-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Description
What type of resource that you're use?
Filterlist: Anti APKMirror Ads and Countdown
Describe the issue
Take report from collinbarrett/FilterLists#2812 that said APKMirror update anti-adblock method
Steps to reproduce
- Go to APKMirror website
- Pick some app to download
- if the app have architecture variants, select some.
- See the download button
Expected behaviour
It should have no wait time countdown and the button should not greyed out.
Actual behaviour
Get wait time countdown due to blocked ads and download button are greyed out, that's prevent you to click until countdown end.
Screenshots
Logs
Additional notes
There's has the 3 letters generated DOM inserted behind download button to store and check how many ads are visible, I cannot find proper function name to block because the 3 letters are randomly generated everytime when pages are reloaded, I'll copy the possibly code block function that check ads and block download button in case other peoples found solution.
<script type="text/javascript">function docReady(t){"complete"===document.readyState||"loading"!==document.readyState&&!document.documentElement.doScroll?t():document.addEventListener("DOMContentLoaded",t)}function visible(t){return!!(2<t.offsetWidth||2<t.offsetHeight||2<t.getClientRects().length)}function realTimer(t,e){let o=Math.floor(Date.now()/1e3),a,n=setInterval(function(){a=e-Math.floor(Math.floor(Date.now()/1e3)-o),t(a),0==a&&clearInterval(n)},1e3)}function visibleEl(t){let o=0;return document.querySelectorAll(t).forEach(function(t,e){visible(t)&&(o+=1)}),o}let APKHelpers={customEvent:function(t,e,o){return new CustomEvent(t+".bs."+e,{cancelable:!0,bubbles:!0,relatedTarget:o})},customEventDispatch:function(t){if(this)return this.dispatchEvent(t)},loadJs:function(n,s=!1){return new Promise(function(t,e){let o=document,a=o.createElement("script");a.src=n,0!=s&&(a.id=s),a.onerror=function(t){e(t,a)},a.onload=function(){t(!0)},(o.head||o.body).appendChild(a)})}},APKModal=function(){let e=document.createElement("div"),a=null;function n(t){a&&s(a),document.body.dataset.originalPadding=parseInt(getComputedStyle(document.body).paddingRight,10),APKHelpers.customEventDispatch.call(t,APKHelpers.customEvent("show","modal")),t.addEventListener("transitionend",()=>{APKHelpers.customEventDispatch.call(t,APKHelpers.customEvent("shown","modal"))},{once:!0}),t.addEventListener("click",o,!1),document.body.appendChild(e),document.body.style.paddingRight=document.body.dataset.originalPadding+function(){const t=document.createElement("div");t.style.visibility="hidden",t.style.overflow="scroll",document.body.appendChild(t);var e=document.createElement("div");t.appendChild(e);e=t.offsetWidth-e.offsetWidth;return t.parentNode.removeChild(t),e}()+"px",document.body.classList.add("modal-open"),document.body.classList.add("apkm-modal-open"),t.classList.add("in"),t.offsetWidth,t.classList.add("shown"),t.setAttribute("aria-hidden",!1),a=t}function s(t){t&&APKHelpers.customEventDispatch.call(t,APKHelpers.customEvent("hide","modal"))&&(a=null,t.removeEventListener("click",o,!1),document.body.style.paddingRight=document.body.dataset.originalPadding+"px",document.body.classList.remove("modal-open"),document.body.classList.remove("apkm-modal-open"),t.classList.remove("in"),t.classList.remove("shown"),t.setAttribute("aria-hidden",!0),e.remove())}function o(o){if(o&&("hashchange"==o.type&&(a?s(a):t(o)),"click"==o.type)){let t=o.target,e="modal"==t.getAttribute("data-dismiss")||t.closest('[data-dismiss="modal"]')||!1;!e&&t!=a||(o.preventDefault(),s(a),history.back())}}function t(t){var e=window.location.hash;e&&function(t,e){let o=document.getElementById(t.substring(1));o&&o.classList.contains("modal")&&(e||(history.replaceState("",document.title,window.location.pathname+window.location.search),history.pushState("",document.title,window.location.pathname+window.location.search+t)),n(o))}(e,t)}return e.classList.add("modal-backdrop"),window.addEventListener("hashchange",o,!1),document.addEventListener("keydown",function(t){"input"!==t.target.tagName.toLowerCase()&&"textarea"!==t.target.tagName.toLowerCase()&&a&&27===t.which&&history.back()},!1),{hide:s,showFromHash:t,showFromAction:function(t,e){e&&e.preventDefault(),e=t.id||"APKModal",history.pushState("",document.title,window.location.pathname+window.location.search+"#"+e),n(t)}}}(),APKDropdown=function(){let o=document.createElement("div"),a='[data-toggle="dropdown"]';function n(t){var e=this.dataset.target||!!this.getAttribute("href")&&this.getAttribute("href").replace(/.*(?=#[^\s]*$)/,"");return document.querySelector(e)||this.parentNode}function s(t){o.remove();let e=document.querySelectorAll(a);e.forEach(function(t){let e=n.call(t);e&&e.classList.contains("open")&&APKHelpers.customEventDispatch.call(e,APKHelpers.customEvent("hide","dropdown"))&&(t.setAttribute("aria-expanded","false"),e.classList.remove("open"),APKHelpers.customEventDispatch.call(e,APKHelpers.customEvent("hidden","dropdown")))})}return o.classList.add("dropdown-backdrop"),{toggle:function(t){if(void 0===this.classList||!this.classList.contains("disabled")&&!this.hasAttribute("disabled")){let t=n.call(this),e=t.classList.contains("open");if(s(),!e){if("ontouchstart"in document.documentElement&&!t.closest(".navbar-nav")&&this.parentNode.appendChild(o),!APKHelpers.customEventDispatch.call(t,APKHelpers.customEvent("show","dropdown")))return;this.setAttribute("aria-expanded","true"),t.classList.add("open"),APKHelpers.customEventDispatch.call(t,APKHelpers.customEvent("shown","dropdown"))}return!1}},clearDropdowns:s}}(),APKTab=function(){let d={};function o(a){let n=this,s=n.closest("ul:not(.dropdown-menu)"),i=document.querySelector(n.dataset.target||n.getAttribute("href").replace(/.*(?=#[^\s]*$)/,""));if(i&&("li"!==n.parentNode.tagName.toLowerCase()||!n.parentNode.classList.contains("active"))){if(s.classList.contains("sticky-tabs")&&history&&history.pushState&&window.location.hash!=i.id&&(!a||"hashchange"!=a.type)&&history.pushState(null,null,window.location.pathname+window.location.search+"#"+i.id),"undefined"!=typeof tabadcode&&!(i.id in d)&&i.querySelector(".gooWindow")){i.querySelector(".gooWindow").innerHTML=tabadcode[i.id],d[i.id]=!0;try{(adsbygoogle=window.adsbygoogle||[]).push({})}catch(t){}}let t=s.querySelector(".active a"),e=APKHelpers.customEventDispatch.call(t,APKHelpers.customEvent("hide","tab",n)),o=APKHelpers.customEventDispatch.call(n,APKHelpers.customEvent("show","tab",t));e&&o&&(l(n.closest("li"),s),l(i,i.parentNode,function(){APKHelpers.customEventDispatch.call(t,APKHelpers.customEvent("hidden","tab")),APKHelpers.customEventDispatch.call(n,APKHelpers.customEvent("shown","tab"))}))}}function l(e,t,o){let a=t.querySelector(":scope > .active");a.classList.remove("active");let n=a.querySelectorAll(":scope > .dropdown-menu > .active");n.forEach(function(t){t.classList.remove("active")});let s=a.querySelectorAll('[data-toggle="tab"]');s.forEach(function(t){t.setAttribute("aria-expanded","false")}),e.classList.add("active");let i=e.querySelectorAll('[data-toggle="tab"]');if(i.forEach(function(t){t.setAttribute("aria-expanded","true")}),e.closest(".dropdown-menu")){e.closest("li.dropdown").classList.add("active");let t=e.querySelectorAll('[data-toggle="tab"]');t.forEach(function(t){t.setAttribute("aria-expanded","true")})}o&&o()}function t(t){var e=window.location.hash,e=document.querySelector('[data-toggle="tab"][href="'+e+'"],[data-toggle="pill"][href="'+e+'"]');e&&o.call(e,t)}return window.addEventListener("hashchange",t,!1),{show:o,showFromHash:t}}();document.addEventListener("DOMContentLoaded",function(){APKTab.showFromHash(),APKModal.showFromHash(),document.addEventListener("click",function(t){APKDropdown.clearDropdowns();let e=t.target,o="modal"==e.getAttribute("data-toggle")?e:e.closest('[data-toggle="modal"]')||!1;if(o){var a=o.dataset.target||!!o.getAttribute("href")&&o.getAttribute("href").replace(/.*(?=#[^\s]*$)/,"");if(a)return void APKModal.showFromAction(document.querySelector(a),t)}a="dropdown"==e.getAttribute("data-toggle")?e:e.closest('[data-toggle="dropdown"]')||!1;a?APKDropdown.toggle.call(a):(a="tab"==e.getAttribute("data-toggle")||"pill"==e.getAttribute("data-toggle")?e:e.closest('[data-toggle="tab"]')||e.closest('[data-toggle="pill"]')||!1)&&(t.preventDefault(),APKTab.show.call(a))},!1)},!1);</script>
<script>
HVB = visibleEl(".gooWidget");
</script>
<script>
function nkF(){RSV()}function RSV(){let l=document.querySelector(".PBP"),t=document.querySelector(".GpX"),o=document.querySelector(".fontBlue");l.classList.add("qZW"),t.classList.remove("hidden"),t.style.height=t.scrollHeight+"px",realTimer(function(e){return e<1?(t.style.height=0,void l.classList.remove("qZW")):void(o.innerHTML=e+" more sec")},15),t.querySelector(".vwB").style.width="100%"}HVB<2&&nkF(); </script>