BlueCat Address Manager Generate Links

Generate Links from Text in table cells in BlueCat Address Manager

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name        BlueCat Address Manager Generate Links
// @namespace   *
// @description Generate Links from Text in table cells in BlueCat Address Manager
// @include     */app*
// @version     4
// @grant       none
// @author      Marius Galm
// @copyright   2019, Marius Galm
// @license	MIT
// @icon        https://www.bluecatnetworks.com/wp-content/uploads/2018/03/cropped-bluecat-favicon-32x32.png
// @require     http://code.jquery.com/jquery-latest.min.js
// @require https://greasyfork.org/scripts/376375-anchorme/code/Anchorme.js?version=659847
// ==/UserScript==

var pattern = /^(https?:\/\/|ftps?:\/\/)?([a-z0-9%\-]+\.){1,}([a-z0-9\-]+)?(:(\d{1,5}))?(\/([a-z0-9\-._~:\/\?#\[\]@!$&'\(\)\*\+,;=%]+)?)?$/i;
if (document.readyState === "interactive" ) {
	$("#outerTable tr td").not(':first').hover(
		function () {
            //console.log($(this)[0].getElementsByTagName("span")[0]);
			if ($(this)[0].getElementsByTagName("span")[0] != null) {
				if ($(this)[0].getElementsByTagName("span")[0].innerHTML.trim() !== "") {
					var str = $(this)[0].getElementsByTagName("span")[0].innerHTML.trim();
					if ( str.match(pattern) ) {
			                	//console.log("found string to link");
						$(this)[0].getElementsByTagName("span")[0].innerHTML = anchorme(str, {attributes:[ { name:"target", value:"_blank" } ] } );
					}
				}
			}
		}
	);
}