• Resolved semrocc

    (@semrocc)


    When updating WordPress to 4.2, there is a bunch of JS and CSS added to the head:

    <script type="text/javascript">
    			window._wpemojiSettings = {"baseUrl":"http:\/\/s.w.org\/images\/core\/emoji\/72x72\/","ext":".png","source":{"concatemoji":"http:\/\/www.mysite.com\/wp\/wp-includes\/js\/wp-emoji-release.min.js?ver=4.2"}};
    			!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);
    		</script>
    		<style type="text/css">
    img.wp-smiley,
    img.emoji {
    	display: inline !important;
    	border: none !important;
    	box-shadow: none !important;
    	height: 1em !important;
    	width: 1em !important;
    	margin: 0 .07em !important;
    	vertical-align: -0.1em !important;
    	background: none !important;
    	padding: 0 !important;
    }
    </style>
Viewing 15 replies - 31 through 45 (of 52 total)
  • I really don’t care about emoji either way. But i am concerned that to use default WordPress smileys another plugin must be used.

    Make emoji a toggle on / off. And if emoji is on don’t overwrite the default smilie shortcodes.

    Seems simple enough to me.

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    But i am concerned that to use default WordPress smileys another plugin must be used.

    This isn’t exactly true. The default smilies have almost all been replaced with their emoji equivalents. The old smilies are more or less just gone. The image files remain for anybody who was linking to them directly, but the default smilies are now emoji.

    The Classic Smilies plugin I made simply reverts this change and disables all the emoji back-compat code.

    So, you don’t need a plugin to use the default smilies, you need a plugin to use the default smilies from previous versions of WordPress.

    Make emoji a toggle on / off

    That’s not going to happen. Smilies are being replaced with emoji, long term. Making these optional in core is unlikely. Smilies are not a standard, and never have been. Emoji is an actual standard, defined in Unicode. Standards win.

    Otto, Well then something is mucked up when viewing emoji’s in Google Chrome browser. Using the ?? shortcode produces a “gray x on a black background” is that the emoji equivalent of :wink:? LOL!

    Yea standards win all the time. But many older articles might not look good with the emoji default image. Oh well thanks for your plugin to enable the default old smilies.

    As usual just my two cents worth as usual ??

    @otto

    Great that your plugin removes the overhead of emoji but at our site we are not allowed to install new plugins (publishers rules) so do you think that those two lines of code suggested on previous page in functions php will do the trick as good as your plugin?

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    @infolotnicze: No, those two lines of code will not really work. They just disable the front-end detection script. The plugin does much more stuff to provide a full solution. I recommend using the plugin or living with the emoji. Nothing in-between.

    @fidosysop:

    The ?? emoji equivalent looks like this: https://s.w.org/images/core/emoji/72×72/1f609.png

    If you’ve disabled the emoji detection javascript, then yes, Chrome (on Windows, at least), lacks that particular character.

    Down towards the bottom of this page about that character, you can see how the browser renders it in normal html mode. Look for “UTF-8 Unicode Character(s)”.

    https://www.iemoji.com/view/emoji/5/people/winking-face

    @otto and if we don’t use emotikons at all? Our site is designed to work without any js so loading it brakes this rule.

    exactly @infolotnicze

    Never used smileys or emojis so all this does for me is add more useless code to my website.

    Was shocked to find this was due to a wordpress core update and not a badly written 3rd party plugin.

    WHY ARE YOU ADDING INLINE CSS AND JS TO MY HEAD TAG GTFO!!!

    Such a dumb thing to add! Why assume everyone uses emojis/smilies?

    Who the hell even uses emojis? Most WordPress sites aren’t aimed at children, I don’t think anyone will complain if these aren’t a default.

    At the moment any dev who does view->source on my website thinks I’m a hack adding inline styles with “!important” everywhere.

    @ PKRG:

    To solve the problem with the sizes, go to file wp-includes/formating.php

    in aprox the middle of the file, you will find the function translate_smiley

    go to the end of this function and f*** this line off (remove the bold part)

    return sprintf( ‘<img src=”%s” alt=”%s” class=”wp-smiley” style=”height: 1em; max-height: 1em;” />’, esc_url( $src_url ), esc_attr( $smiley ) );

    The issue I’m having is that WP is going in, finding, for example, a checkmark ? encoded as & # 1 0 0 0 4 ; — and then replacing that checkmark with this “emoji” image.

    HOWEVER, GUYS: as a text glyph, CSS is used to color the checkmark green — but WP returns an image of a grey checkbox.

    I do not like this change — but then, I feel like I disagree with everything WP does these days. Wish I could drop it.

    Uncaught TypeError: f.className.indexOf is not a function
    https://sample.com/wp-includes/js/wp-emoji-release.min.js?ver=4.2.2 line 4

    I hate smiling, period.

    Moderator Marius L. J.

    (@clorith)

    @lamentira

    I would highly recommend not editing core files, but I believe the plugin Otto mentioned earlier handles the image sizing as well for you.

    @wasanajones

    This thread is concerning the removal of emoji from your site, if you are experiencing problems with your install and seeing errors then please, open a new topic about it.

    @lamentira,

    Thanks for your suggestion but I rather prefer not to alter the core files.

    I added the function hook from Classic Smilies plugin directly to my functions.php.

    function disable_emojis() {
    	remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
    	remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
    	remove_action( 'wp_print_styles', 'print_emoji_styles' );
    	remove_action( 'admin_print_styles', 'print_emoji_styles' );
    	remove_filter( 'the_content_feed', 'wp_staticize_emoji' );
    	remove_filter( 'comment_text_rss', 'wp_staticize_emoji' );
    	remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' );
    }
    add_action( 'init', 'disable_emojis' );

    But the size of my “old” smileys was still bypassed by the hardcoded size added on each smiley (style=”height: 1em; max-height: 1em;”)

    but thanks to classic smilies code, I was able to style them

    img.wp-smiley, img.emoji {
    height: auto!important;
    max-height:100%!important;
    width: 100%!important;
    }

    The problem is solved on my case.

    Thanks for your help

    It’s things like this that are steadily driving me towards developing websites using ProcessWire or Concrete5. Two really nice alternatives to WordPress.

    +1 to get rid of emoji support, or at least add it in as an option in settings.

    LOL @ U2 Apple comment. Perfect example. C’mon, WP!

Viewing 15 replies - 31 through 45 (of 52 total)
  • The topic ‘Emoji and smiley js and css added to head’ is closed to new replies.