From 8a03995d72a9afe999c243cffd1fae05b441c172 Mon Sep 17 00:00:00 2001 From: BigCoke233 Date: Sun, 12 Apr 2020 15:34:50 +0800 Subject: =?UTF-8?q?:books:=20Add:=20=E6=94=AF=E6=8C=81=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E9=9D=99=E6=80=81=E8=B5=84=E6=BA=90=20CDN?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- functions.php | 16 ++++++++++++---- includes/footer.php | 3 ++- includes/head.php | 3 ++- libs/Options.php | 6 ++++-- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/functions.php b/functions.php index 552454b..be3fccc 100644 --- a/functions.php +++ b/functions.php @@ -80,10 +80,18 @@ array_push($views, $cid); /** * 自动生成引用 */ -function generate_require($files,$type,$cdn = NULL) { - if ($cdn) - $path = $cdn.themeVersion()."/"; - else $path = Helper::options()->themeUrl("","Miracles"); +function generate_require($files,$type,$cdn,$custom) { + if ($cdn=='1'){ + $path = 'https://cdn.jsdelivr.net/gh/BigCoke233/miracles@'.themeVersion()."/"; + } + elseif ($cdn=='2'){ + $path = 'http://raw.githack.com/BigCoke233/miracles/master/'; + } + elseif ($cdn=='3'){ + $path = $custom; + }else{ + $path = Helper::options()->themeUrl("","Miracles"); + } foreach ($files as $file) { if ($type == "js") echo ""; diff --git a/includes/footer.php b/includes/footer.php index 6c82d26..94c9d48 100644 --- a/includes/footer.php +++ b/includes/footer.php @@ -23,7 +23,8 @@ options->CDN?"https://cdn.jsdelivr.net/gh/BigCoke233/miracles@":""); + if($this->options->customCDN): $custom=$this->options->customCDN; else: $custom=Helper::options()->themeUrl("","Miracles"); endif; + generate_require($js_files,"js",$this->options->CDN,$custom); ?>