From 313ee2843670141c4cf2418bfea080485a41130a Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Wed, 2 Dec 2020 15:23:20 +0100 Subject: [PATCH] [Generic viewer] Re-factor how the `notFound` appearance is set on the "findInput" in the `PDFFindBar` Rather than having two slightly different ways of setting the pending/notFound appearance on the "findInput", we can simply use "data-status" in both cases since they're obviously mutually exclusive. --- web/pdf_find_bar.js | 5 +---- web/viewer.css | 7 +++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/web/pdf_find_bar.js b/web/pdf_find_bar.js index c444c2541b0c9..bd141bac07aff 100644 --- a/web/pdf_find_bar.js +++ b/web/pdf_find_bar.js @@ -104,7 +104,6 @@ class PDFFindBar { } updateUIState(state, previous, matchesCount) { - let notFound = false; let findMsg = ""; let status = ""; @@ -118,7 +117,7 @@ class PDFFindBar { case FindState.NOT_FOUND: findMsg = this.l10n.get("find_not_found", null, "Phrase not found"); - notFound = true; + status = "notFound"; break; case FindState.WRAPPED: @@ -137,8 +136,6 @@ class PDFFindBar { } break; } - - this.findField.classList.toggle("notFound", notFound); this.findField.setAttribute("data-status", status); Promise.resolve(findMsg).then(msg => { diff --git a/web/viewer.css b/web/viewer.css index b8188a4a22163..6dd8da167e168 100644 --- a/web/viewer.css +++ b/web/viewer.css @@ -582,6 +582,9 @@ html[dir="rtl"] #findInput { html[dir="rtl"] #findInput[data-status="pending"] { background-position: 3px; } +#findInput[data-status="notFound"] { + background-color: rgba(255, 102, 102, 1); +} .secondaryToolbar { padding: 6px 0 10px 0; @@ -682,10 +685,6 @@ html[dir="ltr"] .doorHangerRight:before { display: none; } -#findInput.notFound { - background-color: rgba(255, 102, 102, 1); -} - #toolbarViewerMiddle { position: absolute; left: 50%;