Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
n0nexist committed Mar 29, 2023
1 parent 0b49180 commit 6b72c0f
Show file tree
Hide file tree
Showing 3 changed files with 175 additions and 0 deletions.
130 changes: 130 additions & 0 deletions background.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
/*
github.com/n0nexist/AdSmack
*/

// List of regex patterns to block
const BLOCKED_URLS = [
"*://*.doubleclick.net/*",
"*://partner.googleadservices.com/*",
"*://adservice.google.com/*",
"*://*.googlesyndication.com/*",
"*://*.google-analytics.com/*",
"*://creative.ak.fbcdn.net/*",
"*://*.adbrite.com/*",
"*://*.exponential.com/*",
"*://*.quantserve.com/*",
"*://*.scorecardresearch.com/*",
"*://*.zedo.com/*",
"*://*.adblade.com/*",
"*://*.adclickmedia.com/*",
"*://*.adnxs.com/*",
"*://*.adroll.com/*",
"*://*.adserver.com/*",
"*://*.adtech.com/*",
"*://*.atdmt.com/*",
"*://*.casalemedia.com/*",
"*://*.chitika.com/*",
"*://*.clicksor.com/*",
"*://*.criteo.com/*",
"*://*.districtm.net/*",
"*://*.dynamicyield.com/*",
"*://*.engagebdr.com/*",
"*://*.fastclick.com/*",
"*://*.flashtalking.com/*",
"*://*.gemini.yahoo.com/*",
"*://*.imrworldwide.com/*",
"*://*.infolinks.com/*",
"*://*.intellimize.com/*",
"*://*.jsdelivr.net/*",
"*://*.krxd.net/*",
"*://*.liveintent.com/*",
"*://*.maxmind.com/*",
"*://*.media.net/*",
"*://*.mediaplex.com/*",
"*://*.mgid.com/*",
"*://*.moatads.com/*",
"*://*.monetate.net/*",
"*://*.nativeads.com/*",
"*://*.ooyala.com/*",
"*://*.outbrain.com/*",
"*://*.perimeterx.net/*",
"*://*.pixel.adsafeprotected.com/*",
"*://*.pubmatic.com/*",
"*://*.quantummetric.com/*",
"*://*.redditads.com/*",
"*://*.revcontent.com/*",
"*://*.rubiconproject.com/*",
"*://*.sharethrough.com/*",
"*://*.simpli.fi/*",
"*://*.smartadserver.com/*",
"*://*.taboola.com/*",
"*://*.tapad.com/*",
"*://*.teads.tv/*",
"*://*.hotjar.*/*",
"*://*events.hotjar.io/*",
"*://*.ads-twitter.com/*",
"*://*analytics.twitter.com/*",
"*://*ads.twitter.com/*",
"*://*ads-api.twitter.com/*",
"*://*s3.amazonaws.com/*",
"*://*advertising*amazonaws.com/*",
"*://*.adcolony.com/*",
"*://app-measurement.com/*",
"*://analytics.google.com/*",
"*://*.googleanalytics.com/*",
"*://*.freshmarketer.com/*",
"*://*freshmarketer.com/*",
"*://stats.wp.com/*",
"*://*.luckyorange.*/*",
"*://luckyorange.com/*",
"*://*.sentry-cdn.*/*",
"*://*.bugsnag.*/*",
"*://pixel.facebook.com/*",
"*://an.luckyorange.com/*",
"*://*.redditmedia.com/*",
"*://events.reddit.com/*",
"*://ads-api.tiktok.*/*",
"*://analytics.tiktok.*/*",
"*://analytics-sg.tiktok.*/*",
"*://business-api.tiktok.*/*",
"*://ads.tiktok.*/*",
"*://ads.youtube.com/*",
"*://ads.pinterest.*/*",
"*://log.pinterest.*/*",
"*://analytics.pinterest.*/*",
"*://trk.pinterest.*/*",
"*://widgets.pinterest.*/*",
"*://ads.yahoo.*/*",
"*://geo.yahoo.*/*",
"*://udc.yahoo.*/*",
"*://udcm.yahoo.*/*",
"*://analytics.query.yahoo.*/*",
"*://partnerads.ysm.yahoo.*/*",
"*://log.fc.yahoo.*/*",
"*://gemini.yahoo.*/*",
"*://adtech.yahoo.*/*",
"*://extmaps-api.yandex.*/*",
"*://appmetrica.yandex.*/*",
"*://adfstat.yandex.*/*",
"*://metrika.yandex.*/*",
"*://advertising.yandex.*/*",
"*://offerwall.yandex.*/*",
"*://*.unityads.unity3d.com/*",
];

// Short adblock script
browser.webRequest.onBeforeRequest.addListener(
function(details) {
// Check if the request URL matches any of the blocked patterns
// Using regular expressions
for (let pattern of BLOCKED_URLS) {
let regex = new RegExp(pattern.replace(/\*/g, '.*'));
if (regex.test(details.url)) {
// Drops the request
return {cancel: true};
}
}
},
{urls: ["<all_urls>"]}, // Make this work on all urls
["blocking"]
);
16 changes: 16 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"manifest_version": 2,
"name": "AdSmack",
"version": "1.2.3",
"description": "made by n0nexist.github.io",
"browser_action": {
"default_title": "AdSmack",
"default_popup": "menu.html"
},
"permissions": ["webRequest", "webRequestBlocking", "<all_urls>"],
"background": {
"scripts": ["background.js"],
"persistent": false
}
}

29 changes: 29 additions & 0 deletions menu.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!DOCTYPE html>
<html>
<head>
<title>AdSmack</title>
<style>
body {
font-family: 'Times New Roman', Times, serif;
font-size: 12px;
margin: 0;
padding: 0;
}

h1 {
font-size: 16px;
font-weight: bold;
margin: 0 0 10px;
}

body {
background: black;
color: red;
}
</style>
</head>
<body>
<h2> AdSmack </h2>
<center><h4>by <a href="https://n0nexist.github.io/" style = "color: rgb(168, 19, 19)">n0nexist</a></h4></center>
</body>
</html>

0 comments on commit 6b72c0f

Please sign in to comment.