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
(New improved way to generate the map key, without having to edit this file every time a new key is added) |
|||
Line 1: | Line 1: | ||
/* NC-Wiki Jquery File - Do not delete! */ | /* NC-Wiki Jquery File - Do not delete! */ | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
$kjq(document).ready(function($) | $kjq(document).ready(function($) | ||
Line 17: | Line 5: | ||
// 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!='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 mapkey functions | ||
// End of functions | // End of functions | ||
}); | }); |