forked from erikdubbelboer/phpRedisAdmin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
103 lines (81 loc) · 2.41 KB
/
index.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
93
94
95
96
97
98
99
100
101
102
$(function() {
$('#sidebar a').click(function(e) {
if (e.currentTarget.href.indexOf('/?') == -1) {
return;
}
e.preventDefault();
var href;
if ((e.currentTarget.href.indexOf('?') == -1) ||
(e.currentTarget.href.indexOf('?') == (e.currentTarget.href.length - 1))) {
href = 'overview.php';
} else {
href = e.currentTarget.href.substr(e.currentTarget.href.indexOf('?') + 1);
if (href.indexOf('&') != -1) {
href = href.replace('&', '.php?');
} else {
href += '.php';
}
}
$('#iframe').attr('src', href);
});
$('#server').change(function(e) {
if (location.href.indexOf('?') == -1) {
location.href = location.href+'?s='+e.target.value;
} else if (location.href.indexOf('&s=') == -1) {
location.href = location.href+'&s='+e.target.value;
} else {
location.href = location.href.replace(/s=[0-9]*/, 's='+e.target.value);
}
});
$('li.current').parents('li.folder').removeClass('collapsed');
$('li.folder').click(function(e) {
var t = $(this);
if ((e.pageY >= t.offset().top) &&
(e.pageY <= t.offset().top + t.children('div').height())) {
e.stopPropagation();
t.toggleClass('collapsed');
}
});
$('a').click(function() {
$('li.current').removeClass('current');
});
$('li a').click(function() {
$(this).parent().addClass('current');
});
$('#filter').focus(function() {
if ($(this).hasClass('info')) {
$(this).removeClass('info').val('');
}
}).keyup(function() {
var val = $(this).val();
$('li:not(.folder)').each(function(i, el) {
var key = $('a', el).get(0);
var key = unescape(key.href.substr(key.href.indexOf('key=') + 4));
if (key.indexOf(val) == -1) {
$(el).addClass('hidden');
} else {
$(el).removeClass('hidden');
}
});
$('li.folder').each(function(i, el) {
if ($('li:not(.hidden, .folder)', el).length == 0) {
$(el).addClass('hidden');
} else {
$(el).removeClass('hidden');
}
});
});
$('.deltree').click(function(e) {
e.preventDefault();
if (confirm('Are you sure you want to delete this whole tree and all it\'s keys?')) {
$.ajax({
type: "POST",
url: this.href,
data: 'post=1',
success: function(url) {
top.location.href = top.location.pathname;
}
});
}
});
});