codepoints.net add sample character examples

Seeing "embedded" page font examples is neat, but sometimes it is useful to see how your own system handles glyphs on its own. This script adds samples for each displayed instance.

Stan na 04-08-2025. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name        codepoints.net add sample character examples
// @namespace   Violentmonkey Scripts
// @match       https://codepoints.net/*
// @grant       none
// @version     1.0.0
// @author      myf
// @description Seeing "embedded" page font examples is neat, but sometimes it is useful to see how your own system handles glyphs on its own. This script adds samples for each displayed instance.
// @license     CC0
// ==/UserScript==

/*
 * https://greasyfork.org/en/scripts/544593
*/

const fonts = [
  'Segoe UI Emoji',
  'Segoe UI Symbol',
  'Twemoji Mozilla',
  'Helvetica, Arial, sans-serif',
  'Verdana, system-ui, sans-serif',
  'Georgia, Times New Roman, serif'
];
function addChars() {
  const charEls = document.querySelectorAll('[data-cp]:not(:has(samp))');
  for ( const charEl of charEls ) {
    const dataCp = charEl.getAttribute('data-cp');
    const char = String.fromCodePoint(
      dataCp.indexOf('U+') == 0
      ? parseInt( dataCp.slice(2), 16 )
      : parseInt( dataCp )
    );
    const samp = document.createElement('samp');
    for ( const font of fonts ) {
      const span = document.createElement('span');
      span.style.fontFamily = font;
      span.textContent = char;
      if(font.indexOf('Emoji')>1) {
        span.textContent += '\uFE0F';
      }
      if(font.indexOf('Symbol')>1) {
        span.textContent += '\uFE0E';
      }
      span.title = font;
      samp.append(span);
    }
    charEl.tagName == 'MAIN'
    ? charEl.insertAdjacentElement('afterbegin',samp)
    : charEl.append(samp);
  }
}

addChars()

setInterval(addChars,500);