diff --git a/public/js/plugin-download.js b/public/js/plugin-download.js index ff50fbb..1cb09fe 100644 --- a/public/js/plugin-download.js +++ b/public/js/plugin-download.js @@ -1,18 +1,30 @@ +const loadPlugin = title => { + localStorage.setItem('plugin', title); + const url = `${location.protocol}//${location.host}${location.pathname}`; + const newURL = `${url}?${$.param({ + plugin: encodeURIComponent(title) + })}`; + window.location.href = newURL; +}; + $(() => { + var storedTitle = localStorage.getItem('plugin'); + if (storedTitle && storedTitle !== plugin) { + loadPlugin(storedTitle); + } else { + $('#controls').removeAttr('hidden'); + } + $('#search-input').keypress(event => { if (event.which === 13) { search(); } }); + $('#plugin-select').val(plugin); $('#plugin-select').change(() => { const title = $('#plugin-select').val(); - const url = `${location.protocol}//${location.host}${location.pathname}`; - const newURL = `${url}?${$.param({ - plugin: encodeURIComponent(title) - })}`; - window.location.href = newURL; + loadPlugin(title); }); - $('#plugin-select').val(plugin); }); let mangaTitle = ""; diff --git a/src/views/plugin-download.html.ecr b/src/views/plugin-download.html.ecr index 8f4d99e..9d999fd 100644 --- a/src/views/plugin-download.html.ecr +++ b/src/views/plugin-download.html.ecr @@ -8,7 +8,7 @@ <% else %>