This repository has been archived on 2018-10-12. You can view files and clone it, but cannot push or open issues or pull requests.
node-task/public/js/ink-ui.min.js

6 lines
144 KiB
JavaScript
Raw Normal View History

2014-09-24 17:57:25 -04:00
Ink.createModule("Ink.UI.Animate",1,["Ink.UI.Common_1","Ink.Dom.Event_1","Ink.Dom.Css_1"],function(a,b,c){"use strict";function d(){a.BaseUIComponent.apply(this,arguments)}var e=function(a){return"animationName"in a.style?"animation":"oAnimationName"in a.style?"oAnimation":"msAnimationName"in a.style?"msAnimation":"webkitAnimationName"in a.style?"webkitAnimation":null}(document.createElement("div")),f={animation:"animationend",oAnimation:"oanimationend",msAnimation:"MSAnimationEnd",webkitAnimation:"webkitAnimationEnd"}[e];return d._name="Animate_1",d._optionDefinition={trigger:["Element",null],duration:["String","slow"],animation:["String"],removeClass:["Boolean",!0],onEnd:["Function",function(){}]},d.prototype._init=function(){isNaN(parseInt(this._options.duration,10))||(this._options.duration=parseInt(this._options.duration,10)),this._options.trigger?b.observe(this._options.trigger,"click",Ink.bind(function(){this.animate()},this)):this.animate()},d.prototype.animate=function(){d.animate(this._element,this._options.animation,this._options)},Ink.extendObj(d,{_animationPrefix:e,animationSupported:!!e,animationEndEventName:f,animate:function(b,g,h){function i(a){a.target===b&&a.animationName===g&&(h.onEnd&&h.onEnd(a),h.removeClass&&c.removeClassName(b,g),"string"==typeof h.duration&&c.removeClassName(b,h.duration),b.removeEventListener(f,i,!1))}return b=a.elOrSelector(b),"number"==typeof h||"string"==typeof h?h={duration:h}:h||(h={}),"function"==typeof arguments[3]&&(h.onEnd=arguments[3]),"number"!=typeof h.duration&&"string"!=typeof h.duration&&(h.duration=400),d.animationSupported?("number"==typeof h.duration?b.style[e+"Duration"]=h.duration+"ms":"string"==typeof h.duration&&c.addClassName(b,h.duration),c.addClassName(b,["animated",g]),void b.addEventListener(f,i,!1)):void(h.onEnd&&setTimeout(function(){h.onEnd(null)},0))}}),a.createUIComponent(d),d}),Ink.createModule("Ink.UI.Carousel","1",["Ink.UI.Common_1","Ink.Dom.Event_1","Ink.Dom.Css_1","Ink.Dom.Element_1","Ink.UI.Pagination_1","Ink.Dom.Browser_1","Ink.Dom.Selector_1"],function(a,b,c,d,e,f){"use strict";function g(a,b,c){return Math.min(c,Math.max(b,a))}function h(){a.BaseUIComponent.apply(this,arguments)}function i(a,b){a.style.transitionProperty=a.style.oTransitionProperty=a.style.msTransitionProperty=a.style.mozTransitionProperty=a.style.webkitTransitionProperty=b}var j=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||function(a){return setTimeout(a,1e3/30)};return h._name="Carousel_1",h._optionDefinition={autoAdvance:["Integer",0],axis:["String","x"],initialPage:["Integer",0],spaceAfterLastSlide:["Boolean",!0],hideLast:["Boolean",!1],center:["Boolean",!1],keyboardSupport:["Boolean",!1],pagination:["String",null],onChange:["Function",null],onInit:["Function",function(){}],swipe:["Boolean",!0]},h.prototype={_init:function(){this._handlers={paginationChange:Ink.bindMethod(this,"_onPaginationChange"),windowResize:b.throttle(Ink.bindMethod(this,"refit"),200)},b.observe(window,"resize",this._handlers.windowResize),this._isY="y"===this._options.axis;var a=Ink.s("ul.stage",this._element);this._ulEl=a,d.removeTextNodeChildren(a),null==this._options.pagination&&(this._currentPage=this._options.initialPage),this.refit(),this._isY&&(this._ulEl.style.whiteSpace="normal"),this._options.swipe&&(b.observe(this._element,"touchstart",Ink.bindMethod(this,"_onTouchStart")),b.observe(this._element,"touchmove",Ink.bindMethod(this,"_onTouchMove")),b.observe(this._element,"touchend",Ink.bindMethod(this,"_onTouchEnd"))),this._setUpPagination(),this._setUpAutoAdvance(),this._setUpHider(),this._options.onInit.call(this,this)},refit:function(){var a=this._isY,b=function(b,c){return b?c?d.outerDimensions(b)[a?0:1]:d.outerDimensions(b)[a?1:0]:0};this._liEls=Ink.ss("li.slide",this._ulEl);var c=this._liEls.length,e=this._ulEl.getBoundingClientRect();this._ctnLength=a?e.bottom-e.top:e.right-e.left,this._elLength=b(this._liEls[0]),this._slidesPerPage=Math.floor(this._ctnLength/this._elLength)||1,isFinite(this._slidesPerPage)||(this._slidesPerPa
},_parseDate:function(a){var b=g.set(this._options.format,a);return b?k(b):null},_isValidDate:function(a){var b=/^\d{4}$/,c=/^\d{1,2}$/;return b.test(a._year)&&c.test(a._month)&&c.test(a._day)&&+a._month+1>=1&&+a._month+1<=12&&+a._day>=1&&+a._day<=this._daysInMonth(a._year,a._month+1)},_isDate:function(a,b){try{if("undefined"==typeof a)return!1;var c=g.set(a,b);if(c&&this._isValidDate(k(c)))return!0}catch(d){}return!1},_acceptableDay:function(a){return this._acceptableDateComponent(a,"validDayFn")},_acceptableMonth:function(a){return this._acceptableDateComponent(a,"validMonthFn")},_acceptableYear:function(a){return this._acceptableDateComponent(a,"validYearFn")},_acceptableDateComponent:function(a,b){return this._options[b]?this._callUserCallbackBool(this._options[b],a):this._dateWithinRange(a)},_writeDateInFormat:function(){return g.get(this._options.format,this.getDate())},setDate:function(a){if(a&&"function"==typeof a.getDate&&(a=[a.getFullYear(),a.getMonth()+1,a.getDate()].join("-")),/\d{4}-\d{1,2}-\d{1,2}/.test(a)){var b=a.split("-");this._year=+b[0],this._month=+b[1]-1,this._day=+b[2]}this._setDate()},getDate:function(){if(!this._day)throw"Ink.UI.DatePicker: Still picking a date. Cannot getDate now!";return new Date(this._year,this._month,this._day)},_setDate:function(a){if(a){var b=d.data(a);this._day=+b.calDay||this._day}var c=this._fitDateToRange(this);this._year=c._year,this._month=c._month,this._day=c._day,this._options.displayInSelect?(this._options.dayField.value=this._day,this._options.monthField.value=this._month+1,this._options.yearField.value=this._year):this._element.value=this._writeDateInFormat(),this._options.onSetDate&&this._options.onSetDate(this,{date:this.getDate()})},_updateCal:function(a){"function"==typeof this._options.onMonthSelected&&this._options.onMonthSelected(this,{year:this._year,month:this._month}),a&&null===this._updateMonth(a)||this._renderMonth()},_daysInMonth:function(a,b){var c={2:a%400===0||a%4===0&&a%100!==0?29:28,4:30,6:30,9:30,11:30};return c[b]||31},_updateMonth:function(a){var b;return a>0?b=this._getNextMonth():0>a&&(b=this._getPrevMonth()),b?(this._year=b._year,this._month=b._month,void(this._day=b._day)):null},_getNextMonth:function(a){return this._tryLeap(a,"Month","next",function(a){return a._month+=1,a._month>11&&(a._month=0,a._year+=1),a})},_getPrevMonth:function(a){return this._tryLeap(a,"Month","prev",function(a){return a._month-=1,a._month<0&&(a._month=11,a._year-=1),a})},_getPrevYear:function(a){return this._tryLeap(a,"Year","prev",function(a){return a._year-=1,a})},_getNextYear:function(a){return this._tryLeap(a,"Year","next",function(a){return a._year+=1,a})},_tryLeap:function(a,b,c,d){a=a||{_year:this._year,_month:this._month,_day:this._day};var e="prev"===c?"_min":"_max",f=this[e];if(0===this._dateCmpUntil(a,f,b))return null;var g=this._options[c+"ValidDateFn"];return g?this._callUserCallbackDate(g,a):(a=d(a),a=this._fitDateToRange(a),this["_acceptable"+b](a)?a:null)},_getNextDecade:function(a){a=a||{_year:this._year,_month:this._month,_day:this._day};var b=this._getCurrentDecade(a);return b+10>this._max._year?null:b+10},_getPrevDecade:function(a){a=a||{_year:this._year,_month:this._month,_day:this._day};var b=this._getCurrentDecade(a);return b-10<this._min._year?null:b-10},_getCurrentDecade:function(a){return a=a?a._year||a:this._year,10*Math.floor(a/10)},_callUserCallbackBase:function(a,b){return a.call(this,b._year,b._month+1,b._day)},_callUserCallbackBool:function(a,b){return!!this._callUserCallbackBase(a,b)},_callUserCallbackDate:function(a,b){var c=this._callUserCallbackBase(a,b);return c?k(c):null},_dateParsers:{"yyyy-mm-dd":"Y-m-d","yyyy/mm/dd":"Y/m/d","yy-mm-dd":"y-m-d","yy/mm/dd":"y/m/d","dd-mm-yyyy":"d-m-Y","dd/mm/yyyy":"d/m/Y","dd-mm-yy":"d-m-y","dd/mm/yy":"d/m/y","mm/dd/yyyy":"m/d/Y","mm-dd-yyyy":"m-d-Y"},_renderMonth:function(){var a=this._month,b=this._year;this._showDefaultView(),d.setHTML(this._monthContainer,""),this._monthContainer.appendChild(this._getMonthCalendarHeader(this._options.startWeekDay)),this._monthContainer.appendChild(this.
return i._name="FormElement_1",i._optionDefinition={label:["String",null],rules:["String",null],form:["Object"]},i.prototype={_init:function(){this._errors={},this._rules={},this._value=null,null===this._options.label&&(this._options.label=this._getLabel())},_getLabel:function(){var a=b.findUpwardsBySelector(this._element,".control-group label");return a?b.textContent(a):this._element.name||this._element.id||""},_parseRules:function(a){this._rules={},a=a.split("|");var b,c=a.length,d,e,f;if(c>0)for(b=0;c>b;b++)if(d=a[b])if(-1!==(f=d.indexOf("["))){e=d.substr(f+1),e=e.split("]"),e=e[0],e=e.split(",");for(var g=0,h=e.length;h>g;g++)e[g]="true"===e[g]?!0:"false"===e[g]?!1:e[g];e.splice(0,0,this.getValue()),d=d.substr(0,f),this._rules[d]=e}else this._rules[d]=[this.getValue()]},_addError:function(a){for(var b=this._rules[a]||[],c={field:this._options.label,value:this.getValue()},d=1;d<b.length;d++)c["param"+d]=b[d];var e="formvalidator."+a;this._errors[a]=l.text(e,c),this._errors[a]===e&&(this._errors[a]="Validation message not found")},getValue:function(){switch(this._element.nodeName.toLowerCase()){case"select":return Ink.s("option:selected",this._element).value;case"textarea":return this._element.value;case"input":if(!("type"in this._element))return this._element.value;if("radio"===this._element.type||"checkbox"===this._element.type){if(this._element.checked)return this._element.value}else if("file"!==this._element.type)return this._element.value;return;default:return this._element.innerHTML}},getErrors:function(){return this._errors},getElement:function(){return this._element},getFormElements:function(){return this._options.form._formElements},validate:function(){if(this._errors={},0||this._parseRules(this._options.rules),"required"in this._rules||""!==this.getValue())for(var a in this._rules)if(this._rules.hasOwnProperty(a)){if("function"!=typeof k[a])return Ink.warn('Rule "'+a+'" not found. Used in element:',this._element),this._addError(null),!1;if(k[a].apply(this,this._rules[a])===!1)return this._addError(a),!1}return!0}},a.createUIComponent(i),j._name="FormValidator_1",j._optionDefinition={eventTrigger:["String","submit"],neverSubmit:["Boolean","false"],searchFor:["String","input, select, textarea, .control-group"],beforeValidation:["Function",void 0],onError:["Function",void 0],onSuccess:["Function",void 0]},j.setRule=function(a,b,c){if(k[a]=c,l.getKey("formvalidator."+a)!==b){var d={};d["formvalidator."+a]=b;var e={};e[l.lang()]=d,l.append(e)}},j.getI18n=function(){return l},j.setI18n=function(a){l=a},j.appendI18n=function(){l.append.apply(l,[].slice.call(arguments))},j.setLanguage=function(a){l.lang(a)},j.getRules=function(){return k},j.prototype={_init:function(){this._rootElement=this._element,this._formElements={},this._errorMessages=[],this._markedErrorElements=[],"string"==typeof this._options.eventTrigger&&c.observe(this._rootElement,this._options.eventTrigger,Ink.bindEvent(this.validate,this))},getElements:function(){this._formElements={};var a=d.select(this._options.searchFor,this._rootElement);if(a.length){var c,e;for(c=0;c<a.length;c+=1){e=a[c];var f=b.data(e);if("rules"in f){var g={form:this},h;"name"in e&&e.name?h=e.name:"id"in e&&e.id?h=e.id:(h="element_"+Math.floor(100*Math.random()),e.id=h),h in this._formElements||(this._formElements[h]=[]),this._formElements[h].push(new i(e,g))}}}return this._formElements},validate:function(a){this._options.neverSubmit+""=="true"&&a&&c.stopDefault(a),"function"==typeof this._options.beforeValidation&&this._options.beforeValidation(),f.each(this._markedErrorElements,function(a){e.removeClassName(a,["validation","error"])}),f.each(this._errorMessages,b.remove),this.getElements();var d=[];for(var g in this._formElements)if(this._formElements.hasOwnProperty(g))for(var h=0;h<this._formElements[g].length;h+=1)this._formElements[g][h].validate()||d.push(this._formElements[g][h]);return 0===d.length?("function"==typeof this._options.onSuccess&&this._options.onSuccess(),a&&this._options.cancelEventOnSuccess+""=="true"?(c.stopDefault(a),!1):!0):(a&&c.stopDefault(a),"funct
}else a<=Number(this._options.largeMax)&&a>=Number(this._options.largeMin)&&"large"!==this._curLayout?this._curLayout="large":a>=Number(this._options.mediumMin)&&a<=Number(this._options.mediumMax)&&"medium"!==this._curLayout?this._curLayout="medium":a>=Number(this._options.smallMin)&&a<=Number(this._options.smallMax)&&"small"!==this._curLayout&&(this._curLayout="small")},_getColumnsToShow:function(){return Number(this._options.customBreakPoints&&"object"==typeof this._options.customBreakPoints?this._options.customBreakPoints[this._curLayout].cols:this._options[this._curLayout+"Cols"])},_canApplyLayoutChange:function(){var a=this._curLayout;return this._setCurLayout(),a!==this._curLayout?!0:!1},_getPageItemsToList:function(){this._aColumn=Ink.ss(this._options.column,this._element);var a=this._aColumn.length,b=0;if(a>0){for(var c=0;c<this._aColumn.length;c++)for(var d=Ink.ss(this._options.item,this._aColumn[c]),e=0;e<d.length;e++)this._options.isOrdered&&(b=c+e*a),this._aList[b]=d[e],this._options.isOrdered||b++,d[e].parentNode.removeChild(d[e]);if(this._aList.length>0&&this._options.isOrdered){for(var f=[],g=0;g<this._aList.length;g++)"undefined"!=typeof this._aList[g]&&f.push(this._aList[g]);this._aList=f}}},_removeDomItems:function(){var a=this._aColumn.length;if(a>0)for(var b=0;a>b;b++)for(var c=Ink.ss(this._options.item,this._aColumn[b]),d=c.length-1;d>=0;d--)c[d].parentNode.removeChild(c[d])},_applyLayoutChange:function(){var a=this._getColumnsToShow(),b=this._aList.length,c=0,d=0;if(a>0)for(;a>d;){if(this._aColumn[d].appendChild(this._aList[c]),c++,d++,c===b)return;d===a&&(d=0)}}},a.createUIComponent(d),d}),Ink.createModule("Ink.UI.Sticky","1",["Ink.UI.Common_1","Ink.Dom.Event_1","Ink.Dom.Element_1","Ink.Dom.Css_1"],function(a,b,c,d){"use strict";function e(){a.BaseUIComponent.apply(this,arguments)}return e._name="Sticky_1",e._optionDefinition={offsetBottom:["Integer",0],offsetTop:["Integer",0],topElement:["Element",null],wrapperClass:["String","ink-sticky-wrapper"],stickyClass:["String","ink-sticky-stuck"],inlineDimensions:["Boolean",!0],inlinePosition:["Boolean",!0],bottomElement:["Element",null],activateInLayouts:["String","tiny,small,medium,large,xlarge"]},e.prototype={_init:function(){this._options.activateInLayouts=this._options.activateInLayouts.toString(),this._dims=null,this._options.offsetTop=parseInt(this._options.offsetTop,10)||0,this._options.offsetBottom=parseInt(this._options.offsetBottom,10)||0,this._options.topElement&&(this._options.topElement=a.elOrSelector(this._options.topElement,"Top Element")),this._options.bottomElement&&(this._options.bottomElement=a.elOrSelector(this._options.bottomElement,"Sticky bottom Element")),this._wrapper=c.create("div",{className:this._options.wrapperClass}),c.wrap(this._element,this._wrapper);var d=document.addEventListener?document:window;this._onScroll=Ink.bind(b.throttle(this._onScroll,33),this),b.observe(d,"scroll",this._onScroll),b.observe(window,"resize",Ink.bindEvent(b.throttle(this._onResize,100),this)),this._onScroll()},_isDisabledInLayout:function(){var b=a.currentLayout();return b?-1===this._options.activateInLayouts.indexOf(b):!1},_onScroll:function(){var a=this._getDims(),b=c.scrollHeight(),d=this._isDisabledInLayout()||b<=a.top-this._options.offsetTop||this._options.topElement&&this._options.topElement.getBoundingClientRect().bottom+this._options.offsetTop>0;if(d)return void this._unstick();var e=this._options.offsetTop+a.height+c.scrollHeight(),f=document.body.scrollHeight;this._options.bottomElement&&(f=this._options.bottomElement.getBoundingClientRect().top+c.scrollHeight()),f-=this._options.offsetBottom,this._stickTo(f>e?"screen":"bottom")},_stickTo:function(a){var b=this._element.style,e=this._getDims();if(d.addClassName(this._element,this._options.stickyClass),this._wrapper.style.height=e.height+"px",this._inlineDimensions(e.height+"px",e.width+"px"),this._options.inlinePosition!==!1)if(b.left=e.left+"px","screen"===a)b.bottom=null,b.top=this._options.offsetTop+"px";else if("bottom"===a){var f=this._getBottomOffset(),g=c.scrollHeight()+c.viewpo
d=this._getWhereValueInsideViewport(d,{left:h-n[0],right:h+n[0],top:i+n[1],bottom:i+n[1]},{right:p,bottom:q}),"up"===d?(i-=n[1],i-=l,h+=j):"down"===d?(i+=o[1],i+=l,h+=j):"left"===d?(h-=n[0],h-=l,i+=k):"right"===d&&(h+=o[0],h+=l,i+=k);var r=null;d.match(/(up|down|left|right)/)&&(r=document.createElement("SPAN"),f.addClassName(r,"arrow"),f.addClassName(r,this._oppositeDirections[d]),a.appendChild(r));var s=h,t=i,u=t+n[1]-q,v=s+n[0]-p,w=0-s,x=0-t;u>0?(r&&(r.style.top=n[1]/2+u+"px"),t-=u):x>0?(r&&(r.style.top=n[1]/2-x+"px"),t+=x):v>0?(r&&(r.style.left=n[0]/2+v+"px"),s-=v):w>0&&(r&&(r.style.left=n[0]/2-w+"px"),s+=w),a.style.left=s+"px",a.style.top=t+"px"}},_getWhereValueInsideViewport:function(a,b,c){return"left"===a&&b.left<0?"right":"right"===a&&b.right>c.right?"left":"up"===a&&b.top<0?"down":"down"===a&&b.bottom>c.bottom?"up":a},_removeTooltip:function(){var a=this.tooltip;if(a){var b=Ink.bind(c.remove,{},a);"mousemove"!==this._getOpt("where")&&i?(a.style.opacity=0,setTimeout(b,1e3*this._getFloatOpt("fade"))):b(),this.tooltip=null}},_getOpt:function(a){var b=c.data(this.element)[c._camelCase("tip-"+a)];if(b)return b;var d=this.root.options[a];return"undefined"!=typeof d?d:void 0},_getIntOpt:function(a){return parseInt(this._getOpt(a),10)},_getFloatOpt:function(a){return parseFloat(this._getOpt(a),10)},_destroy:function(){this.tooltip&&c.remove(this.tooltip),this.root=null,this.element=null,this.tooltip=null},_onMouseOver:function(a){var b=this._getMousePosition(a),c=this._getFloatOpt("delay");c?this._delayTimeout=setTimeout(Ink.bind(function(){this.tooltip||this._makeTooltip(b),this._delayTimeout=null},this),1e3*c):this._makeTooltip(b)},_onMouseMove:function(a){if("mousemove"===this._getOpt("where")&&this.tooltip){var b=this._getMousePosition(a);this._setPos(b[0],b[1])}},_onMouseOut:function(){this._getIntOpt("forever")||this._removeTooltip(),this._delayTimeout&&(clearTimeout(this._delayTimeout),this._delayTimeout=null)},_onTooltipMouseOver:function(){this.tooltip&&this._removeTooltip()},_setPos:function(a,b){a+=this._getIntOpt("left"),b+=this._getIntOpt("top");var d=this._getPageXY();if(this.tooltip){var e=[c.elementWidth(this.tooltip),c.elementHeight(this.tooltip)],f=this._getScroll();e[0]+a-f[0]>=d[0]-20&&(a=a-e[0]-this._getIntOpt("left")-10),e[1]+b-f[1]>=d[1]-20&&(b=b-e[1]-this._getIntOpt("top")-10),this.tooltip.style.left=a+"px",this.tooltip.style.top=b+"px"}},_getPageXY:function(){var a=0,b=0;return"number"==typeof window.innerWidth?(a=window.innerWidth,b=window.innerHeight):document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)?(a=document.documentElement.clientWidth,b=document.documentElement.clientHeight):document.body&&(document.body.clientWidth||document.body.clientHeight)&&(a=document.body.clientWidth,b=document.body.clientHeight),[parseInt(a,10),parseInt(b,10)]},_getScroll:function(){var a=document.documentElement,b=document.body;return a&&(a.scrollLeft||a.scrollTop)?[a.scrollLeft,a.scrollTop]:b?[b.scrollLeft,b.scrollTop]:[0,0]},_getMousePosition:function(a){return[parseInt(b.pointerX(a),10),parseInt(b.pointerY(a),10)]}},g}),Ink.createModule("Ink.UI.TreeView","1",["Ink.UI.Common_1","Ink.Dom.Event_1","Ink.Dom.Css_1","Ink.Dom.Element_1","Ink.Dom.Selector_1","Ink.Util.Array_1"],function(a,b,c,d,e,f){"use strict";function g(){a.BaseUIComponent.apply(this,arguments)}return g._name="TreeView_1",g._optionDefinition={node:["String","li"],child:["String",null],children:["String","ul"],parentClass:["String","parent"],openNodeClass:["String","open"],openClass:["String","fa fa-minus-circle"],closedClass:["String","fa fa-plus-circle"],hideClass:["String","hide-all"],iconTag:["String","i"],stopDefault:["Boolean",!0]},g.prototype={_init:function(){this._options.child&&(Ink.warn("Ink.UI.TreeView: options.child is being renamed to options.children."),this._options.children=this._options.child),this._handlers={click:Ink.bindEvent(this._onClick,this)},b.on(this._element,"click",this._options.node,this._handlers.click),f.each(Ink.ss(this._options.node,this._element),Ink.bind(funct
//# sourceMappingURL=ink-ui.min.map