-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathhuk.min.js
1 lines (1 loc) · 3.48 KB
/
huk.min.js
1
(function(a,b){if(typeof module!="undefined")module.exports=b();else if(typeof define=="function"&&define.amd)define(a,b);else this[a]=b()})("huk",function(){function f(a,b){var c=0;while(c<b.length&&b[c]!=a)c++;return c<b.length}function g(a,b){var c=[],d=[];_.each(a,function(a){if(b.call(null,a))c.push(a);else d.push(a)});return[c,d]}function h(a,b,c,d){_.each(b,function(b,f){e(a).on(f,function(a){b.call(this,a,c,d)})})}function i(a){return a[0]}function j(a){return a[1]}function k(a){return a[2]}function l(a,b){e(a).css(b)}function m(a){var b=a.events||{};delete a.events;_.each(a,function(c,e){if(f(e,d.split(" "))){b[e]=c;delete a[e]}});return b}function n(a,b){if(_.isString(b))a.appendChild(document.createTextNode(b));else if(_.isArray(b))_.each(b,function(b){n(a,b)});else if(_.isElement(b))a.appendChild(b.cloneNode(true));return a}function o(a,c,d){var e=document.createElement(a),g,i,j;if(_.isString(c))c=f(a,b.split(" "))?{src:c}:{content:c};i=m(c);h(e,i,c.data,d);if(c.css)l(e,c.css);delete c.css;g=c.content||"";delete c.content;if(g)e=n(e,g,d);_.each(c,function(a,b){if(b!="data")e.setAttribute(b,a)});return e}function p(a,b,c){var d=[],e=[];if(_.isUndefined(b))b={};if(_.isArray(b)){_.each(b,function(b){d.push(b.complete);delete b.complete;e.push(o(a,b))})}else{if(_.isFunction(b.complete)){d.push(b.complete);delete b.complete}e.push(o(a,b))}if(!_.isEmpty(d))c.completes.push([d,b.data,e]);c.data=c.data.concat(e)}function q(a){var b=_.extend({},a.itemArgs);if(a.content)b.content=a.content;return b}function r(a,b){if(a.length==1)return b[a];return r(_.rest(a),b[_.first(a)])}function s(a){var b,c,d=a.itemTag||"li",e=a.justItems,f=this;if(_.isNumber(a.items))a.items=_.range(a);b=a.items.map(function(b,c){var e=q(a),f,g,h={value:b,index:c};e.data=b;f=o(d,e,c);_.each(f.attributes,function(a){a.value=a.value.replace(/<<.[a-z,.,0-9,_,-]*>>/gi,function(a){a=a.substr(2,a.length-4);if(_.first(a)=="v"){return r(a.split("."),h)}else return h[a]})});f.innerHTML=f.innerHTML.replace(/<<.[a-z,.,0-9,_,-]*>>/gi,function(a){a=a.substr(8,a.length-16);if(_.first(a)=="v"){return r(a.split("."),h)}else return h[a]});return f});delete a.items;delete a.itemArgs;delete a.itemTag;delete a.content;delete a.justItems;if(e)f.data=f.data.concat(b);else{c=o("ul",a);_.each(b,function(a){c.appendChild(a)});f.data.push(c)}return f}function t(a){this.el=e(a);this.data=[];this.completes=[]}function u(a){return new t(a)}"use strict";var a="a area article adress abbr audio b button base bdi bdo center blockquote cite col"+" colgroup command datalist details dl figure footer header hgroup map keygen kbd"+" mark meter nav noscript object param output progress rp rt ruby section source sub"+" summary time tfoot sup track video wbr figcaption caption canvas code div dt dd"+" em fieldset font form h1 h2 h3 h4 h5 h6 i iframe img input label li menu meta ol p"+" pre script select span strong style table tbody td tr textarea ul hr",b="img iframe audio video",c="append after before html text prepend",d="click hover",e=jQuery||ender;t.prototype.list=s;t.constructor.prototype.list=s;t.constructor.prototype.addTag=function(a){t.prototype[a]=function(b){p(a,b,this);return this};t.constructor.prototype[a]=function(b){return o(a,b)}};_.each(a.split(" "),function(a){t.addTag(a)});_.each(c.split(" "),function(a){t.prototype[a]=function(){var b=this.el;e(b)[a](this.data);_.each(this.completes,function(a){_.each(k(a),function(b,c){var d=i(a)[c];if(!_.isUndefined(d))d.call(b,j(a))})})}});t.prototype.val=function(){return this.data};return u})