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 #31242. git-svn-id: https://develop.svn.wordpress.org/trunk@31744 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
fdb65519ac
commit
a5cd4f6284
@ -272,7 +272,7 @@ inlineEditPost = {
|
||||
if ( -1 !== r.indexOf( '<tr' ) ) {
|
||||
$(inlineEditPost.what+id).siblings('tr.hidden').addBack().remove();
|
||||
$('#edit-'+id).before(r).remove();
|
||||
window.WPEmoji.parse( $( inlineEditPost.what + id ).get( 0 ) );
|
||||
wp.emoji.parse( $( inlineEditPost.what + id ).get( 0 ) );
|
||||
$(inlineEditPost.what+id).hide().fadeIn();
|
||||
} else {
|
||||
r = r.replace( /<.[^<>]*?>/g, '' );
|
||||
|
@ -117,7 +117,7 @@ inlineEditTax = {
|
||||
// Update the value in the Parent dropdown.
|
||||
$( '#parent' ).find( 'option[value=' + option_value + ']' ).text( row.find( '.row-title' ).text() );
|
||||
|
||||
window.WPEmoji.parse( row.get( 0 ) );
|
||||
wp.emoji.parse( row.get( 0 ) );
|
||||
|
||||
row.hide().fadeIn();
|
||||
} else {
|
||||
|
@ -741,7 +741,7 @@ jQuery(document).ready( function($) {
|
||||
});
|
||||
}
|
||||
|
||||
window.WPEmoji.parse( box.get( 0 ) );
|
||||
wp.emoji.parse( box.get( 0 ) );
|
||||
|
||||
b.html(revert_b);
|
||||
real_slug.val(new_slug);
|
||||
|
@ -49,7 +49,7 @@ jQuery(document).ready(function($) {
|
||||
else
|
||||
$( '.tags' ).prepend( res.responses[0].supplemental.parents ); // As the parent is not visible, Insert the version with Parent - Child - ThisTerm
|
||||
|
||||
window.WPEmoji.parse( $( '.tags' ).get( 0 ) );
|
||||
wp.emoji.parse( $( '.tags' ).get( 0 ) );
|
||||
|
||||
$('.tags .no-items').remove();
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
( function( tinymce, WPEmoji ) {
|
||||
( function( tinymce, wp ) {
|
||||
tinymce.PluginManager.add( 'wpemoji', function( editor, url ) {
|
||||
var typing;
|
||||
|
||||
if ( ! WPEmoji.parseEmoji ) {
|
||||
if ( ! wp.emoji.parseEmoji ) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
node = selection.getNode();
|
||||
bookmark = selection.getBookmark();
|
||||
|
||||
WPEmoji.parse( node );
|
||||
wp.emoji.parse( node );
|
||||
|
||||
imgs = editor.dom.select( 'img.emoji', node );
|
||||
|
||||
@ -61,4 +61,4 @@
|
||||
}
|
||||
} );
|
||||
} );
|
||||
} )( window.tinymce, window.WPEmoji );
|
||||
} )( window.tinymce, window.wp );
|
||||
|
0
src/wp-includes/js/twemoji.js
Executable file → Normal file
0
src/wp-includes/js/twemoji.js
Executable file → Normal file
40
src/wp-includes/js/emoji.js → src/wp-includes/js/wp-emoji.js
Executable file → Normal file
40
src/wp-includes/js/emoji.js → src/wp-includes/js/wp-emoji.js
Executable file → Normal file
@ -1,8 +1,10 @@
|
||||
/* global EmojiSettings, twemoji */
|
||||
var WPEmoji;
|
||||
/* global _wpemojiSettings, twemoji */
|
||||
window.wp = window.wp || {};
|
||||
|
||||
(function() {
|
||||
WPEmoji = {
|
||||
var emoji;
|
||||
|
||||
wp.emoji = emoji = {
|
||||
/**
|
||||
* The CDN URL for where emoji files are hosted.
|
||||
*
|
||||
@ -10,7 +12,7 @@ var WPEmoji;
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
base_url: '//s0.wp.com/wp-content/mu-plugins/emoji/twemoji/72x72',
|
||||
baseUrl: '//s0.wp.com/wp-content/mu-plugins/emoji/twemoji/72x72',
|
||||
|
||||
/**
|
||||
* The extension of the hosted emoji files.
|
||||
@ -54,16 +56,16 @@ var WPEmoji;
|
||||
* @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;
|
||||
if ( typeof _wpemojiSettings !== 'undefined' ) {
|
||||
emoji.baseUrl = _wpemojiSettings.baseUrl || emoji.baseUrl;
|
||||
emoji.ext = _wpemojiSettings.ext || emoji.ext;
|
||||
}
|
||||
|
||||
WPEmoji.parseAllEmoji = ! WPEmoji.browserSupportsEmoji();
|
||||
WPEmoji.parseFlags = ! WPEmoji.browserSupportsFlagEmoji();
|
||||
WPEmoji.parseEmoji = WPEmoji.parseAllEmoji || WPEmoji.parseFlags;
|
||||
emoji.parseAllEmoji = ! emoji.browserSupportsEmoji();
|
||||
emoji.parseFlags = ! emoji.browserSupportsFlagEmoji();
|
||||
emoji.parseEmoji = emoji.parseAllEmoji || emoji.parseFlags;
|
||||
|
||||
if ( ! WPEmoji.parseEmoji ) {
|
||||
if ( ! emoji.parseEmoji ) {
|
||||
return;
|
||||
}
|
||||
},
|
||||
@ -74,7 +76,7 @@ var WPEmoji;
|
||||
* @since 4.2.0
|
||||
*/
|
||||
load: function() {
|
||||
WPEmoji.parse( document.body );
|
||||
emoji.parse( document.body );
|
||||
},
|
||||
|
||||
/**
|
||||
@ -160,13 +162,13 @@ var WPEmoji;
|
||||
* @param {Element} element The DOM node to parse.
|
||||
*/
|
||||
parse: function( element ) {
|
||||
if ( ! WPEmoji.parseEmoji ) {
|
||||
if ( ! emoji.parseEmoji ) {
|
||||
return;
|
||||
}
|
||||
|
||||
return twemoji.parse( element, {
|
||||
base: this.base_url,
|
||||
ext: this.ext,
|
||||
base: emoji.baseUrl,
|
||||
ext: emoji.ext,
|
||||
callback: function( icon, options ) {
|
||||
// Ignore some standard characters that TinyMCE recommends in its character map.
|
||||
switch ( icon ) {
|
||||
@ -181,7 +183,7 @@ var WPEmoji;
|
||||
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])$/ ) ) {
|
||||
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;
|
||||
}
|
||||
|
||||
@ -192,10 +194,10 @@ var WPEmoji;
|
||||
};
|
||||
|
||||
if ( window.addEventListener ) {
|
||||
window.addEventListener( 'load', WPEmoji.load, false );
|
||||
window.addEventListener( 'load', emoji.load, false );
|
||||
} else if ( window.attachEvent ) {
|
||||
window.attachEvent( 'onload', WPEmoji.load );
|
||||
window.attachEvent( 'onload', emoji.load );
|
||||
}
|
||||
|
||||
WPEmoji.init();
|
||||
emoji.init();
|
||||
})();
|
@ -425,8 +425,8 @@ function wp_default_scripts( &$scripts ) {
|
||||
$scripts->add( 'mce-view', "/wp-includes/js/mce-view$suffix.js", array( 'shortcode', 'media-models', 'media-audiovideo', 'wp-playlist' ), false, 1 );
|
||||
|
||||
$scripts->add( 'twemoji', "/wp-includes/js/twemoji$suffix.js", array(), false, 1 );
|
||||
$scripts->add( 'emoji', "/wp-includes/js/emoji$suffix.js", array( 'twemoji' ), false, 1 );
|
||||
did_action( 'init' ) && $scripts->localize( 'emoji', 'EmojiSettings', array(
|
||||
$scripts->add( 'emoji', "/wp-includes/js/wp-emoji$suffix.js", array( 'twemoji' ), false, 1 );
|
||||
did_action( 'init' ) && $scripts->localize( 'wp-emoji', '_wpemojiSettings', array(
|
||||
/**
|
||||
* Filter the URL where emoji images are hosted.
|
||||
*
|
||||
@ -434,7 +434,7 @@ function wp_default_scripts( &$scripts ) {
|
||||
*
|
||||
* @param string The emoji base URL.
|
||||
*/
|
||||
'base_url' => apply_filters( 'emoji_url', '//s0.wp.com/wp-content/mu-plugins/emoji/twemoji/72x72/' ),
|
||||
'baseUrl' => apply_filters( 'emoji_url', '//s0.wp.com/wp-content/mu-plugins/emoji/twemoji/72x72/' ),
|
||||
/**
|
||||
* Filter the extension of the emoji files.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user