isdata-customer-sdk 0.2.9 → 0.2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.common.js +290 -30
- package/dist/index.common.js.map +1 -1
- package/dist/index.umd.js +290 -30
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +3 -3
- package/dist/index.umd.min.js.map +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -33123,7 +33123,7 @@ const check = element => {
|
|
|
33123
33123
|
if (classes.contains("ant-table-cell")) {
|
|
33124
33124
|
let innerHTML = element.innerHTML;
|
|
33125
33125
|
if (innerHTML.includes("序号") || innerHTML.includes("Serial No.")) {
|
|
33126
|
-
console.log("检查smardaten平台表格 序号 元素:",
|
|
33126
|
+
// console.log("检查smardaten平台表格 序号 元素:",innerHTML);
|
|
33127
33127
|
let tempHTMLMatch = {
|
|
33128
33128
|
oldValue: '$L{序号}'
|
|
33129
33129
|
};
|
|
@@ -33132,7 +33132,7 @@ const check = element => {
|
|
|
33132
33132
|
return checkResult;
|
|
33133
33133
|
}
|
|
33134
33134
|
if (innerHTML.includes("操作")) {
|
|
33135
|
-
console.log("检查smardaten平台表格 操作 元素:",
|
|
33135
|
+
// console.log("检查smardaten平台表格 操作 元素:",innerHTML);
|
|
33136
33136
|
let tempHTMLMatch = {
|
|
33137
33137
|
oldValue: '$L{操作}'
|
|
33138
33138
|
};
|
|
@@ -33145,7 +33145,7 @@ const check = element => {
|
|
|
33145
33145
|
if (classes.contains("export_menu")) {
|
|
33146
33146
|
let innerHTML = element.innerHTML;
|
|
33147
33147
|
if (innerHTML.includes("导出进度") || innerHTML.includes("Export progress")) {
|
|
33148
|
-
console.log("检查smardaten平台表格 导出按钮 元素:",
|
|
33148
|
+
// console.log("检查smardaten平台表格 导出按钮 元素:",innerHTML);
|
|
33149
33149
|
let tempHTMLMatch = {
|
|
33150
33150
|
oldValue: '$L{导出进度}'
|
|
33151
33151
|
};
|
|
@@ -33279,7 +33279,7 @@ const check = element => {
|
|
|
33279
33279
|
if (classes.contains("ant-popover-message-title")) {
|
|
33280
33280
|
let innerHTML = element.innerHTML;
|
|
33281
33281
|
if (innerHTML.includes("确认执行:") || innerHTML.includes("Confirm Execution:")) {
|
|
33282
|
-
console.log("检查smardaten平台删除提问对话框:",
|
|
33282
|
+
// console.log("检查smardaten平台删除提问对话框:",innerHTML);
|
|
33283
33283
|
let tempHTMLMatch = {
|
|
33284
33284
|
oldValue: '$L{操作确认:删除?}'
|
|
33285
33285
|
};
|
|
@@ -33292,7 +33292,7 @@ const check = element => {
|
|
|
33292
33292
|
if (classes.contains("ant-btn-sm")) {
|
|
33293
33293
|
let innerHTML = element.innerHTML;
|
|
33294
33294
|
if (innerHTML.includes("Cancel") || innerHTML.includes("取消")) {
|
|
33295
|
-
console.log("检查smardaten平台 Tip提问取消删除按钮:",
|
|
33295
|
+
// console.log("检查smardaten平台 Tip提问取消删除按钮:",innerHTML);
|
|
33296
33296
|
let tempHTMLMatch = {
|
|
33297
33297
|
oldValue: '$L{取消}'
|
|
33298
33298
|
};
|
|
@@ -33301,7 +33301,7 @@ const check = element => {
|
|
|
33301
33301
|
return checkResult;
|
|
33302
33302
|
}
|
|
33303
33303
|
if (innerHTML.includes("确定") || innerHTML.includes("OK")) {
|
|
33304
|
-
console.log("检查smardaten平台 Tip提问确认删除按钮:",
|
|
33304
|
+
// console.log("检查smardaten平台 Tip提问确认删除按钮:",innerHTML);
|
|
33305
33305
|
let tempHTMLMatch = {
|
|
33306
33306
|
oldValue: '$L{确定}'
|
|
33307
33307
|
};
|
|
@@ -33361,15 +33361,21 @@ const catalog_i18n_check = element => {
|
|
|
33361
33361
|
;// ./src/api/i18n/commom_i18n/common_i18n.js
|
|
33362
33362
|
|
|
33363
33363
|
|
|
33364
|
-
|
|
33365
|
-
|
|
33364
|
+
function getOldValueNodeText(innerHTML, index) {
|
|
33365
|
+
const container = document.createElement('div');
|
|
33366
|
+
container.innerHTML = innerHTML;
|
|
33367
|
+
const childNode = container.childNodes[index];
|
|
33368
|
+
return childNode.textContent;
|
|
33369
|
+
}
|
|
33366
33370
|
const common_i18n_check = element => {
|
|
33367
33371
|
const checkResult = {
|
|
33368
33372
|
result: false,
|
|
33369
33373
|
innerHTMLMatch: null
|
|
33370
33374
|
};
|
|
33371
33375
|
// 检查目录列表 名称 列
|
|
33372
|
-
if (element.tagName === 'BUTTON') {
|
|
33376
|
+
if (element.tagName === 'BUTTON' || element.tagName === 'P') {
|
|
33377
|
+
//TODO:先检查新的是否需要解析,新的不需要有可能是解析后的再次判断,如果有历史解析值,则解析
|
|
33378
|
+
//如果新的需要解析,更新缓存的历史解析值
|
|
33373
33379
|
let innerHTML = element.innerHTML;
|
|
33374
33380
|
let oldValue = element.getAttribute("oldValue");
|
|
33375
33381
|
if (!oldValue) {
|
|
@@ -33381,25 +33387,36 @@ const common_i18n_check = element => {
|
|
|
33381
33387
|
// console.log("检查结果:",firstCheckResult);
|
|
33382
33388
|
let scriptFunction = (appID, lang) => {
|
|
33383
33389
|
let elementsArray = [];
|
|
33384
|
-
element.childNodes.
|
|
33385
|
-
let scriptNodeItem =
|
|
33390
|
+
for (let i = 0; i < element.childNodes.length; i++) {
|
|
33391
|
+
let scriptNodeItem = element.childNodes[i];
|
|
33386
33392
|
if (scriptNodeItem.nodeType === Node.TEXT_NODE) {
|
|
33387
|
-
let
|
|
33388
|
-
console.log("执行 button 文本节点翻译:", text);
|
|
33389
|
-
|
|
33393
|
+
let oldValue = element.getAttribute("oldValue");
|
|
33394
|
+
// console.log("执行 button 文本节点翻译:", text);
|
|
33395
|
+
// 创建正则表达式匹配所有 $L{...} 格式
|
|
33396
|
+
const regex = /\$L\{([^}]+)\}/g;
|
|
33397
|
+
let isTextMatch = checkTextFormat(oldValue);
|
|
33390
33398
|
if (!isTextMatch) {
|
|
33391
33399
|
elementsArray.push(scriptNodeItem);
|
|
33392
33400
|
} else {
|
|
33393
|
-
console.log("执行 button 脚本节点翻译isTextMatch:", isTextMatch
|
|
33401
|
+
// console.log("执行 button 脚本节点翻译isTextMatch:", isTextMatch?true:false);
|
|
33394
33402
|
// element.removeChild(scriptNodeItem);
|
|
33395
|
-
|
|
33396
|
-
let
|
|
33403
|
+
// 替换所有 $L{...} 占位符为翻译文本
|
|
33404
|
+
let childNodeText = getOldValueNodeText(oldValue, i);
|
|
33405
|
+
let newValue = childNodeText;
|
|
33406
|
+
let match;
|
|
33407
|
+
while ((match = regex.exec(oldValue)) !== null) {
|
|
33408
|
+
const fullMatch = match[0];
|
|
33409
|
+
const placeholderKey = match[1];
|
|
33410
|
+
const translation = i18n(placeholderKey, appID, lang);
|
|
33411
|
+
newValue = newValue.replace(fullMatch, translation);
|
|
33412
|
+
}
|
|
33413
|
+
let textNode = document.createTextNode(newValue);
|
|
33397
33414
|
elementsArray.push(textNode);
|
|
33398
33415
|
}
|
|
33399
33416
|
} else {
|
|
33400
33417
|
elementsArray.push(scriptNodeItem);
|
|
33401
33418
|
}
|
|
33402
|
-
}
|
|
33419
|
+
}
|
|
33403
33420
|
element.innerHTML = '';
|
|
33404
33421
|
elementsArray.forEach(el => {
|
|
33405
33422
|
element.appendChild(el);
|
|
@@ -33464,6 +33481,56 @@ const attribute_i18n_check = element => {
|
|
|
33464
33481
|
;// ./src/api/i18n/smardaten_i18n/calendar_i18n.js
|
|
33465
33482
|
|
|
33466
33483
|
|
|
33484
|
+
function convertToChineseWeekday(englishInput) {
|
|
33485
|
+
// 清理输入:去除首尾空格并转为小写
|
|
33486
|
+
const input = englishInput.trim().toLowerCase();
|
|
33487
|
+
|
|
33488
|
+
// 定义星期映射关系
|
|
33489
|
+
const weekdayMap = {
|
|
33490
|
+
'mon': '周一',
|
|
33491
|
+
'monday': '周一',
|
|
33492
|
+
'mondays': '周一',
|
|
33493
|
+
'tue': '周二',
|
|
33494
|
+
'tues': '周二',
|
|
33495
|
+
'tuesday': '周二',
|
|
33496
|
+
'tuesdays': '周二',
|
|
33497
|
+
'wed': '周三',
|
|
33498
|
+
'wednesday': '周三',
|
|
33499
|
+
'wednesdays': '周三',
|
|
33500
|
+
'thu': '周四',
|
|
33501
|
+
'thur': '周四',
|
|
33502
|
+
'thurs': '周四',
|
|
33503
|
+
'thursday': '周四',
|
|
33504
|
+
'thursdays': '周四',
|
|
33505
|
+
'fri': '周五',
|
|
33506
|
+
'friday': '周五',
|
|
33507
|
+
'fridays': '周五',
|
|
33508
|
+
'sat': '周六',
|
|
33509
|
+
'saturday': '周六',
|
|
33510
|
+
'saturdays': '周六',
|
|
33511
|
+
'sun': '周日',
|
|
33512
|
+
'sunday': '周日',
|
|
33513
|
+
'sundays': '周日'
|
|
33514
|
+
};
|
|
33515
|
+
|
|
33516
|
+
// 使用正则表达式匹配所有可能的星期格式
|
|
33517
|
+
const pattern = /^(mon(day)?s?\.?|tue(sday)?s?\.?|wed(nesday)?s?\.?|thu(r(sday)?)?s?\.?|fri(day)?s?\.?|sat(urday)?s?\.?|sun(day)?s?\.?)$/i;
|
|
33518
|
+
|
|
33519
|
+
// 测试输入是否匹配星期格式
|
|
33520
|
+
if (!pattern.test(input)) {
|
|
33521
|
+
return '未知日期';
|
|
33522
|
+
}
|
|
33523
|
+
|
|
33524
|
+
// 提取基础名称(去除复数形式和句点)
|
|
33525
|
+
const baseName = input.replace(/\./g, '') // 移除所有句点
|
|
33526
|
+
.replace(/s$/, ''); // 移除结尾的's'(复数形式)
|
|
33527
|
+
|
|
33528
|
+
// 特殊处理周四的多种缩写形式
|
|
33529
|
+
const normalized = baseName.startsWith('thu') ? 'thu' : baseName.slice(0, 3);
|
|
33530
|
+
|
|
33531
|
+
// 映射到中文名称
|
|
33532
|
+
return weekdayMap[normalized] || weekdayMap[baseName] || '未知日期';
|
|
33533
|
+
}
|
|
33467
33534
|
function extractYearMonth(str) {
|
|
33468
33535
|
const regex = /(\d{4})年(0?[1-9]|1[0-2])月/g;
|
|
33469
33536
|
const matches = str.matchAll(regex);
|
|
@@ -33478,6 +33545,53 @@ function extractYearMonth(str) {
|
|
|
33478
33545
|
}
|
|
33479
33546
|
return result;
|
|
33480
33547
|
}
|
|
33548
|
+
function extractDayNumbers(text) {
|
|
33549
|
+
// 匹配两种情况:
|
|
33550
|
+
// 1. "数字+日"格式(如"5日"、"12日")
|
|
33551
|
+
// 2. 独立的1-31数字(前后有边界)
|
|
33552
|
+
const regex = /(?:(\b(0?[1-9]|[12]\d|3[01])\b)(?=日))|(\b(0?[1-9]|[12]\d|3[01])\b)/g;
|
|
33553
|
+
const results = [];
|
|
33554
|
+
let match;
|
|
33555
|
+
while ((match = regex.exec(text)) !== null) {
|
|
33556
|
+
// match[2] 对应第一种情况(带"日"字的数字)
|
|
33557
|
+
// match[4] 对应第二种情况(独立数字)
|
|
33558
|
+
const numStr = match[2] || match[4];
|
|
33559
|
+
if (numStr) {
|
|
33560
|
+
// 转换为整数并验证范围
|
|
33561
|
+
const day = parseInt(numStr, 10);
|
|
33562
|
+
if (day >= 1 && day <= 31) {
|
|
33563
|
+
results.push(day);
|
|
33564
|
+
}
|
|
33565
|
+
}
|
|
33566
|
+
}
|
|
33567
|
+
return results;
|
|
33568
|
+
}
|
|
33569
|
+
function extractNumbersFromScenarios(text) {
|
|
33570
|
+
// 定义两种场景的正则表达式
|
|
33571
|
+
const patterns = [
|
|
33572
|
+
// 场景1: "Other X pieces of data"
|
|
33573
|
+
/Other\s+(\d+)\s+pieces of data/gi,
|
|
33574
|
+
// 场景2: "其他 X 条记录"
|
|
33575
|
+
/其他\s+(\d+)\s+条记录/g];
|
|
33576
|
+
const results = [];
|
|
33577
|
+
|
|
33578
|
+
// 遍历所有模式进行匹配
|
|
33579
|
+
patterns.forEach(pattern => {
|
|
33580
|
+
let match;
|
|
33581
|
+
while ((match = pattern.exec(text)) !== null) {
|
|
33582
|
+
// 提取捕获组中的数字
|
|
33583
|
+
const number = parseInt(match[1], 10);
|
|
33584
|
+
results.push({
|
|
33585
|
+
scenario: match[0],
|
|
33586
|
+
// 完整匹配的字符串
|
|
33587
|
+
number: number,
|
|
33588
|
+
// 提取的数字
|
|
33589
|
+
type: pattern.source.includes('Other') ? 'English' : 'Chinese'
|
|
33590
|
+
});
|
|
33591
|
+
}
|
|
33592
|
+
});
|
|
33593
|
+
return results;
|
|
33594
|
+
}
|
|
33481
33595
|
const calendar_i18n_check = element => {
|
|
33482
33596
|
const checkResult = {
|
|
33483
33597
|
result: false,
|
|
@@ -33497,13 +33611,152 @@ const calendar_i18n_check = element => {
|
|
|
33497
33611
|
let year = yearMonth.year;
|
|
33498
33612
|
let month = yearMonth.month;
|
|
33499
33613
|
let newInnerHTML = `${year}/${month}`;
|
|
33614
|
+
let lang = window.localStorage.getItem("iportal_localID") || "zh-CN";
|
|
33615
|
+
if (lang === "zh-CN") {
|
|
33616
|
+
newInnerHTML = `${year}年${month}月`;
|
|
33617
|
+
}
|
|
33500
33618
|
element.innerHTML = newInnerHTML;
|
|
33501
33619
|
}
|
|
33502
33620
|
};
|
|
33503
33621
|
let innerHTML = element.innerHTML;
|
|
33504
33622
|
let testRule = /^\d{4}年(0?[1-9]|1[0-2])月$/;
|
|
33505
33623
|
if (testRule.test(innerHTML)) {
|
|
33506
|
-
console.log("检查smardaten平台日历标题 元素:",
|
|
33624
|
+
// console.log("检查smardaten平台日历标题 元素:",innerHTML);
|
|
33625
|
+
let tempHTMLMatch = {
|
|
33626
|
+
oldValue: innerHTML,
|
|
33627
|
+
isScriptAction: true,
|
|
33628
|
+
scriptFunction: scriptFunction
|
|
33629
|
+
};
|
|
33630
|
+
checkResult.result = true;
|
|
33631
|
+
checkResult.innerHTMLMatch = tempHTMLMatch;
|
|
33632
|
+
return checkResult;
|
|
33633
|
+
}
|
|
33634
|
+
}
|
|
33635
|
+
// 检查日历今天按钮
|
|
33636
|
+
if (classes.contains("fc-today-button")) {
|
|
33637
|
+
let innerHTML = element.innerHTML;
|
|
33638
|
+
if (innerHTML.includes("今天") || innerHTML.includes("today")) {
|
|
33639
|
+
// console.log("检查smardaten平台日历 今天 元素:",innerHTML);
|
|
33640
|
+
let tempHTMLMatch = {
|
|
33641
|
+
oldValue: '$L{今天}'
|
|
33642
|
+
};
|
|
33643
|
+
checkResult.result = true;
|
|
33644
|
+
checkResult.innerHTMLMatch = tempHTMLMatch;
|
|
33645
|
+
return checkResult;
|
|
33646
|
+
}
|
|
33647
|
+
}
|
|
33648
|
+
// 检查日历标题
|
|
33649
|
+
if (classes.contains("fullCalendar_title_value")) {
|
|
33650
|
+
let innerHTML = element.innerHTML;
|
|
33651
|
+
const regex = /周[一二三四五六日]/;
|
|
33652
|
+
const regex_en = /^(mon(day)?s?\.?|tue(sday)?s?\.?|wed(nesday)?s?\.?|thu(r(sday)?)?s?\.?|fri(day)?s?\.?|sat(urday)?s?\.?|sun(day)?s?\.?)$/i;
|
|
33653
|
+
let match = innerHTML.match(regex);
|
|
33654
|
+
if (match) {
|
|
33655
|
+
// console.log("检查smardaten平台日历 周 元素:",innerHTML);
|
|
33656
|
+
let day = match[0];
|
|
33657
|
+
let tempHTMLMatch = {
|
|
33658
|
+
oldValue: `$L{${day}}`
|
|
33659
|
+
};
|
|
33660
|
+
checkResult.result = true;
|
|
33661
|
+
checkResult.innerHTMLMatch = tempHTMLMatch;
|
|
33662
|
+
return checkResult;
|
|
33663
|
+
}
|
|
33664
|
+
match = innerHTML.match(regex_en);
|
|
33665
|
+
if (match) {
|
|
33666
|
+
// console.log("检查smardaten平台日历 周 元素:",innerHTML);
|
|
33667
|
+
let day = match[0];
|
|
33668
|
+
let tempHTMLMatch = {
|
|
33669
|
+
oldValue: `$L{${convertToChineseWeekday(day)}}`
|
|
33670
|
+
};
|
|
33671
|
+
checkResult.result = true;
|
|
33672
|
+
checkResult.innerHTMLMatch = tempHTMLMatch;
|
|
33673
|
+
return checkResult;
|
|
33674
|
+
}
|
|
33675
|
+
}
|
|
33676
|
+
//日期单元格
|
|
33677
|
+
if (classes.contains("fc-daygrid-day-number")) {
|
|
33678
|
+
let scriptFunction = (appID, lang) => {
|
|
33679
|
+
let oldValue = element.getAttribute("oldValue");
|
|
33680
|
+
let result = extractDayNumbers(oldValue);
|
|
33681
|
+
if (result && result.length > 0) {
|
|
33682
|
+
let day = result[0];
|
|
33683
|
+
let newInnerHTML = `${day}`;
|
|
33684
|
+
let lang = window.localStorage.getItem("iportal_localID") || "zh-CN";
|
|
33685
|
+
if (lang === "zh-CN") {
|
|
33686
|
+
newInnerHTML = `${day}日`;
|
|
33687
|
+
}
|
|
33688
|
+
element.innerHTML = newInnerHTML;
|
|
33689
|
+
}
|
|
33690
|
+
};
|
|
33691
|
+
let innerHTML = element.innerHTML;
|
|
33692
|
+
let match = extractDayNumbers(innerHTML);
|
|
33693
|
+
if (match.length > 0) {
|
|
33694
|
+
// console.log("检查smardaten平台日历 日 元素:",innerHTML);
|
|
33695
|
+
let tempHTMLMatch = {
|
|
33696
|
+
oldValue: innerHTML,
|
|
33697
|
+
isScriptAction: true,
|
|
33698
|
+
scriptFunction: scriptFunction
|
|
33699
|
+
};
|
|
33700
|
+
checkResult.result = true;
|
|
33701
|
+
checkResult.innerHTMLMatch = tempHTMLMatch;
|
|
33702
|
+
return checkResult;
|
|
33703
|
+
}
|
|
33704
|
+
}
|
|
33705
|
+
// 日历更多按钮
|
|
33706
|
+
if (classes.contains("fc-daygrid-more-link")) {
|
|
33707
|
+
let scriptFunction = (appID, lang) => {
|
|
33708
|
+
let oldValue = element.getAttribute("oldValue");
|
|
33709
|
+
let result = extractNumbersFromScenarios(oldValue);
|
|
33710
|
+
if (result && result.length > 0) {
|
|
33711
|
+
let day = result[0]["number"];
|
|
33712
|
+
let newInnerHTML = "另外${X}条数据";
|
|
33713
|
+
newInnerHTML = i18n(newInnerHTML, appID, lang);
|
|
33714
|
+
newInnerHTML = newInnerHTML.replace("${X}", day);
|
|
33715
|
+
element.innerHTML = newInnerHTML;
|
|
33716
|
+
}
|
|
33717
|
+
};
|
|
33718
|
+
let innerHTML = element.innerHTML;
|
|
33719
|
+
let match = extractNumbersFromScenarios(innerHTML);
|
|
33720
|
+
if (match.length > 0) {
|
|
33721
|
+
// console.log("检查smardaten平台日历 更多 元素:",innerHTML);
|
|
33722
|
+
let tempHTMLMatch = {
|
|
33723
|
+
oldValue: innerHTML,
|
|
33724
|
+
isScriptAction: true,
|
|
33725
|
+
scriptFunction: scriptFunction
|
|
33726
|
+
};
|
|
33727
|
+
checkResult.result = true;
|
|
33728
|
+
checkResult.innerHTMLMatch = tempHTMLMatch;
|
|
33729
|
+
return checkResult;
|
|
33730
|
+
}
|
|
33731
|
+
}
|
|
33732
|
+
// 日历弹窗标题
|
|
33733
|
+
if (classes.contains("fc-popover-title")) {
|
|
33734
|
+
// 正则表达式匹配中文日期格式
|
|
33735
|
+
const regex = /(\d{4})年(\d{1,2})月(\d{1,2})日/g;
|
|
33736
|
+
let scriptFunction = (appID, lang) => {
|
|
33737
|
+
let oldValue = element.getAttribute("oldValue");
|
|
33738
|
+
let match = oldValue.match(regex);
|
|
33739
|
+
if (match) {
|
|
33740
|
+
// 替换函数
|
|
33741
|
+
const convertedText = oldValue.replace(regex, function (match, year, month, day) {
|
|
33742
|
+
// 格式化月份和日期为两位数
|
|
33743
|
+
const formattedMonth = month.padStart(2, '0');
|
|
33744
|
+
const formattedDay = day.padStart(2, '0');
|
|
33745
|
+
let result = `${year}/${formattedMonth}/${formattedDay}`;
|
|
33746
|
+
let lang = window.localStorage.getItem("iportal_localID") || "zh-CN";
|
|
33747
|
+
if (lang === "zh-CN") {
|
|
33748
|
+
result = `${year}年${formattedMonth}月${formattedDay}日`;
|
|
33749
|
+
}
|
|
33750
|
+
// 返回新格式的日期
|
|
33751
|
+
return result;
|
|
33752
|
+
});
|
|
33753
|
+
element.innerHTML = convertedText;
|
|
33754
|
+
}
|
|
33755
|
+
};
|
|
33756
|
+
let innerHTML = element.innerHTML;
|
|
33757
|
+
let match = innerHTML.match(regex);
|
|
33758
|
+
if (match.length > 0) {
|
|
33759
|
+
// console.log("检查smardaten平台日历 日 元素:",innerHTML);
|
|
33507
33760
|
let tempHTMLMatch = {
|
|
33508
33761
|
oldValue: innerHTML,
|
|
33509
33762
|
isScriptAction: true,
|
|
@@ -33613,7 +33866,7 @@ function processElement(element) {
|
|
|
33613
33866
|
}
|
|
33614
33867
|
|
|
33615
33868
|
// 仅处理元素节点
|
|
33616
|
-
if (element && element.nodeType
|
|
33869
|
+
if (element && element.nodeType !== Node.ELEMENT_NODE) {
|
|
33617
33870
|
return false;
|
|
33618
33871
|
}
|
|
33619
33872
|
|
|
@@ -33638,7 +33891,7 @@ function processElement(element) {
|
|
|
33638
33891
|
let innerHTMLMatch = null;
|
|
33639
33892
|
const attrCheckResult = attribute_i18n_check(element);
|
|
33640
33893
|
if (attrCheckResult.result) {
|
|
33641
|
-
|
|
33894
|
+
console.log("检查到属性匹配元素:", element);
|
|
33642
33895
|
}
|
|
33643
33896
|
|
|
33644
33897
|
//检查是否是smardaten平台元素
|
|
@@ -33648,14 +33901,21 @@ function processElement(element) {
|
|
|
33648
33901
|
element.setAttribute("oldValue", innerHTMLMatch.oldValue);
|
|
33649
33902
|
} else {
|
|
33650
33903
|
if (!hasChildren) {
|
|
33651
|
-
//如果存在历史值,说明之前解析过,有可能是值需要刷新触发
|
|
33652
|
-
let
|
|
33653
|
-
|
|
33654
|
-
|
|
33904
|
+
//如果存在历史值,说明之前解析过,有可能是值需要刷新触发
|
|
33905
|
+
let newValue = element.innerHTML;
|
|
33906
|
+
let newMatch = checkTextFormat(newValue);
|
|
33907
|
+
if (newMatch) {
|
|
33908
|
+
innerHTMLMatch = newMatch;
|
|
33909
|
+
} else {
|
|
33910
|
+
newValue = element.getAttribute("oldValue");
|
|
33911
|
+
if (!newValue) {
|
|
33912
|
+
newValue = element.innerHTML;
|
|
33913
|
+
}
|
|
33914
|
+
innerHTMLMatch = checkTextFormat(newValue);
|
|
33655
33915
|
}
|
|
33656
|
-
innerHTMLMatch = checkTextFormat(oldValue);
|
|
33657
33916
|
if (innerHTMLMatch) {
|
|
33658
|
-
|
|
33917
|
+
// console.log("检查到innerHTML匹配元素:",element);
|
|
33918
|
+
element.setAttribute("oldValue", newValue);
|
|
33659
33919
|
}
|
|
33660
33920
|
}
|
|
33661
33921
|
}
|
|
@@ -33684,7 +33944,7 @@ function processElement(element) {
|
|
|
33684
33944
|
isAttibuteAction: attrCheckResult.result,
|
|
33685
33945
|
attrFunction: attrCheckResult.scriptFunction || null
|
|
33686
33946
|
});
|
|
33687
|
-
console.log("添加后元素缓冲数:",
|
|
33947
|
+
// console.log("添加后元素缓冲数:",window.i18nElementsMap.size);
|
|
33688
33948
|
applyTranslation(element);
|
|
33689
33949
|
return true;
|
|
33690
33950
|
}
|
|
@@ -33701,7 +33961,7 @@ function unProcessElement(element) {
|
|
|
33701
33961
|
}
|
|
33702
33962
|
const localDomID = element.getAttribute("localDomID");
|
|
33703
33963
|
if (localDomID) {
|
|
33704
|
-
console.log(`处理元素ID:${localDomID} 移除缓存`);
|
|
33964
|
+
// console.log(`处理元素ID:${localDomID} 移除缓存`);
|
|
33705
33965
|
element.removeAttribute("localDomID");
|
|
33706
33966
|
}
|
|
33707
33967
|
if (localDomID && window.i18nElementsMap.has(localDomID)) {
|
|
@@ -33712,7 +33972,7 @@ function unProcessElement(element) {
|
|
|
33712
33972
|
// element.innerHTML = oldValue;
|
|
33713
33973
|
// }
|
|
33714
33974
|
window.i18nElementsMap.delete(localDomID);
|
|
33715
|
-
console.log("移除后元素缓冲数:",
|
|
33975
|
+
// console.log("移除后元素缓冲数:",window.i18nElementsMap.size);
|
|
33716
33976
|
}
|
|
33717
33977
|
}
|
|
33718
33978
|
|