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

Last change on this file since 10853 was 10853, checked in by flop25, 13 years ago

really compatible 2.2

File size: 2.1 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    $("a.load").bind(ak_mouse_event, function () {
11        $('table.thumbnails tr td.ncol').each(function () {
12            if ($(this).hasClass('selected')) {
13                $(this).removeClass('selected')
14            }
15        });
16        $a = $(this);
17        //next_thumbnail = $('table.thumbnails a[href=' + $(this).attr('href') + ']');
18        next_thumbnail = $('table.thumbnails a');
19        if (next_thumbnail.length == 0) {
20            if ($a.attr('id') == 'akNextPicture') {
21                rel = 'next'
22            } else {
23                rel = 'previous'
24            }
25            next_link = $('table.thumbnails div.navbar a[rel=' + rel + ']');
26            if (next_link.length != 0) {
27                window.location = next_link.attr('href')
28            }
29        } else {
30            next_thumbnail.parent().parent().parent().addClass('selected');
31            try {
32                $.get($a.attr('href'), {}, function success(data) {
33                                                                                        $('#akPicture').attr('src', data.AK_PIC_SRC).attr('alt', data.AK_PIC_ALT).attr('title', data.AK_PIC_TITLE);
34                                                                                        $('.ak_pic a').attr('href', data.AK_PIC_URL);
35                    if (data.AK_PREVIOUS) {
36                        $('#akPreviousPicture').removeClass('hide').attr('href', data.AK_PREVIOUS)
37                    } else {
38                        $('#akPreviousPicture').addClass('hide')
39                    }
40                    if (data.AK_NEXT) {
41                        $('#akNextPicture').removeClass('hide').attr('href', data.AK_NEXT)
42                    } else {
43                        $('#akNextPicture').addClass('hide')
44                    }
45                    $a.click(function (e) {
46                        e.preventDefault()
47                    })
48                }, 'json')
49            } catch (e) {}
50        }
51        return false
52    })
53});
Note: See TracBrowser for help on using the repository browser.