CSDN博客文章转载插件 可以实现CSDN上的文章一键转载
当前为
// ==UserScript==
// @name CSDN博客文章转载插件
// @version 0.2
// @description CSDN博客文章转载插件 可以实现CSDN上的文章一键转载
// @author By Jackie http://csdn.admans.cn/
// @match *://blog.csdn.net/*/article/details/*
// @match *://mp.csdn.net/postedit*
// @grant GM_addStyle
// @namespace https://greasyfork.org/users/164689
// ==/UserScript==
GM_addStyle("#ReproduceBtn{position: absolute;float: right;right: 80px;width: auto;background: #0f962191;z-index: 99;color: white;text-align: center;margin: 5px;padding: 5px;border-radius: 5px;cursor: pointer;}");
document.domain="csdn.net";
(function(){
'use strict';
document.domain="csdn.net";
if(location.href.indexOf("article/details") > -1)
{
var divBtn = document.createElement("div");
divBtn.setAttribute("id", "ReproduceBtn");
divBtn.innerHTML ='转载';
var article=document.getElementsByClassName('article_content')[0];
article.insertBefore(divBtn,article.childNodes[0]);
var posteditUrl="https://mp.csdn.net/postedit";
divBtn.onclick=function()
{
window.open(posteditUrl);
}
}
else
{
document.onreadystatechange = function(e){
if(document.readyState == 'complete') {
setTimeout(function(){
document.getElementById('txtTitle').value=window.opener.document.getElementsByClassName('title-article')[0].innerHTML;
document.getElementsByTagName("iframe")[0].contentDocument.body.innerHTML=window.opener.document.getElementById('content_views').innerHTML;
},1000);
}
}
}
})();