diff --git a/js/auto-reload.js b/js/auto-reload.js index 0bfae3e8..ff015a80 100644 --- a/js/auto-reload.js +++ b/js/auto-reload.js @@ -37,7 +37,30 @@ $(document).ready(function(){ var countdown_interval; // Add an update link - $('.boardlist.bottom').prev().after("["+_("Update")+"] ( "+_("Auto")+") "); + $('.boardlist.bottom').prev().after("["+_("Update")+"] ( "+_("Auto")+") "); + + // Adds Options panel item + if (typeof localStorage.auto_thread_update === 'undefined') { + localStorage.auto_thread_update = 'true'; //default value + } + if (window.Options && Options.get_tab('general')) { + Options.extend_tab('general', ''); + $('#auto-thread-update>input').on('click', function() { + if ($('#auto-thread-update>input').is(':checked')) { + localStorage.auto_thread_update = 'true'; + } else { + localStorage.auto_thread_update = 'false'; + } + }); + if (localStorage.auto_thread_update === 'true') { + $('#show-relative-time>input').prop('checked', true); + } + } + + // Set the updater checkbox according to user setting + if (localStorage.auto_thread_update === 'true') { + $('#auto_update_status').prop('checked', true); + } // Grab the settings var settings = new script_settings('auto-reload'); @@ -51,19 +74,19 @@ $(document).ready(function(){ var end_of_page = false; - var new_posts = 0; + var new_posts = 0; var first_new_post = null; var title = document.title; if (typeof update_title == "undefined") { - var update_title = function() { - if (new_posts) { - document.title = "("+new_posts+") "+title; - } else { - document.title = title; - } - }; + var update_title = function() { + if (new_posts) { + document.title = "("+new_posts+") "+title; + } else { + document.title = title; + } + }; } if (typeof add_title_collector != "undefined") @@ -130,9 +153,9 @@ $(document).ready(function(){ clearInterval(countdown_interval); } - var epoch = (new Date).getTime(); - var epochold = epoch; - + var epoch = (new Date).getTime(); + var epochold = epoch; + var timeDiff = function (delay) { if((epoch-epochold) > delay) { epochold = epoch = (new Date).getTime(); diff --git a/js/expand.js b/js/expand.js index 0fa8de05..c43481ee 100644 --- a/js/expand.js +++ b/js/expand.js @@ -24,7 +24,7 @@ $(document).ready(function(){ var thread = $(this).parents('[id^="thread_"]'); var id = thread.attr('id').replace(/^thread_/, ''); $.ajax({ - url: thread.find('p.intro a.post_no:first').attr('href'), + url: thread.find('div.post:not(.hidden) p.intro a.post_no:first').attr('href'), context: document.body, success: function(data) { var last_expanded = false; diff --git a/js/hide-threads.js b/js/hide-threads.js index 64f0a384..bc1526eb 100644 --- a/js/hide-threads.js +++ b/js/hide-threads.js @@ -87,23 +87,22 @@ $(document).ready(function(){ hidden_data[board] = {}; // id : timestamp } - $(' ') - .insertAfter(post.children('p.intro').children('a.post_no:last')) + $(' ') + .insertBefore(post.children('p.intro').children('input.delete')) .click(function() { hidden_data[board][id] = Math.round(Date.now() / 1000); store_data(); var hide_link = $(this); post.children('div').hide(); hide_link.hide(); - $('[+]') - .insertAfter(post.children('p.intro').children('a.post_no:last')) + $('[+]') + .insertBefore(post.children('p.intro').children('input.delete')) .click(function() { delete hidden_data[board][id]; store_data(); post.children('div').show(); hide_link.show(); $(this).remove(); - }); }); if (hidden_data[board][id]) diff --git a/js/post-hover.js b/js/post-hover.js index aa4f5c60..fab3a45d 100644 --- a/js/post-hover.js +++ b/js/post-hover.js @@ -212,11 +212,17 @@ onready(function(){ if (this.isImage && !this.isSpoiler) { // video files uses jpg for thumbnail - if (this.ext === '.webm' || this.ext === '.mp4') this.ext = '.jpg'; + if (this.ext === '.webm' || this.ext === '.mp4' || this.ext === '.jpeg') this.ext = '.jpg'; thumb_url = '/'+ board +'/thumb/' + this.tim + this.ext; } else { thumb_url = (this.isSpoiler) ? '/static/spoiler.png' : '/static/file.png'; } + + // truncate long filenames + if (this.filename.length > 23) { + this.filename = this.filename.substr(0, 22) + '…'; + } + // file infos var $ele = $('
')
@@ -224,7 +230,7 @@ onready(function(){
.append(''+ this.filename + file_ext +'')
.append(' ('+ bytesToSize(this.fsize) +', '+ this.w +'x'+ this.h +')')
);
- if (multifile) $ele.addClass('multifile').css('max-width', '200px');
+ if (multifile) $ele.addClass('multifile').css('width', this.thumb_w + 30);
// image
var $img = $('')
diff --git a/js/quick-reply.js b/js/quick-reply.js
index 7156b224..9ac1a593 100644
--- a/js/quick-reply.js
+++ b/js/quick-reply.js
@@ -278,7 +278,13 @@
}
});
- $postForm.find('textarea[name="body"]').removeAttr('id').removeAttr('cols').attr('placeholder', _('Comment'));
+ $postForm.find('textarea[name="body"]').removeAttr('id').removeAttr('cols').attr('placeholder', _('Comment'))
+ .on('keydown', function (e) {
+ //close quick reply when esc is prssed
+ if (e.which === 27) {
+ $('.close-btn').trigger('click');
+ }
+ });
$postForm.find('textarea:not([name="body"]),input[type="hidden"]:not(.captcha_cookie)').removeAttr('id').appendTo($dummyStuff);
@@ -373,7 +379,8 @@
} else {
$postForm.show();
}
-
+
+ $postForm.find('textarea[name="body"]').focus();
$(window).on('stylesheet', function() {
do_css();
if ($('link#stylesheet').attr('href')) {
diff --git a/templates/main.js b/templates/main.js
index 254e12c0..e9084703 100644
--- a/templates/main.js
+++ b/templates/main.js
@@ -22,58 +22,58 @@ function fmt(s,a) {
}
function until($timestamp) {
- var $difference = $timestamp - Date.now()/1000|0, $num;
- switch(true){
- case ($difference < 60):
- return "" + $difference + ' ' + _('second(s)');
- case ($difference < 3600): //60*60 = 3600
- return "" + ($num = Math.round($difference/(60))) + ' ' + _('minute(s)');
- case ($difference < 86400): //60*60*24 = 86400
- return "" + ($num = Math.round($difference/(3600))) + ' ' + _('hour(s)');
- case ($difference < 604800): //60*60*24*7 = 604800
- return "" + ($num = Math.round($difference/(86400))) + ' ' + _('day(s)');
- case ($difference < 31536000): //60*60*24*365 = 31536000
- return "" + ($num = Math.round($difference/(604800))) + ' ' + _('week(s)');
- default:
- return "" + ($num = Math.round($difference/(31536000))) + ' ' + _('year(s)');
- }
+ var $difference = $timestamp - Date.now()/1000|0, $num;
+ switch(true){
+ case ($difference < 60):
+ return "" + $difference + ' ' + _('second(s)');
+ case ($difference < 3600): //60*60 = 3600
+ return "" + ($num = Math.round($difference/(60))) + ' ' + _('minute(s)');
+ case ($difference < 86400): //60*60*24 = 86400
+ return "" + ($num = Math.round($difference/(3600))) + ' ' + _('hour(s)');
+ case ($difference < 604800): //60*60*24*7 = 604800
+ return "" + ($num = Math.round($difference/(86400))) + ' ' + _('day(s)');
+ case ($difference < 31536000): //60*60*24*365 = 31536000
+ return "" + ($num = Math.round($difference/(604800))) + ' ' + _('week(s)');
+ default:
+ return "" + ($num = Math.round($difference/(31536000))) + ' ' + _('year(s)');
+ }
}
function ago($timestamp) {
- var $difference = (Date.now()/1000|0) - $timestamp, $num;
- switch(true){
- case ($difference < 60) :
- return "" + $difference + ' ' + _('second(s)');
- case ($difference < 3600): //60*60 = 3600
- return "" + ($num = Math.round($difference/(60))) + ' ' + _('minute(s)');
- case ($difference < 86400): //60*60*24 = 86400
- return "" + ($num = Math.round($difference/(3600))) + ' ' + _('hour(s)');
- case ($difference < 604800): //60*60*24*7 = 604800
- return "" + ($num = Math.round($difference/(86400))) + ' ' + _('day(s)');
- case ($difference < 31536000): //60*60*24*365 = 31536000
- return "" + ($num = Math.round($difference/(604800))) + ' ' + _('week(s)');
- default:
- return "" + ($num = Math.round($difference/(31536000))) + ' ' + _('year(s)');
- }
+ var $difference = (Date.now()/1000|0) - $timestamp, $num;
+ switch(true){
+ case ($difference < 60) :
+ return "" + $difference + ' ' + _('second(s)');
+ case ($difference < 3600): //60*60 = 3600
+ return "" + ($num = Math.round($difference/(60))) + ' ' + _('minute(s)');
+ case ($difference < 86400): //60*60*24 = 86400
+ return "" + ($num = Math.round($difference/(3600))) + ' ' + _('hour(s)');
+ case ($difference < 604800): //60*60*24*7 = 604800
+ return "" + ($num = Math.round($difference/(86400))) + ' ' + _('day(s)');
+ case ($difference < 31536000): //60*60*24*365 = 31536000
+ return "" + ($num = Math.round($difference/(604800))) + ' ' + _('week(s)');
+ default:
+ return "" + ($num = Math.round($difference/(31536000))) + ' ' + _('year(s)');
+ }
}
var datelocale =
- { days: [_('Sunday'), _('Monday'), _('Tuesday'), _('Wednesday'), _('Thursday'), _('Friday'), _('Saturday')]
- , shortDays: [_("Sun"), _("Mon"), _("Tue"), _("Wed"), _("Thu"), _("Fri"), _("Sat")]
- , months: [_('January'), _('February'), _('March'), _('April'), _('May'), _('June'), _('July'), _('August'), _('September'), _('October'), _('November'), _('December')]
- , shortMonths: [_('Jan'), _('Feb'), _('Mar'), _('Apr'), _('May'), _('Jun'), _('Jul'), _('Aug'), _('Sep'), _('Oct'), _('Nov'), _('Dec')]
- , AM: _('AM')
- , PM: _('PM')
- , am: _('am')
- , pm: _('pm')
- };
+ { days: [_('Sunday'), _('Monday'), _('Tuesday'), _('Wednesday'), _('Thursday'), _('Friday'), _('Saturday')]
+ , shortDays: [_("Sun"), _("Mon"), _("Tue"), _("Wed"), _("Thu"), _("Fri"), _("Sat")]
+ , months: [_('January'), _('February'), _('March'), _('April'), _('May'), _('June'), _('July'), _('August'), _('September'), _('October'), _('November'), _('December')]
+ , shortMonths: [_('Jan'), _('Feb'), _('Mar'), _('Apr'), _('May'), _('Jun'), _('Jul'), _('Aug'), _('Sep'), _('Oct'), _('Nov'), _('Dec')]
+ , AM: _('AM')
+ , PM: _('PM')
+ , am: _('am')
+ , pm: _('pm')
+ };
function alert(a) {
var handler, div;
var close = function() {
- handler.fadeOut(400, function() { handler.remove(); });
- return false;
+ handler.fadeOut(400, function() { handler.remove(); });
+ return false;
};
handler = $("