-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
1150 lines (1000 loc) · 35.2 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
$(document).ready(function () {
let storeid = [];
let storeid_p = [];
let storec = null;
let storet = null;
let stored = null;
let storejarr = null;
let storetmp = null;
let storefunc = null;
let storetag = null;
let storeclass = null;
lightbox.option({
resizeDuration: 100,
wrapAround: true,
albumLabel: "",
});
let itemsPerBatch = 13; // 每批加载的数量
let loadedItems = 0; // 已加载的数量
let stopLoad = false; //如果点down就不触发滚动加载
let qs = window.location.search;
let up = new URLSearchParams(qs);
if (up.get("t") != null) {
storetag = up
.get("t")
.replaceAll(/%20/g, "")
.replaceAll(" ", "")
.split(",");
}else if (up.get("c") != null) {
storeclass = up
.get("c")
.replaceAll(/%20/g, "")
.replaceAll(" ", "")
.split(",");
}
fetch(
"https://docs.google.com/spreadsheets/d/e/2PACX-1vTjLHFu3SqqXZHqA5ZVrO7A1U6ozpdwn93EHlHRGY8A5AY0VlzR5xx4sCIqJ0bEJ9tHMDxGJmcZqYLL/pub?gid=655900093&single=true&output=csv"
)
.then((response) => response.text())
.then((data) => {
let flag =
(iNo =
iClass =
iTime =
iName =
iPrice =
iPackage =
iTags =
iFresh =
iAppearance =
iStatus =
iDate =
iUsers =
null);
let jarr = [];
let lines = data.split("\n");
let arr = lines[0].split(",");
for (let i = 0; i < arr.length; i++) {
switch (arr[i]) {
case "NO":
iNo = i;
break;
case "分类":
iClass = i;
break;
case "时间":
iTime = i;
break;
case "名称":
iName = i;
break;
case "总价/欧元":
iPrice = i;
break;
case "包装":
iPackage = i;
break;
case "主题分类":
iTags = i;
break;
case "新旧/全新1.0":
iFresh = i;
break;
case "外观":
iAppearance = i;
break;
case "状态":
iStatus = i;
break;
case "用户":
iUsers = i;
break;
case "更新时间":
iDate = i;
break;
default:
console.log("meet unknown ",arr[i]);
}
}
for (let i = 1; i < lines.length; i++) {
let items = lines[i].split(",");
jarr.push({
iNo: items[iNo],
iClass: items[iClass],
iTime: items[iTime],
iUsers: items[iUsers],
iName: items[iName],
iPrice: items[iPrice],
iPackage: items[iPackage],
iTags: items[iTags],
iFresh: items[iFresh],
iAppearance: items[iAppearance],
iStatus: items[iStatus],
iDate: items[iDate].replaceAll(/\r/g, ""),
});
storeid_p[parseFloat(items[iNo])] = parseFloat(items[iPrice]);
}
function isArrayInArray(arrayA, arrayB) {
for (let i = 0; i < arrayA.length; i++) {
if (arrayB.includes(arrayA[i])) {
return true;
}
}
return false;
}
if(storetag!=null){
jarr = jarr.filter((obj) => isArrayInArray(storetag,obj.iTags));
}else if(storeclass!=null){
jarr = jarr.filter((obj) => isArrayInArray(storeclass,obj.iClass));
}
storejarr = jarr;
//jarr = jarr.filter((obj) => (obj.iTime == "Now"));
jarr = jarr.filter((obj) => (obj.iStatus != "SOLD")); //按类别排序
jarr.sort(function (a, b) {
var propertyA = parseFloat(a.iPrice);
var propertyB = parseFloat(b.iPrice);
if (propertyA < propertyB) return 1;
if (propertyA > propertyB) return -1;
return 0;
});
jarr.sort(function (a, b) {
var propertyA = a.iStatus; //parseInt(a.iTags);
var propertyB = b.iStatus; //parseInt(b.iTags);
if (propertyB == "SOLD") return -1;
return 0;
});
storejarr.sort(function (a, b) {
var propertyA = a.iStatus; //parseInt(a.iTags);
var propertyB = b.iStatus; //parseInt(b.iTags);
if (propertyB == "SOLD") return -1;
return 0;
});
//不重复的标签
let uniqueTags = $.map(jarr, function (obj) {
return obj.iTags.split(" ");
})
.filter(function (element) {
return element !== "";
})
.filter(function (value, index, self) {
return self.indexOf(value) === index;
});
function moveElementsWithLettersToEnd(arr) {
const lettersRegex = /[a-zA-Z]/; // 正则表达式,用于匹配字母
const lettersElements = arr.filter((item) => lettersRegex.test(item)); // 过滤含有字母的元素
const nonLettersElements = arr.filter(
(item) => !lettersRegex.test(item)
); // 过滤不含字母的元素
return nonLettersElements.concat(lettersElements); // 将不含字母的元素和含有字母的元素合并,含有字母的元素将在最后
}
uniqueTags = moveElementsWithLettersToEnd(uniqueTags);
//不重复的类别
let uniqueClass = $.map(jarr, function (obj) {
return obj.iClass;
}).filter(function (value, index, self) {
return self.indexOf(value) === index;
});
//生成标签
//$("#cls").html(
//// $.map(uniqueClass, function (v) {
//// return (
// '<button class="btnc outline" value="' + v + '">' + v + "</button>"
// );
// }).join("")
//);
$("#tag").html(
$.map(uniqueTags, function (v) {
return (
'<button class="btnt outline" value="' + v + '">' + v + "</button>"
);
}).join("")
);
function calculateSumAtIndexes(A, B) {
var sumArray = [];
for (var i = 0; i < B.length; i++) {
var index = B[i];
if (index >= 0 && index < A.length) {
sumArray.push(A[index]);
} else {
sumArray.push(0); // 如果索引越界,则添加 0
}
}
return $.map(sumArray, (num) => num).reduce((a, b) => a + b, 0);
}
let today = new Date();
//不重复的标签
let newjarr = $.grep(jarr, function (obj) {
let tmp = obj.iDate.split("-");
return (parseInt(tmp[1]) == today.getMonth() + 1) && (parseInt(tmp[2]) + 7 > today.getDate());
});
//不重复的标签
let uniqueDayTags = $.map(newjarr, function (obj) {
return obj.iTags.split(" ");
})
.filter(function (element) {
return element !== "";
})
.filter(function (value, index, self) {
return self.indexOf(value) === index;
});
if (uniqueDayTags != "") {
$("#day").html(
$.map(moveElementsWithLettersToEnd(uniqueDayTags), function (v) {
return (
'<button class="btnt outline" value="' +
v +
'">' +
v +
"</button>"
);
}).join("")
);
$(".containerd").show();
}
if(storetag!=null||storeclass!=null){
$("#cls").append(
'<button class="btnc outline" style="display:none" id="sqhidec" value="reset">收起</button>'
);
}else{
$("#cls").append(
'<button class="btnc outline" value="price10">10欧及以上</button>' +
'<button class="btnc outline" value="price5">5~9欧</button>' +
'<button class="btnc outline" value="price1">1~4欧</button>' +
//'<button class="btnc outline" value="fresh8">八成新</button>' +
'<button class="btnc outline" value="zero">免费送</button>' +
'<button class="btnc outline" style="display:none" id="sqhidec" value="reset">收起</button>'
);
}
$("#tag").append(
'<button class="btnt outline" style="display:none" id="sqhidet" value="reset">收起</button>'
);
$("#day").append(
'<button class="btnt outline" style="display:none" id="sqhided" value="reset">收起</button>'
);
$("#containerc").on("click", ".btnc", function () {
let temp;
$(".btnc").removeClass("active");
if (event.target.value != "reset") {
$(this).addClass("active");
$("#sqhidec").show();
storec = event.target.value;
} else {
$(this).removeClass("active");
$("#sqhidec").hide();
storec = null;
}
if (event.target.value == "zero") {
temp = $.grep(jarr, function (obj) {
return obj.iPrice == 0;
});
} else if (event.target.value == "fresh") {
temp = $.grep(jarr, function (obj) {
return obj.iFresh.includes("1.0");
});
} else if (event.target.value == "fresh9") {
temp = $.grep(jarr, function (obj) {
return obj.iFresh.includes("0.9");
});
} else if (event.target.value == "price1") {
temp = $.grep(jarr, function (obj) {
return obj.iPrice > 0 && obj.iPrice < 5;
});
} else if (event.target.value == "price5") {
temp = $.grep(jarr, function (obj) {
return obj.iPrice > 4 && obj.iPrice < 10;
});
} else if (event.target.value == "price10") {
temp = $.grep(jarr, function (obj) {
return obj.iPrice >= 10;
});
} else if (event.target.value == "fresh8") {
temp = $.grep(jarr, function (obj) {
return obj.iFresh.includes("0.8");
});
} else if (event.target.value == "package") {
temp = $.grep(jarr, function (obj) {
return obj.iPackage.includes("$");
});
} else {
temp = $.grep(jarr, function (obj) {
return obj.iClass.includes(event.target.value);
});
}
//creats("#cls_content", temp, "按品类排序:", false);
loadedItems = 0;
itemsPerBatch = 10;
if (window.innerWidth < 768) {
itemsPerBatch = 5;
}
storefunc = "indexClass";
storetmp = temp;
$("#cls_content").html("");
creats("#cls_content", storetmp, "按价格排序:", true);
});
$(window).on("scroll", () => {
const scrollPosition = $(window).scrollTop();
const windowHeight = $(window).height();
const documentHeight = $(document).height();
if(!stopLoad){
if (
storefunc == "indexClass" &&
scrollPosition + windowHeight >= documentHeight - 150
) {
creats("#cls_content", storetmp, "按价格排序:", true);
} else if (
storefunc == "indexAll" &&
scrollPosition + windowHeight >= documentHeight - 150
) {
creats("#blist", storetmp, "按价格排序:", true);
} else {}
}
});
$("body").on("click", "#appendmore", function () {
if (storefunc == "indexClass") {
creats("#cls_content", storetmp, "按价格排序:", true);
} else if (storefunc == "indexAll") {
creats("#blist", storetmp, "按价格排序:", true);
} else {
}
});
$("#containert").on("click", ".btnt", function () {
$(".btnt").removeClass("active");
if (event.target.value != "reset") {
$("#sqhidet").show();
$(this).addClass("active");
storet = event.target.value;
} else {
$(this).removeClass("active");
$("#sqhidet").hide();
storet = null;
}
let temp = $.grep(jarr, function (obj) {
return obj.iTags.includes(event.target.value);
});
creats("#tag_content", temp, "按价格排序:", false);
//$("#olist").show();
});
$("#containerd").on("click", ".btnt", function () {
$(".btnt").removeClass("active");
if (event.target.value != "reset") {
$("#sqhided").show();
$(this).addClass("active");
stored = event.target.value;
} else {
$(this).removeClass("active");
$("#sqhided").hide();
$(".day_content").hide();
stored = null;
}
let temp = $.grep(jarr, function (obj) {
let tp = obj.iDate.split("-");
return (
obj.iTags.includes(event.target.value) &&
(parseInt(tp[1]) == today.getMonth() + 1) && (parseInt(tp[2]) + 7 > today.getDate())
);
});
creats("#day_content", temp, "<br>按价格排序:", false);
//$("#olist").show();
});
// 点击加号
$("body").on("click", ".icon-overlay", function () {
let val = $(this).attr("value");
let val_p = parseFloat($(this).attr("value_p"));
let isAdding = JSON.parse($(this).attr("flag"));
$(this).toggleClass("icon-clicked");
if (isAdding) {
if (!storeid.includes(val)) {
storeid.push(val);
creats(
"#olist",
jarr.filter((obj) => storeid.includes(obj.iNo)),
"<b>物品总价:€ " +
calculateSumAtIndexes(storeid_p, storeid) +
"<br>物品编号:" +
storeid.toString().replaceAll(",", ", ") +
"</b>",
false
);
}
} else {
if (storeid.length > 0) {
storeid = storeid.filter((element) => element !== val);
creats(
"#olist",
jarr.filter((obj) => storeid.includes(obj.iNo)),
"<b>物品总价:€ " +
calculateSumAtIndexes(storeid_p, storeid) +
"<br>物品编号:" +
storeid.toString().replaceAll(",", ", ") +
"</b>",
false
);
if (storeid.length == 0) {
$("#olist").html("已选物品:无");
updateTextWithColorChange(0, storeid.length, "#dtxt");
}
let xtmp;
//console.log(storet,storec);
if (storet != null) {
xtmp = $.grep(jarr, function (obj) {
return obj.iTags.includes(storet);
});
creats("#tag_content", xtmp, "按价格排序:", false);
}
//console.log(stored,storec);
if (stored != null) {
xtmp = $.grep(jarr, function (obj) {
return (
obj.iTags.includes(stored) &&
obj.iDate.includes(
[
today.getFullYear(),
today.getMonth() + 1,
today.getDate(),
].join("-")
)
);
});
creats("#day_content", xtmp, "<br>按价格排序:", false);
}
if (storec != null && storec == "all") {
creats("#blist", jarr, "按价格排序:", false);
} else {
if (storec == "zero") {
xtmp = $.grep(jarr, function (obj) {
return obj.iPrice == 0;
});
} else if (storec == "fresh") {
xtmp = $.grep(jarr, function (obj) {
return obj.iFresh.includes("1.0");
});
} else if (storec == "fresh9") {
xtmp = $.grep(jarr, function (obj) {
return obj.iFresh.includes("0.9");
});
} else if (storec == "fresh8") {
xtmp = $.grep(jarr, function (obj) {
return obj.iFresh.includes("0.8");
});
} else if (storec == "package") {
xtmp = $.grep(jarr, function (obj) {
return obj.iPackage.includes("$");
});
} else {
xtmp = $.grep(jarr, function (obj) {
return obj.iClass.includes(storec);
});
}
creats("#cls_content", xtmp, "按价格排序:", false);
}
}
}
$(this).attr("flag", !isAdding);
});
$(".inav").removeClass("actblack");
$("#anav").click(function () {
$("#alist").html("");
$(".inav").removeClass("actblack");
$(this).addClass("actblack");
$(".text").hide();
$("#alist").show();
$("#alist").append(
"序号, 用户, 分类, 新旧/全新1.0, 名称, 总价/欧元, 可售时间, 包装, 主题分类, 外观, 状态, <br>"
);
//conso//le.log(jarr);
for (let i = 0; i < storejarr.length; i++) {
let no = storejarr[i].iNo;
if (parseInt(no) < 10) no = "00" + no;
else if (parseInt(no) < 100) no = "0" + no;
if (storejarr[i].iStatus == "SOLD")
$("#alist").append(
"<span style='color:red'>No." +
no +
", " +
storejarr[i].iUsers +
", " +
storejarr[i].iClass +
", " +
getFresh2(storejarr[i].iFresh) +
", " +
storejarr[i].iName +
", " +
storejarr[i].iPrice +
", " +
storejarr[i].iTime +
", " +
storejarr[i].iPackage +
", " +
storejarr[i].iTags +
", " +
storejarr[i].iAppearance +
", " +
storejarr[i].iStatus +
", </span><br>"
);
else
$("#alist").append(
"No." +
no +
", " +
storejarr[i].iUsers +
", " +
storejarr[i].iClass +
", " +
getFresh2(storejarr[i].iFresh) +
", " +
storejarr[i].iName +
", " +
storejarr[i].iPrice +
", " +
storejarr[i].iTime +
", " +
storejarr[i].iPackage +
", " +
storejarr[i].iTags +
", " +
storejarr[i].iAppearance +
", " +
storejarr[i].iStatus +
", <br>"
);
}
$("#enav").attr(
"href",
"https://translate.google.com/translate?sl=auto&tl=en&u=https://u2s.glitch.me/csv.html"
);
$("#enav").show();
if (isWeChatBrowser()) {
$("#enav").hide();
}
});
$("#bnav").click(function () {
itemsPerBatch = 13;
if (window.innerWidth < 768) {
itemsPerBatch = 5;
}
loadedItems = 0;
storefunc = "indexAll";
storec = "all";
$(".inav").removeClass("actblack");
$(this).addClass("actblack");
$(".text").hide();
$("#enav").attr(
"href",
"https://translate.google.com/translate?sl=auto&tl=en&u=https://u2s.glitch.me/all.h_tml"
);
$("#enav").show();
$("#blist").html("");
$("#blist").show();
// 检测滚动事件,当用户接近底部时触发加载更多内容
storetmp = jarr;
creats("#blist", storetmp, "按价格排序:", true);
if (isWeChatBrowser()) {
$("#enav").hide();
}
});
$("#cnav").click(function () {
$(".inav").removeClass("actblack");
$(this).addClass("actblack");
$(".text").hide();
$("#clist").show();
$("#enav").hide();
//$("#olist").show();
});
$("#dnav").click(function () {
$(".inav").removeClass("actblack");
$(this).addClass("actblack");
$("#alist").hide();
$("#blist").hide();
$("#clist").hide();
$("#olist").show();
});
function getFresh(number) {
const chineseNumberMap = {
1: "一成新",
2: "二成新",
3: "三成新",
4: "四成新",
5: "五成新",
6: "六成新",
7: "七成新",
8: "八成新",
9: "九成新",
10: "全新",
};
return chineseNumberMap[number * 10] || "";
}
function getFresh2(number) {
const chineseNumberMap = {
1: "一成新",
2: "二成新",
3: "三成新",
4: "四成新",
5: "五成新",
6: "六成新",
7: "七成新",
8: "八成新",
9: "九成新",
10: "完全新",
};
return chineseNumberMap[number * 10] || "";
}
// 更新文本内容并添加颜色变化效果
function updateTextWithColorChange(newText, id) {
$(id).css("transition", "color 1s");
$(id).css("color", "red");
$(id).text(newText);
setTimeout(function () {
$(id).css("color", "");
$(id).css("transition", "");
}, 1000); // 1000 毫秒 = 1 秒
}
function creats(ct, tmp, txt, mx) {
let tmp_l = tmp.length;
let htmltext = "";
txt = '<span class="orders" style="font-size: 13px">' + txt + "</span><br><br>";
if (mx) {
tmp = tmp.slice(loadedItems, loadedItems + itemsPerBatch);
//console.log(tmp);
if (tmp.length == 0 || loadedItems != 0) txt = "";
} else {
if (tmp.length == 0) txt = "";
}
let gray = "";
if (window.innerWidth < 768) {
htmltext =
txt +
$.map(tmp, function (v) {
let pt = v.iPrice;
if (v.iTime == "Oct") pt = v.iPrice + " / get it after 10.1";
if (v.iStatus == "SOLD"){
gray = " style='filter: grayscale(80%) contrast(0.5);' ";//pointer-events: none;
pt = v.iPrice + "<span> × SOLD</span>";
}else{
gray = "";
}
let no = v.iNo;
if (parseInt(no) < 10) no = "00" + no;
else if (parseInt(no) < 100) no = "0" + no;
let trr = v.iAppearance.split(" ");
let htm =
'<div '+ gray +' class="iboxLine">' +
$.map(trr, function (e) {
if (e == "") e = "00000";
//else if (e.indexOf("X") < 0) e = e + ".jpg";
//else e = e + ".png";
return (
'<a href="https://cdn.jsdelivr.net/gh/zonelyn/img/' +
e +
'" data-lightbox="image-1" data-title="' +
v.iName +" / "+
" €" +
v.iPrice +
'">' +
'<img class="img" src="https://cdn.jsdelivr.net/gh/zonelyn/img/' +
e +
'" /></a>'
);
}).join("");
let clk_flag = true;
let clk_url =
"https://cdn.glitch.global/f1c7b686-0e39-43f2-8186-adb49d7f1137/pluss.png?v=1692143457820";
if ($.inArray(v.iNo, storeid) !== -1) {
clk_flag = false;
clk_url =
"https://cdn.glitch.global/f1c7b686-0e39-43f2-8186-adb49d7f1137/okk.png?v=1692145326322";
}
htm +=
'<div'+ gray +' class="text-overlay"><b><span class="intro">No.' +
no +
"</span><br><span class='intro'>" +
v.iName +
"</span><br>";
if (v.iTags != "") {
htm +=
" <span class='intro'>" +
getFresh(v.iFresh) +
" / " +
$.map(v.iTags.split(" "), function (e) {
return e;
}).join(" / ") +
"</span><br>";
}
htm += '<span class="intro" style="color:#FF9595">€' + pt + "</span></div>";
htm +=
'<div class="text-overlay-user"><b><span style="color:#00000080">#' +
v.iUsers +
"**</span></div>";
if (v.iStatus != "SOLD" && storetag==null && storeclass==null )
htm +=
'<img style="background-color:white" value="' +
v.iNo +
'" value_p="' +
v.iPrice +
'" class="icon-overlay" flag="' +
clk_flag +
'" src="' +
clk_url +
'"/>';
htm += "</b></div>";
return htm;
}).join(" ");
} else {
htmltext =
txt +
$.map(tmp, function (v) {
let pt = v.iPrice;
let tags = "";
//if (v.iFresh == "1.0") tags += "[全新] ";
//if (v.iPackage == "$") tags += "[带包装] ";
if (v.iTime == "Oct") pt = v.iPrice + " / get it after 10.1";
if (v.iStatus == "SOLD"){
gray = " style='filter: grayscale(80%) contrast(0.5);'";//pointer-events: none;
pt = v.iPrice + "<span> × SOLD</span>";
}else{
gray = "";
}
let no = v.iNo;
if (parseInt(no) < 10) no = "00" + no;
else if (parseInt(no) < 100) no = "0" + no;
let trr = v.iAppearance.split(" ");
let tmphtm = "<br>";
if (v.iTags != "") {
tmphtm +=
"<span class='intro'>" +
$.map(v.iTags.split(" "), function (e) {
return e;
}).join(" / ") +
"</span>";
}
let htm =
'<div '+ gray +' class="ibox">' +
$.map(trr, function (e) {
if (e == "") e = "00000";
//else if (e.indexOf("X") < 0) e = e + ".jpg";
//else e = e + ".png";
return (
'<a href="https://cdn.jsdelivr.net/gh/zonelyn/img/' +
e +
'" data-lightbox="image-1" data-title="' +
"No." +
v.iNo +
" / " +
v.iName +" / "+
" €" +
v.iPrice +
'">' +
'<img src="https://cdn.jsdelivr.net/gh/zonelyn/img/' +
e +
'" /></a>'
);
}).join("") +
'<br><span class="intro">' +
v.iName +
"</span>" +
tmphtm +
'<br><span class="intro" style="color:#FF9595"><b>€ ' +
pt +
"</b></span>";
if (tags != "") {
htm += " <span class='intro'>" + tags + "</span>";
}
let clk_flag = true;
let clk_url =
"https://cdn.glitch.global/f1c7b686-0e39-43f2-8186-adb49d7f1137/pluss.png?v=1692143457820";
if ($.inArray(v.iNo, storeid) !== -1) {
clk_flag = false;
clk_url =
"https://cdn.glitch.global/f1c7b686-0e39-43f2-8186-adb49d7f1137/okk.png?v=1692145326322";
}
htm += '<div '+ gray +' class="text-overlay"><span>' + no + "</span></div>";
if (v.iStatus != "SOLD" && storetag==null && storeclass==null )
htm +=
'<img style="background-color:white" value="' +
v.iNo +
'" value_p="' +
v.iPrice +
'" class="icon-overlay" flag="' +
clk_flag +
'" src="' +
clk_url +
'"/>';
//htm +=
// '<div class="text-overlay-user" style="font-size:5px !important;color:#00000080;bottom:4px !important;right:4px !important;"><b><span>#' +
// v.iUsers +
// "**</span></div>";
htm += "</div>";
return htm;
}).join(" ");
}
if (mx) {
loadedItems += itemsPerBatch;
$(".jump-text").hide();
let iimg = "<img style='margin-bottom:-2px;height:13px' class='ldimg loadimg' src='https://cdn.glitch.global/f1c7b686-0e39-43f2-8186-adb49d7f1137/loading.gif?v=1691874362695' />";
if (isWeChatBrowser()) {iimg = "";}
if (loadedItems < tmp_l) {
htmltext +=
"<div class='jump-text' style='margin-bottom:15px;'>" +
iimg +
"<a id='appendmore' value='" +
loadedItems +
"' style='text-decoration:none;cursor:pointer'>" +
"<span class='ldimg' style='font-size:13px;margin-right:10px'> scroll or click here to load more items." +
"</span></a></div>";
}
$(ct).append(htmltext);
} else $(ct).html(htmltext);
updateTextWithColorChange(storeid.length, "#dtxt");
//updateTextWithColorChange(" scroll or click to load more items.", ".ldimg");
}
$("#olist").hide();
let currentDate = new Date();
let count = jarr.filter(function (obj) {
return obj.iStatus == "SOLD";
}).length;
if(storetag!=null||storeclass!=null){
$("#bnav").click();
$("#cnt").html(
"当前总量: " +
jarr.length +
"(" +
count +
"), 自取地址: <a href='https://maps.app.goo.gl/1xSBcypjtKVDYpbz5' style='color:blue'>3552AS</a> <a style='float:right'>更新: " +
currentDate.toDateString() +
"</a>"
);
$("#cnt").hide();
$(".navbar").hide();
$(".orders").hide();
$(".bluelist").hide();
$("#downBtnss").hide();
$("#downBtn").hide();
$(".icon-overlay").hide();
$(".body-content").css("padding-top", "0px");
}else if(up.get("v") != null){
$(".inav").removeClass("actblack");
$("#dnav").addClass("actblack");
storeid = up
.get("v")
.replaceAll(/%20/g, "")
.replaceAll(" ", "")
.split(",");
//console.log(storeid);
storejarr = storejarr.filter((obj) => storeid.includes(obj.iNo));
creats(
"#olist",
storejarr,
"<b>物品总价:€ <span id='countall'></span>" +
"<br>物品编号:" +
storeid.toString().replaceAll(",", ", ") +
"</b>",
false ); $("#alist").hide();
$("#blist").hide();
$("#clist").hide();
$("#olist").show();
$("#elist").show();
$("#countall").html("<b>"+ calculateSumAtIndexes(storeid_p, storeid) +"</b>");
$("#cnav").hide();