Last active
December 11, 2015 21:38
-
-
Save ggshily/4663477 to your computer and use it in GitHub Desktop.
redirect the content to github in cnblogs
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
//console.log("hello") | |
if(document.getElementById("cnblogs_post_body") != null) | |
{ | |
var content = document.getElementById("cnblogs_post_body").textContent; | |
console.log(content); | |
if(content.indexOf("https://gist") == 0) | |
{ | |
var xhr = new XMLHttpRequest(); | |
xhr.open("GET", content, true); | |
xhr.onreadystatechange = function() { | |
if (xhr.readyState == 4) { | |
console.log("content:" + xhr.responseText); | |
document.getElementById("cnblogs_post_body").innerHTML = xhr.responseText; | |
} | |
} | |
xhr.send(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment