zz-shopify-components 0.0.3 → 0.0.5
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/blocks/zz-accessories-item.liquid +3 -1
- package/blocks/zz-button.liquid +3 -1
- package/blocks/zz-flex-layout-bg-block.liquid +3 -1
- package/blocks/zz-ratio-image.liquid +3 -1
- package/blocks/zz-responsive-width-image.liquid +3 -1
- package/blocks/zz-video-swiper-perview-item.liquid +3 -1
- package/package.json +1 -1
- package/sections/zz-navigation-tab-v3.liquid +3 -1
- package/sections/zz-navigation-tab.liquid +3 -1
- package/assets/site-jump.js +0 -52
- package/assets/site-jumpV2.js +0 -35
|
@@ -70,7 +70,9 @@
|
|
|
70
70
|
document.addEventListener('DOMContentLoaded', (event) => {
|
|
71
71
|
const btns = document.querySelectorAll('.{{ btn_class }}')
|
|
72
72
|
if(btns && btns[0]) {
|
|
73
|
-
bindSiteJump
|
|
73
|
+
if(window.bindSiteJump) {
|
|
74
|
+
bindSiteJump(btns[0], {{ block.settings.links | json }})
|
|
75
|
+
}
|
|
74
76
|
}
|
|
75
77
|
|
|
76
78
|
})
|
package/blocks/zz-button.liquid
CHANGED
|
@@ -182,7 +182,9 @@
|
|
|
182
182
|
});
|
|
183
183
|
});
|
|
184
184
|
{% if block.settings.function_type == 'link_map' %}
|
|
185
|
-
bindSiteJump
|
|
185
|
+
if(window.bindSiteJump) {
|
|
186
|
+
bindSiteJump(btn[0], {{ block.settings.links | json }})
|
|
187
|
+
}
|
|
186
188
|
{% endif %}
|
|
187
189
|
}
|
|
188
190
|
|
|
@@ -508,7 +508,9 @@
|
|
|
508
508
|
const btn = document.getElementsByClassName('{{ layout_class }}')
|
|
509
509
|
if(btn && btn[0]) {
|
|
510
510
|
{% if block.settings.function_type == 'link_map' %}
|
|
511
|
-
bindSiteJump
|
|
511
|
+
if(window.bindSiteJump) {
|
|
512
|
+
bindSiteJump(btn[0], {{ block.settings.links | json }})
|
|
513
|
+
}
|
|
512
514
|
{% else %}
|
|
513
515
|
// 监听点击事件
|
|
514
516
|
btn[0].addEventListener('click', (event) => {
|
|
@@ -153,7 +153,9 @@
|
|
|
153
153
|
const btn = document.getElementsByClassName('{{ link_class }}')
|
|
154
154
|
if(btn && btn.length > 0) {
|
|
155
155
|
Array.from(btn).forEach(item => {
|
|
156
|
-
bindSiteJump
|
|
156
|
+
if(window.bindSiteJump) {
|
|
157
|
+
bindSiteJump(item, {{ block.settings.links | json }})
|
|
158
|
+
}
|
|
157
159
|
})
|
|
158
160
|
}
|
|
159
161
|
})
|
|
@@ -206,7 +206,9 @@
|
|
|
206
206
|
const btn = document.getElementsByClassName('{{ image_class }}')
|
|
207
207
|
if(btn && btn[0]) {
|
|
208
208
|
{% if block.settings.function_type == 'link_map' %}
|
|
209
|
-
bindSiteJump
|
|
209
|
+
if(window.bindSiteJump) {
|
|
210
|
+
bindSiteJump(btn[0], {{ block.settings.links | json }})
|
|
211
|
+
}
|
|
210
212
|
{% else %}
|
|
211
213
|
// 监听点击事件
|
|
212
214
|
btn[0].addEventListener('click', (event) => {
|
|
@@ -204,7 +204,9 @@
|
|
|
204
204
|
const btn = document.getElementsByClassName('{{ media_class }}')
|
|
205
205
|
if(btn && btn[0]) {
|
|
206
206
|
{% if block.settings.function_type == 'link_map' %}
|
|
207
|
-
bindSiteJump
|
|
207
|
+
if(window.bindSiteJump) {
|
|
208
|
+
bindSiteJump(btn[0], {{ block.settings.links | json }})
|
|
209
|
+
}
|
|
208
210
|
{% else %}
|
|
209
211
|
// 监听点击事件
|
|
210
212
|
btn[0].addEventListener('click', (event) => {
|
package/package.json
CHANGED
|
@@ -321,7 +321,9 @@
|
|
|
321
321
|
});
|
|
322
322
|
});
|
|
323
323
|
{% if section.settings.btn_function_type == 'link_map' %}
|
|
324
|
-
bindSiteJump
|
|
324
|
+
if(window.bindSiteJump) {
|
|
325
|
+
bindSiteJump(btn, {{ section.settings.links | json }})
|
|
326
|
+
}
|
|
325
327
|
{% endif %}
|
|
326
328
|
})
|
|
327
329
|
|
|
@@ -333,7 +333,9 @@
|
|
|
333
333
|
});
|
|
334
334
|
});
|
|
335
335
|
{% if section.settings.btn_function_type == 'link_map' %}
|
|
336
|
-
bindSiteJump
|
|
336
|
+
if(window.bindSiteJump) {
|
|
337
|
+
bindSiteJump(btn, {{ section.settings.links | json }})
|
|
338
|
+
}
|
|
337
339
|
{% endif %}
|
|
338
340
|
})
|
|
339
341
|
|
package/assets/site-jump.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
// 用来处理多国家多跳转的问题
|
|
2
|
-
// el: 传入的元素
|
|
3
|
-
// links: 站点地图文本
|
|
4
|
-
|
|
5
|
-
var bindSiteJump = bindSiteJump
|
|
6
|
-
? bindSiteJump
|
|
7
|
-
: function bindSiteJump(el, links) {
|
|
8
|
-
if (!el || !links) {
|
|
9
|
-
console.log('SiteJump: el and links are required');
|
|
10
|
-
return;
|
|
11
|
-
// throw new Error('SiteJump: el and links are required');
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const SITE_JUMP_MAP = links;
|
|
15
|
-
const arr = SITE_JUMP_MAP.split('\n'); // 按换行符拆分为数组
|
|
16
|
-
const siteMap = {};
|
|
17
|
-
// 将站点地图解析成对象
|
|
18
|
-
arr.forEach((item) => {
|
|
19
|
-
const [key, value] = item.split(': ');
|
|
20
|
-
if (key && value) {
|
|
21
|
-
siteMap[key.trim()] = value.trim();
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
document.addEventListener('DOMContentLoaded', function (event) {
|
|
26
|
-
const countryElement =
|
|
27
|
-
document.getElementsByClassName('countryWord')[0];
|
|
28
|
-
const country = countryElement.innerText.trim();
|
|
29
|
-
const targetUrl = siteMap[country] || siteMap['default'] || '/';
|
|
30
|
-
if (el.tagName.toLowerCase() === 'a') {
|
|
31
|
-
if (countryElement) {
|
|
32
|
-
el.href = targetUrl;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
// 绑定点击事件
|
|
38
|
-
el.onclick = () => {
|
|
39
|
-
console.log(123412342);
|
|
40
|
-
|
|
41
|
-
const countryElement =
|
|
42
|
-
document.getElementsByClassName('countryWord')[0];
|
|
43
|
-
if (countryElement) {
|
|
44
|
-
const country = countryElement.innerText.trim();
|
|
45
|
-
const targetUrl = siteMap[country] || siteMap['default'] || '/';
|
|
46
|
-
// window.location.href = targetUrl; // 跳转到匹配的站点
|
|
47
|
-
toSubSiteBP(targetUrl);
|
|
48
|
-
} else {
|
|
49
|
-
console.error('SiteJump: Country element not found');
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
};
|
package/assets/site-jumpV2.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
// 用来处理多国家多跳转的问题
|
|
2
|
-
// el: 传入的元素
|
|
3
|
-
// links: 站点地图文本
|
|
4
|
-
|
|
5
|
-
var bindSiteJump = bindSiteJump
|
|
6
|
-
? bindSiteJump
|
|
7
|
-
: function bindSiteJump(el, links) {
|
|
8
|
-
if (!links) {
|
|
9
|
-
console.log('SiteJump: links are required');
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const SITE_JUMP_MAP = links;
|
|
14
|
-
console.log(SITE_JUMP_MAP, 'SITE_JUMP_MAP');
|
|
15
|
-
const arr = SITE_JUMP_MAP.split('\n'); // 按换行符拆分为数组
|
|
16
|
-
const siteMap = {};
|
|
17
|
-
// 将站点地图解析成对象
|
|
18
|
-
arr.forEach((item) => {
|
|
19
|
-
const [key, value] = item.split(': ');
|
|
20
|
-
if (key && value) {
|
|
21
|
-
siteMap[key.trim()] = value.trim();
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
const countryElement =
|
|
26
|
-
document.getElementsByClassName('countryWord')[0];
|
|
27
|
-
if (countryElement) {
|
|
28
|
-
const country = countryElement.innerText.trim();
|
|
29
|
-
const targetUrl = siteMap[country] || siteMap['default'] || '/';
|
|
30
|
-
// 加跟踪参数并跳转到匹配的站点
|
|
31
|
-
toSubSiteBP(targetUrl);
|
|
32
|
-
} else {
|
|
33
|
-
console.error('SiteJump: Country element not found');
|
|
34
|
-
}
|
|
35
|
-
};
|