Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
MetaGer
Commits
06a4d28f
Commit
06a4d28f
authored
Aug 12, 2019
by
Aria Givi
Browse files
some name changes for clarity
parent
2f8d92a2
Changes
5
Hide whitespace changes
Inline
Side-by-side
resources/js/keyboardNavigation.js
View file @
06a4d28f
var
ctrlInfo
=
false
;
// Flag used for checking if the user was shown the keyboard control information
var
currentResultIndex
=
1
;
// stores index of result which was focused last
var
currentElement
Data
=
{
// Object used for storing currently focused element and element type (e.g. anchor tag or result div)
var
current
Focused
Element
=
{
// Object used for storing currently focused element and element type (e.g. anchor tag or result div)
element
:
$
(
"
div.result
"
).
first
(),
type
:
"
result
"
};
...
...
@@ -18,11 +18,10 @@ $(document).on('keydown', function(e) {
}
});
function
setFocus
(
e
,
type
)
{
currentElementData
.
element
=
e
;
currentElementData
.
type
=
type
;
console
.
log
(
currentElementData
);
currentElementData
.
element
.
focus
();
function
focusElement
(
e
,
type
)
{
currentFocusedElement
.
element
=
e
;
currentFocusedElement
.
type
=
type
;
currentFocusedElement
.
element
.
focus
();
}
function
tabKeyPressed
()
{
...
...
@@ -35,31 +34,31 @@ function tabKeyPressed() {
}
function
enterKeyPressed
()
{
if
(
currentElement
Data
.
type
===
"
result
"
)
{
if
(
current
Focused
Element
.
type
===
"
result
"
)
{
console
.
log
(
$
(
"
:focus
"
).
find
(
"
a
"
).
first
());
setFocus
(
$
(
"
:focus
"
).
find
(
"
a
"
).
first
(),
"
link
"
)
}
else
if
(
currentElement
Data
.
type
===
"
link
"
)
{
window
.
location
=
currentElement
Data
.
element
.
attr
(
'
href
'
);
focusElement
(
$
(
"
:focus
"
).
find
(
"
a
"
).
first
(),
"
link
"
)
}
else
if
(
current
Focused
Element
.
type
===
"
link
"
)
{
window
.
location
=
current
Focused
Element
.
element
.
attr
(
'
href
'
);
}
}
function
showInfoBox
()
{
$
(
"
#keyboard-
ctrl
-info
"
).
show
();
setFocus
(
$
(
"
#keyboard-
ctrl
-info
"
),
"
infobox
"
);
$
(
"
#keyboard-
nav
-info
"
).
show
();
focusElement
(
$
(
"
#keyboard-
nav
-info
"
),
"
infobox
"
);
}
function
focusNextElement
()
{
if
(
currentElement
Data
.
type
===
"
result
"
)
{
if
(
current
Focused
Element
.
type
===
"
result
"
)
{
focusNextResult
();
}
else
{
setFocus
(
$
(
"
div.result
"
).
not
(
'
.ad
'
).
first
(),
"
result
"
);
focusElement
(
$
(
"
div.result
"
).
not
(
'
.ad
'
).
first
(),
"
result
"
);
}
}
function
focusNextResult
()
{
if
(
currentElement
Data
.
element
.
next
().
length
>
0
)
{
setFocus
(
currentElement
Data
.
element
.
next
(),
"
result
"
);
if
(
current
Focused
Element
.
element
.
next
().
length
>
0
)
{
focusElement
(
current
Focused
Element
.
element
.
next
(),
"
result
"
);
}
else
{
setFocus
(
$
(
"
div.result
"
).
not
(
'
.ad
'
).
first
(),
"
result
"
);
focusElement
(
$
(
"
div.result
"
).
not
(
'
.ad
'
).
first
(),
"
result
"
);
}
}
resources/less/metager/pages/resultpage.less
View file @
06a4d28f
...
...
@@ -3,4 +3,4 @@
@import "./resultpage/product.less";
@import "./resultpage/quicktips.less";
@import "./resultpage/result-saver.less";
@import "./resultpage/keyboard-ctrl.less";
\ No newline at end of file
@import "./resultpage/keyboard-nav.less";
\ No newline at end of file
resources/less/metager/pages/resultpage/keyboard-
ctrl
.less
→
resources/less/metager/pages/resultpage/keyboard-
nav
.less
View file @
06a4d28f
/* Keyboard control styles*/
#keyboard-
ctrl
-info {
#keyboard-
nav
-info {
display: none;
position: relative;
margin: 10px 0;
...
...
@@ -14,7 +14,7 @@
border: 10px solid yellow;
}
.keyboard-
ctrl
-info-header{
.keyboard-
nav
-info-header{
text-align: center;
h5 {
font-weight: bold;
...
...
resources/views/layouts/keyboardNavBox.blade.php
View file @
06a4d28f
<div
id=
"keyboard-
ctrl
-info"
tabindex=
"0"
>
<div
class=
"keyboard-
ctrl
-info-content"
>
<div
class=
"keyboard-
ctrl
-info-header"
>
<h5
class=
"keyboard-
ctrl
-info-title"
>
Tastatur-Navigationsanleitung
</h5>
<div
class=
"keyboard-
ctrl
-info-body"
>
<div
id=
"keyboard-
nav
-info"
tabindex=
"0"
>
<div
class=
"keyboard-
nav
-info-content"
>
<div
class=
"keyboard-
nav
-info-header"
>
<h5
class=
"keyboard-
nav
-info-title"
>
Tastatur-Navigationsanleitung
</h5>
<div
class=
"keyboard-
nav
-info-body"
>
<p>
Die Navigation durch die Ergebnisseite ist hierarchisch aufgebaut.
</p>
<ul>
<li>
TAB-Taste: Innerhalb der aktuellen Ebene zum nächsten Element springen.
</li>
...
...
webpack.mix.js
View file @
06a4d28f
...
...
@@ -60,7 +60,8 @@ mix
[
"
resources/js/scriptResultPage.js
"
,
"
resources/js/result-saver.js
"
,
"
resources/js/translations.js
"
"
resources/js/translations.js
"
,
"
resources/js/keyboardNavigation.js
"
],
"
public/js/scriptResultPage.js
"
)
...
...
@@ -68,7 +69,7 @@ mix
.
babel
(
"
resources/js/bitpay.js
"
,
"
public/js/bitpay.js
"
)
// utility
.
babel
(
[
"
resources/js/utility.js
"
,
"
resources/js/keyboardNavigation.js
"
,
"
resources/js/translations.js
"
],
[
"
resources/js/utility.js
"
,
"
resources/js/translations.js
"
],
"
public/js/utility.js
"
)
.
babel
(
"
resources/js/widgets.js
"
,
"
public/js/widgets.js
"
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment