mirror of
https://github.com/konpa/devicon.git
synced 2025-08-10 16:45:54 +02:00
fetch latest release via github api and use it for showing the header and CDN links
This commit is contained in:
@@ -8,6 +8,21 @@ var devicon = angular.module('devicon', ['ngSanitize', 'ngAnimate']);
|
||||
|
||||
devicon.controller('IconListCtrl', function($scope, $http, $compile) {
|
||||
|
||||
// Determination of the latest release tagging
|
||||
// which is used for showing in the header of the page
|
||||
// as well as for CDN links
|
||||
var gitHubPath = 'devicons/devicon';
|
||||
var url = 'https://api.github.com/repos/' + gitHubPath + '/tags';
|
||||
$scope.latestReleaseTagging = 'master';
|
||||
$http.get(url).success(function (data) {
|
||||
if(data.length > 0) {
|
||||
$scope.latestReleaseTagging = data[0].name;
|
||||
}
|
||||
}).error(function () {
|
||||
console.log('Unable to determine latest release version, fallback to master.')
|
||||
});
|
||||
|
||||
|
||||
var baseUrl = window.location.origin + '/dist';
|
||||
|
||||
// Get devicon.json
|
||||
@@ -69,7 +84,6 @@ devicon.controller('IconListCtrl', function($scope, $http, $compile) {
|
||||
/*------ End of "Re-format devicon.json" ------*/
|
||||
});
|
||||
|
||||
|
||||
/*
|
||||
| Change selected icon
|
||||
|--------------------------------
|
||||
|
@@ -46,7 +46,7 @@
|
||||
|
||||
<div class="container">
|
||||
<header class="clearfix">
|
||||
<h1>Devicon <span>2.7</span></h1>
|
||||
<h1>Devicon <span><a href="https://github.com/devicons/devicon/releases">{{ latestReleaseTagging }}</a></span></h1>
|
||||
<h2>Devicon is a set of icons representing programming languages, designing & development tools. You can use it as a font or directly copy/paste the svg code into your project.</h2>
|
||||
<h3>(Super) Quick Setup</h3>
|
||||
<h5>First select an icon on the right, then select the version below and copy/paste the code into your project.</h5>
|
||||
@@ -65,7 +65,7 @@
|
||||
</ul>
|
||||
<div class="cde">
|
||||
<div class="cde-com"><!-- in your header --></div>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/devicons/devicon@master/devicon.min.css"><br />
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/devicons/devicon@{{ latestReleaseTagging }}/devicon.min.css"><br />
|
||||
<br />
|
||||
<div class="cde-com"><!-- in your body --></div>
|
||||
<i class="devicon-{{selectedIcon.name}}-{{selectedFontIcon}}<span ng-if="colored"> colored</span>"></i><br />
|
||||
|
Reference in New Issue
Block a user