Browse Source

implement showing last modification date

dev
hoschi-it 3 years ago
parent
commit
66da56a9b0
  1. 2
      code.js
  2. 14
      functions.js
  3. 3
      index.html

2
code.js

@ -10,4 +10,6 @@ window.onload = function() {
element.addEventListener('input', this.focusNextMaskElement);
}
}
this.injectLastModificationDate();
};

14
functions.js

@ -18,8 +18,12 @@ function removeActiveInputText() {
}
function focusNextMaskElement() {
if (isMaskElementSelected() && !isSelectedElementLast()) {
document.activeElement.nextElementSibling.focus();
if (isMaskElementSelected()) {
if (!isSelectedElementLast()) {
document.activeElement.nextElementSibling.focus();
} else {
document.focus();
}
}
}
@ -30,3 +34,9 @@ function clearForm() {
e.value = '';
}
}
function injectLastModificationDate() {
var lastEditedElem = this.document.getElementById('lastEdit');
var lastEdited = new Date(this.document.lastModified);
lastEditedElem.textContent = lastEdited.toString();
}

3
index.html

@ -16,6 +16,9 @@
</form>
<button onclick="clearForm()">Clear</button>
</section>
<section>
<p>Last code edit on <span id="lastEdit"></span></p>
</section>
<script src="build.min.js"></script>
</body>
</html>
Loading…
Cancel
Save