google-ads.js (1648B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 "use strict"; 6 7 /** 8 * Bug 1713726 - Shim Ads by Google 9 * 10 * Sites relying on window.adsbygoogle may encounter breakage if it is blocked. 11 * This shim provides a stub for that API to mitigate that breakage. 12 */ 13 14 if (window.adsbygoogle?.loaded === undefined) { 15 window.adsbygoogle = { 16 loaded: true, 17 push() {}, 18 }; 19 } 20 21 if (window.gapi?._pl === undefined) { 22 const stub = { 23 go() {}, 24 render: () => "", 25 }; 26 window.gapi = { 27 _pl: true, 28 additnow: stub, 29 autocomplete: stub, 30 backdrop: stub, 31 blogger: stub, 32 commentcount: stub, 33 comments: stub, 34 community: stub, 35 donation: stub, 36 family_creation: stub, 37 follow: stub, 38 hangout: stub, 39 health: stub, 40 interactivepost: stub, 41 load() {}, 42 logutil: { 43 enableDebugLogging() {}, 44 }, 45 page: stub, 46 partnersbadge: stub, 47 person: stub, 48 platform: { 49 go() {}, 50 }, 51 playemm: stub, 52 playreview: stub, 53 plus: stub, 54 plusone: stub, 55 post: stub, 56 profile: stub, 57 ratingbadge: stub, 58 recobar: stub, 59 savetoandroidpay: stub, 60 savetodrive: stub, 61 savetowallet: stub, 62 share: stub, 63 sharetoclassroom: stub, 64 shortlists: stub, 65 signin: stub, 66 signin2: stub, 67 surveyoptin: stub, 68 visibility: stub, 69 youtube: stub, 70 ytsubscribe: stub, 71 zoomableimage: stub, 72 }; 73 } 74 75 for (const e of document.querySelectorAll("ins.adsbygoogle")) { 76 e.style.maxWidth = "0px"; 77 }