Procházet zdrojové kódy

added version debugger and toggle hover explainer

Nikita Krupin před 3 roky
rodič
revize
7c9a80a629

+ 37 - 1
Extensions/combined/popup.css

@@ -43,14 +43,50 @@ button:hover {
 }
 
 #ext-version {
+  padding: .25rem .5rem;
+}
+
+#ext-update {
+  cursor: pointer;
+  color: var(--white);
+  text-decoration: none;
+  background: var(--primary);
+  border-radius: .25rem;
+}
+#ext-update:hover {
+  text-decoration: underline;
+}
+
+#ext {
+  padding: .25rem 0;
   z-index: 69;
   position: fixed;
+  background: var(--secondary);
   margin: 0;
   bottom: 1.15rem;
   right: 1.15rem;
-  background: var(--secondary);
   border-radius: .25rem;
+}
+
+.switch::before {
+  content: attr(data-hover);
+  visibility: hidden;
+  opacity: 0;
+  width: 250px;
+  background-color: var(--secondary);
+  border-radius: .5rem;
   padding: .25rem .5rem;
+  transition: opacity .2 ease-in-out;
+
+  position: absolute;
+  z-index: 1;
+  left: 0;
+  top: 160%;
+}
+
+.switch:hover::before {
+  opacity: 1;
+  visibility: visible;
 }
 
 #advancedToggle {

+ 6 - 3
Extensions/combined/popup.html

@@ -65,16 +65,19 @@
     </button>
 
     <!-- bottom-right -->
-    <p id="ext-version"></p>
+    <div id="ext">
+      <a href="https://returnyoutubedislike.com/install" target="_blank" id="ext-update"></a>
+      <span id="ext-version"></span>
+    </div>
 
     <!-- dialog box -->
     <fieldset id="advancedSettings">
       <legend id="advancedLegend">Settings</legend>
 
-      <label class="switch">
+      <label class="switch" data-hover="Stops counting your likes and dislikes.">
         <input type="checkbox" id="disable_vote_submission" />
         <span class="slider" />
-        <span class="switchLabel">Disable like/dislike submission</span>
+        <span class="switchLabel">Disable vote submission</span>
       </label>
       <!-- <br />
       <label class="switch">

+ 13 - 0
Extensions/combined/popup.js

@@ -71,6 +71,19 @@ function initConfig() {
 function initializeVersionNumber() {
   const version = chrome.runtime.getManifest().version;
   document.getElementById('ext-version').innerHTML = 'v' + version;
+
+  fetch(
+    "https://raw.githubusercontent.com/Anarios/return-youtube-dislike/main/Extensions/combined/manifest-chrome.json"
+  )
+    .then((response) => response.json())
+    .then((json) => {
+      if (version !== json.version) {
+        document.getElementById('ext-update').innerHTML = 'update to v' + json.version;
+        document.getElementById('ext-update').style.padding = '.25rem .5rem';
+      }
+    });
+  // .catch(console.error);
+
 }
 
 function initializeDisableVoteSubmission() {