OSDN Git Service

63a8ea882c1054b63ac89ed9e9fa8ae1a79d298b
[webchat/WebChat.git] / public / scripts / adminclient.js
1 $(document).ready(function(){
2         SwitchItem("logs_tab");
3         SwitchTab("logs");
4
5         $("#tabs li[name=logs]").click(function(e){
6                 SwitchItem("logs_tab");
7                 SwitchTab("logs");
8         });
9         $("#tabs li[name=banlist]").click(function(e){
10                 SwitchItem("banlist_tab");
11                 SwitchTab("banlist");
12         });
13         $("#tabs li[name=roomlist]").click(function(e){
14                 SwitchItem("roomlist_tab");
15                 SwitchTab("roomlist");
16         });
17 });
18
19 function SwitchTab(name)
20 {
21         $("#tabs ul").children().each(function(){
22                 var item = $(this);
23                 if(item.attr("name") == name)
24                 {
25                         item.removeClass("inactive_tab");
26                         item.addClass("active_tab");
27                 }else{
28                         item.addClass("inactive_tab");
29                         item.removeClass("active_tab");
30                 }
31         });
32 }
33
34 function SwitchItem(id)
35 {
36         $("#items").children().each(function(){
37                 var item = $(this);
38                 if(item.attr("id") == id)
39                 {
40                         item.css("display","block");
41                 }else{
42                         item.css("display","none");
43                 }
44         });
45 }