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