mirror of
https://github.com/rakion99/shelter-editor.git
synced 2026-09-22 18:12:15 +00:00
Added Self-Healing to the Number Inputs
The number inputs now self-heal after a few seconds if left empty. This will prevent any possible save errors or confusion.
This commit is contained in:
1 parent
2f7c7fd3d2
commit
5e8f6795e7
2 files changed
+16
-2
No files matched your search
@@ -332,8 +332,6 @@
|
||||
<script src="js/FileSaver.js"></script>
|
||||
<script src="js/shelter.js"></script>
|
||||
<script src="js/jscolor.js"></script>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
|
||||
|
||||
@@ -30,6 +30,21 @@ function colorConverter(colorhex, mode)
|
||||
}
|
||||
}
|
||||
|
||||
//lazy code addition, but I believe it is beneficial and not too invasive.
|
||||
function numberCheckHelper()
|
||||
{
|
||||
$("input[type='number']").each(function()
|
||||
{
|
||||
if($(this).val === undefined || $(this).val().trim().length == 0 || $(this).val() == null)
|
||||
{
|
||||
var a = $(this).attr("min");
|
||||
if(a === undefined) a = 0;
|
||||
$(this).val(a);
|
||||
}
|
||||
});
|
||||
setTimeout(numberCheckHelper, 3000);
|
||||
}
|
||||
|
||||
function colortofos()
|
||||
{
|
||||
var colorhex = document.getElementsByClassName("jscolor")[0].value;
|
||||
@@ -39,6 +54,7 @@ function colortofos()
|
||||
$(document).ready(function(){
|
||||
|
||||
|
||||
numberCheckHelper();
|
||||
if(window.location.href.indexOf("?preset=") > -1 && window.location.href.indexOf("?savename=") > -1){
|
||||
|
||||
urlPreset = window.location.href.substring(window.location.href.indexOf("?preset=")+8, window.location.href.indexOf("?savename="));
|
||||
|
||||
Reference in new issue
Block a user