Changeset 26915 for extensions/Slide
- Timestamp:
- Jan 23, 2014, 10:50:23 AM (11 years ago)
- Location:
- extensions/Slide
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Slide/js/slide.js
r26889 r26915 174 174 // removal/edit comment 175 175 $(document).on('click', '.actions a', function(e){ 176 var e = $(this),177 confi = e.attr('confirm');178 if(e.hasClass('delet')){179 if (confirm( confi)) {180 _rem_ed( e);176 var $a = $(this); 177 if($a.hasClass('delet')){ 178 var $confi = $a.attr('confirm'); 179 if (confirm($confi)) { 180 _rem_ed($a); 181 181 }; 182 182 } 183 if(e.hasClass('annul')){ 184 var href = e.attr('href') + ' #comments'; 185 $('#comments').addClass('unwrap').load(href, function(){ 186 $('.unwrap').children().unwrap(); 187 }); 188 } 189 if(e.hasClass('editComment')){ 190 _rem_ed(e); 191 }; 192 e.preventDefault(); 193 }); 194 183 _rem_ed($a); 184 e.preventDefault(); 185 }); 186 195 187 //Change the order of comments 196 188 $(document).on('click', '.commentsOrder', function(e){ 197 $.ajax({ 198 url : $(this).attr('href'), 199 success : function(html){ 200 _comment_reload(html) 201 } 202 }); 189 var $a = $(this); 190 _rem_ed($a); 203 191 e.preventDefault(); 204 192 }); … … 206 194 //edit profil 207 195 $(document).on('click', '#profile input[name=reset_to_default]', function(e){ 208 var profil = $('#profile'),209 profilhref =profil.attr('action'),210 profilmet =profil.attr('method'),211 profilser =profil.serialize(),212 profilval = $(this).attr('value'),213 profilnam = $(this).attr('name'),214 data = profilser + '&' + profilnam + '=' +profilval;196 var $profil = $('#profile'), 197 $profilhref = $profil.attr('action'), 198 $profilmet = $profil.attr('method'), 199 $profilser = $profil.serialize(), 200 $profilval = $(this).attr('value'), 201 $profilnam = $(this).attr('name'), 202 $data = $profilser + '&' + $profilnam + '=' + $profilval; 215 203 $.ajax({ 216 url : profilhref,217 type : profilmet,218 data : data,204 url : $profilhref, 205 type : $profilmet, 206 data : $data, 219 207 success : function(html) { 220 var content = $(html).find('#profile');221 profil.replaceWith(content)208 var $content = $(html).find('#profile'); 209 $profil.replaceWith($content) 222 210 } 223 211 }); … … 227 215 // search page 228 216 $(document).on('submit', '.theSearchPage .filter', function(e){ 229 var sch= $('.filter'),230 schmet =sch.attr('method'),231 schser =sch.serialize(),232 schhref =sch.attr('action');233 schser =schser+"&submit=Valide";217 var $sch = $('.filter'), 218 $schmet = $sch.attr('method'), 219 $schser = $sch.serialize(), 220 $schhref = $sch.attr('action'); 221 $schser = $schser+"&submit=Valide"; 234 222 $.ajax({ 235 url : schhref,236 type : schmet,237 data : schser,223 url : $schhref, 224 type : $schmet, 225 data : $schser, 238 226 success : function(html){ 239 var e = $(html).find('.errors');240 if( e.length){241 var inf = e.text()242 _message( inf);227 var $e = $(html).find('.errors'); 228 if($e.leng$th){ 229 var $inf = $e.text(); 230 _message($inf); 243 231 } else { 244 232 var $href = $(html).find('.titrePage h2 a:nth-child(2)').attr('href'), … … 257 245 //comment page 258 246 $(document).on('submit', '.theCommentsPage .filter', function(e){ 259 var com= $('.filter'),260 commet =com.attr('method'),261 comser =com.serialize(),262 comhref =com.attr('action');247 var $com = $('.filter'), 248 $commet = $com.attr('method'), 249 $comser = $com.serialize(), 250 $comhref = $com.attr('action'); 263 251 $.ajax({ 264 url : comhref,265 type : commet,266 data : comser,252 url : $comhref, 253 type : $commet, 254 data : $comser, 267 255 success : function(html){ 268 256 var $layerShow = $('body').data('layerShow'), … … 544 532 function _load_slideshow($href,$slideW) { 545 533 $('#slideshow').empty().addClass('slideloader'); 546 $.getScript('themes/Slide/js/slideshow.js'); 534 if (!$('#slideshow').hasClass('slideshowReady')) { 535 $.getScript('themes/Slide/js/slideshow.js', function(){ 536 $('#slideshow').addClass('slideshowReady'); 537 }); 538 }; 539 547 540 $.ajax({ 548 541 url : $href, … … 572 565 }; 573 566 567 function _stock_img($href,$title){ 568 var $img = {src : $href , title : $title , descr : $title}; 569 $slideshow.push($img); 570 }; 571 574 572 function _tabs_dragbar() { 575 573 var $layerShow = $('body').data('layerShow'); … … 588 586 }; 589 587 590 function _stock_img($href,$title){591 var $img = {image : $href , title : $title , descr : $title};592 $slideshow.push($img);593 };594 595 588 function _close($tabClick) { 596 589 var $layerBack = $tabClick.parent(), … … 646 639 647 640 function _rem_ed(e) { 648 var c = e.attr('class'), 649 href = e.attr('href'); 641 var $href = e.attr('href'); 650 642 $.ajax({ 651 url : href,643 url : $href, 652 644 success : function(html){ 653 645 _comment_reload(html) … … 699 691 var $com = $(html).find('#comments'), 700 692 $layerShow = $('body').data('layerShow'); 701 console.log($com);702 693 $('#comments', $layerShow).replaceWith($com); 703 694 }; -
extensions/Slide/js/slideshow.js
r26889 r26915 53 53 54 54 $(ele).data('e',v_ele); 55 $(ele).width(options.width).height(options.height).addClass(options.styleSlideshow + ' slideshow').append($('<div />').addClass('slidecontent').append($('<div />').addClass('contener_slideshow').append($('<ul />'))).append($('<div/>').addClass('control_slideshow'))); 56 57 58 59 /* $(window).load(function(){ 60 $(ele).removeClass('slideloader'); 61 $('.slidecontent', ele).animate({ 62 opacity: 1 63 },400); 64 });*/ 65 55 $(ele).width(options.width).height(options.height).addClass(options.styleSlideshow + ' slideshow').append($('<div />').addClass('slidecontent').append($('<div />').addClass('contener_slideshow').append($('<ul />').height(cont_h))).append($('<div/>').addClass('control_slideshow'))); 56 57 66 58 //mise en place des images 67 59 $(document).ready(function(){ 68 60 $.each(options.imgs, function(i, img){ 69 var imag = img. image,61 var imag = img.src, 70 62 alt = img.alt, 71 63 title = img.title, … … 73 65 descr = img.descr; 74 66 75 if(typeof descr === 'undefined'){ 76 var divDescr = "" 67 if(typeof descr === 'undefined'){ 68 var divDescr = "" 69 }else{ 70 var divDescr =[$('<div />').addClass('descr').html(descr)] 71 }; 72 73 if(typeof url === 'undefined'){ 74 var blockImg = [$('<div />').append(divDescr).append($('<img />').attr({'src':imag , 'alt':alt , 'title':title }))] 75 }else{ 76 var blockImg = [$('<a />').attr({'href':url , 'target':options.target}).append(divDescr).append($('<img />').attr({'src':imag , 'alt':alt , 'title':title }))] 77 } 78 79 $('ul',ele).append($('<li />').addClass('img-' + i).append($('<div />').addClass('contenerImg').width(options.width).height(cont_h).append(blockImg))); 80 81 82 }); 83 84 _resizeSlideshowImag() ; 85 86 //resize and center image_____________________________________________________________________________________________________ 87 88 function _resizeSlideshowImag (){ 89 var e = $('ul',ele); 90 91 e.each(function(){ 92 93 var $img = e.find('img'), 94 $descr = e.find('.descr'), 95 $img_w = $img.width(), 96 $img_h = $img.height(), 97 $img_r = $img_h/$img_w, 98 $box_h = cont_h, 99 $box_w = options.width, 100 $box_r = $box_h/$box_w, 101 $new_h, 102 $new_w; 103 104 105 if(($img_h > $box_h) || ($img_w > $box_w)){ 106 if($box_r < $img_r){ 107 $new_h = $box_h - 30; 108 $new_w = $box_h / $img_r 109 }else{ 110 $new_h = ($box_w * $img_r) - 30; 111 $new_w = $box_w 112 }; 113 77 114 }else{ 78 var divDescr =[$('<div />').addClass('descr').html(descr)] 79 }; 80 81 if(typeof url === 'undefined'){ 82 var blockImg = [$('<div />').append(divDescr).append($('<img />').attr({'src':imag , 'alt':alt , 'title':title }))] 83 }else{ 84 var blockImg =[$('<a />').attr({'href':url , 'target':options.target}).append(divDescr).append($('<img />').attr({'src':imag , 'alt':alt , 'title':title }))] 85 } 86 87 $('ul',ele).height(cont_h); 88 $('ul',ele).append($('<li />').addClass('img-' + i).append($('<div />').addClass('contenerImg').width(options.width).height(cont_h).append(blockImg))) 115 $new_h = $img_h; 116 $new_w = $img_w; 117 }; 118 var $left = ($(ele).data('e').s_w / 2)-($new_w / 2) + 'px', 119 $top = ($box_h / 2)-($new_h / 2) + 'px'; 120 121 $img.css({ 122 width : $new_w + 'px', 123 height : $new_h + 'px', 124 left : $left, 125 top : $top, 126 }); 127 $descr.css( 128 { 129 left : $left, 130 width : $new_w + 'px', 131 height : $new_h/4, 132 bottom : (($box_h / 2)-($new_h / 2)) + 'px', 133 }) 89 134 }) 90 91 //resize and center image_____________________________________________________________________________________________________ 92 $('.contenerImg',ele).each(function(){ 93 var img = $(this).find('img'), 94 img_w = $(this).find('img').width(), 95 img_h = $(this).find('img').height(), 96 img_r = img_h/img_w, 97 box_h = $(this).height(), 98 box_w = $(this).width(), 99 box_r = box_h/box_w, 100 new_h, 101 new_w; 102 103 if((img_h > box_h) || (img_w > box_w)){ 104 if(box_r < img_r){ 105 new_h = box_h - 30; 106 new_w = box_h / img_r 107 }else{ 108 new_h = (box_w * img_r) - 30; 109 new_w = box_w 110 }; 111 img.css({ 112 width : new_w + 'px', 113 height : new_h + 'px' 114 }) 115 }else{ 116 new_h = img_h; 117 new_w = img_w; 118 }; 119 var left = ($(ele).data('e').s_w / 2)-(new_w / 2) + 'px', 120 top = (box_h / 2)-(new_h / 2) + 'px', 121 descr = $(this).find('.descr'); 122 img.css({ 123 left : left, 124 top : top, 125 }); 126 descr.css( 127 { 128 left : left, 129 width : new_w + 'px', 130 height : new_h/4, 131 bottom : ((box_h / 2)-(new_h / 2)) + 'px', 132 }) 133 }); 134 135 }; 135 136 //slide_____________________________________________________________________________________________ 136 137 if(options.styleSlideshow == 'Slide'){ … … 149 150 150 151 //bouton play/pause________________________________________________________________________________________________________________________ 151 if(options.displayPlayPause == true){152 $('.control_slideshow', ele).append($('<div />').addClass('slideshow_control'))153 };152 if(options.displayPlayPause == true){ 153 $('.control_slideshow', ele).append($('<div />').addClass('slideshow_control')) 154 }; 154 155 155 156 //auto démarage____________________________________________________________________________________________________________ … … 187 188 $('.clt_thumb', ele).hide() 188 189 }; 189 var resize_thumb_w = ((options.width-(n_thumb * 6))/n_thumb),190 var resize_thumb_w = ((options.width-(n_thumb * 5))/n_thumb), 190 191 r = options.thumb_width/options.thumb_height, 191 192 rezise_thumb_h = resize_thumb_w / r, … … 195 196 $('.link', ele).append($('<div />').addClass('nav-thumb-content').height(rezise_thumb_h + 10).width(navThumb_w)); 196 197 $.each(options.imgs, function(i, img){ 197 var imag = img. image;198 var imag = img.src; 198 199 $('.nav-thumb-content', ele).append($('<span />').addClass('slideshow-' + i + ' nav-link slideshow-thumb').attr('imag', i).width(resize_thumb_w).height(rezise_thumb_h).append($('<img />').attr({'class':'thumb','src':imag}))); 199 200 }); … … 271 272 }); 272 273 273 //mouse over _______________________________________________________________________________________________________________________________________________274 $('.contener_slideshow', ele). hover(function() {275 $(ele).data('e').playOnT = $(ele).data('e').playOn;274 //mouse over image_______________________________________________________________________________________________________________________________________________ 275 $('.contener_slideshow', ele).find('img').hover(function() { 276 $(ele).data('e').playOnT = $(ele).data('e').playOn; 276 277 if($(ele).data('e').playOn == true){ 277 278 $(ele).data('e').playOn = false; 278 279 _pause(ele); 279 280 } 280 $(this). find('.descr').slideDown(200, function() {281 $(this).parent().find('.descr').slideDown(200, function() { 281 282 $(this).clearQueue(); 282 283 }); 283 284 }, function() { 284 if ($(ele).data('e').playOnT == true){ 285 $(ele).data('e').playOn = true; 286 _start(ele) 287 } 288 $(this).find('.descr').slideUp(200, function() { 289 $(this).clearQueue(); 290 }); 291 }); 285 if ($(ele).data('e').playOnT == true){ 286 $(ele).data('e').playOn = true; 287 _start(ele) 288 } 289 $(this).parent().find('.descr').slideUp(200, function() { 290 $(this).clearQueue(); 291 }); 292 }); 293 294 //mouse over nav 295 $('.nav', ele).hover(function() { 296 $(ele).data('e').playOnT = $(ele).data('e').playOn; 297 if($(ele).data('e').playOn == true){ 298 $(ele).data('e').playOn = false; 299 _pause(ele); 300 } 301 302 }, function() { 303 if ($(ele).data('e').playOnT == true){ 304 $(ele).data('e').playOn = true; 305 _start(ele) 306 } 307 }); 308 309 292 310 //nav thumb________________________________________________________________________________________________________________________________________________ 293 311 $('.thumb-right',ele).on('mousedown',function(){ … … 372 390 }; 373 391 374 392 375 393 //stop animation______________________________________________________________________________________________________________________________ 376 394 function _pause(ele) { … … 406 424 function _thumbSlide(ele) { 407 425 if(options.navType == 'thumb'){ 408 var a = ($(ele).data('e').i_img)/$(ele).data('e').n_thumb; 426 var a = ($(ele).data('e').i_img)/$(ele).data('e').n_thumb, 427 thumbcontent = $('.nav-thumb-content', ele); 409 428 if(a < 0){ 410 429 a = 0 … … 412 431 $(ele).data('e').thumb_i = Math.floor(a); 413 432 var m_r = ( $(ele).data('e').thumb_i)* $(ele).data('e').s_w; 414 if ( m_r > $('.nav-thumb-content', ele).width() - $('.nav-thumb-slide', ele).width()){ 415 m_r = $('.nav-thumb-content', ele).width() - $('.nav-thumb-slide', ele).width(); 416 }; 417 var n_p = $('.nav-thumb-content', ele).position(); 418 if ( n_p.left != m_r){ 419 $('.nav-thumb-content', ele).animate({ 420 left : - m_r 421 }) 422 } 433 if ( m_r > thumbcontent.width() - $('.nav-thumb-slide', ele).width()){ 434 m_r = thumbcontent.width() - $('.nav-thumb-slide', ele).width(); 435 }; 436 var n_p = thumbcontent.position(); 437 if($('.link:hover', ele).length == 0){ 438 if ( n_p.left != m_r ){ 439 $('.nav-thumb-content', ele).animate({ 440 left : - m_r 441 }) 442 }; 443 }; 423 444 } 424 445 }; -
extensions/Slide/theme.css
r26894 r26915 905 905 cursor: pointer; 906 906 position: absolute; 907 width: 20%;907 width: 10%; 908 908 top: 0; 909 909 min-width: 30px
Note: See TracChangeset
for help on using the changeset viewer.