Minor fix

This commit is contained in:
thednp 2016-09-20 06:52:42 +03:00
parent d1e016185b
commit 56a0045f89
3 changed files with 11 additions and 7 deletions

View file

@ -54,17 +54,19 @@
for ( p in o ) {
var prop = replaceUppercase(p), cv = getCurrentValue(l,prop.replace(/_+[a-z]+/,''));
if ( /%|[a-z]/.test(o[p]) || /%|[a-z]/.test(cv) ) {
var u = K.truD(cv).u || K.truD(o[p]).u, s = /%/.test(u) ? '_percent' : '_'+u; prop = prop.replace(s,'');
var u = K.truD(cv).u || K.truD(o[p]).u, s = /%/.test(u) ? '_percent' : '_'+u;
if (!(p+s in atts)) {
atts[p+s] = function(l,p,a,b,v) {
l.setAttribute(prop, unit(a.v,b.v,b.u,v) );
var _p = _p || replaceUppercase(p).replace(s,'');
l.setAttribute(_p, unit(a.v,b.v,b.u,v) );
}
}
ats[p+s] = K.truD(o[p]);
} else {
if (!(p in atts)) {
atts[p] = function(l,o,a,b,v) {
l.setAttribute(prop, number(a,b,v));
var _o = _o || replaceUppercase(o);
l.setAttribute(_o, number(a,b,v));
}
}
ats[p] = parseFloat(o[p]);

View file

@ -1,2 +1,2 @@
// Attributes Plugin for KUTE.js | dnp_theme | MIT License
(function(c){if("function"===typeof define&&define.amd)define(["./kute.js"],function(a){c(a);return a});else if("object"==typeof module&&"function"==typeof require){var a=require("./kute.js");module.exports=c(a)}else if("undefined"!==typeof window.KUTE)c(a);else throw Error("Attributes Plugin require KUTE.js.");})(function(c){var a=window.KUTE,h=a.dom;c=a.pp;var l=a.Interpolate.unit,m=a.Interpolate.number,g,n=function(a,d){return a.getAttribute(d)},k=function(a){return/[A-Z]/g.test(a)?a.replace(a.match(/[A-Z]/g)[0],"-"+a.match(/[A-Z]/g)[0].toLowerCase()):a};a.prS.attr=function(a,d,c){d={};for(var b in c){c=k(b).replace(/_+[a-z]+/,"");var f=a.getAttribute(c);d[c]=f||(/opacity/i.test(b)?1:0)}return d};c.attr=function(c,d,p){"attr"in h||(h.attr=function(a,c,b,d,e){for(var f in d)h.attributes[f](a,f,b[f],d[f],e)},g=h.attributes={});c={};for(var b in d){var f=k(b),e=n(p,f.replace(/_+[a-z]+/,""));/%|[a-z]/.test(d[b])||/%|[a-z]/.test(e)?(e=a.truD(e).u||a.truD(d[b]).u,e=/%/.test(e)?"_percent":"_"+e,f=f.replace(e,""),b+e in g||(g[b+e]=function(a,c,b,d,e){a.setAttribute(f,l(b.v,d.v,d.u,e))}),c[b+e]=a.truD(d[b])):(b in g||(g[b]=function(a,c,b,d,e){a.setAttribute(f,m(b,d,e))}),c[b]=parseFloat(d[b]))}return c}});
(function(b){if("function"===typeof define&&define.amd)define(["./kute.js"],function(a){b(a);return a});else if("object"==typeof module&&"function"==typeof require){var a=require("./kute.js");module.exports=b(a)}else if("undefined"!==typeof window.KUTE)b(a);else throw Error("Attributes Plugin require KUTE.js.");})(function(b){var a=window.KUTE,h=a.dom;b=a.pp;var m=a.Interpolate.unit,n=a.Interpolate.number,g,p=function(a,d){return a.getAttribute(d)},k=function(a){return/[A-Z]/g.test(a)?a.replace(a.match(/[A-Z]/g)[0],"-"+a.match(/[A-Z]/g)[0].toLowerCase()):a};a.prS.attr=function(a,d,b){d={};for(var c in b){b=k(c).replace(/_+[a-z]+/,"");var e=a.getAttribute(b);d[b]=e||(/opacity/i.test(c)?1:0)}return d};b.attr=function(b,d,q){"attr"in h||(h.attr=function(a,b,c,d,e){for(var f in d)h.attributes[f](a,f,c[f],d[f],e)},g=h.attributes={});b={};for(var c in d){var e=k(c),e=p(q,e.replace(/_+[a-z]+/,""));if(/%|[a-z]/.test(d[c])||/%|[a-z]/.test(e)){var e=a.truD(e).u||a.truD(d[c]).u,l=/%/.test(e)?"_percent":"_"+e;c+l in g||(g[c+l]=function(a,b,c,d,e){var f=f||k(b).replace(l,"");a.setAttribute(f,m(c.v,d.v,d.u,e))});b[c+l]=a.truD(d[c])}else c in g||(g[c]=function(a,b,c,d,e){var f=f||k(b);a.setAttribute(f,n(c,d,e))}),b[c]=parseFloat(d[c])}return b}});

View file

@ -54,17 +54,19 @@
for ( p in o ) {
var prop = replaceUppercase(p), cv = getCurrentValue(l,prop.replace(/_+[a-z]+/,''));
if ( /%|[a-z]/.test(o[p]) || /%|[a-z]/.test(cv) ) {
var u = K.truD(cv).u || K.truD(o[p]).u, s = /%/.test(u) ? '_percent' : '_'+u; prop = prop.replace(s,'');
var u = K.truD(cv).u || K.truD(o[p]).u, s = /%/.test(u) ? '_percent' : '_'+u;
if (!(p+s in atts)) {
atts[p+s] = function(l,p,a,b,v) {
l.setAttribute(prop, unit(a.v,b.v,b.u,v) );
var _p = _p || replaceUppercase(p).replace(s,'');
l.setAttribute(_p, unit(a.v,b.v,b.u,v) );
}
}
ats[p+s] = K.truD(o[p]);
} else {
if (!(p in atts)) {
atts[p] = function(l,o,a,b,v) {
l.setAttribute(prop, number(a,b,v));
var _o = _o || replaceUppercase(o);
l.setAttribute(_o, number(a,b,v));
}
}
ats[p] = parseFloat(o[p]);