Emoji:
- Fix loading errors in IE9 and IE10. - Add fallbacks for the loading events. Fixes #32109 for trunk. Built from https://develop.svn.wordpress.org/trunk@32334 git-svn-id: http://core.svn.wordpress.org/trunk@32305 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
ed0da72d97
commit
4e971bea9f
|
@ -4174,7 +4174,7 @@ function print_emoji_detection_script() {
|
|||
?>
|
||||
<script type="text/javascript">
|
||||
window._wpemojiSettings = <?php echo wp_json_encode( $settings ); ?>;
|
||||
!function(a,b,c){function d(a){var c=b.createElement("canvas"),d=c.getContext&&c.getContext("2d");return d&&d.fillText?(d.textBaseline="top",d.font="600 32px Arial","flag"===a?(d.fillText(String.fromCharCode(55356,56812,55356,56807),0,0),c.toDataURL().length>3e3):(d.fillText(String.fromCharCode(55357,56835),0,0),0!==d.getImageData(16,16,1,1).data[0])):!1}function e(a){var c=b.createElement("script");c.src=a,c.type="text/javascript",b.getElementsByTagName("head")[0].appendChild(c)}var f;c.supports={simple:d("simple"),flag:d("flag")},c.supports.simple&&c.supports.flag||(f=c.source||{},f.concatemoji?e(f.concatemoji):f.wpemoji&&f.twemoji&&(e(f.twemoji),e(f.wpemoji)))}(window,document,window._wpemojiSettings);
|
||||
!function(a,b,c){function d(a){var c=b.createElement("canvas"),d=c.getContext&&c.getContext("2d");return d&&d.fillText?(d.textBaseline="top",d.font="600 32px Arial","flag"===a?(d.fillText(String.fromCharCode(55356,56812,55356,56807),0,0),c.toDataURL().length>3e3):(d.fillText(String.fromCharCode(55357,56835),0,0),0!==d.getImageData(16,16,1,1).data[0])):!1}function e(a){var c=b.createElement("script");c.src=a,c.type="text/javascript",b.getElementsByTagName("head")[0].appendChild(c)}var f,g;c.supports={simple:d("simple"),flag:d("flag")},c.DOMReady=!1,c.readyCallback=function(){c.DOMReady=!0},c.supports.simple&&c.supports.flag||(g=function(){c.readyCallback()},b.addEventListener?(b.addEventListener("DOMContentLoaded",g,!1),a.addEventListener("load",g,!1)):(a.attachEvent("onload",g),b.attachEvent("onreadystatechange",function(){"complete"===b.readyState&&c.readyCallback()})),f=c.source||{},f.concatemoji?e(f.concatemoji):f.wpemoji&&f.twemoji&&(e(f.twemoji),e(f.wpemoji)))}(window,document,window._wpemojiSettings);
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
( function( window, document, settings ) {
|
||||
var src;
|
||||
var src, ready;
|
||||
|
||||
/**
|
||||
* Detect if the browser supports rendering emoji or flag emoji. Flag emoji are a single glyph
|
||||
|
@ -62,7 +62,28 @@
|
|||
flag: browserSupportsEmoji( 'flag' )
|
||||
};
|
||||
|
||||
settings.DOMReady = false;
|
||||
settings.readyCallback = function() {
|
||||
settings.DOMReady = true;
|
||||
};
|
||||
|
||||
if ( ! settings.supports.simple || ! settings.supports.flag ) {
|
||||
ready = function() {
|
||||
settings.readyCallback();
|
||||
};
|
||||
|
||||
if ( document.addEventListener ) {
|
||||
document.addEventListener( 'DOMContentLoaded', ready, false );
|
||||
window.addEventListener( 'load', ready, false );
|
||||
} else {
|
||||
window.attachEvent( 'onload', ready );
|
||||
document.attachEvent( 'onreadystatechange', function() {
|
||||
if ( 'complete' === document.readyState ) {
|
||||
settings.readyCallback();
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
src = settings.source || {};
|
||||
|
||||
if ( src.concatemoji ) {
|
||||
|
|
|
@ -1 +1 @@
|
|||
!function(a,b,c){function d(a){var c=b.createElement("canvas"),d=c.getContext&&c.getContext("2d");return d&&d.fillText?(d.textBaseline="top",d.font="600 32px Arial","flag"===a?(d.fillText(String.fromCharCode(55356,56812,55356,56807),0,0),c.toDataURL().length>3e3):(d.fillText(String.fromCharCode(55357,56835),0,0),0!==d.getImageData(16,16,1,1).data[0])):!1}function e(a){var c=b.createElement("script");c.src=a,c.type="text/javascript",b.getElementsByTagName("head")[0].appendChild(c)}var f;c.supports={simple:d("simple"),flag:d("flag")},c.supports.simple&&c.supports.flag||(f=c.source||{},f.concatemoji?e(f.concatemoji):f.wpemoji&&f.twemoji&&(e(f.twemoji),e(f.wpemoji)))}(window,document,window._wpemojiSettings);
|
||||
!function(a,b,c){function d(a){var c=b.createElement("canvas"),d=c.getContext&&c.getContext("2d");return d&&d.fillText?(d.textBaseline="top",d.font="600 32px Arial","flag"===a?(d.fillText(String.fromCharCode(55356,56812,55356,56807),0,0),c.toDataURL().length>3e3):(d.fillText(String.fromCharCode(55357,56835),0,0),0!==d.getImageData(16,16,1,1).data[0])):!1}function e(a){var c=b.createElement("script");c.src=a,c.type="text/javascript",b.getElementsByTagName("head")[0].appendChild(c)}var f,g;c.supports={simple:d("simple"),flag:d("flag")},c.DOMReady=!1,c.readyCallback=function(){c.DOMReady=!0},c.supports.simple&&c.supports.flag||(g=function(){c.readyCallback()},b.addEventListener?(b.addEventListener("DOMContentLoaded",g,!1),a.addEventListener("load",g,!1)):(a.attachEvent("onload",g),b.attachEvent("onreadystatechange",function(){"complete"===b.readyState&&c.readyCallback()})),f=c.source||{},f.concatemoji?e(f.concatemoji):f.wpemoji&&f.twemoji&&(e(f.twemoji),e(f.wpemoji)))}(window,document,window._wpemojiSettings);
|
File diff suppressed because one or more lines are too long
|
@ -3,24 +3,6 @@
|
|||
function wpEmoji() {
|
||||
var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver,
|
||||
|
||||
/**
|
||||
* Flag to determine if the browser and the OS support emoji.
|
||||
*
|
||||
* @since 4.2.0
|
||||
*
|
||||
* @var Boolean
|
||||
*/
|
||||
supportsEmoji = false,
|
||||
|
||||
/**
|
||||
* Flag to determine if the browser and the OS support flag (two character) emoji.
|
||||
*
|
||||
* @since 4.2.0
|
||||
*
|
||||
* @var Boolean
|
||||
*/
|
||||
supportsFlagEmoji = false,
|
||||
|
||||
/**
|
||||
* Flag to determine if we should replace emoji characters with images.
|
||||
*
|
||||
|
@ -30,10 +12,9 @@
|
|||
*/
|
||||
replaceEmoji = false,
|
||||
|
||||
isIE8 = window.navigator.userAgent.indexOf( 'IE 8' ) !== -1,
|
||||
|
||||
// Private
|
||||
twemoji, timer,
|
||||
loaded = false,
|
||||
count = 0;
|
||||
|
||||
/**
|
||||
|
@ -42,6 +23,10 @@
|
|||
* @since 4.2.0
|
||||
*/
|
||||
function load() {
|
||||
if ( loaded ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( typeof window.twemoji === 'undefined' ) {
|
||||
// Break if waiting for longer than 30 sec.
|
||||
if ( count > 600 ) {
|
||||
|
@ -57,6 +42,7 @@
|
|||
}
|
||||
|
||||
twemoji = window.twemoji;
|
||||
loaded = true;
|
||||
|
||||
if ( MutationObserver ) {
|
||||
new MutationObserver( function( mutationRecords ) {
|
||||
|
@ -107,7 +93,7 @@
|
|||
* @param {Object} args Additional options for Twemoji.
|
||||
*/
|
||||
function parse( object, args ) {
|
||||
if ( ! replaceEmoji ) {
|
||||
if ( ! replaceEmoji || ! twemoji ) {
|
||||
return object;
|
||||
}
|
||||
|
||||
|
@ -132,7 +118,7 @@
|
|||
return false;
|
||||
}
|
||||
|
||||
if ( ! supportsFlagEmoji && supportsEmoji &&
|
||||
if ( ! settings.supports.flag && settings.supports.simple &&
|
||||
! /^1f1(?:e[6-9a-f]|f[0-9a-f])-1f1(?:e[6-9a-f]|f[0-9a-f])$/.test( icon ) ) {
|
||||
|
||||
return false;
|
||||
|
@ -143,29 +129,16 @@
|
|||
} );
|
||||
}
|
||||
|
||||
// Load when the readyState changes to 'interactive', not 'complete'.
|
||||
function onLoad() {
|
||||
if ( ( ! isIE8 && 'interactive' === document.readyState ) || ( isIE8 && 'complete' === document.readyState ) ) {
|
||||
load();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize our emoji support, and set up listeners.
|
||||
*/
|
||||
if ( settings ) {
|
||||
supportsEmoji = window._wpemojiSettings.supports.simple;
|
||||
supportsFlagEmoji = window._wpemojiSettings.supports.flag;
|
||||
replaceEmoji = ! supportsEmoji || ! supportsFlagEmoji;
|
||||
replaceEmoji = ! settings.supports.simple || ! settings.supports.flag;
|
||||
|
||||
if ( ( ! isIE8 && 'loading' === document.readyState ) || ( isIE8 && 'complete' !== document.readyState ) ) {
|
||||
if ( document.addEventListener ) {
|
||||
document.addEventListener( 'readystatechange', onLoad, false );
|
||||
} else if ( document.attachEvent ) {
|
||||
document.attachEvent( 'onreadystatechange', onLoad );
|
||||
}
|
||||
} else {
|
||||
if ( settings.DOMReady ) {
|
||||
load();
|
||||
} else {
|
||||
settings.readyCallback = load;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
!function(a,b){function c(){function c(){if("undefined"==typeof a.twemoji){if(m>600)return;return a.clearTimeout(g),g=a.setTimeout(c,50),void m++}f=a.twemoji,h&&new h(function(a){for(var b,c,e,f,g=a.length;g--;){if(b=a[g].addedNodes,c=a[g].removedNodes,e=b.length,1===e&&1===c.length&&3===b[0].nodeType&&"IMG"===c[0].nodeName&&b[0].data===c[0].alt)return;for(;e--;)f=b[e],3===f.nodeType&&(f=f.parentNode),f&&1===f.nodeType&&d(f)}}).observe(document.body,{childList:!0,subtree:!0}),d(document.body)}function d(a,c){return k?(c=c||{},f.parse(a,{base:b.baseUrl,ext:b.ext,className:c.className||"emoji",imgAttr:c.imgAttr,callback:function(a,b){switch(a){case"a9":case"ae":case"2122":case"2194":case"2660":case"2663":case"2665":case"2666":return!1}return j||!i||/^1f1(?:e[6-9a-f]|f[0-9a-f])-1f1(?:e[6-9a-f]|f[0-9a-f])$/.test(a)?"".concat(b.base,a,b.ext):!1}})):a}function e(){(!l&&"interactive"===document.readyState||l&&"complete"===document.readyState)&&c()}var f,g,h=a.MutationObserver||a.WebKitMutationObserver||a.MozMutationObserver,i=!1,j=!1,k=!1,l=-1!==a.navigator.userAgent.indexOf("IE 8"),m=0;return b&&(i=a._wpemojiSettings.supports.simple,j=a._wpemojiSettings.supports.flag,k=!i||!j,!l&&"loading"===document.readyState||l&&"complete"!==document.readyState?document.addEventListener?document.addEventListener("readystatechange",e,!1):document.attachEvent&&document.attachEvent("onreadystatechange",e):c()),{replaceEmoji:k,parse:d}}a.wp=a.wp||{},a.wp.emoji=new c}(window,window._wpemojiSettings);
|
||||
!function(a,b){function c(){function c(){if(!i){if("undefined"==typeof a.twemoji){if(j>600)return;return a.clearTimeout(f),f=a.setTimeout(c,50),void j++}e=a.twemoji,i=!0,g&&new g(function(a){for(var b,c,e,f,g=a.length;g--;){if(b=a[g].addedNodes,c=a[g].removedNodes,e=b.length,1===e&&1===c.length&&3===b[0].nodeType&&"IMG"===c[0].nodeName&&b[0].data===c[0].alt)return;for(;e--;)f=b[e],3===f.nodeType&&(f=f.parentNode),f&&1===f.nodeType&&d(f)}}).observe(document.body,{childList:!0,subtree:!0}),d(document.body)}}function d(a,c){return h&&e?(c=c||{},e.parse(a,{base:b.baseUrl,ext:b.ext,className:c.className||"emoji",imgAttr:c.imgAttr,callback:function(a,c){switch(a){case"a9":case"ae":case"2122":case"2194":case"2660":case"2663":case"2665":case"2666":return!1}return b.supports.flag||!b.supports.simple||/^1f1(?:e[6-9a-f]|f[0-9a-f])-1f1(?:e[6-9a-f]|f[0-9a-f])$/.test(a)?"".concat(c.base,a,c.ext):!1}})):a}var e,f,g=a.MutationObserver||a.WebKitMutationObserver||a.MozMutationObserver,h=!1,i=!1,j=0;return b&&(h=!b.supports.simple||!b.supports.flag,b.DOMReady?c():b.readyCallback=c),{replaceEmoji:h,parse:d}}a.wp=a.wp||{},a.wp.emoji=new c}(window,window._wpemojiSettings);
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.3-alpha-32333';
|
||||
$wp_version = '4.3-alpha-32334';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue