1(function ($) { 2 3 $.fn.flatie = function(extras) { 4 5 // Try parseJSON 6 try { 7 var options = $.parseJSON($(this).find('.playerData').text()); 8 } catch (err) { 9 console.log('JSON parse ERROR, fall back to JS!'); 10 } 11 12 // Merge settings, set variables etc 13 var player = $(this); 14 var settings = $.extend(extras, options); 15 16 var HTMLContent = $('<div class="playerScreen">\ 17 <div id="unique-container-' + generateID(1) + '" class="jPlayer-container"></div>\ 18 <a tabindex="1" href="#" class="video-play"><div class="play-icon"><i class="icon-play-circle"></i></div></a>\ 19 </div>\ 20 <div class="controls">\ 21 <div class="controlset left">\ 22 <a tabindex="1" href="#" class="play smooth"><i class="icon-play"></i></a>\ 23 <a tabindex="1" href="#" class="pause smooth"><i class="icon-pause"></i></a>\ 24 </div>\ 25 <div class="controlset right-volume">\ 26 <a tabindex="1" href="#" class="mute smooth"><i class="icon-volume"></i></a>\ 27 <a tabindex="1" href="#" class="unmute smooth"><i class="icon-mute"></i></a>\ 28 </div>\ 29 <div class="volumeblock">\ 30 <div class="volume-control"><div class="volume-value"></div></div>\ 31 </div>\ 32 <div class="controlset right">\ 33 <a href="#" tabindex="1" class="fullscreen smooth"><i class="icon-fullscreen"></i></a>\ 34 <a href="#" tabindex="1" class="smallscreen smooth"><i class="icon-fullscreen-exit"></i></a>\ 35 </div>\ 36 <div class="jp-progress-block">\ 37 <div class="timer current"></div>\ 38 <div class="timer duration"></div>\ 39 <div class="jp-progress">\ 40 <div class="seekBar">\ 41 <div class="playBar"></div></div></div></div></div>'); 42 43 $(this).find('.playerData').remove(); 44 $(this).append(HTMLContent); 45 46 // Get supplied media from MEDIA array 47 var supplied = new Array; 48 $.each(settings.media, function(key, value) { if (key != 'poster') {supplied.push(key);}}); 49 formats = supplied.join(', '); 50 51 // Get volume from Cookie 52 var cVolume = getcookie('jplayer-volume'); 53 var options = { 54 55 ready: function (event) { 56 57 if(event.jPlayer.status.noVolume) { 58 // Add a class and then CSS rules deal with it. 59 $(player).find(".controls .jp-progress-block").css({ margin: '0 10px 0 45px'}); 60 } 61 62 $(this).jPlayer("setMedia", settings.media); 63 64 if (settings.autoplay != null) { 65 $(this).jPlayer('play'); 66 } 67 }, 68 69 // Extra Settings 70 swfPath: "skin/Jplayer.swf", 71 supplied: formats, 72 solution: 'html, flash', 73 volume: ((cVolume != null) ? cVolume : '0.5'), 74 smoothPlayBar: false, 75 keyEnabled: true, 76 remainingDuration: false, 77 toggleDuration: false, 78 errorAlerts: false, 79 warningAlerts: false, 80 81 // CSS Selectors 82 size: { 83 width: "100%", 84 height: "auto" 85 }, 86 87 cssSelectorAncestor: '#' + $(player).attr('id'), 88 cssSelector: { 89 videoPlay: ".video-play", 90 play: ".play", 91 pause: ".pause", 92 seekBar: ".seekBar", 93 playBar: ".playBar", 94 mute: ".right-volume .mute", 95 unmute: ".right-volume .unmute", 96 volumeBar: ".volume-control", 97 volumeBarValue: ".volume-control .volume-value", 98 currentTime: ".timer.current", 99 duration: ".timer.duration", 100 fullScreen: ".fullscreen", 101 restoreScreen: ".smallscreen", 102 gui: ".controls", 103 noSolution: ".noSolution" 104 }, 105 106 error: function(event) { 107 if(event.jPlayer.error.type === $.jPlayer.error.URL_NOT_SET) { 108 // Setup the media stream again and play it. 109 $(this).jPlayer("setMedia", settings.media).jPlayer('play'); 110 } 111 }, 112 113 play: function() { 114 $(player).find('.playerScreen .video-play').stop(true,true).fadeOut(150); 115 $(this).on('click', function() { $(this).jPlayer('pause');}); 116 $(this).jPlayer("pauseOthers"); 117 jplayer_responsive(); 118 }, 119 120 pause: function() { 121 $(player).find('.playerScreen .video-play').stop(true,true).fadeIn(350); 122 $(this).unbind('click'); 123 }, 124 125 ended: function() { 126 $(this).jPlayer("setMedia", settings.media); 127 }, 128 129 volumechange: function(event) { 130 setcookie('jplayer-volume', event.jPlayer.options.volume); 131 } 132 133 }; 134 135 // Create the volume slider control 136 $(player).find('.volumeblock').mousedown(function() { 137 138 parent = $(player).find('.volumeblock'); 139 140 $(player).find('.volumeblock').mousemove(function(e){ 141 142 $(player).find('.volume-control .volume-value').css({ 143 'width': e.pageX - $(parent).offset().left 144 }); 145 146 var total = $(player).find('.volume-control').width(); 147 $(player).find('.jPlayer-container').jPlayer("option", "muted", false); 148 $(player).find('.jPlayer-container').jPlayer("option", "volume", (e.pageX - $(parent).offset().left) / total); 149 150 return false;
151 }) 152 153 return false; 154 155 }); 156 157 158 // Create the progress slider mouse move event 159 $(player).find('.jp-progress').mousedown(function() { 160 161 parent = $(player).find('.jp-progress .seekBar'); 162 163 $(player).find('.jp-progress').mousemove(function(e) { 164 165 var total = $(player).find('.jp-progress .seekBar').width(); 166 var perc = (((e.pageX - $(parent).offset().left) / total) * 100); 167 168 $(player).find('.jp-progress .seekBar .playBar').css({ 169 'width': perc + '%' 170 }); 171 172 173 $(player).find('.jPlayer-container').jPlayer("playHead", perc); 174 175 return false; 176 }) 177 178 return false; 179 180 }); 181 182 $(document).mouseup(function() { 183 $('.jp-progress, .volumeblock').unbind('mousemove'); 184 }); 185 186 $.extend(options, settings); 187 188 // Initialize Player 189 $(this).find('.jPlayer-container').jPlayer(options); 190 $(window).on('resize', jplayer_responsive); 191 } 192 193 194})(jQuery); 195 196// Simple function to write cookie 197function setcookie(name, value, expires, path, domain, secure) { 198 199 var today = new Date(); 200 today.setTime(today.getTime()); 201 202 if (expires) { 203 expires = expires * 1000 * 60 * 60 * 24; 204 } 205 206 var expires_date = new Date(today.getTime() + (expires)); 207 208 document.cookie = name+'=' + escape(value) + 209 ((expires) ? ';expires='+ expires_date.toGMTString() : '') + //expires.toGMTString() 210 ((path) ? ';path=' + path : '') + 211 ((domain) ? ';domain=' + domain : '') + 212 ((secure) ? ';secure' : ''); 213 214} 215 216// Read cookievalue 217function getcookie(name) { 218 219 var start = document.cookie.indexOf(name + "="); 220 var len = start + name.length + 1; 221 222 if ((!start) && (name != document.cookie.substring(0, name.length))) { 223 return null; 224 } 225 226 if (start == -1) return null; 227 228 var end = document.cookie.indexOf(';', len); 229 230 if (end == -1) end = document.cookie.length; 231 return unescape( document.cookie.substring(len, end)); 232 233} 234 235// Responsive Flash 236function jplayer_responsive() { 237 238 $('.jPlayer[class!=audioPlayer] object').each(function() { 239 240 var width = $(this).width(); 241 $(this).height(width / 1.778); 242 243 }); 244 245} 246 247var globalIdCounter = 0; 248function generateID(baseStr) { 249 return(baseStr + globalIdCounter++); 250}
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.