Skip to content

Commit

Permalink
[Generic viewer] Re-factor how the notFound appearance is set on th…
Browse files Browse the repository at this point in the history
…e "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.
  • Loading branch information
Snuffleupagus committed Dec 2, 2020
1 parent 956fcab commit 313ee28
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
5 changes: 1 addition & 4 deletions web/pdf_find_bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ class PDFFindBar {
}

updateUIState(state, previous, matchesCount) {
let notFound = false;
let findMsg = "";
let status = "";

Expand All @@ -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:
Expand All @@ -137,8 +136,6 @@ class PDFFindBar {
}
break;
}

this.findField.classList.toggle("notFound", notFound);
this.findField.setAttribute("data-status", status);

Promise.resolve(findMsg).then(msg => {
Expand Down
7 changes: 3 additions & 4 deletions web/viewer.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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%;
Expand Down

0 comments on commit 313ee28

Please sign in to comment.