Skip to content

Instantly share code, notes, and snippets.

@ggshily
Last active December 11, 2015 21:38
Show Gist options
  • Save ggshily/4663477 to your computer and use it in GitHub Desktop.
Save ggshily/4663477 to your computer and use it in GitHub Desktop.
redirect the content to github in cnblogs
//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