Changeset 26131
- Timestamp:
- 11/13/2013 03:25:20 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/js/svg-painter.js
r26072 r26131 1 ;var svgPainter = ( function( $, window, document, undefined ) { 1 /* global mp6_color_scheme:true */ 2 var svgPainter = ( function( $, window, document, undefined ) { 2 3 3 4 'use strict'; … … 31 32 32 33 if ( typeof colors === 'undefined' && typeof mp6_color_scheme !== 'undefined' ) { 33 varcolors = mp6_color_scheme;34 colors = mp6_color_scheme; 34 35 } 35 36 … … 87 88 return; 88 89 89 var xml = $element.data( 'mp6-svg-' + color ); 90 var xml = $element.data( 'mp6-svg-' + color ), 91 base64; 90 92 91 93 if ( ! xml ) { 92 94 93 varbase64 = $element.css( 'background-image' ).match( /.+data:image\/svg\+xml;base64,(.+)\)/ );95 base64 = $element.css( 'background-image' ).match( /.+data:image\/svg\+xml;base64,(.+)\)/ ); 94 96 95 97 if ( ! base64 ) … … 97 99 98 100 try { 99 varxml = window.atob( base64[1] );101 xml = window.atob( base64[1] ); 100 102 } catch ( e ) { 101 varxml = $.base64.atob( base64[1] );103 xml = $.base64.atob( base64[1] ); 102 104 } 103 105 … … 121 123 } 122 124 123 $element.attr( 'style', "background-image: url('data:image/svg+xml;base64," + xml + "') !important;");125 $element.attr( 'style', 'background-image: url("data:image/svg+xml;base64,' + xml + '") !important;' ); 124 126 125 127 } … … 142 144 ;(function($) { 143 145 144 var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",146 var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/', 145 147 a256 = '', 146 148 r64 = [256], 147 149 r256 = [256], 148 i = 0; 150 i = 0, 151 c, Plugin; 149 152 150 153 while(i < 256) { 151 varc = String.fromCharCode(i);154 c = String.fromCharCode(i); 152 155 a256 += c; 153 156 r256[i] = i; … … 162 165 length = s.length, 163 166 result = '', 164 bitsInBuffer = 0; 167 bitsInBuffer = 0, 168 tmp; 165 169 166 170 while(i < length) { 167 varc = s.charCodeAt(i);171 c = s.charCodeAt(i); 168 172 c = c < 256 ? alpha[c] : -1; 169 173 … … 173 177 while(bitsInBuffer >= w2) { 174 178 bitsInBuffer -= w2; 175 vartmp = buffer >> bitsInBuffer;179 tmp = buffer >> bitsInBuffer; 176 180 result += beta.charAt(tmp); 177 181 buffer ^= tmp << bitsInBuffer; … … 183 187 } 184 188 185 varPlugin = $.base64 = function(dir, input, encode) {189 Plugin = $.base64 = function(dir, input, encode) { 186 190 return input ? Plugin[dir](input, encode) : dir ? null : this; 187 191 }; … … 192 196 }; 193 197 194 $.base64.atob = function(coded , utf8decode) {195 coded = coded.replace(/[^A-Za-z0-9\+\/\=]/g, "");198 $.base64.atob = function(coded) { 199 coded = coded.replace(/[^A-Za-z0-9\+\/\=]/g, ''); 196 200 coded = String(coded).split('='); 197 201 var i = coded.length;
Note: See TracChangeset
for help on using the changeset viewer.