Yves_W / RedditClickBoxFix

// ==UserScript==
// @name           RedditClickBoxFix
// @namespace      yveswscripts
// @description    Fix that I quickly made to get out of this Reddit ClickBox beta test
// @author         Yves W
// @version        0.1.3.2
// @copyright      2016+, Yves W (openuserjs.org/users/Yves_W)
// @license      MIT
// @homepageURL    https://openuserjs.org/scripts/Yves_W/RedditClickBoxFix
// @supportURL     https://github.com/YvesW
// @updateURL      https://openuserjs.org/meta/Yves_W/RedditClickBoxFix.meta.js
// @downloadURL    https://openuserjs.org/install/Yves_W/RedditClickBoxFix.user.js
// @include        *www.reddit.com/*
// @require        http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// @run-at         document-start
// ==/UserScript==


window.addEventListener('DOMContentLoaded', function(e) {
    if ($('body.listing-page.loggedin').length){
    if ($('div.expand-media').length){
    $('div.expand-media').contents().unwrap();
    }
    else {
alert("The A/B testing has probably ended for you, or you're using a different account! You should now disable the RedditClickBoxFix userscript for a possible performance improvement or to prevent an interaction with for example RES. This message box is probably quite obnoxious, but I really want you guys to experience reddit the best way possible, which means disabling this script if the A/B testing has ended and I can't do that via the script AFAIK ;). If you need further help, if you want to comment on this or if this message pops up while you're still in this beta, contact me via GH. Tampermonkey (Chrome): Click on the Tampermonkey icon > Dashboard > Click on the slider before RedditClickBoxFix to disable the userscript. Greasemonkey (Firefox): Extra > Add-ons > Userscripts > RedditClickBoxFix > Disable.");
    }
    }
    window.removeEventListener(e.type, arguments.callee, true);
}, true);


window.addEventListener('load', function() {
    if ($('body.listing-page.loggedin').length){
    if ($('#progressIndicator').length){
window.setInterval(function(){
    if ($('div.expand-media').length){
    $('div.expand-media').contents().unwrap();
    }
}, 1000);
    }
    }
}, false);