WordPress/wp-admin/js/svg-painter.min.js

2 lines
2.3 KiB
JavaScript
Raw Normal View History

/*! This file is auto-generated */
window.wp=window.wp||{},wp.svgPainter=function(a,o,n){"use strict";var t,r,e,m,i,s,c,u,l,f={},g=[];function p(){for(;l<256;)m=String.fromCharCode(l),s+=m,u[l]=l,c[l]=i.indexOf(m),++l}function d(n,t,a,e,i,o){var r,s,c=0,u=0,l="",f=0;for(s=(n=String(n)).length;u<s;){for(c=(c<<i)+(m=(m=n.charCodeAt(u))<256?a[m]:-1),f+=i;o<=f;)r=c>>(f-=o),l+=e.charAt(r),c^=r<<f;++u}return!t&&0<f&&(l+=e.charAt(c<<o-f)),l}return a(n).ready(function(){n.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#Image","1.1")&&(a(n.body).removeClass("no-svg").addClass("svg"),wp.svgPainter.init())}),i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s="",c=[256],u=[256],l=0,r={atob:function(n){var t;for(m||p(),n=n.replace(/[^A-Za-z0-9\+\/\=]/g,""),t=(n=String(n).split("=")).length;n[--t]=d(n[t],!0,c,s,6,8),0<t;);return n=n.join("")},btoa:function(n){return m||p(),(n=d(n,!1,u,i,8,6))+"====".slice(n.length%4||4)}},{init:function(){e=this,t=a("#adminmenu .wp-menu-image, #wpadminbar .ab-item"),this.setColors(),this.findElements(),this.paint()},setColors:function(n){void 0===n&&void 0!==o._wpColorScheme&&(n=o._wpColorScheme),n&&n.icons&&n.icons.base&&n.icons.current&&n.icons.focus&&(f=n.icons)},findElements:function(){t.each(function(){var n=a(this),t=n.css("background-image");t&&-1!=t.indexOf("data:image/svg+xml;base64")&&g.push(n)})},paint:function(){a.each(g,function(n,t){var a=t.parent().parent();a.hasClass("current")||a.hasClass("wp-has-current-submenu")?e.paintElement(t,"current"):(e.paintElement(t,"base"),a.hover(function(){e.paintElement(t,"focus")},function(){o.setTimeout(function(){e.paintElement(t,"base")},100)}))})},paintElement:function(n,t){var a,e,i;if(t&&f.hasOwnProperty(t)&&(i=f[t]).match(/^(#[0-9a-f]{3}|#[0-9a-f]{6})$/i)&&"none"!==(a=n.data("wp-ui-svg-"+i))){if(!a){if(!(e=n.css("background-image").match(/.+data:image\/svg\+xml;base64,([A-Za-z0-9\+\/\=]+)/))||!e[1])return void n.data("wp-ui-svg-"+i,"none");try{a="atob"in o?o.atob(e[1]):r.atob(e[1])}catch(n){}if(!a)return void n.data("wp-ui-svg-"+i,"none");a=(a=(a=a.replace(/fill="(.+?)"/g,'fill="'+i+'"')).replace(/style="(.+?)"/g,'style="fill:'+i+'"')).replace(/fill:.*?;/g,"fill: "+i+";"),a="btoa"in o?o.btoa(a):r.btoa(a),n.data("wp-ui-svg-"+i,a)}n.attr("style",'background-image: url("data:image/svg+xml;base64,'+a+'") !important;')}}}}(jQuery,window,document);