<commit_before><!--The MIT License (MIT)

Copyright (c) 2017 by <NAME>

Based on work 
Copyright (c) 2016 by <NAME>
Copyright (c) 2016 by <NAME>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

-->
<!--
 Standalone page to draw icons in matrix and generates the map definition with the format required by 
 library for OLED SD1306 screen: https://github.com/squix78/esp8266-oled-ssd1306
 100% quick and dirty vanilla ECS6, no framework or library was injured for this project.

-->
<html>
  <head>
    <meta charset="utf-8" />
    <style>
      #form {
        user-select: none; 
      }
      #chars table {
        margin-top: 5px;
        user-select: none; 
      }
      #chars table, tr, td, th {
        border-collapse: collapse;
      }
      #chars td, th {
        border: 1px solid #CCC;
        width: 12px;
        height: 15px;
      }
      #chars th[action] {
        cursor:pointer;
      }
      #chars th[action="up"], #chars th[action="down"], #chars th[action="left"], #chars th[action="right"] {
        font-size: 10px;
      }
      #chars td.on {
        background-color: #CCC;
      }
      
      #addChar, #generate {
        display: none;
        user-select: none;
      }
      body.started #addChar, body.started #generate {
        display: inline;
      }
      body.started #create {
        display: none;
      }
      #page {
        position:relative;
      }
      #page>div {
        position: relative;
        float: left;
      }

      #output {
        margin-left: 20px;
        margin-top: 12px;
        font-size:12px;
        user-select: all;
        max-width:60%;
      }
      #header {
        margin-top: 10px;
      }
      #inputText {
        width: 100%;
        height:120px;
      }
      
    </style>
  </head>
  <body>
    <div id="form">
      <table width="100%">
        <tr>
          <td>Font array name:</td><td><input placeholder="Font array name" type="text" id="name" value="My_Font"/></td>
          <td width="75%" rowspan="5">
            <textarea id="inputText" placeholder="Or paste a char array font definition here">
const char My_Font[] PROGMEM = {
  0xa, // Width: 10
  0xd, // Height: 13
  0x1, // First char: 1
  0x2, // Number of chars: 2
  // Jump table:
  0x0, 0x0, 0x14, 0xa,
  0x0, 0x14, 0x14, 0xa,
  // Font Data:
  0x80,0x1f,0x80,0x10,0x80,0x1f,0x80,0x10,0x80,0x1f,0x80,0x10,0x80,0x1f,0x80,0x10,0x80,0x1f,0x0,0x6,
  0x0,0x60,0x0,0x5c,0x80,0x43,0x60,0x40,0x98,0x57,0x98,0x57,0x60,0x40,0x80,0x43,0x0,0x5c,0x0,0x60,
};              
            </textarea></td>
        </tr>
        <tr>
          <td>First char code:</td><td><input placeholder="First char code" type="number" id="code" value="1" min="1"/></td>
        </tr>
        <tr>
          <td>Width:</td><td><input placeholder="Font width" type="number" id="width" value="10"/></td>
        </tr>
        <tr>
          <td>Height:</td><td><input placeholder="Font height" type="number" id="height" value="13" max="64"/></td>
        </tr>
        <tr>
          <td colspan="3"> </td>     <!--slightly improves layout-->
        </tr>
        <tr>
          <td colspan="2"><button id="create">Create</button> </td>
          <td><button id="parse">Parse</button></td>
        </tr>
      </table>
      <br/>
    </div>
    <div id="page">
      <div id="charxContainer" ondragstart="return false;">
        <div id="chars"></div><br/>
        <button id="addChar">Add a character</button>
      </div>
      <div id="output">
        <button id="generate">Generate</button>
        <div class="output" id="header"> </div>
        <div class="output" id="jump"> </div>
        <div class="output" id="data"> </div>
      </div>
    </div>
    <script>
    (function() {
      let font;
      
      class Font {
        constructor() {
          this.height = parseInt(document.getElementById('height').value);
          this.width = parseInt(document.getElementById('width').value);
          let firstCharCode = parseInt(document.getElementById('code').value);
          this.currentCharCode = firstCharCode;
          this.fontContainer = document.getElementById('chars');
          this.bytesForHeight = (1 + ((this.height - 1) >> 3));  // number of bytes needed for this font height
          document.body.className = "started";
          document.getElementById('height').disabled = true;
          document.getElementById('width').disabled = true;          
        }
        
        // Should we have a Char and a Pixel class ? not sure it's worth it.
        // Let's use the DOM to store everything for now
        
        // Add a pixel matrix to draw a new character
        // jumpaData not used for now: some day, use the last byte for optimisation 
        addChar(jumpData, charData) {
          let charContainer = this.fontContainer.appendChild(document.createElement("table"));<commit_msg>Fixing 'select-all' issues on Firefox<commit_after><!--The MIT License (MIT)

Copyright (c) 2017 by <NAME>

Based on work 
Copyright (c) 2016 by <NAME>
Copyright (c) 2016 by <NAME>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

-->
<!--
 Standalone page to draw icons in matrix and generates the map definition with the format required by 
 library for OLED SD1306 screen: https://github.com/squix78/esp8266-oled-ssd1306
 100% quick and dirty vanilla ECS6, no framework or library was injured for this project.

-->
<html>
  <head>
    <meta charset="utf-8" />
    <style>
      body {
        user-select: none; 
        -moz-user-select: none; 
      }
      #chars table {
        margin-top: 5px;
      }
      #chars table, tr, td, th {
        border-collapse: collapse;
      }
      #chars td, th {
        border: 1px solid #CCC;
        width: 12px;
        height: 15px;
      }
      #chars th[action] {
        cursor:pointer;
      }
      #chars th[action="up"], #chars th[action="down"], #chars th[action="left"], #chars th[action="right"] {
        font-size: 10px;
      }
      #chars td.on {
        background-color: #CCC;
      }
      
      #addChar, #generate {
        display: none;
      }
      body.started #addChar, body.started #generate {
        display: inline;
      }
      body.started #create {
        display: none;
      }
      #page {
        position:relative;
      }
      #page>div {
        position: relative;
        float: left;
      }

      #output {
        margin-left: 20px;
        margin-top: 12px;
        font-size:12px;
        user-select: all;
        -moz-user-select: all;
        max-width:60%;
      }
      
      #header {
        margin-top: 10px;
      }
      #inputText {
        width: 100%;
        height:120px;
      }
      
    </style>
  </head>
  <body>
    <div id="form">
      <table width="100%">
        <tr>
          <td>Font array name:</td><td><input placeholder="Font array name" type="text" id="name" value="My_Font"/></td>
          <td width="75%" rowspan="5">
            <textarea id="inputText" placeholder="Or paste a char array font definition here">
