-
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
0 parents
commit 2572c7f
Showing
9 changed files
with
71 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 @@ | ||
*.zip |
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,9 @@ | ||
|<h2>Toggle YouTube Comments</h2><br>![](icons/128.png)| | ||
|:---:| | ||
|It's dangerous to go alone. Take this.<br>Collapses YouTube comments by default.| | ||
|_<sup>Extension listens for [SPF events] which are YouTube specific.</sup><br><sup>Icon by [Gregor Cresnar]. Licensed under [CC BY 3.0].</sup>_| | ||
|
||
|
||
[SPF events]: https://youtube.github.io/spfjs/documentation/events/ | ||
[Gregor Cresnar]: http://www.flaticon.com/authors/gregor-cresnar | ||
[CC BY 3.0]: http://creativecommons.org/licenses/by/3.0/ "Creative Commons Attribution 3.0 Unported" |
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,3 @@ | ||
#!/usr/bin/env bash | ||
|
||
zip -9 -r $(date +%F)-toggle-youtube-comments.zip . -x "*.git*" "*.md" "$0" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,21 @@ | ||
{ | ||
"manifest_version": 2, | ||
"name": "Toggle YouTube Comments", | ||
"description": "Be safe. Hide YouTube comments.", | ||
"version": "1.0.0", | ||
|
||
"icons": { | ||
"16": "icons/16.png", | ||
"32": "icons/32.png", | ||
"128": "icons/128.png" | ||
}, | ||
|
||
"content_scripts": [ | ||
{ | ||
"matches": ["http://*.youtube.com/*", "https://*.youtube.com/*"], | ||
"js": ["script.js"], | ||
"css": ["youtube.css"], | ||
"run_at": "document_start" | ||
} | ||
] | ||
} |
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,36 @@ | ||
'use strict'; | ||
|
||
function toggleComments() { | ||
var label = document.getElementById('toggle-comments').firstElementChild; | ||
var comments = document.getElementById('watch-discussion'); | ||
if (comments.classList.toggle('hide-comments')) { | ||
label.textContent = 'Show comments'; | ||
} else { | ||
label.textContent = 'Hide comments'; | ||
} | ||
} | ||
|
||
function inject() { | ||
addClass(); | ||
addButton(); | ||
} | ||
|
||
function addClass() { | ||
document.getElementById('watch-discussion').className += ' hide-comments'; | ||
} | ||
|
||
function addButton() { | ||
var button =` | ||
<button class="yt-uix-button yt-uix-button-size-default yt-uix-button-expander" id="toggle-comments" type="button"> | ||
<span class="yt-uix-button-content">Show comments</span> | ||
</button> | ||
`; | ||
|
||
document.getElementById('action-panel-details').innerHTML += button; | ||
document.getElementById('toggle-comments').addEventListener('click', toggleComments); | ||
} | ||
|
||
(function () { | ||
document.addEventListener('DOMContentLoaded', inject); // Static navigation (i.e. initial page load) | ||
document.addEventListener('spfdone', inject); // Dynamic navigation (i.e. subsequent page loads) | ||
})(); |
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 @@ | ||
.hide-comments { display: none !important } |