diff options
Diffstat (limited to 'application/palemoon/base')
-rw-r--r-- | application/palemoon/base/content/browser.js | 54 | ||||
-rw-r--r-- | application/palemoon/base/content/browser.xul | 2 | ||||
-rw-r--r-- | application/palemoon/base/content/content.js | 6 | ||||
-rw-r--r-- | application/palemoon/base/content/tabbrowser.xml | 13 |
4 files changed, 72 insertions, 3 deletions
diff --git a/application/palemoon/base/content/browser.js b/application/palemoon/base/content/browser.js index 34b91b6cb..5a832c077 100644 --- a/application/palemoon/base/content/browser.js +++ b/application/palemoon/base/content/browser.js @@ -336,6 +336,48 @@ const gSessionHistoryObserver = { } }; +var gURLBarSettings = { + prefSuggest: "browser.urlbar.suggest.", + /* + For searching in the source code: + browser.urlbar.suggest.bookmark + browser.urlbar.suggest.history + browser.urlbar.suggest.openpage + */ + prefSuggests: [ + "bookmark", + "history", + "openpage" + ], + prefKeyword: "keyword.enabled", + + observe: function(aSubject, aTopic, aData) { + if (aTopic != "nsPref:changed") + return; + + this.writePlaceholder(); + }, + + writePlaceholder: function() { + let attribute = "placeholder"; + let prefs = this.prefSuggests.map(pref => { + return this.prefSuggest + pref; + }); + prefs.push(this.prefKeyword); + let placeholderDefault = prefs.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 +1010,11 @@ var gBrowserInit = { Services.obs.addObserver(gXPInstallObserver, "addon-install-complete", false); Services.obs.addObserver(gXSSObserver, "xss-on-violate-policy", false); + gPrefService.addObserver(gURLBarSettings.prefSuggest, gURLBarSettings, false); + gPrefService.addObserver(gURLBarSettings.prefKeyword, gURLBarSettings, false); + + gURLBarSettings.writePlaceholder(); + BrowserOffline.init(); OfflineApps.init(); IndexedDBPromptHelper.init(); @@ -1314,6 +1361,13 @@ var gBrowserInit = { Services.obs.removeObserver(gXSSObserver, "xss-on-violate-policy"); try { + gPrefService.removeObserver(gURLBarSettings.prefSuggest, gURLBarSettings); + gPrefService.removeObserver(gURLBarSettings.prefKeyword, gURLBarSettings); + } catch (ex) { + Cu.reportError(ex); + } + + try { gPrefService.removeObserver(gHomeButton.prefDomain, gHomeButton); } catch (ex) { Cu.reportError(ex); diff --git a/application/palemoon/base/content/browser.xul b/application/palemoon/base/content/browser.xul index f83010023..3044ce675 100644 --- a/application/palemoon/base/content/browser.xul +++ b/application/palemoon/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/application/palemoon/base/content/content.js b/application/palemoon/base/content/content.js index 19032eb84..3587bbeef 100644 --- a/application/palemoon/base/content/content.js +++ b/application/palemoon/base/content/content.js @@ -61,4 +61,8 @@ addEventListener("blur", function(event) { addMessageListener("Finder:Initialize", function () { let {RemoteFinderListener} = Cu.import("resource://gre/modules/RemoteFinder.jsm", {}); new RemoteFinderListener(global); -});
\ No newline at end of file +}); + +addEventListener("DOMWebNotificationClicked", function(event) { + sendAsyncMessage("DOMWebNotificationClicked", {}); +}, false); diff --git a/application/palemoon/base/content/tabbrowser.xml b/application/palemoon/base/content/tabbrowser.xml index b8d5f3e41..51f7063f3 100644 --- a/application/palemoon/base/content/tabbrowser.xml +++ b/application/palemoon/base/content/tabbrowser.xml @@ -2950,13 +2950,23 @@ let browser = aMessage.target; switch (aMessage.name) { - case "DOMTitleChanged": + case "DOMTitleChanged": { let tab = this.getTabForBrowser(browser); if (!tab) return; let titleChanged = this.setTabTitle(tab); if (titleChanged && !tab.selected && !tab.hasAttribute("busy")) tab.setAttribute("titlechanged", "true"); + break; + } + case "DOMWebNotificationClicked": { + let tab = this.getTabForBrowser(browser); + if (!tab) + return; + this.selectedTab = tab; + window.focus(); + break; + } } ]]></body> </method> @@ -3022,6 +3032,7 @@ this._outerWindowIDBrowserMap.set(this.mCurrentBrowser.outerWindowID, this.mCurrentBrowser); } + messageManager.addMessageListener("DOMWebNotificationClicked", this); ]]> </constructor> |