MediaWiki:Imagemap-Hightlight.js: Unterschied zwischen den Versionen

Zur Navigation springen Zur Suche springen
Keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
 
(3 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 89: Zeile 89:
// massage the area "href" and create a human legible string to be used as the tooltip of "li"
// massage the area "href" and create a human legible string to be used as the tooltip of "li"
function pageOfHref(href, cssClass) {
function pageOfHref(href, cssClass) {
var page = href.replace(document.location.protocol + wgServer + "/wiki/", '').replace(/.*\/\//, '').replace(/_/g, ' ');
var page = href.replace(document.location.protocol + mw.config.get( 'wgServerName' ) + "/wiki/", '').replace(/.*\/\//, '').replace(/_/g, ' '); /*JSC 210819: veraltete Funktion ausgetauscht */
page = page.replace(/#(.*)/, function(toReplace){return toReplace.replace(/\.([\dA-F]{2})/g, '%$1');});
page = page.replace(/#(.*)/, function(toReplace){return toReplace.replace(/\.([\dA-F]{2})/g, '%$1');});
page = decodeURIComponent(page); // used for "title" of legends - just like "normal" wiki links.
page = decodeURIComponent(page); // used for "title" of legends - just like "normal" wiki links.
Zeile 98: Zeile 98:
   
   
function init() {
function init() {
appendCSS('li.' + myClassName + '{white-space:nowrap;}\n' + //css for li element
mw.util.addCSS('li.' + myClassName + '{white-space:nowrap;}\n' + //css for li element
'li.' + liHighlightClass + '{background-color:yellow;}\n' + //css for highlighted li element.
'li.' + liHighlightClass + '{background-color:yellow;}\n' + //css for highlighted li element.
'.rtl li.' + myClassName + '{float: right; margin-left: 3em;}\n' +
'.rtl li.' + myClassName + '{float: right; margin-left: 3em;}\n' +
Zeile 104: Zeile 104:
$(hilightDivMarker+ ' img').each(function() {
$(hilightDivMarker+ ' img').each(function() {
var img = $(this), map = img.siblings('map:first');
var img = $(this), map = img.siblings('map:first');
            if (map.length === 0)
                  map = img.closest('span').siblings('map:first');
if (!('area', map).length)
if (!('area', map).length)
return; //not an imagemap. inside "each" anonymous function, 'return' means "continue".
return; //not an imagemap. inside "each" anonymous function, 'return' means "continue".