Skip to content

Commit

Permalink
feat: update changelogs (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
jhassan8 authored Jul 8, 2023
1 parent 0eb52cb commit 7e007b3
Show file tree
Hide file tree
Showing 6 changed files with 165 additions and 0 deletions.
2 changes: 2 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<link rel="stylesheet" href="server/css/login.css" />
<link rel="stylesheet" href="server/css/search.css" />
<link rel="stylesheet" href="server/css/history.css" />
<link rel="stylesheet" href="server/css/changelog.css" />
<link rel="stylesheet" href="server/css/home.css" />
<link rel="stylesheet" href="server/css/video.css" />
<link rel="stylesheet" href="server/css/keyboard.css" />
Expand Down Expand Up @@ -58,6 +59,7 @@
<script src="server/js/screen/login.js"></script>
<script src="server/js/screen/search.js"></script>
<script src="server/js/screen/history.js"></script>
<script src="server/js/screen/changelog.js"></script>
<script src="server/js/screen/home.js"></script>
<script src="server/js/screen/home.details.js"></script>
<script src="server/js/screen/home.episodes.js"></script>
Expand Down
74 changes: 74 additions & 0 deletions server/css/changelog.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#changelog-modal {
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.6);
overflow: hidden;
z-index: 200;
position: absolute;
left: 0;
top: 0;
display: flex;
align-items: center;
justify-content: center;
}

#changelog-modal .content {
width: 40%;
height: 50%;
background: rgb(0, 0, 0, 0.8);
padding: 20px 40px;
display: flex;
flex-direction: column;
color: #fff;
font-size: 16px;
border-radius: 10px;
}

#changelog-modal .content .header {
font-size: 30px;
font-weight: bold;
}

#changelog-modal .content .body {
position: relative;
flex: 1;
}

#changelog-modal .content .extra {
bottom: 30px;
position: absolute;
font-size: 13px;
}

#changelog-modal .content .body .changes {
list-style: square;
padding: 20px 0;
margin: 0;
}

#changelog-modal .content .body .changes li {
margin: 15px 0;
}

#changelog-modal .content .body .changes li .change-title {
font-size: 22px;
font-weight: bold;
text-transform: uppercase;
}

#changelog-modal .content .footer {
display: flex;
justify-content: flex-end;
}

#changelog-modal .content .footer .button {
display: block;
width: 150px;
color: rgb(0, 0, 0);
background: rgb(244, 117, 33);
font-size: 2rem;
font-weight: bold;
padding: 10px 20px;
border-radius: 5px;
text-align: center;
}
1 change: 1 addition & 0 deletions server/js/core/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ window.session = {
},
},
storage: {
version: NaN,
account: {
password: NaN,
username: NaN,
Expand Down
3 changes: 3 additions & 0 deletions server/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ window.main = {
exit.init();
} else {
switch (main.state) {
case changelog.id:
changelog.keyDown(event);
break;
case loading.id:
loading.keyDown(event);
break;
Expand Down
84 changes: 84 additions & 0 deletions server/js/screen/changelog.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
window.changelog = {
id: "changelog-modal",
data: {
version: "v1.1",
changes: [
{
title: "feat: update changelogs",
description: "You will now receive a report like this with each update.",
},
{
title: "feat: skip intro beta version",
description: "Anime without delays! Skip the intro with just one button. More action, less waiting.",
},
{
title: "fix: solve error when video versions is null",
description: "Playback issues have been resolved in certain anime titles, such as \"The Marginal Service\".",
},
],
extra: "If you have any issues or suggestions, you can report them on the GitHub jhassan8/crunchyroll-tizen.",
},

init: function () {
if (session.storage.version !== changelog.data.version) {
var changelog_element = document.createElement("div");
changelog_element.id = changelog.id;

changelog_element.innerHTML = `
<div class="content">
<div class="header">
Crunchyroll ${changelog.data.version}
</div>
<div class="body">
<ul class="changes">
${changelog.getChanges()}
</ul>
<div class="extra">
${changelog.data.extra}
</div>
</div>
<div class="footer">
<a class="button ${login.id}-option" translate>OK</a>
</div>
</div>`;

session.storage.version = changelog.data.version;
session.update();

document.body.appendChild(changelog_element);
main.state = changelog.id;
}
},

destroy: function () {
main.state = home.id;
document.body.removeChild(document.getElementById(changelog.id));
},

getChanges: function (item) {
var content_changes = "";
changelog.data.changes.forEach((element) => {
content_changes += `
<li>
<div class="change-title">
${element.title}
</div>
<div class="change-description">
${element.description}
</div>
</li>`;
});
return content_changes;
},

keyDown: function (event) {
switch (event.keyCode) {
case tvKey.KEY_PANEL_ENTER:
case tvKey.KEY_ENTER:
case tvKey.KEY_BACK:
case 27:
changelog.destroy();
break;
}
},
};
1 change: 1 addition & 0 deletions server/js/screen/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ init: function () {
$(`#${home.id} .rows .row-content`)[0].slick.slickGoTo(0);

main.state = home.id;
changelog.init();
},

destroy: function () {
Expand Down

0 comments on commit 7e007b3

Please sign in to comment.