Skip to content

Commit

Permalink
Integrated changes noted in PR #215 comments
Browse files Browse the repository at this point in the history
  • Loading branch information
PokkeFe committed Jun 30, 2021
1 parent 35e7165 commit 8db368c
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions text_extensions_for_pandas/resources/span_array.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Increment the version to invalidate the cached script
const VERSION = 0.75
const global_stylesheet = document.head.querySelector("style.span-array-css")
const local_stylesheet = document.currentScript.parentElement.querySelector("style.span-array-css")

if(window.SpanArray == undefined || window.SpanArray.VERSION == undefined || window.SpanArray.VERSION < VERSION) {

// Replace global SpanArray CSS with latest copy
const global_stylesheet = document.head.querySelector("style.span-array-css")
const local_stylesheet = document.currentScript.parentElement.querySelector("style.span-array-css")
if(local_stylesheet != undefined) {
if(global_stylesheet != undefined) {
document.head.removeChild(global_stylesheet)
Expand Down Expand Up @@ -385,17 +385,18 @@ if(window.SpanArray == undefined || window.SpanArray.VERSION == undefined || win
if(closest_tr == undefined) return

const matching_span = doc_object.lookup_table[closest_tr.getAttribute("data-id")]
if(matching_span == undefined) return

switch(closest_control_button.getAttribute("data-control")) {
case "visibility":
{
if(matching_span != undefined) matching_span.visible = !matching_span.visible
matching_span.visible = !matching_span.visible
source_spanarray.render()
}
break;
case "highlight":
{
if(matching_span != undefined) matching_span.highlighted = !matching_span.highlighted
matching_span.highlighted = !matching_span.highlighted
source_spanarray.render()
}
break;
Expand Down Expand Up @@ -437,9 +438,7 @@ if(window.SpanArray == undefined || window.SpanArray.VERSION == undefined || win
} else {
// SpanArray JS is already defined and not an outdated copy
// Replace global SpanArray CSS with latest copy IFF global stylesheet is undefined

const global_stylesheet = document.head.querySelector("style.span-array-css")
const local_stylesheet = document.currentScript.parentElement.querySelector("style.span-array-css")

if(local_stylesheet != undefined) {
if(global_stylesheet == undefined) {
document.head.appendChild(local_stylesheet)
Expand Down

0 comments on commit 8db368c

Please sign in to comment.