Skip to content

Commit

Permalink
Tweak important youtube rule
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanbr committed Sep 3, 2023
1 parent fecb7d2 commit 5b0514a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion brave-unbreak.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ userlytics.com##+js(set, navigator.connection, {})
youtube.com##ytd-rich-item-renderer:has(ytd-display-ad-renderer)
! youtube.com (importantYT) to get around uBO exception
! https://github.com/uBlockOrigin/uAssets/blob/master/filters/filters.txt#L31
youtube.com,youtubekids.com,youtube-nocookie.com##+js(rpnt, script, /(\(function serverContract\(\)|writeEmbed|var _F_cssRowKey|importantYT)/, 'const pruner=text=>{let json=JSON.parse(text);for(k of["playerAds","adPlacements","adSlots"]){json[k]=[];}return JSON.stringify(json);};const urlFromArg=arg=>{if(typeof arg==="string"){return arg;}if(arg instanceof Request){return arg.url;}return String(arg);};const realFetch=window.fetch;window.fetch=new Proxy(window.fetch,{apply:function(target,thisArg,args){if(!(urlFromArg(args[0]).includes("player?key="))){return Reflect.apply(target,thisArg,args);}return realFetch(...args).then(realResponse=>realResponse.text().then(text=>new Response(pruner(text),{status:realResponse.status,statusText:realResponse.statusText,headers:realResponse.headers,})));}});window.XMLHttpRequest.prototype.open=new Proxy(window.XMLHttpRequest.prototype.open,{apply:async(target,thisArg,args)=>{if(!(urlFromArg(args[1]).includes("player?key="))){return Reflect.apply(target,thisArg,args);}thisArg.addEventListener("readystatechange",function(){if(thisArg.readyState!==4){return;}const type=thisArg.responseType;if(type!==""&&type!=="text"){return;}const textin=thisArg.responseText;const textout=pruner(textin);if(textout===textin){return;}Object.defineProperty(thisArg,"response",{value:textout});Object.defineProperty(thisArg,"responseText",{value:textout});});return Reflect.apply(target,thisArg,args);}}); $1')
youtube.com,youtubekids.com,youtube-nocookie.com##+js(rpnt, script, /(\(function serverContract\(\)|writeEmbed|var _F_cssRowKey)/, '/*important*/ const pruner=text=>{let json=JSON.parse(text);for(k of["playerAds","adPlacements","adSlots"]){json[k]=[];}return JSON.stringify(json);};const urlFromArg=arg=>{if(typeof arg==="string"){return arg;}if(arg instanceof Request){return arg.url;}return String(arg);};const realFetch=window.fetch;window.fetch=new Proxy(window.fetch,{apply:function(target,thisArg,args){if(!(urlFromArg(args[0]).includes("player?key="))){return Reflect.apply(target,thisArg,args);}return realFetch(...args).then(realResponse=>realResponse.text().then(text=>new Response(pruner(text),{status:realResponse.status,statusText:realResponse.statusText,headers:realResponse.headers,})));}});window.XMLHttpRequest.prototype.open=new Proxy(window.XMLHttpRequest.prototype.open,{apply:async(target,thisArg,args)=>{if(!(urlFromArg(args[1]).includes("player?key="))){return Reflect.apply(target,thisArg,args);}thisArg.addEventListener("readystatechange",function(){if(thisArg.readyState!==4){return;}const type=thisArg.responseType;if(type!==""&&type!=="text"){return;}const textin=thisArg.responseText;const textout=pruner(textin);if(textout===textin){return;}Object.defineProperty(thisArg,"response",{value:textout});Object.defineProperty(thisArg,"responseText",{value:textout});});return Reflect.apply(target,thisArg,args);}}); $1')
9gag.com##article:has(.promoted)
! Fix browser lockup on skepticalscience.com (https://github.com/brave/brave-browser/issues/5406)
||skepticalscience.net/widgets/heat_widget/js/heat_content.js$script,domain=skepticalscience.com
Expand Down

0 comments on commit 5b0514a

Please sign in to comment.