Skip to content

Instantly share code, notes, and snippets.

@jamesmanning
Last active October 18, 2017 04:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesmanning/7e0f09c74dfc0b084f67072a64d13e75 to your computer and use it in GitHub Desktop.
Save jamesmanning/7e0f09c74dfc0b084f67072a64d13e75 to your computer and use it in GitHub Desktop.
// from https://pastebin.com/6pAYrAM2
/*
toggle video visability & remove until next video
taken from /v4c/ and hardly modified
*/
$('nav.navbar a[href="#"][onclick]').attr("href", "javascript:void(0)");
if (!$('a[onclick*="removeUntilNext"]').length) {
$('a[onclick*="removeVideo"]').parent().parent().append($("<li>").append($("<a>").attr("href", "javascript:void(0)").attr("onclick", "javascript:removeUntilNext()").text("Remove Video Until Next")))
}
function removeUntilNext() {
socket.once("changeMedia", unremoveVideo);
return removeVideo()
}
function removeVideo(event) {
//socket.emit("voteskip");
try {
PLAYER.setVolume(0);
if (PLAYER.type === "rv") {
killVideoUntilItIsDead($(PLAYER.player))
}
} catch (e) {
console.log(e)
}
CLIENT.removedOnGDrive = PLAYER.mediaType == "gd" ? true : false;
$("#videowrap").hide().attr("id", "videowrap_disabled");
$("#ytapiplayer").attr("id", "ytapiplayer_disabled");
$("#chatwrap").removeClass("col-lg-5 col-md-5").addClass("col-md-12");
$('a[onclick*="removeVideo"]').attr("onclick", "javascript:unremoveVideo(event)").text("Show video");
if (event)
event.preventDefault()
}
function unremoveVideo(event) {
setTimeout(function() {
PLAYER.setVolume(.33)
}, 250);
socket.emit("playerReady");
$("#chatwrap").addClass("col-lg-5 col-md-5").removeClass("col-md-12");
$("#videowrap_disabled").attr("id", "videowrap").show();
$("#ytapiplayer_disabled").attr("id", "ytapiplayer");
$('a[onclick*="removeVideo"]').attr("onclick", "javascript:removeVideo(event)").text("Remove video");
if (event)
event.preventDefault();
// if (CLIENT.removedOnGDrive) {
// CLIENT.removedOnGDrive = false;
setTimeout(function() {
$("#mediarefresh").click()
}, 1e3)
// }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment