User:Garthwebb/global.js

(function(window,$) { var btn = $('Trace');  btn.click(function{ var run = function { window.TraceViewer.openFromDom; };   var poll = function { if ( window.TraceViewer ) { run; } else { setTimeout(poll,500); }   };    if ( window.TraceViewer ) { run; } else { var script = document.createElement('script'); script.src = "http://community.garth.wikia-dev.com/__load/-/debug%3Dtrue%26lang%3Den%26skin%3Doasis/wikia.ext.traceviewer"; script.type = "text/javascript"; $('head') .append(script); poll; } });  $('body').append(btn); })(this,jQuery);