1$(document).ready(function() 2{ 3 youTuber(); 4}); 5 6function youTuber() 7{ 8 $("head").append($("<link>").attr({ type: 'text/css', rel: 'stylesheet', href: 'youtuber/youtuber.css' })); // css 9 $("body").append($("<div>").attr({ class: 'youTuberBack' })); // bg 10 $(".youTuberBack").height($(document).height()); 11 12 var i, id, shortLink, bg = $(".youTuberBack"), wh, ww, video, fw, fh, qw, qh, href; 13 14 qw = [3840, 2560, 1920, 1280, 854, 640, 426]; // video sizes 15 qh = [2160, 1440, 1080, 720, 480, 360, 240]; 16 17 function sizeVideo() // resize video 18 { 19 ww = $(window).width(); 20 for (i=0; i < qw.length; i++) 21 { 22 if (ww > qw[i]) 23 { 24 $("#youTuber").attr({"width": qw[i], "height": qh[i]}); 25 $(video).css({"width": qw[i], "height": qh[i]}); 26 break; 27 } 28 } 29 } 30 31 function sizeContainer() 32 { 33 if ($(video).is(":visible")) 34 { 35 wh = $(window).height(); 36 ww = $(window).width(); 37 fw = $(video).width(); 38 fh = $(video).height(); 39 $(video).css("left", (ww-fw)/2); 40 $(video).css("top", (wh-fh)/2); 41 $(bg).css("height", $(document).height()); 42 } 43 } 44 45 function closeContainer() 46 { 47 $(bg).html(""); 48 $(bg).fadeOut("fast"); 49 } 50 51 $(".youTuber").bind('click.youTuber', function() // link click 52 { 53 href = $(this).attr("href"); // get link 54 i = href.search(/\/youtu.be/i); 55 56 if (i >
56 0) // youtu.be 57 { 58 id = href.match(/(\.be\/)([^&]+)/); 59 id = id[2]; 60 } 61 else // youtube.com 62 { 63 id = href.match(/(\?|&)v=([^&]+)/); 64 id = id[2]; 65 } 66 67 if (id.length == 0) return false; 68 69 $(bg).fadeIn("fast"); 70 $(bg).append($("<div />").attr({ id: 'youTuberLoading'}).text("ÐагÑÑзка")); 71 $(bg).append($("<div />").attr({ id: 'youTuberClose'}).html("×")); 72 $(bg).append($("<div />").attr({ id: 'youTuberContainer' })); 73 74 $("#youTuberContainer").append($("<iframe />").attr({ src: 'https://youtube.com/embed/'+id+'?autoplay=1', frameborder: 0, id: 'youTuber', "allowfullscreen": "" })); 75 video = $("#youTuberContainer"); 76 sizeVideo(); 77 $(video).fadeIn("fast"); 78 sizeContainer(); 79 return false; 80 }); 81 82 $(window).resize(function() // resize 83 { 84 sizeContainer(); 85 sizeVideo(); 86 }); 87 88 $(bg).bind('click.youTuberClose', function() // bg close 89 { 90 closeContainer(); 91 }); 92 93 $(document).keyup(function(a) // esc btn 94 { 95 if ((a.keyCode == 27) && ($(bg).is(":visible"))) { 96 $(bg).click(); 97 } 98 }); 99}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.