about summary refs log tree commit diff stats
path: root/src/pages
diff options
context:
space:
mode:
authorManeraKai <manerakai@protonmail.com>2022-05-21 02:38:24 +0300
committerManeraKai <manerakai@protonmail.com>2022-05-21 02:38:24 +0300
commit51b0df71b9220e3d0b84d25ba67818897c33610c (patch)
tree28661a83b1a8742489dc7956b0a199abf83af948 /src/pages
parentMerge branch 'master' of https://github.com/libredirect/libredirect (diff)
downloadlibredirect-51b0df71b9220e3d0b84d25ba67818897c33610c.zip
Cleaned code. Fixed thing in CopyRaw #268
Diffstat (limited to 'src/pages')
-rw-r--r--src/pages/popup/popup.html4
-rw-r--r--src/pages/popup/popup.js11
-rw-r--r--src/pages/popup/popup.pug4
3 files changed, 13 insertions, 6 deletions
diff --git a/src/pages/popup/popup.html b/src/pages/popup/popup.html
index b815bc1d..db7148c9 100644
--- a/src/pages/popup/popup.html
+++ b/src/pages/popup/popup.html
@@ -94,12 +94,12 @@
           <path d="M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z"></path>
         </svg>
         <h4>Settings</h4></a></div>
-    <div class="some-block" title="Copy the original redirected link">        <a class="title button" id="copy_raw">
+    <div class="some-block" id="copy_raw_div" title="Copy the original redirected link">        <a class="title button" id="copy_raw">
         <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor">
           <path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"></path>
         </svg>
         <h4>Copy Raw</h4></a></div>
-    <div class="some-block" title="Unify cookies across all selected instances"><a class="title button" id="unify">
+    <div class="some-block" id="unify_div" title="Unify cookies across all selected instances"><a class="title button" id="unify">
         <svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor">
           <rect fill="none" height="24" width="24"></rect>
           <path d="M18,2H9C7.9,2,7,2.9,7,4v12c0,1.1,0.9,2,2,2h9c1.1,0,2-0.9,2-2V4C20,2.9,19.1,2,18,2z M18,16H9V4h9V16z M3,15v-2h2v2H3z M3,9.5h2v2H3V9.5z M10,20h2v2h-2V20z M3,18.5v-2h2v2H3z M5,22c-1.1,0-2-0.9-2-2h2V22z M8.5,22h-2v-2h2V22z M13.5,22L13.5,22l0-2h2 v0C15.5,21.1,14.6,22,13.5,22z M5,6L5,6l0,2H3v0C3,6.9,3.9,6,5,6z"></path>
diff --git a/src/pages/popup/popup.js b/src/pages/popup/popup.js
index e465a7e0..dc6c373f 100644
--- a/src/pages/popup/popup.js
+++ b/src/pages/popup/popup.js
@@ -78,9 +78,16 @@ document.addEventListener("change", () => {
 })
 
 document.getElementById("change_instance").addEventListener("click", utils.switchInstance);
-document.getElementById('copy_raw').addEventListener("click", utils.copyRaw);
+let copyRawElement = document.getElementById('copy_raw');
+copyRawElement.addEventListener("click", () => utils.copyRaw(false, copyRawElement));
+
+utils.copyRaw(true).then(r => { if (!r) document.getElementById('copy_raw_div').style.display = 'none'; })
+// utils.unify().then(r => { if (!r) document.getElementById('unify_div').style.display = 'none'; })
+
 document.getElementById("more-options").addEventListener("click", () => browser.runtime.openOptionsPage());
-document.getElementById('unify').addEventListener("click", unify);
+
+let unifyElement = document.getElementById('unify');
+unifyElement.addEventListener("click", () => utils.unify(unifyElement));
 
 generalHelper.init().then(() => {
   let popupFrontends = generalHelper.getPopupFrontends();
diff --git a/src/pages/popup/popup.pug b/src/pages/popup/popup.pug
index 97f6d045..12588679 100644
--- a/src/pages/popup/popup.pug
+++ b/src/pages/popup/popup.pug
@@ -108,12 +108,12 @@ html(lang="en")
                 +settings
                 h4 Settings
 
-        .some-block(title="Copy the original redirected link")         
+        #copy_raw_div.some-block(title="Copy the original redirected link")         
             a#copy_raw.title.button
                 +copy_raw
                 h4 Copy Raw
 
-        .some-block(title="Unify cookies across all selected instances")
+        #unify_div.some-block(title="Unify cookies across all selected instances")
             a#unify.title.button
                 +unify
                 h4 Unify Settings