2013-12-03 23:37:09 -05:00
|
|
|
/**
|
|
|
|
* Attempt to re-color SVG icons used in the admin menu or the toolbar
|
|
|
|
*
|
2018-06-27 22:30:15 -04:00
|
|
|
* @output wp-admin/js/svg-painter.js
|
2013-12-03 23:37:09 -05:00
|
|
|
*/
|
2013-12-05 17:01:10 -05:00
|
|
|
|
|
|
|
window.wp = window.wp || {};
|
|
|
|
|
|
|
|
wp.svgPainter = ( function( $, window, document, undefined ) {
|
Say hello to a fresh new look for the WordPress admin.
Still to come: more color schemes, a responsive component, and more.
see #25858.
props iammattthomas, tillkruess, EmpireOfLight, melchoyce, ryelle, joen, mitchoyoshitaka, sirbrillig, andypeatling, isaackeyet, Otto42, dd32, matt, helen.
Built from https://develop.svn.wordpress.org/trunk@26072
git-svn-id: http://core.svn.wordpress.org/trunk@25992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-09 19:27:10 -05:00
|
|
|
'use strict';
|
2013-12-05 17:01:10 -05:00
|
|
|
var selector, base64, painter,
|
2013-12-03 23:37:09 -05:00
|
|
|
colorscheme = {},
|
2013-12-03 23:13:11 -05:00
|
|
|
elements = [];
|
Say hello to a fresh new look for the WordPress admin.
Still to come: more color schemes, a responsive component, and more.
see #25858.
props iammattthomas, tillkruess, EmpireOfLight, melchoyce, ryelle, joen, mitchoyoshitaka, sirbrillig, andypeatling, isaackeyet, Otto42, dd32, matt, helen.
Built from https://develop.svn.wordpress.org/trunk@26072
git-svn-id: http://core.svn.wordpress.org/trunk@25992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-09 19:27:10 -05:00
|
|
|
|
|
|
|
$(document).ready( function() {
|
2020-01-28 19:45:18 -05:00
|
|
|
// Detection for browser SVG capability.
|
Say hello to a fresh new look for the WordPress admin.
Still to come: more color schemes, a responsive component, and more.
see #25858.
props iammattthomas, tillkruess, EmpireOfLight, melchoyce, ryelle, joen, mitchoyoshitaka, sirbrillig, andypeatling, isaackeyet, Otto42, dd32, matt, helen.
Built from https://develop.svn.wordpress.org/trunk@26072
git-svn-id: http://core.svn.wordpress.org/trunk@25992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-09 19:27:10 -05:00
|
|
|
if ( document.implementation.hasFeature( 'http://www.w3.org/TR/SVG11/feature#Image', '1.1' ) ) {
|
2013-12-03 23:13:11 -05:00
|
|
|
$( document.body ).removeClass( 'no-svg' ).addClass( 'svg' );
|
2013-12-05 17:01:10 -05:00
|
|
|
wp.svgPainter.init();
|
Say hello to a fresh new look for the WordPress admin.
Still to come: more color schemes, a responsive component, and more.
see #25858.
props iammattthomas, tillkruess, EmpireOfLight, melchoyce, ryelle, joen, mitchoyoshitaka, sirbrillig, andypeatling, isaackeyet, Otto42, dd32, matt, helen.
Built from https://develop.svn.wordpress.org/trunk@26072
git-svn-id: http://core.svn.wordpress.org/trunk@25992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-09 19:27:10 -05:00
|
|
|
}
|
2013-12-03 23:13:11 -05:00
|
|
|
});
|
Say hello to a fresh new look for the WordPress admin.
Still to come: more color schemes, a responsive component, and more.
see #25858.
props iammattthomas, tillkruess, EmpireOfLight, melchoyce, ryelle, joen, mitchoyoshitaka, sirbrillig, andypeatling, isaackeyet, Otto42, dd32, matt, helen.
Built from https://develop.svn.wordpress.org/trunk@26072
git-svn-id: http://core.svn.wordpress.org/trunk@25992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-09 19:27:10 -05:00
|
|
|
|
2013-12-03 23:13:11 -05:00
|
|
|
/**
|
|
|
|
* Needed only for IE9
|
|
|
|
*
|
|
|
|
* Based on jquery.base64.js 0.0.3 - https://github.com/yckart/jquery.base64.js
|
|
|
|
*
|
|
|
|
* Based on: https://gist.github.com/Yaffle/1284012
|
|
|
|
*
|
|
|
|
* Copyright (c) 2012 Yannick Albert (http://yckart.com)
|
|
|
|
* Licensed under the MIT license
|
|
|
|
* http://www.opensource.org/licenses/mit-license.php
|
|
|
|
*/
|
|
|
|
base64 = ( function() {
|
|
|
|
var c,
|
|
|
|
b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',
|
|
|
|
a256 = '',
|
|
|
|
r64 = [256],
|
|
|
|
r256 = [256],
|
|
|
|
i = 0;
|
|
|
|
|
2013-12-05 17:01:10 -05:00
|
|
|
function init() {
|
|
|
|
while( i < 256 ) {
|
|
|
|
c = String.fromCharCode(i);
|
|
|
|
a256 += c;
|
|
|
|
r256[i] = i;
|
|
|
|
r64[i] = b64.indexOf(c);
|
|
|
|
++i;
|
|
|
|
}
|
2013-12-03 23:13:11 -05:00
|
|
|
}
|
Say hello to a fresh new look for the WordPress admin.
Still to come: more color schemes, a responsive component, and more.
see #25858.
props iammattthomas, tillkruess, EmpireOfLight, melchoyce, ryelle, joen, mitchoyoshitaka, sirbrillig, andypeatling, isaackeyet, Otto42, dd32, matt, helen.
Built from https://develop.svn.wordpress.org/trunk@26072
git-svn-id: http://core.svn.wordpress.org/trunk@25992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-09 19:27:10 -05:00
|
|
|
|
2013-12-03 23:13:11 -05:00
|
|
|
function code( s, discard, alpha, beta, w1, w2 ) {
|
|
|
|
var tmp, length,
|
|
|
|
buffer = 0,
|
|
|
|
i = 0,
|
|
|
|
result = '',
|
|
|
|
bitsInBuffer = 0;
|
Say hello to a fresh new look for the WordPress admin.
Still to come: more color schemes, a responsive component, and more.
see #25858.
props iammattthomas, tillkruess, EmpireOfLight, melchoyce, ryelle, joen, mitchoyoshitaka, sirbrillig, andypeatling, isaackeyet, Otto42, dd32, matt, helen.
Built from https://develop.svn.wordpress.org/trunk@26072
git-svn-id: http://core.svn.wordpress.org/trunk@25992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-09 19:27:10 -05:00
|
|
|
|
2013-12-03 23:13:11 -05:00
|
|
|
s = String(s);
|
|
|
|
length = s.length;
|
Say hello to a fresh new look for the WordPress admin.
Still to come: more color schemes, a responsive component, and more.
see #25858.
props iammattthomas, tillkruess, EmpireOfLight, melchoyce, ryelle, joen, mitchoyoshitaka, sirbrillig, andypeatling, isaackeyet, Otto42, dd32, matt, helen.
Built from https://develop.svn.wordpress.org/trunk@26072
git-svn-id: http://core.svn.wordpress.org/trunk@25992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-09 19:27:10 -05:00
|
|
|
|
2013-12-03 23:13:11 -05:00
|
|
|
while( i < length ) {
|
|
|
|
c = s.charCodeAt(i);
|
|
|
|
c = c < 256 ? alpha[c] : -1;
|
Say hello to a fresh new look for the WordPress admin.
Still to come: more color schemes, a responsive component, and more.
see #25858.
props iammattthomas, tillkruess, EmpireOfLight, melchoyce, ryelle, joen, mitchoyoshitaka, sirbrillig, andypeatling, isaackeyet, Otto42, dd32, matt, helen.
Built from https://develop.svn.wordpress.org/trunk@26072
git-svn-id: http://core.svn.wordpress.org/trunk@25992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-09 19:27:10 -05:00
|
|
|
|
2013-12-03 23:13:11 -05:00
|
|
|
buffer = ( buffer << w1 ) + c;
|
|
|
|
bitsInBuffer += w1;
|
Say hello to a fresh new look for the WordPress admin.
Still to come: more color schemes, a responsive component, and more.
see #25858.
props iammattthomas, tillkruess, EmpireOfLight, melchoyce, ryelle, joen, mitchoyoshitaka, sirbrillig, andypeatling, isaackeyet, Otto42, dd32, matt, helen.
Built from https://develop.svn.wordpress.org/trunk@26072
git-svn-id: http://core.svn.wordpress.org/trunk@25992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-09 19:27:10 -05:00
|
|
|
|
2013-12-03 23:13:11 -05:00
|
|
|
while( bitsInBuffer >= w2 ) {
|
|
|
|
bitsInBuffer -= w2;
|
|
|
|
tmp = buffer >> bitsInBuffer;
|
|
|
|
result += beta.charAt(tmp);
|
|
|
|
buffer ^= tmp << bitsInBuffer;
|
|
|
|
}
|
|
|
|
++i;
|
|
|
|
}
|
Say hello to a fresh new look for the WordPress admin.
Still to come: more color schemes, a responsive component, and more.
see #25858.
props iammattthomas, tillkruess, EmpireOfLight, melchoyce, ryelle, joen, mitchoyoshitaka, sirbrillig, andypeatling, isaackeyet, Otto42, dd32, matt, helen.
Built from https://develop.svn.wordpress.org/trunk@26072
git-svn-id: http://core.svn.wordpress.org/trunk@25992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-09 19:27:10 -05:00
|
|
|
|
2013-12-03 23:13:11 -05:00
|
|
|
if ( ! discard && bitsInBuffer > 0 ) {
|
|
|
|
result += beta.charAt( buffer << ( w2 - bitsInBuffer ) );
|
|
|
|
}
|
Say hello to a fresh new look for the WordPress admin.
Still to come: more color schemes, a responsive component, and more.
see #25858.
props iammattthomas, tillkruess, EmpireOfLight, melchoyce, ryelle, joen, mitchoyoshitaka, sirbrillig, andypeatling, isaackeyet, Otto42, dd32, matt, helen.
Built from https://develop.svn.wordpress.org/trunk@26072
git-svn-id: http://core.svn.wordpress.org/trunk@25992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-09 19:27:10 -05:00
|
|
|
|
2013-12-03 23:13:11 -05:00
|
|
|
return result;
|
|
|
|
}
|
Say hello to a fresh new look for the WordPress admin.
Still to come: more color schemes, a responsive component, and more.
see #25858.
props iammattthomas, tillkruess, EmpireOfLight, melchoyce, ryelle, joen, mitchoyoshitaka, sirbrillig, andypeatling, isaackeyet, Otto42, dd32, matt, helen.
Built from https://develop.svn.wordpress.org/trunk@26072
git-svn-id: http://core.svn.wordpress.org/trunk@25992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-09 19:27:10 -05:00
|
|
|
|
2013-12-03 23:13:11 -05:00
|
|
|
function btoa( plain ) {
|
2013-12-05 17:01:10 -05:00
|
|
|
if ( ! c ) {
|
|
|
|
init();
|
|
|
|
}
|
|
|
|
|
2013-12-03 23:13:11 -05:00
|
|
|
plain = code( plain, false, r256, b64, 8, 6 );
|
|
|
|
return plain + '===='.slice( ( plain.length % 4 ) || 4 );
|
|
|
|
}
|
Say hello to a fresh new look for the WordPress admin.
Still to come: more color schemes, a responsive component, and more.
see #25858.
props iammattthomas, tillkruess, EmpireOfLight, melchoyce, ryelle, joen, mitchoyoshitaka, sirbrillig, andypeatling, isaackeyet, Otto42, dd32, matt, helen.
Built from https://develop.svn.wordpress.org/trunk@26072
git-svn-id: http://core.svn.wordpress.org/trunk@25992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-09 19:27:10 -05:00
|
|
|
|
2013-12-03 23:13:11 -05:00
|
|
|
function atob( coded ) {
|
|
|
|
var i;
|
Say hello to a fresh new look for the WordPress admin.
Still to come: more color schemes, a responsive component, and more.
see #25858.
props iammattthomas, tillkruess, EmpireOfLight, melchoyce, ryelle, joen, mitchoyoshitaka, sirbrillig, andypeatling, isaackeyet, Otto42, dd32, matt, helen.
Built from https://develop.svn.wordpress.org/trunk@26072
git-svn-id: http://core.svn.wordpress.org/trunk@25992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-09 19:27:10 -05:00
|
|
|
|
2013-12-05 17:01:10 -05:00
|
|
|
if ( ! c ) {
|
|
|
|
init();
|
|
|
|
}
|
|
|
|
|
2013-12-03 23:13:11 -05:00
|
|
|
coded = coded.replace( /[^A-Za-z0-9\+\/\=]/g, '' );
|
|
|
|
coded = String(coded).split('=');
|
|
|
|
i = coded.length;
|
Say hello to a fresh new look for the WordPress admin.
Still to come: more color schemes, a responsive component, and more.
see #25858.
props iammattthomas, tillkruess, EmpireOfLight, melchoyce, ryelle, joen, mitchoyoshitaka, sirbrillig, andypeatling, isaackeyet, Otto42, dd32, matt, helen.
Built from https://develop.svn.wordpress.org/trunk@26072
git-svn-id: http://core.svn.wordpress.org/trunk@25992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-09 19:27:10 -05:00
|
|
|
|
2013-12-03 23:13:11 -05:00
|
|
|
do {
|
|
|
|
--i;
|
|
|
|
coded[i] = code( coded[i], true, r64, a256, 6, 8 );
|
|
|
|
} while ( i > 0 );
|
Say hello to a fresh new look for the WordPress admin.
Still to come: more color schemes, a responsive component, and more.
see #25858.
props iammattthomas, tillkruess, EmpireOfLight, melchoyce, ryelle, joen, mitchoyoshitaka, sirbrillig, andypeatling, isaackeyet, Otto42, dd32, matt, helen.
Built from https://develop.svn.wordpress.org/trunk@26072
git-svn-id: http://core.svn.wordpress.org/trunk@25992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-09 19:27:10 -05:00
|
|
|
|
2013-12-03 23:13:11 -05:00
|
|
|
coded = coded.join('');
|
|
|
|
return coded;
|
|
|
|
}
|
Say hello to a fresh new look for the WordPress admin.
Still to come: more color schemes, a responsive component, and more.
see #25858.
props iammattthomas, tillkruess, EmpireOfLight, melchoyce, ryelle, joen, mitchoyoshitaka, sirbrillig, andypeatling, isaackeyet, Otto42, dd32, matt, helen.
Built from https://develop.svn.wordpress.org/trunk@26072
git-svn-id: http://core.svn.wordpress.org/trunk@25992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-09 19:27:10 -05:00
|
|
|
|
2013-12-03 23:13:11 -05:00
|
|
|
return {
|
|
|
|
atob: atob,
|
|
|
|
btoa: btoa
|
|
|
|
};
|
|
|
|
})();
|
Say hello to a fresh new look for the WordPress admin.
Still to come: more color schemes, a responsive component, and more.
see #25858.
props iammattthomas, tillkruess, EmpireOfLight, melchoyce, ryelle, joen, mitchoyoshitaka, sirbrillig, andypeatling, isaackeyet, Otto42, dd32, matt, helen.
Built from https://develop.svn.wordpress.org/trunk@26072
git-svn-id: http://core.svn.wordpress.org/trunk@25992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-09 19:27:10 -05:00
|
|
|
|
2013-12-03 23:13:11 -05:00
|
|
|
return {
|
|
|
|
init: function() {
|
2013-12-05 17:01:10 -05:00
|
|
|
painter = this;
|
2013-12-03 23:13:11 -05:00
|
|
|
selector = $( '#adminmenu .wp-menu-image, #wpadminbar .ab-item' );
|
Say hello to a fresh new look for the WordPress admin.
Still to come: more color schemes, a responsive component, and more.
see #25858.
props iammattthomas, tillkruess, EmpireOfLight, melchoyce, ryelle, joen, mitchoyoshitaka, sirbrillig, andypeatling, isaackeyet, Otto42, dd32, matt, helen.
Built from https://develop.svn.wordpress.org/trunk@26072
git-svn-id: http://core.svn.wordpress.org/trunk@25992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-09 19:27:10 -05:00
|
|
|
|
2013-12-03 23:13:11 -05:00
|
|
|
this.setColors();
|
|
|
|
this.findElements();
|
|
|
|
this.paint();
|
|
|
|
},
|
Say hello to a fresh new look for the WordPress admin.
Still to come: more color schemes, a responsive component, and more.
see #25858.
props iammattthomas, tillkruess, EmpireOfLight, melchoyce, ryelle, joen, mitchoyoshitaka, sirbrillig, andypeatling, isaackeyet, Otto42, dd32, matt, helen.
Built from https://develop.svn.wordpress.org/trunk@26072
git-svn-id: http://core.svn.wordpress.org/trunk@25992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-09 19:27:10 -05:00
|
|
|
|
2013-12-03 23:13:11 -05:00
|
|
|
setColors: function( colors ) {
|
|
|
|
if ( typeof colors === 'undefined' && typeof window._wpColorScheme !== 'undefined' ) {
|
|
|
|
colors = window._wpColorScheme;
|
|
|
|
}
|
Say hello to a fresh new look for the WordPress admin.
Still to come: more color schemes, a responsive component, and more.
see #25858.
props iammattthomas, tillkruess, EmpireOfLight, melchoyce, ryelle, joen, mitchoyoshitaka, sirbrillig, andypeatling, isaackeyet, Otto42, dd32, matt, helen.
Built from https://develop.svn.wordpress.org/trunk@26072
git-svn-id: http://core.svn.wordpress.org/trunk@25992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-09 19:27:10 -05:00
|
|
|
|
2013-12-03 23:13:11 -05:00
|
|
|
if ( colors && colors.icons && colors.icons.base && colors.icons.current && colors.icons.focus ) {
|
|
|
|
colorscheme = colors.icons;
|
|
|
|
}
|
Say hello to a fresh new look for the WordPress admin.
Still to come: more color schemes, a responsive component, and more.
see #25858.
props iammattthomas, tillkruess, EmpireOfLight, melchoyce, ryelle, joen, mitchoyoshitaka, sirbrillig, andypeatling, isaackeyet, Otto42, dd32, matt, helen.
Built from https://develop.svn.wordpress.org/trunk@26072
git-svn-id: http://core.svn.wordpress.org/trunk@25992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-09 19:27:10 -05:00
|
|
|
},
|
|
|
|
|
2013-12-03 23:13:11 -05:00
|
|
|
findElements: function() {
|
|
|
|
selector.each( function() {
|
|
|
|
var $this = $(this), bgImage = $this.css( 'background-image' );
|
Say hello to a fresh new look for the WordPress admin.
Still to come: more color schemes, a responsive component, and more.
see #25858.
props iammattthomas, tillkruess, EmpireOfLight, melchoyce, ryelle, joen, mitchoyoshitaka, sirbrillig, andypeatling, isaackeyet, Otto42, dd32, matt, helen.
Built from https://develop.svn.wordpress.org/trunk@26072
git-svn-id: http://core.svn.wordpress.org/trunk@25992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-09 19:27:10 -05:00
|
|
|
|
2013-12-03 23:13:11 -05:00
|
|
|
if ( bgImage && bgImage.indexOf( 'data:image/svg+xml;base64' ) != -1 ) {
|
|
|
|
elements.push( $this );
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
Say hello to a fresh new look for the WordPress admin.
Still to come: more color schemes, a responsive component, and more.
see #25858.
props iammattthomas, tillkruess, EmpireOfLight, melchoyce, ryelle, joen, mitchoyoshitaka, sirbrillig, andypeatling, isaackeyet, Otto42, dd32, matt, helen.
Built from https://develop.svn.wordpress.org/trunk@26072
git-svn-id: http://core.svn.wordpress.org/trunk@25992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-09 19:27:10 -05:00
|
|
|
|
2013-12-03 23:13:11 -05:00
|
|
|
paint: function() {
|
2020-01-28 19:45:18 -05:00
|
|
|
// Loop through all elements.
|
2013-12-03 23:13:11 -05:00
|
|
|
$.each( elements, function( index, $element ) {
|
Say hello to a fresh new look for the WordPress admin.
Still to come: more color schemes, a responsive component, and more.
see #25858.
props iammattthomas, tillkruess, EmpireOfLight, melchoyce, ryelle, joen, mitchoyoshitaka, sirbrillig, andypeatling, isaackeyet, Otto42, dd32, matt, helen.
Built from https://develop.svn.wordpress.org/trunk@26072
git-svn-id: http://core.svn.wordpress.org/trunk@25992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-09 19:27:10 -05:00
|
|
|
var $menuitem = $element.parent().parent();
|
|
|
|
|
|
|
|
if ( $menuitem.hasClass( 'current' ) || $menuitem.hasClass( 'wp-has-current-submenu' ) ) {
|
2020-01-28 19:45:18 -05:00
|
|
|
// Paint icon in 'current' color.
|
2013-12-05 17:01:10 -05:00
|
|
|
painter.paintElement( $element, 'current' );
|
Say hello to a fresh new look for the WordPress admin.
Still to come: more color schemes, a responsive component, and more.
see #25858.
props iammattthomas, tillkruess, EmpireOfLight, melchoyce, ryelle, joen, mitchoyoshitaka, sirbrillig, andypeatling, isaackeyet, Otto42, dd32, matt, helen.
Built from https://develop.svn.wordpress.org/trunk@26072
git-svn-id: http://core.svn.wordpress.org/trunk@25992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-09 19:27:10 -05:00
|
|
|
} else {
|
2020-01-28 19:45:18 -05:00
|
|
|
// Paint icon in base color.
|
2013-12-05 17:01:10 -05:00
|
|
|
painter.paintElement( $element, 'base' );
|
Say hello to a fresh new look for the WordPress admin.
Still to come: more color schemes, a responsive component, and more.
see #25858.
props iammattthomas, tillkruess, EmpireOfLight, melchoyce, ryelle, joen, mitchoyoshitaka, sirbrillig, andypeatling, isaackeyet, Otto42, dd32, matt, helen.
Built from https://develop.svn.wordpress.org/trunk@26072
git-svn-id: http://core.svn.wordpress.org/trunk@25992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-09 19:27:10 -05:00
|
|
|
|
2020-01-28 19:45:18 -05:00
|
|
|
// Set hover callbacks.
|
2021-02-23 14:45:04 -05:00
|
|
|
$menuitem.on( 'mouseenter', function() {
|
|
|
|
painter.paintElement( $element, 'focus' );
|
|
|
|
} ).on( 'mouseleave', function() {
|
|
|
|
// Match the delay from hoverIntent.
|
|
|
|
window.setTimeout( function() {
|
|
|
|
painter.paintElement( $element, 'base' );
|
|
|
|
}, 100 );
|
|
|
|
} );
|
Say hello to a fresh new look for the WordPress admin.
Still to come: more color schemes, a responsive component, and more.
see #25858.
props iammattthomas, tillkruess, EmpireOfLight, melchoyce, ryelle, joen, mitchoyoshitaka, sirbrillig, andypeatling, isaackeyet, Otto42, dd32, matt, helen.
Built from https://develop.svn.wordpress.org/trunk@26072
git-svn-id: http://core.svn.wordpress.org/trunk@25992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-09 19:27:10 -05:00
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2013-12-03 23:13:11 -05:00
|
|
|
paintElement: function( $element, colorType ) {
|
|
|
|
var xml, encoded, color;
|
|
|
|
|
|
|
|
if ( ! colorType || ! colorscheme.hasOwnProperty( colorType ) ) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
color = colorscheme[ colorType ];
|
Say hello to a fresh new look for the WordPress admin.
Still to come: more color schemes, a responsive component, and more.
see #25858.
props iammattthomas, tillkruess, EmpireOfLight, melchoyce, ryelle, joen, mitchoyoshitaka, sirbrillig, andypeatling, isaackeyet, Otto42, dd32, matt, helen.
Built from https://develop.svn.wordpress.org/trunk@26072
git-svn-id: http://core.svn.wordpress.org/trunk@25992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-09 19:27:10 -05:00
|
|
|
|
2020-01-28 19:45:18 -05:00
|
|
|
// Only accept hex colors: #101 or #101010.
|
2013-12-03 23:13:11 -05:00
|
|
|
if ( ! color.match( /^(#[0-9a-f]{3}|#[0-9a-f]{6})$/i ) ) {
|
Say hello to a fresh new look for the WordPress admin.
Still to come: more color schemes, a responsive component, and more.
see #25858.
props iammattthomas, tillkruess, EmpireOfLight, melchoyce, ryelle, joen, mitchoyoshitaka, sirbrillig, andypeatling, isaackeyet, Otto42, dd32, matt, helen.
Built from https://develop.svn.wordpress.org/trunk@26072
git-svn-id: http://core.svn.wordpress.org/trunk@25992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-09 19:27:10 -05:00
|
|
|
return;
|
2013-12-03 23:13:11 -05:00
|
|
|
}
|
Say hello to a fresh new look for the WordPress admin.
Still to come: more color schemes, a responsive component, and more.
see #25858.
props iammattthomas, tillkruess, EmpireOfLight, melchoyce, ryelle, joen, mitchoyoshitaka, sirbrillig, andypeatling, isaackeyet, Otto42, dd32, matt, helen.
Built from https://develop.svn.wordpress.org/trunk@26072
git-svn-id: http://core.svn.wordpress.org/trunk@25992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-09 19:27:10 -05:00
|
|
|
|
2013-12-04 16:16:11 -05:00
|
|
|
xml = $element.data( 'wp-ui-svg-' + color );
|
Say hello to a fresh new look for the WordPress admin.
Still to come: more color schemes, a responsive component, and more.
see #25858.
props iammattthomas, tillkruess, EmpireOfLight, melchoyce, ryelle, joen, mitchoyoshitaka, sirbrillig, andypeatling, isaackeyet, Otto42, dd32, matt, helen.
Built from https://develop.svn.wordpress.org/trunk@26072
git-svn-id: http://core.svn.wordpress.org/trunk@25992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-09 19:27:10 -05:00
|
|
|
|
2013-12-05 17:01:10 -05:00
|
|
|
if ( xml === 'none' ) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
Say hello to a fresh new look for the WordPress admin.
Still to come: more color schemes, a responsive component, and more.
see #25858.
props iammattthomas, tillkruess, EmpireOfLight, melchoyce, ryelle, joen, mitchoyoshitaka, sirbrillig, andypeatling, isaackeyet, Otto42, dd32, matt, helen.
Built from https://develop.svn.wordpress.org/trunk@26072
git-svn-id: http://core.svn.wordpress.org/trunk@25992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-09 19:27:10 -05:00
|
|
|
if ( ! xml ) {
|
2013-12-05 17:01:10 -05:00
|
|
|
encoded = $element.css( 'background-image' ).match( /.+data:image\/svg\+xml;base64,([A-Za-z0-9\+\/\=]+)/ );
|
Say hello to a fresh new look for the WordPress admin.
Still to come: more color schemes, a responsive component, and more.
see #25858.
props iammattthomas, tillkruess, EmpireOfLight, melchoyce, ryelle, joen, mitchoyoshitaka, sirbrillig, andypeatling, isaackeyet, Otto42, dd32, matt, helen.
Built from https://develop.svn.wordpress.org/trunk@26072
git-svn-id: http://core.svn.wordpress.org/trunk@25992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-09 19:27:10 -05:00
|
|
|
|
2013-12-03 23:13:11 -05:00
|
|
|
if ( ! encoded || ! encoded[1] ) {
|
2013-12-05 17:01:10 -05:00
|
|
|
$element.data( 'wp-ui-svg-' + color, 'none' );
|
Say hello to a fresh new look for the WordPress admin.
Still to come: more color schemes, a responsive component, and more.
see #25858.
props iammattthomas, tillkruess, EmpireOfLight, melchoyce, ryelle, joen, mitchoyoshitaka, sirbrillig, andypeatling, isaackeyet, Otto42, dd32, matt, helen.
Built from https://develop.svn.wordpress.org/trunk@26072
git-svn-id: http://core.svn.wordpress.org/trunk@25992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-09 19:27:10 -05:00
|
|
|
return;
|
2013-12-03 23:13:11 -05:00
|
|
|
}
|
Say hello to a fresh new look for the WordPress admin.
Still to come: more color schemes, a responsive component, and more.
see #25858.
props iammattthomas, tillkruess, EmpireOfLight, melchoyce, ryelle, joen, mitchoyoshitaka, sirbrillig, andypeatling, isaackeyet, Otto42, dd32, matt, helen.
Built from https://develop.svn.wordpress.org/trunk@26072
git-svn-id: http://core.svn.wordpress.org/trunk@25992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-09 19:27:10 -05:00
|
|
|
|
2013-12-05 17:01:10 -05:00
|
|
|
try {
|
|
|
|
if ( 'atob' in window ) {
|
|
|
|
xml = window.atob( encoded[1] );
|
|
|
|
} else {
|
|
|
|
xml = base64.atob( encoded[1] );
|
|
|
|
}
|
|
|
|
} catch ( error ) {}
|
|
|
|
|
|
|
|
if ( xml ) {
|
2020-01-28 19:45:18 -05:00
|
|
|
// Replace `fill` attributes.
|
2013-12-05 17:01:10 -05:00
|
|
|
xml = xml.replace( /fill="(.+?)"/g, 'fill="' + color + '"');
|
Say hello to a fresh new look for the WordPress admin.
Still to come: more color schemes, a responsive component, and more.
see #25858.
props iammattthomas, tillkruess, EmpireOfLight, melchoyce, ryelle, joen, mitchoyoshitaka, sirbrillig, andypeatling, isaackeyet, Otto42, dd32, matt, helen.
Built from https://develop.svn.wordpress.org/trunk@26072
git-svn-id: http://core.svn.wordpress.org/trunk@25992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-09 19:27:10 -05:00
|
|
|
|
2020-01-28 19:45:18 -05:00
|
|
|
// Replace `style` attributes.
|
2013-12-05 17:01:10 -05:00
|
|
|
xml = xml.replace( /style="(.+?)"/g, 'style="fill:' + color + '"');
|
Say hello to a fresh new look for the WordPress admin.
Still to come: more color schemes, a responsive component, and more.
see #25858.
props iammattthomas, tillkruess, EmpireOfLight, melchoyce, ryelle, joen, mitchoyoshitaka, sirbrillig, andypeatling, isaackeyet, Otto42, dd32, matt, helen.
Built from https://develop.svn.wordpress.org/trunk@26072
git-svn-id: http://core.svn.wordpress.org/trunk@25992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-09 19:27:10 -05:00
|
|
|
|
2020-01-28 19:45:18 -05:00
|
|
|
// Replace `fill` properties in `<style>` tags.
|
2013-12-05 17:01:10 -05:00
|
|
|
xml = xml.replace( /fill:.*?;/g, 'fill: ' + color + ';');
|
Say hello to a fresh new look for the WordPress admin.
Still to come: more color schemes, a responsive component, and more.
see #25858.
props iammattthomas, tillkruess, EmpireOfLight, melchoyce, ryelle, joen, mitchoyoshitaka, sirbrillig, andypeatling, isaackeyet, Otto42, dd32, matt, helen.
Built from https://develop.svn.wordpress.org/trunk@26072
git-svn-id: http://core.svn.wordpress.org/trunk@25992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-09 19:27:10 -05:00
|
|
|
|
2013-12-05 17:01:10 -05:00
|
|
|
if ( 'btoa' in window ) {
|
|
|
|
xml = window.btoa( xml );
|
|
|
|
} else {
|
|
|
|
xml = base64.btoa( xml );
|
|
|
|
}
|
Say hello to a fresh new look for the WordPress admin.
Still to come: more color schemes, a responsive component, and more.
see #25858.
props iammattthomas, tillkruess, EmpireOfLight, melchoyce, ryelle, joen, mitchoyoshitaka, sirbrillig, andypeatling, isaackeyet, Otto42, dd32, matt, helen.
Built from https://develop.svn.wordpress.org/trunk@26072
git-svn-id: http://core.svn.wordpress.org/trunk@25992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-09 19:27:10 -05:00
|
|
|
|
2013-12-05 17:01:10 -05:00
|
|
|
$element.data( 'wp-ui-svg-' + color, xml );
|
2013-12-03 23:13:11 -05:00
|
|
|
} else {
|
2013-12-05 17:01:10 -05:00
|
|
|
$element.data( 'wp-ui-svg-' + color, 'none' );
|
|
|
|
return;
|
Say hello to a fresh new look for the WordPress admin.
Still to come: more color schemes, a responsive component, and more.
see #25858.
props iammattthomas, tillkruess, EmpireOfLight, melchoyce, ryelle, joen, mitchoyoshitaka, sirbrillig, andypeatling, isaackeyet, Otto42, dd32, matt, helen.
Built from https://develop.svn.wordpress.org/trunk@26072
git-svn-id: http://core.svn.wordpress.org/trunk@25992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-09 19:27:10 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-12-05 17:01:10 -05:00
|
|
|
$element.attr( 'style', 'background-image: url("data:image/svg+xml;base64,' + xml + '") !important;' );
|
Say hello to a fresh new look for the WordPress admin.
Still to come: more color schemes, a responsive component, and more.
see #25858.
props iammattthomas, tillkruess, EmpireOfLight, melchoyce, ryelle, joen, mitchoyoshitaka, sirbrillig, andypeatling, isaackeyet, Otto42, dd32, matt, helen.
Built from https://develop.svn.wordpress.org/trunk@26072
git-svn-id: http://core.svn.wordpress.org/trunk@25992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-09 19:27:10 -05:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
})( jQuery, window, document );
|