Template:Team:HokkaidoU Japan/Book/JS

From 2014.igem.org

(Difference between revisions)
 
(48 intermediate revisions not shown)
Line 1: Line 1:
<html>
<html>
-
<script type=”text/javascript” src=”http://code.jquery.com/jquery-1.11.1.min.js”></script>
 
-
<script src="//ajax.aspnetcdn.com/ajax/modernizr/modernizr-2.7.2.js"></script>
 
<script type="text/javascript">
<script type="text/javascript">
-
/*! jQuery UI - v1.8.20 - 2012-04-30
+
function and(a, b) {
-
* https://github.com/jquery/jquery-ui
+
  if ( a ) {
-
* Includes: jquery.ui.core.js
+
    return b;
-
* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */
+
  } else {
-
(function(a,b){function c(b,c){var e=b.nodeName.toLowerCase();if("area"===e){var f=b.parentNode,g=f.name,h;return!b.href||!g||f.nodeName.toLowerCase()!=="map"?!1:(h=a("img[usemap=#"+g+"]")[0],!!h&&d(h))}return(/input|select|textarea|button|object/.test(e)?!b.disabled:"a"==e?b.href||c:c)&&d(b)}function d(b){return!a(b).parents().andSelf().filter(function(){return a.curCSS(this,"visibility")==="hidden"||a.expr.filters.hidden(this)}).length}a.ui=a.ui||{};if(a.ui.version)return;a.extend(a.ui,{version:"1.8.20",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}}),a.fn.extend({propAttr:a.fn.prop||a.fn.attr,_focus:a.fn.focus,focus:function(b,c){return typeof b=="number"?this.each(function(){var d=this;setTimeout(function(){a(d).focus(),c&&c.call(d)},b)}):this._focus.apply(this,arguments)},scrollParent:function(){var b;return a.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?b=this.parents().filter(function(){return/(relative|absolute|fixed)/.test(a.curCSS(this,"position",1))&&/(auto|scroll)/.test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0):b=this.parents().filter(function(){return/(auto|scroll)/.test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0),/fixed/.test(this.css("position"))||!b.length?a(document):b},zIndex:function(c){if(c!==b)return this.css("zIndex",c);if(this.length){var d=a(this[0]),e,f;while(d.length&&d[0]!==document){e=d.css("position");if(e==="absolute"||e==="relative"||e==="fixed"){f=parseInt(d.css("zIndex"),10);if(!isNaN(f)&&f!==0)return f}d=d.parent()}}return 0},disableSelection:function(){return this.bind((a.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),a.each(["Width","Height"],function(c,d){function h(b,c,d,f){return a.each(e,function(){c-=parseFloat(a.curCSS(b,"padding"+this,!0))||0,d&&(c-=parseFloat(a.curCSS(b,"border"+this+"Width",!0))||0),f&&(c-=parseFloat(a.curCSS(b,"margin"+this,!0))||0)}),c}var e=d==="Width"?["Left","Right"]:["Top","Bottom"],f=d.toLowerCase(),g={innerWidth:a.fn.innerWidth,innerHeight:a.fn.innerHeight,outerWidth:a.fn.outerWidth,outerHeight:a.fn.outerHeight};a.fn["inner"+d]=function(c){return c===b?g["inner"+d].call(this):this.each(function(){a(this).css(f,h(this,c)+"px")})},a.fn["outer"+d]=function(b,c){return typeof b!="number"?g["outer"+d].call(this,b):this.each(function(){a(this).css(f,h(this,b,!0,c)+"px")})}}),a.extend(a.expr[":"],{data:function(b,c,d){return!!a.data(b,d[3])},focusable:function(b){return c(b,!isNaN(a.attr(b,"tabindex")))},tabbable:function(b){var d=a.attr(b,"tabindex"),e=isNaN(d);return(e||d>=0)&&c(b,!e)}}),a(function(){var b=document.body,c=b.appendChild(c=document.createElement("div"));c.offsetHeight,a.extend(c.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0}),a.support.minHeight=c.offsetHeight===100,a.support.selectstart="onselectstart"in c,b.removeChild(c).style.display="none"}),a.extend(a.ui,{plugin:{add:function(b,c,d){var e=a.ui[b].prototype;for(var f in d)e.plugins[f]=e.plugins[f]||[],e.plugins[f].push([c,d[f]])},call:function(a,b,c){var d=a.plugins[b];if(!d||!a.element[0].parentNode)return;for(var e=0;e<d.length;e++)a.options[d[e][0]]&&d[e][1].apply(a.element,c)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(b,c){if(a(b).css("overflow")==="hidden")return!1;var d=c&&c==="left"?"scrollLeft":"scrollTop",e=!1;return b[d]>0?!0:(b[d]=1,e=b[d]>0,b[d]=0,e)},isOverAxis:function(a,b,c){return a>b&&a<b+c},isOver:function(b,c,d,e,f,g){return a.ui.isOverAxis(b,d,f)&&a.ui.isOverAxis(c,e,g)}})})(jQuery);;/*! jQuery UI - v1.8.20 - 2012-04-30
+
    return a;
-
* https://github.com/jquery/jquery-ui
+
  }
-
* Includes: jquery.ui.widget.js
+
}
-
* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */
+
-
(function(a,b){if(a.cleanData){var c=a.cleanData;a.cleanData=function(b){for(var d=0,e;(e=b[d])!=null;d++)try{a(e).triggerHandler("remove")}catch(f){}c(b)}}else{var d=a.fn.remove;a.fn.remove=function(b,c){return this.each(function(){return c||(!b||a.filter(b,[this]).length)&&a("*",this).add([this]).each(function(){try{a(this).triggerHandler("remove")}catch(b){}}),d.call(a(this),b,c)})}}a.widget=function(b,c,d){var e=b.split(".")[0],f;b=b.split(".")[1],f=e+"-"+b,d||(d=c,c=a.Widget),a.expr[":"][f]=function(c){return!!a.data(c,b)},a[e]=a[e]||{},a[e][b]=function(a,b){arguments.length&&this._createWidget(a,b)};var g=new c;g.options=a.extend(!0,{},g.options),a[e][b].prototype=a.extend(!0,g,{namespace:e,widgetName:b,widgetEventPrefix:a[e][b].prototype.widgetEventPrefix||b,widgetBaseClass:f},d),a.widget.bridge(b,a[e][b])},a.widget.bridge=function(c,d){a.fn[c]=function(e){var f=typeof e=="string",g=Array.prototype.slice.call(arguments,1),h=this;return e=!f&&g.length?a.extend.apply(null,[!0,e].concat(g)):e,f&&e.charAt(0)==="_"?h:(f?this.each(function(){var d=a.data(this,c),f=d&&a.isFunction(d[e])?d[e].apply(d,g):d;if(f!==d&&f!==b)return h=f,!1}):this.each(function(){var b=a.data(this,c);b?b.option(e||{})._init():a.data(this,c,new d(e,this))}),h)}},a.Widget=function(a,b){arguments.length&&this._createWidget(a,b)},a.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:!1},_createWidget:function(b,c){a.data(c,this.widgetName,this),this.element=a(c),this.options=a.extend(!0,{},this.options,this._getCreateOptions(),b);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()}),this._create(),this._trigger("create"),this._init()},_getCreateOptions:function(){return a.metadata&&a.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName),this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled "+"ui-state-disabled")},widget:function(){return this.element},option:function(c,d){var e=c;if(arguments.length===0)return a.extend({},this.options);if(typeof c=="string"){if(d===b)return this.options[c];e={},e[c]=d}return this._setOptions(e),this},_setOptions:function(b){var c=this;return a.each(b,function(a,b){c._setOption(a,b)}),this},_setOption:function(a,b){return this.options[a]=b,a==="disabled"&&this.widget()[b?"addClass":"removeClass"](this.widgetBaseClass+"-disabled"+" "+"ui-state-disabled").attr("aria-disabled",b),this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_trigger:function(b,c,d){var e,f,g=this.options[b];d=d||{},c=a.Event(c),c.type=(b===this.widgetEventPrefix?b:this.widgetEventPrefix+b).toLowerCase(),c.target=this.element[0],f=c.originalEvent;if(f)for(e in f)e in c||(c[e]=f[e]);return this.element.trigger(c,d),!(a.isFunction(g)&&g.call(this.element[0],c,d)===!1||c.isDefaultPrevented())}}})(jQuery);;/*! jQuery UI - v1.8.20 - 2012-04-30
+
-
* https://github.com/jquery/jquery-ui
+
-
* Includes: jquery.ui.mouse.js
+
-
* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */
+
-
(function(a,b){var c=!1;a(document).mouseup(function(a){c=!1}),a.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var b=this;this.element.bind("mousedown."+this.widgetName,function(a){return b._mouseDown(a)}).bind("click."+this.widgetName,function(c){if(!0===a.data(c.target,b.widgetName+".preventClickEvent"))return a.removeData(c.target,b.widgetName+".preventClickEvent"),c.stopImmediatePropagation(),!1}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),a(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(b){if(c)return;this._mouseStarted&&this._mouseUp(b),this._mouseDownEvent=b;var d=this,e=b.which==1,f=typeof this.options.cancel=="string"&&b.target.nodeName?a(b.target).closest(this.options.cancel).length:!1;if(!e||f||!this._mouseCapture(b))return!0;this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){d.mouseDelayMet=!0},this.options.delay));if(this._mouseDistanceMet(b)&&this._mouseDelayMet(b)){this._mouseStarted=this._mouseStart(b)!==!1;if(!this._mouseStarted)return b.preventDefault(),!0}return!0===a.data(b.target,this.widgetName+".preventClickEvent")&&a.removeData(b.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(a){return d._mouseMove(a)},this._mouseUpDelegate=function(a){return d._mouseUp(a)},a(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),b.preventDefault(),c=!0,!0},_mouseMove:function(b){return!a.browser.msie||document.documentMode>=9||!!b.button?this._mouseStarted?(this._mouseDrag(b),b.preventDefault()):(this._mouseDistanceMet(b)&&this._mouseDelayMet(b)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,b)!==!1,this._mouseStarted?this._mouseDrag(b):this._mouseUp(b)),!this._mouseStarted):this._mouseUp(b)},_mouseUp:function(b){return a(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,b.target==this._mouseDownEvent.target&&a.data(b.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(b)),!1},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(a){return this.mouseDelayMet},_mouseStart:function(a){},_mouseDrag:function(a){},_mouseStop:function(a){},_mouseCapture:function(a){return!0}})})(jQuery);;/*! jQuery UI - v1.8.20 - 2012-04-30
+
-
* https://github.com/jquery/jquery-ui
+
-
* Includes: jquery.ui.slider.js
+
-
* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */
+
-
(function(a,b){var c=5;a.widget("ui.slider",a.ui.mouse,{widgetEventPrefix:"slide",options:{animate:!1,distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null},_create:function(){var b=this,d=this.options,e=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),f="<a class='ui-slider-handle ui-state-default ui-corner-all'></a>",g=d.values&&d.values.length||1,h=[];this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget"+" ui-widget-content"+" ui-corner-all"+(d.disabled?" ui-slider-disabled ui-disabled":"")),this.range=a([]),d.range&&(d.range===!0&&(d.values||(d.values=[this._valueMin(),this._valueMin()]),d.values.length&&d.values.length!==2&&(d.values=[d.values[0],d.values[0]])),this.range=a("<div></div>").appendTo(this.element).addClass("ui-slider-range ui-widget-header"+(d.range==="min"||d.range==="max"?" ui-slider-range-"+d.range:"")));for(var i=e.length;i<g;i+=1)h.push(f);this.handles=e.add(a(h.join("")).appendTo(b.element)),this.handle=this.handles.eq(0),this.handles.add(this.range).filter("a").click(function(a){a.preventDefault()}).hover(function(){d.disabled||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")}).focus(function(){d.disabled?a(this).blur():(a(".ui-slider .ui-state-focus").removeClass("ui-state-focus"),a(this).addClass("ui-state-focus"))}).blur(function(){a(this).removeClass("ui-state-focus")}),this.handles.each(function(b){a(this).data("index.ui-slider-handle",b)}),this.handles.keydown(function(d){var e=a(this).data("index.ui-slider-handle"),f,g,h,i;if(b.options.disabled)return;switch(d.keyCode){case a.ui.keyCode.HOME:case a.ui.keyCode.END:case a.ui.keyCode.PAGE_UP:case a.ui.keyCode.PAGE_DOWN:case a.ui.keyCode.UP:case a.ui.keyCode.RIGHT:case a.ui.keyCode.DOWN:case a.ui.keyCode.LEFT:d.preventDefault();if(!b._keySliding){b._keySliding=!0,a(this).addClass("ui-state-active"),f=b._start(d,e);if(f===!1)return}}i=b.options.step,b.options.values&&b.options.values.length?g=h=b.values(e):g=h=b.value();switch(d.keyCode){case a.ui.keyCode.HOME:h=b._valueMin();break;case a.ui.keyCode.END:h=b._valueMax();break;case a.ui.keyCode.PAGE_UP:h=b._trimAlignValue(g+(b._valueMax()-b._valueMin())/c);break;case a.ui.keyCode.PAGE_DOWN:h=b._trimAlignValue(g-(b._valueMax()-b._valueMin())/c);break;case a.ui.keyCode.UP:case a.ui.keyCode.RIGHT:if(g===b._valueMax())return;h=b._trimAlignValue(g+i);break;case a.ui.keyCode.DOWN:case a.ui.keyCode.LEFT:if(g===b._valueMin())return;h=b._trimAlignValue(g-i)}b._slide(d,e,h)}).keyup(function(c){var d=a(this).data("index.ui-slider-handle");b._keySliding&&(b._keySliding=!1,b._stop(c,d),b._change(c,d),a(this).removeClass("ui-state-active"))}),this._refreshValue(),this._animateOff=!1},destroy:function(){return this.handles.remove(),this.range.remove(),this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider"),this._mouseDestroy(),this},_mouseCapture:function(b){var c=this.options,d,e,f,g,h,i,j,k,l;return c.disabled?!1:(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),d={x:b.pageX,y:b.pageY},e=this._normValueFromMouse(d),f=this._valueMax()-this._valueMin()+1,h=this,this.handles.each(function(b){var c=Math.abs(e-h.values(b));f>c&&(f=c,g=a(this),i=b)}),c.range===!0&&this.values(1)===c.min&&(i+=1,g=a(this.handles[i])),j=this._start(b,i),j===!1?!1:(this._mouseSliding=!0,h._handleIndex=i,g.addClass("ui-state-active").focus(),k=g.offset(),l=!a(b.target).parents().andSelf().is(".ui-slider-handle"),this._clickOffset=l?{left:0,top:0}:{left:b.pageX-k.left-g.width()/2,top:b.pageY-k.top-g.height()/2-(parseInt(g.css("borderTopWidth"),10)||0)-(parseInt(g.css("borderBottomWidth"),10)||0)+(parseInt(g.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(b,i,e),this._animateOff=!0,!0))},_mouseStart:function(a){return!0},_mouseDrag:function(a){var b={x:a.pageX,y:a.pageY},c=this._normValueFromMouse(b);return this._slide(a,this._handleIndex,c),!1},_mouseStop:function(a){return this.handles.removeClass("ui-state-active"),this._mouseSliding=!1,this._stop(a,this._handleIndex),this._change(a,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation=this.options.orientation==="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(a){var b,c,d,e,f;return this.orientation==="horizontal"?(b=this.elementSize.width,c=a.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(b=this.elementSize.height,c=a.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),d=c/b,d>1&&(d=1),d<0&&(d=0),this.orientation==="vertical"&&(d=1-d),e=this._valueMax()-this._valueMin(),f=this._valueMin()+d*e,this._trimAlignValue(f)},_start:function(a,b){var c={handle:this.handles[b],value:this.value()};return this.options.values&&this.options.values.length&&(c.value=this.values(b),c.values=this.values()),this._trigger("start",a,c)},_slide:function(a,b,c){var d,e,f;this.options.values&&this.options.values.length?(d=this.values(b?0:1),this.options.values.length===2&&this.options.range===!0&&(b===0&&c>d||b===1&&c<d)&&(c=d),c!==this.values(b)&&(e=this.values(),e[b]=c,f=this._trigger("slide",a,{handle:this.handles[b],value:c,values:e}),d=this.values(b?0:1),f!==!1&&this.values(b,c,!0))):c!==this.value()&&(f=this._trigger("slide",a,{handle:this.handles[b],value:c}),f!==!1&&this.value(c))},_stop:function(a,b){var c={handle:this.handles[b],value:this.value()};this.options.values&&this.options.values.length&&(c.value=this.values(b),c.values=this.values()),this._trigger("stop",a,c)},_change:function(a,b){if(!this._keySliding&&!this._mouseSliding){var c={handle:this.handles[b],value:this.value()};this.options.values&&this.options.values.length&&(c.value=this.values(b),c.values=this.values()),this._trigger("change",a,c)}},value:function(a){if(arguments.length){this.options.value=this._trimAlignValue(a),this._refreshValue(),this._change(null,0);return}return this._value()},values:function(b,c){var d,e,f;if(arguments.length>1){this.options.values[b]=this._trimAlignValue(c),this._refreshValue(),this._change(null,b);return}if(!arguments.length)return this._values();if(!a.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(b):this.value();d=this.options.values,e=arguments[0];for(f=0;f<d.length;f+=1)d[f]=this._trimAlignValue(e[f]),this._change(null,f);this._refreshValue()},_setOption:function(b,c){var d,e=0;a.isArray(this.options.values)&&(e=this.options.values.length),a.Widget.prototype._setOption.apply(this,arguments);switch(b){case"disabled":c?(this.handles.filter(".ui-state-focus").blur(),this.handles.removeClass("ui-state-hover"),this.handles.propAttr("disabled",!0),this.element.addClass("ui-disabled")):(this.handles.propAttr("disabled",!1),this.element.removeClass("ui-disabled"));break;case"orientation":this._detectOrientation(),this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation),this._refreshValue();break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":this._animateOff=!0,this._refreshValue();for(d=0;d<e;d+=1)this._change(null,d);this._animateOff=!1}},_value:function(){var a=this.options.value;return a=this._trimAlignValue(a),a},_values:function(a){var b,c,d;if(arguments.length)return b=this.options.values[a],b=this._trimAlignValue(b),b;c=this.options.values.slice();for(d=0;d<c.length;d+=1)c[d]=this._trimAlignValue(c[d]);return c},_trimAlignValue:function(a){if(a<=this._valueMin())return this._valueMin();if(a>=this._valueMax())return this._valueMax();var b=this.options.step>0?this.options.step:1,c=(a-this._valueMin())%b,d=a-c;return Math.abs(c)*2>=b&&(d+=c>0?b:-b),parseFloat(d.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var b=this.options.range,c=this.options,d=this,e=this._animateOff?!1:c.animate,f,g={},h,i,j,k;this.options.values&&this.options.values.length?this.handles.each(function(b,i){f=(d.values(b)-d._valueMin())/(d._valueMax()-d._valueMin())*100,g[d.orientation==="horizontal"?"left":"bottom"]=f+"%",a(this).stop(1,1)[e?"animate":"css"](g,c.animate),d.options.range===!0&&(d.orientation==="horizontal"?(b===0&&d.range.stop(1,1)[e?"animate":"css"]({left:f+"%"},c.animate),b===1&&d.range[e?"animate":"css"]({width:f-h+"%"},{queue:!1,duration:c.animate})):(b===0&&d.range.stop(1,1)[e?"animate":"css"]({bottom:f+"%"},c.animate),b===1&&d.range[e?"animate":"css"]({height:f-h+"%"},{queue:!1,duration:c.animate}))),h=f}):(i=this.value(),j=this._valueMin(),k=this._valueMax(),f=k!==j?(i-j)/(k-j)*100:0,g[d.orientation==="horizontal"?"left":"bottom"]=f+"%",this.handle.stop(1,1)[e?"animate":"css"](g,c.animate),b==="min"&&this.orientation==="horizontal"&&this.range.stop(1,1)[e?"animate":"css"]({width:f+"%"},c.animate),b==="max"&&this.orientation==="horizontal"&&this.range[e?"animate":"css"]({width:100-f+"%"},{queue:!1,duration:c.animate}),b==="min"&&this.orientation==="vertical"&&this.range.stop(1,1)[e?"animate":"css"]({height:f+"%"},c.animate),b==="max"&&this.orientation==="vertical"&&this.range[e?"animate":"css"]({height:100-f+"%"},{queue:!1,duration:c.animate}))}}),a.extend(a.ui.slider,{version:"1.8.20"})})(jQuery);;
+
-
/*! Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net)
+
(function() {
-
* Licensed under the MIT License (LICENSE.txt).
+
-
*
+
-
* Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
+
-
* Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
+
-
* Thanks to: Seamus Leahy for adding deltaX and deltaY
+
-
*
+
-
* Version: 3.0.6
+
-
*
+
-
* Requires: 1.2.2+
+
-
*/
+
-
(function(a){function d(b){var c=b||window.event,d=[].slice.call(arguments,1),e=0,f=!0,g=0,h=0;return b=a.event.fix(c),b.type="mousewheel",c.wheelDelta&&(e=c.wheelDelta/120),c.detail&&(e=-c.detail/3),h=e,c.axis!==undefined&&c.axis===c.HORIZONTAL_AXIS&&(h=0,g=-1*e),c.wheelDeltaY!==undefined&&(h=c.wheelDeltaY/120),c.wheelDeltaX!==undefined&&(g=-1*c.wheelDeltaX/120),d.unshift(b,e,g,h),(a.event.dispatch||a.event.handle).apply(this,d)}var b=["DOMMouseScroll","mousewheel"];if(a.event.fixHooks)for(var c=b.length;c;)a.event.fixHooks[b[--c]]=a.event.mouseHooks;a.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var a=b.length;a;)this.addEventListener(b[--a],d,!1);else this.onmousewheel=d},teardown:function(){if(this.removeEventListener)for(var a=b.length;a;)this.removeEventListener(b[--a],d,!1);else this.onmousewheel=null}},a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})})(jQuery)
+
-
/**
+
var event = jQuery.event,
-
* hash.js
+
-
*
+
-
* Copyright (C) 2012 Emmanuel Garcia
+
-
* MIT Licensed
+
-
*
+
-
* ****************************************
+
-
*
+
-
* Hash.pushState(true);
+
-
*
+
-
* Hash.on('/page/([0-9]+)$',
+
-
* {yep: function(path, parts) { }, nop: function() { }},
+
-
* 'Page $1');
+
-
*
+
-
* Hash.go('/page/1');
+
-
**/
+
-
(function() {
+
//helper that finds handlers by type and calls back a function, this is basically handle
 +
// events - the events object
 +
// types - an array of event types to look for
 +
// callback(type, handlerFunc, selector) - a callback
 +
// selector - an optional selector to filter with, if there, matches by selector
 +
//    if null, matches anything, otherwise, matches with no selector
 +
findHelper = function( events, types, callback, selector ) {
 +
var t, type, typeHandlers, all, h, handle,
 +
namespaces, namespace,
 +
match;
 +
for ( t = 0; t < types.length; t++ ) {
 +
type = types[t];
 +
all = type.indexOf(".") < 0;
 +
if (!all ) {
 +
namespaces = type.split(".");
 +
type = namespaces.shift();
 +
namespace = new RegExp("(^|\\.)" + namespaces.slice(0).sort().join("\\.(?:.*\\.)?") + "(\\.|$)");
 +
}
 +
typeHandlers = (events[type] || []).slice(0);
-
'use strict';
+
for ( h = 0; h < typeHandlers.length; h++ ) {
 +
handle = typeHandlers[h];
 +
 +
match = (all || namespace.test(handle.namespace));
 +
 +
if(match){
 +
if(selector){
 +
if (handle.selector === selector  ) {
 +
callback(type, handle.origHandler || handle.handler);
 +
}
 +
} else if (selector === null){
 +
callback(type, handle.origHandler || handle.handler, handle.selector);
 +
}
 +
else if (!handle.selector ) {
 +
callback(type, handle.origHandler || handle.handler);
 +
 +
}
 +
}
 +
 +
 +
}
 +
}
 +
};
-
var hashes = {},
+
/**
-
regexp = {},
+
* Finds event handlers of a given type on an element.
-
history = [],
+
* @param {HTMLElement} el
-
freq = 100,
+
* @param {Array} types an array of event names
-
num = 0,
+
* @param {String} [selector] optional selector
-
pushState = false,
+
* @return {Array} an array of event handlers
-
timer = null,
+
*/
-
currentUrl = null,
+
event.find = function( el, types, selector ) {
 +
var events = ( $._data(el) || {} ).events,
 +
handlers = [],
 +
t, liver, live;
-
freeze = function(obj) {
+
if (!events ) {
-
if (Object.freeze) return Object.freeze(obj);
+
return handlers;
-
return obj;
+
}
-
},
+
findHelper(events, types, function( type, handler ) {
 +
handlers.push(handler);
 +
}, selector);
 +
return handlers;
 +
};
 +
/**
 +
* Finds all events.  Group by selector.
 +
* @param {HTMLElement} el the element
 +
* @param {Array} types event types
 +
*/
 +
event.findBySelector = function( el, types ) {
 +
var events = $._data(el).events,
 +
selectors = {},
 +
//adds a handler for a given selector and event
 +
add = function( selector, event, handler ) {
 +
var select = selectors[selector] || (selectors[selector] = {}),
 +
events = select[event] || (select[event] = []);
 +
events.push(handler);
 +
};
-
getHashParts = function() {
+
if (!events ) {
-
return window.location.href.split('#');
+
return selectors;
-
},
+
}
 +
//first check live:
 +
/*$.each(events.live || [], function( i, live ) {
 +
if ( $.inArray(live.origType, types) !== -1 ) {
 +
add(live.selector, live.origType, live.origHandler || live.handler);
 +
}
 +
});*/
 +
//then check straight binds
 +
findHelper(events, types, function( type, handler, selector ) {
 +
add(selector || "", type, handler);
 +
}, null);
-
startTimer = function() {
+
return selectors;
-
+
};
-
if (!timer)
+
event.supportTouch = "ontouchend" in document;
-
timer = setInterval(function() {
+
-
if (num>0 && currentUrl!=window.location.href) {
+
$.fn.respondsTo = function( events ) {
-
currentUrl = window.location.href;
+
if (!this.length ) {
-
window.Hash.check();
+
return false;
 +
} else {
 +
//add default ?
 +
return event.find(this[0], $.isArray(events) ? events : [events]).length > 0;
 +
}
 +
};
 +
$.fn.triggerHandled = function( event, data ) {
 +
event = (typeof event == "string" ? $.Event(event) : event);
 +
this.trigger(event, data);
 +
return event.handled;
 +
};
 +
/**
 +
* Only attaches one event handler for all types ...
 +
* @param {Array} types llist of types that will delegate here
 +
* @param {Object} startingEvent the first event to start listening to
 +
* @param {Object} onFirst a function to call
 +
*/
 +
event.setupHelper = function( types, startingEvent, onFirst ) {
 +
if (!onFirst ) {
 +
onFirst = startingEvent;
 +
startingEvent = null;
 +
}
 +
var add = function( handleObj ) {
 +
 
 +
var bySelector, selector = handleObj.selector || "";
 +
if ( selector ) {
 +
bySelector = event.find(this, types, selector);
 +
if (!bySelector.length ) {
 +
$(this).delegate(selector, startingEvent, onFirst);
 +
}
 +
}
 +
else {
 +
//var bySelector = event.find(this, types, selector);
 +
if (!event.find(this, types, selector).length ) {
 +
event.add(this, startingEvent, onFirst, {
 +
selector: selector,
 +
delegate: this
 +
});
}
}
-
}, freq);
 
-
},
+
}
-
stopTimer = function() {
+
},
 +
remove = function( handleObj ) {
 +
var bySelector, selector = handleObj.selector || "";
 +
if ( selector ) {
 +
bySelector = event.find(this, types, selector);
 +
if (!bySelector.length ) {
 +
$(this).undelegate(selector, startingEvent, onFirst);
 +
}
 +
}
 +
else {
 +
if (!event.find(this, types, selector).length ) {
 +
event.remove(this, startingEvent, onFirst, {
 +
selector: selector,
 +
delegate: this
 +
});
 +
}
 +
}
 +
};
 +
$.each(types, function() {
 +
event.special[this] = {
 +
add: add,
 +
remove: remove,
 +
setup: function() {},
 +
teardown: function() {}
 +
};
 +
});
 +
};
 +
})(jQuery);
 +
(function($){
 +
var isPhantom = /Phantom/.test(navigator.userAgent),
 +
supportTouch =and( !isPhantom , "ontouchend" in document),
 +
scrollEvent = "touchmove scroll",
 +
// Use touch events or map it to mouse events
 +
touchStartEvent = supportTouch ? "touchstart" : "mousedown",
 +
touchStopEvent = supportTouch ? "touchend" : "mouseup",
 +
touchMoveEvent = supportTouch ? "touchmove" : "mousemove",
 +
data = function(event){
 +
var d = event.originalEvent.touches ?
 +
event.originalEvent.touches[ 0 ] :
 +
event;
 +
return {
 +
time: (new Date).getTime(),
 +
coords: [ d.pageX, d.pageY ],
 +
origin: $( event.target )
 +
};
 +
}
-
if (timer) {
+
/**
-
clearInterval(timer);
+
* @add jQuery.event.swipe
-
timer = null;
+
*/
 +
var swipe = $.event.swipe = {
 +
/**
 +
* @attribute delay
 +
* Delay is the upper limit of time the swipe motion can take in milliseconds.  This defaults to 500.
 +
*
 +
* A user must perform the swipe motion in this much time.
 +
*/
 +
delay : 500,
 +
/**
 +
* @attribute max
 +
* The maximum distance the pointer must travel in pixels.  The default is 75 pixels.
 +
*/
 +
max : 75,
 +
/**
 +
* @attribute min
 +
* The minimum distance the pointer must travel in pixels.  The default is 30 pixels.
 +
*/
 +
min : 30
 +
};
 +
 
 +
$.event.setupHelper( [
 +
 
 +
/**
 +
* @hide
 +
* @attribute swipe
 +
*/
 +
"swipe",
 +
/**
 +
* @hide
 +
* @attribute swipeleft
 +
*/
 +
'swipeleft',
 +
/**
 +
* @hide
 +
* @attribute swiperight
 +
*/
 +
'swiperight',
 +
/**
 +
* @hide
 +
* @attribute swipeup
 +
*/
 +
'swipeup',
 +
/**
 +
* @hide
 +
* @attribute swipedown
 +
*/
 +
'swipedown'], touchStartEvent, function(ev){
 +
var
 +
// update with data when the event was started
 +
start = data(ev),
 +
stop,
 +
delegate = ev.delegateTarget || ev.currentTarget,
 +
selector = ev.handleObj.selector,
 +
entered = this;
 +
 +
function moveHandler(event){
 +
if ( !start ) {
 +
return;
}
}
 +
// update stop with the data from the current event
 +
stop = data(event);
 +
// prevent scrolling
 +
if ( Math.abs( start.coords[0] - stop.coords[0] ) > 10 ) {
 +
event.preventDefault();
 +
}
};
};
-
window.Hash = freeze({
+
// Attach to the touch move events
 +
$(document.documentElement).bind(touchMoveEvent, moveHandler)
 +
.one(touchStopEvent, function(event){
 +
$(this).unbind( touchMoveEvent, moveHandler);
 +
// if start and stop contain data figure out if we have a swipe event
 +
if ( and(start , stop)) {
 +
// calculate the distance between start and stop data
 +
var deltaX = Math.abs(start.coords[0] - stop.coords[0]),
 +
deltaY = Math.abs(start.coords[1] - stop.coords[1]),
 +
distance = Math.sqrt(deltaX*deltaX+deltaY*deltaY);
-
pushState: function(yes) {
+
// check if the delay and distance are matched
 +
if ( and(stop.time - start.time < swipe.delay , distance >= swipe.min) ) {
 +
var events = ['swipe'];
 +
// check if we moved horizontally
 +
if( and(deltaX >= swipe.min , deltaY < swipe.min)) {
 +
// based on the x coordinate check if we moved left or right
 +
events.push( start.coords[0] > stop.coords[0] ? "swipeleft" : "swiperight" );
 +
} else
 +
// check if we moved vertically
 +
if(and(deltaY >= swipe.min , deltaX < swipe.min)){
 +
// based on the y coordinate check if we moved up or down
 +
events.push( start.coords[1] < stop.coords[1] ? "swipedown" : "swipeup" );
 +
}
-
if (window.history && window.history.pushState)
+
// trigger swipe events on this guy
-
pushState = yes;
+
$.each($.event.find(delegate, events, selector), function(){
 +
this.call(entered, ev, {start : start, end: stop})
 +
})
 +
 +
}
 +
}
 +
// reset start and stop
 +
start = stop = undefined;
 +
})
 +
});
-
return this;
+
})(jQuery)
-
},
+
-
fragment: function() {
 
-
 
-
var hash = getHashParts();
 
-
return (pushState) ?
 
-
window.location.pathname + ((hash[1]) ? '#' + hash[1] : '')
 
-
: hash[1] || '';
 
 +
 +
</script>
 +
<script type="text/javascript">
 +
 +
/**
 +
* jquery.bookblock.js v2.0.1
 +
* http://www.codrops.com
 +
*
 +
* Licensed under the MIT license.
 +
* http://www.opensource.org/licenses/mit-license.php
 +
*
 +
* Copyright 2013, Codrops
 +
* http://www.codrops.com
 +
*/
 +
;( function( $, window, undefined ) {
 +
 +
'use strict';
 +
 +
// global
 +
var $window = $(window),
 +
Modernizr = window.Modernizr;
 +
 +
// https://gist.github.com/edankwan/4389601
 +
Modernizr.addTest('csstransformspreserve3d', function () {
 +
var prop = Modernizr.prefixed('transformStyle');
 +
var val = 'preserve-3d';
 +
var computedStyle;
 +
if(!prop) return false;
 +
 +
prop = prop.replace(/([A-Z])/g, function(str,m1){ return '-' + m1.toLowerCase(); }).replace(/^ms-/,'-ms-');
 +
 +
Modernizr.testStyles('#modernizr{' + prop + ':' + val + ';}', function (el, rule) {
 +
computedStyle = window.getComputedStyle ? getComputedStyle(el, null).getPropertyValue(prop) : '';
 +
});
 +
 +
return (computedStyle === val);
 +
});
 +
 +
/*
 +
* debouncedresize: special jQuery event that happens once after a window resize
 +
*
 +
* latest version and complete README available on Github:
 +
* https://github.com/louisremi/jquery-smartresize
 +
*
 +
* Copyright 2012 @louis_remi
 +
* Licensed under the MIT license.
 +
*
 +
* This saved you an hour of work?
 +
* Send me music http://www.amazon.co.uk/wishlist/HNTU0468LQON
 +
*/
 +
var $event = $.event,
 +
$special,
 +
resizeTimeout;
 +
 +
$special = $event.special.debouncedresize = {
 +
setup: function() {
 +
$( this ).on( "resize", $special.handler );
},
},
-
+
teardown: function() {
-
get: function(path, params) {
+
$( this ).off( "resize", $special.handler );
-
+
},
-
var p, fragment = '', parameters = [];
+
handler: function( event, execAsap ) {
 +
// Save the context
 +
var context = this,
 +
args = arguments,
 +
dispatch = function() {
 +
// set correct event type
 +
event.type = "debouncedresize";
 +
$event.dispatch.apply( context, args );
 +
};
-
for(p in params) {
+
if ( resizeTimeout ) {
-
if (!Object.prototype.hasOwnProperty(p))
+
clearTimeout( resizeTimeout );
-
continue;
+
-
parameters.push(encodeURIComponent(p) + '=' + encodeURIComponent(params[p]));
+
}
}
-
if (parameters.length>0)
+
execAsap ?
-
parameters = '?' + parameters.join('&');
+
dispatch() :
-
+
resizeTimeout = setTimeout( dispatch, $special.threshold );
-
return (pushState) ? path + parameters :
+
-
getHashParts()[0] + '#' + path + parameters;
+
-
 
+
},
},
 +
threshold: 150
 +
};
-
go: function(hash, params) {
+
$.BookBlock = function( options, element ) {
 +
this.$el = $( element );
 +
this._init( options );
 +
};
-
if (this.fragment()!=hash) {
+
// the options
-
var to = this.get(hash, params);
+
$.BookBlock.defaults = {
 +
// vertical or horizontal flip
 +
orientation : 'vertical',
 +
// ltr (left to right) or rtl (right to left)
 +
direction : 'ltr',
 +
// speed for the flip transition in ms
 +
speed : 1000,
 +
// easing for the flip transition
 +
easing : 'ease-in-out',
 +
// if set to true, both the flipping page and the sides will have an overlay to simulate shadows
 +
shadows : true,
 +
// opacity value for the "shadow" on both sides (when the flipping page is over it)
 +
// value : 0.1 - 1
 +
shadowSides : 0.2,
 +
// opacity value for the "shadow" on the flipping page (while it is flipping)
 +
// value : 0.1 - 1
 +
shadowFlip : 0.1,
 +
// if we should show the first item after reaching the end
 +
circular : false,
 +
// if we want to specify a selector that triggers the next() function. example: ´#bb-nav-next´
 +
nextEl : '',
 +
// if we want to specify a selector that triggers the prev() function
 +
prevEl : '',
 +
// autoplay. If true it overwrites the circular option to true
 +
autoplay : false,
 +
// time (ms) between page switch, if autoplay is true
 +
interval : 3000,
 +
// callback after the flip transition
 +
// old is the index of the previous item
 +
// page is the current item´s index
 +
// isLimit is true if the current page is the last one (or the first one)
 +
onEndFlip : function(old, page, isLimit) { return false; },
 +
// callback before the flip transition
 +
// page is the current item´s index
 +
onBeforeFlip : function(page) { return false; }
 +
};
-
if (pushState)
+
$.BookBlock.prototype = {
-
window.history.pushState(null, document.title, to);
+
_init : function(options) {
-
else
+
// options
-
window.location.href = to;
+
this.options = $.extend( true, {}, $.BookBlock.defaults, options );
-
}
+
// orientation class
-
+
this.$el.addClass( 'bb-' + this.options.orientation );
-
return this;
+
// items
 +
this.$items = this.$el.children( '.bb-item' ).hide();
 +
// total items
 +
this.itemsCount = this.$items.length;
 +
// current item´s index
 +
this.current = 0;
 +
// previous item´s index
 +
this.previous = -1;
 +
// show first item
 +
this.$current = this.$items.eq( this.current ).show();
 +
// get width of this.$el
 +
// this will be necessary to create the flipping layout
 +
this.elWidth = this.$el.width();
 +
var transEndEventNames = {
 +
'WebkitTransition': 'webkitTransitionEnd',
 +
'MozTransition': 'transitionend',
 +
'OTransition': 'oTransitionEnd',
 +
'msTransition': 'MSTransitionEnd',
 +
'transition': 'transitionend'
 +
};
 +
this.transEndEventName = transEndEventNames[Modernizr.prefixed( 'transition' )] + '.bookblock';
 +
// support css 3d transforms && css transitions && Modernizr.csstransformspreserve3d This is just comment
 +
this.support = and( Modernizr.csstransitions , and (Modernizr.csstransforms3d , Modernizr.csstransformspreserve3d));
 +
// initialize/bind some events
 +
this._initEvents();
 +
// start slideshow
 +
if ( this.options.autoplay ) {
 +
this.options.circular = true;
 +
this._startSlideshow();
 +
}
},
},
 +
_initEvents : function() {
-
update: function () {
+
var self = this;
-
+
-
currentUrl = window.location.href;
+
-
return this;
+
-
},
+
if ( this.options.nextEl !== '' ) {
 +
$( this.options.nextEl ).on( 'click.bookblock touchstart.bookblock', function() { self._action( 'next' ); return false; } );
 +
}
-
on: function(hash, callback, title) {
+
if ( this.options.prevEl !== '' ) {
 +
$( this.options.prevEl ).on( 'click.bookblock touchstart.bookblock', function() { self._action( 'prev' ); return false; } );
 +
}
-
if (!hashes[hash])
+
$window.on( 'debouncedresize', function() {
-
hashes[hash] = {title: title, listeners: []};
+
// update width value
-
+
self.elWidth = self.$el.width();
-
hashes[hash].listeners.push(callback);
+
} );
-
num++;
+
-
startTimer();
+
-
return this;
 
},
},
 +
_action : function( dir, page ) {
 +
this._stopSlideshow();
 +
this._navigate( dir, page );
 +
},
 +
_navigate : function( dir, page ) {
-
check: function() {
+
if ( this.isAnimating ) {
 +
return false;
 +
}
-
var i,
+
// callback trigger
-
hash,
+
this.options.onBeforeFlip( this.current );
-
parts,
+
-
fragment = this.fragment();
+
 +
this.isAnimating = true;
 +
// update current value
 +
this.$current = this.$items.eq( this.current );
-
for (hash in hashes) {
+
if ( page !== undefined ) {
-
if (!Object.prototype.hasOwnProperty.call(hashes, hash))
+
this.current = page;
-
continue;
+
}
 +
else if ( and (dir === 'next' , this.options.direction === 'ltr' )|| and(dir === 'prev' , this.options.direction === 'rtl' )) {
 +
if (and( !this.options.circular , this.current === this.itemsCount - 1 )) {
 +
this.end = true;
 +
}
 +
else {
 +
this.previous = this.current;
 +
this.current = this.current < this.itemsCount - 1 ? this.current + 1 : 0;
 +
}
 +
}
 +
else if ( and(dir === 'prev' , this.options.direction === 'ltr') || and(dir === 'next' , this.options.direction === 'rtl' )) {
 +
if (and( !this.options.circular , this.current === 0 )) {
 +
this.end = true;
 +
}
 +
else {
 +
this.previous = this.current;
 +
this.current = this.current > 0 ? this.current - 1 : this.itemsCount - 1;
 +
}
 +
}
-
hashes[hash].regexp = hashes[hash].regexp || new RegExp(hash);
+
this.$nextItem = and( !this.options.circular , this.end) ? this.$current : this.$items.eq( this.current );
 +
 +
if ( !this.support ) {
 +
this._layoutNoSupport( dir );
 +
} else {
 +
this._layout( dir );
 +
}
-
if ((parts = hashes[hash].regexp.exec(fragment))) {
+
},
-
if (hashes[hash].title)
+
_layoutNoSupport : function(dir) {
-
document.title = hashes[hash].title;
+
this.$items.hide();
 +
this.$nextItem.show();
 +
this.end = false;
 +
this.isAnimating = false;
 +
var isLimit = and (dir === 'next' , this.current === this.itemsCount - 1) || and( dir === 'prev' , this.current === 0);
 +
// callback trigger
 +
this.options.onEndFlip( this.previous, this.current, isLimit );
 +
},
 +
// creates the necessary layout for the 3d structure
 +
_layout : function(dir) {
-
for (i = 0; i<hashes[hash].listeners.length; i++)
+
var self = this,
-
if (hashes[hash].listeners[i].yep)
+
// basic structure: 1 element for the left side.
-
hashes[hash].listeners[i].yep(fragment, parts);
+
$s_left = this._addSide( 'left', dir ),
-
} else {
+
// 1 element for the flipping/middle page
-
for (i = 0; i<hashes[hash].listeners.length; i++)
+
$s_middle = this._addSide( 'middle', dir ),
-
if (hashes[hash].listeners[i].nop)
+
// 1 element for the right side
-
hashes[hash].listeners[i].nop(fragment);
+
$s_right = this._addSide( 'right', dir ),
 +
// overlays
 +
$o_left = $s_left.find( 'div.bb-overlay' ),
 +
$o_middle_f = $s_middle.find( 'div.bb-flipoverlay:first' ),
 +
$o_middle_b = $s_middle.find( 'div.bb-flipoverlay:last' ),
 +
$o_right = $s_right.find( 'div.bb-overlay' ),
 +
speed = this.end ? 400 : this.options.speed;
 +
 
 +
this.$items.hide();
 +
this.$el.prepend( $s_left, $s_middle, $s_right );
 +
 +
$s_middle.css({
 +
transitionDuration: speed + 'ms',
 +
transitionTimingFunction : this.options.easing
 +
}).on( this.transEndEventName, function( event ) {
 +
if ( $( event.target ).hasClass( 'bb-page' ) ) {
 +
self.$el.children( '.bb-page' ).remove();
 +
self.$nextItem.show();
 +
self.end = false;
 +
self.isAnimating = false;
 +
var isLimit = and( dir === 'next' , self.current === self.itemsCount - 1) || and(dir === 'prev' , self.current === 0);
 +
// callback trigger
 +
self.options.onEndFlip( self.previous, self.current, isLimit );
}
}
 +
});
 +
if ( dir === 'prev' ) {
 +
$s_middle.addClass( 'bb-flip-initial' );
}
}
-
return this;
+
// overlays
-
}
+
if (and(this.options.shadows , !this.end)) {
-
});
+
-
})();
+
var o_left_style = (dir === 'next') ? {
 +
transition: 'opacity ' + this.options.speed / 2 + 'ms ' + 'linear' + ' ' + this.options.speed / 2 + 'ms'
 +
} : {
 +
transition: 'opacity ' + this.options.speed / 2 + 'ms ' + 'linear',
 +
opacity: this.options.shadowSides
 +
},
 +
o_middle_f_style = (dir === 'next') ? {
 +
transition: 'opacity ' + this.options.speed / 2 + 'ms ' + 'linear'
 +
} : {
 +
transition: 'opacity ' + this.options.speed / 2 + 'ms ' + 'linear' + ' ' + this.options.speed / 2 + 'ms',
 +
opacity: this.options.shadowFlip
 +
},
 +
o_middle_b_style = (dir === 'next') ? {
 +
transition: 'opacity ' + this.options.speed / 2 + 'ms ' + 'linear' + ' ' + this.options.speed / 2 + 'ms',
 +
opacity: this.options.shadowFlip
 +
} : {
 +
transition: 'opacity ' + this.options.speed / 2 + 'ms ' + 'linear'
 +
},
 +
o_right_style = (dir === 'next') ? {
 +
transition: 'opacity ' + this.options.speed / 2 + 'ms ' + 'linear',
 +
opacity: this.options.shadowSides
 +
} : {
 +
transition: 'opacity ' + this.options.speed / 2 + 'ms ' + 'linear' + ' ' + this.options.speed / 2 + 'ms'
 +
};
 +
$o_middle_f.css(o_middle_f_style);
 +
$o_middle_b.css(o_middle_b_style);
 +
$o_left.css(o_left_style);
 +
$o_right.css(o_right_style);
 +
}
-
/* Documentation sample */
+
setTimeout( function() {
 +
// first && last pages lift slightly up when we can't go further
 +
$s_middle.addClass( self.end ? 'bb-flip-' + dir + '-end' : 'bb-flip-' + dir );
-
function loadPage(page) {
+
// overlays
 +
if (and( self.options.shadows , !self.end) ) {
-
var img = $('<img />');
+
$o_middle_f.css({
-
img.load(function() {
+
opacity: dir === 'next' ? self.options.shadowFlip : 0
-
var container = $('.sample-docs .p'+page);
+
});
-
img.css({width: container.width(), height: container.height()});
+
-
img.appendTo($('.sample-docs .p'+page));
+
-
container.find('.loader').remove();
+
-
});
+
-
img.attr('src', 'pages/' +  (page-2) + '.png');
+
$o_middle_b.css({
 +
opacity: dir === 'next' ? 0 : self.options.shadowFlip
 +
});
-
}
+
$o_left.css({
 +
opacity: dir === 'next' ? self.options.shadowSides : 0
 +
});
-
function addPage(page, book) {
+
$o_right.css({
 +
opacity: dir === 'next' ? 0 : self.options.shadowSides
 +
});
-
var id, pages = book.turn('pages');
+
}
 +
}, 25 );
 +
},
 +
// adds the necessary sides (bb-page) to the layout
 +
_addSide : function( side, dir ) {
 +
var $side;
-
var element = $('<div />', {});
+
switch (side) {
 +
case 'left':
 +
/*
 +
<div class="bb-page" style="z-index:102;">
 +
<div class="bb-back">
 +
<div class="bb-outer">
 +
<div class="bb-content">
 +
<div class="bb-inner">
 +
dir==='next' ? [content of current page] : [content of next page]
 +
</div>
 +
</div>
 +
<div class="bb-overlay"></div>
 +
</div>
 +
</div>
 +
</div>
 +
*/
 +
$side = $('<div class="bb-page"><div class="bb-back"><div class="bb-outer"><div class="bb-content"><div class="bb-inner">' + ( dir === 'next' ? this.$current.html() : this.$nextItem.html() ) + '</div></div><div class="bb-overlay"></div></div></div></div>').css( 'z-index', 102 );
 +
break;
 +
case 'middle':
 +
/*
 +
<div class="bb-page" style="z-index:103;">
 +
<div class="bb-front">
 +
<div class="bb-outer">
 +
<div class="bb-content">
 +
<div class="bb-inner">
 +
dir==='next' ? [content of current page] : [content of next page]
 +
</div>
 +
</div>
 +
<div class="bb-flipoverlay"></div>
 +
</div>
 +
</div>
 +
<div class="bb-back">
 +
<div class="bb-outer">
 +
<div class="bb-content">
 +
<div class="bb-inner">
 +
dir==='next' ? [content of next page] : [content of current page]
 +
</div>
 +
</div>
 +
<div class="bb-flipoverlay"></div>
 +
</div>
 +
</div>
 +
</div>
 +
*/
 +
$side = $('<div class="bb-page"><div class="bb-front"><div class="bb-outer"><div class="bb-content"><div class="bb-inner">' + (dir === 'next' ? this.$current.html() : this.$nextItem.html()) + '</div></div><div class="bb-flipoverlay"></div></div></div><div class="bb-back"><div class="bb-outer"><div class="bb-content" style="width:' + this.elWidth + 'px"><div class="bb-inner">' + ( dir === 'next' ? this.$nextItem.html() : this.$current.html() ) + '</div></div><div class="bb-flipoverlay"></div></div></div></div>').css( 'z-index', 103 );
 +
break;
 +
case 'right':
 +
/*
 +
<div class="bb-page" style="z-index:101;">
 +
<div class="bb-front">
 +
<div class="bb-outer">
 +
<div class="bb-content">
 +
<div class="bb-inner">
 +
dir==='next' ? [content of next page] : [content of current page]
 +
</div>
 +
</div>
 +
<div class="bb-overlay"></div>
 +
</div>
 +
</div>
 +
</div>
 +
*/
 +
$side = $('<div class="bb-page"><div class="bb-front"><div class="bb-outer"><div class="bb-content"><div class="bb-inner">' + ( dir === 'next' ? this.$nextItem.html() : this.$current.html() ) + '</div></div><div class="bb-overlay"></div></div></div></div>').css( 'z-index', 101 );
 +
break;
 +
}
-
if (book.turn('addPage', element, page)) {
+
return $side;
-
if (page<28) {
+
},
-
element.html('<div class="gradient"></div><div class="loader"></div>');
+
_startSlideshow : function() {
-
loadPage(page);
+
var self = this;
-
}
+
this.slideshow = setTimeout( function() {
-
}
+
self._navigate( 'next' );
-
}
+
if ( self.options.autoplay ) {
 +
self._startSlideshow();
 +
}
 +
}, this.options.interval );
 +
},
 +
_stopSlideshow : function() {
 +
if ( this.options.autoplay ) {
 +
clearTimeout( this.slideshow );
 +
this.options.autoplay = false;
 +
}
 +
},
 +
// public method: flips next
 +
next : function() {
 +
this._action( this.options.direction === 'ltr' ? 'next' : 'prev' );
 +
},
 +
// public method: flips back
 +
prev : function() {
 +
this._action( this.options.direction === 'ltr' ? 'prev' : 'next' );
 +
},
 +
// public method: goes to a specific page
 +
jump : function( page ) {
-
function updateTabs() {
+
page -= 1;
-
+
-
var tabs = {7: 'Clases', 12:'Constructor', 14:'Properties', 16:'Methods', 23:'Events'},
+
-
left = [],
+
-
right = [],
+
-
book = $('.sample-docs'),
+
-
actualPage = book.turn('page'),
+
-
view = book.turn('view');
+
-
for (var page in tabs) {
+
if ( page === this.current || page >= this.itemsCount || page < 0 ) {
-
var isHere = $.inArray(parseInt(page, 10), view)!=-1;
+
return false;
 +
}
-
if (page>actualPage && !isHere)
+
var dir;
-
right.push('<a href="#page/' + page + '">' + tabs[page] + '</a>');
+
if( this.options.direction === 'ltr' ) {
-
else if (isHere) {
+
dir = page > this.current ? 'next' : 'prev';
-
+
}
-
if (page%2===0)
+
else {
-
left.push('<a href="#page/' + page + '" class="on">' + tabs[page] + '</a>');
+
dir = page > this.current ? 'prev' : 'next';
-
else
+
}
-
right.push('<a href="#page/' + page + '" class="on">' + tabs[page] + '</a>');
+
this._action( dir, page );
-
} else
+
-
left.push('<a href="#page/' + page + '">' + tabs[page] + '</a>');
+
-
}
+
},
 +
// public method: goes to the last page
 +
last : function() {
 +
this.jump( this.itemsCount );
 +
},
 +
// public method: goes to the first page
 +
first : function() {
 +
this.jump( 1 );
 +
},
 +
// public method: check if isAnimating is true
 +
isActive: function() {
 +
return this.isAnimating;
 +
},
 +
// public method: dynamically adds new elements
 +
// call this method after inserting new "bb-item" elements inside the BookBlock
 +
update : function () {
 +
var $currentItem = this.$items.eq( this.current );
 +
this.$items = this.$el.children( '.bb-item' );
 +
this.itemsCount = this.$items.length;
 +
this.current = $currentItem.index();
 +
},
 +
destroy : function() {
 +
if ( this.options.autoplay ) {
 +
this._stopSlideshow();
 +
}
 +
this.$el.removeClass( 'bb-' + this.options.orientation );
 +
this.$items.show();
-
$('.sample-docs .tabs .left').html(left.join(''));
+
if ( this.options.nextEl !== '' ) {
-
$('.sample-docs .tabs .right').html(right.join(''));
+
$( this.options.nextEl ).off( '.bookblock' );
 +
}
-
}
+
if ( this.options.prevEl !== '' ) {
 +
$( this.options.prevEl ).off( '.bookblock' );
 +
}
 +
$window.off( 'debouncedresize' );
 +
}
 +
}
-
function numberOfViews(book) {
+
var logError = function( message ) {
-
return book.turn('pages') / 2 + 1;
+
if ( window.console ) {
-
}
+
window.console.error( message );
 +
}
 +
};
 +
$.fn.bookblock = function( options ) {
 +
if ( typeof options === 'string' ) {
 +
var args = Array.prototype.slice.call( arguments, 1 );
 +
this.each(function() {
 +
var instance = $.data( this, 'bookblock' );
 +
if ( !instance ) {
 +
logError( "cannot call methods on bookblock prior to initialization; " +
 +
"attempted to call method '" + options + "'" );
 +
return;
 +
}
 +
if ( !$.isFunction( instance[options] ) || options.charAt(0) === "_" ) {
 +
logError( "no such method '" + options + "' for bookblock instance" );
 +
return;
 +
}
 +
instance[ options ].apply( instance, args );
 +
});
 +
}
 +
else {
 +
this.each(function() {
 +
var instance = $.data( this, 'bookblock' );
 +
if ( instance ) {
 +
instance._init();
 +
}
 +
else {
 +
instance = $.data( this, 'bookblock', new $.BookBlock( options, this ) );
 +
}
 +
});
 +
}
 +
return this;
 +
};
-
function getViewNumber(book, page) {
+
} )( jQuery, window );
-
return parseInt((page || book.turn('page'))/2 + 1, 10);
+
</script>
-
}
+
<script>
 +
