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
5d3db6eb
Commit
5d3db6eb
authored
14 years ago
by
Michal Rezler
Browse files
Options
Downloads
Patches
Plain Diff
toolbar.js is jQueryfied
parent
2ed49e2a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/scripts/toolbar.js
+54
-41
54 additions, 41 deletions
lib/scripts/toolbar.js
with
54 additions
and
41 deletions
lib/scripts/toolbar.js
+
54
−
41
View file @
5d3db6eb
...
...
@@ -12,54 +12,62 @@ var pickercounter=0;
* @author Andreas Gohr <andi@splitbrain.org>
*/
function
initToolbar
(
tbid
,
edid
,
tb
,
allowblock
){
var
toolbar
=
$
(
tbid
);
if
(
!
toolbar
)
return
;
var
edit
=
$
(
edid
);
if
(
!
edit
)
return
;
if
(
edit
.
readOnly
)
return
;
var
$
=
jQuery
;
if
(
typeof
tbid
==
'
string
'
)
{
var
toolbar
=
$
(
'
#
'
+
tbid
);
}
else
{
var
toolbar
=
$
(
tbid
);
}
if
(
toolbar
.
length
==
0
)
return
;
var
edit
=
$
(
'
#
'
+
edid
);
if
(
edit
.
length
==
0
)
return
;
if
(
edit
.
attr
(
'
readOnly
'
))
return
;
if
(
typeof
allowblock
===
'
undefined
'
)
{
allowblock
=
true
;
}
//empty the toolbar area:
toolbar
.
innerHTML
=
''
;
toolbar
.
html
(
''
)
;
var
cnt
=
tb
.
length
;
var
cnt
=
tb
.
length
;
for
(
var
i
=
0
;
i
<
cnt
;
i
++
){
if
(
!
allowblock
&&
tb
[
i
].
block
===
true
)
{
continue
;
}
var
actionFunc
;
// create new button
var
btn
=
createToolButton
(
tb
[
i
][
'
icon
'
],
// create new button
(jQuery object)
var
btn
=
$
(
createToolButton
(
tb
[
i
][
'
icon
'
],
tb
[
i
][
'
title
'
],
tb
[
i
][
'
key
'
],
tb
[
i
][
'
id
'
],
tb
[
i
][
'
class
'
]);
tb
[
i
][
'
class
'
]));
// type is a tb function -> assign it as onclick
actionFunc
=
'
tb_
'
+
tb
[
i
][
'
type
'
];
if
(
jQuery
.
isFunction
(
window
[
actionFunc
])
){
addEvent
(
btn
,
'
click
'
,
bind
(
window
[
actionFunc
],
btn
,
tb
[
i
],
edid
));
toolbar
.
append
Child
(
btn
);
if
(
$
.
isFunction
(
window
[
actionFunc
])
){
btn
.
bind
(
'
click
'
,
bind
(
window
[
actionFunc
],
btn
,
tb
[
i
],
edid
)
);
toolbar
.
append
(
btn
);
continue
;
}
// type is a init function -> execute it
actionFunc
=
'
addBtnAction
'
+
tb
[
i
][
'
type
'
].
charAt
(
0
).
toUpperCase
()
+
tb
[
i
][
'
type
'
].
substring
(
1
);
if
(
jQuery
.
isFunction
(
window
[
actionFunc
])
){
if
(
$
.
isFunction
(
window
[
actionFunc
])
){
if
(
window
[
actionFunc
](
btn
,
tb
[
i
],
edid
)){
toolbar
.
append
Child
(
btn
);
}
toolbar
.
append
(
btn
);
}
continue
;
}
alert
(
'
unknown toolbar type:
'
+
tb
[
i
][
'
type
'
]
+
'
'
+
actionFunc
);
}
// end for
}
/**
...
...
@@ -197,10 +205,14 @@ function tb_autohead(btn, props, edid){
function
addBtnActionPicker
(
btn
,
props
,
edid
)
{
var
pickerid
=
'
picker
'
+
(
pickercounter
++
);
createPicker
(
pickerid
,
props
,
edid
);
addEvent
(
btn
,
'
click
'
,
function
(){
pickerToggle
(
pickerid
,
btn
);
return
false
;
});
btn
.
click
(
function
()
{
pickerToggle
(
pickerid
,
btn
);
return
false
;
}
);
return
true
;
}
...
...
@@ -214,7 +226,7 @@ function addBtnActionPicker(btn, props, edid) {
* @author Andreas Gohr <gohr@cosmocode.de>
*/
function
addBtnActionLinkwiz
(
btn
,
props
,
edid
)
{
jQuery
(
btn
).
linkwiz
(
$
(
edid
));
jQuery
(
btn
).
linkwiz
(
jQuery
(
'
#
'
+
edid
));
return
true
;
}
...
...
@@ -224,17 +236,18 @@ function addBtnActionLinkwiz(btn, props, edid) {
* @author Andreas Gohr <andi@splitbrain.org>
*/
function
pickerToggle
(
pickerid
,
btn
){
var
picker
=
$
(
pickerid
);
if
(
picker
.
style
.
marginLeft
==
'
-10000px
'
){
var
x
=
findPosX
(
btn
);
var
y
=
findPosY
(
btn
);
picker
.
style
.
left
=
(
x
+
3
)
+
'
px
'
;
picker
.
style
.
top
=
(
y
+
btn
.
offsetHeight
+
3
)
+
'
px
'
;
picker
.
style
.
marginLeft
=
'
0px
'
;
picker
.
style
.
marginTop
=
'
0px
'
;
}
else
{
picker
.
style
.
marginLeft
=
'
-10000px
'
;
picker
.
style
.
marginTop
=
'
-10000px
'
;
var
picker
=
jQuery
(
'
#
'
+
pickerid
);
if
(
picker
.
css
(
'
marginLeft
'
)
==
'
-10000px
'
){
var
x
=
findPosX
(
btn
[
0
]);
var
y
=
findPosY
(
btn
[
0
]);
picker
.
css
(
'
left
'
,(
x
+
3
)
+
'
px
'
)
.
css
(
'
top
'
,
(
y
+
btn
[
0
].
offsetHeight
+
3
)
+
'
px
'
)
.
css
(
'
marginLeft
'
,
'
0px
'
)
.
css
(
'
marginTop
'
,
'
0px
'
);
}
else
{
picker
.
css
(
'
marginLeft
'
,
'
-10000px
'
)
.
css
(
'
marginTop
'
,
'
-10000px
'
);
}
}
...
...
@@ -244,10 +257,10 @@ function pickerToggle(pickerid,btn){
* @author Andreas Gohr <andi@splitbrain.org>
*/
function
pickerClose
(){
var
pobjs
=
getElementsByClass
(
'
picker
'
);
var
pobjs
=
jQuery
(
'
#
picker
'
);
for
(
var
i
=
0
;
i
<
pobjs
.
length
;
i
++
){
pobjs
[
i
].
style
.
marginLeft
=
'
-10000px
'
;
pobjs
[
i
].
style
.
marginTop
=
'
-10000px
'
;
pobjs
[
i
].
css
(
'
marginLeft
'
,
'
-10000px
'
)
.
css
(
'
marginTop
'
,
'
-10000px
'
)
;
}
}
...
...
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