Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Slider.js « utils « src « js - github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2e6bd416e0f8eaf6346debc162a1652ad19d0efe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/**
 * Changes status of slider
 */
function PMA_set_status_label ($element) {
    var text;
    if ($element.css('display') === 'none') {
        text = '+ ';
    } else {
        text = '- ';
    }
    $element.closest('.slide-wrapper').prev().find('span').text(text);
}

/**
 * Initializes slider effect.
 */
export function PMA_init_slider () {
    $('div.pma_auto_slider').each(function () {
        var $this = $(this);
        if ($this.data('slider_init_done')) {
            return;
        }
        var $wrapper = $('<div>', { 'class': 'slide-wrapper' });
        $wrapper.toggle($this.is(':visible'));
        $('<a>', { href: '#' + this.id, 'class': 'ajax' })
            .text($this.attr('title'))
            .prepend($('<span>'))
            .insertBefore($this)
            .on('click', function () {
                var $wrapper = $this.closest('.slide-wrapper');
                var visible = $this.is(':visible');
                if (!visible) {
                    $wrapper.show();
                }
                $this[visible ? 'hide' : 'show']('blind', function () {
                    $wrapper.toggle(!visible);
                    $wrapper.parent().toggleClass('print_ignore', visible);
                    PMA_set_status_label($this);
                });
                return false;
            });
        $this.wrap($wrapper);
        $this.removeAttr('title');
        PMA_set_status_label($this);
        $this.data('slider_init_done', 1);
    });
}