-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
34 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,32 @@ | ||
const typedTextSpan = document.querySelector(".typed-text"), | ||
textArray = ["Javascript", "IT Enthusiast","Cyber Security"], | ||
typingDelay = 200, | ||
erasingDelay = 100, | ||
newTextDelay = 2e3; | ||
let textArrayIndex = 0, | ||
charIndex = 0; | ||
const typedTextSpan = document.querySelector(".typed-text"); | ||
const textArray = ["Javascript", "IT Enthusiast", "Cyber Security"]; | ||
const typingDelay = 200; | ||
const erasingDelay = 100; | ||
const newTextDelay = 2000; | ||
let textArrayIndex = 0; | ||
let charIndex = 0; | ||
|
||
function type() { charIndex < textArray[textArrayIndex].length ? (typedTextSpan.textContent += textArray[textArrayIndex].charAt(charIndex), charIndex++, setTimeout(type, 200)) : setTimeout(erase, 2e3) } | ||
function type() { | ||
if (charIndex < textArray[textArrayIndex].length) { | ||
typedTextSpan.textContent += textArray[textArrayIndex].charAt(charIndex); | ||
charIndex++; | ||
setTimeout(type, typingDelay); | ||
} else { | ||
setTimeout(erase, newTextDelay); | ||
} | ||
} | ||
|
||
function erase() { charIndex > 0 ? (typedTextSpan.textContent = textArray[textArrayIndex].substring(0, charIndex - 1), charIndex--, setTimeout(erase, 100)) : (textArrayIndex++, textArrayIndex >= textArray.length && (textArrayIndex = 0), setTimeout(type, 1300)) } | ||
document.addEventListener("DOMContentLoaded", (function() { setTimeout(type, 2250) })); | ||
function erase() { | ||
if (charIndex > 0) { | ||
typedTextSpan.textContent = textArray[textArrayIndex].substring(0, charIndex - 1); | ||
charIndex--; | ||
setTimeout(erase, erasingDelay); | ||
} else { | ||
textArrayIndex = (textArrayIndex + 1) % textArray.length; | ||
setTimeout(type, typingDelay); | ||
} | ||
} | ||
|
||
$(document).ready((function() { | ||
$(".changeprofile").submit((function(e) { | ||
var formObj, formURL = $(this).attr("action"), | ||
formData = new FormData(this); | ||
$.ajax({ url: formURL, type: "POST", data: formData, contentType: !1, cache: !1, processData: !1, beforeSend: function() { $("button").attr("disabled", "disabled"), $("input").attr("disabled", "disabled"), $("a").attr("disabled", "disabled"), $(".inibutton").html('<i class="fas fa-spinner fa-spin"></i> Wait') }, success: function(data) { data.includes("Success") ? ($("button").removeAttr("disabled", "disabled"), $("a").removeAttr("disabled", "disabled"), $("input").removeAttr("disabled", "disabled"), $(".inibutton").html("Save"), $.notify({ icon: "tim-icons icon-check-2", message: data }, { type: "success", timer: 3e3, placement: { from: "top", align: "right" } }), window.location = window.location) : ($("button").removeAttr("disabled", "disabled"), $("a").removeAttr("disabled", "disabled"), $("input").removeAttr("disabled", "disabled"), $(".inibutton").html("Save"), $.notify({ icon: "tim-icons icon-simple-remove", message: data }, { type: "danger", timer: 3e3, placement: { from: "top", align: "right" } })) } }), e.preventDefault() | ||
})) | ||
})) | ||
document.addEventListener("DOMContentLoaded", function() { | ||
setTimeout(type, newTextDelay); | ||
}); |