Skip to content

Commit

Permalink
Less ads, less popups
Browse files Browse the repository at this point in the history
  • Loading branch information
lethak committed Mar 18, 2017
1 parent a818fe3 commit 5f9c0e3
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 20 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea
2 changes: 1 addition & 1 deletion DIU.meta.js
Original file line number Diff line number Diff line change
@@ -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*
Expand Down
76 changes: 60 additions & 16 deletions DIU.user.js
Original file line number Diff line number Diff line change
@@ -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*
Expand All @@ -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);
})();
23 changes: 20 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 5f9c0e3

Please sign in to comment.