mirror of
https://github.com/hkalexling/Mango.git
synced 2025-08-03 11:25:29 -04:00
Save last used plugin in local storage
This commit is contained in:
parent
0e1e4de528
commit
8349fb68a4
@ -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 => {
|
$('#search-input').keypress(event => {
|
||||||
if (event.which === 13) {
|
if (event.which === 13) {
|
||||||
search();
|
search();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
$('#plugin-select').val(plugin);
|
||||||
$('#plugin-select').change(() => {
|
$('#plugin-select').change(() => {
|
||||||
const title = $('#plugin-select').val();
|
const title = $('#plugin-select').val();
|
||||||
const url = `${location.protocol}//${location.host}${location.pathname}`;
|
loadPlugin(title);
|
||||||
const newURL = `${url}?${$.param({
|
|
||||||
plugin: encodeURIComponent(title)
|
|
||||||
})}`;
|
|
||||||
window.location.href = newURL;
|
|
||||||
});
|
});
|
||||||
$('#plugin-select').val(plugin);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
let mangaTitle = "";
|
let mangaTitle = "";
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
<% else %>
|
<% else %>
|
||||||
<h2 class=uk-title>Download with Plugins</h2>
|
<h2 class=uk-title>Download with Plugins</h2>
|
||||||
|
|
||||||
<div class="uk-grid-small" uk-grid>
|
<div id="controls" class="uk-grid-small" uk-grid hidden>
|
||||||
<div class="uk-width-3-4@m uk-child-width-1-1">
|
<div class="uk-width-3-4@m uk-child-width-1-1">
|
||||||
<div class="uk-margin">
|
<div class="uk-margin">
|
||||||
<label class="uk-form-label" for="search-input"> </label>
|
<label class="uk-form-label" for="search-input"> </label>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user