Skip to content

Instantly share code, notes, and snippets.

@janglapuk
Last active July 2, 2021 14:58
Show Gist options
  • Save janglapuk/790470741a39a0f2301b27d234e6a9cc to your computer and use it in GitHub Desktop.
Save janglapuk/790470741a39a0f2301b27d234e6a9cc to your computer and use it in GitHub Desktop.
GreaseMonkey/TamperMonkey script for automating adf.ly 'Skip' button
// ==UserScript==
// @name adf.ly Auto Skip Ad
// @namespace http://github.com/janglapuk
// @version 0.5
// @description Let you ignore the bunch of ads :] (simple and optimized rev)
// @author janglapuk
// @match http://adf.ly/*
// @require http://code.jquery.com/jquery-3.2.1.slim.min.js
// @require https://gist.githubusercontent.com/raw/2625891/waitForKeyElements.js
// @updateURL https://gist.github.com/janglapuk/790470741a39a0f2301b27d234e6a9cc/raw/adfly-skipper.user.js
// @grant none
// ==/UserScript==
// Credits:
// BrockA for waitForKeyElements.js (https://gist.github.com/BrockA)
(function() {
'use strict';
var skipBtn = 'a#skip_button[href]';
waitForKeyElements(skipBtn, function() {
var aLink = $(skipBtn);
window.location = aLink.attr('href');
});
})();
@alilord2011
Copy link

thanks

@Reaper261203
Copy link

Reaper261203 commented Aug 3, 2018

(tampermonkey) It says 22 "waitForKeyElements" is not defined and 23 "$" is not defined :(

@LuukvandenHoogen
Copy link

LuukvandenHoogen commented Jul 2, 2021

This is my suggestion, hastely put together because I had to download a lot, but at this time (july 2021) it does the job without popups, clicks and speeded up 4 seconds wait time.
Only now I realise what a lot of clicks that normally is..

`// ==UserScript==
// @name adf.ly Auto Skip Ad
// @namespace http://github.com/janglapuk
// @Version 1.0
// @description Let you ignore the bunch of ads :] (simple and optimized rev)
// @author janglapuk (feat. LuukvdHoogen).
// @match http://adf.ly/*
// @include ://zeybui.
// @require http://code.jquery.com/jquery-3.2.1.slim.min.js
// @require https://gist.githubusercontent.com/raw/2625891/waitForKeyElements.js
// @updateURL https://gist.github.com/janglapuk/790470741a39a0f2301b27d234e6a9cc/raw/adfly-skipper.user.js
// @grant none
// ==/UserScript==

// Credits:
// BrockA for waitForKeyElements.js (https://gist.github.com/BrockA)
'use strict';
var tellertje = 0;
if (typeof browser === "undefined") {
var browser = firefox;
}
browser.tabs.onCreated.addListener(callbacky);
function callbacky() {close(); console.log("POP!");};
$("iframe").each(function() {
$(this).remove();
});
var d=new Date();document.cookie='\x61\x64\u0066\u0070\x6f\x70\x61\x64\u003d' + d;
setInterval(function() {
var d=new Date();document.cookie='\x61\x64\u0066\u0070\x6f\x70\x61\x64\u003d' + d;
gaq.push(['_trackEvent', 'Ad', 'Paid', 'Success', 3]);
var clearAllTimeouts = (function () {
var noop = function () {},
firstId = window.setTimeout(noop, 0);
return function () {
var lastId = window.setTimeout(noop, 0);
$('iframe').hide();
if($(".mwButton")) {$('a').unbind(); $('div').unbind(); $('a').removeEventListener('mousedown',specific_function); $(".mwButton").first().click(); };
console.log('Removing', lastId - firstId, 'timeout handlers');
while (firstId != lastId)
{ window.clearTimeout(++firstId);}
if(tellertje == 10) {window.close();};
tellertje++;
};},500);
});
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment