ABPVN AdsBlock

Script block ads, remove wating of ABPVN

目前為 2021-08-20 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name ABPVN AdsBlock
  3. // @namespace ABPVN
  4. // @author ABPVN
  5. // @copyright ABPVN
  6. // @homepage https://abpvn.com
  7. // @supportURL https://github.com/abpvn/abpvn/issues
  8. // @icon https://abpvn.com/icon.png
  9. // @description Script block ads, remove wating of ABPVN
  10. // @description:vi Script chặn quảng cáo,loại bỏ chờ đợi của ABPVN
  11. // @contributionURL https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=donghoang.nguyen@gmail.com&item_name=ABPVN Donation
  12. // @grant GM_getValue
  13. // @grant GM_setValue
  14. // @grant GM_openInTab
  15. // @grant GM_registerMenuCommand
  16. // @include http://*
  17. // @include https://*
  18. // @version     2.2.98
  19. // @change-log Add getlink.tienichmaytinh.net auto bypass
  20. // @run-at document-end
  21. // ==/UserScript==
  22. /* String Prototype */
  23. String.prototype.startWith = function (str) {
  24. return typeof this.indexOf === 'function' && this.indexOf(str) === 0;
  25. };
  26. String.prototype.ismatch = function (regex) {
  27. return typeof this.match === 'function' && this.match(regex) !== null;
  28. };
  29. //Bypass Class
  30. var byPass = {
  31. hideLinkUnlock: function () {
  32. var contentDiv = document.querySelectorAll('.onp-sl-content,.onp-locker-call,[data-locker-id]');
  33. if (contentDiv.length) {
  34. ABPVN.cTitle();
  35. //Add style tag to hide all .onp-sl and show all .onp-sl-content
  36. if (!document.getElementById('abpvn_style')) {
  37. var style = document.createElement('style');
  38. style.id = 'abpvn_style';
  39. style.innerHTML = '.onp-sl-content{display:block!important;}.onp-sl,.onp-sl-overlap-box{display:none!important;}.onp-sl-blur-area{filter: none!important;}';
  40. document.body.appendChild(style);
  41. } //ShowALl ContentDiv
  42. for (var i in contentDiv) {
  43. if (contentDiv[i].firstChild && contentDiv[i].firstChild.innerText != 'Unlocked by ABPVN.COM') {
  44. var creditDiv = document.createElement('div');
  45. creditDiv.innerHTML = '<a href="http://abpvn.com" target="_blank" style="color: #08BE54;font-weight: bold;">Unlocked by ABPVN.COM</a>';
  46. creditDiv.style.textAlign = 'right';
  47. contentDiv[i].insertBefore(creditDiv, contentDiv[i].firstChild);
  48. }
  49. if (contentDiv[i].style) {
  50. contentDiv[i].style.display = 'block';
  51. }
  52. } //Hide All LockDiv
  53. var lockDiv = document.querySelectorAll('.onp-sl,div[id^="content-locker"]');
  54. for (var j in lockDiv) {
  55. if (lockDiv[j].style) {
  56. lockDiv[j].style.display = 'none !important';
  57. lockDiv[j].setAttribute('hidden', 'hidden');
  58. }
  59. }
  60. }
  61. },
  62. removeShortLink: function () {
  63. var allShortLink = document.querySelectorAll('a[href*="/full/?api="]');
  64. var count = 0;
  65. if (allShortLink.length) {
  66. ABPVN.cTitle();
  67. for (var i = 0; i < allShortLink.length; i++) {
  68. var processingLink = allShortLink[i];
  69. var href = processingLink.getAttribute('href');
  70. var tmp = href.match(/url=(.+?)&|$/);
  71. if (tmp[1]) {
  72. processingLink.setAttribute('href', atob(tmp[1].replace(/=+$/, '')));
  73. var oldTitle = processingLink.getAttribute('title');
  74. processingLink.setAttribute('title', oldTitle ? (oldTitle + ' ') : '' + 'Short link by pass by ABPVN.COM');
  75. count++;
  76. }
  77. }
  78. Logger.info("By pass " + count + " short link");
  79. }
  80. },
  81. quickByPassLink: function () {
  82. var regex = /123link\..*|phlame.pw|megaurl\.*|www.123l\.*|vinaurl\.*|share4you.pro|doxeaz10.site|derow.win|linkviet.net|ez4linkss.com|ckk.ai|link.codevn.net|linksht.com|beta.shortearn.eu|getlink.tienichmaytinh.net/;
  83. var largeTimeoutHost = /share4you.pro|derow.win/;
  84. var autoCaptchaOnlyList = /megaurl\.*|vinaurl\.*|doxeaz10.site|linkviet.net|ez4linkss.com|ckk.ai|link.codevn.net|beta.shortearn.eu|getlink.tienichmaytinh.net/;
  85. if (regex.test(location.hostname)) {
  86. try {
  87. var checkClick = function (mutation) {
  88. if (mutation.attributeName === "disabled" && !mutation.target.disabled) {
  89. return true;
  90. }
  91. if (mutation.attributeName === "class" && !mutation.target.classList.contains('disabled')) {
  92. return true;
  93. }
  94. return false;
  95. }
  96. var link;
  97. // Set up a new observer
  98. var observer = new MutationObserver(function (mutations) {
  99. mutations.forEach(function (mutation) {
  100. // Check the modified attributeName is "disabled"
  101. if (checkClick(mutation)) {
  102. mutation.target.click();
  103. }
  104. if (mutation.attributeName === "href") {
  105. link = mutation.target.getAttribute("href");
  106. document.body.innerHTML = '<style>h1{color: #00dc58;}a{color: #015199}a h1{color: #015199;}</style><center><h1>ABPVN quick bypass đã hoạt động</h1><a href=\'https://abpvn.com/donate\'><h1>Ủng hộ ABPVN</h1></a><br/>Không tự chuyển trang? <a href=\'' + link + '\' title=\'Chuyển trang\'>Click vào đây</a></center>';
  107. location.href = link;
  108. }
  109. });
  110. });
  111. // Configure to only listen to attribute changes
  112. var config = {
  113. attributes: true
  114. };
  115. var button = document.getElementById('invisibleCaptchaShortlink') || document.querySelector('.download_1');
  116. if (button) {
  117. observer.observe(button, config);
  118. } else if (document.querySelector('#originalLink')) {
  119. link = document.querySelector('#originalLink').getAttribute("href");
  120. document.body.innerHTML = '<style>h1{color: #00dc58;}a{color: #015199}a h1{color: #015199;}</style><center><h1>ABPVN quick bypass đã hoạt động</h1><a href=\'https://abpvn.com/donate\'><h1>Ủng hộ ABPVN</h1></a><br/>Không tự chuyển trang? <a href=\'' + link + '\' title=\'Chuyển trang\'>Click vào đây</a></center>';
  121. location.href = link;
  122. } else {
  123. var getLinkl = document.querySelector('.get-link');
  124. var timeout = largeTimeoutHost.test(location.hostname) ? 6000 : 100;
  125. if (getLinkl) {
  126. observer.observe(getLinkl, config);
  127. if (!autoCaptchaOnlyList.test(location.hostname)) {
  128. setTimeout(function () {
  129. $("#go-link").addClass("go-link").trigger("submit.adLinkFly.counterSubmit").one("submit.adLinkFly.counterSubmit", function (e) {
  130. e.preventDefault();
  131. if (!largeTimeoutHost.test(location.hostname)) {
  132. location.reload();
  133. }
  134. });
  135. }, timeout);
  136. }
  137. }
  138. }
  139. // mshares.co
  140. var downloadButton = document.querySelector('#download-file-button');
  141. if (downloadButton) {
  142. $.ajax({
  143. url: '/download/get-download-info',
  144. type: 'POST',
  145. data: {
  146. id: downloadButton.getAttribute('data-id')
  147. },
  148. success: function (data) {
  149. if (data.success && data.file_info && data.file_info.href) {
  150. var link = data.file_info.href;
  151. document.body.innerHTML = '<style>h1{color: #00dc58;}a{color: #015199}a h1{color: #015199;}</style><center><h1>ABPVN quick download đã hoạt động</h1><a href=\'https://abpvn.com/donate\'><h1>Ủng hộ ABPVN</h1></a><br/>Không tự tải xuống? <a href=\'' + link + '\' title=\'Tải xuống\'>Click vào đây</a></center>';
  152. location.href = link;
  153. } else {
  154. location.reload();
  155. }
  156. },
  157. error: function () {
  158. location.reload();
  159. }
  160. });
  161. }
  162. } catch (e) {
  163. Logger.error(e);
  164. }
  165. }
  166. },
  167. wikiall_org: function () {
  168. if (location.hostname == 'wikiall.org' && document.querySelector('#timer')) {
  169. var observer = new MutationObserver(function (mutations) {
  170. mutations.forEach(function (mutation) {
  171. // Check the modified childList of place
  172. if (mutation.type == 'childList') {
  173. var targetA = mutation.target.querySelector('a');
  174. location.href = targetA.getAttribute('href');
  175. }
  176. });
  177. });
  178. // Configure to only listen to attribute changes
  179. var place = document.querySelector('#place');
  180. observer.observe(place, {
  181. childList: true
  182. });
  183. }
  184. },
  185. init: function () {
  186. if (configure.getValue('unlock_content', true)) {
  187. window.addEventListener('DOMContentLoaded', this.hideLinkUnlock);
  188. window.addEventListener('load', this.hideLinkUnlock);
  189. this.hideLinkUnlock();
  190. }
  191. if (configure.getValue('remove_short_link', true)) {
  192. window.addEventListener('DOMContentLoaded', this.removeShortLink);
  193. }
  194. if (configure.getValue('quick_by_pass_link', true)) {
  195. this.quickByPassLink();
  196. this.wikiall_org();
  197. }
  198. }
  199. };
  200. //Logger Class
  201. var Logger = {
  202. style: 'color: #00DC58',
  203. info: function (text) {
  204. console.info('%cABPVN.COM Info: ', this.style, text);
  205. },
  206. warn: function (text) {
  207. console.warn('%cABPVN Warn: ', this.style, text);
  208. },
  209. error: function (text) {
  210. console.error('%cABPVN Error: ', this.style, text);
  211. },
  212. log: function (text) {
  213. console.log('%cABPVN Log: ', this.style, text);
  214. },
  215. };
  216. //get Link class
  217. var getLink = {
  218. vnz_leech_auto_fill: function () {
  219. if (this.url == 'https://www4.cbox.ws/box/?boxid=4240872&boxtag=soigia&sec=form' && this.url.indexOf('link=')) {
  220. var url = (window.location != window.parent.location) ?
  221. document.referrer :
  222. document.location.href;
  223. var match = url.match(/link=([\w\.\/\:]+)($|&|\?)/);
  224. if (match) {
  225. document.querySelector('input[name="pst"]').value = match[1];
  226. }
  227. }
  228. },
  229. mediafire_com: function () {
  230. if (this.url.startWith('http://www.mediafire.com/file/') || this.url.startWith('https://www.mediafire.com/file/')) {
  231. var a_tag = document.querySelector('.download_link a.input');
  232. var link = a_tag.getAttribute('href');
  233. if (link.startWith('http')) {
  234. document.body.innerHTML = '<style>h1{color: #00dc58;}a{color: #015199}a h1{color: #015199;}</style><center><h1>ABPVN MediaFire Download đã hoạt động</h1><a href=\'https://abpvn.com/donate\'><h1>Ủng hộ ABPVN</h1></a><br/>Không tự tải xuống? <a href=\'' + link + '\' title=\'Download\'>Click vào đây</a></center>';
  235. location.href = link;
  236. }
  237. }
  238. },
  239. usercloud_com: function () {
  240. if (this.url.startWith('https://userscloud.com/') && this.url.length > 24) {
  241. var form = document.querySelector('form[name="F1"]');
  242. if (form) {
  243. form.submit();
  244. document.body.innerHTML = '<style>h1{color: #00dc58;}a{color: #015199}a h1{color: #015199;}</style><center><h1>ABPVN UserCloud Download đã hoạt động</h1><a href=\'https://abpvn.com/donate\'><h1>Ủng hộ ABPVN</h1></center>';
  245. } else {
  246. var a_link = document.querySelector('h4 a.btn-success');
  247. if (a_link) {
  248. var link = a_link.getAttribute('href');
  249. if (link.startWith('https')) {
  250. document.body.innerHTML = '<style>h1{color: #00dc58;}a{color: #015199}a h1{color: #015199;}</style><center><h1>ABPVN UserCloud Download đã hoạt động</h1><a href=\'https://abpvn.com/donate\'><h1>Ủng hộ ABPVN</h1></a><br/>Không tự tải xuống? <a href=\'' + link + '\' title=\'Download\'>Click vào đây</a></center>';
  251.  
  252. }
  253. }
  254. }
  255. }
  256. },
  257. init: function () {
  258. this.url = location.href;
  259. if (configure.getValue('quick_download', true)) {
  260. this.mediafire_com();
  261. this.usercloud_com();
  262. this.vnz_leech_auto_fill();
  263. }
  264. }
  265. };
  266. //Fix site class
  267. var fixSite = {
  268. elementExist: function (selector) {
  269. var check = document.querySelector(selector);
  270. return check != null;
  271. },
  272. getAllText: function (selector) {
  273. var text = '';
  274. var nodeList = document.querySelectorAll(selector);
  275. if (nodeList) {
  276. for (var i in nodeList) {
  277. if (nodeList[i].innerText) text += nodeList[i].innerText;
  278. }
  279. }
  280. return text;
  281. },
  282. getScript: function (url) {
  283. var xhr = new XMLHttpRequest();
  284. xhr.open('GET', url);
  285. xhr.addEventListener('load', function (data) {
  286. var blob = new Blob([xhr.responseText], {
  287. type: 'text/javascript'
  288. });
  289. var blobUrl = URL.createObjectURL(blob);
  290. var script = document.createElement('script');
  291. script.src = blobUrl;
  292. script.type = 'text/javascript';
  293. document.getElementsByTagName('head')[0].appendChild(script);
  294. });
  295. xhr.send();
  296. },
  297. loadCss: function (url, id) {
  298. var css_tag = document.createElement('link');
  299. css_tag.rel = 'stylesheet';
  300. css_tag.id = id;
  301. css_tag.href = url;
  302. var head = document.getElementsByTagName('head')[0];
  303. head.appendChild(css_tag);
  304. },
  305. fakelinkRemover: function () {
  306. var regex = /ibongda|thevang.tv|banthang.live|tructiepbongda.vip|dabong.net|bongda365.tv|tructiepbongda.pro/
  307. if (regex.test(this.url)) {
  308. ABPVN.cTitle();
  309. var fakeLink = document.querySelectorAll('a[data-href][rel="nofollow"],a[data-url][rel="nofollow"],a[data-url].pop-open');
  310. var count = 0;
  311. for (var i = 0; i < fakeLink.length; i++) {
  312. if (fakeLink[i]) {
  313. fakeLink[i].setAttribute('href', fakeLink[i].getAttribute('data-href') || fakeLink[i].getAttribute('data-url'));
  314. count++;
  315. }
  316. }
  317. Logger.info("Removed " + count + " fake link in " + location.hostname);
  318. }
  319. },
  320. antiAdblockRemover: function () {
  321. var msg = 'By pass adBlock detect rồi nhé! Hahahahaha 😁😁😁';
  322. if (typeof adBlockDetected === 'function') {
  323. adBlockDetected = function () {
  324. Logger.info(msg);
  325. };
  326. }
  327. if (typeof showAdsBlock === 'function') {
  328. showAdsBlock = function () {
  329. Logger.info(msg);
  330. };
  331. }
  332. if (typeof nothingCanStopMeShowThisMessage === 'function') {
  333. nothingCanStopMeShowThisMessage = function () {
  334. Logger.info(msg);
  335. };
  336. }
  337. },
  338. kickass_cc: function () {
  339. if (this.url.startWith('https://kickass2.cc')) {
  340. var allFakeA = document.querySelectorAll('a[href^="https://mylink.cx/?url="]');
  341. var count = 0;
  342. for (var i = 0; i < allFakeA.length; i++) {
  343. var aTag = allFakeA[i];
  344. if (aTag) {
  345. var realLink = aTag.getAttribute('href').replace(/https:\/\/mylink\.cx\/\?url=(.*)/, '$1');
  346. aTag.setAttribute('href', decodeURIComponent(realLink));
  347. count++;
  348. }
  349. }
  350. Logger.info("Removed " + count + " fake link in " + location.hostname);
  351. }
  352. },
  353. topphimhd_info: function () {
  354. if (this.url.startWith('http://lb.topphimhd.info')) {
  355. var adSourceEl = document.querySelector('[data-ads=""]');
  356. if (adSourceEl) {
  357. adSourceEl.remove();
  358. Logger.log("Removed ads source");
  359. ABPVN.cTitle();
  360. }
  361. }
  362. },
  363. removeRedir: function (config) {
  364. if (this.url.match(new RegExp(config.url, 'g')) || this.url.startWith(config.url)) {
  365. ABPVN.cTitle();
  366. var links = document.querySelectorAll(config.selector || 'a[href^="' + config.replace + '"]');
  367. Logger.info('Remove Redirect for ' + links.length + ' links');
  368. if (links.length) {
  369. links.forEach(function (item) {
  370. var stockUrl = item.getAttribute('href').replace(config.replace, '');
  371. var count = 0;
  372. while (stockUrl.indexOf('%2') > -1 && count < 5) {
  373. stockUrl = decodeURIComponent(stockUrl);
  374. count++;
  375. }
  376. count = 0;
  377. while (stockUrl.indexOf('aHR0c') === 0 && count < 5) {
  378. stockUrl = atob(stockUrl);
  379. count++;
  380. }
  381. item.setAttribute('href', stockUrl);
  382. item.setAttribute('title', 'Link đã xóa chuyển hướng trung gian bởi abpvn.com');
  383. }.bind(this));
  384. }
  385. }
  386. },
  387. removeRedirect() {
  388. var configs = [
  389. {
  390. url: 'https://samsungvn.com',
  391. replace: 'https://samsungvn.com/xfa-interstitial/redirect?url=',
  392. },
  393. {
  394. url: 'https://forum.vietdesigner.net',
  395. replace: 'redirect/?url='
  396. },
  397. {
  398. url: 'http://phanmemaz.com/',
  399. replace: 'http://phanmemaz.com/wp-content/plugins/tm-wordpress-redirection/l.php?'
  400. },
  401. {
  402. url: 'forums.voz.vn/showthread.php',
  403. replace: '/redirect/index.php?link='
  404. },
  405. {
  406. url: 'www.webtretho.com/forum/',
  407. replace: /http(s?):\/\/webtretho\.com\/forum\/links\.php\?url=/,
  408. selector: 'a[href*="webtretho.com/forum/links.php?url="]'
  409. },
  410. {
  411. url: '/kat.vc|kickass.best/',
  412. replace: 'https://mylink.cx/?url='
  413. },
  414. {
  415. url: 'https://tuong.me/',
  416. replace: 'https://tuong.me/chuyen-huong/?url='
  417. },
  418. {
  419. url: 'https://yhocdata.com/',
  420. replace: 'https://yhocdata.com/redirect/?url='
  421. },
  422. {
  423. url: 'https://vn-z.vn/',
  424. replace: 'https://vn-z.vn/redirect?to='
  425. },
  426. {
  427. url: 'https://romgoc.net',
  428. replace: 'https://romgoc.net/redirect-to/?url='
  429. },
  430. {
  431. url: 'https://tophanmem.com',
  432. replace: 'https://tophanmem.com/redirect-to/?url='
  433. },
  434. ];
  435. configs.forEach(function (config) {
  436. this.removeRedir(config);
  437. }.bind(this));
  438. },
  439. init: function () {
  440. this.url = location.href;
  441. if (configure.getValue('remove_redirect', true)) {
  442. this.removeRedirect();
  443. }
  444. this.antiAdblockRemover();
  445. this.kickass_cc();
  446. this.fakelinkRemover();
  447. this.topphimhd_info();
  448. }
  449. };
  450. //Ad blocker script
  451. var adBlocker = {
  452. blockPopUp: function () {
  453. var listSite = [
  454. 'blogtruyen.vn',
  455. 'www.khosachnoi.net',
  456. 'hamtruyen.vn',
  457. 'phim14.net',
  458. 'phim7.com',
  459. 'www.diendan.trentroiduoidat.com',
  460. 'www.trentroiduoidat.com',
  461. 'chophanthiet.us',
  462. 'animetvn.com',
  463. 'font.vn',
  464. 'vidoza.net',
  465. 'www.easysoft.xyz',
  466. 'hdonline.vn',
  467. 'www.phim.media',
  468. 'phimnhanh.com',
  469. 'www.vietsubhd.com',
  470. 'www.phimmedia.tv',
  471. 'tvhay.org',
  472. 'bilutv.org',
  473. 'fullcrackpc.com'
  474. ];
  475. for (var i = 0; i < listSite.length; i++) {
  476. if (location.hostname === listSite[i]) {
  477. ABPVN.cTitle();
  478. Logger.info('Đã chặn popup quảng cáo');
  479. document.body.onclick = null;
  480. document.onclick = null;
  481. document.ontouchstart = null;
  482. document.onmousedown = null;
  483. window.addEventListener('load', function () {
  484. setTimeout(function () {
  485. Logger.info('Đã chặn popup quảng cáo onload');
  486. document.ontouchstart = null;
  487. document.onclick = null;
  488. document.body.onclick = null;
  489. document.onmousedown = null;
  490. }, 300);
  491. });
  492. window.addEventListener('DOMContentLoaded', function () {
  493. setTimeout(function () {
  494. Logger.info('Đã chặn popup quảng cáo dom load');
  495. document.ontouchstart = null;
  496. document.onclick = null;
  497. document.body.onclick = null;
  498. document.onmousedown = null;
  499. }, 300);
  500. });
  501. }
  502. }
  503. },
  504. mgIdAdRemover: function () {
  505. var allMgIdEl = document.querySelectorAll('[id*="ScriptRoot"]');
  506. if (allMgIdEl && allMgIdEl.length) {
  507. ABPVN.cTitle();
  508. Logger.log('Removed mgIdAd placeholder');
  509. for (var i = 0; i < allMgIdEl.length; i++) {
  510. if (location.hostname !== 'megaup.net') {
  511. allMgIdEl[i].id = 'ScriptRoot-removed-by-abpvn-' + Math.random();
  512. }
  513. allMgIdEl[i].innerHTML = '';
  514. }
  515. }
  516. },
  517. phimnhanh_com: function () {
  518. if (this.url.startWith('http://phimnhanh.com/xem-phim')) {
  519. Logger.warn('Đã chặn video preload');
  520. if (video !== undefined) {
  521. video.preroll = function (options) { };
  522. }
  523. }
  524. },
  525. vinaurl_net: function () {
  526. if (this.url.match(/vinaurl\.*/)) {
  527. document.querySelectorAll('div[id^="ads-"]').forEach(item => item.remove());
  528. }
  529. },
  530. phimnhe_net: function () {
  531. if (this.url.startWith('https://phimnhe.net') && createCookie !== undefined) {
  532. ABPVN.cTitle();
  533. createCookie('vwinpopuppc', 1, 72);
  534. createCookie('vwinpopupmb', 1, 72);
  535. }
  536. },
  537. aphimhot_com: function () {
  538. if (this.url.startWith('https://aphimhot.com')) {
  539. sessionStorage.setItem(key, 1);
  540. openTab = function (url) {
  541. Logger.log(`Chn popup ri nhé😁😁. Đang chuyn đến ${url}...`);
  542. location.href = url;
  543. }
  544. }
  545. },
  546. init: function () {
  547. this.url = location.href;
  548. this.mgIdAdRemover();
  549. this.blockPopUp();
  550. this.phimnhanh_com();
  551. this.vinaurl_net();
  552. this.phimnhe_net();
  553. this.aphimhot_com();
  554. },
  555. };
  556. var configure = {
  557. urls: {
  558. setting: 'https://abpvn.com/script-setting.html',
  559. issue: 'https://github.com/abpvn/abpvn/issues/new',
  560. fanpage: 'https://www.facebook.com/abpvn.org',
  561. },
  562. openUrl: function (url) {
  563. if (typeof GM_openInTab === 'function') {
  564. GM_openInTab(url);
  565. }
  566. },
  567. getValue: function (key, defaultValue) {
  568. var value;
  569. if (typeof GM_getValue === 'function') {
  570. value = GM_getValue(key);
  571. }
  572. if (typeof value === 'undefined') {
  573. return defaultValue;
  574. }
  575. return value;
  576. },
  577. setValue: function (key, value) {
  578. if (typeof GM_setValue === 'function') {
  579. return GM_setValue(key, value);
  580. }
  581. },
  582. setUpSetting: function () {
  583. if (this.url === this.urls.setting) {
  584. var settingContainer = document.querySelector('#setting-container');
  585. if (settingContainer) {
  586. settingContainer.classList.add('installed');
  587. var allSetting = settingContainer.querySelectorAll('input[type="checkbox"]');
  588. if (allSetting) {
  589. allSetting.forEach(checkbox => {
  590. checkbox.checked = this.getValue(checkbox.name, true);
  591. checkbox.addEventListener('change', event => {
  592. var target = event.target;
  593. var key = target.name;
  594. this.setValue(key, event.target.checked);
  595. });
  596. });
  597. }
  598. }
  599. }
  600. },
  601. init: function () {
  602. this.url = location.href;
  603. if (typeof GM_registerMenuCommand === 'function') {
  604. GM_registerMenuCommand('ABPVN - Cài đặt', () => {
  605. this.openUrl(this.urls.setting);
  606. });
  607. GM_registerMenuCommand('ABPVN - Báo lỗi', () => {
  608. this.openUrl(this.urls.issue);
  609. });
  610. GM_registerMenuCommand('ABPVN - Fanpage', () => {
  611. this.openUrl(this.urls.fanpage);
  612. });
  613. }
  614. this.setUpSetting();
  615. }
  616. };
  617. //Main class
  618. var ABPVN = {
  619. cTitle: function () {
  620. if (document.title.indexOf(' - Fixed by ABPVN.COM') === -1) {
  621. document.title = document.title + ' - Fixed by ABPVN.COM';
  622. }
  623. },
  624. init: function () {
  625. //Init class adBlocker
  626. adBlocker.init();
  627. //Init class getLink
  628. getLink.init();
  629. //Init class Fixsite
  630. fixSite.init();
  631. //Init bypass class
  632. byPass.init();
  633. if (window === window.parent) {
  634. //Init Congfiure
  635. configure.init();
  636. }
  637. }
  638. };
  639. //RUN INNIT
  640. ABPVN.init();