User:Kirb/skin.js

From The iPhone Wiki
< User:Kirb
Revision as of 10:12, 7 January 2012 by Kirb (talk | contribs) (a base javascript to add some extra functionality)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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");
    }
    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);