mirror of
https://github.com/vichan-devel/vichan.git
synced 2025-02-13 01:24:35 +01:00
post-filter.js: trim
This commit is contained in:
parent
fd1972b4fb
commit
035214c1e1
@ -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') {
|
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';
|
||||||
|
|
||||||
// returns blacklist object from storage
|
// returns blacklist object from storage
|
||||||
function getList() {
|
function getList() {
|
||||||
return JSON.parse(localStorage.postFilter);
|
return JSON.parse(localStorage.postFilter);
|
||||||
@ -64,12 +70,12 @@ if (active_page === 'thread' || active_page === 'index' || active_page === 'cata
|
|||||||
}
|
}
|
||||||
|
|
||||||
function nameSpanToString(el) {
|
function nameSpanToString(el) {
|
||||||
var s = '';
|
var s = '';
|
||||||
|
|
||||||
$.each($(el).contents(), function(k,v) {
|
$.each($(el).contents(), function(k,v) {
|
||||||
if (v.nodeName === 'IMG')
|
if (v.nodeName === 'IMG')
|
||||||
s=s+$(v).attr('alt')
|
s=s+$(v).attr('alt')
|
||||||
|
|
||||||
if (v.nodeName === '#text')
|
if (v.nodeName === '#text')
|
||||||
s=s+v.nodeValue
|
s=s+v.nodeValue
|
||||||
});
|
});
|
||||||
@ -165,7 +171,7 @@ if (active_page === 'thread' || active_page === 'index' || active_page === 'cata
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* hide/show the specified thread/post
|
* hide/show the specified thread/post
|
||||||
*/
|
*/
|
||||||
function hide(ele) {
|
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
|
* create filter menu when the button is clicked
|
||||||
*/
|
*/
|
||||||
function initPostMenu(pageData) {
|
function initPostMenu(pageData) {
|
||||||
@ -338,7 +344,7 @@ if (active_page === 'thread' || active_page === 'index' || active_page === 'cata
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* hide/unhide thread on index view
|
* hide/unhide thread on index view
|
||||||
*/
|
*/
|
||||||
function quickToggle(ele, threadId, pageData) {
|
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 postId = $(ele).find('.post_no').not('[id]').text();
|
||||||
var hidden = $(ele).data('hidden');
|
var hidden = $(ele).data('hidden');
|
||||||
var boardId = $(ele).parents('.thread').data('board');
|
var boardId = $(ele).parents('.thread').data('board');
|
||||||
|
|
||||||
if (hidden) {
|
if (hidden) {
|
||||||
blacklist.remove.post(boardId, threadId, postId, false);
|
blacklist.remove.post(boardId, threadId, postId, false);
|
||||||
$(this).html('[–]');
|
$(this).html('[–]');
|
||||||
@ -744,7 +750,7 @@ if (active_page === 'thread' || active_page === 'index' || active_page === 'cata
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* clear out pruned threads
|
* clear out pruned threads
|
||||||
*/
|
*/
|
||||||
function purge() {
|
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
|
if ((timestamp() - list.lastPurge) < 86400) // less than 1 day
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (boardId in list.nextPurge) {
|
for (boardId in list.nextPurge) {
|
||||||
board = list.nextPurge[boardId];
|
board = list.nextPurge[boardId];
|
||||||
for (threadId in board) {
|
for (threadId in board) {
|
||||||
@ -864,7 +870,7 @@ if (active_page === 'thread' || active_page === 'index' || active_page === 'cata
|
|||||||
}
|
}
|
||||||
init();
|
init();
|
||||||
});
|
});
|
||||||
|
|
||||||
if (typeof window.Menu !== "undefined") {
|
if (typeof window.Menu !== "undefined") {
|
||||||
$(document).trigger('menu_ready');
|
$(document).trigger('menu_ready');
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user