added more preview pages and more templates
This commit is contained in:
1 parent
c6119ffdf5
commit
b19fdee30d
3726 files changed
+651487
-6169
No files matched your search
+258
@@ -0,0 +1,258 @@
|
||||
//TMForm
|
||||
(function($){
|
||||
$.fn.TMForm=function(opt){
|
||||
return this.each(TMForm)
|
||||
|
||||
function TMForm(){
|
||||
var form=$(this)
|
||||
opt=$.extend({
|
||||
okClass:'ok'
|
||||
,emptyClass:'empty'
|
||||
,invalidClass:'invalid'
|
||||
,successClass:'success'
|
||||
,onceVerifiedClass:'once-verified'
|
||||
,mailHandlerURL:'bat/MailHandler.php'
|
||||
,successShowDelay:'4000'
|
||||
,stripHTML:true
|
||||
},opt)
|
||||
|
||||
init()
|
||||
|
||||
function init(){
|
||||
form
|
||||
.on('submit',formSubmit)
|
||||
.on('reset',formReset)
|
||||
.on('focus','[data-constraints]',function(){
|
||||
$(this).parents('label').removeClass(opt.emptyClass)
|
||||
})
|
||||
.on('blur','[data-constraints]:not(.once-verified)',function(){
|
||||
$(this)
|
||||
.addClass(opt.onceVerifiedClass)
|
||||
.trigger('validate.form')
|
||||
})
|
||||
.on('keyup','[data-constraints].once-verified',function(){
|
||||
$(this).trigger('validate.form')
|
||||
})
|
||||
|
||||
if($('[data-constraints]',form).length!==0)
|
||||
$('[data-constraints]',form)
|
||||
.regula('bind')
|
||||
.on('show.placeholder',function(){
|
||||
fieldDesolation($(this))
|
||||
})
|
||||
.on('validate.form',fieldValidate)
|
||||
|
||||
|
||||
$('[placeholder]',form).TMPlaceholder()
|
||||
|
||||
$('[data-type=submit]',form)
|
||||
.click(function(){
|
||||
form.trigger('submit')
|
||||
return false
|
||||
})
|
||||
|
||||
$('[data-type=reset]',form)
|
||||
.click(function(){
|
||||
form.trigger('reset')
|
||||
return false
|
||||
})
|
||||
}
|
||||
|
||||
function fieldValidate(el){
|
||||
var el=$(this)
|
||||
,result=el.regula('validate')
|
||||
,isEmpty=false
|
||||
,isInvalid=false
|
||||
,isRequired=!!~el.data('constraints').indexOf('@Required')
|
||||
|
||||
$.each(result,function(){
|
||||
if(this.constraintName==='Required')
|
||||
isEmpty=true
|
||||
else
|
||||
isInvalid=true
|
||||
})
|
||||
|
||||
if(!el.hasClass(opt.onceVerifiedClass)&&!isEmpty)
|
||||
el.addClass(opt.onceVerifiedClass)
|
||||
|
||||
if(isEmpty)
|
||||
el.parents('label').addClass(opt.emptyClass)
|
||||
|
||||
if(isInvalid&&!isEmpty&&isRequired)
|
||||
el.parents('label')
|
||||
.removeClass(opt.emptyClass)
|
||||
.removeClass(opt.okClass)
|
||||
.addClass(opt.invalidClass)
|
||||
|
||||
if(isInvalid&&!isRequired&&el.val())
|
||||
el.parents('label')
|
||||
.removeClass(opt.emptyClass)
|
||||
.removeClass(opt.okClass)
|
||||
.addClass(opt.invalidClass)
|
||||
|
||||
if(!result.length)
|
||||
el.parents('label')
|
||||
.removeClass(opt.invalidClass)
|
||||
.removeClass(opt.emptyClass)
|
||||
.addClass(opt.okClass)
|
||||
}
|
||||
|
||||
function fieldDesolation(el){
|
||||
el
|
||||
.removeClass(opt.onceVerifiedClass)
|
||||
.parents('label')
|
||||
.removeClass(opt.invalidClass)
|
||||
.removeClass(opt.emptyClass)
|
||||
.removeClass(opt.okClass)
|
||||
}
|
||||
|
||||
function getValue(el){
|
||||
return el.val()||false
|
||||
}
|
||||
|
||||
function formSubmit(){
|
||||
$('[data-constraints]',form).trigger('validate.form')
|
||||
|
||||
if(!$('label.'+opt.invalidClass+',label.'+opt.emptyClass,form).length){
|
||||
$.ajax({
|
||||
type:"POST"
|
||||
,url:opt.mailHandlerURL
|
||||
,data:{
|
||||
name:getValue($('label.name input'))
|
||||
,email:getValue($('label.email input'))
|
||||
,phone:getValue($('label.phone input'))
|
||||
,fax:getValue($('label.fax input'))
|
||||
,state:getValue($('label.state input'))
|
||||
,message:getValue($('label.message textarea'))
|
||||
,owner_email:opt.ownerEmail||'#'
|
||||
,stripHTML:opt.stripHTML
|
||||
}
|
||||
,success: function(e){
|
||||
form.addClass(opt.successClass)
|
||||
setTimeout(function(){
|
||||
form
|
||||
.removeClass(opt.successClass)
|
||||
.trigger('reset')
|
||||
},opt.successShowDelay)
|
||||
}
|
||||
})
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
function formReset(){
|
||||
fieldDesolation($('[data-constraints]',form))
|
||||
}
|
||||
}
|
||||
}
|
||||
})(jQuery)
|
||||
|
||||
;(function($){
|
||||
$.fn.TMPlaceholder=function(opt){
|
||||
return this.each(function(){
|
||||
var th=$(this)
|
||||
,placeholder_text
|
||||
,placeholder
|
||||
|
||||
opt=$.extend({
|
||||
placeholderClass:'_placeholder'
|
||||
,placeholderFocusedClass:'focused'
|
||||
,placeholderHiddenClass:'hidden'
|
||||
},opt)
|
||||
|
||||
init()
|
||||
|
||||
function init(){
|
||||
placeholder_text=th.attr('placeholder')
|
||||
placeholder=$(document.createElement('span'))
|
||||
placeholder
|
||||
.addClass(opt.placeholderClass)
|
||||
.css({
|
||||
left:th.prop('offsetLeft')
|
||||
,top:th.prop('offsetTop')
|
||||
,width:th.width()
|
||||
,height:th.outerHeight()
|
||||
})
|
||||
.text(placeholder_text)
|
||||
.appendTo(th.parent())
|
||||
.click(function(){
|
||||
th.focus()
|
||||
return false
|
||||
})
|
||||
.on('contextmenu',function(){
|
||||
th.trigger('hide.placeholder').focus()
|
||||
})
|
||||
|
||||
th
|
||||
.val('')
|
||||
.removeAttr('placeholder')
|
||||
.on('hide.placeholder',function(){
|
||||
placeholder.addClass(opt.placeholderHiddenClass)
|
||||
})
|
||||
.on('show.placeholder',function(){
|
||||
placeholder.removeClass(opt.placeholderHiddenClass)
|
||||
})
|
||||
.on('focus',function(){
|
||||
placeholder.addClass(opt.placeholderFocusedClass)
|
||||
})
|
||||
.on('blur',function(){
|
||||
var val=th.val()
|
||||
if(val===''||val===placeholder_text)
|
||||
th.val('')
|
||||
,th.trigger('show.placeholder')
|
||||
placeholder.removeClass(opt.placeholderFocusedClass)
|
||||
})
|
||||
.on('keydown',function(e){
|
||||
if(e.keyCode===32||e.keyCode>46)
|
||||
th.trigger('hide.placeholder')
|
||||
})
|
||||
.on('keyup',function(){
|
||||
if(th.val()===''){
|
||||
th.trigger('show.placeholder')
|
||||
return false
|
||||
}else{
|
||||
th.trigger('hide.placeholder')
|
||||
}
|
||||
})
|
||||
.parents('form').on('reset',function(){
|
||||
th.trigger('show.placeholder')
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})(jQuery)
|
||||
//using suggested jQuery practice by passing jQuery into a function
|
||||
//in order to have $ notation without conflicting with other libraries
|
||||
//Author: Troy Ingram
|
||||
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(4(a){3(n j===\'4\'&&j.w){j([\'x\'],a)}e{a(r)}}(4(b){u $=b,7={9:4(a){3(2 d b){3(!a)a={};3(2.8().c>0){$.g(h,a,{i:2.8()})}}5.9(a);6 2},k:4(a){3(2 d b){3(!a)a={};3(2.8().c>0){$.g(h,a,{i:2.8()})}}5.k(a);6 2},p:4(a){3(2 d b){3(!a)a={};3(2.8().c>0){$.g(h,a,{i:2.8()})}}6 5.p(a)},q:4(a){5.q(a);6 2},m:4(a){5.m(a);6 2},s:4(a){5.s(a);6 2}};7.t=7.9;7.v=7.k;$.C.5=f;$.5=f;4 f(a){3(7[a]){6 7[a].l(2,y.z.A.B(o,1))}e 3(n a===\'D\'||!a){6 7.9.l(2,o)}e{$.E(\'F \'+a+\' G H I t r.5\')}}}));',45,45,'||this|if|function|regula|return|methods|get|bind|||length|instanceof|else|CallMethod|extend|true|elements|define|unbind|apply|compound|typeof|arguments|validate|custom|jQuery|override|on|var|off|amd|jquery|Array|prototype|slice|call|fn|object|error|Method|does|not|exist'.split('|'),0,{}))
|
||||
/*
|
||||
Regula: An annotation-based form-validation framework in Javascript
|
||||
Version 1.2.4-SNAPSHOT
|
||||
|
||||
Written By Vivin Paliath (http://vivin.net)
|
||||
License: BSD License
|
||||
|
||||
TODO: Add step validation to regula (like html5 step validation)
|
||||
TODO: Add URL validation to regula (like html5 url validation)
|
||||
Copyright (C) 2010-2012
|
||||
*/
|
||||
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('1a 1v={4S:1e(){},2h:1e(){},3A:1e(){},1t:1e(){},1u:1e(){},26:1e(){},2I:1e(){},37:{},4J:{},4I:{}},1v=1e(){1e G(){i={1U:{}}}1e t(a,b){1a c=H.4q;"1s"!==1n b.4l&&(c=!b.4l);1j!(N.2j(a)&&!c)}1e O(){1a a=!1;1b("2q"===1m.1R.1T()&&""!==1m.1E.1J(/\\s/g,""))1i(1a b=I(2n.4g,"2e","1E",1m.1E),c=0;c<b.1g&&!a;)a=b[c].4h,c++;1q a=1m.4h;1j a}1e P(){1j""!=1m.1z.1J(/\\s/g,"")}1e N(){1j""===1m.1z.1J(/\\s/g,"")}1e Q(){1a a=!0;1b(1m.2d)1b("2b"===1m.2d.1T())a=0<1m.57;1q 1b("2Y"===1m.1R.1T()||"2q"===1m.1R.1T())a=O.2j(1m);1q 1b("2e"===1m.2d.1T()||"2y"===1m.2d.1T())"47"!=1m.1R.1T()&&(a=P.2j(1m));1j a}1e R(a){1a b={44:{2X:0,3c:1,3l:2},3T:{3c:0,3l:1,2X:2},3U:{3l:0,3c:1,2X:2}}[a.3W],c=a.4Y;"1s"===1n a.4Y&&(c=/\\//.25(1m.1z)?"/":/\\./.25(1m.1z)?".":/ /.25(1m.1z)?" ":/[^0-9]+/);1a d=1m.1z.2H(c),e=3X 3Y(d[b.2X],d[b.3c]-1,d[b.3l]),d=3X 3Y;"1s"!==1n a.55&&(d=a.55.2H(c),d=3X 3Y(d[b.2X],d[b.3c]-1,d[b.3l]));1j{45:e,3P:d}}1e 5m(a,b,c){1i(1a d=c.2N,e=[],f=0;f<d.1g;f++){1a k=d[f],w=q[k.1k],j={},i;1i(i 1l k.1o)k.1o.1F(i)&&"2c"!=i&&x(j,i,k.1o[i]);1b(0<c.1o.1g)1i(i 1l a)a.1F(i)&&"2c"!=i&&x(j,i,a[i]);1a m=S(b,1m.1H,w,j);m.4b||(j=T(1m.1H,w,j),k={1Q:b,5w:w,1t:h[w].1t,1u:h[w].1u,4P:k.1o,35:m.35,1d:j},c.38||(k.39=m.39||[]),e.1I(k))}1j e}1e D(a,b,c){1a d={1c:!0,1d:"",1f:1h};"28"==a.2d.1T()&&!h[b].1y?d={1c:!1,1d:m(a,b,"@"+b+" 1P 23 a 28 1M, 3p 2p 2W 3I 1p 2h 1Z 1p a 28"),1f:1h}:"28"!=a.2d.1T()&&h[b].1y?d={1c:!1,1d:m(a,b,"@"+b+" 1P a 28 1M, 3p 2p 2W 3I 1p 2h 1Z 1p a 4D-28 1Y"),1f:1h}:("1s"===1n a.1R||"2Y"!=a.1R.1T()&&"2q"!=a.1R.1T())&&"3a"==b?d={1c:!1,1d:m(a,b,"@"+b+" 1P 2a 5f 1p 6M 2k 2q 6L. 3O 2W 3I 1p 2h 1Z 1p 1S 2e 1Y 4o 1P 6K a 2Y 6J a 2q 47."),1f:1h}:"2b"!=a.2d.1T()&&"36"==b?d={1c:!1,1d:m(a,b,"@"+b+" 1P 2a 5f 1p 2b 6I. 3O 2W 3I 1p 2h 1Z 1p 1S 2e 1Y 4o 1P 23 a 2b 4O."),1f:1h}:(a=U(a,h[b],c),a.33?d={1c:!1,1d:a.1d,1f:1h}:d.1f=c);1j d}1e U(a,b,c){1a d={33:!1,1d:""};c.2c<b.1o.1g&&(d={33:!0,1d:m(a,q[b.1k],"@"+q[b.1k]+" 1K 6H 6G "+b.1o.1g+" 2g(s). 6D, 2p 2f 2o 2a "+c.2c),1f:1h});1i(1a e=[],f=0;f<b.1o.1g;f++){1a k=b.1o[f];"1s"===1n c[k]&&e.1I(k)}0<e.1g&&(d={33:!0,1d:m(a,q[b.1k],"3O 6C 1p 2f 2o 6z 6y 2m 4e 6x 1i @"+q[b.1k]+", 3p 2p 2W 6w 6u 1w 4M "+e.1g+" 4e 2g(s): "+J(e,", ")),1f:1h});1j d}1e V(a,b,c){1a d="",e=2G("^"+u[v.1U]+"$|^"+u[v.1U]+",|,"+u[v.1U]+",|,"+u[v.1U]+"$");c.1x||x(c,"1x",u[v.1U]);d=c.1x.1J(/\\s/g,"");e.25(d)||(d=u[v.1U]+","+d,c.1x=d);d=d.2H(/,/);1i(e=0;e<d.1g;e++){1a f=d[e];1b(!i[f]){1a k=-1,k=0<K.1g?K.6t():5j++;v[f]=k;u[k]=f;i[f]={}}i[f][a.1H]||(i[f][a.1H]={});i[f][a.1H][b]=c}}1e L(a,b){1i(1a c=!1,d=0;!c&&d<a.1g;)c=b==a[d],d++;1j c}1e J(a,b){1i(1a c="",d=0;d<a.1g;d++)c+=a[d]+b;1j c.1J(2G(b+"$"),"")}1e x(a,b,c){a.2c||(a.2c=0);a[b]||a.2c++;a[b]=c}1e W(a){1i(1a b 1l a)1b(a.1F(b))1j!1;1j!0}1e r(a){1a b="5q 5r: {",c;1i(c 1l a)a.1F(c)&&("24"==1n a[c]?b+=c+": "+a[c]+", ":a[c]2V 2w&&(b+=c+": ["+J(a[c],", ")+"], "));1j b=b.1J(/, $/,"")+"}"}1e m(a,b,c){1a d="";1h!=a?(d=a.1H,d=""==b||1h==b||4i 0==b?d+": ":d+("."+b+": ")):""!=b&&(1h!=b&&4i 0!=b)&&(d="@"+b+": ");1j d+c}1e M(a,b){1b(W(i[b][a])&&(2A i[b][a],W(i[b]))){2A i[b];1a c=v[b];2A v[b];2A u[c];K.1I(c)}}1e 4B(a,b){1e c(a){1j a?a.1J(/^\\s+/,"").1J(/\\s+$/,""):""}1e d(b){1a c={1c:!0,1d:"",1f:1h};1b(!/[A-3H-4E]/.25(b)||"1s"===1n b||1h==b)c={1c:!1,1d:m(a,l,"27 2Z 2F"),1f:1h};1j c}1e e(b){1a c={1c:!0,1d:"",1f:1h};/[0-4R-3H-4E]/.25(b)||(c={1c:!1,1d:m(a,l,"27 2F 1l 6s. 30 2a 31 0-9, A-Z, a-z, 2k 2C")+" "+c.1d,1f:1h});1j c}1e f(b){1a f,i=c(b.1C());0==i.1g&&(i=b.1C());f={1c:!1,1d:m(a,l,"27 2Z 2F 1i 2g 1E. 30 2a 31 A-Z, a-z, 2k 2C"),1f:1h};1b("1s"!==1n i)1b(f=d(i.2l(0)),f.1c){1i(1a g=1;g<i.1g&&f.1c;)f=e(i.2l(g)),g++;f.1c&&(f.1f=i)}1q f={1c:!1,1d:m(a,l,"27 2Z 2F 1i 2g 1E. 30 2a 31 A-Z, a-z, 2k 2C")+" "+f.1d,1f:1h};1b(f.1c)1b(i=f.1f,g=b.1C(),"="==g){0==c(b[0]).1g&&b.1C();g={1c:!0,1d:"",1f:[]};1b(")"==b[0])g={1c:!1,1d:m(a,l,"4d 1z 4a")+" "+g.1d,1f:1h};1q 1b(f=b.1C(),g={1c:!0,1d:"",1f:1h},"-"==f?(g=k(b),g.1c&&(g.1f=f+g.1f)):(b.2E(f),g={1c:!1,1d:m(a,l,"2t a 6r 32"),1f:1h}),f=g,f.1c||(f=k(b),f.1c||(f={1c:!1,1d:m(a,l,"4d 1z 1P 23 a 32")+" "+f.1d,1f:1h})),g=f,f=g.1d,!g.1c){1a g=b.1C(),h="",w={1c:!0,1d:"",1f:1h};1b(\'"\'==g){1i(1a j=!1;0<b.1g&&w.1c&&!j;)\'"\'==b[0]?(j=!0,b.1C()):(w=q(b),h+=w.1f);j||(w={1c:!1,1d:m(a,l,"5x 24 5y"),1f:1h})}1q b.2E(g),w={1c:!1,1d:m(a,l,"27 5z 24"),1f:1h};w.1c=w.1c&&j;w.1f=h;g=w;g.1d=g.1d+" "+f;f=g.1d;1b(!g.1c){j="";g=b.1C();h={1c:!0,1d:"",1f:1h};1b("/"==g){1i(1a j=g,n=!1;0<b.1g&&h.1c&&!n;)"/"==b[0]?(j+=b.1C(),n=!0):(h=q(b),j+=h.1f);n||(h={1c:!1,1d:m(a,l,"5x 2O 5y"),1f:1h})}1q b.2E(g),h={1c:!1,1d:m(a,l,"2t a 4k 4m"),1f:1h};h.1c=h.1c&&n;h.1f=j;g=h;g.1d=g.1d+" "+f;f=g.1d;1b(!g.1c&&(n=b.1C(),j={1c:!0,1d:"",1f:1h},"4n"==c(n)||"6q"==c(n)?j={1c:!0,1d:"",1f:"4n"===n}:(b.2E(n),j={Line truncated
|
||||
|
||||
regula.custom({
|
||||
name:'JustLetters'
|
||||
,validator:function(){
|
||||
return /^[a-zA-Z'][a-zA-Z-' ]+[a-zA-Z']?$/.test(this.value)
|
||||
}
|
||||
})
|
||||
regula.custom({
|
||||
name:'JustNumbers'
|
||||
,validator:function(){
|
||||
return /^\+?(\d[\d\-\+\(\) ]{5,}\d$)/.test(this.value)
|
||||
}
|
||||
})
|
||||
$(window).load(function(){
|
||||
$('#contact-form').TMForm({
|
||||
ownerEmail:'#'
|
||||
})
|
||||
|
||||
})
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
/* ==========================================================
|
||||
* bootstrap-affix.js v2.2.2
|
||||
* http://twitter.github.com/bootstrap/javascript.html#affix
|
||||
* ==========================================================
|
||||
* Copyright 2012 Twitter, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* ========================================================== */
|
||||
|
||||
|
||||
!function ($) {
|
||||
|
||||
"use strict"; // jshint ;_;
|
||||
|
||||
|
||||
/* AFFIX CLASS DEFINITION
|
||||
* ====================== */
|
||||
|
||||
var Affix = function (element, options) {
|
||||
this.options = $.extend({}, $.fn.affix.defaults, options)
|
||||
this.$window = $(window)
|
||||
.on('scroll.affix.data-api', $.proxy(this.checkPosition, this))
|
||||
.on('click.affix.data-api', $.proxy(function () { setTimeout($.proxy(this.checkPosition, this), 1) }, this))
|
||||
this.$element = $(element)
|
||||
this.checkPosition()
|
||||
}
|
||||
|
||||
Affix.prototype.checkPosition = function () {
|
||||
if (!this.$element.is(':visible')) return
|
||||
|
||||
var scrollHeight = $(document).height()
|
||||
, scrollTop = this.$window.scrollTop()
|
||||
, position = this.$element.offset()
|
||||
, offset = this.options.offset
|
||||
, offsetBottom = offset.bottom
|
||||
, offsetTop = offset.top
|
||||
, reset = 'affix affix-top affix-bottom'
|
||||
, affix
|
||||
|
||||
if (typeof offset != 'object') offsetBottom = offsetTop = offset
|
||||
if (typeof offsetTop == 'function') offsetTop = offset.top()
|
||||
if (typeof offsetBottom == 'function') offsetBottom = offset.bottom()
|
||||
|
||||
affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ?
|
||||
false : offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ?
|
||||
'bottom' : offsetTop != null && scrollTop <= offsetTop ?
|
||||
'top' : false
|
||||
|
||||
if (this.affixed === affix) return
|
||||
|
||||
this.affixed = affix
|
||||
this.unpin = affix == 'bottom' ? position.top - scrollTop : null
|
||||
|
||||
this.$element.removeClass(reset).addClass('affix' + (affix ? '-' + affix : ''))
|
||||
}
|
||||
|
||||
|
||||
/* AFFIX PLUGIN DEFINITION
|
||||
* ======================= */
|
||||
|
||||
var old = $.fn.affix
|
||||
|
||||
$.fn.affix = function (option) {
|
||||
return this.each(function () {
|
||||
var $this = $(this)
|
||||
, data = $this.data('affix')
|
||||
, options = typeof option == 'object' && option
|
||||
if (!data) $this.data('affix', (data = new Affix(this, options)))
|
||||
if (typeof option == 'string') data[option]()
|
||||
})
|
||||
}
|
||||
|
||||
$.fn.affix.Constructor = Affix
|
||||
|
||||
$.fn.affix.defaults = {
|
||||
offset: 0
|
||||
}
|
||||
|
||||
|
||||
/* AFFIX NO CONFLICT
|
||||
* ================= */
|
||||
|
||||
$.fn.affix.noConflict = function () {
|
||||
$.fn.affix = old
|
||||
return this
|
||||
}
|
||||
|
||||
|
||||
/* AFFIX DATA-API
|
||||
* ============== */
|
||||
|
||||
$(window).on('load', function () {
|
||||
$('[data-spy="affix"]').each(function () {
|
||||
var $spy = $(this)
|
||||
, data = $spy.data()
|
||||
|
||||
data.offset = data.offset || {}
|
||||
|
||||
data.offsetBottom && (data.offset.bottom = data.offsetBottom)
|
||||
data.offsetTop && (data.offset.top = data.offsetTop)
|
||||
|
||||
$spy.affix(data)
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
}(window.jQuery);
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
HTML5 Shiv v3.6.2pre | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
|
||||
*/
|
||||
(function(l,f){function m(){var a=e.elements;return"string"==typeof a?a.split(" "):a}function i(a){var b=n[a[o]];b||(b={},h++,a[o]=h,n[h]=b);return b}function p(a,b,c){b||(b=f);if(g)return b.createElement(a);c||(c=i(b));b=c.cache[a]?c.cache[a].cloneNode():r.test(a)?(c.cache[a]=c.createElem(a)).cloneNode():c.createElem(a);return b.canHaveChildren&&!s.test(a)?c.frag.appendChild(b):b}function t(a,b){if(!b.cache)b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag();
|
||||
a.createElement=function(c){return!e.shivMethods?b.createElem(c):p(c,a,b)};a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+m().join().replace(/\w+/g,function(a){b.createElem(a);b.frag.createElement(a);return'c("'+a+'")'})+");return n}")(e,b.frag)}function q(a){a||(a=f);var b=i(a);if(e.shivCSS&&!j&&!b.hasCSS){var c,d=a;c=d.createElement("p");d=d.getElementsByTagName("head")[0]||d.documentElement;c.innerHTML="x<style>article,aside,figcaption,figure,footer,header,hgroup,nav,section{display:block}mark{background:#FF0;color:#000}</style>";
|
||||
c=d.insertBefore(c.lastChild,d.firstChild);b.hasCSS=!!c}g||t(a,b);return a}var k=l.html5||{},s=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,r=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,j,o="_html5shiv",h=0,n={},g;(function(){try{var a=f.createElement("a");a.innerHTML="<xyz></xyz>";j="hidden"in a;var b;if(!(b=1==a.childNodes.length)){f.createElement("a");var c=f.createDocumentFragment();b="undefined"==typeof c.cloneNode||
|
||||
"undefined"==typeof c.createDocumentFragment||"undefined"==typeof c.createElement}g=b}catch(d){g=j=!0}})();var e={elements:k.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",version:"3.6.2pre",shivCSS:!1!==k.shivCSS,supportsUnknownElements:g,shivMethods:!1!==k.shivMethods,type:"default",shivDocument:q,createElement:p,createDocumentFragment:function(a,b){a||(a=f);if(g)return a.createDocumentFragment();
|
||||
for(var b=b||i(a),c=b.frag.cloneNode(),d=0,e=m(),h=e.length;d<h;d++)c.createElement(e[d]);return c}};l.html5=e;q(f)})(this,document);
|
||||
@@ -0,0 +1,496 @@
|
||||
/*!
|
||||
* jQuery Migrate - v1.1.0 - 2013-01-31
|
||||
* https://github.com/jquery/jquery-migrate
|
||||
* Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors; Licensed MIT
|
||||
*/
|
||||
(function( jQuery, window, undefined ) {
|
||||
"use strict";
|
||||
|
||||
|
||||
var warnedAbout = {};
|
||||
|
||||
// List of warnings already given; public read only
|
||||
jQuery.migrateWarnings = [];
|
||||
|
||||
// Set to true to prevent console output; migrateWarnings still maintained
|
||||
// jQuery.migrateMute = false;
|
||||
|
||||
// Show a message on the console so devs know we're active
|
||||
if ( !jQuery.migrateMute && window.console && console.log ) {
|
||||
console.log("JQMIGRATE: Logging is active");
|
||||
}
|
||||
|
||||
// Set to false to disable traces that appear with warnings
|
||||
if ( jQuery.migrateTrace === undefined ) {
|
||||
jQuery.migrateTrace = true;
|
||||
}
|
||||
|
||||
// Forget any warnings we've already given; public
|
||||
jQuery.migrateReset = function() {
|
||||
warnedAbout = {};
|
||||
jQuery.migrateWarnings.length = 0;
|
||||
};
|
||||
|
||||
function migrateWarn( msg) {
|
||||
if ( !warnedAbout[ msg ] ) {
|
||||
warnedAbout[ msg ] = true;
|
||||
jQuery.migrateWarnings.push( msg );
|
||||
if ( window.console && console.warn && !jQuery.migrateMute ) {
|
||||
console.warn( "JQMIGRATE: " + msg );
|
||||
if ( jQuery.migrateTrace && console.trace ) {
|
||||
console.trace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function migrateWarnProp( obj, prop, value, msg ) {
|
||||
if ( Object.defineProperty ) {
|
||||
// On ES5 browsers (non-oldIE), warn if the code tries to get prop;
|
||||
// allow property to be overwritten in case some other plugin wants it
|
||||
try {
|
||||
Object.defineProperty( obj, prop, {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
migrateWarn( msg );
|
||||
return value;
|
||||
},
|
||||
set: function( newValue ) {
|
||||
migrateWarn( msg );
|
||||
value = newValue;
|
||||
}
|
||||
});
|
||||
return;
|
||||
} catch( err ) {
|
||||
// IE8 is a dope about Object.defineProperty, can't warn there
|
||||
}
|
||||
}
|
||||
|
||||
// Non-ES5 (or broken) browser; just set the property
|
||||
jQuery._definePropertyBroken = true;
|
||||
obj[ prop ] = value;
|
||||
}
|
||||
|
||||
if ( document.compatMode === "BackCompat" ) {
|
||||
// jQuery has never supported or tested Quirks Mode
|
||||
migrateWarn( "jQuery is not compatible with Quirks Mode" );
|
||||
}
|
||||
|
||||
|
||||
var attrFn = {},
|
||||
oldAttr = jQuery.attr,
|
||||
valueAttrGet = jQuery.attrHooks.value && jQuery.attrHooks.value.get ||
|
||||
function() { return null; },
|
||||
valueAttrSet = jQuery.attrHooks.value && jQuery.attrHooks.value.set ||
|
||||
function() { return undefined; },
|
||||
rnoType = /^(?:input|button)$/i,
|
||||
rnoAttrNodeType = /^[238]$/,
|
||||
rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
|
||||
ruseDefault = /^(?:checked|selected)$/i;
|
||||
|
||||
// jQuery.attrFn
|
||||
migrateWarnProp( jQuery, "attrFn", attrFn, "jQuery.attrFn is deprecated" );
|
||||
|
||||
jQuery.attr = function( elem, name, value, pass ) {
|
||||
var lowerName = name.toLowerCase(),
|
||||
nType = elem && elem.nodeType;
|
||||
|
||||
// Since pass is used internally, we only warn and shim for new jQuery
|
||||
// versions where there isn't a pass arg in the formal params
|
||||
if ( pass && oldAttr.length < 4 ) {
|
||||
migrateWarn("jQuery.fn.attr( props, pass ) is deprecated");
|
||||
if ( elem && !rnoAttrNodeType.test( nType ) && jQuery.isFunction( jQuery.fn[ name ] ) ) {
|
||||
return jQuery( elem )[ name ]( value );
|
||||
}
|
||||
}
|
||||
|
||||
// Warn if user tries to set `type`, since it breaks on IE 6/7/8; by checking
|
||||
// for disconnected elements we don't warn on $( "<button>", { type: "button" } ).
|
||||
if ( name === "type" && value !== undefined && rnoType.test( elem.nodeName ) && elem.parentNode ) {
|
||||
migrateWarn("Can't change the 'type' of an input or button in IE 6/7/8");
|
||||
}
|
||||
|
||||
// Restore boolHook for boolean property/attribute synchronization
|
||||
if ( !jQuery.attrHooks[ lowerName ] && rboolean.test( lowerName ) ) {
|
||||
jQuery.attrHooks[ lowerName ] = {
|
||||
get: function( elem, name ) {
|
||||
// Align boolean attributes with corresponding properties
|
||||
// Fall back to attribute presence where some booleans are not supported
|
||||
var attrNode,
|
||||
property = jQuery.prop( elem, name );
|
||||
return property === true || typeof property !== "boolean" &&
|
||||
( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ?
|
||||
|
||||
name.toLowerCase() :
|
||||
undefined;
|
||||
},
|
||||
set: function( elem, value, name ) {
|
||||
var propName;
|
||||
if ( value === false ) {
|
||||
// Remove boolean attributes when set to false
|
||||
jQuery.removeAttr( elem, name );
|
||||
} else {
|
||||
// value is true since we know at this point it's type boolean and not false
|
||||
// Set boolean attributes to the same name and set the DOM property
|
||||
propName = jQuery.propFix[ name ] || name;
|
||||
if ( propName in elem ) {
|
||||
// Only set the IDL specifically if it already exists on the element
|
||||
elem[ propName ] = true;
|
||||
}
|
||||
|
||||
elem.setAttribute( name, name.toLowerCase() );
|
||||
}
|
||||
return name;
|
||||
}
|
||||
};
|
||||
|
||||
// Warn only for attributes that can remain distinct from their properties post-1.9
|
||||
if ( ruseDefault.test( lowerName ) ) {
|
||||
migrateWarn( "jQuery.fn.attr('" + lowerName + "') may use property instead of attribute" );
|
||||
}
|
||||
}
|
||||
|
||||
return oldAttr.call( jQuery, elem, name, value );
|
||||
};
|
||||
|
||||
// attrHooks: value
|
||||
jQuery.attrHooks.value = {
|
||||
get: function( elem, name ) {
|
||||
var nodeName = ( elem.nodeName || "" ).toLowerCase();
|
||||
if ( nodeName === "button" ) {
|
||||
return valueAttrGet.apply( this, arguments );
|
||||
}
|
||||
if ( nodeName !== "input" && nodeName !== "option" ) {
|
||||
migrateWarn("jQuery.fn.attr('value') no longer gets properties");
|
||||
}
|
||||
return name in elem ?
|
||||
elem.value :
|
||||
null;
|
||||
},
|
||||
set: function( elem, value ) {
|
||||
var nodeName = ( elem.nodeName || "" ).toLowerCase();
|
||||
if ( nodeName === "button" ) {
|
||||
return valueAttrSet.apply( this, arguments );
|
||||
}
|
||||
if ( nodeName !== "input" && nodeName !== "option" ) {
|
||||
migrateWarn("jQuery.fn.attr('value', val) no longer sets properties");
|
||||
}
|
||||
// Does not return so that setAttribute is also used
|
||||
elem.value = value;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
var matched, browser,
|
||||
oldInit = jQuery.fn.init,
|
||||
oldParseJSON = jQuery.parseJSON,
|
||||
// Note this does NOT include the #9521 XSS fix from 1.7!
|
||||
rquickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*|#([\w\-]*))$/;
|
||||
|
||||
// $(html) "looks like html" rule change
|
||||
jQuery.fn.init = function( selector, context, rootjQuery ) {
|
||||
var match;
|
||||
|
||||
if ( selector && typeof selector === "string" && !jQuery.isPlainObject( context ) &&
|
||||
(match = rquickExpr.exec( selector )) && match[1] ) {
|
||||
// This is an HTML string according to the "old" rules; is it still?
|
||||
if ( selector.charAt( 0 ) !== "<" ) {
|
||||
migrateWarn("$(html) HTML strings must start with '<' character");
|
||||
}
|
||||
// Now process using loose rules; let pre-1.8 play too
|
||||
if ( context && context.context ) {
|
||||
// jQuery object as context; parseHTML expects a DOM object
|
||||
context = context.context;
|
||||
}
|
||||
if ( jQuery.parseHTML ) {
|
||||
return oldInit.call( this, jQuery.parseHTML( jQuery.trim(selector), context, true ),
|
||||
context, rootjQuery );
|
||||
}
|
||||
}
|
||||
return oldInit.apply( this, arguments );
|
||||
};
|
||||
jQuery.fn.init.prototype = jQuery.fn;
|
||||
|
||||
// Let $.parseJSON(falsy_value) return null
|
||||
jQuery.parseJSON = function( json ) {
|
||||
if ( !json && json !== null ) {
|
||||
migrateWarn("jQuery.parseJSON requires a valid JSON string");
|
||||
return null;
|
||||
}
|
||||
return oldParseJSON.apply( this, arguments );
|
||||
};
|
||||
|
||||
jQuery.uaMatch = function( ua ) {
|
||||
ua = ua.toLowerCase();
|
||||
|
||||
var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
|
||||
/(webkit)[ \/]([\w.]+)/.exec( ua ) ||
|
||||
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
|
||||
/(msie) ([\w.]+)/.exec( ua ) ||
|
||||
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
|
||||
[];
|
||||
|
||||
return {
|
||||
browser: match[ 1 ] || "",
|
||||
version: match[ 2 ] || "0"
|
||||
};
|
||||
};
|
||||
|
||||
matched = jQuery.uaMatch( navigator.userAgent );
|
||||
browser = {};
|
||||
|
||||
if ( matched.browser ) {
|
||||
browser[ matched.browser ] = true;
|
||||
browser.version = matched.version;
|
||||
}
|
||||
|
||||
// Chrome is Webkit, but Webkit is also Safari.
|
||||
if ( browser.chrome ) {
|
||||
browser.webkit = true;
|
||||
} else if ( browser.webkit ) {
|
||||
browser.safari = true;
|
||||
}
|
||||
|
||||
jQuery.browser = browser;
|
||||
|
||||
// Warn if the code tries to get jQuery.browser
|
||||
migrateWarnProp( jQuery, "browser", browser, "jQuery.browser is deprecated" );
|
||||
|
||||
jQuery.sub = function() {
|
||||
function jQuerySub( selector, context ) {
|
||||
return new jQuerySub.fn.init( selector, context );
|
||||
}
|
||||
jQuery.extend( true, jQuerySub, this );
|
||||
jQuerySub.superclass = this;
|
||||
jQuerySub.fn = jQuerySub.prototype = this();
|
||||
jQuerySub.fn.constructor = jQuerySub;
|
||||
jQuerySub.sub = this.sub;
|
||||
jQuerySub.fn.init = function init( selector, context ) {
|
||||
if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {
|
||||
context = jQuerySub( context );
|
||||
}
|
||||
|
||||
return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
|
||||
};
|
||||
jQuerySub.fn.init.prototype = jQuerySub.fn;
|
||||
var rootjQuerySub = jQuerySub(document);
|
||||
migrateWarn( "jQuery.sub() is deprecated" );
|
||||
return jQuerySub;
|
||||
};
|
||||
|
||||
|
||||
var oldFnData = jQuery.fn.data;
|
||||
|
||||
jQuery.fn.data = function( name ) {
|
||||
var ret, evt,
|
||||
elem = this[0];
|
||||
|
||||
// Handles 1.7 which has this behavior and 1.8 which doesn't
|
||||
if ( elem && name === "events" && arguments.length === 1 ) {
|
||||
ret = jQuery.data( elem, name );
|
||||
evt = jQuery._data( elem, name );
|
||||
if ( ( ret === undefined || ret === evt ) && evt !== undefined ) {
|
||||
migrateWarn("Use of jQuery.fn.data('events') is deprecated");
|
||||
return evt;
|
||||
}
|
||||
}
|
||||
return oldFnData.apply( this, arguments );
|
||||
};
|
||||
|
||||
|
||||
var rscriptType = /\/(java|ecma)script/i,
|
||||
oldSelf = jQuery.fn.andSelf || jQuery.fn.addBack;
|
||||
|
||||
jQuery.fn.andSelf = function() {
|
||||
migrateWarn("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()");
|
||||
return oldSelf.apply( this, arguments );
|
||||
};
|
||||
|
||||
// Since jQuery.clean is used internally on older versions, we only shim if it's missing
|
||||
if ( !jQuery.clean ) {
|
||||
jQuery.clean = function( elems, context, fragment, scripts ) {
|
||||
// Set context per 1.8 logic
|
||||
context = context || document;
|
||||
context = !context.nodeType && context[0] || context;
|
||||
context = context.ownerDocument || context;
|
||||
|
||||
migrateWarn("jQuery.clean() is deprecated");
|
||||
|
||||
var i, elem, handleScript, jsTags,
|
||||
ret = [];
|
||||
|
||||
jQuery.merge( ret, jQuery.buildFragment( elems, context ).childNodes );
|
||||
|
||||
// Complex logic lifted directly from jQuery 1.8
|
||||
if ( fragment ) {
|
||||
// Special handling of each script element
|
||||
handleScript = function( elem ) {
|
||||
// Check if we consider it executable
|
||||
if ( !elem.type || rscriptType.test( elem.type ) ) {
|
||||
// Detach the script and store it in the scripts array (if provided) or the fragment
|
||||
// Return truthy to indicate that it has been handled
|
||||
return scripts ?
|
||||
scripts.push( elem.parentNode ? elem.parentNode.removeChild( elem ) : elem ) :
|
||||
fragment.appendChild( elem );
|
||||
}
|
||||
};
|
||||
|
||||
for ( i = 0; (elem = ret[i]) != null; i++ ) {
|
||||
// Check if we're done after handling an executable script
|
||||
if ( !( jQuery.nodeName( elem, "script" ) && handleScript( elem ) ) ) {
|
||||
// Append to fragment and handle embedded scripts
|
||||
fragment.appendChild( elem );
|
||||
if ( typeof elem.getElementsByTagName !== "undefined" ) {
|
||||
// handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration
|
||||
jsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName("script") ), handleScript );
|
||||
|
||||
// Splice the scripts into ret after their former ancestor and advance our index beyond them
|
||||
ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
|
||||
i += jsTags.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
};
|
||||
}
|
||||
|
||||
var eventAdd = jQuery.event.add,
|
||||
eventRemove = jQuery.event.remove,
|
||||
eventTrigger = jQuery.event.trigger,
|
||||
oldToggle = jQuery.fn.toggle,
|
||||
oldLive = jQuery.fn.live,
|
||||
oldDie = jQuery.fn.die,
|
||||
ajaxEvents = "ajaxStart|ajaxStop|ajaxSend|ajaxComplete|ajaxError|ajaxSuccess",
|
||||
rajaxEvent = new RegExp( "\\b(?:" + ajaxEvents + ")\\b" ),
|
||||
rhoverHack = /(?:^|\s)hover(\.\S+|)\b/,
|
||||
hoverHack = function( events ) {
|
||||
if ( typeof( events ) != "string" || jQuery.event.special.hover ) {
|
||||
return events;
|
||||
}
|
||||
if ( rhoverHack.test( events ) ) {
|
||||
migrateWarn("'hover' pseudo-event is deprecated, use 'mouseenter mouseleave'");
|
||||
}
|
||||
return events && events.replace( rhoverHack, "mouseenter$1 mouseleave$1" );
|
||||
};
|
||||
|
||||
// Event props removed in 1.9, put them back if needed; no practical way to warn them
|
||||
if ( jQuery.event.props && jQuery.event.props[ 0 ] !== "attrChange" ) {
|
||||
jQuery.event.props.unshift( "attrChange", "attrName", "relatedNode", "srcElement" );
|
||||
}
|
||||
|
||||
// Undocumented jQuery.event.handle was "deprecated" in jQuery 1.7
|
||||
if ( jQuery.event.dispatch ) {
|
||||
migrateWarnProp( jQuery.event, "handle", jQuery.event.dispatch, "jQuery.event.handle is undocumented and deprecated" );
|
||||
}
|
||||
|
||||
// Support for 'hover' pseudo-event and ajax event warnings
|
||||
jQuery.event.add = function( elem, types, handler, data, selector ){
|
||||
if ( elem !== document && rajaxEvent.test( types ) ) {
|
||||
migrateWarn( "AJAX events should be attached to document: " + types );
|
||||
}
|
||||
eventAdd.call( this, elem, hoverHack( types || "" ), handler, data, selector );
|
||||
};
|
||||
jQuery.event.remove = function( elem, types, handler, selector, mappedTypes ){
|
||||
eventRemove.call( this, elem, hoverHack( types ) || "", handler, selector, mappedTypes );
|
||||
};
|
||||
|
||||
jQuery.fn.error = function() {
|
||||
var args = Array.prototype.slice.call( arguments, 0);
|
||||
migrateWarn("jQuery.fn.error() is deprecated");
|
||||
args.splice( 0, 0, "error" );
|
||||
if ( arguments.length ) {
|
||||
return this.bind.apply( this, args );
|
||||
}
|
||||
// error event should not bubble to window, although it does pre-1.7
|
||||
this.triggerHandler.apply( this, args );
|
||||
return this;
|
||||
};
|
||||
|
||||
jQuery.fn.toggle = function( fn, fn2 ) {
|
||||
|
||||
// Don't mess with animation or css toggles
|
||||
if ( !jQuery.isFunction( fn ) || !jQuery.isFunction( fn2 ) ) {
|
||||
return oldToggle.apply( this, arguments );
|
||||
}
|
||||
migrateWarn("jQuery.fn.toggle(handler, handler...) is deprecated");
|
||||
|
||||
// Save reference to arguments for access in closure
|
||||
var args = arguments,
|
||||
guid = fn.guid || jQuery.guid++,
|
||||
i = 0,
|
||||
toggler = function( event ) {
|
||||
// Figure out which function to execute
|
||||
var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
|
||||
jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
|
||||
|
||||
// Make sure that clicks stop
|
||||
event.preventDefault();
|
||||
|
||||
// and execute the function
|
||||
return args[ lastToggle ].apply( this, arguments ) || false;
|
||||
};
|
||||
|
||||
// link all the functions, so any of them can unbind this click handler
|
||||
toggler.guid = guid;
|
||||
while ( i < args.length ) {
|
||||
args[ i++ ].guid = guid;
|
||||
}
|
||||
|
||||
return this.click( toggler );
|
||||
};
|
||||
|
||||
jQuery.fn.live = function( types, data, fn ) {
|
||||
migrateWarn("jQuery.fn.live() is deprecated");
|
||||
if ( oldLive ) {
|
||||
return oldLive.apply( this, arguments );
|
||||
}
|
||||
jQuery( this.context ).on( types, this.selector, data, fn );
|
||||
return this;
|
||||
};
|
||||
|
||||
jQuery.fn.die = function( types, fn ) {
|
||||
migrateWarn("jQuery.fn.die() is deprecated");
|
||||
if ( oldDie ) {
|
||||
return oldDie.apply( this, arguments );
|
||||
}
|
||||
jQuery( this.context ).off( types, this.selector || "**", fn );
|
||||
return this;
|
||||
};
|
||||
|
||||
// Turn global events into document-triggered events
|
||||
jQuery.event.trigger = function( event, data, elem, onlyHandlers ){
|
||||
if ( !elem & !rajaxEvent.test( event ) ) {
|
||||
migrateWarn( "Global events are undocumented and deprecated" );
|
||||
}
|
||||
return eventTrigger.call( this, event, data, elem || document, onlyHandlers );
|
||||
};
|
||||
jQuery.each( ajaxEvents.split("|"),
|
||||
function( _, name ) {
|
||||
jQuery.event.special[ name ] = {
|
||||
setup: function() {
|
||||
var elem = this;
|
||||
|
||||
// The document needs no shimming; must be !== for oldIE
|
||||
if ( elem !== document ) {
|
||||
jQuery.event.add( document, name + "." + jQuery.guid, function() {
|
||||
jQuery.event.trigger( name, null, elem, true );
|
||||
});
|
||||
jQuery._data( this, name, jQuery.guid++ );
|
||||
}
|
||||
return false;
|
||||
},
|
||||
teardown: function() {
|
||||
if ( this !== document ) {
|
||||
jQuery.event.remove( document, name + "." + jQuery._data( this, name ) );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
})( jQuery, window );
|
||||
+114
@@ -0,0 +1,114 @@
|
||||
/*!
|
||||
* jQuery Cookie Plugin v1.4.0
|
||||
* https://github.com/carhartl/jquery-cookie
|
||||
*
|
||||
* Copyright 2013 Klaus Hartl
|
||||
* Released under the MIT license
|
||||
*/
|
||||
(function (factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as anonymous module.
|
||||
define(['jquery'], factory);
|
||||
} else {
|
||||
// Browser globals.
|
||||
factory(jQuery);
|
||||
}
|
||||
}(function ($) {
|
||||
|
||||
var pluses = /\+/g;
|
||||
|
||||
function encode(s) {
|
||||
return config.raw ? s : encodeURIComponent(s);
|
||||
}
|
||||
|
||||
function decode(s) {
|
||||
return config.raw ? s : decodeURIComponent(s);
|
||||
}
|
||||
|
||||
function stringifyCookieValue(value) {
|
||||
return encode(config.json ? JSON.stringify(value) : String(value));
|
||||
}
|
||||
|
||||
function parseCookieValue(s) {
|
||||
if (s.indexOf('"') === 0) {
|
||||
// This is a quoted cookie as according to RFC2068, unescape...
|
||||
s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
|
||||
}
|
||||
|
||||
try {
|
||||
// Replace server-side written pluses with spaces.
|
||||
// If we can't decode the cookie, ignore it, it's unusable.
|
||||
// If we can't parse the cookie, ignore it, it's unusable.
|
||||
s = decodeURIComponent(s.replace(pluses, ' '));
|
||||
return config.json ? JSON.parse(s) : s;
|
||||
} catch(e) {}
|
||||
}
|
||||
|
||||
function read(s, converter) {
|
||||
var value = config.raw ? s : parseCookieValue(s);
|
||||
return $.isFunction(converter) ? converter(value) : value;
|
||||
}
|
||||
|
||||
var config = $.cookie = function (key, value, options) {
|
||||
|
||||
// Write
|
||||
|
||||
if (value !== undefined && !$.isFunction(value)) {
|
||||
options = $.extend({}, config.defaults, options);
|
||||
|
||||
if (typeof options.expires === 'number') {
|
||||
var days = options.expires, t = options.expires = new Date();
|
||||
t.setTime(+t + days * 864e+5);
|
||||
}
|
||||
|
||||
return (document.cookie = [
|
||||
encode(key), '=', stringifyCookieValue(value),
|
||||
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
|
||||
options.path ? '; path=' + options.path : '',
|
||||
options.domain ? '; domain=' + options.domain : '',
|
||||
options.secure ? '; secure' : ''
|
||||
].join(''));
|
||||
}
|
||||
|
||||
// Read
|
||||
|
||||
var result = key ? undefined : {};
|
||||
|
||||
// To prevent the for loop in the first place assign an empty array
|
||||
// in case there are no cookies at all. Also prevents odd result when
|
||||
// calling $.cookie().
|
||||
var cookies = document.cookie ? document.cookie.split('; ') : [];
|
||||
|
||||
for (var i = 0, l = cookies.length; i < l; i++) {
|
||||
var parts = cookies[i].split('=');
|
||||
var name = decode(parts.shift());
|
||||
var cookie = parts.join('=');
|
||||
|
||||
if (key && key === name) {
|
||||
// If second argument (value) is a function it's a converter...
|
||||
result = read(cookie, value);
|
||||
break;
|
||||
}
|
||||
|
||||
// Prevent storing a cookie that we couldn't decode.
|
||||
if (!key && (cookie = read(cookie)) !== undefined) {
|
||||
result[name] = cookie;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
config.defaults = {};
|
||||
|
||||
$.removeCookie = function (key, options) {
|
||||
if ($.cookie(key) === undefined) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Must not alter options, thus extending a fresh object...
|
||||
$.cookie(key, '', $.extend({}, options, { expires: -1 }));
|
||||
return !$.cookie(key);
|
||||
};
|
||||
|
||||
}));
|
||||
@@ -0,0 +1,295 @@
|
||||
/**
|
||||
* Copyright (C) 2012 Chris Wharton (chris@weare2ndfloor.com)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT
|
||||
* HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR
|
||||
* FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE
|
||||
* OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS,
|
||||
* COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.COPYRIGHT HOLDERS WILL NOT
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL
|
||||
* DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://gnu.org/licenses/>.
|
||||
|
||||
Documentation available at http://cookiecuttr.com
|
||||
|
||||
*/
|
||||
(function ($) {
|
||||
$.cookieCuttr = function (options) {
|
||||
var defaults = {
|
||||
cookieCutter: true, // you'd like to enable the div/section/span etc. hide feature? change this to true
|
||||
cookieCutterDeclineOnly: false, // you'd like the CookieCutter to only hide when someone has clicked declined set this to true
|
||||
cookieAnalytics: true, // just using a simple analytics package? change this to true
|
||||
cookieDeclineButton: true, // this will disable non essential cookies
|
||||
cookieAcceptButton: true, // this will disable non essential cookies
|
||||
cookieResetButton: false,
|
||||
cookieOverlayEnabled: false, // don't want a discreet toolbar? Fine, set this to true
|
||||
cookiePolicyLink: '/privacy-policy/', // if applicable, enter the link to your privacy policy here...
|
||||
cookieMessage: 'We use cookies on this website, you can <a href="{{cookiePolicyLink}}" title="read about our cookies">read about them here</a>. To use the website as intended please...',
|
||||
cookieAnalyticsMessage: 'We use cookies, just to track visits to our website, we store no personal details.',
|
||||
cookieErrorMessage: "We\'re sorry, this feature places cookies in your browser and has been disabled. <br>To continue using this functionality, please",
|
||||
cookieWhatAreTheyLink: "http://www.allaboutcookies.org/",
|
||||
cookieDisable: '',
|
||||
cookieExpires: 365,
|
||||
cookieAcceptButtonText: "ACCEPT COOKIES",
|
||||
cookieDeclineButtonText: "DECLINE COOKIES",
|
||||
cookieResetButtonText: "RESET COOKIES FOR THIS WEBSITE",
|
||||
cookieWhatAreLinkText: "What are cookies?",
|
||||
cookieNotificationLocationBottom: false, // top or bottom - they are your only options, so true for bottom, false for top
|
||||
cookiePolicyPage: false,
|
||||
cookiePolicyPageMessage: 'Please read the information below and then choose from the following options',
|
||||
cookieDiscreetLink: false,
|
||||
cookieDiscreetReset: false,
|
||||
cookieDiscreetLinkText: "Cookies?",
|
||||
cookieDiscreetPosition: "topleft", //options: topleft, topright, bottomleft, bottomright
|
||||
cookieNoMessage: false, // change to true hide message from all pages apart from your policy page
|
||||
cookieDomain: ""
|
||||
};
|
||||
var options = $.extend(defaults, options);
|
||||
var message = defaults.cookieMessage.replace('{{cookiePolicyLink}}', defaults.cookiePolicyLink);
|
||||
defaults.cookieMessage = 'We use cookies on this website, you can <a href="' + defaults.cookiePolicyLink + '" title="read about our cookies">read about them here</a>. To use the website as intended please...';
|
||||
//convert options
|
||||
var cookiePolicyLinkIn = options.cookiePolicyLink;
|
||||
var cookieCutter = options.cookieCutter;
|
||||
var cookieCutterDeclineOnly = options.cookieCutterDeclineOnly;
|
||||
var cookieAnalytics = options.cookieAnalytics;
|
||||
var cookieDeclineButton = options.cookieDeclineButton;
|
||||
var cookieAcceptButton = options.cookieAcceptButton;
|
||||
var cookieResetButton = options.cookieResetButton;
|
||||
var cookieOverlayEnabled = options.cookieOverlayEnabled;
|
||||
var cookiePolicyLink = options.cookiePolicyLink;
|
||||
var cookieMessage = message;
|
||||
var cookieAnalyticsMessage = options.cookieAnalyticsMessage;
|
||||
var cookieErrorMessage = options.cookieErrorMessage;
|
||||
var cookieDisable = options.cookieDisable;
|
||||
var cookieWhatAreTheyLink = options.cookieWhatAreTheyLink;
|
||||
var cookieExpires = options.cookieExpires;
|
||||
var cookieAcceptButtonText = options.cookieAcceptButtonText;
|
||||
var cookieDeclineButtonText = options.cookieDeclineButtonText;
|
||||
var cookieResetButtonText = options.cookieResetButtonText;
|
||||
var cookieWhatAreLinkText = options.cookieWhatAreLinkText;
|
||||
var cookieNotificationLocationBottom = options.cookieNotificationLocationBottom;
|
||||
var cookiePolicyPage = options.cookiePolicyPage;
|
||||
var cookiePolicyPageMessage = options.cookiePolicyPageMessage;
|
||||
var cookieDiscreetLink = options.cookieDiscreetLink;
|
||||
var cookieDiscreetReset = options.cookieDiscreetReset;
|
||||
var cookieDiscreetLinkText = options.cookieDiscreetLinkText;
|
||||
var cookieDiscreetPosition = options.cookieDiscreetPosition;
|
||||
var cookieNoMessage = options.cookieNoMessage;
|
||||
// cookie identifier
|
||||
var $cookieAccepted = $.cookie('cc_cookie_accept') == "cc_cookie_accept";
|
||||
$.cookieAccepted = function () {
|
||||
return $cookieAccepted;
|
||||
};
|
||||
var $cookieDeclined = $.cookie('cc_cookie_decline') == "cc_cookie_decline";
|
||||
$.cookieDeclined = function () {
|
||||
return $cookieDeclined;
|
||||
};
|
||||
// write cookie accept button
|
||||
if (cookieAcceptButton) {
|
||||
var cookieAccept = ' <a href="#accept" class="cc-cookie-accept">' + cookieAcceptButtonText + '</a> ';
|
||||
} else {
|
||||
var cookieAccept = "";
|
||||
}
|
||||
// write cookie decline button
|
||||
if (cookieDeclineButton) {
|
||||
var cookieDecline = ' <a href="#decline" class="cc-cookie-decline">' + cookieDeclineButtonText + '</a> ';
|
||||
} else {
|
||||
var cookieDecline = "";
|
||||
}
|
||||
// write extra class for overlay
|
||||
if (cookieOverlayEnabled) {
|
||||
var cookieOverlay = 'cc-overlay';
|
||||
} else {
|
||||
var cookieOverlay = "";
|
||||
}
|
||||
// to prepend or append, that is the question?
|
||||
if ((cookieNotificationLocationBottom) || (cookieDiscreetPosition == "bottomright") || (cookieDiscreetPosition == "bottomleft")) {
|
||||
var appOrPre = true;
|
||||
} else {
|
||||
var appOrPre = false;
|
||||
}
|
||||
if (($cookieAccepted) || ($cookieDeclined)) {
|
||||
// write cookie reset button
|
||||
if ((cookieResetButton) && (cookieDiscreetReset)) {
|
||||
if (appOrPre) {
|
||||
$('body').append('<div class="cc-cookies cc-discreet"><a class="cc-cookie-reset" href="#" title="' + cookieResetButtonText + '">' + cookieResetButtonText + '</a></div>');
|
||||
} else {
|
||||
$('body').prepend('<div class="cc-cookies cc-discreet"><a class="cc-cookie-reset" href="#" title="' + cookieResetButtonText + '">' + cookieResetButtonText + '</a></div>');
|
||||
}
|
||||
//add appropriate CSS depending on position chosen
|
||||
if (cookieDiscreetPosition == "topleft") {
|
||||
$('div.cc-cookies').css("top", "0");
|
||||
$('div.cc-cookies').css("left", "0");
|
||||
}
|
||||
if (cookieDiscreetPosition == "topright") {
|
||||
$('div.cc-cookies').css("top", "0");
|
||||
$('div.cc-cookies').css("right", "0");
|
||||
}
|
||||
if (cookieDiscreetPosition == "bottomleft") {
|
||||
$('div.cc-cookies').css("bottom", "0");
|
||||
$('div.cc-cookies').css("left", "0");
|
||||
}
|
||||
if (cookieDiscreetPosition == "bottomright") {
|
||||
$('div.cc-cookies').css("bottom", "0");
|
||||
$('div.cc-cookies').css("right", "0");
|
||||
}
|
||||
} else if (cookieResetButton) {
|
||||
if (appOrPre) {
|
||||
$('body').append('<div class="cc-cookies"><a href="#" class="cc-cookie-reset">' + cookieResetButtonText + '</a></div>');
|
||||
} else {
|
||||
$('body').prepend('<div class="cc-cookies"><a href="#" class="cc-cookie-reset">' + cookieResetButtonText + '</a></div>');
|
||||
}
|
||||
} else {
|
||||
var cookieResetButton = "";
|
||||
}
|
||||
} else {
|
||||
// add message to just after opening body tag
|
||||
if ((cookieNoMessage) && (!cookiePolicyPage)) {
|
||||
// show no link on any pages APART from the policy page
|
||||
} else if ((cookieDiscreetLink) && (!cookiePolicyPage)) { // show discreet link
|
||||
if (appOrPre) {
|
||||
$('body').append('<div class="cc-cookies cc-discreet"><a href="' + cookiePolicyLinkIn + '" title="' + cookieDiscreetLinkText + '">' + cookieDiscreetLinkText + '</a></div>');
|
||||
} else {
|
||||
$('body').prepend('<div class="cc-cookies cc-discreet"><a href="' + cookiePolicyLinkIn + '" title="' + cookieDiscreetLinkText + '">' + cookieDiscreetLinkText + '</a></div>');
|
||||
}
|
||||
//add appropriate CSS depending on position chosen
|
||||
if (cookieDiscreetPosition == "topleft") {
|
||||
$('div.cc-cookies').css("top", "0");
|
||||
$('div.cc-cookies').css("left", "0");
|
||||
}
|
||||
if (cookieDiscreetPosition == "topright") {
|
||||
$('div.cc-cookies').css("top", "0");
|
||||
$('div.cc-cookies').css("right", "0");
|
||||
}
|
||||
if (cookieDiscreetPosition == "bottomleft") {
|
||||
$('div.cc-cookies').css("bottom", "0");
|
||||
$('div.cc-cookies').css("left", "0");
|
||||
}
|
||||
if (cookieDiscreetPosition == "bottomright") {
|
||||
$('div.cc-cookies').css("bottom", "0");
|
||||
$('div.cc-cookies').css("right", "0");
|
||||
}
|
||||
} else if (cookieAnalytics) { // show analytics overlay
|
||||
if (appOrPre) {
|
||||
$('body').append('<div class="cc-cookies ' + cookieOverlay + '">' + cookieAnalyticsMessage + cookieAccept + cookieDecline + '<a href="' + cookieWhatAreTheyLink + '" title="Visit All about cookies (External link)">' + cookieWhatAreLinkText + '</a></div>');
|
||||
} else {
|
||||
$('body').prepend('<div class="cc-cookies ' + cookieOverlay + '">' + cookieAnalyticsMessage + cookieAccept + cookieDecline + '<a href="' + cookieWhatAreTheyLink + '" title="Visit All about cookies (External link)">' + cookieWhatAreLinkText + '</a></div>');
|
||||
}
|
||||
}
|
||||
if (cookiePolicyPage) { // show policy page overlay
|
||||
if (appOrPre) {
|
||||
$('body').append('<div class="cc-cookies ' + cookieOverlay + '">' + cookiePolicyPageMessage + " " + ' <a href="#accept" class="cc-cookie-accept">' + cookieAcceptButtonText + '</a> ' + ' <a href="#decline" class="cc-cookie-decline">' + cookieDeclineButtonText + '</a> ' + '</div>');
|
||||
} else {
|
||||
$('body').prepend('<div class="cc-cookies ' + cookieOverlay + '">' + cookiePolicyPageMessage + " " + ' <a href="#accept" class="cc-cookie-accept">' + cookieAcceptButtonText + '</a> ' + ' <a href="#decline" class="cc-cookie-decline">' + cookieDeclineButtonText + '</a> ' + '</div>');
|
||||
}
|
||||
} else if ((!cookieAnalytics) && (!cookieDiscreetLink)) { // show privacy policy option
|
||||
if (appOrPre) {
|
||||
$('body').append('<div class="cc-cookies ' + cookieOverlay + '">' + cookieMessage + cookieAccept + cookieDecline + '</div>');
|
||||
} else {
|
||||
$('body').prepend('<div class="cc-cookies ' + cookieOverlay + '">' + cookieMessage + cookieAccept + cookieDecline + '</div>');
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((cookieCutter) && (!cookieCutterDeclineOnly) && (($cookieDeclined) || (!$cookieAccepted))) {
|
||||
$(cookieDisable).html('<div class="cc-cookies-error">' + cookieErrorMessage + ' <a href="#accept" class="cc-cookie-accept">' + cookieAcceptButtonText + '</a> ' + '</div>');
|
||||
}
|
||||
if ((cookieCutter) && (cookieCutterDeclineOnly) && ($cookieDeclined)) {
|
||||
$(cookieDisable).html('<div class="cc-cookies-error">' + cookieErrorMessage + ' <a href="#accept" class="cc-cookie-accept">' + cookieAcceptButtonText + '</a> ' + '</div>');
|
||||
}
|
||||
// if bottom is true, switch div to bottom if not in discreet mode
|
||||
if ((cookieNotificationLocationBottom) && (!cookieDiscreetLink)) {
|
||||
$('div.cc-cookies').css("top", "auto");
|
||||
$('div.cc-cookies').css("bottom", "0");
|
||||
$('div.cc-cookies').css("position", "fixed");
|
||||
}
|
||||
if ((cookieNotificationLocationBottom) && (cookieDiscreetLink) && (cookiePolicyPage)) {
|
||||
$('div.cc-cookies').css("top", "auto");
|
||||
$('div.cc-cookies').css("bottom", "0");
|
||||
$('div.cc-cookies').css("position", "fixed");
|
||||
}
|
||||
// setting the cookies
|
||||
|
||||
// for top bar
|
||||
$('.cc-cookie-accept, .cc-cookie-decline').click(function (e) {
|
||||
e.preventDefault();
|
||||
if ($(this).is('[href$=#decline]')) {
|
||||
$.cookie("cc_cookie_accept", null, {
|
||||
path: '/'
|
||||
});
|
||||
$.cookie("cc_cookie_decline", "cc_cookie_decline", {
|
||||
expires: cookieExpires,
|
||||
path: '/'
|
||||
});
|
||||
if (options.cookieDomain) {
|
||||
// kill google analytics cookies
|
||||
$.cookie("__utma", null, {
|
||||
domain: '.' + options.cookieDomain,
|
||||
path: '/'
|
||||
});
|
||||
$.cookie("__utmb", null, {
|
||||
domain: '.' + options.cookieDomain,
|
||||
path: '/'
|
||||
});
|
||||
$.cookie("__utmc", null, {
|
||||
domain: '.' + options.cookieDomain,
|
||||
path: '/'
|
||||
});
|
||||
$.cookie("__utmz", null, {
|
||||
domain: '.' + options.cookieDomain,
|
||||
path: '/'
|
||||
});
|
||||
}
|
||||
} else {
|
||||
$.cookie("cc_cookie_decline", null, {
|
||||
path: '/'
|
||||
});
|
||||
$.cookie("cc_cookie_accept", "cc_cookie_accept", {
|
||||
expires: cookieExpires,
|
||||
path: '/'
|
||||
});
|
||||
}
|
||||
$(".cc-cookies").fadeOut(function () {
|
||||
// reload page to activate cookies
|
||||
location.reload();
|
||||
});
|
||||
});
|
||||
//reset cookies
|
||||
$('a.cc-cookie-reset').click(function (f) {
|
||||
f.preventDefault();
|
||||
$.cookie("cc_cookie_accept", null, {
|
||||
path: '/'
|
||||
});
|
||||
$.cookie("cc_cookie_decline", null, {
|
||||
path: '/'
|
||||
});
|
||||
$(".cc-cookies").fadeOut(function () {
|
||||
// reload page to activate cookies
|
||||
location.reload();
|
||||
});
|
||||
});
|
||||
//cookie error accept
|
||||
$('.cc-cookies-error a.cc-cookie-accept').click(function (g) {
|
||||
g.preventDefault();
|
||||
$.cookie("cc_cookie_accept", "cc_cookie_accept", {
|
||||
expires: cookieExpires,
|
||||
path: '/'
|
||||
});
|
||||
$.cookie("cc_cookie_decline", null, {
|
||||
path: '/'
|
||||
});
|
||||
// reload page to activate cookies
|
||||
location.reload();
|
||||
});
|
||||
};
|
||||
})(jQuery);
|
||||
$(document).ready(function () {
|
||||
$.cookieCuttr();
|
||||
});
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
/* jquery-countdown - v0.2 - See un-minified version for license etc */
|
||||
jQuery.fn.countdown=function(g){var b={stepTime:60,format:"dd:hh:mm:ss",startTime:"01:12:32:55",digitImages:6,digitWidth:53,digitHeight:77,timerEnd:function(){},image:"digits.png"};var f=[],a;var c=function(o){var q=0;var w=0;var h=0;var x=0;if(typeof b.startTime=="object"){var j=new Date();if(b.startTime.getTime()<j.getTime()){b.startTime.setFullYear(b.startTime.getFullYear()+1)}var k=Math.ceil((b.startTime.getTime()-j.getTime())/1000);var u=Math.floor(k/86400);var s=Math.floor((k%86400)/3600);var m=Math.floor(((k%86400)%3600)/60);var t=((k%86400)%3600)%60;b.startTime=u+":"+s+":"+m+":"+t}_startTime=b.startTime.split("");cCounter=0;for(var n=0;n<_startTime.length;n++){if(isNaN(parseInt(_startTime[n]))){cCounter=cCounter+1}}var p=b.startTime.split(":");var v="";for(var n=0;n<p.length;n++){var r=59;if(p.length==3){if(n==0){r=23}}if(p.length==4){if(n==0){r=9999}if(n==1){r=23}}if(p[n]>r){p[n]=r}if(p[n].length<2){p[n]="0"+p[n]}}b.startTime=p.join(":");switch(cCounter){case 3:if(b.startTime.split(":")[0].length==3){b.format="ddd:hh:mm:ss"}else{b.format="dd:hh:mm:ss"}break;case 2:b.format="hh:mm:ss";break;case 1:b.format="mm:ss";break;case 0:b.format="ss";break}b.startTime=b.startTime.split("");b.format=b.format.split("");for(var n=0;n<b.startTime.length;n++){if(parseInt(b.startTime[n])>=0){var l=jQuery('<div id="cnt_'+n+'" class="cntDigit" />').css({height:b.digitHeight*b.digitImages*10,"float":"left",background:"url('"+b.image+"')",width:b.digitWidth});f.push(l);e(q,-((parseInt(b.startTime[n])*b.digitHeight*b.digitImages)));f[q].__max=9;switch(b.format[n]){case"h":if(w<1){f[q].__max=2;w=1}else{f[q].__condmax=3}break;case"d":f[q].__max=9;break;case"m":if(h<1){f[q].__max=5;h=1}else{f[q].__condmax=9}break;case"s":if(x<1){f[q].__max=5;x=1}else{f[q].__condmax=9}break}++q}else{l=jQuery('<div class="cntSeparator"/>').css({"float":"left"}).text(b.startTime[n])}o.append("<div>");o.append(l);o.append("</div>")}};var e=function(h,i){if(i!==undefined){return f[h].css({marginTop:i+"px"})}return parseInt(f[h].css("marginTop").replace("px",""))};var d=function(h){f[h]._digitInitial=-(f[h].__max*b.digitHeight*b.digitImages);return function i(){mtop=e(h)+b.digitHeight;if(mtop==b.digitHeight){e(h,f[h]._digitInitial);if(h>0){d(h-1)()}else{clearInterval(a);for(var j=0;j<f.length;j++){e(j,0)}b.timerEnd();return}if((h>0)&&(f[h].__condmax!==undefined)&&(f[h-1]._digitInitial==e(h-1))){e(h,-(f[h].__condmax*b.digitHeight*b.digitImages))}return}e(h,mtop);if(e(h)/b.digitHeight%b.digitImages!=0){setTimeout(i,b.stepTime)}if(mtop==0){f[h].__ismax=true}}};$.extend(b,g);this.css({height:b.digitHeight,overflow:"hidden"});c(this);a=setInterval(d(f.length-1),1000)};
|
||||
|
||||
$(document).ready(function(){
|
||||
var _date=new Date()
|
||||
,countdown_to={
|
||||
year:2013
|
||||
,month:6 /* January = 0, February = 1, March = 2, April = 3, May = 4, June = 5, July = 6, August = 7, September = 8, October = 9, November = 10, December = 11 */
|
||||
,date:13
|
||||
,hours:0
|
||||
,minutes:15
|
||||
,seconds:00
|
||||
}
|
||||
|
||||
_date.setFullYear(countdown_to.year,countdown_to.month,countdown_to.date)
|
||||
_date.setHours(countdown_to.hours)
|
||||
_date.setMinutes(countdown_to.minutes)
|
||||
_date.setSeconds(countdown_to.seconds)
|
||||
|
||||
/*code for demonstration*/
|
||||
_date=new Date()
|
||||
_date.setMonth(_date.getMonth()+8)
|
||||
/*end code for demonstration*/
|
||||
|
||||
$('#counter').countdown({
|
||||
image: 'img/digits_inverted.png',
|
||||
startTime: _date,
|
||||
stepTime: 35
|
||||
});
|
||||
$('#counter1').countdown({
|
||||
image: 'img/digits.png',
|
||||
startTime: _date,
|
||||
stepTime: 35
|
||||
});
|
||||
$('#counter2').countdown({
|
||||
image: 'img/digits2.png',
|
||||
startTime: _date,
|
||||
stepTime: 35
|
||||
});
|
||||
$('#counter3').countdown({
|
||||
image: 'img/digits2_blue.png',
|
||||
startTime: _date,
|
||||
stepTime: 35
|
||||
});
|
||||
$('#counter4').countdown({
|
||||
image: 'img/digits2_green.png',
|
||||
startTime: _date,
|
||||
stepTime: 35
|
||||
});
|
||||
$('#counter5').countdown({
|
||||
image: 'img/digits2_orange.png',
|
||||
startTime: _date,
|
||||
stepTime: 35
|
||||
});
|
||||
$('#counter6').countdown({
|
||||
image: 'img/digits2_purple.png',
|
||||
startTime: _date,
|
||||
stepTime: 35
|
||||
});
|
||||
$('#counter7').countdown({
|
||||
image: 'img/digits2_red.png',
|
||||
startTime: _date,
|
||||
stepTime: 35
|
||||
});
|
||||
$('#counter8').countdown({
|
||||
image: 'img/digits2_yellow.png',
|
||||
startTime: _date,
|
||||
stepTime: 35
|
||||
});
|
||||
$('#counter9').countdown({
|
||||
image: 'img/digits_inverted.png',
|
||||
startTime: _date,
|
||||
stepTime: 35
|
||||
});
|
||||
});
|
||||
@@ -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,896 @@
|
||||
/*
|
||||
* jQuery FlexSlider v2.1
|
||||
* http://www.woothemes.com/flexslider/
|
||||
*
|
||||
* Copyright 2012 WooThemes
|
||||
* Free to use under the GPLv2 license.
|
||||
* http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* Contributing author: Tyler Smith (@mbmufffin)
|
||||
*/
|
||||
|
||||
;(function ($) {
|
||||
|
||||
//FlexSlider: Object Instance
|
||||
$.flexslider = function(el, options) {
|
||||
var slider = $(el),
|
||||
vars = $.extend({}, $.flexslider.defaults, options),
|
||||
namespace = vars.namespace,
|
||||
touch = ("ontouchstart" in window) || window.DocumentTouch && document instanceof DocumentTouch,
|
||||
eventType = (touch) ? "touchend" : "click",
|
||||
vertical = vars.direction === "vertical",
|
||||
reverse = vars.reverse,
|
||||
carousel = (vars.itemWidth > 0),
|
||||
fade = vars.animation === "fade",
|
||||
asNav = vars.asNavFor !== "",
|
||||
methods = {};
|
||||
|
||||
// Store a reference to the slider object
|
||||
$.data(el, "flexslider", slider);
|
||||
|
||||
// Privat slider methods
|
||||
methods = {
|
||||
init: function() {
|
||||
slider.animating = false;
|
||||
slider.currentSlide = vars.startAt;
|
||||
slider.animatingTo = slider.currentSlide;
|
||||
slider.atEnd = (slider.currentSlide === 0 || slider.currentSlide === slider.last);
|
||||
slider.containerSelector = vars.selector.substr(0,vars.selector.search(' '));
|
||||
slider.slides = $(vars.selector, slider);
|
||||
slider.container = $(slider.containerSelector, slider);
|
||||
slider.count = slider.slides.length;
|
||||
// SYNC:
|
||||
slider.syncExists = $(vars.sync).length > 0;
|
||||
// SLIDE:
|
||||
if (vars.animation === "slide") vars.animation = "swing";
|
||||
slider.prop = (vertical) ? "top" : "marginLeft";
|
||||
slider.args = {};
|
||||
// SLIDESHOW:
|
||||
slider.manualPause = false;
|
||||
// TOUCH/USECSS:
|
||||
slider.transitions = !vars.video && !fade && vars.useCSS && (function() {
|
||||
var obj = document.createElement('div'),
|
||||
props = ['perspectiveProperty', 'WebkitPerspective', 'MozPerspective', 'OPerspective', 'msPerspective'];
|
||||
for (var i in props) {
|
||||
if ( obj.style[ props[i] ] !== undefined ) {
|
||||
slider.pfx = props[i].replace('Perspective','').toLowerCase();
|
||||
slider.prop = "-" + slider.pfx + "-transform";
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}());
|
||||
// CONTROLSCONTAINER:
|
||||
if (vars.controlsContainer !== "") slider.controlsContainer = $(vars.controlsContainer).length > 0 && $(vars.controlsContainer);
|
||||
// MANUAL:
|
||||
if (vars.manualControls !== "") slider.manualControls = $(vars.manualControls).length > 0 && $(vars.manualControls);
|
||||
|
||||
// RANDOMIZE:
|
||||
if (vars.randomize) {
|
||||
slider.slides.sort(function() { return (Math.round(Math.random())-0.5); });
|
||||
slider.container.empty().append(slider.slides);
|
||||
}
|
||||
|
||||
slider.doMath();
|
||||
|
||||
// ASNAV:
|
||||
if (asNav) methods.asNav.setup();
|
||||
|
||||
// INIT
|
||||
slider.setup("init");
|
||||
|
||||
// CONTROLNAV:
|
||||
if (vars.controlNav) methods.controlNav.setup();
|
||||
|
||||
// DIRECTIONNAV:
|
||||
if (vars.directionNav) methods.directionNav.setup();
|
||||
|
||||
// KEYBOARD:
|
||||
if (vars.keyboard && ($(slider.containerSelector).length === 1 || vars.multipleKeyboard)) {
|
||||
$(document).bind('keyup', function(event) {
|
||||
var keycode = event.keyCode;
|
||||
if (!slider.animating && (keycode === 39 || keycode === 37)) {
|
||||
var target = (keycode === 39) ? slider.getTarget('next') :
|
||||
(keycode === 37) ? slider.getTarget('prev') : false;
|
||||
slider.flexAnimate(target, vars.pauseOnAction);
|
||||
}
|
||||
});
|
||||
}
|
||||
// MOUSEWHEEL:
|
||||
if (vars.mousewheel) {
|
||||
slider.bind('mousewheel', function(event, delta, deltaX, deltaY) {
|
||||
event.preventDefault();
|
||||
var target = (delta < 0) ? slider.getTarget('next') : slider.getTarget('prev');
|
||||
slider.flexAnimate(target, vars.pauseOnAction);
|
||||
});
|
||||
}
|
||||
|
||||
// PAUSEPLAY
|
||||
if (vars.pausePlay) methods.pausePlay.setup();
|
||||
|
||||
// SLIDSESHOW
|
||||
if (vars.slideshow) {
|
||||
if (vars.pauseOnHover) {
|
||||
slider.hover(function() {
|
||||
if (!slider.manualPlay && !slider.manualPause) slider.pause();
|
||||
}, function() {
|
||||
if (!slider.manualPause && !slider.manualPlay) slider.play();
|
||||
});
|
||||
}
|
||||
// initialize animation
|
||||
(vars.initDelay > 0) ? setTimeout(slider.play, vars.initDelay) : slider.play();
|
||||
}
|
||||
|
||||
// TOUCH
|
||||
if (touch && vars.touch) methods.touch();
|
||||
|
||||
// FADE&&SMOOTHHEIGHT || SLIDE:
|
||||
if (!fade || (fade && vars.smoothHeight)) $(window).bind("resize focus", methods.resize);
|
||||
|
||||
|
||||
// API: start() Callback
|
||||
setTimeout(function(){
|
||||
vars.start(slider);
|
||||
}, 200);
|
||||
},
|
||||
asNav: {
|
||||
setup: function() {
|
||||
slider.asNav = true;
|
||||
slider.animatingTo = Math.floor(slider.currentSlide/slider.move);
|
||||
slider.currentItem = slider.currentSlide;
|
||||
slider.slides.removeClass(namespace + "active-slide").eq(slider.currentItem).addClass(namespace + "active-slide");
|
||||
slider.slides.click(function(e){
|
||||
e.preventDefault();
|
||||
var $slide = $(this),
|
||||
target = $slide.index();
|
||||
if (!$(vars.asNavFor).data('flexslider').animating && !$slide.hasClass('active')) {
|
||||
slider.direction = (slider.currentItem < target) ? "next" : "prev";
|
||||
slider.flexAnimate(target, vars.pauseOnAction, false, true, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
controlNav: {
|
||||
setup: function() {
|
||||
if (!slider.manualControls) {
|
||||
methods.controlNav.setupPaging();
|
||||
} else { // MANUALCONTROLS:
|
||||
methods.controlNav.setupManual();
|
||||
}
|
||||
},
|
||||
setupPaging: function() {
|
||||
var type = (vars.controlNav === "thumbnails") ? 'control-thumbs' : 'control-paging',
|
||||
j = 1,
|
||||
item;
|
||||
|
||||
slider.controlNavScaffold = $('<ol class="'+ namespace + 'control-nav ' + namespace + type + '"></ol>');
|
||||
|
||||
if (slider.pagingCount > 1) {
|
||||
for (var i = 0; i < slider.pagingCount; i++) {
|
||||
item = (vars.controlNav === "thumbnails") ? '<img src="' + slider.slides.eq(i).attr("data-thumb") + '"/>' : '<a>' + j + '</a>';
|
||||
slider.controlNavScaffold.append('<li>' + item + '</li>');
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
// CONTROLSCONTAINER:
|
||||
(slider.controlsContainer) ? $(slider.controlsContainer).append(slider.controlNavScaffold) : slider.append(slider.controlNavScaffold);
|
||||
methods.controlNav.set();
|
||||
|
||||
methods.controlNav.active();
|
||||
|
||||
slider.controlNavScaffold.delegate('a, img', eventType, function(event) {
|
||||
event.preventDefault();
|
||||
var $this = $(this),
|
||||
target = slider.controlNav.index($this);
|
||||
|
||||
if (!$this.hasClass(namespace + 'active')) {
|
||||
slider.direction = (target > slider.currentSlide) ? "next" : "prev";
|
||||
slider.flexAnimate(target, vars.pauseOnAction);
|
||||
}
|
||||
});
|
||||
// Prevent iOS click event bug
|
||||
if (touch) {
|
||||
slider.controlNavScaffold.delegate('a', "click touchstart", function(event) {
|
||||
event.preventDefault();
|
||||
});
|
||||
}
|
||||
},
|
||||
setupManual: function() {
|
||||
slider.controlNav = slider.manualControls;
|
||||
methods.controlNav.active();
|
||||
|
||||
slider.controlNav.live(eventType, function(event) {
|
||||
event.preventDefault();
|
||||
var $this = $(this),
|
||||
target = slider.controlNav.index($this);
|
||||
|
||||
if (!$this.hasClass(namespace + 'active')) {
|
||||
(target > slider.currentSlide) ? slider.direction = "next" : slider.direction = "prev";
|
||||
slider.flexAnimate(target, vars.pauseOnAction);
|
||||
}
|
||||
});
|
||||
// Prevent iOS click event bug
|
||||
if (touch) {
|
||||
slider.controlNav.live("click touchstart", function(event) {
|
||||
event.preventDefault();
|
||||
});
|
||||
}
|
||||
},
|
||||
set: function() {
|
||||
var selector = (vars.controlNav === "thumbnails") ? 'img' : 'a';
|
||||
slider.controlNav = $('.' + namespace + 'control-nav li ' + selector, (slider.controlsContainer) ? slider.controlsContainer : slider);
|
||||
},
|
||||
active: function() {
|
||||
slider.controlNav.removeClass(namespace + "active").eq(slider.animatingTo).addClass(namespace + "active");
|
||||
},
|
||||
update: function(action, pos) {
|
||||
if (slider.pagingCount > 1 && action === "add") {
|
||||
slider.controlNavScaffold.append($('<li><a>' + slider.count + '</a></li>'));
|
||||
} else if (slider.pagingCount === 1) {
|
||||
slider.controlNavScaffold.find('li').remove();
|
||||
} else {
|
||||
slider.controlNav.eq(pos).closest('li').remove();
|
||||
}
|
||||
methods.controlNav.set();
|
||||
(slider.pagingCount > 1 && slider.pagingCount !== slider.controlNav.length) ? slider.update(pos, action) : methods.controlNav.active();
|
||||
}
|
||||
},
|
||||
directionNav: {
|
||||
setup: function() {
|
||||
var directionNavScaffold = $('<ul class="' + namespace + 'direction-nav"><li><a class="' + namespace + 'prev" href="#">' + vars.prevText + '</a></li><li><a class="' + namespace + 'next" href="#">' + vars.nextText + '</a></li></ul>');
|
||||
|
||||
// CONTROLSCONTAINER:
|
||||
if (slider.controlsContainer) {
|
||||
$(slider.controlsContainer).append(directionNavScaffold);
|
||||
slider.directionNav = $('.' + namespace + 'direction-nav li a', slider.controlsContainer);
|
||||
} else {
|
||||
slider.append(directionNavScaffold);
|
||||
slider.directionNav = $('.' + namespace + 'direction-nav li a', slider);
|
||||
}
|
||||
|
||||
methods.directionNav.update();
|
||||
|
||||
slider.directionNav.bind(eventType, function(event) {
|
||||
event.preventDefault();
|
||||
var target = ($(this).hasClass(namespace + 'next')) ? slider.getTarget('next') : slider.getTarget('prev');
|
||||
slider.flexAnimate(target, vars.pauseOnAction);
|
||||
});
|
||||
// Prevent iOS click event bug
|
||||
if (touch) {
|
||||
slider.directionNav.bind("click touchstart", function(event) {
|
||||
event.preventDefault();
|
||||
});
|
||||
}
|
||||
},
|
||||
update: function() {
|
||||
var disabledClass = namespace + 'disabled';
|
||||
if (slider.pagingCount === 1) {
|
||||
slider.directionNav.addClass(disabledClass);
|
||||
} else if (!vars.animationLoop) {
|
||||
if (slider.animatingTo === 0) {
|
||||
slider.directionNav.removeClass(disabledClass).filter('.' + namespace + "prev").addClass(disabledClass);
|
||||
} else if (slider.animatingTo === slider.last) {
|
||||
slider.directionNav.removeClass(disabledClass).filter('.' + namespace + "next").addClass(disabledClass);
|
||||
} else {
|
||||
slider.directionNav.removeClass(disabledClass);
|
||||
}
|
||||
} else {
|
||||
slider.directionNav.removeClass(disabledClass);
|
||||
}
|
||||
}
|
||||
},
|
||||
pausePlay: {
|
||||
setup: function() {
|
||||
var pausePlayScaffold = $('<div class="' + namespace + 'pauseplay"><a></a></div>');
|
||||
|
||||
// CONTROLSCONTAINER:
|
||||
if (slider.controlsContainer) {
|
||||
slider.controlsContainer.append(pausePlayScaffold);
|
||||
slider.pausePlay = $('.' + namespace + 'pauseplay a', slider.controlsContainer);
|
||||
} else {
|
||||
slider.append(pausePlayScaffold);
|
||||
slider.pausePlay = $('.' + namespace + 'pauseplay a', slider);
|
||||
}
|
||||
|
||||
methods.pausePlay.update((vars.slideshow) ? namespace + 'pause' : namespace + 'play');
|
||||
|
||||
slider.pausePlay.bind(eventType, function(event) {
|
||||
event.preventDefault();
|
||||
if ($(this).hasClass(namespace + 'pause')) {
|
||||
slider.manualPause = true;
|
||||
slider.manualPlay = false;
|
||||
slider.pause();
|
||||
} else {
|
||||
slider.manualPause = false;
|
||||
slider.manualPlay = true;
|
||||
slider.play();
|
||||
}
|
||||
});
|
||||
// Prevent iOS click event bug
|
||||
if (touch) {
|
||||
slider.pausePlay.bind("click touchstart", function(event) {
|
||||
event.preventDefault();
|
||||
});
|
||||
}
|
||||
},
|
||||
update: function(state) {
|
||||
(state === "play") ? slider.pausePlay.removeClass(namespace + 'pause').addClass(namespace + 'play').text(vars.playText) : slider.pausePlay.removeClass(namespace + 'play').addClass(namespace + 'pause').text(vars.pauseText);
|
||||
}
|
||||
},
|
||||
touch: function() {
|
||||
var startX,
|
||||
startY,
|
||||
offset,
|
||||
cwidth,
|
||||
dx,
|
||||
startT,
|
||||
scrolling = false;
|
||||
|
||||
el.addEventListener('touchstart', onTouchStart, false);
|
||||
function onTouchStart(e) {
|
||||
if (slider.animating) {
|
||||
e.preventDefault();
|
||||
} else if (e.touches.length === 1) {
|
||||
slider.pause();
|
||||
// CAROUSEL:
|
||||
cwidth = (vertical) ? slider.h : slider. w;
|
||||
startT = Number(new Date());
|
||||
// CAROUSEL:
|
||||
offset = (carousel && reverse && slider.animatingTo === slider.last) ? 0 :
|
||||
(carousel && reverse) ? slider.limit - (((slider.itemW + vars.itemMargin) * slider.move) * slider.animatingTo) :
|
||||
(carousel && slider.currentSlide === slider.last) ? slider.limit :
|
||||
(carousel) ? ((slider.itemW + vars.itemMargin) * slider.move) * slider.currentSlide :
|
||||
(reverse) ? (slider.last - slider.currentSlide + slider.cloneOffset) * cwidth : (slider.currentSlide + slider.cloneOffset) * cwidth;
|
||||
startX = (vertical) ? e.touches[0].pageY : e.touches[0].pageX;
|
||||
startY = (vertical) ? e.touches[0].pageX : e.touches[0].pageY;
|
||||
|
||||
el.addEventListener('touchmove', onTouchMove, false);
|
||||
el.addEventListener('touchend', onTouchEnd, false);
|
||||
}
|
||||
}
|
||||
|
||||
function onTouchMove(e) {
|
||||
dx = (vertical) ? startX - e.touches[0].pageY : startX - e.touches[0].pageX;
|
||||
scrolling = (vertical) ? (Math.abs(dx) < Math.abs(e.touches[0].pageX - startY)) : (Math.abs(dx) < Math.abs(e.touches[0].pageY - startY));
|
||||
|
||||
if (!scrolling || Number(new Date()) - startT > 500) {
|
||||
e.preventDefault();
|
||||
if (!fade && slider.transitions) {
|
||||
if (!vars.animationLoop) {
|
||||
dx = dx/((slider.currentSlide === 0 && dx < 0 || slider.currentSlide === slider.last && dx > 0) ? (Math.abs(dx)/cwidth+2) : 1);
|
||||
}
|
||||
slider.setProps(offset + dx, "setTouch");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onTouchEnd(e) {
|
||||
// finish the touch by undoing the touch session
|
||||
el.removeEventListener('touchmove', onTouchMove, false);
|
||||
|
||||
if (slider.animatingTo === slider.currentSlide && !scrolling && !(dx === null)) {
|
||||
var updateDx = (reverse) ? -dx : dx,
|
||||
target = (updateDx > 0) ? slider.getTarget('next') : slider.getTarget('prev');
|
||||
|
||||
if (slider.canAdvance(target) && (Number(new Date()) - startT < 550 && Math.abs(updateDx) > 50 || Math.abs(updateDx) > cwidth/2)) {
|
||||
slider.flexAnimate(target, vars.pauseOnAction);
|
||||
} else {
|
||||
if (!fade) slider.flexAnimate(slider.currentSlide, vars.pauseOnAction, true);
|
||||
}
|
||||
}
|
||||
el.removeEventListener('touchend', onTouchEnd, false);
|
||||
startX = null;
|
||||
startY = null;
|
||||
dx = null;
|
||||
offset = null;
|
||||
}
|
||||
},
|
||||
resize: function() {
|
||||
if (!slider.animating && slider.is(':visible')) {
|
||||
if (!carousel) slider.doMath();
|
||||
|
||||
if (fade) {
|
||||
// SMOOTH HEIGHT:
|
||||
methods.smoothHeight();
|
||||
} else if (carousel) { //CAROUSEL:
|
||||
slider.slides.width(slider.computedW);
|
||||
slider.update(slider.pagingCount);
|
||||
slider.setProps();
|
||||
}
|
||||
else if (vertical) { //VERTICAL:
|
||||
slider.viewport.height(slider.h);
|
||||
slider.setProps(slider.h, "setTotal");
|
||||
} else {
|
||||
// SMOOTH HEIGHT:
|
||||
if (vars.smoothHeight) methods.smoothHeight();
|
||||
slider.newSlides.width(slider.computedW);
|
||||
slider.setProps(slider.computedW, "setTotal");
|
||||
}
|
||||
}
|
||||
},
|
||||
smoothHeight: function(dur) {
|
||||
if (!vertical || fade) {
|
||||
var $obj = (fade) ? slider : slider.viewport;
|
||||
(dur) ? $obj.animate({"height": slider.slides.eq(slider.animatingTo).height()}, dur) : $obj.height(slider.slides.eq(slider.animatingTo).height());
|
||||
}
|
||||
},
|
||||
sync: function(action) {
|
||||
var $obj = $(vars.sync).data("flexslider"),
|
||||
target = slider.animatingTo;
|
||||
|
||||
switch (action) {
|
||||
case "animate": $obj.flexAnimate(target, vars.pauseOnAction, false, true); break;
|
||||
case "play": if (!$obj.playing && !$obj.asNav) { $obj.play(); } break;
|
||||
case "pause": $obj.pause(); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// public methods
|
||||
slider.flexAnimate = function(target, pause, override, withSync, fromNav) {
|
||||
if (asNav && slider.pagingCount === 1) slider.direction = (slider.currentItem < target) ? "next" : "prev";
|
||||
|
||||
if (!slider.animating && (slider.canAdvance(target, fromNav) || override) && slider.is(":visible")) {
|
||||
if (asNav && withSync) {
|
||||
var master = $(vars.asNavFor).data('flexslider');
|
||||
slider.atEnd = target === 0 || target === slider.count - 1;
|
||||
master.flexAnimate(target, true, false, true, fromNav);
|
||||
slider.direction = (slider.currentItem < target) ? "next" : "prev";
|
||||
master.direction = slider.direction;
|
||||
|
||||
if (Math.ceil((target + 1)/slider.visible) - 1 !== slider.currentSlide && target !== 0) {
|
||||
slider.currentItem = target;
|
||||
slider.slides.removeClass(namespace + "active-slide").eq(target).addClass(namespace + "active-slide");
|
||||
target = Math.floor(target/slider.visible);
|
||||
} else {
|
||||
slider.currentItem = target;
|
||||
slider.slides.removeClass(namespace + "active-slide").eq(target).addClass(namespace + "active-slide");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
slider.animating = true;
|
||||
slider.animatingTo = target;
|
||||
// API: before() animation Callback
|
||||
vars.before(slider);
|
||||
|
||||
// SLIDESHOW:
|
||||
if (pause) slider.pause();
|
||||
|
||||
// SYNC:
|
||||
if (slider.syncExists && !fromNav) methods.sync("animate");
|
||||
|
||||
// CONTROLNAV
|
||||
if (vars.controlNav) methods.controlNav.active();
|
||||
|
||||
// !CAROUSEL:
|
||||
// CANDIDATE: slide active class (for add/remove slide)
|
||||
if (!carousel) slider.slides.removeClass(namespace + 'active-slide').eq(target).addClass(namespace + 'active-slide');
|
||||
|
||||
// INFINITE LOOP:
|
||||
// CANDIDATE: atEnd
|
||||
slider.atEnd = target === 0 || target === slider.last;
|
||||
|
||||
// DIRECTIONNAV:
|
||||
if (vars.directionNav) methods.directionNav.update();
|
||||
|
||||
if (target === slider.last) {
|
||||
// API: end() of cycle Callback
|
||||
vars.end(slider);
|
||||
// SLIDESHOW && !INFINITE LOOP:
|
||||
if (!vars.animationLoop) slider.pause();
|
||||
}
|
||||
|
||||
// SLIDE:
|
||||
if (!fade) {
|
||||
var dimension = (vertical) ? slider.slides.filter(':first').height() : slider.computedW,
|
||||
margin, slideString, calcNext;
|
||||
|
||||
// INFINITE LOOP / REVERSE:
|
||||
if (carousel) {
|
||||
margin = (vars.itemWidth > slider.w) ? vars.itemMargin * 2 : vars.itemMargin;
|
||||
calcNext = ((slider.itemW + margin) * slider.move) * slider.animatingTo;
|
||||
slideString = (calcNext > slider.limit && slider.visible !== 1) ? slider.limit : calcNext;
|
||||
} else if (slider.currentSlide === 0 && target === slider.count - 1 && vars.animationLoop && slider.direction !== "next") {
|
||||
slideString = (reverse) ? (slider.count + slider.cloneOffset) * dimension : 0;
|
||||
} else if (slider.currentSlide === slider.last && target === 0 && vars.animationLoop && slider.direction !== "prev") {
|
||||
slideString = (reverse) ? 0 : (slider.count + 1) * dimension;
|
||||
} else {
|
||||
slideString = (reverse) ? ((slider.count - 1) - target + slider.cloneOffset) * dimension : (target + slider.cloneOffset) * dimension;
|
||||
}
|
||||
slider.setProps(slideString, "", vars.animationSpeed);
|
||||
if (slider.transitions) {
|
||||
if (!vars.animationLoop || !slider.atEnd) {
|
||||
slider.animating = false;
|
||||
slider.currentSlide = slider.animatingTo;
|
||||
}
|
||||
slider.container.unbind("webkitTransitionEnd transitionend");
|
||||
slider.container.bind("webkitTransitionEnd transitionend", function() {
|
||||
slider.wrapup(dimension);
|
||||
});
|
||||
} else {
|
||||
slider.container.animate(slider.args, vars.animationSpeed, vars.easing, function(){
|
||||
slider.wrapup(dimension);
|
||||
});
|
||||
}
|
||||
} else { // FADE:
|
||||
if (!touch) {
|
||||
slider.slides.eq(slider.currentSlide).fadeOut(vars.animationSpeed, vars.easing);
|
||||
slider.slides.eq(target).fadeIn(vars.animationSpeed, vars.easing, slider.wrapup);
|
||||
} else {
|
||||
slider.slides.eq(slider.currentSlide).css({ "opacity": 0, "zIndex": 1 });
|
||||
slider.slides.eq(target).css({ "opacity": 1, "zIndex": 2 });
|
||||
slider.animating = false;
|
||||
slider.currentSlide = slider.animatingTo;
|
||||
}
|
||||
}
|
||||
// SMOOTH HEIGHT:
|
||||
if (vars.smoothHeight) methods.smoothHeight(vars.animationSpeed);
|
||||
}
|
||||
}
|
||||
slider.wrapup = function(dimension) {
|
||||
// SLIDE:
|
||||
if (!fade && !carousel) {
|
||||
if (slider.currentSlide === 0 && slider.animatingTo === slider.last && vars.animationLoop) {
|
||||
slider.setProps(dimension, "jumpEnd");
|
||||
} else if (slider.currentSlide === slider.last && slider.animatingTo === 0 && vars.animationLoop) {
|
||||
slider.setProps(dimension, "jumpStart");
|
||||
}
|
||||
}
|
||||
slider.animating = false;
|
||||
slider.currentSlide = slider.animatingTo;
|
||||
// API: after() animation Callback
|
||||
vars.after(slider);
|
||||
}
|
||||
|
||||
// SLIDESHOW:
|
||||
slider.animateSlides = function() {
|
||||
if (!slider.animating) slider.flexAnimate(slider.getTarget("next"));
|
||||
}
|
||||
// SLIDESHOW:
|
||||
slider.pause = function() {
|
||||
clearInterval(slider.animatedSlides);
|
||||
slider.playing = false;
|
||||
// PAUSEPLAY:
|
||||
if (vars.pausePlay) methods.pausePlay.update("play");
|
||||
// SYNC:
|
||||
if (slider.syncExists) methods.sync("pause");
|
||||
}
|
||||
// SLIDESHOW:
|
||||
slider.play = function() {
|
||||
slider.animatedSlides = setInterval(slider.animateSlides, vars.slideshowSpeed);
|
||||
slider.playing = true;
|
||||
// PAUSEPLAY:
|
||||
if (vars.pausePlay) methods.pausePlay.update("pause");
|
||||
// SYNC:
|
||||
if (slider.syncExists) methods.sync("play");
|
||||
}
|
||||
slider.canAdvance = function(target, fromNav) {
|
||||
// ASNAV:
|
||||
var last = (asNav) ? slider.pagingCount - 1 : slider.last;
|
||||
return (fromNav) ? true :
|
||||
(asNav && slider.currentItem === slider.count - 1 && target === 0 && slider.direction === "prev") ? true :
|
||||
(asNav && slider.currentItem === 0 && target === slider.pagingCount - 1 && slider.direction !== "next") ? false :
|
||||
(target === slider.currentSlide && !asNav) ? false :
|
||||
(vars.animationLoop) ? true :
|
||||
(slider.atEnd && slider.currentSlide === 0 && target === last && slider.direction !== "next") ? false :
|
||||
(slider.atEnd && slider.currentSlide === last && target === 0 && slider.direction === "next") ? false :
|
||||
true;
|
||||
}
|
||||
slider.getTarget = function(dir) {
|
||||
slider.direction = dir;
|
||||
if (dir === "next") {
|
||||
return (slider.currentSlide === slider.last) ? 0 : slider.currentSlide + 1;
|
||||
} else {
|
||||
return (slider.currentSlide === 0) ? slider.last : slider.currentSlide - 1;
|
||||
}
|
||||
}
|
||||
|
||||
// SLIDE:
|
||||
slider.setProps = function(pos, special, dur) {
|
||||
var target = (function() {
|
||||
var posCheck = (pos) ? pos : ((slider.itemW + vars.itemMargin) * slider.move) * slider.animatingTo,
|
||||
posCalc = (function() {
|
||||
if (carousel) {
|
||||
return (special === "setTouch") ? pos :
|
||||
(reverse && slider.animatingTo === slider.last) ? 0 :
|
||||
(reverse) ? slider.limit - (((slider.itemW + vars.itemMargin) * slider.move) * slider.animatingTo) :
|
||||
(slider.animatingTo === slider.last) ? slider.limit : posCheck;
|
||||
} else {
|
||||
switch (special) {
|
||||
case "setTotal": return (reverse) ? ((slider.count - 1) - slider.currentSlide + slider.cloneOffset) * pos : (slider.currentSlide + slider.cloneOffset) * pos;
|
||||
case "setTouch": return (reverse) ? pos : pos;
|
||||
case "jumpEnd": return (reverse) ? pos : slider.count * pos;
|
||||
case "jumpStart": return (reverse) ? slider.count * pos : pos;
|
||||
default: return pos;
|
||||
}
|
||||
}
|
||||
}());
|
||||
return (posCalc * -1) + "px";
|
||||
}());
|
||||
|
||||
if (slider.transitions) {
|
||||
target = (vertical) ? "translate3d(0," + target + ",0)" : "translate3d(" + target + ",0,0)";
|
||||
dur = (dur !== undefined) ? (dur/1000) + "s" : "0s";
|
||||
slider.container.css("-" + slider.pfx + "-transition-duration", dur);
|
||||
}
|
||||
|
||||
slider.args[slider.prop] = target;
|
||||
if (slider.transitions || dur === undefined) slider.container.css(slider.args);
|
||||
}
|
||||
|
||||
slider.setup = function(type) {
|
||||
// SLIDE:
|
||||
if (!fade) {
|
||||
var sliderOffset, arr;
|
||||
|
||||
if (type === "init") {
|
||||
slider.viewport = $('<div class="' + namespace + 'viewport"></div>').css({"overflow": "hidden", "position": "relative"}).appendTo(slider).append(slider.container);
|
||||
// INFINITE LOOP:
|
||||
slider.cloneCount = 0;
|
||||
slider.cloneOffset = 0;
|
||||
// REVERSE:
|
||||
if (reverse) {
|
||||
arr = $.makeArray(slider.slides).reverse();
|
||||
slider.slides = $(arr);
|
||||
slider.container.empty().append(slider.slides);
|
||||
}
|
||||
}
|
||||
// INFINITE LOOP && !CAROUSEL:
|
||||
if (vars.animationLoop && !carousel) {
|
||||
slider.cloneCount = 2;
|
||||
slider.cloneOffset = 1;
|
||||
// clear out old clones
|
||||
if (type !== "init") slider.container.find('.clone').remove();
|
||||
slider.container.append(slider.slides.first().clone().addClass('clone')).prepend(slider.slides.last().clone().addClass('clone'));
|
||||
}
|
||||
slider.newSlides = $(vars.selector, slider);
|
||||
|
||||
sliderOffset = (reverse) ? slider.count - 1 - slider.currentSlide + slider.cloneOffset : slider.currentSlide + slider.cloneOffset;
|
||||
// VERTICAL:
|
||||
if (vertical && !carousel) {
|
||||
slider.container.height((slider.count + slider.cloneCount) * 200 + "%").css("position", "absolute").width("100%");
|
||||
setTimeout(function(){
|
||||
slider.newSlides.css({"display": "block"});
|
||||
slider.doMath();
|
||||
slider.viewport.height(slider.h);
|
||||
slider.setProps(sliderOffset * slider.h, "init");
|
||||
}, (type === "init") ? 100 : 0);
|
||||
} else {
|
||||
slider.container.width((slider.count + slider.cloneCount) * 200 + "%");
|
||||
slider.setProps(sliderOffset * slider.computedW, "init");
|
||||
setTimeout(function(){
|
||||
slider.doMath();
|
||||
slider.newSlides.css({"width": slider.computedW, "float": "left", "display": "block"});
|
||||
// SMOOTH HEIGHT:
|
||||
if (vars.smoothHeight) methods.smoothHeight();
|
||||
}, (type === "init") ? 100 : 0);
|
||||
}
|
||||
} else { // FADE:
|
||||
slider.slides.css({"width": "100%", "float": "left", "marginRight": "-100%", "position": "relative"});
|
||||
if (type === "init") {
|
||||
if (!touch) {
|
||||
slider.slides.eq(slider.currentSlide).fadeIn(vars.animationSpeed, vars.easing);
|
||||
} else {
|
||||
slider.slides.css({ "opacity": 0, "display": "block", "webkitTransition": "opacity " + vars.animationSpeed / 1000 + "s ease", "zIndex": 1 }).eq(slider.currentSlide).css({ "opacity": 1, "zIndex": 2});
|
||||
}
|
||||
}
|
||||
// SMOOTH HEIGHT:
|
||||
if (vars.smoothHeight) methods.smoothHeight();
|
||||
}
|
||||
// !CAROUSEL:
|
||||
// CANDIDATE: active slide
|
||||
if (!carousel) slider.slides.removeClass(namespace + "active-slide").eq(slider.currentSlide).addClass(namespace + "active-slide");
|
||||
}
|
||||
|
||||
slider.doMath = function() {
|
||||
var slide = slider.slides.first(),
|
||||
slideMargin = vars.itemMargin,
|
||||
minItems = vars.minItems,
|
||||
maxItems = vars.maxItems;
|
||||
|
||||
slider.w = slider.width();
|
||||
slider.h = slide.height();
|
||||
slider.boxPadding = slide.outerWidth() - slide.width();
|
||||
|
||||
// CAROUSEL:
|
||||
if (carousel) {
|
||||
slider.itemT = vars.itemWidth + slideMargin;
|
||||
slider.minW = (minItems) ? minItems * slider.itemT : slider.w;
|
||||
slider.maxW = (maxItems) ? maxItems * slider.itemT : slider.w;
|
||||
slider.itemW = (slider.minW > slider.w) ? (slider.w - (slideMargin * minItems))/minItems :
|
||||
(slider.maxW < slider.w) ? (slider.w - (slideMargin * maxItems))/maxItems :
|
||||
(vars.itemWidth > slider.w) ? slider.w : vars.itemWidth;
|
||||
slider.visible = Math.floor(slider.w/(slider.itemW + slideMargin));
|
||||
slider.move = (vars.move > 0 && vars.move < slider.visible ) ? vars.move : slider.visible;
|
||||
slider.pagingCount = Math.ceil(((slider.count - slider.visible)/slider.move) + 1);
|
||||
slider.last = slider.pagingCount - 1;
|
||||
slider.limit = (slider.pagingCount === 1) ? 0 :
|
||||
(vars.itemWidth > slider.w) ? ((slider.itemW + (slideMargin * 2)) * slider.count) - slider.w - slideMargin : ((slider.itemW + slideMargin) * slider.count) - slider.w - slideMargin;
|
||||
} else {
|
||||
slider.itemW = slider.w;
|
||||
slider.pagingCount = slider.count;
|
||||
slider.last = slider.count - 1;
|
||||
}
|
||||
slider.computedW = slider.itemW - slider.boxPadding;
|
||||
}
|
||||
|
||||
slider.update = function(pos, action) {
|
||||
slider.doMath();
|
||||
|
||||
// update currentSlide and slider.animatingTo if necessary
|
||||
if (!carousel) {
|
||||
if (pos < slider.currentSlide) {
|
||||
slider.currentSlide += 1;
|
||||
} else if (pos <= slider.currentSlide && pos !== 0) {
|
||||
slider.currentSlide -= 1;
|
||||
}
|
||||
slider.animatingTo = slider.currentSlide;
|
||||
}
|
||||
|
||||
// update controlNav
|
||||
if (vars.controlNav && !slider.manualControls) {
|
||||
if ((action === "add" && !carousel) || slider.pagingCount > slider.controlNav.length) {
|
||||
methods.controlNav.update("add");
|
||||
} else if ((action === "remove" && !carousel) || slider.pagingCount < slider.controlNav.length) {
|
||||
if (carousel && slider.currentSlide > slider.last) {
|
||||
slider.currentSlide -= 1;
|
||||
slider.animatingTo -= 1;
|
||||
}
|
||||
methods.controlNav.update("remove", slider.last);
|
||||
}
|
||||
}
|
||||
// update directionNav
|
||||
if (vars.directionNav) methods.directionNav.update();
|
||||
|
||||
}
|
||||
|
||||
slider.addSlide = function(obj, pos) {
|
||||
var $obj = $(obj);
|
||||
|
||||
slider.count += 1;
|
||||
slider.last = slider.count - 1;
|
||||
|
||||
// append new slide
|
||||
if (vertical && reverse) {
|
||||
(pos !== undefined) ? slider.slides.eq(slider.count - pos).after($obj) : slider.container.prepend($obj);
|
||||
} else {
|
||||
(pos !== undefined) ? slider.slides.eq(pos).before($obj) : slider.container.append($obj);
|
||||
}
|
||||
|
||||
// update currentSlide, animatingTo, controlNav, and directionNav
|
||||
slider.update(pos, "add");
|
||||
|
||||
// update slider.slides
|
||||
slider.slides = $(vars.selector + ':not(.clone)', slider);
|
||||
// re-setup the slider to accomdate new slide
|
||||
slider.setup();
|
||||
|
||||
//FlexSlider: added() Callback
|
||||
vars.added(slider);
|
||||
}
|
||||
slider.removeSlide = function(obj) {
|
||||
var pos = (isNaN(obj)) ? slider.slides.index($(obj)) : obj;
|
||||
|
||||
// update count
|
||||
slider.count -= 1;
|
||||
slider.last = slider.count - 1;
|
||||
|
||||
// remove slide
|
||||
if (isNaN(obj)) {
|
||||
$(obj, slider.slides).remove();
|
||||
} else {
|
||||
(vertical && reverse) ? slider.slides.eq(slider.last).remove() : slider.slides.eq(obj).remove();
|
||||
}
|
||||
|
||||
// update currentSlide, animatingTo, controlNav, and directionNav
|
||||
slider.doMath();
|
||||
slider.update(pos, "remove");
|
||||
|
||||
// update slider.slides
|
||||
slider.slides = $(vars.selector + ':not(.clone)', slider);
|
||||
// re-setup the slider to accomdate new slide
|
||||
slider.setup();
|
||||
|
||||
// FlexSlider: removed() Callback
|
||||
vars.removed(slider);
|
||||
}
|
||||
|
||||
//FlexSlider: Initialize
|
||||
methods.init();
|
||||
}
|
||||
|
||||
//FlexSlider: Default Settings
|
||||
$.flexslider.defaults = {
|
||||
namespace: "flex-", //{NEW} String: Prefix string attached to the class of every element generated by the plugin
|
||||
selector: ".slides > li", //{NEW} Selector: Must match a simple pattern. '{container} > {slide}' -- Ignore pattern at your own peril
|
||||
animation: "fade", //String: Select your animation type, "fade" or "slide"
|
||||
easing: "swing", //{NEW} String: Determines the easing method used in jQuery transitions. jQuery easing plugin is supported!
|
||||
direction: "horizontal", //String: Select the sliding direction, "horizontal" or "vertical"
|
||||
reverse: false, //{NEW} Boolean: Reverse the animation direction
|
||||
animationLoop: true, //Boolean: Should the animation loop? If false, directionNav will received "disable" classes at either end
|
||||
smoothHeight: false, //{NEW} Boolean: Allow height of the slider to animate smoothly in horizontal mode
|
||||
startAt: 0, //Integer: The slide that the slider should start on. Array notation (0 = first slide)
|
||||
slideshow: false, //Boolean: Animate slider automatically
|
||||
slideshowSpeed: 7000, //Integer: Set the speed of the slideshow cycling, in milliseconds
|
||||
animationSpeed: 600, //Integer: Set the speed of animations, in milliseconds
|
||||
initDelay: 0, //{NEW} Integer: Set an initialization delay, in milliseconds
|
||||
randomize: false, //Boolean: Randomize slide order
|
||||
|
||||
// Usability features
|
||||
pauseOnAction: true, //Boolean: Pause the slideshow when interacting with control elements, highly recommended.
|
||||
pauseOnHover: false, //Boolean: Pause the slideshow when hovering over slider, then resume when no longer hovering
|
||||
useCSS: true, //{NEW} Boolean: Slider will use CSS3 transitions if available
|
||||
touch: true, //{NEW} Boolean: Allow touch swipe navigation of the slider on touch-enabled devices
|
||||
video: true, //{NEW} Boolean: If using video in the slider, will prevent CSS3 3D Transforms to avoid graphical glitches
|
||||
|
||||
// Primary Controls
|
||||
controlNav: true, //Boolean: Create navigation for paging control of each clide? Note: Leave true for manualControls usage
|
||||
directionNav: true, //Boolean: Create navigation for previous/next navigation? (true/false)
|
||||
prevText: "Previous", //String: Set the text for the "previous" directionNav item
|
||||
nextText: "Next", //String: Set the text for the "next" directionNav item
|
||||
|
||||
// Secondary Navigation
|
||||
keyboard: true, //Boolean: Allow slider navigating via keyboard left/right keys
|
||||
multipleKeyboard: false, //{NEW} Boolean: Allow keyboard navigation to affect multiple sliders. Default behavior cuts out keyboard navigation with more than one slider present.
|
||||
mousewheel: false, //{UPDATED} Boolean: Requires jquery.mousewheel.js (https://github.com/brandonaaron/jquery-mousewheel) - Allows slider navigating via mousewheel
|
||||
pausePlay: false, //Boolean: Create pause/play dynamic element
|
||||
pauseText: "Pause", //String: Set the text for the "pause" pausePlay item
|
||||
playText: "Play", //String: Set the text for the "play" pausePlay item
|
||||
|
||||
// Special properties
|
||||
controlsContainer: "", //{UPDATED} jQuery Object/Selector: Declare which container the navigation elements should be appended too. Default container is the FlexSlider element. Example use would be $(".flexslider-container"). Property is ignored if given element is not found.
|
||||
manualControls: "", //{UPDATED} jQuery Object/Selector: Declare custom control navigation. Examples would be $(".flex-control-nav li") or "#tabs-nav li img", etc. The number of elements in your controlNav should match the number of slides/tabs.
|
||||
sync: "", //{NEW} Selector: Mirror the actions performed on this slider with another slider. Use with care.
|
||||
asNavFor: "", //{NEW} Selector: Internal property exposed for turning the slider into a thumbnail navigation for another slider
|
||||
|
||||
// Carousel Options
|
||||
itemWidth: 0, //{NEW} Integer: Box-model width of individual carousel items, including horizontal borders and padding.
|
||||
itemMargin: 0, //{NEW} Integer: Margin between carousel items.
|
||||
minItems: 0, //{NEW} Integer: Minimum number of carousel items that should be visible. Items will resize fluidly when below this.
|
||||
maxItems: 0, //{NEW} Integer: Maxmimum number of carousel items that should be visible. Items will resize fluidly when above this limit.
|
||||
move: 0, //{NEW} Integer: Number of carousel items that should move on animation. If 0, slider will move all visible items.
|
||||
|
||||
// Callback API
|
||||
start: function(){}, //Callback: function(slider) - Fires when the slider loads the first slide
|
||||
before: function(){}, //Callback: function(slider) - Fires asynchronously with each slider animation
|
||||
after: function(){}, //Callback: function(slider) - Fires after each slider animation completes
|
||||
end: function(){}, //Callback: function(slider) - Fires when the slider reaches the last slide (asynchronous)
|
||||
added: function(){}, //{NEW} Callback: function(slider) - Fires after a slide is added
|
||||
removed: function(){} //{NEW} Callback: function(slider) - Fires after a slide is removed
|
||||
}
|
||||
|
||||
|
||||
//FlexSlider: Plugin Function
|
||||
$.fn.flexslider = function(options) {
|
||||
if (options === undefined) options = {};
|
||||
|
||||
if (typeof options === "object") {
|
||||
return this.each(function() {
|
||||
var $this = $(this),
|
||||
selector = (options.selector) ? options.selector : ".slides > li",
|
||||
$slides = $this.find(selector);
|
||||
|
||||
if ($slides.length === 1) {
|
||||
$slides.fadeIn(400);
|
||||
if (options.start) options.start($this);
|
||||
} else if ($this.data('flexslider') === undefined) {
|
||||
new $.flexslider(this, options);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// Helper strings to quickly perform functions on the slider
|
||||
var $slider = $(this).data('flexslider');
|
||||
switch (options) {
|
||||
case "play": $slider.play(); break;
|
||||
case "pause": $slider.pause(); break;
|
||||
case "next": $slider.flexAnimate($slider.getTarget("next"), true); break;
|
||||
case "prev":
|
||||
case "previous": $slider.flexAnimate($slider.getTarget("prev"), true); break;
|
||||
default: if (typeof options === "number") $slider.flexAnimate(options, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
})(jQuery);
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
/*! jQuery v1.9.1 | (c) 2005, 2012 jQuery Foundation, Inc. | jquery.org/license
|
||||
//@ sourceMappingURL=jquery.min.map
|
||||
*/(function(e,t){var n,r,i=typeof t,o=e.document,a=e.location,s=e.jQuery,u=e.$,l={},c=[],p="1.9.1",f=c.concat,d=c.push,h=c.slice,g=c.indexOf,m=l.toString,y=l.hasOwnProperty,v=p.trim,b=function(e,t){return new b.fn.init(e,t,r)},x=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,w=/\S+/g,T=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,N=/^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,k=/^[\],:{}\s]*$/,E=/(?:^|:|,)(?:\s*\[)+/g,S=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,A=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,j=/^-ms-/,D=/-([\da-z])/gi,L=function(e,t){return t.toUpperCase()},H=function(e){(o.addEventListener||"load"===e.type||"complete"===o.readyState)&&(q(),b.ready())},q=function(){o.addEventListener?(o.removeEventListener("DOMContentLoaded",H,!1),e.removeEventListener("load",H,!1)):(o.detachEvent("onreadystatechange",H),e.detachEvent("onload",H))};b.fn=b.prototype={jquery:p,constructor:b,init:function(e,n,r){var i,a;if(!e)return this;if("string"==typeof e){if(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:N.exec(e),!i||!i[1]&&n)return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e);if(i[1]){if(n=n instanceof b?n[0]:n,b.merge(this,b.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:o,!0)),C.test(i[1])&&b.isPlainObject(n))for(i in n)b.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i]);return this}if(a=o.getElementById(i[2]),a&&a.parentNode){if(a.id!==i[2])return r.find(e);this.length=1,this[0]=a}return this.context=o,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):b.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),b.makeArray(e,this))},selector:"",length:0,size:function(){return this.length},toArray:function(){return h.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=b.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return b.each(this,e,t)},ready:function(e){return b.ready.promise().done(e),this},slice:function(){return this.pushStack(h.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(b.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:d,sort:[].sort,splice:[].splice},b.fn.init.prototype=b.fn,b.extend=b.fn.extend=function(){var e,n,r,i,o,a,s=arguments[0]||{},u=1,l=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[1]||{},u=2),"object"==typeof s||b.isFunction(s)||(s={}),l===u&&(s=this,--u);l>u;u++)if(null!=(o=arguments[u]))for(i in o)e=s[i],r=o[i],s!==r&&(c&&r&&(b.isPlainObject(r)||(n=b.isArray(r)))?(n?(n=!1,a=e&&b.isArray(e)?e:[]):a=e&&b.isPlainObject(e)?e:{},s[i]=b.extend(c,a,r)):r!==t&&(s[i]=r));return s},b.extend({noConflict:function(t){return e.$===b&&(e.$=u),t&&e.jQuery===b&&(e.jQuery=s),b},isReady:!1,readyWait:1,holdReady:function(e){e?b.readyWait++:b.ready(!0)},ready:function(e){if(e===!0?!--b.readyWait:!b.isReady){if(!o.body)return setTimeout(b.ready);b.isReady=!0,e!==!0&&--b.readyWait>0||(n.resolveWith(o,[b]),b.fn.trigger&&b(o).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===b.type(e)},isArray:Array.isArray||function(e){return"array"===b.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[m.call(e)]||"object":typeof e},isPlainObject:function(e){if(!e||"object"!==b.type(e)||e.nodeType||b.isWindow(e))return!1;try{if(e.constructor&&!y.call(e,"constructor")&&!y.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||y.call(e,r)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||o;var r=C.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=b.buildFragment([e],t,i),i&&b(i).remove(),b.merge([],r.childNodes))},parseJSON:function(n){return e.JSON&&e.JSON.parse?e.JSON.parse(n):null===n?n:"string"==typeof n&&(n=b.trim(n),n&&k.test(n.replace(S,"@").replace(A,"]").replace(E,"")))?Function("return "+n)():(b.error("Invalid JSON: "+n),t)},parseXML:function(n){var r,i;if(!n||"string"!=typeof n)return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(o){r=t}return r&&r.documentElement&&!r.getElementsByTagName("parsererror").length||b.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&b.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(j,"ms-").replace(D,L)},nodeName:function(Line truncated
|
||||
return(!i||i!==r&&!b.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),b.support.submitBubbles||(b.event.special.submit={setup:function(){return b.nodeName(this,"form")?!1:(b.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=b.nodeName(n,"input")||b.nodeName(n,"button")?n.form:t;r&&!b._data(r,"submitBubbles")&&(b.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),b._data(r,"submitBubbles",!0))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&b.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return b.nodeName(this,"form")?!1:(b.event.remove(this,"._submit"),t)}}),b.support.changeBubbles||(b.event.special.change={setup:function(){return Z.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(b.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),b.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),b.event.simulate("change",this,e,!0)})),!1):(b.event.add(this,"beforeactivate._change",function(e){var t=e.target;Z.test(t.nodeName)&&!b._data(t,"changeBubbles")&&(b.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||b.event.simulate("change",this.parentNode,e,!0)}),b._data(t,"changeBubbles",!0))}),t)},handle:function(e){var n=e.target;return this!==n||e.isSimulated||e.isTrigger||"radio"!==n.type&&"checkbox"!==n.type?e.handleObj.handler.apply(this,arguments):t},teardown:function(){return b.event.remove(this,"._change"),!Z.test(this.nodeName)}}),b.support.focusinBubbles||b.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){b.event.simulate(t,e.target,b.event.fix(e),!0)};b.event.special[t]={setup:function(){0===n++&&o.addEventListener(e,r,!0)},teardown:function(){0===--n&&o.removeEventListener(e,r,!0)}}}),b.fn.extend({on:function(e,n,r,i,o){var a,s;if("object"==typeof e){"string"!=typeof n&&(r=r||n,n=t);for(a in e)this.on(a,n,r,e[a],o);return this}if(null==r&&null==i?(i=n,r=n=t):null==i&&("string"==typeof n?(i=r,r=t):(i=r,r=n,n=t)),i===!1)i=ot;else if(!i)return this;return 1===o&&(s=i,i=function(e){return b().off(e),s.apply(this,arguments)},i.guid=s.guid||(s.guid=b.guid++)),this.each(function(){b.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,o;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,b(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(o in e)this.off(o,n,e[o]);return this}return(n===!1||"function"==typeof n)&&(r=n,n=t),r===!1&&(r=ot),this.each(function(){b.event.remove(this,e,r,n)})},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},trigger:function(e,t){return this.each(function(){b.event.trigger(e,t,this)})},triggerHandler:function(e,n){var r=this[0];return r?b.event.trigger(e,n,r,!0):t}}),function(e,t){var n,r,i,o,a,s,u,l,c,p,f,d,h,g,m,y,v,x="sizzle"+-new Date,w=e.document,T={},N=0,C=0,k=it(),E=it(),S=it(),A=typeof t,j=1<<31,D=[],L=D.pop,H=D.push,q=D.slice,M=D.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},_="[\\x20\\t\\r\\n\\f]",F="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=F.replace("w","w#"),B="([*^$|!~]?=)",P="\\["+_+"*("+F+")"+_+"*(?:"+B+_+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+O+")|)|)"+_+"*\\]",R=":("+F+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+P.replace(3,8)+")*)|.*)\\)|)",W=RegExp("^"+_+"+|((?:^|[^\\\\])(?:\\\\.)*)"+_+"+$","g"),$=RegExp("^"+_+"*,"+_+"*"),I=RegExp("^"+_+"*([\\x20\\t\\r\\n\\f>+~])"+_+"*"),z=RegExp(R),X=RegExp("^"+O+"$"),U={ID:RegExp("^#("+F+")"),CLASS:RegExp("^\\.("+F+")"),NAME:RegExp("^\\[name=['\"]?("+F+")['\"]?\\]"),TAG:RegExp("^("+F.replace("w","w*")+")"),ATTR:RegExp("^"+P),PSEUDO:RegExp("^"+R),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+_+"*(even|odd|(([+-]|)(\\d*)n|)"+_+"*(?:([+-]|)"+_+"*(\\d+)|))"+_+"*\\)|)","i"),needsContext:RegExp("^"+_+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+_+"*((?:-\\d)?\\d*)"+_+"*\\)|)(?=[^-]|$)","i")},V=/[\x20\t\r\n\f]*[+~]/,Y=/^[^{]+\{\s*\[native code/,J=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,G=/^(?:input|select|textarea|button)$/i,Q=/^h\d$/i,K=/'|\\/g,Z=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,et=/\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,tt=function(e,t){var n="0x"+t-65536;return n!==n?t:0>n?String.fromCharCode(n+65536):String.fromCharCode(55296|n>>10,56320|1023&n)};try{q.call(w.documentElement.childNodes,0)[0].nodeType}catch(nt){q=function(e){var t,n=[];while(t=this[e++])n.push(t);return n}}function rt(e){return Y.test(e+"")}function it(){var e,t=[];return e=function(n,r){return t.push(n+Line truncated
|
||||
}b.merge(d,s.childNodes),s.textContent="";while(s.firstChild)s.removeChild(s.firstChild);s=f.lastChild}else d.push(t.createTextNode(o));s&&f.removeChild(s),b.support.appendChecked||b.grep(Ot(d,"input"),Bt),h=0;while(o=d[h++])if((!r||-1===b.inArray(o,r))&&(a=b.contains(o.ownerDocument,o),s=Ot(f.appendChild(o),"script"),a&&Mt(s),n)){i=0;while(o=s[i++])kt.test(o.type||"")&&n.push(o)}return s=null,f},cleanData:function(e,t){var n,r,o,a,s=0,u=b.expando,l=b.cache,p=b.support.deleteExpando,f=b.event.special;for(;null!=(n=e[s]);s++)if((t||b.acceptData(n))&&(o=n[u],a=o&&l[o])){if(a.events)for(r in a.events)f[r]?b.event.remove(n,r):b.removeEvent(n,r,a.handle);l[o]&&(delete l[o],p?delete n[u]:typeof n.removeAttribute!==i?n.removeAttribute(u):n[u]=null,c.push(o))}}});var Pt,Rt,Wt,$t=/alpha\([^)]*\)/i,It=/opacity\s*=\s*([^)]*)/,zt=/^(top|right|bottom|left)$/,Xt=/^(none|table(?!-c[ea]).+)/,Ut=/^margin/,Vt=RegExp("^("+x+")(.*)$","i"),Yt=RegExp("^("+x+")(?!px)[a-z%]+$","i"),Jt=RegExp("^([+-])=("+x+")","i"),Gt={BODY:"block"},Qt={position:"absolute",visibility:"hidden",display:"block"},Kt={letterSpacing:0,fontWeight:400},Zt=["Top","Right","Bottom","Left"],en=["Webkit","O","Moz","ms"];function tn(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=en.length;while(i--)if(t=en[i]+n,t in e)return t;return r}function nn(e,t){return e=t||e,"none"===b.css(e,"display")||!b.contains(e.ownerDocument,e)}function rn(e,t){var n,r,i,o=[],a=0,s=e.length;for(;s>a;a++)r=e[a],r.style&&(o[a]=b._data(r,"olddisplay"),n=r.style.display,t?(o[a]||"none"!==n||(r.style.display=""),""===r.style.display&&nn(r)&&(o[a]=b._data(r,"olddisplay",un(r.nodeName)))):o[a]||(i=nn(r),(n&&"none"!==n||!i)&&b._data(r,"olddisplay",i?n:b.css(r,"display"))));for(a=0;s>a;a++)r=e[a],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[a]||"":"none"));return e}b.fn.extend({css:function(e,n){return b.access(this,function(e,n,r){var i,o,a={},s=0;if(b.isArray(n)){for(o=Rt(e),i=n.length;i>s;s++)a[n[s]]=b.css(e,n[s],!1,o);return a}return r!==t?b.style(e,n,r):b.css(e,n)},e,n,arguments.length>1)},show:function(){return rn(this,!0)},hide:function(){return rn(this)},toggle:function(e){var t="boolean"==typeof e;return this.each(function(){(t?e:nn(this))?b(this).show():b(this).hide()})}}),b.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Wt(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":b.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,a,s,u=b.camelCase(n),l=e.style;if(n=b.cssProps[u]||(b.cssProps[u]=tn(l,u)),s=b.cssHooks[n]||b.cssHooks[u],r===t)return s&&"get"in s&&(o=s.get(e,!1,i))!==t?o:l[n];if(a=typeof r,"string"===a&&(o=Jt.exec(r))&&(r=(o[1]+1)*o[2]+parseFloat(b.css(e,n)),a="number"),!(null==r||"number"===a&&isNaN(r)||("number"!==a||b.cssNumber[u]||(r+="px"),b.support.clearCloneStyle||""!==r||0!==n.indexOf("background")||(l[n]="inherit"),s&&"set"in s&&(r=s.set(e,r,i))===t)))try{l[n]=r}catch(c){}}},css:function(e,n,r,i){var o,a,s,u=b.camelCase(n);return n=b.cssProps[u]||(b.cssProps[u]=tn(e.style,u)),s=b.cssHooks[n]||b.cssHooks[u],s&&"get"in s&&(a=s.get(e,!0,r)),a===t&&(a=Wt(e,n,i)),"normal"===a&&n in Kt&&(a=Kt[n]),""===r||r?(o=parseFloat(a),r===!0||b.isNumeric(o)?o||0:a):a},swap:function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i}}),e.getComputedStyle?(Rt=function(t){return e.getComputedStyle(t,null)},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),u=s?s.getPropertyValue(n)||s[n]:t,l=e.style;return s&&(""!==u||b.contains(e.ownerDocument,e)||(u=b.style(e,n)),Yt.test(u)&&Ut.test(n)&&(i=l.width,o=l.minWidth,a=l.maxWidth,l.minWidth=l.maxWidth=l.width=u,u=s.width,l.width=i,l.minWidth=o,l.maxWidth=a)),u}):o.documentElement.currentStyle&&(Rt=function(e){return e.currentStyle},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),u=s?s[n]:t,l=e.style;return null==u&&l&&l[n]&&(u=l[n]),Yt.test(u)&&!zt.test(n)&&(i=l.left,o=e.runtimeStyle,a=o&&o.left,a&&(o.left=e.currentStyle.left),l.left="fontSize"===n?"1em":u,u=l.pixelLeft+"px",l.left=i,a&&(o.left=a)),""===u?"auto":u});function on(e,t,n){var r=Vt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function an(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:0,a=0;for(;4>o;o+=2)"margin"===n&&(a+=b.css(e,n+Zt[o],!0,i)),r?("content"===n&&(a-=b.css(e,"padding"+Zt[o],!0,i)),"margin"!==n&&(a-=b.css(e,"border"+Zt[o]+"Width",!0,i))):(a+=b.css(e,"padding"+Zt[o],!0,i),"padding"!==n&&(a+=b.css(e,"border"+Zt[o]+"Width",!0,i)));return a}function sn(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=Rt(e),a=b.support.boxSizing&&"border-box"===b.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=Wt(e,t,o),(0>i||null==i)&&(i=e.style[t]),Yt.test(i))return i;r=a&&(b.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}reLine truncated
|
||||
+223
@@ -0,0 +1,223 @@
|
||||
/*
|
||||
* jQuery One Page Nav Plugin
|
||||
* http://github.com/davist11/jQuery-One-Page-Nav
|
||||
*
|
||||
* Copyright (c) 2010 Trevor Davis (http://trevordavis.net)
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
* Uses the same license as jQuery, see:
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* @version 2.2
|
||||
*
|
||||
* Example usage:
|
||||
* $('#nav').onePageNav({
|
||||
* currentClass: 'current',
|
||||
* changeHash: false,
|
||||
* scrollSpeed: 750
|
||||
* });
|
||||
*/
|
||||
|
||||
;(function($, window, document, undefined){
|
||||
|
||||
// our plugin constructor
|
||||
var OnePageNav = function(elem, options){
|
||||
this.elem = elem;
|
||||
this.$elem = $(elem);
|
||||
this.options = options;
|
||||
this.metadata = this.$elem.data('plugin-options');
|
||||
this.$nav = this.$elem.find('a');
|
||||
this.$win = $(window);
|
||||
this.sections = {};
|
||||
this.didScroll = false;
|
||||
this.$doc = $(document);
|
||||
this.docHeight = this.$doc.height();
|
||||
};
|
||||
|
||||
// the plugin prototype
|
||||
OnePageNav.prototype = {
|
||||
defaults: {
|
||||
currentClass: 'current',
|
||||
changeHash: false,
|
||||
easing: 'swing',
|
||||
filter: '',
|
||||
scrollSpeed: 750,
|
||||
scrollOffset: 0,
|
||||
scrollThreshold: 0.5,
|
||||
begin: false,
|
||||
end: false,
|
||||
scrollChange: false
|
||||
},
|
||||
|
||||
init: function() {
|
||||
var self = this;
|
||||
|
||||
// Introduce defaults that can be extended either
|
||||
// globally or using an object literal.
|
||||
self.config = $.extend({}, self.defaults, self.options, self.metadata);
|
||||
|
||||
//Filter any links out of the nav
|
||||
if(self.config.filter !== '') {
|
||||
self.$nav = self.$nav.filter(self.config.filter);
|
||||
}
|
||||
|
||||
//Handle clicks on the nav
|
||||
self.$nav.on('click.onePageNav', $.proxy(self.handleClick, self));
|
||||
|
||||
//Get the section positions
|
||||
self.getPositions();
|
||||
|
||||
//Handle scroll changes
|
||||
self.bindInterval();
|
||||
|
||||
//Update the positions on resize too
|
||||
self.$win.on('resize.onePageNav', $.proxy(self.getPositions, self));
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
adjustNav: function(self, $parent) {
|
||||
self.$elem.find('.' + self.config.currentClass).removeClass(self.config.currentClass);
|
||||
$parent.addClass(self.config.currentClass);
|
||||
},
|
||||
|
||||
bindInterval: function() {
|
||||
var self = this;
|
||||
var docHeight;
|
||||
|
||||
self.$win.on('scroll.onePageNav', function() {
|
||||
self.didScroll = true;
|
||||
});
|
||||
|
||||
self.t = setInterval(function() {
|
||||
docHeight = self.$doc.height();
|
||||
|
||||
//If it was scrolled
|
||||
if(self.didScroll) {
|
||||
self.didScroll = false;
|
||||
self.scrollChange();
|
||||
}
|
||||
|
||||
//If the document height changes
|
||||
if(docHeight !== self.docHeight) {
|
||||
self.docHeight = docHeight;
|
||||
self.getPositions();
|
||||
}
|
||||
}, 250);
|
||||
},
|
||||
|
||||
getHash: function($link) {
|
||||
return $link.attr('href').split('#')[1];
|
||||
},
|
||||
|
||||
getPositions: function() {
|
||||
var self = this;
|
||||
var linkHref;
|
||||
var topPos;
|
||||
var $target;
|
||||
|
||||
self.$nav.each(function() {
|
||||
linkHref = self.getHash($(this));
|
||||
$target = $('#' + linkHref);
|
||||
|
||||
if($target.length) {
|
||||
topPos = $target.offset().top;
|
||||
self.sections[linkHref] = Math.round(topPos) - self.config.scrollOffset;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
getSection: function(windowPos) {
|
||||
var returnValue = null;
|
||||
var windowHeight = Math.round(this.$win.height() * this.config.scrollThreshold);
|
||||
|
||||
for(var section in this.sections) {
|
||||
if((this.sections[section] - windowHeight) < windowPos) {
|
||||
returnValue = section;
|
||||
}
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
},
|
||||
|
||||
handleClick: function(e) {
|
||||
var self = this;
|
||||
var $link = $(e.currentTarget);
|
||||
var $parent = $link.parent();
|
||||
var newLoc = '#' + self.getHash($link);
|
||||
|
||||
if(!$parent.hasClass(self.config.currentClass)) {
|
||||
//Start callback
|
||||
if(self.config.begin) {
|
||||
self.config.begin();
|
||||
}
|
||||
|
||||
//Change the highlighted nav item
|
||||
self.adjustNav(self, $parent);
|
||||
|
||||
//Removing the auto-adjust on scroll
|
||||
self.unbindInterval();
|
||||
|
||||
//Scroll to the correct position
|
||||
$.scrollTo(newLoc, self.config.scrollSpeed, {
|
||||
axis: 'y',
|
||||
easing: self.config.easing,
|
||||
offset: {
|
||||
top: -self.config.scrollOffset
|
||||
},
|
||||
onAfter: function() {
|
||||
//Do we need to change the hash?
|
||||
if(self.config.changeHash) {
|
||||
window.location.hash = newLoc;
|
||||
}
|
||||
|
||||
//Add the auto-adjust on scroll back in
|
||||
self.bindInterval();
|
||||
|
||||
//End callback
|
||||
if(self.config.end) {
|
||||
self.config.end();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
},
|
||||
|
||||
scrollChange: function() {
|
||||
var windowTop = this.$win.scrollTop();
|
||||
var position = this.getSection(windowTop);
|
||||
var $parent;
|
||||
|
||||
//If the position is set
|
||||
if(position !== null) {
|
||||
$parent = this.$elem.find('a[href$="#' + position + '"]').parent();
|
||||
|
||||
//If it's not already the current section
|
||||
if(!$parent.hasClass(this.config.currentClass)) {
|
||||
//Change the highlighted nav item
|
||||
this.adjustNav(this, $parent);
|
||||
|
||||
//If there is a scrollChange callback
|
||||
if(this.config.scrollChange) {
|
||||
this.config.scrollChange($parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
unbindInterval: function() {
|
||||
clearInterval(this.t);
|
||||
this.$win.unbind('scroll.onePageNav');
|
||||
}
|
||||
};
|
||||
|
||||
OnePageNav.defaults = OnePageNav.prototype.defaults;
|
||||
|
||||
$.fn.onePageNav = function(options) {
|
||||
return this.each(function() {
|
||||
new OnePageNav(this, options).init();
|
||||
});
|
||||
};
|
||||
|
||||
})( jQuery, window , document );
|
||||
@@ -0,0 +1,869 @@
|
||||
/* ------------------------------------------------------------------------
|
||||
Class: prettyPhoto
|
||||
Use: Lightbox clone for jQuery
|
||||
Author: Stephane Caron (http://www.no-margin-for-errors.com)
|
||||
Version: 3.1.2
|
||||
------------------------------------------------------------------------- */
|
||||
(function($) {
|
||||
$.prettyPhoto = {version: '3.1.2'};
|
||||
|
||||
$.fn.prettyPhoto = function(pp_settings) {
|
||||
pp_settings = jQuery.extend({
|
||||
animation_speed: 'fast', /* fast/slow/normal */
|
||||
slideshow: 0, /* false OR interval time in ms */
|
||||
autoplay_slideshow: false, /* true/false */
|
||||
opacity: 0.80, /* Value between 0 and 1 */
|
||||
show_title: false, /* true/false */
|
||||
allow_resize: false, /* Resize the photos bigger than viewport. true/false */
|
||||
default_width: 500,
|
||||
default_height: 344,
|
||||
counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
|
||||
theme: 'pp_default', /* light_rounded / dark_rounded / light_square / dark_square / facebook */
|
||||
horizontal_padding: 20, /* The padding on each side of the picture */
|
||||
hideflash: false, /* Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto */
|
||||
wmode: 'opaque', /* Set the flash wmode attribute */
|
||||
autoplay: false, /* Automatically start videos: True/False */
|
||||
modal: false, /* If set to true, only the close button will close the window */
|
||||
deeplinking: false, /* Allow prettyPhoto to update the url to enable deeplinking. */
|
||||
overlay_gallery: false, /* If set to true, a gallery will overlay the fullscreen image on mouse over */
|
||||
keyboard_shortcuts: true, /* Set to false if you open forms inside prettyPhoto */
|
||||
changepicturecallback: function(){}, /* Called everytime an item is shown/changed */
|
||||
callback: function(){}, /* Called when prettyPhoto is closed */
|
||||
ie6_fallback: true,
|
||||
markup: '<div class="pp_pic_holder"> \
|
||||
<div class="ppt"> </div> \
|
||||
<div class="pp_top"> \
|
||||
<div class="pp_left"></div> \
|
||||
<div class="pp_middle"></div> \
|
||||
<div class="pp_right"></div> \
|
||||
</div> \
|
||||
<div class="pp_content_container"> \
|
||||
<div class="pp_left"> \
|
||||
<div class="pp_right"> \
|
||||
<div class="pp_content"> \
|
||||
<div class="pp_loaderIcon"></div> \
|
||||
<div class="pp_fade"> \
|
||||
<a href="#" class="pp_expand" title="Expand the image">Expand</a> \
|
||||
<div class="pp_hoverContainer"> \
|
||||
<a class="pp_next" href="#">next</a> \
|
||||
<a class="pp_previous" href="#">previous</a> \
|
||||
</div> \
|
||||
<div id="pp_full_res"></div> \
|
||||
<div class="pp_details"> \
|
||||
<div class="pp_nav"> \
|
||||
<a href="#" class="pp_arrow_previous">Previous</a> \
|
||||
<p class="currentTextHolder">0/0</p> \
|
||||
<a href="#" class="pp_arrow_next">Next</a> \
|
||||
</div> \
|
||||
<a class="pp_close" href="#">Close</a> \
|
||||
</div> \
|
||||
</div> \
|
||||
</div> \
|
||||
</div> \
|
||||
</div> \
|
||||
</div> \
|
||||
<div class="pp_bottom"> \
|
||||
<div class="pp_left"></div> \
|
||||
<div class="pp_middle"></div> \
|
||||
<div class="pp_right"></div> \
|
||||
</div> \
|
||||
</div> \
|
||||
<div class="pp_overlay"></div>',
|
||||
gallery_markup: '<div class="pp_gallery"> \
|
||||
<a href="#" class="pp_arrow_previous">Previous</a> \
|
||||
<div> \
|
||||
<ul> \
|
||||
{gallery} \
|
||||
</ul> \
|
||||
</div> \
|
||||
<a href="#" class="pp_arrow_next">Next</a> \
|
||||
</div>',
|
||||
image_markup: '<img id="fullResImage" src="{path}" />',
|
||||
flash_markup: '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="{width}" height="{height}"><param name="wmode" value="{wmode}" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="{path}" /><embed src="{path}" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="{width}" height="{height}" wmode="{wmode}"></embed></object>',
|
||||
quicktime_markup: '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="{height}" width="{width}"><param name="src" value="{path}"><param name="autoplay" value="{autoplay}"><param name="type" value="video/quicktime"><embed src="{path}" height="{height}" width="{width}" autoplay="{autoplay}" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/"></embed></object>',
|
||||
iframe_markup: '<iframe src ="{path}" width="{width}" height="{height}" frameborder="no"></iframe>',
|
||||
inline_markup: '<div class="pp_inline">{content}</div>',
|
||||
custom_markup: '',
|
||||
social_tools: '<div class="pp_social"><div class="twitter"><a href="http://twitter.com/share" class="twitter-share-button" data-count="none">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div><div class="facebook"><iframe src="http://www.facebook.com/plugins/like.php?locale=en_US&href='+location.href+'&layout=button_count&show_faces=true&width=500&action=like&font&colorscheme=light&height=23" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:500px; height:23px;" allowTransparency="true"></iframe></div></div>' /* html or false to disable */
|
||||
}, pp_settings);
|
||||
|
||||
// Global variables accessible only by prettyPhoto
|
||||
var matchedObjects = this, percentBased = false, pp_dimensions, pp_open,
|
||||
|
||||
// prettyPhoto container specific
|
||||
pp_contentHeight, pp_contentWidth, pp_containerHeight, pp_containerWidth,
|
||||
|
||||
// Window size
|
||||
windowHeight = $(window).height(), windowWidth = $(window).width(),
|
||||
|
||||
// Global elements
|
||||
pp_slideshow;
|
||||
|
||||
doresize = true, scroll_pos = _get_scroll();
|
||||
|
||||
// Window/Keyboard events
|
||||
$(window).unbind('resize.prettyphoto').bind('resize.prettyphoto',function(){ _center_overlay(); _resize_overlay(); });
|
||||
|
||||
if(pp_settings.keyboard_shortcuts) {
|
||||
$(document).unbind('keydown.prettyphoto').bind('keydown.prettyphoto',function(e){
|
||||
if(typeof $pp_pic_holder != 'undefined'){
|
||||
if($pp_pic_holder.is(':visible')){
|
||||
switch(e.keyCode){
|
||||
case 37:
|
||||
$.prettyPhoto.changePage('previous');
|
||||
e.preventDefault();
|
||||
break;
|
||||
case 39:
|
||||
$.prettyPhoto.changePage('next');
|
||||
e.preventDefault();
|
||||
break;
|
||||
case 27:
|
||||
if(!settings.modal)
|
||||
$.prettyPhoto.close();
|
||||
e.preventDefault();
|
||||
break;
|
||||
};
|
||||
// return false;
|
||||
};
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Initialize prettyPhoto.
|
||||
*/
|
||||
$.prettyPhoto.initialize = function() {
|
||||
|
||||
settings = pp_settings;
|
||||
|
||||
if(settings.theme == 'pp_default') settings.horizontal_padding = 16;
|
||||
if(settings.ie6_fallback && $.browser.msie && parseInt($.browser.version) == 6) settings.theme = "light_square"; // Fallback to a supported theme for IE6
|
||||
|
||||
// Find out if the picture is part of a set
|
||||
theRel = $(this).attr('data-gal');
|
||||
galleryRegExp = /\[(?:.*)\]/;
|
||||
isSet = (galleryRegExp.exec(theRel)) ? true : false;
|
||||
|
||||
// Put the SRCs, TITLEs, ALTs into an array.
|
||||
pp_images = (isSet) ? jQuery.map(matchedObjects, function(n, i){ if($(n).attr('data-gal').indexOf(theRel) != -1) return $(n).attr('href'); }) : $.makeArray($(this).attr('href'));
|
||||
pp_titles = (isSet) ? jQuery.map(matchedObjects, function(n, i){ if($(n).attr('data-gal').indexOf(theRel) != -1) return ($(n).find('img').attr('alt')) ? $(n).find('img').attr('alt') : ""; }) : $.makeArray($(this).find('img').attr('alt'));
|
||||
pp_descriptions = (isSet) ? jQuery.map(matchedObjects, function(n, i){ if($(n).attr('data-gal').indexOf(theRel) != -1) return ($(n).attr('title')) ? $(n).attr('title') : ""; }) : $.makeArray($(this).attr('title'));
|
||||
|
||||
set_position = jQuery.inArray($(this).attr('href'), pp_images); // Define where in the array the clicked item is positionned
|
||||
rel_index = (isSet) ? set_position : $("a[data-gal^='"+theRel+"']").index($(this));
|
||||
|
||||
_build_overlay(this); // Build the overlay {this} being the caller
|
||||
|
||||
if(settings.allow_resize)
|
||||
$(window).bind('scroll.prettyphoto',function(){ _center_overlay(); });
|
||||
|
||||
|
||||
$.prettyPhoto.open();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Opens the prettyPhoto modal box.
|
||||
* @param image {String,Array} Full path to the image to be open, can also be an array containing full images paths.
|
||||
* @param title {String,Array} The title to be displayed with the picture, can also be an array containing all the titles.
|
||||
* @param description {String,Array} The description to be displayed with the picture, can also be an array containing all the descriptions.
|
||||
*/
|
||||
$.prettyPhoto.open = function(event) {
|
||||
if(typeof settings == "undefined"){ // Means it's an API call, need to manually get the settings and set the variables
|
||||
settings = pp_settings;
|
||||
if($.browser.msie && $.browser.version == 6) settings.theme = "light_square"; // Fallback to a supported theme for IE6
|
||||
pp_images = $.makeArray(arguments[0]);
|
||||
pp_titles = (arguments[1]) ? $.makeArray(arguments[1]) : $.makeArray("");
|
||||
pp_descriptions = (arguments[2]) ? $.makeArray(arguments[2]) : $.makeArray("");
|
||||
isSet = (pp_images.length > 1) ? true : false;
|
||||
set_position = 0;
|
||||
_build_overlay(event.target); // Build the overlay {this} being the caller
|
||||
}
|
||||
|
||||
if($.browser.msie && $.browser.version == 6) $('select').css('visibility','hidden'); // To fix the bug with IE select boxes
|
||||
|
||||
if(settings.hideflash) $('object,embed,iframe[src*=youtube],iframe[src*=vimeo]').css('visibility','hidden'); // Hide the flash
|
||||
|
||||
_checkPosition($(pp_images).size()); // Hide the next/previous links if on first or last images.
|
||||
|
||||
$('.pp_loaderIcon').show();
|
||||
|
||||
// Fade the content in
|
||||
if($ppt.is(':hidden')) $ppt.css('opacity',0).show();
|
||||
$pp_overlay.show().fadeTo(settings.animation_speed,settings.opacity);
|
||||
|
||||
// Display the current position
|
||||
$pp_pic_holder.find('.currentTextHolder').text((set_position+1) + settings.counter_separator_label + $(pp_images).size());
|
||||
|
||||
// Set the description
|
||||
if(pp_descriptions[set_position] != ""){
|
||||
$pp_pic_holder.find('.pp_description').show().html(unescape(pp_descriptions[set_position]));
|
||||
}else{
|
||||
$pp_pic_holder.find('.pp_description').hide();
|
||||
}
|
||||
|
||||
// Get the dimensions
|
||||
movie_width = ( parseFloat(getParam('width',pp_images[set_position])) ) ? getParam('width',pp_images[set_position]) : settings.default_width.toString();
|
||||
movie_height = ( parseFloat(getParam('height',pp_images[set_position])) ) ? getParam('height',pp_images[set_position]) : settings.default_height.toString();
|
||||
|
||||
// If the size is % based, calculate according to window dimensions
|
||||
percentBased=false;
|
||||
if(movie_height.indexOf('%') != -1) { movie_height = parseFloat(($(window).height() * parseFloat(movie_height) / 100) - 150); percentBased = true; }
|
||||
if(movie_width.indexOf('%') != -1) { movie_width = parseFloat(($(window).width() * parseFloat(movie_width) / 100) - 150); percentBased = true; }
|
||||
|
||||
// Fade the holder
|
||||
$pp_pic_holder.fadeIn(function(){
|
||||
// Set the title
|
||||
(settings.show_title && pp_titles[set_position] != "" && typeof pp_titles[set_position] != "undefined") ? $ppt.html(unescape(pp_titles[set_position])) : $ppt.html(' ');
|
||||
|
||||
imgPreloader = "";
|
||||
skipInjection = false;
|
||||
|
||||
// Inject the proper content
|
||||
switch(_getFileType(pp_images[set_position])){
|
||||
case 'image':
|
||||
imgPreloader = new Image();
|
||||
|
||||
// Preload the neighbour images
|
||||
nextImage = new Image();
|
||||
if(isSet && set_position < $(pp_images).size() -1) nextImage.src = pp_images[set_position + 1];
|
||||
prevImage = new Image();
|
||||
if(isSet && pp_images[set_position - 1]) prevImage.src = pp_images[set_position - 1];
|
||||
|
||||
$pp_pic_holder.find('#pp_full_res')[0].innerHTML = settings.image_markup.replace(/{path}/g,pp_images[set_position]);
|
||||
|
||||
imgPreloader.onload = function(){
|
||||
// Fit item to viewport
|
||||
pp_dimensions = _fitToViewport(imgPreloader.width,imgPreloader.height);
|
||||
|
||||
_showContent();
|
||||
};
|
||||
|
||||
imgPreloader.onerror = function(){
|
||||
alert('Image cannot be loaded. Make sure the path is correct and image exist.');
|
||||
$.prettyPhoto.close();
|
||||
};
|
||||
|
||||
imgPreloader.src = pp_images[set_position];
|
||||
break;
|
||||
|
||||
case 'youtube':
|
||||
pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
|
||||
|
||||
movie = 'http://www.youtube.com/embed/'+getParam('v',pp_images[set_position]);
|
||||
(getParam('data-gal',pp_images[set_position])) ? movie+="?data-gal="+getParam('data-gal',pp_images[set_position]) : movie+="?data-gal=1";
|
||||
|
||||
if(settings.autoplay) movie += "&autoplay=1";
|
||||
|
||||
toInject = settings.iframe_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,movie);
|
||||
break;
|
||||
|
||||
case 'vimeo':
|
||||
pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
|
||||
|
||||
movie_id = pp_images[set_position];
|
||||
var regExp = /http:\/\/(www\.)?vimeo.com\/(\d+)/;
|
||||
var match = movie_id.match(regExp);
|
||||
|
||||
movie = 'http://player.vimeo.com/video/'+ match[2] +'?title=0&byline=0&portrait=0';
|
||||
if(settings.autoplay) movie += "&autoplay=1;";
|
||||
|
||||
vimeo_width = pp_dimensions['width'] + '/embed/?moog_width='+ pp_dimensions['width'];
|
||||
|
||||
toInject = settings.iframe_markup.replace(/{width}/g,vimeo_width).replace(/{height}/g,pp_dimensions['height']).replace(/{path}/g,movie);
|
||||
break;
|
||||
|
||||
case 'quicktime':
|
||||
pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
|
||||
pp_dimensions['height']+=15; pp_dimensions['contentHeight']+=15; pp_dimensions['containerHeight']+=15; // Add space for the control bar
|
||||
|
||||
toInject = settings.quicktime_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,pp_images[set_position]).replace(/{autoplay}/g,settings.autoplay);
|
||||
break;
|
||||
|
||||
case 'flash':
|
||||
pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
|
||||
|
||||
flash_vars = pp_images[set_position];
|
||||
flash_vars = flash_vars.substring(pp_images[set_position].indexOf('flashvars') + 10,pp_images[set_position].length);
|
||||
|
||||
filename = pp_images[set_position];
|
||||
filename = filename.substring(0,filename.indexOf('?'));
|
||||
|
||||
toInject = settings.flash_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,filename+'?'+flash_vars);
|
||||
break;
|
||||
|
||||
case 'iframe':
|
||||
pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
|
||||
|
||||
frame_url = pp_images[set_position];
|
||||
frame_url = frame_url.substr(0,frame_url.indexOf('iframe')-1);
|
||||
|
||||
toInject = settings.iframe_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{path}/g,frame_url);
|
||||
break;
|
||||
|
||||
case 'ajax':
|
||||
doresize = false; // Make sure the dimensions are not resized.
|
||||
pp_dimensions = _fitToViewport(movie_width,movie_height);
|
||||
doresize = true; // Reset the dimensions
|
||||
|
||||
skipInjection = true;
|
||||
$.get(pp_images[set_position],function(responseHTML){
|
||||
toInject = settings.inline_markup.replace(/{content}/g,responseHTML);
|
||||
$pp_pic_holder.find('#pp_full_res')[0].innerHTML = toInject;
|
||||
_showContent();
|
||||
});
|
||||
|
||||
break;
|
||||
|
||||
case 'custom':
|
||||
pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
|
||||
|
||||
toInject = settings.custom_markup;
|
||||
break;
|
||||
|
||||
case 'inline':
|
||||
// to get the item height clone it, apply default width, wrap it in the prettyPhoto containers , then delete
|
||||
myClone = $(pp_images[set_position]).clone().append('<br clear="all" />').css({'width':settings.default_width}).wrapInner('<div id="pp_full_res"><div class="pp_inline"></div></div>').appendTo($('body')).show();
|
||||
doresize = false; // Make sure the dimensions are not resized.
|
||||
pp_dimensions = _fitToViewport($(myClone).width(),$(myClone).height());
|
||||
doresize = true; // Reset the dimensions
|
||||
$(myClone).remove();
|
||||
toInject = settings.inline_markup.replace(/{content}/g,$(pp_images[set_position]).html());
|
||||
break;
|
||||
};
|
||||
|
||||
if(!imgPreloader && !skipInjection){
|
||||
$pp_pic_holder.find('#pp_full_res')[0].innerHTML = toInject;
|
||||
|
||||
// Show content
|
||||
_showContent();
|
||||
};
|
||||
});
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Change page in the prettyPhoto modal box
|
||||
* @param direction {String} Direction of the paging, previous or next.
|
||||
*/
|
||||
$.prettyPhoto.changePage = function(direction){
|
||||
currentGalleryPage = 0;
|
||||
|
||||
if(direction == 'previous') {
|
||||
set_position--;
|
||||
if (set_position < 0) set_position = $(pp_images).size()-1;
|
||||
}else if(direction == 'next'){
|
||||
set_position++;
|
||||
if(set_position > $(pp_images).size()-1) set_position = 0;
|
||||
}else{
|
||||
set_position=direction;
|
||||
};
|
||||
|
||||
rel_index = set_position;
|
||||
|
||||
if(!doresize) doresize = true; // Allow the resizing of the images
|
||||
$('.pp_contract').removeClass('pp_contract').addClass('pp_expand');
|
||||
|
||||
_hideContent(function(){ $.prettyPhoto.open(); });
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Change gallery page in the prettyPhoto modal box
|
||||
* @param direction {String} Direction of the paging, previous or next.
|
||||
*/
|
||||
$.prettyPhoto.changeGalleryPage = function(direction){
|
||||
if(direction=='next'){
|
||||
currentGalleryPage ++;
|
||||
|
||||
if(currentGalleryPage > totalPage) currentGalleryPage = 0;
|
||||
}else if(direction=='previous'){
|
||||
currentGalleryPage --;
|
||||
|
||||
if(currentGalleryPage < 0) currentGalleryPage = totalPage;
|
||||
}else{
|
||||
currentGalleryPage = direction;
|
||||
};
|
||||
|
||||
slide_speed = (direction == 'next' || direction == 'previous') ? settings.animation_speed : 0;
|
||||
|
||||
slide_to = currentGalleryPage * (itemsPerPage * itemWidth);
|
||||
|
||||
$pp_gallery.find('ul').animate({left:-slide_to},slide_speed);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Start the slideshow...
|
||||
*/
|
||||
$.prettyPhoto.startSlideshow = function(){
|
||||
if(typeof pp_slideshow == 'undefined'){
|
||||
$pp_pic_holder.find('.pp_play').unbind('click').removeClass('pp_play').addClass('pp_pause').click(function(){
|
||||
$.prettyPhoto.stopSlideshow();
|
||||
return false;
|
||||
});
|
||||
pp_slideshow = setInterval($.prettyPhoto.startSlideshow,settings.slideshow);
|
||||
}else{
|
||||
$.prettyPhoto.changePage('next');
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Stop the slideshow...
|
||||
*/
|
||||
$.prettyPhoto.stopSlideshow = function(){
|
||||
$pp_pic_holder.find('.pp_pause').unbind('click').removeClass('pp_pause').addClass('pp_play').click(function(){
|
||||
$.prettyPhoto.startSlideshow();
|
||||
return false;
|
||||
});
|
||||
clearInterval(pp_slideshow);
|
||||
pp_slideshow=undefined;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Closes prettyPhoto.
|
||||
*/
|
||||
$.prettyPhoto.close = function(){
|
||||
if($pp_overlay.is(":animated")) return;
|
||||
|
||||
$.prettyPhoto.stopSlideshow();
|
||||
|
||||
$pp_pic_holder.stop().find('object,embed').css('visibility','hidden');
|
||||
|
||||
$('div.pp_pic_holder,div.ppt,.pp_fade').fadeOut(settings.animation_speed,function(){ $(this).remove(); });
|
||||
|
||||
$pp_overlay.fadeOut(settings.animation_speed, function(){
|
||||
if($.browser.msie && $.browser.version == 6) $('select').css('visibility','visible'); // To fix the bug with IE select boxes
|
||||
|
||||
if(settings.hideflash) $('object,embed,iframe[src*=youtube],iframe[src*=vimeo]').css('visibility','visible'); // Show the flash
|
||||
|
||||
$(this).remove(); // No more need for the prettyPhoto markup
|
||||
|
||||
$(window).unbind('scroll.prettyphoto');
|
||||
|
||||
settings.callback();
|
||||
|
||||
doresize = true;
|
||||
|
||||
pp_open = false;
|
||||
|
||||
delete settings;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Set the proper sizes on the containers and animate the content in.
|
||||
*/
|
||||
function _showContent(){
|
||||
$('.pp_loaderIcon').hide();
|
||||
|
||||
// Calculate the opened top position of the pic holder
|
||||
projectedTop = scroll_pos['scrollTop'] + ((windowHeight/2) - (pp_dimensions['containerHeight']/2));
|
||||
if(projectedTop < 0) projectedTop = 0;
|
||||
|
||||
$ppt.fadeTo(settings.animation_speed,1);
|
||||
|
||||
// Resize the content holder
|
||||
$pp_pic_holder.find('.pp_content')
|
||||
.animate({
|
||||
height:pp_dimensions['contentHeight'],
|
||||
width:pp_dimensions['contentWidth']
|
||||
},settings.animation_speed);
|
||||
|
||||
// Resize picture the holder
|
||||
$pp_pic_holder.animate({
|
||||
'top': projectedTop,
|
||||
'left': (windowWidth/2) - (pp_dimensions['containerWidth']/2),
|
||||
width:pp_dimensions['containerWidth']
|
||||
},settings.animation_speed,function(){
|
||||
$pp_pic_holder.find('.pp_hoverContainer,#fullResImage').height(pp_dimensions['height']).width(pp_dimensions['width']);
|
||||
|
||||
$pp_pic_holder.find('.pp_fade').fadeIn(settings.animation_speed); // Fade the new content
|
||||
|
||||
// Show the nav
|
||||
if(isSet && _getFileType(pp_images[set_position])=="image") { $pp_pic_holder.find('.pp_hoverContainer').show(); }else{ $pp_pic_holder.find('.pp_hoverContainer').hide(); }
|
||||
|
||||
if(pp_dimensions['resized']){ // Fade the resizing link if the image is resized
|
||||
$('a.pp_expand,a.pp_contract').show();
|
||||
}else{
|
||||
$('a.pp_expand').hide();
|
||||
}
|
||||
|
||||
if(settings.autoplay_slideshow && !pp_slideshow && !pp_open) $.prettyPhoto.startSlideshow();
|
||||
|
||||
if(settings.deeplinking)
|
||||
setHashtag();
|
||||
|
||||
settings.changepicturecallback(); // Callback!
|
||||
|
||||
pp_open = true;
|
||||
});
|
||||
|
||||
_insert_gallery();
|
||||
};
|
||||
|
||||
/**
|
||||
* Hide the content...DUH!
|
||||
*/
|
||||
function _hideContent(callback){
|
||||
// Fade out the current picture
|
||||
$pp_pic_holder.find('#pp_full_res object,#pp_full_res embed').css('visibility','hidden');
|
||||
$pp_pic_holder.find('.pp_fade').fadeOut(settings.animation_speed,function(){
|
||||
$('.pp_loaderIcon').show();
|
||||
|
||||
callback();
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Check the item position in the gallery array, hide or show the navigation links
|
||||
* @param setCount {integer} The total number of items in the set
|
||||
*/
|
||||
function _checkPosition(setCount){
|
||||
(setCount > 1) ? $('.pp_nav').show() : $('.pp_nav').hide(); // Hide the bottom nav if it's not a set.
|
||||
};
|
||||
|
||||
/**
|
||||
* Resize the item dimensions if it's bigger than the viewport
|
||||
* @param width {integer} Width of the item to be opened
|
||||
* @param height {integer} Height of the item to be opened
|
||||
* @return An array containin the "fitted" dimensions
|
||||
*/
|
||||
function _fitToViewport(width,height){
|
||||
resized = false;
|
||||
|
||||
_getDimensions(width,height);
|
||||
|
||||
// Define them in case there's no resize needed
|
||||
imageWidth = width, imageHeight = height;
|
||||
|
||||
if( ((pp_containerWidth > windowWidth) || (pp_containerHeight > windowHeight)) && doresize && settings.allow_resize && !percentBased) {
|
||||
resized = true, fitting = false;
|
||||
|
||||
while (!fitting){
|
||||
if((pp_containerWidth > windowWidth)){
|
||||
imageWidth = (windowWidth - 200);
|
||||
imageHeight = (height/width) * imageWidth;
|
||||
}else if((pp_containerHeight > windowHeight)){
|
||||
imageHeight = (windowHeight - 200);
|
||||
imageWidth = (width/height) * imageHeight;
|
||||
}else{
|
||||
fitting = true;
|
||||
};
|
||||
|
||||
pp_containerHeight = imageHeight, pp_containerWidth = imageWidth;
|
||||
};
|
||||
|
||||
_getDimensions(imageWidth,imageHeight);
|
||||
|
||||
if((pp_containerWidth > windowWidth) || (pp_containerHeight > windowHeight)){
|
||||
_fitToViewport(pp_containerWidth,pp_containerHeight)
|
||||
};
|
||||
};
|
||||
|
||||
return {
|
||||
width:Math.floor(imageWidth),
|
||||
height:Math.floor(imageHeight),
|
||||
containerHeight:Math.floor(pp_containerHeight),
|
||||
containerWidth:Math.floor(pp_containerWidth) + (settings.horizontal_padding * 2),
|
||||
contentHeight:Math.floor(pp_contentHeight),
|
||||
contentWidth:Math.floor(pp_contentWidth),
|
||||
resized:resized
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the containers dimensions according to the item size
|
||||
* @param width {integer} Width of the item to be opened
|
||||
* @param height {integer} Height of the item to be opened
|
||||
*/
|
||||
function _getDimensions(width,height){
|
||||
width = parseFloat(width);
|
||||
height = parseFloat(height);
|
||||
|
||||
// Get the details height, to do so, I need to clone it since it's invisible
|
||||
$pp_details = $pp_pic_holder.find('.pp_details');
|
||||
$pp_details.width(width);
|
||||
detailsHeight = parseFloat($pp_details.css('marginTop')) + parseFloat($pp_details.css('marginBottom'));
|
||||
|
||||
$pp_details = $pp_details.clone().addClass(settings.theme).width(width).appendTo($('body')).css({
|
||||
'position':'absolute',
|
||||
'top':-10000
|
||||
});
|
||||
detailsHeight += $pp_details.height();
|
||||
detailsHeight = (detailsHeight <= 34) ? 36 : detailsHeight; // Min-height for the details
|
||||
if($.browser.msie && $.browser.version==7) detailsHeight+=8;
|
||||
$pp_details.remove();
|
||||
|
||||
// Get the titles height, to do so, I need to clone it since it's invisible
|
||||
$pp_title = $pp_pic_holder.find('.ppt');
|
||||
$pp_title.width(width);
|
||||
titleHeight = parseFloat($pp_title.css('marginTop')) + parseFloat($pp_title.css('marginBottom'));
|
||||
$pp_title = $pp_title.clone().appendTo($('body')).css({
|
||||
'position':'absolute',
|
||||
'top':-10000
|
||||
});
|
||||
titleHeight += $pp_title.height();
|
||||
$pp_title.remove();
|
||||
|
||||
// Get the container size, to resize the holder to the right dimensions
|
||||
pp_contentHeight = height + detailsHeight;
|
||||
pp_contentWidth = width;
|
||||
pp_containerHeight = pp_contentHeight + titleHeight + $pp_pic_holder.find('.pp_top').height() + $pp_pic_holder.find('.pp_bottom').height();
|
||||
pp_containerWidth = width;
|
||||
}
|
||||
|
||||
function _getFileType(itemSrc){
|
||||
if (itemSrc.match(/youtube\.com\/watch/i)) {
|
||||
return 'youtube';
|
||||
}else if (itemSrc.match(/vimeo\.com/i)) {
|
||||
return 'vimeo';
|
||||
}else if(itemSrc.match(/\b.mov\b/i)){
|
||||
return 'quicktime';
|
||||
}else if(itemSrc.match(/\b.swf\b/i)){
|
||||
return 'flash';
|
||||
}else if(itemSrc.match(/\biframe=true\b/i)){
|
||||
return 'iframe';
|
||||
}else if(itemSrc.match(/\bajax=true\b/i)){
|
||||
return 'ajax';
|
||||
}else if(itemSrc.match(/\bcustom=true\b/i)){
|
||||
return 'custom';
|
||||
}else if(itemSrc.substr(0,1) == '#'){
|
||||
return 'inline';
|
||||
}else{
|
||||
return 'image';
|
||||
};
|
||||
};
|
||||
|
||||
function _center_overlay(){
|
||||
if(doresize && typeof $pp_pic_holder != 'undefined') {
|
||||
scroll_pos = _get_scroll();
|
||||
contentHeight = $pp_pic_holder.height(), contentwidth = $pp_pic_holder.width();
|
||||
|
||||
projectedTop = (windowHeight/2) + scroll_pos['scrollTop'] - (contentHeight/2);
|
||||
if(projectedTop < 0) projectedTop = 0;
|
||||
|
||||
if(contentHeight > windowHeight)
|
||||
return;
|
||||
|
||||
$pp_pic_holder.css({
|
||||
'top': projectedTop,
|
||||
'left': (windowWidth/2) + scroll_pos['scrollLeft'] - (contentwidth/2)
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
function _get_scroll(){
|
||||
if (self.pageYOffset) {
|
||||
return {scrollTop:self.pageYOffset,scrollLeft:self.pageXOffset};
|
||||
} else if (document.documentElement && document.documentElement.scrollTop) { // Explorer 6 Strict
|
||||
return {scrollTop:document.documentElement.scrollTop,scrollLeft:document.documentElement.scrollLeft};
|
||||
} else if (document.body) {// all other Explorers
|
||||
return {scrollTop:document.body.scrollTop,scrollLeft:document.body.scrollLeft};
|
||||
};
|
||||
};
|
||||
|
||||
function _resize_overlay() {
|
||||
windowHeight = $(window).height(), windowWidth = $(window).width();
|
||||
|
||||
if(typeof $pp_overlay != "undefined") $pp_overlay.height($(document).height()).width(windowWidth);
|
||||
};
|
||||
|
||||
function _insert_gallery(){
|
||||
if(isSet && settings.overlay_gallery && _getFileType(pp_images[set_position])=="image" && (settings.ie6_fallback && !($.browser.msie && parseInt($.browser.version) == 6))) {
|
||||
itemWidth = 52+5; // 52 beign the thumb width, 5 being the right margin.
|
||||
navWidth = (settings.theme == "facebook" || settings.theme == "pp_default") ? 50 : 30; // Define the arrow width depending on the theme
|
||||
|
||||
itemsPerPage = Math.floor((pp_dimensions['containerWidth'] - 100 - navWidth) / itemWidth);
|
||||
itemsPerPage = (itemsPerPage < pp_images.length) ? itemsPerPage : pp_images.length;
|
||||
totalPage = Math.ceil(pp_images.length / itemsPerPage) - 1;
|
||||
|
||||
// Hide the nav in the case there's no need for links
|
||||
if(totalPage == 0){
|
||||
navWidth = 0; // No nav means no width!
|
||||
$pp_gallery.find('.pp_arrow_next,.pp_arrow_previous').hide();
|
||||
}else{
|
||||
$pp_gallery.find('.pp_arrow_next,.pp_arrow_previous').show();
|
||||
};
|
||||
|
||||
galleryWidth = itemsPerPage * itemWidth;
|
||||
fullGalleryWidth = pp_images.length * itemWidth;
|
||||
|
||||
// Set the proper width to the gallery items
|
||||
$pp_gallery
|
||||
.css('margin-left',-((galleryWidth/2) + (navWidth/2)))
|
||||
.find('div:first').width(galleryWidth+5)
|
||||
.find('ul').width(fullGalleryWidth)
|
||||
.find('li.selected').removeClass('selected');
|
||||
|
||||
goToPage = (Math.floor(set_position/itemsPerPage) < totalPage) ? Math.floor(set_position/itemsPerPage) : totalPage;
|
||||
|
||||
$.prettyPhoto.changeGalleryPage(goToPage);
|
||||
|
||||
$pp_gallery_li.filter(':eq('+set_position+')').addClass('selected');
|
||||
}else{
|
||||
$pp_pic_holder.find('.pp_content').unbind('mouseenter mouseleave');
|
||||
// $pp_gallery.hide();
|
||||
}
|
||||
}
|
||||
|
||||
function _build_overlay(caller){
|
||||
|
||||
settings.markup=settings.markup.replace('{pp_social}',(settings.social_tools)?settings.social_tools:'');
|
||||
|
||||
$('body').append(settings.markup); // Inject the markup
|
||||
|
||||
$pp_pic_holder = $('.pp_pic_holder') , $ppt = $('.ppt'), $pp_overlay = $('div.pp_overlay'); // Set my global selectors
|
||||
|
||||
// Inject the inline gallery!
|
||||
if(isSet && settings.overlay_gallery) {
|
||||
currentGalleryPage = 0;
|
||||
toInject = "";
|
||||
for (var i=0; i < pp_images.length; i++) {
|
||||
if(!pp_images[i].match(/\b(jpg|jpeg|png|gif)\b/gi)){
|
||||
classname = 'default';
|
||||
img_src = '';
|
||||
}else{
|
||||
classname = '';
|
||||
img_src = pp_images[i];
|
||||
}
|
||||
toInject += "<li class='"+classname+"'><a href='#'><img src='" + img_src + "' width='50' alt='' /></a></li>";
|
||||
};
|
||||
|
||||
toInject = settings.gallery_markup.replace(/{gallery}/g,toInject);
|
||||
|
||||
$pp_pic_holder.find('#pp_full_res').after(toInject);
|
||||
|
||||
$pp_gallery = $('.pp_pic_holder .pp_gallery'), $pp_gallery_li = $pp_gallery.find('li'); // Set the gallery selectors
|
||||
|
||||
$pp_gallery.find('.pp_arrow_next').click(function(){
|
||||
$.prettyPhoto.changeGalleryPage('next');
|
||||
$.prettyPhoto.stopSlideshow();
|
||||
return false;
|
||||
});
|
||||
|
||||
$pp_gallery.find('.pp_arrow_previous').click(function(){
|
||||
$.prettyPhoto.changeGalleryPage('previous');
|
||||
$.prettyPhoto.stopSlideshow();
|
||||
return false;
|
||||
});
|
||||
|
||||
$pp_pic_holder.find('.pp_content').hover(
|
||||
function(){
|
||||
$pp_pic_holder.find('.pp_gallery:not(.disabled)').fadeIn();
|
||||
},
|
||||
function(){
|
||||
$pp_pic_holder.find('.pp_gallery:not(.disabled)').fadeOut();
|
||||
});
|
||||
|
||||
itemWidth = 52+5; // 52 beign the thumb width, 5 being the right margin.
|
||||
$pp_gallery_li.each(function(i){
|
||||
$(this)
|
||||
.find('a')
|
||||
.click(function(){
|
||||
$.prettyPhoto.changePage(i);
|
||||
$.prettyPhoto.stopSlideshow();
|
||||
return false;
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
// Inject the play/pause if it's a slideshow
|
||||
if(settings.slideshow){
|
||||
$pp_pic_holder.find('.pp_nav').prepend('<a href="#" class="pp_play">Play</a>')
|
||||
$pp_pic_holder.find('.pp_nav .pp_play').click(function(){
|
||||
$.prettyPhoto.startSlideshow();
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
$pp_pic_holder.attr('class','pp_pic_holder ' + settings.theme); // Set the proper theme
|
||||
|
||||
$pp_overlay
|
||||
.css({
|
||||
'opacity':0,
|
||||
'height':$(document).height(),
|
||||
'width':$(window).width()
|
||||
})
|
||||
.bind('click',function(){
|
||||
if(!settings.modal) $.prettyPhoto.close();
|
||||
});
|
||||
|
||||
$('a.pp_close').bind('click',function(){ $.prettyPhoto.close(); return false; });
|
||||
|
||||
$('a.pp_expand').bind('click',function(e){
|
||||
// Expand the image
|
||||
if($(this).hasClass('pp_expand')){
|
||||
$(this).removeClass('pp_expand').addClass('pp_contract');
|
||||
doresize = false;
|
||||
}else{
|
||||
$(this).removeClass('pp_contract').addClass('pp_expand');
|
||||
doresize = true;
|
||||
};
|
||||
|
||||
_hideContent(function(){ $.prettyPhoto.open(); });
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
$pp_pic_holder.find('.pp_previous, .pp_nav .pp_arrow_previous').bind('click',function(){
|
||||
$.prettyPhoto.changePage('previous');
|
||||
$.prettyPhoto.stopSlideshow();
|
||||
return false;
|
||||
});
|
||||
|
||||
$pp_pic_holder.find('.pp_next, .pp_nav .pp_arrow_next').bind('click',function(){
|
||||
$.prettyPhoto.changePage('next');
|
||||
$.prettyPhoto.stopSlideshow();
|
||||
return false;
|
||||
});
|
||||
|
||||
_center_overlay(); // Center it
|
||||
};
|
||||
|
||||
if(!pp_alreadyInitialized && getHashtag()){
|
||||
pp_alreadyInitialized = true;
|
||||
|
||||
// Grab the rel index to trigger the click on the correct element
|
||||
hashIndex = getHashtag();
|
||||
hashRel = hashIndex;
|
||||
hashIndex = hashIndex.substring(hashIndex.indexOf('/')+1,hashIndex.length-1);
|
||||
hashRel = hashRel.substring(0,hashRel.indexOf('/'));
|
||||
|
||||
// Little timeout to make sure all the prettyPhoto initialize scripts has been run.
|
||||
// Useful in the event the page contain several init scripts.
|
||||
setTimeout(function(){ $("a[data-gal^='"+hashRel+"']:eq("+hashIndex+")").trigger('click'); },50);
|
||||
}
|
||||
|
||||
return this.unbind('click.prettyphoto').bind('click.prettyphoto',$.prettyPhoto.initialize); // Return the jQuery object for chaining. The unbind method is used to avoid click conflict when the plugin is called more than once
|
||||
};
|
||||
|
||||
function getHashtag(){
|
||||
url = location.href;
|
||||
hashtag = (url.indexOf('#!') != -1) ? decodeURI(url.substring(url.indexOf('#!')+2,url.length)) : false;
|
||||
return hashtag;
|
||||
};
|
||||
|
||||
function setHashtag(){
|
||||
if(typeof theRel == 'undefined') return; // theRel is set on normal calls, it's impossible to deeplink using the API
|
||||
location.hash = '!' + theRel + '/'+rel_index+'/';
|
||||
};
|
||||
|
||||
function getParam(name,url){
|
||||
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
|
||||
var regexS = "[\\?&]"+name+"=([^&#]*)";
|
||||
var regex = new RegExp( regexS );
|
||||
var results = regex.exec( url );
|
||||
return ( results == null ) ? "" : results[1];
|
||||
}
|
||||
|
||||
})(jQuery);
|
||||
|
||||
var pp_alreadyInitialized = false; // Used for the deep linking to make sure not to call the same function several times.
|
||||
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Copyright (c) 2007-2012 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
|
||||
* Dual licensed under MIT and GPL.
|
||||
* @author Ariel Flesler
|
||||
* @version 1.4.3
|
||||
*/
|
||||
;(function($){var h=$.scrollTo=function(a,b,c){$(window).scrollTo(a,b,c)};h.defaults={axis:'xy',duration:parseFloat($.fn.jquery)>=1.3?0:1,limit:true};h.window=function(a){return $(window)._scrollable()};$.fn._scrollable=function(){return this.map(function(){var a=this,isWin=!a.nodeName||$.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!isWin)return a;var b=(a.contentWindow||a).document||a.ownerDocument||a;return/webkit/i.test(navigator.userAgent)||b.compatMode=='BackCompat'?b.body:b.documentElement})};$.fn.scrollTo=function(e,f,g){if(typeof f=='object'){g=f;f=0}if(typeof g=='function')g={onAfter:g};if(e=='max')e=9e9;g=$.extend({},h.defaults,g);f=f||g.duration;g.queue=g.queue&&g.axis.length>1;if(g.queue)f/=2;g.offset=both(g.offset);g.over=both(g.over);return this._scrollable().each(function(){if(!e)return;var d=this,$elem=$(d),targ=e,toff,attr={},win=$elem.is('html,body');switch(typeof targ){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(targ)){targ=both(targ);break}targ=$(targ,this);if(!targ.length)return;case'object':if(targ.is||targ.style)toff=(targ=$(targ)).offset()}$.each(g.axis.split(''),function(i,a){var b=a=='x'?'Left':'Top',pos=b.toLowerCase(),key='scroll'+b,old=d[key],max=h.max(d,a);if(toff){attr[key]=toff[pos]+(win?0:old-$elem.offset()[pos]);if(g.margin){attr[key]-=parseInt(targ.css('margin'+b))||0;attr[key]-=parseInt(targ.css('border'+b+'Width'))||0}attr[key]+=g.offset[pos]||0;if(g.over[pos])attr[key]+=targ[a=='x'?'width':'height']()*g.over[pos]}else{var c=targ[pos];attr[key]=c.slice&&c.slice(-1)=='%'?parseFloat(c)/100*max:c}if(g.limit&&/^\d+$/.test(attr[key]))attr[key]=attr[key]<=0?0:Math.min(attr[key],max);if(!i&&g.queue){if(old!=attr[key])animate(g.onAfterFirst);delete attr[key]}});animate(g.onAfter);function animate(a){$elem.animate(attr,f,g.easing,a&&function(){a.call(this,e,g)})}}).end()};h.max=function(a,b){var c=b=='x'?'Width':'Height',scroll='scroll'+c;if(!$(a).is('html,body'))return a[scroll]-$(a)[c.toLowerCase()]();var d='client'+c,html=a.ownerDocument.documentElement,body=a.ownerDocument.body;return Math.max(html[scroll],body[scroll])-Math.min(html[d],body[d])};function both(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
var q=null;window.PR_SHOULD_USE_CONTINUATION=!0;
|
||||
(function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a=
|
||||
[],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c<i;++c){var j=f[c];if(/\\[bdsw]/i.test(j))a.push(j);else{var j=m(j),d;c+2<i&&"-"===f[c+1]?(d=m(f[c+2]),c+=2):d=j;b.push([j,d]);d<65||j>122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;c<b.length;++c)i=b[c],i[0]<=j[1]+1?j[1]=Math.max(j[1],i[1]):f.push(j=i);b=["["];o&&b.push("^");b.push.apply(b,a);for(c=0;c<
|
||||
f.length;++c)i=f[c],b.push(e(i[0])),i[1]>i[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c<b;++c){var j=f[c];j==="("?++i:"\\"===j.charAt(0)&&(j=+j.substring(1))&&j<=i&&(d[j]=-1)}for(c=1;c<d.length;++c)-1===d[c]&&(d[c]=++t);for(i=c=0;c<b;++c)j=f[c],j==="("?(++i,d[i]===void 0&&(f[c]="(?:")):"\\"===j.charAt(0)&&
|
||||
(j=+j.substring(1))&&j<=i&&(f[c]="\\"+d[i]);for(i=c=0;c<b;++c)"^"===f[c]&&"^"!==f[c+1]&&(f[c]="");if(a.ignoreCase&&s)for(c=0;c<b;++c)j=f[c],a=j.charAt(0),j.length>=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p<d;++p){var g=a[p];if(g.ignoreCase)l=!0;else if(/[a-z]/i.test(g.source.replace(/\\u[\da-f]{4}|\\x[\da-f]{2}|\\[^UXux]/gi,""))){s=!0;l=!1;break}}for(var r=
|
||||
{b:8,t:9,n:10,v:11,f:12,r:13},n=[],p=0,d=a.length;p<d;++p){g=a[p];if(g.global||g.multiline)throw Error(""+g);n.push("(?:"+y(g)+")")}return RegExp(n.join("|"),l?"gi":"g")}function M(a){function m(a){switch(a.nodeType){case 1:if(e.test(a.className))break;for(var g=a.firstChild;g;g=g.nextSibling)m(g);g=a.nodeName;if("BR"===g||"LI"===g)h[s]="\n",t[s<<1]=y++,t[s++<<1|1]=a;break;case 3:case 4:g=a.nodeValue,g.length&&(g=p?g.replace(/\r\n?/g,"\n"):g.replace(/[\t\n\r ]+/g," "),h[s]=g,t[s<<1]=y,y+=g.length,
|
||||
t[s++<<1|1]=a)}}var e=/(?:^|\s)nocode(?:\s|$)/,h=[],y=0,t=[],s=0,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=document.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);m(a);return{a:h.join("").replace(/\n$/,""),c:t}}function B(a,m,e,h){m&&(a={a:m,d:a},e(a),h.push.apply(h,a.e))}function x(a,m){function e(a){for(var l=a.d,p=[l,"pln"],d=0,g=a.a.match(y)||[],r={},n=0,z=g.length;n<z;++n){var f=g[n],b=r[f],o=void 0,c;if(typeof b===
|
||||
"string")c=!1;else{var i=h[f.charAt(0)];if(i)o=f.match(i[1]),b=i[0];else{for(c=0;c<t;++c)if(i=m[c],o=f.match(i[1])){b=i[0];break}o||(b="pln")}if((c=b.length>=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m),
|
||||
l=[],p={},d=0,g=e.length;d<g;++d){var r=e[d],n=r[3];if(n)for(var k=n.length;--k>=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/,
|
||||
q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/,
|
||||
q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g,
|
||||
"");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a),
|
||||
a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e}
|
||||
for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g<d.length;++g)e(d[g]);m===(m|0)&&d[0].setAttribute("value",
|
||||
m);var r=s.createElement("OL");r.className="linenums";for(var n=Math.max(0,m-1|0)||0,g=0,z=d.length;g<z;++g)l=d[g],l.className="L"+(g+n)%10,l.firstChild||l.appendChild(s.createTextNode("\xa0")),r.appendChild(l);a.appendChild(r)}function k(a,m){for(var e=m.length;--e>=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*</.test(m)?"default-markup":"default-code";return A[a]}function E(a){var m=
|
||||
a.g;try{var e=M(a.h),h=e.a;a.a=h;a.c=e.c;a.d=0;C(m,h)(a);var k=/\bMSIE\b/.test(navigator.userAgent),m=/\n/g,t=a.a,s=t.length,e=0,l=a.c,p=l.length,h=0,d=a.e,g=d.length,a=0;d[g]=s;var r,n;for(n=r=0;n<g;)d[n]!==d[n+2]?(d[r++]=d[n++],d[r++]=d[n++]):n+=2;g=r;for(n=r=0;n<g;){for(var z=d[n],f=d[n+1],b=n+2;b+2<=g&&d[b+1]===f;)b+=2;d[r++]=z;d[r++]=f;n=b}for(d.length=r;h<p;){var o=l[h+2]||s,c=d[a+2]||s,b=Math.min(o,c),i=l[h+1],j;if(i.nodeType!==1&&(j=t.substring(e,b))){k&&(j=j.replace(m,"\r"));i.nodeValue=
|
||||
j;var u=i.ownerDocument,v=u.createElement("SPAN");v.className=d[a+1];var x=i.parentNode;x.replaceChild(v,i);v.appendChild(i);e<o&&(l[h+1]=i=u.createTextNode(t.substring(b,o)),x.insertBefore(i,v.nextSibling))}e=b;e>=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],
|
||||
"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"],
|
||||
H=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],
|
||||
J=[v,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+
|
||||
I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^<?]+/],["dec",/^<!\w[^>]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),
|
||||
["default-markup","htm","html","mxml","xhtml","xml","xsl"]);k(x([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css",
|
||||
/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);k(x([],[["atv",/^[\S\s]+/]]),["uq.val"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),["c","cc","cpp","cxx","cyc","m"]);k(u({keywords:"null,true,false"}),["json"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),["cs"]);k(u({keywords:G,cStyleComments:!0}),["java"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),
|
||||
["cv","py"]);k(u({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),["js"]);k(u({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes",
|
||||
hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);k(x([],[["str",/^[\S\s]+/]]),["regex"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement("PRE");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p<h.length&&l.now()<e;p++){var n=h[p],k=n.className;if(k.indexOf("prettyprint")>=0){var k=k.match(g),f,b;if(b=
|
||||
!k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&"CODE"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName==="pre"||o.tagName==="code"||o.tagName==="xmp")&&o.className&&o.className.indexOf("prettyprint")>=0){b=!0;break}b||((b=(b=n.className.match(/\blinenums\b(?::(\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p<h.length?setTimeout(m,
|
||||
250):a&&a()}for(var e=[document.getElementsByTagName("pre"),document.getElementsByTagName("code"),document.getElementsByTagName("xmp")],h=[],k=0;k<e.length;++k)for(var t=0,s=e[k].length;t<s;++t)h.push(e[k][t]);var e=q,l=Date;l.now||(l={now:function(){return+new Date}});var p=0,d,g=/\blang(?:uage)?-([\w.]+)(?!\S)/;m()};window.PR={createSimpleLexer:x,registerLangHandler:k,sourceDecorator:u,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit",
|
||||
PR_NOCODE:"nocode",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ"}})();
|
||||
+112
@@ -0,0 +1,112 @@
|
||||
;(function($){
|
||||
function init(form,o){
|
||||
var name=$('.name>input',form)
|
||||
,email=$('.email>input',form)
|
||||
,submit=$('a[data-type="submit"]',form)
|
||||
,msg_success=$('.success',form).hide()
|
||||
,bl,vl
|
||||
|
||||
o=$.extend({
|
||||
ownerEmail:'#'
|
||||
,mailHandlerURL:'bat/MailHandler-sub.php'
|
||||
},o)
|
||||
|
||||
submit.click(function(){
|
||||
vl=true
|
||||
name.add(email).trigger('keyup')
|
||||
if(!$('.invalid',form).length)
|
||||
sendRQ()
|
||||
return false
|
||||
})
|
||||
|
||||
form[form.on?'on':'bind']('keyup',function(e){
|
||||
if(e.keyCode===13){
|
||||
name.add(email).data({wtch:true}).trigger('keyup')
|
||||
if(!$('.invalid',form).length){
|
||||
sendRQ()
|
||||
return false
|
||||
}else{
|
||||
$('.invalid',form).focus()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
name.add(email)
|
||||
.data({wtch:true})
|
||||
.each(function(){
|
||||
var th=$(this)
|
||||
,val=th.val()
|
||||
th
|
||||
.data({defVal:val})
|
||||
.focus(function(){
|
||||
if(th.val()==val)
|
||||
th.val('')
|
||||
,th.parents('label').removeClass('invalid')
|
||||
,th.data({wtch:false})
|
||||
})
|
||||
.blur(function(){
|
||||
if(th.val()=='')
|
||||
th.val(val)
|
||||
//,th.parents('label').removeClass('invalid')
|
||||
//else
|
||||
th.data({wtch:true}).trigger('keyup')
|
||||
})
|
||||
})
|
||||
[name.on?'on':'bind']('keyup',function(e){
|
||||
var th=$(this)
|
||||
if(th.data('wtch'))
|
||||
th.parents('label')[validate(th)?'removeClass':'addClass']('invalid')
|
||||
})
|
||||
|
||||
function validate(el){
|
||||
var rx={
|
||||
"text":/^[a-zA-Z'][a-zA-Z-' ]+[a-zA-Z']?$/
|
||||
,"email":/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i
|
||||
}
|
||||
,val=el.val();
|
||||
(el.parents('label').hasClass('email')) && el.attr({'type':'email'});
|
||||
return rx[el.attr('type')].test(val)&&val!==el.data('defVal')
|
||||
}
|
||||
|
||||
function sendRQ(){
|
||||
if(bl)
|
||||
return false
|
||||
bl=true
|
||||
$.ajax({
|
||||
type:"POST"
|
||||
,url:o.mailHandlerURL
|
||||
,data:{
|
||||
name:name.length?name.val():email.val().split('@')[0]
|
||||
,email:email.val()
|
||||
,owner_email:o.ownerEmail
|
||||
,sitename:o.sitename||o.ownerEmail.split('@')[1]
|
||||
}
|
||||
,success:function(e){
|
||||
bl=false
|
||||
msg_success
|
||||
.slideDown(400,function(){
|
||||
submit.focus()
|
||||
form.trigger('reset')
|
||||
name.add(email).data({wtch:true})
|
||||
setTimeout(function(){
|
||||
msg_success.fadeOut(400)
|
||||
},1000)
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
$.fn.sForm=function(o){
|
||||
return this.each(function(){
|
||||
init($(this),o)
|
||||
})
|
||||
}
|
||||
|
||||
})(jQuery)
|
||||
$(window).load(function(){
|
||||
$('#subscribe-form').sForm({
|
||||
ownerEmail:'#'
|
||||
,sitename:'sitename.link'
|
||||
})
|
||||
})
|
||||
+134
@@ -0,0 +1,134 @@
|
||||
$(document).ready(function() {
|
||||
var currentYear = (new Date).getFullYear();
|
||||
$("#copyright-year").text( (new Date).getFullYear() );
|
||||
// hide #back-top first
|
||||
$("#back-top").hide();
|
||||
// fade in #back-top
|
||||
$(function () {
|
||||
$(window).scroll(function () {
|
||||
if ($(this).scrollTop() > 100) {
|
||||
$('#back-top').fadeIn();
|
||||
} else {
|
||||
$('#back-top').fadeOut();
|
||||
}
|
||||
});
|
||||
|
||||
// scroll body to 0px on click
|
||||
$('#back-top a').click(function () {
|
||||
$('body,html').animate({
|
||||
scrollTop: 0
|
||||
}, 400);
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
if ($(location).attr('href').indexOf("http://info.template-help.com")+1)
|
||||
{
|
||||
$('#copyright').text('Template-Help.com');
|
||||
}
|
||||
|
||||
|
||||
// prettyphoto init
|
||||
$("a[data-gal^='prettyPhoto']").prettyPhoto({
|
||||
animationSpeed:'slow',
|
||||
theme:'facebook',
|
||||
slideshow:false,
|
||||
autoplay_slideshow: false,
|
||||
show_title: true,
|
||||
overlay_gallery: false
|
||||
}).append('<span></span>').hover(
|
||||
function(){
|
||||
$(this).find('>img').stop().animate({opacity:.5})
|
||||
},
|
||||
function(){
|
||||
$(this).find('>img').stop().animate({opacity:1})
|
||||
}
|
||||
);
|
||||
|
||||
// slide-down-box-------------------------------
|
||||
var idArray = [],
|
||||
click_scroll = false;
|
||||
$("#nav a").each(function(index){
|
||||
idArray[index]=$(this).attr("href");
|
||||
});
|
||||
|
||||
$('ul.list li a').prepend('<i class="icon-sample"></i>');
|
||||
$('li:first-child', "#nav").addClass('first');
|
||||
$('li:last-child', "#nav").addClass('last');
|
||||
|
||||
$("#affect_all").toggle(
|
||||
function(){
|
||||
$("#nav>li").not(".act_item").addClass("open_item").find("dd").stop(true).slideDown(200);
|
||||
$(this).find('.expand').hide();
|
||||
$(this).find('.close').show();
|
||||
},
|
||||
function(){
|
||||
$("#nav>li").not(".act_item").removeClass("open_item").find("dd").stop(true).slideUp(200);
|
||||
$(this).find('.expand').show();
|
||||
$(this).find('.close').hide();
|
||||
}
|
||||
);
|
||||
$(".slide-down dt i").click(function(){
|
||||
$(this).parents("li").toggleClass("open_item").find('dd').slideToggle(300);
|
||||
return false;
|
||||
});
|
||||
$(".slide-down a").click(function(){
|
||||
click_scroll = true;
|
||||
$(window).scrollTo($(this).attr("href"), 800, function(){
|
||||
click_scroll = false;
|
||||
change_menu_item();
|
||||
});
|
||||
return false;
|
||||
});
|
||||
$(window).scroll(change_menu_item).trigger("scroll");
|
||||
function change_menu_item(){
|
||||
if(!click_scroll){
|
||||
$(".current").removeClass("current");
|
||||
$(".act_item").removeClass("act_item");
|
||||
$(".open_item").removeClass("open_item");
|
||||
for(var i=0, lenghtArray = idArray.length; i<lenghtArray; i++){
|
||||
if($(idArray[i]).offset().top-$(window).scrollTop()<=(($(window).height()/2)-100) && $(idArray[i]).offset().top-$(window).scrollTop()>=0 || $(window).scrollTop()+(($(window).height()/2)-100)>$(idArray[i]).offset().top && $(idArray[i]).offset().top+$(idArray[i]).height()>$(window).scrollTop()+(($(window).height()/2))){
|
||||
$("a[href="+idArray[i]+"]").parent("li").addClass("current");
|
||||
$("a[href="+idArray[i]+"]").parents("li").addClass("act_item open_item");
|
||||
}
|
||||
}
|
||||
$(".act_item").find("dd").slideDown(200);
|
||||
$("li", '#nav').not(".act_item").find("dd").stop().slideUp(200);
|
||||
}
|
||||
}
|
||||
/*Language switcher*/
|
||||
|
||||
$('#lang_icon').toggle(function(){
|
||||
$('#lang_icon > i').find('i').removeClass('icon-angle-down').addClass('icon-angle-up');
|
||||
$('#lang_list').slideDown(200);
|
||||
}, function(){
|
||||
$('#lang_list').slideUp(200);
|
||||
$('#lang_icon > i').find('i').addClass('icon-angle-down').removeClass('icon-angle-up');
|
||||
})
|
||||
|
||||
$('#lang_list li').click(function(){
|
||||
$('#lang_list').slideUp(200);
|
||||
$('#lang_icon > i').find('i').addClass('icon-angle-down').removeClass('icon-angle-up');
|
||||
})
|
||||
$(document).click(function() {
|
||||
$('#lang_list').slideUp(200);
|
||||
$('#lang_icon > i').find('i').addClass('icon-angle-down').removeClass('icon-angle-up');
|
||||
});
|
||||
$('#lang_icon').click(function(e){
|
||||
e.stopPropagation();
|
||||
});
|
||||
|
||||
})
|
||||
!function ($) {
|
||||
$(function(){
|
||||
var $window = $(window)
|
||||
// make code pretty
|
||||
window.prettyPrint && prettyPrint()
|
||||
// side bar
|
||||
$('#nav_container').affix({
|
||||
offset: {
|
||||
top: 80
|
||||
}
|
||||
})
|
||||
})
|
||||
}(window.jQuery)
|
||||
Reference in new issue
Block a user