From 61a305a1a27d414072b0de24441c07b1630c3075 Mon Sep 17 00:00:00 2001 From: czaks Date: Wed, 3 Jul 2013 01:04:08 -0400 Subject: js i18n: misc fixes; quick-reply.js i18n Conflicts: tools/i18n_compile.php --- js/quick-reply.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'js') diff --git a/js/quick-reply.js b/js/quick-reply.js index bc36ca48..ea504b48 100644 --- a/js/quick-reply.js +++ b/js/quick-reply.js @@ -17,7 +17,7 @@ $(document).ready(function(){ return; // not index txt_new_topic = $('form[name=post] input[type=submit]').val(); - txt_new_reply = txt_new_topic == 'Submit' ? txt_new_topic : new_reply_string; + txt_new_reply = txt_new_topic == _('Submit') ? txt_new_topic : new_reply_string; undo_quick_reply = function() { $('div.banner').remove(); @@ -27,9 +27,9 @@ $(document).ready(function(){ $('div.post.op').each(function() { var id = $(this).children('p.intro').children('a.post_no:eq(1)').text(); - $('[Quick reply]').insertAfter($(this).children('p.intro').children('a:last')).click(function() { + $('['+_("Quick reply")+']').insertAfter($(this).children('p.intro').children('a:last')).click(function() { $('div.banner').remove(); - $('') + $('') .insertBefore('form[name=post]'); $('form[name=post] input[type=submit]').val(txt_new_reply); -- cgit v1.3 From f98d5bdd180d7452e82d7e35dcd7e3372ccd2aab Mon Sep 17 00:00:00 2001 From: czaks Date: Tue, 2 Jul 2013 20:58:16 -0400 Subject: local-time.js: make it work in localised environments --- js/local-time.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js') diff --git a/js/local-time.js b/js/local-time.js index b92cc5be..bb81c83a 100644 --- a/js/local-time.js +++ b/js/local-time.js @@ -25,13 +25,13 @@ onready(function(){ var times = document.getElementsByTagName('time'); for(var i = 0; i < times.length; i++) { - if(!times[i].innerHTML.match(/^\d+\/\d+\/\d+ \(\w+\) \d+:\d+:\d+$/)) + if(typeof times[i].getAttribute('data-local') == 'undefined') continue; var t = iso8601(times[i].getAttribute('datetime')); - + times[i].setAttribute('data-local', 'true'); times[i].innerHTML = // date zeropad(t.getMonth() + 1, 2) + "/" + zeropad(t.getDate(), 2) + "/" + t.getFullYear().toString().substring(2) + -- cgit v1.3 From 46ebcbf51d99cd439906cf63a5bf4cefe5ddce45 Mon Sep 17 00:00:00 2001 From: czaks Date: Tue, 2 Jul 2013 21:09:05 -0400 Subject: local-time.js: make it work with thread expand etc; BEWARE IT NOW NEEDS JQUERY TO BE LOADED BEFORE --- js/local-time.js | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) (limited to 'js') diff --git a/js/local-time.js b/js/local-time.js index bb81c83a..aee26ed2 100644 --- a/js/local-time.js +++ b/js/local-time.js @@ -6,6 +6,7 @@ * Copyright (c) 2012 Michael Save * * Usage: + * $config['additional_javascript'][] = 'js/jquery.min.js'; * $config['additional_javascript'][] = 'js/local-time.js'; * */ @@ -21,23 +22,32 @@ onready(function(){ var zeropad = function(num, count) { return [Math.pow(10, count - num.toString().length), num].join('').substr(1); }; + + var do_localtime = function(elem) { + var times = elem.getElementsByTagName('time'); - var times = document.getElementsByTagName('time'); - - for(var i = 0; i < times.length; i++) { - if(typeof times[i].getAttribute('data-local') == 'undefined') - continue; + for(var i = 0; i < times.length; i++) { + if(typeof times[i].getAttribute('data-local') == 'undefined') + continue; - var t = iso8601(times[i].getAttribute('datetime')); + var t = iso8601(times[i].getAttribute('datetime')); - times[i].setAttribute('data-local', 'true'); - times[i].innerHTML = - // date - zeropad(t.getMonth() + 1, 2) + "/" + zeropad(t.getDate(), 2) + "/" + t.getFullYear().toString().substring(2) + - " (" + ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"][t.getDay()] + ") " + - // time - zeropad(t.getHours(), 2) + ":" + zeropad(t.getMinutes(), 2) + ":" + zeropad(t.getSeconds(), 2); + times[i].setAttribute('data-local', 'true'); + times[i].innerHTML = + // date + zeropad(t.getMonth() + 1, 2) + "/" + zeropad(t.getDate(), 2) + "/" + t.getFullYear().toString().substring(2) + + " (" + ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"][t.getDay()] + ") " + + // time + zeropad(t.getHours(), 2) + ":" + zeropad(t.getMinutes(), 2) + ":" + zeropad(t.getSeconds(), 2); + }; }; + + do_localtime(document); + + // allow to work with auto-reload.js, etc. + $(document).bind('new_post', function(e, post) { + do_localtime(post); + }); }); -- cgit v1.3 From 0a97cf721584e352806354e2c5c6392175d89d7c Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Wed, 31 Jul 2013 04:37:07 -0400 Subject: js/local-time.js: Make jQuery optional --- js/local-time.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'js') diff --git a/js/local-time.js b/js/local-time.js index aee26ed2..40869c3a 100644 --- a/js/local-time.js +++ b/js/local-time.js @@ -6,7 +6,7 @@ * Copyright (c) 2012 Michael Save * * Usage: - * $config['additional_javascript'][] = 'js/jquery.min.js'; + * // $config['additional_javascript'][] = 'js/jquery.min.js'; * $config['additional_javascript'][] = 'js/local-time.js'; * */ @@ -44,10 +44,12 @@ onready(function(){ }; do_localtime(document); - - // allow to work with auto-reload.js, etc. - $(document).bind('new_post', function(e, post) { - do_localtime(post); - }); + + if (window.jQuery) { + // allow to work with auto-reload.js, etc. + $(document).bind('new_post', function(e, post) { + do_localtime(post); + }); + } }); -- cgit v1.3 From 4922828e35eca8b28135a681a6f5d0e9a93641fd Mon Sep 17 00:00:00 2001 From: czaks Date: Wed, 3 Jul 2013 01:17:56 -0400 Subject: js i18n: expand.js --- js/expand.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js') diff --git a/js/expand.js b/js/expand.js index 6e5fa659..d5706643 100644 --- a/js/expand.js +++ b/js/expand.js @@ -17,7 +17,7 @@ $(document).ready(function(){ $('div.post.op span.omitted').each(function() { $(this) - .html($(this).text().replace(/Click reply to view\./, 'Click to expand.')) + .html($(this).text().replace(_("Click reply to view."), ''+_("Click to expand")+'.')) .find('a').click(function() { var thread = $(this).parent().parent().parent(); var id = thread.attr('id').replace(/^thread_/, ''); @@ -40,7 +40,7 @@ $(document).ready(function(){ last_expanded = post_in_doc; } }); - $('Hide expanded replies.') + $('' + _('Hide expanded replies') + '.') .insertAfter(thread.find('span.omitted').css('display', 'none')) .click(function() { thread.find('.expanded').remove(); -- cgit v1.3 From 2779db56cb080d1837d216d3c1f9b8c6aa013f08 Mon Sep 17 00:00:00 2001 From: Marcin Łabanowski Date: Sat, 29 Dec 2012 16:30:46 +0100 Subject: smartphone-spoiler.js: add windows phone/tablet user agents --- js/smartphone-spoiler.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js') diff --git a/js/smartphone-spoiler.js b/js/smartphone-spoiler.js index ede273e4..54c7a9a1 100644 --- a/js/smartphone-spoiler.js +++ b/js/smartphone-spoiler.js @@ -11,7 +11,7 @@ */ onready(function(){ - if(navigator.userAgent.match(/iPhone|iPod|iPad|Android|Opera Mini|Blackberry|PlayBook/i)) { + if(navigator.userAgent.match(/iPhone|iPod|iPad|Android|Opera Mini|Blackberry|PlayBook|Windows Phone|Tablet PC|Windows CE|IEMobile/i)) { var spoilers = document.getElementsByClassName('spoiler'); for(var i = 0; i < spoilers.length; i++) { spoilers[i].onmousedown = function() { -- cgit v1.3 From fee73c2087dcac126c430bae905ed4ff24784c35 Mon Sep 17 00:00:00 2001 From: czaks Date: Wed, 3 Jul 2013 01:27:09 -0400 Subject: js i18n: local-time.js --- js/local-time.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js') diff --git a/js/local-time.js b/js/local-time.js index 40869c3a..d581e304 100644 --- a/js/local-time.js +++ b/js/local-time.js @@ -37,7 +37,7 @@ onready(function(){ times[i].innerHTML = // date zeropad(t.getMonth() + 1, 2) + "/" + zeropad(t.getDate(), 2) + "/" + t.getFullYear().toString().substring(2) + - " (" + ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"][t.getDay()] + ") " + + " (" + [_("Sun"), _("Mon"), _("Tue"), _("Wed"), _("Thu"), _("Fri"), _("Sat"), _("Sun")][t.getDay()] + ") " + // time zeropad(t.getHours(), 2) + ":" + zeropad(t.getMinutes(), 2) + ":" + zeropad(t.getSeconds(), 2); }; -- cgit v1.3 From bf4eca82b60f8ecd30f529164eb9f65872746608 Mon Sep 17 00:00:00 2001 From: czaks Date: Wed, 3 Jul 2013 01:40:23 -0400 Subject: js i18n: hide-locked-threads.js i18n --- js/toggle-locked-threads.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js') diff --git a/js/toggle-locked-threads.js b/js/toggle-locked-threads.js index 50c44eda..1d517a4d 100644 --- a/js/toggle-locked-threads.js +++ b/js/toggle-locked-threads.js @@ -36,7 +36,7 @@ $(document).ready(function(){ $('hr:first').before(''); $('div#toggle-locked-threads a') - .text((hide_locked_threads ? 'Show' : 'Hide') + ' locked threads') + .text(hide_locked_threads ? _('Show locked threads') : _('Hide locked threads')) .click(function() { hide_locked_threads = !hide_locked_threads; if (hide_locked_threads) { @@ -51,7 +51,7 @@ $(document).ready(function(){ delete localStorage.hidelockedthreads; } - $(this).text((hide_locked_threads ? 'Show' : 'Hide') + ' locked threads') + $(this).text(hide_locked_threads ? _('Show locked threads') : _('Hide locked threads')) }); if (hide_locked_threads) { -- cgit v1.3 From 223624892a8cf9cb6f41f6b83927f2d12f00246c Mon Sep 17 00:00:00 2001 From: czaks Date: Wed, 3 Jul 2013 01:48:24 -0400 Subject: js i18n: forced-anon.js --- js/forced-anon.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'js') diff --git a/js/forced-anon.js b/js/forced-anon.js index 3dbf0dfc..6ae43882 100644 --- a/js/forced-anon.js +++ b/js/forced-anon.js @@ -56,17 +56,17 @@ $(document).ready(function() { forced_anon = localStorage['forcedanon'] ? true : false; $('hr:first').before(''); - $('div#forced-anon a').text('Forced anonymity (' + (forced_anon ? 'enabled' : 'disabled') + ')'); + $('div#forced-anon a').text(_('Forced anonymity')+' (' + (forced_anon ? _('enabled') : _('disabled')) + ')'); $('div#forced-anon a').click(function() { forced_anon = !forced_anon; if(forced_anon) { - $('div#forced-anon a').text('Forced anonymity (enabled)'); + $('div#forced-anon a').text(_('Forced anonymity')+' ('+_('enabled')+')'); localStorage.forcedanon = true; enable_fa(); } else { - $('div#forced-anon a').text('Forced anonymity (disabled)'); + $('div#forced-anon a').text(_('Forced anonymity')+' ('+_('disabled')+')'); delete localStorage.forcedanon; disable_fa(); } -- cgit v1.3 From a1b739b818eef2aa17846cd171f04e21dc7d34e4 Mon Sep 17 00:00:00 2001 From: czaks Date: Wed, 3 Jul 2013 01:55:43 -0400 Subject: js i18n: quick-post-controls.js --- js/quick-post-controls.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'js') diff --git a/js/quick-post-controls.js b/js/quick-post-controls.js index 0c164bbb..c28f874f 100644 --- a/js/quick-post-controls.js +++ b/js/quick-post-controls.js @@ -24,17 +24,17 @@ $(document).ready(function(){ '' + - ': ' + + ': ' + '' + - '' + - '' + - ' ' + + '' + + '' + + ' ' + '
' + - ': ' + + ': ' + '' + - ' ' + + ' ' + '' + ''); post_form -- cgit v1.3 From e648121e4ad07aadec7579d62a56190ca19d3fe5 Mon Sep 17 00:00:00 2001 From: czaks Date: Sat, 27 Jul 2013 01:12:22 -0400 Subject: hide-images.js: javascript i18n --- js/hide-images.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js') diff --git a/js/hide-images.js b/js/hide-images.js index 7344cd8f..365ebac6 100644 --- a/js/hide-images.js +++ b/js/hide-images.js @@ -47,13 +47,13 @@ $(document).ready(function(){ var fileinfo = $(this).parent().prev(); var id = $(this).parent().parent().find('>p.intro>a.post_no:eq(1),>div.post.op>p.intro>a.post_no:eq(1)').text(); - var replacement = $('File (hide): '); + var replacement = $(''+_('File')+' ('+_('hide')+'): '); replacement.find('a').click(function() { hidden_data[board][id] = Math.round(Date.now() / 1000); store_data(); - var show_link = $('show').click(function() { + var show_link = $(''+_('show')+'').click(function() { delete hidden_data[board][id]; store_data(); -- cgit v1.3 From 2868dd7886082cfb11fcbe8f8bee1108a48c81a3 Mon Sep 17 00:00:00 2001 From: czaks Date: Sat, 15 Jun 2013 01:39:39 -0400 Subject: javascripts: fixed interactions (BEWARE, inline-expanding.js now requires jquery! fix your configs) Conflicts: js/expand.js js/inline-expanding.js --- js/expand.js | 4 ++-- js/inline-expanding.js | 5 ++--- js/show-backlinks.js | 4 ++++ 3 files changed, 8 insertions(+), 5 deletions(-) (limited to 'js') diff --git a/js/expand.js b/js/expand.js index d5706643..f2cfdc5e 100644 --- a/js/expand.js +++ b/js/expand.js @@ -14,7 +14,7 @@ $(document).ready(function(){ if($('div.banner').length != 0) return; // not index - + $('div.post.op span.omitted').each(function() { $(this) .html($(this).text().replace(_("Click reply to view."), ''+_("Click to expand")+'.')) @@ -51,4 +51,4 @@ $(document).ready(function(){ }); }); }); -}); +}); \ No newline at end of file diff --git a/js/inline-expanding.js b/js/inline-expanding.js index 20383f04..e529a395 100644 --- a/js/inline-expanding.js +++ b/js/inline-expanding.js @@ -14,7 +14,7 @@ onready(function(){ var inline_expand_post = function() { var link = this.getElementsByTagName('a'); - + for (var i = 0; i < link.length; i++) { if (typeof link[i] == "object" && link[i].childNodes && typeof link[i].childNodes[0] !== 'undefined' && link[i].childNodes[0].src && link[i].className != 'file') { link[i].childNodes[0].style.maxWidth = '95%'; @@ -54,7 +54,7 @@ onready(function(){ if (window.jQuery) { $('div[id^="thread_"]').each(inline_expand_post); - + // allow to work with auto-reload.js, etc. $(document).bind('new_post', function(e, post) { inline_expand_post.call(post); @@ -64,4 +64,3 @@ onready(function(){ } }); - diff --git a/js/show-backlinks.js b/js/show-backlinks.js index e6e17e4f..4ead494b 100644 --- a/js/show-backlinks.js +++ b/js/show-backlinks.js @@ -46,5 +46,9 @@ onready(function(){ }; $('div.post.reply').each(showBackLinks); + + $(document).bind('new_post', function(e, post) { + showBackLinks.call(post); + }); }); -- cgit v1.3 From 45ead9803f01c2cb84b11b3747e432737af27595 Mon Sep 17 00:00:00 2001 From: czaks Date: Sat, 27 Jul 2013 00:57:12 -0400 Subject: ukko: fix javascript interoperation Conflicts: js/expand.js js/hide-threads.js templates/themes/ukko/ukko.js --- js/expand.js | 13 +++++++++++-- js/hide-threads.js | 12 +++++++++--- js/show-backlinks.js | 7 ++++++- 3 files changed, 26 insertions(+), 6 deletions(-) (limited to 'js') diff --git a/js/expand.js b/js/expand.js index f2cfdc5e..07ce9e43 100644 --- a/js/expand.js +++ b/js/expand.js @@ -14,8 +14,9 @@ $(document).ready(function(){ if($('div.banner').length != 0) return; // not index - $('div.post.op span.omitted').each(function() { + + var do_expand = function() { $(this) .html($(this).text().replace(_("Click reply to view."), ''+_("Click to expand")+'.')) .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); + } }); -}); \ No newline at end of file +}); diff --git a/js/hide-threads.js b/js/hide-threads.js index faa1289c..575804b6 100644 --- a/js/hide-threads.js +++ b/js/hide-threads.js @@ -41,11 +41,11 @@ $(document).ready(function(){ 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 thread_container = $(this).parent(); $('[–] ') - .insertBefore(thread_container.find(':first')) + .insertBefore(thread_container.find(':not(h2,h2 *):first')) .click(function() { hidden_data[board][id] = Math.round(Date.now() / 1000); store_data(); @@ -68,9 +68,15 @@ $(document).ready(function(){ 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]) 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]); }); }); diff --git a/js/show-backlinks.js b/js/show-backlinks.js index 4ead494b..f23cfc38 100644 --- a/js/show-backlinks.js +++ b/js/show-backlinks.js @@ -48,7 +48,12 @@ onready(function(){ $('div.post.reply').each(showBackLinks); $(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); + } }); }); -- cgit v1.3