PluginProbe ʕ •ᴥ•ʔ
Independent Analytics – WordPress Analytics Plugin / 2.8.8
Independent Analytics – WordPress Analytics Plugin v2.8.8
2.15.0 2.14.10 trunk 1.1 1.10 1.10.1 1.11 1.12 1.13 1.14 1.15 1.16 1.17 1.17.1 1.17.2 1.17.3 1.17.4 1.18 1.18.1 1.19.0 1.19.1 1.2 1.20.0 1.21.0 1.22.0 1.22.1 1.23.0 1.23.1 1.24.0 1.24.1 1.25.0 1.25.1 1.26.0 1.27.0 1.28.0 1.28.1 1.28.2 1.28.3 1.29.0 1.3 1.30.0 1.30.1 1.4 1.5 1.6 1.7 1.8 1.9 2.0.0 2.0.1 2.1.4 2.1.5 2.1.6 2.10.0 2.10.1 2.10.2 2.10.3 2.10.4 2.11.0 2.11.1 2.11.10 2.11.2 2.11.3 2.11.4 2.11.5 2.11.6 2.11.7 2.11.8 2.11.9 2.12.0 2.12.1 2.12.2 2.13.1 2.13.2 2.13.5 2.13.6 2.14.0 2.14.1 2.14.2 2.14.4 2.14.6 2.14.7 2.14.8 2.14.9 2.2.0 2.2.1 2.3.1 2.3.2 2.4.2 2.4.3 2.5.0 2.5.1 2.6.0 2.6.1 2.6.2 2.6.3 2.6.4 2.7.0 2.7.1 2.7.2 2.7.3 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.8 2.8.9 2.9.2 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7
independent-analytics / javascript-source / modules / sticky-sidebar.js
independent-analytics / javascript-source / modules Last commit date
date-picker.js 1 year ago duplicate-field.js 2 years ago email-reports.js 2 years ago notices.js 2 years ago scroll-to-top.js 2 years ago sticky-sidebar.js 2 years ago support.js 2 years ago user-roles.js 1 year ago
sticky-sidebar.js
100 lines
1 const $ = jQuery;
2
3 const StickySidebar = {
4 setup() {
5 if ($('#iawp-layout-sidebar').length == 0) {
6 return;
7 }
8
9 let scrollPosition = window.scrollY;
10 const sidebar = document.getElementById('iawp-layout-sidebar');
11 const sidebarContainer = document.querySelector('.iawp-layout-sidebar');
12 const layoutContainer = document.getElementById('iawp-layout');
13 var self = this;
14
15 if(!sidebar && !layoutContainer) {
16 return; // These elements aren't visible on an interrupt page such as migration pending page
17 }
18
19 sidebar.scroll(0, window.scrollY);
20 this.setMinMainHeight();
21
22 document.addEventListener('scroll', () => {
23 const change = scrollPosition - window.scrollY;
24
25 if (window.scrollY < 1 || window.scrollY > ($(document).height() - $(window).height() - 1)) {
26 scrollPosition = window.scrollY;
27 return;
28 }
29 sidebar.scroll(0, sidebar.scrollTop - change);
30 scrollPosition = window.scrollY;
31 });
32
33 window.addEventListener('resize', () => {
34 this.setMinMainHeight();
35 });
36
37 document.getElementById('collapse-sidebar').addEventListener('click', () => {
38 const isSidebarCollapsed = layoutContainer.classList.toggle('collapsed');
39 this.saveSidebarState(isSidebarCollapsed)
40 sidebar.scroll(0, window.scrollY);
41 this.setMinMainHeight();
42 this.setTableHorizontal();
43 });
44
45 $('#mobile-menu-toggle').on('click', function() {
46 if ($('#menu-container').hasClass('open')) {
47 $('#menu-container').removeClass('open');
48 $(this).find('.text').text(iawpText.openMobileMenu);
49 } else {
50 $('#menu-container').addClass('open');
51 $(this).find('.text').text(iawpText.closeMobileMenu);
52 }
53 });
54
55 var dataTableContainer = $('#data-table-container');
56 var dataTable = $('#data-table');
57
58 // Data table resizing
59 if (dataTable.width() > dataTableContainer.width()) {
60 self.setTableHorizontal();
61 }
62 $(window).on('resize', function() {
63 self.setTableHorizontal();
64 self.setReportTitleMaxWidth();
65 });
66
67 this.setReportTitleMaxWidth();
68 },
69 saveSidebarState(isSidebarCollapsed) {
70 const data = {
71 ...iawpActions.update_user_settings,
72 'is_sidebar_collapsed': isSidebarCollapsed
73 };
74
75 jQuery.post(ajaxurl, data, (response) => {
76
77 }).fail(() => {
78
79 });
80 },
81 setMinMainHeight() {
82 $('.iawp-layout-main').css('min-height', $('.iawp-layout-sidebar .inner').outerHeight(true) + 32);
83 },
84 setTableHorizontal() {
85 if ($('#data-table').width() > $('#data-table-container').width()) {
86 $('#data-table-container').addClass('horizontal');
87 } else {
88 $('#data-table-container').removeClass('horizontal');
89 }
90 },
91 setReportTitleMaxWidth() {
92 if ($(window).width() < 600) {
93 $('.rename-report').css('max-width', '');
94 } else {
95 $('.rename-report').css('max-width', 'calc(100% - ' + $('.report-title-bar .buttons').width() + 'px)');
96 }
97 }
98 }
99
100 export { StickySidebar };