-
Notifications
You must be signed in to change notification settings - Fork 0
/
layout.js
92 lines (77 loc) · 2.44 KB
/
layout.js
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
function gimmick_search(gimmick) {
search = new RegExp(gimmick, "i");
$('.wrestler-rank-item').each(function() {
if($(this).data('gimmicks').search(search) != -1) {
$(this).removeClass('gimmick-filter-hide')
} else {
$(this).addClass('gimmick-filter-hide')
}
})
rank_page();
}
function rank_page(page) {
i = 1
if(! page) {
page = 1
}
under = ( page - 1 ) * items_per_page
over = page * items_per_page
rank_page_nr = page;
$('a.wrestler-rank-item').each(function() {
$(this).removeClass('limit-filter-hide');
is_visible = ($(this).css('display') == 'none') ? false : true;
if(is_visible) {
if(i <= under || i > over) {
$(this).addClass('limit-filter-hide');
}
i = i + 1
}
});
$('#rank-pagination a').each(function() {
li = $(this).parent();
pager_nr = $(this).data('page')
li.removeClass('active');
li.removeClass('disabled');
if(pager_nr == page) {
li.addClass('active');
} else if(items_per_page * pager_nr > i) {
li.addClass('disabled');
}
});
}
function rank_previous_page() {
if(rank_page_nr <= 1)
return false;
return rank_page(rank_page_nr - 1);
}
function rank_next_page() {
return rank_page(rank_page_nr + 1);
}
$('#wrestler-filter').keyup(function() {
clearTimeout(gimmick_search_scheduler);
gimmick = $(this).val();
gimmick_search_scheduler = setTimeout(function() {gimmick_search(gimmick)}, 250);
})
$('a.promotion-filter').click(function(){
$('a.promotion-filter').each(function() {$(this).removeClass('active')});
$(this).addClass('active');
$('#promotion-filter .txt').html($(this).html());
promotion = $(this).data('promotion')
$('nav.rank a').each(function() {
if(promotion === undefined) {
$(this).removeClass('promotion-filter-hide');
} else if($(this).data('promotion') == promotion) {
$(this).removeClass('promotion-filter-hide');
} else {
$(this).addClass('promotion-filter-hide');
}
})
rank_page();
})
$(document).ready(function() {
var user_lang = navigator.language || navigator.userLanguage;
if(user_lang.split('-')[0] != 'ja') {
$('html').attr('lang', 'en');
$('input[name=lang][id=en]').click();
}
});