Explorar o código

optimizations

Front %!s(int64=3) %!d(string=hai) anos
pai
achega
a8b79f05e9
Modificáronse 1 ficheiros con 2 adicións e 7 borrados
  1. 2 7
      Extensions/UserScript/Return Youtube Dislike.user.js

+ 2 - 7
Extensions/UserScript/Return Youtube Dislike.user.js

@@ -21,12 +21,9 @@ function cLog(text, subtext = '') {
 }
 
 function doXHR(opts) {
-  if (typeof GM_xmlhttpRequest === 'function') {
+  if (typeof GM_xmlhttpRequest === 'function' || typeof GM.xmlHttpRequest === 'function') {
     return GM_xmlhttpRequest(opts);
   }
-  if (typeof GM.xmlHttpRequest === 'function') {
-    return GM.xmlHttpRequest(opts);
-  }
 
   console.warn('Unable to detect UserScript plugin, falling back to native XHR.');
 
@@ -73,11 +70,9 @@ function isVideoNotDisliked() {
 function getState() {
   if (isVideoLiked()) {
     return "liked";
-  }
-  if (isVideoDisliked()) {
+  } else if (isVideoDisliked()) {
     return "disliked";
   }
-
   return "neutral";
 }