Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

Clean up to remove WP's emoji mess #84

Merged
merged 1 commit into from
Apr 29, 2015
Merged

Clean up to remove WP's emoji mess #84

merged 1 commit into from
Apr 29, 2015

Conversation

retlehs
Copy link
Member

@retlehs retlehs commented Apr 28, 2015

i just realized that as of wp 4.2, by default, every site now has this in the <head>:

<script type="text/javascript">
      window._wpemojiSettings = {"baseUrl":"https:\/\/s.w.org\/images\/core\/emoji\/72x72\/","ext":".png","source":{"concatemoji":"\/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>

by default, WP also tries to load these custom emoji's from an external server:

image

none of this is necessary for browsers that natively support emoji:

image

@retlehs
Copy link
Member Author

retlehs commented Apr 28, 2015

if you go into the writing settings of your WP admin and disable "Convert emoticons like :-) and :-P to graphics on display" it will remove the inline JS, but you are still stuck with:

<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>

@retlehs retlehs changed the title Clean up WP's emoji mess Clean up to remove WP's emoji mess Apr 28, 2015
retlehs added a commit that referenced this pull request Apr 29, 2015
Clean up to remove WP's emoji mess
@retlehs retlehs merged commit 0b75d91 into master Apr 29, 2015
@retlehs retlehs deleted the emoji-cleanup branch April 29, 2015 04:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant