ProxyFiend / ProxyFiendLib

/*
 *  ProxyFiendLib
 *
 *  Written primarily by ProxyFiend for his own user scripts.
 */

var GM_getJSON = function (data) {
    GM_xmlhttpRequest({
        method: "GET",
        url: data.url + "?" + jQuery.param(data.data),
        onload: function (resp) {
            data.onload(JSON.parse(resp.responseText), resp);
        }
    });
};

var GM_debug = function (prefix, message) {
    console.debug("[" + prefix + "] " + message);
};

/**
 * Creates and writes an element for the specified stylesheet.
 *
 * @param url The URL/URI for the said stylesheet.
 */
var GM_css = function (url) {
    var styleElem = document.createElement("link");
    styleElem.setAttribute("type", "text/css");
    styleElem.setAttribute("rel", "stylesheet");
    styleElem.setAttribute("href", url);
    document.head.appendChild(styleElem);
};

var GM_script = function(url) {
    var scriptElem = document.createElement("script");
    scriptElem.setAttribute("src", url);
    document.head.appendChild(scriptElem);
};