From 5f9c0e3b5bd0fc976a487b15da2d997c88d8109f Mon Sep 17 00:00:00 2001 From: LethaK Maas Date: Sat, 18 Mar 2017 22:19:06 +0100 Subject: [PATCH] Less ads, less popups --- .gitignore | 1 + DIU.meta.js | 2 +- DIU.user.js | 76 ++++++++++++++++++++++++++++++++++++++++++----------- README.md | 23 +++++++++++++--- 4 files changed, 82 insertions(+), 20 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..485dee6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea diff --git a/DIU.meta.js b/DIU.meta.js index a44547f..52c8687 100644 --- a/DIU.meta.js +++ b/DIU.meta.js @@ -1,7 +1,7 @@ // ==UserScript== // @name Digitally Imported Userscript // @namespace LTKDIFMU -// @version 2016.1.31 +// @version 2017.3.18 // @author LethaK Maas // @description Removes afk popup and minimize ads if possible // @include http://www.di.fm* diff --git a/DIU.user.js b/DIU.user.js index c1114bd..9e49f9b 100644 --- a/DIU.user.js +++ b/DIU.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name Digitally Imported Userscript // @namespace LTKDIFMU -// @version 2016.1.31 +// @version 2017.3.18 // @author LethaK Maas // @description Removes afk popup and minimize ads if possible // @include http://www.di.fm* @@ -12,25 +12,69 @@ // @grant none // ==/UserScript== (function () { + setInterval(function(){ -setInterval(function(){ + try{ -// AFK MUTE -di.app.timedAlerts.stop(); -// Ads -//AudioAddict.WP.AdManager.providers = {} -//AudioAddict.Ad.adswizz = {}; -AudioAddict.WP.wp.adManager.stop(); -AudioAddict.webplayer.adblocks.gracePeriodTimer_.finish_(); -AudioAddict.webplayer.adblocks.gracePeriodTimer_.stop(); -AudioAddict.webplayer.adblocks.adEnd_(); -AudioAddict.webplayer.adblocks.adBlockEnd(); + jQuery('[id^="adprovider"]').remove(); + //$(document).trigger("ad-end"); + //di.eventbus.trigger("webplayer:ad:end"); + jQuery(document).on("ad-begin", function(e){ + console.warn('Ad begin event (muting) ', e); + AudioAddict.WP.wp.mute(); + }); + jQuery(document).on("ad-end", function(e){ + console.warn('Ad end event (unmuting) ', e); + AudioAddict.WP.wp.unMute(); + }); -// Ads panel -jQuery('#panel-ad > div.panel-header > div.icon-cross3.panel-close.icon').trigger('click'); -},2000); + di.app.module("WebplayerApp.Ads.Adblocks").logger = new di.log.Console("WebplayerApp.Ads.Adblocks (Silenced)"); + di.app.module("WebplayerApp.Ads.Supervisor").logger = new di.log.Console("WebplayerApp.Ads.Supervisor (Silenced)"); -}) () + di.app.module("WebplayerApp.Ads.Adblocks").adHasVisual = function(){ + return false; + }; + + di.app.module("WebplayerApp.Ads.Adblocks").onAdBlockEnd = function(){ + this.adblockActive = !1; + di.eventbus.trigger("webplayer:adblock:end"); + }; + + di.app.module("WebplayerApp.Ads.Adblocks").onAdBegin = function(e, t) { + return void 0; + }; + + NS("AudioAddict.WP.AdManager").providers = null; + NS("AudioAddict.WP.AdManager.providers"); + + di.app.module("WebplayerApp.Ads.Supervisor").supervise = function(e){}; + di.app.module("WebplayerApp.Ads.Supervisor").eligibleForPreroll = function(){return false;}; + di.app.module("WebplayerApp.Ads.Supervisor").eligibleForMidroll = function(){return false;}; + di.app.module("WebplayerApp.Ads.Supervisor").requestAd = function(e){}; + di.app.module("WebplayerApp.Ads.Supervisor").selectAds_ = function(e){return [];}; + di.app.module("WebplayerApp.Ads.Supervisor").startAd = function(e){return }; + di.app.module("WebplayerApp.app.webplayer").submodules.ads = null; + di.app.timedAlerts.stop(); + di.app.WebplayerApp.Ads.Provider = null; + //AudioAddict.WP.wp.adManager.stop(); + + //AudioAddict.WP.adManager = null; + //AudioAddict.WP.wp.adManager = null; + + NS("AudioAddict.WP").AdManager = null; + NS("AudioAddict.WP").AdProvider = null; + di.app.webplayer.ads = null; + + NS("AudioAddict.WP.wp").initAdManager = function(){ return null;}; + + + jQuery('.premium-upsell').remove(); + } catch(ex){ + console.warn('An error occured while silencing ads', ex); + } + + }, 500); +})(); diff --git a/README.md b/README.md index 60b3d0f..4a76550 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,30 @@ # Digitally Imported Userscript -userscript aimed to minimize Ads and AFK-auto-mute on Digitally Imported (di.fm). Load with greasemonkey or tampermonkey browser extension +userscript aimed to minimize and block ads + + +## Features + +* Removes "premium" ad popup +* Removes "premium" ad section on all pages +* Prevents **some** ads to reach your ears by bypassing them +* Auto mute when an ad is playing, auto unmute when finished +* Breaks the anti-AFK system, so you can let the music run for hours without any human interaction + + +## Installation + +Load this [userscript](https://github.com/lethak/digitally_imported_userscript/raw/master/DIU.user.js) with [greasemonkey](https://addons.mozilla.org/en-gb/firefox/addon/greasemonkey/) or [tampermonkey](https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo) browser extension Userscript: https://github.com/lethak/digitally_imported_userscript/raw/master/DIU.user.js +## Still polluted by ads ? +Let me know via the "issue" section of this repository, or submit a pull request if you know how to fix the script. +If you can afford it, please consider [becoming premium](https://www.di.fm/premium). You will get access to DI in high quality and can listen from VLC or other players. -# Not actively maintained +## Looking for maintainers -* I am not listening to DI anymore from their website... to many ads +I am not listening to DI as often as I used to, please let me know if you want to be involved with this repo