Popup dimensions: now in storage
This commit is contained in:
parent
67e347b652
commit
6e23d4f3a5
|
@ -1,15 +1,17 @@
|
||||||
/**
|
/**
|
||||||
* Open the given url in a popup
|
* Open the given url in a popup
|
||||||
* @param {string} url -
|
* @param {string} url -
|
||||||
|
* @param {number} width -
|
||||||
|
* @param {number} height -
|
||||||
* @return {void} -
|
* @return {void} -
|
||||||
*/
|
*/
|
||||||
function openInPopup(url) {
|
function openInPopup(url, width, height) {
|
||||||
browser.windows.create({
|
browser.windows.create({
|
||||||
url,
|
url,
|
||||||
type: 'popup',
|
type: 'popup',
|
||||||
allowScriptsToClose: true,
|
allowScriptsToClose: true,
|
||||||
height: 600,
|
width,
|
||||||
width: 900,
|
height,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +28,7 @@ function shareCurrentTab(tab) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const shareUrl = `${storage.url}?post=${encodeURIComponent(url)}&title=${encodeURIComponent(title)}&source=bookmarklet`;
|
const shareUrl = `${storage.url}?post=${encodeURIComponent(url)}&title=${encodeURIComponent(title)}&source=bookmarklet`;
|
||||||
openInPopup(shareUrl);
|
openInPopup(shareUrl, storage.popupWidth, storage.popupHeight);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,8 @@ Default settings. Initialize storage to these values.
|
||||||
var storage = {
|
var storage = {
|
||||||
url: '',
|
url: '',
|
||||||
pageAction: false,
|
pageAction: false,
|
||||||
|
popupWidth: 900,
|
||||||
|
popupHeight: 600,
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue