Skip to content

Instantly share code, notes, and snippets.

@Dykam
Created January 3, 2012 00:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Dykam/1552712 to your computer and use it in GitHub Desktop.
Save Dykam/1552712 to your computer and use it in GitHub Desktop.
Script to remove all apps from https://www.facebook.com/settings?tab=applications Compressed url form below, ready for pasting.
// ==ClosureCompiler==
// @output_file_name default.js
// @compilation_level ADVANCED_OPTIMIZATIONS
// ==/ClosureCompiler==
(function () {
var el = document.createElement('div'),
b = document.getElementsByTagName('body')[0];
otherlib = false, msg = '';
el.style.position = 'fixed';
el.style.height = '32px';
el.style.width = '220px';
el.style.marginLeft = '-110px';
el.style.top = '0';
el.style.left = '50%';
el.style.padding = '5px 10px';
el.style.zIndex = 1001;
el.style.fontSize = '12px';
el.style.color = '#222';
el.style.backgroundColor = '#f99';
if (typeof jQuery != 'undefined') {
msg = 'This page already using jQuery v' + jQuery.fn.jquery;
return showMsg();
} else if (typeof $ == 'function') {
otherlib = true;
}
function getScript(url, success) {
var script = document.createElement('script');
script.src = url;
var head = document.getElementsByTagName('head')[0],
done = false;
script.onload = script.onreadystatechange = function () {
if (!done && (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete')) {
done = true;
success();
script.onload = script.onreadystatechange = null;
head.removeChild(script);
}
};
head.appendChild(script);
}
getScript('http://code.jquery.com/jquery-latest.min.js', function () {
if (typeof jQuery == 'undefined') {
msg = 'Sorry, but jQuery wasn\'t able to load';
} else {
msg = 'This page is now jQuerified with v' + jQuery.fn.jquery;
if (otherlib) {
msg += ' and noConflict(). Use $jq(), not $().';
}
}
return showMsg();
});
function showMsg() {
el.innerHTML = msg;
b.appendChild(el);
window.setTimeout(function () {
if (typeof jQuery == 'undefined') {
b.removeChild(el);
} else {
jQuery(el).fadeOut('slow', function () {
jQuery(this).remove();
});
if (otherlib) {
$jq = jQuery.noConflict();
}
}
}, 2500);
}
var delay = 10;
var del1 = function() {
var x = $jq("label.fbSettingsListItemDelete.uiCloseButton.uiCloseButtonSmall input[title=Remove]").last();
if(!x.length) { return; }
x.click();
setTimeout(del2, delay);
}
var del2 = function() {
var button = $jq("input[name=remove][value=Remove]:visible");
if(button.length) {
button.click();
setTimeout(del3, delay);
} else {
setTimeout(del2, delay);
}
}
var del3 = function() {
var button = $jq("input[name=ok][value=OK]:visible");
if(button.length) {
button.click();
setTimeout(del1, delay);
} else {
setTimeout(del3, delay);
}
}
del1();
})();
javascript:(function(){function e(){var a=$jq("input[name=ok][value=OK]:visible");a.length?(a.click(),setTimeout(c,10)):setTimeout(e,10)}function d(){var a=$jq("input[name=remove][value=Remove]:visible");a.length?(a.click(),setTimeout(e,10)):setTimeout(d,10)}function c(){var a=$jq("label.fbSettingsListItemDelete.uiCloseButton.uiCloseButtonSmall input[title=Remove]").d();a.length&&(a.click(),setTimeout(d,10))}function f(){a.innerHTML=msg;g.appendChild(a);window.setTimeout(function(){"undefined"==typeof jQuery?
g.removeChild(a):(jQuery(a).c("slow",function(){jQuery(this).remove()}),otherlib&&($jq=jQuery.e()))},2500)}var a=document.createElement("div"),g=document.getElementsByTagName("body")[0];otherlib=!1;msg="";a.style.position="fixed";a.style.height="32px";a.style.width="220px";a.style.marginLeft="-110px";a.style.top="0";a.style.left="50%";a.style.padding="5px 10px";a.style.zIndex=1001;a.style.fontSize="12px";a.style.color="#222";a.style.backgroundColor="#f99";if("undefined"!=typeof jQuery)return msg=
"This page already using jQuery v"+jQuery.a.b,f();"function"==typeof $&&(otherlib=!0);(function(a,e){var b=document.createElement("script");b.src=a;var c=document.getElementsByTagName("head")[0],d=!1;b.onload=b.onreadystatechange=function(){if(!d&&(!this.readyState||"loaded"==this.readyState||"complete"==this.readyState))d=!0,e(),b.onload=b.onreadystatechange=null,c.removeChild(b)};c.appendChild(b)})("http://code.jquery.com/jquery-latest.min.js",function(){"undefined"==typeof jQuery?msg="Sorry, but jQuery wasn't able to load":
(msg="This page is now jQuerified with v"+jQuery.a.b,otherlib&&(msg+=" and noConflict(). Use $jq(), not $()."));return f()});c()})();
javascript:(function(){function e(){var a=$jq("input[name=ok][value=OK]:visible");a.length?(a.click(),setTimeout(c,10)):setTimeout(e,10)}function d(){var a=$jq("input[name=remove][value=Remove]:visible");a.length?(a.click(),setTimeout(e,10)):setTimeout(d,10)}function c(){var a=$jq("label.fbSettingsListItemDelete.uiCloseButton.uiCloseButtonSmall input[title=Remove]").d();a.length&&(a.click(),setTimeout(d,10))}function f(){a.innerHTML=msg;g.appendChild(a);window.setTimeout(function(){"undefined"==typeof jQuery?
g.removeChild(a):(jQuery(a).c("slow",function(){jQuery(this).remove()}),otherlib&&($jq=jQuery.e()))},2500)}var a=document.createElement("div"),g=document.getElementsByTagName("body")[0];otherlib=!1;msg="";a.style.position="fixed";a.style.height="32px";a.style.width="220px";a.style.marginLeft="-110px";a.style.top="0";a.style.left="50%";a.style.padding="5px 10px";a.style.zIndex=1001;a.style.fontSize="12px";a.style.color="#222";a.style.backgroundColor="#f99";if("undefined"!=typeof jQuery)return msg=
"This page already using jQuery v"+jQuery.a.b,f();"function"==typeof $&&(otherlib=!0);(function(a,e){var b=document.createElement("script");b.src=a;var c=document.getElementsByTagName("head")[0],d=!1;b.onload=b.onreadystatechange=function(){if(!d&&(!this.readyState||"loaded"==this.readyState||"complete"==this.readyState))d=!0,e(),b.onload=b.onreadystatechange=null,c.removeChild(b)};c.appendChild(b)})("http://code.jquery.com/jquery-latest.min.js",function(){"undefined"==typeof jQuery?msg="Sorry, but jQuery wasn't able to load":
(msg="This page is now jQuerified with v"+jQuery.a.b,otherlib&&(msg+=" and noConflict(). Use $jq(), not $()."));return f()});c()})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment