simplify steam workshop admin advanced fields
This commit is contained in:
parent
19a8e6a389
commit
3b186a61c0
2 changed files with 38 additions and 0 deletions
34
Panel/modules/steam_workshop/simple_admin_helper.php
Normal file
34
Panel/modules/steam_workshop/simple_admin_helper.php
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
function gsp_steam_workshop_simple_admin_script()
|
||||
{
|
||||
?>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
const advanced = ['_regex_','_mods_backreference_index_','_variable_','_place_after_','_mod_string_','_string_separator_','_filepath_'];
|
||||
const rows = Array.from(document.querySelectorAll('tr'));
|
||||
const hide = [];
|
||||
rows.forEach(row => {
|
||||
const t = row.innerText || '';
|
||||
if (advanced.some(a => t.indexOf(a) !== -1)) {
|
||||
row.style.display = 'none';
|
||||
hide.push(row);
|
||||
}
|
||||
});
|
||||
if (hide.length) {
|
||||
const btn = document.createElement('button');
|
||||
btn.type = 'button';
|
||||
btn.className = 'button';
|
||||
btn.textContent = 'Show Advanced Options';
|
||||
btn.onclick = function () {
|
||||
const show = hide[0].style.display === 'none';
|
||||
hide.forEach(r => r.style.display = show ? '' : 'none');
|
||||
btn.textContent = show ? 'Hide Advanced Options' : 'Show Advanced Options';
|
||||
};
|
||||
const table = document.querySelector('table');
|
||||
if (table && table.parentNode) table.parentNode.insertBefore(btn, table);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
|
@ -1,4 +1,6 @@
|
|||
<?php
|
||||
require_once(dirname(__FILE__) . '/simple_admin_helper.php');
|
||||
|
||||
/*
|
||||
*
|
||||
* OGP - Open Game Panel
|
||||
|
|
@ -252,4 +254,6 @@ function exec_ogp_module()
|
|||
$ft->end_form();
|
||||
}
|
||||
}
|
||||
|
||||
if (function_exists('gsp_steam_workshop_simple_admin_script')) { gsp_steam_workshop_simple_admin_script(); }
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue