/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
// The WebIDL binder places static methods on the prototype, rather than // on the constructor, which is a bit clumsy, and is definitely not // idiomatic.
LanguageInfo.detectLanguage = LanguageInfo.prototype.detectLanguage;
// Closure is overzealous in its function call optimization, and tries // to turn these singleton methods into unbound function calls.
ensureCache.alloc = ensureCache.alloc.bind(ensureCache);
ensureCache.prepare = ensureCache.prepare.bind(ensureCache);
// Accept forms both with and without underscores/hypens. for (let code of Object.keys(Encodings)) { if (code["includes"]("_"))
Encodings[code.replace(/_/g, "")] = Encodings[code];
}
addOnPreMain(function() {
onmessage = function(aMsg) {
let data = aMsg["data"];
let langInfo; if (data["tld"] == undefined && data["encoding"] == undefined && data["language"] == undefined) {
langInfo = LanguageInfo.detectLanguage(data["text"], !data["isHTML"]);
} else { // Do our best to find the given encoding in the encodings table. // Otherwise, just fall back to unknown.
let enc = String(data["encoding"]).toUpperCase().replace(/[_-]/g, "");
let encoding; if (Encodings.hasOwnProperty(enc))
encoding = Encodings[enc]; else
encoding = Encodings["UNKNOWN_ENCODING"];
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.