From ce40ad00a418e65c3f6bc9806790e0da598452f2 Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Fri, 5 Sep 2014 17:17:48 +0000 Subject: [PATCH] --- .../views/scripts/common/header.phtml | 4 +- images/logo.svg | 5 + js/common.coffee | 4 + js/common.js | 19 +- js/contact.js | 216 +++++++------- js/home.js | 276 +++++++++--------- js/test.coffee | 28 ++ js/test.js | 62 ++++ less/header.less | 11 + 9 files changed, 357 insertions(+), 268 deletions(-) create mode 100644 js/common.coffee create mode 100644 js/test.coffee create mode 100644 js/test.js diff --git a/framework/application/views/scripts/common/header.phtml b/framework/application/views/scripts/common/header.phtml index e946e4b..698b263 100644 --- a/framework/application/views/scripts/common/header.phtml +++ b/framework/application/views/scripts/common/header.phtml @@ -12,8 +12,8 @@ if (!is_null($homepage)) { link($this->image('images/logo.svg', '', 318, 132), $home, array('class' => 'logo')); + if (null !== 'home') { + echo $this->link($this->image('/images/logo.svg', '', 318, 132), $home, array('class' => 'logo')); echo ''; } diff --git a/images/logo.svg b/images/logo.svg index 4baf79c..6e47258 100644 --- a/images/logo.svg +++ b/images/logo.svg @@ -3,6 +3,11 @@
'; +function makeInfoContent(c) { + var res = ''; + if (c.nom != '') { + res += '' + c.nom + '
'; } - if(c.adresse!=''){ - res+=c.adresse+'
'; + if (c.adresse != '') { + res += c.adresse + '
'; } - if(c.code_postal){ - res+=c.code_postal+' '; + if (c.code_postal) { + res += c.code_postal + ' '; } - if(c.ville!=''){ - res+=c.ville+'
'; + if (c.ville != '') { + res += c.ville + '
'; } return res; - + } \ No newline at end of file diff --git a/js/home.js b/js/home.js index 5ca3ce1..291ad7f 100644 --- a/js/home.js +++ b/js/home.js @@ -1,4 +1,4 @@ -TO_LOAD_ONCE[TO_LOAD_ONCE.length]='load_home();'; +TO_LOAD_ONCE[TO_LOAD_ONCE.length] = 'load_home();'; var nbSlides; var currentSlide; @@ -11,172 +11,158 @@ var time; function load_home() { slideShow(); - preloadSlides(); - - $(".logo") - - .mouseenter(function() { - var img = $(this).children("img"); - //fb( $(img)); - //$(this).children().css('fill',"#6F216C"); - $('path, polygon, circle', this).attr('fill', '#ccc'); - $(this).children().find("Background").attr("fill", "#ccc"); - }) - - .mouseleave(function() { - $(this).children().css('fill','black'); - }); + preloadSlides(); } function slideShow() { - nbSlides = $('.slide').length; - - currentSlideId = 0; - - currentSlide=$('.slide:first'); - - if(currentSlide.length>0){ - - var image=new Image(); - image.src=currentSlide.attr('data-image'); - - if(image.complete){ - currentSlide.html(""); - } - - $(image).load(function(){ - currentSlide.html(""); - }); - - var legend = currentSlide.attr('data-legend'); - $('#slide-legend').html(legend); - - $('.slide:first').fadeIn(); - - if(autoSlide) { - time = currentSlide.attr('data-time'); - switchTimer = window.setTimeout( nextSlide, time); - } - - } - - initLinks(); - //checkPages(); - - - + nbSlides = $('.slide').length; + + currentSlideId = 0; + + currentSlide = $('.slide:first'); + + if (currentSlide.length > 0) { + + var image = new Image(); + image.src = currentSlide.attr('data-image'); + + if (image.complete) { + currentSlide.html(""); + } + + $(image).load(function() { + currentSlide.html(""); + }); + + var legend = currentSlide.attr('data-legend'); + $('#slide-legend').html(legend); + + $('.slide:first').fadeIn(); + + if (autoSlide) { + time = currentSlide.attr('data-time'); + switchTimer = window.setTimeout(nextSlide, time); + } + + } + + initLinks(); + //checkPages(); + + + } function nextSlide() { - - if( autoSlide ) { - if( currentSlideId < nbSlides-1 && !isAnim) - { - currentSlideId++; - }else{ - currentSlideId=0; - } - animSlide(); - } - + + if (autoSlide) { + if (currentSlideId < nbSlides - 1 && !isAnim) + { + currentSlideId++; + } else { + currentSlideId = 0; + } + animSlide(); + } + } function preloadSlides() { - - var i=0; - - $('.slide[data-image]').each(function(){ - var slide=this; - var image=new Image(); - image.src=$(this).attr('data-image'); - - if(image.complete){ - $(this).html(""); - } - - $(image).load(function(){ - $(slide).html(""); - }); - - i++; - }); + + var i = 0; + + $('.slide[data-image]').each(function() { + var slide = this; + var image = new Image(); + image.src = $(this).attr('data-image'); + + if (image.complete) { + $(this).html(""); + } + + $(image).load(function() { + $(slide).html(""); + }); + + i++; + }); } function initLinks() { - - $('.next').click(function(){ - - autoSlide = false; - - if( currentSlideId < nbSlides-1 && !isAnim) - { - currentSlideId++; - }else{ - currentSlideId=0; - } - - animSlide(); - - return false; - }); - - $('.prev').click(function(){ - - autoSlide = false; - - if( currentSlideId > 0 && !isAnim ) - { - currentSlideId--; - }else{ - currentSlideId = nbSlides-1; - } - - animSlide(); - - return false; - }); - + + $('.next').click(function() { + + autoSlide = false; + + if (currentSlideId < nbSlides - 1 && !isAnim) + { + currentSlideId++; + } else { + currentSlideId = 0; + } + + animSlide(); + + return false; + }); + + $('.prev').click(function() { + + autoSlide = false; + + if (currentSlideId > 0 && !isAnim) + { + currentSlideId--; + } else { + currentSlideId = nbSlides - 1; + } + + animSlide(); + + return false; + }); + } function animSlide() { - isAnim = true; - $('#slide-legend').fadeOut(); + isAnim = true; + $('#slide-legend').fadeOut(); + + $(currentSlide).fadeOut(animDuration, function() { - $(currentSlide).fadeOut(animDuration,function(){ + currentSlide = $('#slide-' + currentSlideId); - currentSlide = $('#slide-'+currentSlideId); + var legende = currentSlide.attr('data-legend'); - var legende = currentSlide.attr('data-legend'); - - $('#slide-legend').html(legende); + $('#slide-legend').html(legende); - $('#slide-'+currentSlideId).fadeIn(); - - $('#slide-legend').fadeIn(); + $('#slide-' + currentSlideId).fadeIn(); - isAnim = false; - - if( autoSlide ) { - time = $('#slide-'+currentSlideId).attr('data-time'); - fb(time); - switchTimer = window.setTimeout( nextSlide, time); - } - + $('#slide-legend').fadeIn(); - }); + isAnim = false; + + if (autoSlide) { + time = $('#slide-' + currentSlideId).attr('data-time'); + fb(time); + switchTimer = window.setTimeout(nextSlide, time); + } + + + }); } function checkPages() { - if( currentSlideId >= nbSlides-1) { - $('.next').css("visibility","hidden"); - } - if( currentSlideId == 0 ) { - if( nbSlides-1 > 0) { - $('.next').css("visibility","visible"); - } - $('.prev').css("visibility","hidden"); - }else{ - $('.prev').css("visibility","visible"); - } - + if (currentSlideId >= nbSlides - 1) { + $('.next').css("visibility", "hidden"); + } + if (currentSlideId == 0) { + if (nbSlides - 1 > 0) { + $('.next').css("visibility", "visible"); + } + $('.prev').css("visibility", "hidden"); + } else { + $('.prev').css("visibility", "visible"); + } + } \ No newline at end of file diff --git a/js/test.coffee b/js/test.coffee new file mode 100644 index 0000000..e6bb9bc --- /dev/null +++ b/js/test.coffee @@ -0,0 +1,28 @@ +$ -> + yearsOld = max: 10, ida: 9, tim: 11 + + ages = for child, age of yearsOld + "#{child} is #{age}" + + range = (x)=>x+parseFloat "5.5" + + interval = setInterval => + parseFloat 5.5 + , 1000 + + +class Animal + constructor: ()-> + @papates=2 + +class Nutria extends Animal + constructor:()-> + @papates=4 + $(".pate").click ()=> + fb @papates + + +((w,d) -> + $ -> + parseFloat '5.5' +)(window,document) \ No newline at end of file diff --git a/js/test.js b/js/test.js new file mode 100644 index 0000000..72751d7 --- /dev/null +++ b/js/test.js @@ -0,0 +1,62 @@ +// Generated by CoffeeScript 1.8.0 +var Animal, Nutria, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + +$(function() { + var age, ages, child, interval, range, yearsOld; + yearsOld = { + max: 10, + ida: 9, + tim: 11 + }; + ages = (function() { + var _results; + _results = []; + for (child in yearsOld) { + age = yearsOld[child]; + _results.push("" + child + " is " + age); + } + return _results; + })(); + range = (function(_this) { + return function(x) { + return x + parseFloat("5.5"); + }; + })(this); + return interval = setInterval((function(_this) { + return function() { + return parseFloat(5.5, 1000); + }; + })(this)); +}); + +Animal = (function() { + function Animal() { + this.papates = 2; + } + + return Animal; + +})(); + +Nutria = (function(_super) { + __extends(Nutria, _super); + + function Nutria() { + this.papates = 4; + } + + $(".pate").click(function() { + return fb(Nutria.papates); + }); + + return Nutria; + +})(Animal); + +(function(w, d) { + return $(function() { + return parseFloat('5.5'); + }); +})(window, document); diff --git a/less/header.less b/less/header.less index d43d5d8..48999c7 100644 --- a/less/header.less +++ b/less/header.less @@ -32,6 +32,17 @@ position:absolute; top:-1px; left:-34px; + + &:hover{ + .svg{ + cursor:pointer; + svg{ + #Background{ + fill:#ff0000 !important; + } + } + } + } } .sublogo { -- 2.39.5