diff --git a/js/background.js b/js/background.js index 49a73c3..b24ea9c 100644 --- a/js/background.js +++ b/js/background.js @@ -20,19 +20,20 @@ // or on gist.github.com, this function will open a new tab and load // the notebook into Colab. -chrome.browserAction.onClicked.addListener(function(tab) { +chrome.action.onClicked.addListener(function(tab) { const colab_url = 'https://colab.research.google.com/'; const github = /^https?:\/\/github\.com\/(.+)\/(.*\.ipynb)$/; const gist = /^https?:\/\/gist\.github\.com\/(.+)\/([a-f0-9]+(?:\#file\-.*\-ipynb)?)$/; - let path, url = null; + let path = null; + let url = null; if (github.test(tab.url)) { path = github.exec(tab.url); url = colab_url + ['github', path[1], path[2]].join('/'); } else if (gist.test(tab.url)) { - path = gist.exec(page.url); + path = gist.exec(tab.url); url = colab_url + ['gist', path[1], path[2]].join('/'); } diff --git a/manifest.json b/manifest.json index 3708108..3b772a2 100644 --- a/manifest.json +++ b/manifest.json @@ -1,21 +1,24 @@ { "name": "Open in Colab", "description": "Open a Github-hosted notebook in Google Colab", - "version": "1.0.1", - "version_name": "1.0.1", - "manifest_version": 2, + "version": "1.1.0", + "version_name": "1.1.0", + "manifest_version": 3, "icons": { "16": "images/icon16.png", "32": "images/icon32.png", "128": "images/icon128.png" }, - "browser_action": { - "default_icon": "images/icon16.png", + "action": { + "default_icon": { + "16": "images/icon16.png", + "32": "images/icon32.png", + "128": "images/icon128.png" + }, "default_title": "Open notebook in Google Colab" }, "background": { - "scripts": ["js/background.js"], - "persistent": false + "service_worker": "js/background.js" }, "permissions": ["activeTab"] }