For faster navigation, this Iframe is preloading the Wikiwand page for User:FRDian/Wordcount.js.

User:FRDian/Wordcount.js

/*
繁體:
原先的Liangent製作的滑鼠所選擇的字數。因只是顯示字數,而造成小小作品判斷的淪陷。
根據[[Wikipedia:小小作品]]之小小作品提昇管理辦法有提到小小作品的定義
「正文50个汉字以下:外文字母和数字算半个汉字,不包含信息框和模板本身,但訊息框內的實際內容字數計入。」

简体:
原先的Liangent制作的鼠标所选择的字数。因只是显示字数,而造成小小作品判断的沦陷。
根据[[Wikipedia:小小作品]]之小小作品提升管理办法有提到小小作品的定义
“正文50个汉字以下:外文字母和数字算半个汉字,不包含信息框和模板本身,但信息框内的实际内容字数计入。”

原創者/原创者:Liangent
改良者:小躍
簡體版/简体版:FRDian
*/

(function($) {
        function bytecount(text) {
            text = text.replace(/[\u0000-\u007F]/g, '.');
            text = text.replace(/[\u0080-\u07FF\uD800-\uDFFF]/g, '..');
            text = text.replace(/[\u0800-\uD7FF\uE000-\uFFFF]/g, '...');
            return text.length;
        };
        
        function cjkcount(text) {
            text = text.replace(/\./g, '');
            text = text.replace(/[\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u3005\u3007\u3021-\u3029\u3038-\u303B\u3400-\u4DB5\u4E00-\u9FCC\uF900-\uFA6D\uFA70-\uFAD9]|[\uD840-\uD868][\uDC00-\uDFFF]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|[\uD86A-\uD86C][\uDC00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D]|\uD87E[\uDC00-\uDE1D]/g, '.');
            text = text.replace(/[^\.]/g, '');
            return text.length;
        };
        
        function getwcbytext(text) {
            return text.length + '个字符,其中包含' + cjkcount(text) + '个汉字<br />合'+(cjkcount(text)+(text.length-cjkcount(text))/2)+'个汉字,总计'+bytecount(text) + '字节<br /> encoding by 小躍<br />simplified by FRDian';
        };
        function getsel() {
            if (!window.getSelection) return '';
            return getSelection().toString();
        };
        function dowc(event) {
            $('.wordcount').remove(); // or remove after text.length == 0 checking?
            var text = getsel();
            if (text.length == 0) return;
            var divj = $('<div />').html(getwcbytext(text))
                .css({
                    'position': 'fixed',
                    'right': '0',
                    'bottom': '0',
                    'margin': '4px',
                    'padding': '6px'
                })
                .addClass('wordcount ui-state-highlight ui-corner-all')
                .appendTo('body');
                // we hook keyup, so this may make it flickering
                // eg when shift, ctrl.etc key up
                //.hide().fadeIn('slow');
            setTimeout(function() {
                divj.fadeOut('slow');
            }, 10000);
        };
        $(document).mouseup(dowc).keyup(dowc);
    })(jQuery);
{{bottomLinkPreText}} {{bottomLinkText}}
User:FRDian/Wordcount.js
Listen to this article

This browser is not supported by Wikiwand :(
Wikiwand requires a browser with modern capabilities in order to provide you with the best reading experience.
Please download and use one of the following browsers:

This article was just edited, click to reload
This article has been deleted on Wikipedia (Why?)

Back to homepage

Please click Add in the dialog above
Please click Allow in the top-left corner,
then click Install Now in the dialog
Please click Open in the download dialog,
then click Install
Please click the "Downloads" icon in the Safari toolbar, open the first download in the list,
then click Install
{{::$root.activation.text}}

Install Wikiwand

Install on Chrome Install on Firefox
Don't forget to rate us

Tell your friends about Wikiwand!

Gmail Facebook Twitter Link

Enjoying Wikiwand?

Tell your friends and spread the love:
Share on Gmail Share on Facebook Share on Twitter Share on Buffer

Our magic isn't perfect

You can help our automatic cover photo selection by reporting an unsuitable photo.

This photo is visually disturbing This photo is not a good choice

Thank you for helping!


Your input will affect cover photo selection, along with input from other users.

X

Get ready for Wikiwand 2.0 🎉! the new version arrives on September 1st! Don't want to wait?