$(function(){
 +
var Page = (function() {
 +
 +
var config = {
 +
$bookBlock : $( '#bb-bookblock' ),
 +
$navNext : $( '#bb-nav-next' ),
 +
$navPrev : $( '#bb-nav-prev' ),
 +
},
 +
init = function() {
 +
config.$bookBlock.bookblock( {
 +
speed : 800,
 +
shadowSides : 0.8,
 +
shadowFlip : 0.7
 +
} );
 +
initEvents();
 +
},
 +
initEvents = function() {
 +
 +
var $slides = config.$bookBlock.children();
 +
// add navigation events
 +
config.$navNext.on( 'click touchstart', function() {
 +
config.$bookBlock.bookblock( 'next' );
 +
return false;
 +
} );
-
function moveBar(yes) {
 
-
if (Modernizr && Modernizr.csstransforms) {
 
-
$('#slider .ui-slider-handle').css({zIndex: yes ? -1 : 10000});
 
-
}
 
-
}
 
-
function setPreview(view) {
 
-
var previewWidth = 115,
+
config.$navPrev.on( 'click touchstart', function() {
-
previewHeight = 73,
+
config.$bookBlock.bookblock( 'prev' );
-
previewSrc = 'pics/preview.jpg',
+
return false;
-
preview = $(_thumbPreview.children(':first')),
+
} );
-
numPages = (view==1 || view==$('#slider').slider('option', 'max')) ? 1 : 2,
+
-
width = (numPages==1) ? previewWidth/2 : previewWidth;
+
-
_thumbPreview.
+
// add swipe events
-
addClass('no-transition').
+
$slides.on( {
-
css({width: width + 15,
+
'swipeleft' : function( event ) {
-
height: previewHeight + 15,
+
config.$bookBlock.bookblock( 'next' );
-
top: -previewHeight - 30,
+
return false;
-
left: ($($('#slider').children(':first')).width() - width - 15)/2
+
},
-
});
+
'swiperight' : function( event ) {
 +
config.$bookBlock.bookblock( 'prev' );
 +
return false;
 +
}
 +
} );
-
preview.css({
+
// add keyboard events
-
width: width,
+
$( document ).keydown( function(e) {
-
height: previewHeight
+
var keyCode = e.keyCode || e.which,
-
});
+
arrow = {
 +
left : 37,
 +
up : 38,
 +
right : 39,
 +
down : 40
 +
};
-
if (preview.css('background-image')==='' ||
+
switch (keyCode) {
-
preview.css('background-image')=='none') {
+
case arrow.left:
 +
config.$bookBlock.bookblock( 'prev' );
 +
break;
 +
case arrow.right:
 +
config.$bookBlock.bookblock( 'next' );
 +
break;
 +
}
 +
} );
 +
};
-
preview.css({backgroundImage: 'url(' + previewSrc + ')'});
+
return { init : init };
-
setTimeout(function(){
+
})();
-
_thumbPreview.removeClass('no-transition');
+
Page.init();
-
}, 0);
+
 
 +
});
-
}
 
-
preview.css({backgroundPosition:
 
-
'0px -'+((view-1)*previewHeight)+'px'
 
-
});
 
-
}
 
</script>
</script>
</html>
</html>

Latest revision as of 14:06, 15 October 2014