Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- PROJECT: HOME-IFY
- Author: Jay Chowdhary
- BRO ARE YOU A FUCKING ASIAN CHOWMEIN COOK? FUCKING Chowdhary LMAO IT SOUNDS LIKE THAT SPICE CALLED CHOWDER BUT THEN SINCE YOU A ASIAN NIGGA, YOU HAVE CHOWDHARY
- Date: 11/10/2015
- File: main.js
- */
- /* global, alert, $, JQuery, confirm */
- /* User Structure */
- var User = {
- name: "",
- email: "",
- id: "",
- username: "",
- password: "",
- dob: "",
- gender: ""
- };
- /* too lazy */
- var icon = "<span class='glyphicon glyphicon-remove'></span> ";
- /* Accounts Array */
- var Accounts = (localStorage.getItem("Accounts") !== null) ? JSON.parse(localStorage.getItem("Accounts")) : [];
- /* Returns User Session [Active] */
- var c_user = (localStorage.getItem("Logged") !== null) ? JSON.parse(localStorage.getItem("Logged")) : [];
- /* Register */
- function register() {
- // Checks for errors
- if ((document.getElementById("first-name").value === "") || (document.getElementById("last-name").value === "")) {
- document.getElementById("error").innerHTML = icon + "Please enter your full name.";
- return;
- } else {
- User.name = document.getElementById("first-name").value + " " + document.getElementById("last-name").value;
- }
- if ((document.getElementById("email-id").value === "") || (document.getElementById("email-provider").value === "")) {
- document.getElementById("error").innerHTML = icon + "Please enter a valid e-mail.";
- return;
- } else {
- User.email = document.getElementById("email-id").value + "@" + document.getElementById("email-provider").value;
- }
- if (document.getElementById("username").value === "") {
- document.getElementById("error").innerHTML = icon + "Please enter a valid username";
- return;
- } else {
- User.username = document.getElementById("username").value;
- }
- if (document.getElementById("password").value === "") {
- document.getElementById("error").innerHTML = icon + "Please enter a valid password.";
- return;
- }
- if (document.getElementById("password").value !== document.getElementById("verify-password").value) {
- document.getElementById("error").innerHTML = icon + "The passwords entered do not match";
- return;
- } else {
- User.password = document.getElementById("password").value;
- }
- if ((document.getElementById("dob-month").value === "") || (document.getElementById("dob-day").value === "") || (document.getElementById("dob-year").value === "")) {
- document.getElementById("error").innerHTML = icon + "Please enter a valid birthday.";
- return;
- } else {
- User.dob = document.getElementById("dob-month").value + " " + document.getElementById("dob-day").value + " " + document.getElementById("dob-year").value;
- }
- if ((document.getElementById("gender-male").checked === false) && (document.getElementById("gender-female").checked === false)) {
- document.getElementById("error").innerHTML = icon + "Please select a gender.";
- return;
- } else {
- if (document.getElementById("gender-male").checked === true) {
- User.gender = "male";
- } else {
- User.gender = "female";
- }
- }
- User.id = Accounts.length;
- Accounts.push(User); // Pushes the object User into the array Accounts
- localStorage.setItem("Accounts", JSON.stringify(Accounts));
- localStorage.setItem("Logged", JSON.stringify(User.id));
- alert("Sucessfully registered!");
- window.location = "portal.html";
- }
- //Logs c_user in
- function Login() {
- for (var i = 0; i < Accounts.length; i++) {
- if (document.getElementById("login-user").value === Accounts[i].username && document.getElementById("login-psw").value === Accounts[i].password) {
- localStorage.setItem("Logged", i); // Sets logged in User
- window.location.href = "profiel.html";
- return;
- }
- }
- alert("Invalid username or password!");
- }
- //Logs c_user out
- function Logout() {
- localStorage.removeItem("Logged");
- window.location = "index.html";
- }
- /* Portal Page [Registration] */
- function PortalPage() {
- var marrigestatus;
- // FINNA FUCKIN REMAIN SINGLE CUZ YOU CANT SPELL MARRIAGE YOU FUCKING DICKBRAIN
- var countryregion;
- var provincestate;
- var city;
- var address;
- var countrycode;
- var phone;
- var occupation;
- var salary;
- var transportation;
- var arts;
- var education;
- var environment;
- var tech;
- var business;
- var health;
- var roommatestatus;
- var pricehome;
- var lengthstay;
- // THIS IS WHY YOUR PARENTS DONT WANT YOU TO DO RES FOR UNI YOU FUCKING WASTE
- document.getElementById('char-name').innerHTML = Accounts[c_user].name;
- /* Portal Page Configuration */
- var navListItems = $('ul.setup-panel li a'),
- allWells = $('.setup-content');
- allWells.hide();
- navListItems.click(function(e)
- {
- e.preventDefault();
- var $target = $($(this).attr('href')),
- $item = $(this).closest('li');
- if (!$item.hasClass('disabled')) {
- // IF YOU ARE DISABLED? WHAT DO YOU MEAN IF LMAOOO
- navListItems.closest('li').removeClass('active');
- navListItems.closest('li').addClass('disabled');
- $item.addClass('active');
- allWells.hide();
- $target.show();
- }
- });
- $('ul.setup-panel li.active a').trigger('click');
- // Step 1 to 2 Button
- $('#activate-step-2').on('click', function(e) {
- var marrigestatus = document.getElementById("marrigestatus"),
- countryregion = document.getElementById("countryregion"),
- provincestate = document.getElementById("provincestate");
- if (marrigestatus.options[marrigestatus.selectedIndex].value === "Select...") {
- document.getElementById("error").innerHTML = icon + "Please indicate your marital status.";
- return;
- }
- // LMFAO BITCH YOU FINNA BE SINGLE AF LMAOOOOO
- if (countryregion.options[countryregion.selectedIndex].value === "Select...") {
- document.getElementById("error").innerHTML = icon + "Please select a valid country.";
- return;
- }
- if (provincestate.options[provincestate.selectedIndex].value === "Select...") {
- document.getElementById("error").innerHTML = icon + "Please select a valid province.";
- return;
- }
- if (document.getElementById("city").value === "") {
- document.getElementById("error").innerHTML = icon + "Please select a valid city.";
- // WE DONT SERVE YOU MALTON ASS MOTHERFUCKERS....sandalwood represent bitch
- return;
- }
- if (document.getElementById("address").value === "") {
- document.getElementById("error").innerHTML = icon + "Please enter a valid address.";
- return;
- }
- if (document.getElementById("country-code").value === "") {
- document.getElementById("error").innerHTML = icon + "Please enter your country code.";
- return;
- }
- if (document.getElementById("phone").value === "") {
- document.getElementById("error").innerHTML = icon + "Please enter your phone number.";
- // CALL ME ON YOUR CELLLLLPHONNEEEEEEEE DAY NIGHT WHEN U NEED MY PORN
- return;
- }
- marrigestatus = marrigestatus.options[marrigestatus.selectedIndex].value;
- countryregion = countryregion.options[countryregion.selectedIndex].value;
- provincestate = provincestate.options[provincestate.selectedIndex].value;
- city = document.getElementById("city").value;
- address = document.getElementById("address").value;
- countrycode = document.getElementById("country-code").value;
- phone = document.getElementById("phone").value;
- $('ul.setup-panel li:eq(1)').removeClass('disabled');
- $('ul.setup-panel li a[href="#step-2"]').trigger('click');
- $(this).remove();
- })
- // Step 2 to 3 Button
- $('#activate-step-3').on('click', function(e) {
- salary = document.getElementById("salary");
- // broke ass nigga
- transportation = document.getElementById("transportation");
- // your mom gives me a piggyback ride to osmows
- if (document.getElementById("occupation").value === "") {
- // twitch streaming aint an occupation you jizz-for-brains fuck
- document.getElementById("error-two").innerHTML = icon + "Please enter your occupation.";
- return;
- }
- if (salary.options[salary.selectedIndex].value === "Select...") {
- document.getElementById("error-two").innerHTML = icon + "Please enter your estimated salary.";
- return;
- }
- if (transportation.options[transportation.selectedIndex].value === "Select...") {
- document.getElementById("error-two").innerHTML = icon + "Please select your method of transportation.";
- return;
- }
- if ((document.getElementById("student-no").checked === false) && (document.getElementById("student-yes").checked === false)) {
- document.getElementById("error-two").innerHTML = icon + "Please indicate whether you are a student.";
- return;
- }
- var interests = document.getElementById("arts").checked || document.getElementById("education").checked || document.getElementById("environment").checked || document.getElementById("tech").checked || document.getElementById("business").checked || document.getElementById("health").checked;
- if (interests === false) {
- document.getElementById("error-two").innerHTML = icon + "Please select atleast one area of interest.";
- return;
- }
- occupation = document.getElementById("occupation").value;
- salary = salary.options[salary.selectedIndex].value;
- transportation = transportation.options[transportation.selectedIndex].value;
- arts = document.getElementById("arts").checked;
- education = document.getElementById("education").checked;
- environment = document.getElementById("environment").checked;
- tech = document.getElementById("tech").checked;
- business = document.getElementById("business").checked;
- health = document.getElementById("health").checked;
- $('ul.setup-panel li:eq(2)').removeClass('disabled');
- $('ul.setup-panel li a[href="#step-3"]').trigger('click');
- // TRIGGER? BOMB TRIGGER? I KNEW YOU WERE A FUCKING TERRORIST....
- $(this).remove();
- })
- $('#finish-portal').on('click', function(e) {
- roommatestatus = document.getElementById("roommatestatus");
- pricehome = document.getElementById("pricehome");
- lengthstay = document.getElementById("lengthstay");
- if (roommatestatus.options[roommatestatus.selectedIndex].value === "Select...") {
- document.getElementById("error-three").innerHTML = icon + "Please select what you are looking for.";
- return;
- }
- if (pricehome.options[pricehome.selectedIndex].value === "Select...") {
- document.getElementById("error-three").innerHTML = icon + "Please select your budget range.";
- return;
- }
- if ((document.getElementById("petsafe-no").checked === false) && (document.getElementById("petsafe-yes").checked === false)) {
- document.getElementById("error-three").innerHTML = icon + "Please indicate whether the house should be petsafe.";
- return;
- }
- if ((document.getElementById("smoking-no").checked === false) && (document.getElementById("smoking-yes").checked === false)) {
- document.getElementById("error-three").innerHTML = icon + "Please indicate whether the house should be smoke free.";
- return;
- }
- if (lengthstay.options[lengthstay.selectedIndex].value === "Select...") {
- document.getElementById("error-three").innerHTML = icon + "Please select how long you wish to stay.";
- return;
- }
- pricehome = pricehome.options[pricehome.selectedIndex].value;
- lengthstay = lengthstay.options[lengthstay.selectedIndex].value;
- Accounts[c_user].marrigestatus = marrigestatus;
- Accounts[c_user].countryregion = countryregion;
- Accounts[c_user].provincestate = provincestate;
- Accounts[c_user].city = city;
- Accounts[c_user].address = address;
- Accounts[c_user].countrycode = countrycode;
- Accounts[c_user].phone = phone;
- Accounts[c_user].occupation;
- Accounts[c_user].salary = salary;
- Accounts[c_user].transportation = transportation;
- Accounts[c_user].arts = arts;
- Accounts[c_user].education = education;
- Accounts[c_user].environment = environment;
- Accounts[c_user].tech = tech;
- Accounts[c_user].business = business;
- Accounts[c_user].health = health;
- Accounts[c_user].roommatestatus = roommatestatus;
- Accounts[c_user].pricehome = pricehome;
- Accounts[c_user].lengthstay = lengthstay;
- localStorage.setItem("Accounts", JSON.stringify(Accounts));
- alert("Sucessfully registered!");
- // THATS THE ONLY SUCCESS YOU'VE EVER HAD....REGISTERING....AND BEING THE CHOSEN SPERM.....FUCKING WASTE
- window.location = "profile.html";
- })
- }
- function FindMatches() {
- var nArray = [];
- var matchCount = 0;
- for (var i = 0; i < Accounts.length; i += 1) {
- if (i != c_user) {
- if(Accounts[i].marrigestatus == Accounts[c_user].marrigestatus) {
- matchCount = matchCount + 1;
- }
- if(Accounts[i].countryregion == Accounts[c_user].countryregion) {
- matchCount = matchCount + 1;
- }
- if(Accounts[i].provincestate == Accounts[c_user].provincestate) {
- matchCount = matchCount + 1;
- }
- if(Accounts[i].city == Accounts[c_user].city) {
- matchCount = matchCount + 1;
- }
- if(Accounts[i].address == Accounts[c_user].city) {
- matchCount = matchCount + 1;
- }
- if(Accounts[i].countrycode == Accounts[c_user].countrycode) {
- matchCount = matchCount + 1;
- }
- if(Accounts[i].phone == Accounts[c_user].phone) {
- matchCount = matchCount + 1;
- }
- if(Accounts[i].occupation == Accounts[c_user].occupation) {
- matchCount = matchCount + 1;
- }
- if(Accounts[i].salary == Accounts[c_user].salary) {
- matchCount = matchCount + 1;
- }
- if(Accounts[i].transportation == Accounts[c_user].transportation) {
- matchCount = matchCount + 1;
- }
- if(Accounts[i].arts == Accounts[c_user].arts) {
- matchCount = matchCount + 1;
- }
- if(Accounts[i].education == Accounts[c_user].education) {
- matchCount = matchCount + 1;
- }
- if(Accounts[i].environment == Accounts[c_user].environment) {
- matchCount = matchCount + 1;
- }
- if(Accounts[i].tech == Accounts[c_user].tech) {
- matchCount = matchCount + 1;
- }
- if(Accounts[i].business == Accounts[c_user].business) {
- matchCount = matchCount + 1;
- }
- if(Accounts[i].health == Accounts[c_user].health) {
- matchCount = matchCount + 1;
- }
- if(Accounts[i].roommatestatus == Accounts[c_user].roommatestatus) {
- matchCount = matchCount + 1;
- }
- if(Accounts[i].pricehome == Accounts[c_user].pricehome) {
- matchCount = matchCount + 1;
- }
- if(Accounts[i].lengthstay == Accounts[c_user].lengthstay) {
- matchCount = matchCount + 1;
- }
- // ADD THIS FUCKING SHIT INTO THE ARRAY OF OBJECTS YOU FUCKING WHORE
- nArray.push(Accounts[i] + " " + matchCount);
- // RESET THE FUCKING MATCHCOUNT YOU ASSWIPING CUNTLICKERLOVERLOL
- matchCount = 0;
- }
- }
- }
- // LMAO YOU CAN SEARCH PAGE BUT YOU SUCK AT SEARCHING FOR A GRILLFRAND HAHAHA
- function SearchPage() {
- document.getElementById('char-name').innerHTML = Accounts[c_user].name;
- }
Add Comment
Please, Sign In to add comment