-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cb42f11
commit a75651d
Showing
3 changed files
with
19 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
# youtube-chronological-order | ||
YouTube Chronological Order Chrome Extension |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,25 @@ | ||
|
||
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)=>{ | ||
chrome.browserAction.onClicked.addListener(tab=>{ | ||
appendToUrl() | ||
}) | ||
|
||
function appendToUrl(){ | ||
chrome.tabs.query({'active': true, 'lastFocusedWindow': true}, tabs=>{ | ||
let currentTab = tabs[0] | ||
let oldURL = currentTab.url | ||
console.log('url=', oldURL) | ||
console.log('old url=', oldURL) | ||
|
||
|
||
let newUrl = oldURL + MAGIC_URL_POSTFIX | ||
chrome.tabs.update(currentTab.id, {url: newUrl}) | ||
}) | ||
}) | ||
} | ||
|
||
//Keyboard Shortcut | ||
chrome.commands.onCommand.addListener(command => { | ||
if(command === 'appendToUrl'){ | ||
appendToUrl() | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters