-
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.
- Loading branch information
1 parent
ddf152c
commit 0c24a99
Showing
11 changed files
with
96 additions
and
102 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,7 @@ | ||
[*] | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true |
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
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
File renamed without changes.
File renamed without changes
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 @@ | ||
/* | ||
* 💥 Nuketube main script | ||
* Copyright 2018 @ guicheffer.me | ||
* | ||
* Plugin for chrome/firefox which removes all the elements from the page and let only the youtube video tag plays | ||
* | ||
*/ | ||
|
||
const urlRegex = /^https?:\/\/(?:[^./?#]+\.)?youtube\.com/ | ||
const initialize = (domContent) => { | ||
console.log(`I received the following DOM content:\n ${domContent}`) | ||
} | ||
|
||
chrome.browserAction.onClicked.addListener((tab) => { | ||
if (urlRegex.test(tab.url)) { | ||
chrome.tabs.executeScript({ | ||
file: './lib/content.js' | ||
}) ; | ||
} | ||
}) |
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,55 @@ | ||
/* | ||
* 💥 Nuketube content script | ||
* Copyright 2018 @ guicheffer.me | ||
* | ||
* Plugin for chrome/firefox which removes all the elements from the page and let only the youtube video tag plays | ||
* | ||
*/ | ||
|
||
// Adds query values into a global "getQueryStrings" variable | ||
if (!window.getQueryStrings) { | ||
window.getQueryStrings = () => { | ||
const itself = {} | ||
const fullQs = window.location.search.substring(1) | ||
const params = fullQs.split('&') | ||
|
||
for (let i=0; i<params.length; i++) { | ||
const pair = params[i].split('=') | ||
|
||
if (typeof itself[pair[0]] === 'undefined') { | ||
itself[pair[0]] = pair[1] | ||
} else if (typeof itself[pair[0]] === 'string') { | ||
const arr = [ itself[pair[0]], pair[1] ] | ||
itself[pair[0]] = arr | ||
} else { | ||
itself[pair[0]].push(pair[1]) | ||
} | ||
} | ||
|
||
return itself | ||
} | ||
} | ||
|
||
(() => { | ||
const queryStrings = getQueryStrings() | ||
|
||
if (!queryStrings.v || typeof queryStrings.v === 'undefined') return window.alert('💥 No youtube video found! 😭') | ||
|
||
const isThereAFullScreenAlready = document.querySelector('#iframe-video-nuketube') | ||
if (isThereAFullScreenAlready) return window.location.reload() | ||
|
||
const bodyElement = document.querySelector('body') | ||
const iframeStyleInline = 'position: absolute;' | ||
bodyElement.innerHTML = '' | ||
|
||
const cloneVideoElement = document.createElement( 'div' ) | ||
cloneVideoElement.innerHTML = ` | ||
<iframe id="iframe-video-nuketube" width="100%" height="100%" | ||
src="https://www.youtube.com/embed/${queryStrings.v}?autoplay=1" | ||
style="${iframeStyleInline}" | ||
frameborder="0" allowfullscreen autoplay> | ||
</iframe> | ||
` | ||
|
||
bodyElement.appendChild(cloneVideoElement) | ||
})() |
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.