真正CSDN博客文章一键转载插件(含源码)
生活随笔
收集整理的這篇文章主要介紹了
真正CSDN博客文章一键转载插件(含源码)
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
插件地址:https://greasyfork.org/zh-CN/scripts/381053-csdn%E5%8D%9A%E5%AE%A2%E6%96%87%E7%AB%A0%E8%BD%AC%E8%BD%BD%E6%8F%92%E4%BB%B6
插件安裝使用說明請參閱:https://greasyfork.org/zh-CN
文章閱讀界面
?文章發(fā)布頁面
?
源代碼
// ==UserScript== // @name CSDN博客文章一鍵轉(zhuǎn)載插件 // @version 0.4 // @description CSDN博客文章轉(zhuǎn)載插件 可以實現(xiàn)CSDN上的文章一鍵轉(zhuǎn)載 // @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 = '轉(zhuǎn)載';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 //文章發(fā)布窗口{document.onreadystatechange = function(e) {if (document.readyState == 'complete') {setTimeout(function() {var blogContent = window.opener.document.getElementById('content_views').innerHTML + "<br>---------------------"?+ "<br>作者:" + window.opener.document.getElementsByClassName('follow-nickName')[0].innerHTML? + "<br>來源:CSDN"? + "<br>原文:" + window.opener.location.href? + "<br>版權(quán)聲明:本文為博主原創(chuàng)文章,轉(zhuǎn)載請附上博文鏈接!"document.getElementById('txtTitle').value = window.opener.document.getElementsByClassName('title-article')[0].innerHTML;document.getElementsByTagName("iframe")[0].contentDocument.body.innerHTML = blogContent;},1000);}}}})();?
總結(jié)
以上是生活随笔為你收集整理的真正CSDN博客文章一键转载插件(含源码)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 架构师必须知道的架构设计原则
- 下一篇: js 通过jquery插件获取url参数