Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
moodle-block_hshcourselist
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
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
elc
moodle-block_hshcourselist
Commits
a41e783f
Commit
a41e783f
authored
6 years ago
by
Tobias Baden
Browse files
Options
Downloads
Patches
Plain Diff
Fixed the scroll-by-items functionality - ListSearch
- Updated Version Number
parent
1af80472
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
amd/build/listselect.min.js
+2
-2
2 additions, 2 deletions
amd/build/listselect.min.js
amd/src/listselect.js
+25
-19
25 additions, 19 deletions
amd/src/listselect.js
version.php
+1
-1
1 addition, 1 deletion
version.php
with
28 additions
and
22 deletions
amd/build/listselect.min.js
+
2
−
2
View file @
a41e783f
/*! hshcourselist 2018-08-31 */
/*! hshcourselist 2018-09-12 */
define
([
"
jquery
"
],
function
(
a
){
function
b
(
b
,
c
){
var
d
=
c
+
"
/course/view.php?id=
"
+
b
.
val
();
a
(
"
#hshcourseform
"
).
attr
(
"
action
"
,
d
)}
function
c
(
a
){
a
.
removeClass
(
"
active
"
),
a
.
removeClass
(
"
activeCourseSearch
"
)}
function
d
(
a
){
a
.
addClass
(
"
active
"
),
a
.
addClass
(
"
activeCourseSearch
"
)}
function
e
(
a
){
var
b
=
window
.
innerHeight
,
c
=
a
.
getBoundingClientRect
(),
d
=
c
.
bottom
,
e
=
c
.
top
;
d
>
b
&&
a
.
scrollIntoView
({
block
:
"
end
"
,
behavior
:
"
smooth
"
}),
e
<
0
&&
a
.
scrollIntoView
({
block
:
"
start
"
,
behavior
:
"
smooth
"
})}
return
{
init
:
function
(
f
){
a
(
"
input
"
).
keydown
(
function
(
g
){
var
h
,
i
=
a
(
"
.hshcoursesearchlistitem
"
),
j
=
g
.
keyCode
,
k
=
i
.
filter
(
"
.activeCourseSearch
"
);
40
!==
j
&&
38
!==
j
&&
13
!==
j
||
(
c
(
i
),
38
===
j
?(
h
=!
k
.
length
||
k
.
is
(
"
:first-child
"
)?
i
.
last
():
k
.
prev
(),
b
(
h
,
f
)):
40
===
j
?(
h
=!
k
.
length
||
k
.
is
(
"
:last-child
"
)?
i
.
eq
(
0
):
k
.
next
(),
b
(
h
,
f
)):
13
===
j
&&
(
h
=
k
,
isNaN
(
h
.
val
())
&&
(
h
=
i
.
eq
(
0
)),
b
(
h
,
f
)),
d
(
h
),
e
(
h
.
eq
(
0
)))})}}});
define
([
"
jquery
"
],
function
(
a
){
function
b
(
b
,
c
){
var
d
=
c
+
"
/course/view.php?id=
"
+
b
.
val
();
a
(
"
#hshcourseform
"
).
attr
(
"
action
"
,
d
)}
function
c
(
a
){
a
.
removeClass
(
"
active
"
),
a
.
removeClass
(
"
activeCourseSearch
"
)}
function
d
(
a
){
a
.
addClass
(
"
active
"
),
a
.
addClass
(
"
activeCourseSearch
"
)}
function
e
(
a
){
var
b
=
window
.
innerHeight
,
c
=
a
.
getBoundingClientRect
(),
d
=
c
.
bottom
,
e
=
c
.
top
;
d
>
b
&&
a
.
scrollIntoView
({
block
:
"
end
"
,
behavior
:
"
smooth
"
}),
e
<
0
&&
a
.
scrollIntoView
({
block
:
"
start
"
,
behavior
:
"
smooth
"
})}
return
{
init
:
function
(
f
){
a
(
"
input
"
).
keydown
(
function
(
g
){
var
h
,
i
=
a
(
"
.hshcoursesearchlistitem
"
),
j
=
i
.
filter
(
"
.activeCourseSearch
"
),
k
=
g
.
keyCode
;
if
(
40
===
k
||
38
===
k
||
13
===
k
){
c
(
i
),
38
===
k
?(
h
=!
j
.
length
||
j
.
is
(
"
:first-child
"
)?
i
.
last
():
j
.
prev
(),
b
(
h
,
f
)):
40
===
k
?(
h
=!
j
.
length
||
j
.
is
(
"
:last-child
"
)?
i
.
eq
(
0
):
j
.
next
(),
b
(
h
,
f
)):
13
===
k
&&
(
h
=
j
,
isNaN
(
h
.
val
())
&&
(
h
=
i
.
eq
(
0
)),
b
(
h
,
f
)),
d
(
h
);
e
(
document
.
getElementsByClassName
(
"
activeCourseSearch
"
)[
0
])}})}}});
\ No newline at end of file
\ No newline at end of file
This diff is collapsed.
Click to expand it.
amd/src/listselect.js
+
25
−
19
View file @
a41e783f
define
([
'
jquery
'
],
function
(
$
)
{
define
([
"
jquery
"
],
function
(
$
)
{
function
changeActionString
(
current
,
wwwroot
)
{
function
changeActionString
(
current
,
wwwroot
)
{
var
actionString
=
wwwroot
+
'
/course/view.php?id=
'
+
current
.
val
();
var
actionString
=
wwwroot
+
"
/course/view.php?id=
"
+
current
.
val
();
$
(
'
#hshcourseform
'
).
attr
(
'
action
'
,
actionString
);
$
(
"
#hshcourseform
"
).
attr
(
"
action
"
,
actionString
);
}
}
function
setInactive
(
target
)
{
function
setInactive
(
target
)
{
target
.
removeClass
(
'
active
'
);
target
.
removeClass
(
"
active
"
);
target
.
removeClass
(
'
activeCourseSearch
'
);
target
.
removeClass
(
"
activeCourseSearch
"
);
}
}
function
setActive
(
target
)
{
function
setActive
(
target
)
{
target
.
addClass
(
'
active
'
);
target
.
addClass
(
"
active
"
);
target
.
addClass
(
'
activeCourseSearch
'
);
target
.
addClass
(
"
activeCourseSearch
"
);
}
}
function
scrollIntoViewIfNeeded
(
element
)
{
function
scrollIntoViewIfNeeded
(
element
)
{
...
@@ -32,9 +32,9 @@ define(['jquery'], function ($) {
...
@@ -32,9 +32,9 @@ define(['jquery'], function ($) {
return
{
return
{
init
:
function
(
wwwroot
)
{
init
:
function
(
wwwroot
)
{
$
(
'
input
'
).
keydown
(
function
(
e
)
{
$
(
"
input
"
).
keydown
(
function
(
e
)
{
var
listItems
=
$
(
'
.hshcoursesearchlistitem
'
);
var
listItems
=
$
(
"
.hshcoursesearchlistitem
"
);
var
selected
=
listItems
.
filter
(
'
.activeCourseSearch
'
);
var
selected
=
listItems
.
filter
(
"
.activeCourseSearch
"
);
var
current
;
var
current
;
var
key
=
e
.
keyCode
;
var
key
=
e
.
keyCode
;
...
@@ -44,21 +44,24 @@ define(['jquery'], function ($) {
...
@@ -44,21 +44,24 @@ define(['jquery'], function ($) {
setInactive
(
listItems
);
setInactive
(
listItems
);
if
(
key
===
38
)
{
// KEY UP
if
(
key
===
38
)
{
if
(
!
selected
.
length
||
selected
.
is
(
'
:first-child
'
))
{
// KEY UP
if
(
!
selected
.
length
||
selected
.
is
(
"
:first-child
"
))
{
current
=
listItems
.
last
();
current
=
listItems
.
last
();
}
else
{
}
else
{
current
=
selected
.
prev
();
current
=
selected
.
prev
();
}
}
changeActionString
(
current
,
wwwroot
);
changeActionString
(
current
,
wwwroot
);
}
else
if
(
key
===
40
)
{
// KEY DOWN
}
else
if
(
key
===
40
)
{
if
(
!
selected
.
length
||
selected
.
is
(
'
:last-child
'
))
{
// KEY DOWN
if
(
!
selected
.
length
||
selected
.
is
(
"
:last-child
"
))
{
current
=
listItems
.
eq
(
0
);
current
=
listItems
.
eq
(
0
);
}
else
{
}
else
{
current
=
selected
.
next
();
current
=
selected
.
next
();
}
}
changeActionString
(
current
,
wwwroot
);
changeActionString
(
current
,
wwwroot
);
}
else
if
(
key
===
13
)
{
// KEY ENTER
}
else
if
(
key
===
13
)
{
// KEY ENTER
current
=
selected
;
current
=
selected
;
if
(
isNaN
(
current
.
val
()))
{
if
(
isNaN
(
current
.
val
()))
{
current
=
listItems
.
eq
(
0
);
current
=
listItems
.
eq
(
0
);
...
@@ -67,8 +70,11 @@ define(['jquery'], function ($) {
...
@@ -67,8 +70,11 @@ define(['jquery'], function ($) {
}
}
setActive
(
current
);
setActive
(
current
);
scrollIntoViewIfNeeded
(
current
.
eq
(
0
));
var
scrollToElement
=
document
.
getElementsByClassName
(
"
activeCourseSearch
"
)[
0
];
scrollIntoViewIfNeeded
(
scrollToElement
);
});
});
},
}
}
};
});
});
This diff is collapsed.
Click to expand it.
version.php
+
1
−
1
View file @
a41e783f
<?php
<?php
$plugin
->
component
=
'block_hshcourselist'
;
$plugin
->
component
=
'block_hshcourselist'
;
$plugin
->
version
=
20180
831
00
;
// YYYYMMDDHH
$plugin
->
version
=
20180
912
00
;
// YYYYMMDDHH
$plugin
->
requires
=
2016112900
;
// YYYYMMDDHH
$plugin
->
requires
=
2016112900
;
// YYYYMMDDHH
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