From 4d1f55e3d7c1aa58a1d2f6dfde99332f430a7756 Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Sat, 18 Jul 2020 01:21:25 +0200 Subject: [PATCH] Allow user to configure local or CDN source for JQuery (fixes marekrei#77) --- __encode/config.php | 18 +++++++++++ index.php | 74 +++++++++++++++++++++++++++------------------ 2 files changed, 63 insertions(+), 29 deletions(-) diff --git a/__encode/config.php b/__encode/config.php index 6953249..fce939a 100644 --- a/__encode/config.php +++ b/__encode/config.php @@ -279,4 +279,22 @@ // $_CONFIG['session_name'] = ""; +// +// Defines where to find the JQuery file. +// Allowed values: +// * "local": use the locally hosted file (at __encode/static/jquery.min.js) +// * "cdn" : use the CDN url provided by $_CONFIG['jquery_cdn_url'] +// * "none" : don't use JQuery (Warning: limited functionnality) +// +$_CONFIG['jquery_source'] = "cdn"; + +// +// URL to the JQuery javascript file (Usually a CDN). +// You can use the CDN of your choice or any custom URL. See: +// https://jquery.com/download/#using-jquery-with-a-cdn +// Respected only when $_CONFIG['jquery_source'] == "cdn". +// Default: $_CONFIG['session_name'] = ""; +// +$_CONFIG['jquery_cdn_url'] = "https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"; + ?> diff --git a/index.php b/index.php index 4b1dee0..024eac0 100644 --- a/index.php +++ b/index.php @@ -395,32 +395,50 @@ function outputHtml() getConfig('log_file') != null && strlen($this->getConfig('log_file')) > 0) - || ($this->getConfig('thumbnails') != null && $this->getConfig('thumbnails') == true && $this->mobile == false) - || (GateKeeper::isDeleteAllowed())) +if($this->getConfig('jquery_source') != null && $this->getConfig('jquery_source') != "none") { -?> - - -\n"; + echo "\n"; } -?> -}); -//]]> - -