From d792f672940de7fb1dee6484020ae919a0a302f8 Mon Sep 17 00:00:00 2001 From: nobody Date: Thu, 5 Nov 2020 07:07:52 +0100 Subject: [PATCH] Code moved --- core/constants.js | 30 +++++++++++++++++++ modules/internal/helpers.js | 59 +------------------------------------ 2 files changed, 31 insertions(+), 58 deletions(-) diff --git a/core/constants.js b/core/constants.js index 6036c691..41e1f768 100644 --- a/core/constants.js +++ b/core/constants.js @@ -233,6 +233,36 @@ const FrameworkAndBundle = { 'resources/twitter-bootstrap/2.3.2/': 'Bootstrap' }; +const CDNs = { + 'ajax.googleapis.com': 'Google Hosted Libraries', + 'ajax.aspnetcdn.com': 'Microsoft Ajax CDN', + 'ajax.microsoft.com': 'Microsoft Ajax CDN [Deprecated]', + 'cdnjs.cloudflare.com': 'CDNJS (Cloudflare)', + 'code.jquery.com': 'jQuery CDN (MaxCDN)', + 'cdn.jsdelivr.net': 'jsDelivr (Cloudflare)', + 'yastatic.net': 'Yandex CDN', + 'yandex.st': 'Yandex CDN [Deprecated]', + 'apps.bdimg.com': 'Baidu CDN', + 'libs.baidu.com': 'Baidu CDN [Deprecated]', + 'lib.sinaapp.com': 'Sina Public Resources', + 'upcdn.b0.upaiyun.com': 'UpYun Library', + 'cdn.bootcss.com': 'BootCDN #1', + 'sdn.geekzu.org': 'Geekzu Public Service [Mirror]', + 'ajax.proxy.ustclug.org': 'USTC Linux User Group [Mirror]', + 'unpkg.com': 'UNPKG (Cloudflare)', + 'stackpath.bootstrapcdn.com': 'StackPath BootstrapCDN', + 'maxcdn.bootstrapcdn.com': 'MaxCDN Bootstrap CDN', + 'use.fontawesome.com': 'Font Awesome CDN', + 'ajax.cloudflare.com': 'Cloudflare CDN', + 'akamai-webcdn.kgstatic.net': 'Akamai WebCDN', + 'netdna.bootstrapcdn.com': 'NetDNA', + 'pagecdn.io': 'PageCDN', + 'fonts.googleapis.com': 'Google Fonts', + 'gitcdn.github.io': 'GitHub', + 'cdn.bootcdn.net': 'BootCDN #2', + 'vjs.zencdn.net': 'Video.js CDN', +}; + // Supported charsets for TextDecoder() // https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder/TextDecoder const EncodingTypes = { diff --git a/modules/internal/helpers.js b/modules/internal/helpers.js index 8271ac75..551a55df 100644 --- a/modules/internal/helpers.js +++ b/modules/internal/helpers.js @@ -175,64 +175,7 @@ helpers.generateRandomHexString = function (length) { }; helpers.determineCdnName = function (domainName) { - switch (domainName) { - case 'ajax.googleapis.com': - return 'Google Hosted Libraries'; - case 'ajax.aspnetcdn.com': - return 'Microsoft Ajax CDN'; - case 'ajax.microsoft.com': - return 'Microsoft Ajax CDN [Deprecated]'; - case 'cdnjs.cloudflare.com': - return 'CDNJS (Cloudflare)'; - case 'code.jquery.com': - return 'jQuery CDN (MaxCDN)'; - case 'cdn.jsdelivr.net': - return 'jsDelivr (Cloudflare)'; - case 'yastatic.net': - return 'Yandex CDN'; - case 'yandex.st': - return 'Yandex CDN [Deprecated]'; - case 'apps.bdimg.com': - return 'Baidu CDN'; - case 'libs.baidu.com': - return 'Baidu CDN [Deprecated]'; - case 'lib.sinaapp.com': - return 'Sina Public Resources'; - case 'upcdn.b0.upaiyun.com': - return 'UpYun Library'; - case 'cdn.bootcss.com': - return 'BootCDN #1'; - case 'sdn.geekzu.org': - return 'Geekzu Public Service [Mirror]'; - case 'ajax.proxy.ustclug.org': - return 'USTC Linux User Group [Mirror]'; - case 'unpkg.com': - return 'UNPKG (Cloudflare)'; - case 'stackpath.bootstrapcdn.com': - return 'StackPath BootstrapCDN'; - case 'maxcdn.bootstrapcdn.com': - return 'MaxCDN Bootstrap CDN'; - case 'use.fontawesome.com': - return 'Font Awesome CDN'; - case 'ajax.cloudflare.com': - return 'Cloudflare CDN'; - case 'akamai-webcdn.kgstatic.net': - return 'Akamai WebCDN'; - case 'netdna.bootstrapcdn.com': - return 'NetDNA'; - case 'pagecdn.io': - return 'PageCDN'; - case 'fonts.googleapis.com': - return 'Google Fonts'; - case 'gitcdn.github.io': - return 'GitHub'; - case 'cdn.bootcdn.net': - return 'BootCDN #2'; - case 'vjs.zencdn.net': - return 'Video.js CDN'; - default: - return 'Unknown'; - } + return CDNs[domainName] || 'Unknown'; }; helpers.determineScriptDirection = function (language) {