Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Homework5_Kiselyov_Alexander #6

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added dist/assets/github_logo.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 dist/assets/ok_logo.jpg
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 dist/assets/user_logo.jpg
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 dist/assets/vk_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions dist/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<!DOCTYPE html>
<html>
<head>
<title>MyCard</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- inject:css -->
<link rel="stylesheet" href="./styles/style.css">
<!-- endinject -->
</head>
<body>
<div class="toggle">
<input type="checkbox" class="check" id="toggle">
<b class="b switch"></b>
<b class="b track"></b>
</div>
<div class="card__wrapper">
<div class="card__wrapper-left">
<img class="card__user-logo" src="./assets/user_logo.jpg" alt="Лого пользователя"/>
<div class="card__user-name">Alexander Kiselyov</div>
<div class="card__user-position">Student</div>
<div class="card__social-links">
<a href="https://vk.com/id213001016"><img class="card__social-link card__social-link__vk" src="./assets/vk_logo.png" alt="Лого ВКонтакте"></a>
<a href="https://ok.ru/profile/569592525687"><img class="card__social-link card__social-link__ok" src="./assets/ok_logo.jpg" alt="Лого Одноклассники"/></a>
<a href="https://github.com/AlexanderKiselyov"><img class="card__social-link card__social-link__git" src="./assets/github_logo.png" alt="Лого Гитхаб"/></a>
</div>
<button class="card__download-cv-button">Download CV</button>
<div class="card__footer">@2021 All rights reserved.</div>
</div>
<div class="card__wrapper-main">
<h1 class="card__user-name card__bold-name">Alexander Kiselyov</h1>
<h3 class="card__user-position card__bold-position">Student</h3>
<div id="skills" class="card__user-skills-button"></div>
</div>
</div>
</body>
<!-- inject:js -->
<script src="./js/toggle.js"></script>
<script src="./js/skills.js"></script>
<!-- endinject -->
</html>
68 changes: 68 additions & 0 deletions dist/js/skills.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
document.addEventListener("DOMContentLoaded", function(event) {
var skillsButton = document.getElementById("skills");
var pathParts = window.location.pathname.split("/");
if (pathParts[pathParts.length - 1] == "skills.html") {
skillsButton.style.setProperty("--card__skills-button-rotate", "225deg");
skillsButton.style.setProperty("--card__skills-button-hor-disp", "38%");

addNewSkill("C#", "70%");
addNewSkill("Java", "60%");
addNewSkill("JavaScript", "50%");

var addNewSkillEl = document.getElementById("addNewSkill");
var newSkillName = document.getElementById("newSkillName");
var newSkillValue = document.getElementById("newSkillValue");
addNewSkillEl.onclick = function () {
if (newSkillName.value && newSkillValue.value && newSkillValue.value >= 0 && newSkillValue.value <= 100) {
addNewSkill(newSkillName.value, newSkillValue.value + "%");
var cardSkillsWrapper = document.getElementById("card__skills-wrapper");
cardSkillsWrapper.scrollTop = cardSkillsWrapper.scrollHeight;
} else {
alert("Incorrect input!");
}
}
}

skills.onclick = function () {
pathParts = window.location.pathname.split("/");
if (pathParts[pathParts.length - 1] == "skills.html") {
window.location.href = "../index.html";
} else if (pathParts[pathParts.length - 1] == "index.html") {
window.location.href = "pages/skills.html";
}
}

function addNewSkill(skillNameNew, skillPercentNew) {
var skillsWrapper = document.getElementById("card__skills-wrapper");
var skillContainer = document.createElement("div");
skillContainer.classList.add("card__skill-container");
var skillWrapper = document.createElement("div");
skillWrapper.style.width = "80%";
skillWrapper.style.margin = "10px";
var skillName = document.createElement("div");
skillName.innerText = skillNameNew;
var skillProgress = document.createElement("div");
skillProgress.classList.add("card__progress");
skillProgress.classList.add("card__progress-moved");
var skillProgressBar = document.createElement("div");
skillProgressBar.classList.add("card__progress-bar");
skillProgressBar.style.width = skillPercentNew;
skillProgressBar.animate([ { width: "5%", backgroundColor: "#98FB98"}, { width: skillPercentNew, backgroundColor: "#006400"} ], { duration: 5000 });
var skillPercent = document.createElement("div");
skillPercent.classList.add("card__skill-percent");
skillPercent.innerText = skillPercentNew;
skillPercent.style.marginLeft = skillPercentNew;
skillPercent.animate([{ marginLeft: "5%" }, { marginLeft: skillPercentNew }], { duration: 5000 });
var deleteButton = document.createElement("button");
deleteButton.innerText = "Delete";
deleteButton.addEventListener('click', () => { deleteButton.parentElement.remove(); });
deleteButton.classList.add("card__skill-delete");
skillWrapper.appendChild(skillName);
skillProgress.appendChild(skillProgressBar);
skillWrapper.appendChild(skillProgress);
skillWrapper.appendChild(skillPercent);
skillContainer.appendChild(skillWrapper);
skillContainer.appendChild(deleteButton);
skillsWrapper.appendChild(skillContainer);
}
});
11 changes: 11 additions & 0 deletions dist/js/toggle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
document.addEventListener("DOMContentLoaded", function(event) {
var checkbox = document.getElementById('toggle');

checkbox.onclick = function () {
if (this.checked) {
document.documentElement.setAttribute('theme', 'dark');
} else {
document.documentElement.setAttribute('theme', 'light');
}
}
});
44 changes: 44 additions & 0 deletions dist/pages/skills.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<!DOCTYPE html>
<html>
<head>
<title>MyCard</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- inject:css -->
<link rel="stylesheet" href="../styles/style.css">
<!-- endinject -->
</head>
<body>
<div class="toggle">
<input type="checkbox" class="check" id="toggle">
<b class="b switch"></b>
<b class="b track"></b>
</div>
<div class="card__wrapper">
<div class="card__wrapper-left">
<img class="card__user-logo" src="../assets/user_logo.jpg" alt="Лого пользователя"/>
<div class="card__user-name">Alexander Kiselyov</div>
<div class="card__user-position">Student</div>
<div class="card__social-links">
<a href="https://vk.com/id213001016"><img class="card__social-link card__social-link__vk" src="../assets/vk_logo.png" alt="Лого ВКонтакте"></a>
<a href="https://ok.ru/profile/569592525687"><img class="card__social-link card__social-link__ok" src="../assets/ok_logo.jpg" alt="Лого Одноклассники"/></a>
<a href="https://github.com/AlexanderKiselyov"><img class="card__social-link card__social-link__git" src="../assets/github_logo.png" alt="Лого Гитхаб"/></a>
</div>
<button class="card__download-cv-button">Download CV</button>
<div class="card__footer">@2021 All rights reserved.</div>
</div>
<div class="card__wrapper-main">
<div class="card__user-name card__bold-name">My skills</div>
<div id="card__skills-wrapper" class="card__skills-wrapper"></div>
<input id="newSkillName" class="card__skill-name-field" type="text" placeholder="Skill name"/>
<input id="newSkillValue" class="card__skill-value-field" type="number" min="0" max="100" placeholder="Skill value"/>
<button id="addNewSkill" class="card__skill-add">Add new skill</button>
<div id="skills" class="card__user-skills-button"></div>
</div>
</div>
</body>
<!-- inject:js -->
<script src="../js/toggle.js"></script>
<script src="../js/skills.js"></script>
<!-- endinject -->
</html>
Loading