// ==UserScript== // @name RefLinkGenerator // @name:zh 引用链接生成器 // @namespace http://www.joshuazhang.net // @version 1.1.1 // @description Generate reference link in all kinds of markup languages like html, markdown etc and copy to system clipboard. // @description:zh 提取网页标题和URL,快捷生成各类标记语言引用链接文本并复制到系统剪贴板 // @homepageURL https://coding.net/u/joshz/p/RefLinkGenerator/git // @supportURL https://coding.net/u/joshz/p/RefLinkGenerator/topic/all // @require https://code.jquery.com/jquery-1.11.3.min.js // @include http://* // @include https://* // @author joshz // @grant GM_addStyle // @grant GM_log // @run-at document-end // @downloadURL none // ==/UserScript== var DEBUG = true; /* Add rlg-panel styles https://stackoverflow.com/a/707580/2709868 TODO More style attrs need to be assigned, since they always inherit from current page. */ var style ="#rlg-panel {display:inline-block;position:fixed;top:10%;left:0;z-index:2147483647;background:#111;color:#fff;overflow:hidden;} \ #rlg-panel input{color:#111;margin:2px 8px 2px 8px;border-width:2px;border-color:#32cd32} \ #rlg-panel a{color:#fff;font-size:14px;text-decoration:none;border-style:solid;border-width:1px;border-color:#32cd32} \ #rlg-panel div{white-space:nowrap;margin:2px 10px 2px 10px;}"; // CSS to be added GM_addStyle(style); /* Retrieve page url and page title */ var page_url = window.location.href; // Obtain absolute URL of current page if (DEBUG) {GM_log('page_url=> ' + page_url);} var page_title; try { var tag_content_title = document.getElementsByTagName('title')[0].innerHTML; } catch(err) { GM_log("Fail to get tag