Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
nopaque
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SFB 1288 - INF
nopaque
Commits
d16e749e
Commit
d16e749e
authored
4 years ago
by
Patrick Jentsch
Browse files
Options
Downloads
Plain Diff
Merge branch 'development' of gitlab.ub.uni-bielefeld.de:sfb1288inf/opaque into development
parents
7dd27fb0
b4c98a97
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/corpora/views.py
+2
-2
2 additions, 2 deletions
app/corpora/views.py
app/static/js/nopaque.lists.js
+61
-21
61 additions, 21 deletions
app/static/js/nopaque.lists.js
app/templates/corpora/analyse_corpus.html.j2
+1
-1
1 addition, 1 deletion
app/templates/corpora/analyse_corpus.html.j2
with
64 additions
and
24 deletions
app/corpora/views.py
+
2
−
2
View file @
d16e749e
...
...
@@ -61,8 +61,8 @@ def analyse_corpus(corpus_id):
results_per_page
=
request
.
args
.
get
(
'
results_per_page
'
,
30
))
query_form
=
QueryForm
(
prefix
=
'
query-form
'
,
query
=
request
.
args
.
get
(
'
query
'
))
query_download_form
=
QueryDownloadForm
()
inspect_display_options_form
=
InspectDisplayOptionsForm
(
prefix
=
'
query_download_
form
'
)
query_download_form
=
QueryDownloadForm
(
prefix
=
'
query-download-form
'
)
inspect_display_options_form
=
InspectDisplayOptionsForm
(
prefix
=
'
inspect-display-options-
form
'
)
return
render_template
(
'
corpora/analyse_corpus.html.j2
'
,
corpus_id
=
corpus_id
,
display_options_form
=
display_options_form
,
...
...
This diff is collapsed.
Click to expand it.
app/static/js/nopaque.lists.js
+
61
−
21
View file @
d16e749e
...
...
@@ -193,22 +193,24 @@ class ResultsList extends List {
let
contextModalLoading
;
let
contextModalReady
;
let
contextResultsElement
;
let
modalExpertModeSwitchElement
;
let
highlightSentencesSwitchElement
;
let
htmlTokenStr
;
let
lc
;
let
modalExpertModeSwitchElement
;
let
modalTokenElements
;
let
nrOfContextSentences
;
let
partElement
;
let
rc
;
let
token
;
let
tokenHTMLArray
;
let
uniqueS
;
let
htmlTokenStr
;
let
tokenHTMlElement
;
let
uniqueS
;
this
.
contextData
=
response
.
payload
;
contextResultsElement
=
document
.
getElementById
(
"
context-results
"
);
modalExpertModeSwitchElement
=
document
.
getElementById
(
"
query_download_form-expert_mode_inspect
"
);
highlightSentencesSwitchElement
=
document
.
getElementById
(
"
query_download_form-highlight_sentences
"
);
modalExpertModeSwitchElement
=
document
.
getElementById
(
"
inspect-display-options-form-expert_mode_inspect
"
);
highlightSentencesSwitchElement
=
document
.
getElementById
(
"
inspect-display-options-form-highlight_sentences
"
);
nrOfContextSentences
=
document
.
getElementById
(
"
context-sentences
"
);
uniqueS
=
new
Set
();
// check if cpos ranges are used or not
if
(
this
.
contextData
.
cpos_ranges
==
true
)
{
...
...
@@ -276,51 +278,87 @@ class ResultsList extends List {
contextResultsElement
.
appendChild
(
sentenceElement
);
}
modalExpertModeSwitchElement
.
addEventListener
(
"
change
"
,
(
event
)
=>
{
// add inspect display options events
modalExpertModeSwitchElement
.
onchange
=
(
event
)
=>
{
if
(
event
.
target
.
checked
)
{
this
.
expertModeOn
(
"
context-results
"
);
}
else
{
this
.
expertModeOff
(
"
context-results
"
)
}
}
)
;
};
if
(
modalExpertModeSwitchElement
.
checked
)
{
this
.
expertModeOn
(
"
context-results
"
);
}
highlightSentencesSwitchElement
.
addEventListener
(
"
change
"
,
(
event
)
=>
{
highlightSentencesSwitchElement
.
onchange
=
(
event
)
=>
{
if
(
event
.
target
.
checked
)
{
this
.
higlightContextSentences
();
}
else
{
this
.
unhighlightContextSentences
();
}
});
};
nrOfContextSentences
.
onchange
=
(
event
)
=>
{
console
.
log
(
event
.
target
.
value
);
this
.
changeSentenceContext
(
event
.
target
.
value
);
}
// checks on new modal opening if switches are checked
// if switches are checked functions are executed
if
(
modalExpertModeSwitchElement
.
checked
)
{
this
.
expertModeOn
(
"
context-results
"
);
}
if
(
highlightSentencesSwitchElement
.
checked
)
{
this
.
higlightContextSentences
();
}
// checks the value of the number of sentences to show on modal opening
// sets context sentences accordingly
this
.
changeSentenceContext
(
nrOfContextSentences
.
value
)
}
higlightContextSentences
()
{
let
sentences
;
sentences
=
document
.
getElementById
(
"
context-results
"
).
getElementsByClassName
(
"
sentence
"
);
for
(
let
s
of
sentences
)
{
s
.
insertAdjacentHTML
(
"
afte
rend
"
,
`<
br
>`
)
s
.
insertAdjacentHTML
(
"
befo
re
e
nd
"
,
`<
span><br><br></span
>`
)
}
}
unhighlightContextSentences
()
{
let
sentences
;
let
sibling
;
let
br
;
sentences
=
document
.
getElementById
(
"
context-results
"
).
getElementsByClassName
(
"
sentence
"
);
for
(
let
s
of
sentences
)
{
sibling
=
s
.
nextSibling
;
sibling
.
remove
();
br
=
s
.
lastChild
;
br
.
remove
();
}
}
changeSentenceContext
(
sValue
)
{
// TODO:
changeSentenceContext
(
sValue
,
maxSValue
=
10
)
{
let
array
;
let
sentences
;
let
toHideArray
;
let
toShowArray
;
sValue
=
maxSValue
-
sValue
;
console
.
log
(
sValue
);
sentences
=
document
.
getElementById
(
"
context-results
"
).
getElementsByClassName
(
"
sentence
"
);
array
=
Array
.
from
(
sentences
);
if
(
sValue
!=
0
)
{
toHideArray
=
array
.
slice
(
0
,
sValue
).
concat
(
array
.
slice
(
-
(
sValue
)));
toShowArray
=
array
.
slice
(
sValue
,
9
).
concat
(
array
.
slice
(
9
,
-
(
sValue
)))
}
else
{
toHideArray
=
[];
toShowArray
=
array
;
}
console
.
log
(
array
);
console
.
log
(
"
#######
"
);
console
.
log
(
toHideArray
);
for
(
let
s
of
toHideArray
)
{
s
.
classList
.
add
(
"
hide
"
);
}
for
(
let
s
of
toShowArray
)
{
s
.
classList
.
remove
(
"
hide
"
);
}
}
// ###### Display options changing live how the matches are being displayed ######
...
...
@@ -332,8 +370,9 @@ class ResultsList extends List {
// console.log(this);
this
.
page
=
event
.
target
.
value
;
this
.
update
();
this
.
activateInspect
();
if
(
expertModeSwitchElement
.
checked
)
{
this
.
expertModeOn
();
// page holds new result rows, so add new tooltips
this
.
expertModeOn
(
"
query-display
"
);
// page holds new result rows, so add new tooltips
}
nopaque
.
flash
(
"
Updated matches per page.
"
)
}
catch
(
e
)
{
...
...
@@ -417,11 +456,11 @@ class ResultsList extends List {
this
.
currentExpertTokenElements
[
htmlId
]
=
document
.
getElementById
(
htmlId
).
getElementsByClassName
(
"
token
"
);
this
.
tooltipEventCreateBind
=
this
.
tooltipEventCreate
.
bind
(
this
);
this
.
tooltipEventDestroyBind
=
this
.
tooltipEventDestroy
.
bind
(
this
);
this
.
eventTokens
[
htmlId
]
=
[];
for
(
let
tokenElement
of
this
.
currentExpertTokenElements
[
htmlId
])
{
tokenElement
.
classList
.
add
(
"
chip
"
,
"
hoverable
"
,
"
expert-view
"
);
tokenElement
.
onmouseover
=
this
.
tooltipEventCreateBind
;
tokenElement
.
onmouseout
=
this
.
tooltipEventDestroyBind
;
this
.
eventTokens
[
htmlId
]
=
[];
this
.
eventTokens
[
htmlId
].
push
(
tokenElement
);
}
}
...
...
@@ -463,6 +502,7 @@ class ResultsList extends List {
tokenElement
.
classList
.
remove
(
"
chip
"
,
"
hoverable
"
,
"
expert-view
"
);
}
this
.
currentExpertTokenElements
[
htmlId
]
=
[];
for
(
let
eventToken
of
this
.
eventTokens
[
htmlId
])
{
eventToken
.
onmouseover
=
""
;
eventToken
.
onmouseout
=
""
;
...
...
This diff is collapsed.
Click to expand it.
app/templates/corpora/analyse_corpus.html.j2
+
1
−
1
View file @
d16e749e
...
...
@@ -234,7 +234,7 @@
</div>
</div>
<div class="modal-footer">
<a href="#!" class="left waves-effect waves-light btn">Export</a>
<a href="#!" class="left waves-effect waves-light btn
disabled
">Export</a>
<a href="#!" class="modal-close waves-effect waves-light red btn">Close</a>
</div>
</div>
...
...
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