1
1
/**
2
2
Rule the words! KKuTu Online
3
3
Copyright (C) 2017 JJoriping([email protected] )
4
- Copyright (C) 2017 KKuTu Korea(op @kkutu.co.kr)
4
+ Copyright (C) 2017-2018 KKuTu Korea(admin @kkutu.co.kr)
5
5
6
6
This program is free software: you can redistribute it and/or modify
7
7
it under the terms of the GNU General Public License as published by
@@ -22,66 +22,55 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
22
22
var LIST ;
23
23
var isHoverButton = false ;
24
24
function buttonOverAnimate ( ) {
25
- var width = 3068 ;
26
- var original = 236 ;
25
+ var width = 5200 ;
26
+ var original = 260 ;
27
27
var times = width / original ;
28
28
var originalTimes = times ;
29
29
var times_ = 0.1 / times ;
30
30
function change ( ) {
31
31
$ ( "#game-start" ) . css ( "background-position-x" , original * times + "px" ) ;
32
- $ ( "#game-start" ) . css ( "transform" , "scale(" + ( 1 + times_ * ( originalTimes - times ) ) + ")" ) ;
32
+ // $("#game-start").css("transform","scale("+(1+times_*(originalTimes-times))+")");
33
33
times -- ;
34
- if ( times > - 1 && isHoverButton ) setTimeout ( function ( ) { change ( ) ; } , 30 ) ;
34
+ if ( times > - 1 && isHoverButton ) setTimeout ( function ( ) { change ( ) ; } , 1000 / originalTimes ) ;
35
35
else if ( ! isHoverButton ) {
36
- $ ( "#game-start" ) . css ( "background-position-x" , "3068px" ) ;
37
- $ ( "#game-start" ) . css ( "transform" , "scale(1)" ) ;
36
+ $ ( "#game-start" ) . css ( "background-position-x" , width ) ;
37
+ // $("#game-start").css("transform","scale(1)");
38
38
}
39
39
}
40
40
change ( ) ;
41
41
}
42
- function buttonOverAnimate2 ( context ) {
42
+ function buttonOverAnimate2 ( $a ) {
43
43
var times = 10 ;
44
44
var times_ = 0.1 / 10 ;
45
45
function change ( ) {
46
- $ ( context ) . css ( "transform" , "scale(" + ( 1 + times_ * ( 10 - times ) ) + ")" ) ;
46
+ $a . css ( "transform" , "scale(" + ( 1 + times_ * ( 10 - times ) ) + ")" ) ;
47
47
times -- ;
48
- if ( times > - 1 && $ ( context ) . hasClass ( 'hover' ) ) setTimeout ( function ( ) { change ( ) ; } , 30 ) ;
49
- else if ( ! $ ( context ) . hasClass ( 'hover' ) ) {
50
- $ ( context ) . css ( "transform" , "scale(1)" ) ;
48
+ if ( times > - 1 && $a . hasClass ( 'hover' ) ) setTimeout ( function ( ) { change ( ) ; } , 30 ) ;
49
+ else if ( ! $a . hasClass ( 'hover' ) ) {
50
+ $a . css ( "transform" , "scale(1)" ) ;
51
51
}
52
52
}
53
53
change ( ) ;
54
54
}
55
-
55
+
56
56
$ ( document ) . ready ( function ( ) {
57
-
57
+
58
58
var GAMEBG = "/img/kkutu/gamebg_korea.png" ;
59
59
$ ( "#Background" ) . attr ( 'src' , "" ) . addClass ( "jt-image" ) . css ( {
60
60
'background-image' : "url(" + GAMEBG + ")" ,
61
61
'background-size' : "200px 200px"
62
62
} ) ;
63
- $ ( ".server-item" ) . each ( function ( index , item ) {
64
- $ ( item ) . mouseover ( function ( ) {
65
- $ ( this ) . addClass ( 'hover' ) ;
66
- buttonOverAnimate2 ( this ) ;
67
- } ) ;
68
- $ ( item ) . mouseout ( function ( ) {
69
- $ ( this ) . removeClass ( 'hover' ) ;
70
- $ ( this ) . css ( "transform" , "scale(1)" ) ;
71
- } ) ;
72
- } ) ;
73
63
$ ( "#game-start" ) . mouseover ( function ( ) {
74
64
isHoverButton = true ;
75
65
buttonOverAnimate ( ) ;
76
66
} ) ;
77
67
$ ( "#game-start" ) . mouseout ( function ( ) {
78
68
isHoverButton = false ;
79
- $ ( "#game-start" ) . css ( "background-position-x" , "3068px" ) ;
80
- $ ( "#game-start" ) . css ( "transform" , "scale(1)" ) ;
69
+ $ ( "#game-start" ) . css ( "background-position-x" , "5200px" ) ;
81
70
} ) ;
82
71
$ ( "#game-start" ) . click ( function ( e ) {
83
72
var i , j ;
84
-
73
+
85
74
for ( i = 0.9 ; i < 1 ; i += 0.01 ) {
86
75
for ( var j = 0 ; j < LIST . length ; j ++ ) {
87
76
if ( LIST [ j ] < i * LIMIT ) {
@@ -92,91 +81,103 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
92
81
}
93
82
alert ( "접속 가능한 서버가 없습니다! 혹시 로그인을 안하셨다면, 로그인을 하신 후 시도해주세요!" ) ;
94
83
} ) ;
95
- $ ( "#server-refresh" ) . click ( function ( e ) {
84
+ $ ( ".server-item" ) . each ( function ( ) {
85
+ $ ( this ) . mouseover ( function ( ) {
86
+ $ ( this ) . find ( ".server-head" ) . addClass ( 'hover' ) ;
87
+ buttonOverAnimate2 ( $ ( this ) . find ( ".server-head" ) ) ;
88
+ } ) ;
89
+ $ ( this ) . mouseout ( function ( ) {
90
+ $ ( this ) . find ( ".server-head" ) . removeClass ( 'hover' ) ;
91
+ $ ( this ) . find ( ".server-head" ) . css ( "transform" , "scale(1)" ) ;
92
+ } ) ;
93
+ } ) ;
94
+ $ ( "#kkuko-status-refresh" ) . click ( function ( e ) {
96
95
seekServers ( ) ;
97
96
} ) ;
98
97
setInterval ( function ( ) {
99
- $ ( "#server-refresh" ) . click ( ) ;
98
+ seekServers ( ) ;
100
99
} , 60000 ) ;
101
100
seekServers ( ) ;
102
- setCenterImage ( ) ;
101
+ setslideImage ( ) ;
103
102
} ) ;
104
103
var currentImageNum = 0 ;
105
- function changeCenterImage ( num ) {
104
+ function changeslideImage ( num ) {
106
105
isInterval = num == undefined ;
107
106
num = num || currentImageNum ;
108
- $ ( $ ( ".centerImage" ) [ num - 1 < 0 ?$ ( ".centerImage" ) . length - 1 :num - 1 ] ) . animate ( { opacity : "0" } ) ;
109
- $ ( $ ( ".centerImage" ) [ num ] ) . animate ( { opacity : "1" } ) ;
110
- if ( $ ( $ ( ".centerImage" ) [ num ] ) . attr ( "url" ) )
111
- $ ( ".centerImage" ) . css ( "cursor" , "pointer" ) ;
107
+ for ( var i = 0 ; i < $ ( ".slideImage" ) . length ; i ++ )
108
+ if ( num != i ) $ ( $ ( ".slideImage" ) [ i ] ) . animate ( { opacity : "0" } ) ;
109
+ var $this = $ ( $ ( ".slideImage" ) [ num ] ) ;
110
+ $this . animate ( { opacity : "1" } ) ;
111
+ if ( $this . attr ( "url" ) )
112
+ $ ( ".slideImage" ) . css ( "cursor" , "pointer" ) ;
112
113
else
113
- $ ( ".centerImage" ) . css ( "cursor" , "" ) ;
114
- $ ( ".centerPanel" ) . unbind ( ) ;
115
- $ ( ".centerPanel" ) . click ( function ( ) {
116
- if ( $ ( $ ( ".centerImage" ) [ num ] ) . attr ( "url" ) ) {
117
- window . open ( $ ( $ ( ".centerImage" ) [ num ] ) . attr ( "url" ) ) ;
118
- }
119
- } ) ;
114
+ $ ( ".slideImage" ) . css ( "cursor" , "" ) ;
115
+ $this . unbind ( ) ;
116
+ if ( $this . attr ( "url" ) )
117
+ $this . click ( function ( ) {
118
+ window . open ( $this . attr ( "url" ) ) ;
119
+ } ) ;
120
120
currentImageNum ++ ;
121
- if ( currentImageNum >= $ ( ".centerImage " ) . length ) currentImageNum = 0 ;
122
- if ( isInterval ) setTimeout ( changeCenterImage , 5000 ) ;
121
+ if ( currentImageNum >= $ ( ".slideImage " ) . length ) currentImageNum = 0 ;
122
+ if ( isInterval ) setTimeout ( changeslideImage , 4000 ) ;
123
123
}
124
- function setCenterImage ( ) {
125
- $ ( ".centerImage " ) . each ( function ( index , item ) {
124
+ function setslideImage ( ) {
125
+ $ ( ".slideImage " ) . each ( function ( index , item ) {
126
126
if ( index == 0 ) $ ( item ) . css ( "opacity" , "1" ) ;
127
127
else $ ( item ) . css ( "opacity" , "0" ) ;
128
- $ ( item ) . css ( "top" , "-" + index * 350 + "px" ) ;
129
- $ ( ".centerImage -List" ) . append ( $ ( "<div>" ) . addClass ( "centerImage -Item" ) . attr ( "image-number" , index ) . click ( function ( ) {
130
- changeCenterImage ( $ ( this ) . attr ( "image-number" ) ) ;
128
+ $ ( item ) . css ( "top" , "-" + index * 270 + "px" ) ;
129
+ $ ( ".slideImage -List" ) . append ( $ ( "<div>" ) . addClass ( "slideImage -Item" ) . attr ( "image-number" , index ) . click ( function ( ) {
130
+ changeslideImage ( $ ( this ) . attr ( "image-number" ) ) ;
131
131
} ) ) ;
132
132
} ) ;
133
- $ ( ".centerImage -List" ) . css ( "top" , "-" + ( ( ( $ ( ".centerImage " ) . length - 1 ) * 350 ) + 25 ) + "px" ) ;
134
- changeCenterImage ( ) ;
133
+ $ ( ".slideImage -List" ) . css ( "top" , "-" + ( ( ( $ ( ".slideImage " ) . length - 1 ) * 270 ) + 25 ) + "px" ) ;
134
+ changeslideImage ( ) ;
135
135
}
136
136
function seekServers ( ) {
137
137
$ . get ( "/servers" , function ( data ) {
138
138
var sum = 0 ;
139
-
139
+
140
140
LIST = data . list ;
141
141
LIMIT = data . max ;
142
142
data . list . forEach ( function ( v , i ) {
143
143
var status = ( v === null ) ? "x" : "o" ;
144
- var people = ( status == "x" ) ? "- " : ( v + " / " + LIMIT ) ;
144
+ var people = ( status == "x" ) ? "" : ( v + "/ " + LIMIT ) ;
145
145
var limp = v / LIMIT * 100 ;
146
146
var $e ;
147
-
147
+
148
148
sum += v || 0 ;
149
149
var statusText ;
150
150
if ( status == "o" ) {
151
- statusText = "원활" ;
152
- if ( limp >= 99 ) {
153
- status = "q " ;
151
+ statusText = "매우 원활" ;
152
+ if ( limp >= 75 ) {
153
+ status = "r " ;
154
154
statusText = "혼잡" ;
155
155
}
156
- else if ( limp >= 90 ) {
157
- status = "p " ;
156
+ else if ( limp >= 40 ) {
157
+ status = "q " ;
158
158
statusText = "보통" ;
159
159
}
160
+ else if ( limp >= 15 ) {
161
+ status = "p" ;
162
+ statusText = "원활" ;
163
+ }
160
164
} else if ( status == "x" )
161
- statusText = "X " ;
165
+ statusText = "서버닫힘 " ;
162
166
$ ( $ ( ".server-item" ) [ i ] ) . empty ( ) ;
163
167
$ ( $ ( ".server-item" ) [ i ] ) . attr ( 'id' , "server-" + i )
164
- . append ( $ ( "<div>" ) . addClass ( "server-name" ) . html ( L [ 'server_' + i ] ) )
165
- . append ( $ ( "<div>" ) . addClass ( "server-enter" ) . html ( L [ 'serverEnter' ] ) )
166
- . append ( $ ( "<div>" ) . addClass ( "server-status" )
167
- . append ( $ ( "<div>" ) . addClass ( "server-status-circle ss-" + status ) )
168
- . append ( $ ( "<label>" ) . addClass ( "server-status-text" ) . html ( statusText ) )
169
- . append ( $ ( "<label>" ) . addClass ( "server-status-players" ) . html ( people ) ) )
170
- . append (
171
- $ ( "<div>" ) . addClass ( "server-people graph" )
172
- . append ( $ ( "<div>" ) . addClass ( "graph-bar" ) . width ( limp + "%" ) )
173
- ) ;
168
+ . append ( $ ( "<div>" ) . addClass ( "server-status-bar ssb-" + status ) )
169
+ . append ( $ ( "<div>" ) . addClass ( "server-head" )
170
+ . append ( $ ( "<div>" ) . addClass ( "server-name" ) . html ( L [ 'server_' + i ] ) )
171
+ . append ( $ ( "<div>" ) . addClass ( "server-enter" ) . html ( L [ 'serverEnter' ] ) ) )
172
+ . append ( $ ( "<div>" ) . addClass ( "server-status sss-" + status )
173
+ . append ( $ ( "<label>" ) . addClass ( "server-status-players" ) . html ( people ) )
174
+ . append ( $ ( "<label>" ) . addClass ( "server-status-text" ) . html ( statusText ) ) ) ;
174
175
if ( status != "x" ) $ ( $ ( ".server-item" ) [ i ] ) . click ( function ( e ) {
175
176
location . href = "/?server=" + i ;
176
- } ) ; else $ ( $ ( ".server-item" ) [ i ] ) . children ( ".server-enter" ) . html ( "접속불가" ) ;
177
- $ ( "#server- players" ) . html ( "총 " + sum + "명 접속 " ) ;
177
+ } ) ;
178
+ $ ( "#kkuko-status- players" ) . html ( "▼ 총 " + sum + "명이 접속하고 있습니다. " ) ;
178
179
} ) ;
179
-
180
+
180
181
} ) ;
181
182
}
182
- } ) ( ) ;
183
+ } ) ( ) ;
0 commit comments