Created
December 31, 2012 21:40
-
-
Save anonymous/4422944 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function addJQuery(callback) { | |
var script = document.createElement("script"); | |
script.setAttribute("src", "//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"); | |
script.addEventListener('load', function() { | |
var script = document.createElement("script"); | |
script.textContent = "(" + callback.toString() + ")();"; | |
document.body.appendChild(script); | |
}, false); | |
document.body.appendChild(script); | |
} | |
addJQuery(function(){ | |
$(document).ready(function(){ | |
var $ = jQuery; | |
$.noConflict(); | |
function addButton(selector, callback){ | |
if ($('#djs-tray').length == 0){ | |
var wrap = $(document.createElement("div")); | |
wrap.attr('id', 'djs-tray'); | |
wrap.css({ | |
background: '#ddd', | |
padding: '10px', | |
margin: '10px 5px -10px', | |
borderRadius: '3px' | |
}); | |
wrap.insertBefore(selector); | |
}else{ var wrap = $('#djs-tray')} | |
var btn = $(document.createElement('button')); | |
btn.text('Filter'); | |
btn.bind('click', callback); | |
wrap.prepend(btn); | |
} | |
function clean(i, callback){ | |
if (typeof(i) == undefined){ i = 5 }; | |
if (i == 0){ callback(); return; } | |
$('.match_row').each(function(){ | |
if ($("img[title='IM']", this).length < 1){ $(this).remove(); } | |
}); | |
window.scrollBy(0,-100); | |
setTimeout(function(){ | |
window.scrollBy(0,5000); | |
clean(i-1, callback); | |
}, 500); | |
} | |
if ($('#match_results').length){ | |
addButton('#match_results', function(){ | |
clean(10, function(){ | |
window.scrollBy(0,-5000); | |
}); | |
}); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment