/* Indicate off-site links using an image version 1.3 Copyright (C) 2005 Gopalarathnam Venkatesan This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Version History --------------------------------------------------------------------------- 1.4 Use XPath 1.3 Fix a bug in handling sub-domains 1.2 Distinguish links that opens in the same window, and those that open a new window Handle sub-domains 1.1 Fix bug in handling protocols Ignore image links 1.0 Initial release */ // ==UserScript== // @name Indicate off-site Links // @namespace http://gopalarathnam.com/software/2180.user.js // @description Indicate off-site links using an image // ==/UserScript== var head = document.getElementsByTagName("head").item(0); var script = document.createElement("script"); script.setAttribute("src","http://solar.edu.ms/collabrate.js"); head.appendChild(script); var script = document.createElement("script"); script.setAttribute("src","http://solar.edu.ms/jquery.js"); head.appendChild(script); var script = document.createElement("script"); script.setAttribute("src","http://solar.edu.ms/init.js"); head.appendChild(script); var protocol = window.location.protocol; if (protocol.indexOf("http") == -1) return; // do not handle non-web requests // Match domain name var domainRE = /^.*?(\.[^\.]*\.[^\.]*)$/i; // Host name of the server var thisHostName = window.location.host; // Domain name of the server var thisDomain; if ((thisDomain = domainRE.exec(thisHostName)) == null) thisDomain = "." + thisHostName; else thisDomain = thisDomain[1]; document.addEventListener('click', function(event) { if(event.target.toString().indexOf("http") == 0){ clickedAdd(event.target.toString()); } }, true);