Final commit for hierarchy change

This commit is contained in:
binaryatrocity committed 2014-06-22 20:22:03 -05:00
1 parent 4de458981f
commit 75a6844b9b
604 files changed
+28824 -1

No files matched your search

+299
View File
@@ -0,0 +1,299 @@
/*! UIkit 2.5.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
(function(addon) {
if (typeof define == "function" && define.amd) { // AMD
define("uikit-autocomplete", ["uikit"], function(){
return jQuery.UIkit.autocomplete || addon(window, window.jQuery, window.jQuery.UIkit);
});
}
if(window && window.jQuery && window.jQuery.UIkit) {
addon(window, window.jQuery, window.jQuery.UIkit);
}
})(function(global, $, UI){
var Autocomplete = function(element, options) {
var $this = this, $element = $(element);
if($element.data("autocomplete")) return;
this.options = $.extend({}, Autocomplete.defaults, options);
this.element = $element;
this.dropdown = $element.find('.uk-dropdown');
this.template = $element.find('script[type="text/autocomplete"]').html();
this.template = UI.Utils.template(this.template || this.options.template);
this.input = $element.find("input:first").attr("autocomplete", "off");
this.element.data("autocomplete", this);
if (!this.dropdown.length) {
this.dropdown = $('<div class="uk-dropdown"></div>').appendTo($element);
}
if (this.options.flipDropdown) {
this.dropdown.addClass('uk-dropdown-flip');
}
this.init();
};
$.extend(Autocomplete.prototype, {
visible : false,
value : null,
selected : null,
init: function() {
var $this = this,
select = false,
trigger = UI.Utils.debounce(function(e) {
if(select) {
return (select = false);
}
$this.trigger();
}, this.options.delay);
this.input.on({
"keydown": function(e) {
if (e && e.which && !e.shiftKey) {
switch (e.which) {
case 13: // enter
e.preventDefault();
select = true;
$this.select();
break;
case 38: // up
e.preventDefault();
$this.pick('prev');
break;
case 40: // down
e.preventDefault();
$this.pick('next');
break;
case 27:
case 9: // esc, tab
$this.hide();
break;
default:
break;
}
}
},
"keyup": trigger,
"blur": function(e) {
setTimeout(function() { $this.hide(); }, 200);
}
});
this.dropdown.on("click", ".uk-autocomplete-results > *", function(){
$this.select();
});
this.dropdown.on("mouseover", ".uk-autocomplete-results > *", function(){
$this.pick($(this));
});
},
trigger: function() {
var $this = this, old = this.value;
this.value = this.input.val();
if (this.value.length < this.options.minLength) return this.hide();
if (this.value != old) {
$this.request();
}
return this;
},
pick: function(item) {
var items = this.dropdown.find('.uk-autocomplete-results').children(':not(.'+this.options.skipClass+')'),
selected = false;
if (typeof item !== "string" && !item.hasClass(this.options.skipClass)) {
selected = item;
} else if (item == 'next' || item == 'prev') {
if (this.selected) {
var index = items.index(this.selected);
if (item == 'next') {
selected = items.eq(index + 1 < items.length ? index + 1 : 0);
} else {
selected = items.eq(index - 1 < 0 ? items.length - 1 : index - 1);
}
} else {
selected = items[(item == 'next') ? 'first' : 'last']();
}
}
if (selected && selected.length) {
this.selected = selected;
items.removeClass(this.options.hoverClass);
this.selected.addClass(this.options.hoverClass);
}
},
select: function() {
if(!this.selected) return;
var data = this.selected.data();
this.element.trigger("autocomplete-select", [data, this]);
if (data.value) {
this.input.val(data.value);
}
this.hide();
},
show: function() {
if (this.visible) return;
this.visible = true;
this.element.addClass("uk-open");
return this;
},
hide: function() {
if (!this.visible) return;
this.visible = false;
this.element.removeClass("uk-open");
return this;
},
request: function() {
var $this = this,
release = function(data) {
if(data) {
$this.render(data);
}
$this.element.removeClass($this.options.loadingClass);
};
this.element.addClass(this.options.loadingClass);
if (this.options.source) {
var source = this.options.source;
switch(typeof(this.options.source)) {
case 'function':
this.options.source.apply(this, [release]);
break;
case 'object':
if(source.length) {
var items = [];
source.forEach(function(item){
if(item.value && item.value.toLowerCase().indexOf($this.value.toLowerCase())!=-1) {
items.push(item);
}
});
release(items);
}
break;
case 'string':
var params ={};
params[this.options.param] = this.value;
$.ajax({
url: this.options.source,
data: params,
type: this.options.method,
dataType: 'json',
complete: function(xhr) {
release(xhr.responseJSON || []);
}
});
break;
default:
release(null);
}
} else {
this.element.removeClass($this.options.loadingClass);
}
},
render: function(data) {
var $this = this;
this.dropdown.empty();
this.selected = false;
if (this.options.renderer) {
this.options.renderer.apply(this, [data]);
} else if(data && data.length) {
this.dropdown.append(this.template({"items":data}));
this.show();
}
return this;
}
});
Autocomplete.defaults = {
minLength: 3,
param: 'search',
method: 'post',
delay: 300,
loadingClass: 'uk-loading',
flipDropdown: false,
skipClass: 'uk-skip',
hoverClass: 'uk-active',
source: null,
renderer: null,
// template
template: '<ul class="uk-nav uk-nav-autocomplete uk-autocomplete-results">{{~items}}<li data-value="{{$item.value}}"><a>{{$item.value}}</a></li>{{/items}}</ul>'
};
UI["autocomplete"] = Autocomplete;
// init code
$(document).on("focus.autocomplete.uikit", "[data-uk-autocomplete]", function(e) {
var ele = $(this);
if (!ele.data("autocomplete")) {
var obj = new Autocomplete(ele, UI.Utils.options(ele.attr("data-uk-autocomplete")));
}
});
return Autocomplete;
});
+3
View File
@@ -0,0 +1,3 @@
/*! UIkit 2.5.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
(function(t){"function"==typeof define&&define.amd&&define("uikit-autocomplete",["uikit"],function(){return jQuery.UIkit.autocomplete||t(window,window.jQuery,window.jQuery.UIkit)}),window&&window.jQuery&&window.jQuery.UIkit&&t(window,window.jQuery,window.jQuery.UIkit)})(function(t,e,i){var n=function(t,o){var s=e(t);s.data("autocomplete")||(this.options=e.extend({},n.defaults,o),this.element=s,this.dropdown=s.find(".uk-dropdown"),this.template=s.find('script[type="text/autocomplete"]').html(),this.template=i.Utils.template(this.template||this.options.template),this.input=s.find("input:first").attr("autocomplete","off"),this.element.data("autocomplete",this),this.dropdown.length||(this.dropdown=e('<div class="uk-dropdown"></div>').appendTo(s)),this.options.flipDropdown&&this.dropdown.addClass("uk-dropdown-flip"),this.init())};return e.extend(n.prototype,{visible:!1,value:null,selected:null,init:function(){var t=this,n=!1,o=i.Utils.debounce(function(){return n?n=!1:(t.trigger(),void 0)},this.options.delay);this.input.on({keydown:function(e){if(e&&e.which&&!e.shiftKey)switch(e.which){case 13:e.preventDefault(),n=!0,t.select();break;case 38:e.preventDefault(),t.pick("prev");break;case 40:e.preventDefault(),t.pick("next");break;case 27:case 9:t.hide();break;default:}},keyup:o,blur:function(){setTimeout(function(){t.hide()},200)}}),this.dropdown.on("click",".uk-autocomplete-results > *",function(){t.select()}),this.dropdown.on("mouseover",".uk-autocomplete-results > *",function(){t.pick(e(this))})},trigger:function(){var t=this,e=this.value;return this.value=this.input.val(),this.value.length<this.options.minLength?this.hide():(this.value!=e&&t.request(),this)},pick:function(t){var e=this.dropdown.find(".uk-autocomplete-results").children(":not(."+this.options.skipClass+")"),i=!1;if("string"==typeof t||t.hasClass(this.options.skipClass)){if("next"==t||"prev"==t)if(this.selected){var n=e.index(this.selected);i="next"==t?e.eq(e.length>n+1?n+1:0):e.eq(0>n-1?e.length-1:n-1)}else i=e["next"==t?"first":"last"]()}else i=t;i&&i.length&&(this.selected=i,e.removeClass(this.options.hoverClass),this.selected.addClass(this.options.hoverClass))},select:function(){if(this.selected){var t=this.selected.data();this.element.trigger("autocomplete-select",[t,this]),t.value&&this.input.val(t.value),this.hide()}},show:function(){return this.visible?void 0:(this.visible=!0,this.element.addClass("uk-open"),this)},hide:function(){return this.visible?(this.visible=!1,this.element.removeClass("uk-open"),this):void 0},request:function(){var t=this,i=function(e){e&&t.render(e),t.element.removeClass(t.options.loadingClass)};if(this.element.addClass(this.options.loadingClass),this.options.source){var n=this.options.source;switch(typeof this.options.source){case"function":this.options.source.apply(this,[i]);break;case"object":if(n.length){var o=[];n.forEach(function(e){e.value&&-1!=e.value.toLowerCase().indexOf(t.value.toLowerCase())&&o.push(e)}),i(o)}break;case"string":var s={};s[this.options.param]=this.value,e.ajax({url:this.options.source,data:s,type:this.options.method,dataType:"json",complete:function(t){i(t.responseJSON||[])}});break;default:i(null)}}else this.element.removeClass(t.options.loadingClass)},render:function(t){return this.dropdown.empty(),this.selected=!1,this.options.renderer?this.options.renderer.apply(this,[t]):t&&t.length&&(this.dropdown.append(this.template({items:t})),this.show()),this}}),n.defaults={minLength:3,param:"search",method:"post",delay:300,loadingClass:"uk-loading",flipDropdown:!1,skipClass:"uk-skip",hoverClass:"uk-active",source:null,renderer:null,template:'<ul class="uk-nav uk-nav-autocomplete uk-autocomplete-results">{{~items}}<li data-value="{{$item.value}}"><a>{{$item.value}}</a></li>{{/items}}</ul>'},i.autocomplete=n,e(document).on("focus.autocomplete.uikit","[data-uk-autocomplete]",function(){var t=e(this);t.data("autocomplete")||new n(t,i.Utils.options(t.attr("data-uk-autocomplete")))}),n});
+313
View File
@@ -0,0 +1,313 @@
/*! UIkit 2.5.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
(function(addon) {
if (typeof define == "function" && define.amd) { // AMD
define("uikit-datepicker", ["uikit"], function(){
return jQuery.UIkit.datepicker || addon(window, window.jQuery, window.jQuery.UIkit);
});
}
if(window && window.jQuery && window.jQuery.UIkit) {
addon(window, window.jQuery, window.jQuery.UIkit);
}
})(function(global, $, UI){
// Datepicker
var active = false,
dropdown = $('<div class="uk-dropdown uk-datepicker"></div>'),
moment;
dropdown.on("click", ".uk-datepicker-next, .uk-datepicker-previous, [data-date]", function(e){
e.stopPropagation();
e.preventDefault();
var ele = $(this);
if(ele.is('[data-date]')) {
active.element.val(moment(ele.data("date")).format(active.options.format)).trigger("change");
dropdown.hide();
active = false;
} else {
active.add("months", 1 * (ele.hasClass("uk-datepicker-next") ? 1:-1));
}
});
var DatePicker = function(element, options) {
var $this = this, $element = $(element);
if($element.data("datepicker")) return;
this.element = $element;
this.options = $.extend({}, DatePicker.defaults, options);
this.current = this.element.val() ? moment(this.element.val(), this.options.format) : moment();
this.element.on("click", function(){
if(active!==$this) $this.pick(this.value);
}).on("change", function(){
if($this.element.val() && !moment($this.element.val(), $this.options.format).isValid()) {
$this.element.val(moment().format($this.options.format));
}
});
this.element.data("datepicker", this);
};
DatePicker.defaults = {
weekstart: 1,
i18n: {
months : ['January','February','March','April','May','June','July','August','September','October','November','December'],
weekdays : ['Sun','Mon','Tue','Wed','Thu','Fri','Sat']
},
format: "DD.MM.YYYY",
offsettop: 5,
template: function(data, opts) {
var content = '';
content += '<div class="uk-datepicker-nav">';
content += '<a href="" class="uk-datepicker-previous"></a>';
content += '<a href="" class="uk-datepicker-next"></a>';
content += '<div class="uk-datepicker-heading">'+ opts.i18n.months[data.month] +' '+ data.year+'</div>';
content += '</div>';
content += '<table class="uk-datepicker-table">';
content += '<thead>';
for(var i = 0; i < data.weekdays.length; i++) {
if (data.weekdays[i]) {
content += '<th>'+data.weekdays[i]+'</th>';
}
}
content += '</thead>';
content += '<tbody>';
for(var i = 0; i < data.days.length; i++) {
if (data.days[i] && data.days[i].length){
content += '<tr>';
for(var d = 0; d < data.days[i].length; d++) {
if (data.days[i][d]) {
var day = data.days[i][d],
cls = [];
if(!day.inmonth) cls.push("uk-datepicker-table-muted");
if(day.selected) cls.push("uk-active");
content += '<td><a href="" class="'+cls.join(" ")+'" data-date="'+day.day.format()+'">'+day.day.format("D")+'</a></td>';
}
}
content += '</tr>';
}
}
content += '</tbody>';
content += '</table>';
return content;
}
};
$.extend(DatePicker.prototype, {
pick: function(initdate) {
var offset = this.element.offset(),
css = {"top": offset.top + this.element.outerHeight() + this.options.offsettop, "left": offset.left, "right":""};
this.current = initdate ? moment(initdate, this.options.format):moment();
this.initdate = this.current.format("YYYY-MM-DD");
this.update();
if ($.UIkit.langdirection == 'right') {
css.right = window.innerWidth - (css.left + this.element.outerWidth());
css.left = "";
}
dropdown.css(css).show();
active = this;
},
add: function(unit, value) {
this.current.add(unit, value);
this.update();
},
setMonth: function(month) {
this.current.month(month);
this.update();
},
setYear: function(year) {
this.current.year(year);
this.update();
},
update: function() {
var data = this.getRows(this.current.year(), this.current.month()),
tpl = this.options.template(data, this.options);
dropdown.html(tpl);
},
getRows: function(year, month) {
var opts = this.options,
now = moment().format('YYYY-MM-DD'),
days = [31, (year % 4 === 0 && year % 100 !== 0 || year % 400 === 0) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month],
before = new Date(year, month, 1).getDay(),
data = {"month":month, "year":year,"weekdays":[],"days":[]},
row = [];
data.weekdays = (function(){
for (var i=0, arr=[]; i < 7; i++) {
var day = i + (opts.weekstart || 0);
while (day >= 7) {
day -= 7;
}
arr.push(opts.i18n.weekdays[day]);
}
return arr;
})();
if (opts.weekstart && opts.weekstart > 0) {
before -= opts.weekstart;
if (before < 0) {
before += 7;
}
}
var cells = days + before, after = cells;
while(after > 7) { after -= 7; }
cells += 7 - after;
var day, isDisabled, isSelected, isToday, isInMonth;
for (var i = 0, r = 0; i < cells; i++) {
day = new Date(year, month, 1 + (i - before));
isDisabled = (opts.mindate && day < opts.mindate) || (opts.maxdate && day > opts.maxdate);
isInMonth = !(i < before || i >= (days + before));
day = moment(day);
isSelected = this.initdate == day.format("YYYY-MM-DD");
isToday = now == day.format("YYYY-MM-DD");
row.push({"selected": isSelected, "today": isToday, "disabled": isDisabled, "day":day, "inmonth":isInMonth});
if (++r === 7) {
data.days.push(row);
row = [];
r = 0;
}
}
return data;
}
});
UI["datepicker"] = DatePicker;
// init code
$(document).on("focus.datepicker.uikit", "[data-uk-datepicker]", function(e) {
var ele = $(this);
if (!ele.data("datepicker")) {
e.preventDefault();
var obj = new DatePicker(ele, UI.Utils.options(ele.attr("data-uk-datepicker")));
ele.trigger("focus");
}
});
$(document).on("click.datepicker.uikit", function(e) {
var target = $(e.target);
if (active && target[0] != dropdown[0] && !target.data("datepicker") && !target.parents(".uk-datepicker:first").length) {
dropdown.hide();
active = false;
}
});
$(function(){
dropdown.appendTo("body");
});
//! moment.js
//! version : 2.5.1
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
//! license : MIT
//! momentjs.com
moment = (function(B){function G(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1}}function Z(a,b){return function(c){return l(a.call(this,c),b)}}function ta(a,b){return function(c){return this.lang().ordinal(a.call(this,c),b)}}function $(){}function H(a){aa(a);v(this,a)}function I(a){a=ba(a);var b=a.year||0,c=a.month||0,d=a.week||0,f=a.day||0;this._milliseconds=+(a.millisecond||0)+1E3*(a.second||0)+6E4*(a.minute||
0)+36E5*(a.hour||0);this._days=+f+7*d;this._months=+c+12*b;this._data={};this._bubble()}function v(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);b.hasOwnProperty("toString")&&(a.toString=b.toString);b.hasOwnProperty("valueOf")&&(a.valueOf=b.valueOf);return a}function w(a){return 0>a?Math.ceil(a):Math.floor(a)}function l(a,b,c){for(var d=""+Math.abs(a);d.length<b;)d="0"+d;return(0<=a?c?"+":"":"-")+d}function J(a,b,c,d){var f=b._milliseconds,g=b._days;b=b._months;var m,h;f&&a._d.setTime(+a._d+
f*c);if(g||b)m=a.minute(),h=a.hour();g&&a.date(a.date()+g*c);b&&a.month(a.month()+b*c);f&&!d&&e.updateOffset(a,g||b);if(g||b)a.minute(m),a.hour(h)}function K(a){return"[object Array]"===Object.prototype.toString.call(a)}function ca(a,b,c){var d=Math.min(a.length,b.length),f=Math.abs(a.length-b.length),g=0,e;for(e=0;e<d;e++)(c&&a[e]!==b[e]||!c&&h(a[e])!==h(b[e]))&&g++;return g+f}function n(a){if(a){var b=a.toLowerCase().replace(/(.)s$/,"$1");a=ua[a]||va[b]||b}return a}function ba(a){var b={},c,d;for(d in a)a.hasOwnProperty(d)&&
(c=n(d))&&(b[c]=a[d]);return b}function wa(a){var b,c;if(0===a.indexOf("week"))b=7,c="day";else if(0===a.indexOf("month"))b=12,c="month";else return;e[a]=function(d,f){var g,m,h=e.fn._lang[a],k=[];"number"===typeof d&&(f=d,d=B);m=function(a){a=e().utc().set(c,a);return h.call(e.fn._lang,a,d||"")};if(null!=f)return m(f);for(g=0;g<b;g++)k.push(m(g));return k}}function h(a){a=+a;var b=0;0!==a&&isFinite(a)&&(b=0<=a?Math.floor(a):Math.ceil(a));return b}function L(a,b){return(new Date(Date.UTC(a,b+1,0))).getUTCDate()}
function da(a,b,c){return C(e([a,11,31+b-c]),b,c).week}function M(a){return 0===a%4&&0!==a%100||0===a%400}function aa(a){var b;a._a&&-2===a._pf.overflow&&(b=0>a._a[x]||11<a._a[x]?x:1>a._a[q]||a._a[q]>L(a._a[r],a._a[x])?q:0>a._a[p]||23<a._a[p]?p:0>a._a[y]||59<a._a[y]?y:0>a._a[D]||59<a._a[D]?D:0>a._a[E]||999<a._a[E]?E:-1,a._pf._overflowDayOfYear&&(b<r||b>q)&&(b=q),a._pf.overflow=b)}function ea(a){null==a._isValid&&(a._isValid=!isNaN(a._d.getTime())&&0>a._pf.overflow&&!a._pf.empty&&!a._pf.invalidMonth&&
!a._pf.nullInput&&!a._pf.invalidFormat&&!a._pf.userInvalidated,a._strict&&(a._isValid=a._isValid&&0===a._pf.charsLeftOver&&0===a._pf.unusedTokens.length));return a._isValid}function N(a){return a?a.toLowerCase().replace("_","-"):a}function O(a,b){return b._isUTC?e(a).zone(b._offset||0):e(a).local()}function s(a){var b=0,c,d,f,g,m=function(a){if(!z[a]&&xa)try{require("./lang/"+a)}catch(b){}return z[a]};if(!a)return e.fn._lang;if(!K(a)){if(d=m(a))return d;a=[a]}for(;b<a.length;){g=N(a[b]).split("-");
c=g.length;for(f=(f=N(a[b+1]))?f.split("-"):null;0<c;){if(d=m(g.slice(0,c).join("-")))return d;if(f&&f.length>=c&&ca(g,f,!0)>=c-1)break;c--}b++}return e.fn._lang}function ya(a){return a.match(/\[[\s\S]/)?a.replace(/^\[|\]$/g,""):a.replace(/\\/g,"")}function za(a){var b=a.match(fa),c,d;c=0;for(d=b.length;c<d;c++)b[c]=u[b[c]]?u[b[c]]:ya(b[c]);return function(f){var g="";for(c=0;c<d;c++)g+=b[c]instanceof Function?b[c].call(f,a):b[c];return g}}function P(a,b){if(!a.isValid())return a.lang().invalidDate();
b=ga(b,a.lang());Q[b]||(Q[b]=za(b));return Q[b](a)}function ga(a,b){function c(a){return b.longDateFormat(a)||a}var d=5;for(F.lastIndex=0;0<=d&&F.test(a);)a=a.replace(F,c),F.lastIndex=0,d-=1;return a}function Aa(a,b){var c=b._strict;switch(a){case "DDDD":return ha;case "YYYY":case "GGGG":case "gggg":return c?Ba:Ca;case "Y":case "G":case "g":return Da;case "YYYYYY":case "YYYYY":case "GGGGG":case "ggggg":return c?Ea:Fa;case "S":if(c)return Ga;case "SS":if(c)return ia;case "SSS":if(c)return ha;case "DDD":return Ha;
case "MMM":case "MMMM":case "dd":case "ddd":case "dddd":return Ia;case "a":case "A":return s(b._l)._meridiemParse;case "X":return Ja;case "Z":case "ZZ":return R;case "T":return Ka;case "SSSS":return La;case "MM":case "DD":case "YY":case "GG":case "gg":case "HH":case "hh":case "mm":case "ss":case "ww":case "WW":return c?ia:ja;case "M":case "D":case "d":case "H":case "h":case "m":case "s":case "w":case "W":case "e":case "E":return ja;case "Do":return Ma;default:var c=RegExp,d;d=Na(a.replace("\\","")).replace(/[-\/\\^$*+?.()|[\]{}]/g,
"\\$&");return new c(d)}}function ka(a){a=(a||"").match(R)||[];a=((a[a.length-1]||[])+"").match(Oa)||["-",0,0];var b=+(60*a[1])+h(a[2]);return"+"===a[0]?-b:b}function S(a){var b,c=[],d,f,g,m,k;if(!a._d){d=Pa(a);a._w&&null==a._a[q]&&null==a._a[x]&&(b=function(b){var c=parseInt(b,10);return b?3>b.length?68<c?1900+c:2E3+c:c:null==a._a[r]?e().weekYear():a._a[r]},f=a._w,null!=f.GG||null!=f.W||null!=f.E?b=la(b(f.GG),f.W||1,f.E,4,1):(g=s(a._l),m=null!=f.d?ma(f.d,g):null!=f.e?parseInt(f.e,10)+g._week.dow:
0,k=parseInt(f.w,10)||1,null!=f.d&&m<g._week.dow&&k++,b=la(b(f.gg),k,m,g._week.doy,g._week.dow)),a._a[r]=b.year,a._dayOfYear=b.dayOfYear);a._dayOfYear&&(b=null==a._a[r]?d[r]:a._a[r],a._dayOfYear>(M(b)?366:365)&&(a._pf._overflowDayOfYear=!0),b=T(b,0,a._dayOfYear),a._a[x]=b.getUTCMonth(),a._a[q]=b.getUTCDate());for(b=0;3>b&&null==a._a[b];++b)a._a[b]=c[b]=d[b];for(;7>b;b++)a._a[b]=c[b]=null==a._a[b]?2===b?1:0:a._a[b];c[p]+=h((a._tzm||0)/60);c[y]+=h((a._tzm||0)%60);a._d=(a._useUTC?T:Qa).apply(null,c)}}
function Pa(a){var b=new Date;return a._useUTC?[b.getUTCFullYear(),b.getUTCMonth(),b.getUTCDate()]:[b.getFullYear(),b.getMonth(),b.getDate()]}function U(a){a._a=[];a._pf.empty=!0;var b=s(a._l),c=""+a._i,d,f,g,e,k=c.length,l=0;f=ga(a._f,b).match(fa)||[];for(b=0;b<f.length;b++){g=f[b];if(d=(c.match(Aa(g,a))||[])[0])e=c.substr(0,c.indexOf(d)),0<e.length&&a._pf.unusedInput.push(e),c=c.slice(c.indexOf(d)+d.length),l+=d.length;if(u[g]){d?a._pf.empty=!1:a._pf.unusedTokens.push(g);e=a;var n=void 0,t=e._a;
switch(g){case "M":case "MM":null!=d&&(t[x]=h(d)-1);break;case "MMM":case "MMMM":n=s(e._l).monthsParse(d);null!=n?t[x]=n:e._pf.invalidMonth=d;break;case "D":case "DD":null!=d&&(t[q]=h(d));break;case "Do":null!=d&&(t[q]=h(parseInt(d,10)));break;case "DDD":case "DDDD":null!=d&&(e._dayOfYear=h(d));break;case "YY":t[r]=h(d)+(68<h(d)?1900:2E3);break;case "YYYY":case "YYYYY":case "YYYYYY":t[r]=h(d);break;case "a":case "A":e._isPm=s(e._l).isPM(d);break;case "H":case "HH":case "h":case "hh":t[p]=h(d);break;
case "m":case "mm":t[y]=h(d);break;case "s":case "ss":t[D]=h(d);break;case "S":case "SS":case "SSS":case "SSSS":t[E]=h(1E3*("0."+d));break;case "X":e._d=new Date(1E3*parseFloat(d));break;case "Z":case "ZZ":e._useUTC=!0;e._tzm=ka(d);break;case "w":case "ww":case "W":case "WW":case "d":case "dd":case "ddd":case "dddd":case "e":case "E":g=g.substr(0,1);case "gg":case "gggg":case "GG":case "GGGG":case "GGGGG":g=g.substr(0,2),d&&(e._w=e._w||{},e._w[g]=d)}}else a._strict&&!d&&a._pf.unusedTokens.push(g)}a._pf.charsLeftOver=
k-l;0<c.length&&a._pf.unusedInput.push(c);a._isPm&&12>a._a[p]&&(a._a[p]+=12);!1===a._isPm&&12===a._a[p]&&(a._a[p]=0);S(a);aa(a)}function Na(a){return a.replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(a,c,d,f,e){return c||d||f||e})}function Qa(a,b,c,d,f,e,h){b=new Date(a,b,c,d,f,e,h);1970>a&&b.setFullYear(a);return b}function T(a){var b=new Date(Date.UTC.apply(null,arguments));1970>a&&b.setUTCFullYear(a);return b}function ma(a,b){if("string"===typeof a)if(isNaN(a)){if(a=b.weekdaysParse(a),"number"!==
typeof a)return null}else a=parseInt(a,10);return a}function Ra(a,b,c,d,f){return f.relativeTime(b||1,!!c,a,d)}function C(a,b,c){b=c-b;c-=a.day();c>b&&(c-=7);c<b-7&&(c+=7);a=e(a).add("d",c);return{week:Math.ceil(a.dayOfYear()/7),year:a.year()}}function la(a,b,c,d,f){var e=T(a,0,1).getUTCDay();b=7*(b-1)+((null!=c?c:f)-f)+(f-e+(e>d?7:0)-(e<f?7:0))+1;return{year:0<b?a:a-1,dayOfYear:0<b?b:(M(a-1)?366:365)+b}}function na(a){var b=a._i,c=a._f;if(null===b)return e.invalid({nullInput:!0});"string"===typeof b&&
(a._i=b=s().preparse(b));if(e.isMoment(b)){a=b;var d={},f;for(f in a)a.hasOwnProperty(f)&&Sa.hasOwnProperty(f)&&(d[f]=a[f]);a=d;a._d=new Date(+b._d)}else if(c)if(K(c)){var b=a,g,h;if(0===b._f.length)b._pf.invalidFormat=!0,b._d=new Date(NaN);else{for(f=0;f<b._f.length;f++)if(c=0,d=v({},b),d._pf=G(),d._f=b._f[f],U(d),ea(d)&&(c+=d._pf.charsLeftOver,c+=10*d._pf.unusedTokens.length,d._pf.score=c,null==h||c<h))h=c,g=d;v(b,g||d)}}else U(a);else if(d=a,g=d._i,h=Ta.exec(g),g===B)d._d=new Date;else if(h)d._d=
new Date(+h[1]);else if("string"===typeof g)if(b=d._i,f=Ua.exec(b)){d._pf.iso=!0;g=0;for(h=V.length;g<h;g++)if(V[g][1].exec(b)){d._f=V[g][0]+(f[6]||" ");break}g=0;for(h=W.length;g<h;g++)if(W[g][1].exec(b)){d._f+=W[g][0];break}b.match(R)&&(d._f+="Z");U(d)}else d._d=new Date(b);else K(g)?(d._a=g.slice(0),S(d)):"[object Date]"===Object.prototype.toString.call(g)||g instanceof Date?d._d=new Date(+g):"object"===typeof g?d._d||(g=ba(d._i),d._a=[g.year,g.month,g.day,g.hour,g.minute,g.second,g.millisecond],
S(d)):d._d=new Date(g);return new H(a)}function oa(a,b){var c="date"===b||"month"===b||"year"===b;e.fn[a]=e.fn[a+"s"]=function(a,f){var g=this._isUTC?"UTC":"";null==f&&(f=c);return null!=a?(this._d["set"+g+b](a),e.updateOffset(this,f),this):this._d["get"+g+b]()}}function Va(a){e.duration.fn[a]=function(){return this._data[a]}}function pa(a,b){e.duration.fn["as"+a]=function(){return+this/b}}for(var e,A=Math.round,k,r=0,x=1,q=2,p=3,y=4,D=5,E=6,z={},Sa={_isAMomentObject:null,_i:null,_f:null,_l:null,
_strict:null,_isUTC:null,_offset:null,_pf:null,_lang:null},xa="undefined"!==typeof module&&module.exports&&"undefined"!==typeof require,Ta=/^\/?Date\((\-?\d+)/i,Wa=/(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/,Xa=/^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/,fa=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,4}|X|zz?|ZZ?|.)/g,
F=/(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g,ja=/\d\d?/,Ha=/\d{1,3}/,Ca=/\d{1,4}/,Fa=/[+\-]?\d{1,6}/,La=/\d+/,Ia=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,R=/Z|[\+\-]\d\d:?\d\d/gi,Ka=/T/i,Ja=/[\+\-]?\d+(\.\d{1,3})?/,Ma=/\d{1,2}/,Ga=/\d/,ia=/\d\d/,ha=/\d{3}/,Ba=/\d{4}/,Ea=/[+-]?\d{6}/,Da=/[+-]?\d+/,Ua=/^\s*(?:[+-]\d{6}|\d{4})-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,
V=[["YYYYYY-MM-DD",/[+-]\d{6}-\d{2}-\d{2}/],["YYYY-MM-DD",/\d{4}-\d{2}-\d{2}/],["GGGG-[W]WW-E",/\d{4}-W\d{2}-\d/],["GGGG-[W]WW",/\d{4}-W\d{2}/],["YYYY-DDD",/\d{4}-\d{3}/]],W=[["HH:mm:ss.SSSS",/(T| )\d\d:\d\d:\d\d\.\d{1,3}/],["HH:mm:ss",/(T| )\d\d:\d\d:\d\d/],["HH:mm",/(T| )\d\d:\d\d/],["HH",/(T| )\d\d/]],Oa=/([\+\-]|\d\d)/gi,X=["Date","Hours","Minutes","Seconds","Milliseconds"],Y={Milliseconds:1,Seconds:1E3,Minutes:6E4,Hours:36E5,Days:864E5,Months:2592E6,Years:31536E6},ua={ms:"millisecond",s:"second",
m:"minute",h:"hour",d:"day",D:"date",w:"week",W:"isoWeek",M:"month",y:"year",DDD:"dayOfYear",e:"weekday",E:"isoWeekday",gg:"weekYear",GG:"isoWeekYear"},va={dayofyear:"dayOfYear",isoweekday:"isoWeekday",isoweek:"isoWeek",weekyear:"weekYear",isoweekyear:"isoWeekYear"},Q={},qa="DDD w W M D d".split(" "),ra="MDHhmswW".split(""),u={M:function(){return this.month()+1},MMM:function(a){return this.lang().monthsShort(this,a)},MMMM:function(a){return this.lang().months(this,a)},D:function(){return this.date()},
DDD:function(){return this.dayOfYear()},d:function(){return this.day()},dd:function(a){return this.lang().weekdaysMin(this,a)},ddd:function(a){return this.lang().weekdaysShort(this,a)},dddd:function(a){return this.lang().weekdays(this,a)},w:function(){return this.week()},W:function(){return this.isoWeek()},YY:function(){return l(this.year()%100,2)},YYYY:function(){return l(this.year(),4)},YYYYY:function(){return l(this.year(),5)},YYYYYY:function(){var a=this.year();return(0<=a?"+":"-")+l(Math.abs(a),
6)},gg:function(){return l(this.weekYear()%100,2)},gggg:function(){return l(this.weekYear(),4)},ggggg:function(){return l(this.weekYear(),5)},GG:function(){return l(this.isoWeekYear()%100,2)},GGGG:function(){return l(this.isoWeekYear(),4)},GGGGG:function(){return l(this.isoWeekYear(),5)},e:function(){return this.weekday()},E:function(){return this.isoWeekday()},a:function(){return this.lang().meridiem(this.hours(),this.minutes(),!0)},A:function(){return this.lang().meridiem(this.hours(),this.minutes(),
!1)},H:function(){return this.hours()},h:function(){return this.hours()%12||12},m:function(){return this.minutes()},s:function(){return this.seconds()},S:function(){return h(this.milliseconds()/100)},SS:function(){return l(h(this.milliseconds()/10),2)},SSS:function(){return l(this.milliseconds(),3)},SSSS:function(){return l(this.milliseconds(),3)},Z:function(){var a=-this.zone(),b="+";0>a&&(a=-a,b="-");return b+l(h(a/60),2)+":"+l(h(a)%60,2)},ZZ:function(){var a=-this.zone(),b="+";0>a&&(a=-a,b="-");
return b+l(h(a/60),2)+l(h(a)%60,2)},z:function(){return this.zoneAbbr()},zz:function(){return this.zoneName()},X:function(){return this.unix()},Q:function(){return this.quarter()}},sa=["months","monthsShort","weekdays","weekdaysShort","weekdaysMin"];qa.length;)k=qa.pop(),u[k+"o"]=ta(u[k],k);for(;ra.length;)k=ra.pop(),u[k+k]=Z(u[k],2);u.DDDD=Z(u.DDD,3);v($.prototype,{set:function(a){var b,c;for(c in a)b=a[c],"function"===typeof b?this[c]=b:this["_"+c]=b},_months:"January February March April May June July August September October November December".split(" "),
months:function(a){return this._months[a.month()]},_monthsShort:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),monthsShort:function(a){return this._monthsShort[a.month()]},monthsParse:function(a){var b,c;this._monthsParse||(this._monthsParse=[]);for(b=0;12>b;b++)if(this._monthsParse[b]||(c=e.utc([2E3,b]),c="^"+this.months(c,"")+"|^"+this.monthsShort(c,""),this._monthsParse[b]=RegExp(c.replace(".",""),"i")),this._monthsParse[b].test(a))return b},_weekdays:"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),
weekdays:function(a){return this._weekdays[a.day()]},_weekdaysShort:"Sun Mon Tue Wed Thu Fri Sat".split(" "),weekdaysShort:function(a){return this._weekdaysShort[a.day()]},_weekdaysMin:"Su Mo Tu We Th Fr Sa".split(" "),weekdaysMin:function(a){return this._weekdaysMin[a.day()]},weekdaysParse:function(a){var b,c;this._weekdaysParse||(this._weekdaysParse=[]);for(b=0;7>b;b++)if(this._weekdaysParse[b]||(c=e([2E3,1]).day(b),c="^"+this.weekdays(c,"")+"|^"+this.weekdaysShort(c,"")+"|^"+this.weekdaysMin(c,
""),this._weekdaysParse[b]=RegExp(c.replace(".",""),"i")),this._weekdaysParse[b].test(a))return b},_longDateFormat:{LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D YYYY",LLL:"MMMM D YYYY LT",LLLL:"dddd, MMMM D YYYY LT"},longDateFormat:function(a){var b=this._longDateFormat[a];!b&&this._longDateFormat[a.toUpperCase()]&&(b=this._longDateFormat[a.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(a){return a.slice(1)}),this._longDateFormat[a]=b);return b},isPM:function(a){return"p"===(a+"").toLowerCase().charAt(0)},
_meridiemParse:/[ap]\.?m?\.?/i,meridiem:function(a,b,c){return 11<a?c?"pm":"PM":c?"am":"AM"},_calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},calendar:function(a,b){var c=this._calendar[a];return"function"===typeof c?c.apply(b):c},_relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",
y:"a year",yy:"%d years"},relativeTime:function(a,b,c,d){var f=this._relativeTime[c];return"function"===typeof f?f(a,b,c,d):f.replace(/%d/i,a)},pastFuture:function(a,b){var c=this._relativeTime[0<a?"future":"past"];return"function"===typeof c?c(b):c.replace(/%s/i,b)},ordinal:function(a){return this._ordinal.replace("%d",a)},_ordinal:"%d",preparse:function(a){return a},postformat:function(a){return a},week:function(a){return C(a,this._week.dow,this._week.doy).week},_week:{dow:0,doy:6},_invalidDate:"Invalid date",
invalidDate:function(){return this._invalidDate}});e=function(a,b,c,d){var f;"boolean"===typeof c&&(d=c,c=B);f={_isAMomentObject:!0};f._i=a;f._f=b;f._l=c;f._strict=d;f._isUTC=!1;f._pf=G();return na(f)};e.utc=function(a,b,c,d){var f;"boolean"===typeof c&&(d=c,c=B);f={_isAMomentObject:!0,_useUTC:!0,_isUTC:!0};f._l=c;f._i=a;f._f=b;f._strict=d;f._pf=G();return na(f).utc()};e.unix=function(a){return e(1E3*a)};e.duration=function(a,b){var c=a,d=null,f;if(e.isDuration(a))c={ms:a._milliseconds,d:a._days,
M:a._months};else if("number"===typeof a)c={},b?c[b]=a:c.milliseconds=a;else if(d=Wa.exec(a))f="-"===d[1]?-1:1,c={y:0,d:h(d[q])*f,h:h(d[p])*f,m:h(d[y])*f,s:h(d[D])*f,ms:h(d[E])*f};else if(d=Xa.exec(a))f="-"===d[1]?-1:1,c=function(a){a=a&&parseFloat(a.replace(",","."));return(isNaN(a)?0:a)*f},c={y:c(d[2]),M:c(d[3]),d:c(d[4]),h:c(d[5]),m:c(d[6]),s:c(d[7]),w:c(d[8])};d=new I(c);e.isDuration(a)&&a.hasOwnProperty("_lang")&&(d._lang=a._lang);return d};e.version="2.5.1";e.defaultFormat="YYYY-MM-DDTHH:mm:ssZ";
e.updateOffset=function(){};e.lang=function(a,b){if(!a)return e.fn._lang._abbr;if(b){var c=N(a);b.abbr=c;z[c]||(z[c]=new $);z[c].set(b)}else null===b?(delete z[a],a="en"):z[a]||s(a);return(e.duration.fn._lang=e.fn._lang=s(a))._abbr};e.langData=function(a){a&&a._lang&&a._lang._abbr&&(a=a._lang._abbr);return s(a)};e.isMoment=function(a){return a instanceof H||null!=a&&a.hasOwnProperty("_isAMomentObject")};e.isDuration=function(a){return a instanceof I};for(k=sa.length-1;0<=k;--k)wa(sa[k]);e.normalizeUnits=
function(a){return n(a)};e.invalid=function(a){var b=e.utc(NaN);null!=a?v(b._pf,a):b._pf.userInvalidated=!0;return b};e.parseZone=function(){return e.apply(null,arguments).parseZone()};v(e.fn=H.prototype,{clone:function(){return e(this)},valueOf:function(){return+this._d+6E4*(this._offset||0)},unix:function(){return Math.floor(+this/1E3)},toString:function(){return this.clone().lang("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},toDate:function(){return this._offset?new Date(+this):this._d},toISOString:function(){var a=
e(this).utc();return 0<a.year()&&9999>=a.year()?P(a,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):P(a,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]")},toArray:function(){return[this.year(),this.month(),this.date(),this.hours(),this.minutes(),this.seconds(),this.milliseconds()]},isValid:function(){return ea(this)},isDSTShifted:function(){return this._a?this.isValid()&&0<ca(this._a,(this._isUTC?e.utc(this._a):e(this._a)).toArray()):!1},parsingFlags:function(){return v({},this._pf)},invalidAt:function(){return this._pf.overflow},
utc:function(){return this.zone(0)},local:function(){this.zone(0);this._isUTC=!1;return this},format:function(a){a=P(this,a||e.defaultFormat);return this.lang().postformat(a)},add:function(a,b){var c;c="string"===typeof a?e.duration(+b,a):e.duration(a,b);J(this,c,1);return this},subtract:function(a,b){var c;c="string"===typeof a?e.duration(+b,a):e.duration(a,b);J(this,c,-1);return this},diff:function(a,b,c){a=O(a,this);var d=6E4*(this.zone()-a.zone()),f;b=n(b);"year"===b||"month"===b?(f=432E5*(this.daysInMonth()+
a.daysInMonth()),d=12*(this.year()-a.year())+(this.month()-a.month()),d+=(this-e(this).startOf("month")-(a-e(a).startOf("month")))/f,d-=6E4*(this.zone()-e(this).startOf("month").zone()-(a.zone()-e(a).startOf("month").zone()))/f,"year"===b&&(d/=12)):(f=this-a,d="second"===b?f/1E3:"minute"===b?f/6E4:"hour"===b?f/36E5:"day"===b?(f-d)/864E5:"week"===b?(f-d)/6048E5:f);return c?d:w(d)},from:function(a,b){return e.duration(this.diff(a)).lang(this.lang()._abbr).humanize(!b)},fromNow:function(a){return this.from(e(),
a)},calendar:function(){var a=O(e(),this).startOf("day"),a=this.diff(a,"days",!0),a=-6>a?"sameElse":-1>a?"lastWeek":0>a?"lastDay":1>a?"sameDay":2>a?"nextDay":7>a?"nextWeek":"sameElse";return this.format(this.lang().calendar(a,this))},isLeapYear:function(){return M(this.year())},isDST:function(){return this.zone()<this.clone().month(0).zone()||this.zone()<this.clone().month(5).zone()},day:function(a){var b=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=a?(a=ma(a,this.lang()),this.add({d:a-
b})):b},month:function(a){var b=this._isUTC?"UTC":"",c;if(null!=a){if("string"===typeof a&&(a=this.lang().monthsParse(a),"number"!==typeof a))return this;c=Math.min(this.date(),L(this.year(),a));this._d["set"+b+"Month"](a,c);e.updateOffset(this,!0);return this}return this._d["get"+b+"Month"]()},startOf:function(a){a=n(a);switch(a){case "year":this.month(0);case "month":this.date(1);case "week":case "isoWeek":case "day":this.hours(0);case "hour":this.minutes(0);case "minute":this.seconds(0);case "second":this.milliseconds(0)}"week"===
a?this.weekday(0):"isoWeek"===a&&this.isoWeekday(1);return this},endOf:function(a){a=n(a);return this.startOf(a).add("isoWeek"===a?"week":a,1).subtract("ms",1)},isAfter:function(a,b){b="undefined"!==typeof b?b:"millisecond";return+this.clone().startOf(b)>+e(a).startOf(b)},isBefore:function(a,b){b="undefined"!==typeof b?b:"millisecond";return+this.clone().startOf(b)<+e(a).startOf(b)},isSame:function(a,b){b=b||"ms";return+this.clone().startOf(b)===+O(a,this).startOf(b)},min:function(a){a=e.apply(null,
arguments);return a<this?this:a},max:function(a){a=e.apply(null,arguments);return a>this?this:a},zone:function(a,b){b=null==b?!0:!1;var c=this._offset||0;if(null!=a)"string"===typeof a&&(a=ka(a)),16>Math.abs(a)&&(a*=60),this._offset=a,this._isUTC=!0,c!==a&&b&&J(this,e.duration(c-a,"m"),1,!0);else return this._isUTC?c:this._d.getTimezoneOffset();return this},zoneAbbr:function(){return this._isUTC?"UTC":""},zoneName:function(){return this._isUTC?"Coordinated Universal Time":""},parseZone:function(){this._tzm?
this.zone(this._tzm):"string"===typeof this._i&&this.zone(this._i);return this},hasAlignedHourOffset:function(a){a=a?e(a).zone():0;return 0===(this.zone()-a)%60},daysInMonth:function(){return L(this.year(),this.month())},dayOfYear:function(a){var b=A((e(this).startOf("day")-e(this).startOf("year"))/864E5)+1;return null==a?b:this.add("d",a-b)},quarter:function(){return Math.ceil((this.month()+1)/3)},weekYear:function(a){var b=C(this,this.lang()._week.dow,this.lang()._week.doy).year;return null==a?
b:this.add("y",a-b)},isoWeekYear:function(a){var b=C(this,1,4).year;return null==a?b:this.add("y",a-b)},week:function(a){var b=this.lang().week(this);return null==a?b:this.add("d",7*(a-b))},isoWeek:function(a){var b=C(this,1,4).week;return null==a?b:this.add("d",7*(a-b))},weekday:function(a){var b=(this.day()+7-this.lang()._week.dow)%7;return null==a?b:this.add("d",a-b)},isoWeekday:function(a){return null==a?this.day()||7:this.day(this.day()%7?a:a-7)},isoWeeksInYear:function(){return da(this.year(),
1,4)},weeksInYear:function(){var a=this._lang._week;return da(this.year(),a.dow,a.doy)},get:function(a){a=n(a);return this[a]()},set:function(a,b){a=n(a);if("function"===typeof this[a])this[a](b);return this},lang:function(a){if(a===B)return this._lang;this._lang=s(a);return this}});for(k=0;k<X.length;k++)oa(X[k].toLowerCase().replace(/s$/,""),X[k]);oa("year","FullYear");e.fn.days=e.fn.day;e.fn.months=e.fn.month;e.fn.weeks=e.fn.week;e.fn.isoWeeks=e.fn.isoWeek;e.fn.toJSON=e.fn.toISOString;v(e.duration.fn=
I.prototype,{_bubble:function(){var a=this._milliseconds,b=this._days,c=this._months,d=this._data;d.milliseconds=a%1E3;a=w(a/1E3);d.seconds=a%60;a=w(a/60);d.minutes=a%60;a=w(a/60);d.hours=a%24;b+=w(a/24);d.days=b%30;c+=w(b/30);d.months=c%12;b=w(c/12);d.years=b},weeks:function(){return w(this.days()/7)},valueOf:function(){return this._milliseconds+864E5*this._days+this._months%12*2592E6+31536E6*h(this._months/12)},humanize:function(a){var b=+this,c;c=!a;var d=this.lang(),f=A(Math.abs(b)/1E3),e=A(f/
60),h=A(e/60),k=A(h/24),l=A(k/365),f=45>f&&["s",f]||1===e&&["m"]||45>e&&["mm",e]||1===h&&["h"]||22>h&&["hh",h]||1===k&&["d"]||25>=k&&["dd",k]||45>=k&&["M"]||345>k&&["MM",A(k/30)]||1===l&&["y"]||["yy",l];f[2]=c;f[3]=0<b;f[4]=d;c=Ra.apply({},f);a&&(c=this.lang().pastFuture(b,c));return this.lang().postformat(c)},add:function(a,b){var c=e.duration(a,b);this._milliseconds+=c._milliseconds;this._days+=c._days;this._months+=c._months;this._bubble();return this},subtract:function(a,b){var c=e.duration(a,
b);this._milliseconds-=c._milliseconds;this._days-=c._days;this._months-=c._months;this._bubble();return this},get:function(a){a=n(a);return this[a.toLowerCase()+"s"]()},as:function(a){a=n(a);return this["as"+a.charAt(0).toUpperCase()+a.slice(1)+"s"]()},lang:e.fn.lang,toIsoString:function(){var a=Math.abs(this.years()),b=Math.abs(this.months()),c=Math.abs(this.days()),d=Math.abs(this.hours()),e=Math.abs(this.minutes()),g=Math.abs(this.seconds()+this.milliseconds()/1E3);return this.asSeconds()?(0>
this.asSeconds()?"-":"")+"P"+(a?a+"Y":"")+(b?b+"M":"")+(c?c+"D":"")+(d||e||g?"T":"")+(d?d+"H":"")+(e?e+"M":"")+(g?g+"S":""):"P0D"}});for(k in Y)Y.hasOwnProperty(k)&&(pa(k,Y[k]),Va(k.toLowerCase()));pa("Weeks",6048E5);e.duration.fn.asMonths=function(){return(+this-31536E6*this.years())/2592E6+12*this.years()};e.lang("en",{ordinal:function(a){var b=a%10,b=1===h(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+b}});return e}).call(this);
DatePicker.moment = moment;
return DatePicker;
});
+3
View File
@@ -0,0 +1,3 @@
/*! UIkit 2.5.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
(function(t){"function"==typeof define&&define.amd&&define("uikit-datepicker",["uikit"],function(){return jQuery.UIkit.datepicker||t(window,window.jQuery,window.jQuery.UIkit)}),window&&window.jQuery&&window.jQuery.UIkit&&t(window,window.jQuery,window.jQuery.UIkit)})(function(t,e,n){var i,s=!1,o=e('<div class="uk-dropdown uk-datepicker"></div>');o.on("click",".uk-datepicker-next, .uk-datepicker-previous, [data-date]",function(t){t.stopPropagation(),t.preventDefault();var n=e(this);n.is("[data-date]")?(s.element.val(i(n.data("date")).format(s.options.format)).trigger("change"),o.hide(),s=!1):s.add("months",1*(n.hasClass("uk-datepicker-next")?1:-1))});var a=function(t,n){var o=this,r=e(t);r.data("datepicker")||(this.element=r,this.options=e.extend({},a.defaults,n),this.current=this.element.val()?i(this.element.val(),this.options.format):i(),this.element.on("click",function(){s!==o&&o.pick(this.value)}).on("change",function(){o.element.val()&&!i(o.element.val(),o.options.format).isValid()&&o.element.val(i().format(o.options.format))}),this.element.data("datepicker",this))};return a.defaults={weekstart:1,i18n:{months:["January","February","March","April","May","June","July","August","September","October","November","December"],weekdays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},format:"DD.MM.YYYY",offsettop:5,template:function(t,e){var n="";n+='<div class="uk-datepicker-nav">',n+='<a href="" class="uk-datepicker-previous"></a>',n+='<a href="" class="uk-datepicker-next"></a>',n+='<div class="uk-datepicker-heading">'+e.i18n.months[t.month]+" "+t.year+"</div>",n+="</div>",n+='<table class="uk-datepicker-table">',n+="<thead>";for(var i=0;t.weekdays.length>i;i++)t.weekdays[i]&&(n+="<th>"+t.weekdays[i]+"</th>");n+="</thead>",n+="<tbody>";for(var i=0;t.days.length>i;i++)if(t.days[i]&&t.days[i].length){n+="<tr>";for(var s=0;t.days[i].length>s;s++)if(t.days[i][s]){var o=t.days[i][s],a=[];o.inmonth||a.push("uk-datepicker-table-muted"),o.selected&&a.push("uk-active"),n+='<td><a href="" class="'+a.join(" ")+'" data-date="'+o.day.format()+'">'+o.day.format("D")+"</a></td>"}n+="</tr>"}return n+="</tbody>",n+="</table>"}},e.extend(a.prototype,{pick:function(t){var n=this.element.offset(),a={top:n.top+this.element.outerHeight()+this.options.offsettop,left:n.left,right:""};this.current=t?i(t,this.options.format):i(),this.initdate=this.current.format("YYYY-MM-DD"),this.update(),"right"==e.UIkit.langdirection&&(a.right=window.innerWidth-(a.left+this.element.outerWidth()),a.left=""),o.css(a).show(),s=this},add:function(t,e){this.current.add(t,e),this.update()},setMonth:function(t){this.current.month(t),this.update()},setYear:function(t){this.current.year(t),this.update()},update:function(){var t=this.getRows(this.current.year(),this.current.month()),e=this.options.template(t,this.options);o.html(e)},getRows:function(t,e){var n=this.options,s=i().format("YYYY-MM-DD"),o=[31,0===t%4&&0!==t%100||0===t%400?29:28,31,30,31,30,31,31,30,31,30,31][e],a=new Date(t,e,1).getDay(),r={month:e,year:t,weekdays:[],days:[]},u=[];r.weekdays=function(){for(var t=0,e=[];7>t;t++){for(var i=t+(n.weekstart||0);i>=7;)i-=7;e.push(n.i18n.weekdays[i])}return e}(),n.weekstart&&n.weekstart>0&&(a-=n.weekstart,0>a&&(a+=7));for(var l=o+a,d=l;d>7;)d-=7;l+=7-d;for(var c,h,f,p,m,g=0,v=0;l>g;g++)c=new Date(t,e,1+(g-a)),h=n.mindate&&n.mindate>c||n.maxdate&&c>n.maxdate,m=!(a>g||g>=o+a),c=i(c),f=this.initdate==c.format("YYYY-MM-DD"),p=s==c.format("YYYY-MM-DD"),u.push({selected:f,today:p,disabled:h,day:c,inmonth:m}),7===++v&&(r.days.push(u),u=[],v=0);return r}}),n.datepicker=a,e(document).on("focus.datepicker.uikit","[data-uk-datepicker]",function(t){var i=e(this);i.data("datepicker")||(t.preventDefault(),new a(i,n.Utils.options(i.attr("data-uk-datepicker"))),i.trigger("focus"))}),e(document).on("click.datepicker.uikit",function(t){var n=e(t.target);!s||n[0]==o[0]||n.data("datepicker")||n.parents(".uk-datepicker:first").length||(o.hide(),s=!1)}),e(function(){o.appendTo("body")}),i=function(t){function e(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1}}function n(t,e){return function(n){return l(t.call(this,n),e)}}function i(t,e){return function(n){return this.lang().ordinal(t.call(this,n),e)}}function s(){}function o(t){y(t),r(this,t)}function a(t){t=p(t);var e=t.year||0,n=t.month||0,i=t.week||0,s=t.day||0;this._milliseconds=+(t.millisecond||0)+1e3*(t.second||0)+6e4*(t.minute||0)+36e5*(t.hour||0),this._days=+s+7*i,this._months=+n+12*e,this._data={},this._bubble()}function r(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return e.hasOwnProperty("toString")&&(t.toString=e.toString),e.hasOwnProperty("valueOf")&&(t.valueOf=e.valueOf),t}function u(t){return 0>t?Math.ceil(t):Math.floor(t)}function l(t,e,n){for(var i=""+Math.abs(t);e>i.length;)i="0"+i;return(t>=0?n?"+":"":"-")+i}function d(t,e,n,i){var s=e._milliseconds,o=e._days;e=e._months;var a,r;s&&t._d.setTime(+t._Line truncated
+64
View File
@@ -0,0 +1,64 @@
/*! UIkit 2.5.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
(function(addon) {
if (typeof define == "function" && define.amd) { // AMD
define("uikit-form-password", ["uikit"], function(){
return jQuery.UIkit.formPassword || addon(window, window.jQuery, window.jQuery.UIkit);
});
}
if(window && window.jQuery && window.jQuery.UIkit) {
addon(window, window.jQuery, window.jQuery.UIkit);
}
})(function(global, $, UI){
var FormPassword = function(element, options) {
var $this = this, $element = $(element);
if($element.data("formPassword")) return;
this.options = $.extend({}, FormPassword.defaults, options);
this.element = $element.on("click", function(e) {
e.preventDefault();
if($this.input.length) {
var type = $this.input.attr("type");
$this.input.attr("type", type=="text" ? "password":"text");
$this.element.text($this.options[type=="text" ? "lblShow":"lblHide"]);
}
});
$this.input = this.element.next("input").length ? this.element.next("input") : this.element.prev("input");
$this.element.text(this.options[$this.input.is("[type='password']") ? "lblShow":"lblHide"]);
this.element.data("formPassword", this);
};
FormPassword.defaults = {
"lblShow": "Show",
"lblHide": "Hide"
};
UI["formPassword"] = FormPassword;
// init code
$(document).on("click.formpassword.uikit", "[data-uk-form-password]", function(e) {
var ele = $(this);
if (!ele.data("formPassword")) {
e.preventDefault();
var obj = new FormPassword(ele, UI.Utils.options(ele.attr("data-uk-form-password")));
ele.trigger("click");
}
});
return FormPassword;
});
@@ -0,0 +1,3 @@
/*! UIkit 2.5.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
(function(t){"function"==typeof define&&define.amd&&define("uikit-form-password",["uikit"],function(){return jQuery.UIkit.formPassword||t(window,window.jQuery,window.jQuery.UIkit)}),window&&window.jQuery&&window.jQuery.UIkit&&t(window,window.jQuery,window.jQuery.UIkit)})(function(t,e,n){var i=function(t,n){var s=this,o=e(t);o.data("formPassword")||(this.options=e.extend({},i.defaults,n),this.element=o.on("click",function(t){if(t.preventDefault(),s.input.length){var e=s.input.attr("type");s.input.attr("type","text"==e?"password":"text"),s.element.text(s.options["text"==e?"lblShow":"lblHide"])}}),s.input=this.element.next("input").length?this.element.next("input"):this.element.prev("input"),s.element.text(this.options[s.input.is("[type='password']")?"lblShow":"lblHide"]),this.element.data("formPassword",this))};return i.defaults={lblShow:"Show",lblHide:"Hide"},n.formPassword=i,e(document).on("click.formpassword.uikit","[data-uk-form-password]",function(t){var s=e(this);s.data("formPassword")||(t.preventDefault(),new i(s,n.Utils.options(s.attr("data-uk-form-password"))),s.trigger("click"))}),i});
+415
View File
@@ -0,0 +1,415 @@
/*! UIkit 2.5.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
(function(addon) {
if (typeof define == "function" && define.amd) { // AMD
define("uikit-markdownarea", ["uikit"], function(){
return jQuery.UIkit.markdownarea || addon(window, window.jQuery, window.jQuery.UIkit);
});
}
if(window && window.jQuery && window.jQuery.UIkit) {
addon(window, window.jQuery, window.jQuery.UIkit);
}
})(function(global, $, UI){
var Markdownarea = function(element, options){
var $element = $(element);
if($element.data("markdownarea")) return;
this.element = $element;
this.options = $.extend({}, Markdownarea.defaults, options);
this.marked = this.options.marked || marked;
this.CodeMirror = this.options.CodeMirror || CodeMirror;
this.marked.setOptions({
gfm: true,
tables: true,
breaks: true,
pedantic: false,
sanitize: false,
smartLists: true,
smartypants: false,
langPrefix: 'lang-'
});
this.init();
this.element.data("markdownarea", this);
};
$.extend(Markdownarea.prototype, {
init: function(){
var $this = this, tpl = Markdownarea.template;
tpl = tpl.replace(/\{\:lblPreview\}/g, this.options.lblPreview);
tpl = tpl.replace(/\{\:lblCodeview\}/g, this.options.lblCodeview);
this.markdownarea = $(tpl);
this.content = this.markdownarea.find(".uk-markdownarea-content");
this.toolbar = this.markdownarea.find(".uk-markdownarea-toolbar");
this.preview = this.markdownarea.find(".uk-markdownarea-preview").children().eq(0);
this.code = this.markdownarea.find(".uk-markdownarea-code");
this.element.before(this.markdownarea).appendTo(this.code);
this.editor = this.CodeMirror.fromTextArea(this.element[0], this.options.codemirror);
this.editor.markdownarea = this;
this.editor.on("change", (function(){
var render = function(){
var value = $this.editor.getValue();
$this.currentvalue = String(value);
$this.element.trigger("markdownarea-before", [$this]);
$this.applyPlugins();
$this.marked($this.currentvalue, function (err, markdown) {
if (err) throw err;
$this.preview.html(markdown);
$this.element.val($this.editor.getValue()).trigger("markdownarea-update", [$this]);
});
};
render();
return UI.Utils.debounce(render, 150);
})());
this.code.find(".CodeMirror").css("height", this.options.height);
this._buildtoolbar();
this.fit();
$(window).on("resize", UI.Utils.debounce(function(){
$this.fit();
}, 200));
var previewContainer = $this.preview.parent(),
codeContent = this.code.find('.CodeMirror-sizer'),
codeScroll = this.code.find('.CodeMirror-scroll').on('scroll',UI.Utils.debounce(function() {
if($this.markdownarea.attr("data-mode")=="tab") return;
// calc position
var codeHeight = codeContent.height() - codeScroll.height(),
previewHeight = previewContainer[0].scrollHeight - previewContainer.height(),
ratio = previewHeight / codeHeight,
previewPostition = codeScroll.scrollTop() * ratio;
// apply new scroll
previewContainer.scrollTop(previewPostition);
}, 10));
this.markdownarea.on("click", ".uk-markdown-button-markdown, .uk-markdown-button-preview", function(e){
e.preventDefault();
if($this.markdownarea.attr("data-mode")=="tab") {
$this.markdownarea.find(".uk-markdown-button-markdown, .uk-markdown-button-preview").removeClass("uk-active").filter(this).addClass("uk-active");
$this.activetab = $(this).hasClass("uk-markdown-button-markdown") ? "code":"preview";
$this.markdownarea.attr("data-active-tab", $this.activetab);
}
});
this.preview.parent().css("height", this.code.height());
},
applyPlugins: function(){
var $this = this,
plugins = Object.keys(Markdownarea.plugins),
plgs = Markdownarea.plugins;
this.markers = {};
if(plugins.length) {
var lines = this.currentvalue.split("\n");
plugins.forEach(function(name){
this.markers[name] = [];
}, this);
for(var line=0,max=lines.length;line<max;line++) {
(function(line){
plugins.forEach(function(name){
var i = 0;
lines[line] = lines[line].replace(plgs[name].identifier, function(){
var replacement = plgs[name].cb({
"area" : $this,
"found": arguments,
"line" : line,
"pos" : i++,
"uid" : [name, line, i, (new Date().getTime())+"RAND"+(Math.ceil(Math.random() *100000))].join('-'),
"replace": function(strwith){
var src = this.area.editor.getLine(this.line),
start = src.indexOf(this.found[0]);
end = this.found[0].length;
this.area.editor.replaceRange(strwith, {"line": this.line, "ch":start}, {"line": this.line, "ch":end} );
}
});
return replacement;
});
});
})(line);
}
this.currentvalue = lines.join("\n");
}
},
_buildtoolbar: function(){
if(!(this.options.toolbar && this.options.toolbar.length)) return;
var $this = this, bar = [];
this.options.toolbar.forEach(function(cmd){
if(Markdownarea.commands[cmd]) {
var title = Markdownarea.commands[cmd].title ? Markdownarea.commands[cmd].title : cmd;
bar.push('<li><a data-markdownarea-cmd="'+cmd+'" title="'+title+'" data-uk-tooltip>'+Markdownarea.commands[cmd].label+'</a></li>');
if(Markdownarea.commands[cmd].shortcut) {
$this.registerShortcut(Markdownarea.commands[cmd].shortcut, Markdownarea.commands[cmd].action);
}
}
});
this.toolbar.html(bar.join("\n"));
this.markdownarea.on("click", "a[data-markdownarea-cmd]", function(){
var cmd = $(this).data("markdownareaCmd");
if(cmd && Markdownarea.commands[cmd] && (!$this.activetab || $this.activetab=="code" || cmd=="fullscreen")) {
Markdownarea.commands[cmd].action.apply($this, [$this.editor])
}
});
},
fit: function() {
var mode = this.options.mode;
if(mode=="split" && this.markdownarea.width() < this.options.maxsplitsize) {
mode = "tab";
}
if(mode=="tab") {
if(!this.activetab) {
this.activetab = "code";
this.markdownarea.attr("data-active-tab", this.activetab);
}
this.markdownarea.find(".uk-markdown-button-markdown, .uk-markdown-button-preview").removeClass("uk-active")
.filter(this.activetab=="code" ? '.uk-markdown-button-markdown':'.uk-markdown-button-preview').addClass("uk-active");
}
this.editor.refresh();
this.preview.parent().css("height", this.code.height());
this.markdownarea.attr("data-mode", mode);
},
registerShortcut: function(combination, callback){
var $this = this;
combination = $.isArray(combination) ? combination : [combination];
for(var i=0,max=combination.length;i < max;i++) {
var map = {};
map[combination[i]] = function(){
callback.apply($this, [$this.editor]);
};
$this.editor.addKeyMap(map);
}
}
});
//jQuery plugin
$.fn.markdownarea = function(options){
return this.each(function(){
var ele = $(this);
if(!ele.data("markdownarea")) {
var obj = new Markdownarea(ele, options);
}
});
};
var baseReplacer = function(replace, editor){
var text = editor.getSelection(),
markdown = replace.replace('$1', text);
editor.replaceSelection(markdown, 'end');
};
Markdownarea.commands = {
"fullscreen": {
"title" : 'Fullscreen',
"label" : '<i class="uk-icon-expand"></i>',
"action" : function(editor){
editor.markdownarea.markdownarea.toggleClass("uk-markdownarea-fullscreen");
var wrap = editor.getWrapperElement();
if(editor.markdownarea.markdownarea.hasClass("uk-markdownarea-fullscreen")) {
editor.state.fullScreenRestore = {scrollTop: window.pageYOffset, scrollLeft: window.pageXOffset, width: wrap.style.width, height: wrap.style.height};
wrap.style.width = "";
wrap.style.height = editor.markdownarea.content.height()+"px";
document.documentElement.style.overflow = "hidden";
} else {
document.documentElement.style.overflow = "";
var info = editor.state.fullScreenRestore;
wrap.style.width = info.width; wrap.style.height = info.height;
window.scrollTo(info.scrollLeft, info.scrollTop);
}
editor.refresh();
editor.markdownarea.preview.parent().css("height", editor.markdownarea.code.height());
}
},
"bold" : {
"title" : "Bold",
"label" : '<i class="uk-icon-bold"></i>',
"shortcut": ['Ctrl-B', 'Cmd-B'],
"action" : function(editor){
baseReplacer("**$1**", editor);
}
},
"italic" : {
"title" : "Italic",
"label" : '<i class="uk-icon-italic"></i>',
"action" : function(editor){
baseReplacer("*$1*", editor);
}
},
"strike" : {
"title" : "Strikethrough",
"label" : '<i class="uk-icon-strikethrough"></i>',
"action" : function(editor){
baseReplacer("~~$1~~", editor);
}
},
"blockquote" : {
"title" : "Blockquote",
"label" : '<i class="uk-icon-quote-right"></i>',
"action" : function(editor){
baseReplacer("> $1", editor);
}
},
"link" : {
"title" : "Link",
"label" : '<i class="uk-icon-link"></i>',
"action" : function(editor){
baseReplacer("[$1](http://)", editor);
}
},
"picture" : {
"title" : "Picture",
"label" : '<i class="uk-icon-picture-o"></i>',
"action" : function(editor){
baseReplacer("![$1](http://)", editor);
}
},
"listUl" : {
"title" : "Unordered List",
"label" : '<i class="uk-icon-list-ul"></i>',
"action" : function(editor){
baseReplacer("* $1", editor);
}
},
"listOl" : {
"title" : "Ordered List",
"label" : '<i class="uk-icon-list-ol"></i>',
"action" : function(editor){
baseReplacer("1. $1", editor);
}
}
}
Markdownarea.defaults = {
"mode" : "split",
"height" : 500,
"maxsplitsize" : 1000,
"codemirror" : { mode: 'gfm', tabMode: 'indent', tabindex: "2", lineWrapping: true, dragDrop: false },
"toolbar" : [ "bold", "italic", "strike", "link", "picture", "blockquote", "listUl", "listOl" ],
"lblPreview" : "Preview",
"lblCodeview" : "Markdown"
};
Markdownarea.template = '<div class="uk-markdownarea uk-clearfix" data-mode="split">' +
'<div class="uk-markdownarea-navbar">' +
'<ul class="uk-markdownarea-navbar-nav uk-markdownarea-toolbar"></ul>' +
'<div class="uk-markdownarea-navbar-flip">' +
'<ul class="uk-markdownarea-navbar-nav">' +
'<li class="uk-markdown-button-markdown"><a>{:lblCodeview}</a></li>' +
'<li class="uk-markdown-button-preview"><a>{:lblPreview}</a></li>' +
'<li><a data-markdownarea-cmd="fullscreen"><i class="uk-icon-expand"></i></a></li>' +
'</ul>' +
'</div>' +
'</div>' +
'<div class="uk-markdownarea-content">' +
'<div class="uk-markdownarea-code"></div>' +
'<div class="uk-markdownarea-preview"><div></div></div>' +
'</div>' +
'</div>';
Markdownarea.plugins = {};
Markdownarea.addPlugin = function(name, identifier, callback) {
Markdownarea.plugins[name] = {"identifier":identifier, "cb":callback};
};
UI["markdownarea"] = Markdownarea;
// init code
$(function() {
$("textarea[data-uk-markdownarea]").each(function() {
var area = $(this), obj;
if (!area.data("markdownarea")) {
obj = new Markdownarea(area, UI.Utils.options(area.attr("data-uk-markdownarea")));
}
});
});
return Markdownarea;
});
+3
View File
@@ -0,0 +1,3 @@
/*! UIkit 2.5.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
(function(t){"function"==typeof define&&define.amd&&define("uikit-markdownarea",["uikit"],function(){return jQuery.UIkit.markdownarea||t(window,window.jQuery,window.jQuery.UIkit)}),window&&window.jQuery&&window.jQuery.UIkit&&t(window,window.jQuery,window.jQuery.UIkit)})(function(t,e,i){var n=function(t,i){var o=e(t);o.data("markdownarea")||(this.element=o,this.options=e.extend({},n.defaults,i),this.marked=this.options.marked||marked,this.CodeMirror=this.options.CodeMirror||CodeMirror,this.marked.setOptions({gfm:!0,tables:!0,breaks:!0,pedantic:!1,sanitize:!1,smartLists:!0,smartypants:!1,langPrefix:"lang-"}),this.init(),this.element.data("markdownarea",this))};e.extend(n.prototype,{init:function(){var t=this,o=n.template;o=o.replace(/\{\:lblPreview\}/g,this.options.lblPreview),o=o.replace(/\{\:lblCodeview\}/g,this.options.lblCodeview),this.markdownarea=e(o),this.content=this.markdownarea.find(".uk-markdownarea-content"),this.toolbar=this.markdownarea.find(".uk-markdownarea-toolbar"),this.preview=this.markdownarea.find(".uk-markdownarea-preview").children().eq(0),this.code=this.markdownarea.find(".uk-markdownarea-code"),this.element.before(this.markdownarea).appendTo(this.code),this.editor=this.CodeMirror.fromTextArea(this.element[0],this.options.codemirror),this.editor.markdownarea=this,this.editor.on("change",function(){var e=function(){var e=t.editor.getValue();t.currentvalue=e+"",t.element.trigger("markdownarea-before",[t]),t.applyPlugins(),t.marked(t.currentvalue,function(e,i){if(e)throw e;t.preview.html(i),t.element.val(t.editor.getValue()).trigger("markdownarea-update",[t])})};return e(),i.Utils.debounce(e,150)}()),this.code.find(".CodeMirror").css("height",this.options.height),this._buildtoolbar(),this.fit(),e(window).on("resize",i.Utils.debounce(function(){t.fit()},200));var s=t.preview.parent(),a=this.code.find(".CodeMirror-sizer"),r=this.code.find(".CodeMirror-scroll").on("scroll",i.Utils.debounce(function(){if("tab"!=t.markdownarea.attr("data-mode")){var e=a.height()-r.height(),i=s[0].scrollHeight-s.height(),n=i/e,o=r.scrollTop()*n;s.scrollTop(o)}},10));this.markdownarea.on("click",".uk-markdown-button-markdown, .uk-markdown-button-preview",function(i){i.preventDefault(),"tab"==t.markdownarea.attr("data-mode")&&(t.markdownarea.find(".uk-markdown-button-markdown, .uk-markdown-button-preview").removeClass("uk-active").filter(this).addClass("uk-active"),t.activetab=e(this).hasClass("uk-markdown-button-markdown")?"code":"preview",t.markdownarea.attr("data-active-tab",t.activetab))}),this.preview.parent().css("height",this.code.height())},applyPlugins:function(){var t=this,e=Object.keys(n.plugins),i=n.plugins;if(this.markers={},e.length){var o=this.currentvalue.split("\n");e.forEach(function(t){this.markers[t]=[]},this);for(var s=0,a=o.length;a>s;s++)(function(n){e.forEach(function(e){var s=0;o[n]=o[n].replace(i[e].identifier,function(){var o=i[e].cb({area:t,found:arguments,line:n,pos:s++,uid:[e,n,s,(new Date).getTime()+"RAND"+Math.ceil(1e5*Math.random())].join("-"),replace:function(t){var e=this.area.editor.getLine(this.line),i=e.indexOf(this.found[0]);end=this.found[0].length,this.area.editor.replaceRange(t,{line:this.line,ch:i},{line:this.line,ch:end})}});return o})})})(s);this.currentvalue=o.join("\n")}},_buildtoolbar:function(){if(this.options.toolbar&&this.options.toolbar.length){var t=this,i=[];this.options.toolbar.forEach(function(e){if(n.commands[e]){var o=n.commands[e].title?n.commands[e].title:e;i.push('<li><a data-markdownarea-cmd="'+e+'" title="'+o+'" data-uk-tooltip>'+n.commands[e].label+"</a></li>"),n.commands[e].shortcut&&t.registerShortcut(n.commands[e].shortcut,n.commands[e].action)}}),this.toolbar.html(i.join("\n")),this.markdownarea.on("click","a[data-markdownarea-cmd]",function(){var i=e(this).data("markdownareaCmd");!i||!n.commands[i]||t.activetab&&"code"!=t.activetab&&"fullscreen"!=i||n.commands[i].action.apply(t,[t.editor])})}},fit:function(){var t=this.options.mode;"split"==t&&this.markdownarea.width()<this.options.maxsplitsize&&(t="tab"),"tab"==t&&(this.activetab||(this.activetab="code",this.markdownarea.attr("data-active-tab",this.activetab)),this.markdownarea.find(".uk-markdown-button-markdown, .uk-markdown-button-preview").removeClass("uk-active").filter("code"==this.activetab?".uk-markdown-button-markdown":".uk-markdown-button-preview").addClass("uk-active")),this.editor.refresh(),this.preview.parent().css("height",this.code.height()),this.markdownarea.attr("data-mode",t)},registerShortcut:function(t,i){var n=this;t=e.isArray(t)?t:[t];for(var o=0,s=t.length;s>o;o++){var a={};a[t[o]]=function(){i.apply(n,[n.editor])},n.editor.addKeyMap(a)}}}),e.fn.markdownarea=function(t){return this.each(function(){var i=e(this);i.data("markdownarea")||new n(i,t)})};var o=function(t,e){var i=e.getSelection(),n=t.replace("$1",i);e.replaceSelection(n,"end")};return n.commands={fullscreen:{title:"Fullscreen",label:'<i class="uk-icon-expand"></i>',action:function(t){t.markdownarea.markdownareaLine truncated
+177
View File
@@ -0,0 +1,177 @@
/*! UIkit 2.5.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
(function(addon) {
if (typeof define == "function" && define.amd) { // AMD
define("uikit-notify", ["uikit"], function(){
return jQuery.UIkit.notify || addon(window, window.jQuery, window.jQuery.UIkit);
});
}
if(window && window.jQuery && window.jQuery.UIkit) {
addon(window, window.jQuery, window.jQuery.UIkit);
}
})(function(global, $, UI){
var containers = {},
messages = {},
notify = function(options){
if ($.type(options) == 'string') {
options = { message: options };
}
if (arguments[1]) {
options = $.extend(options, $.type(arguments[1]) == 'string' ? {status:arguments[1]} : arguments[1]);
}
return (new Message(options)).show();
},
closeAll = function(group, instantly){
if(group) {
for(var id in messages) { if(group===messages[id].group) messages[id].close(instantly); }
} else {
for(var id in messages) { messages[id].close(instantly); }
}
};
var Message = function(options){
var $this = this;
this.options = $.extend({}, Message.defaults, options);
this.uuid = "ID"+(new Date().getTime())+"RAND"+(Math.ceil(Math.random() * 100000));
this.element = $([
'<div class="uk-notify-message">',
'<a class="uk-close"></a>',
'<div>'+this.options.message+'</div>',
'</div>'
].join('')).data("notifyMessage", this);
// status
if (this.options.status) {
this.element.addClass('uk-notify-message-'+this.options.status);
this.currentstatus = this.options.status;
}
this.group = this.options.group;
messages[this.uuid] = this;
if(!containers[this.options.pos]) {
containers[this.options.pos] = $('<div class="uk-notify uk-notify-'+this.options.pos+'"></div>').appendTo('body').on("click", ".uk-notify-message", function(){
$(this).data("notifyMessage").close();
});
}
};
$.extend(Message.prototype, {
uuid: false,
element: false,
timout: false,
currentstatus: "",
group: false,
show: function() {
if (this.element.is(":visible")) return;
var $this = this;
containers[this.options.pos].show().prepend(this.element);
var marginbottom = parseInt(this.element.css("margin-bottom"), 10);
this.element.css({"opacity":0, "margin-top": -1*this.element.outerHeight(), "margin-bottom":0}).animate({"opacity":1, "margin-top": 0, "margin-bottom":marginbottom}, function(){
if ($this.options.timeout) {
var closefn = function(){ $this.close(); };
$this.timeout = setTimeout(closefn, $this.options.timeout);
$this.element.hover(
function() { clearTimeout($this.timeout); },
function() { $this.timeout = setTimeout(closefn, $this.options.timeout); }
);
}
});
return this;
},
close: function(instantly) {
var $this = this,
finalize = function(){
$this.element.remove();
if(!containers[$this.options.pos].children().length) {
containers[$this.options.pos].hide();
}
delete messages[$this.uuid];
};
if(this.timeout) clearTimeout(this.timeout);
if(instantly) {
finalize();
} else {
this.element.animate({"opacity":0, "margin-top": -1* this.element.outerHeight(), "margin-bottom":0}, function(){
finalize();
});
}
},
content: function(html){
var container = this.element.find(">div");
if(!html) {
return container.html();
}
container.html(html);
return this;
},
status: function(status) {
if(!status) {
return this.currentstatus;
}
this.element.removeClass('uk-notify-message-'+this.currentstatus).addClass('uk-notify-message-'+status);
this.currentstatus = status;
return this;
}
});
Message.defaults = {
message: "",
status: "",
timeout: 5000,
group: null,
pos: 'top-center'
};
UI["notify"] = notify;
UI["notify"].message = Message;
UI["notify"].closeAll = closeAll;
return notify;
});
+3
View File
@@ -0,0 +1,3 @@
/*! UIkit 2.5.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
(function(t){"function"==typeof define&&define.amd&&define("uikit-notify",["uikit"],function(){return jQuery.UIkit.notify||t(window,window.jQuery,window.jQuery.UIkit)}),window&&window.jQuery&&window.jQuery.UIkit&&t(window,window.jQuery,window.jQuery.UIkit)})(function(t,e,i){var n={},s={},o=function(t){return"string"==e.type(t)&&(t={message:t}),arguments[1]&&(t=e.extend(t,"string"==e.type(arguments[1])?{status:arguments[1]}:arguments[1])),new r(t).show()},a=function(t,e){if(t)for(var i in s)t===s[i].group&&s[i].close(e);else for(var i in s)s[i].close(e)},r=function(t){this.options=e.extend({},r.defaults,t),this.uuid="ID"+(new Date).getTime()+"RAND"+Math.ceil(1e5*Math.random()),this.element=e(['<div class="uk-notify-message">','<a class="uk-close"></a>',"<div>"+this.options.message+"</div>","</div>"].join("")).data("notifyMessage",this),this.options.status&&(this.element.addClass("uk-notify-message-"+this.options.status),this.currentstatus=this.options.status),this.group=this.options.group,s[this.uuid]=this,n[this.options.pos]||(n[this.options.pos]=e('<div class="uk-notify uk-notify-'+this.options.pos+'"></div>').appendTo("body").on("click",".uk-notify-message",function(){e(this).data("notifyMessage").close()}))};return e.extend(r.prototype,{uuid:!1,element:!1,timout:!1,currentstatus:"",group:!1,show:function(){if(!this.element.is(":visible")){var t=this;n[this.options.pos].show().prepend(this.element);var e=parseInt(this.element.css("margin-bottom"),10);return this.element.css({opacity:0,"margin-top":-1*this.element.outerHeight(),"margin-bottom":0}).animate({opacity:1,"margin-top":0,"margin-bottom":e},function(){if(t.options.timeout){var e=function(){t.close()};t.timeout=setTimeout(e,t.options.timeout),t.element.hover(function(){clearTimeout(t.timeout)},function(){t.timeout=setTimeout(e,t.options.timeout)})}}),this}},close:function(t){var e=this,i=function(){e.element.remove(),n[e.options.pos].children().length||n[e.options.pos].hide(),delete s[e.uuid]};this.timeout&&clearTimeout(this.timeout),t?i():this.element.animate({opacity:0,"margin-top":-1*this.element.outerHeight(),"margin-bottom":0},function(){i()})},content:function(t){var e=this.element.find(">div");return t?(e.html(t),this):e.html()},status:function(t){return t?(this.element.removeClass("uk-notify-message-"+this.currentstatus).addClass("uk-notify-message-"+t),this.currentstatus=t,this):this.currentstatus}}),r.defaults={message:"",status:"",timeout:5e3,group:null,pos:"top-center"},i.notify=o,i.notify.message=r,i.notify.closeAll=a,o});
+94
View File
@@ -0,0 +1,94 @@
/*! UIkit 2.5.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
(function(addon) {
if (typeof define == "function" && define.amd) { // AMD
define("uikit-search", ["uikit"], function(){
return jQuery.UIkit.search || addon(window, window.jQuery, window.jQuery.UIkit);
});
}
if(window && window.jQuery && window.jQuery.UIkit) {
addon(window, window.jQuery, window.jQuery.UIkit);
}
})(function(global, $, UI){
"use strict";
var Search = function(element, options) {
var $element = $(element), $this = this;
if ($element.data("search")) return;
this.autocomplete = new UI.autocomplete($element, $.extend({}, Search.defaults, options));
this.autocomplete.dropdown.addClass('uk-dropdown-search');
this.autocomplete.input.on("keyup", function(){
$element[this.value ? "addClass":"removeClass"]("uk-active");
}).closest("form").on("reset", function(){
this.value="";
$element.removeClass("uk-active");
});
$element.on('autocomplete-select', function(e, data) {
if (data.url) {
location.href = data.url;
} else if(data.moreresults) {
$this.autocomplete.input.closest('form').submit();
}
});
$element.data("search", this);
};
Search.defaults = {
msgResultsHeader : 'Search Results',
msgMoreResults : 'More Results',
msgNoResults : 'No results found',
template : '<ul class="uk-nav uk-nav-search uk-autocomplete-results">\
{{#msgResultsHeader}}<li class="uk-nav-header uk-skip">{{msgResultsHeader}}</li>{{/msgResultsHeader}}\
{{#items && items.length}}\
{{~items}}\
<li data-url="{{!$item.url}}">\
<a href="{{!$item.url}}">\
{{$item.title}}\
{{#$item.text}}<div>{{{$item.text}}}</div>{{/$item.text}}\
</a>\
</li>\
{{/items}}\
{{#msgMoreResults}}\
<li class="uk-nav-divider uk-skip"></li>\
<li class="uk-search-moreresults" data-moreresults="true"><a href="javascript:jQuery(this).closest(\'form\').submit();">{{msgMoreResults}}</a></li>\
{{/msgMoreResults}}\
{{/end}}\
{{^items.length}}\
{{#msgNoResults}}<li class="uk-skip"><a>{{msgNoResults}}</a></li>{{/msgNoResults}}\
{{/end}}\
</ul>',
renderer: function(data) {
var $this = this, opts = this.options;
this.dropdown.append(this.template({"items":data.results || [], "msgResultsHeader":opts.msgResultsHeader, "msgMoreResults": opts.msgMoreResults, "msgNoResults": opts.msgNoResults}));
this.show();
}
};
UI["search"] = Search;
// init code
$(document).on("focus.search.uikit", "[data-uk-search]", function(e) {
var ele = $(this);
if (!ele.data("search")) {
var obj = new Search(ele, UI.Utils.options(ele.attr("data-uk-search")));
}
});
return Search;
});
+3
View File
@@ -0,0 +1,3 @@
/*! UIkit 2.5.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
(function(t){"function"==typeof define&&define.amd&&define("uikit-search",["uikit"],function(){return jQuery.UIkit.search||t(window,window.jQuery,window.jQuery.UIkit)}),window&&window.jQuery&&window.jQuery.UIkit&&t(window,window.jQuery,window.jQuery.UIkit)})(function(t,e,i){"use strict";var n=function(t,s){var o=e(t),a=this;o.data("search")||(this.autocomplete=new i.autocomplete(o,e.extend({},n.defaults,s)),this.autocomplete.dropdown.addClass("uk-dropdown-search"),this.autocomplete.input.on("keyup",function(){o[this.value?"addClass":"removeClass"]("uk-active")}).closest("form").on("reset",function(){this.value="",o.removeClass("uk-active")}),o.on("autocomplete-select",function(t,e){e.url?location.href=e.url:e.moreresults&&a.autocomplete.input.closest("form").submit()}),o.data("search",this))};return n.defaults={msgResultsHeader:"Search Results",msgMoreResults:"More Results",msgNoResults:"No results found",template:'<ul class="uk-nav uk-nav-search uk-autocomplete-results"> {{#msgResultsHeader}}<li class="uk-nav-header uk-skip">{{msgResultsHeader}}</li>{{/msgResultsHeader}} {{#items && items.length}} {{~items}} <li data-url="{{!$item.url}}"> <a href="{{!$item.url}}"> {{$item.title}} {{#$item.text}}<div>{{{$item.text}}}</div>{{/$item.text}} </a> </li> {{/items}} {{#msgMoreResults}} <li class="uk-nav-divider uk-skip"></li> <li class="uk-search-moreresults" data-moreresults="true"><a href="javascript:jQuery(this).closest(\'form\').submit();">{{msgMoreResults}}</a></li> {{/msgMoreResults}} {{/end}} {{^items.length}} {{#msgNoResults}}<li class="uk-skip"><a>{{msgNoResults}}</a></li>{{/msgNoResults}} {{/end}} </ul>',renderer:function(t){var e=this.options;this.dropdown.append(this.template({items:t.results||[],msgResultsHeader:e.msgResultsHeader,msgMoreResults:e.msgMoreResults,msgNoResults:e.msgNoResults})),this.show()}},i.search=n,e(document).on("focus.search.uikit","[data-uk-search]",function(){var t=e(this);t.data("search")||new n(t,i.Utils.options(t.attr("data-uk-search")))}),n});
+606
View File
@@ -0,0 +1,606 @@
/*! UIkit 2.5.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
/*
* Based on Nestable jQuery Plugin - Copyright (c) 2012 David Bushell - http://dbushell.com/
*/
(function(addon) {
if (typeof define == "function" && define.amd) { // AMD
define("uikit-sortable", ["uikit"], function(){
return jQuery.fn.uksortable || addon(window.jQuery, jQuery.UIkit, window, document);
});
}
if(window && window.jQuery && window.jQuery.UIkit) {
addon(window.jQuery, jQuery.UIkit, window, document);
}
})(function($, UI, window, document, undefined) {
var hasTouch = 'ontouchstart' in window,
html = $("html"),
touchedlists = [];
/**
* Detect CSS pointer-events property
* events are normally disabled on the dragging element to avoid conflicts
* https://github.com/ausi/Feature-detection-technique-for-pointer-events/blob/master/modernizr-pointerevents.js
*/
var hasPointerEvents = (function()
{
var el = document.createElement('div'),
docEl = document.documentElement;
if (!('pointerEvents' in el.style)) {
return false;
}
el.style.pointerEvents = 'auto';
el.style.pointerEvents = 'x';
docEl.appendChild(el);
var supports = window.getComputedStyle && window.getComputedStyle(el, '').pointerEvents === 'auto';
docEl.removeChild(el);
return !!supports;
})();
var eStart = hasTouch ? 'touchstart' : 'mousedown',
eMove = hasTouch ? 'touchmove' : 'mousemove',
eEnd = hasTouch ? 'touchend' : 'mouseup',
eCancel = hasTouch ? 'touchcancel' : 'mouseup';
function Plugin(element, options)
{
var $element = $(element);
if($element.data("uksortable")) return;
this.w = $(window);
this.el = $element;
this.options = $.extend({}, $.fn.uksortable.defaults, options);
this.tplempty = '<div class="' + this.options.emptyClass + '"/>';
this.el.find(">"+this.options.itemNodeName).addClass(this.options.listitemClass).end().find("ul:not(.ignore-list)").addClass(this.options.listClass).find(">li").addClass(this.options.listitemClass);
if(!this.el.children(this.options.itemNodeName).length) {
this.el.append(this.tplempty);
}
this.el.data("uksortable", this);
this.el.data("uksortable-id", "ID"+(new Date().getTime())+"RAND"+(Math.ceil(Math.random() *100000)));
this.init();
}
Plugin.prototype = {
init: function()
{
var list = this;
list.reset();
list.el.data('uksortable-group', this.options.group);
list.placeEl = $('<div class="' + list.options.placeClass + '"/>');
$.each(this.el.find(list.options.itemNodeName), function(k, el)
{
list.setParent($(el));
});
list.el.on('click', '[data-sortable-action]', function(e)
{
if (list.dragEl || (!hasTouch && e.button !== 0)) {
return;
}
e.preventDefault();
var target = $(e.currentTarget),
action = target.data('sortableAction'),
item = target.closest(list.options.itemNodeName);
if (action === 'collapse') {
list.collapseItem(item);
}
if (action === 'expand') {
list.expandItem(item);
}
if (action === 'toggle') {
list.toggleItem(item);
}
});
var onStartEvent = function(e)
{
var handle = $(e.target);
if (!handle.hasClass(list.options.handleClass)) {
if (handle.closest('.' + list.options.noDragClass).length) {
return;
}
handle = handle.closest('.' + list.options.handleClass);
}
if (!handle.length || list.dragEl || (!hasTouch && e.button !== 0) || (hasTouch && e.touches.length !== 1)) {
return;
}
e.preventDefault();
list.dragStart(hasTouch ? e.touches[0] : e);
};
var onMoveEvent = function(e)
{
if (list.dragEl) {
e.preventDefault();
list.dragMove(hasTouch ? e.touches[0] : e);
}
};
var onEndEvent = function(e)
{
if (list.dragEl) {
e.preventDefault();
list.dragStop(hasTouch ? e.touches[0] : e);
}
};
if (hasTouch) {
list.el[0].addEventListener(eStart, onStartEvent, false);
window.addEventListener(eMove, onMoveEvent, false);
window.addEventListener(eEnd, onEndEvent, false);
window.addEventListener(eCancel, onEndEvent, false);
} else {
list.el.on(eStart, onStartEvent);
list.w.on(eMove, onMoveEvent);
list.w.on(eEnd, onEndEvent);
}
},
serialize: function()
{
var data,
depth = 0,
list = this;
step = function(level, depth)
{
var array = [ ],
items = level.children(list.options.itemNodeName);
items.each(function()
{
var li = $(this),
item = $.extend({}, li.data()),
sub = li.children(list.options.listNodeName);
if (sub.length) {
item.children = step(sub, depth + 1);
}
array.push(item);
});
return array;
};
data = step(list.el, depth);
return data;
},
list: function(options)
{
var data = [],
list = this,
depth = 0,
options = $.extend({}, list.options, options),
step = function(level, depth, parent)
{
var items = level.children(options.itemNodeName);
items.each(function(index)
{
var li = $(this),
item = $.extend({parent_id: (parent ? parent : null), depth: depth, order: index}, li.data()),
sub = li.children(options.listNodeName);
data.push(item);
if (sub.length) {
step(sub, depth + 1, li.data(options.idProperty || 'id'));
}
});
};
step(list.el, depth);
return data;
},
reset: function()
{
this.mouse = {
offsetX : 0,
offsetY : 0,
startX : 0,
startY : 0,
lastX : 0,
lastY : 0,
nowX : 0,
nowY : 0,
distX : 0,
distY : 0,
dirAx : 0,
dirX : 0,
dirY : 0,
lastDirX : 0,
lastDirY : 0,
distAxX : 0,
distAxY : 0
};
this.moving = false;
this.dragEl = null;
this.dragRootEl = null;
this.dragDepth = 0;
this.hasNewRoot = false;
this.pointEl = null;
for(var i=0; i<touchedlists.length; i++) {
if(!touchedlists[i].children().length) {
touchedlists[i].append(this.tplempty);
}
}
touchedlists = [];
},
toggleItem: function(li) {
this[li.hasClass(this.options.collapsedClass) ? "expandItem":"collapseItem"](li);
},
expandItem: function(li)
{
li.removeClass(this.options.collapsedClass);
},
collapseItem: function(li)
{
var lists = li.children(this.options.listNodeName);
if (lists.length) {
li.addClass(this.options.collapsedClass);
}
},
expandAll: function()
{
var list = this;
list.el.find(list.options.itemNodeName).each(function()
{
list.expandItem($(this));
});
},
collapseAll: function()
{
var list = this;
list.el.find(list.options.itemNodeName).each(function()
{
list.collapseItem($(this));
});
},
setParent: function(li)
{
if (li.children(this.options.listNodeName).length) {
li.addClass("uk-parent");
}
},
unsetParent: function(li)
{
li.removeClass('uk-parent '+this.options.collapsedClass);
li.children(this.options.listNodeName).remove();
},
dragStart: function(e)
{
var mouse = this.mouse,
target = $(e.target),
dragItem = target.closest(this.options.itemNodeName),
offset = dragItem.offset();
this.placeEl.css('height', dragItem.height());
mouse.offsetX = e.pageX - offset.left;
mouse.offsetY = e.pageY - offset.top;
mouse.startX = mouse.lastX = offset.left;
mouse.startY = mouse.lastY = offset.top;
this.dragRootEl = this.el;
this.dragEl = $(document.createElement(this.options.listNodeName)).addClass(this.options.listClass + ' ' + this.options.dragClass);
this.dragEl.css('width', dragItem.width());
this.tmpDragOnSiblings = [dragItem[0].previousSibling, dragItem[0].nextSibling];
// fix for zepto.js
//dragItem.after(this.placeEl).detach().appendTo(this.dragEl);
dragItem.after(this.placeEl);
dragItem[0].parentNode.removeChild(dragItem[0]);
dragItem.appendTo(this.dragEl);
$(document.body).append(this.dragEl);
this.dragEl.css({
left : offset.left,
top : offset.top
});
// total depth of dragging item
var i, depth,
items = this.dragEl.find(this.options.itemNodeName);
for (i = 0; i < items.length; i++) {
depth = $(items[i]).parents(this.options.listNodeName).length;
if (depth > this.dragDepth) {
this.dragDepth = depth;
}
}
html.addClass(this.options.movingClass);
},
dragStop: function(e)
{
// fix for zepto.js
//this.placeEl.replaceWith(this.dragEl.children(this.options.itemNodeName + ':first').detach());
var el = this.dragEl.children(this.options.itemNodeName).first();
el[0].parentNode.removeChild(el[0]);
this.placeEl.replaceWith(el);
this.dragEl.remove();
if (this.tmpDragOnSiblings[0]!=el[0].previousSibling || this.tmpDragOnSiblings[0]!=el[0].previousSibling) {
this.el.trigger('sortable-change',[el, this.hasNewRoot ? "added":"moved"]);
if (this.hasNewRoot) {
this.dragRootEl.trigger('sortable-change', [el, "removed"]);
}
}
this.reset();
html.removeClass(this.options.movingClass);
},
dragMove: function(e)
{
var list, parent, prev, next, depth,
opt = this.options,
mouse = this.mouse;
this.dragEl.css({
left : e.pageX - mouse.offsetX,
top : e.pageY - mouse.offsetY
});
// mouse position last events
mouse.lastX = mouse.nowX;
mouse.lastY = mouse.nowY;
// mouse position this events
mouse.nowX = e.pageX;
mouse.nowY = e.pageY;
// distance mouse moved between events
mouse.distX = mouse.nowX - mouse.lastX;
mouse.distY = mouse.nowY - mouse.lastY;
// direction mouse was moving
mouse.lastDirX = mouse.dirX;
mouse.lastDirY = mouse.dirY;
// direction mouse is now moving (on both axis)
mouse.dirX = mouse.distX === 0 ? 0 : mouse.distX > 0 ? 1 : -1;
mouse.dirY = mouse.distY === 0 ? 0 : mouse.distY > 0 ? 1 : -1;
// axis mouse is now moving on
var newAx = Math.abs(mouse.distX) > Math.abs(mouse.distY) ? 1 : 0;
// do nothing on first move
if (!mouse.moving) {
mouse.dirAx = newAx;
mouse.moving = true;
return;
}
// calc distance moved on this axis (and direction)
if (mouse.dirAx !== newAx) {
mouse.distAxX = 0;
mouse.distAxY = 0;
} else {
mouse.distAxX += Math.abs(mouse.distX);
if (mouse.dirX !== 0 && mouse.dirX !== mouse.lastDirX) {
mouse.distAxX = 0;
}
mouse.distAxY += Math.abs(mouse.distY);
if (mouse.dirY !== 0 && mouse.dirY !== mouse.lastDirY) {
mouse.distAxY = 0;
}
}
mouse.dirAx = newAx;
/**
* move horizontal
*/
if (mouse.dirAx && mouse.distAxX >= opt.threshold) {
// reset move distance on x-axis for new phase
mouse.distAxX = 0;
prev = this.placeEl.prev(opt.itemNodeName);
// increase horizontal level if previous sibling exists and is not collapsed
if (mouse.distX > 0 && prev.length && !prev.hasClass(opt.collapsedClass)) {
// cannot increase level when item above is collapsed
list = prev.find(opt.listNodeName).last();
// check if depth limit has reached
depth = this.placeEl.parents(opt.listNodeName).length;
if (depth + this.dragDepth <= opt.maxDepth) {
// create new sub-level if one doesn't exist
if (!list.length) {
list = $('<' + opt.listNodeName + '/>').addClass(opt.listClass);
list.append(this.placeEl);
prev.append(list);
this.setParent(prev);
} else {
// else append to next level up
list = prev.children(opt.listNodeName).last();
list.append(this.placeEl);
}
}
}
// decrease horizontal level
if (mouse.distX < 0) {
// we can't decrease a level if an item preceeds the current one
next = this.placeEl.next(opt.itemNodeName);
if (!next.length) {
parent = this.placeEl.parent();
this.placeEl.closest(opt.itemNodeName).after(this.placeEl);
if (!parent.children().length) {
this.unsetParent(parent.parent());
}
}
}
}
var isEmpty = false;
// find list item under cursor
if (!hasPointerEvents) {
this.dragEl[0].style.visibility = 'hidden';
}
this.pointEl = $(document.elementFromPoint(e.pageX - document.body.scrollLeft, e.pageY - (window.pageYOffset || document.documentElement.scrollTop)));
if (!hasPointerEvents) {
this.dragEl[0].style.visibility = 'visible';
}
if (this.pointEl.hasClass(opt.handleClass)) {
this.pointEl = this.pointEl.closest(opt.itemNodeName);
} else {
var sortableitem = this.pointEl.closest('.'+opt.itemClass);
if(sortableitem.length) {
this.pointEl = sortableitem.closest(opt.itemNodeName);
}
}
if (this.pointEl.hasClass(opt.emptyClass)) {
isEmpty = true;
}
else if (this.pointEl.data('uksortable') && !this.pointEl.children().length) {
isEmpty = true;
this.pointEl = $(this.tplempty).appendTo(this.pointEl);
}
else if (!this.pointEl.length || !this.pointEl.hasClass(opt.listitemClass)) {
return;
}
// find parent list of item under cursor
var pointElRoot = this.el,
tmpRoot = this.pointEl.closest('.'+this.options.listBaseClass),
isNewRoot = pointElRoot[0] !== this.pointEl.closest('.'+this.options.listBaseClass)[0],
$newRoot = tmpRoot;
/**
* move vertical
*/
if (!mouse.dirAx || isNewRoot || isEmpty) {
// check if groups match if dragging over new root
if (isNewRoot && opt.group !== $newRoot.data('uksortable-group')) {
return;
} else {
touchedlists.push(pointElRoot);
}
// check depth limit
depth = this.dragDepth - 1 + this.pointEl.parents(opt.listNodeName).length;
if (depth > opt.maxDepth) {
return;
}
var before = e.pageY < (this.pointEl.offset().top + this.pointEl.height() / 2);
parent = this.placeEl.parent();
// if empty create new list to replace empty placeholder
if (isEmpty) {
this.pointEl.replaceWith(this.placeEl);
}
else if (before) {
this.pointEl.before(this.placeEl);
}
else {
this.pointEl.after(this.placeEl);
}
if (!parent.children().length) {
if(!parent.data("uksortable")) this.unsetParent(parent.parent());
}
if (!this.dragRootEl.find(opt.itemNodeName).length && !this.dragRootEl.children().length) {
this.dragRootEl.append(this.tplempty);
}
// parent root list has changed
if (isNewRoot) {
this.dragRootEl = tmpRoot;
this.hasNewRoot = this.el[0] !== this.dragRootEl[0];
}
}
}
};
$.fn.uksortable = function(params)
{
var lists = this,
retval = this;
lists.each(function()
{
var element = $(this),
plugin = element.data("uksortable");
if (!plugin) {
plugin = new Plugin(element, params);
} else {
if (typeof params === 'string' && typeof plugin[params] === 'function') {
retval = plugin[params]();
}
}
});
return retval || lists;
};
$.fn.uksortable.defaults = {
prefix : 'uk',
listNodeName : 'ul',
itemNodeName : 'li',
listBaseClass : '{prefix}-sortable',
listClass : '{prefix}-sortable-list',
listitemClass : '{prefix}-sortable-list-item',
itemClass : '{prefix}-sortable-item',
dragClass : '{prefix}-sortable-list-dragged',
movingClass : '{prefix}-sortable-moving',
handleClass : '{prefix}-sortable-handle',
collapsedClass : '{prefix}-collapsed',
placeClass : '{prefix}-sortable-placeholder',
noDragClass : '{prefix}-sortable-nodrag',
emptyClass : '{prefix}-sortable-empty',
group : 0,
maxDepth : 10,
threshold : 20
};
$(document).on("uk-domready", function(e) {
$("[data-uk-sortable]").each(function(){
var ele = $(this),
options = $.extend({}, $.fn.uksortable.defaults, UI.Utils.options(ele.attr("data-uk-sortable")));
Object.keys(options).forEach(function(key){
if(String(options[key]).indexOf('{prefix}')!=-1) {
options[key] = options[key].replace('{prefix}', options.prefix);
}
});
if(!ele.data("uksortable")) {
ele.uksortable(options);
}
});
});
return $.fn.uksortable;
});
+3
View File
@@ -0,0 +1,3 @@
/*! UIkit 2.5.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
(function(t){"function"==typeof define&&define.amd&&define("uikit-sortable",["uikit"],function(){return jQuery.fn.uksortable||t(window.jQuery,jQuery.UIkit,window,document)}),window&&window.jQuery&&window.jQuery.UIkit&&t(window.jQuery,jQuery.UIkit,window,document)})(function(t,e,i,n){function s(e,n){var s=t(e);s.data("uksortable")||(this.w=t(i),this.el=s,this.options=t.extend({},t.fn.uksortable.defaults,n),this.tplempty='<div class="'+this.options.emptyClass+'"/>',this.el.find(">"+this.options.itemNodeName).addClass(this.options.listitemClass).end().find("ul:not(.ignore-list)").addClass(this.options.listClass).find(">li").addClass(this.options.listitemClass),this.el.children(this.options.itemNodeName).length||this.el.append(this.tplempty),this.el.data("uksortable",this),this.el.data("uksortable-id","ID"+(new Date).getTime()+"RAND"+Math.ceil(1e5*Math.random())),this.init())}var o="ontouchstart"in i,a=t("html"),r=[],l=function(){var t=n.createElement("div"),e=n.documentElement;if(!("pointerEvents"in t.style))return!1;t.style.pointerEvents="auto",t.style.pointerEvents="x",e.appendChild(t);var s=i.getComputedStyle&&"auto"===i.getComputedStyle(t,"").pointerEvents;return e.removeChild(t),!!s}(),u=o?"touchstart":"mousedown",d=o?"touchmove":"mousemove",h=o?"touchend":"mouseup",c=o?"touchcancel":"mouseup";return s.prototype={init:function(){var e=this;e.reset(),e.el.data("uksortable-group",this.options.group),e.placeEl=t('<div class="'+e.options.placeClass+'"/>'),t.each(this.el.find(e.options.itemNodeName),function(i,n){e.setParent(t(n))}),e.el.on("click","[data-sortable-action]",function(i){if(!e.dragEl&&(o||0===i.button)){i.preventDefault();var n=t(i.currentTarget),s=n.data("sortableAction"),a=n.closest(e.options.itemNodeName);"collapse"===s&&e.collapseItem(a),"expand"===s&&e.expandItem(a),"toggle"===s&&e.toggleItem(a)}});var n=function(i){var n=t(i.target);if(!n.hasClass(e.options.handleClass)){if(n.closest("."+e.options.noDragClass).length)return;n=n.closest("."+e.options.handleClass)}!n.length||e.dragEl||!o&&0!==i.button||o&&1!==i.touches.length||(i.preventDefault(),e.dragStart(o?i.touches[0]:i))},s=function(t){e.dragEl&&(t.preventDefault(),e.dragMove(o?t.touches[0]:t))},a=function(t){e.dragEl&&(t.preventDefault(),e.dragStop(o?t.touches[0]:t))};o?(e.el[0].addEventListener(u,n,!1),i.addEventListener(d,s,!1),i.addEventListener(h,a,!1),i.addEventListener(c,a,!1)):(e.el.on(u,n),e.w.on(d,s),e.w.on(h,a))},serialize:function(){var e,i=0,n=this;return step=function(e,i){var s=[],o=e.children(n.options.itemNodeName);return o.each(function(){var e=t(this),o=t.extend({},e.data()),a=e.children(n.options.listNodeName);a.length&&(o.children=step(a,i+1)),s.push(o)}),s},e=step(n.el,i)},list:function(e){var i=[],n=this,s=0,e=t.extend({},n.options,e),o=function(n,s,a){var r=n.children(e.itemNodeName);r.each(function(n){var r=t(this),l=t.extend({parent_id:a?a:null,depth:s,order:n},r.data()),u=r.children(e.listNodeName);i.push(l),u.length&&o(u,s+1,r.data(e.idProperty||"id"))})};return o(n.el,s),i},reset:function(){this.mouse={offsetX:0,offsetY:0,startX:0,startY:0,lastX:0,lastY:0,nowX:0,nowY:0,distX:0,distY:0,dirAx:0,dirX:0,dirY:0,lastDirX:0,lastDirY:0,distAxX:0,distAxY:0},this.moving=!1,this.dragEl=null,this.dragRootEl=null,this.dragDepth=0,this.hasNewRoot=!1,this.pointEl=null;for(var t=0;r.length>t;t++)r[t].children().length||r[t].append(this.tplempty);r=[]},toggleItem:function(t){this[t.hasClass(this.options.collapsedClass)?"expandItem":"collapseItem"](t)},expandItem:function(t){t.removeClass(this.options.collapsedClass)},collapseItem:function(t){var e=t.children(this.options.listNodeName);e.length&&t.addClass(this.options.collapsedClass)},expandAll:function(){var e=this;e.el.find(e.options.itemNodeName).each(function(){e.expandItem(t(this))})},collapseAll:function(){var e=this;e.el.find(e.options.itemNodeName).each(function(){e.collapseItem(t(this))})},setParent:function(t){t.children(this.options.listNodeName).length&&t.addClass("uk-parent")},unsetParent:function(t){t.removeClass("uk-parent "+this.options.collapsedClass),t.children(this.options.listNodeName).remove()},dragStart:function(e){var i=this.mouse,s=t(e.target),o=s.closest(this.options.itemNodeName),r=o.offset();this.placeEl.css("height",o.height()),i.offsetX=e.pageX-r.left,i.offsetY=e.pageY-r.top,i.startX=i.lastX=r.left,i.startY=i.lastY=r.top,this.dragRootEl=this.el,this.dragEl=t(n.createElement(this.options.listNodeName)).addClass(this.options.listClass+" "+this.options.dragClass),this.dragEl.css("width",o.width()),this.tmpDragOnSiblings=[o[0].previousSibling,o[0].nextSibling],o.after(this.placeEl),o[0].parentNode.removeChild(o[0]),o.appendTo(this.dragEl),t(n.body).append(this.dragEl),this.dragEl.css({left:r.left,top:r.top});var l,u,d=this.dragEl.find(this.options.itemNodeName);for(l=0;d.length>l;l++)u=t(d[l]).parents(this.options.listNodeName).length,u>this.dragDepth&&(this.dragDepth=u);a.addClass(this.options.movingClass)},dragStop:function(){var t=this.dragEl.chiLine truncated
+148
View File
@@ -0,0 +1,148 @@
/*! UIkit 2.5.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
(function(addon) {
if (typeof define == "function" && define.amd) { // AMD
define("uikit-sticky", ["uikit"], function(){
return jQuery.fn.uksticky || addon(window, window.jQuery, window.jQuery.UIkit);
});
}
if(window && window.jQuery && window.jQuery.UIkit) {
addon(window, window.jQuery, window.jQuery.UIkit);
}
})(function(global, $, UI){
var defaults = {
top : 0,
bottom : 0,
clsactive : 'uk-active',
clswrapper : 'uk-sticky',
getWidthFrom : ''
},
$window = $(window),
$document = $(document),
sticked = [],
windowHeight = $window.height(),
scroller = function() {
var scrollTop = $window.scrollTop(),
documentHeight = $document.height(),
dwh = documentHeight - windowHeight,
extra = (scrollTop > dwh) ? dwh - scrollTop : 0;
for (var i = 0; i < sticked.length; i++) {
if(!sticked[i].stickyElement.is(":visible")) {
continue;
}
var s = sticked[i], elementTop = s.stickyWrapper.offset().top, etse = elementTop - s.top - extra;
if (scrollTop <= etse) {
if (s.currentTop !== null) {
s.stickyElement.css({"position":"", "top":"", "width":""}).parent().removeClass(s.clsactive);
s.currentTop = null;
}
} else {
var newTop = documentHeight - s.stickyElement.outerHeight() - s.top - s.bottom - scrollTop - extra;
newTop = newTop<0 ? newTop + s.top : s.top;
if (s.currentTop != newTop) {
s.stickyElement.css({"position": "fixed", "top": newTop, "width": s.stickyElement.width()});
if (typeof s.getWidthFrom !== 'undefined') {
s.stickyElement.css('width', $(s.getWidthFrom).width());
}
s.stickyElement.parent().addClass(s.clsactive);
s.currentTop = newTop;
}
}
}
},
resizer = function() {
windowHeight = $window.height();
},
methods = {
init: function(options) {
var o = $.extend({}, defaults, options);
return this.each(function() {
var stickyElement = $(this);
if(stickyElement.data("sticky")) return;
var stickyId = stickyElement.attr('id') || ("s"+Math.ceil(Math.random()*10000)),
wrapper = $('<div></div>').attr('id', 'sticky-'+stickyId).addClass(o.clswrapper);
stickyElement.wrapAll(wrapper);
if (stickyElement.css("float") == "right") {
stickyElement.css({"float":"none"}).parent().css({"float":"right"});
}
stickyElement.data("sticky", true);
var stickyWrapper = stickyElement.parent();
stickyWrapper.css('height', stickyElement.outerHeight());
sticked.push({
top: o.top,
bottom: o.bottom,
stickyElement: stickyElement,
currentTop: null,
stickyWrapper: stickyWrapper,
clsactive: o.clsactive,
getWidthFrom: o.getWidthFrom
});
});
},
update: scroller
};
// should be more efficient than using $window.scroll(scroller) and $window.resize(resizer):
window.addEventListener('scroll', scroller, false);
window.addEventListener('resize', resizer, false);
$.fn.uksticky = function(method) {
if (methods[method]) {
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
} else if (typeof method === 'object' || !method ) {
return methods.init.apply( this, arguments );
} else {
$.error('Method ' + method + ' does not exist on jQuery.sticky');
}
};
$(document).on("uk-domready", function(e) {
setTimeout(function(){
scroller();
$("[data-uk-sticky]").each(function(){
var $ele = $(this);
if(!$ele.data("sticky")) $ele.uksticky(UI.Utils.options($ele.attr('data-uk-sticky')));
});
}, 0);
});
return $.fn.uksticky;
});
+3
View File
@@ -0,0 +1,3 @@
/*! UIkit 2.5.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
(function(t){"function"==typeof define&&define.amd&&define("uikit-sticky",["uikit"],function(){return jQuery.fn.uksticky||t(window,window.jQuery,window.jQuery.UIkit)}),window&&window.jQuery&&window.jQuery.UIkit&&t(window,window.jQuery,window.jQuery.UIkit)})(function(t,e,i){var n={top:0,bottom:0,clsactive:"uk-active",clswrapper:"uk-sticky",getWidthFrom:""},s=e(window),o=e(document),a=[],r=s.height(),l=function(){for(var t=s.scrollTop(),i=o.height(),n=i-r,l=t>n?n-t:0,u=0;a.length>u;u++)if(a[u].stickyElement.is(":visible")){var d=a[u],h=d.stickyWrapper.offset().top,c=h-d.top-l;if(c>=t)null!==d.currentTop&&(d.stickyElement.css({position:"",top:"",width:""}).parent().removeClass(d.clsactive),d.currentTop=null);else{var f=i-d.stickyElement.outerHeight()-d.top-d.bottom-t-l;f=0>f?f+d.top:d.top,d.currentTop!=f&&(d.stickyElement.css({position:"fixed",top:f,width:d.stickyElement.width()}),d.getWidthFrom!==void 0&&d.stickyElement.css("width",e(d.getWidthFrom).width()),d.stickyElement.parent().addClass(d.clsactive),d.currentTop=f)}}},u=function(){r=s.height()},d={init:function(t){var i=e.extend({},n,t);return this.each(function(){var t=e(this);if(!t.data("sticky")){var n=t.attr("id")||"s"+Math.ceil(1e4*Math.random()),s=e("<div></div>").attr("id","sticky-"+n).addClass(i.clswrapper);t.wrapAll(s),"right"==t.css("float")&&t.css({"float":"none"}).parent().css({"float":"right"}),t.data("sticky",!0);var o=t.parent();o.css("height",t.outerHeight()),a.push({top:i.top,bottom:i.bottom,stickyElement:t,currentTop:null,stickyWrapper:o,clsactive:i.clsactive,getWidthFrom:i.getWidthFrom})}})},update:l};return window.addEventListener("scroll",l,!1),window.addEventListener("resize",u,!1),e.fn.uksticky=function(t){return d[t]?d[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof t&&t?(e.error("Method "+t+" does not exist on jQuery.sticky"),void 0):d.init.apply(this,arguments)},e(document).on("uk-domready",function(){setTimeout(function(){l(),e("[data-uk-sticky]").each(function(){var t=e(this);t.data("sticky")||t.uksticky(i.Utils.options(t.attr("data-uk-sticky")))})},0)}),e.fn.uksticky});
+539
View File
@@ -0,0 +1,539 @@
/*! UIkit 2.5.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
/*
* Based on https://github.com/jdewit/bootstrap-timepicker
*/
(function(addon) {
if (typeof define == "function" && define.amd) { // AMD
define("uikit-timepicker", ["uikit"], function(){
return jQuery.UIkit.timepicker || addon(window, window.jQuery, window.jQuery.UIkit);
});
}
if(window && window.jQuery && window.jQuery.UIkit) {
addon(window, window.jQuery, window.jQuery.UIkit);
}
})(function(global, $, UI){
// Timepicker
var TimePicker = function(element, options) {
var $this = this, $element = $(element);
if($element.data("timepicker")) return;
this.$element = $element;
this.element = this.$element[0];
this.options = $.extend({}, TimePicker.defaults, options);
this.$element.on({
'focus.timepicker.uikit' : $.proxy(this.highlightUnit, this),
'click.timepicker.uikit' : $.proxy(this.highlightUnit, this),
'keydown.timepicker.uikit': $.proxy(this.onKeydown, this),
'blur.timepicker.uikit' : $.proxy(this.blurElement, this)
});
this.setDefaultTime(this.options.defaultTime);
this.$element.data("timepicker", this);
};
TimePicker.defaults = {
defaultTime: 'current',
disableFocus: false,
minuteStep: 15,
secondStep: 15,
showSeconds: false,
showMeridian: false
};
$.extend(TimePicker.prototype, {
setDefaultTime: function(defaultTime){
if (!this.element.value) {
if (defaultTime === 'current') {
var d = new Date();
this.hour = d.getHours(),
this.minute = Math.floor(d.getMinutes() / this.options.minuteStep) * this.options.minuteStep,
this.second = Math.floor(d.getSeconds() / this.options.secondStep) * this.options.secondStep,
this.meridian = 'AM';
if (this.options.showMeridian) {
if (this.hour === 0) {
this.hour = 12;
} else if (this.hour >= 12) {
if (this.hour > 12) this.hour = this.hour - 12;
this.meridian = 'PM';
} else {
this.meridian = 'AM';
}
}
this.update();
} else if (defaultTime === false) {
this.hour = 0;
this.minute = 0;
this.second = 0;
this.meridian = 'AM';
} else {
this.setTime(defaultTime);
}
} else {
this.updateFromElementVal();
}
},
setTime: function(time) {
var arr, timeArray;
if (this.options.showMeridian) {
arr = time.split(' ');
timeArray = arr[0].split(':');
this.meridian = arr[1];
} else {
timeArray = time.split(':');
}
this.hour = parseInt(timeArray[0], 10);
this.minute = parseInt(timeArray[1], 10);
this.second = parseInt(timeArray[2], 10);
if (isNaN(this.hour)) this.hour = 0;
if (isNaN(this.minute)) this.minute = 0;
if (this.options.showMeridian) {
if (this.hour > 12) {
this.hour = 12;
} else if (this.hour < 1) {
this.hour = 12;
}
if (this.meridian === 'am' || this.meridian === 'a') {
this.meridian = 'AM';
} else if (this.meridian === 'pm' || this.meridian === 'p') {
this.meridian = 'PM';
}
if (this.meridian !== 'AM' && this.meridian !== 'PM') {
this.meridian = 'AM';
}
} else {
if (this.hour >= 24) {
this.hour = 23;
} else if (this.hour < 0) {
this.hour = 0;
}
}
if (this.minute < 0) {
this.minute = 0;
} else if (this.minute >= 60) {
this.minute = 59;
}
if (this.options.showSeconds) {
if (isNaN(this.second)) {
this.second = 0;
} else if (this.second < 0) {
this.second = 0;
} else if (this.second >= 60) {
this.second = 59;
}
}
this.update();
},
blurElement: function() {
this.highlightedUnit = undefined;
this.updateFromElementVal();
},
decrementHour: function(noupdate) {
if (this.options.showMeridian) {
if (this.hour === 1) {
this.hour = 12;
} else if (this.hour === 12) {
this.hour--;
return this.toggleMeridian();
} else if (this.hour === 0) {
this.hour = 11;
return this.toggleMeridian();
} else {
this.hour--;
}
} else {
if (this.hour === 0) {
this.hour = 23;
} else {
this.hour--;
}
}
if(!noupdate) this.update();
},
decrementMinute: function(step) {
var newVal = (step) ? this.minute - step : this.minute - this.options.minuteStep;
if (newVal < 0) {
this.decrementHour(true);
this.minute = newVal + 60;
} else {
this.minute = newVal;
}
this.update();
},
decrementSecond: function() {
var newVal = this.second - this.options.secondStep;
if (newVal < 0) {
this.decrementMinute(true);
this.second = newVal + 60;
} else {
this.second = newVal;
}
this.update();
},
onKeydown: function(e) {
switch (e.keyCode) {
case 9: //tab
this.updateFromElementVal();
switch (this.highlightedUnit) {
case 'hour':
e.preventDefault();
this.highlightNextUnit();
break;
case 'minute':
if (this.options.showMeridian || this.options.showSeconds) {
e.preventDefault();
this.highlightNextUnit();
}
break;
case 'second':
if (this.options.showMeridian) {
e.preventDefault();
this.highlightNextUnit();
}
break;
}
break;
case 27: // escape
this.updateFromElementVal();
break;
case 37: // left arrow
e.preventDefault();
this.highlightPrevUnit();
this.updateFromElementVal();
break;
case 38: // up arrow
e.preventDefault();
switch (this.highlightedUnit) {
case 'hour':
this.incrementHour();
this.highlightHour();
break;
case 'minute':
this.incrementMinute();
this.highlightMinute();
break;
case 'second':
this.incrementSecond();
this.highlightSecond();
break;
case 'meridian':
this.toggleMeridian();
this.highlightMeridian();
break;
}
break;
case 39: // right arrow
e.preventDefault();
this.updateFromElementVal();
this.highlightNextUnit();
break;
case 40: // down arrow
e.preventDefault();
switch (this.highlightedUnit) {
case 'hour':
this.decrementHour();
this.highlightHour();
break;
case 'minute':
this.decrementMinute();
this.highlightMinute();
break;
case 'second':
this.decrementSecond();
this.highlightSecond();
break;
case 'meridian':
this.toggleMeridian();
this.highlightMeridian();
break;
}
break;
}
},
formatTime: function(hour, minute, second, meridian) {
hour = hour < 10 ? '0' + hour : hour;
minute = minute < 10 ? '0' + minute : minute;
second = second < 10 ? '0' + second : second;
return hour + ':' + minute + (this.options.showSeconds ? ':' + second : '') + (this.options.showMeridian ? ' ' + meridian : '');
},
getCursorPosition: function() {
if ('selectionStart' in this.element) {// Standard-compliant browsers
return this.element.selectionStart;
} else if (document.selection) {// IE fix
this.element.focus();
var sel = document.selection.createRange(),
selLen = document.selection.createRange().text.length;
sel.moveStart('character', - this.element.value.length);
return sel.text.length - selLen;
}
},
getTime: function() {
return this.formatTime(this.hour, this.minute, this.second, this.meridian);
},
highlightUnit: function() {
this.position = this.getCursorPosition();
if (this.position >= 0 && this.position <= 2) {
this.highlightHour();
} else if (this.position >= 3 && this.position <= 5) {
this.highlightMinute();
} else if (this.position >= 6 && this.position <= 8) {
if (this.options.showSeconds) {
this.highlightSecond();
} else {
this.highlightMeridian();
}
} else if (this.position >= 9 && this.position <= 11) {
this.highlightMeridian();
}
},
highlightNextUnit: function() {
switch (this.highlightedUnit) {
case 'hour':
this.highlightMinute();
break;
case 'minute':
if (this.options.showSeconds) {
this.highlightSecond();
} else if (this.options.showMeridian){
this.highlightMeridian();
} else {
this.highlightHour();
}
break;
case 'second':
if (this.options.showMeridian) {
this.highlightMeridian();
} else {
this.highlightHour();
}
break;
case 'meridian':
this.highlightHour();
break;
}
},
highlightPrevUnit: function() {
switch (this.highlightedUnit) {
case 'hour':
this.highlightMeridian();
break;
case 'minute':
this.highlightHour();
break;
case 'second':
this.highlightMinute();
break;
case 'meridian':
if (this.options.showSeconds) {
this.highlightSecond();
} else {
this.highlightMinute();
}
break;
}
},
highlightHour: function() {
var $element = this.element;
this.highlightedUnit = 'hour';
if ($element.setSelectionRange) {
setTimeout(function() {
$element.setSelectionRange(0,2);
}, 0);
}
},
highlightMinute: function() {
var $element = this.element;
this.highlightedUnit = 'minute';
if ($element.setSelectionRange) {
setTimeout(function() {
$element.setSelectionRange(3,5);
}, 0);
}
},
highlightSecond: function() {
var $element = this.element;
this.highlightedUnit = 'second';
if ($element.setSelectionRange) {
setTimeout(function() {
$element.setSelectionRange(6,8);
}, 0);
}
},
highlightMeridian: function() {
var $element = this.element;
this.highlightedUnit = 'meridian';
if ($element.setSelectionRange) {
if (this.options.showSeconds) {
setTimeout(function() {
$element.setSelectionRange(9,11);
}, 0);
} else {
setTimeout(function() {
$element.setSelectionRange(6,8);
}, 0);
}
}
},
incrementHour: function(noupdate) {
if (this.options.showMeridian) {
if (this.hour === 11) {
this.hour++;
return this.toggleMeridian();
} else if (this.hour === 12) {
this.hour = 0;
}
}
if (this.hour === 23) {
this.hour = 0;
return;
}
this.hour++;
if(!noupdate) this.update();
},
incrementMinute: function(step) {
var newVal = step ? (this.minute + step) : (this.minute + this.options.minuteStep - (this.minute % this.options.minuteStep));
if (newVal > 59) {
this.incrementHour(true);
this.minute = newVal - 60;
} else {
this.minute = newVal;
}
this.update();
},
incrementSecond: function() {
var newVal = this.second + this.options.secondStep - (this.second % this.options.secondStep);
if (newVal > 59) {
this.incrementMinute(true);
this.second = newVal - 60;
} else {
this.second = newVal;
}
this.update();
},
remove: function() {
$('document').off('.timepicker.uikit');
delete this.$element.data().timepicker;
},
toggleMeridian: function() {
this.meridian = this.meridian === 'AM' ? 'PM' : 'AM';
this.update();
},
update: function() {
this.$element.trigger({
'type': 'changeTime.timepicker',
'time': {
'value': this.getTime(),
'hours': this.hour,
'minutes': this.minute,
'seconds': this.second,
'meridian': this.meridian
}
});
this.updateElement();
},
updateElement: function() {
this.$element.val(this.getTime()).trigger("change");
},
updateFromElementVal: function() {
if (this.element.value) this.setTime(this.element.value);
}
});
// init code
$(document).on("focus.timepicker.uikit", "[data-uk-timepicker]", function(e) {
var ele = $(this);
if (!ele.data("timepicker")) {
e.preventDefault();
var obj = new TimePicker(ele, UI.Utils.options(ele.attr("data-uk-timepicker")));
ele.trigger("focus");
}
});
UI["timepicker"] = TimePicker;
return TimePicker;
});
+3
View File
@@ -0,0 +1,3 @@
/*! UIkit 2.5.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
(function(t){"function"==typeof define&&define.amd&&define("uikit-timepicker",["uikit"],function(){return jQuery.UIkit.timepicker||t(window,window.jQuery,window.jQuery.UIkit)}),window&&window.jQuery&&window.jQuery.UIkit&&t(window,window.jQuery,window.jQuery.UIkit)})(function(t,e,i){var n=function(t,i){var s=e(t);s.data("timepicker")||(this.$element=s,this.element=this.$element[0],this.options=e.extend({},n.defaults,i),this.$element.on({"focus.timepicker.uikit":e.proxy(this.highlightUnit,this),"click.timepicker.uikit":e.proxy(this.highlightUnit,this),"keydown.timepicker.uikit":e.proxy(this.onKeydown,this),"blur.timepicker.uikit":e.proxy(this.blurElement,this)}),this.setDefaultTime(this.options.defaultTime),this.$element.data("timepicker",this))};return n.defaults={defaultTime:"current",disableFocus:!1,minuteStep:15,secondStep:15,showSeconds:!1,showMeridian:!1},e.extend(n.prototype,{setDefaultTime:function(t){if(this.element.value)this.updateFromElementVal();else if("current"===t){var e=new Date;this.hour=e.getHours(),this.minute=Math.floor(e.getMinutes()/this.options.minuteStep)*this.options.minuteStep,this.second=Math.floor(e.getSeconds()/this.options.secondStep)*this.options.secondStep,this.meridian="AM",this.options.showMeridian&&(0===this.hour?this.hour=12:this.hour>=12?(this.hour>12&&(this.hour=this.hour-12),this.meridian="PM"):this.meridian="AM"),this.update()}else t===!1?(this.hour=0,this.minute=0,this.second=0,this.meridian="AM"):this.setTime(t)},setTime:function(t){var e,i;this.options.showMeridian?(e=t.split(" "),i=e[0].split(":"),this.meridian=e[1]):i=t.split(":"),this.hour=parseInt(i[0],10),this.minute=parseInt(i[1],10),this.second=parseInt(i[2],10),isNaN(this.hour)&&(this.hour=0),isNaN(this.minute)&&(this.minute=0),this.options.showMeridian?(this.hour>12?this.hour=12:1>this.hour&&(this.hour=12),"am"===this.meridian||"a"===this.meridian?this.meridian="AM":("pm"===this.meridian||"p"===this.meridian)&&(this.meridian="PM"),"AM"!==this.meridian&&"PM"!==this.meridian&&(this.meridian="AM")):this.hour>=24?this.hour=23:0>this.hour&&(this.hour=0),0>this.minute?this.minute=0:this.minute>=60&&(this.minute=59),this.options.showSeconds&&(isNaN(this.second)?this.second=0:0>this.second?this.second=0:this.second>=60&&(this.second=59)),this.update()},blurElement:function(){this.highlightedUnit=void 0,this.updateFromElementVal()},decrementHour:function(t){if(this.options.showMeridian)if(1===this.hour)this.hour=12;else{if(12===this.hour)return this.hour--,this.toggleMeridian();if(0===this.hour)return this.hour=11,this.toggleMeridian();this.hour--}else 0===this.hour?this.hour=23:this.hour--;t||this.update()},decrementMinute:function(t){var e=t?this.minute-t:this.minute-this.options.minuteStep;0>e?(this.decrementHour(!0),this.minute=e+60):this.minute=e,this.update()},decrementSecond:function(){var t=this.second-this.options.secondStep;0>t?(this.decrementMinute(!0),this.second=t+60):this.second=t,this.update()},onKeydown:function(t){switch(t.keyCode){case 9:switch(this.updateFromElementVal(),this.highlightedUnit){case"hour":t.preventDefault(),this.highlightNextUnit();break;case"minute":(this.options.showMeridian||this.options.showSeconds)&&(t.preventDefault(),this.highlightNextUnit());break;case"second":this.options.showMeridian&&(t.preventDefault(),this.highlightNextUnit())}break;case 27:this.updateFromElementVal();break;case 37:t.preventDefault(),this.highlightPrevUnit(),this.updateFromElementVal();break;case 38:switch(t.preventDefault(),this.highlightedUnit){case"hour":this.incrementHour(),this.highlightHour();break;case"minute":this.incrementMinute(),this.highlightMinute();break;case"second":this.incrementSecond(),this.highlightSecond();break;case"meridian":this.toggleMeridian(),this.highlightMeridian()}break;case 39:t.preventDefault(),this.updateFromElementVal(),this.highlightNextUnit();break;case 40:switch(t.preventDefault(),this.highlightedUnit){case"hour":this.decrementHour(),this.highlightHour();break;case"minute":this.decrementMinute(),this.highlightMinute();break;case"second":this.decrementSecond(),this.highlightSecond();break;case"meridian":this.toggleMeridian(),this.highlightMeridian()}}},formatTime:function(t,e,i,n){return t=10>t?"0"+t:t,e=10>e?"0"+e:e,i=10>i?"0"+i:i,t+":"+e+(this.options.showSeconds?":"+i:"")+(this.options.showMeridian?" "+n:"")},getCursorPosition:function(){if("selectionStart"in this.element)return this.element.selectionStart;if(document.selection){this.element.focus();var t=document.selection.createRange(),e=document.selection.createRange().text.length;return t.moveStart("character",-this.element.value.length),t.text.length-e}},getTime:function(){return this.formatTime(this.hour,this.minute,this.second,this.meridian)},highlightUnit:function(){this.position=this.getCursorPosition(),this.position>=0&&2>=this.position?this.highlightHour():this.position>=3&&5>=this.position?this.highlightMinute():this.position>=6&&8>=this.position?this.options.showSeconds?this.highlightSecond():this.highLine truncated
+246
View File
@@ -0,0 +1,246 @@
/*! UIkit 2.5.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
(function(addon) {
if (typeof define == "function" && define.amd) { // AMD
define(["uikit"], function(){
return jQuery.UIkit || addon(window.jQuery, window.jQuery.UIkit);
});
}
if (window && window.jQuery && window.jQuery.UIkit) {
addon(window.jQuery, window.jQuery.UIkit);
}
})(function($, UI){
var UploadSelect = function(element, options) {
var $this = this,
$element = $(element),
options = $.extend({}, xhrupload.defaults, UploadSelect.defaults, options);
if ($element.data("uploadSelect")) return;
this.element = $element.on("change", function() {
xhrupload($this.element[0].files, options);
});
$element.data("uploadSelect", this);
};
UploadSelect.defaults = {};
var UploadDrop = function(element, options) {
var $this = this,
$element = $(element),
options = $.extend({}, xhrupload.defaults, UploadDrop.defaults, options),
hasdragCls = false;
if ($element.data("uploadDrop")) return;
$element.on("drop", function(e){
if (e.dataTransfer && e.dataTransfer.files) {
e.stopPropagation();
e.preventDefault();
$element.removeClass(options.dragoverClass);
xhrupload(e.dataTransfer.files, options);
}
}).on("dragenter", function(e){
e.stopPropagation();
e.preventDefault();
}).on("dragover", function(e){
e.stopPropagation();
e.preventDefault();
if (!hasdragCls) {
$element.addClass(options.dragoverClass);
hasdragCls = true;
}
}).on("dragleave", function(e){
e.stopPropagation();
e.preventDefault();
$element.removeClass(options.dragoverClass);
hasdragCls = false;
});
$element.data("uploadDrop", this);
};
UploadDrop.defaults = {
'dragoverClass': 'uk-dragover'
};
UI["upload"] = { "select" : UploadSelect, "drop" : UploadDrop };
UI.support.ajaxupload = (function() {
function supportFileAPI() {
var fi = document.createElement('INPUT'); fi.type = 'file'; return 'files' in fi;
}
function supportAjaxUploadProgressEvents() {
var xhr = new XMLHttpRequest(); return !! (xhr && ('upload' in xhr) && ('onprogress' in xhr.upload));
}
function supportFormData() {
return !! window.FormData;
}
return supportFileAPI() && supportAjaxUploadProgressEvents() && supportFormData();
})();
if (UI.support.ajaxupload){
$.event.props.push("dataTransfer");
}
function xhrupload(files, settings) {
if (!UI.support.ajaxupload){
return this;
}
settings = $.extend({}, xhrupload.defaults, settings);
if (!files.length){
return;
}
if (settings.allow !== '*.*') {
for(var i=0,file;file=files[i];i++) {
if(!matchName(settings.allow, file.name)) {
if(typeof(settings.notallowed) == 'string') {
alert(settings.notallowed);
} else {
settings.notallowed(file, settings);
}
return;
}
}
}
var complete = settings.complete;
if (settings.single){
var count = files.length,
uploaded = 0;
settings.complete = function(response, xhr){
uploaded = uploaded+1;
complete(response, xhr);
if (uploaded<count){
upload([files[uploaded]], settings);
} else {
settings.allcomplete(response, xhr);
}
};
upload([files[0]], settings);
} else {
settings.complete = function(response, xhr){
complete(response, xhr);
settings.allcomplete(response, xhr);
};
upload(files, settings);
}
function upload(files, settings){
// upload all at once
var formData = new FormData(), xhr = new XMLHttpRequest();
if (settings.before(settings, files)===false) return;
for (var i = 0, f; f = files[i]; i++) { formData.append(settings.param, f); }
for (var p in settings.params) { formData.append(p, settings.params[p]); }
// Add any event handlers here...
xhr.upload.addEventListener("progress", function(e){
var percent = (e.loaded / e.total)*100;
settings.progress(percent, e);
}, false);
xhr.addEventListener("loadstart", function(e){ settings.loadstart(e); }, false);
xhr.addEventListener("load", function(e){ settings.load(e); }, false);
xhr.addEventListener("loadend", function(e){ settings.loadend(e); }, false);
xhr.addEventListener("error", function(e){ settings.error(e); }, false);
xhr.addEventListener("abort", function(e){ settings.abort(e); }, false);
xhr.open(settings.method, settings.action, true);
xhr.onreadystatechange = function() {
settings.readystatechange(xhr);
if (xhr.readyState==4){
var response = xhr.responseText;
if (settings.type=="json") {
try {
response = $.parseJSON(response);
} catch(e) {
response = false;
}
}
settings.complete(response, xhr);
}
};
xhr.send(formData);
}
}
xhrupload.defaults = {
'action': '',
'single': true,
'method': 'POST',
'param' : 'files[]',
'params': {},
'allow' : '*.*',
'type' : 'text',
// events
'before' : function(o){},
'loadstart' : function(){},
'load' : function(){},
'loadend' : function(){},
'error' : function(){},
'abort' : function(){},
'progress' : function(){},
'complete' : function(){},
'allcomplete' : function(){},
'readystatechange': function(){},
'notallowed' : function(file, settings){ alert('Only the following file types are allowed: '+settings.allow); }
};
function matchName(pattern, path) {
var parsedPattern = '^' + pattern.replace(/\//g, '\\/').
replace(/\*\*/g, '(\\/[^\\/]+)*').
replace(/\*/g, '[^\\/]+').
replace(/((?!\\))\?/g, '$1.') + '$';
parsedPattern = '^' + parsedPattern + '$';
return (path.match(new RegExp(parsedPattern)) !== null);
}
UI.Utils.xhrupload = xhrupload;
return xhrupload;
});
+3
View File
@@ -0,0 +1,3 @@
/*! UIkit 2.5.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
(function(t){"function"==typeof define&&define.amd&&define(["uikit"],function(){return jQuery.UIkit||t(window.jQuery,window.jQuery.UIkit)}),window&&window.jQuery&&window.jQuery.UIkit&&t(window.jQuery,window.jQuery.UIkit)})(function(t,e){function i(s,o){function a(e,i){var n=new FormData,s=new XMLHttpRequest;if(i.before(i,e)!==!1){for(var o,a=0;o=e[a];a++)n.append(i.param,o);for(var r in i.params)n.append(r,i.params[r]);s.upload.addEventListener("progress",function(t){var e=100*(t.loaded/t.total);i.progress(e,t)},!1),s.addEventListener("loadstart",function(t){i.loadstart(t)},!1),s.addEventListener("load",function(t){i.load(t)},!1),s.addEventListener("loadend",function(t){i.loadend(t)},!1),s.addEventListener("error",function(t){i.error(t)},!1),s.addEventListener("abort",function(t){i.abort(t)},!1),s.open(i.method,i.action,!0),s.onreadystatechange=function(){if(i.readystatechange(s),4==s.readyState){var e=s.responseText;if("json"==i.type)try{e=t.parseJSON(e)}catch(n){e=!1}i.complete(e,s)}},s.send(n)}}if(!e.support.ajaxupload)return this;if(o=t.extend({},i.defaults,o),s.length){if("*.*"!==o.allow)for(var r,l=0;r=s[l];l++)if(!n(o.allow,r.name))return"string"==typeof o.notallowed?alert(o.notallowed):o.notallowed(r,o),void 0;var u=o.complete;if(o.single){var h=s.length,d=0;o.complete=function(t,e){d+=1,u(t,e),h>d?a([s[d]],o):o.allcomplete(t,e)},a([s[0]],o)}else o.complete=function(t,e){u(t,e),o.allcomplete(t,e)},a(s,o)}}function n(t,e){var i="^"+t.replace(/\//g,"\\/").replace(/\*\*/g,"(\\/[^\\/]+)*").replace(/\*/g,"[^\\/]+").replace(/((?!\\))\?/g,"$1.")+"$";return i="^"+i+"$",null!==e.match(RegExp(i))}var s=function(e,n){var o=this,a=t(e),n=t.extend({},i.defaults,s.defaults,n);a.data("uploadSelect")||(this.element=a.on("change",function(){i(o.element[0].files,n)}),a.data("uploadSelect",this))};s.defaults={};var o=function(e,n){var s=t(e),n=t.extend({},i.defaults,o.defaults,n),a=!1;s.data("uploadDrop")||(s.on("drop",function(t){t.dataTransfer&&t.dataTransfer.files&&(t.stopPropagation(),t.preventDefault(),s.removeClass(n.dragoverClass),i(t.dataTransfer.files,n))}).on("dragenter",function(t){t.stopPropagation(),t.preventDefault()}).on("dragover",function(t){t.stopPropagation(),t.preventDefault(),a||(s.addClass(n.dragoverClass),a=!0)}).on("dragleave",function(t){t.stopPropagation(),t.preventDefault(),s.removeClass(n.dragoverClass),a=!1}),s.data("uploadDrop",this))};return o.defaults={dragoverClass:"uk-dragover"},e.upload={select:s,drop:o},e.support.ajaxupload=function(){function t(){var t=document.createElement("INPUT");return t.type="file","files"in t}function e(){var t=new XMLHttpRequest;return!!(t&&"upload"in t&&"onprogress"in t.upload)}function i(){return!!window.FormData}return t()&&e()&&i()}(),e.support.ajaxupload&&t.event.props.push("dataTransfer"),i.defaults={action:"",single:!0,method:"POST",param:"files[]",params:{},allow:"*.*",type:"text",before:function(){},loadstart:function(){},load:function(){},loadend:function(){},error:function(){},abort:function(){},progress:function(){},complete:function(){},allcomplete:function(){},readystatechange:function(){},notallowed:function(t,e){alert("Only the following file types are allowed: "+e.allow)}},e.Utils.xhrupload=i,i});