Skip to content

Commit bf3c06a

Browse files
committed
【fix】修复英文例子页面sidebar for产品不对的问题 review by luoxiao
1 parent edcc1d5 commit bf3c06a

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

examples/template/editor.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@
5353
var notFor = ['iClient Classic', '3D-WebGL'];
5454
var productArr = ['Leaflet', 'OpenLayers', 'MapboxGL', 'MapLibreGL', 'component', 'iClient Classic', '3D-WebGL']
5555
var path = window.location.pathname.split('/');
56-
var identification = productArr.find(name => name.toLowerCase().includes(path[2]) || name.toLowerCase().includes(path[3]));
56+
var examplesStrIndex = path.indexOf('examples');
57+
var identification = productArr.filter(function(name) { return name.toLowerCase().includes(path[examplesStrIndex + 1])})[0];
5758
if (identification) {
5859
var suffixHeader = document.getElementById('suffix-title');
5960
suffixHeader.innerText = (notFor.indexOf(identification) < 0 ? 'for ' : '') + identification;

examples/template/example.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@
4242
var notFor = ['iClient Classic', '3D-WebGL'];
4343
var productArr = ['Leaflet', 'OpenLayers', 'MapboxGL', 'MapLibreGL', 'component', 'iClient Classic', '3D-WebGL']
4444
var path = window.location.pathname.split('/');
45-
var identification = productArr.filter(function(name) { return name.toLowerCase().includes(path[2]) || name.toLowerCase().includes(path[3]) })[0];
45+
var examplesStrIndex = path.indexOf('examples');
46+
var identification = productArr.filter(function(name) { return name.toLowerCase().includes(path[examplesStrIndex + 1])})[0];
4647
if (identification) {
4748
var suffixHeader = document.getElementById('suffix-title');
4849
suffixHeader.innerText = (notFor.indexOf(identification) < 0 ? 'for ' : '') + identification;

0 commit comments

Comments
 (0)