Bp/quote handling
Discuss0
35,785pages on
this wiki
this wiki
< User:Bp
...
Contents |
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);