The iPhone Wiki is no longer updated. Visit this article on The Apple Wiki for current information. |
Difference between revisions of "User:Kirb/skin.js"
(a base javascript to add some extra functionality) |
(whoopsies) |
||
Line 17: | Line 17: | ||
console.log("IW:Debug: logging turned on via debug=true parameter"); |
console.log("IW:Debug: logging turned on via debug=true parameter"); |
||
} |
} |
||
− | 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 |
+ | 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; |
Revision as of 10:18, 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);