|
1 | 1 | ;(function(window) {
|
2 |
| - /** |
3 |
| - * Add parameter to url search |
4 |
| - * for switch users groups |
5 |
| - * |
6 |
| - * Possible options: |
7 |
| - * https://examples.com?users=prod |
8 |
| - * https://examples.com?users=dev |
9 |
| - * https://examples.com - for qa by default |
10 |
| - */ |
11 |
| - var usersQuery = _getQueryVar('users'); |
| 2 | + /** |
| 3 | + * Add parameter to url search |
| 4 | + * for switch users groups |
| 5 | + * |
| 6 | + * Possible options: |
| 7 | + * https://examples.com?users=prod |
| 8 | + * https://examples.com?users=dev |
| 9 | + * https://examples.com - for qa by default |
| 10 | + */ |
| 11 | + var usersQuery = _getQueryVar('users'); |
12 | 12 |
|
13 |
| - var CONFIG = { |
14 |
| - debug: true, |
15 |
| - webrtc: { |
16 |
| - answerTimeInterval: 30, |
17 |
| - dialingTimeInterval: 5, |
18 |
| - disconnectTimeInterval: 30, |
19 |
| - statsReportTimeInterval: 5 |
20 |
| - } |
21 |
| - }; |
| 13 | + var CONFIG = { |
| 14 | + debug: true, |
| 15 | + webrtc: { |
| 16 | + answerTimeInterval: 30, |
| 17 | + dialingTimeInterval: 5, |
| 18 | + disconnectTimeInterval: 30, |
| 19 | + statsReportTimeInterval: 5 |
| 20 | + } |
| 21 | + }; |
22 | 22 |
|
23 | 23 | /**
|
24 | 24 | * QBAppDefault for qa and dev
|
25 | 25 | * QBAppProd for production
|
26 | 26 | */
|
27 |
| - var QBAppProd = { |
28 |
| - appId: 92, |
29 |
| - authKey: 'wJHdOcQSxXQGWx5', |
30 |
| - authSecret: 'BTFsj7Rtt27DAmT' |
31 |
| - }, |
32 |
| - QBAppDefault = { |
33 |
| - appId: 28287, |
34 |
| - authKey: 'XydaWcf8OO9xhGT', |
35 |
| - authSecret: 'JZfqTspCvELAmnW' |
36 |
| - }; |
| 27 | + var QBAppProd = { |
| 28 | + appId: 92, |
| 29 | + authKey: 'wJHdOcQSxXQGWx5', |
| 30 | + authSecret: 'BTFsj7Rtt27DAmT' |
| 31 | + }, |
| 32 | + QBAppDefault = { |
| 33 | + appId: 28287, |
| 34 | + authKey: 'XydaWcf8OO9xhGT', |
| 35 | + authSecret: 'JZfqTspCvELAmnW' |
| 36 | + }; |
37 | 37 |
|
38 |
| - /** set QBApp */ |
39 |
| - var QBApp = usersQuery === 'prod' ? QBAppProd : QBAppDefault; |
| 38 | + /** set QBApp */ |
| 39 | + var QBApp = usersQuery === 'prod' ? QBAppProd : QBAppDefault; |
40 | 40 |
|
41 | 41 | var QBUsersQA = [
|
42 | 42 | {
|
|
185 | 185 | }
|
186 | 186 | ];
|
187 | 187 |
|
188 |
| - /** set QBUsers */ |
189 |
| - var QBUsers = usersQuery === 'prod' ? QBUsersProd : usersQuery === 'dev' ? QBUsersDev : QBUsersQA; |
| 188 | + /** set QBUsers */ |
| 189 | + var QBUsers = usersQuery === 'prod' ? QBUsersProd : usersQuery === 'dev' ? QBUsersDev : QBUsersQA; |
190 | 190 |
|
191 |
| - var MESSAGES = { |
192 |
| - 'login': 'Login as any user on this computer and another user on another computer.', |
193 |
| - 'create_session': 'Creating a session...', |
194 |
| - 'connect': 'Connecting...', |
195 |
| - 'connect_error': 'Something wrong with connect to chat. Check internet connection or user info and trying again.', |
196 |
| - 'login_as': 'Logged in as ', |
197 |
| - 'title_login': 'Choose a user to login with:', |
198 |
| - 'title_callee': 'Choose users to call:', |
199 |
| - 'calling': 'Calling...', |
200 |
| - 'webrtc_not_avaible': 'WebRTC is not available in your browser', |
201 |
| - 'no_internet': 'Please check your Internet connection and try again' |
202 |
| - }; |
| 191 | + var MESSAGES = { |
| 192 | + 'login': 'Login as any user on this computer and another user on another computer.', |
| 193 | + 'create_session': 'Creating a session...', |
| 194 | + 'connect': 'Connecting...', |
| 195 | + 'connect_error': 'Something wrong with connect to chat. Check internet connection or user info and trying again.', |
| 196 | + 'login_as': 'Logged in as ', |
| 197 | + 'title_login': 'Choose a user to login with:', |
| 198 | + 'title_callee': 'Choose users to call:', |
| 199 | + 'calling': 'Calling...', |
| 200 | + 'webrtc_not_avaible': 'WebRTC is not available in your browser', |
| 201 | + 'no_internet': 'Please check your Internet connection and try again' |
| 202 | + }; |
203 | 203 |
|
204 |
| - /** |
205 |
| - * PRIVATE |
206 |
| - */ |
207 |
| - /** |
208 |
| - * [_getQueryVar get value of key from search string of url] |
209 |
| - * @param {[string]} q [name of query] |
210 |
| - * @return {[string]} [value of query] |
211 |
| - */ |
212 |
| - function _getQueryVar(q) { |
213 |
| - var query = window.location.search.substring(1), |
214 |
| - vars = query.split("&"), |
215 |
| - answ = false; |
| 204 | + /** |
| 205 | + * PRIVATE |
| 206 | + */ |
| 207 | + /** |
| 208 | + * [_getQueryVar get value of key from search string of url] |
| 209 | + * @param {[string]} q [name of query] |
| 210 | + * @return {[string]} [value of query] |
| 211 | + */ |
| 212 | + function _getQueryVar(q) { |
| 213 | + var query = window.location.search.substring(1), |
| 214 | + vars = query.split("&"), |
| 215 | + answ = false; |
216 | 216 |
|
217 |
| - vars.forEach(function(el, i){ |
218 |
| - var pair = el.split('='); |
| 217 | + vars.forEach(function(el, i){ |
| 218 | + var pair = el.split('='); |
219 | 219 |
|
220 |
| - if(pair[0] === q) { |
221 |
| - answ = pair[1]; |
222 |
| - } |
223 |
| - }); |
| 220 | + if(pair[0] === q) { |
| 221 | + answ = pair[1]; |
| 222 | + } |
| 223 | + }); |
224 | 224 |
|
225 |
| - return answ; |
226 |
| - } |
| 225 | + return answ; |
| 226 | + } |
227 | 227 |
|
228 |
| - /** |
229 |
| - * set configuration variables in global |
230 |
| - */ |
231 |
| - window.QBApp = QBApp; |
232 |
| - window.CONFIG = CONFIG; |
233 |
| - window.QBUsers = QBUsers; |
234 |
| - window.MESSAGES = MESSAGES; |
| 228 | + /** |
| 229 | + * set configuration variables in global |
| 230 | + */ |
| 231 | + window.app = {}; |
| 232 | + window.app.CONFIG = { |
| 233 | + 'qbApp': QBApp, |
| 234 | + 'config': CONFIG, |
| 235 | + 'qbUsers': QBUsers, |
| 236 | + 'msgs': MESSAGES |
| 237 | + }; |
235 | 238 | }(window));
|
0 commit comments