1(function($){ 2 3 var _SW_equalizeDivs = false, 4 _SW_devices = { 5 1 : 'screen', 6 2 : 'screen', 7 3 : 'tablet', 8 4 : 'mobile', 9 5 : 'mobile', 10 types : { 11 1 : 'Normal Screen', 12 2 : 'Large Screen', 13 3 : 'Tablet', 14 4 : 'Mobile Landscape', 15 5 : 'Mobile Portrait' 16 } 17 },_SW, 18 _SW_cache = {}; 19 20 //module manager 21 var SW_SELF_URL = (function() { 22 var script_tags = document.getElementsByTagName('script'); 23 var path = script_tags[script_tags.length-1].src; 24 path = path.match(/(.*\/).*\.js/); 25 return path[1]; 26 })(); 27 28 var modules = {}; 29 var parent_module; 30 var require = function(id,callback){ 31 //if callback passed we expect this to be async require 32 var async = typeof callback === 'function' ? true : false; 33 if ($.isArray(id)){ 34 var ret = {}; 35 $(id).each(function(i,ix){ 36 var ex = require(ix,callback); 37 ret = $.extend({}, ret, ex); 38 }); 39 return ret; 40 } 41 42 //resolve id 43 var url = SW_SELF_URL + id; 44 if ( modules[id] && modules[id].loaded === true ){ 45 console.log( id + ' loaded from cache'); 46 return modules[id].exports; 47 } 48 49 modules[id] = { 50 id : id, 51 parent : parent_module, 52 exports : {}, 53 loaded : false 54 }; 55 56 parent_module = modules[id]; 57 window.exports = modules[id].exports; 58 var loadScript = function (url, cb) { 59 cb = async ? cb : function(){} 60 if (!async) 61 modules[id].loaded = true; 62 jQuery.ajax({ 63 url: url, 64 dataType: 'script', 65 cache: false, 66 success: function(){ 67 if (async) { 68 modules[id].loaded = true; 69 } 70 71 //switch require back to the parent 72 if (modules[id].parent){ 73 window.exports = modules[id].parent.exports; 74 } 75 76 parent_module = modules[id].parent; 77 cb(modules[id].exports); 78 }, 79 async: async 80 }); 81 } 82 83 loadScript(url,callback); 84 return modules[id].exports; 85 }; 86 87 window.require = require; 88// setTimeout(function(){ 89// require('test.js',function(ex){ 90// console.log(modules); 91// }); 92// //console.log(t); 93// var t = require('test.js'); 94// //var t2 = require('test.js'); 95// //t.google(); 96// //t2.google(); 97// //console.log(t); 98// },1000); 99 100 //resize event handler with delay response 101 var _resizeTimer; 102 $(window).resize(function() { 103 clearTimeout(_resizeTimer); 104 _resizeTimer = setTimeout(methods.fireOnResize, 250); 105 }); 106 107 //inatiate after document load 108 $(document).ready(function() { 109 //initiate 110 if (!_SW){ 111 _SW = Sweefty(); 112 } 113 114 //quick test if our browser support floating point margins 115 var div = $('<div id="SW_hidden_element" style="margin-left:50.6%"></div>'); 116 $('body').append(div); 117 var num = parseFloat(div.css('margin-left')); 118 if (num % 1 == 0){ 119 _SW_equalizeDivs = true; 120 } 121 122 div.hide(); 123 124 //run resize event 125 setTimeout(methods.fireOnResize,250); 126 //$('.row .column').wrapInner('<div style="margin:10px 15px; 0"></div>'); 127 128 //tabs 129 $('.tabs').each(function(){ 130 var tabs = $(this); 131 var divs = $('> div',tabs); 132 var lis = $('> ul li',tabs); 133 divs.hide(); 134 135 lis.each(function(i){ 136 var $this = $(this); 137 if ($this.hasClass('active')){ 138 divs.eq(i).show(); 139 } 140 141 $this.click(function(){ 142 143 if ($(this).hasClass('active')){ 144 return false; 145 } 146 147 lis.removeClass('active'); 148 $(this).addClass('active'); 149 divs.hide(); 150 divs.eq(i).fadeIn('fast'); 151 return true; 152 }); 153 }); 154 }); 155 156 //nav menu fix for IE 6 & 7 157 $("ul.nav li").hover( function() { 158 $(this).addClass("iehover"); 159 },function() { 160 $(this).removeClass("iehover"); 161 }); 162 163 $('ul.nav > li').each(function(){ 164 var $this = $(this); 165 var As = $this.children('a'); 166 167 if (As.next('ul').length){ 168 As.append('<span class="dir"></span>'); 169 } 170 }); 171 172 //delay processing of data-trigger attributes 173 //making sure all elements in place 174 setTimeout(function(){ 175 $('[data-trigger]').each(function(){ 176 var $this = $(this); 177 var options = $this.data('trigger').split('[and]'); 178 $(options).each(function(i){ 179 methods.parse($this,options[i]); 180 }); 181 }); 182 },100); 183 }); 184 185 //internal methods 186 var methods = { 187 parse : function(ele,options){ 188 var $this = this; 189 if (typeof options == 'object'){ 190 191 } else { 192 var obj = {}; 193 var action = ''; 194 195 options = options.split(';'); 196 for (var x = 0; x < options.length; x++){ 197 var values = options[x].split(':'); 198 if (values && values.length == 2){ 199 var key = values[0].replace(/\s+/,''); 200 var value = values[1]; 201 202 if (x == 0){ 203 action = key; 204 } 205 206 obj[key] = value; 207 } 208 } 209 210 if (typeof $this.trigger[action] === 'function'){ 211 $this.trigger[action](ele,obj); 212 } 213 } 214 }, 215 216 trigger : { 217 //default - predefined triggers 218 //other triggers can be found in plugins folder as seperate plugins 219 toggle : function(ele,obj){ 220 var target = obj.toggle; 221 var on = obj.on || 'click'; 222 var type = obj.type || 'fadeToggle'; 223 224 if (target == 'this'){ 225 target = ele; 226 } else if (target == 'next') { 227 target = ele.next(); 228 }else if (target == 'previous') { 229 target = ele.prev(); 230 } 231 232 target = $(target); 233 234 if (obj.target == 'hide'){ 235 target.hide(); 236 } 237 238 ele.on(on,function(){ 239 target[type](); 240 }); 241 }, 242 243 menu : function(ele,obj) { 244 245 var type = obj.menu; 246 var getList = function(element,count){ 247 var counter; 248 !count ? counter = 0 : counter = count; 249 250 var value = ''; 251 var style = ''; 252 var padding = ''; 253 var indent = ''; 254 if (counter > 0){ 255 indent = new Array( counter+1 ).join( '\u00a0\u00a0' ); 256 } 257 258 element.children('li').each(function(){ 259 var $this = $(this); 260 var A = $this.children('a'); 261 var text = A.text(); 262 var link = A.attr('href'); 263 264 //get current link 265 //if link is hash or nothing then disable 266 //get associated event 267 value +='<option style="'+style+'" value="'+link+'">'+indent+text+'</option>'; 268 269 if (A.next('ul').length){ 270 value += getList(A.next('ul'),counter+1); 271 } 272 }); 273 274 return value; 275 } 276 277 var select = '<div class="selectContainer show-phone prettySelect">'; 278 select += '<select class="selectMenu">'; 279 select += getList(ele); 280 select +='</select>'; 281 select += '</div>'; 282 283 var newSelect = $(select); 284 285 if (type == 'pretty'){ 286 var selectMenu = newSelect.find('select'); 287 selectMenu.each(function(){ 288 var title = $(this).attr('title'); 289 if( $('option:selected', this).val() != '' ) title = $('option:selected',this).text(); 290 $(this) 291 .css({'z-index':10,'opacity':0,'-khtml-appearance':'none'}) 292 .after('<div class="prettyMenu"><span class="prettyTitle">' + title + '</span><span class="pointer"></span></div>') 293 .change(function(){ 294 var $this = $(this); 295 val = $('option:selected',$this).text(); 296 $('span.prettyTitle',newSelect).text(val); 297 298 //get value 299 var value = $this.val(); 300 301 if (value == '#'){ 302 var index = $('option:selected',$this).index(); 303 //get original element and trigger click event 304 ele.find('a').eq(index).trigger('click'); 305 } else { 306 window.location = value; 307 } 308 }); 309 }); 310 } 311 312 ele.addClass('hide-phone'); 313 if (obj.appendTo){ 314 $(obj.appendTo).append(newSelect); 315 } else { 316 ele.after(newSelect); 317 } 318 } 319 }, 320 321 //array of events that will run on screen resize event 322 events : [function(){ 323 //default resize acions 324 //run fittext function on resize 325 $('.fittext').fittext(); 326 }], 327
328 fireOnResize : function(){ 329 //get current screen resolution 330 _SW.on.lastDevice = _SW.on._ini(); 331 332 for (var i= 0; i < methods.events.length;i++){ 333 var fun = methods.events[i]; 334 fun(); 335 } 336 337 _SW.on.previousDevice = _SW.on.lastDevice; 338 }, 339 340 setEvent: function(func) { 341 if (typeof func !== 'function'){ 342 throw 'Events must be of a function type'; 343 } else { 344 methods.events.push(func); 345 } 346 } 347 }; 348 349 var SW = function(){ 350 _SW = this; 351 }; 352 353 //set plugin triggers 354 SW.prototype.trigger = function(name,fn){ 355 methods.trigger[name] = fn; 356 return fn; 357 }; 358 359 SW.prototype.require = require; 360 SW.prototype.on = { 361 _ini : function(){ 362 var id = parseInt($('#SW_hidden_element').css('width')); 363 var screenType = _SW_devices[id]; 364 return screenType; 365 }, 366 resize : function(func){ 367 methods.setEvent(func); 368 }, 369 device : function(dev,func,func2){ 370 var deviceType,Runfunc1,Runfunc2; 371 if (func2 && typeof func2 == 'function'){ 372 Runfunc2 = func2; 373 } if (func && typeof func == 'function'){ 374 Runfunc1 = func; 375 deviceType = dev; 376 } else { 377 Runfunc1 = dev; 378 } 379 380 methods.setEvent(function(){ 381 if (_SW.on.previousDevice !== _SW.on.lastDevice){ 382 if (deviceType){ 383 if (deviceType == _SW.on.lastDevice) { 384 Runfunc1(_SW.on.lastDevice); 385 } else if (Runfunc2 && deviceType !== _SW.on.lastDevice 386 && _SW.on.previousDevice == deviceType) { 387 Runfunc2(_SW.on.lastDevice); 388 } 389 } else { 390 Runfunc1(_SW.on.lastDevice); 391 } 392 } 393 }); 394 }, 395 mobile : function(func,func2){ 396 _SW.on.device('mobile',func,func2); 397 }, 398 tablet : function(func,func2){ 399 _SW.on.device('tablet',func,func2); 400 }, 401 screen : function(func,func2){ 402 _SW.on.device('screen',func,func2); 403 }, 404 lastDevice : '', 405 previousDevice : '' 406 }; 407 408 function path() { 409 this.path = window.location.pathname; 410 } 411 412 //path detector 413 SW.prototype.path = function(){ 414 return new path(); 415 }; 416 417 $.fn.fittext = function(customOptions){ 418 return this.each(function() { 419 var $this = $(this); 420 421 //get data-compression 422 var font = $this.data('font') || '1'; 423 font = font.toString().split(';'); 424 425 var compression = parseFloat(font[0]) || 1; 426 var minimum = parseInt(font[1]) || undefined; 427 var maximun = parseInt(font[2]) || undefined; 428 429 var text = $this.text(); 430 var charsnum = text.split('').length; 431 432 //get width 433 var width = $this.width(); 434 var fontSize = parseInt((width/charsnum)*(2*compression)); 435 436 if (minimum && fontSize < minimum){ 437 fontSize = minimum; 438 } else if (maximun && fontSize > maximun){ 439 fontSize = maximun; 440 } 441 442 $this.css('fontSize',fontSize+'px'); 443 }); 444 }; 445 446 window.Sweefty = function (args) { 447 return _SW || new SW(args); 448 } 449 450}(jQuery)); 451 452 453 454 Sweefty().on.mobile(function(){ 455 456 var height = $('.row.scroll > .column:first').outerHeight(); 457 var sLeft = $(document).width(); 458 459 $('.row.scroll').css({ 460 //overflow : 'hidden', 461 //height : height, 462 position : 'relative' 463 }); 464 465 $('.row.scroll > .column').on('swipeLeft',function(e){ 466 var $this = $(this); 467 var next = $this.next('.column'); 468 469 if (next.length < 1){ 470 // 471 $this.stop().animate({ 472 left: -(sLeft/2) 473 },{ 474 duration : 200, 475 complete : function(){ 476 $this.animate({ 477 left : 0 478 },{ 479 duration : 250 480 }); 481 } 482 }); 483 484 } 485 else { 486 next.css({left:sLeft}); 487 $this.stop().animate({ 488 left: -sLeft 489 },{ 490 duration : 250, 491 complete : function(){ 492 $this.hide(); 493 next.show(); 494 next.stop().animate({ 495 left : 0 496 },{ 497 duration : 250 498 }); 499 } 500 }); 501 } 502 }).bind('swipeRight',function(e){ 503 504 var $this = $(this); 505 var prev = $this.prev('.column'); 506 507 if (prev.length < 1){ 508 $this.stop().animate({ 509 left: sLeft/2 510 },{ 511 duration : 250, 512 complete : function(){ 513 $this.animate({ 514 left : 0 515 },{ 516 duration : 250 517 }); 518 } 519 }); 520 } 521 else { 522 prev.css({left:-sLeft}); 523 $this.stop().animate({ 524 left: sLeft 525 },{ 526 duration : 250, 527 complete : function(){ 528 $this.hide(); 529 prev.show(); 530 prev.stop().animate({ 531 left : 0 532 },{ 533 duration : 250 534 }); 535 } 536 }); 537 } 538 }); 539 540 //other devices 541 },function(){ 542 $('.row.scroll').css({ 543 height : 'auto', 544 overflow : 'none' 545 }); 546 547 $('.row.scroll .column').css({display:'block'}); 548 $('.row.scroll > .column').unbind('swipeLeft').unbind('swipeRight'); 549 } 550 ); 551 552/* 553 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ 554 * 555 * Uses the built in easing capabilities added In jQuery 1.1 556 * to offer multiple easing options 557 * 558 * TERMS OF USE - jQuery Easing 559 * 560 * Open source under the BSD License. 561 * 562 * Copyright © 2008 George McGinley Smith 563 * All rights reserved. 564 * 565 * Redistribution and use in source and binary forms, with or without modification, 566 * are permitted provided that the following conditions are met: 567 * 568 * Redistributions of source code must retain the above copyright notice, this list of 569 * conditions and the following disclaimer. 570 * Redistributions in binary form must reproduce the above copyright notice, this list 571 * of conditions and the following disclaimer in the documentation and/or other materials 572 * provided with the distribution. 573 * 574 * Neither the name of the author nor the names of contributors may be used to endorse 575 * or promote products derived from this software without specific prior written permission. 576 * 577 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 578 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 579 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 580 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
vendor: 5,084 bytes, lines 581-723
581 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 582 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 583 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 584 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 585 * OF THE POSSIBILITY OF SUCH DAMAGE. 586 * 587*/ 588 589// t: current time, b: begInnIng value, c: change In value, d: duration 590jQuery.easing['jswing'] = jQuery.easing['swing']; 591 592jQuery.extend( jQuery.easing, 593{ 594 def: 'easeOutQuad', 595 swing: function (x, t, b, c, d) { 596 //alert(jQuery.easing.default); 597 return jQuery.easing[jQuery.easing.def](x, t, b, c, d); 598 }, 599 easeInQuad: function (x, t, b, c, d) { 600 return c*(t/=d)*t + b; 601 }, 602 easeOutQuad: function (x, t, b, c, d) { 603 return -c *(t/=d)*(t-2) + b; 604 }, 605 easeInOutQuad: function (x, t, b, c, d) { 606 if ((t/=d/2) < 1) return c/2*t*t + b; 607 return -c/2 * ((--t)*(t-2) - 1) + b; 608 }, 609 easeInCubic: function (x, t, b, c, d) { 610 return c*(t/=d)*t*t + b; 611 }, 612 easeOutCubic: function (x, t, b, c, d) { 613 return c*((t=t/d-1)*t*t + 1) + b; 614 }, 615 easeInOutCubic: function (x, t, b, c, d) { 616 if ((t/=d/2) < 1) return c/2*t*t*t + b; 617 return c/2*((t-=2)*t*t + 2) + b; 618 }, 619 easeInQuart: function (x, t, b, c, d) { 620 return c*(t/=d)*t*t*t + b; 621 }, 622 easeOutQuart: function (x, t, b, c, d) { 623 return -c * ((t=t/d-1)*t*t*t - 1) + b; 624 }, 625 easeInOutQuart: function (x, t, b, c, d) { 626 if ((t/=d/2) < 1) return c/2*t*t*t*t + b; 627 return -c/2 * ((t-=2)*t*t*t - 2) + b; 628 }, 629 easeInQuint: function (x, t, b, c, d) { 630 return c*(t/=d)*t*t*t*t + b; 631 }, 632 easeOutQuint: function (x, t, b, c, d) { 633 return c*((t=t/d-1)*t*t*t*t + 1) + b; 634 }, 635 easeInOutQuint: function (x, t, b, c, d) { 636 if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b; 637 return c/2*((t-=2)*t*t*t*t + 2) + b; 638 }, 639 easeInSine: function (x, t, b, c, d) { 640 return -c * Math.cos(t/d * (Math.PI/2)) + c + b; 641 }, 642 easeOutSine: function (x, t, b, c, d) { 643 return c * Math.sin(t/d * (Math.PI/2)) + b; 644 }, 645 easeInOutSine: function (x, t, b, c, d) { 646 return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; 647 }, 648 easeInExpo: function (x, t, b, c, d) { 649 return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b; 650 }, 651 easeOutExpo: function (x, t, b, c, d) { 652 return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b; 653 }, 654 easeInOutExpo: function (x, t, b, c, d) { 655 if (t==0) return b; 656 if (t==d) return b+c; 657 if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b; 658 return c/2 * (-Math.pow(2, -10 * --t) + 2) + b; 659 }, 660 easeInCirc: function (x, t, b, c, d) { 661 return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b; 662 }, 663 easeOutCirc: function (x, t, b, c, d) { 664 return c * Math.sqrt(1 - (t=t/d-1)*t) + b; 665 }, 666 easeInOutCirc: function (x, t, b, c, d) { 667 if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b; 668 return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b; 669 }, 670 easeInElastic: function (x, t, b, c, d) { 671 var s=1.70158;var p=0;var a=c; 672 if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; 673 if (a < Math.abs(c)) { a=c; var s=p/4; } 674 else var s = p/(2*Math.PI) * Math.asin (c/a); 675 return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; 676 }, 677 easeOutElastic: function (x, t, b, c, d) { 678 var s=1.70158;var p=0;var a=c; 679 if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; 680 if (a < Math.abs(c)) { a=c; var s=p/4; } 681 else var s = p/(2*Math.PI) * Math.asin (c/a); 682 return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b; 683 }, 684 easeInOutElastic: function (x, t, b, c, d) { 685 var s=1.70158;var p=0;var a=c; 686 if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5); 687 if (a < Math.abs(c)) { a=c; var s=p/4; } 688 else var s = p/(2*Math.PI) * Math.asin (c/a); 689 if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; 690 return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b; 691 }, 692 easeInBack: function (x, t, b, c, d, s) { 693 if (s == undefined) s = 1.70158; 694 return c*(t/=d)*t*((s+1)*t - s) + b; 695 }, 696 easeOutBack: function (x, t, b, c, d, s) { 697 if (s == undefined) s = 1.70158; 698 return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; 699 }, 700 easeInOutBack: function (x, t, b, c, d, s) { 701 if (s == undefined) s = 1.70158; 702 if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; 703 return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; 704 }, 705 easeInBounce: function (x, t, b, c, d) { 706 return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b; 707 }, 708 easeOutBounce: function (x, t, b, c, d) { 709 if ((t/=d) < (1/2.75)) { 710 return c*(7.5625*t*t) + b; 711 } else if (t < (2/2.75)) { 712 return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; 713 } else if (t < (2.5/2.75)) { 714 return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; 715 } else { 716 return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; 717 } 718 }, 719 easeInOutBounce: function (x, t, b, c, d) { 720 if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b; 721 return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b; 722 } 723});
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.