improve including of custom js/css

pull/57/head
Peter 'Pita' Martischka 2011-07-31 17:21:01 +01:00
parent 340fbf4d44
commit de32503f8e
6 changed files with 30 additions and 4 deletions

View File

@ -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

View File

@ -0,0 +1,5 @@
/*
You may have to use !important to override css attributs, for example:
* {color: blue !important;}
*/

View File

@ -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/
}

View File

@ -123,5 +123,8 @@
}
return randomstring;
}
//start the costum js
if(costumStart) costumStart();
</script>
</html>

View File

@ -29,6 +29,9 @@ $(document).ready(function()
document.location = expectedURL;
}
//start the costum js
if(costumStart) costumStart();
handshake();
});

View File

@ -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];