Add support for popup on the search page
This commit is contained in:
parent
1a9348ec27
commit
42ec3e2a43
@ -220,7 +220,8 @@ function optionsSetDefaults(options) {
|
||||
length: 10,
|
||||
modifier: 'shift',
|
||||
deepDomScan: false,
|
||||
popupNestingMaxDepth: 0
|
||||
popupNestingMaxDepth: 0,
|
||||
enableOnSearchPage: true
|
||||
},
|
||||
|
||||
dictionaries: {},
|
||||
|
51
ext/bg/js/search-frontend.js
Normal file
51
ext/bg/js/search-frontend.js
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Alex Yatskov <alex@foosoft.net>
|
||||
* Author: Alex Yatskov <alex@foosoft.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
async function searchFrontendSetup() {
|
||||
const options = await apiOptionsGet();
|
||||
if (!options.scanning.enableOnSearchPage) { return; }
|
||||
|
||||
const scriptSrcs = [
|
||||
'/fg/js/api.js',
|
||||
'/fg/js/frontend-api-receiver.js',
|
||||
'/fg/js/popup.js',
|
||||
'/fg/js/popup-proxy-host.js',
|
||||
'/fg/js/util.js',
|
||||
'/fg/js/frontend.js'
|
||||
];
|
||||
for (const src of scriptSrcs) {
|
||||
const script = document.createElement('script');
|
||||
script.async = false;
|
||||
script.src = src;
|
||||
document.body.appendChild(script);
|
||||
}
|
||||
|
||||
const styleSrcs = [
|
||||
'/fg/css/client.css'
|
||||
];
|
||||
for (const src of styleSrcs) {
|
||||
const style = document.createElement('link');
|
||||
style.rel = 'stylesheet';
|
||||
style.type = 'text/css';
|
||||
style.href = src;
|
||||
document.head.appendChild(style);
|
||||
}
|
||||
}
|
||||
|
||||
searchFrontendSetup();
|
@ -48,6 +48,7 @@ async function formRead() {
|
||||
optionsNew.scanning.alphanumeric = $('#search-alphanumeric').prop('checked');
|
||||
optionsNew.scanning.autoHideResults = $('#auto-hide-results').prop('checked');
|
||||
optionsNew.scanning.deepDomScan = $('#deep-dom-scan').prop('checked');
|
||||
optionsNew.scanning.enableOnSearchPage = $('#enable-scanning-on-search-page').prop('checked');
|
||||
optionsNew.scanning.delay = parseInt($('#scan-delay').val(), 10);
|
||||
optionsNew.scanning.length = parseInt($('#scan-length').val(), 10);
|
||||
optionsNew.scanning.modifier = $('#scan-modifier-key').val();
|
||||
@ -190,6 +191,7 @@ async function onReady() {
|
||||
$('#search-alphanumeric').prop('checked', options.scanning.alphanumeric);
|
||||
$('#auto-hide-results').prop('checked', options.scanning.autoHideResults);
|
||||
$('#deep-dom-scan').prop('checked', options.scanning.deepDomScan);
|
||||
$('#enable-scanning-on-search-page').prop('checked', options.scanning.enableOnSearchPage);
|
||||
$('#scan-delay').val(options.scanning.delay);
|
||||
$('#scan-length').val(options.scanning.length);
|
||||
$('#scan-modifier-key').val(options.scanning.modifier);
|
||||
|
@ -51,5 +51,6 @@
|
||||
<script src="/mixed/js/japanese.js"></script>
|
||||
|
||||
<script src="/bg/js/search.js"></script>
|
||||
<script src="/bg/js/search-frontend.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -192,6 +192,10 @@
|
||||
<label><input type="checkbox" id="auto-hide-results"> Automatically hide results</label>
|
||||
</div>
|
||||
|
||||
<div class="checkbox">
|
||||
<label><input type="checkbox" id="enable-scanning-on-search-page"> Enable scanning on search page</label>
|
||||
</div>
|
||||
|
||||
<div class="checkbox options-advanced">
|
||||
<label><input type="checkbox" id="deep-dom-scan"> Deep DOM scan</label>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user