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

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

Revert "really compatible 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            try {
34              $.get($a.attr('href'),{},
35                    function success(data) {               
36                      $('#akPicture')
37                        .attr('src', data.AK_PIC_SRC)
38                        .attr('alt', data.AK_PIC_ALT)
39                        .attr('title', data.AK_PIC_TITLE);
40
41                      if (data.AK_PREVIOUS) {
42                        $('#akPreviousPicture')
43                          .removeClass('hide')
44                          .attr('href', data.AK_PREVIOUS);
45                      } else {
46                        $('#akPreviousPicture').addClass('hide');
47                      }
48                      if (data.AK_NEXT) {
49                        $('#akNextPicture')
50                          .removeClass('hide')
51                          .attr('href', data.AK_NEXT);
52                      } else {
53                        $('#akNextPicture').addClass('hide');
54                      }
55                      $a.click(function(e) { e.preventDefault();}); 
56                    },
57                    'json');       
58            } catch (e) {}
59          }
60          return false;
61        });
62  });
Note: See TracBrowser for help on using the repository browser.