| @@ -20,53 +20,26 @@ | ||
| 20 | 20 | $fcgiButton.removeClass('active'); |
| 21 | 21 | $fcgiSettings.slideUp('fast'); |
| 22 | 22 | }); |
| 23 | 23 | |
| 24 | - // Remove page cache notice after 2 seconds | |
| 25 | - if ($('#fly-page-cache-notice').length) { | |
| 24 | + // Remove form update notice after 2 seconds | |
| 25 | + if ($('.fly-form-notice').length) { | |
| 26 | 26 | setTimeout(function () { |
| 27 | - $('#fly-page-cache-notice').fadeOut('slow'); | |
| 27 | + $('.fly-form-notice').fadeOut('slow', function () { | |
| 28 | + $(this).remove(); | |
| 29 | + }); | |
| 28 | 30 | }, 2000); |
| 29 | 31 | } |
| 30 | 32 | |
| 31 | - var colors = ['#F87171', '#16a34a', '#FBBF24',]; | |
| 32 | - var opcacheMemory = $('#opcache-memory'), | |
| 33 | - opcacheKeys = $('#opcache-keys'), | |
| 34 | - opcacheHits = $('#opcache-hits'); | |
| 33 | + if ($('#optimization-wrapper').length) { | |
| 34 | + let sections = $('#optimization-wrapper .section'); | |
| 35 | 35 | |
| 36 | - new Chart(opcacheMemory, { | |
| 37 | - type: 'doughnut', | |
| 38 | - data: { | |
| 39 | - labels: ['Used', 'Free', 'Wasted'], | |
| 40 | - datasets: [{ | |
| 41 | - data: [80, 15, 5], | |
| 42 | - backgroundColor: colors, | |
| 43 | - }], | |
| 44 | - hoverOffset: 10 | |
| 45 | - }, | |
| 46 | - }); | |
| 47 | - | |
| 48 | - new Chart(opcacheKeys, { | |
| 49 | - type: 'doughnut', | |
| 50 | - data: { | |
| 51 | - labels: ['Used', 'Free', 'Wasted'], | |
| 52 | - datasets: [{ | |
| 53 | - data: [80, 15, 5], | |
| 54 | - backgroundColor: colors, | |
| 55 | - }], | |
| 56 | - hoverOffset: 10 | |
| 57 | - }, | |
| 58 | - }); | |
| 59 | - | |
| 60 | - new Chart(opcacheHits, { | |
| 61 | - type: 'doughnut', | |
| 62 | - data: { | |
| 63 | - labels: ['Used', 'Free', 'Wasted'], | |
| 64 | - datasets: [{ | |
| 65 | - data: [80, 15, 5], | |
| 66 | - backgroundColor: colors, | |
| 67 | - }], | |
| 68 | - hoverOffset: 10 | |
| 69 | - }, | |
| 70 | - }); | |
| 36 | + $('input[id="enable-optimization"]').on('change', function () { | |
| 37 | + if ($(this).is(':checked')) { | |
| 38 | + sections.slideDown('fast'); | |
| 39 | + } else { | |
| 40 | + sections.slideUp('fast'); | |
| 41 | + } | |
| 42 | + }); | |
| 43 | + } | |
| 71 | 44 | |
| 72 | 45 | })(jQuery); |