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
4062d3d5
Commit
4062d3d5
authored
14 years ago
by
Marek Sacha
Committed by
Andreas Gohr
14 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Reimplementation of Accesskeys in javascript (FS#1809), toolbar accesskyes fix.
parent
7ea8e592
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/exe/js.php
+2
-0
2 additions, 0 deletions
lib/exe/js.php
lib/scripts/hotkeys.js
+42
-16
42 additions, 16 deletions
lib/scripts/hotkeys.js
with
44 additions
and
16 deletions
lib/exe/js.php
+
2
−
0
View file @
4062d3d5
...
...
@@ -113,6 +113,8 @@ function js_out(){
}
js_runonstart
(
'scrollToMarker()'
);
js_runonstart
(
'focusMarker()'
);
// init hotkeys - must have been done after init of toolbar
js_runonstart
(
'initializeHotkeys()'
);
// end output buffering and get contents
$js
=
ob_get_contents
();
...
...
This diff is collapsed.
Click to expand it.
lib/scripts/hotkeys.js
+
42
−
16
View file @
4062d3d5
...
...
@@ -27,6 +27,9 @@ function Hotkeys() {
* (at anchor elements and input elements [type="submit"]) and registers
* appropriate shortcuts.
*
* Secondly, initialization registers listeners on document to catch all
* keyboard events.
*
* @author Marek Sacha <sachamar@fel.cvut.cz>
*/
this
.
initialize
=
function
()
{
...
...
@@ -39,7 +42,7 @@ function Hotkeys() {
t
.
each
(
anchors
,
function
(
a
)
{
if
(
a
.
accessKey
!=
""
)
{
t
.
addShortcut
(
t
.
modifier
+
'
+
'
+
a
.
accessKey
,
function
()
{
window
.
location
.
href
=
a
.
href
;
a
.
click
()
;
});
}
});
...
...
@@ -50,12 +53,41 @@ function Hotkeys() {
*/
var
inputs
=
document
.
getElementsByTagName
(
"
input
"
);
t
.
each
(
inputs
,
function
(
i
)
{
if
(
i
.
type
==
"
submit
"
)
{
if
(
i
.
type
==
"
submit
"
&&
i
.
accessKey
!=
""
)
{
t
.
addShortcut
(
t
.
modifier
+
'
+
'
+
i
.
accessKey
,
function
()
{
i
.
click
();
});
}
});
/**
* Lookup all buttons with accesskey and register event -
* perform "click" on a button.
*/
var
buttons
=
document
.
getElementsByTagName
(
"
button
"
);
t
.
each
(
buttons
,
function
(
b
)
{
if
(
b
.
accessKey
!=
""
)
{
t
.
addShortcut
(
t
.
modifier
+
'
+
'
+
b
.
accessKey
,
function
()
{
b
.
click
();
});
}
});
/**
* Register listeners on document to catch keyboard events.
*/
addEvent
(
document
,
'
keyup
'
,
function
(
e
)
{
return
t
.
onkeyup
.
call
(
t
,
e
);
});
addEvent
(
document
,
'
keypress
'
,
function
(
e
)
{
return
t
.
onkeypress
.
call
(
t
,
e
);
});
addEvent
(
document
,
'
keydown
'
,
function
(
e
)
{
return
t
.
onkeydown
.
call
(
t
,
e
);
});
};
/**
...
...
@@ -247,19 +279,13 @@ function Hotkeys() {
};
}
addInitEvent
(
function
(){
/**
* Init function for hotkeys. Called from js.php, to ensure hotkyes are initialized after toolbar.
* Call of addInitEvent(initializeHotkeys) is unnecessary now.
*
* @author Marek Sacha <sachamar@fel.cvut.cz>
*/
function
initializeHotkeys
()
{
var
hotkeys
=
new
Hotkeys
();
hotkeys
.
initialize
();
addEvent
(
document
,
'
keyup
'
,
function
(
e
)
{
return
hotkeys
.
onkeyup
.
call
(
hotkeys
,
e
);
});
addEvent
(
document
,
'
keypress
'
,
function
(
e
)
{
return
hotkeys
.
onkeypress
.
call
(
hotkeys
,
e
);
});
addEvent
(
document
,
'
keydown
'
,
function
(
e
)
{
return
hotkeys
.
onkeydown
.
call
(
hotkeys
,
e
);
});
});
\ No newline at end of file
}
\ No newline at end of file
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