File Editor
Directories:
.. (Back)
builder
education
entries
Files:
connect.js
connect.min.js
dashboard-widget.js
dashboard-widget.min.js
Create New File
Create
Edit File: dashboard-widget.min.js
const WPFormsDashboardWidget=window.WPFormsDashboardWidget||function(t){const s={$widget:t("#wpforms_reports_widget_lite"),$settingsBtn:t("#wpforms-dash-widget-settings-button"),$canvas:t("#wpforms-dash-widget-chart"),$chartDismissButton:t(".wpforms-dash-widget-dismiss-chart-upgrade"),$dismissButton:t(".wpforms-dash-widget-dismiss-icon"),$recommendedBlockDismissButton:t("#wpforms-dash-widget-dismiss-recommended-plugin-block")};var e=t("body").hasClass("rtl"),a={instance:null,settings:{type:"line",data:{labels:[],datasets:[{label:wpforms_dashboard_widget.i18n.entries,data:[],backgroundColor:"rgba(255, 129, 0, 0.135)",borderColor:"rgba(211, 126, 71, 1)",borderWidth:2,pointRadius:4,pointBorderWidth:1,pointBackgroundColor:"rgba(255, 255, 255, 1)"}]},options:{maintainAspectRatio:!1,scales:{x:{type:"timeseries",reverse:e,ticks:{source:"labels",padding:10,minRotation:25,maxRotation:25,callback(e,s,t){var a=Math.floor(t.length/7);return a<1||(t.length-s-1)%a==0?moment(e).format("MMM D"):void 0}}},y:{beginAtZero:!0,ticks:{maxTicksLimit:6,padding:20,callback(e){if(Math.floor(e)===e)return e}}}},elements:{line:{tension:0,fill:!0}},animation:!1,plugins:{legend:{display:!1},tooltip:{displayColors:!1,rtl:e}}}},init(){var e;s.$canvas.length&&(e=s.$canvas[0].getContext("2d"),a.instance=new Chart(e,a.settings),a.updateUI())},updateUI(){a.updateWithDummyData(),a.instance.data.labels=a.settings.data.labels,a.instance.data.datasets[0].data=a.settings.data.datasets[0].data,a.instance.update()},updateWithDummyData(){var e,s=moment().endOf("day");let t;for(t=1;t<=7;t++)e=s.clone().subtract(t,"days"),a.settings.data.labels.push(e),a.settings.data.datasets[0].data.push({x:e,y:Math.floor(16*Math.random())+5})}},o={init(){t(o.ready)},ready(){a.init(),o.events(),o.graphSettings()},graphSettings(){s.$settingsBtn.on("click",function(){t(this).siblings(".wpforms-dash-widget-settings-menu").toggle()})},events(){o.formsListEvents(),o.handleChartClose(),o.handleRecommendedPluginsClose(),o.handleWidgetBlockClose()},formsListEvents(){s.$widget.on("click","#wpforms-dash-widget-forms-more",function(){o.toggleCompleteFormsList()})},handleChartClose(){s.$chartDismissButton.on("click",function(e){e.preventDefault(),o.saveWidgetMeta("hide_graph",1),t(".wpforms-dash-widget.wpforms-lite").addClass("wpforms-dash-widget-no-graph"),t(this).closest(".wpforms-dash-widget-chart-block-container").remove()})},handleRecommendedPluginsClose(){console.warn("WARNING! WPFormsDashboardWidget.handleRecommendedPluginsClose() has been deprecated, please use WPFormsDashboardWidget.handleWidgetBlockClose() instead."),s.$recommendedBlockDismissButton.on("click",function(){o.dismissRecommendedBlock()})},handleWidgetBlockClose(){s.$dismissButton.on("click",function(){o.dismissWidgetBlock(t(this))})},saveWidgetMeta(e,s){e={_wpnonce:wpforms_dashboard_widget.nonce,action:"wpforms_"+wpforms_dashboard_widget.slug+"_save_widget_meta",meta:e,value:s};t.post(ajaxurl,e)},toggleCompleteFormsList(){t("#wpforms-dash-widget-forms-list-table .wpforms-dash-widget-forms-list-hidden-el").toggle(),t("#wpforms-dash-widget-forms-more").html(function(e,s){return s===wpforms_dashboard_widget.show_less_html?wpforms_dashboard_widget.show_more_html:wpforms_dashboard_widget.show_less_html})},dismissWidgetBlock(e){e.closest(".wpforms-dash-widget-block").remove(),o.saveWidgetMeta(e.data("field"),1)},dismissRecommendedBlock(){console.warn("WARNING! WPFormsDashboardWidget.dismissRecommendedBlock() has been deprecated, please use WPFormsDashboardWidget.dismissWidgetBlock() instead."),t(".wpforms-dash-widget-recommended-plugin-block").remove(),o.saveWidgetMeta("hide_recommended_block",1)}};return o}((document,window,jQuery));WPFormsDashboardWidget.init();
Save Changes
Rename File
Rename