Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name feedly - Remove utm from Links
- // @description リンクに追加されているトラッキングコードutm_source=feedlyを削除します
- // @version 0.1
- // @include http://www.feedly.com/*
- // @include https://www.feedly.com/*
- // ==/UserScript==
- function removeutm(){
- var as = document.evaluate('descendant-or-self::a', document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
- for (var i = 0, l = as.snapshotLength;i < l;++i){
- var a = as.snapshotItem(i);
- if (a.href.indexOf('http') === 0 && a.host !== location.host && /utm_/i.test(a.href)){
- var newhref = a.href.replace(/([\?\&]utm_source=feedly)/ig, '');
- a.setAttribute('href', newhref);
- }
- }
- }
- var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
- var observer = new MutationObserver(function(mutations) {
- removeutm();
- });
- observer.observe(document, { childList: true , subtree: true});
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement