Latest Neocron News and Information
- New test server patch #563 has been released to Vedeena
Difference between revisions of "Metadata:Mapping/Map.js"
From Neocron Wiki
(NPC hiding added...need to change this) |
(Brammers changed the content model of the page Metadata:Mapping/Map.js from "wikitext" to "JavaScript") Tag: content model change |
||
(20 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | /* NC-Wiki Jquery File - Do not delete! */ | + | /* NC-Wiki Jquery File - Do not delete! (c) 2017 - Tech Haven Network */ |
− | + | $(document).ready(function($) | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
{ | { | ||
// Add functions and stuff here | // Add functions and stuff here | ||
− | // NC-Wiki map | + | // NC-Wiki map - enabled the plugin |
− | $('.ncwiki_map').maphilight( | + | $('img.ncwiki_map').maphilight( |
{ | { | ||
fill: true, | fill: true, | ||
Line 30: | Line 18: | ||
alwaysOn: false | alwaysOn: false | ||
}); | }); | ||
+ | |||
+ | // Function to hide unsed map key elements | ||
// Dont hide map on the Template:Mapkey page | // Dont hide map on the Template:Mapkey page | ||
// Otherwise you cannot preview it! | // Otherwise you cannot preview it! | ||
− | + | if (wgPageName.substr(0,15)!='Template:Mapkey') | |
− | if (wgPageName!='Template:Mapkey') | ||
{ | { | ||
− | + | // Ok find the map key elemetns | |
− | + | $('li.map_key').each(function () | |
− | + | { | |
− | + | // Get the classnames out | |
− | + | classnames=$(this).attr('class').split(" "); | |
− | + | ||
− | + | for (var i=0; i<classnames.length; i++) | |
− | + | { | |
− | + | // Is a class ending in _key ? | |
− | + | ||
− | + | if ((classnames[i]!='map_key') && | |
− | + | (classnames[i].substring(classnames[i].length-4,classnames[i].length)=='_key')) | |
− | + | { | |
− | + | // Ok got the clasname lets see if it's being shown on the map | |
− | + | myclass=classnames[i].substring(0,classnames[i].length-4); | |
+ | if ($('area.'+myclass).length==0) | ||
+ | { | ||
+ | // Not found anything - so hide it on the map | ||
+ | $('li.'+myclass+'_key').hide(); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | }); | ||
} | } | ||
− | // End of functions | + | // End of mapkey functions |
+ | |||
}); | }); |