NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name 复制 博客园(私人用) // @namespace http://tampermonkey.net/ // @version 0.1 // @description 复制dom节点,提交到博客 // @author edwin // @license MIT // @match https://www.cnblogs.com/* // @require https://unpkg.com/jquery@3.3.1/dist/jquery.min.js // @grant none // ==/UserScript== (function () { 'use strict'; let parent = document.querySelector("#navigator .blogStats"); var html = "<textarea id=\"textcopy\" style=\"margin: 0px; width: 0px; height: 0px;\"></textarea><input type='submit' class='mycopy' onclick='var Url2=document.getElementById(\"cnblogs_post_body\");var clickContent = Url2.innerHTML;console.log(clickContent);var inputElement = document.getElementById(\"textcopy\");inputElement.value = clickContent;inputElement.select();document.execCommand(\"Copy\");window.open(\"https://zshipu.com/2md/\");' value='拷贝' style='display:inline-block;line-height:1.5;background:#2866bd;color:#fff;font-weight:700;text-align:center;padding:6px;border:2px solid #E5E5E5;'/>" let userAdiv = document.createElement("div"); userAdiv.innerHTML = html; parent.insertBefore(userAdiv, parent.childNodes[0]); // Your code here... function copyopen() { var Url2 = document.getElementById("article_content"); var clickContent = Url2.innerHTML; var inputElement = document.getElementById("textcopy"); inputElement.value = clickContent; inputElement.select(); document.execCommand("Copy"); window.open("https://zshipu.com/2md/"); } })();