Skip to content

Commit b311d7f

Browse files
committed
【fix】修复英文页面下的include不对问题
AI-GEN: 80% Claude
1 parent 798b211 commit b311d7f

7 files changed

Lines changed: 15 additions & 14 deletions

File tree

‎dist/classic/include-classic.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@
5858
var distMatch = selfSrc.match(/^(.*?)\/?(?:classic\/)?include-classic\.js(?:[?#]|$)/);
5959
if (distMatch && distMatch[1]) {
6060
disturl = distMatch[1];
61-
//web 与 dist 同级:libsurl 若是相对路径的 web/libs,随 disturl 一起校正
61+
//相对路径的 web/libs 先去掉一层 ../,再接到 disturl 后面
6262
if (libsurl && !/^https?:\/\//i.test(libsurl) && /(?:^|\/)web\/libs\/?$/.test(libsurl)) {
63-
libsurl = disturl.replace(/\/?dist\/?$/, '') + '/web/libs';
63+
libsurl = disturl + '/' + libsurl.replace(/^\.\.\//, '');
6464
}
6565
}
6666
var includes = (targetScript.getAttribute('include') || "").split(",");

‎dist/leaflet/include-leaflet.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@
5858
var distMatch = selfSrc.match(/^(.*?)\/?(?:leaflet\/)?include-leaflet\.js(?:[?#]|$)/);
5959
if (distMatch && distMatch[1]) {
6060
disturl = distMatch[1];
61-
//web 与 dist 同级:libsurl 若是相对路径的 web/libs,随 disturl 一起校正
61+
//相对路径的 web/libs 先去掉一层 ../,再接到 disturl 后面
6262
if (libsurl && !/^https?:\/\//i.test(libsurl) && /(?:^|\/)web\/libs\/?$/.test(libsurl)) {
63-
libsurl = disturl.replace(/\/?dist\/?$/, '') + '/web/libs';
63+
libsurl = disturl + '/' + libsurl.replace(/^\.\.\//, '');
6464
}
6565
}
6666
var includes = (targetScript.getAttribute('include') || '').split(',');

‎dist/mapboxgl/include-mapboxgl.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@
5858
var distMatch = selfSrc.match(/^(.*?)\/?(?:mapboxgl\/)?include-mapboxgl\.js(?:[?#]|$)/);
5959
if (distMatch && distMatch[1]) {
6060
disturl = distMatch[1];
61-
//web 与 dist 同级:libsurl 若是相对路径的 web/libs,随 disturl 一起校正
61+
//相对路径的 web/libs 先去掉一层 ../,再接到 disturl 后面
6262
if (libsurl && !/^https?:\/\//i.test(libsurl) && /(?:^|\/)web\/libs\/?$/.test(libsurl)) {
63-
libsurl = disturl.replace(/\/?dist\/?$/, '') + '/web/libs';
63+
libsurl = disturl + '/' + libsurl.replace(/^\.\.\//, '');
6464
}
6565
}
6666
var includes = (targetScript.getAttribute('include') || '').split(',');

‎dist/maplibregl/include-maplibregl.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@
5858
var distMatch = selfSrc.match(/^(.*?)\/?(?:maplibregl\/)?include-maplibregl\.js(?:[?#]|$)/);
5959
if (distMatch && distMatch[1]) {
6060
disturl = distMatch[1];
61-
//web 与 dist 同级:libsurl 若是相对路径的 web/libs,随 disturl 一起校正
61+
//相对路径的 web/libs 先去掉一层 ../,再接到 disturl 后面
6262
if (libsurl && !/^https?:\/\//i.test(libsurl) && /(?:^|\/)web\/libs\/?$/.test(libsurl)) {
63-
libsurl = disturl.replace(/\/?dist\/?$/, '') + '/web/libs';
63+
libsurl = disturl + '/' + libsurl.replace(/^\.\.\//, '');
6464
}
6565
}
6666
var includes = (targetScript.getAttribute('include') || '').split(',');

‎dist/ol/include-ol.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@
5858
var distMatch = selfSrc.match(/^(.*?)\/?(?:ol\/)?include-ol\.js(?:[?#]|$)/);
5959
if (distMatch && distMatch[1]) {
6060
disturl = distMatch[1];
61-
//web 与 dist 同级:libsurl 若是相对路径的 web/libs,随 disturl 一起校正
61+
//相对路径的 web/libs 先去掉一层 ../,再接到 disturl 后面
6262
if (libsurl && !/^https?:\/\//i.test(libsurl) && /(?:^|\/)web\/libs\/?$/.test(libsurl)) {
63-
libsurl = disturl.replace(/\/?dist\/?$/, '') + '/web/libs';
63+
libsurl = disturl + '/' + libsurl.replace(/^\.\.\//, '');
6464
}
6565
}
6666
var includes = (targetScript.getAttribute('include') || '').split(',');

‎dist/openlayers/include-openlayers.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@
5858
var distMatch = selfSrc.match(/^(.*?)\/?(?:openlayers\/)?include-openlayers\.js(?:[?#]|$)/);
5959
if (distMatch && distMatch[1]) {
6060
disturl = distMatch[1];
61-
//web 与 dist 同级:libsurl 若是相对路径的 web/libs,随 disturl 一起校正
61+
//相对路径的 web/libs 先去掉一层 ../,再接到 disturl 后面
6262
if (libsurl && !/^https?:\/\//i.test(libsurl) && /(?:^|\/)web\/libs\/?$/.test(libsurl)) {
63-
libsurl = disturl.replace(/\/?dist\/?$/, '') + '/web/libs';
63+
libsurl = disturl + '/' + libsurl.replace(/^\.\.\//, '');
6464
}
6565
}
6666
var includes = (targetScript.getAttribute('include') || '').split(',');

‎examples/js/include-web.js‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,10 @@
7070
//加载类库资源文件
7171
function load(config) {
7272
var libsurl = config.libsurl;
73-
//web 在 examples 上一级:libsurl 若是相对路径的 web/libs,按 basePath 校正
73+
//相对路径的 web/libs 先去掉一层 ../,再按 basePath 拼接。
74+
//默认 libsurl 按 examples/<产品>/ 的深度写(../../web/libs),en 页面更深一层,basePath 会多退一级
7475
if (libsurl && !/^https?:\/\//i.test(libsurl) && /(?:^|\/)web\/libs\/?$/.test(libsurl)) {
75-
libsurl = basePath.replace(/\/?$/, '/../') + 'web/libs';
76+
libsurl = basePath + libsurl.replace(/^\.\.\//, '');
7677
}
7778

7879
var includes = (targetScript.getAttribute('include') || "").split(",");

0 commit comments

Comments
 (0)