Live-update stamp preview as user types
This commit is contained in:
parent
5d7cf78484
commit
533f5b5e26
@ -67,7 +67,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
||||||
<button type="button" class="btn btn-primary" onclick="saveSettingsModal()">Save</button>
|
<button type="button" class="btn btn-primary" onclick="saveSettingsModal()"><i class="fas fa-save"></i> Save Settings</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -10,12 +10,22 @@ var signaturePadCallback = function () {};
|
|||||||
var clientSignatureSvg = "";
|
var clientSignatureSvg = "";
|
||||||
|
|
||||||
function getStampSvg(callback) {
|
function getStampSvg(callback) {
|
||||||
$.get("templates/stamps/" + getStorage("notary_state") + ".svg", {}, function (data) {
|
getStampSvgWithValues({
|
||||||
|
name: getStorage("notary_name"),
|
||||||
|
location: getStorage("notary_location"),
|
||||||
|
expires: getStorage("notary_expires"),
|
||||||
|
idnumber: getStorage("notary_idnumber"),
|
||||||
|
state: getStorage("notary_state")
|
||||||
|
}, callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getStampSvgWithValues(values, callback) {
|
||||||
|
$.get("templates/stamps/" + values.state + ".svg", {}, function (data) {
|
||||||
data = data + "";
|
data = data + "";
|
||||||
data = data.replaceAll("[[[NAME]]]", getStorage("notary_name"));
|
data = data.replaceAll("[[[NAME]]]", values.name);
|
||||||
data = data.replaceAll("[[[LOCATION]]]", getStorage("notary_location"));
|
data = data.replaceAll("[[[LOCATION]]]", values.location);
|
||||||
data = data.replaceAll("[[[EXPIRES]]]", getStorage("notary_expires"));
|
data = data.replaceAll("[[[EXPIRES]]]", values.expires);
|
||||||
data = data.replaceAll("[[[IDNUMBER]]]", getStorage("notary_idnumber"));
|
data = data.replaceAll("[[[IDNUMBER]]]", values.idnumber);
|
||||||
|
|
||||||
callback(data);
|
callback(data);
|
||||||
}, "text");
|
}, "text");
|
||||||
|
14
js/main.js
14
js/main.js
@ -121,4 +121,16 @@ function trimAndShrinkSVG(svgstring) {
|
|||||||
//console.log(svg.outerHTML);
|
//console.log(svg.outerHTML);
|
||||||
div.innerHTML = "";
|
div.innerHTML = "";
|
||||||
return svg.outerHTML;
|
return svg.outerHTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$("body").on("input change paste", "#settingsModal input", function () {
|
||||||
|
getStampSvgWithValues({
|
||||||
|
name: $("#settingsModal #notary_name").val(),
|
||||||
|
location: $("#settingsModal #notary_location").val(),
|
||||||
|
expires: $("#settingsModal #notary_expires").val(),
|
||||||
|
idnumber: $("#settingsModal #notary_idnumber").val(),
|
||||||
|
state: $("#settingsModal #notary_state option:selected").val()
|
||||||
|
}, function (svg) {
|
||||||
|
$("#settingsModal #stamp-preview").attr("src", "data:image/svg+xml;base64," + btoa(svg));
|
||||||
|
});
|
||||||
|
});
|
Loading…
x
Reference in New Issue
Block a user