Difference between revisions of "User:Kirb/skin.js"

From The iPhone Wiki
Jump to: navigation, search
(whoopsies)
m (im not thinking.)
Line 19: Line 19:
 
var console="console" in window?console:{},_console=console,console.log=function(){
 
var console="console" in window?console:{},_console=console,console.log=function(){
 
arguments[0]="IW:Debug: "+arguments[0];
 
arguments[0]="IW:Debug: "+arguments[0];
return _console&&_console.log&&iphonewiki.debug?console.log.apply(this,arguments):false;
+
return _console&&_console.log&&iphonewiki.debug?_console.log.apply(this,arguments):false;
 
},console.warn=function(){
 
},console.warn=function(){
 
arguments[0]="IW:Warning: "+arguments[0];
 
arguments[0]="IW:Warning: "+arguments[0];
return console&&console.warn&&iphonewiki.debug?console.warn.apply(this,arguments):false;
+
return console&&console.warn&&iphonewiki.debug?_console.warn.apply(this,arguments):false;
 
},console.error=function(){
 
},console.error=function(){
 
arguments[0]="IW:Error: "+arguments[0];
 
arguments[0]="IW:Error: "+arguments[0];
return console&&console.error&&iphonewiki.debug?console.error.apply(this,arguments):false;
+
return console&&console.error&&iphonewiki.debug?_console.error.apply(this,arguments):false;
 
};
 
};
 
console.log("beta theme javascript loading");
 
console.log("beta theme javascript loading");

Revision as of 12:23, 7 January 2012

/* User:thekirbylover's JS for The iPhone Wiki; feel free to use any or all of this
 * To use on your own PC: install Greasemonkey (Tampermonkey or Blank Canvas on Chrome)
 * and add a script that loads on www.theiphonewiki.com and enter the following in the text box: 
 * importScript("User:thekirbylover/skin.js")
 */

// Default preferences - set yours in the userscript
window.iphonewiki={
    debug:true, // debug logging (can be overridden with debug=true in URL)
    ajax:true, // ajax interface
    share:true // share button
};

(function($){
    if((/(\?|\&)debug=true(\&|$)/gi).test(location.search)){
        iphonewiki.debug=true;
        console.log("IW:Debug: logging turned on via debug=true parameter");
    }
    var console="console" in window?console:{},_console=console,console.log=function(){
        arguments[0]="IW:Debug: "+arguments[0];
        return _console&&_console.log&&iphonewiki.debug?_console.log.apply(this,arguments):false;
    },console.warn=function(){
        arguments[0]="IW:Warning: "+arguments[0];
        return console&&console.warn&&iphonewiki.debug?_console.warn.apply(this,arguments):false;
    },console.error=function(){
        arguments[0]="IW:Error: "+arguments[0];
        return console&&console.error&&iphonewiki.debug?_console.error.apply(this,arguments):false;
    };
    console.log("beta theme javascript loading");
    if(iphonewiki.ajax){
        console.log("loading history.js");
        $.getScript("https://balupton.github.com/history.js/scripts/bundled/html4+html5/jquery.history.js",function(){
            $.getScript("https://raw.github.com/balupton/jquery-scrollto/master/scripts/jquery.scrollto.min.js",function(){
                $.getScript("https://raw.github.com/gist/854622/ajaxify-html5.js",function(){
                    console.log("history.js loaded");
                });
            });
        });
    }
    if(iphonewiki.share){
        console.log("loading share link");
        $("<li><a id=addthis_button class=addthis_button href='//www.addthis.com/bookmark.php?v=250&pub=kirbylover4000'>Bookmark and Share</a></li>").appendTo("#p-tb ul");
        $.getScript("http://s7.addthis.com/js/250/addthis_widget.js#pub=kirbylover4000");
        console.log("share link loaded");
    }
})(jQuery);