From cb42f11f500ce0bcb7b044f52966a1d32d0d1822 Mon Sep 17 00:00:00 2001 From: SleekPanther Date: Tue, 10 Jul 2018 16:17:49 -0400 Subject: [PATCH] Initial functionality works (still prototype) --- background.js | 15 +++++++++++++++ manifest.json | 30 ++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 background.js create mode 100644 manifest.json diff --git a/background.js b/background.js new file mode 100644 index 0000000..ab7e601 --- /dev/null +++ b/background.js @@ -0,0 +1,15 @@ + +const MAGIC_URL_POSTFIX = '&list=ULcxqQ59vzyTk' + +chrome.browserAction.onClicked.addListener((tab)=>{ + //chrome.tabs.executeScript(null, {file: "testScript.js"}) + chrome.tabs.query({'active': true, 'lastFocusedWindow': true}, (tabs)=>{ + let currentTab = tabs[0] + let oldURL = currentTab.url + console.log('url=', oldURL) + + + let newUrl = oldURL + MAGIC_URL_POSTFIX + chrome.tabs.update(currentTab.id, {url: newUrl}) + }) +}) diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..65a4446 --- /dev/null +++ b/manifest.json @@ -0,0 +1,30 @@ +{ + "manifest_version": 2, + + "name": "YouTube Chronological Order", + "description": "Watch YouTube videos in chronological order from any channel", + "version": "0.1.0", + "version_name": "0.1.0", + + "browser_action": { + // "default_icon": "assets/icons/icon.png", + "default_title": "Watch videos in chronological order" + }, + "permissions": [ + "activeTab", + "tabs" + ], + "background": { + "scripts": [ + "background.js" + ] + }, + "commands": { + "appendToUrl": { + "suggested_key": { + "default": "Alt+P" + }, + "description": "Watch all videos from channel in chronological order" + } + } +} \ No newline at end of file