simplify steam workshop admin advanced fields

This commit is contained in:
Frank Harris 2026-06-09 14:58:34 -05:00
parent 19a8e6a389
commit 3b186a61c0
2 changed files with 38 additions and 0 deletions

View 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
}
?>

View file

@ -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(); }
?>