From d01a5e36fbbae8f0c1242bfd9bf5d50cb9db44da Mon Sep 17 00:00:00 2001 From: Awilum Date: Fri, 3 Jan 2014 00:05:13 +0200 Subject: [PATCH] Chocolat Added --- public/assets/css/chocolat.css | 112 +++++++++ public/assets/img/chocolat/close.gif | Bin 0 -> 70 bytes public/assets/img/chocolat/closew.gif | Bin 0 -> 70 bytes public/assets/img/chocolat/left.gif | Bin 0 -> 68 bytes public/assets/img/chocolat/leftw.gif | Bin 0 -> 68 bytes public/assets/img/chocolat/loading.gif | Bin 0 -> 1222 bytes public/assets/img/chocolat/loadingw.gif | Bin 0 -> 57 bytes public/assets/img/chocolat/right.gif | Bin 0 -> 67 bytes public/assets/img/chocolat/rightw.gif | Bin 0 -> 67 bytes public/assets/js/jquery.chocolat.js | 294 ++++++++++++++++++++++++ 10 files changed, 406 insertions(+) create mode 100644 public/assets/css/chocolat.css create mode 100644 public/assets/img/chocolat/close.gif create mode 100644 public/assets/img/chocolat/closew.gif create mode 100644 public/assets/img/chocolat/left.gif create mode 100644 public/assets/img/chocolat/leftw.gif create mode 100644 public/assets/img/chocolat/loading.gif create mode 100644 public/assets/img/chocolat/loadingw.gif create mode 100644 public/assets/img/chocolat/right.gif create mode 100644 public/assets/img/chocolat/rightw.gif create mode 100644 public/assets/js/jquery.chocolat.js diff --git a/public/assets/css/chocolat.css b/public/assets/css/chocolat.css new file mode 100644 index 0000000..e15f8e2 --- /dev/null +++ b/public/assets/css/chocolat.css @@ -0,0 +1,112 @@ +body{ + margin:0; + padding:0; +} +#Choco_overlay{ + background: #fff; + position: fixed; + top: 0; + left: 0; + z-index: 1000; + width: 100%; + height: 100%; + display:none; + padding:0; + margin:0; +} +#Choco_content{ + display:none; + width:800px; + height:600px; + z-index:1001; + position:fixed; + left:50%; + top:50%; + margin-left:-400px; + margin-top:-300px; + border-top:1px solid transparent;/*Yes, adjust image perfectly at the center of a box, don't know why.*/ +} +#Choco_left_arrow{ + float:left; + background-image:url(../images/left.gif); + background-position:12%; + left:-14%; +} +#Choco_right_arrow{ + float:right; + background-image:url(../images/right.gif); + background-position:88%; + left:14%; +} +.Choco_arrows{ + background-repeat:no-repeat; + display:none; + position:relative; + cursor:pointer; + width:49%; + top:-100%; + height:100%; + margin-top:-30px; +} +#Choco_container_photo{ + text-align:center; + width:800px; + height:600px; + /*background:url(../images/ajax-loader.gif) center center no-repeat;*/ +} +#Choco_container_description{ + padding:0; + height:26px; + width:100%; + color:#505050; + font-family:Tahoma; + clear:both; + position:relative; + font-size:12px; + margin-top:-5px; + overflow:hidden; + visibility:hidden; +} +#Choco_container_title{ + float:left; + padding:5px; +} +#Choco_container_via{ + padding:5px; + float:right; +} +#Choco_container_via a{ + color:gray; +} +#Choco_container_via a:hover{ + color:white; + background:gray; +} +#Choco_close{ + width:30px; + height:25px; + background-image:url(../images/close.gif); + background-repeat:no-repeat; + z-index:1002; + cursor:pointer; + margin-top:-20px; + display:none; +} +#Choco_loading{ + width:9px; + height:11px; + background-image:url(../images/loading.gif); + background-repeat:no-repeat; + z-index:1002; + cursor:pointer; + float:right; + margin-top:-20px; + display:none; +} +#Choco_bigImage{ + display:none; + position:relative; + width:100%; + height:100%; + margin-top:-5px; +} diff --git a/public/assets/img/chocolat/close.gif b/public/assets/img/chocolat/close.gif new file mode 100644 index 0000000000000000000000000000000000000000..77933f7ce5c1d1accf589697208106f676578cfd GIT binary patch literal 70 zcmZ?wbhEHbjEB@#9a}5c0b_{Se(lcNN2?K>9d;=6*5=#<+w2gg5 zL1J=tYKcNpYI8?t&$^1LIGr_bAC~(f~lT? zZnA-yfr6Q#o}sacxw*NHf{}rtfxdx}zM+w>p}Cc@k(Ggg0u(3#Z7WJivkG!?gW3h; z*(zm}loVL$>z9|8>y;bpw&$amzVPg@)As;uP=V3xw&xF z#U(+h2=`(&xHzP;AXPsowK%`DC^;3VTp46lft7PnYGO%#QAmD%4lEP{GV)9Ei!<^I z6r6)i6~Z&~Qu51-!K!_ItvvIJOA_;vQ$1a5m4N#7GBZ=GoE)7joD7W3jh&ob4Gmol zE!=DNggCdQ)(_#SEujeV}9XLD7m7%`hQg+5s`)i5AF#C;QYqU|KH%CThn2 z|Nj2@{p;tC@87({PcxqRv3 zh4bgmo;iK$#u35cm<%;FYmM&Sm zXyJnS^XAT(J!|HS>C>i8nLKIYg#NzXp6;&Bj`p_Jmgc6$hWfhNn(C^`it@73lH#Jm zg8aPPob0U3jP$hBl;otug!s7FnCPg;i14t`kl>)e0DnJUA8#*D4|g|L7iT9&2YWkP z8*3{|3v)A56JsM_hSJm3(bm$`P*+n`QC3n^ke8E{k(QE_5El~_5f%~@;OFDz;pXDx zU}s}xVP*mr4T?WmIOP}^8FWB}2dEffVB+cNUwNA2_q<7Kqr$K%;0G$me!%HBWlNi; a{Ovm;L>a=0W(ya{mfi=8<}7Dmum%8rn4jzb literal 0 HcmV?d00001 diff --git a/public/assets/img/chocolat/loadingw.gif b/public/assets/img/chocolat/loadingw.gif new file mode 100644 index 0000000000000000000000000000000000000000..50695c0246f882d57ab90f25dce62a3d0cef3865 GIT binary patch literal 57 zcmZ?wbhEHbocda6L OTE4u0'); + } + $('#'+settings.linksContainer).append('
  • '+settings.setTitle+'
  • '); + e = this.parent(); + $(this).remove(); + if($.trim(e.html()) == ""){//If parent empty : remove it + e.remove(); + } + return $('#Choco_numsetIndex_'+settings.setIndex).unbind('click').bind('click', {id: settings.setIndex, nom : settings.setTitle, i : settings.currentImage}, _initialise); + } + } + + function _initialise(event) { + + settings.currentImage = event.data.i; + settings.setIndex = event.data.id; + settings.setTitle = event.data.nom; + settings.lastImage = images[settings.setIndex].length - 1; + showChocolat(); + return false; + } + function _interface(){ + //html + clear(); + settings.container.append('
    '); + $('#Choco_left_arrow').css('background-image', 'url('+settings.leftImg+')'); + $('#Choco_right_arrow').css('background-image', 'url('+settings.rightImg+')'); + $('#Choco_close').css('background-image', 'url('+settings.closeImg+')'); + $('#Choco_loading').css('background-image', 'url('+settings.loadingImg+')'); + if(settings.container.get(0).nodeName.toLowerCase() !== 'body'){ + settings.container.css({'position':'relative','overflow':'hidden','line-height':'normal'});//yes, yes + $('#Choco_content').css('position','relative'); + $('#Choco_overlay').css('position', 'absolute'); + } + //events + $(document).unbind('keydown').bind('keydown', function(e){ + switch(e.keyCode){ + case 37: + changePageChocolat(-1); + break; + case 39: + changePageChocolat(1); + break; + case 27: + close(); + break; + }; + }); + if(settings.vache){ + $('#Choco_overlay').click(function(){ + close(); + return false; + }); + } + $('#Choco_left_arrow').unbind().bind('click', function(){ + changePageChocolat(-1); + return false; + }); + $('#Choco_right_arrow').unbind().bind('click', function(){ + changePageChocolat(1); + return false; + }); + $('#Choco_close').unbind().bind('click', function(){ + close(); + return false; + }); + $(window).resize(function() { + load(settings.currentImage,true); + }); + + } + function showChocolat(){ + _interface(); + load(settings.currentImage, false); + $('#Choco_overlay') + .css({ + 'background-color' : settings.overlayColor, + 'opacity' : settings.overlayOpacity + }) + .fadeIn(settings.fadeInOverlayduration); + $('#Choco_content').fadeIn(settings.fadeInImageduration,function(){}); + + } + function load(image,resize){ + settings.currentImage = image; + $('#Choco_loading').fadeIn(settings.fadeInImageduration); + var imgPreloader = new Image(); + imgPreloader.onload = function(){ + $('#Choco_bigImage').attr('src',images[settings.setIndex][settings.currentImage]['adress']); + var ajustees = iWantThePerfectImageSize(imgPreloader.height,imgPreloader.width); + ChoColat(ajustees['hauteur'],ajustees['largeur'],resize); + $('#Choco_loading').stop().fadeOut(settings.fadeOutImageduration); + }; + imgPreloader.src = images[settings.setIndex][settings.currentImage]['adress']; + preload(); + upadteDescription(); + } + function changePageChocolat(signe){ + if(!settings.linkImages || (settings.currentImage == 0 && signe == -1) || (settings.currentImage == settings.lastImage && signe == 1)) + { + return false; + } + else{ + //$('#Choco_container_description').fadeTo(settings.fadeOutImageduration,0); making a weird bug with firefox 17 + $('#Choco_container_description').css('visibility','hidden'); + $('#Choco_bigImage').fadeTo(settings.fadeOutImageduration, 0, function(){ + load(settings.currentImage + parseInt(signe), false); + }); + } + } + function ChoColat(hauteur_image,largeur_image,resize){ + + if(resize){ + $('#Choco_container_photo, #Choco_content, #Choco_bigImage').stop(true,false).css({'overflow':'visible'}); + $('#Choco_bigImage').animate({ + 'height' : hauteur_image+'px', + 'width' : largeur_image+'px' + },settings.fadeInImageduration); + } + $('#Choco_container_photo').animate({ + 'height' : hauteur_image, + 'width' : largeur_image + },settings.fadeInImageduration); + $('#Choco_content').animate({ + 'height' : hauteur_image, + 'width' : largeur_image, + 'marginLeft' : -largeur_image/2, + 'marginTop' : -(hauteur_image)/2 + },settings.fadeInImageduration, 'swing', function(){ + $('#Choco_bigImage').fadeTo(settings.fadeInImageduration, 1).height(hauteur_image).width(largeur_image); + if(!resize) + { + arrowsManaging(); + //$('#Choco_container_description').fadeTo(settings.fadeInImageduration,1); making a weird bug with firefox 17 + $('#Choco_container_description').css('visibility','visible'); + $('#Choco_close').fadeIn(settings.fadeInImageduration); + } + }). + css('overflow', 'visible'); + } + function arrowsManaging(){ + if(settings.linkImages){ + var what = ['Choco_right_arrow','Choco_left_arrow']; + for(var i=0; i < what.length; i++){ + hide = false; + if(what[i] == 'Choco_right_arrow' && settings.currentImage == settings.lastImage){ + hide = true; + $('#'+what[i]).fadeOut(300); + } + else if(what[i] == 'Choco_left_arrow' && settings.currentImage == 0){ + hide = true; + $('#'+what[i]).fadeOut(300); + } + if(!hide){ + $('#'+what[i]).fadeIn(settings.fadeOutImageduration); + } + } + } + } + function preload(){ + if(settings.currentImage !== settings.lastImage){ + i = new Image; + z = settings.currentImage + 1; + i.src = images[settings.setIndex][z]['adress']; + } + } + function upadteDescription(){ + var current = settings.currentImage + 1; + var last = settings.lastImage + 1; + $('#Choco_container_title').html(images[settings.setIndex][settings.currentImage]['caption']); + $('#Choco_container_via').html(settings.setTitle+settings.separator1+current +settings.separator2+last); + } + function isSet(variable,defaultValue){ + // return variable === undefined ? defaultValue : variable; ? + if (variable === undefined) { + return defaultValue; + } + else{ + return variable; + } + } + function iWantThePerfectImageSize(himg,limg){ + //28% = 14% + 14% margin + var lblock = limg + (limg*28/100); + var heightDescAndClose = $('#Choco_container_description').height()+$('#Choco_close').height(); + var hblock = himg + heightDescAndClose; + var k = limg/himg; + var kk = himg/limg; + if(settings.container.get(0).nodeName.toLowerCase() == 'body'){ + windowHeight = $(window).height(); + windowWidth = $(window).width(); + } + else{ + windowHeight = settings.container.height(); + windowWidth = settings.container.width(); + } + notFitting = true; + while (notFitting){ + var lblock = limg + (limg*28/100); + var hblock = himg + heightDescAndClose; + if(lblock > windowWidth){ + limg = windowWidth*100/128; + + himg = kk * limg; + }else if(hblock > windowHeight){ + himg = (windowHeight - heightDescAndClose); + limg = k * himg; + }else{ + notFitting = false; + }; + }; + return { + largeur:limg, + hauteur:himg + }; + + } + function clear(){ + $('#Choco_overlay').remove(); + $('#Choco_content').remove(); + } + function close(){ + $('#Choco_overlay').fadeOut(900, function(){$('#Choco_overlay').remove()}); + $('#Choco_content').fadeOut(500, function(){$('#Choco_content').remove()}); + settings.currentImage = 0; + } + +}; +})(jQuery);