From 40324482ba301d7ed9a56ef0fc2d4391dbaf871b Mon Sep 17 00:00:00 2001 From: Florent Bruneau Date: Tue, 29 Mar 2011 21:11:29 +0200 Subject: [PATCH] Load json2 on IE because IE<=7 do not implements JSON (Closes #1449) Could have been more clever by selecting only the version of IE without JSON. Signed-off-by: Florent Bruneau --- Makefile | 6 +++++- classes/xnetpage.php | 3 +++ classes/xorgpage.php | 3 +++ htdocs/javascript/.gitignore | 1 + 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 90a3713..d63ab9b 100644 --- a/Makefile +++ b/Makefile @@ -76,7 +76,7 @@ htdocs/.htaccess: htdocs/.htaccess.in Makefile ## ## static content ## -static: htdocs/javascript/core.js htdocs/javascript@VERSION +static: htdocs/javascript/core.js htdocs/javascript@VERSION htdocs/javascript/json2.js htdocs/javascript/core.js: cd htdocs/javascript/ && ln -s ../../core/htdocs/javascript/core.js @@ -84,6 +84,10 @@ htdocs/javascript/core.js: %@VERSION: % Makefile ChangeLog cd $< && rm -f $(VERSION) && ln -sf . $(VERSION) +htdocs/javascript/json2.js: DOWNLOAD_SRC = https://github.com/douglascrockford/JSON-js/raw/master/json2.js --no-check-certificate +htdocs/javascript/json2.js: + @$(download) + ## ## wiki ## diff --git a/classes/xnetpage.php b/classes/xnetpage.php index e2075b0..0f1a1cd 100644 --- a/classes/xnetpage.php +++ b/classes/xnetpage.php @@ -41,6 +41,9 @@ class XnetPage extends PlPage $this->assign('is_admin', may_update()); $this->assign('is_member', is_member()); } + if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false) { + $this->addJsLink('json2.js'); + } $this->addJsLink('jquery.xorg.js'); $this->addJsLink('overlib.js'); $this->addJsLink('core.js'); diff --git a/classes/xorgpage.php b/classes/xorgpage.php index 83824d8..852b842 100644 --- a/classes/xorgpage.php +++ b/classes/xorgpage.php @@ -27,6 +27,9 @@ class XorgPage extends PlPage // Set the default page $this->changeTpl('platal/index.tpl'); + if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false) { + $this->addJsLink('json2.js'); + } $this->addJsLink('jquery.xorg.js'); $this->addJsLink('overlib.js'); $this->addJsLink('core.js'); diff --git a/htdocs/javascript/.gitignore b/htdocs/javascript/.gitignore index 85fe6a4..47ad449 100644 --- a/htdocs/javascript/.gitignore +++ b/htdocs/javascript/.gitignore @@ -4,4 +4,5 @@ # jQuery and its plugins are downloaded by the Makefile /jquery*.*js /core.js +/json2.js !/jquery.autocomplete.js -- 2.1.4