-
Notifications
You must be signed in to change notification settings - Fork 0
/
slickmap.min.js
15 lines (12 loc) · 1.5 KB
/
slickmap.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/*!
SlickMap v 0.1
Developed by Rodrigo Castilho
email: rodcast@gmail.com
site: http://rodrigocastilho.com
Copyright (C) 2010.
Licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License (http://creativecommons.org/licenses/by-sa/3.0/)
Create Site map with base JSON and SlickMap CSS. Pure JavaScript (no framework)
@Inspired on SlickMap CSS:
http://astuteo.com/slickmap/
*/
;var SlickMap=(function(c,a){String.prototype.stripId=function(){return this.toLowerCase().replace(/^\s*|\s$/g,"").replace(/\s+/g,"_").replace(/[áàâãäª]/g,"a").replace(/[éèêë]/g,"e").replace(/[íìîï]/g,"i").replace(/[óòôõöº]/g,"o").replace(/[úùûü]/g,"u").replace(/ç/g,"c").replace(/\W/g,"_").replace(/_+/g,"_")};Object.prototype.isJSON=function(d){return(!JSON.stringify(d)?true:false)};function b(){if(a&&a.isJSON()){var g=c.getElementById("sitemap"),f=c.createElement("h1"),e=c.createElement("h2");g.className="sitemap";f.innerHTML=a.title||"";e.innerHTML=a.subtitle||"";g.appendChild(f).parentNode.appendChild(e);var d=function(o){var n=o.item,m=c.createElement("ul"),k,l,j,h;for(l in n){if(n.hasOwnProperty(l)){h=c.createElement("li");j=c.createElement("a");k=o.item[l];j.appendChild(c.createTextNode(k.name));j.href=k.link;j.title=k.description;h.id=(k.name).stripId();h.appendChild(j);if(k.item){h.appendChild(d.call(this,k))}m.appendChild(h)}}return m};if(a.hasOwnProperty("items")){g.appendChild(d(a.items[0]));g.getElementsByTagName("ul")[0].id="primaryNav"}}}return b()})(document,_slickmap);