/************************************************************************************ * * * * * Slide - v2.0 - 2013-10-01 * * http://piwitheme.fr/ * * * * * *************************************************************************************/ (function($) { //_________________________________________________________________________________________________________________________________ //|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| $(document).ready(function(){ $('body').prepend($('
').attr({'class':'tab','id':'tab-0','data-urltab':window.location}).append($('').attr('class','sld_tab'))).wrapInner($('').attr({'class':'pageslide','id':'layer-0'})); $('.pageslide').first().show(); var $w_w = $(window).width(), $w_h = $(window).height(), $tab = 40, i = 0, $layerShow = $('#layer-0'), $slideshow = []; $('body').append($('').attr('id','slideLoading').css({top:(($w_h/2)-50),left:(($w_w/2)-50)})); $('body').data('layerShow',$layerShow); _init_page() $(document).on('click','.slide', function(e) { var $url = $(this).attr('href'); $int = setTimeout(function() { $('#slideLoading').css('z-index',1000) }, 500); i++; _load($url); _pushstate($url); e.preventDefault(); }); $(document).on('click','.sameLayer', function(e) { var $href = $(this).attr('href'), $layerShow = $('body').data('layerShow'), $url = $href + ' #the_page', $slide_w = $layerShow.width(); _pushstate($href); if ($('.slshFirst').length){ $urlFirst = $('.slshFirst').attr('href') } else { $urlFirst = $href }; $('#the_page',$layerShow).addClass('unwrap').load($url, function(){ _init_page($urlFirst,$slide_w) $('.unwrap').children().unwrap(); }); e.preventDefault(); }); $(document).on('click','.tab', function(e) { _close( $(this) ); var $url = $(this).data('urltab'); _pushstate($url); }); $(document).on('submit','#quicksearch', function(e) { i++; var $val = $('#qsearchInput').attr('value'), $url = 'qsearch.php?q='+ $val, frame = $("").attr({src: $url,id: 'frame'}).css({display:'none'}); $('body').append(frame); setTimeout( function () { var $obj = $("#frame").contents(), $urlframe = $obj[0].location.href; $('#frame').pushstate($urlframe); $('#frame').remove() }, 1000); _load($url); $(this).attr('value', qsearch_prompt); e.preventDefault(); }); // Picture page rating $(document).on('mouseover','.rateButton',function(){ $('#rateForm input').each(function(){ $(this).removeClass('rateButtonFull').removeClass('rateButtonSelected'); }); $(this).addClass('rateButtonFull'); var rate = $(this).attr('title'), nth = ':nth-child(-n+' + rate + ')'; $('.rateButton' + nth).addClass('rateButtonFull'); }); $(document).on('mouseout','#rateForm',function(){ $('#rateForm input').each(function(){ $(this).removeClass('rateButtonFull').addClass('rateButton'); }); $('#rateForm input[type="button"]').addClass('rateButtonSelected'); _rate_star() }); $(document).on('click','.rateButton', function(e){ var form = $(this).parents('form'), hrefa = form.attr('action'), hrefm = form.attr('method'), rate = $(this).attr('title'), rate = 'rate=' + rate; $.ajax({ url : hrefa, type : hrefm, data : rate, success : function(){ hrefa = hrefa.substring(0,hrefa.indexOf('&')); hrefInf = hrefa + ' #imageInfos'; $('#imageInfos').addClass('unwrap').load(hrefInf,function(){ _rate_star(); _imageInfo(); $('.unwrap').children().unwrap(); }); } }); e.preventDefault(); }); //switchbox derivative $(document).on('click','.derivative', function(){ var url = $(this).data('url'), typeSave = $(this).data('typesave'), typeMap = $(this).data('typemap'), cookies = $(this).data('cookie') theImg = $('#theMainImage'); theImg.attr({'width':'' ,'height':'', 'src': url , 'useMap': '#map' + typeMap}); $('#derivativeSwitchBox .switchCheck').css('visibility','hidden'); $('#derivativeChecked' + typeSave).css('visibility','visible'); document.cookie = 'picture_deriv='+typeSave+';path=cookies'; }); $(document).on('click','.original',function(){ var theURL = $(this).data('url'), winName = $(this).data('winname'), features = $(this).data('features'); $.getScript('./themes/default/js/scripts.js', function(){ phpWGOpenWindow(theURL,winName,features) }); }); $(document).on('click','.privacy', function(){ var rootUrl = $(this).data('root'), id = $(this).data('id'), level = $(this).data('level'); setPrivacyLevel(rootUrl, id, level); }); //add comment $(document).on('click', '#addComment input[type=submit]', function(e){ $(this).valid_comment(); e.preventDefault(); }); $(document).on('click', '#editComment input[type=submit]', function(e){ $(this).valid_comment(); e.preventDefault(); }); // removal/edit comment $(document).on('click', '.actions a', function(e){ var e = $(this), confi = e.attr('confirm'); if(e.hasClass('delet')){ if (confirm(confi)) { _rem_ed(e); }; } if(e.hasClass('annul')){ var href = e.attr('href') + ' #comments'; $('#comments').addClass('unwrap').load(href, function(){ $('.unwrap').children().unwrap(); }); } if(e.hasClass('editComment')){ _rem_ed(e); }; e.preventDefault(); }); //Change the order of comments $(document).on('click', '.commentsOrder', function(e){ $.ajax({ url : $(this).attr('href'), success : function(html){ _comment_reload(html) } }); e.preventDefault(); }); //edit profil $(document).on('click', '#profile input[name=reset_to_default]', function(e){ var profil = $('#profile'), profilhref = profil.attr('action'), profilmet = profil.attr('method'), profilser = profil.serialize(), profilval = $(this).attr('value'), profilnam = $(this).attr('name'), data = profilser + '&' + profilnam + '=' + profilval; $.ajax({ url : profilhref, type : profilmet, data : data, success : function(html) { var content = $(html).find('#profile'); profil.replaceWith(content) } }); e.preventDefault(); }); // search page $(document).on('submit', '.theSearchPage .filter', function(e){ var sch = $('.filter'), schmet = sch.attr('method'), schser = sch.serialize(), schhref = sch.attr('action'); schser = schser+"&submit=Valide"; $.ajax({ url : schhref, type : schmet, data : schser, success : function(html){ var e = $(html).find('.errors'); if(e.length){ var inf = e.text() _message(inf); } else { var $href = $(html).find('.titrePage h2 a:nth-child(2)').attr('href'), $layerShow = $('body').data('layerShow'), $url = $href + ' #the_page'; $('#the_page', $layerShow).addClass('unwrap').load($url,function(){ _init_page(); $('.unwrap').children().unwrap(); }); }; } }); e.preventDefault(); }); //comment page $(document).on('submit', '.theCommentsPage .filter', function(e){ var com = $('.filter'), commet = com.attr('method'), comser = com.serialize(), comhref = com.attr('action'); $.ajax({ url : comhref, type : commet, data : comser, success : function(html){ var $layerShow = $('body').data('layerShow'), $comfilt = $(html).find('#content'); $('#content', $layerShow).replaceWith($comfilt); } }); e.preventDefault(); }); //switchBox var $optbox = [ {li : '#sortOrderLink', box : '#sortOrderBox'}, {li : '#derivativeSwitchLink' , box : '#derivativeSwitchBox'}, {li : '#privacyLevelLink' , box : '#privacyLevelBox'}, {li : '#calendarViewSwitchLink' , box : '#calendarViewSwitchBox'} ]; $.each($optbox, function(i, a){ $(document).on('click', a.li , function(e) { var $layerShow = $('body').data('layerShow'), $ele = $( a.box , $layerShow), ePos = $(this).position(), ePos_h = $(this).height(); if ($ele.is(":hidden")){ var left = (ePos.left) + 'px', top = (ePos.top + ePos_h) + 'px'; $ele.css({left: left , top: top }).show(); } e.preventDefault(); }); $(document).on('mouseleave', a.box, function() { $(this).hide(); }); }); //_____function SLIDE______________________________________________________________________________________________________________________________________________ function _init_page($urlFirst,$slide_w) { var $layerShow = $('body').data('layerShow'); _selectPageSlide(); _display_menu(); _titre_page(); _scrollbar(); _content_size(); _piwitheme_link(); _dragbar_tabs(); if($('#the_page',$layerShow).hasClass('thePicturePage')){ _rate_star(); _imageInfo() }; if($('#the_page',$layerShow).hasClass('EC_drag')||$('#the_page',$layerShow).hasClass('EC_tictac')){ _ECaptcha(); }; if($('#slideshow').length){ $('#theHeader', $layerShow).remove(); _load_slideshow($urlFirst, $slide_w); }; if($('body').hasClass('lightbox')||$('body').hasClass('lightboxReady')) { _lightbox() }; if($('body').hasClass('GThumb')||$('body').hasClass('GThumbReady')) { _GThumb() }; }; function _load( $url ) { var $z = (100 / i).toFixed(), $tab = 40 * i, $pageslide_w = $w_w - $tab, $href = $url + ' #the_page'; $('body').append($('').attr('class','pageslide').css({ left: 'auto', right: '-' + $w_w + 'px' })); $('.pageslide').attr('id', function(i){ return "layer-" + i; }); var $layerPrev = $('#layer-' + (i - 1)), $layerShow = $('#layer-' + i); $layerShow.css({'z-index' : $z, width : $pageslide_w +'px' }) $('body').data('layerShow',$layerShow); $('body').data('layerPrev',$layerPrev); $('body').data( 'i',i); $layerShow.load( $href, function(){ $layerPrev .css({right:'auto'}) .animate({marginLeft: - $pageslide_w + ((i - 1) * 40)}, 1000); $layerShow .show() .animate({right: 0}, 1000) .prepend($('') .attr({'class':'tab','id':'tab-0','data-urltab':window.location}) .append($('').attr('class','sld_tab'))); $('.tab').attr('id', function(i){ return "tab-" + i; }); $('#slideLoading').css('z-index',0); clearTimeout($int); _init_page($url, $pageslide_w) }); }; function _selectPageSlide(){ var $layerShow = $('body').data('layerShow'), $a = [ '#menu_start a', '.navigationBar a', '.calendarBar a', '.calendarCalBar a', '.navigationButtons a', '#imageHeaderBar a', '.calImg a', '.date_today', '#sortOrderLink', '#sortOrderBox a', '#derivativeSwitchBox a', '#derivativeSwitchLink', '.actionButtons a', '.actions a', '.navThumb', '.calendarTitle a', '#linkToPiwigo a', '#copyright a', '#languageSwitchLink', '#languageSwitchBox a', '#theHeader a', '#myHomePage a', '#mbAdditionalPages a', '#photosAddContent a', '.amm-MenuBar-links-icons a', '.commentsOrder', '#calendarViewSwitchLink', '#calendarViewSwitchBox a', '#ato_header a', '#ato_header_closed a', ], $b = [ '.pwg-icon-letters', '.pwg-icon-cloud', '.pwg-icon-help', '.pwg-icon-calendar', '.pwg-icon-camera-calendar', '.pwg-icon-favorite-del', '.pwg-icon-caddie-add', '.pwg-icon-category-view-flat', '.pwg-icon-category-view-normal', '#thePicturePage .pwg-icon-slideshow', '#thePicturePage .pwg-icon-camera-info', '#thePicturePage .pwg-icon-save', '#thePicturePage .pwg-icon-favorite-add', '#thePicturePage .pwg-icon-representative', '#thePicturePage .pwg-icon-edit', '.pwg-icon-category-edit' ], $c = [ '.description_stuffs .zero nb-comments', '.description_stuffs .nb-hits', '.description_stuffs .nb-comments' ], $d = [ '.pwg-icon-arrow-n' ], $e = [ '#linkToPiwigo a', '#copyright a' ], $f = [ '.navigationButtons a', '.navThumbs a', '.navigationBar a', '#derivativeSwitchBox a', '#sortOrderBox a', '#theMainImage map area a', '#calendarViewSwitchBox a', '.calImg a', ]; $g = [ '.pwg-icon-caddie-add', '.pwg-icon-category-view-normal', '.pwg-icon-calendar', '.pwg-icon-camera-calendar' ]; if($('body').hasClass('withlightbox')) { $a.push('.illustration a'); }; $.each($a, function(i,e) { $(e, $layerShow).addClass('noSlide') }); $.each($b, function(i,e) { $(e, $layerShow).parent().addClass('noSlide') }); $.each($c,function(i,e) { $(e, $layerShow).remove() }); $.each($d,function(i,e) { $(e, $layerShow).parent().remove() }); $.each($e,function(i,e) { $(e, $layerShow).attr('target','blank') }); $.each($f, function(i,e) { $(e, $layerShow).addClass('sameLayer') }); $.each($g, function(i,e) { $(e, $layerShow).parent().addClass('sameLayer') }); $('a:not(.noSlide)', $layerShow).addClass('slide'); $('#layer-0 ').find('.sameLayer').removeClass('sameLayer'); $('.stuffs_block .illustration .description', $layerShow).removeClass('description').addClass('description_stuffs'); $('.titrePage + div', $layerShow).addClass('blockConteneur'); $('.myHomePage_links a[href="index.php?/contact"]', $layerShow).addClass('slide'); }; function _titre_page() { var $layerShow = $('body').data('layerShow'), $titre = $('#content .titrePage h2',$layerShow).first().text(), $titre = $titre.substring($titre.lastIndexOf("/")).replace("/",""); $('#content .titrePage h2',$layerShow).first().replaceWith("