| @@ -0,0 +1,2 @@ | ||
| !.gitignore | ||
|
|
| @@ -0,0 +1,231 @@ | ||
| /* | ||
| Copyright 2011 Ivan Malopinsky. All rights reserved. | ||
| Redistribution and use in source and binary forms, with or without modification, are | ||
| permitted provided that the following conditions are met: | ||
| 1. Redistributions of source code must retain the above copyright notice, this list of | ||
| conditions and the following disclaimer. | ||
| 2. Redistributions in binary form must reproduce the above copyright notice, this list | ||
| of conditions and the following disclaimer in the documentation and/or other materials | ||
| provided with the distribution. | ||
| THIS SOFTWARE IS PROVIDED BY Ivan Malopinsky ''AS IS'' AND ANY EXPRESS OR IMPLIED | ||
| WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | ||
| FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Ivan Malopinsky OR | ||
| CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
| CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
| ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
| NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | ||
| ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| The views and conclusions contained in the software and documentation are those of the | ||
| authors and should not be interpreted as representing official policies, either expressed | ||
| or implied, of Ivan Malopinsky.*/ | ||
|
|
||
| var cssFx = cssFx || {}; | ||
| (function (fx) { | ||
| //ded's domready | ||
| !function(a,b){function m(a){l=1;while(a=c.shift())a()}var c=[],d,e,f=!1,g=b.documentElement,h=g.doScroll,i="DOMContentLoaded",j="addEventListener",k="onreadystatechange",l=/^loade|c/.test(b.readyState);b[j]&&b[j](i,e=function(){b.removeEventListener(i,e,f),m()},f),h&&b.attachEvent(k,d=function(){/^c/.test(b.readyState)&&(b.detachEvent(k,d),m())}),a.domReady=h?function(a){self!=top?l?a():c.push(a):function(){try{g.doScroll("left")}catch(b){return setTimeout(function(){domReady(a)},50)}a()}()}:function(a){l?a():c.push(a)}}(this,document) | ||
|
|
||
| function sjax(a){if(AJAX=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP")){AJAX.open("GET",a,false);AJAX.send(null);return AJAX.responseText}else return false} | ||
|
|
||
| function str_trim(a){return a.replace(/\n/gm,"").replace(/^\s\s*/,"").replace(/\s\s*$/,"")} | ||
|
|
||
| function strip_css_comments(a){return a.replace(/\/\*([\s\S]*?)\*\//gim,"")} | ||
|
|
||
| function rgb2hex(a,b,c){return((256+a<<8|b)<<8|c).toString(16).slice(1)} | ||
|
|
||
| if(!Array.indexOf)Array.prototype.indexOf=function(c,b){for(var a=b||0;a<this.length;a++)if(this[a]==c)return a;return-1}; | ||
|
|
||
| //cssFx-specific data | ||
|
|
||
| var prefix = ["-moz-", "-webkit-", "-o-", "-ms-"]; | ||
|
|
||
| var prefixes01 = ["background-origin", "background-size", "border-image", "border-image-outset", "border-image-repeat", "border-image-source", "border-image-width", "border-radius", "box-shadow", "column-count", "column-gap", "column-rule", "column-rule-color", "column-rule-style", "column-rule-width", "column-width"]; | ||
| var prefixes013 = ["box-flex","box-orient","box-align","box-ordinal-group","box-flex-group","box-pack","box-direction","box-lines","box-sizing"]; | ||
| var prefixes0123 = ["transform","transform-origin","transition","transition-property","transition-duration","transition-timing-function","transition-delay","user-select"]; | ||
|
|
||
| var supported_rules = ["border-bottom-left-radius", "border-bottom-right-radius", "border-top-left-radius", "border-top-right-radius", "display", "opacity", "text-overflow", "background-clip", "background-image", "background"].concat(prefixes0123).concat(prefixes01).concat(prefixes013); | ||
| fx.processCSS = function (css_files) { | ||
| var css_fx_output = []; | ||
| var css_regex = /([\s\S]*?)\{([\s\S]*?)\}/gim; | ||
| var import_regex = /\@import\s+(?:url\([\'\"]|[\'\"])([\w\s\-\_\.\:\/\;\:]+)/gim; | ||
| for (var x in css_files) { | ||
| var css = css_files[x]; | ||
| if (typeof css === "string") { | ||
| var rules = []; | ||
| var matches = css_regex.test(css) && css.match(css_regex); | ||
| var imports = import_regex.test(css) && css.match(import_regex); | ||
| import_regex.lastIndex = 0; | ||
| css_regex.lastIndex = 0; | ||
| if (imports.length > 0) { | ||
| for (var y = 0; y < import_match_count; y++) { | ||
| css_files.push(fx.fetchCSS([import_regex.exec(css.match(import_regex)[y])[1]], true)); | ||
| } | ||
| } | ||
| for (var x in matches) { | ||
| var nextMatch = css_regex.exec(matches[x]); | ||
| if (nextMatch !== null) { | ||
| var selector = str_trim(strip_css_comments(nextMatch[1])); | ||
| var rule = str_trim(strip_css_comments(nextMatch[2])).replace(/\s{2,}|\t/gm, " "); | ||
| for (var z in supported_rules) { | ||
| if (rule.indexOf(supported_rules[z]) !== -1) { | ||
| if (converted_rule = fx.processElement(selector, rule)) { | ||
| rules.push(converted_rule); | ||
| } | ||
| break; | ||
| } | ||
| } | ||
| } | ||
| css_regex.lastIndex = 0; | ||
| } | ||
| if (rules.length > 0) { | ||
| css_fx_output.push(rules.join("\n")); | ||
| } | ||
| } | ||
| } | ||
| return css_fx_output; | ||
| } | ||
| fx.insertCSS = function (output) { | ||
| for (var x in output) { | ||
| if (typeof output[x] === "string") { | ||
| var css_fx_output = document.createElement('style'); | ||
| css_fx_output.setAttribute('type', 'text/css'); | ||
| if (css_fx_output.styleSheet) { | ||
| //Internet Explorer | ||
| css_fx_output.styleSheet.cssText = output[x]; | ||
| } else { | ||
| //Everyone else | ||
| css_fx_output.textContent = output[x]; | ||
| } | ||
| document.getElementsByTagName("head")[0].appendChild(css_fx_output); | ||
| } | ||
| } | ||
| } | ||
| fx.processElement = function (e, rule) { | ||
| var css_array = rule.split(";"), | ||
| rules = []; | ||
| for (var r in css_array) { | ||
| if (typeof css_array[r] === "string" && css_array[r].indexOf(":") !== -1) { | ||
| var rule = css_array[r].split(":"); | ||
| rule[0] = str_trim(rule[0]); | ||
| rule[1] = str_trim(rule[1]); | ||
| var new_rules = []; | ||
| var clean_rule = rule.join(":"); | ||
| if (prefixes01.indexOf(rule[0]) !== -1) { | ||
| new_rules.push(prefix[0] + clean_rule); | ||
| new_rules.push(prefix[1] + clean_rule); | ||
| } else if (prefixes013.indexOf(rule[0]) !== -1) { | ||
| //-moz, -webkit, -ms | ||
| new_rules.push(prefix[0] + clean_rule); | ||
| new_rules.push(prefix[1] + clean_rule); | ||
| if (rule[0] === "box-align") { | ||
| new_rules.push(prefix[3] + rule[0] + ":middle"); | ||
| } else { | ||
| new_rules.push(prefix[3] + clean_rule); | ||
| } | ||
| } else if (prefixes0123.indexOf(rule[0]) !== -1) { | ||
| //-moz, -webkit, -o, -ms | ||
| new_rules.push(prefix[0] + clean_rule); | ||
| new_rules.push(prefix[1] + clean_rule); | ||
| new_rules.push(prefix[2] + clean_rule); | ||
| new_rules.push(prefix[3] + clean_rule); | ||
| } else { | ||
| switch (rule[0]) { | ||
| case "border-top-left-radius": | ||
| case "border-top-right-radius": | ||
| case "border-bottom-left-radius": | ||
| case "border-bottom-right-radius": | ||
| var v = rule[0].split("-"); | ||
| new_rules.push(prefix[0] + "border-radius-" + v[1] + v[2] + ":" + rule[1]); | ||
| new_rules.push(prefix[1] + clean_rule); | ||
| break; | ||
| case "display": | ||
| if (rule[1] === "box") { | ||
| new_rules.push("display:" + prefix[0] + rule[1]); | ||
| new_rules.push("display:" + prefix[1] + rule[1]); | ||
| new_rules.push("display:" + prefix[3] + rule[1]); | ||
| } else if (rule[1] === "inline-block") { | ||
| new_rules.push("display:" + prefix[0] + "inline-stack"); | ||
| new_rules.push("zoom:1;*display:inline"); | ||
| } | ||
| break; | ||
| case "text-overflow": | ||
| if (rule[1] === "ellipsis") { | ||
| new_rules.push(prefix[2] + clean_rule); | ||
| } | ||
| break; | ||
| case "opacity": | ||
| var opacity = parseInt(parseFloat(rule[1]) * 100); | ||
| new_rules.push(prefix[3] + "filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=" + opacity + ")"); | ||
| new_rules.push("filter: alpha(opacity=" + opacity + ")"); | ||
| new_rules.push(prefix[0] + clean_rule); | ||
| new_rules.push(prefix[1] + clean_rule); | ||
| break; | ||
| case "background-clip": | ||
| if (rule[1] === "padding-box") { | ||
| new_rules.push(prefix[1] + clean_rule); | ||
| new_rules.push(prefix[0] + rule[0] + ":padding"); | ||
| } | ||
| break; | ||
| case "background-image": | ||
| case "background-color": | ||
| case "background": | ||
| var lg = "linear-gradient"; | ||
| if (rule[1].indexOf(lg) !== -1) { | ||
| var attributes = rule[1].substr(lg.length); | ||
| if (rule[0] === "background-image") { | ||
| attributes = rule[1].substr(lg.length).match(/\((.*)\)/)[0]; | ||
| } | ||
| var prop = lg + attributes; | ||
| new_rules.push(rule[0] + ":" + prefix[0] + prop); | ||
| //new_rules.push(rule[0] + ":" + prefix[1] + "gradient" + prop); Old webkit, needs to be rewritten | ||
| new_rules.push(rule[0] + ":" + prefix[1] + prop); | ||
| new_rules.push(rule[0] + ":" + prefix[2] + prop); | ||
| new_rules.push(rule[0] + ":" + prefix[3] + prop); | ||
| } else if (rule[1].indexOf("rgba") !== -1) { | ||
| //Color array | ||
| var cA = rule[1].match(/rgba\((.*?)\)/)[1].split(","); | ||
| var hex = Math.floor(+(str_trim(cA[3])) * 255).toString(16) + rgb2hex(+str_trim(cA[0]), +str_trim(cA[1]), +str_trim(cA[2])); | ||
| new_rules.push("filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#" + hex + ",endColorstr=#" + hex + ");zoom:1"); | ||
| } | ||
| break; | ||
| } | ||
| } | ||
| if (new_rules.length > 0) { | ||
| rules.push(new_rules.join(";")); | ||
| } | ||
| } | ||
| } | ||
| return (rules.length > 0 ? e + "{" + rules.join(";") + "}" : false); | ||
| } | ||
| fx.fetchCSS = function (files, single) { | ||
| var css_files = []; | ||
| for (var x in files) { | ||
| typeof (files[x]) === "string" && css_files.push(sjax(files[x])); | ||
| } | ||
| return single === undefined ? css_files : css_files[0]; | ||
| } | ||
| domReady(function () { | ||
| var style_els = document.getElementsByTagName("style"); | ||
| var link_els = document.getElementsByTagName("link"); | ||
| var link_hrefs = []; | ||
| //Processing external stylesheets | ||
| for (var x in link_els) { | ||
| if (typeof (link_els[x]) === "object" && link_els[x].className === "cssfx") { | ||
| link_hrefs.push(link_els[x].href); | ||
| } | ||
| } | ||
| var css_files = fx.fetchCSS(link_hrefs); | ||
| //Processing in-page stylesheets | ||
| for (var x in style_els) { | ||
| if (typeof (style_els[x]) === "object") { | ||
| css_files.push(style_els[x].innerHTML); | ||
| } | ||
| } | ||
| fx.insertCSS(fx.processCSS(css_files)); | ||
| }) | ||
| })(cssFx); |
| @@ -0,0 +1,67 @@ | ||
| /* | ||
| * Easy Tooltip 1.0 - jQuery plugin | ||
| * written by Alen Grakalic | ||
| * http://cssglobe.com/post/4380/easy-tooltip--jquery-plugin | ||
| * | ||
| * Copyright (c) 2009 Alen Grakalic (http://cssglobe.com) | ||
| * Dual licensed under the MIT (MIT-LICENSE.txt) | ||
| * and GPL (GPL-LICENSE.txt) licenses. | ||
| * | ||
| * Built for jQuery library | ||
| * http://jquery.com | ||
| * | ||
| */ | ||
|
|
||
| (function($) { | ||
|
|
||
| $.fn.easyTooltip = function(options){ | ||
|
|
||
| // default configuration properties | ||
| var defaults = { | ||
| xOffset: 10, | ||
| yOffset: 25, | ||
| tooltipId: "easyTooltip", | ||
| clickRemove: false, | ||
| content: "", | ||
| useElement: "" | ||
| }; | ||
|
|
||
| var options = $.extend(defaults, options); | ||
| var content; | ||
|
|
||
| this.each(function() { | ||
| var title = $(this).attr("title"); | ||
| $(this).hover(function(e){ | ||
| content = (options.content != "") ? options.content : title; | ||
| content = (options.useElement != "") ? $("#" + options.useElement).html() : content; | ||
| $(this).attr("title",""); | ||
| if (content != "" && content != undefined){ | ||
| $("body").append("<div class='"+ options.tooltipId +"'>"+ content +"</div>"); | ||
| $("#" + options.tooltipId) | ||
| .css("position","absolute") | ||
| .css("top",(e.pageY - options.yOffset) + "px") | ||
| .css("left",(e.pageX + options.xOffset) + "px") | ||
| .css("display","none") | ||
| .fadeIn("fast") | ||
| } | ||
| }, | ||
| function(){ | ||
| $("#" + options.tooltipId).remove(); | ||
| $(this).attr("title",title); | ||
| }); | ||
| $(this).mousemove(function(e){ | ||
| $("#" + options.tooltipId) | ||
| .css("top",(e.pageY - options.yOffset) + "px") | ||
| .css("left",(e.pageX + options.xOffset) + "px") | ||
| }); | ||
| if(options.clickRemove){ | ||
| $(this).mousedown(function(e){ | ||
| $("#" + options.tooltipId).remove(); | ||
| $(this).attr("title",title); | ||
| }); | ||
| } | ||
| }); | ||
|
|
||
| }; | ||
|
|
||
| })(jQuery); |
| @@ -0,0 +1,205 @@ | ||
| /* | ||
| * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ | ||
| * | ||
| * Uses the built in easing capabilities added In jQuery 1.1 | ||
| * to offer multiple easing options | ||
| * | ||
| * TERMS OF USE - jQuery Easing | ||
| * | ||
| * Open source under the BSD License. | ||
| * | ||
| * Copyright © 2008 George McGinley Smith | ||
| * All rights reserved. | ||
| * | ||
| * Redistribution and use in source and binary forms, with or without modification, | ||
| * are permitted provided that the following conditions are met: | ||
| * | ||
| * Redistributions of source code must retain the above copyright notice, this list of | ||
| * conditions and the following disclaimer. | ||
| * Redistributions in binary form must reproduce the above copyright notice, this list | ||
| * of conditions and the following disclaimer in the documentation and/or other materials | ||
| * provided with the distribution. | ||
| * | ||
| * Neither the name of the author nor the names of contributors may be used to endorse | ||
| * or promote products derived from this software without specific prior written permission. | ||
| * | ||
| * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY | ||
| * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
| * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
| * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
| * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE | ||
| * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | ||
| * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
| * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| * | ||
| */ | ||
|
|
||
| // t: current time, b: begInnIng value, c: change In value, d: duration | ||
| jQuery.easing['jswing'] = jQuery.easing['swing']; | ||
|
|
||
| jQuery.extend( jQuery.easing, | ||
| { | ||
| def: 'easeOutQuad', | ||
| swing: function (x, t, b, c, d) { | ||
| //alert(jQuery.easing.default); | ||
| return jQuery.easing[jQuery.easing.def](x, t, b, c, d); | ||
| }, | ||
| easeInQuad: function (x, t, b, c, d) { | ||
| return c*(t/=d)*t + b; | ||
| }, | ||
| easeOutQuad: function (x, t, b, c, d) { | ||
| return -c *(t/=d)*(t-2) + b; | ||
| }, | ||
| easeInOutQuad: function (x, t, b, c, d) { | ||
| if ((t/=d/2) < 1) return c/2*t*t + b; | ||
| return -c/2 * ((--t)*(t-2) - 1) + b; | ||
| }, | ||
| easeInCubic: function (x, t, b, c, d) { | ||
| return c*(t/=d)*t*t + b; | ||
| }, | ||
| easeOutCubic: function (x, t, b, c, d) { | ||
| return c*((t=t/d-1)*t*t + 1) + b; | ||
| }, | ||
| easeInOutCubic: function (x, t, b, c, d) { | ||
| if ((t/=d/2) < 1) return c/2*t*t*t + b; | ||
| return c/2*((t-=2)*t*t + 2) + b; | ||
| }, | ||
| easeInQuart: function (x, t, b, c, d) { | ||
| return c*(t/=d)*t*t*t + b; | ||
| }, | ||
| easeOutQuart: function (x, t, b, c, d) { | ||
| return -c * ((t=t/d-1)*t*t*t - 1) + b; | ||
| }, | ||
| easeInOutQuart: function (x, t, b, c, d) { | ||
| if ((t/=d/2) < 1) return c/2*t*t*t*t + b; | ||
| return -c/2 * ((t-=2)*t*t*t - 2) + b; | ||
| }, | ||
| easeInQuint: function (x, t, b, c, d) { | ||
| return c*(t/=d)*t*t*t*t + b; | ||
| }, | ||
| easeOutQuint: function (x, t, b, c, d) { | ||
| return c*((t=t/d-1)*t*t*t*t + 1) + b; | ||
| }, | ||
| easeInOutQuint: function (x, t, b, c, d) { | ||
| if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b; | ||
| return c/2*((t-=2)*t*t*t*t + 2) + b; | ||
| }, | ||
| easeInSine: function (x, t, b, c, d) { | ||
| return -c * Math.cos(t/d * (Math.PI/2)) + c + b; | ||
| }, | ||
| easeOutSine: function (x, t, b, c, d) { | ||
| return c * Math.sin(t/d * (Math.PI/2)) + b; | ||
| }, | ||
| easeInOutSine: function (x, t, b, c, d) { | ||
| return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; | ||
| }, | ||
| easeInExpo: function (x, t, b, c, d) { | ||
| return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b; | ||
| }, | ||
| easeOutExpo: function (x, t, b, c, d) { | ||
| return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b; | ||
| }, | ||
| easeInOutExpo: function (x, t, b, c, d) { | ||
| if (t==0) return b; | ||
| if (t==d) return b+c; | ||
| if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b; | ||
| return c/2 * (-Math.pow(2, -10 * --t) + 2) + b; | ||
| }, | ||
| easeInCirc: function (x, t, b, c, d) { | ||
| return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b; | ||
| }, | ||
| easeOutCirc: function (x, t, b, c, d) { | ||
| return c * Math.sqrt(1 - (t=t/d-1)*t) + b; | ||
| }, | ||
| easeInOutCirc: function (x, t, b, c, d) { | ||
| if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b; | ||
| return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b; | ||
| }, | ||
| easeInElastic: function (x, t, b, c, d) { | ||
| var s=1.70158;var p=0;var a=c; | ||
| if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; | ||
| if (a < Math.abs(c)) { a=c; var s=p/4; } | ||
| else var s = p/(2*Math.PI) * Math.asin (c/a); | ||
| return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; | ||
| }, | ||
| easeOutElastic: function (x, t, b, c, d) { | ||
| var s=1.70158;var p=0;var a=c; | ||
| if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; | ||
| if (a < Math.abs(c)) { a=c; var s=p/4; } | ||
| else var s = p/(2*Math.PI) * Math.asin (c/a); | ||
| return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b; | ||
| }, | ||
| easeInOutElastic: function (x, t, b, c, d) { | ||
| var s=1.70158;var p=0;var a=c; | ||
| if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5); | ||
| if (a < Math.abs(c)) { a=c; var s=p/4; } | ||
| else var s = p/(2*Math.PI) * Math.asin (c/a); | ||
| if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; | ||
| return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b; | ||
| }, | ||
| easeInBack: function (x, t, b, c, d, s) { | ||
| if (s == undefined) s = 1.70158; | ||
| return c*(t/=d)*t*((s+1)*t - s) + b; | ||
| }, | ||
| easeOutBack: function (x, t, b, c, d, s) { | ||
| if (s == undefined) s = 1.70158; | ||
| return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; | ||
| }, | ||
| easeInOutBack: function (x, t, b, c, d, s) { | ||
| if (s == undefined) s = 1.70158; | ||
| if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; | ||
| return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; | ||
| }, | ||
| easeInBounce: function (x, t, b, c, d) { | ||
| return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b; | ||
| }, | ||
| easeOutBounce: function (x, t, b, c, d) { | ||
| if ((t/=d) < (1/2.75)) { | ||
| return c*(7.5625*t*t) + b; | ||
| } else if (t < (2/2.75)) { | ||
| return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; | ||
| } else if (t < (2.5/2.75)) { | ||
| return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; | ||
| } else { | ||
| return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; | ||
| } | ||
| }, | ||
| easeInOutBounce: function (x, t, b, c, d) { | ||
| if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b; | ||
| return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b; | ||
| } | ||
| }); | ||
|
|
||
| /* | ||
| * | ||
| * TERMS OF USE - EASING EQUATIONS | ||
| * | ||
| * Open source under the BSD License. | ||
| * | ||
| * Copyright © 2001 Robert Penner | ||
| * All rights reserved. | ||
| * | ||
| * Redistribution and use in source and binary forms, with or without modification, | ||
| * are permitted provided that the following conditions are met: | ||
| * | ||
| * Redistributions of source code must retain the above copyright notice, this list of | ||
| * conditions and the following disclaimer. | ||
| * Redistributions in binary form must reproduce the above copyright notice, this list | ||
| * of conditions and the following disclaimer in the documentation and/or other materials | ||
| * provided with the distribution. | ||
| * | ||
| * Neither the name of the author nor the names of contributors may be used to endorse | ||
| * or promote products derived from this software without specific prior written permission. | ||
| * | ||
| * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY | ||
| * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
| * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
| * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
| * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE | ||
| * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | ||
| * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
| * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| * | ||
| */ |
| @@ -0,0 +1,139 @@ | ||
| /*! | ||
| * Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net) | ||
| * backgroundPosition cssHook for jquery. Necessary to combat different css property names between browsers | ||
| * https://github.com/brandonaaron/jquery-cssHooks | ||
| * Licensed under the MIT License (LICENSE.txt). | ||
| */ | ||
| (function($) { | ||
| // backgroundPosition[X,Y] get hooks | ||
| var $div = $('<div style="background-position: 3px 5px">'); | ||
| $.support.backgroundPosition = $div.css('backgroundPosition') === "3px 5px" ? true : false; | ||
| $.support.backgroundPositionXY = $div.css('backgroundPositionX') === "3px" ? true : false; | ||
| $div = null; | ||
|
|
||
| var xy = ["X","Y"]; | ||
|
|
||
| // helper function to parse out the X and Y values from backgroundPosition | ||
| function parseBgPos(bgPos) { | ||
| var parts = bgPos.split(/\s/), | ||
| values = { | ||
| "X": parts[0], | ||
| "Y": parts[1] | ||
| }; | ||
| return values; | ||
| } | ||
|
|
||
| if (!$.support.backgroundPosition && $.support.backgroundPositionXY) { | ||
| $.cssHooks.backgroundPosition = { | ||
| get: function( elem, computed, extra ) { | ||
| return $.map(xy, function( l, i ) { | ||
| return $.css(elem, "backgroundPosition" + l); | ||
| }).join(" "); | ||
| }, | ||
| set: function( elem, value ) { | ||
| $.each(xy, function( i, l ) { | ||
| var values = parseBgPos(value); | ||
| elem.style[ "backgroundPosition" + l ] = values[ l ]; | ||
| }); | ||
| } | ||
| }; | ||
| } | ||
|
|
||
| if ($.support.backgroundPosition && !$.support.backgroundPositionXY) { | ||
| $.each(xy, function( i, l ) { | ||
| $.cssHooks[ "backgroundPosition" + l ] = { | ||
| get: function( elem, computed, extra ) { | ||
| var values = parseBgPos( $.css(elem, "backgroundPosition") ); | ||
| return values[ l ]; | ||
| }, | ||
| set: function( elem, value ) { | ||
| var values = parseBgPos( $.css(elem, "backgroundPosition") ), | ||
| isX = l === "X"; | ||
| elem.style.backgroundPosition = (isX ? value : values[ "X" ]) + " " + | ||
| (isX ? values[ "Y" ] : value); | ||
| } | ||
| }; | ||
| $.fx.step[ "backgroundPosition" + l ] = function( fx ) { | ||
| $.cssHooks[ "backgroundPosition" + l ].set( fx.elem, fx.now + fx.unit ); | ||
| }; | ||
| }); | ||
| } | ||
| })(jQuery); | ||
|
|
||
| /*! | ||
| * Scroll-based parallax plugin for jQuery | ||
| * Copyright (c) 2011 Dave Cranwell (http://davecranwell.com) | ||
| * Licensed under the MIT License. | ||
| * 2011-05-18 | ||
| * version 1.0 | ||
| */ | ||
| (function($){ | ||
| $.fn.scrollParallax = function(options) { | ||
| var settings = { | ||
| 'speed': 0.2, | ||
| 'axis': 'x,y', | ||
| 'debug': false | ||
| } | ||
|
|
||
| function debug(msg){ | ||
| if(settings.debug && 'console' in window && 'log' in window.console){ | ||
| console.log(msg); | ||
| } | ||
| } | ||
|
|
||
| return this.each(function() { | ||
| //defined accessible $this var in standard way for use within functions | ||
| var $this = $(this); | ||
|
|
||
| //extend options in standard way | ||
| if (options) { | ||
| $.extend(settings, options); | ||
| } | ||
|
|
||
| $this.bind('inview', function (event, visible) { | ||
| if (visible == true) { | ||
| $this.addClass("inview"); | ||
| debug("in view"); | ||
| }else{ | ||
| $this.removeClass("inview"); | ||
| debug("out of view"); | ||
| } | ||
| }); | ||
|
|
||
| //find current position so parallax can be relative to it | ||
| var currentPosArray=$this.css("backgroundPosition").split(" "); | ||
| var currentXPos=parseInt(currentPosArray[0].replace(/[^0-9\-]/g, "")); | ||
| var currentYPos=parseInt(currentPosArray[1].replace(/[^0-9\-]/g, "")); | ||
|
|
||
| //recalculate position on scroll | ||
| $(window).bind('scroll', function(){ | ||
| if($this.hasClass("inview")){ | ||
| var offset = $this.offset(); | ||
|
|
||
| //calculate new position | ||
| if(settings.axis.match(/x/)){ | ||
| var Xpos = offset.left - $(window).scrollLeft(); | ||
| var newXPos = (-(Xpos) * settings.speed) + currentXPos; | ||
| newXPos = parseInt(newXPos) + "px "; | ||
| }else{ | ||
| var newXPos = currentPosArray[0]; | ||
| } | ||
| if(settings.axis.match(/y/)){ | ||
| var Ypos = offset.top - $(window).scrollTop(); | ||
| var newYPos = (-(Ypos) * settings.speed) + currentYPos; | ||
| newYPos = parseInt(newYPos) +"px"; | ||
| }else{ | ||
| var newYPos = currentPosArray[1]; | ||
| } | ||
|
|
||
| debug("new X position: "+ newXPos); | ||
| debug("new Y position: "+ newYPos); | ||
|
|
||
| $this.css({'backgroundPosition': newXPos + newYPos}); | ||
|
|
||
| } | ||
| }); | ||
| }); | ||
| }; | ||
|
|
||
| })(jQuery); |
| @@ -0,0 +1,215 @@ | ||
| /** | ||
| * jQuery.ScrollTo | ||
| * Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com | ||
| * Dual licensed under MIT and GPL. | ||
| * Date: 5/25/2009 | ||
| * | ||
| * @projectDescription Easy element scrolling using jQuery. | ||
| * http://flesler.blogspot.com/2007/10/jqueryscrollto.html | ||
| * Works with jQuery +1.2.6. Tested on FF 2/3, IE 6/7/8, Opera 9.5/6, Safari 3, Chrome 1 on WinXP. | ||
| * | ||
| * @author Ariel Flesler | ||
| * @version 1.4.2 | ||
| * | ||
| * @id jQuery.scrollTo | ||
| * @id jQuery.fn.scrollTo | ||
| * @param {String, Number, DOMElement, jQuery, Object} target Where to scroll the matched elements. | ||
| * The different options for target are: | ||
| * - A number position (will be applied to all axes). | ||
| * - A string position ('44', '100px', '+=90', etc ) will be applied to all axes | ||
| * - A jQuery/DOM element ( logically, child of the element to scroll ) | ||
| * - A string selector, that will be relative to the element to scroll ( 'li:eq(2)', etc ) | ||
| * - A hash { top:x, left:y }, x and y can be any kind of number/string like above. | ||
| * - A percentage of the container's dimension/s, for example: 50% to go to the middle. | ||
| * - The string 'max' for go-to-end. | ||
| * @param {Number} duration The OVERALL length of the animation, this argument can be the settings object instead. | ||
| * @param {Object,Function} settings Optional set of settings or the onAfter callback. | ||
| * @option {String} axis Which axis must be scrolled, use 'x', 'y', 'xy' or 'yx'. | ||
| * @option {Number} duration The OVERALL length of the animation. | ||
| * @option {String} easing The easing method for the animation. | ||
| * @option {Boolean} margin If true, the margin of the target element will be deducted from the final position. | ||
| * @option {Object, Number} offset Add/deduct from the end position. One number for both axes or { top:x, left:y }. | ||
| * @option {Object, Number} over Add/deduct the height/width multiplied by 'over', can be { top:x, left:y } when using both axes. | ||
| * @option {Boolean} queue If true, and both axis are given, the 2nd axis will only be animated after the first one ends. | ||
| * @option {Function} onAfter Function to be called after the scrolling ends. | ||
| * @option {Function} onAfterFirst If queuing is activated, this function will be called after the first scrolling ends. | ||
| * @return {jQuery} Returns the same jQuery object, for chaining. | ||
| * | ||
| * @desc Scroll to a fixed position | ||
| * @example $('div').scrollTo( 340 ); | ||
| * | ||
| * @desc Scroll relatively to the actual position | ||
| * @example $('div').scrollTo( '+=340px', { axis:'y' } ); | ||
| * | ||
| * @dec Scroll using a selector (relative to the scrolled element) | ||
| * @example $('div').scrollTo( 'p.paragraph:eq(2)', 500, { easing:'swing', queue:true, axis:'xy' } ); | ||
| * | ||
| * @ Scroll to a DOM element (same for jQuery object) | ||
| * @example var second_child = document.getElementById('container').firstChild.nextSibling; | ||
| * $('#container').scrollTo( second_child, { duration:500, axis:'x', onAfter:function(){ | ||
| * alert('scrolled!!'); | ||
| * }}); | ||
| * | ||
| * @desc Scroll on both axes, to different values | ||
| * @example $('div').scrollTo( { top: 300, left:'+=200' }, { axis:'xy', offset:-20 } ); | ||
| */ | ||
| ;(function( $ ){ | ||
|
|
||
| var $scrollTo = $.scrollTo = function( target, duration, settings ){ | ||
| $(window).scrollTo( target, duration, settings ); | ||
| }; | ||
|
|
||
| $scrollTo.defaults = { | ||
| axis:'xy', | ||
| duration: parseFloat($.fn.jquery) >= 1.3 ? 0 : 1 | ||
| }; | ||
|
|
||
| // Returns the element that needs to be animated to scroll the window. | ||
| // Kept for backwards compatibility (specially for localScroll & serialScroll) | ||
| $scrollTo.window = function( scope ){ | ||
| return $(window)._scrollable(); | ||
| }; | ||
|
|
||
| // Hack, hack, hack :) | ||
| // Returns the real elements to scroll (supports window/iframes, documents and regular nodes) | ||
| $.fn._scrollable = function(){ | ||
| return this.map(function(){ | ||
| var elem = this, | ||
| isWin = !elem.nodeName || $.inArray( elem.nodeName.toLowerCase(), ['iframe','#document','html','body'] ) != -1; | ||
|
|
||
| if( !isWin ) | ||
| return elem; | ||
|
|
||
| var doc = (elem.contentWindow || elem).document || elem.ownerDocument || elem; | ||
|
|
||
| return $.browser.safari || doc.compatMode == 'BackCompat' ? | ||
| doc.body : | ||
| doc.documentElement; | ||
| }); | ||
| }; | ||
|
|
||
| $.fn.scrollTo = function( target, duration, settings ){ | ||
| if( typeof duration == 'object' ){ | ||
| settings = duration; | ||
| duration = 0; | ||
| } | ||
| if( typeof settings == 'function' ) | ||
| settings = { onAfter:settings }; | ||
|
|
||
| if( target == 'max' ) | ||
| target = 9e9; | ||
|
|
||
| settings = $.extend( {}, $scrollTo.defaults, settings ); | ||
| // Speed is still recognized for backwards compatibility | ||
| duration = duration || settings.speed || settings.duration; | ||
| // Make sure the settings are given right | ||
| settings.queue = settings.queue && settings.axis.length > 1; | ||
|
|
||
| if( settings.queue ) | ||
| // Let's keep the overall duration | ||
| duration /= 2; | ||
| settings.offset = both( settings.offset ); | ||
| settings.over = both( settings.over ); | ||
|
|
||
| return this._scrollable().each(function(){ | ||
| var elem = this, | ||
| $elem = $(elem), | ||
| targ = target, toff, attr = {}, | ||
| win = $elem.is('html,body'); | ||
|
|
||
| switch( typeof targ ){ | ||
| // A number will pass the regex | ||
| case 'number': | ||
| case 'string': | ||
| if( /^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(targ) ){ | ||
| targ = both( targ ); | ||
| // We are done | ||
| break; | ||
| } | ||
| // Relative selector, no break! | ||
| targ = $(targ,this); | ||
| case 'object': | ||
| // DOMElement / jQuery | ||
| if( targ.is || targ.style ) | ||
| // Get the real position of the target | ||
| toff = (targ = $(targ)).offset(); | ||
| } | ||
| $.each( settings.axis.split(''), function( i, axis ){ | ||
| var Pos = axis == 'x' ? 'Left' : 'Top', | ||
| pos = Pos.toLowerCase(), | ||
| key = 'scroll' + Pos, | ||
| old = elem[key], | ||
| max = $scrollTo.max(elem, axis); | ||
|
|
||
| if( toff ){// jQuery / DOMElement | ||
| attr[key] = toff[pos] + ( win ? 0 : old - $elem.offset()[pos] ); | ||
|
|
||
| // If it's a dom element, reduce the margin | ||
| if( settings.margin ){ | ||
| attr[key] -= parseInt(targ.css('margin'+Pos)) || 0; | ||
| attr[key] -= parseInt(targ.css('border'+Pos+'Width')) || 0; | ||
| } | ||
|
|
||
| attr[key] += settings.offset[pos] || 0; | ||
|
|
||
| if( settings.over[pos] ) | ||
| // Scroll to a fraction of its width/height | ||
| attr[key] += targ[axis=='x'?'width':'height']() * settings.over[pos]; | ||
| }else{ | ||
| var val = targ[pos]; | ||
| // Handle percentage values | ||
| attr[key] = val.slice && val.slice(-1) == '%' ? | ||
| parseFloat(val) / 100 * max | ||
| : val; | ||
| } | ||
|
|
||
| // Number or 'number' | ||
| if( /^\d+$/.test(attr[key]) ) | ||
| // Check the limits | ||
| attr[key] = attr[key] <= 0 ? 0 : Math.min( attr[key], max ); | ||
|
|
||
| // Queueing axes | ||
| if( !i && settings.queue ){ | ||
| // Don't waste time animating, if there's no need. | ||
| if( old != attr[key] ) | ||
| // Intermediate animation | ||
| animate( settings.onAfterFirst ); | ||
| // Don't animate this axis again in the next iteration. | ||
| delete attr[key]; | ||
| } | ||
| }); | ||
|
|
||
| animate( settings.onAfter ); | ||
|
|
||
| function animate( callback ){ | ||
| $elem.animate( attr, duration, settings.easing, callback && function(){ | ||
| callback.call(this, target, settings); | ||
| }); | ||
| }; | ||
|
|
||
| }).end(); | ||
| }; | ||
|
|
||
| // Max scrolling position, works on quirks mode | ||
| // It only fails (not too badly) on IE, quirks mode. | ||
| $scrollTo.max = function( elem, axis ){ | ||
| var Dim = axis == 'x' ? 'Width' : 'Height', | ||
| scroll = 'scroll'+Dim; | ||
|
|
||
| if( !$(elem).is('html,body') ) | ||
| return elem[scroll] - $(elem)[Dim.toLowerCase()](); | ||
|
|
||
| var size = 'client' + Dim, | ||
| html = elem.ownerDocument.documentElement, | ||
| body = elem.ownerDocument.body; | ||
|
|
||
| return Math.max( html[scroll], body[scroll] ) | ||
| - Math.min( html[size] , body[size] ); | ||
|
|
||
| }; | ||
|
|
||
| function both( val ){ | ||
| return typeof val == 'object' ? val : { top:val, left:val }; | ||
| }; | ||
|
|
||
| })( jQuery ); |
| @@ -0,0 +1,297 @@ | ||
| /* | ||
| * transform: A light jQuery cssHooks for 2d transform | ||
| * | ||
| * limitations: | ||
| * - requires jQuery 1.4.3+ | ||
| * - Should you use the *translate* property, then your elements need to be absolutely positionned in a relatively positionned wrapper **or it will fail in IE678**. | ||
| * - incompatible with "matrix(...)" transforms | ||
| * - transformOrigin is not accessible | ||
| * | ||
| * latest version and complete README available on Github: | ||
| * https://github.com/louisremi/jquery.transform.js | ||
| * | ||
| * Copyright 2011 @louis_remi | ||
| * Licensed under the MIT license. | ||
| * | ||
| * This saved you an hour of work? | ||
| * Send me music http://www.amazon.co.uk/wishlist/HNTU0468LQON | ||
| * | ||
| */ | ||
| (function( $ ) { | ||
|
|
||
| /* | ||
| * Feature tests and global variables | ||
| */ | ||
| var div = document.createElement("div"), | ||
| divStyle = div.style, | ||
| propertyName = "transform", | ||
| suffix = "Transform", | ||
| testProperties = [ | ||
| "O" + suffix, | ||
| "ms" + suffix, | ||
| "Webkit" + suffix, | ||
| "Moz" + suffix, | ||
| // prefix-less property | ||
| propertyName | ||
| ], | ||
| i = testProperties.length, | ||
| supportProperty, | ||
| supportMatrixFilter, | ||
| propertyHook, | ||
| rMatrix = /Matrix([^)]*)/; | ||
|
|
||
| // test different vendor prefixes of this property | ||
| while ( i-- ) { | ||
| if ( testProperties[i] in divStyle ) { | ||
| $.support[propertyName] = supportProperty = testProperties[i]; | ||
| continue; | ||
| } | ||
| } | ||
| // IE678 alternative | ||
| if ( !supportProperty ) { | ||
| $.support.matrixFilter = supportMatrixFilter = divStyle.filter === ""; | ||
| } | ||
| // prevent IE memory leak | ||
| div = divStyle = null; | ||
|
|
||
| // px isn't the default unit of this property | ||
| $.cssNumber[propertyName] = true; | ||
|
|
||
| /* | ||
| * fn.css() hooks | ||
| */ | ||
| $.cssHooks[propertyName] = propertyHook = { | ||
| // One fake getter to rule them all | ||
| get: function( elem ) { | ||
| var transform = $.data( elem, "transform" ) || { | ||
| translate: [0,0], | ||
| rotate: 0, | ||
| scale: [1,1], | ||
| skew: [0,0] | ||
| }; | ||
| transform.toString = function() { | ||
| return "translate("+this.translate[0]+"px,"+this.translate[1]+"px) rotate("+this.rotate+"rad) scale("+this.scale+") skew("+this.skew[0]+"rad,"+this.skew[1]+"rad)"; | ||
| } | ||
| return transform; | ||
| }, | ||
| set: function( elem, value, animate ) { | ||
| if ( typeof value === "string" ) { | ||
| value = components(value); | ||
| } | ||
|
|
||
| var translate = value.translate, | ||
| rotate = value.rotate, | ||
| scale = value.scale, | ||
| skew = value.skew, | ||
| elemStyle = elem.style, | ||
| currentStyle, | ||
| filter; | ||
|
|
||
| $.data( elem, "transform", value ); | ||
|
|
||
| // We can improve performance by avoiding unnecessary transforms | ||
| // skew is the less likely to be used | ||
| if (!skew[0] && !skew[1]) { | ||
| skew = 0; | ||
| } | ||
|
|
||
| if ( supportProperty ) { | ||
| elemStyle[supportProperty] = "translate("+translate[0]+"px,"+translate[1]+"px) rotate("+rotate+"rad) scale("+scale+")"+(skew?" skew("+skew[0]+"rad,"+skew[1]+"rad)" : ""); | ||
|
|
||
| } else if ( supportMatrixFilter ) { | ||
|
|
||
| if ( !animate ) { | ||
| elemStyle.zoom = 1; | ||
| } | ||
|
|
||
| var cos = Math.cos(rotate), | ||
| sin = Math.sin(rotate), | ||
| M11 = cos*scale[0], | ||
| M12 = -sin*scale[1], | ||
| M21 = sin*scale[0], | ||
| M22 = cos*scale[1], | ||
| tanX, | ||
| tanY, | ||
| Matrix, | ||
| centerOrigin; | ||
|
|
||
| if ( skew ) { | ||
| tanX = Math.tan(skew[0]); | ||
| tanY = Math.tan(skew[1]); | ||
| M11 += M12*tanY; | ||
| M12 += M11*tanX; | ||
| M21 += M22*tanY; | ||
| M22 += M21*tanX; | ||
| } | ||
|
|
||
| Matrix = [ | ||
| "Matrix("+ | ||
| "M11="+M11, | ||
| "M12="+M12, | ||
| "M21="+M21, | ||
| "M22="+M22, | ||
| "SizingMethod='auto expand'" | ||
| ].join(); | ||
| filter = ( currentStyle = elem.currentStyle ) && currentStyle.filter || elemStyle.filter || ""; | ||
|
|
||
| elemStyle.filter = rMatrix.test(filter) ? | ||
| filter.replace(rMatrix, Matrix) : | ||
| filter + " progid:DXImageTransform.Microsoft." + Matrix + ")"; | ||
|
|
||
| // center the transform origin, from pbakaus's Transformie http://github.com/pbakaus/transformie | ||
| if ( (centerOrigin = $.transform.centerOrigin) ) { | ||
| elemStyle[centerOrigin == "margin" ? "marginLeft" : "left"] = -(elem.offsetWidth/2) + (elem.clientWidth/2) + "px"; | ||
| elemStyle[centerOrigin == "margin" ? "marginTop" : "top"] = -(elem.offsetHeight/2) + (elem.clientHeight/2) + "px"; | ||
| } | ||
|
|
||
| // We assume that the elements are absolute positionned inside a relative positionned wrapper | ||
| elemStyle.left = translate[0] + "px"; | ||
| elemStyle.top = translate[1] + "px"; | ||
| } | ||
| } | ||
| }; | ||
|
|
||
| /* | ||
| * fn.animate() hooks | ||
| */ | ||
| $.fx.step.transform = function( fx ) { | ||
| var elem = fx.elem, | ||
| start = fx.start, | ||
| end = fx.end, | ||
| pos = fx.pos, | ||
| transform = {}, | ||
| coef; | ||
|
|
||
| // fx.end and fx.start need to be converted to their translate/rotate/scale/skew components | ||
| // so that we can interpolate them | ||
| if ( !start || typeof end === "string" ) { | ||
| // the following block can be commented out with jQuery 1.5.1+, see #7912 | ||
| if (!start) { | ||
| start = propertyHook.get( elem ); | ||
| } | ||
|
|
||
| // force layout only once per animation | ||
| if ( supportMatrixFilter ) { | ||
| elem.style.zoom = 1; | ||
| } | ||
|
|
||
| // end has to be parsed | ||
| fx.end = end = components(end); | ||
| } | ||
|
|
||
| /* | ||
| * We want a fast interpolation algorithm. | ||
| * This implies avoiding function calls and sacrifying DRY principle: | ||
| * - avoid $.each(function(){}) | ||
| * - round values using bitewise hacks, see http://jsperf.com/math-round-vs-hack/3 | ||
| */ | ||
| transform.translate = [ | ||
| (start.translate[0] + (end.translate[0] - start.translate[0]) * pos + .5) | 0, | ||
| (start.translate[1] + (end.translate[1] - start.translate[1]) * pos + .5) | 0 | ||
| ]; | ||
| transform.rotate = start.rotate + (end.rotate - start.rotate) * pos; | ||
| transform.scale = [ | ||
| start.scale[0] + (end.scale[0] - start.scale[0]) * pos, | ||
| start.scale[1] + (end.scale[1] - start.scale[1]) * pos | ||
| ]; | ||
| transform.skew = [ | ||
| start.skew[0] + (end.skew[0] - start.skew[0]) * pos, | ||
| start.skew[1] + (end.skew[1] - start.skew[1]) * pos | ||
| ]; | ||
|
|
||
| propertyHook.set( elem, transform, true ); | ||
| }; | ||
|
|
||
| /* | ||
| * Utility functions | ||
| */ | ||
| // parse transform components of a transform string not containing "matrix(...)" | ||
| function components( transform ) { | ||
| // split the != transforms | ||
| transform = transform.split(")"); | ||
|
|
||
| var translate = [0,0], | ||
| rotate = 0, | ||
| scale = [1,1], | ||
| skew = [0,0], | ||
| i = transform.length -1, | ||
| trim = $.trim, | ||
| split, value; | ||
|
|
||
| // add components | ||
| while ( i-- ) { | ||
| split = transform[i].split("("); | ||
| value = split[1]; | ||
|
|
||
| switch ( trim(split[0]) ) { | ||
| case "translateX": | ||
| translate[0] += parseInt(value, 10); | ||
| break; | ||
|
|
||
| case "translateY": | ||
| translate[1] += parseInt(value, 10); | ||
| break; | ||
|
|
||
| case "translate": | ||
| value = value.split(","); | ||
| translate[0] += parseInt(value[0], 10); | ||
| translate[1] += parseInt(value[1] || 0, 10); | ||
| break; | ||
|
|
||
| case "rotate": | ||
| rotate += toRadian(value); | ||
| break; | ||
|
|
||
| case "scaleX": | ||
| scale[0] *= value; | ||
|
|
||
| case "scaleY": | ||
| scale[1] *= value; | ||
|
|
||
| case "scale": | ||
| value = value.split(","); | ||
| scale[0] *= value[0]; | ||
| scale[1] *= (value.length>1? value[1] : value[0]); | ||
| break; | ||
|
|
||
| case "skewX": | ||
| skew[0] += toRadian(value); | ||
| break; | ||
|
|
||
| case "skewY": | ||
| skew[1] += toRadian(value); | ||
| break; | ||
|
|
||
| case "skew": | ||
| value = value.split(","); | ||
| skew[0] += toRadian(value[0]); | ||
| skew[1] += toRadian(value[1] || "0"); | ||
| break; | ||
| } | ||
| } | ||
|
|
||
| return { | ||
| translate: translate, | ||
| rotate: rotate, | ||
| scale: scale, | ||
| skew: skew | ||
| }; | ||
| } | ||
|
|
||
| // converts an angle string in any unit to a radian Float | ||
| function toRadian(value) { | ||
| return ~value.indexOf("deg") ? | ||
| parseInt(value,10) * (Math.PI * 2 / 360): | ||
| ~value.indexOf("grad") ? | ||
| parseInt(value,10) * (Math.PI/200): | ||
| parseFloat(value); | ||
| } | ||
|
|
||
| $.transform = { | ||
| centerOrigin: "margin", | ||
| radToDeg: function( rad ) { | ||
| return rad * 180 / Math.PI; | ||
| } | ||
| }; | ||
|
|
||
| })( jQuery ); |
| @@ -0,0 +1,124 @@ | ||
| $(function(){ | ||
| var saidBus = new google.maps.LatLng(51.75308, -1.26814); | ||
| var oxford = new google.maps.LatLng(51.75353, -1.26470); | ||
| var myOptions = { | ||
| zoom: 15, | ||
| center: oxford, | ||
| mapTypeId: google.maps.MapTypeId.ROADMAP | ||
| }; | ||
| var map = new google.maps.Map(document.getElementById("map_canvas"), | ||
| myOptions); | ||
|
|
||
| var saidInfowindow = new google.maps.InfoWindow({ | ||
| content: '<div class="infowindow"><h3>Säid Business School</h3><div class="content">The venue</div></div>' | ||
| }); | ||
|
|
||
| var image = 'img/map_pin_venue_shadow.png'; | ||
|
|
||
| var saidMarker = new google.maps.Marker({ | ||
| position: saidBus, | ||
| map: map, | ||
| icon: image | ||
| }); | ||
|
|
||
| google.maps.event.addListener(saidMarker, 'click', function() { | ||
| saidInfowindow.open(map,saidMarker); | ||
| }); | ||
|
|
||
| var markers = { | ||
| '#venue': [saidMarker], | ||
| '#restaurants': [], | ||
| '#accommodation': [] | ||
| }; | ||
| var request = { | ||
| location: oxford, | ||
| radius: '1000', | ||
| types: ['restaurant','lodging'] | ||
| }; | ||
|
|
||
| service = new google.maps.places.PlacesService(map); | ||
|
|
||
| service.search(request, function(results, status){ | ||
| if (status == google.maps.places.PlacesServiceStatus.OK) { | ||
| for (var i = 0; i < results.length; i++) { | ||
| if(jQuery.inArray("lodging", results[i].types)!=-1) { | ||
| createLodgingMarker(results[i]); | ||
| } else if(jQuery.inArray("restaurant", results[i]["types"])!=-1) { | ||
| createRestaurantMarker(results[i]); | ||
| } | ||
| } | ||
| } | ||
| }); | ||
|
|
||
| function createRestaurantMarker(place) { | ||
| var image = 'img/map_pin_restaurants_shadow.png'; | ||
| var marker = new google.maps.Marker({ | ||
| map: map, | ||
| position: place.geometry.location, | ||
| icon: image | ||
| }); | ||
|
|
||
| var request = { | ||
| reference: place.reference | ||
| }; | ||
|
|
||
| var infowindow = new google.maps.InfoWindow(); | ||
|
|
||
| service = new google.maps.places.PlacesService(map); | ||
| service.getDetails(request, function(place, status){ | ||
| if (status == google.maps.places.PlacesServiceStatus.OK) { | ||
| var content = '<div class="infowindow"><h3>'+place.name+'</h3><div class="content">'+place.formatted_address+'</div></div>'; | ||
| infowindow.setContent(content); | ||
| } | ||
| }); | ||
|
|
||
| google.maps.event.addListener(marker, 'click', function() { | ||
| infowindow.open(map, this); | ||
| }); | ||
|
|
||
| markers["#restaurants"].push(marker); | ||
| } | ||
|
|
||
| function createLodgingMarker(place) { | ||
| var image = 'img/map_pin_accommodation_shadow.png'; | ||
| var marker = new google.maps.Marker({ | ||
| map: map, | ||
| position: place.geometry.location, | ||
| icon: image | ||
| }); | ||
|
|
||
| var request = { | ||
| reference: place.reference | ||
| }; | ||
|
|
||
| var infowindow = new google.maps.InfoWindow(); | ||
|
|
||
| service = new google.maps.places.PlacesService(map); | ||
| service.getDetails(request, function(place, status){ | ||
| if (status == google.maps.places.PlacesServiceStatus.OK) { | ||
| var content = '<div class="infowindow"><h3>'+place.name+'</h3><div class="content">'+place.formatted_address+'</div></div>'; | ||
| infowindow.setContent(content); | ||
| } | ||
| }); | ||
|
|
||
| google.maps.event.addListener(marker, 'click', function() { | ||
| infowindow.open(map, this); | ||
| }); | ||
|
|
||
| markers["#accommodation"].push(marker); | ||
| } | ||
|
|
||
|
|
||
| $('#map ul a').click(function() { | ||
| jQuery.scrollTo.window().queue([]).stop(); | ||
| var $this = $(this); | ||
| var status = $this.hasClass("off"); | ||
| if(markers[this.hash]) { | ||
| for(var i =0; i < markers[this.hash].length; i++) { | ||
| markers[this.hash][i].setVisible(status); | ||
| } | ||
| } | ||
| $this.toggleClass("off"); | ||
| return false; | ||
| }); | ||
| }) |
| @@ -0,0 +1,2 @@ | ||
| !.gitignore | ||
|
|