class CollectionProduct extends HTMLElement{ constructor(){ super(); this.totalPage = 0; this.containerHeight = 0; this.perRow = this.dataset.row; this.limit = this.dataset.limit; this.viewmore = this.dataset.viewmore; this.layout = (this.dataset.layout) ? '-' + this.dataset.layout : ''; this.tagsFilter = []; this.currentPage = 1; this.initData(); this.length = this.data.length; this.progress = 0; this.parser = new DOMParser(); this.productsContainer = this.getElementsByClassName('products-container')[0]; this.collectionGrid = document.getElementsByClassName('collection-grid__wrapper')[0]; this.filterContainer = document.getElementsByClassName('grid__item--sidebar')[0]; this.submitFilter = document.getElementsByClassName('submitTagsFilter'); this.btnOpenFilterMobile = document.getElementsByClassName('js-drawer-open-collection-filters')[0]; if(this.btnOpenFilterMobile != undefined) { this.btnOpenFilterText = this.btnOpenFilterMobile.querySelector(".btn-filter-text"); } Array.from(this.submitFilter).forEach(function(btn){ btn.addEventListener("click", this.actionSubmitFilter.bind(this)); }, this); this.tagListActive = document.querySelectorAll('#CollectionSidebar-v2 .tag-list--active-tags'); if(this.filterContainer != undefined) { this.filterItems = this.filterContainer.querySelectorAll('.tag span'); Array.from(this.filterItems).forEach(function(element){ element.addEventListener("click", this.getTagsFilter.bind(this)); }, this); } if(this.viewmore == '' || !this.viewmore) { this.createPagination(); }else { this.createViewMore(); } } initData(){ this.data = []; let p = ''; try{ p = JSON.parse('{"handle":"hd-mini-camera-audio-recorder-10hrs-battery-use","title":"USB Mini Camera Audio Recorder 10hrs Battery Use","status":"ACTIVE","tags":["Application_No App","Battery Capacity_320 mAh","Camera Type_Black Box","Camera Type_Hidden","Camera Type_Mini","Camera Type_Spy Camera","Camera Type_Wearable","Collection_Spy Camera","Features_Construction Time Lapse","Features_Motion Activated","Features_No Phone Required","Field Of View_0 - 90 degrees","Location_Body Worn","Location_Indoor","Location_Office \/ Business","Location_Outdoor","OS Compatibility_Windows","Power Source_Battery","Recording Source_Audio + Video","Storage - Maximum Capacity_128 Gb (16 Hrs Recording)","Storage Type_Memory Card","Video Resolution - Max_HD 720p","Viewing_Memory Card Storage"]}'); this.data.push(p); p = JSON.parse('{"handle":"mobile-phone-wireless-charger-clock-inbuilt-security-camera","title":"Wireless Charger Camera Clock","status":"ACTIVE","tags":["Brand_Awaretech","Camera Type_Charging Dock","Camera Type_Clock","Camera Type_Hidden","Camera Type_Nanny","Camera Type_Spy Camera","Collection_Spy Camera","Connectivity_WiFi\/Wireless","Features_Motion Activated","Live View_View Live Video","Location_Dining Room","Location_Indoor","Location_Office \/ Business","Location_Warehouse","OS Compatibility_Android","OS Compatibility_IOS","OS Compatibility_Windows","Power Source_Battery","Power Source_Plug In","Recording Source_Audio + Video","Storage Type_Cloud Recording (In-App)","Storage Type_Memory Card","Video Resolution - Max_Full HD 1080p","Viewing_Remote View"]}'); this.data.push(p); p = JSON.parse('{"handle":"smoke-detector-hidden-camera-wifi-enabled","title":"[Tuya Series] Smoke Detector Hidden Camera - WiFi Enabled","status":"ACTIVE","tags":["Application_IOT Living","Battery Capacity_10000 mAH","Brand_Awaretech","Camera Megapixels_2MP","Camera Type_Hidden","Camera Type_Nanny","Camera Type_Smoke Detector","Camera Type_Spy Camera","Collection_Spy Camera","Connectivity_WiFi\/Wireless","Features_App Push Notification","Features_Motion Activated","Features_Smartphone App","Field Of View_120 - 180-degree","Lens_2 mega pixels","Live View_View Live Video","Location_Dining Room","Location_Indoor","Location_Living Room","Location_Office \/ Business","Night Vision Range_0-10 Metres","Night Vision_Night Vision Enabled","OS Compatibility_Android","OS Compatibility_IOS","OS Compatibility_Windows","Power Source_Battery","Power Source_Plug In","Recording Source_Audio + Video","Sensor_CMOS","Storage - Maximum Capacity_128 Gb (16 Hrs Recording)","Storage Type_Cloud Recording (In-App)","Storage Type_Memory Card","Video Resolution - Max_Full HD 1080p","Viewing_Remote View","Zoom_Digital"]}'); this.data.push(p); p = JSON.parse('{"handle":"power-bank-with-hidden-hd-camera-and-mic-fast-charging","title":"Power Bank with Hidden HD Camera and Mic - Portable Fast Charging","status":"ACTIVE","tags":["Application_IOT Living","Brand_Awaretech","Camera Type_Hidden","Camera Type_Mini","Camera Type_Nanny","Camera Type_Powerbank","Camera Type_Spy Camera","Camera Type_Surveillance","Collection_Spy Camera","Connectivity_WiFi\/Wireless","Features_Motion Activated","Features_Smartphone App","Live View_View Live Video","Location_Indoor","Location_Living Room","Location_Office \/ Business","OS Compatibility_Android","OS Compatibility_IOS","OS Compatibility_Windows","Power Source_Battery","Recording Source_Audio + Video","Storage - Maximum Capacity_64 Gb (8 Hrs Recording)","Storage Type_Cloud Recording (In-App)","Storage Type_Memory Card","Video Resolution - Max_Full HD 1080p","Viewing_Remote View"]}'); this.data.push(p); p = JSON.parse('{"handle":"hd-pen-camera-audio-recorder-5-5hrs-battery-use","title":"Micro HD Pen Camera Audio Recorder-longest battery Use","status":"ACTIVE","tags":["Application_No App","Battery Capacity_160 mAh","Camera Type_Hidden","Camera Type_Mini","Camera Type_Nanny","Camera Type_Pen","Camera Type_Spy Camera","Camera Type_Wearable","Collection_Spy Camera","Features_No Phone Required","Field Of View_0 - 90 degrees","Location_Body Worn","Location_Indoor","Location_Office \/ Business","Location_Outdoor","OS Compatibility_Windows","Power Source_Battery","Recording Source_Audio + Video","Storage - Maximum Capacity_128 Gb (16 Hrs Recording)","Storage Type_Memory Card","Video Resolution - Max_HD 720p","Viewing_Memory Card Storage"]}'); this.data.push(p); p = JSON.parse('{"handle":"checkmate\u2122-infidelity-home-test-kit","title":"CheckMate\u2122 Infidelity Home Test Kit","status":"ACTIVE","tags":["Featured","Infidelity Detection Kits","Personal Security"]}'); this.data.push(p); p = JSON.parse('{"handle":"lawmate-rd-30-bug-hidden-camera-detector","title":"LawMate\u2122 RD-30 Bug & Hidden Camera Detector","status":"ACTIVE","tags":["Brand_LawMate","Collection_Bug Detectors","Detector Type_Audio Detector","Detector Type_Camera Detector","Detector Type_Wireless Frequency Detector","Power Source_Battery"]}'); this.data.push(p); p = JSON.parse('{"handle":"hd-1080p-mini-black-box-rotatable-security-wi-fi-camera","title":"HD 1080P Mini Black Box Rotatable Security Wi-Fi Camera","status":"ACTIVE","tags":["Battery Capacity_950 mAh","Camera Type_Black Box","Camera Type_Hidden","Camera Type_Spy Camera","Camera Type_Surveillance","Collection_Spy Camera","Connectivity_WiFi\/Wireless","Features_Motion Activated","Features_Smartphone App","Field Of View_120 - 180-degree","Live View_View Live Video","Location_Indoor","Location_Living Room","Location_Office \/ Business","Night Vision_Night Vision Enabled","OS Compatibility_Android","OS Compatibility_IOS","Power Source_Battery","Power Source_Plug In","Recording Source_Audio + Video","Storage - Maximum Capacity_128 Gb (16 Hrs Recording)","Storage Type_Cloud Recording (In-App)","Storage Type_Memory Card","Video Resolution - Max_Full HD 1080p","Viewing_Remote View"]}'); this.data.push(p); p = JSON.parse('{"handle":"4g-magnetic-gps-tracker","title":"4G Magnetic GPS Tracker","status":"ACTIVE","tags":["Application_Winnes GPS","Battery Capacity_10000 mAh","Collection_GPS Trackers","Colour_Black","Connectivity_4G Sim Enabled","Fleet Monitoring_In app monitoring","GPS Accuracy_0-5 meters","Mount_Free standing","OS Compatibility_Windows","Power Source_Battery","Storage - Maximum Capacity_256 Mb","Storage Type_Cloud Storage","Tracker Features_Compact","Tracker Features_Driver Monitorig","Tracker Features_Geo-Fence Alarm","Tracker Features_Magnetic","Tracker Features_Portable","Tracker Features_Sim Card Slot","Tracker Features_Wireless","Tracker Type_Car GPS","Viewing_Remote View"]}'); this.data.push(p); p = JSON.parse('{"handle":"lawmate-pv-rc200hdw-wifi-enabled-key-fob-spy-camera","title":"LawMate\u00ae PV-RC200HDW WiFi Enabled Key Fob Spy Camera","status":"ACTIVE","tags":["Application_PV Cam Viewer","Battery Capacity_650 mAh","Brand_LawMate\u00ae","Camera Megapixels_5MP","Camera Type_Car Key FOB & Chain","Camera Type_Hidden","Camera Type_Mini","Camera Type_Spy Camera","Camera Type_Wearable","Collection_Spy Camera","Connectivity_WiFi\/Wireless","Features_App Push Notification","Features_Motion Activated","Features_Smartphone App","Field Of View_0 - 90 degrees","Lens_3 mega piexels 1\/3''","Live View_View Live Video","Location_Indoor","Location_Office \/ Business","Location_Outdoor","Location_vehicle","Location_Warehouse","Night Vision Range_0-10 Metres","OS Compatibility_Android","OS Compatibility_IOS","OS Compatibility_Windows","Power Source_Battery","Recording Source_Audio + Video","Sensor_CMOS","Storage - Maximum Capacity_32 Gb (4 Hrs Recording)","Storage Type_Memory Card","Storage Type_NVR\/DVR","Video Resolution - Max_Full HD 1080p","Viewing_Memory Card Storage","Zoom_Digital"]}'); this.data.push(p); p = JSON.parse('{"handle":"lawmate-pv-rc200hd2kr-key-fob-camera","title":"LawMate\u00ae PV-RC200HD2(KR) Key Fob Camera","status":"ACTIVE","tags":["Application_PV Cam Viewer","Battery Capacity_650 mAh","Brand_LawMate\u00ae","Camera Megapixels_5MP","Camera Type_Car Key FOB & Chain","Camera Type_Hidden","Camera Type_Mini","Camera Type_Spy Camera","Camera Type_Wearable","Collection_Spy Camera","Connectivity_WiFi\/Wireless","DIY_DIY","Features_App Push Notification","Features_Motion Activated","Features_Smartphone App","Field Of View_0 - 90 degrees","Lens_5 mega pixels","Live View_View Live Video","Location_Indoor","Location_Living Room","Location_Office \/ Business","Location_Outdoor","Location_vehicle","Night Vision Range_0-10 Metres","OS Compatibility_Android","OS Compatibility_IOS","OS Compatibility_Windows","Power Source_Battery","Recording Source_Audio + Video","Sensor_CMOS","Storage - Maximum Capacity_32 Gb (4 Hrs Recording)","Storage Type_Memory Card","Storage Type_NVR\/DVR","Video Resolution - Max_Full HD 1080p","Viewing_Memory Card Storage","Zoom_Digital"]}'); this.data.push(p); p = JSON.parse('{"handle":"lawmate-rd-10-bug-hidden-camera-detector","title":"LawMate\u2122 RD-10 Bug & Hidden Camera Detector","status":"ACTIVE","tags":["Brand_LawMate","Collection_Bug Detectors","Detector Type_Camera Detector","Detector Type_Wireless Frequency Detector","Power Source_Battery"]}'); this.data.push(p); p = JSON.parse('{"handle":"lawmate-pv-dy20i-diy-hidden-camera-dvr","title":"LawMate\u00ae PV-DY20i DIY Hidden Camera DVR","status":"ACTIVE","tags":["Application_PV Cam Viewer","Battery Capacity_500 mAH","Brand_LawMate\u00ae","Camera Megapixels_2MP","Camera Type_Hidden","Camera Type_Mini","Camera Type_Nanny","Camera Type_Pinhole","Camera Type_Spy Camera","Collection_Spy Camera","Connectivity_WiFi\/Wireless","DIY_DIY","Features_Construction Time Lapse","Features_Motion Activated","Features_Smartphone App","Field Of View_0 - 90 degrees","Lens_3 mega piexels 1\/3''","Live View_View Live Video","Location_Indoor","Location_Office \/ Business","Location_Outdoor","Night Vision Range_0-10 Metres","OS Compatibility_Android","OS Compatibility_IOS","OS Compatibility_Windows","Power Source_Battery","Recording Source_Audio + Video","Sensor_CMOS","Storage - Maximum Capacity_32 Gb (4 Hrs Recording)","Storage Type_Cloud Recording (In-App)","Storage Type_Memory Card","Video Resolution - Max_Full HD 1080p","Viewing_Remote View","Zoom_Digital"]}'); this.data.push(p); p = JSON.parse('{"handle":"1080p-scouting-trail-camera","title":"4K Black Flash Trail Camera For Wildlife Monitoring","status":"ACTIVE","tags":["Battery Capacity_4-8 AA Batteries","Camera Features_Motion Activated","Camera Features_No Internet Required","Camera Megapixels_32MP","Camera Rotation Angle_No Rotation","Collection_Outdoor","Field Of View_90 - 120 degrees","IP Rating_IP66","Live View_View from Memory","Night Vision Range_20m","Night Vision_Night Vision Enabled","OS Compatibility_Windows","Outdoor Camera Type_Home Security","Outdoor Camera Type_Trail","Power Source_Battery","Storage - Maximum Capacity_512 Gb (64 Hrs Recording)","Storage_Memory Card","Video Playback Viewing_Memory Stored","Video Resolution_UHD 2160p (4k)"]}'); this.data.push(p); p = JSON.parse('{"handle":"mini-cube-hd-hidden-wifi-camera-1080p-the-spy-store","title":"Mini Cube HD Hidden Wi-Fi Camera","status":"ACTIVE","tags":["Battery Capacity_400 mAh","Camera Type_Mini","Camera Type_Mini Cube","Camera Type_Spy Camera","Collection_Spy Camera","Connectivity_WiFi\/Wireless","Field Of View_120 - 180-degree","Live View_View Live Video","Location_Dining Room","Location_Indoor","Location_Living Room","Location_Office \/ Business","New Arrivals","Night Vision_Night Vision Enabled","OS Compatibility_Android","OS Compatibility_IOS","OS Compatibility_Windows","Power Source_Battery","Recording Source_Audio + Video","Storage - Maximum Capacity_32 Gb (4 Hrs Recording)","Storage Type_Memory Card","Video Resolution - Max_Full HD 1080p","Viewing_Remote View"]}'); this.data.push(p); p = JSON.parse('{"handle":"mini-body-camera-1080p-full-hd-wide-angle-the-spy-store","title":"\ufeffMini Body Camera - 1080P Full HD Wide Angle","status":"ACTIVE","tags":["Application_No App","Battery Capacity_560 mAh","Camera Type_Body Worn","Camera Type_Clip On","Camera Type_Mini","Camera Type_Spy Camera","Camera Type_Wearable","Collection_Spy Camera","Connectivity_WiFi\/Wireless","Features_Loop Recording","Field Of View_120 - 180-degree","Location_Body Worn","New Arrivals","OS Compatibility_Windows","Power Source_Battery","Recording Source_Audio + Video","Storage - Maximum Capacity_64 Gb (8 Hrs Recording)","Storage Type_Memory Card","Video Resolution - Max_Full HD 1080p","Viewing_Memory Card Storage"]}'); this.data.push(p); p = JSON.parse('{"handle":"mini-wireless-security-camera-with-night-vision","title":"Mini Wireless Covert Camera with Night Vision","status":"ACTIVE","tags":["Application_IOT Living","Battery Capacity_520 mAh","Brand_Awaretech","Camera Type_Hidden","Camera Type_Mini","Camera Type_Spy Camera","Camera Type_Surveillance","Collection_Spy Camera","Connectivity_WiFi\/Wireless","Features_Motion Activated","Features_Smartphone App","Field Of View_90 - 120 degrees","Live View_View Live Video","Location_Indoor","Location_Living Room","Location_Warehouse","New Arrivals","Night Vision_Night Vision Enabled","OS Compatibility_Android","OS Compatibility_IOS","OS Compatibility_Windows","Power Source_Battery","Power Source_Plug In","Recording Source_Audio + Video","Storage - Maximum Capacity_64 Gb (8 Hrs Recording)","Storage Type_Cloud Recording (In-App)","Storage Type_Memory Card","Video Resolution - Max_Full HD 1080p","Viewing_Remote View"]}'); this.data.push(p); p = JSON.parse('{"handle":"covert-video-audio-wifi-security-camera","title":"Mini Blackbox Covert Video & Audio WiFi Hidden Camera","status":"ACTIVE","tags":["Application_IOT Living","Brand_Awaretech","Camera Type_Hidden","Camera Type_Mini","Camera Type_Spy Camera","Camera Type_Surveillance","Collection_Spy Camera","Connectivity_WiFi\/Wireless","Features_Motion Activated","Features_Smartphone App","Live View_View Live Video","Location_Indoor","Location_Living Room","Location_Office \/ Business","Location_Warehouse","New Arrivals","Night Vision_Night Vision Enabled","OS Compatibility_Android","OS Compatibility_IOS","OS Compatibility_Windows","Power Source_Battery","Recording Source_Audio + Video","Storage - Maximum Capacity_64 Gb (8 Hrs Recording)","Storage Type_Cloud Recording (In-App)","Storage Type_Memory Card","Video Resolution - Max_Full HD 1080p","Viewing_Remote View"]}'); this.data.push(p); p = JSON.parse('{"handle":"full-hd-wearable-sports-action-camera","title":"\ufeff\ufeffFull HD Wearable Sports Action Camera","status":"ACTIVE","tags":["Battery Capacity_800 mAh","Camera Type_Body Worn","Camera Type_Clip On","Camera Type_Mini","Camera Type_Spy Camera","Camera Type_Wearable","Collection_Spy Camera","Connectivity_WiFi\/Wireless","Live View_View Live Video","Location_Body Worn","Location_Indoor","Location_Outdoor","New Arrivals","Night Vision_Night Vision Enabled","OS Compatibility_Android","OS Compatibility_IOS","OS Compatibility_Windows","Power Source_Battery","Recording Source_Audio + Video","Storage - Maximum Capacity_128 Gb (16 Hrs Recording)","Storage Type_Cloud Recording (In-App)","Storage Type_Internal Memory","Video Resolution - Max_Full HD 1080p","Viewing_Remote View"]}'); this.data.push(p); p = JSON.parse('{"handle":"portable-hidden-camera-and-movement-detector","title":"Portable Hidden Camera Detector","status":"ACTIVE","tags":["Collection_Bug Detectors","Detector Type_Camera Detector","Detector Type_Wireless Frequency Detector","Device Type_Personal Alarm","New Arrivals","Power Source_Battery"]}'); this.data.push(p); p = JSON.parse('{"handle":"flexible-gooseneck-camera-full-hd","title":"\ufeff\ufeffFlexible Gooseneck Camera | Full HD","status":"ACTIVE","tags":["Camera Type_Goosneck","Camera Type_Head Torch","Camera Type_Mini","Camera Type_Spy Camera","Night Vision_Night Vision Enabled"]}'); this.data.push(p); p = JSON.parse('{"handle":"4k-uhd-car-key-remote-spy-camera","title":"4K UHD Car Key Remote Spy Camera","status":"ACTIVE","tags":["Camera Type_Car Key FOB & Chain","Camera Type_Hidden","Camera Type_Mini","Camera Type_Nanny","Camera Type_Spy Camera","Camera Type_Wearable","Location_vehicle","New Arrivals","Video Resolution_UHD 2160p (4k)","Viewing_Memory Card Storage"]}'); this.data.push(p); p = JSON.parse('{"handle":"covert-pen-camera-records-in-full-hd","title":"\ufeff\ufeffCovert Pen Camera records in Full HD","status":"ACTIVE","tags":["Camera Type_Hidden","Camera Type_Mini","Camera Type_Nanny","Camera Type_Pen","Camera Type_Spy Camera","Camera Type_Wearable","Location_Body Worn","New Arrivals","Power Source_Battery","Storage - Maximum Capacity_128 Gb (16 Hrs Recording)","Storage - Maximum Capacity_16 GB","Storage Type_Internal Memory","Video Resolution_Full HD 1080p","Viewing_Memory Card Storage"]}'); this.data.push(p); p = JSON.parse('{"handle":"discreet-button-spy-camera","title":"Discreet Button Spy Camera","status":"ACTIVE","tags":["Camera Type_Body Worn","Camera Type_Button","Camera Type_Hidden","Camera Type_Mini","Camera Type_Nanny","Camera Type_Spy Camera","Features_No Phone Required","Location_Body Worn","New Arrivals","OS Compatibility_Windows","Power Source_Battery","Storage - Maximum Capacity_128 Gb (16 Hrs Recording)","Storage Type_Internal Memory","Video Resolution_Full HD 1080p"]}'); this.data.push(p); p = JSON.parse('{"handle":"hidden-camera-ac-adapter-night-vision-adjustable","title":"Hidden Camera AC Adapter with Night Vision and Adjustable Lens Angle","status":"ACTIVE","tags":["Brand_Awaretech","Camera Features_Motion Activated","Camera Features_Smartphone App","Camera Type_AC Adapter","Camera Type_Hidden","Camera Type_Mini","Camera Type_Nanny","Camera Type_Spy Camera","Collection_Spy Camera","Colour_Black","Connectivity_WiFi\/Wireless","Features_Motion Activated","Features_Smartphone App","Field Of View_120 - 180-degree","Live View_View Live Video","Location_Bedroom","Location_Living Room","Location_Office \/ Business","Microphone_Built-In","Night Vision_Night Vision Enabled","OS Compatibility_Android","OS Compatibility_IOS"]}'); this.data.push(p); p = JSON.parse('{"handle":"4g-mini-cube-spy-camera","title":"\ufeff\ufeff4G Mini Cube Spy Camera with Night Vision","status":"ACTIVE","tags":["Battery Capacity_2500 mAh","Camera Features_Motion Activated","Camera Features_Smartphone App","Camera Features_Two-Way Audio","Camera Megapixels_2MP","Camera Type_Mini","Camera Type_Mini Cube","Camera Type_Nanny","Camera Type_Spy Camera","Colour_Black","Connectivity_4G Sim Enabled","Connectivity_WiFi\/Wireless","Location_Bedroom","Location_Dining Room","Location_Living Room","Location_Office \/ Business","Microphone_Built-In","Night Vision Range_0-5 Metres","Recording Source_Audio + Video","Storage - Maximum Capacity_256 Mb"]}'); this.data.push(p); p = JSON.parse('{"handle":"smart-floodlight-with-1080p-hd-wi-fi-camera-2x-5000k","title":"Dual Smart Floodlight with 1080P HD Wi-Fi Camera and Night Vision","status":"ACTIVE","tags":["Application_IOT Living","Camera Features_Motion Activated","Camera Features_Smartphone App","Camera Features_Two-Way Audio","Camera Type_Surveillance","Collection_Outdoor","Colour_Black","Connectivity_WiFi\/Wireless","Location_Outdoor","Microphone_Built-In","Night Vision_Night Vision Enabled","Outdoor Camera Type_Floodlight","Outdoor Camera Type_Home Security","Power Source_Hardwired","Recording Source_Audio + Video"]}'); this.data.push(p); p = JSON.parse('{"handle":"light-bulb-camera-360-wifi-surveillance","title":"Light Bulb Camera 360\u00b0 WiFi Surveillance","status":"ACTIVE","tags":["Camera Type_Bulb","Camera Type_Hidden","Collection_Spy Camera","Connectivity_WiFi\/Wireless","Field Of View_180 - 360 degree","Location_Dining Room","Location_Indoor","Location_Living Room","Microphone_Built-In","Night Vision_Night Vision Enabled","OS Compatibility_Android","OS Compatibility_IOS","OS Compatibility_Windows","Recording Source_Audio + Video","Storage Type_Cloud Storage","Storage Type_Internal Memory","Storage Type_Memory Card"]}'); this.data.push(p); p = JSON.parse('{"handle":"4g-voice-recorder-disguised-power-bank","title":"4G Live Listening Power Bank","status":"ACTIVE","tags":["Audio Recording Mode_Continuous","Audio Recording Mode_Voice Activated","Battery Capacity_10000 mAh","Brand_Awaretech","Collection_Listening Devices","Colour_Black","Connectivity_4G Sim Enabled","Featured Covert Voice Recorders","Listening Device Type_Power Bank","Power Source_Battery"]}'); this.data.push(p); p = JSON.parse('{"handle":"kids-water-resistant-gps-smart-watch-pink","title":"Kids Water Resistant GPS Smart Watch - Pink","status":"ACTIVE","tags":["Additional Control_Historical Mileage","Additional Control_Historical Route","Colour_Pink","Connectivity_4G Sim Enabled","Device Type_Personal Alarm","OS Compatibility_Android","OS Compatibility_IOS","OS Compatibility_Windows","Power Source_Battery","Tracker Features_Geo-Fence Alarm","Tracker Features_Kids","Tracker Features_Listening","Tracker Features_Sim Card Slot","Tracker Features_SOS Button","Tracker Features_Water Proof","Tracker Features_Wrist Watch","Tracker Type_Kids GPS","Tracker Type_Personal GPS","Viewing_Built in screen"]}'); this.data.push(p); p = JSON.parse('{"handle":"kids-water-resistant-gps-smart-watch-blue","title":"Kids Water Resistant GPS Smart Watch - Blue","status":"ACTIVE","tags":["Additional Control_Historical Route","Collection_GPS Trackers","Colour_Blue","Connectivity_4G Sim Enabled","OS Compatibility_Android","OS Compatibility_IOS","OS Compatibility_Windows","Personal Security","Power Source_Battery","Tracker Features_Geo-Fence Alarm","Tracker Features_Kids","Tracker Features_Listening","Tracker Features_Sim Card Slot","Tracker Features_SOS Button","Tracker Features_Water Proof","Tracker Features_Wrist Watch","Tracker Type_Kids GPS","Viewing_Built in screen"]}'); this.data.push(p); p = JSON.parse('{"handle":"kids-water-resistant-gps-smart-watch-black","title":"Kids Water Resistant GPS Smart Watch - Black","status":"ACTIVE","tags":["Additional Control_Historical Route","Colour_Black","Connectivity_4G Sim Enabled","OS Compatibility_Android","OS Compatibility_IOS","OS Compatibility_Windows","Personal Security","Power Source_Battery","Tracker Features_Geo-Fence Alarm","Tracker Features_Kids","Tracker Features_Listening","Tracker Features_Sim Card Slot","Tracker Features_SOS Button","Tracker Features_Water Proof","Tracker Features_Wrist Watch","Tracker Type_Kids GPS","Tracker Type_Personal GPS","Viewing_Built in screen"]}'); this.data.push(p); p = JSON.parse('{"handle":"spy-camera-usb-stick-with-invisible-lens","title":"Spy Camera USB Stick With Invisible Lens","status":"ACTIVE","tags":["Battery Capacity_300 mAh","Camera Features_No Internet Required","Camera Type_Body Worn","Camera Type_Hidden","Camera Type_Nanny","Camera Type_USB Stick","Camera Type_Wearable","Collection_Spy Camera","Colour_Black","Features_No Phone Required","Location_Body Worn","Location_Living Room","Location_Office \/ Business","Microphone_Built-In","Power Source_Battery","Recording Source_Audio + Video","Storage - Maximum Capacity_32 Gb (4 Hrs Recording)","Video Resolution - Max_Full HD 1080p"]}'); this.data.push(p); p = JSON.parse('{"handle":"sphcdsc0001-dual-dash-cam-full-hd-gps-tagging-night-vision","title":"Dual Dash Cam - Full HD, GPS Tagging, Night Vision","status":"ACTIVE","tags":["1080p Resolution","Audio Playback_PC Playback","Battery Capacity_180 mAh","Camera Type_Surveillance","car","Features_Loop Recording","Features_No Phone Required","Field Of View_120 - 180-degree","GPS Accuracy_0-15 meters","Location_vehicle","Microphone_Built-In","Mount_Base mount","New Arrivals","Night Vision_Night Vision Enabled","OS Compatibility_Windows","Power Source_Hardwired","Power Source_Plug In","Storage - Maximum Capacity_32 GB","Storage Type_Memory Card","Storage_Memory Card","Tracker Features_Hard Wired","Tracker Type_Car GPS","Video Resolution_Full HD 1080p","Viewing_Built in screen","Viewing_Memory Card Storage"]}'); this.data.push(p); p = JSON.parse('{"handle":"camera-glasses-polarized-lens-2k-hd-recording","title":"Camera Glasses | Polarized Lens, 2K HD Recording","status":"ACTIVE","tags":["1080p Resolution","Application_No App","Camera Type_Spy Camera","Camera Type_Wearable","Collection_Spy Camera","Features_No Phone Required","Field Of View_0 - 90 degrees","Personal Security","Power Source_Battery","Storage - Maximum Capacity_128 Gb (16 Hrs Recording)","Storage Type_Memory Card","Video Resolution_Full HD 1080p","Viewing_Memory Card Storage"]}'); this.data.push(p); p = JSON.parse('{"handle":"smart-voice-recorder-wrist-watch","title":"Smart Voice Recorder Wrist Watch","status":"ACTIVE","tags":["Application_No App","Audio Playback_PC Playback","Badge: New","Collection_Listening Devices","Listening Device Type_Wrist Watch","Location_Indoor","Location_Outdoor","Microphone_Built-In","Personal Security","Recording Devices","Storage Type_Internal Memory"]}'); this.data.push(p); p = JSON.parse('{"handle":"4g-mini-cube-spy-camera-with-night-vision-v2","title":"4G Mini Cube Spy Camera with Night Vision","status":"ACTIVE","tags":["Battery Capacity_3000 mAh","Bedroom","Camera Features_Smartphone App","Camera Features_Two-Way Audio","Camera Megapixels_2MP","Camera Type_Hidden","Camera Type_Mini","Camera Type_Nanny","Camera Type_Spy Camera","Connectivity_4G Sim Enabled","Connectivity_WiFi\/Wireless","Featured","Features_Motion Activated","Features_Two-Way Audio","Location_Bedroom","Location_Dining Room","Location_Indoor","Location_Living Room","Location_Office \/ Business","Night Vision Range_0-5 Metres","Outdoor Camera Type_3G \/ 4G SIM Enabled","Recording Source_Audio + Video","Storage - Maximum Capacity_256 Mb"]}'); this.data.push(p); p = JSON.parse('{"handle":"hd-1080p-black-box-rotatable-security-wi-fi-camera-big-battery","title":"HD 1080P Black Box Rotatable Security Wi-Fi Camera","status":"ACTIVE","tags":["Camera Type_Hidden","Camera Type_Spy Camera","Camera Type_Surveillance","Collection_Spy Camera","Features_Motion Activated","Features_Smartphone App","Field Of View_90 - 120 degrees","Location_Dining Room","Location_Indoor","Location_Living Room","Location_Nursing Home","Location_Office \/ Business","Location_Warehouse","OS Compatibility_Android","OS Compatibility_IOS","OS Compatibility_Windows","Power Source_Battery","Power Source_Plug In","Storage - Maximum Capacity_128 Gb (16 Hrs Recording)","Storage Type_Cloud Storage","Storage Type_Memory Card","Storage_Cloud Recording (In-App)","Storage_Memory Card","Video Playback Viewing_Remote View","Viewing_Memory Card Storage","Viewing_Remote View"]}'); this.data.push(p); p = JSON.parse('{"handle":"4g-personal-alarm-gps-tracker-with-sos","title":"4G Personal Alarm & GPS Tracker with SOS","status":"ACTIVE","tags":["Badge: New","Connectivity_4G Sim Enabled","Features_Smartphone App","GPS Accuracy_0-15 meters","Microphone_Built-In","New Arrivals","Other","Personal Security","Tracker Features_Geo-Fence Alarm","Tracker Features_Portable","Tracker Features_Water Proof","Tracker Type_Personal GPS"]}'); this.data.push(p); p = JSON.parse('{"handle":"camera-clock-with-adjustable-angle","title":"Smart Alarm Clock Spy Camera 1080P\/2K\/4K Full HD with Remote Night Vision & Motion Detection","status":"ACTIVE","tags":["1080p Resolution","Battery Capacity_3000 mAh","Camera Type_Clock","Camera Type_Hidden","Camera Type_Nanny","Collection_Spy Camera","Colour_Black","Connectivity_WiFi\/Wireless","Features_Loop Recording","Features_Motion Activated","Features_Smartphone App","Field Of View_120 - 180-degree","Live View_View Live Video","Location_Bedroom","Location_Dining Room","Location_Indoor","Location_Living Room","Location_Nursing Home","Location_Office \/ Business","Location_Warehouse","Night Vision Range_0-10 Metres","Night Vision Range_5m","Night Vision_Night Vision Enabled","OS Compatibility_Android","OS Compatibility_IOS","Power Source_Battery","Power Source_Plug In","Spy Cameras","Storage - Maximum Capacity_256 Mb","Storage Type_Memory Card","Video Playback Viewing_Memory Stored","Video Playback Viewing_Remote View","Video Resolution_Full HD 1080p","Viewing_Memory Card Storage","Viewing_Remote View"]}'); this.data.push(p); p = JSON.parse('{"handle":"power-bank-with-hidden-camera-wireless-charging","title":"2K Spy Camera Wireless Charging Power Bank with Motion Detection (Support Offline Recording)","status":"ACTIVE","tags":["1080p Resolution","Battery Capacity_10000 mAh","Battery Powered Spy Camera","Bedroom","Camera Features_Motion Activated","Camera Features_No Internet Required","Camera Features_Smartphone App","Camera Type_Charging Dock","Camera Type_Hidden","Camera Type_Powerbank","Camera Type_Spy Camera","Cheating Spouse","Collection_Spy Camera","Colour_Black","Connectivity_WiFi\/Wireless","Featured","Features_Motion Activated","Features_Smartphone App","Field Of View_90 - 120 degrees","Live View_View from Memory","Live View_View Live Video","Location_Bedroom","Location_Dining Room","Location_Indoor","Location_Living Room","Location_Nursing Home","Location_Office \/ Business","Location_Warehouse","New Arrivals","Night Vision Range_0-10 Metres","OS Compatibility_Android","OS Compatibility_IOS","Power Source_Battery","Spy Cameras","Storage - Maximum Capacity_256 Gb (32 Hrs Recording)","Storage Type_Memory Card","Storage_Memory Card"]}'); this.data.push(p); p = JSON.parse('{"handle":"personal-tracker-qbitm","title":"4G Compact Portable Personal Tracker with Geo-fence & SOS Alarm","status":"ACTIVE","tags":["Application_Tracksolid Pro","Battery Capacity_650 mAh","Cheating Spouse","Collection_GPS Trackers","Device Type_Personal Alarm","OS Compatibility_Android","OS Compatibility_IOS","OS Compatibility_Windows","Personal Alarms","Personal GPS Trackers","Personal Security","Power Source_Battery","Tracker Features_Compact","Tracker Features_Geo-Fence Alarm","Tracker Features_Kids","Tracker Features_Portable","Tracker Features_Sim Card Slot","Tracker Features_SOS Button","Tracker Type_Asset GPS","Tracker Type_Car GPS","Tracker Type_Kids GPS","Tracker Type_Personal GPS"]}'); this.data.push(p); p = JSON.parse('{"handle":"7-in-1-multi-functional-personal-alarm","title":"7-IN-1 Ultimate Multi-functional Personal Alarm (Grey)","status":"ACTIVE","tags":["Device Type_Personal Alarm","Features_Motion Activated","Personal Alarms","Personal Security","Power Source_Battery","SOS Alert"]}'); this.data.push(p); p = JSON.parse('{"handle":"binocular-night-vision-full-color-4k","title":"4K Night Vision Binoculars with Long Viewing Distance & Rechargeable Lithium Battery (Full Color NV)","status":"ACTIVE","tags":["Application_No App","Battery Capacity_5000 mAh","Camera Features_No Internet Required","Camera Type_Surveillance","Collection_Spy Camera","Colour_Black","Law Enforcement","Location_Outdoor","night vision","night vision binocular","Night Vision Range_100m","Night Vision_Night Vision Enabled","Outdoor Camera Type_Trail","Personal Security","Power Source_Battery","Recording Source_Audio + Video","Storage Type_Memory Card","Storage_Memory Card","Video Playback Viewing_Memory Stored","Video Resolution_UHD 2160p (4k)","Viewing_Built in screen","Zoom_Digital"]}'); this.data.push(p); p = JSON.parse('{"handle":"monocular-night-vision-nv1000","title":"4K Handheld Night Vision Monocular with 5X Zoom and Rechargeable Battery","status":"ACTIVE","tags":["night vision","night vision binocular","Night Vision Range_100m","Night Vision_Night Vision Enabled"]}'); this.data.push(p); p = JSON.parse('{"handle":"1080p-wifi-nanny-cam-picture-frame-with-ir-night-vision-and-super-long-battery-life","title":"1080P WIFI Nanny Cam Picture Frame with IR Night Vision and Super Long Battery Life","status":"ACTIVE","tags":["1080p Resolution","Battery Capacity_1000 mAH","Battery Powered Spy Camera","Camera Features_Motion Activated","Camera Features_Smartphone App","Camera Type_Nanny","Cheating Spouse","Collection_Spy Camera","Colour_Black","Connectivity_WiFi\/Wireless","Features_App Push Notification","Features_Motion Activated","Features_Smartphone App","Field Of View_0 - 90 degrees","Location_Bedroom","Location_Dining Room","Location_Indoor","Location_Living Room","Location_Nursing Home","Location_Office \/ Business","New Arrivals","OS Compatibility_Android","OS Compatibility_IOS","Power Source_Battery","Recording Source_Audio + Video","Storage Type_Memory Card"]}'); this.data.push(p); p = JSON.parse('{"handle":"smart-power-adaptor-camera-with-night-vision-and-motion-detection-us-plug-with-au-adaptor","title":"Smart Power Adaptor Camera with Night Vision and Motion Detection (AU Plug)","status":"ACTIVE","tags":["1080p Resolution","Camera Features_Motion Activated","Camera Features_Smartphone App","Camera Type_AC Adapter","Camera Type_Nanny","Collection_Spy Camera","Colour_Silver","Connectivity_WiFi\/Wireless","Features_Loop Recording","Features_Motion Activated","Features_Smartphone App","Location_Bedroom","Location_Dining Room","Location_Indoor","Location_Living Room","Location_Nursing Home","Location_Office \/ Business","New Arrivals","Night Vision Range_0-5 Metres","Office\/Business","OS Compatibility_Android","OS Compatibility_IOS","Power Source_Plug In","Storage Type_Memory Card","Video Resolution_Full HD 1080p"]}'); this.data.push(p); } catch(e){ console.error(e); } } loadProductsGrid(start, stop, data){ let number_product = stop - start; for(let i = start; i < stop; i++) { let url = window.location.origin + '/products/' + data[i].handle + "?view=grid-item" + this.layout; fetch(url) .then((res) => { if(res.status == 404){ return false; } return res.text(); }) .then(res => this.addProduct(res, i, number_product)) .catch(err => console.log(err)); } } addProduct(res, i, number_product){ this.progress++; let doc = this.parser.parseFromString(res, 'text/html'); let product = doc.querySelector(".grid-product"); let layout = ''; let items_layout = document.getElementsByClassName('item-layout'); for(let i = 0; i < items_layout.length; i++) { if(items_layout[i].classList.contains('active')) { layout = items_layout[i].dataset.layout; } } if(product != null) { product.style.display = 'flex'; product.style.order = i + 1; product.classList.add(layout + '-active'); this.productsContainer.append(product); let compare = product.querySelector('.SPCMP_Add_span'); if(compare != null) { compare.innerText = 'COMPARE'; } let add_to_cart = product.querySelector('.grid-product__add-to-cart'); if(add_to_cart != null) { add_to_cart.addEventListener('click', function(e){ e.preventDefault(); let a_element = e.target.closest('a'); if(!a_element.classList.contains('added')) { a_element.classList.add('added'); let variant_id = a_element.dataset.variant; let formData = { 'items': [{ 'id': variant_id, 'quantity': 1 }] }; theme.cart.addItemFromForm(formData); } }); } } if(this.progress == number_product) { this.productsContainer.setAttribute('style', ''); if(this.viewmore == '' || !this.viewmore) { this.scrollToTop(); } } } render(resetCurrentPage = false){ if(resetCurrentPage) { this.currentPage = 1; } let productPerPage = this.limit; let end_index = this.currentPage * productPerPage; let start_index = end_index - productPerPage; if(this.tagsFilter.length < 1) { while (this.productsContainer.firstChild) this.productsContainer.removeChild(this.productsContainer.firstChild); let data = this.data; let stop_index = 0; if(data.length > (this.currentPage*productPerPage)) { stop_index = end_index }else{ stop_index = data.length; } if(this.currentPage > 1) { this.productsContainer.style.height = this.containerHeight + 'px'; } this.progress = 0; this.loadProductsGrid(start_index, stop_index, data); let pagination = this.productsContainer.parentElement.getElementsByClassName('pagination')[0]; if(pagination != undefined) { this.productsContainer.parentElement.removeChild(pagination); this.createPagination(data); } }else { let data = []; for (let i = 0; i < this.data.length; i++) { let productTags = this.data[i]['tags']; let is_passed = false; for(let j = 0; j < this.tagsFilter.length; j++) { if(productTags.includes(this.tagsFilter[j])) { is_passed = true; } } if(is_passed) { data.push(this.data[i]); } } while (this.productsContainer.firstChild) this.productsContainer.removeChild(this.productsContainer.firstChild); if(data.length > 0) { let stop_index = 0; if(data.length > (this.currentPage*productPerPage)) { stop_index = end_index }else{ stop_index = data.length; } if(this.currentPage > 1) { this.productsContainer.style.height = this.containerHeight + 'px'; } this.progress = 0; this.loadProductsGrid(start_index, stop_index, data); let pagination = this.productsContainer.parentElement.getElementsByClassName('pagination')[0]; this.productsContainer.parentElement.removeChild(pagination); this.createPagination(data); }else{ let notfound = '

Sorry, there are no products in this tags.

'; this.productsContainer.innerHTML = notfound; } } } reInitProductCompare(){ if(typeof window.reinitializeCompare == 'function'){ window.reinitializeCompare(); console.log("Product Compare reinited"); } } createPagination(data = []) { if(data.length > 0) { this.totalPage = data.length / this.limit; }else{ this.totalPage = this.data.length / this.limit; } if(!Number.isInteger(this.totalPage )) { this.totalPage += 1; } let pagination = document.createElement('div'); pagination.classList.add('pagination'); let html = ''; if(this.currentPage > 1) { html += ''; html += ''; html += ''; html += ''; html += ''; } for(let i = 1; i <= this.totalPage; i++) { if(this.currentPage == i) { html += ''+ i +''; }else{ html += ''+ i +''; } } if(this.currentPage < parseInt(this.totalPage)) { html += ''; html += ''; html += ''; html += ''; html += ''; } pagination.innerHTML = html; this.productsContainer.parentElement.appendChild(pagination); let pagination_item = pagination.querySelectorAll('.page a'); Array.from(pagination_item).forEach(function(element){ element.addEventListener("click", this.actionPagination.bind(this)); }, this); } actionPagination(e) { e.preventDefault(); this.currentPage = e.target.closest('a').dataset.page; // if(e.path[0].nodeName == 'A') { // this.currentPage = e.target.dataset.page; // }else{ // } let current_height = this.productsContainer.offsetHeight; this.containerHeight = current_height; this.render(); } createViewMore() { let btnViewMore = document.createElement('div'); btnViewMore.classList.add('btn-viewmore'); let viewMoreHtml = 'View more'; btnViewMore.dataset.times = 1; btnViewMore.innerHTML = viewMoreHtml; let viewMoreLink = btnViewMore.getElementsByTagName('a')[0]; viewMoreLink.addEventListener('click', this.actionViewMore.bind(this)); this.productsContainer.parentElement.appendChild(btnViewMore); } actionViewMore(e) { e.preventDefault(); this.currentTimes = e.target.closest('.btn-viewmore').dataset.times; let productPerPage = this.limit; let end_index = (parseFloat(this.currentTimes) + 1) * productPerPage; let start_index = end_index - productPerPage; let data = this.data; let number_product = end_index - start_index; let stop_index = 0; if(data.length > (this.currentTimes*productPerPage)) { stop_index = end_index }else{ stop_index = data.length; } for(let i = start_index; i < stop_index; i++) { if(data[i] != undefined) { let url = window.location.origin + '/products/' + data[i].handle + "?view=grid-item" + this.layout; fetch(url) .then(res => res.text()) .then(res => this.addProduct(res, i, number_product)); } if(i >= data.length) { let btnViewMore = this.getElementsByClassName('btn-viewmore')[0]; btnViewMore.style.display = 'none'; } } e.target.closest('.btn-viewmore').dataset.times = parseFloat(this.currentTimes) + 1; } getTagsFilter(e) { let tag = e.target.dataset.tag; Array.from(this.filterItems).forEach(function(element){ let tag_e = element.dataset.tag; let parent_e = element.parentElement; if(parent_e.classList.contains('tag--active') && tag_e == tag) { parent_e.classList.remove('tag--active'); this.removeRedTag(tag); let index = this.tagsFilter.indexOf(tag); if (index !== -1) { this.tagsFilter.splice(index, 1); } }else if (!parent_e.classList.contains('tag--active') && tag_e == tag) { parent_e.classList.add('tag--active'); let is_added = false; let tagListActiveItems = document.querySelectorAll('.tag--remove'); if(tagListActiveItems.length > 0) { Array.from(tagListActiveItems).forEach(function(item){ if(item.dataset.tag == tag) { is_added = true; } }, this); } if(!is_added) { this.addRedTag(tag); } if(!this.tagsFilter.includes(tag)) { this.tagsFilter.push(tag); } } this.btnOpenFilterText.innerText = 'Filter (' + this.tagsFilter.length + ')'; }, this); if (this.tagsFilter.length > 0 && !this.btnOpenFilterMobile.classList.contains('btn--tertiary-active')) { this.btnOpenFilterMobile.classList.add('btn--tertiary-active'); } else if (this.tagsFilter.length < 1){ this.btnOpenFilterMobile.classList.remove('btn--tertiary-active'); this.btnOpenFilterText.innerText = 'Filter'; } this.render(true); if (theme.FilterDrawer) { theme.FilterDrawer.close(); } } actionSubmitFilter(e) { e.preventDefault(); this.collectionGrid.classList.add('unload'); this.filterHandle(); let html = document.getElementsByTagName('html')[0]; let body = document.getElementsByTagName('body')[0]; let drawer = document.getElementById('FilterDrawer'); if(drawer.classList.contains('drawer--is-open')) { drawer.classList.remove('drawer--is-open'); } if(html.classList.contains('js-drawer-open') && body.classList.contains('js-drawer-open')) { html.classList.remove('js-drawer-open'); body.classList.remove('js-drawer-open'); let openFilterMobile = document.getElementsByClassName('js-drawer-open-collection-filters')[0]; openFilterMobile.click(); } } filterHandle() { this.render(true); this.collectionGrid.classList.remove('unload'); } addRedTag(tag) { let tag_arr = tag.split('_'); let html = ''+ tag_arr[1] +''; html += ''; let li_element = document.createElement('li'); li_element.classList.add('tag','tag--remove'); li_element.dataset.tag = tag; li_element.innerHTML = html; Array.from(this.tagListActive).forEach(function(ul){ let duplicatedE = li_element.cloneNode(true); ul.appendChild(duplicatedE); this.actionRemoveRedTag(duplicatedE); }.bind(this)); } removeRedTag(tag) { Array.from(this.tagListActive).forEach(function(ul){ let tags_remove = ul.getElementsByTagName('li'); for(let i = 0; i < tags_remove.length; i++) { if(tags_remove[i].dataset.tag == tag) { ul.removeChild(tags_remove[i]); } } }.bind(this)); } actionRemoveRedTag(element) { let redTag = element.querySelector('span'); redTag.addEventListener("click", function(e){ let tag_remove = redTag.parentElement.dataset.tag; let index = this.tagsFilter.indexOf(tag_remove); if (index !== -1) { this.tagsFilter.splice(index, 1); } this.removeRedTag(tag_remove); Array.from(this.filterItems).forEach(function(item){ let tag = item.dataset.tag; if(tag == tag_remove && item.parentElement.classList.contains('tag--active')) { item.parentElement.classList.remove('tag--active'); } }); if (this.tagsFilter.length < 1){ this.btnOpenFilterMobile.classList.remove('btn--tertiary-active'); this.btnOpenFilterText.innerText = 'Filter'; } else { this.btnOpenFilterText.innerText = 'Filter (' + this.tagsFilter.length + ')'; } this.render(); }.bind(this)); } switchSubmitFilterBtn() { if (this.tagsFilter.length > 0) { Array.from(this.submitFilter).forEach(function(btn){ btn.classList.remove('hide'); btn.text = 'submit filter (' + this.tagsFilter.length + ')'; }, this); }else{ Array.from(this.submitFilter).forEach(function(btn){ btn.classList.add('hide'); }, this); } } scrollToTop() { let scrollHeight = this.productsContainer.offsetTop; // if(window.innerWidth <= 768) { // scrollDiv = scrollDiv - 100; // } window.scrollTo({ top: scrollHeight - 200, behavior: 'smooth'}); } } customElements.define('collection-products', CollectionProduct);