Browse Source

ukko: fix javascript interoperation

Conflicts:
	js/expand.js
	js/hide-threads.js
	templates/themes/ukko/ukko.js
pull/40/head
czaks 11 years ago
committed by Michael Foster
parent
commit
45ead9803f
  1. 13
      js/expand.js
  2. 12
      js/hide-threads.js
  3. 7
      js/show-backlinks.js

13
js/expand.js

@ -14,8 +14,9 @@
$(document).ready(function(){ $(document).ready(function(){
if($('div.banner').length != 0) if($('div.banner').length != 0)
return; // not index return; // not index
$('div.post.op span.omitted').each(function() { $('div.post.op span.omitted').each(function() {
var do_expand = function() {
$(this) $(this)
.html($(this).text().replace(_("Click reply to view."), '<a href="javascript:void(0)">'+_("Click to expand")+'</a>.')) .html($(this).text().replace(_("Click reply to view."), '<a href="javascript:void(0)">'+_("Click to expand")+'</a>.'))
.find('a').click(function() { .find('a').click(function() {
@ -50,5 +51,13 @@ $(document).ready(function(){
} }
}); });
}); });
}
$('div.post.op span.omitted').each(do_expand);
$(document).bind("new_post", function(e, post) {
if (!$(post).hasClass("reply")) {
$(post).find('div.post.op span.omitted').each(do_expand);
}
}); });
}); });

12
js/hide-threads.js

@ -41,11 +41,11 @@ $(document).ready(function(){
hidden_data[board] = {}; // id : timestamp hidden_data[board] = {}; // id : timestamp
} }
$('div.post.op').each(function() { var do_hide_threads = function() {
var id = $(this).children('p.intro').children('a.post_no:eq(1)').text(); var id = $(this).children('p.intro').children('a.post_no:eq(1)').text();
var thread_container = $(this).parent(); var thread_container = $(this).parent();
$('<a class="hide-thread-link" style="float:left;margin-right:5px" href="javascript:void(0)">[–]</a><span> </span>') $('<a class="hide-thread-link" style="float:left;margin-right:5px" href="javascript:void(0)">[–]</a><span> </span>')
.insertBefore(thread_container.find(':first')) .insertBefore(thread_container.find(':not(h2,h2 *):first'))
.click(function() { .click(function() {
hidden_data[board][id] = Math.round(Date.now() / 1000); hidden_data[board][id] = Math.round(Date.now() / 1000);
store_data(); store_data();
@ -68,9 +68,15 @@ $(document).ready(function(){
hidden_div.remove(); hidden_div.remove();
}); });
hidden_div.insertAfter(thread_container.find(':first')); hidden_div.insertAfter(thread_container.find(':not(h2,h2 *):first'));
}); });
if (hidden_data[board][id]) if (hidden_data[board][id])
thread_container.find('.hide-thread-link').click(); thread_container.find('.hide-thread-link').click();
}
$('div.post.op').each(do_hide_threads);
$(document).bind('new_post', function(e, post) {
do_hide_threads.call($(post).find('div.post.op')[0]);
}); });
}); });

7
js/show-backlinks.js

@ -48,7 +48,12 @@ onready(function(){
$('div.post.reply').each(showBackLinks); $('div.post.reply').each(showBackLinks);
$(document).bind('new_post', function(e, post) { $(document).bind('new_post', function(e, post) {
showBackLinks.call(post); if ($(post).hasClass("reply")) {
showBackLinks.call(post);
}
else {
$(post).find('div.post.reply').each(showBackLinks);
}
}); });
}); });

Loading…
Cancel
Save