diff --git a/core/constants.js b/core/constants.js index 07727802..7dd648f7 100644 --- a/core/constants.js +++ b/core/constants.js @@ -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 = { diff --git a/modules/internal/stats.js b/modules/internal/stats.js index 406df230..756ea8ee 100644 --- a/modules/internal/stats.js +++ b/modules/internal/stats.js @@ -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']) { diff --git a/pages/statistics/statistics.js b/pages/statistics/statistics.js index 0b7c2123..d87e45a0 100644 --- a/pages/statistics/statistics.js +++ b/pages/statistics/statistics.js @@ -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; diff --git a/pages/updates/updates.html b/pages/updates/updates.html index c1722f28..7367e9d7 100644 --- a/pages/updates/updates.html +++ b/pages/updates/updates.html @@ -37,6 +37,7 @@
  • Added: OwlCarousel v2.3.4 (#148)
  • Added: OwlCarousel v2.0.0-beta.2.4 (#148)
  • Added: markdown-it v12.0.2 (#149)
  • +
  • Fixed: Unknown frameworks in statistics page (#151)