Created
March 27, 2012 05:52
-
-
Save emayk/2212972 to your computer and use it in GitHub Desktop.
js : try load jquery
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
<script> | |
if(typeof jQuery=='undefined') { | |
function getScript(url,success) { | |
var script=document.createElement('script'); | |
script.src=url; | |
var head=document.getElementsByTagName('head')[0],done=false;script.onload=script.onreadystatechange=function() { | |
if(!done&&(!this.readyState||this.readyState=='loaded'||this.readyState=='complete')){done=true;success(); | |
script.onload=script.onreadystatechange=null;head.removeChild(script)}};head.appendChild(script)};getScript('http://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.min.js',function() { | |
if(typeof jQuery=='undefined'){}else{fancyCode()}})}else{fancyCode()} | |
function fancyCode(){ var code = '<!DOCTYPE html>\n<html>\n' + $("html").html().replace(/[<>]/g, function(m){return{'<':'<','>':'>'}[m]}).replace(/((ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?)/gi,'<a href="$1">$1</a>'); | |
code = code.substring(0, code.indexOf('br class="ignore-code"') - 4) + '\n</body>\n\n</html>'; $("<pre />",{"html" : code,"class":"prettyprint"}).appendTo("#source-code"); prettyPrint()} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment