Skip to content

Commit

Permalink
improve edit GUI
Browse files Browse the repository at this point in the history
  • Loading branch information
garywill committed Nov 13, 2022
1 parent b051123 commit 8ac64a9
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/editengine.html
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,6 @@ <h2>JSON field</h2>
</details>
<br><br><br>

<div>
Notice: <br>
This GUI has no ask, no warning, and no any notice before doing load/save/delete/override operations yet. <b>Be mindful before click</b>.<br>
So, please keep your JSON safe as copies somewhere.

</div>

<div >

Expand Down Expand Up @@ -201,12 +195,12 @@ <h2>Editing-engines GUI Table for Big Search</h2>
</div>
</td>

<!--key column-->
<!-- id column-->
<td>


<code><input type="text" v-bind:rindex="index" class="" name="userName" placeholder="Unique Id (JSON key, programatical name)" v-model="row.key" /></code>
<button v-if="0" title="Generate a key name with random">Gen</button>
<button v-if="0" title="Generate an Id with random">Gen</button>
</td>

<!--display name column-->
Expand Down Expand Up @@ -352,7 +346,7 @@ <h3 class="accordion-header" id="">
<tr>
<th></th>
<th>Engine | Id</th>
<th>Search buttons (and buttons keys)</th>
<th>Search buttons (and buttons Ids)</th>
</tr>

</thead>
Expand Down
24 changes: 24 additions & 0 deletions src/editengine.js
Original file line number Diff line number Diff line change
Expand Up @@ -436,13 +436,28 @@ onrd.push(function() {
});

function load_from_ext() {
var con = false;
if ( bs_gui.userJsonArr.length > 0 )
con = confirm("Do you want to load saved custom engines from extension? \nThat will override what's currently in the table below.") ;
else
con = true;

if (!con)
return;

window.postMessage({
direction: "page-to-content",
app: "bigsearch-edit",
message: "getAddonUsercustom"
}, document.location.href);
}
function save_table_to_addon() {
var con = false;
con = confirm(`Do you want to save ${bs_gui.userJsonArr.length} custom engines to extension? \n \nThat will override your extension's current custom engines data. \n\nAre you sure to save and override?`) ;

if (!con)
return;

var res = false;
res = bs_gui.gui2json()
if (res) {
Expand Down Expand Up @@ -594,6 +609,15 @@ function genRandomInt(min,max) {


function load_example(template) {
var con = false;
if ( bs_gui.userJsonArr.length > 0 )
con = confirm("Do you want to load example into below table? \nThat will override what's currently in the table below.") ;
else
con = true;

if (!con)
return;

const template_default = `
{
"l_common" : { "lstr": "Favorite built-in engines" },
Expand Down

0 comments on commit 8ac64a9

Please sign in to comment.