PUGE 2 years ago
parent
commit
6fbf13251b
3 changed files with 15 additions and 14 deletions
  1. 14 13
      back/background.js
  2. 0 0
      background.js
  3. 1 1
      manifest.json

+ 14 - 13
back/background.js

@@ -102,16 +102,6 @@ chrome.runtime.onMessage.addListener(function(message, sender, sendResponse) {
           reGetData('')
         })
       }, 100);
-    case 'notifications':
-      chrome.notifications.create(null, {
-        type: 'basic',
-        iconUrl: 'img/48.png',
-        title: message.title,
-        message: message.message
-      });
-    case 'playMusic':
-      let musicUrl = message.url ? message.url : 'https://cunchu.site/work/assist/lingyin.wav'
-      new Audio(musicUrl).play()
     default:
       break;
   }
@@ -156,7 +146,7 @@ function lanjie (blockList) {
 
 chrome.runtime.onMessageExternal.addListener(
   function(request, sender, sendResponse) {
-    sendResponse('ok')
+    console.log(request)
     switch (request.name) {
       case 'sendMessage':
         var myHeaders = new Headers();
@@ -196,9 +186,20 @@ chrome.runtime.onMessageExternal.addListener(
           .then(response => response.text())
           .then(result => console.log(result))
           .catch(error => console.log('error', error));
-      default:
-        break;
+      case 'notifications':
+        chrome.notifications.create(null, {
+          type: 'basic',
+          iconUrl: 'img/48.png',
+          title: request.title,
+          message: request.message
+        });
+      case 'playMusic':
+        let musicUrl = request.url ? request.url : 'https://cunchu.site/work/assist/lingyin.wav'
+        new Audio(musicUrl).play()
+        default:
+          break;
     }
+    sendResponse('ok')
   }
 );
 

File diff suppressed because it is too large
+ 0 - 0
background.js


+ 1 - 1
manifest.json

@@ -1,7 +1,7 @@
 {
 	"manifest_version": 2,
 	"name": "脚本助手",
-	"version": "1.1.26",
+	"version": "1.1.27",
 	"description": "脚本助手",
 	"icons": {
 		"16": "./img/16.png",

Some files were not shown because too many files changed in this diff