Ticket #31242: 31242.patch
File 31242.patch, 7.4 KB (added by , 10 years ago) |
---|
-
Gruntfile.js
295 295 'wp-includes/js/tinymce/plugins/wp*/plugin.js', 296 296 // Third party scripts 297 297 '!wp-admin/js/farbtastic.js', 298 '!wp-includes/js/backbone *.js',298 '!wp-includes/js/backbone.js', 299 299 '!wp-includes/js/swfobject.js', 300 '!wp-includes/js/underscore *.js',300 '!wp-includes/js/underscore.js', 301 301 '!wp-includes/js/colorpicker.js', 302 302 '!wp-includes/js/hoverIntent.js', 303 303 '!wp-includes/js/json2.js', 304 304 '!wp-includes/js/tw-sack.js', 305 '!wp-includes/js/twemoji.js', 305 306 '!**/*.min.js' 306 307 ], 307 308 // Remove once other JSHint errors are resolved -
src/wp-content/themes/twentyfifteen/readme.txt
1 === Twenty Fifteen ===1 === Twenty Fifteen 😋 === 2 2 Contributors: the WordPress team 3 3 Tags: black, blue, gray, pink, purple, white, yellow, dark, light, two-columns, left-sidebar, fixed-layout, responsive-layout, accessibility-ready, custom-background, custom-colors, custom-header, custom-menu, editor-style, featured-images, microformats, post-formats, rtl-language-support, sticky-post, threaded-comments, translation-ready 4 4 Requires at least: 4.1 -
src/wp-includes/js/wp-emoji.js
1 /* global _wpemojiSettings, twemoji */2 1 window.wp = window.wp || {}; 3 2 4 (function() { 5 var emoji; 6 7 wp.emoji = emoji = { 8 /** 9 * The CDN URL for where emoji files are hosted. 10 * 11 * @since 4.2.0 12 * 13 * @var string 14 */ 15 baseUrl: '//s0.wp.com/wp-content/mu-plugins/emoji/twemoji/72x72', 16 17 /** 18 * The extension of the hosted emoji files. 19 * 20 * @since 4.2.0 21 * 22 * @var string 23 */ 24 ext: '.png', 25 3 ( function( window, wp, twemoji, settings ) { 4 var emoji = { 26 5 /** 27 6 * Flag to determine if we should parse all emoji characters into Twemoji images. 28 7 * 29 8 * @since 4.2.0 30 9 * 31 * @var bool10 * @var Boolean 32 11 */ 33 12 parseAllEmoji: false, 34 13 … … 37 16 * 38 17 * @since 4.2.0 39 18 * 40 * @var bool19 * @var Boolean 41 20 */ 42 21 parseEmoji: false, 43 22 … … 46 25 * 47 26 * @since 4.2.0 48 27 * 49 * @var bool28 * @var Boolean 50 29 */ 51 30 parseFlags: false, 52 31 … … 56 35 * @since 4.2.0 57 36 */ 58 37 init: function() { 59 if ( typeof _wpemojiSettings !== 'undefined' ) {60 emoji.baseUrl = _wpemojiSettings.baseUrl || emoji.baseUrl;61 emoji.ext = _wpemojiSettings.ext || emoji.ext;62 }63 64 38 emoji.parseAllEmoji = ! emoji.browserSupportsEmoji(); 65 39 emoji.parseFlags = ! emoji.browserSupportsFlagEmoji(); 66 40 emoji.parseEmoji = emoji.parseAllEmoji || emoji.parseFlags; 67 41 68 if ( ! emoji.parseEmoji ) { 69 return; 42 if ( window.addEventListener ) { 43 window.addEventListener( 'load', emoji.load, false ); 44 } else if ( window.attachEvent ) { 45 window.attachEvent( 'onload', emoji.load ); 70 46 } 71 47 }, 72 48 … … 76 52 * @since 4.2.0 77 53 */ 78 54 load: function() { 55 new MutationObserver( callback ) 56 57 .observe( document.body, { 58 childList: true, 59 subtree: true 60 } ); 61 62 function callback( mutationRecords ) { 63 var i = mutationRecords.length, 64 ii, 65 node; 66 67 while ( i-- ) { 68 ii = mutationRecords[ i ].addedNodes.length; 69 70 while ( ii-- ) { 71 node = mutationRecords[ i ].addedNodes[ ii ]; 72 73 if ( node.nodeType === 3 ) { 74 node = node.parentNode; 75 } 76 77 if ( node.nodeType === 1 ) { 78 emoji.parse( node ); 79 } 80 } 81 } 82 } 83 79 84 emoji.parse( document.body ); 80 85 }, 81 86 … … 84 89 * 85 90 * @since 4.2.0 86 91 * 87 * @return { bool} True if the browser can render emoji, false if it cannot.92 * @return {Boolean} True if the browser can render emoji, false if it cannot. 88 93 */ 89 94 browserSupportsEmoji: function() { 90 var context, smile; 95 var canvas = document.createElement( 'canvas' ) 96 context = canvas.getContext && canvas.getContext( '2d' ); 91 97 92 if ( ! document.createElement( 'canvas' ).getContext ) {93 return ;98 if ( ! context.fillText ) { 99 return false; 94 100 } 95 101 96 context = document.createElement( 'canvas' ).getContext( '2d' );97 if ( typeof context.fillText != 'function' ) {98 return;99 }100 101 smile = String.fromCharCode( 55357 ) + String.fromCharCode( 56835 );102 103 102 /* 104 103 * Chrome OS X added native emoji rendering in M41. Unfortunately, 105 104 * it doesn't work when the font is bolder than 500 weight. So, we … … 107 106 */ 108 107 context.textBaseline = 'top'; 109 108 context.font = '600 32px Arial'; 110 context.fillText( smile, 0, 0 );109 context.fillText( String.fromCharCode( 55357, 56835 ), 0, 0 ); 111 110 112 111 return context.getImageData( 16, 16, 1, 1 ).data[0] !== 0; 113 112 }, … … 117 116 * made of two characters, so some browsers (notably, Firefox OS X) don't support them. 118 117 * 119 118 * @since 4.2.0 120 * @return {bool} True if the browser renders flag characters as a flag glyph, false if it does not. 119 * 120 * @return {Boolean} True if the browser renders flag characters as a flag glyph, false if it does not. 121 121 */ 122 122 browserSupportsFlagEmoji: function() { 123 var context, flag, canvas; 123 var canvas = document.createElement( 'canvas' ) 124 context = canvas.getContext && canvas.getContext( '2d' ); 124 125 125 canvas = document.createElement( 'canvas' ); 126 127 if ( ! canvas.getContext ) { 128 return; 129 } 130 131 context = canvas.getContext( '2d' ); 132 133 if ( typeof context.fillText != 'function' ) { 134 return; 126 if ( ! context.fillText ) { 127 return false; 135 128 } 136 129 137 flag = String.fromCharCode(55356) + String.fromCharCode(56812); // [G]138 flag += String.fromCharCode(55356) + String.fromCharCode(56807); // [B]139 140 130 context.textBaseline = 'top'; 141 131 context.font = '32px Arial'; 142 context.fillText( flag, 0, 0 );132 context.fillText( String.fromCharCode( 55356, 56812, 55356, 56807 ), 0, 0 ); 143 133 144 134 /* 145 135 * This works because the image will be one of three things: … … 151 141 * to a larger image (4-5KB data URL). 152 142 */ 153 143 return canvas.toDataURL().length > 3000; 154 155 144 }, 156 145 157 146 /** 158 * Given a DOM node, parse any emoji characters into Twemoji images.147 * Given an element or string, parse any emoji characters into Twemoji images. 159 148 * 160 149 * @since 4.2.0 161 150 * 162 * @param { Element} element The DOM nodeto parse.151 * @param {HTMLElement|String} object The element or string to parse. 163 152 */ 164 parse: function( element ) {153 parse: function( object ) { 165 154 if ( ! emoji.parseEmoji ) { 166 return ;155 return object; 167 156 } 168 157 169 return twemoji.parse( element, {170 base: emoji.baseUrl,171 ext: emoji.ext,158 return twemoji.parse( object, { 159 base: settings.baseUrl, 160 ext: settings.ext, 172 161 callback: function( icon, options ) { 173 162 // Ignore some standard characters that TinyMCE recommends in its character map. 174 163 switch ( icon ) { … … 193 182 } 194 183 }; 195 184 196 if ( window.addEventListener ) {197 window.addEventListener( 'load', emoji.load, false );198 } else if ( window.attachEvent ) {199 window.attachEvent( 'onload', emoji.load );200 }201 202 185 emoji.init(); 203 })(); 186 187 wp.emoji = emoji; 188 } )( window, window.wp, window.twemoji, window._wpemojiSettings );