Skip to content
Snippets Groups Projects
Commit 32cb905a authored by Andreas Gohr's avatar Andreas Gohr
Browse files

moved the TOC toggling to dw_behaviour

parent 08db4441
No related branches found
No related tags found
No related merge requests found
...@@ -107,7 +107,6 @@ function js_out(){ ...@@ -107,7 +107,6 @@ function js_out(){
// init stuff // init stuff
js_runonstart("addEvent(document,'click',closePopups)"); js_runonstart("addEvent(document,'click',closePopups)");
js_runonstart('addTocToggle()');
js_runonstart("initToolbar('tool__bar','wiki__text',toolbar)"); js_runonstart("initToolbar('tool__bar','wiki__text',toolbar)");
if($conf['locktime'] != 0){ if($conf['locktime'] != 0){
js_runonstart("locktimer.init(".($conf['locktime'] - 60).",'".js_escape($lang['willexpire'])."',".$conf['usedraft'].", 'wiki__text')"); js_runonstart("locktimer.init(".($conf['locktime'] - 60).",'".js_escape($lang['willexpire'])."',".$conf['usedraft'].", 'wiki__text')");
......
...@@ -17,6 +17,7 @@ var dw_behaviour = { ...@@ -17,6 +17,7 @@ var dw_behaviour = {
dw_behaviour.removeHighlightOnClick(); dw_behaviour.removeHighlightOnClick();
dw_behaviour.quickSelect(); dw_behaviour.quickSelect();
dw_behaviour.checkWindowsShares(); dw_behaviour.checkWindowsShares();
dw_behaviour.initTocToggle();
}, },
/** /**
...@@ -89,6 +90,36 @@ var dw_behaviour = { ...@@ -89,6 +90,36 @@ var dw_behaviour = {
jQuery('a.windows').live('click', function(){ jQuery('a.windows').live('click', function(){
alert(LANG.nosmblinks); alert(LANG.nosmblinks);
}); });
},
/**
* Adds the toggle switch to the TOC
*/
initTocToggle: function() {
var $header = jQuery('#toc__header');
if(!$header.length) return;
var $toc = jQuery('#toc__inside');
var $clicky = jQuery(document.createElement('span'))
.attr('id','toc__toggle')
.css('cursor','pointer')
.click(function(){
$toc.slideToggle();
setClicky();
});
$header.prepend($clicky);
var setClicky = function(){
if($toc.css('display') == 'none'){
$clicky.html('<span>+</span>');
$clicky[0].className = 'toc_open';
}else{
$clicky.html('<span>&minus;</span>');
$clicky[0].className = 'toc_close';
}
};
setClicky();
} }
}; };
......
...@@ -193,47 +193,6 @@ function hideLoadBar(id){ ...@@ -193,47 +193,6 @@ function hideLoadBar(id){
if(obj) obj.style.display="none"; if(obj) obj.style.display="none";
} }
/**
* Adds the toggle switch to the TOC
*/
function addTocToggle() {
if(!document.getElementById) return;
var header = $('toc__header');
if(!header) return;
var toc = $('toc__inside');
var obj = document.createElement('span');
obj.id = 'toc__toggle';
obj.style.cursor = 'pointer';
if (toc && toc.style.display == 'none') {
obj.innerHTML = '<span>+</span>';
obj.className = 'toc_open';
} else {
obj.innerHTML = '<span>&minus;</span>';
obj.className = 'toc_close';
}
prependChild(header,obj);
obj.parentNode.onclick = toggleToc;
obj.parentNode.style.cursor = 'pointer';
}
/**
* This toggles the visibility of the Table of Contents
*/
function toggleToc() {
var toc = $('toc__inside');
var obj = $('toc__toggle');
if(toc.style.display == 'none') {
toc.style.display = '';
obj.innerHTML = '<span>&minus;</span>';
obj.className = 'toc_close';
} else {
toc.style.display = 'none';
obj.innerHTML = '<span>+</span>';
obj.className = 'toc_open';
}
}
/** /**
* Create JavaScript mouseover popup * Create JavaScript mouseover popup
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment