-
-
Save fieldform/6179582 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Stuart Powers | |
write_window(document.activeElement.value); | |
function write_window(content) { | |
top.consoleRef=window.open('', | |
'git-r-done', | |
+',menubar=1' | |
+',toolbar=1' | |
+',status=1' | |
+',scrollbars=1' | |
+',resizable=1'); | |
top.consoleRef.document.writeln(content); | |
top.consoleRef.document.close(); | |
} | |
function dostuff() { | |
$.ajax({ | |
url: document.location.href, | |
dataType:'html', | |
success: function(content){ | |
setTimeout(function(){write_window(content)},500); | |
} | |
}); | |
} | |
function add_jquery(attempt) { | |
var jq=document.createElement('script'); | |
jq.type='text/javascript'; | |
jq.async=false; | |
jq.src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js'; | |
var s=document.getElementsByTagName('script')[0]; | |
s.parentNode.insertBefore(jq,s); | |
try | |
{ | |
var foo=$('*'); | |
dostuff(); | |
} | |
catch(err) | |
{ | |
if(attempt < 5) | |
{ | |
attempt = attempt + 1; | |
setTimeout("add_jquery("+attempt+")",1000) | |
} | |
else | |
{ | |
alert('could not load jquery..try again!'); | |
} | |
} | |
} | |
add_jquery(0); | |
// javascript:(function()%7Bwrite_window(document.activeElement.value);function%20write_window(content)%7Btop.consoleRef=window.open('','git-r-done',+',menubar=1'+',toolbar=1'+',status=1'+',scrollbars=1'+',resizable=1');top.consoleRef.document.writeln(content);top.consoleRef.document.close();%7Dfunction%20dostuff()%7B$.ajax(%7Burl:document.location.href,dataType:'html',success:function(content)%7BsetTimeout(function()%7Bwrite_window(content)%7D,500);%7D%7D);%7Dfunction%20add_jquery(attempt)%7Bvar%20jq=document.createElement('script');jq.type='text/javascript';jq.async=false;jq.src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js';var%20s=document.getElementsByTagName('script')%5B0%5D;s.parentNode.insertBefore(jq,s);try%7Bvar%20foo=$('*');dostuff();%7Dcatch(err)%7Bif(attempt%3C5)%7Battempt=attempt+1;setTimeout(%22add_jquery(%22+attempt+%22)%22,1000)%7Delse%7Balert('could%20not%20load%20jquery..try%20again!');%7D%7D%7Dadd_jquery(0);%7D)(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment