commit cf35f9361a7766be9d1d6562e38c08bc9f27b7f5
Author: FOFStudio <1185907650@qq.com>
Date: Thu Aug 14 15:43:15 2025 +0800
Initial commit
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..c350201
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,73 @@
+Apache License
+Version 2.0, January 2004
+http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
+
+"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
+
+ (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work.
+
+To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
+
+Copyright 2025 FOFStudio
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..3edf662
--- /dev/null
+++ b/README.md
@@ -0,0 +1,3 @@
+# FOFcompiler
+
+FOF编译器开源,实现将中文代码编译至原生英文代码
\ No newline at end of file
diff --git a/index.html b/index.html
new file mode 100644
index 0000000..4c2fc52
--- /dev/null
+++ b/index.html
@@ -0,0 +1,96 @@
+
+
+
+
+
+
+ Document
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/js/Compiler.js b/js/Compiler.js
new file mode 100644
index 0000000..4fd1347
--- /dev/null
+++ b/js/Compiler.js
@@ -0,0 +1,68 @@
+//本JS为编译主JS,存放一些编译中通用的方法和变量及相关的数据
+let CompilerStart = "1_0_1Compiler\r\n";//编译器版本标识
+let CompilerIdentificationText = "-begin---====----==--==--==--==--==--==--==--==-end-"//编译器唯一标识文本,一些特殊字符可用该标识替换
+let Comendfofdianhaobenin = "endfofdianhaobenin";//点号的替换符
+let ComSymbol$FOFStuDio = "ComSymbolFOFStuDio{";//${}替换 通常在`${}`中
+let ComSymbolCssFOFStuDio = "ComSymbolCssFOFStuDio";//$替换 在CSS中需要直接处理
+let ComNewlineCharacterFOFStuDiorn = "ComNewlineCharacterRNFOFStuDio";// \r\n
+let ComNewlineCharacterFOFStuDion = "ComNewlineCharacterFOFStuDion";// \n
+let ComNewlineCharacterFOFStuDior = "ComNewlineCharacterRFOFStuDion";// \r
+let ComShuangYinHaoFOFStuDion = "ComShuangYinHaoFOFStuDion";// "
+let ComDanYinHaoFOFStuDion = "ComDanYinHaoFOFStuDion";// '
+let ComFanYinHaoFOFStuDion = "ComFanYinHaoFOFStuDion";// `
+let ComXingHaoFOFStuDioText1 = "ComXingHaoFOFStuDioText1";// /*
+let ComXingHaoFOFStuDioText2 = "ComXingHaoFOFStuDioText2";// */
+
+let FileTypeExtension = {
+ //代码文件格式
+ html: ".html",
+ css: ".css",
+ js: ".js",
+ lhtml: ".lhtml",
+ lcss: ".lcss",
+ ljs: ".ljs",
+ Nohtml: "html",
+ Nocss: "css",
+ Nojs: "js",
+ Nolhtml: "lhtml",
+ Nolcss: "lcss",
+ Noljs: "ljs",
+}
+
+/*
+编译相关所需要的配置
+@IfComPiler-是否正在编译,假代表不是,真代表是-【注意:判断编译调试状态以该字段为主,翻译、转换等都不在本字段范围中】
+@IfComDebug-调试还是编译,2代表编译,1代表调试
+*/
+let ComPilerDataMsgType = {
+ IfComPiler: false,
+ IfComDebug: 0
+}
+let FOFStudioType = {
+ replaceStringsInCode: (JSCode) => {
+ const JsCodeJSonCompilerStr = [];
+ function replaceMatch(match) {
+ const uuid = StrCodeUuid(); // 每次匹配到字符串时都生成新的UUID
+ JsCodeJSonCompilerStr.push([uuid, match, false]); // 直接将新的UUID和原始字符串推入数组
+ return uuid; // 返回新的UUID用于替换原始字符串
+ }
+ // 匹配双引号和单引号包含的文本
+ const pattern1 = /(["'])(?:(?=(\\?))\2.)*?\1/g;
+ const matches1 = JSCode.match(pattern1);
+ if (matches1) {
+ JSCode = JSCode.replace(pattern1, replaceMatch);
+ }
+ // 匹配反引号包含的文本
+ const pattern2 = /([`])(?:(?=(\\?))\2.)*?\1/gs;
+ const matches2 = JSCode.match(pattern2);
+ if (matches2) {
+ JSCode = JSCode.replace(pattern2, replaceMatch);
+ }
+ return { JSCode, JsCodeJSonCompilerStr };
+ }
+}
+JsonJSCodeMain(JavascriptCompilationPNameAll_, JavascriptCompilationJQCode_, JsonJSCodeTransformation_, JavascriptCodeKey_, JavascriptNoCodeStatic_, JavascriptEvCode_, JavascriptYesCodeStatic_, JavascriptOverallCode_)
+
+JSONCompilerInt_All(HTMLcompilation_, HTMLcompilationFun_, HTMLcompilationAttr_, HTMLcompilation2_, HTMLTripartiteClass_);//HTML编译器初始化
+
+JsonCssCodeMain(CssCompilation_);//CSS编译器初始化
\ No newline at end of file
diff --git a/js/GeneralMethod.js b/js/GeneralMethod.js
new file mode 100644
index 0000000..5b6514a
--- /dev/null
+++ b/js/GeneralMethod.js
@@ -0,0 +1,356 @@
+// 处理replace方法,替换字符串含有$元素
+Object.defineProperty(String.prototype, "replaceHack", {
+ value: function (substr, newSubStr) {
+ this.name = 'replaceHack';
+ this.enumerable = false;
+ try {
+ if (typeof newSubStr == 'string' && /\$/g.test(newSubStr)) {
+ newSubStr = newSubStr.replace(/\$/g, "$$$$");
+ };
+ return this.replace(substr, newSubStr)
+ } catch (error) {
+ console.log(error);
+ }
+ },
+ enumerable: false // 定义了一个不可枚举的属性
+});
+//禁止用F5键
+document.onkeydown = function (e) {
+ var ev = window.event || e;
+ var code = ev.keyCode || ev.which;
+ if (code == 116) {
+ ev.keyCode ? ev.keyCode = 0 : ev.which = 0;
+ cancelBubble = true;
+ return false;
+ }
+}
+//不敏感大小写查询方法
+function indexOfT(T1, T2) {
+ let Str = T1.toLowerCase();
+ let Str1 = T2.toLowerCase();
+ if (Str.indexOf(Str1) != -1) {
+ return true;
+ } else {
+ return false;
+ }
+}
+//生成32/64位随机字符串
+function generateRandomNumberString(length = 32) {
+ const chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
+ const alphaChars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
+ // 确保生成的字符串长度在32到64位之间
+ length = Math.max(32, Math.min(64, length));
+ // 生成第一个字符(必须是字母)
+ let uuid = alphaChars.charAt(Math.floor(Math.random() * alphaChars.length));
+ // 生成中间部分
+ for (let i = 1; i < length - 1; i++) {
+ uuid += chars.charAt(Math.floor(Math.random() * chars.length));
+ }
+ // 生成最后一个字符(必须是字母)
+ uuid += alphaChars.charAt(Math.floor(Math.random() * alphaChars.length));
+ return uuid;
+}
+//根据字符串生成临时的UUID
+function StrCodeUuid(hexDigits) {
+ return generateRandomNumberString();
+}
+//时间转时间戳,10位
+function Time_Strformat(shijianchuo) {
+ var data = new Date(shijianchuo)
+ var time3 = Date.parse(data);
+ time3 = time3 / 1000;
+ return time3;
+}
+//取时间戳13位
+function Time_GetTime_1() {
+ var timestamp = (new Date()).valueOf();
+ return timestamp;
+}
+//取时间戳10位
+function Time_GetTime_2() {
+ ts = Math.round(new Date().getTime() / 1000).toString();
+ return parseInt(ts);
+}
+/* 十六进制转文本辅助函数 */
+let readUTF_10_6 = function (arr) {
+ if (typeof arr === 'string') {
+ return arr;
+ }
+ let UTF = '',
+ _arr = arr;
+ for (let i = 0; i < ObjLengthCount(_arr); i++) {
+ let one = _arr[i].toString(2),
+ v = one.match(/^1+?(?=0)/);
+ if (v && ObjLengthCount(one) == 8) {
+ let bytesLength = ObjLengthCount(v[0]);
+ let store = _arr[i].toString(2).slice(7 - bytesLength);
+ for (let st = 1; st < bytesLength; st++) {
+ store += _arr[st + i].toString(2).slice(2)
+ }
+ UTF += String.fromCharCode(parseInt(store, 2));
+ i += bytesLength - 1
+ } else {
+ UTF += String.fromCharCode(_arr[i])
+ }
+ }
+ return UTF
+}
+//十六进制转文本
+let hexToString_16 = function (str) {
+ if (ObjLengthCount(str) % 2 != 0) {
+ return "";
+ }
+ let buf = [];
+ for (let i = 0; i < ObjLengthCount(str); i += 2) {
+ buf.push(parseInt(str.substring(i, i + 2), 16));
+ }
+ return readUTF_10_6(buf);
+}
+//文本转十六进制
+let bin2Hex_16 = function (str) {
+ let re = /[\u4E00-\u9FA5]/
+ let ar = []
+ for (let i = 0; i < ObjLengthCount(str); i++) {
+ let a = ''
+ if (re.test(str.charAt(i))) { // 中文
+ a = encodeURI(str.charAt(i)).replaceHack(/%/g, '')
+ } else {
+ a = str.charCodeAt(i).toString(16)
+ }
+ ar.push(a)
+ }
+ str = ar.join('')
+ return str
+}
+function bin2Hex_16_2(str) {
+ let ar = [];
+ for (let i = 0; i < str.length; i++) {
+ let code = str.charCodeAt(i);
+ if (code > 0x7F) { // 如果是多字节字符(包括中文、特殊符号等)
+ let encoded = encodeURIComponent(str.charAt(i)).replace(/%/g, '');
+ for (let j = 0; j < encoded.length; j += 2) {
+ ar.push(encoded.substr(j, 2));
+ }
+ } else {
+ ar.push(('0' + code.toString(16)).slice(-2)); // 确保每个字符都是两位的十六进制数
+ }
+ }
+ return ar.join('');
+}
+//取对象或数组成员数
+function ObjLengthCount(o) {
+ var t = typeof o;
+ if (t == 'string') {
+ return o.length;
+ } else if (t == 'object') {
+ var n = 0;
+ for (var i in o) {
+ n++;
+ }
+ return n;
+ }
+ if (o) {
+ return 0;
+ }
+ if (o.length) {
+ return o.length;
+ } else {
+ return 0;
+ }
+}
+//获取所有中间文本,注意start和end要进行特殊符号转义
+function TakeTheMiddleOfTheTextAll(str, start, end, ifRep = false) {
+ let strStr2 = str;
+ strStr2 = strStr2.replaceAll("\r\n", " " + ComNewlineCharacterFOFStuDiorn + " ")
+ strStr2 = strStr2.replaceAll("\n", " " + ComNewlineCharacterFOFStuDion + " ")
+ strStr2 = strStr2.replaceAll("\r", " " + ComNewlineCharacterFOFStuDior + "r ")
+ if (ifRep == true) {
+ strStr2 = strStr2.replaceAll("$", "12345ssdlhlhmzj12345")
+ start = start.replaceAll("$", "12345ssdlhlhmzj12345")
+ end = end.replaceAll("$", "12345ssdlhlhmzj12345")
+ }
+ let res = strStr2.match(new RegExp(`${start}(.*?)${end}`, "gm"))
+ if (res) {
+ for (let index = 0; index < res.length; index++) {
+ res[index] = res[index].replaceAll(" " + ComNewlineCharacterFOFStuDiorn + " ", "\r\n")
+ res[index] = res[index].replaceAll(" " + ComNewlineCharacterFOFStuDion + " ", "\n")
+ res[index] = res[index].replaceAll(" " + ComNewlineCharacterFOFStuDior + "r ", "\r")
+ if (ifRep == true) {
+ res[index] = res[index].replaceAll("12345ssdlhlhmzj12345", "$")
+ }
+ }
+ return res;
+ } else {
+ return [];
+ }
+}
+//获取第一个中间文本,注意start和end要进行特殊符号转义
+function TakeTheMiddleOfTheText2(str, start, end) {
+ let ls = TakeTheMiddleOfTheTextAll(str, start, end);
+ if (ls != undefined && ls != null) {
+ if (ls.length >= 1) {
+ return ls[0];
+ } else {
+ return "";
+ }
+ } else {
+ return "";
+ }
+}
+//判断是否正常JSON文本
+function isJSONparse(jsonContent) {
+ jsonContent = jsonContent.replaceAll(" ", "");
+ if (typeof jsonContent == 'string') {
+ try {
+ var obj = JSON.parse(jsonContent);
+ if (jsonContent.indexOf('{') > -1 || jsonContent.indexOf('[') > -1) {
+ return true;
+ } else {
+ return false;
+ }
+
+ } catch (e) {
+ return false;
+ }
+ }
+ return false;
+};
+//生成二维码
+function qrcodeImg(elText, qrcodeID, width, height) {
+ var qrcode = new QRCode(document.getElementById(qrcodeID), {
+ width: width,
+ height: height
+ });
+ if (elText == undefined) {
+ return;
+ }
+ qrcode.makeCode(elText);
+}
+
+function FilePath(str)//取全路径去除名称的路径
+{
+ if (str.indexOf("/") != -1) {
+ str = str.replaceAll("/", "\\")
+ }
+ let strAll = str.split("\\");
+ if (strAll) {
+ if (strAll.length >= 1) {
+ str = str.replace(strAll[strAll.length - 1], "")
+ str = str.replaceAll("\\", "/")
+ return str;
+ }
+ }
+ return "";
+}
+function FilePathName(str)//取全路径中的名称区域
+{
+ if (str.indexOf("/") != -1) {
+ str = str.replaceAll("/", "\\")
+ }
+ let strAll = str.split("\\");
+ if (strAll) {
+ if (strAll.length >= 1) {
+ return strAll[strAll.length - 1];
+ }
+ }
+ return "";
+}
+function FilePathName2(str)//文件名称去掉路径和后缀名
+{
+ if (str.indexOf("/") != -1) {
+ str = str.replaceAll("/", "\\")
+ }
+ let strAll = str.split("\\");
+ if (strAll) {
+ if (strAll.length >= 1) {
+ let StrType = strAll[strAll.length - 1].split(".");
+ if (StrType) {
+ if (StrType.length >= 1) {
+ StrType[StrType.length - 1] = "." + StrType[StrType.length - 1]
+ let RetName = strAll[strAll.length - 1].substring(0, strAll[strAll.length - 1].length - StrType[StrType.length - 1].length)
+ return RetName
+ }
+ }
+ }
+ }
+ return "";
+}
+function FilePathName3(str)//获取后缀名
+{
+ let strAll = str.split(".");
+ if (strAll) {
+ if (strAll.length >= 1) {
+ return "." + strAll[strAll.length - 1]
+ }
+ }
+ return "";
+}
+/*
+msg:判断图片后缀格式【判断是否是图片格式】,返回真代表图片格式,否则不是图片格式
+@FileExtension-文件后缀或文件名称
+*/
+function IfProjectImageType(FileExtension) {
+ let LsStrImage = `bmp、jpg、jpeg、tiff、gif、pcx、tga、exif、fpx、svg、psd、cdr、pcd、dxf、ufo、eps、ai、raw`;
+ let IfImageObj = false;
+ let ImageData = LsStrImage.split("、");
+ for (let index = 0; index < ObjLengthCount(ImageData); index++) {
+ if (ImageData[index] == FileExtension) {
+ IfImageObj = true;
+ break;
+ }
+ ImageData[index] = "." + ImageData[index]
+ }
+ for (let index = 0; index < ObjLengthCount(ImageData); index++) {
+ if (ImageData[index].indexOf(FileExtension) != -1) {
+ IfImageObj = true;
+ break;
+ }
+ }
+ return IfImageObj;
+}
+//判断是否包含中文
+function TextisChinese(s) {
+ try {
+ let reg = new RegExp("[\\u4E00-\\u9FFF]+", "g")
+ if (reg.test(s)) {
+ return true
+ } else {
+ return false
+ }
+ } catch (error) {
+ return true
+ }
+
+}
+//判断是否有符号
+function hasSpecialStr(str) {
+ var specialChars = "~·`!!@#$¥%^…&*()()—-_=+[]{}【】、|\\;:;:'\"“‘,./<>《》??,。";
+ var len = specialChars.length;
+ for (var i = 0; i < len; i++) {
+ if (str.indexOf(specialChars.substring(i, i + 1)) != -1) {
+ return true;
+ }
+ }
+ return false;
+}
+//获取文本内容的指定行内容
+function getCodeTextLine(text, lineNumber) {
+ try {
+ const lines = text.split(/\r?\n/);
+ if (lineNumber > 0 && lineNumber <= lines.length) {
+ return lines[lineNumber - 1];
+ } else {
+ return null;
+ }
+ } catch (error) {
+ return null;
+ }
+}
+//判断有没有中文
+function FOFcontainsChinese(str) {
+ var reg = /[\u4E00-\u9FA5]/;
+ return reg.test(str);
+}
+function FOFgetRandomNumber(min, max) {
+ return Math.floor(Math.random() * (max - min + 1)) + min;
+}
\ No newline at end of file
diff --git a/js/JavaScript/CompilerJavaScript.js b/js/JavaScript/CompilerJavaScript.js
new file mode 100644
index 0000000..3bd36df
--- /dev/null
+++ b/js/JavaScript/CompilerJavaScript.js
@@ -0,0 +1,390 @@
+let JavascriptCompilationPNameAll = [];//存储所有的多层指向PName命令
+let JsonJSCodeJQ = [];//储存所有的JQ编译数据
+let JsonJSCodeTransformation = [];//储存所有的代码转换类编译数据
+let JavascriptCodeKey = [];//储存所有的JS关键字
+let JavascriptNoCodeStatic = [];//储存所有非静态的类中命令
+let JavascriptEvCode = [];//储存所有的全局侦听事件命令
+let JavascriptYesCodeStatic = [];//储存所有的静态命令
+let JavascriptYesCodeStatic2 = [];//储存所有的静态命令,将endfofdianhaobenin转换为.
+let JavascriptOverallCode = [];//储存所有的全局命令
+let JavascriptCompilerLineBreak = [];//编译换行处理,例如类名\r\n .
+//初始化JS编译JSON信息
+function JsonJSCodeMain(JavascriptCompilationPNameAll_, JSON_JQ, JsonJSCodeTransformation_, JavascriptCodeKey_, JavascriptNoCodeStatic_, JavascriptEvCode_, JavascriptYesCodeStatic_, JavascriptOverallCode_) {
+ JavascriptCompilationPNameAll = JavascriptCompilationPNameAll_
+ let JavascriptCompilationPNameAllLs = [[], [], [], [], [], [], [], [], [], []];
+ for (let index = 0; index < JavascriptCompilationPNameAll_.length; index++) {
+ if (JavascriptCompilationPNameAll_[index]["com1"].indexOf("endfofdianhaobenin") == -1) {
+ JavascriptCompilationPNameAllLs[0][JavascriptCompilationPNameAllLs[0].length] = JavascriptCompilationPNameAll_[index];
+ }
+ let intEnd = JavascriptCompilationPNameAll_[index]["com1"].split("endfofdianhaobenin");
+ if (intEnd.length == 2) {
+ JavascriptCompilationPNameAllLs[1][JavascriptCompilationPNameAllLs[1].length] = JavascriptCompilationPNameAll_[index];
+ }
+ if (intEnd.length == 3) {
+ JavascriptCompilationPNameAllLs[2][JavascriptCompilationPNameAllLs[2].length] = JavascriptCompilationPNameAll_[index];
+ }
+ if (intEnd.length == 4) {
+ JavascriptCompilationPNameAllLs[3][JavascriptCompilationPNameAllLs[3].length] = JavascriptCompilationPNameAll_[index];
+ }
+ if (intEnd.length == 5) {
+ JavascriptCompilationPNameAllLs[4][JavascriptCompilationPNameAllLs[4].length] = JavascriptCompilationPNameAll_[index];
+ }
+ if (intEnd.length == 6) {
+ JavascriptCompilationPNameAllLs[5][JavascriptCompilationPNameAllLs[5].length] = JavascriptCompilationPNameAll_[index];
+ }
+ if (intEnd.length == 7) {
+ JavascriptCompilationPNameAllLs[6][JavascriptCompilationPNameAllLs[6].length] = JavascriptCompilationPNameAll_[index];
+ }
+ }
+ for (let index = 0; index < JavascriptCompilationPNameAllLs.length; index++) {
+ for (let index_ = 0; index_ < JavascriptCompilationPNameAllLs[JavascriptCompilationPNameAllLs.length - index - 1].length; index_++) {
+ JavascriptCompilationPNameAll[JavascriptCompilationPNameAll.length] = JavascriptCompilationPNameAllLs[JavascriptCompilationPNameAllLs.length - index - 1][index_]
+ }
+ }
+ JsonJSCodeJQ = JSON_JQ;
+ JsonJSCodeTransformation = JsonJSCodeTransformation_;
+ JavascriptCodeKey = JavascriptCodeKey_;
+ JavascriptNoCodeStatic = JavascriptNoCodeStatic_;
+ JavascriptEvCode = JavascriptEvCode_;
+ JavascriptYesCodeStatic = JavascriptYesCodeStatic_;
+ if (JavascriptYesCodeStatic != undefined) {
+ JavascriptYesCodeStatic2 = JSON.parse(JSON.stringify(JavascriptYesCodeStatic).replaceAll("endfofdianhaobenin", "."))
+ }
+ JavascriptOverallCode = JavascriptOverallCode_;
+}
+//编译Html文件下所有Script中的JS代码
+//编译JS命令
+//str-要编译的页面代码,
+//CodeType-编译的类型,1代表编译成本地语言,2代表编译成英文
+//【注意:本地语言,例如中文、柬埔寨或者其他国家语言以正则为主,目前暂时支持中文】
+//FileID - 文件的ID,可以是空字符串
+function JsCodeCompilerAll(str, CodeType, FileID) {
+ let JsCodeAll = JsCodeAllScript(str);
+ for (let index = 0; index < JsCodeAll.length; index++) {
+ let JsCodeAr = [JsCodeAll[index], JsCodeAll[index]];
+ JsCodeAr[1] = JsCodeCompiler({
+ "JSCode": JsCodeAr[1],
+ "CodeType": CodeType,
+ "FileID": FileID
+ });
+ str = str.replace(JsCodeAr[0], JsCodeAr[1])
+ }
+ return str;
+}
+//获取所有Script标签中的内容
+function JsCodeAllScript(htmlStr) {
+ let reg = RegExp("()", "g");
+ htmlStrAll = htmlStr.match(reg);
+ if (htmlStrAll == null || htmlStrAll == undefined) {
+ htmlStrAll = [];
+ }
+ if (htmlStrAll.length >= 1) {
+ for (let index = 0; index < htmlStrAll.length; index++) {
+ let JsCodeStrSplit = htmlStrAll[index];
+ let JsCodeStrSplitArr = JsCodeStrSplit.split(">");
+ if (JsCodeStrSplitArr.length >= 1) {
+ if (indexOfT(JsCodeStrSplitArr[0], "=\"") == false && indexOfT(JsCodeStrSplitArr[0], "=\'") == false && indexOfT(JsCodeStrSplitArr[0], FileTypeExtension.js) == false && indexOfT(JsCodeStrSplitArr[0], " http://") == false && indexOfT(JsCodeStrSplitArr[0], " https://") == false) {
+ htmlStrAllReturn[htmlStrAllReturn.length] = htmlStrAll[index];
+ } else {
+ if (indexOfT(JsCodeStrSplitArr[0], `type="module"`) != false) {
+ htmlStrAllReturn[htmlStrAllReturn.length] = htmlStrAll[index];
+ }
+ if (indexOfT(JsCodeStrSplitArr[0], `type='module'`) != false) {
+ htmlStrAllReturn[htmlStrAllReturn.length] = htmlStrAll[index];
+ }
+ if (indexOfT(JsCodeStrSplitArr[0], `因特网标准='module'`) != false) {
+ htmlStrAllReturn[htmlStrAllReturn.length] = htmlStrAll[index];
+ }
+ if (indexOfT(JsCodeStrSplitArr[0], `因特网标准="module"`) != false) {
+ htmlStrAllReturn[htmlStrAllReturn.length] = htmlStrAll[index];
+ }
+ }
+ }
+ }
+ }
+ return htmlStrAllReturn;
+}
+//编译JS命令
+//JSCode-要编译的JS代码
+//CodeType-编译的类型,1代表编译成本地语言,2代表编译成英文
+//【注意:本地语言,例如中文、柬埔寨或者其他国家语言以正则为主,目前暂时支持中文】
+//FileID - 文件的ID,可以是空字符串
+//CompilerObj - 编译配置
+function JsCodeCompiler(CompilerObj = {}) {
+ JavascriptCompilerLineBreak = [];//编译换行处理
+ CompilerObj["JSCode"] = "CompilerStartJS" + CompilerStart + CompilerObj["JSCode"];
+ CompilerObj["JSCode"] = RegularReplacer(CompilerObj["JSCode"], 1)//编译特殊符号替换
+ CompilerObj["JSCode"] = JsCodeCompilerCodeJQ(CompilerObj["CodeType"], CompilerObj["JSCode"]);//JQ专属编译
+ let JsCodeJSonCompilerStr = [];//储存所有编译时产生的临时数据,该变量中的临时数据将不会参与到JS编译!
+ let RetJSCode = NoStrCompiler(JsCodeJSonCompilerStr, CompilerObj["JSCode"], 1, ComPilerDataMsgType.IfComPiler, CompilerObj["FileID"]);//不参与编译的相关数据加密
+ JsCodeJSonCompilerStr = RetJSCode["JsCodeJSonCompilerStr"]
+ CompilerObj["JSCode"] = RetJSCode["code"]
+ CompilerObj["JSCode"] = JsCodeCompilertEvCode(CompilerObj["CodeType"], CompilerObj["JSCode"]);//全局事件侦听编译
+ CompilerObj["JSCode"] = JsCodeCompilerCodePNameAll(CompilerObj["CodeType"], CompilerObj["JSCode"]);//多层指向PName编译
+ CompilerObj["JSCode"] = JsCodeCompYesCodeStatic(CompilerObj["CodeType"], CompilerObj["JSCode"]);//静态命令编译
+ CompilerObj["JSCode"] = JsCodeCompilerClassCode(CompilerObj["CodeType"], CompilerObj["JSCode"]);//类数据编译
+ CompilerObj["JSCode"] = JsCodeCompilerCodeKeyword(CompilerObj["CodeType"], CompilerObj["JSCode"]);//关键字的编译
+ CompilerObj["JSCode"] = JsCodeCompOverallCode(CompilerObj["CodeType"], CompilerObj["JSCode"]);//全局命令编译
+ RetJSCode = NoStrCompiler(JsCodeJSonCompilerStr, CompilerObj["JSCode"], 2, ComPilerDataMsgType.IfComPiler, CompilerObj["FileID"]);//不参与编译的相关数据解密
+ CompilerObj["JSCode"] = RetJSCode["code"]
+ CompilerObj["JSCode"] = YesStrCompiler(CompilerObj["JSCode"], CompilerObj["CodeType"]);
+ //处理需要编译的NoStrCompiler代码,例如:双引号中的html代码等
+ CompilerObj["JSCode"] = RegularReplacer(CompilerObj["JSCode"], 2)//编译特殊符号还原
+ CompilerObj["JSCode"] = CompilerObj["JSCode"].replace("CompilerStartJS" + CompilerStart, "");
+ return CompilerObj["JSCode"];
+}
+//类数据编译
+function JsCodeCompilerClassCode(CodeType, JSCode) {
+ for (let index = 0; index < JavascriptNoCodeStatic.length; index++) {
+ if (JSCode.includes(JavascriptNoCodeStatic[index]["T_title_en"]) || JSCode.includes(JavascriptNoCodeStatic[index]["T_title"]))//查询到代码中有这个类的关键字
+ {
+ if (CodeType == 1) {
+ JSCode = JsCodeReplace(JSCode, JavascriptNoCodeStatic[index]["T_title_en"], JavascriptNoCodeStatic[index]["T_title"], 1, 2);
+ } else {
+ JSCode = JsCodeReplace(JSCode, JavascriptNoCodeStatic[index]["T_title"], JavascriptNoCodeStatic[index]["T_title_en"], 1, 2);
+ }
+ if (JavascriptCompilerLineBreak.indexOf(JavascriptNoCodeStatic[index]["T_title_en"]) == -1) {
+ JavascriptCompilerLineBreak[JavascriptCompilerLineBreak.length] = JavascriptNoCodeStatic[index]["T_title_en"]
+ }
+ if (JavascriptCompilerLineBreak.indexOf(JavascriptNoCodeStatic[index]["T_title"]) == -1) {
+ JavascriptCompilerLineBreak[JavascriptCompilerLineBreak.length] = JavascriptNoCodeStatic[index]["T_title"]
+ }
+
+ }
+ if (JavascriptNoCodeStatic[index]["CodeList"] != undefined && JavascriptNoCodeStatic[index]["CodeList"] != null) {
+ for (let index_ = 0; index_ < JavascriptNoCodeStatic[index]["CodeList"].length; index_++) {//循环遍历类下面的命令
+ let CodeData = {
+ T_title: "." + JavascriptNoCodeStatic[index]["CodeList"][index_]["T_title"],
+ T_title_en: "." + JavascriptNoCodeStatic[index]["CodeList"][index_]["T_title_en"]
+ }
+ CodeData.T_title = CodeData.T_title.replaceAll(".", Comendfofdianhaobenin)
+ CodeData.T_title_en = CodeData.T_title_en.replaceAll(".", Comendfofdianhaobenin)
+ if (CodeType == 1) {
+ JSCode = JsCodeReplace(JSCode, CodeData.T_title_en, CodeData.T_title, 1, 3);
+ } else {
+ JSCode = JsCodeReplace(JSCode, CodeData.T_title, CodeData.T_title_en, 1, 3);
+ }
+ }
+ }
+ }
+ return JSCode;
+}
+//全局侦听事件编译
+function JsCodeCompilertEvCode(CodeType, JSCode) {
+ for (let index = 0; index < JavascriptEvCode.length; index++) {
+ if (JavascriptEvCode[index]["CodeList"] != undefined && JavascriptEvCode[index]["CodeList"] != null) {
+ for (let index_ = 0; index_ < JavascriptEvCode[index]["CodeList"].length; index_++) {//循环遍历类下面的命令
+ for (let index__ = 0; index__ < 6; index__++) {
+ let IDInt = index__ + 1;
+ let CodeData = {
+ T_title: "." + JavascriptEvCode[index]["CodeList"][index_]["com" + IDInt],
+ T_title_en: "." + JavascriptEvCode[index]["CodeList"][index_]["comEn" + IDInt]
+ }
+ CodeData.T_title = CodeData.T_title.replaceAll(".", Comendfofdianhaobenin)
+ CodeData.T_title_en = CodeData.T_title_en.replaceAll(".", Comendfofdianhaobenin)
+ if (CodeType == 1) {
+ JSCode = JsCodeReplace(JSCode, CodeData.T_title_en, CodeData.T_title, 3, 3);
+ } else {
+ JSCode = JsCodeReplace(JSCode, CodeData.T_title, CodeData.T_title_en, 3, 3);
+ }
+ }
+ }
+ }
+ }
+ return JSCode;
+}
+//关键字编译
+//CodeType-编译的类型,1代表编译成本地语言,2代表编译成英文
+function JsCodeCompilerCodeKeyword(CodeType, JSCode) {
+ for (let index = 0; index < JavascriptCodeKey.length; index++) {
+ if (JavascriptCodeKey[index]["JSType"] == "全局函数") {
+ continue;
+ }
+ if (CodeType == 1) {
+ if (JSCode.includes(JavascriptCodeKey[index]["JSNameEN"]))//代表有需要进行处理的关键字
+ {
+ JSCode = JsCodeReplace(JSCode, JavascriptCodeKey[index]["JSNameEN"], JavascriptCodeKey[index]["JSName"], 2, 1);
+ }
+ }
+ if (CodeType == 2) {
+ if (JSCode.includes(JavascriptCodeKey[index]["JSName"]))//代表有需要进行处理的关键字
+ {
+ JSCode = JsCodeReplace(JSCode, JavascriptCodeKey[index]["JSName"], JavascriptCodeKey[index]["JSNameEN"], 2, 1);
+ }
+ }
+ }
+ return JSCode;
+}
+//静态命令编译
+function JsCodeCompYesCodeStatic(CodeType, JSCode) {
+ for (let index = 0; index < JavascriptYesCodeStatic.length; index++) {
+ if (JavascriptYesCodeStatic[index]["CodeList"] != undefined && JavascriptYesCodeStatic[index]["CodeList"] != null) {
+ for (let index_ = 0; index_ < JavascriptYesCodeStatic[index]["CodeList"].length; index_++) {//循环遍历类下面的命令
+ let CodeData = {
+ T_title: JavascriptYesCodeStatic[index]["CodeList"][index_]["comZh"],
+ T_title_en: JavascriptYesCodeStatic[index]["CodeList"][index_]["comEn"]
+ }
+ if (CodeType == 1) {
+ if (JSCode.includes(JavascriptYesCodeStatic[index]["CodeList"][index_]["com1"]) == true) {
+ JSCode = JsCodeReplace(JSCode, JavascriptYesCodeStatic[index]["CodeList"][index_]["com1"], CodeData.T_title, 2, 4);
+ }
+ if (JSCode.includes(JavascriptYesCodeStatic[index]["CodeList"][index_]["com2"]) == true) {
+ JSCode = JsCodeReplace(JSCode, JavascriptYesCodeStatic[index]["CodeList"][index_]["com2"], CodeData.T_title, 2, 4);
+ }
+ if (JSCode.includes(JavascriptYesCodeStatic[index]["CodeList"][index_]["com3"]) == true) {
+ JSCode = JsCodeReplace(JSCode, JavascriptYesCodeStatic[index]["CodeList"][index_]["com3"], CodeData.T_title, 2, 4);
+ }
+ if (JSCode.includes(JavascriptYesCodeStatic[index]["CodeList"][index_]["com4"]) == true) {
+ JSCode = JsCodeReplace(JSCode, JavascriptYesCodeStatic[index]["CodeList"][index_]["com4"], CodeData.T_title, 2, 4);
+ }
+ } else {
+ if (JSCode.includes(JavascriptYesCodeStatic[index]["CodeList"][index_]["com1"]) == true) {
+ JSCode = JsCodeReplace(JSCode, JavascriptYesCodeStatic[index]["CodeList"][index_]["com1"], CodeData.T_title_en, 2, 4);
+ }
+ if (JSCode.includes(JavascriptYesCodeStatic[index]["CodeList"][index_]["com2"]) == true) {
+ JSCode = JsCodeReplace(JSCode, JavascriptYesCodeStatic[index]["CodeList"][index_]["com2"], CodeData.T_title_en, 2, 4);
+ }
+ if (JSCode.includes(JavascriptYesCodeStatic[index]["CodeList"][index_]["com3"]) == true) {
+ JSCode = JsCodeReplace(JSCode, JavascriptYesCodeStatic[index]["CodeList"][index_]["com3"], CodeData.T_title_en, 2, 4);
+ }
+ if (JSCode.includes(JavascriptYesCodeStatic[index]["CodeList"][index_]["com4"]) == true) {
+ JSCode = JsCodeReplace(JSCode, JavascriptYesCodeStatic[index]["CodeList"][index_]["com4"], CodeData.T_title_en, 2, 4);
+ }
+ }
+ }
+ }
+ }
+ return JSCode;
+}
+//全局命令编译
+function JsCodeCompOverallCode(CodeType, JSCode) {
+ for (let index = 0; index < JavascriptOverallCode.length; index++) {
+ let CodeData = {
+ T_title: JavascriptOverallCode[index]["T_title"],
+ T_title_en: JavascriptOverallCode[index]["T_title_en"]
+ }
+ if (CodeType == 1) {
+ JSCode = JsCodeReplace(JSCode, CodeData.T_title_en, CodeData.T_title, 2, 5);
+ } else {
+ JSCode = JsCodeReplace(JSCode, CodeData.T_title, CodeData.T_title_en, 2, 5);
+ }
+ }
+ return JSCode;
+}
+//多层PName命令编译
+function JsCodeCompilerCodePNameAll(CodeType, JSCode) {
+ for (let index = 0; index < JavascriptCompilationPNameAll.length; index++) {
+ if (JSCode.includes(JavascriptCompilationPNameAll[index]["com1"]) == true || JSCode.includes(JavascriptCompilationPNameAll[index]["com2"]) == true) {
+ if (CodeType == 1) {
+ JSCode = JsCodeReplace(JSCode, JavascriptCompilationPNameAll[index]["com1"], JavascriptCompilationPNameAll[index]["comEnd2"], 2, 3);
+ JSCode = JsCodeReplace(JSCode, JavascriptCompilationPNameAll[index]["com2"], JavascriptCompilationPNameAll[index]["comEnd2"], 2, 3);
+ } else {
+ JSCode = JsCodeReplace(JSCode, JavascriptCompilationPNameAll[index]["com1"], JavascriptCompilationPNameAll[index]["comEnd1"], 2, 3);
+ JSCode = JsCodeReplace(JSCode, JavascriptCompilationPNameAll[index]["com2"], JavascriptCompilationPNameAll[index]["comEnd1"], 2, 3);
+ }
+ }
+ }
+ return JSCode;
+}
+//Type-1代表替换转变,2代表转变还原
+function RegularReplacer(code, Type) {
+ if (Type == 1) {
+ code = code.replaceAll("${", ComSymbol$FOFStuDio);//编译条件点号转编译内容
+ code = code.replaceAll(".", Comendfofdianhaobenin);//编译条件点号转编译内容
+ }
+ if (Type == 2) {
+ code = code.replaceAll(Comendfofdianhaobenin, ".");//编译条件点号转编译内容
+ code = code.replaceAll(ComSymbol$FOFStuDio, "${");//编译条件点号转编译内容
+ }
+ return code
+}
\ No newline at end of file
diff --git a/js/JavaScript/CompilerJavaScriptCodeReplace.js b/js/JavaScript/CompilerJavaScriptCodeReplace.js
new file mode 100644
index 0000000..6b2bbf1
--- /dev/null
+++ b/js/JavaScript/CompilerJavaScriptCodeReplace.js
@@ -0,0 +1,84 @@
+//用来进行JS命令的替换编译,本方法不能独立使用,通常用来配合JsCodeCompiler命令
+//参数1【JSCode】为整体的JS代码
+//参数2【JSCodeKeyword】为需要编译的关键字
+//参数3【regCompilerCode】为需要替换编译为的内容
+//参数4【ifendfofdianhaobenin】【只针对命令有效】,1需要加点编译【针对普通命令】;2常规编译,不加点;3代表不需要正则,直接替换
+//参数5【ReplaceType】为编译类型,1代表关键字,2代表类,3代表命令,4代表静态命令【类.xxx】,5代表全局静态命令
+function JsCodeReplace(JSCode, JSCodeKeyword, regCompilerCode, ifendfofdianhaobenin, ReplaceType) {
+ let JSCodeStr = JSCode;
+ JSCodeStr = JSCodeStr + "\r\nBeginEnd" + CompilerIdentificationText;//给代码结尾加上标识符,防止因为结尾代码【代码最后面没有内容】而造成编译失效
+ if (ifendfofdianhaobenin == 3) {
+ JSCodeStr = JSCodeStr.replaceAll(JSCodeKeyword, regCompilerCode)
+ }
+ if (ReplaceType == 1 || ReplaceType == 2) {
+ //当编译类型为关键字或者类的时候;将点号进行一次替换,替换为一段不会重复的文本
+ JSCodeStr = JSCodeStr.replaceAll(Comendfofdianhaobenin, CompilerIdentificationText);
+ }
+ if (ifendfofdianhaobenin == 1 || ifendfofdianhaobenin == 2) {
+ if (ReplaceType == 3 && ifendfofdianhaobenin == 1) {
+ if (JSCodeStr.includes(Comendfofdianhaobenin)) {
+ JSCodeStr = JSCodeStr.replace(new RegExp(Comendfofdianhaobenin, 'gm'), "-endfofdianhaobenin");
+ }
+ }
+ if (JSCodeStr == regCompilerCode) {//判断是否是直接一样的内容,一样就直接匹配替换
+ JSCodeStr = regCompilerCode;
+ return JSCodeStr;
+ }
+ let JSCodeStrOriginal = JSCodeStr;
+ if (JSCodeStrOriginal.includes(JSCodeKeyword)) {
+ let RegExpObj = windowJsCodeReplace(JSCodeStrOriginal, JSCodeKeyword, regCompilerCode, ifendfofdianhaobenin, ReplaceType)
+ if (RegExpObj["JSCodeStrArr"]) {
+ if (RegExpObj["JSCodeStrArr"].length >= 1) {
+ regCompilerCode = RegExpObj["regCompilerCode"]
+ let regCompilerCodeArr = [StrCodeUuid(regCompilerCode), regCompilerCode];
+ JSCodeStr = JSCodeStr.replace(RegExpObj["RegExp"], regCompilerCodeArr[0]);
+ for (let index = 0; index < RegExpObj["JSCodeStrArr"].length; index++) {
+ let FirstText = RegExpObj["JSCodeStrArr"][index].substring(0, 1);
+ JSCodeStr = JSCodeStr.replace(regCompilerCodeArr[0], FirstText + regCompilerCodeArr[1]);
+ }
+ }
+ }
+ }
+ }
+ JSCodeStr = JSCodeStr.replaceAll("\r\nBeginEnd" + CompilerIdentificationText, "");//将添加上的结尾代码删除
+ if (ReplaceType == 1 || ReplaceType == 2) {
+ //将被替换的文本还原成点号
+ JSCodeStr = JSCodeStr.replaceAll(CompilerIdentificationText, Comendfofdianhaobenin);
+ }
+ if (ReplaceType == 3 && ifendfofdianhaobenin == 1) {
+ if (JSCodeStr.includes("-endfofdianhaobenin")) {
+ JSCodeStr = JSCodeStr.replace(new RegExp("-endfofdianhaobenin", 'gm'), Comendfofdianhaobenin);
+ }
+ }
+ return JSCodeStr;
+}
+function windowJsCodeReplace(JSCodeStrOriginal, JSCodeKeyword, regCompilerCode, ifendfofdianhaobenin, ReplaceType) {
+ let JSCodeStrArr = JSCodeStrOriginal.match(new RegExp("(?=[^0-9a-zA-Z\u4e00-\u9fa5_])[^0-9a-zA-Z\u4e00-\u9fa5_]" + JSCodeKeyword + "(?=[^0-9a-zA-Z\u4e00-\u9fa5_])", "g"));
+ if (JSCodeStrArr == null && ifendfofdianhaobenin == 2 && ReplaceType == 4) {
+ if (JSCodeStrOriginal.includes("浏览器窗口" + Comendfofdianhaobenin + JSCodeKeyword)) {
+ JSCodeStrArr = JSCodeStrOriginal.match(new RegExp("(?=[^0-9a-zA-Z\u4e00-\u9fa5_])[^0-9a-zA-Z\u4e00-\u9fa5_]" + "浏览器窗口" + Comendfofdianhaobenin + JSCodeKeyword + "(?=[^0-9a-zA-Z\u4e00-\u9fa5_])", "g"));
+ if (JSCodeStrArr != null) {
+ return {
+ "JSCodeStrArr": JSCodeStrArr,
+ "RegExp": new RegExp("(?=[^0-9a-zA-Z\u4e00-\u9fa5_])[^0-9a-zA-Z\u4e00-\u9fa5_]" + "浏览器窗口" + Comendfofdianhaobenin + JSCodeKeyword + "(?=[^0-9a-zA-Z\u4e00-\u9fa5_])", "g"),
+ "regCompilerCode": "浏览器窗口" + Comendfofdianhaobenin + regCompilerCode
+ }
+ }
+ }
+ if (JSCodeStrArr == null && ifendfofdianhaobenin == 2 && ReplaceType == 4) {
+ if (JSCodeStrOriginal.includes("window" + Comendfofdianhaobenin + JSCodeKeyword)) {
+ JSCodeStrArr = JSCodeStrOriginal.match(new RegExp("(?=[^0-9a-zA-Z\u4e00-\u9fa5_])[^0-9a-zA-Z\u4e00-\u9fa5_]" + "window" + Comendfofdianhaobenin + JSCodeKeyword + "(?=[^0-9a-zA-Z\u4e00-\u9fa5_])", "g"));
+ return {
+ "JSCodeStrArr": JSCodeStrArr,
+ "RegExp": new RegExp("(?=[^0-9a-zA-Z\u4e00-\u9fa5_])[^0-9a-zA-Z\u4e00-\u9fa5_]" + "window" + Comendfofdianhaobenin + JSCodeKeyword + "(?=[^0-9a-zA-Z\u4e00-\u9fa5_])", "g"),
+ "regCompilerCode": "window" + Comendfofdianhaobenin + regCompilerCode
+ }
+ }
+ }
+ }
+ return {
+ "JSCodeStrArr": JSCodeStrArr,
+ "RegExp": new RegExp("(?=[^0-9a-zA-Z\u4e00-\u9fa5_])[^0-9a-zA-Z\u4e00-\u9fa5_]" + JSCodeKeyword + "(?=[^0-9a-zA-Z\u4e00-\u9fa5_])", "g"),
+ "regCompilerCode": regCompilerCode
+ };
+}
\ No newline at end of file
diff --git a/js/JavaScript/CompilerJavaScriptJQ.js b/js/JavaScript/CompilerJavaScriptJQ.js
new file mode 100644
index 0000000..3644d8b
--- /dev/null
+++ b/js/JavaScript/CompilerJavaScriptJQ.js
@@ -0,0 +1,580 @@
+//CodeType-参数2编译的类型;1代表编译成本地语言,2代表编译成英文
+function JsCodeCompilerCodeJQ(CodeType, JSCode) {
+ JSCode = JsCodeCompilerJQselector(CodeType, JSCode);
+ JSCode = JsCodeCompilerJQFun(CodeType, JSCode);
+ if (CodeType == 1) {
+ JSCode = JsCodeCompilerJQHtml_Zh(JSCode)
+ } else {
+ JSCode = JsCodeCompilerJQHtml_En(JSCode)
+ }
+ return JSCode;
+}
+function JsCodeCompilerJQHtml_En(JSCode) {
+ for (let index = 0; index < JSON3_All.length; index++) {
+ let Title = [JSON3_All[index]["title"], JSON3_All[index]["title"]]
+ Title[1] = Title[1].replace("<", "");
+ Title[1] = Title[1].replace(">", "");
+ Title[1] = Title[1].replace("!", "");
+ let Title_en = [JSON3_All[index]["title_en"], JSON3_All[index]["title_en"]]
+ Title_en[1] = Title_en[1].replace("<", "");
+ Title_en[1] = Title_en[1].replace(">", "");
+ Title_en[1] = Title_en[1].replace("!", "");
+ if (JSCode.includes("$(\"" + Title[0] + "\")") == true) {
+ JSCode = JSCode.replaceAll("$(\"" + Title[0] + "\")", "$(\"" + Title_en[0] + "\")")
+ }
+ if (JSCode.includes("$('" + Title[0] + "')") == true) {
+ JSCode = JSCode.replaceAll("$('" + Title[0] + "')", "$('" + Title_en[0] + "')")
+ }
+ if (JSCode.includes("$(`" + Title[0] + "`)") == true) {
+ JSCode = JSCode.replaceAll("$(`" + Title[0] + "`)", "$(`" + Title_en[0] + "`)")
+ }
+
+ if (JSCode.includes("$(\" " + Title[0] + "\")") == true) {
+ JSCode = JSCode.replaceAll("$(\"" + Title[0] + "\")", "$(\"" + Title_en[0] + "\")")
+ }
+ if (JSCode.includes("$(' " + Title[0] + "')") == true) {
+ JSCode = JSCode.replaceAll("$('" + Title[0] + "')", "$('" + Title_en[0] + "')")
+ }
+ if (JSCode.includes("$(` " + Title[0] + "`)") == true) {
+ JSCode = JSCode.replaceAll("$(`" + Title[0] + "`)", "$(`" + Title_en[0] + "`)")
+ }
+
+ if (JSCode.includes("$( \"" + Title[0] + "\")") == true) {
+ JSCode = JSCode.replaceAll("$(\"" + Title[0] + "\")", "$(\"" + Title_en[0] + "\")")
+ }
+ if (JSCode.includes("$( '" + Title[0] + "')") == true) {
+ JSCode = JSCode.replaceAll("$('" + Title[0] + "')", "$('" + Title_en[0] + "')")
+ }
+ if (JSCode.includes("$( `" + Title[0] + "`)") == true) {
+ JSCode = JSCode.replaceAll("$(`" + Title[0] + "`)", "$(`" + Title_en[0] + "`)")
+ }
+
+ if (JSCode.includes("$(\"" + Title[0] + " \")") == true) {
+ JSCode = JSCode.replaceAll("$(\"" + Title[0] + "\")", "$(\"" + Title_en[0] + "\")")
+ }
+ if (JSCode.includes("$('" + Title[0] + " ')") == true) {
+ JSCode = JSCode.replaceAll("$('" + Title[0] + "')", "$('" + Title_en[0] + "')")
+ }
+ if (JSCode.includes("$(`" + Title[0] + " `)") == true) {
+ JSCode = JSCode.replaceAll("$(`" + Title[0] + "`)", "$(`" + Title_en[0] + "`)")
+ }
+
+ if (JSCode.includes("$(\" " + Title[0] + " \")") == true) {
+ JSCode = JSCode.replaceAll("$(\"" + Title[0] + "\")", "$(\"" + Title_en[0] + "\")")
+ }
+ if (JSCode.includes("$(' " + Title[0] + " ')") == true) {
+ JSCode = JSCode.replaceAll("$('" + Title[0] + "')", "$('" + Title_en[0] + "')")
+ }
+ if (JSCode.includes("$(` " + Title[0] + " `)") == true) {
+ JSCode = JSCode.replaceAll("$(`" + Title[0] + "`)", "$(`" + Title_en[0] + "`)")
+ }
+
+ if (JSCode.includes("$( \"" + Title[0] + "\" )") == true) {
+ JSCode = JSCode.replaceAll("$(\"" + Title[0] + "\")", "$(\"" + Title_en[0] + "\")")
+ }
+ if (JSCode.includes("$( '" + Title[0] + "' )") == true) {
+ JSCode = JSCode.replaceAll("$('" + Title[0] + "')", "$('" + Title_en[0] + "')")
+ }
+ if (JSCode.includes("$( `" + Title[0] + "` )") == true) {
+ JSCode = JSCode.replaceAll("$(`" + Title[0] + "`)", "$(`" + Title_en[0] + "`)")
+ }
+
+ if (JSCode.includes("$( \"" + Title[0] + " \")") == true) {
+ JSCode = JSCode.replaceAll("$(\"" + Title[0] + "\")", "$(\"" + Title_en[0] + "\")")
+ }
+ if (JSCode.includes("$( '" + Title[0] + " ')") == true) {
+ JSCode = JSCode.replaceAll("$('" + Title[0] + "')", "$('" + Title_en[0] + "')")
+ }
+ if (JSCode.includes("$( `" + Title[0] + " `)") == true) {
+ JSCode = JSCode.replaceAll("$(`" + Title[0] + "`)", "$(`" + Title_en[0] + "`)")
+ }
+
+ if (JSCode.includes("$(\"" + Title[0] + " ") == true) {
+ JSCode = JSCode.replaceAll("$(\"" + Title[0] + " ", "$(\"" + Title_en[0] + " ")
+ }
+ if (JSCode.includes("$('" + Title[0] + " ") == true) {
+ JSCode = JSCode.replaceAll("$('" + Title[0] + " ", "$('" + Title_en[0] + " ")
+ }
+ if (JSCode.includes("$(`" + Title[0] + " ") == true) {
+ JSCode = JSCode.replaceAll("$(`" + Title[0] + " ", "$(`" + Title_en[0] + " ")
+ }
+
+ if (JSCode.includes("$( \"" + Title[0] + " ") == true) {
+ JSCode = JSCode.replaceAll("$( \"" + Title[0] + " ", "$( \"" + Title_en[0] + " ")
+ }
+ if (JSCode.includes("$( '" + Title[0] + " ") == true) {
+ JSCode = JSCode.replaceAll("$( '" + Title[0] + " ", "$( '" + Title_en[0] + " ")
+ }
+ if (JSCode.includes("$( `" + Title[0] + " ") == true) {
+ JSCode = JSCode.replaceAll("$( `" + Title[0] + " ", "$( `" + Title_en[0] + " ")
+ }
+
+ if (JSCode.includes("$(\" " + Title[0] + " ") == true) {
+ JSCode = JSCode.replaceAll("$(\" " + Title[0] + " ", "$(\" " + Title_en[0] + " ")
+ }
+ if (JSCode.includes("$(' " + Title[0] + " ") == true) {
+ JSCode = JSCode.replaceAll("$(' " + Title[0] + " ", "$(' " + Title_en[0] + " ")
+ }
+ if (JSCode.includes("$(` " + Title[0] + " ") == true) {
+ JSCode = JSCode.replaceAll("$(` " + Title[0] + " ", "$(` " + Title_en[0] + " ")
+ }
+
+ //==========
+
+ if (JSCode.includes("$(\"" + Title[1] + "\")") == true) {
+ JSCode = JSCode.replaceAll("$(\"" + Title[1] + "\")", "$(\"" + Title_en[1] + "\")")
+ }
+ if (JSCode.includes("$('" + Title[1] + "')") == true) {
+ JSCode = JSCode.replaceAll("$('" + Title[1] + "')", "$('" + Title_en[1] + "')")
+ }
+ if (JSCode.includes("$(`" + Title[1] + "`)") == true) {
+ JSCode = JSCode.replaceAll("$(`" + Title[1] + "`)", "$(`" + Title_en[1] + "`)")
+ }
+ if (JSCode.includes("$(" + Title[1] + ")") == true) {
+ JSCode = JSCode.replaceAll("$(" + Title[1] + ")", "$(" + Title_en[1] + ")")
+ }
+
+ if (JSCode.includes("$(\" " + Title[1] + "\")") == true) {
+ JSCode = JSCode.replaceAll("$(\"" + Title[1] + "\")", "$(\"" + Title_en[1] + "\")")
+ }
+ if (JSCode.includes("$(' " + Title[1] + "')") == true) {
+ JSCode = JSCode.replaceAll("$('" + Title[1] + "')", "$('" + Title_en[1] + "')")
+ }
+ if (JSCode.includes("$(` " + Title[1] + "`)") == true) {
+ JSCode = JSCode.replaceAll("$(`" + Title[1] + "`)", "$(`" + Title_en[1] + "`)")
+ }
+ if (JSCode.includes("$( " + Title[1] + ")") == true) {
+ JSCode = JSCode.replaceAll("$(" + Title[1] + ")", "$(" + Title_en[1] + ")")
+ }
+
+ if (JSCode.includes("$( \"" + Title[1] + "\")") == true) {
+ JSCode = JSCode.replaceAll("$(\"" + Title[1] + "\")", "$(\"" + Title_en[1] + "\")")
+ }
+ if (JSCode.includes("$( '" + Title[1] + "')") == true) {
+ JSCode = JSCode.replaceAll("$('" + Title[1] + "')", "$('" + Title_en[1] + "')")
+ }
+ if (JSCode.includes("$( `" + Title[1] + "`)") == true) {
+ JSCode = JSCode.replaceAll("$(`" + Title[1] + "`)", "$(`" + Title_en[1] + "`)")
+ }
+ if (JSCode.includes("$(" + Title[1] + " )") == true) {
+ JSCode = JSCode.replaceAll("$(" + Title[1] + ")", "$(" + Title_en[1] + ")")
+ }
+
+ if (JSCode.includes("$(\"" + Title[1] + " \")") == true) {
+ JSCode = JSCode.replaceAll("$(\"" + Title[1] + "\")", "$(\"" + Title_en[1] + "\")")
+ }
+ if (JSCode.includes("$('" + Title[1] + " ')") == true) {
+ JSCode = JSCode.replaceAll("$('" + Title[1] + "')", "$('" + Title_en[1] + "')")
+ }
+ if (JSCode.includes("$(`" + Title[1] + " `)") == true) {
+ JSCode = JSCode.replaceAll("$(`" + Title[1] + "`)", "$(`" + Title_en[1] + "`)")
+ }
+
+ if (JSCode.includes("$(\" " + Title[1] + " \")") == true) {
+ JSCode = JSCode.replaceAll("$(\"" + Title[1] + "\")", "$(\"" + Title_en[1] + "\")")
+ }
+ if (JSCode.includes("$(' " + Title[1] + " ')") == true) {
+ JSCode = JSCode.replaceAll("$('" + Title[1] + "')", "$('" + Title_en[1] + "')")
+ }
+ if (JSCode.includes("$(` " + Title[1] + " `)") == true) {
+ JSCode = JSCode.replaceAll("$(`" + Title[1] + "`)", "$(`" + Title_en[1] + "`)")
+ }
+
+ if (JSCode.includes("$( \"" + Title[1] + "\" )") == true) {
+ JSCode = JSCode.replaceAll("$(\"" + Title[1] + "\")", "$(\"" + Title_en[1] + "\")")
+ }
+ if (JSCode.includes("$( '" + Title[1] + "' )") == true) {
+ JSCode = JSCode.replaceAll("$('" + Title[1] + "')", "$('" + Title_en[1] + "')")
+ }
+ if (JSCode.includes("$( `" + Title[1] + "` )") == true) {
+ JSCode = JSCode.replaceAll("$(`" + Title[1] + "`)", "$(`" + Title_en[1] + "`)")
+ }
+
+ if (JSCode.includes("$( \"" + Title[1] + " \")") == true) {
+ JSCode = JSCode.replaceAll("$(\"" + Title[1] + "\")", "$(\"" + Title_en[1] + "\")")
+ }
+ if (JSCode.includes("$( '" + Title[1] + " ')") == true) {
+ JSCode = JSCode.replaceAll("$('" + Title[1] + "')", "$('" + Title_en[1] + "')")
+ }
+ if (JSCode.includes("$( `" + Title[1] + " `)") == true) {
+ JSCode = JSCode.replaceAll("$(`" + Title[1] + "`)", "$(`" + Title_en[1] + "`)")
+ }
+
+ if (JSCode.includes("$(\"" + Title[1] + " ") == true) {
+ JSCode = JSCode.replaceAll("$(\"" + Title[1] + " ", "$(\"" + Title_en[1] + " ")
+ }
+ if (JSCode.includes("$('" + Title[1] + " ") == true) {
+ JSCode = JSCode.replaceAll("$('" + Title[1] + " ", "$('" + Title_en[1] + " ")
+ }
+ if (JSCode.includes("$(`" + Title[1] + " ") == true) {
+ JSCode = JSCode.replaceAll("$(`" + Title[1] + " ", "$(`" + Title_en[1] + " ")
+ }
+
+ if (JSCode.includes("$( \"" + Title[1] + " ") == true) {
+ JSCode = JSCode.replaceAll("$( \"" + Title[1] + " ", "$( \"" + Title_en[1] + " ")
+ }
+ if (JSCode.includes("$( '" + Title[1] + " ") == true) {
+ JSCode = JSCode.replaceAll("$( '" + Title[1] + " ", "$( '" + Title_en[1] + " ")
+ }
+ if (JSCode.includes("$( `" + Title[1] + " ") == true) {
+ JSCode = JSCode.replaceAll("$( `" + Title[1] + " ", "$( `" + Title_en[1] + " ")
+ }
+
+ if (JSCode.includes("$(\" " + Title[1] + " ") == true) {
+ JSCode = JSCode.replaceAll("$(\" " + Title[1] + " ", "$(\" " + Title_en[1] + " ")
+ }
+ if (JSCode.includes("$(' " + Title[1] + " ") == true) {
+ JSCode = JSCode.replaceAll("$(' " + Title[1] + " ", "$(' " + Title_en[1] + " ")
+ }
+ if (JSCode.includes("$(` " + Title[1] + " ") == true) {
+ JSCode = JSCode.replaceAll("$(` " + Title[1] + " ", "$(` " + Title_en[1] + " ")
+ }
+ }
+ return JSCode;
+}
+function JsCodeCompilerJQHtml_Zh(JSCode) {
+ for (let index = 0; index < JSON3_All.length; index++) {
+ let Title = [JSON3_All[index]["title"], JSON3_All[index]["title"]]
+ Title[1] = Title[1].replace("<", "");
+ Title[1] = Title[1].replace(">", "");
+ Title[1] = Title[1].replace("!", "");
+ let Title_en = [JSON3_All[index]["title_en"], JSON3_All[index]["title_en"]]
+ Title_en[1] = Title_en[1].replace("<", "");
+ Title_en[1] = Title_en[1].replace(">", "");
+ Title_en[1] = Title_en[1].replace("!", "");
+ if (JSCode.indexOf("$(\"" + Title_en[0] + "\")") != -1) {
+ JSCode = JSCode.replaceAll("$(\"" + Title_en[0] + "\")", "$(\"" + Title[0] + "\")")
+ }
+ if (JSCode.indexOf("$('" + Title_en[0] + "')") != -1) {
+ JSCode = JSCode.replaceAll("$('" + Title_en[0] + "')", "$('" + Title[0] + "')")
+ }
+ if (JSCode.indexOf("$(`" + Title_en[0] + "`)") != -1) {
+ JSCode = JSCode.replaceAll("$(`" + Title_en[0] + "`)", "$(`" + Title[0] + "`)")
+ }
+ if (JSCode.indexOf("$(" + Title_en[0] + ")") != -1) {
+ JSCode = JSCode.replaceAll("$(" + Title_en[0] + ")", "$(" + Title[0] + ")")
+ }
+
+ if (JSCode.indexOf("$(\" " + Title_en[0] + "\")") != -1) {
+ JSCode = JSCode.replaceAll("$(\"" + Title_en[0] + "\")", "$(\"" + Title[0] + "\")")
+ }
+ if (JSCode.indexOf("$(' " + Title_en[0] + "')") != -1) {
+ JSCode = JSCode.replaceAll("$('" + Title_en[0] + "')", "$('" + Title[0] + "')")
+ }
+ if (JSCode.indexOf("$(` " + Title_en[0] + "`)") != -1) {
+ JSCode = JSCode.replaceAll("$(`" + Title_en[0] + "`)", "$(`" + Title[0] + "`)")
+ }
+ if (JSCode.indexOf("$( " + Title_en[0] + ")") != -1) {
+ JSCode = JSCode.replaceAll("$(" + Title_en[0] + ")", "$(" + Title[0] + ")")
+ }
+
+ if (JSCode.indexOf("$( \"" + Title_en[0] + "\")") != -1) {
+ JSCode = JSCode.replaceAll("$(\"" + Title_en[0] + "\")", "$(\"" + Title[0] + "\")")
+ }
+ if (JSCode.indexOf("$( '" + Title_en[0] + "')") != -1) {
+ JSCode = JSCode.replaceAll("$('" + Title_en[0] + "')", "$('" + Title[0] + "')")
+ }
+ if (JSCode.indexOf("$( `" + Title_en[0] + "`)") != -1) {
+ JSCode = JSCode.replaceAll("$(`" + Title_en[0] + "`)", "$(`" + Title[0] + "`)")
+ }
+ if (JSCode.indexOf("$(" + Title_en[0] + " )") != -1) {
+ JSCode = JSCode.replaceAll("$(" + Title_en[0] + ")", "$(" + Title[0] + ")")
+ }
+
+ if (JSCode.indexOf("$(\"" + Title_en[0] + " \")") != -1) {
+ JSCode = JSCode.replaceAll("$(\"" + Title_en[0] + "\")", "$(\"" + Title[0] + "\")")
+ }
+ if (JSCode.indexOf("$('" + Title_en[0] + " ')") != -1) {
+ JSCode = JSCode.replaceAll("$('" + Title_en[0] + "')", "$('" + Title[0] + "')")
+ }
+ if (JSCode.indexOf("$(`" + Title_en[0] + " `)") != -1) {
+ JSCode = JSCode.replaceAll("$(`" + Title_en[0] + "`)", "$(`" + Title[0] + "`)")
+ }
+
+ if (JSCode.indexOf("$(\" " + Title_en[0] + " \")") != -1) {
+ JSCode = JSCode.replaceAll("$(\"" + Title_en[0] + "\")", "$(\"" + Title[0] + "\")")
+ }
+ if (JSCode.indexOf("$(' " + Title_en[0] + " ')") != -1) {
+ JSCode = JSCode.replaceAll("$('" + Title_en[0] + "')", "$('" + Title[0] + "')")
+ }
+ if (JSCode.indexOf("$(` " + Title_en[0] + " `)") != -1) {
+ JSCode = JSCode.replaceAll("$(`" + Title_en[0] + "`)", "$(`" + Title[0] + "`)")
+ }
+
+ if (JSCode.indexOf("$( \"" + Title_en[0] + "\" )") != -1) {
+ JSCode = JSCode.replaceAll("$(\"" + Title_en[0] + "\")", "$(\"" + Title[0] + "\")")
+ }
+ if (JSCode.indexOf("$( '" + Title_en[0] + "' )") != -1) {
+ JSCode = JSCode.replaceAll("$('" + Title_en[0] + "')", "$('" + Title[0] + "')")
+ }
+ if (JSCode.indexOf("$( `" + Title_en[0] + "` )") != -1) {
+ JSCode = JSCode.replaceAll("$(`" + Title_en[0] + "`)", "$(`" + Title[0] + "`)")
+ }
+
+ if (JSCode.indexOf("$( \"" + Title_en[0] + " \")") != -1) {
+ JSCode = JSCode.replaceAll("$(\"" + Title_en[0] + "\")", "$(\"" + Title[0] + "\")")
+ }
+ if (JSCode.indexOf("$( '" + Title_en[0] + " ')") != -1) {
+ JSCode = JSCode.replaceAll("$('" + Title_en[0] + "')", "$('" + Title[0] + "')")
+ }
+ if (JSCode.indexOf("$( `" + Title_en[0] + " `)") != -1) {
+ JSCode = JSCode.replaceAll("$(`" + Title_en[0] + "`)", "$(`" + Title[0] + "`)")
+ }
+
+ if (JSCode.indexOf("$(\"" + Title_en[0] + " ") != -1) {
+ JSCode = JSCode.replaceAll("$(\"" + Title_en[0] + " ", "$(\"" + Title[0] + " ")
+ }
+ if (JSCode.indexOf("$('" + Title_en[0] + " ") != -1) {
+ JSCode = JSCode.replaceAll("$('" + Title_en[0] + " ", "$('" + Title[0] + " ")
+ }
+ if (JSCode.indexOf("$(`" + Title_en[0] + " ") != -1) {
+ JSCode = JSCode.replaceAll("$(`" + Title_en[0] + " ", "$(`" + Title[0] + " ")
+ }
+
+ if (JSCode.indexOf("$( \"" + Title_en[0] + " ") != -1) {
+ JSCode = JSCode.replaceAll("$( \"" + Title_en[0] + " ", "$( \"" + Title[0] + " ")
+ }
+ if (JSCode.indexOf("$( '" + Title_en[0] + " ") != -1) {
+ JSCode = JSCode.replaceAll("$( '" + Title_en[0] + " ", "$( '" + Title[0] + " ")
+ }
+ if (JSCode.indexOf("$( `" + Title_en[0] + " ") != -1) {
+ JSCode = JSCode.replaceAll("$( `" + Title_en[0] + " ", "$( `" + Title[0] + " ")
+ }
+
+ if (JSCode.indexOf("$(\" " + Title_en[0] + " ") != -1) {
+ JSCode = JSCode.replaceAll("$(\" " + Title_en[0] + " ", "$(\" " + Title[0] + " ")
+ }
+ if (JSCode.indexOf("$(' " + Title_en[0] + " ") != -1) {
+ JSCode = JSCode.replaceAll("$(' " + Title_en[0] + " ", "$(' " + Title[0] + " ")
+ }
+ if (JSCode.indexOf("$(` " + Title_en[0] + " ") != -1) {
+ JSCode = JSCode.replaceAll("$(` " + Title_en[0] + " ", "$(` " + Title[0] + " ")
+ }
+
+ //==========
+
+ if (JSCode.indexOf("$(\"" + Title_en[1] + "\")") != -1) {
+ JSCode = JSCode.replaceAll("$(\"" + Title_en[1] + "\")", "$(\"" + Title[1] + "\")")
+ }
+ if (JSCode.indexOf("$('" + Title_en[1] + "')") != -1) {
+ JSCode = JSCode.replaceAll("$('" + Title_en[1] + "')", "$('" + Title[1] + "')")
+ }
+ if (JSCode.indexOf("$(`" + Title_en[1] + "`)") != -1) {
+ JSCode = JSCode.replaceAll("$(`" + Title_en[1] + "`)", "$(`" + Title[1] + "`)")
+ }
+ if (JSCode.indexOf("$(" + Title_en[1] + ")") != -1) {
+ JSCode = JSCode.replaceAll("$(" + Title_en[1] + ")", "$(" + Title[1] + ")")
+ }
+
+ if (JSCode.indexOf("$(\" " + Title_en[1] + "\")") != -1) {
+ JSCode = JSCode.replaceAll("$(\"" + Title_en[1] + "\")", "$(\"" + Title[1] + "\")")
+ }
+ if (JSCode.indexOf("$(' " + Title_en[1] + "')") != -1) {
+ JSCode = JSCode.replaceAll("$('" + Title_en[1] + "')", "$('" + Title[1] + "')")
+ }
+ if (JSCode.indexOf("$(` " + Title_en[1] + "`)") != -1) {
+ JSCode = JSCode.replaceAll("$(`" + Title_en[1] + "`)", "$(`" + Title[1] + "`)")
+ }
+ if (JSCode.indexOf("$( " + Title_en[1] + ")") != -1) {
+ JSCode = JSCode.replaceAll("$(" + Title_en[1] + ")", "$(" + Title[1] + ")")
+ }
+
+ if (JSCode.indexOf("$( \"" + Title_en[1] + "\")") != -1) {
+ JSCode = JSCode.replaceAll("$(\"" + Title_en[1] + "\")", "$(\"" + Title[1] + "\")")
+ }
+ if (JSCode.indexOf("$( '" + Title_en[1] + "')") != -1) {
+ JSCode = JSCode.replaceAll("$('" + Title_en[1] + "')", "$('" + Title[1] + "')")
+ }
+ if (JSCode.indexOf("$( `" + Title_en[1] + "`)") != -1) {
+ JSCode = JSCode.replaceAll("$(`" + Title_en[1] + "`)", "$(`" + Title[1] + "`)")
+ }
+ if (JSCode.indexOf("$(" + Title_en[1] + " )") != -1) {
+ JSCode = JSCode.replaceAll("$(" + Title_en[1] + ")", "$(" + Title[1] + ")")
+ }
+
+ if (JSCode.indexOf("$(\"" + Title_en[1] + " \")") != -1) {
+ JSCode = JSCode.replaceAll("$(\"" + Title_en[1] + "\")", "$(\"" + Title[1] + "\")")
+ }
+ if (JSCode.indexOf("$('" + Title_en[1] + " ')") != -1) {
+ JSCode = JSCode.replaceAll("$('" + Title_en[1] + "')", "$('" + Title[1] + "')")
+ }
+ if (JSCode.indexOf("$(`" + Title_en[1] + " `)") != -1) {
+ JSCode = JSCode.replaceAll("$(`" + Title_en[1] + "`)", "$(`" + Title[1] + "`)")
+ }
+
+ if (JSCode.indexOf("$(\" " + Title_en[1] + " \")") != -1) {
+ JSCode = JSCode.replaceAll("$(\"" + Title_en[1] + "\")", "$(\"" + Title[1] + "\")")
+ }
+ if (JSCode.indexOf("$(' " + Title_en[1] + " ')") != -1) {
+ JSCode = JSCode.replaceAll("$('" + Title_en[1] + "')", "$('" + Title[1] + "')")
+ }
+ if (JSCode.indexOf("$(` " + Title_en[1] + " `)") != -1) {
+ JSCode = JSCode.replaceAll("$(`" + Title_en[1] + "`)", "$(`" + Title[1] + "`)")
+ }
+
+ if (JSCode.indexOf("$( \"" + Title_en[1] + "\" )") != -1) {
+ JSCode = JSCode.replaceAll("$(\"" + Title_en[1] + "\")", "$(\"" + Title[1] + "\")")
+ }
+ if (JSCode.indexOf("$( '" + Title_en[1] + "' )") != -1) {
+ JSCode = JSCode.replaceAll("$('" + Title_en[1] + "')", "$('" + Title[1] + "')")
+ }
+ if (JSCode.indexOf("$( `" + Title_en[1] + "` )") != -1) {
+ JSCode = JSCode.replaceAll("$(`" + Title_en[1] + "`)", "$(`" + Title[1] + "`)")
+ }
+
+ if (JSCode.indexOf("$( \"" + Title_en[1] + " \")") != -1) {
+ JSCode = JSCode.replaceAll("$(\"" + Title_en[1] + "\")", "$(\"" + Title[1] + "\")")
+ }
+ if (JSCode.indexOf("$( '" + Title_en[1] + " ')") != -1) {
+ JSCode = JSCode.replaceAll("$('" + Title_en[1] + "')", "$('" + Title[1] + "')")
+ }
+ if (JSCode.indexOf("$( `" + Title_en[1] + " `)") != -1) {
+ JSCode = JSCode.replaceAll("$(`" + Title_en[1] + "`)", "$(`" + Title[1] + "`)")
+ }
+
+ if (JSCode.indexOf("$(\"" + Title_en[1] + " ") != -1) {
+ JSCode = JSCode.replaceAll("$(\"" + Title_en[1] + " ", "$(\"" + Title[1] + " ")
+ }
+ if (JSCode.indexOf("$('" + Title_en[1] + " ") != -1) {
+ JSCode = JSCode.replaceAll("$('" + Title_en[1] + " ", "$('" + Title[1] + " ")
+ }
+ if (JSCode.indexOf("$(`" + Title_en[1] + " ") != -1) {
+ JSCode = JSCode.replaceAll("$(`" + Title_en[1] + " ", "$(`" + Title[1] + " ")
+ }
+
+ if (JSCode.indexOf("$( \"" + Title_en[1] + " ") != -1) {
+ JSCode = JSCode.replaceAll("$( \"" + Title_en[1] + " ", "$( \"" + Title[1] + " ")
+ }
+ if (JSCode.indexOf("$( '" + Title_en[1] + " ") != -1) {
+ JSCode = JSCode.replaceAll("$( '" + Title_en[1] + " ", "$( '" + Title[1] + " ")
+ }
+ if (JSCode.indexOf("$( `" + Title_en[1] + " ") != -1) {
+ JSCode = JSCode.replaceAll("$( `" + Title_en[1] + " ", "$( `" + Title[1] + " ")
+ }
+
+ if (JSCode.indexOf("$(\" " + Title_en[1] + " ") != -1) {
+ JSCode = JSCode.replaceAll("$(\" " + Title_en[1] + " ", "$(\" " + Title[1] + " ")
+ }
+ if (JSCode.indexOf("$(' " + Title_en[1] + " ") != -1) {
+ JSCode = JSCode.replaceAll("$(' " + Title_en[1] + " ", "$(' " + Title[1] + " ")
+ }
+ if (JSCode.indexOf("$(` " + Title_en[1] + " ") != -1) {
+ JSCode = JSCode.replaceAll("$(` " + Title_en[1] + " ", "$(` " + Title[1] + " ")
+ }
+ }
+ return JSCode;
+}
+//JQ专属方法的编译
+function JsCodeCompilerJQFun(CodeType, JSCode) {
+ //编译第一步:实现将$(和$. 全局替换成一个唯一的字符
+ let JQObjCode = [StrCodeUuid("$("), StrCodeUuid("$" + Comendfofdianhaobenin)];
+ let JQObjCode2 = ["$(", "$" + Comendfofdianhaobenin];
+ JSCode = JSCode.replaceAll(JQObjCode2[0], JQObjCode[0]);
+ JSCode = JSCode.replaceAll(JQObjCode2[1], JQObjCode[1]);
+ if (JSCode.indexOf(JQObjCode[0]) != -1) {
+ let JSCodeJsMatchArr = TakeTheMiddleOfTheTextAll(JSCode, JQObjCode[0], "\\)")
+ if (JSCodeJsMatchArr) {
+ for (let index = 0; index < JSCodeJsMatchArr.length; index++) {
+ for (let JsonJSCodeJQindex = 0; JsonJSCodeJQindex < JsonJSCodeJQ.length; JsonJSCodeJQindex++) {
+ if (JSCode.indexOf(JsonJSCodeJQ[JsonJSCodeJQindex]["code1"]) == -1 && JSCode.indexOf(JsonJSCodeJQ[JsonJSCodeJQindex]["code2"]) == -1) {
+ continue;
+ }
+ if (JavascriptCompilerLineBreak.indexOf(JSCodeJsMatchArr[index]) == -1) {
+ JavascriptCompilerLineBreak[JavascriptCompilerLineBreak.length] = JSCodeJsMatchArr[index];
+ }
+ let regCompilerCodeArr
+ if (CodeType == 1) {
+ regCompilerCodeArr = [JsonJSCodeJQ[JsonJSCodeJQindex]["code2"], JsonJSCodeJQ[JsonJSCodeJQindex]["code1"]];
+ } else {
+ regCompilerCodeArr = [JsonJSCodeJQ[JsonJSCodeJQindex]["code1"], JsonJSCodeJQ[JsonJSCodeJQindex]["code2"]];
+ }
+ JSCode = JSCode.replaceAll(JSCodeJsMatchArr[index] + Comendfofdianhaobenin + regCompilerCodeArr[0] + "(", JSCodeJsMatchArr[index] + Comendfofdianhaobenin + regCompilerCodeArr[1] + "(");
+ JSCode = JSCode.replaceAll(JSCodeJsMatchArr[index] + Comendfofdianhaobenin + regCompilerCodeArr[0] + " ", JSCodeJsMatchArr[index] + Comendfofdianhaobenin + regCompilerCodeArr[1] + " ");
+ }
+ }
+ }
+ }
+ for (let index = 0; index < JsonJSCodeJQ.length; index++) {
+ if (JSCode.indexOf(JsonJSCodeJQ[index]["code1"]) == -1 && JSCode.indexOf(JsonJSCodeJQ[index]["code2"]) == -1) {
+ continue;
+ }
+ let regCompilerCodeArr = []
+ if (CodeType == 1) {
+ regCompilerCodeArr = [JsonJSCodeJQ[index]["code2"], JsonJSCodeJQ[index]["code1"]];
+ } else {
+ regCompilerCodeArr = [JsonJSCodeJQ[index]["code1"], JsonJSCodeJQ[index]["code2"]];
+ }
+ JSCode = JSCode.replaceAll(JQObjCode[1] + regCompilerCodeArr[0] + "(", JQObjCode[1] + regCompilerCodeArr[1] + "(");
+ JSCode = JSCode.replaceAll(JQObjCode[1] + regCompilerCodeArr[0] + " ", JQObjCode[1] + regCompilerCodeArr[1] + " ");
+ for (let index2 = 0; index2 < JsonJSCodeJQ.length; index2++) {
+ let JsonJSCodeJQArr = []
+ if (JSCode.indexOf(JsonJSCodeJQ[index2]["code1"] + "(") != -1) {
+ JsonJSCodeJQArr = TakeTheMiddleOfTheTextAll(JSCode, JsonJSCodeJQ[index2]["code1"] + "\\(", "\\)");
+ if (JsonJSCodeJQArr) {
+ //添加HTML样式类("li")
+ for (let index3 = 0; index3 < JsonJSCodeJQArr.length; index3++) {
+ if (JSCode.indexOf(JsonJSCodeJQArr[index3] + Comendfofdianhaobenin + regCompilerCodeArr[0] + "(") != -1) {
+ JSCode = JSCode.replaceAll(JsonJSCodeJQArr[index3] + Comendfofdianhaobenin + regCompilerCodeArr[0] + "(", JsonJSCodeJQArr[index3] + Comendfofdianhaobenin + regCompilerCodeArr[1] + "(");
+ }
+ if (JSCode.indexOf(JsonJSCodeJQArr[index3] + Comendfofdianhaobenin + regCompilerCodeArr[0] + " ") != -1) {
+ JSCode = JSCode.replaceAll(JsonJSCodeJQArr[index3] + Comendfofdianhaobenin + regCompilerCodeArr[0] + " ", JsonJSCodeJQArr[index3] + Comendfofdianhaobenin + regCompilerCodeArr[1] + " ");
+ }
+ if (JavascriptCompilerLineBreak.indexOf(JsonJSCodeJQArr[index3]) == -1) {
+ JavascriptCompilerLineBreak[JavascriptCompilerLineBreak.length] = JsonJSCodeJQArr[index3];
+ }
+ }
+ }
+ }
+ if (JSCode.indexOf(JsonJSCodeJQ[index2]["code2"] + "(") != -1) {
+ JsonJSCodeJQArr = TakeTheMiddleOfTheTextAll(JSCode, JsonJSCodeJQ[index2]["code2"] + "\\(", "\\)");
+ if (JsonJSCodeJQArr) {
+ for (let index3 = 0; index3 < JsonJSCodeJQArr.length; index3++) {
+ if (JSCode.indexOf(JsonJSCodeJQArr[index3] + Comendfofdianhaobenin + regCompilerCodeArr[0] + "(") != -1) {
+ JSCode = JSCode.replaceAll(JsonJSCodeJQArr[index3] + Comendfofdianhaobenin + regCompilerCodeArr[0] + "(", JsonJSCodeJQArr[index3] + Comendfofdianhaobenin + regCompilerCodeArr[1] + "(");
+ }
+ if (JSCode.indexOf(JsonJSCodeJQArr[index3] + Comendfofdianhaobenin + regCompilerCodeArr[0] + " ") != -1) {
+ JSCode = JSCode.replaceAll(JsonJSCodeJQArr[index3] + Comendfofdianhaobenin + regCompilerCodeArr[0] + " ", JsonJSCodeJQArr[index3] + Comendfofdianhaobenin + regCompilerCodeArr[1] + " ");
+ }
+ if (JavascriptCompilerLineBreak.indexOf(JsonJSCodeJQArr[index3]) == -1) {
+ JavascriptCompilerLineBreak[JavascriptCompilerLineBreak.length] = JsonJSCodeJQArr[index3];
+ }
+ }
+ }
+ }
+ }
+ }
+ JavascriptCompilerLineBreak = JSON.stringify(JavascriptCompilerLineBreak);
+ JavascriptCompilerLineBreak = JavascriptCompilerLineBreak.replaceAll(JQObjCode[0], JQObjCode2[0])
+ JavascriptCompilerLineBreak = JavascriptCompilerLineBreak.replaceAll(JQObjCode[1], JQObjCode2[1])
+ JavascriptCompilerLineBreak = JSON.parse(JavascriptCompilerLineBreak);
+ JSCode = JSCode.replaceAll(JQObjCode[0], JQObjCode2[0]);
+ JSCode = JSCode.replaceAll(JQObjCode[1], JQObjCode2[1]);
+ return JSCode;
+}
+//JQ选择器支持
+function JsCodeCompilerJQselector(CodeType, JSCode) {
+ JSCode = JSCode.replaceAll(Comendfofdianhaobenin, ".")
+ //编译第一步:实现将$(和$. 全局替换成一个唯一的字符
+ let JQObjCode = [StrCodeUuid("$("), StrCodeUuid("$" + Comendfofdianhaobenin)];
+ let JQObjCode2 = ["$(", "$" + Comendfofdianhaobenin];
+ JSCode = JSCode.replaceAll(JQObjCode2[0], JQObjCode[0]);
+ JSCode = JSCode.replaceAll(JQObjCode2[1], JQObjCode[1]);
+ let JSCodeJsMatchArr = TakeTheMiddleOfTheTextAll(JSCode, JQObjCode[0], "\\)")
+ if (JSCodeJsMatchArr) {
+ for (let index = 0; index < JSCodeJsMatchArr.length; index++) {
+ let CodeStr = JSCodeJsMatchArr[index];
+ CodeStr = CodeStr.replaceAll("\"", " FOFSTUDIO" + ComShuangYinHaoFOFStuDion)
+ CodeStr = CodeStr.replaceAll("'", " FOFSTUDIO" + ComDanYinHaoFOFStuDion)
+ CodeStr = CodeStr.replaceAll("`", " FOFSTUDIO" + ComFanYinHaoFOFStuDion)
+ CodeStr = CssCodeCompiler(CodeStr, CodeType);
+ CodeStr = CodeStr.replaceAll(" FOFSTUDIO" + ComShuangYinHaoFOFStuDion, "\"")
+ CodeStr = CodeStr.replaceAll(" FOFSTUDIO" + ComDanYinHaoFOFStuDion, "'")
+ CodeStr = CodeStr.replaceAll(" FOFSTUDIO" + ComFanYinHaoFOFStuDion, "`")
+ JSCode = JSCode.replaceAll(JSCodeJsMatchArr[index], CodeStr);
+ }
+ }
+ JSCode = JSCode.replaceAll(JQObjCode[0], JQObjCode2[0]);
+ JSCode = JSCode.replaceAll(JQObjCode[1], JQObjCode2[1]);
+ JSCode = JSCode.replaceAll(".", Comendfofdianhaobenin)
+ return JSCode;
+}
\ No newline at end of file
diff --git a/js/JavaScript/NoStrCompiler/CompilerJavaScriptNoStrCompiler.js b/js/JavaScript/NoStrCompiler/CompilerJavaScriptNoStrCompiler.js
new file mode 100644
index 0000000..0be535b
--- /dev/null
+++ b/js/JavaScript/NoStrCompiler/CompilerJavaScriptNoStrCompiler.js
@@ -0,0 +1,170 @@
+//不参与编译的JS相关数据
+//JsCodeJSonCompilerStr-存所有编译时产生的临时数据,该变量中的临时数据将不会参与到JS编译!
+//JSCode-代表编译的代码
+//IfType-代表类型【1是开头,2是结束】
+//ifCompiler-是否编译,真代表是
+//FileID - 文件ID,可以是空字符串
+function NoStrCompiler(JsCodeJSonCompilerStr, JSCode, IfType, ifCompiler = false, FileID) {
+ return NoStrCompiler_StrComNo(JsCodeJSonCompilerStr, JSCode, IfType, ifCompiler, FileID)
+}
+
+//不参与编译的JS相关数据-字符串不参与编译
+//JsCodeJSonCompilerStr-存所有编译时产生的临时数据,该变量中的临时数据将不会参与到JS编译!
+//JSCode-代表编译的代码
+//IfType-代表类型【1是开头,2是结束】
+//ifCompiler-是否编译,真代表是
+//FileID - 文件ID,可以是空字符串
+function NoStrCompiler_StrComNo(JsCodeJSonCompilerStr, JSCode, IfType, ifCompiler = false, FileID) {
+ if (IfType == 1) {
+ JSCode = JSCode.replaceAll("image/*", "NoCompilerJsCode0" + CompilerStart)
+ JSCode = JSCode.replaceAll("= 1) {
+ for (let index = 0; index < StringObj.length; index++) {
+ if (StringObj[index].includes("<") && StringObj[index].includes(">"))
+ {
+ let StrCodeLs = [StringObj[index], StringObj[index]]
+ StrCodeLs[1] = CodeCompilerHtmlAll(StrCodeLs[1], CodeType, 1)
+ JSCode = JSCode.replaceHack(StrCodeLs[0], StrCodeLs[1])
+ }
+ }
+ }
+ }
+ return JSCode;
+}
+
+//全局命令中不参与编译的语法,例如:对象{ }
+function GlobalCommandsDoNotCompile(JSCode) {
+ let GArrCodeLs = []
+ for (let index = 0; index < JavascriptOverallCode.length; index++) {
+ let ifGArrCodeLsAdd = false;
+ let ArrCodeLs = []
+ ArrCodeLs[ArrCodeLs.length] = "{" + JavascriptOverallCode[index]["T_title"] + ":"
+ ArrCodeLs[ArrCodeLs.length] = " " + JavascriptOverallCode[index]["T_title"] + ":"
+ ArrCodeLs[ArrCodeLs.length] = " " + JavascriptOverallCode[index]["T_title"] + " :"
+ ArrCodeLs[ArrCodeLs.length] = "," + JavascriptOverallCode[index]["T_title"] + ":"
+ ArrCodeLs[ArrCodeLs.length] = "," + JavascriptOverallCode[index]["T_title"] + ":"
+ ArrCodeLs[ArrCodeLs.length] = "," + JavascriptOverallCode[index]["T_title"] + " :"
+
+ ArrCodeLs[ArrCodeLs.length] = "{" + JavascriptOverallCode[index]["T_title_en"] + ":"
+ ArrCodeLs[ArrCodeLs.length] = " " + JavascriptOverallCode[index]["T_title_en"] + ":"
+ ArrCodeLs[ArrCodeLs.length] = " " + JavascriptOverallCode[index]["T_title_en"] + " :"
+ ArrCodeLs[ArrCodeLs.length] = "," + JavascriptOverallCode[index]["T_title_en"] + ":"
+ ArrCodeLs[ArrCodeLs.length] = "," + JavascriptOverallCode[index]["T_title_en"] + ":"
+ ArrCodeLs[ArrCodeLs.length] = "," + JavascriptOverallCode[index]["T_title_en"] + " :"
+ for (let index2 = 0; index2 < ArrCodeLs.length; index2++) {
+ if (JSCode.includes(ArrCodeLs[index2])) {
+ let reg = new RegExp("(?=[^0-9a-zA-Z\u4e00-\u9fa5_])[^0-9a-zA-Z\u4e00-\u9fa5_]" + ArrCodeLs[index2] + "(?=[^0-9a-zA-Z\u4e00-\u9fa5_])", "g");
+ if (reg.test(JSCode) == true) {
+ ifGArrCodeLsAdd = true
+ }
+ }
+ if (ifGArrCodeLsAdd == true) {
+ if (GArrCodeLs.includes("{" + JavascriptOverallCode[index]["T_title"] + ":") == false) {
+ GArrCodeLs[GArrCodeLs.length] = "{" + JavascriptOverallCode[index]["T_title"] + ":"
+ }
+ if (GArrCodeLs.includes(" " + JavascriptOverallCode[index]["T_title"] + ":") == false) {
+ GArrCodeLs[GArrCodeLs.length] = " " + JavascriptOverallCode[index]["T_title"] + ":"
+ }
+ if (GArrCodeLs.includes(" " + JavascriptOverallCode[index]["T_title"] + " :") == false) {
+ GArrCodeLs[GArrCodeLs.length] = " " + JavascriptOverallCode[index]["T_title"] + " :"
+ }
+ if (GArrCodeLs.includes("," + JavascriptOverallCode[index]["T_title"] + ":") == false) {
+ GArrCodeLs[GArrCodeLs.length] = "," + JavascriptOverallCode[index]["T_title"] + ":"
+ }
+ if (GArrCodeLs.includes("," + JavascriptOverallCode[index]["T_title"] + ":") == false) {
+ GArrCodeLs[GArrCodeLs.length] = "," + JavascriptOverallCode[index]["T_title"] + ":"
+ }
+ if (GArrCodeLs.includes("," + JavascriptOverallCode[index]["T_title"] + " :") == false) {
+ GArrCodeLs[GArrCodeLs.length] = "," + JavascriptOverallCode[index]["T_title"] + " :"
+ }
+ if (GArrCodeLs.includes("{" + JavascriptOverallCode[index]["T_title_en"] + ":") == false) {
+ GArrCodeLs[GArrCodeLs.length] = "{" + JavascriptOverallCode[index]["T_title_en"] + ":"
+ }
+ if (GArrCodeLs.includes(" " + JavascriptOverallCode[index]["T_title_en"] + ":") == false) {
+ GArrCodeLs[GArrCodeLs.length] = " " + JavascriptOverallCode[index]["T_title_en"] + ":"
+ }
+ if (GArrCodeLs.includes(" " + JavascriptOverallCode[index]["T_title_en"] + " :") == false) {
+ GArrCodeLs[GArrCodeLs.length] = " " + JavascriptOverallCode[index]["T_title_en"] + " :"
+ }
+ if (GArrCodeLs.includes("," + JavascriptOverallCode[index]["T_title_en"] + ":") == false) {
+ GArrCodeLs[GArrCodeLs.length] = "," + JavascriptOverallCode[index]["T_title_en"] + ":"
+ }
+ if (GArrCodeLs.includes("," + JavascriptOverallCode[index]["T_title_en"] + ":") == false) {
+ GArrCodeLs[GArrCodeLs.length] = "," + JavascriptOverallCode[index]["T_title_en"] + ":"
+ }
+ if (GArrCodeLs.includes("," + JavascriptOverallCode[index]["T_title_en"] + " :") == false) {
+ GArrCodeLs[GArrCodeLs.length] = "," + JavascriptOverallCode[index]["T_title_en"] + " :"
+ }
+ }
+ }
+ }
+ return GArrCodeLs;
+}
diff --git a/js/css/CompilerCss.js b/js/css/CompilerCss.js
new file mode 100644
index 0000000..1bdeaf0
--- /dev/null
+++ b/js/css/CompilerCss.js
@@ -0,0 +1,622 @@
+let JsonCssCode = [];//储存所有的JSON类编译数据
+let JSON3_All_Title = [];//存储所有的标签名称,不带<>的标签
+function CssCodeAllStyle(htmlStr) {
+ let reg = RegExp("(= 1) {
+ for (let index = 0; index < StringObj.length; index++) {
+ let StrCodeLs = [StrCodeUuid(StringObj[index]), StringObj[index]]
+ CssCode = CssCode.replaceAll(StringObj[index], StrCodeLs[0])
+ CssCodeJSonCompilerStr[CssCodeJSonCompilerStr.length] = StrCodeLs;
+ }
+ }
+ }
+ }
+ if (CssCode.indexOf("\"") != -1 && CssCode.indexOf("\"") != -1) {
+ StringObj = TakeTheMiddleOfTheTextAll(CssCode, "\"", "\"");
+ if (StringObj != undefined && StringObj != null) {
+ if (StringObj.length >= 1) {
+ for (let index = 0; index < StringObj.length; index++) {
+ let StrCodeLs = [StrCodeUuid(StringObj[index]), StringObj[index]]
+ CssCode = CssCode.replaceAll(StringObj[index], StrCodeLs[0])
+ CssCodeJSonCompilerStr[CssCodeJSonCompilerStr.length] = StrCodeLs;
+ }
+ }
+ }
+ }
+ if (CssCode.indexOf("'") != -1) {
+ StringObj = TakeTheMiddleOfTheTextAll(CssCode, "'", "'");
+ if (StringObj != undefined && StringObj != null) {
+ if (StringObj.length >= 1) {
+ for (let index = 0; index < StringObj.length; index++) {
+ let StrCodeLs = [StrCodeUuid(StringObj[index]), StringObj[index]]
+ CssCode = CssCode.replaceAll(StringObj[index], StrCodeLs[0])
+ CssCodeJSonCompilerStr[CssCodeJSonCompilerStr.length] = StrCodeLs;
+ }
+ }
+ }
+ }
+ if (CssCode.indexOf("`") != -1) {
+ StringObj = TakeTheMiddleOfTheTextAll(CssCode, "`", "`");
+ if (StringObj != undefined && StringObj != null) {
+ if (StringObj.length >= 1) {
+ for (let index = 0; index < StringObj.length; index++) {
+ let StrCodeLs = [StrCodeUuid(StringObj[index]), StringObj[index]]
+ CssCode = CssCode.replaceAll(StringObj[index], StrCodeLs[0])
+ CssCodeJSonCompilerStr[CssCodeJSonCompilerStr.length] = StrCodeLs;
+ }
+ }
+ }
+ }
+ if (JSON3_All_Title.length <= 0) {
+ for (let index = 0; index < JSON3_All.length; index++) {
+ let title = JSON3_All[index]["title"];
+ title = title.replaceHack("<", "")
+ title = title.replaceHack(">", "")
+ let title_en = JSON3_All[index]["title_en"];
+ title_en = title_en.replaceHack("<", "")
+ title_en = title_en.replaceHack(">", "")
+ JSON3_All_Title[JSON3_All_Title.length] = {
+ "title": title,
+ "title_en": title_en
+ }
+ }
+ }
+ //html重名.标签操作
+ for (let index = 0; index < JSON3_All_Title.length; index++) {
+ let title = JSON3_All_Title[index]["title"];
+ let title_en = JSON3_All_Title[index]["title_en"];
+ if (CssCode.indexOf("." + title) != -1 || CssCode.indexOf("." + title_en) != -1 || CssCode.indexOf("#" + title) != -1 || CssCode.indexOf("#" + title_en) != -1)//代表有需要进行处理的关键字
+ {
+ if (CssCode.indexOf("." + title + " ") != -1 || CssCode.indexOf("." + title + "{") != -1 || CssCode.indexOf("." + title + ".") != -1 || CssCode.indexOf("." + title_en + " ") != -1 || CssCode.indexOf("." + title_en + "{") != -1 || CssCode.indexOf("." + title_en + ".") != -1 || CssCode.indexOf("." + title_en + ":") != -1 || CssCode.indexOf("." + title + ":") != -1) {
+ if (CssCode.indexOf("." + title + " ") != -1) {
+ let StrCodeLs = [StrCodeUuid("." + title + " ") + " ", "." + title + " "]
+ CssCode = CssCode.replaceAll("." + title + " ", StrCodeLs[0])
+ CssCodeJSonCompilerStr[CssCodeJSonCompilerStr.length] = StrCodeLs;
+ }
+ if (CssCode.indexOf("." + title + "{") != -1) {
+ let StrCodeLs = [StrCodeUuid("." + title + "{") + "{", "." + title + "{"]
+ CssCode = CssCode.replaceAll("." + title + "{", StrCodeLs[0])
+ CssCodeJSonCompilerStr[CssCodeJSonCompilerStr.length] = StrCodeLs;
+ }
+ if (CssCode.indexOf("." + title + ".") != -1) {
+ let StrCodeLs = [StrCodeUuid("." + title + ".") + ".", "." + title + "."]
+ CssCode = CssCode.replaceAll("." + title + ".", StrCodeLs[0])
+ CssCodeJSonCompilerStr[CssCodeJSonCompilerStr.length] = StrCodeLs;
+ }
+ if (CssCode.indexOf("." + title + ":") != -1) {
+ let StrCodeLs = [StrCodeUuid("." + title + ":") + ":", "." + title + ":"]
+ CssCode = CssCode.replaceAll("." + title + ":", StrCodeLs[0])
+ CssCodeJSonCompilerStr[CssCodeJSonCompilerStr.length] = StrCodeLs;
+ }
+
+ if (CssCode.indexOf("." + title_en + " ") != -1) {
+ let StrCodeLs = [StrCodeUuid("." + title_en + " ") + " ", "." + title_en + " "]
+ CssCode = CssCode.replaceAll("." + title_en + " ", StrCodeLs[0])
+ CssCodeJSonCompilerStr[CssCodeJSonCompilerStr.length] = StrCodeLs;
+ }
+ if (CssCode.indexOf("." + title_en + "{") != -1) {
+ let StrCodeLs = [StrCodeUuid("." + title_en + "{") + "{", "." + title_en + "{"]
+ CssCode = CssCode.replaceAll("." + title_en + "{", StrCodeLs[0])
+ CssCodeJSonCompilerStr[CssCodeJSonCompilerStr.length] = StrCodeLs;
+ }
+ if (CssCode.indexOf("." + title_en + ".") != -1) {
+ let StrCodeLs = [StrCodeUuid("." + title_en + ".") + ".", "." + title_en + "."]
+ CssCode = CssCode.replaceAll("." + title_en + ".", StrCodeLs[0])
+ CssCodeJSonCompilerStr[CssCodeJSonCompilerStr.length] = StrCodeLs;
+ }
+ if (CssCode.indexOf("." + title_en + ":") != -1) {
+ let StrCodeLs = [StrCodeUuid("." + title_en + ":") + ":", "." + title_en + ":"]
+ CssCode = CssCode.replaceAll("." + title_en + ":", StrCodeLs[0])
+ CssCodeJSonCompilerStr[CssCodeJSonCompilerStr.length] = StrCodeLs;
+ }
+ }
+
+ if (CssCode.indexOf("#" + title + " ") != -1 || CssCode.indexOf("#" + title + "{") != -1 || CssCode.indexOf("#" + title + "#") != -1 || CssCode.indexOf("#" + title_en + " ") != -1 || CssCode.indexOf("#" + title_en + "{") != -1 || CssCode.indexOf("#" + title_en + "#") != -1 || CssCode.indexOf("#" + title_en + ":") != -1 || CssCode.indexOf("#" + title + ":") != -1) {
+ if (CssCode.indexOf("#" + title + " ") != -1) {
+ let StrCodeLs = [StrCodeUuid("#" + title + " ") + " ", "#" + title + " "]
+ CssCode = CssCode.replaceAll("#" + title + " ", StrCodeLs[0])
+ CssCodeJSonCompilerStr[CssCodeJSonCompilerStr.length] = StrCodeLs;
+ }
+ if (CssCode.indexOf("#" + title + "{") != -1) {
+ let StrCodeLs = [StrCodeUuid("#" + title + "{") + "{", "#" + title + "{"]
+ CssCode = CssCode.replaceAll("#" + title + "{", StrCodeLs[0])
+ CssCodeJSonCompilerStr[CssCodeJSonCompilerStr.length] = StrCodeLs;
+ }
+ if (CssCode.indexOf("#" + title + "#") != -1) {
+ let StrCodeLs = [StrCodeUuid("#" + title + "#") + "#", "#" + title + "#"]
+ CssCode = CssCode.replaceAll("#" + title + "#", StrCodeLs[0])
+ CssCodeJSonCompilerStr[CssCodeJSonCompilerStr.length] = StrCodeLs;
+ }
+ if (CssCode.indexOf("#" + title + ":") != -1) {
+ let StrCodeLs = [StrCodeUuid("#" + title + ":") + ":", "#" + title + ":"]
+ CssCode = CssCode.replaceAll("#" + title + ":", StrCodeLs[0])
+ CssCodeJSonCompilerStr[CssCodeJSonCompilerStr.length] = StrCodeLs;
+ }
+
+ if (CssCode.indexOf("#" + title_en + " ") != -1) {
+ let StrCodeLs = [StrCodeUuid("#" + title_en + " ") + " ", "#" + title_en + " "]
+ CssCode = CssCode.replaceAll("#" + title_en + " ", StrCodeLs[0])
+ CssCodeJSonCompilerStr[CssCodeJSonCompilerStr.length] = StrCodeLs;
+ }
+ if (CssCode.indexOf("#" + title_en + "{") != -1) {
+ let StrCodeLs = [StrCodeUuid("#" + title_en + "{") + "{", "#" + title_en + "{"]
+ CssCode = CssCode.replaceAll("#" + title_en + "{", StrCodeLs[0])
+ CssCodeJSonCompilerStr[CssCodeJSonCompilerStr.length] = StrCodeLs;
+ }
+ if (CssCode.indexOf("#" + title_en + "#") != -1) {
+ let StrCodeLs = [StrCodeUuid("#" + title_en + "#") + "#", "#" + title_en + "#"]
+ CssCode = CssCode.replaceAll("#" + title_en + "#", StrCodeLs[0])
+ CssCodeJSonCompilerStr[CssCodeJSonCompilerStr.length] = StrCodeLs;
+ }
+ if (CssCode.indexOf("#" + title_en + ":") != -1) {
+ let StrCodeLs = [StrCodeUuid("#" + title_en + ":") + ":", "#" + title_en + ":"]
+ CssCode = CssCode.replaceAll("#" + title_en + ":", StrCodeLs[0])
+ CssCodeJSonCompilerStr[CssCodeJSonCompilerStr.length] = StrCodeLs;
+ }
+ }
+ }
+ }
+ //.css名 重名操作
+ for (let index = 0; index < JsonCssCode.length; index++) {
+ if (JsonCssCode[index].length >= 3) {
+ if (CssCode.indexOf(JsonCssCode[index][0]) != -1 || CssCode.indexOf(JsonCssCode[index][1]) != -1 || CssCode.indexOf(JsonCssCode[index][1]) != -1 || CssCode.indexOf(JsonCssCode[index][0]) != -1)//代表有需要进行处理的关键字
+ {
+ if (JsonCssCode[index][0].indexOf("_") == -1 && JsonCssCode[index][0].indexOf("-") == -1) {
+ if (CssCode.indexOf("." + JsonCssCode[index][0] + " ") != -1 || CssCode.indexOf("." + JsonCssCode[index][0] + "{") != -1 || CssCode.indexOf("." + JsonCssCode[index][0] + "\r\n") != -1) {
+ if (HTMLTripartiteClassStr.indexOf(`"T_title":"` + JsonCssCode[index][0] + `"`) == -1 && HTMLTripartiteClassStr.indexOf(`"T_title_en":"` + JsonCssCode[index][0] + `"`) == -1) {
+ let StrCodeLs = [StrCodeUuid("." + JsonCssCode[index][0]) + " ", "." + JsonCssCode[index][0] + " "]
+ CssCode = CssCode.replaceAll("." + JsonCssCode[index][0] + " ", StrCodeLs[0])
+ CssCodeJSonCompilerStr[CssCodeJSonCompilerStr.length] = StrCodeLs;
+
+ StrCodeLs = [StrCodeUuid("." + JsonCssCode[index][0] + "{") + "{", "." + JsonCssCode[index][0] + "{"]
+ CssCode = CssCode.replaceAll("." + JsonCssCode[index][0] + "{", StrCodeLs[0])
+ CssCodeJSonCompilerStr[CssCodeJSonCompilerStr.length] = StrCodeLs;
+
+ StrCodeLs = [StrCodeUuid("." + JsonCssCode[index][0] + "\r\n"), "." + JsonCssCode[index][0] + "\r\n"]
+ CssCode = CssCode.replaceAll("." + JsonCssCode[index][0] + "\r\n", StrCodeLs[0])
+ CssCodeJSonCompilerStr[CssCodeJSonCompilerStr.length] = StrCodeLs;
+ }
+ }
+ }
+ if (JsonCssCode[index][1].indexOf("_") == -1 && JsonCssCode[index][1].indexOf("-") == -1) {
+ if (CssCode.indexOf("." + JsonCssCode[index][1] + " ") != -1 || CssCode.indexOf("." + JsonCssCode[index][1] + "{") != -1 || CssCode.indexOf("." + JsonCssCode[index][1] + "\r\n") != -1) {
+ if (HTMLTripartiteClassStr.indexOf(`"T_title":"` + JsonCssCode[index][1] + `"`) == -1 && HTMLTripartiteClassStr.indexOf(`"T_title_en":"` + JsonCssCode[index][1] + `"`) == -1) {
+ let StrCodeLs = [StrCodeUuid("." + JsonCssCode[index][1]) + " ", "." + JsonCssCode[index][1] + " "]
+ CssCode = CssCode.replaceAll("." + JsonCssCode[index][1] + " ", StrCodeLs[0])
+ CssCodeJSonCompilerStr[CssCodeJSonCompilerStr.length] = StrCodeLs;
+
+ StrCodeLs = [StrCodeUuid("." + JsonCssCode[index][1] + "{") + "{", "." + JsonCssCode[index][1] + "{"]
+ CssCode = CssCode.replaceAll("." + JsonCssCode[index][1] + "{", StrCodeLs[0])
+ CssCodeJSonCompilerStr[CssCodeJSonCompilerStr.length] = StrCodeLs;
+
+ StrCodeLs = [StrCodeUuid("." + JsonCssCode[index][1] + "\r\n"), "." + JsonCssCode[index][1] + "\r\n"]
+ CssCode = CssCode.replaceAll("." + JsonCssCode[index][1] + "\r\n", StrCodeLs[0])
+ CssCodeJSonCompilerStr[CssCodeJSonCompilerStr.length] = StrCodeLs;
+ }
+ }
+ }
+ if (CssCode.indexOf("#") != -1) {
+ if (CssCode.indexOf("#" + JsonCssCode[index][0] + " ") != -1 || CssCode.indexOf("#" + JsonCssCode[index][0] + "{") != -1 || CssCode.indexOf("#" + JsonCssCode[index][0] + "\r\n") != -1) {
+ if (HTMLTripartiteClassStr.indexOf(`"T_title":"` + JsonCssCode[index][0] + `"`) == -1 && HTMLTripartiteClassStr.indexOf(`"T_title_en":"` + JsonCssCode[index][0] + `"`) == -1) {
+ let StrCodeLs = [StrCodeUuid("#" + JsonCssCode[index][0]) + " ", "#" + JsonCssCode[index][0] + " "]
+ CssCode = CssCode.replaceAll("#" + JsonCssCode[index][0] + " ", StrCodeLs[0])
+ CssCodeJSonCompilerStr[CssCodeJSonCompilerStr.length] = StrCodeLs;
+
+ StrCodeLs = [StrCodeUuid("#" + JsonCssCode[index][0] + "{") + "{", "#" + JsonCssCode[index][0] + "{"]
+ CssCode = CssCode.replaceAll("#" + JsonCssCode[index][0] + "{", StrCodeLs[0])
+ CssCodeJSonCompilerStr[CssCodeJSonCompilerStr.length] = StrCodeLs;
+
+ StrCodeLs = [StrCodeUuid("#" + JsonCssCode[index][0] + "\r\n"), "#" + JsonCssCode[index][0] + "\r\n"]
+ CssCode = CssCode.replaceAll("#" + JsonCssCode[index][0] + "\r\n", StrCodeLs[0])
+ CssCodeJSonCompilerStr[CssCodeJSonCompilerStr.length] = StrCodeLs;
+ }
+ }
+ if (CssCode.indexOf("#" + JsonCssCode[index][1] + " ") != -1 || CssCode.indexOf("#" + JsonCssCode[index][1] + "{") != -1 || CssCode.indexOf("#" + JsonCssCode[index][1] + "\r\n") != -1) {
+ if (HTMLTripartiteClassStr.indexOf(`"T_title":"` + JsonCssCode[index][1] + `"`) == -1 && HTMLTripartiteClassStr.indexOf(`"T_title_en":"` + JsonCssCode[index][1] + `"`) == -1) {
+ let StrCodeLs = [StrCodeUuid("#" + JsonCssCode[index][1]) + " ", "#" + JsonCssCode[index][1] + " "]
+ CssCode = CssCode.replaceAll("#" + JsonCssCode[index][1] + " ", StrCodeLs[0])
+ CssCodeJSonCompilerStr[CssCodeJSonCompilerStr.length] = StrCodeLs;
+
+ StrCodeLs = [StrCodeUuid("#" + JsonCssCode[index][1] + "{") + "{", "#" + JsonCssCode[index][1] + "{"]
+ CssCode = CssCode.replaceAll("#" + JsonCssCode[index][1] + "{", StrCodeLs[0])
+ CssCodeJSonCompilerStr[CssCodeJSonCompilerStr.length] = StrCodeLs;
+
+ StrCodeLs = [StrCodeUuid("#" + JsonCssCode[index][1] + "\r\n"), "#" + JsonCssCode[index][1] + "\r\n"]
+ CssCode = CssCode.replaceAll("#" + JsonCssCode[index][1] + "\r\n", StrCodeLs[0])
+ CssCodeJSonCompilerStr[CssCodeJSonCompilerStr.length] = StrCodeLs;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ if (IfType == 2) {
+ for (let index = 0; index < CssCodeJSonCompilerStr.length; index++) {
+ let StrCodeLs = CssCodeJSonCompilerStr[CssCodeJSonCompilerStr.length - index - 1]
+ if (CssCode.indexOf(StrCodeLs[0]) != -1) {
+ CssCode = CssCode.replaceAll(StrCodeLs[0], StrCodeLs[1])
+ }
+ }
+ if (CssCode.indexOf("NoCompilerCssCode1" + CompilerStart) != -1) {
+ CssCode = CssCode.replaceAll("NoCompilerCssCode1" + CompilerStart, "