summaryrefslogtreecommitdiff
path: root/lib/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'lib/scripts')
-rw-r--r--lib/scripts/script.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/scripts/script.js b/lib/scripts/script.js
index 3d21f580d..5f868c172 100644
--- a/lib/scripts/script.js
+++ b/lib/scripts/script.js
@@ -476,6 +476,32 @@ function cleanMsgArea(){
}
/**
+ * disable multiple revisions checkboxes if two are checked
+ *
+ * @author Anika Henke <anika@selfthinker.org>
+ */
+addInitEvent(function(){
+ var revForm = $('page__revisions');
+ if (!revForm) return;
+ var elems = revForm.elements;
+ var countTicks = 0;
+ for (var i=0; i<elems.length; i++) {
+ var input1 = elems[i];
+ if (input1.type=='checkbox') {
+ addEvent(input1,'click',function(e){
+ if (this.checked) countTicks++;
+ else countTicks--;
+ for (var j=0; j<elems.length; j++) {
+ var input2 = elems[j];
+ if (countTicks >= 2) input2.disabled = (input2.type=='checkbox' && !input2.checked);
+ else input2.disabled = (input2.type!='checkbox');
+ }
+ });
+ }
+ }
+});
+
+/**
* Add the event handler to the actiondropdown
*
* @author Andreas Gohr <andi@splitbrain.org>