-
Notifications
You must be signed in to change notification settings - Fork 0
/
KickstarterReverseUpdates.user.js
46 lines (41 loc) · 1.39 KB
/
KickstarterReverseUpdates.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// ==UserScript==
// @name Kickstarter Reverse Updates
// @description Reverse the order of updates on Kickstarter projects, when called.
// @version 0.1.0
// @author TheQwerty
// @namespace https://github.com/TheQwerty/Misc-UserScripts/raw/master/
// @homepage https://github.com/TheQwerty/Misc-UserScripts
//
//
// @include http://www.kickstarter.com/projects/*/*/posts
// ==/UserScript==
(function() {
var $;
var jQuery;
//Add jQuery (if needed) and then execute callback.
function addJQuery(callback) {
if (typeof unsafeWindow.jQuery == 'undefined') {
//Add jQuery script node with callback on load.
var script = document.createElement("script");
script.setAttribute("src", "http://ajax.googleapis.com/ajax/libs/jquery/1.3/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);
} else {
//jQuery was already loaded so let's hijack it from unsafeWindow.
$ = unsafeWindow.jQuery.noConflict(true);
jQuery = $;
callback();
}
}
//Main execution function.
function main() {
$('#main').append($('.post').get().reverse());
}
GM_registerMenuCommand("Reverse Kickstarter Updates", function () {
addJQuery(main);
});
})();