mirror of
https://codeberg.org/nobody/LocalCDN.git
synced 2025-02-17 04:10:53 +01:00
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')
|
||||
};
|
||||
|
||||
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()
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder/TextDecoder
|
||||
const EncodingTypes = {
|
||||
|
@ -21,12 +21,18 @@
|
||||
var stats = {};
|
||||
|
||||
stats.setStats = function (injection) {
|
||||
let data, today, cdn, framework, newEntry;
|
||||
let data, today, cdn, framework, newEntry, pathSegments;
|
||||
|
||||
data = storageManager.statistics;
|
||||
today = new Date().toISOString().slice(0, 10);
|
||||
cdn = injection.source;
|
||||
framework = injection.path;
|
||||
|
||||
if (injection.bundle !== '') {
|
||||
pathSegments = injection.path.split('/');
|
||||
framework = pathSegments[0] + '/' + pathSegments[1] + '/' + pathSegments[2] + '/';
|
||||
} else {
|
||||
framework = injection.path;
|
||||
}
|
||||
|
||||
if (today in data) {
|
||||
if (cdn in data[today]['cdns']) {
|
||||
|
@ -186,6 +186,9 @@ statistics._displayNameOfFramework = function (str, type) {
|
||||
filename = helpers.extractFilenameFromPath(str);
|
||||
filename = helpers.determineResourceName(filename);
|
||||
|
||||
if (filename === 'Unknown') {
|
||||
filename = FrameworkAndBundle[str];
|
||||
}
|
||||
version = str.match(Resource.VERSION_EXPRESSION);
|
||||
if (version !== null && version.length > 0) {
|
||||
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.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>Fixed: Unknown frameworks in statistics page (<a href="https://codeberg.org/nobody/LocalCDN/issues/150">#151</a>)</li>
|
||||
</ul>
|
||||
<div id="generator-section">
|
||||
<div class="topic-label">
|
||||
|
Loading…
x
Reference in New Issue
Block a user