Compare commits

..

No commits in common. "c347a9a773ef74bf14a9b231a22694e203ffabef" and "5eea63e2fd2f218a4f9fdc37de76a1d9234d4c57" have entirely different histories.

3 changed files with 30 additions and 223 deletions

View File

@ -14,7 +14,7 @@
$this->load->model('setting/setting'); $this->load->model('setting/setting');
if ($this->config->get('module_img_opti_status')) { if ($this->config->get('module_img_opti_status')) {
$nat_pos = $this->config->get('module_img_opti_menu_position'); $nat_pos = $this->config->get('module_img_opti_menu_position');
if (empty($nat_pos) || $nat_pos == 'sidebar' || $nat_pos == 'both') { if ($nat_pos == 'sidebar' || $nat_pos == 'both') {
if ($this->user->hasPermission('access', 'module/img_opti')) { if ($this->user->hasPermission('access', 'module/img_opti')) {
$nat_token_str = 'token=' . (isset($this->session->data['token']) ? $this->session->data['token'] : ''); $nat_token_str = 'token=' . (isset($this->session->data['token']) ? $this->session->data['token'] : '');
$nat_item = array( $nat_item = array(
@ -46,11 +46,10 @@
if (!$exists) { if (!$exists) {
if ($nat_menu_index > -1) { if ($nat_menu_index > -1) {
$data['menus'][$nat_menu_index]['children'][] = $nat_item; $data['menus'][$nat_menu_index]['children'][] = $nat_item;
$data['menus'][$nat_menu_index]['icon'] = 'fa-space-shuttle fa-rotate-270 fw';
} else { } else {
$data['menus'][] = array( $data['menus'][] = array(
'id' => 'menu-nat', 'id' => 'menu-nat',
'icon' => 'fa-space-shuttle fa-rotate-270 fw', 'icon' => 'fa-rocket fw',
'name' => '[NAT] Modules', 'name' => '[NAT] Modules',
'href' => '', 'href' => '',
'children' => array($nat_item) 'children' => array($nat_item)
@ -74,7 +73,7 @@
$this->load->model('setting/setting'); $this->load->model('setting/setting');
if ($this->config->get('module_img_opti_status')) { if ($this->config->get('module_img_opti_status')) {
$nat_pos = $this->config->get('module_img_opti_menu_position'); $nat_pos = $this->config->get('module_img_opti_menu_position');
if (empty($nat_pos) || $nat_pos == 'header' || $nat_pos == 'both') { if ($nat_pos == 'header' || $nat_pos == 'both') {
if ($this->user->hasPermission('access', 'module/img_opti')) { if ($this->user->hasPermission('access', 'module/img_opti')) {
$exists = false; $exists = false;
foreach ($data['nat_menus'] as $m) { foreach ($data['nat_menus'] as $m) {
@ -100,31 +99,13 @@
<operation error="skip"> <operation error="skip">
<search><![CDATA[</head>]]></search> <search><![CDATA[</head>]]></search>
<add position="before"><![CDATA[ <add position="before"><![CDATA[
<style type="text/css"> <style>
#nat-ecosystem-menu .fa-rocket { color: #ec741c !important; }
#nat-ecosystem-menu .fa-rocket:before { content: "\f197" !important; display: inline-block; transform: rotate(270deg); }
#nat-ecosystem-menu .fa-space-shuttle { color: #ec741c !important; }
a.img-thumbnail img, a.thumbnail img { a.img-thumbnail img, a.thumbnail img {
width: 100px !important; width: 100px !important;
height: 100px !important; height: 100px !important;
object-fit: contain !important; object-fit: contain !important;
} }
</style> </style>
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', function() {
if (typeof $ !== 'undefined') {
var $menu = $('#nat-ecosystem-menu');
if ($menu.length && !$('.navbar-right #nat-ecosystem-menu, .pull-right #nat-ecosystem-menu').length) {
var $logout = $('a[href*="common/logout"]').closest('li');
if ($logout.length) {
$menu.insertBefore($logout);
} else {
$('.nav.navbar-nav.navbar-right, .navbar-right, .nav.pull-right, #header .nav').first().append($menu);
}
}
}
});
</script>
]]></add> ]]></add>
</operation> </operation>
<operation error="skip"> <operation error="skip">
@ -133,7 +114,7 @@ document.addEventListener('DOMContentLoaded', function() {
<?php if (isset($nat_menus) && !empty($nat_menus) && empty($GLOBALS['nat_menu_rendered'])) { ?> <?php if (isset($nat_menus) && !empty($nat_menus) && empty($GLOBALS['nat_menu_rendered'])) { ?>
<?php $GLOBALS['nat_menu_rendered'] = true; ?> <?php $GLOBALS['nat_menu_rendered'] = true; ?>
<li class="dropdown" id="nat-ecosystem-menu"> <li class="dropdown" id="nat-ecosystem-menu">
<a class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-space-shuttle fa-rotate-270 fa-lg" style="color: #ec741c;"></i> <span class="hidden-xs hidden-sm hidden-md">[NAT]</span> <span class="caret"></span></a> <a class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-rocket fa-lg" style="color:#e74c3c;"></i> <span class="hidden-xs hidden-sm hidden-md">[NAT]</span> <span class="caret"></span></a>
<ul class="dropdown-menu dropdown-menu-right" id="nat-ecosystem-list"> <ul class="dropdown-menu dropdown-menu-right" id="nat-ecosystem-list">
<li class="dropdown-header">Ecosystem [NAT]</li> <li class="dropdown-header">Ecosystem [NAT]</li>
<?php foreach ($nat_menus as $n_menu) { ?> <?php foreach ($nat_menus as $n_menu) { ?>

View File

@ -389,18 +389,18 @@
</div> </div>
</div> </div>
<div class="row nat-opti-action-row" style="margin-top: 15px; display: flex; flex-wrap: wrap; align-items: stretch;"> <div class="row">
<div class="col-sm-10 col-xs-9" id="block-start" style="padding-right: 5px; display: flex;"> <div class="col-sm-10" id="block-start">
<button type="button" id="btn-start" class="btn btn-primary btn-lg btn-block" <?php echo !$gd_enabled ? 'disabled' : ''; ?> style="border-radius: 6px; font-weight: bold; min-height: 46px; height: 100%; display: flex; align-items: center; justify-content: center;"><i class="fa fa-play" style="margin-right: 8px;"></i> <?php echo $button_start; ?></button> <button type="button" id="btn-start" class="btn btn-primary btn-lg btn-block" <?php echo !$gd_enabled ? 'disabled' : ''; ?>><i class="fa fa-play"></i> <?php echo $button_start; ?></button>
</div> </div>
<div class="col-sm-2 col-xs-3" id="block-reset-cache" style="padding-left: 5px; display: flex;"> <div class="col-sm-2" id="block-reset-cache">
<button type="button" id="btn-reset-cache" class="btn btn-default btn-lg btn-block" data-toggle="tooltip" data-placement="top" title="<?php echo isset($help_btn_reset_cache) ? $help_btn_reset_cache : $text_reset_cache_hint; ?>" style="border-radius: 6px; min-height: 46px; height: 100%; display: flex; align-items: center; justify-content: center;"><i class="fa fa-eraser" style="font-size: 18px;"></i></button> <button type="button" id="btn-reset-cache" class="btn btn-default btn-lg btn-block" title="<?php echo $text_reset_cache_hint; ?>"><i class="fa fa-eraser"></i></button>
</div> </div>
<div class="col-sm-6 col-xs-6" id="block-pause" style="display:none; padding-right: 5px;"> <div class="col-sm-6" id="block-pause" style="display:none;">
<button type="button" id="btn-pause" class="btn btn-warning btn-lg btn-block" style="border-radius: 6px; font-weight: bold; min-height: 46px; height: 100%; display: flex; align-items: center; justify-content: center;"><i class="fa fa-pause" style="margin-right: 8px;"></i> <?php echo $button_pause; ?></button> <button type="button" id="btn-pause" class="btn btn-warning btn-lg btn-block"><i class="fa fa-pause"></i> <?php echo $button_pause; ?></button>
</div> </div>
<div class="col-sm-6 col-xs-6" id="block-stop" style="display:none; padding-left: 5px;"> <div class="col-sm-6" id="block-stop" style="display:none;">
<button type="button" id="btn-stop" class="btn btn-danger btn-lg btn-block" style="border-radius: 6px; font-weight: bold; min-height: 46px; height: 100%; display: flex; align-items: center; justify-content: center;"><i class="fa fa-stop" style="margin-right: 8px;"></i> <?php echo $button_stop; ?></button> <button type="button" id="btn-stop" class="btn btn-danger btn-lg btn-block"><i class="fa fa-stop"></i> <?php echo $button_stop; ?></button>
</div> </div>
</div> </div>
</div> </div>
@ -459,28 +459,6 @@
<div class="tab-pane" id="tab-cleaner"> <div class="tab-pane" id="tab-cleaner">
<div class="row"> <div class="row">
<div class="col-md-5"> <div class="col-md-5">
<div class="panel panel-default nat-smart-cache-panel" style="border-left: 4px solid #3498db; margin-bottom: 20px; background: #fdfefe;">
<div class="panel-body" style="padding: 15px;">
<div class="nat-smart-cache-flex">
<div class="nat-smart-cache-info">
<h4 style="margin: 0 0 5px 0; color: #2c3e50; font-weight: bold;">
<i class="fa fa-magic text-primary"></i> <?php echo $text_cleaner_smart_cache_title; ?>
<span data-toggle="popover" data-placement="bottom" title="<i class='fa fa-info-circle'></i> <?php echo $text_cleaner_smart_cache_popover_title; ?>" data-content="<?php echo $text_cleaner_smart_cache_popover_desc; ?>" style="cursor: pointer; margin-left: 6px; font-size: 15px; color: #3498db;">
<i class="fa fa-question-circle"></i>
</span>
</h4>
<div style="font-size: 12px; color: #7f8c8d; line-height: 1.4;">
<?php echo $text_cleaner_smart_cache_short_desc; ?>
</div>
</div>
<div class="nat-smart-cache-action">
<button type="button" id="btn-cleaner-smart-cache" class="btn btn-primary">
<i class="fa fa-magic"></i> <?php echo $button_cleaner_smart_cache; ?>
</button>
</div>
</div>
</div>
</div>
<div class="alert alert-info"><i class="fa fa-info-circle"></i> <?php echo $text_cleaner_info; ?></div> <div class="alert alert-info"><i class="fa fa-info-circle"></i> <?php echo $text_cleaner_info; ?></div>
<div id="form-cleaner"> <div id="form-cleaner">
<div class="form-group"> <div class="form-group">
@ -646,24 +624,22 @@
</div> </div>
<div class="row" style="margin-top: 20px;"> <div class="row" style="margin-top: 20px;">
<div class="col-md-12"> <div class="col-md-4">
<div style="background: #fffdf5; padding: 16px; border: 1px solid #f39c12; border-radius: 6px;"> <div class="checkbox" style="background: #fffdf5; padding: 15px; border: 1px solid #f39c12; border-radius: 6px; min-height: 150px; margin-top: 0; margin-bottom: 0;">
<div class="checkbox" style="margin-top: 0; margin-bottom: 8px;"> <label style="font-weight: bold; font-size: 14px; color: #d35400;">
<label style="font-weight: bold; font-size: 14px; color: #d35400;"> <input type="checkbox" name="module_img_opti_broken_fallback" value="1" <?php if (isset($module_img_opti_broken_fallback) && $module_img_opti_broken_fallback) { ?>checked="checked"<?php } ?>>
<input type="checkbox" name="module_img_opti_broken_fallback" id="chk-broken-fallback" value="1" <?php if (isset($module_img_opti_broken_fallback) && $module_img_opti_broken_fallback) { ?>checked="checked"<?php } ?>> <?php echo $entry_broken_fallback; ?>
<i class="fa fa-picture-o"></i> <?php echo $entry_broken_fallback; ?> </label>
</label> <div style="font-size: 12px; color: #666; margin-top: 8px; line-height: 1.4;"><?php echo $help_broken_fallback; ?></div>
</div> </div>
<div style="font-size: 12px; color: #666; line-height: 1.4; margin-bottom: 10px;"> </div>
<?php echo $help_broken_fallback; ?> <div class="col-md-8">
</div> <div class="form-group" style="background: #fffdf5; padding: 15px; border: 1px solid #f39c12; border-radius: 6px; min-height: 150px; margin-top: 0; margin-bottom: 0;">
<div id="fallback-image-box" style="<?php if (empty($module_img_opti_broken_fallback)) { ?>display: none;<?php } ?> margin-top: 10px; padding-top: 12px; border-top: 1px dashed #f0c36d;"> <label style="font-weight: bold; font-size: 14px; color: #d35400; margin-bottom: 8px;"><?php echo $entry_fallback_image; ?></label>
<label style="font-weight: bold; color: #333; font-size: 13px; margin-bottom: 8px; display: block;"><span data-toggle="tooltip" title="<?php echo $help_fallback_image; ?>" style="cursor:help; border-bottom:1px dashed #999;"><?php echo $entry_fallback_image; ?></span></label> <div style="display: flex; align-items: center; gap: 15px;">
<div style="display: flex; align-items: center; gap: 15px; flex-wrap: wrap;"> <a href="" id="thumb-fallback_image" data-toggle="image" class="img-thumbnail" style="margin-bottom: 0; flex-shrink: 0;"><img src="<?php echo $thumb_fallback_image; ?>" alt="" title="" data-placeholder="<?php echo $placeholder; ?>" /></a>
<a href="" id="thumb-fallback_image" data-toggle="image" class="img-thumbnail" style="margin-bottom: 0; flex-shrink: 0;"><img src="<?php echo $thumb_fallback_image; ?>" alt="" title="" data-placeholder="<?php echo $placeholder; ?>" /></a> <input type="hidden" name="module_img_opti_fallback_image" value="<?php echo $module_img_opti_fallback_image; ?>" id="input-fallback_image" />
<input type="hidden" name="module_img_opti_fallback_image" value="<?php echo $module_img_opti_fallback_image; ?>" id="input-fallback_image" /> <div style="font-size: 12px; color: #666; line-height: 1.4;"><?php echo $help_fallback_image; ?></div>
<div style="font-size: 12px; color: #666; line-height: 1.4; max-width: 650px;"><?php echo $help_fallback_image; ?></div>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -1368,14 +1344,6 @@ $(document).ready(function() {
} }
}); });
$(document).on('change', '#chk-broken-fallback', function() {
if ($(this).is(':checked')) {
$('#fallback-image-box').slideDown();
} else {
$('#fallback-image-box').slideUp();
}
});
$('#wm_type').on('change', function() { $('#wm_type').on('change', function() {
if ($(this).val() == 'text') { if ($(this).val() == 'text') {
$('#wm_image_wrap').hide(); $('#wm_image_wrap').hide();
@ -3292,52 +3260,6 @@ $(document).ready(function() {
$('#tool-selector').val(savedTool).trigger('change'); $('#tool-selector').val(savedTool).trigger('change');
} }
}); });
// ============ SMART CACHE CLEANER (FROM TAB-CLEANER) ============
$(document).on('click', '#btn-cleaner-smart-cache', function(e) {
e.preventDefault();
var $btn = $(this);
$btn.button('loading');
$.ajax({
url: 'index.php?route=module/img_opti/run_tool&' + tokenParam,
type: 'post',
data: { tool: 'smart_cache', action: 'scan' },
dataType: 'json',
success: function(json) {
$btn.button('reset');
if (json && json.status === 'ok') {
var html = '';
html += '<div class="alert alert-info" style="margin-bottom: 15px;">';
html += '<p><strong><i class="fa fa-info-circle"></i> ' + (json.title || 'Smart Cache Analysis') + '</strong></p>';
html += '<p style="margin: 5px 0 0 0;">' + (json.message || '') + '</p>';
html += '</div>';
if (json.details && json.details.length) {
html += '<div style="max-height: 250px; overflow-y: auto; border: 1px solid #ddd; padding: 10px; background: #fff; border-radius: 4px; font-size: 12px; font-family: monospace;">';
for (var i = 0; i < json.details.length; i++) {
html += '<div style="padding: 2px 0; border-bottom: 1px solid #f1f1f1;">' + json.details[i] + '</div>';
}
html += '</div>';
}
$('#smart-cache-modal-content').html(html);
if (json.total_orphans && json.total_orphans > 0) {
$('#btn-do-smart-cache-clean').show().find('span').text('<?php echo $button_clean_orphans_now; ?> (' + json.total_orphans + ')');
} else {
$('#btn-do-smart-cache-clean').hide();
}
$('#modal-cleaner-smart-cache').modal('show');
} else {
alert(json && json.error ? json.error : 'Unknown error during smart cache analysis');
}
},
error: function(xhr, ajaxOptions, thrownError) {
$btn.button('reset');
alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
}
});
});
</script> </script>
<div class="modal fade" id="modal-compare" tabindex="-1" role="dialog" aria-labelledby="compareModalLabel"> <div class="modal fade" id="modal-compare" tabindex="-1" role="dialog" aria-labelledby="compareModalLabel">
@ -3794,102 +3716,6 @@ $(document).on('click', '#btn-cleaner-smart-cache', function(e) {
.compare-img img { .compare-img img {
object-fit: contain; object-fit: contain;
} }
/* Smart Cache Cleaner Panel (Responsive Flex Layout) */
.nat-smart-cache-flex {
display: flex !important;
align-items: center !important;
justify-content: space-between !important;
gap: 15px !important;
flex-wrap: wrap !important;
}
.nat-smart-cache-info {
flex: 1 1 180px !important;
min-width: 170px !important;
}
.nat-smart-cache-action {
flex: 0 0 auto !important;
display: flex !important;
align-items: center !important;
}
.nat-smart-cache-action .btn,
#btn-cleaner-smart-cache {
display: inline-flex !important;
align-items: center !important;
justify-content: center !important;
gap: 8px !important;
min-height: 36px !important;
height: 36px !important;
line-height: 1 !important;
padding: 0 16px !important;
font-size: 13px !important;
font-weight: bold !important;
border-radius: 4px !important;
white-space: nowrap !important;
vertical-align: middle !important;
box-sizing: border-box !important;
}
.nat-smart-cache-action .btn i,
#btn-cleaner-smart-cache i {
margin: 0 !important;
font-size: 14px !important;
line-height: 1 !important;
}
@media (max-width: 767px) {
.nat-smart-cache-action {
width: 100% !important;
margin-top: 8px !important;
}
.nat-smart-cache-action .btn,
#btn-cleaner-smart-cache {
width: 100% !important;
display: flex !important;
}
}
html.nat-dark-mode .nat-smart-cache-panel,
body.nat-dark-mode .nat-smart-cache-panel {
border-left-color: #3498db !important;
}
/* Optimize Action Buttons Row Alignment */
.nat-opti-action-row {
margin-top: 15px !important;
display: flex !important;
flex-wrap: wrap !important;
align-items: stretch !important;
}
.nat-opti-action-row #btn-start,
.nat-opti-action-row #btn-reset-cache,
.nat-opti-action-row #btn-pause,
.nat-opti-action-row #btn-stop {
min-height: 46px !important;
height: 46px !important;
display: flex !important;
align-items: center !important;
justify-content: center !important;
box-sizing: border-box !important;
}
.nat-opti-action-row #btn-reset-cache i {
font-size: 18px !important;
}
.nat-opti-action-row #btn-start i,
.nat-opti-action-row #btn-pause i,
.nat-opti-action-row #btn-stop i {
margin-right: 8px !important;
font-size: 18px !important;
}
html.nat-dark-mode .nat-opti-action-row #btn-reset-cache,
body.nat-dark-mode .nat-opti-action-row #btn-reset-cache {
background-color: #1e293b !important;
border-color: #475569 !important;
color: #f1f5f9 !important;
}
html.nat-dark-mode .nat-opti-action-row #btn-reset-cache:hover,
body.nat-dark-mode .nat-opti-action-row #btn-reset-cache:hover {
background-color: #334155 !important;
border-color: #64748b !important;
color: #38bdf8 !important;
}
</style> </style>