You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
2.9 KiB
JavaScript
67 lines
2.9 KiB
JavaScript
/*
|
|
* Copyright 2021 Netsyms Technologies.
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
*/
|
|
|
|
|
|
function setupNotaryOptions(name, email, location, expires, idnumber, state) {
|
|
setStorage("notary_name", name);
|
|
setStorage("notary_email", email.trim().toLowerCase());
|
|
setStorage("notary_location", location);
|
|
setStorage("notary_expires", expires);
|
|
setStorage("notary_idnumber", idnumber);
|
|
setStorage("notary_state", state);
|
|
}
|
|
|
|
function openSettingsModal() {
|
|
$("#settingsModal #notary_name").val(getStorage("notary_name"));
|
|
$("#settingsModal #notary_email").val(getStorage("notary_email"));
|
|
$("#settingsModal #notary_location").val(getStorage("notary_location"));
|
|
$("#settingsModal #notary_expires").val(getStorage("notary_expires"));
|
|
$("#settingsModal #notary_idnumber").val(getStorage("notary_idnumber"));
|
|
$("#settingsModal #notary_state").val(getStorage("notary_state"));
|
|
|
|
$("#settingsModal #color_theme").val(inStorage("color_theme") ? getStorage("color_theme") : "purple");
|
|
$("#settingsModal #button_size").val(getStorage("button_size") ? getStorage("button_size") : "sm");
|
|
// show preview of stamp
|
|
if (inStorage("notary_state")) {
|
|
getStampSvg(function (svg) {
|
|
$("#settingsModal #stamp-preview").attr("src", "data:image/svg+xml;base64," + btoa(svg));
|
|
});
|
|
}
|
|
|
|
// show signature
|
|
if (inStorage("notary_signature")) {
|
|
$("#settingsModal #signature-preview").attr("src", "data:image/svg+xml;base64," + btoa(getStorage("notary_signature")));
|
|
}
|
|
|
|
new bootstrap.Modal(document.getElementById('settingsModal')).show();
|
|
}
|
|
|
|
function saveSettingsModal() {
|
|
setupNotaryOptions(
|
|
$("#settingsModal #notary_name").val(),
|
|
$("#settingsModal #notary_email").val(),
|
|
$("#settingsModal #notary_location").val(),
|
|
$("#settingsModal #notary_expires").val(),
|
|
$("#settingsModal #notary_idnumber").val(),
|
|
$("#settingsModal #notary_state option:selected").val());
|
|
// show preview of stamp
|
|
if (inStorage("notary_state")) {
|
|
getStampSvg(function (svg) {
|
|
$("#settingsModal #stamp-preview").attr("src", "data:image/svg+xml;base64," + btoa(svg));
|
|
});
|
|
}
|
|
// show signature
|
|
if (inStorage("notary_signature")) {
|
|
$("#settingsModal #signature-preview").attr("src", "data:image/svg+xml;base64," + btoa(getStorage("notary_signature")));
|
|
}
|
|
|
|
setStorage("color_theme", $("#appOptionsSettings #color_theme option:selected").val());
|
|
setAppTheme(getStorage("color_theme"));
|
|
setStorage("button_size", $("#appOptionsSettings #button_size option:selected").val());
|
|
setButtonSize(getStorage("button_size"));
|
|
showToast("<i class='fas fa-check'></i> Settings saved.");
|
|
} |