Build mobile apps with simple HTML, CSS, and JS components. http://goratchet.com/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

10 lines
6.5 KiB

/*!
* =====================================================
11 years ago
* Ratchet v2.0.1 (http://goratchet.com)
* Copyright 2014 Connor Sears
* Licensed under MIT (https://github.com/twbs/ratchet/blob/master/LICENSE)
*
11 years ago
* v2.0.1 designed by @connors.
* =====================================================
*/
$(function(){"use strict";var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r=function(){l=0,m=[],n=$(window),a=$(document),o=$(document.body),b=b||$(".js-device"),h=$(".js-jump-menu"),i=$(".js-component-group"),j=$(".component-example a"),k=$(".component"),m=k.map(function(){return $(this).offset().top}),d=$(window).height()/3,c=$(window).width(),e=$(document).height(),f=parseInt($(".docs-content").css("padding-bottom"),10),g=$(".docs-footer").outerHeight(!1),q=$(".js-docs-component-toolbar"),c>=768&&b.offset()&&(b.initialLeft=b.offset().left,b.initialTop=b.initialTop||b.offset().top,b.dockingOffset=($(window).height()-b.height())/2),t(),u(),v(),p||s()},s=function(){p=!0,b.on("click",function(a){a.preventDefault()}),$(".js-docs-nav-trigger").on("click",function(){var a=$(".docs-nav-group"),b=$(".js-docs-nav-trigger");b.toggleClass("active"),a.toggleClass("active")}),h.click(function(a){a.stopPropagation(),a.preventDefault(),i.toggleClass("active")}),a.on("click",function(){i.removeClass("active")}),$(".platform-switch").on("click",function(){var a=$(".docs-components"),b=$(this).attr("data-platform");a.hasClass("platform-ios")?(a.removeClass("platform-ios"),a.addClass(b)):a.hasClass("platform-android")?(a.removeClass("platform-android"),a.addClass(b)):a.addClass(b),$(this).siblings(".active").removeClass("active"),$(this).addClass("active")}),n.on("scroll",u),n.on("scroll",v)},t=function(){if(c=$(window).width(),768>=c){var a=$(".content");a.length>1&&$(a[0]).remove()}},u=function(){function a(a){$("#iwindow").html(a)}if(!(768>=c)){var e,f=n.scrollTop();if(b.length){b.initialTop-f<=b.dockingOffset?(b[0].className="device device-fixed",b.css({top:b.dockingOffset})):(b[0].className="device",b[0].setAttribute("style",""));for(var g=k.length;g--;)if(m[g]-f<d){if(l===g)return;l=g,o.find(".component.active").removeClass("active"),e=$(k[g]),e.addClass("active"),e.attr("id")?b.attr("id",e.attr("id")+"InDevice"):b.attr("id",""),e.hasClass("informational")||a(e.find(".highlight .html").text());break}}}},v=function(){var a=n.scrollTop(),b=$(".docs-sub-header").outerHeight();a>=b?q.addClass("visible"):b>=a&&(q.removeClass("visible"),i.removeClass("active"))};$(window).on("load resize",r),$(window).on("load",function(){window.FingerBlast&&new FingerBlast(".device-content")})}),function(){"use strict";function a(a){this.element="string"==typeof a?document.querySelector(a):a,this.element&&this.listen()}a.prototype={x:0/0,y:0/0,startDistance:0/0,startAngle:0/0,mouseIsDown:!1,listen:function(){function a(a,b){var c,d,e;if(a){if("compareDocumentPosition"in b)return!!(16&b.compareDocumentPosition(a));if("contains"in b)return b!==a&&b.contains(a);for(c=b.getElementsByTagName("*"),d=0;e=c[d++];)if(e===a)return!0;return!1}}var b=this.activate.bind(this),c=this.deactivate.bind(this);this.element.addEventListener("mouseover",function(c){var d=c.relatedTarget;d===this||a(d,this)||b()}),this.element.addEventListener("mouseout",function(b){var d=b.relatedTarget;d===this||a(d,this)||c(b)})},activate:function(){this.active||(this.element.addEventListener("mousedown",this.touchStart=this.touchStart.bind(this),!0),this.element.addEventListener("mousemove",this.touchMove=this.touchMove.bind(this),!0),this.element.addEventListener("mouseup",this.touchEnd=this.touchEnd.bind(this),!0),this.element.addEventListener("click",this.click=this.click.bind(this),!0),this.active=!0)},deactivate:function(a){this.active=!1,this.mouseIsDown&&this.touchEnd(a),this.element.removeEventListener("mousedown",this.touchStart,!0),this.element.removeEventListener("mousemove",this.touchMove,!0),this.element.removeEventListener("mouseup",this.touchEnd,!0),this.element.removeEventListener("click",this.click,!0)},click:function(a){a.synthetic||(a.preventDefault(),a.stopPropagation())},touchStart:function(a){a.synthetic||/input|textarea/.test(a.target.tagName.toLowerCase())||(this.mouseIsDown=!0,a.preventDefault(),a.stopPropagation(),this.fireTouchEvents("touchstart",a))},touchMove:function(a){a.synthetic||(a.preventDefault(),a.stopPropagation(),this.move(a.clientX,a.clientY),this.mouseIsDo