diff options
author | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-03-21 08:05:10 +0100 |
---|---|---|
committer | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-03-21 08:05:10 +0100 |
commit | 15df6e149d514b4ac2e9bdc0b094c7998c0ee338 (patch) | |
tree | 299ed283fb7ffd7e856eb5f941bc9ad3e78b1546 | |
parent | dcd332ecece7e1eaa73179a8497e6469488f8048 (diff) | |
download | palemoon-gre-15df6e149d514b4ac2e9bdc0b094c7998c0ee338.tar.gz |
"Enter address" if the feature "autocomplete" is disabled
Issue #1651
-rw-r--r-- | browser/base/content/browser.js | 47 | ||||
-rw-r--r-- | browser/base/content/browser.xul | 2 | ||||
-rw-r--r-- | browser/locales/en-US/chrome/browser/browser.dtd | 1 | ||||
-rw-r--r-- | browser/locales/en-US/chrome/browser/browser.properties | 2 |
4 files changed, 50 insertions, 2 deletions
diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 34b91b6cb..2e90b5622 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -336,6 +336,39 @@ const gSessionHistoryObserver = { } }; +var gURLBarSettings = { + prefSuggestBookmark: "browser.urlbar.suggest.bookmark", + prefSuggestHistory: "browser.urlbar.suggest.history", + prefSuggestOpenpage: "browser.urlbar.suggest.openpage", + + observe: function(aSubject, aTopic, aData) { + if (aTopic != "nsPref:changed") + return; + + this.writePlaceholder(); + }, + + writePlaceholder: function() { + let attribute = "placeholder"; + let suggests = [ + this.prefSuggestBookmark, + this.prefSuggestHistory, + this.prefSuggestOpenpage, + ]; + let placeholderDefault = suggests.some(pref => { + return gPrefService.getBoolPref(pref); + }); + + if (placeholderDefault) { + gURLBar.setAttribute( + attribute, gNavigatorBundle.getString("urlbar.placeholder")); + } else { + gURLBar.setAttribute( + attribute, gNavigatorBundle.getString("urlbar.placeholderURLOnly")); + } + } +}; + /** * Given a starting docshell and a URI to look up, find the docshell the URI * is loaded in. @@ -968,6 +1001,12 @@ var gBrowserInit = { Services.obs.addObserver(gXPInstallObserver, "addon-install-complete", false); Services.obs.addObserver(gXSSObserver, "xss-on-violate-policy", false); + gPrefService.addObserver(gURLBarSettings.prefSuggestBookmark, gURLBarSettings, false); + gPrefService.addObserver(gURLBarSettings.prefSuggestHistory, gURLBarSettings, false); + gPrefService.addObserver(gURLBarSettings.prefSuggestOpenpage, gURLBarSettings, false); + + gURLBarSettings.writePlaceholder(); + BrowserOffline.init(); OfflineApps.init(); IndexedDBPromptHelper.init(); @@ -1314,6 +1353,14 @@ var gBrowserInit = { Services.obs.removeObserver(gXSSObserver, "xss-on-violate-policy"); try { + gPrefService.removeObserver(gURLBarSettings.prefSuggestBookmark, gURLBarSettings); + gPrefService.removeObserver(gURLBarSettings.prefSuggestHistory, gURLBarSettings); + gPrefService.removeObserver(gURLBarSettings.prefSuggestOpenpage, gURLBarSettings); + } catch (ex) { + Cu.reportError(ex); + } + + try { gPrefService.removeObserver(gHomeButton.prefDomain, gHomeButton); } catch (ex) { Cu.reportError(ex); diff --git a/browser/base/content/browser.xul b/browser/base/content/browser.xul index f83010023..3044ce675 100644 --- a/browser/base/content/browser.xul +++ b/browser/base/content/browser.xul @@ -410,7 +410,7 @@ <toolbaritem id="urlbar-container" align="center" flex="400" persist="width" combined="true" title="&locationItem.title;" class="chromeclass-location" removable="true"> <textbox id="urlbar" flex="1" - placeholder="&urlbar.placeholder2;" + placeholder="" type="autocomplete" autocompletesearch="urlinline history" autocompletesearchparam="enable-actions" diff --git a/browser/locales/en-US/chrome/browser/browser.dtd b/browser/locales/en-US/chrome/browser/browser.dtd index fe5f64854..0225f422b 100644 --- a/browser/locales/en-US/chrome/browser/browser.dtd +++ b/browser/locales/en-US/chrome/browser/browser.dtd @@ -337,7 +337,6 @@ These should match what Safari and other Apple applications use on OS X Lion. -- <!ENTITY appMenuSafeMode.label "Restart in Safe Modeā¦"> <!ENTITY openCmd.commandkey "l"> -<!ENTITY urlbar.placeholder2 "Search or enter address"> <!ENTITY urlbar.accesskey "d"> <!ENTITY urlbar.switchToTab.label "Switch to tab:"> diff --git a/browser/locales/en-US/chrome/browser/browser.properties b/browser/locales/en-US/chrome/browser/browser.properties index 5f75502ed..8b3fea4d5 100644 --- a/browser/locales/en-US/chrome/browser/browser.properties +++ b/browser/locales/en-US/chrome/browser/browser.properties @@ -220,6 +220,8 @@ tabHistory.goBack=Go back to this page tabHistory.goForward=Go forward to this page # URL Bar +urlbar.placeholder=Search or enter address +urlbar.placeholderURLOnly=Enter address pasteAndGo.label=Paste & Go # Block autorefresh |