aboutsummaryrefslogtreecommitdiff
path: root/lib/dokuwiki/lib/plugins/indexmenu/edit.js
blob: 7deb5a596c0792b97f8b4ae369ab57c89fc6d871 (plain)
1
function indexmenu_toolbar_additions(){var e,d,c,b=DOKUid("tool__bar");if(!b){return;}e=DOKUid("edbtn__save");if(!e){return;}var a=indexmenu_createPicker("picker_plugin_indexmenu");c=indexmenu_createToolbar();b.appendChild(c);c.onclick=(function(){indexmenu_ajaxmenu("req=local",a,this,false,indexmenu_createThemes);return false;});d=window.indexmenu_contextmenu;if(d[1]){window.indexmenu_contextmenu[0]=d[1].concat(d[0]);}}function indexmenu_createThemes(k,j){if(k.substring(0,9)!="indexmenu"){j.innerHTML="Retrieving error";return;}var i=[["<p><strong><em>Navigation</em></strong></p>",0],["navbar","The tree opens at the current namespace"],["context","Display the tree of the current wiki namespace context"],["nocookie","Don\t remember open/closed nodes during user navigation"],["noscroll","Prevent to scrolling the tree when it does not fit its container width"],["notoc","Disable the toc preview feature"],["<p><strong><em>Sort</em></strong></p>",0],["nsort","Sort also namespaces"],["tsort","By title"],["dsort","By date"],["msort","By meta tag"],["<p><strong><em>Performance</em></strong></p>",0],["max#2","How many levels to render with ajax when a node is opened"],["maxjs#2","How many levels to render in the client browser when a node is opened"],["<p><strong><em>Filters</em></strong></p>",0],["nons","Show only pages"],["nopg","Show only namespaces"]];var h,g,f,e,d,c,b,a;e=k.split(",");f=DOKU_MEDIA+"lib/plugins/indexmenu/images/";d=indexmenu_toolFrame(j,"Indexmenu");b=document.createElement("div");b.className="no indexmenu_nojstoolbar";d.appendChild(b);h=createToolButton(DOKU_MEDIA+"lib/tpl/default/images/open.gif","nojs index");h.innerHTML+="Nojs";h.className="pickerbutton";eval("b.onclick = function(){indexmenu_opts(\"\");}");b.appendChild(h);b=document.createElement("div");b.className="no indexmenu_jstoolbar";d.appendChild(b);if(e[0]!="indexmenu"){b.innerHTML+="No themes";e=[];}else{e.splice(0,3);}for(g in e){h=createToolButton(f+e[g]+"/base."+indexmenu_findExt(e[g]),e[g]);h.className="pickerbutton";eval("h.onclick = function(){indexmenu_opts(\"js#"+e[g]+"\");}");b.appendChild(h);}c=indexmenu_toolFrame(j,"Options");a=document.createElement("form");a.id="indexmenu_optfrm";a.className="indexmenu_opts";c.appendChild(a);for(g in i){lc=document.createElement("label");lc.innerHTML=i[g][0]+" ";if(i[g][1]){lc.title=i[g][1];h=document.createElement("input");h.type="checkbox";h.name="check";h.title=i[g][1];h.value=i[g][0];a.appendChild(h);}a.appendChild(lc);}b=document.createElement("div");b.className="indexmenu_extratoolbar";b.innerHTML="<p><strong><em>Extra</em></strong></p>";d.appendChild(b);h=createToolButton(f+"/msort.gif","Insert the sort meta-number");h.className="pickerbutton";h.onclick=(function(){insertTags("wiki__text","{{indexmenu_n>","}}","1");DOKUid("picker_plugin_indexmenu").style.display="none";return false;});b.appendChild(h);}function indexmenu_createToolbar(){var b=document.createElement("img");b.src=DOKU_MEDIA+"lib/plugins/indexmenu/images/indexmenu_toolbar.png";var a=document.createElement("button");a.id="syntax_plugin_indexmenu";a.className="toolbutton";a.title="Insert the Indexmenu tree";a.appendChild(b);return a;}function indexmenu_opts(d){var c,b="";var a=DOKUid("indexmenu_optfrm");for(c=0;c<a.length;c++){if(a[c].checked){b=b+" "+a[c].value;}}insertTags("wiki__text","{{indexmenu>",((d||b)?"|":"")+d.replace(/#default$/,"")+b+"}}","#1");DOKUid("picker_plugin_indexmenu").style.display="none";return false;}function indexmenu_insertTags(d,c){var b,a=d;if(c){b=new RegExp(c,"g");a=d.replace(b,":");}insertTags("wiki__text","[[","]]",a);}function indexmenu_toolFrame(b,a){f=document.createElement("fieldset");l=document.createElement("legend");l.innerHTML="<strong>"+a+"</strong>";f.appendChild(l);b.appendChild(f);return f;}indexmenu_toolbar_additions();