PluginProbe ʕ •ᴥ•ʔ
Widget Options – Advanced Conditional Visibility for Gutenberg Blocks & Classic Widgets / 4.2.3
Widget Options – Advanced Conditional Visibility for Gutenberg Blocks & Classic Widgets v4.2.3
4.2.5 4.2.4 trunk 3.7.10 3.7.11 3.7.12 3.7.13 3.7.14 3.7.2 3.7.5 3.7.6 3.7.7 3.7.8 3.7.9 3.8 3.8.1 3.8.10 3.8.2 3.8.3 3.8.4 3.8.5 3.8.6 3.8.7 3.8.8 3.8.9 3.8.9.1 3.9.0 3.9.1 3.9.2 3.9.3 3.9.4 3.9.5 3.9.6 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.0.5.1 4.0.6 4.0.6.1 4.0.7 4.0.8 4.0.9 4.1.0 4.1.1 4.1.2 4.1.3 4.2.0 4.2.1 4.2.2 4.2.3
widget-options / assets / js / widgetopts.resize.js
widget-options / assets / js Last commit date
bootstrap-multiselect.min.js 2 months ago jquery.liveFilter.js 2 months ago jquery.liveFilter.min.js 2 months ago jquery.widgetopts.beaver.js 2 months ago jquery.widgetopts.beaver.min.js 2 months ago select2-settings.js 2 months ago select2-settings.min.js 2 months ago select2.min.js 2 months ago settings.js 2 months ago settings.min.js 2 months ago widgetopts.global.js 2 months ago widgetopts.migration.js 2 months ago widgetopts.resize.js 2 months ago widgets.js 2 months ago widgets.min.js 2 months ago wpWidgetOpts.js 2 months ago wpWidgetOpts.min.js 2 months ago
widgetopts.resize.js
46 lines
1 (function () {
2 // Define breakpoints for mobile, tablet, and desktop
3 const mobileBreakpoint = 767;
4 const tabletBreakpoint = 1024;
5
6 let previousDeviceCategory = ""; // To store the previous window size category
7
8 // Function to detect device size category
9 function getDeviceCategory() {
10 const width = window.innerWidth;
11
12 if (width <= mobileBreakpoint) {
13 return "mobile";
14 } else if (width > mobileBreakpoint && width <= tabletBreakpoint) {
15 return "tablet";
16 } else {
17 return "desktop";
18 }
19 }
20
21 // Function to check for window resize and refresh if needed
22 function checkWindowSize() {
23 const currentDeviceCategory = getDeviceCategory();
24
25 // Compare with the previous device category
26 if (currentDeviceCategory !== previousDeviceCategory) {
27 previousDeviceCategory = currentDeviceCategory; // Update the previous category
28 location.reload();
29 }
30 }
31
32 document.addEventListener("DOMContentLoaded", function () {
33 let resizeTimeout;
34
35 function checkWindowSizeDebounced() {
36 clearTimeout(resizeTimeout);
37 resizeTimeout = setTimeout(checkWindowSize, 200); // 200ms delay
38 }
39
40 // Initial detection when the page loads
41 previousDeviceCategory = getDeviceCategory();
42
43 window.addEventListener("resize", checkWindowSizeDebounced);
44 });
45 })();
46