Skip to content

Instantly share code, notes, and snippets.

@mcfearsome
Created July 27, 2008 16:11
Show Gist options
  • Save mcfearsome/2783 to your computer and use it in GitHub Desktop.
Save mcfearsome/2783 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name bitlyUI
// @namespace http://fluidapp.com
// @description What does this do?
// @include *
// @author Someone
// ==/UserScript==
//
// GreaseKit friendly
//
if(typeof GM_xmlhttpRequest === "undefined") {
GM_xmlhttpRequest = function(/* object */ details) {
details.method = details.method.toUpperCase() || "GET";
if(!details.url) {
throw("GM_xmlhttpRequest requires an URL.");
return;
}
// build XMLHttpRequest object
var oXhr, aAjaxes = [];
if(typeof ActiveXObject !== "undefined") {
var oCls = ActiveXObject;
aAjaxes[aAjaxes.length] = {cls:oCls, arg:"Microsoft.XMLHTTP"};
aAjaxes[aAjaxes.length] = {cls:oCls, arg:"Msxml2.XMLHTTP"};
aAjaxes[aAjaxes.length] = {cls:oCls, arg:"Msxml2.XMLHTTP.3.0"};
}
if(typeof XMLHttpRequest !== "undefined")
aAjaxes[aAjaxes.length] = {cls:XMLHttpRequest, arg:undefined};
for(var i=aAjaxes.length; i--; )
try{
oXhr = new aAjaxes[i].cls(aAjaxes[i].arg);
if(oXhr) break;
} catch(e) {}
// run it
if(oXhr) {
if("onreadystatechange" in details)
oXhr.onreadystatechange = function() { details.onreadystatechange(oXhr) };
if("onload" in details)
oXhr.onload = function() { details.onload(oXhr) };
if("onerror" in details)
oXhr.onerror = function() { details.onerror(oXhr) };
oXhr.open(details.method, details.url, true);
if("headers" in details)
for(var header in details.headers)
oXhr.setRequestHeader(header, details.headers[header]);
if("data" in details)
oXhr.send(details.data);
else
oXhr.send();
} else
throw ("This Browser is not supported, please upgrade.")
}
}
if(typeof GM_addStyle === "undefined") {
function GM_addStyle(/* String */ styles) {
var oStyle = document.createElement("style");
oStyle.setAttribute("type", "text\/css");
oStyle.appendChild(document.createTextNode(styles));
document.getElementsByTagName("head")[0].appendChild(oStyle);
}
}
if(typeof GM_log === "undefined") {
function GM_log(log) {
if(console)
console.log(log);
else
alert(log);
}
}
(function () {
if (window.fluid) {
var entryBox = document.getElementById("entry_box");
var entryBoxClone = entryBox.cloneNode(true);
var historyContainer = document.getElementById("history");
var historyContainerClone = historyContainer.cloneNode(true);
var resultsContainer = document.getElementById("results");
var resultsContainerClone = resultsContainer.cloneNode(true);
var tables = document.getElementsByTagName("table");
if (tables.length) {
// tables[0].style.display = "none";
tables[0].parentNode.removeChild(tables[0]);
}
document.getElementById("footer").style.display = "none";
document.getElementById("blowfish").style.display = "none";
document.getElementById("logo_txt").style.display = "none";
$A(document.getElementsByTagName("br")).each(function(item) {
item.style.height = "0px";
})
document.body.appendChild(entryBoxClone);
document.body.appendChild(resultsContainerClone);
document.body.appendChild(historyContainerClone);
var addlink = document.getElementById("addLinkTxt");
var addlinkform = document.getElementById("addLinkForm");
addlink.href = "#";
console.log(addlink);
addlink.onclick = function(evt) {
console.log(addlinkform.style.display);
if(addlinkform.style.display == "none") {
addlinkform.style.display = "block";
} else {
addlinkform.style.display = "none";
document.getElementById("alias").value = "";
}
}
// document.body.styl÷e.display = "block";
$("shorten").onclick = function() {
var url = $("url").value;
var alias = $("alias").value;
compress(url, alias);
}
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment