// ==UserScript== // @name RefLinkGenerator // @name:en-us RefLinkGenerator // @name:zh-cn 引用链接生成器 // @namespace http://www.joshuazhang.net // @version 1.3 // @description:en-us Generate reference link in all kinds of markup languages like html, markdown etc and copy to system clipboard. // @description:zh-cn 提取网页标题和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 // @run-at document-end // @noframes // @description Generate reference link in all kinds of markup languages like html, markdown etc and copy to system clipboard. // @downloadURL https://update.greasyfork.icu/scripts/11800/RefLinkGenerator.user.js // @updateURL https://update.greasyfork.icu/scripts/11800/RefLinkGenerator.meta.js // ==/UserScript== /* Tampermonkey reference -> https://tampermonkey.net/documentation.php 1. @noframes tag will prevent this script run inside iframe 2. GM_log is not very user friendly, use console.log instead See:console.log is not working when used in a Firefox, Greasemonkey script - Stack Overflow -> https://stackoverflow.com/questions/10135241/console-log-is-not-working-when-used-in-a-firefox-greasemonkey-script */ /* Add rlg-panel styles https://stackoverflow.com/a/707580/2709868 Just some basic style, mostly the panel style will 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); rlg_log("rlg-panel css loaded"); /* Retrieve page url and page title Page title is automatically acquired following order as such: 1.