UD Same Character Highlighter

Mousing over a character link highlights all instances of that link

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

Advertisement:

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

Advertisement:

// ==UserScript==
// @name		UD Same Character Highlighter
// @namespace		http://www.aichon.com
// @description		Mousing over a character link highlights all instances of that link
// @include		http://urbandead.com/map.cgi*
// @include		http://www.urbandead.com/map.cgi*
// @exclude		http://urbandead.com/map.cgi?logout
// @exclude		http://www.urbandead.com/map.cgi?logout
// @version 0.0.1.20210919202133
// ==/UserScript==

/* Urban Dead Same Character Highlighter
 * v1.0.2
 *
 * Copyright (C) 2009 Bradley Sattem
 * Author: Bradley Sattem (a.k.a. Aichon)
 * Last Modified: 2009-10-30
 * 
 * Tested under: Safari 4.0.3 on Mac
 *   
 * Contact: [my first name [DOT] my last name]@gmail.com (check the Copyright info for my name)
 *
 * Changes:
 *   v1.0.3 - Fixed a small bug introduced by 1.0.2
 *   v1.0.2 - Made it more careful about which links it attaches to (created an error with Barrista)
 *   v1.0.1 - Initial public release
 *
 */


addHighlight();

function addHighlight() {
	var links = document.evaluate("//a[contains(@href, 'profile.cgi?id')]", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);

	for(var i = 0; i < links.snapshotLength; i++) {
		var id = getProfileID(links.snapshotItem(i));

		links.snapshotItem(i).setAttribute("onmouseover","toggleHighlight(" + id + ")");
		links.snapshotItem(i).setAttribute("onmouseout","toggleHighlight(" + id + ")");
	}
}

function getProfileID(link) {
	return link.href.substr(link.href.indexOf("=") + 1);
}

toggleHighlight = function(id) {
	var charLinks = document.evaluate("//a[contains(@href, 'profile.cgi?id=" + id + "')]", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);

	for(var i = 0; i < charLinks.snapshotLength; i++) {
		if(charLinks.snapshotItem(i).style.textDecoration == "underline") charLinks.snapshotItem(i).style.textDecoration = "none";
		else charLinks.snapshotItem(i).style.textDecoration = "underline";
	}
}