vendor: 8,783 bytes, lines 1-230
1//////////////////////////////////////////////////// 2//////////////////////////////////////////////////// 3/* 4jQuery Core Plugins 5 6* jQuery Easing v1.3 7* Background position animation for jQuery v1.1.1. 8* jQuery css clip animation 9* jquery.transform.js 10* jQuery Cookie 11* jquery.color 12* jquery.socialbutton-1.9.1 13*/ 14//////////////////////////////////////////////////// 15//////////////////////////////////////////////////// 16 17/*-------------------------------------------------- 18* jQuery Easing v1.3 19--------------------------------------------------*/ 20/* 21 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ 22 * 23 * Uses the built in easing capabilities added In jQuery 1.1 24 * to offer multiple easing options 25 * 26 * TERMS OF USE - jQuery Easing 27 * 28 * Open source under the BSD License. 29 * 30 * Copyright ï¾ï½© 2008 George McGinley Smith 31 * All rights reserved. 32 * 33 * Redistribution and use in source and binary forms, with or without modification, 34 * are permitted provided that the following conditions are met: 35 * 36 * Redistributions of source code must retain the above copyright notice, this list of 37 * conditions and the following disclaimer. 38 * Redistributions in binary form must reproduce the above copyright notice, this list 39 * of conditions and the following disclaimer in the documentation and/or other materials 40 * provided with the distribution. 41 * 42 * Neither the name of the author nor the names of contributors may be used to endorse 43 * or promote products derived from this software without specific prior written permission. 44 * 45 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 46 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 47 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 48 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 49 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 50 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 51 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 52 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 53 * OF THE POSSIBILITY OF SUCH DAMAGE. 54 * 55*/ 56 57// t: current time, b: begInnIng value, c: change In value, d: duration 58jQuery.easing['jswing'] = jQuery.easing['swing']; 59 60jQuery.extend( jQuery.easing, 61{ 62 def: 'easeOutQuad', 63 swing: function (x, t, b, c, d) { 64 //alert(jQuery.easing.default); 65 return jQuery.easing[jQuery.easing.def](x, t, b, c, d); 66 }, 67 easeInQuad: function (x, t, b, c, d) { 68 return c*(t/=d)*t + b; 69 }, 70 easeOutQuad: function (x, t, b, c, d) { 71 return -c *(t/=d)*(t-2) + b; 72 }, 73 easeInOutQuad: function (x, t, b, c, d) { 74 if ((t/=d/2) < 1) return c/2*t*t + b; 75 return -c/2 * ((--t)*(t-2) - 1) + b; 76 }, 77 easeInCubic: function (x, t, b, c, d) { 78 return c*(t/=d)*t*t + b; 79 }, 80 easeOutCubic: function (x, t, b, c, d) { 81 return c*((t=t/d-1)*t*t + 1) + b; 82 }, 83 easeInOutCubic: function (x, t, b, c, d) { 84 if ((t/=d/2) < 1) return c/2*t*t*t + b; 85 return c/2*((t-=2)*t*t + 2) + b; 86 }, 87 easeInQuart: function (x, t, b, c, d) { 88 return c*(t/=d)*t*t*t + b; 89 }, 90 easeOutQuart: function (x, t, b, c, d) { 91 return -c * ((t=t/d-1)*t*t*t - 1) + b; 92 }, 93 easeInOutQuart: function (x, t, b, c, d) { 94 if ((t/=d/2) < 1) return c/2*t*t*t*t + b; 95 return -c/2 * ((t-=2)*t*t*t - 2) + b; 96 }, 97 easeInQuint: function (x, t, b, c, d) { 98 return c*(t/=d)*t*t*t*t + b; 99 }, 100 easeOutQuint: function (x, t, b, c, d) { 101 return c*((t=t/d-1)*t*t*t*t + 1) + b; 102 }, 103 easeInOutQuint: function (x, t, b, c, d) { 104 if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b; 105 return c/2*((t-=2)*t*t*t*t + 2) + b; 106 }, 107 easeInSine: function (x, t, b, c, d) { 108 return -c * Math.cos(t/d * (Math.PI/2)) + c + b; 109 }, 110 easeOutSine: function (x, t, b, c, d) { 111 return c * Math.sin(t/d * (Math.PI/2)) + b; 112 }, 113 easeInOutSine: function (x, t, b, c, d) { 114 return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; 115 }, 116 easeInExpo: function (x, t, b, c, d) { 117 return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b; 118 }, 119 easeOutExpo: function (x, t, b, c, d) { 120 return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b; 121 }, 122 easeInOutExpo: function (x, t, b, c, d) { 123 if (t==0) return b; 124 if (t==d) return b+c; 125 if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b; 126 return c/2 * (-Math.pow(2, -10 * --t) + 2) + b; 127 }, 128 easeInCirc: function (x, t, b, c, d) { 129 return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b; 130 }, 131 easeOutCirc: function (x, t, b, c, d) { 132 return c * Math.sqrt(1 - (t=t/d-1)*t) + b; 133 }, 134 easeInOutCirc: function (x, t, b, c, d) { 135 if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b; 136 return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b; 137 }, 138 easeInElastic: function (x, t, b, c, d) { 139 var s=1.70158;var p=0;var a=c; 140 if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; 141 if (a < Math.abs(c)) { a=c; var s=p/4; } 142 else var s = p/(2*Math.PI) * Math.asin (c/a); 143 return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; 144 }, 145 easeOutElastic: function (x, t, b, c, d) { 146 var s=1.70158;var p=0;var a=c; 147 if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; 148 if (a < Math.abs(c)) { a=c; var s=p/4; } 149 else var s = p/(2*Math.PI) * Math.asin (c/a); 150 return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b; 151 }, 152 easeInOutElastic: function (x, t, b, c, d) { 153 var s=1.70158;var p=0;var a=c; 154 if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5); 155 if (a < Math.abs(c)) { a=c; var s=p/4; } 156 else var s = p/(2*Math.PI) * Math.asin (c/a); 157 if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; 158 return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b; 159 }, 160 easeInBack: function (x, t, b, c, d, s) { 161 if (s == undefined) s = 1.70158; 162 return c*(t/=d)*t*((s+1)*t - s) + b; 163 }, 164 easeOutBack: function (x, t, b, c, d, s) { 165 if (s == undefined) s = 1.70158; 166 return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; 167 }, 168 easeInOutBack: function (x, t, b, c, d, s) { 169 if (s == undefined) s = 1.70158; 170 if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; 171 return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; 172 }, 173 easeInBounce: function (x, t, b, c, d) { 174 return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b; 175 }, 176 easeOutBounce: function (x, t, b, c, d) { 177 if ((t/=d) < (1/2.75)) { 178 return c*(7.5625*t*t) + b; 179 } else if (t < (2/2.75)) { 180 return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; 181 } else if (t < (2.5/2.75)) { 182 return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; 183 } else { 184 return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; 185 } 186 }, 187 easeInOutBounce: function (x, t, b, c, d) { 188 if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b; 189 return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b; 190 } 191}); 192 193/* 194 * 195 * TERMS OF USE - EASING EQUATIONS 196 * 197 * Open source under the BSD License. 198 * 199 * Copyright ï¾ï½© 2001 Robert Penner 200 * All rights reserved. 201 * 202 * Redistribution and use in source and binary forms, with or without modification, 203 * are permitted provided that the following conditions are met: 204 * 205 * Redistributions of source code must retain the above copyright notice, this list of 206 * conditions and the following disclaimer. 207 * Redistributions in binary form must reproduce the above copyright notice, this list 208 * of conditions and the following disclaimer in the documentation and/or other materials 209 * provided with the distribution. 210 * 211 * Neither the name of the author nor the names of contributors may be used to endorse 212 * or promote products derived from this software without specific prior written permission. 213 * 214 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 215 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 216 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 217 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 218 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 219 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 220 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 221 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 222 * OF THE POSSIBILITY OF SUCH DAMAGE. 223 * 224 */ 225 226 227/*-------------------------------------------------- 228* Background position animation for jQuery v1.1.1. 229--------------------------------------------------*/ 230/*
231 Background position animation for jQuery v1.1.1. 232 Written by Keith Wood (kbwood{at}iinet.com.au) November 2010. 233 Available under the MIT license. 234 Please attribute the author if you use it. */ 235(function($){var g=!!$.Tween;if(g){$.Tween.propHooks['backgroundPosition']={get:function(a){return parseBackgroundPosition($(a.elem).css(a.prop))},set:setBackgroundPosition}}else{$.fx.step['backgroundPosition']=setBackgroundPosition};function parseBackgroundPosition(c){var d=(c||'').split(/ /);var e={center:'50%',left:'0%',right:'100%',top:'0%',bottom:'100%'};var f=function(a){var b=(e[d[a]]||d[a]||'50%').match(/^([+-]=)?([+-]?\d+(\.\d*)?)(.*)$/);d[a]=[b[1],parseFloat(b[2]),b[4]||'px']};if(d.length==1&&$.inArray(d[0],['top','bottom'])>-1){d[1]=d[0];d[0]='50%'}f(0);f(1);return d}function setBackgroundPosition(a){if(!a.set){initBackgroundPosition(a)}$(a.elem).css('background-position',((a.pos*(a.end[0][1]-a.start[0][1])+a.start[0][1])+a.end[0][2])+' '+((a.pos*(a.end[1][1]-a.start[1][1])+a.start[1][1])+a.end[1][2]))}
235function initBackgroundPosition(a){a.start=parseBackgroundPosition($(a.elem).css('backgroundPosition'));a.end=parseBackgroundPosition(a.end);for(var i=0;i<a.end.length;i++){if(a.end[i][0]){a.end[i][1]=a.start[i][1]+(a.end[i][0]=='-='?-1:+1)*a.end[i][1]}}a.set=true}})(jQuery); 236 237 238 239/*-------------------------------------------------- 240* jQuery css clip animation 241--------------------------------------------------*/ 242/* 243* jQuery css clip animation support -- Jim Palmer 244* version 0.1.2b 245* idea spawned from jquery.color.js by John Resig 246* Released under the MIT license. 247*/ 248(function(jQuery) { 249jQuery.fx.step.clip = function(fx) { 250if (fx.state == 0) { 251/* handle three valid possibilities 252* val val val val 253* val, val, val, val 254* val,val,val,val 255*/ 256var cRE = /rect\(([0-9]{1,})(px|em)[,\s]+([0-9]{1,})(px|em)[,\s]+([0-9]{1,})(px|em)[,\s]+([0-9]{1,})(px|em)\)/; 257// no longer replace commas - they may not exist and the regex compensates for them anyway 258//grab the curent clip region of the element 259$elem = $(fx.elem); 260var clip = cRE.test(fx.elem.style.clip) ? fx.elem.style.clip : 'rect(0px ' + $elem.width() + 'px ' + $elem.height() + 'px 0px)'; 261fx.start = cRE.exec(clip.replace(/,/g, " ")); 262// handle the fx.end error 263try { 264fx.end = cRE.exec(fx.end.replace(/,/g, '')); 265} catch (e) { 266return false; 267} 268} 269var sarr = new Array(), earr = new Array(), spos = fx.start.length, epos = fx.end.length, 270emOffset = fx.start[ss + 1] == 'em' ? (parseInt($(fx.elem).css('fontSize')) * 1.333 * parseInt(fx.start[ss])) : 1; 271for (var ss = 1; ss < spos; ss += 2) { sarr.push(parseInt(emOffset * fx.start[ss])); } 272for (var es = 1; es < epos; es += 2) { earr.push(parseInt(emOffset * fx.end[es])); } 273fx.elem.style.clip = 'rect(' + 274parseInt((fx.pos * (earr[0] - sarr[0])) + sarr[0]) + 'px ' + 275parseInt((fx.pos * (earr[1] - sarr[1])) + sarr[1]) + 'px ' + 276parseInt((fx.pos * (earr[2] - sarr[2])) + sarr[2]) + 'px ' + 277parseInt((fx.pos * (earr[3] - sarr[3])) + sarr[3]) + 'px)'; 278} 279})(jQuery); 280 281 282/*-------------------------------------------------- 283* jquery.transform.js 284--------------------------------------------------*/ 285/*! 286 * jQuery 2d/3d Transform v@.@.@ 287 * 288 * Extend jQuery animate function adding css3 2D & 3D animation. 289 * Copyright 2013, Thomas THELLIEZ (http://eenox.net/) 290 * 291 * Fork from jQuery 2d Transform v0.9.3 (http://wiki.github.com/heygrady/transform/) 292 * Copyright 2010, Grady Kuhnline 293 * 294 * Dual licensed under the MIT or GPL Version 2 licenses. 295 * http://jquery.org/license 296 * 297 * Date: Sat Dec 4 15:46:09 2010 -0800 298 */ 299/////////////////////////////////////////////////////// 300// Transform 301/////////////////////////////////////////////////////// 302(function($, window, document, undefined) { 303 /** 304 * @var Regex identify the matrix filter in IE 305 */ 306 var rmatrix = /progid:DXImageTransform\.Microsoft\.Matrix\(.*?\)/, 307 rfxnum = /^([\+\-]=)?([\d+.\-]+)(.*)$/, 308 rperc = /%/; 309 310 // Steal some code from Modernizr 311 var m = document.createElement( 'modernizr' ), 312 m_style = m.style; 313 314 function stripUnits(arg) { 315 return parseFloat(arg); 316 } 317 318 /** 319 * Find the prefix that this browser uses 320 */ 321 function getVendorPrefix() { 322 var property = { 323 transformProperty : '', 324 MozTransform : '-moz-', 325 WebkitTransform : '-webkit-', 326 OTransform : '-o-', 327 msTransform : '-ms-' 328 }; 329 for (var p in property) { 330 if (typeof m_style[p] != 'undefined') { 331 return property[p]; 332 } 333 } 334 return null; 335 } 336 337 function supportCssTransforms() { 338 if (typeof(window.Modernizr) !== 'undefined') { 339 return Modernizr.csstransforms; 340 } 341 342 var props = [ 'transformProperty', 'WebkitTransform', 'MozTransform', 'OTransform', 'msTransform' ]; 343 for ( var i in props ) { 344 if ( m_style[ props[i] ] !== undefined ) { 345 return true; 346 } 347 } 348 } 349 350 // Capture some basic properties 351 var vendorPrefix = getVendorPrefix(), 352 transformProperty = vendorPrefix !== null ? vendorPrefix + 'transform' : false, 353 transformOriginProperty = vendorPrefix !== null ? vendorPrefix + 'transform-origin' : false; 354 355 // store support in the jQuery Support object 356 $.support.csstransforms = supportCssTransforms(); 357 358 // IE9 public preview 6 requires the DOM names 359 if (vendorPrefix == '-ms-') { 360 transformProperty = 'msTransform'; 361 transformOriginProperty = 'msTransformOrigin'; 362 } 363 364 /** 365 * Class for creating cross-browser transformations 366 * @constructor 367 */ 368 $.extend({ 369 transform: function(elem) { 370 // Cache the transform object on the element itself 371 elem.transform = this; 372 373 /** 374 * The element we're working with 375 * @var jQueryCollection 376 */ 377 this.$elem = $(elem); 378 379 /** 380 * Remember the matrix we're applying to help the safeOuterLength func 381 */ 382 this.applyingMatrix = false;
383 this.matrix = null; 384 385 /** 386 * Remember the css height and width to save time 387 * This is only really used in IE 388 * @var Number 389 */ 390 this.height = null; 391 this.width = null; 392 this.outerHeight = null; 393 this.outerWidth = null; 394 395 /** 396 * We need to know the box-sizing in IE for building the outerHeight and outerWidth 397 * @var string 398 */ 399 this.boxSizingValue = null; 400 this.boxSizingProperty = null; 401 402 this.attr = null; 403 this.transformProperty = transformProperty; 404 this.transformOriginProperty = transformOriginProperty; 405 } 406 }); 407 408 $.extend($.transform, { 409 /** 410 * @var Array list of all valid transform functions 411 */ 412 funcs: ['matrix', 'origin', 'reflect', 'reflectX', 'reflectXY', 'reflectY', 'rotate', 'rotateX', 'rotateY', 'rotateZ', 'scale', 'scaleX', 'scaleY', 'scaleZ', 'scale3d', 'skew', 'skewX', 'skewY', 'translate', 'translateX', 'translateY', 'translateZ', 'translate3d'] 413 }); 414 415 /** 416 * Create Transform as a jQuery plugin 417 * @param Object funcs 418 * @param Object options 419 */ 420 $.fn.transform = function(funcs, options) { 421 return this.each(function() { 422 var t = this.transform || new $.transform(this); 423 if (funcs) { 424 t.exec(funcs, options); 425 } 426 }); 427 }; 428 429 $.transform.prototype = { 430 /** 431 * Applies all of the transformations 432 * @param Object funcs 433 * @param Object options 434 * forceMatrix - uses the matrix in all browsers 435 * preserve - tries to preserve the values from previous runs 436 */ 437 exec: function(funcs, options) { 438 // extend options 439 options = $.extend(true, { 440 forceMatrix: false, 441 preserve: false 442 }, options); 443 444 // preserve the funcs from the previous run 445 this.attr = null; 446 if (options.preserve) { 447 funcs = $.extend(true, this.getAttrs(true, true), funcs); 448 } else { 449 funcs = $.extend(true, {}, funcs); // copy the object to prevent weirdness 450 } 451 452 // Record the custom attributes on the element itself 453 this.setAttrs(funcs); 454 455 // apply the funcs 456 if ($.support.csstransforms && !options.forceMatrix) { 457 // CSS3 is supported 458 return this.execFuncs(funcs); 459 } else if ($.browser.msie || ($.support.csstransforms && options.forceMatrix)) { 460 // Internet Explorer or Forced matrix 461 return this.execMatrix(funcs); 462 } 463 return false; 464 }, 465 466 /** 467 * Applies all of the transformations as functions 468 * @param Object funcs 469 */ 470 execFuncs: function(funcs) { 471 var values = []; 472 473 // construct a CSS string 474 for (var func in funcs) { 475 // handle origin separately 476 if (func == 'origin') { 477 this[func].apply(this, $.isArray(funcs[func]) ? funcs[func] : [funcs[func]]); 478 } else if ($.inArray(func, $.transform.funcs) !== -1) { 479 values.push(this.createTransformFunc(func, funcs[func])); 480 } 481 } 482 this.$elem.css(transformProperty, values.join(' ')); 483 return true; 484 }, 485 486 /** 487 * Applies all of the transformations as a matrix 488 * @param Object funcs 489 */ 490 execMatrix: function(funcs) { 491 var matrix, 492 tempMatrix, 493 args; 494 495 var elem = this.$elem[0], 496 _this = this; 497 function normalPixels(val, i) { 498 if (rperc.test(val)) { 499 // this really only applies to translation 500 return parseFloat(val) / 100 * _this['safeOuter' + (i ? 'Height' : 'Width')](); 501 } 502 return toPx(elem, val); 503 } 504 505 var rtranslate = /translate[X|Y|Z|3d]?/, 506 trans = []; 507 508 for (var func in funcs) { 509 switch ($.type(funcs[func])) { 510 case 'array': args = funcs[func]; break; 511 case 'string': args = $.map(funcs[func].split(','), $.trim); break; 512 default: args = [funcs[func]]; 513 } 514 515 if ($.matrix[func]) { 516 517 if ($.cssAngle[func]) { 518 // normalize on degrees 519 args = $.map(args, $.angle.toDegree); 520 } else if (!$.cssNumber[func]) { 521 // normalize to pixels 522 args = $.map(args, normalPixels); 523 } else { 524 // strip units 525 args = $.map(args, stripUnits); 526 } 527 528 tempMatrix = $.matrix[func].apply(this, args); 529 if (rtranslate.test(func)) { 530 //defer translation 531 trans.push(tempMatrix); 532 } else { 533 matrix = matrix ? matrix.x(tempMatrix) : tempMatrix; 534 } 535 } else if (func == 'origin') { 536 this[func].apply(this, args); 537 } 538 } 539 540 // check that we have a matrix 541 matrix = matrix || $.matrix.identity(); 542 543 // Apply translation 544 $.each(trans, function(i, val) { matrix = matrix.x(val); }); 545 546 // pull out the relevant values 547 var a = parseFloat(matrix.e(1,1).toFixed(6)), 548 b = parseFloat(matrix.e(2,1).toFixed(6)), 549 c = parseFloat(matrix.e(1,2).toFixed(6)), 550 d = parseFloat(matrix.e(2,2).toFixed(6)), 551 tx = matrix.rows === 3 ? parseFloat(matrix.e(1,3).toFixed(6)) : 0, 552 ty = matrix.rows === 3 ? parseFloat(matrix.e(2,3).toFixed(6)) : 0; 553 //apply the transform to the element
554 if ($.support.csstransforms && vendorPrefix === '-moz-') { 555 // -moz- 556 this.$elem.css(transformProperty, 'matrix(' + a + ', ' + b + ', ' + c + ', ' + d + ', ' + tx + 'px, ' + ty + 'px)'); 557 } else if ($.support.csstransforms) { 558 // -webkit, -o-, w3c 559 // NOTE: WebKit and Opera don't allow units on the translate variables 560 this.$elem.css(transformProperty, 'matrix(' + a + ', ' + b + ', ' + c + ', ' + d + ', ' + tx + ', ' + ty + ')'); 561 } else if ($.browser.msie && $.browser.version < 9) { 562 // IE 7 & 8 requires the special transform Filter 563 564 //TODO: Use Nearest Neighbor during animation FilterType=\'nearest neighbor\' 565 var filterType = ', FilterType=\'nearest neighbor\''; //bilinear 566 var style = this.$elem[0].style; 567 var matrixFilter = 'progid:DXImageTransform.Microsoft.Matrix(' + 568 'M11=' + a + ', M12=' + c + ', M21=' + b + ', M22=' + d + 569 ', sizingMethod=\'auto expand\'' + filterType + ')'; 570 var filter = style.filter || $.curCSS( this.$elem[0], "filter" ) || ""; 571 style.filter = rmatrix.test(filter) ? filter.replace(rmatrix, matrixFilter) : filter ? filter + ' ' + matrixFilter : matrixFilter; 572 573 // Let's know that we're applying post matrix fixes and the height/width will be static for a bit 574 this.applyingMatrix = true; 575 this.matrix = matrix; 576 577 // IE can't set the origin or translate directly 578 this.fixPosition(matrix, tx, ty); 579 580 this.applyingMatrix = false; 581 this.matrix = null; 582 } 583 return true; 584 }, 585 586 /** 587 * Sets the transform-origin 588 * This really needs to be percentages 589 * @param Number x length 590 * @param Number y length 591 */ 592 origin: function(x, y) { 593 // use CSS in supported browsers 594 if ($.support.csstransforms) { 595 if (typeof y === 'undefined') { 596 this.$elem.css(transformOriginProperty, x); 597 } else { 598 this.$elem.css(transformOriginProperty, x + ' ' + y); 599 } 600 return true; 601 } 602 603 // correct for keyword lengths 604 switch (x) { 605 case 'left': x = '0'; break; 606 case 'right': x = '100%'; break; 607 case 'center': // no break 608 case undefined: x = '50%'; 609 } 610 switch (y) { 611 case 'top': y = '0'; break; 612 case 'bottom': y = '100%'; break; 613 case 'center': // no break 614 case undefined: y = '50%'; //TODO: does this work? 615 } 616 617 // store mixed values with units, assumed pixels 618 if (typeof(window.Modernizr) !== 'undefined' && Modernizr.csstransforms3d) { 619 this.setAttr('origin', [ 620 rperc.test(x) ? x : toPx(this.$elem[0], x) + 'px', 621 rperc.test(y) ? y : toPx(this.$elem[0], y) + 'px', 622 '0' 623 ]); 624 } else 625 this.setAttr('origin', [ 626 rperc.test(x) ? x : toPx(this.$elem[0], x) + 'px', 627 rperc.test(y) ? y : toPx(this.$elem[0], y) + 'px' 628 ]); 629 //console.log(this.getAttr('origin')); 630 return true; 631 }, 632 633 /** 634 * Create a function suitable for a CSS value 635 * @param string func 636 * @param Mixed value 637 */ 638 createTransformFunc: function(func, value) { 639 if (func.substr(0, 7) === 'reflect') { 640 // let's fake reflection, false value 641 // falsey sets an identity matrix 642 var m = value ? $.matrix[func]() : $.matrix.identity(); 643 return 'matrix(' + m.e(1,1) + ', ' + m.e(2,1) + ', ' + m.e(1,2) + ', ' + m.e(2,2) + ', 0, 0)'; 644 } 645 646 //value = _correctUnits(func, value); 647 648 if (func == 'matrix') { 649 if (vendorPrefix === '-moz-') { 650 value[4] = value[4] ? value[4] + 'px' : 0; 651 value[5] = value[5] ? value[5] + 'px' : 0; 652 } 653 } 654 return func + '(' + ($.isArray(value) ? value.join(', ') : value) + ')'; 655 }, 656 657 /** 658 * @param Matrix matrix 659 * @param Number tx 660 * @param Number ty 661 * @param Number height 662 * @param Number width 663 */ 664 fixPosition: function(matrix, tx, ty, height, width) { 665 // now we need to fix it! 666 var calc = new $.matrix.calc(matrix, this.safeOuterHeight(), this.safeOuterWidth()), 667 origin = this.getAttr('origin'); // mixed percentages and px 668 669 // translate a 0, 0 origin to the current origin 670 var offset = calc.originOffset(new $.matrix.V2( 671 rperc.test(origin[0]) ? parseFloat(origin[0])/100*calc.outerWidth : parseFloat(origin[0]), 672 rperc.test(origin[1]) ? parseFloat(origin[1])/100*calc.outerHeight : parseFloat(origin[1]) 673 )); 674 675 // IE glues the top-most and left-most pixels of the transformed object to top/left of the original object 676 //TODO: This seems wrong in the calculations 677 var sides = calc.sides(); 678 679 // Protect against an item that is already positioned 680 var cssPosition = this.$elem.css('position'); 681 if (cssPosition == 'static') { 682 cssPosition = 'relative'; 683 } 684 685 //TODO: if the element is already positioned, we should attempt to respect it (somehow)
686 //NOTE: we could preserve our offset top and left in an attr on the elem 687 var pos = {top: 0, left: 0}; 688 689 // Approximates transform-origin, tx, and ty 690 var css = { 691 'position': cssPosition, 692 'top': (offset.top + ty + sides.top + pos.top) + 'px', 693 'left': (offset.left + tx + sides.left + pos.left) + 'px', 694 'zoom': 1 695 }; 696 697 this.$elem.css(css); 698 } 699 }; 700 701 /** 702 * Ensure that values have the appropriate units on them 703 * @param string func 704 * @param Mixed value 705 */ 706 function toPx(elem, val) { 707 var parts = rfxnum.exec($.trim(val)); 708 709 if (parts[3] && parts[3] !== 'px') { 710 var prop = 'paddingBottom', 711 orig = $.style( elem, prop ); 712 713 $.style( elem, prop, val ); 714 val = cur( elem, prop ); 715 $.style( elem, prop, orig ); 716 return val; 717 } 718 return parseFloat( val ); 719 } 720 721 function cur(elem, prop) { 722 if ( elem[prop] != null && (!elem.style || elem.style[prop] == null) ) { 723 return elem[ prop ]; 724 } 725 726 var r = parseFloat( $.css( elem, prop ) ); 727 return r && r > -10000 ? r : 0; 728 } 729})(jQuery, this, this.document); 730 731 732/////////////////////////////////////////////////////// 733// Safe Outer Length 734/////////////////////////////////////////////////////// 735(function($, window, document, undefined) { 736 $.extend($.transform.prototype, { 737 /** 738 * @param void 739 * @return Number 740 */ 741 safeOuterHeight: function() { 742 return this.safeOuterLength('height'); 743 }, 744 745 /** 746 * @param void 747 * @return Number 748 */ 749 safeOuterWidth: function() { 750 return this.safeOuterLength('width'); 751 }, 752 753 /** 754 * Returns reliable outer dimensions for an object that may have been transformed. 755 * Only use this if the matrix isn't handy 756 * @param String dim height or width 757 * @return Number 758 */ 759 safeOuterLength: function(dim) { 760 var funcName = 'outer' + (dim == 'width' ? 'Width' : 'Height'); 761 762 if (!$.support.csstransforms && $.browser.msie && $.browser.version < 9) { 763 // make the variables more generic 764 dim = dim == 'width' ? 'width' : 'height'; 765 766 // if we're transforming and have a matrix; we can shortcut. 767 // the true outerHeight is the transformed outerHeight divided by the ratio. 768 // the ratio is equal to the height of a 1px by 1px box that has been transformed by the same matrix. 769 if (this.applyingMatrix && !this[funcName] && this.matrix) { 770 // calculate and return the correct size 771 var calc = new $.matrix.calc(this.matrix, 1, 1), 772 ratio = calc.offset(), 773 length = this.$elem[funcName]() / ratio[dim]; 774 this[funcName] = length; 775 776 return length; 777 } else if (this.applyingMatrix && this[funcName]) { 778 // return the cached calculation 779 return this[funcName]; 780 } 781 782 // map dimensions to box sides 783 var side = { 784 height: ['top', 'bottom'], 785 width: ['left', 'right'] 786 }; 787 788 // setup some variables 789 var elem = this.$elem[0], 790 outerLen = parseFloat($.curCSS(elem, dim, true)), //TODO: this can be cached on animations that do not animate height/width 791 boxSizingProp = this.boxSizingProperty, 792 boxSizingValue = this.boxSizingValue; 793 794 // IE6 && IE7 will never have a box-sizing property, so fake it 795 if (!this.boxSizingProperty) { 796 boxSizingProp = this.boxSizingProperty = _findBoxSizingProperty() || 'box-sizing'; 797 boxSizingValue = this.boxSizingValue = this.$elem.css(boxSizingProp) || 'content-box'; 798 } 799 800 // return it immediately if we already know it 801 if (this[funcName] && this[dim] == outerLen) { 802 return this[funcName]; 803 } else { 804 this[dim] = outerLen; 805 } 806 807 // add in the padding and border 808 if (boxSizingProp && (boxSizingValue == 'padding-box' || boxSizingValue == 'content-box')) { 809 outerLen += parseFloat($.curCSS(elem, 'padding-' + side[dim][0], true)) || 0 + 810 parseFloat($.curCSS(elem, 'padding-' + side[dim][1], true)) || 0; 811 } 812 if (boxSizingProp && boxSizingValue == 'content-box') { 813 outerLen += parseFloat($.curCSS(elem, 'border-' + side[dim][0] + '-width', true)) || 0 + 814 parseFloat($.curCSS(elem, 'border-' + side[dim][1] + '-width', true)) || 0; 815 } 816 817 // remember and return the outerHeight 818 this[funcName] = outerLen; 819 return outerLen; 820 } 821 return this.$elem[funcName](); 822 } 823 }); 824 825 /** 826 * Determine the correct property for checking the box-sizing property 827 * @param void 828 * @return string 829 */ 830 var _boxSizingProperty = null; 831 function _findBoxSizingProperty () { 832 if (_boxSizingProperty) { 833 return _boxSizingProperty; 834 } 835 836 var property = { 837 boxSizing : 'box-sizing', 838 MozBoxSizing : '-moz-box-sizing', 839 WebkitBoxSizing : '-webkit-box-sizing', 840 OBoxSizing : '-o-box-sizing' 841 }, 842 elem = document.body; 843 844 for (var p in property) { 845 if (typeof elem.style[p] != 'undefined') { 846 _boxSizingProperty = property[p]; 847 return _boxSizingProperty; 848 } 849 } 850 return null; 851 } 852})(jQuery, this, this.document); 853 854
855/////////////////////////////////////////////////////// 856// Attr 857/////////////////////////////////////////////////////// 858(function($, window, document, undefined) { 859 var rfuncvalue = /([\w\-]*?)\((.*?)\)/g, // with values 860 attr = 'data-transform', 861 rspace = /\s/, 862 rcspace = /,\s?/; 863 864 $.extend($.transform.prototype, { 865 /** 866 * This overrides all of the attributes 867 * @param Object funcs a list of transform functions to store on this element 868 * @return void 869 */ 870 setAttrs: function(funcs) { 871 var string = '', 872 value; 873 for (var func in funcs) { 874 value = funcs[func]; 875 if ($.isArray(value)) { 876 value = value.join(', '); 877 } 878 string += ' ' + func + '(' + value + ')'; 879 } 880 this.attr = $.trim(string); 881 this.$elem.attr(attr, this.attr); 882 }, 883 884 /** 885 * This sets only a specific atribute 886 * @param string func name of a transform function 887 * @param mixed value with proper units 888 * @return void 889 */ 890 setAttr: function(func, value) { 891 // stringify the value 892 if ($.isArray(value)) { 893 value = value.join(', '); 894 } 895 896 // pull from a local variable to look it up 897 var transform = this.attr || this.$elem.attr(attr); 898 if (!transform || transform.indexOf(func) == -1) { 899 // we don't have any existing values, save it 900 // we don't have this function yet, save it 901 this.attr = $.trim(transform + ' ' + func + '(' + value + ')'); 902 this.$elem.attr(attr, this.attr); 903 } else { 904 // replace the existing value 905 var funcs = [], parts; 906 907 // regex split 908 rfuncvalue.lastIndex = 0; // reset the regex pointer 909 while (parts = rfuncvalue.exec(transform)) { 910 if (func == parts[1]) { 911 funcs.push(func + '(' + value + ')'); 912 } else { 913 funcs.push(parts[0]); 914 } 915 } 916 this.attr = funcs.join(' '); 917 this.$elem.attr(attr, this.attr); 918 } 919 }, 920 921 /** 922 * @return Object 923 */ 924 getAttrs: function() { 925 var transform = this.attr || this.$elem.attr(attr); 926 if (!transform) { 927 // We don't have any existing values, return empty object 928 return {}; 929 } 930 931 // replace the existing value 932 var attrs = {}, parts, value; 933 934 rfuncvalue.lastIndex = 0; // reset the regex pointer 935 while ((parts = rfuncvalue.exec(transform)) !== null) { 936 if (parts) { 937 value = parts[2].split(rcspace); 938 attrs[parts[1]] = value.length == 1 ? value[0] : value; 939 } 940 } 941 return attrs; 942 }, 943 944 /** 945 * @param String func 946 * @return mixed 947 */ 948 getAttr: function(func) { 949 var attrs = this.getAttrs(); 950 if (typeof attrs[func] !== 'undefined') { 951 return attrs[func]; 952 } 953 954 //TODO: move the origin to a function 955 if (func === 'origin' && $.support.csstransforms) { 956 // supported browsers return percentages always 957 return this.$elem.css(this.transformOriginProperty).split(rspace); 958 } else if (func === 'origin') { 959 // just force IE to also return a percentage 960 return ['50%', '50%']; 961 } 962 963 return $.cssDefault[func] || 0; 964 } 965 }); 966 967 // Define 968 if (typeof($.cssAngle) == 'undefined') { 969 $.cssAngle = {}; 970 } 971 $.extend($.cssAngle, { 972 rotate: true, 973 rotateX: true, 974 rotateY: true, 975 rotateZ: true, 976 skew: true, 977 skewX: true, 978 skewY: true 979 }); 980 981 // Define default values 982 if (typeof($.cssDefault) == 'undefined') { 983 $.cssDefault = {}; 984 } 985 986 $.extend($.cssDefault, { 987 scale: [1, 1], 988 scaleX: 1, 989 scaleY: 1, 990 scale3d: [1, 1, 1], 991 matrix: [1, 0, 0, 1, 0, 0], 992 origin: ['50%', '50%'], // TODO: allow this to be a function, like get 993 reflect: [1, 0, 0, 1, 0, 0], 994 reflectX: [1, 0, 0, 1, 0, 0], 995 reflectXY: [1, 0, 0, 1, 0, 0], 996 reflectY: [1, 0, 0, 1, 0, 0] 997 }); 998 999 // Define functons with multiple values 1000 if (typeof($.cssMultipleValues) == 'undefined') { 1001 $.cssMultipleValues = {}; 1002 } 1003 $.extend($.cssMultipleValues, { 1004 matrix: 6, 1005 origin: { 1006 length: 2, 1007 duplicate: true 1008 }, 1009 reflect: 6, 1010 reflectX: 6, 1011 reflectXY: 6, 1012 reflectY: 6, 1013 scale: { 1014 length: 2, 1015 duplicate: true 1016 }, 1017 skew: 2, 1018 translate: 2, 1019 translate3d:3, 1020 scale3d:3 1021 }); 1022 1023 // specify unitless funcs 1024 $.extend($.cssNumber, { 1025 matrix: true, 1026 reflect: true, 1027 reflectX: true, 1028 reflectXY: true, 1029 reflectY: true, 1030 scale: true, 1031 scaleX: true, 1032 scaleY: true, 1033 scaleZ: true, 1034 scale3d: true 1035 }); 1036 1037 // override all of the css functions 1038 $.each($.transform.funcs, function(i, func) { 1039 $.cssHooks[func] = {
1040 set: function(elem, value) { 1041 var transform = elem.transform || new $.transform(elem), 1042 funcs = {}; 1043 funcs[func] = value; 1044 transform.exec(funcs, {preserve: true}); 1045 }, 1046 get: function(elem, computed) { 1047 var transform = elem.transform || new $.transform(elem); 1048 return transform.getAttr(func); 1049 } 1050 }; 1051 }); 1052 1053 // Support Reflection animation better by returning a matrix 1054 $.each(['reflect', 'reflectX', 'reflectXY', 'reflectY'], function(i, func) { 1055 $.cssHooks[func].get = function(elem, computed) { 1056 var transform = elem.transform || new $.transform(elem); 1057 return transform.getAttr('matrix') || $.cssDefault[func]; 1058 }; 1059 }); 1060})(jQuery, this, this.document); 1061/////////////////////////////////////////////////////// 1062// Animation 1063/////////////////////////////////////////////////////// 1064(function($, window, document, undefined) { 1065 /** 1066 * @var Regex looks for units on a string 1067 */ 1068 var rfxnum = /^([+\-]=)?([\d+.\-]+)(.*)$/; 1069 1070 /** 1071 * Doctors prop values in the event that they contain spaces 1072 * @param Object prop 1073 * @param String speed 1074 * @param String easing 1075 * @param Function callback 1076 * @return bool 1077 */ 1078 var _animate = $.fn.animate; 1079 $.fn.animate = function( prop, speed, easing, callback ) { 1080 var optall = $.speed(speed, easing, callback), 1081 mv = $.cssMultipleValues; 1082 1083 // Speed always creates a complete function that must be reset 1084 optall.complete = optall.old; 1085 1086 // Capture multiple values 1087 if (!$.isEmptyObject(prop)) { 1088 if (typeof optall.original === 'undefined') { 1089 optall.original = {}; 1090 } 1091 $.each( prop, function( name, val ) { 1092 if (mv[name] 1093 || $.cssAngle[name] 1094 || (!$.cssNumber[name] && $.inArray(name, $.transform.funcs) !== -1)) { 1095 1096 // Handle special easing 1097 var specialEasing = null; 1098 if (jQuery.isArray(prop[name])) { 1099 var mvlen = 1, len = val.length; 1100 if (mv[name]) { 1101 mvlen = (typeof mv[name].length === 'undefined' ? mv[name] : mv[name].length); 1102 } 1103 if ( len > mvlen 1104 || (len < mvlen && len == 2) 1105 || (len == 2 && mvlen == 2 && isNaN(parseFloat(val[len - 1])))) { 1106 1107 specialEasing = val[len - 1]; 1108 val.splice(len - 1, 1); 1109 } 1110 } 1111 1112 // Store the original values onto the optall 1113 optall.original[name] = val.toString(); 1114 1115 // reduce to a unitless number (to trick animate) 1116 prop[name] = parseFloat(val); 1117 } 1118 } ); 1119 } 1120 1121 //NOTE: we edited prop above to trick animate 1122 //NOTE: we pre-convert to an optall so we can doctor it 1123 return _animate.apply(this, [arguments[0], optall]); 1124 }; 1125 1126 var prop = 'paddingBottom'; 1127 function cur(elem, prop) { 1128 if ( elem[prop] != null && (!elem.style || elem.style[prop] == null) ) { 1129 //return elem[ prop ]; 1130 } 1131 1132 var r = parseFloat( $.css( elem, prop ) ); 1133 return r && r > -10000 ? r : 0; 1134 } 1135 1136 function customizeTween(from, to, unit) { 1137 var multiple = $.cssMultipleValues[this.prop], 1138 angle = $.cssAngle[this.prop]; 1139 1140 //TODO: simply check for the existence of CSS Hooks? 1141 if (multiple || (!$.cssNumber[this.prop] && $.inArray(this.prop, $.transform.funcs) !== -1)) { 1142 this.values = []; 1143 1144 if (!multiple) { 1145 multiple = 1; 1146 } 1147 1148 // Pull out the known values 1149 var values = this.options.original[this.prop], 1150 currentValues = $(this.elem).css(this.prop), 1151 defaultValues = $.cssDefault[this.prop] || 0; 1152 1153 // make sure the current css value is an array 1154 if (!$.isArray(currentValues)) { 1155 currentValues = [currentValues]; 1156 } 1157 1158 // make sure the new values are an array 1159 if (!$.isArray(values)) { 1160 if ($.type(values) === 'string') { 1161 values = values.split(','); 1162 } else { 1163 values = [values]; 1164 } 1165 } 1166 1167 // make sure we have enough new values 1168 var length = multiple.length || multiple, i = 0; 1169 while (values.length < length) { 1170 values.push(multiple.duplicate ? values[0] : defaultValues[i] || 0); 1171 i++; 1172 } 1173 1174 // calculate a start, end and unit for each new value 1175 var start, parts, end, //unit, 1176 fx = this, 1177 transform = fx.elem.transform; 1178 orig = $.style(fx.elem, prop); 1179 1180 $.each(values, function(i, val) { 1181 // find a sensible start value 1182 if (currentValues[i]) { 1183 start = currentValues[i]; 1184 } else if (defaultValues[i] && !multiple.duplicate) { 1185 start = defaultValues[i]; 1186 } else if (multiple.duplicate) { 1187 start = currentValues[0]; 1188 } else { 1189 start = 0; 1190 } 1191 1192 // Force the correct unit on the start 1193 if (angle) { 1194 start = $.angle.toDegree(start); 1195 } else if (!$.cssNumber[fx.prop]) { 1196 parts = rfxnum.exec($.trim(start)); 1197 if (parts[3] && parts[3] !== 'px') { 1198 if (parts[3] === '%') { 1199 start = parseFloat( parts[2] ) / 100 * transform['safeOuter' + (i ? 'Height' : 'Width')](); 1200 } else { 1201 $.style( fx.elem, prop, start); 1202 start = cur(fx.elem, prop); 1203 $.style( fx.elem, prop, orig); 1204 } 1205 } 1206 } 1207 start = parseFloat(start); 1208 1209 // parse the value with a regex 1210 parts = rfxnum.exec($.trim(val)); 1211 1212 if (parts) { 1213 // we found a sensible value and unit 1214 end = parseFloat( parts[2] ); 1215 unit = parts[3] || "px"; //TODO: change to an appropriate default unit 1216 1217 if (angle) { 1218 end = $.angle.toDegree(end + unit); 1219 unit = 'deg'; 1220 } else if (!$.cssNumber[fx.prop] && unit === '%') { 1221 start = (start / transform['safeOuter' + (i ? 'Height' : 'Width')]()) * 100; 1222 } else if (!$.cssNumber[fx.prop] && unit !== 'px') {
1223 $.style( fx.elem, prop, (end || 1) + unit); 1224 start = ((end || 1) / cur(fx.elem, prop)) * start; 1225 $.style( fx.elem, prop, orig); 1226 } 1227 1228 // If a +=/-= token was provided, we're doing a relative animation 1229 if (parts[1]) { 1230 end = ((parts[1] === "-=" ? -1 : 1) * end) + start; 1231 } 1232 } else { 1233 // I don't know when this would happen 1234 end = val; 1235 unit = ''; 1236 } 1237 1238 // Save the values 1239 fx.values.push({ 1240 start: start, 1241 end: end, 1242 unit: unit 1243 }); 1244 }); 1245 } 1246 } 1247 1248 if ($.fx.prototype.custom) { 1249 (function(prototype) { 1250 var _custom = prototype.custom; 1251 prototype.custom = function (from, to, unit) { 1252 customizeTween.apply(this, arguments); 1253 return _custom.apply(this, arguments); 1254 }; 1255 }($.fx.prototype)); 1256 } 1257 1258 // jQuery 1.8+ support 1259 if ($.Animation && $.Animation.tweener) { 1260 $.Animation.tweener($.transform.funcs.join(' '), function(prop, value) { 1261 var tween = this.createTween(prop, value); 1262 customizeTween.apply(tween, [tween.start, tween.end, tween.unit]); 1263 return tween; 1264 }); 1265 } 1266 /** 1267 * Animates a multi value attribute 1268 * @param Object fx 1269 * @return null 1270 */ 1271 $.fx.multipleValueStep = { 1272 _default: function(fx) { 1273 $.each(fx.values, function(i, val) { 1274 fx.values[i].now = val.start + ((val.end - val.start) * fx.pos); 1275 }); 1276 } 1277 }; 1278 $.each(['matrix', 'reflect', 'reflectX', 'reflectXY', 'reflectY'], function(i, func) { 1279 $.fx.multipleValueStep[func] = function(fx) { 1280 var d = fx.decomposed, 1281 $m = $.matrix; 1282 m = $m.identity(); 1283 1284 d.now = {}; 1285 1286 // increment each part of the decomposition and recompose it 1287 $.each(d.start, function(k) { 1288 // calculate the current value 1289 d.now[k] = parseFloat(d.start[k]) + ((parseFloat(d.end[k]) - parseFloat(d.start[k])) * fx.pos); 1290 1291 // skip functions that won't affect the transform 1292 if (((k === 'scaleX' || k === 'scaleY') && d.now[k] === 1) || 1293 (k !== 'scaleX' && k !== 'scaleY' && d.now[k] === 0)) { 1294 return true; 1295 } 1296 1297 // calculating 1298 m = m.x($m[k](d.now[k])); 1299 }); 1300 1301 // save the correct matrix values for the value of now 1302 var val; 1303 $.each(fx.values, function(i) { 1304 switch (i) { 1305 case 0: val = parseFloat(m.e(1, 1).toFixed(6)); break; 1306 case 1: val = parseFloat(m.e(2, 1).toFixed(6)); break; 1307 case 2: val = parseFloat(m.e(1, 2).toFixed(6)); break; 1308 case 3: val = parseFloat(m.e(2, 2).toFixed(6)); break; 1309 case 4: val = parseFloat(m.e(1, 3).toFixed(6)); break; 1310 case 5: val = parseFloat(m.e(2, 3).toFixed(6)); break; 1311 } 1312 fx.values[i].now = val; 1313 }); 1314 }; 1315 }); 1316 /** 1317 * Step for animating tranformations 1318 */ 1319 $.each($.transform.funcs, function(i, func) { 1320 function t(fx) { 1321 var transform = fx.elem.transform || new $.transform(fx.elem), 1322 funcs = {}; 1323 1324 if ($.cssMultipleValues[func] || (!$.cssNumber[func] && $.inArray(func, $.transform.funcs) !== -1)) { 1325 ($.fx.multipleValueStep[fx.prop] || $.fx.multipleValueStep._default)(fx); 1326 funcs[fx.prop] = []; 1327 $.each(fx.values, function(i, val) { 1328 funcs[fx.prop].push(val.now + ($.cssNumber[fx.prop] ? '' : val.unit)); 1329 }); 1330 } else { 1331 funcs[fx.prop] = fx.now + ($.cssNumber[fx.prop] ? '' : fx.unit); 1332 } 1333 1334 transform.exec(funcs, {preserve: true}); 1335 } 1336 if ($.Tween && $.Tween.propHooks) { 1337 $.Tween.propHooks[func] = { set: t }; 1338 } 1339 if ($.fx.step) $.fx.step[func] = t; 1340 }); 1341 1342 // Support matrix animation 1343 $.each(['matrix', 'reflect', 'reflectX', 'reflectXY', 'reflectY'], function(i, func) { 1344 function t(fx) { 1345 var transform = fx.elem.transform || new $.transform(fx.elem), 1346 funcs = {}; 1347 1348 if (!fx.initialized) { 1349 fx.initialized = true; 1350 1351 // Reflections need a sensible end value set 1352 if (func !== 'matrix') { 1353 var values = $.matrix[func]().elements; 1354 var val; 1355 $.each(fx.values, function(i) { 1356 switch (i) { 1357 case 0: val = values[0]; break; 1358 case 1: val = values[2]; break; 1359 case 2: val = values[1]; break; 1360 case 3: val = values[3]; break; 1361 default: val = 0; 1362 } 1363 fx.values[i].end = val; 1364 }); 1365 } 1366 1367 // Decompose the start and end 1368 fx.decomposed = {}; 1369 var v = fx.values; 1370 1371 fx.decomposed.start = $.matrix.matrix(v[0].start, v[1].start, v[2].start, v[3].start, v[4].start, v[5].start).decompose(); 1372 fx.decomposed.end = $.matrix.matrix(v[0].end, v[1].end, v[2].end, v[3].end, v[4].end, v[5].end).decompose(); 1373 } 1374 1375 ($.fx.multipleValueStep[fx.prop] || $.fx.multipleValueStep._default)(fx); 1376 funcs.matrix = []; 1377 $.each(fx.values, function(i, val) { 1378 funcs.matrix.push(val.now); 1379 }); 1380 1381 transform.exec(funcs, {preserve: true}); 1382 } 1383 if ($.Tween && $.Tween.propHooks) { 1384 $.Tween.propHooks[func] = { set: t }; 1385 } 1386 if ($.fx.step) $.fx.step[func] = t; 1387 }); 1388})(jQuery, this, this.document); 1389/////////////////////////////////////////////////////// 1390// Angle 1391/////////////////////////////////////////////////////// 1392(function($, window, document, undefined) { 1393 /**
1394 * Converting a radian to a degree 1395 * @const 1396 */ 1397 var RAD_DEG = 180/Math.PI; 1398 1399 /** 1400 * Converting a radian to a grad 1401 * @const 1402 */ 1403 var RAD_GRAD = 200/Math.PI; 1404 1405 /** 1406 * Converting a degree to a radian 1407 * @const 1408 */ 1409 var DEG_RAD = Math.PI/180; 1410 1411 /** 1412 * Converting a degree to a grad 1413 * @const 1414 */ 1415 var DEG_GRAD = 2/1.8; 1416 1417 /** 1418 * Converting a grad to a degree 1419 * @const 1420 */ 1421 var GRAD_DEG = 0.9; 1422 1423 /** 1424 * Converting a grad to a radian 1425 * @const 1426 */ 1427 var GRAD_RAD = Math.PI/200; 1428 1429 1430 var rfxnum = /^([+\-]=)?([\d+.\-]+)(.*)$/; 1431 1432 /** 1433 * Functions for converting angles 1434 * @var Object 1435 */ 1436 $.extend({ 1437 angle: { 1438 /** 1439 * available units for an angle 1440 * @var Regex 1441 */ 1442 runit: /(deg|g?rad)/, 1443 1444 /** 1445 * Convert a radian into a degree 1446 * @param Number rad 1447 * @return Number 1448 */ 1449 radianToDegree: function(rad) { 1450 return rad * RAD_DEG; 1451 }, 1452 1453 /** 1454 * Convert a radian into a degree 1455 * @param Number rad 1456 * @return Number 1457 */ 1458 radianToGrad: function(rad) { 1459 return rad * RAD_GRAD; 1460 }, 1461 1462 /** 1463 * Convert a degree into a radian 1464 * @param Number deg 1465 * @return Number 1466 */ 1467 degreeToRadian: function(deg) { 1468 return deg * DEG_RAD; 1469 }, 1470 1471 /** 1472 * Convert a degree into a radian 1473 * @param Number deg 1474 * @return Number 1475 */ 1476 degreeToGrad: function(deg) { 1477 return deg * DEG_GRAD; 1478 }, 1479 1480 /** 1481 * Convert a grad into a degree 1482 * @param Number grad 1483 * @return Number 1484 */ 1485 gradToDegree: function(grad) { 1486 return grad * GRAD_DEG; 1487 }, 1488 1489 /** 1490 * Convert a grad into a radian 1491 * @param Number grad 1492 * @return Number 1493 */ 1494 gradToRadian: function(grad) { 1495 return grad * GRAD_RAD; 1496 }, 1497 1498 /** 1499 * Convert an angle with a unit to a degree 1500 * @param String val angle with a unit 1501 * @return Number 1502 */ 1503 toDegree: function (val) { 1504 var parts = rfxnum.exec(val); 1505 if (parts) { 1506 val = parseFloat( parts[2] ); 1507 switch (parts[3] || 'deg') { 1508 case 'grad': 1509 val = $.angle.gradToDegree(val); 1510 break; 1511 case 'rad': 1512 val = $.angle.radianToDegree(val); 1513 break; 1514 } 1515 return val; 1516 } 1517 return 0; 1518 } 1519 } 1520 }); 1521})(jQuery, this, this.document); 1522/////////////////////////////////////////////////////// 1523// Matrix 1524/////////////////////////////////////////////////////// 1525(function($, window, document, undefined) { 1526 /** 1527 * Matrix object for creating matrices relevant for 2d Transformations 1528 * @var Object 1529 */ 1530 if (typeof($.matrix) == 'undefined') { 1531 $.extend({ 1532 matrix: {} 1533 }); 1534 } 1535 var $m = $.matrix; 1536 1537 $.extend( $m, { 1538 /** 1539 * A 2-value vector 1540 * @param Number x 1541 * @param Number y 1542 * @constructor 1543 */ 1544 V2: function(x, y){ 1545 if ($.isArray(arguments[0])) { 1546 this.elements = arguments[0].slice(0, 2); 1547 } else { 1548 this.elements = [x, y]; 1549 } 1550 this.length = 2; 1551 }, 1552 1553 /** 1554 * A 3-value vector 1555 * @param Number x 1556 * @param Number y 1557 * @param Number z 1558 * @constructor 1559 */ 1560 V3: function(x, y, z){ 1561 if ($.isArray(arguments[0])) { 1562 this.elements = arguments[0].slice(0, 3); 1563 } else { 1564 this.elements = [x, y, z]; 1565 } 1566 this.length = 3; 1567 }, 1568 1569 /** 1570 * A 4-value vector 1571 * @param Number x 1572 * @param Number y 1573 * @param Number z 1574 * @constructor 1575 */ 1576 V4: function(x, y, z, l){ 1577 if ($.isArray(arguments[0])) { 1578 this.elements = arguments[0].slice(0, 4); 1579 } else { 1580 this.elements = [x, y, z, l]; 1581 } 1582 this.length = 4; 1583 }, 1584 1585 1586 /** 1587 * A 2x2 Matrix, useful for 2D-transformations without translations 1588 * @param Number mn 1589 * @constructor 1590 */ 1591 M2x2: function(m11, m12, m21, m22) { 1592 if ($.isArray(arguments[0])) { 1593 this.elements = arguments[0].slice(0, 4); 1594 } else { 1595 this.elements = Array.prototype.slice.call(arguments).slice(0, 4); 1596 } 1597 this.rows = 2; 1598 this.cols = 2; 1599 }, 1600 1601 /** 1602 * A 3x3 Matrix, useful for 3D-transformations without translations 1603 * @param Number mn 1604 * @constructor 1605 */ 1606 M3x3: function(m11, m12, m13, m21, m22, m23, m31, m32, m33) { 1607 if ($.isArray(arguments[0])) { 1608 this.elements = arguments[0].slice(0, 9); 1609 } else { 1610 this.elements = Array.prototype.slice.call(arguments).slice(0, 9); 1611 } 1612 this.rows = 3; 1613 this.cols = 3; 1614 }, 1615 1616 1617 /** 1618 * A 4x4 Matrix, useful for 3D-transformations without translations 1619 * @param Number mn 1620 * @constructor 1621 */ 1622 M4x4: function(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34) { 1623 if ($.isArray(arguments[0])) { 1624 this.elements = arguments[0].slice(0, 12); 1625 } else { 1626 this.elements = Array.prototype.slice.call(arguments).slice(0, 12); 1627 } 1628 this.rows = 4; 1629 this.cols = 4; 1630 } 1631 }); 1632 1633 /** generic matrix prototype */ 1634 var Matrix = { 1635 /** 1636 * Return a specific element from the matrix 1637 * @param Number row where 1 is the 0th row 1638 * @param Number col where 1 is the 0th column 1639 * @return Number 1640 */ 1641 e: function(row, col) { 1642 var rows = this.rows, 1643 cols = this.cols; 1644 1645 // return 0 on nonsense rows and columns 1646 if (row > rows || col >
1646 rows || row < 1 || col < 1) { 1647 return 0; 1648 } 1649 1650 return this.elements[(row - 1) * cols + col - 1]; 1651 }, 1652 1653 /** 1654 * Taken from Zoomooz 1655 * https://github.com/jaukia/zoomooz/blob/c7a37b9a65a06ba730bd66391bbd6fe8e55d3a49/js/jquery.zoomooz.js 1656 */ 1657 decompose: function() { 1658 var a = this.e(1, 1), 1659 b = this.e(2, 1), 1660 c = this.e(1, 2), 1661 d = this.e(2, 2), 1662 e = this.e(1, 3), 1663 f = this.e(2, 3); 1664 1665 // In case the matrix can't be decomposed 1666 if (Math.abs(a * d - b * c) < 0.01) { 1667 return { 1668 rotate: 0 + 'deg', 1669 rotateX: 0 + 'deg', 1670 rotateY: 0 + 'deg', 1671 rotateZ: 0 + 'deg', 1672 skewX: 0 + 'deg', 1673 scaleX: 1, 1674 scaleY: 1, 1675 translateX: 0 + 'px', 1676 translateY: 0 + 'px' 1677 }; 1678 } 1679 1680 // Translate is easy 1681 var tx = e, ty = f; 1682 1683 // factor out the X scale 1684 var sx = Math.sqrt(a * a + b * b); 1685 a = a/sx; 1686 b = b/sx; 1687 1688 // factor out the skew 1689 var k = a * c + b * d; 1690 c -= a * k; 1691 d -= b * k; 1692 1693 // factor out the Y scale 1694 var sy = Math.sqrt(c * c + d * d); 1695 c = c / sy; 1696 d = d / sy; 1697 k = k / sy; 1698 1699 // account for negative scale 1700 if ((a * d - b * c) < 0.0) { 1701 a = -a; 1702 b = -b; 1703 //c = -c; // accomplishes nothing to negate it 1704 //d = -d; // accomplishes nothing to negate it 1705 sx = -sx; 1706 //sy = -sy //Scale Y shouldn't ever be negated 1707 } 1708 1709 // calculate the rotation angle and skew angle 1710 var rad2deg = $.angle.radianToDegree; 1711 var r = rad2deg(Math.atan2(b, a)); 1712 k = rad2deg(Math.atan(k)); 1713 1714 return { 1715 rotate: r + 'deg', 1716 rotateX: r + 'deg', 1717 rotateY: r + 'deg', 1718 rotateZ: r + 'deg', 1719 skewX: k + 'deg', 1720 scaleX: sx, 1721 scaleY: sy, 1722 translateX: tx + 'px', 1723 translateY: ty + 'px' 1724 1725 }; 1726 } 1727 }; 1728 1729 /** Extend all of the matrix types with the same prototype */ 1730 $.extend($m.M2x2.prototype, Matrix, { 1731 toM3x3: function() { 1732 var a = this.elements; 1733 return new $m.M3x3( 1734 a[0], a[1], 0, 1735 a[2], a[3], 0, 1736 0, 0, 1 1737 ); 1738 }, 1739 1740 /** 1741 * Multiply a 2x2 matrix by a similar matrix or a vector 1742 * @param M2x2 | V2 matrix 1743 * @return M2x2 | V2 1744 */ 1745 x: function(matrix) { 1746 var isVector = typeof(matrix.rows) === 'undefined'; 1747 1748 // Ensure the right-sized matrix 1749 if (!isVector && matrix.rows == 3) { 1750 return this.toM3x3().x(matrix); 1751 } 1752 1753 var a = this.elements, 1754 b = matrix.elements; 1755 1756 if (isVector && b.length == 2) { 1757 // b is actually a vector 1758 return new $m.V2( 1759 a[0] * b[0] + a[1] * b[1], 1760 a[2] * b[0] + a[3] * b[1] 1761 ); 1762 } else if (b.length == a.length) { 1763 // b is a 2x2 matrix 1764 return new $m.M2x2( 1765 a[0] * b[0] + a[1] * b[2], 1766 a[0] * b[1] + a[1] * b[3], 1767 1768 a[2] * b[0] + a[3] * b[2], 1769 a[2] * b[1] + a[3] * b[3] 1770 ); 1771 } 1772 return false; // fail 1773 }, 1774 1775 /** 1776 * Generates an inverse of the current matrix 1777 * @param void 1778 * @return M2x2 1779 * @link http://www.dr-lex.be/random/matrix_inv.html 1780 */ 1781 inverse: function() { 1782 var d = 1/this.determinant(), 1783 a = this.elements; 1784 return new $m.M2x2( 1785 d * a[3], d * -a[1], 1786 d * -a[2], d * a[0] 1787 ); 1788 }, 1789 1790 /** 1791 * Calculates the determinant of the current matrix 1792 * @param void 1793 * @return Number 1794 * @link http://www.dr-lex.be/random/matrix_inv.html 1795 */ 1796 determinant: function() { 1797 var a = this.elements; 1798 return a[0] * a[3] - a[1] * a[2]; 1799 } 1800 }); 1801 1802 $.extend($m.M3x3.prototype, Matrix, { 1803 toM4x4: function() { 1804 var a = this.elements; 1805 return new $m.M4x4( 1806 a[0], a[1], a[2], 0, 1807 a[3], a[4], a[5], 0, 1808 a[6], a[7], a[8], 0, 1809 0, 0, 0, 1 1810 ); 1811 }, 1812 /** 1813 * Multiply a 3x3 matrix by a similar matrix or a vector 1814 * @param M3x3 | V3 matrix 1815 * @return M3x3 | V3 1816 */ 1817 x: function(matrix) { 1818 var isVector = typeof(matrix.rows) === 'undefined'; 1819 1820 // Ensure the right-sized matrix 1821 if (!isVector && matrix.rows < 3) { 1822 matrix = matrix.toM3x3(); 1823 } 1824 1825 var a = this.elements, 1826 b = matrix.elements; 1827 1828 if (isVector && b.length == 3) { 1829 // b is actually a vector 1830 return new $m.V3( 1831 a[0] * b[0] + a[1] * b[1] + a[2] * b[2], 1832 a[3] * b[0] + a[4] * b[1] + a[5] * b[2], 1833 a[6] * b[0] + a[7] * b[1] + a[8] * b[2] 1834 ); 1835 } else if (b.length == a.length) { 1836 // b is a 3x3 matrix 1837 return new $m.M3x3( 1838 a[0] * b[0] + a[1] * b[3] + a[2] * b[6], 1839 a[0] * b[1] + a[1] * b[4] + a[2] * b[7], 1840 a[0] * b[2] + a[1] * b[5] + a[2] * b[8], 1841 1842 a[3] * b[0] + a[4] * b[3] + a[5] * b[6], 1843 a[3] * b[1] + a[4] * b[4] + a[5] * b[7], 1844 a[3] * b[2] + a[4] * b[5] + a[5] * b[8], 1845 1846 a[6] * b[0] + a[7] * b[3] + a[8] * b[6], 1847 a[6] * b[1] + a[7] * b[4] + a[8] * b[7], 1848 a[6] * b[2] + a[7] * b[5] + a[8] * b[8] 1849 ); 1850 } 1851 return false; // fail 1852 }, 1853 1854 /** 1855 * Generates an inverse of the current matrix 1856 * @param void 1857 * @return M3x3 1858 * @link http://www.dr-lex.be/random/matrix_inv.html 1859 */ 1860 inverse: function() { 1861 var d = 1/this.determinant(), 1862 a = this.elements; 1863 return new $m.M3x3( 1864 d * ( a[8] * a[4] - a[7] * a[5]), 1865 d * (-(a[8] * a[1] - a[7] * a[2])), 1866 d * ( a[5] * a[1] - a[4] * a[2]), 1867 1868 d * (-(a[8] * a[3] - a[6] * a[5])), 1869 d * ( a[8] * a[0] - a[6] * a[2]), 1870 d * (-(a[5] * a[0] - a[3] * a[2])), 1871 1872 d * ( a[7] * a[3] - a[6] * a[4]), 1873 d * (-(a[7] * a[0] - a[6] * a[1])), 1874 d * ( a[4] * a[0] - a[3] * a[1]) 1875 ); 1876 }, 1877 1878 /** 1879 * Calculates the determinant of the current matrix 1880 * @param void 1881 * @return Number 1882 * @link http://www.dr-lex.be/random/matrix_inv.html 1883 */ 1884 determinant: function() { 1885 var a = this.elements; 1886 return a[0] * (a[8] * a[4] - a[7] * a[5]) - a[3] * (a[8] * a[1] - a[7] * a[2]) + a[6] * (a[5] * a[1] - a[4] * a[2]); 1887 } 1888 }); 1889 1890 $.extend($m.M4x4.prototype, Matrix, { 1891 /** 1892 * Multiply a 4x4 matrix by a similar matrix or a vector 1893 * @param M4x4 | V4 matrix 1894 * @return M4x4 | V4 1895 */ 1896 x: function(matrix) { 1897 var isVector = typeof(matrix.rows) === 'undefined'; 1898 1899 // Ensure the right-sized matrix 1900 if (!isVector && matrix.rows < 4) { 1901 matrix = matrix.toM4x4(); 1902 } 1903 1904 var a = this.elements, 1905 b = matrix.elements; 1906 1907 if (isVector && b.length == 4) { 1908 // b is actually a vector 1909 return new $m.V4( 1910 a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3], 1911 a[4] * b[0] + a[5] * b[1] + a[6] * b[2] + a[7] * b[3], 1912 a[8] * b[0] + a[9] * b[1] + a[10] * b[2] + a[11] * b[3] 1913 ); 1914 } else if (b.length == a.length) { 1915 // b is a 4x4 matrix 1916 return new $m.M4x4( 1917 a[0] * b[0] + a[1] * b[4] + a[2] * b[8], 1918 a[0] * b[1] + a[1] * b[5] + a[2] * b[9], 1919 a[0] * b[2] + a[1] * b[6] + a[2] * b[10], 1920 a[0] * b[3] + a[1] * b[7] + a[2] * b[11], 1921 1922 a[3] * b[0] + a[4] * b[4] + a[5] * b[8], 1923 a[3] * b[1] + a[4] * b[5] + a[5] * b[9], 1924 a[3] * b[2] + a[4] * b[6] + a[5] * b[10], 1925 a[3] * b[3] + a[4] * b[7] + a[5] * b[11], 1926 1927 a[6] * b[0] + a[7] * b[4] + a[8] * b[8], 1928 a[6] * b[1] + a[7] * b[5] + a[8] * b[9], 1929 a[6] * b[2] + a[7] * b[6] + a[8] * b[10], 1930 a[6] * b[3] + a[7] * b[7] + a[8] * b[11] 1931 ); 1932 } 1933 return false; // fail 1934 }, 1935 1936 /** 1937 * Generates an inverse of the current matrix 1938 * @param void 1939 * @return M4x4 1940 * @link http://www.dr-lex.be/random/matrix_inv.html 1941 */ 1942 inverse: function() { 1943 var d = 1/this.determinant(), 1944 a = this.elements; 1945 return new $m.M4x4( 1946 d * ( a[8] * a[4] - a[7] * a[5]), 1947 d * (-(a[8] * a[1] - a[7] * a[2])), 1948 d * ( a[5] * a[1] - a[4] * a[2]),
1949 d * (-(a[5] * a[4] - a[4] * a[5])), 1950 1951 d * (-(a[8] * a[3] - a[6] * a[5])), 1952 d * ( a[8] * a[0] - a[6] * a[2]), 1953 d * (-(a[5] * a[0] - a[3] * a[2])), 1954 d * ( a[5] * a[3] - a[3] * a[5]), 1955 1956 d * ( a[7] * a[3] - a[6] * a[4]), 1957 d * (-(a[7] * a[0] - a[6] * a[1])), 1958 d * ( a[4] * a[0] - a[3] * a[1]), 1959 d * (-(a[4] * a[3] - a[3] * a[4])) 1960 ); 1961 }, 1962 1963 /** 1964 * Calculates the determinant of the current matrix 1965 * @param void 1966 * @return Number 1967 * @link http://www.dr-lex.be/random/matrix_inv.html 1968 */ 1969 determinant: function() { 1970 var a = this.elements; 1971 return a[0] * (a[8] * a[4] - a[7] * a[5]) - a[3] * (a[8] * a[1] - a[7] * a[2]) + a[6] * (a[5] * a[1] - a[4] * a[2]) + a[9] * (a[5] * a[4] - a[4] * a[5]); 1972 } 1973 }); 1974 1975 /** generic vector prototype */ 1976 var Vector = { 1977 /** 1978 * Return a specific element from the vector 1979 * @param Number i where 1 is the 0th value 1980 * @return Number 1981 */ 1982 e: function(i) { 1983 return this.elements[i - 1]; 1984 } 1985 }; 1986 1987 /** Extend all of the vector types with the same prototype */ 1988 $.extend($m.V2.prototype, Vector); 1989 $.extend($m.V3.prototype, Vector); 1990 $.extend($m.V4.prototype, Vector); 1991})(jQuery, this, this.document); 1992/////////////////////////////////////////////////////// 1993// Matrix Calculations 1994/////////////////////////////////////////////////////// 1995(function($, window, document, undefined) { 1996 /** 1997 * Matrix object for creating matrices relevant for 2d Transformations 1998 * @var Object 1999 */ 2000 if (typeof($.matrix) == 'undefined') { 2001 $.extend({ 2002 matrix: {} 2003 }); 2004 } 2005 2006 $.extend( $.matrix, { 2007 /** 2008 * Class for calculating coordinates on a matrix 2009 * @param Matrix matrix 2010 * @param Number outerHeight 2011 * @param Number outerWidth 2012 * @constructor 2013 */ 2014 calc: function(matrix, outerHeight, outerWidth) { 2015 /** 2016 * @var Matrix 2017 */ 2018 this.matrix = matrix; 2019 2020 /** 2021 * @var Number 2022 */ 2023 this.outerHeight = outerHeight; 2024 2025 /** 2026 * @var Number 2027 */ 2028 this.outerWidth = outerWidth; 2029 } 2030 }); 2031 2032 $.matrix.calc.prototype = { 2033 /** 2034 * Calculate a coord on the new object 2035 * @return Object 2036 */ 2037 coord: function(x, y, z, l) { 2038 //default z and w 2039 z = typeof(z) !== 'undefined' ? z : 0; 2040 2041 var matrix = this.matrix, 2042 vector; 2043 2044 switch (matrix.rows) { 2045 case 2: 2046 vector = matrix.x(new $.matrix.V2(x, y)); 2047 break; 2048 case 3: 2049 vector = matrix.x(new $.matrix.V3(x, y, z)); 2050 break; 2051 case 4: 2052 vector = matrix.x(new $.matrix.V4(x, y, z, l)); 2053 break; 2054 } 2055 2056 return vector; 2057 }, 2058 2059 /** 2060 * Calculate the corners of the new object 2061 * @return Object 2062 */ 2063 corners: function(x, y) { 2064 // Try to save the corners if this is called a lot 2065 var save = !(typeof(x) !=='undefined' || typeof(y) !=='undefined'), 2066 c; 2067 if (!this.c || !save) { 2068 y = y || this.outerHeight; 2069 x = x || this.outerWidth; 2070 2071 c = { 2072 tl: this.coord(0, 0), 2073 bl: this.coord(0, y), 2074 tr: this.coord(x, 0), 2075 br: this.coord(x, y) 2076 }; 2077 } else { 2078 c = this.c; 2079 } 2080 2081 if (save) { 2082 this.c = c; 2083 } 2084 return c; 2085 }, 2086 2087 /** 2088 * Calculate the sides of the new object 2089 * @return Object 2090 */ 2091 sides: function(corners) { 2092 // The corners of the box 2093 var c = corners || this.corners(); 2094 2095 return { 2096 top: Math.min(c.tl.e(2), c.tr.e(2), c.br.e(2), c.bl.e(2)), 2097 bottom: Math.max(c.tl.e(2), c.tr.e(2), c.br.e(2), c.bl.e(2)), 2098 left: Math.min(c.tl.e(1), c.tr.e(1), c.br.e(1), c.bl.e(1)), 2099 right: Math.max(c.tl.e(1), c.tr.e(1), c.br.e(1), c.bl.e(1)) 2100 }; 2101 }, 2102 2103 /** 2104 * Calculate the offset of the new object 2105 * @return Object 2106 */ 2107 offset: function(corners) { 2108 // The corners of the box 2109 var s = this.sides(corners); 2110 2111 // return size 2112 return { 2113 height: Math.abs(s.bottom - s.top), 2114 width: Math.abs(s.right - s.left) 2115 }; 2116 }, 2117 2118 /** 2119 * Calculate the area of the new object 2120 * @return Number 2121 * @link http://en.wikipedia.org/wiki/Quadrilateral#Area_of_a_convex_quadrilateral 2122 */ 2123 area: function(corners) { 2124 // The corners of the box 2125 var c = corners || this.corners(); 2126 2127 // calculate the two diagonal vectors 2128 var v1 = { 2129 x: c.tr.e(1) - c.tl.e(1) + c.br.e(1) - c.bl.e(1), 2130 y: c.tr.e(2) - c.tl.e(2) + c.br.e(2) - c.bl.e(2) 2131 }, 2132 v2 = { 2133 x: c.bl.e(1) - c.tl.e(1) + c.br.e(1) - c.tr.e(1), 2134 y: c.bl.e(2) - c.tl.e(2) + c.br.e(2) - c.tr.e(2) 2135 }; 2136 2137 return 0.25 * Math.abs(v1.e(1) * v2.e(2) - v1.e(2) * v2.e(1)); 2138 }, 2139 2140 /** 2141 * Calculate the non-affinity of the new object 2142 * @return Number 2143 */ 2144 nonAffinity: function() { 2145 // The corners of the box 2146 var sides = this.sides(), 2147 xDiff = sides.top - sides.bottom, 2148 yDiff = sides.left - sides.right; 2149 2150 return parseFloat(parseFloat(Math.abs( 2151 (Math.pow(xDiff, 2) + Math.pow(yDiff, 2)) / 2152 (sides.top * sides.bottom + sides.left * sides.right) 2153 )).toFixed(8)); 2154 }, 2155 2156 /** 2157 * Calculate a proper top and left for IE 2158 * @param Object toOrigin 2159 * @param Object fromOrigin 2160 * @return Object 2161 */ 2162 originOffset: function(toOrigin, fromOrigin) { 2163 // the origin to translate to 2164 toOrigin = toOrigin ? toOrigin : new $.matrix.V2( 2165 this.outerWidth * 0.5, 2166 this.outerHeight * 0.5 2167 ); 2168 2169 2170 // the origin to translate from (IE has a fixed origin of 0, 0) 2171 fromOrigin = fromOrigin ? fromOrigin : new $.matrix.V2( 2172 0, 2173 0 2174 ); 2175 2176 // transform the origins 2177 var toCenter = this.coord(toOrigin.e(1), toOrigin.e(2)); 2178 var fromCenter = this.coord(fromOrigin.e(1), fromOrigin.e(2)); 2179 2180 // return the offset 2181 return { 2182 top: (fromCenter.e(2) - fromOrigin.e(2)) - (toCenter.e(2) - toOrigin.e(2)), 2183 left: (fromCenter.e(1) - fromOrigin.e(1)) - (toCenter.e(1) - toOrigin.e(1)) 2184 }; 2185 } 2186 }; 2187})(jQuery, this, this.document); 2188///////////////////////////////////////////////////////
2189// 2d/3d Matrix Functions 2190/////////////////////////////////////////////////////// 2191(function($, window, document, undefined) { 2192 /** 2193 * Matrix object for creating matrices relevant for 2d/3d Transformations 2194 * @var Object 2195 */ 2196 if (typeof($.matrix) == 'undefined') { 2197 $.extend({ 2198 matrix: {} 2199 }); 2200 } 2201 var $m = $.matrix, 2202 $m2x2 = $m.M2x2, 2203 $m3x3 = $m.M3x3, 2204 $m4x4 = $m.M4x4; 2205 2206 $.extend( $m, { 2207 /** 2208 * Identity matrix 2209 * @param Number size 2210 * @return Matrix 2211 */ 2212 identity: function(size) { 2213 size = size || 2; 2214 var length = size * size, 2215 elements = new Array(length), 2216 mod = size + 1; 2217 for (var i = 0; i < length; i++) { 2218 elements[i] = (i % mod) === 0 ? 1 : 0; 2219 } 2220 return new $m['M'+size+'x'+size](elements); 2221 }, 2222 2223 /** 2224 * Matrix 2225 * @return Matrix 2226 */ 2227 matrix: function() { 2228 var args = Array.prototype.slice.call(arguments); 2229 // arguments are in column-major order 2230 switch (arguments.length) { 2231 case 4: 2232 return new $m2x2( 2233 args[0], args[2], 2234 args[1], args[3] 2235 ); 2236 case 6: 2237 return new $m3x3( 2238 args[0], args[2], args[4], 2239 args[1], args[3], args[5], 2240 0, 0, 1 2241 ); 2242 case 8: 2243 return new $m4x4( 2244 args[0], args[3], args[6],0, 2245 args[1], args[4], args[7],0, 2246 args[2], args[5], args[8],0, 2247 0, 0, 0, 1 2248 2249 ); } 2250 }, 2251 2252 /** 2253 * Reflect (same as rotate(180)) 2254 * @return Matrix 2255 */ 2256 reflect: function() { 2257 return new $m2x2( 2258 -1, 0, 2259 0, -1 2260 ); 2261 }, 2262 2263 /** 2264 * Reflect across the x-axis (mirrored upside down) 2265 * @return Matrix 2266 */ 2267 reflectX: function() { 2268 return new $m2x2( 2269 1, 0, 2270 0, -1 2271 ); 2272 }, 2273 2274 /** 2275 * Reflect by swapping x an y (same as reflectX + rotate(-90)) 2276 * @return Matrix 2277 */ 2278 reflectXY: function() { 2279 return new $m2x2( 2280 0, 1, 2281 1, 0 2282 ); 2283 }, 2284 2285 /** 2286 * Reflect across the y-axis (mirrored) 2287 * @return Matrix 2288 */ 2289 reflectY: function() { 2290 return new $m2x2( 2291 -1, 0, 2292 0, 1 2293 ); 2294 }, 2295 2296 /** 2297 * Rotates around the origin 2298 * @param Number deg 2299 * @return Matrix 2300 * @link http://www.w3.org/TR/SVG/coords.html#RotationDefined 2301 */ 2302 rotate: function(deg) { 2303 //TODO: detect units 2304 var rad = $.angle.degreeToRadian(deg), 2305 costheta = Math.cos(rad), 2306 sintheta = Math.sin(rad); 2307 2308 var a = costheta, 2309 b = sintheta, 2310 c = -sintheta, 2311 d = costheta; 2312 2313 return new $m2x2( 2314 a, c, 2315 b, d 2316 ); 2317 }, 2318 2319 /** 2320 * Rotate X around the origin 2321 * @param Number deg 2322 * @return Matrix 2323 * @link http://www.w3.org/TR/SVG/coords.html#RotationDefined 2324 */ 2325 rotateX: function(deg) { 2326 //TODO: detect units 2327 var rad = $.angle.degreeToRadian(deg), 2328 costheta = Math.cos(rad), 2329 sintheta = Math.sin(rad); 2330 2331 var a = costheta, 2332 b = sintheta, 2333 c = -sintheta, 2334 d = costheta; 2335 2336 return new $m4x4( 2337 1, 0, 0, 0, 2338 0, a, c, 0, 2339 0, b, d, 0, 2340 0, 0, 0 ,1 2341 ); 2342 }, 2343 2344 /** 2345 * Rotate Y around the origin 2346 * @param Number deg 2347 * @return Matrix 2348 * @link http://www.w3.org/TR/SVG/coords.html#RotationDefined 2349 */ 2350 rotateY: function(deg) { 2351 //TODO: detect units 2352 var rad = $.angle.degreeToRadian(deg), 2353 costheta = Math.cos(rad), 2354 sintheta = Math.sin(rad); 2355 2356 var a = costheta, 2357 b = sintheta, 2358 c = -sintheta, 2359 d = costheta; 2360 2361 2362 return new $m4x4( 2363 a, 0, b, 0, 2364 0, 1, 0, 0, 2365 c, 0, d, 0, 2366 0, 0, 0 ,1 2367 ); 2368 }, 2369 2370 /** 2371 * Rotate Z around the origin 2372 * @param Number deg 2373 * @return Matrix 2374 * @link http://www.w3.org/TR/SVG/coords.html#RotationDefined 2375 */ 2376 rotateZ: function(deg) { 2377 //TODO: detect units 2378 var rad = $.angle.degreeToRadian(deg), 2379 costheta = Math.cos(rad), 2380 sintheta = Math.sin(rad); 2381 2382 var a = costheta, 2383 b = sintheta, 2384 c = -sintheta, 2385 d = costheta; 2386 2387 2388 return new $m4x4( 2389 a, c, 0, 0, 2390 b, d, 0, 0, 2391 0, 0, 1, 0, 2392 0, 0, 0 ,1 2393 ); 2394 }, 2395 /** 2396 * Scale 2397 * @param Number sx 2398 * @param Number sy 2399 * @return Matrix 2400 * @link http://www.w3.org/TR/SVG/coords.html#ScalingDefined 2401 */ 2402 scale: function (sx, sy) { 2403 sx = sx || sx === 0 ? sx : 1; 2404 sy = sy || sy === 0 ? sy : sx; 2405 2406 return new $m2x2(
2407 sx, 0, 2408 0, sy 2409 ); 2410 }, 2411 2412 /** 2413 * Scale 3d 2414 * @param Number sx 2415 * @param Number sy 2416 * @param Number sz 2417 * @return Matrix 2418 * @link http://www.w3.org/TR/SVG/coords.html#ScalingDefined 2419 */ 2420 scale3d: function (sx, sy, sz) { 2421 sx = sx || sx === 0 ? sx : 1; 2422 sy = sy || sy === 0 ? sy : sx; 2423 sz = sz || sz === 0 ? sz : sy; 2424 2425 return new $m4x4( 2426 sx, 0, 0, 0, 2427 0, sy, 0, 0, 2428 0, 0, sz, 0, 2429 0, 0, 0 , 1 2430 ); 2431 }, 2432 2433 /** 2434 * Scale on the X-axis 2435 * @param Number sx 2436 * @return Matrix 2437 */ 2438 scaleX: function (sx) { 2439 return $m.scale(sx, 1); 2440 }, 2441 2442 /** 2443 * Scale on the Y-axis 2444 * @param Number sy 2445 * @return Matrix 2446 */ 2447 scaleY: function (sy) { 2448 return $m.scale(1, sy); 2449 }, 2450 2451 /** 2452 * Scale on the Z-axis 2453 * @param Number sz 2454 * @return Matrix 2455 */ 2456 scaleZ: function (sz) { 2457 return $m.scale3d(1, 1, sz); 2458 }, 2459 2460 /** 2461 * Skews on the X-axis and Y-axis 2462 * @param Number degX 2463 * @param Number degY 2464 * @return Matrix 2465 */ 2466 skew: function (degX, degY) { 2467 degX = degX || 0; 2468 degY = degY || 0; 2469 2470 //TODO: detect units 2471 var radX = $.angle.degreeToRadian(degX), 2472 radY = $.angle.degreeToRadian(degY), 2473 x = Math.tan(radX), 2474 y = Math.tan(radY); 2475 2476 return new $m2x2( 2477 1, x, 2478 y, 1 2479 ); 2480 }, 2481 2482 /** 2483 * Skews on the X-axis 2484 * @param Number degX 2485 * @return Matrix 2486 * @link http://www.w3.org/TR/SVG/coords.html#SkewXDefined 2487 */ 2488 skewX: function (degX) { 2489 return $m.skew(degX); 2490 }, 2491 2492 /** 2493 * Skews on the Y-axis 2494 * @param Number degY 2495 * @return Matrix 2496 * @link http://www.w3.org/TR/SVG/coords.html#SkewYDefined 2497 */ 2498 skewY: function (degY) { 2499 return $m.skew(0, degY); 2500 }, 2501 2502 /** 2503 * Translate 2504 * @param Number tx 2505 * @param Number ty 2506 * @return Matrix 2507 * @link http://www.w3.org/TR/SVG/coords.html#TranslationDefined 2508 */ 2509 translate: function (tx, ty) { 2510 tx = tx || 0; 2511 ty = ty || 0; 2512 2513 return new $m3x3( 2514 1, 0, tx, 2515 0, 1, ty, 2516 0, 0, 1 2517 ); 2518 }, 2519 /** 2520 * Translate 3d 2521 * @param Number tx 2522 * @param Number ty 2523 * @param Number tz 2524 * @return Matrix 2525 * @link http://www.w3.org/TR/SVG/coords.html#TranslationDefined 2526 */ 2527 translate3d: function (tx, ty, tz) { 2528 tx = tx || 0; 2529 ty = ty || 0; 2530 tz = tz || 0; 2531 2532 return new $m4x4( 2533 1, 0, 0, 0, 2534 0, 1, 0, 0, 2535 0, 0, 1, 0, 2536 tx, ty, tz ,1 2537 ); 2538 }, 2539 2540 /** 2541 * Translate on the X-axis 2542 * @param Number tx 2543 * @return Matrix 2544 * @link http://www.w3.org/TR/SVG/coords.html#TranslationDefined 2545 */ 2546 translateX: function (tx) { 2547 return $m.translate(tx); 2548 }, 2549 2550 /** 2551 * Translate on the Y-axis 2552 * @param Number ty 2553 * @return Matrix 2554 * @link http://www.w3.org/TR/SVG/coords.html#TranslationDefined 2555 */ 2556 translateY: function (ty) { 2557 return $m.translate(0, ty); 2558 }, 2559 2560 /** 2561 * Translate on the Z-axis 2562 * @param Number ty 2563 * @return Matrix 2564 * @link http://www.w3.org/TR/SVG/coords.html#TranslationDefined 2565 */ 2566 translateZ: function (tz) { 2567 return $m.translate3d(0, 0, tz); 2568 } 2569 }); 2570})(jQuery, this, this.document); 2571 2572 2573/*-------------------------------------------------- 2574* jQuery Cookie 2575--------------------------------------------------*/ 2576/** 2577 * Cookie plugin 2578 * 2579 * Copyright (c) 2006 Klaus Hartl (stilbuero.de) 2580 * Dual licensed under the MIT and GPL licenses: 2581 * http://www.opensource.org/licenses/mit-license.php 2582 * http://www.gnu.org/licenses/gpl.html 2583 * 2584 */ 2585 2586/** 2587 * Create a cookie with the given name and value and other optional parameters. 2588 * 2589 * @example $.cookie('the_cookie', 'the_value'); 2590 * @desc Set the value of a cookie. 2591 * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true }); 2592 * @desc Create a cookie with all available options. 2593 * @example $.cookie('the_cookie', 'the_value'); 2594 * @desc Create a session cookie. 2595 * @example $.cookie('the_cookie', null); 2596 * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain 2597 * used when the cookie was set. 2598 * 2599 * @param String name The name of the cookie. 2600 * @param String value The value of the cookie. 2601 * @param Object options An object literal containing key/value pairs to provide optional cookie attributes. 2602 * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object. 2603 * If a negative value is specified (e.g. a date in the past), the cookie will be deleted. 2604 * If set to null or omitted, the cookie will be a session cookie and will not be retained 2605 * when the the browser exits. 2606 * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie). 2607 * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie). 2608 * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will 2609 * require a secure protocol (like HTTPS). 2610 * @type undefined 2611 * 2612 * @name $.cookie 2613 * @cat Plugins/Cookie 2614 * @author Klaus Hartl/[email protected] 2615 */ 2616 2617/** 2618 * Get the value of a cookie with the given name. 2619 * 2620 * @example $.cookie('the_cookie'); 2621 * @desc Get the value of a cookie. 2622 * 2623 * @param String name The name of the cookie. 2624 * @return The value of the cookie.
2625 * @type String 2626 * 2627 * @name $.cookie 2628 * @cat Plugins/Cookie 2629 * @author Klaus Hartl/[email protected] 2630 */ 2631jQuery.cookie = function(name, value, options) { 2632 if (typeof value != 'undefined') { // name and value given, set cookie 2633 options = options || {}; 2634 if (value === null) { 2635 value = ''; 2636 options.expires = -1; 2637 } 2638 var expires = ''; 2639 if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) { 2640 var date; 2641 if (typeof options.expires == 'number') { 2642 date = new Date(); 2643 date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000)); 2644 } else { 2645 date = options.expires; 2646 } 2647 expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE 2648 } 2649 // CAUTION: Needed to parenthesize options.path and options.domain 2650 // in the following expressions, otherwise they evaluate to undefined 2651 // in the packed version for some reason... 2652 var path = options.path ? '; path=' + (options.path) : ''; 2653 var domain = options.domain ? '; domain=' + (options.domain) : ''; 2654 var secure = options.secure ? '; secure' : ''; 2655 document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join(''); 2656 } else { // only name given, get cookie 2657 var cookieValue = null; 2658 if (document.cookie && document.cookie != '') { 2659 var cookies = document.cookie.split(';'); 2660 for (var i = 0; i < cookies.length; i++) { 2661 var cookie = jQuery.trim(cookies[i]); 2662 // Does this cookie string begin with the name we want? 2663 if (cookie.substring(0, name.length + 1) == (name + '=')) { 2664 cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); 2665 break; 2666 } 2667 } 2668 } 2669 return cookieValue; 2670 } 2671}; 2672 2673 2674/*-------------------------------------------------- 2675* jquery.color 2676--------------------------------------------------*/ 2677/* 2678 * jQuery Color Animations 2679 * Copyright 2007 John Resig 2680 * Released under the MIT and GPL licenses. 2681 */ 2682 2683(function(jQuery){ 2684 2685 // We override the animation for all of these color styles 2686 jQuery.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function(i,attr){ 2687 jQuery.fx.step[attr] = function(fx){ 2688 if ( fx.state == 0 ) { 2689 fx.start = getColor( fx.elem, attr ); 2690 fx.end = getRGB( fx.end ); 2691 } 2692 2693 fx.elem.style[attr] = "rgb(" + [ 2694 Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0]), 255), 0), 2695 Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1]), 255), 0), 2696 Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2]), 255), 0) 2697 ].join(",") + ")"; 2698 } 2699 }); 2700 2701 // Color Conversion functions from highlightFade 2702 // By Blair Mitchelmore 2703 // http://jquery.offput.ca/highlightFade/ 2704 2705 // Parse strings looking for color tuples [255,255,255] 2706 function getRGB(color) { 2707 var result; 2708 2709 // Check if we're already dealing with an array of colors 2710 if ( color && color.constructor == Array && color.length == 3 ) 2711 return color; 2712 2713 // Look for rgb(num,num,num) 2714 if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color)) 2715 return [parseInt(result[1]), parseInt(result[2]), parseInt(result[3])]; 2716 2717 // Look for rgb(num%,num%,num%) 2718 if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color)) 2719 return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55]; 2720 2721 // Look for #a0b1c2 2722 if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color)) 2723 return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)]; 2724 2725 // Look for #fff 2726 if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color)) 2727 return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)]; 2728 2729 // Otherwise, we're most likely dealing with a named color 2730 return colors[jQuery.trim(color).toLowerCase()]; 2731 } 2732 2733 function getColor(elem, attr) { 2734 var color; 2735 2736 do { 2737 color = jQuery.curCSS(elem, attr); 2738 2739 // Keep going until we find an element that has color, or we hit the body 2740 if ( color != '' && color != 'transparent' || jQuery.nodeName(elem, "body") ) 2741 break; 2742 2743 attr = "backgroundColor";
vendor: 4,855 bytes, lines 2744-2842
2744 } while ( elem = elem.parentNode ); 2745 2746 return getRGB(color); 2747 }; 2748 2749 // Some named colors to work with 2750 // From Interface by Stefan Petre 2751 // http://interface.eyecon.ro/ 2752 2753 var colors = { 2754 aqua:[0,255,255], 2755 azure:[240,255,255], 2756 beige:[245,245,220], 2757 black:[0,0,0], 2758 blue:[0,0,255], 2759 brown:[165,42,42], 2760 cyan:[0,255,255], 2761 darkblue:[0,0,139], 2762 darkcyan:[0,139,139], 2763 darkgrey:[169,169,169], 2764 darkgreen:[0,100,0], 2765 darkkhaki:[189,183,107], 2766 darkmagenta:[139,0,139], 2767 darkolivegreen:[85,107,47], 2768 darkorange:[255,140,0], 2769 darkorchid:[153,50,204], 2770 darkred:[139,0,0], 2771 darksalmon:[233,150,122], 2772 darkviolet:[148,0,211], 2773 fuchsia:[255,0,255], 2774 gold:[255,215,0], 2775 green:[0,128,0], 2776 indigo:[75,0,130], 2777 khaki:[240,230,140], 2778 lightblue:[173,216,230], 2779 lightcyan:[224,255,255], 2780 lightgreen:[144,238,144], 2781 lightgrey:[211,211,211], 2782 lightpink:[255,182,193], 2783 lightyellow:[255,255,224], 2784 lime:[0,255,0], 2785 magenta:[255,0,255], 2786 maroon:[128,0,0], 2787 navy:[0,0,128], 2788 olive:[128,128,0], 2789 orange:[255,165,0], 2790 pink:[255,192,203], 2791 purple:[128,0,128], 2792 violet:[128,0,128], 2793 red:[255,0,0], 2794 silver:[192,192,192], 2795 white:[255,255,255], 2796 yellow:[255,255,0] 2797 }; 2798 2799})(jQuery); 2800 2801 2802/*-------------------------------------------------- 2803* jquery.mousewheel 2804--------------------------------------------------*/ 2805/*! Copyright (c) 2013 Brandon Aaron (http://brandon.aaron.sh) 2806 * Licensed under the MIT License (LICENSE.txt). 2807 * 2808 * Version: 3.1.12 2809 * 2810 * Requires: jQuery 1.2.2+ 2811 */ 2812!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a:a(jQuery)}(function(a){function b(b){var g=b||window.event,h=i.call(arguments,1),j=0,l=0,m=0,n=0,o=0,p=0;if(b=a.event.fix(g),b.type="mousewheel","detail"in g&&(m=-1*g.detail),"wheelDelta"in g&&(m=g.wheelDelta),"wheelDeltaY"in g&&(m=g.wheelDeltaY),"wheelDeltaX"in g&&(l=-1*g.wheelDeltaX),"axis"in g&&g.axis===g.HORIZONTAL_AXIS&&(l=-1*m,m=0),j=0===m?l:m,"deltaY"in g&&(m=-1*g.deltaY,j=m),"deltaX"in g&&(l=g.deltaX,0===m&&(j=-1*l)),0!==m||0!==l){if(1===g.deltaMode){var q=a.data(this,"mousewheel-line-height");j*=q,m*=q,l*=q}else if(2===g.deltaMode){var r=a.data(this,"mousewheel-page-height");j*=r,m*=r,l*=r}if(n=Math.max(Math.abs(m),Math.abs(l)),(!f||f>n)&&(f=n,d(g,n)&&(f/=40)),d(g,n)&&(j/=40,l/=40,m/=40),j=Math[j>=1?"floor":"ceil"](j/f),l=Math[l>=1?"floor":"ceil"](l/f),m=Math[m>=1?"floor":"ceil"](m/f),k.settings.normalizeOffset&&this.getBoundingClientRect){var s=this.getBoundingClientRect();o=b.clientX-s.left,p=b.clientY-s.top}return b.deltaX=l,b.deltaY=m,b.deltaFactor=f,b.offsetX=o,b.offsetY=p,b.deltaMode=0,h.unshift(b,j,l,m),e&&clearTimeout(e),e=setTimeout(c,200),(a.event.dispatch||a.event.handle).apply(this,h)}}function c(){f=null}function d(a,b){return k.settings.adjustOldDeltas&&"mousewheel"===a.type&&b%120===0}var e,f,g=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],h="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],i=Array.prototype.slice;if(a.event.fixHooks)for(var j=g.length;j;)a.event.fixHooks[g[--j]]=a.event.mouseHooks;var k=a.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var c=h.length;c;)this.addEventListener(h[--c],b,!1);else this.onmousewheel=b;a.data(this,"mousewheel-line-height",k.getLineHeight(this)),a.data(this,"mousewheel-page-height",k.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var c=h.length;c;)this.removeEventListener(h[--c],b,!1);else this.onmousewheel=null;a.removeData(this,"mousewheel-line-height"),a.removeData(this,"mousewheel-page-height")},getLineHeight:function(b){var c=a(b),d=c["offsetParent"in a.fn?"offsetParent":"parent"]();return d.length||(d=a("body")),parseInt(d.css("fontSize"),10)||parseInt(c.css("fontSize"),10)||16},getPageHeight:function(b){return a(b).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})}); 2813 2814 2815 2816 2817 2818 2819//////////////////////////////////////////////////// 2820//////////////////////////////////////////////////// 2821/* 2822Another Plugins 2823*/ 2824//////////////////////////////////////////////////// 2825//////////////////////////////////////////////////// 2826 2827/*-------------------------------------------------- 2828* TextResizeDetector 2829--------------------------------------------------*/ 2830/** 2831 * @fileoverview TextResizeDetector 2832 * 2833 * Detects changes to font sizes when user changes browser settings 2834 * <br>Fires a custom event with the following data:<br><br> 2835 * iBase : base font size 2836 * iDelta : difference in pixels from previous setting<br> 2837 * iSize : size in pixel of text<br> 2838 * 2839 * * @author Lawrence Carvalho [email protected] 2840 * @version 1.0 2841 */ 2842
2843/** 2844 * @constructor 2845 */ 2846TextResizeDetector = function() { 2847 var el = null; 2848 var iIntervalDelay = 200; 2849 var iInterval = null; 2850 var iCurrSize = -1; 2851 var iBase = -1; 2852 var aListeners = []; 2853 var createControlElement = function() { 2854 el = document.createElement('span'); 2855 el.id='textResizeControl'; 2856 el.innerHTML=' '; 2857 el.style.position="absolute"; 2858 el.style.left="-9999px"; 2859 var elC = document.getElementById(TextResizeDetector.TARGET_ELEMENT_ID); 2860 // insert before firstChild 2861 if (elC) 2862 elC.insertBefore(el,elC.firstChild); 2863 iBase = iCurrSize = TextResizeDetector.getSize(); 2864 }; 2865 2866 function _stopDetector() { 2867 window.clearInterval(iInterval); 2868 iInterval=null; 2869 }; 2870 function _startDetector() { 2871 if (!iInterval) { 2872 iInterval = window.setInterval('TextResizeDetector.detect()',iIntervalDelay); 2873 } 2874 }; 2875 2876 function _detect() { 2877 var iNewSize = TextResizeDetector.getSize(); 2878 2879 if(iNewSize!== iCurrSize) { 2880 for (var i=0;i <aListeners.length;i++) { 2881 aListnr = aListeners[i]; 2882 var oArgs = { iBase: iBase,iDelta:((iCurrSize!=-1) ? iNewSize - iCurrSize + 'px' : "0px"),iSize:iCurrSize = iNewSize}; 2883 if (!aListnr.obj) { 2884 aListnr.fn('textSizeChanged',[oArgs]); 2885 } 2886 else { 2887 aListnr.fn.apply(aListnr.obj,['textSizeChanged',[oArgs]]); 2888 } 2889 } 2890 2891 } 2892 return iCurrSize; 2893 }; 2894 var onAvailable = function() { 2895 2896 if (!TextResizeDetector.onAvailableCount_i ) { 2897 TextResizeDetector.onAvailableCount_i =0; 2898 } 2899 2900 if (document.getElementById(TextResizeDetector.TARGET_ELEMENT_ID)) { 2901 TextResizeDetector.init(); 2902 if (TextResizeDetector.USER_INIT_FUNC){ 2903 TextResizeDetector.USER_INIT_FUNC(); 2904 } 2905 TextResizeDetector.onAvailableCount_i = null; 2906 } 2907 else { 2908 if (TextResizeDetector.onAvailableCount_i<600) { 2909 TextResizeDetector.onAvailableCount_i++; 2910 setTimeout(onAvailable,200) 2911 } 2912 } 2913 }; 2914 setTimeout(onAvailable,500); 2915 2916 return { 2917 /* 2918 * Initializes the detector 2919 * 2920 * @param {String} sId The id of the element in which to create the control element 2921 */ 2922 init: function() { 2923 2924 createControlElement(); 2925 _startDetector(); 2926 }, 2927 /** 2928 * Adds listeners to the ontextsizechange event. 2929 * Returns the base font size 2930 * 2931 */ 2932 addEventListener:function(fn,obj,bScope) { 2933 aListeners[aListeners.length] = { 2934 fn: fn, 2935 obj: obj 2936 } 2937 return iBase; 2938 }, 2939 /** 2940 * performs the detection and fires textSizeChanged event 2941 * @return the current font size 2942 * @type {integer} 2943 */ 2944 detect:function() { 2945 return _detect(); 2946 }, 2947 /** 2948 * Returns the height of the control element 2949 * 2950 * @return the current height of control element 2951 * @type {integer} 2952 */ 2953 getSize:function() { 2954 var iSize; 2955 return el.offsetHeight; 2956 2957 2958 }, 2959 /** 2960 * Stops the detector 2961 */ 2962 stopDetector:function() { 2963 return _stopDetector(); 2964 }, 2965 /* 2966 * Starts the detector 2967 */ 2968 startDetector:function() { 2969 return _startDetector(); 2970 } 2971 } 2972 }(); 2973TextResizeDetector.TARGET_ELEMENT_ID = 'doc'; 2974TextResizeDetector.USER_INIT_FUNC = null; 2975 2976 2977 2978 2979 2980/*-------------------------------------------------- 2981* Web Font Loader v1.6.3 2982--------------------------------------------------*/ 2983/* Web Font Loader v1.6.3 - (c) Adobe Systems, Google. License: Apache 2.0 */ 2984(function(){function aa(a,b,c){return a.call.apply(a.bind,arguments)}function ba(a,b,c){if(!a)throw Error();if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(c,d);return a.apply(b,c)}}return function(){return a.apply(b,arguments)}}function m(a,b,c){m=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?aa:ba;return m.apply(null,arguments)}var n=Date.now||function(){return+new Date};function r(a,b){this.C=a;this.q=b||a;this.D=this.q.document}r.prototype.createElement=function(a,b,c){a=this.D.createElement(a);if(b)for(var d in b)b.hasOwnProperty(d)&&("style"==d?a.style.cssText=b[d]:a.setAttribute(d,b[d]));c&&a.appendChild(this.D.createTextNode(c));return a};function s(a,b,c){a=a.D.getElementsByTagName(b)[0];a||(a=document.documentElement);a&&a.lastChild&&a.insertBefore(c,a.lastChild)} 2985function t(a,b,c){b=b||[];c=c||[];for(var d=a.className.split(/\s+/),f=0;f<b.length;f+=1){for(var e=!1,g=0;g<d.length;g+=1)if(b[f]===d[g]){e=!0;break}e||d.push(b[f])}b=[];for(f=0;f<d.length;f+=1){e=!1;for(g=0;g<c.length;g+=1)if(d[f]===c[g]){e=!0;break}e||b.push(d[f])}a.className=b.join(" ").replace(/\s+/g," ").replace(/^\s+|\s+$/,"")}function u(a,b){for(var c=a.className.split(/\s+/),d=0,f=c.length;d<f;d++)if(c[d]==b)return!0;return!1} 2986function v(a){if("string"===typeof a.ca)return a.ca;var b=a.q.location.protocol;"about:"==b&&(b=a.C.location.protocol);return"https:"==b?"https:":"http:"}function w(a,b){var c=a.createElement("link",{rel:"stylesheet",href:b,media:"all"}),d=!1;c.onload=function(){d||(d=!0)};c.onerror=function(){d||(d=!0)};s(a,"head",c)} 2987function x(a,b,c,d){var f=a.D.getElementsByTagName("head")[0];if(f){var e=a.createElement("script",{src:b}),g=!1;e.onload=e.onreadystatechange=function(){g||this.readyState&&"loaded"!=this.readyState&&"complete"!=this.readyState||(g=!0,
2987c&&c(null),e.onload=e.onreadystatechange=null,"HEAD"==e.parentNode.tagName&&f.removeChild(e))};f.appendChild(e);setTimeout(function(){g||(g=!0,c&&c(Error("Script load timeout")))},d||5E3);return e}return null};function y(a){this.ba=a||"-"}y.prototype.d=function(a){for(var b=[],c=0;c<arguments.length;c++)b.push(arguments[c].replace(/[\W_]+/g,"").toLowerCase());return b.join(this.ba)};function z(a,b){this.U=a;this.M=4;this.G="n";var c=(b||"n4").match(/^([nio])([1-9])$/i);c&&(this.G=c[1],this.M=parseInt(c[2],10))}z.prototype.getName=function(){return this.U};function A(a){return a.G+a.M}function ca(a){var b=4,c="n",d=null;a&&((d=a.match(/(normal|oblique|italic)/i))&&d[1]&&(c=d[1].substr(0,1).toLowerCase()),(d=a.match(/([1-9]00|normal|bold)/i))&&d[1]&&(/bold/i.test(d[1])?b=7:/[1-9]00/.test(d[1])&&(b=parseInt(d[1].substr(0,1),10))));return c+b};function da(a,b){this.a=a;this.j=a.q.document.documentElement;this.I=b;this.f="wf";this.e=new y("-");this.Y=!1!==b.events;this.v=!1!==b.classes}function ea(a){a.v&&t(a.j,[a.e.d(a.f,"loading")]);B(a,"loading")}function C(a){if(a.v){var b=u(a.j,a.e.d(a.f,"active")),c=[],d=[a.e.d(a.f,"loading")];b||c.push(a.e.d(a.f,"inactive"));t(a.j,c,d)}B(a,"inactive")}function B(a,b,c){if(a.Y&&a.I[b])if(c)a.I[b](c.getName(),A(c));else a.I[b]()};function fa(){this.u={}}function ga(a,b,c){var d=[],f;for(f in b)if(b.hasOwnProperty(f)){var e=a.u[f];e&&d.push(e(b[f],c))}return d};function D(a,b){this.a=a;this.A=b;this.g=this.a.createElement("span",{"aria-hidden":"true"},this.A)}function F(a){s(a.a,"body",a.g)} 2988function G(a){var b;b=[];for(var c=a.U.split(/,\s*/),d=0;d<c.length;d++){var f=c[d].replace(/['"]/g,"");-1==f.indexOf(" ")?b.push(f):b.push("'"+f+"'")}b=b.join(",");c="normal";"o"===a.G?c="oblique":"i"===a.G&&(c="italic");return"display:block;position:absolute;top:-9999px;left:-9999px;font-size:300px;width:auto;height:auto;line-height:normal;margin:0;padding:0;font-variant:normal;white-space:nowrap;font-family:"+b+";"+("font-style:"+c+";font-weight:"+(a.M+"00")+";")} 2989D.prototype.remove=function(){var a=this.g;a.parentNode&&a.parentNode.removeChild(a)};function H(a,b,c,d,f,e,g){this.N=a;this.aa=b;this.a=c;this.h=d;this.A=g||"BESbswy";this.p={};this.L=f||3E3;this.S=e||null;this.w=this.o=this.m=null;this.m=new D(this.a,this.A);this.o=new D(this.a,this.A);this.w=new D(this.a,this.A);a=new z("serif",A(this.h));a=G(a);this.m.g.style.cssText=a;a=new z("sans-serif",A(this.h));a=G(a);this.o.g.style.cssText=a;a=new z("monospace",A(this.h));a=G(a);this.w.g.style.cssText=a;F(this.m);F(this.o);F(this.w);this.p.serif=this.m.g.offsetWidth;this.p["sans-serif"]= 2990this.o.g.offsetWidth;this.p.monospace=this.w.g.offsetWidth}var I={ga:"serif",fa:"sans-serif",ea:"monospace"},J=null;function K(){if(null===J){var a=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent);J=!!a&&(536>parseInt(a[1],10)||536===parseInt(a[1],10)&&11>=parseInt(a[2],10))}return J} 2991H.prototype.start=function(){this.da=n();var a=new z(this.h.getName()+",serif",A(this.h)),a=G(a);this.m.g.style.cssText=a;a=new z(this.h.getName()+",sans-serif",A(this.h));a=G(a);this.o.g.style.cssText=a;L(this)};function M(a,b,c){for(var d in I)if(I.hasOwnProperty(d)&&b===a.p[I[d]]&&c===a.p[I[d]])return!0;return!1} 2992function L(a){var b=a.m.g.offsetWidth,c=a.o.g.offsetWidth,d;(d=b===a.p.serif&&c===a.p["sans-serif"])||(d=K()&&M(a,b,c));d?n()-a.da>=a.L?K()&&M(a,b,c)&&(null===a.S||a.S.hasOwnProperty(a.h.getName()))?N(a,a.N):N(a,a.aa):ha(a):N(a,a.N)}function ha(a){setTimeout(m(function(){L(this)},a),50)}function N(a,b){a.m.remove();a.o.remove();a.w.remove();b(a.h)};function O(a,b,c){this.a=a;this.s=b;this.J=0;this.W=this.R=!1;this.L=c}O.prototype.Z=function(a){var b=this.s;b.v&&t(b.j,[b.e.d(b.f,a.getName(),A(a).toString(),"active")],[b.e.d(b.f,a.getName(),A(a).toString(),"loading"),b.e.d(b.f,a.getName(),A(a).toString(),"inactive")]);B(b,"fontactive",a);this.W=!0;P(this)}; 2993O.prototype.$=function(a){var b=this.s;if(b.v){var c=u(b.j,b.e.d(b.f,a.getName(),A(a).toString(),"active")),d=[],f=[b.e.d(b.f,a.getName(),A(a).toString(),"loading")];c||d.push(b.e.d(b.f,a.getName(),A(a).toString(),"inactive"));t(b.j,d,f)}B(b,"fontinactive",a);P(this)};function P(a){0==--a.J&&a.R&&(a.W?(a=a.s,a.v&&t(a.j,[a.e.d(a.f,"active")],[a.e.d(a.f,"loading"),a.e.d(a.f,"inactive")]),B(a,"active")):C(a.s))};function Q(a){this.C=a;this.t=new fa;this.T=0;this.O=this.P=!0}Q.prototype.load=function(a){this.a=new r(this.C,a.context||this.C);this.P=!1!==a.events;this.O=!1!==a.classes;ia(this,new da(this.a,a),a)}; 2994function ja(a,b,c,d,f){var e=0==--a.T;(a.O||a.P)&&setTimeout(function(){var a=f||null,l=d||null||{};if(0===c.length&&e)C(b.s);else{b.J+=c.length;e&&(b.R=e);for(var k=0;k<c.length;k++){var h=c[k],p=l[h.getName()],q=b.s,E=h;q.v&&t(q.j,[q.e.d(q.f,E.getName(),A(E).toString(),"loading")]);B(q,"fontloading",E);q=null;q=new H(m(b.Z,b),m(b.$,b),b.a,h,b.L,a,p);q.start()}}},0)} 2995function ia(a,b,c){var d=[],f=c.timeout;ea(b);var d=ga(a.t,c,a.a),e=new O(a.a,b,f);a.T=d.length;b=0;for(c=d.length;b<c;b++)d[b].load(function(b,c,d){ja(a,e,b,c,d)})};function R(a,b,c){this.H=a?a:b+ka;this.k=[];this.K=[];this.X=c||""}var ka="//fonts.googleapis.com/css";R.prototype.d=function(){if(0==this.k.length)throw Error("No fonts to load!");if(-1!=this.H.indexOf("kit="))return this.H;for(var a=this.k.length,b=[],c=0;c<a;c++)b.push(this.k[c].replace(/ /g,"+"));a=this.H+"?family="+b.join("%7C");0<this.K.length&&(a+="&subset="+this.K.join(","));0<this.X.length&&(a+="&text="+encodeURIComponent(this.X));return a};function S(a){this.k=a;this.V=[];this.F={}} 2996var T={latin:"BESbswy",cyrillic:"йяЖ",greek:"αβΣ",khmer:"កខគ",Hanuman:"កខគ"},la={thin:"1",extralight:"2","extra-light":"2",ultralight:"2","ultra-light":"2",light:"3",regular:"4",book:"4",medium:"5","semi-bold":"6",semibold:"6","demi-bold":"6",demibold:"6",bold:"7","extra-bold":"8",extrabold:"8","ultra-bold":"8",ultrabold:"8",black:"9",heavy:"9",l:"3",r:"4",b:"7"},ma={i:"i",italic:"i",n:"n",normal:"n"},na=/^(thin|(?:(?:extra|ultra)-?)?light|regular|book|medium|(?:(?:semi|demi|extra|ultra)-?)?bold|black|heavy|l|r|b|[1-9]00)?(n|i|normal|italic)?$/; 2997S.prototype.parse=function(){for(var a=this.k.length,b=0;b<a;b++){var c=this.k[b].split(":"),d=c[0].replace(/\+/g," "),f=["n4"];if(2<=c.length){var e;var g=c[1];e=[];if(g)for(var g=g.split(","),l=g.length,k=0;k<l;k++){var h;h=g[k];if(h.match(/^[\w-]+$/))if(h=na.exec(h.toLowerCase()),null==h)h="";else{var p;p=h[1];if(null==p||""==p)p="4";else{var q=la[p];p=q?q:isNaN(p)?"4":p.substr(0,1)}h=h[2];h=[null==h||""==h?"n":ma[h],p].join("")}else h="";h&&e.push(h)}0<e.length&&(f=e);3==c.length&&(c=c[2],e=[], 2998c=c?c.split(","):e,0<c.length&&(c=T[c[0]])&&(this.F[d]=c))}this.F[d]||(c=T[d])&&(this.F[d]=c);for(c=0;c<f.length;c+=1)this.V.push(new z(d,f[c]))}};function U(a,b){this.a=a;this.c=b}var oa={Arimo:!0,Cousine:!0,Tinos:!0};U.prototype.load=function(a){for(var b=this.a,c=new R(this.c.api,v(b),this.c.text),d=this.c.families,f=d.length,e=0;e<f;e++){var g=d[e].split(":");3==g.length&&c.K.push(g.pop());var l="";2==g.length&&""!=g[1]&&(l=":");c.k.push(g.join(l))}d=new S(d);d.parse();w(b,c.d());a(d.V,d.F,oa)};function V(a,b){this.a=a;this.c=b;this.Q=[]}V.prototype.B=function(a){var b=this.a;return v(this.a)+(this.c.api||"//f.fontdeck.com/s/css/js/")+(b.q.location.hostname||b.C.location.hostname)+"/"+a+".js"}; 2999V.prototype.load=function(a){var b=this.c.id,c=this.a.q,d=this;b?(c.__webfontfontdeckmodule__||(c.__webfontfontdeckmodule__={}),c.__webfontfontdeckmodule__[b]=function(b,c){for(var g=0,l=c.fonts.length;g<l;++g){var k=c.fonts[g];d.Q.push(new z(k.name,ca("font-weight:"+k.weight+";font-style:"+k.style)))}a(d.Q)},x(this.a,this.B(b),function(b){b&&a([])})):a([])};function W(a,b){this.a=a;this.c=b}W.prototype.B=function(a){return(this.c.api||"https://use.typekit.net")+"/"+a+".js"};W.prototype.load=function(a){var b=this.c.id,c=this.a.q;b?x(this.a,this.B(b),function(b){if(b)a([]);else if(c.Typekit&&c.Typekit.config&&c.Typekit.config.fn){b=c.Typekit.config.fn;for(var f=[],e=0;e<b.length;e+=2)for(var g=b[e],l=b[e+1],k=0;k<l.length;k++)f.push(new z(g,l[k]));try{c.Typekit.load({events:!1,classes:!1})}catch(h){}a(f)}},2E3):a([])};function X(a,b){this.a=a;this.c=b}X.prototype.B=function(a,b){var c=v(this.a),d=(this.c.api||"fast.fonts.net/jsapi").replace(/^.*http(s?):(\/\/)?/,"");return c+"//"+d+"/"+a+".js"+(b?"?v="+b:"")};X.prototype.load=function(a){var b=this.c.projectId,c=this.c.version;if(b){var d=this.a.q;x(this.a,this.B(b,c),function(c){if(c)a([]);else if(d["__mti_fntLst"+b]){c=d["__mti_fntLst"+b]();var e=[];
vendor: 4,413 bytes, lines 2999-3017
2999if(c)for(var g=0;g<c.length;g++)e.push(new z(c[g].fontfamily));a(e)}else a([])}).id="__MonotypeAPIScript__"+b}else a([])};function Y(a,b){this.a=a;this.c=b}Y.prototype.load=function(a){var b,c,d=this.c.urls||[],f=this.c.families||[],e=this.c.testStrings||{};b=0;for(c=d.length;b<c;b++)w(this.a,d[b]);d=[];b=0;for(c=f.length;b<c;b++){var g=f[b].split(":");if(g[1])for(var l=g[1].split(","),k=0;k<l.length;k+=1)d.push(new z(g[0],l[k]));else d.push(new z(g[0]))}a(d,e)};var Z=new Q(window);Z.t.u.custom=function(a,b){return new Y(b,a)};Z.t.u.fontdeck=function(a,b){return new V(b,a)};Z.t.u.monotype=function(a,b){return new X(b,a)};Z.t.u.typekit=function(a,b){return new W(b,a)};Z.t.u.google=function(a,b){return new U(b,a)};var $={load:m(Z.load,Z)};"function"===typeof define&&define.amd?define(function(){return $}):"undefined"!==typeof module&&module.exports?module.exports=$:(window.WebFont=$,window.WebFontConfig&&Z.load(window.WebFontConfig));}()); 3000 3001 3002 3003 3004 3005//////////////////////////////////////////////////// 3006//////////////////////////////////////////////////// 3007/* 3008jQuery Extensions Plugins 3009*/ 3010//////////////////////////////////////////////////// 3011//////////////////////////////////////////////////// 3012 3013/*-------------------------------------------------- 3014* jquery.lazyload 3015--------------------------------------------------*/ 3016/*! Lazy Load 1.9.7 - MIT license - Copyright 2010-2015 Mika Tuupola */ 3017!function(a,b,c,d){var e=a(b);a.fn.lazyload=function(f){function g(){var b=0;i.each(function(){var c=a(this);if(!j.skip_invisible||c.is(":visible"))if(a.abovethetop(this,j)||a.leftofbegin(this,j));else if(a.belowthefold(this,j)||a.rightoffold(this,j)){if(++b>j.failure_limit)return!1}else c.trigger("appear"),b=0})}var h,i=this,j={threshold:0,failure_limit:0,event:"scroll",effect:"show",container:b,data_attribute:"original",skip_invisible:!1,appear:null,load:null,placeholder:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB/AAffA0nNPuCLAAAAAElFTkSuQmCC"};return f&&(d!==f.failurelimit&&(f.failure_limit=f.failurelimit,delete f.failurelimit),d!==f.effectspeed&&(f.effect_speed=f.effectspeed,delete f.effectspeed),a.extend(j,f)),h=j.container===d||j.container===b?e:a(j.container),0===j.event.indexOf("scroll")&&h.bind(j.event,function(){return g()}),this.each(function(){var b=this,c=a(b);b.loaded=!1,(c.attr("src")===d||c.attr("src")===!1)&&c.is("img")&&c.attr("src",j.placeholder),c.one("appear",function(){if(!this.loaded){if(j.appear){var d=i.length;j.appear.call(b,d,j)}a("<img />").bind("load",function(){var d=c.attr("data-"+j.data_attribute);c.hide(),c.is("img")?c.attr("src",d):c.css("background-image","url('"+d+"')"),c[j.effect](j.effect_speed),b.loaded=!0;var e=a.grep(i,function(a){return!a.loaded});if(i=a(e),j.load){var f=i.length;j.load.call(b,f,j)}}).attr("src",c.attr("data-"+j.data_attribute))}}),0!==j.event.indexOf("scroll")&&c.bind(j.event,function(){b.loaded||c.trigger("appear")})}),e.bind("resize",function(){g()}),/(?:iphone|ipod|ipad).*os 5/gi.test(navigator.appVersion)&&e.bind("pageshow",function(b){b.originalEvent&&b.originalEvent.persisted&&i.each(function(){a(this).trigger("appear")})}),a(c).ready(function(){g()}),this},a.belowthefold=function(c,f){var g;return g=f.container===d||f.container===b?(b.innerHeight?b.innerHeight:e.height())+e.scrollTop():a(f.container).offset().top+a(f.container).height(),g<=a(c).offset().top-f.threshold},a.rightoffold=function(c,f){var g;return g=f.container===d||f.container===b?e.width()+e.scrollLeft():a(f.container).offset().left+a(f.container).width(),g<=a(c).offset().left-f.threshold},a.abovethetop=function(c,f){var g;return g=f.container===d||f.container===b?e.scrollTop():a(f.container).offset().top,g>=a(c).offset().top+f.threshold+a(c).height()},a.leftofbegin=function(c,f){var g;return g=f.container===d||f.container===b?e.scrollLeft():a(f.container).offset().left,g>=a(c).offset().left+f.threshold+a(c).width()},a.inviewport=function(b,c){return!(a.rightoffold(b,c)||a.leftofbegin(b,c)||a.belowthefold(b,c)||a.abovethetop(b,c))},a.extend(a.expr[":"],{"below-the-fold":function(b){return a.belowthefold(b,{threshold:0})},"above-the-top":function(b){return!a.belowthefold(b,{threshold:0})},"right-of-screen":function(b){return a.rightoffold(b,{threshold:0})},"left-of-screen":function(b){return!a.rightoffold(b,{threshold:0})}
3017,"in-viewport":function(b){return a.inviewport(b,{threshold:0})},"above-the-fold":function(b){return!a.belowthefold(b,{threshold:0})},"right-of-fold":function(b){return a.rightoffold(b,{threshold:0})},"left-of-fold":function(b){return!a.rightoffold(b,{threshold:0})}})}(jQuery,window,document); 3018 3019 3020/*-------------------------------------------------- 3021* FLAutoKerning.js 3022--------------------------------------------------*/ 3023/* 3024 ã«ã¼ãã³ã°ãã¢ã®å®ç¾© 3025 åä½ã¯emã -0.5(em) ã§ããã¯ã¹0.5ååè©°ã¾ãã 3026 "*ã" ã¨å®ç¾©ããå ´åã"ãã"ã"ãã"ã"ãã"ãã¨ããããã«ãå ¨ã¦ã®"âã"ã®çµã¿åããã«ã«ã¼ãã³ã°ãè¨å®ãããã 3027 "ãã" ã¨å®ç¾©ãããå ´åã "ãã"ã¨ããæåã®ãã¢ã®ã¿ã«ã«ã¼ãã³ã°ãè¨å®ãããã 3028 ã¯ã¤ã«ãã«ã¼ããã¢ã¨ç´æ¥æå®ã®ãã¢ãè¡çªããå ´åãç´æ¥æå®ã®ãã¢ãåªå ãããã 3029*/ 3030var p = {}; 3031 3032//åå¾ã®æåãã¯ã¤ã«ãã«ã¼ãæå®ããæ±ç¨ã®ã«ã¼ãã³ã°ã㢠3033p["*ã"] = -0.03; 3034p["ã*"] = -0.02; 3035p["*ã"] = -0.075; 3036p["ã*"] = -0.075; 3037p["*ã"] = -0.075; 3038p["ã*"] = -0.075; 3039p["*ã"] = -0.05; 3040p["ã*"] = -0.075; 3041p["*ã"] = -0.05; 3042p["ã*"] = -0.075; 3043p["*ã "] = -0.05; 3044p["ã *"] = -0.075; 3045p["*ã"] = -0.05; 3046p["ã*"] = -0.075; 3047p["*ã"] = -0.05; 3048p["ã*"] = -0.075; 3049p["*ã£"] = -0.075; 3050p["ã£*"] = -0.075; 3051p["*ã"] = -0.05; 3052p["ã*"] = -0.075; 3053p["*ã "] = -0.05; 3054p["ã *"] = -0.075; 3055p["*ã"] = -0.075; 3056p["ã*"] = -0.075; 3057p["*ã"] = -0.075; 3058p["ã*"] = -0.075; 3059p["*ã"] = -0.075; 3060p["ã*"] = -0.075; 3061p["*ãª"] = -0.075; 3062p["ãª*"] = -0.075; 3063p["*ã"] = -0.05; 3064p["ã*"] = -0.075; 3065p["ã£*"] = -0.05; 3066p["*ã£"] = -0.05; 3067p["ã¥*"] = -0.05; 3068p["*ã¥"] = -0.05; 3069p["ã§*"] = -0.08; 3070p["*ã§"] = -0.08; 3071p["*ã"] = -0.25; 3072p["ã*"] = -0.25; 3073p["*ï¼"] = -0.25; 3074p["ï¼*"] = -0.25; 3075p["ã*"] = -0.25; 3076p["ã*"] = -0.25; 3077p["ã»*"] = -0.25; 3078p["*ã»"] = -0.25; 3079p["*ï¼"] = -0.25; 3080p["ï¼*"] = -0.25; 3081 3082//ç´æ¥æå®ã®ã«ã¼ãã³ã°ã㢠3083p["ãã¦"] = -0.12; 3084p["ãã"] = -0.15; 3085p["ã¿ã¯"] = -0.12; 3086p["ã¿ã°"] = -0.12; 3087p["ãã"] = -0.2; 3088p["ã©ã "] = -0.1; 3089p["ãã«"] = -0.1; 3090p["ã³ã"] = -0.15; 3091p["ã³ã°"] = -0.05; 3092p["ã¼ã"] = -0.15; 3093p["ãã"] = -0.75; 3094p["ãã"] = -0.25; 3095p["ãã"] = -0.25; 3096p["ãã"] = -0.75; 3097p["ãã"] = -0.75; 3098p["ãã"] = -0.75; 3099p["ãã"] = -0.75; 3100p["ãï¼"] = -0.75; 3101p["ãï¼"] = -0.75; 3102 3103//1æåã¯è¡é å°ç¨ã®ã«ã¼ãã³ã°ã㢠3104p["ã"] = -0.5; 3105p["ã"] = -0.5; 3106p["ï¼"] = -0.5; 3107p["ã"] = -0.5; 3108p["â"] = -0.5; 3109 3110//20150624追å 3111p["ã*"] = -0.45; 3112p["ãå"] = -0.05; 3113p["ãã"] = -0.02; 3114p["äºæ¥"] = 0.08; 3115p["ã¼ã"] = -0.21; 3116 3117 3118var tp = {}; 3119tp["ã"] = -0.75; 3120tp["ã"] = -0.75; 3121tp["ã人"] = -0.1; 3122tp["人ã"] = 0.04; 3123tp["ãã¨"] = -0.45; 3124tp["ã¨ã¨"] = -0.15; 3125tp["ã¨ã"] = -0.1; 3126tp["ãã«"] = -0.12; 3127tp["ã«ã"] = -0.4; 3128tp["ãã¢"] = -0.12; 3129tp["ã¢ã"] = -0.12; 3130tp["ãã¥"] = -0.12; 3131tp["ã¥ã"] = -0.08; 3132tp["ãã"] = -0.26; 3133tp["ãã"] = -0.2; 3134tp["ãã®"] = -0.45; 3135tp["æªæ¥"] = 0.05; 3136tp["æ¥ã¸"] = 0.07; 3137 3138var ax1 = {}; 3139ax1["ã"] = -0.5; 3140ax1["ã人"] = -0.12; 3141ax1["人ã"] = 0.1; 3142ax1["ãã¨"] = -0.3; 3143ax1["ã¨ã¨"] = -0.14; 3144ax1["ã¨ã"] = -0.1; 3145ax1["ã«ã"] = -0.25; 3146ax1["ãã"] = -0.16; 3147ax1["ãã"] = -0.1; 3148ax1["ãã®"] = -0.32; 3149ax1["æªæ¥"] = 0.16; 3150ax1["æ¥ã¸"] = 0.12; 3151 3152var akk = {}; 3153akk["hu"] = -0.02; 3154akk["um"] = -0.02; 3155akk["in"] = -0.02; 3156akk["nn"] = -0.04; 3157akk["no"] = -0.04; 3158akk["va"] = -0.04; 3159akk["io"] = -0.03; 3160akk["on"] = -0.04; 3161 3162var shingocondb = {}; 3163shingocondb["ãã¨"] = -0.01; 3164shingocondb["ãã"] = -0.02; 3165shingocondb["ã*"] = -0.4; 3166shingocondb["ã¤ãª"] = -0.001; 3167shingocondb["ãã"] = -0.01; 3168shingocondb["ã*"] = -0.4; 3169 3170/* 3171 * @class FLAutoKerning 3172 * @version 0.0.3 (2011/02/28) 3173 * 3174 * ããã¹ãã«æåè©°ããé©ç¨ããUtilityã¯ã©ã¹ã 3175 * ã¤ã³ã¹ã¿ã³ã¹åããã«ãã¹ã¿ãã£ãã¯é¢æ°ã¨ãã¦ä½¿ç¨ããã 3176 * 3177 * @author Takayuki Fukatsu, artandmobile.com, fladdict.net 3178 * @requires jQuery 3179 */ 3180var FLAutoKerning = {}; 3181 3182 3183/* 3184 * ãã£ãã©ã«ãã®ã«ã¼ãã³ã°æ å ±ãæ ¼ç´ãã宿°ã 3185 * ã¦ã¼ã¶ã¼ãä»»æã®ã«ã¼ãã³ã°æ å ±ãé©ç¨ããªãå ´åã¯ããã®æ å ±ãåºæºã«ã«ã¼ãã³ã°ãè¨å®ãããã 3186 */ 3187FLAutoKerning.DEFAULT_KERNING_INFO = p; 3188FLAutoKerning.TPMIN_KERNING_INFO = tp; 3189FLAutoKerning.AXISB_KERNING_INFO = ax1; 3190FLAutoKerning.AKKO_KERNING_INFO = akk; 3191FLAutoKerning.SHINGOCONDB_KERNING_INFO = shingocondb; 3192/* 3193 * 渡ããã jQuery ãªãã¸ã§ã¯ãå ã®ããã¹ãã«ãåè©°ããé©ç¨ããã 3194 * åè©°ãã¯ã¹ã¿ã¤ã«ã·ã¼ãã®letter-spacingã«ãã£ã¦å®ç¾ãããã 3195 * 第2弿°ãæå®ãããã¨ã§ãã¦ã¼ã¶ã¼ç¬èªã®ã«ã¼ãã³ã°æ å ±ãé©ç¨ãããã¨ãå¯è½ã 3196 * 3197 * @param {jQuery} elements ããã¹ããå å ããhtmlè¦ç´ ã® jQuery ãªãã¸ã§ã¯ãã 3198 * @param {Array} kerningInfo ã«ã¼ãã³ã°ãã¢æ å ±ãæ ¼ç´ããé åãçç¥ããå ´åã¯ãFLAutoKerning.DEFAULT_KERNING_INFO ãé©ç¨ãããã 3199 */ 3200FLAutoKerning.process = function( elements, kerningInfo ) 3201{ 3202 if(kerningInfo==undefined) 3203 kerningInfo = FLAutoKerning.DEFAULT_KERNING_INFO; 3204 3205 elements.each( 3206 function(index, element){ 3207 var html = $(element).html(); 3208 var newHtml = ""; 3209 var n = html.length; 3210 for(var i=0; i<n; i++) 3211 { 3212 var char = html.substr(i,1); 3213 var char2 = char; 3214 var nextChar = html.substr(i+1,1); 3215 var space = 0; 3216 3217 if(kerningInfo[char+nextChar]){ 3218 //æç¤ºçãªã«ã¼ãã³ã°ãã¢ã®å¦ç 3219 space = kerningInfo[char+nextChar]; 3220 }else{ 3221 //æ±ç¨ã«ã¼ãã³ã°ãã¢ã®å¦ç 3222 if(kerningInfo[char+"*"] ) 3223 space += kerningInfo[char+"*"]; 3224 if(kerningInfo["*"+nextChar] ) 3225 space += kerningInfo["*"+nextChar]; 3226 } 3227 if(space!=0) 3228 char2 = "<span style='letter-spacing:" + space + "em'>" + char + "</span>"; 3229 3230 //è¡é ç´ç©ã®å¦ç 3231 if(i == 0 && kerningInfo[char]) 3232 char2 = "<span style='margin-left:" + kerningInfo[char] + "em'/>" + char2; 3233
3234 newHtml += char2; 3235 } 3236 $(element).html(newHtml); 3237 }); 3238} 3239 3240//tenpã®å¤æ°ãåé¤ 3241delete p; 3242 3243 3244 3245/*-------------------------------------------------- 3246* jquery.socialbutton-1.9.1 3247--------------------------------------------------*/ 3248/** 3249 * jquery.socialbutton - jQuery plugin for social networking websites 3250 * http://itra.jp/jquery_socialbutton_plugin/ 3251 * 3252 * Copyright 2010, Itrans, Inc. http://itra.jp/ 3253 * 3254 * Dual licensed under the MIT or GPL Version 2 licenses. 3255 * http://jquery.org/license 3256 * 3257 * Version: 1.9.1 3258 */ 3259 3260/** 3261 * SYNOPSIS 3262 * 3263 * 3264 * mixi_check 3265 * http://developer.mixi.co.jp/connect/mixi_plugin/mixi_check/spec_mixi_check 3266 * 3267 * $('#mixi_check').socialbutton('mixi_check', { 3268 * key: 'mixi-check-key' 3269 * }); 3270 * 3271 * $('#mixi_check').socialbutton('mixi_check', { 3272 * key: 'mixi-check-key', 3273 * button: 'button-1', 3274 * url: 'http://itra.jp/' 3275 * }); 3276 * 3277 * 3278 * mixi_like 3279 * http://developer.mixi.co.jp/connect/mixi_plugin/favorite_button/spec 3280 * 3281 * $('#mixi_like').socialbutton('mixi_like', { 3282 * key: 'mixi-check-key', 3283 * }); 3284 * 3285 * $('#mixi_like').socialbutton('mixi_like', { 3286 * key: 'mixi-check-key', 3287 * url: 'http://itra.jp/', 3288 * width: 450, 3289 * height: 80, 3290 * show_faces: true, 3291 * style: 'additional-style-here' 3292 * }); 3293 * 3294 * 3295 * facebook_like 3296 * http://developers.facebook.com/docs/reference/plugins/like 3297 * 3298 * $('#facebook_like').socialbutton('facebook_like'); 3299 * 3300 * $('#facebook_like').socialbutton('facebook_like', { 3301 * button: 'standard', // synonym 'layout' 3302 * url: 'http://itra.jp', 3303 * show_faces: true, 3304 * width: 450, 3305 * height: 80, 3306 * action: 'like', 3307 * locale: 'en_US', 3308 * font: 'arial', 3309 * colorscheme: 'light' 3310 * }); 3311 * 3312 * 3313 * facebook_share 3314 * http://developers.facebook.com/docs/share 3315 * 3316 * $('#facebook_share').socialbutton('facebook_share'); 3317 * 3318 * $('#facebook_share').socialbutton('facebook_share', { 3319 * button: 'button_count', // synonym 'type' 3320 * url: 'http://itra.jp', 3321 * text: 'Share' 3322 * }); 3323 * 3324 * 3325 * Twitter 3326 * http://twitter.com/goodies/tweetbutton 3327 * 3328 * $('#twitter').socialbutton('twitter'); 3329 * 3330 * $('#twitter').socialbutton('twitter', { 3331 * button: 'vertical', // synonym 'count' 3332 * url: 'http://itra.jp/', 3333 * text: 'tweet text', 3334 * lang: 'ja', 3335 * via: 'ishiiyoshinori', 3336 * related: 'twitter' 3337 * }); 3338 * 3339 * 3340 * GREE Social Feedback 3341 * http://developer.gree.co.jp/connect/plugins/sf 3342 * 3343 * $('#gree_sf').socialbutton('gree_sf'); 3344 * 3345 * $('#gree_sf').socialbutton('gree_sf', { 3346 * button: 0, // synonym 'type' 3347 * url: 'http://itra.jp/', 3348 * width: 0, // auto 3349 * height: 20 3350 * }); 3351 * 3352 * 3353 * Evernote Site Memory 3354 * http://www.evernote.com/about/developer/sitememory/ 3355 * 3356 * $('#evernote').socialbutton('evernote'); 3357 * 3358 * $('#evernote').socialbutton('evernote', { 3359 * button: 'article-clipper', 3360 * url: 'http://itra.jp/', 3361 * provider_name: 'itra.jp', 3362 * suggest_notebook: 'webclip', 3363 * content_id: 'element-id-to-clip', 3364 * code: 'your-affiliate-code', 3365 * title: 'note-title', 3366 * suggest_tags: 'comma-separated-tags,up-to-three-tags', 3367 * styling: 'full' 3368 * }); 3369 * 3370 * 3371 * Hatena Bookmark 3372 * http://b.hatena.ne.jp/ 3373 * 3374 * $('#hatena').socialbutton('hatena'); 3375 * 3376 * $('#hatena').socialbutton('hatena', { 3377 * button: 'standard', 3378 * url: 'http://itra.jp/', 3379 * title: 'page-title' 3380 * }); 3381 * 3382 * 3383 * Hatena Bookmark (Old Style) 3384 * http://b.hatena.ne.jp/ 3385 * 3386 * $('#hatena').socialbutton('hatena_oldstyle'); 3387 * 3388 * $('#hatena').socialbutton('hatena_oldstyle', { 3389 * button: '/path/to/your-icon.png', 3390 * url: 'http://itra.jp/', 3391 * padding: 10, 3392 * height: 15 3393 * }); 3394 * 3395 * 3396 * Google +1 Button 3397 * http://www.google.com/webmasters/+1/button/ 3398 * 3399 * $('#google').socialbutton('google_plusone'); 3400 * 3401 * $('#google').socialbutton('google_plusone', { 3402 * button: 'standard', // synonym 'size' 3403 * url: 'http://itra.jp', // synonym 'href' 3404 * lang: 'ja', 3405 * parsetags: 'explicit', 3406 * callback: 'some_callback_function', 3407 * count: true 3408 * }); 3409 * 3410 * 3411 * Pintarest Button 3412 * http://pinterest.com/about/goodies/ 3413 * 3414 * $('#pinterest').socialbutton('pintarest', { 3415 * button: 'horizontal', // or 'vertical', 'none' 3416 * url: 'http://itra.jp', 3417 * media: 'http://itra.jp/image.jpg', 3418 * description: 'This is an image.' 3419 * }); 3420 */ 3421 3422(function($) { 3423 3424$.fn.socialbutton = function(service, options) { 3425 3426 options = options || {}; 3427 3428 var defaults = { 3429 mixi_check: { 3430 key: '', 3431 button: 'button-1', // button-1,button-2,button-3,button-4,button-5 3432 url: '' // document.URL 3433 }, 3434 mixi_like: { 3435 key: '', 3436 url: document.URL, 3437 width: 0, // auto 3438 height: 0, // auto 3439 show_faces: true, 3440 style: '', 3441 3442 sizes: { 3443 width: { 3444 with_faces: 450, 3445 without_faces: 140 3446 }, 3447 height: { 3448 with_faces_minimum: 80, 3449 without_faces_minimum: 20 3450 } 3451 } 3452 }, 3453 facebook_like: { 3454 button: 'standard', // standard / button_count / box_count 3455 url: document.URL, 3456 3457 show_faces: true, 3458 width: 0, // auto 3459 height: 0, // auto 3460 3461 width_standard_default: 450, // orig: 450 3462 width_standard_minimum: 225, 3463 height_standard_without_photo: 35, 3464 height_standard_with_photo: 80, 3465 3466 width_button_count_default: 120, // orig: 90, jp_min: 114 3467 width_button_count_minimum: 90, 3468 height_button_count: 25, // orig:20, jp_min: 21 3469 3470 width_button_default: 70, // orig: 90, jp_min: 114 3471 width_button_minimum: 47, 3472 height_button: 25, // orig:20, jp_min: 21 3473 3474 width_box_count_default: 80, // orig:55, jp_min: 75 3475 width_box_count_minimum: 55, 3476 height_box_count: 70, // orig: 65, jp_min: 66 3477 3478 action: 'like', // like / recommend 3479 locale: '', // auto 3480 font: '', 3481 colorscheme: 'light' // light / dark 3482 }, 3483 facebook_share: { 3484 button: 'button_count', // box_count / button / icon_link / icon 3485 url: '', //document.URL 3486 text: '' //Share 3487 }, 3488 twitter: { 3489 button: 'vertical', // vertical / horizontal / none 3490 url: '', // document.URL 3491 text: '', 3492 lang: 'ja', // ja / en /de / fr / es 3493 via: '', 3494 related: '' 3495 }, 3496 gree_sf: { 3497 button: 0, // 0,1,2,3,4 3498 url: document.URL, 3499 width: 0, // auto 3500 height: 20, 3501 3502 widths: { 3503 type0_16: 58, type0_20: 70, type0_23: 76, 3504 type1_16: 58, type1_20: 73, type1_23: 78, 3505 type2_16: 58, type2_20: 73, type2_23: 78, 3506 type3_16: 49, type3_20: 61, type3_23: 64, 3507 type4_16: 16, type4_22: 21, type4_32: 32 3508 } 3509 }, 3510 evernote: { 3511 button: 'article-clipper', // article-clipper, article-clipper-remember, article-clipper-jp, article-clipper-rus, article-clipper-fr, article-clipper-es, article-clipper-de, article-clipper-vert, site-mem-32, site-mem-36, site-mem-22, site-mem-16 3512 url: '', // document.URL 3513 provider_name: '', // domain name
3514 suggest_notebook: '', // notebook name 3515 content_id: '', // element id for clip 3516 code: '', // affiliate code 3517 title: '', 3518 suggest_tags: '', 3519 styling: '' // none(text-only), full 3520 }, 3521 hatena: { 3522 button: 'standard', // standard, vertical, simple 3523 url: document.URL, 3524 title: document.title 3525 }, 3526 hatena_oldstyle: { 3527 button: 'http://d.hatena.ne.jp/images/b_append.gif', 3528 url: document.URL, 3529 height: 13, 3530 padding: 7 3531 }, 3532 google_plusone: { 3533 button: '', // small, standard, medium, tall 3534 url: '', 3535 lang: '', // en-US 3536 parsetags: '', // none(onload), explicit 3537 callback: '', 3538 count: true // true, false 3539 }, 3540 pinterest: { 3541 button: 'horizontal', // horizontal, vertical, none 3542 url: document.URL, 3543 media: '', 3544 description: '' 3545 } 3546 }; 3547 3548 var max_index = this.size() - 1; 3549 3550 return this.each(function(index) { 3551 3552 switch (service) { 3553 case 'mixi_check': 3554 socialbutton_mixi_check(this, options, defaults.mixi_check, index, max_index); 3555 break; 3556 3557 case 'mixi_like': 3558 socialbutton_mixi_like(this, options, defaults.mixi_like, index, max_index); 3559 break; 3560 3561 case 'facebook_like': 3562 socialbutton_facebook_like(this, options, defaults.facebook_like, index, max_index); 3563 break; 3564 3565 case 'facebook_share': 3566 socialbutton_facebook_share(this, options, defaults.facebook_share, index, max_index); 3567 break; 3568 3569 case 'twitter': 3570 socialbutton_twitter(this, options, defaults.twitter, index, max_index); 3571 break; 3572 3573 case 'gree_sf': 3574 socialbutton_gree_sf(this, options, defaults.gree_sf, index, max_index); 3575 break; 3576 3577 case 'evernote': 3578 socialbutton_evernote(this, options, defaults.evernote, index, max_index); 3579 break; 3580 3581 case 'hatena': 3582 socialbutton_hatena(this, options, defaults.hatena, index, max_index); 3583 break; 3584 3585 case 'hatena_oldstyle': 3586 socialbutton_hatena_oldstyle(this, options, defaults.hatena_oldstyle, index, max_index); 3587 break; 3588 3589 case 'google_plusone': 3590 socialbutton_google_plusone(this, options, defaults.google_plusone, index, max_index); 3591 break; 3592 3593 case 'pinterest': 3594 socialbutton_pinterest(this, options, defaults.pinterest, index, max_index); 3595 break; 3596 3597 default: 3598 break; 3599 } 3600 3601 return true; 3602 }); 3603} 3604 3605function socialbutton_mixi_check(target, options, defaults, index, max_index) 3606{ 3607 var key = options.key || defaults.key; 3608 var button = options.button || defaults.button; 3609 var url = options.url || defaults.url; 3610 3611 if (key == '') { 3612 return; 3613 } 3614 3615 var attr = merge_attributes({ 3616 'data-key': key, 3617 'data-url': htmlspecialchars(url), 3618 'data-button': button 3619 }); 3620 3621 var tag = '<a href="http://mixi.jp/share.pl" class="mixi-check-button"' + attr + '>Check</a>'; 3622 3623 $(target).html(tag); 3624 3625 if (index == max_index) { 3626 $('body').append('<script type="text/javascript" src="http://static.mixi.jp/js/share.js"></script>'); 3627 } 3628} 3629 3630function socialbutton_mixi_like(target, options, defaults, index, max_index) 3631{ 3632 var key = options.key || defaults.key; 3633 var url = options.url || defaults.url; 3634 var width = options.width != undefined ? options.width : defaults.width; 3635 var height = options.height != undefined ? options.height : defaults.height; 3636 var show_faces = options.show_faces != undefined ? options.show_faces : defaults.show_faces; 3637 var style = options.style || defaults.style; 3638 3639 if (key == '') { 3640 return; 3641 } 3642 3643 if (options.url) { 3644 url = decodeURIComponent(url); 3645 } 3646 url = url_encode_rfc3986(url); 3647 3648 if (width == 0) { 3649 width = show_faces ? defaults.sizes.width.with_faces : defaults.sizes.width.without_faces; 3650 } 3651 3652 if (height == 0) { 3653 height = show_faces ? defaults.sizes.height.with_faces_minimum : defaults.sizes.height.without_faces_minimum; 3654 } else { 3655 if (show_faces && height < defaults.sizes.height.with_faces_minimum) { 3656 height = defaults.sizes.height.with_faces_minimum; 3657 } else if (!show_faces && height < defaults.sizes.height.without_faces_minimum) { 3658 height = defaults.sizes.height.without_faces_minimum; 3659 } 3660 } 3661 3662 var params = merge_parameters({ 3663 'href': url, 3664 'service_key': key, 3665 'width': width, 3666 'show_faces': show_faces ? 'true' : 'false' 3667 }); 3668 3669 var attr = merge_attributes({ 3670 src: 'http://plugins.mixi.jp/favorite.pl?' + params, 3671 scrolling: 'no', 3672 frameborder: '0', 3673 allowTransparency: 'true', 3674 style: 'border:0; overflow:hidden; width:' + width + 'px; height:' + height + 'px; ' + style 3675 }); 3676 3677 var tag = '<iframe' + attr + '></iframe>'; 3678 3679 $(target).html(tag); 3680} 3681 3682function socialbutton_facebook_like(target, options, defaults, index, max_index) 3683{ 3684 var layout = options.layout || options.button || defaults.button; 3685 var url = options.url || defaults.url; 3686 3687 var show_faces = options.show_faces != undefined ? options.show_faces : defaults.show_faces; 3688 var width = options.width != undefined ? options.width : defaults.width; 3689 var height = options.height != undefined ? options.height : defaults.height; 3690 var action = options.action || defaults.action; 3691 var locale = options.locale || defaults.locale; 3692 var font = options.font || defaults.font; 3693 var colorscheme = options.colorscheme || defaults.colorscheme; 3694 3695 if (options.url) { 3696 url = decodeURIComponent(url); 3697 } 3698 url = url_encode_rfc3986(url); 3699 3700 switch (layout) { 3701 case 'standard': 3702 if (width == 0) { 3703 width = defaults.width_standard_default; 3704 } else if (width < defaults.width_standard_minimum) { 3705 width = defaults.width_standard_minimum; 3706 } 3707 if (height == 0) { 3708 height = show_faces ? defaults.height_standard_with_photo : defaults.height_standard_without_photo; 3709 } else if (height < defaults.height_standard_without_photo) { 3710 height = defaults.height_standard_without_photo; 3711 } 3712 break; 3713 case 'button_count': 3714 if (width == 0) { 3715 width = defaults.width_button_count_default; 3716 } else if (width < defaults.width_button_count_minimum) { 3717 width = defaults.width_button_count_minimum; 3718 } 3719 if (height == 0) { 3720 height = defaults.height_button_count; 3721 } else if (height < defaults.height_button_count) { 3722 height = defaults.height_button_count; 3723 } 3724 break; 3725 case 'button': 3726 if (width == 0) { 3727 width = defaults.width_button_default; 3728 } else if (width < defaults.width_button_minimum) { 3729 width = defaults.width_button_minimum; 3730 } 3731 if (height == 0) { 3732 height = defaults.height_button; 3733 } else if (height < defaults.height_button) { 3734 height = defaults.height_button; 3735 } 3736 break; 3737 case 'box_count': 3738 if (width == 0) { 3739 width = defaults.width_box_count_default; 3740 } else if (width < defaults.width_box_count_minimum) { 3741 width = defaults.width_box_count_minimum; 3742 } 3743 if (height == 0) { 3744 height = defaults.height_box_count; 3745 } else if (height < defaults.height_box_count) { 3746 height = defaults.height_box_count; 3747 } 3748 break; 3749 } 3750 3751 var params = merge_parameters({ 3752 'href': url, 3753 'layout': layout, 3754 'show_faces': show_faces ? 'true' : 'false', 3755 'width': width, 3756 'action': action, 3757 'locale': locale, 3758 'font': font, 3759 'colorscheme': colorscheme, 3760 'height': height 3761 /* 'share':'true' */ 3762 }); 3763 3764 var tag = '<iframe src="http://www.facebook.com/plugins/like.php?' + params + '" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:' + width + 'px; height:' + height + 'px;" allowTransparency="true"></iframe>'; 3765 3766 $(target).html(tag); 3767} 3768 3769function socialbutton_facebook_share(target, options, defaults, index, max_index) 3770{ 3771 var type = options.type || options.button || defaults.button; 3772 var url = options.url || defaults.url; 3773 var text = options.text || defaults.text; 3774 3775 var attr = merge_attributes({ 3776 'type': type, 3777 'share_url': htmlspecialchars(url) 3778 }); 3779 3780 var tag = '<a name="fb_share"' + attr + '>
3780' + text + '</a>'; 3781 3782 if(index == 0) { 3783 tag += '<script type="text/javascript" src="http://static.ak.fbcdn.net/connect.php/js/FB.Share"></script>'; 3784 } 3785 3786 $(target).html(tag); 3787} 3788 3789function socialbutton_twitter(target, options, defaults, index, max_index) 3790{ 3791 var count = options.count || options.button || defaults.button; 3792 var url = options.url || defaults.url; 3793 3794 var text = options.text || defaults.text; 3795 var lang = options.lang || defaults.lang; 3796 var via = options.via || defaults.via; 3797 var related = options.related || defaults.related; 3798 3799 var attr = merge_attributes({ 3800 'data-count': count, 3801 'data-url': htmlspecialchars(url), 3802 'data-text': text, 3803 'data-lang': lang, 3804 'data-via': via, 3805 'data-related': related 3806 }); 3807 3808 var tag = '<a href="http://twitter.com/share" class="twitter-share-button"' + attr + '>Tweet</a>'; 3809 3810 $(target).html(tag); 3811 3812 if (index == max_index) { 3813 $('body').append('<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>'); 3814 } 3815} 3816 3817function socialbutton_gree_sf(target, options, defaults, index, max_index) 3818{ 3819 var type = options.type || options.button || defaults.button; 3820 var url = options.url || defaults.url; 3821 3822 var width = options.width != undefined ? options.width : defaults.width; 3823 var height = options.height != undefined ? options.height : defaults.height; 3824 3825 if (options.url) { 3826 url = decodeURIComponent(url); 3827 } 3828 url = url_encode_rfc3986(url); 3829 3830 switch (type) { 3831 case 0: 3832 case 1: 3833 case 2: 3834 case 3: 3835 if (height != 16 && height != 20 && height != 23) { 3836 height = 20; 3837 } 3838 break; 3839 3840 case 4: 3841 if (height != 16 && height != 22 && height != 32) { 3842 height = 22; 3843 } 3844 break; 3845 3846 default: 3847 type = 0; 3848 width = 0; 3849 height = 20; 3850 break; 3851 } 3852 3853 if (width == 0) { 3854 width = defaults.widths['type' + type + '_' + height]; 3855 } 3856 3857 var params = merge_parameters({ 3858 'url': url, 3859 'type': String(type), 3860 'height': height 3861 }); 3862 3863 var tag = '<iframe src="http://share.gree.jp/share?' + params + '" scrolling="no" frameborder="0" marginwidth="0" marginheight="0" style="border:none; overflow:hidden; width:' + width + 'px; height:' + height + 'px;" allowTransparency="true"></iframe>'; 3864 3865 $(target).html(tag); 3866} 3867 3868function socialbutton_evernote(target, options, defaults, index, max_index) 3869{ 3870 var button = options.button || defaults.button; 3871 var url = options.url || defaults.url; 3872 3873 var provider_name = options.provider_name || defaults.provider_name; 3874 var suggest_notebook = options.suggest_notebook || defaults.suggest_notebook; 3875 var content_id = options.content_id || defaults.content_id; 3876 var code = options.code || defaults.code; 3877 var title = options.title || defaults.title; 3878 var suggest_tags = options.suggest_tags || defaults.suggest_tags; 3879 var styling = options.styling || defaults.styling; 3880 3881 if (button == 'article-clipper' || 3882 button == 'article-clipper-remember' || 3883 button == 'article-clipper-jp' || 3884 button == 'article-clipper-rus' || 3885 button == 'article-clipper-fr' || 3886 button == 'article-clipper-es' || 3887 button == 'article-clipper-de' || 3888 button == 'article-clipper-vert' || 3889 button == 'site-mem-32' || 3890 button == 'site-mem-36' || 3891 button == 'site-mem-22' || 3892 button == 'site-mem-16' 3893 ) { 3894 button = 'http://static.evernote.com/' + button + '.png'; 3895 } 3896 3897 var clipoptions = { 3898 'url': url, 3899 'providerName': provider_name, 3900 'suggestNotebook': suggest_notebook, 3901 'contentId': content_id, 3902 'code': code, 3903 'title': title, 3904 'suggestTags': suggest_tags, 3905 'styling': styling 3906 }; 3907 3908 if (index == 0) { 3909 $('body').append('<script type="text/javascript" src="http://static.evernote.com/noteit.js"></script>'); 3910 } 3911 3912 var tag = $(document.createElement('a')) 3913 .attr({href: '#'}) 3914 .click(function(){ 3915 if (Evernote) { 3916 Evernote.doClip(clipoptions); 3917 } 3918 return false; 3919 }) 3920 .append('<img src="' + button + '" alt="Clip to Evernote" style="border: none" />'); 3921 3922 $(target).html(tag); 3923} 3924 3925function socialbutton_hatena(target, options, defaults, index, max_index) 3926{ 3927 var layout = options.layout || options.button || defaults.button; 3928 var url = options.url || defaults.url; 3929 var title = options.title || defaults.title; 3930 3931 url = htmlspecialchars(url); 3932 title = htmlspecialchars(title); 3933 3934 var attr = merge_attributes({ 3935 'href': 'http://b.hatena.ne.jp/entry/' + url, 3936 'class': 'hatena-bookmark-button', 3937 'data-hatena-bookmark-title': title, 3938 'data-hatena-bookmark-layout': layout, 3939 'title': 'ãã®ã¨ã³ããªã¼ãã¯ã¦ãªããã¯ãã¼ã¯ã«è¿½å ' 3940 }); 3941 3942 var tag = '<a' + attr + '><img src="http://b.st-hatena.com/images/entry-button/button-only.gif" alt="ãã®ã¨ã³ããªã¼ãã¯ã¦ãªããã¯ãã¼ã¯ã«è¿½å " width="20" height="20" style="border: none;" /></a>' 3943 + '<script type="text/javascript" src="http://b.st-hatena.com/js/bookmark_button.js" charset="utf-8" async="async"></script>'; 3944 3945 $(target).html(tag); 3946} 3947 3948function socialbutton_hatena_oldstyle(target, options, defaults, index, max_index) 3949{ 3950 var button = options.button || defaults.button; 3951 var url = options.url || defaults.url; 3952 3953 var height = options.height != undefined ? options.height : defaults.height; 3954 var padding = options.padding != undefined ? options.padding : defaults.padding; 3955 3956 url = htmlspecialchars(url); 3957 3958 var tag = '<span style="font-size: ' + height + 'px; line-height: 100%; ">' 3959 + '<span style="padding-right: ' + padding + 'px"><a href="http://b.hatena.ne.jp/entry/add/' + url + '" target="_blank"><img src="' + button + '" style="border: none; vertical-align: text-bottom" /></a></span>' 3960 + '<a href="http://b.hatena.ne.jp/entry/' + url + '" target="_blank"><img src="http://b.hatena.ne.jp/entry/image/' + url + '" style="border: none; vertical-align: text-bottom" /></a>' 3961 + '</span>'; 3962 3963 $(target).html(tag); 3964} 3965 3966function socialbutton_google_plusone(target, options, defaults, index, max_index) 3967{ 3968 if (!$.support.tbody) { 3969 return; 3970 } 3971 3972 var size = options.size || options.button || defaults.button; 3973 var href = options.href || options.url || defaults.url; 3974 3975 var lang = options.lang || defaults.lang; 3976 var parsetags = options.parsetags || defaults.parsetags; 3977 3978 var callback = options.callback || defaults.callback; 3979 var count = options.count != undefined ? options.count : defaults.count; 3980 3981 switch (size) { 3982 case 'small': 3983 case 'standard': 3984 case 'medium': 3985 break; 3986 3987 case 'tall': 3988 count = true; 3989 break; 3990 3991 default: 3992 size = 'standard'; 3993 count = true; 3994 } 3995 3996 var tag = $('<div>') 3997 .attr({ 3998 'data-callback': callback, 3999 'data-count': count ? 'true' : 'false', 4000 'data-href': href, 4001 'data-size': size 4002 }).addClass('g-plusone'); 4003 $(target).append(tag); 4004 4005 if (index == max_index) { 4006 4007 var script_params = ''; 4008 4009 if (lang != '') { 4010 script_params += 'lang: "' + htmlspecialchars(lang) + '"'; 4011 } 4012 if (parsetags != '') { 4013 script_params += script_params != '' ? ',' : ''; 4014 script_params += 'parsetags: "' + htmlspecialchars(parsetags) + "'"; 4015 } 4016 if (script_params != '') { 4017 script_params = '{' + script_params + '}'; 4018 } 4019 4020 if (typeof gapi === 'undefined' || typeof gapi.plusone === 'undefined') { 4021 $('body').append('<script type="text/javascript" src="https://apis.google.com/js/plusone.js">' + script_params + '</script>'); 4022 } else { 4023 gapi.plusone.go(); 4024 } 4025 } 4026} 4027 4028function socialbutton_pinterest(target, options, defaults, index, max_index) 4029{ 4030 var url = options.url || defaults.url; 4031 var button = options.button || defaults.button; 4032 var media = options.media != undefined ? options.media : defaults.media; 4033 var description = options.description != undefined ? options.description : defaults.description; 4034 4035 url = url_encode_rfc3986(decodeURIComponent(url)); 4036 media = url_encode_rfc3986(decodeURIComponent(media)); 4037 description = decodeURIComponent(description); 4038 4039 var params = merge_parameters({ 4040 'url': url, 4041 'media': media, 4042 'description': description 4043 }); 4044 4045 var tag = '<a href="http://pinterest.com/pin/create/button/?' + params + '" class="pin-it-button" count-layout="' + button +'"><img border="0" src="//assets.pinterest.com/images/PinExt.png" title="Pin It" /></a>' 4046 4047 $(target).html(tag); 4048 4049 if (index == max_index) { 4050 $('body').append('<script type="text/javascript" src="//assets.pinterest.com/js/pinit.js"></script>'); 4051 } 4052} 4053 4054function merge_attributes(attr) 4055{ 4056 var merged = ''; 4057 4058 for (var i in attr) { 4059 if (attr[i] == '') { 4060 continue; 4061 } 4062 merged += ' ' + i + '="' + attr[i] + '"'; 4063 } 4064 4065 return merged; 4066} 4067 4068function merge_parameters(params) 4069{ 4070 var merged = ''; 4071 4072 for (var i in params) { 4073 if (params[i] == '') { 4074 continue; 4075 } 4076 merged += merged != '' ? '&' : ''; 4077 merged += i + '=' + params[i] + ''; 4078 } 4079 4080 return merged; 4081} 4082 4083function htmlspecialchars(string) 4084{ 4085 var table = [ 4086 [/&/g, '&'], 4087 [/</g, '<'], 4088 [/>/g, '>'], 4089 [/"/g, '"'], 4090 [/'/g, '''] 4091 ]; 4092 4093 for (var i in table) { 4094 string = string.replace(table[i][0], table[i][1]); 4095 } 4096 4097 return string; 4098} 4099 4100function url_encode_rfc3986(url) 4101{ 4102 return encodeURIComponent(url).replace(/[!*'()]/g, function(p) { 4103 return "%" + p.charCodeAt(0).toString(16); 4104 }); 4105} 4106 4107})(jQuery); 4108 4109
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.