// ==UserScript==
// @name CatChan
// @version 2023.01.22.1
// @description Cross domain catalog for imageboards
// @include http*://*krautchan.net/*
// @include http*://boards.4chan.org/*
// @include http*://boards.4channel.org/*
// @include http*://i.4cdn.org/*
// @include http*://8kun.top/*
// @include http*://lainchan.org/*
// @include http*://lainchan.jp/*
// @include http*://*meguca.org/*
// @include http*://rssnews.sakura.tv/*
// @require https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.1-beta.4/Chart.min.js
// @updateURL https://raw.github.com/Dogman8/CatChan/master/CatChan.meta.js
// @grant unsafeWindow
// @grant GM_xmlhttpRequest
// ==/UserScript==
//
// Copyright 2014 DogMan8
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, version 3 of the License.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see .
//
(function (){
// if (window.top != window.self) return; //don't run on frames or iframes
//if (window.top != window.self && window.name!='KC' && window.name!='4chan' && window.name!='8chan') return; //don't run on frames or iframes
if (window.top != window.self && window.name==='') return; //don't run on frames or iframes
if (window.name==='post_tgt' && window.location.href.indexOf('localhost')!=-1) return;
// http://stackoverflow.com/questions/9791489/greasemonkey-require-does-not-work-in-chrome
// http://stackoverflow.com/questions/2246901/how-can-i-use-jquery-in-greasemonkey-scripts-in-google-chrome
// http://stackoverflow.com/questions/17341122/link-and-execute-external-javascript-file-hosted-on-github
var brwsr = {
ff: (navigator.userAgent.indexOf("Firefox") != -1),
sw_cache: true,
JSON_parse: function(val){ // patch for Tampermonkey.
var retval = JSON.parse(val);
// if (GM_setValue)
// if (typeof(retval)==='object')
// for (var i in retval) if (typeof(retval[i])==='string' && retval[i].startsWith('[') && retval[i].endsWith(']')) retval[i] = brwsr.JSON_parse(retval[i]);}
for (var i in retval) if (typeof(retval[i])==='string' && retval[i].search(/^\[.*\]$/)!=-1) retval[i] = brwsr.JSON_parse(retval[i]);
return retval;
},
};
brwsr.innerText = (!brwsr.ff)? 'innerText' : 'textContent';
brwsr.Date_parse = (!brwsr.ff)? Date.parse : function(str){
var time = Date.parse(str);
if (isNaN(time)) {
var idx = str.lastIndexOf('.');
time = Date.parse(str.substr(0,idx),10) + parseInt(str.substr(idx+1,3),10);
}
return time;
};
// brwsr.Date_parse = (!brwsr.ff)? Date.parse : function(str){return Date.parse(str.replace(/ /,'T'));};
brwsr.document_body = (!brwsr.ff)? document.body : document.documentElement;
brwsr.mousewheel = (!brwsr.ff)? 'mousewheel' : 'DOMMouseScroll';
brwsr.hasMessageChannel = MessageChannel;
var DelayBuffer = function(tgt, delay){
this.tgt = tgt;
this.delay = delay;
this.id = null;
this.do_tgt = this.do_tgt.bind(this);
};
DelayBuffer.prototype = {
// constructor: DelayBuffer,
do_tgt: function(){this.id = null; this.tgt();},
delayed_do: function(delay){
if (this.id===null) {
if (delay===undefined) delay = this.delay;
this.id = setTimeout(this.do_tgt,
(typeof(delay)==='number')? delay : (this.hasFocus)? delay.fg : delay.bg);
}
},
cancel: function(){if (this.id!==null) {clearTimeout(this.id);this.id=null;}},
get_bound_func: function(){return this.delayed_do.bind(this);},
hasFocus: true
};
var Watchdog = function(tgt, delay){
DelayBuffer.call(this, tgt, delay);
};
Watchdog.prototype = {
// constructor: Watchdog,
start: function(delay){this.delayed_do(delay);},
stop: function(){this.cancel();},
restart: function(delay){this.cancel();this.delayed_do(delay);},
get_bound_func: function(){return this.restart.bind(this);},
__proto__: DelayBuffer.prototype
};
//// var MutexWatchdog = function(name){ // watchdog for 8chan's unstability. // working code, @safe1069
//// this.mutex = true;
//// this.req = false;
//// this.name = name;
//// this.abort_req = false;
//// this.wdg = new Watchdog(this.fire.bind(this), 30000);
////// this.wdg = new DelayBuffer(function(){ // working code.
////// this.mutex = true;
////// if (pref.debug_mode['7']) console.log('watchdog: '+this.name);}.bind(this), 30000);
//// }
//// MutexWatchdog.prototype = {
//// get: function(){
//// if (this.mutex && !this.abort_req) {
//// this.mutex = false;
//// this.wdg.start();
//// if (pref.debug_mode['5']) console.log('mutex: get: '+this.name);
//// this.req = false;
//// return true;
//// } else {
//// if (!this.abort_req) this.req = true;
//// if (pref.debug_mode['5']) console.log('mutex: fail: '+this.name);
//// this.abort_req = false;
//// return false;
//// }
//// },
//// restart: function(delay){
//// this.wdg.restart(delay);
//// },
//// stop: function(){
//// this.wdg.stop();
//// this.mutex = true;
//// if (pref.debug_mode['5']) console.log('mutex: release: '+this.name);
//// },
//// fire: function(){
//// this.mutex = true;
//// cataLog.scan_boards.scan_abort(this.name);
//// if (pref.debug_mode['7']) console.log('watchdog: '+this.name);
//// },
//// abort: function(){
//// this.abort_req = true;
//// this.stop();
//// },
//// query_req: function(){
//// return this.req;
//// }
//// }
var comf = { // common_func
Object_modifyDescriptor: function(obj,prop,desc){
desc.__proto__ = Object.getOwnPropertyDescriptor(obj,prop);
Object.defineProperty(obj,prop,desc);
},
Object_defProps: function(dst,src){
for (var i in src) dst[i] = src[i];
return src;
},
Array_toObj: function(src, val){
var obj = {};
for (var i=0;i'}},
patch: {delayed_invoke: {use: brwsr.ff}},
catalog: {t2h_sel:'N', thumbnail:{hover:{popup_zIndex:100001}}, env:{popup_native:false,refresh_initial:false}},
proto:{
footer:{rOP:false, iOP:false},
env:{event_dynamic: true}
},
easy2:{limits:2},
style:{addSS:{str:'//s.4cdn.org/css/flags.689.css'}},
};
} else if (href.indexOf('lainchan.org')!==-1) {
domain = 'lain';
pref_default = {
page:{ env:{ disp_offset:1}},
catalog:{image_hover:true, board:{all_boards:true}, env:{disp_offset:1, disp_filler:' '}},
proto:{ env:{ localtime_native:false,
colorID_native: false}},
stats:{ time_unit:3, patch_tm:true},
chart: {inst:{show: {p:true}, time_sel:3}},
easy2:{limits:1},
thread_reader:{own_posts_tracker:true},
};
} else if (href.indexOf('lainchan.jp')!=-1) {
domain = 'lainjp';
pref_default = {
page:{ env:{ disp_offset:1}},
proto:{ env:{ localtime_native:false,
colorID_native: false}},
stats:{ time_unit:3, patch_tm:true},
chart: {inst:{show: {p:true}, time_sel:3}},
// overwritten by easy2 default.
catalog:{image_hover:true, board:{all_boards:true}, env:{disp_offset:1, disp_filler:' '},},
thread: {auto_update:true},
thread_reader:{own_posts_tracker:true},
scan:{max:100},
liveTag:{style:{urtm:'color:lime !important;font-weight:bold !important',
ur:'color:limegreen !important;font-weight:bold !important',
in:'color:red !important'}},
virtualBoard:{scanDelay:1},
easy2:{limits:1},
style:{design:{post_new:{base:'border:2px solid red !important'}}},
};
pref_default2 = true;
} else if (href.search(/8kun.top/)!=-1) { // 8chan.co|8ch.net
domain = '8chan';
pref_default = {
catalog_expand_with_hr: true,
page:{ env:{ disp_offset:1, disp_filler:'
'}}};
} else if (href.search(/krautchan.net/)!=-1) {
domain = 'KC';
pref_default = {
thread_reader:{own_posts_tracker:true, check_num_of_children: false},
proto:{
env:{
popup_native:false,
expand_thumbnail_inline_native:false,
image_hover_native:false,
colorID_native:false,
backlink_native:false,
localtime_native:false,
auto_update_native:false,
},
},
page:{use_expander_always:true},
};
} else if (href.indexOf('//localhost/')!==-1 || href.indexOf('//192.168.')!==-1 || href.indexOf('//rssnews.sakura.tv/')!==-1) {
domain = 'rssn'; // 'dist';
pref_default = {cpfx:'',catalog_open_where:'CatChan_tgt',auto_watch:{style:true},catalog:{order:{ordering:1},env:{refresh_initial:false},board:{recommendation:false}},proto:{footer:{nrtm:false,nr:false,rp:false,im:false,board:false,page:false,design:'condensed'}},headline:{footer:{ctime:true,triage:true,triage_str:'NONE,\u25ef,background:lightgray,EXPAND,\u25b6,\u25c0,SPC, ,,KILL,x,,SPC, ,,NONE, H,background:lightcyan,NONE,R,opacity:0.7;background:gray,NONE,N,,SPC, ,'},max_letters:10000,subStyle:1},scan:{crawler:1},virtualBoard:{scanDelay:1,bl:{showActives:true}},float:{refresh_src:'bg',env:{refresh_initial:false}},page:{env:{refresh_initial:false}},chart:{inst:{scale_thread:1,time_sel:2,show:{np:false}}},settings:{indexing:10},notify:{desktop:{notify:false}}}; // ,virtualBoard:{scan:false,scan_domains:{rssn:'none'}}};
pref_default2 = true;
pref_default3 = {virtualBoard:{scan_domains:{lainjp:undefined, KC:undefined, dist:undefined, RSS:undefined}}};
}
var domains = ['meguca', '4chan', 'lain', 'lainjp', '8chan', 'KC', 'dist', 'rssn','RSS'];
if (domain) domains.unshift(domains.splice(domains.indexOf(domain),1)[0]);
var domains_others = ['8chan_live','vichan','4chan_s','4chan_i','4chanB','4chanR','imeguca']; // , 'CatChan_tgt']; // adding 'CatChan_tgt' with opening fixed-tab is good for testing the step window.
if (pref_default2) {
pref_default2 = {// new default patch
catalog:{auto_load_filter:true, auto_save_filter:true, auto_save_filter_at_refresh:true},
liveTag: {use:false, from:'op'},
virtualBoard:{bl:{max:100}, scan:true, scan_domains:{}},
network:{fetch_actively:false},
easy2:{presets:1,VB:{local:1},catalog:{auto_update:false},page:{auto_update:false}},
};
pref_default2.virtualBoard.scan_domains[domain] = 'board';
}
return {
domain: domain,
domains: domains,
pref_default: pref_default,
pref_default2: pref_default2,
pref_default3: pref_default3 || {virtualBoard:{scan_domains:{RSS:undefined}}},
isStep: window.opener && (domains.indexOf(window.name)!=-1 || domains_others.indexOf(window.name)!=-1),
add_domain: function(domain, no_scan){
this.domains.push(domain);
this.debug_domains.push(domain);
if (!no_scan) pref.virtualBoard.scan_domains[domain] = 'none';
pref.debug_mode.domains[domain] = true;
pref.features.domains[domain] = true;
},
debug_domains: ['DEFAULT','4chan','vichan','lain','lainjp','8chan','8chan_live','KC','meguca','meguca1','meguca2','rssn','RSS','rss'],
debug_types: ['','_json','_html'], // ,'_json_template','_html_template']; // '' for common
site2keys: [],
};
})();
var pref4 = { // dynamic, but not auto sync objects.
funcs:{
set_options_to_selector: function(sel,options){
sel.length = options.length;
for (var i=0;i)R: (lp/)(RP)(*sp)(+dp)()( / I: IM)( / P: pg) (ni/nf )(ct )(cT )(bt )(bT )(pt )(pT )(pr )(dn)(bd)(no) ',
condensed: '(ar )(nm/)(nr/)(lp/)(rp)(*sp)(+dp)(/im)(/pg) (ni/nf )(ct )(cT )(bt )(bT )(pt )(pT )(pr )(dn)(bd)(no) ',
meguca: '(ar )(dn)(bd)(no) (nm/)(nr/)(lp/)(rp)(*sp)(+dp)(/im)(/pg) (ni/nf )(ct )(cT )(bt )(bT )(pt )(pT )(pr ) ',
custom2org:'(ar )(nm/)(nr/)()(lp/)(RP)(*sp)(+dp)()(/IM)(/pg) (ni/nf) (ct )(cT )(bt )(bT )(pt )(pT )(pr )(dn)(bd)(no) ',
custom3org:'(ar )(nm/)(nr/)(lp/)(RP)(*sp)(+dp)(/IM)(/pg) (ni/nf) (ct )(cT )(bt )(bT )(pt )(pT )(pr )(dn)(bd)(no) ',
},
};
function pref_default(for_save) {
var proto = {
image_hover:false,
image_prefetch:false,
click: 'none',
click_area: 'thumbnail',
format: { // show: {style: true, contents: true, layout: true, posts: false, fileinfo: false, images_2nd: true},
// hover: {style: true, contents: false, layout: false, posts: true, fileinfo: true, images_2nd: true},
// search:{style: false, contents: false, layout: false, posts: true, fileinfo: true, images_2nd: true},
thumb: {
resize: false, size:'small',
vsmall:{w1:80, h1:80, w2:40, h2:40, min:16, s2:true, en:true},
small:{w1:150, h1:150, w2:75, h2:75, min:32, s2:true, en:true},
large:{w1:250, h1:250, w2:125, h2:125, min:64, s2:true, en:true},
custom:{w1:350, h1:350, w2:250, h2:250, min:64, s2:true, en:true},
custom2:{w1:80, h1:80, w2:40, h2:40, min:16, s2:true, en:true}},
nc: {width:380, height:0, max:false},
ec: {width:450, height:500, max:true},
nc2:{width:165, height:0, max:false},
ec2:{width:240, height:350, max:true},
op:'on', subStyle:0, subStyle2:0,
},
footer: {use:true, nrtm:true, nr:true, rp:true, rp0:false, im:true, domain:false, board:true, no:false, flag:false, tag:true, page:true, design:'native', rOP:true, iOP:true, pgp:true,
custom: pref0.footer.native, custom2:pref0.footer.custom2org, custom3:pref0.footer.custom3org,
ctime:false, btime:false, ptime:false, rctime:false, rbtime:false, rptime:false, br:true, prate:false, archived:true, nd:false, nl:false, nf:false, nid:false, ns:false,
triage:false, menu:true, triage_str:'KILL,x,,SPC, ,', menu_str:'SPC, ,,MENU,\u25b6,', merged_tag:'any',
nr0:false, nr1:false, nr1_style:'color:limegreen;font-weight:bold', nrtm0:false, nrtm1:false, nrtm1_style:'color:lime;font-weight:bold'},
triage_hover:true,
// footer_br: true,
draw_on_demand: true,
load_on_demand: false, load_on_demand_timeout: 10,
t2h_sel: 'page',
t2h_L: 100,
t2h_M: 50,
get t2h_N(){return this.t2h_num_of_posts},
t2h_num_of_posts : 5,
save_board_list_sel: false,
board_list_sel: 0,
mark_new_posts: true,
auto_update : false,
auto_update_period : 10,
auto_update_countdown: true,
auto_update_shrink: 1,
storePosts:'auto', sourceOfSP:'auto', searchAs:false, searchAsA:false, searchAc:{loosen:true, max:1000, max_threads:10000, max_threads_at_refresh:10000},
popup:true, colorID:true, backlink:true, popup_truncated:true, popup_zIndex:100, backlink_all:false, backlink_all_cross:false,
popup_hlt:true, bl_ec:false, bl_rm:true, // popup_highlight, backlink_explicit_cross, baclink_remove_if_OP
popup_delay:50, popdown_delay:500, popdown:'delay', popup_mMove:true,
inline_post:'inline',
link_show_op:true, link_show_cross:true,
expand_thumbnail_inline:true, localtime:true,
expand_thumbnail_inline_all_after:false,
// expand_thumbnail_initial:false,
hide_posts_without_images:false,
thumbnail:{
inline:{ondemandStop:true, stopHover:true, ref_height:150, // ondemand:true,
limit_width: true, limit_height:false, margin_width: 40, margin_height: 0, webm: true, webm_mute:false, webm_loop:false},
hover: {limit_width: true, limit_height: true, margin_width: 40, margin_height: 0, webm:false, webm_mute: true, webm_loop:false, webm_ctrl:true,
popup_delay:50, popdown_delay:500, popdown:'delay', popup_mMove:true, popup_zIndex:101,
dragfloat:true, df_dblC:true, df_mW:true, zoom_click:false, zoom_over:false, zoom_dblC:true, zoom_mW:true},
},
infoPv: {use:false, popup_delay:200, popdown_delay:0, popdown:'delay', popup_mMove:false, popup_zIndex:101},
popupX: {popup_delay:500, popdown_delay:500, popdown:'delay', popup_mMove:true, popup_zIndex:101, use:false, ID:true, flag:true, name:false, anon:false, trip:false, ID2:false},
// popupID: {popup_delay:500, popdown_delay:500, popdown:'delay', popup_mMove:true, popup_zIndex:101},
// popupFlag: {popup_delay:500, popdown_delay:500, popdown:'delay', popup_mMove:true, popup_zIndex:101},
// popupName: {popup_delay:500, popdown_delay:500, popdown:'delay', popup_mMove:true, popup_zIndex:101, anon:false},
// popupTrip: {popup_delay:500, popdown_delay:500, popdown:'delay', popup_mMove:true, popup_zIndex:101},
open_spoiler_text: false,
open_spoiler_image: false,
merge: false, merge_list: false, merge_list_str: '', merge_list_obj6: null, merge_truncated: false,
merge_lv:true, merge_lv_str:'', merge_lv_obj6:null,
merge_auto:false, // merge_auto_lv:2, merge_auto_lv_add:true,
merge_op:{auto:false, fetch:false, hop:1, lv_add:true, lv_def:2, lv_inc:true, attr:true, list:true},
merge_mode:'list', merge_btn:{add:true, lv_add:true, lv_def:1, lv_inc:true, attr:false, list:false},
lazyDraw: {merge: true, merge_step: 16, step: 16},
scroll_lock: false,
use_expander_always: false,
// popup2:'sr',
popup2_sel:'auto', popup2_sel_tolerance:10, popup2_resize:false, popup2_resize_bw:8, popup2_resize_cw:20,
popup3: {ww:'no', wn:'no', nw:'no', nn:'no', popup_delay:300, popdown_delay:500, popdown:'delay', popup_mMove:true, popup_zIndex:100, oX:10, oY:10}, // oX,oY is short for offsetX,Y
posts_search_op: 'opaque',
posts_search_op_opacity: 40,
deleted_posts: {detect:'acc', store:'LS', merge:true, auto_clean:true},
detect_sage: false, page_his: false,
// auto_config_posts_search: true,
promiscuous: false, accept_others_refresh:false,
hide_unwatched: false, refresh_src:'bg', refresh_src_th:3,
postMenu:true,
appearance: {
titleBar: {filter: true, settings: true, refresh: true, boards_selector: true},
initial: {state: 'float', width: 400, height: 400, left:0, top:0},
orderOnTB: false,
expand: {kwd:true, time:true, tag:false, list:false, ctrl:false},
},
imagesearch: {
use: true,
google: true,
iqdb: true,
saucenao: true,
whatAnime: true,
desustorage: true,
exhentai: true,
},
safety: {hide:false, remove:false, max:10000}, // at refresh
triage_place: 'topLeft',
env: {
disp_offset:0,
disp_filler:'',
popup_native:true,
expand_thumbnail_inline_native:true,
image_hover_native:false,
colorID_native:true,
backlink_native:true,
localtime_native:true,
auto_update_native:false,
event_dynamic:false,
popup_native_kill:true,
refresh_initial:true,
// thread_pos_static:true,
kwd_filter_delay: 0, kwd_filter_delay_len: 5,
},
};
var proto_search = Object.create(Object.prototype, {ci:{get:()=>pref.liveTag.ci}, rexps_remake:{value:comf.rexps_remake}}); // non-enumerables // needs prototype to save, uses hasOwnProperty in obj_delim_the_same
var pref_new = {
script_prefix: 'CatChan',
cpfx: 'CatChan_', // class prefix
tabID: 0, // prevent from opening new thread in the same tab between multiple CatChan instances, see open_new_thread(), saved by beforeunload in set_event_target // https://stackoverflow.com/questions/11896160/any-way-to-identify-browser-tab-in-javascript
features: {
page: true, graph: true, setting: true, setting2: true, postform: true, catalog: true, listener : true, uip_tracker: true, thread_reader: true, debug: false,
notify:{desktop:true, sound:true, favicon:true},
recovery: true, IDB:true,
domains: comf.Array_toObj(site0.domains, true),
},
max_capture: 576,
interval_found: 10,
write_to_ls: true,
aggregator: 'true', // radiobutton
server: true,
load_pref: true,
load_data: true,
check_page: false,
check_post: false,
check_thread: false,
import_format: 'obj', // radiobutton
max_graph: 576, // radiobutton
scale_thread: 10,
auto_start: true,
// workaround_for_dollchan: false,
prevent_redirection: false,
graph_animation: false,
autoconf: 'auto',
info_server: false,
info_client: false,
wafd_tb: 'tb',
wafd_open_spoiler: false,
show_page_fraction : true,
catalog_max_page: 5,
catalog_max_page_auto: true,
catalog_max_page_select: 'auto',
catalog_snoop_refresh: true,
catalog_auto_rollup_when_moving: true,
// catalog_size_width: 240,
// catalog_size_height: 350,
// catalog_size_text_width: 400,
// catalog_size_text_height: 16,
// catalog_size_tn1_width: 240,
// catalog_size_tn1_height: 240,
// catalog_size_tn2_width: 80,
// catalog_size_tn2_height: 80,
catalog_size_frame0_width: 30,
catalog_size_frame1_width: 69,
// catalog_enable_cross_board: true,
// catalog_enable_cross_domain: true,
catalog_2nd_images_show: false,
catalog_2nd_images_hover: true,
catalog_2nd_images_search: true,
catalog_posts_on_demand: true,
// catalog_checkbox_deletion_show: false,
// catalog_checkbox_deletion_hover: true,
// catalog_checkbox_deletion_search: true,
// catalog_popup: true,
// catalog_popdown: 'delay',
// catalog_popup_delay: 300,
// catalog_popdown_delay: 500,
catalog_popup_size_fix: true,
catalog_open_last50: 'exist_watch',
catalog_board_list_str: '',
// '//sample of board group\n' +
//// '//board_name[,nickname+board_name[+thread No.] | \'*\'+up to X page | \'^\'+style]...\n'+
// '//board_name[,nickname+board_name[+thread No.][\'*\'+up to X page]]..., [#Tag|##Tag]..., [!stats]\n'+
// 'Global/int/,8chan/int/,KC/int/,4chan/int/\n'+
// 'Global/b/,8chan/b/,KC/b/,4chan/b/\n'+
// 'v+gg,8chan/v/,8chan/gamergatehq/,4chan/v/\n'+
// 'Inter/pol/,8chan/pol/,4chan/pol/\n'+
// 'JapanShoppingMall,8chan/jpck/,8chan/japan2/\n'+
// 'tech,meguca/g/,lain/tech/,8chan/tech/,4chan/g/,KC/t/\n',
//// 'ScriptHome,8chan/scriptcdc/,KC/jp/35003\n',
//// 'script_home,8chan/scriptcdc/,KC/jp/35003,KC/kc/41434\n',
catalog_board_list_obj: null,
catalog_promiscuous: false,
// catalog_board_list_sel: 0,
get catalog_board_list_sel() {return (cataLog && cataLog.embed_mode && this[cataLog.embed_mode])? this[cataLog.embed_mode].board_list_sel : 0;},
set catalog_board_list_sel(val) {if (cataLog && cataLog.embed_mode && this[cataLog.embed_mode]) this[cataLog.embed_mode].board_list_sel = val;},
// catalog_sw_domain: 'https://8chan.co',
localtime_offset : -(new Date().getTimezoneOffset()/60),
// catalog_localtime : true,
// catalog_border_show : false,
// catalog_border : '1px solid',
// catalog_enable_background : false,
catalog_footer_ignore_my_own_posts : true,
catalog_footer_tag_letters : 3,
catalog_no_popup_at_expanded : true,
catalog_open_in_new_tab : true,
catalog_open_where : 'named',
catalog_open_where_click : true,
// catalog_use_named_window : true,
// catalog_triage : true,
// catalog_triage_place : 'topLeft',
catalog_triage_hist : 16,
triage:{
popdown:true, popdown_delay:2000, hide_toggle:true, sync_ex:'bg', sync_attr:'bg', sync_watch:'bg', // zIndex:110,
menu_str: pref0.triage.menu_str,
postMenu_str: pref0.triage.postMenu_str,
},
catalog_triage_str: 'KILL,X,,TIME,v,,WATCH,W,,UNWATCH,UW,,UNDO,U,',
// catalog_auto_update_countdown : true,
// catalog_show_setting : false,
// catalog_expand_at_initial : false,
// catalog_expand_at_initial_embed : true,
catalog_expand_with_hr : false,
cli: {auto:false,
json_str:'',
// json_str:'//{"site2":{"KC":{"time_offset":2}}} // summer time for KC.\n'+
// '//{"site2":{"4chan":{"protocol":"https:"}}} // use https to 4chan.\n'+
// '//{"pref":{"patch":{"rm_404_blacklist":["8chan"]}}} // 8chan sends corrupted data.\n',
eval_str: '', json_out_str:'', json_query_str:''
},
// show_tooltip : true,
tooltips: {help: {show: true, popup_delay:2000, popdown_delay:1000},
info: {show: true, popup_delay:300, popdown_delay:500},
zIndex:100},
filter: {
// show : false,
kwd: {use:false, str:'', re:false, ci:true, match:0, sentence:false, ew:false, op:true, post:false, inPost:false,
sub:true, name:true, trip:false, com:true, file:false, meta:false, flag:false, id:false, id2:false, rexps:null},
tag: false, tagBTgts:0, tagBFunc:0, tag_ci:false,
time: false, time_creation: false, time_watch: false, time_watch_creation: false, time_str: '', time_obj6: null, // for legacy, this line will be removed.
time: {use:false, func:'pn', time_val:Date.now()-86400000, h:0, w:0}, // time_str is getter/setter // func[0]:hide, func[1]:watch, 'p':posted, 'c':created, 'n':none, h for hide, w for watch, see onchange_funcs['filter.time.*W/']
list_time_scroll: true,
list : true,
// list_mark_time : true,
list_str : '',
// list_obj : [],
list_obj2 : {},
attr_list : true,
attr_list_str : '',
attr_list_obj2 : {},
bookmark_list : true,
bookmark_list_str : '',
bookmark_list_obj2 : {},
watch_list_str : '',
watch_list_obj2 : {},
// watch_list_mark_time : true,
// tag_scansite : true,
tag_search: {str:'', re:false, show_nof_boards:false, showActives:false, get ci(){return pref.liveTag.ci;}, sentence:false, rexps:null},
tag2bList: {label:'', by:'tag', rm_nvb:true},
auto_list: {use:false, str:'', obj7:null, kill:false, watch:true, show:false, sticky:false, style:false, style_str:'', dtrm_str:''},
disLWKA:true, disTWKA:false, // disable list/tag filter when keyword filter is active
postFilter: {use:false, hide:false, boards:false, boards_str:'', style:true, style_str:'', str:'', obj7:null, obj7_old:null},
},
postFilter: {use:false, str:'', obj7:null, obj7_old:null},
auto_watch: {watch:true, triage:false, triage_str:'', hide:false, hide_com:'TIME', style:false, style_str:'background:silver'},
catalog: {
// get filter(){console.log('WARNING: catalog.filter is accessed'); return pref.filter;}, // for safe
// max_threads : 512,
max_threads_at_refresh : 500,
bookmark_list_rm404 : true,
auto_load_filter : false,
auto_save_filter : false,
auto_save_filter_at_refresh : false,
tag : {ignore:12, max:12},
board: {recommendation: true, all_boards:false, board_tags: false, ex_list: false, ex_list_str: '', ex_list_obj2: null, board_tags_same: false},
style_general_list : true,
style_general_list_str: '',
style_general_list_obj2: null,
refresh : {except_bt : true, at_switch: true},
design : 'auto',
catalog_json : true,
embed : true,
embed_page: true,
embed_frame : true,
embed_archive: false,
// order : {reply_to_me: true, reply: true, watch: 'dont_care', sticky:'dont_care', find_sage_in_8chan: false},
order: {reply_to_me:true, reply:true, watch:'dont_care', sticky:'first', ordering:0},
// health_indicator: {on: true, max:10},
mimic_base_site: true,
// text_mode: {mode:'graphic', sub:true, name:false, com:true},
appearance: {titleBar:{__proto__:proto.appearance.titleBar}, expand:{__proto__:proto.appearance.expand}, __proto__:proto.appearance},
t2h_sel: 'no',
click: 'open',
popupX: {__proto__:proto.popupX},
// env:{thread_pos_static: false, __proto__:proto.env},
footer: {__proto__:proto.footer}, // this is required for save, or refers proto directly and deletes them all.
// view: 'catalog',
env:Object.create(proto.env),
format: {thumb: {__proto__:proto.format.thumb}, __proto__:proto.format},
merge_lv:false,
infoPv: {use: false, __proto__:proto.infoPv},
safety: {__proto__:proto.safety},
searchAs:true, accept_others_refresh:true,
merge_op:{__proto__:proto.merge_op},
merge_btn:{__proto__:proto.merge_btn},
__proto__: proto},
page: {
get embed(){return pref.catalog.embed_page;},
infinite: false,
// scan_tag:true,
format: { // show:{style:false, contents:false, layout:false, posts:true, fileinfo:true, images_2nd:true},
thumb: {size:'large', __proto__:proto.format.thumb}, __proto__:proto.format},
image_hover:true,
// get footer(){return pref.catalog.footer;},
// footer_br: false,
load_on_demand: true,
popupX: {__proto__:proto.popupX},
env: {kwd_filter_delay: 500, __proto__:proto.env},
// view: 'page',
appearance: {titleBar:{__proto__:proto.appearance.titleBar}, expand:{__proto__:proto.appearance.expand}, __proto__:proto.appearance},
safety: {__proto__:proto.safety},
footer: {__proto__:proto.footer},
merge_op:{__proto__:proto.merge_op},
merge_btn:{__proto__:proto.merge_btn},
__proto__: proto},
thread: {
embed: false,
format: { // show:{style:false, contents:false, layout:false, posts:true, fileinfo:true, images_2nd:true},
thumb: {size:'large', __proto__:proto.format.thumb}, __proto__:proto.format},
image_hover:true,
// get footer(){return pref.catalog.footer;},
// footer_br: false,
popupX: {__proto__:proto.popupX},
env:{auto_update_native:true, refresh_initial:false, kwd_filter_delay:500, __proto__:proto.env},
// t2h_num_of_posts : -1,
auto_update: false,
// use_expander_always: true, // for merge
// view: 'thread',
merge_mode:'all',
triage_hover:false,
appearance: {titleBar:{__proto__:proto.appearance.titleBar}, expand:{time:false, __proto__:proto.appearance.expand}, __proto__:proto.appearance},
safety: {__proto__:proto.safety},
footer: {__proto__:proto.footer}, // for safe
merge_op:{__proto__:proto.merge_op},
merge_btn:{__proto__:proto.merge_btn},
__proto__: proto},
float: {
click: 'open',
footer: {triage:true, __proto__:proto.footer},
// get footer(){return pref.catalog.footer;},
format: {thumb: {resize: true, __proto__:proto.format.thumb},
fc: {resize: false, width:240, height:350, max:true},
__proto__:proto.format},
save_board_list_sel: true,
popup3: {__proto__:proto.popup3},
popupX: {__proto__:proto.popupX},
env:Object.create(proto.env),
order: {reply_to_me:true, reply:true, watch:'dont_care', sticky:'first', ordering:0},
view: 'headline', hide_unwatched:false, refresh_src:'wl', catalog_size: 0, catalog_teaser: 0,
catalog:{thumb:{__proto__:proto.format.thumb}, __proto__:proto.format},
page:{thumb:{size:'large', __proto__:proto.format.thumb}, __proto__:proto.format},
headline:{thumb:{__proto__:proto.format.thumb}, __proto__:proto.format},
disable_kwd_filter_at_initial: true,
auto_launch: false, clone:true,
appearance: {titleBar:{__proto__:proto.appearance.titleBar}, expand:{__proto__:proto.appearance.expand}, __proto__:proto.appearance},
safety: {__proto__:proto.safety},
merge_op:{__proto__:proto.merge_op},
merge_btn:{__proto__:proto.merge_btn},
__proto__: proto},
headline:{
triage_hover:false,
triage_place:'topLeft',
max_letters: 150,
merge_truncated: true,
merge_lv: false,
subStyle: 0,
format: {thumb: {__proto__:proto.format.thumb}, __proto__:proto.format},
footer: {__proto__:proto.footer},
__proto__: proto},
common: {
clear_at_manual_scan : false,
consolidated_filter: false, // true,
consolidated_watch_list: true,
sync_watch_list: true,
sync_watch_list_delay: 100,
watch_list_rm404: 'no',
merge_list_rm404: 'dead',
blur_404: true,
// watch_list_fromAutoKwd: true,
// watch_list_fromTimeFilter: false,
},
// graph : {key: null, pipe: null},
uip_tracker: {on : false, posts: true, deletion: true, interval: 10, adaptive: true, highlight_str:'color:red', annotate:true,
auto_open:false, auto_open_th:300, auto_open_kwd:'',
deletion: {show:true, link:true, name:true, name_str:'color:red', addName:true, addName_str:'DELETED_', post:false, post_str:'opacity:0.4'},
sage: {detect:true, name:true, name_str:'color:blue', addName:false, addName_str:'SAGE_', post:false, post_str:'opacity:0.4', tolerance:1,
patch_bug:false, patch_bug2:false, patch_bug2nth:8, patch_bug3:true, annotate:true, page:false, patch_bug4:true, patch_bug5:false, annotate_page:false}},
thread_reader: {use: true, sync: true, triage: true, triage_close: true, check_num_of_children: true,
own_posts_tracker: false, show_own_post_by: 'anchor', show_reply_to_me_by: 'anchor', clean_up_own_posts: true, unmark_on_hover: true},
IDinfo: {use:true, auto:true,
ID: {use:true, nof:true, op:true, h:'', t:''},
ID2: {use:false, nof:true, op:true, h:'', t:''},
flag:{use:true, nof:true, ID:true, h:'(', t:')'},
trip:{use:false, nof:true, name:false, h:'(', t:')'},
name:{use:false, nof:true, trip:false, h:'(', t:')'}},
// IDinfo: {use:true, ID:true, flag:true, flagID:true, IDop:true, nofIDs:true, nofFlags:true, auto:true, name:false, trip:false, nameTrip:false, nofNames:true, nofTrips:true,
// ID2:true, ID2op:true, nofID2s:true, tripName:false},
settings: {indexing: 0, footer_sel:1},
tag : {gen: false, gen_str:''}, // dummy for checkbox and textarea.
cloudflare: {auto_reload: true, auto_reload_time: 5},
scan: {max:10000, lifetime:20, crawler:50, max_threads:1000, crawler_adaptive:true, crawler_idle_time_to_spawn:100, max_archive:150},
notify : {sound: {notify: false, src:'beep', beep_freq:1000, beep_length_f:0.2, beep_volume_f:1, reply_to_me: true, reply: true, new_thread: true, appear: true, supp_init:true,
file:null},
desktop: {notify: true, reply_to_me: true, reply: true, new_thread:true, appear:true, lifetime:30, show_last:false, supp_init:true,
limit:(brwsr.ff)? 10 : 30, delay:(brwsr.ff)? 500 : 0},
favicon: true,
title: {notify:true, hide_zero: true},
},
liveTag: {
use: true, max: 12, maxstr: 25, from:'post', lock_tags_in_op: true, ci: true,
inherit_board_name: true, lock_board_name: true, inherit_board_tags: true, lock_board_tags: true,
info: true, NC: true, // NotConsolidated
style: {ex:'color:blue', exurtm:'color:cyan;font-weight:bold', exur:'color:deepskyblue;font-weight:bold',
in:'color:red', inurtm:'color:yellow;font-weight:bold', inur:'color:orange;font-weight:bold',
pk:'color:brown', pkurtm:'color:tan;font-weight:bold', pkur:'color:darkgoldenrod;font-weight:bold',
use:true, urtm:'color:lime;font-weight:bold', ur:'color:limegreen;font-weight:bold'},
// style_urtm_obj4:{}, style_ur_obj4:{}, style_in_obj4:{},
pickup_interval: 10, rm_404:'imm', disp_delay:{fg:500, bg:5000}, click_func: 'in', click_func_bl: 'pkin', click_func_ctrl: 'ex',
watch_all: true, lazy_each:150, lazy_delay:100,
ex_list: true, ex_list_str:'8chan:#selection\n', ex_list_obj5:null,
rm_list: true, rm_list_str:'http*\n', rm_list_obj5:null},
virtualBoard: {
scan:false, scanDelay:5,
bl:{ show:true, max:20, p_board:'replace', p_remove:false, v_remove:true, dumb:false, showActives:false, activesWOF:true}, // activesWithOutFilter
scan_domains: comf.Array_toObj(site0.domains,'none'),
// scan_domains: {meguca:'none', lain:'none', '8chan':'none', '4chan':'none', KC:'none', lainjp:'none'},
instant_scan: true, vtag:'no', vtagsel:true, vptagsel:true, ts:'cr',
search: {show: true, str:'', re:false, sentence:false, rexps:null, __proto__:proto_search}, assb:true, // AutoShrinkSearchBar
},
tagSearch:{auto:false, th_b:20, th_t:1}, // for 8chan
style:{
design:{
titleBar:{base:'background:#b5ccf9;border:1px solid blue;font-weight:normal', ov:false, sel:'body', comp:true},
window:{base:'background:#e5ecf9;color:#000000;font-weight:normal', ov:false, sel:'body', comp:true},
popUp:{base:'background:#e5f4f9;color:#000000;border:2px solid blue;font-weight:normal', ov:false, sel:'body', comp:true},
post_new:{base:'border-left:3px solid red', ov:false, sel:'', comp:true},
post_editing:{base:'background:#cec952 !important', ov:false, sel:'', comp:true},
},
zIndex:1,
// sel: 'fix',
// fix:{
// titleBar_str:'background:#b5ccf9;border:1px solid blue;font-weight:normal',
// window_str:'background:#e5ecf9;color:#000000;font-weight:normal',
// popUp_str:'background:#e5f4f9;color:#000000;border:2px solid blue;font-weight:normal'
// },
// copy:{titleBar_str:'body', window_str:'body', popUp_str:'body', titleBar_comp:true, window_comp:true, popUp_comp:true},
// post_editing: 'background:#cec952 !important',
// post_new: 'border:2px solid red',
userCSS: {use:false, str:''},
tips:{
merged:true, merged_cnt:'>>',
// merged1:true, merged1_str:'merged1::before{float:left;content:">";}',
// merged2:true, merged2_str:'merged2::before{float:left;content:">>";}',
// merged3:true, merged3_str:'merged3::before{float:left;content:">>>";}',
},
addSS: {use:false, str:''},
},
recovery:{comment:true, interval:10, auto_clean:true},
healthIndicator: {show:true, max:10, expand_running:false, dont_retire_running:true, cancel:true},
network: {cross_domain:'indirect', fetch_actively:true, adaptive:true, th100:5, th100_delay:500, th20:10, th20_delay:100, timeout:15, overXFO:true, overCSPF:true},
stats: {use:false, retain_404:true, draw_delay:10, estimate_posts:true,
save:true, load:true, len_capture:1440, auto_acquisition:true, auto_acquisition_scan:true, auto_acquisition_scan_delay:120, auto_acquisition_all:false,
tolerant:true, tolerance:90, patch_tm:false}, // patch_tm is a patch for thread moving in lainchan or 4chan/bant/.
chart: {off_anime_blur:true, window_width:400, window_height:400, instant_scan:true, load_on_demand:false,
inst:{len:120, scale_thread:10, time_sel:1, board_sel:0, show_legend:true, // separate:false,
show: {np:true, p:false, ep:false, nt:false, t:true, et:false}, clip_np:false, clip_np_val:0,
options: {bezierCurve: false, animation:false, pointDot:true, pointDotRadius:4}}},
archive:{load_img:true, restore_auto:true, clear_threads:true, clear_files:false, format:'auto', domain:0, board:'',
src:'shown', store_auto:false, dir_dled:null, open_local:false, fix_inconsistency:true, store_watched:false,
oneshot: {post:true, tn:true, img:true, webm:true , post_idb:true, tn_idb:true, img_idb:true, webm_idb:true},
live: {post:true, tn:true, img:false, webm:false, post_idb:true, tn_idb:true, img_idb:false, webm_idb:false},
deleted: {post:true, tn:true, img:false, webm:false, post_idb:true, tn_idb:true, img_idb:false, webm_idb:false},
IDB: {auto_clean:true, auto_clean_init:true, prune:168, prune_flush:false, nof_tr:10, nof_cl:20, nof_cl_max:80,
auto_restore:false, auto_restore_watch:false, auto_restore_remove:true,
watchdog:120, redirect_404: false, redirect_404_CSP: false}, // check_every:1, },
kwd: {use:true, str:'', re:false, ci:true, match:0, op:true, post:false, sub:true, name:true, trip:false, com:true, file:false, meta:false, sentence:false, ew:false, rexps:null},
list:true,
list_str:'', list_obj6:null, list_inherit:false,
tar: true, tarsize: 100, sub_in_filename:true,
// get list_str(){return pref3.archive.list_str_get();},
// set list_str(val){pref3.archive.list_str_set(val);},
files_sel:0,
IDB_board_sel:0, IDB_board_sel_gfunc_pre:pref4.archive.IDB_board_sel_gfunc_pre,
IDB_thread_sel:0, IDB_thread_sel_gfunc_pre:pref4.archive.IDB_thread_sel_gfunc_pre,
IDB_select_multiple: true,
editing_timeout: true,
},
threadStats: {use:false, full:true, retry:false},
RSS: {str:'', sec_auto:true, dnd:{nf:false, f_rec:true, f_vbd:false}},
debug_mode : {unread_count:'', parse_error:false, site2func:'', site2func_expand:true, pfunc:'', pfunc_expand: true, pfunc_all:'', pfunc_all_expand: true, pfunc_all_site2: false,
pfunc_comp:'', pfunc_comp_expand_same:true, pfunc_comp_expand_diff:true, pfunc_comp_proto:'', domains: comf.Array_toObj(site0.debug_domains,true),
types: comf.Array_toObj(site0.debug_types, true)},
test_mode: {tips:false, num:0, num_f:0, test_str:''},
patch: {
delayed_invoke: {use: false, sec: 10},
rm_404_blacklist: [], //['8chan'], // 8chan sends corrupted data.
},
pref2: {
KC: {summer_time: false},
meguca: {
// get remove_history_class(){return pref.catalog_open_where!=='_self';},
historyAPI: true,
utilize_boards_json:true, utilize_boards_json_domain:true,},
'8chan': {utilize_boards_json:true,},
BBC: {summer_time: true},
},
easy: {posts_ago:24, threads_ago:24, max_boards:50,},
easy2: {
reset: true, presets: 0, time_post:24, time_op:24, basics:true, // easy2 local parameters.
auto_update:false, auto_update_period:10, // easy2 local parameters.
VB: {local:0, global:0}, LTfrom: 0, limits:0, // easy2 local parameters.
virtualBoard: {scan:true, bl:{show:true, max:100}},
liveTag: {use:false, from:'op'},
catalog: {embed:true, embed_page:true, max_threads_at_refresh:500,
auto_load_filter:true, auto_save_filter:true, auto_save_filter_at_refresh:true, auto_update:true, auto_update_period:10},
filter: {time:{use:false, func:'pn', tv:24}}, // time_str is dropped intentionally for not overwriting when time.use===false
// filter: {time_watch:false, time_watch_creation:false},
page:{auto_update:true, auto_update_period:10},
thread: {embed:false, auto_update:true, auto_update_period:10},
notify:{desktop:{notify:true}},
stats: {use:false},
scan:{max:100, max_threads:1000},
network:{fetch_actively:false},
healthIndicator:{expand_running:false},
},
INST:{},
dashboard: {rss_live:true, rss:null, rss_apply_global:false, rss_com:'show'},
colorPicker: { bgbd:'bg', bds:'2px solid', txt:'', picker:'#ff0000', col:'#ff0000'},
proto: proto, // for overwrite from pref_default.
};
for (var i=0;i<50;i++) pref_new.debug_mode[i] = false;
for (var i=0;i<220;i++) pref_new.test_mode[i] = false;
if (site0.pref_default2) pref_func.pref_overwrite(pref_new,site0.pref_default2);
if (site0.pref_default ) pref_func.pref_overwrite(pref_new,site0.pref_default);
if (site0.pref_default3) comf.overwrite_prop(pref_new,site0.pref_default3);
// if (site) if (site2[site.nickname].pref_default) pref_func.pref_overwrite(pref_new,site2[site.nickname].pref_default);
if (for_save) {
pref_func.delete_null(pref_new);
// Object.defineProperty(pref_new.page, 'footer',{get:function(){return pref_new.catalog.footer;}, enumerable:true, configurable:true}); // patch for refer to each object instead of global pref.
// Object.defineProperty(pref_new.thread,'footer',{get:function(){return pref_new.catalog.footer;}, enumerable:true, configurable:true});
// Object.defineProperty(pref_new.float, 'footer',{get:function(){return pref_new.catalog.footer;}, enumerable:true, configurable:true});
delete pref_new.tabID;
} else {
Object.defineProperty(pref_new, 'samples', {get:function(){return pref_func.settings.samples;}});
Object.defineProperty(pref_new.filter.time, 'time_str', {get: function(){return this.time_val>0x10000000? new Date(this.time_val).toLocaleString() : this.time_val;},
set: function(v){this.time_val = Date.parse(v) || 0;}}); // configurable:false for test
}
// comf.Object_modifyDescriptor(pref_new.style.userCSS,'sample',{writable:false});
comf.Object_modifyDescriptor(pref_new.features.domains, site0.domain, {writable:false});
Object.defineProperty(pref_new.triage, 'sampleLoader', {value:0, configurable:true});
return pref_new;
}
var gGEH = {
get_key_rec: function(e){return this.get_key_recursive(e.target, e.currentTarget);},
get_key_recursive: function(pn, pn_end, allow_merged){
var key;
while (pn && !(key=this.pns_all_keys.get(pn)) && pn!==pn_end) pn = pn.parentNode;
if (key) if (!allow_merged && typeof(key)!=='string') key = key.lths[0].key; // for merged thread
return key;
},
pns_all_keys: new WeakMap(),
pns_resize: new WeakMap(), // stores resize funcs
triage_in: null, // patch for test_mode['127']
triage_in2: null, // patch for test_mode['127']
last_viewed: null,
time_jumped: 0,
drag: (function(){
var sx = 0;
var sy = 0;
var effect = null;
var callback = null;
function dragover(e){ // http://www.html5rocks.com/ja/tutorials/dnd/basics/
e.preventDefault();
e.dataTransfer.dropEffect = effect;
}
function dragend(e){
document.body.removeEventListener('dragover',dragover,false);
var pn = e.currentTarget;
pn.removeEventListener('dragend',dragend,false);
var dx = e.screenX - sx;
var dy = e.screenY - sy;
if (effect==='move') {
var s = pn.style;
if (pref.catalog_popup_size_fix && pn.dataset.isPopup==='true') {
s.width = pn.offsetWidth + 'px';
s.height = pn.offsetHeight + 'px';
}
if (s.left) s.left = (parseInt(s.left ,10) + dx) + 'px';
else s.right = (parseInt(s.right,10) - dx) + 'px';
if (s.top) s.top = (parseInt(s.top ,10) + dy) + 'px';
else s.bottom = (parseInt(s.bottom,10) - dy) + 'px';
}
if (callback) callback(e, dx, dy);
callback = null;
effect = null;
e.stopPropagation();
}
return {
started: function(e, callback_in, effect_in){
sx = e.screenX;
sy = e.screenY;
document.body.addEventListener('dragover',dragover,false);
e.currentTarget.addEventListener('dragend',dragend,false);
effect = effect_in;
callback = callback_in;
e.stopPropagation();
},
get dragging(){return effect;}
};
})(),
};
var pref_func = {
delete_null: function delete_null(dst){
for (var i in dst) {
if (dst[i]===null /*|| typeof(dst[i])==='function'*/) delete dst[i];
else if (typeof(dst[i])==='object' && !Array.isArray(dst[i])) delete_null(dst[i]);
}
},
pref_overwrite: function pref_overwrite(dst,src,strict,loose, test_new_func){ // test_new_func for cosolidate with overwrite_prop, to delete DOMs of files, see 'load_default'
for (var i in src) // if (!pref || !pref.test_mode['199'] || src.hasOwnProperty(i)) // test_mode['199'] should be tested later.
if (loose || dst[i]!==undefined && (dst[i]!==null || pref && pref.test_mode['117'])) {
if (strict && typeof(src[i])!==typeof(dst[i])) continue;
if (test_new_func? dst[i]!==null && src[i]!==null && typeof(dst[i])==='object' && typeof(src[i])==='object'
: typeof(src[i])==='object' && !Array.isArray(src[i])) pref_overwrite(dst[i],src[i],strict,loose, test_new_func); // CAUTION. SKIP NULL IMPLICITLY. SHOULD THIS BE FIXED?
// else dst[i] = src[i];
else if (dst[i]!==src[i] || !dst.hasOwnProperty(i) && (Object.getPrototypeOf(dst)||{})[i]!==(Object.getPrototypeOf(src)||{})[i]) dst[i] = src[i]; // for i15 case, see Debug.diff // utilize prototype
// else if (dst[i]!==src[i]) dst[i] = src[i]; // utilize prototype
}
return dst;
},
parseJSONCs: (function(){
function err_extra(str, src_str, allow){
if (str.search(/^[\s\n]*$/)===0) return 0;
if (!allow) console.log('WARNING: '+src_str+': There are extra characters in JSON: '+str);
return 1;
}
return function(str, callback, src_str, allow_prefix, callback_args0, callback_args1){ // https://stackoverflow.com/questions/17638305/why-is-bind-slower-than-a-closure
var result = {pass:0, fail:0, extra:0, prefix:0};
var prefix = '';
var json_str = '';
var start = 0;
var level = 0;
var i=-1;
while (++i=7 && str.slice(outer_end).match(/^\s*(\/\/[^\n]*)*\n/);
if (line_comment) outer_end += line_comment[0].length;
callback(obj, prefix.replace(/^[\s\n]*/,''), callback_args0, callback_args1, start, i+1, start-prefix.length, outer_end); // call even if obj===null
}
} else if (level<0) {result.extra += err_extra(json_str, src_str); level = 0;}
json_str = '';
start = outer_end;
}
} else if (s_i==='/') {
if (str[i+1]==='/') {json_str += str.slice(start,i); i++; while (++i0? 'Failed:'+result.fail : '')+(extra>0? (result.fail>0? ', ':'')+'Extra strings:'+extra : ''))+', Passed:'+result.pass +
' @'+ new Date().toLocaleString();
return suc;
},
queryOrSet_params_by_JSON: (function(){
var str_out;
function query_or_overwrite(obj, prefix, query, enables){
for (var i in obj) {
// var API = i==='add_rss' && site2 && site2['rss'];
// var root_obj = i==='site2'? site2 : i==='pref'? pref : i==='pref_func'? pref_func : i=='liveTag'? liveTag : i==='site3'? site3 : API || null; // remove eval(i)
var root_obj = i==='site2'? site2 : i==='pref'? pref : i==='pref_func'? pref_func : i=='liveTag'? liveTag : i==='site3'? site3 : i==='site'? site : null; // remove eval(i)
// if (i==='site2' || i==='pref' || i==='pref_func' || i=='liveTag' || i==='site3')
if (root_obj && (!enables || enables.indexOf(i)!=-1))
// if (!query) pref_func.pref_overwrite(root_obj, API? obj : obj[i], undefined, i==='site2');
if (!query) pref_func.pref_overwrite(root_obj, obj[i], undefined, i==='site2');
else str_out = '{"' + i + '":' + pref_func.pref_query(query===true? root_obj : query, obj[i]) + '}\n';
}
}
return function(query, str_in, enables, pn_out){
if (!str_in) return;
str_out = '';
var result = this.parseJSONCs(str_in, query_or_overwrite, 'JSON_CLI', false, query, enables);
if (pn_out) var suc = this.parseJSONCs_out(pn_out, result);
if (query && suc) return str_out;
};
})(),
site2_json: function(enables){
this.queryOrSet_params_by_JSON(false, pref.cli.json_str, enables);
},
RSS_json: (function(){
function fmt_and_copy(dst, src, func_fmt){ // fmt_ane_copy is faster than copy_and_fmt if dic is accumulated.
func_fmt(src);
for (var t in src) dst[t] = src[t];
}
function RSS_cfg(obj, prefix, done_init, remake){
var pfunc = site2['rss'].parse_funcs['page_html'];
if (!prefix) {if (site2['rss']) site2['rss'].add_rss_append(obj, done_init, remake);}
else if (prefix.indexOf('DEFAULT')!==-1) for (var i in obj) {
if (i==='dic_tags' || i==='dic_funcs') RSS_cfg(obj[i], i);
// if (i==='dic_tags') fmt_and_copy(pfunc.dic_tags.always, obj[i], pfunc.fmt_dic_tags);
// else if (i==='dic_funcs') for (var j in obj[i]) pfunc.dic_funcs[j] = pfunc.eval_func(obj[i][j]);
else pfunc.opt_def[i] = obj[i];
} else if (prefix.indexOf('dic_tags')!=-1) {
if (('incase' in obj) || ('always' in obj)) for (var j in obj) fmt_and_copy(pfunc.dic_tags[j], obj[j], pfunc.fmt_dic_tags);
else fmt_and_copy(pfunc.dic_tags.always, obj, pfunc.fmt_dic_tags);
} else if (prefix.indexOf('dic_funcs')!=-1) for (var j in obj) pfunc.dic_funcs[j] = pfunc.eval_func(obj[j]);
// var tgt = prefix.indexOf('dic_tags')!=-1? pfunc.dic_tags : prefix.indexOf('dic_funcs')!=-1? pfunc.dic_funcs : null;
// if (tgt) {
// if (tgt===pfunc.dic_tags) for (var i in obj) pfunc.fmt_dic_tags(obj[i]);
// else if (tgt===pfunc.dic_funcs) for (var i in obj) obj[i] = pfunc.eval_func(obj[i]);
// pref_func.pref_overwrite(tgt, obj, undefined, true);
// } else if (site2['rss']) site2['rss'].add_rss_append(obj);
}
return function(init, remake){
if (!init) {
var pfunc = site2['rss'].parse_funcs['page_html'];
var tgts = [pfunc.opt_def, pfunc.dic_tags.incase, pfunc.dic_tags.always, pfunc.dic_funcs];
for (var i=0;i/g,'>').replace(/"/g,'"').replace(/'/g,''');
},
report_error: function(str){
console.log(str);
var pn = this.settings && this.settings.pn13 && this.settings.pn13.getElementsByClassName(pref.cpfx+'errors')[0];
if (pn) pn.appendChild(cnst.dom(''+str+'
'));
},
add_to_list_2: null, // inserted later
fmt4str2_2: null, // inserted later
};
var pref = pref_default(); // pref_default is loaded.
(function(){
function pref_overwriteAll(storage){
var str = storage && storage[pref.script_prefix+'.pref'];
if (str) pref_func.pref_overwrite(pref, JSON.parse(str), true);
// if (!src_str) return;
// var src = JSON.parse(src_str);
// if (src.proto) {pref_func.pref_overwrite(pref.proto, src.proto, true); delete src.proto;}
// pref_func.pref_overwrite(pref, src, true);
}
pref_overwriteAll(localStorage);
// if ( localStorage && localStorage[pref.script_prefix+'.pref']) pref_func.pref_overwrite(pref,JSON.parse( localStorage[pref.script_prefix+'.pref']),true);
for (var i in {catalog:null, page:null, float:null, thread:null}) if (!pref[i].save_board_list_sel) pref[i].board_list_sel = 0;
pref_overwriteAll(sessionStorage);
// if (sessionStorage && sessionStorage[pref.script_prefix+'.pref']) pref_func.pref_overwrite(pref,JSON.parse(sessionStorage[pref.script_prefix+'.pref']),true);
if (window.name) for (var i in {catalog:null, page:null, float:null, thread:null}) pref[i].board_list_sel = 0;
if (pref.cli.auto) pref_func.site2_json(['pref']);
pref.script_prefix = pref_func.sanitize(pref.script_prefix);
if (site0.isStep) {
// for (var i in site.features) site.features[i] = false;
for (var i in pref.features) if (i!=='domains') pref.features[i] = false;
for (var i in pref.features.domains) if (i!==site0.domain) pref.features.domains[i] = false;
brwsr.sw_cache = null;
pref_func.pref_overwrite(pref,{
catalog:{auto_update:false},
thread:{auto_update:false},
page:{auto_update:false},
float:{auto_update:false},
virtualBoard:{scan:false},
stats:{auto_acquisition_scan:false},
cloudflare:{auto_reload:false},
});
}
if (pref.pref2.KC.summer_time) site2['KC'].time_offset = 2;
if (!window.SharedWorker) {
pref.info_server = false;
pref.info_client = false;
}
})();
var pref3 = { // auto sync objects.
stats: {use:null, estimate_posts:null},
reload_required: false,
// order:{ordering_old: 0},
// filter: {
// time_str: function(parent,key,val, parent_src){parent_src['time_obj6'] = Date.parse(val);},
//// time_str: function(parent,key,val){parent[key.replace(/str$/,'obj')] = Date.parse(val);},
//// time_obj6: 0,
// },
// notify:{sound:{file:null}},
archive: {
working: false,
list_str: function(parent,key,val){parent[key.replace(/str$/,'obj2')] = pref_func.str2obj2(val);},
list_obj2: null,
// list_obj3: null,
jsons: null,
imgs: null,
dir: null,
// list_str_set: function(val){
// pref3.archive.list_str = val;
// pref_func.str2obj2(pref3.archive,'list_obj2',val);
// },
// list_str_get: function(){
// var lm = liveTag.mems;
// for (var name in pref3.archive.list_obj2) {
// var dbt = comf.name2domainboardthread(name);
// if (!dbt[2]) continue;
// if (lm[dbt[0]] && lm[dbt[0]][dbt[1]]) var lth = lm[dbt[0]][dbt[1]][dbt[2]];
// if (lth && lth.archived && lth.time_checked !== pref3.archive.list_obj2[name].time) pref3.archive.list_str = list_func_1(pref3.archive.list_str, name, lth.time_checked); // BUG. NOT implemented yet.
// }
// return pref3.archive.list_str;
// function list_func_1(str,name,datetime){ // refer 'triage_exe'
// var key = new RegExp('(^|,)'+name.replace(/\+/,'\\+')+'([\\^@!][^,\n]*)*(,|\n|$)','mg');
//// var millisec = datetime%1000;
//// var time_str = '@' + new Date(datetime).toLocaleString() + ((datetime%1000==0)? '' : '.'+millisec);
//// str = str.value.replace(key,',') + ',' + name + time_str + '\n';
// str = str.value.replace(key,',') + ',' + name + '\n'; // remove time_str
// return str.replace(/,,+/g,',').replace(/^,/g,'').replace(/\n,/g,'\n').replace(/\n\n+/g,'\n').replace(/^\n/,'');
// }
// },
},
proto: {
merge_list_str: function(parent,key,val){
if (!this.merge_list_obj2_old) this.merge_list_obj2_old = this.merge_list_obj2;
var head = null;
var all_fullname = true;
this.merge_list_obj2 = pref_func.str2obj2(val.replace(/\s*\+\s*/g,',+'), 'merge', null, function(field, tgt){
var add = field[0]==='+'; // .search(/^\s*\+\s*/)!=-1;
var name = (add? field.slice(1) : field) || 'DEFAULT'; // field.replace(/^\s*\+\s*/,'') || 'DEFAULT';
var dbt = comf.name2domainboardthread(name,true);
if (!dbt[0] || !dbt[1] || !dbt[2]) all_fullname = false;
if (add && head) head[head.length] = name;
else head = [name];
tgt[name] = head;
});
if (all_fullname) this.merge_list_obj2[':F'] = true;
// if (pref.test_mode['177']) { // DOESN"T WORK
// this.merge_list_obj2c = {};
// if (gClg) for (var name in gClg.AllThreads) this.merge_list_obj2c_update(name, true);
// }
},
merge_list_obj2: null,
// merge_list_obj2c: {}, // cache
merge_list_obj2_old: null,
merge_lv_str: function(parent,key,val){
if (!this.merge_lv_obj2_old) this.merge_lv_obj2_old = this.merge_lv_obj2;
parent['merge_lv_obj2'] = pref_func.str2obj2(val, 'merge_lv', null, 'val');
},
merge_lv_obj2: null,
merge_lv_obj2_old: null,
// merge_lv_obj3: null,
},
test_mode: {js_file:null},
};
// Object.defineProperty(pref3.proto, 'merge_list_obj2c_update', {value:function(name, single){ // DOESN'T WORK
// var arr = pref_func.merge_obj5a_sc(name, this.merge_list_obj2, null);
// if (arr) {
// if (single) this.merge_list_obj2c[name] = arr;
// else for (var i=0;i0? Array.prototype.slice.call(fm) : [pn]);
// var fm; // working code
// if (Array.isArray(pn) || pn instanceof HTMLCollection || pn instanceof NodeList) fm = pn;
// else {
// var query_str = 'input,textarea,select'+ ((set)? '' : ',span[data-class=show_value]');
// fm = Array.prototype.slice.call(pn.querySelectorAll(query_str));
// if (fm.length==0) fm = [pn];
// }
this.apply_prep_2_all(fm, set, propagate, false, make_obj, pref_obj);
if (!no_save) this.apply_prep_save(pn,set,propagate, false, make_obj, pref_obj);
if (mirror!=='never') this.apply_prep_mirror(fm[0],set,propagate, mirror, make_obj, pref_obj); // will be removed.
},
apply_prep_1n: function(name,set,propagate, mirror, make_obj, pref_obj){
this.apply_prep_1(pref_func.settings.pnOrDummy(name),set,propagate, mirror, make_obj, pref_obj);
},
apply_prep_1: function(pn,set,propagate, mirror, make_obj, pref_obj){
var old_val = this.apply_prep_2(pn,set,propagate, false, make_obj, pref_obj);
this.apply_prep_save(pn,set,propagate, false, make_obj, pref_obj);
this.apply_prep_mirror(pn,set,propagate, mirror, make_obj, pref_obj);
return old_val;
},
apply_prep_mirror: function(pn, set,propagate, mirror, make_obj, pref_obj){
var name = pn.name || pn.getAttribute('name'); // getAttribute for span, pn.name for pnOrDummy
if (name && this.mirror_names(name)) mirror = true;
if (mirror) {
var fms = [];
for (var i in this.mirror_targets) if (this.mirror_targets[i]) {
var pns = this.mirror_targets[i].querySelectorAll(pn.tagName+'[name="'+name+'"]');
for (var j=0;j=0;j--) if (fm[j]===pn) fm.splice(j,1);
// if (fm.length==0) return;
// this.apply_prep_2(fm,set,propagate, mirror, make_obj, pref_obj);
},
apply_prep_save: function(fms,set,propagate, mirror, make_obj, pref_obj){
if (pref.test_mode['117']) {if (sessionStorage && set) sessionStorage[pref.script_prefix+'.pref']=JSON.stringify(pref_func.site2_json_ex_remove());}
else {if (sessionStorage && (set||make_obj)) sessionStorage[pref.script_prefix+'.pref'] = JSON.stringify(pref);}
},
apply_prep_2_all: function(fms,set,propagate, mirror, make_obj, pref_obj){
for (var i=0;i // if (!fm.name) continue;
if (fm.type=='button') return;
var target_hier = pref_func.get_tgt(name, /*fm.type==='file'? pref3 :*/ pref_obj || set!==true && set || null); // set(==this['.']) for each instance
var parent = target_hier[0];
var tgt = target_hier[1];
if (!parent) return;
var old_val = set? parent[tgt] : undefined; // don't invoke getters if !set
var tagName = fm.tagName;
if (tagName==='INPUT') {
if (fm.type==='file') {
if (!set && parent[tgt] && parent[tgt]!==fm) fm.parentNode.replaceChild(parent[tgt],fm);
else parent[tgt] = fm; // set also when set===false, keep tracking the DomNode.
} else if (set) {
// if (parent[tgt+'_old']!==undefined) parent[tgt+'_old'] = parent[tgt]; // not used
this.apply_prep_set(parent, tgt, fm, name);
// if (!mirror && fm.type!=='radio') this.apply_prep(fm,false,false,true); // !mirror for cutting infinite loop. // radio has multiple elements.
} else this.apply_prep_load(fm, parent, tgt);
if (set || make_obj)
if (typeof(parent[tgt])==='string' )
if (fm.type==='text') {
// if (tgt.substr(-3,3)==='str' && parent[tgt.substr(0,tgt.length-3)+'obj4']) pref_func.str2obj4(parent,tgt.substr(0,tgt.length-3)+'obj4',fm.value);
if (tgt.substr(-3,3)==='str' && parent[tgt.slice(0,-3)+'obj6']) pref_func.str2obj6(parent,tgt,fm.value,name);
}
} else if (tagName==='TEXTAREA') {
if (set) parent[tgt] = fm.value;
else fm.value = parent[tgt];
if (set || make_obj) {
if (tgt.slice(-3)==='str') {
var stgt = tgt.slice(0,-3);
if (parent[stgt+'obj']) pref_func.str2obj(tgt);
else if (parent[stgt+'obj2']) parent[stgt+'obj2'] = pref_func.str2obj2(fm.value);
// if (tgt.substr(-3,3)==='str' && parent[tgt.substr(0,tgt.length-3)+'obj4']) pref_func.str2obj4(parent,tgt.substr(0,tgt.length-3)+'obj4',fm.value);
else if (parent[stgt+'obj5']!==undefined) pref_func.str2obj5(parent,stgt+'obj5',fm.value, tgt==='rm_list_str');
else if (parent[stgt+'obj6']===null) pref_func.str2obj6(parent,tgt,fm.value,name); // obj6===null always, obj6 is located in pref3,
else if (parent[stgt+'obj7']!==undefined) {
if (parent[stgt+'obj7_old']!==undefined) parent[stgt+'obj7_old'] = parent[stgt+'obj7'];
parent[stgt+'obj7'] = pref_func.str2obj7.s2o({}, fm.value, name);
}
}
}
} else if (tagName==='SELECT') {
if (set) this.apply_prep_set(parent, tgt, fm, name); // if (parent[tgt]!==undefined) parent[tgt] = fm.selectedIndex;,
else {
// var tgt_obj = (tgt.search(/sel/)!=-1)? tgt.replace(/sel/,'obj') : null;
// if (parent[tgt_obj]) {
// fm.length=0;
// for (var j=0;j=fm.length) parent[tgt] = 0;
// fm.selectedIndex = parent[tgt];
}
} else if (tagName==='SPAN') {
if (!set && fm.dataset['show_value']) {
var val = parent[tgt];
var func_str = this.apply_prep_2_str[tgt+':'+parent[tgt]];
if (func_str) val = (typeof(func_str)==='string')? func_str : func_str(parent);
// if (fm.getAttribute('name').substr(-7,7)==='t2h_sel' && ['L','M','N'].indexOf(parent[tgt])!=-1) val = parent['t2h_'+parent[tgt]];
fm.textContent = val.toString().replace(/^./,function(v){return v.toUpperCase();});
}
}
if (propagate) {
if (fm.oninput) fm.oninput.call(fm, {currentTarget:fm, target:fm}, true);
if (fm.onchange) fm.onchange.call(fm, {currentTarget:fm, target:fm}, true);
}
return old_val;
},
apply_prep_set: function(parent, tgt, fm, name){ // don't set if parent[tgt]===undefined
var type = typeof(parent[tgt]);
if (type==='number') {
var num_str = fm.value.replace(/[\uff10-\uff19]/g,function(m){return String.fromCharCode(m.charCodeAt(0)-65248);}); // full width numbers -> half width numbers.
var val;
parent[tgt] = (fm.tagName==='SELECT')? fm.selectedIndex
: (val = (name && name.substr(-2)==='_f')? parseFloat(num_str) : parseInt(num_str,10), isNaN(val)? 0 : val)
} else if (type==='boolean') parent[tgt] = fm.checked;
else if (type==='string') if (fm.type==='text' || fm.type==='color' || fm.tagName==='SELECT' || fm.checked) parent[tgt] = fm.value;
},
apply_prep_load: function(fm, parent, tgt){
var val = parent[tgt];
if (fm.tagName==='SELECT') {
fm.selectedIndex = (typeof(val)==='number')? (val>=fm.length? parent[tgt]=0:0, parent[tgt])
: Array.prototype.slice.call(fm.options).map(function(v){return v.value;}).indexOf(parent[tgt]);
// } else fm.selectedOptions = parent[tgt]; // selectedOptions is read only
} else { // INPUT
var type = typeof(val);
if (type=='number' ) fm.value = val;
else if (type=='boolean') fm.checked = val;
else if (type=='string' ) if (fm.type==='text') fm.value = val;
else if (val === fm.value) fm.checked = true;
}
},
apply_prep_2_str: {
't2h_sel:L': function(parent){return parent['t2h_L'];},
't2h_sel:M': function(parent){return parent['t2h_M'];},
't2h_sel:N': function(parent){return parent['t2h_N'];},
't2h_sel:N_unread': function(parent){return parent['t2h_N']+'+unread';},
't2h_sel:unread': 'All unread',
'posts_search_op:opaque': function(parent){return 'opaque '+parent['posts_search_op_opacity']+'%';},
// 'popup2:sr': 'SearchResult',
// 'popup2:srpv': 'SearchResult/Preview',
// 'popup2:pv': 'Preview',
// 'popup2:chart': 'PostRateChart',
// 'popup2:dp': 'DeletedPosts',
},
// make_pref_obj : function(name){ // copy of part of apply_prep.
// var target_hier = pref_func.get_tgt(name);
// var parent = target_hier[0];
// var tgt = target_hier[1];
// if (tgt.search(/str$/)!=-1 && parent[tgt.replace(/str$/,'obj')]) pref_func.str2obj(tgt);
// if (tgt.search(/str$/)!=-1 && parent[tgt.replace(/str$/,'obj2')]) pref_func.str2obj2(parent,tgt.replace(/str$/,'obj2'),parent[tgt]);
// },
catalog_board_list_str_or: '',
catalog_board_list_str_bt: '',
catalog_board_list_str_bt_same: '',
add_onchange: function(pn,func_obj, func_obj2){ // obj2 for oninput
return this.set_event_target(pn, this.add_onchange_entry_func.bind(func_obj), func_obj2, func_obj);
},
add_onchange_entry_func: function(e, propagated){ // always used after binded.
var pn_name = e.currentTarget.getAttribute('name') || e.currentTarget.dataset.name; // getAttribute for , but using dataset is right.
// var pn_name = e.currentTarget.getAttribute('name'); // for
if (!propagated && ['INPUT','TEXTAREA','SELECT'].indexOf(e.currentTarget.tagName)!=-1) var old_val = pref_func.apply_prep_1(e.currentTarget, this['.'] && this['.'].pref || true); // this['.'] for each instance
if (this[pn_name]) this[pn_name].call(this,e); // e.currentTarget,e); // exact match
else if (this[pn_name+' w/']) this[pn_name+' w/'].call(this,e,pn_name);
else if (this[pn_name+'/O']) this[pn_name+'/O'].call(this,e,pn_name,old_val);
// else if (this[pn_name+'/t']) this[pn_name+'/t'].call(this,e); // all should be this.
else {
var idx = pn_name.indexOf('.');
if (idx!=-1) {
var name = pn_name.substr(idx); // *.XXX
if (this['*'+name]) this['*'+name].call(this,e); // e.currentTarget,e);
else if (this['*w/'+name]) this['*w/'+name].call(this,e,pn_name); // e.currentTarget,e,pn_name);
else {
var idx_l = pn_name.lastIndexOf('.');
if (idx_l!=-1) {
var arr = pn_name.split('.');
var name = pn_name.substr(0,idx_l+1)+'*'; // XXX.YYY.*
if (this[name]) this[name].call(this,e); // e.currentTarget,e);
else if (this[name+'W/']) this[name+'W/'].call(this,e,arr); // arr version
else if (this[name+'w/']) this[name+'w/'].call(this,e,pn_name); // e.currentTarget,e,pn_name); // XXX.YYY.* with source name
else {
// var arr = pn_name.split('.');
var name02 = arr.slice(0,-2).join('.')+'.*.'+arr.slice(-1)[0]; // XXX.*.ZZZ
if (this[name02]) this[name02].call(this,e);
else if (this[name02+'/O']) this[name02+'/O'].call(this,e,pn_name,old_val);
else {
var name0 = arr.slice(0,-2).join('.')+'.*.*W/'; // XXX.*.*
if (this[name0]) this[name0].call(this,e,arr);
else if (arr[0]==='catalog' || arr[0]==='page' || arr[0]==='headline' || arr[0]==='float' || arr[0]==='thread') { // for these, hierarchical approach is PROHIBITED.
var nameMV = 'MODEVIEW.'+arr.slice(1,-2).join('.')+'.*.*W/'; // MODEVIEW.XXX.*.*
if (this[nameMV]) this[nameMV].call(this,e,arr);
// else {
// var name_middle = pn_name.split('.').slice(1,-1).join('.');
// var func;
// if (name_middle && func = this['*.'+name_middle+'.*']) func.call(this,e);
// else if (name_middle && func = this['*.'+name_middle+'.*w/']) func.call(this,e,pn_name); // *.YYY.*
} else if (idx!=-1) { // hierarchical approach,
var name_0 = arr[0]; // XXX.YYY
var name_1 = pn_name.slice(idx+1);
if (this[name_0] && this[name_0][name_1]) this[name_0][name_1](e); // NO EMULATION of 'this' value. should consolidate to func.call(this,e).
}
}
}
}
}
}
}
// var pn = e.target.parentNode; // 'Filter' doesn't have stopper.
// while (pn && pn!==site.script_body) {
// if (pn.getAttribute('name')==='SUB') this['SUB'].call(pn,{currentTarget:pn});
// pn = pn.parentNode;
// }
},
add_onchange_format: function(func_obj){
var keys = Object.keys(func_obj);
for (var i=0;i0? str.slice(0,idx) : 'DEFAULT';
//// var fields = str.substring(idx).replace(/@/g,';@').replace(/!/g,';').split(';').filter(function(v){return v;}); // better than match(/(^.|[@;])[^@;]*)/g);
// if (!name) name = 'DEFAULT';
}
function func_org_1(name, str, tgt){
var fields = str.replace(/@/g,';@').split(';'); // better than match(/(^.|[@;])[^@;]*)/g);
var obj = tgt[name] || (tgt[name] = {});
for (var i=0;i0 && idx!==idxl && idxl!=name.length-1) { // domain/board/thread
var db = name.slice(0,idxl+1);
if (!tgt[db]) tgt[db] = {};
tgt[db][name.slice(idxl+1)] = null;
}
}
function func_for_val(field, tgt){
field = field.replace(/\s*/g,'');
var idx = field.indexOf(':');
var name = (idx>=1)? field.substr(0,idx) : 'DEFAULT';
tgt[name] = field.substr(idx+1);
}
var obj2proto = {
_revise: function(name, str_add, str_removed, force){
if (!pref.test_mode['190']) this._reviseObj(name, str_add, force);
return fmt4str2_2(str_removed, (str_add || force) && (name+str_add));
},
_reviseObj: function(name, str, force){
// if (str) str = str.replace(/\s*\/\/.*/mg,'').replace(/\n/g,',').replace(/\s*$/,'').split(/\s*,\s*/)[0]; // for safety
var rm = !str && !force;
var exist = (name in this);
if (exist) {
if (rm) obj3_rm(this[':REV'], name);
delete this[name]; // force remake for not accumulating
}
if (rm) return;
func_org_1(name, str, this);
if (!exist) func_rev_1(name,this[':REV']);
},
};
var obj2proto_merge = {
_revise: function(dst, src, no_insert, str, old){ // dst and src must be fullname
var darr = this[dst];
var sarr = this[src];
//if (!pref.test_mode['192']) { // working code
//// if (!old) old = {__proto__:this}; // emulation of _old, WILL BE REMOVED
//// if (darr) {
//// var dold = darr.slice();
//// for (var i=0;i1) {
arr.splice(arr.indexOf(name),1);
if (arr.length===1) if (obj3_rm(obj3,arr[0],obj2)) // checking if fullname, and obj3_db can't be used since arr[0] may be in other boards.
str = add_to_list_2(null, arr[0], str);
}
return str;
}
function rm_merge(name,obj3_db,no,str){
delete this[name];
delete obj3_db[no];
var key = name.replace(/\+/,'\\+')+'([\\^@;:][^,\n]*)*'; // see 'triage_exe'
return str.replace(new RegExp('(^|,)'+key+'([,\n]+\\s*\\+*|$|\\+)','mg'),'$1').replace(new RegExp('\\+\\s*'+key+'(,|\n|$|\\s*\\+)','mg'),'$2');
}
var obj2proto_merge_lv = {
_revise: function(name, lv){ // name must be fullname
var str = this._str;
var changed = {};
if (typeof(name)==='string') str = this._reviseObj(name, lv, str, changed);
else for (var i=0;i0 && idx!==idxl && idxl!=name.length-1) { // domain/board/thread
var db = name.slice(0,idxl+1);
if (obj3[db]) delete obj3[db][name.slice(idxl+1)];
else console.log('Error: an inconsistency was found in str2obj2.obj3_rm: '+name);
if (obj2) delete obj2[name];
return true;
}
}
function add_to_list_2(tgt, name, str, no_insert){
var dst = tgt && existIn(str,tgt);
var src = existIn(str,name);
if (src && (!tgt || dst || no_insert)) {
str = src[1]==='+'? str.slice(0,src.index) +str.slice(src.index+src[0].length) // eliminates '+' preferentially
: str.slice(0,src.index+src[1].length)+str.slice(src.index+src[0].length+src[3].length); // remove
var len_erased = src[0].length + (src[1]==='+'? 0 : -src[1].length+src[3].length);
}
if (tgt) { // if (dst || tgt===null) {
if (dst) { // if (tgt!==null) {
var idx = (src && dst.index>src.index? dst.index - len_erased : dst.index) + dst[0].length;
str = str.slice(0,idx)+'+'+name+str.slice(idx); // add
} else if (src && !no_insert) str = str.slice(0,src.index+src[1].length)+tgt+'+'+str.slice(src.index+src[1].length); // insert
else var str_add = tgt+'+'+name; // add to last
}
return fmt4str2_2(str, str_add);
}
function existIn(str, key_in){
var key = key_in.replace(/\+/,'\\+');
return new RegExp('(^|,|\\+)\\s*'+key+'(\s*)(?=(,|\n|$|\\+))','mg').exec(str);
// return new RegExp('(^|,|\\+)\\s*'+key+'([^,\n+]*)(?=(,|\n|$|\\+))','mg').exec(str); // (?<=) requires chrome 62 // BUG, key isn't terminated
}
function fmt4str2_2(str, str_add){
str = str_add? (str + (str.length===0 || str[str.length-1]==='\n'? '':'\n')+str_add+'\n') : str; // add to last, '\n' for faster execution(no replacement)
if (pref.debug_mode['40'] && pref_func.fmt4str2(str)!==str) {
console.log('ERROR: fmt4str2_2');
console.trace();
}
return str;
}
pref_func.add_to_list_2 = add_to_list_2;
pref_func.fmt4str2_2 = fmt4str2_2;
return function(str, src, obj2_only, func){
var tgt = src==='merge'? {__proto__:obj2proto_merge} : src==='merge_lv'? {__proto__:obj2proto_merge_lv} : src || {__proto__:obj2proto};
var fields = str.replace(/\s*\/\/.*/mg,'').replace(/\n/g,',').replace(/\s*$/,'').split(/\s*,\s*/);
var f2 = (func==='val')? func_for_val : func || func_org;
for (var i=0;i=0;i--) {
// if (fields[i]) {
// var coms = fields[i].replace(/\s/g,'').split(':');
// fields[i] = '"'+coms[0]+'":"'+coms[1]+'"';
// } else fields.splice(i,1);
// }
// return JSON.parse('{' + fields.join(',') + '}');
// },
str2obj5: function(parent,key,str_in, flag_g){
parent[key] = {};
var tgt = parent[key];
var fields = str_in.replace(/\s*\/\/.*/mg,'').replace(/\n/g,',').split(',');
for (var i=0;iidx+2);
var str = (rx)? fd.slice(idx+2,idx2) : fd.slice(idx+1);
var flags = (flag_g? 'g':'') + (rx? fd.slice(idx2+1).replace(/g/,'') : '');
if (tgt[name]===undefined) tgt[name] = [];
try {
tgt[name][tgt[name].length] = new RegExp((rx)? str : this.str2rstr(str, flag_g), flags);
} catch(e) {
console.log('ERROR at str2obj5 in string of: '+fields[i]);
}
// tgt[name][tgt[name].length] = (fields[i][idx+1]==='/')? new RegExp(fields[i].substr(idx+2,fields[i].lastIndexOf('/')-idx-2),fields[i].substr(fields[i].lastIndexOf('/')+1)) :
// (key==='ex_list_obj5')? new RegExp(fields[i].substr(idx+1).replace(/\*/g,'.*')) :
// new RegExp(fields[i].substr(idx+1).replace(/\*/g,'\\S*(\\s|$)'),'g');
// tgt[name][tgt[name].length] = new RegExp('#'+(fields[i][idx]==='/')? fields[i].substr(idx+1) :
// fields[i].substr(idx+1).replace(/\*/,'.*'));
}
},
str2rstr: function(str,flag_g){
return str.replace(/[\.\(\)\[\]\+\^\$\{\}]/g,'\\$&').replace(/\*/g,flag_g?'\\S*(\\s|\\n|$)':'.*').replace(/\?/g,'.');
},
// str2obj8: (function(){ // not tested
// var idx;
// var proto = {re:false, ci:false, match:0, sentence:false, op:true, post:false,
// sub:true, name:true, trip:false, com:true, file:false, meta:false, flag:false, id:false, rexps:null};
// return {
// str2obj: function(parent,key,str_pref){
// parent[key] = {};
// tgt = parent[key];
// var fields = str_pref.replace(/\s*\/\/.*/mg,'').replace(/\n/g,',').split(',');
// var flag_g = key==='rm_list_obj5';
// var json = key==='auto_list_obj5';
// for (var i=0;iidx+2);
// var str = (rx)? fd.slice(idx+2,idx2) : fd.slice(idx+1);
// var flags = (flag_g? 'g':'') + (rx? fd.slice(idx2+1).replace(/g/g,'') : '');
// return new RegExp((rx)? str : this.str2rstr(str, flag_g), flags);
// }
// function func_json(fd){
// var idx2 = fd.indexOf('{');
// if (idx2 {' can use 'this' instead of 'pref_func'.
// if (!pref_func.obj_elim_the_same(pref_test[v], proto, true)) delete pref_test[v];});
//}
//// delete pref_test.page.footer;
//// delete pref_test.thread.footer;
//// delete pref_test.float.footer;
if (pref.test_mode['201'] && Debug) Debug.diff.verify(pref_func.pref_overwrite(pref_default(),pref_diff), pref, '');
if (pref.test_mode['198'] && Debug) Debug.diff.run_test();
return pref_diff;
},
site2_json_ex: function(full, filter){
var pref_test = this.site2_json_ex_remove();
if (!filter) if (pref_test.filter) delete pref_test.filter;
if (!full) if (pref_test.catalog_board_list_str) delete pref_test.catalog_board_list_str;
// if (pref_test.cli) delete pref_test.cli.json_str;
return '{"pref":' + (!filter? JSON.stringify(pref_test) : '{"filter":'+JSON.stringify(pref_test.filter)+'}') + '}';
// if (!filter) pref.cli.json_str = '{"pref":' + JSON.stringify(pref_test) + '}';
// else pref.cli.json_str = '{"pref":{"filter":' + JSON.stringify(pref_test.filter) + '}}';
},
pref_query: function pref_query(ref,src){
var str = '';
for (var i in src) {
if (ref[i]!==undefined) {
str += '"' + i + '":' +
((typeof(src[i])==='object' && !Array.isArray(src[i]))? pref_query(ref[i],src[i]) :
JSON.stringify(ref[i]))
+ ',';
}
}
return '{' + str.slice(0,-1) + '}';
},
site2_eval: function(){
// try {
// if (pref.cli.eval_str!=='') eval(pref.cli.eval_str);
// } catch (e) {
// console.log('ERROR in overwtite strings:');
// console.log(pref.cli.eval_str);
// console.log(e);
// }
},
// get tooltips(){return Tooltips;}, // code was moved.
pref_samples: (site0.isStep)? null : {
simple: {
catalog_triage_str: 'KILL,X,',
catalog : {style_general_list_str:'%border:4px solid #d6daf0\n%margin:4px',
// format : {show:{posts:true}}
},
},
backwash: {
catalog_triage_str :
'NONE,O,width:;height:,NONE,O,border:4px solid #ff0000;width:100px;height:100px,NONE,O,border:4px solid #00ff00;width:100px;height:100px,'+
'NONE,O,border:4px solid #0000ff;width:100px;height:100px,NONE,O,border:4px solid #ffff00;width:100px;height:100px,'+
'NONE,O,border:4px solid #ff00ff;width:100px;height:100px,NONE,O,border:4px solid #00ffff;width:100px;height:100px',
// catalog_expand_at_initial : true,
page:{click:'expand'},
// catalog:{format: {show: {style: true, contents: true, layout: true, posts: true, fileinfo: true, images_2nd: true}}},
},
recommend: {
max_threads_at_refresh : 500,
catalog: {
auto_load_filter: true,
auto_save_filter: true,
auto_save_filter_at_refresh: true,
order: {
sticky:'first',
// find_sage_in_8chan: true
},
board: {board_tags_same: true},
auto_update : true,
auto_update_period : 1,
},
page:{auto_update:true, auto_update_period:1},
float:{auto_update:true, auto_update_period:1},
},
get easy2(){return pref.easy2;},
'easy2.presets': (function(){
var presets = [
{liveTag: {use:false}, virtualBoard:{scan:false}, LTfrom:0, VB:{local:0, global:0}, network:{fetch_actively:false}},
{liveTag: {use:false}, virtualBoard:{scan:true }, LTfrom:0, VB:{local:1, global:0}, network:{fetch_actively:false}},
{liveTag: {use:false}, virtualBoard:{scan:true }, LTfrom:0, VB:{local:1, global:1}, network:{fetch_actively:false}},
{liveTag: {use:true }, virtualBoard:{scan:true }, LTfrom:0, VB:{local:2, global:0}, network:{fetch_actively:true }},
{liveTag: {use:true }, virtualBoard:{scan:true }, LTfrom:0, VB:{local:2, global:1}, network:{fetch_actively:true }},
{liveTag: {use:true }, virtualBoard:{scan:true }, LTfrom:0, VB:{local:2, global:2}, network:{fetch_actively:true }},
{liveTag: {use:true }, virtualBoard:{scan:true }, LTfrom:1, VB:{local:2, global:0}, network:{fetch_actively:true }},
{liveTag: {use:true }, virtualBoard:{scan:true }, LTfrom:1, VB:{local:2, global:1}, network:{fetch_actively:true }},
{liveTag: {use:true }, virtualBoard:{scan:true }, LTfrom:1, VB:{local:2, global:2}, network:{fetch_actively:true }},
];
var vb_kwd = ['none','board','thread'];
var basics = {
catalog:{auto_load_filter:true, auto_save_filter:true, auto_save_filter_at_refresh:true},
};
return function(idx){
var easy2 = pref.easy2;
if (idx!==undefined) pref_func.pref_overwrite(easy2, presets[idx]);
easy2.virtualBoard.scan_domains = {};
for (var i in pref.virtualBoard.scan_domains) easy2.virtualBoard.scan_domains[i] = vb_kwd[((i===site.nickname)? easy2.VB.local : easy2.VB.global)];
easy2.liveTag.from = (easy2.LTfrom===0)? 'op' : 'post';
var auto_update = {auto_update:pref.easy2.auto_update, auto_update_period:pref.easy2.auto_update_period};
if (easy2.catalog.embed) pref_func.pref_overwrite(easy2,{catalog:auto_update});
if (easy2.catalog.embed_page) pref_func.pref_overwrite(easy2,{page: auto_update});
if (easy2.thread.embed) pref_func.pref_overwrite(easy2,{thread: auto_update});
if (easy2.filter.time.use) easy2.filter.time.time_str = new Date(Date.now()-easy2.filter.time.tv*3600000).toLocaleString();
// if (easy2.filter.time_watch || easy2.filter.time_watch_creation)
// easy2.filter.time_str = new Date(Date.now()-((easy2.filter.time_watch)?easy2.time_post:easy2.time_op)*3600000).toLocaleString();
if (pref.easy2.basics) pref_func.pref_overwrite(easy2, basics);
return easy2;
};
})(),
'easy2.limits': (function(){
var limits = [
{virtualBoard:{bl:{max:100}}, scan:{max: 100, max_threads: 1000}, catalog:{max_threads_at_refresh: 500}}, // general
{virtualBoard:{bl:{max: 50}}, scan:{max: 100, max_threads: 1500}, catalog:{max_threads_at_refresh: 1500}}, // lain, meguca
{virtualBoard:{bl:{max:150}}, scan:{max: 100, max_threads: 15000}, catalog:{max_threads_at_refresh:15000}}, // 4chan
{virtualBoard:{bl:{max:100}}, scan:{max: 50, max_threads: 15000}, catalog:{max_threads_at_refresh:15000}}, // 8chan, top 50
{virtualBoard:{bl:{max:150}}, scan:{max: 100, max_threads: 30000}, catalog:{max_threads_at_refresh:15000}}, // 8chan, top 100
{virtualBoard:{bl:{max:200}}, scan:{max: 500, max_threads:100000}, catalog:{max_threads_at_refresh:15000}}, // 8chan, top 500
{virtualBoard:{bl:{max:200}}, scan:{max:10000, max_threads:100000}, catalog:{max_threads_at_refresh:15000}}, // 8chan, all
{virtualBoard:{bl:{max:150}}, scan:{max: 100, max_threads: 15000}, catalog:{max_threads_at_refresh:15000}}, // KC
];
return function(){
pref_func.pref_overwrite(pref.easy2, limits[pref.easy2.limits]);
}
})(),
'easy.virtualBoard_10_passive': {
virtualBoard: {bl:{show: true, max:20}, scan: true},
catalog: {auto_load_filter:true, auto_save_filter:true, auto_save_filter_at_refresh:true, auto_update:true, auto_update_period:10},
page:{auto_update:true, auto_update_period:10},
float:{auto_update:true, auto_update_period:10},
func: function(){for (var i in pref.virtualBoard.scan_domains) pref.virtualBoard.scan_domains[i] = (i===site.nickname)? 'board' : 'none';},
},
'easy.virtualBoard_10': {
virtualBoard: {bl:{show: true, max:20}, scan: true},
catalog: {auto_load_filter:true, auto_save_filter:true, auto_save_filter_at_refresh:true, auto_update:true, auto_update_period:10},
page:{auto_update:true, auto_update_period:10},
float:{auto_update:true, auto_update_period:10},
func: function(){for (var i in pref.virtualBoard.scan_domains) pref.virtualBoard.scan_domains[i] = (i===site.nickname)? 'thread' : 'none';},
},
'easy.virtualBoard_1': {
virtualBoard: {bl:{show: true, max:100}, scan: true, scanDelay: 20},
catalog: {auto_load_filter:true, auto_save_filter:true, auto_save_filter_at_refresh:true, auto_update:true, auto_update_period:1},
page:{auto_update:true, auto_update_period:1},
float:{auto_update:true, auto_update_period:1},
func: function(){for (var i in pref.virtualBoard.scan_domains) pref.virtualBoard.scan_domains[i] = (i===site.nickname)? 'thread' : 'none';},
},
'easy.virtualBoard_8_50': {
virtualBoard: {bl:{show: true, max:100}, scan: true, scanDelay: 20},
// scan:{max:50},
catalog: {auto_load_filter:true, auto_save_filter:true, auto_save_filter_at_refresh:true, auto_update:true, auto_update_period:5},
page:{auto_update:true, auto_update_period:5},
float:{auto_update:true, auto_update_period:5},
func: function(){
pref.scan.max = pref.easy.max_boards;
for (var i in pref.virtualBoard.scan_domains) pref.virtualBoard.scan_domains[i] = (i===site.nickname)? 'thread' : 'none';
},
},
//// 'easy.virtualBoard_8_100': {
//// catalog_auto_update : true,
//// catalog_auto_update_period : 5,
//// virtualBoard: {bl:{show: true, max:100}, scan: true, scanDelay: 20},
//// scan:{max:100},
//// catalog: {auto_load_filter:true, auto_save_filter:true, auto_save_filter_at_refresh:true},
//// func: function(){for (var i in pref.virtualBoard.scan_domains) pref.virtualBoard.scan_domains[i] = (i===site.nickname)? 'thread' : 'none';},
//// },
//// 'easy.virtualBoard_8_500': {
//// catalog_auto_update : true,
//// catalog_auto_update_period : 5,
//// virtualBoard: {bl:{show: true, max:100}, scan: true, scanDelay: 20},
//// scan:{max:500},
//// catalog: {auto_load_filter:true, auto_save_filter:true, auto_save_filter_at_refresh:true},
//// func: function(){for (var i in pref.virtualBoard.scan_domains) pref.virtualBoard.scan_domains[i] = (i===site.nickname)? 'thread' : 'none';},
//// },
'easy.virtualBoard_8_all': {
virtualBoard: {bl:{show: true, max:100}, scan: true, scanDelay: 20},
scan:{max:10000},
catalog: {auto_load_filter:true, auto_save_filter:true, auto_save_filter_at_refresh:true, auto_update:true, auto_update_period:5},
page:{auto_update:true, auto_update_period:5},
float:{auto_update:true, auto_update_period:5},
func: function(){for (var i in pref.virtualBoard.scan_domains) pref.virtualBoard.scan_domains[i] = (i===site.nickname)? 'thread' : 'none';},
},
'easy.virtualBoard_interSite': {
virtualBoard: {bl:{show: true, max:100}, scan: true, scanDelay: 20},
catalog: {auto_load_filter:true, auto_save_filter:true, auto_save_filter_at_refresh:true, auto_update:true, auto_update_period:10},
page:{auto_update:true, auto_update_period:10},
float:{auto_update:true, auto_update_period:10},
func: function(){for (var i in pref.virtualBoard.scan_domains) pref.virtualBoard.scan_domains[i] = (i===site.nickname)? 'thread' : 'board';},
// func: function(){for (var i in pref.virtualBoard.scan_domains) if (i!==site.nickname && pref.virtualBoard.scan_domains[i]==='none') pref.virtualBoard.scan_domains[i] = 'board';},
},
'easy.posts_0h': {
filter:{time:{use:true, func:'np', quick_sel:1}},
},
'easy.posts_24h': {
filter:{time:{use:true, func:'pp', get time_str(){return new Date(Date.now()-pref.easy.posts_ago*3600000).toLocaleString();}}}
},
'easy.threads_24h': {
filter:{time:{use:true, func:'cc', get time_str(){return new Date(Date.now()-pref.easy.threads_ago*3600000).toLocaleString();}}}
},
//// 'easy.posts_48h': {
//// filter:{time_str:null, time_watch:true},
//// func: function(){pref_func.pref_samples['easy.posts_48h'].filter.time_str = new Date(Date.now()-48*3600000).toLocaleString();}
//// },
'easy.embed_index': {
catalog:{embed_page:true, auto_load_filter:true, auto_save_filter:true, auto_save_filter_at_refresh:true},
},
'easy.embed_index_lazy': {
auto_watch:{watch:false},
catalog:{embed_page:true, auto_load_filter:true, auto_save_filter:true, auto_save_filter_at_refresh:true},
liveTag:{use:false},
notify:{desktop:{notify:false}},
network:{fetch_actively:false},
// page:{scan_tag:false},
},
'easy.light': {
catalog:{embed_page:true, auto_load_filter:true, auto_save_filter:true, auto_save_filter_at_refresh:true},
filter:{time:{use:false}},
liveTag:{use:false},
stats:{use:false},
network:{fetch_actively:false},
// page:{scan_tag:false},
},
'easy.embed_index_infinite': {
catalog_max_page_auto:true,
catalog:{embed_page:true, auto_load_filter:true, auto_save_filter:true, auto_save_filter_at_refresh:true},
},
'easy.embed_index_backwash': {
catalog_max_page_auto:true,
catalog:{embed_page:true, auto_load_filter:true, auto_save_filter:true, auto_save_filter_at_refresh:true, auto_update:true, auto_update_period:0},
page:{auto_update:true, auto_update_period:0},
float:{auto_update:true, auto_update_period:0},
},
'easy.stat_activate': {
stats:{use:true},
virtualBoard:{scan:true, scan_domains:{}},
liveTag:{use:true, from:'post'},
func: function(){this.virtualBoard.scan_domains[site.nickname] = 'board';},
},
pn_samples : null,
init : function(){
if (pref_func.pref_samples.pn_samples) return;
var html = pref_func.format_html_str('General samples:
'+
'
'+
'
'+
'
'+
'Triages:
'+
'
'+
'
'+
'
'+
'
'+
'
'+
'
'+
'
'+
'
');
var onchange_funcs = { // patch
simple: this.onclick_event,
backwash: this.onclick_event,
recommend: this.onclick_event,
__proto__:pref_func.settings.onchange_funcs
};
cnst.make_popup(pref_func.pref_samples,'pn_samples',html,onchange_funcs);
// pref_func.pref_samples.pn_samples = cnst.init('left:0px:tile:get:bottom:Show:tb',cnst.void_func,cnst.void_func,pref_func.pref_samples.destroy,cnst.void_func)[0];
// var pn_smpl = pref_func.pref_samples.pn_samples;
// pn_smpl.childNodes[1].innerHTML = '';
// var buttons = pn_smpl.childNodes[1].getElementsByTagName('BUTTON');
// for (var i=0;i=0;i--) if (names.indexOf(pns[i].name)==-1) pns.splice(i,1);
if (pns.length>0) pref_func.apply_prep(pns, false, true, null, true); // refresh appearance, make object, trigger event.
// for (var i=0;iwindow.innerWidth)? 'right':'left') + ':0px:' + ((e.clientY*2>window.innerHeight)? 'bottom:0':'top:'+site.header_height())+'px';
var pn13 = cnst.init(pos+':Show:tb',cnst.void_func,cnst.void_func,pref_func.settings.show_hide,cnst.void_func);
var pn13_0_2 = cnst.add_to_tb(pn13,
'');
if (pref.settings.indexing >= pref_func.settings.options.length) pref.settings.indexing = 0;
pn13_0_2.getElementsByTagName('select')['settings.indexing'].selectedIndex = pref.settings.indexing;
pref_func.settings.pn13 = pn13; // for onchange func.
// pref_func.mirror_targets.pn13_1 = pn13.childNodes[1]; // for mirror.
pref_func.settings.onchange_funcs['settings.*']();
pref_func.add_onchange(pn13_0_2,pref_func.settings.onchange_funcs_formatted);
Tooltips.add_root(pref_func.settings.pn13);
cnst.bottom_top(pn13);
} else {
Tooltips.remove_root(pref_func.settings.pn13);
// pref_func.settings.files_store();
//// pref_func.mirror_targets.pn13_1 = null;
pref_func.settings.pn13 = cnst.div_destroy(pref_func.settings.pn13, true); // returns null
// pref.dashboard.rss = null;
}
},
apply_pn13_1: function(set,propagate){
pref_func.apply_prep(pref_func.settings.pn13_1,set,propagate);
pref_func.settings.onchange_funcs['pn13_1_warning']();
},
// files_store: function(){
//// var files_archive = pref_func.mirror_targets.pn13_1.querySelectorAll('span[name="FILES_ARCHIVE0"]')[0]; // out of w3c, but works in chrome and FF.
//// if (files_archive) site.script_body.firstChild.appendChild(files_archive); // called also at initial. // firstChild is 'display:none'.
////// if (files_archive) site.script_body.appendChild(files_archive); // called also at initial.
// var files = pref_func.settings.pn13.querySelectorAll('input[type=file]');
// if (files.length>0) pref_func.apply_prep_2_all(files,true);
// },
samples: {
catalog: {
get style_general_list_str(){return Tooltips.str['catalog.style_general_list_str']().replace(/^/mg,'// ')+
'\n\n;background:#e5ecf9 // example for all threads\n'+
';border:1px solid black\n'+
'8chan;background:#eef2ff;border:1px solid #d6daf0\n'+
'8chan;background:#eef2ff\n'+
'KC;background:#e0e0fc;border:1px solid #aaaacc\n'+
'4chan;background:#ffffee;border:1px solid #f0e0d6\n'+
'/a/;background:#eef2ff // color /a/ blue\n\n';},
board:{ get ex_list_str(){return '// Identifier [, Identifier ...]\n//\n' + pref.samples.GeneralRules;}}
},
postFilter:{get str(){return '// [Identifier:]JSONC for post filter\n'+
'// comments are started wich // or enclosed by /*...*/\n'+
'// You can edit this directly,\n'+
'// but I recommend you to copy-paste from local postFilter whose JSONs are generated by GUI.\n'+
'// You can add identifier to each head of JSONC. If no indentifier, it will be applied to all.\n\n'+
'{"str":"cute","style":"border-left:10px solid pink"}\n\n'+Tooltips.str.Identifier.replace(/^[^\n]/mg,'// $&')+
'// JSONC: is JSON but allows C-type comments in it.';}},
style:{userCSS:{str:'/* userCSS will be a