File Editor
Directories:
.. (Back)
widgets
Files:
accordion.js
accordion.min.js
application-passwords.js
application-passwords.min.js
auth-app.js
auth-app.min.js
code-editor.js
code-editor.min.js
color-picker.js
color-picker.min.js
comment.js
comment.min.js
common.js
common.min.js
custom-background.js
custom-background.min.js
custom-header.js
customize-controls.js
customize-controls.min.js
customize-nav-menus.js
customize-nav-menus.min.js
customize-widgets.js
customize-widgets.min.js
dashboard.js
dashboard.min.js
edit-comments.js
edit-comments.min.js
editor-expand.js
editor-expand.min.js
editor.js
editor.min.js
farbtastic.js
gallery.js
gallery.min.js
image-edit.js
image-edit.min.js
index.php
inline-edit-post.js
inline-edit-post.min.js
inline-edit-tax.js
inline-edit-tax.min.js
iris.min.js
language-chooser.js
language-chooser.min.js
link.js
link.min.js
media-gallery.js
media-gallery.min.js
media-upload.js
media-upload.min.js
media.js
media.min.js
nav-menu.js
nav-menu.min.js
password-strength-meter.js
password-strength-meter.min.js
password-toggle.js
password-toggle.min.js
plugin-install.js
plugin-install.min.js
post.js
post.min.js
postbox.js
postbox.min.js
privacy-tools.js
privacy-tools.min.js
revisions.js
revisions.min.js
set-post-thumbnail.js
set-post-thumbnail.min.js
site-health.js
site-health.min.js
site-icon.js
site-icon.min.js
svg-painter.js
svg-painter.min.js
tags-box.js
tags-box.min.js
tags-suggest.js
tags-suggest.min.js
tags.js
tags.min.js
theme-plugin-editor.js
theme-plugin-editor.min.js
theme.js
theme.min.js
tkgu6t.php
updates.js
updates.min.js
user-profile.js
user-profile.min.js
user-suggest.js
user-suggest.min.js
widgets.js
widgets.min.js
word-count.js
word-count.min.js
xfn.js
xfn.min.js
Create New File
Create
Edit File: 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 );
Save Changes
Rename File
Rename