|
|
|
@ -7,13 +7,21 @@
|
|
|
|
|
* Licensed under the MIT license:
|
|
|
|
|
* http://www.opensource.org/licenses/MIT
|
|
|
|
|
*/
|
|
|
|
|
;(function(root, undefined) {
|
|
|
|
|
;
|
|
|
|
|
(function (root, undefined) {
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
|
|
var NODE_JS = typeof(module) != 'undefined';
|
|
|
|
|
if (NODE_JS) {
|
|
|
|
|
root = global;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Note that for maximum portability, libraries that are not jQuery should
|
|
|
|
|
// declare themselves as anonymous modules, and avoid setting a global if an
|
|
|
|
|
// AMD loader is present. jQuery is a special case. For more information, see
|
|
|
|
|
// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var HEX_CHARS = '0123456789abcdef'.split('');
|
|
|
|
|
|
|
|
|
|
var S = [0x29, 0x2E, 0x43, 0xC9, 0xA2, 0xD8, 0x7C, 0x01, 0x3D, 0x36, 0x54, 0xA1, 0xEC, 0xF0, 0x06, 0x13,
|
|
|
|
@ -56,14 +64,17 @@
|
|
|
|
|
code = message.charCodeAt(index);
|
|
|
|
|
if (code < 0x80) {
|
|
|
|
|
M[i++] = code;
|
|
|
|
|
} else if (code < 0x800) {
|
|
|
|
|
}
|
|
|
|
|
else if (code < 0x800) {
|
|
|
|
|
M[i++] = 0xc0 | (code >> 6);
|
|
|
|
|
M[i++] = 0x80 | (code & 0x3f);
|
|
|
|
|
} else if (code < 0xd800 || code >= 0xe000) {
|
|
|
|
|
}
|
|
|
|
|
else if (code < 0xd800 || code >= 0xe000) {
|
|
|
|
|
M[i++] = 0xe0 | (code >> 12);
|
|
|
|
|
M[i++] = 0x80 | ((code >> 6) & 0x3f);
|
|
|
|
|
M[i++] = 0x80 | (code & 0x3f);
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
code = 0x10000 + (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff));
|
|
|
|
|
M[i++] = 0xf0 | (code >> 18);
|
|
|
|
|
M[i++] = 0x80 | ((code >> 12) & 0x3f);
|
|
|
|
@ -142,7 +153,13 @@
|
|
|
|
|
|
|
|
|
|
if (!root.JS_MD2_TEST && NODE_JS) {
|
|
|
|
|
module.exports = md2;
|
|
|
|
|
}
|
|
|
|
|
else if (typeof define === "function" && define.amd) {
|
|
|
|
|
define("md2", [], function () {
|
|
|
|
|
return md2;
|
|
|
|
|
});
|
|
|
|
|
} else if (root) {
|
|
|
|
|
root.md2 = md2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}(this));
|
|
|
|
|