1156 lines
67 KiB
JavaScript
1156 lines
67 KiB
JavaScript
//LableNameCode-需要进行替换的某匹配标签整体内容
|
||
function GlobalClass(LableNameCode, CodeType) {
|
||
let GlobalstyleArr = [];
|
||
if (CodeType == 1) {
|
||
if (LableNameCode.indexOf("类名=\"") != -1) {
|
||
GlobalstyleArr = TakeTheMiddleOfTheTextAll(LableNameCode, "类名=\"", "\" ");
|
||
}
|
||
|
||
} else {
|
||
if (LableNameCode.indexOf("class=\"") != -1) {
|
||
GlobalstyleArr = TakeTheMiddleOfTheTextAll(LableNameCode, "class=\"", "\" ");
|
||
}
|
||
}
|
||
for (let index = 0; index < GlobalstyleArr.length; index++) {
|
||
let GlobalstyleArrStr = GlobalstyleArr[index];
|
||
if (CodeType == 1) {
|
||
GlobalstyleArrStr = GlobalstyleArrStr.replaceHack("类名=\"", "");
|
||
} else {
|
||
GlobalstyleArrStr = GlobalstyleArrStr.replaceHack("class=\"", "");
|
||
}
|
||
GlobalstyleArrStr = GlobalstyleArrStr.substring(0, GlobalstyleArrStr.length - 2);
|
||
if (GlobalstyleArrStr != undefined && GlobalstyleArrStr != null && GlobalstyleArrStr != "") {
|
||
let GlobalstyleArr2 = ClassData(GlobalstyleArrStr, CodeType);
|
||
if (GlobalstyleArr2 != "" && GlobalstyleArr2 != undefined && GlobalstyleArr2 != null) {
|
||
if (GlobalstyleArr[index].indexOf(GlobalstyleArrStr) != -1) {
|
||
GlobalstyleArrStr = GlobalstyleArr[index].replaceHack(GlobalstyleArrStr, GlobalstyleArr2);
|
||
LableNameCode = LableNameCode.replaceHack(GlobalstyleArr[index], GlobalstyleArrStr);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
if (GlobalstyleArr.length <= 0) {
|
||
if (CodeType == 1) {
|
||
if (LableNameCode.indexOf("类名='") != -1) {
|
||
GlobalstyleArr = TakeTheMiddleOfTheTextAll(LableNameCode, "类名='", "' ");
|
||
}
|
||
} else {
|
||
if (LableNameCode.indexOf("class='") != -1) {
|
||
GlobalstyleArr = TakeTheMiddleOfTheTextAll(LableNameCode, "class='", "' ");
|
||
}
|
||
}
|
||
|
||
for (let index = 0; index < GlobalstyleArr.length; index++) {
|
||
let GlobalstyleArrStr = GlobalstyleArr[index];
|
||
if (CodeType == 1) {
|
||
GlobalstyleArrStr = GlobalstyleArrStr.replaceHack("类名='", "");
|
||
} else {
|
||
GlobalstyleArrStr = GlobalstyleArrStr.replaceHack("class='", "");
|
||
}
|
||
GlobalstyleArrStr = GlobalstyleArrStr.substring(0, GlobalstyleArrStr.length - 2);
|
||
if (GlobalstyleArrStr != undefined && GlobalstyleArrStr != null && GlobalstyleArrStr != "") {
|
||
let GlobalstyleArr2 = ClassData(GlobalstyleArrStr, CodeType);
|
||
if (GlobalstyleArr2 != "" && GlobalstyleArr2 != undefined && GlobalstyleArr2 != null) {
|
||
if (GlobalstyleArr[index].indexOf(GlobalstyleArrStr) != -1) {
|
||
GlobalstyleArrStr = GlobalstyleArr[index].replaceHack(GlobalstyleArrStr, GlobalstyleArr2);
|
||
LableNameCode = LableNameCode.replaceHack(GlobalstyleArr[index], GlobalstyleArrStr);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
if (GlobalstyleArr.length <= 0) {
|
||
|
||
if (CodeType == 1) {
|
||
if (LableNameCode.indexOf("类名=\"") != -1) {
|
||
GlobalstyleArr = TakeTheMiddleOfTheTextAll(LableNameCode, "类名=\"", "\">");
|
||
}
|
||
|
||
} else {
|
||
if (LableNameCode.indexOf("class=\"") != -1) {
|
||
GlobalstyleArr = TakeTheMiddleOfTheTextAll(LableNameCode, "class=\"", "\">");
|
||
}
|
||
|
||
}
|
||
for (let index = 0; index < GlobalstyleArr.length; index++) {
|
||
let GlobalstyleArrStr = GlobalstyleArr[index];
|
||
if (CodeType == 1) {
|
||
GlobalstyleArrStr = GlobalstyleArrStr.replaceHack("类名=\"", "");
|
||
} else {
|
||
GlobalstyleArrStr = GlobalstyleArrStr.replaceHack("class=\"", "");
|
||
}
|
||
GlobalstyleArrStr = GlobalstyleArrStr.substring(0, GlobalstyleArrStr.length - 2);
|
||
if (GlobalstyleArrStr != undefined && GlobalstyleArrStr != null && GlobalstyleArrStr != "") {
|
||
let GlobalstyleArr2 = ClassData(GlobalstyleArrStr, CodeType);
|
||
if (GlobalstyleArr2 != "" && GlobalstyleArr2 != undefined && GlobalstyleArr2 != null) {
|
||
if (GlobalstyleArr[index].indexOf(GlobalstyleArrStr) != -1) {
|
||
GlobalstyleArrStr = GlobalstyleArr[index].replaceHack(GlobalstyleArrStr, GlobalstyleArr2);
|
||
LableNameCode = LableNameCode.replaceHack(GlobalstyleArr[index], GlobalstyleArrStr);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
if (GlobalstyleArr.length <= 0) {
|
||
|
||
if (CodeType == 1) {
|
||
if (LableNameCode.indexOf("类名=\"") != -1) {
|
||
GlobalstyleArr = TakeTheMiddleOfTheTextAll(LableNameCode, "类名=\"", "\"/");
|
||
}
|
||
|
||
} else {
|
||
if (LableNameCode.indexOf("class=\"") != -1) {
|
||
GlobalstyleArr = TakeTheMiddleOfTheTextAll(LableNameCode, "class=\"", "\"/");
|
||
}
|
||
|
||
}
|
||
for (let index = 0; index < GlobalstyleArr.length; index++) {
|
||
let GlobalstyleArrStr = GlobalstyleArr[index];
|
||
if (CodeType == 1) {
|
||
GlobalstyleArrStr = GlobalstyleArrStr.replaceHack("类名=\"", "");
|
||
} else {
|
||
GlobalstyleArrStr = GlobalstyleArrStr.replaceHack("class=\"", "");
|
||
}
|
||
GlobalstyleArrStr = GlobalstyleArrStr.substring(0, GlobalstyleArrStr.length - 2);
|
||
if (GlobalstyleArrStr != undefined && GlobalstyleArrStr != null && GlobalstyleArrStr != "") {
|
||
let GlobalstyleArr2 = ClassData(GlobalstyleArrStr, CodeType);
|
||
if (GlobalstyleArr2 != "" && GlobalstyleArr2 != undefined && GlobalstyleArr2 != null) {
|
||
if (GlobalstyleArr[index].indexOf(GlobalstyleArrStr) != -1) {
|
||
GlobalstyleArrStr = GlobalstyleArr[index].replaceHack(GlobalstyleArrStr, GlobalstyleArr2);
|
||
LableNameCode = LableNameCode.replaceHack(GlobalstyleArr[index], GlobalstyleArrStr);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
if (GlobalstyleArr.length <= 0) {
|
||
if (CodeType == 1) {
|
||
if (LableNameCode.indexOf("类名='") != -1) {
|
||
GlobalstyleArr = TakeTheMiddleOfTheTextAll(LableNameCode, "类名='", "'>");
|
||
}
|
||
|
||
} else {
|
||
if (LableNameCode.indexOf("class='") != -1) {
|
||
GlobalstyleArr = TakeTheMiddleOfTheTextAll(LableNameCode, "class='", "'>");
|
||
}
|
||
|
||
}
|
||
for (let index = 0; index < GlobalstyleArr.length; index++) {
|
||
let GlobalstyleArrStr = GlobalstyleArr[index];
|
||
if (CodeType == 1) {
|
||
GlobalstyleArrStr = GlobalstyleArrStr.replaceHack("类名='", "");
|
||
} else {
|
||
GlobalstyleArrStr = GlobalstyleArrStr.replaceHack("class='", "");
|
||
}
|
||
GlobalstyleArrStr = GlobalstyleArrStr.substring(0, GlobalstyleArrStr.length - 2);
|
||
if (GlobalstyleArrStr != undefined && GlobalstyleArrStr != null && GlobalstyleArrStr != "") {
|
||
let GlobalstyleArr2 = ClassData(GlobalstyleArrStr, CodeType);
|
||
if (GlobalstyleArr2 != "" && GlobalstyleArr2 != undefined && GlobalstyleArr2 != null) {
|
||
if (GlobalstyleArr[index].indexOf(GlobalstyleArrStr) != -1) {
|
||
GlobalstyleArrStr = GlobalstyleArr[index].replaceHack(GlobalstyleArrStr, GlobalstyleArr2);
|
||
LableNameCode = LableNameCode.replaceHack(GlobalstyleArr[index], GlobalstyleArrStr);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
if (GlobalstyleArr.length <= 0) {
|
||
if (CodeType == 1) {
|
||
if (LableNameCode.indexOf("类名='") != -1) {
|
||
GlobalstyleArr = TakeTheMiddleOfTheTextAll(LableNameCode, "类名='", "'/");
|
||
}
|
||
|
||
} else {
|
||
if (LableNameCode.indexOf("class='") != -1) {
|
||
GlobalstyleArr = TakeTheMiddleOfTheTextAll(LableNameCode, "class='", "'/");
|
||
}
|
||
|
||
}
|
||
for (let index = 0; index < GlobalstyleArr.length; index++) {
|
||
let GlobalstyleArrStr = GlobalstyleArr[index];
|
||
if (CodeType == 1) {
|
||
GlobalstyleArrStr = GlobalstyleArrStr.replaceHack("类名='", "");
|
||
} else {
|
||
GlobalstyleArrStr = GlobalstyleArrStr.replaceHack("class='", "");
|
||
}
|
||
GlobalstyleArrStr = GlobalstyleArrStr.substring(0, GlobalstyleArrStr.length - 2);
|
||
if (GlobalstyleArrStr != undefined && GlobalstyleArrStr != null && GlobalstyleArrStr != "") {
|
||
let GlobalstyleArr2 = ClassData(GlobalstyleArrStr, CodeType);
|
||
if (GlobalstyleArr2 != "" && GlobalstyleArr2 != undefined && GlobalstyleArr2 != null) {
|
||
if (GlobalstyleArr[index].indexOf(GlobalstyleArrStr) != -1) {
|
||
GlobalstyleArrStr = GlobalstyleArr[index].replaceHack(GlobalstyleArrStr, GlobalstyleArr2);
|
||
LableNameCode = LableNameCode.replaceHack(GlobalstyleArr[index], GlobalstyleArrStr);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
return LableNameCode;
|
||
}
|
||
//class的值编译,也就是三方库的类名编译
|
||
function ClassData(LableNameCode, CodeType) {
|
||
for (let index = 0; index < HTMLTripartiteClass.length; index++) {
|
||
//T_title
|
||
let ClassName = [];
|
||
if (CodeType == 1) {
|
||
ClassName = [HTMLTripartiteClass[index]["T_title"], HTMLTripartiteClass[index]["T_title_en"]]
|
||
} else {
|
||
ClassName = [HTMLTripartiteClass[index]["T_title_en"], HTMLTripartiteClass[index]["T_title"]]
|
||
}
|
||
if (LableNameCode.indexOf(ClassName[1]) != -1) {
|
||
let LableNameCodeStr = "---------- " + LableNameCode + " ----------";
|
||
let ClassOriginal = LableNameCodeStr;
|
||
let regCompilerCodeArr = [StrCodeUuid(ClassName[0]), ClassName[0]];
|
||
let reg = new RegExp("[^0-9a-zA-Z\u4e00-\u9fa5_-]" + ClassName[1] + "(?=[^0-9a-zA-Z\u4e00-\u9fa5_-])", "g");
|
||
if (ClassOriginal.indexOf(ClassName[1]) != -1) {
|
||
let ClassStrArr = ClassOriginal.match(reg);
|
||
if (ClassStrArr != undefined && ClassStrArr != null) {
|
||
if (ClassStrArr.length >= 1) {
|
||
LableNameCodeStr = LableNameCodeStr.replaceHack(reg, regCompilerCodeArr[0]);
|
||
for (let index = 0; index < ClassStrArr.length; index++) {
|
||
let FirstText = ClassStrArr[index].substring(0, 1);
|
||
LableNameCodeStr = LableNameCodeStr.replaceHack(regCompilerCodeArr[0], FirstText + regCompilerCodeArr[1]);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
if (LableNameCodeStr.indexOf("---------- ") != -1) {
|
||
LableNameCodeStr = LableNameCodeStr.replaceAll("---------- ", "");
|
||
}
|
||
if (LableNameCodeStr.indexOf(" ----------") != -1) {
|
||
LableNameCodeStr = LableNameCodeStr.replaceAll(" ----------", "");
|
||
}
|
||
LableNameCode = LableNameCodeStr
|
||
}
|
||
}
|
||
return LableNameCode;
|
||
}
|
||
//LableNameCode-需要进行替换的某匹配标签整体内容
|
||
function Globalstyle(LableNameCode, CodeType) {
|
||
let GlobalstyleArr = [];
|
||
if (CodeType == 1) {
|
||
if (LableNameCode.indexOf("行内样式=\"") != -1) {
|
||
GlobalstyleArr = TakeTheMiddleOfTheTextAll(LableNameCode, "行内样式=\"", "\" ");
|
||
}
|
||
|
||
} else {
|
||
if (LableNameCode.indexOf("style=\"") != -1) {
|
||
GlobalstyleArr = TakeTheMiddleOfTheTextAll(LableNameCode, "style=\"", "\" ");
|
||
}
|
||
|
||
}
|
||
for (let index = 0; index < GlobalstyleArr.length; index++) {
|
||
let GlobalstyleArrStr = GlobalstyleArr[index];
|
||
if (CodeType == 1) {
|
||
GlobalstyleArrStr = GlobalstyleArrStr.replaceHack("行内样式=\"", "");
|
||
} else {
|
||
GlobalstyleArrStr = GlobalstyleArrStr.replaceHack("style=\"", "");
|
||
}
|
||
GlobalstyleArrStr = GlobalstyleArrStr.substring(0, GlobalstyleArrStr.length - 2);
|
||
if (GlobalstyleArrStr != undefined && GlobalstyleArrStr != null && GlobalstyleArrStr != "") {
|
||
let GlobalstyleArr2 = CssCodeCompiler(GlobalstyleArrStr, CodeType);
|
||
if (GlobalstyleArr[index].indexOf(GlobalstyleArrStr) != -1) {
|
||
GlobalstyleArrStr = GlobalstyleArr[index].replaceHack(GlobalstyleArrStr, GlobalstyleArr2);
|
||
LableNameCode = LableNameCode.replaceHack(GlobalstyleArr[index], GlobalstyleArrStr);
|
||
}
|
||
}
|
||
}
|
||
if (GlobalstyleArr.length <= 0) {
|
||
if (CodeType == 1) {
|
||
if (LableNameCode.indexOf("行内样式='") != -1) {
|
||
GlobalstyleArr = TakeTheMiddleOfTheTextAll(LableNameCode, "行内样式='", "' ");
|
||
}
|
||
|
||
} else {
|
||
if (LableNameCode.indexOf("style='") != -1) {
|
||
GlobalstyleArr = TakeTheMiddleOfTheTextAll(LableNameCode, "style='", "' ");
|
||
}
|
||
|
||
}
|
||
for (let index = 0; index < GlobalstyleArr.length; index++) {
|
||
let GlobalstyleArrStr = GlobalstyleArr[index];
|
||
if (CodeType == 1) {
|
||
GlobalstyleArrStr = GlobalstyleArrStr.replaceHack("行内样式='", "");
|
||
} else {
|
||
GlobalstyleArrStr = GlobalstyleArrStr.replaceHack("style='", "");
|
||
}
|
||
GlobalstyleArrStr = GlobalstyleArrStr.substring(0, GlobalstyleArrStr.length - 2);
|
||
if (GlobalstyleArrStr != undefined && GlobalstyleArrStr != null && GlobalstyleArrStr != "") {
|
||
let GlobalstyleArr2 = CssCodeCompiler(GlobalstyleArrStr, CodeType);
|
||
if (GlobalstyleArr[index].indexOf(GlobalstyleArrStr) != -1) {
|
||
GlobalstyleArrStr = GlobalstyleArr[index].replaceHack(GlobalstyleArrStr, GlobalstyleArr2);
|
||
LableNameCode = LableNameCode.replaceHack(GlobalstyleArr[index], GlobalstyleArrStr);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
if (GlobalstyleArr.length <= 0) {
|
||
if (CodeType == 1) {
|
||
if (LableNameCode.indexOf("行内样式=\"") != -1) {
|
||
GlobalstyleArr = TakeTheMiddleOfTheTextAll(LableNameCode, "行内样式=\"", "\">");
|
||
}
|
||
|
||
} else {
|
||
if (LableNameCode.indexOf("style=\"") != -1) {
|
||
GlobalstyleArr = TakeTheMiddleOfTheTextAll(LableNameCode, "style=\"", "\">");
|
||
}
|
||
|
||
}
|
||
for (let index = 0; index < GlobalstyleArr.length; index++) {
|
||
let GlobalstyleArrStr = GlobalstyleArr[index];
|
||
if (CodeType == 1) {
|
||
GlobalstyleArrStr = GlobalstyleArrStr.replaceHack("行内样式=\"", "");
|
||
} else {
|
||
GlobalstyleArrStr = GlobalstyleArrStr.replaceHack("style=\"", "");
|
||
}
|
||
GlobalstyleArrStr = GlobalstyleArrStr.substring(0, GlobalstyleArrStr.length - 2);
|
||
if (GlobalstyleArrStr != undefined && GlobalstyleArrStr != null && GlobalstyleArrStr != "") {
|
||
let GlobalstyleArr2 = CssCodeCompiler(GlobalstyleArrStr, CodeType);
|
||
if (GlobalstyleArr[index].indexOf(GlobalstyleArrStr) != -1) {
|
||
GlobalstyleArrStr = GlobalstyleArr[index].replaceHack(GlobalstyleArrStr, GlobalstyleArr2);
|
||
LableNameCode = LableNameCode.replaceHack(GlobalstyleArr[index], GlobalstyleArrStr);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
if (GlobalstyleArr.length <= 0) {
|
||
if (CodeType == 1) {
|
||
if (LableNameCode.indexOf("行内样式=\"") != -1) {
|
||
GlobalstyleArr = TakeTheMiddleOfTheTextAll(LableNameCode, "行内样式=\"", "\"/");
|
||
}
|
||
|
||
} else {
|
||
if (LableNameCode.indexOf("style=\"") != -1) {
|
||
GlobalstyleArr = TakeTheMiddleOfTheTextAll(LableNameCode, "style=\"", "\"/");
|
||
}
|
||
|
||
}
|
||
for (let index = 0; index < GlobalstyleArr.length; index++) {
|
||
let GlobalstyleArrStr = GlobalstyleArr[index];
|
||
if (CodeType == 1) {
|
||
GlobalstyleArrStr = GlobalstyleArrStr.replaceHack("行内样式=\"", "");
|
||
} else {
|
||
GlobalstyleArrStr = GlobalstyleArrStr.replaceHack("style=\"", "");
|
||
}
|
||
GlobalstyleArrStr = GlobalstyleArrStr.substring(0, GlobalstyleArrStr.length - 2);
|
||
if (GlobalstyleArrStr != undefined && GlobalstyleArrStr != null && GlobalstyleArrStr != "") {
|
||
let GlobalstyleArr2 = CssCodeCompiler(GlobalstyleArrStr, CodeType);
|
||
if (GlobalstyleArr[index].indexOf(GlobalstyleArrStr) != -1) {
|
||
GlobalstyleArrStr = GlobalstyleArr[index].replaceHack(GlobalstyleArrStr, GlobalstyleArr2);
|
||
LableNameCode = LableNameCode.replaceHack(GlobalstyleArr[index], GlobalstyleArrStr);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
if (GlobalstyleArr.length <= 0) {
|
||
if (CodeType == 1) {
|
||
if (LableNameCode.indexOf("行内样式='") != -1) {
|
||
GlobalstyleArr = TakeTheMiddleOfTheTextAll(LableNameCode, "行内样式='", "'>");
|
||
}
|
||
|
||
} else {
|
||
if (LableNameCode.indexOf("style='") != -1) {
|
||
GlobalstyleArr = TakeTheMiddleOfTheTextAll(LableNameCode, "style='", "'>");
|
||
}
|
||
|
||
}
|
||
for (let index = 0; index < GlobalstyleArr.length; index++) {
|
||
let GlobalstyleArrStr = GlobalstyleArr[index];
|
||
if (CodeType == 1) {
|
||
GlobalstyleArrStr = GlobalstyleArrStr.replaceHack("行内样式='", "");
|
||
} else {
|
||
GlobalstyleArrStr = GlobalstyleArrStr.replaceHack("style='", "");
|
||
}
|
||
GlobalstyleArrStr = GlobalstyleArrStr.substring(0, GlobalstyleArrStr.length - 2);
|
||
if (GlobalstyleArrStr != undefined && GlobalstyleArrStr != null && GlobalstyleArrStr != "") {
|
||
let GlobalstyleArr2 = CssCodeCompiler(GlobalstyleArrStr, CodeType);
|
||
if (GlobalstyleArr[index].indexOf(GlobalstyleArrStr) != -1) {
|
||
GlobalstyleArrStr = GlobalstyleArr[index].replaceHack(GlobalstyleArrStr, GlobalstyleArr2);
|
||
LableNameCode = LableNameCode.replaceHack(GlobalstyleArr[index], GlobalstyleArrStr);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
if (GlobalstyleArr.length <= 0) {
|
||
if (CodeType == 1) {
|
||
if (LableNameCode.indexOf("行内样式='") != -1) {
|
||
GlobalstyleArr = TakeTheMiddleOfTheTextAll(LableNameCode, "行内样式='", "'/");
|
||
}
|
||
|
||
} else {
|
||
if (LableNameCode.indexOf("style='") != -1) {
|
||
GlobalstyleArr = TakeTheMiddleOfTheTextAll(LableNameCode, "style='", "'/");
|
||
}
|
||
|
||
}
|
||
for (let index = 0; index < GlobalstyleArr.length; index++) {
|
||
let GlobalstyleArrStr = GlobalstyleArr[index];
|
||
if (CodeType == 1) {
|
||
GlobalstyleArrStr = GlobalstyleArrStr.replaceHack("行内样式='", "");
|
||
} else {
|
||
GlobalstyleArrStr = GlobalstyleArrStr.replaceHack("style='", "");
|
||
}
|
||
GlobalstyleArrStr = GlobalstyleArrStr.substring(0, GlobalstyleArrStr.length - 2);
|
||
if (GlobalstyleArrStr != undefined && GlobalstyleArrStr != null && GlobalstyleArrStr != "") {
|
||
let GlobalstyleArr2 = CssCodeCompiler(GlobalstyleArrStr, CodeType);
|
||
if (GlobalstyleArr[index].indexOf(GlobalstyleArrStr) != -1) {
|
||
GlobalstyleArrStr = GlobalstyleArr[index].replaceHack(GlobalstyleArrStr, GlobalstyleArr2);
|
||
LableNameCode = LableNameCode.replaceHack(GlobalstyleArr[index], GlobalstyleArrStr);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
return LableNameCode;
|
||
}
|
||
//FileID - 文件的ID,可以是空字符串
|
||
function GlobalFun(LableNameCode, CodeType, FileID) {
|
||
for (let index = 0; index < JSON2_All.length; index++) {
|
||
let LableNameFun = [];
|
||
if (CodeType == 1) {
|
||
LableNameFun = [JSON2_All[index]["title"], JSON2_All[index]["title_en"]]
|
||
} else {
|
||
LableNameFun = [JSON2_All[index]["title_en"], JSON2_All[index]["title"]]
|
||
}
|
||
if (LableNameCode.indexOf(LableNameFun[1]) != -1 || LableNameCode.indexOf(LableNameFun[0]) != -1) {
|
||
if (LableNameCode.indexOf("'" + LableNameFun[1] + "=") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack("'" + LableNameFun[1] + "=", "'" + LableNameFun[0] + "=");
|
||
}
|
||
if (LableNameCode.indexOf("\"" + LableNameFun[1] + "=") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack("\"" + LableNameFun[1] + "=", "\"" + LableNameFun[0] + "=");
|
||
}
|
||
if (LableNameCode.indexOf(" " + LableNameFun[1] + "=") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack(" " + LableNameFun[1] + "=", " " + LableNameFun[0] + "=");
|
||
}
|
||
if (LableNameCode.indexOf("'" + LableNameFun[1] + " =") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack("'" + LableNameFun[1] + " =", "'" + LableNameFun[0] + " =");
|
||
}
|
||
if (LableNameCode.indexOf("\"" + LableNameFun[1] + " =") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack("\"" + LableNameFun[1] + " =", "\"" + LableNameFun[0] + " =");
|
||
}
|
||
if (LableNameCode.indexOf(" " + LableNameFun[1] + " =") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack(" " + LableNameFun[1] + " =", " " + LableNameFun[0] + " =");
|
||
}
|
||
if (LableNameCode.indexOf("'" + LableNameFun[1] + " =") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack("'" + LableNameFun[1] + " =", "'" + LableNameFun[0] + " =");
|
||
}
|
||
if (LableNameCode.indexOf("\"" + LableNameFun[1] + " =") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack("\"" + LableNameFun[1] + " =", "\"" + LableNameFun[0] + " =");
|
||
}
|
||
if (LableNameCode.indexOf(" " + LableNameFun[1] + " =") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack(" " + LableNameFun[1] + " =", " " + LableNameFun[0] + " =");
|
||
}
|
||
let GlobalFunCode = []
|
||
if (LableNameCode.indexOf(LableNameFun[0] + "=\"") != -1) {
|
||
GlobalFunCode = TakeTheMiddleOfTheText2(LableNameCode, LableNameFun[0] + "=\"", "\" ");
|
||
if (GlobalFunCode != "") {
|
||
let GlobalFunCodeStr = GlobalFunCode;
|
||
GlobalFunCodeStr = GlobalFunCodeStr.replaceHack(LableNameFun[0] + "=\"", "");
|
||
GlobalFunCodeStr = GlobalFunCodeStr.substring(0, GlobalFunCodeStr.length - 2);
|
||
if (GlobalFunCodeStr != undefined && GlobalFunCodeStr != null && GlobalFunCodeStr != "") {
|
||
let GlobalFunCode2 = GlobalFunCodeStr
|
||
if (GlobalFunJsIf(GlobalFunCodeStr) == true) {
|
||
GlobalFunCode2 = JsCodeCompiler({
|
||
"JSCode": GlobalFunCodeStr,
|
||
"CodeType": CodeType,
|
||
"FileID": FileID
|
||
});
|
||
}
|
||
if (GlobalFunCode.indexOf(GlobalFunCodeStr) != -1) {
|
||
GlobalFunCodeStr = GlobalFunCode.replaceHack(GlobalFunCodeStr, GlobalFunCode2);
|
||
LableNameCode = LableNameCode.replaceAll(GlobalFunCode, GlobalFunCodeStr);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
if (GlobalFunCode == "") {
|
||
if (LableNameCode.indexOf(LableNameFun[0] + "='") != -1) {
|
||
GlobalFunCode = TakeTheMiddleOfTheText2(LableNameCode, LableNameFun[0] + "='", "' ");
|
||
if (GlobalFunCode != "") {
|
||
let GlobalFunCodeStr = GlobalFunCode;
|
||
GlobalFunCodeStr = GlobalFunCodeStr.replaceHack(LableNameFun[0] + "='", "");
|
||
GlobalFunCodeStr = GlobalFunCodeStr.substring(0, GlobalFunCodeStr.length - 2);
|
||
if (GlobalFunCodeStr != undefined && GlobalFunCodeStr != null && GlobalFunCodeStr != "") {
|
||
let GlobalFunCode2 = GlobalFunCodeStr
|
||
if (GlobalFunJsIf(GlobalFunCodeStr) == true) {
|
||
GlobalFunCode2 = JsCodeCompiler({
|
||
"JSCode": GlobalFunCodeStr,
|
||
"CodeType": CodeType,
|
||
"FileID": FileID
|
||
});
|
||
}
|
||
if (GlobalFunCode.indexOf(GlobalFunCodeStr) != -1) {
|
||
GlobalFunCodeStr = GlobalFunCode.replaceHack(GlobalFunCodeStr, GlobalFunCode2);
|
||
LableNameCode = LableNameCode.replaceAll(GlobalFunCode, GlobalFunCodeStr);
|
||
}
|
||
|
||
|
||
}
|
||
}
|
||
}
|
||
|
||
}
|
||
if (GlobalFunCode == "") {
|
||
if (LableNameCode.indexOf(LableNameFun[0] + "=\"") != -1) {
|
||
GlobalFunCode = TakeTheMiddleOfTheText2(LableNameCode, LableNameFun[0] + "=\"", "\">");
|
||
if (GlobalFunCode != "") {
|
||
let GlobalFunCodeStr = GlobalFunCode;
|
||
GlobalFunCodeStr = GlobalFunCodeStr.replaceHack(LableNameFun[0] + "=\"", "");
|
||
GlobalFunCodeStr = GlobalFunCodeStr.substring(0, GlobalFunCodeStr.length - 2);
|
||
if (GlobalFunCodeStr != undefined && GlobalFunCodeStr != null && GlobalFunCodeStr != "") {
|
||
let GlobalFunCode2 = GlobalFunCodeStr
|
||
if (GlobalFunJsIf(GlobalFunCodeStr) == true) {
|
||
GlobalFunCode2 = JsCodeCompiler({
|
||
"JSCode": GlobalFunCodeStr,
|
||
"CodeType": CodeType,
|
||
"FileID": FileID
|
||
});
|
||
}
|
||
if (GlobalFunCode.indexOf(GlobalFunCodeStr) != -1) {
|
||
GlobalFunCodeStr = GlobalFunCode.replaceHack(GlobalFunCodeStr, GlobalFunCode2);
|
||
LableNameCode = LableNameCode.replaceAll(GlobalFunCode, GlobalFunCodeStr);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
}
|
||
if (GlobalFunCode == "") {
|
||
if (LableNameCode.indexOf(LableNameFun[0] + "='") != -1) {
|
||
GlobalFunCode = TakeTheMiddleOfTheText2(LableNameCode, LableNameFun[0] + "='", "'>");
|
||
if (GlobalFunCode != "") {
|
||
let GlobalFunCodeStr = GlobalFunCode;
|
||
GlobalFunCodeStr = GlobalFunCodeStr.replaceHack(LableNameFun[0] + "='", "");
|
||
GlobalFunCodeStr = GlobalFunCodeStr.substring(0, GlobalFunCodeStr.length - 2);
|
||
if (GlobalFunCodeStr != undefined && GlobalFunCodeStr != null && GlobalFunCodeStr != "") {
|
||
let GlobalFunCode2 = GlobalFunCodeStr
|
||
if (GlobalFunJsIf(GlobalFunCodeStr) == true) {
|
||
GlobalFunCode2 = JsCodeCompiler({
|
||
"JSCode": GlobalFunCodeStr,
|
||
"CodeType": CodeType,
|
||
"FileID": FileID
|
||
});
|
||
}
|
||
if (GlobalFunCode.indexOf(GlobalFunCodeStr) != -1) {
|
||
GlobalFunCodeStr = GlobalFunCode.replaceHack(GlobalFunCodeStr, GlobalFunCode2);
|
||
LableNameCode = LableNameCode.replaceAll(GlobalFunCode, GlobalFunCodeStr);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
return LableNameCode;
|
||
}
|
||
//JS全局方法是否参与编译相关判断
|
||
function GlobalFunJsIf(code) {
|
||
if (code.indexOf("=") != -1 || code.indexOf(";") != -1 || code.indexOf("-") != -1 || code.indexOf("{") != -1 || code.indexOf("}") != -1 || code.indexOf("=") != -1 || code.indexOf(".") != -1 || code.indexOf("[") != -1 || code.indexOf("]") != -1 || code.indexOf("|") != -1 || code.indexOf("/") != -1 || code.indexOf("*") != -1 || code.indexOf("\\") != -1 || code.indexOf("&") != -1 || code.indexOf("%") != -1 || code.indexOf("@") != -1 || code.indexOf("#") != -1 || code.indexOf("~") != -1 || code.indexOf(",真") != -1 || code.indexOf("(真") != -1 || code.indexOf(",假") != -1 || code.indexOf("(假") != -1 || code.indexOf(" 假") != -1 || code.indexOf(" 真") != -1 || code.indexOf("假 ") != -1 || code.indexOf("真 ") != -1 || code.indexOf(",true") != -1 || code.indexOf("(true") != -1 || code.indexOf(",false") != -1 || code.indexOf("(false") != -1 || code.indexOf(" false") != -1 || code.indexOf(" true") != -1 || code.indexOf("false ") != -1 || code.indexOf("true ") != -1) {
|
||
return true;
|
||
}
|
||
for (let index = 0; index < JavascriptOverallCode.length; index++) {
|
||
if (code.indexOf(JavascriptOverallCode[index]["T_title"]) != -1 || code.indexOf(JavascriptOverallCode[index]["T_title_en"]) != -1) {
|
||
return true;
|
||
}
|
||
}
|
||
for (let index = 0; index < JavascriptCodeKey.length; index++) {
|
||
if (JavascriptCodeKey[index]["JSName"].length >= 2) {
|
||
if (code.indexOf(JavascriptCodeKey[index]["JSName"]) != -1 || code.indexOf(JavascriptCodeKey[index]["JSNameEN"]) != -1) {
|
||
return true;
|
||
}
|
||
}
|
||
}
|
||
return false;
|
||
}
|
||
//全局属性
|
||
function GlobalAttributes(LableNameCode, CodeType) {
|
||
for (let index = 0; index < JSON1_All.length; index++) {
|
||
let LableNameAttr = [];
|
||
if (CodeType == 1) {
|
||
LableNameAttr = [JSON1_All[index]["title"], JSON1_All[index]["title_en"]]
|
||
} else {
|
||
LableNameAttr = [JSON1_All[index]["title_en"], JSON1_All[index]["title"]]
|
||
}
|
||
if (LableNameCode.indexOf(LableNameAttr[0]) != -1 || LableNameCode.indexOf(LableNameAttr[1]) != -1) {
|
||
if (LableNameCode.indexOf("'" + LableNameAttr[1] + "=") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack("'" + LableNameAttr[1] + "=", "'" + LableNameAttr[0] + "=");
|
||
}
|
||
if (LableNameCode.indexOf("\"" + LableNameAttr[1] + "=") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack("\"" + LableNameAttr[1] + "=", "\"" + LableNameAttr[0] + "=");
|
||
}
|
||
if (LableNameCode.indexOf(" " + LableNameAttr[1] + "=") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack(" " + LableNameAttr[1] + "=", " " + LableNameAttr[0] + "=");
|
||
}
|
||
if (LableNameCode.indexOf(":" + LableNameAttr[1] + "=") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack(":" + LableNameAttr[1] + "=", ":" + LableNameAttr[0] + "=");
|
||
}
|
||
if (LableNameCode.indexOf("'" + LableNameAttr[1] + " =") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack("'" + LableNameAttr[1] + " =", "'" + LableNameAttr[0] + " =");
|
||
}
|
||
if (LableNameCode.indexOf("\"" + LableNameAttr[1] + " =") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack("\"" + LableNameAttr[1] + " =", "\"" + LableNameAttr[0] + " =");
|
||
}
|
||
if (LableNameCode.indexOf(" " + LableNameAttr[1] + " =") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack(" " + LableNameAttr[1] + " =", " " + LableNameAttr[0] + " =");
|
||
}
|
||
if (LableNameCode.indexOf(":" + LableNameAttr[1] + " =") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack(":" + LableNameAttr[1] + " =", ":" + LableNameAttr[0] + " =");
|
||
}
|
||
if (LableNameCode.indexOf("'" + LableNameAttr[1] + " =") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack("'" + LableNameAttr[1] + " =", "'" + LableNameAttr[0] + " =");
|
||
}
|
||
if (LableNameCode.indexOf("\"" + LableNameAttr[1] + " =") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack("\"" + LableNameAttr[1] + " =", "\"" + LableNameAttr[0] + " =");
|
||
}
|
||
if (LableNameCode.indexOf(" " + LableNameAttr[1] + " =") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack(" " + LableNameAttr[1] + " =", " " + LableNameAttr[0] + " =");
|
||
}
|
||
if (LableNameCode.indexOf(":" + LableNameAttr[1] + " =") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack(":" + LableNameAttr[1] + " =", ":" + LableNameAttr[0] + " =");
|
||
}
|
||
if (LableNameCode.indexOf(" " + LableNameAttr[1] + " ") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack(" " + LableNameAttr[1] + " ", " " + LableNameAttr[0] + " ");
|
||
}
|
||
if (LableNameCode.indexOf(" " + LableNameAttr[1] + ">") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack(" " + LableNameAttr[1] + ">", " " + LableNameAttr[0] + ">");
|
||
}
|
||
if (LableNameCode.indexOf(":" + LableNameAttr[1] + ">") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack(":" + LableNameAttr[1] + ">", ":" + LableNameAttr[0] + ">");
|
||
}
|
||
if (LableNameCode.indexOf("'" + LableNameAttr[1] + ":") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack("'" + LableNameAttr[1] + ":", "'" + LableNameAttr[0] + ":");
|
||
}
|
||
if (LableNameCode.indexOf("\"" + LableNameAttr[1] + ":") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack("\"" + LableNameAttr[1] + ":", "\"" + LableNameAttr[0] + ":");
|
||
}
|
||
if (LableNameCode.indexOf(" " + LableNameAttr[1] + ":") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack(" " + LableNameAttr[1] + ":", " " + LableNameAttr[0] + ":");
|
||
}
|
||
if (LableNameCode.indexOf(":" + LableNameAttr[1] + ":") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack(":" + LableNameAttr[1] + ":", ":" + LableNameAttr[0] + ":");
|
||
}
|
||
if (LableNameCode.indexOf("'" + LableNameAttr[1] + " :") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack("'" + LableNameAttr[1] + " :", "'" + LableNameAttr[0] + " :");
|
||
}
|
||
if (LableNameCode.indexOf("\"" + LableNameAttr[1] + " :") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack("\"" + LableNameAttr[1] + " :", "\"" + LableNameAttr[0] + " :");
|
||
}
|
||
if (LableNameCode.indexOf(" " + LableNameAttr[1] + " :") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack(" " + LableNameAttr[1] + " :", " " + LableNameAttr[0] + " :");
|
||
}
|
||
if (LableNameCode.indexOf(":" + LableNameAttr[1] + " :") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack(":" + LableNameAttr[1] + " :", ":" + LableNameAttr[0] + " :");
|
||
}
|
||
let LableNameAttrArrData = []
|
||
if (LableNameCode.indexOf(LableNameAttr[0] + "=\"") != -1) {
|
||
LableNameAttrArrData = TakeTheMiddleOfTheTextAll(LableNameCode, LableNameAttr[0] + "=\"", "\"");
|
||
if (LableNameAttrArrData.length >= 1) {
|
||
LableNameCode = GlobalArrDataCompiler(LableNameCode, LableNameAttrArrData, index, CodeType, LableNameAttr[0])
|
||
}
|
||
}
|
||
if (LableNameCode.indexOf(LableNameAttr[0] + "='") != -1) {
|
||
LableNameAttrArrData = TakeTheMiddleOfTheTextAll(LableNameCode, LableNameAttr[0] + "='", "'");
|
||
if (LableNameAttrArrData.length >= 1) {
|
||
LableNameCode = GlobalArrDataCompiler(LableNameCode, LableNameAttrArrData, index, CodeType, LableNameAttr[0])
|
||
}
|
||
}
|
||
if (LableNameCode.indexOf(LableNameAttr[0] + " =\"") != -1) {
|
||
LableNameAttrArrData = TakeTheMiddleOfTheTextAll(LableNameCode, LableNameAttr[0] + " =\"", "\"");
|
||
if (LableNameAttrArrData.length >= 1) {
|
||
LableNameCode = GlobalArrDataCompiler(LableNameCode, LableNameAttrArrData, index, CodeType, LableNameAttr[0])
|
||
}
|
||
}
|
||
if (LableNameCode.indexOf(LableNameAttr[0] + " ='") != -1) {
|
||
LableNameAttrArrData = TakeTheMiddleOfTheTextAll(LableNameCode, LableNameAttr[0] + " ='", "'");
|
||
if (LableNameAttrArrData.length >= 1) {
|
||
LableNameCode = GlobalArrDataCompiler(LableNameCode, LableNameAttrArrData, index, CodeType, LableNameAttr[0])
|
||
}
|
||
}
|
||
if (LableNameCode.indexOf(LableNameAttr[0] + " = \"") != -1) {
|
||
LableNameAttrArrData = TakeTheMiddleOfTheTextAll(LableNameCode, LableNameAttr[0] + " = \"", "\"");
|
||
if (LableNameAttrArrData.length >= 1) {
|
||
LableNameCode = GlobalArrDataCompiler(LableNameCode, LableNameAttrArrData, index, CodeType, LableNameAttr[0])
|
||
}
|
||
}
|
||
if (LableNameCode.indexOf(LableNameAttr[0] + " = '") != -1) {
|
||
LableNameAttrArrData = TakeTheMiddleOfTheTextAll(LableNameCode, LableNameAttr[0] + " = '", "'");
|
||
if (LableNameAttrArrData.length >= 1) {
|
||
LableNameCode = GlobalArrDataCompiler(LableNameCode, LableNameAttrArrData, index, CodeType, LableNameAttr[0])
|
||
}
|
||
}
|
||
if (LableNameCode.indexOf(LableNameAttr[0] + " = \"") != -1) {
|
||
LableNameAttrArrData = TakeTheMiddleOfTheTextAll(LableNameCode, LableNameAttr[0] + " = \"", "\"");
|
||
if (LableNameAttrArrData.length >= 1) {
|
||
LableNameCode = GlobalArrDataCompiler(LableNameCode, LableNameAttrArrData, index, CodeType, LableNameAttr[0])
|
||
}
|
||
}
|
||
if (LableNameCode.indexOf(LableNameAttr[0] + " = '") != -1) {
|
||
LableNameAttrArrData = TakeTheMiddleOfTheTextAll(LableNameCode, LableNameAttr[0] + " = '", "'");
|
||
if (LableNameAttrArrData.length >= 1) {
|
||
LableNameCode = GlobalArrDataCompiler(LableNameCode, LableNameAttrArrData, index, CodeType, LableNameAttr[0])
|
||
}
|
||
}
|
||
if (LableNameCode.indexOf(LableNameAttr[0] + " =\"") != -1) {
|
||
LableNameAttrArrData = TakeTheMiddleOfTheTextAll(LableNameCode, LableNameAttr[0] + " =\"", "\"");
|
||
if (LableNameAttrArrData.length >= 1) {
|
||
LableNameCode = GlobalArrDataCompiler(LableNameCode, LableNameAttrArrData, index, CodeType, LableNameAttr[0])
|
||
}
|
||
}
|
||
if (LableNameCode.indexOf(LableNameAttr[0] + " ='") != -1) {
|
||
LableNameAttrArrData = TakeTheMiddleOfTheTextAll(LableNameCode, LableNameAttr[0] + " ='", "'");
|
||
if (LableNameAttrArrData.length >= 1) {
|
||
LableNameCode = GlobalArrDataCompiler(LableNameCode, LableNameAttrArrData, index, CodeType, LableNameAttr[0])
|
||
}
|
||
}
|
||
if (LableNameCode.indexOf(LableNameAttr[0] + ":='") != -1) {
|
||
LableNameAttrArrData = TakeTheMiddleOfTheTextAll(LableNameCode, LableNameAttr[0] + ":='", "'");
|
||
if (LableNameAttrArrData.length >= 1) {
|
||
LableNameCode = GlobalArrDataCompiler(LableNameCode, LableNameAttrArrData, index, CodeType, LableNameAttr[0])
|
||
}
|
||
}
|
||
if (LableNameCode.indexOf(LableNameAttr[0] + ":=\"") != -1) {
|
||
LableNameAttrArrData = TakeTheMiddleOfTheTextAll(LableNameCode, LableNameAttr[0] + ":=\"", "\"");
|
||
if (LableNameAttrArrData.length >= 1) {
|
||
LableNameCode = GlobalArrDataCompiler(LableNameCode, LableNameAttrArrData, index, CodeType, LableNameAttr[0])
|
||
}
|
||
}
|
||
}
|
||
}
|
||
return LableNameCode;
|
||
}
|
||
//全局属性值
|
||
//LableNameCode-需要进行替换的某匹配标签整体内容
|
||
//LableNameAttrArrData-匹配到该标签中某个属性的所有属性内容,例如:[xxxx="kkkk",ssssss="kkkk"]
|
||
//indexAttr-当前遍历的全局属性位置
|
||
//CodeType-编译类别
|
||
//LableNameAttr-属性名
|
||
function GlobalArrDataCompiler(LableNameCode, LableNameAttrArrData, indexAttr, CodeType, LableNameAttr) {
|
||
for (let index = 0; index < LableNameAttrArrData.length; index++) {
|
||
let StrOg = LableNameAttrArrData[index];
|
||
StrOg = StrOg.replaceAll(LableNameAttr + "=", "LableNameAttr1")
|
||
StrOg = StrOg.replaceAll(LableNameAttr + " =", "LableNameAttr2")
|
||
StrOg = StrOg.replaceAll(LableNameAttr + " =", "LableNameAttr3")
|
||
StrOg = StrOg.replaceAll(LableNameAttr + " = ", "LableNameAttr4")
|
||
|
||
for (let indexAttrData = 0; indexAttrData < JSON1_All[indexAttr]["children"].length; indexAttrData++) {
|
||
let indexAttrDataArr = [];
|
||
if (CodeType == 1) {
|
||
indexAttrDataArr = [JSON1_All[indexAttr]["children"][indexAttrData]["title"], JSON1_All[indexAttr]["children"][indexAttrData]["title_en"]]
|
||
} else {
|
||
indexAttrDataArr = [JSON1_All[indexAttr]["children"][indexAttrData]["title_en"], JSON1_All[indexAttr]["children"][indexAttrData]["title"]]
|
||
}
|
||
let reg = new RegExp("[^0-9a-zA-Z\u4e00-\u9fa5_-]" + indexAttrDataArr[1] + "(?=[^0-9a-zA-Z\u4e00-\u9fa5_-])", "g");
|
||
let regCompilerCodeArr = [StrCodeUuid(indexAttrDataArr[0]), indexAttrDataArr[0]];
|
||
let StrOgArr = StrOg.match(reg);
|
||
StrOg = StrOg.replaceHack(reg, regCompilerCodeArr[0]);
|
||
if (StrOgArr != undefined && StrOgArr != null) {
|
||
if (StrOgArr.length >= 1) {
|
||
for (let index_ = 0; index_ < StrOgArr.length; index_++) {
|
||
let FirstText = StrOgArr[index_].substring(0, 1);
|
||
StrOg = StrOg.replaceHack(regCompilerCodeArr[0], FirstText + regCompilerCodeArr[1]);
|
||
}
|
||
}
|
||
}
|
||
StrOg = StrOg.replaceAll("LableNameAttr1", LableNameAttr + "=")
|
||
StrOg = StrOg.replaceAll("LableNameAttr2", LableNameAttr + " =")
|
||
LableNameCode = LableNameCode.replaceHack(LableNameAttrArrData[index], StrOg);
|
||
}
|
||
}
|
||
return LableNameCode;
|
||
}
|
||
//LableNameCode-需要进行替换的某匹配标签整体内容
|
||
//<iframe>的srcdoc属性
|
||
function Globalsrcdoc(LableNameCode, CodeType) {
|
||
let GlobalstyleArr = [];
|
||
|
||
if (CodeType == 1) {
|
||
GlobalstyleArr = TakeTheMiddleOfTheTextAll(LableNameCode, "覆盖框架内容=\"", "\" ");
|
||
} else {
|
||
GlobalstyleArr = TakeTheMiddleOfTheTextAll(LableNameCode, "srcdoc=\"", "\" ");
|
||
}
|
||
for (let index = 0; index < GlobalstyleArr.length; index++) {
|
||
let GlobalstyleArrStr = GlobalstyleArr[index];
|
||
if (CodeType == 1) {
|
||
GlobalstyleArrStr = GlobalstyleArrStr.replaceHack("覆盖框架内容=\"", "");
|
||
} else {
|
||
GlobalstyleArrStr = GlobalstyleArrStr.replaceHack("srcdoc=\"", "");
|
||
}
|
||
GlobalstyleArrStr = GlobalstyleArrStr.substring(0, GlobalstyleArrStr.length - 2);
|
||
if (GlobalstyleArrStr != undefined && GlobalstyleArrStr != null && GlobalstyleArrStr != "") {
|
||
let GlobalstyleArr2 = CodeCompilerHtmlAll(GlobalstyleArrStr, CodeType, 1);
|
||
if (GlobalstyleArr[index].indexOf(GlobalstyleArrStr) != -1) {
|
||
GlobalstyleArrStr = GlobalstyleArr[index].replaceHack(GlobalstyleArrStr, GlobalstyleArr2);
|
||
LableNameCode = LableNameCode.replaceHack(GlobalstyleArr[index], GlobalstyleArrStr);
|
||
}
|
||
}
|
||
}
|
||
if (GlobalstyleArr.length <= 0) {
|
||
if (CodeType == 1) {
|
||
GlobalstyleArr = TakeTheMiddleOfTheTextAll(LableNameCode, "覆盖框架内容='", "' ");
|
||
} else {
|
||
GlobalstyleArr = TakeTheMiddleOfTheTextAll(LableNameCode, "srcdoc='", "' ");
|
||
}
|
||
for (let index = 0; index < GlobalstyleArr.length; index++) {
|
||
let GlobalstyleArrStr = GlobalstyleArr[index];
|
||
if (CodeType == 1) {
|
||
GlobalstyleArrStr = GlobalstyleArrStr.replaceHack("覆盖框架内容='", "");
|
||
} else {
|
||
GlobalstyleArrStr = GlobalstyleArrStr.replaceHack("srcdoc='", "");
|
||
}
|
||
GlobalstyleArrStr = GlobalstyleArrStr.substring(0, GlobalstyleArrStr.length - 2);
|
||
if (GlobalstyleArrStr != undefined && GlobalstyleArrStr != null && GlobalstyleArrStr != "") {
|
||
let GlobalstyleArr2 = CodeCompilerHtmlAll(GlobalstyleArrStr, CodeType, 1);
|
||
if (GlobalstyleArr[index].indexOf(GlobalstyleArrStr) != -1) {
|
||
GlobalstyleArrStr = GlobalstyleArr[index].replaceHack(GlobalstyleArrStr, GlobalstyleArr2);
|
||
LableNameCode = LableNameCode.replaceHack(GlobalstyleArr[index], GlobalstyleArrStr);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
if (GlobalstyleArr.length <= 0) {
|
||
if (CodeType == 1) {
|
||
GlobalstyleArr = TakeTheMiddleOfTheTextAll(LableNameCode, "覆盖框架内容=\"", "\">");
|
||
} else {
|
||
GlobalstyleArr = TakeTheMiddleOfTheTextAll(LableNameCode, "srcdoc=\"", "\">");
|
||
}
|
||
for (let index = 0; index < GlobalstyleArr.length; index++) {
|
||
let GlobalstyleArrStr = GlobalstyleArr[index];
|
||
if (CodeType == 1) {
|
||
GlobalstyleArrStr = GlobalstyleArrStr.replaceHack("覆盖框架内容=\"", "");
|
||
} else {
|
||
GlobalstyleArrStr = GlobalstyleArrStr.replaceHack("srcdoc=\"", "");
|
||
}
|
||
GlobalstyleArrStr = GlobalstyleArrStr.substring(0, GlobalstyleArrStr.length - 2);
|
||
if (GlobalstyleArrStr != undefined && GlobalstyleArrStr != null && GlobalstyleArrStr != "") {
|
||
let GlobalstyleArr2 = CodeCompilerHtmlAll(GlobalstyleArrStr, CodeType, 1);
|
||
if (GlobalstyleArr[index].indexOf(GlobalstyleArrStr) != -1) {
|
||
GlobalstyleArrStr = GlobalstyleArr[index].replaceHack(GlobalstyleArrStr, GlobalstyleArr2);
|
||
LableNameCode = LableNameCode.replaceHack(GlobalstyleArr[index], GlobalstyleArrStr);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
if (GlobalstyleArr.length <= 0) {
|
||
if (CodeType == 1) {
|
||
GlobalstyleArr = TakeTheMiddleOfTheTextAll(LableNameCode, "覆盖框架内容=\"", "\"/");
|
||
} else {
|
||
GlobalstyleArr = TakeTheMiddleOfTheTextAll(LableNameCode, "srcdoc=\"", "\"/");
|
||
}
|
||
for (let index = 0; index < GlobalstyleArr.length; index++) {
|
||
let GlobalstyleArrStr = GlobalstyleArr[index];
|
||
if (CodeType == 1) {
|
||
GlobalstyleArrStr = GlobalstyleArrStr.replaceHack("覆盖框架内容=\"", "");
|
||
} else {
|
||
GlobalstyleArrStr = GlobalstyleArrStr.replaceHack("srcdoc=\"", "");
|
||
}
|
||
GlobalstyleArrStr = GlobalstyleArrStr.substring(0, GlobalstyleArrStr.length - 2);
|
||
if (GlobalstyleArrStr != undefined && GlobalstyleArrStr != null && GlobalstyleArrStr != "") {
|
||
let GlobalstyleArr2 = CodeCompilerHtmlAll(GlobalstyleArrStr, CodeType, 1);
|
||
if (GlobalstyleArr[index].indexOf(GlobalstyleArrStr) != -1) {
|
||
GlobalstyleArrStr = GlobalstyleArr[index].replaceHack(GlobalstyleArrStr, GlobalstyleArr2);
|
||
LableNameCode = LableNameCode.replaceHack(GlobalstyleArr[index], GlobalstyleArrStr);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
if (GlobalstyleArr.length <= 0) {
|
||
if (CodeType == 1) {
|
||
GlobalstyleArr = TakeTheMiddleOfTheTextAll(LableNameCode, "覆盖框架内容='", "'>");
|
||
} else {
|
||
GlobalstyleArr = TakeTheMiddleOfTheTextAll(LableNameCode, "srcdoc='", "'>");
|
||
}
|
||
for (let index = 0; index < GlobalstyleArr.length; index++) {
|
||
let GlobalstyleArrStr = GlobalstyleArr[index];
|
||
if (CodeType == 1) {
|
||
GlobalstyleArrStr = GlobalstyleArrStr.replaceHack("覆盖框架内容='", "");
|
||
} else {
|
||
GlobalstyleArrStr = GlobalstyleArrStr.replaceHack("srcdoc='", "");
|
||
}
|
||
GlobalstyleArrStr = GlobalstyleArrStr.substring(0, GlobalstyleArrStr.length - 2);
|
||
if (GlobalstyleArrStr != undefined && GlobalstyleArrStr != null && GlobalstyleArrStr != "") {
|
||
let GlobalstyleArr2 = CodeCompilerHtmlAll(GlobalstyleArrStr, CodeType, 1);
|
||
if (GlobalstyleArr[index].indexOf(GlobalstyleArrStr) != -1) {
|
||
GlobalstyleArrStr = GlobalstyleArr[index].replaceHack(GlobalstyleArrStr, GlobalstyleArr2);
|
||
LableNameCode = LableNameCode.replaceHack(GlobalstyleArr[index], GlobalstyleArrStr);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
if (GlobalstyleArr.length <= 0) {
|
||
if (CodeType == 1) {
|
||
GlobalstyleArr = TakeTheMiddleOfTheTextAll(LableNameCode, "覆盖框架内容='", "'/");
|
||
} else {
|
||
GlobalstyleArr = TakeTheMiddleOfTheTextAll(LableNameCode, "srcdoc='", "'/");
|
||
}
|
||
for (let index = 0; index < GlobalstyleArr.length; index++) {
|
||
let GlobalstyleArrStr = GlobalstyleArr[index];
|
||
if (CodeType == 1) {
|
||
GlobalstyleArrStr = GlobalstyleArrStr.replaceHack("覆盖框架内容='", "");
|
||
} else {
|
||
GlobalstyleArrStr = GlobalstyleArrStr.replaceHack("srcdoc='", "");
|
||
}
|
||
GlobalstyleArrStr = GlobalstyleArrStr.substring(0, GlobalstyleArrStr.length - 2);
|
||
if (GlobalstyleArrStr != undefined && GlobalstyleArrStr != null && GlobalstyleArrStr != "") {
|
||
let GlobalstyleArr2 = CodeCompilerHtmlAll(GlobalstyleArrStr, CodeType, 1);
|
||
if (GlobalstyleArr[index].indexOf(GlobalstyleArrStr) != -1) {
|
||
GlobalstyleArrStr = GlobalstyleArr[index].replaceHack(GlobalstyleArrStr, GlobalstyleArr2);
|
||
LableNameCode = LableNameCode.replaceHack(GlobalstyleArr[index], GlobalstyleArrStr);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
return LableNameCode;
|
||
}
|
||
|
||
//三方库的自定义属性编译
|
||
function UserAttributes(LableNameCode, CodeType) {
|
||
try {
|
||
for (let index = 0; index < window.RenderingJsonArr.length; index++) {
|
||
if (window.RenderingJsonArr[index]["htmlattr"].length >= 1) {
|
||
for (let index1 = 0; index1 < window.RenderingJsonArr[index]["htmlattr"].length; index1++) {
|
||
let LableNameAttr = [];
|
||
if (CodeType == 1) {
|
||
LableNameAttr = [window.RenderingJsonArr[index]["htmlattr"][index1]["nameZh"], window.RenderingJsonArr[index]["htmlattr"][index1]["nameEn"]]
|
||
} else {
|
||
LableNameAttr = [window.RenderingJsonArr[index]["htmlattr"][index1]["nameEn"], window.RenderingJsonArr[index]["htmlattr"][index1]["nameZh"]]
|
||
}
|
||
if (LableNameCode.indexOf(LableNameAttr[0]) != -1 || LableNameCode.indexOf(LableNameAttr[1]) != -1) {
|
||
if (LableNameCode.indexOf("'" + LableNameAttr[1] + "=") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack("'" + LableNameAttr[1] + "=", "'" + LableNameAttr[0] + "=");
|
||
}
|
||
if (LableNameCode.indexOf("\"" + LableNameAttr[1] + "=") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack("\"" + LableNameAttr[1] + "=", "\"" + LableNameAttr[0] + "=");
|
||
}
|
||
if (LableNameCode.indexOf(" " + LableNameAttr[1] + "=") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack(" " + LableNameAttr[1] + "=", " " + LableNameAttr[0] + "=");
|
||
}
|
||
if (LableNameCode.indexOf(":" + LableNameAttr[1] + "=") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack(":" + LableNameAttr[1] + "=", ":" + LableNameAttr[0] + "=");
|
||
}
|
||
if (LableNameCode.indexOf("'" + LableNameAttr[1] + " =") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack("'" + LableNameAttr[1] + " =", "'" + LableNameAttr[0] + " =");
|
||
}
|
||
if (LableNameCode.indexOf("\"" + LableNameAttr[1] + " =") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack("\"" + LableNameAttr[1] + " =", "\"" + LableNameAttr[0] + " =");
|
||
}
|
||
if (LableNameCode.indexOf(" " + LableNameAttr[1] + " =") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack(" " + LableNameAttr[1] + " =", " " + LableNameAttr[0] + " =");
|
||
}
|
||
if (LableNameCode.indexOf(":" + LableNameAttr[1] + " =") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack(":" + LableNameAttr[1] + " =", ":" + LableNameAttr[0] + " =");
|
||
}
|
||
if (LableNameCode.indexOf("'" + LableNameAttr[1] + " =") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack("'" + LableNameAttr[1] + " =", "'" + LableNameAttr[0] + " =");
|
||
}
|
||
if (LableNameCode.indexOf("\"" + LableNameAttr[1] + " =") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack("\"" + LableNameAttr[1] + " =", "\"" + LableNameAttr[0] + " =");
|
||
}
|
||
if (LableNameCode.indexOf(" " + LableNameAttr[1] + " =") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack(" " + LableNameAttr[1] + " =", " " + LableNameAttr[0] + " =");
|
||
}
|
||
if (LableNameCode.indexOf(":" + LableNameAttr[1] + " =") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack(":" + LableNameAttr[1] + " =", ":" + LableNameAttr[0] + " =");
|
||
}
|
||
if (LableNameCode.indexOf(" " + LableNameAttr[1] + " ") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack(" " + LableNameAttr[1] + " ", " " + LableNameAttr[0] + " ");
|
||
}
|
||
if (LableNameCode.indexOf(" " + LableNameAttr[1] + ">") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack(" " + LableNameAttr[1] + ">", " " + LableNameAttr[0] + ">");
|
||
}
|
||
if (LableNameCode.indexOf(":" + LableNameAttr[1] + ">") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack(":" + LableNameAttr[1] + ">", ":" + LableNameAttr[0] + ">");
|
||
}
|
||
if (LableNameCode.indexOf("'" + LableNameAttr[1] + ":") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack("'" + LableNameAttr[1] + ":", "'" + LableNameAttr[0] + ":");
|
||
}
|
||
if (LableNameCode.indexOf("\"" + LableNameAttr[1] + ":") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack("\"" + LableNameAttr[1] + ":", "\"" + LableNameAttr[0] + ":");
|
||
}
|
||
if (LableNameCode.indexOf(" " + LableNameAttr[1] + ":") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack(" " + LableNameAttr[1] + ":", " " + LableNameAttr[0] + ":");
|
||
}
|
||
if (LableNameCode.indexOf(":" + LableNameAttr[1] + ":") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack(":" + LableNameAttr[1] + ":", ":" + LableNameAttr[0] + ":");
|
||
}
|
||
if (LableNameCode.indexOf("'" + LableNameAttr[1] + " :") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack("'" + LableNameAttr[1] + " :", "'" + LableNameAttr[0] + " :");
|
||
}
|
||
if (LableNameCode.indexOf("\"" + LableNameAttr[1] + " :") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack("\"" + LableNameAttr[1] + " :", "\"" + LableNameAttr[0] + " :");
|
||
}
|
||
if (LableNameCode.indexOf(" " + LableNameAttr[1] + " :") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack(" " + LableNameAttr[1] + " :", " " + LableNameAttr[0] + " :");
|
||
}
|
||
if (LableNameCode.indexOf(":" + LableNameAttr[1] + " :") != -1) {
|
||
LableNameCode = LableNameCode.replaceHack(":" + LableNameAttr[1] + " :", ":" + LableNameAttr[0] + " :");
|
||
}
|
||
|
||
let LableNameAttrArrData = []
|
||
if (LableNameCode.indexOf(LableNameAttr[0] + "=\"") != -1) {
|
||
LableNameAttrArrData = TakeTheMiddleOfTheTextAll(LableNameCode, LableNameAttr[0] + "=\"", "\"");
|
||
if (LableNameAttrArrData.length >= 1) {
|
||
LableNameCode = UserArrDataCompiler(LableNameCode, LableNameAttrArrData, index1, CodeType, LableNameAttr[0])
|
||
}
|
||
}
|
||
if (LableNameCode.indexOf(LableNameAttr[0] + "='") != -1) {
|
||
LableNameAttrArrData = TakeTheMiddleOfTheTextAll(LableNameCode, LableNameAttr[0] + "='", "'");
|
||
if (LableNameAttrArrData.length >= 1) {
|
||
LableNameCode = UserArrDataCompiler(LableNameCode, LableNameAttrArrData, index1, CodeType, LableNameAttr[0])
|
||
}
|
||
}
|
||
if (LableNameCode.indexOf(LableNameAttr[0] + " =\"") != -1) {
|
||
LableNameAttrArrData = TakeTheMiddleOfTheTextAll(LableNameCode, LableNameAttr[0] + " =\"", "\"");
|
||
if (LableNameAttrArrData.length >= 1) {
|
||
LableNameCode = UserArrDataCompiler(LableNameCode, LableNameAttrArrData, index1, CodeType, LableNameAttr[0])
|
||
}
|
||
}
|
||
if (LableNameCode.indexOf(LableNameAttr[0] + " ='") != -1) {
|
||
LableNameAttrArrData = TakeTheMiddleOfTheTextAll(LableNameCode, LableNameAttr[0] + " ='", "'");
|
||
if (LableNameAttrArrData.length >= 1) {
|
||
LableNameCode = UserArrDataCompiler(LableNameCode, LableNameAttrArrData, index1, CodeType, LableNameAttr[0])
|
||
}
|
||
}
|
||
if (LableNameCode.indexOf(LableNameAttr[0] + " = \"") != -1) {
|
||
LableNameAttrArrData = TakeTheMiddleOfTheTextAll(LableNameCode, LableNameAttr[0] + " = \"", "\"");
|
||
if (LableNameAttrArrData.length >= 1) {
|
||
LableNameCode = UserArrDataCompiler(LableNameCode, LableNameAttrArrData, index1, CodeType, LableNameAttr[0])
|
||
}
|
||
}
|
||
if (LableNameCode.indexOf(LableNameAttr[0] + " = '") != -1) {
|
||
LableNameAttrArrData = TakeTheMiddleOfTheTextAll(LableNameCode, LableNameAttr[0] + " = '", "'");
|
||
if (LableNameAttrArrData.length >= 1) {
|
||
LableNameCode = UserArrDataCompiler(LableNameCode, LableNameAttrArrData, index1, CodeType, LableNameAttr[0])
|
||
}
|
||
}
|
||
if (LableNameCode.indexOf(LableNameAttr[0] + " = \"") != -1) {
|
||
LableNameAttrArrData = TakeTheMiddleOfTheTextAll(LableNameCode, LableNameAttr[0] + " = \"", "\"");
|
||
if (LableNameAttrArrData.length >= 1) {
|
||
LableNameCode = UserArrDataCompiler(LableNameCode, LableNameAttrArrData, index1, CodeType, LableNameAttr[0])
|
||
}
|
||
}
|
||
if (LableNameCode.indexOf(LableNameAttr[0] + " = '") != -1) {
|
||
LableNameAttrArrData = TakeTheMiddleOfTheTextAll(LableNameCode, LableNameAttr[0] + " = '", "'");
|
||
if (LableNameAttrArrData.length >= 1) {
|
||
LableNameCode = UserArrDataCompiler(LableNameCode, LableNameAttrArrData, index1, CodeType, LableNameAttr[0])
|
||
}
|
||
}
|
||
if (LableNameCode.indexOf(LableNameAttr[0] + " =\"") != -1) {
|
||
LableNameAttrArrData = TakeTheMiddleOfTheTextAll(LableNameCode, LableNameAttr[0] + " =\"", "\"");
|
||
if (LableNameAttrArrData.length >= 1) {
|
||
LableNameCode = UserArrDataCompiler(LableNameCode, LableNameAttrArrData, index1, CodeType, LableNameAttr[0])
|
||
}
|
||
}
|
||
if (LableNameCode.indexOf(LableNameAttr[0] + " ='") != -1) {
|
||
LableNameAttrArrData = TakeTheMiddleOfTheTextAll(LableNameCode, LableNameAttr[0] + " ='", "'");
|
||
if (LableNameAttrArrData.length >= 1) {
|
||
LableNameCode = UserArrDataCompiler(LableNameCode, LableNameAttrArrData, index1, CodeType, LableNameAttr[0])
|
||
}
|
||
}
|
||
if (LableNameCode.indexOf(LableNameAttr[0] + ":='") != -1) {
|
||
LableNameAttrArrData = TakeTheMiddleOfTheTextAll(LableNameCode, LableNameAttr[0] + ":='", "'");
|
||
if (LableNameAttrArrData.length >= 1) {
|
||
LableNameCode = UserArrDataCompiler(LableNameCode, LableNameAttrArrData, index1, CodeType, LableNameAttr[0])
|
||
}
|
||
}
|
||
if (LableNameCode.indexOf(LableNameAttr[0] + ":=\"") != -1) {
|
||
LableNameAttrArrData = TakeTheMiddleOfTheTextAll(LableNameCode, LableNameAttr[0] + ":=\"", "\"");
|
||
if (LableNameAttrArrData.length >= 1) {
|
||
LableNameCode = UserArrDataCompiler(LableNameCode, LableNameAttrArrData, index1, CodeType, LableNameAttr[0])
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
} catch (error) {
|
||
|
||
}
|
||
|
||
return LableNameCode;
|
||
}
|
||
//三方库的自定义属性值编译
|
||
//LableNameCode-需要进行替换的某匹配标签整体内容
|
||
//LableNameAttrArrData-匹配到该标签中某个属性的所有属性内容,例如:[xxxx="kkkk",ssssss="kkkk"]
|
||
//indexAttr-当前遍历的三方属性位置
|
||
//CodeType-编译类别
|
||
//LableNameAttr-属性名
|
||
function UserArrDataCompiler(LableNameCode, LableNameAttrArrData, indexAttr, CodeType, LableNameAttr) {
|
||
for (let index = 0; index < LableNameAttrArrData.length; index++) {
|
||
let StrOg = LableNameAttrArrData[index];
|
||
StrOg = StrOg.replaceAll(LableNameAttr + "=", "LableNameAttr1")
|
||
StrOg = StrOg.replaceAll(LableNameAttr + " =", "LableNameAttr2")
|
||
StrOg = StrOg.replaceAll(LableNameAttr + " =", "LableNameAttr3")
|
||
StrOg = StrOg.replaceAll(LableNameAttr + " = ", "LableNameAttr4")
|
||
|
||
for (let indexAttrData = 0; indexAttrData < window.RenderingJsonArr[index]["htmlattr"][indexAttr]["list"].length; indexAttrData++) {
|
||
let indexAttrDataArr = [];
|
||
if (CodeType == 1) {
|
||
indexAttrDataArr = [window.RenderingJsonArr[index]["htmlattr"][indexAttr]["list"][indexAttrData]["nameZh"], window.RenderingJsonArr[index]["htmlattr"][indexAttr]["list"][indexAttrData]["nameEn"]]
|
||
} else {
|
||
indexAttrDataArr = [window.RenderingJsonArr[index]["htmlattr"][indexAttr]["list"][indexAttrData]["nameEn"], window.RenderingJsonArr[index]["htmlattr"][indexAttr]["list"][indexAttrData]["nameZh"]]
|
||
}
|
||
let reg = new RegExp("[^0-9a-zA-Z\u4e00-\u9fa5_-]" + indexAttrDataArr[1] + "(?=[^0-9a-zA-Z\u4e00-\u9fa5_-])", "g");
|
||
let regCompilerCodeArr = [StrCodeUuid(indexAttrDataArr[0]), indexAttrDataArr[0]];
|
||
let StrOgArr = StrOg.match(reg);
|
||
StrOg = StrOg.replaceHack(reg, regCompilerCodeArr[0]);
|
||
if (StrOgArr != undefined && StrOgArr != null) {
|
||
if (StrOgArr.length >= 1) {
|
||
for (let index_ = 0; index_ < StrOgArr.length; index_++) {
|
||
let FirstText = StrOgArr[index_].substring(0, 1);
|
||
StrOg = StrOg.replaceHack(regCompilerCodeArr[0], FirstText + regCompilerCodeArr[1]);
|
||
}
|
||
}
|
||
}
|
||
StrOg = StrOg.replaceAll("LableNameAttr1", LableNameAttr + "=")
|
||
StrOg = StrOg.replaceAll("LableNameAttr2", LableNameAttr + " =")
|
||
LableNameCode = LableNameCode.replaceHack(LableNameAttrArrData[index], StrOg);
|
||
}
|
||
}
|
||
return LableNameCode;
|
||
}
|
||
//class的值编译,三方模块的自定义类名编译
|
||
function UserClassData(LableNameCode, CodeType) {
|
||
try {
|
||
for (let index = 0; index < window.RenderingJsonArr.length; index++) {
|
||
if (window.RenderingJsonArr[index]["class"].length >= 1) {
|
||
for (let index1 = 0; index1 < window.RenderingJsonArr[index]["class"].length; index1++) {
|
||
let ClassName = [];
|
||
if (CodeType == 1) {
|
||
ClassName = [window.RenderingJsonArr[index]["class"][index1]["nameZh"], window.RenderingJsonArr[index]["class"][index1]["nameEn"]]
|
||
} else {
|
||
ClassName = [window.RenderingJsonArr[index]["class"][index1]["nameEn"], window.RenderingJsonArr[index]["class"][index1]["nameZh"]]
|
||
}
|
||
if (LableNameCode.indexOf(ClassName[1]) != -1) {
|
||
let LableNameCodeStr = "---------- " + LableNameCode + " ----------";
|
||
let ClassOriginal = LableNameCodeStr;
|
||
let regCompilerCodeArr = [StrCodeUuid(ClassName[0]), ClassName[0]];
|
||
let reg = new RegExp("[^0-9a-zA-Z\u4e00-\u9fa5_-]" + ClassName[1] + "(?=[^0-9a-zA-Z\u4e00-\u9fa5_-])", "g");
|
||
if (ClassOriginal.indexOf(ClassName[1]) != -1) {
|
||
let ClassStrArr = ClassOriginal.match(reg);
|
||
if (ClassStrArr != undefined && ClassStrArr != null) {
|
||
if (ClassStrArr.length >= 1) {
|
||
LableNameCodeStr = LableNameCodeStr.replaceHack(reg, regCompilerCodeArr[0]);
|
||
for (let index = 0; index < ClassStrArr.length; index++) {
|
||
let FirstText = ClassStrArr[index].substring(0, 1);
|
||
LableNameCodeStr = LableNameCodeStr.replaceHack(regCompilerCodeArr[0], FirstText + regCompilerCodeArr[1]);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
if (LableNameCodeStr.indexOf("---------- ") != -1) {
|
||
LableNameCodeStr = LableNameCodeStr.replaceAll("---------- ", "");
|
||
}
|
||
if (LableNameCodeStr.indexOf(" ----------") != -1) {
|
||
LableNameCodeStr = LableNameCodeStr.replaceAll(" ----------", "");
|
||
}
|
||
LableNameCode = LableNameCodeStr
|
||
}
|
||
}
|
||
}
|
||
}
|
||
} catch (error) {
|
||
|
||
}
|
||
return LableNameCode;
|
||
} |