1; (function($) { 2 3 var $win = $(window); 4 5 var lm_defaults = { 6 'item': $('body'), 7 'options': window.options ? window.options : {}, 8 '$doc': $(document), 9 '$win': $(window), 10 '$both': $('html, body'), 11 '$html': $('html'), 12 '$head': $('head'), 13 '$body': $('body'), 14 }; 15 16 window.lm_defaults = lm_defaults; 17 18 var Launch = function() { 19 20 var lm = lm_defaults; 21 22 $win.trigger('lm:once', lm); 23 $win.trigger('lm:begin', lm); 24 $win.trigger('lm:middle', lm); 25 $win.trigger('lm:end', lm); 26 $win.trigger('lm:once:end', lm); 27 28 } 29 30 if (jQuery.isReady) { 31 32 setTimeout(Launch, 200) 33 34 } else { 35 36 $(document).ready(Launch); 37 38 } 39 40 $.fn.lmStart = function(lm) { 41 42 if (!lm) { 43 lm = lm_defaults; 44 } 45 46 lm.item = $(this); 47 48 if (lm.item.html()) { 49 lm.$win.trigger('lm:begin', lm); 50 lm.$win.trigger('lm:middle', lm); 51 lm.$win.trigger('lm:end', lm); 52 } 53 54 }; 55 56 //On Initial Page Load 57 $win.on('lm:once', function(event, lm) { 58 59 60 }); 61 62 $win.on('lm:begin', function(event, lm) { 63 64 lm.$html.addClass('loading'); 65 66 lm.item.find('script[type="text/javascript/defer"]').each(function() { 67 68 var item = $(this); 69 70 item.clone().attr('type', '').insertAfter(this); 71 item.remove(); 72 73 }); 74 75 }); 76 77 //On Each Content Change (Order = 3) 78 $win.on('lm:end', function(event, lm) { 79 80 lm.$html.removeClass('loading').addClass('loaded'); 81 82 }); 83 84 //On Each Content Change (Order = 2) 85 $win 86 .on('lm:middle.bg-image', function(event, lm) { 87 88 var $items = lm.item.find('._bg'), 89 scrollPoint = lm.$body.hasClass('components-preview') ? 0 : 40; 90 91 var show = function() { 92 93 var top = $win.scrollTop(); 94 var height = $win.innerHeight(); 95 96 $items.each(function() { 97 98 var $item = $(this), 99 src = $item.attr('data-image-src'), 100 display = $item.css('display'); 101 102 if (!src || display === "none") return; 103 104 var offset = $item.offset().top; 105 106 if (offset > height && top < scrollPoint) return; 107 108 $item.css('background-image', 'url(' + src + ')'); 109 $item.attr('data-image-src', ''); 110 111 }); 112 113 } 114 show(); 115 116 lm.$win.smartresize(show); 117 118 var onScroll = function() { 119 120 var top = $win.scrollTop(); 121 122 if (top > scrollPoint) { 123 show(); 124 lm.$win.off('scroll.bg-image'); 125 } 126 127 } 128 129 lm.$win.on('scroll.bg-image', onScroll); 130 131 }) 132 // .on('lm:middle.header-scroll', function(event, lm) { 133 134 // if (!lm.$body.hasClass('supports-components') || lm.$body.hasClass('components-preview')) return; 135 136 // var item = lm.$body.find('.components-head').first(), 137 // $wrap = item.find(".components-head-wrap"), 138 // $space = lm.$body.find(".space-head"), 139 // is_scrolled = false, 140 // is_top = false, 141 // height = 100, 142 // timer = false; 143 144 // var resize = function() { 145 146 // height = item.outerHeight(); 147 148 // }; 149 // resize(); 150 151 // lm.$win.smartresize(resize); 152 // item.on('resize', resize); 153 154 // var scrolled = function() { 155 156 // var top = lm.$doc.scrollTop(), 157 // is_show_menu = lm.$html.hasClass('show-menu'); 158 159 // if (top <= 39 && !is_top) { 160 161 // is_top = true; 162 // lm.$html.addClass('scrolled-top'); 163 164 // } 165 166 // if (top >= 40 && is_top) { 167 168 // is_top = false; 169 // lm.$html.removeClass('scrolled-top'); 170 171 // } 172 173 // if (top > height * 1.5 && !is_scrolled) { 174 175 // is_scrolled = true; 176 // clearTimeout(timer); 177 178 // lm.$html.addClass('pre-sticky-set'); 179 180 // setTimeout(function() { 181 // lm.$html.removeClass('pre-sticky-set'); 182 // }, 100); 183 184 // lm.$html.addClass('pre-sticky'); 185 // lm.$win.trigger('scrolled-top', false); 186 187 // timer = setTimeout(function() { 188 // lm.$html.addClass('header-sticky'); 189 // //lm.$win.trigger('lm:scrolled', lm); 190 // }, 500); 191 192 // } 193
194 // if (top < height * 1.5 && is_scrolled && !is_show_menu) { 195 196 // is_scrolled = false; 197 // clearTimeout(timer); 198 199 // lm.$html.removeClass('header-sticky'); 200 201 // timer = setTimeout(function() { 202 // lm.$html.removeClass('pre-sticky'); 203 // lm.$win.trigger('scrolled-top', true); 204 // $space.trigger('resize'); 205 // }, 100); 206 207 // } 208 209 // }; 210 // setTimeout(scrolled, 500) 211 212 // lm.$doc.smartscroll(scrolled, 'header', 10); 213 214 // }) 215 // .on('lm:middle.menu', function(event, lm) { 216 217 // lm.item.find('.menu').each(function() { 218 219 // var item = $(this); 220 221 // if (item.hasClass('menu-expand')) { 222 223 // item.find('.menu-item-expand').each(function() { 224 225 // var $li = $(this).closest('li'), 226 // $ul = $li.find('> ul').children().clone(true, true); 227 228 // $li.before($ul); 229 // $li.remove(); 230 231 // }); 232 233 // } 234 235 // var $sub = item.find('.sub-menu'); 236 237 // if (lm.$win.innerWidth() >= 960 && !item.hasClass('menu-no-hover')) { 238 239 // $sub.closest('li').addClass('has-sub-menu').find('> a').append('<i class="fa drop"></i>'); 240 241 // } else { 242 243 // $sub.each(function() { 244 245 // var item = $(this), 246 // $li = item.closest('li').addClass('has-sub-menu'), 247 // $link = $li.find('> a'), 248 // $clone = $($link[0].outerHTML), 249 // href = $clone.attr('href'); 250 251 252 // if (href && href != '#' && !item.find('> li > a[href="' + href + '"]').length) { 253 // item.prepend($("<li />").html($clone)); 254 // } 255 256 // $link.append('<i class="fa drop"></i>'); 257 258 // $link.on('click.drop', function(event) { 259 260 // event.preventDefault(); 261 // $(this).closest('li').find('ul').first().toggle(); 262 263 // }); 264 265 // }); 266 267 // } 268 269 // }); 270 271 // }) 272 .on('lm:middle.height-of', function(event, lm) { 273 274 lm.item.find('.height-of').each(function() { 275 276 var item = $(this), 277 target = item.attr('data-target'), 278 $target = target == 'next' ? item.next() : $(target), 279 multi = target ? target.indexOf(',') + 1 : ''; 280 281 if (!$target.length) return; 282 283 var resize = function() { 284 285 var h = 0; 286 287 if (multi) { 288 289 $target.each(function() { 290 h = $(this).outerHeight(true); 291 }); 292 293 } else { 294 295 h = $target.outerHeight(true); 296 297 } 298 299 item.height(h); 300 301 }; 302 303 resize(); 304 lm.$win.smartresize(resize); 305 item.on('resize', resize); 306 307 }); 308 309 }) 310 .on('lm:middle.match-height', function(event, lm) { 311 312 var groups = {}; 313 314 lm.item.find('.match-height').each(function() { 315 316 var item = $(this), 317 parent = item.attr('data-parent') || item.closest('._row, ._grid') || item.closest('section'), 318 group = item.attr('data-group') || item.attr('class') || item.prop("tagName").toLowerCase(); 319 320 if (typeof (parent) == 'object' && parent.length && !parent.attr('data-matchid')) { 321 322 parent.attr('data-matchid', 'rand-' + Math.floor((Math.random() * 10000) + 1)); 323 parent = parent.attr('data-matchid'); 324 325 } else if (typeof (parent) == 'object' && parent.length && parent.attr('data-matchid')) { 326 327 parent = parent.attr('data-matchid'); 328 329 } else if (typeof (parent) == 'object' && !parent.length) { 330 331 parent = ''; 332 333 } 334 335 group = parent + group; 336 337 if (!groups[group]) groups[group] = $(''); 338 groups[group].push(item[0]); 339 340 }); 341 342 $.each(groups, function(i, group) { 343 344 $(group).matchheight(); 345 346 }); 347 348 }); 349 350 $.fn.fluidvideo = function() { 351 352 $(this).filter('iframe[src*="player.vimeo.com"], iframe[src*="youtube.com"], iframe[src*="wistia"], iframe[src*="youtube-nocookie.com"], iframe[src*="kickstarter.com"][src*="video.html"], .fluidframe, object, embed').each(function(index, element) { 353 354 var item = $(this); 355 var url = item.attr("src"); 356 var char = "?" 357 if (url && url.indexOf("?") != -1) char = "&"; 358 359 var height = parseFloat(((item.height() / item.width()) * 100).toFixed(2)); 360 361 item 362 .css({ 'position': 'absolute', 'top': '0', 'left': '0', 'width': '100%', 'height': '100%' }) 363 .wrap("<div class='fluidvideo-wrap' />") 364 .wrap("<div class='fluidvideo' style='padding-bottom:" + ((typeof (height) == 'number' && height > 20) ? height : '56.25') + "%; position:relative; height:0; overflow:hidden;' />"); 365 366 //item.attr('wmode', 'Opaque').attr("src",url+char+"wmode=transparent"); 367 368 }); 369 370 }; 371 372 $.fn.tallest = function() { 373 374 var h = 0; 375 $(this).each(function() { 376 377 var $el = $(this).css({ 'min-height': '' }); 378 h = ($el.outerHeight() > h) ? $el.outerHeight() : h; 379 380 }); 381 382 return h; 383 384 }; 385 386 $.fn.equalheight = function() { 387 388 var $cols = $(this), 389 $rows = {}, 390 height = 0; 391 392 var set = function() { 393 394 $rows = {}; 395 396 $cols.css({ 'min-height': '' }); 397 398 $cols.each(function() { 399 400 var $c = $(this), 401 top = $c.offset().top; 402 403 if (!$c.is(':visible')) return; 404 405 if (!$rows[top]) $rows[top] = $(''); 406 $rows[top].push($c); 407 408 }); 409 410 $.each($rows, function($i, $els) { 411 412 height = $els.tallest(); 413 $els.each(function() { 414 $(this).css({ 'min-height': height });
415 }); 416 417 }); 418 419 }; 420 set(); 421 422 $win.smartresize(set); 423 $win.on('load lm:reload', set); 424 425 }; 426 427 $.fn.matchheight = function() { 428 429 var $els = this, 430 $rows = {}, 431 height = 0; 432 433 var set = function() { 434 435 $rows = {}; 436 437 $els.each(function() { 438 439 var $el = $(this), 440 $pr = $el.closest('.match-parent'); 441 442 if (!$pr.length) { 443 $pr = $el.closest('.item, ._item'); 444 } 445 446 if ($pr.length) { 447 448 var top = $pr.offset().top; 449 450 if (!$rows[top]) $rows[top] = $(''); 451 $rows[top].push($el[0]); 452 453 } else { 454 455 if (!$rows['none']) $rows['none'] = $(''); 456 $rows['none'].push($el[0]); 457 458 } 459 460 }); 461 462 $.each($rows, function(i, $e) { 463 464 height = $e.tallest(); 465 466 if (!$e.is(':visible')) return; 467 468 $e.each(function() { 469 $(this).css({ 'min-height': height }); 470 }); 471 472 }); 473 474 }; 475 set(); 476 477 $win.smartresize(set); 478 $win.on('load lm:reload', set); 479 480 }; 481 482 // debouncing function from John Hann 483 // http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/ 484 var debounce = function(func, threshold, execAsap) { 485 var timeout; 486 487 return function debounced() { 488 var obj = this, args = arguments; 489 function delayed() { 490 if (!execAsap) 491 func.apply(obj, args); 492 timeout = null; 493 }; 494 495 if (timeout) 496 clearTimeout(timeout); 497 else if (execAsap) 498 func.apply(obj, args); 499 500 timeout = setTimeout(delayed, threshold || 100); 501 }; 502 } 503 504 $.fn.smartresize = function(fn, namespace, threshold) { 505 506 var name = 'resize'; 507 508 if (namespace) { 509 510 name = name + '.' + namespace; 511 this.unbind(name); 512 513 } 514 515 return fn ? this.bind(name, debounce(fn, threshold)) : this.trigger('smartresize'); 516 517 }; 518 519 520 $.fn.smartscroll = function(fn, namespace, threshold) { 521 522 var name = 'scroll'; 523 524 if (namespace) { 525 526 name = name + '.' + namespace; 527 this.unbind(name); 528 529 } 530 531 return fn ? this.bind(name, debounce(fn, threshold || 10)) : this.trigger('smartscroll'); 532 533 }; 534 535}(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.