summaryrefslogtreecommitdiff
path: root/lib/scripts/behaviour.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/scripts/behaviour.js')
-rw-r--r--lib/scripts/behaviour.js42
1 files changed, 5 insertions, 37 deletions
diff --git a/lib/scripts/behaviour.js b/lib/scripts/behaviour.js
index 1580ae86f..cfdc89157 100644
--- a/lib/scripts/behaviour.js
+++ b/lib/scripts/behaviour.js
@@ -1,6 +1,3 @@
-/*jslint sloppy: true */
-/*global jQuery, LANG, document, alert */
-
/**
* Automatic behaviours
*
@@ -16,7 +13,6 @@ var dw_behaviour = {
dw_behaviour.removeHighlightOnClick();
dw_behaviour.quickSelect();
dw_behaviour.checkWindowsShares();
- dw_behaviour.initTocToggle();
dw_behaviour.subscription();
dw_behaviour.revisionBoxHandler();
@@ -67,7 +63,9 @@ var dw_behaviour = {
quickSelect: function(){
jQuery('select.quickselect')
.change(function(e){ e.target.form.submit(); })
- .parents('form').find('input[type=submit]').hide();
+ .parents('form').find('input[type=submit]').each(function(){
+ if (!jQuery(this).hasClass('show')) jQuery(this).hide();
+ });
},
/**
@@ -87,36 +85,6 @@ var dw_behaviour = {
},
/**
- * 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(200);
- 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();
- },
-
- /**
* Hide list subscription style if target is a page
*
* @author Adrian Lang <lang@cosmocode.de>
@@ -201,13 +169,13 @@ jQuery.fn.dw_show = function(fn) {
*
* @param bool the current state of the element (optional)
*/
-jQuery.fn.dw_toggle = function(bool) {
+jQuery.fn.dw_toggle = function(bool, fn) {
return this.each(function() {
var $this = jQuery(this);
if (typeof bool === 'undefined') {
bool = $this.is(':hidden');
}
- $this[bool ? "dw_show" : "dw_hide" ]();
+ $this[bool ? "dw_show" : "dw_hide" ](fn);
});
};