Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
viswanathr73 committed Jun 6, 2023
0 parents commit a488744
Show file tree
Hide file tree
Showing 94 changed files with 98,176 additions and 0 deletions.
1,023 changes: 1,023 additions & 0 deletions assets/css/style.css

Large diffs are not rendered by default.

Binary file added assets/img/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/bg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/bg.webp
Binary file not shown.
Binary file added assets/img/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/me.webp
Binary file not shown.
Binary file added assets/img/portfolio/Netflix.webp
Binary file not shown.
Binary file added assets/img/portfolio/Zerodha.webp
Binary file not shown.
104 changes: 104 additions & 0 deletions assets/js/form-validation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
function validateForm() {
var name = document.getElementById("name").value;
var mobilenumber = document.getElementById("mobilenumber").value;
var email = document.getElementById("email").value;
var subject = document.getElementById("subject").value;
var message = document.getElementById("message").value;
var msg1 = document.getElementById("msg1")

if (name == "") {
msg1.innerHTML = "Name must be filled out"
setTimeout(function () {
msg1.innerHTML = ""
}, 5000)
return false;
}

if (/\d/.test(name)) {
msg1.innerHTML = "Name must be character"
setTimeout(function () {
msg1.innerHTML = ""
}, 5000)
return false
}

if (mobilenumber == "") {
msg1.innerHTML = "Mobile Number must be filled out"
setTimeout(function () {
msg1.innerHTML = ""
}, 5000)
return false;
}

if (isNaN(mobilenumber)) {
msg1.innerHTML = "Mobile Number must be Digits"
setTimeout(function () {
msg1.innerHTML = ""
}, 5000)
return false
}

if (mobilenumber.length < 10) {
msg1.innerHTML = "Mobile Number must have 10 digits"
setTimeout(function () {
msg1.innerHTML = ""
}, 5000)
return false
}

if (mobilenumber.length > 10) {
msg1.innerHTML = "Mobile Number must have only 10 digits"
setTimeout(function () {
msg1.innerHTML = ""
}, 5000)
return false
}

var emailRegex = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
if (!emailRegex.test(email)) {
msg1.innerHTML = "Email must be a valid email address"
setTimeout(function () {
msg1.innerHTML = ""
}, 5000)
return false;
}

if (subject == "") {
msg1.innerHTML = "Subject must be filled out"
setTimeout(function () {
msg1.innerHTML = ""
}, 5000)
return false;
}


if (message == "") {
msg1.innerHTML = "Message must be filled out"
setTimeout(function () {
msg1.innerHTML = ""
}, 5000)
return false;
}

return true;
}

const scriptURL = 'https://script.google.com/macros/s/AKfycbwqNYxDj_FxTnM5lKZw6nSVXzI8oGLHALX6Hv527jUucnlVAVafa-J_ftHUSUinKjk/exec'
const form = document.getElementById("form")
const msg = document.getElementById("msg")

