Wikia

Memory Alpha

Bp/quote handling

Discuss0
36,873pages on
this wiki

< User:Bp

Revision as of 17:16, October 30, 2006 by Bp (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

...

Usage Edit

The template usage information is at User:Bp/Tquote.

For the user:monobook.js options:

explicitQuotes = n;

Where n can be:

  • 0 - never show speaker labels
  • 1 - mouse over to show speaker labels
  • 2 - always show speaker labels

Source Edit

Versions Edit

  • first release

CSS Edit

.dialogue {margin-left:20px;}	
.dialogue-inside {border-left:5px solid #434343; padding-left:5px;}	
.dialogue-inside-highlight {border-left:5px solid #434343; padding-left:5px;}	
.dialogue-attribution {margin-left:40px;}	
.quoteline {line-height:1.7; font-size:116%;}	
.quoteline-action {margin-left:20px; line-height:1.7;}	
.speaker-label {font-family: monospace; font-style: normal; color: #FFCC00;}

JS Edit

function speakerLabel(text) {
	var spkr = document.createElement('span');
	spkr.innerHTML = text + ": ";
	spkr.className = "speaker-label";
	return spkr;
}

function explicitQuoteOn(event, e) {
	var si = (e) ? e.firstChild : this.firstChild;
	while(si) {
		explicitQuoteOn(event, si);
		if (si.className == "dialogue-inside") {
			si.className = "dialogue-inside-highlight";
		} else if (si.className == "quoteline") {
			if (si.childNodes[0].className != "speaker-label") {
				if (si.title != '') {
					si.insertBefore(speakerLabel(si.title), si.childNodes[0]);
					si.title = '';
				}
			}
			if (si.childNodes[0].className == "speaker-label") {
				si.childNodes[0].style.display = "inline";
			}
		}
		si = si = si.nextSibling;
	}
}

function explicitQuoteOff(event, e) {
	var si = (e) ? e.firstChild : this.firstChild;
	while(si) {
		explicitQuoteOff(event, si);
		if (si.className == "dialogue-inside-highlight") {
			si.className = "dialogue-inside";
		} else if (si.className == "quoteline") {
			if (si.childNodes[0].className == "speaker-label") {
				si.childNodes[0].style.display = "none";
			}
		}
		si = si = si.nextSibling;
	}
}

var explicitQuotes = 1;

function doQuotes() {
	if (!explicitQuotes) { return; }

	var dumbevent;
	var divs = document.getElementsByTagName("div");
	for (var i = 0; i < divs.length; i++) {
		if (divs[i].className == 'dialogue') {
			if (explicitQuotes == 1) {
				divs[i].onmouseover = explicitQuoteOn;
				divs[i].onmouseout = explicitQuoteOff;
			} else {
				explicitQuoteOn(dumbevent, divs[i]);
			}
		}
	}
}

hookEvent("load", doQuotes);

Around Wikia's network

Random Wiki