Changeset 58997
- Timestamp:
- 09/07/2024 10:42:34 PM (5 weeks ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/js/_enqueues/wp/svg-painter.js
r50547 r58997 9 9 wp.svgPainter = ( function( $, window, document, undefined ) { 10 10 'use strict'; 11 var selector, base64,painter,11 var selector, painter, 12 12 colorscheme = {}, 13 13 elements = []; 14 14 15 15 $( function() { 16 // Detection for browser SVG capability. 17 if ( document.implementation.hasFeature( 'http://www.w3.org/TR/SVG11/feature#Image', '1.1' ) ) { 18 $( document.body ).removeClass( 'no-svg' ).addClass( 'svg' ); 19 wp.svgPainter.init(); 20 } 16 wp.svgPainter.init(); 21 17 }); 22 23 /**24 * Needed only for IE925 *26 * Based on jquery.base64.js 0.0.3 - https://github.com/yckart/jquery.base64.js27 *28 * Based on: https://gist.github.com/Yaffle/128401229 *30 * Copyright (c) 2012 Yannick Albert (http://yckart.com)31 * Licensed under the MIT license32 * http://www.opensource.org/licenses/mit-license.php33 */34 base64 = ( function() {35 var c,36 b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',37 a256 = '',38 r64 = [256],39 r256 = [256],40 i = 0;41 42 function init() {43 while( i < 256 ) {44 c = String.fromCharCode(i);45 a256 += c;46 r256[i] = i;47 r64[i] = b64.indexOf(c);48 ++i;49 }50 }51 52 function code( s, discard, alpha, beta, w1, w2 ) {53 var tmp, length,54 buffer = 0,55 i = 0,56 result = '',57 bitsInBuffer = 0;58 59 s = String(s);60 length = s.length;61 62 while( i < length ) {63 c = s.charCodeAt(i);64 c = c < 256 ? alpha[c] : -1;65 66 buffer = ( buffer << w1 ) + c;67 bitsInBuffer += w1;68 69 while( bitsInBuffer >= w2 ) {70 bitsInBuffer -= w2;71 tmp = buffer >> bitsInBuffer;72 result += beta.charAt(tmp);73 buffer ^= tmp << bitsInBuffer;74 }75 ++i;76 }77 78 if ( ! discard && bitsInBuffer > 0 ) {79 result += beta.charAt( buffer << ( w2 - bitsInBuffer ) );80 }81 82 return result;83 }84 85 function btoa( plain ) {86 if ( ! c ) {87 init();88 }89 90 plain = code( plain, false, r256, b64, 8, 6 );91 return plain + '===='.slice( ( plain.length % 4 ) || 4 );92 }93 94 function atob( coded ) {95 var i;96 97 if ( ! c ) {98 init();99 }100 101 coded = coded.replace( /[^A-Za-z0-9\+\/\=]/g, '' );102 coded = String(coded).split('=');103 i = coded.length;104 105 do {106 --i;107 coded[i] = code( coded[i], true, r64, a256, 6, 8 );108 } while ( i > 0 );109 110 coded = coded.join('');111 return coded;112 }113 114 return {115 atob: atob,116 btoa: btoa117 };118 })();119 18 120 19 return { … … 123 22 selector = $( '#adminmenu .wp-menu-image, #wpadminbar .ab-item' ); 124 23 125 this.setColors();126 this.findElements();127 this.paint();24 painter.setColors(); 25 painter.findElements(); 26 painter.paint(); 128 27 }, 129 28 … … 202 101 203 102 try { 204 if ( 'atob' in window ) { 205 xml = window.atob( encoded[1] ); 206 } else { 207 xml = base64.atob( encoded[1] ); 208 } 103 xml = window.atob( encoded[1] ); 209 104 } catch ( error ) {} 210 105 … … 219 114 xml = xml.replace( /fill:.*?;/g, 'fill: ' + color + ';'); 220 115 221 if ( 'btoa' in window ) { 222 xml = window.btoa( xml ); 223 } else { 224 xml = base64.btoa( xml ); 225 } 116 xml = window.btoa( xml ); 226 117 227 118 $element.data( 'wp-ui-svg-' + color, xml ); -
trunk/src/wp-admin/admin-header.php
r58419 r58997 204 204 } 205 205 206 $admin_body_class .= ' no-customize-support no-svg';206 $admin_body_class .= ' no-customize-support svg'; 207 207 208 208 if ( $current_screen->is_block_editor() ) {
Note: See TracChangeset
for help on using the changeset viewer.