vendor: 8,607 bytes, lines 1-254
1!function(root, factory) { 2 if (typeof define === "function" && define.amd) { 3 define([ "jquery" ], factory); 4 } else if (typeof exports === "object") { 5 factory(require("jquery")); 6 } else { 7 factory(root.jQuery); 8 } 9}(this, function($) { 10 "use strict"; 11 var PLUGIN_NAME = "vide"; 12 var DEFAULTS = { 13 volume: 1, 14 playbackRate: 1, 15 muted: true, 16 loop: true, 17 autoplay: true, 18 position: "50% 50%", 19 posterType: "detect", 20 resizing: true, 21 bgColor: "transparent" 22 }; 23 var NOT_IMPLEMENTED_MSG = "Not implemented"; 24 function parseOptions(str) { 25 var obj = {}; 26 var delimiterIndex; 27 var option; 28 var prop; 29 var val; 30 var arr; 31 var len; 32 var i; 33 arr = str.replace(/\s*:\s*/g, ":").replace(/\s*,\s*/g, ",").split(","); 34 for (i = 0, len = arr.length; i < len; i++) { 35 option = arr[i]; 36 if (option.search(/^(http|https|ftp):\/\//) !== -1 || option.search(":") === -1) { 37 break; 38 } 39 delimiterIndex = option.indexOf(":"); 40 prop = option.substring(0, delimiterIndex); 41 val = option.substring(delimiterIndex + 1); 42 if (!val) { 43 val = undefined; 44 } 45 if (typeof val === "string") { 46 val = val === "true" || (val === "false" ? false : val); 47 } 48 if (typeof val === "string") { 49 val = !isNaN(val) ? +val : val; 50 } 51 obj[prop] = val; 52 } 53 if (prop == null && val == null) { 54 return str; 55 } 56 return obj; 57 } 58 function parsePosition(str) { 59 str = "" + str; 60 var args = str.split(/\s+/); 61 var x = "50%"; 62 var y = "50%"; 63 var len; 64 var arg; 65 var i; 66 for (i = 0, len = args.length; i < len; i++) { 67 arg = args[i]; 68 if (arg === "left") { 69 x = "0%"; 70 } else if (arg === "right") { 71 x = "100%"; 72 } else if (arg === "top") { 73 y = "0%"; 74 } else if (arg === "bottom") { 75 y = "100%"; 76 } else if (arg === "center") { 77 if (i === 0) { 78 x = "50%"; 79 } else { 80 y = "50%"; 81 } 82 } else { 83 if (i === 0) { 84 x = arg; 85 } else { 86 y = arg; 87 } 88 } 89 } 90 return { 91 x: x, 92 y: y 93 }; 94 } 95 function findPoster(path, callback) { 96 var onLoad = function() { 97 callback(this.src); 98 }; 99 $('<img src="' + path + '.gif">').load(onLoad); 100 $('<img src="' + path + '.jpg">').load(onLoad); 101 $('<img src="' + path + '.jpeg">').load(onLoad); 102 $('<img src="' + path + '.png">').load(onLoad); 103 } 104 function Vide(element, path, options) { 105 this.$element = $(element); 106 if (typeof path === "string") { 107 path = parseOptions(path); 108 } 109 if (!options) { 110 options = {}; 111 } else if (typeof options === "string") { 112 options = parseOptions(options); 113 } 114 if (typeof path === "string") { 115 path = path.replace(/\.\w*$/, ""); 116 } else if (typeof path === "object") { 117 for (var i in path) { 118 if (path.hasOwnProperty(i)) { 119 path[i] = path[i].replace(/\.\w*$/, ""); 120 } 121 } 122 } 123 this.settings = $.extend({}, DEFAULTS, options); 124 this.path = path; 125 try { 126 this.init(); 127 } catch (e) { 128 if (e.message !== NOT_IMPLEMENTED_MSG) { 129 throw e; 130 } 131 } 132 } 133 Vide.prototype.init = function() { 134 var vide = this; 135 var path = vide.path; 136 var poster = path; 137 var sources = ""; 138 var $element = vide.$element; 139 var settings = vide.settings; 140 var position = parsePosition(settings.position); 141 var posterType = settings.posterType; 142 var $video; 143 var $wrapper; 144 $wrapper = vide.$wrapper = $("<div>").css({ 145 position: "fixed", 146 "z-index": -1, 147 top: 0, 148 left: 0, 149 bottom: 0, 150 right: 0, 151 overflow: "hidden", 152 "-webkit-background-size": "cover", 153 "-moz-background-size": "cover", 154 "-o-background-size": "cover", 155 "background-size": "cover", 156 "background-color": settings.bgColor, 157 "background-repeat": "no-repeat", 158 "background-position": position.x + " " + position.y 159 }).append('<div id="palo-login-background"></div>'); 160 if (typeof path === "object") { 161 if (path.poster) { 162 poster = path.poster; 163 } else { 164 if (path.mp4) { 165 poster = path.mp4; 166 } else if (path.webm) { 167 poster = path.webm; 168 } else if (path.ogv) { 169 poster = path.ogv; 170 } 171 } 172 } 173 if (posterType === "detect") { 174 findPoster(poster, function(url) { 175 $wrapper.css("background-image", "url(" + url + ")"); 176 }); 177 } else if (posterType !== "none") { 178 $wrapper.css("background-image", "url(" + poster + "." + posterType + ")"); 179 } 180 if ($element.css("position") === "static") { 181 $element.css("position", "relative"); 182 } 183 $element.prepend($wrapper); 184 if (typeof path === "object") { 185 if (path.mp4) { 186 sources += '<source src="' + path.mp4 + '.mp4" type="video/mp4">'; 187 } 188 if (path.webm) { 189 sources += '<source src="' + path.webm + '.webm" type="video/webm">'; 190 } 191 if (path.ogv) { 192 sources += '<source src="' + path.ogv + '.ogv" type="video/ogg">'; 193 } 194 $video = vide.$video = $("<video>" + sources + "</video>"); 195 } else { 196 $video = vide.$video = $("<video>" + '<source src="' + path + '.mp4" type="video/mp4">' + '<source src="' + path + '.webm" type="video/webm">' + '<source src="' + path + '.ogv" type="video/ogg">' + "</video>"); 197 } 198 try { 199 $video.prop({ 200 autoplay: settings.autoplay, 201 loop: settings.loop, 202 volume: settings.volume, 203 muted: settings.muted, 204 defaultMuted: settings.muted, 205 playbackRate: settings.playbackRate, 206 defaultPlaybackRate: settings.playbackRate 207 }); 208 } catch (e) { 209 throw new Error(NOT_IMPLEMENTED_MSG); 210 } 211 $video.css({ 212 margin: "auto", 213 position: "fixed", 214 "z-index": -1, 215 top: position.y, 216 left: position.x, 217 "-webkit-transform": "translate(-" + position.x + ", -" + position.y + ")", 218 "-ms-transform": "translate(-" + position.x + ", -" + position.y + ")", 219 "-moz-transform": "translate(-" + position.x + ", -" + position.y + ")", 220 transform: "translate(-" + position.x + ", -" + position.y + ")", 221 visibility: "hidden", 222 opacity: 0 223 }).one("canplaythrough." + PLUGIN_NAME, function() { 224 vide.resize(); 225 }).one("playing." + PLUGIN_NAME, function() { 226 $video.css({ 227 visibility: "visible", 228 opacity: 1 229 }); 230 $wrapper.css("background-image", "none"); 231 }); 232 $element.on("resize." + PLUGIN_NAME, function() { 233 if (settings.resizing) { 234 vide.resize(); 235 } 236 }); 237 $wrapper.append($video); 238 }; 239 Vide.prototype.getVideoObject = function() { 240 return this.$video[0]; 241 }; 242 Vide.prototype.resize = function() { 243 if (!this.$video) { 244 return; 245 } 246 var $wrapper = this.$wrapper; 247 var $video = this.$video; 248 var video = $video[0]; 249 var videoHeight = video.videoHeight; 250 var videoWidth = video.videoWidth; 251 var wrapperHeight = $wrapper.height(); 252 var wrapperWidth = $wrapper.width(); 253 if (wrapperWidth / videoWidth > wrapperHeight / videoHeight) { 254 $video.css({
255 width: wrapperWidth + 2, 256 height: "auto" 257 }); 258 } else { 259 $video.css({ 260 width: "auto", 261 height: wrapperHeight + 2 262 }); 263 } 264 }; 265 Vide.prototype.destroy = function() { 266 delete $[PLUGIN_NAME].lookup[this.index]; 267 this.$video && this.$video.off(PLUGIN_NAME); 268 this.$element.off(PLUGIN_NAME).removeData(PLUGIN_NAME); 269 this.$wrapper.remove(); 270 }; 271 $[PLUGIN_NAME] = { 272 lookup: [] 273 }; 274 $.fn[PLUGIN_NAME] = function(path, options) { 275 var instance; 276 this.each(function() { 277 instance = $.data(this, PLUGIN_NAME); 278 instance && instance.destroy(); 279 instance = new Vide(this, path, options); 280 instance.index = $[PLUGIN_NAME].lookup.push(instance) - 1; 281 $.data(this, PLUGIN_NAME, instance); 282 }); 283 return this; 284 }; 285 $(document).ready(function() { 286 var $window = $(window); 287 $window.on("resize." + PLUGIN_NAME, function() { 288 for (var len = $[PLUGIN_NAME].lookup.length, i = 0, instance; i < len; i++) { 289 instance = $[PLUGIN_NAME].lookup[i]; 290 if (instance && instance.settings.resizing) { 291 instance.resize(); 292 } 293 } 294 }); 295 $window.on("unload." + PLUGIN_NAME, function() { 296 return false; 297 }); 298 $(document).find("[data-" + PLUGIN_NAME + "-bg]").each(function(i, element) { 299 var $element = $(element); 300 var options = $element.data(PLUGIN_NAME + "-options"); 301 var path = $element.data(PLUGIN_NAME + "-bg"); 302 $element[PLUGIN_NAME](path, options); 303 }); 304 }); 305}); 306 307(function($) { 308 "use strict"; 309 var palo_admin = { 310 init: function() { 311 this.videoLogin(); 312 this.ajaxUserApproval(); 313 }, 314 videoLogin: function() { 315 if (typeof PALO === "undefined") { 316 return; 317 } 318 var bg_video = PALO.background_video; 319 var video_obj = {}; 320 var options = {}; 321 options.posterType = "none"; 322 if (PALO.background_image !== "") { 323 $("html").attr("style", "background-image:url('" + PALO.background_image + "');"); 324 } 325 if (bg_video) { 326 video_obj = this.getVideoType(bg_video); 327 $("body").vide(video_obj, options); 328 } else { 329 $("#login").before('<div id="palo-login-background"></div>'); 330 } 331 }, 332 getVideoType: function(video) { 333 var object = {}; 334 switch (true) { 335 case video.search(/.mp4/g) != -1: 336 object.mp4 = video; 337 break; 338 339 case video.search(/.webm/g) != -1: 340 object.webm = video; 341 break; 342 343 case video.search(/.ogv/g) != -1: 344 object.ogv = video; 345 break; 346 } 347 return object; 348 }, 349 ajaxUserApproval: function() { 350 $("a.button-user-status").on("click", function(e) { 351 e.preventDefault(); 352 var elm = $(this); 353 var callback = elm.attr("data-callback"); 354 var nonce = elm.attr("data-nonce"); 355 var user_id = elm.attr("data-id"); 356 var text = elm.text(); 357 $.ajax({ 358 url: ajaxurl, 359 type: "POST", 360 dataType: "json", 361 data: { 362 action: "user_approval_ajax", 363 callback: callback, 364 nonce: nonce, 365 user_id: user_id 366 }, 367 beforeSend: function() { 368 elm.text(PALO_Admin.preload); 369 }, 370 success: function(respond) { 371 if (respond.status) { 372 if (callback === "approve_user") { 373 elm.attr("data-callback", "disable_user").attr("data-nonce", respond.nonce).removeClass("button-primary").text(PALO_Admin.disable); 374 } else { 375 elm.attr("data-callback", "approve_user").attr("data-nonce", respond.nonce).addClass("button-primary").text(PALO_Admin.approve); 376 } 377 } else { 378 elm.text(text); 379 } 380 }, 381 error: function(e) { 382 console.log(e); 383 } 384 }); 385 }); 386 } 387 }; 388 palo_admin.init(); 389})(jQuery);
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.