summaryrefslogtreecommitdiffstats
path: root/application/palemoon/base/content/browser.js
diff options
context:
space:
mode:
authorjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-04-15 11:46:16 +0200
committerjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-04-15 11:46:16 +0200
commitd432689a50bc57be3b38e0b8ec8e1171bc26b2b2 (patch)
treede9241e5f14e482d4b7f1e9cc0e37e8243ca7196 /application/palemoon/base/content/browser.js
parent60d29fb2861768032b831b77541e06de03b6ded2 (diff)
downloadUXP-d432689a50bc57be3b38e0b8ec8e1171bc26b2b2.tar
UXP-d432689a50bc57be3b38e0b8ec8e1171bc26b2b2.tar.gz
UXP-d432689a50bc57be3b38e0b8ec8e1171bc26b2b2.tar.lz
UXP-d432689a50bc57be3b38e0b8ec8e1171bc26b2b2.tar.xz
UXP-d432689a50bc57be3b38e0b8ec8e1171bc26b2b2.zip
Bug 92737 - Part 5: Set multiple homepage when multiple items are dropped on Home button
Issue #121
Diffstat (limited to 'application/palemoon/base/content/browser.js')
-rw-r--r--application/palemoon/base/content/browser.js22
1 files changed, 15 insertions, 7 deletions
diff --git a/application/palemoon/base/content/browser.js b/application/palemoon/base/content/browser.js
index e05eca986..efd26c2b9 100644
--- a/application/palemoon/base/content/browser.js
+++ b/application/palemoon/base/content/browser.js
@@ -2686,8 +2686,10 @@ var homeButtonObserver = {
onDrop: function (aEvent)
{
// disallow setting home pages that inherit the principal
- let url = browserDragAndDrop.drop(aEvent, {}, true);
- setTimeout(openHomeDialog, 0, url);
+ let links = browserDragAndDrop.dropLinks(aEvent, true);
+ if (links.length) {
+ setTimeout(openHomeDialog, 0, links.map(link => link.url).join("|"));
+ }
},
onDragOver: function (aEvent)
@@ -2703,18 +2705,24 @@ var homeButtonObserver = {
function openHomeDialog(aURL)
{
var promptTitle = gNavigatorBundle.getString("droponhometitle");
- var promptMsg = gNavigatorBundle.getString("droponhomemsg");
+ var promptMsg;
+ if (aURL.includes("|")) {
+ promptMsg = gNavigatorBundle.getString("droponhomemsgMultiple");
+ } else {
+ promptMsg = gNavigatorBundle.getString("droponhomemsg");
+ }
+
var pressedVal = Services.prompt.confirmEx(window, promptTitle, promptMsg,
Services.prompt.STD_YES_NO_BUTTONS,
null, null, null, null, {value:0});
if (pressedVal == 0) {
try {
- var str = Components.classes["@mozilla.org/supports-string;1"]
- .createInstance(Components.interfaces.nsISupportsString);
- str.data = aURL;
+ var homepageStr = Components.classes["@mozilla.org/supports-string;1"]
+ .createInstance(Components.interfaces.nsISupportsString);
+ homepageStr.data = aURL;
gPrefService.setComplexValue("browser.startup.homepage",
- Components.interfaces.nsISupportsString, str);
+ Components.interfaces.nsISupportsString, homepageStr);
} catch (ex) {
dump("Failed to set the home page.\n"+ex+"\n");
}