Skip to content

Commit

Permalink
demo: fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
uchks committed Oct 6, 2024
1 parent 472a0c3 commit a0fb4cd
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 42 deletions.
27 changes: 13 additions & 14 deletions depictions/web/changelog.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,12 @@
src="js/content-blocks-changelog.js"
></script>
<script type="text/javascript">
bundleid = $.QueryString["p"];
const bundleid = $.QueryString.p;
const contentBlocks = getContentBlocks();

var contentBlocks = getContentBlocks();

$(document).ready(function () {
$(document).ready(() => {
populateContentBlocks(
bundleid + "/changelog.xml",
`${bundleid}/changelog.xml`,
contentBlocks,
() => {
$("#packageError").show();
Expand Down Expand Up @@ -68,16 +67,16 @@
</div>
<!-- REPO FOOTER -->
<script type="text/javascript">
var repoContents = {
const repoContents = {
"#repoFooterLinks": {
type: "custom",
source: "repo>footerlinks>link",
render: function (element, source) {
$.each(source, function (index, data) {
var a = $("<a class='link-item list-group-item'>");
render: (element, source) => {
$.each(source, (index, data) => {
const a = $("<a class='link-item list-group-item'>");
a.attr("href", $(data).find("url").text());
if ($(data).find("iconclass")) {
var i = $("<span>");
const i = $("<span>");
i.attr("class", $(data).find("iconclass").text());
console.log(i);
$(a).append(i);
Expand All @@ -88,23 +87,23 @@
}, //render
},
};
$(document).ready(function () {
$(document).ready(() => {
$.ajax({
type: "GET",
dataType: "xml",
url: "../../repo.xml",
cache: false,
success: function (xml) {
success: (xml) => {
data_loader_engine(repoContents, xml);
if (navigator.userAgent.search(/Cydia/) != -1) {
if (navigator.userAgent.search(/Cydia/) !== -1) {
$("a").each(function () {
console.log($(this).text());
$(this).attr("target", "_blank");
});
}
},

error: function () {
error: () => {
$("#contactInfo").hide();
},
}); //ajax
Expand Down
10 changes: 5 additions & 5 deletions depictions/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
</style>
<script>
$(() => {
const bundleid = $.QueryString["p"];
const bundleid = $.QueryString.p;
const contentBlocks = getContentBlocks();

populateContentBlocks(
Expand All @@ -144,7 +144,7 @@
$.ajax({
type: "GET",
dataType: "xml",
url: "../repo.xml",
url: "../../repo.xml",
cache: false,
success: (xml) => {
$(xml)
Expand Down Expand Up @@ -186,7 +186,7 @@ <h3 class="section-title">Description</h3>
<div class="card">
<ul id="descriptionList" class="list-group list-group-flush">
<li id="screenshotsLink" class="link-item list-group-item">
<i class="fas fa-images"></i>
<i class="fa-solid fa-file-image"></i>
Screenshots
</li>
</ul>
Expand All @@ -201,7 +201,7 @@ <h3 class="section-title">
<div class="card">
<ul id="changesList" class="list-group list-group-flush">
<li id="changelogLink" class="link-item list-group-item">
<i class="fas fa-history"></i>
<i class="fa-solid fa-clock-rotate-left"></i>
Full Changelog
</li>
</ul>
Expand Down Expand Up @@ -233,7 +233,7 @@ <h3 class="section-title">Contact</h3>
<div id="packageError" style="display: none">
<div class="container">
<div class="alert alert-danger">
<i class="fas fa-exclamation-circle me-2"></i>
<i class="fa-solid fa-circle-exclamation me-2"></i>
<strong>Oh snap!</strong> The package you are trying to view is not
hosted on this repository.
</div>
Expand Down
17 changes: 11 additions & 6 deletions depictions/web/js/content-blocks-index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
function getContentBlocks() {
const bundleid = $.QueryString.p;

return {
"#packageName": {
type: "text",
Expand Down Expand Up @@ -64,7 +66,10 @@ function getContentBlocks() {
);
},
},
"#versionBadge": { type: "text", source: "package>version" },
"#versionBadge": {
type: "text",
source: "package>version",
},
"#changesList": {
type: "list",
source: "package>changelog>change",
Expand Down Expand Up @@ -103,22 +108,22 @@ function getContentBlocks() {
source: "package>links>link",
paragraphElement: "<li class='list-group-item'>",
render: (element, source) => {
if ($(source).lenght === 0) {
if ($(source).length === 0) {
$("#externalLinksContainer").remove();
return;
}

$.each(source, (index, data) => {
const a = $("<a class='link-item list-group-item'>");
a.attr("href", $(data).find("url").text());
if ($(data).find("iconclass")) {
if ($(data).find("iconclass").length) {
const i = $("<span>");
i.attr("class", $(data).find("iconclass").text());
console.log(i);
$(a).append(i);
}
$(a).append($(data).find("name").text());
$(element).append(a);
}); //each
});
},
},
};
Expand All @@ -139,5 +144,5 @@ function populateContentBlocks(data, blocks, error, success) {
$("#packageInformation").hide();
error(textStatus);
},
}); //ajax
});
}
7 changes: 5 additions & 2 deletions depictions/web/js/content-blocks-screenshots.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
function getContentBlocks() {
const bundleid = $.QueryString.p;

return {
"#screenshotsList": {
type: "custom",
Expand All @@ -7,11 +9,12 @@ function getContentBlocks() {
if ($(source).length === 0) {
$(element).append(
$(
"<div class='alert alert-danger'>The aren't any screenshots for this package</div>"
"<div class='alert alert-danger'>There aren't any screenshots for this package</div>"
)
);
return;
}

$.each(source, (index, data) => {
const th = $("<div class='thumbnail'>");
th.append($("<p>").text($(data).find("description").text()));
Expand Down Expand Up @@ -43,5 +46,5 @@ function populateContentBlocks(data, blocks, error, success) {
$("#packageInformation").hide();
error(textStatus);
},
}); //ajax
});
}
27 changes: 13 additions & 14 deletions depictions/web/screenshots.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,13 @@
src="js/content-blocks-screenshots.js"
></script>
<script type="text/javascript">
bundleid = $.QueryString["p"];
const bundleid = $.QueryString.p;
const contentBlocks = getContentBlocks();

var contentBlocks = getContentBlocks();

$(document).ready(function () {
$(document).ready(() => {
//return;
populateContentBlocks(
bundleid + "/info.xml",
`${bundleid}/info.xml`,
contentBlocks,
() => {
$("#packageError").show();
Expand Down Expand Up @@ -72,16 +71,16 @@ <h5>SCREENSHOTS</h5>
</div>
<!-- REPO FOOTER -->
<script type="text/javascript">
var repoContents = {
const repoContents = {
"#repoFooterLinks": {
type: "custom",
source: "repo>footerlinks>link",
render: function (element, source) {
$.each(source, function (index, data) {
var a = $("<a class='link-item list-group-item'>");
render: (element, source) => {
$.each(source, (index, data) => {
const a = $("<a class='link-item list-group-item'>");
a.attr("href", $(data).find("url").text());
if ($(data).find("iconclass")) {
var i = $("<span>");
const i = $("<span>");
i.attr("class", $(data).find("iconclass").text());
console.log(i);
$(a).append(i);
Expand All @@ -92,22 +91,22 @@ <h5>SCREENSHOTS</h5>
}, //render
},
};
$(document).ready(function () {
$(document).ready(() => {
$.ajax({
type: "GET",
dataType: "xml",
url: "../../repo.xml",
cache: false,
success: function (xml) {
success: (xml) => {
data_loader_engine(repoContents, xml);
if (navigator.userAgent.search(/Cydia/) != -1) {
if (navigator.userAgent.search(/Cydia/) !== -1) {
$("a").each(function () {
console.log($(this).text());
$(this).attr("target", "_blank");
});
}
},
error: function () {
error: () => {
$("#contactInfo").hide();
},
}); //ajax
Expand Down
2 changes: 1 addition & 1 deletion repo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<iconclass>fa-brands fa-x-twitter</iconclass>
</link>
<link> # You can remove this if you wish, however if I may, please do not do so! It will allow others to find repo.me such as you have!
<name>I want this depiction template</name>
<name>I want to use repo.me</name>
<url>https://github.com/uchks/repo.me</url>
<iconclass>fa-solid fa-thumbs-up</iconclass>
</link>
Expand Down

0 comments on commit a0fb4cd

Please sign in to comment.