source: extensions/akBookStyle/trunk/js/ak_jquery-load.js

Last change on this file was 10975, checked in by nikrou, 13 years ago

Update to make plugin compatible with piwigo 2.2

File size: 1.8 KB
Line 
1$(function() {
2    next_link = $('table.thumbnails div.navbar a[rel=next]');
3    if (next_link.length!=0) {
4      $('#akNextPicture').css('visibility', 'visible');
5    }
6    previous_link = $('table.thumbnails div.navbar a[rel=previous]');
7    if (previous_link.length!=0) {
8      $('#akPreviousPicture').css('visibility', 'visible');
9    }
10   
11    $("a.load")
12      .bind(ak_mouse_event, function() {
13          $('table.thumbnails tr td.ncol').each(function() {
14              if ($(this).hasClass('selected')) {
15                $(this).removeClass('selected');
16              }
17            });
18
19          $a = $(this);
20          next_thumbnail = $('table.thumbnails a[href="'+$(this).attr('href')+'"]');
21          if (next_thumbnail.length==0) {
22            if ($a.attr('id')=='akNextPicture') {
23              rel = 'next';
24            } else {
25              rel = 'previous';
26            }
27            next_link = $('table.thumbnails div.navbar a[rel='+rel+']');
28            if (next_link.length!=0) {
29              window.location = next_link.attr('href');
30            }
31          } else {
32            next_thumbnail.parent().parent().parent().addClass('selected');
33            $.get($a.attr('href'),{},
34                  function success(data) {
35                    $('#akPicture')
36                      .attr('src', data.AK_PIC_SRC)
37                      .attr('alt', data.AK_PIC_ALT)
38                      .attr('title', data.AK_PIC_TITLE);
39                   
40                    if (data.AK_PREVIOUS) {
41                      $('#akPreviousPicture')
42                        .removeClass('hide')
43                        .attr('href', data.AK_PREVIOUS);
44                    } else {
45                      $('#akPreviousPicture').addClass('hide');
46                    }
47                    if (data.AK_NEXT) {
48                      $('#akNextPicture')
49                        .removeClass('hide')
50                        .attr('href', data.AK_NEXT);
51                    } else {
52                      $('#akNextPicture').addClass('hide');
53                    }
54                    $a.click(function(e) { e.preventDefault();}); 
55                  },
56                  'json');         
57          }
58          return false;
59        });
60  });
Note: See TracBrowser for help on using the repository browser.