Skip to content

Instantly share code, notes, and snippets.

@AleksandrZhukov
Created April 12, 2015 11:10
Show Gist options
  • Save AleksandrZhukov/2404cea7c1644bc2f7dc to your computer and use it in GitHub Desktop.
Save AleksandrZhukov/2404cea7c1644bc2f7dc to your computer and use it in GitHub Desktop.
vk
// Here You can type your custom JavaScript...
$("#mv_box").find("#video_player").css({"width": "1280px", "height": "720px"})
$("#mv_box").find(".video_box_wrap").removeAttr("style")
el_1 = "<span id='expandInfo' onclick='expandInfo()' style='position: absolute; top: 20px; right: 20px; display: inline-block; font-size: 0px; width: 18px; height: 18px; cursor: pointer; -webkit-user-select: none; transform:rotate(0); background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA4BpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMDE0IDc5LjE1Njc5NywgMjAxNC8wOC8yMC0wOTo1MzowMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo4OTI2NDlBQjU2QjgxMUUzQkFEMThCRENDMzUyMkUyNiIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpGOTNFMzUwNkRGNjgxMUU0OUVEQkZEN0UyRDYwRDYxNiIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDpGOTNFMzUwNURGNjgxMUU0OUVEQkZEN0UyRDYwRDYxNiIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ0MgMjAxNCAoV2luZG93cykiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpmNjdhMGE4MS1jOWMyLTdhNDMtODNjOS1hYWRlNDJkYjMzODAiIHN0UmVmOmRvY3VtZW50SUQ9ImFkb2JlOmRvY2lkOnBob3Rvc2hvcDpjNTVhNWRjZC1hNTY0LTExZTQtYjBkOC1mMTIxYzU5Mzc5ZjkiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz6RPA0lAAABCElEQVR42mL8//8/AzUAEwOVwDA2iAVEdE5bmAGkSoF4PxBnlWfF/8KnCaieH0gtAGJ7IO4Cqu+AuagLiJWAOBmINwMVcuExRBhI7QHiACAWBOJqZK9tRVLrBsTbgRr4sBgiAaQOArEJkvBaZIPigXg9kqQdEO8GahRCMkQeSB0CYm0kdcuBOAXEYIQlSKBCZiC1EIijkRRegroQ5LrdQCyPJDcbiDOB4fMXxSCoYSAXTgfiNCQNt6AGSSCJTQDiIqAhcM2M6FkEaBgjkOoF4kIc4d0KNKAGXZARV14DGtgEpGrRhCuAhnRiU8+IL9MCDcsFUpVADEoOpUBDZuNSyzia+wkCgAADACtYU6wwlpd5AAAAAElFTkSuQmCC\");'>+<span>"
el_2 = "<span id='additionalInfo' onclick='additionalInfo()' first-сhange='true' style='position: absolute; top: 20px; right: 45px; display: inline-block; font-size: 20px; width: 18px; height: 11px; cursor: pointer;text-align: center;font-weight: bold;color: #8895A0;line-height: 0.8; -webkit-user-select: none;'>×</span>"
el_3 = "<div id='recommendedVideo'></div>"
$(document).on( "mousemove","#mv_layer_wrap", function() {
$("#mv_box").find("#video_player").css({"width": "1280px", "height": "720px"})
$("#mv_box").find(".video_box_wrap").removeAttr("style")
if (!$("span").is("#expandInfo")) {
$("#mv_controls_panel").hide(0)
$("#mv_controls").find(".mv_info_panel").css("position" , "relative").append(el_1).append(el_2)
}
if ($("#additionalInfo").attr("first-сhange") == "true") {
additionalInfo()
$("#additionalInfo").attr("first-сhange","false")
}
if ($(".mv_cont").height()<$(window).height()){
$(".mv_cont").css("top", function(){
return (($(window).height()-$(".mv_cont").height())/2)+"px"
})
}
})
function expandInfo() {
$("#expandInfo").css("transform",function(){
if ($(this).css("transform") == "matrix(1, 0, 0, 1, 0, 0)")
return "matrix(-1, 1.22464679914735e-16, -1.22464679914735e-16, -1, 0, 0)"
else
return "matrix(1, 0, 0, 1, 0, 0)"
})
$("#mv_controls_panel").slideToggle(200)
}
function additionalInfo() {
if (!$("#mv_controls").attr("custom-сhange") === true) {
$("#mv_controls").attr("custom-сhange","true")
$(".mv_share_actions").hide(0)
//hide user avatar
//$(".mv_info_block > a").hide(0)
//$(".mv_title_panel").css({"padding": "0", "margin-top": "0px"})
//$(".mv_title").css("float","none")
//$(".mv_author_name").css({"position": "inherit", "bottom": "0", "width": "auto"})
if (!$("#recommendedVideo").is("div"))
$("#mv_controls").find(".mv_info_panel").append(el_3)
$("#recommendedVideo").show(0)
if ($("#recommendedVideo").children().length == 0)
$(".mv_narrow_column").clone().appendTo($("#recommendedVideo"))
$("#recommendedVideo").find(".mv_recommend_title").hide(0)
$("#recommendedVideo").find(".mv_narrow_column").css({"width": "100%","padding": "0","float": "inherit"})
$("#recommendedVideo").find(".mv_recom_item").css({"display": "inline-block","float": "left","padding": "15px 0 0 0"})
$("#recommendedVideo").find(".mv_recom_name").css({"max-width": "calc(990px / 4)"})
$(".mv_cont").css("padding", "10px 0px 10px")
}
else {
$("#mv_controls").removeAttr("custom-сhange")
$(".mv_info_block > a").show(0)
$(".mv_share_actions").show(0)
$(".mv_title_panel").removeAttr("style")
$(".mv_title").removeAttr("style")
$(".mv_author_name").removeAttr("style")
$(".mv_cont").css("padding", "10px 0px 80px")
$("div#recommendedVideo").hide(0)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment