Fixed: Unknown frameworks in statistics page (#151)
This commit is contained in:
parent
c6e0a542fe
commit
e4c5bc1db0
|
@ -215,6 +215,14 @@ const Links = {
|
||||||
'STATISTICS': chrome.extension.getURL('pages/statistics/statistics.html')
|
'STATISTICS': chrome.extension.getURL('pages/statistics/statistics.html')
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const FrameworkAndBundle = {
|
||||||
|
'resources/element-ui/2.13.2/': 'ElementUI',
|
||||||
|
'resources/bootstrap-datepicker/1.9.0/': 'Bootstrap DatePicker',
|
||||||
|
'resources/jquery.lazy/1.7.11/': 'jQuery Lazy',
|
||||||
|
'resources/waypoints/4.0.1/': 'Waypoints',
|
||||||
|
'resources/findify-bundle/6.9.15/': 'Findify'
|
||||||
|
};
|
||||||
|
|
||||||
// Supported charsets for TextDecoder()
|
// Supported charsets for TextDecoder()
|
||||||
// https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder/TextDecoder
|
// https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder/TextDecoder
|
||||||
const EncodingTypes = {
|
const EncodingTypes = {
|
||||||
|
|
|
@ -21,12 +21,18 @@
|
||||||
var stats = {};
|
var stats = {};
|
||||||
|
|
||||||
stats.setStats = function (injection) {
|
stats.setStats = function (injection) {
|
||||||
let data, today, cdn, framework, newEntry;
|
let data, today, cdn, framework, newEntry, pathSegments;
|
||||||
|
|
||||||
data = storageManager.statistics;
|
data = storageManager.statistics;
|
||||||
today = new Date().toISOString().slice(0, 10);
|
today = new Date().toISOString().slice(0, 10);
|
||||||
cdn = injection.source;
|
cdn = injection.source;
|
||||||
|
|
||||||
|
if (injection.bundle !== '') {
|
||||||
|
pathSegments = injection.path.split('/');
|
||||||
|
framework = pathSegments[0] + '/' + pathSegments[1] + '/' + pathSegments[2] + '/';
|
||||||
|
} else {
|
||||||
framework = injection.path;
|
framework = injection.path;
|
||||||
|
}
|
||||||
|
|
||||||
if (today in data) {
|
if (today in data) {
|
||||||
if (cdn in data[today]['cdns']) {
|
if (cdn in data[today]['cdns']) {
|
||||||
|
|
|
@ -186,6 +186,9 @@ statistics._displayNameOfFramework = function (str, type) {
|
||||||
filename = helpers.extractFilenameFromPath(str);
|
filename = helpers.extractFilenameFromPath(str);
|
||||||
filename = helpers.determineResourceName(filename);
|
filename = helpers.determineResourceName(filename);
|
||||||
|
|
||||||
|
if (filename === 'Unknown') {
|
||||||
|
filename = FrameworkAndBundle[str];
|
||||||
|
}
|
||||||
version = str.match(Resource.VERSION_EXPRESSION);
|
version = str.match(Resource.VERSION_EXPRESSION);
|
||||||
if (version !== null && version.length > 0) {
|
if (version !== null && version.length > 0) {
|
||||||
version = version === 'latest' ? version : 'v' + version;
|
version = version === 'latest' ? version : 'v' + version;
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
<li>Added: OwlCarousel v2.3.4 (<a href="https://codeberg.org/nobody/LocalCDN/issues/148">#148</a>)</li>
|
<li>Added: OwlCarousel v2.3.4 (<a href="https://codeberg.org/nobody/LocalCDN/issues/148">#148</a>)</li>
|
||||||
<li>Added: OwlCarousel v2.0.0-beta.2.4 (<a href="https://codeberg.org/nobody/LocalCDN/issues/148">#148</a>)</li>
|
<li>Added: OwlCarousel v2.0.0-beta.2.4 (<a href="https://codeberg.org/nobody/LocalCDN/issues/148">#148</a>)</li>
|
||||||
<li>Added: markdown-it v12.0.2 (<a href="https://codeberg.org/nobody/LocalCDN/issues/149">#149</a>)</li>
|
<li>Added: markdown-it v12.0.2 (<a href="https://codeberg.org/nobody/LocalCDN/issues/149">#149</a>)</li>
|
||||||
|
<li>Fixed: Unknown frameworks in statistics page (<a href="https://codeberg.org/nobody/LocalCDN/issues/150">#151</a>)</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div id="generator-section">
|
<div id="generator-section">
|
||||||
<div class="topic-label">
|
<div class="topic-label">
|
||||||
|
|
Loading…
Reference in New Issue