MediaWiki:Imagemap-Hightlight.js: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
JSC (Diskussion | Beiträge) Keine Bearbeitungszusammenfassung |
JSC (Diskussion | Beiträge) Keine Bearbeitungszusammenfassung |
||
| (Eine dazwischenliegende Version desselben Benutzers wird 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 + mw.config.get( 'wgServerName' ) + "/wiki/", '').replace(/.*\/\//, '').replace(/_/g, ' '); /*JSC 210819: veraltete Funktion ausgetauscht */ | |||
var page = href.replace(document.location.protocol + mw.config.get( 'wgServerName' ) + "/wiki/", '').replace(/.*\/\//, '').replace(/_/g, ' '); | |||
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 105: | 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". | ||