/(^[^:\/#\?]*:\/\/([^#\?\/]*\.)?www\.google\.co(\.jp|m)(:[0-9]{1,5})?\/maps/.*$)/
最近googleのサービスがサブドメインからドメインはいかに移動する事が多い。それゆえAutopagerize等はexclude しなくてはならないのだが。
メニューから除外するとドメインをごっそり exclude 。それでは困るので色々考えてみた結果。
com と co.jp にも対応。
PC相談員。ニュースサイトより造船や橋梁関係からのコメントを出していきます。たまにPCネタを
/(^[^:\/#\?]*:\/\/([^#\?\/]*\.)?www\.google\.co(\.jp|m)(:[0-9]{1,5})?\/maps/.*$)/
最近googleのサービスがサブドメインからドメインはいかに移動する事が多い。それゆえAutopagerize等はexclude しなくてはならないのだが。
メニューから除外するとドメインをごっそり exclude 。それでは困るので色々考えてみた結果。
com と co.jp にも対応。
AutoPagerizeと同時作業させたくてeventを調査した。
ソースコードから dispatchEvent をキーワードに検索すると
GM_AutoPagerizeLoaded
AutoPagerize_DOMNodeInserted
GM_AutoPagerizeNextPageLoaded
が見つかった。
// ==UserScript==
// @name TestEventFromAutopagerized
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://*/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
window.addEventListener("GM_AutoPagerizeLoaded",report,true);
window.addEventListener("AutoPagerize_DOMNodeInserted",report,true);
window.addEventListener("GM_AutoPagerizeNextPageLoaded",report,true);
function report(e){
console.log(e);
}
// Your code here...
})();
簡単にプログラムを作ってみてテストしたら発火してたのは
AutoPagerize_DOMNodeInserted
GM_AutoPagerizeNextPageLoaded
で
GM_AutoPagerizeLoaded
は発火していなかった。何故だろう。on Firefox 75
GM_AutoPagerizeNextPageLoaded
GM_AutoPagerizeNextPageLoaded { target: HTMLDocument https://www.xxxx.com/jp/category/, isTrusted: false, srcElement: HTMLDocument https://www.xxxx.com/jp/category/, currentTarget: Window, eventPhase: 1, bubbles: true, cancelable: false, returnValue: true, defaultPrevented: false, composed: false, … }
target.activeElement: <body> で最初も読み込んだページも全体を指している。
AutoPagerize_DOMNodeInserted
AutoPagerize_DOMNodeInserted { target: div#xxx, isTrusted: false, relatedNode: body, prevValue: "null", newValue: "https://www.xxxx.com/jp/category/?page=2", attrName: "null", attrChange: 0, MODIFICATION: 1, ADDITION: 2, REMOVAL: 3, … }
target: <div id="xxx"> と読み込んだ部分だけを指している違いがある
AutoPagerizeを使っていると出てくるエラーを研究
今回の調査では function log(e)は@561 や @798 の try{} catch{}構文で使用されていることが判明した
エラーではなく continue していた。
続きを読む “AuutoPagerizeの研究 TypeError: “a is undefined” evaluate eval line 1 > Function:50″