From 63f4f854ffdcaed0985da6da32e960efbfab59c5 Mon Sep 17 00:00:00 2001 From: Anika Henke Date: Sat, 30 Jul 2011 09:46:11 +0100 Subject: made TOC toggle faster to avoid clunky text flow around it --- lib/scripts/behaviour.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/scripts/behaviour.js') diff --git a/lib/scripts/behaviour.js b/lib/scripts/behaviour.js index dd7676432..a94e40b7a 100644 --- a/lib/scripts/behaviour.js +++ b/lib/scripts/behaviour.js @@ -104,7 +104,7 @@ var dw_behaviour = { .attr('id','toc__toggle') .css('cursor','pointer') .click(function(){ - $toc.slideToggle(); + $toc.slideToggle(200); setClicky(); }); $header.prepend($clicky); -- cgit v1.2.3 From 4678059bd0b91fb4d92aaa85cd5d0855818a2c30 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Sun, 14 Aug 2011 17:29:44 +0200 Subject: don't remove msg() errors on click this interferred with copy'n'pasting error messages --- lib/scripts/behaviour.js | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'lib/scripts/behaviour.js') diff --git a/lib/scripts/behaviour.js b/lib/scripts/behaviour.js index a94e40b7a..aadf74a1c 100644 --- a/lib/scripts/behaviour.js +++ b/lib/scripts/behaviour.js @@ -13,7 +13,6 @@ var dw_behaviour = { init: function(){ dw_behaviour.focusMarker(); dw_behaviour.scrollToMarker(); - dw_behaviour.closeMsgOnClick(); dw_behaviour.removeHighlightOnClick(); dw_behaviour.quickSelect(); dw_behaviour.checkWindowsShares(); @@ -37,17 +36,6 @@ var dw_behaviour = { jQuery('#focus__this').focus(); }, - /** - * Close messages shown by the msg() PHP function by click - */ - closeMsgOnClick: function(){ - jQuery('div.success, div.info, div.error, div.notify').click( - function(e){ - jQuery(e.target).fadeOut('fast'); - } - ); - }, - /** * Remove all search highlighting when clicking on a highlighted term * -- cgit v1.2.3 From 20e3e8ebefec296327d39fb572b06d60c151c867 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Thu, 18 Aug 2011 11:36:18 +0200 Subject: added some function comments --- lib/scripts/behaviour.js | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'lib/scripts/behaviour.js') diff --git a/lib/scripts/behaviour.js b/lib/scripts/behaviour.js index aadf74a1c..6012e5d1d 100644 --- a/lib/scripts/behaviour.js +++ b/lib/scripts/behaviour.js @@ -112,14 +112,31 @@ var dw_behaviour = { }; +/** + * Hides elements with a slide animation + * + * @param fn optional callback to run after hiding + * @author Adrian Lang + */ jQuery.fn.dw_hide = function(fn) { return this.slideUp('fast', fn); }; -jQuery.fn.dw_show = function() { - return this.slideDown('fast'); +/** + * Unhides elements with a slide animation + * + * @param fn optional callback to run after hiding + * @author Adrian Lang + */ +jQuery.fn.dw_show = function(fn) { + return this.slideDown('fast', fn); }; +/** + * Toggles visibility of an element using a slide element + * + * @param bool the current state of the element (optional) + */ jQuery.fn.dw_toggle = function(bool) { return this.each(function() { var $this = jQuery(this); -- cgit v1.2.3 From 02782d1287173f3981a008755958543c178de296 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Thu, 18 Aug 2011 12:24:43 +0200 Subject: moved subscription javascript into behaviour --- lib/scripts/behaviour.js | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) (limited to 'lib/scripts/behaviour.js') diff --git a/lib/scripts/behaviour.js b/lib/scripts/behaviour.js index 6012e5d1d..0f69d5721 100644 --- a/lib/scripts/behaviour.js +++ b/lib/scripts/behaviour.js @@ -17,6 +17,7 @@ var dw_behaviour = { dw_behaviour.quickSelect(); dw_behaviour.checkWindowsShares(); dw_behaviour.initTocToggle(); + dw_behaviour.subscription(); }, /** @@ -108,8 +109,41 @@ var dw_behaviour = { }; setClicky(); - } + }, + /** + * Hide list subscription style if target is a page + * + * @author Adrian Lang + * @author Pierre Spring + */ + subscription: function(){ + var $form, $list, $digest; + + $form = jQuery('#subscribe__form'); + if (0 === $form.length) return; + + $list = $form.find("input[name='sub_style'][value='list']"); + $digest = $form.find("input[name='sub_style'][value='digest']"); + + $form.find("input[name='sub_target']") + .click( + function () { + var $this = jQuery(this), show_list; + if (!$this.prop('checked')) { + return; + } + + show_list = $this.val().match(/:$/); + $list.parent().dw_toggle(show_list); + if (!show_list && $list.prop('checked')) { + $digest.prop('checked', 'checked'); + } + } + ) + .filter(':checked') + .click(); + } }; /** -- cgit v1.2.3 From 38331508a78e955e63596e778f863996dfa7763b Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Fri, 19 Aug 2011 13:06:25 +0200 Subject: jqueryized diff checkbox script --- lib/scripts/behaviour.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'lib/scripts/behaviour.js') diff --git a/lib/scripts/behaviour.js b/lib/scripts/behaviour.js index 0f69d5721..1580ae86f 100644 --- a/lib/scripts/behaviour.js +++ b/lib/scripts/behaviour.js @@ -18,6 +18,11 @@ var dw_behaviour = { dw_behaviour.checkWindowsShares(); dw_behaviour.initTocToggle(); dw_behaviour.subscription(); + + dw_behaviour.revisionBoxHandler(); + jQuery('#page__revisions input[type=checkbox]').click( + dw_behaviour.revisionBoxHandler + ); }, /** @@ -143,7 +148,32 @@ var dw_behaviour = { ) .filter(':checked') .click(); + }, + + /** + * disable multiple revisions checkboxes if two are checked + * + * @author Andreas Gohr + */ + revisionBoxHandler: function(){ + var $checked = jQuery('#page__revisions input[type=checkbox]:checked'); + var $all = jQuery('#page__revisions input[type=checkbox]'); + + if($checked.length < 2){ + $all.attr('disabled',false); + jQuery('#page__revisions input[type=submit]').attr('disabled',true); + }else{ + $all.attr('disabled',true); + jQuery('#page__revisions input[type=submit]').attr('disabled',false); + for(var i=0; i<$checked.length; i++){ + $checked[i].disabled = false; + if(i>1){ + $checked[i].checked = false; + } + } + } } + }; /** -- cgit v1.2.3 From ba72dce1b47b01a626df51666b84593d8cbc1050 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Sun, 21 Aug 2011 14:33:07 +0200 Subject: fixed TOC-Bug and moved TOC behaviour to page.js FS#2314 --- lib/scripts/behaviour.js | 31 ------------------------------- 1 file changed, 31 deletions(-) (limited to 'lib/scripts/behaviour.js') diff --git a/lib/scripts/behaviour.js b/lib/scripts/behaviour.js index 1580ae86f..d7c3d2975 100644 --- a/lib/scripts/behaviour.js +++ b/lib/scripts/behaviour.js @@ -16,7 +16,6 @@ var dw_behaviour = { dw_behaviour.removeHighlightOnClick(); dw_behaviour.quickSelect(); dw_behaviour.checkWindowsShares(); - dw_behaviour.initTocToggle(); dw_behaviour.subscription(); dw_behaviour.revisionBoxHandler(); @@ -86,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('+'); - $clicky[0].className = 'toc_open'; - }else{ - $clicky.html(''); - $clicky[0].className = 'toc_close'; - } - }; - - setClicky(); - }, - /** * Hide list subscription style if target is a page * -- cgit v1.2.3 From 511885ddd1d0f56b93fe6ad9ad0fbdc3836cf892 Mon Sep 17 00:00:00 2001 From: Adrian Lang Date: Mon, 22 Aug 2011 15:34:47 +0200 Subject: Add missing callback param to dw_toggle --- lib/scripts/behaviour.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'lib/scripts/behaviour.js') diff --git a/lib/scripts/behaviour.js b/lib/scripts/behaviour.js index d7c3d2975..afb210840 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 * @@ -170,13 +167,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); }); }; -- cgit v1.2.3