liuxiaolong
2019-05-09 0d1d88cdb668e75ea8609417ac18ae19947e9525
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
$(function () {
    $('h1').find('a')
        .attr('target', '_blank')
        .addClass('edit-page-link')
        .text('Edit on GitHub');
 
    // languages
    $('[data-language]').each(function (i) {
        var $this = $(this),
            language = $this.data('language');
 
        // default
        if (i === 0) {
            $this.addClass('active');
        }
 
        $this.find('a').attr('href', '/' + (language === 'en' ? '' : language));
        if (location.href.indexOf(language) !== -1) {
            $this.addClass('active').siblings().removeClass('active');
            $('.language').text($(this).text());
        }
    });
 
    // examples
    $('iframe[data-src]').each(function () {
        $(this).wrap('<div class="examples-parent"></div>').parent()
            .append('<button class="examples-button btn btn-primary btn-lg"><i class="glyphicon glyphicon-fire"></i> Start Example</button>');
    });
    $(document).on('click', 'button.examples-button', function () {
        var $iframe = $(this).prev();
        $iframe.attr('src', $iframe.data('src'));
        $(this).remove();
    });
 
    if (location.href.indexOf('documentation') > -1) {
        var query = {
            t: '',
            c: '',
            e: '',
            m: '',
            l: ''
        };
        $.each(location.search.substring(1).split('&'), function (i, t) {
            var arr = t.split('=');
            if (query.hasOwnProperty(arr[0])) {
                query[arr[0]] = arr[1];
            }
        });
        $.each(query, function (id, value) {
            $('#' + id).bootstrapTable({
                searchText: value
            });
        });
    }
});
 
function methodFormatter(value) {
    if (!value) {
        return '';
    }
    var href = 'http://issues.wenzhixin.net.cn/bootstrap-table/#methods/' + value + '.html';
    return '<a target="_blank" href="' + href + '"><i class="glyphicon glyphicon-screenshot"></i></a>';
}