summaryrefslogtreecommitdiffstats
path: root/browser/components/pocket/content/panels/js/sendtomobile.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
commit2aa4a82499d4becd2284cdb482213d541b8804dd (patch)
treeb80bf8bf13c3766139fbacc530efd0dd9d54394c /browser/components/pocket/content/panels/js/sendtomobile.js
parentInitial commit. (diff)
downloadfirefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz
firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/components/pocket/content/panels/js/sendtomobile.js')
-rw-r--r--browser/components/pocket/content/panels/js/sendtomobile.js53
1 files changed, 53 insertions, 0 deletions
diff --git a/browser/components/pocket/content/panels/js/sendtomobile.js b/browser/components/pocket/content/panels/js/sendtomobile.js
new file mode 100644
index 0000000000..0bdfbfa25d
--- /dev/null
+++ b/browser/components/pocket/content/panels/js/sendtomobile.js
@@ -0,0 +1,53 @@
+/* global $:false, Handlebars:false, thePKT_SAVED:false, */
+
+var PKT_SENDTOMOBILE = (function() {
+ var width = 350;
+ var ctaHeight = 200; // iframe height
+ var confirmHeight = 275;
+ var premDetailsHeight = 110;
+ var email = null;
+
+ function _initPanelOneClicks() {
+ $("#pkt_ext_sendtomobile_button").click(function() {
+ $("#pkt_ext_sendtomobile_button").replaceWith(
+ '<div class="pkt_ext_loadingspinner"><div></div></div>'
+ );
+
+ thePKT_SAVED.sendMessage("getMobileDownload", {}, function(data) {
+ if (data.status == 1) {
+ $("body").html(Handlebars.templates.ho2_download({ email }));
+ thePKT_SAVED.sendMessage("resizePanel", {
+ width,
+ height: confirmHeight,
+ });
+ } else {
+ $("body").html(Handlebars.templates.ho2_download_error({ email }));
+ thePKT_SAVED.sendMessage("resizePanel", {
+ width,
+ height: confirmHeight,
+ });
+ }
+ });
+ });
+ }
+
+ function create(ho2, displayName, adjustHeight) {
+ email = displayName;
+ $("body").addClass("pkt_ext_ho2_experiment");
+ var height = adjustHeight ? premDetailsHeight : 0;
+
+ // Show "Send to your phone" CTA
+ height += ctaHeight;
+ $("body").append(Handlebars.templates.ho2_sharebutton());
+ thePKT_SAVED.sendMessage("resizePanel", { width, height });
+
+ _initPanelOneClicks();
+ }
+
+ /**
+ * Public functions
+ */
+ return {
+ create,
+ };
+})();