1 line
3.2 KiB
JavaScript
1 line
3.2 KiB
JavaScript
![]() |
define(["jquery"],function(r){return r(function(r){r.extend(!0,r,{support:{rgba:function(){var e=r("script:first"),t=e.css("color"),s=!1;if(/^rgba/.test(t))s=!0;else try{s=t!==e.css("color","rgba(0, 0, 0, 0.5)").css("color"),e.css("color",t)}catch(r){}return e.removeAttr("style"),s}()}});var e,t=r("html").prop("style");function s(e){var t=[],s=0,n=e.length;function o(){var r=/^(-?[0-9\.]+)(?:px)?\s+(-?[0-9\.]+)(?:px)?(?:\s+(-?[0-9\.]+)(?:px)?)?(?:\s+(-?[0-9\.]+)(?:px)?)?/.exec(e.substring(s));return null!==r&&r.length>0&&(i.left=parseInt(r[1],10),i.top=parseInt(r[2],10),i.blur=r[3]?parseInt(r[3],10):0,i.spread=r[4]?parseInt(r[4],10):0,s+=r[0].length,!0)}function l(){var r=/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})/.exec(e.substring(s));return null!==r&&r.length>0?(i.color=[parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16),1],s+=r[0].length,!0):null!==(r=/^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])/.exec(e.substring(s)))&&r.length>0?(i.color=[17*parseInt(r[1],16),17*parseInt(r[2],16),17*parseInt(r[3],16),1],s+=r[0].length,!0):null!==(r=/^rgb\(\s*([0-9\.]+)\s*,\s*([0-9\.]+)\s*,\s*([0-9\.]+)\s*\)/.exec(e.substring(s)))&&r.length>0?(i.color=[parseInt(r[1],10),parseInt(r[2],10),parseInt(r[3],10),1],s+=r[0].length,!0):null!==(r=/^rgba\(\s*([0-9\.]+)\s*,\s*([0-9\.]+)\s*,\s*([0-9\.]+)\s*,\s*([0-9\.]+)\s*\)/.exec(e.substring(s)))&&r.length>0&&(i.color=[parseInt(r[1],10),parseInt(r[2],10),parseInt(r[3],10),parseFloat(r[4])],s+=r[0].length,!0)}function a(){var r=/^\s+/.exec(e.substring(s));return null!==r&&r.length>0&&(s+=r[0].length,!0)}function p(){var r=/^\s*,\s*/.exec(e.substring(s));return null!==r&&r.length>0&&(s+=r[0].length,!0)}function u(e){if(r.isPlainObject(e)){var t,s,n=0,o=[];for(r.isArray(e.color)&&(n=(s=e.color).length),t=0;t<4;t++)t<n?o.push(s[t]):3===t?o.push(1):o.push(0)}return r.extend({left:0,top:0,blur:0,spread:0},e)}for(var c,i=u();s<n;)if(void 0,null!==(c=/^inset\b/.exec(e.substring(s)))&&c.length>0&&(i.inset=!0,s+=c[0].length,1))a();else if(o())a();else if(l())a();else{if(!p())break;t.push(u(i)),i={}}return t.push(u(i)),t}r.each(["boxShadow","MozBoxShadow","WebkitBoxShadow"],function(r,s){if(void 0!==t[s])return e=s,!1}),e&&(r.Tween.propHooks.boxShadow={get:function(t){return r(t.elem).css(e)},set:function(t){var n,o=t.elem.style,l=s(r(t.elem)[0].style[e]||r(t.elem).css(e)),a=s(t.end),p=Math.max(l.length,a.length);for(n=0;n<p;n++)a[n]=r.extend({},l[n],a[n]),l[n]?"color"in l[n]&&!1!==r.isArray(l[n].color)||(l[n].color=a[n].color||[0,0,0,0]):l[n]=s("0 0 0 0 rgba(0,0,0,0)")[0];t.run=function(t){var s,n,p,u,c=(s=l,n=a,p=t,u=[],r.each(s,function(e){var t=[],o=s[e],l=n[e];if(o.inset&&t.push("inset"),void 0!==l.left&&t.push(parseFloat(o.left+p*(l.left-o.left))+"px "+parseFloat(o.top+p*(l.top-o.top))+"px"),void 0!==l.blur&&t.push(parseFloat(o.blur+p*(l.blur-o.blur))+"px"),void 0!==l.spread&&t.push(parseFloat(o.spread+p*(l.spread-o.spread))+"px"),void 0!==l.color){var a="rgb"+(r.support.rgba?"a":"")+"("+parseInt(o.color[0]+p*(l.color[0]-o.color[0]),10)+","+parseInt(o.color[1]+p*(l.color[1]-o.color[1]),10)+","+parseInt(o.color[2]+p*(l.color[2]-o.color[2]),10);r.support.rgba&&(a+=","+parseFloat(o.color[3]+p*(l.color[3]-o.color[3]))),a+=")",t.push(a)}u.push(t.join(" "))}),u.join(", "));o[e]=c}}})})});
|