// ==UserScript== // @name Popup Blocker Script // @name:zh-CN 弹窗阻止程序脚本 // @namespace https://popupblockerscript.com/ // @version 0.6 // @description The most efficient user script for blocking popups of all types. Designed to fight the sneakiest popups including the ones on adult and streaming websites. // @description:zh-CN 用于阻止所有类型弹窗的最有效用户脚本。为防范最狡猾的弹窗而设计,包括成人和流媒体网站上的弹窗。 // @author Mike Kyshenko // @match https://*/* // @match http://*/* // @grant GM_listValues // @grant GM_deleteValue // @grant GM_setValue // @grant GM_getValue // @grant GM_getResourceURL // @grant GM_getResourceText // @grant GM_addStyle // @grant GM_xmlhttpRequest // @connect re.popupblockerscript.com // @connect self // @connect * // @require https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js // @downloadURL https://update.greasyfork.icu/scripts/418443/Popup%20Blocker%20Script.user.js // @updateURL https://update.greasyfork.icu/scripts/418443/Popup%20Blocker%20Script.meta.js // ==/UserScript== const LANG = { EN: { "notificationMessage": { "message": "Popup Blocked" }, "overlayWasBlocked": { "message": "Overlay Blocked" }, "allowOnce": { "message": "Show popup once" }, "allowAlways": { "message": "Whitelist this site" }, "NTF_allowOverlayOnce": { "message": "Allow overlay once" } }, "CN":{ "notificationMessage": { "message": "弹窗被阻止" }, "overlayWasBlocked": { "message": "叠加弹窗被阻止" }, "allowOnce": { "message": "显示一次弹窗" }, "allowAlways": { "message": "允许此网站上的弹窗" }, "NTF_allowOverlayOnce": { "message": "显示一次弹窗" } } }; !function(modules) { var installedModules = {}; function __webpack_require__(moduleId) { if (installedModules[moduleId]) return installedModules[moduleId].exports; var module = installedModules[moduleId] = { i: moduleId, l: !1, exports: {} }; return modules[moduleId].call(module.exports, module, module.exports, __webpack_require__), module.l = !0, module.exports; } __webpack_require__.m = modules, __webpack_require__.c = installedModules, __webpack_require__.d = function(exports, name, getter) { __webpack_require__.o(exports, name) || Object.defineProperty(exports, name, { enumerable: !0, get: getter }); }, __webpack_require__.r = function(exports) { "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(exports, "__esModule", { value: !0 }); }, __webpack_require__.t = function(value, mode) { if (1 & mode && (value = __webpack_require__(value)), 8 & mode) return value; if (4 & mode && "object" == typeof value && value && value.__esModule) return value; var ns = Object.create(null); if (__webpack_require__.r(ns), Object.defineProperty(ns, "default", { enumerable: !0, value: value }), 2 & mode && "string" != typeof value) for (var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); return ns; }, __webpack_require__.n = function(module) { var getter = module && module.__esModule ? function() { return module.default; } : function() { return module; }; return __webpack_require__.d(getter, "a", getter), getter; }, __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }, __webpack_require__.p = "", __webpack_require__(__webpack_require__.s = 1); }([ function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_exports__.a = { defaultWhiteList: [ "engage.wixapps.net", "linkedin.com", "google", "www.gmail.com", "www.pinterest.com", "www.youtube.com", "www.facebook.com", "search.yahoo.com", "chrome://newtab", "www.food.com" ], defaultBlackList: [ "adrunnr", "successforyu.clickfunnels.com", "fmovies.se", "in-365-tagen.info", "5000-settimanale.com", "shop.mazzugioielli.com", "maxigossip.com", "lp.yazizim.com", "beyourxfriend.com", "99tab.com", "zzqrt.com", "canuck-method.net", "bewomenly.com", "playnow.guru", "datingforyou-48e1.kxcdn.com", "trafficnetworkads24.com", "sistemadedinerogratis.com", "canuckmethodprofit.co", "consumerresearchnetwork.com", "securemacfix.com", "zz3d3.ru", "zd1.quebec-bin.com", "hot-games4you.xyz", "om.elvenar.com", "superpccleanup.com", "gomediaz.com", "judithi.xyz", "free.atozmanuals.com", "yoursuccess.ravpage.co.il", "123hop.ir", "quizcliente.pw", "aussiemethod.biz", "hlpnowp-c.com", "picbumper.com", "shaneless.com", "anacondamonster.com", "altrk1.com", "health.todaydiets.com", "download.weatherblink.com", "happyluketh.com", "go.ameinfo.com", "50kaweek.net", "thepornsurvey.com", "ofsiite.ru", "fulltab.com", "1000spins.com", "time2play-online.net", "vintacars.com", "welcome.pussysaga.com", "free-desktop-games.com", "download.televisionfanatic.com", "theprofitsmaker.net", "sgad.info", "algocashmaster.net", "sunmaker.com", "topvipdreams.com", "watchmygirlfriend.gfpornvideos.com", "filesharefanatic.com", "safedownloadhub.com", "7awlalalam.blogspot.com", "tvplusnewtab.com", "trendingpatrol.com", "moneymorning.com", "ifileyou.com", "classifiedcanada.ca", "firefan.com", "methode-binaire.com", "letmetell.com", "kenduktur.com", "getafuk.com", "yotraleplahnte.ru", "jackpot.88beto.com", "pwwysydh.com", "search.queryrouter.com", "v.lvztxy.com", "pussysaga.com", "saffamethod.com", "prezzonline.com", "searchprivacy.website", "3d2819216eb4e1035879-7c248de0c99745406e9b749fc86ec3e4.ssl.cf1.rackcdn.com", "only2date.com", "mysagagame.com", "themillionaireinpjs.net", "wlt.kd2244.com", "quickprivacycheck.com", "hotchatdate.com", "autotraderbot.com", "z1.zedo.com", "youlucky2014.com", "traffic.getmyads.com", "appcloudprotected.com", "safensecure.com-allsites3.xyz", "newpoptab.com", "static.williamhill.com", "myhealthyblog.co", "greatestmobideals.com", "sweetclarity.com", "mgid.com", "securepccure.com", "autopengebygger.com", "am15.net", "es.reimageplus.com", "o2.promos-info.com", "it.reimageplus.com", "westsluts.com", "spinandwin.com-ser.pw", "reimageplus.com", "vodafone.promos-info.com", "vinnmatpengar.se", "movie.ienjoyapps.com", "love4single.com", "origin.getprice.com.au", "ohmydating.com", "lp.want-to-win.com", "yabuletchrome.ru", "bamdad.net", "gotositenow.com", "vcrypt.pw", "newtabtv.com", "mon.setsu.xyz", "youforgottorenewyourhosting.com", "zone-telechargement.ws", "land.pckeeper.software", "ad.adpop-1.com", "advancedpctools.com", "videos.randolphcountyheraldtribune.com", "web-start.org", "softreadynow.installupgradenowfreshandforyou.website", "uplod.ws", "pornhubcasino.com", "maxbet.ro", "2016prizefeed.com", "thevideo.me", "wantubad.com", "tavanero.com", "xcusmy.club", "daclips.in", "gaymenofporn.online", "jackpotcitycasino.com", "italian-method.com", "getsearchincognito.com", "youjustwonprize.com", "finanz-nachrichten.me", "quizcliente.site", "da.reimageplus.com", "jkanime.net", "britmoneymethod.com", "uae.souq.com", "ka.azzer.net", "safensecure.xyz", "8t.hootingrhejkz.online", "www6.blinkx.com", "wizzcaster.com", "comparaison-prix.com", "vodlocker.lol", "fr.reimageplus.com", "free.fromdoctopdf.com", "userscloud.com", "myprivatesearch.com", "fanli90.cn", "tutticodicisconto.it", "mediadec.com", "gogamego.thewhizproducts.com", "download.weatherblink.com", "free.videodownloadconverter.com", "we-are-gamers.com", "sesso.communityadult.net", "lp.blpmovies.com", "search.queryrouter.com", "bbb-johannesburg.localspecific.com", "lp.blpmovies.com", "go.ppixelm.com", "r0.ru", "sesso.communityadult.net", "bbb-johannesburg.localspecific.com", "ppixelm.com", "cyberguardianspe.info", "we-are-gamers.com", "loginfaster.com/new", "www.alfacart.com", "www.foresee.com", "mobile-win.com", "www.plusnetwork.com", "www.amicafarmacia.com", "www.ienjoyapps.com", "cheapcheap.io", "screenaddict.thewhizproducts.com", "nova.rambler.ru", "free.gamingwonderland.com", "p9328ujeiw1.ru", "mobilecasinoclub.co.uk", "pfhsystem.com", "regtuneup.com", "theprofitsmaker.net", "bodogpromotions.eu", "heroesreplay.org", "financialsecrets.info", "mymoneymakingapp.com", "sunmaker.com", "888casino-promotions.com", "vogliosesso.com", "scienceremix.com", "allinonedocs.com", "arabia.starzplay.com", "allirishcasino.com", "advancepctools.info", "movie.ienjoyapps.com", "surveyform001.s3-website-us-east-1.amazonaws.com", "mgs188.com", "pfhsystem.com", "lpeva.com", "ddsh8.com", "theprofitsmaker.net", "b2.ijquery11.com", "sporthero.thewhizmarketing.com", "securefastmac.tech", "seen-on-screen.thewhizmarketing.com", "1000spins.com", "search.queryrouter.com", "pfhsystem.com", "reimageplus.com", "offer.alibaba.com", "searchlistings.org", "search.queryrouter.com", "search.queryrouter.com", "mybinaryoptionsrobot.com", "duplicashapp.com", "search.queryrouter.com", "bestgame.directory", "droidclub.net", ".rivalo.com", "yoursuperprize.com", "mediaexplained.com", "om.elvenar.com", "shinar.club", "revitoleczemacream.com", "freelotto.com", "screenaddict.thewhizproducts.com", "download.bringmesports.com/", "allinonedocs.com", "driver-fixer.com", "arabydeal.com", "cleanyourcomputertoday.com", "arabydeal.com", "music.mixplugin.com", "1se.info", "survey12.com", "freesoftwaredlul.com", "pldist01.com", "ad.adpop-1.com", "searchanonymous.net", "abrst.pro", "muzikfury.thewhizmarketing.com", "lp.mbtrx.com", "th1.forfun.maxisize-pro.com", "watchmygirlfriend.gfpornbox.com", "new.freelotto.com", "desktoptrack.com", "search.queryrouter.com", "offer.alibaba.com", "1000spins.com", "promotions.coral.co.uk", "search.queryrouter.com", "tbsia.com", "tbsia.com", "multtaepyo.com", "search.queryrouter.com", "czechmethod.com", "consumerview.co", "wayretail.com", "72onbase.com", "funsafetab.com", "search.queryrouter.com", "speedyfiledownload.com", "driver-fixer.com", "arabydeal.com", "cleanyourcomputertoday.com", "arabydeal.com", "music.mixplugin.com", "1se.info", "survey12.com", "freesoftwaredlul.com", "pldist01.com", "ad.adpop-1.com", "searchanonymous.net", "abrst.pro", "muzikfury.thewhizmarketing.com", "lp.mbtrx.com", "th1.forfun.maxisize-pro.com", "watchmygirlfriend.gfpornbox.com", "new.freelotto.com", "desktoptrack.com", "search.queryrouter.com", "offer.alibaba.com", "1000spins.com", "promotions.coral.co.uk", "search.queryrouter.com", "tbsia.com", "tbsia.com", "surveyform001.s3-website-us-east-1.amazonaws.com", "mgs188.com", "pfhsystem.com", "lpeva.com", "ddsh8.com", "theprofitsmaker.net", "quantomcoding.com", "sporthero.thewhizmarketing.com", "popads.net", "onclkds.com", "consumerview.co", "12kotov.ru", "ruhotpair2.fingta.com", "easytelevisionaccessnow.com", "ahwrd.com", "lpeva.com", "ppgzf.com", "zjstx.com", "kituure.xyz", "join.pro-gaming-world.com", "mackeeperapp.mackeeper.com", "tracknotify.com", "2075.cdn.beyondhosting.net", "idollash.com", "ds.moviegoat.com", "fulltab.com", "rackcdn.com", "prestoris.com", "adsterra.com", "swampssovuuhusp.top", "streesusa.info", "freesoftwaredlul.com", "adreactor.com", "a-static.com", "codeonclick.com", "heheme.com", "adf.ly", "seen-on-screen.thewhizmarketing.com", "openload.co" ] }; }, function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); var storage = { get: () => new Promise(resolve => { const items = [ ...arguments ]; if (1 == items.length) resolve(GM_getValue(items[0])); else { const data = {}; items.forEach(item => { data[item] = GM_getValue(item); }), resolve(data); } }), set(key, value) { GM_setValue(key, value); } }; class OverlayDectector { constructor() { this.winWidth = window.innerWidth, this.winHeight = window.innerHeight; } ALGO2({x: x, y: y, mw: mw, mh: mh}) { let overlay, element = document.elementFromPoint(x, y); if (element && this.notRootElement(element)) do { this.isOverlayish({ el: element, minWidth: mw, minHeight: mh }) && (overlay = element), element = element.parentNode; } while (!overlay && this.notRootElement(element)); return overlay; } notRootElement(element) { return element != document.body && element != document && element != document.documentElement; } detectOverlayLayer(detectRange) { for (let coords of detectRange) { let overlay = this.ALGO2(coords); if (overlay) return this.getRecipe(overlay); } return !1; } find() { const detect = { AnySize: [ { x: this.winWidth / 2, y: this.winHeight / 2, mw: 100, mh: 100 }, { x: this.winWidth / 2, y: this.winHeight / 3, mw: 100, mh: 100 } ], FullScreen: [ { x: this.winWidth / 2, y: this.winHeight / 2, mw: .9 * this.winHeight, mh: .9 * this.winHeight } ] }; let recipe, overlays = []; return (recipe = this.detectOverlayLayer(detect.AnySize)) && (overlays.push(this.hideByRecipe(recipe)), (recipe = this.detectOverlayLayer(detect.FullScreen)) && overlays.push(this.hideByRecipe(recipe))), overlays; } getRecipe(el) { let recipe = []; const isSingleInstanceInDocument = recipe => 1 == $(recipe.join(" > ")).length; do { let node = el.nodeName.toLowerCase(), id = el.getAttribute("id"), className = el.getAttribute("class"), style = el.getAttribute("style"); if (id) { recipe.unshift("#" + id.trim()); break; } if (className ? recipe.unshift(node + "." + className.trim().replace(/\s+/g, ".")) : recipe.unshift(node + '[style="' + style + '"]'), isSingleInstanceInDocument(recipe)) break; el = el.parentNode; } while (el != document.body); return !!isSingleInstanceInDocument(recipe) && recipe.join(" > "); } hideByRecipe(recipe) { let el = $(recipe), css = el.prop("style").cssText; return el.prop("style").cssText = `${css};display:none !important;`, { el: el, recipe: recipe, css: css }; } isOverlayish({el: el, minWidth: minWidth, minHeight: minHeight}) { let css = window.getComputedStyle(el); return !!("none" != css.display && "hidden" != css.visibility && /fixed|absolute/.test(css.position) && ("auto" == css.zIndex || parseInt(css.zIndex) >= 0) && el.offsetWidth >= minWidth && el.offsetHeight >= minHeight) && [ el, 1 * css.zIndex ]; } } var content_overlayKiller = class extends OverlayDectector { constructor(props = {}) { super(), this.activeBlockList = [], this.activeRecepiesList = [], this.onAutoDetect = props.onAutoDetect || (() => {}), this.onUserRemove = props.onUserRemove || (() => {}), this.onBlockListFound = props.onBlockListFound || (() => {}), this.onRecipeFound = props.onRecipeFound || (() => {}), this.onRecipeNotFound = props.onRecipeNotFound || (() => {}), this.blackListPromise = this.createBlockListFromStorage(), window == top && this.autoDetect(); } hide(recepies) { this.last = [], recepies.forEach(recipe => { this.last.push(this.hideByRecipe(recipe)); }); } restore() { this.last.forEach(item => { let {el: el, recipe: recipe, css: css} = item; el.prop("style").cssText = css + ";display: block", [ ...$("style.pp-remove-overlay") ].forEach(style => { (style = $(style)).data("recipe") == btoa(recipe) && $(style).remove(); }); }), window.dispatchEvent(new Event("resize")); } remove(props = {}) { let overlays = this.find(); overlays.length ? (this.last = overlays, this.createGlobalCSS(), this.onUserRemove({ success: !0, recepies: overlays.map(o => o.recipe), props: props })) : this.onUserRemove({ success: !1, props: props }); } addToLocalBlacklist() { const domain = document.domain, url = location.href; PBStorageSync.pb_overlayBlockedList.update((list = {}) => { let blocks = list[domain] || []; return blocks.push({ id: `block-${blocks.length}`, url: url, domain: domain, recipe: this.last.map(item => item.recipe).join(", ") }), list[domain] = blocks, list; }); } removeFromLocalBlacklist() { const domain = document.domain; PBStorageSync.pb_overlayBlockedList.update((list = {}) => { let blocks = list[domain] || [], lastRecepies = this.last.map(item => item.recipe); return blocks = blocks.filter(item => -1 == lastRecepies.indexOf(item.recipe)), list[domain] = blocks, list; }); } autoDetect(attempt = 0) { if (attempt < 40) { let foundBlockList = this.forceBlock(this.activeBlockList), foundRecipeList = this.forceBlock(this.activeRecepiesList); foundBlockList.length && this.onBlockListFound({ found: foundBlockList }), foundRecipeList.length && this.onRecipeFound({ found: foundRecipeList }), setTimeout(() => { this.autoDetect(++attempt); }, 250); } else this.checkRecepiesSuccess(); } createBlockListFromStorage() { return new Promise(resolve => { storage.get("pb_overlayBlockedList").then((list = {}) => { list[document.domain] && (this.activeBlockList = list[document.domain], this.createBlockCSS(this.activeBlockList)), resolve(); }); }); } createBlockListFromRecepies(recepies) { this.blackListPromise.then(() => { const blockList = this.activeBlockList.map(item => item.recipe); recepies = recepies.map(recipe => ({ recipe: recipe, found: !1 })).filter(item => -1 == blockList.indexOf(item.recipe)), this.activeRecepiesList = recepies, this.createBlockCSS(recepies); }); } checkRecepiesSuccess() { const notFound = this.activeRecepiesList.filter(item => !item.found); notFound.length && this.onRecipeNotFound(notFound); } createGlobalCSS() { const htmlStyle = $("html").attr("style"), bodyStyle = $("body").attr("style"); $('').appendTo("head"), $("html").attr("style", (htmlStyle ? htmlStyle + ";" : "") + "overflow:auto !important;"), $("body").attr("style", (bodyStyle ? bodyStyle + ";" : "") + "overflow:auto !important;"); } createBlockCSS(list) { this.createGlobalCSS(), list.forEach(item => { let css = item.recipe + " { display:none !important; }"; $(``).appendTo("head"); }); } forceBlock(list) { let hide = []; return list.filter(item => !item.found).forEach(item => { $(item.recipe).length && (item.found = !0, hide.push(item.recipe)); }), hide.length && this.hide(hide), hide; } }; function inject() { const originalWindowOpenFn = window.open, originalCreateElementFn = document.createElement, originalAppendChildFn = HTMLElement.prototype.appendChild, originalCreateEventFn = document.createEvent, windowsWithNames = {}; let fullScreenOpenTime, lastBlockTime, timeSinceCreateAElement = 0, lastCreatedAElement = null, winWidth = window.innerWidth, winHeight = window.innerHeight, abd = !1; const parentOrigin = window.location != window.parent.location ? document.referrer || window.parent.location || "*" : document.location, parentRef = window.parent; function newWindowOpenFn() { const openWndArguments = arguments; let useOriginalOpenWnd = !0, generatedWindow = null; function getWindowName(openWndArguments) { const windowName = openWndArguments[1]; return null == windowName || [ "_blank", "_parent", "_self", "_top" ].includes(windowName) ? null : windowName; } let capturingElement = null, srcElement = null, closestParentLink = null; null != window.event && (capturingElement = window.event.currentTarget, srcElement = window.event.srcElement), null != srcElement && srcElement instanceof HTMLElement && (closestParentLink = srcElement.closest("a")) && closestParentLink.href && (openWndArguments[3] = closestParentLink.href); try { if (null == capturingElement) { let caller = openWndArguments.callee; for (;null != caller.arguments && null != caller.arguments.callee.caller; ) caller = caller.arguments.callee.caller; null != caller.arguments && caller.arguments.length > 0 && null != caller.arguments[0].currentTarget && (capturingElement = caller.arguments[0].currentTarget); } } catch (e) {} null == capturingElement ? (window.pbreason = "Blocked a new window opened without any user interaction", useOriginalOpenWnd = !1) : null != capturingElement && (capturingElement instanceof Window || function() { try { return !!(parent.Window && capturingElement instanceof parent.Window); } catch (e) { return !1; } }() || capturingElement === document || null != capturingElement.URL && null != capturingElement.body || null != capturingElement.nodeName && ("body" == capturingElement.nodeName.toLowerCase() || "document" == capturingElement.nodeName.toLowerCase())) ? (window.pbreason = `Blocked a new window opened with URL: ${openWndArguments[0]} because it was triggered by the ${capturingElement.nodeName} element`, useOriginalOpenWnd = !1) : !function(el) { let style = el && el.style; return !!(style && /fixed|absolute/.test(style.position) && el.offsetWidth >= .6 * winWidth && el.offsetHeight >= .75 * winHeight); }(capturingElement) ? useOriginalOpenWnd = !0 : (window.pbreason = "Blocked a new window opened when clicking on an element that seems to be an overlay", useOriginalOpenWnd = !1); document.webkitFullscreenElement || document.mozFullscreenElement || document.fullscreenElement; (new Date().getTime() - fullScreenOpenTime < 1e3 || isNaN(fullScreenOpenTime) && (document.fullScreenElement && null !== document.fullScreenElement || null != document.mozFullscreenElement || null != document.webkitFullscreenElement)) && (window.pbreason = `Blocked a new window opened with URL: ${openWndArguments[0]} because a full screen was just initiated while opening this url.`, document.exitFullscreen ? document.exitFullscreen() : document.mozCancelFullScreen ? document.mozCancelFullScreen() : document.webkitCancelFullScreen && document.webkitCancelFullScreen(), useOriginalOpenWnd = !1); let openUrl = openWndArguments[0], inWhitelist = isInWhitelist(openUrl); if (inWhitelist ? useOriginalOpenWnd = !0 : isInList(openUrl, pb_blacklist) && (useOriginalOpenWnd = !1), 1 == useOriginalOpenWnd) { generatedWindow = originalWindowOpenFn.apply(this, openWndArguments); let windowName = getWindowName(openWndArguments); if (null != windowName && (windowsWithNames[windowName] = generatedWindow), generatedWindow !== window) { const openTime = new Date().getTime(), originalWndBlurFn = generatedWindow.blur; generatedWindow.blur = (() => { new Date().getTime() - openTime < 1e3 && !inWhitelist ? (window.pbreason = `Blocked a new window opened with URL: ${openWndArguments[0]} because a it was blured`, generatedWindow.close(), blockedWndNotification(openWndArguments)) : originalWndBlurFn(); }); } } else { const location = { href: openWndArguments[0] }; location.replace = (url => { location.href = url; }), generatedWindow = { close: () => !0, test: () => !0, blur: () => !0, focus: () => !0, showModelessDialog: () => !0, showModalDialog: () => !0, prompt: () => !0, confirm: () => !0, alert: () => !0, moveTo: () => !0, moveBy: () => !0, resizeTo: () => !0, resizeBy: () => !0, scrollBy: () => !0, scrollTo: () => !0, getSelection: () => !0, onunload: () => !0, print: () => !0, open() { return this; }, opener: window, closed: !1, innerHeight: 480, innerWidth: 640, name: openWndArguments[1], location: location, document: { location: location } }, function(src, dest) { let prop; for (prop in src) try { void 0 === dest[prop] && src[prop] && (dest[prop] = src[prop]); } catch (e) {} }(window, generatedWindow), generatedWindow.window = generatedWindow; let windowName = getWindowName(openWndArguments); if (null != windowName) try { windowsWithNames[windowName].close(); } catch (err) {} let fnGetUrl = function() { let url; url = generatedWindow.location instanceof Object ? generatedWindow.document.location instanceof Object ? null != location.href ? location.href : openWndArguments[0] : generatedWindow.document.location : generatedWindow.location, openWndArguments[0] = url, blockedWndNotification(openWndArguments); }; top == self ? setTimeout(fnGetUrl, 100) : fnGetUrl(); } return generatedWindow; } function onFullScreen(isInFullScreenMode) { fullScreenOpenTime = isInFullScreenMode ? new Date().getTime() : NaN; } function isInWhitelist(url) { return isInList(url, pb_whitelist); } function isInList(url, list) { return !!list && list.some(li => new RegExp("https?://(www.|.*.)?" + li + "+").test(url)); } function blockedWndNotification(openWndArguments) { var baseURL; (!lastBlockTime || lastBlockTime < Date.now() - 1e3) && (openWndArguments[0] = (baseURL = openWndArguments[0], /^about:blank/i.test(baseURL) ? baseURL : /^(https?:)?\/\//.test(baseURL) ? baseURL : baseURL = location.origin + (/^\//.test(baseURL) ? "" : "/") + baseURL), openWndArguments.abd = abd, parentRef.postMessage({ type: "blockedWindow", args: JSON.stringify(openWndArguments) }, parentOrigin)), lastBlockTime = Date.now(); } window.open = function() { try { return newWindowOpenFn.apply(this, arguments); } catch (err) { return null; } }, HTMLElement.prototype.appendChild = function() { const newElement = originalAppendChildFn.apply(this, arguments); if ("IFRAME" == newElement.nodeName && newElement.contentWindow) try { let code = `(function () {\n var pb_blacklist = ${JSON.stringify(pb_blacklist)};\n var pb_whitelist = ${JSON.stringify(pb_whitelist)};\n ${inject.toString()};\n inject();\n })();`, s = document.createElement("script"); s.text = code, newElement.contentWindow.document.body.appendChild(s); } catch (e) {} return newElement; }, document.createElement = function() { const newElement = originalCreateElementFn.apply(document, arguments); if ("a" == arguments[0] || "A" == arguments[0]) { timeSinceCreateAElement = new Date().getTime(); const originalDispatchEventFn = newElement.dispatchEvent; newElement.dispatchEvent = function(event) { return null == event.type || "click" != `${event.type}`.toLocaleLowerCase() || isInWhitelist(newElement.href) ? originalDispatchEventFn.call(this, event) : (window.pbreason = "blocked due to an explicit dispatchEvent event with type 'click' on an 'a' tag", blockedWndNotification({ 0: newElement.href }), !0); }, lastCreatedAElement = newElement; } return newElement; }, document.createEvent = function() { try { if (arguments[0].toLowerCase().includes("mouse") && new Date().getTime() - timeSinceCreateAElement <= 50) { let openUrlDomain, topUrl, topDomain; try { openUrlDomain = new URL(lastCreatedAElement.href).hostname; } catch (e) {} try { topUrl = window.location != window.parent.location ? document.referrer : document.location.href; } catch (e) {} try { topDomain = new URL(topUrl).hostname; } catch (e) {} let isSelfDomain = openUrlDomain == topDomain; if (lastCreatedAElement.href.trim() && !isInWhitelist(lastCreatedAElement.href) && !isSelfDomain) return window.pbreason = `Blocked because 'a' element was recently created and ${arguments[0]} event was created shortly after`, arguments[0] = lastCreatedAElement.href, blockedWndNotification({ 0: lastCreatedAElement.href }), { type: "click", initMouseEvent: function() {} }; } return originalCreateEventFn.apply(document, arguments); } catch (err) {} }, document.addEventListener("fullscreenchange", () => { onFullScreen(document.fullscreen); }, !1), document.addEventListener("mozfullscreenchange", () => { onFullScreen(document.mozFullScreen); }, !1), document.addEventListener("webkitfullscreenchange", () => { onFullScreen(document.webkitIsFullScreen); }, !1), function() { try { var tester = document.createElement("div"); tester.innerHTML = " ", tester.className = "adsbox", tester.style.cssText = "position:absolute;top-1000px;left:-1000px;", document.body.appendChild(tester), window.setTimeout(function() { 0 === tester.offsetHeight && (abd = !0), tester.remove(); }, 100); } catch (e) {} }(), window.pbExternalCommand = function(commandId, messageId) { !function(commandId, messageId) { if (messageId == pb_message) switch (commandId) { case 0: window.open = originalWindowOpenFn, document.createElement = originalCreateElementFn, document.createEvent = originalCreateEventFn, HTMLElement.prototype.appendChild = originalAppendChildFn; } }(commandId, messageId); }; } function executeCode(code) { let s = document.createElement("script"); s.textContent = code, insertBeforeRoot(s), setTimeout(function() { s.parentNode.removeChild(s); }, 50); } function isDomainInList(domain, domainList, returnValue) { domainList = domainList || []; for (var i = 0; i < domainList.length; i++) { var domainTail = domainList[i]; if (new RegExp("\\b[(www\\.)|.*.]?" + domainTail + "\\b").test(domain)) return !returnValue || domainTail; } return !1; } function getI18N(msgName, alternative) { const lang = "zh-cn" == navigator.language.toLowerCase() ? "CN" : "EN"; return (LANG[lang][msgName] || LANG[lang][alternative] || { message: msgName }).message; } function insertBeforeRoot(dom) { let rootDocument = document.documentElement; rootDocument.insertBefore(dom, rootDocument.firstChild); } const notification_$ = jQuery.noConflict(); var content_notification = class { constructor(props = {}) { this.queue = [], this.props = props, this.notificationHTML = "\n
\n \n \n \n \n \n \n \n", window.addEventListener("message", event => { if (event.data && event.data.toastId == this.toastId) { let data = event.data; switch (data.action) { case "pb-message-display": this.options.onDisplay && this.options.onDisplay(), this.props.onDisplay.call(this, { source: data.source }); break; case "pb-message-close": this.userGeneratedClose = !0, data.quickClose ? this.remove() : this.queueFade(100, this.options.onFadeOut), data.triggerEvent && (this.options.onClose && this.options.onClose(), this.options.onButtonClick && this.options.onButtonClick({ id: "close" }), this.props.onButtonClick.call(this, { source: data.source, id: "close" }), this.props.onCloseClick.call(this, { source: data.source })); break; case "pb-message-btn-click": this.options.buttons[data.id] && this.options.buttons[data.id](), this.options.onButtonClick && this.options.onButtonClick({ id: data.id }), this.props.onButtonClick.call(this, { source: data.source, id: data.id }); break; case "pb-message-tooltip-over": isI18N(data.id) && this.showTooltip(data); break; case "pb-message-tooltip-out": this.hideTooltip(); } this.props.onAction && this.props.onAction(data.action); } }), document.addEventListener("visibilitychange", event => { if ("visible" == document.visibilityState) { let now = new Date().getTime(); this.queueFadeTime && now > this.queueFadeTime + 5e3 && this.remove(); } }, !1); } addQueue(options) { this.queue.push(options), this.isNotificationActive || this.show(this.getNextQueueItem()); } getNextQueueItem() { return this.queue.shift(); } show(options) { this.init(options), !options.quickOpen || document.body ? (this.isNotificationActive = !0, this.render()) : setTimeout(() => { this.show(options); }, 50); } render() { let data = this.getIframeData(); this.toast = notification_$('