mirror of
https://github.com/iv-org/invidious.git
synced 2025-08-17 18:18:30 +00:00
Return Youtube Dislikes and Ratio
This commit is contained in:
parent
326a362eb8
commit
61577b12f7
@ -7,6 +7,24 @@ String.prototype.supplant = function (o) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function set_real_dislike()
|
||||||
|
{
|
||||||
|
var xhr = new XMLHttpRequest();
|
||||||
|
xhr.open('GET', 'https://returnyoutubedislikeapi.com/votes?videoId=' + video_data.id);
|
||||||
|
xhr.onload = function() {
|
||||||
|
if (xhr.status === 200) {
|
||||||
|
var data = JSON.parse(xhr.responseText);
|
||||||
|
document.getElementById("dislikes").innerHTML = "<i class='icon ion-ios-thumbs-down'></i> " + data.dislikes.toLocaleString('en-US');
|
||||||
|
document.getElementById("rating").innerHTML = "Rating: " + Math.round(data.rating * 10) / 10 + " / 5";
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
document.getElementById("dislikes").innerHTML = "<i class='icon ion-ios-thumbs-down'></i> 0";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
xhr.send();
|
||||||
|
}
|
||||||
|
|
||||||
function toggle_parent(target) {
|
function toggle_parent(target) {
|
||||||
body = target.parentNode.parentNode.children[1];
|
body = target.parentNode.parentNode.children[1];
|
||||||
if (body.style.display === null || body.style.display === '') {
|
if (body.style.display === null || body.style.display === '') {
|
||||||
@ -452,6 +470,9 @@ window.addEventListener('load', function (e) {
|
|||||||
get_playlist(video_data.plid);
|
get_playlist(video_data.plid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Gets and sets the dislike count from 'returnyoutubedislikeapi.com'
|
||||||
|
set_real_dislike();
|
||||||
|
|
||||||
if (video_data.params.comments[0] === 'youtube') {
|
if (video_data.params.comments[0] === 'youtube') {
|
||||||
get_youtube_comments();
|
get_youtube_comments();
|
||||||
} else if (video_data.params.comments[0] === 'reddit') {
|
} else if (video_data.params.comments[0] === 'reddit') {
|
||||||
|
@ -209,7 +209,7 @@ before_all do |env|
|
|||||||
"style-src 'self' 'unsafe-inline'",
|
"style-src 'self' 'unsafe-inline'",
|
||||||
"img-src 'self' data:",
|
"img-src 'self' data:",
|
||||||
"font-src 'self' data:",
|
"font-src 'self' data:",
|
||||||
"connect-src 'self'",
|
"connect-src 'self' returnyoutubedislikeapi.com",
|
||||||
"manifest-src 'self'",
|
"manifest-src 'self'",
|
||||||
"media-src 'self' blob:" + extra_media_csp,
|
"media-src 'self' blob:" + extra_media_csp,
|
||||||
"child-src 'self' blob:",
|
"child-src 'self' blob:",
|
||||||
|
Loading…
Reference in New Issue
Block a user