PageSourceSearch

https://mybodysite.com/js//third_party_tools/tinymce_charactercount.js

js mybodysite.com collected 2026-09-28 13:57:14 UTC 1,474 bytes, 44 lines download raw bytes

1// borrowed from https://amystechnotes.com/2015/05/06/tinymce-add-character-count/comment-page-1/
2tinymce.PluginManager.add('charactercount', function (editor) {
3    var self = this;
4
5    function update() {
6        editor.theme.panel.find('#charactercount').text(['Characters: {0}', self.getCount()]);
7    }
8
9    editor.on('init', function () {
10        var statusbar = editor.theme.panel && editor.theme.panel.find('#statusbar')[0];
11
12        if (statusbar) {
13            window.setTimeout(function () {
14                statusbar.insert({
15                    type: 'label',
16                    name: 'charactercount',
17                    text: ['Characters: {0}', self.getCount()],
18                    classes: 'charactercount',
19                    disabled: editor.settings.readonly
20                }, 0);
21
22                editor.on('setcontent beforeaddundo', update);
23
24                editor.on('keyup', function (e) {
25                    update();
26                });
27            }, 0);
28        }
29    });
30
31    self.getCount = function () {
32        var tx = editor.getContent({ format: 'raw' });
33        var decoded = decodeHtml(tx);
34        var decodedStripped = decoded.replace(/(<([^>]+)>)/ig, "").trim();
35        var tc = decodedStripped.length;
36        return tc;
37    };
38
39    function decodeHtml(html) {
40        var txt = document.createElement("textarea");
41        txt.innerHTML = html;
42        return txt.value;
43    }
44});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.