From de32503f8ef5b7ec71e0fafff796eef7c5d13a81 Mon Sep 17 00:00:00 2001 From: Peter 'Pita' Martischka Date: Sun, 31 Jul 2011 17:21:01 +0100 Subject: [PATCH] improve including of custom js/css --- bin/installDeps.sh | 12 +++++++++--- static/custom/css.template | 5 +++++ static/custom/js.template | 6 ++++++ static/index.html | 3 +++ static/js/pad2.js | 3 +++ static/timeslider.html | 5 ++++- 6 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 static/custom/css.template create mode 100644 static/custom/js.template diff --git a/bin/installDeps.sh b/bin/installDeps.sh index ffe15b9aa..6602ef5fc 100755 --- a/bin/installDeps.sh +++ b/bin/installDeps.sh @@ -54,10 +54,16 @@ echo "Clear minfified cache..." rm -f var/minified* echo "ensure custom css/js files are created..." -for f in $(cat "static/custom/.gitignore") +FILES=( index pad timeslider ) + +for f in ${FILES[@]} do - if [ ! -f "static/custom/$f" ]; then - touch "static/custom/$f" + if [ ! -f "static/custom/$f.js" ]; then + cp -v "static/custom/js.template" "static/custom/$f.js" || exit 1 + fi + + if [ ! -f "static/custom/$f.css" ]; then + cp -v "static/custom/css.template" "static/custom/$f.css" || exit 1 fi done diff --git a/static/custom/css.template b/static/custom/css.template new file mode 100644 index 000000000..b47c7fc0d --- /dev/null +++ b/static/custom/css.template @@ -0,0 +1,5 @@ +/* + You may have to use !important to override css attributs, for example: + + * {color: blue !important;} +*/ diff --git a/static/custom/js.template b/static/custom/js.template new file mode 100644 index 000000000..e857a8bfe --- /dev/null +++ b/static/custom/js.template @@ -0,0 +1,6 @@ +function costumStart() +{ + //define your javascript here + //jquery is avaiable - except index.js + //you can load extra scripts with $.getScript http://api.jquery.com/jQuery.getScript/ +} diff --git a/static/index.html b/static/index.html index 7d21a0759..b7085458b 100644 --- a/static/index.html +++ b/static/index.html @@ -123,5 +123,8 @@ } return randomstring; } + + //start the costum js + if(costumStart) costumStart(); diff --git a/static/js/pad2.js b/static/js/pad2.js index e18a27635..aa1f7ccd7 100644 --- a/static/js/pad2.js +++ b/static/js/pad2.js @@ -29,6 +29,9 @@ $(document).ready(function() document.location = expectedURL; } + //start the costum js + if(costumStart) costumStart(); + handshake(); }); diff --git a/static/timeslider.html b/static/timeslider.html index e183d2344..fbcbc149e 100644 --- a/static/timeslider.html +++ b/static/timeslider.html @@ -55,8 +55,11 @@ var socket, token, padId; - $(window).load(function () + $(document).ready(function () { + //start the costum js + if(costumStart) costumStart(); + //get the padId out of the url var urlParts= document.location.pathname.split("/"); padId = urlParts[urlParts.length-2];