Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dokuwiki
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BRIC
dokuwiki
Commits
38331508
Commit
38331508
authored
13 years ago
by
Andreas Gohr
Browse files
Options
Downloads
Patches
Plain Diff
jqueryized diff checkbox script
parent
2c5ba7b2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/scripts/behaviour.js
+30
-0
30 additions, 0 deletions
lib/scripts/behaviour.js
lib/scripts/script.js
+0
-28
0 additions, 28 deletions
lib/scripts/script.js
with
30 additions
and
28 deletions
lib/scripts/behaviour.js
+
30
−
0
View file @
38331508
...
@@ -18,6 +18,11 @@ var dw_behaviour = {
...
@@ -18,6 +18,11 @@ var dw_behaviour = {
dw_behaviour
.
checkWindowsShares
();
dw_behaviour
.
checkWindowsShares
();
dw_behaviour
.
initTocToggle
();
dw_behaviour
.
initTocToggle
();
dw_behaviour
.
subscription
();
dw_behaviour
.
subscription
();
dw_behaviour
.
revisionBoxHandler
();
jQuery
(
'
#page__revisions input[type=checkbox]
'
).
click
(
dw_behaviour
.
revisionBoxHandler
);
},
},
/**
/**
...
@@ -143,7 +148,32 @@ var dw_behaviour = {
...
@@ -143,7 +148,32 @@ var dw_behaviour = {
)
)
.
filter
(
'
:checked
'
)
.
filter
(
'
:checked
'
)
.
click
();
.
click
();
},
/**
* disable multiple revisions checkboxes if two are checked
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
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
;
}
}
}
}
}
};
};
/**
/**
...
...
This diff is collapsed.
Click to expand it.
lib/scripts/script.js
+
0
−
28
View file @
38331508
...
@@ -187,32 +187,4 @@ function closePopups(){
...
@@ -187,32 +187,4 @@ function closePopups(){
jQuery
(
'
div.JSpopup
'
).
hide
();
jQuery
(
'
div.JSpopup
'
).
hide
();
}
}
/**
* 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
'
);
}
});
input1
.
checked
=
false
;
// chrome reselects on back button which messes up the logic
}
else
if
(
input1
.
type
==
'
submit
'
){
input1
.
disabled
=
true
;
}
}
});
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment