diff --git a/.gitignore b/.gitignore
index ea051b290..df6d75bec 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
node_modules
-settings.json
\ No newline at end of file
+settings.json
+static/js/jquery.min.js
\ No newline at end of file
diff --git a/bin/run.sh b/bin/run.sh
index 3940e87c4..f1a1af995 100755
--- a/bin/run.sh
+++ b/bin/run.sh
@@ -37,6 +37,21 @@ fi
echo "Ensure that all dependencies are up to date..."
npm install
+echo "Ensure jQuery is downloaded and up to date..."
+DOWNLOAD_JQUERY="true"
+NEEDED_VERSION="1.6.1"
+if [ -f "static/js/jquery.min.js" ]; then
+ VERSION=$(cat static/js/jquery.min.js | head -n 2 | tail -n 1 | grep -o "v[0-9]*\.[0-9]*\.[0-9]*");
+
+ if [[ ${VERSION:1} = $NEEDED_VERSION ]]; then
+ DOWNLOAD_JQUERY="false"
+ fi
+fi
+
+if [[ $DOWNLOAD_JQUERY = "true" ]]; then
+ wget -O static/js/jquery.min.js http://code.jquery.com/jquery-$NEEDED_VERSION.min.js
+fi
+
#Remove all minified data to force node creating it new
echo "Clear minfified cache..."
rm var/minified* 2> /dev/null
diff --git a/node/minify.js b/node/minify.js
index 7245b214f..aee3d3c05 100644
--- a/node/minify.js
+++ b/node/minify.js
@@ -39,7 +39,7 @@ exports.padJS = function(req, res)
{
res.header("Content-Type","text/javascript");
- var jsFiles = ["plugins.js", "undo-xpopup.js", "json2.js", "pad_utils.js", "pad_cookie.js", "pad_editor.js", "pad_editbar.js", "pad_docbar.js", "pad_modals.js", "ace.js", "collab_client.js", "pad_userlist.js", "pad_impexp.js", "pad_savedrevs.js", "pad_connectionstatus.js", "pad2.js"];
+ var jsFiles = ["jquery.min.js", "plugins.js", "undo-xpopup.js", "json2.js", "pad_utils.js", "pad_cookie.js", "pad_editor.js", "pad_editbar.js", "pad_docbar.js", "pad_modals.js", "ace.js", "collab_client.js", "pad_userlist.js", "pad_impexp.js", "pad_savedrevs.js", "pad_connectionstatus.js", "pad2.js"];
//minifying is enabled
if(settings.minify)
@@ -182,9 +182,9 @@ exports.padJS = function(req, res)
{
//put all javascript files in an array
var values = [];
- for(var i in fileValues)
+ for(var i in jsFiles)
{
- values.push(fileValues[i]);
+ values.push(fileValues[jsFiles[i]]);
}
//minify all javascript files to one
diff --git a/static/pad.html b/static/pad.html
index 1ce2a6f05..5b263648d 100644
--- a/static/pad.html
+++ b/static/pad.html
@@ -19,7 +19,6 @@
var clientVars = {}; // ]]>
-