var pickup_regexp = readCookie('pickup_regexp') || ''; var pickup_tab_list = new Array(); // ã¿ãä¸è¦§ // çºè¨(JSON)ãæå®æ¡ä»¶ã«ããããããå¤å® function execRegexp(tw, exp) { return (!exp.id || tw.user.screen_name.match(exp.id )) && (!exp.id_n ||!tw.user.screen_name.match(exp.id_n)) && (!exp.text || tw.text.match(exp.text )) && (!exp.text_n ||!tw.text.match(exp.text_n)) && (!exp.source || tw.source.match(exp.source )) && (!exp.source_n ||!tw.source.match(exp.source_n)) } // ã¿ãåãæ¿ãå¦ç function switchRegexp(tab) { var pickup = new Array(); switchTo(tab.id); $('tw2h').innerHTML = '
'; // ã¡ã¤ã³TLãã該å½ããçºè¨ãæ½åº var tl = $('tw').childNodes; for (var i = 0; i < tl.length; i++) { var tl2 = tl[i].childNodes; for (var j = 0; j < tl2.length; j++) { var target = tl2[j]; for (var k = 0; k < tab.pickup.length; k++) { if (target.tw && execRegexp(target.tw, tab.pickup[k])) { pickup.push(target.tw); break; } } } } twShow2(pickup); } // æ½åºã¿ãå¤æ´ function setRegexp(str) { pickup_regexp = str; writeCookie('pickup_regexp', pickup_regexp, 3652); // æ½åºã¿ããé¤å» for (var i = 0; i < pickup_tab_list.length; i++) pickup_tab_list[i].parentNode.removeChild(pickup_tab_list[i]); pickup_tab_list = new Array; // æ½åºã¿ãååæå initRegexp(); } // ã¿ããåé¤ function closeRegexp(tab) { if (!confirm("ã¿ããéãã¦ãããããã§ãã?")) return; var list = pickup_regexp.split(/[\r\n]/); var list2 = []; for (var id = 0; id < list.length; id++) if (list[id].split(':')[0] != tab) list2.push(list[id]); setRegexp(list2.join("\n")); switchTL(); } // æ½åºã¿ãåæå function initRegexp() { var list = pickup_regexp.split(/[\r\n]/); // æ½åºã¿ããçæ for (var id = 0; id < list.length; id++) { var entry = list[id].split(':'); var tabname = entry[0]; var regexp = entry[1] ? entry[1].split("/") : []; var regexp2 = entry[2] ? entry[2].split("/") : []; var regexp3 = entry[3] ? entry[3].split("/") : []; var filter = entry[4]; if (!tabname) continue; var ptab = $('pickup-'+tabname); if (!ptab) { ptab = document.createElement('a'); ptab.pickup = new Array(); ptab.id = 'pickup-' + tabname; ptab.innerHTML = ptab.name = tabname; ptab.href = '#'; ptab.onclick = function() { switchRegexp(this); return false; }; $('menu2').insertBefore(ptab, $('misc')); pickup_tab_list.push(ptab); } var exps = new Object; try { if (regexp[0]) exps.id = new RegExp(regexp[0]); if (regexp[1]) exps.id_n = new RegExp(regexp[1]); if (regexp2[0]) exps.text = new RegExp(regexp2[0]); if (regexp2[1]) exps.text_n = new RegExp(regexp2[1]); if (regexp3[0]) exps.source = new RegExp(regexp3[0]); if (regexp3[1]) exps.source_n = new RegExp(regexp3[1]); } catch (e) { alert("RegExp Error in " + tabname + " tab :\nline "+(id+1)+" - " + e); } if (filter) exps.filterTL = true; ptab.pickup.push(exps); } } initRegexp(); registerPlugin({ miscTab: function(ele) { var e = document.createElement("p"); e.innerHTML = 'Pickup Pattern (TabName:ID:Status:TLFilter) :