isdata-customer-sdk 0.2.10 → 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 +288 -32
- package/dist/index.common.js.map +1 -1
- package/dist/index.umd.js +288 -32
- 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.common.js
CHANGED
|
@@ -33105,7 +33105,7 @@ const check = element => {
|
|
|
33105
33105
|
if (classes.contains("ant-table-cell")) {
|
|
33106
33106
|
let innerHTML = element.innerHTML;
|
|
33107
33107
|
if (innerHTML.includes("序号") || innerHTML.includes("Serial No.")) {
|
|
33108
|
-
console.log("检查smardaten平台表格 序号 元素:",
|
|
33108
|
+
// console.log("检查smardaten平台表格 序号 元素:",innerHTML);
|
|
33109
33109
|
let tempHTMLMatch = {
|
|
33110
33110
|
oldValue: '$L{序号}'
|
|
33111
33111
|
};
|
|
@@ -33114,7 +33114,7 @@ const check = element => {
|
|
|
33114
33114
|
return checkResult;
|
|
33115
33115
|
}
|
|
33116
33116
|
if (innerHTML.includes("操作")) {
|
|
33117
|
-
console.log("检查smardaten平台表格 操作 元素:",
|
|
33117
|
+
// console.log("检查smardaten平台表格 操作 元素:",innerHTML);
|
|
33118
33118
|
let tempHTMLMatch = {
|
|
33119
33119
|
oldValue: '$L{操作}'
|
|
33120
33120
|
};
|
|
@@ -33127,7 +33127,7 @@ const check = element => {
|
|
|
33127
33127
|
if (classes.contains("export_menu")) {
|
|
33128
33128
|
let innerHTML = element.innerHTML;
|
|
33129
33129
|
if (innerHTML.includes("导出进度") || innerHTML.includes("Export progress")) {
|
|
33130
|
-
console.log("检查smardaten平台表格 导出按钮 元素:",
|
|
33130
|
+
// console.log("检查smardaten平台表格 导出按钮 元素:",innerHTML);
|
|
33131
33131
|
let tempHTMLMatch = {
|
|
33132
33132
|
oldValue: '$L{导出进度}'
|
|
33133
33133
|
};
|
|
@@ -33261,7 +33261,7 @@ const check = element => {
|
|
|
33261
33261
|
if (classes.contains("ant-popover-message-title")) {
|
|
33262
33262
|
let innerHTML = element.innerHTML;
|
|
33263
33263
|
if (innerHTML.includes("确认执行:") || innerHTML.includes("Confirm Execution:")) {
|
|
33264
|
-
console.log("检查smardaten平台删除提问对话框:",
|
|
33264
|
+
// console.log("检查smardaten平台删除提问对话框:",innerHTML);
|
|
33265
33265
|
let tempHTMLMatch = {
|
|
33266
33266
|
oldValue: '$L{操作确认:删除?}'
|
|
33267
33267
|
};
|
|
@@ -33274,7 +33274,7 @@ const check = element => {
|
|
|
33274
33274
|
if (classes.contains("ant-btn-sm")) {
|
|
33275
33275
|
let innerHTML = element.innerHTML;
|
|
33276
33276
|
if (innerHTML.includes("Cancel") || innerHTML.includes("取消")) {
|
|
33277
|
-
console.log("检查smardaten平台 Tip提问取消删除按钮:",
|
|
33277
|
+
// console.log("检查smardaten平台 Tip提问取消删除按钮:",innerHTML);
|
|
33278
33278
|
let tempHTMLMatch = {
|
|
33279
33279
|
oldValue: '$L{取消}'
|
|
33280
33280
|
};
|
|
@@ -33283,7 +33283,7 @@ const check = element => {
|
|
|
33283
33283
|
return checkResult;
|
|
33284
33284
|
}
|
|
33285
33285
|
if (innerHTML.includes("确定") || innerHTML.includes("OK")) {
|
|
33286
|
-
console.log("检查smardaten平台 Tip提问确认删除按钮:",
|
|
33286
|
+
// console.log("检查smardaten平台 Tip提问确认删除按钮:",innerHTML);
|
|
33287
33287
|
let tempHTMLMatch = {
|
|
33288
33288
|
oldValue: '$L{确定}'
|
|
33289
33289
|
};
|
|
@@ -33343,15 +33343,19 @@ const catalog_i18n_check = element => {
|
|
|
33343
33343
|
;// ./src/api/i18n/commom_i18n/common_i18n.js
|
|
33344
33344
|
|
|
33345
33345
|
|
|
33346
|
-
|
|
33347
|
-
|
|
33346
|
+
function getOldValueNodeText(innerHTML, index) {
|
|
33347
|
+
const container = document.createElement('div');
|
|
33348
|
+
container.innerHTML = innerHTML;
|
|
33349
|
+
const childNode = container.childNodes[index];
|
|
33350
|
+
return childNode.textContent;
|
|
33351
|
+
}
|
|
33348
33352
|
const common_i18n_check = element => {
|
|
33349
33353
|
const checkResult = {
|
|
33350
33354
|
result: false,
|
|
33351
33355
|
innerHTMLMatch: null
|
|
33352
33356
|
};
|
|
33353
33357
|
// 检查目录列表 名称 列
|
|
33354
|
-
if (element.tagName === 'BUTTON') {
|
|
33358
|
+
if (element.tagName === 'BUTTON' || element.tagName === 'P') {
|
|
33355
33359
|
//TODO:先检查新的是否需要解析,新的不需要有可能是解析后的再次判断,如果有历史解析值,则解析
|
|
33356
33360
|
//如果新的需要解析,更新缓存的历史解析值
|
|
33357
33361
|
let innerHTML = element.innerHTML;
|
|
@@ -33365,25 +33369,36 @@ const common_i18n_check = element => {
|
|
|
33365
33369
|
// console.log("检查结果:",firstCheckResult);
|
|
33366
33370
|
let scriptFunction = (appID, lang) => {
|
|
33367
33371
|
let elementsArray = [];
|
|
33368
|
-
element.childNodes.
|
|
33369
|
-
let scriptNodeItem =
|
|
33372
|
+
for (let i = 0; i < element.childNodes.length; i++) {
|
|
33373
|
+
let scriptNodeItem = element.childNodes[i];
|
|
33370
33374
|
if (scriptNodeItem.nodeType === Node.TEXT_NODE) {
|
|
33371
|
-
let
|
|
33372
|
-
console.log("执行 button 文本节点翻译:", text);
|
|
33373
|
-
|
|
33375
|
+
let oldValue = element.getAttribute("oldValue");
|
|
33376
|
+
// console.log("执行 button 文本节点翻译:", text);
|
|
33377
|
+
// 创建正则表达式匹配所有 $L{...} 格式
|
|
33378
|
+
const regex = /\$L\{([^}]+)\}/g;
|
|
33379
|
+
let isTextMatch = checkTextFormat(oldValue);
|
|
33374
33380
|
if (!isTextMatch) {
|
|
33375
33381
|
elementsArray.push(scriptNodeItem);
|
|
33376
33382
|
} else {
|
|
33377
|
-
console.log("执行 button 脚本节点翻译isTextMatch:", isTextMatch
|
|
33383
|
+
// console.log("执行 button 脚本节点翻译isTextMatch:", isTextMatch?true:false);
|
|
33378
33384
|
// element.removeChild(scriptNodeItem);
|
|
33379
|
-
|
|
33380
|
-
let
|
|
33385
|
+
// 替换所有 $L{...} 占位符为翻译文本
|
|
33386
|
+
let childNodeText = getOldValueNodeText(oldValue, i);
|
|
33387
|
+
let newValue = childNodeText;
|
|
33388
|
+
let match;
|
|
33389
|
+
while ((match = regex.exec(oldValue)) !== null) {
|
|
33390
|
+
const fullMatch = match[0];
|
|
33391
|
+
const placeholderKey = match[1];
|
|
33392
|
+
const translation = i18n(placeholderKey, appID, lang);
|
|
33393
|
+
newValue = newValue.replace(fullMatch, translation);
|
|
33394
|
+
}
|
|
33395
|
+
let textNode = document.createTextNode(newValue);
|
|
33381
33396
|
elementsArray.push(textNode);
|
|
33382
33397
|
}
|
|
33383
33398
|
} else {
|
|
33384
33399
|
elementsArray.push(scriptNodeItem);
|
|
33385
33400
|
}
|
|
33386
|
-
}
|
|
33401
|
+
}
|
|
33387
33402
|
element.innerHTML = '';
|
|
33388
33403
|
elementsArray.forEach(el => {
|
|
33389
33404
|
element.appendChild(el);
|
|
@@ -33448,6 +33463,56 @@ const attribute_i18n_check = element => {
|
|
|
33448
33463
|
;// ./src/api/i18n/smardaten_i18n/calendar_i18n.js
|
|
33449
33464
|
|
|
33450
33465
|
|
|
33466
|
+
function convertToChineseWeekday(englishInput) {
|
|
33467
|
+
// 清理输入:去除首尾空格并转为小写
|
|
33468
|
+
const input = englishInput.trim().toLowerCase();
|
|
33469
|
+
|
|
33470
|
+
// 定义星期映射关系
|
|
33471
|
+
const weekdayMap = {
|
|
33472
|
+
'mon': '周一',
|
|
33473
|
+
'monday': '周一',
|
|
33474
|
+
'mondays': '周一',
|
|
33475
|
+
'tue': '周二',
|
|
33476
|
+
'tues': '周二',
|
|
33477
|
+
'tuesday': '周二',
|
|
33478
|
+
'tuesdays': '周二',
|
|
33479
|
+
'wed': '周三',
|
|
33480
|
+
'wednesday': '周三',
|
|
33481
|
+
'wednesdays': '周三',
|
|
33482
|
+
'thu': '周四',
|
|
33483
|
+
'thur': '周四',
|
|
33484
|
+
'thurs': '周四',
|
|
33485
|
+
'thursday': '周四',
|
|
33486
|
+
'thursdays': '周四',
|
|
33487
|
+
'fri': '周五',
|
|
33488
|
+
'friday': '周五',
|
|
33489
|
+
'fridays': '周五',
|
|
33490
|
+
'sat': '周六',
|
|
33491
|
+
'saturday': '周六',
|
|
33492
|
+
'saturdays': '周六',
|
|
33493
|
+
'sun': '周日',
|
|
33494
|
+
'sunday': '周日',
|
|
33495
|
+
'sundays': '周日'
|
|
33496
|
+
};
|
|
33497
|
+
|
|
33498
|
+
// 使用正则表达式匹配所有可能的星期格式
|
|
33499
|
+
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;
|
|
33500
|
+
|
|
33501
|
+
// 测试输入是否匹配星期格式
|
|
33502
|
+
if (!pattern.test(input)) {
|
|
33503
|
+
return '未知日期';
|
|
33504
|
+
}
|
|
33505
|
+
|
|
33506
|
+
// 提取基础名称(去除复数形式和句点)
|
|
33507
|
+
const baseName = input.replace(/\./g, '') // 移除所有句点
|
|
33508
|
+
.replace(/s$/, ''); // 移除结尾的's'(复数形式)
|
|
33509
|
+
|
|
33510
|
+
// 特殊处理周四的多种缩写形式
|
|
33511
|
+
const normalized = baseName.startsWith('thu') ? 'thu' : baseName.slice(0, 3);
|
|
33512
|
+
|
|
33513
|
+
// 映射到中文名称
|
|
33514
|
+
return weekdayMap[normalized] || weekdayMap[baseName] || '未知日期';
|
|
33515
|
+
}
|
|
33451
33516
|
function extractYearMonth(str) {
|
|
33452
33517
|
const regex = /(\d{4})年(0?[1-9]|1[0-2])月/g;
|
|
33453
33518
|
const matches = str.matchAll(regex);
|
|
@@ -33462,6 +33527,53 @@ function extractYearMonth(str) {
|
|
|
33462
33527
|
}
|
|
33463
33528
|
return result;
|
|
33464
33529
|
}
|
|
33530
|
+
function extractDayNumbers(text) {
|
|
33531
|
+
// 匹配两种情况:
|
|
33532
|
+
// 1. "数字+日"格式(如"5日"、"12日")
|
|
33533
|
+
// 2. 独立的1-31数字(前后有边界)
|
|
33534
|
+
const regex = /(?:(\b(0?[1-9]|[12]\d|3[01])\b)(?=日))|(\b(0?[1-9]|[12]\d|3[01])\b)/g;
|
|
33535
|
+
const results = [];
|
|
33536
|
+
let match;
|
|
33537
|
+
while ((match = regex.exec(text)) !== null) {
|
|
33538
|
+
// match[2] 对应第一种情况(带"日"字的数字)
|
|
33539
|
+
// match[4] 对应第二种情况(独立数字)
|
|
33540
|
+
const numStr = match[2] || match[4];
|
|
33541
|
+
if (numStr) {
|
|
33542
|
+
// 转换为整数并验证范围
|
|
33543
|
+
const day = parseInt(numStr, 10);
|
|
33544
|
+
if (day >= 1 && day <= 31) {
|
|
33545
|
+
results.push(day);
|
|
33546
|
+
}
|
|
33547
|
+
}
|
|
33548
|
+
}
|
|
33549
|
+
return results;
|
|
33550
|
+
}
|
|
33551
|
+
function extractNumbersFromScenarios(text) {
|
|
33552
|
+
// 定义两种场景的正则表达式
|
|
33553
|
+
const patterns = [
|
|
33554
|
+
// 场景1: "Other X pieces of data"
|
|
33555
|
+
/Other\s+(\d+)\s+pieces of data/gi,
|
|
33556
|
+
// 场景2: "其他 X 条记录"
|
|
33557
|
+
/其他\s+(\d+)\s+条记录/g];
|
|
33558
|
+
const results = [];
|
|
33559
|
+
|
|
33560
|
+
// 遍历所有模式进行匹配
|
|
33561
|
+
patterns.forEach(pattern => {
|
|
33562
|
+
let match;
|
|
33563
|
+
while ((match = pattern.exec(text)) !== null) {
|
|
33564
|
+
// 提取捕获组中的数字
|
|
33565
|
+
const number = parseInt(match[1], 10);
|
|
33566
|
+
results.push({
|
|
33567
|
+
scenario: match[0],
|
|
33568
|
+
// 完整匹配的字符串
|
|
33569
|
+
number: number,
|
|
33570
|
+
// 提取的数字
|
|
33571
|
+
type: pattern.source.includes('Other') ? 'English' : 'Chinese'
|
|
33572
|
+
});
|
|
33573
|
+
}
|
|
33574
|
+
});
|
|
33575
|
+
return results;
|
|
33576
|
+
}
|
|
33465
33577
|
const calendar_i18n_check = element => {
|
|
33466
33578
|
const checkResult = {
|
|
33467
33579
|
result: false,
|
|
@@ -33481,13 +33593,152 @@ const calendar_i18n_check = element => {
|
|
|
33481
33593
|
let year = yearMonth.year;
|
|
33482
33594
|
let month = yearMonth.month;
|
|
33483
33595
|
let newInnerHTML = `${year}/${month}`;
|
|
33596
|
+
let lang = window.localStorage.getItem("iportal_localID") || "zh-CN";
|
|
33597
|
+
if (lang === "zh-CN") {
|
|
33598
|
+
newInnerHTML = `${year}年${month}月`;
|
|
33599
|
+
}
|
|
33484
33600
|
element.innerHTML = newInnerHTML;
|
|
33485
33601
|
}
|
|
33486
33602
|
};
|
|
33487
33603
|
let innerHTML = element.innerHTML;
|
|
33488
33604
|
let testRule = /^\d{4}年(0?[1-9]|1[0-2])月$/;
|
|
33489
33605
|
if (testRule.test(innerHTML)) {
|
|
33490
|
-
console.log("检查smardaten平台日历标题 元素:",
|
|
33606
|
+
// console.log("检查smardaten平台日历标题 元素:",innerHTML);
|
|
33607
|
+
let tempHTMLMatch = {
|
|
33608
|
+
oldValue: innerHTML,
|
|
33609
|
+
isScriptAction: true,
|
|
33610
|
+
scriptFunction: scriptFunction
|
|
33611
|
+
};
|
|
33612
|
+
checkResult.result = true;
|
|
33613
|
+
checkResult.innerHTMLMatch = tempHTMLMatch;
|
|
33614
|
+
return checkResult;
|
|
33615
|
+
}
|
|
33616
|
+
}
|
|
33617
|
+
// 检查日历今天按钮
|
|
33618
|
+
if (classes.contains("fc-today-button")) {
|
|
33619
|
+
let innerHTML = element.innerHTML;
|
|
33620
|
+
if (innerHTML.includes("今天") || innerHTML.includes("today")) {
|
|
33621
|
+
// console.log("检查smardaten平台日历 今天 元素:",innerHTML);
|
|
33622
|
+
let tempHTMLMatch = {
|
|
33623
|
+
oldValue: '$L{今天}'
|
|
33624
|
+
};
|
|
33625
|
+
checkResult.result = true;
|
|
33626
|
+
checkResult.innerHTMLMatch = tempHTMLMatch;
|
|
33627
|
+
return checkResult;
|
|
33628
|
+
}
|
|
33629
|
+
}
|
|
33630
|
+
// 检查日历标题
|
|
33631
|
+
if (classes.contains("fullCalendar_title_value")) {
|
|
33632
|
+
let innerHTML = element.innerHTML;
|
|
33633
|
+
const regex = /周[一二三四五六日]/;
|
|
33634
|
+
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;
|
|
33635
|
+
let match = innerHTML.match(regex);
|
|
33636
|
+
if (match) {
|
|
33637
|
+
// console.log("检查smardaten平台日历 周 元素:",innerHTML);
|
|
33638
|
+
let day = match[0];
|
|
33639
|
+
let tempHTMLMatch = {
|
|
33640
|
+
oldValue: `$L{${day}}`
|
|
33641
|
+
};
|
|
33642
|
+
checkResult.result = true;
|
|
33643
|
+
checkResult.innerHTMLMatch = tempHTMLMatch;
|
|
33644
|
+
return checkResult;
|
|
33645
|
+
}
|
|
33646
|
+
match = innerHTML.match(regex_en);
|
|
33647
|
+
if (match) {
|
|
33648
|
+
// console.log("检查smardaten平台日历 周 元素:",innerHTML);
|
|
33649
|
+
let day = match[0];
|
|
33650
|
+
let tempHTMLMatch = {
|
|
33651
|
+
oldValue: `$L{${convertToChineseWeekday(day)}}`
|
|
33652
|
+
};
|
|
33653
|
+
checkResult.result = true;
|
|
33654
|
+
checkResult.innerHTMLMatch = tempHTMLMatch;
|
|
33655
|
+
return checkResult;
|
|
33656
|
+
}
|
|
33657
|
+
}
|
|
33658
|
+
//日期单元格
|
|
33659
|
+
if (classes.contains("fc-daygrid-day-number")) {
|
|
33660
|
+
let scriptFunction = (appID, lang) => {
|
|
33661
|
+
let oldValue = element.getAttribute("oldValue");
|
|
33662
|
+
let result = extractDayNumbers(oldValue);
|
|
33663
|
+
if (result && result.length > 0) {
|
|
33664
|
+
let day = result[0];
|
|
33665
|
+
let newInnerHTML = `${day}`;
|
|
33666
|
+
let lang = window.localStorage.getItem("iportal_localID") || "zh-CN";
|
|
33667
|
+
if (lang === "zh-CN") {
|
|
33668
|
+
newInnerHTML = `${day}日`;
|
|
33669
|
+
}
|
|
33670
|
+
element.innerHTML = newInnerHTML;
|
|
33671
|
+
}
|
|
33672
|
+
};
|
|
33673
|
+
let innerHTML = element.innerHTML;
|
|
33674
|
+
let match = extractDayNumbers(innerHTML);
|
|
33675
|
+
if (match.length > 0) {
|
|
33676
|
+
// console.log("检查smardaten平台日历 日 元素:",innerHTML);
|
|
33677
|
+
let tempHTMLMatch = {
|
|
33678
|
+
oldValue: innerHTML,
|
|
33679
|
+
isScriptAction: true,
|
|
33680
|
+
scriptFunction: scriptFunction
|
|
33681
|
+
};
|
|
33682
|
+
checkResult.result = true;
|
|
33683
|
+
checkResult.innerHTMLMatch = tempHTMLMatch;
|
|
33684
|
+
return checkResult;
|
|
33685
|
+
}
|
|
33686
|
+
}
|
|
33687
|
+
// 日历更多按钮
|
|
33688
|
+
if (classes.contains("fc-daygrid-more-link")) {
|
|
33689
|
+
let scriptFunction = (appID, lang) => {
|
|
33690
|
+
let oldValue = element.getAttribute("oldValue");
|
|
33691
|
+
let result = extractNumbersFromScenarios(oldValue);
|
|
33692
|
+
if (result && result.length > 0) {
|
|
33693
|
+
let day = result[0]["number"];
|
|
33694
|
+
let newInnerHTML = "另外${X}条数据";
|
|
33695
|
+
newInnerHTML = i18n(newInnerHTML, appID, lang);
|
|
33696
|
+
newInnerHTML = newInnerHTML.replace("${X}", day);
|
|
33697
|
+
element.innerHTML = newInnerHTML;
|
|
33698
|
+
}
|
|
33699
|
+
};
|
|
33700
|
+
let innerHTML = element.innerHTML;
|
|
33701
|
+
let match = extractNumbersFromScenarios(innerHTML);
|
|
33702
|
+
if (match.length > 0) {
|
|
33703
|
+
// console.log("检查smardaten平台日历 更多 元素:",innerHTML);
|
|
33704
|
+
let tempHTMLMatch = {
|
|
33705
|
+
oldValue: innerHTML,
|
|
33706
|
+
isScriptAction: true,
|
|
33707
|
+
scriptFunction: scriptFunction
|
|
33708
|
+
};
|
|
33709
|
+
checkResult.result = true;
|
|
33710
|
+
checkResult.innerHTMLMatch = tempHTMLMatch;
|
|
33711
|
+
return checkResult;
|
|
33712
|
+
}
|
|
33713
|
+
}
|
|
33714
|
+
// 日历弹窗标题
|
|
33715
|
+
if (classes.contains("fc-popover-title")) {
|
|
33716
|
+
// 正则表达式匹配中文日期格式
|
|
33717
|
+
const regex = /(\d{4})年(\d{1,2})月(\d{1,2})日/g;
|
|
33718
|
+
let scriptFunction = (appID, lang) => {
|
|
33719
|
+
let oldValue = element.getAttribute("oldValue");
|
|
33720
|
+
let match = oldValue.match(regex);
|
|
33721
|
+
if (match) {
|
|
33722
|
+
// 替换函数
|
|
33723
|
+
const convertedText = oldValue.replace(regex, function (match, year, month, day) {
|
|
33724
|
+
// 格式化月份和日期为两位数
|
|
33725
|
+
const formattedMonth = month.padStart(2, '0');
|
|
33726
|
+
const formattedDay = day.padStart(2, '0');
|
|
33727
|
+
let result = `${year}/${formattedMonth}/${formattedDay}`;
|
|
33728
|
+
let lang = window.localStorage.getItem("iportal_localID") || "zh-CN";
|
|
33729
|
+
if (lang === "zh-CN") {
|
|
33730
|
+
result = `${year}年${formattedMonth}月${formattedDay}日`;
|
|
33731
|
+
}
|
|
33732
|
+
// 返回新格式的日期
|
|
33733
|
+
return result;
|
|
33734
|
+
});
|
|
33735
|
+
element.innerHTML = convertedText;
|
|
33736
|
+
}
|
|
33737
|
+
};
|
|
33738
|
+
let innerHTML = element.innerHTML;
|
|
33739
|
+
let match = innerHTML.match(regex);
|
|
33740
|
+
if (match.length > 0) {
|
|
33741
|
+
// console.log("检查smardaten平台日历 日 元素:",innerHTML);
|
|
33491
33742
|
let tempHTMLMatch = {
|
|
33492
33743
|
oldValue: innerHTML,
|
|
33493
33744
|
isScriptAction: true,
|
|
@@ -33597,7 +33848,7 @@ function processElement(element) {
|
|
|
33597
33848
|
}
|
|
33598
33849
|
|
|
33599
33850
|
// 仅处理元素节点
|
|
33600
|
-
if (element && element.nodeType
|
|
33851
|
+
if (element && element.nodeType !== Node.ELEMENT_NODE) {
|
|
33601
33852
|
return false;
|
|
33602
33853
|
}
|
|
33603
33854
|
|
|
@@ -33622,7 +33873,7 @@ function processElement(element) {
|
|
|
33622
33873
|
let innerHTMLMatch = null;
|
|
33623
33874
|
const attrCheckResult = attribute_i18n_check(element);
|
|
33624
33875
|
if (attrCheckResult.result) {
|
|
33625
|
-
|
|
33876
|
+
console.log("检查到属性匹配元素:", element);
|
|
33626
33877
|
}
|
|
33627
33878
|
|
|
33628
33879
|
//检查是否是smardaten平台元素
|
|
@@ -33632,16 +33883,21 @@ function processElement(element) {
|
|
|
33632
33883
|
element.setAttribute("oldValue", innerHTMLMatch.oldValue);
|
|
33633
33884
|
} else {
|
|
33634
33885
|
if (!hasChildren) {
|
|
33635
|
-
//如果存在历史值,说明之前解析过,有可能是值需要刷新触发
|
|
33636
|
-
|
|
33637
|
-
|
|
33638
|
-
|
|
33639
|
-
|
|
33640
|
-
|
|
33886
|
+
//如果存在历史值,说明之前解析过,有可能是值需要刷新触发
|
|
33887
|
+
let newValue = element.innerHTML;
|
|
33888
|
+
let newMatch = checkTextFormat(newValue);
|
|
33889
|
+
if (newMatch) {
|
|
33890
|
+
innerHTMLMatch = newMatch;
|
|
33891
|
+
} else {
|
|
33892
|
+
newValue = element.getAttribute("oldValue");
|
|
33893
|
+
if (!newValue) {
|
|
33894
|
+
newValue = element.innerHTML;
|
|
33895
|
+
}
|
|
33896
|
+
innerHTMLMatch = checkTextFormat(newValue);
|
|
33641
33897
|
}
|
|
33642
|
-
innerHTMLMatch = checkTextFormat(oldValue);
|
|
33643
33898
|
if (innerHTMLMatch) {
|
|
33644
|
-
|
|
33899
|
+
// console.log("检查到innerHTML匹配元素:",element);
|
|
33900
|
+
element.setAttribute("oldValue", newValue);
|
|
33645
33901
|
}
|
|
33646
33902
|
}
|
|
33647
33903
|
}
|
|
@@ -33670,7 +33926,7 @@ function processElement(element) {
|
|
|
33670
33926
|
isAttibuteAction: attrCheckResult.result,
|
|
33671
33927
|
attrFunction: attrCheckResult.scriptFunction || null
|
|
33672
33928
|
});
|
|
33673
|
-
console.log("添加后元素缓冲数:",
|
|
33929
|
+
// console.log("添加后元素缓冲数:",window.i18nElementsMap.size);
|
|
33674
33930
|
applyTranslation(element);
|
|
33675
33931
|
return true;
|
|
33676
33932
|
}
|
|
@@ -33687,7 +33943,7 @@ function unProcessElement(element) {
|
|
|
33687
33943
|
}
|
|
33688
33944
|
const localDomID = element.getAttribute("localDomID");
|
|
33689
33945
|
if (localDomID) {
|
|
33690
|
-
console.log(`处理元素ID:${localDomID} 移除缓存`);
|
|
33946
|
+
// console.log(`处理元素ID:${localDomID} 移除缓存`);
|
|
33691
33947
|
element.removeAttribute("localDomID");
|
|
33692
33948
|
}
|
|
33693
33949
|
if (localDomID && window.i18nElementsMap.has(localDomID)) {
|
|
@@ -33698,7 +33954,7 @@ function unProcessElement(element) {
|
|
|
33698
33954
|
// element.innerHTML = oldValue;
|
|
33699
33955
|
// }
|
|
33700
33956
|
window.i18nElementsMap.delete(localDomID);
|
|
33701
|
-
console.log("移除后元素缓冲数:",
|
|
33957
|
+
// console.log("移除后元素缓冲数:",window.i18nElementsMap.size);
|
|
33702
33958
|
}
|
|
33703
33959
|
}
|
|
33704
33960
|
|