const char My_Font[] PROGMEM = {
  0xa, // Width: 10
  0xd, // Height: 13
  0x1, // First char: 1
  0x2, // Number of chars: 2
  // Jump table:
  0x0, 0x0, 0x14, 0xa,
  0x0, 0x14, 0x14, 0xa,
  // Font Data:
  0x80,0x1f,0x80,0x10,0x80,0x1f,0x80,0x10,0x80,0x1f,0x80,0x10,0x80,0x1f,0x80,0x10,0x80,0x1f,0x0,0x6,
  0x0,0x60,0x0,0x5c,0x80,0x43,0x60,0x40,0x98,0x57,0x98,0x57,0x60,0x40,0x80,0x43,0x0,0x5c,0x0,0x60,
};              
            </textarea></td>
        </tr>
        <tr>
          <td>First char code:</td><td><input placeholder="First char code" type="number" id="code" value="1" min="1"/></td>
        </tr>
        <tr>
          <td>Width:</td><td><input placeholder="Font width" type="number" id="width" value="10"/></td>
        </tr>
        <tr>
          <td>Height:</td><td><input placeholder="Font height" type="number" id="height" value="13" max="64"/></td>
        </tr>
        <tr>
          <td colspan="3"> </td>     <!--slightly improves layout-->
        </tr>
        <tr>
          <td colspan="2"><button id="create">Create</button> <button id="generate">Generate</button></td>
          <td><button id="parse">Parse</button></td>
        </tr>
      </table>
      <br/>
    </div>
    <div id="page">
      <div id="charxContainer" ondragstart="return false;">
        <div id="chars"></div><br/>
        <button id="addChar">Add a character</button>
      </div>
      <div id="output">
        <div class="output" id="header"> </div>
        <div class="output" id="jump"> </div>
        <div class="output" id="data"> </div>
      </div>
    </div>
    <script>
    (function() {
      let font;
      
      class Font {
        constructor() {
          this.height = parseInt(document.getElementById('height').value);
          this.width = parseInt(document.getElementById('width').value);
          let firstCharCode = parseInt(document.getElementById('code').value);
          this.currentCharCode = firstCharCode;
          this.fontContainer = document.getElementById('chars');
          this.bytesForHeight = (1 + ((this.height - 1) >> 3));  // number of bytes needed for this font height
          document.body.className = "started";
          document.getElementById('height').disabled = true;
          document.getElementById('width').disabled = true;          
        }
        
        // Should we have a Char and a Pixel class ? not sure it's worth it.
        // Let's use the DOM to store everything for now
        
        // Add a pixel matrix to draw a new character
        // jumpaData not used for now: some day, use the last byte for optimisation 
        addChar(jumpData, charData) {
          let charContainer = this.fontContainer.appendChild(document.createElement("table"));
{'fraction_non_alphanumeric': 0.13071672354948805, 'fraction_numerical': 0.03583617747440273, 'mean_word_length': 2.3993619489559164, 'pattern_counts': {'":': 0, '<': 171, '<?xml version=': 0, '>': 177, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4481701', 'n_tokens_mistral': 3871, 'n_tokens_neox': 3597, 'n_words': 1084}