mirror of
https://github.com/ivabus/www
synced 2024-11-10 09:55:15 +03:00
Remove two scripts that were doing the samer thing, but less efficiently
This commit is contained in:
parent
5aa840b524
commit
2960dc8e94
|
@ -61,11 +61,9 @@ integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+
|
||||||
var urlRepo = "https://api.github.com/repos/" + repository;
|
var urlRepo = "https://api.github.com/repos/" + repository;
|
||||||
var urlRelease = "https://api.github.com/repos/" + repository + "/releases/latest";
|
var urlRelease = "https://api.github.com/repos/" + repository + "/releases/latest";
|
||||||
var token = "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";
|
var token = "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";
|
||||||
|
|
||||||
// Check if the data is already stored in local storage
|
// Check if the data is already stored in local storage
|
||||||
var dataRepo = JSON.parse(localStorage.getItem('dataRepo'));
|
var dataRepo = JSON.parse(localStorage.getItem('dataRepo'));
|
||||||
var dataRelease = JSON.parse(localStorage.getItem('dataRelease'));
|
var dataRelease = JSON.parse(localStorage.getItem('dataRelease'));
|
||||||
|
|
||||||
if (dataRepo && dataRelease) {
|
if (dataRepo && dataRelease) {
|
||||||
// If the data is already stored, use it to update the page
|
// If the data is already stored, use it to update the page
|
||||||
var stargazers = "(" + numeral(dataRepo.stargazers_count).format("0.0a") + ")";
|
var stargazers = "(" + numeral(dataRepo.stargazers_count).format("0.0a") + ")";
|
||||||
|
@ -91,13 +89,11 @@ integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+
|
||||||
// Store the response data in local storage
|
// Store the response data in local storage
|
||||||
localStorage.setItem('dataRepo', JSON.stringify(dataRepo[0]));
|
localStorage.setItem('dataRepo', JSON.stringify(dataRepo[0]));
|
||||||
localStorage.setItem('dataRelease', JSON.stringify(dataRelease[0]));
|
localStorage.setItem('dataRelease', JSON.stringify(dataRelease[0]));
|
||||||
|
|
||||||
// Update the page with the response data
|
// Update the page with the response data
|
||||||
var stargazers = "(" + numeral(JSON.parse(localStorage.getItem('dataRepo')).stargazers_count).format("0.0a") + ")";
|
var stargazers = "(" + numeral(JSON.parse(localStorage.getItem('dataRepo')).stargazers_count).format("0.0a") + ")";
|
||||||
var release = JSON.parse(localStorage.getItem('dataRelease')).tag_name;
|
var release = JSON.parse(localStorage.getItem('dataRelease')).tag_name;
|
||||||
$(".stargazers").html(stargazers).hide().fadeIn(400);
|
$(".stargazers").html(stargazers).hide().fadeIn(400);
|
||||||
$(".release").html(release).hide().fadeIn(400);
|
$(".release").html(release).hide().fadeIn(400);
|
||||||
|
|
||||||
// Reserve the space for the stargazers element
|
// Reserve the space for the stargazers element
|
||||||
var stargazersWidth = $(".stargazers").width();
|
var stargazersWidth = $(".stargazers").width();
|
||||||
$(".content").css("min-width", stargazersWidth);
|
$(".content").css("min-width", stargazersWidth);
|
||||||
|
@ -105,29 +101,3 @@ integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
|
||||||
$(document).ready(function() {
|
|
||||||
var repository = "teaxyz/cli";
|
|
||||||
var url = "https://api.github.com/repos/" + repository;
|
|
||||||
|
|
||||||
$.get(url, function(data) {
|
|
||||||
var stargazers = numeral(data.stargazers_count).format("0.0a");
|
|
||||||
$(".stargazers").html(stargazers).hide().fadeIn(400);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
|
|
||||||
$(document).ready(function() {
|
|
||||||
var repository = "teaxyz/cli";
|
|
||||||
var url = "https://api.github.com/repos/"+ repository +"/releases/latest";
|
|
||||||
|
|
||||||
$.get(url, function(data) {
|
|
||||||
var release = data.tag_name;
|
|
||||||
$(".release").html(release).hide().fadeIn(400);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
Loading…
Reference in a new issue