AdminerTablesFilter: Persist filter value in a tab
This commit is contained in:
parent
2c8eff9b53
commit
28a84fec18
|
@ -8,7 +8,7 @@
|
||||||
*/
|
*/
|
||||||
class AdminerTablesFilter {
|
class AdminerTablesFilter {
|
||||||
function tablesPrint($tables) { ?>
|
function tablesPrint($tables) { ?>
|
||||||
<p class="jsonly"><input id="filter-field" onkeyup="tablesFilterInput();">
|
<p class="jsonly"><input id="filter-field" onkeyup="tablesFilterInput();" autocomplete="off">
|
||||||
<p id='tables' onmouseover='menuOver(this, event);' onmouseout='menuOut(this);'>
|
<p id='tables' onmouseover='menuOver(this, event);' onmouseout='menuOut(this);'>
|
||||||
<?php
|
<?php
|
||||||
foreach ($tables as $table => $type) {
|
foreach ($tables as $table => $type) {
|
||||||
|
@ -30,6 +30,9 @@ function tablesFilter(){
|
||||||
var reg = (value + '').replace(/([\\\.\+\*\?\[\^\]\$\(\)\{\}\=\!\<\>\|\:])/g, '\\$1');
|
var reg = (value + '').replace(/([\\\.\+\*\?\[\^\]\$\(\)\{\}\=\!\<\>\|\:])/g, '\\$1');
|
||||||
reg = new RegExp('('+ reg + ')', 'gi');
|
reg = new RegExp('('+ reg + ')', 'gi');
|
||||||
}
|
}
|
||||||
|
if (sessionStorage) {
|
||||||
|
sessionStorage.setItem('adminer_tables_filter', value);
|
||||||
|
}
|
||||||
var tables = document.getElementById('tables').getElementsByTagName('span');
|
var tables = document.getElementById('tables').getElementsByTagName('span');
|
||||||
for (var i = 0; i < tables.length; i++) {
|
for (var i = 0; i < tables.length; i++) {
|
||||||
var a = tables[i].getElementsByTagName('a')[1];
|
var a = tables[i].getElementsByTagName('a')[1];
|
||||||
|
@ -49,9 +52,15 @@ function tablesFilterInput() {
|
||||||
tablesFilterTimeout = window.setTimeout(tablesFilter, 200);
|
tablesFilterTimeout = window.setTimeout(tablesFilter, 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (document.getElementById('filter-field').value){
|
if (sessionStorage){
|
||||||
|
var db = document.getElementById('dbs').getElementsByTagName('select')[0];
|
||||||
|
db = db.options[db.selectedIndex].text;
|
||||||
|
if (db == sessionStorage.getItem('adminer_tables_filter_db') && sessionStorage.getItem('adminer_tables_filter')){
|
||||||
|
document.getElementById('filter-field').value = sessionStorage.getItem('adminer_tables_filter');
|
||||||
tablesFilter();
|
tablesFilter();
|
||||||
}
|
}
|
||||||
|
sessionStorage.setItem('adminer_tables_filter_db', db);
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue