Skip to content

Commit

Permalink
Fixed remaining search focus bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
leggett committed Apr 18, 2019
1 parent d01a777 commit 589a2f5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion gmail/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Simplify Gmail",
"version": "1.2.0",
"version": "1.2.2",
"description": "Simplifies Gmail interface to the bare minimum",
"homepage_url": "https://simpl.fyi/gmail",
"icons": {
Expand Down
19 changes: 9 additions & 10 deletions gmail/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,18 +136,17 @@ if (location.hash.substring(1, 9) == "settings") {

// == SEARCH FUNCTIONS =====================================================

// Global variable to track if we should ignore focus (temp fix)
var ignoreSearchFocus = false;

/* Focus search input */
function toggleSearchFocus() {
function toggleSearchFocus() {
// We are about to show Search if hideSearch is still on the html tag
if (htmlEl.classList.contains('hideSearch')) {
document.querySelectorAll('div.gb_td form input')[0].blur();
document.querySelectorAll('div.gb_td form')[0].classList.remove('gb_oe');
document.querySelector('div.gb_td form').classList.remove('gb_oe');

// Remove focus from search input or button
document.activeElement.blur();
} else {
document.querySelectorAll('div.gb_td form')[0].classList.add('gb_oe');
document.querySelectorAll('div.gb_td form input')[0].focus();
document.querySelector('div.gb_td form').classList.add('gb_oe');
document.querySelector('div.gb_td form input').focus();
}
}

Expand All @@ -168,6 +167,8 @@ function initSearch() {
var searchButton = document.getElementsByClassName('gb_Ue')[0];
var searchIcon = searchButton.getElementsByTagName('svg')[0];
searchIcon.addEventListener('click', function(event) {
event.preventDefault();
event.stopPropagation();
htmlEl.classList.toggle('hideSearch');
searchForm.classList.toggle('gb_vd');
window.localStorage.simplifyHideSearch = htmlEl.classList.contains('hideSearch') ? true : false;
Expand Down Expand Up @@ -538,10 +539,8 @@ function testPagination() {

// Hide pagination control if the total count is less than 100
if (pageButtons.length >= 2) {
if (simplifyDebug) console.log('Hiding pagination controls');
pagination.style.display = "none";
} else {
if (simplifyDebug) console.log('Showing pagination controls');
pagination.style.display = "inline-block";
}
});
Expand Down

0 comments on commit 589a2f5

Please sign in to comment.