mirror of
https://github.com/vichan-devel/vichan.git
synced 2025-02-02 21:07:20 +01:00
Merge pull request #873 from Zankaria/cleanup-pre-mobile-ui
Cleanup pre mobile UI
This commit is contained in:
commit
f39988229a
@ -17,38 +17,37 @@
|
|||||||
*
|
*
|
||||||
* You must have boardlinks or else this script will not load.
|
* You must have boardlinks or else this script will not load.
|
||||||
* Search for "$config['boards'] = array(" within your inc/config.php and add something similar to your instance-config.php.
|
* Search for "$config['boards'] = array(" within your inc/config.php and add something similar to your instance-config.php.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
auto_reload_enabled = true; // For watch.js to interop.
|
||||||
auto_reload_enabled = true; // for watch.js to interop
|
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
if($('div.banner').length == 0)
|
if($('div.banner').length == 0) {
|
||||||
return; // not index
|
// Not index.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if($(".post.op").size() != 1)
|
if($(".post.op").size() != 1) {
|
||||||
return; //not thread page
|
// Not thread page.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var countdown_interval;
|
var countdown_interval;
|
||||||
|
|
||||||
// Add an update link
|
// Add an update link.
|
||||||
$('.boardlist.bottom').prev().after("<span id='updater'><a href='#' id='update_thread' style='padding-left:10px'>["+_("Update")+"]</a> (<input type='checkbox' id='auto_update_status' checked> "+_("Auto")+") <span id='update_secs'></span></span>");
|
$('.boardlist.bottom').prev().after("<span id='updater'><a href='#' id='update_thread' style='padding-left:10px'>["+_("Update")+"]</a> (<input type='checkbox' id='auto_update_status' checked> "+_("Auto")+") <span id='update_secs'></span></span>");
|
||||||
|
|
||||||
// Grab the settings
|
// Grab the settings.
|
||||||
var settings = new script_settings('auto-reload');
|
var settings = new script_settings('auto-reload');
|
||||||
var poll_interval_mindelay = settings.get('min_delay_bottom', 5000);
|
var poll_interval_mindelay = settings.get('min_delay_bottom', 5000);
|
||||||
var poll_interval_maxdelay = settings.get('max_delay', 600000);
|
var poll_interval_maxdelay = settings.get('max_delay', 600000);
|
||||||
var poll_interval_errordelay = settings.get('error_delay', 30000);
|
var poll_interval_errordelay = settings.get('error_delay', 30000);
|
||||||
|
|
||||||
// number of ms to wait before reloading
|
// number of ms to wait before reloading.
|
||||||
var poll_interval_delay = poll_interval_mindelay;
|
var poll_interval_delay = poll_interval_mindelay;
|
||||||
var poll_current_time = poll_interval_delay;
|
var poll_current_time = poll_interval_delay;
|
||||||
|
|
||||||
var end_of_page = false;
|
|
||||||
|
|
||||||
var new_posts = 0;
|
var new_posts = 0;
|
||||||
var first_new_post = null;
|
|
||||||
|
|
||||||
var title = document.title;
|
var title = document.title;
|
||||||
|
|
||||||
@ -62,17 +61,18 @@ $(document).ready(function(){
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof add_title_collector != "undefined")
|
if (typeof add_title_collector != "undefined") {
|
||||||
add_title_collector(function(){
|
add_title_collector(function() {
|
||||||
return new_posts;
|
return new_posts;
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
var window_active = true;
|
var window_active = true;
|
||||||
$(window).focus(function() {
|
$(window).focus(function() {
|
||||||
window_active = true;
|
window_active = true;
|
||||||
recheck_activated();
|
recheck_activated();
|
||||||
|
|
||||||
// Reset the delay if needed
|
// Reset the delay if needed.
|
||||||
if(settings.get('reset_focus', true)) {
|
if(settings.get('reset_focus', true)) {
|
||||||
poll_interval_delay = poll_interval_mindelay;
|
poll_interval_delay = poll_interval_mindelay;
|
||||||
}
|
}
|
||||||
@ -89,7 +89,6 @@ $(document).ready(function(){
|
|||||||
stop_auto_update();
|
stop_auto_update();
|
||||||
$('#update_secs').text("");
|
$('#update_secs').text("");
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -110,7 +109,6 @@ $(document).ready(function(){
|
|||||||
new_posts = 0;
|
new_posts = 0;
|
||||||
}
|
}
|
||||||
update_title();
|
update_title();
|
||||||
first_new_post = null;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// automatically updates the thread after a specified delay
|
// automatically updates the thread after a specified delay
|
||||||
@ -130,10 +128,10 @@ $(document).ready(function(){
|
|||||||
var epochold = epoch;
|
var epochold = epoch;
|
||||||
|
|
||||||
var timeDiff = function (delay) {
|
var timeDiff = function (delay) {
|
||||||
if((epoch-epochold) > delay) {
|
if ((epoch-epochold) > delay) {
|
||||||
epochold = epoch = (new Date).getTime();
|
epochold = epoch = (new Date).getTime();
|
||||||
return true;
|
return true;
|
||||||
}else{
|
} else {
|
||||||
epoch = (new Date).getTime();
|
epoch = (new Date).getTime();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -152,9 +150,6 @@ $(document).ready(function(){
|
|||||||
$(data).find('div.post.reply').each(function() {
|
$(data).find('div.post.reply').each(function() {
|
||||||
var id = $(this).attr('id');
|
var id = $(this).attr('id');
|
||||||
if($('#' + id).length == 0) {
|
if($('#' + id).length == 0) {
|
||||||
if (!new_posts) {
|
|
||||||
first_new_post = this;
|
|
||||||
}
|
|
||||||
new_posts++;
|
new_posts++;
|
||||||
loaded_posts++;
|
loaded_posts++;
|
||||||
elementsToAppend.push($(this));
|
elementsToAppend.push($(this));
|
||||||
@ -225,16 +220,14 @@ $(document).ready(function(){
|
|||||||
$(window).scroll(function() {
|
$(window).scroll(function() {
|
||||||
recheck_activated();
|
recheck_activated();
|
||||||
|
|
||||||
// if the newest post is not visible
|
// If the newest post is not visible.
|
||||||
if($(this).scrollTop() + $(this).height() <
|
if($(this).scrollTop() + $(this).height() <
|
||||||
$('div.post:last').position().top + $('div.post:last').height()) {
|
$('div.post:last').position().top + $('div.post:last').height()) {
|
||||||
end_of_page = false;
|
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
if($("#auto_update_status").is(':checked') && timeDiff(poll_interval_mindelay)) {
|
if($("#auto_update_status").is(':checked') && timeDiff(poll_interval_mindelay)) {
|
||||||
poll(manualUpdate = true);
|
poll(manualUpdate = true);
|
||||||
}
|
}
|
||||||
end_of_page = true;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
47
js/expand.js
47
js/expand.js
@ -10,60 +10,61 @@
|
|||||||
* Usage:
|
* Usage:
|
||||||
* $config['additional_javascript'][] = 'js/jquery.min.js';
|
* $config['additional_javascript'][] = 'js/jquery.min.js';
|
||||||
* $config['additional_javascript'][] = 'js/expand.js';
|
* $config['additional_javascript'][] = 'js/expand.js';
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function() {
|
||||||
if($('span.omitted').length == 0)
|
if ($('span.omitted').length === 0) {
|
||||||
return; // nothing to expand
|
// Nothing to expand.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var do_expand = function() {
|
let doExpand = 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(window.expand_fun = function() {
|
.find('a').click(window.expandFun = function() {
|
||||||
var thread = $(this).parents('[id^="thread_"]');
|
let thread = $(this).parents('[id^="thread_"]');
|
||||||
var id = thread.attr('id').replace(/^thread_/, '');
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: thread.find('p.intro a.post_no:first').attr('href'),
|
url: thread.find('p.intro a.post_no:first').attr('href'),
|
||||||
context: document.body,
|
context: document.body,
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
var last_expanded = false;
|
let lastExpanded = false;
|
||||||
$(data).find('div.post.reply').each(function() {
|
$(data).find('div.post.reply').each(function() {
|
||||||
thread.find('div.hidden').remove();
|
thread.find('div.hidden').remove();
|
||||||
var post_in_doc = thread.find('#' + $(this).attr('id'));
|
let postInDoc = thread.find('#' + $(this).attr('id'));
|
||||||
if(post_in_doc.length == 0) {
|
if (postInDoc.length === 0) {
|
||||||
if(last_expanded) {
|
if (lastExpanded) {
|
||||||
$(this).addClass('expanded').insertAfter(last_expanded).before('<br class="expanded">');
|
$(this).addClass('expanded').insertAfter(lastExpanded).before('<br class="expanded">');
|
||||||
} else {
|
} else {
|
||||||
$(this).addClass('expanded').insertAfter(thread.find('div.post:first')).after('<br class="expanded">');
|
$(this).addClass('expanded').insertAfter(thread.find('div.post:first')).after('<br class="expanded">');
|
||||||
}
|
}
|
||||||
last_expanded = $(this);
|
lastExpanded = $(this);
|
||||||
$(document).trigger('new_post', this);
|
$(document).trigger('new_post', this);
|
||||||
} else {
|
} else {
|
||||||
last_expanded = post_in_doc;
|
lastExpanded = postInDoc;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
thread.find("span.omitted").css('display', 'none');
|
thread.find('span.omitted').css('display', 'none');
|
||||||
|
|
||||||
$('<span class="omitted hide-expanded"><a href="javascript:void(0)">' + _('Hide expanded replies') + '</a>.</span>')
|
$('<span class="omitted hide-expanded"><a href="javascript:void(0)">' + _('Hide expanded replies') + '</a>.</span>')
|
||||||
.insertAfter(thread.find('.op div.body, .op span.omitted').last())
|
.insertAfter(thread.find('.op div.body, .op span.omitted').last())
|
||||||
.click(function() {
|
.click(function() {
|
||||||
thread.find('.expanded').remove();
|
thread.find('.expanded').remove();
|
||||||
$(this).parent().find(".omitted:not(.hide-expanded)").css('display', '');
|
let parent = $(this).parent();
|
||||||
$(this).parent().find(".hide-expanded").remove();
|
parent.find('.omitted:not(.hide-expanded)').css('display', '');
|
||||||
|
parent.find('.hide-expanded').remove();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$('div.post.op span.omitted').each(do_expand);
|
$('div.post.op span.omitted').each(doExpand);
|
||||||
|
|
||||||
$(document).on("new_post", function(e, post) {
|
$(document).on('new_post', function(e, post) {
|
||||||
if (!$(post).hasClass("reply")) {
|
if (!$(post).hasClass('reply')) {
|
||||||
$(post).find('div.post.op span.omitted').each(do_expand);
|
$(post).find('div.post.op span.omitted').each(doExpand);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -9,31 +9,31 @@
|
|||||||
* Usage:
|
* Usage:
|
||||||
* $config['additional_javascript'][] = 'js/jquery.min.js';
|
* $config['additional_javascript'][] = 'js/jquery.min.js';
|
||||||
* $config['additional_javascript'][] = 'js/inline-expanding.js';
|
* $config['additional_javascript'][] = 'js/inline-expanding.js';
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function() {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var DEFAULT_MAX = 5; // default maximum image loads
|
// Default maximum image loads.
|
||||||
var inline_expand_post = function() {
|
const DEFAULT_MAX = 5;
|
||||||
var link = this.getElementsByTagName('a');
|
|
||||||
|
|
||||||
var loadingQueue = (function () {
|
let inline_expand_post = function() {
|
||||||
var MAX_IMAGES = localStorage.inline_expand_max || DEFAULT_MAX; // maximum number of images to load concurrently, 0 to disable
|
let link = this.getElementsByTagName('a');
|
||||||
var loading = 0; // number of images that is currently loading
|
|
||||||
var waiting = []; // waiting queue
|
|
||||||
|
|
||||||
var enqueue = function (ele) {
|
let loadingQueue = (function() {
|
||||||
|
let MAX_IMAGES = localStorage.inline_expand_max || DEFAULT_MAX; // Maximum number of images to load concurrently, 0 to disable.
|
||||||
|
let loading = 0; // Number of images that is currently loading.
|
||||||
|
let waiting = []; // Waiting queue.
|
||||||
|
|
||||||
|
let enqueue = function(ele) {
|
||||||
waiting.push(ele);
|
waiting.push(ele);
|
||||||
};
|
};
|
||||||
var dequeue = function () {
|
let dequeue = function() {
|
||||||
return waiting.shift();
|
return waiting.shift();
|
||||||
};
|
};
|
||||||
var update = function() {
|
let update = function() {
|
||||||
var ele;
|
|
||||||
while (loading < MAX_IMAGES || MAX_IMAGES === 0) {
|
while (loading < MAX_IMAGES || MAX_IMAGES === 0) {
|
||||||
ele = dequeue();
|
let ele = dequeue();
|
||||||
if (ele) {
|
if (ele) {
|
||||||
++loading;
|
++loading;
|
||||||
ele.deferred.resolve();
|
ele.deferred.resolve();
|
||||||
@ -43,8 +43,8 @@ $(document).ready(function(){
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
return {
|
return {
|
||||||
remove: function (ele) {
|
remove: function(ele) {
|
||||||
var i = waiting.indexOf(ele);
|
let i = waiting.indexOf(ele);
|
||||||
if (i > -1) {
|
if (i > -1) {
|
||||||
waiting.splice(i, 1);
|
waiting.splice(i, 1);
|
||||||
}
|
}
|
||||||
@ -54,14 +54,14 @@ $(document).ready(function(){
|
|||||||
--loading;
|
--loading;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
add: function (ele) {
|
add: function(ele) {
|
||||||
ele.deferred = $.Deferred();
|
ele.deferred = $.Deferred();
|
||||||
ele.deferred.done(function () {
|
ele.deferred.done(function () {
|
||||||
var $loadstart = $.Deferred();
|
let $loadstart = $.Deferred();
|
||||||
var thumb = ele.childNodes[0];
|
let thumb = ele.childNodes[0];
|
||||||
var img = ele.childNodes[1];
|
let img = ele.childNodes[1];
|
||||||
|
|
||||||
var onLoadStart = function (img) {
|
let onLoadStart = function (img) {
|
||||||
if (img.naturalWidth) {
|
if (img.naturalWidth) {
|
||||||
$loadstart.resolve(img, thumb);
|
$loadstart.resolve(img, thumb);
|
||||||
} else {
|
} else {
|
||||||
@ -71,7 +71,7 @@ $(document).ready(function(){
|
|||||||
|
|
||||||
$(img).one('load', function () {
|
$(img).one('load', function () {
|
||||||
$.when($loadstart).done(function () {
|
$.when($loadstart).done(function () {
|
||||||
// once fully loaded, update the waiting queue
|
// Once fully loaded, update the waiting queue.
|
||||||
--loading;
|
--loading;
|
||||||
$(ele).data('imageLoading', 'false');
|
$(ele).data('imageLoading', 'false');
|
||||||
update();
|
update();
|
||||||
@ -93,35 +93,36 @@ $(document).ready(function(){
|
|||||||
} else {
|
} else {
|
||||||
enqueue(ele);
|
enqueue(ele);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
for (var i = 0; i < link.length; i++) {
|
for (let i = 0; i < link.length; i++) {
|
||||||
if (typeof link[i] == "object" && link[i].childNodes && typeof link[i].childNodes[0] !== 'undefined' &&
|
if (typeof link[i] == "object" && link[i].childNodes && typeof link[i].childNodes[0] !== 'undefined' &&
|
||||||
link[i].childNodes[0].src && link[i].childNodes[0].className.match(/post-image/) && !link[i].className.match(/file/)) {
|
link[i].childNodes[0].src && link[i].childNodes[0].className.match(/post-image/) && !link[i].className.match(/file/)) {
|
||||||
link[i].onclick = function(e) {
|
link[i].onclick = function(e) {
|
||||||
var img, post_body, still_open, canvas, scroll;
|
let thumb = this.childNodes[0];
|
||||||
var thumb = this.childNodes[0];
|
let padding = 5;
|
||||||
var padding = 5;
|
let boardlist = $('.boardlist')[0];
|
||||||
var boardlist = $('.boardlist')[0];
|
|
||||||
|
|
||||||
|
|
||||||
if (thumb.className == 'hidden')
|
if (thumb.className == 'hidden') {
|
||||||
return false;
|
return false;
|
||||||
if (e.which == 2 || e.ctrlKey) // open in new tab
|
}
|
||||||
|
if (e.which == 2 || e.ctrlKey) {
|
||||||
|
// Open in new tab.
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
if (!$(this).data('expanded')) {
|
if (!$(this).data('expanded')) {
|
||||||
|
if (~this.parentNode.className.indexOf('multifile')) {
|
||||||
if (~this.parentNode.className.indexOf('multifile'))
|
|
||||||
$(this).data('width', this.parentNode.style.width);
|
$(this).data('width', this.parentNode.style.width);
|
||||||
|
}
|
||||||
|
|
||||||
this.parentNode.removeAttribute('style');
|
this.parentNode.removeAttribute('style');
|
||||||
$(this).data('expanded', 'true');
|
$(this).data('expanded', 'true');
|
||||||
|
|
||||||
if (thumb.tagName === 'CANVAS') {
|
if (thumb.tagName === 'CANVAS') {
|
||||||
canvas = thumb;
|
let canvas = thumb;
|
||||||
thumb = thumb.nextSibling;
|
thumb = thumb.nextSibling;
|
||||||
this.removeChild(canvas);
|
this.removeChild(canvas);
|
||||||
canvas.style.display = 'block';
|
canvas.style.display = 'block';
|
||||||
@ -130,7 +131,7 @@ $(document).ready(function(){
|
|||||||
thumb.style.opacity = '0.4';
|
thumb.style.opacity = '0.4';
|
||||||
thumb.style.filter = 'alpha(opacity=40)';
|
thumb.style.filter = 'alpha(opacity=40)';
|
||||||
|
|
||||||
img = document.createElement('img');
|
let img = document.createElement('img');
|
||||||
img.className = 'full-image';
|
img.className = 'full-image';
|
||||||
img.style.display = 'none';
|
img.style.display = 'none';
|
||||||
img.setAttribute('alt', 'Fullsized image');
|
img.setAttribute('alt', 'Fullsized image');
|
||||||
@ -140,43 +141,50 @@ $(document).ready(function(){
|
|||||||
} else {
|
} else {
|
||||||
loadingQueue.remove(this);
|
loadingQueue.remove(this);
|
||||||
|
|
||||||
scroll = false;
|
let scroll = false;
|
||||||
|
|
||||||
// scroll to thumb if not triggered by 'shrink all image'
|
// Scroll to thumb if not triggered by 'shrink all image'.
|
||||||
if (e.target.className == 'full-image') {
|
if (e.target.className == 'full-image') {
|
||||||
scroll = true;
|
scroll = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (~this.parentNode.className.indexOf('multifile'))
|
if (~this.parentNode.className.indexOf('multifile')) {
|
||||||
this.parentNode.style.width = $(this).data('width');
|
this.parentNode.style.width = $(this).data('width');
|
||||||
|
}
|
||||||
|
|
||||||
thumb.style.opacity = '';
|
thumb.style.opacity = '';
|
||||||
thumb.style.display = '';
|
thumb.style.display = '';
|
||||||
if (thumb.nextSibling) this.removeChild(thumb.nextSibling); //full image loaded or loading
|
if (thumb.nextSibling) {
|
||||||
|
// Full image loaded or loading.
|
||||||
|
this.removeChild(thumb.nextSibling);
|
||||||
|
}
|
||||||
$(this).removeData('expanded');
|
$(this).removeData('expanded');
|
||||||
delete thumb.style.filter;
|
delete thumb.style.filter;
|
||||||
|
|
||||||
// do the scrolling after page reflow
|
// Do the scrolling after page reflow.
|
||||||
if (scroll) {
|
if (scroll) {
|
||||||
post_body = $(thumb).parentsUntil('form > div').last();
|
let post_body = $(thumb).parentsUntil('form > div').last();
|
||||||
|
|
||||||
// on multifile posts, determin how many other images are still expanded
|
// On multifile posts, determine how many other images are still expanded.
|
||||||
still_open = post_body.find('.post-image').filter(function(){
|
let still_open = post_body.find('.post-image').filter(function() {
|
||||||
return $(this).parent().data('expanded') == 'true';
|
return $(this).parent().data('expanded') == 'true';
|
||||||
}).length;
|
}).length;
|
||||||
|
|
||||||
// deal with differnt boards' menu styles
|
// Deal with different boards menu styles.
|
||||||
if ($(boardlist).css('position') == 'fixed')
|
if ($(boardlist).css('position') == 'fixed') {
|
||||||
padding += boardlist.getBoundingClientRect().height;
|
padding += boardlist.getBoundingClientRect().height;
|
||||||
|
}
|
||||||
|
|
||||||
if (still_open > 0) {
|
if (still_open > 0) {
|
||||||
if (thumb.getBoundingClientRect().top - padding < 0)
|
if (thumb.getBoundingClientRect().top - padding < 0) {
|
||||||
$(document).scrollTop($(thumb).parent().parent().offset().top - padding);
|
$(document).scrollTop($(thumb).parent().parent().offset().top - padding);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (post_body[0].getBoundingClientRect().top - padding < 0)
|
if (post_body[0].getBoundingClientRect().top - padding < 0) {
|
||||||
$(document).scrollTop(post_body.offset().top - padding);
|
$(document).scrollTop(post_body.offset().top - padding);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (localStorage.no_animated_gif === 'true' && typeof unanimate_gif === 'function') {
|
if (localStorage.no_animated_gif === 'true' && typeof unanimate_gif === 'function') {
|
||||||
unanimate_gif(thumb);
|
unanimate_gif(thumb);
|
||||||
@ -188,17 +196,18 @@ $(document).ready(function(){
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// setting up user option
|
// Setting up user option.
|
||||||
if (window.Options && Options.get_tab('general')) {
|
if (window.Options && Options.get_tab('general')) {
|
||||||
Options.extend_tab('general', '<span id="inline-expand-max">'+ _('Number of simultaneous image downloads (0 to disable): ') +
|
Options.extend_tab('general', '<span id="inline-expand-max">' +
|
||||||
|
_('Number of simultaneous image downloads (0 to disable): ') +
|
||||||
'<input type="number" step="1" min="0" size="4"></span>');
|
'<input type="number" step="1" min="0" size="4"></span>');
|
||||||
$('#inline-expand-max input')
|
$('#inline-expand-max input')
|
||||||
.css('width', '50px')
|
.css('width', '50px')
|
||||||
.val(localStorage.inline_expand_max || DEFAULT_MAX)
|
.val(localStorage.inline_expand_max || DEFAULT_MAX)
|
||||||
.on('change', function (e) {
|
.on('change', function (e) {
|
||||||
// validation in case some fucktard tries to enter a negative floating point number
|
// Validation in case some fucktard tries to enter a negative floating point number.
|
||||||
var n = parseInt(e.target.value);
|
let n = parseInt(e.target.value);
|
||||||
var val = (n<0) ? 0 : n;
|
let val = (n < 0) ? 0 : n;
|
||||||
|
|
||||||
localStorage.inline_expand_max = val;
|
localStorage.inline_expand_max = val;
|
||||||
});
|
});
|
||||||
@ -207,7 +216,7 @@ $(document).ready(function(){
|
|||||||
if (window.jQuery) {
|
if (window.jQuery) {
|
||||||
$('div[id^="thread_"]').each(inline_expand_post);
|
$('div[id^="thread_"]').each(inline_expand_post);
|
||||||
|
|
||||||
// allow to work with auto-reload.js, etc.
|
// Allow to work with auto-reload.js, etc.
|
||||||
$(document).on('new_post', function(e, post) {
|
$(document).on('new_post', function(e, post) {
|
||||||
inline_expand_post.call(post);
|
inline_expand_post.call(post);
|
||||||
});
|
});
|
||||||
|
@ -85,7 +85,7 @@ if (active_page == 'index' && (""+document.location).match(/\/(index\.html)?(\?|
|
|||||||
|
|
||||||
if ($(th).find(".new-posts").html() != msg) {
|
if ($(th).find(".new-posts").html() != msg) {
|
||||||
$(th).find(".new-posts").html(msg);
|
$(th).find(".new-posts").html(msg);
|
||||||
$(th).find(".new-posts a").click(window.expand_fun);
|
$(th).find(".new-posts a").click(window.expandFun);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
/* Depends on post-menu.js
|
||||||
|
* Usage:
|
||||||
|
* $config['additional_javascript'][] = 'js/jquery.min.js';
|
||||||
|
* $config['additional_javascript'][] = 'js/post-menu.js';
|
||||||
|
* $config['additional_javascript'][] = 'js/post-filter.js';
|
||||||
|
*/
|
||||||
if (active_page === 'thread' || active_page === 'index' || active_page === 'catalog' || active_page === 'ukko') {
|
if (active_page === 'thread' || active_page === 'index' || active_page === 'catalog' || active_page === 'ukko') {
|
||||||
$(document).on('menu_ready', function () {
|
$(document).on('menu_ready', function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
@ -10,17 +10,15 @@
|
|||||||
* Usage:
|
* Usage:
|
||||||
* $config['additional_javascript'][] = 'js/jquery.min.js';
|
* $config['additional_javascript'][] = 'js/jquery.min.js';
|
||||||
* $config['additional_javascript'][] = 'js/quick-post-controls.js';
|
* $config['additional_javascript'][] = 'js/quick-post-controls.js';
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function() {
|
||||||
var open_form = function() {
|
let open_form = function() {
|
||||||
var thread = $(this).parent().parent().hasClass('op');
|
let thread = $(this).parent().parent().hasClass('op');
|
||||||
var id = $(this).attr('name').match(/^delete_(\d+)$/)[1];
|
let id = $(this).attr('name').match(/^delete_(\d+)$/)[1];
|
||||||
var submitButton;
|
|
||||||
|
|
||||||
if(this.checked) {
|
if (this.checked) {
|
||||||
var post_form = $('<form class="post-actions" method="post" style="margin:10px 0 0 0">' +
|
let post_form = $('<form class="post-actions" method="post" style="margin:10px 0 0 0">' +
|
||||||
'<div style="text-align:right">' +
|
'<div style="text-align:right">' +
|
||||||
(!thread ? '<hr>' : '') +
|
(!thread ? '<hr>' : '') +
|
||||||
|
|
||||||
@ -29,14 +27,14 @@ $(document).ready(function(){
|
|||||||
'<label for="password_' + id + '">'+_("Password")+'</label>: ' +
|
'<label for="password_' + id + '">'+_("Password")+'</label>: ' +
|
||||||
'<input id="password_' + id + '" type="password" name="password" size="11" maxlength="18">' +
|
'<input id="password_' + id + '" type="password" name="password" size="11" maxlength="18">' +
|
||||||
'<input title="'+_('Delete file only')+'" type="checkbox" name="file" id="delete_file_' + id + '">' +
|
'<input title="'+_('Delete file only')+'" type="checkbox" name="file" id="delete_file_' + id + '">' +
|
||||||
'<label for="delete_file_' + id + '">'+_('File')+'</label>' +
|
'<label for="delete_file_' + id + '">' + _('File') + '</label>' +
|
||||||
' <input type="submit" name="delete" value="'+_('Delete')+'">' +
|
' <input type="submit" name="delete" value="' + _('Delete') + '">' +
|
||||||
|
|
||||||
'<br>' +
|
'<br>' +
|
||||||
|
|
||||||
'<label for="reason_' + id + '">'+_('Reason')+'</label>: ' +
|
'<label for="reason_' + id + '">' + _('Reason') + '</label>: ' +
|
||||||
'<input id="reason_' + id + '" type="text" name="reason" size="20" maxlength="100">' +
|
'<input id="reason_' + id + '" type="text" name="reason" size="20" maxlength="100">' +
|
||||||
' <input type="submit" name="report" value="'+_('Report')+'">' +
|
' <input type="submit" name="report" value="' + _('Report') + '">' +
|
||||||
'</div>' +
|
'</div>' +
|
||||||
'</form>');
|
'</form>');
|
||||||
post_form
|
post_form
|
||||||
@ -59,26 +57,27 @@ $(document).ready(function(){
|
|||||||
|
|
||||||
post_form.find('input[type="password"]').val(localStorage.password);
|
post_form.find('input[type="password"]').val(localStorage.password);
|
||||||
|
|
||||||
if(thread) {
|
if (thread) {
|
||||||
post_form.prependTo($(this).parent().parent().find('div.body'));
|
post_form.prependTo($(this).parent().parent().find('div.body'));
|
||||||
} else {
|
} else {
|
||||||
post_form.appendTo($(this).parent().parent());
|
post_form.appendTo($(this).parent().parent());
|
||||||
//post_form.insertBefore($(this));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$(window).trigger('quick-post-controls', post_form);
|
$(window).trigger('quick-post-controls', post_form);
|
||||||
} else {
|
} else {
|
||||||
var elm = $(this).parent().parent().find('form');
|
let elm = $(this).parent().parent().find('form');
|
||||||
|
|
||||||
if(elm.attr('class') == 'post-actions')
|
if (elm.attr('class') == 'post-actions') {
|
||||||
elm.remove();
|
elm.remove();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var init_qpc = function() {
|
let init_qpc = function() {
|
||||||
$(this).change(open_form);
|
$(this).change(open_form);
|
||||||
if(this.checked)
|
if (this.checked) {
|
||||||
$(this).trigger('change');
|
$(this).trigger('change');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$('div.post input[type=checkbox].delete').each(init_qpc);
|
$('div.post input[type=checkbox].delete').each(init_qpc);
|
||||||
@ -87,4 +86,3 @@ $(document).ready(function(){
|
|||||||
$(post).find('input[type=checkbox].delete').each(init_qpc);
|
$(post).find('input[type=checkbox].delete').each(init_qpc);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -8,9 +8,8 @@
|
|||||||
*
|
*
|
||||||
* Usage:
|
* Usage:
|
||||||
* $config['additional_javascript'][] = 'js/jquery.min.js';
|
* $config['additional_javascript'][] = 'js/jquery.min.js';
|
||||||
* // $config['additional_javascript'][] = 'js/post-hover'; (optional; must come first)
|
* // $config['additional_javascript'][] = 'js/post-hover.js'; (optional; must come first)
|
||||||
* $config['additional_javascript'][] = 'js/show-backlinks.js';
|
* $config['additional_javascript'][] = 'js/show-backlinks.js';
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
onReady(function() {
|
onReady(function() {
|
||||||
@ -18,34 +17,33 @@ onReady(function() {
|
|||||||
let reply_id = $(this).attr('id').replace(/(^reply_)|(^op_)/, '');
|
let reply_id = $(this).attr('id').replace(/(^reply_)|(^op_)/, '');
|
||||||
|
|
||||||
$(this).find('div.body a:not([rel="nofollow"])').each(function() {
|
$(this).find('div.body a:not([rel="nofollow"])').each(function() {
|
||||||
let id, post, $mentioned;
|
let id = $(this).text().match(/^>>(\d+)$/);
|
||||||
|
if (id) {
|
||||||
if (id = $(this).text().match(/^>>(\d+)$/)) {
|
|
||||||
id = id[1];
|
id = id[1];
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$post = $('#reply_' + id);
|
let post = $('#reply_' + id);
|
||||||
if ($post.length == 0){
|
if (post.length == 0){
|
||||||
$post = $('#op_' + id);
|
post = $('#op_' + id);
|
||||||
if ($post.length == 0) {
|
if (post.length == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$mentioned = $post.find('p.intro span.mentioned');
|
let mentioned = post.find('p.intro span.mentioned');
|
||||||
if($mentioned.length == 0) {
|
if(mentioned.length == 0) {
|
||||||
$mentioned = $('<span class="mentioned unimportant"></span>').appendTo($post.find('p.intro'));
|
mentioned = $('<span class="mentioned unimportant"></span>').appendTo(post.find('p.intro'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($mentioned.find('a.mentioned-' + reply_id).length != 0) {
|
if (mentioned.find('a.mentioned-' + reply_id).length != 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let link = $('<a class="mentioned-' + reply_id + '" onclick="highlightReply(\'' + reply_id + '\');" href="#' + reply_id + '">>>' +
|
let link = $('<a class="mentioned-' + reply_id + '" onclick="highlightReply(\'' + reply_id + '\');" href="#' + reply_id + '">>>' +
|
||||||
reply_id + '</a>');
|
reply_id + '</a>');
|
||||||
link.appendTo($mentioned)
|
link.appendTo(mentioned)
|
||||||
|
|
||||||
if (window.init_hover) {
|
if (window.init_hover) {
|
||||||
link.each(init_hover);
|
link.each(init_hover);
|
||||||
@ -54,13 +52,12 @@ onReady(function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
$('div.post.reply').each(showBackLinks);
|
$('div.post.reply').each(showBackLinks);
|
||||||
$('div.post.op').each(showBackLinks);
|
|
||||||
|
|
||||||
$(document).on('new_post', function(e, post) {
|
$(document).on('new_post', function(e, post) {
|
||||||
if ($(post).hasClass("op")) {
|
if ($(post).hasClass('reply')) {
|
||||||
$(post).find('div.post.reply').each(showBackLinks);
|
showBackLinks.call(post);
|
||||||
} else {
|
} else {
|
||||||
$(post).parent().find('div.post.reply').each(showBackLinks);
|
$(post).find('div.post.reply').each(showBackLinks);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -5,9 +5,9 @@
|
|||||||
/* jshint globalstrict:true, quotmark:single */
|
/* jshint globalstrict:true, quotmark:single */
|
||||||
/* jshint browser:true, jquery:true, devel:true, unused:true, undef:true */
|
/* jshint browser:true, jquery:true, devel:true, unused:true, undef:true */
|
||||||
/* global active_page:false, board_name:false */
|
/* global active_page:false, board_name:false */
|
||||||
if(!localStorage.watchlist){
|
if(!localStorage.watchlist) {
|
||||||
//If the watchlist is undefined in the localStorage,
|
// If the watchlist is undefined in the localStorage,
|
||||||
//initialize it as an empty array.
|
// initialize it as an empty array.
|
||||||
localStorage.watchlist = '[]';
|
localStorage.watchlist = '[]';
|
||||||
}
|
}
|
||||||
var watchlist = {};
|
var watchlist = {};
|
||||||
@ -20,13 +20,17 @@ var watchlist = {};
|
|||||||
*/
|
*/
|
||||||
watchlist.render = function(reset) {
|
watchlist.render = function(reset) {
|
||||||
/* jshint eqnull:true */
|
/* jshint eqnull:true */
|
||||||
if (reset == null) reset = false;
|
if (reset == null) {
|
||||||
|
reset = false;
|
||||||
|
}
|
||||||
/* jshint eqnull:false */
|
/* jshint eqnull:false */
|
||||||
if (reset && $('#watchlist').length) $('#watchlist').remove();
|
if (reset && $('#watchlist').length) {
|
||||||
var threads = [];
|
$('#watchlist').remove();
|
||||||
//Read the watchlist and create a new container for each thread.
|
}
|
||||||
|
let threads = [];
|
||||||
|
// Read the watchlist and create a new container for each thread.
|
||||||
JSON.parse(localStorage.watchlist).forEach(function(e, i) {
|
JSON.parse(localStorage.watchlist).forEach(function(e, i) {
|
||||||
//look at line 69, that's what (e) is here.
|
// Look at line 69, that's what (e) is here.
|
||||||
threads.push('<div class="watchlist-inner" id="watchlist-'+i+'">' +
|
threads.push('<div class="watchlist-inner" id="watchlist-'+i+'">' +
|
||||||
'<span>/'+e[0]+'/ - ' +
|
'<span>/'+e[0]+'/ - ' +
|
||||||
'<a href="'+e[3]+'">'+e[1].replace("thread_", _("Thread #"))+'</a>' +
|
'<a href="'+e[3]+'">'+e[1].replace("thread_", _("Thread #"))+'</a>' +
|
||||||
@ -35,12 +39,12 @@ watchlist.render = function(reset) {
|
|||||||
'</div>');
|
'</div>');
|
||||||
});
|
});
|
||||||
if ($('#watchlist').length) {
|
if ($('#watchlist').length) {
|
||||||
//If the watchlist is already there, empty it and append the threads.
|
// If the watchlist is already there, empty it and append the threads.
|
||||||
$('#watchlist').children('.watchlist-inner').remove();
|
$('#watchlist').children('.watchlist-inner').remove();
|
||||||
$('#watchlist').append(threads.join(''));
|
$('#watchlist').append(threads.join(''));
|
||||||
} else {
|
} else {
|
||||||
//If the watchlist has not yet been rendered, create it.
|
// If the watchlist has not yet been rendered, create it.
|
||||||
var menuStyle = getComputedStyle($('.boardlist')[0]);
|
let menuStyle = getComputedStyle($('.boardlist')[0]);
|
||||||
$((active_page == 'ukko') ? 'hr:first' : (active_page == 'catalog') ? 'body>span:first' : 'form[name="post"]').before(
|
$((active_page == 'ukko') ? 'hr:first' : (active_page == 'catalog') ? 'body>span:first' : 'form[name="post"]').before(
|
||||||
$('<div id="watchlist">'+
|
$('<div id="watchlist">'+
|
||||||
'<div class="watchlist-controls">'+
|
'<div class="watchlist-controls">'+
|
||||||
@ -48,7 +52,8 @@ watchlist.render = function(reset) {
|
|||||||
'<span><a id="clearGhosts">['+_('Clear Ghosts')+']</a></span>'+
|
'<span><a id="clearGhosts">['+_('Clear Ghosts')+']</a></span>'+
|
||||||
'</div>'+
|
'</div>'+
|
||||||
threads.join('')+
|
threads.join('')+
|
||||||
'</div>').css("background-color", menuStyle.backgroundColor).css("border", menuStyle.borderBottomWidth+" "+menuStyle.borderBottomStyle+" "+menuStyle.borderBottomColor));
|
'</div>').css("background-color", menuStyle.backgroundColor).css("border", menuStyle.borderBottomWidth+" "+menuStyle.borderBottomStyle+" "+menuStyle.borderBottomColor)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
@ -58,32 +63,31 @@ watchlist.render = function(reset) {
|
|||||||
* @param {[Obj/Str]} sel [An unwrapped jquery selector.]
|
* @param {[Obj/Str]} sel [An unwrapped jquery selector.]
|
||||||
*/
|
*/
|
||||||
watchlist.add = function(sel) {
|
watchlist.add = function(sel) {
|
||||||
var threadName, threadInfo;
|
let threadName;
|
||||||
|
let threadInfo;
|
||||||
|
|
||||||
var board_name = $(sel).parents('.thread').data('board');
|
let board_name = $(sel).parents('.thread').data('board');
|
||||||
|
|
||||||
if (active_page === 'thread') {
|
if (active_page === 'thread') {
|
||||||
if ($('.subject').length){
|
if ($('.subject').length) {
|
||||||
//If a subject is given, use the first 20 characters as the thread name.
|
// If a subject is given, use the first 20 characters as the thread name.
|
||||||
threadName = $('.subject').text().substring(0,20);
|
threadName = $('.subject').text().substring(0,20);
|
||||||
} else { //Otherwise use the thread id.
|
} else { //Otherwise use the thread id.
|
||||||
threadName = $('.op').parent().attr('id');
|
threadName = $('.op').parent().attr('id');
|
||||||
}
|
}
|
||||||
//board name, thread name as defined above, current amount of posts, thread url
|
// Board name, thread name as defined above, current amount of posts, thread url
|
||||||
threadInfo = [board_name, threadName, $('.post').length, location.href];
|
threadInfo = [board_name, threadName, $('.post').length, location.href];
|
||||||
|
|
||||||
} else if (active_page === 'index' || active_page === 'ukko') {
|
} else if (active_page === 'index' || active_page === 'ukko') {
|
||||||
|
let postCount;
|
||||||
var postCount;
|
// Figure out the post count.
|
||||||
//Figure out the post count.
|
|
||||||
if ($(sel).parents('.op').children('.omitted').length) {
|
if ($(sel).parents('.op').children('.omitted').length) {
|
||||||
postCount = $(sel).parents('.op').children('.omitted').text().split(' ')[0];
|
postCount = $(sel).parents('.op').children('.omitted').text().split(' ')[0];
|
||||||
} else {
|
} else {
|
||||||
postCount = $(sel).parents('.op').siblings('.post').length+1;
|
postCount = $(sel).parents('.op').siblings('.post').length+1;
|
||||||
}
|
}
|
||||||
//Grab the reply link.;
|
// Grab the reply link.;
|
||||||
var threadLink = $(sel).siblings('a:not(.watchThread)').last().attr('href');
|
let threadLink = $(sel).siblings('a:not(.watchThread)').last().attr('href');
|
||||||
//Figure out the thread name. If anon, use the thread id.
|
// Figure out the thread name. If anon, use the thread id.
|
||||||
if ($(sel).parent().find('.subject').length) {
|
if ($(sel).parent().find('.subject').length) {
|
||||||
threadName = $(sel).parent().find('.subject').text().substring(0,20);
|
threadName = $(sel).parent().find('.subject').text().substring(0,20);
|
||||||
} else {
|
} else {
|
||||||
@ -91,7 +95,6 @@ watchlist.add = function(sel) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
threadInfo = [board_name, threadName, postCount, threadLink];
|
threadInfo = [board_name, threadName, postCount, threadLink];
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
alert('Functionality not yet implemented for this type of page.');
|
alert('Functionality not yet implemented for this type of page.');
|
||||||
return this;
|
return this;
|
||||||
@ -102,7 +105,7 @@ watchlist.add = function(sel) {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
var _watchlist = JSON.parse(localStorage.watchlist); //Read the watchlist
|
let _watchlist = JSON.parse(localStorage.watchlist); //Read the watchlist
|
||||||
_watchlist.push(threadInfo); //Add the new watch item.
|
_watchlist.push(threadInfo); //Add the new watch item.
|
||||||
localStorage.watchlist = JSON.stringify(_watchlist); //Save the watchlist.
|
localStorage.watchlist = JSON.stringify(_watchlist); //Save the watchlist.
|
||||||
return this;
|
return this;
|
||||||
@ -113,7 +116,7 @@ watchlist.add = function(sel) {
|
|||||||
* @param {[Int]} n [The index at which to remove.]
|
* @param {[Int]} n [The index at which to remove.]
|
||||||
*/
|
*/
|
||||||
watchlist.remove = function(n) {
|
watchlist.remove = function(n) {
|
||||||
var _watchlist = JSON.parse(localStorage.watchlist);
|
let _watchlist = JSON.parse(localStorage.watchlist);
|
||||||
_watchlist.splice(n, 1);
|
_watchlist.splice(n, 1);
|
||||||
localStorage.watchlist = JSON.stringify(_watchlist);
|
localStorage.watchlist = JSON.stringify(_watchlist);
|
||||||
return this;
|
return this;
|
||||||
@ -137,26 +140,26 @@ watchlist.exists = function(sel) {
|
|||||||
error: function() {
|
error: function() {
|
||||||
watchlist.remove(parseInt($(sel).attr('id').split('-')[1])).render();
|
watchlist.remove(parseInt($(sel).attr('id').split('-')[1])).render();
|
||||||
},
|
},
|
||||||
success : function(){
|
success : function() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function() {
|
||||||
if (!(active_page == 'thread' || active_page == 'index' || active_page == 'catalog' || active_page == 'ukko')) {
|
if (!(active_page == 'thread' || active_page == 'index' || active_page == 'catalog' || active_page == 'ukko')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Append the watchlist toggle button.
|
// Append the watchlist toggle button.
|
||||||
$('.boardlist').append(' <span>[ <a class="watchlist-toggle" href="#">'+_('watchlist')+'</a> ]</span>');
|
$('.boardlist').append(' <span>[ <a class="watchlist-toggle" href="#">' + _('watchlist') + '</a> ]</span>');
|
||||||
//Append a watch thread button after every OP post number.
|
// Append a watch thread button after every OP post number.
|
||||||
$('.op>.intro>.post_no:odd').after('<a class="watchThread" href="#">['+_('Watch Thread')+']</a>');
|
$('.op>.intro>.post_no:odd').after('<a class="watchThread" href="#">[' + _('Watch Thread') + ']</a>');
|
||||||
|
|
||||||
//Draw the watchlist, hidden.
|
// Draw the watchlist, hidden.
|
||||||
watchlist.render();
|
watchlist.render();
|
||||||
|
|
||||||
//Show or hide the watchlist.
|
// Show or hide the watchlist.
|
||||||
$('.watchlist-toggle').on('click', function(e) {
|
$('.watchlist-toggle').on('click', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
//if ctrl+click, reset the watchlist.
|
//if ctrl+click, reset the watchlist.
|
||||||
@ -167,35 +170,33 @@ $(document).ready(function(){
|
|||||||
$('#watchlist').css('display', 'none');
|
$('#watchlist').css('display', 'none');
|
||||||
} else {
|
} else {
|
||||||
$('#watchlist').css('display', 'block');
|
$('#watchlist').css('display', 'block');
|
||||||
} //Shit got really weird with hide/show. Went with css manip. Probably faster anyway.
|
} // Shit got really weird with hide/show. Went with css manip. Probably faster anyway.
|
||||||
});
|
});
|
||||||
|
|
||||||
//Trigger the watchlist add function.
|
// Trigger the watchlist add function.
|
||||||
//The selector is passed as an argument in case the page is not a thread.
|
// The selector is passed as an argument in case the page is not a thread.
|
||||||
$('.watchThread').on('click', function(e) {
|
$('.watchThread').on('click', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
watchlist.add(this).render();
|
watchlist.add(this).render();
|
||||||
});
|
});
|
||||||
|
|
||||||
//The index is saved in .watchlist-inner so that it can be passed as the argument here.
|
// The index is saved in .watchlist-inner so that it can be passed as the argument here.
|
||||||
//$('.watchlist-remove').on('click') won't work in case of re-renders and
|
// $('.watchlist-remove').on('click') won't work in case of re-renders and
|
||||||
//the page will need refreshing. This works around that.
|
// the page will need refreshing. This works around that.
|
||||||
$(document).on('click', '.watchlist-remove', function() {
|
$(document).on('click', '.watchlist-remove', function() {
|
||||||
var item = parseInt($(this).parent().attr('id').split('-')[1]);
|
let item = parseInt($(this).parent().attr('id').split('-')[1]);
|
||||||
watchlist.remove(item).render();
|
watchlist.remove(item).render();
|
||||||
});
|
});
|
||||||
|
|
||||||
//Empty the watchlist and redraw it.
|
// Empty the watchlist and redraw it.
|
||||||
$('#clearList').on('click', function(){
|
$('#clearList').on('click', function() {
|
||||||
watchlist.clear().render();
|
watchlist.clear().render();
|
||||||
});
|
});
|
||||||
|
|
||||||
//Get rid of every watched item that no longer directs to an existing page.
|
// Get rid of every watched item that no longer directs to an existing page.
|
||||||
$('#clearGhosts').on('click', function() {
|
$('#clearGhosts').on('click', function() {
|
||||||
$('.watchlist-inner').each(function(){
|
$('.watchlist-inner').each(function() {
|
||||||
watchlist.exists(this);
|
watchlist.exists(this);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -929,9 +929,11 @@ pre {
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.poster_id:hover {
|
.poster_id:hover {
|
||||||
color: #800000!important;
|
color: #800000!important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.poster_id::before {
|
.poster_id::before {
|
||||||
content: " ID: ";
|
content: " ID: ";
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
var modRoot = "{{ config.root }}" + (inMod ? "mod.php?/" : "");
|
var modRoot = "{{ config.root }}" + (inMod ? "mod.php?/" : "");
|
||||||
</script>
|
</script>
|
||||||
{% if not nojavascript %}
|
{% if not nojavascript %}
|
||||||
<script type="text/javascript" src="{{ config.url_javascript }}?v={{ config.resource_version }} data-resource-version="{{ config.resource_version }}"></script>
|
<script type="text/javascript" src="{{ config.url_javascript }}?v={{ config.resource_version }}"></script>
|
||||||
{% if not config.additional_javascript_compile %}
|
{% if not config.additional_javascript_compile %}
|
||||||
{% for javascript in config.additional_javascript %}<script type="text/javascript" src="{{ config.additional_javascript_url }}{{ javascript }}?v={{ config.resource_version }}"></script>{% endfor %}
|
{% for javascript in config.additional_javascript %}<script type="text/javascript" src="{{ config.additional_javascript_url }}{{ javascript }}?v={{ config.resource_version }}"></script>{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user