<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[31744] trunk/src: Emoji JS cleanup.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/31744">31744</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/31744","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>nacin</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2015-03-12 03:16:51 +0000 (Thu, 12 Mar 2015)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Emoji JS cleanup.
* Filename: emoji.js => wp-emoji.js
* Script handle: emoji => wp-emoji
* Object: WPEmoji => wp.emoji
* Script settings: EmojiSettings => _wpemojiSettings
* Setting key: base_url => baseUrl
* Remove executable bit from files
see <a href="https://core.trac.wordpress.org/ticket/31242">#31242</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadminjsinlineeditpostjs">trunk/src/wp-admin/js/inline-edit-post.js</a></li>
<li><a href="#trunksrcwpadminjsinlineedittaxjs">trunk/src/wp-admin/js/inline-edit-tax.js</a></li>
<li><a href="#trunksrcwpadminjspostjs">trunk/src/wp-admin/js/post.js</a></li>
<li><a href="#trunksrcwpadminjstagsjs">trunk/src/wp-admin/js/tags.js</a></li>
<li><a href="#trunksrcwpincludesjstinymcepluginswpemojipluginjs">trunk/src/wp-includes/js/tinymce/plugins/wpemoji/plugin.js</a></li>
<li><a href="#trunksrcwpincludesscriptloaderphp">trunk/src/wp-includes/script-loader.php</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesjswpemojijs">trunk/src/wp-includes/js/wp-emoji.js</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesjsemojijs">trunk/src/wp-includes/js/emoji.js</a></li>
</ul>
<h3>Property Changed</h3>
<ul>
<li><a href="#trunksrcwpincludesjstwemojijs">trunk/src/wp-includes/js/twemoji.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadminjsinlineeditpostjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/js/inline-edit-post.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/js/inline-edit-post.js 2015-03-12 02:36:09 UTC (rev 31743)
+++ trunk/src/wp-admin/js/inline-edit-post.js 2015-03-12 03:16:51 UTC (rev 31744)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -272,7 +272,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if ( -1 !== r.indexOf( '<tr' ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $(inlineEditPost.what+id).siblings('tr.hidden').addBack().remove();
</span><span class="cx" style="display: block; padding: 0 10px"> $('#edit-'+id).before(r).remove();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- window.WPEmoji.parse( $( inlineEditPost.what + id ).get( 0 ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ wp.emoji.parse( $( inlineEditPost.what + id ).get( 0 ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> $(inlineEditPost.what+id).hide().fadeIn();
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> r = r.replace( /<.[^<>]*?>/g, '' );
</span></span></pre></div>
<a id="trunksrcwpadminjsinlineedittaxjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/js/inline-edit-tax.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/js/inline-edit-tax.js 2015-03-12 02:36:09 UTC (rev 31743)
+++ trunk/src/wp-admin/js/inline-edit-tax.js 2015-03-12 03:16:51 UTC (rev 31744)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -117,7 +117,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Update the value in the Parent dropdown.
</span><span class="cx" style="display: block; padding: 0 10px"> $( '#parent' ).find( 'option[value=' + option_value + ']' ).text( row.find( '.row-title' ).text() );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- window.WPEmoji.parse( row.get( 0 ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ wp.emoji.parse( row.get( 0 ) );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> row.hide().fadeIn();
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span></span></pre></div>
<a id="trunksrcwpadminjspostjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/js/post.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/js/post.js 2015-03-12 02:36:09 UTC (rev 31743)
+++ trunk/src/wp-admin/js/post.js 2015-03-12 03:16:51 UTC (rev 31744)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -741,7 +741,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- window.WPEmoji.parse( box.get( 0 ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ wp.emoji.parse( box.get( 0 ) );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> b.html(revert_b);
</span><span class="cx" style="display: block; padding: 0 10px"> real_slug.val(new_slug);
</span></span></pre></div>
<a id="trunksrcwpadminjstagsjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/js/tags.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/js/tags.js 2015-03-12 02:36:09 UTC (rev 31743)
+++ trunk/src/wp-admin/js/tags.js 2015-03-12 03:16:51 UTC (rev 31744)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -49,7 +49,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> else
</span><span class="cx" style="display: block; padding: 0 10px"> $( '.tags' ).prepend( res.responses[0].supplemental.parents ); // As the parent is not visible, Insert the version with Parent - Child - ThisTerm
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- window.WPEmoji.parse( $( '.tags' ).get( 0 ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ wp.emoji.parse( $( '.tags' ).get( 0 ) );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $('.tags .no-items').remove();
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="trunksrcwpincludesjsemojijs"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: trunk/src/wp-includes/js/emoji.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/emoji.js 2015-03-12 02:36:09 UTC (rev 31743)
+++ trunk/src/wp-includes/js/emoji.js 2015-03-12 03:16:51 UTC (rev 31744)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,201 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/* global EmojiSettings, twemoji */
-var WPEmoji;
-
-(function() {
- WPEmoji = {
- /**
- * The CDN URL for where emoji files are hosted.
- *
- * @since 4.2.0
- *
- * @var string
- */
- base_url: '//s0.wp.com/wp-content/mu-plugins/emoji/twemoji/72x72',
-
- /**
- * The extension of the hosted emoji files.
- *
- * @since 4.2.0
- *
- * @var string
- */
- ext: '.png',
-
- /**
- * Flag to determine if we should parse all emoji characters into Twemoji images.
- *
- * @since 4.2.0
- *
- * @var bool
- */
- parseAllEmoji: false,
-
- /**
- * Flag to determine if we should consider parsing emoji characters into Twemoji images.
- *
- * @since 4.2.0
- *
- * @var bool
- */
- parseEmoji: false,
-
- /**
- * Flag to determine if we should parse flag characters into Twemoji images.
- *
- * @since 4.2.0
- *
- * @var bool
- */
- parseFlags: false,
-
- /**
- * Initialize our emoji support, and set up listeners.
- *
- * @since 4.2.0
- */
- init: function() {
- if ( typeof EmojiSettings !== 'undefined' ) {
- this.base_url = EmojiSettings.base_url || this.base_url;
- this.ext = EmojiSettings.ext || this.ext;
- }
-
- WPEmoji.parseAllEmoji = ! WPEmoji.browserSupportsEmoji();
- WPEmoji.parseFlags = ! WPEmoji.browserSupportsFlagEmoji();
- WPEmoji.parseEmoji = WPEmoji.parseAllEmoji || WPEmoji.parseFlags;
-
- if ( ! WPEmoji.parseEmoji ) {
- return;
- }
- },
-
- /**
- * Runs when the document load event is fired, so we can do our first parse of the page.
- *
- * @since 4.2.0
- */
- load: function() {
- WPEmoji.parse( document.body );
- },
-
- /**
- * Detect if the browser supports rendering emoji.
- *
- * @since 4.2.0
- *
- * @return {bool} True if the browser can render emoji, false if it cannot.
- */
- browserSupportsEmoji: function() {
- var context, smile;
-
- if ( ! document.createElement( 'canvas' ).getContext ) {
- return;
- }
-
- context = document.createElement( 'canvas' ).getContext( '2d' );
- if ( typeof context.fillText != 'function' ) {
- return;
- }
-
- smile = String.fromCharCode( 55357 ) + String.fromCharCode( 56835 );
-
- /*
- * Chrome OS X added native emoji rendering in M41. Unfortunately,
- * it doesn't work when the font is bolder than 500 weight. So, we
- * check for bold rendering support to avoid invisible emoji in Chrome.
- */
- context.textBaseline = 'top';
- context.font = '600 32px Arial';
- context.fillText( smile, 0, 0 );
-
- return context.getImageData( 16, 16, 1, 1 ).data[0] !== 0;
- },
-
- /**
- * Detect if the browser supports rendering flag emoji. Flag emoji are a single glyph
- * made of two characters, so some browsers (notably, Firefox OS X) don't support them.
- *
- * @since 4.2.0
- * @return {bool} True if the browser renders flag characters as a flag glyph, false if it does not.
- */
- browserSupportsFlagEmoji: function() {
- var context, flag, canvas;
-
- canvas = document.createElement( 'canvas' );
-
- if ( ! canvas.getContext ) {
- return;
- }
-
- context = canvas.getContext( '2d' );
-
- if ( typeof context.fillText != 'function' ) {
- return;
- }
-
- flag = String.fromCharCode(55356) + String.fromCharCode(56812); // [G]
- flag += String.fromCharCode(55356) + String.fromCharCode(56807); // [B]
-
- context.textBaseline = 'top';
- context.font = '32px Arial';
- context.fillText( flag, 0, 0 );
-
- /*
- * This works because the image will be one of three things:
- * - Two empty squares, if the browser doen't render emoji
- * - Two squares with 'G' and 'B' in them, if the browser doen't render flag emoji
- * - The British flag
- *
- * The first two will encode to small images (1-2KB data URLs), the third will encode
- * to a larger image (4-5KB data URL).
- */
- return canvas.toDataURL().length > 3000;
-
- },
-
- /**
- * Given a DOM node, parse any emoji characters into Twemoji images.
- *
- * @since 4.2.0
- *
- * @param {Element} element The DOM node to parse.
- */
- parse: function( element ) {
- if ( ! WPEmoji.parseEmoji ) {
- return;
- }
-
- return twemoji.parse( element, {
- base: this.base_url,
- ext: this.ext,
- callback: function( icon, options ) {
- // Ignore some standard characters that TinyMCE recommends in its character map.
- switch ( icon ) {
- case 'a9':
- case 'ae':
- case '2122':
- case '2194':
- case '2660':
- case '2663':
- case '2665':
- case '2666':
- return false;
- }
-
- if ( WPEmoji.parseFlags && ! WPEmoji.parseAllEmoji && ! icon.match( /^1f1(e[6-9a-f]|f[1-9a-f])-1f1(e[6-9a-f]|f[1-9a-f])$/ ) ) {
- return false;
- }
-
- return ''.concat( options.base, '/', icon, options.ext );
- }
- } );
- }
- };
-
- if ( window.addEventListener ) {
- window.addEventListener( 'load', WPEmoji.load, false );
- } else if ( window.attachEvent ) {
- window.attachEvent( 'onload', WPEmoji.load );
- }
-
- WPEmoji.init();
-})();
</del></span></pre></div>
<a id="trunksrcwpincludesjstinymcepluginswpemojipluginjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/tinymce/plugins/wpemoji/plugin.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/tinymce/plugins/wpemoji/plugin.js 2015-03-12 02:36:09 UTC (rev 31743)
+++ trunk/src/wp-includes/js/tinymce/plugins/wpemoji/plugin.js 2015-03-12 03:16:51 UTC (rev 31744)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,8 +1,8 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-( function( tinymce, WPEmoji ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+( function( tinymce, wp ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> tinymce.PluginManager.add( 'wpemoji', function( editor, url ) {
</span><span class="cx" style="display: block; padding: 0 10px"> var typing;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! WPEmoji.parseEmoji ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! wp.emoji.parseEmoji ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -32,7 +32,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> node = selection.getNode();
</span><span class="cx" style="display: block; padding: 0 10px"> bookmark = selection.getBookmark();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- WPEmoji.parse( node );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ wp.emoji.parse( node );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> imgs = editor.dom.select( 'img.emoji', node );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -61,4 +61,4 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> } );
</span><span class="cx" style="display: block; padding: 0 10px"> } );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-} )( window.tinymce, window.WPEmoji );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+} )( window.tinymce, window.wp );
</ins><span class="cx" style="display: block; padding: 0 10px">Index: trunk/src/wp-includes/js/twemoji.js
</span><span class="cx" style="display: block; padding: 0 10px">===================================================================
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">--- trunk/src/wp-includes/js/twemoji.js 2015-03-12 02:36:09 UTC (rev 31743)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+++ trunk/src/wp-includes/js/twemoji.js 2015-03-12 03:16:51 UTC (rev 31744)
</ins></span></pre></div>
<a id="trunksrcwpincludesjstwemojijs"></a>
<div class="propset"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Property changes: trunk/src/wp-includes/js/twemoji.js</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svnexecutable"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: svn:executable</h4></div>
<del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-*
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="trunksrcwpincludesjswpemojijsfromrev31742trunksrcwpincludesjsemojijs"></a>
<div class="copfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Copied: trunk/src/wp-includes/js/wp-emoji.js (from rev 31742, trunk/src/wp-includes/js/emoji.js)</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/wp-emoji.js (rev 0)
+++ trunk/src/wp-includes/js/wp-emoji.js 2015-03-12 03:16:51 UTC (rev 31744)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,203 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/* global _wpemojiSettings, twemoji */
+window.wp = window.wp || {};
+
+(function() {
+ var emoji;
+
+ wp.emoji = emoji = {
+ /**
+ * The CDN URL for where emoji files are hosted.
+ *
+ * @since 4.2.0
+ *
+ * @var string
+ */
+ baseUrl: '//s0.wp.com/wp-content/mu-plugins/emoji/twemoji/72x72',
+
+ /**
+ * The extension of the hosted emoji files.
+ *
+ * @since 4.2.0
+ *
+ * @var string
+ */
+ ext: '.png',
+
+ /**
+ * Flag to determine if we should parse all emoji characters into Twemoji images.
+ *
+ * @since 4.2.0
+ *
+ * @var bool
+ */
+ parseAllEmoji: false,
+
+ /**
+ * Flag to determine if we should consider parsing emoji characters into Twemoji images.
+ *
+ * @since 4.2.0
+ *
+ * @var bool
+ */
+ parseEmoji: false,
+
+ /**
+ * Flag to determine if we should parse flag characters into Twemoji images.
+ *
+ * @since 4.2.0
+ *
+ * @var bool
+ */
+ parseFlags: false,
+
+ /**
+ * Initialize our emoji support, and set up listeners.
+ *
+ * @since 4.2.0
+ */
+ init: function() {
+ if ( typeof _wpemojiSettings !== 'undefined' ) {
+ emoji.baseUrl = _wpemojiSettings.baseUrl || emoji.baseUrl;
+ emoji.ext = _wpemojiSettings.ext || emoji.ext;
+ }
+
+ emoji.parseAllEmoji = ! emoji.browserSupportsEmoji();
+ emoji.parseFlags = ! emoji.browserSupportsFlagEmoji();
+ emoji.parseEmoji = emoji.parseAllEmoji || emoji.parseFlags;
+
+ if ( ! emoji.parseEmoji ) {
+ return;
+ }
+ },
+
+ /**
+ * Runs when the document load event is fired, so we can do our first parse of the page.
+ *
+ * @since 4.2.0
+ */
+ load: function() {
+ emoji.parse( document.body );
+ },
+
+ /**
+ * Detect if the browser supports rendering emoji.
+ *
+ * @since 4.2.0
+ *
+ * @return {bool} True if the browser can render emoji, false if it cannot.
+ */
+ browserSupportsEmoji: function() {
+ var context, smile;
+
+ if ( ! document.createElement( 'canvas' ).getContext ) {
+ return;
+ }
+
+ context = document.createElement( 'canvas' ).getContext( '2d' );
+ if ( typeof context.fillText != 'function' ) {
+ return;
+ }
+
+ smile = String.fromCharCode( 55357 ) + String.fromCharCode( 56835 );
+
+ /*
+ * Chrome OS X added native emoji rendering in M41. Unfortunately,
+ * it doesn't work when the font is bolder than 500 weight. So, we
+ * check for bold rendering support to avoid invisible emoji in Chrome.
+ */
+ context.textBaseline = 'top';
+ context.font = '600 32px Arial';
+ context.fillText( smile, 0, 0 );
+
+ return context.getImageData( 16, 16, 1, 1 ).data[0] !== 0;
+ },
+
+ /**
+ * Detect if the browser supports rendering flag emoji. Flag emoji are a single glyph
+ * made of two characters, so some browsers (notably, Firefox OS X) don't support them.
+ *
+ * @since 4.2.0
+ * @return {bool} True if the browser renders flag characters as a flag glyph, false if it does not.
+ */
+ browserSupportsFlagEmoji: function() {
+ var context, flag, canvas;
+
+ canvas = document.createElement( 'canvas' );
+
+ if ( ! canvas.getContext ) {
+ return;
+ }
+
+ context = canvas.getContext( '2d' );
+
+ if ( typeof context.fillText != 'function' ) {
+ return;
+ }
+
+ flag = String.fromCharCode(55356) + String.fromCharCode(56812); // [G]
+ flag += String.fromCharCode(55356) + String.fromCharCode(56807); // [B]
+
+ context.textBaseline = 'top';
+ context.font = '32px Arial';
+ context.fillText( flag, 0, 0 );
+
+ /*
+ * This works because the image will be one of three things:
+ * - Two empty squares, if the browser doen't render emoji
+ * - Two squares with 'G' and 'B' in them, if the browser doen't render flag emoji
+ * - The British flag
+ *
+ * The first two will encode to small images (1-2KB data URLs), the third will encode
+ * to a larger image (4-5KB data URL).
+ */
+ return canvas.toDataURL().length > 3000;
+
+ },
+
+ /**
+ * Given a DOM node, parse any emoji characters into Twemoji images.
+ *
+ * @since 4.2.0
+ *
+ * @param {Element} element The DOM node to parse.
+ */
+ parse: function( element ) {
+ if ( ! emoji.parseEmoji ) {
+ return;
+ }
+
+ return twemoji.parse( element, {
+ base: emoji.baseUrl,
+ ext: emoji.ext,
+ callback: function( icon, options ) {
+ // Ignore some standard characters that TinyMCE recommends in its character map.
+ switch ( icon ) {
+ case 'a9':
+ case 'ae':
+ case '2122':
+ case '2194':
+ case '2660':
+ case '2663':
+ case '2665':
+ case '2666':
+ return false;
+ }
+
+ if ( emoji.parseFlags && ! emoji.parseAllEmoji && ! icon.match( /^1f1(e[6-9a-f]|f[1-9a-f])-1f1(e[6-9a-f]|f[1-9a-f])$/ ) ) {
+ return false;
+ }
+
+ return ''.concat( options.base, '/', icon, options.ext );
+ }
+ } );
+ }
+ };
+
+ if ( window.addEventListener ) {
+ window.addEventListener( 'load', emoji.load, false );
+ } else if ( window.attachEvent ) {
+ window.attachEvent( 'onload', emoji.load );
+ }
+
+ emoji.init();
+})();
</ins></span></pre></div>
<a id="trunksrcwpincludesscriptloaderphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/script-loader.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/script-loader.php 2015-03-12 02:36:09 UTC (rev 31743)
+++ trunk/src/wp-includes/script-loader.php 2015-03-12 03:16:51 UTC (rev 31744)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -425,8 +425,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $scripts->add( 'mce-view', "/wp-includes/js/mce-view$suffix.js", array( 'shortcode', 'media-models', 'media-audiovideo', 'wp-playlist' ), false, 1 );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $scripts->add( 'twemoji', "/wp-includes/js/twemoji$suffix.js", array(), false, 1 );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $scripts->add( 'emoji', "/wp-includes/js/emoji$suffix.js", array( 'twemoji' ), false, 1 );
- did_action( 'init' ) && $scripts->localize( 'emoji', 'EmojiSettings', array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $scripts->add( 'emoji', "/wp-includes/js/wp-emoji$suffix.js", array( 'twemoji' ), false, 1 );
+ did_action( 'init' ) && $scripts->localize( 'wp-emoji', '_wpemojiSettings', array(
</ins><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Filter the URL where emoji images are hosted.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -434,7 +434,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string The emoji base URL.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'base_url' => apply_filters( 'emoji_url', '//s0.wp.com/wp-content/mu-plugins/emoji/twemoji/72x72/' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'baseUrl' => apply_filters( 'emoji_url', '//s0.wp.com/wp-content/mu-plugins/emoji/twemoji/72x72/' ),
</ins><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Filter the extension of the emoji files.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span></span></pre>
</div>
</div>
</body>
</html>