form.addEventListener('submit', e => {
e.preventDefault()
if (validateForm()) {
fetch(scriptURL, { method: 'POST', body: new FormData(form) })
.then(response => {
msg.innerHTML = "Sent Successfully"
// alert("Sent Successfully")
setTimeout(function () {
msg.innerHTML = ""
}, 5000)
form.reset()
})
.catch(error => console.error('Error!', error.message))
}
})
219 changes: 219 additions & 0 deletions assets/js/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,219 @@
(function() {
"use strict";

/**
* Easy selector helper function
*/
const select = (el, all = false) => {
el = el.trim()
if (all) {
return [...document.querySelectorAll(el)]
} else {
return document.querySelector(el)
}
}

/**
* Easy event listener function
*/
const on = (type, el, listener, all = false) => {
let selectEl = select(el, all)

if (selectEl) {
if (all) {
selectEl.forEach(e => e.addEventListener(type, listener))
} else {
selectEl.addEventListener(type, listener)
}
}
}

/**
* Scrolls to an element with header offset
*/
const scrollto = (el) => {
window.scrollTo({
top: 0,
behavior: 'smooth'
})
}

/**
* Mobile nav toggle
*/
on('click', '.mobile-nav-toggle', function(e) {
select('#navbar').classList.toggle('navbar-mobile')
this.classList.toggle('bi-list')
this.classList.toggle('bi-x')
})

/**
* Scrool with ofset on links with a class name .scrollto
*/
on('click', '#navbar .nav-link', function(e) {
let section = select(this.hash)
if (section) {
e.preventDefault()

let navbar = select('#navbar')
let header = select('#header')
let sections = select('section', true)
let navlinks = select('#navbar .nav-link', true)

navlinks.forEach((item) => {
item.classList.remove('active')
})

this.classList.add('active')

if (navbar.classList.contains('navbar-mobile')) {
navbar.classList.remove('navbar-mobile')
let navbarToggle = select('.mobile-nav-toggle')
navbarToggle.classList.toggle('bi-list')
navbarToggle.classList.toggle('bi-x')
}

if (this.hash == '#header') {
header.classList.remove('header-top')
sections.forEach((item) => {
item.classList.remove('section-show')
})
return;
}

if (!header.classList.contains('header-top')) {
header.classList.add('header-top')
setTimeout(function() {
sections.forEach((item) => {
item.classList.remove('section-show')
})
section.classList.add('section-show')

}, 350);
} else {
sections.forEach((item) => {
item.classList.remove('section-show')
})
section.classList.add('section-show')
}

scrollto(this.hash)
}
}, true)

/**
* Activate/show sections on load with hash links
*/
window.addEventListener('load', () => {
if (window.location.hash) {
let initial_nav = select(window.location.hash)

if (initial_nav) {
let header = select('#header')
let navlinks = select('#navbar .nav-link', true)

header.classList.add('header-top')

navlinks.forEach((item) => {
if (item.getAttribute('href') == window.location.hash) {
item.classList.add('active')
} else {
item.classList.remove('active')
}
})

setTimeout(function() {
initial_nav.classList.add('section-show')
}, 350);

scrollto(window.location.hash)
}
}
});

/**
* Skills animation
*/
let skilsContent = select('.skills-content');
if (skilsContent) {
new Waypoint({
element: skilsContent,
offset: '80%',
handler: function(direction) {
let progress = select('.progress .progress-bar', true);
progress.forEach((el) => {
el.style.width = el.getAttribute('aria-valuenow') + '%'
});
}
})
}

/**
* Porfolio isotope and filter
*/
window.addEventListener('load', () => {
let portfolioContainer = select('.portfolio-container');
if (portfolioContainer) {
let portfolioIsotope = new Isotope(portfolioContainer, {
itemSelector: '.portfolio-item',
layoutMode: 'fitRows'
});

let portfolioFilters = select('#portfolio-flters li', true);

on('click', '#portfolio-flters li', function(e) {
e.preventDefault();
portfolioFilters.forEach(function(el) {
el.classList.remove('filter-active');
});
this.classList.add('filter-active');

portfolioIsotope.arrange({
filter: this.getAttribute('data-filter')
});
}, true);
}

});

/**
* Initiate portfolio lightbox
*/
const portfolioLightbox = GLightbox({
selector: '.portfolio-lightbox'
});

/**
* Initiate portfolio details lightbox
*/
const portfolioDetailsLightbox = GLightbox({
selector: '.portfolio-details-lightbox',
width: '90%',
height: '90vh'
});

/**
* Portfolio details slider
*/
new Swiper('.portfolio-details-slider', {
speed: 400,
loop: true,
autoplay: {
delay: 5000,
disableOnInteraction: false
},
pagination: {
el: '.swiper-pagination',
type: 'bullets',
clickable: true
}
});

/**
* Initiate Pure Counter
*/
new PureCounter();

})()


Loading

0 comments on commit a488744

Please sign in to comment.