Text To link mod was reported 2021-06-10 by msoop as an unauthorized copy of Text To link.

Text To link uses the AGPL license. Visit tldrlegal.com for help understanding what this license means.

msoop said:
Script License Created Updated
Reported Text To link mod N/A 2016-09-02 05:30:28 UTC 2016-10-01 05:31:58 UTC
Original Text To link AGPL 2014-04-07 08:49:26 UTC 2020-10-10 03:08:24 UTC
  • // ==UserScript==
  • -// @name Text To link
  • -// @description Turn plain text URLs into clickable links
  • -// @description:zh 把文字链接转换为可点击链接
  • +// @name Text To link mod
  • +// @description Turn plain text URLs into clickable links, 把文字链接转换为可点击链接
  • // @author lkytal
  • // @namespace Lkytal
  • -// @version 2.8.7
  • -// @homepage https://lkytal.github.io/
  • -// @homepageURL https://lkytal.github.io/GM
  • -// @license AGPL
  • -
  • +// @homepage http://lkytal.github.io/
  • // @include *
  • // @exclude *pan.baidu.com/*
  • // @exclude *renren.com/*
  • // @exclude *exhentai.org/*
  • // @exclude *music.google.com/*
  • -// @exclude *play.google.com/music/*
  • // @exclude *mail.google.com/*
  • // @exclude *docs.google.com/*
  • // @exclude *www.google.*
  • // @exclude *acid3.acidtests.org/*
  • +// @exclude http://space.bilibili.com*
  • // @exclude *.163.com/*
  • -// @exclude *.alipay.com/*
  • -// @run-at document-end
  • -// @icon https://github.com/lkytal/GM/raw/master/icons/link.png
  • +// @exclude https://travis-ci.org/*
  • +// @exclude https://github.com/*/blob/*
  • +// @exclude https://github.com/*/edit/*
  • +// @exclude https://github.com/*/new/*
  • +// @exclude https://github.com/*/pull/*
  • +// @version 2.7.6
  • +// @icon http://lkytal.qiniudn.com/ic.ico
  • // @grant unsafeWindow
  • -// @charset UTF-8
  • -// @supportURL https://github.com/lkytal/GM/issues
  • +// @homepageURL https://git.oschina.net/coldfire/GM
  • // @updateURL https://git.oschina.net/coldfire/GM/raw/master/meta/linkMix.meta.js
  • // @downloadURL https://git.oschina.net/coldfire/GM/raw/master/linkMix.user.js
  • // ==/UserScript==
  • -"use strict";
  • -;
  • -var clearLink, excludedTags, linkFilter, linkMixInit, linkPack, linkify, observePage, observer, setLink, urlPrefixes, url_regexp, xPath;
  • +"use strict";
  • +var clearLink, excludedTags, filter, linkMixInit, linkPack, linkify, observePage, observer, setLink, url_regexp, xpath;
  • -url_regexp = /((https?:\/\/|www\.)[\x21-\x7e]+[\w\/=]|\w([\w._-])+@\w[\w\._-]+\.(com|cn|org|net|info|tv|cc|gov|edu)|(\w[\w._-]+\.(com|cn|org|net|info|tv|cc|gov|edu))(\/[\x21-\x7e]*[\w\/])?|ed2k:\/\/[\x21-\x7e]+\|\/|thunder:\/\/[\x21-\x7e]+=)/gi;
  • -
  • -urlPrefixes = ['http://', 'https://', 'ftp://', 'thunder://', 'ed2k://', 'mailto://', 'file://'];
  • -
  • +url_regexp = /((https?:\/\/|www\.)[\x21-\x7e]+[\w\/]|(\w[\w._-]+\.(com|cn|org|net|info|tv|cc))(\/[\x21-\x7e]*[\w\/])?|ed2k:\/\/[\x21-\x7e]+\|\/|thunder:\/\/[\x21-\x7e]+=)/gi;
  • clearLink = function (event) {
  • - var j, len, link, prefix, ref, ref1, url;
  • + var link, ref, url;
  • link = (ref = event.originalTarget) != null ? ref : event.target;
  • - if (!(link != null && link.localName === "a" && ((ref1 = link.className) != null ? ref1.indexOf("textToLink") : void 0) !== -1)) {
  • + if (!((link != null) && link.localName === "a" && link.className.indexOf("texttolink") !== -1)) {
  • return;
  • }
  • url = link.getAttribute("href");
  • - //console.log url
  • - for (j = 0, len = urlPrefixes.length; j < len; j++) {
  • - prefix = urlPrefixes[j];
  • - if (url.indexOf(prefix) === 0) {
  • - return;
  • - }
  • - }
  • - if (url.indexOf('@') !== -1) {
  • - return link.setAttribute("href", "mailto://" + url);
  • - } else {
  • + if (url.indexOf("http") !== 0 && url.indexOf("ed2k://") !== 0 && url.indexOf("thunder://") !== 0) {
  • return link.setAttribute("href", "http://" + url);
  • }
  • };
  • document.addEventListener("mouseover", clearLink);
  • setLink = function (candidate) {
  • - var ref, ref1, ref2, span, text;
  • - if (candidate == null || ((ref = candidate.parentNode) != null ? (ref1 = ref.className) != null ? typeof ref1.indexOf === "function" ? ref1.indexOf("textToLink") : void 0 : void 0 : void 0) !== -1 || candidate.nodeName === "#cdata-section") {
  • + var span, text;
  • + if ((candidate == null) || candidate.parentNode.className.indexOf("texttolink") !== -1 || candidate.nodeName === "#cdata-section") {
  • return;
  • }
  • - text = candidate.textContent.replace(url_regexp, '<a href="$1" target="_blank" class="textToLink">$1</a>');
  • - if (((ref2 = candidate.textContent) != null ? ref2.length : void 0) === text.length) {
  • + text = candidate.textContent.replace(url_regexp, '<a href="$1" target="_blank" class="texttolink">$1</a>');
  • + if (candidate.textContent.length === text.length) {
  • return;
  • }
  • span = document.createElement("span");
  • excludedTags = "a,svg,canvas,applet,input,button,area,pre,embed,frame,frameset,head,iframe,img,option,map,meta,noscript,object,script,style,textarea,code".split(",");
  • -xPath = `//text()[not(ancestor::${excludedTags.join(') and not(ancestor::')})]`;
  • +xpath = "//text()[not(ancestor::" + (excludedTags.join(') and not(ancestor::')) + ")]";
  • +
  • +filter = new RegExp("^(" + (excludedTags.join('|')) + ")$", "i");
  • linkPack = function (result, start) {
  • - var i, j, k, ref, ref1, ref2, ref3, startTime;
  • - startTime = Date.now();
  • - while (start + 10000 < result.snapshotLength) {
  • + var i, j, k, ref, ref1, ref2, ref3;
  • + if (start + 10000 < result.snapshotLength) {
  • for (i = j = ref = start, ref1 = start + 10000; ref <= ref1 ? j <= ref1 : j >= ref1; i = ref <= ref1 ? ++j : --j) {
  • setLink(result.snapshotItem(i));
  • }
  • - start += 10000;
  • - if (Date.now() - startTime > 2500) {
  • - return;
  • - }
  • - }
  • + setTimeout(function() {
  • + return linkPack(result, start + 10000);
  • + }, 15);
  • + } else {
  • for (i = k = ref2 = start, ref3 = result.snapshotLength; ref2 <= ref3 ? k <= ref3 : k >= ref3; i = ref2 <= ref3 ? ++k : --k) {
  • setLink(result.snapshotItem(i));
  • }
  • + }
  • };
  • -linkify = function (node) {
  • +linkify = function(doc) {
  • var result;
  • - result = document.evaluate(xPath, node, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
  • + result = document.evaluate(xpath, doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
  • return linkPack(result, 0);
  • };
  • -linkFilter = function (node) {
  • - var j, len, tag;
  • - for (j = 0, len = excludedTags.length; j < len; j++) {
  • - tag = excludedTags[j];
  • - if (tag === node.parentNode.localName.toLowerCase()) {
  • - return NodeFilter.FILTER_REJECT;
  • - }
  • - }
  • - return NodeFilter.FILTER_ACCEPT;
  • -};
  • -
  • observePage = function (root) {
  • var tW;
  • - tW = document.createTreeWalker(root, NodeFilter.SHOW_TEXT, { //+ NodeFilter.SHOW_ELEMENT,
  • - acceptNode: linkFilter
  • + tW = document.createTreeWalker(root, NodeFilter.SHOW_TEXT, {
  • + acceptNode: function(a) {
  • + if (!filter.test(a.parentNode.localName)) {
  • + return NodeFilter.FILTER_ACCEPT;
  • + }
  • + }
  • }, false);
  • while (tW.nextNode()) {
  • setLink(tW.currentNode);
  • if (window !== window.top || window.document.title === "") {
  • return;
  • }
  • - //console.time('a')
  • linkify(document.body);
  • - //console.timeEnd('a')
  • return observer.observe(document.body, {
  • childList: true,
  • subtree: true
  • });
  • };
  • +var clearlinkF=function(link) {
  • + url = link.getAttribute("href");
  • + if (url.indexOf("http") !== 0 && url.indexOf("ed2k://") !== 0 && url.indexOf("thunder://") !== 0) {
  • + return link.setAttribute("href", "http://" + url);
  • + }
  • +};
  • +var clearlinkE=function() {
  • + var a =document.getElementsByClassName('texttolink');
  • + for (var i=0;i<a.length;i++) clearlinkF(a[i]);
  • +};
  • +setTimeout(clearlinkE, 1500);
  • +
  • setTimeout(linkMixInit, 100);

This report has been upheld by a moderator.