Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Jonathan Wilkes
purr-data
Commits
ea898cd9
Commit
ea898cd9
authored
Jul 20, 2021
by
Jonathan Wilkes
Browse files
Merge branch 'prakhar/purr-data-traverse_find' into emscripten
parents
2c5ae521
188b374a
Pipeline
#3680
canceled with stage
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
emscripten/project/purr-data/index.html
View file @
ea898cd9
...
...
@@ -100,6 +100,8 @@
<div
class=
"console-find-webapp"
id=
"console_find"
style=
"display: none;"
>
<div
class=
"d-flex justify-content-end align-items-center"
>
<i
class=
"fa fa-long-arrow-up text-primary"
id=
"find_above"
style=
"cursor: pointer;"
></i>
<i
class=
"fa fa-long-arrow-down text-primary"
id=
"find_below"
style=
"cursor: pointer;"
></i>
<label><input
type=
"text"
id=
"console_find_text"
name=
"console_find_text"
defaultValue=
"Search in Console"
style=
"width: 15em;"
placeholder=
"Search in Console"
/>
</label>
<label
class=
"highlight-find d-flex align-items-center"
>
Highlight All
...
...
emscripten/project/purr-data/utils/actions.js
View file @
ea898cd9
...
...
@@ -91,6 +91,18 @@ function load_menu_actions(){
}
});
minit
(
"
find_below
"
,
{
onclick
:
function
()
{
console_find_below
()
}
});
minit
(
"
find_above
"
,
{
onclick
:
function
()
{
console_find_above
()
}
});
// View entries
minit
(
"
view-fullscreen
"
,{
onclick
:
...
...
emscripten/project/purr-data/utils/console_find.js
View file @
ea898cd9
...
...
@@ -60,7 +60,7 @@ function console_find_callback() {
var
highlight_checkbox
=
document
.
getElementById
(
"
console_find_highlight
"
);
console_find_highlight_all
(
highlight_checkbox
);
console_find_traverse
.
set_index
(
0
);
console_find_traverse
.
next
();
console_find_traverse
.
set_first_match
();
}
function
console_find_keypress
(
e
)
{
...
...
@@ -99,6 +99,12 @@ var console_find_traverse = (function () {
next
:
function
()
{
var
i
,
last
,
next
,
elements
=
console_text
.
getElementsByTagName
(
wrap_tag
);
count
++
;
if
(
count
>=
elements
.
length
)
{
count
=
0
;
}
else
if
(
count
<
0
)
{
count
=
elements
.
length
-
1
;
}
if
(
elements
.
length
>
0
)
{
i
=
count
%
elements
.
length
;
elements
[
i
].
classList
.
add
(
"
console_find_current
"
);
...
...
@@ -110,18 +116,58 @@ var console_find_traverse = (function () {
}
// adjust the scrollbar to make sure the element is visible,
// but only if necessary.
// I don't think this is available on all browsers...
var
isFirefox
=
typeof
InstallTrigger
!==
'
undefined
'
;
// checks if browser is Firefox or not
if
(
isFirefox
)
{
elements
[
i
].
scrollIntoView
();
}
else
{
elements
[
i
].
scrollIntoViewIfNeeded
();
}
count
++
;
}
},
previous
:
function
()
{
var
i
,
last
,
prev
,
elements
=
console_text
.
getElementsByTagName
(
wrap_tag
);
count
--
;
if
(
count
>=
elements
.
length
)
{
count
=
0
;
}
else
if
(
count
<
0
)
{
count
=
elements
.
length
-
1
;
}
if
(
elements
.
length
>
0
)
{
i
=
count
%
elements
.
length
;
elements
[
i
].
classList
.
add
(
"
console_find_current
"
);
if
(
elements
.
length
>
1
)
{
last
=
i
===
elements
.
length
-
1
?
0
:
i
+
1
;
prev
=
(
i
-
1
+
elements
.
length
)
%
elements
.
length
;
elements
[
last
].
classList
.
remove
(
"
console_find_current
"
);
elements
[
prev
].
classList
.
remove
(
"
console_find_current
"
);
}
// adjust the scrollbar to make sure the element is visible,
// but only if necessary.
var
isFirefox
=
typeof
InstallTrigger
!==
'
undefined
'
;
// checks if browser is Firefox or not
if
(
isFirefox
)
{
elements
[
i
].
scrollIntoView
();
}
else
{
elements
[
i
].
scrollIntoViewIfNeeded
();
}
}
},
set_index
:
function
(
c
)
{
count
=
c
;
},
set_first_match
:
function
()
{
var
elements
=
console_text
.
getElementsByTagName
(
wrap_tag
);
if
(
elements
.
length
>
0
)
{
elements
[
0
].
classList
.
add
(
"
console_find_current
"
);
}
// adjust the scrollbar to make sure the element is visible,
// but only if necessary.
var
isFirefox
=
typeof
InstallTrigger
!==
'
undefined
'
;
// checks ifbrowser is Firefox or not
if
(
isFirefox
)
{
elements
[
0
].
scrollIntoView
();
}
else
{
elements
[
0
].
scrollIntoViewIfNeeded
();
}
}
};
}());
...
...
@@ -140,3 +186,11 @@ function console_find_keydown(evt) {
}
}
function
console_find_below
()
{
console_find_traverse
.
next
();
}
function
console_find_above
()
{
console_find_traverse
.
previous
();
}
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment