diff options
author | Deathamns <deathamns@gmail.com> | 2014-10-25 09:50:37 +0200 |
---|---|---|
committer | Deathamns <deathamns@gmail.com> | 2014-11-09 17:40:48 +0100 |
commit | 99d8f431d5c7b393dcf8cbe6382beec13c29f781 (patch) | |
tree | 5d31cb3d2d6222fbd9a53d44ccf41dd10d24cf6b /src | |
parent | 54749b31fbdcedcaf601fe4bce00b3ce15d04532 (diff) | |
download | uBlock-99d8f431d5c7b393dcf8cbe6382beec13c29f781.zip uBlock-99d8f431d5c7b393dcf8cbe6382beec13c29f781.tar.gz uBlock-99d8f431d5c7b393dcf8cbe6382beec13c29f781.tar.bz2 |
input[type="file"].click() didn't work in Safari
Click couldn't be initiated with JavaScript in Safari if the input was
hidden with display: none. Using visibility: hidden or opacity: 0 solves
the problem.
Alternative solution would be to hide (opacity: 0) the input and slide it
(position: absolute; top: 0; left: 0; width: 100%; height: 100%) over the
button, which would work in all browsers, and wouldn't require JavaScript.
Diffstat (limited to 'src')
-rw-r--r-- | src/1p-filters.html | 2 | ||||
-rw-r--r-- | src/about.html | 2 | ||||
-rw-r--r-- | src/css/common.css | 16 | ||||
-rw-r--r-- | src/whitelist.html | 2 |
4 files changed, 14 insertions, 8 deletions
diff --git a/src/1p-filters.html b/src/1p-filters.html index 7c959d0..1705b5f 100644 --- a/src/1p-filters.html +++ b/src/1p-filters.html @@ -13,7 +13,7 @@ <div> <p data-i18n="1pFormatHint"></p> <p><button id="importUserFiltersFromFile" data-i18n="1pImport"></button>   <button id="exportUserFiltersToFile" data-i18n="1pExport"></button></p> - <input id="importFilePicker" type="file" accept="text/plain" style="display:none;"> + <input id="importFilePicker" type="file" accept="text/plain" class="hiddenFileInput"> <textarea class="userFilters" id="userFilters" dir="auto" spellcheck="false"></textarea> <p><button id="userFiltersApply" disabled="true" data-i18n="1pApplyChanges"></button></p> </div> diff --git a/src/about.html b/src/about.html index 20a47c1..e7507c0 100644 --- a/src/about.html +++ b/src/about.html @@ -26,7 +26,7 @@ <div style="margin:1em 0 0 0;"> <p><button type="button" id="export" data-i18n="aboutBackupDataButton"></button> <button type="button" id="import" data-i18n="aboutRestoreDataButton"></button> - <input id="restoreFilePicker" type="file" accept="text/plain" style="display:none;"> + <input id="restoreFilePicker" type="file" accept="text/plain" class="hiddenFileInput"> <p> <p><button type="button" id="reset" data-i18n="aboutResetDataButton"></button> </div> diff --git a/src/css/common.css b/src/css/common.css index 3509396..ba52e1f 100644 --- a/src/css/common.css +++ b/src/css/common.css @@ -1,9 +1,9 @@ @font-face { - font-family: 'FontAwesome'; - src: url('fonts/fontawesome-webfont.ttf') format('truetype'); - font-weight: normal; - font-style: normal; -} + font-family: 'FontAwesome'; + src: url('fonts/fontawesome-webfont.ttf') format('truetype'); + font-weight: normal; + font-style: normal; + } .fa { font-family: FontAwesome; font-style: normal; @@ -64,3 +64,9 @@ body[dir=rtl] [data-tip][data-tip-anchor="top"]:hover:after { 85% { opacity: 0; } 100% { opacity: 1; } } + +.hiddenFileInput { + visibility: hidden; + width: 0; + height: 0; + } diff --git a/src/whitelist.html b/src/whitelist.html index 3980cbc..c1a0b0a 100644 --- a/src/whitelist.html +++ b/src/whitelist.html @@ -13,7 +13,7 @@ <div> <p data-i18n="whitelistPrompt"></p> <p><button id="importWhitelistFromFile" data-i18n="whitelistImport"></button>   <button id="exportWhitelistToFile" data-i18n="whitelistExport"></button></p> - <input id="importFilePicker" type="file" accept="text/plain" style="display:none;"> + <input id="importFilePicker" type="file" accept="text/plain" class="hiddenFileInput"> <textarea id="whitelist" dir="auto" spellcheck="false"></textarea> <p><button id="whitelistApply" type="button" disabled="true" data-i18n="whitelistApply"></button></p> </div> |