-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding basic manifest, and some simple html/js to detect youtube and …
…get the video ID.
- Loading branch information
1 parent
a4de5ca
commit d17ab5a
Showing
4 changed files
with
52 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"manifest_version": 2, | ||
|
||
"name": "Innertube", | ||
"description": "Seach Youtube videos", | ||
"version": "1.0", | ||
|
||
"content_security_policy": "script-src 'self' https://ajax.googleapis.com; object-src 'self'", | ||
|
||
"browser_action": { | ||
"default_icon": "static/base.png", | ||
"default_popup": "views/popup.html" | ||
}, | ||
"permissions": [ | ||
"activeTab", | ||
"tabs" | ||
] | ||
} |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
chrome.tabs.query({'active': true, 'lastFocusedWindow': true}, function (tabs) { | ||
var url = tabs[0].url; | ||
u = new URL(url); | ||
if (u.hostname == "www.youtube.com" || u.hostname == "youtube.com") { | ||
$('#not-youtube-warning').hide(); | ||
$('#search-content').show(); | ||
} else { | ||
$('#not-youtube-warning').show(); | ||
$('#search-content').hide(); | ||
} | ||
usp = new URLSearchParams(u.search); | ||
video_id = usp.get('v'); | ||
console.log(video_id); | ||
}); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<title>Innertube - Youtube video search</title> | ||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> | ||
<script src="../scripts/popup.js"></script> | ||
</head> | ||
<body> | ||
<div id="search-content"> | ||
<h1>Innertube: Youtube video search.</h1> | ||
<form> | ||
<input type="text" name="searchtext" id="searchtext" /> | ||
<input type="submit" value="Search"> | ||
</form> | ||
</div> | ||
<div id="not-youtube-warning"> | ||
<p>This extension only works on www.youtube.com.</p> | ||
</div> | ||
</body> | ||
</html> |