User:Kirb/skin.js

From The iPhone Wiki
< User:Kirb
Revision as of 12:23, 7 January 2012 by Kirb (talk | contribs) (im not thinking.)
Jump to: navigation, search

Note: After saving, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
/* 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);