From 035214c1e1f1f3b8af7a6261eb9f59275bc58a6a Mon Sep 17 00:00:00 2001 From: Zankaria Date: Sat, 17 Aug 2024 18:31:07 +0200 Subject: [PATCH] post-filter.js: trim --- js/post-filter.js | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/js/post-filter.js b/js/post-filter.js index c9e903d8..12ae2cd7 100644 --- a/js/post-filter.js +++ b/js/post-filter.js @@ -1,7 +1,13 @@ +/* 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') { $(document).on('menu_ready', function () { 'use strict'; - + // returns blacklist object from storage function getList() { return JSON.parse(localStorage.postFilter); @@ -64,12 +70,12 @@ if (active_page === 'thread' || active_page === 'index' || active_page === 'cata } function nameSpanToString(el) { - var s = ''; + var s = ''; $.each($(el).contents(), function(k,v) { if (v.nodeName === 'IMG') s=s+$(v).attr('alt') - + if (v.nodeName === '#text') s=s+v.nodeValue }); @@ -165,7 +171,7 @@ if (active_page === 'thread' || active_page === 'index' || active_page === 'cata } }; - /* + /* * hide/show the specified thread/post */ function hide(ele) { @@ -198,7 +204,7 @@ if (active_page === 'thread' || active_page === 'index' || active_page === 'cata } } - /* + /* * create filter menu when the button is clicked */ function initPostMenu(pageData) { @@ -338,7 +344,7 @@ if (active_page === 'thread' || active_page === 'index' || active_page === 'cata }); } - /* + /* * hide/unhide thread on index view */ function quickToggle(ele, threadId, pageData) { @@ -352,7 +358,7 @@ if (active_page === 'thread' || active_page === 'index' || active_page === 'cata var postId = $(ele).find('.post_no').not('[id]').text(); var hidden = $(ele).data('hidden'); var boardId = $(ele).parents('.thread').data('board'); - + if (hidden) { blacklist.remove.post(boardId, threadId, postId, false); $(this).html('[–]'); @@ -744,7 +750,7 @@ if (active_page === 'thread' || active_page === 'index' || active_page === 'cata } } - /* + /* * clear out pruned threads */ function purge() { @@ -780,7 +786,7 @@ if (active_page === 'thread' || active_page === 'index' || active_page === 'cata if ((timestamp() - list.lastPurge) < 86400) // less than 1 day return; - + for (boardId in list.nextPurge) { board = list.nextPurge[boardId]; for (threadId in board) { @@ -864,7 +870,7 @@ if (active_page === 'thread' || active_page === 'index' || active_page === 'cata } init(); }); - + if (typeof window.Menu !== "undefined") { $(document).trigger('menu_ready'); }