编辑:svg-painter.js
/** * Attempt to re-color SVG icons used in the admin menu or the toolbar * * @output wp-admin/js/svg-painter.js */ window.wp = window.wp || {}; wp.svgPainter = ( function( $, window, document, undefined ) { 'use strict'; var selector, painter, colorscheme = {}, elements = []; $( function() { wp.svgPainter.init(); }); return { init: function() { painter = this; selector = $( '#adminmenu .wp-menu-image, #wpadminbar .ab-item' ); painter.setColors(); painter.findElements(); painter.paint(); }, setColors: function( colors ) { if ( typeof colors === 'undefined' && typeof window._wpColorScheme !== 'undefined' ) { colors = window._wpColorScheme; } if ( colors && colors.icons && colors.icons.base && colors.icons.current && colors.icons.focus ) { colorscheme = colors.icons; } }, findElements: function() { selector.each( function() { var $this = $(this), bgImage = $this.css( 'background-image' ); if ( bgImage && bgImage.indexOf( 'data:image/svg+xml;base64' ) != -1 ) { elements.push( $this ); } }); }, paint: function() { // Loop through all elements. $.each( elements, function( index, $element ) { var $menuitem = $element.parent().parent(); if ( $menuitem.hasClass( 'current' ) || $menuitem.hasClass( 'wp-has-current-submenu' ) ) { // Paint icon in 'current' color. painter.paintElement( $element, 'current' ); } else { // Paint icon in base color. painter.paintElement( $element, 'base' ); // Set hover callbacks. $menuitem.on( 'mouseenter', function() { painter.paintElement( $element, 'focus' ); } ).on( 'mouseleave', function() { // Match the delay from hoverIntent. window.setTimeout( function() { painter.paintElement( $element, 'base' ); }, 100 ); } ); } }); }, paintElement: function( $element, colorType ) { var xml, encoded, color; if ( ! colorType || ! colorscheme.hasOwnProperty( colorType ) ) { return; } color = colorscheme[ colorType ]; // Only accept hex colors: #101 or #101010. if ( ! color.match( /^(#[0-9a-f]{3}|#[0-9a-f]{6})$/i ) ) { return; } xml = $element.data( 'wp-ui-svg-' + color ); if ( xml === 'none' ) { return; } if ( ! xml ) { encoded = $element.css( 'background-image' ).match( /.+data:image\/svg\+xml;base64,([A-Za-z0-9\+\/\=]+)/ ); if ( ! encoded || ! encoded[1] ) { $element.data( 'wp-ui-svg-' + color, 'none' ); return; } try { xml = window.atob( encoded[1] ); } catch ( error ) {} if ( xml ) { // Replace `fill` attributes. xml = xml.replace( /fill="(.+?)"/g, 'fill="' + color + '"'); // Replace `style` attributes. xml = xml.replace( /style="(.+?)"/g, 'style="fill:' + color + '"'); // Replace `fill` properties in `<style>` tags. xml = xml.replace( /fill:.*?;/g, 'fill: ' + color + ';'); xml = window.btoa( xml ); $element.data( 'wp-ui-svg-' + color, xml ); } else { $element.data( 'wp-ui-svg-' + color, 'none' ); return; } } $element.attr( 'style', 'background-image: url("data:image/svg+xml;base64,' + xml + '") !important;' ); } }; })( jQuery, window, document );
保存文件
位置:
home
/
fembzvrs
/
zimeza.com
/
wp-admin
/
js
批量上传
创建
创建
批量权限
批量删除
名称
权限
大小
修改时间
操作
↑ 返回上级
-
-
-
-
widgets
drwxr-xr-x
-
2025-07-06 02:11
权限
删除
重命名
accordion.js
-rw-r--r--
2.86 KB
2024-10-13 23:09
编辑
下载
权限
删除
重命名
accordion.min.js
-rw-r--r--
758 B
2025-02-06 22:27
编辑
下载
权限
删除
重命名
color-picker.js
-rw-r--r--
9.54 KB
2021-03-18 23:01
编辑
下载
权限
删除
重命名
color-picker.min.js
-rw-r--r--
3.4 KB
2025-02-06 22:27
编辑
下载
权限
删除
重命名
customize-nav-menus.min.js
-rw-r--r--
47.14 KB
2025-12-03 02:17
编辑
下载
权限
删除
重命名
inline-edit-tax.js
-rw-r--r--
7.61 KB
2021-03-18 23:01
编辑
下载
权限
删除
重命名
inline-edit-tax.min.js
-rw-r--r--
2.93 KB
2025-02-06 22:27
编辑
下载
权限
删除
重命名
language-chooser.min.js
-rw-r--r--
423 B
2021-02-24 00:45
编辑
下载
权限
删除
重命名
media-gallery.js
-rw-r--r--
1.27 KB
2021-02-24 00:45
编辑
下载
权限
删除
重命名
media-gallery.min.js
-rw-r--r--
611 B
2022-04-09 00:07
编辑
下载
权限
删除
重命名
media-upload.min.js
-rw-r--r--
1.13 KB
2025-02-06 22:27
编辑
下载
权限
删除
重命名
password-strength-meter.min.js
-rw-r--r--
1.1 KB
2025-02-06 22:27
编辑
下载
权限
删除
重命名
site-health.js
-rw-r--r--
13.15 KB
2023-12-28 20:27
编辑
下载
权限
删除
重命名
site-health.min.js
-rw-r--r--
6.13 KB
2025-02-06 22:27
编辑
下载
权限
删除
重命名
site-icon.min.js
-rw-r--r--
2.2 KB
2025-02-06 22:27
编辑
下载
权限
删除
重命名
svg-painter.js
-rw-r--r--
3.2 KB
2024-09-08 02:44
编辑
下载
权限
删除
重命名
svg-painter.min.js
-rw-r--r--
1.53 KB
2025-02-06 22:27
编辑
下载
权限
删除
重命名
tags-box.js
-rw-r--r--
10.88 KB
2021-03-18 23:01
编辑
下载
权限
删除
重命名
tags-box.min.js
-rw-r--r--
3 KB
2025-02-06 22:27
编辑
下载
权限
删除
重命名
tags-suggest.js
-rw-r--r--
5.64 KB
2024-02-19 03:16
编辑
下载
权限
删除
重命名
tags-suggest.min.js
-rw-r--r--
2.22 KB
2025-02-06 22:27
编辑
下载
权限
删除
重命名
tags.js
-rw-r--r--
5.96 KB
2025-12-03 02:17
编辑
下载
权限
删除
重命名
tags.min.js
-rw-r--r--
2.41 KB
2025-12-03 02:17
编辑
下载
权限
删除
重命名
user-suggest.min.js
-rw-r--r--
676 B
2025-02-06 22:27
编辑
下载
权限
删除
重命名
xfn.js
-rw-r--r--
740 B
2021-03-18 23:01
编辑
下载
权限
删除
重命名
xfn.min.js
-rw-r--r--
458 B
2021-03-18 23:01
编辑
下载
权限
删除
重命名