vendor: 7,380 bytes, lines 1-70
1/* 2 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ 3 * 4 * Uses the built in easing capabilities added In jQuery 1.1 5 * to offer multiple easing options 6 * 7 * TERMS OF USE - jQuery Easing 8 * 9 * Open source under the BSD License. 10 * 11 * Copyright © 2008 George McGinley Smith 12 * All rights reserved. 13 * 14 * Redistribution and use in source and binary forms, with or without modification, 15 * are permitted provided that the following conditions are met: 16 * 17 * Redistributions of source code must retain the above copyright notice, this list of 18 * conditions and the following disclaimer. 19 * Redistributions in binary form must reproduce the above copyright notice, this list 20 * of conditions and the following disclaimer in the documentation and/or other materials 21 * provided with the distribution. 22 * 23 * Neither the name of the author nor the names of contributors may be used to endorse 24 * or promote products derived from this software without specific prior written permission. 25 * 26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 27 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 28 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 29 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 30 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 31 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 32 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 33 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 34 * OF THE POSSIBILITY OF SUCH DAMAGE. 35 * 36*/ 37jQuery.easing["jswing"] = jQuery.easing["swing"]; jQuery.extend(jQuery.easing, { def: "easeOutQuad", swing: function (e, t, n, r, i) { return jQuery.easing[jQuery.easing.def](e, t, n, r, i) }, easeInQuad: function (e, t, n, r, i) { return r * (t /= i) * t + n }, easeOutQuad: function (e, t, n, r, i) { return -r * (t /= i) * (t - 2) + n }, easeInOutQuad: function (e, t, n, r, i) { if ((t /= i / 2) < 1) return r / 2 * t * t + n; return -r / 2 * (--t * (t - 2) - 1) + n }, easeInCubic: function (e, t, n, r, i) { return r * (t /= i) * t * t + n }, easeOutCubic: function (e, t, n, r, i) { return r * ((t = t / i - 1) * t * t + 1) + n }, easeInOutCubic: function (e, t, n, r, i) { if ((t /= i / 2) < 1) return r / 2 * t * t * t + n; return r / 2 * ((t -= 2) * t * t + 2) + n }, easeInQuart: function (e, t, n, r, i) { return r * (t /= i) * t * t * t + n }, easeOutQuart: function (e, t, n, r, i) { return -r * ((t = t / i - 1) * t * t * t - 1) + n }, easeInOutQuart: function (e, t, n, r, i) { if ((t /= i / 2) < 1) return r / 2 * t * t * t * t + n; return -r / 2 * ((t -= 2) * t * t * t - 2) + n }, easeInQuint: function (e, t, n, r, i) { return r * (t /= i) * t * t * t * t + n }, easeOutQuint: function (e, t, n, r, i) { return r * ((t = t / i - 1) * t * t * t * t + 1) + n }, easeInOutQuint: function (e, t, n, r, i) { if ((t /= i / 2) < 1) return r / 2 * t * t * t * t * t + n; return r / 2 * ((t -= 2) * t * t * t * t + 2) + n }, easeInSine: function (e, t, n, r, i) { return -r * Math.cos(t / i * (Math.PI / 2)) + r + n }, easeOutSine: function (e, t, n, r, i) { return r * Math.sin(t / i * (Math.PI / 2)) + n }, easeInOutSine: function (e, t, n, r, i) { return -r / 2 * (Math.cos(Math.PI * t / i) - 1) + n }, easeInExpo: function (e, t, n, r, i) { return t == 0 ? n : r * Math.pow(2, 10 * (t / i - 1)) + n }, easeOutExpo: function (e, t, n, r, i) { return t == i ? n + r : r * (-Math.pow(2, -10 * t / i) + 1) + n }, easeInOutExpo: function (e, t, n, r, i) { if (t == 0) return n; if (t == i) return n + r; if ((t /= i / 2) < 1) return r / 2 * Math.pow(2, 10 * (t - 1)) + n; return r / 2 * (-Math.pow(2, -10 * --t) + 2) + n }, easeInCirc: function (e, t, n, r, i) { return -r * (Math.sqrt(1 - (t /= i) * t) - 1) + n }, easeOutCirc: function (e, t, n, r, i) { return r * Math.sqrt(1 - (t = t / i - 1) * t) + n }, easeInOutCirc: function (e, t, n, r, i) { if ((t /= i / 2) < 1) return -r / 2 * (Math.sqrt(1 - t * t) - 1) + n; return r / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + n }, easeInElastic: function (e, t, n, r, i) { var s = 1.70158; var o = 0; var u = r; if (t == 0) return n; if ((t /= i) == 1) return n + r; if (!o) o = i * .3; if (u < Math.abs(r)) { u = r; var s = o / 4 } else var s = o / (2 * Math.PI) * Math.asin(r / u); return -(u * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * i - s) * 2 * Math.PI / o)) + n }, easeOutElastic: function (e, t, n, r, i) { var s = 1.70158; var o = 0; var u = r; if (t == 0) return n; if ((t /= i) == 1) return n + r; if (!o) o = i * .3; if (u < Math.abs(r)) { u = r; var s = o / 4 } else var s = o / (2 * Math.PI) * Math.asin(r / u); return u * Math.pow(2, -10 * t) * Math.sin((t * i - s) * 2 * Math.PI / o) + r + n }, easeInOutElastic: function (e, t, n, r, i) { var s = 1.70158; var o = 0; var u = r; if (t == 0) return n; if ((t /= i / 2) == 2) return n + r; if (!o) o = i * .3 * 1.5; if (u < Math.abs(r)) { u = r; var s = o / 4 } else var s = o / (2 * Math.PI) * Math.asin(r / u); if (t < 1) return -.5 * u * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * i - s) * 2 * Math.PI / o) + n; return u * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * i - s) * 2 * Math.PI / o) * .5 + r + n }, easeInBack: function (e, t, n, r, i, s) { if (s == undefined) s = 1.70158; return r * (t /= i) * t * ((s + 1) * t - s) + n }, easeOutBack: function (e, t, n, r, i, s) { if (s == undefined) s = 1.70158; return r * ((t = t / i - 1) * t * ((s + 1) * t + s) + 1) + n }, easeInOutBack: function (e, t, n, r, i, s) { if (s == undefined) s = 1.70158; if ((t /= i / 2) < 1) return r / 2 * t * t * (((s *= 1.525) + 1) * t - s) + n; return r / 2 * ((t -= 2) * t * (((s *= 1.525) + 1) * t + s) + 2) + n }, easeInBounce: function (e, t, n, r, i) { return r - jQuery.easing.easeOutBounce(e, i - t, 0, r, i) + n }, easeOutBounce: function (e, t, n, r, i) { if ((t /= i) < 1 / 2.75) { return r * 7.5625 * t * t + n } else if (t < 2 / 2.75) { return r * (7.5625 * (t -= 1.5 / 2.75) * t + .75) + n } else if (t < 2.5 / 2.75) { return r * (7.5625 * (t -= 2.25 / 2.75) * t + .9375) + n } else { return r * (7.5625 * (t -= 2.625 / 2.75) * t + .984375) + n } }, easeInOutBounce: function (e, t, n, r, i) { if (t < i / 2) return jQuery.easing.easeInBounce(e, t * 2, 0, r, i) * .5 + n; return jQuery.easing.easeOutBounce(e, t * 2 - i, 0, r, i) * .5 + r * .5 + n } }) 38 39 40/** 41 * Copyright 2013, GreenTreeLabs 42 * 43 * @author Diego Imbriani 44 * @version 1.8.4 45 * @desc unusual tiling gallery 46 * @url http://codecanyon.net/item/final-tiles-gallery/4734090?ref=GreenTreeLabs 47 * 48 */ 49 50;(function ($) { 51 52 /** 53 * Copyright 2012, Digital Fusion 54 * Licensed under the MIT license. 55 * http://teamdf.com/jquery-plugins/license/ 56 * 57 * @author Sam Sehnert 58 * @desc A small plugin that checks whether elements are within 59 * the user visible viewport of a web browser. 60 * only accounts for vertical position, not horizontal. 61 */ 62 63 $.fn.visible = function(partial) { 64 65 if(! $(this).offset()) 66 return true; 67 68 var $t = $(this), 69 $w = $(window), 70 viewTop = $w.scrollTop(),
71 viewBottom = viewTop + $w.height(), 72 _top = $t.offset().top, 73 _bottom = _top + $t.height(), 74 compareTop = partial === true ? _bottom : _top, 75 compareBottom = partial === true ? _top : _bottom; 76 77 return ((compareBottom <= viewBottom) && (compareTop >= viewTop)); 78 79 }; 80 81 $.finalTilesGallery = function (element, options) { 82 function supportsTransitions() { 83 84 var b = document.body || document.documentElement; 85 var s = b.style; 86 var p = 'transition'; 87 if (typeof s[p] == 'string') { return true; } 88 89 // Tests for vendor specific prop 90 v = ['Moz', 'Webkit', 'Khtml', 'O', 'ms'], 91 p = p.charAt(0).toUpperCase() + p.substr(1); 92 for (var i = 0; i < v.length; i++) { 93 if (typeof s[v[i] + p] == 'string') { return true; } 94 } 95 return false; 96 } 97 98 var Slot = function (cell_size, width, height) { 99 this.position = { x: 0, y: 0 }; 100 this.blocks = { h: Math.floor(width / cell_size), v: Math.floor(height / cell_size) }; 101 this.size = { width: this.blocks.h * cell_size, height: this.blocks.v * cell_size }; 102 this.px = { width: width, height: height }; 103 this.cell_size = cell_size; 104 this.edge_right = false; 105 } 106 107 Slot.prototype.resize = function (blocks, onlyWidth) { 108 //nw : nh = w : h => nh = nw * h / w 109 var new_width = blocks * this.cell_size; 110 var new_height = (new_width * this.px.height) / this.px.width; 111 var bv = this.blocks.v; 112 this.blocks.h = blocks; 113 if(!onlyWidth) 114 this.blocks.v = Math.floor(new_height / this.cell_size); 115 } 116 117 var Grid = function (cell_size, margin, min_tile_width, width) { 118 this.slots = []; 119 this.cells = []; 120 this.margin = margin; 121 this.min_tile_width = min_tile_width; 122 this.cell_size = cell_size; 123 this.width = width; 124 this.hor_size = Math.floor(width / cell_size); 125 this.init(); 126 } 127 128 Grid.prototype.init = function () { 129 this.slots.length = 0; 130 this.cells.length = 0; 131 for (var i = 0; i < this.hor_size * 100; i++) { 132 this.cells[i] = 0; 133 } 134 } 135 136 Grid.prototype.add_slot = function (slot) { 137 for (var j = 0; j < slot.blocks.v; j++) { 138 for (var i = 0; i < slot.blocks.h; i++) { 139 var row = slot.position.y + j; 140 var column = slot.position.x + i; 141 //if (this.cells.length < row * this.hor_size + column) 142 143 this.cells[row * this.hor_size + column] = 1; 144 this.cells.push(0); 145 } 146 } 147 148 this.slots.push(slot); 149 } 150 151 Grid.prototype.count_free_cells_on_right = function (index) { 152 var line = Math.floor(index / this.hor_size); 153 var line_end = (line + 1) * this.hor_size; 154 155 var length = 0; 156 157 for (; index < line_end; index++, length++) { 158 if (this.cells[index] == 1) { 159 break; 160 } 161 } 162 163 return length; 164 } 165 166 Grid.prototype.insert = function (width, height, allowEnlargement) { 167 var slot = new Slot(this.cell_size, width, height); 168 var av_blocks = 0; 169 var free_cell = 0; 170 var line = 0; 171 172 if (this.slots.length == 0) { 173 av_blocks = this.hor_size; 174 slot.position.x = 0; 175 slot.position.y = 0; 176 } else { 177 178 //find first available cell 179 var exit = false; 180 for (; free_cell < this.cells.length; free_cell++) { 181 if (this.cells[free_cell] == 0) { 182 183 line = Math.floor(free_cell / this.hor_size); 184 var line_end = (line + 1) * this.hor_size; 185 186 //available blocks 187 av_blocks = 0; 188 for (var k = 0; k <= line_end - free_cell; k++) { 189 av_blocks = k; 190 if (this.cells[free_cell + k] == 1) { 191 //there's another slot on the right 192 break; 193 } 194 } 195 break; 196 } 197 } 198 } 199 //the slot need to be shrinked 200 if (av_blocks < slot.blocks.h) { 201 slot.resize(av_blocks); 202 } else { 203 var free_on_right = this.count_free_cells_on_right(free_cell + slot.blocks.h); 204 if (free_on_right * this.cell_size - plugin.settings.margin < this.min_tile_width && 205 free_on_right > 0) { 206 slot.resize(av_blocks, !allowEnlargement); 207 slot.enlarged = true; 208 } 209 if (free_on_right == 0) 210 slot.edge_right = true; 211 } 212 213 slot.position.x = free_cell % this.hor_size; 214 slot.position.y = Math.floor(free_cell / this.hor_size); 215 216 this.add_slot(slot); 217 return slot; 218 } 219 220 //for debug purpouses 221 Grid.prototype.print = function () { 222 var log = ""; 223 for (var i = 1; i <= this.cells.length; i++) { 224 log += this.cells[i - 1] == 1 ? "ââ" : "__"; 225 if (i > 0 && i % this.hor_size == 0) 226 log += "\n"; 227 } 228 $("pre").text(log); 229 } 230 231 var defaults = { 232 margin: 10, 233 minTileWidth: 200, 234 autoLoadURL: null, 235 autoLoadOffset: 50, 236 gridCellSize: 10, 237 scrollEffect: 'zoom', 238 enableTwitter: false, 239 twitterText: '',
240 enableFacebook: false, 241 facebookText: '', 242 enableGplus: false, 243 enablePinterest: false, 244 allowEnlargement: true, 245 hoverEffect: 'fade', 246 hoverEasing: 'swing', 247 hoverEffectDuration: 250, 248 ignoreImageAttributes: true, 249 imageSizeFactor: 1, 250 onComplete: function () { }, 251 onUpdate: function () { } 252 } 253 254 var plugin = this; 255 var grid = null; 256 var transitions = supportsTransitions(); 257 var animateTiles = false; 258 var isLoading = false; 259 var currentPage = 1; 260 var hasSocial = false; 261 var maxHeight = 0; 262 263 plugin.settings = {} 264 265 var $element = $(element), 266 element = element; 267 268 var currentWidth = $element.width(); 269 var completed = false; 270 271 var setupFilters = function () { 272 if ($element.find(".ftg-filters").length == 0) 273 return; 274 275 $element.find(".ftg-filters a").click(function (e) { 276 e.preventDefault(); 277 animateTiles = true; 278 279 maxHeight = 0; 280 281 if ($(this).hasClass("selected")) 282 return; 283 284 $element.find(".ftg-filters .selected").add(this).toggleClass("selected"); 285 286 var ft = $(this).attr("href").substr(1); 287 var $tiles = $("void"); 288 grid = null; 289 if (ft.length > 0) { 290 $element.find(".tile").addClass("ftg-hidden").hide().css({ 291 bottom: 0, 292 left: "50%" 293 }); 294 $tiles = $element.find(".ftg-" + ft).show().removeClass("ftg-hidden"); 295 } else { 296 $tiles = $element.find(".tile").removeClass("ftg-hidden").show(); 297 } 298 entile($tiles); 299 }); 300 } 301 302 plugin.addElements = function (html) { 303 var $hidden = $("<div />").hide(); 304 $hidden.append(html); 305 var $tiles = $hidden.find(".tile"); 306 styleTiles($tiles, { top: $(window).scrollTop() + 500 }); 307 setupSocial($tiles); 308 $("body").append($hidden); 309 310 $tiles.appendTo($element.find(".ftg-items")); 311 $hidden.remove(); 312 preloadImages($tiles); 313 } 314 315 plugin.showLoading = function () { 316 var panel = $("<div class='ftg-loading-panel' />"); 317 panel.append("<p>Loading</p>"); 318 panel.hide(); 319 $("body").append(panel); 320 panel.fadeIn(); 321 } 322 323 plugin.hideLoading = function () { 324 $(".ftg-loading-panel").fadeOut("fast", function () { 325 $(this).remove(); 326 }); 327 } 328 329 plugin.init = function () { 330 331 plugin.settings = $.extend({}, defaults, options); 332 333 $element.find(".ftg-items").css({ 334 position: "relative", 335 minWidth: plugin.settings.minTileWidth 336 }); 337 var $tiles = $element.find(".tile"); 338 styleTiles($tiles); 339 setupFilters(); 340 preloadImages($tiles); 341 342 hasSocial = plugin.settings.enableFacebook || plugin.settings.enableGplus || 343 plugin.settings.enableTwitter || plugin.settings.enablePinterest; 344 345 if (hasSocial) 346 setupSocial($tiles); 347 348 var resTo = 0; 349 350 $(window).resize(function () { 351 clearTimeout(resTo); 352 if (currentWidth != $element.width()) { 353 resTo = setTimeout(function () { 354 grid = null; 355 maxHeight = 0; 356 animateTiles = true; 357 entile($element.find(".tile")); 358 }, 200); 359 } 360 }); 361 362 var $modules = $('.tile'); 363 $(window).scroll(function(event) { 364 $modules.each(function(i, el) { 365 var $el = $modules.eq(i); 366 if ($el.visible(true)) { 367 $modules 368 .splice(i, 1); 369 $el 370 .addClass("effect-" + plugin.settings.scrollEffect) 371 .removeClass('module'); 372 } 373 }); 374 }); 375 376 377 var ajaxComplete = false;
378 if (plugin.settings.autoLoadURL) { 379 $(window).scroll(function () { 380 if (!ajaxComplete && !isLoading && $(window).scrollTop() >= $(document).height() - $(window).height() - plugin.settings.autoLoadOffset) { 381 isLoading = true; 382 plugin.showLoading(); 383 $.get(plugin.settings.autoLoadURL, { page: ++currentPage }, function (html) { 384 if ($.trim(html).length == 0) { 385 ajaxComplete = true; 386 } else { 387 plugin.addElements(html); 388 } 389 }); 390 } 391 }); 392 } 393 } 394 395 var setupSocial = function ($tiles) { 396 $tiles.each(function (i, tile) { 397 var $tile = $(tile); 398 $tile.append("<div class='ftg-social' />"); 399 }); 400 401 if (plugin.settings.enableTwitter) 402 setupTwitter($tiles); 403 if (plugin.settings.enableFacebook) 404 setupFacebook($tiles); 405 if (plugin.settings.enableGplus) 406 setupGplus($tiles); 407 if (plugin.settings.enablePinterest) 408 setupPinterest($tiles); 409 } 410 411 var addSocialIcon = function ($tiles, cssClass, name) { 412 $tiles.find(".ftg-social").each(function (i, tile) { 413 var $tile = $(tile); 414 415 var tw = $("<a class='" + cssClass + "' href='#'></a>"); 416 $tile.append(tw); 417 }); 418 } 419 420 //credits James Padolsey http://james.padolsey.com/ 421 var qualifyURL = function (url) { 422 var img = document.createElement('img'); 423 img.src = url; // set string url 424 url = img.src; // get qualified url 425 img.src = null; // no server request 426 return url; 427 } 428 429 var setupTwitter = function ($tiles) { 430 addSocialIcon($tiles, "tw-icon fa fa-twitter", "Twitter"); 431 $tiles.find(".tw-icon").click(function (e) { 432 e.preventDefault(); 433 var $caption = $(this).parents(".tile:first").find(".caption"); 434 var text = plugin.settings.twitterText || document.title; 435 if (!plugin.settings.twitterText && $caption.length == 1 && $caption.text().length > 0) 436 text = $.trim($caption.text()); 437 var w = window.open("https://twitter.com/intent/tweet?url=" + encodeURI(location.href.split('#')[0]) + "&text=" + encodeURI(text), "ftgw", "location=1,status=1,scrollbars=1,width=600,height=400"); 438 w.moveTo((screen.width / 2) - (300), (screen.height / 2) - (200)); 439 }); 440 } 441 442 var setupFacebook = function ($tiles) { 443 addSocialIcon($tiles, "fb-icon fa fa-facebook", "Facebook"); 444 $tiles.find(".fb-icon").click(function (e) { 445 e.preventDefault(); 446 447 var image = $(this).parents(".tile:first").find("img.item"); 448 449 var $caption = $(this).parents(".tile:first").find(".caption"); 450 var text = plugin.settings.facebookText || document.title; 451 if (!plugin.settings.facebookText && $caption.length == 1 && $caption.text().length > 0) 452 text = $.trim($caption.text()); 453 454 var url = "http://www.facebook.com/sharer.php?u=" + encodeURI(location.href.split('#')[0]) + "&t=" + encodeURI(text); 455 456 if (image.length == 1) { 457 var src = image.attr("src"); 458 url += ("&p[images][0]=" + qualifyURL(src)); 459 } 460 461 var w = window.open(url, "ftgw", "location=1,status=1,scrollbars=1,width=600,height=400"); 462 w.moveTo((screen.width / 2) - (300), (screen.height / 2) - (200)); 463 }); 464 } 465 466 var setupPinterest = function ($tiles) { 467 addSocialIcon($tiles, "pi-icon fa fa-pinterest", "Pinterest"); 468 $tiles.find(".pi-icon").click(function (e) { 469 e.preventDefault(); 470 471 var image = $(this).parents(".tile:first").find("img.item"); 472 473 var $caption = $(this).parents(".tile:first").find(".caption"); 474 var text = plugin.settings.facebookText || document.title; 475 if (!plugin.settings.facebookText && $caption.length == 1 && $caption.text().length > 0) 476 text = $.trim($caption.text()); 477 478 var url = "http://pinterest.com/pin/create/button/?url=" + encodeURI(location.href) + "&description=" + encodeURI(text); 479 480 if (image.length == 1) { 481 var src = image.attr("src"); 482 url += ("&media=" + qualifyURL(src)); 483 } 484 485 var w = window.open(url, "ftgw", "location=1,status=1,scrollbars=1,width=600,height=400"); 486 w.moveTo((screen.width / 2) - (300), (screen.height / 2) - (200)); 487 }); 488 } 489 490 var setupGplus = function ($tiles) { 491 addSocialIcon($tiles, "gp-icon fa fa-google-plus", "G+"); 492 $tiles.find(".gp-icon").click(function (e) { 493 e.preventDefault(); 494 495 var url = "https://plus.google.com/share?url=" + encodeURI(location.href); 496 497 var w = window.open(url, "ftgw", "location=1,status=1,scrollbars=1,width=600,height=400"); 498 w.moveTo((screen.width / 2) - (300), (screen.height / 2) - (200)); 499 }); 500 } 501 502 var styleTiles = function ($tiles, styles) { 503 $tiles.css({ 504 position: "absolute", 505 left: "50%" 506 }); 507 508 if (styles) { 509 for (var style in styles) { 510 $tiles.css(style, styles[style]); 511 } 512 } 513 514 $tiles.find('.tile-inner').css({ position: "relative" }); 515 516 $tiles.find(".item").css({ 517 width: "100%", 518 display: "none" 519 }); 520 } 521 522 var loadImages = function (stack) { 523 var $tile = $(stack.shift()); 524 if ($tile.data("type") == null || $tile.data("type") == "image") { 525
526 var image = $tile.find(".item"); 527 var img = new Image(); 528 529 if (image.attr("width") && image.attr("height") && !plugin.settings.ignoreImageAttributes) { 530 assignImagesSize($tile); 531 entile($tile); 532 assignHover($tile); 533 if (stack.length > 0) 534 loadImages(stack); 535 } else { 536 537 img.onload = function () { 538 $tile.find(".item") 539 .data("width", this.width * plugin.settings.imageSizeFactor) 540 .data("height", this.height * plugin.settings.imageSizeFactor); 541 assignImagesSize($tile); 542 entile($tile); 543 assignHover($tile); 544 if (stack.length > 0) 545 loadImages(stack); 546 }; 547 img.onerror = function () { 548 assignImagesSize($tile); 549 entile($tile); 550 assignHover($tile); 551 if (stack.length > 0) 552 loadImages(stack); 553 }; 554 555 img.src = image.attr("src"); 556 } 557 } else { 558 assignImagesSize($tile); 559 entile($tile); 560 assignHover($tile); 561 if (stack.length > 0) 562 loadImages(stack); 563 } 564 } 565 566 var preloadImages = function ($tiles) { 567 var preloadStack = []; 568 $tiles.each(function (i, tile) { 569 preloadStack.push(tile); 570 }); 571 572 loadImages(preloadStack); 573 } 574 575 var assignHover = function ($tile) { 576 var $caption = $tile.find(".caption"); 577 578 if($caption.length > 0) { 579 $caption.css({ 580 position: "absolute", 581 width: "100%", 582 height: "100%", 583 opacity: 0 584 }); 585 var props = { 586 enter : {}, 587 leave : {} 588 }; 589 switch(plugin.settings.hoverEffect) { 590 default: 591 case "fade": 592 $caption.css({ 593 left: 0, 594 top: 0 595 }); 596 props.enter.opacity = 1; 597 props.leave.opacity = 0; 598 break; 599 case "slide-top": 600 $caption.css({ 601 left: 0, 602 top: 0 - $tile.find(".item").data('size').height 603 }); 604 props.enter.top = 0; 605 props.leave.top = 0 - $tile.find(".item").data('size').height; 606 props.enter.opacity = 1; 607 props.leave.opacity = 0; 608 break; 609 case "slide-bottom": 610 $caption.css({ 611 left: 0, 612 bottom: 0 - $tile.find(".item").data('size').height 613 }); 614 props.enter.bottom = 0; 615 props.leave.bottom = 0 - $tile.find(".item").data('size').height; 616 props.enter.opacity = 1; 617 props.leave.opacity = 0; 618 break; 619 case "slide-left": 620 $caption.css({ 621 left: 0 - $tile.find(".item").data('size').width, 622 top: 0 623 }); 624 props.enter.left = 0; 625 props.leave.left = 0 - $tile.find(".item").data('size').width; 626 props.enter.opacity = 1; 627 props.leave.opacity = 0; 628 break; 629 case "slide-right": 630 $caption.css({
631 right: 0 - $tile.find(".item").data('size').width, 632 top: 0 633 }); 634 props.enter.right = 0; 635 props.leave.right = 0 - $tile.find(".item").data('size').width; 636 props.enter.opacity = 1; 637 props.leave.opacity = 0; 638 break; 639 } 640 $tile.mouseenter(function () { 641 $caption.css('display', 'block'); 642 $caption.animate(props.enter, 643 plugin.settings.hoverEffectDuration, 644 plugin.settings.hoverEasing, 645 function() {}); 646 }); 647 $tile.mouseleave(function () { 648 $caption.animate(props.leave, 649 plugin.settings.hoverEffectDuration, 650 plugin.settings.hoverEasing, 651 function() {}); 652 }); 653 } 654 } 655 656 var assignImagesSize = function ($tiles) { 657 $tiles.each(function () { 658 var size = {}; 659 var $item = $(this).find(".item"); 660 if ($(this).data("type") == null || $(this).data("type") == "image") { 661 if ($item.attr("width")) { 662 size = { 663 width: parseInt($item.attr("width")), 664 height: parseInt($item.attr("height")) 665 } 666 } else { 667 $item.show(); 668 size = { 669 width: $item.data("width"), 670 height: $item.data("height") 671 }; 672 } 673 $item.hide(); 674 } 675 if ($(this).data("type") == "video") { 676 size = { 677 width: parseInt($(this).find("iframe").attr("width")), 678 height: parseInt($(this).find("iframe").attr("height")), 679 } 680 } 681 682 //if (size.width < plugin.settings.minTileWidth) { 683 // //w : h = w1 : h1 => h1 = h * w1 / w 684 // size.height = size.height * plugin.settings.minTileWidth / size.width; 685 // size.width = plugin.settings.minTileWidth; 686 //} 687 $item.data("size", size); 688 }); 689 } 690 691 var entile = function ($tiles) { 692 if (!grid) 693 grid = new Grid(plugin.settings.gridCellSize, plugin.settings.margin, plugin.settings.minTileWidth, $element.width()); 694 695 var transition = animateTiles ? "all .5s" : "none"; 696 697 $tiles.css({ 698 transition: transition 699 }); 700 $tiles.find(".item").css({ 701 display: "block" 702 }); 703 704 $tiles.each(function () { 705 if ($(this).hasClass("ftg-hidden")) 706 return; 707 708 $(this).show(); 709 var size = $(this).find(".item").data("size"); 710 711 var slot = grid.insert( 712 size.width + plugin.settings.margin, 713 size.height + plugin.settings.margin, 714 plugin.settings.allowEnlargement); 715 716 $(this).data("enlarged", slot.enlarged); 717 718 $(this).find(".caption").css({ 719 width: "100%" 720 }); 721 722 var top = slot.cell_size * slot.position.y; 723 var height = slot.cell_size * slot.blocks.v; 724 725 var tileWidth = slot.cell_size * slot.blocks.h - plugin.settings.margin; 726 var tileHeight = slot.cell_size * slot.blocks.v - plugin.settings.margin; 727 728 if (top + tileHeight > maxHeight) 729 maxHeight = top + height + plugin.settings.margin; 730 731 if (supportsTransitions() || !animateTiles) { 732 $(this).css({ 733 top: top, 734 left: slot.cell_size * slot.position.x, 735 width: slot.cell_size * slot.blocks.h, 736 height: height 737 }, 500); 738 $(this).find('.tile-inner').css({ 739 display: "block", 740 overflow: "hidden" 741 }).css({ 742 width: tileWidth, 743 height: tileHeight 744 }) 745 .data("width", tileWidth) 746 .data("height", tileHeight); 747 } else { 748 $(this).animate({ 749 top: top, 750 left: slot.cell_size * slot.position.x, 751 width: slot.cell_size * slot.blocks.h, 752 height: height 753 }, 500); 754 $(this).find('.tile-inner').css({ 755 display: "block", 756 overflow: "hidden" 757 }).animate({ 758 width: tileWidth, 759 height: tileHeight 760 }) 761 .data("width", tileWidth) 762 .data("height", tileHeight); 763 } 764 765 $element.find(".ftg-items").height(maxHeight); 766 }); 767 $tiles.find("img.item").each(function (i, item) { 768 var $item = $(item); 769 var size = $item.data("size"); 770 771 $item.css({ 772 marginTop: 0, 773 marginLeft: 0, 774 width: "100%", 775 display: "block", 776 fontSize: 10, //against weird rules in some reset.css 777 margin: "auto", 778 maxWidth: "9999em" 779 }); 780 781 782 //TODO controllo se aspect ratio parent > aspect ratio img 783 var ratioImg = size.width / size.height; 784 var ratioTile = $item.parent().data("width") / $item.parent().data("height"); 785 786 if($item.parent().parent().data("enlarged") && !plugin.settings.allowEnlargement) { 787 $item.css({ 788 height: $item.parent().data("height") , 789 width: size.width, 790 marginTop: 0 791 }); 792 } 793 794 else if (ratioImg == ratioTile) { 795 $item.css({ 796 width: $item.parent().data("width"), 797 height: $item.parent().data("height") 798 }); 799 $item.attr("case", "0"); 800 return;//continue $.each loop 801 } 802 803 else if (ratioImg >= ratioTile) { 804 $item.css({ 805 width: "auto", 806 height: $item.parent().data("height") 807 }); 808 809 $item.attr("case", "2"); 810 811 var diff = $item.width() - $item.parent().data("width"); 812 $item.css("margin-left", diff / -2); 813 } else { 814 815 //ratioImg < ratioTile 816 $item.css({ 817 width: $item.parent().data("width"), 818 height: "auto" 819 }); 820 821 $item.attr("case", "4"); 822 823 var diff = $item.height() - $item.parent().data("height"); 824 $item.css("margin-top", diff / -2); 825 } 826 827 }); 828 $tiles.each(function () { 829 var el = $(this); 830 if (el.visible(true)) { 831 el.addClass("already-visible"); 832 } 833 }); 834 //grid.print(); 835 836 currentWidth = $element.width(); 837 if (!completed) { 838 completed = true; 839 plugin.settings.onComplete.call(plugin); 840 } else { 841 plugin.settings.onUpdate.call(plugin); 842 } 843 844 isLoading = false;
845 plugin.hideLoading(); 846 } 847 848 plugin.init(); 849 } 850 851 $.fn.finalTilesGallery = function (options) { 852 return this.each(function () { 853 if (undefined == $(this).data('finalTilesGallery')) { 854 var plugin = new $.finalTilesGallery(this, options); 855 $(this).data('finalTilesGallery', plugin); 856 } 857 }); 858 } 859})(jQuery); 860
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.