Insert Post Ads - Version 1.2

Version Description

  • This update features vi stories from video intelligence - a video player that supplies both content and video advertising. Watch a demo: http://demo.vi.ai/ViewsterBlog_Nintendo.html Read the FAQ: https://www.vi.ai/frequently-asked-questions-vi-stories-for-wordpress/?utm_source=WordPress&utm_medium=Plugin%20FAQ&utm_campaign=WP%20insertpostads
  • New: Compatible up to WP 4.9.1
Download this release

Release Info

Developer insertpostads
Plugin Icon 128x128 Insert Post Ads
Version 1.2
Comparing to
See all releases

Code changes from version 1.1.2 to 1.2

Files changed (51) hide show
  1. apis/vi/api.php +421 -0
  2. common.php +34 -0
  3. controls/assets/css/controls.css +1411 -0
  4. controls/assets/images/chosen-sprite.png +0 -0
  5. controls/assets/images/chosen-sprite@2x.png +0 -0
  6. controls/assets/images/jquery-te.png +0 -0
  7. controls/assets/images/jquery.minicolors.png +0 -0
  8. controls/assets/js/controls.js +50 -0
  9. controls/assets/js/uncompressed/jQuery-TE/jquery-te-1.4.0.js +1347 -0
  10. controls/assets/js/uncompressed/jQuery-TE/license/AUTHOR.txt +6 -0
  11. controls/assets/js/uncompressed/jQuery-TE/license/MIT-LICENSE.txt +7 -0
  12. controls/assets/js/uncompressed/jQuery-chosen/LICENSE.md +23 -0
  13. controls/assets/js/uncompressed/jQuery-chosen/chosen.jquery.js +1349 -0
  14. controls/assets/js/uncompressed/jQuery-minicolors/LICENSE.md +7 -0
  15. controls/assets/js/uncompressed/jQuery-minicolors/jquery.minicolors.js +1108 -0
  16. controls/controls.php +571 -0
  17. css/admin.css +70 -0
  18. css/controls.css +1411 -0
  19. css/insert-post.css +559 -0
  20. css/jquery.minicolors.css +319 -0
  21. geotargeting.php +363 -0
  22. images/adsense-logo.png +0 -0
  23. images/advertisement-preview.png +0 -0
  24. images/ajax-loader-flat.gif +0 -0
  25. images/ajax-loader.gif +0 -0
  26. images/chosen-sprite.png +0 -0
  27. images/chosen-sprite@2x.png +0 -0
  28. images/header-banner.png +0 -0
  29. images/icon.png +0 -0
  30. images/jquery-te.png +0 -0
  31. images/jquery.minicolors.png +0 -0
  32. images/vi-big-logo.png +0 -0
  33. images/vi-empty-graph.jpg +0 -0
  34. images/vi-logo-large.png +0 -0
  35. images/vi-logo-small.png +0 -0
  36. images/vi-logo-square.png +0 -0
  37. images/vi-no-data.jpg +0 -0
  38. inpostads.php +576 -0
  39. insert-post-ads.php +64 -4
  40. js/Chart.bundle.min.js +10 -0
  41. js/admin.js +1122 -0
  42. js/controls.js +50 -0
  43. js/jquery.minicolors.js +1108 -0
  44. languages/insert-post-ads.pot +0 -0
  45. readme.txt +7 -2
  46. rules.php +144 -0
  47. uninstall.php +18 -0
  48. vi-integration.php +1230 -0
  49. views/dashboard-notices.php +0 -0
  50. views/settings.php +20 -19
  51. views/sidebar.php +0 -0
apis/vi/api.php ADDED
@@ -0,0 +1,421 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ function insert_ads_vi_api_get_settings() {
3
+ $viSettings = get_transient('insert_ads_vi_api_settings');
4
+ if(($viSettings === false) || !is_array($viSettings)) {
5
+ try {
6
+ $response = wp_remote_get('https://dashboard-api.vidint.net/v1/api/widget/settings', array('timeout' => 15));
7
+ if(!is_wp_error($response) && (200 == wp_remote_retrieve_response_code($response))) {
8
+ $responseBody = json_decode($response['body']);
9
+ if((json_last_error() == JSON_ERROR_NONE) && ($responseBody->status == 'ok')) {
10
+ $viSettings = array(
11
+ 'signupURL' => $responseBody->data->signupURL,
12
+ 'demoPageURL' => $responseBody->data->demoPageURL,
13
+ 'iabCategoriesURL' => $responseBody->data->iabCategoriesURL,
14
+ 'loginAPI' => $responseBody->data->loginAPI,
15
+ 'directSellURL' => $responseBody->data->directSellURL,
16
+ 'dashboardURL' => $responseBody->data->dashboardURL,
17
+ 'revenueAPI' => $responseBody->data->revenueAPI,
18
+ 'adsTxtAPI' => $responseBody->data->adsTxtAPI,
19
+ 'languages' => $responseBody->data->languages,
20
+ 'jsTagAPI' => $responseBody->data->jsTagAPI,
21
+ );
22
+ delete_transient('insert_ads_vi_api_settings');
23
+ set_transient('insert_ads_vi_api_settings', $viSettings, WEEK_IN_SECONDS);
24
+ } else {
25
+ return false;
26
+ }
27
+ }
28
+ } catch(Exception $ex) {
29
+ return false;
30
+ }
31
+ }
32
+ return $viSettings;
33
+ }
34
+
35
+ function insert_ads_vi_api_get_signupurl() {
36
+ $viSettings = insert_ads_vi_api_get_settings();
37
+ if(($viSettings != false) && is_array($viSettings)) {
38
+ return $viSettings['signupURL'];
39
+ }
40
+ return false;
41
+ }
42
+
43
+ function insert_ads_vi_api_get_dashboardurl() {
44
+ $viSettings = insert_ads_vi_api_get_settings();
45
+ if(($viSettings != false) && is_array($viSettings)) {
46
+ return $viSettings['dashboardURL'];
47
+ }
48
+ return false;
49
+ }
50
+
51
+ function insert_ads_vi_api_get_iabCategoriesURL() {
52
+ $viSettings = insert_ads_vi_api_get_settings();
53
+ if(($viSettings != false) && is_array($viSettings)) {
54
+ return $viSettings['iabCategoriesURL'];
55
+ }
56
+ return false;
57
+ }
58
+
59
+ function insert_ads_vi_api_get_languages() {
60
+ $viSettings = insert_ads_vi_api_get_settings();
61
+ if(($viSettings != false) && is_array($viSettings)) {
62
+ $languages = array();
63
+ foreach($viSettings['languages'] as $language) {
64
+ foreach($language as $key => $value) {
65
+ $languages[$key] = $value;
66
+ }
67
+ }
68
+ if(count($languages) > 0) {
69
+ return $languages;
70
+ } else {
71
+ return false;
72
+ }
73
+ }
74
+ return false;
75
+ }
76
+
77
+ function insert_ads_vi_api_get_adstxt_content() {
78
+ $viSettings = insert_ads_vi_api_get_settings();
79
+ if(($viSettings != false) && is_array($viSettings)) {
80
+ $viToken = insert_ads_vi_api_get_publisher_token();
81
+ if($viToken !== false) {
82
+ try{
83
+ $response = wp_remote_get(
84
+ $viSettings['adsTxtAPI'],
85
+ array(
86
+ 'timeout' => 15,
87
+ 'headers' => array(
88
+ 'Content-Type' => 'application/json',
89
+ 'Authorization' => $viToken
90
+ )
91
+ )
92
+ );
93
+ if(!is_wp_error($response)) {
94
+ if(200 == wp_remote_retrieve_response_code($response)) {
95
+ $responseBody = json_decode($response['body']);
96
+ if((json_last_error() == JSON_ERROR_NONE) && ($responseBody->status == 'ok')) {
97
+ return $responseBody->data;
98
+ } else {
99
+ return false;
100
+ }
101
+ } else {
102
+ return false;
103
+ }
104
+ }
105
+ } catch(Exception $ex) {
106
+ return false;
107
+ }
108
+ } else {
109
+ return false;
110
+ }
111
+ } else {
112
+ return false;
113
+ }
114
+ }
115
+
116
+ function insert_ads_vi_api_login($email, $password) {
117
+ if(($email != '') && ($password != '')) {
118
+ $viSettings = insert_ads_vi_api_get_settings();
119
+ if(($viSettings != false) && is_array($viSettings)) {
120
+ try {
121
+ $response = wp_remote_post(
122
+ $viSettings['loginAPI'],
123
+ array(
124
+ 'timeout' => 15,
125
+ 'headers' => array(
126
+ 'Content-Type' => 'application/json'
127
+ ),
128
+ 'body' => json_encode(array(
129
+ 'email' => $email,
130
+ 'password' => $password,
131
+ ))
132
+ )
133
+ );
134
+ if(!is_wp_error($response)) {
135
+ if(401 == wp_remote_retrieve_response_code($response)) {
136
+ $responseBody = json_decode($response['body']);
137
+ if((json_last_error() == JSON_ERROR_NONE) && ($responseBody->status == 'error')) {
138
+ return array(
139
+ 'status' => 'error',
140
+ 'errorCode' => 'WIVI008',
141
+ 'message' => $responseBody->error->message.':'.$responseBody->error->description.'',
142
+ );
143
+ } else {
144
+ return array(
145
+ 'status' => 'error',
146
+ 'errorCode' => 'WIVI007',
147
+ 'message' => 'Response JSON error, Please try again later!',
148
+ );
149
+ }
150
+ } else if(200 == wp_remote_retrieve_response_code($response)) {
151
+ $responseBody = json_decode($response['body']);
152
+ if((json_last_error() == JSON_ERROR_NONE) && ($responseBody->status == 'ok')) {
153
+ $viToken = $responseBody->data;
154
+ delete_transient('insert_ads_vi_api_authetication_token');
155
+ set_transient('insert_ads_vi_api_authetication_token', $viToken, MONTH_IN_SECONDS);
156
+ } else {
157
+ return array(
158
+ 'status' => 'error',
159
+ 'errorCode' => 'WIVI006',
160
+ 'message' => 'Response JSON error!',
161
+ );
162
+ }
163
+ } else {
164
+ return array(
165
+ 'status' => 'error',
166
+ 'errorCode' => 'WIVI005',
167
+ 'message' => 'Unknown response code',
168
+ );
169
+ }
170
+ } else {
171
+ return array(
172
+ 'status' => 'error',
173
+ 'errorCode' => 'WIVI004',
174
+ 'message' => 'API response error',
175
+ );
176
+ }
177
+ } catch(Exception $ex) {
178
+ return array(
179
+ 'status' => 'error',
180
+ 'errorCode' => 'WIVI003',
181
+ 'message' => 'Exception during API communication',
182
+ );
183
+ }
184
+ } else {
185
+ return array(
186
+ 'status' => 'error',
187
+ 'errorCode' => 'WIVI002',
188
+ 'message' => 'API is unreachable',
189
+ );
190
+ }
191
+ } else {
192
+ return array(
193
+ 'status' => 'error',
194
+ 'errorCode' => 'WIVI001',
195
+ 'message' => 'Email / Password is Empty!',
196
+ );
197
+ }
198
+ return $viToken;
199
+ }
200
+
201
+ function insert_ads_vi_api_logout() {
202
+ delete_transient('insert_ads_vi_api_authetication_token');
203
+ //delete_transient('insert_ads_vi_api_settings');
204
+ }
205
+
206
+ function insert_ads_vi_api_get_publisher_id() {
207
+ $viToken = get_transient('insert_ads_vi_api_authetication_token');
208
+ if($viToken === false) {
209
+ return false;
210
+ }
211
+ $viToken = explode('.', $viToken);
212
+ $viToken = base64_decode($viToken[1]);
213
+ $viToken = json_decode($viToken);
214
+ if(json_last_error() == JSON_ERROR_NONE) {
215
+ return $viToken->publisherId;
216
+ }
217
+ return false;
218
+ }
219
+
220
+ function insert_ads_vi_api_get_publisher_token() {
221
+ $viToken = get_transient('insert_ads_vi_api_authetication_token');
222
+ if($viToken === false) {
223
+ return false;
224
+ }
225
+ return $viToken;
226
+ }
227
+
228
+ function insert_ads_vi_api_is_loggedin() {
229
+ $viToken = get_transient('insert_ads_vi_api_authetication_token');
230
+ if($viToken === false) {
231
+ return false;
232
+ }
233
+ return true;
234
+ }
235
+
236
+ function insert_ads_vi_api_get_revenue_data() {
237
+ $viSettings = insert_ads_vi_api_get_settings();
238
+ if(($viSettings != false) && is_array($viSettings)) {
239
+ $viToken = insert_ads_vi_api_get_publisher_token();
240
+ if($viToken !== false) {
241
+ try{
242
+ $response = wp_remote_get(
243
+ $viSettings['revenueAPI'],
244
+ array(
245
+ 'timeout' => 15,
246
+ 'headers' => array(
247
+ 'Content-Type' => 'application/json',
248
+ 'Authorization' => $viToken
249
+ )
250
+ )
251
+ );
252
+ if(!is_wp_error($response)) {
253
+ if(200 == wp_remote_retrieve_response_code($response)) {
254
+ $responseBody = json_decode($response['body']);
255
+ if((json_last_error() == JSON_ERROR_NONE) && ($responseBody->status == 'ok')) {
256
+ return json_decode(json_encode($responseBody->data), True);
257
+ } else {
258
+ return false;
259
+ }
260
+ } else {
261
+ return false;
262
+ }
263
+ }
264
+ } catch(Exception $ex) {
265
+ return false;
266
+ }
267
+ } else {
268
+ return false;
269
+ }
270
+ } else {
271
+ return false;
272
+ }
273
+ }
274
+
275
+ function insert_ads_vi_api_set_vi_code($args = null) {
276
+ $domain = insert_ads_get_domain_name_from_url(get_bloginfo('url'));
277
+ $selectedArgs = array();
278
+ $selectedArgs['domain'] = $domain;
279
+ $selectedArgs['divId'] = 'insert_ads_vi_ad';
280
+
281
+ if(isset($args) && is_array($args)) {
282
+ if(isset($args['ad_unit_type']) && ($args['ad_unit_type'] != '') && ($args['ad_unit_type'] != 'select') && ($args['ad_unit_type'] != 'undefined')) {
283
+ $selectedArgs['adUnitType'] = $args['ad_unit_type'];
284
+ } else {
285
+ $selectedArgs['adUnitType'] = 'NATIVE_VIDEO_UNIT';
286
+ }
287
+
288
+ if(isset($args['language']) && ($args['language'] != '') && ($args['language'] != 'select') && ($args['language'] != 'undefined')) {
289
+ $selectedArgs['language'] = $args['language'];
290
+ }
291
+
292
+ if(isset($args['iab_category_child']) && ($args['iab_category_child'] != '') && ($args['iab_category_child'] != 'select') && ($args['iab_category_child'] != 'undefined')) {
293
+ $selectedArgs['iabCategory'] = $args['iab_category_child'];
294
+ }
295
+
296
+ if(isset($args['font_family']) && ($args['font_family'] != '') && ($args['font_family'] != 'select') && ($args['font_family'] != 'undefined')) {
297
+ $selectedArgs['font'] = $args['font_family'];
298
+ }
299
+
300
+ if(isset($args['font_size']) && ($args['font_size'] != '') && ($args['font_size'] != 'select') && ($args['font_size'] != 'undefined')) {
301
+ $selectedArgs['fontSize'] = $args['font_size'];
302
+ }
303
+
304
+ if(isset($args['keywords']) && ($args['keywords'] != '') && ($args['keywords'] != 'undefined')) {
305
+ $selectedArgs['keywords'] = $args['keywords'];
306
+ } else { //Send the keywords field even if it is empty
307
+ $selectedArgs['keywords'] = '';
308
+ }
309
+
310
+ if(isset($args['native_text_color']) && ($args['native_text_color'] != '') && ($args['native_text_color'] != 'undefined')) {
311
+ $selectedArgs['textColor'] = $args['native_text_color'];
312
+ }
313
+
314
+ if(isset($args['native_bg_color']) && ($args['native_bg_color'] != '') && ($args['native_bg_color'] != 'undefined')) {
315
+ $selectedArgs['backgroundColor'] = $args['native_bg_color'];
316
+ }
317
+
318
+ if(isset($args['optional_1']) && ($args['optional_1'] != '') && ($args['optional_1'] != 'undefined')) {
319
+ $selectedArgs['vioptional1'] = $args['optional_1'];
320
+ }
321
+ if(isset($args['optional_2']) && ($args['optional_2'] != '') && ($args['optional_2'] != 'undefined')) {
322
+ $selectedArgs['vioptional2'] = $args['optional_2'];
323
+ }
324
+ if(isset($args['optional_3']) && ($args['optional_3'] != '') && ($args['optional_3'] != 'undefined')) {
325
+ $selectedArgs['vioptional3'] = $args['optional_3'];
326
+ }
327
+ }
328
+
329
+ $viSettings = insert_ads_vi_api_get_settings();
330
+ if(($viSettings != false) && is_array($viSettings)) {
331
+ $viToken = insert_ads_vi_api_get_publisher_token();
332
+ if($viToken !== false) {
333
+ try{
334
+ $response = wp_remote_request(
335
+ $viSettings['jsTagAPI'],
336
+ array(
337
+ 'method' => 'POST',
338
+ 'timeout' => 15,
339
+ 'headers' => array(
340
+ 'Content-Type' => 'application/json',
341
+ 'Authorization' => $viToken
342
+ ),
343
+ 'body' => json_encode($selectedArgs)
344
+ )
345
+ );
346
+ if(!is_wp_error($response)) {
347
+ if(400 == wp_remote_retrieve_response_code($response)) {
348
+ $responseBody = json_decode($response['body']);
349
+ if((json_last_error() == JSON_ERROR_NONE) && ($responseBody->status == 'error')) {
350
+ return array(
351
+ 'status' => 'error',
352
+ 'errorCode' => 'WIVI108',
353
+ 'message' => $responseBody->error->description,
354
+ );
355
+ } else {
356
+ return array(
357
+ 'status' => 'error',
358
+ 'errorCode' => 'WIVI107',
359
+ 'message' => 'Response JSON error, Please try again later!',
360
+ );
361
+ }
362
+ } else if(201 == wp_remote_retrieve_response_code($response)) {
363
+ $responseBody = json_decode($response['body']);
364
+ if((json_last_error() == JSON_ERROR_NONE) && ($responseBody->status == 'ok')) {
365
+ delete_transient('insert_ads_vi_api_jstag');
366
+ set_transient('insert_ads_vi_api_jstag', $responseBody->data, YEAR_IN_SECONDS);
367
+ return $responseBody->data;
368
+ } else {
369
+ return array(
370
+ 'status' => 'error',
371
+ 'errorCode' => 'WIVI106',
372
+ 'message' => 'Response JSON error!',
373
+ );
374
+ }
375
+ } else {
376
+ return array(
377
+ 'status' => 'error',
378
+ 'errorCode' => 'WIVI105',
379
+ 'message' => 'Unknown response code',
380
+ );
381
+ }
382
+ }
383
+ } catch(Exception $ex) {
384
+ return array(
385
+ 'status' => 'error',
386
+ 'errorCode' => 'WIVI103',
387
+ 'message' => 'Exception during API communication',
388
+ );
389
+ }
390
+ } else {
391
+ return array(
392
+ 'status' => 'error',
393
+ 'errorCode' => 'WIVI102',
394
+ 'message' => 'Authorization Token is Missing',
395
+ );
396
+ }
397
+ } else {
398
+ return array(
399
+ 'status' => 'error',
400
+ 'errorCode' => 'WIVI101',
401
+ 'message' => 'API is unreachable',
402
+ );
403
+ }
404
+ }
405
+
406
+ function insert_ads_vi_api_get_vi_code($settingsKey = '') {
407
+ $jsTag = get_transient('insert_ads_vi_api_jstag');
408
+ if(($jsTag === false) || ($jsTag == '')) {
409
+ if($settingsKey != '') {
410
+ $vicodeSettings = get_option($settingsKey);
411
+ $jsTag = insert_ads_vi_api_set_vi_code($vicodeSettings);
412
+ } else {
413
+ $jsTag = insert_ads_vi_api_set_vi_code();
414
+ }
415
+ if(($jsTag === false) || ($jsTag == '')) {
416
+ return false;
417
+ }
418
+ }
419
+ return '<script>'.$jsTag.'</script>';
420
+ }
421
+ ?>
common.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* Begin Version Upgrade */
3
+ add_action('init', 'insert_ads_upgrade_version', 0);
4
+ function insert_ads_upgrade_version() {
5
+ $databaseVersion = get_option('insert_ads_version');
6
+ if($databaseVersion != WP_INSADS_VERSION) {
7
+ do_action('insert_ads_upgrade_database');
8
+ update_option('insert_ads_version', WP_INSADS_VERSION);
9
+ }
10
+ }
11
+ /* End Version Upgrade */
12
+
13
+ /* Begin Misc Functions */
14
+ function insert_ads_add_ordinal_number_suffix($num) {
15
+ if (!in_array(($num % 100),array(11,12,13))){
16
+ switch ($num % 10) {
17
+ case 1: return $num.'st';
18
+ case 2: return $num.'nd';
19
+ case 3: return $num.'rd';
20
+ }
21
+ }
22
+ return $num.'th';
23
+ }
24
+
25
+ function insert_ads_get_domain_name_from_url($url){
26
+ $pieces = parse_url($url);
27
+ $domain = isset($pieces['host']) ? $pieces['host'] : '';
28
+ if(preg_match('/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.[a-z\.]{2,6})$/i', $domain, $regs)){
29
+ return $regs['domain'];
30
+ }
31
+ return false;
32
+ }
33
+ /* End Misc Functions */
34
+ ?>
controls/assets/css/controls.css ADDED
@@ -0,0 +1,1411 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .smartlogixControlsSectionWrapper {
2
+ margin: 15px 0;
3
+ padding: 5px;
4
+ border: 1px solid #999999;
5
+ border-radius: 5px;
6
+ position: relative;
7
+ }
8
+
9
+ .smartlogixControlsSectionWrapper .smartlogixControlsSectionTitle {
10
+ font-weight: bold;
11
+ position: absolute;
12
+ left: 15px;
13
+ right: 15px;
14
+ top: -10px;
15
+ background: #FFFFFF;
16
+ color: #111111;
17
+ padding: 0px 10px;
18
+ }
19
+
20
+ .smartlogixControlsSectionWrapper .smartlogixControlsSectionInner {
21
+ margin: 10px 0 10px;
22
+ padding: 0 10px;
23
+ position: relative;
24
+ }
25
+
26
+ @media screen and (min-width: 768px) and (max-width: 1200px) {
27
+ .smartlogixControlsSectionWrapper .smartlogixControlsSectionInner {
28
+ margin-top: 30px;
29
+ }
30
+ }
31
+
32
+ .smartlogixControlsSectionWrapper .smartlogixControlsSectionInner p {
33
+ margin: 0 0 10px;
34
+ }
35
+
36
+
37
+ .ipcheckbox{
38
+ background: #C8161B;
39
+ border: none;
40
+ height: 36px;
41
+ -webkit-border-radius: 18px;
42
+ border-radius: 18px;
43
+ width: 120px;
44
+ -webkit-transition: all 0.3s ease-in-out;
45
+ -moz-transition: all 0.3s ease-in-out;
46
+ -ms-transition: all 0.3s ease-in-out;
47
+ -o-transition: all 0.3s ease-in-out;
48
+ transition: all 0.3s ease-in-out;
49
+ -webkit-box-shadow: none;
50
+ box-shadow: none;
51
+ cursor: pointer;
52
+ position: relative;
53
+ display: inline-block;
54
+ }
55
+
56
+ .ipcheckbox.checked{
57
+ -webkit-box-shadow: inset 0 0 0 36px #6ddc5f;
58
+ box-shadow: inset 0 0 0 36px #6ddc5f;
59
+ }
60
+
61
+ .ipcheckbox.checked .handle{
62
+ left: 87px;
63
+ }
64
+
65
+ .ipcheckbox .handle{
66
+ width: 30px;
67
+ height: 30px;
68
+ position: absolute;
69
+ top: 3px;
70
+ left: 3px;
71
+ -webkit-border-radius: 100%;
72
+ border-radius: 100%;
73
+ background: white;
74
+ -webkit-transition: all 350ms cubic-bezier(0, 0.89, 0.44, 1);
75
+ -moz-transition: all 350ms cubic-bezier(0, 0.89, 0.44, 1);
76
+ -o-transition: all 350ms cubic-bezier(0, 0.89, 0.44, 1);
77
+ transition: all 350ms cubic-bezier(0, 0.89, 0.44, 1);
78
+ -webkit-box-shadow: 0 1px 2px 0 rgba(0,0,0,0.2),0 3px 4px 0 rgba(0,0,0,0.1);
79
+ box-shadow: 0 1px 2px 0 rgba(0,0,0,0.2),0 3px 4px 0 rgba(0,0,0,0.1);
80
+ }
81
+
82
+ .chosen-container {
83
+ position: relative;
84
+ display: inline-block;
85
+ vertical-align: middle;
86
+ font-size: 13px;
87
+ zoom: 1;
88
+ *display: inline;
89
+ -webkit-user-select: none;
90
+ -moz-user-select: none;
91
+ user-select: none;
92
+ }
93
+
94
+ .chosen-container * {
95
+ -webkit-box-sizing: border-box;
96
+ -moz-box-sizing: border-box;
97
+ box-sizing: border-box;
98
+ }
99
+
100
+ .chosen-container .chosen-drop {
101
+ display: block;
102
+ height: 241px;
103
+ width: 100%;
104
+ border: 1px solid #aaa;
105
+ border-top: 0;
106
+ background: #fff;
107
+ /*box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15);*/
108
+ }
109
+
110
+ .chosen-container.chosen-with-drop .chosen-drop {
111
+ left: 0;
112
+ }
113
+
114
+ .chosen-container a {
115
+ cursor: pointer;
116
+ }
117
+
118
+ .chosen-container .search-choice .group-name,
119
+ .chosen-container .chosen-single .group-name {
120
+ margin-right: 4px;
121
+ overflow: hidden;
122
+ white-space: nowrap;
123
+ text-overflow: ellipsis;
124
+ font-weight: normal;
125
+ color: #999999;
126
+ }
127
+
128
+ .chosen-container .search-choice .group-name:after,
129
+ .chosen-container .chosen-single .group-name:after {
130
+ content: ":";
131
+ padding-left: 2px;
132
+ vertical-align: top;
133
+ }
134
+
135
+ .chosen-container-single .chosen-single {
136
+ position: relative;
137
+ display: block;
138
+ overflow: hidden;
139
+ padding: 0 0 0 8px;
140
+ height: 25px;
141
+ border: 1px solid #aaa;
142
+ border-radius: 5px;
143
+ background-color: #fff;
144
+ background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #ffffff), color-stop(50%, #f6f6f6), color-stop(52%, #eeeeee), color-stop(100%, #f4f4f4));
145
+ background: -webkit-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
146
+ background: -moz-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
147
+ background: -o-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
148
+ background: linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
149
+ background-clip: padding-box;
150
+ box-shadow: 0 0 3px white inset, 0 1px 1px rgba(0, 0, 0, 0.1);
151
+ color: #444;
152
+ text-decoration: none;
153
+ white-space: nowrap;
154
+ line-height: 24px;
155
+ }
156
+
157
+ .chosen-container-single .chosen-default {
158
+ color: #999;
159
+ }
160
+
161
+ .chosen-container-single .chosen-single span {
162
+ display: block;
163
+ overflow: hidden;
164
+ margin-right: 26px;
165
+ text-overflow: ellipsis;
166
+ white-space: nowrap;
167
+ }
168
+
169
+ .chosen-container-single .chosen-single-with-deselect span {
170
+ margin-right: 38px;
171
+ }
172
+
173
+ .chosen-container-single .chosen-single abbr {
174
+ position: absolute;
175
+ top: 6px;
176
+ right: 26px;
177
+ display: block;
178
+ width: 12px;
179
+ height: 12px;
180
+ background: url('../images/chosen-sprite.png') -42px 1px no-repeat;
181
+ font-size: 1px;
182
+ }
183
+
184
+ .chosen-container-single .chosen-single abbr:hover {
185
+ background-position: -42px -10px;
186
+ }
187
+
188
+ .chosen-container-single.chosen-disabled .chosen-single abbr:hover {
189
+ background-position: -42px -10px;
190
+ }
191
+
192
+ .chosen-container-single .chosen-single div {
193
+ position: absolute;
194
+ top: 0;
195
+ right: 0;
196
+ display: block;
197
+ width: 18px;
198
+ height: 100%;
199
+ }
200
+
201
+ .chosen-container-single .chosen-single div b {
202
+ display: block;
203
+ width: 100%;
204
+ height: 100%;
205
+ background: url('../images/chosen-sprite.png') no-repeat 0px 2px;
206
+ }
207
+
208
+ .chosen-container-single .chosen-search {
209
+ position: relative;
210
+ z-index: 1010;
211
+ margin: 0;
212
+ padding: 3px 4px;
213
+ white-space: nowrap;
214
+ }
215
+
216
+ .chosen-container-single .chosen-search input[type="text"] {
217
+ margin: 1px 0;
218
+ padding: 4px 20px 4px 5px;
219
+ width: 100%;
220
+ height: auto;
221
+ outline: 0;
222
+ border: 1px solid #aaa;
223
+ background: white url('../images/chosen-sprite.png') no-repeat 100% -20px;
224
+ background: url('../images/chosen-sprite.png') no-repeat 100% -20px;
225
+ font-size: 1em;
226
+ font-family: sans-serif;
227
+ line-height: normal;
228
+ border-radius: 0;
229
+ }
230
+
231
+ .chosen-container-single .chosen-drop {
232
+ margin-top: -1px;
233
+ border-radius: 0 0 4px 4px;
234
+ background-clip: padding-box;
235
+ }
236
+
237
+ .chosen-container-single.chosen-container-single-nosearch .chosen-search {
238
+ position: absolute;
239
+ left: -9999px;
240
+ }
241
+
242
+ .chosen-container .chosen-results {
243
+ color: #444;
244
+ position: relative;
245
+ overflow-x: hidden;
246
+ overflow-y: auto;
247
+ margin: 0 4px 4px 0;
248
+ padding: 0 0 0 4px;
249
+ max-height: 240px;
250
+ -webkit-overflow-scrolling: touch;
251
+ }
252
+
253
+ .chosen-container .chosen-results li {
254
+ display: none;
255
+ margin: 0;
256
+ padding: 5px 6px;
257
+ list-style: none;
258
+ line-height: 15px;
259
+ word-wrap: break-word;
260
+ -webkit-touch-callout: none;
261
+ }
262
+
263
+ .chosen-container .chosen-results li.active-result {
264
+ display: list-item;
265
+ cursor: pointer;
266
+ }
267
+
268
+ .chosen-container .chosen-results li.disabled-result {
269
+ display: list-item;
270
+ color: #ccc;
271
+ cursor: default;
272
+ }
273
+
274
+ .chosen-container .chosen-results li.highlighted {
275
+ background-color: #3875d7;
276
+ background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #3875d7), color-stop(90%, #2a62bc));
277
+ background-image: -webkit-linear-gradient(#3875d7 20%, #2a62bc 90%);
278
+ background-image: -moz-linear-gradient(#3875d7 20%, #2a62bc 90%);
279
+ background-image: -o-linear-gradient(#3875d7 20%, #2a62bc 90%);
280
+ background-image: linear-gradient(#3875d7 20%, #2a62bc 90%);
281
+ color: #fff;
282
+ }
283
+
284
+ .chosen-container .chosen-results li.no-results {
285
+ color: #777;
286
+ display: list-item;
287
+ background: #f4f4f4;
288
+ }
289
+
290
+ .chosen-container .chosen-results li.group-result {
291
+ display: list-item;
292
+ font-weight: bold;
293
+ cursor: default;
294
+ }
295
+
296
+ .chosen-container .chosen-results li.group-option {
297
+ padding-left: 15px;
298
+ }
299
+
300
+ .chosen-container .chosen-results li em {
301
+ font-style: normal;
302
+ text-decoration: underline;
303
+ }
304
+
305
+ .chosen-container-multi .chosen-choices {
306
+ position: relative;
307
+ overflow: hidden;
308
+ margin: 0;
309
+ padding: 0 5px;
310
+ width: 100%;
311
+ height: auto !important;
312
+ height: 1%;
313
+ border: 1px solid #aaa;
314
+ background-color: #fff;
315
+ background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff));
316
+ background-image: -webkit-linear-gradient(#eeeeee 1%, #ffffff 15%);
317
+ background-image: -moz-linear-gradient(#eeeeee 1%, #ffffff 15%);
318
+ background-image: -o-linear-gradient(#eeeeee 1%, #ffffff 15%);
319
+ background-image: linear-gradient(#eeeeee 1%, #ffffff 15%);
320
+ cursor: text;
321
+ }
322
+
323
+ .chosen-container-multi .chosen-choices li {
324
+ float: left;
325
+ list-style: none;
326
+ }
327
+
328
+ .chosen-container-multi .chosen-choices li.search-field {
329
+ margin: 0;
330
+ padding: 0;
331
+ white-space: nowrap;
332
+ }
333
+
334
+ .chosen-container-multi .chosen-choices li.search-field input[type="text"] {
335
+ margin: 1px 0;
336
+ padding: 0;
337
+ height: 25px;
338
+ outline: 0;
339
+ border: 0 !important;
340
+ background: transparent !important;
341
+ box-shadow: none;
342
+ color: #999;
343
+ font-size: 100%;
344
+ font-family: sans-serif;
345
+ line-height: normal;
346
+ border-radius: 0;
347
+ }
348
+
349
+ .chosen-container-multi .chosen-choices li.search-choice {
350
+ position: relative;
351
+ margin: 3px 5px 3px 0;
352
+ padding: 3px 20px 3px 5px;
353
+ border: 1px solid #aaa;
354
+ max-width: 100%;
355
+ border-radius: 3px;
356
+ background-color: #eeeeee;
357
+ background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee));
358
+ background-image: -webkit-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
359
+ background-image: -moz-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
360
+ background-image: -o-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
361
+ background-image: linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
362
+ background-size: 100% 19px;
363
+ background-repeat: repeat-x;
364
+ background-clip: padding-box;
365
+ box-shadow: 0 0 2px white inset, 0 1px 0 rgba(0, 0, 0, 0.05);
366
+ color: #333;
367
+ line-height: 13px;
368
+ cursor: default;
369
+ }
370
+
371
+ .chosen-container-multi .chosen-choices li.search-choice span {
372
+ word-wrap: break-word;
373
+ }
374
+
375
+ .chosen-container-multi .chosen-choices li.search-choice .search-choice-close {
376
+ position: absolute;
377
+ top: 4px;
378
+ right: 3px;
379
+ display: block;
380
+ width: 12px;
381
+ height: 12px;
382
+ background: url('../images/chosen-sprite.png') -42px 1px no-repeat;
383
+ font-size: 1px;
384
+ }
385
+
386
+ .chosen-container-multi .chosen-choices li.search-choice .search-choice-close:hover {
387
+ background-position: -42px -10px;
388
+ }
389
+
390
+ .chosen-container-multi .chosen-choices li.search-choice-disabled {
391
+ padding-right: 5px;
392
+ border: 1px solid #ccc;
393
+ background-color: #e4e4e4;
394
+ background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee));
395
+ background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
396
+ background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
397
+ background-image: -o-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
398
+ background-image: linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
399
+ color: #666;
400
+ }
401
+
402
+ .chosen-container-multi .chosen-choices li.search-choice-focus {
403
+ background: #d4d4d4;
404
+ }
405
+
406
+ .chosen-container-multi .chosen-choices li.search-choice-focus .search-choice-close {
407
+ background-position: -42px -10px;
408
+ }
409
+
410
+ .chosen-container-multi .chosen-results {
411
+ margin: 0;
412
+ padding: 0;
413
+ }
414
+
415
+ .chosen-container-multi .chosen-drop .result-selected {
416
+ display: list-item;
417
+ color: #ccc;
418
+ cursor: default;
419
+ }
420
+
421
+ .chosen-container-active .chosen-single {
422
+ border: 1px solid #5897fb;
423
+ box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
424
+ }
425
+
426
+ .chosen-container-active.chosen-with-drop .chosen-single {
427
+ border: 1px solid #aaa;
428
+ -moz-border-radius-bottomright: 0;
429
+ border-bottom-right-radius: 0;
430
+ -moz-border-radius-bottomleft: 0;
431
+ border-bottom-left-radius: 0;
432
+ background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #eeeeee), color-stop(80%, #ffffff));
433
+ background-image: -webkit-linear-gradient(#eeeeee 20%, #ffffff 80%);
434
+ background-image: -moz-linear-gradient(#eeeeee 20%, #ffffff 80%);
435
+ background-image: -o-linear-gradient(#eeeeee 20%, #ffffff 80%);
436
+ background-image: linear-gradient(#eeeeee 20%, #ffffff 80%);
437
+ box-shadow: 0 1px 0 #fff inset;
438
+ }
439
+
440
+ .chosen-container-active.chosen-with-drop .chosen-single div {
441
+ border-left: none;
442
+ background: transparent;
443
+ }
444
+
445
+ .chosen-container-active.chosen-with-drop .chosen-single div b {
446
+ background-position: -18px 2px;
447
+ }
448
+
449
+ .chosen-container-active .chosen-choices {
450
+ border: 1px solid #5897fb;
451
+ box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
452
+ }
453
+
454
+ .chosen-container-active .chosen-choices li.search-field input[type="text"] {
455
+ color: #222 !important;
456
+ }
457
+
458
+ .chosen-disabled {
459
+ opacity: 0.5 !important;
460
+ cursor: default;
461
+ }
462
+
463
+ .chosen-disabled .chosen-single {
464
+ cursor: default;
465
+ }
466
+
467
+ .chosen-disabled .chosen-choices .search-choice .search-choice-close {
468
+ cursor: default;
469
+ }
470
+
471
+ .chosen-rtl {
472
+ text-align: right;
473
+ }
474
+
475
+ .chosen-rtl .chosen-single {
476
+ overflow: visible;
477
+ padding: 0 8px 0 0;
478
+ }
479
+
480
+ .chosen-rtl .chosen-single span {
481
+ margin-right: 0;
482
+ margin-left: 26px;
483
+ direction: rtl;
484
+ }
485
+
486
+ .chosen-rtl .chosen-single-with-deselect span {
487
+ margin-left: 38px;
488
+ }
489
+
490
+ .chosen-rtl .chosen-single div {
491
+ right: auto;
492
+ left: 3px;
493
+ }
494
+
495
+ .chosen-rtl .chosen-single abbr {
496
+ right: auto;
497
+ left: 26px;
498
+ }
499
+
500
+ .chosen-rtl .chosen-choices li {
501
+ float: right;
502
+ }
503
+
504
+ .chosen-rtl .chosen-choices li.search-field input[type="text"] {
505
+ direction: rtl;
506
+ }
507
+
508
+ .chosen-rtl .chosen-choices li.search-choice {
509
+ margin: 3px 5px 3px 0;
510
+ padding: 3px 5px 3px 19px;
511
+ }
512
+
513
+ .chosen-rtl .chosen-choices li.search-choice .search-choice-close {
514
+ right: auto;
515
+ left: 4px;
516
+ }
517
+
518
+ .chosen-rtl.chosen-container-single-nosearch .chosen-search,
519
+ .chosen-rtl .chosen-drop {
520
+ left: 9999px;
521
+ }
522
+
523
+ .chosen-rtl.chosen-container-single .chosen-results {
524
+ margin: 0 0 4px 4px;
525
+ padding: 0 4px 0 0;
526
+ }
527
+
528
+ .chosen-rtl .chosen-results li.group-option {
529
+ padding-right: 15px;
530
+ padding-left: 0;
531
+ }
532
+
533
+ .chosen-rtl.chosen-container-active.chosen-with-drop .chosen-single div {
534
+ border-right: none;
535
+ }
536
+
537
+ .chosen-rtl .chosen-search input[type="text"] {
538
+ padding: 4px 5px 4px 20px;
539
+ background: white url('../images/chosen-sprite.png') no-repeat -30px -20px;
540
+ background: url('../images/chosen-sprite.png') no-repeat -30px -20px;
541
+ direction: rtl;
542
+ }
543
+
544
+ .chosen-rtl.chosen-container-single .chosen-single div b {
545
+ background-position: 6px 2px;
546
+ }
547
+
548
+ .chosen-rtl.chosen-container-single.chosen-with-drop .chosen-single div b {
549
+ background-position: -12px 2px;
550
+ }
551
+
552
+ .jqte {
553
+ margin: 0;
554
+ border:#bbb 1px solid;
555
+ overflow:hidden;
556
+ }
557
+
558
+ .jqte * {
559
+ color:#333;
560
+ font-family:Arial, Helvetica, sans-serif;
561
+ font-size:14px;
562
+ }
563
+
564
+ .jqte_focused {
565
+ /*border-color:#00AAE7;
566
+ box-shadow:0 0 10px #00BDFF; -webkit-box-shadow:0 0 10px #00BDFF; -moz-box-shadow:0 0 10px #00BDFF;*/
567
+ }
568
+
569
+ .jqte_toolbar {
570
+ overflow:auto;
571
+ padding:3px 4px;
572
+ background:#EEE;
573
+ border-bottom:#BBB 1px solid;
574
+ }
575
+
576
+ .jqte_tool {
577
+ float:left;
578
+ margin:0;
579
+ padding:0;
580
+ cursor:pointer;
581
+ }
582
+
583
+ .jqte_tool, .jqte_tool_icon, .jqte_tool_label {
584
+ border:#EEE 1px solid;
585
+ border-radius:3px; -webkit-border-radius:3px; -moz-border-radius:3px
586
+ }
587
+
588
+ .jqte_hiddenField {
589
+ display:none
590
+ }
591
+
592
+ .jqte_tool_icon {
593
+ display:block;
594
+ width:22px;
595
+ height:22px;
596
+ background:url('../images/jquery-te.png') no-repeat
597
+ }
598
+
599
+ .jqte_tool.jqte_tool_1 .jqte_tool_label {
600
+ position:relative;
601
+ display:block;
602
+ padding:3px;
603
+ width:70px;
604
+ height:16px;
605
+ overflow:hidden;
606
+ }
607
+
608
+ .jqte_tool.jqte_tool_1 .jqte_tool_text {
609
+ font:bold 13px Arial,sans-serif;
610
+ color:#222;
611
+ }
612
+
613
+ .jqte_tool.jqte_tool_1 .jqte_tool_icon {
614
+ position:absolute;
615
+ top:10px;
616
+ right:2px;
617
+ width:6px;
618
+ height:4px;
619
+ background-position:-19px -23px;
620
+ border:none;
621
+ border-radius:none; -webkit-border-radius:none; -moz-border-radius:none
622
+ }
623
+
624
+ .jqte_tool.jqte_tool_2 .jqte_tool_icon {
625
+ background-position:0 0
626
+ }
627
+
628
+ .jqte_tool.jqte_tool_3 .jqte_tool_icon {
629
+ background-position:-22px 0
630
+ }
631
+
632
+ .jqte_tool.jqte_tool_4 .jqte_tool_icon {
633
+ background-position:-44px 0
634
+ }
635
+
636
+ .jqte_tool.jqte_tool_5 .jqte_tool_icon {
637
+ background-position:-66px 0
638
+ }
639
+
640
+ .jqte_tool.jqte_tool_6 .jqte_tool_icon {
641
+ background-position:-88px 0
642
+ }
643
+
644
+ .jqte_tool.jqte_tool_7 .jqte_tool_icon {
645
+ background-position:-110px 0
646
+ }
647
+
648
+ .jqte_tool.jqte_tool_8 .jqte_tool_icon {
649
+ background-position:-132px 0
650
+ }
651
+
652
+ .jqte_tool.jqte_tool_9 .jqte_tool_icon {
653
+ background-position:-154px 0
654
+ }
655
+
656
+ .jqte_tool.jqte_tool_10 .jqte_tool_icon {
657
+ background-position:-176px 0
658
+ }
659
+
660
+ .jqte_tool.jqte_tool_11 .jqte_tool_icon {
661
+ background-position:-198px 0
662
+ }
663
+
664
+ .jqte_tool.jqte_tool_12 .jqte_tool_icon {
665
+ background-position:-220px 0
666
+ }
667
+
668
+ .jqte_tool.jqte_tool_13 .jqte_tool_icon {
669
+ background-position:-242px 0
670
+ }
671
+
672
+ .jqte_tool.jqte_tool_14 .jqte_tool_icon {
673
+ background-position:-264px 0
674
+ }
675
+
676
+ .jqte_tool.jqte_tool_15 .jqte_tool_icon {
677
+ background-position:-286px 0
678
+ }
679
+
680
+ .jqte_tool.jqte_tool_16 .jqte_tool_icon {
681
+ background-position:-308px 0
682
+ }
683
+
684
+ .jqte_tool.jqte_tool_17 .jqte_tool_icon {
685
+ background-position:-330px 0
686
+ }
687
+
688
+ .jqte_tool.jqte_tool_18 .jqte_tool_icon {
689
+ background-position:-352px 0
690
+ }
691
+
692
+ .jqte_tool.jqte_tool_19 .jqte_tool_icon {
693
+ background-position:-374px 0
694
+ }
695
+
696
+ .jqte_tool.jqte_tool_20 .jqte_tool_icon {
697
+ background-position:-396px 0
698
+ }
699
+
700
+ .jqte_tool.jqte_tool_21 .jqte_tool_icon {
701
+ background-position:-418px 0
702
+ }
703
+
704
+ .jqte_tool:hover {
705
+ background-color:#FFF;
706
+ border-color:#FFF
707
+ }
708
+
709
+ .jqte_tool:hover .jqte_tool_icon, .jqte_tool:hover .jqte_tool_label {
710
+ border:#AAA 1px solid
711
+ }
712
+
713
+ .jqte_tool:active .jqte_tool_icon, .jqte_tool:active .jqte_tool_label {
714
+ border:#777 1px solid
715
+ }
716
+
717
+ .jqte_tool.jqte_tool_1:hover .jqte_tool_icon, .jqte_tool.jqte_tool_1:active .jqte_tool_icon {
718
+ border:none
719
+ }
720
+
721
+ .jqte_tool_depressed {
722
+ background-color:#DDD;
723
+ border-color:#CCC
724
+ }
725
+
726
+ .jqte_tool_depressed .jqte_tool_icon {
727
+ border-color:#AAA
728
+ }
729
+
730
+ .jqte_tool_depressed:hover {
731
+ background-color:#EEE
732
+ }
733
+
734
+ .jqte_linkform {
735
+ padding:5px 10px;
736
+ background:#DDD;
737
+ border-bottom:#BBB 1px solid;
738
+ }
739
+
740
+ .jqte_linktypeselect {
741
+ position:relative;
742
+ float:left;
743
+ width:130px;
744
+ background:#EEE;
745
+ cursor:pointer
746
+ }
747
+
748
+ .jqte_linktypeselect:Active {
749
+ background:#FFF
750
+ }
751
+
752
+ .jqte_linktypeview {
753
+ padding:3px 5px;
754
+ border:#333 1px solid;
755
+ color:#777;
756
+ border-radius:3px; -webkit-border-radius:3px; -moz-border-radius:3px;
757
+ outline:none
758
+ }
759
+
760
+ .jqte_linktypetext {
761
+ font-size:12px;
762
+ }
763
+
764
+ .jqte_linktypearrow {
765
+ position:absolute;
766
+ bottom:8px; right:6px;
767
+ width:7px;
768
+ height:6px;
769
+ margin:0 auto;
770
+ background:url('../images/jquery-te.png') -7px -23px no-repeat;
771
+ }
772
+
773
+ .jqte_linktypes {
774
+ display:none;
775
+ position:absolute;
776
+ top:22px; left:1px;
777
+ width:125px;
778
+ background:#FFF;
779
+ border:#333 1px solid;
780
+ box-shadow:0 1px 4px #AAA; -webkit-box-shadow:0 1px 4px #AAA; -moz-box-shadow:0 1px 4px #AAA
781
+ }
782
+
783
+ .jqte_linktypes a {
784
+ display:block;
785
+ padding:4px 5px;
786
+ font-size:12px;
787
+ }
788
+
789
+ .jqte_linktypes a:hover {
790
+ background:#DDD
791
+ }
792
+
793
+ .jqte_linkinput {
794
+ float:left;
795
+ margin:0 5px;
796
+ padding:3px 5px;
797
+ width:300px;
798
+ background:#EEE;
799
+ border:#333 1px solid;
800
+ color:#777;
801
+ font-size:12px;
802
+ border-radius:3px; -webkit-border-radius:3px; -moz-border-radius:3px;
803
+ outline:none;
804
+ }
805
+
806
+ .jqte_linkinput:focus, .jqte_linkinput:hover {
807
+ background:#FFF;
808
+ border-color:#000;
809
+ }
810
+
811
+ .jqte_linkbutton {
812
+ float:left;
813
+ padding:3px 12px;
814
+ background:#AAA;
815
+ border:#333 1px solid;
816
+ color:#FFF;
817
+ font-size:12px;
818
+ font-weight:bold;
819
+ cursor:pointer;
820
+ border-radius:3px; -webkit-border-radius:3px; -moz-border-radius:3px;
821
+ box-shadow:inset 0 1px #EEE; -webkit-box-shadow:inset 0 1px #EEE; -moz-box-shadow:inset 0 1px #EEE;
822
+ }
823
+
824
+ .jqte_linkbutton:hover {
825
+ background:#A1A1A1
826
+ }
827
+
828
+ .jqte_linkbutton:active {
829
+ box-shadow:inset 0 1px #CCC; -webkit-box-shadow:inset 0 1px #CCC; -moz-box-shadow:inset 0 1px #CCC;
830
+ background:#888;
831
+ }
832
+
833
+ .jqte_formats {
834
+ display:none;
835
+ position:absolute;
836
+ width:180px;
837
+ oveflow-x:hidden;
838
+ overflow-y:auto;
839
+ background:#FFF;
840
+ border:#AAA 1px solid;
841
+ box-shadow:0 0 5px #AAA; -webkit-box-shadow:0 0 5px #AAA; -moz-box-shadow:0 0 5px #AAA;
842
+ z-index:100;
843
+ }
844
+
845
+ .jqte_format {
846
+ display:block;
847
+ padding:4px 7px;
848
+ font-size:13px
849
+ }
850
+
851
+ .jqte_format:hover {
852
+ background:#DDD
853
+ }
854
+
855
+ .jqte_format_1, .jqte_format_2, .jqte_format_3, .jqte_format_4, .jqte_format_5, .jqte_format_6 {
856
+ font-weight:bold
857
+ }
858
+
859
+ .jqte_format_1 {
860
+ font-size:22px
861
+ }
862
+
863
+ .jqte_format_2 {
864
+ font-size:20px
865
+ }
866
+
867
+ .jqte_format_3 {
868
+ font-size:18px
869
+ }
870
+
871
+ .jqte_format_4 {
872
+ font-size:16px
873
+ }
874
+
875
+ .jqte_format_5 {
876
+ font-size:14px
877
+ }
878
+
879
+ .jqte_format_6 {
880
+ font-size:12px
881
+ }
882
+
883
+ .jqte_format_7 {
884
+ font-family:"Courier New", Courier, monospace
885
+ }
886
+
887
+ .jqte_fontsizes {
888
+ display:none;
889
+ position:absolute;
890
+ width:180px;
891
+ height:198px;
892
+ oveflow-x:hidden;
893
+ overflow-y:auto;
894
+ background:#FFF;
895
+ border:#AAA 1px solid;
896
+ box-shadow:0 0 5px #AAA; -webkit-box-shadow:0 0 5px #AAA; -moz-box-shadow:0 0 5px #AAA
897
+ }
898
+
899
+ .jqte_fontsize {
900
+ display:block;
901
+ padding:3px 7px;
902
+ }
903
+
904
+ .jqte_fontsize:hover {
905
+ background:#DDD
906
+ }
907
+
908
+ .jqte_cpalette {
909
+ display:none;
910
+ position:absolute;
911
+ padding:6px;
912
+ width:144px;
913
+ background:#FFF;
914
+ border:#AAA 1px solid;
915
+ box-shadow:0 0 5px #AAA; -webkit-box-shadow:0 0 5px #AAA; -moz-box-shadow:0 0 5px #AAA
916
+ }
917
+
918
+ .jqte_color {
919
+ display:block;
920
+ float:left;
921
+ width:16px;
922
+ height:16px;
923
+ border:#FFF 1px solid;
924
+ }
925
+
926
+ .jqte_color:hover {
927
+ border-color:#000
928
+ }
929
+
930
+ .jqte_colorSeperator {
931
+ float:none;
932
+ clear:both;
933
+ height:7px;
934
+ }
935
+
936
+ .jqte_editor, .jqte_source {
937
+ padding:10px;
938
+ background:#FFF;
939
+ min-height:100px;
940
+ max-height:900px;
941
+ overflow:auto;
942
+ outline:none;
943
+ word-wrap:break-word; -ms-word-wrap:break-word;
944
+ resize:vertical
945
+ }
946
+
947
+ .jqte_editor div, .jqte_editor p {
948
+ margin:0 0 7px
949
+ }
950
+
951
+ .jqte_editor a:link, .jqte_editor a:link * {
952
+ color:#0066FF !important;
953
+ text-decoration:underline;
954
+ }
955
+
956
+ .jqte_editor blockquote {
957
+ margin-top:0;
958
+ margin-bottom:7px
959
+ }
960
+
961
+ .jqte_editor img {
962
+ float:left;
963
+ margin:0 10px 5px 0
964
+ }
965
+
966
+ .jqte_editor a[jqte-setlink], .jqte_editor a[jqte-setlink] * {
967
+ background:#3297FD !important;
968
+ color:#FFF !important
969
+ }
970
+
971
+ .jqte_editor h1, .jqte_editor h2, .jqte_editor h3, .jqte_editor h4, .jqte_editor h5, .jqte_editor h6, .jqte_editor pre {
972
+ display:block;
973
+ margin:0 0 3px;
974
+ }
975
+
976
+ .jqte_editor h1, .jqte_editor h1 * {
977
+ font-size:26px
978
+ }
979
+
980
+ .jqte_editor h2, .jqte_editor h2 * {
981
+ font-size:24px
982
+ }
983
+
984
+ .jqte_editor h3, .jqte_editor h3 * {
985
+ font-size:22px
986
+ }
987
+
988
+ .jqte_editor h4, .jqte_editor h4 * {
989
+ font-size:20px
990
+ }
991
+
992
+ .jqte_editor h5, .jqte_editor h5 * {
993
+ font-size:18px
994
+ }
995
+
996
+ .jqte_editor h6, .jqte_editor h6 * {
997
+ font-size:15px
998
+ }
999
+
1000
+ .jqte_editor pre, .jqte_editor pre * {
1001
+ font-family:"Courier New", Courier, monospace
1002
+ }
1003
+
1004
+ .jqte_source, .jqte_source textarea {
1005
+ background:#FFF1E8
1006
+ }
1007
+
1008
+ .jqte_source textarea {
1009
+ margin:0 !important;
1010
+ padding:0 !important;
1011
+ display:block !important;
1012
+ width:100% !important;
1013
+ min-height:100px;
1014
+ font-family:Courier, Arial, sans-serif !important;
1015
+ font-weight:normal;
1016
+ font-size:15px;
1017
+ overflow:hidden !important;
1018
+ outline:none;
1019
+ resize:none;
1020
+ }
1021
+
1022
+ .jqte_source textarea, .jqte_source textarea:focus {
1023
+ css_shadow:none !important;
1024
+ background:none !important;
1025
+ border:none !important;
1026
+ }
1027
+
1028
+ .jqte_title {
1029
+ display:none;
1030
+ position:absolute;
1031
+ z-index:9999;
1032
+ }
1033
+
1034
+ .jqte_titleArrow {
1035
+ position:relative;
1036
+ }
1037
+
1038
+ .jqte_titleArrowIcon {
1039
+ width:7px;
1040
+ height:6px;
1041
+ margin:0 auto;
1042
+ background:url('../images/jquery-te.png') 0 -23px no-repeat;
1043
+ }
1044
+
1045
+ .jqte_titleText {
1046
+ padding:5px 7px;
1047
+ margin-top:0;
1048
+ min-width:5px;
1049
+ min-height:1px;
1050
+ max-width:400px;
1051
+ background:#000;
1052
+ border-radius:3px; -webkit-border-radius:3px; -moz-border-radius:3px;
1053
+ word-wrap:break-word; -ms-word-wrap:break-word
1054
+ }
1055
+
1056
+ .jqte_titleText, .jqte_titleText * {
1057
+ color:#FFF;
1058
+ font-size:11px
1059
+ }
1060
+
1061
+ .jqte_placeholder {
1062
+ position:relative;
1063
+ display:none;
1064
+ }
1065
+
1066
+ .jqte_placeholder_text {
1067
+ position:absolute;
1068
+ top:43px;
1069
+ left:10px;
1070
+ font-size:14px;
1071
+ color:#CCC;
1072
+ }
1073
+
1074
+ @media only screen and (-webkit-min-device-pixel-ratio: 1.5),
1075
+ only screen and (min-resolution: 144dpi),
1076
+ only screen and (min-resolution: 1.5dppx) {
1077
+ .chosen-rtl .chosen-search input[type="text"],
1078
+ .chosen-container-single .chosen-single abbr,
1079
+ .chosen-container-single .chosen-single div b,
1080
+ .chosen-container-single .chosen-search input[type="text"],
1081
+ .chosen-container-multi .chosen-choices .search-choice .search-choice-close,
1082
+ .chosen-container .chosen-results-scroll-down span,
1083
+ .chosen-container .chosen-results-scroll-up span {
1084
+ background-image: url('../images/chosen-sprite@2x.png') !important;
1085
+ background-size: 52px 37px !important;
1086
+ background-repeat: no-repeat !important;
1087
+ }
1088
+
1089
+ }
1090
+
1091
+ /* @end */
1092
+
1093
+ .minicolors {
1094
+ position: relative;
1095
+ }
1096
+
1097
+ .minicolors-sprite {
1098
+ background-image: url(../images/jquery.minicolors.png);
1099
+ }
1100
+
1101
+ .minicolors-swatch {
1102
+ position: absolute;
1103
+ vertical-align: middle;
1104
+ background-position: -80px 0;
1105
+ border: solid 1px #ccc;
1106
+ cursor: text;
1107
+ padding: 0;
1108
+ margin: 0;
1109
+ display: inline-block;
1110
+ }
1111
+
1112
+ .minicolors-swatch-color {
1113
+ position: absolute;
1114
+ top: 0;
1115
+ left: 0;
1116
+ right: 0;
1117
+ bottom: 0;
1118
+ }
1119
+
1120
+ .minicolors input[type=hidden] + .minicolors-swatch {
1121
+ width: 28px;
1122
+ position: static;
1123
+ cursor: pointer;
1124
+ }
1125
+
1126
+ .minicolors input[type=hidden][disabled] + .minicolors-swatch {
1127
+ cursor: default;
1128
+ }
1129
+
1130
+ /* Panel */
1131
+ .minicolors-panel {
1132
+ position: absolute;
1133
+ width: 173px;
1134
+ background: white;
1135
+ border: solid 1px #CCC;
1136
+ box-shadow: 0 0 20px rgba(0, 0, 0, .2);
1137
+ z-index: 99999;
1138
+ box-sizing: content-box;
1139
+ display: none;
1140
+ }
1141
+
1142
+ .minicolors-panel.minicolors-visible {
1143
+ display: block;
1144
+ }
1145
+
1146
+ /* Panel positioning */
1147
+ .minicolors-position-top .minicolors-panel {
1148
+ top: -154px;
1149
+ }
1150
+
1151
+ .minicolors-position-right .minicolors-panel {
1152
+ right: 0;
1153
+ }
1154
+
1155
+ .minicolors-position-bottom .minicolors-panel {
1156
+ top: 30px;
1157
+ }
1158
+
1159
+ .minicolors-position-left .minicolors-panel {
1160
+ left: 0;
1161
+ }
1162
+
1163
+ .minicolors-with-opacity .minicolors-panel {
1164
+ width: 194px;
1165
+ }
1166
+
1167
+ .minicolors .minicolors-grid {
1168
+ position: relative;
1169
+ top: 1px;
1170
+ left: 1px;
1171
+ width: 150px;
1172
+ height: 150px;
1173
+ background-position: -120px 0;
1174
+ cursor: crosshair;
1175
+ }
1176
+
1177
+ .minicolors .minicolors-grid-inner {
1178
+ position: absolute;
1179
+ top: 0;
1180
+ left: 0;
1181
+ width: 150px;
1182
+ height: 150px;
1183
+ }
1184
+
1185
+ .minicolors-slider-saturation .minicolors-grid {
1186
+ background-position: -420px 0;
1187
+ }
1188
+
1189
+ .minicolors-slider-saturation .minicolors-grid-inner {
1190
+ background-position: -270px 0;
1191
+ background-image: inherit;
1192
+ }
1193
+
1194
+ .minicolors-slider-brightness .minicolors-grid {
1195
+ background-position: -570px 0;
1196
+ }
1197
+
1198
+ .minicolors-slider-brightness .minicolors-grid-inner {
1199
+ background-color: black;
1200
+ }
1201
+
1202
+ .minicolors-slider-wheel .minicolors-grid {
1203
+ background-position: -720px 0;
1204
+ }
1205
+
1206
+ .minicolors-slider,
1207
+ .minicolors-opacity-slider {
1208
+ position: absolute;
1209
+ top: 1px;
1210
+ left: 152px;
1211
+ width: 20px;
1212
+ height: 150px;
1213
+ background-color: white;
1214
+ background-position: 0 0;
1215
+ cursor: row-resize;
1216
+ }
1217
+
1218
+ .minicolors-slider-saturation .minicolors-slider {
1219
+ background-position: -60px 0;
1220
+ }
1221
+
1222
+ .minicolors-slider-brightness .minicolors-slider {
1223
+ background-position: -20px 0;
1224
+ }
1225
+
1226
+ .minicolors-slider-wheel .minicolors-slider {
1227
+ background-position: -20px 0;
1228
+ }
1229
+
1230
+ .minicolors-opacity-slider {
1231
+ left: 173px;
1232
+ background-position: -40px 0;
1233
+ display: none;
1234
+ }
1235
+
1236
+ .minicolors-with-opacity .minicolors-opacity-slider {
1237
+ display: block;
1238
+ }
1239
+
1240
+ /* Pickers */
1241
+ .minicolors-grid .minicolors-picker {
1242
+ position: absolute;
1243
+ top: 70px;
1244
+ left: 70px;
1245
+ width: 12px;
1246
+ height: 12px;
1247
+ border: solid 1px black;
1248
+ border-radius: 10px;
1249
+ margin-top: -6px;
1250
+ margin-left: -6px;
1251
+ background: none;
1252
+ }
1253
+
1254
+ .minicolors-grid .minicolors-picker > div {
1255
+ position: absolute;
1256
+ top: 0;
1257
+ left: 0;
1258
+ width: 8px;
1259
+ height: 8px;
1260
+ border-radius: 8px;
1261
+ border: solid 2px white;
1262
+ box-sizing: content-box;
1263
+ }
1264
+
1265
+ .minicolors-picker {
1266
+ position: absolute;
1267
+ top: 0;
1268
+ left: 0;
1269
+ width: 18px;
1270
+ height: 2px;
1271
+ background: white;
1272
+ border: solid 1px black;
1273
+ margin-top: -2px;
1274
+ box-sizing: content-box;
1275
+ }
1276
+
1277
+ /* Swatches */
1278
+ .minicolors-swatches,
1279
+ .minicolors-swatches li {
1280
+ margin: 5px 0 3px 5px;
1281
+ padding: 0;
1282
+ list-style: none;
1283
+ overflow: hidden;
1284
+ }
1285
+
1286
+ .minicolors-swatches .minicolors-swatch {
1287
+ position: relative;
1288
+ float: left;
1289
+ cursor: pointer;
1290
+ margin:0 4px 0 0;
1291
+ }
1292
+
1293
+ .minicolors-with-opacity .minicolors-swatches .minicolors-swatch {
1294
+ margin-right: 7px;
1295
+ }
1296
+
1297
+ .minicolors-swatch.selected {
1298
+ border-color: #000;
1299
+ }
1300
+
1301
+ /* Inline controls */
1302
+ .minicolors-inline {
1303
+ display: inline-block;
1304
+ }
1305
+
1306
+ .minicolors-inline .minicolors-input {
1307
+ display: none !important;
1308
+ }
1309
+
1310
+ .minicolors-inline .minicolors-panel {
1311
+ position: relative;
1312
+ top: auto;
1313
+ left: auto;
1314
+ box-shadow: none;
1315
+ z-index: auto;
1316
+ display: inline-block;
1317
+ }
1318
+
1319
+ /* Default theme */
1320
+ .minicolors-theme-default .minicolors-swatch {
1321
+ top: 5px;
1322
+ left: 5px;
1323
+ width: 18px;
1324
+ height: 18px;
1325
+ }
1326
+ .minicolors-theme-default .minicolors-swatches .minicolors-swatch {
1327
+ margin-bottom: 2px;
1328
+ top: 0;
1329
+ left: 0;
1330
+ width: 18px;
1331
+ height: 18px;
1332
+ }
1333
+ .minicolors-theme-default.minicolors-position-right .minicolors-swatch {
1334
+ left: auto;
1335
+ right: 5px;
1336
+ }
1337
+ .minicolors-theme-default.minicolors {
1338
+ width: auto;
1339
+ display: inline-block;
1340
+ }
1341
+ .minicolors-theme-default .minicolors-input {
1342
+ height: 20px;
1343
+ width: auto;
1344
+ display: inline-block;
1345
+ padding-left: 26px;
1346
+ }
1347
+ .minicolors-theme-default.minicolors-position-right .minicolors-input {
1348
+ padding-right: 26px;
1349
+ padding-left: inherit;
1350
+ }
1351
+
1352
+ /* Bootstrap theme */
1353
+ .minicolors-theme-bootstrap .minicolors-swatch {
1354
+ z-index: 2;
1355
+ top: 3px;
1356
+ left: 3px;
1357
+ width: 28px;
1358
+ height: 28px;
1359
+ border-radius: 3px;
1360
+ }
1361
+ .minicolors-theme-bootstrap .minicolors-swatches .minicolors-swatch {
1362
+ margin-bottom: 2px;
1363
+ top: 0;
1364
+ left: 0;
1365
+ width: 20px;
1366
+ height: 20px;
1367
+ }
1368
+ .minicolors-theme-bootstrap .minicolors-swatch-color {
1369
+ border-radius: inherit;
1370
+ }
1371
+ .minicolors-theme-bootstrap.minicolors-position-right > .minicolors-swatch {
1372
+ left: auto;
1373
+ right: 3px;
1374
+ }
1375
+ .minicolors-theme-bootstrap .minicolors-input {
1376
+ float: none;
1377
+ padding-left: 44px;
1378
+ }
1379
+ .minicolors-theme-bootstrap.minicolors-position-right .minicolors-input {
1380
+ padding-right: 44px;
1381
+ padding-left: 12px;
1382
+ }
1383
+ .minicolors-theme-bootstrap .minicolors-input.input-lg + .minicolors-swatch {
1384
+ top: 4px;
1385
+ left: 4px;
1386
+ width: 37px;
1387
+ height: 37px;
1388
+ border-radius: 5px;
1389
+ }
1390
+ .minicolors-theme-bootstrap .minicolors-input.input-sm + .minicolors-swatch {
1391
+ width: 24px;
1392
+ height: 24px;
1393
+ }
1394
+ .minicolors-theme-bootstrap .minicolors-input.input-xs + .minicolors-swatch {
1395
+ width: 18px;
1396
+ height: 18px;
1397
+ }
1398
+ .input-group .minicolors-theme-bootstrap:not(:first-child) .minicolors-input {
1399
+ border-top-left-radius: 0;
1400
+ border-bottom-left-radius: 0;
1401
+ }
1402
+
1403
+ /* Semantic Ui theme */
1404
+ .minicolors-theme-semanticui .minicolors-swatch {
1405
+ top: 0;
1406
+ left: 0;
1407
+ padding: 18px;
1408
+ }
1409
+ .minicolors-theme-semanticui input {
1410
+ text-indent: 30px;
1411
+ }
controls/assets/images/chosen-sprite.png ADDED
Binary file
controls/assets/images/chosen-sprite@2x.png ADDED
Binary file
controls/assets/images/jquery-te.png ADDED
Binary file
controls/assets/images/jquery.minicolors.png ADDED
Binary file
controls/assets/js/controls.js ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Begin ipCheckbox */
2
+ (function($){
3
+ $.fn.extend({
4
+ ipCheckbox: function () {
5
+ $(this).each(function (){
6
+ var sourceCheckbox = $(this);
7
+ var ipcheckbox = jQuery("<div>",{class: 'ipcheckbox'}).append(jQuery("<div>",{class: 'handle'}));
8
+ if(sourceCheckbox.is(":checked")){ ipcheckbox.addClass("checked"); }
9
+ sourceCheckbox.hide().after(ipcheckbox);
10
+ ipcheckbox.click(function (){
11
+ ipcheckbox.toggleClass("checked");
12
+ if (ipcheckbox.hasClass("checked")){
13
+ sourceCheckbox.prop('checked', true);
14
+ }else{
15
+ sourceCheckbox.prop('checked', false);
16
+ }
17
+ });
18
+ });
19
+ }
20
+ });
21
+ })(jQuery);
22
+ /* End ipCheckbox */
23
+
24
+ /* Begin Chosen Selectbox */
25
+ /*! Chosen v1.8.2 | (c) 2011-2017 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */
26
+ (function(){var t,e,s,i,n=function(t,e){return function(){return t.apply(e,arguments)}},r=function(t,e){function s(){this.constructor=t}for(var i in e)o.call(e,i)&&(t[i]=e[i]);return s.prototype=e.prototype,t.prototype=new s,t.__super__=e.prototype,t},o={}.hasOwnProperty;(i=function(){function t(){this.options_index=0,this.parsed=[]}return t.prototype.add_node=function(t){return"OPTGROUP"===t.nodeName.toUpperCase()?this.add_group(t):this.add_option(t)},t.prototype.add_group=function(t){var e,s,i,n,r,o;for(e=this.parsed.length,this.parsed.push({array_index:e,group:!0,label:t.label,title:t.title?t.title:void 0,children:0,disabled:t.disabled,classes:t.className}),o=[],s=0,i=(r=t.childNodes).length;s<i;s++)n=r[s],o.push(this.add_option(n,e,t.disabled));return o},t.prototype.add_option=function(t,e,s){if("OPTION"===t.nodeName.toUpperCase())return""!==t.text?(null!=e&&(this.parsed[e].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:t.value,text:t.text,html:t.innerHTML,title:t.title?t.title:void 0,selected:t.selected,disabled:!0===s?s:t.disabled,group_array_index:e,group_label:null!=e?this.parsed[e].label:null,classes:t.className,style:t.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1},t}()).select_to_array=function(t){var e,s,n,r,o;for(r=new i,s=0,n=(o=t.childNodes).length;s<n;s++)e=o[s],r.add_node(e);return r.parsed},e=function(){function t(e,s){this.form_field=e,this.options=null!=s?s:{},this.label_click_handler=n(this.label_click_handler,this),t.browser_is_supported()&&(this.is_multiple=this.form_field.multiple,this.set_default_text(),this.set_default_values(),this.setup(),this.set_up_html(),this.register_observers(),this.on_ready())}return t.prototype.set_default_values=function(){return this.click_test_action=function(t){return function(e){return t.test_active_click(e)}}(this),this.activate_action=function(t){return function(e){return t.activate_field(e)}}(this),this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.is_rtl=this.options.rtl||/\bchosen-rtl\b/.test(this.form_field.className),this.allow_single_deselect=null!=this.options.allow_single_deselect&&null!=this.form_field.options[0]&&""===this.form_field.options[0].text&&this.options.allow_single_deselect,this.disable_search_threshold=this.options.disable_search_threshold||0,this.disable_search=this.options.disable_search||!1,this.enable_split_word_search=null==this.options.enable_split_word_search||this.options.enable_split_word_search,this.group_search=null==this.options.group_search||this.options.group_search,this.search_contains=this.options.search_contains||!1,this.single_backstroke_delete=null==this.options.single_backstroke_delete||this.options.single_backstroke_delete,this.max_selected_options=this.options.max_selected_options||Infinity,this.inherit_select_classes=this.options.inherit_select_classes||!1,this.display_selected_options=null==this.options.display_selected_options||this.options.display_selected_options,this.display_disabled_options=null==this.options.display_disabled_options||this.options.display_disabled_options,this.include_group_label_in_selected=this.options.include_group_label_in_selected||!1,this.max_shown_results=this.options.max_shown_results||Number.POSITIVE_INFINITY,this.case_sensitive_search=this.options.case_sensitive_search||!1,this.hide_results_on_select=null==this.options.hide_results_on_select||this.options.hide_results_on_select},t.prototype.set_default_text=function(){return this.form_field.getAttribute("data-placeholder")?this.default_text=this.form_field.getAttribute("data-placeholder"):this.is_multiple?this.default_text=this.options.placeholder_text_multiple||this.options.placeholder_text||t.default_multiple_text:this.default_text=this.options.placeholder_text_single||this.options.placeholder_text||t.default_single_text,this.default_text=this.escape_html(this.default_text),this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||t.default_no_result_text},t.prototype.choice_label=function(t){return this.include_group_label_in_selected&&null!=t.group_label?"<b class='group-name'>"+t.group_label+"</b>"+t.html:t.html},t.prototype.mouse_enter=function(){return this.mouse_on_container=!0},t.prototype.mouse_leave=function(){return this.mouse_on_container=!1},t.prototype.input_focus=function(t){if(this.is_multiple){if(!this.active_field)return setTimeout(function(t){return function(){return t.container_mousedown()}}(this),50)}else if(!this.active_field)return this.activate_field()},t.prototype.input_blur=function(t){if(!this.mouse_on_container)return this.active_field=!1,setTimeout(function(t){return function(){return t.blur_test()}}(this),100)},t.prototype.label_click_handler=function(t){return this.is_multiple?this.container_mousedown(t):this.activate_field()},t.prototype.results_option_build=function(t){var e,s,i,n,r,o,h;for(e="",h=0,n=0,r=(o=this.results_data).length;n<r&&(s=o[n],i="",""!==(i=s.group?this.result_add_group(s):this.result_add_option(s))&&(h++,e+=i),(null!=t?t.first:void 0)&&(s.selected&&this.is_multiple?this.choice_build(s):s.selected&&!this.is_multiple&&this.single_set_selected_text(this.choice_label(s))),!(h>=this.max_shown_results));n++);return e},t.prototype.result_add_option=function(t){var e,s;return t.search_match&&this.include_option_in_results(t)?(e=[],t.disabled||t.selected&&this.is_multiple||e.push("active-result"),!t.disabled||t.selected&&this.is_multiple||e.push("disabled-result"),t.selected&&e.push("result-selected"),null!=t.group_array_index&&e.push("group-option"),""!==t.classes&&e.push(t.classes),s=document.createElement("li"),s.className=e.join(" "),s.style.cssText=t.style,s.setAttribute("data-option-array-index",t.array_index),s.innerHTML=t.highlighted_html||t.html,t.title&&(s.title=t.title),this.outerHTML(s)):""},t.prototype.result_add_group=function(t){var e,s;return(t.search_match||t.group_match)&&t.active_options>0?((e=[]).push("group-result"),t.classes&&e.push(t.classes),s=document.createElement("li"),s.className=e.join(" "),s.innerHTML=t.highlighted_html||this.escape_html(t.label),t.title&&(s.title=t.title),this.outerHTML(s)):""},t.prototype.results_update_field=function(){if(this.set_default_text(),this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.results_build(),this.results_showing)return this.winnow_results()},t.prototype.reset_single_select_options=function(){var t,e,s,i,n;for(n=[],t=0,e=(s=this.results_data).length;t<e;t++)(i=s[t]).selected?n.push(i.selected=!1):n.push(void 0);return n},t.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},t.prototype.results_search=function(t){return this.results_showing?this.winnow_results():this.results_show()},t.prototype.winnow_results=function(){var t,e,s,i,n,r,o,h,l,c,_,a,u,d,p;for(this.no_results_clear(),c=0,t=(o=this.get_search_text()).replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),l=this.get_search_regex(t),s=0,i=(h=this.results_data).length;s<i;s++)(n=h[s]).search_match=!1,_=null,a=null,n.highlighted_html="",this.include_option_in_results(n)&&(n.group&&(n.group_match=!1,n.active_options=0),null!=n.group_array_index&&this.results_data[n.group_array_index]&&(0===(_=this.results_data[n.group_array_index]).active_options&&_.search_match&&(c+=1),_.active_options+=1),p=n.group?n.label:n.text,n.group&&!this.group_search||(a=this.search_string_match(p,l),n.search_match=null!=a,n.search_match&&!n.group&&(c+=1),n.search_match?(o.length&&(u=a.index,r=p.slice(0,u),e=p.slice(u,u+o.length),d=p.slice(u+o.length),n.highlighted_html=this.escape_html(r)+"<em>"+this.escape_html(e)+"</em>"+this.escape_html(d)),null!=_&&(_.group_match=!0)):null!=n.group_array_index&&this.results_data[n.group_array_index].search_match&&(n.search_match=!0)));return this.result_clear_highlight(),c<1&&o.length?(this.update_results_content(""),this.no_results(o)):(this.update_results_content(this.results_option_build()),this.winnow_results_set_highlight())},t.prototype.get_search_regex=function(t){var e,s;return s=this.search_contains?t:"(^|\\s|\\b)"+t+"[^\\s]*",this.enable_split_word_search||this.search_contains||(s="^"+s),e=this.case_sensitive_search?"":"i",new RegExp(s,e)},t.prototype.search_string_match=function(t,e){var s;return s=e.exec(t),!this.search_contains&&(null!=s?s[1]:void 0)&&(s.index+=1),s},t.prototype.choices_count=function(){var t,e,s;if(null!=this.selected_option_count)return this.selected_option_count;for(this.selected_option_count=0,t=0,e=(s=this.form_field.options).length;t<e;t++)s[t].selected&&(this.selected_option_count+=1);return this.selected_option_count},t.prototype.choices_click=function(t){if(t.preventDefault(),this.activate_field(),!this.results_showing&&!this.is_disabled)return this.results_show()},t.prototype.keydown_checker=function(t){var e,s;switch(s=null!=(e=t.which)?e:t.keyCode,this.search_field_scale(),8!==s&&this.pending_backstroke&&this.clear_backstroke(),s){case 8:this.backstroke_length=this.get_search_field_value().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(t),this.mouse_on_container=!1;break;case 13:case 27:this.results_showing&&t.preventDefault();break;case 32:this.disable_search&&t.preventDefault();break;case 38:t.preventDefault(),this.keyup_arrow();break;case 40:t.preventDefault(),this.keydown_arrow()}},t.prototype.keyup_checker=function(t){var e,s;switch(s=null!=(e=t.which)?e:t.keyCode,this.search_field_scale(),s){case 8:this.is_multiple&&this.backstroke_length<1&&this.choices_count()>0?this.keydown_backstroke():this.pending_backstroke||(this.result_clear_highlight(),this.results_search());break;case 13:t.preventDefault(),this.results_showing&&this.result_select(t);break;case 27:this.results_showing&&this.results_hide();break;case 9:case 16:case 17:case 18:case 38:case 40:case 91:break;default:this.results_search()}},t.prototype.clipboard_event_checker=function(t){if(!this.is_disabled)return setTimeout(function(t){return function(){return t.results_search()}}(this),50)},t.prototype.container_width=function(){return null!=this.options.width?this.options.width:this.form_field.offsetWidth+"px"},t.prototype.include_option_in_results=function(t){return!(this.is_multiple&&!this.display_selected_options&&t.selected)&&(!(!this.display_disabled_options&&t.disabled)&&!t.empty)},t.prototype.search_results_touchstart=function(t){return this.touch_started=!0,this.search_results_mouseover(t)},t.prototype.search_results_touchmove=function(t){return this.touch_started=!1,this.search_results_mouseout(t)},t.prototype.search_results_touchend=function(t){if(this.touch_started)return this.search_results_mouseup(t)},t.prototype.outerHTML=function(t){var e;return t.outerHTML?t.outerHTML:((e=document.createElement("div")).appendChild(t),e.innerHTML)},t.prototype.get_single_html=function(){return'<a class="chosen-single chosen-default">\n <span>'+this.default_text+'</span>\n <div><b></b></div>\n</a>\n<div class="chosen-drop">\n <div class="chosen-search">\n <input class="chosen-search-input" type="text" autocomplete="off" />\n </div>\n <ul class="chosen-results"></ul>\n</div>'},t.prototype.get_multi_html=function(){return'<ul class="chosen-choices">\n <li class="search-field">\n <input class="chosen-search-input" type="text" autocomplete="off" value="'+this.default_text+'" />\n </li>\n</ul>\n<div class="chosen-drop">\n <ul class="chosen-results"></ul>\n</div>'},t.prototype.get_no_results_html=function(t){return'<li class="no-results">\n '+this.results_none_found+" <span>"+this.escape_html(t)+"</span>\n</li>"},t.browser_is_supported=function(){return"Microsoft Internet Explorer"===window.navigator.appName?document.documentMode>=8:!(/iP(od|hone)/i.test(window.navigator.userAgent)||/IEMobile/i.test(window.navigator.userAgent)||/Windows Phone/i.test(window.navigator.userAgent)||/BlackBerry/i.test(window.navigator.userAgent)||/BB10/i.test(window.navigator.userAgent)||/Android.*Mobile/i.test(window.navigator.userAgent))},t.default_multiple_text="Select Some Options",t.default_single_text="Select an Option",t.default_no_result_text="No results match",t}(),(t=jQuery).fn.extend({chosen:function(i){return e.browser_is_supported()?this.each(function(e){var n,r;r=(n=t(this)).data("chosen"),"destroy"!==i?r instanceof s||n.data("chosen",new s(this,i)):r instanceof s&&r.destroy()}):this}}),s=function(s){function n(){return n.__super__.constructor.apply(this,arguments)}return r(n,e),n.prototype.setup=function(){return this.form_field_jq=t(this.form_field),this.current_selectedIndex=this.form_field.selectedIndex},n.prototype.set_up_html=function(){var e,s;return(e=["chosen-container"]).push("chosen-container-"+(this.is_multiple?"multi":"single")),this.inherit_select_classes&&this.form_field.className&&e.push(this.form_field.className),this.is_rtl&&e.push("chosen-rtl"),s={"class":e.join(" "),title:this.form_field.title},this.form_field.id.length&&(s.id=this.form_field.id.replace(/[^\w]/g,"_")+"_chosen"),this.container=t("<div />",s),this.container.width(this.container_width()),this.is_multiple?this.container.html(this.get_multi_html()):this.container.html(this.get_single_html()),this.form_field_jq.hide().after(this.container),this.dropdown=this.container.find("div.chosen-drop").first(),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chosen-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chosen-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chosen-search").first(),this.selected_item=this.container.find(".chosen-single").first()),this.results_build(),this.set_tab_index(),this.set_label_behavior()},n.prototype.on_ready=function(){return this.form_field_jq.trigger("chosen:ready",{chosen:this})},n.prototype.register_observers=function(){return this.container.on("touchstart.chosen",function(t){return function(e){t.container_mousedown(e)}}(this)),this.container.on("touchend.chosen",function(t){return function(e){t.container_mouseup(e)}}(this)),this.container.on("mousedown.chosen",function(t){return function(e){t.container_mousedown(e)}}(this)),this.container.on("mouseup.chosen",function(t){return function(e){t.container_mouseup(e)}}(this)),this.container.on("mouseenter.chosen",function(t){return function(e){t.mouse_enter(e)}}(this)),this.container.on("mouseleave.chosen",function(t){return function(e){t.mouse_leave(e)}}(this)),this.search_results.on("mouseup.chosen",function(t){return function(e){t.search_results_mouseup(e)}}(this)),this.search_results.on("mouseover.chosen",function(t){return function(e){t.search_results_mouseover(e)}}(this)),this.search_results.on("mouseout.chosen",function(t){return function(e){t.search_results_mouseout(e)}}(this)),this.search_results.on("mousewheel.chosen DOMMouseScroll.chosen",function(t){return function(e){t.search_results_mousewheel(e)}}(this)),this.search_results.on("touchstart.chosen",function(t){return function(e){t.search_results_touchstart(e)}}(this)),this.search_results.on("touchmove.chosen",function(t){return function(e){t.search_results_touchmove(e)}}(this)),this.search_results.on("touchend.chosen",function(t){return function(e){t.search_results_touchend(e)}}(this)),this.form_field_jq.on("chosen:updated.chosen",function(t){return function(e){t.results_update_field(e)}}(this)),this.form_field_jq.on("chosen:activate.chosen",function(t){return function(e){t.activate_field(e)}}(this)),this.form_field_jq.on("chosen:open.chosen",function(t){return function(e){t.container_mousedown(e)}}(this)),this.form_field_jq.on("chosen:close.chosen",function(t){return function(e){t.close_field(e)}}(this)),this.search_field.on("blur.chosen",function(t){return function(e){t.input_blur(e)}}(this)),this.search_field.on("keyup.chosen",function(t){return function(e){t.keyup_checker(e)}}(this)),this.search_field.on("keydown.chosen",function(t){return function(e){t.keydown_checker(e)}}(this)),this.search_field.on("focus.chosen",function(t){return function(e){t.input_focus(e)}}(this)),this.search_field.on("cut.chosen",function(t){return function(e){t.clipboard_event_checker(e)}}(this)),this.search_field.on("paste.chosen",function(t){return function(e){t.clipboard_event_checker(e)}}(this)),this.is_multiple?this.search_choices.on("click.chosen",function(t){return function(e){t.choices_click(e)}}(this)):this.container.on("click.chosen",function(t){t.preventDefault()})},n.prototype.destroy=function(){return t(this.container[0].ownerDocument).off("click.chosen",this.click_test_action),this.form_field_label.length>0&&this.form_field_label.off("click.chosen"),this.search_field[0].tabIndex&&(this.form_field_jq[0].tabIndex=this.search_field[0].tabIndex),this.container.remove(),this.form_field_jq.removeData("chosen"),this.form_field_jq.show()},n.prototype.search_field_disabled=function(){return this.is_disabled=this.form_field.disabled||this.form_field_jq.parents("fieldset").is(":disabled"),this.container.toggleClass("chosen-disabled",this.is_disabled),this.search_field[0].disabled=this.is_disabled,this.is_multiple||this.selected_item.off("focus.chosen",this.activate_field),this.is_disabled?this.close_field():this.is_multiple?void 0:this.selected_item.on("focus.chosen",this.activate_field)},n.prototype.container_mousedown=function(e){var s;if(!this.is_disabled)return!e||"mousedown"!==(s=e.type)&&"touchstart"!==s||this.results_showing||e.preventDefault(),null!=e&&t(e.target).hasClass("search-choice-close")?void 0:(this.active_field?this.is_multiple||!e||t(e.target)[0]!==this.selected_item[0]&&!t(e.target).parents("a.chosen-single").length||(e.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),t(this.container[0].ownerDocument).on("click.chosen",this.click_test_action),this.results_show()),this.activate_field())},n.prototype.container_mouseup=function(t){if("ABBR"===t.target.nodeName&&!this.is_disabled)return this.results_reset(t)},n.prototype.search_results_mousewheel=function(t){var e;if(t.originalEvent&&(e=t.originalEvent.deltaY||-t.originalEvent.wheelDelta||t.originalEvent.detail),null!=e)return t.preventDefault(),"DOMMouseScroll"===t.type&&(e*=40),this.search_results.scrollTop(e+this.search_results.scrollTop())},n.prototype.blur_test=function(t){if(!this.active_field&&this.container.hasClass("chosen-container-active"))return this.close_field()},n.prototype.close_field=function(){return t(this.container[0].ownerDocument).off("click.chosen",this.click_test_action),this.active_field=!1,this.results_hide(),this.container.removeClass("chosen-container-active"),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale(),this.search_field.blur()},n.prototype.activate_field=function(){if(!this.is_disabled)return this.container.addClass("chosen-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()},n.prototype.test_active_click=function(e){var s;return(s=t(e.target).closest(".chosen-container")).length&&this.container[0]===s[0]?this.active_field=!0:this.close_field()},n.prototype.results_build=function(){return this.parsing=!0,this.selected_option_count=null,this.results_data=i.select_to_array(this.form_field),this.is_multiple?this.search_choices.find("li.search-choice").remove():this.is_multiple||(this.single_set_selected_text(),this.disable_search||this.form_field.options.length<=this.disable_search_threshold?(this.search_field[0].readOnly=!0,this.container.addClass("chosen-container-single-nosearch")):(this.search_field[0].readOnly=!1,this.container.removeClass("chosen-container-single-nosearch"))),this.update_results_content(this.results_option_build({first:!0})),this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.parsing=!1},n.prototype.result_do_highlight=function(t){var e,s,i,n,r;if(t.length){if(this.result_clear_highlight(),this.result_highlight=t,this.result_highlight.addClass("highlighted"),i=parseInt(this.search_results.css("maxHeight"),10),r=this.search_results.scrollTop(),n=i+r,s=this.result_highlight.position().top+this.search_results.scrollTop(),(e=s+this.result_highlight.outerHeight())>=n)return this.search_results.scrollTop(e-i>0?e-i:0);if(s<r)return this.search_results.scrollTop(s)}},n.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClass("highlighted"),this.result_highlight=null},n.prototype.results_show=function(){return this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.container.addClass("chosen-with-drop"),this.results_showing=!0,this.search_field.focus(),this.search_field.val(this.get_search_field_value()),this.winnow_results(),this.form_field_jq.trigger("chosen:showing_dropdown",{chosen:this}))},n.prototype.update_results_content=function(t){return this.search_results.html(t)},n.prototype.results_hide=function(){return this.results_showing&&(this.result_clear_highlight(),this.container.removeClass("chosen-with-drop"),this.form_field_jq.trigger("chosen:hiding_dropdown",{chosen:this})),this.results_showing=!1},n.prototype.set_tab_index=function(t){var e;if(this.form_field.tabIndex)return e=this.form_field.tabIndex,this.form_field.tabIndex=-1,this.search_field[0].tabIndex=e},n.prototype.set_label_behavior=function(){if(this.form_field_label=this.form_field_jq.parents("label"),!this.form_field_label.length&&this.form_field.id.length&&(this.form_field_label=t("label[for='"+this.form_field.id+"']")),this.form_field_label.length>0)return this.form_field_label.on("click.chosen",this.label_click_handler)},n.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices_count()<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},n.prototype.search_results_mouseup=function(e){var s;if((s=t(e.target).hasClass("active-result")?t(e.target):t(e.target).parents(".active-result").first()).length)return this.result_highlight=s,this.result_select(e),this.search_field.focus()},n.prototype.search_results_mouseover=function(e){var s;if(s=t(e.target).hasClass("active-result")?t(e.target):t(e.target).parents(".active-result").first())return this.result_do_highlight(s)},n.prototype.search_results_mouseout=function(e){if(t(e.target).hasClass("active-result")||t(e.target).parents(".active-result").first())return this.result_clear_highlight()},n.prototype.choice_build=function(e){var s,i;return s=t("<li />",{"class":"search-choice"}).html("<span>"+this.choice_label(e)+"</span>"),e.disabled?s.addClass("search-choice-disabled"):((i=t("<a />",{"class":"search-choice-close","data-option-array-index":e.array_index})).on("click.chosen",function(t){return function(e){return t.choice_destroy_link_click(e)}}(this)),s.append(i)),this.search_container.before(s)},n.prototype.choice_destroy_link_click=function(e){if(e.preventDefault(),e.stopPropagation(),!this.is_disabled)return this.choice_destroy(t(e.target))},n.prototype.choice_destroy=function(t){if(this.result_deselect(t[0].getAttribute("data-option-array-index")))return this.active_field?this.search_field.focus():this.show_search_field_default(),this.is_multiple&&this.choices_count()>0&&this.get_search_field_value().length<1&&this.results_hide(),t.parents("li").first().remove(),this.search_field_scale()},n.prototype.results_reset=function(){if(this.reset_single_select_options(),this.form_field.options[0].selected=!0,this.single_set_selected_text(),this.show_search_field_default(),this.results_reset_cleanup(),this.trigger_form_field_change(),this.active_field)return this.results_hide()},n.prototype.results_reset_cleanup=function(){return this.current_selectedIndex=this.form_field.selectedIndex,this.selected_item.find("abbr").remove()},n.prototype.result_select=function(t){var e,s;if(this.result_highlight)return e=this.result_highlight,this.result_clear_highlight(),this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.is_multiple?e.removeClass("active-result"):this.reset_single_select_options(),e.addClass("result-selected"),s=this.results_data[e[0].getAttribute("data-option-array-index")],s.selected=!0,this.form_field.options[s.options_index].selected=!0,this.selected_option_count=null,this.search_field.val(""),this.is_multiple?this.choice_build(s):this.single_set_selected_text(this.choice_label(s)),this.is_multiple&&(!this.hide_results_on_select||t.metaKey||t.ctrlKey)?this.winnow_results():(this.results_hide(),this.show_search_field_default()),(this.is_multiple||this.form_field.selectedIndex!==this.current_selectedIndex)&&this.trigger_form_field_change({selected:this.form_field.options[s.options_index].value}),this.current_selectedIndex=this.form_field.selectedIndex,t.preventDefault(),this.search_field_scale())},n.prototype.single_set_selected_text=function(t){return null==t&&(t=this.default_text),t===this.default_text?this.selected_item.addClass("chosen-default"):(this.single_deselect_control_build(),this.selected_item.removeClass("chosen-default")),this.selected_item.find("span").html(t)},n.prototype.result_deselect=function(t){var e;return e=this.results_data[t],!this.form_field.options[e.options_index].disabled&&(e.selected=!1,this.form_field.options[e.options_index].selected=!1,this.selected_option_count=null,this.result_clear_highlight(),this.results_showing&&this.winnow_results(),this.trigger_form_field_change({deselected:this.form_field.options[e.options_index].value}),this.search_field_scale(),!0)},n.prototype.single_deselect_control_build=function(){if(this.allow_single_deselect)return this.selected_item.find("abbr").length||this.selected_item.find("span").first().after('<abbr class="search-choice-close"></abbr>'),this.selected_item.addClass("chosen-single-with-deselect")},n.prototype.get_search_field_value=function(){return this.search_field.val()},n.prototype.get_search_text=function(){return t.trim(this.get_search_field_value())},n.prototype.escape_html=function(e){return t("<div/>").text(e).html()},n.prototype.winnow_results_set_highlight=function(){var t,e;if(e=this.is_multiple?[]:this.search_results.find(".result-selected.active-result"),null!=(t=e.length?e.first():this.search_results.find(".active-result").first()))return this.result_do_highlight(t)},n.prototype.no_results=function(t){var e;return e=this.get_no_results_html(t),this.search_results.append(e),this.form_field_jq.trigger("chosen:no_results",{chosen:this})},n.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},n.prototype.keydown_arrow=function(){var t;return this.results_showing&&this.result_highlight?(t=this.result_highlight.nextAll("li.active-result").first())?this.result_do_highlight(t):void 0:this.results_show()},n.prototype.keyup_arrow=function(){var t;return this.results_showing||this.is_multiple?this.result_highlight?(t=this.result_highlight.prevAll("li.active-result")).length?this.result_do_highlight(t.first()):(this.choices_count()>0&&this.results_hide(),this.result_clear_highlight()):void 0:this.results_show()},n.prototype.keydown_backstroke=function(){var t;return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke()):(t=this.search_container.siblings("li.search-choice").last()).length&&!t.hasClass("search-choice-disabled")?(this.pending_backstroke=t,this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClass("search-choice-focus")):void 0},n.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},n.prototype.search_field_scale=function(){var e,s,i,n,r,o,h;if(this.is_multiple){for(r={position:"absolute",left:"-1000px",top:"-1000px",display:"none",whiteSpace:"pre"},s=0,i=(o=["fontSize","fontStyle","fontWeight","fontFamily","lineHeight","textTransform","letterSpacing"]).length;s<i;s++)r[n=o[s]]=this.search_field.css(n);return(e=t("<div />").css(r)).text(this.get_search_field_value()),t("body").append(e),h=e.width()+25,e.remove(),this.container.is(":visible")&&(h=Math.min(this.container.outerWidth()-10,h)),this.search_field.width(h)}},n.prototype.trigger_form_field_change=function(t){return this.form_field_jq.trigger("input",t),this.form_field_jq.trigger("change",t)},n}()}).call(this);
27
+ /* End Chosen Selectbox */
28
+
29
+ /* Begin jQuery TE */
30
+ /*!
31
+ *
32
+ * jQuery TE 1.4.0 , http://jqueryte.com/
33
+ * Copyright (C) 2013, Fatih Koca (fattih@fattih.com), (http://jqueryte.com/about)
34
+
35
+ * jQuery TE is provided under the MIT LICENSE.
36
+ *
37
+ */
38
+ (function(e){e.fn.jqte=function(t){function l(e,t,n,r,i){var s=f.length+1;return f.push({name:e,cls:s,command:t,key:n,tag:r,emphasis:i})}var n=[{title:"Text Format"},{title:"Font Size"},{title:"Color"},{title:"Bold",hotkey:"B"},{title:"Italic",hotkey:"I"},{title:"Underline",hotkey:"U"},{title:"Ordered List",hotkey:"."},{title:"Unordered List",hotkey:","},{title:"Subscript",hotkey:"down arrow"},{title:"Superscript",hotkey:"up arrow"},{title:"Outdent",hotkey:"left arrow"},{title:"Indent",hotkey:"right arrow"},{title:"Justify Left"},{title:"Justify Center"},{title:"Justify Right"},{title:"Strike Through",hotkey:"K"},{title:"Add Link",hotkey:"L"},{title:"Remove Link"},{title:"Cleaner Style",hotkey:"Delete"},{title:"Horizontal Rule",hotkey:"H"},{title:"Source"}];var r=[["p","Normal"],["h1","Header 1"],["h2","Header 2"],["h3","Header 3"],["h4","Header 4"],["h5","Header 5"],["h6","Header 6"],["pre","Preformatted"]];var i=["10","12","16","18","20","24","28"];var s=["0,0,0","68,68,68","102,102,102","153,153,153","204,204,204","238,238,238","243,243,243","255,255,255",null,"255,0,0","255,153,0","255,255,0","0,255,0","0,255,255","0,0,255","153,0,255","255,0,255",null,"244,204,204","252,229,205","255,242,204","217,234,211","208,224,227","207,226,243","217,210,233","234,209,220","234,153,153","249,203,156","255,229,153","182,215,168","162,196,201","159,197,232","180,167,214","213,166,189","224,102,102","246,178,107","255,217,102","147,196,125","118,165,175","111,168,220","142,124,195","194,123,160","204,0,0","230,145,56","241,194,50","106,168,79","69,129,142","61,133,198","103,78,167","166,77,121","153,0,0","180,95,6","191,144,0","56,118,29","19,79,92","11,83,148","53,28,117","116,27,71","102,0,0","120,63,4","127,96,0","39,78,19","12,52,61","7,55,99","32,18,77","76,17,48"];var o=["Web Address","E-mail Address","Picture URL"];var u=e.extend({status:true,css:"jqte",title:true,titletext:n,button:"OK",format:true,formats:r,fsize:true,fsizes:i,funit:"px",color:true,linktypes:o,b:true,i:true,u:true,ol:true,ul:true,sub:true,sup:true,outdent:true,indent:true,left:true,center:true,right:true,strike:true,link:true,unlink:true,remove:true,rule:true,source:true,placeholder:false,br:true,p:true,change:"",focus:"",blur:""},t);e.fn.jqteVal=function(t){e(this).closest("."+u.css).find("."+u.css+"_editor").html(t)};var a=navigator.userAgent.toLowerCase();if(/msie [1-7]./.test(a))u.title=false;var f=[];l("format","formats","","",false);l("fsize","fSize","","",false);l("color","colors","","",false);l("b","Bold","B",["b","strong"],true);l("i","Italic","I",["i","em"],true);l("u","Underline","U",["u"],true);l("ol","insertorderedlist","¾",["ol"],true);l("ul","insertunorderedlist","¼",["ul"],true);l("sub","subscript","(",["sub"],true);l("sup","superscript","&",["sup"],true);l("outdent","outdent","%",["blockquote"],false);l("indent","indent","'",["blockquote"],true);l("left","justifyLeft","","",false);l("center","justifyCenter","","",false);l("right","justifyRight","","",false);l("strike","strikeThrough","K",["strike"],true);l("link","linkcreator","L",["a"],true);l("unlink","unlink","",["a"],false);l("remove","removeformat",".","",false);l("rule","inserthorizontalrule","H",["hr"],false);l("source","displaysource","","",false);return this.each(function(){function B(){if(window.getSelection)return window.getSelection();else if(document.selection&&document.selection.createRange&&document.selection.type!="None")return document.selection.createRange()}function j(e,t){var n,r=B();if(window.getSelection){if(r.anchorNode&&r.getRangeAt)n=r.getRangeAt(0);if(n){r.removeAllRanges();r.addRange(n)}if(!a.match(/msie/))document.execCommand("StyleWithCSS",false,false);document.execCommand(e,false,t)}else if(document.selection&&document.selection.createRange&&document.selection.type!="None"){n=document.selection.createRange();n.execCommand(e,false,t)}q(false,false)}function F(t,n,r){if(v.not(":focus"))v.focus();if(window.getSelection){var i=B(),s,o,u;if(i.anchorNode&&i.getRangeAt){s=i.getRangeAt(0);o=document.createElement(t);e(o).attr(n,r);u=s.extractContents();o.appendChild(u);s.insertNode(o);i.removeAllRanges();if(n=="style")q(e(o),r);else q(e(o),false)}}else if(document.selection&&document.selection.createRange&&document.selection.type!="None"){var a=document.selection.createRange();var f=a.htmlText;var l="<"+t+" "+n+'="'+r+'">'+f+"</"+t+">";document.selection.createRange().pasteHTML(l)}}function q(e,t){var n=I();n=n?n:e;if(n&&t==false){if(n.parent().is("[style]"))n.attr("style",n.parent().attr("style"));if(n.is("[style]"))n.find("*").attr("style",n.attr("style"))}else if(e&&t&&e.is("[style]")){var r=t.split(";");r=r[0].split(":");if(e.is("[style*="+r[0]+"]"))e.find("*").css(r[0],r[1]);R(e)}}function R(t){if(t){var t=t[0];if(document.body.createTextRange){var n=document.body.createTextRange();n.moveToElementText(t);n.select()}else if(window.getSelection){var r=window.getSelection();var n=document.createRange();if(t!="undefined"&&t!=null){n.selectNodeContents(t);r.removeAllRanges();r.addRange(n);if(e(t).is(":empty")){e(t).append(" ");R(e(t))}}}}}function U(){if(!p.data("sourceOpened")){var t=I();var n="http://";W(true);if(t){var r=t.prop("tagName").toLowerCase();if(r=="a"&&t.is("[href]")){n=t.attr("href");t.attr(S,"")}else F("a",S,"")}else y.val(n).focus();g.click(function(t){if(e(t.target).hasClass(u.css+"_linktypetext")||e(t.target).hasClass(u.css+"_linktypearrow"))X(true)});w.find("a").click(function(){var t=e(this).attr(u.css+"-linktype");w.data("linktype",t);E.find("."+u.css+"_linktypetext").html(w.find("a:eq("+w.data("linktype")+")").text());V(n);X()});V(n);y.focus().val(n).bind("keypress keyup",function(e){if(e.keyCode==13){z(h.find("["+S+"]"));return false}});b.click(function(){z(h.find("["+S+"]"))})}else W(false)}function z(t){y.focus();R(t);t.removeAttr(S);if(w.data("linktype")!="2")j("createlink",y.val());else{j("insertImage",y.val());v.find("img").each(function(){var t=e(this).prev("a");var n=e(this).next("a");if(t.length>0&&t.html()=="")t.remove();else if(n.length>0&&n.html()=="")n.remove()})}W();v.trigger("change")}function W(e){Q("["+S+"]:not([href])");h.find("["+S+"][href]").removeAttr(S);if(e){p.data("linkOpened",true);d.show()}else{p.data("linkOpened",false);d.hide()}X()}function X(e){if(e)w.show();else w.hide()}function V(e){var t=w.data("linktype");if(t=="1"&&(y.val()=="http://"||y.is("[value^=http://]")||!y.is("[value^=mailto]")))y.val("mailto:");else if(t!="1"&&!y.is("[value^=http://]"))y.val("http://");else y.val(e)}function J(t){if(!p.data("sourceOpened")){if(t=="fSize")styleField=P;else if(t=="colors")styleField=H;K(styleField,true);styleField.find("a").unbind("click").click(function(){var n=e(this).attr(u.css+"-styleval");if(t=="fSize"){styleType="font-size";n=n+u.funit}else if(t=="colors"){styleType="color";n="rgb("+n+")"}var r=G(styleType);F("span","style",styleType+":"+n+";"+r);K("",false);e("."+u.css+"_title").remove();v.trigger("change")})}else K(styleField,false);W(false)}function K(e,t){var n="",r=[{d:"fsizeOpened",f:P},{d:"cpallOpened",f:H}];if(e!=""){for(var i=0;i<r.length;i++){if(e==r[i]["f"])n=r[i]}}if(t){p.data(n["d"],true);n["f"].slideDown(100);for(var i=0;i<r.length;i++){if(n["d"]!=r[i]["d"]){p.data(r[i]["d"],false);r[i]["f"].slideUp(100)}}}else{for(var i=0;i<r.length;i++){p.data(r[i]["d"],false);r[i]["f"].slideUp(100)}}}function Q(t){h.find(t).each(function(){e(this).before(e(this).html()).remove()})}function G(e){var t=I();if(t&&t.is("[style]")&&t.css(e)!=""){var n=t.css(e);t.css(e,"");var r=t.attr("style");t.css(e,n);return r}else return""}function Y(){Z(true);D.find("a").click(function(){e("*",this).click(function(e){e.preventDefault();return false});et(e(this).text());var t=e(this).attr(u.css+"-formatval");j("formatBlock","<"+t+">");Z(false)})}function Z(e){var t=e?true:false;t=e&&D.data("status")?true:false;if(t||!e)D.data("status",false).slideUp(200);else D.data("status",true).slideDown(200)}function et(e){var t=D.closest("."+u.css+"_tool").find("."+u.css+"_tool_label").find("."+u.css+"_tool_text");if(e.length>10)e=e.substr(0,7)+"...";t.html(e)}function tt(e){var t,n,r;t=e.replace(/\n/gim,"").replace(/\r/gim,"").replace(/\t/gim,"").replace(/ /gim," ");n=[/\<span(|\s+.*?)><span(|\s+.*?)>(.*?)<\/span><\/span>/gim,/<(\w*[^p])\s*[^\/>]*>\s*<\/\1>/gim,/\<div(|\s+.*?)>(.*?)\<\/div>/gim,/\<strong(|\s+.*?)>(.*?)\<\/strong>/gim,/\<em(|\s+.*?)>(.*?)\<\/em>/gim];r=["<span$2>$3</span>","","<p$1>$2</p>","<b$1>$2</b>","<i$1>$2</i>"];for(A=0;A<5;A++){for(var i=0;i<n.length;i++){t=t.replace(n[i],r[i])}}if(!u.p)t=t.replace(/\<p(|\s+.*?)>(.*?)\<\/p>/ig,"<br/>$2");if(!u.br){n=[/\<br>(.*?)/ig,/\<br\/>(.*?)/ig];r=["<p>$1</p>","<p>$1</p>"];for(var i=0;i<n.length;i++){t=t.replace(n[i],r[i])}}if(!u.p&&!u.br)t=t.replace(/\<p>(.*?)\<\/p>/ig,"<div>$1</div>");return t}function nt(){var e=v.text()==""&&v.html().length<12?"":v.html();l.val(tt(e))}function rt(){v.html(tt(l.val()))}function it(t){var n=false,r=I(),i;if(r){e.each(t,function(t,s){i=r.prop("tagName").toLowerCase();if(i==s)n=true;else{r.parents().each(function(){i=e(this).prop("tagName").toLowerCase();if(i==s)n=true})}});return n}else return false}function st(t){for(var n=0;n<f.length;n++){if(u[f[n].name]&&f[n].emphasis&&f[n].tag!="")it(f[n].tag)?p.find("."+u.css+"_tool_"+f[n].cls).addClass(m):e("."+u.css+"_tool_"+f[n].cls).removeClass(m)}if(u.format&&e.isArray(u.formats)){var r=false;for(var i=0;i<u.formats.length;i++){var s=[];s[0]=u.formats[i][0];if(u.formats[i][0].length>0&&it(s)){et(u.formats[i][1]);r=true;break}}if(!r)et(u.formats[0][1])}K("",false);Z(false)}if(!e(this).data("jqte")||e(this).data("jqte")==null||e(this).data("jqte")=="undefined")e(this).data("jqte",true);else e(this).data("jqte",false);if(!u.status||!e(this).data("jqte")){if(e(this).closest("."+u.css).length>0){var t=e(this).closest("."+u.css).find("."+u.css+"_editor").html();var n="";e(e(this)[0].attributes).each(function(){if(this.nodeName!="style")n=n+" "+this.nodeName+'="'+this.nodeValue+'"'});var r=e(this).is("[data-origin]")&&e(this).attr("data-origin")!=""?e(this).attr("data-origin"):"textarea";var i=">"+t;if(r=="input"||r=="option"){t=t.replace(/"/g,"&#34;").replace(/'/g,"&#39;").replace(/</g,"<").replace(/>/g,">");i='value="'+t+'">'}var o=e(this).clone();e(this).data("jqte",false).closest("."+u.css).before(o).remove();o.replaceWith("<"+r+n+i+"</"+r+">")}return}var l=e(this);var r=e(this).prop("tagName").toLowerCase();e(this).attr("data-origin",r);var c=e(this).is("[value]")||r=="textarea"?e(this).val():e(this).html();c=c.replace(/&#34;/g,'"').replace(/&#39;/g,"'").replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");e(this).after('<div class="'+u.css+'"></div>');var h=e(this).next("."+u.css);h.html('<div class="'+u.css+"_toolbar"+'" role="toolbar" unselectable></div><div class="'+u.css+'_linkform" style="display:none" role="dialog"></div><div class="'+u.css+"_editor"+'"></div>');var p=h.find("."+u.css+"_toolbar");var d=h.find("."+u.css+"_linkform");var v=h.find("."+u.css+"_editor");var m=u.css+"_tool_depressed";d.append('<div class="'+u.css+'_linktypeselect" unselectable></div><input class="'+u.css+'_linkinput" type="text/css" value=""><div class="'+u.css+'_linkbutton" unselectable>'+u.button+'</div> <div style="height:1px;float:none;clear:both"></div>');var g=d.find("."+u.css+"_linktypeselect");var y=d.find("."+u.css+"_linkinput");var b=d.find("."+u.css+"_linkbutton");g.append('<div class="'+u.css+'_linktypeview" unselectable></div><div class="'+u.css+'_linktypes" role="menu" unselectable></div>');var w=g.find("."+u.css+"_linktypes");var E=g.find("."+u.css+"_linktypeview");var S=u.css+"-setlink";v.after('<div class="'+u.css+"_source "+u.css+'_hiddenField"></div>');var x=h.find("."+u.css+"_source");l.appendTo(x);if(r!="textarea"){var n="";e(l[0].attributes).each(function(){if(this.nodeName!="type"&&this.nodeName!="value")n=n+" "+this.nodeName+'="'+this.nodeValue+'"'});l.replaceWith("<textarea "+n+">"+c+"</textarea>");l=x.find("textarea")}v.attr("contenteditable","true").html(c);for(var T=0;T<f.length;T++){if(u[f[T].name]){var N=f[T].key.length>0?u.titletext[T].hotkey!=null&&u.titletext[T].hotkey!="undefined"&&u.titletext[T].hotkey!=""?" (Ctrl+"+u.titletext[T].hotkey+")":"":"";var C=u.titletext[T].title!=null&&u.titletext[T].title!="undefined"&&u.titletext[T].title!=""?u.titletext[T].title+N:"";p.append('<div class="'+u.css+"_tool "+u.css+"_tool_"+f[T].cls+'" role="button" data-tool="'+T+'" unselectable><a class="'+u.css+'_tool_icon" unselectable></a></div>');p.find("."+u.css+"_tool[data-tool="+T+"]").data({tag:f[T].tag,command:f[T].command,emphasis:f[T].emphasis,title:C});if(f[T].name=="format"&&e.isArray(u.formats)){var k=u.formats[0][1].length>0&&u.formats[0][1]!="undefined"?u.formats[0][1]:"";p.find("."+u.css+"_tool_"+f[T].cls).find("."+u.css+"_tool_icon").replaceWith('<a class="'+u.css+'_tool_label" unselectable><span class="'+u.css+'_tool_text" unselectable>'+k+'</span><span class="'+u.css+'_tool_icon" unselectable></span></a>');p.find("."+u.css+"_tool_"+f[T].cls).append('<div class="'+u.css+'_formats" unselectable></div>');for(var L=0;L<u.formats.length;L++){p.find("."+u.css+"_formats").append("<a "+u.css+'-formatval="'+u.formats[L][0]+'" class="'+u.css+"_format"+" "+u.css+"_format_"+L+'" role="menuitem" unselectable>'+u.formats[L][1]+"</a>")}p.find("."+u.css+"_formats").data("status",false)}else if(f[T].name=="fsize"&&e.isArray(u.fsizes)){p.find("."+u.css+"_tool_"+f[T].cls).append('<div class="'+u.css+'_fontsizes" unselectable></div>');for(var L=0;L<u.fsizes.length;L++){p.find("."+u.css+"_fontsizes").append("<a "+u.css+'-styleval="'+u.fsizes[L]+'" class="'+u.css+"_fontsize"+'" style="font-size:'+u.fsizes[L]+u.funit+'" role="menuitem" unselectable>Abcdefgh...</a>')}}else if(f[T].name=="color"&&e.isArray(s)){p.find("."+u.css+"_tool_"+f[T].cls).append('<div class="'+u.css+'_cpalette" unselectable></div>');for(var A=0;A<s.length;A++){if(s[A]!=null)p.find("."+u.css+"_cpalette").append("<a "+u.css+'-styleval="'+s[A]+'" class="'+u.css+"_color"+'" style="background-color: rgb('+s[A]+')" role="gridcell" unselectable></a>');else p.find("."+u.css+"_cpalette").append('<div class="'+u.css+"_colorSeperator"+'"></div>')}}}}w.data("linktype","0");for(var T=0;T<3;T++){w.append("<a "+u.css+'-linktype="'+T+'" unselectable>'+u.linktypes[T]+"</a>");E.html('<div class="'+u.css+'_linktypearrow" unselectable></div><div class="'+u.css+'_linktypetext">'+w.find("a:eq("+w.data("linktype")+")").text()+"</div>")}var O="";if(/msie/.test(a))O="-ms-";else if(/chrome/.test(a)||/safari/.test(a)||/yandex/.test(a))O="-webkit-";else if(/mozilla/.test(a))O="-moz-";else if(/opera/.test(a))O="-o-";else if(/konqueror/.test(a))O="-khtml-";else O="";if(u.placeholder&&u.placeholder!=""){h.prepend('<div class="'+u.css+'_placeholder" unselectable><div class="'+u.css+'_placeholder_text">'+u.placeholder+"</div></div>");var M=h.find("."+u.css+"_placeholder");M.click(function(){v.focus()})}h.find("[unselectable]").css(O+"user-select","none").addClass("unselectable").attr("unselectable","on").on("selectstart mousedown",false);var _=p.find("."+u.css+"_tool");var D=p.find("."+u.css+"_formats");var P=p.find("."+u.css+"_fontsizes");var H=p.find("."+u.css+"_cpalette");var I=function(){var t,n;if(window.getSelection){n=getSelection();t=n.anchorNode}if(!t&&document.selection&&document.selection.createRange&&document.selection.type!="None"){n=document.selection;var r=n.getRangeAt?n.getRangeAt(0):n.createRange();t=r.commonAncestorContainer?r.commonAncestorContainer:r.parentElement?r.parentElement():r.item(0)}if(t){return t.nodeName=="#text"?e(t.parentNode):e(t)}else return false};_.unbind("click").click(function(t){if(e(this).data("command")=="displaysource"&&!p.data("sourceOpened")){p.find("."+u.css+"_tool").addClass(u.css+"_hiddenField");e(this).removeClass(u.css+"_hiddenField");p.data("sourceOpened",true);l.css("height",v.outerHeight());x.removeClass(u.css+"_hiddenField");v.addClass(u.css+"_hiddenField");l.focus();W(false);K("",false);Z();if(u.placeholder&&u.placeholder!="")M.hide()}else{if(!p.data("sourceOpened")){if(e(this).data("command")=="linkcreator"){if(!p.data("linkOpened"))U();else{W(false);Z(false)}}else if(e(this).data("command")=="formats"){if(e(this).data("command")=="formats"&&!e(t.target).hasClass(u.css+"_format"))Y();K("",false);if(v.not(":focus"))v.focus()}else if(e(this).data("command")=="fSize"||e(this).data("command")=="colors"){if(e(this).data("command")=="fSize"&&!e(t.target).hasClass(u.css+"_fontsize")||e(this).data("command")=="colors"&&!e(t.target).hasClass(u.css+"_color"))J(e(this).data("command"));Z(false);if(v.not(":focus"))v.focus()}else{if(v.not(":focus"))v.focus();j(e(this).data("command"),null);K("",false);Z(false);X();e(this).data("emphasis")==true&&!e(this).hasClass(m)?e(this).addClass(m):e(this).removeClass(m);x.addClass(u.css+"_hiddenField");v.removeClass(u.css+"_hiddenField")}}else{p.data("sourceOpened",false);p.find("."+u.css+"_tool").removeClass(u.css+"_hiddenField");x.addClass(u.css+"_hiddenField");v.removeClass(u.css+"_hiddenField")}if(u.placeholder&&u.placeholder!="")v.html()!=""?M.hide():M.show()}v.trigger("change")}).hover(function(t){if(u.title&&e(this).data("title")!=""&&(e(t.target).hasClass(u.css+"_tool")||e(t.target).hasClass(u.css+"_tool_icon"))){e("."+u.css+"_title").remove();h.append('<div class="'+u.css+'_title"><div class="'+u.css+'_titleArrow"><div class="'+u.css+'_titleArrowIcon"></div></div><div class="'+u.css+'_titleText">'+e(this).data("title")+"</div></div>");var n=e("."+u.css+"_title:first");var r=n.find("."+u.css+"_titleArrowIcon");var i=e(this).position();var s=i.left+e(this).outerWidth()-n.outerWidth()/2-e(this).outerWidth()/2;var o=i.top+e(this).outerHeight()+5;n.delay(400).css({top:o,left:s}).fadeIn(200)}},function(){e("."+u.css+"_title").remove()});var ot=null;v.bind("keypress keyup keydown drop cut copy paste DOMCharacterDataModified DOMSubtreeModified",function(){if(!p.data("sourceOpened"))e(this).trigger("change");X();if(e.isFunction(u.change))u.change();if(u.placeholder&&u.placeholder!="")e(this).text()!=""?M.hide():M.show()}).bind("change",function(){if(!p.data("sourceOpened")){clearTimeout(ot);ot=setTimeout(nt,10)}}).keydown(function(e){if(e.ctrlKey){for(var t=0;t<f.length;t++){if(u[f[t].name]&&e.keyCode==f[t].key.charCodeAt(0)){if(f[t].command!=""&&f[t].command!="linkcreator")j(f[t].command,null);else if(f[t].command=="linkcreator")U();return false}}}}).bind("mouseup keyup",st).focus(function(){if(e.isFunction(u.focus))u.focus();h.addClass(u.css+"_focused");if(/opera/.test(a)){var t=document.createRange();t.selectNodeContents(v[0]);t.collapse(false);var n=window.getSelection();n.removeAllRanges();n.addRange(t)}}).focusout(function(){_.removeClass(m);K("",false);Z(false);X();if(e.isFunction(u.blur))u.blur();h.removeClass(u.css+"_focused");if(e.isArray(u.formats))et(u.formats[0][1])});l.bind("keydown keyup",function(){setTimeout(rt,0);e(this).height(e(this)[0].scrollHeight);if(e(this).val()=="")e(this).height(0)}).focus(function(){h.addClass(u.css+"_focused")}).focusout(function(){h.removeClass(u.css+"_focused")})})}})(jQuery)
39
+ /* End jQuery TE */
40
+
41
+ /* Begin MiniColors */
42
+ //
43
+ // jQuery MiniColors: A tiny color picker built on jQuery
44
+ //
45
+ // Developed by Cory LaViska for A Beautiful Site, LLC
46
+ //
47
+ // Licensed under the MIT license: http://opensource.org/licenses/MIT
48
+ //
49
+ !function(i){"function"==typeof define&&define.amd?define(["jquery"],i):"object"==typeof exports?module.exports=i(require("jquery")):i(jQuery)}(function(i){"use strict";function t(t,o){var s,a,n,r,e,l=i('<div class="minicolors" />'),h=i.minicolors.defaults;if(!t.data("minicolors-initialized")){if(o=i.extend(!0,{},h,o),l.addClass("minicolors-theme-"+o.theme).toggleClass("minicolors-with-opacity",o.opacity),void 0!==o.position&&i.each(o.position.split(" "),function(){l.addClass("minicolors-position-"+this)}),s="rgb"===o.format?o.opacity?"25":"20":o.keywords?"11":"7",t.addClass("minicolors-input").data("minicolors-initialized",!1).data("minicolors-settings",o).prop("size",s).wrap(l).after('<div class="minicolors-panel minicolors-slider-'+o.control+'"><div class="minicolors-slider minicolors-sprite"><div class="minicolors-picker"></div></div><div class="minicolors-opacity-slider minicolors-sprite"><div class="minicolors-picker"></div></div><div class="minicolors-grid minicolors-sprite"><div class="minicolors-grid-inner"></div><div class="minicolors-picker"><div></div></div></div></div>'),o.inline||(t.after('<span class="minicolors-swatch minicolors-sprite minicolors-input-swatch"><span class="minicolors-swatch-color"></span></span>'),t.next(".minicolors-input-swatch").on("click",function(i){i.preventDefault(),t.focus()})),r=t.parent().find(".minicolors-panel"),r.on("selectstart",function(){return!1}).end(),o.swatches&&0!==o.swatches.length)for(r.addClass("minicolors-with-swatches"),a=i('<ul class="minicolors-swatches"></ul>').appendTo(r),e=0;e<o.swatches.length;++e)n=o.swatches[e],n=v(n)?g(n,!0):I(u(n,!0)),i('<li class="minicolors-swatch minicolors-sprite"><span class="minicolors-swatch-color"></span></li>').appendTo(a).data("swatch-color",o.swatches[e]).find(".minicolors-swatch-color").css({backgroundColor:C(n),opacity:n.a}),o.swatches[e]=n;o.inline&&t.parent().addClass("minicolors-inline"),c(t,!1),t.data("minicolors-initialized",!0)}}function o(i){var t=i.parent();i.removeData("minicolors-initialized").removeData("minicolors-settings").removeProp("size").removeClass("minicolors-input"),t.before(i).remove()}function s(i){var t=i.parent(),o=t.find(".minicolors-panel"),s=i.data("minicolors-settings");!i.data("minicolors-initialized")||i.prop("disabled")||t.hasClass("minicolors-inline")||t.hasClass("minicolors-focus")||(a(),t.addClass("minicolors-focus"),o.stop(!0,!0).fadeIn(s.showSpeed,function(){s.show&&s.show.call(i.get(0))}))}function a(){i(".minicolors-focus").each(function(){var t=i(this),o=t.find(".minicolors-input"),s=t.find(".minicolors-panel"),a=o.data("minicolors-settings");s.fadeOut(a.hideSpeed,function(){a.hide&&a.hide.call(o.get(0)),t.removeClass("minicolors-focus")})})}function n(i,t,o){var s,a,n,e,c=i.parents(".minicolors").find(".minicolors-input"),l=c.data("minicolors-settings"),h=i.find("[class$=-picker]"),d=i.offset().left,p=i.offset().top,u=Math.round(t.pageX-d),g=Math.round(t.pageY-p),m=o?l.animationSpeed:0;t.originalEvent.changedTouches&&(u=t.originalEvent.changedTouches[0].pageX-d,g=t.originalEvent.changedTouches[0].pageY-p),u<0&&(u=0),g<0&&(g=0),u>i.width()&&(u=i.width()),g>i.height()&&(g=i.height()),i.parent().is(".minicolors-slider-wheel")&&h.parent().is(".minicolors-grid")&&(s=75-u,a=75-g,n=Math.sqrt(s*s+a*a),e=Math.atan2(a,s),e<0&&(e+=2*Math.PI),n>75&&(n=75,u=75-75*Math.cos(e),g=75-75*Math.sin(e)),u=Math.round(u),g=Math.round(g)),i.is(".minicolors-grid")?h.stop(!0).animate({top:g+"px",left:u+"px"},m,l.animationEasing,function(){r(c,i)}):h.stop(!0).animate({top:g+"px"},m,l.animationEasing,function(){r(c,i)})}function r(i,t){function o(i,t){var o,s;return i.length&&t?(o=i.offset().left,s=i.offset().top,{x:o-t.offset().left+i.outerWidth()/2,y:s-t.offset().top+i.outerHeight()/2}):null}var s,a,n,r,c,h,d,p=i.val(),u=i.attr("data-opacity"),g=i.parent(),m=i.data("minicolors-settings"),v=g.find(".minicolors-input-swatch"),b=g.find(".minicolors-grid"),w=g.find(".minicolors-slider"),y=g.find(".minicolors-opacity-slider"),C=b.find("[class$=-picker]"),M=w.find("[class$=-picker]"),x=y.find("[class$=-picker]"),I=o(C,b),S=o(M,w),z=o(x,y);if(t.is(".minicolors-grid, .minicolors-slider, .minicolors-opacity-slider")){switch(m.control){case"wheel":r=b.width()/2-I.x,c=b.height()/2-I.y,h=Math.sqrt(r*r+c*c),d=Math.atan2(c,r),d<0&&(d+=2*Math.PI),h>75&&(h=75,I.x=69-75*Math.cos(d),I.y=69-75*Math.sin(d)),a=f(h/.75,0,100),s=f(180*d/Math.PI,0,360),n=f(100-Math.floor(S.y*(100/w.height())),0,100),p=k({h:s,s:a,b:n}),w.css("backgroundColor",k({h:s,s:a,b:100}));break;case"saturation":s=f(parseInt(I.x*(360/b.width()),10),0,360),a=f(100-Math.floor(S.y*(100/w.height())),0,100),n=f(100-Math.floor(I.y*(100/b.height())),0,100),p=k({h:s,s:a,b:n}),w.css("backgroundColor",k({h:s,s:100,b:n})),g.find(".minicolors-grid-inner").css("opacity",a/100);break;case"brightness":s=f(parseInt(I.x*(360/b.width()),10),0,360),a=f(100-Math.floor(I.y*(100/b.height())),0,100),n=f(100-Math.floor(S.y*(100/w.height())),0,100),p=k({h:s,s:a,b:n}),w.css("backgroundColor",k({h:s,s:a,b:100})),g.find(".minicolors-grid-inner").css("opacity",1-n/100);break;default:s=f(360-parseInt(S.y*(360/w.height()),10),0,360),a=f(Math.floor(I.x*(100/b.width())),0,100),n=f(100-Math.floor(I.y*(100/b.height())),0,100),p=k({h:s,s:a,b:n}),b.css("backgroundColor",k({h:s,s:100,b:100}))}u=m.opacity?parseFloat(1-z.y/y.height()).toFixed(2):1,e(i,p,u)}else v.find("span").css({backgroundColor:p,opacity:u}),l(i,p,u)}function e(i,t,o){var s,a=i.parent(),n=i.data("minicolors-settings"),r=a.find(".minicolors-input-swatch");n.opacity&&i.attr("data-opacity",o),"rgb"===n.format?(s=v(t)?g(t,!0):I(u(t,!0)),o=""===i.attr("data-opacity")?1:f(parseFloat(i.attr("data-opacity")).toFixed(2),0,1),!isNaN(o)&&n.opacity||(o=1),t=i.minicolors("rgbObject").a<=1&&s&&n.opacity?"rgba("+s.r+", "+s.g+", "+s.b+", "+parseFloat(o)+")":"rgb("+s.r+", "+s.g+", "+s.b+")"):(v(t)&&(t=y(t)),t=p(t,n.letterCase)),i.val(t),r.find("span").css({backgroundColor:t,opacity:o}),l(i,t,o)}function c(t,o){var s,a,n,r,e,c,h,d,w,C,x=t.parent(),I=t.data("minicolors-settings"),S=x.find(".minicolors-input-swatch"),z=x.find(".minicolors-grid"),F=x.find(".minicolors-slider"),T=x.find(".minicolors-opacity-slider"),D=z.find("[class$=-picker]"),j=F.find("[class$=-picker]"),q=T.find("[class$=-picker]");switch(v(t.val())?(s=y(t.val()),e=f(parseFloat(b(t.val())).toFixed(2),0,1),e&&t.attr("data-opacity",e)):s=p(u(t.val(),!0),I.letterCase),s||(s=p(m(I.defaultValue,!0),I.letterCase)),a=M(s),r=I.keywords?i.map(I.keywords.split(","),function(t){return i.trim(t.toLowerCase())}):[],c=""!==t.val()&&i.inArray(t.val().toLowerCase(),r)>-1?p(t.val()):v(t.val())?g(t.val()):s,o||t.val(c),I.opacity&&(n=""===t.attr("data-opacity")?1:f(parseFloat(t.attr("data-opacity")).toFixed(2),0,1),isNaN(n)&&(n=1),t.attr("data-opacity",n),S.find("span").css("opacity",n),d=f(T.height()-T.height()*n,0,T.height()),q.css("top",d+"px")),"transparent"===t.val().toLowerCase()&&S.find("span").css("opacity",0),S.find("span").css("backgroundColor",s),I.control){case"wheel":w=f(Math.ceil(.75*a.s),0,z.height()/2),C=a.h*Math.PI/180,h=f(75-Math.cos(C)*w,0,z.width()),d=f(75-Math.sin(C)*w,0,z.height()),D.css({top:d+"px",left:h+"px"}),d=150-a.b/(100/z.height()),""===s&&(d=0),j.css("top",d+"px"),F.css("backgroundColor",k({h:a.h,s:a.s,b:100}));break;case"saturation":h=f(5*a.h/12,0,150),d=f(z.height()-Math.ceil(a.b/(100/z.height())),0,z.height()),D.css({top:d+"px",left:h+"px"}),d=f(F.height()-a.s*(F.height()/100),0,F.height()),j.css("top",d+"px"),F.css("backgroundColor",k({h:a.h,s:100,b:a.b})),x.find(".minicolors-grid-inner").css("opacity",a.s/100);break;case"brightness":h=f(5*a.h/12,0,150),d=f(z.height()-Math.ceil(a.s/(100/z.height())),0,z.height()),D.css({top:d+"px",left:h+"px"}),d=f(F.height()-a.b*(F.height()/100),0,F.height()),j.css("top",d+"px"),F.css("backgroundColor",k({h:a.h,s:a.s,b:100})),x.find(".minicolors-grid-inner").css("opacity",1-a.b/100);break;default:h=f(Math.ceil(a.s/(100/z.width())),0,z.width()),d=f(z.height()-Math.ceil(a.b/(100/z.height())),0,z.height()),D.css({top:d+"px",left:h+"px"}),d=f(F.height()-a.h/(360/F.height()),0,F.height()),j.css("top",d+"px"),z.css("backgroundColor",k({h:a.h,s:100,b:100}))}t.data("minicolors-initialized")&&l(t,c,n)}function l(i,t,o){var s,a,n,r=i.data("minicolors-settings"),e=i.data("minicolors-lastChange");if(!e||e.value!==t||e.opacity!==o){if(i.data("minicolors-lastChange",{value:t,opacity:o}),r.swatches&&0!==r.swatches.length){for(s=v(t)?g(t,!0):I(t),a=-1,n=0;n<r.swatches.length;++n)if(s.r===r.swatches[n].r&&s.g===r.swatches[n].g&&s.b===r.swatches[n].b&&s.a===r.swatches[n].a){a=n;break}i.parent().find(".minicolors-swatches .minicolors-swatch").removeClass("selected"),a!==-1&&i.parent().find(".minicolors-swatches .minicolors-swatch").eq(n).addClass("selected")}r.change&&(r.changeDelay?(clearTimeout(i.data("minicolors-changeTimeout")),i.data("minicolors-changeTimeout",setTimeout(function(){r.change.call(i.get(0),t,o)},r.changeDelay))):r.change.call(i.get(0),t,o)),i.trigger("change").trigger("input")}}function h(t){var o,s=i(t).attr("data-opacity");if(v(i(t).val()))o=g(i(t).val(),!0);else{var a=u(i(t).val(),!0);o=I(a)}return o?(void 0!==s&&i.extend(o,{a:parseFloat(s)}),o):null}function d(t,o){var s,a=i(t).attr("data-opacity");if(v(i(t).val()))s=g(i(t).val(),!0);else{var n=u(i(t).val(),!0);s=I(n)}return s?(void 0===a&&(a=1),o?"rgba("+s.r+", "+s.g+", "+s.b+", "+parseFloat(a)+")":"rgb("+s.r+", "+s.g+", "+s.b+")"):null}function p(i,t){return"uppercase"===t?i.toUpperCase():i.toLowerCase()}function u(i,t){return i=i.replace(/^#/g,""),i.match(/^[A-F0-9]{3,6}/gi)?3!==i.length&&6!==i.length?"":(3===i.length&&t&&(i=i[0]+i[0]+i[1]+i[1]+i[2]+i[2]),"#"+i):""}function g(i,t){var o=i.replace(/[^\d,.]/g,""),s=o.split(",");return s[0]=f(parseInt(s[0],10),0,255),s[1]=f(parseInt(s[1],10),0,255),s[2]=f(parseInt(s[2],10),0,255),s[3]&&(s[3]=f(parseFloat(s[3],10),0,1)),t?s[3]?{r:s[0],g:s[1],b:s[2],a:s[3]}:{r:s[0],g:s[1],b:s[2]}:"undefined"!=typeof s[3]&&s[3]<=1?"rgba("+s[0]+", "+s[1]+", "+s[2]+", "+s[3]+")":"rgb("+s[0]+", "+s[1]+", "+s[2]+")"}function m(i,t){return v(i)?g(i):u(i,t)}function f(i,t,o){return i<t&&(i=t),i>o&&(i=o),i}function v(i){var t=i.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i);return!(!t||4!==t.length)}function b(i){return i=i.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+(\.\d{1,2})?|\.\d{1,2})[\s+]?/i),i&&6===i.length?i[4]:"1"}function w(i){var t={},o=Math.round(i.h),s=Math.round(255*i.s/100),a=Math.round(255*i.b/100);if(0===s)t.r=t.g=t.b=a;else{var n=a,r=(255-s)*a/255,e=(n-r)*(o%60)/60;360===o&&(o=0),o<60?(t.r=n,t.b=r,t.g=r+e):o<120?(t.g=n,t.b=r,t.r=n-e):o<180?(t.g=n,t.r=r,t.b=r+e):o<240?(t.b=n,t.r=r,t.g=n-e):o<300?(t.b=n,t.g=r,t.r=r+e):o<360?(t.r=n,t.g=r,t.b=n-e):(t.r=0,t.g=0,t.b=0)}return{r:Math.round(t.r),g:Math.round(t.g),b:Math.round(t.b)}}function y(i){return i=i.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i),i&&4===i.length?"#"+("0"+parseInt(i[1],10).toString(16)).slice(-2)+("0"+parseInt(i[2],10).toString(16)).slice(-2)+("0"+parseInt(i[3],10).toString(16)).slice(-2):""}function C(t){var o=[t.r.toString(16),t.g.toString(16),t.b.toString(16)];return i.each(o,function(i,t){1===t.length&&(o[i]="0"+t)}),"#"+o.join("")}function k(i){return C(w(i))}function M(i){var t=x(I(i));return 0===t.s&&(t.h=360),t}function x(i){var t={h:0,s:0,b:0},o=Math.min(i.r,i.g,i.b),s=Math.max(i.r,i.g,i.b),a=s-o;return t.b=s,t.s=0!==s?255*a/s:0,0!==t.s?i.r===s?t.h=(i.g-i.b)/a:i.g===s?t.h=2+(i.b-i.r)/a:t.h=4+(i.r-i.g)/a:t.h=-1,t.h*=60,t.h<0&&(t.h+=360),t.s*=100/255,t.b*=100/255,t}function I(i){return i=parseInt(i.indexOf("#")>-1?i.substring(1):i,16),{r:i>>16,g:(65280&i)>>8,b:255&i}}i.minicolors={defaults:{animationSpeed:50,animationEasing:"swing",change:null,changeDelay:0,control:"hue",defaultValue:"",format:"hex",hide:null,hideSpeed:100,inline:!1,keywords:"",letterCase:"lowercase",opacity:!1,position:"bottom left",show:null,showSpeed:100,theme:"default",swatches:[]}},i.extend(i.fn,{minicolors:function(n,r){switch(n){case"destroy":return i(this).each(function(){o(i(this))}),i(this);case"hide":return a(),i(this);case"opacity":return void 0===r?i(this).attr("data-opacity"):(i(this).each(function(){c(i(this).attr("data-opacity",r))}),i(this));case"rgbObject":return h(i(this),"rgbaObject"===n);case"rgbString":case"rgbaString":return d(i(this),"rgbaString"===n);case"settings":return void 0===r?i(this).data("minicolors-settings"):(i(this).each(function(){var t=i(this).data("minicolors-settings")||{};o(i(this)),i(this).minicolors(i.extend(!0,t,r))}),i(this));case"show":return s(i(this).eq(0)),i(this);case"value":return void 0===r?i(this).val():(i(this).each(function(){"object"==typeof r&&null!==r?(r.opacity&&i(this).attr("data-opacity",f(r.opacity,0,1)),r.color&&i(this).val(r.color)):i(this).val(r),c(i(this))}),i(this));default:return"create"!==n&&(r=n),i(this).each(function(){t(i(this),r)}),i(this)}}}),i([document]).on("mousedown.minicolors touchstart.minicolors",function(t){i(t.target).parents().add(t.target).hasClass("minicolors")||a()}).on("mousedown.minicolors touchstart.minicolors",".minicolors-grid, .minicolors-slider, .minicolors-opacity-slider",function(t){var o=i(this);t.preventDefault(),i(t.delegateTarget).data("minicolors-target",o),n(o,t,!0)}).on("mousemove.minicolors touchmove.minicolors",function(t){var o=i(t.delegateTarget).data("minicolors-target");o&&n(o,t)}).on("mouseup.minicolors touchend.minicolors",function(){i(this).removeData("minicolors-target")}).on("click.minicolors",".minicolors-swatches li",function(t){t.preventDefault();var o=i(this),s=o.parents(".minicolors").find(".minicolors-input"),a=o.data("swatch-color");e(s,a,b(a)),c(s)}).on("mousedown.minicolors touchstart.minicolors",".minicolors-input-swatch",function(t){var o=i(this).parent().find(".minicolors-input");t.preventDefault(),s(o)}).on("focus.minicolors",".minicolors-input",function(){var t=i(this);t.data("minicolors-initialized")&&s(t)}).on("blur.minicolors",".minicolors-input",function(){var t,o,s,a,n,r=i(this),e=r.data("minicolors-settings");r.data("minicolors-initialized")&&(t=e.keywords?i.map(e.keywords.split(","),function(t){return i.trim(t.toLowerCase())}):[],""!==r.val()&&i.inArray(r.val().toLowerCase(),t)>-1?n=r.val():(v(r.val())?s=g(r.val(),!0):(o=u(r.val(),!0),s=o?I(o):null),n=null===s?e.defaultValue:"rgb"===e.format?g(e.opacity?"rgba("+s.r+","+s.g+","+s.b+","+r.attr("data-opacity")+")":"rgb("+s.r+","+s.g+","+s.b+")"):C(s)),a=e.opacity?r.attr("data-opacity"):1,"transparent"===n.toLowerCase()&&(a=0),r.closest(".minicolors").find(".minicolors-input-swatch > span").css("opacity",a),r.val(n),""===r.val()&&r.val(m(e.defaultValue,!0)),r.val(p(r.val(),e.letterCase)))}).on("keydown.minicolors",".minicolors-input",function(t){var o=i(this);if(o.data("minicolors-initialized"))switch(t.keyCode){case 9:a();break;case 13:case 27:a(),o.blur()}}).on("keyup.minicolors",".minicolors-input",function(){var t=i(this);t.data("minicolors-initialized")&&c(t,!0)}).on("paste.minicolors",".minicolors-input",function(){var t=i(this);t.data("minicolors-initialized")&&setTimeout(function(){c(t,!0)},1)})});
50
+ /* End MiniColors */
controls/assets/js/uncompressed/jQuery-TE/jquery-te-1.4.0.js ADDED
@@ -0,0 +1,1347 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ *
3
+ * jQuery TE 1.4.0 , http://jqueryte.com/
4
+ * Copyright (C) 2013, Fatih Koca (fattih@fattih.com), (http://jqueryte.com/about)
5
+
6
+ * jQuery TE is provided under the MIT LICENSE.
7
+ *
8
+ */
9
+
10
+ (function($){
11
+ $.fn.jqte = function(options){
12
+
13
+ // default titles of buttons
14
+ var varsTitle = [
15
+ {title:"Text Format"},
16
+ {title:"Font Size"},
17
+ {title:"Color"},
18
+ {title:"Bold",hotkey:"B"},
19
+ {title:"Italic",hotkey:"I"},
20
+ {title:"Underline",hotkey:"U"},
21
+ {title:"Ordered List",hotkey:"."},
22
+ {title:"Unordered List",hotkey:","},
23
+ {title:"Subscript",hotkey:"down arrow"},
24
+ {title:"Superscript",hotkey:"up arrow"},
25
+ {title:"Outdent",hotkey:"left arrow"},
26
+ {title:"Indent",hotkey:"right arrow"},
27
+ {title:"Justify Left"},
28
+ {title:"Justify Center"},
29
+ {title:"Justify Right"},
30
+ {title:"Strike Through",hotkey:"K"},
31
+ {title:"Add Link",hotkey:"L"},
32
+ {title:"Remove Link"},
33
+ {title:"Cleaner Style",hotkey:"Delete"},
34
+ {title:"Horizontal Rule",hotkey:"H"},
35
+ {title:"Source"}
36
+ ];
37
+
38
+ // default text formats
39
+ var formats = [["p","Normal"],["h1","Header 1"],["h2","Header 2"],["h3","Header 3"],["h4","Header 4"],["h5","Header 5"],["h6","Header 6"],["pre","Preformatted"]];
40
+
41
+ // default font sizes
42
+ var fsizes = ["10","12","16","18","20","24","28"];
43
+
44
+ // default rgb values of colors
45
+ var colors = [
46
+ "0,0,0","68,68,68","102,102,102","153,153,153","204,204,204","238,238,238","243,243,243","255,255,255",
47
+ null,
48
+ "255,0,0","255,153,0","255,255,0","0,255,0","0,255,255","0,0,255","153,0,255","255,0,255",
49
+ null,
50
+ "244,204,204","252,229,205","255,242,204","217,234,211","208,224,227","207,226,243","217,210,233","234,209,220",
51
+ "234,153,153","249,203,156","255,229,153","182,215,168","162,196,201","159,197,232","180,167,214","213,166,189",
52
+ "224,102,102","246,178,107","255,217,102","147,196,125","118,165,175","111,168,220","142,124,195","194,123,160",
53
+ "204,0,0","230,145,56","241,194,50","106,168,79","69,129,142","61,133,198","103,78,167","166,77,121",
54
+ "153,0,0","180,95,6","191,144,0","56,118,29","19,79,92","11,83,148","53,28,117","116,27,71",
55
+ "102,0,0","120,63,4","127,96,0","39,78,19","12,52,61","7,55,99","32,18,77","76,17,48"
56
+ ];
57
+
58
+ // default link-type names
59
+ var linktypes = ["Web Address","E-mail Address","Picture URL"];
60
+
61
+ var vars = $.extend({
62
+ // options
63
+ 'status' : true,
64
+ 'css' : "jqte",
65
+ 'title' : true,
66
+ 'titletext' : varsTitle,
67
+ 'button' : "OK",
68
+ 'format' : true,
69
+ 'formats' : formats,
70
+ 'fsize' : true,
71
+ 'fsizes' : fsizes,
72
+ 'funit' : "px",
73
+ 'color' : true,
74
+ 'linktypes' : linktypes,
75
+ 'b' : true,
76
+ 'i' : true,
77
+ 'u' : true,
78
+ 'ol' : true,
79
+ 'ul' : true,
80
+ 'sub' : true,
81
+ 'sup' : true,
82
+ 'outdent' : true,
83
+ 'indent' : true,
84
+ 'left' : true,
85
+ 'center' : true,
86
+ 'right' : true,
87
+ 'strike' : true,
88
+ 'link' : true,
89
+ 'unlink' : true,
90
+ 'remove' : true,
91
+ 'rule' : true,
92
+ 'source' : true,
93
+ 'placeholder' : false,
94
+ 'br' : true,
95
+ 'p' : true,
96
+
97
+ // events
98
+ 'change' : "",
99
+ 'focus' : "",
100
+ 'blur' : ""
101
+ }, options);
102
+
103
+ // methods
104
+ $.fn.jqteVal = function(value){
105
+ $(this).closest("."+vars.css).find("."+vars.css+"_editor").html(value);
106
+ }
107
+
108
+ // browser information is received
109
+ var thisBrowser = navigator.userAgent.toLowerCase();
110
+
111
+ // if browser is ie and it version is 7 or even older, close title property
112
+ if(/msie [1-7]./.test(thisBrowser))
113
+ vars.title = false;
114
+
115
+ var buttons = [];
116
+
117
+ // insertion function for parameters to toolbar
118
+ function addParams(name,command,key,tag,emphasis)
119
+ {
120
+ var thisCssNo = buttons.length+1;
121
+ return buttons.push({name:name, cls:thisCssNo, command:command, key:key, tag:tag, emphasis:emphasis});
122
+ };
123
+
124
+ // add parameters for toolbar buttons
125
+ addParams('format','formats','','',false); // text format button --> no hotkey
126
+ addParams('fsize','fSize','','',false); // font size button --> no hotkey
127
+ addParams('color','colors','','',false); // text color button --> no hotkey
128
+ addParams('b','Bold','B',["b","strong"],true); // bold --> ctrl + b
129
+ addParams('i','Italic','I',["i","em"],true); // italic --> ctrl + i
130
+ addParams('u','Underline','U',["u"],true); // underline --> ctrl + u
131
+ addParams('ol','insertorderedlist','¾',["ol"],true); // ordered list --> ctrl + .(dot)
132
+ addParams('ul','insertunorderedlist','¼',["ul"],true); // unordered list --> ctrl + ,(comma)
133
+ addParams('sub','subscript','(',["sub"],true); // sub script --> ctrl + down arrow
134
+ addParams('sup','superscript','&',["sup"],true); // super script --> ctrl + up arrow
135
+ addParams('outdent','outdent','%',["blockquote"],false); // outdent --> ctrl + left arrow
136
+ addParams('indent','indent','\'',["blockquote"],true); // indent --> ctrl + right arrow
137
+ addParams('left','justifyLeft','','',false); // justify Left --> no hotkey
138
+ addParams('center','justifyCenter','','',false); // justify center --> no hotkey
139
+ addParams('right','justifyRight','','',false); // justify right --> no hotkey
140
+ addParams('strike','strikeThrough','K',["strike"],true); // strike through --> ctrl + K
141
+ addParams('link','linkcreator','L',["a"],true); // insertion link --> ctrl + L
142
+ addParams('unlink','unlink','',["a"],false); // remove link --> ctrl + N
143
+ addParams('remove','removeformat','.','',false); // remove all styles --> ctrl + delete
144
+ addParams('rule','inserthorizontalrule','H',["hr"],false); // insertion horizontal rule --> ctrl + H
145
+ addParams('source','displaysource','','',false); // feature of displaying source
146
+
147
+ return this.each(function(){
148
+ if(!$(this).data("jqte") || $(this).data("jqte")==null || $(this).data("jqte")=="undefined")
149
+ $(this).data("jqte",true);
150
+ else
151
+ $(this).data("jqte",false);
152
+
153
+ // is the status false of the editor
154
+ if(!vars.status || !$(this).data("jqte"))
155
+ {
156
+ // if wanting the false status later
157
+ if($(this).closest("."+vars.css).length>0)
158
+ {
159
+ var editorValue = $(this).closest("."+vars.css).find("."+vars.css+"_editor").html();
160
+
161
+ // add all attributes of element
162
+ var thisElementAttrs = "";
163
+
164
+ $($(this)[0].attributes).each(function()
165
+ {
166
+ if(this.nodeName!="style")
167
+ thisElementAttrs = thisElementAttrs+" "+this.nodeName+'="'+this.nodeValue+'"';
168
+ });
169
+
170
+ var thisElementTag = $(this).is("[data-origin]") && $(this).attr("data-origin")!="" ? $(this).attr("data-origin") : "textarea";
171
+
172
+ // the contents of this element
173
+ var createValue = '>'+editorValue;
174
+
175
+ // if this element is input or option
176
+ if(thisElementTag=="input" || thisElementTag=="option")
177
+ {
178
+ // encode special html characters
179
+ editorValue = editorValue.replace(/"/g,'&#34;').replace(/'/g,'&#39;').replace(/</g,'&lt;').replace(/>/g,'&gt;');
180
+
181
+ // the value of this element
182
+ createValue = 'value="'+editorValue+'">';
183
+ }
184
+
185
+ var thisClone = $(this).clone();
186
+
187
+ $(this).data("jqte",false).closest("."+vars.css).before(thisClone).remove();
188
+ thisClone.replaceWith('<'+ thisElementTag + thisElementAttrs + createValue + '</'+thisElementTag+'>');
189
+ }
190
+ return;
191
+ }
192
+
193
+ // element will converted to the jqte editor
194
+ var thisElement = $(this);
195
+
196
+ // tag name of the element
197
+ var thisElementTag = $(this).prop('tagName').toLowerCase();
198
+
199
+ // tag name of origin
200
+ $(this).attr("data-origin",thisElementTag);
201
+
202
+ // contents of the element
203
+ var thisElementVal = $(this).is("[value]") || thisElementTag == "textarea" ? $(this).val() : $(this).html();
204
+
205
+ // decode special html characters
206
+ thisElementVal = thisElementVal.replace(/&#34;/g,'"').replace(/&#39;/g,"'").replace(/&lt;/g,'<').replace(/&gt;/g,'>').replace(/&amp;/g,'&');
207
+
208
+ // start jqte editor to after the element
209
+ $(this).after('<div class="'+vars.css+'"></div>');
210
+
211
+ // jqte
212
+ var jQTE = $(this).next('.'+vars.css);
213
+
214
+ // insert toolbar in jqte editor
215
+ jQTE.html('<div class="'+vars.css+"_toolbar"+'" role="toolbar" unselectable></div><div class="'+vars.css+'_linkform" style="display:none" role="dialog"></div><div class="'+vars.css+"_editor"+'"></div>');
216
+
217
+ var toolbar = jQTE.find('.'+vars.css+"_toolbar"); // the toolbar variable
218
+ var linkform = jQTE.find('.'+vars.css+"_linkform"); // the link-form-area in the toolbar variable
219
+ var editor = jQTE.find('.'+vars.css+"_editor"); // the text-field of jqte editor
220
+ var emphasize = vars.css+"_tool_depressed"; // highlight style of the toolbar buttons
221
+
222
+ // add to some tools in link form area
223
+ linkform.append('<div class="'+vars.css+'_linktypeselect" unselectable></div><input class="'+vars.css+'_linkinput" type="text/css" value=""><div class="'+vars.css+'_linkbutton" unselectable>'+vars.button+'</div> <div style="height:1px;float:none;clear:both"></div>');
224
+
225
+ var linktypeselect = linkform.find("."+vars.css+"_linktypeselect"); // the tool of link-type-selector
226
+ var linkinput = linkform.find("."+vars.css+"_linkinput"); // the input of insertion link
227
+ var linkbutton = linkform.find("."+vars.css+"_linkbutton"); // the button of insertion link
228
+
229
+ // add to the link-type-selector sub tool parts
230
+ linktypeselect.append('<div class="'+vars.css+'_linktypeview" unselectable></div><div class="'+vars.css+'_linktypes" role="menu" unselectable></div>');
231
+
232
+ var linktypes = linktypeselect.find("."+vars.css+"_linktypes"); // the select box of link types
233
+ var linktypeview = linktypeselect.find("."+vars.css+"_linktypeview"); // the link type preview
234
+ var setdatalink = vars.css+"-setlink"; // the selected text add to mark as "link will be added"
235
+
236
+ // create to the source-area
237
+ editor.after('<div class="'+vars.css+'_source '+vars.css+'_hiddenField"></div>');
238
+
239
+ var sourceField = jQTE.find("."+vars.css+"_source"); // the source-area variable
240
+
241
+ // move the element to the source-area
242
+ thisElement.appendTo(sourceField);
243
+
244
+ // if the element isn't a textarea, convert this to textarea
245
+ if(thisElementTag!="textarea")
246
+ {
247
+ // add all attributes of element to new textarea (type and value except)
248
+ var thisElementAttrs = "";
249
+
250
+ $(thisElement[0].attributes).each(function(){
251
+ if(this.nodeName!="type" && this.nodeName!="value")
252
+ thisElementAttrs = thisElementAttrs+" "+this.nodeName+'="'+this.nodeValue+'"';
253
+ });
254
+
255
+ // convert the element to textarea
256
+ thisElement.replaceWith('<textarea '+thisElementAttrs+'>'+thisElementVal+'</textarea>');
257
+
258
+ // update to variable of thisElement
259
+ thisElement = sourceField.find("textarea");
260
+ }
261
+
262
+ // add feature editable to the text-field ve copy from the element's value to text-field
263
+ editor.attr("contenteditable","true").html(thisElementVal);
264
+
265
+ // insertion the toolbar button
266
+ for(var n = 0; n < buttons.length; n++)
267
+ {
268
+ // if setting of this button is activated (is it true?)
269
+ if(vars[buttons[n].name])
270
+ {
271
+ // if it have a title, add to this button
272
+ var buttonHotkey = buttons[n].key.length>0 ? vars.titletext[n].hotkey!=null && vars.titletext[n].hotkey!="undefined" && vars.titletext[n].hotkey!="" ? ' (Ctrl+'+vars.titletext[n].hotkey+')' : '' : '';
273
+ var buttonTitle = vars.titletext[n].title!=null && vars.titletext[n].title!="undefined" && vars.titletext[n].title!="" ? vars.titletext[n].title+buttonHotkey : '';
274
+
275
+ // add this button to the toolbar
276
+ toolbar.append('<div class="'+vars.css+'_tool '+vars.css+'_tool_'+buttons[n].cls+'" role="button" data-tool="'+n+'" unselectable><a class="'+vars.css+'_tool_icon" unselectable></a></div>');
277
+
278
+ // add the parameters to this button
279
+ toolbar.find('.'+vars.css+'_tool[data-tool='+n+']').data({tag : buttons[n].tag, command : buttons[n].command, emphasis : buttons[n].emphasis, title : buttonTitle});
280
+
281
+ // format-selector field
282
+ if(buttons[n].name=="format" && $.isArray(vars.formats))
283
+ {
284
+ // selected text format
285
+ var toolLabel = vars.formats[0][1].length>0 && vars.formats[0][1]!="undefined" ? vars.formats[0][1] : "";
286
+
287
+ toolbar.find("."+vars.css+'_tool_'+buttons[n].cls).find("."+vars.css+"_tool_icon").replaceWith('<a class="'+vars.css+'_tool_label" unselectable><span class="'+vars.css+'_tool_text" unselectable>'+toolLabel+'</span><span class="'+vars.css+'_tool_icon" unselectable></span></a>');
288
+
289
+ toolbar.find("."+vars.css+'_tool_'+buttons[n].cls)
290
+ .append('<div class="'+vars.css+'_formats" unselectable></div>');
291
+
292
+ // add font-sizes to font-size-selector
293
+ for(var f = 0; f < vars.formats.length; f++)
294
+ {
295
+ toolbar.find("."+vars.css+"_formats").append('<a '+vars.css+'-formatval="'+ vars.formats[f][0] +'" class="'+vars.css+'_format'+' '+vars.css+'_format_'+f+'" role="menuitem" unselectable>'+ vars.formats[f][1] +'</a>');
296
+ }
297
+
298
+ toolbar.find("."+vars.css+"_formats").data("status",false);
299
+ }
300
+
301
+ // font-size-selector field
302
+ else if(buttons[n].name=="fsize" && $.isArray(vars.fsizes))
303
+ {
304
+ toolbar.find("."+vars.css+'_tool_'+buttons[n].cls)
305
+ .append('<div class="'+vars.css+'_fontsizes" unselectable></div>');
306
+
307
+ // add font-sizes to font-size-selector
308
+ for(var f = 0; f < vars.fsizes.length; f++)
309
+ {
310
+ toolbar.find("."+vars.css+"_fontsizes").append('<a '+vars.css+'-styleval="'+ vars.fsizes[f] +'" class="'+vars.css+'_fontsize'+'" style="font-size:'+ vars.fsizes[f] + vars.funit+'" role="menuitem" unselectable>Abcdefgh...</a>');
311
+ }
312
+ }
313
+
314
+ // color-selector field
315
+ else if(buttons[n].name=="color" && $.isArray(colors))
316
+ {
317
+ toolbar.find("."+vars.css+'_tool_'+buttons[n].cls)
318
+ .append('<div class="'+vars.css+'_cpalette" unselectable></div>');
319
+
320
+ // create color palette to color-selector field
321
+ for(var c = 0; c < colors.length; c++)
322
+ {
323
+ if(colors[c]!=null)
324
+ toolbar.find("."+vars.css+"_cpalette").append('<a '+vars.css+'-styleval="'+ colors[c] +'" class="'+vars.css+'_color'+'" style="background-color: rgb('+ colors[c] +')" role="gridcell" unselectable></a>');
325
+ else
326
+ toolbar.find("."+vars.css+"_cpalette").append('<div class="'+vars.css+"_colorSeperator"+'"></div>');
327
+ }
328
+ }
329
+ }
330
+ }
331
+
332
+ // the default value of the link-type
333
+ linktypes.data("linktype","0");
334
+
335
+ // add link types to link-type-selector
336
+ for(var n = 0; n < 3; n++)
337
+ {
338
+ linktypes.append('<a '+vars.css+'-linktype="'+n+'" unselectable>'+vars.linktypes[n]+'</a>');
339
+
340
+ linktypeview.html('<div class="'+vars.css+'_linktypearrow" unselectable></div><div class="'+vars.css+'_linktypetext">'+linktypes.find('a:eq('+linktypes.data("linktype")+')').text()+'</div>');
341
+ }
342
+
343
+ // add the prefix of css according to browser
344
+ var prefixCss = "";
345
+
346
+ if(/msie/.test(thisBrowser)) // ie
347
+ prefixCss = '-ms-';
348
+ else if(/chrome/.test(thisBrowser) || /safari/.test(thisBrowser) || /yandex/.test(thisBrowser)) // webkit group (safari, chrome, yandex)
349
+ prefixCss = '-webkit-';
350
+ else if(/mozilla/.test(thisBrowser)) // firefox
351
+ prefixCss = '-moz-';
352
+ else if(/opera/.test(thisBrowser)) // opera
353
+ prefixCss = '-o-';
354
+ else if(/konqueror/.test(thisBrowser)) // konqueror
355
+ prefixCss = '-khtml-';
356
+ else
357
+ prefixCss = '';
358
+
359
+ // the feature of placeholder
360
+ if(vars.placeholder && vars.placeholder!="")
361
+ {
362
+ jQTE.prepend('<div class="'+vars.css+'_placeholder" unselectable><div class="'+vars.css+'_placeholder_text">'+vars.placeholder+'</div></div>');
363
+
364
+ var placeHolder = jQTE.find("."+vars.css+"_placeholder");
365
+
366
+ placeHolder.click(function(){
367
+ editor.focus();
368
+ });
369
+ }
370
+
371
+ // make unselectable to unselectable attribute ones
372
+ jQTE.find("[unselectable]")
373
+ .css(prefixCss+"user-select","none")
374
+ .addClass("unselectable")
375
+ .attr("unselectable","on")
376
+ .on("selectstart mousedown",false);
377
+
378
+ // each button of the toolbar
379
+ var toolbutton = toolbar.find("."+vars.css+"_tool");
380
+
381
+ // format menu
382
+ var formatbar = toolbar.find("."+vars.css+"_formats");
383
+
384
+ // font-size filed
385
+ var fsizebar = toolbar.find("."+vars.css+"_fontsizes");
386
+
387
+ // color palette
388
+ var cpalette = toolbar.find("."+vars.css+"_cpalette");
389
+
390
+ // get the selected text as plain format
391
+ function selectionGet()
392
+ {
393
+ // for webkit, mozilla, opera
394
+ if (window.getSelection)
395
+ return window.getSelection();
396
+ // for ie
397
+ else if (document.selection && document.selection.createRange && document.selection.type != "None")
398
+ return document.selection.createRange();
399
+ }
400
+
401
+ // the function of changing to the selected text with "execCommand" method
402
+ function selectionSet(addCommand,thirdParam)
403
+ {
404
+ var range,
405
+ sel = selectionGet();
406
+
407
+ // for webkit, mozilla, opera
408
+ if (window.getSelection)
409
+ {
410
+ if (sel.anchorNode && sel.getRangeAt)
411
+ range = sel.getRangeAt(0);
412
+
413
+ if(range)
414
+ {
415
+ sel.removeAllRanges();
416
+ sel.addRange(range);
417
+ }
418
+
419
+ if(!thisBrowser.match(/msie/))
420
+ document.execCommand('StyleWithCSS', false, false);
421
+
422
+ document.execCommand(addCommand, false, thirdParam);
423
+ }
424
+
425
+ // for ie
426
+ else if (document.selection && document.selection.createRange && document.selection.type != "None")
427
+ {
428
+ range = document.selection.createRange();
429
+ range.execCommand(addCommand, false, thirdParam);
430
+ }
431
+
432
+ // change styles to around tags
433
+ affectStyleAround(false,false);
434
+ }
435
+
436
+ // the function of changing to the selected text with tags and tags's attributes
437
+ function replaceSelection(tTag,tAttr,tVal) {
438
+
439
+ // first, prevent to conflict of different jqte editors
440
+ if(editor.not(":focus"))
441
+ editor.focus();
442
+
443
+ // for webkit, mozilla, opera
444
+ if (window.getSelection)
445
+ {
446
+ var selObj = selectionGet(), selRange, newElement, documentFragment;
447
+
448
+ if (selObj.anchorNode && selObj.getRangeAt)
449
+ {
450
+ selRange = selObj.getRangeAt(0);
451
+
452
+ // create to new element
453
+ newElement = document.createElement(tTag);
454
+
455
+ // add the attribute to the new element
456
+ $(newElement).attr(tAttr,tVal);
457
+
458
+ // extract to the selected text
459
+ documentFragment = selRange.extractContents();
460
+
461
+ // add the contents to the new element
462
+ newElement.appendChild(documentFragment);
463
+
464
+ selRange.insertNode(newElement);
465
+ selObj.removeAllRanges();
466
+
467
+ // if the attribute is "style", change styles to around tags
468
+ if(tAttr=="style")
469
+ affectStyleAround($(newElement),tVal);
470
+ // for other attributes
471
+ else
472
+ affectStyleAround($(newElement),false);
473
+ }
474
+ }
475
+ // for ie
476
+ else if (document.selection && document.selection.createRange && document.selection.type != "None")
477
+ {
478
+ var range = document.selection.createRange();
479
+ var selectedText = range.htmlText;
480
+
481
+ var newText = '<'+tTag+' '+tAttr+'="'+tVal+'">'+selectedText+'</'+tTag+'>';
482
+
483
+ document.selection.createRange().pasteHTML(newText);
484
+ }
485
+ }
486
+
487
+ // the function of getting to the parent tag
488
+ var getSelectedNode = function() {
489
+ var node,selection;
490
+ if(window.getSelection) {
491
+ selection = getSelection();
492
+ node = selection.anchorNode;
493
+ }
494
+ if(!node && document.selection && document.selection.createRange && document.selection.type != "None")
495
+ {
496
+ selection = document.selection;
497
+ var range = selection.getRangeAt ? selection.getRangeAt(0) : selection.createRange();
498
+ node = range.commonAncestorContainer ? range.commonAncestorContainer :
499
+ range.parentElement ? range.parentElement() : range.item(0);
500
+ }
501
+ if(node) {
502
+ return (node.nodeName == "#text" ? $(node.parentNode) : $(node));
503
+ }
504
+ else
505
+ return false;
506
+ };
507
+
508
+ // the function of replacement styles to the around tags (parent and child)
509
+ function affectStyleAround(element,style)
510
+ {
511
+ var selectedTag = getSelectedNode(); // the selected node
512
+
513
+ selectedTag = selectedTag ? selectedTag : element;
514
+
515
+ // (for replacement with execCommand) affect to child tags with parent tag's styles
516
+ if(selectedTag && style==false)
517
+ {
518
+ // apply to the selected node with parent tag's styles
519
+ if(selectedTag.parent().is("[style]"))
520
+ selectedTag.attr("style",selectedTag.parent().attr("style"));
521
+
522
+ // apply to child tags with parent tag's styles
523
+ if(selectedTag.is("[style]"))
524
+ selectedTag.find("*").attr("style",selectedTag.attr("style"));
525
+ }
526
+ // (for replacement with html changing method)
527
+ else if(element && style && element.is("[style]"))
528
+ {
529
+ var styleKey = style.split(";"); // split the styles
530
+
531
+ styleKey = styleKey[0].split(":") // get the key of first style feature
532
+
533
+ // apply to child tags with parent tag's styles
534
+ if(element.is("[style*="+styleKey[0]+"]"))
535
+ element.find("*").css(styleKey[0],styleKey[1]);
536
+
537
+ // select to the selected node again
538
+ selectText(element);
539
+ }
540
+ }
541
+
542
+ // the function of making selected to a element
543
+ function selectText(element)
544
+ {
545
+ if(element)
546
+ {
547
+ var element = element[0];
548
+
549
+ if (document.body.createTextRange)
550
+ {
551
+ var range = document.body.createTextRange();
552
+ range.moveToElementText(element);
553
+ range.select();
554
+ }
555
+ else if (window.getSelection)
556
+ {
557
+ var selection = window.getSelection();
558
+ var range = document.createRange();
559
+
560
+ if(element != "undefined" && element != null)
561
+ {
562
+ range.selectNodeContents(element);
563
+
564
+ selection.removeAllRanges();
565
+ selection.addRange(range);
566
+
567
+ if($(element).is(":empty"))
568
+ {
569
+ $(element).append("&nbsp;");
570
+ selectText($(element));
571
+ }
572
+ }
573
+ }
574
+ }
575
+ }
576
+
577
+ // the function of converting text to link
578
+ function selected2link()
579
+ {
580
+ if(!toolbar.data("sourceOpened"))
581
+ {
582
+ var selectedTag = getSelectedNode(); // the selected node
583
+ var thisHrefLink = "http://"; // default the input value of the link-form-field
584
+
585
+ // display the link-form-field
586
+ linkAreaSwitch(true);
587
+
588
+ if(selectedTag)
589
+ {
590
+
591
+ var thisTagName = selectedTag.prop('tagName').toLowerCase();
592
+
593
+ // if tag name of the selected node is "a" and the selected node have "href" attribute
594
+ if(thisTagName == "a" && selectedTag.is('[href]'))
595
+ {
596
+ thisHrefLink = selectedTag.attr('href');
597
+
598
+ selectedTag.attr(setdatalink,"");
599
+ }
600
+ // if it don't have "a" tag name
601
+ else
602
+ replaceSelection("a",setdatalink,"");
603
+
604
+ }
605
+ else
606
+ linkinput.val(thisHrefLink).focus();
607
+
608
+ // the method of displaying-hiding to link-types
609
+ linktypeselect.click(function(e)
610
+ {
611
+ if($(e.target).hasClass(vars.css+"_linktypetext") || $(e.target).hasClass(vars.css+"_linktypearrow"))
612
+ linktypeSwitch(true);
613
+ });
614
+
615
+ // the method of selecting to link-types
616
+ linktypes.find("a").click(function()
617
+ {
618
+ var thisLinkType = $(this).attr(vars.css+"-linktype");
619
+
620
+ linktypes.data("linktype",thisLinkType)
621
+
622
+ linktypeview.find("."+vars.css+"_linktypetext").html(linktypes.find('a:eq('+linktypes.data("linktype")+')').text());
623
+
624
+ linkInputSet(thisHrefLink);
625
+
626
+ linktypeSwitch();
627
+ });
628
+
629
+ linkInputSet(thisHrefLink);
630
+
631
+ // the method of link-input
632
+ linkinput
633
+ // auto focus
634
+ .focus()
635
+ // update to value
636
+ .val(thisHrefLink)
637
+ // the event of key to enter in link-input
638
+ .bind("keypress keyup",function(e)
639
+ {
640
+ if(e.keyCode==13)
641
+ {
642
+ linkRecord(jQTE.find("["+setdatalink+"]"));
643
+ return false;
644
+ }
645
+ });
646
+
647
+ // the event of click link-button
648
+ linkbutton.click(function()
649
+ {
650
+ linkRecord(jQTE.find("["+setdatalink+"]"));
651
+ });
652
+ }
653
+ else
654
+ // hide the link-form-field
655
+ linkAreaSwitch(false);
656
+ }
657
+
658
+ function linkRecord(thisSelection)
659
+ {
660
+ // focus to link-input
661
+ linkinput.focus();
662
+
663
+ // select to the selected node
664
+ selectText(thisSelection);
665
+
666
+ // remove pre-link attribute (mark as "link will be added") of the selected node
667
+ thisSelection.removeAttr(setdatalink);
668
+
669
+ // if not selected to link-type of picture
670
+ if(linktypes.data("linktype")!="2")
671
+ selectionSet("createlink",linkinput.val()); // insert link url of link-input to the selected node
672
+ // if selected to link-type of picture
673
+ else
674
+ {
675
+ selectionSet("insertImage",linkinput.val()); // insert image url of link-input to the selected node
676
+
677
+ // the method of all pictures in the editor
678
+ editor.find("img").each(function(){
679
+ var emptyPrevLinks = $(this).prev("a");
680
+ var emptyNextLinks = $(this).next("a");
681
+
682
+ // if "a" tags of the front and rear of the picture is empty, remove
683
+ if(emptyPrevLinks.length>0 && emptyPrevLinks.html()=="")
684
+ emptyPrevLinks.remove();
685
+ else if(emptyNextLinks.length>0 && emptyNextLinks.html()=="")
686
+ emptyNextLinks.remove();
687
+ });
688
+ }
689
+
690
+ // hide the link-form-field
691
+ linkAreaSwitch();
692
+
693
+ // export contents of the text to the sources
694
+ editor.trigger("change");
695
+ }
696
+
697
+ // the function of switching link-form-field
698
+ function linkAreaSwitch(status)
699
+ {
700
+ // remove all pre-link attribute (mark as "link will be added")
701
+ clearSetElement("["+setdatalink+"]:not([href])");
702
+ jQTE.find("["+setdatalink+"][href]").removeAttr(setdatalink);
703
+
704
+ if(status)
705
+ {
706
+ toolbar.data("linkOpened",true);
707
+ linkform.show();
708
+ }
709
+ else
710
+ {
711
+ toolbar.data("linkOpened",false);
712
+ linkform.hide();
713
+ }
714
+
715
+ linktypeSwitch();
716
+ }
717
+
718
+ // the function of switching link-type-selector
719
+ function linktypeSwitch(status)
720
+ {
721
+ if(status)
722
+ linktypes.show();
723
+ else
724
+ linktypes.hide();
725
+ }
726
+
727
+ // the function of updating the link-input according to the link-type
728
+ function linkInputSet(thisHrefLink)
729
+ {
730
+ var currentType = linktypes.data("linktype");
731
+
732
+ // if selected type of e-mail
733
+ if(currentType=="1" && (linkinput.val()=="http://" || linkinput.is("[value^=http://]") || !linkinput.is("[value^=mailto]")))
734
+ linkinput.val("mailto:");
735
+ else if(currentType!="1" && !linkinput.is("[value^=http://]"))
736
+ linkinput.val("http://");
737
+ else
738
+ linkinput.val(thisHrefLink);
739
+ }
740
+
741
+ // the function of adding style to selected text
742
+ function selected2style(styleCommand)
743
+ {
744
+ if(!toolbar.data("sourceOpened"))
745
+ {
746
+
747
+ // if selected to changing the font-size value
748
+ if(styleCommand=="fSize")
749
+ styleField = fsizebar;
750
+
751
+ // if selected to changing the text-color value
752
+ else if(styleCommand=="colors")
753
+ styleField = cpalette;
754
+
755
+ // display the style-field
756
+ styleFieldSwitch(styleField,true);
757
+
758
+ // the event of click to style button
759
+ styleField.find("a").unbind("click").click(function()
760
+ {
761
+ var styleValue = $(this).attr(vars.css + "-styleval"); // the property of style value to be added
762
+
763
+ // if selected to changing the font-size value
764
+ if(styleCommand=="fSize")
765
+ {
766
+ styleType = "font-size";
767
+ styleValue = styleValue + vars.funit; // combine the value with size unit
768
+ }
769
+ // if selected to changing the text-color value
770
+ else if(styleCommand=="colors")
771
+ {
772
+ styleType = "color";
773
+ styleValue = "rgb("+styleValue + ")"; // combine color value with rgb
774
+ }
775
+
776
+ var prevStyles = refuseStyle(styleType); // affect styles to child tags (and extract to the new style attributes)
777
+
778
+ // change to selected text
779
+ replaceSelection("span","style",styleType+":"+styleValue+";"+prevStyles);
780
+
781
+ // hide all style-fields
782
+ styleFieldSwitch("",false);
783
+
784
+ // remove title bubbles
785
+ $('.'+vars.css+'_title').remove();
786
+
787
+ // export contents of the text to the sources
788
+ editor.trigger("change");
789
+ });
790
+
791
+ }
792
+ else
793
+ // hide the style-field
794
+ styleFieldSwitch(styleField,false);
795
+
796
+ // hide the link-form-field
797
+ linkAreaSwitch(false);
798
+ }
799
+
800
+ // the function of switching the style-field
801
+ function styleFieldSwitch(styleField,status)
802
+ {
803
+ var mainData="", // the style data of the actual wanted
804
+ allData = [{"d":"fsizeOpened","f":fsizebar},{"d":"cpallOpened","f":cpalette}]; // all style datas
805
+
806
+ // if the style data of the actual wanted isn't empty
807
+ if(styleField!="")
808
+ {
809
+ // return to all datas and find the main data
810
+ for(var si=0; si < allData.length; si++)
811
+ {
812
+ if(styleField==allData[si]["f"])
813
+ mainData = allData[si];
814
+ }
815
+ }
816
+ // display the style-field
817
+ if(status)
818
+ {
819
+ toolbar.data(mainData["d"],true); // stil seçme alanının açıldığını belirten parametre yaz
820
+ mainData["f"].slideDown(100); // stil seçme alanını aç
821
+
822
+ // return to all datas and close the fields of external datas
823
+ for(var si=0; si < allData.length; si++)
824
+ {
825
+ if(mainData["d"]!=allData[si]["d"])
826
+ {
827
+ toolbar.data(allData[si]["d"],false);
828
+ allData[si]["f"].slideUp(100);
829
+ }
830
+ }
831
+ }
832
+ // hide all style-fields
833
+ else
834
+ {
835
+ // return to all datas and close all style fields
836
+ for(var si=0; si < allData.length; si++)
837
+ {
838
+ toolbar.data(allData[si]["d"],false);
839
+ allData[si]["f"].slideUp(100);
840
+ }
841
+ }
842
+ }
843
+
844
+ // the function of removing all pre-link attribute (mark as "link will be added")
845
+ function clearSetElement(elem)
846
+ {
847
+ jQTE.find(elem).each(function(){
848
+ $(this).before($(this).html()).remove();
849
+ });
850
+ }
851
+
852
+ // the function of refusing some styles
853
+ function refuseStyle(refStyle)
854
+ {
855
+ var selectedTag = getSelectedNode(); // the selected node
856
+
857
+ // if the selected node have attribute of "style" and it have unwanted style
858
+ if(selectedTag && selectedTag.is("[style]") && selectedTag.css(refStyle)!="")
859
+ {
860
+ var refValue = selectedTag.css(refStyle); // first get key of unwanted style
861
+
862
+ selectedTag.css(refStyle,""); // clear unwanted style
863
+
864
+ var cleanStyle = selectedTag.attr("style"); // cleaned style
865
+
866
+ selectedTag.css(refStyle,refValue); // add unwanted style to the selected node again
867
+
868
+ return cleanStyle; // print cleaned style
869
+ }
870
+ else
871
+ return "";
872
+ }
873
+
874
+ // the function of adding style to selected text
875
+ function selected2format()
876
+ {
877
+ formatFieldSwitch(true);
878
+
879
+ formatbar.find("a").click(function()
880
+ {
881
+ $("*",this).click(function(e)
882
+ {
883
+ e.preventDefault();
884
+ return false;
885
+ });
886
+
887
+ formatLabelView($(this).text());
888
+
889
+ var formatValue = $(this).attr(vars.css + "-formatval"); // the type of format value
890
+
891
+ // convert to selected format
892
+ selectionSet("formatBlock",'<'+formatValue+'>');
893
+
894
+ formatFieldSwitch(false);
895
+ });
896
+ }
897
+
898
+ // the function of switching the style-field
899
+ function formatFieldSwitch(status)
900
+ {
901
+ var thisStatus = status ? true : false;
902
+
903
+ thisStatus = status && formatbar.data("status") ? true : false;
904
+
905
+ if(thisStatus || !status)
906
+ formatbar.data("status",false).slideUp(200);
907
+ else
908
+ formatbar.data("status",true).slideDown(200);
909
+ }
910
+
911
+ // change format label
912
+ function formatLabelView(str)
913
+ {
914
+ var formatLabel = formatbar.closest("."+vars.css+"_tool").find("."+vars.css+"_tool_label").find("."+vars.css+"_tool_text");
915
+
916
+ if(str.length > 10)
917
+ str = str.substr(0,7) + "...";
918
+
919
+ // change format label of button
920
+ formatLabel.html(str);
921
+ }
922
+
923
+ // the function of insertion a specific form to texts
924
+ function extractToText(strings)
925
+ {
926
+ var $htmlContent, $htmlPattern, $htmlReplace;
927
+
928
+ // first remove to unnecessary gaps
929
+ $htmlContent = strings.replace(/\n/gim,'').replace(/\r/gim,'').replace(/\t/gim,'').replace(/&nbsp;/gim,' ');
930
+
931
+ $htmlPattern = [
932
+ /\<span(|\s+.*?)><span(|\s+.*?)>(.*?)<\/span><\/span>/gim, // trim nested spans
933
+ /<(\w*[^p])\s*[^\/>]*>\s*<\/\1>/gim, // remove empty or white-spaces tags (ignore paragraphs (<p>) and breaks (<br>))
934
+ /\<div(|\s+.*?)>(.*?)\<\/div>/gim, // convert div to p
935
+ /\<strong(|\s+.*?)>(.*?)\<\/strong>/gim, // convert strong to b
936
+ /\<em(|\s+.*?)>(.*?)\<\/em>/gim // convert em to i
937
+ ];
938
+
939
+ $htmlReplace = [
940
+ '<span$2>$3</span>',
941
+ '',
942
+ '<p$1>$2</p>',
943
+ '<b$1>$2</b>',
944
+ '<i$1>$2</i>'
945
+ ];
946
+
947
+ // repeat the cleaning process 5 times
948
+ for(c=0; c<5; c++)
949
+ {
950
+ // create loop as the number of pattern
951
+ for(var i = 0; i < $htmlPattern.length; i++)
952
+ {
953
+ $htmlContent = $htmlContent.replace($htmlPattern[i], $htmlReplace[i]);
954
+ }
955
+ }
956
+
957
+ // if paragraph is false (<p>), convert <p> to <br>
958
+ if(!vars.p)
959
+ $htmlContent = $htmlContent.replace(/\<p(|\s+.*?)>(.*?)\<\/p>/ig, '<br/>$2');
960
+
961
+ // if break is false (<br>), convert <br> to <p>
962
+ if(!vars.br)
963
+ {
964
+ $htmlPattern = [
965
+ /\<br>(.*?)/ig,
966
+ /\<br\/>(.*?)/ig
967
+ ];
968
+
969
+ $htmlReplace = [
970
+ '<p>$1</p>',
971
+ '<p>$1</p>'
972
+ ];
973
+
974
+ // create loop as the number of pattern (for breaks)
975
+ for (var i = 0; i < $htmlPattern.length; i++) {
976
+ $htmlContent = $htmlContent.replace($htmlPattern[i], $htmlReplace[i]);
977
+ }
978
+ }
979
+
980
+ // if paragraph and break is false (<p> && <br>), convert <p> to <div>
981
+ if(!vars.p && !vars.br)
982
+ $htmlContent = $htmlContent.replace(/\<p>(.*?)\<\/p>/ig, '<div>$1</div>');
983
+
984
+ return $htmlContent;
985
+ }
986
+
987
+ // the function of exporting contents of the text field to the source field (to be the standard in all browsers)
988
+ function postToSource()
989
+ {
990
+ // clear unnecessary tags when editor view empty
991
+ var sourceStrings = editor.text()=="" && editor.html().length<12 ? "" : editor.html();
992
+
993
+ thisElement.val(extractToText(sourceStrings));
994
+ }
995
+
996
+ // the function of exporting contents of the source field to the text field (to be the standard in all browsers)
997
+ function postToEditor()
998
+ {
999
+ editor.html(extractToText(thisElement.val()));
1000
+ }
1001
+
1002
+ // the function of getting parent (or super parent) tag name of the selected node
1003
+ function detectElement(tags){
1004
+
1005
+ var resultdetect=false, $node = getSelectedNode(), parentsTag;
1006
+
1007
+ if($node)
1008
+ {
1009
+ $.each(tags, function(i, val){
1010
+ parentsTag = $node.prop('tagName').toLowerCase();
1011
+
1012
+ if (parentsTag == val)
1013
+ resultdetect = true;
1014
+ else
1015
+ {
1016
+ $node.parents().each(function(){
1017
+ parentsTag = $(this).prop('tagName').toLowerCase();
1018
+ if (parentsTag == val)
1019
+ resultdetect = true;
1020
+ });
1021
+ }
1022
+ });
1023
+
1024
+ return resultdetect;
1025
+ }
1026
+ else
1027
+ return false;
1028
+ };
1029
+
1030
+ // the function of highlighting the toolbar buttons according to the cursor position in jqte editor
1031
+ function buttonEmphasize(e)
1032
+ {
1033
+ for(var n = 0; n < buttons.length; n++)
1034
+ {
1035
+ if(vars[buttons[n].name] && buttons[n].emphasis && buttons[n].tag!='')
1036
+ detectElement(buttons[n].tag) ? toolbar.find('.'+vars.css+'_tool_'+buttons[n].cls).addClass(emphasize) : $('.'+vars.css+'_tool_'+buttons[n].cls).removeClass(emphasize);
1037
+ }
1038
+ // showing text format
1039
+ if(vars.format && $.isArray(vars.formats))
1040
+ {
1041
+ var isFoundFormat = false;
1042
+
1043
+ for(var f = 0; f < vars.formats.length; f++)
1044
+ {
1045
+ var thisFormat = [];
1046
+ thisFormat[0] = vars.formats[f][0];
1047
+
1048
+ if(vars.formats[f][0].length>0 && detectElement(thisFormat))
1049
+ {
1050
+ formatLabelView(vars.formats[f][1]);
1051
+
1052
+ isFoundFormat = true;
1053
+ break;
1054
+ }
1055
+ }
1056
+
1057
+ if(!isFoundFormat)
1058
+ formatLabelView(vars.formats[0][1]);
1059
+ }
1060
+
1061
+ // hide all style-fields
1062
+ styleFieldSwitch("",false);
1063
+ formatFieldSwitch(false);
1064
+ }
1065
+
1066
+ // the event of click to the toolbar buttons
1067
+ toolbutton
1068
+ .unbind("click")
1069
+ .click(function(e){
1070
+ // if source button is clicked
1071
+ if($(this).data('command')=='displaysource' && !toolbar.data("sourceOpened"))
1072
+ {
1073
+ // hide all the toolbar buttons (except the source button)
1074
+ toolbar.find("."+vars.css+"_tool").addClass(vars.css+"_hiddenField");
1075
+ $(this).removeClass(vars.css+"_hiddenField");
1076
+
1077
+ // update to data of source displaying
1078
+ toolbar.data("sourceOpened",true);
1079
+
1080
+ // equalize height of the text field with height of the source field
1081
+ thisElement.css("height",editor.outerHeight());
1082
+
1083
+ sourceField.removeClass(vars.css+"_hiddenField");
1084
+ editor.addClass(vars.css+"_hiddenField");
1085
+ thisElement.focus();
1086
+
1087
+ // hide the link-form-field
1088
+ linkAreaSwitch(false);
1089
+
1090
+ // hide all style-fields
1091
+ styleFieldSwitch("",false);
1092
+
1093
+ // hide format field
1094
+ formatFieldSwitch();
1095
+
1096
+ // hide placeholder
1097
+ if(vars.placeholder && vars.placeholder!="")
1098
+ placeHolder.hide();
1099
+ }
1100
+ // if other buttons is clicked
1101
+ else
1102
+ {
1103
+ // if source field is closed
1104
+ if(!toolbar.data("sourceOpened"))
1105
+ {
1106
+ // if insert-link-button is clicked
1107
+ if($(this).data('command')=='linkcreator')
1108
+ {
1109
+ if(!toolbar.data("linkOpened"))
1110
+ selected2link();
1111
+ else
1112
+ {
1113
+ // hide the link-form-field
1114
+ linkAreaSwitch(false);
1115
+
1116
+ // hide format field
1117
+ formatFieldSwitch(false);
1118
+ }
1119
+ }
1120
+
1121
+ // if the format button is clicked
1122
+ else if($(this).data('command')=='formats')
1123
+ {
1124
+ if($(this).data('command')=='formats' && !$(e.target).hasClass(vars.css+"_format"))
1125
+ selected2format();
1126
+
1127
+ // hide all style-fields
1128
+ styleFieldSwitch("",false);
1129
+
1130
+ if(editor.not(":focus"))
1131
+ editor.focus();
1132
+ }
1133
+
1134
+ // if the style buttons are clicked
1135
+ else if($(this).data('command')=='fSize' || $(this).data('command')=='colors')
1136
+ {
1137
+ if(
1138
+ ($(this).data('command')=='fSize' && !$(e.target).hasClass(vars.css+"_fontsize")) || // the font-size button
1139
+ ($(this).data('command')=='colors' && !$(e.target).hasClass(vars.css+"_color")) // the color button
1140
+ )
1141
+ selected2style($(this).data('command'));
1142
+
1143
+ // hide format field
1144
+ formatFieldSwitch(false);
1145
+
1146
+ if(editor.not(":focus"))
1147
+ editor.focus();
1148
+ }
1149
+
1150
+ // if other buttons is clicked
1151
+ else
1152
+ {
1153
+ // first, prevent to conflict of different jqte editors
1154
+ if(editor.not(":focus"))
1155
+ editor.focus();
1156
+
1157
+ // apply command of clicked button to the selected text
1158
+ selectionSet($(this).data('command'),null);
1159
+
1160
+ // hide all menu-fields
1161
+ styleFieldSwitch("",false);
1162
+ formatFieldSwitch(false);
1163
+ linktypeSwitch();
1164
+
1165
+ // to highlight the toolbar buttons according to the cursor position in jqte editor
1166
+ $(this).data('emphasis')==true && !$(this).hasClass(emphasize) ? $(this).addClass(emphasize) : $(this).removeClass(emphasize);
1167
+
1168
+ sourceField.addClass(vars.css+"_hiddenField");
1169
+ editor.removeClass(vars.css+"_hiddenField");
1170
+ }
1171
+
1172
+ }
1173
+ // hide the source field and display the text field
1174
+ else
1175
+ {
1176
+ // update to data of source hiding
1177
+ toolbar.data("sourceOpened",false);
1178
+
1179
+ // display all the toolbar buttons
1180
+ toolbar.find("."+vars.css+"_tool").removeClass(vars.css+"_hiddenField");
1181
+
1182
+ sourceField.addClass(vars.css+"_hiddenField");
1183
+ editor.removeClass(vars.css+"_hiddenField");
1184
+ }
1185
+
1186
+ if(vars.placeholder && vars.placeholder!="")
1187
+ editor.html()!="" ? placeHolder.hide() : placeHolder.show();
1188
+ }
1189
+
1190
+ // export contents of the text to the sources
1191
+ editor.trigger("change");
1192
+ })
1193
+ // the event of showing to the title bubble when mouse over of the toolbar buttons
1194
+ .hover(function(e){
1195
+ if(vars.title && $(this).data("title")!="" && ( $(e.target).hasClass(vars.css+"_tool") || $(e.target).hasClass(vars.css+"_tool_icon") ))
1196
+ {
1197
+ $('.'+vars.css+'_title').remove();
1198
+
1199
+ // create the title bubble
1200
+ jQTE.append('<div class="'+vars.css+'_title"><div class="'+vars.css+'_titleArrow"><div class="'+vars.css+'_titleArrowIcon"></div></div><div class="'+vars.css+'_titleText">'+$(this).data("title")+'</div></div>');
1201
+
1202
+ var thisTitle = $('.'+vars.css+'_title:first');
1203
+ var thisArrow = thisTitle.find('.'+vars.css+'_titleArrowIcon');
1204
+ var thisPosition = $(this).position();
1205
+ var thisAlignX = thisPosition.left + $(this).outerWidth() - (thisTitle.outerWidth()/2) - ($(this).outerWidth()/2);
1206
+ var thisAlignY = (thisPosition.top + $(this).outerHeight() + 5);
1207
+
1208
+ // show the title bubble and set to its position
1209
+ thisTitle.delay(400).css({'top':thisAlignY, 'left':thisAlignX}).fadeIn(200);
1210
+ }
1211
+ },function(){
1212
+ $('.'+vars.css+'_title').remove();
1213
+ });
1214
+
1215
+ // prevent multiple calling postToSource()
1216
+ var editorChangeTimer = null;
1217
+
1218
+ // the methods of the text fields
1219
+ editor
1220
+
1221
+ // trigger change method of the text field when the text field modified
1222
+ .bind("keypress keyup keydown drop cut copy paste DOMCharacterDataModified DOMSubtreeModified",function()
1223
+ {
1224
+ // export contents of the text to the sources
1225
+ if(!toolbar.data("sourceOpened"))
1226
+ $(this).trigger("change");
1227
+
1228
+ // hide the link-type-field
1229
+ linktypeSwitch();
1230
+
1231
+ // if the change method is added run the change method
1232
+ if($.isFunction(vars.change))
1233
+ vars.change();
1234
+
1235
+ // the feature of placeholder
1236
+ if(vars.placeholder && vars.placeholder!="")
1237
+ $(this).text()!="" ? placeHolder.hide() : placeHolder.show();
1238
+ })
1239
+ .bind("change",function()
1240
+ {
1241
+ if(!toolbar.data("sourceOpened"))
1242
+ {
1243
+ clearTimeout(editorChangeTimer);
1244
+ editorChangeTimer = setTimeout(postToSource,10);
1245
+ }
1246
+ })
1247
+
1248
+ // run to keyboard shortcuts
1249
+ .keydown(function(e)
1250
+ {
1251
+ // if ctrl key is clicked
1252
+ if(e.ctrlKey)
1253
+ {
1254
+ // check all toolbar buttons
1255
+ for(var n = 0; n < buttons.length; n++)
1256
+ {
1257
+ // if this settings of this button is activated (is it true)
1258
+ // if the keyed button with ctrl is same of hotkey of this button
1259
+ if(vars[buttons[n].name] && e.keyCode == buttons[n].key.charCodeAt(0))
1260
+ {
1261
+ if(buttons[n].command!='' && buttons[n].command!='linkcreator')
1262
+ selectionSet(buttons[n].command,null);
1263
+
1264
+ else if(buttons[n].command=='linkcreator')
1265
+ selected2link();
1266
+
1267
+ return false;
1268
+ }
1269
+ }
1270
+ }
1271
+ })
1272
+
1273
+ // method of triggering to the highlight button
1274
+ .bind("mouseup keyup",buttonEmphasize)
1275
+
1276
+ // the event of focus to the text field
1277
+ .focus(function()
1278
+ {
1279
+ // if the focus method is added run the focus method
1280
+ if($.isFunction(vars.focus))
1281
+ vars.focus();
1282
+
1283
+ // add onfocus class
1284
+ jQTE.addClass(vars.css+"_focused");
1285
+
1286
+ // prevent focus problem on opera
1287
+ if(/opera/.test(thisBrowser))
1288
+ {
1289
+ var range = document.createRange();
1290
+ range.selectNodeContents(editor[0]);
1291
+ range.collapse(false);
1292
+ var selection = window.getSelection();
1293
+ selection.removeAllRanges();
1294
+ selection.addRange(range);
1295
+ }
1296
+ })
1297
+
1298
+ // the event of focus out from the text field
1299
+ .focusout(function()
1300
+ {
1301
+ // remove to highlights of all toolbar buttons
1302
+ toolbutton.removeClass(emphasize);
1303
+
1304
+ // hide all menu-fields
1305
+ styleFieldSwitch("",false);
1306
+ formatFieldSwitch(false);
1307
+ linktypeSwitch();
1308
+
1309
+ // if the blur method is added run the blur method
1310
+ if($.isFunction(vars.blur))
1311
+ vars.blur();
1312
+
1313
+ // remove onfocus class
1314
+ jQTE.removeClass(vars.css+"_focused");
1315
+
1316
+ // show default text format
1317
+ if($.isArray(vars.formats))
1318
+ formatLabelView(vars.formats[0][1]);
1319
+ });
1320
+
1321
+ // the event of key in the source field
1322
+ thisElement
1323
+ .bind("keydown keyup",function()
1324
+ {
1325
+ // export contents of the source to the text field
1326
+ setTimeout(postToEditor,0);
1327
+
1328
+ // auto extension for the source field
1329
+ $(this).height($(this)[0].scrollHeight);
1330
+
1331
+ // if the source field is empty, shorten to the source field
1332
+ if($(this).val()=="")
1333
+ $(this).height(0);
1334
+ })
1335
+ .focus(function()
1336
+ {
1337
+ // add onfocus class
1338
+ jQTE.addClass(vars.css+"_focused");
1339
+ })
1340
+ .focusout(function()
1341
+ {
1342
+ // remove onfocus class
1343
+ jQTE.removeClass(vars.css+"_focused");
1344
+ });
1345
+ });
1346
+ };
1347
+ })(jQuery);
controls/assets/js/uncompressed/jQuery-TE/license/AUTHOR.txt ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ AUTHOR
2
+
3
+ jQuery TE 1.4.0 , http://jqueryte.com/
4
+ Copyright (C) 2013, Fatih Koca (fattih@fattih.com), (http://jqueryte.com/about)
5
+
6
+ jQuery TE is provided under the MIT LICENSE.
controls/assets/js/uncompressed/jQuery-TE/license/MIT-LICENSE.txt ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ Copyright (C) 2013 jQueryTE, Fatih Koca (fattih@fattih.com), http://jqueryte.com/license.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (jQueryTE), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED"AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
controls/assets/js/uncompressed/jQuery-chosen/LICENSE.md ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Chosen
2
+ - by Patrick Filler for [Harvest](http://getharvest.com)
3
+ - Copyright (c) 2011-2016 by Harvest
4
+
5
+ Available for use under the [MIT License](http://en.wikipedia.org/wiki/MIT_License)
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in
15
+ all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ THE SOFTWARE.
controls/assets/js/uncompressed/jQuery-chosen/chosen.jquery.js ADDED
@@ -0,0 +1,1349 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ Chosen, a Select Box Enhancer for jQuery and Prototype
3
+ by Patrick Filler for Harvest, http://getharvest.com
4
+
5
+ Version 1.8.2
6
+ Full source at https://github.com/harvesthq/chosen
7
+ Copyright (c) 2011-2017 Harvest http://getharvest.com
8
+
9
+ MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
10
+ This file is generated by `grunt build`, do not edit it by hand.
11
+ */
12
+
13
+ (function() {
14
+ var $, AbstractChosen, Chosen, SelectParser,
15
+ bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
16
+ extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
17
+ hasProp = {}.hasOwnProperty;
18
+
19
+ SelectParser = (function() {
20
+ function SelectParser() {
21
+ this.options_index = 0;
22
+ this.parsed = [];
23
+ }
24
+
25
+ SelectParser.prototype.add_node = function(child) {
26
+ if (child.nodeName.toUpperCase() === "OPTGROUP") {
27
+ return this.add_group(child);
28
+ } else {
29
+ return this.add_option(child);
30
+ }
31
+ };
32
+
33
+ SelectParser.prototype.add_group = function(group) {
34
+ var group_position, i, len, option, ref, results1;
35
+ group_position = this.parsed.length;
36
+ this.parsed.push({
37
+ array_index: group_position,
38
+ group: true,
39
+ label: group.label,
40
+ title: group.title ? group.title : void 0,
41
+ children: 0,
42
+ disabled: group.disabled,
43
+ classes: group.className
44
+ });
45
+ ref = group.childNodes;
46
+ results1 = [];
47
+ for (i = 0, len = ref.length; i < len; i++) {
48
+ option = ref[i];
49
+ results1.push(this.add_option(option, group_position, group.disabled));
50
+ }
51
+ return results1;
52
+ };
53
+
54
+ SelectParser.prototype.add_option = function(option, group_position, group_disabled) {
55
+ if (option.nodeName.toUpperCase() === "OPTION") {
56
+ if (option.text !== "") {
57
+ if (group_position != null) {
58
+ this.parsed[group_position].children += 1;
59
+ }
60
+ this.parsed.push({
61
+ array_index: this.parsed.length,
62
+ options_index: this.options_index,
63
+ value: option.value,
64
+ text: option.text,
65
+ html: option.innerHTML,
66
+ title: option.title ? option.title : void 0,
67
+ selected: option.selected,
68
+ disabled: group_disabled === true ? group_disabled : option.disabled,
69
+ group_array_index: group_position,
70
+ group_label: group_position != null ? this.parsed[group_position].label : null,
71
+ classes: option.className,
72
+ style: option.style.cssText
73
+ });
74
+ } else {
75
+ this.parsed.push({
76
+ array_index: this.parsed.length,
77
+ options_index: this.options_index,
78
+ empty: true
79
+ });
80
+ }
81
+ return this.options_index += 1;
82
+ }
83
+ };
84
+
85
+ return SelectParser;
86
+
87
+ })();
88
+
89
+ SelectParser.select_to_array = function(select) {
90
+ var child, i, len, parser, ref;
91
+ parser = new SelectParser();
92
+ ref = select.childNodes;
93
+ for (i = 0, len = ref.length; i < len; i++) {
94
+ child = ref[i];
95
+ parser.add_node(child);
96
+ }
97
+ return parser.parsed;
98
+ };
99
+
100
+ AbstractChosen = (function() {
101
+ function AbstractChosen(form_field, options1) {
102
+ this.form_field = form_field;
103
+ this.options = options1 != null ? options1 : {};
104
+ this.label_click_handler = bind(this.label_click_handler, this);
105
+ if (!AbstractChosen.browser_is_supported()) {
106
+ return;
107
+ }
108
+ this.is_multiple = this.form_field.multiple;
109
+ this.set_default_text();
110
+ this.set_default_values();
111
+ this.setup();
112
+ this.set_up_html();
113
+ this.register_observers();
114
+ this.on_ready();
115
+ }
116
+
117
+ AbstractChosen.prototype.set_default_values = function() {
118
+ this.click_test_action = (function(_this) {
119
+ return function(evt) {
120
+ return _this.test_active_click(evt);
121
+ };
122
+ })(this);
123
+ this.activate_action = (function(_this) {
124
+ return function(evt) {
125
+ return _this.activate_field(evt);
126
+ };
127
+ })(this);
128
+ this.active_field = false;
129
+ this.mouse_on_container = false;
130
+ this.results_showing = false;
131
+ this.result_highlighted = null;
132
+ this.is_rtl = this.options.rtl || /\bchosen-rtl\b/.test(this.form_field.className);
133
+ this.allow_single_deselect = (this.options.allow_single_deselect != null) && (this.form_field.options[0] != null) && this.form_field.options[0].text === "" ? this.options.allow_single_deselect : false;
134
+ this.disable_search_threshold = this.options.disable_search_threshold || 0;
135
+ this.disable_search = this.options.disable_search || false;
136
+ this.enable_split_word_search = this.options.enable_split_word_search != null ? this.options.enable_split_word_search : true;
137
+ this.group_search = this.options.group_search != null ? this.options.group_search : true;
138
+ this.search_contains = this.options.search_contains || false;
139
+ this.single_backstroke_delete = this.options.single_backstroke_delete != null ? this.options.single_backstroke_delete : true;
140
+ this.max_selected_options = this.options.max_selected_options || Infinity;
141
+ this.inherit_select_classes = this.options.inherit_select_classes || false;
142
+ this.display_selected_options = this.options.display_selected_options != null ? this.options.display_selected_options : true;
143
+ this.display_disabled_options = this.options.display_disabled_options != null ? this.options.display_disabled_options : true;
144
+ this.include_group_label_in_selected = this.options.include_group_label_in_selected || false;
145
+ this.max_shown_results = this.options.max_shown_results || Number.POSITIVE_INFINITY;
146
+ this.case_sensitive_search = this.options.case_sensitive_search || false;
147
+ return this.hide_results_on_select = this.options.hide_results_on_select != null ? this.options.hide_results_on_select : true;
148
+ };
149
+
150
+ AbstractChosen.prototype.set_default_text = function() {
151
+ if (this.form_field.getAttribute("data-placeholder")) {
152
+ this.default_text = this.form_field.getAttribute("data-placeholder");
153
+ } else if (this.is_multiple) {
154
+ this.default_text = this.options.placeholder_text_multiple || this.options.placeholder_text || AbstractChosen.default_multiple_text;
155
+ } else {
156
+ this.default_text = this.options.placeholder_text_single || this.options.placeholder_text || AbstractChosen.default_single_text;
157
+ }
158
+ this.default_text = this.escape_html(this.default_text);
159
+ return this.results_none_found = this.form_field.getAttribute("data-no_results_text") || this.options.no_results_text || AbstractChosen.default_no_result_text;
160
+ };
161
+
162
+ AbstractChosen.prototype.choice_label = function(item) {
163
+ if (this.include_group_label_in_selected && (item.group_label != null)) {
164
+ return "<b class='group-name'>" + item.group_label + "</b>" + item.html;
165
+ } else {
166
+ return item.html;
167
+ }
168
+ };
169
+
170
+ AbstractChosen.prototype.mouse_enter = function() {
171
+ return this.mouse_on_container = true;
172
+ };
173
+
174
+ AbstractChosen.prototype.mouse_leave = function() {
175
+ return this.mouse_on_container = false;
176
+ };
177
+
178
+ AbstractChosen.prototype.input_focus = function(evt) {
179
+ if (this.is_multiple) {
180
+ if (!this.active_field) {
181
+ return setTimeout(((function(_this) {
182
+ return function() {
183
+ return _this.container_mousedown();
184
+ };
185
+ })(this)), 50);
186
+ }
187
+ } else {
188
+ if (!this.active_field) {
189
+ return this.activate_field();
190
+ }
191
+ }
192
+ };
193
+
194
+ AbstractChosen.prototype.input_blur = function(evt) {
195
+ if (!this.mouse_on_container) {
196
+ this.active_field = false;
197
+ return setTimeout(((function(_this) {
198
+ return function() {
199
+ return _this.blur_test();
200
+ };
201
+ })(this)), 100);
202
+ }
203
+ };
204
+
205
+ AbstractChosen.prototype.label_click_handler = function(evt) {
206
+ if (this.is_multiple) {
207
+ return this.container_mousedown(evt);
208
+ } else {
209
+ return this.activate_field();
210
+ }
211
+ };
212
+
213
+ AbstractChosen.prototype.results_option_build = function(options) {
214
+ var content, data, data_content, i, len, ref, shown_results;
215
+ content = '';
216
+ shown_results = 0;
217
+ ref = this.results_data;
218
+ for (i = 0, len = ref.length; i < len; i++) {
219
+ data = ref[i];
220
+ data_content = '';
221
+ if (data.group) {
222
+ data_content = this.result_add_group(data);
223
+ } else {
224
+ data_content = this.result_add_option(data);
225
+ }
226
+ if (data_content !== '') {
227
+ shown_results++;
228
+ content += data_content;
229
+ }
230
+ if (options != null ? options.first : void 0) {
231
+ if (data.selected && this.is_multiple) {
232
+ this.choice_build(data);
233
+ } else if (data.selected && !this.is_multiple) {
234
+ this.single_set_selected_text(this.choice_label(data));
235
+ }
236
+ }
237
+ if (shown_results >= this.max_shown_results) {
238
+ break;
239
+ }
240
+ }
241
+ return content;
242
+ };
243
+
244
+ AbstractChosen.prototype.result_add_option = function(option) {
245
+ var classes, option_el;
246
+ if (!option.search_match) {
247
+ return '';
248
+ }
249
+ if (!this.include_option_in_results(option)) {
250
+ return '';
251
+ }
252
+ classes = [];
253
+ if (!option.disabled && !(option.selected && this.is_multiple)) {
254
+ classes.push("active-result");
255
+ }
256
+ if (option.disabled && !(option.selected && this.is_multiple)) {
257
+ classes.push("disabled-result");
258
+ }
259
+ if (option.selected) {
260
+ classes.push("result-selected");
261
+ }
262
+ if (option.group_array_index != null) {
263
+ classes.push("group-option");
264
+ }
265
+ if (option.classes !== "") {
266
+ classes.push(option.classes);
267
+ }
268
+ option_el = document.createElement("li");
269
+ option_el.className = classes.join(" ");
270
+ option_el.style.cssText = option.style;
271
+ option_el.setAttribute("data-option-array-index", option.array_index);
272
+ option_el.innerHTML = option.highlighted_html || option.html;
273
+ if (option.title) {
274
+ option_el.title = option.title;
275
+ }
276
+ return this.outerHTML(option_el);
277
+ };
278
+
279
+ AbstractChosen.prototype.result_add_group = function(group) {
280
+ var classes, group_el;
281
+ if (!(group.search_match || group.group_match)) {
282
+ return '';
283
+ }
284
+ if (!(group.active_options > 0)) {
285
+ return '';
286
+ }
287
+ classes = [];
288
+ classes.push("group-result");
289
+ if (group.classes) {
290
+ classes.push(group.classes);
291
+ }
292
+ group_el = document.createElement("li");
293
+ group_el.className = classes.join(" ");
294
+ group_el.innerHTML = group.highlighted_html || this.escape_html(group.label);
295
+ if (group.title) {
296
+ group_el.title = group.title;
297
+ }
298
+ return this.outerHTML(group_el);
299
+ };
300
+
301
+ AbstractChosen.prototype.results_update_field = function() {
302
+ this.set_default_text();
303
+ if (!this.is_multiple) {
304
+ this.results_reset_cleanup();
305
+ }
306
+ this.result_clear_highlight();
307
+ this.results_build();
308
+ if (this.results_showing) {
309
+ return this.winnow_results();
310
+ }
311
+ };
312
+
313
+ AbstractChosen.prototype.reset_single_select_options = function() {
314
+ var i, len, ref, result, results1;
315
+ ref = this.results_data;
316
+ results1 = [];
317
+ for (i = 0, len = ref.length; i < len; i++) {
318
+ result = ref[i];
319
+ if (result.selected) {
320
+ results1.push(result.selected = false);
321
+ } else {
322
+ results1.push(void 0);
323
+ }
324
+ }
325
+ return results1;
326
+ };
327
+
328
+ AbstractChosen.prototype.results_toggle = function() {
329
+ if (this.results_showing) {
330
+ return this.results_hide();
331
+ } else {
332
+ return this.results_show();
333
+ }
334
+ };
335
+
336
+ AbstractChosen.prototype.results_search = function(evt) {
337
+ if (this.results_showing) {
338
+ return this.winnow_results();
339
+ } else {
340
+ return this.results_show();
341
+ }
342
+ };
343
+
344
+ AbstractChosen.prototype.winnow_results = function() {
345
+ var escapedQuery, fix, i, len, option, prefix, query, ref, regex, results, results_group, search_match, startpos, suffix, text;
346
+ this.no_results_clear();
347
+ results = 0;
348
+ query = this.get_search_text();
349
+ escapedQuery = query.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
350
+ regex = this.get_search_regex(escapedQuery);
351
+ ref = this.results_data;
352
+ for (i = 0, len = ref.length; i < len; i++) {
353
+ option = ref[i];
354
+ option.search_match = false;
355
+ results_group = null;
356
+ search_match = null;
357
+ option.highlighted_html = '';
358
+ if (this.include_option_in_results(option)) {
359
+ if (option.group) {
360
+ option.group_match = false;
361
+ option.active_options = 0;
362
+ }
363
+ if ((option.group_array_index != null) && this.results_data[option.group_array_index]) {
364
+ results_group = this.results_data[option.group_array_index];
365
+ if (results_group.active_options === 0 && results_group.search_match) {
366
+ results += 1;
367
+ }
368
+ results_group.active_options += 1;
369
+ }
370
+ text = option.group ? option.label : option.text;
371
+ if (!(option.group && !this.group_search)) {
372
+ search_match = this.search_string_match(text, regex);
373
+ option.search_match = search_match != null;
374
+ if (option.search_match && !option.group) {
375
+ results += 1;
376
+ }
377
+ if (option.search_match) {
378
+ if (query.length) {
379
+ startpos = search_match.index;
380
+ prefix = text.slice(0, startpos);
381
+ fix = text.slice(startpos, startpos + query.length);
382
+ suffix = text.slice(startpos + query.length);
383
+ option.highlighted_html = (this.escape_html(prefix)) + "<em>" + (this.escape_html(fix)) + "</em>" + (this.escape_html(suffix));
384
+ }
385
+ if (results_group != null) {
386
+ results_group.group_match = true;
387
+ }
388
+ } else if ((option.group_array_index != null) && this.results_data[option.group_array_index].search_match) {
389
+ option.search_match = true;
390
+ }
391
+ }
392
+ }
393
+ }
394
+ this.result_clear_highlight();
395
+ if (results < 1 && query.length) {
396
+ this.update_results_content("");
397
+ return this.no_results(query);
398
+ } else {
399
+ this.update_results_content(this.results_option_build());
400
+ return this.winnow_results_set_highlight();
401
+ }
402
+ };
403
+
404
+ AbstractChosen.prototype.get_search_regex = function(escaped_search_string) {
405
+ var regex_flag, regex_string;
406
+ regex_string = this.search_contains ? escaped_search_string : "(^|\\s|\\b)" + escaped_search_string + "[^\\s]*";
407
+ if (!(this.enable_split_word_search || this.search_contains)) {
408
+ regex_string = "^" + regex_string;
409
+ }
410
+ regex_flag = this.case_sensitive_search ? "" : "i";
411
+ return new RegExp(regex_string, regex_flag);
412
+ };
413
+
414
+ AbstractChosen.prototype.search_string_match = function(search_string, regex) {
415
+ var match;
416
+ match = regex.exec(search_string);
417
+ if (!this.search_contains && (match != null ? match[1] : void 0)) {
418
+ match.index += 1;
419
+ }
420
+ return match;
421
+ };
422
+
423
+ AbstractChosen.prototype.choices_count = function() {
424
+ var i, len, option, ref;
425
+ if (this.selected_option_count != null) {
426
+ return this.selected_option_count;
427
+ }
428
+ this.selected_option_count = 0;
429
+ ref = this.form_field.options;
430
+ for (i = 0, len = ref.length; i < len; i++) {
431
+ option = ref[i];
432
+ if (option.selected) {
433
+ this.selected_option_count += 1;
434
+ }
435
+ }
436
+ return this.selected_option_count;
437
+ };
438
+
439
+ AbstractChosen.prototype.choices_click = function(evt) {
440
+ evt.preventDefault();
441
+ this.activate_field();
442
+ if (!(this.results_showing || this.is_disabled)) {
443
+ return this.results_show();
444
+ }
445
+ };
446
+
447
+ AbstractChosen.prototype.keydown_checker = function(evt) {
448
+ var ref, stroke;
449
+ stroke = (ref = evt.which) != null ? ref : evt.keyCode;
450
+ this.search_field_scale();
451
+ if (stroke !== 8 && this.pending_backstroke) {
452
+ this.clear_backstroke();
453
+ }
454
+ switch (stroke) {
455
+ case 8:
456
+ this.backstroke_length = this.get_search_field_value().length;
457
+ break;
458
+ case 9:
459
+ if (this.results_showing && !this.is_multiple) {
460
+ this.result_select(evt);
461
+ }
462
+ this.mouse_on_container = false;
463
+ break;
464
+ case 13:
465
+ if (this.results_showing) {
466
+ evt.preventDefault();
467
+ }
468
+ break;
469
+ case 27:
470
+ if (this.results_showing) {
471
+ evt.preventDefault();
472
+ }
473
+ break;
474
+ case 32:
475
+ if (this.disable_search) {
476
+ evt.preventDefault();
477
+ }
478
+ break;
479
+ case 38:
480
+ evt.preventDefault();
481
+ this.keyup_arrow();
482
+ break;
483
+ case 40:
484
+ evt.preventDefault();
485
+ this.keydown_arrow();
486
+ break;
487
+ }
488
+ };
489
+
490
+ AbstractChosen.prototype.keyup_checker = function(evt) {
491
+ var ref, stroke;
492
+ stroke = (ref = evt.which) != null ? ref : evt.keyCode;
493
+ this.search_field_scale();
494
+ switch (stroke) {
495
+ case 8:
496
+ if (this.is_multiple && this.backstroke_length < 1 && this.choices_count() > 0) {
497
+ this.keydown_backstroke();
498
+ } else if (!this.pending_backstroke) {
499
+ this.result_clear_highlight();
500
+ this.results_search();
501
+ }
502
+ break;
503
+ case 13:
504
+ evt.preventDefault();
505
+ if (this.results_showing) {
506
+ this.result_select(evt);
507
+ }
508
+ break;
509
+ case 27:
510
+ if (this.results_showing) {
511
+ this.results_hide();
512
+ }
513
+ break;
514
+ case 9:
515
+ case 16:
516
+ case 17:
517
+ case 18:
518
+ case 38:
519
+ case 40:
520
+ case 91:
521
+ break;
522
+ default:
523
+ this.results_search();
524
+ break;
525
+ }
526
+ };
527
+
528
+ AbstractChosen.prototype.clipboard_event_checker = function(evt) {
529
+ if (this.is_disabled) {
530
+ return;
531
+ }
532
+ return setTimeout(((function(_this) {
533
+ return function() {
534
+ return _this.results_search();
535
+ };
536
+ })(this)), 50);
537
+ };
538
+
539
+ AbstractChosen.prototype.container_width = function() {
540
+ if (this.options.width != null) {
541
+ return this.options.width;
542
+ } else {
543
+ return this.form_field.offsetWidth + "px";
544
+ }
545
+ };
546
+
547
+ AbstractChosen.prototype.include_option_in_results = function(option) {
548
+ if (this.is_multiple && (!this.display_selected_options && option.selected)) {
549
+ return false;
550
+ }
551
+ if (!this.display_disabled_options && option.disabled) {
552
+ return false;
553
+ }
554
+ if (option.empty) {
555
+ return false;
556
+ }
557
+ return true;
558
+ };
559
+
560
+ AbstractChosen.prototype.search_results_touchstart = function(evt) {
561
+ this.touch_started = true;
562
+ return this.search_results_mouseover(evt);
563
+ };
564
+
565
+ AbstractChosen.prototype.search_results_touchmove = function(evt) {
566
+ this.touch_started = false;
567
+ return this.search_results_mouseout(evt);
568
+ };
569
+
570
+ AbstractChosen.prototype.search_results_touchend = function(evt) {
571
+ if (this.touch_started) {
572
+ return this.search_results_mouseup(evt);
573
+ }
574
+ };
575
+
576
+ AbstractChosen.prototype.outerHTML = function(element) {
577
+ var tmp;
578
+ if (element.outerHTML) {
579
+ return element.outerHTML;
580
+ }
581
+ tmp = document.createElement("div");
582
+ tmp.appendChild(element);
583
+ return tmp.innerHTML;
584
+ };
585
+
586
+ AbstractChosen.prototype.get_single_html = function() {
587
+ return "<a class=\"chosen-single chosen-default\">\n <span>" + this.default_text + "</span>\n <div><b></b></div>\n</a>\n<div class=\"chosen-drop\">\n <div class=\"chosen-search\">\n <input class=\"chosen-search-input\" type=\"text\" autocomplete=\"off\" />\n </div>\n <ul class=\"chosen-results\"></ul>\n</div>";
588
+ };
589
+
590
+ AbstractChosen.prototype.get_multi_html = function() {
591
+ return "<ul class=\"chosen-choices\">\n <li class=\"search-field\">\n <input class=\"chosen-search-input\" type=\"text\" autocomplete=\"off\" value=\"" + this.default_text + "\" />\n </li>\n</ul>\n<div class=\"chosen-drop\">\n <ul class=\"chosen-results\"></ul>\n</div>";
592
+ };
593
+
594
+ AbstractChosen.prototype.get_no_results_html = function(terms) {
595
+ return "<li class=\"no-results\">\n " + this.results_none_found + " <span>" + (this.escape_html(terms)) + "</span>\n</li>";
596
+ };
597
+
598
+ AbstractChosen.browser_is_supported = function() {
599
+ if ("Microsoft Internet Explorer" === window.navigator.appName) {
600
+ return document.documentMode >= 8;
601
+ }
602
+ if (/iP(od|hone)/i.test(window.navigator.userAgent) || /IEMobile/i.test(window.navigator.userAgent) || /Windows Phone/i.test(window.navigator.userAgent) || /BlackBerry/i.test(window.navigator.userAgent) || /BB10/i.test(window.navigator.userAgent) || /Android.*Mobile/i.test(window.navigator.userAgent)) {
603
+ return false;
604
+ }
605
+ return true;
606
+ };
607
+
608
+ AbstractChosen.default_multiple_text = "Select Some Options";
609
+
610
+ AbstractChosen.default_single_text = "Select an Option";
611
+
612
+ AbstractChosen.default_no_result_text = "No results match";
613
+
614
+ return AbstractChosen;
615
+
616
+ })();
617
+
618
+ $ = jQuery;
619
+
620
+ $.fn.extend({
621
+ chosen: function(options) {
622
+ if (!AbstractChosen.browser_is_supported()) {
623
+ return this;
624
+ }
625
+ return this.each(function(input_field) {
626
+ var $this, chosen;
627
+ $this = $(this);
628
+ chosen = $this.data('chosen');
629
+ if (options === 'destroy') {
630
+ if (chosen instanceof Chosen) {
631
+ chosen.destroy();
632
+ }
633
+ return;
634
+ }
635
+ if (!(chosen instanceof Chosen)) {
636
+ $this.data('chosen', new Chosen(this, options));
637
+ }
638
+ });
639
+ }
640
+ });
641
+
642
+ Chosen = (function(superClass) {
643
+ extend(Chosen, superClass);
644
+
645
+ function Chosen() {
646
+ return Chosen.__super__.constructor.apply(this, arguments);
647
+ }
648
+
649
+ Chosen.prototype.setup = function() {
650
+ this.form_field_jq = $(this.form_field);
651
+ return this.current_selectedIndex = this.form_field.selectedIndex;
652
+ };
653
+
654
+ Chosen.prototype.set_up_html = function() {
655
+ var container_classes, container_props;
656
+ container_classes = ["chosen-container"];
657
+ container_classes.push("chosen-container-" + (this.is_multiple ? "multi" : "single"));
658
+ if (this.inherit_select_classes && this.form_field.className) {
659
+ container_classes.push(this.form_field.className);
660
+ }
661
+ if (this.is_rtl) {
662
+ container_classes.push("chosen-rtl");
663
+ }
664
+ container_props = {
665
+ 'class': container_classes.join(' '),
666
+ 'title': this.form_field.title
667
+ };
668
+ if (this.form_field.id.length) {
669
+ container_props.id = this.form_field.id.replace(/[^\w]/g, '_') + "_chosen";
670
+ }
671
+ this.container = $("<div />", container_props);
672
+ this.container.width(this.container_width());
673
+ if (this.is_multiple) {
674
+ this.container.html(this.get_multi_html());
675
+ } else {
676
+ this.container.html(this.get_single_html());
677
+ }
678
+ this.form_field_jq.hide().after(this.container);
679
+ this.dropdown = this.container.find('div.chosen-drop').first();
680
+ this.search_field = this.container.find('input').first();
681
+ this.search_results = this.container.find('ul.chosen-results').first();
682
+ this.search_field_scale();
683
+ this.search_no_results = this.container.find('li.no-results').first();
684
+ if (this.is_multiple) {
685
+ this.search_choices = this.container.find('ul.chosen-choices').first();
686
+ this.search_container = this.container.find('li.search-field').first();
687
+ } else {
688
+ this.search_container = this.container.find('div.chosen-search').first();
689
+ this.selected_item = this.container.find('.chosen-single').first();
690
+ }
691
+ this.results_build();
692
+ this.set_tab_index();
693
+ return this.set_label_behavior();
694
+ };
695
+
696
+ Chosen.prototype.on_ready = function() {
697
+ return this.form_field_jq.trigger("chosen:ready", {
698
+ chosen: this
699
+ });
700
+ };
701
+
702
+ Chosen.prototype.register_observers = function() {
703
+ this.container.on('touchstart.chosen', (function(_this) {
704
+ return function(evt) {
705
+ _this.container_mousedown(evt);
706
+ };
707
+ })(this));
708
+ this.container.on('touchend.chosen', (function(_this) {
709
+ return function(evt) {
710
+ _this.container_mouseup(evt);
711
+ };
712
+ })(this));
713
+ this.container.on('mousedown.chosen', (function(_this) {
714
+ return function(evt) {
715
+ _this.container_mousedown(evt);
716
+ };
717
+ })(this));
718
+ this.container.on('mouseup.chosen', (function(_this) {
719
+ return function(evt) {
720
+ _this.container_mouseup(evt);
721
+ };
722
+ })(this));
723
+ this.container.on('mouseenter.chosen', (function(_this) {
724
+ return function(evt) {
725
+ _this.mouse_enter(evt);
726
+ };
727
+ })(this));
728
+ this.container.on('mouseleave.chosen', (function(_this) {
729
+ return function(evt) {
730
+ _this.mouse_leave(evt);
731
+ };
732
+ })(this));
733
+ this.search_results.on('mouseup.chosen', (function(_this) {
734
+ return function(evt) {
735
+ _this.search_results_mouseup(evt);
736
+ };
737
+ })(this));
738
+ this.search_results.on('mouseover.chosen', (function(_this) {
739
+ return function(evt) {
740
+ _this.search_results_mouseover(evt);
741
+ };
742
+ })(this));
743
+ this.search_results.on('mouseout.chosen', (function(_this) {
744
+ return function(evt) {
745
+ _this.search_results_mouseout(evt);
746
+ };
747
+ })(this));
748
+ this.search_results.on('mousewheel.chosen DOMMouseScroll.chosen', (function(_this) {
749
+ return function(evt) {
750
+ _this.search_results_mousewheel(evt);
751
+ };
752
+ })(this));
753
+ this.search_results.on('touchstart.chosen', (function(_this) {
754
+ return function(evt) {
755
+ _this.search_results_touchstart(evt);
756
+ };
757
+ })(this));
758
+ this.search_results.on('touchmove.chosen', (function(_this) {
759
+ return function(evt) {
760
+ _this.search_results_touchmove(evt);
761
+ };
762
+ })(this));
763
+ this.search_results.on('touchend.chosen', (function(_this) {
764
+ return function(evt) {
765
+ _this.search_results_touchend(evt);
766
+ };
767
+ })(this));
768
+ this.form_field_jq.on("chosen:updated.chosen", (function(_this) {
769
+ return function(evt) {
770
+ _this.results_update_field(evt);
771
+ };
772
+ })(this));
773
+ this.form_field_jq.on("chosen:activate.chosen", (function(_this) {
774
+ return function(evt) {
775
+ _this.activate_field(evt);
776
+ };
777
+ })(this));
778
+ this.form_field_jq.on("chosen:open.chosen", (function(_this) {
779
+ return function(evt) {
780
+ _this.container_mousedown(evt);
781
+ };
782
+ })(this));
783
+ this.form_field_jq.on("chosen:close.chosen", (function(_this) {
784
+ return function(evt) {
785
+ _this.close_field(evt);
786
+ };
787
+ })(this));
788
+ this.search_field.on('blur.chosen', (function(_this) {
789
+ return function(evt) {
790
+ _this.input_blur(evt);
791
+ };
792
+ })(this));
793
+ this.search_field.on('keyup.chosen', (function(_this) {
794
+ return function(evt) {
795
+ _this.keyup_checker(evt);
796
+ };
797
+ })(this));
798
+ this.search_field.on('keydown.chosen', (function(_this) {
799
+ return function(evt) {
800
+ _this.keydown_checker(evt);
801
+ };
802
+ })(this));
803
+ this.search_field.on('focus.chosen', (function(_this) {
804
+ return function(evt) {
805
+ _this.input_focus(evt);
806
+ };
807
+ })(this));
808
+ this.search_field.on('cut.chosen', (function(_this) {
809
+ return function(evt) {
810
+ _this.clipboard_event_checker(evt);
811
+ };
812
+ })(this));
813
+ this.search_field.on('paste.chosen', (function(_this) {
814
+ return function(evt) {
815
+ _this.clipboard_event_checker(evt);
816
+ };
817
+ })(this));
818
+ if (this.is_multiple) {
819
+ return this.search_choices.on('click.chosen', (function(_this) {
820
+ return function(evt) {
821
+ _this.choices_click(evt);
822
+ };
823
+ })(this));
824
+ } else {
825
+ return this.container.on('click.chosen', function(evt) {
826
+ evt.preventDefault();
827
+ });
828
+ }
829
+ };
830
+
831
+ Chosen.prototype.destroy = function() {
832
+ $(this.container[0].ownerDocument).off('click.chosen', this.click_test_action);
833
+ if (this.form_field_label.length > 0) {
834
+ this.form_field_label.off('click.chosen');
835
+ }
836
+ if (this.search_field[0].tabIndex) {
837
+ this.form_field_jq[0].tabIndex = this.search_field[0].tabIndex;
838
+ }
839
+ this.container.remove();
840
+ this.form_field_jq.removeData('chosen');
841
+ return this.form_field_jq.show();
842
+ };
843
+
844
+ Chosen.prototype.search_field_disabled = function() {
845
+ this.is_disabled = this.form_field.disabled || this.form_field_jq.parents('fieldset').is(':disabled');
846
+ this.container.toggleClass('chosen-disabled', this.is_disabled);
847
+ this.search_field[0].disabled = this.is_disabled;
848
+ if (!this.is_multiple) {
849
+ this.selected_item.off('focus.chosen', this.activate_field);
850
+ }
851
+ if (this.is_disabled) {
852
+ return this.close_field();
853
+ } else if (!this.is_multiple) {
854
+ return this.selected_item.on('focus.chosen', this.activate_field);
855
+ }
856
+ };
857
+
858
+ Chosen.prototype.container_mousedown = function(evt) {
859
+ var ref;
860
+ if (this.is_disabled) {
861
+ return;
862
+ }
863
+ if (evt && ((ref = evt.type) === 'mousedown' || ref === 'touchstart') && !this.results_showing) {
864
+ evt.preventDefault();
865
+ }
866
+ if (!((evt != null) && ($(evt.target)).hasClass("search-choice-close"))) {
867
+ if (!this.active_field) {
868
+ if (this.is_multiple) {
869
+ this.search_field.val("");
870
+ }
871
+ $(this.container[0].ownerDocument).on('click.chosen', this.click_test_action);
872
+ this.results_show();
873
+ } else if (!this.is_multiple && evt && (($(evt.target)[0] === this.selected_item[0]) || $(evt.target).parents("a.chosen-single").length)) {
874
+ evt.preventDefault();
875
+ this.results_toggle();
876
+ }
877
+ return this.activate_field();
878
+ }
879
+ };
880
+
881
+ Chosen.prototype.container_mouseup = function(evt) {
882
+ if (evt.target.nodeName === "ABBR" && !this.is_disabled) {
883
+ return this.results_reset(evt);
884
+ }
885
+ };
886
+
887
+ Chosen.prototype.search_results_mousewheel = function(evt) {
888
+ var delta;
889
+ if (evt.originalEvent) {
890
+ delta = evt.originalEvent.deltaY || -evt.originalEvent.wheelDelta || evt.originalEvent.detail;
891
+ }
892
+ if (delta != null) {
893
+ evt.preventDefault();
894
+ if (evt.type === 'DOMMouseScroll') {
895
+ delta = delta * 40;
896
+ }
897
+ return this.search_results.scrollTop(delta + this.search_results.scrollTop());
898
+ }
899
+ };
900
+
901
+ Chosen.prototype.blur_test = function(evt) {
902
+ if (!this.active_field && this.container.hasClass("chosen-container-active")) {
903
+ return this.close_field();
904
+ }
905
+ };
906
+
907
+ Chosen.prototype.close_field = function() {
908
+ $(this.container[0].ownerDocument).off("click.chosen", this.click_test_action);
909
+ this.active_field = false;
910
+ this.results_hide();
911
+ this.container.removeClass("chosen-container-active");
912
+ this.clear_backstroke();
913
+ this.show_search_field_default();
914
+ this.search_field_scale();
915
+ return this.search_field.blur();
916
+ };
917
+
918
+ Chosen.prototype.activate_field = function() {
919
+ if (this.is_disabled) {
920
+ return;
921
+ }
922
+ this.container.addClass("chosen-container-active");
923
+ this.active_field = true;
924
+ this.search_field.val(this.search_field.val());
925
+ return this.search_field.focus();
926
+ };
927
+
928
+ Chosen.prototype.test_active_click = function(evt) {
929
+ var active_container;
930
+ active_container = $(evt.target).closest('.chosen-container');
931
+ if (active_container.length && this.container[0] === active_container[0]) {
932
+ return this.active_field = true;
933
+ } else {
934
+ return this.close_field();
935
+ }
936
+ };
937
+
938
+ Chosen.prototype.results_build = function() {
939
+ this.parsing = true;
940
+ this.selected_option_count = null;
941
+ this.results_data = SelectParser.select_to_array(this.form_field);
942
+ if (this.is_multiple) {
943
+ this.search_choices.find("li.search-choice").remove();
944
+ } else if (!this.is_multiple) {
945
+ this.single_set_selected_text();
946
+ if (this.disable_search || this.form_field.options.length <= this.disable_search_threshold) {
947
+ this.search_field[0].readOnly = true;
948
+ this.container.addClass("chosen-container-single-nosearch");
949
+ } else {
950
+ this.search_field[0].readOnly = false;
951
+ this.container.removeClass("chosen-container-single-nosearch");
952
+ }
953
+ }
954
+ this.update_results_content(this.results_option_build({
955
+ first: true
956
+ }));
957
+ this.search_field_disabled();
958
+ this.show_search_field_default();
959
+ this.search_field_scale();
960
+ return this.parsing = false;
961
+ };
962
+
963
+ Chosen.prototype.result_do_highlight = function(el) {
964
+ var high_bottom, high_top, maxHeight, visible_bottom, visible_top;
965
+ if (el.length) {
966
+ this.result_clear_highlight();
967
+ this.result_highlight = el;
968
+ this.result_highlight.addClass("highlighted");
969
+ maxHeight = parseInt(this.search_results.css("maxHeight"), 10);
970
+ visible_top = this.search_results.scrollTop();
971
+ visible_bottom = maxHeight + visible_top;
972
+ high_top = this.result_highlight.position().top + this.search_results.scrollTop();
973
+ high_bottom = high_top + this.result_highlight.outerHeight();
974
+ if (high_bottom >= visible_bottom) {
975
+ return this.search_results.scrollTop((high_bottom - maxHeight) > 0 ? high_bottom - maxHeight : 0);
976
+ } else if (high_top < visible_top) {
977
+ return this.search_results.scrollTop(high_top);
978
+ }
979
+ }
980
+ };
981
+
982
+ Chosen.prototype.result_clear_highlight = function() {
983
+ if (this.result_highlight) {
984
+ this.result_highlight.removeClass("highlighted");
985
+ }
986
+ return this.result_highlight = null;
987
+ };
988
+
989
+ Chosen.prototype.results_show = function() {
990
+ if (this.is_multiple && this.max_selected_options <= this.choices_count()) {
991
+ this.form_field_jq.trigger("chosen:maxselected", {
992
+ chosen: this
993
+ });
994
+ return false;
995
+ }
996
+ this.container.addClass("chosen-with-drop");
997
+ this.results_showing = true;
998
+ this.search_field.focus();
999
+ this.search_field.val(this.get_search_field_value());
1000
+ this.winnow_results();
1001
+ return this.form_field_jq.trigger("chosen:showing_dropdown", {
1002
+ chosen: this
1003
+ });
1004
+ };
1005
+
1006
+ Chosen.prototype.update_results_content = function(content) {
1007
+ return this.search_results.html(content);
1008
+ };
1009
+
1010
+ Chosen.prototype.results_hide = function() {
1011
+ if (this.results_showing) {
1012
+ this.result_clear_highlight();
1013
+ this.container.removeClass("chosen-with-drop");
1014
+ this.form_field_jq.trigger("chosen:hiding_dropdown", {
1015
+ chosen: this
1016
+ });
1017
+ }
1018
+ return this.results_showing = false;
1019
+ };
1020
+
1021
+ Chosen.prototype.set_tab_index = function(el) {
1022
+ var ti;
1023
+ if (this.form_field.tabIndex) {
1024
+ ti = this.form_field.tabIndex;
1025
+ this.form_field.tabIndex = -1;
1026
+ return this.search_field[0].tabIndex = ti;
1027
+ }
1028
+ };
1029
+
1030
+ Chosen.prototype.set_label_behavior = function() {
1031
+ this.form_field_label = this.form_field_jq.parents("label");
1032
+ if (!this.form_field_label.length && this.form_field.id.length) {
1033
+ this.form_field_label = $("label[for='" + this.form_field.id + "']");
1034
+ }
1035
+ if (this.form_field_label.length > 0) {
1036
+ return this.form_field_label.on('click.chosen', this.label_click_handler);
1037
+ }
1038
+ };
1039
+
1040
+ Chosen.prototype.show_search_field_default = function() {
1041
+ if (this.is_multiple && this.choices_count() < 1 && !this.active_field) {
1042
+ this.search_field.val(this.default_text);
1043
+ return this.search_field.addClass("default");
1044
+ } else {
1045
+ this.search_field.val("");
1046
+ return this.search_field.removeClass("default");
1047
+ }
1048
+ };
1049
+
1050
+ Chosen.prototype.search_results_mouseup = function(evt) {
1051
+ var target;
1052
+ target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
1053
+ if (target.length) {
1054
+ this.result_highlight = target;
1055
+ this.result_select(evt);
1056
+ return this.search_field.focus();
1057
+ }
1058
+ };
1059
+
1060
+ Chosen.prototype.search_results_mouseover = function(evt) {
1061
+ var target;
1062
+ target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
1063
+ if (target) {
1064
+ return this.result_do_highlight(target);
1065
+ }
1066
+ };
1067
+
1068
+ Chosen.prototype.search_results_mouseout = function(evt) {
1069
+ if ($(evt.target).hasClass("active-result") || $(evt.target).parents('.active-result').first()) {
1070
+ return this.result_clear_highlight();
1071
+ }
1072
+ };
1073
+
1074
+ Chosen.prototype.choice_build = function(item) {
1075
+ var choice, close_link;
1076
+ choice = $('<li />', {
1077
+ "class": "search-choice"
1078
+ }).html("<span>" + (this.choice_label(item)) + "</span>");
1079
+ if (item.disabled) {
1080
+ choice.addClass('search-choice-disabled');
1081
+ } else {
1082
+ close_link = $('<a />', {
1083
+ "class": 'search-choice-close',
1084
+ 'data-option-array-index': item.array_index
1085
+ });
1086
+ close_link.on('click.chosen', (function(_this) {
1087
+ return function(evt) {
1088
+ return _this.choice_destroy_link_click(evt);
1089
+ };
1090
+ })(this));
1091
+ choice.append(close_link);
1092
+ }
1093
+ return this.search_container.before(choice);
1094
+ };
1095
+
1096
+ Chosen.prototype.choice_destroy_link_click = function(evt) {
1097
+ evt.preventDefault();
1098
+ evt.stopPropagation();
1099
+ if (!this.is_disabled) {
1100
+ return this.choice_destroy($(evt.target));
1101
+ }
1102
+ };
1103
+
1104
+ Chosen.prototype.choice_destroy = function(link) {
1105
+ if (this.result_deselect(link[0].getAttribute("data-option-array-index"))) {
1106
+ if (this.active_field) {
1107
+ this.search_field.focus();
1108
+ } else {
1109
+ this.show_search_field_default();
1110
+ }
1111
+ if (this.is_multiple && this.choices_count() > 0 && this.get_search_field_value().length < 1) {
1112
+ this.results_hide();
1113
+ }
1114
+ link.parents('li').first().remove();
1115
+ return this.search_field_scale();
1116
+ }
1117
+ };
1118
+
1119
+ Chosen.prototype.results_reset = function() {
1120
+ this.reset_single_select_options();
1121
+ this.form_field.options[0].selected = true;
1122
+ this.single_set_selected_text();
1123
+ this.show_search_field_default();
1124
+ this.results_reset_cleanup();
1125
+ this.trigger_form_field_change();
1126
+ if (this.active_field) {
1127
+ return this.results_hide();
1128
+ }
1129
+ };
1130
+
1131
+ Chosen.prototype.results_reset_cleanup = function() {
1132
+ this.current_selectedIndex = this.form_field.selectedIndex;
1133
+ return this.selected_item.find("abbr").remove();
1134
+ };
1135
+
1136
+ Chosen.prototype.result_select = function(evt) {
1137
+ var high, item;
1138
+ if (this.result_highlight) {
1139
+ high = this.result_highlight;
1140
+ this.result_clear_highlight();
1141
+ if (this.is_multiple && this.max_selected_options <= this.choices_count()) {
1142
+ this.form_field_jq.trigger("chosen:maxselected", {
1143
+ chosen: this
1144
+ });
1145
+ return false;
1146
+ }
1147
+ if (this.is_multiple) {
1148
+ high.removeClass("active-result");
1149
+ } else {
1150
+ this.reset_single_select_options();
1151
+ }
1152
+ high.addClass("result-selected");
1153
+ item = this.results_data[high[0].getAttribute("data-option-array-index")];
1154
+ item.selected = true;
1155
+ this.form_field.options[item.options_index].selected = true;
1156
+ this.selected_option_count = null;
1157
+ this.search_field.val("");
1158
+ if (this.is_multiple) {
1159
+ this.choice_build(item);
1160
+ } else {
1161
+ this.single_set_selected_text(this.choice_label(item));
1162
+ }
1163
+ if (this.is_multiple && (!this.hide_results_on_select || (evt.metaKey || evt.ctrlKey))) {
1164
+ this.winnow_results();
1165
+ } else {
1166
+ this.results_hide();
1167
+ this.show_search_field_default();
1168
+ }
1169
+ if (this.is_multiple || this.form_field.selectedIndex !== this.current_selectedIndex) {
1170
+ this.trigger_form_field_change({
1171
+ selected: this.form_field.options[item.options_index].value
1172
+ });
1173
+ }
1174
+ this.current_selectedIndex = this.form_field.selectedIndex;
1175
+ evt.preventDefault();
1176
+ return this.search_field_scale();
1177
+ }
1178
+ };
1179
+
1180
+ Chosen.prototype.single_set_selected_text = function(text) {
1181
+ if (text == null) {
1182
+ text = this.default_text;
1183
+ }
1184
+ if (text === this.default_text) {
1185
+ this.selected_item.addClass("chosen-default");
1186
+ } else {
1187
+ this.single_deselect_control_build();
1188
+ this.selected_item.removeClass("chosen-default");
1189
+ }
1190
+ return this.selected_item.find("span").html(text);
1191
+ };
1192
+
1193
+ Chosen.prototype.result_deselect = function(pos) {
1194
+ var result_data;
1195
+ result_data = this.results_data[pos];
1196
+ if (!this.form_field.options[result_data.options_index].disabled) {
1197
+ result_data.selected = false;
1198
+ this.form_field.options[result_data.options_index].selected = false;
1199
+ this.selected_option_count = null;
1200
+ this.result_clear_highlight();
1201
+ if (this.results_showing) {
1202
+ this.winnow_results();
1203
+ }
1204
+ this.trigger_form_field_change({
1205
+ deselected: this.form_field.options[result_data.options_index].value
1206
+ });
1207
+ this.search_field_scale();
1208
+ return true;
1209
+ } else {
1210
+ return false;
1211
+ }
1212
+ };
1213
+
1214
+ Chosen.prototype.single_deselect_control_build = function() {
1215
+ if (!this.allow_single_deselect) {
1216
+ return;
1217
+ }
1218
+ if (!this.selected_item.find("abbr").length) {
1219
+ this.selected_item.find("span").first().after("<abbr class=\"search-choice-close\"></abbr>");
1220
+ }
1221
+ return this.selected_item.addClass("chosen-single-with-deselect");
1222
+ };
1223
+
1224
+ Chosen.prototype.get_search_field_value = function() {
1225
+ return this.search_field.val();
1226
+ };
1227
+
1228
+ Chosen.prototype.get_search_text = function() {
1229
+ return $.trim(this.get_search_field_value());
1230
+ };
1231
+
1232
+ Chosen.prototype.escape_html = function(text) {
1233
+ return $('<div/>').text(text).html();
1234
+ };
1235
+
1236
+ Chosen.prototype.winnow_results_set_highlight = function() {
1237
+ var do_high, selected_results;
1238
+ selected_results = !this.is_multiple ? this.search_results.find(".result-selected.active-result") : [];
1239
+ do_high = selected_results.length ? selected_results.first() : this.search_results.find(".active-result").first();
1240
+ if (do_high != null) {
1241
+ return this.result_do_highlight(do_high);
1242
+ }
1243
+ };
1244
+
1245
+ Chosen.prototype.no_results = function(terms) {
1246
+ var no_results_html;
1247
+ no_results_html = this.get_no_results_html(terms);
1248
+ this.search_results.append(no_results_html);
1249
+ return this.form_field_jq.trigger("chosen:no_results", {
1250
+ chosen: this
1251
+ });
1252
+ };
1253
+
1254
+ Chosen.prototype.no_results_clear = function() {
1255
+ return this.search_results.find(".no-results").remove();
1256
+ };
1257
+
1258
+ Chosen.prototype.keydown_arrow = function() {
1259
+ var next_sib;
1260
+ if (this.results_showing && this.result_highlight) {
1261
+ next_sib = this.result_highlight.nextAll("li.active-result").first();
1262
+ if (next_sib) {
1263
+ return this.result_do_highlight(next_sib);
1264
+ }
1265
+ } else {
1266
+ return this.results_show();
1267
+ }
1268
+ };
1269
+
1270
+ Chosen.prototype.keyup_arrow = function() {
1271
+ var prev_sibs;
1272
+ if (!this.results_showing && !this.is_multiple) {
1273
+ return this.results_show();
1274
+ } else if (this.result_highlight) {
1275
+ prev_sibs = this.result_highlight.prevAll("li.active-result");
1276
+ if (prev_sibs.length) {
1277
+ return this.result_do_highlight(prev_sibs.first());
1278
+ } else {
1279
+ if (this.choices_count() > 0) {
1280
+ this.results_hide();
1281
+ }
1282
+ return this.result_clear_highlight();
1283
+ }
1284
+ }
1285
+ };
1286
+
1287
+ Chosen.prototype.keydown_backstroke = function() {
1288
+ var next_available_destroy;
1289
+ if (this.pending_backstroke) {
1290
+ this.choice_destroy(this.pending_backstroke.find("a").first());
1291
+ return this.clear_backstroke();
1292
+ } else {
1293
+ next_available_destroy = this.search_container.siblings("li.search-choice").last();
1294
+ if (next_available_destroy.length && !next_available_destroy.hasClass("search-choice-disabled")) {
1295
+ this.pending_backstroke = next_available_destroy;
1296
+ if (this.single_backstroke_delete) {
1297
+ return this.keydown_backstroke();
1298
+ } else {
1299
+ return this.pending_backstroke.addClass("search-choice-focus");
1300
+ }
1301
+ }
1302
+ }
1303
+ };
1304
+
1305
+ Chosen.prototype.clear_backstroke = function() {
1306
+ if (this.pending_backstroke) {
1307
+ this.pending_backstroke.removeClass("search-choice-focus");
1308
+ }
1309
+ return this.pending_backstroke = null;
1310
+ };
1311
+
1312
+ Chosen.prototype.search_field_scale = function() {
1313
+ var div, i, len, style, style_block, styles, width;
1314
+ if (!this.is_multiple) {
1315
+ return;
1316
+ }
1317
+ style_block = {
1318
+ position: 'absolute',
1319
+ left: '-1000px',
1320
+ top: '-1000px',
1321
+ display: 'none',
1322
+ whiteSpace: 'pre'
1323
+ };
1324
+ styles = ['fontSize', 'fontStyle', 'fontWeight', 'fontFamily', 'lineHeight', 'textTransform', 'letterSpacing'];
1325
+ for (i = 0, len = styles.length; i < len; i++) {
1326
+ style = styles[i];
1327
+ style_block[style] = this.search_field.css(style);
1328
+ }
1329
+ div = $('<div />').css(style_block);
1330
+ div.text(this.get_search_field_value());
1331
+ $('body').append(div);
1332
+ width = div.width() + 25;
1333
+ div.remove();
1334
+ if (this.container.is(':visible')) {
1335
+ width = Math.min(this.container.outerWidth() - 10, width);
1336
+ }
1337
+ return this.search_field.width(width);
1338
+ };
1339
+
1340
+ Chosen.prototype.trigger_form_field_change = function(extra) {
1341
+ this.form_field_jq.trigger("input", extra);
1342
+ return this.form_field_jq.trigger("change", extra);
1343
+ };
1344
+
1345
+ return Chosen;
1346
+
1347
+ })(AbstractChosen);
1348
+
1349
+ }).call(this);
controls/assets/js/uncompressed/jQuery-minicolors/LICENSE.md ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ Copyright 2017 A Beautiful Site, LLC
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
controls/assets/js/uncompressed/jQuery-minicolors/jquery.minicolors.js ADDED
@@ -0,0 +1,1108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //
2
+ // jQuery MiniColors: A tiny color picker built on jQuery
3
+ //
4
+ // Developed by Cory LaViska for A Beautiful Site, LLC
5
+ //
6
+ // Licensed under the MIT license: http://opensource.org/licenses/MIT
7
+ //
8
+ (function (factory) {
9
+ if(typeof define === 'function' && define.amd) {
10
+ // AMD. Register as an anonymous module.
11
+ define(['jquery'], factory);
12
+ } else if(typeof exports === 'object') {
13
+ // Node/CommonJS
14
+ module.exports = factory(require('jquery'));
15
+ } else {
16
+ // Browser globals
17
+ factory(jQuery);
18
+ }
19
+ }(function ($) {
20
+ 'use strict';
21
+
22
+ // Defaults
23
+ $.minicolors = {
24
+ defaults: {
25
+ animationSpeed: 50,
26
+ animationEasing: 'swing',
27
+ change: null,
28
+ changeDelay: 0,
29
+ control: 'hue',
30
+ defaultValue: '',
31
+ format: 'hex',
32
+ hide: null,
33
+ hideSpeed: 100,
34
+ inline: false,
35
+ keywords: '',
36
+ letterCase: 'lowercase',
37
+ opacity: false,
38
+ position: 'bottom left',
39
+ show: null,
40
+ showSpeed: 100,
41
+ theme: 'default',
42
+ swatches: []
43
+ }
44
+ };
45
+
46
+ // Public methods
47
+ $.extend($.fn, {
48
+ minicolors: function(method, data) {
49
+
50
+ switch(method) {
51
+ // Destroy the control
52
+ case 'destroy':
53
+ $(this).each(function() {
54
+ destroy($(this));
55
+ });
56
+ return $(this);
57
+
58
+ // Hide the color picker
59
+ case 'hide':
60
+ hide();
61
+ return $(this);
62
+
63
+ // Get/set opacity
64
+ case 'opacity':
65
+ // Getter
66
+ if(data === undefined) {
67
+ // Getter
68
+ return $(this).attr('data-opacity');
69
+ } else {
70
+ // Setter
71
+ $(this).each(function() {
72
+ updateFromInput($(this).attr('data-opacity', data));
73
+ });
74
+ }
75
+ return $(this);
76
+
77
+ // Get an RGB(A) object based on the current color/opacity
78
+ case 'rgbObject':
79
+ return rgbObject($(this), method === 'rgbaObject');
80
+
81
+ // Get an RGB(A) string based on the current color/opacity
82
+ case 'rgbString':
83
+ case 'rgbaString':
84
+ return rgbString($(this), method === 'rgbaString');
85
+
86
+ // Get/set settings on the fly
87
+ case 'settings':
88
+ if(data === undefined) {
89
+ return $(this).data('minicolors-settings');
90
+ } else {
91
+ // Setter
92
+ $(this).each(function() {
93
+ var settings = $(this).data('minicolors-settings') || {};
94
+ destroy($(this));
95
+ $(this).minicolors($.extend(true, settings, data));
96
+ });
97
+ }
98
+ return $(this);
99
+
100
+ // Show the color picker
101
+ case 'show':
102
+ show($(this).eq(0));
103
+ return $(this);
104
+
105
+ // Get/set the hex color value
106
+ case 'value':
107
+ if(data === undefined) {
108
+ // Getter
109
+ return $(this).val();
110
+ } else {
111
+ // Setter
112
+ $(this).each(function() {
113
+ if(typeof(data) === 'object' && data !== null) {
114
+ if(data.opacity) {
115
+ $(this).attr('data-opacity', keepWithin(data.opacity, 0, 1));
116
+ }
117
+ if(data.color) {
118
+ $(this).val(data.color);
119
+ }
120
+ } else {
121
+ $(this).val(data);
122
+ }
123
+ updateFromInput($(this));
124
+ });
125
+ }
126
+ return $(this);
127
+
128
+ // Initializes the control
129
+ default:
130
+ if(method !== 'create') data = method;
131
+ $(this).each(function() {
132
+ init($(this), data);
133
+ });
134
+ return $(this);
135
+
136
+ }
137
+
138
+ }
139
+ });
140
+
141
+ // Initialize input elements
142
+ function init(input, settings) {
143
+ var minicolors = $('<div class="minicolors" />');
144
+ var defaults = $.minicolors.defaults;
145
+ var size;
146
+ var swatches;
147
+ var swatch;
148
+ var panel;
149
+ var i;
150
+
151
+ // Do nothing if already initialized
152
+ if(input.data('minicolors-initialized')) return;
153
+
154
+ // Handle settings
155
+ settings = $.extend(true, {}, defaults, settings);
156
+
157
+ // The wrapper
158
+ minicolors
159
+ .addClass('minicolors-theme-' + settings.theme)
160
+ .toggleClass('minicolors-with-opacity', settings.opacity);
161
+
162
+ // Custom positioning
163
+ if(settings.position !== undefined) {
164
+ $.each(settings.position.split(' '), function() {
165
+ minicolors.addClass('minicolors-position-' + this);
166
+ });
167
+ }
168
+
169
+ // Input size
170
+ if(settings.format === 'rgb') {
171
+ size = settings.opacity ? '25' : '20';
172
+ } else {
173
+ size = settings.keywords ? '11' : '7';
174
+ }
175
+
176
+ // The input
177
+ input
178
+ .addClass('minicolors-input')
179
+ .data('minicolors-initialized', false)
180
+ .data('minicolors-settings', settings)
181
+ .prop('size', size)
182
+ .wrap(minicolors)
183
+ .after(
184
+ '<div class="minicolors-panel minicolors-slider-' + settings.control + '">' +
185
+ '<div class="minicolors-slider minicolors-sprite">' +
186
+ '<div class="minicolors-picker"></div>' +
187
+ '</div>' +
188
+ '<div class="minicolors-opacity-slider minicolors-sprite">' +
189
+ '<div class="minicolors-picker"></div>' +
190
+ '</div>' +
191
+ '<div class="minicolors-grid minicolors-sprite">' +
192
+ '<div class="minicolors-grid-inner"></div>' +
193
+ '<div class="minicolors-picker"><div></div></div>' +
194
+ '</div>' +
195
+ '</div>'
196
+ );
197
+
198
+ // The swatch
199
+ if(!settings.inline) {
200
+ input.after('<span class="minicolors-swatch minicolors-sprite minicolors-input-swatch"><span class="minicolors-swatch-color"></span></span>');
201
+ input.next('.minicolors-input-swatch').on('click', function(event) {
202
+ event.preventDefault();
203
+ input.focus();
204
+ });
205
+ }
206
+
207
+ // Prevent text selection in IE
208
+ panel = input.parent().find('.minicolors-panel');
209
+ panel.on('selectstart', function() { return false; }).end();
210
+
211
+ // Swatches
212
+ if(settings.swatches && settings.swatches.length !== 0) {
213
+ panel.addClass('minicolors-with-swatches');
214
+ swatches = $('<ul class="minicolors-swatches"></ul>')
215
+ .appendTo(panel);
216
+ for(i = 0; i < settings.swatches.length; ++i) {
217
+ swatch = settings.swatches[i];
218
+ swatch = isRgb(swatch) ? parseRgb(swatch, true) : hex2rgb(parseHex(swatch, true));
219
+ $('<li class="minicolors-swatch minicolors-sprite"><span class="minicolors-swatch-color"></span></li>')
220
+ .appendTo(swatches)
221
+ .data('swatch-color', settings.swatches[i])
222
+ .find('.minicolors-swatch-color')
223
+ .css({
224
+ backgroundColor: rgb2hex(swatch),
225
+ opacity: swatch.a
226
+ });
227
+ settings.swatches[i] = swatch;
228
+ }
229
+ }
230
+
231
+ // Inline controls
232
+ if(settings.inline) input.parent().addClass('minicolors-inline');
233
+
234
+ updateFromInput(input, false);
235
+
236
+ input.data('minicolors-initialized', true);
237
+ }
238
+
239
+ // Returns the input back to its original state
240
+ function destroy(input) {
241
+ var minicolors = input.parent();
242
+
243
+ // Revert the input element
244
+ input
245
+ .removeData('minicolors-initialized')
246
+ .removeData('minicolors-settings')
247
+ .removeProp('size')
248
+ .removeClass('minicolors-input');
249
+
250
+ // Remove the wrap and destroy whatever remains
251
+ minicolors.before(input).remove();
252
+ }
253
+
254
+ // Shows the specified dropdown panel
255
+ function show(input) {
256
+ var minicolors = input.parent();
257
+ var panel = minicolors.find('.minicolors-panel');
258
+ var settings = input.data('minicolors-settings');
259
+
260
+ // Do nothing if uninitialized, disabled, inline, or already open
261
+ if(
262
+ !input.data('minicolors-initialized') ||
263
+ input.prop('disabled') ||
264
+ minicolors.hasClass('minicolors-inline') ||
265
+ minicolors.hasClass('minicolors-focus')
266
+ ) return;
267
+
268
+ hide();
269
+
270
+ minicolors.addClass('minicolors-focus');
271
+ panel
272
+ .stop(true, true)
273
+ .fadeIn(settings.showSpeed, function() {
274
+ if(settings.show) settings.show.call(input.get(0));
275
+ });
276
+ }
277
+
278
+ // Hides all dropdown panels
279
+ function hide() {
280
+ $('.minicolors-focus').each(function() {
281
+ var minicolors = $(this);
282
+ var input = minicolors.find('.minicolors-input');
283
+ var panel = minicolors.find('.minicolors-panel');
284
+ var settings = input.data('minicolors-settings');
285
+
286
+ panel.fadeOut(settings.hideSpeed, function() {
287
+ if(settings.hide) settings.hide.call(input.get(0));
288
+ minicolors.removeClass('minicolors-focus');
289
+ });
290
+
291
+ });
292
+ }
293
+
294
+ // Moves the selected picker
295
+ function move(target, event, animate) {
296
+ var input = target.parents('.minicolors').find('.minicolors-input');
297
+ var settings = input.data('minicolors-settings');
298
+ var picker = target.find('[class$=-picker]');
299
+ var offsetX = target.offset().left;
300
+ var offsetY = target.offset().top;
301
+ var x = Math.round(event.pageX - offsetX);
302
+ var y = Math.round(event.pageY - offsetY);
303
+ var duration = animate ? settings.animationSpeed : 0;
304
+ var wx, wy, r, phi;
305
+
306
+ // Touch support
307
+ if(event.originalEvent.changedTouches) {
308
+ x = event.originalEvent.changedTouches[0].pageX - offsetX;
309
+ y = event.originalEvent.changedTouches[0].pageY - offsetY;
310
+ }
311
+
312
+ // Constrain picker to its container
313
+ if(x < 0) x = 0;
314
+ if(y < 0) y = 0;
315
+ if(x > target.width()) x = target.width();
316
+ if(y > target.height()) y = target.height();
317
+
318
+ // Constrain color wheel values to the wheel
319
+ if(target.parent().is('.minicolors-slider-wheel') && picker.parent().is('.minicolors-grid')) {
320
+ wx = 75 - x;
321
+ wy = 75 - y;
322
+ r = Math.sqrt(wx * wx + wy * wy);
323
+ phi = Math.atan2(wy, wx);
324
+ if(phi < 0) phi += Math.PI * 2;
325
+ if(r > 75) {
326
+ r = 75;
327
+ x = 75 - (75 * Math.cos(phi));
328
+ y = 75 - (75 * Math.sin(phi));
329
+ }
330
+ x = Math.round(x);
331
+ y = Math.round(y);
332
+ }
333
+
334
+ // Move the picker
335
+ if(target.is('.minicolors-grid')) {
336
+ picker
337
+ .stop(true)
338
+ .animate({
339
+ top: y + 'px',
340
+ left: x + 'px'
341
+ }, duration, settings.animationEasing, function() {
342
+ updateFromControl(input, target);
343
+ });
344
+ } else {
345
+ picker
346
+ .stop(true)
347
+ .animate({
348
+ top: y + 'px'
349
+ }, duration, settings.animationEasing, function() {
350
+ updateFromControl(input, target);
351
+ });
352
+ }
353
+ }
354
+
355
+ // Sets the input based on the color picker values
356
+ function updateFromControl(input, target) {
357
+
358
+ function getCoords(picker, container) {
359
+ var left, top;
360
+ if(!picker.length || !container) return null;
361
+ left = picker.offset().left;
362
+ top = picker.offset().top;
363
+
364
+ return {
365
+ x: left - container.offset().left + (picker.outerWidth() / 2),
366
+ y: top - container.offset().top + (picker.outerHeight() / 2)
367
+ };
368
+ }
369
+
370
+ var hue, saturation, brightness, x, y, r, phi;
371
+ var hex = input.val();
372
+ var opacity = input.attr('data-opacity');
373
+
374
+ // Helpful references
375
+ var minicolors = input.parent();
376
+ var settings = input.data('minicolors-settings');
377
+ var swatch = minicolors.find('.minicolors-input-swatch');
378
+
379
+ // Panel objects
380
+ var grid = minicolors.find('.minicolors-grid');
381
+ var slider = minicolors.find('.minicolors-slider');
382
+ var opacitySlider = minicolors.find('.minicolors-opacity-slider');
383
+
384
+ // Picker objects
385
+ var gridPicker = grid.find('[class$=-picker]');
386
+ var sliderPicker = slider.find('[class$=-picker]');
387
+ var opacityPicker = opacitySlider.find('[class$=-picker]');
388
+
389
+ // Picker positions
390
+ var gridPos = getCoords(gridPicker, grid);
391
+ var sliderPos = getCoords(sliderPicker, slider);
392
+ var opacityPos = getCoords(opacityPicker, opacitySlider);
393
+
394
+ // Handle colors
395
+ if(target.is('.minicolors-grid, .minicolors-slider, .minicolors-opacity-slider')) {
396
+
397
+ // Determine HSB values
398
+ switch(settings.control) {
399
+ case 'wheel':
400
+ // Calculate hue, saturation, and brightness
401
+ x = (grid.width() / 2) - gridPos.x;
402
+ y = (grid.height() / 2) - gridPos.y;
403
+ r = Math.sqrt(x * x + y * y);
404
+ phi = Math.atan2(y, x);
405
+ if(phi < 0) phi += Math.PI * 2;
406
+ if(r > 75) {
407
+ r = 75;
408
+ gridPos.x = 69 - (75 * Math.cos(phi));
409
+ gridPos.y = 69 - (75 * Math.sin(phi));
410
+ }
411
+ saturation = keepWithin(r / 0.75, 0, 100);
412
+ hue = keepWithin(phi * 180 / Math.PI, 0, 360);
413
+ brightness = keepWithin(100 - Math.floor(sliderPos.y * (100 / slider.height())), 0, 100);
414
+ hex = hsb2hex({
415
+ h: hue,
416
+ s: saturation,
417
+ b: brightness
418
+ });
419
+
420
+ // Update UI
421
+ slider.css('backgroundColor', hsb2hex({ h: hue, s: saturation, b: 100 }));
422
+ break;
423
+
424
+ case 'saturation':
425
+ // Calculate hue, saturation, and brightness
426
+ hue = keepWithin(parseInt(gridPos.x * (360 / grid.width()), 10), 0, 360);
427
+ saturation = keepWithin(100 - Math.floor(sliderPos.y * (100 / slider.height())), 0, 100);
428
+ brightness = keepWithin(100 - Math.floor(gridPos.y * (100 / grid.height())), 0, 100);
429
+ hex = hsb2hex({
430
+ h: hue,
431
+ s: saturation,
432
+ b: brightness
433
+ });
434
+
435
+ // Update UI
436
+ slider.css('backgroundColor', hsb2hex({ h: hue, s: 100, b: brightness }));
437
+ minicolors.find('.minicolors-grid-inner').css('opacity', saturation / 100);
438
+ break;
439
+
440
+ case 'brightness':
441
+ // Calculate hue, saturation, and brightness
442
+ hue = keepWithin(parseInt(gridPos.x * (360 / grid.width()), 10), 0, 360);
443
+ saturation = keepWithin(100 - Math.floor(gridPos.y * (100 / grid.height())), 0, 100);
444
+ brightness = keepWithin(100 - Math.floor(sliderPos.y * (100 / slider.height())), 0, 100);
445
+ hex = hsb2hex({
446
+ h: hue,
447
+ s: saturation,
448
+ b: brightness
449
+ });
450
+
451
+ // Update UI
452
+ slider.css('backgroundColor', hsb2hex({ h: hue, s: saturation, b: 100 }));
453
+ minicolors.find('.minicolors-grid-inner').css('opacity', 1 - (brightness / 100));
454
+ break;
455
+
456
+ default:
457
+ // Calculate hue, saturation, and brightness
458
+ hue = keepWithin(360 - parseInt(sliderPos.y * (360 / slider.height()), 10), 0, 360);
459
+ saturation = keepWithin(Math.floor(gridPos.x * (100 / grid.width())), 0, 100);
460
+ brightness = keepWithin(100 - Math.floor(gridPos.y * (100 / grid.height())), 0, 100);
461
+ hex = hsb2hex({
462
+ h: hue,
463
+ s: saturation,
464
+ b: brightness
465
+ });
466
+
467
+ // Update UI
468
+ grid.css('backgroundColor', hsb2hex({ h: hue, s: 100, b: 100 }));
469
+ break;
470
+ }
471
+
472
+ // Handle opacity
473
+ if(settings.opacity) {
474
+ opacity = parseFloat(1 - (opacityPos.y / opacitySlider.height())).toFixed(2);
475
+ } else {
476
+ opacity = 1;
477
+ }
478
+
479
+ updateInput(input, hex, opacity);
480
+ }
481
+ else {
482
+ // Set swatch color
483
+ swatch.find('span').css({
484
+ backgroundColor: hex,
485
+ opacity: opacity
486
+ });
487
+
488
+ // Handle change event
489
+ doChange(input, hex, opacity);
490
+ }
491
+ }
492
+
493
+ // Sets the value of the input and does the appropriate conversions
494
+ // to respect settings, also updates the swatch
495
+ function updateInput(input, value, opacity) {
496
+ var rgb;
497
+
498
+ // Helpful references
499
+ var minicolors = input.parent();
500
+ var settings = input.data('minicolors-settings');
501
+ var swatch = minicolors.find('.minicolors-input-swatch');
502
+
503
+ if(settings.opacity) input.attr('data-opacity', opacity);
504
+
505
+ // Set color string
506
+ if(settings.format === 'rgb') {
507
+ // Returns RGB(A) string
508
+
509
+ // Checks for input format and does the conversion
510
+ if(isRgb(value)) {
511
+ rgb = parseRgb(value, true);
512
+ }
513
+ else {
514
+ rgb = hex2rgb(parseHex(value, true));
515
+ }
516
+
517
+ opacity = input.attr('data-opacity') === '' ? 1 : keepWithin(parseFloat(input.attr('data-opacity')).toFixed(2), 0, 1);
518
+ if(isNaN(opacity) || !settings.opacity) opacity = 1;
519
+
520
+ if(input.minicolors('rgbObject').a <= 1 && rgb && settings.opacity) {
521
+ // Set RGBA string if alpha
522
+ value = 'rgba(' + rgb.r + ', ' + rgb.g + ', ' + rgb.b + ', ' + parseFloat(opacity) + ')';
523
+ } else {
524
+ // Set RGB string (alpha = 1)
525
+ value = 'rgb(' + rgb.r + ', ' + rgb.g + ', ' + rgb.b + ')';
526
+ }
527
+ } else {
528
+ // Returns hex color
529
+
530
+ // Checks for input format and does the conversion
531
+ if(isRgb(value)) {
532
+ value = rgbString2hex(value);
533
+ }
534
+
535
+ value = convertCase(value, settings.letterCase);
536
+ }
537
+
538
+ // Update value from picker
539
+ input.val(value);
540
+
541
+ // Set swatch color
542
+ swatch.find('span').css({
543
+ backgroundColor: value,
544
+ opacity: opacity
545
+ });
546
+
547
+ // Handle change event
548
+ doChange(input, value, opacity);
549
+ }
550
+
551
+ // Sets the color picker values from the input
552
+ function updateFromInput(input, preserveInputValue) {
553
+ var hex, hsb, opacity, keywords, alpha, value, x, y, r, phi;
554
+
555
+ // Helpful references
556
+ var minicolors = input.parent();
557
+ var settings = input.data('minicolors-settings');
558
+ var swatch = minicolors.find('.minicolors-input-swatch');
559
+
560
+ // Panel objects
561
+ var grid = minicolors.find('.minicolors-grid');
562
+ var slider = minicolors.find('.minicolors-slider');
563
+ var opacitySlider = minicolors.find('.minicolors-opacity-slider');
564
+
565
+ // Picker objects
566
+ var gridPicker = grid.find('[class$=-picker]');
567
+ var sliderPicker = slider.find('[class$=-picker]');
568
+ var opacityPicker = opacitySlider.find('[class$=-picker]');
569
+
570
+ // Determine hex/HSB values
571
+ if(isRgb(input.val())) {
572
+ // If input value is a rgb(a) string, convert it to hex color and update opacity
573
+ hex = rgbString2hex(input.val());
574
+ alpha = keepWithin(parseFloat(getAlpha(input.val())).toFixed(2), 0, 1);
575
+ if(alpha) {
576
+ input.attr('data-opacity', alpha);
577
+ }
578
+ } else {
579
+ hex = convertCase(parseHex(input.val(), true), settings.letterCase);
580
+ }
581
+
582
+ if(!hex){
583
+ hex = convertCase(parseInput(settings.defaultValue, true), settings.letterCase);
584
+ }
585
+ hsb = hex2hsb(hex);
586
+
587
+ // Get array of lowercase keywords
588
+ keywords = !settings.keywords ? [] : $.map(settings.keywords.split(','), function(a) {
589
+ return $.trim(a.toLowerCase());
590
+ });
591
+
592
+ // Set color string
593
+ if(input.val() !== '' && $.inArray(input.val().toLowerCase(), keywords) > -1) {
594
+ value = convertCase(input.val());
595
+ } else {
596
+ value = isRgb(input.val()) ? parseRgb(input.val()) : hex;
597
+ }
598
+
599
+ // Update input value
600
+ if(!preserveInputValue) input.val(value);
601
+
602
+ // Determine opacity value
603
+ if(settings.opacity) {
604
+ // Get from data-opacity attribute and keep within 0-1 range
605
+ opacity = input.attr('data-opacity') === '' ? 1 : keepWithin(parseFloat(input.attr('data-opacity')).toFixed(2), 0, 1);
606
+ if(isNaN(opacity)) opacity = 1;
607
+ input.attr('data-opacity', opacity);
608
+ swatch.find('span').css('opacity', opacity);
609
+
610
+ // Set opacity picker position
611
+ y = keepWithin(opacitySlider.height() - (opacitySlider.height() * opacity), 0, opacitySlider.height());
612
+ opacityPicker.css('top', y + 'px');
613
+ }
614
+
615
+ // Set opacity to zero if input value is transparent
616
+ if(input.val().toLowerCase() === 'transparent') {
617
+ swatch.find('span').css('opacity', 0);
618
+ }
619
+
620
+ // Update swatch
621
+ swatch.find('span').css('backgroundColor', hex);
622
+
623
+ // Determine picker locations
624
+ switch(settings.control) {
625
+ case 'wheel':
626
+ // Set grid position
627
+ r = keepWithin(Math.ceil(hsb.s * 0.75), 0, grid.height() / 2);
628
+ phi = hsb.h * Math.PI / 180;
629
+ x = keepWithin(75 - Math.cos(phi) * r, 0, grid.width());
630
+ y = keepWithin(75 - Math.sin(phi) * r, 0, grid.height());
631
+ gridPicker.css({
632
+ top: y + 'px',
633
+ left: x + 'px'
634
+ });
635
+
636
+ // Set slider position
637
+ y = 150 - (hsb.b / (100 / grid.height()));
638
+ if(hex === '') y = 0;
639
+ sliderPicker.css('top', y + 'px');
640
+
641
+ // Update panel color
642
+ slider.css('backgroundColor', hsb2hex({ h: hsb.h, s: hsb.s, b: 100 }));
643
+ break;
644
+
645
+ case 'saturation':
646
+ // Set grid position
647
+ x = keepWithin((5 * hsb.h) / 12, 0, 150);
648
+ y = keepWithin(grid.height() - Math.ceil(hsb.b / (100 / grid.height())), 0, grid.height());
649
+ gridPicker.css({
650
+ top: y + 'px',
651
+ left: x + 'px'
652
+ });
653
+
654
+ // Set slider position
655
+ y = keepWithin(slider.height() - (hsb.s * (slider.height() / 100)), 0, slider.height());
656
+ sliderPicker.css('top', y + 'px');
657
+
658
+ // Update UI
659
+ slider.css('backgroundColor', hsb2hex({ h: hsb.h, s: 100, b: hsb.b }));
660
+ minicolors.find('.minicolors-grid-inner').css('opacity', hsb.s / 100);
661
+ break;
662
+
663
+ case 'brightness':
664
+ // Set grid position
665
+ x = keepWithin((5 * hsb.h) / 12, 0, 150);
666
+ y = keepWithin(grid.height() - Math.ceil(hsb.s / (100 / grid.height())), 0, grid.height());
667
+ gridPicker.css({
668
+ top: y + 'px',
669
+ left: x + 'px'
670
+ });
671
+
672
+ // Set slider position
673
+ y = keepWithin(slider.height() - (hsb.b * (slider.height() / 100)), 0, slider.height());
674
+ sliderPicker.css('top', y + 'px');
675
+
676
+ // Update UI
677
+ slider.css('backgroundColor', hsb2hex({ h: hsb.h, s: hsb.s, b: 100 }));
678
+ minicolors.find('.minicolors-grid-inner').css('opacity', 1 - (hsb.b / 100));
679
+ break;
680
+
681
+ default:
682
+ // Set grid position
683
+ x = keepWithin(Math.ceil(hsb.s / (100 / grid.width())), 0, grid.width());
684
+ y = keepWithin(grid.height() - Math.ceil(hsb.b / (100 / grid.height())), 0, grid.height());
685
+ gridPicker.css({
686
+ top: y + 'px',
687
+ left: x + 'px'
688
+ });
689
+
690
+ // Set slider position
691
+ y = keepWithin(slider.height() - (hsb.h / (360 / slider.height())), 0, slider.height());
692
+ sliderPicker.css('top', y + 'px');
693
+
694
+ // Update panel color
695
+ grid.css('backgroundColor', hsb2hex({ h: hsb.h, s: 100, b: 100 }));
696
+ break;
697
+ }
698
+
699
+ // Fire change event, but only if minicolors is fully initialized
700
+ if(input.data('minicolors-initialized')) {
701
+ doChange(input, value, opacity);
702
+ }
703
+ }
704
+
705
+ // Runs the change and changeDelay callbacks
706
+ function doChange(input, value, opacity) {
707
+ var settings = input.data('minicolors-settings');
708
+ var lastChange = input.data('minicolors-lastChange');
709
+ var obj, sel, i;
710
+
711
+ // Only run if it actually changed
712
+ if(!lastChange || lastChange.value !== value || lastChange.opacity !== opacity) {
713
+
714
+ // Remember last-changed value
715
+ input.data('minicolors-lastChange', {
716
+ value: value,
717
+ opacity: opacity
718
+ });
719
+
720
+ // Check and select applicable swatch
721
+ if(settings.swatches && settings.swatches.length !== 0) {
722
+ if(!isRgb(value)) {
723
+ obj = hex2rgb(value);
724
+ }
725
+ else {
726
+ obj = parseRgb(value, true);
727
+ }
728
+ sel = -1;
729
+ for(i = 0; i < settings.swatches.length; ++i) {
730
+ if(obj.r === settings.swatches[i].r && obj.g === settings.swatches[i].g && obj.b === settings.swatches[i].b && obj.a === settings.swatches[i].a) {
731
+ sel = i;
732
+ break;
733
+ }
734
+ }
735
+
736
+ input.parent().find('.minicolors-swatches .minicolors-swatch').removeClass('selected');
737
+ if(sel !== -1) {
738
+ input.parent().find('.minicolors-swatches .minicolors-swatch').eq(i).addClass('selected');
739
+ }
740
+ }
741
+
742
+ // Fire change event
743
+ if(settings.change) {
744
+ if(settings.changeDelay) {
745
+ // Call after a delay
746
+ clearTimeout(input.data('minicolors-changeTimeout'));
747
+ input.data('minicolors-changeTimeout', setTimeout(function() {
748
+ settings.change.call(input.get(0), value, opacity);
749
+ }, settings.changeDelay));
750
+ } else {
751
+ // Call immediately
752
+ settings.change.call(input.get(0), value, opacity);
753
+ }
754
+ }
755
+ input.trigger('change').trigger('input');
756
+ }
757
+ }
758
+
759
+ // Generates an RGB(A) object based on the input's value
760
+ function rgbObject(input) {
761
+ var rgb,
762
+ opacity = $(input).attr('data-opacity');
763
+ if( isRgb($(input).val()) ) {
764
+ rgb = parseRgb($(input).val(), true);
765
+ } else {
766
+ var hex = parseHex($(input).val(), true);
767
+ rgb = hex2rgb(hex);
768
+ }
769
+ if( !rgb ) return null;
770
+ if( opacity !== undefined ) $.extend(rgb, { a: parseFloat(opacity) });
771
+ return rgb;
772
+ }
773
+
774
+ // Generates an RGB(A) string based on the input's value
775
+ function rgbString(input, alpha) {
776
+ var rgb,
777
+ opacity = $(input).attr('data-opacity');
778
+ if( isRgb($(input).val()) ) {
779
+ rgb = parseRgb($(input).val(), true);
780
+ } else {
781
+ var hex = parseHex($(input).val(), true);
782
+ rgb = hex2rgb(hex);
783
+ }
784
+ if( !rgb ) return null;
785
+ if( opacity === undefined ) opacity = 1;
786
+ if( alpha ) {
787
+ return 'rgba(' + rgb.r + ', ' + rgb.g + ', ' + rgb.b + ', ' + parseFloat(opacity) + ')';
788
+ } else {
789
+ return 'rgb(' + rgb.r + ', ' + rgb.g + ', ' + rgb.b + ')';
790
+ }
791
+ }
792
+
793
+ // Converts to the letter case specified in settings
794
+ function convertCase(string, letterCase) {
795
+ return letterCase === 'uppercase' ? string.toUpperCase() : string.toLowerCase();
796
+ }
797
+
798
+ // Parses a string and returns a valid hex string when possible
799
+ function parseHex(string, expand) {
800
+ string = string.replace(/^#/g, '');
801
+ if(!string.match(/^[A-F0-9]{3,6}/ig)) return '';
802
+ if(string.length !== 3 && string.length !== 6) return '';
803
+ if(string.length === 3 && expand) {
804
+ string = string[0] + string[0] + string[1] + string[1] + string[2] + string[2];
805
+ }
806
+ return '#' + string;
807
+ }
808
+
809
+ // Parses a string and returns a valid RGB(A) string when possible
810
+ function parseRgb(string, obj) {
811
+ var values = string.replace(/[^\d,.]/g, '');
812
+ var rgba = values.split(',');
813
+
814
+ rgba[0] = keepWithin(parseInt(rgba[0], 10), 0, 255);
815
+ rgba[1] = keepWithin(parseInt(rgba[1], 10), 0, 255);
816
+ rgba[2] = keepWithin(parseInt(rgba[2], 10), 0, 255);
817
+ if(rgba[3]) {
818
+ rgba[3] = keepWithin(parseFloat(rgba[3], 10), 0, 1);
819
+ }
820
+
821
+ // Return RGBA object
822
+ if( obj ) {
823
+ if (rgba[3]) {
824
+ return {
825
+ r: rgba[0],
826
+ g: rgba[1],
827
+ b: rgba[2],
828
+ a: rgba[3]
829
+ };
830
+ } else {
831
+ return {
832
+ r: rgba[0],
833
+ g: rgba[1],
834
+ b: rgba[2]
835
+ };
836
+ }
837
+ }
838
+
839
+ // Return RGBA string
840
+ if(typeof(rgba[3]) !== 'undefined' && rgba[3] <= 1) {
841
+ return 'rgba(' + rgba[0] + ', ' + rgba[1] + ', ' + rgba[2] + ', ' + rgba[3] + ')';
842
+ } else {
843
+ return 'rgb(' + rgba[0] + ', ' + rgba[1] + ', ' + rgba[2] + ')';
844
+ }
845
+
846
+ }
847
+
848
+ // Parses a string and returns a valid color string when possible
849
+ function parseInput(string, expand) {
850
+ if(isRgb(string)) {
851
+ // Returns a valid rgb(a) string
852
+ return parseRgb(string);
853
+ } else {
854
+ return parseHex(string, expand);
855
+ }
856
+ }
857
+
858
+ // Keeps value within min and max
859
+ function keepWithin(value, min, max) {
860
+ if(value < min) value = min;
861
+ if(value > max) value = max;
862
+ return value;
863
+ }
864
+
865
+ // Checks if a string is a valid RGB(A) string
866
+ function isRgb(string) {
867
+ var rgb = string.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i);
868
+ return (rgb && rgb.length === 4) ? true : false;
869
+ }
870
+
871
+ // Function to get alpha from a RGB(A) string
872
+ function getAlpha(rgba) {
873
+ rgba = rgba.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+(\.\d{1,2})?|\.\d{1,2})[\s+]?/i);
874
+ return (rgba && rgba.length === 6) ? rgba[4] : '1';
875
+ }
876
+
877
+ // Converts an HSB object to an RGB object
878
+ function hsb2rgb(hsb) {
879
+ var rgb = {};
880
+ var h = Math.round(hsb.h);
881
+ var s = Math.round(hsb.s * 255 / 100);
882
+ var v = Math.round(hsb.b * 255 / 100);
883
+ if(s === 0) {
884
+ rgb.r = rgb.g = rgb.b = v;
885
+ } else {
886
+ var t1 = v;
887
+ var t2 = (255 - s) * v / 255;
888
+ var t3 = (t1 - t2) * (h % 60) / 60;
889
+ if(h === 360) h = 0;
890
+ if(h < 60) { rgb.r = t1; rgb.b = t2; rgb.g = t2 + t3; }
891
+ else if(h < 120) {rgb.g = t1; rgb.b = t2; rgb.r = t1 - t3; }
892
+ else if(h < 180) {rgb.g = t1; rgb.r = t2; rgb.b = t2 + t3; }
893
+ else if(h < 240) {rgb.b = t1; rgb.r = t2; rgb.g = t1 - t3; }
894
+ else if(h < 300) {rgb.b = t1; rgb.g = t2; rgb.r = t2 + t3; }
895
+ else if(h < 360) {rgb.r = t1; rgb.g = t2; rgb.b = t1 - t3; }
896
+ else { rgb.r = 0; rgb.g = 0; rgb.b = 0; }
897
+ }
898
+ return {
899
+ r: Math.round(rgb.r),
900
+ g: Math.round(rgb.g),
901
+ b: Math.round(rgb.b)
902
+ };
903
+ }
904
+
905
+ // Converts an RGB string to a hex string
906
+ function rgbString2hex(rgb){
907
+ rgb = rgb.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i);
908
+ return (rgb && rgb.length === 4) ? '#' +
909
+ ('0' + parseInt(rgb[1],10).toString(16)).slice(-2) +
910
+ ('0' + parseInt(rgb[2],10).toString(16)).slice(-2) +
911
+ ('0' + parseInt(rgb[3],10).toString(16)).slice(-2) : '';
912
+ }
913
+
914
+ // Converts an RGB object to a hex string
915
+ function rgb2hex(rgb) {
916
+ var hex = [
917
+ rgb.r.toString(16),
918
+ rgb.g.toString(16),
919
+ rgb.b.toString(16)
920
+ ];
921
+ $.each(hex, function(nr, val) {
922
+ if(val.length === 1) hex[nr] = '0' + val;
923
+ });
924
+ return '#' + hex.join('');
925
+ }
926
+
927
+ // Converts an HSB object to a hex string
928
+ function hsb2hex(hsb) {
929
+ return rgb2hex(hsb2rgb(hsb));
930
+ }
931
+
932
+ // Converts a hex string to an HSB object
933
+ function hex2hsb(hex) {
934
+ var hsb = rgb2hsb(hex2rgb(hex));
935
+ if(hsb.s === 0) hsb.h = 360;
936
+ return hsb;
937
+ }
938
+
939
+ // Converts an RGB object to an HSB object
940
+ function rgb2hsb(rgb) {
941
+ var hsb = { h: 0, s: 0, b: 0 };
942
+ var min = Math.min(rgb.r, rgb.g, rgb.b);
943
+ var max = Math.max(rgb.r, rgb.g, rgb.b);
944
+ var delta = max - min;
945
+ hsb.b = max;
946
+ hsb.s = max !== 0 ? 255 * delta / max : 0;
947
+ if(hsb.s !== 0) {
948
+ if(rgb.r === max) {
949
+ hsb.h = (rgb.g - rgb.b) / delta;
950
+ } else if(rgb.g === max) {
951
+ hsb.h = 2 + (rgb.b - rgb.r) / delta;
952
+ } else {
953
+ hsb.h = 4 + (rgb.r - rgb.g) / delta;
954
+ }
955
+ } else {
956
+ hsb.h = -1;
957
+ }
958
+ hsb.h *= 60;
959
+ if(hsb.h < 0) {
960
+ hsb.h += 360;
961
+ }
962
+ hsb.s *= 100/255;
963
+ hsb.b *= 100/255;
964
+ return hsb;
965
+ }
966
+
967
+ // Converts a hex string to an RGB object
968
+ function hex2rgb(hex) {
969
+ hex = parseInt(((hex.indexOf('#') > -1) ? hex.substring(1) : hex), 16);
970
+ return {
971
+ r: hex >> 16,
972
+ g: (hex & 0x00FF00) >> 8,
973
+ b: (hex & 0x0000FF)
974
+ };
975
+ }
976
+
977
+ // Handle events
978
+ $([document])
979
+ // Hide on clicks outside of the control
980
+ .on('mousedown.minicolors touchstart.minicolors', function(event) {
981
+ if(!$(event.target).parents().add(event.target).hasClass('minicolors')) {
982
+ hide();
983
+ }
984
+ })
985
+ // Start moving
986
+ .on('mousedown.minicolors touchstart.minicolors', '.minicolors-grid, .minicolors-slider, .minicolors-opacity-slider', function(event) {
987
+ var target = $(this);
988
+ event.preventDefault();
989
+ $(event.delegateTarget).data('minicolors-target', target);
990
+ move(target, event, true);
991
+ })
992
+ // Move pickers
993
+ .on('mousemove.minicolors touchmove.minicolors', function(event) {
994
+ var target = $(event.delegateTarget).data('minicolors-target');
995
+ if(target) move(target, event);
996
+ })
997
+ // Stop moving
998
+ .on('mouseup.minicolors touchend.minicolors', function() {
999
+ $(this).removeData('minicolors-target');
1000
+ })
1001
+ // Selected a swatch
1002
+ .on('click.minicolors', '.minicolors-swatches li', function(event) {
1003
+ event.preventDefault();
1004
+ var target = $(this), input = target.parents('.minicolors').find('.minicolors-input'), color = target.data('swatch-color');
1005
+ updateInput(input, color, getAlpha(color));
1006
+ updateFromInput(input);
1007
+ })
1008
+ // Show panel when swatch is clicked
1009
+ .on('mousedown.minicolors touchstart.minicolors', '.minicolors-input-swatch', function(event) {
1010
+ var input = $(this).parent().find('.minicolors-input');
1011
+ event.preventDefault();
1012
+ show(input);
1013
+ })
1014
+ // Show on focus
1015
+ .on('focus.minicolors', '.minicolors-input', function() {
1016
+ var input = $(this);
1017
+ if(!input.data('minicolors-initialized')) return;
1018
+ show(input);
1019
+ })
1020
+ // Update value on blur
1021
+ .on('blur.minicolors', '.minicolors-input', function() {
1022
+ var input = $(this);
1023
+ var settings = input.data('minicolors-settings');
1024
+ var keywords;
1025
+ var hex;
1026
+ var rgba;
1027
+ var swatchOpacity;
1028
+ var value;
1029
+
1030
+ if(!input.data('minicolors-initialized')) return;
1031
+
1032
+ // Get array of lowercase keywords
1033
+ keywords = !settings.keywords ? [] : $.map(settings.keywords.split(','), function(a) {
1034
+ return $.trim(a.toLowerCase());
1035
+ });
1036
+
1037
+ // Set color string
1038
+ if(input.val() !== '' && $.inArray(input.val().toLowerCase(), keywords) > -1) {
1039
+ value = input.val();
1040
+ } else {
1041
+ // Get RGBA values for easy conversion
1042
+ if(isRgb(input.val())) {
1043
+ rgba = parseRgb(input.val(), true);
1044
+ } else {
1045
+ hex = parseHex(input.val(), true);
1046
+ rgba = hex ? hex2rgb(hex) : null;
1047
+ }
1048
+
1049
+ // Convert to format
1050
+ if(rgba === null) {
1051
+ value = settings.defaultValue;
1052
+ } else if(settings.format === 'rgb') {
1053
+ value = settings.opacity ?
1054
+ parseRgb('rgba(' + rgba.r + ',' + rgba.g + ',' + rgba.b + ',' + input.attr('data-opacity') + ')') :
1055
+ parseRgb('rgb(' + rgba.r + ',' + rgba.g + ',' + rgba.b + ')');
1056
+ } else {
1057
+ value = rgb2hex(rgba);
1058
+ }
1059
+ }
1060
+
1061
+ // Update swatch opacity
1062
+ swatchOpacity = settings.opacity ? input.attr('data-opacity') : 1;
1063
+ if(value.toLowerCase() === 'transparent') swatchOpacity = 0;
1064
+ input
1065
+ .closest('.minicolors')
1066
+ .find('.minicolors-input-swatch > span')
1067
+ .css('opacity', swatchOpacity);
1068
+
1069
+ // Set input value
1070
+ input.val(value);
1071
+
1072
+ // Is it blank?
1073
+ if(input.val() === '') input.val(parseInput(settings.defaultValue, true));
1074
+
1075
+ // Adjust case
1076
+ input.val(convertCase(input.val(), settings.letterCase));
1077
+
1078
+ })
1079
+ // Handle keypresses
1080
+ .on('keydown.minicolors', '.minicolors-input', function(event) {
1081
+ var input = $(this);
1082
+ if(!input.data('minicolors-initialized')) return;
1083
+ switch(event.keyCode) {
1084
+ case 9: // tab
1085
+ hide();
1086
+ break;
1087
+ case 13: // enter
1088
+ case 27: // esc
1089
+ hide();
1090
+ input.blur();
1091
+ break;
1092
+ }
1093
+ })
1094
+ // Update on keyup
1095
+ .on('keyup.minicolors', '.minicolors-input', function() {
1096
+ var input = $(this);
1097
+ if(!input.data('minicolors-initialized')) return;
1098
+ updateFromInput(input, true);
1099
+ })
1100
+ // Update on paste
1101
+ .on('paste.minicolors', '.minicolors-input', function() {
1102
+ var input = $(this);
1103
+ if(!input.data('minicolors-initialized')) return;
1104
+ setTimeout(function() {
1105
+ updateFromInput(input, true);
1106
+ }, 1);
1107
+ });
1108
+ }));
controls/controls.php ADDED
@@ -0,0 +1,571 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class smartlogix {
3
+ private $type;
4
+ private $plainHTML;
5
+ private $useParagraph;
6
+ private $helpText;
7
+ private $id;
8
+ private $name;
9
+ private $value;
10
+ private $label;
11
+ private $className;
12
+ private $style;
13
+ private $required;
14
+ private $options;
15
+
16
+ private $optionName;
17
+ private $optionIdentifier;
18
+ private $values;
19
+
20
+ private $pages;
21
+ private $posts;
22
+ private $categories;
23
+
24
+ public $HTML;
25
+ public $JS;
26
+
27
+ function __construct($args = null) {
28
+ $this->HTML = '';
29
+ $this->JS = '';
30
+
31
+ $this->type = 'text';
32
+ $this->plainHTML = false;
33
+ $this->useParagraph = true;
34
+ $this->helpText = '';
35
+ $this->id = '';
36
+ $this->name = '';
37
+ $this->value = '';
38
+ $this->label = '';
39
+ $this->className = 'input widefat';
40
+ $this->style = '';
41
+ $this->required = '';
42
+ $this->options = null;
43
+
44
+ $this->optionName = '';
45
+ $this->optionIdentifier = '';
46
+ $this->values = '';
47
+
48
+ if(isset($args) && is_array($args)) {
49
+ if(isset($args['type']) && ($args['type'] != '')) {
50
+ $this->type = $args['type'];
51
+ }
52
+ if(isset($args['plainHTML']) && ($args['plainHTML'] != '')) {
53
+ $this->plainHTML = $args['plainHTML'];
54
+ }
55
+ if(isset($args['useParagraph']) && ($args['useParagraph'] != '')) {
56
+ $this->useParagraph = $args['useParagraph'];
57
+ }
58
+ if(isset($args['helpText']) && ($args['helpText'] != '')) {
59
+ $this->helpText = $args['helpText'];
60
+ }
61
+ if(isset($args['id']) && ($args['id'] != '')) {
62
+ $this->id = $args['id'];
63
+ }
64
+ if(isset($args['name']) && ($args['name'] != '')) {
65
+ $this->name = $args['name'];
66
+ }
67
+ if(isset($args['value']) && ($args['value'] != '')) {
68
+ $this->value = $args['value'];
69
+ }
70
+ if(isset($args['label']) && ($args['label'] != '')) {
71
+ $this->label = $args['label'];
72
+ }
73
+ if(isset($args['className']) && ($args['className'] != '')) {
74
+ $this->className = $args['className'];
75
+ }
76
+ if(isset($args['style']) && ($args['style'] != '')) {
77
+ $this->style = $args['style'];
78
+ }
79
+ if(isset($args['required']) && ($args['required'] != '')) {
80
+ $this->required = $args['required'];
81
+ }
82
+ if(isset($args['options']) && is_array($args['options'])) {
83
+ $this->options = $args['options'];
84
+ }
85
+
86
+ if(isset($args['optionIdentifier']) && ($args['optionIdentifier'] != '')) {
87
+ $this->optionIdentifier = $args['optionIdentifier'];
88
+ }
89
+ if(isset($args['optionName']) && ($args['optionName'] != '')) {
90
+ $this->optionName = $args['optionName'];
91
+ }
92
+ if(isset($args['values']) && ($args['values'] != '')) {
93
+ $this->values = $args['values'];
94
+ }
95
+
96
+ if(isset($args['optionIdentifier']) && ($args['optionIdentifier'] != '') && isset($args['optionName']) && ($args['optionName'] != '')) {
97
+ $this->id = str_replace(array('[', ']'), array('_', ''), $args['optionIdentifier']).'_'.$args['optionName'];
98
+ $this->name = $args['optionIdentifier'].'['.$args['optionName'].']';
99
+ } elseif(isset($this->optionIdentifier) && ($this->optionIdentifier != '') && isset($args['optionName']) && ($args['optionName'] != '')) {
100
+ $this->id = str_replace(array('[', ']'), array('_', ''), $this->optionIdentifier).'_'.$args['optionName'];
101
+ $this->name = $this->optionIdentifier.'['.$args['optionName'].']';
102
+ } elseif(isset($args['optionIdentifier']) && ($args['optionIdentifier'] != '') && isset($this->optionName) && ($this->optionName != '')) {
103
+ $this->id = str_replace(array('[', ']'), array('_', ''), $args['optionIdentifier']).'_'.$this->optionName;
104
+ $this->name = $args['optionIdentifier'].'['.$this->optionName.']';
105
+ } elseif(isset($this->optionIdentifier) && ($this->optionIdentifier != '') && isset($this->optionName) && ($this->optionName != '')) {
106
+ $this->id = str_replace(array('[', ']'), array('_', ''), $this->optionIdentifier).'_'.$this->optionName;
107
+ $this->name = $this->optionIdentifier.'['.$this->optionName.']';
108
+ }
109
+
110
+ if(isset($args['values']) && is_array($args['values'])) {
111
+ if(isset($args['optionName']) && ($args['optionName'] != '')) {
112
+ $this->value = $args['values'][$args['optionName']];
113
+ } elseif(isset($this->optionName) && ($this->optionName != '')) {
114
+ $this->value = $args['values'][$this->optionName];
115
+ }
116
+ } elseif(isset($this->values) && is_array($this->values)) {
117
+ if(isset($args['optionName']) && ($args['optionName'] != '')) {
118
+ $this->value = $this->values[$args['optionName']];
119
+ } elseif(isset($this->optionName) && ($this->optionName != '')) {
120
+ $this->value = $this->values[$this->optionName];
121
+ }
122
+ }
123
+ }
124
+ }
125
+
126
+ private function sync_args($args) {
127
+ $syncedArgs = array();
128
+ if(is_array($args)) {
129
+ $syncedArgs = $args;
130
+ }
131
+
132
+ if(isset($args['type']) && ($args['type'] != '')) {
133
+ $syncedArgs['type'] = $args['type'];
134
+ } else {
135
+ $syncedArgs['type'] = $this->type;
136
+ }
137
+
138
+ if(isset($args['plainHTML']) && ($args['plainHTML'] != '')) {
139
+ $syncedArgs['plainHTML'] = $args['plainHTML'];
140
+ } else {
141
+ $syncedArgs['plainHTML'] = $this->plainHTML;
142
+ }
143
+
144
+ if(isset($args['useParagraph']) && ($args['useParagraph'] != '')) {
145
+ $syncedArgs['useParagraph'] = $args['useParagraph'];
146
+ } else {
147
+ $syncedArgs['useParagraph'] = $this->useParagraph;
148
+ }
149
+
150
+ if(isset($args['helpText']) && ($args['helpText'] != '')) {
151
+ $syncedArgs['helpText'] = $args['helpText'];
152
+ } else {
153
+ $syncedArgs['helpText'] = $this->helpText;
154
+ }
155
+
156
+ if(isset($args['id']) && ($args['id'] != '')) {
157
+ $syncedArgs['id'] = $args['id'];
158
+ } else {
159
+ $syncedArgs['id'] = $this->id;
160
+ }
161
+
162
+ if(isset($args['name']) && ($args['name'] != '')) {
163
+ $syncedArgs['name'] = $args['name'];
164
+ } else {
165
+ $syncedArgs['name'] = $this->name;
166
+ }
167
+
168
+ if(isset($args['value']) && ($args['value'] != '')) {
169
+ $syncedArgs['value'] = $args['value'];
170
+ } else {
171
+ $syncedArgs['value'] = $this->value;
172
+ }
173
+
174
+ if(isset($args['label']) && ($args['label'] != '')) {
175
+ $syncedArgs['label'] = $args['label'];
176
+ } else {
177
+ $syncedArgs['label'] = $this->label;
178
+ }
179
+
180
+ if(isset($args['className']) && ($args['className'] != '')) {
181
+ $syncedArgs['className'] = $args['className'];
182
+ } else {
183
+ $syncedArgs['className'] = $this->className;
184
+ }
185
+
186
+ if(isset($args['style']) && ($args['style'] != '')) {
187
+ $syncedArgs['style'] = $args['style'];
188
+ } else {
189
+ $syncedArgs['style'] = $this->style;
190
+ }
191
+
192
+ if(isset($args['required']) && ($args['required'] != '')) {
193
+ $syncedArgs['required'] = $args['required'];
194
+ } else {
195
+ $syncedArgs['required'] = $this->required;
196
+ }
197
+
198
+ if(isset($args['options']) && is_array($args['options'])) {
199
+ $syncedArgs['options'] = $args['options'];
200
+ } else {
201
+ $syncedArgs['options'] = $this->options;
202
+ }
203
+
204
+
205
+ if(isset($args['optionIdentifier']) && ($args['optionIdentifier'] != '') && isset($args['optionName']) && ($args['optionName'] != '')) {
206
+ $syncedArgs['id'] = str_replace(array('[', ']'), array('_', ''), $args['optionIdentifier']).'_'.$args['optionName'];
207
+ $syncedArgs['name'] = $args['optionIdentifier'].'['.$args['optionName'].']';
208
+ } elseif(isset($this->optionIdentifier) && ($this->optionIdentifier != '') && isset($args['optionName']) && ($args['optionName'] != '')) {
209
+ $syncedArgs['id'] = str_replace(array('[', ']'), array('_', ''), $this->optionIdentifier).'_'.$args['optionName'];
210
+ $syncedArgs['name'] = $this->optionIdentifier.'['.$args['optionName'].']';
211
+ } elseif(isset($args['optionIdentifier']) && ($args['optionIdentifier'] != '') && isset($this->optionName) && ($this->optionName != '')) {
212
+ $syncedArgs['id'] = str_replace(array('[', ']'), array('_', ''), $args['optionIdentifier']).'_'.$this->optionName;
213
+ $syncedArgs['name'] = $args['optionIdentifier'].'['.$this->optionName.']';
214
+ } elseif(isset($this->optionIdentifier) && ($this->optionIdentifier != '') && isset($this->optionName) && ($this->optionName != '')) {
215
+ $syncedArgs['id'] = str_replace(array('[', ']'), array('_', ''), $this->optionIdentifier).'_'.$this->optionName;
216
+ $syncedArgs['name'] = $this->optionIdentifier.'['.$this->optionName.']';
217
+ }
218
+
219
+ if(isset($args['values']) && is_array($args['values'])) {
220
+ if(isset($args['optionName']) && ($args['optionName'] != '')) {
221
+ $syncedArgs['value'] = $args['values'][$args['optionName']];
222
+ } elseif(isset($this->optionName) && ($this->optionName != '')) {
223
+ $syncedArgs['value'] = $args['values'][$this->optionName];
224
+ }
225
+ } elseif(isset($this->values) && is_array($this->values)) {
226
+ if(isset($args['optionName']) && ($args['optionName'] != '')) {
227
+ $syncedArgs['value'] = $this->values[$args['optionName']];
228
+ } elseif(isset($this->optionName) && ($this->optionName != '')) {
229
+ $syncedArgs['value'] = $this->values[$this->optionName];
230
+ }
231
+ }
232
+
233
+ return $syncedArgs;
234
+ }
235
+
236
+ public function add_control($args = null) {
237
+ $control = $this->get_control($args, true);
238
+ $this->HTML .= $control['HTML'];
239
+ $this->JS .= $control['JS'];
240
+ }
241
+
242
+ public function get_control($args = null, $ignorePlainHTML = false) {
243
+ $HTML = '';
244
+ $JS = '';
245
+ $args = $this->sync_args($args);
246
+
247
+ switch($args['type']) {
248
+ case 'hidden':
249
+ $HTML .= '<input type="hidden" '.(($args['id'] != '')?'id="'.$args['id'].'"':'').' '.(($args['name'] != '')?'name="'.$args['name'].'"':'').' '.(($args['value'] != '')?'value="'.$args['value'].'"':'').' '.(($args['className'] != '')?'class="'.$args['className'].'"':'').' '.(($args['style'] != '')?'style="'.$args['style'].'"':'').' />';
250
+ break;
251
+ case 'text':
252
+ if($args['useParagraph']) { $HTML .= '<p>'; }
253
+ if($args['label'] != '') { $HTML .= '<label '.(($args['name'] != '')?'for="'.$args['name'].'"':'').'>'.$args['label'].'</label><br />'; }
254
+ $HTML .= '<input type="text" '.(($args['id'] != '')?'id="'.$args['id'].'"':'').' '.(($args['name'] != '')?'name="'.$args['name'].'"':'').' '.(($args['value'] != '')?'value="'.$args['value'].'"':'').' '.(($args['className'] != '')?'class="'.$args['className'].'"':'').' '.(($args['style'] != '')?'style="'.$args['style'].'"':'').' '.(($args['required'])?'required':'').' />';
255
+ if($args['helpText'] != '') { $HTML .= '<small>'.$args['helpText'].'</small>'; }
256
+ if($args['useParagraph']) { $HTML .= '</p>'; }
257
+ break;
258
+ case 'password':
259
+ if($args['useParagraph']) { $HTML .= '<p>'; }
260
+ if($args['label'] != '') { $HTML .= '<label '.(($args['name'] != '')?'for="'.$args['name'].'"':'').'>'.$args['label'].'</label><br />'; }
261
+ $HTML .= '<input type="password" '.(($args['id'] != '')?'id="'.$args['id'].'"':'').' '.(($args['name'] != '')?'name="'.$args['name'].'"':'').' '.(($args['value'] != '')?'value="'.$args['value'].'"':'').' '.(($args['className'] != '')?'class="'.$args['className'].'"':'').' '.(($args['style'] != '')?'style="'.$args['style'].'"':'').' '.(($args['required'])?'required':'').' />';
262
+ if($args['helpText'] != '') { $HTML .= '<small>'.$args['helpText'].'</small>'; }
263
+ if($args['useParagraph']) { $HTML .= '</p>'; }
264
+ break;
265
+ case 'textarea':
266
+ if($args['useParagraph']) { $HTML .= '<p>'; }
267
+ if($args['label'] != '') { $HTML .= '<label '.(($args['name'] != '')?'for="'.$args['name'].'"':'').'>'.$args['label'].'</label><br />'; }
268
+ $HTML .= '<textarea '.(($args['id'] != '')?'id="'.$args['id'].'"':'').' '.(($args['name'] != '')?'name="'.$args['name'].'"':'').' '.(($args['className'] != '')?'class="'.$args['className'].'"':'').' '.(($args['style'] != '')?'style="'.$args['style'].'"':'').' '.(($args['required'])?'required':'').'>'.stripslashes((($args['value'] != '')?$args['value']:'')).'</textarea>';
269
+ if($args['helpText'] != '') { $HTML .= '<small>'.$args['helpText'].'</small>'; }
270
+ if($args['useParagraph']) { $HTML .= '</p>'; }
271
+ break;
272
+ case 'checkbox':
273
+ if($args['useParagraph']) { $HTML .= '<p>'; }
274
+ if(isset($args['value']) && (filter_var($args['value'], FILTER_VALIDATE_BOOLEAN))) {
275
+ $HTML .= '<input type="checkbox" '.(($args['id'] != '')?'id="'.$args['id'].'"':'').' '.(($args['name'] != '')?'name="'.$args['name'].'"':'').' value="1" '.checked(true, true, false).' '.(($args['className'] != '')?'class="'.$args['className'].'"':'').' '.(($args['style'] != '')?'style="'.$args['style'].'"':'').' '.(($args['required'])?'required':'').' />';
276
+ } else {
277
+ $HTML .= '<input type="checkbox" '.(($args['id'] != '')?'id="'.$args['id'].'"':'').' '.(($args['name'] != '')?'name="'.$args['name'].'"':'').' value="1" '.(($args['className'] != '')?'class="'.$args['className'].'"':'').' '.(($args['style'] != '')?'style="'.$args['style'].'"':'').' '.(($args['required'])?'required':'').' />';
278
+ }
279
+ if($args['label'] != '') { $HTML .= '&nbsp;<label '.(($args['name'] != '')?'for="'.$args['name'].'"':'').'>'.$args['label'].'</label>'; }
280
+ if($args['helpText'] != '') { $HTML .= '<small>'.$args['helpText'].'</small>'; }
281
+ if($args['useParagraph']) { $HTML .= '</p>'; }
282
+ break;
283
+ case 'radio':
284
+ if($args['useParagraph']) { $HTML .= '<p>'; }
285
+ if(isset($args['value']) && (filter_var($args['value'], FILTER_VALIDATE_BOOLEAN))) {
286
+ $HTML .= '<input type="radio" '.(($args['id'] != '')?'id="'.$args['id'].'"':'').' '.(($args['name'] != '')?'name="'.$args['name'].'"':'').' value="1" '.checked(true, true, false).' '.(($args['className'] != '')?'class="'.$args['className'].'"':'').' '.(($args['style'] != '')?'style="'.$args['style'].'"':'').' '.(($args['required'])?'required':'').' />';
287
+ } else {
288
+ $HTML .= '<input type="radio" '.(($args['id'] != '')?'id="'.$args['id'].'"':'').' '.(($args['name'] != '')?'name="'.$args['name'].'"':'').' value="1" '.(($args['className'] != '')?'class="'.$args['className'].'"':'').' '.(($args['style'] != '')?'style="'.$args['style'].'"':'').' '.(($args['required'])?'required':'').' />';
289
+ }
290
+ if($args['label'] != '') { $HTML .= '&nbsp;<label '.(($args['name'] != '')?'for="'.$args['name'].'"':'').'>'.$args['label'].'</label>'; }
291
+ if($args['helpText'] != '') { $HTML .= '<small>'.$args['helpText'].'</small>'; }
292
+ if($args['useParagraph']) { $HTML .= '</p>'; }
293
+ break;
294
+ case 'select':
295
+ if($args['useParagraph']) { $HTML .= '<p>'; }
296
+ if($args['label'] != '') { $HTML .= '<label '.(($args['name'] != '')?'for="'.$args['name'].'"':'').'>'.$args['label'].'</label><br />'; }
297
+ $HTML .= '<select '.(($args['id'] != '')?'id="'.$args['id'].'"':'').' '.(($args['name'] != '')?'name="'.$args['name'].'"':'').' '.(($args['value'] != '')?'value="'.$args['value'].'"':'').' '.(($args['className'] != '')?'class="'.$args['className'].'"':'').' '.(($args['style'] != '')?'style="'.$args['style'].'"':'').' '.(($args['required'])?'required':'').'>';
298
+ if(is_array($args['options'])) {
299
+ foreach($args['options'] as $option) {
300
+ $metadata = '';
301
+ if(isset($option['metadata']) && is_array($option['metadata'])) {
302
+ foreach($option['metadata'] as $key => $value) {
303
+ $metadata .= 'data-'.$key.'="'.$value.'"';
304
+ }
305
+ }
306
+ $HTML .= '<option '.$metadata.''.(($option['value'] != '')?'value="'.$option['value'].'"':'').' '.selected((($args['value'] != '')?$args['value']:''), (($option['value'] != '')?$option['value']:''), false).'>'.(($option['text'] != '')?$option['text']:'').'</option>';
307
+ }
308
+ }
309
+ $HTML .= '</select>';
310
+ if($args['helpText'] != '') { $HTML .= '<small>'.$args['helpText'].'</small>'; }
311
+ if($args['useParagraph']) { $HTML .= '</p>'; }
312
+ break;
313
+ case 'choosen-multiselect':
314
+ if($args['useParagraph']) { $HTML .= '<p>'; }
315
+ if($args['label'] != '') { $HTML .= '<label '.(($args['name'] != '')?'for="'.$args['name'].'"':'').'>'.$args['label'].'</label><br />'; }
316
+ $HTML .= '<select data-placeholder="'.(($args['label'] != '')?$args['label']:'Select Your Options').'" multiple '.(($args['id'] != '')?'id="'.$args['id'].'"':'').' '.(($args['name'] != '')?'name="'.$args['name'].'"':'').' '.(($args['value'] != '')?'value="'.$args['value'].'"':'').' '.(($args['className'] != '')?'class="'.$args['className'].'"':'').' '.(($args['style'] != '')?'style="'.$args['style'].'"':'').' '.(($args['required'])?'required':'').'>';
317
+ if(is_array($args['options'])) {
318
+ foreach($args['options'] as $option) {
319
+ if(in_array((($option['value'] != '')?$option['value']:''), ((is_array($args['value']))?$args['value']:array()))) {
320
+ $HTML .= '<option '.(($option['value'] != '')?'value="'.$option['value'].'"':'').' '.selected(1, 1, false).'>'.(($option['text'] != '')?$option['text']:'').'</option>';
321
+ } else {
322
+ $HTML .= '<option '.(($option['value'] != '')?'value="'.$option['value'].'"':'').'>'.(($option['text'] != '')?$option['text']:'').'</option>';
323
+ }
324
+ }
325
+ }
326
+ $HTML .= '</select>';
327
+ if($args['helpText'] != '') { $HTML .= '<small>'.$args['helpText'].'</small>'; }
328
+ if($args['useParagraph']) { $HTML .= '</p>'; }
329
+ $JS .= 'jQuery("#'.(($args['id'] != '')?$args['id']:'').'").chosen({ width: "100%" }).on("change", function(evt, params) { jQuery("#'.(($args['id'] != '')?$args['id']:'').'_chosen .search-field input").click(); }).trigger("chosen:open");';
330
+ break;
331
+ case 'radio-group':
332
+ if($args['useParagraph']) { $HTML .= '<p>'; }
333
+ if($args['label'] != '') { $HTML .= '<label '.(($args['name'] != '')?'for="'.$args['name'].'"':'').'>'.$args['label'].'</label><br />'; }
334
+ if(is_array($args['options'])) {
335
+ $index = 1;
336
+ foreach($args['options'] as $option) {
337
+ $HTML .= '<input type="radio" '.(($args['id'] != '')?'id="'.$args['id'].'_'.$index.'"':'').' '.(($args['name'] != '')?'name="'.$args['name'].'"':'').' '.(($option['value'] != '')?'value="'.$option['value'].'"':'').' '.checked(((isset($args['value']))?$args['value']:''), ((isset($option['value']))?$option['value']:''), false).' '.(($args['className'] != '')?'class="'.$args['className'].'"':'').' '.(($args['style'] != '')?'style="'.$args['style'].'"':'').' />';
338
+ if($option['text'] != '') { $HTML .= '&nbsp;<label '.(($args['name'] != '')?'for="'.$args['name'].'"':'').'>'.(($option['text'] != '')?$option['text']:'').'</label><br />'; }
339
+ $index++;
340
+ }
341
+ }
342
+ if($args['helpText'] != '') { $HTML .= '<small>'.$args['helpText'].'</small>'; }
343
+ if($args['useParagraph']) { $HTML .= '</p>'; }
344
+ break;
345
+ case 'ipCheckbox':
346
+ if($args['useParagraph']) { $HTML .= '<p>'; }
347
+ if(isset($args['value']) && (filter_var($args['value'], FILTER_VALIDATE_BOOLEAN))) {
348
+ $HTML .= '<input type="checkbox" '.(($args['id'] != '')?'id="'.$args['id'].'"':'').' '.(($args['name'] != '')?'name="'.$args['name'].'"':'').' value="true" '.checked(true, true, false).' '.(($args['className'] != '')?'class="ipCheckbox '.$args['className'].'"':'class="ipCheckbox"').' '.(($args['style'] != '')?'style="'.$args['style'].'"':'').' '.(($args['required'])?'required':'').' />';
349
+ } else {
350
+ $HTML .= '<input type="checkbox" '.(($args['id'] != '')?'id="'.$args['id'].'"':'').' '.(($args['name'] != '')?'name="'.$args['name'].'"':'').' value="true" '.(($args['className'] != '')?'class="ipCheckbox '.$args['className'].'"':'class="ipCheckbox"').' '.(($args['style'] != '')?'style="'.$args['style'].'"':'').' '.(($args['required'])?'required':'').' />';
351
+ }
352
+ if($args['label'] != '') { $HTML .= '&nbsp;<label '.(($args['name'] != '')?'for="'.$args['name'].'"':'').'>'.$args['label'].'</label>'; }
353
+ if($args['helpText'] != '') { $HTML .= '<small>'.$args['helpText'].'</small>'; }
354
+ if($args['useParagraph']) { $HTML .= '</p>'; }
355
+ $JS .= 'jQuery("#'.(($args['id'] != '')?$args['id']:'').'").ipCheckbox();';
356
+ break;
357
+ case 'minicolors':
358
+ if($args['useParagraph']) { $HTML .= '<p>'; }
359
+ if($args['label'] != '') { $HTML .= '<label '.(($args['name'] != '')?'for="'.$args['name'].'"':'').'>'.$args['label'].'</label><br />'; }
360
+ $HTML .= '<input type="text" '.(($args['id'] != '')?'id="'.$args['id'].'"':'').' '.(($args['name'] != '')?'name="'.$args['name'].'"':'').' '.(($args['value'] != '')?'value="'.$args['value'].'"':'').' '.(($args['className'] != '')?'class="'.$args['className'].'"':'').' '.(($args['style'] != '')?'style="'.$args['style'].'"':'').' '.(($args['required'])?'required':'').' />';
361
+ if($args['helpText'] != '') { $HTML .= '<small>'.$args['helpText'].'</small>'; }
362
+ if($args['useParagraph']) { $HTML .= '</p>'; }
363
+ $JS .= 'jQuery("#'.(($args['id'] != '')?$args['id']:'').'").minicolors();';
364
+ break;
365
+ case 'textarea-wysiwyg':
366
+ if($args['useParagraph']) { $HTML .= '<p>'; }
367
+ if($args['label'] != '') { $HTML .= '<label '.(($args['name'] != '')?'for="'.$args['name'].'"':'').'>'.$args['label'].'</label><br />'; }
368
+ $HTML .= '<textarea '.(($args['id'] != '')?'id="'.$args['id'].'"':'').' '.(($args['name'] != '')?'name="'.$args['name'].'"':'').' '.(($args['className'] != '')?'class="'.$args['className'].'"':'').' '.(($args['style'] != '')?'style="'.$args['style'].'"':'').' '.(($args['required'])?'required':'').'>'.stripslashes((($args['value'] != '')?$args['value']:'')).'</textarea>';
369
+ if($args['helpText'] != '') { $HTML .= '<small>'.$args['helpText'].'</small>'; }
370
+ if($args['useParagraph']) { $HTML .= '</p>'; }
371
+ $JS .= 'jQuery("#'.(($args['id'] != '')?$args['id']:'').'").jqte();';
372
+ break;
373
+ case 'checkbox-button':
374
+ if($args['useParagraph']) { $HTML .= '<p>'; }
375
+ if(isset($args['value']) && (filter_var($args['value'], FILTER_VALIDATE_BOOLEAN))) {
376
+ $HTML .= '<input type="checkbox" '.(($args['id'] != '')?'id="'.$args['id'].'"':'').' '.(($args['name'] != '')?'name="'.$args['name'].'"':'').' value="true" '.checked(true, true, false).' '.(($args['className'] != '')?'class="'.$args['className'].'"':'').' '.(($args['style'] != '')?'style="'.$args['style'].'"':'').' '.(($args['required'])?'required':'').' />';
377
+ } else {
378
+ $HTML .= '<input type="checkbox" '.(($args['id'] != '')?'id="'.$args['id'].'"':'').' '.(($args['name'] != '')?'name="'.$args['name'].'"':'').' value="true" '.(($args['className'] != '')?'class="'.$args['className'].'"':'').' '.(($args['style'] != '')?'style="'.$args['style'].'"':'').' '.(($args['required'])?'required':'').' />';
379
+ }
380
+ if($args['label'] != '') { $HTML .= '<label for="'.(($args['id'] != '')?$args['id']:'').'">'.$args['label'].'</label>'; }
381
+ if($args['helpText'] != '') { $HTML .= '<small>'.$args['helpText'].'</small>'; }
382
+ if($args['useParagraph']) { $HTML .= '</p>'; }
383
+ $JS .= 'jQuery("#'.(($args['id'] != '')?$args['id']:'').'").button({ create: function(event, ui) { jQuery(this).button("option", "label", (jQuery(this).is(":checked")?"'.(($args['checkedLabel'] != '')?$args['checkedLabel']:'').'":"'.(($args['uncheckedLabel'] != '')?$args['uncheckedLabel']:'').'")) }}).change(function () { jQuery(this).button("option", "label", (jQuery(this).is(":checked")?"'.(($args['checkedLabel'] != '')?$args['checkedLabel']:'').'":"'.(($args['uncheckedLabel'] != '')?$args['uncheckedLabel']:'').'")); });';
384
+ break;
385
+ case 'pages-select':
386
+ $this->load_data('pages');
387
+ if($args['useParagraph']) { $HTML .= '<p>'; }
388
+ if($args['label'] != '') { $HTML .= '<label '.(($args['name'] != '')?'for="'.$args['name'].'"':'').'>'.$args['label'].'</label><br />'; }
389
+ $HTML .= '<select '.(($args['id'] != '')?'id="'.$args['id'].'"':'').' '.(($args['name'] != '')?'name="'.$args['name'].'"':'').' '.(($args['value'] != '')?'value="'.$args['value'].'"':'').' '.(($args['className'] != '')?'class="'.$args['className'].'"':'').' '.(($args['style'] != '')?'style="'.$args['style'].'"':'').' '.(($args['required'])?'required':'').'>';
390
+ if(is_array($this->pages)) {
391
+ foreach($this->pages as $option) {
392
+ $HTML .= '<option '.(($option['value'] != '')?'value="'.$option['value'].'"':'').' '.selected((($args['value'] != '')?$args['value']:''), (($option['value'] != '')?$option['value']:''), false).'>'.(($option['text'] != '')?$option['text']:'').'</option>';
393
+ }
394
+ }
395
+ $HTML .= '</select>';
396
+ if($args['helpText'] != '') { $HTML .= '<small>'.$args['helpText'].'</small>'; }
397
+ if($args['useParagraph']) { $HTML .= '</p>'; }
398
+ break;
399
+ case 'pages-chosen-multiselect':
400
+ $this->load_data('pages');
401
+ if($args['useParagraph']) { $HTML .= '<p>'; }
402
+ if($args['label'] != '') { $HTML .= '<label '.(($args['name'] != '')?'for="'.$args['name'].'"':'').'>'.$args['label'].'</label><br />'; }
403
+ $HTML .= '<select multiple data-placeholder="'.(($args['label'] != '')?$args['label']:'Select Your Options').'" '.(($args['id'] != '')?'id="'.$args['id'].'"':'').' '.(($args['name'] != '')?'name="'.$args['name'].'"':'').' '.(($args['value'] != '')?'value="'.$args['value'].'"':'').' '.(($args['className'] != '')?'class="'.$args['className'].'"':'').' '.(($args['style'] != '')?'style="'.$args['style'].'"':'').' '.(($args['required'])?'required':'').'>';
404
+ if(is_array($this->pages)) {
405
+ foreach($this->pages as $option) {
406
+ if(in_array((($option['value'] != '')?$option['value']:''), ((is_array($args['value']))?$args['value']:array()))) {
407
+ $HTML .= '<option '.(($option['value'] != '')?'value="'.$option['value'].'"':'').' '.selected(1, 1, false).'>'.(($option['text'] != '')?$option['text']:'').'</option>';
408
+ } else {
409
+ $HTML .= '<option '.(($option['value'] != '')?'value="'.$option['value'].'"':'').'>'.(($option['text'] != '')?$option['text']:'').'</option>';
410
+ }
411
+ }
412
+ }
413
+ $HTML .= '</select>';
414
+ if($args['helpText'] != '') { $HTML .= '<small>'.$args['helpText'].'</small>'; }
415
+ if($args['useParagraph']) { $HTML .= '</p>'; }
416
+ $JS .= 'jQuery("#'.(($args['id'] != '')?$args['id']:'').'").chosen({ width: "100%" }).on("change", function(evt, params) { jQuery("#'.(($args['id'] != '')?$args['id']:'').'_chosen .search-field input").click(); }).trigger("chosen:open");';
417
+ break;
418
+ case 'posts-select':
419
+ $this->load_data('posts');
420
+ if($args['useParagraph']) { $HTML .= '<p>'; }
421
+ if($args['label'] != '') { $HTML .= '<label '.(($args['name'] != '')?'for="'.$args['name'].'"':'').'>'.$args['label'].'</label><br />'; }
422
+ $HTML .= '<select '.(($args['id'] != '')?'id="'.$args['id'].'"':'').' '.(($args['name'] != '')?'name="'.$args['name'].'"':'').' '.(($args['value'] != '')?'value="'.$args['value'].'"':'').' '.(($args['className'] != '')?'class="'.$args['className'].'"':'').' '.(($args['style'] != '')?'style="'.$args['style'].'"':'').' '.(($args['required'])?'required':'').'>';
423
+ if(is_array($this->posts)) {
424
+ foreach($this->posts as $option) {
425
+ $HTML .= '<option '.(($option['value'] != '')?'value="'.$option['value'].'"':'').' '.selected((($args['value'] != '')?$args['value']:''), (($option['value'] != '')?$option['value']:''), false).'>'.(($option['text'] != '')?$option['text']:'').'</option>';
426
+ }
427
+ }
428
+ $HTML .= '</select>';
429
+ if($args['helpText'] != '') { $HTML .= '<small>'.$args['helpText'].'</small>'; }
430
+ if($args['useParagraph']) { $HTML .= '</p>'; }
431
+ break;
432
+ case 'posts-chosen-multiselect':
433
+ $this->load_data('posts');
434
+ if($args['useParagraph']) { $HTML .= '<p>'; }
435
+ if($args['label'] != '') { $HTML .= '<label '.(($args['name'] != '')?'for="'.$args['name'].'"':'').'>'.$args['label'].'</label><br />'; }
436
+ $HTML .= '<select multiple data-placeholder="'.(($args['label'] != '')?$args['label']:'Select Your Options').'" '.(($args['id'] != '')?'id="'.$args['id'].'"':'').' '.(($args['name'] != '')?'name="'.$args['name'].'"':'').' '.(($args['value'] != '')?'value="'.$args['value'].'"':'').' '.(($args['className'] != '')?'class="'.$args['className'].'"':'').' '.(($args['style'] != '')?'style="'.$args['style'].'"':'').' '.(($args['required'])?'required':'').'>';
437
+ if(is_array($this->posts)) {
438
+ foreach($this->posts as $option) {
439
+ if(in_array((($option['value'] != '')?$option['value']:''), ((is_array($args['value']))?$args['value']:array()))) {
440
+ $HTML .= '<option '.(($option['value'] != '')?'value="'.$option['value'].'"':'').' '.selected(1, 1, false).'>'.(($option['text'] != '')?$option['text']:'').'</option>';
441
+ } else {
442
+ $HTML .= '<option '.(($option['value'] != '')?'value="'.$option['value'].'"':'').'>'.(($option['text'] != '')?$option['text']:'').'</option>';
443
+ }
444
+ }
445
+ }
446
+ $HTML .= '</select>';
447
+ if($args['helpText'] != '') { $HTML .= '<small>'.$args['helpText'].'</small>'; }
448
+ if($args['useParagraph']) { $HTML .= '</p>'; }
449
+ $JS .= 'jQuery("#'.(($args['id'] != '')?$args['id']:'').'").chosen({ width: "100%" }).on("change", function(evt, params) { jQuery("#'.(($args['id'] != '')?$args['id']:'').'_chosen .search-field input").click(); }).trigger("chosen:open");';
450
+ break;
451
+ case 'categories-select':
452
+ $this->load_data('categories');
453
+ if($args['useParagraph']) { $HTML .= '<p>'; }
454
+ if($args['label'] != '') { $HTML .= '<label '.(($args['name'] != '')?'for="'.$args['name'].'"':'').'>'.$args['label'].'</label><br />'; }
455
+ $HTML .= '<select '.(($args['id'] != '')?'id="'.$args['id'].'"':'').' '.(($args['name'] != '')?'name="'.$args['name'].'"':'').' '.(($args['value'] != '')?'value="'.$args['value'].'"':'').' '.(($args['className'] != '')?'class="'.$args['className'].'"':'').' '.(($args['style'] != '')?'style="'.$args['style'].'"':'').' '.(($args['required'])?'required':'').'>';
456
+ if(is_array($this->categories)) {
457
+ foreach($this->categories as $option) {
458
+ $HTML .= '<option '.(($option['value'] != '')?'value="'.$option['value'].'"':'').' '.selected((($args['value'] != '')?$args['value']:''), (($option['value'] != '')?$option['value']:''), false).'>'.(($option['text'] != '')?$option['text']:'').'</option>';
459
+ }
460
+ }
461
+ $HTML .= '</select>';
462
+ if($args['helpText'] != '') { $HTML .= '<small>'.$args['helpText'].'</small>'; }
463
+ if($args['useParagraph']) { $HTML .= '</p>'; }
464
+ break;
465
+ case 'categories-chosen-multiselect':
466
+ $this->load_data('categories');
467
+ if($args['useParagraph']) { $HTML .= '<p>'; }
468
+ if($args['label'] != '') { $HTML .= '<label '.(($args['name'] != '')?'for="'.$args['name'].'"':'').'>'.$args['label'].'</label><br />'; }
469
+ $HTML .= '<select multiple data-placeholder="'.(($args['label'] != '')?$args['label']:'Select Your Options').'" '.(($args['id'] != '')?'id="'.$args['id'].'"':'').' '.(($args['name'] != '')?'name="'.$args['name'].'"':'').' '.(($args['value'] != '')?'value="'.$args['value'].'"':'').' '.(($args['className'] != '')?'class="'.$args['className'].'"':'').' '.(($args['style'] != '')?'style="'.$args['style'].'"':'').' '.(($args['required'])?'required':'').'>';
470
+ if(is_array($this->categories)) {
471
+ foreach($this->categories as $option) {
472
+ if(in_array((($option['value'] != '')?$option['value']:''), ((is_array($args['value']))?$args['value']:array()))) {
473
+ $HTML .= '<option '.(($option['value'] != '')?'value="'.$option['value'].'"':'').' '.selected(1, 1, false).'>'.(($option['text'] != '')?$option['text']:'').'</option>';
474
+ } else {
475
+ $HTML .= '<option '.(($option['value'] != '')?'value="'.$option['value'].'"':'').'>'.(($option['text'] != '')?$option['text']:'').'</option>';
476
+ }
477
+ }
478
+ }
479
+ $HTML .= '</select>';
480
+ if($args['helpText'] != '') { $HTML .= '<small>'.$args['helpText'].'</small>'; }
481
+ if($args['useParagraph']) { $HTML .= '</p>'; }
482
+ $JS .= 'jQuery("#'.(($args['id'] != '')?$args['id']:'').'").chosen({ width: "100%" }).on("change", function(evt, params) { jQuery("#'.(($args['id'] != '')?$args['id']:'').'_chosen .search-field input").click(); }).trigger("chosen:open");';
483
+ break;
484
+ }
485
+
486
+ if($args['plainHTML'] && !$ignorePlainHTML) {
487
+ return $HTML;
488
+ } else {
489
+ return array(
490
+ 'HTML' => $HTML,
491
+ 'JS' => $JS
492
+ );
493
+ }
494
+ }
495
+
496
+ private function load_data($type) {
497
+ switch($type) {
498
+ case 'pages':
499
+ if(!is_array($this->pages)) {
500
+ $pages = get_pages('numberposts=100');
501
+ if(isset($pages) && is_array($pages)) {
502
+ $this->pages = array();
503
+ foreach($pages as $page) {
504
+ $this->pages[] = array('text' => (($page->post_title != '')?$page->post_title:'Untitled Page ('.$page->ID.')'), 'value' => $page->ID);
505
+ }
506
+ }
507
+ }
508
+ break;
509
+ case 'posts':
510
+ if(!is_array($this->posts)) {
511
+ $posts = get_posts('numberposts=100');
512
+ if(isset($posts) && is_array($posts)) {
513
+ $this->posts = array();
514
+ foreach($posts as $post) {
515
+ $this->posts[] = array('text' => $post->post_title, 'value' => $post->ID);
516
+ }
517
+ }
518
+ }
519
+ break;
520
+ case 'categories':
521
+ if(!is_array($this->categories)) {
522
+ $categories = get_categories('number=200&hide_empty=0');
523
+ if(isset($categories) && is_array($categories)) {
524
+ $this->categories = array();
525
+ foreach($categories as $category) {
526
+ $this->categories[] = array('text' => $category->name, 'value' => $category->term_id);
527
+ }
528
+ }
529
+ }
530
+ break;
531
+ }
532
+ }
533
+
534
+ public function create_section($sectionTitle = '', $includeBlock = true) {
535
+ $wrapperHTML = '<div class="smartlogixSectionWrapper">';
536
+ if($sectionTitle != '') {
537
+ $wrapperHTML .= '<label class="smartlogixSectionTitle">'.$sectionTitle.'</label>';
538
+ }
539
+ if($includeBlock) {
540
+ $wrapperHTML .= $this->create_block();
541
+ }
542
+ $wrapperHTML .= $this->HTML;
543
+ $wrapperHTML .= '</div>';
544
+ $this->HTML = $wrapperHTML;
545
+ }
546
+
547
+ public function create_block() {
548
+ $this->HTML = '<div class="smartlogixSectionInner">'.$this->HTML.'</div>';
549
+ }
550
+
551
+ public function set_HTML($HTML) {
552
+ $this->HTML = $HTML;
553
+ }
554
+
555
+ public function clear_controls($clearHTML = true, $clearJS = false) {
556
+ if($clearHTML) {
557
+ $this->HTML = '';
558
+ }
559
+ if($clearJS) {
560
+ $this->JS = '';
561
+ }
562
+ }
563
+
564
+ public static function enqueue_assets($path, $version = '1') {
565
+ wp_register_style('smartlogix-controls-css', $path.'/assets/css/controls.css', array(), $version);
566
+ wp_enqueue_style('smartlogix-controls-css');
567
+ wp_register_script('smartlogix-controls-js', $path.'/assets/js/controls.js', array(), $version);
568
+ wp_enqueue_script('smartlogix-controls-js');
569
+ }
570
+ }
571
+ ?>
css/admin.css CHANGED
@@ -1,4 +1,74 @@
1
  body.post-type-insertpostads #misc-publishing-actions,
2
  body.post-type-insertpostads #minor-publishing-actions {
3
  display: none;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  }
1
  body.post-type-insertpostads #misc-publishing-actions,
2
  body.post-type-insertpostads #minor-publishing-actions {
3
  display: none;
4
+ }
5
+ .postbox > .plugin-card.vi-card{
6
+ /* border: 3px solid #9a02c0;*/
7
+ float: none;
8
+ width: 100%;
9
+ margin: 0;
10
+ border:0;
11
+ }
12
+ .vi-list{
13
+ list-style-type: disc;
14
+ font-size: 12px;
15
+ padding-left: 20px;
16
+ line-height: 12px;
17
+ }
18
+ .vi-card #insert_ads_vi_earnings_wrapper #insert_ads_vi_earnings{
19
+ width: 25% !important;
20
+ min-width: 20% !important;
21
+ }
22
+ .vi-card #insert_ads_vi_earnings_wrapper #insert_ads_vi_chart_wrapper{
23
+ width:75% !important;
24
+ height:auto !important;
25
+ }
26
+ .insert_ads_notice {
27
+ border-left-color: #000000 !important;
28
+ }
29
+ .ui-dialog, .ui-dialog-buttonpane{
30
+ background: #f0f0f0 !important;
31
+ }
32
+ #insert_ads_vi_login_dialog .smartlogixSectionTitle{
33
+ background: #f0f0f0;
34
+ }
35
+ #insert_ads_vi_signup_dialog + .ui-dialog-buttonpane{
36
+ display:none;
37
+ }
38
+ div[aria-describedby="insert_ads_vi_signup_dialog"] .ui-dialog-titlebar{
39
+ background: transparent;
40
+ border: 0;
41
+ padding: 0;
42
+ }
43
+ div[aria-describedby="insert_ads_vi_signup_dialog"] .ui-dialog-titlebar > span{
44
+ display:none;
45
+ }
46
+
47
+ div[aria-describedby="insert_ads_vi_signup_dialog"] .ui-dialog-titlebar button{
48
+ top: 20px;
49
+ z-index: 9999;
50
+ right: 10px;
51
+ }
52
+ .ui-button-text, .ui-button{
53
+ outline:none;
54
+ }
55
+ .pwithcheck{
56
+ display:none !important;
57
+ }
58
+ .insert_ads_vi_code_data_wrapper ~ .pwithcheck{
59
+ display:block !important;
60
+ }
61
+ #sucdial{
62
+ position: fixed;
63
+ width: 30%;
64
+ font-size: 20px;
65
+ background: white;
66
+ text-align: center;
67
+ padding: 30px 0px;
68
+ box-shadow: 0px 0px 10px;
69
+ left: 0px;
70
+ right: 0px;
71
+ margin: auto;
72
+ top: 40%;
73
+ z-index: 99999;
74
  }
css/controls.css ADDED
@@ -0,0 +1,1411 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .smartlogixSectionWrapper {
2
+ margin: 15px 0;
3
+ padding: 5px;
4
+ border: 1px solid #999999;
5
+ border-radius: 5px;
6
+ position: relative;
7
+ }
8
+
9
+ .smartlogixSectionWrapper .smartlogixSectionTitle {
10
+ font-weight: bold;
11
+ position: absolute;
12
+ left: 15px;
13
+ right: 15px;
14
+ top: -10px;
15
+ background: #FFFFFF;
16
+ color: #111111;
17
+ padding: 0px 10px;
18
+ }
19
+
20
+ .smartlogixSectionWrapper .smartlogixSectionInner {
21
+ margin: 10px 0 10px;
22
+ padding: 0 10px;
23
+ position: relative;
24
+ }
25
+
26
+ @media screen and (min-width: 768px) and (max-width: 1200px) {
27
+ .smartlogixSectionWrapper .smartlogixSectionInner {
28
+ margin-top: 30px;
29
+ }
30
+ }
31
+
32
+ .smartlogixSectionWrapper .smartlogixSectionInner p {
33
+ margin: 0 0 10px;
34
+ }
35
+
36
+
37
+ .ipcheckbox{
38
+ background: #C8161B;
39
+ border: none;
40
+ height: 36px;
41
+ -webkit-border-radius: 18px;
42
+ border-radius: 18px;
43
+ width: 120px;
44
+ -webkit-transition: all 0.3s ease-in-out;
45
+ -moz-transition: all 0.3s ease-in-out;
46
+ -ms-transition: all 0.3s ease-in-out;
47
+ -o-transition: all 0.3s ease-in-out;
48
+ transition: all 0.3s ease-in-out;
49
+ -webkit-box-shadow: none;
50
+ box-shadow: none;
51
+ cursor: pointer;
52
+ position: relative;
53
+ display: inline-block;
54
+ }
55
+
56
+ .ipcheckbox.checked{
57
+ -webkit-box-shadow: inset 0 0 0 36px #6ddc5f;
58
+ box-shadow: inset 0 0 0 36px #6ddc5f;
59
+ }
60
+
61
+ .ipcheckbox.checked .handle{
62
+ left: 87px;
63
+ }
64
+
65
+ .ipcheckbox .handle{
66
+ width: 30px;
67
+ height: 30px;
68
+ position: absolute;
69
+ top: 3px;
70
+ left: 3px;
71
+ -webkit-border-radius: 100%;
72
+ border-radius: 100%;
73
+ background: white;
74
+ -webkit-transition: all 350ms cubic-bezier(0, 0.89, 0.44, 1);
75
+ -moz-transition: all 350ms cubic-bezier(0, 0.89, 0.44, 1);
76
+ -o-transition: all 350ms cubic-bezier(0, 0.89, 0.44, 1);
77
+ transition: all 350ms cubic-bezier(0, 0.89, 0.44, 1);
78
+ -webkit-box-shadow: 0 1px 2px 0 rgba(0,0,0,0.2),0 3px 4px 0 rgba(0,0,0,0.1);
79
+ box-shadow: 0 1px 2px 0 rgba(0,0,0,0.2),0 3px 4px 0 rgba(0,0,0,0.1);
80
+ }
81
+
82
+ .chosen-container {
83
+ position: relative;
84
+ display: inline-block;
85
+ vertical-align: middle;
86
+ font-size: 13px;
87
+ zoom: 1;
88
+ *display: inline;
89
+ -webkit-user-select: none;
90
+ -moz-user-select: none;
91
+ user-select: none;
92
+ }
93
+
94
+ .chosen-container * {
95
+ -webkit-box-sizing: border-box;
96
+ -moz-box-sizing: border-box;
97
+ box-sizing: border-box;
98
+ }
99
+
100
+ .chosen-container .chosen-drop {
101
+ display: block;
102
+ height: 241px;
103
+ width: 100%;
104
+ border: 1px solid #aaa;
105
+ border-top: 0;
106
+ background: #fff;
107
+ /*box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15);*/
108
+ }
109
+
110
+ .chosen-container.chosen-with-drop .chosen-drop {
111
+ left: 0;
112
+ }
113
+
114
+ .chosen-container a {
115
+ cursor: pointer;
116
+ }
117
+
118
+ .chosen-container .search-choice .group-name,
119
+ .chosen-container .chosen-single .group-name {
120
+ margin-right: 4px;
121
+ overflow: hidden;
122
+ white-space: nowrap;
123
+ text-overflow: ellipsis;
124
+ font-weight: normal;
125
+ color: #999999;
126
+ }
127
+
128
+ .chosen-container .search-choice .group-name:after,
129
+ .chosen-container .chosen-single .group-name:after {
130
+ content: ":";
131
+ padding-left: 2px;
132
+ vertical-align: top;
133
+ }
134
+
135
+ .chosen-container-single .chosen-single {
136
+ position: relative;
137
+ display: block;
138
+ overflow: hidden;
139
+ padding: 0 0 0 8px;
140
+ height: 25px;
141
+ border: 1px solid #aaa;
142
+ border-radius: 5px;
143
+ background-color: #fff;
144
+ background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #ffffff), color-stop(50%, #f6f6f6), color-stop(52%, #eeeeee), color-stop(100%, #f4f4f4));
145
+ background: -webkit-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
146
+ background: -moz-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
147
+ background: -o-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
148
+ background: linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
149
+ background-clip: padding-box;
150
+ box-shadow: 0 0 3px white inset, 0 1px 1px rgba(0, 0, 0, 0.1);
151
+ color: #444;
152
+ text-decoration: none;
153
+ white-space: nowrap;
154
+ line-height: 24px;
155
+ }
156
+
157
+ .chosen-container-single .chosen-default {
158
+ color: #999;
159
+ }
160
+
161
+ .chosen-container-single .chosen-single span {
162
+ display: block;
163
+ overflow: hidden;
164
+ margin-right: 26px;
165
+ text-overflow: ellipsis;
166
+ white-space: nowrap;
167
+ }
168
+
169
+ .chosen-container-single .chosen-single-with-deselect span {
170
+ margin-right: 38px;
171
+ }
172
+
173
+ .chosen-container-single .chosen-single abbr {
174
+ position: absolute;
175
+ top: 6px;
176
+ right: 26px;
177
+ display: block;
178
+ width: 12px;
179
+ height: 12px;
180
+ background: url('../images/chosen-sprite.png') -42px 1px no-repeat;
181
+ font-size: 1px;
182
+ }
183
+
184
+ .chosen-container-single .chosen-single abbr:hover {
185
+ background-position: -42px -10px;
186
+ }
187
+
188
+ .chosen-container-single.chosen-disabled .chosen-single abbr:hover {
189
+ background-position: -42px -10px;
190
+ }
191
+
192
+ .chosen-container-single .chosen-single div {
193
+ position: absolute;
194
+ top: 0;
195
+ right: 0;
196
+ display: block;
197
+ width: 18px;
198
+ height: 100%;
199
+ }
200
+
201
+ .chosen-container-single .chosen-single div b {
202
+ display: block;
203
+ width: 100%;
204
+ height: 100%;
205
+ background: url('../images/chosen-sprite.png') no-repeat 0px 2px;
206
+ }
207
+
208
+ .chosen-container-single .chosen-search {
209
+ position: relative;
210
+ z-index: 1010;
211
+ margin: 0;
212
+ padding: 3px 4px;
213
+ white-space: nowrap;
214
+ }
215
+
216
+ .chosen-container-single .chosen-search input[type="text"] {
217
+ margin: 1px 0;
218
+ padding: 4px 20px 4px 5px;
219
+ width: 100%;
220
+ height: auto;
221
+ outline: 0;
222
+ border: 1px solid #aaa;
223
+ background: white url('../images/chosen-sprite.png') no-repeat 100% -20px;
224
+ background: url('../images/chosen-sprite.png') no-repeat 100% -20px;
225
+ font-size: 1em;
226
+ font-family: sans-serif;
227
+ line-height: normal;
228
+ border-radius: 0;
229
+ }
230
+
231
+ .chosen-container-single .chosen-drop {
232
+ margin-top: -1px;
233
+ border-radius: 0 0 4px 4px;
234
+ background-clip: padding-box;
235
+ }
236
+
237
+ .chosen-container-single.chosen-container-single-nosearch .chosen-search {
238
+ position: absolute;
239
+ left: -9999px;
240
+ }
241
+
242
+ .chosen-container .chosen-results {
243
+ color: #444;
244
+ position: relative;
245
+ overflow-x: hidden;
246
+ overflow-y: auto;
247
+ margin: 0 4px 4px 0;
248
+ padding: 0 0 0 4px;
249
+ max-height: 240px;
250
+ -webkit-overflow-scrolling: touch;
251
+ }
252
+
253
+ .chosen-container .chosen-results li {
254
+ display: none;
255
+ margin: 0;
256
+ padding: 5px 6px;
257
+ list-style: none;
258
+ line-height: 15px;
259
+ word-wrap: break-word;
260
+ -webkit-touch-callout: none;
261
+ }
262
+
263
+ .chosen-container .chosen-results li.active-result {
264
+ display: list-item;
265
+ cursor: pointer;
266
+ }
267
+
268
+ .chosen-container .chosen-results li.disabled-result {
269
+ display: list-item;
270
+ color: #ccc;
271
+ cursor: default;
272
+ }
273
+
274
+ .chosen-container .chosen-results li.highlighted {
275
+ background-color: #3875d7;
276
+ background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #3875d7), color-stop(90%, #2a62bc));
277
+ background-image: -webkit-linear-gradient(#3875d7 20%, #2a62bc 90%);
278
+ background-image: -moz-linear-gradient(#3875d7 20%, #2a62bc 90%);
279
+ background-image: -o-linear-gradient(#3875d7 20%, #2a62bc 90%);
280
+ background-image: linear-gradient(#3875d7 20%, #2a62bc 90%);
281
+ color: #fff;
282
+ }
283
+
284
+ .chosen-container .chosen-results li.no-results {
285
+ color: #777;
286
+ display: list-item;
287
+ background: #f4f4f4;
288
+ }
289
+
290
+ .chosen-container .chosen-results li.group-result {
291
+ display: list-item;
292
+ font-weight: bold;
293
+ cursor: default;
294
+ }
295
+
296
+ .chosen-container .chosen-results li.group-option {
297
+ padding-left: 15px;
298
+ }
299
+
300
+ .chosen-container .chosen-results li em {
301
+ font-style: normal;
302
+ text-decoration: underline;
303
+ }
304
+
305
+ .chosen-container-multi .chosen-choices {
306
+ position: relative;
307
+ overflow: hidden;
308
+ margin: 0;
309
+ padding: 0 5px;
310
+ width: 100%;
311
+ height: auto !important;
312
+ height: 1%;
313
+ border: 1px solid #aaa;
314
+ background-color: #fff;
315
+ background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff));
316
+ background-image: -webkit-linear-gradient(#eeeeee 1%, #ffffff 15%);
317
+ background-image: -moz-linear-gradient(#eeeeee 1%, #ffffff 15%);
318
+ background-image: -o-linear-gradient(#eeeeee 1%, #ffffff 15%);
319
+ background-image: linear-gradient(#eeeeee 1%, #ffffff 15%);
320
+ cursor: text;
321
+ }
322
+
323
+ .chosen-container-multi .chosen-choices li {
324
+ float: left;
325
+ list-style: none;
326
+ }
327
+
328
+ .chosen-container-multi .chosen-choices li.search-field {
329
+ margin: 0;
330
+ padding: 0;
331
+ white-space: nowrap;
332
+ }
333
+
334
+ .chosen-container-multi .chosen-choices li.search-field input[type="text"] {
335
+ margin: 1px 0;
336
+ padding: 0;
337
+ height: 25px;
338
+ outline: 0;
339
+ border: 0 !important;
340
+ background: transparent !important;
341
+ box-shadow: none;
342
+ color: #999;
343
+ font-size: 100%;
344
+ font-family: sans-serif;
345
+ line-height: normal;
346
+ border-radius: 0;
347
+ }
348
+
349
+ .chosen-container-multi .chosen-choices li.search-choice {
350
+ position: relative;
351
+ margin: 3px 5px 3px 0;
352
+ padding: 3px 20px 3px 5px;
353
+ border: 1px solid #aaa;
354
+ max-width: 100%;
355
+ border-radius: 3px;
356
+ background-color: #eeeeee;
357
+ background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee));
358
+ background-image: -webkit-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
359
+ background-image: -moz-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
360
+ background-image: -o-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
361
+ background-image: linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
362
+ background-size: 100% 19px;
363
+ background-repeat: repeat-x;
364
+ background-clip: padding-box;
365
+ box-shadow: 0 0 2px white inset, 0 1px 0 rgba(0, 0, 0, 0.05);
366
+ color: #333;
367
+ line-height: 13px;
368
+ cursor: default;
369
+ }
370
+
371
+ .chosen-container-multi .chosen-choices li.search-choice span {
372
+ word-wrap: break-word;
373
+ }
374
+
375
+ .chosen-container-multi .chosen-choices li.search-choice .search-choice-close {
376
+ position: absolute;
377
+ top: 4px;
378
+ right: 3px;
379
+ display: block;
380
+ width: 12px;
381
+ height: 12px;
382
+ background: url('../images/chosen-sprite.png') -42px 1px no-repeat;
383
+ font-size: 1px;
384
+ }
385
+
386
+ .chosen-container-multi .chosen-choices li.search-choice .search-choice-close:hover {
387
+ background-position: -42px -10px;
388
+ }
389
+
390
+ .chosen-container-multi .chosen-choices li.search-choice-disabled {
391
+ padding-right: 5px;
392
+ border: 1px solid #ccc;
393
+ background-color: #e4e4e4;
394
+ background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee));
395
+ background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
396
+ background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
397
+ background-image: -o-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
398
+ background-image: linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
399
+ color: #666;
400
+ }
401
+
402
+ .chosen-container-multi .chosen-choices li.search-choice-focus {
403
+ background: #d4d4d4;
404
+ }
405
+
406
+ .chosen-container-multi .chosen-choices li.search-choice-focus .search-choice-close {
407
+ background-position: -42px -10px;
408
+ }
409
+
410
+ .chosen-container-multi .chosen-results {
411
+ margin: 0;
412
+ padding: 0;
413
+ }
414
+
415
+ .chosen-container-multi .chosen-drop .result-selected {
416
+ display: list-item;
417
+ color: #ccc;
418
+ cursor: default;
419
+ }
420
+
421
+ .chosen-container-active .chosen-single {
422
+ border: 1px solid #5897fb;
423
+ box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
424
+ }
425
+
426
+ .chosen-container-active.chosen-with-drop .chosen-single {
427
+ border: 1px solid #aaa;
428
+ -moz-border-radius-bottomright: 0;
429
+ border-bottom-right-radius: 0;
430
+ -moz-border-radius-bottomleft: 0;
431
+ border-bottom-left-radius: 0;
432
+ background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #eeeeee), color-stop(80%, #ffffff));
433
+ background-image: -webkit-linear-gradient(#eeeeee 20%, #ffffff 80%);
434
+ background-image: -moz-linear-gradient(#eeeeee 20%, #ffffff 80%);
435
+ background-image: -o-linear-gradient(#eeeeee 20%, #ffffff 80%);
436
+ background-image: linear-gradient(#eeeeee 20%, #ffffff 80%);
437
+ box-shadow: 0 1px 0 #fff inset;
438
+ }
439
+
440
+ .chosen-container-active.chosen-with-drop .chosen-single div {
441
+ border-left: none;
442
+ background: transparent;
443
+ }
444
+
445
+ .chosen-container-active.chosen-with-drop .chosen-single div b {
446
+ background-position: -18px 2px;
447
+ }
448
+
449
+ .chosen-container-active .chosen-choices {
450
+ border: 1px solid #5897fb;
451
+ box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
452
+ }
453
+
454
+ .chosen-container-active .chosen-choices li.search-field input[type="text"] {
455
+ color: #222 !important;
456
+ }
457
+
458
+ .chosen-disabled {
459
+ opacity: 0.5 !important;
460
+ cursor: default;
461
+ }
462
+
463
+ .chosen-disabled .chosen-single {
464
+ cursor: default;
465
+ }
466
+
467
+ .chosen-disabled .chosen-choices .search-choice .search-choice-close {
468
+ cursor: default;
469
+ }
470
+
471
+ .chosen-rtl {
472
+ text-align: right;
473
+ }
474
+
475
+ .chosen-rtl .chosen-single {
476
+ overflow: visible;
477
+ padding: 0 8px 0 0;
478
+ }
479
+
480
+ .chosen-rtl .chosen-single span {
481
+ margin-right: 0;
482
+ margin-left: 26px;
483
+ direction: rtl;
484
+ }
485
+
486
+ .chosen-rtl .chosen-single-with-deselect span {
487
+ margin-left: 38px;
488
+ }
489
+
490
+ .chosen-rtl .chosen-single div {
491
+ right: auto;
492
+ left: 3px;
493
+ }
494
+
495
+ .chosen-rtl .chosen-single abbr {
496
+ right: auto;
497
+ left: 26px;
498
+ }
499
+
500
+ .chosen-rtl .chosen-choices li {
501
+ float: right;
502
+ }
503
+
504
+ .chosen-rtl .chosen-choices li.search-field input[type="text"] {
505
+ direction: rtl;
506
+ }
507
+
508
+ .chosen-rtl .chosen-choices li.search-choice {
509
+ margin: 3px 5px 3px 0;
510
+ padding: 3px 5px 3px 19px;
511
+ }
512
+
513
+ .chosen-rtl .chosen-choices li.search-choice .search-choice-close {
514
+ right: auto;
515
+ left: 4px;
516
+ }
517
+
518
+ .chosen-rtl.chosen-container-single-nosearch .chosen-search,
519
+ .chosen-rtl .chosen-drop {
520
+ left: 9999px;
521
+ }
522
+
523
+ .chosen-rtl.chosen-container-single .chosen-results {
524
+ margin: 0 0 4px 4px;
525
+ padding: 0 4px 0 0;
526
+ }
527
+
528
+ .chosen-rtl .chosen-results li.group-option {
529
+ padding-right: 15px;
530
+ padding-left: 0;
531
+ }
532
+
533
+ .chosen-rtl.chosen-container-active.chosen-with-drop .chosen-single div {
534
+ border-right: none;
535
+ }
536
+
537
+ .chosen-rtl .chosen-search input[type="text"] {
538
+ padding: 4px 5px 4px 20px;
539
+ background: white url('../images/chosen-sprite.png') no-repeat -30px -20px;
540
+ background: url('../images/chosen-sprite.png') no-repeat -30px -20px;
541
+ direction: rtl;
542
+ }
543
+
544
+ .chosen-rtl.chosen-container-single .chosen-single div b {
545
+ background-position: 6px 2px;
546
+ }
547
+
548
+ .chosen-rtl.chosen-container-single.chosen-with-drop .chosen-single div b {
549
+ background-position: -12px 2px;
550
+ }
551
+
552
+ .jqte {
553
+ margin: 0;
554
+ border:#bbb 1px solid;
555
+ overflow:hidden;
556
+ }
557
+
558
+ .jqte * {
559
+ color:#333;
560
+ font-family:Arial, Helvetica, sans-serif;
561
+ font-size:14px;
562
+ }
563
+
564
+ .jqte_focused {
565
+ /*border-color:#00AAE7;
566
+ box-shadow:0 0 10px #00BDFF; -webkit-box-shadow:0 0 10px #00BDFF; -moz-box-shadow:0 0 10px #00BDFF;*/
567
+ }
568
+
569
+ .jqte_toolbar {
570
+ overflow:auto;
571
+ padding:3px 4px;
572
+ background:#EEE;
573
+ border-bottom:#BBB 1px solid;
574
+ }
575
+
576
+ .jqte_tool {
577
+ float:left;
578
+ margin:0;
579
+ padding:0;
580
+ cursor:pointer;
581
+ }
582
+
583
+ .jqte_tool, .jqte_tool_icon, .jqte_tool_label {
584
+ border:#EEE 1px solid;
585
+ border-radius:3px; -webkit-border-radius:3px; -moz-border-radius:3px
586
+ }
587
+
588
+ .jqte_hiddenField {
589
+ display:none
590
+ }
591
+
592
+ .jqte_tool_icon {
593
+ display:block;
594
+ width:22px;
595
+ height:22px;
596
+ background:url('../images/jquery-te.png') no-repeat
597
+ }
598
+
599
+ .jqte_tool.jqte_tool_1 .jqte_tool_label {
600
+ position:relative;
601
+ display:block;
602
+ padding:3px;
603
+ width:70px;
604
+ height:16px;
605
+ overflow:hidden;
606
+ }
607
+
608
+ .jqte_tool.jqte_tool_1 .jqte_tool_text {
609
+ font:bold 13px Arial,sans-serif;
610
+ color:#222;
611
+ }
612
+
613
+ .jqte_tool.jqte_tool_1 .jqte_tool_icon {
614
+ position:absolute;
615
+ top:10px;
616
+ right:2px;
617
+ width:6px;
618
+ height:4px;
619
+ background-position:-19px -23px;
620
+ border:none;
621
+ border-radius:none; -webkit-border-radius:none; -moz-border-radius:none
622
+ }
623
+
624
+ .jqte_tool.jqte_tool_2 .jqte_tool_icon {
625
+ background-position:0 0
626
+ }
627
+
628
+ .jqte_tool.jqte_tool_3 .jqte_tool_icon {
629
+ background-position:-22px 0
630
+ }
631
+
632
+ .jqte_tool.jqte_tool_4 .jqte_tool_icon {
633
+ background-position:-44px 0
634
+ }
635
+
636
+ .jqte_tool.jqte_tool_5 .jqte_tool_icon {
637
+ background-position:-66px 0
638
+ }
639
+
640
+ .jqte_tool.jqte_tool_6 .jqte_tool_icon {
641
+ background-position:-88px 0
642
+ }
643
+
644
+ .jqte_tool.jqte_tool_7 .jqte_tool_icon {
645
+ background-position:-110px 0
646
+ }
647
+
648
+ .jqte_tool.jqte_tool_8 .jqte_tool_icon {
649
+ background-position:-132px 0
650
+ }
651
+
652
+ .jqte_tool.jqte_tool_9 .jqte_tool_icon {
653
+ background-position:-154px 0
654
+ }
655
+
656
+ .jqte_tool.jqte_tool_10 .jqte_tool_icon {
657
+ background-position:-176px 0
658
+ }
659
+
660
+ .jqte_tool.jqte_tool_11 .jqte_tool_icon {
661
+ background-position:-198px 0
662
+ }
663
+
664
+ .jqte_tool.jqte_tool_12 .jqte_tool_icon {
665
+ background-position:-220px 0
666
+ }
667
+
668
+ .jqte_tool.jqte_tool_13 .jqte_tool_icon {
669
+ background-position:-242px 0
670
+ }
671
+
672
+ .jqte_tool.jqte_tool_14 .jqte_tool_icon {
673
+ background-position:-264px 0
674
+ }
675
+
676
+ .jqte_tool.jqte_tool_15 .jqte_tool_icon {
677
+ background-position:-286px 0
678
+ }
679
+
680
+ .jqte_tool.jqte_tool_16 .jqte_tool_icon {
681
+ background-position:-308px 0
682
+ }
683
+
684
+ .jqte_tool.jqte_tool_17 .jqte_tool_icon {
685
+ background-position:-330px 0
686
+ }
687
+
688
+ .jqte_tool.jqte_tool_18 .jqte_tool_icon {
689
+ background-position:-352px 0
690
+ }
691
+
692
+ .jqte_tool.jqte_tool_19 .jqte_tool_icon {
693
+ background-position:-374px 0
694
+ }
695
+
696
+ .jqte_tool.jqte_tool_20 .jqte_tool_icon {
697
+ background-position:-396px 0
698
+ }
699
+
700
+ .jqte_tool.jqte_tool_21 .jqte_tool_icon {
701
+ background-position:-418px 0
702
+ }
703
+
704
+ .jqte_tool:hover {
705
+ background-color:#FFF;
706
+ border-color:#FFF
707
+ }
708
+
709
+ .jqte_tool:hover .jqte_tool_icon, .jqte_tool:hover .jqte_tool_label {
710
+ border:#AAA 1px solid
711
+ }
712
+
713
+ .jqte_tool:active .jqte_tool_icon, .jqte_tool:active .jqte_tool_label {
714
+ border:#777 1px solid
715
+ }
716
+
717
+ .jqte_tool.jqte_tool_1:hover .jqte_tool_icon, .jqte_tool.jqte_tool_1:active .jqte_tool_icon {
718
+ border:none
719
+ }
720
+
721
+ .jqte_tool_depressed {
722
+ background-color:#DDD;
723
+ border-color:#CCC
724
+ }
725
+
726
+ .jqte_tool_depressed .jqte_tool_icon {
727
+ border-color:#AAA
728
+ }
729
+
730
+ .jqte_tool_depressed:hover {
731
+ background-color:#EEE
732
+ }
733
+
734
+ .jqte_linkform {
735
+ padding:5px 10px;
736
+ background:#DDD;
737
+ border-bottom:#BBB 1px solid;
738
+ }
739
+
740
+ .jqte_linktypeselect {
741
+ position:relative;
742
+ float:left;
743
+ width:130px;
744
+ background:#EEE;
745
+ cursor:pointer
746
+ }
747
+
748
+ .jqte_linktypeselect:Active {
749
+ background:#FFF
750
+ }
751
+
752
+ .jqte_linktypeview {
753
+ padding:3px 5px;
754
+ border:#333 1px solid;
755
+ color:#777;
756
+ border-radius:3px; -webkit-border-radius:3px; -moz-border-radius:3px;
757
+ outline:none
758
+ }
759
+
760
+ .jqte_linktypetext {
761
+ font-size:12px;
762
+ }
763
+
764
+ .jqte_linktypearrow {
765
+ position:absolute;
766
+ bottom:8px; right:6px;
767
+ width:7px;
768
+ height:6px;
769
+ margin:0 auto;
770
+ background:url('../images/jquery-te.png') -7px -23px no-repeat;
771
+ }
772
+
773
+ .jqte_linktypes {
774
+ display:none;
775
+ position:absolute;
776
+ top:22px; left:1px;
777
+ width:125px;
778
+ background:#FFF;
779
+ border:#333 1px solid;
780
+ box-shadow:0 1px 4px #AAA; -webkit-box-shadow:0 1px 4px #AAA; -moz-box-shadow:0 1px 4px #AAA
781
+ }
782
+
783
+ .jqte_linktypes a {
784
+ display:block;
785
+ padding:4px 5px;
786
+ font-size:12px;
787
+ }
788
+
789
+ .jqte_linktypes a:hover {
790
+ background:#DDD
791
+ }
792
+
793
+ .jqte_linkinput {
794
+ float:left;
795
+ margin:0 5px;
796
+ padding:3px 5px;
797
+ width:300px;
798
+ background:#EEE;
799
+ border:#333 1px solid;
800
+ color:#777;
801
+ font-size:12px;
802
+ border-radius:3px; -webkit-border-radius:3px; -moz-border-radius:3px;
803
+ outline:none;
804
+ }
805
+
806
+ .jqte_linkinput:focus, .jqte_linkinput:hover {
807
+ background:#FFF;
808
+ border-color:#000;
809
+ }
810
+
811
+ .jqte_linkbutton {
812
+ float:left;
813
+ padding:3px 12px;
814
+ background:#AAA;
815
+ border:#333 1px solid;
816
+ color:#FFF;
817
+ font-size:12px;
818
+ font-weight:bold;
819
+ cursor:pointer;
820
+ border-radius:3px; -webkit-border-radius:3px; -moz-border-radius:3px;
821
+ box-shadow:inset 0 1px #EEE; -webkit-box-shadow:inset 0 1px #EEE; -moz-box-shadow:inset 0 1px #EEE;
822
+ }
823
+
824
+ .jqte_linkbutton:hover {
825
+ background:#A1A1A1
826
+ }
827
+
828
+ .jqte_linkbutton:active {
829
+ box-shadow:inset 0 1px #CCC; -webkit-box-shadow:inset 0 1px #CCC; -moz-box-shadow:inset 0 1px #CCC;
830
+ background:#888;
831
+ }
832
+
833
+ .jqte_formats {
834
+ display:none;
835
+ position:absolute;
836
+ width:180px;
837
+ oveflow-x:hidden;
838
+ overflow-y:auto;
839
+ background:#FFF;
840
+ border:#AAA 1px solid;
841
+ box-shadow:0 0 5px #AAA; -webkit-box-shadow:0 0 5px #AAA; -moz-box-shadow:0 0 5px #AAA;
842
+ z-index:100;
843
+ }
844
+
845
+ .jqte_format {
846
+ display:block;
847
+ padding:4px 7px;
848
+ font-size:13px
849
+ }
850
+
851
+ .jqte_format:hover {
852
+ background:#DDD
853
+ }
854
+
855
+ .jqte_format_1, .jqte_format_2, .jqte_format_3, .jqte_format_4, .jqte_format_5, .jqte_format_6 {
856
+ font-weight:bold
857
+ }
858
+
859
+ .jqte_format_1 {
860
+ font-size:22px
861
+ }
862
+
863
+ .jqte_format_2 {
864
+ font-size:20px
865
+ }
866
+
867
+ .jqte_format_3 {
868
+ font-size:18px
869
+ }
870
+
871
+ .jqte_format_4 {
872
+ font-size:16px
873
+ }
874
+
875
+ .jqte_format_5 {
876
+ font-size:14px
877
+ }
878
+
879
+ .jqte_format_6 {
880
+ font-size:12px
881
+ }
882
+
883
+ .jqte_format_7 {
884
+ font-family:"Courier New", Courier, monospace
885
+ }
886
+
887
+ .jqte_fontsizes {
888
+ display:none;
889
+ position:absolute;
890
+ width:180px;
891
+ height:198px;
892
+ oveflow-x:hidden;
893
+ overflow-y:auto;
894
+ background:#FFF;
895
+ border:#AAA 1px solid;
896
+ box-shadow:0 0 5px #AAA; -webkit-box-shadow:0 0 5px #AAA; -moz-box-shadow:0 0 5px #AAA
897
+ }
898
+
899
+ .jqte_fontsize {
900
+ display:block;
901
+ padding:3px 7px;
902
+ }
903
+
904
+ .jqte_fontsize:hover {
905
+ background:#DDD
906
+ }
907
+
908
+ .jqte_cpalette {
909
+ display:none;
910
+ position:absolute;
911
+ padding:6px;
912
+ width:144px;
913
+ background:#FFF;
914
+ border:#AAA 1px solid;
915
+ box-shadow:0 0 5px #AAA; -webkit-box-shadow:0 0 5px #AAA; -moz-box-shadow:0 0 5px #AAA
916
+ }
917
+
918
+ .jqte_color {
919
+ display:block;
920
+ float:left;
921
+ width:16px;
922
+ height:16px;
923
+ border:#FFF 1px solid;
924
+ }
925
+
926
+ .jqte_color:hover {
927
+ border-color:#000
928
+ }
929
+
930
+ .jqte_colorSeperator {
931
+ float:none;
932
+ clear:both;
933
+ height:7px;
934
+ }
935
+
936
+ .jqte_editor, .jqte_source {
937
+ padding:10px;
938
+ background:#FFF;
939
+ min-height:100px;
940
+ max-height:900px;
941
+ overflow:auto;
942
+ outline:none;
943
+ word-wrap:break-word; -ms-word-wrap:break-word;
944
+ resize:vertical
945
+ }
946
+
947
+ .jqte_editor div, .jqte_editor p {
948
+ margin:0 0 7px
949
+ }
950
+
951
+ .jqte_editor a:link, .jqte_editor a:link * {
952
+ color:#0066FF !important;
953
+ text-decoration:underline;
954
+ }
955
+
956
+ .jqte_editor blockquote {
957
+ margin-top:0;
958
+ margin-bottom:7px
959
+ }
960
+
961
+ .jqte_editor img {
962
+ float:left;
963
+ margin:0 10px 5px 0
964
+ }
965
+
966
+ .jqte_editor a[jqte-setlink], .jqte_editor a[jqte-setlink] * {
967
+ background:#3297FD !important;
968
+ color:#FFF !important
969
+ }
970
+
971
+ .jqte_editor h1, .jqte_editor h2, .jqte_editor h3, .jqte_editor h4, .jqte_editor h5, .jqte_editor h6, .jqte_editor pre {
972
+ display:block;
973
+ margin:0 0 3px;
974
+ }
975
+
976
+ .jqte_editor h1, .jqte_editor h1 * {
977
+ font-size:26px
978
+ }
979
+
980
+ .jqte_editor h2, .jqte_editor h2 * {
981
+ font-size:24px
982
+ }
983
+
984
+ .jqte_editor h3, .jqte_editor h3 * {
985
+ font-size:22px
986
+ }
987
+
988
+ .jqte_editor h4, .jqte_editor h4 * {
989
+ font-size:20px
990
+ }
991
+
992
+ .jqte_editor h5, .jqte_editor h5 * {
993
+ font-size:18px
994
+ }
995
+
996
+ .jqte_editor h6, .jqte_editor h6 * {
997
+ font-size:15px
998
+ }
999
+
1000
+ .jqte_editor pre, .jqte_editor pre * {
1001
+ font-family:"Courier New", Courier, monospace
1002
+ }
1003
+
1004
+ .jqte_source, .jqte_source textarea {
1005
+ background:#FFF1E8
1006
+ }
1007
+
1008
+ .jqte_source textarea {
1009
+ margin:0 !important;
1010
+ padding:0 !important;
1011
+ display:block !important;
1012
+ width:100% !important;
1013
+ min-height:100px;
1014
+ font-family:Courier, Arial, sans-serif !important;
1015
+ font-weight:normal;
1016
+ font-size:15px;
1017
+ overflow:hidden !important;
1018
+ outline:none;
1019
+ resize:none;
1020
+ }
1021
+
1022
+ .jqte_source textarea, .jqte_source textarea:focus {
1023
+ css_shadow:none !important;
1024
+ background:none !important;
1025
+ border:none !important;
1026
+ }
1027
+
1028
+ .jqte_title {
1029
+ display:none;
1030
+ position:absolute;
1031
+ z-index:9999;
1032
+ }
1033
+
1034
+ .jqte_titleArrow {
1035
+ position:relative;
1036
+ }
1037
+
1038
+ .jqte_titleArrowIcon {
1039
+ width:7px;
1040
+ height:6px;
1041
+ margin:0 auto;
1042
+ background:url('../images/jquery-te.png') 0 -23px no-repeat;
1043
+ }
1044
+
1045
+ .jqte_titleText {
1046
+ padding:5px 7px;
1047
+ margin-top:0;
1048
+ min-width:5px;
1049
+ min-height:1px;
1050
+ max-width:400px;
1051
+ background:#000;
1052
+ border-radius:3px; -webkit-border-radius:3px; -moz-border-radius:3px;
1053
+ word-wrap:break-word; -ms-word-wrap:break-word
1054
+ }
1055
+
1056
+ .jqte_titleText, .jqte_titleText * {
1057
+ color:#FFF;
1058
+ font-size:11px
1059
+ }
1060
+
1061
+ .jqte_placeholder {
1062
+ position:relative;
1063
+ display:none;
1064
+ }
1065
+
1066
+ .jqte_placeholder_text {
1067
+ position:absolute;
1068
+ top:43px;
1069
+ left:10px;
1070
+ font-size:14px;
1071
+ color:#CCC;
1072
+ }
1073
+
1074
+ @media only screen and (-webkit-min-device-pixel-ratio: 1.5),
1075
+ only screen and (min-resolution: 144dpi),
1076
+ only screen and (min-resolution: 1.5dppx) {
1077
+ .chosen-rtl .chosen-search input[type="text"],
1078
+ .chosen-container-single .chosen-single abbr,
1079
+ .chosen-container-single .chosen-single div b,
1080
+ .chosen-container-single .chosen-search input[type="text"],
1081
+ .chosen-container-multi .chosen-choices .search-choice .search-choice-close,
1082
+ .chosen-container .chosen-results-scroll-down span,
1083
+ .chosen-container .chosen-results-scroll-up span {
1084
+ background-image: url('../images/chosen-sprite@2x.png') !important;
1085
+ background-size: 52px 37px !important;
1086
+ background-repeat: no-repeat !important;
1087
+ }
1088
+
1089
+ }
1090
+
1091
+ /* @end */
1092
+
1093
+ .minicolors {
1094
+ position: relative;
1095
+ }
1096
+
1097
+ .minicolors-sprite {
1098
+ background-image: url(../images/jquery.minicolors.png);
1099
+ }
1100
+
1101
+ .minicolors-swatch {
1102
+ position: absolute;
1103
+ vertical-align: middle;
1104
+ background-position: -80px 0;
1105
+ border: solid 1px #ccc;
1106
+ cursor: text;
1107
+ padding: 0;
1108
+ margin: 0;
1109
+ display: inline-block;
1110
+ }
1111
+
1112
+ .minicolors-swatch-color {
1113
+ position: absolute;
1114
+ top: 0;
1115
+ left: 0;
1116
+ right: 0;
1117
+ bottom: 0;
1118
+ }
1119
+
1120
+ .minicolors input[type=hidden] + .minicolors-swatch {
1121
+ width: 28px;
1122
+ position: static;
1123
+ cursor: pointer;
1124
+ }
1125
+
1126
+ .minicolors input[type=hidden][disabled] + .minicolors-swatch {
1127
+ cursor: default;
1128
+ }
1129
+
1130
+ /* Panel */
1131
+ .minicolors-panel {
1132
+ position: absolute;
1133
+ width: 173px;
1134
+ background: white;
1135
+ border: solid 1px #CCC;
1136
+ box-shadow: 0 0 20px rgba(0, 0, 0, .2);
1137
+ z-index: 99999;
1138
+ box-sizing: content-box;
1139
+ display: none;
1140
+ }
1141
+
1142
+ .minicolors-panel.minicolors-visible {
1143
+ display: block;
1144
+ }
1145
+
1146
+ /* Panel positioning */
1147
+ .minicolors-position-top .minicolors-panel {
1148
+ top: -154px;
1149
+ }
1150
+
1151
+ .minicolors-position-right .minicolors-panel {
1152
+ right: 0;
1153
+ }
1154
+
1155
+ .minicolors-position-bottom .minicolors-panel {
1156
+ top: 30px;
1157
+ }
1158
+
1159
+ .minicolors-position-left .minicolors-panel {
1160
+ left: 0;
1161
+ }
1162
+
1163
+ .minicolors-with-opacity .minicolors-panel {
1164
+ width: 194px;
1165
+ }
1166
+
1167
+ .minicolors .minicolors-grid {
1168
+ position: relative;
1169
+ top: 1px;
1170
+ left: 1px;
1171
+ width: 150px;
1172
+ height: 150px;
1173
+ background-position: -120px 0;
1174
+ cursor: crosshair;
1175
+ }
1176
+
1177
+ .minicolors .minicolors-grid-inner {
1178
+ position: absolute;
1179
+ top: 0;
1180
+ left: 0;
1181
+ width: 150px;
1182
+ height: 150px;
1183
+ }
1184
+
1185
+ .minicolors-slider-saturation .minicolors-grid {
1186
+ background-position: -420px 0;
1187
+ }
1188
+
1189
+ .minicolors-slider-saturation .minicolors-grid-inner {
1190
+ background-position: -270px 0;
1191
+ background-image: inherit;
1192
+ }
1193
+
1194
+ .minicolors-slider-brightness .minicolors-grid {
1195
+ background-position: -570px 0;
1196
+ }
1197
+
1198
+ .minicolors-slider-brightness .minicolors-grid-inner {
1199
+ background-color: black;
1200
+ }
1201
+
1202
+ .minicolors-slider-wheel .minicolors-grid {
1203
+ background-position: -720px 0;
1204
+ }
1205
+
1206
+ .minicolors-slider,
1207
+ .minicolors-opacity-slider {
1208
+ position: absolute;
1209
+ top: 1px;
1210
+ left: 152px;
1211
+ width: 20px;
1212
+ height: 150px;
1213
+ background-color: white;
1214
+ background-position: 0 0;
1215
+ cursor: row-resize;
1216
+ }
1217
+
1218
+ .minicolors-slider-saturation .minicolors-slider {
1219
+ background-position: -60px 0;
1220
+ }
1221
+
1222
+ .minicolors-slider-brightness .minicolors-slider {
1223
+ background-position: -20px 0;
1224
+ }
1225
+
1226
+ .minicolors-slider-wheel .minicolors-slider {
1227
+ background-position: -20px 0;
1228
+ }
1229
+
1230
+ .minicolors-opacity-slider {
1231
+ left: 173px;
1232
+ background-position: -40px 0;
1233
+ display: none;
1234
+ }
1235
+
1236
+ .minicolors-with-opacity .minicolors-opacity-slider {
1237
+ display: block;
1238
+ }
1239
+
1240
+ /* Pickers */
1241
+ .minicolors-grid .minicolors-picker {
1242
+ position: absolute;
1243
+ top: 70px;
1244
+ left: 70px;
1245
+ width: 12px;
1246
+ height: 12px;
1247
+ border: solid 1px black;
1248
+ border-radius: 10px;
1249
+ margin-top: -6px;
1250
+ margin-left: -6px;
1251
+ background: none;
1252
+ }
1253
+
1254
+ .minicolors-grid .minicolors-picker > div {
1255
+ position: absolute;
1256
+ top: 0;
1257
+ left: 0;
1258
+ width: 8px;
1259
+ height: 8px;
1260
+ border-radius: 8px;
1261
+ border: solid 2px white;
1262
+ box-sizing: content-box;
1263
+ }
1264
+
1265
+ .minicolors-picker {
1266
+ position: absolute;
1267
+ top: 0;
1268
+ left: 0;
1269
+ width: 18px;
1270
+ height: 2px;
1271
+ background: white;
1272
+ border: solid 1px black;
1273
+ margin-top: -2px;
1274
+ box-sizing: content-box;
1275
+ }
1276
+
1277
+ /* Swatches */
1278
+ .minicolors-swatches,
1279
+ .minicolors-swatches li {
1280
+ margin: 5px 0 3px 5px;
1281
+ padding: 0;
1282
+ list-style: none;
1283
+ overflow: hidden;
1284
+ }
1285
+
1286
+ .minicolors-swatches .minicolors-swatch {
1287
+ position: relative;
1288
+ float: left;
1289
+ cursor: pointer;
1290
+ margin:0 4px 0 0;
1291
+ }
1292
+
1293
+ .minicolors-with-opacity .minicolors-swatches .minicolors-swatch {
1294
+ margin-right: 7px;
1295
+ }
1296
+
1297
+ .minicolors-swatch.selected {
1298
+ border-color: #000;
1299
+ }
1300
+
1301
+ /* Inline controls */
1302
+ .minicolors-inline {
1303
+ display: inline-block;
1304
+ }
1305
+
1306
+ .minicolors-inline .minicolors-input {
1307
+ display: none !important;
1308
+ }
1309
+
1310
+ .minicolors-inline .minicolors-panel {
1311
+ position: relative;
1312
+ top: auto;
1313
+ left: auto;
1314
+ box-shadow: none;
1315
+ z-index: auto;
1316
+ display: inline-block;
1317
+ }
1318
+
1319
+ /* Default theme */
1320
+ .minicolors-theme-default .minicolors-swatch {
1321
+ top: 5px;
1322
+ left: 5px;
1323
+ width: 18px;
1324
+ height: 18px;
1325
+ }
1326
+ .minicolors-theme-default .minicolors-swatches .minicolors-swatch {
1327
+ margin-bottom: 2px;
1328
+ top: 0;
1329
+ left: 0;
1330
+ width: 18px;
1331
+ height: 18px;
1332
+ }
1333
+ .minicolors-theme-default.minicolors-position-right .minicolors-swatch {
1334
+ left: auto;
1335
+ right: 5px;
1336
+ }
1337
+ .minicolors-theme-default.minicolors {
1338
+ width: auto;
1339
+ display: inline-block;
1340
+ }
1341
+ .minicolors-theme-default .minicolors-input {
1342
+ height: 20px;
1343
+ width: auto;
1344
+ display: inline-block;
1345
+ padding-left: 26px;
1346
+ }
1347
+ .minicolors-theme-default.minicolors-position-right .minicolors-input {
1348
+ padding-right: 26px;
1349
+ padding-left: inherit;
1350
+ }
1351
+
1352
+ /* Bootstrap theme */
1353
+ .minicolors-theme-bootstrap .minicolors-swatch {
1354
+ z-index: 2;
1355
+ top: 3px;
1356
+ left: 3px;
1357
+ width: 28px;
1358
+ height: 28px;
1359
+ border-radius: 3px;
1360
+ }
1361
+ .minicolors-theme-bootstrap .minicolors-swatches .minicolors-swatch {
1362
+ margin-bottom: 2px;
1363
+ top: 0;
1364
+ left: 0;
1365
+ width: 20px;
1366
+ height: 20px;
1367
+ }
1368
+ .minicolors-theme-bootstrap .minicolors-swatch-color {
1369
+ border-radius: inherit;
1370
+ }
1371
+ .minicolors-theme-bootstrap.minicolors-position-right > .minicolors-swatch {
1372
+ left: auto;
1373
+ right: 3px;
1374
+ }
1375
+ .minicolors-theme-bootstrap .minicolors-input {
1376
+ float: none;
1377
+ padding-left: 44px;
1378
+ }
1379
+ .minicolors-theme-bootstrap.minicolors-position-right .minicolors-input {
1380
+ padding-right: 44px;
1381
+ padding-left: 12px;
1382
+ }
1383
+ .minicolors-theme-bootstrap .minicolors-input.input-lg + .minicolors-swatch {
1384
+ top: 4px;
1385
+ left: 4px;
1386
+ width: 37px;
1387
+ height: 37px;
1388
+ border-radius: 5px;
1389
+ }
1390
+ .minicolors-theme-bootstrap .minicolors-input.input-sm + .minicolors-swatch {
1391
+ width: 24px;
1392
+ height: 24px;
1393
+ }
1394
+ .minicolors-theme-bootstrap .minicolors-input.input-xs + .minicolors-swatch {
1395
+ width: 18px;
1396
+ height: 18px;
1397
+ }
1398
+ .input-group .minicolors-theme-bootstrap:not(:first-child) .minicolors-input {
1399
+ border-top-left-radius: 0;
1400
+ border-bottom-left-radius: 0;
1401
+ }
1402
+
1403
+ /* Semantic Ui theme */
1404
+ .minicolors-theme-semanticui .minicolors-swatch {
1405
+ top: 0;
1406
+ left: 0;
1407
+ padding: 18px;
1408
+ }
1409
+ .minicolors-theme-semanticui input {
1410
+ text-indent: 30px;
1411
+ }
css/insert-post.css ADDED
@@ -0,0 +1,559 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .insert-ads #wpInsertLogo img {
2
+ max-width: 100%;
3
+ }
4
+
5
+ .insert-ads .upgrade-notice {
6
+ background: #FFFFD1;
7
+ padding: 10px;
8
+ border: 1px dashed red;
9
+ text-align: center;
10
+ font-weight: bold;
11
+ }
12
+
13
+ .insert_ads_ajaxloader {
14
+ background: url(../images/ajax-loader.gif) no-repeat center center;
15
+ max-width: 320px;
16
+ min-width: 100px;
17
+ height: 100px;
18
+ margin: auto;
19
+ }
20
+ .insert_ads_ajaxloader_flat {
21
+ background: url(../images/ajax-loader-flat.gif) no-repeat center center;
22
+ max-width: 320px;
23
+ min-width: 100px;
24
+ height: 50px;
25
+ margin: auto;
26
+ }
27
+
28
+ .insert-ads .plugin-card {
29
+ background: #fafafa;
30
+ transition: height 0;
31
+ }
32
+
33
+ .insert-ads .plugin-card.vi-card {
34
+ position: relative;
35
+ }
36
+
37
+ .insert-ads .plugin-card .plugin-card-top {
38
+ background: #ffffff;
39
+ }
40
+
41
+ .insert-ads .plugin-card.vi-card .plugin-card-top {
42
+ padding-bottom: 100px;
43
+ }
44
+
45
+
46
+ .insert-ads .vi-card .plugin-card-bottom {
47
+ bottom: 0;
48
+ left: 0;
49
+ right: 0;
50
+ position: absolute;
51
+ }
52
+
53
+ .insert-ads .plugin-card-bottom .insert_ads_delete_icon {
54
+ color: #b20a0a;
55
+ cursor: pointer;
56
+ float: right;
57
+ }
58
+
59
+ .insert-ads .plugin-card-bottom .insert_ads_delete_icon:hover {
60
+ color: #FC0505;
61
+ }
62
+
63
+ .insert-ads .plugin-card-bottom p {
64
+ border-top: 1px solid #dedede;
65
+ margin: 0;
66
+ padding: 10px 5px;
67
+ }
68
+
69
+ .insert-ads .plugin-card-bottom p:first-child {
70
+ border-top: none;
71
+ }
72
+
73
+ .insert_ads_OR {
74
+ font-size: larger;
75
+ margin: 10px;
76
+ text-align: center;
77
+ }
78
+
79
+ .smartlogixSectionInner .insert_ads_generate_page_button {
80
+ border-radius: 7px;
81
+ display: block;
82
+ font-size: 18px;
83
+ height: auto;
84
+ margin: auto;
85
+ padding: 10px 18px;
86
+ text-transform: uppercase;
87
+ }
88
+
89
+ .insert_ads_rule_block {
90
+ width: calc(50% - 40px);
91
+ margin: 0 20px 5px;
92
+ float: left;
93
+ }
94
+
95
+ .insert_ads_rule_block .ui-button {
96
+ background: #6ddc5f !important;
97
+ border: 2px solid #000 !important;
98
+ color: #fff !important;
99
+ display: block;
100
+ font-weight: bold !important;
101
+ height: 30px;
102
+ margin: 15px auto 0;
103
+ text-shadow: 1px 1px 5px #000;
104
+ width: 80%;
105
+ }
106
+
107
+ .insert_ads_rule_block .ui-helper-hidden-accessible {
108
+ display: none;
109
+ }
110
+
111
+ .insert_ads_rule_block .ui-button.ui-state-active {
112
+ background: #C8161B !important;
113
+ }
114
+
115
+ .insert_ads_popup_content_wrapper .isSelectedIndicator {
116
+ width: 18px;
117
+ height: 18px;
118
+ display: inline-block;
119
+ background: #ddd;
120
+ border-radius: 12px;
121
+ float: left;
122
+ margin-right: 10px;
123
+ cursor: pointer;
124
+ position: relative;
125
+ }
126
+
127
+ .insert_ads_popup_content_wrapper .isSelectedIndicator:after {
128
+ content: '';
129
+ width: 8px;
130
+ height: 8px;
131
+ display: block;
132
+ position: absolute;
133
+ background: #ddd;
134
+ top: 5px;
135
+ left: 5px;
136
+ border-radius: 4px;
137
+
138
+ }
139
+
140
+ .insert_ads_popup_content_wrapper .isSelectedIndicator:before {
141
+ content: '';
142
+ width: 12px;
143
+ height: 12px;
144
+ display: block;
145
+ position: absolute;
146
+ background: #fff;
147
+ top: 3px;
148
+ left: 3px;
149
+ border-radius: 12px;
150
+ }
151
+
152
+ .insert_ads_popup_content_wrapper .isSelectedIndicator:hover, .insert_ads_popup_content_wrapper label:hover .isSelectedIndicator {
153
+ background: #4D3EDB;;
154
+ }
155
+
156
+ .insert_ads_popup_content_wrapper .isSelectedIndicator:hover:after, .insert_ads_popup_content_wrapper label:hover .isSelectedIndicator:after {
157
+ background: #4D3EDB;;
158
+ }
159
+
160
+ .insert_ads_popup_content_wrapper .isSelectedIndicator.active, .insert_ads_popup_content_wrapper .isSelectedIndicator.active:after {
161
+ background: #6ddc5f;
162
+ }
163
+
164
+ .insert_ads_popup_content_wrapper .isSelectedIndicator.active:hover, .insert_ads_popup_content_wrapper label:hover .isSelectedIndicator.active {
165
+ background: #6ddc5f;;
166
+ }
167
+
168
+ .insert_ads_popup_content_wrapper .isSelectedIndicator.disabled:before {
169
+ background: #ddd;
170
+ }
171
+
172
+ .insert_ads_popup_content_wrapper .isSelectedIndicator.disabled:hover, .insert_ads_popup_content_wrapper label:hover .isSelectedIndicator.disabled {
173
+ background: #ddd;
174
+ }
175
+
176
+ .insert_ads_popup_content_wrapper .isSelectedIndicator.disabled:hover:after, .insert_ads_popup_content_wrapper label:hover .isSelectedIndicator.disabled:after {
177
+ background: #ddd;
178
+ }
179
+
180
+ .codeSnippet code {
181
+ display: block;
182
+ font-size: 18px;
183
+ height: auto;
184
+ padding: 10px;
185
+ word-wrap: break-word;
186
+ }
187
+
188
+ .vi-card .plugin-card-top {
189
+ padding: 0;
190
+ }
191
+
192
+ .vi-card .plugin-card-top h4 {
193
+ color: #000;
194
+ font-size: 14px;
195
+ font-weight: 600;
196
+ line-height: 18px;
197
+ margin: 0;
198
+ }
199
+
200
+ .vi-card .plugin-card-top .plugin-card-top-header {
201
+ border-bottom: 1px solid #eee;
202
+ padding: 5px 10px;
203
+ }
204
+
205
+ .vi-card .plugin-card-top .plugin-card-top-content {
206
+ padding: 0 10px 5px;
207
+ font-family: arial;
208
+ font-size: 13px;
209
+ line-height: 18px;
210
+ color: #444444;
211
+ }
212
+
213
+ .vi-card .plugin-card-top .plugin-card-top-content p {
214
+ font-family: arial;
215
+ font-size: 13px;
216
+ line-height: 18px;
217
+ color: #444444;
218
+ }
219
+
220
+
221
+ .vi-card .plugin-card-top .plugin-card-top-content p.strong {
222
+ color: #000;
223
+ font-size: 15px;
224
+ }
225
+
226
+ .vi-card .plugin-card-top .plugin-card-top-content ul {
227
+ margin: 10px 0;
228
+ padding: 0 0 0 15px;
229
+ list-style-type: disc;
230
+ margin-left: 20px;
231
+ }
232
+
233
+ .vi-card .plugin-card-top .plugin-card-top-content ul li {
234
+ list-style: outside none "\2022";
235
+ margin: 0;
236
+ padding: 0 0 0 20px;
237
+ }
238
+
239
+ .vi-card .plugin-card-bottom {
240
+ text-align: right;
241
+ padding: 24px 20px;
242
+ }
243
+
244
+ .vi-card .plugin-card-bottom .button {
245
+ height: 32px;
246
+ line-height: 28px;
247
+ padding: 0 15px;
248
+ margin: 5px 0;
249
+ }
250
+
251
+ .vi-card .plugin-card-bottom .button#insert_ads_vi_signup {
252
+ margin: 5px 0 5px 15px;
253
+ }
254
+
255
+ .vi-card .plugin-card-bottom span {
256
+ display: inline;
257
+ float: left;
258
+ font-size: 13px;
259
+ text-align: left;
260
+ width: calc(100% - 200px);
261
+ font-family: arial;
262
+ line-height: 18px;
263
+ }
264
+
265
+ p.viError {
266
+ font-weight: bold;
267
+ color: #fd5740;
268
+ }
269
+
270
+ .vi-card #insert_ads_vi_earnings_wrapper {
271
+ margin-top: 50px;
272
+ }
273
+
274
+ .vi-card #insert_ads_vi_earnings_wrapper #insert_ads_vi_earnings {
275
+ float: left;
276
+ width: calc(100% - 348px);
277
+ margin-top: 38px;
278
+ min-width: 120px;
279
+ margin-bottom: 15px;
280
+ }
281
+
282
+ @media only screen and (max-width: 1256px) {
283
+ .vi-card #insert_ads_vi_earnings_wrapper {
284
+ margin-top: 0;
285
+ }
286
+
287
+ .vi-card #insert_ads_vi_earnings_wrapper #insert_ads_vi_earnings {
288
+ margin-top: 0;
289
+ }
290
+ }
291
+
292
+ .vi-card #insert_ads_vi_earnings_wrapper #insert_ads_vi_earnings #insert_ads_vi_earnings_label {
293
+ color: rgb(35, 40, 45);
294
+ display: block;
295
+ font-size: 14px;
296
+ line-height: 18px;
297
+ font-family: Arial;
298
+ }
299
+
300
+ .vi-card #insert_ads_vi_earnings_wrapper #insert_ads_vi_earnings #insert_ads_vi_earnings_value {
301
+ color: rgb(35, 40, 45);
302
+ display: block;
303
+ font-size: 32px;
304
+ font-weight: bold;
305
+ line-height: 44px;
306
+ font-family: Arial;
307
+ }
308
+
309
+ .vi-card #insert_ads_vi_earnings_wrapper #insert_ads_vi_chart_wrapper {
310
+ float: right;
311
+ height: 139px;
312
+ width: 348px;
313
+ max-width: 100%;
314
+ }
315
+
316
+ .vi-card #insert_ads_vi_earnings_wrapper #insert_ads_vi_chart_wrapper canvas {
317
+ border: 1px solid #ddd
318
+ }
319
+
320
+ .insert_ads_vi_login_error {
321
+ color: #ff0000;
322
+ font-size: 10px;
323
+ margin: -10px 0 0;
324
+ }
325
+
326
+ #insert_ads_vi_customize_adcode {
327
+ margin-left: 10px;
328
+ }
329
+
330
+ .insert_ads_popup_content_wrapper .insert_ads_vi_popup_right_column {
331
+ width: calc(50% - 30px);
332
+ float: right;
333
+ margin-top: 10px;
334
+ }
335
+
336
+ .insert_ads_popup_content_wrapper .insert_ads_vi_popup_left_column {
337
+ width: calc(50% - 30px);
338
+ float: left;
339
+ margin-top: 10px;
340
+ font-family: Arial;
341
+ font-size: 13px;
342
+ line-height: 18px;
343
+ }
344
+
345
+ .insert_ads_popup_content_wrapper .insert_ads_vi_popup_left_column p {
346
+ position: relative;
347
+ }
348
+
349
+ .insert_ads_popup_content_wrapper .insert_ads_vi_popup_left_column p label {
350
+ float: left;
351
+ display: inline-block;
352
+ width: 180px;
353
+ }
354
+
355
+ .insert_ads_popup_content_wrapper .insert_ads_vi_popup_left_column p br {
356
+ display: none;
357
+ }
358
+
359
+ .insert_ads_popup_content_wrapper .insert_ads_vi_popup_left_column p input,
360
+ .insert_ads_popup_content_wrapper .insert_ads_vi_popup_left_column p select,
361
+ .insert_ads_popup_content_wrapper .insert_ads_vi_popup_left_column p textarea {
362
+ float: right;
363
+ width: calc(100% - 210px);
364
+ display: inline-block;
365
+ clear: none;
366
+ margin-right: 20px;
367
+ }
368
+
369
+ .insert_ads_popup_content_wrapper .insert_ads_vi_popup_left_column p span.tooltipWrapper {
370
+ position: absolute;
371
+ display: inline-block;
372
+ background: #bababa;
373
+ width: 13px;
374
+ height: 13px;
375
+ border-radius: 7px;
376
+ right: 0;
377
+ top: 5px;
378
+ cursor: pointer;
379
+ }
380
+
381
+ .insert_ads_popup_content_wrapper .insert_ads_vi_popup_left_column p span.tooltipWrapper:after {
382
+ content: "i";
383
+ font-size: 10px;
384
+ font-weight: 600;
385
+ color: #fff;
386
+ line-height: 13px;
387
+ position: relative;
388
+ left: 0;
389
+ right: 0;
390
+ margin: 0 auto 0;
391
+ width: 13px;
392
+ height: 13px;
393
+ display: block;
394
+ text-align: center;
395
+ }
396
+
397
+ .insert_ads_popup_content_wrapper .insert_ads_vi_popup_left_column p span.tooltipWrapper:hover {
398
+ background: #000000;
399
+ }
400
+
401
+ .insert_ads_popup_content_wrapper .insert_ads_vi_popup_left_column p span.tooltipWrapper span.tooltip {
402
+ visibility: hidden;
403
+ width: 142px;
404
+ background-color: #363636;
405
+ color: #fff;
406
+ text-align: left;
407
+ padding: 5px;
408
+ border-radius: 4px;
409
+ position: absolute;
410
+ top: -10px;
411
+ left: 20px;
412
+ z-index: 1;
413
+ font-size: 9px;
414
+ }
415
+
416
+ .insert_ads_popup_content_wrapper .insert_ads_vi_popup_left_column p span.tooltipWrapper span.tooltip br {
417
+ display: block;
418
+ }
419
+
420
+ .insert_ads_popup_content_wrapper .insert_ads_vi_popup_left_column p span.tooltipWrapper:hover span.tooltip {
421
+ visibility: visible;
422
+ }
423
+
424
+ .insert_ads_popup_content_wrapper .insert_ads_vi_popup_left_column p span.tooltipWrapper span.tooltip::after {
425
+ /*content: " ";
426
+ position: absolute;
427
+ top: 50%;
428
+ right: 100%;
429
+ margin-top: -5px;
430
+ border-width: 5px;
431
+ border-style: solid;
432
+ border-color: transparent black transparent transparent;*/
433
+ }
434
+
435
+ .insert_ads_popup_content_wrapper .insert_ads_vi_popup_left_column .minicolors {
436
+ width: calc(100% - 190px);
437
+ float: right;
438
+ }
439
+
440
+ .insert_ads_popup_content_wrapper .insert_ads_vi_popup_left_column .minicolors input {
441
+ width: calc(100% - 20px);
442
+ height: 30px;
443
+ }
444
+
445
+ .insert_ads_popup_content_wrapper .insert_ads_vi_popup_left_column p small {
446
+ clear: both;
447
+ height: 1px;
448
+ width: 100%;
449
+ display: block;
450
+ }
451
+
452
+ .insert_ads_popup_content_wrapper .insert_ads_vi_popup_left_column p a.textTip {
453
+ position: absolute;
454
+ right: -92px;
455
+ top: 5px;
456
+ font-size: 11px;
457
+ display: block;
458
+ font-style: italic;
459
+ }
460
+
461
+ .insert_ads_popup_content_wrapper .insert_ads_vi_delay_notice {
462
+ float: right;
463
+ width: calc(100% - 190px);
464
+ display: inline-block;
465
+ clear: both;
466
+ margin: 0 20px 0 0;
467
+ color: #5f5f5f;
468
+ font-size: 13px;
469
+ font-style: italic;
470
+ }
471
+
472
+ .insert_ads_popup_content_wrapper .insert_ads_vi_code_data_wrapper {
473
+ line-height: 24px;
474
+ margin: 18px 0 20px;
475
+ }
476
+
477
+ .insert_ads_popup_content_wrapper .insert_ads_vi_code_data_wrapper label {
478
+ width: 144px;
479
+ display: block;
480
+ font-size: 12px;
481
+ font-family: Arial;
482
+ position: absolute;
483
+ color: #444444;
484
+ }
485
+
486
+ .insert_ads_popup_content_wrapper .insert_ads_vi_code_data_wrapper b {
487
+ margin-left: 164px;
488
+ display: block;
489
+ font-size: 13px;
490
+ font-family: Arial;
491
+ color: #444444;
492
+ }
493
+
494
+ @media screen and (max-width:768px) {
495
+ .insert_ads_rule_block {
496
+ width: auto;
497
+ float: none;
498
+ }
499
+ }
500
+
501
+
502
+ .vi-card .plugin-card-top .plugin-card-top-header {
503
+ border-bottom: 1px solid #eee;
504
+ padding: 15px 30px;
505
+ }
506
+ .vi-card .plugin-card-top .plugin-card-top-content{
507
+ padding: 0 30px 5px;
508
+ }
509
+ .vi-card .plugin-card-bottom {
510
+ text-align: right;
511
+ padding: 5px 30px;
512
+ }
513
+ .pl-right{
514
+ float:right;
515
+ }
516
+ .vi-card #insert_ads_vi_earnings_wrapper {
517
+ margin-top: 0;
518
+ }
519
+ .vi-card #insert_ads_vi_earnings_wrapper #insert_ads_vi_chart_wrapper canvas{
520
+ max-height:150px;
521
+ }
522
+ .insertpostads_page_insert-post-ads #poststuff .stuffbox>h3, .insertpostads_page_insert-post-ads #poststuff h2, .insertpostads_page_insert-post-ads #poststuff h3.hndle, .insertpostads_page_insert-post-ads #poststuff .inside{
523
+ padding: 15px 30px;
524
+ }
525
+ form > .postbox .inside, form > .postbox .inside > p:first-child{
526
+ margin-top:0;
527
+ }
528
+ .ins-settings{
529
+ float:left;
530
+ width:49%;
531
+ }
532
+ .vi-choose{
533
+ float:right;
534
+ width:49%;
535
+ }
536
+ .vi-choose .plugin-card{
537
+ width:100%;
538
+ margin:0;
539
+ border:0;
540
+ }
541
+ .vi-choose .plugin-card-bottom{
542
+ background-color:white;
543
+ border:0;
544
+ }
545
+ .vi-choose .plugin-card-bottom{
546
+ padding: 5px 30px;
547
+ padding-bottom: 14px;
548
+ }
549
+ .vi-ct{
550
+ float: left;
551
+ width: 49%;
552
+ }
553
+ .ins-settings input[type="submit"]{
554
+ position: absolute;
555
+ bottom: -50px;
556
+ }
557
+ .plugin-card.vi-card .plugin-card-bottom > span{
558
+ margin-top: 12px;
559
+ }
css/jquery.minicolors.css ADDED
@@ -0,0 +1,319 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .minicolors {
2
+ position: relative;
3
+ }
4
+
5
+ .minicolors-sprite {
6
+ background-image: url(jquery.minicolors.png);
7
+ }
8
+
9
+ .minicolors-swatch {
10
+ position: absolute;
11
+ vertical-align: middle;
12
+ background-position: -80px 0;
13
+ border: solid 1px #ccc;
14
+ cursor: text;
15
+ padding: 0;
16
+ margin: 0;
17
+ display: inline-block;
18
+ }
19
+
20
+ .minicolors-swatch-color {
21
+ position: absolute;
22
+ top: 0;
23
+ left: 0;
24
+ right: 0;
25
+ bottom: 0;
26
+ }
27
+
28
+ .minicolors input[type=hidden] + .minicolors-swatch {
29
+ width: 28px;
30
+ position: static;
31
+ cursor: pointer;
32
+ }
33
+
34
+ .minicolors input[type=hidden][disabled] + .minicolors-swatch {
35
+ cursor: default;
36
+ }
37
+
38
+ /* Panel */
39
+ .minicolors-panel {
40
+ position: absolute;
41
+ width: 173px;
42
+ background: white;
43
+ border: solid 1px #CCC;
44
+ box-shadow: 0 0 20px rgba(0, 0, 0, .2);
45
+ z-index: 99999;
46
+ box-sizing: content-box;
47
+ display: none;
48
+ }
49
+
50
+ .minicolors-panel.minicolors-visible {
51
+ display: block;
52
+ }
53
+
54
+ /* Panel positioning */
55
+ .minicolors-position-top .minicolors-panel {
56
+ top: -154px;
57
+ }
58
+
59
+ .minicolors-position-right .minicolors-panel {
60
+ right: 0;
61
+ }
62
+
63
+ .minicolors-position-bottom .minicolors-panel {
64
+ top: auto;
65
+ }
66
+
67
+ .minicolors-position-left .minicolors-panel {
68
+ left: 0;
69
+ }
70
+
71
+ .minicolors-with-opacity .minicolors-panel {
72
+ width: 194px;
73
+ }
74
+
75
+ .minicolors .minicolors-grid {
76
+ position: relative;
77
+ top: 1px;
78
+ left: 1px;
79
+ width: 150px;
80
+ height: 150px;
81
+ background-position: -120px 0;
82
+ cursor: crosshair;
83
+ }
84
+
85
+ .minicolors .minicolors-grid-inner {
86
+ position: absolute;
87
+ top: 0;
88
+ left: 0;
89
+ width: 150px;
90
+ height: 150px;
91
+ }
92
+
93
+ .minicolors-slider-saturation .minicolors-grid {
94
+ background-position: -420px 0;
95
+ }
96
+
97
+ .minicolors-slider-saturation .minicolors-grid-inner {
98
+ background-position: -270px 0;
99
+ background-image: inherit;
100
+ }
101
+
102
+ .minicolors-slider-brightness .minicolors-grid {
103
+ background-position: -570px 0;
104
+ }
105
+
106
+ .minicolors-slider-brightness .minicolors-grid-inner {
107
+ background-color: black;
108
+ }
109
+
110
+ .minicolors-slider-wheel .minicolors-grid {
111
+ background-position: -720px 0;
112
+ }
113
+
114
+ .minicolors-slider,
115
+ .minicolors-opacity-slider {
116
+ position: absolute;
117
+ top: 1px;
118
+ left: 152px;
119
+ width: 20px;
120
+ height: 150px;
121
+ background-color: white;
122
+ background-position: 0 0;
123
+ cursor: row-resize;
124
+ }
125
+
126
+ .minicolors-slider-saturation .minicolors-slider {
127
+ background-position: -60px 0;
128
+ }
129
+
130
+ .minicolors-slider-brightness .minicolors-slider {
131
+ background-position: -20px 0;
132
+ }
133
+
134
+ .minicolors-slider-wheel .minicolors-slider {
135
+ background-position: -20px 0;
136
+ }
137
+
138
+ .minicolors-opacity-slider {
139
+ left: 173px;
140
+ background-position: -40px 0;
141
+ display: none;
142
+ }
143
+
144
+ .minicolors-with-opacity .minicolors-opacity-slider {
145
+ display: block;
146
+ }
147
+
148
+ /* Pickers */
149
+ .minicolors-grid .minicolors-picker {
150
+ position: absolute;
151
+ top: 70px;
152
+ left: 70px;
153
+ width: 12px;
154
+ height: 12px;
155
+ border: solid 1px black;
156
+ border-radius: 10px;
157
+ margin-top: -6px;
158
+ margin-left: -6px;
159
+ background: none;
160
+ }
161
+
162
+ .minicolors-grid .minicolors-picker > div {
163
+ position: absolute;
164
+ top: 0;
165
+ left: 0;
166
+ width: 8px;
167
+ height: 8px;
168
+ border-radius: 8px;
169
+ border: solid 2px white;
170
+ box-sizing: content-box;
171
+ }
172
+
173
+ .minicolors-picker {
174
+ position: absolute;
175
+ top: 0;
176
+ left: 0;
177
+ width: 18px;
178
+ height: 2px;
179
+ background: white;
180
+ border: solid 1px black;
181
+ margin-top: -2px;
182
+ box-sizing: content-box;
183
+ }
184
+
185
+ /* Swatches */
186
+ .minicolors-swatches,
187
+ .minicolors-swatches li {
188
+ margin: 5px 0 3px 5px;
189
+ padding: 0;
190
+ list-style: none;
191
+ overflow: hidden;
192
+ }
193
+
194
+ .minicolors-swatches .minicolors-swatch {
195
+ position: relative;
196
+ float: left;
197
+ cursor: pointer;
198
+ margin:0 4px 0 0;
199
+ }
200
+
201
+ .minicolors-with-opacity .minicolors-swatches .minicolors-swatch {
202
+ margin-right: 7px;
203
+ }
204
+
205
+ .minicolors-swatch.selected {
206
+ border-color: #000;
207
+ }
208
+
209
+ /* Inline controls */
210
+ .minicolors-inline {
211
+ display: inline-block;
212
+ }
213
+
214
+ .minicolors-inline .minicolors-input {
215
+ display: none !important;
216
+ }
217
+
218
+ .minicolors-inline .minicolors-panel {
219
+ position: relative;
220
+ top: auto;
221
+ left: auto;
222
+ box-shadow: none;
223
+ z-index: auto;
224
+ display: inline-block;
225
+ }
226
+
227
+ /* Default theme */
228
+ .minicolors-theme-default .minicolors-swatch {
229
+ top: 5px;
230
+ left: 5px;
231
+ width: 18px;
232
+ height: 18px;
233
+ }
234
+ .minicolors-theme-default .minicolors-swatches .minicolors-swatch {
235
+ margin-bottom: 2px;
236
+ top: 0;
237
+ left: 0;
238
+ width: 18px;
239
+ height: 18px;
240
+ }
241
+ .minicolors-theme-default.minicolors-position-right .minicolors-swatch {
242
+ left: auto;
243
+ right: 5px;
244
+ }
245
+ .minicolors-theme-default.minicolors {
246
+ width: auto;
247
+ display: inline-block;
248
+ }
249
+ .minicolors-theme-default .minicolors-input {
250
+ height: 20px;
251
+ width: auto;
252
+ display: inline-block;
253
+ padding-left: 26px;
254
+ }
255
+ .minicolors-theme-default.minicolors-position-right .minicolors-input {
256
+ padding-right: 26px;
257
+ padding-left: inherit;
258
+ }
259
+
260
+ /* Bootstrap theme */
261
+ .minicolors-theme-bootstrap .minicolors-swatch {
262
+ z-index: 2;
263
+ top: 3px;
264
+ left: 3px;
265
+ width: 28px;
266
+ height: 28px;
267
+ border-radius: 3px;
268
+ }
269
+ .minicolors-theme-bootstrap .minicolors-swatches .minicolors-swatch {
270
+ margin-bottom: 2px;
271
+ top: 0;
272
+ left: 0;
273
+ width: 20px;
274
+ height: 20px;
275
+ }
276
+ .minicolors-theme-bootstrap .minicolors-swatch-color {
277
+ border-radius: inherit;
278
+ }
279
+ .minicolors-theme-bootstrap.minicolors-position-right > .minicolors-swatch {
280
+ left: auto;
281
+ right: 3px;
282
+ }
283
+ .minicolors-theme-bootstrap .minicolors-input {
284
+ float: none;
285
+ padding-left: 44px;
286
+ }
287
+ .minicolors-theme-bootstrap.minicolors-position-right .minicolors-input {
288
+ padding-right: 44px;
289
+ padding-left: 12px;
290
+ }
291
+ .minicolors-theme-bootstrap .minicolors-input.input-lg + .minicolors-swatch {
292
+ top: 4px;
293
+ left: 4px;
294
+ width: 37px;
295
+ height: 37px;
296
+ border-radius: 5px;
297
+ }
298
+ .minicolors-theme-bootstrap .minicolors-input.input-sm + .minicolors-swatch {
299
+ width: 24px;
300
+ height: 24px;
301
+ }
302
+ .minicolors-theme-bootstrap .minicolors-input.input-xs + .minicolors-swatch {
303
+ width: 18px;
304
+ height: 18px;
305
+ }
306
+ .input-group .minicolors-theme-bootstrap:not(:first-child) .minicolors-input {
307
+ border-top-left-radius: 0;
308
+ border-bottom-left-radius: 0;
309
+ }
310
+
311
+ /* Semantic Ui theme */
312
+ .minicolors-theme-semanticui .minicolors-swatch {
313
+ top: 0;
314
+ left: 0;
315
+ padding: 18px;
316
+ }
317
+ .minicolors-theme-semanticui input {
318
+ text-indent: 30px;
319
+ }
geotargeting.php ADDED
@@ -0,0 +1,363 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $wpInsertGeoLocation = false;
3
+ $wpInsertVIAdDisplayed = false;
4
+ /* Begin Generate Country List */
5
+ function insert_ads_get_countries() {
6
+ $data = array(
7
+ array('value' => 'AD', 'text' => 'Andorra'),
8
+ array('value' => 'AE', 'text' => 'United Arab Emirates'),
9
+ array('value' => 'AF', 'text' => 'Afghanistan'),
10
+ array('value' => 'AG', 'text' => 'Antigua and Barbuda'),
11
+ array('value' => 'AI', 'text' => 'Anguilla'),
12
+ array('value' => 'AL', 'text' => 'Albania'),
13
+ array('value' => 'AM', 'text' => 'Armenia'),
14
+ array('value' => 'AN', 'text' => 'Netherlands Antilles'),
15
+ array('value' => 'AO', 'text' => 'Angola'),
16
+ array('value' => 'AQ', 'text' => 'Antarctica'),
17
+ array('value' => 'AR', 'text' => 'Argentina'),
18
+ array('value' => 'AS', 'text' => 'American Samoa'),
19
+ array('value' => 'AT', 'text' => 'Austria'),
20
+ array('value' => 'AU', 'text' => 'Australia'),
21
+ array('value' => 'AW', 'text' => 'Aruba'),
22
+ array('value' => 'AZ', 'text' => 'Azerbaijan'),
23
+ array('value' => 'BA', 'text' => 'Bosnia and Herzegovina'),
24
+ array('value' => 'BB', 'text' => 'Barbados'),
25
+ array('value' => 'BD', 'text' => 'Bangladesh'),
26
+ array('value' => 'BE', 'text' => 'Belgium'),
27
+ array('value' => 'BF', 'text' => 'Burkina Faso'),
28
+ array('value' => 'BG', 'text' => 'Bulgaria'),
29
+ array('value' => 'BH', 'text' => 'Bahrain'),
30
+ array('value' => 'BI', 'text' => 'Burundi'),
31
+ array('value' => 'BJ', 'text' => 'Benin'),
32
+ array('value' => 'BM', 'text' => 'Bermuda'),
33
+ array('value' => 'BN', 'text' => 'Brunei Darussalam'),
34
+ array('value' => 'BO', 'text' => 'Bolivia'),
35
+ array('value' => 'BR', 'text' => 'Brazil'),
36
+ array('value' => 'BS', 'text' => 'Bahamas'),
37
+ array('value' => 'BT', 'text' => 'Bhutan'),
38
+ array('value' => 'BV', 'text' => 'Bouvet Island'),
39
+ array('value' => 'BW', 'text' => 'Botswana'),
40
+ array('value' => 'BY', 'text' => 'Belarus'),
41
+ array('value' => 'BZ', 'text' => 'Belize'),
42
+ array('value' => 'CA', 'text' => 'Canada'),
43
+ array('value' => 'CC', 'text' => 'Cocos (Keeling) Islands'),
44
+ array('value' => 'CD', 'text' => 'The Democratic Republic of the Congo'),
45
+ array('value' => 'CF', 'text' => 'Central African Republic'),
46
+ array('value' => 'CG', 'text' => 'Congo'),
47
+ array('value' => 'CH', 'text' => 'Switzerland'),
48
+ array('value' => 'CI', 'text' => 'Cote D\'Ivoire'),
49
+ array('value' => 'CK', 'text' => 'Cook Islands'),
50
+ array('value' => 'CL', 'text' => 'Chile'),
51
+ array('value' => 'CM', 'text' => 'Cameroon'),
52
+ array('value' => 'CN', 'text' => 'China'),
53
+ array('value' => 'CO', 'text' => 'Colombia'),
54
+ array('value' => 'CR', 'text' => 'Costa Rica'),
55
+ array('value' => 'CU', 'text' => 'Cuba'),
56
+ array('value' => 'CV', 'text' => 'Cape Verde'),
57
+ array('value' => 'CX', 'text' => 'Christmas Island'),
58
+ array('value' => 'CY', 'text' => 'Cyprus'),
59
+ array('value' => 'CZ', 'text' => 'Czech Republic'),
60
+ array('value' => 'DE', 'text' => 'Germany'),
61
+ array('value' => 'DJ', 'text' => 'Djibouti'),
62
+ array('value' => 'DK', 'text' => 'Denmark'),
63
+ array('value' => 'DM', 'text' => 'Dominica'),
64
+ array('value' => 'DO', 'text' => 'Dominican Republic'),
65
+ array('value' => 'DZ', 'text' => 'Algeria'),
66
+ array('value' => 'EC', 'text' => 'Ecuador'),
67
+ array('value' => 'EE', 'text' => 'Estonia'),
68
+ array('value' => 'EG', 'text' => 'Egypt'),
69
+ array('value' => 'EH', 'text' => 'Western Sahara'),
70
+ array('value' => 'ER', 'text' => 'Eritrea'),
71
+ array('value' => 'ES', 'text' => 'Spain'),
72
+ array('value' => 'ET', 'text' => 'Ethiopia'),
73
+ array('value' => 'FI', 'text' => 'Finland'),
74
+ array('value' => 'FJ', 'text' => 'Fiji'),
75
+ array('value' => 'FK', 'text' => 'Falkland Islands (Malvinas)'),
76
+ array('value' => 'FM', 'text' => 'Federated States of Micronesia'),
77
+ array('value' => 'FO', 'text' => 'Faroe Islands'),
78
+ array('value' => 'FR', 'text' => 'France'),
79
+ array('value' => 'FX', 'text' => 'France Metropolitan'),
80
+ array('value' => 'GA', 'text' => 'Gabon'),
81
+ array('value' => 'GB', 'text' => 'United Kingdom'),
82
+ array('value' => 'GD', 'text' => 'Grenada'),
83
+ array('value' => 'GE', 'text' => 'Georgia'),
84
+ array('value' => 'GF', 'text' => 'French Guiana'),
85
+ array('value' => 'GH', 'text' => 'Ghana'),
86
+ array('value' => 'GI', 'text' => 'Gibraltar'),
87
+ array('value' => 'GL', 'text' => 'Greenland'),
88
+ array('value' => 'GM', 'text' => 'Gambia'),
89
+ array('value' => 'GN', 'text' => 'Guinea'),
90
+ array('value' => 'GP', 'text' => 'Guadeloupe'),
91
+ array('value' => 'GQ', 'text' => 'Equatorial Guinea'),
92
+ array('value' => 'GR', 'text' => 'Greece'),
93
+ array('value' => 'GS', 'text' => 'South Georgia and the South Sandwich Islands'),
94
+ array('value' => 'GT', 'text' => 'Guatemala'),
95
+ array('value' => 'GU', 'text' => 'Guam'),
96
+ array('value' => 'GW', 'text' => 'Guinea-Bissau'),
97
+ array('value' => 'GY', 'text' => 'Guyana'),
98
+ array('value' => 'HK', 'text' => 'Hong Kong'),
99
+ array('value' => 'HM', 'text' => 'Heard Island and McDonald Islands'),
100
+ array('value' => 'HN', 'text' => 'Honduras'),
101
+ array('value' => 'HR', 'text' => 'Croatia'),
102
+ array('value' => 'HT', 'text' => 'Haiti'),
103
+ array('value' => 'HU', 'text' => 'Hungary'),
104
+ array('value' => 'ID', 'text' => 'Indonesia'),
105
+ array('value' => 'IE', 'text' => 'Ireland'),
106
+ array('value' => 'IL', 'text' => 'Israel'),
107
+ array('value' => 'IN', 'text' => 'India'),
108
+ array('value' => 'IO', 'text' => 'British Indian Ocean Territory'),
109
+ array('value' => 'IQ', 'text' => 'Iraq'),
110
+ array('value' => 'IR', 'text' => 'Islamic Republic of Iran'),
111
+ array('value' => 'IS', 'text' => 'Iceland'),
112
+ array('value' => 'IT', 'text' => 'Italy'),
113
+ array('value' => 'JM', 'text' => 'Jamaica'),
114
+ array('value' => 'JO', 'text' => 'Jordan'),
115
+ array('value' => 'JP', 'text' => 'Japan'),
116
+ array('value' => 'KE', 'text' => 'Kenya'),
117
+ array('value' => 'KG', 'text' => 'Kyrgyzstan'),
118
+ array('value' => 'KH', 'text' => 'Cambodia'),
119
+ array('value' => 'KI', 'text' => 'Kiribati'),
120
+ array('value' => 'KM', 'text' => 'Comoros'),
121
+ array('value' => 'KN', 'text' => 'Saint Kitts and Nevis'),
122
+ array('value' => 'KP', 'text' => 'Democratic People\'s Republic of Korea'),
123
+ array('value' => 'KR', 'text' => 'Republic of Korea'),
124
+ array('value' => 'KW', 'text' => 'Kuwait'),
125
+ array('value' => 'KY', 'text' => 'Cayman Islands'),
126
+ array('value' => 'KZ', 'text' => 'Kazakhstan'),
127
+ array('value' => 'LA', 'text' => 'Lao People\'s Democratic Republic'),
128
+ array('value' => 'LB', 'text' => 'Lebanon'),
129
+ array('value' => 'LC', 'text' => 'Saint Lucia'),
130
+ array('value' => 'LI', 'text' => 'Liechtenstein'),
131
+ array('value' => 'LK', 'text' => 'Sri Lanka'),
132
+ array('value' => 'LR', 'text' => 'Liberia'),
133
+ array('value' => 'LS', 'text' => 'Lesotho'),
134
+ array('value' => 'LT', 'text' => 'Lithuania'),
135
+ array('value' => 'LU', 'text' => 'Luxembourg'),
136
+ array('value' => 'LV', 'text' => 'Latvia'),
137
+ array('value' => 'LY', 'text' => 'Libyan Arab Jamahiriya'),
138
+ array('value' => 'MA', 'text' => 'Morocco'),
139
+ array('value' => 'MC', 'text' => 'Monaco'),
140
+ array('value' => 'MD', 'text' => 'Republic of Moldova'),
141
+ array('value' => 'MG', 'text' => 'Madagascar'),
142
+ array('value' => 'MH', 'text' => 'Marshall Islands'),
143
+ array('value' => 'MK', 'text' => 'Macedonia'),
144
+ array('value' => 'ML', 'text' => 'Mali'),
145
+ array('value' => 'MM', 'text' => 'Myanmar'),
146
+ array('value' => 'MN', 'text' => 'Mongolia'),
147
+ array('value' => 'MO', 'text' => 'Macau'),
148
+ array('value' => 'MP', 'text' => 'Northern Mariana Islands'),
149
+ array('value' => 'MQ', 'text' => 'Martinique'),
150
+ array('value' => 'MR', 'text' => 'Mauritania'),
151
+ array('value' => 'MS', 'text' => 'Montserrat'),
152
+ array('value' => 'MT', 'text' => 'Malta'),
153
+ array('value' => 'MU', 'text' => 'Mauritius'),
154
+ array('value' => 'MV', 'text' => 'Maldives'),
155
+ array('value' => 'MW', 'text' => 'Malawi'),
156
+ array('value' => 'MX', 'text' => 'Mexico'),
157
+ array('value' => 'MY', 'text' => 'Malaysia'),
158
+ array('value' => 'MZ', 'text' => 'Mozambique'),
159
+ array('value' => 'NA', 'text' => 'Namibia'),
160
+ array('value' => 'NC', 'text' => 'New Caledonia'),
161
+ array('value' => 'NE', 'text' => 'Niger'),
162
+ array('value' => 'NF', 'text' => 'Norfolk Island'),
163
+ array('value' => 'NG', 'text' => 'Nigeria'),
164
+ array('value' => 'NI', 'text' => 'Nicaragua'),
165
+ array('value' => 'NL', 'text' => 'Netherlands'),
166
+ array('value' => 'NO', 'text' => 'Norway'),
167
+ array('value' => 'NP', 'text' => 'Nepal'),
168
+ array('value' => 'NR', 'text' => 'Nauru'),
169
+ array('value' => 'NU', 'text' => 'Niue'),
170
+ array('value' => 'NZ', 'text' => 'New Zealand'),
171
+ array('value' => 'OM', 'text' => 'Oman'),
172
+ array('value' => 'PA', 'text' => 'Panama'),
173
+ array('value' => 'PE', 'text' => 'Peru'),
174
+ array('value' => 'PF', 'text' => 'French Polynesia'),
175
+ array('value' => 'PG', 'text' => 'Papua New Guinea'),
176
+ array('value' => 'PH', 'text' => 'Philippines'),
177
+ array('value' => 'PK', 'text' => 'Pakistan'),
178
+ array('value' => 'PL', 'text' => 'Poland'),
179
+ array('value' => 'PM', 'text' => 'Saint Pierre and Miquelon'),
180
+ array('value' => 'PN', 'text' => 'Pitcairn Islands'),
181
+ array('value' => 'PR', 'text' => 'Puerto Rico'),
182
+ array('value' => 'PS', 'text' => 'Palestinian Territory'),
183
+ array('value' => 'PT', 'text' => 'Portugal'),
184
+ array('value' => 'PW', 'text' => 'Palau'),
185
+ array('value' => 'PY', 'text' => 'Paraguay'),
186
+ array('value' => 'QA', 'text' => 'Qatar'),
187
+ array('value' => 'RE', 'text' => 'Reunion'),
188
+ array('value' => 'RO', 'text' => 'Romania'),
189
+ array('value' => 'RU', 'text' => 'Russian Federation'),
190
+ array('value' => 'RW', 'text' => 'Rwanda'),
191
+ array('value' => 'SA', 'text' => 'Saudi Arabia'),
192
+ array('value' => 'SB', 'text' => 'Solomon Islands'),
193
+ array('value' => 'SC', 'text' => 'Seychelles'),
194
+ array('value' => 'SD', 'text' => 'Sudan'),
195
+ array('value' => 'SE', 'text' => 'Sweden'),
196
+ array('value' => 'SG', 'text' => 'Singapore'),
197
+ array('value' => 'SH', 'text' => 'Saint Helena'),
198
+ array('value' => 'SI', 'text' => 'Slovenia'),
199
+ array('value' => 'SJ', 'text' => 'Svalbard and Jan Mayen'),
200
+ array('value' => 'SK', 'text' => 'Slovakia'),
201
+ array('value' => 'SL', 'text' => 'Sierra Leone'),
202
+ array('value' => 'SM', 'text' => 'San Marino'),
203
+ array('value' => 'SN', 'text' => 'Senegal'),
204
+ array('value' => 'SO', 'text' => 'Somalia'),
205
+ array('value' => 'SR', 'text' => 'Suriname'),
206
+ array('value' => 'ST', 'text' => 'Sao Tome and Principe'),
207
+ array('value' => 'SV', 'text' => 'El Salvador'),
208
+ array('value' => 'SY', 'text' => 'Syrian Arab Republic'),
209
+ array('value' => 'SZ', 'text' => 'Swaziland'),
210
+ array('value' => 'TC', 'text' => 'Turks and Caicos Islands'),
211
+ array('value' => 'TD', 'text' => 'Chad'),
212
+ array('value' => 'TF', 'text' => 'French Southern Territories'),
213
+ array('value' => 'TG', 'text' => 'Togo'),
214
+ array('value' => 'TH', 'text' => 'Thailand'),
215
+ array('value' => 'TJ', 'text' => 'Tajikistan'),
216
+ array('value' => 'TK', 'text' => 'Tokelau'),
217
+ array('value' => 'TM', 'text' => 'Turkmenistan'),
218
+ array('value' => 'TN', 'text' => 'Tunisia'),
219
+ array('value' => 'TO', 'text' => 'Tonga'),
220
+ array('value' => 'TL', 'text' => 'Timor-Leste'),
221
+ array('value' => 'TR', 'text' => 'Turkey'),
222
+ array('value' => 'TT', 'text' => 'Trinidad and Tobago'),
223
+ array('value' => 'TV', 'text' => 'Tuvalu'),
224
+ array('value' => 'TW', 'text' => 'Taiwan'),
225
+ array('value' => 'TZ', 'text' => 'United Republic of Tanzania'),
226
+ array('value' => 'UA', 'text' => 'Ukraine'),
227
+ array('value' => 'UG', 'text' => 'Uganda'),
228
+ array('value' => 'UM', 'text' => 'United States Minor Outlying Islands'),
229
+ array('value' => 'US', 'text' => 'United States'),
230
+ array('value' => 'UY', 'text' => 'Uruguay'),
231
+ array('value' => 'UZ', 'text' => 'Uzbekistan'),
232
+ array('value' => 'VA', 'text' => 'Holy See (Vatican City State)'),
233
+ array('value' => 'VC', 'text' => 'Saint Vincent and the Grenadines'),
234
+ array('value' => 'VE', 'text' => 'Venezuela'),
235
+ array('value' => 'VG', 'text' => 'British Virgin Islands'),
236
+ array('value' => 'VI', 'text' => 'U.S. Virgin Islands'),
237
+ array('value' => 'VN', 'text' => 'Vietnam'),
238
+ array('value' => 'VU', 'text' => 'Vanuatu'),
239
+ array('value' => 'WF', 'text' => 'Wallis and Futuna'),
240
+ array('value' => 'WS', 'text' => 'Samoa'),
241
+ array('value' => 'YE', 'text' => 'Yemen'),
242
+ array('value' => 'YT', 'text' => 'Mayotte'),
243
+ array('value' => 'RS', 'text' => 'Serbia'),
244
+ array('value' => 'ZA', 'text' => 'South Africa'),
245
+ array('value' => 'ZM', 'text' => 'Zambia'),
246
+ array('value' => 'ME', 'text' => 'Montenegro'),
247
+ array('value' => 'ZW', 'text' => 'Zimbabwe'),
248
+ array('value' => 'A1', 'text' => 'Anonymous Proxy'),
249
+ array('value' => 'A2', 'text' => 'Satellite Provider'),
250
+ array('value' => 'O1', 'text' => 'Other'),
251
+ array('value' => 'AX', 'text' => 'Aland Islands'),
252
+ array('value' => 'GG', 'text' => 'Guernsey'),
253
+ array('value' => 'IM', 'text' => 'Isle of Man'),
254
+ array('value' => 'JE', 'text' => 'Jersey'),
255
+ array('value' => 'BL', 'text' => 'Saint Barthelemy'),
256
+ array('value' => 'MF', 'text' => 'Saint Martin')
257
+ );
258
+ return $data;
259
+ }
260
+ /* End Generate Country List */
261
+
262
+ /* Begin Get Geo Targeted Ad Code */
263
+ function insert_ads_get_geotargeted_adcode($adOptions) {
264
+ global $wpInsertGeoLocation;
265
+ global $wpInsertABTestingMode;
266
+ global $wpInsertVIAdDisplayed;
267
+ if(($wpInsertGeoLocation != false) && ($wpInsertGeoLocation != '') && ((is_array($adOptions['geo_group1_countries']) && (count($adOptions['geo_group1_countries']) > 0)) || (is_array($adOptions['geo_group2_countries']) && (count($adOptions['geo_group1_countries']) > 0)))) {
268
+ if(($adOptions['geo_group1_adcode'] != '') && in_array($wpInsertGeoLocation, $adOptions['geo_group1_countries'])) {
269
+ return do_shortcode(stripslashes($adOptions['geo_group1_adcode']));
270
+ }
271
+ if(($adOptions['geo_group2_adcode'] != '') && in_array($wpInsertGeoLocation, $adOptions['geo_group2_countries'])) {
272
+ return do_shortcode(stripslashes($adOptions['geo_group2_adcode']));
273
+ }
274
+ }
275
+ switch($wpInsertABTestingMode) {
276
+ case 1:
277
+ if(isset($adOptions['primary_ad_code_type']) && ($adOptions['primary_ad_code_type'] == 'vicode')) {
278
+ if($wpInsertVIAdDisplayed !== true) {
279
+ $wpInsertVIAdDisplayed = true;
280
+ return '<div id="insert_ads_vi_ad">'.insert_ads_vi_api_get_vi_code('insert_ads_vi_code_settings').'</div>';
281
+ } else {
282
+ return '';
283
+ }
284
+ } else {
285
+ return do_shortcode(stripslashes($adOptions['primary_ad_code']));
286
+ }
287
+ case 2:
288
+ return do_shortcode(stripslashes($adOptions['secondary_ad_code']));
289
+ case 3:
290
+ return do_shortcode(stripslashes($adOptions['tertiary_ad_code']));
291
+ default:
292
+ return do_shortcode(stripslashes($adOptions['primary_ad_code']));
293
+ }
294
+ }
295
+
296
+ add_action('init', 'insert_ads_ip_to_country');
297
+ function insert_ads_ip_to_country() {
298
+ global $wpInsertGeoLocation;
299
+ $userIp = $_SERVER["REMOTE_ADDR"];
300
+ if($wpInsertGeoLocation != false) {
301
+ return $wpInsertGeoLocation;
302
+ } else {
303
+ $countryCode = get_transient('insert_ads_ip_'.$userIp);
304
+ if($countryCode === false) {
305
+ if(insert_ads_is_geoip_enabled()) {
306
+ try {
307
+ $response = wp_remote_get('http://freegeoip.net/json/'.$userIp, array('timeout' => 10));
308
+ if(!is_wp_error($response)) {
309
+ if(200 == wp_remote_retrieve_response_code($response)) {
310
+ $responseBody = json_decode($response['body']);
311
+ if((json_last_error() == JSON_ERROR_NONE) && isset($responseBody->country_code)) {
312
+ $wpInsertGeoLocation = $responseBody->country_code;
313
+ set_transient('insert_ads_ip_'.$userIp, $wpInsertGeoLocation, WEEK_IN_SECONDS);
314
+ }
315
+ } else { //Geoip service seems to have hit your hourly query limit, clear the request and cache for an hour it so that we dont slow down the website or overburden the service.
316
+ $wpInsertGeoLocation = '';
317
+ set_transient('insert_ads_ip_'.$userIp, $wpInsertGeoLocation, HOUR_IN_SECONDS);
318
+ }
319
+ } else { //Geoip service seems to be down, clear the request and cache it for a day so that we dont slow down the website or overburden the service.
320
+ $wpInsertGeoLocation = '';
321
+ set_transient('insert_ads_ip_'.$userIp, $wpInsertGeoLocation, DAY_IN_SECONDS);
322
+ }
323
+ } catch(Exception $ex) {
324
+ return '';
325
+ }
326
+ }
327
+ } else {
328
+ $wpInsertGeoLocation = $countryCode;
329
+ }
330
+ }
331
+ }
332
+
333
+ function insert_ads_is_geoip_enabled() {
334
+ $inpostads = get_option('insert_ads_inpostads');
335
+ if(isset($inpostads) && is_array($inpostads)) {
336
+ foreach($inpostads as $inpostad) {
337
+ if(isset($inpostad['geo_group1_countries']) && isset($inpostad['geo_group2_countries']) && ((is_array($inpostad['geo_group1_countries']) && (count($inpostad['geo_group1_countries']) > 0)) || (is_array($inpostad['geo_group2_countries']) && (count($inpostad['geo_group2_countries']) > 0)))) {
338
+ return true;
339
+ }
340
+ }
341
+ }
342
+
343
+ $adwidgets = get_option('insert_ads_adwidgets');
344
+ if(isset($adwidgets) && is_array($adwidgets)) {
345
+ foreach($adwidgets as $adwidget) {
346
+ if(isset($adwidget['geo_group1_countries']) && isset($adwidget['geo_group2_countries']) && ((is_array($adwidget['geo_group1_countries']) && (count($adwidget['geo_group1_countries']) > 0)) || (is_array($adwidget['geo_group2_countries']) && (count($adwidget['geo_group2_countries']) > 0)))) {
347
+ return true;
348
+ }
349
+ }
350
+ }
351
+
352
+ $inthemeads = get_option('insert_ads_inthemeads');
353
+ if(isset($inthemeads) && is_array($inthemeads)) {
354
+ foreach($inthemeads as $inthemead) {
355
+ if(isset($inthemead['geo_group1_countries']) && isset($inthemead['geo_group2_countries']) && ((is_array($inthemead['geo_group1_countries']) && (count($inthemead['geo_group1_countries']) > 0)) || (is_array($inthemead['geo_group2_countries']) && (count($inthemead['geo_group2_countries']) > 0)))) {
356
+ return true;
357
+ }
358
+ }
359
+ }
360
+ return false;
361
+ }
362
+ /* End Get Geo Targeted Ad Code */
363
+ ?>
images/adsense-logo.png ADDED
Binary file
images/advertisement-preview.png ADDED
Binary file
images/ajax-loader-flat.gif ADDED
Binary file
images/ajax-loader.gif ADDED
Binary file
images/chosen-sprite.png ADDED
Binary file
images/chosen-sprite@2x.png ADDED
Binary file
images/header-banner.png ADDED
Binary file
images/icon.png ADDED
Binary file
images/jquery-te.png ADDED
Binary file
images/jquery.minicolors.png ADDED
Binary file
images/vi-big-logo.png ADDED
Binary file
images/vi-empty-graph.jpg ADDED
Binary file
images/vi-logo-large.png ADDED
Binary file
images/vi-logo-small.png ADDED
Binary file
images/vi-logo-square.png ADDED
Binary file
images/vi-no-data.jpg ADDED
Binary file
inpostads.php ADDED
@@ -0,0 +1,576 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* Begin Add Card in Admin Panel */
3
+ add_action('insert_ads_plugin_card', 'insert_ads_inpostads_plugin_card', 10);
4
+ function insert_ads_inpostads_plugin_card() {
5
+ echo '<div class="plugin-card">';
6
+ echo '<h3 class="hndle">In-Post Ads</h3>';
7
+ echo '<div class="plugin-card-bottom">';
8
+ echo '<p><strong>Ads shown within the post content.</strong></p>';
9
+ echo '<div class="vi-ct"><p><a id="insert_ads_inpostads_above" href="javascript:;">Ad - Above Post Content</a></p>';
10
+ echo '<p><a id="insert_ads_inpostads_middle" href="javascript:;">Ad - Middle of Post Content</a></p>';
11
+ echo '<p><a id="insert_ads_inpostads_below" href="javascript:;">Ad - Below Post Content</a></p></div>';
12
+ echo '<div class="vi-ct"><p><a id="insert_ads_inpostads_left" href="javascript:;">Ad - Left of Post Content</a></p>';
13
+ echo '<p><a id="insert_ads_inpostads_right" href="javascript:;">Ad - Right of Post Content</a></p></div>';
14
+ echo '</div>';
15
+ echo '</div>';
16
+ echo '<input type="hidden" id="insert_ads_admin_ajax" name="insert_ads_admin_ajax" value="' . admin_url('admin-ajax.php') . '" /><input type="hidden" id="insert_ads_nonce" name="insert_ads_nonce" value="' . wp_create_nonce('insert-ads') . '" />';
17
+ }
18
+ /* End Add Card in Admin Panel */
19
+
20
+ /* Begin Ad Above Post Content */
21
+ add_action('wp_ajax_insert_ads_inpostads_above_form_get_content', 'insert_ads_inpostads_above_form_get_content');
22
+ function insert_ads_inpostads_above_form_get_content() {
23
+ check_ajax_referer('insert-ads', 'insert_ads_nonce');
24
+ insert_ads_inpostads_form_get_content('above');
25
+ die();
26
+ }
27
+
28
+ add_action('wp_ajax_insert_ads_inpostads_above_form_save_action', 'insert_ads_inpostads_above_form_save_action');
29
+ function insert_ads_inpostads_above_form_save_action() {
30
+ check_ajax_referer('insert-ads', 'insert_ads_nonce');
31
+ insert_ads_inpostads_form_save_action('above');
32
+ die();
33
+ }
34
+ /* End Ad Above Post Content */
35
+
36
+ /* Begin Ad Middle Post Content */
37
+ add_action('wp_ajax_insert_ads_inpostads_middle_form_get_content', 'insert_ads_inpostads_middle_form_get_content');
38
+ function insert_ads_inpostads_middle_form_get_content() {
39
+ check_ajax_referer('insert-ads', 'insert_ads_nonce');
40
+ insert_ads_inpostads_form_get_content('middle');
41
+ die();
42
+ }
43
+
44
+ add_action('wp_ajax_insert_ads_inpostads_middle_form_save_action', 'insert_ads_inpostads_middle_form_save_action');
45
+ function insert_ads_inpostads_middle_form_save_action() {
46
+ check_ajax_referer('insert-ads', 'insert_ads_nonce');
47
+ insert_ads_inpostads_form_save_action('middle');
48
+ die();
49
+ }
50
+ /* End Ad Middle Post Content */
51
+
52
+ /* Begin Ad Below Post Content */
53
+ add_action('wp_ajax_insert_ads_inpostads_below_form_get_content', 'insert_ads_inpostads_below_form_get_content');
54
+ function insert_ads_inpostads_below_form_get_content() {
55
+ check_ajax_referer('insert-ads', 'insert_ads_nonce');
56
+ insert_ads_inpostads_form_get_content('below');
57
+ die();
58
+ }
59
+
60
+ add_action('wp_ajax_insert_ads_inpostads_below_form_save_action', 'insert_ads_inpostads_below_form_save_action');
61
+ function insert_ads_inpostads_below_form_save_action() {
62
+ check_ajax_referer('insert-ads', 'insert_ads_nonce');
63
+ insert_ads_inpostads_form_save_action('below');
64
+ die();
65
+ }
66
+ /* End Ad Below Post Content */
67
+
68
+ /* Begin Ad Left Post Content */
69
+ add_action('wp_ajax_insert_ads_inpostads_left_form_get_content', 'insert_ads_inpostads_left_form_get_content');
70
+ function insert_ads_inpostads_left_form_get_content() {
71
+ check_ajax_referer('insert-ads', 'insert_ads_nonce');
72
+ insert_ads_inpostads_form_get_content('left');
73
+ die();
74
+ }
75
+
76
+ add_action('wp_ajax_insert_ads_inpostads_left_form_save_action', 'insert_ads_inpostads_left_form_save_action');
77
+ function insert_ads_inpostads_left_form_save_action() {
78
+ check_ajax_referer('insert-ads', 'insert_ads_nonce');
79
+ insert_ads_inpostads_form_save_action('left');
80
+ die();
81
+ }
82
+ /* End Ad Left Post Content */
83
+
84
+ /* Begin Ad Right Post Content */
85
+ add_action('wp_ajax_insert_ads_inpostads_right_form_get_content', 'insert_ads_inpostads_right_form_get_content');
86
+ function insert_ads_inpostads_right_form_get_content() {
87
+ check_ajax_referer('insert-ads', 'insert_ads_nonce');
88
+ insert_ads_inpostads_form_get_content('right');
89
+ die();
90
+ }
91
+
92
+ add_action('wp_ajax_insert_ads_inpostads_right_form_save_action', 'insert_ads_inpostads_right_form_save_action');
93
+ function insert_ads_inpostads_right_form_save_action() {
94
+ check_ajax_referer('insert-ads', 'insert_ads_nonce');
95
+ insert_ads_inpostads_form_save_action('right');
96
+ die();
97
+ }
98
+ /* End Ad Right Post Content */
99
+
100
+
101
+
102
+
103
+
104
+ /* Begin Shared UI Functions */
105
+ function insert_ads_inpostads_form_get_content($position) {
106
+ $inpostads = get_option('insert_ads_inpostads');
107
+ echo '<div class="insert_ads_popup_content_wrapper">';
108
+ $posts_per_page = get_option('posts_per_page');
109
+ $instances = array();
110
+ for($i = 1; $i <= $posts_per_page; $i++) {
111
+ $instances[] = array('text' => 'Hide on '.insert_ads_add_ordinal_number_suffix($i).' Post', 'value' => $i);
112
+ }
113
+ $control = new smartlogix(array('optionIdentifier' => 'insert_ads_inpostads['.$position.']', 'values' => $inpostads[$position]));
114
+ $control->add_control(array('type' => 'ipCheckbox', 'optionName' => 'status'));
115
+ echo '<div id="insert_ads_inpostads_'.$position.'_accordion">';
116
+ echo '<h3>Ad Code</h3>';
117
+ echo '<div>';
118
+ $abtestingMode = get_option('insert_ads_abtesting_mode');
119
+
120
+ if($position == 'above' || $position == 'middle') {
121
+ $adTypes = array(
122
+ array('text' => 'Use Generic / Custom Ad Code', 'value' => 'generic'),
123
+ array('text' => 'vi stories', 'value' => 'vicode'),
124
+ );
125
+ $control->add_control(array('type' => 'select', 'label' => 'Ad Type', 'optionName' => 'primary_ad_code_type', 'options' => $adTypes));
126
+ echo $control->HTML;
127
+ $control->clear_controls();
128
+
129
+ $control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'primary_ad_code'));
130
+ $control->create_section('<span id="primary_ad_code_type_generic" class="isSelectedIndicator"></span>Generic / Custom Ad Code (Primary Network)');
131
+ $control->set_HTML('<div class="insert_ads_rule_block">'.$control->HTML.'</div>');
132
+ echo $control->HTML;
133
+ $control->clear_controls();
134
+
135
+ $IsVILoggedin = insert_ads_vi_api_is_loggedin();
136
+ $isJSTagGenerated = ((insert_ads_vi_api_get_vi_code() === false)?false:true);
137
+ $isVIDisabled = false;
138
+ $viMessage = '';
139
+ if(!$IsVILoggedin && !$isJSTagGenerated) {
140
+ $isVIDisabled = true;
141
+ $viMessage = '<p>Introducing <b>vi stories</b> – the video content and advertising player.</p>';
142
+ $viMessage .= '<p>Before you can use <b>vi stories</b>, you must configure it. Once you’ve signed up, in the <i>video intelligence</i> panel, click <i>Sign in</i> then click <i>Configure</i></p>';
143
+ } else if($IsVILoggedin && !$isJSTagGenerated) {
144
+ $isVIDisabled = true;
145
+ $viMessage .= '<p>Before you can use <b>vi stories</b>, you must configure it. In the <i>video intelligence</i> panel, click <i>Configure</i></p>';
146
+ //$viMessage .= '<p><a id="insert_ads_inpostads_vi_customize_adcode" href="javascript:;" class="button button-primary aligncenter">Configure vi Code</a></p>'; /*Button being temporarily removed to avoid confusion for users*/
147
+ } else if(!$IsVILoggedin && $isJSTagGenerated) {
148
+ $isVIDisabled = false;
149
+ $viMessage = '<p>Before you can use <b>vi stories</b>, you must configure it. Once you’ve signed up, in the <i>video intelligence</i> panel, click <i>Sign in</i> then click <i>Configure</i></p>';
150
+ } else {
151
+ $isVIDisabled = false;
152
+ $viMessage = insert_ads_vi_customize_adcode_get_settings();
153
+ $viMessage .= '<p>To configure <b>vi stories</b>, go to the <i>video intelligence</i> panel, click <i>Configure</i></p>';
154
+ //$viMessage .= '<p><a id="insert_ads_inpostads_vi_customize_adcode" href="javascript:;" class="button button-primary aligncenter">Configure vi Code</a></p>'; /*Button being temporarily removed to avoid confusion for users*/
155
+ }
156
+
157
+ $control->HTML .= $viMessage;
158
+ $control->create_section('<span id="primary_ad_code_type_vicode" class="isSelectedIndicator '.(($isVIDisabled)?'disabled':'').'"></span>vi stories (Primary Network)');
159
+ $control->set_HTML('<div class="insert_ads_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
160
+ echo $control->HTML;
161
+ $control->clear_controls();
162
+ } else {
163
+ $control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'primary_ad_code'));
164
+ $control->create_section('Ad Code (Primary Network)');
165
+ echo $control->HTML;
166
+ $control->clear_controls();
167
+ }
168
+
169
+ $control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'secondary_ad_code'));
170
+ $control->create_section('Ad Code (Secondary Network)');
171
+ if($abtestingMode != '2' && $abtestingMode != '3') {
172
+ $control->set_HTML('<div style="display: none;">'.$control->HTML.'</div>');
173
+ }
174
+ echo $control->HTML;
175
+ $control->clear_controls();
176
+
177
+ $control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'tertiary_ad_code'));
178
+ $control->create_section('Ad Code (Tertiary Network)');
179
+ if($abtestingMode != '3') {
180
+ $control->set_HTML('<div style="display: none;">'.$control->HTML.'</div>');
181
+ }
182
+ echo $control->HTML;
183
+ $control->clear_controls();
184
+ echo '</div>';
185
+ echo '<h3>Rules</h3>';
186
+ echo '<div>';
187
+ $control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_loggedin'));
188
+ $control->create_section('Logged in Users');
189
+ $control->set_HTML('<div class="insert_ads_rule_block">'.$control->HTML.'</div>');
190
+ echo $control->HTML;
191
+ $control->clear_controls();
192
+
193
+ $control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_mobile_devices'));
194
+ $control->create_section('Mobile Devices');
195
+ $control->set_HTML('<div class="insert_ads_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
196
+ echo $control->HTML;
197
+ $control->clear_controls();
198
+
199
+ $control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_404'));
200
+ $control->create_section('404 Pages');
201
+ $control->set_HTML('<div class="insert_ads_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
202
+ echo $control->HTML;
203
+ $control->clear_controls();
204
+
205
+ $control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_home'));
206
+ $control->add_control(array('type' => 'choosen-multiselect', 'label' => 'Instances', 'optionName' => 'rules_home_instances', 'options' => $instances));
207
+ $control->create_section('Home');
208
+ $control->set_HTML('<div class="insert_ads_rule_block">'.$control->HTML.'</div>');
209
+ echo $control->HTML;
210
+ $control->clear_controls();
211
+
212
+ $control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_archives'));
213
+ $control->add_control(array('type' => 'choosen-multiselect', 'label' => 'Instances', 'optionName' => 'rules_archives_instances', 'options' => $instances));
214
+ $control->create_section('Archives');
215
+ $control->set_HTML('<div class="insert_ads_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
216
+ echo $control->HTML;
217
+ $control->clear_controls();
218
+
219
+ $control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_search'));
220
+ $control->add_control(array('type' => 'choosen-multiselect', 'label' => 'Instances', 'optionName' => 'rules_search_instances', 'options' => $instances));
221
+ $control->create_section('Search Results');
222
+ $control->set_HTML('<div class="insert_ads_rule_block">'.$control->HTML.'</div>');
223
+ echo $control->HTML;
224
+ $control->clear_controls();
225
+
226
+ $control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_page'));
227
+ $control->add_control(array('type' => 'pages-chosen-multiselect', 'label' => 'Exceptions', 'optionName' => 'rules_page_exceptions'));
228
+ $control->create_section('Single Pages');
229
+ $control->set_HTML('<div class="insert_ads_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
230
+ echo $control->HTML;
231
+ $control->clear_controls();
232
+
233
+ $control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_post'));
234
+ $control->add_control(array('type' => 'posts-chosen-multiselect', 'label' => 'Exceptions', 'optionName' => 'rules_post_exceptions'));
235
+ $control->add_control(array('type' => 'categories-chosen-multiselect', 'label' => 'Category Exceptions', 'optionName' => 'rules_post_categories_exceptions'));
236
+ $control->create_section('Single Posts');
237
+ $control->set_HTML('<div class="insert_ads_rule_block">'.$control->HTML.'</div>');
238
+ echo $control->HTML;
239
+ $control->clear_controls();
240
+
241
+ $control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_categories'));
242
+ $control->add_control(array('type' => 'choosen-multiselect', 'label' => 'Instances', 'optionName' => 'rules_categories_instances', 'options' => $instances));
243
+ $control->add_control(array('type' => 'categories-chosen-multiselect', 'label' => 'Exceptions', 'optionName' => 'rules_categories_exceptions'));
244
+ $control->create_section('Category Archives');
245
+ $control->set_HTML('<div class="insert_ads_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
246
+ echo $control->HTML;
247
+ $control->clear_controls();
248
+
249
+ echo '</div>';
250
+ echo '<h3>Geo Targeting</h3>';
251
+ echo '<div>';
252
+ echo '<p>';
253
+ echo 'A Geo Targeted Ads have a higher priority than Ads configured via Multiple Ad Networks / A-B Testing.<br />';
254
+ echo 'If a Geo Targeting match is found all other Ads (Primary, Secondary and Tertiary Networks) will be ignored.<br />';
255
+ echo '</p>';
256
+ $control->add_control(array('type' => 'choosen-multiselect', 'label' => 'Countries', 'optionName' => 'geo_group1_countries', 'options' => insert_ads_get_countries()));
257
+ $control->add_control(array('type' => 'textarea', 'label' => 'Ad Code', 'style' => 'height: 220px;', 'optionName' => 'geo_group1_adcode'));
258
+ $control->create_section('Group 1');
259
+ $control->set_HTML('<div class="insert_ads_rule_block">'.$control->HTML.'</div>');
260
+ echo $control->HTML;
261
+ $control->clear_controls();
262
+
263
+ $control->add_control(array('type' => 'choosen-multiselect', 'label' => 'Countries', 'optionName' => 'geo_group2_countries', 'options' => insert_ads_get_countries()));
264
+ $control->add_control(array('type' => 'textarea', 'label' => 'Ad Code', 'style' => 'height: 220px;', 'optionName' => 'geo_group2_adcode'));
265
+ $control->create_section('Group 2');
266
+ $control->set_HTML('<div class="insert_ads_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
267
+ echo $control->HTML;
268
+ $control->clear_controls();
269
+ echo '<p>';
270
+ echo 'This feature uses the Free Geo ip service from <a href="http://freegeoip.net/">freegeoip.net</a>, if you find this feature useful please consider donating to the project at <a href="http://freegeoip.net/">freegeoip.net</a>';
271
+ echo '</p>';
272
+ echo '</div>';
273
+ echo '<h3>Styles</h3>';
274
+ echo '<div>';
275
+ $control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'styles'));
276
+ $control->create_section('Styles');
277
+ echo $control->HTML;
278
+ $control->clear_controls();
279
+ echo '</div>';
280
+ echo '<h3>Notes</h3>';
281
+ echo '<div>';
282
+ $control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'notes'));
283
+ $control->create_section('Notes');
284
+ echo $control->HTML;
285
+ $control->clear_controls();
286
+ echo '</div>';
287
+ if($position == 'middle') {
288
+ echo '<h3>Positioning</h3>';
289
+ echo '<div>';
290
+ $control->add_control(array('type' => 'text', 'label' => 'Minimum Character Count', 'optionName' => 'minimum_character_count', 'helpText' => 'Show the ad only if the Content meets the minimum character count. If this parameter is set to 0 (or empty) minimum character count check will be deactivated.'));
291
+ $control->add_control(array('type' => 'text', 'label' => 'Paragraph Buffer Count', 'optionName' => 'paragraph_buffer_count', 'helpText' => 'Shows the ad after X number of Paragraphs. If this parameter is set to 0 (or empty) the ad will appear in the middle of the content.'));
292
+ $control->create_section('Positioning');
293
+ echo $control->HTML;
294
+ $control->clear_controls();
295
+ echo '</div>';
296
+ }
297
+ echo '</div>';
298
+ echo '<script type="text/javascript">';
299
+ echo $control->JS;
300
+ echo 'jQuery("#insert_ads_inpostads_'.$position.'_accordion").accordion({ icons: { header: "ui-icon-circle-arrow-e", activeHeader: "ui-icon-circle-arrow-s" }, heightStyle: "auto" });';
301
+ echo 'primary_ad_code_type_change();';
302
+ echo 'insert_ads_inpostads_vi_customize_adcode();';
303
+ echo '</script>';
304
+ echo '</div>';
305
+ }
306
+
307
+ function insert_ads_inpostads_form_save_action($position) {
308
+ $inpostAds = get_option('insert_ads_inpostads');
309
+ $inpostAds[$position]['status'] = ((isset($_POST['insert_ads_inpostads_'.$position.'_status']) && ($_POST['insert_ads_inpostads_'.$position.'_status'] == 'true'))?'1':'');
310
+
311
+ if($position == 'above' || $position == 'middle') {
312
+ $inpostAds[$position]['primary_ad_code_type'] = ((isset($_POST['insert_ads_inpostads_'.$position.'_primary_ad_code_type']))?$_POST['insert_ads_inpostads_'.$position.'_primary_ad_code_type']:'');
313
+ }
314
+ $inpostAds[$position]['primary_ad_code'] = ((isset($_POST['insert_ads_inpostads_'.$position.'_primary_ad_code']))?$_POST['insert_ads_inpostads_'.$position.'_primary_ad_code']:'');
315
+ $inpostAds[$position]['secondary_ad_code'] = ((isset($_POST['insert_ads_inpostads_'.$position.'_secondary_ad_code']))?$_POST['insert_ads_inpostads_'.$position.'_secondary_ad_code']:'');
316
+ $inpostAds[$position]['tertiary_ad_code'] = ((isset($_POST['insert_ads_inpostads_'.$position.'_tertiary_ad_code']))?$_POST['insert_ads_inpostads_'.$position.'_tertiary_ad_code']:'');
317
+
318
+ $inpostAds[$position]['rules_exclude_loggedin'] = ((isset($_POST['insert_ads_inpostads_'.$position.'_rules_exclude_loggedin']))?$_POST['insert_ads_inpostads_'.$position.'_rules_exclude_loggedin']:'');
319
+ $inpostAds[$position]['rules_exclude_mobile_devices'] = ((isset($_POST['insert_ads_inpostads_'.$position.'_rules_exclude_mobile_devices']))?$_POST['insert_ads_inpostads_'.$position.'_rules_exclude_mobile_devices']:'');
320
+ $inpostAds[$position]['rules_exclude_404'] = ((isset($_POST['insert_ads_inpostads_'.$position.'_rules_exclude_404']))?$_POST['insert_ads_inpostads_'.$position.'_rules_exclude_404']:'');
321
+ $inpostAds[$position]['rules_exclude_home'] = ((isset($_POST['insert_ads_inpostads_'.$position.'_rules_exclude_home']))?$_POST['insert_ads_inpostads_'.$position.'_rules_exclude_home']:'');
322
+ $inpostAds[$position]['rules_home_instances'] = ((isset($_POST['insert_ads_inpostads_'.$position.'_rules_home_instances']))?$_POST['insert_ads_inpostads_'.$position.'_rules_home_instances']:'');
323
+ $inpostAds[$position]['rules_exclude_archives'] = ((isset($_POST['insert_ads_inpostads_'.$position.'_rules_exclude_archives']))?$_POST['insert_ads_inpostads_'.$position.'_rules_exclude_archives']:'');
324
+ $inpostAds[$position]['rules_archives_instances'] = ((isset($_POST['insert_ads_inpostads_'.$position.'_rules_archives_instances']))?$_POST['insert_ads_inpostads_'.$position.'_rules_archives_instances']:'');
325
+ $inpostAds[$position]['rules_exclude_search'] = ((isset($_POST['insert_ads_inpostads_'.$position.'_rules_exclude_search']))?$_POST['insert_ads_inpostads_'.$position.'_rules_exclude_search']:'');
326
+ $inpostAds[$position]['rules_search_instances'] = ((isset($_POST['insert_ads_inpostads_'.$position.'_rules_search_instances']))?$_POST['insert_ads_inpostads_'.$position.'_rules_search_instances']:'');
327
+ $inpostAds[$position]['rules_exclude_page'] = ((isset($_POST['insert_ads_inpostads_'.$position.'_rules_exclude_page']))?$_POST['insert_ads_inpostads_'.$position.'_rules_exclude_page']:'');
328
+ $inpostAds[$position]['rules_page_exceptions'] = ((isset($_POST['insert_ads_inpostads_'.$position.'_rules_page_exceptions']))?$_POST['insert_ads_inpostads_'.$position.'_rules_page_exceptions']:'');
329
+ $inpostAds[$position]['rules_exclude_post'] = ((isset($_POST['insert_ads_inpostads_'.$position.'_rules_exclude_post']))?$_POST['insert_ads_inpostads_'.$position.'_rules_exclude_post']:'');
330
+ $inpostAds[$position]['rules_post_exceptions'] = ((isset($_POST['insert_ads_inpostads_'.$position.'_rules_post_exceptions']))?$_POST['insert_ads_inpostads_'.$position.'_rules_post_exceptions']:'');
331
+ $inpostAds[$position]['rules_post_categories_exceptions'] = ((isset($_POST['insert_ads_inpostads_'.$position.'_rules_post_categories_exceptions']))?$_POST['insert_ads_inpostads_'.$position.'_rules_post_categories_exceptions']:'');
332
+ $inpostAds[$position]['rules_exclude_categories'] = ((isset($_POST['insert_ads_inpostads_'.$position.'_rules_exclude_categories']))?$_POST['insert_ads_inpostads_'.$position.'_rules_exclude_categories']:'');
333
+ $inpostAds[$position]['rules_categories_instances'] = ((isset($_POST['insert_ads_inpostads_'.$position.'_rules_categories_instances']))?$_POST['insert_ads_inpostads_'.$position.'_rules_categories_instances']:'');
334
+ $inpostAds[$position]['rules_categories_exceptions'] = ((isset($_POST['insert_ads_inpostads_'.$position.'_rules_categories_exceptions']))?$_POST['insert_ads_inpostads_'.$position.'_rules_categories_exceptions']:'');
335
+
336
+ $inpostAds[$position]['geo_group1_countries'] = ((isset($_POST['insert_ads_inpostads_'.$position.'_geo_group1_countries']))?$_POST['insert_ads_inpostads_'.$position.'_geo_group1_countries']:'');
337
+ $inpostAds[$position]['geo_group1_adcode'] = ((isset($_POST['insert_ads_inpostads_'.$position.'_geo_group1_adcode']))?$_POST['insert_ads_inpostads_'.$position.'_geo_group1_adcode']:'');
338
+ $inpostAds[$position]['geo_group2_countries'] = ((isset($_POST['insert_ads_inpostads_'.$position.'_geo_group2_countries']))?$_POST['insert_ads_inpostads_'.$position.'_geo_group2_countries']:'');
339
+ $inpostAds[$position]['geo_group2_adcode'] = ((isset($_POST['insert_ads_inpostads_'.$position.'_geo_group2_adcode']))?$_POST['insert_ads_inpostads_'.$position.'_geo_group2_adcode']:'');
340
+
341
+ $inpostAds[$position]['styles'] = ((isset($_POST['insert_ads_inpostads_'.$position.'_styles']))?$_POST['insert_ads_inpostads_'.$position.'_styles']:'');
342
+
343
+ $inpostAds[$position]['notes'] = ((isset($_POST['insert_ads_inpostads_'.$position.'_notes']))?$_POST['insert_ads_inpostads_'.$position.'_notes']:'');
344
+
345
+ if($position == 'middle') {
346
+ $inpostAds[$position]['minimum_character_count'] = ((isset($_POST['insert_ads_inpostads_'.$position.'_minimum_character_count']))?$_POST['insert_ads_inpostads_'.$position.'_minimum_character_count']:'');
347
+ $inpostAds[$position]['paragraph_buffer_count'] = ((isset($_POST['insert_ads_inpostads_'.$position.'_paragraph_buffer_count']))?$_POST['insert_ads_inpostads_'.$position.'_paragraph_buffer_count']:'');
348
+ }
349
+ update_option('insert_ads_inpostads', $inpostAds);
350
+ }
351
+ /* End Shared UI Functions */
352
+
353
+ /* Begin Database Upgrade */
354
+ add_action('insert_ads_upgrade_database', 'insert_ads_inpostads_upgrade_database');
355
+ function insert_ads_inpostads_upgrade_database() {
356
+ if(!get_option('insert_ads_inpostads')) {
357
+ $oldValues = get_option('insert_ads_inpostads_options');
358
+ $newValues = array(
359
+ 'above' => array (
360
+ 'status' => ((isset($oldValues['above']['status']) && $oldValues['above']['status'] == true)?'1':''),
361
+ 'primary_ad_code' => ((isset($oldValues['above']['ad_code_1']))?$oldValues['above']['ad_code_1']:''),
362
+ 'secondary_ad_code' => ((isset($oldValues['above']['ad_code_2']))?$oldValues['above']['ad_code_2']:''),
363
+ 'tertiary_ad_code' => ((isset($oldValues['above']['ad_code_3']))?$oldValues['above']['ad_code_3']:''),
364
+ 'rules_exclude_loggedin' => ((isset($oldValues['above']['rules_exclude_loggedin']))?true:false),
365
+ 'rules_exclude_mobile_devices' => ((isset($oldValues['above']['rules_exclude_mobile_devices']))?true:false),
366
+ 'rules_exclude_home' => ((isset($oldValues['above']['rules_exclude_home']))?true:false),
367
+ 'rules_home_instances' => ((isset($options['above']['rules_home_instances']) && ($options['above']['rules_home_instances'] != ''))?explode(',', $options['above']['rules_home_instances']):array()),
368
+ 'rules_exclude_archives' => ((isset($oldValues['above']['rules_exclude_archives']))?true:false),
369
+ 'rules_archives_instances' => ((isset($options['above']['rules_archives_instances']) && ($options['above']['rules_archives_instances'] != ''))?explode(',', $options['above']['rules_archives_instances']):array()),
370
+ 'rules_exclude_search' => ((isset($oldValues['above']['rules_exclude_search']))?true:false),
371
+ 'rules_search_instances' => ((isset($options['above']['rules_search_instances']) && ($options['above']['rules_search_instances'] != ''))?explode(',', $options['above']['rules_search_instances']):array()),
372
+ 'rules_exclude_page' => ((isset($oldValues['above']['rules_exclude_page']))?true:false),
373
+ 'rules_page_exceptions' => ((isset($options['above']['rules_page_exceptions']) && ($options['above']['rules_page_exceptions'] != ''))?explode(',', $options['above']['rules_page_exceptions']):array()),
374
+ 'rules_exclude_post' => ((isset($oldValues['above']['rules_exclude_post']))?true:false),
375
+ 'rules_post_exceptions' => ((isset($options['above']['rules_post_exceptions']) && ($options['above']['rules_post_exceptions'] != ''))?explode(',', $options['above']['rules_post_exceptions']):array()),
376
+ 'rules_post_categories_exceptions' => ((isset($options['above']['rules_post_categories_exceptions']) && ($options['above']['rules_post_categories_exceptions'] != ''))?explode(',', $options['above']['rules_post_categories_exceptions']):array()),
377
+ 'rules_exclude_categories' => ((isset($oldValues['above']['rules_exclude_categories']))?true:false),
378
+ 'rules_categories_instances' => ((isset($options['above']['rules_categories_instances']) && ($options['above']['rules_categories_instances'] != ''))?explode(',', $options['above']['rules_categories_instances']):array()),
379
+ 'rules_categories_exceptions' => ((isset($options['above']['rules_categories_exceptions']) && ($options['above']['rules_categories_exceptions'] != ''))?explode(',', $options['above']['rules_categories_exceptions']):array()),
380
+ 'geo_group1_countries' => ((isset($options['above']['country_1']) && ($options['above']['country_1'] != ''))?explode(',', $options['above']['country_1']):array()),
381
+ 'geo_group1_adcode' => ((isset($oldValues['above']['country_code_1']))?$oldValues['above']['country_code_1']:''),
382
+ 'geo_group2_countries' => array(),
383
+ 'geo_group2_adcode' => '',
384
+ 'styles' => ((isset($oldValues['above']['styles']))?$oldValues['above']['styles']:'margin: 5px; padding: 0px;'),
385
+ 'notes' => ((isset($oldValues['above']['notes']))?$oldValues['above']['notes']:''),
386
+ ),
387
+ 'middle' => array (
388
+ 'status' => ((isset($oldValues['middle']['status']) && $oldValues['middle']['status'] == true)?'1':''),
389
+ 'primary_ad_code' => ((isset($oldValues['middle']['ad_code_1']))?$oldValues['middle']['ad_code_1']:''),
390
+ 'secondary_ad_code' => ((isset($oldValues['middle']['ad_code_2']))?$oldValues['middle']['ad_code_2']:''),
391
+ 'tertiary_ad_code' => ((isset($oldValues['middle']['ad_code_3']))?$oldValues['middle']['ad_code_3']:''),
392
+ 'rules_exclude_loggedin' => ((isset($oldValues['middle']['rules_exclude_loggedin']))?true:false),
393
+ 'rules_exclude_mobile_devices' => ((isset($oldValues['middle']['rules_exclude_mobile_devices']))?true:false),
394
+ 'rules_exclude_home' => ((isset($oldValues['middle']['rules_exclude_home']))?true:false),
395
+ 'rules_home_instances' => ((isset($options['middle']['rules_home_instances']) && ($options['middle']['rules_home_instances'] != ''))?explode(',', $options['middle']['rules_home_instances']):array()),
396
+ 'rules_exclude_archives' => ((isset($oldValues['middle']['rules_exclude_archives']))?true:false),
397
+ 'rules_archives_instances' => ((isset($options['middle']['rules_archives_instances']) && ($options['middle']['rules_archives_instances'] != ''))?explode(',', $options['middle']['rules_archives_instances']):array()),
398
+ 'rules_exclude_search' => ((isset($oldValues['middle']['rules_exclude_search']))?true:false),
399
+ 'rules_search_instances' => ((isset($options['middle']['rules_search_instances']) && ($options['middle']['rules_search_instances'] != ''))?explode(',', $options['middle']['rules_search_instances']):array()),
400
+ 'rules_exclude_page' => ((isset($oldValues['middle']['rules_exclude_page']))?true:false),
401
+ 'rules_page_exceptions' => ((isset($options['middle']['rules_page_exceptions']) && ($options['middle']['rules_page_exceptions'] != ''))?explode(',', $options['middle']['rules_page_exceptions']):array()),
402
+ 'rules_exclude_post' => ((isset($oldValues['middle']['rules_exclude_post']))?true:false),
403
+ 'rules_post_exceptions' => ((isset($options['middle']['rules_post_exceptions']) && ($options['middle']['rules_post_exceptions'] != ''))?explode(',', $options['middle']['rules_post_exceptions']):array()),
404
+ 'rules_post_categories_exceptions' => ((isset($options['middle']['rules_post_categories_exceptions']) && ($options['middle']['rules_post_categories_exceptions'] != ''))?explode(',', $options['middle']['rules_post_categories_exceptions']):array()),
405
+ 'rules_exclude_categories' => ((isset($oldValues['middle']['rules_exclude_categories']))?true:false),
406
+ 'rules_categories_instances' => ((isset($options['middle']['rules_categories_instances']) && ($options['middle']['rules_categories_instances'] != ''))?explode(',', $options['middle']['rules_categories_instances']):array()),
407
+ 'rules_categories_exceptions' => ((isset($options['middle']['rules_categories_exceptions']) && ($options['middle']['rules_categories_exceptions'] != ''))?explode(',', $options['middle']['rules_categories_exceptions']):array()),
408
+ 'geo_group1_countries' => ((isset($options['middle']['country_1']) && ($options['middle']['country_1'] != ''))?explode(',', $options['middle']['country_1']):array()),
409
+ 'geo_group1_adcode' => ((isset($oldValues['middle']['country_code_1']))?$oldValues['middle']['country_code_1']:''),
410
+ 'geo_group2_countries' => array(),
411
+ 'geo_group2_adcode' => '',
412
+ 'styles' => ((isset($oldValues['middle']['styles']))?$oldValues['middle']['styles']:'margin: 5px; padding: 0px;'),
413
+ 'notes' => ((isset($oldValues['middle']['notes']))?$oldValues['middle']['notes']:''),
414
+ 'minimum_character_count' => ((isset($oldValues['middle']['minimum_character_count']))?$oldValues['middle']['minimum_character_count']:'500'),
415
+ 'paragraph_buffer_count' => ((isset($oldValues['middle']['paragraph_buffer_count']))?$oldValues['middle']['paragraph_buffer_count']:''),
416
+ ),
417
+ 'below' => array (
418
+ 'status' => ((isset($oldValues['below']['status']) && $oldValues['below']['status'] == true)?'1':''),
419
+ 'primary_ad_code' => ((isset($oldValues['below']['ad_code_1']))?$oldValues['below']['ad_code_1']:''),
420
+ 'secondary_ad_code' => ((isset($oldValues['below']['ad_code_2']))?$oldValues['below']['ad_code_2']:''),
421
+ 'tertiary_ad_code' => ((isset($oldValues['below']['ad_code_3']))?$oldValues['below']['ad_code_3']:''),
422
+ 'rules_exclude_loggedin' => ((isset($oldValues['below']['rules_exclude_loggedin']))?true:false),
423
+ 'rules_exclude_mobile_devices' => ((isset($oldValues['below']['rules_exclude_mobile_devices']))?true:false),
424
+ 'rules_exclude_home' => ((isset($oldValues['below']['rules_exclude_home']))?true:false),
425
+ 'rules_home_instances' => ((isset($options['below']['rules_home_instances']) && ($options['below']['rules_home_instances'] != ''))?explode(',', $options['below']['rules_home_instances']):array()),
426
+ 'rules_exclude_archives' => ((isset($oldValues['below']['rules_exclude_archives']))?true:false),
427
+ 'rules_archives_instances' => ((isset($options['below']['rules_archives_instances']) && ($options['below']['rules_archives_instances'] != ''))?explode(',', $options['below']['rules_archives_instances']):array()),
428
+ 'rules_exclude_search' => ((isset($oldValues['below']['rules_exclude_search']))?true:false),
429
+ 'rules_search_instances' => ((isset($options['below']['rules_search_instances']) && ($options['below']['rules_search_instances'] != ''))?explode(',', $options['below']['rules_search_instances']):array()),
430
+ 'rules_exclude_page' => ((isset($oldValues['below']['rules_exclude_page']))?true:false),
431
+ 'rules_page_exceptions' => ((isset($options['below']['rules_page_exceptions']) && ($options['below']['rules_page_exceptions'] != ''))?explode(',', $options['below']['rules_page_exceptions']):array()),
432
+ 'rules_exclude_post' => ((isset($oldValues['below']['rules_exclude_post']))?true:false),
433
+ 'rules_post_exceptions' => ((isset($options['below']['rules_post_exceptions']) && ($options['below']['rules_post_exceptions'] != ''))?explode(',', $options['below']['rules_post_exceptions']):array()),
434
+ 'rules_post_categories_exceptions' => ((isset($options['below']['rules_post_categories_exceptions']) && ($options['below']['rules_post_categories_exceptions'] != ''))?explode(',', $options['below']['rules_post_categories_exceptions']):array()),
435
+ 'rules_exclude_categories' => ((isset($oldValues['below']['rules_exclude_categories']))?true:false),
436
+ 'rules_categories_instances' => ((isset($options['below']['rules_categories_instances']) && ($options['below']['rules_categories_instances'] != ''))?explode(',', $options['below']['rules_categories_instances']):array()),
437
+ 'rules_categories_exceptions' => ((isset($options['below']['rules_categories_exceptions']) && ($options['below']['rules_categories_exceptions'] != ''))?explode(',', $options['below']['rules_categories_exceptions']):array()),
438
+ 'geo_group1_countries' => ((isset($options['below']['country_1']) && ($options['below']['country_1'] != ''))?explode(',', $options['below']['country_1']):array()),
439
+ 'geo_group1_adcode' => ((isset($oldValues['below']['country_code_1']))?$oldValues['below']['country_code_1']:''),
440
+ 'geo_group2_countries' => array(),
441
+ 'geo_group2_adcode' => '',
442
+ 'styles' => ((isset($oldValues['below']['styles']))?$oldValues['below']['styles']:'margin: 5px; padding: 0px;'),
443
+ 'notes' => ((isset($oldValues['below']['notes']))?$oldValues['below']['notes']:''),
444
+ ),
445
+ 'left' => array (
446
+ 'status' => ((isset($oldValues['left']['status']) && $oldValues['left']['status'] == true)?'1':''),
447
+ 'primary_ad_code' => ((isset($oldValues['left']['ad_code_1']))?$oldValues['left']['ad_code_1']:''),
448
+ 'secondary_ad_code' => ((isset($oldValues['left']['ad_code_2']))?$oldValues['left']['ad_code_2']:''),
449
+ 'tertiary_ad_code' => ((isset($oldValues['left']['ad_code_3']))?$oldValues['left']['ad_code_3']:''),
450
+ 'rules_exclude_loggedin' => ((isset($oldValues['left']['rules_exclude_loggedin']))?true:false),
451
+ 'rules_exclude_mobile_devices' => ((isset($oldValues['left']['rules_exclude_mobile_devices']))?true:false),
452
+ 'rules_exclude_home' => ((isset($oldValues['left']['rules_exclude_home']))?true:false),
453
+ 'rules_home_instances' => ((isset($options['left']['rules_home_instances']) && ($options['left']['rules_home_instances'] != ''))?explode(',', $options['left']['rules_home_instances']):array()),
454
+ 'rules_exclude_archives' => ((isset($oldValues['left']['rules_exclude_archives']))?true:false),
455
+ 'rules_archives_instances' => ((isset($options['left']['rules_archives_instances']) && ($options['left']['rules_archives_instances'] != ''))?explode(',', $options['left']['rules_archives_instances']):array()),
456
+ 'rules_exclude_search' => ((isset($oldValues['left']['rules_exclude_search']))?true:false),
457
+ 'rules_search_instances' => ((isset($options['left']['rules_search_instances']) && ($options['left']['rules_search_instances'] != ''))?explode(',', $options['left']['rules_search_instances']):array()),
458
+ 'rules_exclude_page' => ((isset($oldValues['left']['rules_exclude_page']))?true:false),
459
+ 'rules_page_exceptions' => ((isset($options['left']['rules_page_exceptions']) && ($options['left']['rules_page_exceptions'] != ''))?explode(',', $options['left']['rules_page_exceptions']):array()),
460
+ 'rules_exclude_post' => ((isset($oldValues['left']['rules_exclude_post']))?true:false),
461
+ 'rules_post_exceptions' => ((isset($options['left']['rules_post_exceptions']) && ($options['left']['rules_post_exceptions'] != ''))?explode(',', $options['left']['rules_post_exceptions']):array()),
462
+ 'rules_post_categories_exceptions' => ((isset($options['left']['rules_post_categories_exceptions']) && ($options['left']['rules_post_categories_exceptions'] != ''))?explode(',', $options['left']['rules_post_categories_exceptions']):array()),
463
+ 'rules_exclude_categories' => ((isset($oldValues['left']['rules_exclude_categories']))?true:false),
464
+ 'rules_categories_instances' => ((isset($options['left']['rules_categories_instances']) && ($options['left']['rules_categories_instances'] != ''))?explode(',', $options['left']['rules_categories_instances']):array()),
465
+ 'rules_categories_exceptions' => ((isset($options['left']['rules_categories_exceptions']) && ($options['left']['rules_categories_exceptions'] != ''))?explode(',', $options['left']['rules_categories_exceptions']):array()),
466
+ 'geo_group1_countries' => ((isset($options['left']['country_1']) && ($options['left']['country_1'] != ''))?explode(',', $options['left']['country_1']):array()),
467
+ 'geo_group1_adcode' => ((isset($oldValues['left']['country_code_1']))?$oldValues['left']['country_code_1']:''),
468
+ 'geo_group2_countries' => array(),
469
+ 'geo_group2_adcode' => '',
470
+ 'styles' => ((isset($oldValues['left']['styles']))?$oldValues['left']['styles']:'margin: 5px; padding: 0px;'),
471
+ 'notes' => ((isset($oldValues['left']['notes']))?$oldValues['left']['notes']:''),
472
+ ),
473
+ 'right' => array (
474
+ 'status' => ((isset($oldValues['right']['status']) && $oldValues['right']['status'] == true)?'1':''),
475
+ 'primary_ad_code' => ((isset($oldValues['right']['ad_code_1']))?$oldValues['right']['ad_code_1']:''),
476
+ 'secondary_ad_code' => ((isset($oldValues['right']['ad_code_2']))?$oldValues['right']['ad_code_2']:''),
477
+ 'tertiary_ad_code' => ((isset($oldValues['right']['ad_code_3']))?$oldValues['right']['ad_code_3']:''),
478
+ 'rules_exclude_loggedin' => ((isset($oldValues['right']['rules_exclude_loggedin']))?true:false),
479
+ 'rules_exclude_mobile_devices' => ((isset($oldValues['right']['rules_exclude_mobile_devices']))?true:false),
480
+ 'rules_exclude_home' => ((isset($oldValues['right']['rules_exclude_home']))?true:false),
481
+ 'rules_home_instances' => ((isset($options['right']['rules_home_instances']) && ($options['right']['rules_home_instances'] != ''))?explode(',', $options['right']['rules_home_instances']):array()),
482
+ 'rules_exclude_archives' => ((isset($oldValues['right']['rules_exclude_archives']))?true:false),
483
+ 'rules_archives_instances' => ((isset($options['right']['rules_archives_instances']) && ($options['right']['rules_archives_instances'] != ''))?explode(',', $options['right']['rules_archives_instances']):array()),
484
+ 'rules_exclude_search' => ((isset($oldValues['right']['rules_exclude_search']))?true:false),
485
+ 'rules_search_instances' => ((isset($options['right']['rules_search_instances']) && ($options['right']['rules_search_instances'] != ''))?explode(',', $options['right']['rules_search_instances']):array()),
486
+ 'rules_exclude_page' => ((isset($oldValues['right']['rules_exclude_page']))?true:false),
487
+ 'rules_page_exceptions' => ((isset($options['right']['rules_page_exceptions']) && ($options['right']['rules_page_exceptions'] != ''))?explode(',', $options['right']['rules_page_exceptions']):array()),
488
+ 'rules_exclude_post' => ((isset($oldValues['right']['rules_exclude_post']))?true:false),
489
+ 'rules_post_exceptions' => ((isset($options['right']['rules_post_exceptions']) && ($options['right']['rules_post_exceptions'] != ''))?explode(',', $options['right']['rules_post_exceptions']):array()),
490
+ 'rules_post_categories_exceptions' => ((isset($options['right']['rules_post_categories_exceptions']) && ($options['right']['rules_post_categories_exceptions'] != ''))?explode(',', $options['right']['rules_post_categories_exceptions']):array()),
491
+ 'rules_exclude_categories' => ((isset($oldValues['right']['rules_exclude_categories']))?true:false),
492
+ 'rules_categories_instances' => ((isset($options['right']['rules_categories_instances']) && ($options['right']['rules_categories_instances'] != ''))?explode(',', $options['right']['rules_categories_instances']):array()),
493
+ 'rules_categories_exceptions' => ((isset($options['right']['rules_categories_exceptions']) && ($options['right']['rules_categories_exceptions'] != ''))?explode(',', $options['right']['rules_categories_exceptions']):array()),
494
+ 'geo_group1_countries' => ((isset($options['right']['country_1']) && ($options['right']['country_1'] != ''))?explode(',', $options['right']['country_1']):array()),
495
+ 'geo_group1_adcode' => ((isset($oldValues['right']['country_code_1']))?$oldValues['right']['country_code_1']:''),
496
+ 'geo_group2_countries' => array(),
497
+ 'geo_group2_adcode' => '',
498
+ 'styles' => ((isset($oldValues['right']['styles']))?$oldValues['right']['styles']:'margin: 5px; padding: 0px;'),
499
+ 'notes' => ((isset($oldValues['right']['notes']))?$oldValues['right']['notes']:''),
500
+ )
501
+ );
502
+ update_option('insert_ads_inpostads', $newValues);
503
+ }
504
+ }
505
+ /* End Database Upgrade */
506
+
507
+ /* Begin Ad Insertion */
508
+ add_filter('the_content', 'insert_ads_inpostads_the_content', 100);
509
+ function insert_ads_inpostads_the_content($content) {
510
+ if(!is_feed() && is_main_query()) {
511
+ $inpostAds = get_option('insert_ads_inpostads');
512
+
513
+ if(insert_ads_get_ad_status($inpostAds['left'])) {
514
+ $content = '<div class="wpInsert wpInsertInPostAd wpInsertLeft" style="float: left; '.(($inpostAds['left']['styles'] != '')?$inpostAds['left']['styles']:'').'">'.insert_ads_get_geotargeted_adcode($inpostAds['left']).'</div>'.$content;
515
+ }
516
+ if(insert_ads_get_ad_status($inpostAds['right'])) {
517
+ $content = '<div class="wpInsert wpInsertInPostAd wpInsertRight" style="float: right; '.(($inpostAds['right']['styles'] != '')?$inpostAds['right']['styles']:'').'">'.insert_ads_get_geotargeted_adcode($inpostAds['right']).'</div>'.$content;
518
+ }
519
+ if(insert_ads_get_ad_status($inpostAds['above'])) {
520
+ $content = '<div class="wpInsert wpInsertInPostAd wpInsertAbove"'.(($inpostAds['above']['styles'] != '')?' style="'.$inpostAds['above']['styles'].'"':'').'>'.insert_ads_get_geotargeted_adcode($inpostAds['above']).'</div>'.$content;
521
+ }
522
+ if(insert_ads_get_ad_status($inpostAds['middle'])) {
523
+ $paragraphCount = insert_ads_inpostads_get_paragraph_count($content);
524
+ if($paragraphCount > 1) {
525
+ if(($inpostAds['middle']['paragraph_buffer_count'] == 0) || ($inpostAds['middle']['paragraph_buffer_count'] == '')) {
526
+ $position = insert_ads_inpostads_get_midpoint('/p>', $content, round($paragraphCount / 2));
527
+ } else {
528
+ $position = insert_ads_inpostads_get_midpoint('/p>', $content, $inpostAds['middle']['paragraph_buffer_count']);
529
+ }
530
+ if($position) {
531
+ if(($inpostAds['middle']['minimum_character_count'] == 0) || ($inpostAds['middle']['minimum_character_count'] == '')) {
532
+ $content = substr_replace($content, '/p>'.'<div class="wpInsert wpInsertInPostAd wpInsertMiddle"'.(($inpostAds['middle']['styles'] != '')?' style="'.$inpostAds['middle']['styles'].'"':'').'>'.insert_ads_get_geotargeted_adcode($inpostAds['middle']).'</div>', $position, 3);
533
+ } else {
534
+ if(strlen(strip_tags($content)) > $inpostAds['middle']['minimum_character_count']) {
535
+ $content = substr_replace($content, '/p>'.'<div class="wpInsert wpInsertInPostAd wpInsertMiddle"'.(($inpostAds['middle']['styles'] != '')?' style="'.$inpostAds['middle']['styles'].'"':'').'>'.insert_ads_get_geotargeted_adcode($inpostAds['middle']).'</div>', $position, 3);
536
+ }
537
+ }
538
+ }
539
+ }
540
+ }
541
+ if(insert_ads_get_ad_status($inpostAds['below'])) {
542
+ $content = $content.'<div class="wpInsert wpInsertInPostAd wpInsertBelow"'.(($inpostAds['below']['styles'] != '')?' style="'.$inpostAds['below']['styles'].'"':'').'>'.insert_ads_get_geotargeted_adcode($inpostAds['below']).'</div>';
543
+ }
544
+ }
545
+ return $content;
546
+ }
547
+
548
+ function insert_ads_inpostads_get_paragraph_count($content) {
549
+ $paragraphs = explode('/p>', $content);
550
+ $paragraphCount = 0;
551
+ if(is_array($paragraphs)) {
552
+ foreach($paragraphs as $paragraph) {
553
+ if(strlen($paragraph) > 1) {
554
+ $paragraphCount++;
555
+ }
556
+ }
557
+ }
558
+ return $paragraphCount;
559
+ }
560
+
561
+ function insert_ads_inpostads_get_midpoint($search, $string, $offset) {
562
+ $arr = explode($search, $string);
563
+ switch($offset) {
564
+ case $offset == 0:
565
+ return false;
566
+ break;
567
+ case $offset > max(array_keys($arr)):
568
+ return false;
569
+ break;
570
+ default:
571
+ return strlen(implode($search, array_slice($arr, 0, $offset)));
572
+ break;
573
+ }
574
+ }
575
+ /* End Ad Insertion */
576
+ ?>
insert-post-ads.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Plugin Name: Insert Post Ads
4
  * Plugin URI: http://www.insertpostads.com/
5
- * Version: 1.1.2
6
  * Author: InsertPostAds
7
  * Author URI: http://www.insertpostads.com/
8
  * Description: Allows you to insert ads after paragraphs of your post content
@@ -39,7 +39,7 @@ class InsertPostAds {
39
  $this->plugin->name = 'insert-post-ads'; // Plugin Folder
40
  $this->plugin->displayName = 'Post Adverts'; // Plugin Name
41
  $this->plugin->posttype = 'insertpostads';
42
- $this->plugin->version = '1.1.1';
43
  $this->plugin->folder = plugin_dir_path( __FILE__ );
44
  $this->plugin->url = plugin_dir_url( __FILE__ );
45
  $this->plugin->ads_screen_key = $this->plugin->name . '-ads-display-chosen-once';
@@ -92,7 +92,7 @@ class InsertPostAds {
92
  'exclude_from_search' => true,
93
  'show_ui' => true,
94
  'show_in_menu' => true,
95
- 'menu_position' => 20,
96
  'menu_icon' => 'dashicons-migrate',
97
  'capability_type' => 'post',
98
  'hierarchical' => false,
@@ -125,10 +125,15 @@ class InsertPostAds {
125
  */
126
  function adminScriptsAndCSS() {
127
  // JS
128
- // wp_enqueue_script($this->plugin->name.'-admin', $this->plugin->url.'js/admin.js', array('jquery'), $this->plugin->version, true);
 
 
129
 
130
  // CSS
131
  wp_enqueue_style( $this->plugin->name.'-admin', $this->plugin->url.'css/admin.css', array(), $this->plugin->version );
 
 
 
132
  }
133
 
134
  /**
@@ -534,3 +539,58 @@ class InsertPostAds {
534
  }
535
 
536
  $insertPostAds = new InsertPostAds();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  /**
3
  * Plugin Name: Insert Post Ads
4
  * Plugin URI: http://www.insertpostads.com/
5
+ * Version: 1.2
6
  * Author: InsertPostAds
7
  * Author URI: http://www.insertpostads.com/
8
  * Description: Allows you to insert ads after paragraphs of your post content
39
  $this->plugin->name = 'insert-post-ads'; // Plugin Folder
40
  $this->plugin->displayName = 'Post Adverts'; // Plugin Name
41
  $this->plugin->posttype = 'insertpostads';
42
+ $this->plugin->version = '1.2';
43
  $this->plugin->folder = plugin_dir_path( __FILE__ );
44
  $this->plugin->url = plugin_dir_url( __FILE__ );
45
  $this->plugin->ads_screen_key = $this->plugin->name . '-ads-display-chosen-once';
92
  'exclude_from_search' => true,
93
  'show_ui' => true,
94
  'show_in_menu' => true,
95
+ 'menu_position' => 100,
96
  'menu_icon' => 'dashicons-migrate',
97
  'capability_type' => 'post',
98
  'hierarchical' => false,
125
  */
126
  function adminScriptsAndCSS() {
127
  // JS
128
+ wp_enqueue_script($this->plugin->name.'-admin', $this->plugin->url.'js/admin.js', array('jquery', 'jquery-ui-core', 'jquery-ui-accordion', 'jquery-ui-dialog'), $this->plugin->version);
129
+ wp_enqueue_script($this->plugin->name.'chart-admin', $this->plugin->url.'js/Chart.bundle.min.js', array(), $this->plugin->version);
130
+ wp_enqueue_script($this->plugin->name.'colors-admin', $this->plugin->url.'js/controls.js', array(), $this->plugin->version);
131
 
132
  // CSS
133
  wp_enqueue_style( $this->plugin->name.'-admin', $this->plugin->url.'css/admin.css', array(), $this->plugin->version );
134
+ wp_enqueue_style( $this->plugin->name.'ads-admin', $this->plugin->url.'css/insert-post.css', array(), $this->plugin->version );
135
+ wp_enqueue_style( $this->plugin->name.'colors', $this->plugin->url.'css/controls.css', array(), $this->plugin->version );
136
+ wp_enqueue_style( 'jquery-ui-admin', 'https://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css', array(), $this->plugin->version );
137
  }
138
 
139
  /**
539
  }
540
 
541
  $insertPostAds = new InsertPostAds();
542
+
543
+
544
+ /*function myplugin_activate($wpdb, $table_prefix) {
545
+ global $wpdb;
546
+ $prefix = $wpdb->prefix;
547
+ //$wpdb->query('UPDATE wp_usermeta SET meta_value = "" WHERE meta_key = "insert_ads_1.6_admin_notice_dismissed"');
548
+ $wpdb->query('DELETE FROM '.$prefix.'usermeta WHERE `meta_key` = "insert_ads_1.6_admin_notice_dismissed"');
549
+ }
550
+ register_activation_hook( __FILE__, 'myplugin_activate' );*/
551
+
552
+ if(!defined('WP_INSADS_URL'))
553
+ define('WP_INSADS_URL', plugin_dir_url(__FILE__));
554
+ if(!defined('WP_INSADS_DIR'))
555
+ define('WP_INSADS_DIR', plugin_dir_path(__FILE__));
556
+ if(!defined('WP_INSADS_VERSION'))
557
+ define('WP_INSADS_VERSION', '1.6');
558
+ require_once(dirname(__FILE__).'/vi-integration.php');
559
+ require_once(dirname(__FILE__).'/apis/vi/api.php');
560
+ require_once(dirname(__FILE__).'/inpostads.php');
561
+ require_once(dirname(__FILE__).'/rules.php');
562
+ require_once(dirname(__FILE__).'/common.php');
563
+ require_once(dirname(__FILE__).'/geotargeting.php');
564
+ require_once(dirname(__FILE__).'/controls/controls.php');
565
+
566
+ /* Begin Admin Notice */
567
+ add_action('admin_notices', 'insert_ads_admin_notices');
568
+ function insert_ads_admin_notices() {
569
+
570
+ $userId = get_current_user_id();
571
+ if(!get_user_meta($userId, 'insert_ads_'.WP_INSADS_VERSION.'_admin_notice_dismissed', true)) {
572
+ echo '<div class="notice notice-success insert_ads_notice is-dismissible" style="padding: 15px;">';
573
+ echo '<div style="float: left; max-width: 875px; font-size: 14px; font-family: Arial; line-height: 18px; color: #232323;">';
574
+ echo '<p>Thank you for updating <b>Insert Post ADS</b>!</p>';
575
+ echo '<p>This update features <strong>vi stories</strong> from video intelligence - a video player that supplies both content and video advertising. Watch a <a href="http://demo.vi.ai/ViewsterBlog_Nintendo.html">demo</a>.</p>';
576
+ echo '<p>To begin earning <a target="_blank" href="https://www.vi.ai/publisher-registration/?email='.get_bloginfo('admin_email').'&domain='.get_bloginfo('url').'&aid=WP_insertpostads&utm_source=Wordpress&utm_medium=wp_insertpostads&utm_campaign=white&utm_content=Wp_insertpostads">sign up</a> to vi stories and place the ad live now!</p>';
577
+ echo '<p>Read the <a href="https://www.vi.ai/frequently-asked-questions-vi-stories-for-wordpress/?utm_source=WordPress&utm_medium=Plugin%20FAQ&utm_campaign=WP%20insertpostads">FAQ</a>.</p>';
578
+ echo '<p style=" font-size: 10px;">By clicking sign up you agree to send your current domain, email and affiliate ID to video intelligence & Insert Post Ads.</p>';
579
+ echo '</div>';
580
+ echo '<img style="float: right; margin-right: 20px; margin-top: 13px;" src="'.WP_INSADS_URL.'images/vi-big-logo.png?'.WP_INSADS_VERSION.'" />';
581
+ echo '<div class="clear"></div>';
582
+ echo '<input type="hidden" id="insert_ads_admin_notice_nonce" name="insert_ads_admin_notice_nonce" value="'.wp_create_nonce('insert-ads-admin-notice').'" />';
583
+ echo '<input type="hidden" id="insert_ads_admin_notice_ajax" name="insert_ads_admin_notice_ajax" value="'.admin_url('admin-ajax.php').'" />';
584
+ echo '</div>';
585
+ }
586
+
587
+ }
588
+
589
+ add_action('wp_ajax_insert_ads_admin_notice_dismiss', 'insert_ads_admin_notice_dismiss');
590
+ function insert_ads_admin_notice_dismiss() {
591
+ check_ajax_referer('insert-ads-admin-notice', 'insert_ads_admin_notice_nonce');
592
+ $userId = get_current_user_id();
593
+ update_user_meta($userId, 'insert_ads_'.WP_INSADS_VERSION.'_admin_notice_dismissed', 'true');
594
+ die();
595
+ }
596
+ /* End Admin Notice */
js/Chart.bundle.min.js ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * Chart.js
3
+ * http://chartjs.org/
4
+ * Version: 2.7.0
5
+ *
6
+ * Copyright 2017 Nick Downie
7
+ * Released under the MIT license
8
+ * https://github.com/chartjs/Chart.js/blob/master/LICENSE.md
9
+ */
10
+ !function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Chart=t()}}(function(){return function t(e,n,i){function a(o,s){if(!n[o]){if(!e[o]){var l="function"==typeof require&&require;if(!s&&l)return l(o,!0);if(r)return r(o,!0);var u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var d=n[o]={exports:{}};e[o][0].call(d.exports,function(t){var n=e[o][1][t];return a(n||t)},d,d.exports,t,e,n,i)}return n[o].exports}for(var r="function"==typeof require&&require,o=0;o<i.length;o++)a(i[o]);return a}({1:[function(t,e,n){function i(t){if(t){var e=/^#([a-fA-F0-9]{3})$/i,n=/^#([a-fA-F0-9]{6})$/i,i=/^rgba?\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/i,a=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/i,r=/(\w+)/,o=[0,0,0],s=1,l=t.match(e);if(l){l=l[1];for(d=0;d<o.length;d++)o[d]=parseInt(l[d]+l[d],16)}else if(l=t.match(n)){l=l[1];for(d=0;d<o.length;d++)o[d]=parseInt(l.slice(2*d,2*d+2),16)}else if(l=t.match(i)){for(d=0;d<o.length;d++)o[d]=parseInt(l[d+1]);s=parseFloat(l[4])}else if(l=t.match(a)){for(d=0;d<o.length;d++)o[d]=Math.round(2.55*parseFloat(l[d+1]));s=parseFloat(l[4])}else if(l=t.match(r)){if("transparent"==l[1])return[0,0,0,0];if(!(o=c[l[1]]))return}for(var d=0;d<o.length;d++)o[d]=u(o[d],0,255);return s=s||0==s?u(s,0,1):1,o[3]=s,o}}function a(t){if(t){var e=/^hsla?\(\s*([+-]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)/,n=t.match(e);if(n){var i=parseFloat(n[4]);return[u(parseInt(n[1]),0,360),u(parseFloat(n[2]),0,100),u(parseFloat(n[3]),0,100),u(isNaN(i)?1:i,0,1)]}}}function r(t){if(t){var e=/^hwb\(\s*([+-]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)/,n=t.match(e);if(n){var i=parseFloat(n[4]);return[u(parseInt(n[1]),0,360),u(parseFloat(n[2]),0,100),u(parseFloat(n[3]),0,100),u(isNaN(i)?1:i,0,1)]}}}function o(t,e){return void 0===e&&(e=void 0!==t[3]?t[3]:1),"rgba("+t[0]+", "+t[1]+", "+t[2]+", "+e+")"}function s(t,e){return"rgba("+Math.round(t[0]/255*100)+"%, "+Math.round(t[1]/255*100)+"%, "+Math.round(t[2]/255*100)+"%, "+(e||t[3]||1)+")"}function l(t,e){return void 0===e&&(e=void 0!==t[3]?t[3]:1),"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+e+")"}function u(t,e,n){return Math.min(Math.max(e,t),n)}function d(t){var e=t.toString(16).toUpperCase();return e.length<2?"0"+e:e}var c=t(5);e.exports={getRgba:i,getHsla:a,getRgb:function(t){var e=i(t);return e&&e.slice(0,3)},getHsl:function(t){var e=a(t);return e&&e.slice(0,3)},getHwb:r,getAlpha:function(t){var e=i(t);return e?e[3]:(e=a(t))?e[3]:(e=r(t))?e[3]:void 0},hexString:function(t){return"#"+d(t[0])+d(t[1])+d(t[2])},rgbString:function(t,e){return e<1||t[3]&&t[3]<1?o(t,e):"rgb("+t[0]+", "+t[1]+", "+t[2]+")"},rgbaString:o,percentString:function(t,e){return e<1||t[3]&&t[3]<1?s(t,e):"rgb("+Math.round(t[0]/255*100)+"%, "+Math.round(t[1]/255*100)+"%, "+Math.round(t[2]/255*100)+"%)"},percentaString:s,hslString:function(t,e){return e<1||t[3]&&t[3]<1?l(t,e):"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)"},hslaString:l,hwbString:function(t,e){return void 0===e&&(e=void 0!==t[3]?t[3]:1),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+(void 0!==e&&1!==e?", "+e:"")+")"},keyword:function(t){return h[t.slice(0,3)]}};var h={};for(var f in c)h[c[f]]=f},{5:5}],2:[function(t,e,n){var i=t(4),a=t(1),r=function(t){if(t instanceof r)return t;if(!(this instanceof r))return new r(t);this.valid=!1,this.values={rgb:[0,0,0],hsl:[0,0,0],hsv:[0,0,0],hwb:[0,0,0],cmyk:[0,0,0,0],alpha:1};var e;"string"==typeof t?(e=a.getRgba(t))?this.setValues("rgb",e):(e=a.getHsla(t))?this.setValues("hsl",e):(e=a.getHwb(t))&&this.setValues("hwb",e):"object"==typeof t&&(void 0!==(e=t).r||void 0!==e.red?this.setValues("rgb",e):void 0!==e.l||void 0!==e.lightness?this.setValues("hsl",e):void 0!==e.v||void 0!==e.value?this.setValues("hsv",e):void 0!==e.w||void 0!==e.whiteness?this.setValues("hwb",e):void 0===e.c&&void 0===e.cyan||this.setValues("cmyk",e))};r.prototype={isValid:function(){return this.valid},rgb:function(){return this.setSpace("rgb",arguments)},hsl:function(){return this.setSpace("hsl",arguments)},hsv:function(){return this.setSpace("hsv",arguments)},hwb:function(){return this.setSpace("hwb",arguments)},cmyk:function(){return this.setSpace("cmyk",arguments)},rgbArray:function(){return this.values.rgb},hslArray:function(){return this.values.hsl},hsvArray:function(){return this.values.hsv},hwbArray:function(){var t=this.values;return 1!==t.alpha?t.hwb.concat([t.alpha]):t.hwb},cmykArray:function(){return this.values.cmyk},rgbaArray:function(){var t=this.values;return t.rgb.concat([t.alpha])},hslaArray:function(){var t=this.values;return t.hsl.concat([t.alpha])},alpha:function(t){return void 0===t?this.values.alpha:(this.setValues("alpha",t),this)},red:function(t){return this.setChannel("rgb",0,t)},green:function(t){return this.setChannel("rgb",1,t)},blue:function(t){return this.setChannel("rgb",2,t)},hue:function(t){return t&&(t=(t%=360)<0?360+t:t),this.setChannel("hsl",0,t)},saturation:function(t){return this.setChannel("hsl",1,t)},lightness:function(t){return this.setChannel("hsl",2,t)},saturationv:function(t){return this.setChannel("hsv",1,t)},whiteness:function(t){return this.setChannel("hwb",1,t)},blackness:function(t){return this.setChannel("hwb",2,t)},value:function(t){return this.setChannel("hsv",2,t)},cyan:function(t){return this.setChannel("cmyk",0,t)},magenta:function(t){return this.setChannel("cmyk",1,t)},yellow:function(t){return this.setChannel("cmyk",2,t)},black:function(t){return this.setChannel("cmyk",3,t)},hexString:function(){return a.hexString(this.values.rgb)},rgbString:function(){return a.rgbString(this.values.rgb,this.values.alpha)},rgbaString:function(){return a.rgbaString(this.values.rgb,this.values.alpha)},percentString:function(){return a.percentString(this.values.rgb,this.values.alpha)},hslString:function(){return a.hslString(this.values.hsl,this.values.alpha)},hslaString:function(){return a.hslaString(this.values.hsl,this.values.alpha)},hwbString:function(){return a.hwbString(this.values.hwb,this.values.alpha)},keyword:function(){return a.keyword(this.values.rgb,this.values.alpha)},rgbNumber:function(){var t=this.values.rgb;return t[0]<<16|t[1]<<8|t[2]},luminosity:function(){for(var t=this.values.rgb,e=[],n=0;n<t.length;n++){var i=t[n]/255;e[n]=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4)}return.2126*e[0]+.7152*e[1]+.0722*e[2]},contrast:function(t){var e=this.luminosity(),n=t.luminosity();return e>n?(e+.05)/(n+.05):(n+.05)/(e+.05)},level:function(t){var e=this.contrast(t);return e>=7.1?"AAA":e>=4.5?"AA":""},dark:function(){var t=this.values.rgb;return(299*t[0]+587*t[1]+114*t[2])/1e3<128},light:function(){return!this.dark()},negate:function(){for(var t=[],e=0;e<3;e++)t[e]=255-this.values.rgb[e];return this.setValues("rgb",t),this},lighten:function(t){var e=this.values.hsl;return e[2]+=e[2]*t,this.setValues("hsl",e),this},darken:function(t){var e=this.values.hsl;return e[2]-=e[2]*t,this.setValues("hsl",e),this},saturate:function(t){var e=this.values.hsl;return e[1]+=e[1]*t,this.setValues("hsl",e),this},desaturate:function(t){var e=this.values.hsl;return e[1]-=e[1]*t,this.setValues("hsl",e),this},whiten:function(t){var e=this.values.hwb;return e[1]+=e[1]*t,this.setValues("hwb",e),this},blacken:function(t){var e=this.values.hwb;return e[2]+=e[2]*t,this.setValues("hwb",e),this},greyscale:function(){var t=this.values.rgb,e=.3*t[0]+.59*t[1]+.11*t[2];return this.setValues("rgb",[e,e,e]),this},clearer:function(t){var e=this.values.alpha;return this.setValues("alpha",e-e*t),this},opaquer:function(t){var e=this.values.alpha;return this.setValues("alpha",e+e*t),this},rotate:function(t){var e=this.values.hsl,n=(e[0]+t)%360;return e[0]=n<0?360+n:n,this.setValues("hsl",e),this},mix:function(t,e){var n=this,i=t,a=void 0===e?.5:e,r=2*a-1,o=n.alpha()-i.alpha(),s=((r*o==-1?r:(r+o)/(1+r*o))+1)/2,l=1-s;return this.rgb(s*n.red()+l*i.red(),s*n.green()+l*i.green(),s*n.blue()+l*i.blue()).alpha(n.alpha()*a+i.alpha()*(1-a))},toJSON:function(){return this.rgb()},clone:function(){var t,e,n=new r,i=this.values,a=n.values;for(var o in i)i.hasOwnProperty(o)&&(t=i[o],"[object Array]"===(e={}.toString.call(t))?a[o]=t.slice(0):"[object Number]"===e?a[o]=t:console.error("unexpected color value:",t));return n}},r.prototype.spaces={rgb:["red","green","blue"],hsl:["hue","saturation","lightness"],hsv:["hue","saturation","value"],hwb:["hue","whiteness","blackness"],cmyk:["cyan","magenta","yellow","black"]},r.prototype.maxes={rgb:[255,255,255],hsl:[360,100,100],hsv:[360,100,100],hwb:[360,100,100],cmyk:[100,100,100,100]},r.prototype.getValues=function(t){for(var e=this.values,n={},i=0;i<t.length;i++)n[t.charAt(i)]=e[t][i];return 1!==e.alpha&&(n.a=e.alpha),n},r.prototype.setValues=function(t,e){var n,a=this.values,r=this.spaces,o=this.maxes,s=1;if(this.valid=!0,"alpha"===t)s=e;else if(e.length)a[t]=e.slice(0,t.length),s=e[t.length];else if(void 0!==e[t.charAt(0)]){for(n=0;n<t.length;n++)a[t][n]=e[t.charAt(n)];s=e.a}else if(void 0!==e[r[t][0]]){var l=r[t];for(n=0;n<t.length;n++)a[t][n]=e[l[n]];s=e.alpha}if(a.alpha=Math.max(0,Math.min(1,void 0===s?a.alpha:s)),"alpha"===t)return!1;var u;for(n=0;n<t.length;n++)u=Math.max(0,Math.min(o[t][n],a[t][n])),a[t][n]=Math.round(u);for(var d in r)d!==t&&(a[d]=i[t][d](a[t]));return!0},r.prototype.setSpace=function(t,e){var n=e[0];return void 0===n?this.getValues(t):("number"==typeof n&&(n=Array.prototype.slice.call(e)),this.setValues(t,n),this)},r.prototype.setChannel=function(t,e,n){var i=this.values[t];return void 0===n?i[e]:n===i[e]?this:(i[e]=n,this.setValues(t,i),this)},"undefined"!=typeof window&&(window.Color=r),e.exports=r},{1:1,4:4}],3:[function(t,e,n){function i(t){var e,n,i,a=t[0]/255,r=t[1]/255,o=t[2]/255,s=Math.min(a,r,o),l=Math.max(a,r,o),u=l-s;return l==s?e=0:a==l?e=(r-o)/u:r==l?e=2+(o-a)/u:o==l&&(e=4+(a-r)/u),(e=Math.min(60*e,360))<0&&(e+=360),i=(s+l)/2,n=l==s?0:i<=.5?u/(l+s):u/(2-l-s),[e,100*n,100*i]}function a(t){var e,n,i,a=t[0],r=t[1],o=t[2],s=Math.min(a,r,o),l=Math.max(a,r,o),u=l-s;return n=0==l?0:u/l*1e3/10,l==s?e=0:a==l?e=(r-o)/u:r==l?e=2+(o-a)/u:o==l&&(e=4+(a-r)/u),(e=Math.min(60*e,360))<0&&(e+=360),i=l/255*1e3/10,[e,n,i]}function o(t){var e=t[0],n=t[1],a=t[2];return[i(t)[0],100*(1/255*Math.min(e,Math.min(n,a))),100*(a=1-1/255*Math.max(e,Math.max(n,a)))]}function s(t){var e,n,i,a,r=t[0]/255,o=t[1]/255,s=t[2]/255;return a=Math.min(1-r,1-o,1-s),e=(1-r-a)/(1-a)||0,n=(1-o-a)/(1-a)||0,i=(1-s-a)/(1-a)||0,[100*e,100*n,100*i,100*a]}function l(t){return S[JSON.stringify(t)]}function u(t){var e=t[0]/255,n=t[1]/255,i=t[2]/255;return[100*(.4124*(e=e>.04045?Math.pow((e+.055)/1.055,2.4):e/12.92)+.3576*(n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92)+.1805*(i=i>.04045?Math.pow((i+.055)/1.055,2.4):i/12.92)),100*(.2126*e+.7152*n+.0722*i),100*(.0193*e+.1192*n+.9505*i)]}function d(t){var e,n,i,a=u(t),r=a[0],o=a[1],s=a[2];return r/=95.047,o/=100,s/=108.883,r=r>.008856?Math.pow(r,1/3):7.787*r+16/116,o=o>.008856?Math.pow(o,1/3):7.787*o+16/116,s=s>.008856?Math.pow(s,1/3):7.787*s+16/116,e=116*o-16,n=500*(r-o),i=200*(o-s),[e,n,i]}function c(t){var e,n,i,a,r,o=t[0]/360,s=t[1]/100,l=t[2]/100;if(0==s)return r=255*l,[r,r,r];e=2*l-(n=l<.5?l*(1+s):l+s-l*s),a=[0,0,0];for(var u=0;u<3;u++)(i=o+1/3*-(u-1))<0&&i++,i>1&&i--,r=6*i<1?e+6*(n-e)*i:2*i<1?n:3*i<2?e+(n-e)*(2/3-i)*6:e,a[u]=255*r;return a}function h(t){var e=t[0]/60,n=t[1]/100,i=t[2]/100,a=Math.floor(e)%6,r=e-Math.floor(e),o=255*i*(1-n),s=255*i*(1-n*r),l=255*i*(1-n*(1-r)),i=255*i;switch(a){case 0:return[i,l,o];case 1:return[s,i,o];case 2:return[o,i,l];case 3:return[o,s,i];case 4:return[l,o,i];case 5:return[i,o,s]}}function f(t){var e,n,i,a,o=t[0]/360,s=t[1]/100,l=t[2]/100,u=s+l;switch(u>1&&(s/=u,l/=u),e=Math.floor(6*o),n=1-l,i=6*o-e,0!=(1&e)&&(i=1-i),a=s+i*(n-s),e){default:case 6:case 0:r=n,g=a,b=s;break;case 1:r=a,g=n,b=s;break;case 2:r=s,g=n,b=a;break;case 3:r=s,g=a,b=n;break;case 4:r=a,g=s,b=n;break;case 5:r=n,g=s,b=a}return[255*r,255*g,255*b]}function m(t){var e,n,i,a=t[0]/100,r=t[1]/100,o=t[2]/100,s=t[3]/100;return e=1-Math.min(1,a*(1-s)+s),n=1-Math.min(1,r*(1-s)+s),i=1-Math.min(1,o*(1-s)+s),[255*e,255*n,255*i]}function p(t){var e,n,i,a=t[0]/100,r=t[1]/100,o=t[2]/100;return e=3.2406*a+-1.5372*r+-.4986*o,n=-.9689*a+1.8758*r+.0415*o,i=.0557*a+-.204*r+1.057*o,e=e>.0031308?1.055*Math.pow(e,1/2.4)-.055:e*=12.92,n=n>.0031308?1.055*Math.pow(n,1/2.4)-.055:n*=12.92,i=i>.0031308?1.055*Math.pow(i,1/2.4)-.055:i*=12.92,e=Math.min(Math.max(0,e),1),n=Math.min(Math.max(0,n),1),i=Math.min(Math.max(0,i),1),[255*e,255*n,255*i]}function v(t){var e,n,i,a=t[0],r=t[1],o=t[2];return a/=95.047,r/=100,o/=108.883,a=a>.008856?Math.pow(a,1/3):7.787*a+16/116,r=r>.008856?Math.pow(r,1/3):7.787*r+16/116,o=o>.008856?Math.pow(o,1/3):7.787*o+16/116,e=116*r-16,n=500*(a-r),i=200*(r-o),[e,n,i]}function y(t){var e,n,i,a,r=t[0],o=t[1],s=t[2];return r<=8?a=(n=100*r/903.3)/100*7.787+16/116:(n=100*Math.pow((r+16)/116,3),a=Math.pow(n/100,1/3)),e=e/95.047<=.008856?e=95.047*(o/500+a-16/116)/7.787:95.047*Math.pow(o/500+a,3),i=i/108.883<=.008859?i=108.883*(a-s/200-16/116)/7.787:108.883*Math.pow(a-s/200,3),[e,n,i]}function x(t){var e,n,i,a=t[0],r=t[1],o=t[2];return e=Math.atan2(o,r),(n=360*e/2/Math.PI)<0&&(n+=360),i=Math.sqrt(r*r+o*o),[a,i,n]}function _(t){return p(y(t))}function k(t){var e,n,i,a=t[0],r=t[1];return i=t[2]/360*2*Math.PI,e=r*Math.cos(i),n=r*Math.sin(i),[a,e,n]}function w(t){return M[t]}e.exports={rgb2hsl:i,rgb2hsv:a,rgb2hwb:o,rgb2cmyk:s,rgb2keyword:l,rgb2xyz:u,rgb2lab:d,rgb2lch:function(t){return x(d(t))},hsl2rgb:c,hsl2hsv:function(t){var e,n,i=t[0],a=t[1]/100,r=t[2]/100;return 0===r?[0,0,0]:(r*=2,a*=r<=1?r:2-r,n=(r+a)/2,e=2*a/(r+a),[i,100*e,100*n])},hsl2hwb:function(t){return o(c(t))},hsl2cmyk:function(t){return s(c(t))},hsl2keyword:function(t){return l(c(t))},hsv2rgb:h,hsv2hsl:function(t){var e,n,i=t[0],a=t[1]/100,r=t[2]/100;return n=(2-a)*r,e=a*r,e/=n<=1?n:2-n,e=e||0,n/=2,[i,100*e,100*n]},hsv2hwb:function(t){return o(h(t))},hsv2cmyk:function(t){return s(h(t))},hsv2keyword:function(t){return l(h(t))},hwb2rgb:f,hwb2hsl:function(t){return i(f(t))},hwb2hsv:function(t){return a(f(t))},hwb2cmyk:function(t){return s(f(t))},hwb2keyword:function(t){return l(f(t))},cmyk2rgb:m,cmyk2hsl:function(t){return i(m(t))},cmyk2hsv:function(t){return a(m(t))},cmyk2hwb:function(t){return o(m(t))},cmyk2keyword:function(t){return l(m(t))},keyword2rgb:w,keyword2hsl:function(t){return i(w(t))},keyword2hsv:function(t){return a(w(t))},keyword2hwb:function(t){return o(w(t))},keyword2cmyk:function(t){return s(w(t))},keyword2lab:function(t){return d(w(t))},keyword2xyz:function(t){return u(w(t))},xyz2rgb:p,xyz2lab:v,xyz2lch:function(t){return x(v(t))},lab2xyz:y,lab2rgb:_,lab2lch:x,lch2lab:k,lch2xyz:function(t){return y(k(t))},lch2rgb:function(t){return _(k(t))}};var M={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},S={};for(var D in M)S[JSON.stringify(M[D])]=D},{}],4:[function(t,e,n){var i=t(3),a=function(){return new u};for(var r in i){a[r+"Raw"]=function(t){return function(e){return"number"==typeof e&&(e=Array.prototype.slice.call(arguments)),i[t](e)}}(r);var o=/(\w+)2(\w+)/.exec(r),s=o[1],l=o[2];(a[s]=a[s]||{})[l]=a[r]=function(t){return function(e){"number"==typeof e&&(e=Array.prototype.slice.call(arguments));var n=i[t](e);if("string"==typeof n||void 0===n)return n;for(var a=0;a<n.length;a++)n[a]=Math.round(n[a]);return n}}(r)}var u=function(){this.convs={}};u.prototype.routeSpace=function(t,e){var n=e[0];return void 0===n?this.getValues(t):("number"==typeof n&&(n=Array.prototype.slice.call(e)),this.setValues(t,n))},u.prototype.setValues=function(t,e){return this.space=t,this.convs={},this.convs[t]=e,this},u.prototype.getValues=function(t){var e=this.convs[t];if(!e){var n=this.space,i=this.convs[n];e=a[n][t](i),this.convs[t]=e}return e},["rgb","hsl","hsv","cmyk","keyword"].forEach(function(t){u.prototype[t]=function(e){return this.routeSpace(t,arguments)}}),e.exports=a},{3:3}],5:[function(t,e,n){"use strict";e.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},{}],6:[function(t,e,n){!function(t,i){"object"==typeof n&&void 0!==e?e.exports=i():t.moment=i()}(this,function(){"use strict";function n(){return xe.apply(null,arguments)}function i(t){return t instanceof Array||"[object Array]"===Object.prototype.toString.call(t)}function a(t){return null!=t&&"[object Object]"===Object.prototype.toString.call(t)}function r(t){var e;for(e in t)return!1;return!0}function o(t){return void 0===t}function s(t){return"number"==typeof t||"[object Number]"===Object.prototype.toString.call(t)}function l(t){return t instanceof Date||"[object Date]"===Object.prototype.toString.call(t)}function u(t,e){var n,i=[];for(n=0;n<t.length;++n)i.push(e(t[n],n));return i}function d(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function c(t,e){for(var n in e)d(e,n)&&(t[n]=e[n]);return d(e,"toString")&&(t.toString=e.toString),d(e,"valueOf")&&(t.valueOf=e.valueOf),t}function h(t,e,n,i){return Yt(t,e,n,i,!0).utc()}function f(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],meridiem:null,rfc2822:!1,weekdayMismatch:!1}}function g(t){return null==t._pf&&(t._pf=f()),t._pf}function m(t){if(null==t._isValid){var e=g(t),n=ke.call(e.parsedDateParts,function(t){return null!=t}),i=!isNaN(t._d.getTime())&&e.overflow<0&&!e.empty&&!e.invalidMonth&&!e.invalidWeekday&&!e.nullInput&&!e.invalidFormat&&!e.userInvalidated&&(!e.meridiem||e.meridiem&&n);if(t._strict&&(i=i&&0===e.charsLeftOver&&0===e.unusedTokens.length&&void 0===e.bigHour),null!=Object.isFrozen&&Object.isFrozen(t))return i;t._isValid=i}return t._isValid}function p(t){var e=h(NaN);return null!=t?c(g(e),t):g(e).userInvalidated=!0,e}function v(t,e){var n,i,a;if(o(e._isAMomentObject)||(t._isAMomentObject=e._isAMomentObject),o(e._i)||(t._i=e._i),o(e._f)||(t._f=e._f),o(e._l)||(t._l=e._l),o(e._strict)||(t._strict=e._strict),o(e._tzm)||(t._tzm=e._tzm),o(e._isUTC)||(t._isUTC=e._isUTC),o(e._offset)||(t._offset=e._offset),o(e._pf)||(t._pf=g(e)),o(e._locale)||(t._locale=e._locale),we.length>0)for(n=0;n<we.length;n++)o(a=e[i=we[n]])||(t[i]=a);return t}function y(t){v(this,t),this._d=new Date(null!=t._d?t._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),!1===Me&&(Me=!0,n.updateOffset(this),Me=!1)}function b(t){return t instanceof y||null!=t&&null!=t._isAMomentObject}function x(t){return t<0?Math.ceil(t)||0:Math.floor(t)}function _(t){var e=+t,n=0;return 0!==e&&isFinite(e)&&(n=x(e)),n}function k(t,e,n){var i,a=Math.min(t.length,e.length),r=Math.abs(t.length-e.length),o=0;for(i=0;i<a;i++)(n&&t[i]!==e[i]||!n&&_(t[i])!==_(e[i]))&&o++;return o+r}function w(t){!1===n.suppressDeprecationWarnings&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+t)}function M(t,e){var i=!0;return c(function(){if(null!=n.deprecationHandler&&n.deprecationHandler(null,t),i){for(var a,r=[],o=0;o<arguments.length;o++){if(a="","object"==typeof arguments[o]){a+="\n["+o+"] ";for(var s in arguments[0])a+=s+": "+arguments[0][s]+", ";a=a.slice(0,-2)}else a=arguments[o];r.push(a)}w(t+"\nArguments: "+Array.prototype.slice.call(r).join("")+"\n"+(new Error).stack),i=!1}return e.apply(this,arguments)},e)}function S(t,e){null!=n.deprecationHandler&&n.deprecationHandler(t,e),Se[t]||(w(e),Se[t]=!0)}function D(t){return t instanceof Function||"[object Function]"===Object.prototype.toString.call(t)}function C(t,e){var n,i=c({},t);for(n in e)d(e,n)&&(a(t[n])&&a(e[n])?(i[n]={},c(i[n],t[n]),c(i[n],e[n])):null!=e[n]?i[n]=e[n]:delete i[n]);for(n in t)d(t,n)&&!d(e,n)&&a(t[n])&&(i[n]=c({},i[n]));return i}function P(t){null!=t&&this.set(t)}function T(t,e){var n=t.toLowerCase();Fe[n]=Fe[n+"s"]=Fe[e]=t}function I(t){return"string"==typeof t?Fe[t]||Fe[t.toLowerCase()]:void 0}function A(t){var e,n,i={};for(n in t)d(t,n)&&(e=I(n))&&(i[e]=t[n]);return i}function O(t,e){Re[t]=e}function F(t){var e=[];for(var n in t)e.push({unit:n,priority:Re[n]});return e.sort(function(t,e){return t.priority-e.priority}),e}function R(t,e){return function(i){return null!=i?(W(this,t,i),n.updateOffset(this,e),this):L(this,t)}}function L(t,e){return t.isValid()?t._d["get"+(t._isUTC?"UTC":"")+e]():NaN}function W(t,e,n){t.isValid()&&t._d["set"+(t._isUTC?"UTC":"")+e](n)}function Y(t,e,n){var i=""+Math.abs(t),a=e-i.length;return(t>=0?n?"+":"":"-")+Math.pow(10,Math.max(0,a)).toString().substr(1)+i}function N(t,e,n,i){var a=i;"string"==typeof i&&(a=function(){return this[i]()}),t&&(Ne[t]=a),e&&(Ne[e[0]]=function(){return Y(a.apply(this,arguments),e[1],e[2])}),n&&(Ne[n]=function(){return this.localeData().ordinal(a.apply(this,arguments),t)})}function z(t){return t.match(/\[[\s\S]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"")}function B(t){var e,n,i=t.match(Le);for(e=0,n=i.length;e<n;e++)Ne[i[e]]?i[e]=Ne[i[e]]:i[e]=z(i[e]);return function(e){var a,r="";for(a=0;a<n;a++)r+=D(i[a])?i[a].call(e,t):i[a];return r}}function V(t,e){return t.isValid()?(e=H(e,t.localeData()),Ye[e]=Ye[e]||B(e),Ye[e](t)):t.localeData().invalidDate()}function H(t,e){var n=5;for(We.lastIndex=0;n>=0&&We.test(t);)t=t.replace(We,function(t){return e.longDateFormat(t)||t}),We.lastIndex=0,n-=1;return t}function E(t,e,n){nn[t]=D(e)?e:function(t,i){return t&&n?n:e}}function j(t,e){return d(nn,t)?nn[t](e._strict,e._locale):new RegExp(U(t))}function U(t){return q(t.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(t,e,n,i,a){return e||n||i||a}))}function q(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function G(t,e){var n,i=e;for("string"==typeof t&&(t=[t]),s(e)&&(i=function(t,n){n[e]=_(t)}),n=0;n<t.length;n++)an[t[n]]=i}function Z(t,e){G(t,function(t,n,i,a){i._w=i._w||{},e(t,i._w,i,a)})}function X(t,e,n){null!=e&&d(an,t)&&an[t](e,n._a,n,t)}function J(t,e){return new Date(Date.UTC(t,e+1,0)).getUTCDate()}function K(t,e,n){var i,a,r,o=t.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],i=0;i<12;++i)r=h([2e3,i]),this._shortMonthsParse[i]=this.monthsShort(r,"").toLocaleLowerCase(),this._longMonthsParse[i]=this.months(r,"").toLocaleLowerCase();return n?"MMM"===e?-1!==(a=gn.call(this._shortMonthsParse,o))?a:null:-1!==(a=gn.call(this._longMonthsParse,o))?a:null:"MMM"===e?-1!==(a=gn.call(this._shortMonthsParse,o))?a:-1!==(a=gn.call(this._longMonthsParse,o))?a:null:-1!==(a=gn.call(this._longMonthsParse,o))?a:-1!==(a=gn.call(this._shortMonthsParse,o))?a:null}function Q(t,e){var n;if(!t.isValid())return t;if("string"==typeof e)if(/^\d+$/.test(e))e=_(e);else if(e=t.localeData().monthsParse(e),!s(e))return t;return n=Math.min(t.date(),J(t.year(),e)),t._d["set"+(t._isUTC?"UTC":"")+"Month"](e,n),t}function $(t){return null!=t?(Q(this,t),n.updateOffset(this,!0),this):L(this,"Month")}function tt(){function t(t,e){return e.length-t.length}var e,n,i=[],a=[],r=[];for(e=0;e<12;e++)n=h([2e3,e]),i.push(this.monthsShort(n,"")),a.push(this.months(n,"")),r.push(this.months(n,"")),r.push(this.monthsShort(n,""));for(i.sort(t),a.sort(t),r.sort(t),e=0;e<12;e++)i[e]=q(i[e]),a[e]=q(a[e]);for(e=0;e<24;e++)r[e]=q(r[e]);this._monthsRegex=new RegExp("^("+r.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+a.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+i.join("|")+")","i")}function et(t){return nt(t)?366:365}function nt(t){return t%4==0&&t%100!=0||t%400==0}function it(t,e,n,i,a,r,o){var s=new Date(t,e,n,i,a,r,o);return t<100&&t>=0&&isFinite(s.getFullYear())&&s.setFullYear(t),s}function at(t){var e=new Date(Date.UTC.apply(null,arguments));return t<100&&t>=0&&isFinite(e.getUTCFullYear())&&e.setUTCFullYear(t),e}function rt(t,e,n){var i=7+e-n;return-((7+at(t,0,i).getUTCDay()-e)%7)+i-1}function ot(t,e,n,i,a){var r,o,s=1+7*(e-1)+(7+n-i)%7+rt(t,i,a);return s<=0?o=et(r=t-1)+s:s>et(t)?(r=t+1,o=s-et(t)):(r=t,o=s),{year:r,dayOfYear:o}}function st(t,e,n){var i,a,r=rt(t.year(),e,n),o=Math.floor((t.dayOfYear()-r-1)/7)+1;return o<1?i=o+lt(a=t.year()-1,e,n):o>lt(t.year(),e,n)?(i=o-lt(t.year(),e,n),a=t.year()+1):(a=t.year(),i=o),{week:i,year:a}}function lt(t,e,n){var i=rt(t,e,n),a=rt(t+1,e,n);return(et(t)-i+a)/7}function ut(t,e){return"string"!=typeof t?t:isNaN(t)?"number"==typeof(t=e.weekdaysParse(t))?t:null:parseInt(t,10)}function dt(t,e){return"string"==typeof t?e.weekdaysParse(t)%7||7:isNaN(t)?null:t}function ct(t,e,n){var i,a,r,o=t.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],i=0;i<7;++i)r=h([2e3,1]).day(i),this._minWeekdaysParse[i]=this.weekdaysMin(r,"").toLocaleLowerCase(),this._shortWeekdaysParse[i]=this.weekdaysShort(r,"").toLocaleLowerCase(),this._weekdaysParse[i]=this.weekdays(r,"").toLocaleLowerCase();return n?"dddd"===e?-1!==(a=gn.call(this._weekdaysParse,o))?a:null:"ddd"===e?-1!==(a=gn.call(this._shortWeekdaysParse,o))?a:null:-1!==(a=gn.call(this._minWeekdaysParse,o))?a:null:"dddd"===e?-1!==(a=gn.call(this._weekdaysParse,o))?a:-1!==(a=gn.call(this._shortWeekdaysParse,o))?a:-1!==(a=gn.call(this._minWeekdaysParse,o))?a:null:"ddd"===e?-1!==(a=gn.call(this._shortWeekdaysParse,o))?a:-1!==(a=gn.call(this._weekdaysParse,o))?a:-1!==(a=gn.call(this._minWeekdaysParse,o))?a:null:-1!==(a=gn.call(this._minWeekdaysParse,o))?a:-1!==(a=gn.call(this._weekdaysParse,o))?a:-1!==(a=gn.call(this._shortWeekdaysParse,o))?a:null}function ht(){function t(t,e){return e.length-t.length}var e,n,i,a,r,o=[],s=[],l=[],u=[];for(e=0;e<7;e++)n=h([2e3,1]).day(e),i=this.weekdaysMin(n,""),a=this.weekdaysShort(n,""),r=this.weekdays(n,""),o.push(i),s.push(a),l.push(r),u.push(i),u.push(a),u.push(r);for(o.sort(t),s.sort(t),l.sort(t),u.sort(t),e=0;e<7;e++)s[e]=q(s[e]),l[e]=q(l[e]),u[e]=q(u[e]);this._weekdaysRegex=new RegExp("^("+u.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+l.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+s.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+o.join("|")+")","i")}function ft(){return this.hours()%12||12}function gt(t,e){N(t,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),e)})}function mt(t,e){return e._meridiemParse}function pt(t){return t?t.toLowerCase().replace("_","-"):t}function vt(t){for(var e,n,i,a,r=0;r<t.length;){for(e=(a=pt(t[r]).split("-")).length,n=(n=pt(t[r+1]))?n.split("-"):null;e>0;){if(i=yt(a.slice(0,e).join("-")))return i;if(n&&n.length>=e&&k(a,n,!0)>=e-1)break;e--}r++}return null}function yt(n){var i=null;if(!On[n]&&void 0!==e&&e&&e.exports)try{i=Pn._abbr,t("./locale/"+n),bt(i)}catch(t){}return On[n]}function bt(t,e){var n;return t&&(n=o(e)?_t(t):xt(t,e))&&(Pn=n),Pn._abbr}function xt(t,e){if(null!==e){var n=An;if(e.abbr=t,null!=On[t])S("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),n=On[t]._config;else if(null!=e.parentLocale){if(null==On[e.parentLocale])return Fn[e.parentLocale]||(Fn[e.parentLocale]=[]),Fn[e.parentLocale].push({name:t,config:e}),null;n=On[e.parentLocale]._config}return On[t]=new P(C(n,e)),Fn[t]&&Fn[t].forEach(function(t){xt(t.name,t.config)}),bt(t),On[t]}return delete On[t],null}function _t(t){var e;if(t&&t._locale&&t._locale._abbr&&(t=t._locale._abbr),!t)return Pn;if(!i(t)){if(e=yt(t))return e;t=[t]}return vt(t)}function kt(t){var e,n=t._a;return n&&-2===g(t).overflow&&(e=n[on]<0||n[on]>11?on:n[sn]<1||n[sn]>J(n[rn],n[on])?sn:n[ln]<0||n[ln]>24||24===n[ln]&&(0!==n[un]||0!==n[dn]||0!==n[cn])?ln:n[un]<0||n[un]>59?un:n[dn]<0||n[dn]>59?dn:n[cn]<0||n[cn]>999?cn:-1,g(t)._overflowDayOfYear&&(e<rn||e>sn)&&(e=sn),g(t)._overflowWeeks&&-1===e&&(e=hn),g(t)._overflowWeekday&&-1===e&&(e=fn),g(t).overflow=e),t}function wt(t){var e,n,i,a,r,o,s=t._i,l=Rn.exec(s)||Ln.exec(s);if(l){for(g(t).iso=!0,e=0,n=Yn.length;e<n;e++)if(Yn[e][1].exec(l[1])){a=Yn[e][0],i=!1!==Yn[e][2];break}if(null==a)return void(t._isValid=!1);if(l[3]){for(e=0,n=Nn.length;e<n;e++)if(Nn[e][1].exec(l[3])){r=(l[2]||" ")+Nn[e][0];break}if(null==r)return void(t._isValid=!1)}if(!i&&null!=r)return void(t._isValid=!1);if(l[4]){if(!Wn.exec(l[4]))return void(t._isValid=!1);o="Z"}t._f=a+(r||"")+(o||""),It(t)}else t._isValid=!1}function Mt(t){var e,n,i,a,r,o,s,l,u={" GMT":" +0000"," EDT":" -0400"," EST":" -0500"," CDT":" -0500"," CST":" -0600"," MDT":" -0600"," MST":" -0700"," PDT":" -0700"," PST":" -0800"};if(e=t._i.replace(/\([^\)]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s|\s$/g,""),n=Bn.exec(e)){if(i=n[1]?"ddd"+(5===n[1].length?", ":" "):"",a="D MMM "+(n[2].length>10?"YYYY ":"YY "),r="HH:mm"+(n[4]?":ss":""),n[1]){var d=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][new Date(n[2]).getDay()];if(n[1].substr(0,3)!==d)return g(t).weekdayMismatch=!0,void(t._isValid=!1)}switch(n[5].length){case 2:s=0===l?" +0000":((l="YXWVUTSRQPONZABCDEFGHIKLM".indexOf(n[5][1].toUpperCase())-12)<0?" -":" +")+(""+l).replace(/^-?/,"0").match(/..$/)[0]+"00";break;case 4:s=u[n[5]];break;default:s=u[" GMT"]}n[5]=s,t._i=n.splice(1).join(""),o=" ZZ",t._f=i+a+r+o,It(t),g(t).rfc2822=!0}else t._isValid=!1}function St(t){var e=zn.exec(t._i);null===e?(wt(t),!1===t._isValid&&(delete t._isValid,Mt(t),!1===t._isValid&&(delete t._isValid,n.createFromInputFallback(t)))):t._d=new Date(+e[1])}function Dt(t,e,n){return null!=t?t:null!=e?e:n}function Ct(t){var e=new Date(n.now());return t._useUTC?[e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()]:[e.getFullYear(),e.getMonth(),e.getDate()]}function Pt(t){var e,n,i,a,r=[];if(!t._d){for(i=Ct(t),t._w&&null==t._a[sn]&&null==t._a[on]&&Tt(t),null!=t._dayOfYear&&(a=Dt(t._a[rn],i[rn]),(t._dayOfYear>et(a)||0===t._dayOfYear)&&(g(t)._overflowDayOfYear=!0),n=at(a,0,t._dayOfYear),t._a[on]=n.getUTCMonth(),t._a[sn]=n.getUTCDate()),e=0;e<3&&null==t._a[e];++e)t._a[e]=r[e]=i[e];for(;e<7;e++)t._a[e]=r[e]=null==t._a[e]?2===e?1:0:t._a[e];24===t._a[ln]&&0===t._a[un]&&0===t._a[dn]&&0===t._a[cn]&&(t._nextDay=!0,t._a[ln]=0),t._d=(t._useUTC?at:it).apply(null,r),null!=t._tzm&&t._d.setUTCMinutes(t._d.getUTCMinutes()-t._tzm),t._nextDay&&(t._a[ln]=24)}}function Tt(t){var e,n,i,a,r,o,s,l;if(null!=(e=t._w).GG||null!=e.W||null!=e.E)r=1,o=4,n=Dt(e.GG,t._a[rn],st(Nt(),1,4).year),i=Dt(e.W,1),((a=Dt(e.E,1))<1||a>7)&&(l=!0);else{r=t._locale._week.dow,o=t._locale._week.doy;var u=st(Nt(),r,o);n=Dt(e.gg,t._a[rn],u.year),i=Dt(e.w,u.week),null!=e.d?((a=e.d)<0||a>6)&&(l=!0):null!=e.e?(a=e.e+r,(e.e<0||e.e>6)&&(l=!0)):a=r}i<1||i>lt(n,r,o)?g(t)._overflowWeeks=!0:null!=l?g(t)._overflowWeekday=!0:(s=ot(n,i,a,r,o),t._a[rn]=s.year,t._dayOfYear=s.dayOfYear)}function It(t){if(t._f!==n.ISO_8601)if(t._f!==n.RFC_2822){t._a=[],g(t).empty=!0;var e,i,a,r,o,s=""+t._i,l=s.length,u=0;for(a=H(t._f,t._locale).match(Le)||[],e=0;e<a.length;e++)r=a[e],(i=(s.match(j(r,t))||[])[0])&&((o=s.substr(0,s.indexOf(i))).length>0&&g(t).unusedInput.push(o),s=s.slice(s.indexOf(i)+i.length),u+=i.length),Ne[r]?(i?g(t).empty=!1:g(t).unusedTokens.push(r),X(r,i,t)):t._strict&&!i&&g(t).unusedTokens.push(r);g(t).charsLeftOver=l-u,s.length>0&&g(t).unusedInput.push(s),t._a[ln]<=12&&!0===g(t).bigHour&&t._a[ln]>0&&(g(t).bigHour=void 0),g(t).parsedDateParts=t._a.slice(0),g(t).meridiem=t._meridiem,t._a[ln]=At(t._locale,t._a[ln],t._meridiem),Pt(t),kt(t)}else Mt(t);else wt(t)}function At(t,e,n){var i;return null==n?e:null!=t.meridiemHour?t.meridiemHour(e,n):null!=t.isPM?((i=t.isPM(n))&&e<12&&(e+=12),i||12!==e||(e=0),e):e}function Ot(t){var e,n,i,a,r;if(0===t._f.length)return g(t).invalidFormat=!0,void(t._d=new Date(NaN));for(a=0;a<t._f.length;a++)r=0,e=v({},t),null!=t._useUTC&&(e._useUTC=t._useUTC),e._f=t._f[a],It(e),m(e)&&(r+=g(e).charsLeftOver,r+=10*g(e).unusedTokens.length,g(e).score=r,(null==i||r<i)&&(i=r,n=e));c(t,n||e)}function Ft(t){if(!t._d){var e=A(t._i);t._a=u([e.year,e.month,e.day||e.date,e.hour,e.minute,e.second,e.millisecond],function(t){return t&&parseInt(t,10)}),Pt(t)}}function Rt(t){var e=new y(kt(Lt(t)));return e._nextDay&&(e.add(1,"d"),e._nextDay=void 0),e}function Lt(t){var e=t._i,n=t._f;return t._locale=t._locale||_t(t._l),null===e||void 0===n&&""===e?p({nullInput:!0}):("string"==typeof e&&(t._i=e=t._locale.preparse(e)),b(e)?new y(kt(e)):(l(e)?t._d=e:i(n)?Ot(t):n?It(t):Wt(t),m(t)||(t._d=null),t))}function Wt(t){var e=t._i;o(e)?t._d=new Date(n.now()):l(e)?t._d=new Date(e.valueOf()):"string"==typeof e?St(t):i(e)?(t._a=u(e.slice(0),function(t){return parseInt(t,10)}),Pt(t)):a(e)?Ft(t):s(e)?t._d=new Date(e):n.createFromInputFallback(t)}function Yt(t,e,n,o,s){var l={};return!0!==n&&!1!==n||(o=n,n=void 0),(a(t)&&r(t)||i(t)&&0===t.length)&&(t=void 0),l._isAMomentObject=!0,l._useUTC=l._isUTC=s,l._l=n,l._i=t,l._f=e,l._strict=o,Rt(l)}function Nt(t,e,n,i){return Yt(t,e,n,i,!1)}function zt(t,e){var n,a;if(1===e.length&&i(e[0])&&(e=e[0]),!e.length)return Nt();for(n=e[0],a=1;a<e.length;++a)e[a].isValid()&&!e[a][t](n)||(n=e[a]);return n}function Bt(t){for(var e in t)if(-1===En.indexOf(e)||null!=t[e]&&isNaN(t[e]))return!1;for(var n=!1,i=0;i<En.length;++i)if(t[En[i]]){if(n)return!1;parseFloat(t[En[i]])!==_(t[En[i]])&&(n=!0)}return!0}function Vt(t){var e=A(t),n=e.year||0,i=e.quarter||0,a=e.month||0,r=e.week||0,o=e.day||0,s=e.hour||0,l=e.minute||0,u=e.second||0,d=e.millisecond||0;this._isValid=Bt(e),this._milliseconds=+d+1e3*u+6e4*l+1e3*s*60*60,this._days=+o+7*r,this._months=+a+3*i+12*n,this._data={},this._locale=_t(),this._bubble()}function Ht(t){return t instanceof Vt}function Et(t){return t<0?-1*Math.round(-1*t):Math.round(t)}function jt(t,e){N(t,0,0,function(){var t=this.utcOffset(),n="+";return t<0&&(t=-t,n="-"),n+Y(~~(t/60),2)+e+Y(~~t%60,2)})}function Ut(t,e){var n=(e||"").match(t);if(null===n)return null;var i=((n[n.length-1]||[])+"").match(jn)||["-",0,0],a=60*i[1]+_(i[2]);return 0===a?0:"+"===i[0]?a:-a}function qt(t,e){var i,a;return e._isUTC?(i=e.clone(),a=(b(t)||l(t)?t.valueOf():Nt(t).valueOf())-i.valueOf(),i._d.setTime(i._d.valueOf()+a),n.updateOffset(i,!1),i):Nt(t).local()}function Gt(t){return 15*-Math.round(t._d.getTimezoneOffset()/15)}function Zt(){return!!this.isValid()&&(this._isUTC&&0===this._offset)}function Xt(t,e){var n,i,a,r=t,o=null;return Ht(t)?r={ms:t._milliseconds,d:t._days,M:t._months}:s(t)?(r={},e?r[e]=t:r.milliseconds=t):(o=Un.exec(t))?(n="-"===o[1]?-1:1,r={y:0,d:_(o[sn])*n,h:_(o[ln])*n,m:_(o[un])*n,s:_(o[dn])*n,ms:_(Et(1e3*o[cn]))*n}):(o=qn.exec(t))?(n="-"===o[1]?-1:1,r={y:Jt(o[2],n),M:Jt(o[3],n),w:Jt(o[4],n),d:Jt(o[5],n),h:Jt(o[6],n),m:Jt(o[7],n),s:Jt(o[8],n)}):null==r?r={}:"object"==typeof r&&("from"in r||"to"in r)&&(a=Qt(Nt(r.from),Nt(r.to)),(r={}).ms=a.milliseconds,r.M=a.months),i=new Vt(r),Ht(t)&&d(t,"_locale")&&(i._locale=t._locale),i}function Jt(t,e){var n=t&&parseFloat(t.replace(",","."));return(isNaN(n)?0:n)*e}function Kt(t,e){var n={milliseconds:0,months:0};return n.months=e.month()-t.month()+12*(e.year()-t.year()),t.clone().add(n.months,"M").isAfter(e)&&--n.months,n.milliseconds=+e-+t.clone().add(n.months,"M"),n}function Qt(t,e){var n;return t.isValid()&&e.isValid()?(e=qt(e,t),t.isBefore(e)?n=Kt(t,e):((n=Kt(e,t)).milliseconds=-n.milliseconds,n.months=-n.months),n):{milliseconds:0,months:0}}function $t(t,e){return function(n,i){var a,r;return null===i||isNaN(+i)||(S(e,"moment()."+e+"(period, number) is deprecated. Please use moment()."+e+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),r=n,n=i,i=r),n="string"==typeof n?+n:n,a=Xt(n,i),te(this,a,t),this}}function te(t,e,i,a){var r=e._milliseconds,o=Et(e._days),s=Et(e._months);t.isValid()&&(a=null==a||a,r&&t._d.setTime(t._d.valueOf()+r*i),o&&W(t,"Date",L(t,"Date")+o*i),s&&Q(t,L(t,"Month")+s*i),a&&n.updateOffset(t,o||s))}function ee(t,e){var n,i=12*(e.year()-t.year())+(e.month()-t.month()),a=t.clone().add(i,"months");return n=e-a<0?(e-a)/(a-t.clone().add(i-1,"months")):(e-a)/(t.clone().add(i+1,"months")-a),-(i+n)||0}function ne(t){var e;return void 0===t?this._locale._abbr:(null!=(e=_t(t))&&(this._locale=e),this)}function ie(){return this._locale}function ae(t,e){N(0,[t,t.length],0,e)}function re(t,e,n,i,a){var r;return null==t?st(this,i,a).year:(r=lt(t,i,a),e>r&&(e=r),oe.call(this,t,e,n,i,a))}function oe(t,e,n,i,a){var r=ot(t,e,n,i,a),o=at(r.year,0,r.dayOfYear);return this.year(o.getUTCFullYear()),this.month(o.getUTCMonth()),this.date(o.getUTCDate()),this}function se(t){return t}function le(t,e,n,i){var a=_t(),r=h().set(i,e);return a[n](r,t)}function ue(t,e,n){if(s(t)&&(e=t,t=void 0),t=t||"",null!=e)return le(t,e,n,"month");var i,a=[];for(i=0;i<12;i++)a[i]=le(t,i,n,"month");return a}function de(t,e,n,i){"boolean"==typeof t?(s(e)&&(n=e,e=void 0),e=e||""):(n=e=t,t=!1,s(e)&&(n=e,e=void 0),e=e||"");var a=_t(),r=t?a._week.dow:0;if(null!=n)return le(e,(n+r)%7,i,"day");var o,l=[];for(o=0;o<7;o++)l[o]=le(e,(o+r)%7,i,"day");return l}function ce(t,e,n,i){var a=Xt(e,n);return t._milliseconds+=i*a._milliseconds,t._days+=i*a._days,t._months+=i*a._months,t._bubble()}function he(t){return t<0?Math.floor(t):Math.ceil(t)}function fe(t){return 4800*t/146097}function ge(t){return 146097*t/4800}function me(t){return function(){return this.as(t)}}function pe(t){return function(){return this.isValid()?this._data[t]:NaN}}function ve(t,e,n,i,a){return a.relativeTime(e||1,!!n,t,i)}function ye(t,e,n){var i=Xt(t).abs(),a=bi(i.as("s")),r=bi(i.as("m")),o=bi(i.as("h")),s=bi(i.as("d")),l=bi(i.as("M")),u=bi(i.as("y")),d=a<=xi.ss&&["s",a]||a<xi.s&&["ss",a]||r<=1&&["m"]||r<xi.m&&["mm",r]||o<=1&&["h"]||o<xi.h&&["hh",o]||s<=1&&["d"]||s<xi.d&&["dd",s]||l<=1&&["M"]||l<xi.M&&["MM",l]||u<=1&&["y"]||["yy",u];return d[2]=e,d[3]=+t>0,d[4]=n,ve.apply(null,d)}function be(){if(!this.isValid())return this.localeData().invalidDate();var t,e,n,i=_i(this._milliseconds)/1e3,a=_i(this._days),r=_i(this._months);e=x((t=x(i/60))/60),i%=60,t%=60;var o=n=x(r/12),s=r%=12,l=a,u=e,d=t,c=i,h=this.asSeconds();return h?(h<0?"-":"")+"P"+(o?o+"Y":"")+(s?s+"M":"")+(l?l+"D":"")+(u||d||c?"T":"")+(u?u+"H":"")+(d?d+"M":"")+(c?c+"S":""):"P0D"}var xe,_e,ke=_e=Array.prototype.some?Array.prototype.some:function(t){for(var e=Object(this),n=e.length>>>0,i=0;i<n;i++)if(i in e&&t.call(this,e[i],i,e))return!0;return!1},we=n.momentProperties=[],Me=!1,Se={};n.suppressDeprecationWarnings=!1,n.deprecationHandler=null;var De,Ce,Pe=De=Object.keys?Object.keys:function(t){var e,n=[];for(e in t)d(t,e)&&n.push(e);return n},Te={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},Ie={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},Ae=/\d{1,2}/,Oe={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},Fe={},Re={},Le=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,We=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Ye={},Ne={},ze=/\d/,Be=/\d\d/,Ve=/\d{3}/,He=/\d{4}/,Ee=/[+-]?\d{6}/,je=/\d\d?/,Ue=/\d\d\d\d?/,qe=/\d\d\d\d\d\d?/,Ge=/\d{1,3}/,Ze=/\d{1,4}/,Xe=/[+-]?\d{1,6}/,Je=/\d+/,Ke=/[+-]?\d+/,Qe=/Z|[+-]\d\d:?\d\d/gi,$e=/Z|[+-]\d\d(?::?\d\d)?/gi,tn=/[+-]?\d+(\.\d{1,3})?/,en=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,nn={},an={},rn=0,on=1,sn=2,ln=3,un=4,dn=5,cn=6,hn=7,fn=8,gn=Ce=Array.prototype.indexOf?Array.prototype.indexOf:function(t){var e;for(e=0;e<this.length;++e)if(this[e]===t)return e;return-1};N("M",["MM",2],"Mo",function(){return this.month()+1}),N("MMM",0,0,function(t){return this.localeData().monthsShort(this,t)}),N("MMMM",0,0,function(t){return this.localeData().months(this,t)}),T("month","M"),O("month",8),E("M",je),E("MM",je,Be),E("MMM",function(t,e){return e.monthsShortRegex(t)}),E("MMMM",function(t,e){return e.monthsRegex(t)}),G(["M","MM"],function(t,e){e[on]=_(t)-1}),G(["MMM","MMMM"],function(t,e,n,i){var a=n._locale.monthsParse(t,i,n._strict);null!=a?e[on]=a:g(n).invalidMonth=t});var mn=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,pn="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),vn="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),yn=en,bn=en;N("Y",0,0,function(){var t=this.year();return t<=9999?""+t:"+"+t}),N(0,["YY",2],0,function(){return this.year()%100}),N(0,["YYYY",4],0,"year"),N(0,["YYYYY",5],0,"year"),N(0,["YYYYYY",6,!0],0,"year"),T("year","y"),O("year",1),E("Y",Ke),E("YY",je,Be),E("YYYY",Ze,He),E("YYYYY",Xe,Ee),E("YYYYYY",Xe,Ee),G(["YYYYY","YYYYYY"],rn),G("YYYY",function(t,e){e[rn]=2===t.length?n.parseTwoDigitYear(t):_(t)}),G("YY",function(t,e){e[rn]=n.parseTwoDigitYear(t)}),G("Y",function(t,e){e[rn]=parseInt(t,10)}),n.parseTwoDigitYear=function(t){return _(t)+(_(t)>68?1900:2e3)};var xn=R("FullYear",!0);N("w",["ww",2],"wo","week"),N("W",["WW",2],"Wo","isoWeek"),T("week","w"),T("isoWeek","W"),O("week",5),O("isoWeek",5),E("w",je),E("ww",je,Be),E("W",je),E("WW",je,Be),Z(["w","ww","W","WW"],function(t,e,n,i){e[i.substr(0,1)]=_(t)});var _n={dow:0,doy:6};N("d",0,"do","day"),N("dd",0,0,function(t){return this.localeData().weekdaysMin(this,t)}),N("ddd",0,0,function(t){return this.localeData().weekdaysShort(this,t)}),N("dddd",0,0,function(t){return this.localeData().weekdays(this,t)}),N("e",0,0,"weekday"),N("E",0,0,"isoWeekday"),T("day","d"),T("weekday","e"),T("isoWeekday","E"),O("day",11),O("weekday",11),O("isoWeekday",11),E("d",je),E("e",je),E("E",je),E("dd",function(t,e){return e.weekdaysMinRegex(t)}),E("ddd",function(t,e){return e.weekdaysShortRegex(t)}),E("dddd",function(t,e){return e.weekdaysRegex(t)}),Z(["dd","ddd","dddd"],function(t,e,n,i){var a=n._locale.weekdaysParse(t,i,n._strict);null!=a?e.d=a:g(n).invalidWeekday=t}),Z(["d","e","E"],function(t,e,n,i){e[i]=_(t)});var kn="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),wn="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Mn="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),Sn=en,Dn=en,Cn=en;N("H",["HH",2],0,"hour"),N("h",["hh",2],0,ft),N("k",["kk",2],0,function(){return this.hours()||24}),N("hmm",0,0,function(){return""+ft.apply(this)+Y(this.minutes(),2)}),N("hmmss",0,0,function(){return""+ft.apply(this)+Y(this.minutes(),2)+Y(this.seconds(),2)}),N("Hmm",0,0,function(){return""+this.hours()+Y(this.minutes(),2)}),N("Hmmss",0,0,function(){return""+this.hours()+Y(this.minutes(),2)+Y(this.seconds(),2)}),gt("a",!0),gt("A",!1),T("hour","h"),O("hour",13),E("a",mt),E("A",mt),E("H",je),E("h",je),E("k",je),E("HH",je,Be),E("hh",je,Be),E("kk",je,Be),E("hmm",Ue),E("hmmss",qe),E("Hmm",Ue),E("Hmmss",qe),G(["H","HH"],ln),G(["k","kk"],function(t,e,n){var i=_(t);e[ln]=24===i?0:i}),G(["a","A"],function(t,e,n){n._isPm=n._locale.isPM(t),n._meridiem=t}),G(["h","hh"],function(t,e,n){e[ln]=_(t),g(n).bigHour=!0}),G("hmm",function(t,e,n){var i=t.length-2;e[ln]=_(t.substr(0,i)),e[un]=_(t.substr(i)),g(n).bigHour=!0}),G("hmmss",function(t,e,n){var i=t.length-4,a=t.length-2;e[ln]=_(t.substr(0,i)),e[un]=_(t.substr(i,2)),e[dn]=_(t.substr(a)),g(n).bigHour=!0}),G("Hmm",function(t,e,n){var i=t.length-2;e[ln]=_(t.substr(0,i)),e[un]=_(t.substr(i))}),G("Hmmss",function(t,e,n){var i=t.length-4,a=t.length-2;e[ln]=_(t.substr(0,i)),e[un]=_(t.substr(i,2)),e[dn]=_(t.substr(a))});var Pn,Tn=/[ap]\.?m?\.?/i,In=R("Hours",!0),An={calendar:Te,longDateFormat:Ie,invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:Ae,relativeTime:Oe,months:pn,monthsShort:vn,week:_n,weekdays:kn,weekdaysMin:Mn,weekdaysShort:wn,meridiemParse:Tn},On={},Fn={},Rn=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Ln=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Wn=/Z|[+-]\d\d(?::?\d\d)?/,Yn=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],Nn=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],zn=/^\/?Date\((\-?\d+)/i,Bn=/^((?:Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d?\d\s(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(?:\d\d)?\d\d\s)(\d\d:\d\d)(\:\d\d)?(\s(?:UT|GMT|[ECMP][SD]T|[A-IK-Za-ik-z]|[+-]\d{4}))$/;n.createFromInputFallback=M("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(t){t._d=new Date(t._i+(t._useUTC?" UTC":""))}),n.ISO_8601=function(){},n.RFC_2822=function(){};var Vn=M("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var t=Nt.apply(null,arguments);return this.isValid()&&t.isValid()?t<this?this:t:p()}),Hn=M("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var t=Nt.apply(null,arguments);return this.isValid()&&t.isValid()?t>this?this:t:p()}),En=["year","quarter","month","week","day","hour","minute","second","millisecond"];jt("Z",":"),jt("ZZ",""),E("Z",$e),E("ZZ",$e),G(["Z","ZZ"],function(t,e,n){n._useUTC=!0,n._tzm=Ut($e,t)});var jn=/([\+\-]|\d\d)/gi;n.updateOffset=function(){};var Un=/^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/,qn=/^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/;Xt.fn=Vt.prototype,Xt.invalid=function(){return Xt(NaN)};var Gn=$t(1,"add"),Zn=$t(-1,"subtract");n.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",n.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var Xn=M("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(t){return void 0===t?this.localeData():this.locale(t)});N(0,["gg",2],0,function(){return this.weekYear()%100}),N(0,["GG",2],0,function(){return this.isoWeekYear()%100}),ae("gggg","weekYear"),ae("ggggg","weekYear"),ae("GGGG","isoWeekYear"),ae("GGGGG","isoWeekYear"),T("weekYear","gg"),T("isoWeekYear","GG"),O("weekYear",1),O("isoWeekYear",1),E("G",Ke),E("g",Ke),E("GG",je,Be),E("gg",je,Be),E("GGGG",Ze,He),E("gggg",Ze,He),E("GGGGG",Xe,Ee),E("ggggg",Xe,Ee),Z(["gggg","ggggg","GGGG","GGGGG"],function(t,e,n,i){e[i.substr(0,2)]=_(t)}),Z(["gg","GG"],function(t,e,i,a){e[a]=n.parseTwoDigitYear(t)}),N("Q",0,"Qo","quarter"),T("quarter","Q"),O("quarter",7),E("Q",ze),G("Q",function(t,e){e[on]=3*(_(t)-1)}),N("D",["DD",2],"Do","date"),T("date","D"),O("date",9),E("D",je),E("DD",je,Be),E("Do",function(t,e){return t?e._dayOfMonthOrdinalParse||e._ordinalParse:e._dayOfMonthOrdinalParseLenient}),G(["D","DD"],sn),G("Do",function(t,e){e[sn]=_(t.match(je)[0],10)});var Jn=R("Date",!0);N("DDD",["DDDD",3],"DDDo","dayOfYear"),T("dayOfYear","DDD"),O("dayOfYear",4),E("DDD",Ge),E("DDDD",Ve),G(["DDD","DDDD"],function(t,e,n){n._dayOfYear=_(t)}),N("m",["mm",2],0,"minute"),T("minute","m"),O("minute",14),E("m",je),E("mm",je,Be),G(["m","mm"],un);var Kn=R("Minutes",!1);N("s",["ss",2],0,"second"),T("second","s"),O("second",15),E("s",je),E("ss",je,Be),G(["s","ss"],dn);var Qn=R("Seconds",!1);N("S",0,0,function(){return~~(this.millisecond()/100)}),N(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),N(0,["SSS",3],0,"millisecond"),N(0,["SSSS",4],0,function(){return 10*this.millisecond()}),N(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),N(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),N(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),N(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),N(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),T("millisecond","ms"),O("millisecond",16),E("S",Ge,ze),E("SS",Ge,Be),E("SSS",Ge,Ve);var $n;for($n="SSSS";$n.length<=9;$n+="S")E($n,Je);for($n="S";$n.length<=9;$n+="S")G($n,function(t,e){e[cn]=_(1e3*("0."+t))});var ti=R("Milliseconds",!1);N("z",0,0,"zoneAbbr"),N("zz",0,0,"zoneName");var ei=y.prototype;ei.add=Gn,ei.calendar=function(t,e){var i=t||Nt(),a=qt(i,this).startOf("day"),r=n.calendarFormat(this,a)||"sameElse",o=e&&(D(e[r])?e[r].call(this,i):e[r]);return this.format(o||this.localeData().calendar(r,this,Nt(i)))},ei.clone=function(){return new y(this)},ei.diff=function(t,e,n){var i,a,r,o;return this.isValid()&&(i=qt(t,this)).isValid()?(a=6e4*(i.utcOffset()-this.utcOffset()),"year"===(e=I(e))||"month"===e||"quarter"===e?(o=ee(this,i),"quarter"===e?o/=3:"year"===e&&(o/=12)):(r=this-i,o="second"===e?r/1e3:"minute"===e?r/6e4:"hour"===e?r/36e5:"day"===e?(r-a)/864e5:"week"===e?(r-a)/6048e5:r),n?o:x(o)):NaN},ei.endOf=function(t){return void 0===(t=I(t))||"millisecond"===t?this:("date"===t&&(t="day"),this.startOf(t).add(1,"isoWeek"===t?"week":t).subtract(1,"ms"))},ei.format=function(t){t||(t=this.isUtc()?n.defaultFormatUtc:n.defaultFormat);var e=V(this,t);return this.localeData().postformat(e)},ei.from=function(t,e){return this.isValid()&&(b(t)&&t.isValid()||Nt(t).isValid())?Xt({to:this,from:t}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()},ei.fromNow=function(t){return this.from(Nt(),t)},ei.to=function(t,e){return this.isValid()&&(b(t)&&t.isValid()||Nt(t).isValid())?Xt({from:this,to:t}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()},ei.toNow=function(t){return this.to(Nt(),t)},ei.get=function(t){return t=I(t),D(this[t])?this[t]():this},ei.invalidAt=function(){return g(this).overflow},ei.isAfter=function(t,e){var n=b(t)?t:Nt(t);return!(!this.isValid()||!n.isValid())&&("millisecond"===(e=I(o(e)?"millisecond":e))?this.valueOf()>n.valueOf():n.valueOf()<this.clone().startOf(e).valueOf())},ei.isBefore=function(t,e){var n=b(t)?t:Nt(t);return!(!this.isValid()||!n.isValid())&&("millisecond"===(e=I(o(e)?"millisecond":e))?this.valueOf()<n.valueOf():this.clone().endOf(e).valueOf()<n.valueOf())},ei.isBetween=function(t,e,n,i){return("("===(i=i||"()")[0]?this.isAfter(t,n):!this.isBefore(t,n))&&(")"===i[1]?this.isBefore(e,n):!this.isAfter(e,n))},ei.isSame=function(t,e){var n,i=b(t)?t:Nt(t);return!(!this.isValid()||!i.isValid())&&("millisecond"===(e=I(e||"millisecond"))?this.valueOf()===i.valueOf():(n=i.valueOf(),this.clone().startOf(e).valueOf()<=n&&n<=this.clone().endOf(e).valueOf()))},ei.isSameOrAfter=function(t,e){return this.isSame(t,e)||this.isAfter(t,e)},ei.isSameOrBefore=function(t,e){return this.isSame(t,e)||this.isBefore(t,e)},ei.isValid=function(){return m(this)},ei.lang=Xn,ei.locale=ne,ei.localeData=ie,ei.max=Hn,ei.min=Vn,ei.parsingFlags=function(){return c({},g(this))},ei.set=function(t,e){if("object"==typeof t)for(var n=F(t=A(t)),i=0;i<n.length;i++)this[n[i].unit](t[n[i].unit]);else if(t=I(t),D(this[t]))return this[t](e);return this},ei.startOf=function(t){switch(t=I(t)){case"year":this.month(0);case"quarter":case"month":this.date(1);case"week":case"isoWeek":case"day":case"date":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===t&&this.weekday(0),"isoWeek"===t&&this.isoWeekday(1),"quarter"===t&&this.month(3*Math.floor(this.month()/3)),this},ei.subtract=Zn,ei.toArray=function(){var t=this;return[t.year(),t.month(),t.date(),t.hour(),t.minute(),t.second(),t.millisecond()]},ei.toObject=function(){var t=this;return{years:t.year(),months:t.month(),date:t.date(),hours:t.hours(),minutes:t.minutes(),seconds:t.seconds(),milliseconds:t.milliseconds()}},ei.toDate=function(){return new Date(this.valueOf())},ei.toISOString=function(){if(!this.isValid())return null;var t=this.clone().utc();return t.year()<0||t.year()>9999?V(t,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):D(Date.prototype.toISOString)?this.toDate().toISOString():V(t,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]")},ei.inspect=function(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var t="moment",e="";this.isLocal()||(t=0===this.utcOffset()?"moment.utc":"moment.parseZone",e="Z");var n="["+t+'("]',i=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",a=e+'[")]';return this.format(n+i+"-MM-DD[T]HH:mm:ss.SSS"+a)},ei.toJSON=function(){return this.isValid()?this.toISOString():null},ei.toString=function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},ei.unix=function(){return Math.floor(this.valueOf()/1e3)},ei.valueOf=function(){return this._d.valueOf()-6e4*(this._offset||0)},ei.creationData=function(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}},ei.year=xn,ei.isLeapYear=function(){return nt(this.year())},ei.weekYear=function(t){return re.call(this,t,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)},ei.isoWeekYear=function(t){return re.call(this,t,this.isoWeek(),this.isoWeekday(),1,4)},ei.quarter=ei.quarters=function(t){return null==t?Math.ceil((this.month()+1)/3):this.month(3*(t-1)+this.month()%3)},ei.month=$,ei.daysInMonth=function(){return J(this.year(),this.month())},ei.week=ei.weeks=function(t){var e=this.localeData().week(this);return null==t?e:this.add(7*(t-e),"d")},ei.isoWeek=ei.isoWeeks=function(t){var e=st(this,1,4).week;return null==t?e:this.add(7*(t-e),"d")},ei.weeksInYear=function(){var t=this.localeData()._week;return lt(this.year(),t.dow,t.doy)},ei.isoWeeksInYear=function(){return lt(this.year(),1,4)},ei.date=Jn,ei.day=ei.days=function(t){if(!this.isValid())return null!=t?this:NaN;var e=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=t?(t=ut(t,this.localeData()),this.add(t-e,"d")):e},ei.weekday=function(t){if(!this.isValid())return null!=t?this:NaN;var e=(this.day()+7-this.localeData()._week.dow)%7;return null==t?e:this.add(t-e,"d")},ei.isoWeekday=function(t){if(!this.isValid())return null!=t?this:NaN;if(null!=t){var e=dt(t,this.localeData());return this.day(this.day()%7?e:e-7)}return this.day()||7},ei.dayOfYear=function(t){var e=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==t?e:this.add(t-e,"d")},ei.hour=ei.hours=In,ei.minute=ei.minutes=Kn,ei.second=ei.seconds=Qn,ei.millisecond=ei.milliseconds=ti,ei.utcOffset=function(t,e,i){var a,r=this._offset||0;if(!this.isValid())return null!=t?this:NaN;if(null!=t){if("string"==typeof t){if(null===(t=Ut($e,t)))return this}else Math.abs(t)<16&&!i&&(t*=60);return!this._isUTC&&e&&(a=Gt(this)),this._offset=t,this._isUTC=!0,null!=a&&this.add(a,"m"),r!==t&&(!e||this._changeInProgress?te(this,Xt(t-r,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,n.updateOffset(this,!0),this._changeInProgress=null)),this}return this._isUTC?r:Gt(this)},ei.utc=function(t){return this.utcOffset(0,t)},ei.local=function(t){return this._isUTC&&(this.utcOffset(0,t),this._isUTC=!1,t&&this.subtract(Gt(this),"m")),this},ei.parseZone=function(){if(null!=this._tzm)this.utcOffset(this._tzm,!1,!0);else if("string"==typeof this._i){var t=Ut(Qe,this._i);null!=t?this.utcOffset(t):this.utcOffset(0,!0)}return this},ei.hasAlignedHourOffset=function(t){return!!this.isValid()&&(t=t?Nt(t).utcOffset():0,(this.utcOffset()-t)%60==0)},ei.isDST=function(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},ei.isLocal=function(){return!!this.isValid()&&!this._isUTC},ei.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},ei.isUtc=Zt,ei.isUTC=Zt,ei.zoneAbbr=function(){return this._isUTC?"UTC":""},ei.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},ei.dates=M("dates accessor is deprecated. Use date instead.",Jn),ei.months=M("months accessor is deprecated. Use month instead",$),ei.years=M("years accessor is deprecated. Use year instead",xn),ei.zone=M("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",function(t,e){return null!=t?("string"!=typeof t&&(t=-t),this.utcOffset(t,e),this):-this.utcOffset()}),ei.isDSTShifted=M("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",function(){if(!o(this._isDSTShifted))return this._isDSTShifted;var t={};if(v(t,this),(t=Lt(t))._a){var e=t._isUTC?h(t._a):Nt(t._a);this._isDSTShifted=this.isValid()&&k(t._a,e.toArray())>0}else this._isDSTShifted=!1;return this._isDSTShifted});var ni=P.prototype;ni.calendar=function(t,e,n){var i=this._calendar[t]||this._calendar.sameElse;return D(i)?i.call(e,n):i},ni.longDateFormat=function(t){var e=this._longDateFormat[t],n=this._longDateFormat[t.toUpperCase()];return e||!n?e:(this._longDateFormat[t]=n.replace(/MMMM|MM|DD|dddd/g,function(t){return t.slice(1)}),this._longDateFormat[t])},ni.invalidDate=function(){return this._invalidDate},ni.ordinal=function(t){return this._ordinal.replace("%d",t)},ni.preparse=se,ni.postformat=se,ni.relativeTime=function(t,e,n,i){var a=this._relativeTime[n];return D(a)?a(t,e,n,i):a.replace(/%d/i,t)},ni.pastFuture=function(t,e){var n=this._relativeTime[t>0?"future":"past"];return D(n)?n(e):n.replace(/%s/i,e)},ni.set=function(t){var e,n;for(n in t)D(e=t[n])?this[n]=e:this["_"+n]=e;this._config=t,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)},ni.months=function(t,e){return t?i(this._months)?this._months[t.month()]:this._months[(this._months.isFormat||mn).test(e)?"format":"standalone"][t.month()]:i(this._months)?this._months:this._months.standalone},ni.monthsShort=function(t,e){return t?i(this._monthsShort)?this._monthsShort[t.month()]:this._monthsShort[mn.test(e)?"format":"standalone"][t.month()]:i(this._monthsShort)?this._monthsShort:this._monthsShort.standalone},ni.monthsParse=function(t,e,n){var i,a,r;if(this._monthsParseExact)return K.call(this,t,e,n);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),i=0;i<12;i++){if(a=h([2e3,i]),n&&!this._longMonthsParse[i]&&(this._longMonthsParse[i]=new RegExp("^"+this.months(a,"").replace(".","")+"$","i"),this._shortMonthsParse[i]=new RegExp("^"+this.monthsShort(a,"").replace(".","")+"$","i")),n||this._monthsParse[i]||(r="^"+this.months(a,"")+"|^"+this.monthsShort(a,""),this._monthsParse[i]=new RegExp(r.replace(".",""),"i")),n&&"MMMM"===e&&this._longMonthsParse[i].test(t))return i;if(n&&"MMM"===e&&this._shortMonthsParse[i].test(t))return i;if(!n&&this._monthsParse[i].test(t))return i}},ni.monthsRegex=function(t){return this._monthsParseExact?(d(this,"_monthsRegex")||tt.call(this),t?this._monthsStrictRegex:this._monthsRegex):(d(this,"_monthsRegex")||(this._monthsRegex=bn),this._monthsStrictRegex&&t?this._monthsStrictRegex:this._monthsRegex)},ni.monthsShortRegex=function(t){return this._monthsParseExact?(d(this,"_monthsRegex")||tt.call(this),t?this._monthsShortStrictRegex:this._monthsShortRegex):(d(this,"_monthsShortRegex")||(this._monthsShortRegex=yn),this._monthsShortStrictRegex&&t?this._monthsShortStrictRegex:this._monthsShortRegex)},ni.week=function(t){return st(t,this._week.dow,this._week.doy).week},ni.firstDayOfYear=function(){return this._week.doy},ni.firstDayOfWeek=function(){return this._week.dow},ni.weekdays=function(t,e){return t?i(this._weekdays)?this._weekdays[t.day()]:this._weekdays[this._weekdays.isFormat.test(e)?"format":"standalone"][t.day()]:i(this._weekdays)?this._weekdays:this._weekdays.standalone},ni.weekdaysMin=function(t){return t?this._weekdaysMin[t.day()]:this._weekdaysMin},ni.weekdaysShort=function(t){return t?this._weekdaysShort[t.day()]:this._weekdaysShort},ni.weekdaysParse=function(t,e,n){var i,a,r;if(this._weekdaysParseExact)return ct.call(this,t,e,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),i=0;i<7;i++){if(a=h([2e3,1]).day(i),n&&!this._fullWeekdaysParse[i]&&(this._fullWeekdaysParse[i]=new RegExp("^"+this.weekdays(a,"").replace(".",".?")+"$","i"),this._shortWeekdaysParse[i]=new RegExp("^"+this.weekdaysShort(a,"").replace(".",".?")+"$","i"),this._minWeekdaysParse[i]=new RegExp("^"+this.weekdaysMin(a,"").replace(".",".?")+"$","i")),this._weekdaysParse[i]||(r="^"+this.weekdays(a,"")+"|^"+this.weekdaysShort(a,"")+"|^"+this.weekdaysMin(a,""),this._weekdaysParse[i]=new RegExp(r.replace(".",""),"i")),n&&"dddd"===e&&this._fullWeekdaysParse[i].test(t))return i;if(n&&"ddd"===e&&this._shortWeekdaysParse[i].test(t))return i;if(n&&"dd"===e&&this._minWeekdaysParse[i].test(t))return i;if(!n&&this._weekdaysParse[i].test(t))return i}},ni.weekdaysRegex=function(t){return this._weekdaysParseExact?(d(this,"_weekdaysRegex")||ht.call(this),t?this._weekdaysStrictRegex:this._weekdaysRegex):(d(this,"_weekdaysRegex")||(this._weekdaysRegex=Sn),this._weekdaysStrictRegex&&t?this._weekdaysStrictRegex:this._weekdaysRegex)},ni.weekdaysShortRegex=function(t){return this._weekdaysParseExact?(d(this,"_weekdaysRegex")||ht.call(this),t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(d(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=Dn),this._weekdaysShortStrictRegex&&t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)},ni.weekdaysMinRegex=function(t){return this._weekdaysParseExact?(d(this,"_weekdaysRegex")||ht.call(this),t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(d(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Cn),this._weekdaysMinStrictRegex&&t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)},ni.isPM=function(t){return"p"===(t+"").toLowerCase().charAt(0)},ni.meridiem=function(t,e,n){return t>11?n?"pm":"PM":n?"am":"AM"},bt("en",{dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(t){var e=t%10;return t+(1===_(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th")}}),n.lang=M("moment.lang is deprecated. Use moment.locale instead.",bt),n.langData=M("moment.langData is deprecated. Use moment.localeData instead.",_t);var ii=Math.abs,ai=me("ms"),ri=me("s"),oi=me("m"),si=me("h"),li=me("d"),ui=me("w"),di=me("M"),ci=me("y"),hi=pe("milliseconds"),fi=pe("seconds"),gi=pe("minutes"),mi=pe("hours"),pi=pe("days"),vi=pe("months"),yi=pe("years"),bi=Math.round,xi={ss:44,s:45,m:45,h:22,d:26,M:11},_i=Math.abs,ki=Vt.prototype;return ki.isValid=function(){return this._isValid},ki.abs=function(){var t=this._data;return this._milliseconds=ii(this._milliseconds),this._days=ii(this._days),this._months=ii(this._months),t.milliseconds=ii(t.milliseconds),t.seconds=ii(t.seconds),t.minutes=ii(t.minutes),t.hours=ii(t.hours),t.months=ii(t.months),t.years=ii(t.years),this},ki.add=function(t,e){return ce(this,t,e,1)},ki.subtract=function(t,e){return ce(this,t,e,-1)},ki.as=function(t){if(!this.isValid())return NaN;var e,n,i=this._milliseconds;if("month"===(t=I(t))||"year"===t)return e=this._days+i/864e5,n=this._months+fe(e),"month"===t?n:n/12;switch(e=this._days+Math.round(ge(this._months)),t){case"week":return e/7+i/6048e5;case"day":return e+i/864e5;case"hour":return 24*e+i/36e5;case"minute":return 1440*e+i/6e4;case"second":return 86400*e+i/1e3;case"millisecond":return Math.floor(864e5*e)+i;default:throw new Error("Unknown unit "+t)}},ki.asMilliseconds=ai,ki.asSeconds=ri,ki.asMinutes=oi,ki.asHours=si,ki.asDays=li,ki.asWeeks=ui,ki.asMonths=di,ki.asYears=ci,ki.valueOf=function(){return this.isValid()?this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*_(this._months/12):NaN},ki._bubble=function(){var t,e,n,i,a,r=this._milliseconds,o=this._days,s=this._months,l=this._data;return r>=0&&o>=0&&s>=0||r<=0&&o<=0&&s<=0||(r+=864e5*he(ge(s)+o),o=0,s=0),l.milliseconds=r%1e3,t=x(r/1e3),l.seconds=t%60,e=x(t/60),l.minutes=e%60,n=x(e/60),l.hours=n%24,o+=x(n/24),a=x(fe(o)),s+=a,o-=he(ge(a)),i=x(s/12),s%=12,l.days=o,l.months=s,l.years=i,this},ki.get=function(t){return t=I(t),this.isValid()?this[t+"s"]():NaN},ki.milliseconds=hi,ki.seconds=fi,ki.minutes=gi,ki.hours=mi,ki.days=pi,ki.weeks=function(){return x(this.days()/7)},ki.months=vi,ki.years=yi,ki.humanize=function(t){if(!this.isValid())return this.localeData().invalidDate();var e=this.localeData(),n=ye(this,!t,e);return t&&(n=e.pastFuture(+this,n)),e.postformat(n)},ki.toISOString=be,ki.toString=be,ki.toJSON=be,ki.locale=ne,ki.localeData=ie,ki.toIsoString=M("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",be),ki.lang=Xn,N("X",0,0,"unix"),N("x",0,0,"valueOf"),E("x",Ke),E("X",tn),G("X",function(t,e,n){n._d=new Date(1e3*parseFloat(t,10))}),G("x",function(t,e,n){n._d=new Date(_(t))}),n.version="2.18.1",function(t){xe=t}(Nt),n.fn=ei,n.min=function(){return zt("isBefore",[].slice.call(arguments,0))},n.max=function(){return zt("isAfter",[].slice.call(arguments,0))},n.now=function(){return Date.now?Date.now():+new Date},n.utc=h,n.unix=function(t){return Nt(1e3*t)},n.months=function(t,e){return ue(t,e,"months")},n.isDate=l,n.locale=bt,n.invalid=p,n.duration=Xt,n.isMoment=b,n.weekdays=function(t,e,n){return de(t,e,n,"weekdays")},n.parseZone=function(){return Nt.apply(null,arguments).parseZone()},n.localeData=_t,n.isDuration=Ht,n.monthsShort=function(t,e){return ue(t,e,"monthsShort")},n.weekdaysMin=function(t,e,n){return de(t,e,n,"weekdaysMin")},n.defineLocale=xt,n.updateLocale=function(t,e){if(null!=e){var n,i=An;null!=On[t]&&(i=On[t]._config),(n=new P(e=C(i,e))).parentLocale=On[t],On[t]=n,bt(t)}else null!=On[t]&&(null!=On[t].parentLocale?On[t]=On[t].parentLocale:null!=On[t]&&delete On[t]);return On[t]},n.locales=function(){return Pe(On)},n.weekdaysShort=function(t,e,n){return de(t,e,n,"weekdaysShort")},n.normalizeUnits=I,n.relativeTimeRounding=function(t){return void 0===t?bi:"function"==typeof t&&(bi=t,!0)},n.relativeTimeThreshold=function(t,e){return void 0!==xi[t]&&(void 0===e?xi[t]:(xi[t]=e,"s"===t&&(xi.ss=e-1),!0))},n.calendarFormat=function(t,e){var n=t.diff(e,"days",!0);return n<-6?"sameElse":n<-1?"lastWeek":n<0?"lastDay":n<1?"sameDay":n<2?"nextDay":n<7?"nextWeek":"sameElse"},n.prototype=ei,n})},{}],7:[function(t,e,n){var i=t(29)();i.helpers=t(45),t(27)(i),i.defaults=t(25),i.Element=t(26),i.elements=t(40),i.Interaction=t(28),i.platform=t(48),t(31)(i),t(22)(i),t(23)(i),t(24)(i),t(30)(i),t(33)(i),t(32)(i),t(35)(i),t(54)(i),t(52)(i),t(53)(i),t(55)(i),t(56)(i),t(57)(i),t(15)(i),t(16)(i),t(17)(i),t(18)(i),t(19)(i),t(20)(i),t(21)(i),t(8)(i),t(9)(i),t(10)(i),t(11)(i),t(12)(i),t(13)(i),t(14)(i);var a=[];a.push(t(49)(i),t(50)(i),t(51)(i)),i.plugins.register(a),i.platform.initialize(),e.exports=i,"undefined"!=typeof window&&(window.Chart=i),i.canvasHelpers=i.helpers.canvas},{10:10,11:11,12:12,13:13,14:14,15:15,16:16,17:17,18:18,19:19,20:20,21:21,22:22,23:23,24:24,25:25,26:26,27:27,28:28,29:29,30:30,31:31,32:32,33:33,35:35,40:40,45:45,48:48,49:49,50:50,51:51,52:52,53:53,54:54,55:55,56:56,57:57,8:8,9:9}],8:[function(t,e,n){"use strict";e.exports=function(t){t.Bar=function(e,n){return n.type="bar",new t(e,n)}}},{}],9:[function(t,e,n){"use strict";e.exports=function(t){t.Bubble=function(e,n){return n.type="bubble",new t(e,n)}}},{}],10:[function(t,e,n){"use strict";e.exports=function(t){t.Doughnut=function(e,n){return n.type="doughnut",new t(e,n)}}},{}],11:[function(t,e,n){"use strict";e.exports=function(t){t.Line=function(e,n){return n.type="line",new t(e,n)}}},{}],12:[function(t,e,n){"use strict";e.exports=function(t){t.PolarArea=function(e,n){return n.type="polarArea",new t(e,n)}}},{}],13:[function(t,e,n){"use strict";e.exports=function(t){t.Radar=function(e,n){return n.type="radar",new t(e,n)}}},{}],14:[function(t,e,n){"use strict";e.exports=function(t){t.Scatter=function(e,n){return n.type="scatter",new t(e,n)}}},{}],15:[function(t,e,n){"use strict";var i=t(25),a=t(40),r=t(45);i._set("bar",{hover:{mode:"label"},scales:{xAxes:[{type:"category",categoryPercentage:.8,barPercentage:.9,offset:!0,gridLines:{offsetGridLines:!0}}],yAxes:[{type:"linear"}]}}),i._set("horizontalBar",{hover:{mode:"index",axis:"y"},scales:{xAxes:[{type:"linear",position:"bottom"}],yAxes:[{position:"left",type:"category",categoryPercentage:.8,barPercentage:.9,offset:!0,gridLines:{offsetGridLines:!0}}]},elements:{rectangle:{borderSkipped:"left"}},tooltips:{callbacks:{title:function(t,e){var n="";return t.length>0&&(t[0].yLabel?n=t[0].yLabel:e.labels.length>0&&t[0].index<e.labels.length&&(n=e.labels[t[0].index])),n},label:function(t,e){return(e.datasets[t.datasetIndex].label||"")+": "+t.xLabel}},mode:"index",axis:"y"}}),e.exports=function(t){t.controllers.bar=t.DatasetController.extend({dataElementType:a.Rectangle,initialize:function(){var e,n=this;t.DatasetController.prototype.initialize.apply(n,arguments),(e=n.getMeta()).stack=n.getDataset().stack,e.bar=!0},update:function(t){var e,n,i=this,a=i.getMeta().data;for(i._ruler=i.getRuler(),e=0,n=a.length;e<n;++e)i.updateElement(a[e],e,t)},updateElement:function(t,e,n){var i=this,a=i.chart,o=i.getMeta(),s=i.getDataset(),l=t.custom||{},u=a.options.elements.rectangle;t._xScale=i.getScaleForId(o.xAxisID),t._yScale=i.getScaleForId(o.yAxisID),t._datasetIndex=i.index,t._index=e,t._model={datasetLabel:s.label,label:a.data.labels[e],borderSkipped:l.borderSkipped?l.borderSkipped:u.borderSkipped,backgroundColor:l.backgroundColor?l.backgroundColor:r.valueAtIndexOrDefault(s.backgroundColor,e,u.backgroundColor),borderColor:l.borderColor?l.borderColor:r.valueAtIndexOrDefault(s.borderColor,e,u.borderColor),borderWidth:l.borderWidth?l.borderWidth:r.valueAtIndexOrDefault(s.borderWidth,e,u.borderWidth)},i.updateElementGeometry(t,e,n),t.pivot()},updateElementGeometry:function(t,e,n){var i=this,a=t._model,r=i.getValueScale(),o=r.getBasePixel(),s=r.isHorizontal(),l=i._ruler||i.getRuler(),u=i.calculateBarValuePixels(i.index,e),d=i.calculateBarIndexPixels(i.index,e,l);a.horizontal=s,a.base=n?o:u.base,a.x=s?n?o:u.head:d.center,a.y=s?d.center:n?o:u.head,a.height=s?d.size:void 0,a.width=s?void 0:d.size},getValueScaleId:function(){return this.getMeta().yAxisID},getIndexScaleId:function(){return this.getMeta().xAxisID},getValueScale:function(){return this.getScaleForId(this.getValueScaleId())},getIndexScale:function(){return this.getScaleForId(this.getIndexScaleId())},getStackCount:function(t){var e,n,i=this,a=i.chart,r=i.getIndexScale().options.stacked,o=void 0===t?a.data.datasets.length:t+1,s=[];for(e=0;e<o;++e)(n=a.getDatasetMeta(e)).bar&&a.isDatasetVisible(e)&&(!1===r||!0===r&&-1===s.indexOf(n.stack)||void 0===r&&(void 0===n.stack||-1===s.indexOf(n.stack)))&&s.push(n.stack);return s.length},getStackIndex:function(t){return this.getStackCount(t)-1},getRuler:function(){var t,e,n=this,i=n.getIndexScale(),a=n.getStackCount(),r=n.index,o=[],s=i.isHorizontal(),l=s?i.left:i.top,u=l+(s?i.width:i.height);for(t=0,e=n.getMeta().data.length;t<e;++t)o.push(i.getPixelForValue(null,t,r));return{pixels:o,start:l,end:u,stackCount:a,scale:i}},calculateBarValuePixels:function(t,e){var n,i,a,r,o,s,l=this,u=l.chart,d=l.getMeta(),c=l.getValueScale(),h=u.data.datasets,f=c.getRightValue(h[t].data[e]),g=c.options.stacked,m=d.stack,p=0;if(g||void 0===g&&void 0!==m)for(n=0;n<t;++n)(i=u.getDatasetMeta(n)).bar&&i.stack===m&&i.controller.getValueScaleId()===c.id&&u.isDatasetVisible(n)&&(a=c.getRightValue(h[n].data[e]),(f<0&&a<0||f>=0&&a>0)&&(p+=a));return r=c.getPixelForValue(p),o=c.getPixelForValue(p+f),s=(o-r)/2,{size:s,base:r,head:o,center:o+s/2}},calculateBarIndexPixels:function(t,e,n){var i,a,o,s,l,u,d=this,c=n.scale.options,h=d.getStackIndex(t),f=n.pixels,g=f[e],m=f.length,p=n.start,v=n.end;return 1===m?(i=g>p?g-p:v-g,a=g<v?v-g:g-p):(e>0&&(i=(g-f[e-1])/2,e===m-1&&(a=i)),e<m-1&&(a=(f[e+1]-g)/2,0===e&&(i=a))),o=i*c.categoryPercentage,s=a*c.categoryPercentage,l=(o+s)/n.stackCount,u=l*c.barPercentage,u=Math.min(r.valueOrDefault(c.barThickness,u),r.valueOrDefault(c.maxBarThickness,1/0)),g-=o,g+=l*h,g+=(l-u)/2,{size:u,base:g,head:g+u,center:g+u/2}},draw:function(){var t=this,e=t.chart,n=t.getValueScale(),i=t.getMeta().data,a=t.getDataset(),o=i.length,s=0;for(r.canvas.clipArea(e.ctx,e.chartArea);s<o;++s)isNaN(n.getRightValue(a.data[s]))||i[s].draw();r.canvas.unclipArea(e.ctx)},setHoverStyle:function(t){var e=this.chart.data.datasets[t._datasetIndex],n=t._index,i=t.custom||{},a=t._model;a.backgroundColor=i.hoverBackgroundColor?i.hoverBackgroundColor:r.valueAtIndexOrDefault(e.hoverBackgroundColor,n,r.getHoverColor(a.backgroundColor)),a.borderColor=i.hoverBorderColor?i.hoverBorderColor:r.valueAtIndexOrDefault(e.hoverBorderColor,n,r.getHoverColor(a.borderColor)),a.borderWidth=i.hoverBorderWidth?i.hoverBorderWidth:r.valueAtIndexOrDefault(e.hoverBorderWidth,n,a.borderWidth)},removeHoverStyle:function(t){var e=this.chart.data.datasets[t._datasetIndex],n=t._index,i=t.custom||{},a=t._model,o=this.chart.options.elements.rectangle;a.backgroundColor=i.backgroundColor?i.backgroundColor:r.valueAtIndexOrDefault(e.backgroundColor,n,o.backgroundColor),a.borderColor=i.borderColor?i.borderColor:r.valueAtIndexOrDefault(e.borderColor,n,o.borderColor),a.borderWidth=i.borderWidth?i.borderWidth:r.valueAtIndexOrDefault(e.borderWidth,n,o.borderWidth)}}),t.controllers.horizontalBar=t.controllers.bar.extend({getValueScaleId:function(){return this.getMeta().xAxisID},getIndexScaleId:function(){return this.getMeta().yAxisID}})}},{25:25,40:40,45:45}],16:[function(t,e,n){"use strict";var i=t(25),a=t(40),r=t(45);i._set("bubble",{hover:{mode:"single"},scales:{xAxes:[{type:"linear",position:"bottom",id:"x-axis-0"}],yAxes:[{type:"linear",position:"left",id:"y-axis-0"}]},tooltips:{callbacks:{title:function(){return""},label:function(t,e){var n=e.datasets[t.datasetIndex].label||"",i=e.datasets[t.datasetIndex].data[t.index];return n+": ("+t.xLabel+", "+t.yLabel+", "+i.r+")"}}}}),e.exports=function(t){t.controllers.bubble=t.DatasetController.extend({dataElementType:a.Point,update:function(t){var e=this,n=e.getMeta().data;r.each(n,function(n,i){e.updateElement(n,i,t)})},updateElement:function(t,e,n){var i=this,a=i.getMeta(),r=t.custom||{},o=i.getScaleForId(a.xAxisID),s=i.getScaleForId(a.yAxisID),l=i._resolveElementOptions(t,e),u=i.getDataset().data[e],d=i.index,c=n?o.getPixelForDecimal(.5):o.getPixelForValue("object"==typeof u?u:NaN,e,d),h=n?s.getBasePixel():s.getPixelForValue(u,e,d);t._xScale=o,t._yScale=s,t._options=l,t._datasetIndex=d,t._index=e,t._model={backgroundColor:l.backgroundColor,borderColor:l.borderColor,borderWidth:l.borderWidth,hitRadius:l.hitRadius,pointStyle:l.pointStyle,radius:n?0:l.radius,skip:r.skip||isNaN(c)||isNaN(h),x:c,y:h},t.pivot()},setHoverStyle:function(t){var e=t._model,n=t._options;e.backgroundColor=r.valueOrDefault(n.hoverBackgroundColor,r.getHoverColor(n.backgroundColor)),e.borderColor=r.valueOrDefault(n.hoverBorderColor,r.getHoverColor(n.borderColor)),e.borderWidth=r.valueOrDefault(n.hoverBorderWidth,n.borderWidth),e.radius=n.radius+n.hoverRadius},removeHoverStyle:function(t){var e=t._model,n=t._options;e.backgroundColor=n.backgroundColor,e.borderColor=n.borderColor,e.borderWidth=n.borderWidth,e.radius=n.radius},_resolveElementOptions:function(t,e){var n,i,a,o=this,s=o.chart,l=s.data.datasets[o.index],u=t.custom||{},d=s.options.elements.point,c=r.options.resolve,h=l.data[e],f={},g={chart:s,dataIndex:e,dataset:l,datasetIndex:o.index},m=["backgroundColor","borderColor","borderWidth","hoverBackgroundColor","hoverBorderColor","hoverBorderWidth","hoverRadius","hitRadius","pointStyle"];for(n=0,i=m.length;n<i;++n)f[a=m[n]]=c([u[a],l[a],d[a]],g,e);return f.radius=c([u.radius,h?h.r:void 0,l.radius,d.radius],g,e),f}})}},{25:25,40:40,45:45}],17:[function(t,e,n){"use strict";var i=t(25),a=t(40),r=t(45);i._set("doughnut",{animation:{animateRotate:!0,animateScale:!1},hover:{mode:"single"},legendCallback:function(t){var e=[];e.push('<ul class="'+t.id+'-legend">');var n=t.data,i=n.datasets,a=n.labels;if(i.length)for(var r=0;r<i[0].data.length;++r)e.push('<li><span style="background-color:'+i[0].backgroundColor[r]+'"></span>'),a[r]&&e.push(a[r]),e.push("</li>");return e.push("</ul>"),e.join("")},legend:{labels:{generateLabels:function(t){var e=t.data;return e.labels.length&&e.datasets.length?e.labels.map(function(n,i){var a=t.getDatasetMeta(0),o=e.datasets[0],s=a.data[i],l=s&&s.custom||{},u=r.valueAtIndexOrDefault,d=t.options.elements.arc;return{text:n,fillStyle:l.backgroundColor?l.backgroundColor:u(o.backgroundColor,i,d.backgroundColor),strokeStyle:l.borderColor?l.borderColor:u(o.borderColor,i,d.borderColor),lineWidth:l.borderWidth?l.borderWidth:u(o.borderWidth,i,d.borderWidth),hidden:isNaN(o.data[i])||a.data[i].hidden,index:i}}):[]}},onClick:function(t,e){var n,i,a,r=e.index,o=this.chart;for(n=0,i=(o.data.datasets||[]).length;n<i;++n)(a=o.getDatasetMeta(n)).data[r]&&(a.data[r].hidden=!a.data[r].hidden);o.update()}},cutoutPercentage:50,rotation:-.5*Math.PI,circumference:2*Math.PI,tooltips:{callbacks:{title:function(){return""},label:function(t,e){var n=e.labels[t.index],i=": "+e.datasets[t.datasetIndex].data[t.index];return r.isArray(n)?(n=n.slice())[0]+=i:n+=i,n}}}}),i._set("pie",r.clone(i.doughnut)),i._set("pie",{cutoutPercentage:0}),e.exports=function(t){t.controllers.doughnut=t.controllers.pie=t.DatasetController.extend({dataElementType:a.Arc,linkScales:r.noop,getRingIndex:function(t){for(var e=0,n=0;n<t;++n)this.chart.isDatasetVisible(n)&&++e;return e},update:function(t){var e=this,n=e.chart,i=n.chartArea,a=n.options,o=a.elements.arc,s=i.right-i.left-o.borderWidth,l=i.bottom-i.top-o.borderWidth,u=Math.min(s,l),d={x:0,y:0},c=e.getMeta(),h=a.cutoutPercentage,f=a.circumference;if(f<2*Math.PI){var g=a.rotation%(2*Math.PI),m=(g+=2*Math.PI*(g>=Math.PI?-1:g<-Math.PI?1:0))+f,p={x:Math.cos(g),y:Math.sin(g)},v={x:Math.cos(m),y:Math.sin(m)},y=g<=0&&m>=0||g<=2*Math.PI&&2*Math.PI<=m,b=g<=.5*Math.PI&&.5*Math.PI<=m||g<=2.5*Math.PI&&2.5*Math.PI<=m,x=g<=-Math.PI&&-Math.PI<=m||g<=Math.PI&&Math.PI<=m,_=g<=.5*-Math.PI&&.5*-Math.PI<=m||g<=1.5*Math.PI&&1.5*Math.PI<=m,k=h/100,w={x:x?-1:Math.min(p.x*(p.x<0?1:k),v.x*(v.x<0?1:k)),y:_?-1:Math.min(p.y*(p.y<0?1:k),v.y*(v.y<0?1:k))},M={x:y?1:Math.max(p.x*(p.x>0?1:k),v.x*(v.x>0?1:k)),y:b?1:Math.max(p.y*(p.y>0?1:k),v.y*(v.y>0?1:k))},S={width:.5*(M.x-w.x),height:.5*(M.y-w.y)};u=Math.min(s/S.width,l/S.height),d={x:-.5*(M.x+w.x),y:-.5*(M.y+w.y)}}n.borderWidth=e.getMaxBorderWidth(c.data),n.outerRadius=Math.max((u-n.borderWidth)/2,0),n.innerRadius=Math.max(h?n.outerRadius/100*h:0,0),n.radiusLength=(n.outerRadius-n.innerRadius)/n.getVisibleDatasetCount(),n.offsetX=d.x*n.outerRadius,n.offsetY=d.y*n.outerRadius,c.total=e.calculateTotal(),e.outerRadius=n.outerRadius-n.radiusLength*e.getRingIndex(e.index),e.innerRadius=Math.max(e.outerRadius-n.radiusLength,0),r.each(c.data,function(n,i){e.updateElement(n,i,t)})},updateElement:function(t,e,n){var i=this,a=i.chart,o=a.chartArea,s=a.options,l=s.animation,u=(o.left+o.right)/2,d=(o.top+o.bottom)/2,c=s.rotation,h=s.rotation,f=i.getDataset(),g=n&&l.animateRotate?0:t.hidden?0:i.calculateCircumference(f.data[e])*(s.circumference/(2*Math.PI)),m=n&&l.animateScale?0:i.innerRadius,p=n&&l.animateScale?0:i.outerRadius,v=r.valueAtIndexOrDefault;r.extend(t,{_datasetIndex:i.index,_index:e,_model:{x:u+a.offsetX,y:d+a.offsetY,startAngle:c,endAngle:h,circumference:g,outerRadius:p,innerRadius:m,label:v(f.label,e,a.data.labels[e])}});var y=t._model;this.removeHoverStyle(t),n&&l.animateRotate||(y.startAngle=0===e?s.rotation:i.getMeta().data[e-1]._model.endAngle,y.endAngle=y.startAngle+y.circumference),t.pivot()},removeHoverStyle:function(e){t.DatasetController.prototype.removeHoverStyle.call(this,e,this.chart.options.elements.arc)},calculateTotal:function(){var t,e=this.getDataset(),n=this.getMeta(),i=0;return r.each(n.data,function(n,a){t=e.data[a],isNaN(t)||n.hidden||(i+=Math.abs(t))}),i},calculateCircumference:function(t){var e=this.getMeta().total;return e>0&&!isNaN(t)?2*Math.PI*(t/e):0},getMaxBorderWidth:function(t){for(var e,n,i=0,a=this.index,r=t.length,o=0;o<r;o++)e=t[o]._model?t[o]._model.borderWidth:0,i=(n=t[o]._chart?t[o]._chart.config.data.datasets[a].hoverBorderWidth:0)>(i=e>i?e:i)?n:i;return i}})}},{25:25,40:40,45:45}],18:[function(t,e,n){"use strict";var i=t(25),a=t(40),r=t(45);i._set("line",{showLines:!0,spanGaps:!1,hover:{mode:"label"},scales:{xAxes:[{type:"category",id:"x-axis-0"}],yAxes:[{type:"linear",id:"y-axis-0"}]}}),e.exports=function(t){function e(t,e){return r.valueOrDefault(t.showLine,e.showLines)}t.controllers.line=t.DatasetController.extend({datasetElementType:a.Line,dataElementType:a.Point,update:function(t){var n,i,a,o=this,s=o.getMeta(),l=s.dataset,u=s.data||[],d=o.chart.options,c=d.elements.line,h=o.getScaleForId(s.yAxisID),f=o.getDataset(),g=e(f,d);for(g&&(a=l.custom||{},void 0!==f.tension&&void 0===f.lineTension&&(f.lineTension=f.tension),l._scale=h,l._datasetIndex=o.index,l._children=u,l._model={spanGaps:f.spanGaps?f.spanGaps:d.spanGaps,tension:a.tension?a.tension:r.valueOrDefault(f.lineTension,c.tension),backgroundColor:a.backgroundColor?a.backgroundColor:f.backgroundColor||c.backgroundColor,borderWidth:a.borderWidth?a.borderWidth:f.borderWidth||c.borderWidth,borderColor:a.borderColor?a.borderColor:f.borderColor||c.borderColor,borderCapStyle:a.borderCapStyle?a.borderCapStyle:f.borderCapStyle||c.borderCapStyle,borderDash:a.borderDash?a.borderDash:f.borderDash||c.borderDash,borderDashOffset:a.borderDashOffset?a.borderDashOffset:f.borderDashOffset||c.borderDashOffset,borderJoinStyle:a.borderJoinStyle?a.borderJoinStyle:f.borderJoinStyle||c.borderJoinStyle,fill:a.fill?a.fill:void 0!==f.fill?f.fill:c.fill,steppedLine:a.steppedLine?a.steppedLine:r.valueOrDefault(f.steppedLine,c.stepped),cubicInterpolationMode:a.cubicInterpolationMode?a.cubicInterpolationMode:r.valueOrDefault(f.cubicInterpolationMode,c.cubicInterpolationMode)},l.pivot()),n=0,i=u.length;n<i;++n)o.updateElement(u[n],n,t);for(g&&0!==l._model.tension&&o.updateBezierControlPoints(),n=0,i=u.length;n<i;++n)u[n].pivot()},getPointBackgroundColor:function(t,e){var n=this.chart.options.elements.point.backgroundColor,i=this.getDataset(),a=t.custom||{};return a.backgroundColor?n=a.backgroundColor:i.pointBackgroundColor?n=r.valueAtIndexOrDefault(i.pointBackgroundColor,e,n):i.backgroundColor&&(n=i.backgroundColor),n},getPointBorderColor:function(t,e){var n=this.chart.options.elements.point.borderColor,i=this.getDataset(),a=t.custom||{};return a.borderColor?n=a.borderColor:i.pointBorderColor?n=r.valueAtIndexOrDefault(i.pointBorderColor,e,n):i.borderColor&&(n=i.borderColor),n},getPointBorderWidth:function(t,e){var n=this.chart.options.elements.point.borderWidth,i=this.getDataset(),a=t.custom||{};return isNaN(a.borderWidth)?!isNaN(i.pointBorderWidth)||r.isArray(i.pointBorderWidth)?n=r.valueAtIndexOrDefault(i.pointBorderWidth,e,n):isNaN(i.borderWidth)||(n=i.borderWidth):n=a.borderWidth,n},updateElement:function(t,e,n){var i,a,o=this,s=o.getMeta(),l=t.custom||{},u=o.getDataset(),d=o.index,c=u.data[e],h=o.getScaleForId(s.yAxisID),f=o.getScaleForId(s.xAxisID),g=o.chart.options.elements.point;void 0!==u.radius&&void 0===u.pointRadius&&(u.pointRadius=u.radius),void 0!==u.hitRadius&&void 0===u.pointHitRadius&&(u.pointHitRadius=u.hitRadius),i=f.getPixelForValue("object"==typeof c?c:NaN,e,d),a=n?h.getBasePixel():o.calculatePointY(c,e,d),t._xScale=f,t._yScale=h,t._datasetIndex=d,t._index=e,t._model={x:i,y:a,skip:l.skip||isNaN(i)||isNaN(a),radius:l.radius||r.valueAtIndexOrDefault(u.pointRadius,e,g.radius),pointStyle:l.pointStyle||r.valueAtIndexOrDefault(u.pointStyle,e,g.pointStyle),backgroundColor:o.getPointBackgroundColor(t,e),borderColor:o.getPointBorderColor(t,e),borderWidth:o.getPointBorderWidth(t,e),tension:s.dataset._model?s.dataset._model.tension:0,steppedLine:!!s.dataset._model&&s.dataset._model.steppedLine,hitRadius:l.hitRadius||r.valueAtIndexOrDefault(u.pointHitRadius,e,g.hitRadius)}},calculatePointY:function(t,e,n){var i,a,r,o=this,s=o.chart,l=o.getMeta(),u=o.getScaleForId(l.yAxisID),d=0,c=0;if(u.options.stacked){for(i=0;i<n;i++)if(a=s.data.datasets[i],"line"===(r=s.getDatasetMeta(i)).type&&r.yAxisID===u.id&&s.isDatasetVisible(i)){var h=Number(u.getRightValue(a.data[e]));h<0?c+=h||0:d+=h||0}var f=Number(u.getRightValue(t));return f<0?u.getPixelForValue(c+f):u.getPixelForValue(d+f)}return u.getPixelForValue(t)},updateBezierControlPoints:function(){function t(t,e,n){return Math.max(Math.min(t,n),e)}var e,n,i,a,o=this,s=o.getMeta(),l=o.chart.chartArea,u=s.data||[];if(s.dataset._model.spanGaps&&(u=u.filter(function(t){return!t._model.skip})),"monotone"===s.dataset._model.cubicInterpolationMode)r.splineCurveMonotone(u);else for(e=0,n=u.length;e<n;++e)i=u[e]._model,a=r.splineCurve(r.previousItem(u,e)._model,i,r.nextItem(u,e)._model,s.dataset._model.tension),i.controlPointPreviousX=a.previous.x,i.controlPointPreviousY=a.previous.y,i.controlPointNextX=a.next.x,i.controlPointNextY=a.next.y;if(o.chart.options.elements.line.capBezierPoints)for(e=0,n=u.length;e<n;++e)(i=u[e]._model).controlPointPreviousX=t(i.controlPointPreviousX,l.left,l.right),i.controlPointPreviousY=t(i.controlPointPreviousY,l.top,l.bottom),i.controlPointNextX=t(i.controlPointNextX,l.left,l.right),i.controlPointNextY=t(i.controlPointNextY,l.top,l.bottom)},draw:function(){var t=this,n=t.chart,i=t.getMeta(),a=i.data||[],o=n.chartArea,s=a.length,l=0;for(r.canvas.clipArea(n.ctx,o),e(t.getDataset(),n.options)&&i.dataset.draw(),r.canvas.unclipArea(n.ctx);l<s;++l)a[l].draw(o)},setHoverStyle:function(t){var e=this.chart.data.datasets[t._datasetIndex],n=t._index,i=t.custom||{},a=t._model;a.radius=i.hoverRadius||r.valueAtIndexOrDefault(e.pointHoverRadius,n,this.chart.options.elements.point.hoverRadius),a.backgroundColor=i.hoverBackgroundColor||r.valueAtIndexOrDefault(e.pointHoverBackgroundColor,n,r.getHoverColor(a.backgroundColor)),a.borderColor=i.hoverBorderColor||r.valueAtIndexOrDefault(e.pointHoverBorderColor,n,r.getHoverColor(a.borderColor)),a.borderWidth=i.hoverBorderWidth||r.valueAtIndexOrDefault(e.pointHoverBorderWidth,n,a.borderWidth)},removeHoverStyle:function(t){var e=this,n=e.chart.data.datasets[t._datasetIndex],i=t._index,a=t.custom||{},o=t._model;void 0!==n.radius&&void 0===n.pointRadius&&(n.pointRadius=n.radius),o.radius=a.radius||r.valueAtIndexOrDefault(n.pointRadius,i,e.chart.options.elements.point.radius),o.backgroundColor=e.getPointBackgroundColor(t,i),o.borderColor=e.getPointBorderColor(t,i),o.borderWidth=e.getPointBorderWidth(t,i)}})}},{25:25,40:40,45:45}],19:[function(t,e,n){"use strict";var i=t(25),a=t(40),r=t(45);i._set("polarArea",{scale:{type:"radialLinear",angleLines:{display:!1},gridLines:{circular:!0},pointLabels:{display:!1},ticks:{beginAtZero:!0}},animation:{animateRotate:!0,animateScale:!0},startAngle:-.5*Math.PI,legendCallback:function(t){var e=[];e.push('<ul class="'+t.id+'-legend">');var n=t.data,i=n.datasets,a=n.labels;if(i.length)for(var r=0;r<i[0].data.length;++r)e.push('<li><span style="background-color:'+i[0].backgroundColor[r]+'"></span>'),a[r]&&e.push(a[r]),e.push("</li>");return e.push("</ul>"),e.join("")},legend:{labels:{generateLabels:function(t){var e=t.data;return e.labels.length&&e.datasets.length?e.labels.map(function(n,i){var a=t.getDatasetMeta(0),o=e.datasets[0],s=a.data[i].custom||{},l=r.valueAtIndexOrDefault,u=t.options.elements.arc;return{text:n,fillStyle:s.backgroundColor?s.backgroundColor:l(o.backgroundColor,i,u.backgroundColor),strokeStyle:s.borderColor?s.borderColor:l(o.borderColor,i,u.borderColor),lineWidth:s.borderWidth?s.borderWidth:l(o.borderWidth,i,u.borderWidth),hidden:isNaN(o.data[i])||a.data[i].hidden,index:i}}):[]}},onClick:function(t,e){var n,i,a,r=e.index,o=this.chart;for(n=0,i=(o.data.datasets||[]).length;n<i;++n)(a=o.getDatasetMeta(n)).data[r].hidden=!a.data[r].hidden;o.update()}},tooltips:{callbacks:{title:function(){return""},label:function(t,e){return e.labels[t.index]+": "+t.yLabel}}}}),e.exports=function(t){t.controllers.polarArea=t.DatasetController.extend({dataElementType:a.Arc,linkScales:r.noop,update:function(t){var e=this,n=e.chart,i=n.chartArea,a=e.getMeta(),o=n.options,s=o.elements.arc,l=Math.min(i.right-i.left,i.bottom-i.top);n.outerRadius=Math.max((l-s.borderWidth/2)/2,0),n.innerRadius=Math.max(o.cutoutPercentage?n.outerRadius/100*o.cutoutPercentage:1,0),n.radiusLength=(n.outerRadius-n.innerRadius)/n.getVisibleDatasetCount(),e.outerRadius=n.outerRadius-n.radiusLength*e.index,e.innerRadius=e.outerRadius-n.radiusLength,a.count=e.countVisibleElements(),r.each(a.data,function(n,i){e.updateElement(n,i,t)})},updateElement:function(t,e,n){for(var i=this,a=i.chart,o=i.getDataset(),s=a.options,l=s.animation,u=a.scale,d=a.data.labels,c=i.calculateCircumference(o.data[e]),h=u.xCenter,f=u.yCenter,g=0,m=i.getMeta(),p=0;p<e;++p)isNaN(o.data[p])||m.data[p].hidden||++g;var v=s.startAngle,y=t.hidden?0:u.getDistanceFromCenterForValue(o.data[e]),b=v+c*g,x=b+(t.hidden?0:c),_=l.animateScale?0:u.getDistanceFromCenterForValue(o.data[e]);r.extend(t,{_datasetIndex:i.index,_index:e,_scale:u,_model:{x:h,y:f,innerRadius:0,outerRadius:n?_:y,startAngle:n&&l.animateRotate?v:b,endAngle:n&&l.animateRotate?v:x,label:r.valueAtIndexOrDefault(d,e,d[e])}}),i.removeHoverStyle(t),t.pivot()},removeHoverStyle:function(e){t.DatasetController.prototype.removeHoverStyle.call(this,e,this.chart.options.elements.arc)},countVisibleElements:function(){var t=this.getDataset(),e=this.getMeta(),n=0;return r.each(e.data,function(e,i){isNaN(t.data[i])||e.hidden||n++}),n},calculateCircumference:function(t){var e=this.getMeta().count;return e>0&&!isNaN(t)?2*Math.PI/e:0}})}},{25:25,40:40,45:45}],20:[function(t,e,n){"use strict";var i=t(25),a=t(40),r=t(45);i._set("radar",{scale:{type:"radialLinear"},elements:{line:{tension:0}}}),e.exports=function(t){t.controllers.radar=t.DatasetController.extend({datasetElementType:a.Line,dataElementType:a.Point,linkScales:r.noop,update:function(t){var e=this,n=e.getMeta(),i=n.dataset,a=n.data,o=i.custom||{},s=e.getDataset(),l=e.chart.options.elements.line,u=e.chart.scale;void 0!==s.tension&&void 0===s.lineTension&&(s.lineTension=s.tension),r.extend(n.dataset,{_datasetIndex:e.index,_scale:u,_children:a,_loop:!0,_model:{tension:o.tension?o.tension:r.valueOrDefault(s.lineTension,l.tension),backgroundColor:o.backgroundColor?o.backgroundColor:s.backgroundColor||l.backgroundColor,borderWidth:o.borderWidth?o.borderWidth:s.borderWidth||l.borderWidth,borderColor:o.borderColor?o.borderColor:s.borderColor||l.borderColor,fill:o.fill?o.fill:void 0!==s.fill?s.fill:l.fill,borderCapStyle:o.borderCapStyle?o.borderCapStyle:s.borderCapStyle||l.borderCapStyle,borderDash:o.borderDash?o.borderDash:s.borderDash||l.borderDash,borderDashOffset:o.borderDashOffset?o.borderDashOffset:s.borderDashOffset||l.borderDashOffset,borderJoinStyle:o.borderJoinStyle?o.borderJoinStyle:s.borderJoinStyle||l.borderJoinStyle}}),n.dataset.pivot(),r.each(a,function(n,i){e.updateElement(n,i,t)},e),e.updateBezierControlPoints()},updateElement:function(t,e,n){var i=this,a=t.custom||{},o=i.getDataset(),s=i.chart.scale,l=i.chart.options.elements.point,u=s.getPointPositionForValue(e,o.data[e]);void 0!==o.radius&&void 0===o.pointRadius&&(o.pointRadius=o.radius),void 0!==o.hitRadius&&void 0===o.pointHitRadius&&(o.pointHitRadius=o.hitRadius),r.extend(t,{_datasetIndex:i.index,_index:e,_scale:s,_model:{x:n?s.xCenter:u.x,y:n?s.yCenter:u.y,tension:a.tension?a.tension:r.valueOrDefault(o.lineTension,i.chart.options.elements.line.tension),radius:a.radius?a.radius:r.valueAtIndexOrDefault(o.pointRadius,e,l.radius),backgroundColor:a.backgroundColor?a.backgroundColor:r.valueAtIndexOrDefault(o.pointBackgroundColor,e,l.backgroundColor),borderColor:a.borderColor?a.borderColor:r.valueAtIndexOrDefault(o.pointBorderColor,e,l.borderColor),borderWidth:a.borderWidth?a.borderWidth:r.valueAtIndexOrDefault(o.pointBorderWidth,e,l.borderWidth),pointStyle:a.pointStyle?a.pointStyle:r.valueAtIndexOrDefault(o.pointStyle,e,l.pointStyle),hitRadius:a.hitRadius?a.hitRadius:r.valueAtIndexOrDefault(o.pointHitRadius,e,l.hitRadius)}}),t._model.skip=a.skip?a.skip:isNaN(t._model.x)||isNaN(t._model.y)},updateBezierControlPoints:function(){var t=this.chart.chartArea,e=this.getMeta();r.each(e.data,function(n,i){var a=n._model,o=r.splineCurve(r.previousItem(e.data,i,!0)._model,a,r.nextItem(e.data,i,!0)._model,a.tension);a.controlPointPreviousX=Math.max(Math.min(o.previous.x,t.right),t.left),a.controlPointPreviousY=Math.max(Math.min(o.previous.y,t.bottom),t.top),a.controlPointNextX=Math.max(Math.min(o.next.x,t.right),t.left),a.controlPointNextY=Math.max(Math.min(o.next.y,t.bottom),t.top),n.pivot()})},setHoverStyle:function(t){var e=this.chart.data.datasets[t._datasetIndex],n=t.custom||{},i=t._index,a=t._model;a.radius=n.hoverRadius?n.hoverRadius:r.valueAtIndexOrDefault(e.pointHoverRadius,i,this.chart.options.elements.point.hoverRadius),a.backgroundColor=n.hoverBackgroundColor?n.hoverBackgroundColor:r.valueAtIndexOrDefault(e.pointHoverBackgroundColor,i,r.getHoverColor(a.backgroundColor)),a.borderColor=n.hoverBorderColor?n.hoverBorderColor:r.valueAtIndexOrDefault(e.pointHoverBorderColor,i,r.getHoverColor(a.borderColor)),a.borderWidth=n.hoverBorderWidth?n.hoverBorderWidth:r.valueAtIndexOrDefault(e.pointHoverBorderWidth,i,a.borderWidth)},removeHoverStyle:function(t){var e=this.chart.data.datasets[t._datasetIndex],n=t.custom||{},i=t._index,a=t._model,o=this.chart.options.elements.point;a.radius=n.radius?n.radius:r.valueAtIndexOrDefault(e.pointRadius,i,o.radius),a.backgroundColor=n.backgroundColor?n.backgroundColor:r.valueAtIndexOrDefault(e.pointBackgroundColor,i,o.backgroundColor),a.borderColor=n.borderColor?n.borderColor:r.valueAtIndexOrDefault(e.pointBorderColor,i,o.borderColor),a.borderWidth=n.borderWidth?n.borderWidth:r.valueAtIndexOrDefault(e.pointBorderWidth,i,o.borderWidth)}})}},{25:25,40:40,45:45}],21:[function(t,e,n){"use strict";t(25)._set("scatter",{hover:{mode:"single"},scales:{xAxes:[{id:"x-axis-1",type:"linear",position:"bottom"}],yAxes:[{id:"y-axis-1",type:"linear",position:"left"}]},showLines:!1,tooltips:{callbacks:{title:function(){return""},label:function(t){return"("+t.xLabel+", "+t.yLabel+")"}}}}),e.exports=function(t){t.controllers.scatter=t.controllers.line}},{25:25}],22:[function(t,e,n){"use strict";var i=t(25),a=t(26),r=t(45);i._set("global",{animation:{duration:1e3,easing:"easeOutQuart",onProgress:r.noop,onComplete:r.noop}}),e.exports=function(t){t.Animation=a.extend({chart:null,currentStep:0,numSteps:60,easing:"",render:null,onAnimationProgress:null,onAnimationComplete:null}),t.animationService={frameDuration:17,animations:[],dropFrames:0,request:null,addAnimation:function(t,e,n,i){var a,r,o=this.animations;for(e.chart=t,i||(t.animating=!0),a=0,r=o.length;a<r;++a)if(o[a].chart===t)return void(o[a]=e);o.push(e),1===o.length&&this.requestAnimationFrame()},cancelAnimation:function(t){var e=r.findIndex(this.animations,function(e){return e.chart===t});-1!==e&&(this.animations.splice(e,1),t.animating=!1)},requestAnimationFrame:function(){var t=this;null===t.request&&(t.request=r.requestAnimFrame.call(window,function(){t.request=null,t.startDigest()}))},startDigest:function(){var t=this,e=Date.now(),n=0;t.dropFrames>1&&(n=Math.floor(t.dropFrames),t.dropFrames=t.dropFrames%1),t.advance(1+n);var i=Date.now();t.dropFrames+=(i-e)/t.frameDuration,t.animations.length>0&&t.requestAnimationFrame()},advance:function(t){for(var e,n,i=this.animations,a=0;a<i.length;)n=(e=i[a]).chart,e.currentStep=(e.currentStep||0)+t,e.currentStep=Math.min(e.currentStep,e.numSteps),r.callback(e.render,[n,e],n),r.callback(e.onAnimationProgress,[e],n),e.currentStep>=e.numSteps?(r.callback(e.onAnimationComplete,[e],n),n.animating=!1,i.splice(a,1)):++a}},Object.defineProperty(t.Animation.prototype,"animationObject",{get:function(){return this}}),Object.defineProperty(t.Animation.prototype,"chartInstance",{get:function(){return this.chart},set:function(t){this.chart=t}})}},{25:25,26:26,45:45}],23:[function(t,e,n){"use strict";var i=t(25),a=t(45),r=t(28),o=t(48);e.exports=function(t){function e(t){var e=(t=t||{}).data=t.data||{};return e.datasets=e.datasets||[],e.labels=e.labels||[],t.options=a.configMerge(i.global,i[t.type],t.options||{}),t}function n(t){var e=t.options;e.scale?t.scale.options=e.scale:e.scales&&e.scales.xAxes.concat(e.scales.yAxes).forEach(function(e){t.scales[e.id].options=e}),t.tooltip._options=e.tooltips}function s(t){return"top"===t||"bottom"===t}var l=t.plugins;t.types={},t.instances={},t.controllers={},a.extend(t.prototype,{construct:function(n,i){var r=this;i=e(i);var s=o.acquireContext(n,i),l=s&&s.canvas,u=l&&l.height,d=l&&l.width;r.id=a.uid(),r.ctx=s,r.canvas=l,r.config=i,r.width=d,r.height=u,r.aspectRatio=u?d/u:null,r.options=i.options,r._bufferedRender=!1,r.chart=r,r.controller=r,t.instances[r.id]=r,Object.defineProperty(r,"data",{get:function(){return r.config.data},set:function(t){r.config.data=t}}),s&&l?(r.initialize(),r.update()):console.error("Failed to create chart: can't acquire context from the given item")},initialize:function(){var t=this;return l.notify(t,"beforeInit"),a.retinaScale(t,t.options.devicePixelRatio),t.bindEvents(),t.options.responsive&&t.resize(!0),t.ensureScalesHaveIDs(),t.buildScales(),t.initToolTip(),l.notify(t,"afterInit"),t},clear:function(){return a.canvas.clear(this),this},stop:function(){return t.animationService.cancelAnimation(this),this},resize:function(t){var e=this,n=e.options,i=e.canvas,r=n.maintainAspectRatio&&e.aspectRatio||null,o=Math.max(0,Math.floor(a.getMaximumWidth(i))),s=Math.max(0,Math.floor(r?o/r:a.getMaximumHeight(i)));if((e.width!==o||e.height!==s)&&(i.width=e.width=o,i.height=e.height=s,i.style.width=o+"px",i.style.height=s+"px",a.retinaScale(e,n.devicePixelRatio),!t)){var u={width:o,height:s};l.notify(e,"resize",[u]),e.options.onResize&&e.options.onResize(e,u),e.stop(),e.update(e.options.responsiveAnimationDuration)}},ensureScalesHaveIDs:function(){var t=this.options,e=t.scales||{},n=t.scale;a.each(e.xAxes,function(t,e){t.id=t.id||"x-axis-"+e}),a.each(e.yAxes,function(t,e){t.id=t.id||"y-axis-"+e}),n&&(n.id=n.id||"scale")},buildScales:function(){var e=this,n=e.options,i=e.scales={},r=[];n.scales&&(r=r.concat((n.scales.xAxes||[]).map(function(t){return{options:t,dtype:"category",dposition:"bottom"}}),(n.scales.yAxes||[]).map(function(t){return{options:t,dtype:"linear",dposition:"left"}}))),n.scale&&r.push({options:n.scale,dtype:"radialLinear",isDefault:!0,dposition:"chartArea"}),a.each(r,function(n){var r=n.options,o=a.valueOrDefault(r.type,n.dtype),l=t.scaleService.getScaleConstructor(o);if(l){s(r.position)!==s(n.dposition)&&(r.position=n.dposition);var u=new l({id:r.id,options:r,ctx:e.ctx,chart:e});i[u.id]=u,u.mergeTicksOptions(),n.isDefault&&(e.scale=u)}}),t.scaleService.addScalesToLayout(this)},buildOrUpdateControllers:function(){var e=this,n=[],i=[];return a.each(e.data.datasets,function(a,r){var o=e.getDatasetMeta(r),s=a.type||e.config.type;if(o.type&&o.type!==s&&(e.destroyDatasetMeta(r),o=e.getDatasetMeta(r)),o.type=s,n.push(o.type),o.controller)o.controller.updateIndex(r);else{var l=t.controllers[o.type];if(void 0===l)throw new Error('"'+o.type+'" is not a chart type.');o.controller=new l(e,r),i.push(o.controller)}},e),i},resetElements:function(){var t=this;a.each(t.data.datasets,function(e,n){t.getDatasetMeta(n).controller.reset()},t)},reset:function(){this.resetElements(),this.tooltip.initialize()},update:function(t){var e=this;if(t&&"object"==typeof t||(t={duration:t,lazy:arguments[1]}),n(e),!1!==l.notify(e,"beforeUpdate")){e.tooltip._data=e.data;var i=e.buildOrUpdateControllers();a.each(e.data.datasets,function(t,n){e.getDatasetMeta(n).controller.buildOrUpdateElements()},e),e.updateLayout(),a.each(i,function(t){t.reset()}),e.updateDatasets(),l.notify(e,"afterUpdate"),e._bufferedRender?e._bufferedRequest={duration:t.duration,easing:t.easing,lazy:t.lazy}:e.render(t)}},updateLayout:function(){var e=this;!1!==l.notify(e,"beforeLayout")&&(t.layoutService.update(this,this.width,this.height),l.notify(e,"afterScaleUpdate"),l.notify(e,"afterLayout"))},updateDatasets:function(){var t=this;if(!1!==l.notify(t,"beforeDatasetsUpdate")){for(var e=0,n=t.data.datasets.length;e<n;++e)t.updateDataset(e);l.notify(t,"afterDatasetsUpdate")}},updateDataset:function(t){var e=this,n=e.getDatasetMeta(t),i={meta:n,index:t};!1!==l.notify(e,"beforeDatasetUpdate",[i])&&(n.controller.update(),l.notify(e,"afterDatasetUpdate",[i]))},render:function(e){var n=this;e&&"object"==typeof e||(e={duration:e,lazy:arguments[1]});var i=e.duration,r=e.lazy;if(!1!==l.notify(n,"beforeRender")){var o=n.options.animation,s=function(t){l.notify(n,"afterRender"),a.callback(o&&o.onComplete,[t],n)};if(o&&(void 0!==i&&0!==i||void 0===i&&0!==o.duration)){var u=new t.Animation({numSteps:(i||o.duration)/16.66,easing:e.easing||o.easing,render:function(t,e){var n=a.easing.effects[e.easing],i=e.currentStep,r=i/e.numSteps;t.draw(n(r),r,i)},onAnimationProgress:o.onProgress,onAnimationComplete:s});t.animationService.addAnimation(n,u,i,r)}else n.draw(),s(new t.Animation({numSteps:0,chart:n}));return n}},draw:function(t){var e=this;e.clear(),a.isNullOrUndef(t)&&(t=1),e.transition(t),!1!==l.notify(e,"beforeDraw",[t])&&(a.each(e.boxes,function(t){t.draw(e.chartArea)},e),e.scale&&e.scale.draw(),e.drawDatasets(t),e.tooltip.draw(),l.notify(e,"afterDraw",[t]))},transition:function(t){for(var e=this,n=0,i=(e.data.datasets||[]).length;n<i;++n)e.isDatasetVisible(n)&&e.getDatasetMeta(n).controller.transition(t);e.tooltip.transition(t)},drawDatasets:function(t){var e=this;if(!1!==l.notify(e,"beforeDatasetsDraw",[t])){for(var n=(e.data.datasets||[]).length-1;n>=0;--n)e.isDatasetVisible(n)&&e.drawDataset(n,t);l.notify(e,"afterDatasetsDraw",[t])}},drawDataset:function(t,e){var n=this,i=n.getDatasetMeta(t),a={meta:i,index:t,easingValue:e};!1!==l.notify(n,"beforeDatasetDraw",[a])&&(i.controller.draw(e),l.notify(n,"afterDatasetDraw",[a]))},getElementAtEvent:function(t){return r.modes.single(this,t)},getElementsAtEvent:function(t){return r.modes.label(this,t,{intersect:!0})},getElementsAtXAxis:function(t){return r.modes["x-axis"](this,t,{intersect:!0})},getElementsAtEventForMode:function(t,e,n){var i=r.modes[e];return"function"==typeof i?i(this,t,n):[]},getDatasetAtEvent:function(t){return r.modes.dataset(this,t,{intersect:!0})},getDatasetMeta:function(t){var e=this,n=e.data.datasets[t];n._meta||(n._meta={});var i=n._meta[e.id];return i||(i=n._meta[e.id]={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null}),i},getVisibleDatasetCount:function(){for(var t=0,e=0,n=this.data.datasets.length;e<n;++e)this.isDatasetVisible(e)&&t++;return t},isDatasetVisible:function(t){var e=this.getDatasetMeta(t);return"boolean"==typeof e.hidden?!e.hidden:!this.data.datasets[t].hidden},generateLegend:function(){return this.options.legendCallback(this)},destroyDatasetMeta:function(t){var e=this.id,n=this.data.datasets[t],i=n._meta&&n._meta[e];i&&(i.controller.destroy(),delete n._meta[e])},destroy:function(){var e,n,i=this,r=i.canvas;for(i.stop(),e=0,n=i.data.datasets.length;e<n;++e)i.destroyDatasetMeta(e);r&&(i.unbindEvents(),a.canvas.clear(i),o.releaseContext(i.ctx),i.canvas=null,i.ctx=null),l.notify(i,"destroy"),delete t.instances[i.id]},toBase64Image:function(){return this.canvas.toDataURL.apply(this.canvas,arguments)},initToolTip:function(){var e=this;e.tooltip=new t.Tooltip({_chart:e,_chartInstance:e,_data:e.data,_options:e.options.tooltips},e)},bindEvents:function(){var t=this,e=t._listeners={},n=function(){t.eventHandler.apply(t,arguments)};a.each(t.options.events,function(i){o.addEventListener(t,i,n),e[i]=n}),t.options.responsive&&(n=function(){t.resize()},o.addEventListener(t,"resize",n),e.resize=n)},unbindEvents:function(){var t=this,e=t._listeners;e&&(delete t._listeners,a.each(e,function(e,n){o.removeEventListener(t,n,e)}))},updateHoverStyle:function(t,e,n){var i,a,r,o=n?"setHoverStyle":"removeHoverStyle";for(a=0,r=t.length;a<r;++a)(i=t[a])&&this.getDatasetMeta(i._datasetIndex).controller[o](i)},eventHandler:function(t){var e=this,n=e.tooltip;if(!1!==l.notify(e,"beforeEvent",[t])){e._bufferedRender=!0,e._bufferedRequest=null;var i=e.handleEvent(t);i|=n&&n.handleEvent(t),l.notify(e,"afterEvent",[t]);var a=e._bufferedRequest;return a?e.render(a):i&&!e.animating&&(e.stop(),e.render(e.options.hover.animationDuration,!0)),e._bufferedRender=!1,e._bufferedRequest=null,e}},handleEvent:function(t){var e=this,n=e.options||{},i=n.hover,r=!1;return e.lastActive=e.lastActive||[],"mouseout"===t.type?e.active=[]:e.active=e.getElementsAtEventForMode(t,i.mode,i),a.callback(n.onHover||n.hover.onHover,[t.native,e.active],e),"mouseup"!==t.type&&"click"!==t.type||n.onClick&&n.onClick.call(e,t.native,e.active),e.lastActive.length&&e.updateHoverStyle(e.lastActive,i.mode,!1),e.active.length&&i.mode&&e.updateHoverStyle(e.active,i.mode,!0),r=!a.arrayEquals(e.active,e.lastActive),e.lastActive=e.active,r}}),t.Controller=t}},{25:25,28:28,45:45,48:48}],24:[function(t,e,n){"use strict";var i=t(45);e.exports=function(t){function e(t,e){t._chartjs?t._chartjs.listeners.push(e):(Object.defineProperty(t,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[e]}}),a.forEach(function(e){var n="onData"+e.charAt(0).toUpperCase()+e.slice(1),a=t[e];Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:function(){var e=Array.prototype.slice.call(arguments),r=a.apply(this,e);return i.each(t._chartjs.listeners,function(t){"function"==typeof t[n]&&t[n].apply(t,e)}),r}})}))}function n(t,e){var n=t._chartjs;if(n){var i=n.listeners,r=i.indexOf(e);-1!==r&&i.splice(r,1),i.length>0||(a.forEach(function(e){delete t[e]}),delete t._chartjs)}}var a=["push","pop","shift","splice","unshift"];t.DatasetController=function(t,e){this.initialize(t,e)},i.extend(t.DatasetController.prototype,{datasetElementType:null,dataElementType:null,initialize:function(t,e){var n=this;n.chart=t,n.index=e,n.linkScales(),n.addElements()},updateIndex:function(t){this.index=t},linkScales:function(){var t=this,e=t.getMeta(),n=t.getDataset();null===e.xAxisID&&(e.xAxisID=n.xAxisID||t.chart.options.scales.xAxes[0].id),null===e.yAxisID&&(e.yAxisID=n.yAxisID||t.chart.options.scales.yAxes[0].id)},getDataset:function(){return this.chart.data.datasets[this.index]},getMeta:function(){return this.chart.getDatasetMeta(this.index)},getScaleForId:function(t){return this.chart.scales[t]},reset:function(){this.update(!0)},destroy:function(){this._data&&n(this._data,this)},createMetaDataset:function(){var t=this,e=t.datasetElementType;return e&&new e({_chart:t.chart,_datasetIndex:t.index})},createMetaData:function(t){var e=this,n=e.dataElementType;return n&&new n({_chart:e.chart,_datasetIndex:e.index,_index:t})},addElements:function(){var t,e,n=this,i=n.getMeta(),a=n.getDataset().data||[],r=i.data;for(t=0,e=a.length;t<e;++t)r[t]=r[t]||n.createMetaData(t);i.dataset=i.dataset||n.createMetaDataset()},addElementAndReset:function(t){var e=this.createMetaData(t);this.getMeta().data.splice(t,0,e),this.updateElement(e,t,!0)},buildOrUpdateElements:function(){var t=this,i=t.getDataset(),a=i.data||(i.data=[]);t._data!==a&&(t._data&&n(t._data,t),e(a,t),t._data=a),t.resyncElements()},update:i.noop,transition:function(t){for(var e=this.getMeta(),n=e.data||[],i=n.length,a=0;a<i;++a)n[a].transition(t);e.dataset&&e.dataset.transition(t)},draw:function(){var t=this.getMeta(),e=t.data||[],n=e.length,i=0;for(t.dataset&&t.dataset.draw();i<n;++i)e[i].draw()},removeHoverStyle:function(t,e){var n=this.chart.data.datasets[t._datasetIndex],a=t._index,r=t.custom||{},o=i.valueAtIndexOrDefault,s=t._model;s.backgroundColor=r.backgroundColor?r.backgroundColor:o(n.backgroundColor,a,e.backgroundColor),s.borderColor=r.borderColor?r.borderColor:o(n.borderColor,a,e.borderColor),s.borderWidth=r.borderWidth?r.borderWidth:o(n.borderWidth,a,e.borderWidth)},setHoverStyle:function(t){var e=this.chart.data.datasets[t._datasetIndex],n=t._index,a=t.custom||{},r=i.valueAtIndexOrDefault,o=i.getHoverColor,s=t._model;s.backgroundColor=a.hoverBackgroundColor?a.hoverBackgroundColor:r(e.hoverBackgroundColor,n,o(s.backgroundColor)),s.borderColor=a.hoverBorderColor?a.hoverBorderColor:r(e.hoverBorderColor,n,o(s.borderColor)),s.borderWidth=a.hoverBorderWidth?a.hoverBorderWidth:r(e.hoverBorderWidth,n,s.borderWidth)},resyncElements:function(){var t=this,e=t.getMeta(),n=t.getDataset().data,i=e.data.length,a=n.length;a<i?e.data.splice(a,i-a):a>i&&t.insertElements(i,a-i)},insertElements:function(t,e){for(var n=0;n<e;++n)this.addElementAndReset(t+n)},onDataPush:function(){this.insertElements(this.getDataset().data.length-1,arguments.length)},onDataPop:function(){this.getMeta().data.pop()},onDataShift:function(){this.getMeta().data.shift()},onDataSplice:function(t,e){this.getMeta().data.splice(t,e),this.insertElements(t,arguments.length-2)},onDataUnshift:function(){this.insertElements(0,arguments.length)}}),t.DatasetController.extend=i.inherits}},{45:45}],25:[function(t,e,n){"use strict";var i=t(45);e.exports={_set:function(t,e){return i.merge(this[t]||(this[t]={}),e)}}},{45:45}],26:[function(t,e,n){"use strict";function i(t,e,n,i){var r,o,s,l,u,d,c,h,f,g=Object.keys(n);for(r=0,o=g.length;r<o;++r)if(s=g[r],d=n[s],e.hasOwnProperty(s)||(e[s]=d),(l=e[s])!==d&&"_"!==s[0]){if(t.hasOwnProperty(s)||(t[s]=l),u=t[s],(c=typeof d)===typeof u)if("string"===c){if((h=a(u)).valid&&(f=a(d)).valid){e[s]=f.mix(h,i).rgbString();continue}}else if("number"===c&&isFinite(u)&&isFinite(d)){e[s]=u+(d-u)*i;continue}e[s]=d}}var a=t(2),r=t(45),o=function(t){r.extend(this,t),this.initialize.apply(this,arguments)};r.extend(o.prototype,{initialize:function(){this.hidden=!1},pivot:function(){var t=this;return t._view||(t._view=r.clone(t._model)),t._start={},t},transition:function(t){var e=this,n=e._model,a=e._start,r=e._view;return n&&1!==t?(r||(r=e._view={}),a||(a=e._start={}),i(a,r,n,t),e):(e._view=n,e._start=null,e)},tooltipPosition:function(){return{x:this._model.x,y:this._model.y}},hasValue:function(){return r.isNumber(this._model.x)&&r.isNumber(this._model.y)}}),o.extend=r.inherits,e.exports=o},{2:2,45:45}],27:[function(t,e,n){"use strict";var i=t(2),a=t(25),r=t(45);e.exports=function(t){function e(t,e,n){var i;return"string"==typeof t?(i=parseInt(t,10),-1!==t.indexOf("%")&&(i=i/100*e.parentNode[n])):i=t,i}function n(t){return void 0!==t&&null!==t&&"none"!==t}function o(t,i,a){var r=document.defaultView,o=t.parentNode,s=r.getComputedStyle(t)[i],l=r.getComputedStyle(o)[i],u=n(s),d=n(l),c=Number.POSITIVE_INFINITY;return u||d?Math.min(u?e(s,t,a):c,d?e(l,o,a):c):"none"}r.extend=function(t){for(var e=1,n=arguments.length;e<n;e++)r.each(arguments[e],function(e,n){t[n]=e});return t},r.configMerge=function(){return r.merge(r.clone(arguments[0]),[].slice.call(arguments,1),{merger:function(e,n,i,a){var o=n[e]||{},s=i[e];"scales"===e?n[e]=r.scaleMerge(o,s):"scale"===e?n[e]=r.merge(o,[t.scaleService.getScaleDefaults(s.type),s]):r._merger(e,n,i,a)}})},r.scaleMerge=function(){return r.merge(r.clone(arguments[0]),[].slice.call(arguments,1),{merger:function(e,n,i,a){if("xAxes"===e||"yAxes"===e){var o,s,l,u=i[e].length;for(n[e]||(n[e]=[]),o=0;o<u;++o)l=i[e][o],s=r.valueOrDefault(l.type,"xAxes"===e?"category":"linear"),o>=n[e].length&&n[e].push({}),!n[e][o].type||l.type&&l.type!==n[e][o].type?r.merge(n[e][o],[t.scaleService.getScaleDefaults(s),l]):r.merge(n[e][o],l)}else r._merger(e,n,i,a)}})},r.where=function(t,e){if(r.isArray(t)&&Array.prototype.filter)return t.filter(e);var n=[];return r.each(t,function(t){e(t)&&n.push(t)}),n},r.findIndex=Array.prototype.findIndex?function(t,e,n){return t.findIndex(e,n)}:function(t,e,n){n=void 0===n?t:n;for(var i=0,a=t.length;i<a;++i)if(e.call(n,t[i],i,t))return i;return-1},r.findNextWhere=function(t,e,n){r.isNullOrUndef(n)&&(n=-1);for(var i=n+1;i<t.length;i++){var a=t[i];if(e(a))return a}},r.findPreviousWhere=function(t,e,n){r.isNullOrUndef(n)&&(n=t.length);for(var i=n-1;i>=0;i--){var a=t[i];if(e(a))return a}},r.inherits=function(t){var e=this,n=t&&t.hasOwnProperty("constructor")?t.constructor:function(){return e.apply(this,arguments)},i=function(){this.constructor=n};return i.prototype=e.prototype,n.prototype=new i,n.extend=r.inherits,t&&r.extend(n.prototype,t),n.__super__=e.prototype,n},r.isNumber=function(t){return!isNaN(parseFloat(t))&&isFinite(t)},r.almostEquals=function(t,e,n){return Math.abs(t-e)<n},r.almostWhole=function(t,e){var n=Math.round(t);return n-e<t&&n+e>t},r.max=function(t){return t.reduce(function(t,e){return isNaN(e)?t:Math.max(t,e)},Number.NEGATIVE_INFINITY)},r.min=function(t){return t.reduce(function(t,e){return isNaN(e)?t:Math.min(t,e)},Number.POSITIVE_INFINITY)},r.sign=Math.sign?function(t){return Math.sign(t)}:function(t){return 0==(t=+t)||isNaN(t)?t:t>0?1:-1},r.log10=Math.log10?function(t){return Math.log10(t)}:function(t){return Math.log(t)/Math.LN10},r.toRadians=function(t){return t*(Math.PI/180)},r.toDegrees=function(t){return t*(180/Math.PI)},r.getAngleFromPoint=function(t,e){var n=e.x-t.x,i=e.y-t.y,a=Math.sqrt(n*n+i*i),r=Math.atan2(i,n);return r<-.5*Math.PI&&(r+=2*Math.PI),{angle:r,distance:a}},r.distanceBetweenPoints=function(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))},r.aliasPixel=function(t){return t%2==0?0:.5},r.splineCurve=function(t,e,n,i){var a=t.skip?e:t,r=e,o=n.skip?e:n,s=Math.sqrt(Math.pow(r.x-a.x,2)+Math.pow(r.y-a.y,2)),l=Math.sqrt(Math.pow(o.x-r.x,2)+Math.pow(o.y-r.y,2)),u=s/(s+l),d=l/(s+l),c=i*(u=isNaN(u)?0:u),h=i*(d=isNaN(d)?0:d);return{previous:{x:r.x-c*(o.x-a.x),y:r.y-c*(o.y-a.y)},next:{x:r.x+h*(o.x-a.x),y:r.y+h*(o.y-a.y)}}},r.EPSILON=Number.EPSILON||1e-14,r.splineCurveMonotone=function(t){var e,n,i,a,o=(t||[]).map(function(t){return{model:t._model,deltaK:0,mK:0}}),s=o.length;for(e=0;e<s;++e)if(!(i=o[e]).model.skip){if(n=e>0?o[e-1]:null,(a=e<s-1?o[e+1]:null)&&!a.model.skip){var l=a.model.x-i.model.x;i.deltaK=0!==l?(a.model.y-i.model.y)/l:0}!n||n.model.skip?i.mK=i.deltaK:!a||a.model.skip?i.mK=n.deltaK:this.sign(n.deltaK)!==this.sign(i.deltaK)?i.mK=0:i.mK=(n.deltaK+i.deltaK)/2}var u,d,c,h;for(e=0;e<s-1;++e)i=o[e],a=o[e+1],i.model.skip||a.model.skip||(r.almostEquals(i.deltaK,0,this.EPSILON)?i.mK=a.mK=0:(u=i.mK/i.deltaK,d=a.mK/i.deltaK,(h=Math.pow(u,2)+Math.pow(d,2))<=9||(c=3/Math.sqrt(h),i.mK=u*c*i.deltaK,a.mK=d*c*i.deltaK)));var f;for(e=0;e<s;++e)(i=o[e]).model.skip||(n=e>0?o[e-1]:null,a=e<s-1?o[e+1]:null,n&&!n.model.skip&&(f=(i.model.x-n.model.x)/3,i.model.controlPointPreviousX=i.model.x-f,i.model.controlPointPreviousY=i.model.y-f*i.mK),a&&!a.model.skip&&(f=(a.model.x-i.model.x)/3,i.model.controlPointNextX=i.model.x+f,i.model.controlPointNextY=i.model.y+f*i.mK))},r.nextItem=function(t,e,n){return n?e>=t.length-1?t[0]:t[e+1]:e>=t.length-1?t[t.length-1]:t[e+1]},r.previousItem=function(t,e,n){return n?e<=0?t[t.length-1]:t[e-1]:e<=0?t[0]:t[e-1]},r.niceNum=function(t,e){var n=Math.floor(r.log10(t)),i=t/Math.pow(10,n);return(e?i<1.5?1:i<3?2:i<7?5:10:i<=1?1:i<=2?2:i<=5?5:10)*Math.pow(10,n)},r.requestAnimFrame="undefined"==typeof window?function(t){t()}:window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){return window.setTimeout(t,1e3/60)},r.getRelativePosition=function(t,e){var n,i,a=t.originalEvent||t,o=t.currentTarget||t.srcElement,s=o.getBoundingClientRect(),l=a.touches;l&&l.length>0?(n=l[0].clientX,i=l[0].clientY):(n=a.clientX,i=a.clientY);var u=parseFloat(r.getStyle(o,"padding-left")),d=parseFloat(r.getStyle(o,"padding-top")),c=parseFloat(r.getStyle(o,"padding-right")),h=parseFloat(r.getStyle(o,"padding-bottom")),f=s.right-s.left-u-c,g=s.bottom-s.top-d-h;return n=Math.round((n-s.left-u)/f*o.width/e.currentDevicePixelRatio),i=Math.round((i-s.top-d)/g*o.height/e.currentDevicePixelRatio),{x:n,y:i}},r.getConstraintWidth=function(t){return o(t,"max-width","clientWidth")},r.getConstraintHeight=function(t){return o(t,"max-height","clientHeight")},r.getMaximumWidth=function(t){var e=t.parentNode;if(!e)return t.clientWidth;var n=parseInt(r.getStyle(e,"padding-left"),10),i=parseInt(r.getStyle(e,"padding-right"),10),a=e.clientWidth-n-i,o=r.getConstraintWidth(t);return isNaN(o)?a:Math.min(a,o)},r.getMaximumHeight=function(t){var e=t.parentNode;if(!e)return t.clientHeight;var n=parseInt(r.getStyle(e,"padding-top"),10),i=parseInt(r.getStyle(e,"padding-bottom"),10),a=e.clientHeight-n-i,o=r.getConstraintHeight(t);return isNaN(o)?a:Math.min(a,o)},r.getStyle=function(t,e){return t.currentStyle?t.currentStyle[e]:document.defaultView.getComputedStyle(t,null).getPropertyValue(e)},r.retinaScale=function(t,e){var n=t.currentDevicePixelRatio=e||window.devicePixelRatio||1;if(1!==n){var i=t.canvas,a=t.height,r=t.width;i.height=a*n,i.width=r*n,t.ctx.scale(n,n),i.style.height=a+"px",i.style.width=r+"px"}},r.fontString=function(t,e,n){return e+" "+t+"px "+n},r.longestText=function(t,e,n,i){var a=(i=i||{}).data=i.data||{},o=i.garbageCollect=i.garbageCollect||[];i.font!==e&&(a=i.data={},o=i.garbageCollect=[],i.font=e),t.font=e;var s=0;r.each(n,function(e){void 0!==e&&null!==e&&!0!==r.isArray(e)?s=r.measureText(t,a,o,s,e):r.isArray(e)&&r.each(e,function(e){void 0===e||null===e||r.isArray(e)||(s=r.measureText(t,a,o,s,e))})});var l=o.length/2;if(l>n.length){for(var u=0;u<l;u++)delete a[o[u]];o.splice(0,l)}return s},r.measureText=function(t,e,n,i,a){var r=e[a];return r||(r=e[a]=t.measureText(a).width,n.push(a)),r>i&&(i=r),i},r.numberOfLabelLines=function(t){var e=1;return r.each(t,function(t){r.isArray(t)&&t.length>e&&(e=t.length)}),e},r.color=i?function(t){return t instanceof CanvasGradient&&(t=a.global.defaultColor),i(t)}:function(t){return console.error("Color.js not found!"),t},r.getHoverColor=function(t){return t instanceof CanvasPattern?t:r.color(t).saturate(.5).darken(.1).rgbString()}}},{2:2,25:25,45:45}],28:[function(t,e,n){"use strict";function i(t,e){return t.native?{x:t.x,y:t.y}:u.getRelativePosition(t,e)}function a(t,e){var n,i,a,r,o;for(i=0,r=t.data.datasets.length;i<r;++i)if(t.isDatasetVisible(i))for(a=0,o=(n=t.getDatasetMeta(i)).data.length;a<o;++a){var s=n.data[a];s._view.skip||e(s)}}function r(t,e){var n=[];return a(t,function(t){t.inRange(e.x,e.y)&&n.push(t)}),n}function o(t,e,n,i){var r=Number.POSITIVE_INFINITY,o=[];return a(t,function(t){if(!n||t.inRange(e.x,e.y)){var a=t.getCenterPoint(),s=i(e,a);s<r?(o=[t],r=s):s===r&&o.push(t)}}),o}function s(t){var e=-1!==t.indexOf("x"),n=-1!==t.indexOf("y");return function(t,i){var a=e?Math.abs(t.x-i.x):0,r=n?Math.abs(t.y-i.y):0;return Math.sqrt(Math.pow(a,2)+Math.pow(r,2))}}function l(t,e,n){var a=i(e,t);n.axis=n.axis||"x";var l=s(n.axis),u=n.intersect?r(t,a):o(t,a,!1,l),d=[];return u.length?(t.data.datasets.forEach(function(e,n){if(t.isDatasetVisible(n)){var i=t.getDatasetMeta(n).data[u[0]._index];i&&!i._view.skip&&d.push(i)}}),d):[]}var u=t(45);e.exports={modes:{single:function(t,e){var n=i(e,t),r=[];return a(t,function(t){if(t.inRange(n.x,n.y))return r.push(t),r}),r.slice(0,1)},label:l,index:l,dataset:function(t,e,n){var a=i(e,t);n.axis=n.axis||"xy";var l=s(n.axis),u=n.intersect?r(t,a):o(t,a,!1,l);return u.length>0&&(u=t.getDatasetMeta(u[0]._datasetIndex).data),u},"x-axis":function(t,e){return l(t,e,{intersect:!0})},point:function(t,e){return r(t,i(e,t))},nearest:function(t,e,n){var a=i(e,t);n.axis=n.axis||"xy";var r=s(n.axis),l=o(t,a,n.intersect,r);return l.length>1&&l.sort(function(t,e){var n=t.getArea()-e.getArea();return 0===n&&(n=t._datasetIndex-e._datasetIndex),n}),l.slice(0,1)},x:function(t,e,n){var r=i(e,t),o=[],s=!1;return a(t,function(t){t.inXRange(r.x)&&o.push(t),t.inRange(r.x,r.y)&&(s=!0)}),n.intersect&&!s&&(o=[]),o},y:function(t,e,n){var r=i(e,t),o=[],s=!1;return a(t,function(t){t.inYRange(r.y)&&o.push(t),t.inRange(r.x,r.y)&&(s=!0)}),n.intersect&&!s&&(o=[]),o}}}},{45:45}],29:[function(t,e,n){"use strict";t(25)._set("global",{responsive:!0,responsiveAnimationDuration:0,maintainAspectRatio:!0,events:["mousemove","mouseout","click","touchstart","touchmove"],hover:{onHover:null,mode:"nearest",intersect:!0,animationDuration:400},onClick:null,defaultColor:"rgba(0,0,0,0.1)",defaultFontColor:"#666",defaultFontFamily:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",defaultFontSize:12,defaultFontStyle:"normal",showLines:!0,elements:{},layout:{padding:{top:0,right:0,bottom:0,left:0}}}),e.exports=function(){var t=function(t,e){return this.construct(t,e),this};return t.Chart=t,t}},{25:25}],30:[function(t,e,n){"use strict";var i=t(45);e.exports=function(t){function e(t,e){return i.where(t,function(t){return t.position===e})}function n(t,e){t.forEach(function(t,e){return t._tmpIndex_=e,t}),t.sort(function(t,n){var i=e?n:t,a=e?t:n;return i.weight===a.weight?i._tmpIndex_-a._tmpIndex_:i.weight-a.weight}),t.forEach(function(t){delete t._tmpIndex_})}t.layoutService={defaults:{},addBox:function(t,e){t.boxes||(t.boxes=[]),e.fullWidth=e.fullWidth||!1,e.position=e.position||"top",e.weight=e.weight||0,t.boxes.push(e)},removeBox:function(t,e){var n=t.boxes?t.boxes.indexOf(e):-1;-1!==n&&t.boxes.splice(n,1)},configure:function(t,e,n){for(var i,a=["fullWidth","position","weight"],r=a.length,o=0;o<r;++o)i=a[o],n.hasOwnProperty(i)&&(e[i]=n[i])},update:function(t,a,r){function o(t){var e=i.findNextWhere(D,function(e){return e.box===t});if(e)if(t.isHorizontal()){var n={left:Math.max(A,C),right:Math.max(O,P),top:0,bottom:0};t.update(t.fullWidth?b:M,x/2,n)}else t.update(e.minSize.width,S)}function s(t){t.isHorizontal()?(t.left=t.fullWidth?d:A,t.right=t.fullWidth?a-c:A+M,t.top=B,t.bottom=B+t.height,B=t.bottom):(t.left=z,t.right=z+t.width,t.top=F,t.bottom=F+S,z=t.right)}if(t){var l=t.options.layout||{},u=i.options.toPadding(l.padding),d=u.left,c=u.right,h=u.top,f=u.bottom,g=e(t.boxes,"left"),m=e(t.boxes,"right"),p=e(t.boxes,"top"),v=e(t.boxes,"bottom"),y=e(t.boxes,"chartArea");n(g,!0),n(m,!1),n(p,!0),n(v,!1);var b=a-d-c,x=r-h-f,_=x/2,k=(a-b/2)/(g.length+m.length),w=(r-_)/(p.length+v.length),M=b,S=x,D=[];i.each(g.concat(m,p,v),function(t){var e,n=t.isHorizontal();n?(e=t.update(t.fullWidth?b:M,w),S-=e.height):(e=t.update(k,_),M-=e.width),D.push({horizontal:n,minSize:e,box:t})});var C=0,P=0,T=0,I=0;i.each(p.concat(v),function(t){if(t.getPadding){var e=t.getPadding();C=Math.max(C,e.left),P=Math.max(P,e.right)}}),i.each(g.concat(m),function(t){if(t.getPadding){var e=t.getPadding();T=Math.max(T,e.top),I=Math.max(I,e.bottom)}});var A=d,O=c,F=h,R=f;i.each(g.concat(m),o),i.each(g,function(t){A+=t.width}),i.each(m,function(t){O+=t.width}),i.each(p.concat(v),o),i.each(p,function(t){F+=t.height}),i.each(v,function(t){R+=t.height}),i.each(g.concat(m),function(t){var e=i.findNextWhere(D,function(e){return e.box===t}),n={left:0,right:0,top:F,bottom:R};e&&t.update(e.minSize.width,S,n)}),A=d,O=c,F=h,R=f,i.each(g,function(t){A+=t.width}),i.each(m,function(t){O+=t.width}),i.each(p,function(t){F+=t.height}),i.each(v,function(t){R+=t.height});var L=Math.max(C-A,0);A+=L,O+=Math.max(P-O,0);var W=Math.max(T-F,0);F+=W,R+=Math.max(I-R,0);var Y=r-F-R,N=a-A-O;N===M&&Y===S||(i.each(g,function(t){t.height=Y}),i.each(m,function(t){t.height=Y}),i.each(p,function(t){t.fullWidth||(t.width=N)}),i.each(v,function(t){t.fullWidth||(t.width=N)}),S=Y,M=N);var z=d+L,B=h+W;i.each(g.concat(p),s),z+=M,B+=S,i.each(m,s),i.each(v,s),t.chartArea={left:A,top:F,right:A+M,bottom:F+S},i.each(y,function(e){e.left=t.chartArea.left,e.top=t.chartArea.top,e.right=t.chartArea.right,e.bottom=t.chartArea.bottom,e.update(M,S)})}}}}},{45:45}],31:[function(t,e,n){"use strict";var i=t(25),a=t(26),r=t(45);i._set("global",{plugins:{}}),e.exports=function(t){t.plugins={_plugins:[],_cacheId:0,register:function(t){var e=this._plugins;[].concat(t).forEach(function(t){-1===e.indexOf(t)&&e.push(t)}),this._cacheId++},unregister:function(t){var e=this._plugins;[].concat(t).forEach(function(t){var n=e.indexOf(t);-1!==n&&e.splice(n,1)}),this._cacheId++},clear:function(){this._plugins=[],this._cacheId++},count:function(){return this._plugins.length},getAll:function(){return this._plugins},notify:function(t,e,n){var i,a,r,o,s,l=this.descriptors(t),u=l.length;for(i=0;i<u;++i)if(a=l[i],r=a.plugin,"function"==typeof(s=r[e])&&((o=[t].concat(n||[])).push(a.options),!1===s.apply(r,o)))return!1;return!0},descriptors:function(t){var e=t._plugins||(t._plugins={});if(e.id===this._cacheId)return e.descriptors;var n=[],a=[],o=t&&t.config||{},s=o.options&&o.options.plugins||{};return this._plugins.concat(o.plugins||[]).forEach(function(t){if(-1===n.indexOf(t)){var e=t.id,o=s[e];!1!==o&&(!0===o&&(o=r.clone(i.global.plugins[e])),n.push(t),a.push({plugin:t,options:o||{}}))}}),e.descriptors=a,e.id=this._cacheId,a}},t.pluginService=t.plugins,t.PluginBase=a.extend({})}},{25:25,26:26,45:45}],32:[function(t,e,n){"use strict";function i(t){var e,n,i=[];for(e=0,n=t.length;e<n;++e)i.push(t[e].label);return i}function a(t,e,n){var i=t.getPixelForTick(e);return n&&(i-=0===e?(t.getPixelForTick(1)-i)/2:(i-t.getPixelForTick(e-1))/2),i}var r=t(25),o=t(26),s=t(45),l=t(34);r._set("scale",{display:!0,position:"left",offset:!1,gridLines:{display:!0,color:"rgba(0, 0, 0, 0.1)",lineWidth:1,drawBorder:!0,drawOnChartArea:!0,drawTicks:!0,tickMarkLength:10,zeroLineWidth:1,zeroLineColor:"rgba(0,0,0,0.25)",zeroLineBorderDash:[],zeroLineBorderDashOffset:0,offsetGridLines:!1,borderDash:[],borderDashOffset:0},scaleLabel:{display:!1,labelString:"",lineHeight:1.2,padding:{top:4,bottom:4}},ticks:{beginAtZero:!1,minRotation:0,maxRotation:50,mirror:!1,padding:0,reverse:!1,display:!0,autoSkip:!0,autoSkipPadding:0,labelOffset:0,callback:l.formatters.values,minor:{},major:{}}}),e.exports=function(t){function e(t,e,n){return s.isArray(e)?s.longestText(t,n,e):t.measureText(e).width}function n(t){var e=s.valueOrDefault,n=r.global,i=e(t.fontSize,n.defaultFontSize),a=e(t.fontStyle,n.defaultFontStyle),o=e(t.fontFamily,n.defaultFontFamily);return{size:i,style:a,family:o,font:s.fontString(i,a,o)}}function l(t){return s.options.toLineHeight(s.valueOrDefault(t.lineHeight,1.2),s.valueOrDefault(t.fontSize,r.global.defaultFontSize))}t.Scale=o.extend({getPadding:function(){var t=this;return{left:t.paddingLeft||0,top:t.paddingTop||0,right:t.paddingRight||0,bottom:t.paddingBottom||0}},getTicks:function(){return this._ticks},mergeTicksOptions:function(){var t=this.options.ticks;!1===t.minor&&(t.minor={display:!1}),!1===t.major&&(t.major={display:!1});for(var e in t)"major"!==e&&"minor"!==e&&(void 0===t.minor[e]&&(t.minor[e]=t[e]),void 0===t.major[e]&&(t.major[e]=t[e]))},beforeUpdate:function(){s.callback(this.options.beforeUpdate,[this])},update:function(t,e,n){var i,a,r,o,l,u,d=this;for(d.beforeUpdate(),d.maxWidth=t,d.maxHeight=e,d.margins=s.extend({left:0,right:0,top:0,bottom:0},n),d.longestTextCache=d.longestTextCache||{},d.beforeSetDimensions(),d.setDimensions(),d.afterSetDimensions(),d.beforeDataLimits(),d.determineDataLimits(),d.afterDataLimits(),d.beforeBuildTicks(),l=d.buildTicks()||[],d.afterBuildTicks(),d.beforeTickToLabelConversion(),r=d.convertTicksToLabels(l)||d.ticks,d.afterTickToLabelConversion(),d.ticks=r,i=0,a=r.length;i<a;++i)o=r[i],(u=l[i])?u.label=o:l.push(u={label:o,major:!1});return d._ticks=l,d.beforeCalculateTickRotation(),d.calculateTickRotation(),d.afterCalculateTickRotation(),d.beforeFit(),d.fit(),d.afterFit(),d.afterUpdate(),d.minSize},afterUpdate:function(){s.callback(this.options.afterUpdate,[this])},beforeSetDimensions:function(){s.callback(this.options.beforeSetDimensions,[this])},setDimensions:function(){var t=this;t.isHorizontal()?(t.width=t.maxWidth,t.left=0,t.right=t.width):(t.height=t.maxHeight,t.top=0,t.bottom=t.height),t.paddingLeft=0,t.paddingTop=0,t.paddingRight=0,t.paddingBottom=0},afterSetDimensions:function(){s.callback(this.options.afterSetDimensions,[this])},beforeDataLimits:function(){s.callback(this.options.beforeDataLimits,[this])},determineDataLimits:s.noop,afterDataLimits:function(){s.callback(this.options.afterDataLimits,[this])},beforeBuildTicks:function(){s.callback(this.options.beforeBuildTicks,[this])},buildTicks:s.noop,afterBuildTicks:function(){s.callback(this.options.afterBuildTicks,[this])},beforeTickToLabelConversion:function(){s.callback(this.options.beforeTickToLabelConversion,[this])},convertTicksToLabels:function(){var t=this,e=t.options.ticks;t.ticks=t.ticks.map(e.userCallback||e.callback,this)},afterTickToLabelConversion:function(){s.callback(this.options.afterTickToLabelConversion,[this])},beforeCalculateTickRotation:function(){s.callback(this.options.beforeCalculateTickRotation,[this])},calculateTickRotation:function(){var t=this,e=t.ctx,a=t.options.ticks,r=i(t._ticks),o=n(a);e.font=o.font;var l=a.minRotation||0;if(r.length&&t.options.display&&t.isHorizontal())for(var u,d=s.longestText(e,o.font,r,t.longestTextCache),c=d,h=t.getPixelForTick(1)-t.getPixelForTick(0)-6;c>h&&l<a.maxRotation;){var f=s.toRadians(l);if(u=Math.cos(f),Math.sin(f)*d>t.maxHeight){l--;break}l++,c=u*d}t.labelRotation=l},afterCalculateTickRotation:function(){s.callback(this.options.afterCalculateTickRotation,[this])},beforeFit:function(){s.callback(this.options.beforeFit,[this])},fit:function(){var t=this,a=t.minSize={width:0,height:0},r=i(t._ticks),o=t.options,u=o.ticks,d=o.scaleLabel,c=o.gridLines,h=o.display,f=t.isHorizontal(),g=n(u),m=o.gridLines.tickMarkLength;if(a.width=f?t.isFullWidth()?t.maxWidth-t.margins.left-t.margins.right:t.maxWidth:h&&c.drawTicks?m:0,a.height=f?h&&c.drawTicks?m:0:t.maxHeight,d.display&&h){var p=l(d)+s.options.toPadding(d.padding).height;f?a.height+=p:a.width+=p}if(u.display&&h){var v=s.longestText(t.ctx,g.font,r,t.longestTextCache),y=s.numberOfLabelLines(r),b=.5*g.size,x=t.options.ticks.padding;if(f){t.longestLabelWidth=v;var _=s.toRadians(t.labelRotation),k=Math.cos(_),w=Math.sin(_)*v+g.size*y+b*(y-1)+b;a.height=Math.min(t.maxHeight,a.height+w+x),t.ctx.font=g.font;var M=e(t.ctx,r[0],g.font),S=e(t.ctx,r[r.length-1],g.font);0!==t.labelRotation?(t.paddingLeft="bottom"===o.position?k*M+3:k*b+3,t.paddingRight="bottom"===o.position?k*b+3:k*S+3):(t.paddingLeft=M/2+3,t.paddingRight=S/2+3)}else u.mirror?v=0:v+=x+b,a.width=Math.min(t.maxWidth,a.width+v),t.paddingTop=g.size/2,t.paddingBottom=g.size/2}t.handleMargins(),t.width=a.width,t.height=a.height},handleMargins:function(){var t=this;t.margins&&(t.paddingLeft=Math.max(t.paddingLeft-t.margins.left,0),t.paddingTop=Math.max(t.paddingTop-t.margins.top,0),t.paddingRight=Math.max(t.paddingRight-t.margins.right,0),t.paddingBottom=Math.max(t.paddingBottom-t.margins.bottom,0))},afterFit:function(){s.callback(this.options.afterFit,[this])},isHorizontal:function(){return"top"===this.options.position||"bottom"===this.options.position},isFullWidth:function(){return this.options.fullWidth},getRightValue:function(t){if(s.isNullOrUndef(t))return NaN;if("number"==typeof t&&!isFinite(t))return NaN;if(t)if(this.isHorizontal()){if(void 0!==t.x)return this.getRightValue(t.x)}else if(void 0!==t.y)return this.getRightValue(t.y);return t},getLabelForIndex:s.noop,getPixelForValue:s.noop,getValueForPixel:s.noop,getPixelForTick:function(t){var e=this,n=e.options.offset;if(e.isHorizontal()){var i=(e.width-(e.paddingLeft+e.paddingRight))/Math.max(e._ticks.length-(n?0:1),1),a=i*t+e.paddingLeft;n&&(a+=i/2);var r=e.left+Math.round(a);return r+=e.isFullWidth()?e.margins.left:0}var o=e.height-(e.paddingTop+e.paddingBottom);return e.top+t*(o/(e._ticks.length-1))},getPixelForDecimal:function(t){var e=this;if(e.isHorizontal()){var n=(e.width-(e.paddingLeft+e.paddingRight))*t+e.paddingLeft,i=e.left+Math.round(n);return i+=e.isFullWidth()?e.margins.left:0}return e.top+t*e.height},getBasePixel:function(){return this.getPixelForValue(this.getBaseValue())},getBaseValue:function(){var t=this,e=t.min,n=t.max;return t.beginAtZero?0:e<0&&n<0?n:e>0&&n>0?e:0},_autoSkip:function(t){var e,n,i,a,r=this,o=r.isHorizontal(),l=r.options.ticks.minor,u=t.length,d=s.toRadians(r.labelRotation),c=Math.cos(d),h=r.longestLabelWidth*c,f=[];for(l.maxTicksLimit&&(a=l.maxTicksLimit),o&&(e=!1,(h+l.autoSkipPadding)*u>r.width-(r.paddingLeft+r.paddingRight)&&(e=1+Math.floor((h+l.autoSkipPadding)*u/(r.width-(r.paddingLeft+r.paddingRight)))),a&&u>a&&(e=Math.max(e,Math.floor(u/a)))),n=0;n<u;n++)i=t[n],((e>1&&n%e>0||n%e==0&&n+e>=u)&&n!==u-1||s.isNullOrUndef(i.label))&&delete i.label,f.push(i);return f},draw:function(t){var e=this,i=e.options;if(i.display){var o=e.ctx,u=r.global,d=i.ticks.minor,c=i.ticks.major||d,h=i.gridLines,f=i.scaleLabel,g=0!==e.labelRotation,m=e.isHorizontal(),p=d.autoSkip?e._autoSkip(e.getTicks()):e.getTicks(),v=s.valueOrDefault(d.fontColor,u.defaultFontColor),y=n(d),b=s.valueOrDefault(c.fontColor,u.defaultFontColor),x=n(c),_=h.drawTicks?h.tickMarkLength:0,k=s.valueOrDefault(f.fontColor,u.defaultFontColor),w=n(f),M=s.options.toPadding(f.padding),S=s.toRadians(e.labelRotation),D=[],C="right"===i.position?e.left:e.right-_,P="right"===i.position?e.left+_:e.right,T="bottom"===i.position?e.top:e.bottom-_,I="bottom"===i.position?e.top+_:e.bottom;if(s.each(p,function(n,r){if(void 0!==n.label){var o,l,c,f,v=n.label;r===e.zeroLineIndex&&i.offset===h.offsetGridLines?(o=h.zeroLineWidth,l=h.zeroLineColor,c=h.zeroLineBorderDash,f=h.zeroLineBorderDashOffset):(o=s.valueAtIndexOrDefault(h.lineWidth,r),l=s.valueAtIndexOrDefault(h.color,r),c=s.valueOrDefault(h.borderDash,u.borderDash),f=s.valueOrDefault(h.borderDashOffset,u.borderDashOffset));var y,b,x,k,w,M,A,O,F,R,L="middle",W="middle",Y=d.padding;if(m){var N=_+Y;"bottom"===i.position?(W=g?"middle":"top",L=g?"right":"center",R=e.top+N):(W=g?"middle":"bottom",L=g?"left":"center",R=e.bottom-N);var z=a(e,r,h.offsetGridLines&&p.length>1);z<e.left&&(l="rgba(0,0,0,0)"),z+=s.aliasPixel(o),F=e.getPixelForTick(r)+d.labelOffset,y=x=w=A=z,b=T,k=I,M=t.top,O=t.bottom}else{var B,V="left"===i.position;d.mirror?(L=V?"left":"right",B=Y):(L=V?"right":"left",B=_+Y),F=V?e.right-B:e.left+B;var H=a(e,r,h.offsetGridLines&&p.length>1);H<e.top&&(l="rgba(0,0,0,0)"),H+=s.aliasPixel(o),R=e.getPixelForTick(r)+d.labelOffset,y=C,x=P,w=t.left,A=t.right,b=k=M=O=H}D.push({tx1:y,ty1:b,tx2:x,ty2:k,x1:w,y1:M,x2:A,y2:O,labelX:F,labelY:R,glWidth:o,glColor:l,glBorderDash:c,glBorderDashOffset:f,rotation:-1*S,label:v,major:n.major,textBaseline:W,textAlign:L})}}),s.each(D,function(t){if(h.display&&(o.save(),o.lineWidth=t.glWidth,o.strokeStyle=t.glColor,o.setLineDash&&(o.setLineDash(t.glBorderDash),o.lineDashOffset=t.glBorderDashOffset),o.beginPath(),h.drawTicks&&(o.moveTo(t.tx1,t.ty1),o.lineTo(t.tx2,t.ty2)),h.drawOnChartArea&&(o.moveTo(t.x1,t.y1),o.lineTo(t.x2,t.y2)),o.stroke(),o.restore()),d.display){o.save(),o.translate(t.labelX,t.labelY),o.rotate(t.rotation),o.font=t.major?x.font:y.font,o.fillStyle=t.major?b:v,o.textBaseline=t.textBaseline,o.textAlign=t.textAlign;var e=t.label;if(s.isArray(e))for(var n=0,i=0;n<e.length;++n)o.fillText(""+e[n],0,i),i+=1.5*y.size;else o.fillText(e,0,0);o.restore()}}),f.display){var A,O,F=0,R=l(f)/2;if(m)A=e.left+(e.right-e.left)/2,O="bottom"===i.position?e.bottom-R-M.bottom:e.top+R+M.top;else{var L="left"===i.position;A=L?e.left+R+M.top:e.right-R-M.top,O=e.top+(e.bottom-e.top)/2,F=L?-.5*Math.PI:.5*Math.PI}o.save(),o.translate(A,O),o.rotate(F),o.textAlign="center",o.textBaseline="middle",o.fillStyle=k,o.font=w.font,o.fillText(f.labelString,0,0),o.restore()}if(h.drawBorder){o.lineWidth=s.valueAtIndexOrDefault(h.lineWidth,0),o.strokeStyle=s.valueAtIndexOrDefault(h.color,0);var W=e.left,Y=e.right,N=e.top,z=e.bottom,B=s.aliasPixel(o.lineWidth);m?(N=z="top"===i.position?e.bottom:e.top,N+=B,z+=B):(W=Y="left"===i.position?e.right:e.left,W+=B,Y+=B),o.beginPath(),o.moveTo(W,N),o.lineTo(Y,z),o.stroke()}}}})}},{25:25,26:26,34:34,45:45}],33:[function(t,e,n){"use strict";var i=t(25),a=t(45);e.exports=function(t){t.scaleService={constructors:{},defaults:{},registerScaleType:function(t,e,n){this.constructors[t]=e,this.defaults[t]=a.clone(n)},getScaleConstructor:function(t){return this.constructors.hasOwnProperty(t)?this.constructors[t]:void 0},getScaleDefaults:function(t){return this.defaults.hasOwnProperty(t)?a.merge({},[i.scale,this.defaults[t]]):{}},updateScaleDefaults:function(t,e){var n=this;n.defaults.hasOwnProperty(t)&&(n.defaults[t]=a.extend(n.defaults[t],e))},addScalesToLayout:function(e){a.each(e.scales,function(n){n.fullWidth=n.options.fullWidth,n.position=n.options.position,n.weight=n.options.weight,t.layoutService.addBox(e,n)})}}}},{25:25,45:45}],34:[function(t,e,n){"use strict";var i=t(45);e.exports={generators:{linear:function(t,e){var n,a=[];if(t.stepSize&&t.stepSize>0)n=t.stepSize;else{var r=i.niceNum(e.max-e.min,!1);n=i.niceNum(r/(t.maxTicks-1),!0)}var o=Math.floor(e.min/n)*n,s=Math.ceil(e.max/n)*n;t.min&&t.max&&t.stepSize&&i.almostWhole((t.max-t.min)/t.stepSize,n/1e3)&&(o=t.min,s=t.max);var l=(s-o)/n;l=i.almostEquals(l,Math.round(l),n/1e3)?Math.round(l):Math.ceil(l),a.push(void 0!==t.min?t.min:o);for(var u=1;u<l;++u)a.push(o+u*n);return a.push(void 0!==t.max?t.max:s),a},logarithmic:function(t,e){var n,a,r=[],o=i.valueOrDefault,s=o(t.min,Math.pow(10,Math.floor(i.log10(e.min)))),l=Math.floor(i.log10(e.max)),u=Math.ceil(e.max/Math.pow(10,l));0===s?(n=Math.floor(i.log10(e.minNotZero)),a=Math.floor(e.minNotZero/Math.pow(10,n)),r.push(s),s=a*Math.pow(10,n)):(n=Math.floor(i.log10(s)),a=Math.floor(s/Math.pow(10,n)));do{r.push(s),10===++a&&(a=1,++n),s=a*Math.pow(10,n)}while(n<l||n===l&&a<u);var d=o(t.max,s);return r.push(d),r}},formatters:{values:function(t){return i.isArray(t)?t:""+t},linear:function(t,e,n){var a=n.length>3?n[2]-n[1]:n[1]-n[0];Math.abs(a)>1&&t!==Math.floor(t)&&(a=t-Math.floor(t));var r=i.log10(Math.abs(a)),o="";if(0!==t){var s=-1*Math.floor(r);s=Math.max(Math.min(s,20),0),o=t.toFixed(s)}else o="0";return o},logarithmic:function(t,e,n){var a=t/Math.pow(10,Math.floor(i.log10(t)));return 0===t?"0":1===a||2===a||5===a||0===e||e===n.length-1?t.toExponential():""}}}},{45:45}],35:[function(t,e,n){"use strict";var i=t(25),a=t(26),r=t(45);i._set("global",{tooltips:{enabled:!0,custom:null,mode:"nearest",position:"average",intersect:!0,backgroundColor:"rgba(0,0,0,0.8)",titleFontStyle:"bold",titleSpacing:2,titleMarginBottom:6,titleFontColor:"#fff",titleAlign:"left",bodySpacing:2,bodyFontColor:"#fff",bodyAlign:"left",footerFontStyle:"bold",footerSpacing:2,footerMarginTop:6,footerFontColor:"#fff",footerAlign:"left",yPadding:6,xPadding:6,caretPadding:2,caretSize:5,cornerRadius:6,multiKeyBackground:"#fff",displayColors:!0,borderColor:"rgba(0,0,0,0)",borderWidth:0,callbacks:{beforeTitle:r.noop,title:function(t,e){var n="",i=e.labels,a=i?i.length:0;if(t.length>0){var r=t[0];r.xLabel?n=r.xLabel:a>0&&r.index<a&&(n=i[r.index])}return n},afterTitle:r.noop,beforeBody:r.noop,beforeLabel:r.noop,label:function(t,e){var n=e.datasets[t.datasetIndex].label||"";return n&&(n+=": "),n+=t.yLabel},labelColor:function(t,e){var n=e.getDatasetMeta(t.datasetIndex).data[t.index]._view;return{borderColor:n.borderColor,backgroundColor:n.backgroundColor}},labelTextColor:function(){return this._options.bodyFontColor},afterLabel:r.noop,afterBody:r.noop,beforeFooter:r.noop,footer:r.noop,afterFooter:r.noop}}}),e.exports=function(t){function e(t,e){var n=r.color(t);return n.alpha(e*n.alpha()).rgbaString()}function n(t,e){return e&&(r.isArray(e)?Array.prototype.push.apply(t,e):t.push(e)),t}function o(t){var e=t._xScale,n=t._yScale||t._scale,i=t._index,a=t._datasetIndex;return{xLabel:e?e.getLabelForIndex(i,a):"",yLabel:n?n.getLabelForIndex(i,a):"",index:i,datasetIndex:a,x:t._model.x,y:t._model.y}}function s(t){var e=i.global,n=r.valueOrDefault;return{xPadding:t.xPadding,yPadding:t.yPadding,xAlign:t.xAlign,yAlign:t.yAlign,bodyFontColor:t.bodyFontColor,_bodyFontFamily:n(t.bodyFontFamily,e.defaultFontFamily),_bodyFontStyle:n(t.bodyFontStyle,e.defaultFontStyle),_bodyAlign:t.bodyAlign,bodyFontSize:n(t.bodyFontSize,e.defaultFontSize),bodySpacing:t.bodySpacing,titleFontColor:t.titleFontColor,_titleFontFamily:n(t.titleFontFamily,e.defaultFontFamily),_titleFontStyle:n(t.titleFontStyle,e.defaultFontStyle),titleFontSize:n(t.titleFontSize,e.defaultFontSize),_titleAlign:t.titleAlign,titleSpacing:t.titleSpacing,titleMarginBottom:t.titleMarginBottom,footerFontColor:t.footerFontColor,_footerFontFamily:n(t.footerFontFamily,e.defaultFontFamily),_footerFontStyle:n(t.footerFontStyle,e.defaultFontStyle),footerFontSize:n(t.footerFontSize,e.defaultFontSize),_footerAlign:t.footerAlign,footerSpacing:t.footerSpacing,footerMarginTop:t.footerMarginTop,caretSize:t.caretSize,cornerRadius:t.cornerRadius,backgroundColor:t.backgroundColor,opacity:0,legendColorBackground:t.multiKeyBackground,displayColors:t.displayColors,borderColor:t.borderColor,borderWidth:t.borderWidth}}function l(t,e){var n=t._chart.ctx,i=2*e.yPadding,a=0,o=e.body,s=o.reduce(function(t,e){return t+e.before.length+e.lines.length+e.after.length},0);s+=e.beforeBody.length+e.afterBody.length;var l=e.title.length,u=e.footer.length,d=e.titleFontSize,c=e.bodyFontSize,h=e.footerFontSize;i+=l*d,i+=l?(l-1)*e.titleSpacing:0,i+=l?e.titleMarginBottom:0,i+=s*c,i+=s?(s-1)*e.bodySpacing:0,i+=u?e.footerMarginTop:0,i+=u*h,i+=u?(u-1)*e.footerSpacing:0;var f=0,g=function(t){a=Math.max(a,n.measureText(t).width+f)};return n.font=r.fontString(d,e._titleFontStyle,e._titleFontFamily),r.each(e.title,g),n.font=r.fontString(c,e._bodyFontStyle,e._bodyFontFamily),r.each(e.beforeBody.concat(e.afterBody),g),f=e.displayColors?c+2:0,r.each(o,function(t){r.each(t.before,g),r.each(t.lines,g),r.each(t.after,g)}),f=0,n.font=r.fontString(h,e._footerFontStyle,e._footerFontFamily),r.each(e.footer,g),a+=2*e.xPadding,{width:a,height:i}}function u(t,e){var n=t._model,i=t._chart,a=t._chart.chartArea,r="center",o="center";n.y<e.height?o="top":n.y>i.height-e.height&&(o="bottom");var s,l,u,d,c,h=(a.left+a.right)/2,f=(a.top+a.bottom)/2;"center"===o?(s=function(t){return t<=h},l=function(t){return t>h}):(s=function(t){return t<=e.width/2},l=function(t){return t>=i.width-e.width/2}),u=function(t){return t+e.width>i.width},d=function(t){return t-e.width<0},c=function(t){return t<=f?"top":"bottom"},s(n.x)?(r="left",u(n.x)&&(r="center",o=c(n.y))):l(n.x)&&(r="right",d(n.x)&&(r="center",o=c(n.y)));var g=t._options;return{xAlign:g.xAlign?g.xAlign:r,yAlign:g.yAlign?g.yAlign:o}}function d(t,e,n){var i=t.x,a=t.y,r=t.caretSize,o=t.caretPadding,s=t.cornerRadius,l=n.xAlign,u=n.yAlign,d=r+o,c=s+o;return"right"===l?i-=e.width:"center"===l&&(i-=e.width/2),"top"===u?a+=d:a-="bottom"===u?e.height+d:e.height/2,"center"===u?"left"===l?i+=d:"right"===l&&(i-=d):"left"===l?i-=c:"right"===l&&(i+=c),{x:i,y:a}}t.Tooltip=a.extend({initialize:function(){this._model=s(this._options)},getTitle:function(){var t=this,e=t._options.callbacks,i=e.beforeTitle.apply(t,arguments),a=e.title.apply(t,arguments),r=e.afterTitle.apply(t,arguments),o=[];return o=n(o,i),o=n(o,a),o=n(o,r)},getBeforeBody:function(){var t=this._options.callbacks.beforeBody.apply(this,arguments);return r.isArray(t)?t:void 0!==t?[t]:[]},getBody:function(t,e){var i=this,a=i._options.callbacks,o=[];return r.each(t,function(t){var r={before:[],lines:[],after:[]};n(r.before,a.beforeLabel.call(i,t,e)),n(r.lines,a.label.call(i,t,e)),n(r.after,a.afterLabel.call(i,t,e)),o.push(r)}),o},getAfterBody:function(){var t=this._options.callbacks.afterBody.apply(this,arguments);return r.isArray(t)?t:void 0!==t?[t]:[]},getFooter:function(){var t=this,e=t._options.callbacks,i=e.beforeFooter.apply(t,arguments),a=e.footer.apply(t,arguments),r=e.afterFooter.apply(t,arguments),o=[];return o=n(o,i),o=n(o,a),o=n(o,r)},update:function(e){var n,i,a=this,c=a._options,h=a._model,f=a._model=s(c),g=a._active,m=a._data,p={xAlign:h.xAlign,yAlign:h.yAlign},v={x:h.x,y:h.y},y={width:h.width,height:h.height},b={x:h.caretX,y:h.caretY};if(g.length){f.opacity=1;var x=[],_=[];b=t.Tooltip.positioners[c.position](g,a._eventPosition);var k=[];for(n=0,i=g.length;n<i;++n)k.push(o(g[n]));c.filter&&(k=k.filter(function(t){return c.filter(t,m)})),c.itemSort&&(k=k.sort(function(t,e){return c.itemSort(t,e,m)})),r.each(k,function(t){x.push(c.callbacks.labelColor.call(a,t,a._chart)),_.push(c.callbacks.labelTextColor.call(a,t,a._chart))}),f.title=a.getTitle(k,m),f.beforeBody=a.getBeforeBody(k,m),f.body=a.getBody(k,m),f.afterBody=a.getAfterBody(k,m),f.footer=a.getFooter(k,m),f.x=Math.round(b.x),f.y=Math.round(b.y),f.caretPadding=c.caretPadding,f.labelColors=x,f.labelTextColors=_,f.dataPoints=k,v=d(f,y=l(this,f),p=u(this,y))}else f.opacity=0;return f.xAlign=p.xAlign,f.yAlign=p.yAlign,f.x=v.x,f.y=v.y,f.width=y.width,f.height=y.height,f.caretX=b.x,f.caretY=b.y,a._model=f,e&&c.custom&&c.custom.call(a,f),a},drawCaret:function(t,e){var n=this._chart.ctx,i=this._view,a=this.getCaretPosition(t,e,i);n.lineTo(a.x1,a.y1),n.lineTo(a.x2,a.y2),n.lineTo(a.x3,a.y3)},getCaretPosition:function(t,e,n){var i,a,r,o,s,l,u=n.caretSize,d=n.cornerRadius,c=n.xAlign,h=n.yAlign,f=t.x,g=t.y,m=e.width,p=e.height;if("center"===h)s=g+p/2,"left"===c?(a=(i=f)-u,r=i,o=s+u,l=s-u):(a=(i=f+m)+u,r=i,o=s-u,l=s+u);else if("left"===c?(i=(a=f+d+u)-u,r=a+u):"right"===c?(i=(a=f+m-d-u)-u,r=a+u):(i=(a=f+m/2)-u,r=a+u),"top"===h)s=(o=g)-u,l=o;else{s=(o=g+p)+u,l=o;var v=r;r=i,i=v}return{x1:i,x2:a,x3:r,y1:o,y2:s,y3:l}},drawTitle:function(t,n,i,a){var o=n.title;if(o.length){i.textAlign=n._titleAlign,i.textBaseline="top";var s=n.titleFontSize,l=n.titleSpacing;i.fillStyle=e(n.titleFontColor,a),i.font=r.fontString(s,n._titleFontStyle,n._titleFontFamily);var u,d;for(u=0,d=o.length;u<d;++u)i.fillText(o[u],t.x,t.y),t.y+=s+l,u+1===o.length&&(t.y+=n.titleMarginBottom-l)}},drawBody:function(t,n,i,a){var o=n.bodyFontSize,s=n.bodySpacing,l=n.body;i.textAlign=n._bodyAlign,i.textBaseline="top",i.font=r.fontString(o,n._bodyFontStyle,n._bodyFontFamily);var u=0,d=function(e){i.fillText(e,t.x+u,t.y),t.y+=o+s};r.each(n.beforeBody,d);var c=n.displayColors;u=c?o+2:0,r.each(l,function(s,l){r.each(s.before,d),r.each(s.lines,function(r){if(c){i.fillStyle=e(n.legendColorBackground,a),i.fillRect(t.x,t.y,o,o),i.lineWidth=1,i.strokeStyle=e(n.labelColors[l].borderColor,a),i.strokeRect(t.x,t.y,o,o),i.fillStyle=e(n.labelColors[l].backgroundColor,a),i.fillRect(t.x+1,t.y+1,o-2,o-2);var s=e(n.labelTextColors[l],a);i.fillStyle=s}d(r)}),r.each(s.after,d)}),u=0,r.each(n.afterBody,d),t.y-=s},drawFooter:function(t,n,i,a){var o=n.footer;o.length&&(t.y+=n.footerMarginTop,i.textAlign=n._footerAlign,i.textBaseline="top",i.fillStyle=e(n.footerFontColor,a),i.font=r.fontString(n.footerFontSize,n._footerFontStyle,n._footerFontFamily),r.each(o,function(e){i.fillText(e,t.x,t.y),t.y+=n.footerFontSize+n.footerSpacing}))},drawBackground:function(t,n,i,a,r){i.fillStyle=e(n.backgroundColor,r),i.strokeStyle=e(n.borderColor,r),i.lineWidth=n.borderWidth;var o=n.xAlign,s=n.yAlign,l=t.x,u=t.y,d=a.width,c=a.height,h=n.cornerRadius;i.beginPath(),i.moveTo(l+h,u),"top"===s&&this.drawCaret(t,a),i.lineTo(l+d-h,u),i.quadraticCurveTo(l+d,u,l+d,u+h),"center"===s&&"right"===o&&this.drawCaret(t,a),i.lineTo(l+d,u+c-h),i.quadraticCurveTo(l+d,u+c,l+d-h,u+c),"bottom"===s&&this.drawCaret(t,a),i.lineTo(l+h,u+c),i.quadraticCurveTo(l,u+c,l,u+c-h),"center"===s&&"left"===o&&this.drawCaret(t,a),i.lineTo(l,u+h),i.quadraticCurveTo(l,u,l+h,u),i.closePath(),i.fill(),n.borderWidth>0&&i.stroke()},draw:function(){var t=this._chart.ctx,e=this._view;if(0!==e.opacity){var n={width:e.width,height:e.height},i={x:e.x,y:e.y},a=Math.abs(e.opacity<.001)?0:e.opacity,r=e.title.length||e.beforeBody.length||e.body.length||e.afterBody.length||e.footer.length;this._options.enabled&&r&&(this.drawBackground(i,e,t,n,a),i.x+=e.xPadding,i.y+=e.yPadding,this.drawTitle(i,e,t,a),this.drawBody(i,e,t,a),this.drawFooter(i,e,t,a))}},handleEvent:function(t){var e=this,n=e._options,i=!1;if(e._lastActive=e._lastActive||[],"mouseout"===t.type?e._active=[]:e._active=e._chart.getElementsAtEventForMode(t,n.mode,n),!(i=!r.arrayEquals(e._active,e._lastActive)))return!1;if(e._lastActive=e._active,n.enabled||n.custom){e._eventPosition={x:t.x,y:t.y};var a=e._model;e.update(!0),e.pivot(),i|=a.x!==e._model.x||a.y!==e._model.y}return i}}),t.Tooltip.positioners={average:function(t){if(!t.length)return!1;var e,n,i=0,a=0,r=0;for(e=0,n=t.length;e<n;++e){var o=t[e];if(o&&o.hasValue()){var s=o.tooltipPosition();i+=s.x,a+=s.y,++r}}return{x:Math.round(i/r),y:Math.round(a/r)}},nearest:function(t,e){var n,i,a,o=e.x,s=e.y,l=Number.POSITIVE_INFINITY;for(n=0,i=t.length;n<i;++n){var u=t[n];if(u&&u.hasValue()){var d=u.getCenterPoint(),c=r.distanceBetweenPoints(e,d);c<l&&(l=c,a=u)}}if(a){var h=a.tooltipPosition();o=h.x,s=h.y}return{x:o,y:s}}}}},{25:25,26:26,45:45}],36:[function(t,e,n){"use strict";var i=t(25),a=t(26),r=t(45);i._set("global",{elements:{arc:{backgroundColor:i.global.defaultColor,borderColor:"#fff",borderWidth:2}}}),e.exports=a.extend({inLabelRange:function(t){var e=this._view;return!!e&&Math.pow(t-e.x,2)<Math.pow(e.radius+e.hoverRadius,2)},inRange:function(t,e){var n=this._view;if(n){for(var i=r.getAngleFromPoint(n,{x:t,y:e}),a=i.angle,o=i.distance,s=n.startAngle,l=n.endAngle;l<s;)l+=2*Math.PI;for(;a>l;)a-=2*Math.PI;for(;a<s;)a+=2*Math.PI;var u=a>=s&&a<=l,d=o>=n.innerRadius&&o<=n.outerRadius;return u&&d}return!1},getCenterPoint:function(){var t=this._view,e=(t.startAngle+t.endAngle)/2,n=(t.innerRadius+t.outerRadius)/2;return{x:t.x+Math.cos(e)*n,y:t.y+Math.sin(e)*n}},getArea:function(){var t=this._view;return Math.PI*((t.endAngle-t.startAngle)/(2*Math.PI))*(Math.pow(t.outerRadius,2)-Math.pow(t.innerRadius,2))},tooltipPosition:function(){var t=this._view,e=t.startAngle+(t.endAngle-t.startAngle)/2,n=(t.outerRadius-t.innerRadius)/2+t.innerRadius;return{x:t.x+Math.cos(e)*n,y:t.y+Math.sin(e)*n}},draw:function(){var t=this._chart.ctx,e=this._view,n=e.startAngle,i=e.endAngle;t.beginPath(),t.arc(e.x,e.y,e.outerRadius,n,i),t.arc(e.x,e.y,e.innerRadius,i,n,!0),t.closePath(),t.strokeStyle=e.borderColor,t.lineWidth=e.borderWidth,t.fillStyle=e.backgroundColor,t.fill(),t.lineJoin="bevel",e.borderWidth&&t.stroke()}})},{25:25,26:26,45:45}],37:[function(t,e,n){"use strict";var i=t(25),a=t(26),r=t(45),o=i.global;i._set("global",{elements:{line:{tension:.4,backgroundColor:o.defaultColor,borderWidth:3,borderColor:o.defaultColor,borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",capBezierPoints:!0,fill:!0}}}),e.exports=a.extend({draw:function(){var t,e,n,i,a=this,s=a._view,l=a._chart.ctx,u=s.spanGaps,d=a._children.slice(),c=o.elements.line,h=-1;for(a._loop&&d.length&&d.push(d[0]),l.save(),l.lineCap=s.borderCapStyle||c.borderCapStyle,l.setLineDash&&l.setLineDash(s.borderDash||c.borderDash),l.lineDashOffset=s.borderDashOffset||c.borderDashOffset,l.lineJoin=s.borderJoinStyle||c.borderJoinStyle,l.lineWidth=s.borderWidth||c.borderWidth,l.strokeStyle=s.borderColor||o.defaultColor,l.beginPath(),h=-1,t=0;t<d.length;++t)e=d[t],n=r.previousItem(d,t),i=e._view,0===t?i.skip||(l.moveTo(i.x,i.y),h=t):(n=-1===h?n:d[h],i.skip||(h!==t-1&&!u||-1===h?l.moveTo(i.x,i.y):r.canvas.lineTo(l,n._view,e._view),h=t));l.stroke(),l.restore()}})},{25:25,26:26,45:45}],38:[function(t,e,n){"use strict";function i(t){var e=this._view;return!!e&&Math.pow(t-e.x,2)<Math.pow(e.radius+e.hitRadius,2)}var a=t(25),r=t(26),o=t(45),s=a.global.defaultColor;a._set("global",{elements:{point:{radius:3,pointStyle:"circle",backgroundColor:s,borderColor:s,borderWidth:1,hitRadius:1,hoverRadius:4,hoverBorderWidth:1}}}),e.exports=r.extend({inRange:function(t,e){var n=this._view;return!!n&&Math.pow(t-n.x,2)+Math.pow(e-n.y,2)<Math.pow(n.hitRadius+n.radius,2)},inLabelRange:i,inXRange:i,inYRange:function(t){var e=this._view;return!!e&&Math.pow(t-e.y,2)<Math.pow(e.radius+e.hitRadius,2)},getCenterPoint:function(){var t=this._view;return{x:t.x,y:t.y}},getArea:function(){return Math.PI*Math.pow(this._view.radius,2)},tooltipPosition:function(){var t=this._view;return{x:t.x,y:t.y,padding:t.radius+t.borderWidth}},draw:function(t){var e=this._view,n=this._model,i=this._chart.ctx,r=e.pointStyle,l=e.radius,u=e.x,d=e.y,c=o.color,h=0;e.skip||(i.strokeStyle=e.borderColor||s,i.lineWidth=o.valueOrDefault(e.borderWidth,a.global.elements.point.borderWidth),i.fillStyle=e.backgroundColor||s,void 0!==t&&(n.x<t.left||1.01*t.right<n.x||n.y<t.top||1.01*t.bottom<n.y)&&(n.x<t.left?h=(u-n.x)/(t.left-n.x):1.01*t.right<n.x?h=(n.x-u)/(n.x-t.right):n.y<t.top?h=(d-n.y)/(t.top-n.y):1.01*t.bottom<n.y&&(h=(n.y-d)/(n.y-t.bottom)),h=Math.round(100*h)/100,i.strokeStyle=c(i.strokeStyle).alpha(h).rgbString(),i.fillStyle=c(i.fillStyle).alpha(h).rgbString()),o.canvas.drawPoint(i,r,l,u,d))}})},{25:25,26:26,45:45}],39:[function(t,e,n){"use strict";function i(t){return void 0!==t._view.width}function a(t){var e,n,a,r,o=t._view;if(i(t)){var s=o.width/2;e=o.x-s,n=o.x+s,a=Math.min(o.y,o.base),r=Math.max(o.y,o.base)}else{var l=o.height/2;e=Math.min(o.x,o.base),n=Math.max(o.x,o.base),a=o.y-l,r=o.y+l}return{left:e,top:a,right:n,bottom:r}}var r=t(25),o=t(26);r._set("global",{elements:{rectangle:{backgroundColor:r.global.defaultColor,borderColor:r.global.defaultColor,borderSkipped:"bottom",borderWidth:0}}}),e.exports=o.extend({draw:function(){function t(t){return v[(y+t)%4]}var e,n,i,a,r,o,s,l=this._chart.ctx,u=this._view,d=u.borderWidth;if(u.horizontal?(e=u.base,n=u.x,i=u.y-u.height/2,a=u.y+u.height/2,r=n>e?1:-1,o=1,s=u.borderSkipped||"left"):(e=u.x-u.width/2,n=u.x+u.width/2,i=u.y,r=1,o=(a=u.base)>i?1:-1,s=u.borderSkipped||"bottom"),d){var c=Math.min(Math.abs(e-n),Math.abs(i-a)),h=(d=d>c?c:d)/2,f=e+("left"!==s?h*r:0),g=n+("right"!==s?-h*r:0),m=i+("top"!==s?h*o:0),p=a+("bottom"!==s?-h*o:0);f!==g&&(i=m,a=p),m!==p&&(e=f,n=g)}l.beginPath(),l.fillStyle=u.backgroundColor,l.strokeStyle=u.borderColor,l.lineWidth=d;var v=[[e,a],[e,i],[n,i],[n,a]],y=["bottom","left","top","right"].indexOf(s,0);-1===y&&(y=0);var b=t(0);l.moveTo(b[0],b[1]);for(var x=1;x<4;x++)b=t(x),l.lineTo(b[0],b[1]);l.fill(),d&&l.stroke()},height:function(){var t=this._view;return t.base-t.y},inRange:function(t,e){var n=!1;if(this._view){var i=a(this);n=t>=i.left&&t<=i.right&&e>=i.top&&e<=i.bottom}return n},inLabelRange:function(t,e){var n=this;if(!n._view)return!1;var r=a(n);return i(n)?t>=r.left&&t<=r.right:e>=r.top&&e<=r.bottom},inXRange:function(t){var e=a(this);return t>=e.left&&t<=e.right},inYRange:function(t){var e=a(this);return t>=e.top&&t<=e.bottom},getCenterPoint:function(){var t,e,n=this._view;return i(this)?(t=n.x,e=(n.y+n.base)/2):(t=(n.x+n.base)/2,e=n.y),{x:t,y:e}},getArea:function(){var t=this._view;return t.width*Math.abs(t.y-t.base)},tooltipPosition:function(){var t=this._view;return{x:t.x,y:t.y}}})},{25:25,26:26}],40:[function(t,e,n){"use strict";e.exports={},e.exports.Arc=t(36),e.exports.Line=t(37),e.exports.Point=t(38),e.exports.Rectangle=t(39)},{36:36,37:37,38:38,39:39}],41:[function(t,e,n){"use strict";var i=t(42),n=e.exports={clear:function(t){t.ctx.clearRect(0,0,t.width,t.height)},roundedRect:function(t,e,n,i,a,r){if(r){var o=Math.min(r,i/2),s=Math.min(r,a/2);t.moveTo(e+o,n),t.lineTo(e+i-o,n),t.quadraticCurveTo(e+i,n,e+i,n+s),t.lineTo(e+i,n+a-s),t.quadraticCurveTo(e+i,n+a,e+i-o,n+a),t.lineTo(e+o,n+a),t.quadraticCurveTo(e,n+a,e,n+a-s),t.lineTo(e,n+s),t.quadraticCurveTo(e,n,e+o,n)}else t.rect(e,n,i,a)},drawPoint:function(t,e,n,i,a){var r,o,s,l,u,d;if("object"!=typeof e||"[object HTMLImageElement]"!==(r=e.toString())&&"[object HTMLCanvasElement]"!==r){if(!(isNaN(n)||n<=0)){switch(e){default:t.beginPath(),t.arc(i,a,n,0,2*Math.PI),t.closePath(),t.fill();break;case"triangle":t.beginPath(),u=(o=3*n/Math.sqrt(3))*Math.sqrt(3)/2,t.moveTo(i-o/2,a+u/3),t.lineTo(i+o/2,a+u/3),t.lineTo(i,a-2*u/3),t.closePath(),t.fill();break;case"rect":d=1/Math.SQRT2*n,t.beginPath(),t.fillRect(i-d,a-d,2*d,2*d),t.strokeRect(i-d,a-d,2*d,2*d);break;case"rectRounded":var c=n/Math.SQRT2,h=i-c,f=a-c,g=Math.SQRT2*n;t.beginPath(),this.roundedRect(t,h,f,g,g,n/2),t.closePath(),t.fill();break;case"rectRot":d=1/Math.SQRT2*n,t.beginPath(),t.moveTo(i-d,a),t.lineTo(i,a+d),t.lineTo(i+d,a),t.lineTo(i,a-d),t.closePath(),t.fill();break;case"cross":t.beginPath(),t.moveTo(i,a+n),t.lineTo(i,a-n),t.moveTo(i-n,a),t.lineTo(i+n,a),t.closePath();break;case"crossRot":t.beginPath(),s=Math.cos(Math.PI/4)*n,l=Math.sin(Math.PI/4)*n,t.moveTo(i-s,a-l),t.lineTo(i+s,a+l),t.moveTo(i-s,a+l),t.lineTo(i+s,a-l),t.closePath();break;case"star":t.beginPath(),t.moveTo(i,a+n),t.lineTo(i,a-n),t.moveTo(i-n,a),t.lineTo(i+n,a),s=Math.cos(Math.PI/4)*n,l=Math.sin(Math.PI/4)*n,t.moveTo(i-s,a-l),t.lineTo(i+s,a+l),t.moveTo(i-s,a+l),t.lineTo(i+s,a-l),t.closePath();break;case"line":t.beginPath(),t.moveTo(i-n,a),t.lineTo(i+n,a),t.closePath();break;case"dash":t.beginPath(),t.moveTo(i,a),t.lineTo(i+n,a),t.closePath()}t.stroke()}}else t.drawImage(e,i-e.width/2,a-e.height/2,e.width,e.height)},clipArea:function(t,e){t.save(),t.beginPath(),t.rect(e.left,e.top,e.right-e.left,e.bottom-e.top),t.clip()},unclipArea:function(t){t.restore()},lineTo:function(t,e,n,i){if(n.steppedLine)return"after"===n.steppedLine&&!i||"after"!==n.steppedLine&&i?t.lineTo(e.x,n.y):t.lineTo(n.x,e.y),void t.lineTo(n.x,n.y);n.tension?t.bezierCurveTo(i?e.controlPointPreviousX:e.controlPointNextX,i?e.controlPointPreviousY:e.controlPointNextY,i?n.controlPointNextX:n.controlPointPreviousX,i?n.controlPointNextY:n.controlPointPreviousY,n.x,n.y):t.lineTo(n.x,n.y)}};i.clear=n.clear,i.drawRoundedRectangle=function(t){t.beginPath(),n.roundedRect.apply(n,arguments),t.closePath()}},{42:42}],42:[function(t,e,n){"use strict";var i={noop:function(){},uid:function(){var t=0;return function(){return t++}}(),isNullOrUndef:function(t){return null===t||void 0===t},isArray:Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},isObject:function(t){return null!==t&&"[object Object]"===Object.prototype.toString.call(t)},valueOrDefault:function(t,e){return void 0===t?e:t},valueAtIndexOrDefault:function(t,e,n){return i.valueOrDefault(i.isArray(t)?t[e]:t,n)},callback:function(t,e,n){if(t&&"function"==typeof t.call)return t.apply(n,e)},each:function(t,e,n,a){var r,o,s;if(i.isArray(t))if(o=t.length,a)for(r=o-1;r>=0;r--)e.call(n,t[r],r);else for(r=0;r<o;r++)e.call(n,t[r],r);else if(i.isObject(t))for(o=(s=Object.keys(t)).length,r=0;r<o;r++)e.call(n,t[s[r]],s[r])},arrayEquals:function(t,e){var n,a,r,o;if(!t||!e||t.length!==e.length)return!1;for(n=0,a=t.length;n<a;++n)if(r=t[n],o=e[n],r instanceof Array&&o instanceof Array){if(!i.arrayEquals(r,o))return!1}else if(r!==o)return!1;return!0},clone:function(t){if(i.isArray(t))return t.map(i.clone);if(i.isObject(t)){for(var e={},n=Object.keys(t),a=n.length,r=0;r<a;++r)e[n[r]]=i.clone(t[n[r]]);return e}return t},_merger:function(t,e,n,a){var r=e[t],o=n[t];i.isObject(r)&&i.isObject(o)?i.merge(r,o,a):e[t]=i.clone(o)},_mergerIf:function(t,e,n){var a=e[t],r=n[t];i.isObject(a)&&i.isObject(r)?i.mergeIf(a,r):e.hasOwnProperty(t)||(e[t]=i.clone(r))},merge:function(t,e,n){var a,r,o,s,l,u=i.isArray(e)?e:[e],d=u.length;if(!i.isObject(t))return t;for(a=(n=n||{}).merger||i._merger,r=0;r<d;++r)if(e=u[r],i.isObject(e))for(l=0,s=(o=Object.keys(e)).length;l<s;++l)a(o[l],t,e,n);return t},mergeIf:function(t,e){return i.merge(t,e,{merger:i._mergerIf})}};e.exports=i,i.callCallback=i.callback,i.indexOf=function(t,e,n){return Array.prototype.indexOf.call(t,e,n)},i.getValueOrDefault=i.valueOrDefault,i.getValueAtIndexOrDefault=i.valueAtIndexOrDefault},{}],43:[function(t,e,n){"use strict";var i=t(42),a={linear:function(t){return t},easeInQuad:function(t){return t*t},easeOutQuad:function(t){return-t*(t-2)},easeInOutQuad:function(t){return(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1)},easeInCubic:function(t){return t*t*t},easeOutCubic:function(t){return(t-=1)*t*t+1},easeInOutCubic:function(t){return(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2)},easeInQuart:function(t){return t*t*t*t},easeOutQuart:function(t){return-((t-=1)*t*t*t-1)},easeInOutQuart:function(t){return(t/=.5)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)},easeInQuint:function(t){return t*t*t*t*t},easeOutQuint:function(t){return(t-=1)*t*t*t*t+1},easeInOutQuint:function(t){return(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)},easeInSine:function(t){return 1-Math.cos(t*(Math.PI/2))},easeOutSine:function(t){return Math.sin(t*(Math.PI/2))},easeInOutSine:function(t){return-.5*(Math.cos(Math.PI*t)-1)},easeInExpo:function(t){return 0===t?0:Math.pow(2,10*(t-1))},easeOutExpo:function(t){return 1===t?1:1-Math.pow(2,-10*t)},easeInOutExpo:function(t){return 0===t?0:1===t?1:(t/=.5)<1?.5*Math.pow(2,10*(t-1)):.5*(2-Math.pow(2,-10*--t))},easeInCirc:function(t){return t>=1?t:-(Math.sqrt(1-t*t)-1)},easeOutCirc:function(t){return Math.sqrt(1-(t-=1)*t)},easeInOutCirc:function(t){return(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},easeInElastic:function(t){var e=1.70158,n=0,i=1;return 0===t?0:1===t?1:(n||(n=.3),i<1?(i=1,e=n/4):e=n/(2*Math.PI)*Math.asin(1/i),-i*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/n))},easeOutElastic:function(t){var e=1.70158,n=0,i=1;return 0===t?0:1===t?1:(n||(n=.3),i<1?(i=1,e=n/4):e=n/(2*Math.PI)*Math.asin(1/i),i*Math.pow(2,-10*t)*Math.sin((t-e)*(2*Math.PI)/n)+1)},easeInOutElastic:function(t){var e=1.70158,n=0,i=1;return 0===t?0:2==(t/=.5)?1:(n||(n=.45),i<1?(i=1,e=n/4):e=n/(2*Math.PI)*Math.asin(1/i),t<1?i*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/n)*-.5:i*Math.pow(2,-10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/n)*.5+1)},easeInBack:function(t){var e=1.70158;return t*t*((e+1)*t-e)},easeOutBack:function(t){var e=1.70158;return(t-=1)*t*((e+1)*t+e)+1},easeInOutBack:function(t){var e=1.70158;return(t/=.5)<1?t*t*((1+(e*=1.525))*t-e)*.5:.5*((t-=2)*t*((1+(e*=1.525))*t+e)+2)},easeInBounce:function(t){return 1-a.easeOutBounce(1-t)},easeOutBounce:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},easeInOutBounce:function(t){return t<.5?.5*a.easeInBounce(2*t):.5*a.easeOutBounce(2*t-1)+.5}};e.exports={effects:a},i.easingEffects=a},{42:42}],44:[function(t,e,n){"use strict";var i=t(42);e.exports={toLineHeight:function(t,e){var n=(""+t).match(/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/);if(!n||"normal"===n[1])return 1.2*e;switch(t=+n[2],n[3]){case"px":return t;case"%":t/=100}return e*t},toPadding:function(t){var e,n,a,r;return i.isObject(t)?(e=+t.top||0,n=+t.right||0,a=+t.bottom||0,r=+t.left||0):e=n=a=r=+t||0,{top:e,right:n,bottom:a,left:r,height:e+a,width:r+n}},resolve:function(t,e,n){var a,r,o;for(a=0,r=t.length;a<r;++a)if(void 0!==(o=t[a])&&(void 0!==e&&"function"==typeof o&&(o=o(e)),void 0!==n&&i.isArray(o)&&(o=o[n]),void 0!==o))return o}}},{42:42}],45:[function(t,e,n){"use strict";e.exports=t(42),e.exports.easing=t(43),e.exports.canvas=t(41),e.exports.options=t(44)},{41:41,42:42,43:43,44:44}],46:[function(t,e,n){e.exports={acquireContext:function(t){return t&&t.canvas&&(t=t.canvas),t&&t.getContext("2d")||null}}},{}],47:[function(t,e,n){"use strict";function i(t,e){var n=p.getStyle(t,e),i=n&&n.match(/^(\d+)(\.\d+)?px$/);return i?Number(i[1]):void 0}function a(t,e){var n=t.style,a=t.getAttribute("height"),r=t.getAttribute("width");if(t[v]={initial:{height:a,width:r,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||"block",null===r||""===r){var o=i(t,"width");void 0!==o&&(t.width=o)}if(null===a||""===a)if(""===t.style.height)t.height=t.width/(e.options.aspectRatio||2);else{var s=i(t,"height");void 0!==o&&(t.height=s)}return t}function r(t,e,n){t.addEventListener(e,n,w)}function o(t,e,n){t.removeEventListener(e,n,w)}function s(t,e,n,i,a){return{type:t,chart:e,native:a||null,x:void 0!==n?n:null,y:void 0!==i?i:null}}function l(t,e){var n=k[t.type]||t.type,i=p.getRelativePosition(t,e);return s(n,e,i.x,i.y,t)}function u(t,e){var n=!1,i=[];return function(){i=Array.prototype.slice.call(arguments),e=e||this,n||(n=!0,p.requestAnimFrame.call(window,function(){n=!1,t.apply(e,i)}))}}function d(t){var e=document.createElement("div"),n=y+"size-monitor",i="position:absolute;left:0;top:0;right:0;bottom:0;overflow:hidden;pointer-events:none;visibility:hidden;z-index:-1;";e.style.cssText=i,e.className=n,e.innerHTML='<div class="'+n+'-expand" style="'+i+'"><div style="position:absolute;width:1000000px;height:1000000px;left:0;top:0"></div></div><div class="'+n+'-shrink" style="'+i+'"><div style="position:absolute;width:200%;height:200%;left:0; top:0"></div></div>';var a=e.childNodes[0],o=e.childNodes[1];e._reset=function(){a.scrollLeft=1e6,a.scrollTop=1e6,o.scrollLeft=1e6,o.scrollTop=1e6};var s=function(){e._reset(),t()};return r(a,"scroll",s.bind(a,"expand")),r(o,"scroll",s.bind(o,"shrink")),e}function c(t,e){var n=(t[v]||(t[v]={})).renderProxy=function(t){t.animationName===x&&e()};p.each(_,function(e){r(t,e,n)}),t.classList.add(b)}function h(t){var e=t[v]||{},n=e.renderProxy;n&&(p.each(_,function(e){o(t,e,n)}),delete e.renderProxy),t.classList.remove(b)}function f(t,e,n){var i=t[v]||(t[v]={}),a=i.resizer=d(u(function(){if(i.resizer)return e(s("resize",n))}));c(t,function(){if(i.resizer){var e=t.parentNode;e&&e!==a.parentNode&&e.insertBefore(a,e.firstChild),a._reset()}})}function g(t){var e=t[v]||{},n=e.resizer;delete e.resizer,h(t),n&&n.parentNode&&n.parentNode.removeChild(n)}function m(t,e){var n=t._style||document.createElement("style");t._style||(t._style=n,e="/* Chart.js */\n"+e,n.setAttribute("type","text/css"),document.getElementsByTagName("head")[0].appendChild(n)),n.appendChild(document.createTextNode(e))}var p=t(45),v="$chartjs",y="chartjs-",b=y+"render-monitor",x=y+"render-animation",_=["animationstart","webkitAnimationStart"],k={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},w=!!function(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("e",null,e)}catch(t){}return t}()&&{passive:!0};e.exports={_enabled:"undefined"!=typeof window&&"undefined"!=typeof document,initialize:function(){var t="from{opacity:0.99}to{opacity:1}";m(this,"@-webkit-keyframes "+x+"{"+t+"}@keyframes "+x+"{"+t+"}."+b+"{-webkit-animation:"+x+" 0.001s;animation:"+x+" 0.001s;}")},acquireContext:function(t,e){"string"==typeof t?t=document.getElementById(t):t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas);var n=t&&t.getContext&&t.getContext("2d");return n&&n.canvas===t?(a(t,e),n):null},releaseContext:function(t){var e=t.canvas;if(e[v]){var n=e[v].initial;["height","width"].forEach(function(t){var i=n[t];p.isNullOrUndef(i)?e.removeAttribute(t):e.setAttribute(t,i)}),p.each(n.style||{},function(t,n){e.style[n]=t}),e.width=e.width,delete e[v]}},addEventListener:function(t,e,n){var i=t.canvas;if("resize"!==e){var a=n[v]||(n[v]={});r(i,e,(a.proxies||(a.proxies={}))[t.id+"_"+e]=function(e){n(l(e,t))})}else f(i,n,t)},removeEventListener:function(t,e,n){var i=t.canvas;if("resize"!==e){var a=((n[v]||{}).proxies||{})[t.id+"_"+e];a&&o(i,e,a)}else g(i)}},p.addEvent=r,p.removeEvent=o},{45:45}],48:[function(t,e,n){"use strict";var i=t(45),a=t(46),r=t(47),o=r._enabled?r:a;e.exports=i.extend({initialize:function(){},acquireContext:function(){},releaseContext:function(){},addEventListener:function(){},removeEventListener:function(){}},o)},{45:45,46:46,47:47}],49:[function(t,e,n){"use strict";var i=t(25),a=t(40),r=t(45);i._set("global",{plugins:{filler:{propagate:!0}}}),e.exports=function(){function t(t,e,n){var i,a=t._model||{},r=a.fill;if(void 0===r&&(r=!!a.backgroundColor),!1===r||null===r)return!1;if(!0===r)return"origin";if(i=parseFloat(r,10),isFinite(i)&&Math.floor(i)===i)return"-"!==r[0]&&"+"!==r[0]||(i=e+i),!(i===e||i<0||i>=n)&&i;switch(r){case"bottom":return"start";case"top":return"end";case"zero":return"origin";case"origin":case"start":case"end":return r;default:return!1}}function e(t){var e,n=t.el._model||{},i=t.el._scale||{},a=t.fill,r=null;if(isFinite(a))return null;if("start"===a?r=void 0===n.scaleBottom?i.bottom:n.scaleBottom:"end"===a?r=void 0===n.scaleTop?i.top:n.scaleTop:void 0!==n.scaleZero?r=n.scaleZero:i.getBasePosition?r=i.getBasePosition():i.getBasePixel&&(r=i.getBasePixel()),void 0!==r&&null!==r){if(void 0!==r.x&&void 0!==r.y)return r;if("number"==typeof r&&isFinite(r))return e=i.isHorizontal(),{x:e?r:null,y:e?null:r}}return null}function n(t,e,n){var i,a=t[e].fill,r=[e];if(!n)return a;for(;!1!==a&&-1===r.indexOf(a);){if(!isFinite(a))return a;if(!(i=t[a]))return!1;if(i.visible)return a;r.push(a),a=i.fill}return!1}function o(t){var e=t.fill,n="dataset";return!1===e?null:(isFinite(e)||(n="boundary"),d[n](t))}function s(t){return t&&!t.skip}function l(t,e,n,i,a){var o;if(i&&a){for(t.moveTo(e[0].x,e[0].y),o=1;o<i;++o)r.canvas.lineTo(t,e[o-1],e[o]);for(t.lineTo(n[a-1].x,n[a-1].y),o=a-1;o>0;--o)r.canvas.lineTo(t,n[o],n[o-1],!0)}}function u(t,e,n,i,a,r){var o,u,d,c,h,f,g,m=e.length,p=i.spanGaps,v=[],y=[],b=0,x=0;for(t.beginPath(),o=0,u=m+!!r;o<u;++o)h=n(c=e[d=o%m]._view,d,i),f=s(c),g=s(h),f&&g?(b=v.push(c),x=y.push(h)):b&&x&&(p?(f&&v.push(c),g&&y.push(h)):(l(t,v,y,b,x),b=x=0,v=[],y=[]));l(t,v,y,b,x),t.closePath(),t.fillStyle=a,t.fill()}var d={dataset:function(t){var e=t.fill,n=t.chart,i=n.getDatasetMeta(e),a=i&&n.isDatasetVisible(e)&&i.dataset._children||[],r=a.length||0;return r?function(t,e){return e<r&&a[e]._view||null}:null},boundary:function(t){var e=t.boundary,n=e?e.x:null,i=e?e.y:null;return function(t){return{x:null===n?t.x:n,y:null===i?t.y:i}}}};return{id:"filler",afterDatasetsUpdate:function(i,r){var s,l,u,d,c=(i.data.datasets||[]).length,h=r.propagate,f=[];for(l=0;l<c;++l)d=null,(u=(s=i.getDatasetMeta(l)).dataset)&&u._model&&u instanceof a.Line&&(d={visible:i.isDatasetVisible(l),fill:t(u,l,c),chart:i,el:u}),s.$filler=d,f.push(d);for(l=0;l<c;++l)(d=f[l])&&(d.fill=n(f,l,h),d.boundary=e(d),d.mapper=o(d))},beforeDatasetDraw:function(t,e){var n=e.meta.$filler;if(n){var a=t.ctx,o=n.el,s=o._view,l=o._children||[],d=n.mapper,c=s.backgroundColor||i.global.defaultColor;d&&c&&l.length&&(r.canvas.clipArea(a,t.chartArea),u(a,l,d,s,c,o._loop),r.canvas.unclipArea(a))}}}}},{25:25,40:40,45:45}],50:[function(t,e,n){"use strict";var i=t(25),a=t(26),r=t(45);i._set("global",{legend:{display:!0,position:"top",fullWidth:!0,reverse:!1,weight:1e3,onClick:function(t,e){var n=e.datasetIndex,i=this.chart,a=i.getDatasetMeta(n);a.hidden=null===a.hidden?!i.data.datasets[n].hidden:null,i.update()},onHover:null,labels:{boxWidth:40,padding:10,generateLabels:function(t){var e=t.data;return r.isArray(e.datasets)?e.datasets.map(function(e,n){return{text:e.label,fillStyle:r.isArray(e.backgroundColor)?e.backgroundColor[0]:e.backgroundColor,hidden:!t.isDatasetVisible(n),lineCap:e.borderCapStyle,lineDash:e.borderDash,lineDashOffset:e.borderDashOffset,lineJoin:e.borderJoinStyle,lineWidth:e.borderWidth,strokeStyle:e.borderColor,pointStyle:e.pointStyle,datasetIndex:n}},this):[]}}},legendCallback:function(t){var e=[];e.push('<ul class="'+t.id+'-legend">');for(var n=0;n<t.data.datasets.length;n++)e.push('<li><span style="background-color:'+t.data.datasets[n].backgroundColor+'"></span>'),t.data.datasets[n].label&&e.push(t.data.datasets[n].label),e.push("</li>");return e.push("</ul>"),e.join("")}}),e.exports=function(t){function e(t,e){return t.usePointStyle?e*Math.SQRT2:t.boxWidth}function n(e,n){var i=new t.Legend({ctx:e.ctx,options:n,chart:e});o.configure(e,i,n),o.addBox(e,i),e.legend=i}var o=t.layoutService,s=r.noop;return t.Legend=a.extend({initialize:function(t){r.extend(this,t),this.legendHitBoxes=[],this.doughnutMode=!1},beforeUpdate:s,update:function(t,e,n){var i=this;return i.beforeUpdate(),i.maxWidth=t,i.maxHeight=e,i.margins=n,i.beforeSetDimensions(),i.setDimensions(),i.afterSetDimensions(),i.beforeBuildLabels(),i.buildLabels(),i.afterBuildLabels(),i.beforeFit(),i.fit(),i.afterFit(),i.afterUpdate(),i.minSize},afterUpdate:s,beforeSetDimensions:s,setDimensions:function(){var t=this;t.isHorizontal()?(t.width=t.maxWidth,t.left=0,t.right=t.width):(t.height=t.maxHeight,t.top=0,t.bottom=t.height),t.paddingLeft=0,t.paddingTop=0,t.paddingRight=0,t.paddingBottom=0,t.minSize={width:0,height:0}},afterSetDimensions:s,beforeBuildLabels:s,buildLabels:function(){var t=this,e=t.options.labels||{},n=r.callback(e.generateLabels,[t.chart],t)||[];e.filter&&(n=n.filter(function(n){return e.filter(n,t.chart.data)})),t.options.reverse&&n.reverse(),t.legendItems=n},afterBuildLabels:s,beforeFit:s,fit:function(){var t=this,n=t.options,a=n.labels,o=n.display,s=t.ctx,l=i.global,u=r.valueOrDefault,d=u(a.fontSize,l.defaultFontSize),c=u(a.fontStyle,l.defaultFontStyle),h=u(a.fontFamily,l.defaultFontFamily),f=r.fontString(d,c,h),g=t.legendHitBoxes=[],m=t.minSize,p=t.isHorizontal();if(p?(m.width=t.maxWidth,m.height=o?10:0):(m.width=o?10:0,m.height=t.maxHeight),o)if(s.font=f,p){var v=t.lineWidths=[0],y=t.legendItems.length?d+a.padding:0;s.textAlign="left",s.textBaseline="top",r.each(t.legendItems,function(n,i){var r=e(a,d)+d/2+s.measureText(n.text).width;v[v.length-1]+r+a.padding>=t.width&&(y+=d+a.padding,v[v.length]=t.left),g[i]={left:0,top:0,width:r,height:d},v[v.length-1]+=r+a.padding}),m.height+=y}else{var b=a.padding,x=t.columnWidths=[],_=a.padding,k=0,w=0,M=d+b;r.each(t.legendItems,function(t,n){var i=e(a,d)+d/2+s.measureText(t.text).width;w+M>m.height&&(_+=k+a.padding,x.push(k),k=0,w=0),k=Math.max(k,i),w+=M,g[n]={left:0,top:0,width:i,height:d}}),_+=k,x.push(k),m.width+=_}t.width=m.width,t.height=m.height},afterFit:s,isHorizontal:function(){return"top"===this.options.position||"bottom"===this.options.position},draw:function(){var t=this,n=t.options,a=n.labels,o=i.global,s=o.elements.line,l=t.width,u=t.lineWidths;if(n.display){var d,c=t.ctx,h=r.valueOrDefault,f=h(a.fontColor,o.defaultFontColor),g=h(a.fontSize,o.defaultFontSize),m=h(a.fontStyle,o.defaultFontStyle),p=h(a.fontFamily,o.defaultFontFamily),v=r.fontString(g,m,p);c.textAlign="left",c.textBaseline="middle",c.lineWidth=.5,c.strokeStyle=f,c.fillStyle=f,c.font=v;var y=e(a,g),b=t.legendHitBoxes,x=function(t,e,i){if(!(isNaN(y)||y<=0)){c.save(),c.fillStyle=h(i.fillStyle,o.defaultColor),c.lineCap=h(i.lineCap,s.borderCapStyle),c.lineDashOffset=h(i.lineDashOffset,s.borderDashOffset),c.lineJoin=h(i.lineJoin,s.borderJoinStyle),c.lineWidth=h(i.lineWidth,s.borderWidth),c.strokeStyle=h(i.strokeStyle,o.defaultColor);var a=0===h(i.lineWidth,s.borderWidth);if(c.setLineDash&&c.setLineDash(h(i.lineDash,s.borderDash)),n.labels&&n.labels.usePointStyle){var l=g*Math.SQRT2/2,u=l/Math.SQRT2,d=t+u,f=e+u;r.canvas.drawPoint(c,i.pointStyle,l,d,f)}else a||c.strokeRect(t,e,y,g),c.fillRect(t,e,y,g);c.restore()}},_=function(t,e,n,i){var a=g/2,r=y+a+t,o=e+a;c.fillText(n.text,r,o),n.hidden&&(c.beginPath(),c.lineWidth=2,c.moveTo(r,o),c.lineTo(r+i,o),c.stroke())},k=t.isHorizontal();d=k?{x:t.left+(l-u[0])/2,y:t.top+a.padding,line:0}:{x:t.left+a.padding,y:t.top+a.padding,line:0};var w=g+a.padding;r.each(t.legendItems,function(e,n){var i=c.measureText(e.text).width,r=y+g/2+i,o=d.x,s=d.y;k?o+r>=l&&(s=d.y+=w,d.line++,o=d.x=t.left+(l-u[d.line])/2):s+w>t.bottom&&(o=d.x=o+t.columnWidths[d.line]+a.padding,s=d.y=t.top+a.padding,d.line++),x(o,s,e),b[n].left=o,b[n].top=s,_(o,s,e,i),k?d.x+=r+a.padding:d.y+=w})}},handleEvent:function(t){var e=this,n=e.options,i="mouseup"===t.type?"click":t.type,a=!1;if("mousemove"===i){if(!n.onHover)return}else{if("click"!==i)return;if(!n.onClick)return}var r=t.x,o=t.y;if(r>=e.left&&r<=e.right&&o>=e.top&&o<=e.bottom)for(var s=e.legendHitBoxes,l=0;l<s.length;++l){var u=s[l];if(r>=u.left&&r<=u.left+u.width&&o>=u.top&&o<=u.top+u.height){if("click"===i){n.onClick.call(e,t.native,e.legendItems[l]),a=!0;break}if("mousemove"===i){n.onHover.call(e,t.native,e.legendItems[l]),a=!0;break}}}return a}}),{id:"legend",beforeInit:function(t){var e=t.options.legend;e&&n(t,e)},beforeUpdate:function(t){var e=t.options.legend,a=t.legend;e?(r.mergeIf(e,i.global.legend),a?(o.configure(t,a,e),a.options=e):n(t,e)):a&&(o.removeBox(t,a),delete t.legend)},afterEvent:function(t,e){var n=t.legend;n&&n.handleEvent(e)}}}},{25:25,26:26,45:45}],51:[function(t,e,n){"use strict";var i=t(25),a=t(26),r=t(45);i._set("global",{title:{display:!1,fontStyle:"bold",fullWidth:!0,lineHeight:1.2,padding:10,position:"top",text:"",weight:2e3}}),e.exports=function(t){function e(e,i){var a=new t.Title({ctx:e.ctx,options:i,chart:e});n.configure(e,a,i),n.addBox(e,a),e.titleBlock=a}var n=t.layoutService,o=r.noop;return t.Title=a.extend({initialize:function(t){var e=this;r.extend(e,t),e.legendHitBoxes=[]},beforeUpdate:o,update:function(t,e,n){var i=this;return i.beforeUpdate(),i.maxWidth=t,i.maxHeight=e,i.margins=n,i.beforeSetDimensions(),i.setDimensions(),i.afterSetDimensions(),i.beforeBuildLabels(),i.buildLabels(),i.afterBuildLabels(),i.beforeFit(),i.fit(),i.afterFit(),i.afterUpdate(),i.minSize},afterUpdate:o,beforeSetDimensions:o,setDimensions:function(){var t=this;t.isHorizontal()?(t.width=t.maxWidth,t.left=0,t.right=t.width):(t.height=t.maxHeight,t.top=0,t.bottom=t.height),t.paddingLeft=0,t.paddingTop=0,t.paddingRight=0,t.paddingBottom=0,t.minSize={width:0,height:0}},afterSetDimensions:o,beforeBuildLabels:o,buildLabels:o,afterBuildLabels:o,beforeFit:o,fit:function(){var t=this,e=r.valueOrDefault,n=t.options,a=n.display,o=e(n.fontSize,i.global.defaultFontSize),s=t.minSize,l=r.isArray(n.text)?n.text.length:1,u=r.options.toLineHeight(n.lineHeight,o),d=a?l*u+2*n.padding:0;t.isHorizontal()?(s.width=t.maxWidth,s.height=d):(s.width=d,s.height=t.maxHeight),t.width=s.width,t.height=s.height},afterFit:o,isHorizontal:function(){var t=this.options.position;return"top"===t||"bottom"===t},draw:function(){var t=this,e=t.ctx,n=r.valueOrDefault,a=t.options,o=i.global;if(a.display){var s,l,u,d=n(a.fontSize,o.defaultFontSize),c=n(a.fontStyle,o.defaultFontStyle),h=n(a.fontFamily,o.defaultFontFamily),f=r.fontString(d,c,h),g=r.options.toLineHeight(a.lineHeight,d),m=g/2+a.padding,p=0,v=t.top,y=t.left,b=t.bottom,x=t.right;e.fillStyle=n(a.fontColor,o.defaultFontColor),e.font=f,t.isHorizontal()?(l=y+(x-y)/2,u=v+m,s=x-y):(l="left"===a.position?y+m:x-m,u=v+(b-v)/2,s=b-v,p=Math.PI*("left"===a.position?-.5:.5)),e.save(),e.translate(l,u),e.rotate(p),e.textAlign="center",e.textBaseline="middle";var _=a.text;if(r.isArray(_))for(var k=0,w=0;w<_.length;++w)e.fillText(_[w],0,k,s),k+=g;else e.fillText(_,0,0,s);e.restore()}}}),{id:"title",beforeInit:function(t){var n=t.options.title;n&&e(t,n)},beforeUpdate:function(a){var o=a.options.title,s=a.titleBlock;o?(r.mergeIf(o,i.global.title),s?(n.configure(a,s,o),s.options=o):e(a,o)):s&&(t.layoutService.removeBox(a,s),delete a.titleBlock)}}}},{25:25,26:26,45:45}],52:[function(t,e,n){"use strict";e.exports=function(t){var e={position:"bottom"},n=t.Scale.extend({getLabels:function(){var t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels},determineDataLimits:function(){var t=this,e=t.getLabels();t.minIndex=0,t.maxIndex=e.length-1;var n;void 0!==t.options.ticks.min&&(n=e.indexOf(t.options.ticks.min),t.minIndex=-1!==n?n:t.minIndex),void 0!==t.options.ticks.max&&(n=e.indexOf(t.options.ticks.max),t.maxIndex=-1!==n?n:t.maxIndex),t.min=e[t.minIndex],t.max=e[t.maxIndex]},buildTicks:function(){var t=this,e=t.getLabels();t.ticks=0===t.minIndex&&t.maxIndex===e.length-1?e:e.slice(t.minIndex,t.maxIndex+1)},getLabelForIndex:function(t,e){var n=this,i=n.chart.data,a=n.isHorizontal();return i.yLabels&&!a?n.getRightValue(i.datasets[e].data[t]):n.ticks[t-n.minIndex]},getPixelForValue:function(t,e){var n,i=this,a=i.options.offset,r=Math.max(i.maxIndex+1-i.minIndex-(a?0:1),1);if(void 0!==t&&null!==t&&(n=i.isHorizontal()?t.x:t.y),void 0!==n||void 0!==t&&isNaN(e)){var o=i.getLabels();t=n||t;var s=o.indexOf(t);e=-1!==s?s:e}if(i.isHorizontal()){var l=i.width/r,u=l*(e-i.minIndex);return a&&(u+=l/2),i.left+Math.round(u)}var d=i.height/r,c=d*(e-i.minIndex);return a&&(c+=d/2),i.top+Math.round(c)},getPixelForTick:function(t){return this.getPixelForValue(this.ticks[t],t+this.minIndex,null)},getValueForPixel:function(t){var e=this,n=e.options.offset,i=Math.max(e._ticks.length-(n?0:1),1),a=e.isHorizontal(),r=(a?e.width:e.height)/i;return t-=a?e.left:e.top,n&&(t-=r/2),(t<=0?0:Math.round(t/r))+e.minIndex},getBasePixel:function(){return this.bottom}});t.scaleService.registerScaleType("category",n,e)}},{}],53:[function(t,e,n){"use strict";var i=t(25),a=t(45),r=t(34);e.exports=function(t){var e={position:"left",ticks:{callback:r.formatters.linear}},n=t.LinearScaleBase.extend({determineDataLimits:function(){function t(t){return o?t.xAxisID===e.id:t.yAxisID===e.id}var e=this,n=e.options,i=e.chart,r=i.data.datasets,o=e.isHorizontal();e.min=null,e.max=null;var s=n.stacked;if(void 0===s&&a.each(r,function(e,n){if(!s){var a=i.getDatasetMeta(n);i.isDatasetVisible(n)&&t(a)&&void 0!==a.stack&&(s=!0)}}),n.stacked||s){var l={};a.each(r,function(r,o){var s=i.getDatasetMeta(o),u=[s.type,void 0===n.stacked&&void 0===s.stack?o:"",s.stack].join(".");void 0===l[u]&&(l[u]={positiveValues:[],negativeValues:[]});var d=l[u].positiveValues,c=l[u].negativeValues;i.isDatasetVisible(o)&&t(s)&&a.each(r.data,function(t,i){var a=+e.getRightValue(t);isNaN(a)||s.data[i].hidden||(d[i]=d[i]||0,c[i]=c[i]||0,n.relativePoints?d[i]=100:a<0?c[i]+=a:d[i]+=a)})}),a.each(l,function(t){var n=t.positiveValues.concat(t.negativeValues),i=a.min(n),r=a.max(n);e.min=null===e.min?i:Math.min(e.min,i),e.max=null===e.max?r:Math.max(e.max,r)})}else a.each(r,function(n,r){var o=i.getDatasetMeta(r);i.isDatasetVisible(r)&&t(o)&&a.each(n.data,function(t,n){var i=+e.getRightValue(t);isNaN(i)||o.data[n].hidden||(null===e.min?e.min=i:i<e.min&&(e.min=i),null===e.max?e.max=i:i>e.max&&(e.max=i))})});e.min=isFinite(e.min)&&!isNaN(e.min)?e.min:0,e.max=isFinite(e.max)&&!isNaN(e.max)?e.max:1,this.handleTickRangeOptions()},getTickLimit:function(){var t,e=this,n=e.options.ticks;if(e.isHorizontal())t=Math.min(n.maxTicksLimit?n.maxTicksLimit:11,Math.ceil(e.width/50));else{var r=a.valueOrDefault(n.fontSize,i.global.defaultFontSize);t=Math.min(n.maxTicksLimit?n.maxTicksLimit:11,Math.ceil(e.height/(2*r)))}return t},handleDirectionalChanges:function(){this.isHorizontal()||this.ticks.reverse()},getLabelForIndex:function(t,e){return+this.getRightValue(this.chart.data.datasets[e].data[t])},getPixelForValue:function(t){var e,n=this,i=n.start,a=+n.getRightValue(t),r=n.end-i;return n.isHorizontal()?(e=n.left+n.width/r*(a-i),Math.round(e)):(e=n.bottom-n.height/r*(a-i),Math.round(e))},getValueForPixel:function(t){var e=this,n=e.isHorizontal(),i=n?e.width:e.height,a=(n?t-e.left:e.bottom-t)/i;return e.start+(e.end-e.start)*a},getPixelForTick:function(t){return this.getPixelForValue(this.ticksAsNumbers[t])}});t.scaleService.registerScaleType("linear",n,e)}},{25:25,34:34,45:45}],54:[function(t,e,n){"use strict";var i=t(45),a=t(34);e.exports=function(t){var e=i.noop;t.LinearScaleBase=t.Scale.extend({getRightValue:function(e){return"string"==typeof e?+e:t.Scale.prototype.getRightValue.call(this,e)},handleTickRangeOptions:function(){var t=this,e=t.options.ticks;if(e.beginAtZero){var n=i.sign(t.min),a=i.sign(t.max);n<0&&a<0?t.max=0:n>0&&a>0&&(t.min=0)}var r=void 0!==e.min||void 0!==e.suggestedMin,o=void 0!==e.max||void 0!==e.suggestedMax;void 0!==e.min?t.min=e.min:void 0!==e.suggestedMin&&(null===t.min?t.min=e.suggestedMin:t.min=Math.min(t.min,e.suggestedMin)),void 0!==e.max?t.max=e.max:void 0!==e.suggestedMax&&(null===t.max?t.max=e.suggestedMax:t.max=Math.max(t.max,e.suggestedMax)),r!==o&&t.min>=t.max&&(r?t.max=t.min+1:t.min=t.max-1),t.min===t.max&&(t.max++,e.beginAtZero||t.min--)},getTickLimit:e,handleDirectionalChanges:e,buildTicks:function(){var t=this,e=t.options.ticks,n=t.getTickLimit(),r={maxTicks:n=Math.max(2,n),min:e.min,max:e.max,stepSize:i.valueOrDefault(e.fixedStepSize,e.stepSize)},o=t.ticks=a.generators.linear(r,t);t.handleDirectionalChanges(),t.max=i.max(o),t.min=i.min(o),e.reverse?(o.reverse(),t.start=t.max,t.end=t.min):(t.start=t.min,t.end=t.max)},convertTicksToLabels:function(){var e=this;e.ticksAsNumbers=e.ticks.slice(),e.zeroLineIndex=e.ticks.indexOf(0),t.Scale.prototype.convertTicksToLabels.call(e)}})}},{34:34,45:45}],55:[function(t,e,n){"use strict";var i=t(45),a=t(34);e.exports=function(t){var e={position:"left",ticks:{callback:a.formatters.logarithmic}},n=t.Scale.extend({determineDataLimits:function(){function t(t){return l?t.xAxisID===e.id:t.yAxisID===e.id}var e=this,n=e.options,a=n.ticks,r=e.chart,o=r.data.datasets,s=i.valueOrDefault,l=e.isHorizontal();e.min=null,e.max=null,e.minNotZero=null;var u=n.stacked;if(void 0===u&&i.each(o,function(e,n){if(!u){var i=r.getDatasetMeta(n);r.isDatasetVisible(n)&&t(i)&&void 0!==i.stack&&(u=!0)}}),n.stacked||u){var d={};i.each(o,function(a,o){var s=r.getDatasetMeta(o),l=[s.type,void 0===n.stacked&&void 0===s.stack?o:"",s.stack].join(".");r.isDatasetVisible(o)&&t(s)&&(void 0===d[l]&&(d[l]=[]),i.each(a.data,function(t,i){var a=d[l],r=+e.getRightValue(t);isNaN(r)||s.data[i].hidden||(a[i]=a[i]||0,n.relativePoints?a[i]=100:a[i]+=r)}))}),i.each(d,function(t){var n=i.min(t),a=i.max(t);e.min=null===e.min?n:Math.min(e.min,n),e.max=null===e.max?a:Math.max(e.max,a)})}else i.each(o,function(n,a){var o=r.getDatasetMeta(a);r.isDatasetVisible(a)&&t(o)&&i.each(n.data,function(t,n){var i=+e.getRightValue(t);isNaN(i)||o.data[n].hidden||(null===e.min?e.min=i:i<e.min&&(e.min=i),null===e.max?e.max=i:i>e.max&&(e.max=i),0!==i&&(null===e.minNotZero||i<e.minNotZero)&&(e.minNotZero=i))})});e.min=s(a.min,e.min),e.max=s(a.max,e.max),e.min===e.max&&(0!==e.min&&null!==e.min?(e.min=Math.pow(10,Math.floor(i.log10(e.min))-1),e.max=Math.pow(10,Math.floor(i.log10(e.max))+1)):(e.min=1,e.max=10))},buildTicks:function(){var t=this,e=t.options.ticks,n={min:e.min,max:e.max},r=t.ticks=a.generators.logarithmic(n,t);t.isHorizontal()||r.reverse(),t.max=i.max(r),t.min=i.min(r),e.reverse?(r.reverse(),t.start=t.max,t.end=t.min):(t.start=t.min,t.end=t.max)},convertTicksToLabels:function(){this.tickValues=this.ticks.slice(),t.Scale.prototype.convertTicksToLabels.call(this)},getLabelForIndex:function(t,e){return+this.getRightValue(this.chart.data.datasets[e].data[t])},getPixelForTick:function(t){return this.getPixelForValue(this.tickValues[t])},getPixelForValue:function(t){var e,n,a,r=this,o=r.start,s=+r.getRightValue(t),l=r.options.ticks;return r.isHorizontal()?(a=i.log10(r.end)-i.log10(o),0===s?n=r.left:(e=r.width,n=r.left+e/a*(i.log10(s)-i.log10(o)))):(e=r.height,0!==o||l.reverse?0===r.end&&l.reverse?(a=i.log10(r.start)-i.log10(r.minNotZero),n=s===r.end?r.top:s===r.minNotZero?r.top+.02*e:r.top+.02*e+.98*e/a*(i.log10(s)-i.log10(r.minNotZero))):0===s?n=l.reverse?r.top:r.bottom:(a=i.log10(r.end)-i.log10(o),e=r.height,n=r.bottom-e/a*(i.log10(s)-i.log10(o))):(a=i.log10(r.end)-i.log10(r.minNotZero),n=s===o?r.bottom:s===r.minNotZero?r.bottom-.02*e:r.bottom-.02*e-.98*e/a*(i.log10(s)-i.log10(r.minNotZero)))),n},getValueForPixel:function(t){var e,n,a=this,r=i.log10(a.end)-i.log10(a.start);return a.isHorizontal()?(n=a.width,e=a.start*Math.pow(10,(t-a.left)*r/n)):(n=a.height,e=Math.pow(10,(a.bottom-t)*r/n)/a.start),e}});t.scaleService.registerScaleType("logarithmic",n,e)}},{34:34,45:45}],56:[function(t,e,n){"use strict";var i=t(25),a=t(45),r=t(34);e.exports=function(t){function e(t){var e=t.options;return e.angleLines.display||e.pointLabels.display?t.chart.data.labels.length:0}function n(t){var e=t.options.pointLabels,n=a.valueOrDefault(e.fontSize,p.defaultFontSize),i=a.valueOrDefault(e.fontStyle,p.defaultFontStyle),r=a.valueOrDefault(e.fontFamily,p.defaultFontFamily);return{size:n,style:i,family:r,font:a.fontString(n,i,r)}}function o(t,e,n){return a.isArray(n)?{w:a.longestText(t,t.font,n),h:n.length*e+1.5*(n.length-1)*e}:{w:t.measureText(n).width,h:e}}function s(t,e,n,i,a){return t===i||t===a?{start:e-n/2,end:e+n/2}:t<i||t>a?{start:e-n-5,end:e}:{start:e,end:e+n+5}}function l(t){var i,r,l,u=n(t),d=Math.min(t.height/2,t.width/2),c={r:t.width,l:0,t:t.height,b:0},h={};t.ctx.font=u.font,t._pointLabelSizes=[];var f=e(t);for(i=0;i<f;i++){l=t.getPointPosition(i,d),r=o(t.ctx,u.size,t.pointLabels[i]||""),t._pointLabelSizes[i]=r;var g=t.getIndexAngle(i),m=a.toDegrees(g)%360,p=s(m,l.x,r.w,0,180),v=s(m,l.y,r.h,90,270);p.start<c.l&&(c.l=p.start,h.l=g),p.end>c.r&&(c.r=p.end,h.r=g),v.start<c.t&&(c.t=v.start,h.t=g),v.end>c.b&&(c.b=v.end,h.b=g)}t.setReductions(d,c,h)}function u(t){var e=Math.min(t.height/2,t.width/2);t.drawingArea=Math.round(e),t.setCenterPoint(0,0,0,0)}function d(t){return 0===t||180===t?"center":t<180?"left":"right"}function c(t,e,n,i){if(a.isArray(e))for(var r=n.y,o=1.5*i,s=0;s<e.length;++s)t.fillText(e[s],n.x,r),r+=o;else t.fillText(e,n.x,n.y)}function h(t,e,n){90===t||270===t?n.y-=e.h/2:(t>270||t<90)&&(n.y-=e.h)}function f(t){var i=t.ctx,r=a.valueOrDefault,o=t.options,s=o.angleLines,l=o.pointLabels;i.lineWidth=s.lineWidth,i.strokeStyle=s.color;var u=t.getDistanceFromCenterForValue(o.ticks.reverse?t.min:t.max),f=n(t);i.textBaseline="top";for(var g=e(t)-1;g>=0;g--){if(s.display){var m=t.getPointPosition(g,u);i.beginPath(),i.moveTo(t.xCenter,t.yCenter),i.lineTo(m.x,m.y),i.stroke(),i.closePath()}if(l.display){var v=t.getPointPosition(g,u+5),y=r(l.fontColor,p.defaultFontColor);i.font=f.font,i.fillStyle=y;var b=t.getIndexAngle(g),x=a.toDegrees(b);i.textAlign=d(x),h(x,t._pointLabelSizes[g],v),c(i,t.pointLabels[g]||"",v,f.size)}}}function g(t,n,i,r){var o=t.ctx;if(o.strokeStyle=a.valueAtIndexOrDefault(n.color,r-1),o.lineWidth=a.valueAtIndexOrDefault(n.lineWidth,r-1),t.options.gridLines.circular)o.beginPath(),o.arc(t.xCenter,t.yCenter,i,0,2*Math.PI),o.closePath(),o.stroke();else{var s=e(t);if(0===s)return;o.beginPath();var l=t.getPointPosition(0,i);o.moveTo(l.x,l.y);for(var u=1;u<s;u++)l=t.getPointPosition(u,i),o.lineTo(l.x,l.y);o.closePath(),o.stroke()}}function m(t){return a.isNumber(t)?t:0}var p=i.global,v={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,color:"rgba(0, 0, 0, 0.1)",lineWidth:1},gridLines:{circular:!1},ticks:{showLabelBackdrop:!0,backdropColor:"rgba(255,255,255,0.75)",backdropPaddingY:2,backdropPaddingX:2,callback:r.formatters.linear},pointLabels:{display:!0,fontSize:10,callback:function(t){return t}}},y=t.LinearScaleBase.extend({setDimensions:function(){var t=this,e=t.options,n=e.ticks;t.width=t.maxWidth,t.height=t.maxHeight,t.xCenter=Math.round(t.width/2),t.yCenter=Math.round(t.height/2);var i=a.min([t.height,t.width]),r=a.valueOrDefault(n.fontSize,p.defaultFontSize);t.drawingArea=e.display?i/2-(r/2+n.backdropPaddingY):i/2},determineDataLimits:function(){var t=this,e=t.chart,n=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;a.each(e.data.datasets,function(r,o){if(e.isDatasetVisible(o)){var s=e.getDatasetMeta(o);a.each(r.data,function(e,a){var r=+t.getRightValue(e);isNaN(r)||s.data[a].hidden||(n=Math.min(r,n),i=Math.max(r,i))})}}),t.min=n===Number.POSITIVE_INFINITY?0:n,t.max=i===Number.NEGATIVE_INFINITY?0:i,t.handleTickRangeOptions()},getTickLimit:function(){var t=this.options.ticks,e=a.valueOrDefault(t.fontSize,p.defaultFontSize);return Math.min(t.maxTicksLimit?t.maxTicksLimit:11,Math.ceil(this.drawingArea/(1.5*e)))},convertTicksToLabels:function(){var e=this;t.LinearScaleBase.prototype.convertTicksToLabels.call(e),e.pointLabels=e.chart.data.labels.map(e.options.pointLabels.callback,e)},getLabelForIndex:function(t,e){return+this.getRightValue(this.chart.data.datasets[e].data[t])},fit:function(){this.options.pointLabels.display?l(this):u(this)},setReductions:function(t,e,n){var i=this,a=e.l/Math.sin(n.l),r=Math.max(e.r-i.width,0)/Math.sin(n.r),o=-e.t/Math.cos(n.t),s=-Math.max(e.b-i.height,0)/Math.cos(n.b);a=m(a),r=m(r),o=m(o),s=m(s),i.drawingArea=Math.min(Math.round(t-(a+r)/2),Math.round(t-(o+s)/2)),i.setCenterPoint(a,r,o,s)},setCenterPoint:function(t,e,n,i){var a=this,r=a.width-e-a.drawingArea,o=t+a.drawingArea,s=n+a.drawingArea,l=a.height-i-a.drawingArea;a.xCenter=Math.round((o+r)/2+a.left),a.yCenter=Math.round((s+l)/2+a.top)},getIndexAngle:function(t){return t*(2*Math.PI/e(this))+(this.chart.options&&this.chart.options.startAngle?this.chart.options.startAngle:0)*Math.PI*2/360},getDistanceFromCenterForValue:function(t){var e=this;if(null===t)return 0;var n=e.drawingArea/(e.max-e.min);return e.options.ticks.reverse?(e.max-t)*n:(t-e.min)*n},getPointPosition:function(t,e){var n=this,i=n.getIndexAngle(t)-Math.PI/2;return{x:Math.round(Math.cos(i)*e)+n.xCenter,y:Math.round(Math.sin(i)*e)+n.yCenter}},getPointPositionForValue:function(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))},getBasePosition:function(){var t=this,e=t.min,n=t.max;return t.getPointPositionForValue(0,t.beginAtZero?0:e<0&&n<0?n:e>0&&n>0?e:0)},draw:function(){var t=this,e=t.options,n=e.gridLines,i=e.ticks,r=a.valueOrDefault;if(e.display){var o=t.ctx,s=this.getIndexAngle(0),l=r(i.fontSize,p.defaultFontSize),u=r(i.fontStyle,p.defaultFontStyle),d=r(i.fontFamily,p.defaultFontFamily),c=a.fontString(l,u,d);a.each(t.ticks,function(e,a){if(a>0||i.reverse){var u=t.getDistanceFromCenterForValue(t.ticksAsNumbers[a]);if(n.display&&0!==a&&g(t,n,u,a),i.display){var d=r(i.fontColor,p.defaultFontColor);if(o.font=c,o.save(),o.translate(t.xCenter,t.yCenter),o.rotate(s),i.showLabelBackdrop){var h=o.measureText(e).width;o.fillStyle=i.backdropColor,o.fillRect(-h/2-i.backdropPaddingX,-u-l/2-i.backdropPaddingY,h+2*i.backdropPaddingX,l+2*i.backdropPaddingY)}o.textAlign="center",o.textBaseline="middle",o.fillStyle=d,o.fillText(e,0,-u),o.restore()}}}),(e.angleLines.display||e.pointLabels.display)&&f(t)}}});t.scaleService.registerScaleType("radialLinear",y,v)}},{25:25,34:34,45:45}],57:[function(t,e,n){"use strict";function i(t,e){return t-e}function a(t){var e,n,i,a={},r=[];for(e=0,n=t.length;e<n;++e)a[i=t[e]]||(a[i]=!0,r.push(i));return r}function r(t,e,n,i){if("linear"===i||!t.length)return[{time:e,pos:0},{time:n,pos:1}];var a,r,o,s,l,u=[],d=[e];for(a=0,r=t.length;a<r;++a)(s=t[a])>e&&s<n&&d.push(s);for(d.push(n),a=0,r=d.length;a<r;++a)l=d[a+1],o=d[a-1],s=d[a],void 0!==o&&void 0!==l&&Math.round((l+o)/2)===s||u.push({time:s,pos:a/(r-1)});return u}function o(t,e,n){for(var i,a,r,o=0,s=t.length-1;o>=0&&o<=s;){if(i=o+s>>1,a=t[i-1]||null,r=t[i],!a)return{lo:null,hi:r};if(r[e]<n)o=i+1;else{if(!(a[e]>n))return{lo:a,hi:r};s=i-1}}return{lo:r,hi:null}}function s(t,e,n,i){var a=o(t,e,n),r=a.lo?a.hi?a.lo:t[t.length-2]:t[0],s=a.lo?a.hi?a.hi:t[t.length-1]:t[1],l=s[e]-r[e],u=l?(n-r[e])/l:0,d=(s[i]-r[i])*u;return r[i]+d}function l(t,e){var n=e.parser,i=e.parser||e.format;return"function"==typeof n?n(t):"string"==typeof t&&"string"==typeof i?p(t,i):(t instanceof p||(t=p(t)),t.isValid()?t:"function"==typeof i?i(t):t)}function u(t,e){if(y.isNullOrUndef(t))return null;var n=e.options.time,i=l(e.getRightValue(t),n);return i.isValid()?(n.round&&i.startOf(n.round),i.valueOf()):null}function d(t,e,n,i){var a,r,o,s=e-t,l=_[n],u=l.size,d=l.steps;if(!d)return Math.ceil(s/((i||1)*u));for(a=0,r=d.length;a<r&&(o=d[a],!(Math.ceil(s/(u*o))<=i));++a);return o}function c(t,e,n,i){var a,r,o,s=k.length;for(a=k.indexOf(t);a<s-1;++a)if(r=_[k[a]],o=r.steps?r.steps[r.steps.length-1]:x,Math.ceil((n-e)/(o*r.size))<=i)return k[a];return k[s-1]}function h(t){for(var e=k.indexOf(t)+1,n=k.length;e<n;++e)if(_[k[e]].major)return k[e]}function f(t,e,n,i,a,r){var o,s=r.time,l=y.valueOrDefault(s.stepSize,s.unitStepSize),u="week"===n&&s.isoWeekday,c=r.ticks.major.enabled,h=_[n],f=p(t),g=p(e),m=[];for(l||(l=d(t,e,n,a)),u&&(f=f.isoWeekday(u),g=g.isoWeekday(u)),f=f.startOf(u?"day":n),(g=g.startOf(u?"day":n))<e&&g.add(1,n),o=p(f),c&&i&&!u&&!s.round&&(o.startOf(i),o.add(~~((f-o)/(h.size*l))*l,n));o<g;o.add(l,n))m.push(+o);return m.push(+o),m}function g(t,e,n,i,a){var r,o,l=0,u=0;return a.offset&&e.length&&(a.time.min||(r=e.length>1?e[1]:i,o=e[0],l=(s(t,"time",r,"pos")-s(t,"time",o,"pos"))/2),a.time.max||(r=e[e.length-1],o=e.length>1?e[e.length-2]:n,u=(s(t,"time",r,"pos")-s(t,"time",o,"pos"))/2)),{left:l,right:u}}function m(t,e){var n,i,a,r,o=[];for(n=0,i=t.length;n<i;++n)a=t[n],r=!!e&&a===+p(a).startOf(e),o.push({value:a,major:r});return o}var p=t(6);p="function"==typeof p?p:window.moment;var v=t(25),y=t(45),b=Number.MIN_SAFE_INTEGER||-9007199254740991,x=Number.MAX_SAFE_INTEGER||9007199254740991,_={millisecond:{major:!0,size:1,steps:[1,2,5,10,20,50,100,250,500]},second:{major:!0,size:1e3,steps:[1,2,5,10,30]},minute:{major:!0,size:6e4,steps:[1,2,5,10,30]},hour:{major:!0,size:36e5,steps:[1,2,3,6,12]},day:{major:!0,size:864e5,steps:[1,2,5]},week:{major:!1,size:6048e5,steps:[1,2,3,4]},month:{major:!0,size:2628e6,steps:[1,2,3]},quarter:{major:!1,size:7884e6,steps:[1,2,3,4]},year:{major:!0,size:3154e7}},k=Object.keys(_);e.exports=function(t){var e={position:"bottom",distribution:"linear",bounds:"data",time:{parser:!1,format:!1,unit:!1,round:!1,displayFormat:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{millisecond:"h:mm:ss.SSS a",second:"h:mm:ss a",minute:"h:mm a",hour:"hA",day:"MMM D",week:"ll",month:"MMM YYYY",quarter:"[Q]Q - YYYY",year:"YYYY"}},ticks:{autoSkip:!1,source:"auto",major:{enabled:!1}}},n=t.Scale.extend({initialize:function(){if(!p)throw new Error("Chart.js - Moment.js could not be found! You must include it before Chart.js to use the time scale. Download at https://momentjs.com");this.mergeTicksOptions(),t.Scale.prototype.initialize.call(this)},update:function(){var e=this,n=e.options;return n.time&&n.time.format&&console.warn("options.time.format is deprecated and replaced by options.time.parser."),t.Scale.prototype.update.apply(e,arguments)},getRightValue:function(e){return e&&void 0!==e.t&&(e=e.t),t.Scale.prototype.getRightValue.call(this,e)},determineDataLimits:function(){var t,e,n,r,o,s,l=this,d=l.chart,c=l.options.time,h=u(c.min,l)||x,f=u(c.max,l)||b,g=[],m=[],v=[];for(t=0,n=d.data.labels.length;t<n;++t)v.push(u(d.data.labels[t],l));for(t=0,n=(d.data.datasets||[]).length;t<n;++t)if(d.isDatasetVisible(t))if(o=d.data.datasets[t].data,y.isObject(o[0]))for(m[t]=[],e=0,r=o.length;e<r;++e)s=u(o[e],l),g.push(s),m[t][e]=s;else g.push.apply(g,v),m[t]=v.slice(0);else m[t]=[];v.length&&(v=a(v).sort(i),h=Math.min(h,v[0]),f=Math.max(f,v[v.length-1])),g.length&&(g=a(g).sort(i),h=Math.min(h,g[0]),f=Math.max(f,g[g.length-1])),h=h===x?+p().startOf("day"):h,f=f===b?+p().endOf("day")+1:f,l.min=Math.min(h,f),l.max=Math.max(h+1,f),l._horizontal=l.isHorizontal(),l._table=[],l._timestamps={data:g,datasets:m,labels:v}},buildTicks:function(){var t,e,n,i=this,a=i.min,o=i.max,s=i.options,l=s.time,d=l.displayFormats,p=i.getLabelCapacity(a),v=l.unit||c(l.minUnit,a,o,p),y=h(v),b=[],x=[];switch(s.ticks.source){case"data":b=i._timestamps.data;break;case"labels":b=i._timestamps.labels;break;case"auto":default:b=f(a,o,v,y,p,s)}for("ticks"===s.bounds&&b.length&&(a=b[0],o=b[b.length-1]),a=u(l.min,i)||a,o=u(l.max,i)||o,t=0,e=b.length;t<e;++t)(n=b[t])>=a&&n<=o&&x.push(n);return i.min=a,i.max=o,i._unit=v,i._majorUnit=y,i._minorFormat=d[v],i._majorFormat=d[y],i._table=r(i._timestamps.data,a,o,s.distribution),i._offsets=g(i._table,x,a,o,s),m(x,y)},getLabelForIndex:function(t,e){var n=this,i=n.chart.data,a=n.options.time,r=i.labels&&t<i.labels.length?i.labels[t]:"",o=i.datasets[e].data[t];return y.isObject(o)&&(r=n.getRightValue(o)),a.tooltipFormat&&(r=l(r,a).format(a.tooltipFormat)),r},tickFormatFunction:function(t,e,n){var i=this,a=i.options,r=t.valueOf(),o=i._majorUnit,s=i._majorFormat,l=t.clone().startOf(i._majorUnit).valueOf(),u=a.ticks.major,d=u.enabled&&o&&s&&r===l,c=t.format(d?s:i._minorFormat),h=d?u:a.ticks.minor,f=y.valueOrDefault(h.callback,h.userCallback);return f?f(c,e,n):c},convertTicksToLabels:function(t){var e,n,i=[];for(e=0,n=t.length;e<n;++e)i.push(this.tickFormatFunction(p(t[e].value),e,t));return i},getPixelForOffset:function(t){var e=this,n=e._horizontal?e.width:e.height,i=e._horizontal?e.left:e.top,a=s(e._table,"time",t,"pos");return i+n*(e._offsets.left+a)/(e._offsets.left+1+e._offsets.right)},getPixelForValue:function(t,e,n){var i=this,a=null;if(void 0!==e&&void 0!==n&&(a=i._timestamps.datasets[n][e]),null===a&&(a=u(t,i)),null!==a)return i.getPixelForOffset(a)},getPixelForTick:function(t){var e=this.getTicks();return t>=0&&t<e.length?this.getPixelForOffset(e[t].value):null},getValueForPixel:function(t){var e=this,n=e._horizontal?e.width:e.height,i=e._horizontal?e.left:e.top,a=(n?(t-i)/n:0)*(e._offsets.left+1+e._offsets.left)-e._offsets.right,r=s(e._table,"pos",a,"time");return p(r)},getLabelWidth:function(t){var e=this,n=e.options.ticks,i=e.ctx.measureText(t).width,a=y.toRadians(n.maxRotation),r=Math.cos(a),o=Math.sin(a);return i*r+y.valueOrDefault(n.fontSize,v.global.defaultFontSize)*o},getLabelCapacity:function(t){var e=this;e._minorFormat=e.options.time.displayFormats.millisecond;var n=e.tickFormatFunction(p(t),0,[]),i=e.getLabelWidth(n),a=e.isHorizontal()?e.width:e.height;return Math.floor(a/i)}});t.scaleService.registerScaleType("time",n,e)}},{25:25,45:45,6:6}]},{},[7])(7)});
js/admin.js ADDED
@@ -0,0 +1,1122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function() {
2
+ jQuery(window).resize(function() {
3
+ jQuery('.insert-ads .plugin-card').each(function() {
4
+ jQuery(this).css('height', 'auto');
5
+ });
6
+ jQuery('.insert-ads .plugin-card').each(function() {
7
+ var initialCard = jQuery(this);
8
+ var rowTop = initialCard.position().top;
9
+ jQuery('.insert-ads .plugin-card').each(function() {
10
+ if(rowTop == jQuery(this).position().top) {
11
+ if(initialCard.height() < jQuery(this).height()) {
12
+ initialCard.height(jQuery(this).height());
13
+ }
14
+ }
15
+ });
16
+ });
17
+ });
18
+ jQuery(window).resize();
19
+
20
+ insert_ads_click_handler(
21
+ 'insert_ads_abtesting_configuration',
22
+ 'Multiple Ad Networks / A-B Testing : Configuration',
23
+ '480',
24
+ '480',
25
+ function() { },
26
+ function() {
27
+ jQuery.post(
28
+ jQuery('#insert_ads_admin_ajax').val(), {
29
+ 'action': "insert_ads_abtesting_configuration_form_save_action",
30
+ 'insert_ads_nonce': jQuery('#insert_ads_nonce').val(),
31
+ 'insert_ads_abtesting_mode': jQuery('input[name=insert_ads_abtesting_mode]:checked').val()
32
+ }, function(response) { }
33
+ );
34
+ },
35
+ function() { }
36
+ );
37
+
38
+ insert_ads_click_handler(
39
+ 'insert_ads_trackingcodes_google_analytics',
40
+ 'Tracking Codes : Google Analytics',
41
+ '480',
42
+ '480',
43
+ function() {
44
+ jQuery('#insert_ads_trackingcodes_analytics_status').parent().css({'display': 'inline-block', 'margin': '5px 0 0'}).prependTo('.ui-dialog-buttonpane');
45
+ },
46
+ function() {
47
+ jQuery.post(
48
+ jQuery('#insert_ads_admin_ajax').val(), {
49
+ 'action': 'insert_ads_trackingcodes_google_analytics_form_save_action',
50
+ 'insert_ads_nonce': jQuery('#insert_ads_nonce').val(),
51
+ 'insert_ads_trackingcodes_analytics_status': jQuery('#insert_ads_trackingcodes_analytics_status').prop('checked'),
52
+ 'insert_ads_trackingcodes_analytics_code': jQuery('#insert_ads_trackingcodes_analytics_code').val(),
53
+ }, function(response) { }
54
+ );
55
+ },
56
+ function() { }
57
+ );
58
+
59
+ insert_ads_click_handler(
60
+ 'insert_ads_trackingcodes_header',
61
+ 'Tracking Codes : Header',
62
+ jQuery("body").width() * 0.8,
63
+ jQuery("body").height() * 0.8,
64
+ function() {
65
+ jQuery('#insert_ads_trackingcodes_header_code').css('height', (jQuery("body").height() * 0.5)+'px');
66
+ jQuery('#insert_ads_trackingcodes_header_status').parent().css({'display': 'inline-block', 'margin': '5px 0 0'}).prependTo('.ui-dialog-buttonpane');
67
+ },
68
+ function() {
69
+ jQuery.post(
70
+ jQuery('#insert_ads_admin_ajax').val(), {
71
+ 'action': 'insert_ads_trackingcodes_header_form_save_action',
72
+ 'insert_ads_nonce': jQuery('#insert_ads_nonce').val(),
73
+ 'insert_ads_trackingcodes_header_status': jQuery('#insert_ads_trackingcodes_header_status').prop('checked'),
74
+ 'insert_ads_trackingcodes_header_code': jQuery('#insert_ads_trackingcodes_header_code').val(),
75
+ }, function(response) { }
76
+ );
77
+ },
78
+ function() { }
79
+ );
80
+
81
+ insert_ads_click_handler(
82
+ 'insert_ads_trackingcodes_footer',
83
+ 'Tracking Codes : Footer',
84
+ jQuery("body").width() * 0.8,
85
+ jQuery("body").height() * 0.8,
86
+ function() {
87
+ jQuery('#insert_ads_trackingcodes_footer_code').css('height', (jQuery("body").height() * 0.5)+'px');
88
+ jQuery('#insert_ads_trackingcodes_footer_status').parent().css({'display': 'inline-block', 'margin': '5px 0 0'}).prependTo('.ui-dialog-buttonpane');
89
+ },
90
+ function() {
91
+ jQuery.post(
92
+ jQuery('#insert_ads_admin_ajax').val(), {
93
+ 'action': 'insert_ads_trackingcodes_footer_form_save_action',
94
+ 'insert_ads_nonce': jQuery('#insert_ads_nonce').val(),
95
+ 'insert_ads_trackingcodes_footer_status': jQuery('#insert_ads_trackingcodes_footer_status').prop('checked'),
96
+ 'insert_ads_trackingcodes_footer_code': jQuery('#insert_ads_trackingcodes_footer_code').val(),
97
+ }, function(response) { }
98
+ );
99
+ },
100
+ function() { }
101
+ );
102
+
103
+ insert_ads_click_handler(
104
+ 'insert_ads_legalpages_privacy_policy',
105
+ 'Legal Pages : Privacy Policy',
106
+ jQuery("body").width() * 0.8,
107
+ jQuery("body").height() * 0.8,
108
+ function() { },
109
+ function() {
110
+ jQuery.post(
111
+ jQuery('#insert_ads_admin_ajax').val(), {
112
+ 'action': 'insert_ads_legalpages_privacy_policy_form_save_action',
113
+ 'insert_ads_nonce': jQuery('#insert_ads_nonce').val(),
114
+ 'insert_ads_legalpages_privacy_policy_content': jQuery('#insert_ads_legalpages_privacy_policy_content').val(),
115
+ 'insert_ads_legalpages_privacy_policy_assigned_page': jQuery('#insert_ads_legalpages_privacy_policy_assigned_page').val(),
116
+ }, function(response) { }
117
+ );
118
+ },
119
+ function() { }
120
+ );
121
+
122
+ insert_ads_click_handler(
123
+ 'insert_ads_legalpages_terms_conditions',
124
+ 'Legal Pages : Terms and Conditions',
125
+ jQuery("body").width() * 0.8,
126
+ jQuery("body").height() * 0.8,
127
+ function() { },
128
+ function() {
129
+ jQuery.post(
130
+ jQuery('#insert_ads_admin_ajax').val(), {
131
+ 'action': 'insert_ads_legalpages_terms_conditions_form_save_action',
132
+ 'insert_ads_nonce': jQuery('#insert_ads_nonce').val(),
133
+ 'insert_ads_legalpages_terms_conditions_content': jQuery('#insert_ads_legalpages_terms_conditions_content').val(),
134
+ 'insert_ads_legalpages_terms_conditions_assigned_page': jQuery('#insert_ads_legalpages_terms_conditions_assigned_page').val(),
135
+ }, function(response) { }
136
+ );
137
+ },
138
+ function() { }
139
+ );
140
+
141
+ insert_ads_click_handler(
142
+ 'insert_ads_legalpages_disclaimer',
143
+ 'Legal Pages : Disclaimer',
144
+ jQuery("body").width() * 0.8,
145
+ jQuery("body").height() * 0.8,
146
+ function() { },
147
+ function() {
148
+ jQuery.post(
149
+ jQuery('#insert_ads_admin_ajax').val(), {
150
+ 'action': 'insert_ads_legalpages_disclaimer_form_save_action',
151
+ 'insert_ads_nonce': jQuery('#insert_ads_nonce').val(),
152
+ 'insert_ads_legalpages_disclaimer_content': jQuery('#insert_ads_legalpages_disclaimer_content').val(),
153
+ 'insert_ads_legalpages_disclaimer_assigned_page': jQuery('#insert_ads_legalpages_disclaimer_assigned_page').val(),
154
+ }, function(response) { }
155
+ );
156
+ },
157
+ function() { }
158
+ );
159
+
160
+ insert_ads_click_handler(
161
+ 'insert_ads_legalpages_copyright',
162
+ 'Legal Pages : Copyright Notice',
163
+ jQuery("body").width() * 0.8,
164
+ jQuery("body").height() * 0.8,
165
+ function() { },
166
+ function() {
167
+ jQuery.post(
168
+ jQuery('#insert_ads_admin_ajax').val(), {
169
+ 'action': 'insert_ads_legalpages_copyright_form_save_action',
170
+ 'insert_ads_nonce': jQuery('#insert_ads_nonce').val(),
171
+ 'insert_ads_legalpages_copyright_content': jQuery('#insert_ads_legalpages_copyright_content').val(),
172
+ 'insert_ads_legalpages_copyright_assigned_page': jQuery('#insert_ads_legalpages_copyright_assigned_page').val(),
173
+ }, function(response) { }
174
+ );
175
+ },
176
+ function() { }
177
+ );
178
+
179
+ insert_ads_click_handler(
180
+ 'insert_ads_adstxt_generate',
181
+ 'Create / Update ads.txt',
182
+ jQuery("body").width() * 0.8,
183
+ jQuery("body").height() * 0.8,
184
+ function() {
185
+ jQuery('#insert_ads_adstxt_content').css('height', (jQuery('body').height() * 0.5)+'px');
186
+ jQuery('.ui-dialog-buttonset').find('button').first().unbind('click').click(function() {
187
+ jQuery('.ui-dialog-buttonset').find('button').last().button('disable');
188
+ jQuery('.ui-dialog-titlebar').find('button').last().button('disable');
189
+ var insert_ads_adstxt_content = jQuery('#insert_ads_adstxt_content').val();
190
+ jQuery('.ui-dialog-content').html('<div class="insert_ads_ajaxloader"></div>');
191
+ jQuery('.insert_ads_ajaxloader').show();
192
+ jQuery.post(
193
+ jQuery('#insert_ads_admin_ajax').val(), {
194
+ 'action': 'insert_ads_adstxt_generate_form_save_action',
195
+ 'insert_ads_nonce': jQuery('#insert_ads_nonce').val(),
196
+ 'insert_ads_adstxt_content': insert_ads_adstxt_content,
197
+ }, function(response) {
198
+ if(response == '###SUCCESS###') {
199
+ jQuery('.ui-dialog-titlebar').find('button').last().button('enable').click();
200
+ } else {
201
+ jQuery('.ui-dialog-buttonset').find('button').first().button('disable');
202
+ jQuery('.ui-dialog-buttonset').find('button').last().button('enable');
203
+ jQuery('.ui-dialog-titlebar').find('button').last().button('enable');
204
+ jQuery('.ui-dialog-content').html(response);
205
+ }
206
+ }
207
+ );
208
+ });
209
+ },
210
+ function() { },
211
+ function() { }
212
+ );
213
+
214
+ insert_ads_inpostads_click_handler('above');
215
+ insert_ads_inpostads_click_handler('middle');
216
+ insert_ads_inpostads_click_handler('below');
217
+ insert_ads_inpostads_click_handler('left');
218
+ insert_ads_inpostads_click_handler('right');
219
+
220
+ insert_ads_click_handler(
221
+ 'insert_ads_adwidgets_new',
222
+ 'Ad Widget : Add New',
223
+ jQuery("body").width() * 0.8,
224
+ jQuery("body").height() * 0.8,
225
+ function() {
226
+ jQuery('.insert_ads_adwidgets_status').parent().css({'display': 'inline-block', 'margin': '5px 0 0'}).prependTo('.ui-dialog-buttonpane');
227
+ },
228
+ function() {
229
+ var identifier = jQuery(".insert_ads_adwidgets_identifier").val();
230
+ var adwidgetLink = jQuery("<a></a>");
231
+ adwidgetLink.attr("id", "insert_ads_adwidgets_"+identifier);
232
+ adwidgetLink.attr("href", "javascript:;");
233
+ adwidgetLink.attr("onClick", "insert_ads_adwidgets_click_handler(\'"+identifier+"\', \'"+jQuery("#insert_ads_adwidgets_"+identifier+"_title").val()+"\')");
234
+ adwidgetLink.html("Ad Widget : "+jQuery("#insert_ads_adwidgets_"+identifier+"_title").val());
235
+ var deleteButton = jQuery("<span></span>");
236
+ deleteButton.attr("class", "dashicons dashicons-dismiss insert_ads_delete_icon");
237
+ deleteButton.attr("onClick", "insert_ads_adwidgets_remove(\'"+identifier+"\')");
238
+ jQuery("#insert_ads_adwidgets_new").parent().before(jQuery("<p></p>").append(adwidgetLink, deleteButton));
239
+ insert_ads_adwidgets_update(identifier);
240
+ },
241
+ function() { }
242
+ );
243
+
244
+ insert_ads_click_handler(
245
+ 'insert_ads_inthemeads_new',
246
+ 'In-Theme Ad : Add New',
247
+ jQuery("body").width() * 0.8,
248
+ jQuery("body").height() * 0.8,
249
+ function() {
250
+ jQuery('.insert_ads_inthemeads_status').parent().css({'display': 'inline-block', 'margin': '5px 0 0'}).prependTo('.ui-dialog-buttonpane');
251
+ },
252
+ function() {
253
+ var identifier = jQuery(".insert_ads_inthemeads_identifier").val();
254
+ var inthemeadLink = jQuery("<a></a>");
255
+ inthemeadLink.attr("id", "insert_ads_inthemeads_"+identifier);
256
+ inthemeadLink.attr("href", "javascript:;");
257
+ inthemeadLink.attr("onClick", "insert_ads_inthemeads_click_handler(\'"+identifier+"\', \'"+jQuery("#insert_ads_inthemeads_"+identifier+"_title").val()+"\')");
258
+ inthemeadLink.html("Ad Widget : "+jQuery("#insert_ads_inthemeads_"+identifier+"_title").val());
259
+ var deleteButton = jQuery("<span></span>");
260
+ deleteButton.attr("class", "dashicons dashicons-dismiss insert_ads_delete_icon");
261
+ deleteButton.attr("onClick", "insert_ads_inthemeads_remove(\'"+identifier+"\')");
262
+ jQuery("#insert_ads_inthemeads_new").parent().before(jQuery("<p></p>").append(inthemeadLink, deleteButton));
263
+ insert_ads_inthemeads_update(identifier);
264
+ },
265
+ function() { }
266
+ );
267
+
268
+ insert_ads_vi_signup_handler();
269
+ insert_ads_vi_login_handler();
270
+ insert_ads_vi_logout_handler();
271
+ insert_ads_vi_customize_adcode();
272
+ insert_ads_vi_chart_draw()
273
+ });
274
+
275
+ function primary_ad_code_type_change() {
276
+ var location = '';
277
+ if(jQuery('#insert_ads_inpostads_above_primary_ad_code_type').length != 0) {
278
+ location = 'above';
279
+ } else if(jQuery('#insert_ads_inpostads_middle_primary_ad_code_type').length != 0) {
280
+ location = 'middle';
281
+ } else {
282
+ location = '';
283
+ }
284
+ if(location != '') {
285
+ jQuery('#insert_ads_inpostads_'+location+'_primary_ad_code_type').parent().hide();
286
+ jQuery('#insert_ads_inpostads_'+location+'_primary_ad_code_type').change(function() {
287
+ jQuery('.isSelectedIndicator').removeClass('active');
288
+ jQuery('#primary_ad_code_type_'+jQuery(this).val()).addClass('active');
289
+ });
290
+ jQuery('#insert_ads_inpostads_'+location+'_primary_ad_code_type').change();
291
+
292
+ jQuery('#primary_ad_code_type_generic').click(function() {
293
+ jQuery('#insert_ads_inpostads_'+location+'_primary_ad_code_type').val('generic');
294
+ jQuery('#insert_ads_inpostads_'+location+'_primary_ad_code_type').change();
295
+ });
296
+ jQuery('#primary_ad_code_type_generic').parent().click(function() {
297
+ jQuery('#insert_ads_inpostads_'+location+'_primary_ad_code_type').val('generic');
298
+ jQuery('#insert_ads_inpostads_'+location+'_primary_ad_code_type').change();
299
+ });
300
+
301
+ jQuery('#primary_ad_code_type_vicode').click(function() {
302
+ if(!jQuery('#primary_ad_code_type_vicode').hasClass('disabled')) {
303
+ jQuery('#insert_ads_inpostads_'+location+'_primary_ad_code_type').val('vicode');
304
+ jQuery('#insert_ads_inpostads_'+location+'_primary_ad_code_type').change();
305
+ }
306
+ });
307
+ jQuery('#primary_ad_code_type_vicode').parent().click(function() {
308
+ if(!jQuery('#primary_ad_code_type_vicode').hasClass('disabled')) {
309
+ jQuery('#insert_ads_inpostads_'+location+'_primary_ad_code_type').val('vicode');
310
+ jQuery('#insert_ads_inpostads_'+location+'_primary_ad_code_type').change();
311
+ }
312
+ });
313
+ jQuery('#primary_ad_code_type_vicode').parents('.smartlogixSectionTitle').on('click', function(){
314
+ if (!jQuery(document).find('#insert_ads_inpostads_above_status').next().hasClass('checked')){
315
+ jQuery(document).find('#insert_ads_inpostads_above_status').next().trigger('click');
316
+ }
317
+ })
318
+ }
319
+ }
320
+
321
+ function insert_ads_inpostads_vi_customize_adcode() {
322
+ jQuery('#insert_ads_inpostads_vi_customize_adcode').click(function() {
323
+ jQuery('.ui-dialog-titlebar').find('button').last().button('enable').click();
324
+ jQuery('#insert_ads_vi_customize_adcode').click();
325
+ });
326
+ }
327
+
328
+ function insert_ads_inpostads_click_handler(location) {
329
+ insert_ads_click_handler(
330
+ 'insert_ads_inpostads_'+location,
331
+ 'Inpost Ads : Ad '+location.charAt(0).toUpperCase()+location.slice(1)+' Post Content',
332
+ jQuery("body").width() * 0.8,
333
+ jQuery("body").height() * 0.9,
334
+ function() {
335
+ var toggleText = '';
336
+ if (jQuery('#insert_ads_inpostads_above_status').is(':checked')){
337
+ toggleText = 'Press to switch off vi stories';
338
+ } else {
339
+ toggleText = 'Press to activate vi stories';
340
+ }
341
+ jQuery('#insert_ads_inpostads_above_status + div').click(function(){
342
+ if (jQuery('#insert_ads_inpostads_above_status').is(':checked')){
343
+ toggleText = 'Press to switch off vi stories';
344
+ jQuery('#toggletext').text(toggleText);
345
+
346
+ } else {
347
+ toggleText = 'Press to activate vi stories';
348
+ jQuery('#toggletext').text(toggleText);
349
+ }
350
+ })
351
+ jQuery('#insert_ads_inpostads_'+location+'_status').parent().addClass('pwithcheck').css({'display': 'block', 'margin': '10px 0'}).append('<span id="toggletext" style="padding-left:20px; position: relative; top: -10px;">' + toggleText + '</span>').appendTo('.ui-accordion-content:eq(0) .insert_ads_rule_block + .insert_ads_rule_block .smartlogixSectionInner');
352
+ },
353
+ function() {
354
+ args = {};
355
+ args['action'] = 'insert_ads_inpostads_'+location+'_form_save_action';
356
+ args['insert_ads_nonce'] = jQuery('#insert_ads_nonce').val();
357
+ args['insert_ads_inpostads_'+location+'_status'] = jQuery('#insert_ads_inpostads_'+location+'_status').prop('checked');
358
+
359
+ if(location == 'above' || location == 'middle') {
360
+ args['insert_ads_inpostads_'+location+'_primary_ad_code_type'] = jQuery('#insert_ads_inpostads_'+location+'_primary_ad_code_type').val();
361
+ }
362
+ args['insert_ads_inpostads_'+location+'_primary_ad_code'] = jQuery('#insert_ads_inpostads_'+location+'_primary_ad_code').val();
363
+ args['insert_ads_inpostads_'+location+'_secondary_ad_code'] = jQuery('#insert_ads_inpostads_'+location+'_secondary_ad_code').val();
364
+ args['insert_ads_inpostads_'+location+'_tertiary_ad_code'] = jQuery('#insert_ads_inpostads_'+location+'_tertiary_ad_code').val();
365
+
366
+ args['insert_ads_inpostads_'+location+'_rules_exclude_loggedin'] = jQuery('#insert_ads_inpostads_'+location+'_rules_exclude_loggedin').prop('checked');
367
+ args['insert_ads_inpostads_'+location+'_rules_exclude_mobile_devices'] = jQuery('#insert_ads_inpostads_'+location+'_rules_exclude_mobile_devices').prop('checked');
368
+ args['insert_ads_inpostads_'+location+'_rules_exclude_404'] = jQuery('#insert_ads_inpostads_'+location+'_rules_exclude_404').prop('checked');
369
+ args['insert_ads_inpostads_'+location+'_rules_exclude_home'] = jQuery('#insert_ads_inpostads_'+location+'_rules_exclude_home').prop('checked');
370
+ args['insert_ads_inpostads_'+location+'_rules_home_instances'] = jQuery.map(jQuery('#insert_ads_inpostads_'+location+'_rules_home_instances :selected'), function(e) { return jQuery(e).val(); });
371
+ args['insert_ads_inpostads_'+location+'_rules_exclude_archives'] = jQuery('#insert_ads_inpostads_'+location+'_rules_exclude_archives').prop('checked');
372
+ args['insert_ads_inpostads_'+location+'_rules_archives_instances'] = jQuery.map(jQuery('#insert_ads_inpostads_'+location+'_rules_archives_instances :selected'), function(e) { return jQuery(e).val(); });
373
+ args['insert_ads_inpostads_'+location+'_rules_exclude_search'] = jQuery('#insert_ads_inpostads_'+location+'_rules_exclude_search').prop('checked');
374
+ args['insert_ads_inpostads_'+location+'_rules_search_instances'] = jQuery.map(jQuery('#insert_ads_inpostads_'+location+'_rules_search_instances :selected'), function(e) { return jQuery(e).val(); });
375
+ args['insert_ads_inpostads_'+location+'_rules_exclude_page'] = jQuery('#insert_ads_inpostads_'+location+'_rules_exclude_page').prop('checked');
376
+ args['insert_ads_inpostads_'+location+'_rules_page_exceptions'] = jQuery.map(jQuery('#insert_ads_inpostads_'+location+'_rules_page_exceptions :selected'), function(e) { return jQuery(e).val(); });
377
+ args['insert_ads_inpostads_'+location+'_rules_exclude_post'] = jQuery('#insert_ads_inpostads_'+location+'_rules_exclude_post').prop('checked');
378
+ args['insert_ads_inpostads_'+location+'_rules_post_exceptions'] = jQuery.map(jQuery('#insert_ads_inpostads_'+location+'_rules_post_exceptions :selected'), function(e) { return jQuery(e).val(); });
379
+ args['insert_ads_inpostads_'+location+'_rules_post_categories_exceptions'] = jQuery.map(jQuery('#insert_ads_inpostads_'+location+'_rules_post_categories_exceptions :selected'), function(e) { return jQuery(e).val(); });
380
+ args['insert_ads_inpostads_'+location+'_rules_exclude_categories'] = jQuery('#insert_ads_inpostads_'+location+'_rules_exclude_categories').prop('checked');
381
+ args['insert_ads_inpostads_'+location+'_rules_categories_instances'] = jQuery.map(jQuery('#insert_ads_inpostads_'+location+'_rules_categories_instances :selected'), function(e) { return jQuery(e).val(); });
382
+ args['insert_ads_inpostads_'+location+'_rules_categories_exceptions'] = jQuery.map(jQuery('#insert_ads_inpostads_'+location+'_rules_categories_exceptions :selected'), function(e) { return jQuery(e).val(); });
383
+
384
+ args['insert_ads_inpostads_'+location+'_geo_group1_countries'] = jQuery.map(jQuery('#insert_ads_inpostads_'+location+'_geo_group1_countries :selected'), function(e) { return jQuery(e).val(); });
385
+ args['insert_ads_inpostads_'+location+'_geo_group1_adcode'] = jQuery('#insert_ads_inpostads_'+location+'_geo_group1_adcode').val();
386
+ args['insert_ads_inpostads_'+location+'_geo_group2_countries'] = jQuery.map(jQuery('#insert_ads_inpostads_'+location+'_geo_group2_countries :selected'), function(e) { return jQuery(e).val(); });
387
+ args['insert_ads_inpostads_'+location+'_geo_group2_adcode'] = jQuery('#insert_ads_inpostads_'+location+'_geo_group2_adcode').val();
388
+
389
+ args['insert_ads_inpostads_'+location+'_styles'] = jQuery('#insert_ads_inpostads_'+location+'_styles').val();
390
+
391
+ args['insert_ads_inpostads_'+location+'_notes'] = jQuery('#insert_ads_inpostads_'+location+'_notes').val();
392
+
393
+ if(location == 'middle') {
394
+ args['insert_ads_inpostads_'+location+'_minimum_character_count'] = jQuery('#insert_ads_inpostads_'+location+'_minimum_character_count').val();
395
+ args['insert_ads_inpostads_'+location+'_paragraph_buffer_count'] = jQuery('#insert_ads_inpostads_'+location+'_paragraph_buffer_count').val();
396
+ }
397
+ jQuery.post(
398
+ jQuery('#insert_ads_admin_ajax').val(), args, function(response) {
399
+ var sucdial = jQuery('<div id="sucdial">Succesfully updated!</div>').hide().fadeIn('1000');
400
+ jQuery('body').prepend(sucdial);
401
+ jQuery(document).find('#sucdial').delay('2000').fadeOut('1000');
402
+ }
403
+ );
404
+ },
405
+ function() { }
406
+ );
407
+ }
408
+
409
+ function insert_ads_adwidgets_click_handler(identifier, title) {
410
+ jQuery('<div id="insert_ads_adwidgets_'+identifier+'_dialog"></div>').html('<div class="insert_ads_ajaxloader"></div>').dialog({
411
+ 'modal': true,
412
+ 'resizable': false,
413
+ 'width': jQuery("body").width() * 0.8,
414
+ 'maxWidth': jQuery("body").width() * 0.8,
415
+ 'maxHeight': jQuery("body").height() * 0.9,
416
+ 'title': 'Ad Widget : '+title,
417
+ position: { my: 'center', at: 'center', of: window },
418
+ open: function (event, ui) {
419
+ jQuery('.ui-dialog').css({'z-index': 999999, 'max-width': '90%'});
420
+ jQuery('.ui-widget-overlay').css({'z-index': 999998, 'opacity': 0.8, 'background': '#000000'});
421
+ jQuery('.ui-dialog-buttonpane button:contains("Update")').button('disable');
422
+ jQuery.post(
423
+ jQuery('#insert_ads_admin_ajax').val(), {
424
+ 'action': 'insert_ads_adwidgets_existing_form_get_content',
425
+ 'insert_ads_adwidgets_identifier': identifier,
426
+ 'insert_ads_nonce': jQuery('#insert_ads_nonce').val()
427
+ }, function(response) {
428
+ jQuery('.insert_ads_ajaxloader').hide();
429
+ jQuery('.ui-dialog-content').html(response);
430
+ jQuery('.ui-accordion .ui-accordion-content').css('max-height', (jQuery("body").height() * 0.45));
431
+ jQuery('.ui-dialog-buttonpane button:contains("Update")').button('enable');
432
+ jQuery('.insert_ads_adwidgets_status').parent().css({'display': 'inline-block', 'margin': '5px 0 0'}).prependTo('.ui-dialog-buttonpane');
433
+ jQuery('.ui-dialog').css({'position': 'fixed'});
434
+ jQuery('#insert_ads_adwidgets_'+identifier+'_dialog').delay(500).dialog({position: { my: 'center', at: 'center', of: window }});
435
+ }
436
+ );
437
+ },
438
+ buttons: {
439
+ 'Update': function() {
440
+ jQuery("#insert_ads_adwidgets_"+identifier).html("Ad Widget : "+jQuery("#insert_ads_adwidgets_"+identifier+"_title").val());
441
+ jQuery("#insert_ads_adwidgets_"+identifier).attr("onClick", "insert_ads_adwidgets_click_handler(\'"+identifier+"\', \'"+jQuery("#insert_ads_adwidgets_"+identifier+"_title").val()+"\')");
442
+ insert_ads_adwidgets_update(identifier);
443
+ jQuery(this).dialog('close');
444
+ },
445
+ Cancel: function() {
446
+ jQuery(this).dialog('close');
447
+ }
448
+ },
449
+ close: function() {
450
+ jQuery(this).dialog('destroy');
451
+ }
452
+ });
453
+ }
454
+
455
+ function insert_ads_adwidgets_update(identifier) {
456
+ args = {};
457
+ args['action'] = 'insert_ads_adwidgets_existing_form_save_action';
458
+ args['insert_ads_nonce'] = jQuery('#insert_ads_nonce').val();
459
+ args['insert_ads_adwidgets_identifier'] = identifier;
460
+ args['insert_ads_adwidgets_'+identifier+'_status'] = jQuery('#insert_ads_adwidgets_'+identifier+'_status').prop('checked');
461
+
462
+ args['insert_ads_adwidgets_'+identifier+'_title'] = jQuery('#insert_ads_adwidgets_'+identifier+'_title').val();
463
+
464
+ args['insert_ads_adwidgets_'+identifier+'_primary_ad_code'] = jQuery('#insert_ads_adwidgets_'+identifier+'_primary_ad_code').val();
465
+ args['insert_ads_adwidgets_'+identifier+'_secondary_ad_code'] = jQuery('#insert_ads_adwidgets_'+identifier+'_secondary_ad_code').val();
466
+ args['insert_ads_adwidgets_'+identifier+'_tertiary_ad_code'] = jQuery('#insert_ads_adwidgets_'+identifier+'_tertiary_ad_code').val();
467
+
468
+ args['insert_ads_adwidgets_'+identifier+'_rules_exclude_loggedin'] = jQuery('#insert_ads_adwidgets_'+identifier+'_rules_exclude_loggedin').prop('checked');
469
+ args['insert_ads_adwidgets_'+identifier+'_rules_exclude_mobile_devices'] = jQuery('#insert_ads_adwidgets_'+identifier+'_rules_exclude_mobile_devices').prop('checked');
470
+ args['insert_ads_adwidgets_'+identifier+'_rules_exclude_404'] = jQuery('#insert_ads_adwidgets_'+identifier+'_rules_exclude_404').prop('checked');
471
+ args['insert_ads_adwidgets_'+identifier+'_rules_exclude_home'] = jQuery('#insert_ads_adwidgets_'+identifier+'_rules_exclude_home').prop('checked');
472
+ args['insert_ads_adwidgets_'+identifier+'_rules_exclude_archives'] = jQuery('#insert_ads_adwidgets_'+identifier+'_rules_exclude_archives').prop('checked');
473
+ args['insert_ads_adwidgets_'+identifier+'_rules_exclude_search'] = jQuery('#insert_ads_adwidgets_'+identifier+'_rules_exclude_search').prop('checked');
474
+ args['insert_ads_adwidgets_'+identifier+'_rules_exclude_page'] = jQuery('#insert_ads_adwidgets_'+identifier+'_rules_exclude_page').prop('checked');
475
+ args['insert_ads_adwidgets_'+identifier+'_rules_page_exceptions'] = jQuery.map(jQuery('#insert_ads_adwidgets_'+identifier+'_rules_page_exceptions :selected'), function(e) { return jQuery(e).val(); });
476
+ args['insert_ads_adwidgets_'+identifier+'_rules_exclude_post'] = jQuery('#insert_ads_adwidgets_'+identifier+'_rules_exclude_post').prop('checked');
477
+ args['insert_ads_adwidgets_'+identifier+'_rules_post_exceptions'] = jQuery.map(jQuery('#insert_ads_adwidgets_'+identifier+'_rules_post_exceptions :selected'), function(e) { return jQuery(e).val(); });
478
+ args['insert_ads_adwidgets_'+identifier+'_rules_post_categories_exceptions'] = jQuery.map(jQuery('#insert_ads_adwidgets_'+identifier+'_rules_post_categories_exceptions :selected'), function(e) { return jQuery(e).val(); });
479
+ args['insert_ads_adwidgets_'+identifier+'_rules_exclude_categories'] = jQuery('#insert_ads_adwidgets_'+identifier+'_rules_exclude_categories').prop('checked');
480
+ args['insert_ads_adwidgets_'+identifier+'_rules_categories_exceptions'] = jQuery.map(jQuery('#insert_ads_adwidgets_'+identifier+'_rules_categories_exceptions :selected'), function(e) { return jQuery(e).val(); });
481
+
482
+ args['insert_ads_adwidgets_'+identifier+'_geo_group1_countries'] = jQuery.map(jQuery('#insert_ads_adwidgets_'+identifier+'_geo_group1_countries :selected'), function(e) { return jQuery(e).val(); });
483
+ args['insert_ads_adwidgets_'+identifier+'_geo_group1_adcode'] = jQuery('#insert_ads_adwidgets_'+identifier+'_geo_group1_adcode').val();
484
+ args['insert_ads_adwidgets_'+identifier+'_geo_group2_countries'] = jQuery.map(jQuery('#insert_ads_adwidgets_'+identifier+'_geo_group2_countries :selected'), function(e) { return jQuery(e).val(); });
485
+ args['insert_ads_adwidgets_'+identifier+'_geo_group2_adcode'] = jQuery('#insert_ads_adwidgets_'+identifier+'_geo_group2_adcode').val();
486
+
487
+ args['insert_ads_adwidgets_'+identifier+'_styles'] = jQuery('#insert_ads_adwidgets_'+identifier+'_styles').val();
488
+
489
+ args['insert_ads_adwidgets_'+identifier+'_notes'] = jQuery('#insert_ads_adwidgets_'+identifier+'_notes').val();
490
+
491
+ jQuery.post(
492
+ jQuery('#insert_ads_admin_ajax').val(), args, function(response) { }
493
+ );
494
+ }
495
+
496
+ function insert_ads_adwidgets_remove(identifier) {
497
+ jQuery("<p>Are you Sure you want to remove this Ad Unit?</p>").dialog({
498
+ 'modal': true,
499
+ 'resizable': false,
500
+ 'title': 'Deletion Confirmation',
501
+ position: { my: 'center', at: 'center', of: window },
502
+ open: function (event, ui) {
503
+ jQuery('.ui-dialog').css({'z-index': 999999, 'max-width': '90%'});
504
+ jQuery('.ui-widget-overlay').css({'z-index': 999998, 'opacity': 0.8, 'background': '#000000'});
505
+ },
506
+ buttons : {
507
+ 'Confirm': function() {
508
+ jQuery("#insert_ads_adwidgets_"+identifier).parent().remove();
509
+ jQuery.post(
510
+ jQuery('#insert_ads_admin_ajax').val(), {
511
+ 'action': 'insert_ads_adwidgets_remove',
512
+ 'insert_ads_adwidgets_identifier': identifier,
513
+ 'insert_ads_nonce': jQuery('#insert_ads_nonce').val()
514
+ }, function(response) {
515
+ }
516
+ );
517
+ jQuery(this).dialog("close");
518
+ },
519
+ 'Cancel': function() {
520
+ jQuery(this).dialog("close");
521
+ }
522
+ },
523
+ close: function() {
524
+ jQuery(this).dialog('destroy');
525
+ }
526
+ });
527
+ }
528
+
529
+ function insert_ads_inthemeads_click_handler(identifier, title) {
530
+ jQuery('<div id="insert_ads_inthemeads_'+identifier+'_dialog"></div>').html('<div class="insert_ads_ajaxloader"></div>').dialog({
531
+ 'modal': true,
532
+ 'resizable': false,
533
+ 'width': jQuery("body").width() * 0.8,
534
+ 'maxWidth': jQuery("body").width() * 0.8,
535
+ 'maxHeight': jQuery("body").height() * 0.9,
536
+ 'title': 'In-Theme Ad : '+title,
537
+ position: { my: 'center', at: 'center', of: window },
538
+ open: function (event, ui) {
539
+ jQuery('.ui-dialog').css({'z-index': 999999, 'max-width': '90%'});
540
+ jQuery('.ui-widget-overlay').css({'z-index': 999998, 'opacity': 0.8, 'background': '#000000'});
541
+ jQuery('.ui-dialog-buttonpane button:contains("Update")').button('disable');
542
+ jQuery.post(
543
+ jQuery('#insert_ads_admin_ajax').val(), {
544
+ 'action': 'insert_ads_inthemeads_existing_form_get_content',
545
+ 'insert_ads_inthemeads_identifier': identifier,
546
+ 'insert_ads_nonce': jQuery('#insert_ads_nonce').val()
547
+ }, function(response) {
548
+ jQuery('.insert_ads_ajaxloader').hide();
549
+ jQuery('.ui-dialog-content').html(response);
550
+ jQuery('.ui-accordion .ui-accordion-content').css('max-height', (jQuery("body").height() * 0.45));
551
+ jQuery('.ui-dialog-buttonpane button:contains("Update")').button('enable');
552
+ jQuery('.insert_ads_inthemeads_status').parent().css({'display': 'inline-block', 'margin': '5px 0 0'}).prependTo('.ui-dialog-buttonpane');
553
+ jQuery('.ui-dialog').css({'position': 'fixed'});
554
+ jQuery('#insert_ads_inthemeads_'+identifier+'_dialog').delay(500).dialog({position: { my: 'center', at: 'center', of: window }});
555
+ }
556
+ );
557
+ },
558
+ buttons: {
559
+ 'Update': function() {
560
+ jQuery("#insert_ads_inthemeads_"+identifier).html("In-Theme Ad : "+jQuery("#insert_ads_inthemeads_"+identifier+"_title").val());
561
+ jQuery("#insert_ads_inthemeads_"+identifier).attr("onClick", "insert_ads_inthemeads_click_handler(\'"+identifier+"\', \'"+jQuery("#insert_ads_inthemeads_"+identifier+"_title").val()+"\')");
562
+ insert_ads_inthemeads_update(identifier);
563
+ jQuery(this).dialog('close');
564
+ },
565
+ Cancel: function() {
566
+ jQuery(this).dialog('close');
567
+ }
568
+ },
569
+ close: function() {
570
+ jQuery(this).dialog('destroy');
571
+ }
572
+ });
573
+ }
574
+
575
+ function insert_ads_inthemeads_update(identifier) {
576
+ args = {};
577
+ args['action'] = 'insert_ads_inthemeads_existing_form_save_action';
578
+ args['insert_ads_nonce'] = jQuery('#insert_ads_nonce').val();
579
+ args['insert_ads_inthemeads_identifier'] = identifier;
580
+ args['insert_ads_inthemeads_'+identifier+'_status'] = jQuery('#insert_ads_inthemeads_'+identifier+'_status').prop('checked');
581
+
582
+ args['insert_ads_inthemeads_'+identifier+'_title'] = jQuery('#insert_ads_inthemeads_'+identifier+'_title').val();
583
+
584
+ args['insert_ads_inthemeads_'+identifier+'_primary_ad_code'] = jQuery('#insert_ads_inthemeads_'+identifier+'_primary_ad_code').val();
585
+ args['insert_ads_inthemeads_'+identifier+'_secondary_ad_code'] = jQuery('#insert_ads_inthemeads_'+identifier+'_secondary_ad_code').val();
586
+ args['insert_ads_inthemeads_'+identifier+'_tertiary_ad_code'] = jQuery('#insert_ads_inthemeads_'+identifier+'_tertiary_ad_code').val();
587
+
588
+ args['insert_ads_inthemeads_'+identifier+'_rules_exclude_loggedin'] = jQuery('#insert_ads_inthemeads_'+identifier+'_rules_exclude_loggedin').prop('checked');
589
+ args['insert_ads_inthemeads_'+identifier+'_rules_exclude_mobile_devices'] = jQuery('#insert_ads_inthemeads_'+identifier+'_rules_exclude_mobile_devices').prop('checked');
590
+ args['insert_ads_inthemeads_'+identifier+'_rules_exclude_404'] = jQuery('#insert_ads_inthemeads_'+identifier+'_rules_exclude_404').prop('checked');
591
+ args['insert_ads_inthemeads_'+identifier+'_rules_exclude_home'] = jQuery('#insert_ads_inthemeads_'+identifier+'_rules_exclude_home').prop('checked');
592
+ args['insert_ads_inthemeads_'+identifier+'_rules_exclude_archives'] = jQuery('#insert_ads_inthemeads_'+identifier+'_rules_exclude_archives').prop('checked');
593
+ args['insert_ads_inthemeads_'+identifier+'_rules_exclude_search'] = jQuery('#insert_ads_inthemeads_'+identifier+'_rules_exclude_search').prop('checked');
594
+ args['insert_ads_inthemeads_'+identifier+'_rules_exclude_page'] = jQuery('#insert_ads_inthemeads_'+identifier+'_rules_exclude_page').prop('checked');
595
+ args['insert_ads_inthemeads_'+identifier+'_rules_page_exceptions'] = jQuery.map(jQuery('#insert_ads_inthemeads_'+identifier+'_rules_page_exceptions :selected'), function(e) { return jQuery(e).val(); });
596
+ args['insert_ads_inthemeads_'+identifier+'_rules_exclude_post'] = jQuery('#insert_ads_inthemeads_'+identifier+'_rules_exclude_post').prop('checked');
597
+ args['insert_ads_inthemeads_'+identifier+'_rules_post_exceptions'] = jQuery.map(jQuery('#insert_ads_inthemeads_'+identifier+'_rules_post_exceptions :selected'), function(e) { return jQuery(e).val(); });
598
+ args['insert_ads_inthemeads_'+identifier+'_rules_post_categories_exceptions'] = jQuery.map(jQuery('#insert_ads_inthemeads_'+identifier+'_rules_post_categories_exceptions :selected'), function(e) { return jQuery(e).val(); });
599
+ args['insert_ads_inthemeads_'+identifier+'_rules_exclude_categories'] = jQuery('#insert_ads_inthemeads_'+identifier+'_rules_exclude_categories').prop('checked');
600
+ args['insert_ads_inthemeads_'+identifier+'_rules_categories_exceptions'] = jQuery.map(jQuery('#insert_ads_inthemeads_'+identifier+'_rules_categories_exceptions :selected'), function(e) { return jQuery(e).val(); });
601
+
602
+ args['insert_ads_inthemeads_'+identifier+'_geo_group1_countries'] = jQuery.map(jQuery('#insert_ads_inthemeads_'+identifier+'_geo_group1_countries :selected'), function(e) { return jQuery(e).val(); });
603
+ args['insert_ads_inthemeads_'+identifier+'_geo_group1_adcode'] = jQuery('#insert_ads_inthemeads_'+identifier+'_geo_group1_adcode').val();
604
+ args['insert_ads_inthemeads_'+identifier+'_geo_group2_countries'] = jQuery.map(jQuery('#insert_ads_inthemeads_'+identifier+'_geo_group2_countries :selected'), function(e) { return jQuery(e).val(); });
605
+ args['insert_ads_inthemeads_'+identifier+'_geo_group2_adcode'] = jQuery('#insert_ads_inthemeads_'+identifier+'_geo_group2_adcode').val();
606
+
607
+ args['insert_ads_inthemeads_'+identifier+'_styles'] = jQuery('#insert_ads_inthemeads_'+identifier+'_styles').val();
608
+
609
+ args['insert_ads_inthemeads_'+identifier+'_notes'] = jQuery('#insert_ads_inthemeads_'+identifier+'_notes').val();
610
+
611
+ jQuery.post(
612
+ jQuery('#insert_ads_admin_ajax').val(), args, function(response) { }
613
+ );
614
+ }
615
+
616
+ function insert_ads_inthemeads_remove(identifier) {
617
+ jQuery("<p>Are you Sure you want to remove this Ad Unit?</p>").dialog({
618
+ 'modal': true,
619
+ 'resizable': false,
620
+ 'title': 'Deletion Confirmation',
621
+ position: { my: 'center', at: 'center', of: window },
622
+ open: function (event, ui) {
623
+ jQuery('.ui-dialog').css({'z-index': 999999, 'max-width': '90%'});
624
+ jQuery('.ui-widget-overlay').css({'z-index': 999998, 'opacity': 0.8, 'background': '#000000'});
625
+ },
626
+ buttons : {
627
+ 'Confirm': function() {
628
+ jQuery("#insert_ads_inthemeads_"+identifier).parent().remove();
629
+ jQuery.post(
630
+ jQuery('#insert_ads_admin_ajax').val(), {
631
+ 'action': 'insert_ads_inthemeads_remove',
632
+ 'insert_ads_inthemeads_identifier': identifier,
633
+ 'insert_ads_nonce': jQuery('#insert_ads_nonce').val()
634
+ }, function(response) {
635
+ }
636
+ );
637
+ jQuery(this).dialog("close");
638
+ },
639
+ 'Cancel': function() {
640
+ jQuery(this).dialog("close");
641
+ }
642
+ },
643
+ close: function() {
644
+ jQuery(this).dialog('destroy');
645
+ }
646
+ });
647
+ }
648
+
649
+ function insert_ads_legalpages_generate_page(target, title) {
650
+ jQuery('.ui-dialog-buttonpane button:contains("Update")').button('disable');
651
+ jQuery('#'+target+'_generate_page').hide();
652
+ jQuery('#'+target+'_accordion .insert_ads_ajaxloader_flat').show();
653
+ jQuery.post(
654
+ jQuery('#insert_ads_admin_ajax').val(), {
655
+ 'action': target+'_form_generate_page_action',
656
+ 'insert_ads_nonce': jQuery('#insert_ads_nonce').val(),
657
+ }, function(response) {
658
+ if(response != '0') {
659
+ jQuery('#'+target+'_assigned_page').append(jQuery('<option>', {value: response, text: title})).val(response);
660
+ }
661
+ jQuery('#'+target+'_generate_page').show();
662
+ jQuery('#'+target+'_accordion .insert_ads_ajaxloader_flat').hide();
663
+ jQuery('.ui-dialog-buttonpane button:contains("Update")').button('enable');
664
+ }
665
+ );
666
+ }
667
+ jQuery(document).on('click', '#insert_ads_vi_signup2', function(){
668
+ console.log(location.search);
669
+ if(location.search == '?post_type=insertpostads&page=insert-post-ads'){
670
+ jQuery('#insert_ads_vi_signup').trigger('click');
671
+ } else {
672
+ location.href = '/wp-admin/edit.php?post_type=insertpostads&page=insert-post-ads';
673
+ }
674
+ })
675
+ function insert_ads_click_handler(target, title, width, height, openAction, UpdateAction, closeAction) {
676
+ jQuery('#'+target).click(function() {
677
+ console.log(jQuery('#insert_ads_nonce').val(), jQuery('#insert_ads_admin_ajax').val());
678
+ console.log(target);
679
+ jQuery('<div id="'+target+'_dialog"></div>').html('<div class="insert_ads_ajaxloader"></div>').dialog({
680
+ 'modal': true,
681
+ 'resizable': false,
682
+ 'width': width,
683
+ 'maxWidth': width,
684
+ 'maxHeight': height,
685
+ 'title': title,
686
+ position: { my: 'center', at: 'center', of: window },
687
+ open: function (event, ui) {
688
+ jQuery('.ui-dialog').css({'z-index': 999999, 'max-width': '90%'});
689
+ jQuery('.ui-widget-overlay').css({'z-index': 999998, 'opacity': 0.8, 'background': '#000000'});
690
+ jQuery('.ui-dialog-buttonpane button:contains("Update")').button('disable');
691
+
692
+ jQuery.post(
693
+ jQuery('#insert_ads_admin_ajax').val(), {
694
+ 'action': target+'_form_get_content',
695
+ 'insert_ads_nonce': jQuery('#insert_ads_nonce').val()
696
+ }, function(response) {
697
+ jQuery('.insert_ads_ajaxloader').hide();
698
+ jQuery('.ui-dialog-content').html(response);
699
+ jQuery('.ui-accordion .ui-accordion-content').css('max-height', (jQuery("body").height() * 0.45));
700
+ jQuery('.ui-dialog-buttonpane button:contains("Update")').button('enable');
701
+ openAction();
702
+ jQuery('.ui-dialog').css({'position': 'fixed'});
703
+ jQuery('#'+target+'_dialog').delay(500).dialog({position: { my: 'center', at: 'center', of: window }});
704
+
705
+ }
706
+ );
707
+ },
708
+ buttons: {
709
+ 'Update': {
710
+ text: 'Update',
711
+ icons: { primary: "ui-icon-gear" },
712
+ click: function() {
713
+ if(UpdateAction() != 'false') {
714
+ jQuery(this).dialog('close');
715
+ }
716
+ }
717
+ },
718
+ Cancel: {
719
+ text: 'Cancel',
720
+ icons: { primary: "ui-icon-cancel" },
721
+ click: function() {
722
+ if(closeAction() != 'false') {
723
+ jQuery(this).dialog('close');
724
+ }
725
+ }
726
+ }
727
+ },
728
+ close: function() {
729
+ closeAction();
730
+ jQuery(this).dialog('destroy');
731
+ }
732
+ })
733
+ });
734
+ }
735
+ function insert_ads_adstxt_add_entry() {
736
+ var insert_ads_adstxt_new_entry_domain = jQuery("#insert_ads_adstxt_new_entry_domain").val();
737
+ var insert_ads_adstxt_new_entry_pid = jQuery("#insert_ads_adstxt_new_entry_pid").val();
738
+ var insert_ads_adstxt_new_entry_type = jQuery("#insert_ads_adstxt_new_entry_type").val();
739
+ var insert_ads_adstxt_new_entry_certauthority = jQuery("#insert_ads_adstxt_new_entry_certauthority").val();
740
+ var insert_ads_adstxt_content = jQuery("#insert_ads_adstxt_content").val();
741
+ var defaultBorderColor = jQuery("#insert_ads_adstxt_new_entry_domain").css("border-color");
742
+ var defaultLabelColor = jQuery("#insert_ads_adstxt_new_entry_domain").parent().find("small").css("color");
743
+
744
+ var isValidated = true;
745
+ jQuery("#insert_ads_adstxt_new_entry_domain").css({"border-color": defaultBorderColor}).parent().find("small").css({"color": defaultLabelColor});
746
+ jQuery("#insert_ads_adstxt_new_entry_pid").css({"border-color": defaultBorderColor}).parent().find("small").css({"color": defaultLabelColor});
747
+
748
+
749
+ if(insert_ads_adstxt_new_entry_domain == '') {
750
+ jQuery("#insert_ads_adstxt_new_entry_domain").css({"border-color": "#B20303"}).parent().find("small").css({"color": "#B20303"});
751
+ isValidated = false;
752
+ }
753
+ if(insert_ads_adstxt_new_entry_pid == '') {
754
+ jQuery("#insert_ads_adstxt_new_entry_pid").css({"border-color": "#B20303"}).parent().find("small").css({"color": "#B20303"});
755
+ isValidated = false;
756
+ }
757
+
758
+ if(isValidated) {
759
+ if((insert_ads_adstxt_content != '') && (jQuery.inArray((insert_ads_adstxt_content[insert_ads_adstxt_content.length -1]), ["\r", "\n"]) == -1)) {
760
+ insert_ads_adstxt_content += '\r\n';
761
+ }
762
+ insert_ads_adstxt_content += insert_ads_adstxt_new_entry_domain + ', ' + insert_ads_adstxt_new_entry_pid + ', ' + insert_ads_adstxt_new_entry_type;
763
+ if(insert_ads_adstxt_new_entry_certauthority != '') {
764
+ insert_ads_adstxt_content += ', ' + insert_ads_adstxt_new_entry_certauthority;
765
+ }
766
+ jQuery("#insert_ads_adstxt_content").val(insert_ads_adstxt_content);
767
+
768
+ jQuery("#insert_ads_adstxt_new_entry_domain").val('');
769
+ jQuery("#insert_ads_adstxt_new_entry_pid").val('');
770
+ jQuery("#insert_ads_adstxt_new_entry_type").val('DIRECT');
771
+ jQuery("#insert_ads_adstxt_new_entry_certauthority").val('');
772
+
773
+ jQuery("#insert_ads_adstxt_accordion").accordion({active: 0});
774
+ jQuery("#insert_ads_adstxt_content").focus();
775
+ }
776
+ }
777
+
778
+ function insert_ads_adstxt_content_download() {
779
+ var blob = new Blob([jQuery("#insert_ads_adstxt_content").val()], {type: 'text/csv'});
780
+ if(window.navigator.msSaveOrOpenBlob) {
781
+ window.navigator.msSaveBlob(blob, 'ads.txt');
782
+ }
783
+ else{
784
+ var elem = window.document.createElement('a');
785
+ elem.href = window.URL.createObjectURL(blob);
786
+ elem.download = 'ads.txt';
787
+ document.body.appendChild(elem);
788
+ elem.click();
789
+ document.body.removeChild(elem);
790
+ }
791
+ }
792
+
793
+ function insert_ads_vi_signup_handler() {
794
+ insert_ads_click_handler(
795
+ 'insert_ads_vi_signup',
796
+ 'video intelligence: Signup',
797
+ '870',
798
+ '554',
799
+ function() { },
800
+ function() { },
801
+ function() { }
802
+ );
803
+ }
804
+
805
+ function insert_ads_vi_login_handler() {
806
+ insert_ads_click_handler(
807
+ 'insert_ads_vi_login',
808
+ 'video intelligence: Login',
809
+ '540',
810
+ '540',
811
+ function() {
812
+ jQuery('.ui-dialog-buttonset').find('button').first().unbind('click').click(function() {
813
+ if((jQuery('#insert_ads_vi_login_username').val() != '') && (jQuery('#insert_ads_vi_login_password').val() != '')) {
814
+ jQuery('.ui-dialog-buttonset').find('button').first().button('disable');
815
+ jQuery('.ui-dialog-buttonset').find('button').last().button('disable');
816
+ jQuery('.ui-dialog-titlebar').find('button').last().button('disable');
817
+ var insert_ads_vi_login_username = jQuery('#insert_ads_vi_login_username').val();
818
+ var insert_ads_vi_login_password = jQuery('#insert_ads_vi_login_password').val();
819
+ jQuery('.ui-dialog-content').html('<div class="insert_ads_ajaxloader"></div>');
820
+ jQuery('.insert_ads_ajaxloader').show();
821
+ jQuery.post(
822
+ jQuery('#insert_ads_admin_ajax').val(), {
823
+ 'action': 'insert_ads_vi_login_form_save_action',
824
+ 'insert_ads_nonce': jQuery('#insert_ads_nonce').val(),
825
+ 'insert_ads_vi_login_username': insert_ads_vi_login_username,
826
+ 'insert_ads_vi_login_password': insert_ads_vi_login_password,
827
+ }, function(response) {
828
+ if(response.indexOf('###SUCCESS###') !== -1) {
829
+ jQuery.post(
830
+ jQuery('#insert_ads_admin_ajax').val(), {
831
+ 'action': 'insert_ads_vi_update_adstxt',
832
+ 'insert_ads_nonce': jQuery('#insert_ads_nonce').val(),
833
+ }, function(response) {
834
+ if(response.indexOf('###SUCCESS###') !== -1) {
835
+ jQuery('.wrap #insert_ads_title').after(response.replace('###SUCCESS###', ''));
836
+ } else if(response.indexOf('###FAIL###') !== -1) {
837
+ jQuery('.wrap #insert_ads_title').after(response.replace('###FAIL###', ''));
838
+ } else {
839
+ }
840
+ }
841
+ );
842
+ jQuery('.vi-card .plugin-card-bottom, .vi-card .plugin-card-top-content').animate({'opacity': 0}, 1000);
843
+ jQuery('.vi-card').html(response.replace('###SUCCESS###', ''));
844
+ insert_ads_vi_logout_handler();
845
+ insert_ads_vi_customize_adcode();
846
+ insert_ads_vi_chart_draw();
847
+ jQuery(window).resize();
848
+ jQuery('.vi-card .plugin-card-bottom, .vi-card .plugin-card-top-content').animate({'opacity': 1}, 1000);
849
+ jQuery('.ui-dialog-titlebar').find('button').last().button('enable').click();
850
+ } else {
851
+ jQuery('.ui-dialog-buttonset').find('button').first().button('enable');
852
+ jQuery('.ui-dialog-buttonset').find('button').last().button('enable');
853
+ jQuery('.ui-dialog-titlebar').find('button').last().button('enable');
854
+ jQuery('.ui-dialog-content').html(response);
855
+ }
856
+ }
857
+ );
858
+ } else {
859
+ jQuery('#insert_ads_vi_login_username').css('border-color', '#dddddd');
860
+ jQuery('#insert_ads_vi_login_password').css('border-color', '#dddddd');
861
+ if(jQuery('#insert_ads_vi_login_username').val() == '') {
862
+ jQuery('#insert_ads_vi_login_username').css('border-color', '#ff0000');
863
+ }
864
+ if(jQuery('#insert_ads_vi_login_password').val() == '') {
865
+ jQuery('#insert_ads_vi_login_password').css('border-color', '#ff0000');
866
+ }
867
+ }
868
+ });
869
+ },
870
+ function() { },
871
+ function() { }
872
+ );
873
+ }
874
+
875
+ function insert_ads_vi_customize_adcode() {
876
+ insert_ads_click_handler(
877
+ 'insert_ads_vi_customize_adcode',
878
+ 'video intelligence: Customize vi Code',
879
+ jQuery("body").width() * 0.8,
880
+ jQuery("body").height() * 0.8,
881
+ function() {
882
+ jQuery('#insert_ads_vi_code_settings_keywords').attr('maxlength', '200');
883
+ jQuery('#insert_ads_vi_code_settings_optional_1').attr('maxlength', '200');
884
+ jQuery('#insert_ads_vi_code_settings_optional_2').attr('maxlength', '200');
885
+ jQuery('#insert_ads_vi_code_settings_optional_3').attr('maxlength', '200');
886
+ jQuery('.ui-dialog-buttonset').find('button').first().unbind('click').click(function() {
887
+ var keywordsRegex = /[ ,a-zA-Z0-9-’'‘\u00C6\u00D0\u018E\u018F\u0190\u0194\u0132\u014A\u0152\u1E9E\u00DE\u01F7\u021C\u00E6\u00F0\u01DD\u0259\u025B\u0263\u0133\u014B\u0153\u0138\u017F\u00DF\u00FE\u01BF\u021D\u0104\u0181\u00C7\u0110\u018A\u0118\u0126\u012E\u0198\u0141\u00D8\u01A0\u015E\u0218\u0162\u021A\u0166\u0172\u01AFY\u0328\u01B3\u0105\u0253\u00E7\u0111\u0257\u0119\u0127\u012F\u0199\u0142\u00F8\u01A1\u015F\u0219\u0163\u021B\u0167\u0173\u01B0y\u0328\u01B4\u00C1\u00C0\u00C2\u00C4\u01CD\u0102\u0100\u00C3\u00C5\u01FA\u0104\u00C6\u01FC\u01E2\u0181\u0106\u010A\u0108\u010C\u00C7\u010E\u1E0C\u0110\u018A\u00D0\u00C9\u00C8\u0116\u00CA\u00CB\u011A\u0114\u0112\u0118\u1EB8\u018E\u018F\u0190\u0120\u011C\u01E6\u011E\u0122\u0194\u00E1\u00E0\u00E2\u00E4\u01CE\u0103\u0101\u00E3\u00E5\u01FB\u0105\u00E6\u01FD\u01E3\u0253\u0107\u010B\u0109\u010D\u00E7\u010F\u1E0D\u0111\u0257\u00F0\u00E9\u00E8\u0117\u00EA\u00EB\u011B\u0115\u0113\u0119\u1EB9\u01DD\u0259\u025B\u0121\u011D\u01E7\u011F\u0123\u0263\u0124\u1E24\u0126I\u00CD\u00CC\u0130\u00CE\u00CF\u01CF\u012C\u012A\u0128\u012E\u1ECA\u0132\u0134\u0136\u0198\u0139\u013B\u0141\u013D\u013F\u02BCN\u0143N\u0308\u0147\u00D1\u0145\u014A\u00D3\u00D2\u00D4\u00D6\u01D1\u014E\u014C\u00D5\u0150\u1ECC\u00D8\u01FE\u01A0\u0152\u0125\u1E25\u0127\u0131\u00ED\u00ECi\u00EE\u00EF\u01D0\u012D\u012B\u0129\u012F\u1ECB\u0133\u0135\u0137\u0199\u0138\u013A\u013C\u0142\u013E\u0140\u0149\u0144n\u0308\u0148\u00F1\u0146\u014B\u00F3\u00F2\u00F4\u00F6\u01D2\u014F\u014D\u00F5\u0151\u1ECD\u00F8\u01FF\u01A1\u0153\u0154\u0158\u0156\u015A\u015C\u0160\u015E\u0218\u1E62\u1E9E\u0164\u0162\u1E6C\u0166\u00DE\u00DA\u00D9\u00DB\u00DC\u01D3\u016C\u016A\u0168\u0170\u016E\u0172\u1EE4\u01AF\u1E82\u1E80\u0174\u1E84\u01F7\u00DD\u1EF2\u0176\u0178\u0232\u1EF8\u01B3\u0179\u017B\u017D\u1E92\u0155\u0159\u0157\u017F\u015B\u015D\u0161\u015F\u0219\u1E63\u00DF\u0165\u0163\u1E6D\u0167\u00FE\u00FA\u00F9\u00FB\u00FC\u01D4\u016D\u016B\u0169\u0171\u016F\u0173\u1EE5\u01B0\u1E83\u1E81\u0175\u1E85\u01BF\u00FD\u1EF3\u0177\u00FF\u0233\u1EF9\u01B4\u017A\u017C\u017E\u1E93]/g;
888
+ if(
889
+ (jQuery('#insert_ads_vi_code_settings_ad_unit_type').val() != 'select') &&
890
+ (jQuery('#insert_ads_vi_code_settings_iab_category_child').val() != 'select') &&
891
+ (jQuery('#insert_ads_vi_code_settings_language').val() != 'select') &&
892
+ ((jQuery('#insert_ads_vi_code_settings_keywords').val() == '') || ((jQuery(jQuery('#insert_ads_vi_code_settings_keywords').val().match(/./g)).not(jQuery('#insert_ads_vi_code_settings_keywords').val().match(keywordsRegex)).get().length == 0) && (jQuery('#insert_ads_vi_code_settings_keywords').val().length < 200)))
893
+ ) {
894
+ jQuery('.ui-dialog-buttonset').find('button').first().button('disable');
895
+ jQuery('.ui-dialog-buttonset').find('button').last().button('disable');
896
+ jQuery('.ui-dialog-titlebar').find('button').last().button('disable');
897
+ var insert_ads_vi_code_settings_ad_unit_type = jQuery('#insert_ads_vi_code_settings_ad_unit_type').val();
898
+ var insert_ads_vi_code_settings_keywords = jQuery('#insert_ads_vi_code_settings_keywords').val();
899
+ var insert_ads_vi_code_settings_iab_category_parent = jQuery('#insert_ads_vi_code_settings_iab_category_parent').val();
900
+ var insert_ads_vi_code_settings_iab_category_child = jQuery('#insert_ads_vi_code_settings_iab_category_child').val();
901
+ var insert_ads_vi_code_settings_language = jQuery('#insert_ads_vi_code_settings_language').val();
902
+ var insert_ads_vi_code_settings_native_bg_color = jQuery('#insert_ads_vi_code_settings_native_bg_color').val();
903
+ var insert_ads_vi_code_settings_native_text_color = jQuery('#insert_ads_vi_code_settings_native_text_color').val();
904
+ var insert_ads_vi_code_settings_font_family = jQuery('#insert_ads_vi_code_settings_font_family').val();
905
+ var insert_ads_vi_code_settings_font_size = jQuery('#insert_ads_vi_code_settings_font_size').val();
906
+ var insert_ads_vi_code_settings_optional_1 = jQuery('#insert_ads_vi_code_settings_optional_1').val();
907
+ var insert_ads_vi_code_settings_optional_2 = jQuery('#insert_ads_vi_code_settings_optional_2').val();
908
+ var insert_ads_vi_code_settings_optional_3 = jQuery('#insert_ads_vi_code_settings_optional_3').val();
909
+ jQuery('.ui-dialog-content').html('<div class="insert_ads_ajaxloader"></div>');
910
+ jQuery('.insert_ads_ajaxloader').show();
911
+ jQuery.post(
912
+ jQuery('#insert_ads_admin_ajax').val(), {
913
+ 'action': 'insert_ads_vi_customize_adcode_form_save_action',
914
+ 'insert_ads_nonce': jQuery('#insert_ads_nonce').val(),
915
+ 'insert_ads_vi_code_settings_ad_unit_type': insert_ads_vi_code_settings_ad_unit_type,
916
+ 'insert_ads_vi_code_settings_keywords': insert_ads_vi_code_settings_keywords,
917
+ 'insert_ads_vi_code_settings_iab_category_parent': insert_ads_vi_code_settings_iab_category_parent,
918
+ 'insert_ads_vi_code_settings_iab_category_child': insert_ads_vi_code_settings_iab_category_child,
919
+ 'insert_ads_vi_code_settings_language': insert_ads_vi_code_settings_language,
920
+ 'insert_ads_vi_code_settings_native_bg_color': insert_ads_vi_code_settings_native_bg_color,
921
+ 'insert_ads_vi_code_settings_native_text_color': insert_ads_vi_code_settings_native_text_color,
922
+ 'insert_ads_vi_code_settings_font_family': insert_ads_vi_code_settings_font_family,
923
+ 'insert_ads_vi_code_settings_font_size': insert_ads_vi_code_settings_font_size,
924
+ 'insert_ads_vi_code_settings_optional_1': insert_ads_vi_code_settings_optional_1,
925
+ 'insert_ads_vi_code_settings_optional_2': insert_ads_vi_code_settings_optional_2,
926
+ 'insert_ads_vi_code_settings_optional_3': insert_ads_vi_code_settings_optional_3,
927
+ }, function(response) {
928
+ if(response.indexOf('###SUCCESS###') !== -1) {
929
+ jQuery('.ui-dialog-titlebar').find('button').last().button('enable').click();
930
+ var successText = '<div id="sucessText" class="notice notice-success is-dismissible insert-post-ads-notice-welcome"><p>Settings saved!</p></div>';
931
+ jQuery('#poststuff').before(successText);
932
+ jQuery(document).find('#sucessText').delay('2000').fadeOut('1000');
933
+ } else {
934
+ jQuery('.ui-dialog-buttonset').find('button').first().button('disable');
935
+ jQuery('.ui-dialog-buttonset').find('button').last().button('enable');
936
+ jQuery('.ui-dialog-titlebar').find('button').last().button('enable');
937
+ jQuery('.ui-dialog-content').html(response.replace('###FAIL###', ''));
938
+ }
939
+ }
940
+ );
941
+ } else {
942
+ jQuery('#insert_ads_vi_customize_adcode_keywords_required_error').hide();
943
+ jQuery('#insert_ads_vi_customize_adcode_keywords_error').hide();
944
+ jQuery('#insert_ads_vi_customize_adcode_required_error').hide();
945
+ jQuery('#insert_ads_vi_code_settings_ad_unit_type').css('border-color', '#dddddd');
946
+ jQuery('#insert_ads_vi_code_settings_iab_category_parent').css('border-color', '#dddddd');
947
+ jQuery('#insert_ads_vi_code_settings_iab_category_child').css('border-color', '#dddddd');
948
+ jQuery('#insert_ads_vi_code_settings_language').css('border-color', '#dddddd');
949
+ jQuery('#insert_ads_vi_code_settings_keywords').css('border-color', '#dddddd');
950
+ var insert_ads_vi_customize_adcode_keywords_error = false;
951
+ var insert_ads_vi_customize_adcode_required_error = false;
952
+ if(jQuery('#insert_ads_vi_code_settings_ad_unit_type').val() == 'select') {
953
+ jQuery('#insert_ads_vi_code_settings_ad_unit_type').css('border-color', '#ff0000');
954
+ insert_ads_vi_customize_adcode_required_error = true;
955
+ }
956
+ if(jQuery('#insert_ads_vi_code_settings_iab_category_parent').val() == 'select') {
957
+ jQuery('#insert_ads_vi_code_settings_iab_category_parent').css('border-color', '#ff0000');
958
+ insert_ads_vi_customize_adcode_required_error = true;
959
+ }
960
+ if(jQuery('#insert_ads_vi_code_settings_iab_category_child').val() == 'select') {
961
+ jQuery('#insert_ads_vi_code_settings_iab_category_child').css('border-color', '#ff0000');
962
+ insert_ads_vi_customize_adcode_required_error = true;
963
+ }
964
+ if(jQuery('#insert_ads_vi_code_settings_language').val() == 'select') {
965
+ jQuery('#insert_ads_vi_code_settings_language').css('border-color', '#ff0000');
966
+ insert_ads_vi_customize_adcode_required_error = true;
967
+ }
968
+ if(jQuery('#insert_ads_vi_code_settings_keywords').val() != '') {
969
+ if(jQuery('#insert_ads_vi_code_settings_keywords').val().length > 200) {
970
+ jQuery('#insert_ads_vi_code_settings_keywords').css('border-color', '#ff0000');
971
+ insert_ads_vi_customize_adcode_keywords_error = true;
972
+ }
973
+ if(jQuery(jQuery('#insert_ads_vi_code_settings_keywords').val().match(/./g)).not(jQuery('#insert_ads_vi_code_settings_keywords').val().match(keywordsRegex)).get().length != 0) {
974
+ jQuery('#insert_ads_vi_code_settings_keywords').css('border-color', '#ff0000');
975
+ insert_ads_vi_customize_adcode_keywords_error = true;
976
+ }
977
+ }
978
+ if(insert_ads_vi_customize_adcode_keywords_error && insert_ads_vi_customize_adcode_required_error) {
979
+ jQuery('#insert_ads_vi_customize_adcode_keywords_required_error').show();
980
+ } else if(insert_ads_vi_customize_adcode_keywords_error) {
981
+ jQuery('#insert_ads_vi_customize_adcode_keywords_error').show();
982
+ } else if(insert_ads_vi_customize_adcode_required_error) {
983
+ jQuery('#insert_ads_vi_customize_adcode_required_error').show();
984
+ } else {}
985
+ }
986
+ });
987
+ },
988
+ function() { },
989
+ function() { }
990
+ );
991
+ }
992
+
993
+ function insert_ads_vi_code_iab_category_parent_change() {
994
+ jQuery('#insert_ads_vi_code_settings_iab_category_parent').change(function() {
995
+ var insert_ads_vi_code_iab_category = jQuery(this).val();
996
+ jQuery('#insert_ads_vi_code_settings_iab_category_child option').prop('disabled', true).hide();
997
+ jQuery('#insert_ads_vi_code_settings_iab_category_child option').each(function() {
998
+ if((jQuery(this).attr('data-parent') == insert_ads_vi_code_iab_category) || (jQuery(this).val() == 'select')) {
999
+ jQuery(this).prop('disabled', false).show();
1000
+ }
1001
+ });
1002
+ if(jQuery('#insert_ads_vi_code_settings_iab_category_child option:selected').prop('disabled') != false) {
1003
+ jQuery('#insert_ads_vi_code_settings_iab_category_child').val('select');
1004
+ }
1005
+ });
1006
+ jQuery('#insert_ads_vi_code_settings_iab_category_parent').change();
1007
+ }
1008
+
1009
+ function insert_ads_vi_logout_handler() {
1010
+ jQuery('#insert_ads_vi_logout').click(function() {
1011
+ jQuery.post(
1012
+ jQuery('#insert_ads_admin_ajax').val(), {
1013
+ 'action': 'insert_ads_vi_logout_action',
1014
+ 'insert_ads_nonce': jQuery('#insert_ads_nonce').val(),
1015
+ }, function(response) {
1016
+ if(response.indexOf('###SUCCESS###') !== -1) {
1017
+ jQuery('.vi-card').html(response.replace('###SUCCESS###', ''));
1018
+ insert_ads_vi_signup_handler();
1019
+ insert_ads_vi_login_handler();
1020
+ jQuery(window).resize();
1021
+ }
1022
+ jQuery('.vi-card .plugin-card-bottom, .vi-card .plugin-card-top-content').animate({'opacity': 1}, 1000);
1023
+ }
1024
+ );
1025
+ jQuery('.vi-card .plugin-card-bottom, .vi-card .plugin-card-top-content').animate({'opacity': 0}, 1000);
1026
+
1027
+ });
1028
+ }
1029
+
1030
+ function insert_ads_vi_chart_draw() {
1031
+ if(jQuery('#insert_ads_vi_earnings_wrapper').length) {
1032
+ jQuery.post(
1033
+ jQuery('#insert_ads_admin_ajax').val(), {
1034
+ 'action': 'insert_ads_vi_get_chart',
1035
+ 'insert_ads_nonce': jQuery('#insert_ads_nonce').val(),
1036
+ }, function(response) {
1037
+ if(response.indexOf('###SUCCESS###') !== -1) {
1038
+ jQuery('#insert_ads_vi_earnings_wrapper').html(response.replace('###SUCCESS###', ''));
1039
+ if(jQuery('#insert_ads_vi_chart_data').length) {
1040
+ var ctx = document.getElementById("myChart");
1041
+ var insert_ads_vi_chart = new Chart(jQuery('#insert_ads_vi_chart'), {
1042
+ type: 'line',
1043
+ data: {
1044
+ datasets: [{
1045
+ data: JSON.parse(jQuery('#insert_ads_vi_chart_data').val()),
1046
+ backgroundColor: '#EDF5FB',
1047
+ borderColor: '#186EAE',/*E8EBEF*/
1048
+ borderWidth: 1
1049
+ }]
1050
+ },
1051
+ options: {
1052
+ title: {
1053
+ display: false,
1054
+ backgroundColor: '#EDF5FB'
1055
+ },
1056
+ legend: {
1057
+ display: false,
1058
+ },
1059
+ scales: {
1060
+ xAxes: [{
1061
+ type: "time",
1062
+ display: true,
1063
+ scaleLabel: {
1064
+ display: false
1065
+ },
1066
+ gridLines: {
1067
+ display: false,
1068
+ drawTicks: false
1069
+ },
1070
+ ticks: {
1071
+ display: false
1072
+ }
1073
+ }],
1074
+ yAxes: [{
1075
+ display: true,
1076
+ scaleLabel: {
1077
+ display: false
1078
+ },
1079
+ gridLines: {
1080
+ display: true,
1081
+ drawTicks: false
1082
+ },
1083
+ ticks: {
1084
+ display: false
1085
+ }
1086
+ }]
1087
+ },
1088
+ tooltips: {
1089
+ displayColors: false,
1090
+ callbacks: {
1091
+ label: function(tooltipItem, data) {
1092
+ return '$ '+parseFloat(tooltipItem.yLabel).toFixed(2);
1093
+ },
1094
+ title: function(tooltipItem, data) {
1095
+ var monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
1096
+ var dateParts = tooltipItem[0].xLabel.split('/');
1097
+ var date = new Date(dateParts[2], dateParts[0]-1, dateParts[1]);
1098
+ return monthNames[date.getMonth()]+' '+date.getDate();
1099
+ }
1100
+ }
1101
+ }
1102
+ }
1103
+ });
1104
+ }
1105
+ } else {
1106
+ jQuery('#insert_ads_vi_earnings_wrapper').parent().html(response);
1107
+ }
1108
+ jQuery(window).resize();
1109
+ }
1110
+ );
1111
+ }
1112
+ }
1113
+ jQuery(document).ready(function() {
1114
+ jQuery('.insert_ads_notice').on('click', '.notice-dismiss', function() {
1115
+ jQuery.post(
1116
+ jQuery('#insert_ads_admin_notice_ajax').val(), {
1117
+ 'action': 'insert_ads_admin_notice_dismiss',
1118
+ 'insert_ads_admin_notice_nonce': jQuery('#insert_ads_admin_notice_nonce').val(),
1119
+ }, function(response) { }
1120
+ );
1121
+ });
1122
+ });
js/controls.js ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Begin ipCheckbox */
2
+ (function($){
3
+ $.fn.extend({
4
+ ipCheckbox: function () {
5
+ $(this).each(function (){
6
+ var sourceCheckbox = $(this);
7
+ var ipcheckbox = jQuery("<div>",{class: 'ipcheckbox'}).append(jQuery("<div>",{class: 'handle'}));
8
+ if(sourceCheckbox.is(":checked")){ ipcheckbox.addClass("checked"); }
9
+ sourceCheckbox.hide().after(ipcheckbox);
10
+ ipcheckbox.click(function (){
11
+ ipcheckbox.toggleClass("checked");
12
+ if (ipcheckbox.hasClass("checked")){
13
+ sourceCheckbox.prop('checked', true);
14
+ }else{
15
+ sourceCheckbox.prop('checked', false);
16
+ }
17
+ });
18
+ });
19
+ }
20
+ });
21
+ })(jQuery);
22
+ /* End ipCheckbox */
23
+
24
+ /* Begin Chosen Selectbox */
25
+ /*! Chosen v1.8.2 | (c) 2011-2017 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */
26
+ (function(){var t,e,s,i,n=function(t,e){return function(){return t.apply(e,arguments)}},r=function(t,e){function s(){this.constructor=t}for(var i in e)o.call(e,i)&&(t[i]=e[i]);return s.prototype=e.prototype,t.prototype=new s,t.__super__=e.prototype,t},o={}.hasOwnProperty;(i=function(){function t(){this.options_index=0,this.parsed=[]}return t.prototype.add_node=function(t){return"OPTGROUP"===t.nodeName.toUpperCase()?this.add_group(t):this.add_option(t)},t.prototype.add_group=function(t){var e,s,i,n,r,o;for(e=this.parsed.length,this.parsed.push({array_index:e,group:!0,label:t.label,title:t.title?t.title:void 0,children:0,disabled:t.disabled,classes:t.className}),o=[],s=0,i=(r=t.childNodes).length;s<i;s++)n=r[s],o.push(this.add_option(n,e,t.disabled));return o},t.prototype.add_option=function(t,e,s){if("OPTION"===t.nodeName.toUpperCase())return""!==t.text?(null!=e&&(this.parsed[e].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:t.value,text:t.text,html:t.innerHTML,title:t.title?t.title:void 0,selected:t.selected,disabled:!0===s?s:t.disabled,group_array_index:e,group_label:null!=e?this.parsed[e].label:null,classes:t.className,style:t.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1},t}()).select_to_array=function(t){var e,s,n,r,o;for(r=new i,s=0,n=(o=t.childNodes).length;s<n;s++)e=o[s],r.add_node(e);return r.parsed},e=function(){function t(e,s){this.form_field=e,this.options=null!=s?s:{},this.label_click_handler=n(this.label_click_handler,this),t.browser_is_supported()&&(this.is_multiple=this.form_field.multiple,this.set_default_text(),this.set_default_values(),this.setup(),this.set_up_html(),this.register_observers(),this.on_ready())}return t.prototype.set_default_values=function(){return this.click_test_action=function(t){return function(e){return t.test_active_click(e)}}(this),this.activate_action=function(t){return function(e){return t.activate_field(e)}}(this),this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.is_rtl=this.options.rtl||/\bchosen-rtl\b/.test(this.form_field.className),this.allow_single_deselect=null!=this.options.allow_single_deselect&&null!=this.form_field.options[0]&&""===this.form_field.options[0].text&&this.options.allow_single_deselect,this.disable_search_threshold=this.options.disable_search_threshold||0,this.disable_search=this.options.disable_search||!1,this.enable_split_word_search=null==this.options.enable_split_word_search||this.options.enable_split_word_search,this.group_search=null==this.options.group_search||this.options.group_search,this.search_contains=this.options.search_contains||!1,this.single_backstroke_delete=null==this.options.single_backstroke_delete||this.options.single_backstroke_delete,this.max_selected_options=this.options.max_selected_options||Infinity,this.inherit_select_classes=this.options.inherit_select_classes||!1,this.display_selected_options=null==this.options.display_selected_options||this.options.display_selected_options,this.display_disabled_options=null==this.options.display_disabled_options||this.options.display_disabled_options,this.include_group_label_in_selected=this.options.include_group_label_in_selected||!1,this.max_shown_results=this.options.max_shown_results||Number.POSITIVE_INFINITY,this.case_sensitive_search=this.options.case_sensitive_search||!1,this.hide_results_on_select=null==this.options.hide_results_on_select||this.options.hide_results_on_select},t.prototype.set_default_text=function(){return this.form_field.getAttribute("data-placeholder")?this.default_text=this.form_field.getAttribute("data-placeholder"):this.is_multiple?this.default_text=this.options.placeholder_text_multiple||this.options.placeholder_text||t.default_multiple_text:this.default_text=this.options.placeholder_text_single||this.options.placeholder_text||t.default_single_text,this.default_text=this.escape_html(this.default_text),this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||t.default_no_result_text},t.prototype.choice_label=function(t){return this.include_group_label_in_selected&&null!=t.group_label?"<b class='group-name'>"+t.group_label+"</b>"+t.html:t.html},t.prototype.mouse_enter=function(){return this.mouse_on_container=!0},t.prototype.mouse_leave=function(){return this.mouse_on_container=!1},t.prototype.input_focus=function(t){if(this.is_multiple){if(!this.active_field)return setTimeout(function(t){return function(){return t.container_mousedown()}}(this),50)}else if(!this.active_field)return this.activate_field()},t.prototype.input_blur=function(t){if(!this.mouse_on_container)return this.active_field=!1,setTimeout(function(t){return function(){return t.blur_test()}}(this),100)},t.prototype.label_click_handler=function(t){return this.is_multiple?this.container_mousedown(t):this.activate_field()},t.prototype.results_option_build=function(t){var e,s,i,n,r,o,h;for(e="",h=0,n=0,r=(o=this.results_data).length;n<r&&(s=o[n],i="",""!==(i=s.group?this.result_add_group(s):this.result_add_option(s))&&(h++,e+=i),(null!=t?t.first:void 0)&&(s.selected&&this.is_multiple?this.choice_build(s):s.selected&&!this.is_multiple&&this.single_set_selected_text(this.choice_label(s))),!(h>=this.max_shown_results));n++);return e},t.prototype.result_add_option=function(t){var e,s;return t.search_match&&this.include_option_in_results(t)?(e=[],t.disabled||t.selected&&this.is_multiple||e.push("active-result"),!t.disabled||t.selected&&this.is_multiple||e.push("disabled-result"),t.selected&&e.push("result-selected"),null!=t.group_array_index&&e.push("group-option"),""!==t.classes&&e.push(t.classes),s=document.createElement("li"),s.className=e.join(" "),s.style.cssText=t.style,s.setAttribute("data-option-array-index",t.array_index),s.innerHTML=t.highlighted_html||t.html,t.title&&(s.title=t.title),this.outerHTML(s)):""},t.prototype.result_add_group=function(t){var e,s;return(t.search_match||t.group_match)&&t.active_options>0?((e=[]).push("group-result"),t.classes&&e.push(t.classes),s=document.createElement("li"),s.className=e.join(" "),s.innerHTML=t.highlighted_html||this.escape_html(t.label),t.title&&(s.title=t.title),this.outerHTML(s)):""},t.prototype.results_update_field=function(){if(this.set_default_text(),this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.results_build(),this.results_showing)return this.winnow_results()},t.prototype.reset_single_select_options=function(){var t,e,s,i,n;for(n=[],t=0,e=(s=this.results_data).length;t<e;t++)(i=s[t]).selected?n.push(i.selected=!1):n.push(void 0);return n},t.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},t.prototype.results_search=function(t){return this.results_showing?this.winnow_results():this.results_show()},t.prototype.winnow_results=function(){var t,e,s,i,n,r,o,h,l,c,_,a,u,d,p;for(this.no_results_clear(),c=0,t=(o=this.get_search_text()).replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),l=this.get_search_regex(t),s=0,i=(h=this.results_data).length;s<i;s++)(n=h[s]).search_match=!1,_=null,a=null,n.highlighted_html="",this.include_option_in_results(n)&&(n.group&&(n.group_match=!1,n.active_options=0),null!=n.group_array_index&&this.results_data[n.group_array_index]&&(0===(_=this.results_data[n.group_array_index]).active_options&&_.search_match&&(c+=1),_.active_options+=1),p=n.group?n.label:n.text,n.group&&!this.group_search||(a=this.search_string_match(p,l),n.search_match=null!=a,n.search_match&&!n.group&&(c+=1),n.search_match?(o.length&&(u=a.index,r=p.slice(0,u),e=p.slice(u,u+o.length),d=p.slice(u+o.length),n.highlighted_html=this.escape_html(r)+"<em>"+this.escape_html(e)+"</em>"+this.escape_html(d)),null!=_&&(_.group_match=!0)):null!=n.group_array_index&&this.results_data[n.group_array_index].search_match&&(n.search_match=!0)));return this.result_clear_highlight(),c<1&&o.length?(this.update_results_content(""),this.no_results(o)):(this.update_results_content(this.results_option_build()),this.winnow_results_set_highlight())},t.prototype.get_search_regex=function(t){var e,s;return s=this.search_contains?t:"(^|\\s|\\b)"+t+"[^\\s]*",this.enable_split_word_search||this.search_contains||(s="^"+s),e=this.case_sensitive_search?"":"i",new RegExp(s,e)},t.prototype.search_string_match=function(t,e){var s;return s=e.exec(t),!this.search_contains&&(null!=s?s[1]:void 0)&&(s.index+=1),s},t.prototype.choices_count=function(){var t,e,s;if(null!=this.selected_option_count)return this.selected_option_count;for(this.selected_option_count=0,t=0,e=(s=this.form_field.options).length;t<e;t++)s[t].selected&&(this.selected_option_count+=1);return this.selected_option_count},t.prototype.choices_click=function(t){if(t.preventDefault(),this.activate_field(),!this.results_showing&&!this.is_disabled)return this.results_show()},t.prototype.keydown_checker=function(t){var e,s;switch(s=null!=(e=t.which)?e:t.keyCode,this.search_field_scale(),8!==s&&this.pending_backstroke&&this.clear_backstroke(),s){case 8:this.backstroke_length=this.get_search_field_value().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(t),this.mouse_on_container=!1;break;case 13:case 27:this.results_showing&&t.preventDefault();break;case 32:this.disable_search&&t.preventDefault();break;case 38:t.preventDefault(),this.keyup_arrow();break;case 40:t.preventDefault(),this.keydown_arrow()}},t.prototype.keyup_checker=function(t){var e,s;switch(s=null!=(e=t.which)?e:t.keyCode,this.search_field_scale(),s){case 8:this.is_multiple&&this.backstroke_length<1&&this.choices_count()>0?this.keydown_backstroke():this.pending_backstroke||(this.result_clear_highlight(),this.results_search());break;case 13:t.preventDefault(),this.results_showing&&this.result_select(t);break;case 27:this.results_showing&&this.results_hide();break;case 9:case 16:case 17:case 18:case 38:case 40:case 91:break;default:this.results_search()}},t.prototype.clipboard_event_checker=function(t){if(!this.is_disabled)return setTimeout(function(t){return function(){return t.results_search()}}(this),50)},t.prototype.container_width=function(){return null!=this.options.width?this.options.width:this.form_field.offsetWidth+"px"},t.prototype.include_option_in_results=function(t){return!(this.is_multiple&&!this.display_selected_options&&t.selected)&&(!(!this.display_disabled_options&&t.disabled)&&!t.empty)},t.prototype.search_results_touchstart=function(t){return this.touch_started=!0,this.search_results_mouseover(t)},t.prototype.search_results_touchmove=function(t){return this.touch_started=!1,this.search_results_mouseout(t)},t.prototype.search_results_touchend=function(t){if(this.touch_started)return this.search_results_mouseup(t)},t.prototype.outerHTML=function(t){var e;return t.outerHTML?t.outerHTML:((e=document.createElement("div")).appendChild(t),e.innerHTML)},t.prototype.get_single_html=function(){return'<a class="chosen-single chosen-default">\n <span>'+this.default_text+'</span>\n <div><b></b></div>\n</a>\n<div class="chosen-drop">\n <div class="chosen-search">\n <input class="chosen-search-input" type="text" autocomplete="off" />\n </div>\n <ul class="chosen-results"></ul>\n</div>'},t.prototype.get_multi_html=function(){return'<ul class="chosen-choices">\n <li class="search-field">\n <input class="chosen-search-input" type="text" autocomplete="off" value="'+this.default_text+'" />\n </li>\n</ul>\n<div class="chosen-drop">\n <ul class="chosen-results"></ul>\n</div>'},t.prototype.get_no_results_html=function(t){return'<li class="no-results">\n '+this.results_none_found+" <span>"+this.escape_html(t)+"</span>\n</li>"},t.browser_is_supported=function(){return"Microsoft Internet Explorer"===window.navigator.appName?document.documentMode>=8:!(/iP(od|hone)/i.test(window.navigator.userAgent)||/IEMobile/i.test(window.navigator.userAgent)||/Windows Phone/i.test(window.navigator.userAgent)||/BlackBerry/i.test(window.navigator.userAgent)||/BB10/i.test(window.navigator.userAgent)||/Android.*Mobile/i.test(window.navigator.userAgent))},t.default_multiple_text="Select Some Options",t.default_single_text="Select an Option",t.default_no_result_text="No results match",t}(),(t=jQuery).fn.extend({chosen:function(i){return e.browser_is_supported()?this.each(function(e){var n,r;r=(n=t(this)).data("chosen"),"destroy"!==i?r instanceof s||n.data("chosen",new s(this,i)):r instanceof s&&r.destroy()}):this}}),s=function(s){function n(){return n.__super__.constructor.apply(this,arguments)}return r(n,e),n.prototype.setup=function(){return this.form_field_jq=t(this.form_field),this.current_selectedIndex=this.form_field.selectedIndex},n.prototype.set_up_html=function(){var e,s;return(e=["chosen-container"]).push("chosen-container-"+(this.is_multiple?"multi":"single")),this.inherit_select_classes&&this.form_field.className&&e.push(this.form_field.className),this.is_rtl&&e.push("chosen-rtl"),s={"class":e.join(" "),title:this.form_field.title},this.form_field.id.length&&(s.id=this.form_field.id.replace(/[^\w]/g,"_")+"_chosen"),this.container=t("<div />",s),this.container.width(this.container_width()),this.is_multiple?this.container.html(this.get_multi_html()):this.container.html(this.get_single_html()),this.form_field_jq.hide().after(this.container),this.dropdown=this.container.find("div.chosen-drop").first(),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chosen-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chosen-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chosen-search").first(),this.selected_item=this.container.find(".chosen-single").first()),this.results_build(),this.set_tab_index(),this.set_label_behavior()},n.prototype.on_ready=function(){return this.form_field_jq.trigger("chosen:ready",{chosen:this})},n.prototype.register_observers=function(){return this.container.on("touchstart.chosen",function(t){return function(e){t.container_mousedown(e)}}(this)),this.container.on("touchend.chosen",function(t){return function(e){t.container_mouseup(e)}}(this)),this.container.on("mousedown.chosen",function(t){return function(e){t.container_mousedown(e)}}(this)),this.container.on("mouseup.chosen",function(t){return function(e){t.container_mouseup(e)}}(this)),this.container.on("mouseenter.chosen",function(t){return function(e){t.mouse_enter(e)}}(this)),this.container.on("mouseleave.chosen",function(t){return function(e){t.mouse_leave(e)}}(this)),this.search_results.on("mouseup.chosen",function(t){return function(e){t.search_results_mouseup(e)}}(this)),this.search_results.on("mouseover.chosen",function(t){return function(e){t.search_results_mouseover(e)}}(this)),this.search_results.on("mouseout.chosen",function(t){return function(e){t.search_results_mouseout(e)}}(this)),this.search_results.on("mousewheel.chosen DOMMouseScroll.chosen",function(t){return function(e){t.search_results_mousewheel(e)}}(this)),this.search_results.on("touchstart.chosen",function(t){return function(e){t.search_results_touchstart(e)}}(this)),this.search_results.on("touchmove.chosen",function(t){return function(e){t.search_results_touchmove(e)}}(this)),this.search_results.on("touchend.chosen",function(t){return function(e){t.search_results_touchend(e)}}(this)),this.form_field_jq.on("chosen:updated.chosen",function(t){return function(e){t.results_update_field(e)}}(this)),this.form_field_jq.on("chosen:activate.chosen",function(t){return function(e){t.activate_field(e)}}(this)),this.form_field_jq.on("chosen:open.chosen",function(t){return function(e){t.container_mousedown(e)}}(this)),this.form_field_jq.on("chosen:close.chosen",function(t){return function(e){t.close_field(e)}}(this)),this.search_field.on("blur.chosen",function(t){return function(e){t.input_blur(e)}}(this)),this.search_field.on("keyup.chosen",function(t){return function(e){t.keyup_checker(e)}}(this)),this.search_field.on("keydown.chosen",function(t){return function(e){t.keydown_checker(e)}}(this)),this.search_field.on("focus.chosen",function(t){return function(e){t.input_focus(e)}}(this)),this.search_field.on("cut.chosen",function(t){return function(e){t.clipboard_event_checker(e)}}(this)),this.search_field.on("paste.chosen",function(t){return function(e){t.clipboard_event_checker(e)}}(this)),this.is_multiple?this.search_choices.on("click.chosen",function(t){return function(e){t.choices_click(e)}}(this)):this.container.on("click.chosen",function(t){t.preventDefault()})},n.prototype.destroy=function(){return t(this.container[0].ownerDocument).off("click.chosen",this.click_test_action),this.form_field_label.length>0&&this.form_field_label.off("click.chosen"),this.search_field[0].tabIndex&&(this.form_field_jq[0].tabIndex=this.search_field[0].tabIndex),this.container.remove(),this.form_field_jq.removeData("chosen"),this.form_field_jq.show()},n.prototype.search_field_disabled=function(){return this.is_disabled=this.form_field.disabled||this.form_field_jq.parents("fieldset").is(":disabled"),this.container.toggleClass("chosen-disabled",this.is_disabled),this.search_field[0].disabled=this.is_disabled,this.is_multiple||this.selected_item.off("focus.chosen",this.activate_field),this.is_disabled?this.close_field():this.is_multiple?void 0:this.selected_item.on("focus.chosen",this.activate_field)},n.prototype.container_mousedown=function(e){var s;if(!this.is_disabled)return!e||"mousedown"!==(s=e.type)&&"touchstart"!==s||this.results_showing||e.preventDefault(),null!=e&&t(e.target).hasClass("search-choice-close")?void 0:(this.active_field?this.is_multiple||!e||t(e.target)[0]!==this.selected_item[0]&&!t(e.target).parents("a.chosen-single").length||(e.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),t(this.container[0].ownerDocument).on("click.chosen",this.click_test_action),this.results_show()),this.activate_field())},n.prototype.container_mouseup=function(t){if("ABBR"===t.target.nodeName&&!this.is_disabled)return this.results_reset(t)},n.prototype.search_results_mousewheel=function(t){var e;if(t.originalEvent&&(e=t.originalEvent.deltaY||-t.originalEvent.wheelDelta||t.originalEvent.detail),null!=e)return t.preventDefault(),"DOMMouseScroll"===t.type&&(e*=40),this.search_results.scrollTop(e+this.search_results.scrollTop())},n.prototype.blur_test=function(t){if(!this.active_field&&this.container.hasClass("chosen-container-active"))return this.close_field()},n.prototype.close_field=function(){return t(this.container[0].ownerDocument).off("click.chosen",this.click_test_action),this.active_field=!1,this.results_hide(),this.container.removeClass("chosen-container-active"),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale(),this.search_field.blur()},n.prototype.activate_field=function(){if(!this.is_disabled)return this.container.addClass("chosen-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()},n.prototype.test_active_click=function(e){var s;return(s=t(e.target).closest(".chosen-container")).length&&this.container[0]===s[0]?this.active_field=!0:this.close_field()},n.prototype.results_build=function(){return this.parsing=!0,this.selected_option_count=null,this.results_data=i.select_to_array(this.form_field),this.is_multiple?this.search_choices.find("li.search-choice").remove():this.is_multiple||(this.single_set_selected_text(),this.disable_search||this.form_field.options.length<=this.disable_search_threshold?(this.search_field[0].readOnly=!0,this.container.addClass("chosen-container-single-nosearch")):(this.search_field[0].readOnly=!1,this.container.removeClass("chosen-container-single-nosearch"))),this.update_results_content(this.results_option_build({first:!0})),this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.parsing=!1},n.prototype.result_do_highlight=function(t){var e,s,i,n,r;if(t.length){if(this.result_clear_highlight(),this.result_highlight=t,this.result_highlight.addClass("highlighted"),i=parseInt(this.search_results.css("maxHeight"),10),r=this.search_results.scrollTop(),n=i+r,s=this.result_highlight.position().top+this.search_results.scrollTop(),(e=s+this.result_highlight.outerHeight())>=n)return this.search_results.scrollTop(e-i>0?e-i:0);if(s<r)return this.search_results.scrollTop(s)}},n.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClass("highlighted"),this.result_highlight=null},n.prototype.results_show=function(){return this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.container.addClass("chosen-with-drop"),this.results_showing=!0,this.search_field.focus(),this.search_field.val(this.get_search_field_value()),this.winnow_results(),this.form_field_jq.trigger("chosen:showing_dropdown",{chosen:this}))},n.prototype.update_results_content=function(t){return this.search_results.html(t)},n.prototype.results_hide=function(){return this.results_showing&&(this.result_clear_highlight(),this.container.removeClass("chosen-with-drop"),this.form_field_jq.trigger("chosen:hiding_dropdown",{chosen:this})),this.results_showing=!1},n.prototype.set_tab_index=function(t){var e;if(this.form_field.tabIndex)return e=this.form_field.tabIndex,this.form_field.tabIndex=-1,this.search_field[0].tabIndex=e},n.prototype.set_label_behavior=function(){if(this.form_field_label=this.form_field_jq.parents("label"),!this.form_field_label.length&&this.form_field.id.length&&(this.form_field_label=t("label[for='"+this.form_field.id+"']")),this.form_field_label.length>0)return this.form_field_label.on("click.chosen",this.label_click_handler)},n.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices_count()<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},n.prototype.search_results_mouseup=function(e){var s;if((s=t(e.target).hasClass("active-result")?t(e.target):t(e.target).parents(".active-result").first()).length)return this.result_highlight=s,this.result_select(e),this.search_field.focus()},n.prototype.search_results_mouseover=function(e){var s;if(s=t(e.target).hasClass("active-result")?t(e.target):t(e.target).parents(".active-result").first())return this.result_do_highlight(s)},n.prototype.search_results_mouseout=function(e){if(t(e.target).hasClass("active-result")||t(e.target).parents(".active-result").first())return this.result_clear_highlight()},n.prototype.choice_build=function(e){var s,i;return s=t("<li />",{"class":"search-choice"}).html("<span>"+this.choice_label(e)+"</span>"),e.disabled?s.addClass("search-choice-disabled"):((i=t("<a />",{"class":"search-choice-close","data-option-array-index":e.array_index})).on("click.chosen",function(t){return function(e){return t.choice_destroy_link_click(e)}}(this)),s.append(i)),this.search_container.before(s)},n.prototype.choice_destroy_link_click=function(e){if(e.preventDefault(),e.stopPropagation(),!this.is_disabled)return this.choice_destroy(t(e.target))},n.prototype.choice_destroy=function(t){if(this.result_deselect(t[0].getAttribute("data-option-array-index")))return this.active_field?this.search_field.focus():this.show_search_field_default(),this.is_multiple&&this.choices_count()>0&&this.get_search_field_value().length<1&&this.results_hide(),t.parents("li").first().remove(),this.search_field_scale()},n.prototype.results_reset=function(){if(this.reset_single_select_options(),this.form_field.options[0].selected=!0,this.single_set_selected_text(),this.show_search_field_default(),this.results_reset_cleanup(),this.trigger_form_field_change(),this.active_field)return this.results_hide()},n.prototype.results_reset_cleanup=function(){return this.current_selectedIndex=this.form_field.selectedIndex,this.selected_item.find("abbr").remove()},n.prototype.result_select=function(t){var e,s;if(this.result_highlight)return e=this.result_highlight,this.result_clear_highlight(),this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.is_multiple?e.removeClass("active-result"):this.reset_single_select_options(),e.addClass("result-selected"),s=this.results_data[e[0].getAttribute("data-option-array-index")],s.selected=!0,this.form_field.options[s.options_index].selected=!0,this.selected_option_count=null,this.search_field.val(""),this.is_multiple?this.choice_build(s):this.single_set_selected_text(this.choice_label(s)),this.is_multiple&&(!this.hide_results_on_select||t.metaKey||t.ctrlKey)?this.winnow_results():(this.results_hide(),this.show_search_field_default()),(this.is_multiple||this.form_field.selectedIndex!==this.current_selectedIndex)&&this.trigger_form_field_change({selected:this.form_field.options[s.options_index].value}),this.current_selectedIndex=this.form_field.selectedIndex,t.preventDefault(),this.search_field_scale())},n.prototype.single_set_selected_text=function(t){return null==t&&(t=this.default_text),t===this.default_text?this.selected_item.addClass("chosen-default"):(this.single_deselect_control_build(),this.selected_item.removeClass("chosen-default")),this.selected_item.find("span").html(t)},n.prototype.result_deselect=function(t){var e;return e=this.results_data[t],!this.form_field.options[e.options_index].disabled&&(e.selected=!1,this.form_field.options[e.options_index].selected=!1,this.selected_option_count=null,this.result_clear_highlight(),this.results_showing&&this.winnow_results(),this.trigger_form_field_change({deselected:this.form_field.options[e.options_index].value}),this.search_field_scale(),!0)},n.prototype.single_deselect_control_build=function(){if(this.allow_single_deselect)return this.selected_item.find("abbr").length||this.selected_item.find("span").first().after('<abbr class="search-choice-close"></abbr>'),this.selected_item.addClass("chosen-single-with-deselect")},n.prototype.get_search_field_value=function(){return this.search_field.val()},n.prototype.get_search_text=function(){return t.trim(this.get_search_field_value())},n.prototype.escape_html=function(e){return t("<div/>").text(e).html()},n.prototype.winnow_results_set_highlight=function(){var t,e;if(e=this.is_multiple?[]:this.search_results.find(".result-selected.active-result"),null!=(t=e.length?e.first():this.search_results.find(".active-result").first()))return this.result_do_highlight(t)},n.prototype.no_results=function(t){var e;return e=this.get_no_results_html(t),this.search_results.append(e),this.form_field_jq.trigger("chosen:no_results",{chosen:this})},n.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},n.prototype.keydown_arrow=function(){var t;return this.results_showing&&this.result_highlight?(t=this.result_highlight.nextAll("li.active-result").first())?this.result_do_highlight(t):void 0:this.results_show()},n.prototype.keyup_arrow=function(){var t;return this.results_showing||this.is_multiple?this.result_highlight?(t=this.result_highlight.prevAll("li.active-result")).length?this.result_do_highlight(t.first()):(this.choices_count()>0&&this.results_hide(),this.result_clear_highlight()):void 0:this.results_show()},n.prototype.keydown_backstroke=function(){var t;return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke()):(t=this.search_container.siblings("li.search-choice").last()).length&&!t.hasClass("search-choice-disabled")?(this.pending_backstroke=t,this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClass("search-choice-focus")):void 0},n.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},n.prototype.search_field_scale=function(){var e,s,i,n,r,o,h;if(this.is_multiple){for(r={position:"absolute",left:"-1000px",top:"-1000px",display:"none",whiteSpace:"pre"},s=0,i=(o=["fontSize","fontStyle","fontWeight","fontFamily","lineHeight","textTransform","letterSpacing"]).length;s<i;s++)r[n=o[s]]=this.search_field.css(n);return(e=t("<div />").css(r)).text(this.get_search_field_value()),t("body").append(e),h=e.width()+25,e.remove(),this.container.is(":visible")&&(h=Math.min(this.container.outerWidth()-10,h)),this.search_field.width(h)}},n.prototype.trigger_form_field_change=function(t){return this.form_field_jq.trigger("input",t),this.form_field_jq.trigger("change",t)},n}()}).call(this);
27
+ /* End Chosen Selectbox */
28
+
29
+ /* Begin jQuery TE */
30
+ /*!
31
+ *
32
+ * jQuery TE 1.4.0 , http://jqueryte.com/
33
+ * Copyright (C) 2013, Fatih Koca (fattih@fattih.com), (http://jqueryte.com/about)
34
+
35
+ * jQuery TE is provided under the MIT LICENSE.
36
+ *
37
+ */
38
+ (function(e){e.fn.jqte=function(t){function l(e,t,n,r,i){var s=f.length+1;return f.push({name:e,cls:s,command:t,key:n,tag:r,emphasis:i})}var n=[{title:"Text Format"},{title:"Font Size"},{title:"Color"},{title:"Bold",hotkey:"B"},{title:"Italic",hotkey:"I"},{title:"Underline",hotkey:"U"},{title:"Ordered List",hotkey:"."},{title:"Unordered List",hotkey:","},{title:"Subscript",hotkey:"down arrow"},{title:"Superscript",hotkey:"up arrow"},{title:"Outdent",hotkey:"left arrow"},{title:"Indent",hotkey:"right arrow"},{title:"Justify Left"},{title:"Justify Center"},{title:"Justify Right"},{title:"Strike Through",hotkey:"K"},{title:"Add Link",hotkey:"L"},{title:"Remove Link"},{title:"Cleaner Style",hotkey:"Delete"},{title:"Horizontal Rule",hotkey:"H"},{title:"Source"}];var r=[["p","Normal"],["h1","Header 1"],["h2","Header 2"],["h3","Header 3"],["h4","Header 4"],["h5","Header 5"],["h6","Header 6"],["pre","Preformatted"]];var i=["10","12","16","18","20","24","28"];var s=["0,0,0","68,68,68","102,102,102","153,153,153","204,204,204","238,238,238","243,243,243","255,255,255",null,"255,0,0","255,153,0","255,255,0","0,255,0","0,255,255","0,0,255","153,0,255","255,0,255",null,"244,204,204","252,229,205","255,242,204","217,234,211","208,224,227","207,226,243","217,210,233","234,209,220","234,153,153","249,203,156","255,229,153","182,215,168","162,196,201","159,197,232","180,167,214","213,166,189","224,102,102","246,178,107","255,217,102","147,196,125","118,165,175","111,168,220","142,124,195","194,123,160","204,0,0","230,145,56","241,194,50","106,168,79","69,129,142","61,133,198","103,78,167","166,77,121","153,0,0","180,95,6","191,144,0","56,118,29","19,79,92","11,83,148","53,28,117","116,27,71","102,0,0","120,63,4","127,96,0","39,78,19","12,52,61","7,55,99","32,18,77","76,17,48"];var o=["Web Address","E-mail Address","Picture URL"];var u=e.extend({status:true,css:"jqte",title:true,titletext:n,button:"OK",format:true,formats:r,fsize:true,fsizes:i,funit:"px",color:true,linktypes:o,b:true,i:true,u:true,ol:true,ul:true,sub:true,sup:true,outdent:true,indent:true,left:true,center:true,right:true,strike:true,link:true,unlink:true,remove:true,rule:true,source:true,placeholder:false,br:true,p:true,change:"",focus:"",blur:""},t);e.fn.jqteVal=function(t){e(this).closest("."+u.css).find("."+u.css+"_editor").html(t)};var a=navigator.userAgent.toLowerCase();if(/msie [1-7]./.test(a))u.title=false;var f=[];l("format","formats","","",false);l("fsize","fSize","","",false);l("color","colors","","",false);l("b","Bold","B",["b","strong"],true);l("i","Italic","I",["i","em"],true);l("u","Underline","U",["u"],true);l("ol","insertorderedlist","¾",["ol"],true);l("ul","insertunorderedlist","¼",["ul"],true);l("sub","subscript","(",["sub"],true);l("sup","superscript","&",["sup"],true);l("outdent","outdent","%",["blockquote"],false);l("indent","indent","'",["blockquote"],true);l("left","justifyLeft","","",false);l("center","justifyCenter","","",false);l("right","justifyRight","","",false);l("strike","strikeThrough","K",["strike"],true);l("link","linkcreator","L",["a"],true);l("unlink","unlink","",["a"],false);l("remove","removeformat",".","",false);l("rule","inserthorizontalrule","H",["hr"],false);l("source","displaysource","","",false);return this.each(function(){function B(){if(window.getSelection)return window.getSelection();else if(document.selection&&document.selection.createRange&&document.selection.type!="None")return document.selection.createRange()}function j(e,t){var n,r=B();if(window.getSelection){if(r.anchorNode&&r.getRangeAt)n=r.getRangeAt(0);if(n){r.removeAllRanges();r.addRange(n)}if(!a.match(/msie/))document.execCommand("StyleWithCSS",false,false);document.execCommand(e,false,t)}else if(document.selection&&document.selection.createRange&&document.selection.type!="None"){n=document.selection.createRange();n.execCommand(e,false,t)}q(false,false)}function F(t,n,r){if(v.not(":focus"))v.focus();if(window.getSelection){var i=B(),s,o,u;if(i.anchorNode&&i.getRangeAt){s=i.getRangeAt(0);o=document.createElement(t);e(o).attr(n,r);u=s.extractContents();o.appendChild(u);s.insertNode(o);i.removeAllRanges();if(n=="style")q(e(o),r);else q(e(o),false)}}else if(document.selection&&document.selection.createRange&&document.selection.type!="None"){var a=document.selection.createRange();var f=a.htmlText;var l="<"+t+" "+n+'="'+r+'">'+f+"</"+t+">";document.selection.createRange().pasteHTML(l)}}function q(e,t){var n=I();n=n?n:e;if(n&&t==false){if(n.parent().is("[style]"))n.attr("style",n.parent().attr("style"));if(n.is("[style]"))n.find("*").attr("style",n.attr("style"))}else if(e&&t&&e.is("[style]")){var r=t.split(";");r=r[0].split(":");if(e.is("[style*="+r[0]+"]"))e.find("*").css(r[0],r[1]);R(e)}}function R(t){if(t){var t=t[0];if(document.body.createTextRange){var n=document.body.createTextRange();n.moveToElementText(t);n.select()}else if(window.getSelection){var r=window.getSelection();var n=document.createRange();if(t!="undefined"&&t!=null){n.selectNodeContents(t);r.removeAllRanges();r.addRange(n);if(e(t).is(":empty")){e(t).append(" ");R(e(t))}}}}}function U(){if(!p.data("sourceOpened")){var t=I();var n="http://";W(true);if(t){var r=t.prop("tagName").toLowerCase();if(r=="a"&&t.is("[href]")){n=t.attr("href");t.attr(S,"")}else F("a",S,"")}else y.val(n).focus();g.click(function(t){if(e(t.target).hasClass(u.css+"_linktypetext")||e(t.target).hasClass(u.css+"_linktypearrow"))X(true)});w.find("a").click(function(){var t=e(this).attr(u.css+"-linktype");w.data("linktype",t);E.find("."+u.css+"_linktypetext").html(w.find("a:eq("+w.data("linktype")+")").text());V(n);X()});V(n);y.focus().val(n).bind("keypress keyup",function(e){if(e.keyCode==13){z(h.find("["+S+"]"));return false}});b.click(function(){z(h.find("["+S+"]"))})}else W(false)}function z(t){y.focus();R(t);t.removeAttr(S);if(w.data("linktype")!="2")j("createlink",y.val());else{j("insertImage",y.val());v.find("img").each(function(){var t=e(this).prev("a");var n=e(this).next("a");if(t.length>0&&t.html()=="")t.remove();else if(n.length>0&&n.html()=="")n.remove()})}W();v.trigger("change")}function W(e){Q("["+S+"]:not([href])");h.find("["+S+"][href]").removeAttr(S);if(e){p.data("linkOpened",true);d.show()}else{p.data("linkOpened",false);d.hide()}X()}function X(e){if(e)w.show();else w.hide()}function V(e){var t=w.data("linktype");if(t=="1"&&(y.val()=="http://"||y.is("[value^=http://]")||!y.is("[value^=mailto]")))y.val("mailto:");else if(t!="1"&&!y.is("[value^=http://]"))y.val("http://");else y.val(e)}function J(t){if(!p.data("sourceOpened")){if(t=="fSize")styleField=P;else if(t=="colors")styleField=H;K(styleField,true);styleField.find("a").unbind("click").click(function(){var n=e(this).attr(u.css+"-styleval");if(t=="fSize"){styleType="font-size";n=n+u.funit}else if(t=="colors"){styleType="color";n="rgb("+n+")"}var r=G(styleType);F("span","style",styleType+":"+n+";"+r);K("",false);e("."+u.css+"_title").remove();v.trigger("change")})}else K(styleField,false);W(false)}function K(e,t){var n="",r=[{d:"fsizeOpened",f:P},{d:"cpallOpened",f:H}];if(e!=""){for(var i=0;i<r.length;i++){if(e==r[i]["f"])n=r[i]}}if(t){p.data(n["d"],true);n["f"].slideDown(100);for(var i=0;i<r.length;i++){if(n["d"]!=r[i]["d"]){p.data(r[i]["d"],false);r[i]["f"].slideUp(100)}}}else{for(var i=0;i<r.length;i++){p.data(r[i]["d"],false);r[i]["f"].slideUp(100)}}}function Q(t){h.find(t).each(function(){e(this).before(e(this).html()).remove()})}function G(e){var t=I();if(t&&t.is("[style]")&&t.css(e)!=""){var n=t.css(e);t.css(e,"");var r=t.attr("style");t.css(e,n);return r}else return""}function Y(){Z(true);D.find("a").click(function(){e("*",this).click(function(e){e.preventDefault();return false});et(e(this).text());var t=e(this).attr(u.css+"-formatval");j("formatBlock","<"+t+">");Z(false)})}function Z(e){var t=e?true:false;t=e&&D.data("status")?true:false;if(t||!e)D.data("status",false).slideUp(200);else D.data("status",true).slideDown(200)}function et(e){var t=D.closest("."+u.css+"_tool").find("."+u.css+"_tool_label").find("."+u.css+"_tool_text");if(e.length>10)e=e.substr(0,7)+"...";t.html(e)}function tt(e){var t,n,r;t=e.replace(/\n/gim,"").replace(/\r/gim,"").replace(/\t/gim,"").replace(/ /gim," ");n=[/\<span(|\s+.*?)><span(|\s+.*?)>(.*?)<\/span><\/span>/gim,/<(\w*[^p])\s*[^\/>]*>\s*<\/\1>/gim,/\<div(|\s+.*?)>(.*?)\<\/div>/gim,/\<strong(|\s+.*?)>(.*?)\<\/strong>/gim,/\<em(|\s+.*?)>(.*?)\<\/em>/gim];r=["<span$2>$3</span>","","<p$1>$2</p>","<b$1>$2</b>","<i$1>$2</i>"];for(A=0;A<5;A++){for(var i=0;i<n.length;i++){t=t.replace(n[i],r[i])}}if(!u.p)t=t.replace(/\<p(|\s+.*?)>(.*?)\<\/p>/ig,"<br/>$2");if(!u.br){n=[/\<br>(.*?)/ig,/\<br\/>(.*?)/ig];r=["<p>$1</p>","<p>$1</p>"];for(var i=0;i<n.length;i++){t=t.replace(n[i],r[i])}}if(!u.p&&!u.br)t=t.replace(/\<p>(.*?)\<\/p>/ig,"<div>$1</div>");return t}function nt(){var e=v.text()==""&&v.html().length<12?"":v.html();l.val(tt(e))}function rt(){v.html(tt(l.val()))}function it(t){var n=false,r=I(),i;if(r){e.each(t,function(t,s){i=r.prop("tagName").toLowerCase();if(i==s)n=true;else{r.parents().each(function(){i=e(this).prop("tagName").toLowerCase();if(i==s)n=true})}});return n}else return false}function st(t){for(var n=0;n<f.length;n++){if(u[f[n].name]&&f[n].emphasis&&f[n].tag!="")it(f[n].tag)?p.find("."+u.css+"_tool_"+f[n].cls).addClass(m):e("."+u.css+"_tool_"+f[n].cls).removeClass(m)}if(u.format&&e.isArray(u.formats)){var r=false;for(var i=0;i<u.formats.length;i++){var s=[];s[0]=u.formats[i][0];if(u.formats[i][0].length>0&&it(s)){et(u.formats[i][1]);r=true;break}}if(!r)et(u.formats[0][1])}K("",false);Z(false)}if(!e(this).data("jqte")||e(this).data("jqte")==null||e(this).data("jqte")=="undefined")e(this).data("jqte",true);else e(this).data("jqte",false);if(!u.status||!e(this).data("jqte")){if(e(this).closest("."+u.css).length>0){var t=e(this).closest("."+u.css).find("."+u.css+"_editor").html();var n="";e(e(this)[0].attributes).each(function(){if(this.nodeName!="style")n=n+" "+this.nodeName+'="'+this.nodeValue+'"'});var r=e(this).is("[data-origin]")&&e(this).attr("data-origin")!=""?e(this).attr("data-origin"):"textarea";var i=">"+t;if(r=="input"||r=="option"){t=t.replace(/"/g,"&#34;").replace(/'/g,"&#39;").replace(/</g,"<").replace(/>/g,">");i='value="'+t+'">'}var o=e(this).clone();e(this).data("jqte",false).closest("."+u.css).before(o).remove();o.replaceWith("<"+r+n+i+"</"+r+">")}return}var l=e(this);var r=e(this).prop("tagName").toLowerCase();e(this).attr("data-origin",r);var c=e(this).is("[value]")||r=="textarea"?e(this).val():e(this).html();c=c.replace(/&#34;/g,'"').replace(/&#39;/g,"'").replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");e(this).after('<div class="'+u.css+'"></div>');var h=e(this).next("."+u.css);h.html('<div class="'+u.css+"_toolbar"+'" role="toolbar" unselectable></div><div class="'+u.css+'_linkform" style="display:none" role="dialog"></div><div class="'+u.css+"_editor"+'"></div>');var p=h.find("."+u.css+"_toolbar");var d=h.find("."+u.css+"_linkform");var v=h.find("."+u.css+"_editor");var m=u.css+"_tool_depressed";d.append('<div class="'+u.css+'_linktypeselect" unselectable></div><input class="'+u.css+'_linkinput" type="text/css" value=""><div class="'+u.css+'_linkbutton" unselectable>'+u.button+'</div> <div style="height:1px;float:none;clear:both"></div>');var g=d.find("."+u.css+"_linktypeselect");var y=d.find("."+u.css+"_linkinput");var b=d.find("."+u.css+"_linkbutton");g.append('<div class="'+u.css+'_linktypeview" unselectable></div><div class="'+u.css+'_linktypes" role="menu" unselectable></div>');var w=g.find("."+u.css+"_linktypes");var E=g.find("."+u.css+"_linktypeview");var S=u.css+"-setlink";v.after('<div class="'+u.css+"_source "+u.css+'_hiddenField"></div>');var x=h.find("."+u.css+"_source");l.appendTo(x);if(r!="textarea"){var n="";e(l[0].attributes).each(function(){if(this.nodeName!="type"&&this.nodeName!="value")n=n+" "+this.nodeName+'="'+this.nodeValue+'"'});l.replaceWith("<textarea "+n+">"+c+"</textarea>");l=x.find("textarea")}v.attr("contenteditable","true").html(c);for(var T=0;T<f.length;T++){if(u[f[T].name]){var N=f[T].key.length>0?u.titletext[T].hotkey!=null&&u.titletext[T].hotkey!="undefined"&&u.titletext[T].hotkey!=""?" (Ctrl+"+u.titletext[T].hotkey+")":"":"";var C=u.titletext[T].title!=null&&u.titletext[T].title!="undefined"&&u.titletext[T].title!=""?u.titletext[T].title+N:"";p.append('<div class="'+u.css+"_tool "+u.css+"_tool_"+f[T].cls+'" role="button" data-tool="'+T+'" unselectable><a class="'+u.css+'_tool_icon" unselectable></a></div>');p.find("."+u.css+"_tool[data-tool="+T+"]").data({tag:f[T].tag,command:f[T].command,emphasis:f[T].emphasis,title:C});if(f[T].name=="format"&&e.isArray(u.formats)){var k=u.formats[0][1].length>0&&u.formats[0][1]!="undefined"?u.formats[0][1]:"";p.find("."+u.css+"_tool_"+f[T].cls).find("."+u.css+"_tool_icon").replaceWith('<a class="'+u.css+'_tool_label" unselectable><span class="'+u.css+'_tool_text" unselectable>'+k+'</span><span class="'+u.css+'_tool_icon" unselectable></span></a>');p.find("."+u.css+"_tool_"+f[T].cls).append('<div class="'+u.css+'_formats" unselectable></div>');for(var L=0;L<u.formats.length;L++){p.find("."+u.css+"_formats").append("<a "+u.css+'-formatval="'+u.formats[L][0]+'" class="'+u.css+"_format"+" "+u.css+"_format_"+L+'" role="menuitem" unselectable>'+u.formats[L][1]+"</a>")}p.find("."+u.css+"_formats").data("status",false)}else if(f[T].name=="fsize"&&e.isArray(u.fsizes)){p.find("."+u.css+"_tool_"+f[T].cls).append('<div class="'+u.css+'_fontsizes" unselectable></div>');for(var L=0;L<u.fsizes.length;L++){p.find("."+u.css+"_fontsizes").append("<a "+u.css+'-styleval="'+u.fsizes[L]+'" class="'+u.css+"_fontsize"+'" style="font-size:'+u.fsizes[L]+u.funit+'" role="menuitem" unselectable>Abcdefgh...</a>')}}else if(f[T].name=="color"&&e.isArray(s)){p.find("."+u.css+"_tool_"+f[T].cls).append('<div class="'+u.css+'_cpalette" unselectable></div>');for(var A=0;A<s.length;A++){if(s[A]!=null)p.find("."+u.css+"_cpalette").append("<a "+u.css+'-styleval="'+s[A]+'" class="'+u.css+"_color"+'" style="background-color: rgb('+s[A]+')" role="gridcell" unselectable></a>');else p.find("."+u.css+"_cpalette").append('<div class="'+u.css+"_colorSeperator"+'"></div>')}}}}w.data("linktype","0");for(var T=0;T<3;T++){w.append("<a "+u.css+'-linktype="'+T+'" unselectable>'+u.linktypes[T]+"</a>");E.html('<div class="'+u.css+'_linktypearrow" unselectable></div><div class="'+u.css+'_linktypetext">'+w.find("a:eq("+w.data("linktype")+")").text()+"</div>")}var O="";if(/msie/.test(a))O="-ms-";else if(/chrome/.test(a)||/safari/.test(a)||/yandex/.test(a))O="-webkit-";else if(/mozilla/.test(a))O="-moz-";else if(/opera/.test(a))O="-o-";else if(/konqueror/.test(a))O="-khtml-";else O="";if(u.placeholder&&u.placeholder!=""){h.prepend('<div class="'+u.css+'_placeholder" unselectable><div class="'+u.css+'_placeholder_text">'+u.placeholder+"</div></div>");var M=h.find("."+u.css+"_placeholder");M.click(function(){v.focus()})}h.find("[unselectable]").css(O+"user-select","none").addClass("unselectable").attr("unselectable","on").on("selectstart mousedown",false);var _=p.find("."+u.css+"_tool");var D=p.find("."+u.css+"_formats");var P=p.find("."+u.css+"_fontsizes");var H=p.find("."+u.css+"_cpalette");var I=function(){var t,n;if(window.getSelection){n=getSelection();t=n.anchorNode}if(!t&&document.selection&&document.selection.createRange&&document.selection.type!="None"){n=document.selection;var r=n.getRangeAt?n.getRangeAt(0):n.createRange();t=r.commonAncestorContainer?r.commonAncestorContainer:r.parentElement?r.parentElement():r.item(0)}if(t){return t.nodeName=="#text"?e(t.parentNode):e(t)}else return false};_.unbind("click").click(function(t){if(e(this).data("command")=="displaysource"&&!p.data("sourceOpened")){p.find("."+u.css+"_tool").addClass(u.css+"_hiddenField");e(this).removeClass(u.css+"_hiddenField");p.data("sourceOpened",true);l.css("height",v.outerHeight());x.removeClass(u.css+"_hiddenField");v.addClass(u.css+"_hiddenField");l.focus();W(false);K("",false);Z();if(u.placeholder&&u.placeholder!="")M.hide()}else{if(!p.data("sourceOpened")){if(e(this).data("command")=="linkcreator"){if(!p.data("linkOpened"))U();else{W(false);Z(false)}}else if(e(this).data("command")=="formats"){if(e(this).data("command")=="formats"&&!e(t.target).hasClass(u.css+"_format"))Y();K("",false);if(v.not(":focus"))v.focus()}else if(e(this).data("command")=="fSize"||e(this).data("command")=="colors"){if(e(this).data("command")=="fSize"&&!e(t.target).hasClass(u.css+"_fontsize")||e(this).data("command")=="colors"&&!e(t.target).hasClass(u.css+"_color"))J(e(this).data("command"));Z(false);if(v.not(":focus"))v.focus()}else{if(v.not(":focus"))v.focus();j(e(this).data("command"),null);K("",false);Z(false);X();e(this).data("emphasis")==true&&!e(this).hasClass(m)?e(this).addClass(m):e(this).removeClass(m);x.addClass(u.css+"_hiddenField");v.removeClass(u.css+"_hiddenField")}}else{p.data("sourceOpened",false);p.find("."+u.css+"_tool").removeClass(u.css+"_hiddenField");x.addClass(u.css+"_hiddenField");v.removeClass(u.css+"_hiddenField")}if(u.placeholder&&u.placeholder!="")v.html()!=""?M.hide():M.show()}v.trigger("change")}).hover(function(t){if(u.title&&e(this).data("title")!=""&&(e(t.target).hasClass(u.css+"_tool")||e(t.target).hasClass(u.css+"_tool_icon"))){e("."+u.css+"_title").remove();h.append('<div class="'+u.css+'_title"><div class="'+u.css+'_titleArrow"><div class="'+u.css+'_titleArrowIcon"></div></div><div class="'+u.css+'_titleText">'+e(this).data("title")+"</div></div>");var n=e("."+u.css+"_title:first");var r=n.find("."+u.css+"_titleArrowIcon");var i=e(this).position();var s=i.left+e(this).outerWidth()-n.outerWidth()/2-e(this).outerWidth()/2;var o=i.top+e(this).outerHeight()+5;n.delay(400).css({top:o,left:s}).fadeIn(200)}},function(){e("."+u.css+"_title").remove()});var ot=null;v.bind("keypress keyup keydown drop cut copy paste DOMCharacterDataModified DOMSubtreeModified",function(){if(!p.data("sourceOpened"))e(this).trigger("change");X();if(e.isFunction(u.change))u.change();if(u.placeholder&&u.placeholder!="")e(this).text()!=""?M.hide():M.show()}).bind("change",function(){if(!p.data("sourceOpened")){clearTimeout(ot);ot=setTimeout(nt,10)}}).keydown(function(e){if(e.ctrlKey){for(var t=0;t<f.length;t++){if(u[f[t].name]&&e.keyCode==f[t].key.charCodeAt(0)){if(f[t].command!=""&&f[t].command!="linkcreator")j(f[t].command,null);else if(f[t].command=="linkcreator")U();return false}}}}).bind("mouseup keyup",st).focus(function(){if(e.isFunction(u.focus))u.focus();h.addClass(u.css+"_focused");if(/opera/.test(a)){var t=document.createRange();t.selectNodeContents(v[0]);t.collapse(false);var n=window.getSelection();n.removeAllRanges();n.addRange(t)}}).focusout(function(){_.removeClass(m);K("",false);Z(false);X();if(e.isFunction(u.blur))u.blur();h.removeClass(u.css+"_focused");if(e.isArray(u.formats))et(u.formats[0][1])});l.bind("keydown keyup",function(){setTimeout(rt,0);e(this).height(e(this)[0].scrollHeight);if(e(this).val()=="")e(this).height(0)}).focus(function(){h.addClass(u.css+"_focused")}).focusout(function(){h.removeClass(u.css+"_focused")})})}})(jQuery)
39
+ /* End jQuery TE */
40
+
41
+ /* Begin MiniColors */
42
+ //
43
+ // jQuery MiniColors: A tiny color picker built on jQuery
44
+ //
45
+ // Developed by Cory LaViska for A Beautiful Site, LLC
46
+ //
47
+ // Licensed under the MIT license: http://opensource.org/licenses/MIT
48
+ //
49
+ !function(i){"function"==typeof define&&define.amd?define(["jquery"],i):"object"==typeof exports?module.exports=i(require("jquery")):i(jQuery)}(function(i){"use strict";function t(t,o){var s,a,n,r,e,l=i('<div class="minicolors" />'),h=i.minicolors.defaults;if(!t.data("minicolors-initialized")){if(o=i.extend(!0,{},h,o),l.addClass("minicolors-theme-"+o.theme).toggleClass("minicolors-with-opacity",o.opacity),void 0!==o.position&&i.each(o.position.split(" "),function(){l.addClass("minicolors-position-"+this)}),s="rgb"===o.format?o.opacity?"25":"20":o.keywords?"11":"7",t.addClass("minicolors-input").data("minicolors-initialized",!1).data("minicolors-settings",o).prop("size",s).wrap(l).after('<div class="minicolors-panel minicolors-slider-'+o.control+'"><div class="minicolors-slider minicolors-sprite"><div class="minicolors-picker"></div></div><div class="minicolors-opacity-slider minicolors-sprite"><div class="minicolors-picker"></div></div><div class="minicolors-grid minicolors-sprite"><div class="minicolors-grid-inner"></div><div class="minicolors-picker"><div></div></div></div></div>'),o.inline||(t.after('<span class="minicolors-swatch minicolors-sprite minicolors-input-swatch"><span class="minicolors-swatch-color"></span></span>'),t.next(".minicolors-input-swatch").on("click",function(i){i.preventDefault(),t.focus()})),r=t.parent().find(".minicolors-panel"),r.on("selectstart",function(){return!1}).end(),o.swatches&&0!==o.swatches.length)for(r.addClass("minicolors-with-swatches"),a=i('<ul class="minicolors-swatches"></ul>').appendTo(r),e=0;e<o.swatches.length;++e)n=o.swatches[e],n=v(n)?g(n,!0):I(u(n,!0)),i('<li class="minicolors-swatch minicolors-sprite"><span class="minicolors-swatch-color"></span></li>').appendTo(a).data("swatch-color",o.swatches[e]).find(".minicolors-swatch-color").css({backgroundColor:C(n),opacity:n.a}),o.swatches[e]=n;o.inline&&t.parent().addClass("minicolors-inline"),c(t,!1),t.data("minicolors-initialized",!0)}}function o(i){var t=i.parent();i.removeData("minicolors-initialized").removeData("minicolors-settings").removeProp("size").removeClass("minicolors-input"),t.before(i).remove()}function s(i){var t=i.parent(),o=t.find(".minicolors-panel"),s=i.data("minicolors-settings");!i.data("minicolors-initialized")||i.prop("disabled")||t.hasClass("minicolors-inline")||t.hasClass("minicolors-focus")||(a(),t.addClass("minicolors-focus"),o.stop(!0,!0).fadeIn(s.showSpeed,function(){s.show&&s.show.call(i.get(0))}))}function a(){i(".minicolors-focus").each(function(){var t=i(this),o=t.find(".minicolors-input"),s=t.find(".minicolors-panel"),a=o.data("minicolors-settings");s.fadeOut(a.hideSpeed,function(){a.hide&&a.hide.call(o.get(0)),t.removeClass("minicolors-focus")})})}function n(i,t,o){var s,a,n,e,c=i.parents(".minicolors").find(".minicolors-input"),l=c.data("minicolors-settings"),h=i.find("[class$=-picker]"),d=i.offset().left,p=i.offset().top,u=Math.round(t.pageX-d),g=Math.round(t.pageY-p),m=o?l.animationSpeed:0;t.originalEvent.changedTouches&&(u=t.originalEvent.changedTouches[0].pageX-d,g=t.originalEvent.changedTouches[0].pageY-p),u<0&&(u=0),g<0&&(g=0),u>i.width()&&(u=i.width()),g>i.height()&&(g=i.height()),i.parent().is(".minicolors-slider-wheel")&&h.parent().is(".minicolors-grid")&&(s=75-u,a=75-g,n=Math.sqrt(s*s+a*a),e=Math.atan2(a,s),e<0&&(e+=2*Math.PI),n>75&&(n=75,u=75-75*Math.cos(e),g=75-75*Math.sin(e)),u=Math.round(u),g=Math.round(g)),i.is(".minicolors-grid")?h.stop(!0).animate({top:g+"px",left:u+"px"},m,l.animationEasing,function(){r(c,i)}):h.stop(!0).animate({top:g+"px"},m,l.animationEasing,function(){r(c,i)})}function r(i,t){function o(i,t){var o,s;return i.length&&t?(o=i.offset().left,s=i.offset().top,{x:o-t.offset().left+i.outerWidth()/2,y:s-t.offset().top+i.outerHeight()/2}):null}var s,a,n,r,c,h,d,p=i.val(),u=i.attr("data-opacity"),g=i.parent(),m=i.data("minicolors-settings"),v=g.find(".minicolors-input-swatch"),b=g.find(".minicolors-grid"),w=g.find(".minicolors-slider"),y=g.find(".minicolors-opacity-slider"),C=b.find("[class$=-picker]"),M=w.find("[class$=-picker]"),x=y.find("[class$=-picker]"),I=o(C,b),S=o(M,w),z=o(x,y);if(t.is(".minicolors-grid, .minicolors-slider, .minicolors-opacity-slider")){switch(m.control){case"wheel":r=b.width()/2-I.x,c=b.height()/2-I.y,h=Math.sqrt(r*r+c*c),d=Math.atan2(c,r),d<0&&(d+=2*Math.PI),h>75&&(h=75,I.x=69-75*Math.cos(d),I.y=69-75*Math.sin(d)),a=f(h/.75,0,100),s=f(180*d/Math.PI,0,360),n=f(100-Math.floor(S.y*(100/w.height())),0,100),p=k({h:s,s:a,b:n}),w.css("backgroundColor",k({h:s,s:a,b:100}));break;case"saturation":s=f(parseInt(I.x*(360/b.width()),10),0,360),a=f(100-Math.floor(S.y*(100/w.height())),0,100),n=f(100-Math.floor(I.y*(100/b.height())),0,100),p=k({h:s,s:a,b:n}),w.css("backgroundColor",k({h:s,s:100,b:n})),g.find(".minicolors-grid-inner").css("opacity",a/100);break;case"brightness":s=f(parseInt(I.x*(360/b.width()),10),0,360),a=f(100-Math.floor(I.y*(100/b.height())),0,100),n=f(100-Math.floor(S.y*(100/w.height())),0,100),p=k({h:s,s:a,b:n}),w.css("backgroundColor",k({h:s,s:a,b:100})),g.find(".minicolors-grid-inner").css("opacity",1-n/100);break;default:s=f(360-parseInt(S.y*(360/w.height()),10),0,360),a=f(Math.floor(I.x*(100/b.width())),0,100),n=f(100-Math.floor(I.y*(100/b.height())),0,100),p=k({h:s,s:a,b:n}),b.css("backgroundColor",k({h:s,s:100,b:100}))}u=m.opacity?parseFloat(1-z.y/y.height()).toFixed(2):1,e(i,p,u)}else v.find("span").css({backgroundColor:p,opacity:u}),l(i,p,u)}function e(i,t,o){var s,a=i.parent(),n=i.data("minicolors-settings"),r=a.find(".minicolors-input-swatch");n.opacity&&i.attr("data-opacity",o),"rgb"===n.format?(s=v(t)?g(t,!0):I(u(t,!0)),o=""===i.attr("data-opacity")?1:f(parseFloat(i.attr("data-opacity")).toFixed(2),0,1),!isNaN(o)&&n.opacity||(o=1),t=i.minicolors("rgbObject").a<=1&&s&&n.opacity?"rgba("+s.r+", "+s.g+", "+s.b+", "+parseFloat(o)+")":"rgb("+s.r+", "+s.g+", "+s.b+")"):(v(t)&&(t=y(t)),t=p(t,n.letterCase)),i.val(t),r.find("span").css({backgroundColor:t,opacity:o}),l(i,t,o)}function c(t,o){var s,a,n,r,e,c,h,d,w,C,x=t.parent(),I=t.data("minicolors-settings"),S=x.find(".minicolors-input-swatch"),z=x.find(".minicolors-grid"),F=x.find(".minicolors-slider"),T=x.find(".minicolors-opacity-slider"),D=z.find("[class$=-picker]"),j=F.find("[class$=-picker]"),q=T.find("[class$=-picker]");switch(v(t.val())?(s=y(t.val()),e=f(parseFloat(b(t.val())).toFixed(2),0,1),e&&t.attr("data-opacity",e)):s=p(u(t.val(),!0),I.letterCase),s||(s=p(m(I.defaultValue,!0),I.letterCase)),a=M(s),r=I.keywords?i.map(I.keywords.split(","),function(t){return i.trim(t.toLowerCase())}):[],c=""!==t.val()&&i.inArray(t.val().toLowerCase(),r)>-1?p(t.val()):v(t.val())?g(t.val()):s,o||t.val(c),I.opacity&&(n=""===t.attr("data-opacity")?1:f(parseFloat(t.attr("data-opacity")).toFixed(2),0,1),isNaN(n)&&(n=1),t.attr("data-opacity",n),S.find("span").css("opacity",n),d=f(T.height()-T.height()*n,0,T.height()),q.css("top",d+"px")),"transparent"===t.val().toLowerCase()&&S.find("span").css("opacity",0),S.find("span").css("backgroundColor",s),I.control){case"wheel":w=f(Math.ceil(.75*a.s),0,z.height()/2),C=a.h*Math.PI/180,h=f(75-Math.cos(C)*w,0,z.width()),d=f(75-Math.sin(C)*w,0,z.height()),D.css({top:d+"px",left:h+"px"}),d=150-a.b/(100/z.height()),""===s&&(d=0),j.css("top",d+"px"),F.css("backgroundColor",k({h:a.h,s:a.s,b:100}));break;case"saturation":h=f(5*a.h/12,0,150),d=f(z.height()-Math.ceil(a.b/(100/z.height())),0,z.height()),D.css({top:d+"px",left:h+"px"}),d=f(F.height()-a.s*(F.height()/100),0,F.height()),j.css("top",d+"px"),F.css("backgroundColor",k({h:a.h,s:100,b:a.b})),x.find(".minicolors-grid-inner").css("opacity",a.s/100);break;case"brightness":h=f(5*a.h/12,0,150),d=f(z.height()-Math.ceil(a.s/(100/z.height())),0,z.height()),D.css({top:d+"px",left:h+"px"}),d=f(F.height()-a.b*(F.height()/100),0,F.height()),j.css("top",d+"px"),F.css("backgroundColor",k({h:a.h,s:a.s,b:100})),x.find(".minicolors-grid-inner").css("opacity",1-a.b/100);break;default:h=f(Math.ceil(a.s/(100/z.width())),0,z.width()),d=f(z.height()-Math.ceil(a.b/(100/z.height())),0,z.height()),D.css({top:d+"px",left:h+"px"}),d=f(F.height()-a.h/(360/F.height()),0,F.height()),j.css("top",d+"px"),z.css("backgroundColor",k({h:a.h,s:100,b:100}))}t.data("minicolors-initialized")&&l(t,c,n)}function l(i,t,o){var s,a,n,r=i.data("minicolors-settings"),e=i.data("minicolors-lastChange");if(!e||e.value!==t||e.opacity!==o){if(i.data("minicolors-lastChange",{value:t,opacity:o}),r.swatches&&0!==r.swatches.length){for(s=v(t)?g(t,!0):I(t),a=-1,n=0;n<r.swatches.length;++n)if(s.r===r.swatches[n].r&&s.g===r.swatches[n].g&&s.b===r.swatches[n].b&&s.a===r.swatches[n].a){a=n;break}i.parent().find(".minicolors-swatches .minicolors-swatch").removeClass("selected"),a!==-1&&i.parent().find(".minicolors-swatches .minicolors-swatch").eq(n).addClass("selected")}r.change&&(r.changeDelay?(clearTimeout(i.data("minicolors-changeTimeout")),i.data("minicolors-changeTimeout",setTimeout(function(){r.change.call(i.get(0),t,o)},r.changeDelay))):r.change.call(i.get(0),t,o)),i.trigger("change").trigger("input")}}function h(t){var o,s=i(t).attr("data-opacity");if(v(i(t).val()))o=g(i(t).val(),!0);else{var a=u(i(t).val(),!0);o=I(a)}return o?(void 0!==s&&i.extend(o,{a:parseFloat(s)}),o):null}function d(t,o){var s,a=i(t).attr("data-opacity");if(v(i(t).val()))s=g(i(t).val(),!0);else{var n=u(i(t).val(),!0);s=I(n)}return s?(void 0===a&&(a=1),o?"rgba("+s.r+", "+s.g+", "+s.b+", "+parseFloat(a)+")":"rgb("+s.r+", "+s.g+", "+s.b+")"):null}function p(i,t){return"uppercase"===t?i.toUpperCase():i.toLowerCase()}function u(i,t){return i=i.replace(/^#/g,""),i.match(/^[A-F0-9]{3,6}/gi)?3!==i.length&&6!==i.length?"":(3===i.length&&t&&(i=i[0]+i[0]+i[1]+i[1]+i[2]+i[2]),"#"+i):""}function g(i,t){var o=i.replace(/[^\d,.]/g,""),s=o.split(",");return s[0]=f(parseInt(s[0],10),0,255),s[1]=f(parseInt(s[1],10),0,255),s[2]=f(parseInt(s[2],10),0,255),s[3]&&(s[3]=f(parseFloat(s[3],10),0,1)),t?s[3]?{r:s[0],g:s[1],b:s[2],a:s[3]}:{r:s[0],g:s[1],b:s[2]}:"undefined"!=typeof s[3]&&s[3]<=1?"rgba("+s[0]+", "+s[1]+", "+s[2]+", "+s[3]+")":"rgb("+s[0]+", "+s[1]+", "+s[2]+")"}function m(i,t){return v(i)?g(i):u(i,t)}function f(i,t,o){return i<t&&(i=t),i>o&&(i=o),i}function v(i){var t=i.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i);return!(!t||4!==t.length)}function b(i){return i=i.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+(\.\d{1,2})?|\.\d{1,2})[\s+]?/i),i&&6===i.length?i[4]:"1"}function w(i){var t={},o=Math.round(i.h),s=Math.round(255*i.s/100),a=Math.round(255*i.b/100);if(0===s)t.r=t.g=t.b=a;else{var n=a,r=(255-s)*a/255,e=(n-r)*(o%60)/60;360===o&&(o=0),o<60?(t.r=n,t.b=r,t.g=r+e):o<120?(t.g=n,t.b=r,t.r=n-e):o<180?(t.g=n,t.r=r,t.b=r+e):o<240?(t.b=n,t.r=r,t.g=n-e):o<300?(t.b=n,t.g=r,t.r=r+e):o<360?(t.r=n,t.g=r,t.b=n-e):(t.r=0,t.g=0,t.b=0)}return{r:Math.round(t.r),g:Math.round(t.g),b:Math.round(t.b)}}function y(i){return i=i.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i),i&&4===i.length?"#"+("0"+parseInt(i[1],10).toString(16)).slice(-2)+("0"+parseInt(i[2],10).toString(16)).slice(-2)+("0"+parseInt(i[3],10).toString(16)).slice(-2):""}function C(t){var o=[t.r.toString(16),t.g.toString(16),t.b.toString(16)];return i.each(o,function(i,t){1===t.length&&(o[i]="0"+t)}),"#"+o.join("")}function k(i){return C(w(i))}function M(i){var t=x(I(i));return 0===t.s&&(t.h=360),t}function x(i){var t={h:0,s:0,b:0},o=Math.min(i.r,i.g,i.b),s=Math.max(i.r,i.g,i.b),a=s-o;return t.b=s,t.s=0!==s?255*a/s:0,0!==t.s?i.r===s?t.h=(i.g-i.b)/a:i.g===s?t.h=2+(i.b-i.r)/a:t.h=4+(i.r-i.g)/a:t.h=-1,t.h*=60,t.h<0&&(t.h+=360),t.s*=100/255,t.b*=100/255,t}function I(i){return i=parseInt(i.indexOf("#")>-1?i.substring(1):i,16),{r:i>>16,g:(65280&i)>>8,b:255&i}}i.minicolors={defaults:{animationSpeed:50,animationEasing:"swing",change:null,changeDelay:0,control:"hue",defaultValue:"",format:"hex",hide:null,hideSpeed:100,inline:!1,keywords:"",letterCase:"lowercase",opacity:!1,position:"bottom left",show:null,showSpeed:100,theme:"default",swatches:[]}},i.extend(i.fn,{minicolors:function(n,r){switch(n){case"destroy":return i(this).each(function(){o(i(this))}),i(this);case"hide":return a(),i(this);case"opacity":return void 0===r?i(this).attr("data-opacity"):(i(this).each(function(){c(i(this).attr("data-opacity",r))}),i(this));case"rgbObject":return h(i(this),"rgbaObject"===n);case"rgbString":case"rgbaString":return d(i(this),"rgbaString"===n);case"settings":return void 0===r?i(this).data("minicolors-settings"):(i(this).each(function(){var t=i(this).data("minicolors-settings")||{};o(i(this)),i(this).minicolors(i.extend(!0,t,r))}),i(this));case"show":return s(i(this).eq(0)),i(this);case"value":return void 0===r?i(this).val():(i(this).each(function(){"object"==typeof r&&null!==r?(r.opacity&&i(this).attr("data-opacity",f(r.opacity,0,1)),r.color&&i(this).val(r.color)):i(this).val(r),c(i(this))}),i(this));default:return"create"!==n&&(r=n),i(this).each(function(){t(i(this),r)}),i(this)}}}),i([document]).on("mousedown.minicolors touchstart.minicolors",function(t){i(t.target).parents().add(t.target).hasClass("minicolors")||a()}).on("mousedown.minicolors touchstart.minicolors",".minicolors-grid, .minicolors-slider, .minicolors-opacity-slider",function(t){var o=i(this);t.preventDefault(),i(t.delegateTarget).data("minicolors-target",o),n(o,t,!0)}).on("mousemove.minicolors touchmove.minicolors",function(t){var o=i(t.delegateTarget).data("minicolors-target");o&&n(o,t)}).on("mouseup.minicolors touchend.minicolors",function(){i(this).removeData("minicolors-target")}).on("click.minicolors",".minicolors-swatches li",function(t){t.preventDefault();var o=i(this),s=o.parents(".minicolors").find(".minicolors-input"),a=o.data("swatch-color");e(s,a,b(a)),c(s)}).on("mousedown.minicolors touchstart.minicolors",".minicolors-input-swatch",function(t){var o=i(this).parent().find(".minicolors-input");t.preventDefault(),s(o)}).on("focus.minicolors",".minicolors-input",function(){var t=i(this);t.data("minicolors-initialized")&&s(t)}).on("blur.minicolors",".minicolors-input",function(){var t,o,s,a,n,r=i(this),e=r.data("minicolors-settings");r.data("minicolors-initialized")&&(t=e.keywords?i.map(e.keywords.split(","),function(t){return i.trim(t.toLowerCase())}):[],""!==r.val()&&i.inArray(r.val().toLowerCase(),t)>-1?n=r.val():(v(r.val())?s=g(r.val(),!0):(o=u(r.val(),!0),s=o?I(o):null),n=null===s?e.defaultValue:"rgb"===e.format?g(e.opacity?"rgba("+s.r+","+s.g+","+s.b+","+r.attr("data-opacity")+")":"rgb("+s.r+","+s.g+","+s.b+")"):C(s)),a=e.opacity?r.attr("data-opacity"):1,"transparent"===n.toLowerCase()&&(a=0),r.closest(".minicolors").find(".minicolors-input-swatch > span").css("opacity",a),r.val(n),""===r.val()&&r.val(m(e.defaultValue,!0)),r.val(p(r.val(),e.letterCase)))}).on("keydown.minicolors",".minicolors-input",function(t){var o=i(this);if(o.data("minicolors-initialized"))switch(t.keyCode){case 9:a();break;case 13:case 27:a(),o.blur()}}).on("keyup.minicolors",".minicolors-input",function(){var t=i(this);t.data("minicolors-initialized")&&c(t,!0)}).on("paste.minicolors",".minicolors-input",function(){var t=i(this);t.data("minicolors-initialized")&&setTimeout(function(){c(t,!0)},1)})});
50
+ /* End MiniColors */
js/jquery.minicolors.js ADDED
@@ -0,0 +1,1108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //
2
+ // jQuery MiniColors: A tiny color picker built on jQuery
3
+ //
4
+ // Developed by Cory LaViska for A Beautiful Site, LLC
5
+ //
6
+ // Licensed under the MIT license: http://opensource.org/licenses/MIT
7
+ //
8
+ (function (factory) {
9
+ if(typeof define === 'function' && define.amd) {
10
+ // AMD. Register as an anonymous module.
11
+ define(['jquery'], factory);
12
+ } else if(typeof exports === 'object') {
13
+ // Node/CommonJS
14
+ module.exports = factory(require('jquery'));
15
+ } else {
16
+ // Browser globals
17
+ factory(jQuery);
18
+ }
19
+ }(function ($) {
20
+ 'use strict';
21
+
22
+ // Defaults
23
+ $.minicolors = {
24
+ defaults: {
25
+ animationSpeed: 50,
26
+ animationEasing: 'swing',
27
+ change: null,
28
+ changeDelay: 0,
29
+ control: 'hue',
30
+ defaultValue: '',
31
+ format: 'hex',
32
+ hide: null,
33
+ hideSpeed: 100,
34
+ inline: false,
35
+ keywords: '',
36
+ letterCase: 'lowercase',
37
+ opacity: false,
38
+ position: 'bottom left',
39
+ show: null,
40
+ showSpeed: 100,
41
+ theme: 'default',
42
+ swatches: []
43
+ }
44
+ };
45
+
46
+ // Public methods
47
+ $.extend($.fn, {
48
+ minicolors: function(method, data) {
49
+
50
+ switch(method) {
51
+ // Destroy the control
52
+ case 'destroy':
53
+ $(this).each(function() {
54
+ destroy($(this));
55
+ });
56
+ return $(this);
57
+
58
+ // Hide the color picker
59
+ case 'hide':
60
+ hide();
61
+ return $(this);
62
+
63
+ // Get/set opacity
64
+ case 'opacity':
65
+ // Getter
66
+ if(data === undefined) {
67
+ // Getter
68
+ return $(this).attr('data-opacity');
69
+ } else {
70
+ // Setter
71
+ $(this).each(function() {
72
+ updateFromInput($(this).attr('data-opacity', data));
73
+ });
74
+ }
75
+ return $(this);
76
+
77
+ // Get an RGB(A) object based on the current color/opacity
78
+ case 'rgbObject':
79
+ return rgbObject($(this), method === 'rgbaObject');
80
+
81
+ // Get an RGB(A) string based on the current color/opacity
82
+ case 'rgbString':
83
+ case 'rgbaString':
84
+ return rgbString($(this), method === 'rgbaString');
85
+
86
+ // Get/set settings on the fly
87
+ case 'settings':
88
+ if(data === undefined) {
89
+ return $(this).data('minicolors-settings');
90
+ } else {
91
+ // Setter
92
+ $(this).each(function() {
93
+ var settings = $(this).data('minicolors-settings') || {};
94
+ destroy($(this));
95
+ $(this).minicolors($.extend(true, settings, data));
96
+ });
97
+ }
98
+ return $(this);
99
+
100
+ // Show the color picker
101
+ case 'show':
102
+ show($(this).eq(0));
103
+ return $(this);
104
+
105
+ // Get/set the hex color value
106
+ case 'value':
107
+ if(data === undefined) {
108
+ // Getter
109
+ return $(this).val();
110
+ } else {
111
+ // Setter
112
+ $(this).each(function() {
113
+ if(typeof(data) === 'object' && data !== null) {
114
+ if(data.opacity) {
115
+ $(this).attr('data-opacity', keepWithin(data.opacity, 0, 1));
116
+ }
117
+ if(data.color) {
118
+ $(this).val(data.color);
119
+ }
120
+ } else {
121
+ $(this).val(data);
122
+ }
123
+ updateFromInput($(this));
124
+ });
125
+ }
126
+ return $(this);
127
+
128
+ // Initializes the control
129
+ default:
130
+ if(method !== 'create') data = method;
131
+ $(this).each(function() {
132
+ init($(this), data);
133
+ });
134
+ return $(this);
135
+
136
+ }
137
+
138
+ }
139
+ });
140
+
141
+ // Initialize input elements
142
+ function init(input, settings) {
143
+ var minicolors = $('<div class="minicolors" />');
144
+ var defaults = $.minicolors.defaults;
145
+ var size;
146
+ var swatches;
147
+ var swatch;
148
+ var panel;
149
+ var i;
150
+
151
+ // Do nothing if already initialized
152
+ if(input.data('minicolors-initialized')) return;
153
+
154
+ // Handle settings
155
+ settings = $.extend(true, {}, defaults, settings);
156
+
157
+ // The wrapper
158
+ minicolors
159
+ .addClass('minicolors-theme-' + settings.theme)
160
+ .toggleClass('minicolors-with-opacity', settings.opacity);
161
+
162
+ // Custom positioning
163
+ if(settings.position !== undefined) {
164
+ $.each(settings.position.split(' '), function() {
165
+ minicolors.addClass('minicolors-position-' + this);
166
+ });
167
+ }
168
+
169
+ // Input size
170
+ if(settings.format === 'rgb') {
171
+ size = settings.opacity ? '25' : '20';
172
+ } else {
173
+ size = settings.keywords ? '11' : '7';
174
+ }
175
+
176
+ // The input
177
+ input
178
+ .addClass('minicolors-input')
179
+ .data('minicolors-initialized', false)
180
+ .data('minicolors-settings', settings)
181
+ .prop('size', size)
182
+ .wrap(minicolors)
183
+ .after(
184
+ '<div class="minicolors-panel minicolors-slider-' + settings.control + '">' +
185
+ '<div class="minicolors-slider minicolors-sprite">' +
186
+ '<div class="minicolors-picker"></div>' +
187
+ '</div>' +
188
+ '<div class="minicolors-opacity-slider minicolors-sprite">' +
189
+ '<div class="minicolors-picker"></div>' +
190
+ '</div>' +
191
+ '<div class="minicolors-grid minicolors-sprite">' +
192
+ '<div class="minicolors-grid-inner"></div>' +
193
+ '<div class="minicolors-picker"><div></div></div>' +
194
+ '</div>' +
195
+ '</div>'
196
+ );
197
+
198
+ // The swatch
199
+ if(!settings.inline) {
200
+ input.after('<span class="minicolors-swatch minicolors-sprite minicolors-input-swatch"><span class="minicolors-swatch-color"></span></span>');
201
+ input.next('.minicolors-input-swatch').on('click', function(event) {
202
+ event.preventDefault();
203
+ input.focus();
204
+ });
205
+ }
206
+
207
+ // Prevent text selection in IE
208
+ panel = input.parent().find('.minicolors-panel');
209
+ panel.on('selectstart', function() { return false; }).end();
210
+
211
+ // Swatches
212
+ if(settings.swatches && settings.swatches.length !== 0) {
213
+ panel.addClass('minicolors-with-swatches');
214
+ swatches = $('<ul class="minicolors-swatches"></ul>')
215
+ .appendTo(panel);
216
+ for(i = 0; i < settings.swatches.length; ++i) {
217
+ swatch = settings.swatches[i];
218
+ swatch = isRgb(swatch) ? parseRgb(swatch, true) : hex2rgb(parseHex(swatch, true));
219
+ $('<li class="minicolors-swatch minicolors-sprite"><span class="minicolors-swatch-color"></span></li>')
220
+ .appendTo(swatches)
221
+ .data('swatch-color', settings.swatches[i])
222
+ .find('.minicolors-swatch-color')
223
+ .css({
224
+ backgroundColor: rgb2hex(swatch),
225
+ opacity: swatch.a
226
+ });
227
+ settings.swatches[i] = swatch;
228
+ }
229
+ }
230
+
231
+ // Inline controls
232
+ if(settings.inline) input.parent().addClass('minicolors-inline');
233
+
234
+ updateFromInput(input, false);
235
+
236
+ input.data('minicolors-initialized', true);
237
+ }
238
+
239
+ // Returns the input back to its original state
240
+ function destroy(input) {
241
+ var minicolors = input.parent();
242
+
243
+ // Revert the input element
244
+ input
245
+ .removeData('minicolors-initialized')
246
+ .removeData('minicolors-settings')
247
+ .removeProp('size')
248
+ .removeClass('minicolors-input');
249
+
250
+ // Remove the wrap and destroy whatever remains
251
+ minicolors.before(input).remove();
252
+ }
253
+
254
+ // Shows the specified dropdown panel
255
+ function show(input) {
256
+ var minicolors = input.parent();
257
+ var panel = minicolors.find('.minicolors-panel');
258
+ var settings = input.data('minicolors-settings');
259
+
260
+ // Do nothing if uninitialized, disabled, inline, or already open
261
+ if(
262
+ !input.data('minicolors-initialized') ||
263
+ input.prop('disabled') ||
264
+ minicolors.hasClass('minicolors-inline') ||
265
+ minicolors.hasClass('minicolors-focus')
266
+ ) return;
267
+
268
+ hide();
269
+
270
+ minicolors.addClass('minicolors-focus');
271
+ panel
272
+ .stop(true, true)
273
+ .fadeIn(settings.showSpeed, function() {
274
+ if(settings.show) settings.show.call(input.get(0));
275
+ });
276
+ }
277
+
278
+ // Hides all dropdown panels
279
+ function hide() {
280
+ $('.minicolors-focus').each(function() {
281
+ var minicolors = $(this);
282
+ var input = minicolors.find('.minicolors-input');
283
+ var panel = minicolors.find('.minicolors-panel');
284
+ var settings = input.data('minicolors-settings');
285
+
286
+ panel.fadeOut(settings.hideSpeed, function() {
287
+ if(settings.hide) settings.hide.call(input.get(0));
288
+ minicolors.removeClass('minicolors-focus');
289
+ });
290
+
291
+ });
292
+ }
293
+
294
+ // Moves the selected picker
295
+ function move(target, event, animate) {
296
+ var input = target.parents('.minicolors').find('.minicolors-input');
297
+ var settings = input.data('minicolors-settings');
298
+ var picker = target.find('[class$=-picker]');
299
+ var offsetX = target.offset().left;
300
+ var offsetY = target.offset().top;
301
+ var x = Math.round(event.pageX - offsetX);
302
+ var y = Math.round(event.pageY - offsetY);
303
+ var duration = animate ? settings.animationSpeed : 0;
304
+ var wx, wy, r, phi;
305
+
306
+ // Touch support
307
+ if(event.originalEvent.changedTouches) {
308
+ x = event.originalEvent.changedTouches[0].pageX - offsetX;
309
+ y = event.originalEvent.changedTouches[0].pageY - offsetY;
310
+ }
311
+
312
+ // Constrain picker to its container
313
+ if(x < 0) x = 0;
314
+ if(y < 0) y = 0;
315
+ if(x > target.width()) x = target.width();
316
+ if(y > target.height()) y = target.height();
317
+
318
+ // Constrain color wheel values to the wheel
319
+ if(target.parent().is('.minicolors-slider-wheel') && picker.parent().is('.minicolors-grid')) {
320
+ wx = 75 - x;
321
+ wy = 75 - y;
322
+ r = Math.sqrt(wx * wx + wy * wy);
323
+ phi = Math.atan2(wy, wx);
324
+ if(phi < 0) phi += Math.PI * 2;
325
+ if(r > 75) {
326
+ r = 75;
327
+ x = 75 - (75 * Math.cos(phi));
328
+ y = 75 - (75 * Math.sin(phi));
329
+ }
330
+ x = Math.round(x);
331
+ y = Math.round(y);
332
+ }
333
+
334
+ // Move the picker
335
+ if(target.is('.minicolors-grid')) {
336
+ picker
337
+ .stop(true)
338
+ .animate({
339
+ top: y + 'px',
340
+ left: x + 'px'
341
+ }, duration, settings.animationEasing, function() {
342
+ updateFromControl(input, target);
343
+ });
344
+ } else {
345
+ picker
346
+ .stop(true)
347
+ .animate({
348
+ top: y + 'px'
349
+ }, duration, settings.animationEasing, function() {
350
+ updateFromControl(input, target);
351
+ });
352
+ }
353
+ }
354
+
355
+ // Sets the input based on the color picker values
356
+ function updateFromControl(input, target) {
357
+
358
+ function getCoords(picker, container) {
359
+ var left, top;
360
+ if(!picker.length || !container) return null;
361
+ left = picker.offset().left;
362
+ top = picker.offset().top;
363
+
364
+ return {
365
+ x: left - container.offset().left + (picker.outerWidth() / 2),
366
+ y: top - container.offset().top + (picker.outerHeight() / 2)
367
+ };
368
+ }
369
+
370
+ var hue, saturation, brightness, x, y, r, phi;
371
+ var hex = input.val();
372
+ var opacity = input.attr('data-opacity');
373
+
374
+ // Helpful references
375
+ var minicolors = input.parent();
376
+ var settings = input.data('minicolors-settings');
377
+ var swatch = minicolors.find('.minicolors-input-swatch');
378
+
379
+ // Panel objects
380
+ var grid = minicolors.find('.minicolors-grid');
381
+ var slider = minicolors.find('.minicolors-slider');
382
+ var opacitySlider = minicolors.find('.minicolors-opacity-slider');
383
+
384
+ // Picker objects
385
+ var gridPicker = grid.find('[class$=-picker]');
386
+ var sliderPicker = slider.find('[class$=-picker]');
387
+ var opacityPicker = opacitySlider.find('[class$=-picker]');
388
+
389
+ // Picker positions
390
+ var gridPos = getCoords(gridPicker, grid);
391
+ var sliderPos = getCoords(sliderPicker, slider);
392
+ var opacityPos = getCoords(opacityPicker, opacitySlider);
393
+
394
+ // Handle colors
395
+ if(target.is('.minicolors-grid, .minicolors-slider, .minicolors-opacity-slider')) {
396
+
397
+ // Determine HSB values
398
+ switch(settings.control) {
399
+ case 'wheel':
400
+ // Calculate hue, saturation, and brightness
401
+ x = (grid.width() / 2) - gridPos.x;
402
+ y = (grid.height() / 2) - gridPos.y;
403
+ r = Math.sqrt(x * x + y * y);
404
+ phi = Math.atan2(y, x);
405
+ if(phi < 0) phi += Math.PI * 2;
406
+ if(r > 75) {
407
+ r = 75;
408
+ gridPos.x = 69 - (75 * Math.cos(phi));
409
+ gridPos.y = 69 - (75 * Math.sin(phi));
410
+ }
411
+ saturation = keepWithin(r / 0.75, 0, 100);
412
+ hue = keepWithin(phi * 180 / Math.PI, 0, 360);
413
+ brightness = keepWithin(100 - Math.floor(sliderPos.y * (100 / slider.height())), 0, 100);
414
+ hex = hsb2hex({
415
+ h: hue,
416
+ s: saturation,
417
+ b: brightness
418
+ });
419
+
420
+ // Update UI
421
+ slider.css('backgroundColor', hsb2hex({ h: hue, s: saturation, b: 100 }));
422
+ break;
423
+
424
+ case 'saturation':
425
+ // Calculate hue, saturation, and brightness
426
+ hue = keepWithin(parseInt(gridPos.x * (360 / grid.width()), 10), 0, 360);
427
+ saturation = keepWithin(100 - Math.floor(sliderPos.y * (100 / slider.height())), 0, 100);
428
+ brightness = keepWithin(100 - Math.floor(gridPos.y * (100 / grid.height())), 0, 100);
429
+ hex = hsb2hex({
430
+ h: hue,
431
+ s: saturation,
432
+ b: brightness
433
+ });
434
+
435
+ // Update UI
436
+ slider.css('backgroundColor', hsb2hex({ h: hue, s: 100, b: brightness }));
437
+ minicolors.find('.minicolors-grid-inner').css('opacity', saturation / 100);
438
+ break;
439
+
440
+ case 'brightness':
441
+ // Calculate hue, saturation, and brightness
442
+ hue = keepWithin(parseInt(gridPos.x * (360 / grid.width()), 10), 0, 360);
443
+ saturation = keepWithin(100 - Math.floor(gridPos.y * (100 / grid.height())), 0, 100);
444
+ brightness = keepWithin(100 - Math.floor(sliderPos.y * (100 / slider.height())), 0, 100);
445
+ hex = hsb2hex({
446
+ h: hue,
447
+ s: saturation,
448
+ b: brightness
449
+ });
450
+
451
+ // Update UI
452
+ slider.css('backgroundColor', hsb2hex({ h: hue, s: saturation, b: 100 }));
453
+ minicolors.find('.minicolors-grid-inner').css('opacity', 1 - (brightness / 100));
454
+ break;
455
+
456
+ default:
457
+ // Calculate hue, saturation, and brightness
458
+ hue = keepWithin(360 - parseInt(sliderPos.y * (360 / slider.height()), 10), 0, 360);
459
+ saturation = keepWithin(Math.floor(gridPos.x * (100 / grid.width())), 0, 100);
460
+ brightness = keepWithin(100 - Math.floor(gridPos.y * (100 / grid.height())), 0, 100);
461
+ hex = hsb2hex({
462
+ h: hue,
463
+ s: saturation,
464
+ b: brightness
465
+ });
466
+
467
+ // Update UI
468
+ grid.css('backgroundColor', hsb2hex({ h: hue, s: 100, b: 100 }));
469
+ break;
470
+ }
471
+
472
+ // Handle opacity
473
+ if(settings.opacity) {
474
+ opacity = parseFloat(1 - (opacityPos.y / opacitySlider.height())).toFixed(2);
475
+ } else {
476
+ opacity = 1;
477
+ }
478
+
479
+ updateInput(input, hex, opacity);
480
+ }
481
+ else {
482
+ // Set swatch color
483
+ swatch.find('span').css({
484
+ backgroundColor: hex,
485
+ opacity: opacity
486
+ });
487
+
488
+ // Handle change event
489
+ doChange(input, hex, opacity);
490
+ }
491
+ }
492
+
493
+ // Sets the value of the input and does the appropriate conversions
494
+ // to respect settings, also updates the swatch
495
+ function updateInput(input, value, opacity) {
496
+ var rgb;
497
+
498
+ // Helpful references
499
+ var minicolors = input.parent();
500
+ var settings = input.data('minicolors-settings');
501
+ var swatch = minicolors.find('.minicolors-input-swatch');
502
+
503
+ if(settings.opacity) input.attr('data-opacity', opacity);
504
+
505
+ // Set color string
506
+ if(settings.format === 'rgb') {
507
+ // Returns RGB(A) string
508
+
509
+ // Checks for input format and does the conversion
510
+ if(isRgb(value)) {
511
+ rgb = parseRgb(value, true);
512
+ }
513
+ else {
514
+ rgb = hex2rgb(parseHex(value, true));
515
+ }
516
+
517
+ opacity = input.attr('data-opacity') === '' ? 1 : keepWithin(parseFloat(input.attr('data-opacity')).toFixed(2), 0, 1);
518
+ if(isNaN(opacity) || !settings.opacity) opacity = 1;
519
+
520
+ if(input.minicolors('rgbObject').a <= 1 && rgb && settings.opacity) {
521
+ // Set RGBA string if alpha
522
+ value = 'rgba(' + rgb.r + ', ' + rgb.g + ', ' + rgb.b + ', ' + parseFloat(opacity) + ')';
523
+ } else {
524
+ // Set RGB string (alpha = 1)
525
+ value = 'rgb(' + rgb.r + ', ' + rgb.g + ', ' + rgb.b + ')';
526
+ }
527
+ } else {
528
+ // Returns hex color
529
+
530
+ // Checks for input format and does the conversion
531
+ if(isRgb(value)) {
532
+ value = rgbString2hex(value);
533
+ }
534
+
535
+ value = convertCase(value, settings.letterCase);
536
+ }
537
+
538
+ // Update value from picker
539
+ input.val(value);
540
+
541
+ // Set swatch color
542
+ swatch.find('span').css({
543
+ backgroundColor: value,
544
+ opacity: opacity
545
+ });
546
+
547
+ // Handle change event
548
+ doChange(input, value, opacity);
549
+ }
550
+
551
+ // Sets the color picker values from the input
552
+ function updateFromInput(input, preserveInputValue) {
553
+ var hex, hsb, opacity, keywords, alpha, value, x, y, r, phi;
554
+
555
+ // Helpful references
556
+ var minicolors = input.parent();
557
+ var settings = input.data('minicolors-settings');
558
+ var swatch = minicolors.find('.minicolors-input-swatch');
559
+
560
+ // Panel objects
561
+ var grid = minicolors.find('.minicolors-grid');
562
+ var slider = minicolors.find('.minicolors-slider');
563
+ var opacitySlider = minicolors.find('.minicolors-opacity-slider');
564
+
565
+ // Picker objects
566
+ var gridPicker = grid.find('[class$=-picker]');
567
+ var sliderPicker = slider.find('[class$=-picker]');
568
+ var opacityPicker = opacitySlider.find('[class$=-picker]');
569
+
570
+ // Determine hex/HSB values
571
+ if(isRgb(input.val())) {
572
+ // If input value is a rgb(a) string, convert it to hex color and update opacity
573
+ hex = rgbString2hex(input.val());
574
+ alpha = keepWithin(parseFloat(getAlpha(input.val())).toFixed(2), 0, 1);
575
+ if(alpha) {
576
+ input.attr('data-opacity', alpha);
577
+ }
578
+ } else {
579
+ hex = convertCase(parseHex(input.val(), true), settings.letterCase);
580
+ }
581
+
582
+ if(!hex){
583
+ hex = convertCase(parseInput(settings.defaultValue, true), settings.letterCase);
584
+ }
585
+ hsb = hex2hsb(hex);
586
+
587
+ // Get array of lowercase keywords
588
+ keywords = !settings.keywords ? [] : $.map(settings.keywords.split(','), function(a) {
589
+ return $.trim(a.toLowerCase());
590
+ });
591
+
592
+ // Set color string
593
+ if(input.val() !== '' && $.inArray(input.val().toLowerCase(), keywords) > -1) {
594
+ value = convertCase(input.val());
595
+ } else {
596
+ value = isRgb(input.val()) ? parseRgb(input.val()) : hex;
597
+ }
598
+
599
+ // Update input value
600
+ if(!preserveInputValue) input.val(value);
601
+
602
+ // Determine opacity value
603
+ if(settings.opacity) {
604
+ // Get from data-opacity attribute and keep within 0-1 range
605
+ opacity = input.attr('data-opacity') === '' ? 1 : keepWithin(parseFloat(input.attr('data-opacity')).toFixed(2), 0, 1);
606
+ if(isNaN(opacity)) opacity = 1;
607
+ input.attr('data-opacity', opacity);
608
+ swatch.find('span').css('opacity', opacity);
609
+
610
+ // Set opacity picker position
611
+ y = keepWithin(opacitySlider.height() - (opacitySlider.height() * opacity), 0, opacitySlider.height());
612
+ opacityPicker.css('top', y + 'px');
613
+ }
614
+
615
+ // Set opacity to zero if input value is transparent
616
+ if(input.val().toLowerCase() === 'transparent') {
617
+ swatch.find('span').css('opacity', 0);
618
+ }
619
+
620
+ // Update swatch
621
+ swatch.find('span').css('backgroundColor', hex);
622
+
623
+ // Determine picker locations
624
+ switch(settings.control) {
625
+ case 'wheel':
626
+ // Set grid position
627
+ r = keepWithin(Math.ceil(hsb.s * 0.75), 0, grid.height() / 2);
628
+ phi = hsb.h * Math.PI / 180;
629
+ x = keepWithin(75 - Math.cos(phi) * r, 0, grid.width());
630
+ y = keepWithin(75 - Math.sin(phi) * r, 0, grid.height());
631
+ gridPicker.css({
632
+ top: y + 'px',
633
+ left: x + 'px'
634
+ });
635
+
636
+ // Set slider position
637
+ y = 150 - (hsb.b / (100 / grid.height()));
638
+ if(hex === '') y = 0;
639
+ sliderPicker.css('top', y + 'px');
640
+
641
+ // Update panel color
642
+ slider.css('backgroundColor', hsb2hex({ h: hsb.h, s: hsb.s, b: 100 }));
643
+ break;
644
+
645
+ case 'saturation':
646
+ // Set grid position
647
+ x = keepWithin((5 * hsb.h) / 12, 0, 150);
648
+ y = keepWithin(grid.height() - Math.ceil(hsb.b / (100 / grid.height())), 0, grid.height());
649
+ gridPicker.css({
650
+ top: y + 'px',
651
+ left: x + 'px'
652
+ });
653
+
654
+ // Set slider position
655
+ y = keepWithin(slider.height() - (hsb.s * (slider.height() / 100)), 0, slider.height());
656
+ sliderPicker.css('top', y + 'px');
657
+
658
+ // Update UI
659
+ slider.css('backgroundColor', hsb2hex({ h: hsb.h, s: 100, b: hsb.b }));
660
+ minicolors.find('.minicolors-grid-inner').css('opacity', hsb.s / 100);
661
+ break;
662
+
663
+ case 'brightness':
664
+ // Set grid position
665
+ x = keepWithin((5 * hsb.h) / 12, 0, 150);
666
+ y = keepWithin(grid.height() - Math.ceil(hsb.s / (100 / grid.height())), 0, grid.height());
667
+ gridPicker.css({
668
+ top: y + 'px',
669
+ left: x + 'px'
670
+ });
671
+
672
+ // Set slider position
673
+ y = keepWithin(slider.height() - (hsb.b * (slider.height() / 100)), 0, slider.height());
674
+ sliderPicker.css('top', y + 'px');
675
+
676
+ // Update UI
677
+ slider.css('backgroundColor', hsb2hex({ h: hsb.h, s: hsb.s, b: 100 }));
678
+ minicolors.find('.minicolors-grid-inner').css('opacity', 1 - (hsb.b / 100));
679
+ break;
680
+
681
+ default:
682
+ // Set grid position
683
+ x = keepWithin(Math.ceil(hsb.s / (100 / grid.width())), 0, grid.width());
684
+ y = keepWithin(grid.height() - Math.ceil(hsb.b / (100 / grid.height())), 0, grid.height());
685
+ gridPicker.css({
686
+ top: y + 'px',
687
+ left: x + 'px'
688
+ });
689
+
690
+ // Set slider position
691
+ y = keepWithin(slider.height() - (hsb.h / (360 / slider.height())), 0, slider.height());
692
+ sliderPicker.css('top', y + 'px');
693
+
694
+ // Update panel color
695
+ grid.css('backgroundColor', hsb2hex({ h: hsb.h, s: 100, b: 100 }));
696
+ break;
697
+ }
698
+
699
+ // Fire change event, but only if minicolors is fully initialized
700
+ if(input.data('minicolors-initialized')) {
701
+ doChange(input, value, opacity);
702
+ }
703
+ }
704
+
705
+ // Runs the change and changeDelay callbacks
706
+ function doChange(input, value, opacity) {
707
+ var settings = input.data('minicolors-settings');
708
+ var lastChange = input.data('minicolors-lastChange');
709
+ var obj, sel, i;
710
+
711
+ // Only run if it actually changed
712
+ if(!lastChange || lastChange.value !== value || lastChange.opacity !== opacity) {
713
+
714
+ // Remember last-changed value
715
+ input.data('minicolors-lastChange', {
716
+ value: value,
717
+ opacity: opacity
718
+ });
719
+
720
+ // Check and select applicable swatch
721
+ if(settings.swatches && settings.swatches.length !== 0) {
722
+ if(!isRgb(value)) {
723
+ obj = hex2rgb(value);
724
+ }
725
+ else {
726
+ obj = parseRgb(value, true);
727
+ }
728
+ sel = -1;
729
+ for(i = 0; i < settings.swatches.length; ++i) {
730
+ if(obj.r === settings.swatches[i].r && obj.g === settings.swatches[i].g && obj.b === settings.swatches[i].b && obj.a === settings.swatches[i].a) {
731
+ sel = i;
732
+ break;
733
+ }
734
+ }
735
+
736
+ input.parent().find('.minicolors-swatches .minicolors-swatch').removeClass('selected');
737
+ if(sel !== -1) {
738
+ input.parent().find('.minicolors-swatches .minicolors-swatch').eq(i).addClass('selected');
739
+ }
740
+ }
741
+
742
+ // Fire change event
743
+ if(settings.change) {
744
+ if(settings.changeDelay) {
745
+ // Call after a delay
746
+ clearTimeout(input.data('minicolors-changeTimeout'));
747
+ input.data('minicolors-changeTimeout', setTimeout(function() {
748
+ settings.change.call(input.get(0), value, opacity);
749
+ }, settings.changeDelay));
750
+ } else {
751
+ // Call immediately
752
+ settings.change.call(input.get(0), value, opacity);
753
+ }
754
+ }
755
+ input.trigger('change').trigger('input');
756
+ }
757
+ }
758
+
759
+ // Generates an RGB(A) object based on the input's value
760
+ function rgbObject(input) {
761
+ var rgb,
762
+ opacity = $(input).attr('data-opacity');
763
+ if( isRgb($(input).val()) ) {
764
+ rgb = parseRgb($(input).val(), true);
765
+ } else {
766
+ var hex = parseHex($(input).val(), true);
767
+ rgb = hex2rgb(hex);
768
+ }
769
+ if( !rgb ) return null;
770
+ if( opacity !== undefined ) $.extend(rgb, { a: parseFloat(opacity) });
771
+ return rgb;
772
+ }
773
+
774
+ // Generates an RGB(A) string based on the input's value
775
+ function rgbString(input, alpha) {
776
+ var rgb,
777
+ opacity = $(input).attr('data-opacity');
778
+ if( isRgb($(input).val()) ) {
779
+ rgb = parseRgb($(input).val(), true);
780
+ } else {
781
+ var hex = parseHex($(input).val(), true);
782
+ rgb = hex2rgb(hex);
783
+ }
784
+ if( !rgb ) return null;
785
+ if( opacity === undefined ) opacity = 1;
786
+ if( alpha ) {
787
+ return 'rgba(' + rgb.r + ', ' + rgb.g + ', ' + rgb.b + ', ' + parseFloat(opacity) + ')';
788
+ } else {
789
+ return 'rgb(' + rgb.r + ', ' + rgb.g + ', ' + rgb.b + ')';
790
+ }
791
+ }
792
+
793
+ // Converts to the letter case specified in settings
794
+ function convertCase(string, letterCase) {
795
+ return letterCase === 'uppercase' ? string.toUpperCase() : string.toLowerCase();
796
+ }
797
+
798
+ // Parses a string and returns a valid hex string when possible
799
+ function parseHex(string, expand) {
800
+ string = string.replace(/^#/g, '');
801
+ if(!string.match(/^[A-F0-9]{3,6}/ig)) return '';
802
+ if(string.length !== 3 && string.length !== 6) return '';
803
+ if(string.length === 3 && expand) {
804
+ string = string[0] + string[0] + string[1] + string[1] + string[2] + string[2];
805
+ }
806
+ return '#' + string;
807
+ }
808
+
809
+ // Parses a string and returns a valid RGB(A) string when possible
810
+ function parseRgb(string, obj) {
811
+ var values = string.replace(/[^\d,.]/g, '');
812
+ var rgba = values.split(',');
813
+
814
+ rgba[0] = keepWithin(parseInt(rgba[0], 10), 0, 255);
815
+ rgba[1] = keepWithin(parseInt(rgba[1], 10), 0, 255);
816
+ rgba[2] = keepWithin(parseInt(rgba[2], 10), 0, 255);
817
+ if(rgba[3]) {
818
+ rgba[3] = keepWithin(parseFloat(rgba[3], 10), 0, 1);
819
+ }
820
+
821
+ // Return RGBA object
822
+ if( obj ) {
823
+ if (rgba[3]) {
824
+ return {
825
+ r: rgba[0],
826
+ g: rgba[1],
827
+ b: rgba[2],
828
+ a: rgba[3]
829
+ };
830
+ } else {
831
+ return {
832
+ r: rgba[0],
833
+ g: rgba[1],
834
+ b: rgba[2]
835
+ };
836
+ }
837
+ }
838
+
839
+ // Return RGBA string
840
+ if(typeof(rgba[3]) !== 'undefined' && rgba[3] <= 1) {
841
+ return 'rgba(' + rgba[0] + ', ' + rgba[1] + ', ' + rgba[2] + ', ' + rgba[3] + ')';
842
+ } else {
843
+ return 'rgb(' + rgba[0] + ', ' + rgba[1] + ', ' + rgba[2] + ')';
844
+ }
845
+
846
+ }
847
+
848
+ // Parses a string and returns a valid color string when possible
849
+ function parseInput(string, expand) {
850
+ if(isRgb(string)) {
851
+ // Returns a valid rgb(a) string
852
+ return parseRgb(string);
853
+ } else {
854
+ return parseHex(string, expand);
855
+ }
856
+ }
857
+
858
+ // Keeps value within min and max
859
+ function keepWithin(value, min, max) {
860
+ if(value < min) value = min;
861
+ if(value > max) value = max;
862
+ return value;
863
+ }
864
+
865
+ // Checks if a string is a valid RGB(A) string
866
+ function isRgb(string) {
867
+ var rgb = string.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i);
868
+ return (rgb && rgb.length === 4) ? true : false;
869
+ }
870
+
871
+ // Function to get alpha from a RGB(A) string
872
+ function getAlpha(rgba) {
873
+ rgba = rgba.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+(\.\d{1,2})?|\.\d{1,2})[\s+]?/i);
874
+ return (rgba && rgba.length === 6) ? rgba[4] : '1';
875
+ }
876
+
877
+ // Converts an HSB object to an RGB object
878
+ function hsb2rgb(hsb) {
879
+ var rgb = {};
880
+ var h = Math.round(hsb.h);
881
+ var s = Math.round(hsb.s * 255 / 100);
882
+ var v = Math.round(hsb.b * 255 / 100);
883
+ if(s === 0) {
884
+ rgb.r = rgb.g = rgb.b = v;
885
+ } else {
886
+ var t1 = v;
887
+ var t2 = (255 - s) * v / 255;
888
+ var t3 = (t1 - t2) * (h % 60) / 60;
889
+ if(h === 360) h = 0;
890
+ if(h < 60) { rgb.r = t1; rgb.b = t2; rgb.g = t2 + t3; }
891
+ else if(h < 120) {rgb.g = t1; rgb.b = t2; rgb.r = t1 - t3; }
892
+ else if(h < 180) {rgb.g = t1; rgb.r = t2; rgb.b = t2 + t3; }
893
+ else if(h < 240) {rgb.b = t1; rgb.r = t2; rgb.g = t1 - t3; }
894
+ else if(h < 300) {rgb.b = t1; rgb.g = t2; rgb.r = t2 + t3; }
895
+ else if(h < 360) {rgb.r = t1; rgb.g = t2; rgb.b = t1 - t3; }
896
+ else { rgb.r = 0; rgb.g = 0; rgb.b = 0; }
897
+ }
898
+ return {
899
+ r: Math.round(rgb.r),
900
+ g: Math.round(rgb.g),
901
+ b: Math.round(rgb.b)
902
+ };
903
+ }
904
+
905
+ // Converts an RGB string to a hex string
906
+ function rgbString2hex(rgb){
907
+ rgb = rgb.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i);
908
+ return (rgb && rgb.length === 4) ? '#' +
909
+ ('0' + parseInt(rgb[1],10).toString(16)).slice(-2) +
910
+ ('0' + parseInt(rgb[2],10).toString(16)).slice(-2) +
911
+ ('0' + parseInt(rgb[3],10).toString(16)).slice(-2) : '';
912
+ }
913
+
914
+ // Converts an RGB object to a hex string
915
+ function rgb2hex(rgb) {
916
+ var hex = [
917
+ rgb.r.toString(16),
918
+ rgb.g.toString(16),
919
+ rgb.b.toString(16)
920
+ ];
921
+ $.each(hex, function(nr, val) {
922
+ if(val.length === 1) hex[nr] = '0' + val;
923
+ });
924
+ return '#' + hex.join('');
925
+ }
926
+
927
+ // Converts an HSB object to a hex string
928
+ function hsb2hex(hsb) {
929
+ return rgb2hex(hsb2rgb(hsb));
930
+ }
931
+
932
+ // Converts a hex string to an HSB object
933
+ function hex2hsb(hex) {
934
+ var hsb = rgb2hsb(hex2rgb(hex));
935
+ if(hsb.s === 0) hsb.h = 360;
936
+ return hsb;
937
+ }
938
+
939
+ // Converts an RGB object to an HSB object
940
+ function rgb2hsb(rgb) {
941
+ var hsb = { h: 0, s: 0, b: 0 };
942
+ var min = Math.min(rgb.r, rgb.g, rgb.b);
943
+ var max = Math.max(rgb.r, rgb.g, rgb.b);
944
+ var delta = max - min;
945
+ hsb.b = max;
946
+ hsb.s = max !== 0 ? 255 * delta / max : 0;
947
+ if(hsb.s !== 0) {
948
+ if(rgb.r === max) {
949
+ hsb.h = (rgb.g - rgb.b) / delta;
950
+ } else if(rgb.g === max) {
951
+ hsb.h = 2 + (rgb.b - rgb.r) / delta;
952
+ } else {
953
+ hsb.h = 4 + (rgb.r - rgb.g) / delta;
954
+ }
955
+ } else {
956
+ hsb.h = -1;
957
+ }
958
+ hsb.h *= 60;
959
+ if(hsb.h < 0) {
960
+ hsb.h += 360;
961
+ }
962
+ hsb.s *= 100/255;
963
+ hsb.b *= 100/255;
964
+ return hsb;
965
+ }
966
+
967
+ // Converts a hex string to an RGB object
968
+ function hex2rgb(hex) {
969
+ hex = parseInt(((hex.indexOf('#') > -1) ? hex.substring(1) : hex), 16);
970
+ return {
971
+ r: hex >> 16,
972
+ g: (hex & 0x00FF00) >> 8,
973
+ b: (hex & 0x0000FF)
974
+ };
975
+ }
976
+
977
+ // Handle events
978
+ $([document])
979
+ // Hide on clicks outside of the control
980
+ .on('mousedown.minicolors touchstart.minicolors', function(event) {
981
+ if(!$(event.target).parents().add(event.target).hasClass('minicolors')) {
982
+ hide();
983
+ }
984
+ })
985
+ // Start moving
986
+ .on('mousedown.minicolors touchstart.minicolors', '.minicolors-grid, .minicolors-slider, .minicolors-opacity-slider', function(event) {
987
+ var target = $(this);
988
+ event.preventDefault();
989
+ $(event.delegateTarget).data('minicolors-target', target);
990
+ move(target, event, true);
991
+ })
992
+ // Move pickers
993
+ .on('mousemove.minicolors touchmove.minicolors', function(event) {
994
+ var target = $(event.delegateTarget).data('minicolors-target');
995
+ if(target) move(target, event);
996
+ })
997
+ // Stop moving
998
+ .on('mouseup.minicolors touchend.minicolors', function() {
999
+ $(this).removeData('minicolors-target');
1000
+ })
1001
+ // Selected a swatch
1002
+ .on('click.minicolors', '.minicolors-swatches li', function(event) {
1003
+ event.preventDefault();
1004
+ var target = $(this), input = target.parents('.minicolors').find('.minicolors-input'), color = target.data('swatch-color');
1005
+ updateInput(input, color, getAlpha(color));
1006
+ updateFromInput(input);
1007
+ })
1008
+ // Show panel when swatch is clicked
1009
+ .on('mousedown.minicolors touchstart.minicolors', '.minicolors-input-swatch', function(event) {
1010
+ var input = $(this).parent().find('.minicolors-input');
1011
+ event.preventDefault();
1012
+ show(input);
1013
+ })
1014
+ // Show on focus
1015
+ .on('focus.minicolors', '.minicolors-input', function() {
1016
+ var input = $(this);
1017
+ if(!input.data('minicolors-initialized')) return;
1018
+ show(input);
1019
+ })
1020
+ // Update value on blur
1021
+ .on('blur.minicolors', '.minicolors-input', function() {
1022
+ var input = $(this);
1023
+ var settings = input.data('minicolors-settings');
1024
+ var keywords;
1025
+ var hex;
1026
+ var rgba;
1027
+ var swatchOpacity;
1028
+ var value;
1029
+
1030
+ if(!input.data('minicolors-initialized')) return;
1031
+
1032
+ // Get array of lowercase keywords
1033
+ keywords = !settings.keywords ? [] : $.map(settings.keywords.split(','), function(a) {
1034
+ return $.trim(a.toLowerCase());
1035
+ });
1036
+
1037
+ // Set color string
1038
+ if(input.val() !== '' && $.inArray(input.val().toLowerCase(), keywords) > -1) {
1039
+ value = input.val();
1040
+ } else {
1041
+ // Get RGBA values for easy conversion
1042
+ if(isRgb(input.val())) {
1043
+ rgba = parseRgb(input.val(), true);
1044
+ } else {
1045
+ hex = parseHex(input.val(), true);
1046
+ rgba = hex ? hex2rgb(hex) : null;
1047
+ }
1048
+
1049
+ // Convert to format
1050
+ if(rgba === null) {
1051
+ value = settings.defaultValue;
1052
+ } else if(settings.format === 'rgb') {
1053
+ value = settings.opacity ?
1054
+ parseRgb('rgba(' + rgba.r + ',' + rgba.g + ',' + rgba.b + ',' + input.attr('data-opacity') + ')') :
1055
+ parseRgb('rgb(' + rgba.r + ',' + rgba.g + ',' + rgba.b + ')');
1056
+ } else {
1057
+ value = rgb2hex(rgba);
1058
+ }
1059
+ }
1060
+
1061
+ // Update swatch opacity
1062
+ swatchOpacity = settings.opacity ? input.attr('data-opacity') : 1;
1063
+ if(value.toLowerCase() === 'transparent') swatchOpacity = 0;
1064
+ input
1065
+ .closest('.minicolors')
1066
+ .find('.minicolors-input-swatch > span')
1067
+ .css('opacity', swatchOpacity);
1068
+
1069
+ // Set input value
1070
+ input.val(value);
1071
+
1072
+ // Is it blank?
1073
+ if(input.val() === '') input.val(parseInput(settings.defaultValue, true));
1074
+
1075
+ // Adjust case
1076
+ input.val(convertCase(input.val(), settings.letterCase));
1077
+
1078
+ })
1079
+ // Handle keypresses
1080
+ .on('keydown.minicolors', '.minicolors-input', function(event) {
1081
+ var input = $(this);
1082
+ if(!input.data('minicolors-initialized')) return;
1083
+ switch(event.keyCode) {
1084
+ case 9: // tab
1085
+ hide();
1086
+ break;
1087
+ case 13: // enter
1088
+ case 27: // esc
1089
+ hide();
1090
+ input.blur();
1091
+ break;
1092
+ }
1093
+ })
1094
+ // Update on keyup
1095
+ .on('keyup.minicolors', '.minicolors-input', function() {
1096
+ var input = $(this);
1097
+ if(!input.data('minicolors-initialized')) return;
1098
+ updateFromInput(input, true);
1099
+ })
1100
+ // Update on paste
1101
+ .on('paste.minicolors', '.minicolors-input', function() {
1102
+ var input = $(this);
1103
+ if(!input.data('minicolors-initialized')) return;
1104
+ setTimeout(function() {
1105
+ updateFromInput(input, true);
1106
+ }, 1);
1107
+ });
1108
+ }));
languages/insert-post-ads.pot CHANGED
File without changes
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: insertpostads
3
  Tags: ad injection, ads, ads plugin, adsense, adsense injection, google adsense, insert ads in post, insert post ads, wordpress ads plugin, advertising plugin, banners plugin, post ads
4
  Requires at least: 3.6
5
- Tested up to: 4.8
6
- Stable tag: 1.1.2
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -69,6 +69,11 @@ Thank you
69
 
70
  == Changelog ==
71
 
 
 
 
 
 
72
  = 1.1.2 =
73
  * Change the insert 'ad after para# N' container to a random classname to prevent adblockers from blocking it
74
  * In the ad creation page, hide the paragraph# input field when the position in the dropdown are top or bottom
2
  Contributors: insertpostads
3
  Tags: ad injection, ads, ads plugin, adsense, adsense injection, google adsense, insert ads in post, insert post ads, wordpress ads plugin, advertising plugin, banners plugin, post ads
4
  Requires at least: 3.6
5
+ Tested up to: 4.9.1
6
+ Stable tag: 1.2
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
69
 
70
  == Changelog ==
71
 
72
+ = 1.2 =
73
+ * This update features vi stories from video intelligence - a video player that supplies both content and video advertising. Watch a demo: http://demo.vi.ai/ViewsterBlog_Nintendo.html
74
+ Read the FAQ: https://www.vi.ai/frequently-asked-questions-vi-stories-for-wordpress/?utm_source=WordPress&utm_medium=Plugin%20FAQ&utm_campaign=WP%20insertpostads
75
+ * New: Compatible up to WP 4.9.1
76
+
77
  = 1.1.2 =
78
  * Change the insert 'ad after para# N' container to a random classname to prevent adblockers from blocking it
79
  * In the ad creation page, hide the paragraph# input field when the position in the dropdown are top or bottom
rules.php ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $wpInsertPostInstance;
3
+ $wpInsertABTestingMode;
4
+ /* Begin Assign Instance Identifier */
5
+ add_action('the_content', 'insert_ads_track_post_instance', 1);
6
+ function insert_ads_track_post_instance($content) {
7
+ global $wpInsertPostInstance;
8
+ if(is_main_query()) {
9
+ if($wpInsertPostInstance == '') {
10
+ $wpInsertPostInstance = 1;
11
+ } else {
12
+ $wpInsertPostInstance++;
13
+ }
14
+ }
15
+ return $content;
16
+ }
17
+ /* End Assign Instance Identifier */
18
+
19
+ /* Begin Assign AB Testing Mode */
20
+ add_action('wp', 'insert_ads_track_ad_instance', 1);
21
+ function insert_ads_track_ad_instance() {
22
+ global $wpInsertABTestingMode;
23
+ $abtestingMode = get_option('insert_ads_abtesting_mode');
24
+ if(isset($abtestingMode)) {
25
+ $wpInsertABTestingMode = rand(1, floatval($abtestingMode));
26
+ } else {
27
+ $wpInsertABTestingMode = 1;
28
+ }
29
+ }
30
+ /* End Assign AB Testing Mode */
31
+
32
+ /* Begin Get Current Page Type */
33
+ function insert_ads_get_page_details() {
34
+ global $post;
35
+ $page_details = array(
36
+ 'type' => 'POST',
37
+ 'ID' => (isset($post->ID)?$post->ID:'')
38
+ );
39
+ if(is_home() || is_front_page()) {
40
+ $page_details['type'] = 'HOME';
41
+ } else if(is_category()) {
42
+ $page_details['type'] = 'CATEGORY';
43
+ $page_details['ID'] = get_query_var('cat');
44
+ } else if(is_archive()) {
45
+ $page_details['type'] = 'ARCHIVE';
46
+ } else if(is_search()) {
47
+ $page_details['type'] = 'SEARCH';
48
+ } else if(is_page()) {
49
+ $page_details['type'] = 'PAGE';
50
+ } else if(is_single()) {
51
+ if(is_singular('post')) {
52
+ $page_details['type'] = 'POST';
53
+ $page_details['categories'] = wp_get_post_categories($page_details['ID']);
54
+ } else {
55
+ $page_details['type'] = 'CUSTOM';
56
+ $page_details['type_name'] = $post->post_type;
57
+ }
58
+ } else if(is_404()) {
59
+ $page_details['type'] = '404';
60
+ }
61
+ return $page_details;
62
+ }
63
+ /* End Get Current Page Type */
64
+
65
+ /* Begin Get Ad Status */
66
+ function insert_ads_get_ad_status($rules) {
67
+ if(!isset($rules)) { return false; }
68
+
69
+ if(!$rules['status']) {
70
+ return false;
71
+ }
72
+
73
+ if(isset($rules['rules_exclude_loggedin']) && wp_validate_boolean($rules['rules_exclude_loggedin']) && is_user_logged_in()) {
74
+ return false;
75
+ }
76
+
77
+ if(isset($rules['rules_exclude_mobile_devices']) && wp_validate_boolean($rules['rules_exclude_mobile_devices']) && wp_is_mobile()) {
78
+ return false;
79
+ }
80
+
81
+ global $wpInsertPostInstance;
82
+ $page_details = insert_ads_get_page_details();
83
+ switch($page_details['type']) {
84
+ case 'HOME':
85
+ if(isset($rules['rules_exclude_home']) && wp_validate_boolean($rules['rules_exclude_home']) ) {
86
+ return false;
87
+ } else if(isset($rules['rules_home_instances']) && is_array($rules['rules_home_instances']) && (in_array($wpInsertPostInstance, $rules['rules_home_instances']))) {
88
+ return false;
89
+ }
90
+ break;
91
+ case 'ARCHIVE':
92
+ if(isset($rules['rules_exclude_archives']) && wp_validate_boolean($rules['rules_exclude_archives']) ) {
93
+ return false;
94
+ } else if(isset($rules['rules_archives_instances']) && is_array($rules['rules_archives_instances']) && (in_array($wpInsertPostInstance, $rules['rules_archives_instances']))) {
95
+ return false;
96
+ }
97
+ break;
98
+ case 'SEARCH':
99
+ if(isset($rules['rules_exclude_search']) && wp_validate_boolean($rules['rules_exclude_search']) ) {
100
+ return false;
101
+ } else if(isset($rules['rules_search_instances']) && is_array($rules['rules_search_instances']) && (in_array($wpInsertPostInstance, $rules['rules_search_instances']))) {
102
+ return false;
103
+ }
104
+ break;
105
+ case 'PAGE':
106
+ if(isset($rules['rules_exclude_page']) && wp_validate_boolean($rules['rules_exclude_page']) ) {
107
+ return false;
108
+ } else if(isset($rules['rules_page_exceptions']) && is_array($rules['rules_page_exceptions']) && (in_array($page_details['ID'], $rules['rules_page_exceptions']))) {
109
+ return false;
110
+ }
111
+ break;
112
+ case 'POST':
113
+ if(isset($rules['rules_exclude_post']) && wp_validate_boolean($rules['rules_exclude_post']) ) {
114
+ return false;
115
+ } else if(isset($rules['rules_post_exceptions']) && is_array($rules['rules_post_exceptions']) && (in_array($page_details['ID'], $rules['rules_post_exceptions']))) {
116
+ return false;
117
+ } else if(isset($rules['rules_post_categories_exceptions']) && isset($page_details['categories']) && is_array($rules['rules_post_categories_exceptions']) && is_array($page_details['categories']) && (count(array_intersect($page_details['categories'], $rules['rules_post_categories_exceptions'])) > 0)) {
118
+ return false;
119
+ }
120
+ break;
121
+ case 'CATEGORY':
122
+ if(isset($rules['rules_exclude_categories']) && wp_validate_boolean($rules['rules_exclude_categories']) ) {
123
+ return false;
124
+ } else if(isset($rules['rules_categories_exceptions']) && is_array($rules['rules_categories_exceptions']) && (in_array($page_details['ID'], $rules['rules_categories_exceptions']))) {
125
+ return false;
126
+ } else if(isset($rules['rules_categories_instances']) && is_array($rules['rules_categories_instances']) && (in_array($wpInsertPostInstance, $rules['rules_categories_instances']))) {
127
+ return false;
128
+ }
129
+ break;
130
+ case '404':
131
+ if(isset($rules['rules_exclude_404']) && wp_validate_boolean($rules['rules_exclude_404'])) {
132
+ return false;
133
+ }
134
+ break;
135
+ case 'CUSTOM':
136
+ if(isset($rules['rules_exclude_cpt_'.$page_details['type_name']]) && wp_validate_boolean($rules['rules_exclude_cpt_'.$page_details['type_name']])) {
137
+ return false;
138
+ }
139
+ break;
140
+ }
141
+ return true;
142
+ }
143
+ /* End Get Ad Status */
144
+ ?>
uninstall.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // if uninstall.php is not called by WordPress, die
3
+ if (!defined('WP_UNINSTALL_PLUGIN')) {
4
+ die;
5
+ }
6
+
7
+ $option_name = 'wporg_option';
8
+
9
+ delete_option($option_name);
10
+
11
+ // for site options in Multisite
12
+ delete_site_option($option_name);
13
+ // drop a custom database table
14
+ global $wpdb;
15
+ $prefix = $wpdb->prefix;
16
+ //$wpdb->query('UPDATE wp_usermeta SET meta_value = "" WHERE meta_key = "insert_ads_1.6_admin_notice_dismissed"');
17
+ $wpdb->query('DELETE FROM '.$prefix.'usermeta WHERE `meta_key` = "insert_ads_1.6_admin_notice_dismissed"');
18
+ ?>
vi-integration.php ADDED
@@ -0,0 +1,1230 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* Begin Add Card in Admin Panel */
3
+ add_action('insert_ads_plugin_card', 'insert_ads_vi_plugin_card', 5);
4
+ function insert_ads_vi_plugin_card() {
5
+ echo '<div class="plugin-card vi-card">';
6
+ if(insert_ads_vi_api_is_loggedin()) {
7
+ insert_ads_vi_plugin_card_content(true);
8
+ } else {
9
+ insert_ads_vi_plugin_card_content(false);
10
+ }
11
+ echo '</div>';
12
+ }
13
+
14
+ function insert_ads_vi_plugin_card_content($isLoggedin = false, $isAjaxRequest = false) {
15
+ if(!$isLoggedin) {
16
+ echo '<div class="plugin-card-top">';
17
+ echo '<div class="plugin-card-top-header">';
18
+ echo '<h4>Start earning with vi stories</h4>';
19
+ echo '</div>';
20
+ echo '<div class="plugin-card-top-content" '.(($isAjaxRequest)?'style="opacity: 0;"':'').'>';
21
+ echo '<p>Advertisers pay more for video advertising when it’s matched with video content. With vi stories you’ll see video content that is matched to your sites keywords straight away. It increases time on site, and commands a higher CPM than display advertising. A few days after activation you’ll begin to receive revenue from advertising served before this video content.</p>';
22
+ echo '<ul>';
23
+ echo '<li>The set up takes only a few minutes</li>';
24
+ echo '<li>Up to 10x higher CPM than traditional display advertising</li>';
25
+ echo '<li>Users spend longer on your site thanks to professional video content</li>';
26
+ echo '<li>The video player is customizable to match your site</li>';
27
+ echo '</ul>';
28
+ echo '<p>Sign up now to increase time-on-page, and your revenue thanks to high CPMs.</p>';
29
+ echo '</div>';
30
+ echo '</div>';
31
+ echo '<div class="plugin-card-bottom" '.(($isAjaxRequest)?'style="opacity: 0;"':'').'>';
32
+ echo '<span>By clicking sign up you agree to send your current domain, email and affiliate ID to video intelligence & Insert Post Ads.</span>';
33
+ echo '<a id="insert_ads_vi_login" href="javascript:;" class="button button-secondary">Log In</a>';
34
+ echo '<a id="insert_ads_vi_signup" href="javascript:;" class="button button-primary">Sign Up</a>';
35
+ echo '</div>';
36
+ echo '<input type="hidden" id="insert_ads_admin_ajax" name="insert_ads_admin_ajax" value="' . admin_url('admin-ajax.php') . '" /><input type="hidden" id="insert_ads_nonce" name="insert_ads_nonce" value="' . wp_create_nonce('insert-ads') . '" />';
37
+ } else {
38
+ $dashboardURL = insert_ads_vi_api_get_dashboardurl();
39
+ echo '<div class="plugin-card-top">';
40
+ echo '<div class="plugin-card-top-header">';
41
+ echo '<h4>Monetization with vi stories</h4>';
42
+ echo '</div>';
43
+ echo '<div class="plugin-card-top-content" '.(($isAjaxRequest)?'style="opacity: 0;"':'').'>';
44
+ echo '<p>Below you can see your current revenues. <span class="pl-right">Don’t see anything? Consult the <a target="_blank" href="https://www.vi.ai/frequently-asked-questions-vi-stories-for-wordpress/?utm_source=WordPress&utm_medium=Plugin%20FAQ&utm_campaign=WP%20insertpostads">FAQs</a>.</span></p>';
45
+ echo '<div id="insert_ads_vi_earnings_wrapper">';
46
+ echo '<div class="insert_ads_ajaxloader"></div>';
47
+ echo '</div>';
48
+ echo '</div>';
49
+ echo '</div>';
50
+ echo '<div class="plugin-card-bottom" '.(($isAjaxRequest)?'style="opacity: 0;"':'').'>';
51
+ echo '<input type="hidden" id="insert_ads_admin_ajax" name="insert_ads_admin_ajax" value="' . admin_url('admin-ajax.php') . '" /><input type="hidden" id="insert_ads_nonce" name="insert_ads_nonce" value="' . wp_create_nonce('insert-ads') . '" />';
52
+ echo '<a id="insert_ads_vi_dashboard" href="'.$dashboardURL.'" target="_blank" class="button button-primary alignleft">Publisher Dashboard</a>';
53
+ echo '<a id="insert_ads_vi_customize_adcode" href="javascript:;" class="button button-primary alignleft">Configure vi code</a>';
54
+ echo '<a id="insert_ads_vi_logout" href="javascript:;" class="button button-secondary">Log Out</a>';
55
+ echo '</div>';
56
+ }
57
+ }
58
+
59
+ add_action('wp_ajax_insert_ads_vi_get_chart', 'insert_ads_vi_get_chart');
60
+ function insert_ads_vi_get_chart() {
61
+ check_ajax_referer('insert-ads', 'insert_ads_nonce');
62
+ $revenueData = insert_ads_vi_api_get_revenue_data();
63
+ if(isset($revenueData) && is_array($revenueData)) {
64
+ echo '###SUCCESS###';
65
+ echo '<div id="insert_ads_vi_earnings">';
66
+ echo '<span id="insert_ads_vi_earnings_label">Total Earnings</span>';
67
+ echo '<span id="insert_ads_vi_earnings_value">$'.$revenueData['netRevenue'].'</span>';
68
+ echo '</div>';
69
+ echo '<div id="insert_ads_vi_chart_wrapper">';
70
+ echo '<canvas id="insert_ads_vi_chart" width="348" height="139"></canvas>';
71
+ echo '<textarea id="insert_ads_vi_chart_data" style="display: none;">[';
72
+ if(isset($revenueData['mtdReport']) && is_array($revenueData['mtdReport']) & (count($revenueData['mtdReport']) > 0)) {
73
+ $isFirstItem = true;
74
+ foreach($revenueData['mtdReport'] as $reportData) {
75
+ if(!$isFirstItem) {
76
+ echo ',';
77
+ }
78
+ $date = DateTime::createFromFormat('d-m-Y', $reportData['date']);
79
+ echo '{"x": "'.$date->format('m/d/Y').'", "y": "'.$reportData['revenue'].'"}';
80
+ $isFirstItem = false;;
81
+ }
82
+ } else {
83
+ echo '{"x": "'.date('m/d/Y').'", "y": "0.00"}';
84
+ }
85
+ echo ']</textarea>';
86
+ echo '</div>';
87
+ echo '<div class="clear"></div>';
88
+ } else {
89
+ echo '<p class="viError">There was an error processing your request, our team was notified.<br />Please try again later.</p>';
90
+ echo '<div id="insert_ads_vi_earnings_wrapper">';
91
+ echo '<div id="insert_ads_vi_earnings">';
92
+ echo '<span id="insert_ads_vi_earnings_label">Total Earnings</span>';
93
+ echo '<span id="insert_ads_vi_earnings_value"><img src="'.WP_INSADS_URL.'images/vi-no-data.jpg?'.WP_INSADS_VERSION.'"></span>';
94
+ echo '</div>';
95
+ echo '<div id="insert_ads_vi_chart_wrapper">';
96
+ echo '<img width="348" height="139" src="'.WP_INSADS_URL.'images/vi-empty-graph.jpg?'.WP_INSADS_VERSION.'">';
97
+ echo '</div>';
98
+ echo '<div class="clear"></div>';
99
+ echo '</div>';
100
+ }
101
+ die();
102
+ }
103
+ /* End Add Card in Admin Panel */
104
+
105
+ /* Begin Signup Form */
106
+ add_action('wp_ajax_insert_ads_vi_signup_form_get_content', 'insert_ads_vi_signup_form_get_content');
107
+ function insert_ads_vi_signup_form_get_content() {
108
+ check_ajax_referer('insert-ads', 'insert_ads_nonce');
109
+ $signupURL = insert_ads_vi_api_get_signupurl();
110
+ if(true) {
111
+ echo '<div class="insert_ads_popup_content_wrapper">';
112
+ echo '<iframe src="https://www.vi.ai/publisher-registration/?email='.get_bloginfo('admin_email').'&domain='.get_bloginfo('url').'&aid=WP_insertpostads&utm_source=Wordpress&utm_medium=wp_insertpostads&utm_campaign=white&utm_content=Wp_insertpostads" style="width: 100%; max-width: 870px; min-height: 554px;"></iframe>';
113
+ echo '<script type="text/javascript">';
114
+ echo 'jQuery(".ui-dialog-buttonset").find("button").first().remove();';
115
+ echo 'jQuery(".ui-dialog-buttonset").find("button").first().find("span:nth-child(2)").hide().after("<span class=\'ui-button-text\'>Close</span>");';
116
+ echo "";
117
+ echo '</script>';
118
+ echo '</div>';
119
+ } else {
120
+ echo '<div class="insert_ads_popup_content_wrapper">';
121
+ echo '<p> There was an error processing your request. Please try again later. </p>';
122
+ echo '</div>';
123
+ }
124
+ die();
125
+ }
126
+ /* End Signup Form */
127
+
128
+ /* Begin Login Form */
129
+ add_action('wp_ajax_insert_ads_vi_login_form_get_content', 'insert_ads_vi_login_form_get_content');
130
+ function insert_ads_vi_login_form_get_content() {
131
+ check_ajax_referer('insert-ads', 'insert_ads_nonce');
132
+ echo '<div class="insert_ads_popup_content_wrapper">';
133
+ echo '<div class="insert_ads_vi_loginform_wrapper">';
134
+ insert_ads_vi_login_form_get_controls();
135
+ echo '</div>';
136
+ echo '<script type="text/javascript">';
137
+ echo $control->JS;
138
+ echo 'jQuery(".ui-dialog-buttonset").find("button").first().find("span:nth-child(2)").hide().after("<span class=\'ui-button-text\'>Login</span>");';
139
+ echo 'jQuery(".ui-dialog-buttonset").find("button").first().find("span:nth-child(1)").attr("class", "ui-button-icon-primary ui-icon ui-icon-key");';
140
+ echo '</script>';
141
+ echo '</div>';
142
+ die();
143
+ }
144
+
145
+ add_action('wp_ajax_insert_ads_vi_login_form_save_action', 'insert_ads_vi_login_form_save_action');
146
+ function insert_ads_vi_login_form_save_action() {
147
+ check_ajax_referer('insert-ads', 'insert_ads_nonce');
148
+ if(isset($_POST['insert_ads_vi_login_username']) && ($_POST['insert_ads_vi_login_username'] != '') && isset($_POST['insert_ads_vi_login_password']) && ($_POST['insert_ads_vi_login_password'] != '')) {
149
+ $token = insert_ads_vi_api_login($_POST['insert_ads_vi_login_username'], $_POST['insert_ads_vi_login_password']);
150
+ if(is_array($token) && (isset($token['status'])) && ($token['status'] == 'error')) {
151
+ insert_ads_vi_login_form_get_controls();
152
+ if($token['errorCode'] == 'WIVI008') {
153
+ echo '<p class="insert_ads_vi_login_error">'.$token['message'].'</p>';
154
+ } else {
155
+ echo '<p class="insert_ads_vi_login_error">Error Code: '.$token['errorCode'].'<br />Please contact support or try again later!'.'</p>';
156
+ }
157
+ } else {
158
+ echo '###SUCCESS###';
159
+ insert_ads_vi_plugin_card_content(true, true);
160
+ }
161
+ }
162
+ die();
163
+ }
164
+
165
+ function insert_ads_vi_login_form_get_controls() {
166
+ $control = new smartlogix();
167
+ $control->HTML .= '<p>Please log in with the received credentials to complete the integration:</p>';
168
+ $control->add_control(array('type' => 'text', 'id' => 'insert_ads_vi_login_username', 'name' => 'insert_ads_vi_login_username', 'label' => 'Email', 'value' => ''));
169
+ $control->add_control(array('type' => 'password', 'id' => 'insert_ads_vi_login_password', 'name' => 'insert_ads_vi_login_password', 'label' => 'Password', 'value' => ''));
170
+ $control->create_section('Login');
171
+ echo $control->HTML;
172
+ }
173
+
174
+ add_action('wp_ajax_insert_ads_vi_update_adstxt', 'insert_ads_vi_update_adstxt');
175
+ function insert_ads_vi_update_adstxt() {
176
+ check_ajax_referer('insert-ads', 'insert_ads_nonce');
177
+
178
+ $adstxtContent = insert_ads_adstxt_get_content();
179
+ $adstxtContentData = array_filter(explode("\n", trim($adstxtContent)), 'trim');
180
+ $viEntry = insert_ads_vi_api_get_adstxt_content();
181
+ if(strpos(str_replace(array("\r", "\n", " "), '', $adstxtContent), str_replace(array("\r", "\n", " "), '', $viEntry)) !== false) {
182
+ die();
183
+ } else {
184
+ $updatedAdstxtContent = '';
185
+ if(strpos($adstxtContent, '# 41b5eef6') !== false) {
186
+ foreach($adstxtContentData as $line) {
187
+ if(strpos($line, '# 41b5eef6') !== false) {
188
+
189
+ } else {
190
+ $updatedAdstxtContent .= str_replace(array("\r", "\n", " "), '', $line)."\r\n";
191
+ }
192
+ }
193
+ $updatedAdstxtContent .= $viEntry;
194
+ } else {
195
+ $updatedAdstxtContent .= $adstxtContent."\r\n".$viEntry;
196
+ }
197
+
198
+ if(insert_ads_adstxt_update_content($updatedAdstxtContent)) {
199
+ echo '###SUCCESS###';
200
+ echo '<div class="notice notice-warning insert_ads_adsstxt_notice is-dismissible" style="padding: 5px 15px;">';
201
+ echo '<div style="float: left; max-width: 875px; font-size: 14px; font-family: Arial; line-height: 18px; color: #232323;">';
202
+ echo '<p><b>ADS.TXT has been added</b></p>';
203
+ echo '<p>Wp-Insert has updated your ads.txt file with lines that declare video intelligence as a legitimate seller of your inventory and enables you to make more money through video intelligence. Read the <a target="_blank" href="https://www.vi.ai/frequently-asked-questions-vi-stories-for-wordpress/?utm_source=WordPress&utm_medium=Plugin%20FAQ&utm_campaign=WP%20Insert">FAQ</a>.</p>';
204
+ echo '</div>';
205
+ echo '<img style="float: right; margin-right: 20px; margin-top: 13px;" src="'.WP_INSADS_URL.'images/vi-big-logo.png?'.WP_INSADS_VERSION.'" />';
206
+ echo '<div class="clear"></div>';
207
+ echo '<button type="button" class="notice-dismiss" onclick="javascript:jQuery(this).parent().remove()"><span class="screen-reader-text">Dismiss this notice.</span></button>';
208
+ echo '</div>';
209
+ } else {
210
+ echo '###FAIL###';
211
+ echo '<div class="notice notice-error insert_ads_adsstxt_notice is-dismissible" style="padding: 5px 15px;">';
212
+ echo '<div style="float: left; max-width: 875px; font-size: 14px; font-family: Arial; line-height: 18px; color: #232323;">';
213
+ echo '<p><b>ADS.TXT couldn’t be added</b></p>';
214
+ echo '<p>Important note: Wp-Insert hasn’t been able to update your ads.txt file. Please make sure that you enter the following lines manually:</p>';
215
+ echo '<p><code style="display: block;">'.trim(str_replace(array("\r\n", "\r", "\n"), "<br />", $viEntry)).'</code><br />Only by doing so, you\'ll be able to make more money through video intelligence (vi.ai).</p>';
216
+ echo '</div>';
217
+ echo '<img style="float: right; margin-right: 20px; margin-top: 13px;" src="'.WP_INSADS_URL.'images/vi-big-logo.png?'.WP_INSADS_VERSION.'" />';
218
+ echo '<div class="clear"></div>';
219
+ echo '<button type="button" class="notice-dismiss" onclick="javascript:jQuery(this).parent().remove()"><span class="screen-reader-text">Dismiss this notice.</span></button>';
220
+ echo '</div>';
221
+ }
222
+ }
223
+ die();
224
+ }
225
+ /* End Login Form */
226
+
227
+ /* Begin Logout */
228
+ add_action('wp_ajax_insert_ads_vi_logout_action', 'insert_ads_vi_logout_action');
229
+ function insert_ads_vi_logout_action() {
230
+ check_ajax_referer('insert-ads', 'insert_ads_nonce');
231
+ insert_ads_vi_api_logout();
232
+ echo '###SUCCESS###';
233
+ insert_ads_vi_plugin_card_content(false, true);
234
+ die();
235
+ }
236
+ /* End Logout */
237
+
238
+ /* Begin Configure vi Code */
239
+ add_action('wp_ajax_insert_ads_vi_customize_adcode_form_get_content', 'insert_ads_vi_customize_adcode_form_get_content');
240
+ function insert_ads_vi_customize_adcode_form_get_content() {
241
+ check_ajax_referer('insert-ads', 'insert_ads_nonce');
242
+ $vicodeSettings = get_option('insert_ads_vi_code_settings');
243
+ $control = new smartlogix(array('optionIdentifier' => 'insert_ads_vi_code_settings', 'values' => $vicodeSettings));
244
+ $control->HTML = '<div class="insert_ads_popup_content_wrapper">';
245
+ $control->HTML .= '<p>Use this form to customize the look of the video unit. Use the same parameters as your WordPress theme for a natural look on your site.<br />You can use <b>vi stories</b> for <i>In-Post Ads: Ad - Above Post Content</i> and <i>In-Post Ads: Ad - Middle of Post Content</i></p>';
246
+ $control->HTML .= '<div class="insert_ads_vi_popup_right_column">';
247
+ $control->HTML .= '<img style="margin: 0 auto; display: block;" src="'.WP_INSADS_URL.'images/advertisement-preview.png?'.WP_INSADS_VERSION.'" />';
248
+ $control->HTML .= '</div>';
249
+ $control->HTML .= '<div class="insert_ads_vi_popup_left_column">';
250
+ $control->HTML .= '<p id="insert_ads_vi_customize_adcode_keywords_required_error" style="display: none;" class="viError">Keywords contains invalid characters, Some required fields are missing</p>';
251
+ $control->HTML .= '<p id="insert_ads_vi_customize_adcode_keywords_error" style="display: none;" class="viError">Keywords contains invalid characters</p>';
252
+ $control->HTML .= '<p id="insert_ads_vi_customize_adcode_required_error" style="display: none;" class="viError">Some required fields are missing</p>';
253
+ $adUnitOptions = array(
254
+ /*array('text' => 'Select Ad Unit', 'value' => 'select'),*/
255
+ array('text' => 'vi stories', 'value' => 'NATIVE_VIDEO_UNIT'),
256
+ /*array('text' => 'Outstream', 'value' => 'FLOATING_OUTSTREAM')*/
257
+ );
258
+ $control->add_control(array('type' => 'select', 'label' => ' Ad Unit*', 'optionName' => 'ad_unit_type', 'helpText' => '</small><span class="tooltipWrapper"><span class="tooltip">- vi stories (video advertising + video content)</span></span><small>', 'options' => $adUnitOptions));/*<br />- out-stream (video advertising)*/
259
+ $control->add_control(array('type' => 'textarea', 'label' => 'Keywords', 'optionName' => 'keywords', 'helpText' => '</small><span class="tooltipWrapper"><span class="tooltip">Comma separated values describing the content of the page e.g. \'cooking, grilling, pulled pork\'</span></span><small>'));
260
+ $IABParentCategories = array(
261
+ array('text' => 'Select tier 1 category', 'value' => 'select'),
262
+ array('text' => 'Arts & Entertainment', 'value' => 'IAB1'),
263
+ array('text' => 'Automotive', 'value' => 'IAB2'),
264
+ array('text' => 'Business', 'value' => 'IAB3'),
265
+ array('text' => 'Careers', 'value' => 'IAB4'),
266
+ array('text' => 'Education', 'value' => 'IAB5'),
267
+ array('text' => 'Family & Parenting', 'value' => 'IAB6'),
268
+ array('text' => 'Health & Fitness', 'value' => 'IAB7'),
269
+ array('text' => 'Food & Drink', 'value' => 'IAB8'),
270
+ array('text' => 'Hobbies & Interests', 'value' => 'IAB9'),
271
+ array('text' => 'Home & Garden', 'value' => 'IAB10'),
272
+ array('text' => 'Law, Gov’t & Politics', 'value' => 'IAB11'),
273
+ array('text' => 'News', 'value' => 'IAB12'),
274
+ array('text' => 'Personal Finance', 'value' => 'IAB13'),
275
+ array('text' => 'Society', 'value' => 'IAB14'),
276
+ array('text' => 'Science', 'value' => 'IAB15'),
277
+ array('text' => 'Pets', 'value' => 'IAB16'),
278
+ array('text' => 'Sports', 'value' => 'IAB17'),
279
+ array('text' => 'Style & Fashion', 'value' => 'IAB18'),
280
+ array('text' => 'Technology & Computing', 'value' => 'IAB19'),
281
+ array('text' => 'Travel', 'value' => 'IAB20'),
282
+ array('text' => 'Real Estate', 'value' => 'IAB21'),
283
+ array('text' => 'Shopping', 'value' => 'IAB22'),
284
+ array('text' => 'Religion & Spirituality', 'value' => 'IAB23'),
285
+ array('text' => 'Uncategorized', 'value' => 'IAB24'),
286
+ array('text' => 'Non-Standard Content', 'value' => 'IAB25'),
287
+ array('text' => 'Illegal Content', 'value' => 'IAB26')
288
+ );
289
+ $control->add_control(array('type' => 'select', 'label' => 'IAB Category*', 'optionName' => 'iab_category_parent', 'helpText' => '</small><a class="textTip" target="_blank" href="'.insert_ads_vi_api_get_iabCategoriesURL().'">See Complete List</a><small>', 'options' => $IABParentCategories));
290
+ $IABChildCategories = array(
291
+ array('text' => 'Select tier 2 category', 'value' => 'select'),
292
+ array('text' => 'Books & Literature', 'value' => 'IAB1-1', 'metadata' => array('parent' => 'IAB1')),
293
+ array('text' => 'Celebrity Fan/Gossip', 'value' => 'IAB1-2', 'metadata' => array('parent' => 'IAB1')),
294
+ array('text' => 'Fine Art', 'value' => 'IAB1-3', 'metadata' => array('parent' => 'IAB1')),
295
+ array('text' => 'Humor', 'value' => 'IAB1-4', 'metadata' => array('parent' => 'IAB1')),
296
+ array('text' => 'Movies', 'value' => 'IAB1-5', 'metadata' => array('parent' => 'IAB1')),
297
+ array('text' => 'Music', 'value' => 'IAB1-6', 'metadata' => array('parent' => 'IAB1')),
298
+ array('text' => 'Television', 'value' => 'IAB1-7', 'metadata' => array('parent' => 'IAB1')),
299
+ array('text' => 'Auto Parts', 'value' => 'IAB2-1', 'metadata' => array('parent' => 'IAB2')),
300
+ array('text' => 'Auto Repair', 'value' => 'IAB2-2', 'metadata' => array('parent' => 'IAB2')),
301
+ array('text' => 'Buying/Selling Cars', 'value' => 'IAB2-3', 'metadata' => array('parent' => 'IAB2')),
302
+ array('text' => 'Car Culture', 'value' => 'IAB2-4', 'metadata' => array('parent' => 'IAB2')),
303
+ array('text' => 'Certified Pre-Owned', 'value' => 'IAB2-5', 'metadata' => array('parent' => 'IAB2')),
304
+ array('text' => 'Convertible', 'value' => 'IAB2-6', 'metadata' => array('parent' => 'IAB2')),
305
+ array('text' => 'Coupe', 'value' => 'IAB2-7', 'metadata' => array('parent' => 'IAB2')),
306
+ array('text' => 'Crossover', 'value' => 'IAB2-8', 'metadata' => array('parent' => 'IAB2')),
307
+ array('text' => 'Diesel', 'value' => 'IAB2-9', 'metadata' => array('parent' => 'IAB2')),
308
+ array('text' => 'Electric Vehicle', 'value' => 'IAB2-10', 'metadata' => array('parent' => 'IAB2')),
309
+ array('text' => 'Hatchback', 'value' => 'IAB2-11', 'metadata' => array('parent' => 'IAB2')),
310
+ array('text' => 'Hybrid', 'value' => 'IAB2-12', 'metadata' => array('parent' => 'IAB2')),
311
+ array('text' => 'Luxury', 'value' => 'IAB2-13', 'metadata' => array('parent' => 'IAB2')),
312
+ array('text' => 'MiniVan', 'value' => 'IAB2-14', 'metadata' => array('parent' => 'IAB2')),
313
+ array('text' => 'Mororcycles', 'value' => 'IAB2-15', 'metadata' => array('parent' => 'IAB2')),
314
+ array('text' => 'Off-Road Vehicles', 'value' => 'IAB2-16', 'metadata' => array('parent' => 'IAB2')),
315
+ array('text' => 'Performance Vehicles', 'value' => 'IAB2-17', 'metadata' => array('parent' => 'IAB2')),
316
+ array('text' => 'Pickup', 'value' => 'IAB2-18', 'metadata' => array('parent' => 'IAB2')),
317
+ array('text' => 'Road-Side Assistance', 'value' => 'IAB2-19', 'metadata' => array('parent' => 'IAB2')),
318
+ array('text' => 'Sedan', 'value' => 'IAB2-20', 'metadata' => array('parent' => 'IAB2')),
319
+ array('text' => 'Trucks & Accessories', 'value' => 'IAB2-21', 'metadata' => array('parent' => 'IAB2')),
320
+ array('text' => 'Vintage Cars', 'value' => 'IAB2-22', 'metadata' => array('parent' => 'IAB2')),
321
+ array('text' => 'Wagon', 'value' => 'IAB2-23', 'metadata' => array('parent' => 'IAB2')),
322
+ array('text' => 'Advertising', 'value' => 'IAB3-1', 'metadata' => array('parent' => 'IAB3')),
323
+ array('text' => 'Agriculture', 'value' => 'IAB3-2', 'metadata' => array('parent' => 'IAB3')),
324
+ array('text' => 'Biotech/Biomedical', 'value' => 'IAB3-3', 'metadata' => array('parent' => 'IAB3')),
325
+ array('text' => 'Business Software', 'value' => 'IAB3-4', 'metadata' => array('parent' => 'IAB3')),
326
+ array('text' => 'Construction', 'value' => 'IAB3-5', 'metadata' => array('parent' => 'IAB3')),
327
+ array('text' => 'Forestry', 'value' => 'IAB3-6', 'metadata' => array('parent' => 'IAB3')),
328
+ array('text' => 'Government', 'value' => 'IAB3-7', 'metadata' => array('parent' => 'IAB3')),
329
+ array('text' => 'Green Solutions', 'value' => 'IAB3-8', 'metadata' => array('parent' => 'IAB3')),
330
+ array('text' => 'Human Resources', 'value' => 'IAB3-9', 'metadata' => array('parent' => 'IAB3')),
331
+ array('text' => 'Logistics', 'value' => 'IAB3-10', 'metadata' => array('parent' => 'IAB3')),
332
+ array('text' => 'Marketing', 'value' => 'IAB3-11', 'metadata' => array('parent' => 'IAB3')),
333
+ array('text' => 'Metals', 'value' => 'IAB3-12', 'metadata' => array('parent' => 'IAB3')),
334
+ array('text' => 'Career Planning', 'value' => 'IAB4-1', 'metadata' => array('parent' => 'IAB4')),
335
+ array('text' => 'College', 'value' => 'IAB4-2', 'metadata' => array('parent' => 'IAB4')),
336
+ array('text' => 'Financial Aid', 'value' => 'IAB4-3', 'metadata' => array('parent' => 'IAB4')),
337
+ array('text' => 'Job Fairs', 'value' => 'IAB4-4', 'metadata' => array('parent' => 'IAB4')),
338
+ array('text' => 'Job Search', 'value' => 'IAB4-5', 'metadata' => array('parent' => 'IAB4')),
339
+ array('text' => 'Resume Writing/Advice', 'value' => 'IAB4-6', 'metadata' => array('parent' => 'IAB4')),
340
+ array('text' => 'Nursing', 'value' => 'IAB4-7', 'metadata' => array('parent' => 'IAB4')),
341
+ array('text' => 'Scholarships', 'value' => 'IAB4-8', 'metadata' => array('parent' => 'IAB4')),
342
+ array('text' => 'Telecommuting', 'value' => 'IAB4-9', 'metadata' => array('parent' => 'IAB4')),
343
+ array('text' => 'U.S. Military', 'value' => 'IAB4-10', 'metadata' => array('parent' => 'IAB4')),
344
+ array('text' => 'Career Advice', 'value' => 'IAB4-11', 'metadata' => array('parent' => 'IAB4')),
345
+ array('text' => '7-12 Education', 'value' => 'IAB5-1', 'metadata' => array('parent' => 'IAB5')),
346
+ array('text' => 'Adult Education', 'value' => 'IAB5-2', 'metadata' => array('parent' => 'IAB5')),
347
+ array('text' => 'Art History', 'value' => 'IAB5-3', 'metadata' => array('parent' => 'IAB5')),
348
+ array('text' => 'Colledge Administration', 'value' => 'IAB5-4', 'metadata' => array('parent' => 'IAB5')),
349
+ array('text' => 'College Life', 'value' => 'IAB5-5', 'metadata' => array('parent' => 'IAB5')),
350
+ array('text' => 'Distance Learning', 'value' => 'IAB5-6', 'metadata' => array('parent' => 'IAB5')),
351
+ array('text' => 'English as a 2nd Language', 'value' => 'IAB5-7', 'metadata' => array('parent' => 'IAB5')),
352
+ array('text' => 'Language Learning', 'value' => 'IAB5-8', 'metadata' => array('parent' => 'IAB5')),
353
+ array('text' => 'Graduate School', 'value' => 'IAB5-9', 'metadata' => array('parent' => 'IAB5')),
354
+ array('text' => 'Homeschooling', 'value' => 'IAB5-10', 'metadata' => array('parent' => 'IAB5')),
355
+ array('text' => 'Homework/Study Tips', 'value' => 'IAB5-11', 'metadata' => array('parent' => 'IAB5')),
356
+ array('text' => 'K-6 Educators', 'value' => 'IAB5-12', 'metadata' => array('parent' => 'IAB5')),
357
+ array('text' => 'Private School', 'value' => 'IAB5-13', 'metadata' => array('parent' => 'IAB5')),
358
+ array('text' => 'Special Education', 'value' => 'IAB5-14', 'metadata' => array('parent' => 'IAB5')),
359
+ array('text' => 'Studying Business', 'value' => 'IAB5-15', 'metadata' => array('parent' => 'IAB5')),
360
+ array('text' => 'Adoption', 'value' => 'IAB6-1', 'metadata' => array('parent' => 'IAB6')),
361
+ array('text' => 'Babies & Toddlers', 'value' => 'IAB6-2', 'metadata' => array('parent' => 'IAB6')),
362
+ array('text' => 'Daycare/Pre School', 'value' => 'IAB6-3', 'metadata' => array('parent' => 'IAB6')),
363
+ array('text' => 'Family Internet', 'value' => 'IAB6-4', 'metadata' => array('parent' => 'IAB6')),
364
+ array('text' => 'Parenting – K-6 Kids', 'value' => 'IAB6-5', 'metadata' => array('parent' => 'IAB6')),
365
+ array('text' => 'Parenting teens', 'value' => 'IAB6-6', 'metadata' => array('parent' => 'IAB6')),
366
+ array('text' => 'Pregnancy', 'value' => 'IAB6-7', 'metadata' => array('parent' => 'IAB6')),
367
+ array('text' => 'Special Needs Kids', 'value' => 'IAB6-8', 'metadata' => array('parent' => 'IAB6')),
368
+ array('text' => 'Eldercare', 'value' => 'IAB6-9', 'metadata' => array('parent' => 'IAB6')),
369
+ array('text' => 'Exercise', 'value' => 'IAB7-1', 'metadata' => array('parent' => 'IAB7')),
370
+ array('text' => 'A.D.D.', 'value' => 'IAB7-2', 'metadata' => array('parent' => 'IAB7')),
371
+ array('text' => 'AIDS/HIV', 'value' => 'IAB7-3', 'metadata' => array('parent' => 'IAB7')),
372
+ array('text' => 'Allergies', 'value' => 'IAB7-4', 'metadata' => array('parent' => 'IAB7')),
373
+ array('text' => 'Alternative Medicine', 'value' => 'IAB7-5', 'metadata' => array('parent' => 'IAB7')),
374
+ array('text' => 'Arthritis', 'value' => 'IAB7-6', 'metadata' => array('parent' => 'IAB7')),
375
+ array('text' => 'Asthma', 'value' => 'IAB7-7', 'metadata' => array('parent' => 'IAB7')),
376
+ array('text' => 'Autism/PDD', 'value' => 'IAB7-8', 'metadata' => array('parent' => 'IAB7')),
377
+ array('text' => 'Bipolar Disorder', 'value' => 'IAB7-9', 'metadata' => array('parent' => 'IAB7')),
378
+ array('text' => 'Brain Tumor', 'value' => 'IAB7-10', 'metadata' => array('parent' => 'IAB7')),
379
+ array('text' => 'Cancer', 'value' => 'IAB7-11', 'metadata' => array('parent' => 'IAB7')),
380
+ array('text' => 'Cholesterol', 'value' => 'IAB7-12', 'metadata' => array('parent' => 'IAB7')),
381
+ array('text' => 'Chronic Fatigue Syndrome', 'value' => 'IAB7-13', 'metadata' => array('parent' => 'IAB7')),
382
+ array('text' => 'Chronic Pain', 'value' => 'IAB7-14', 'metadata' => array('parent' => 'IAB7')),
383
+ array('text' => 'Cold & Flu', 'value' => 'IAB7-15', 'metadata' => array('parent' => 'IAB7')),
384
+ array('text' => 'Deafness', 'value' => 'IAB7-16', 'metadata' => array('parent' => 'IAB7')),
385
+ array('text' => 'Dental Care', 'value' => 'IAB7-17', 'metadata' => array('parent' => 'IAB7')),
386
+ array('text' => 'Depression', 'value' => 'IAB7-18', 'metadata' => array('parent' => 'IAB7')),
387
+ array('text' => 'Dermatology', 'value' => 'IAB7-19', 'metadata' => array('parent' => 'IAB7')),
388
+ array('text' => 'Diabetes', 'value' => 'IAB7-20', 'metadata' => array('parent' => 'IAB7')),
389
+ array('text' => 'Epilepsy', 'value' => 'IAB7-21', 'metadata' => array('parent' => 'IAB7')),
390
+ array('text' => 'GERD/Acid Reflux', 'value' => 'IAB7-22', 'metadata' => array('parent' => 'IAB7')),
391
+ array('text' => 'Headaches/Migraines', 'value' => 'IAB7-23', 'metadata' => array('parent' => 'IAB7')),
392
+ array('text' => 'Heart Disease', 'value' => 'IAB7-24', 'metadata' => array('parent' => 'IAB7')),
393
+ array('text' => 'Herbs for Health', 'value' => 'IAB7-25', 'metadata' => array('parent' => 'IAB7')),
394
+ array('text' => 'Holistic Healing', 'value' => 'IAB7-26', 'metadata' => array('parent' => 'IAB7')),
395
+ array('text' => 'IBS/Crohn’s Disease', 'value' => 'IAB7-27', 'metadata' => array('parent' => 'IAB7')),
396
+ array('text' => 'Incest/Abuse Support', 'value' => 'IAB7-28', 'metadata' => array('parent' => 'IAB7')),
397
+ array('text' => 'Incontinence', 'value' => 'IAB7-29', 'metadata' => array('parent' => 'IAB7')),
398
+ array('text' => 'Infertility', 'value' => 'IAB7-30', 'metadata' => array('parent' => 'IAB7')),
399
+ array('text' => 'Men’s Health', 'value' => 'IAB7-31', 'metadata' => array('parent' => 'IAB7')),
400
+ array('text' => 'Nutrition', 'value' => 'IAB7-32', 'metadata' => array('parent' => 'IAB7')),
401
+ array('text' => 'Orthopedics', 'value' => 'IAB7-33', 'metadata' => array('parent' => 'IAB7')),
402
+ array('text' => 'Panic/Anxiety Disorders', 'value' => 'IAB7-34', 'metadata' => array('parent' => 'IAB7')),
403
+ array('text' => 'Pediatrics', 'value' => 'IAB7-35', 'metadata' => array('parent' => 'IAB7')),
404
+ array('text' => 'Physical Therapy', 'value' => 'IAB7-36', 'metadata' => array('parent' => 'IAB7')),
405
+ array('text' => 'Psychology/Psychiatry', 'value' => 'IAB7-37', 'metadata' => array('parent' => 'IAB7')),
406
+ array('text' => 'Senor Health', 'value' => 'IAB7-38', 'metadata' => array('parent' => 'IAB7')),
407
+ array('text' => 'Sexuality', 'value' => 'IAB7-39', 'metadata' => array('parent' => 'IAB7')),
408
+ array('text' => 'Sleep Disorders', 'value' => 'IAB7-40', 'metadata' => array('parent' => 'IAB7')),
409
+ array('text' => 'Smoking Cessation', 'value' => 'IAB7-41', 'metadata' => array('parent' => 'IAB7')),
410
+ array('text' => 'Substance Abuse', 'value' => 'IAB7-42', 'metadata' => array('parent' => 'IAB7')),
411
+ array('text' => 'Thyroid Disease', 'value' => 'IAB7-43', 'metadata' => array('parent' => 'IAB7')),
412
+ array('text' => 'Weight Loss', 'value' => 'IAB7-44', 'metadata' => array('parent' => 'IAB7')),
413
+ array('text' => 'Women’s Health', 'value' => 'IAB7-45', 'metadata' => array('parent' => 'IAB7')),
414
+ array('text' => 'American Cuisine', 'value' => 'IAB8-1', 'metadata' => array('parent' => 'IAB8')),
415
+ array('text' => 'Barbecues & Grilling', 'value' => 'IAB8-2', 'metadata' => array('parent' => 'IAB8')),
416
+ array('text' => 'Cajun/Creole', 'value' => 'IAB8-3', 'metadata' => array('parent' => 'IAB8')),
417
+ array('text' => 'Chinese Cuisine', 'value' => 'IAB8-4', 'metadata' => array('parent' => 'IAB8')),
418
+ array('text' => 'Cocktails/Beer', 'value' => 'IAB8-5', 'metadata' => array('parent' => 'IAB8')),
419
+ array('text' => 'Coffee/Tea', 'value' => 'IAB8-6', 'metadata' => array('parent' => 'IAB8')),
420
+ array('text' => 'Cuisine-Specific', 'value' => 'IAB8-7', 'metadata' => array('parent' => 'IAB8')),
421
+ array('text' => 'Desserts & Baking', 'value' => 'IAB8-8', 'metadata' => array('parent' => 'IAB8')),
422
+ array('text' => 'Dining Out', 'value' => 'IAB8-9', 'metadata' => array('parent' => 'IAB8')),
423
+ array('text' => 'Food Allergies', 'value' => 'IAB8-10', 'metadata' => array('parent' => 'IAB8')),
424
+ array('text' => 'French Cuisine', 'value' => 'IAB8-11', 'metadata' => array('parent' => 'IAB8')),
425
+ array('text' => 'Health/Lowfat Cooking', 'value' => 'IAB8-12', 'metadata' => array('parent' => 'IAB8')),
426
+ array('text' => 'Italian Cuisine', 'value' => 'IAB8-13', 'metadata' => array('parent' => 'IAB8')),
427
+ array('text' => 'Japanese Cuisine', 'value' => 'IAB8-14', 'metadata' => array('parent' => 'IAB8')),
428
+ array('text' => 'Mexican Cuisine', 'value' => 'IAB8-15', 'metadata' => array('parent' => 'IAB8')),
429
+ array('text' => 'Vegan', 'value' => 'IAB8-16', 'metadata' => array('parent' => 'IAB8')),
430
+ array('text' => 'Vegetarian', 'value' => 'IAB8-17', 'metadata' => array('parent' => 'IAB8')),
431
+ array('text' => 'Wine', 'value' => 'IAB8-18', 'metadata' => array('parent' => 'IAB8')),
432
+ array('text' => 'Art/Technology', 'value' => 'IAB9-1', 'metadata' => array('parent' => 'IAB9')),
433
+ array('text' => 'Arts & Crafts', 'value' => 'IAB9-2', 'metadata' => array('parent' => 'IAB9')),
434
+ array('text' => 'Beadwork', 'value' => 'IAB9-3', 'metadata' => array('parent' => 'IAB9')),
435
+ array('text' => 'Birdwatching', 'value' => 'IAB9-4', 'metadata' => array('parent' => 'IAB9')),
436
+ array('text' => 'Board Games/Puzzles', 'value' => 'IAB9-5', 'metadata' => array('parent' => 'IAB9')),
437
+ array('text' => 'Candle & Soap Making', 'value' => 'IAB9-6', 'metadata' => array('parent' => 'IAB9')),
438
+ array('text' => 'Card Games', 'value' => 'IAB9-7', 'metadata' => array('parent' => 'IAB9')),
439
+ array('text' => 'Chess', 'value' => 'IAB9-8', 'metadata' => array('parent' => 'IAB9')),
440
+ array('text' => 'Cigars', 'value' => 'IAB9-9', 'metadata' => array('parent' => 'IAB9')),
441
+ array('text' => 'Collecting', 'value' => 'IAB9-10', 'metadata' => array('parent' => 'IAB9')),
442
+ array('text' => 'Comic Books', 'value' => 'IAB9-11', 'metadata' => array('parent' => 'IAB9')),
443
+ array('text' => 'Drawing/Sketching', 'value' => 'IAB9-12', 'metadata' => array('parent' => 'IAB9')),
444
+ array('text' => 'Freelance Writing', 'value' => 'IAB9-13', 'metadata' => array('parent' => 'IAB9')),
445
+ array('text' => 'Genealogy', 'value' => 'IAB9-14', 'metadata' => array('parent' => 'IAB9')),
446
+ array('text' => 'Getting Published', 'value' => 'IAB9-15', 'metadata' => array('parent' => 'IAB9')),
447
+ array('text' => 'Guitar', 'value' => 'IAB9-16', 'metadata' => array('parent' => 'IAB9')),
448
+ array('text' => 'Home Recording', 'value' => 'IAB9-17', 'metadata' => array('parent' => 'IAB9')),
449
+ array('text' => 'Investors & Patents', 'value' => 'IAB9-18', 'metadata' => array('parent' => 'IAB9')),
450
+ array('text' => 'Jewelry Making', 'value' => 'IAB9-19', 'metadata' => array('parent' => 'IAB9')),
451
+ array('text' => 'Magic & Illusion', 'value' => 'IAB9-20', 'metadata' => array('parent' => 'IAB9')),
452
+ array('text' => 'Needlework', 'value' => 'IAB9-21', 'metadata' => array('parent' => 'IAB9')),
453
+ array('text' => 'Painting', 'value' => 'IAB9-22', 'metadata' => array('parent' => 'IAB9')),
454
+ array('text' => 'Photography', 'value' => 'IAB9-23', 'metadata' => array('parent' => 'IAB9')),
455
+ array('text' => 'Radio', 'value' => 'IAB9-24', 'metadata' => array('parent' => 'IAB9')),
456
+ array('text' => 'Roleplaying Games', 'value' => 'IAB9-25', 'metadata' => array('parent' => 'IAB9')),
457
+ array('text' => 'Sci-Fi & Fantasy', 'value' => 'IAB9-26', 'metadata' => array('parent' => 'IAB9')),
458
+ array('text' => 'Scrapbooking', 'value' => 'IAB9-27', 'metadata' => array('parent' => 'IAB9')),
459
+ array('text' => 'Screenwriting', 'value' => 'IAB9-28', 'metadata' => array('parent' => 'IAB9')),
460
+ array('text' => 'Stamps & Coins', 'value' => 'IAB9-29', 'metadata' => array('parent' => 'IAB9')),
461
+ array('text' => 'Video & Computer Games', 'value' => 'IAB9-30', 'metadata' => array('parent' => 'IAB9')),
462
+ array('text' => 'Woodworking', 'value' => 'IAB9-31', 'metadata' => array('parent' => 'IAB9')),
463
+ array('text' => 'Appliances', 'value' => 'IAB10-1', 'metadata' => array('parent' => 'IAB10')),
464
+ array('text' => 'Entertaining', 'value' => 'IAB10-2', 'metadata' => array('parent' => 'IAB10')),
465
+ array('text' => 'Environmental Safety', 'value' => 'IAB10-3', 'metadata' => array('parent' => 'IAB10')),
466
+ array('text' => 'Gardening', 'value' => 'IAB10-4', 'metadata' => array('parent' => 'IAB10')),
467
+ array('text' => 'Home Repair', 'value' => 'IAB10-5', 'metadata' => array('parent' => 'IAB10')),
468
+ array('text' => 'Home Theater', 'value' => 'IAB10-6', 'metadata' => array('parent' => 'IAB10')),
469
+ array('text' => 'Interior Decorating', 'value' => 'IAB10-7', 'metadata' => array('parent' => 'IAB10')),
470
+ array('text' => 'Landscaping', 'value' => 'IAB10-8', 'metadata' => array('parent' => 'IAB10')),
471
+ array('text' => 'Remodeling & Construction', 'value' => 'IAB10-9', 'metadata' => array('parent' => 'IAB10')),
472
+ array('text' => 'Immigration', 'value' => 'IAB11-1', 'metadata' => array('parent' => 'IAB11')),
473
+ array('text' => 'Legal Issues', 'value' => 'IAB11-2', 'metadata' => array('parent' => 'IAB11')),
474
+ array('text' => 'U.S. Government Resources', 'value' => 'IAB11-3', 'metadata' => array('parent' => 'IAB11')),
475
+ array('text' => 'Politics', 'value' => 'IAB11-4', 'metadata' => array('parent' => 'IAB11')),
476
+ array('text' => 'Commentary', 'value' => 'IAB11-5', 'metadata' => array('parent' => 'IAB11')),
477
+ array('text' => 'International News', 'value' => 'IAB12-1', 'metadata' => array('parent' => 'IAB12')),
478
+ array('text' => 'National News', 'value' => 'IAB12-2', 'metadata' => array('parent' => 'IAB12')),
479
+ array('text' => 'Local News', 'value' => 'IAB12-3', 'metadata' => array('parent' => 'IAB12')),
480
+ array('text' => 'Beginning Investing', 'value' => 'IAB13-1', 'metadata' => array('parent' => 'IAB13')),
481
+ array('text' => 'Credit/Debt & Loans', 'value' => 'IAB13-2', 'metadata' => array('parent' => 'IAB13')),
482
+ array('text' => 'Financial News', 'value' => 'IAB13-3', 'metadata' => array('parent' => 'IAB13')),
483
+ array('text' => 'Financial Planning', 'value' => 'IAB13-4', 'metadata' => array('parent' => 'IAB13')),
484
+ array('text' => 'Hedge Fund', 'value' => 'IAB13-5', 'metadata' => array('parent' => 'IAB13')),
485
+ array('text' => 'Insurance', 'value' => 'IAB13-6', 'metadata' => array('parent' => 'IAB13')),
486
+ array('text' => 'Investing', 'value' => 'IAB13-7', 'metadata' => array('parent' => 'IAB13')),
487
+ array('text' => 'Mutual Funds', 'value' => 'IAB13-8', 'metadata' => array('parent' => 'IAB13')),
488
+ array('text' => 'Options', 'value' => 'IAB13-9', 'metadata' => array('parent' => 'IAB13')),
489
+ array('text' => 'Retirement Planning', 'value' => 'IAB13-10', 'metadata' => array('parent' => 'IAB13')),
490
+ array('text' => 'Stocks', 'value' => 'IAB13-11', 'metadata' => array('parent' => 'IAB13')),
491
+ array('text' => 'Tax Planning', 'value' => 'IAB13-12', 'metadata' => array('parent' => 'IAB13')),
492
+ array('text' => 'Dating', 'value' => 'IAB14-1', 'metadata' => array('parent' => 'IAB14')),
493
+ array('text' => 'Divorce Support', 'value' => 'IAB14-2', 'metadata' => array('parent' => 'IAB14')),
494
+ array('text' => 'Gay Life', 'value' => 'IAB14-3', 'metadata' => array('parent' => 'IAB14')),
495
+ array('text' => 'Marriage', 'value' => 'IAB14-4', 'metadata' => array('parent' => 'IAB14')),
496
+ array('text' => 'Senior Living', 'value' => 'IAB14-5', 'metadata' => array('parent' => 'IAB14')),
497
+ array('text' => 'Teens', 'value' => 'IAB14-6', 'metadata' => array('parent' => 'IAB14')),
498
+ array('text' => 'Weddings', 'value' => 'IAB14-7', 'metadata' => array('parent' => 'IAB14')),
499
+ array('text' => 'Ethnic Specific', 'value' => 'IAB14-8', 'metadata' => array('parent' => 'IAB14')),
500
+ array('text' => 'Astrology', 'value' => 'IAB15-1', 'metadata' => array('parent' => 'IAB15')),
501
+ array('text' => 'Biology', 'value' => 'IAB15-2', 'metadata' => array('parent' => 'IAB15')),
502
+ array('text' => 'Chemistry', 'value' => 'IAB15-3', 'metadata' => array('parent' => 'IAB15')),
503
+ array('text' => 'Geology', 'value' => 'IAB15-4', 'metadata' => array('parent' => 'IAB15')),
504
+ array('text' => 'Paranormal Phenomena', 'value' => 'IAB15-5', 'metadata' => array('parent' => 'IAB15')),
505
+ array('text' => 'Physics', 'value' => 'IAB15-6', 'metadata' => array('parent' => 'IAB15')),
506
+ array('text' => 'Space/Astronomy', 'value' => 'IAB15-7', 'metadata' => array('parent' => 'IAB15')),
507
+ array('text' => 'Geography', 'value' => 'IAB15-8', 'metadata' => array('parent' => 'IAB15')),
508
+ array('text' => 'Botany', 'value' => 'IAB15-9', 'metadata' => array('parent' => 'IAB15')),
509
+ array('text' => 'Weather', 'value' => 'IAB15-10', 'metadata' => array('parent' => 'IAB15')),
510
+ array('text' => 'Aquariums', 'value' => 'IAB16-1', 'metadata' => array('parent' => 'IAB16')),
511
+ array('text' => 'Birds', 'value' => 'IAB16-2', 'metadata' => array('parent' => 'IAB16')),
512
+ array('text' => 'Cats', 'value' => 'IAB16-3', 'metadata' => array('parent' => 'IAB16')),
513
+ array('text' => 'Dogs', 'value' => 'IAB16-4', 'metadata' => array('parent' => 'IAB16')),
514
+ array('text' => 'Large Animals', 'value' => 'IAB16-5', 'metadata' => array('parent' => 'IAB16')),
515
+ array('text' => 'Reptiles', 'value' => 'IAB16-6', 'metadata' => array('parent' => 'IAB16')),
516
+ array('text' => 'Veterinary Medicine', 'value' => 'IAB16-7', 'metadata' => array('parent' => 'IAB16')),
517
+ array('text' => 'Auto Racing', 'value' => 'IAB17-1', 'metadata' => array('parent' => 'IAB17')),
518
+ array('text' => 'Baseball', 'value' => 'IAB17-2', 'metadata' => array('parent' => 'IAB17')),
519
+ array('text' => 'Bicycling', 'value' => 'IAB17-3', 'metadata' => array('parent' => 'IAB17')),
520
+ array('text' => 'Bodybuilding', 'value' => 'IAB17-4', 'metadata' => array('parent' => 'IAB17')),
521
+ array('text' => 'Boxing', 'value' => 'IAB17-5', 'metadata' => array('parent' => 'IAB17')),
522
+ array('text' => 'Canoeing/Kayaking', 'value' => 'IAB17-6', 'metadata' => array('parent' => 'IAB17')),
523
+ array('text' => 'Cheerleading', 'value' => 'IAB17-7', 'metadata' => array('parent' => 'IAB17')),
524
+ array('text' => 'Climbing', 'value' => 'IAB17-8', 'metadata' => array('parent' => 'IAB17')),
525
+ array('text' => 'Cricket', 'value' => 'IAB17-9', 'metadata' => array('parent' => 'IAB17')),
526
+ array('text' => 'Figure Skating', 'value' => 'IAB17-10', 'metadata' => array('parent' => 'IAB17')),
527
+ array('text' => 'Fly Fishing', 'value' => 'IAB17-11', 'metadata' => array('parent' => 'IAB17')),
528
+ array('text' => 'Football', 'value' => 'IAB17-12', 'metadata' => array('parent' => 'IAB17')),
529
+ array('text' => 'Freshwater Fishing', 'value' => 'IAB17-13', 'metadata' => array('parent' => 'IAB17')),
530
+ array('text' => 'Game & Fish', 'value' => 'IAB17-14', 'metadata' => array('parent' => 'IAB17')),
531
+ array('text' => 'Golf', 'value' => 'IAB17-15', 'metadata' => array('parent' => 'IAB17')),
532
+ array('text' => 'Horse Racing', 'value' => 'IAB17-16', 'metadata' => array('parent' => 'IAB17')),
533
+ array('text' => 'Horses', 'value' => 'IAB17-17', 'metadata' => array('parent' => 'IAB17')),
534
+ array('text' => 'Hunting/Shooting', 'value' => 'IAB17-18', 'metadata' => array('parent' => 'IAB17')),
535
+ array('text' => 'Inline Skating', 'value' => 'IAB17-19', 'metadata' => array('parent' => 'IAB17')),
536
+ array('text' => 'Martial Arts', 'value' => 'IAB17-20', 'metadata' => array('parent' => 'IAB17')),
537
+ array('text' => 'Mountain Biking', 'value' => 'IAB17-21', 'metadata' => array('parent' => 'IAB17')),
538
+ array('text' => 'NASCAR Racing', 'value' => 'IAB17-22', 'metadata' => array('parent' => 'IAB17')),
539
+ array('text' => 'Olympics', 'value' => 'IAB17-23', 'metadata' => array('parent' => 'IAB17')),
540
+ array('text' => 'Paintball', 'value' => 'IAB17-24', 'metadata' => array('parent' => 'IAB17')),
541
+ array('text' => 'Power & Motorcycles', 'value' => 'IAB17-25', 'metadata' => array('parent' => 'IAB17')),
542
+ array('text' => 'Pro Basketball', 'value' => 'IAB17-26', 'metadata' => array('parent' => 'IAB17')),
543
+ array('text' => 'Pro Ice Hockey', 'value' => 'IAB17-27', 'metadata' => array('parent' => 'IAB17')),
544
+ array('text' => 'Rodeo', 'value' => 'IAB17-28', 'metadata' => array('parent' => 'IAB17')),
545
+ array('text' => 'Rugby', 'value' => 'IAB17-29', 'metadata' => array('parent' => 'IAB17')),
546
+ array('text' => 'Running/Jogging', 'value' => 'IAB17-30', 'metadata' => array('parent' => 'IAB17')),
547
+ array('text' => 'Sailing', 'value' => 'IAB17-31', 'metadata' => array('parent' => 'IAB17')),
548
+ array('text' => 'Saltwater Fishing', 'value' => 'IAB17-32', 'metadata' => array('parent' => 'IAB17')),
549
+ array('text' => 'Scuba Diving', 'value' => 'IAB17-33', 'metadata' => array('parent' => 'IAB17')),
550
+ array('text' => 'Skateboarding', 'value' => 'IAB17-34', 'metadata' => array('parent' => 'IAB17')),
551
+ array('text' => 'Skiing', 'value' => 'IAB17-35', 'metadata' => array('parent' => 'IAB17')),
552
+ array('text' => 'Snowboarding', 'value' => 'IAB17-36', 'metadata' => array('parent' => 'IAB17')),
553
+ array('text' => 'Surfing/Bodyboarding', 'value' => 'IAB17-37', 'metadata' => array('parent' => 'IAB17')),
554
+ array('text' => 'Swimming', 'value' => 'IAB17-38', 'metadata' => array('parent' => 'IAB17')),
555
+ array('text' => 'Table Tennis/Ping-Pong', 'value' => 'IAB17-39', 'metadata' => array('parent' => 'IAB17')),
556
+ array('text' => 'Tennis', 'value' => 'IAB17-40', 'metadata' => array('parent' => 'IAB17')),
557
+ array('text' => 'Volleyball', 'value' => 'IAB17-41', 'metadata' => array('parent' => 'IAB17')),
558
+ array('text' => 'Walking', 'value' => 'IAB17-42', 'metadata' => array('parent' => 'IAB17')),
559
+ array('text' => 'Waterski/Wakeboard', 'value' => 'IAB17-43', 'metadata' => array('parent' => 'IAB17')),
560
+ array('text' => 'World Soccer', 'value' => 'IAB17-44', 'metadata' => array('parent' => 'IAB17')),
561
+ array('text' => 'Beauty', 'value' => 'IAB18-1', 'metadata' => array('parent' => 'IAB18')),
562
+ array('text' => 'Body Art', 'value' => 'IAB18-2', 'metadata' => array('parent' => 'IAB18')),
563
+ array('text' => 'Fashion', 'value' => 'IAB18-3', 'metadata' => array('parent' => 'IAB18')),
564
+ array('text' => 'Jewelry', 'value' => 'IAB18-4', 'metadata' => array('parent' => 'IAB18')),
565
+ array('text' => 'Clothing', 'value' => 'IAB18-5', 'metadata' => array('parent' => 'IAB18')),
566
+ array('text' => 'Accessories', 'value' => 'IAB18-6', 'metadata' => array('parent' => 'IAB18')),
567
+ array('text' => '3-D Graphics', 'value' => 'IAB19-1', 'metadata' => array('parent' => 'IAB19')),
568
+ array('text' => 'Animation', 'value' => 'IAB19-2', 'metadata' => array('parent' => 'IAB19')),
569
+ array('text' => 'Antivirus Software', 'value' => 'IAB19-3', 'metadata' => array('parent' => 'IAB19')),
570
+ array('text' => 'C/C++', 'value' => 'IAB19-4', 'metadata' => array('parent' => 'IAB19')),
571
+ array('text' => 'Cameras & Camcorders', 'value' => 'IAB19-5', 'metadata' => array('parent' => 'IAB19')),
572
+ array('text' => 'Cell Phones', 'value' => 'IAB19-6', 'metadata' => array('parent' => 'IAB19')),
573
+ array('text' => 'Computer Certification', 'value' => 'IAB19-7', 'metadata' => array('parent' => 'IAB19')),
574
+ array('text' => 'Computer Networking', 'value' => 'IAB19-8', 'metadata' => array('parent' => 'IAB19')),
575
+ array('text' => 'Computer Peripherals', 'value' => 'IAB19-9', 'metadata' => array('parent' => 'IAB19')),
576
+ array('text' => 'Computer Reviews', 'value' => 'IAB19-10', 'metadata' => array('parent' => 'IAB19')),
577
+ array('text' => 'Data Centers', 'value' => 'IAB19-11', 'metadata' => array('parent' => 'IAB19')),
578
+ array('text' => 'Databases', 'value' => 'IAB19-12', 'metadata' => array('parent' => 'IAB19')),
579
+ array('text' => 'Desktop Publishing', 'value' => 'IAB19-13', 'metadata' => array('parent' => 'IAB19')),
580
+ array('text' => 'Desktop Video', 'value' => 'IAB19-14', 'metadata' => array('parent' => 'IAB19')),
581
+ array('text' => 'Email', 'value' => 'IAB19-15', 'metadata' => array('parent' => 'IAB19')),
582
+ array('text' => 'Graphics Software', 'value' => 'IAB19-16', 'metadata' => array('parent' => 'IAB19')),
583
+ array('text' => 'Home Video/DVD', 'value' => 'IAB19-17', 'metadata' => array('parent' => 'IAB19')),
584
+ array('text' => 'Internet Technology', 'value' => 'IAB19-18', 'metadata' => array('parent' => 'IAB19')),
585
+ array('text' => 'Java', 'value' => 'IAB19-19', 'metadata' => array('parent' => 'IAB19')),
586
+ array('text' => 'JavaScript', 'value' => 'IAB19-20', 'metadata' => array('parent' => 'IAB19')),
587
+ array('text' => 'Mac Support', 'value' => 'IAB19-21', 'metadata' => array('parent' => 'IAB19')),
588
+ array('text' => 'MP3/MIDI', 'value' => 'IAB19-22', 'metadata' => array('parent' => 'IAB19')),
589
+ array('text' => 'Net Conferencing', 'value' => 'IAB19-23', 'metadata' => array('parent' => 'IAB19')),
590
+ array('text' => 'Net for Beginners', 'value' => 'IAB19-24', 'metadata' => array('parent' => 'IAB19')),
591
+ array('text' => 'Network Security', 'value' => 'IAB19-25', 'metadata' => array('parent' => 'IAB19')),
592
+ array('text' => 'Palmtops/PDAs', 'value' => 'IAB19-26', 'metadata' => array('parent' => 'IAB19')),
593
+ array('text' => 'PC Support', 'value' => 'IAB19-27', 'metadata' => array('parent' => 'IAB19')),
594
+ array('text' => 'Portable', 'value' => 'IAB19-28', 'metadata' => array('parent' => 'IAB19')),
595
+ array('text' => 'Entertainment', 'value' => 'IAB19-29', 'metadata' => array('parent' => 'IAB19')),
596
+ array('text' => 'Shareware/Freeware', 'value' => 'IAB19-30', 'metadata' => array('parent' => 'IAB19')),
597
+ array('text' => 'Unix', 'value' => 'IAB19-31', 'metadata' => array('parent' => 'IAB19')),
598
+ array('text' => 'Visual Basic', 'value' => 'IAB19-32', 'metadata' => array('parent' => 'IAB19')),
599
+ array('text' => 'Web Clip Art', 'value' => 'IAB19-33', 'metadata' => array('parent' => 'IAB19')),
600
+ array('text' => 'Web Design/HTML', 'value' => 'IAB19-34', 'metadata' => array('parent' => 'IAB19')),
601
+ array('text' => 'Web Search', 'value' => 'IAB19-35', 'metadata' => array('parent' => 'IAB19')),
602
+ array('text' => 'Windows', 'value' => 'IAB19-36', 'metadata' => array('parent' => 'IAB19')),
603
+ array('text' => 'Adventure Travel', 'value' => 'IAB20-1', 'metadata' => array('parent' => 'IAB20')),
604
+ array('text' => 'Africa', 'value' => 'IAB20-2', 'metadata' => array('parent' => 'IAB20')),
605
+ array('text' => 'Air Travel', 'value' => 'IAB20-3', 'metadata' => array('parent' => 'IAB20')),
606
+ array('text' => 'Australia & New Zealand', 'value' => 'IAB20-4', 'metadata' => array('parent' => 'IAB20')),
607
+ array('text' => 'Bed & Breakfasts', 'value' => 'IAB20-5', 'metadata' => array('parent' => 'IAB20')),
608
+ array('text' => 'Budget Travel', 'value' => 'IAB20-6', 'metadata' => array('parent' => 'IAB20')),
609
+ array('text' => 'Business Travel', 'value' => 'IAB20-7', 'metadata' => array('parent' => 'IAB20')),
610
+ array('text' => 'By US Locale', 'value' => 'IAB20-8', 'metadata' => array('parent' => 'IAB20')),
611
+ array('text' => 'Camping', 'value' => 'IAB20-9', 'metadata' => array('parent' => 'IAB20')),
612
+ array('text' => 'Canada', 'value' => 'IAB20-10', 'metadata' => array('parent' => 'IAB20')),
613
+ array('text' => 'Caribbean', 'value' => 'IAB20-11', 'metadata' => array('parent' => 'IAB20')),
614
+ array('text' => 'Cruises', 'value' => 'IAB20-12', 'metadata' => array('parent' => 'IAB20')),
615
+ array('text' => 'Eastern Europe', 'value' => 'IAB20-13', 'metadata' => array('parent' => 'IAB20')),
616
+ array('text' => 'Europe', 'value' => 'IAB20-14', 'metadata' => array('parent' => 'IAB20')),
617
+ array('text' => 'France', 'value' => 'IAB20-15', 'metadata' => array('parent' => 'IAB20')),
618
+ array('text' => 'Greece', 'value' => 'IAB20-16', 'metadata' => array('parent' => 'IAB20')),
619
+ array('text' => 'Honeymoons/Getaways', 'value' => 'IAB20-17', 'metadata' => array('parent' => 'IAB20')),
620
+ array('text' => 'Hotels', 'value' => 'IAB20-18', 'metadata' => array('parent' => 'IAB20')),
621
+ array('text' => 'Italy', 'value' => 'IAB20-19', 'metadata' => array('parent' => 'IAB20')),
622
+ array('text' => 'Japan', 'value' => 'IAB20-20', 'metadata' => array('parent' => 'IAB20')),
623
+ array('text' => 'Mexico & Central America', 'value' => 'IAB20-21', 'metadata' => array('parent' => 'IAB20')),
624
+ array('text' => 'National Parks', 'value' => 'IAB20-22', 'metadata' => array('parent' => 'IAB20')),
625
+ array('text' => 'South America', 'value' => 'IAB20-23', 'metadata' => array('parent' => 'IAB20')),
626
+ array('text' => 'Spas', 'value' => 'IAB20-24', 'metadata' => array('parent' => 'IAB20')),
627
+ array('text' => 'Theme Parks', 'value' => 'IAB20-25', 'metadata' => array('parent' => 'IAB20')),
628
+ array('text' => 'Traveling with Kids', 'value' => 'IAB20-26', 'metadata' => array('parent' => 'IAB20')),
629
+ array('text' => 'United Kingdom', 'value' => 'IAB20-27', 'metadata' => array('parent' => 'IAB20')),
630
+ array('text' => 'Apartments', 'value' => 'IAB21-1', 'metadata' => array('parent' => 'IAB21')),
631
+ array('text' => 'Architects', 'value' => 'IAB21-2', 'metadata' => array('parent' => 'IAB21')),
632
+ array('text' => 'Buying/Selling Homes', 'value' => 'IAB21-3', 'metadata' => array('parent' => 'IAB21')),
633
+ array('text' => 'Contests & Freebies', 'value' => 'IAB22-1', 'metadata' => array('parent' => 'IAB22')),
634
+ array('text' => 'Couponing', 'value' => 'IAB22-2', 'metadata' => array('parent' => 'IAB22')),
635
+ array('text' => 'Comparison', 'value' => 'IAB22-3', 'metadata' => array('parent' => 'IAB22')),
636
+ array('text' => 'Engines', 'value' => 'IAB22-4', 'metadata' => array('parent' => 'IAB22')),
637
+ array('text' => 'Alternative Religions', 'value' => 'IAB23-1', 'metadata' => array('parent' => 'IAB23')),
638
+ array('text' => 'Atheism/Agnosticism', 'value' => 'IAB23-2', 'metadata' => array('parent' => 'IAB23')),
639
+ array('text' => 'Buddhism', 'value' => 'IAB23-3', 'metadata' => array('parent' => 'IAB23')),
640
+ array('text' => 'Catholicism', 'value' => 'IAB23-4', 'metadata' => array('parent' => 'IAB23')),
641
+ array('text' => 'Christianity', 'value' => 'IAB23-5', 'metadata' => array('parent' => 'IAB23')),
642
+ array('text' => 'Hinduism', 'value' => 'IAB23-6', 'metadata' => array('parent' => 'IAB23')),
643
+ array('text' => 'Islam', 'value' => 'IAB23-7', 'metadata' => array('parent' => 'IAB23')),
644
+ array('text' => 'Judaism', 'value' => 'IAB23-8', 'metadata' => array('parent' => 'IAB23')),
645
+ array('text' => 'Latter-Day Saints', 'value' => 'IAB23-9', 'metadata' => array('parent' => 'IAB23')),
646
+ array('text' => 'Pagan/Wiccan', 'value' => 'IAB23-10', 'metadata' => array('parent' => 'IAB23')),
647
+ array('text' => 'Unmoderated UGC', 'value' => 'IAB25-1', 'metadata' => array('parent' => 'IAB25')),
648
+ array('text' => 'Extreme Graphic/Explicit Violence', 'value' => 'IAB25-2', 'metadata' => array('parent' => 'IAB25')),
649
+ array('text' => 'Pornography', 'value' => 'IAB25-3', 'metadata' => array('parent' => 'IAB25')),
650
+ array('text' => 'Profane Content', 'value' => 'IAB25-4', 'metadata' => array('parent' => 'IAB25')),
651
+ array('text' => 'Hate Content', 'value' => 'IAB25-5', 'metadata' => array('parent' => 'IAB25')),
652
+ array('text' => 'Under Construction', 'value' => 'IAB25-6', 'metadata' => array('parent' => 'IAB25')),
653
+ array('text' => 'Incentivized', 'value' => 'IAB25-7', 'metadata' => array('parent' => 'IAB25')),
654
+ array('text' => 'Illegal Content', 'value' => 'IAB26-1', 'metadata' => array('parent' => 'IAB26')),
655
+ array('text' => 'Warez', 'value' => 'IAB26-2', 'metadata' => array('parent' => 'IAB26')),
656
+ array('text' => 'Spyware/Malware', 'value' => 'IAB26-3', 'metadata' => array('parent' => 'IAB26')),
657
+ array('text' => 'Copyright Infringement', 'value' => 'IAB26-4', 'metadata' => array('parent' => 'IAB26'))
658
+ );
659
+ $control->add_control(array('type' => 'select', 'label' => '&nbsp;', 'optionName' => 'iab_category_child', 'helpText' => '&nbsp;', 'options' => $IABChildCategories));
660
+ $languages = insert_ads_vi_api_get_languages();
661
+ $languageOptions = array(
662
+ array('text' => 'Select language', 'value' => 'select'),
663
+ );
664
+ if($languages != false) {
665
+ foreach($languages as $key => $value) {
666
+ $languageOptions[] = array('text' => $value, 'value' => $key);
667
+ }
668
+ }
669
+ $control->add_control(array('type' => 'select', 'label' => 'Language*', 'optionName' => 'language', 'helpText' => '&nbsp;', 'options' => $languageOptions));
670
+ $control->add_control(array('type' => 'minicolors', 'label' => 'Native Background color', 'optionName' => 'native_bg_color', 'helpText' => '&nbsp;'));
671
+ $control->add_control(array('type' => 'minicolors', 'label' => 'Native Text color', 'optionName' => 'native_text_color', 'helpText' => '&nbsp;'));
672
+ $fontFamily =array(
673
+ array('text' => 'Select font family', 'value' => 'select'),
674
+ array('text' => 'Georgia', 'value' => 'Georgia'),
675
+ array('text' => 'Palatino Linotype', 'value' => 'Palatino Linotype'),
676
+ array('text' => 'Times New Roman', 'value' => 'Times New Roman'),
677
+ array('text' => 'Arial', 'value' => 'Arial'),
678
+ array('text' => 'Arial Black', 'value' => 'Arial Black'),
679
+ array('text' => 'Comic Sans MS', 'value' => 'Comic Sans MS'),
680
+ array('text' => 'Impact', 'value' => 'Impact'),
681
+ array('text' => 'Lucida Sans Unicode', 'value' => 'Lucida Sans Unicode'),
682
+ array('text' => 'Tahoma', 'value' => 'Tahoma'),
683
+ array('text' => 'Trebuchet MS', 'value' => 'Trebuchet MS'),
684
+ array('text' => 'Verdana', 'value' => 'Verdana'),
685
+ array('text' => 'Courier New', 'value' => 'Courier New'),
686
+ array('text' => 'Lucida Console', 'value' => 'Lucida Console')
687
+ );
688
+ $control->add_control(array('type' => 'select', 'label' => ' Native Text Font Family', 'optionName' => 'font_family', 'helpText' => '&nbsp;', 'options' => $fontFamily));
689
+ $fontSize =array(
690
+ array('text' => 'Select font size', 'value' => 'select'),
691
+ array('text' => '8px', 'value' => '8'),
692
+ array('text' => '9px', 'value' => '9'),
693
+ array('text' => '10px', 'value' => '10'),
694
+ array('text' => '11px', 'value' => '11'),
695
+ array('text' => '12px', 'value' => '12'),
696
+ array('text' => '14px', 'value' => '14'),
697
+ array('text' => '16px', 'value' => '16'),
698
+ array('text' => '18px', 'value' => '18'),
699
+ array('text' => '20px', 'value' => '20'),
700
+ array('text' => '22px', 'value' => '22'),
701
+ array('text' => '24px', 'value' => '24'),
702
+ array('text' => '26px', 'value' => '26'),
703
+ array('text' => '28px', 'value' => '28'),
704
+ array('text' => '36px', 'value' => '36')
705
+ );
706
+ $control->add_control(array('type' => 'select', 'label' => 'Native Text Font Size', 'optionName' => 'font_size', 'helpText' => '&nbsp;', 'options' => $fontSize));
707
+ $control->add_control(array('type' => 'textarea', 'label' => 'Optional 1', 'optionName' => 'optional_1', 'helpText' => '&nbsp;'));
708
+ $control->add_control(array('type' => 'textarea', 'label' => 'Optional 2', 'optionName' => 'optional_2', 'helpText' => '&nbsp;'));
709
+ $control->add_control(array('type' => 'textarea', 'label' => 'Optional 3', 'optionName' => 'optional_3', 'helpText' => '&nbsp;'));
710
+ $control->HTML .= '<p class="insert_ads_vi_delay_notice">vi Ad Changes might take some time to take into effect</p>';
711
+ $control->HTML .= '</div>';
712
+ $control->HTML .= '<div class="clear"></div>';
713
+ $control->HTML .= '</div>';
714
+ $control->create_section(' vi stories: customize your video player ');
715
+ echo $control->HTML;
716
+ echo '<script type="text/javascript">';
717
+ echo $control->JS;
718
+ echo 'insert_ads_vi_code_iab_category_parent_change();';
719
+ echo '</script>';
720
+ die();
721
+ }
722
+
723
+ add_action('wp_ajax_insert_ads_vi_customize_adcode_form_save_action', 'insert_ads_vi_customize_adcode_form_save_action');
724
+ function insert_ads_vi_customize_adcode_form_save_action() {
725
+ check_ajax_referer('insert-ads', 'insert_ads_nonce');
726
+ $vicodeSettings = array();
727
+ $vicodeSettings['ad_unit_type'] = ((isset($_POST['insert_ads_vi_code_settings_ad_unit_type']))?$_POST['insert_ads_vi_code_settings_ad_unit_type']:'');
728
+ $vicodeSettings['keywords'] = ((isset($_POST['insert_ads_vi_code_settings_keywords']))?$_POST['insert_ads_vi_code_settings_keywords']:'');
729
+ $vicodeSettings['iab_category_parent'] = ((isset($_POST['insert_ads_vi_code_settings_iab_category_parent']))?$_POST['insert_ads_vi_code_settings_iab_category_parent']:'');
730
+ $vicodeSettings['iab_category_child'] = ((isset($_POST['insert_ads_vi_code_settings_iab_category_child']))?$_POST['insert_ads_vi_code_settings_iab_category_child']:'');
731
+ $vicodeSettings['language'] = ((isset($_POST['insert_ads_vi_code_settings_language']))?$_POST['insert_ads_vi_code_settings_language']:'');
732
+ $vicodeSettings['native_bg_color'] = ((isset($_POST['insert_ads_vi_code_settings_native_bg_color']))?$_POST['insert_ads_vi_code_settings_native_bg_color']:'#fff');
733
+ $vicodeSettings['native_text_color'] = ((isset($_POST['insert_ads_vi_code_settings_native_text_color']))?$_POST['insert_ads_vi_code_settings_native_text_color']:'#000');
734
+ $vicodeSettings['font_family'] = ((isset($_POST['insert_ads_vi_code_settings_font_family']))?$_POST['insert_ads_vi_code_settings_font_family']:'');
735
+ $vicodeSettings['font_size'] = ((isset($_POST['insert_ads_vi_code_settings_font_size']))?$_POST['insert_ads_vi_code_settings_font_size']:'');
736
+ $vicodeSettings['optional_1'] = ((isset($_POST['insert_ads_vi_code_settings_optional_1']))?$_POST['insert_ads_vi_code_settings_optional_1']:'');
737
+ $vicodeSettings['optional_2'] = ((isset($_POST['insert_ads_vi_code_settings_optional_2']))?$_POST['insert_ads_vi_code_settings_optional_2']:'');
738
+ $vicodeSettings['optional_3'] = ((isset($_POST['insert_ads_vi_code_settings_optional_3']))?$_POST['insert_ads_vi_code_settings_optional_3']:'');
739
+ update_option('insert_ads_vi_code_settings', $vicodeSettings);
740
+ $viCodeStatus = insert_ads_vi_api_set_vi_code($vicodeSettings);
741
+ if(is_array($viCodeStatus) && (isset($viCodeStatus['status'])) && ($viCodeStatus['status'] == 'error')) {
742
+ if($viCodeStatus['errorCode'] == 'WIVI108') {
743
+ echo '###FAIL###';
744
+ echo '<p class="viError">'.$viCodeStatus['message'].'</p>';
745
+ var_dump($viCodeStatus['message']);
746
+ } else {
747
+ echo '###FAIL###';
748
+ echo '<p class="viError">There was an error processing your request, our team was notified.<br />Please try again later.</p>';
749
+ }
750
+ } else {
751
+ echo '###SUCCESS###';
752
+ echo 'Success!';
753
+ }
754
+ die();
755
+ }
756
+
757
+ function insert_ads_vi_customize_adcode_get_settings() {
758
+ $vicodeSettings = get_option('insert_ads_vi_code_settings');
759
+
760
+ $output = '';
761
+ if(isset($vicodeSettings) && is_array($vicodeSettings)) {
762
+ $output .= '<p class="insert_ads_vi_code_data_wrapper">';
763
+ if(isset($vicodeSettings['ad_unit_type']) && ($vicodeSettings['ad_unit_type'] != '') && ($vicodeSettings['ad_unit_type'] != 'select')) {
764
+ $output .= '<label>Ad Unit:</label><b>vi stories</b>';
765
+ }
766
+
767
+ if(isset($vicodeSettings['keywords']) && ($vicodeSettings['keywords'] != '')) {
768
+ $output .= '<label>Keywords:</label><b>'.$vicodeSettings['keywords'].'</b>';
769
+ }
770
+
771
+ if(isset($vicodeSettings['iab_category_child']) && ($vicodeSettings['iab_category_child'] != '') && ($vicodeSettings['iab_category_child'] != 'select')) {
772
+ $IABChildCategories = array(
773
+ array('text' => 'Select', 'value' => 'select'),
774
+ array('text' => 'Books & Literature', 'value' => 'IAB1-1', 'metadata' => array('parent' => 'IAB1')),
775
+ array('text' => 'Celebrity Fan/Gossip', 'value' => 'IAB1-2', 'metadata' => array('parent' => 'IAB1')),
776
+ array('text' => 'Fine Art', 'value' => 'IAB1-3', 'metadata' => array('parent' => 'IAB1')),
777
+ array('text' => 'Humor', 'value' => 'IAB1-4', 'metadata' => array('parent' => 'IAB1')),
778
+ array('text' => 'Movies', 'value' => 'IAB1-5', 'metadata' => array('parent' => 'IAB1')),
779
+ array('text' => 'Music', 'value' => 'IAB1-6', 'metadata' => array('parent' => 'IAB1')),
780
+ array('text' => 'Television', 'value' => 'IAB1-7', 'metadata' => array('parent' => 'IAB1')),
781
+ array('text' => 'Auto Parts', 'value' => 'IAB2-1', 'metadata' => array('parent' => 'IAB2')),
782
+ array('text' => 'Auto Repair', 'value' => 'IAB2-2', 'metadata' => array('parent' => 'IAB2')),
783
+ array('text' => 'Buying/Selling Cars', 'value' => 'IAB2-3', 'metadata' => array('parent' => 'IAB2')),
784
+ array('text' => 'Car Culture', 'value' => 'IAB2-4', 'metadata' => array('parent' => 'IAB2')),
785
+ array('text' => 'Certified Pre-Owned', 'value' => 'IAB2-5', 'metadata' => array('parent' => 'IAB2')),
786
+ array('text' => 'Convertible', 'value' => 'IAB2-6', 'metadata' => array('parent' => 'IAB2')),
787
+ array('text' => 'Coupe', 'value' => 'IAB2-7', 'metadata' => array('parent' => 'IAB2')),
788
+ array('text' => 'Crossover', 'value' => 'IAB2-8', 'metadata' => array('parent' => 'IAB2')),
789
+ array('text' => 'Diesel', 'value' => 'IAB2-9', 'metadata' => array('parent' => 'IAB2')),
790
+ array('text' => 'Electric Vehicle', 'value' => 'IAB2-10', 'metadata' => array('parent' => 'IAB2')),
791
+ array('text' => 'Hatchback', 'value' => 'IAB2-11', 'metadata' => array('parent' => 'IAB2')),
792
+ array('text' => 'Hybrid', 'value' => 'IAB2-12', 'metadata' => array('parent' => 'IAB2')),
793
+ array('text' => 'Luxury', 'value' => 'IAB2-13', 'metadata' => array('parent' => 'IAB2')),
794
+ array('text' => 'MiniVan', 'value' => 'IAB2-14', 'metadata' => array('parent' => 'IAB2')),
795
+ array('text' => 'Mororcycles', 'value' => 'IAB2-15', 'metadata' => array('parent' => 'IAB2')),
796
+ array('text' => 'Off-Road Vehicles', 'value' => 'IAB2-16', 'metadata' => array('parent' => 'IAB2')),
797
+ array('text' => 'Performance Vehicles', 'value' => 'IAB2-17', 'metadata' => array('parent' => 'IAB2')),
798
+ array('text' => 'Pickup', 'value' => 'IAB2-18', 'metadata' => array('parent' => 'IAB2')),
799
+ array('text' => 'Road-Side Assistance', 'value' => 'IAB2-19', 'metadata' => array('parent' => 'IAB2')),
800
+ array('text' => 'Sedan', 'value' => 'IAB2-20', 'metadata' => array('parent' => 'IAB2')),
801
+ array('text' => 'Trucks & Accessories', 'value' => 'IAB2-21', 'metadata' => array('parent' => 'IAB2')),
802
+ array('text' => 'Vintage Cars', 'value' => 'IAB2-22', 'metadata' => array('parent' => 'IAB2')),
803
+ array('text' => 'Wagon', 'value' => 'IAB2-23', 'metadata' => array('parent' => 'IAB2')),
804
+ array('text' => 'Advertising', 'value' => 'IAB3-1', 'metadata' => array('parent' => 'IAB3')),
805
+ array('text' => 'Agriculture', 'value' => 'IAB3-2', 'metadata' => array('parent' => 'IAB3')),
806
+ array('text' => 'Biotech/Biomedical', 'value' => 'IAB3-3', 'metadata' => array('parent' => 'IAB3')),
807
+ array('text' => 'Business Software', 'value' => 'IAB3-4', 'metadata' => array('parent' => 'IAB3')),
808
+ array('text' => 'Construction', 'value' => 'IAB3-5', 'metadata' => array('parent' => 'IAB3')),
809
+ array('text' => 'Forestry', 'value' => 'IAB3-6', 'metadata' => array('parent' => 'IAB3')),
810
+ array('text' => 'Government', 'value' => 'IAB3-7', 'metadata' => array('parent' => 'IAB3')),
811
+ array('text' => 'Green Solutions', 'value' => 'IAB3-8', 'metadata' => array('parent' => 'IAB3')),
812
+ array('text' => 'Human Resources', 'value' => 'IAB3-9', 'metadata' => array('parent' => 'IAB3')),
813
+ array('text' => 'Logistics', 'value' => 'IAB3-10', 'metadata' => array('parent' => 'IAB3')),
814
+ array('text' => 'Marketing', 'value' => 'IAB3-11', 'metadata' => array('parent' => 'IAB3')),
815
+ array('text' => 'Metals', 'value' => 'IAB3-12', 'metadata' => array('parent' => 'IAB3')),
816
+ array('text' => 'Career Planning', 'value' => 'IAB4-1', 'metadata' => array('parent' => 'IAB4')),
817
+ array('text' => 'College', 'value' => 'IAB4-2', 'metadata' => array('parent' => 'IAB4')),
818
+ array('text' => 'Financial Aid', 'value' => 'IAB4-3', 'metadata' => array('parent' => 'IAB4')),
819
+ array('text' => 'Job Fairs', 'value' => 'IAB4-4', 'metadata' => array('parent' => 'IAB4')),
820
+ array('text' => 'Job Search', 'value' => 'IAB4-5', 'metadata' => array('parent' => 'IAB4')),
821
+ array('text' => 'Resume Writing/Advice', 'value' => 'IAB4-6', 'metadata' => array('parent' => 'IAB4')),
822
+ array('text' => 'Nursing', 'value' => 'IAB4-7', 'metadata' => array('parent' => 'IAB4')),
823
+ array('text' => 'Scholarships', 'value' => 'IAB4-8', 'metadata' => array('parent' => 'IAB4')),
824
+ array('text' => 'Telecommuting', 'value' => 'IAB4-9', 'metadata' => array('parent' => 'IAB4')),
825
+ array('text' => 'U.S. Military', 'value' => 'IAB4-10', 'metadata' => array('parent' => 'IAB4')),
826
+ array('text' => 'Career Advice', 'value' => 'IAB4-11', 'metadata' => array('parent' => 'IAB4')),
827
+ array('text' => '7-12 Education', 'value' => 'IAB5-1', 'metadata' => array('parent' => 'IAB5')),
828
+ array('text' => 'Adult Education', 'value' => 'IAB5-2', 'metadata' => array('parent' => 'IAB5')),
829
+ array('text' => 'Art History', 'value' => 'IAB5-3', 'metadata' => array('parent' => 'IAB5')),
830
+ array('text' => 'Colledge Administration', 'value' => 'IAB5-4', 'metadata' => array('parent' => 'IAB5')),
831
+ array('text' => 'College Life', 'value' => 'IAB5-5', 'metadata' => array('parent' => 'IAB5')),
832
+ array('text' => 'Distance Learning', 'value' => 'IAB5-6', 'metadata' => array('parent' => 'IAB5')),
833
+ array('text' => 'English as a 2nd Language', 'value' => 'IAB5-7', 'metadata' => array('parent' => 'IAB5')),
834
+ array('text' => 'Language Learning', 'value' => 'IAB5-8', 'metadata' => array('parent' => 'IAB5')),
835
+ array('text' => 'Graduate School', 'value' => 'IAB5-9', 'metadata' => array('parent' => 'IAB5')),
836
+ array('text' => 'Homeschooling', 'value' => 'IAB5-10', 'metadata' => array('parent' => 'IAB5')),
837
+ array('text' => 'Homework/Study Tips', 'value' => 'IAB5-11', 'metadata' => array('parent' => 'IAB5')),
838
+ array('text' => 'K-6 Educators', 'value' => 'IAB5-12', 'metadata' => array('parent' => 'IAB5')),
839
+ array('text' => 'Private School', 'value' => 'IAB5-13', 'metadata' => array('parent' => 'IAB5')),
840
+ array('text' => 'Special Education', 'value' => 'IAB5-14', 'metadata' => array('parent' => 'IAB5')),
841
+ array('text' => 'Studying Business', 'value' => 'IAB5-15', 'metadata' => array('parent' => 'IAB5')),
842
+ array('text' => 'Adoption', 'value' => 'IAB6-1', 'metadata' => array('parent' => 'IAB6')),
843
+ array('text' => 'Babies & Toddlers', 'value' => 'IAB6-2', 'metadata' => array('parent' => 'IAB6')),
844
+ array('text' => 'Daycare/Pre School', 'value' => 'IAB6-3', 'metadata' => array('parent' => 'IAB6')),
845
+ array('text' => 'Family Internet', 'value' => 'IAB6-4', 'metadata' => array('parent' => 'IAB6')),
846
+ array('text' => 'Parenting – K-6 Kids', 'value' => 'IAB6-5', 'metadata' => array('parent' => 'IAB6')),
847
+ array('text' => 'Parenting teens', 'value' => 'IAB6-6', 'metadata' => array('parent' => 'IAB6')),
848
+ array('text' => 'Pregnancy', 'value' => 'IAB6-7', 'metadata' => array('parent' => 'IAB6')),
849
+ array('text' => 'Special Needs Kids', 'value' => 'IAB6-8', 'metadata' => array('parent' => 'IAB6')),
850
+ array('text' => 'Eldercare', 'value' => 'IAB6-9', 'metadata' => array('parent' => 'IAB6')),
851
+ array('text' => 'Exercise', 'value' => 'IAB7-1', 'metadata' => array('parent' => 'IAB7')),
852
+ array('text' => 'A.D.D.', 'value' => 'IAB7-2', 'metadata' => array('parent' => 'IAB7')),
853
+ array('text' => 'AIDS/HIV', 'value' => 'IAB7-3', 'metadata' => array('parent' => 'IAB7')),
854
+ array('text' => 'Allergies', 'value' => 'IAB7-4', 'metadata' => array('parent' => 'IAB7')),
855
+ array('text' => 'Alternative Medicine', 'value' => 'IAB7-5', 'metadata' => array('parent' => 'IAB7')),
856
+ array('text' => 'Arthritis', 'value' => 'IAB7-6', 'metadata' => array('parent' => 'IAB7')),
857
+ array('text' => 'Asthma', 'value' => 'IAB7-7', 'metadata' => array('parent' => 'IAB7')),
858
+ array('text' => 'Autism/PDD', 'value' => 'IAB7-8', 'metadata' => array('parent' => 'IAB7')),
859
+ array('text' => 'Bipolar Disorder', 'value' => 'IAB7-9', 'metadata' => array('parent' => 'IAB7')),
860
+ array('text' => 'Brain Tumor', 'value' => 'IAB7-10', 'metadata' => array('parent' => 'IAB7')),
861
+ array('text' => 'Cancer', 'value' => 'IAB7-11', 'metadata' => array('parent' => 'IAB7')),
862
+ array('text' => 'Cholesterol', 'value' => 'IAB7-12', 'metadata' => array('parent' => 'IAB7')),
863
+ array('text' => 'Chronic Fatigue Syndrome', 'value' => 'IAB7-13', 'metadata' => array('parent' => 'IAB7')),
864
+ array('text' => 'Chronic Pain', 'value' => 'IAB7-14', 'metadata' => array('parent' => 'IAB7')),
865
+ array('text' => 'Cold & Flu', 'value' => 'IAB7-15', 'metadata' => array('parent' => 'IAB7')),
866
+ array('text' => 'Deafness', 'value' => 'IAB7-16', 'metadata' => array('parent' => 'IAB7')),
867
+ array('text' => 'Dental Care', 'value' => 'IAB7-17', 'metadata' => array('parent' => 'IAB7')),
868
+ array('text' => 'Depression', 'value' => 'IAB7-18', 'metadata' => array('parent' => 'IAB7')),
869
+ array('text' => 'Dermatology', 'value' => 'IAB7-19', 'metadata' => array('parent' => 'IAB7')),
870
+ array('text' => 'Diabetes', 'value' => 'IAB7-20', 'metadata' => array('parent' => 'IAB7')),
871
+ array('text' => 'Epilepsy', 'value' => 'IAB7-21', 'metadata' => array('parent' => 'IAB7')),
872
+ array('text' => 'GERD/Acid Reflux', 'value' => 'IAB7-22', 'metadata' => array('parent' => 'IAB7')),
873
+ array('text' => 'Headaches/Migraines', 'value' => 'IAB7-23', 'metadata' => array('parent' => 'IAB7')),
874
+ array('text' => 'Heart Disease', 'value' => 'IAB7-24', 'metadata' => array('parent' => 'IAB7')),
875
+ array('text' => 'Herbs for Health', 'value' => 'IAB7-25', 'metadata' => array('parent' => 'IAB7')),
876
+ array('text' => 'Holistic Healing', 'value' => 'IAB7-26', 'metadata' => array('parent' => 'IAB7')),
877
+ array('text' => 'IBS/Crohn’s Disease', 'value' => 'IAB7-27', 'metadata' => array('parent' => 'IAB7')),
878
+ array('text' => 'Incest/Abuse Support', 'value' => 'IAB7-28', 'metadata' => array('parent' => 'IAB7')),
879
+ array('text' => 'Incontinence', 'value' => 'IAB7-29', 'metadata' => array('parent' => 'IAB7')),
880
+ array('text' => 'Infertility', 'value' => 'IAB7-30', 'metadata' => array('parent' => 'IAB7')),
881
+ array('text' => 'Men’s Health', 'value' => 'IAB7-31', 'metadata' => array('parent' => 'IAB7')),
882
+ array('text' => 'Nutrition', 'value' => 'IAB7-32', 'metadata' => array('parent' => 'IAB7')),
883
+ array('text' => 'Orthopedics', 'value' => 'IAB7-33', 'metadata' => array('parent' => 'IAB7')),
884
+ array('text' => 'Panic/Anxiety Disorders', 'value' => 'IAB7-34', 'metadata' => array('parent' => 'IAB7')),
885
+ array('text' => 'Pediatrics', 'value' => 'IAB7-35', 'metadata' => array('parent' => 'IAB7')),
886
+ array('text' => 'Physical Therapy', 'value' => 'IAB7-36', 'metadata' => array('parent' => 'IAB7')),
887
+ array('text' => 'Psychology/Psychiatry', 'value' => 'IAB7-37', 'metadata' => array('parent' => 'IAB7')),
888
+ array('text' => 'Senor Health', 'value' => 'IAB7-38', 'metadata' => array('parent' => 'IAB7')),
889
+ array('text' => 'Sexuality', 'value' => 'IAB7-39', 'metadata' => array('parent' => 'IAB7')),
890
+ array('text' => 'Sleep Disorders', 'value' => 'IAB7-40', 'metadata' => array('parent' => 'IAB7')),
891
+ array('text' => 'Smoking Cessation', 'value' => 'IAB7-41', 'metadata' => array('parent' => 'IAB7')),
892
+ array('text' => 'Substance Abuse', 'value' => 'IAB7-42', 'metadata' => array('parent' => 'IAB7')),
893
+ array('text' => 'Thyroid Disease', 'value' => 'IAB7-43', 'metadata' => array('parent' => 'IAB7')),
894
+ array('text' => 'Weight Loss', 'value' => 'IAB7-44', 'metadata' => array('parent' => 'IAB7')),
895
+ array('text' => 'Women’s Health', 'value' => 'IAB7-45', 'metadata' => array('parent' => 'IAB7')),
896
+ array('text' => 'American Cuisine', 'value' => 'IAB8-1', 'metadata' => array('parent' => 'IAB8')),
897
+ array('text' => 'Barbecues & Grilling', 'value' => 'IAB8-2', 'metadata' => array('parent' => 'IAB8')),
898
+ array('text' => 'Cajun/Creole', 'value' => 'IAB8-3', 'metadata' => array('parent' => 'IAB8')),
899
+ array('text' => 'Chinese Cuisine', 'value' => 'IAB8-4', 'metadata' => array('parent' => 'IAB8')),
900
+ array('text' => 'Cocktails/Beer', 'value' => 'IAB8-5', 'metadata' => array('parent' => 'IAB8')),
901
+ array('text' => 'Coffee/Tea', 'value' => 'IAB8-6', 'metadata' => array('parent' => 'IAB8')),
902
+ array('text' => 'Cuisine-Specific', 'value' => 'IAB8-7', 'metadata' => array('parent' => 'IAB8')),
903
+ array('text' => 'Desserts & Baking', 'value' => 'IAB8-8', 'metadata' => array('parent' => 'IAB8')),
904
+ array('text' => 'Dining Out', 'value' => 'IAB8-9', 'metadata' => array('parent' => 'IAB8')),
905
+ array('text' => 'Food Allergies', 'value' => 'IAB8-10', 'metadata' => array('parent' => 'IAB8')),
906
+ array('text' => 'French Cuisine', 'value' => 'IAB8-11', 'metadata' => array('parent' => 'IAB8')),
907
+ array('text' => 'Health/Lowfat Cooking', 'value' => 'IAB8-12', 'metadata' => array('parent' => 'IAB8')),
908
+ array('text' => 'Italian Cuisine', 'value' => 'IAB8-13', 'metadata' => array('parent' => 'IAB8')),
909
+ array('text' => 'Japanese Cuisine', 'value' => 'IAB8-14', 'metadata' => array('parent' => 'IAB8')),
910
+ array('text' => 'Mexican Cuisine', 'value' => 'IAB8-15', 'metadata' => array('parent' => 'IAB8')),
911
+ array('text' => 'Vegan', 'value' => 'IAB8-16', 'metadata' => array('parent' => 'IAB8')),
912
+ array('text' => 'Vegetarian', 'value' => 'IAB8-17', 'metadata' => array('parent' => 'IAB8')),
913
+ array('text' => 'Wine', 'value' => 'IAB8-18', 'metadata' => array('parent' => 'IAB8')),
914
+ array('text' => 'Art/Technology', 'value' => 'IAB9-1', 'metadata' => array('parent' => 'IAB9')),
915
+ array('text' => 'Arts & Crafts', 'value' => 'IAB9-2', 'metadata' => array('parent' => 'IAB9')),
916
+ array('text' => 'Beadwork', 'value' => 'IAB9-3', 'metadata' => array('parent' => 'IAB9')),
917
+ array('text' => 'Birdwatching', 'value' => 'IAB9-4', 'metadata' => array('parent' => 'IAB9')),
918
+ array('text' => 'Board Games/Puzzles', 'value' => 'IAB9-5', 'metadata' => array('parent' => 'IAB9')),
919
+ array('text' => 'Candle & Soap Making', 'value' => 'IAB9-6', 'metadata' => array('parent' => 'IAB9')),
920
+ array('text' => 'Card Games', 'value' => 'IAB9-7', 'metadata' => array('parent' => 'IAB9')),
921
+ array('text' => 'Chess', 'value' => 'IAB9-8', 'metadata' => array('parent' => 'IAB9')),
922
+ array('text' => 'Cigars', 'value' => 'IAB9-9', 'metadata' => array('parent' => 'IAB9')),
923
+ array('text' => 'Collecting', 'value' => 'IAB9-10', 'metadata' => array('parent' => 'IAB9')),
924
+ array('text' => 'Comic Books', 'value' => 'IAB9-11', 'metadata' => array('parent' => 'IAB9')),
925
+ array('text' => 'Drawing/Sketching', 'value' => 'IAB9-12', 'metadata' => array('parent' => 'IAB9')),
926
+ array('text' => 'Freelance Writing', 'value' => 'IAB9-13', 'metadata' => array('parent' => 'IAB9')),
927
+ array('text' => 'Genealogy', 'value' => 'IAB9-14', 'metadata' => array('parent' => 'IAB9')),
928
+ array('text' => 'Getting Published', 'value' => 'IAB9-15', 'metadata' => array('parent' => 'IAB9')),
929
+ array('text' => 'Guitar', 'value' => 'IAB9-16', 'metadata' => array('parent' => 'IAB9')),
930
+ array('text' => 'Home Recording', 'value' => 'IAB9-17', 'metadata' => array('parent' => 'IAB9')),
931
+ array('text' => 'Investors & Patents', 'value' => 'IAB9-18', 'metadata' => array('parent' => 'IAB9')),
932
+ array('text' => 'Jewelry Making', 'value' => 'IAB9-19', 'metadata' => array('parent' => 'IAB9')),
933
+ array('text' => 'Magic & Illusion', 'value' => 'IAB9-20', 'metadata' => array('parent' => 'IAB9')),
934
+ array('text' => 'Needlework', 'value' => 'IAB9-21', 'metadata' => array('parent' => 'IAB9')),
935
+ array('text' => 'Painting', 'value' => 'IAB9-22', 'metadata' => array('parent' => 'IAB9')),
936
+ array('text' => 'Photography', 'value' => 'IAB9-23', 'metadata' => array('parent' => 'IAB9')),
937
+ array('text' => 'Radio', 'value' => 'IAB9-24', 'metadata' => array('parent' => 'IAB9')),
938
+ array('text' => 'Roleplaying Games', 'value' => 'IAB9-25', 'metadata' => array('parent' => 'IAB9')),
939
+ array('text' => 'Sci-Fi & Fantasy', 'value' => 'IAB9-26', 'metadata' => array('parent' => 'IAB9')),
940
+ array('text' => 'Scrapbooking', 'value' => 'IAB9-27', 'metadata' => array('parent' => 'IAB9')),
941
+ array('text' => 'Screenwriting', 'value' => 'IAB9-28', 'metadata' => array('parent' => 'IAB9')),
942
+ array('text' => 'Stamps & Coins', 'value' => 'IAB9-29', 'metadata' => array('parent' => 'IAB9')),
943
+ array('text' => 'Video & Computer Games', 'value' => 'IAB9-30', 'metadata' => array('parent' => 'IAB9')),
944
+ array('text' => 'Woodworking', 'value' => 'IAB9-31', 'metadata' => array('parent' => 'IAB9')),
945
+ array('text' => 'Appliances', 'value' => 'IAB10-1', 'metadata' => array('parent' => 'IAB10')),
946
+ array('text' => 'Entertaining', 'value' => 'IAB10-2', 'metadata' => array('parent' => 'IAB10')),
947
+ array('text' => 'Environmental Safety', 'value' => 'IAB10-3', 'metadata' => array('parent' => 'IAB10')),
948
+ array('text' => 'Gardening', 'value' => 'IAB10-4', 'metadata' => array('parent' => 'IAB10')),
949
+ array('text' => 'Home Repair', 'value' => 'IAB10-5', 'metadata' => array('parent' => 'IAB10')),
950
+ array('text' => 'Home Theater', 'value' => 'IAB10-6', 'metadata' => array('parent' => 'IAB10')),
951
+ array('text' => 'Interior Decorating', 'value' => 'IAB10-7', 'metadata' => array('parent' => 'IAB10')),
952
+ array('text' => 'Landscaping', 'value' => 'IAB10-8', 'metadata' => array('parent' => 'IAB10')),
953
+ array('text' => 'Remodeling & Construction', 'value' => 'IAB10-9', 'metadata' => array('parent' => 'IAB10')),
954
+ array('text' => 'Immigration', 'value' => 'IAB11-1', 'metadata' => array('parent' => 'IAB11')),
955
+ array('text' => 'Legal Issues', 'value' => 'IAB11-2', 'metadata' => array('parent' => 'IAB11')),
956
+ array('text' => 'U.S. Government Resources', 'value' => 'IAB11-3', 'metadata' => array('parent' => 'IAB11')),
957
+ array('text' => 'Politics', 'value' => 'IAB11-4', 'metadata' => array('parent' => 'IAB11')),
958
+ array('text' => 'Commentary', 'value' => 'IAB11-5', 'metadata' => array('parent' => 'IAB11')),
959
+ array('text' => 'International News', 'value' => 'IAB12-1', 'metadata' => array('parent' => 'IAB12')),
960
+ array('text' => 'National News', 'value' => 'IAB12-2', 'metadata' => array('parent' => 'IAB12')),
961
+ array('text' => 'Local News', 'value' => 'IAB12-3', 'metadata' => array('parent' => 'IAB12')),
962
+ array('text' => 'Beginning Investing', 'value' => 'IAB13-1', 'metadata' => array('parent' => 'IAB13')),
963
+ array('text' => 'Credit/Debt & Loans', 'value' => 'IAB13-2', 'metadata' => array('parent' => 'IAB13')),
964
+ array('text' => 'Financial News', 'value' => 'IAB13-3', 'metadata' => array('parent' => 'IAB13')),
965
+ array('text' => 'Financial Planning', 'value' => 'IAB13-4', 'metadata' => array('parent' => 'IAB13')),
966
+ array('text' => 'Hedge Fund', 'value' => 'IAB13-5', 'metadata' => array('parent' => 'IAB13')),
967
+ array('text' => 'Insurance', 'value' => 'IAB13-6', 'metadata' => array('parent' => 'IAB13')),
968
+ array('text' => 'Investing', 'value' => 'IAB13-7', 'metadata' => array('parent' => 'IAB13')),
969
+ array('text' => 'Mutual Funds', 'value' => 'IAB13-8', 'metadata' => array('parent' => 'IAB13')),
970
+ array('text' => 'Options', 'value' => 'IAB13-9', 'metadata' => array('parent' => 'IAB13')),
971
+ array('text' => 'Retirement Planning', 'value' => 'IAB13-10', 'metadata' => array('parent' => 'IAB13')),
972
+ array('text' => 'Stocks', 'value' => 'IAB13-11', 'metadata' => array('parent' => 'IAB13')),
973
+ array('text' => 'Tax Planning', 'value' => 'IAB13-12', 'metadata' => array('parent' => 'IAB13')),
974
+ array('text' => 'Dating', 'value' => 'IAB14-1', 'metadata' => array('parent' => 'IAB14')),
975
+ array('text' => 'Divorce Support', 'value' => 'IAB14-2', 'metadata' => array('parent' => 'IAB14')),
976
+ array('text' => 'Gay Life', 'value' => 'IAB14-3', 'metadata' => array('parent' => 'IAB14')),
977
+ array('text' => 'Marriage', 'value' => 'IAB14-4', 'metadata' => array('parent' => 'IAB14')),
978
+ array('text' => 'Senior Living', 'value' => 'IAB14-5', 'metadata' => array('parent' => 'IAB14')),
979
+ array('text' => 'Teens', 'value' => 'IAB14-6', 'metadata' => array('parent' => 'IAB14')),
980
+ array('text' => 'Weddings', 'value' => 'IAB14-7', 'metadata' => array('parent' => 'IAB14')),
981
+ array('text' => 'Ethnic Specific', 'value' => 'IAB14-8', 'metadata' => array('parent' => 'IAB14')),
982
+ array('text' => 'Astrology', 'value' => 'IAB15-1', 'metadata' => array('parent' => 'IAB15')),
983
+ array('text' => 'Biology', 'value' => 'IAB15-2', 'metadata' => array('parent' => 'IAB15')),
984
+ array('text' => 'Chemistry', 'value' => 'IAB15-3', 'metadata' => array('parent' => 'IAB15')),
985
+ array('text' => 'Geology', 'value' => 'IAB15-4', 'metadata' => array('parent' => 'IAB15')),
986
+ array('text' => 'Paranormal Phenomena', 'value' => 'IAB15-5', 'metadata' => array('parent' => 'IAB15')),
987
+ array('text' => 'Physics', 'value' => 'IAB15-6', 'metadata' => array('parent' => 'IAB15')),
988
+ array('text' => 'Space/Astronomy', 'value' => 'IAB15-7', 'metadata' => array('parent' => 'IAB15')),
989
+ array('text' => 'Geography', 'value' => 'IAB15-8', 'metadata' => array('parent' => 'IAB15')),
990
+ array('text' => 'Botany', 'value' => 'IAB15-9', 'metadata' => array('parent' => 'IAB15')),
991
+ array('text' => 'Weather', 'value' => 'IAB15-10', 'metadata' => array('parent' => 'IAB15')),
992
+ array('text' => 'Aquariums', 'value' => 'IAB16-1', 'metadata' => array('parent' => 'IAB16')),
993
+ array('text' => 'Birds', 'value' => 'IAB16-2', 'metadata' => array('parent' => 'IAB16')),
994
+ array('text' => 'Cats', 'value' => 'IAB16-3', 'metadata' => array('parent' => 'IAB16')),
995
+ array('text' => 'Dogs', 'value' => 'IAB16-4', 'metadata' => array('parent' => 'IAB16')),
996
+ array('text' => 'Large Animals', 'value' => 'IAB16-5', 'metadata' => array('parent' => 'IAB16')),
997
+ array('text' => 'Reptiles', 'value' => 'IAB16-6', 'metadata' => array('parent' => 'IAB16')),
998
+ array('text' => 'Veterinary Medicine', 'value' => 'IAB16-7', 'metadata' => array('parent' => 'IAB16')),
999
+ array('text' => 'Auto Racing', 'value' => 'IAB17-1', 'metadata' => array('parent' => 'IAB17')),
1000
+ array('text' => 'Baseball', 'value' => 'IAB17-2', 'metadata' => array('parent' => 'IAB17')),
1001
+ array('text' => 'Bicycling', 'value' => 'IAB17-3', 'metadata' => array('parent' => 'IAB17')),
1002
+ array('text' => 'Bodybuilding', 'value' => 'IAB17-4', 'metadata' => array('parent' => 'IAB17')),
1003
+ array('text' => 'Boxing', 'value' => 'IAB17-5', 'metadata' => array('parent' => 'IAB17')),
1004
+ array('text' => 'Canoeing/Kayaking', 'value' => 'IAB17-6', 'metadata' => array('parent' => 'IAB17')),
1005
+ array('text' => 'Cheerleading', 'value' => 'IAB17-7', 'metadata' => array('parent' => 'IAB17')),
1006
+ array('text' => 'Climbing', 'value' => 'IAB17-8', 'metadata' => array('parent' => 'IAB17')),
1007
+ array('text' => 'Cricket', 'value' => 'IAB17-9', 'metadata' => array('parent' => 'IAB17')),
1008
+ array('text' => 'Figure Skating', 'value' => 'IAB17-10', 'metadata' => array('parent' => 'IAB17')),
1009
+ array('text' => 'Fly Fishing', 'value' => 'IAB17-11', 'metadata' => array('parent' => 'IAB17')),
1010
+ array('text' => 'Football', 'value' => 'IAB17-12', 'metadata' => array('parent' => 'IAB17')),
1011
+ array('text' => 'Freshwater Fishing', 'value' => 'IAB17-13', 'metadata' => array('parent' => 'IAB17')),
1012
+ array('text' => 'Game & Fish', 'value' => 'IAB17-14', 'metadata' => array('parent' => 'IAB17')),
1013
+ array('text' => 'Golf', 'value' => 'IAB17-15', 'metadata' => array('parent' => 'IAB17')),
1014
+ array('text' => 'Horse Racing', 'value' => 'IAB17-16', 'metadata' => array('parent' => 'IAB17')),
1015
+ array('text' => 'Horses', 'value' => 'IAB17-17', 'metadata' => array('parent' => 'IAB17')),
1016
+ array('text' => 'Hunting/Shooting', 'value' => 'IAB17-18', 'metadata' => array('parent' => 'IAB17')),
1017
+ array('text' => 'Inline Skating', 'value' => 'IAB17-19', 'metadata' => array('parent' => 'IAB17')),
1018
+ array('text' => 'Martial Arts', 'value' => 'IAB17-20', 'metadata' => array('parent' => 'IAB17')),
1019
+ array('text' => 'Mountain Biking', 'value' => 'IAB17-21', 'metadata' => array('parent' => 'IAB17')),
1020
+ array('text' => 'NASCAR Racing', 'value' => 'IAB17-22', 'metadata' => array('parent' => 'IAB17')),
1021
+ array('text' => 'Olympics', 'value' => 'IAB17-23', 'metadata' => array('parent' => 'IAB17')),
1022
+ array('text' => 'Paintball', 'value' => 'IAB17-24', 'metadata' => array('parent' => 'IAB17')),
1023
+ array('text' => 'Power & Motorcycles', 'value' => 'IAB17-25', 'metadata' => array('parent' => 'IAB17')),
1024
+ array('text' => 'Pro Basketball', 'value' => 'IAB17-26', 'metadata' => array('parent' => 'IAB17')),
1025
+ array('text' => 'Pro Ice Hockey', 'value' => 'IAB17-27', 'metadata' => array('parent' => 'IAB17')),
1026
+ array('text' => 'Rodeo', 'value' => 'IAB17-28', 'metadata' => array('parent' => 'IAB17')),
1027
+ array('text' => 'Rugby', 'value' => 'IAB17-29', 'metadata' => array('parent' => 'IAB17')),
1028
+ array('text' => 'Running/Jogging', 'value' => 'IAB17-30', 'metadata' => array('parent' => 'IAB17')),
1029
+ array('text' => 'Sailing', 'value' => 'IAB17-31', 'metadata' => array('parent' => 'IAB17')),
1030
+ array('text' => 'Saltwater Fishing', 'value' => 'IAB17-32', 'metadata' => array('parent' => 'IAB17')),
1031
+ array('text' => 'Scuba Diving', 'value' => 'IAB17-33', 'metadata' => array('parent' => 'IAB17')),
1032
+ array('text' => 'Skateboarding', 'value' => 'IAB17-34', 'metadata' => array('parent' => 'IAB17')),
1033
+ array('text' => 'Skiing', 'value' => 'IAB17-35', 'metadata' => array('parent' => 'IAB17')),
1034
+ array('text' => 'Snowboarding', 'value' => 'IAB17-36', 'metadata' => array('parent' => 'IAB17')),
1035
+ array('text' => 'Surfing/Bodyboarding', 'value' => 'IAB17-37', 'metadata' => array('parent' => 'IAB17')),
1036
+ array('text' => 'Swimming', 'value' => 'IAB17-38', 'metadata' => array('parent' => 'IAB17')),
1037
+ array('text' => 'Table Tennis/Ping-Pong', 'value' => 'IAB17-39', 'metadata' => array('parent' => 'IAB17')),
1038
+ array('text' => 'Tennis', 'value' => 'IAB17-40', 'metadata' => array('parent' => 'IAB17')),
1039
+ array('text' => 'Volleyball', 'value' => 'IAB17-41', 'metadata' => array('parent' => 'IAB17')),
1040
+ array('text' => 'Walking', 'value' => 'IAB17-42', 'metadata' => array('parent' => 'IAB17')),
1041
+ array('text' => 'Waterski/Wakeboard', 'value' => 'IAB17-43', 'metadata' => array('parent' => 'IAB17')),
1042
+ array('text' => 'World Soccer', 'value' => 'IAB17-44', 'metadata' => array('parent' => 'IAB17')),
1043
+ array('text' => 'Beauty', 'value' => 'IAB18-1', 'metadata' => array('parent' => 'IAB18')),
1044
+ array('text' => 'Body Art', 'value' => 'IAB18-2', 'metadata' => array('parent' => 'IAB18')),
1045
+ array('text' => 'Fashion', 'value' => 'IAB18-3', 'metadata' => array('parent' => 'IAB18')),
1046
+ array('text' => 'Jewelry', 'value' => 'IAB18-4', 'metadata' => array('parent' => 'IAB18')),
1047
+ array('text' => 'Clothing', 'value' => 'IAB18-5', 'metadata' => array('parent' => 'IAB18')),
1048
+ array('text' => 'Accessories', 'value' => 'IAB18-6', 'metadata' => array('parent' => 'IAB18')),
1049
+ array('text' => '3-D Graphics', 'value' => 'IAB19-1', 'metadata' => array('parent' => 'IAB19')),
1050
+ array('text' => 'Animation', 'value' => 'IAB19-2', 'metadata' => array('parent' => 'IAB19')),
1051
+ array('text' => 'Antivirus Software', 'value' => 'IAB19-3', 'metadata' => array('parent' => 'IAB19')),
1052
+ array('text' => 'C/C++', 'value' => 'IAB19-4', 'metadata' => array('parent' => 'IAB19')),
1053
+ array('text' => 'Cameras & Camcorders', 'value' => 'IAB19-5', 'metadata' => array('parent' => 'IAB19')),
1054
+ array('text' => 'Cell Phones', 'value' => 'IAB19-6', 'metadata' => array('parent' => 'IAB19')),
1055
+ array('text' => 'Computer Certification', 'value' => 'IAB19-7', 'metadata' => array('parent' => 'IAB19')),
1056
+ array('text' => 'Computer Networking', 'value' => 'IAB19-8', 'metadata' => array('parent' => 'IAB19')),
1057
+ array('text' => 'Computer Peripherals', 'value' => 'IAB19-9', 'metadata' => array('parent' => 'IAB19')),
1058
+ array('text' => 'Computer Reviews', 'value' => 'IAB19-10', 'metadata' => array('parent' => 'IAB19')),
1059
+ array('text' => 'Data Centers', 'value' => 'IAB19-11', 'metadata' => array('parent' => 'IAB19')),
1060
+ array('text' => 'Databases', 'value' => 'IAB19-12', 'metadata' => array('parent' => 'IAB19')),
1061
+ array('text' => 'Desktop Publishing', 'value' => 'IAB19-13', 'metadata' => array('parent' => 'IAB19')),
1062
+ array('text' => 'Desktop Video', 'value' => 'IAB19-14', 'metadata' => array('parent' => 'IAB19')),
1063
+ array('text' => 'Email', 'value' => 'IAB19-15', 'metadata' => array('parent' => 'IAB19')),
1064
+ array('text' => 'Graphics Software', 'value' => 'IAB19-16', 'metadata' => array('parent' => 'IAB19')),
1065
+ array('text' => 'Home Video/DVD', 'value' => 'IAB19-17', 'metadata' => array('parent' => 'IAB19')),
1066
+ array('text' => 'Internet Technology', 'value' => 'IAB19-18', 'metadata' => array('parent' => 'IAB19')),
1067
+ array('text' => 'Java', 'value' => 'IAB19-19', 'metadata' => array('parent' => 'IAB19')),
1068
+ array('text' => 'JavaScript', 'value' => 'IAB19-20', 'metadata' => array('parent' => 'IAB19')),
1069
+ array('text' => 'Mac Support', 'value' => 'IAB19-21', 'metadata' => array('parent' => 'IAB19')),
1070
+ array('text' => 'MP3/MIDI', 'value' => 'IAB19-22', 'metadata' => array('parent' => 'IAB19')),
1071
+ array('text' => 'Net Conferencing', 'value' => 'IAB19-23', 'metadata' => array('parent' => 'IAB19')),
1072
+ array('text' => 'Net for Beginners', 'value' => 'IAB19-24', 'metadata' => array('parent' => 'IAB19')),
1073
+ array('text' => 'Network Security', 'value' => 'IAB19-25', 'metadata' => array('parent' => 'IAB19')),
1074
+ array('text' => 'Palmtops/PDAs', 'value' => 'IAB19-26', 'metadata' => array('parent' => 'IAB19')),
1075
+ array('text' => 'PC Support', 'value' => 'IAB19-27', 'metadata' => array('parent' => 'IAB19')),
1076
+ array('text' => 'Portable', 'value' => 'IAB19-28', 'metadata' => array('parent' => 'IAB19')),
1077
+ array('text' => 'Entertainment', 'value' => 'IAB19-29', 'metadata' => array('parent' => 'IAB19')),
1078
+ array('text' => 'Shareware/Freeware', 'value' => 'IAB19-30', 'metadata' => array('parent' => 'IAB19')),
1079
+ array('text' => 'Unix', 'value' => 'IAB19-31', 'metadata' => array('parent' => 'IAB19')),
1080
+ array('text' => 'Visual Basic', 'value' => 'IAB19-32', 'metadata' => array('parent' => 'IAB19')),
1081
+ array('text' => 'Web Clip Art', 'value' => 'IAB19-33', 'metadata' => array('parent' => 'IAB19')),
1082
+ array('text' => 'Web Design/HTML', 'value' => 'IAB19-34', 'metadata' => array('parent' => 'IAB19')),
1083
+ array('text' => 'Web Search', 'value' => 'IAB19-35', 'metadata' => array('parent' => 'IAB19')),
1084
+ array('text' => 'Windows', 'value' => 'IAB19-36', 'metadata' => array('parent' => 'IAB19')),
1085
+ array('text' => 'Adventure Travel', 'value' => 'IAB20-1', 'metadata' => array('parent' => 'IAB20')),
1086
+ array('text' => 'Africa', 'value' => 'IAB20-2', 'metadata' => array('parent' => 'IAB20')),
1087
+ array('text' => 'Air Travel', 'value' => 'IAB20-3', 'metadata' => array('parent' => 'IAB20')),
1088
+ array('text' => 'Australia & New Zealand', 'value' => 'IAB20-4', 'metadata' => array('parent' => 'IAB20')),
1089
+ array('text' => 'Bed & Breakfasts', 'value' => 'IAB20-5', 'metadata' => array('parent' => 'IAB20')),
1090
+ array('text' => 'Budget Travel', 'value' => 'IAB20-6', 'metadata' => array('parent' => 'IAB20')),
1091
+ array('text' => 'Business Travel', 'value' => 'IAB20-7', 'metadata' => array('parent' => 'IAB20')),
1092
+ array('text' => 'By US Locale', 'value' => 'IAB20-8', 'metadata' => array('parent' => 'IAB20')),
1093
+ array('text' => 'Camping', 'value' => 'IAB20-9', 'metadata' => array('parent' => 'IAB20')),
1094
+ array('text' => 'Canada', 'value' => 'IAB20-10', 'metadata' => array('parent' => 'IAB20')),
1095
+ array('text' => 'Caribbean', 'value' => 'IAB20-11', 'metadata' => array('parent' => 'IAB20')),
1096
+ array('text' => 'Cruises', 'value' => 'IAB20-12', 'metadata' => array('parent' => 'IAB20')),
1097
+ array('text' => 'Eastern Europe', 'value' => 'IAB20-13', 'metadata' => array('parent' => 'IAB20')),
1098
+ array('text' => 'Europe', 'value' => 'IAB20-14', 'metadata' => array('parent' => 'IAB20')),
1099
+ array('text' => 'France', 'value' => 'IAB20-15', 'metadata' => array('parent' => 'IAB20')),
1100
+ array('text' => 'Greece', 'value' => 'IAB20-16', 'metadata' => array('parent' => 'IAB20')),
1101
+ array('text' => 'Honeymoons/Getaways', 'value' => 'IAB20-17', 'metadata' => array('parent' => 'IAB20')),
1102
+ array('text' => 'Hotels', 'value' => 'IAB20-18', 'metadata' => array('parent' => 'IAB20')),
1103
+ array('text' => 'Italy', 'value' => 'IAB20-19', 'metadata' => array('parent' => 'IAB20')),
1104
+ array('text' => 'Japan', 'value' => 'IAB20-20', 'metadata' => array('parent' => 'IAB20')),
1105
+ array('text' => 'Mexico & Central America', 'value' => 'IAB20-21', 'metadata' => array('parent' => 'IAB20')),
1106
+ array('text' => 'National Parks', 'value' => 'IAB20-22', 'metadata' => array('parent' => 'IAB20')),
1107
+ array('text' => 'South America', 'value' => 'IAB20-23', 'metadata' => array('parent' => 'IAB20')),
1108
+ array('text' => 'Spas', 'value' => 'IAB20-24', 'metadata' => array('parent' => 'IAB20')),
1109
+ array('text' => 'Theme Parks', 'value' => 'IAB20-25', 'metadata' => array('parent' => 'IAB20')),
1110
+ array('text' => 'Traveling with Kids', 'value' => 'IAB20-26', 'metadata' => array('parent' => 'IAB20')),
1111
+ array('text' => 'United Kingdom', 'value' => 'IAB20-27', 'metadata' => array('parent' => 'IAB20')),
1112
+ array('text' => 'Apartments', 'value' => 'IAB21-1', 'metadata' => array('parent' => 'IAB21')),
1113
+ array('text' => 'Architects', 'value' => 'IAB21-2', 'metadata' => array('parent' => 'IAB21')),
1114
+ array('text' => 'Buying/Selling Homes', 'value' => 'IAB21-3', 'metadata' => array('parent' => 'IAB21')),
1115
+ array('text' => 'Contests & Freebies', 'value' => 'IAB22-1', 'metadata' => array('parent' => 'IAB22')),
1116
+ array('text' => 'Couponing', 'value' => 'IAB22-2', 'metadata' => array('parent' => 'IAB22')),
1117
+ array('text' => 'Comparison', 'value' => 'IAB22-3', 'metadata' => array('parent' => 'IAB22')),
1118
+ array('text' => 'Engines', 'value' => 'IAB22-4', 'metadata' => array('parent' => 'IAB22')),
1119
+ array('text' => 'Alternative Religions', 'value' => 'IAB23-1', 'metadata' => array('parent' => 'IAB23')),
1120
+ array('text' => 'Atheism/Agnosticism', 'value' => 'IAB23-2', 'metadata' => array('parent' => 'IAB23')),
1121
+ array('text' => 'Buddhism', 'value' => 'IAB23-3', 'metadata' => array('parent' => 'IAB23')),
1122
+ array('text' => 'Catholicism', 'value' => 'IAB23-4', 'metadata' => array('parent' => 'IAB23')),
1123
+ array('text' => 'Christianity', 'value' => 'IAB23-5', 'metadata' => array('parent' => 'IAB23')),
1124
+ array('text' => 'Hinduism', 'value' => 'IAB23-6', 'metadata' => array('parent' => 'IAB23')),
1125
+ array('text' => 'Islam', 'value' => 'IAB23-7', 'metadata' => array('parent' => 'IAB23')),
1126
+ array('text' => 'Judaism', 'value' => 'IAB23-8', 'metadata' => array('parent' => 'IAB23')),
1127
+ array('text' => 'Latter-Day Saints', 'value' => 'IAB23-9', 'metadata' => array('parent' => 'IAB23')),
1128
+ array('text' => 'Pagan/Wiccan', 'value' => 'IAB23-10', 'metadata' => array('parent' => 'IAB23')),
1129
+ array('text' => 'Unmoderated UGC', 'value' => 'IAB25-1', 'metadata' => array('parent' => 'IAB25')),
1130
+ array('text' => 'Extreme Graphic/Explicit Violence', 'value' => 'IAB25-2', 'metadata' => array('parent' => 'IAB25')),
1131
+ array('text' => 'Pornography', 'value' => 'IAB25-3', 'metadata' => array('parent' => 'IAB25')),
1132
+ array('text' => 'Profane Content', 'value' => 'IAB25-4', 'metadata' => array('parent' => 'IAB25')),
1133
+ array('text' => 'Hate Content', 'value' => 'IAB25-5', 'metadata' => array('parent' => 'IAB25')),
1134
+ array('text' => 'Under Construction', 'value' => 'IAB25-6', 'metadata' => array('parent' => 'IAB25')),
1135
+ array('text' => 'Incentivized', 'value' => 'IAB25-7', 'metadata' => array('parent' => 'IAB25')),
1136
+ array('text' => 'Illegal Content', 'value' => 'IAB26-1', 'metadata' => array('parent' => 'IAB26')),
1137
+ array('text' => 'Warez', 'value' => 'IAB26-2', 'metadata' => array('parent' => 'IAB26')),
1138
+ array('text' => 'Spyware/Malware', 'value' => 'IAB26-3', 'metadata' => array('parent' => 'IAB26')),
1139
+ array('text' => 'Copyright Infringement', 'value' => 'IAB26-4', 'metadata' => array('parent' => 'IAB26'))
1140
+ );
1141
+ foreach($IABChildCategories as $IABChildCategoryItem) {
1142
+ if($vicodeSettings['iab_category_child'] == $IABChildCategoryItem['value']) {
1143
+ $output .= '<label>IAB Category:</label><b>'.$IABChildCategoryItem['text'].'</b>';
1144
+ }
1145
+ }
1146
+ }
1147
+
1148
+ $languages = insert_ads_vi_api_get_languages();
1149
+ if(isset($vicodeSettings['language']) && ($vicodeSettings['language'] != '') && ($vicodeSettings['language'] != 'select')) {
1150
+ if($languages != false) {
1151
+ foreach($languages as $key => $value) {
1152
+ if($vicodeSettings['language'] == $key) {
1153
+ $output .= '<label>Language:</label><b>'.$value.'</b>';
1154
+ }
1155
+ }
1156
+ }
1157
+ }
1158
+
1159
+ if(isset($vicodeSettings['native_bg_color']) && ($vicodeSettings['native_bg_color'] != '')) {
1160
+ $output .= '<label>Native Background color:</label><b>'.$vicodeSettings['native_bg_color'].'</b>';
1161
+ }
1162
+
1163
+ if(isset($vicodeSettings['native_text_color']) && ($vicodeSettings['native_text_color'] != '')) {
1164
+ $output .= '<label>Native Text color:</label><b>'.$vicodeSettings['native_text_color'].'</b>';
1165
+ }
1166
+
1167
+ if(isset($vicodeSettings['font_family']) && ($vicodeSettings['font_family'] != '') && ($vicodeSettings['font_family'] != 'select')) {
1168
+ $fontFamily =array(
1169
+ array('text' => 'Select', 'value' => 'select'),
1170
+ array('text' => 'Georgia', 'value' => 'Georgia'),
1171
+ array('text' => 'Palatino Linotype', 'value' => 'Palatino Linotype'),
1172
+ array('text' => 'Times New Roman', 'value' => 'Times New Roman'),
1173
+ array('text' => 'Arial', 'value' => 'Arial'),
1174
+ array('text' => 'Arial Black', 'value' => 'Arial Black'),
1175
+ array('text' => 'Comic Sans MS', 'value' => 'Comic Sans MS'),
1176
+ array('text' => 'Impact', 'value' => 'Impact'),
1177
+ array('text' => 'Lucida Sans Unicode', 'value' => 'Lucida Sans Unicode'),
1178
+ array('text' => 'Tahoma', 'value' => 'Tahoma'),
1179
+ array('text' => 'Trebuchet MS', 'value' => 'Trebuchet MS'),
1180
+ array('text' => 'Verdana', 'value' => 'Verdana'),
1181
+ array('text' => 'Courier New', 'value' => 'Courier New'),
1182
+ array('text' => 'Lucida Console', 'value' => 'Lucida Console')
1183
+ );
1184
+ foreach($fontFamily as $fontFamilyItem) {
1185
+ if($vicodeSettings['font_family'] == $fontFamilyItem['value']) {
1186
+ $output .= '<label>Native Text Font Family:</label><b>'.$fontFamilyItem['text'].'</b>';
1187
+ }
1188
+ }
1189
+ }
1190
+
1191
+ if(isset($vicodeSettings['font_size']) && ($vicodeSettings['font_size'] != '') && ($vicodeSettings['font_size'] != 'select')) {
1192
+ $fontSize =array(
1193
+ array('text' => 'Select', 'value' => 'select'),
1194
+ array('text' => '8px', 'value' => '8'),
1195
+ array('text' => '9px', 'value' => '9'),
1196
+ array('text' => '10px', 'value' => '10'),
1197
+ array('text' => '11px', 'value' => '11'),
1198
+ array('text' => '12px', 'value' => '12'),
1199
+ array('text' => '14px', 'value' => '14'),
1200
+ array('text' => '16px', 'value' => '16'),
1201
+ array('text' => '18px', 'value' => '18'),
1202
+ array('text' => '20px', 'value' => '20'),
1203
+ array('text' => '22px', 'value' => '22'),
1204
+ array('text' => '24px', 'value' => '24'),
1205
+ array('text' => '26px', 'value' => '26'),
1206
+ array('text' => '28px', 'value' => '28'),
1207
+ array('text' => '36px', 'value' => '36')
1208
+ );
1209
+ foreach($fontSize as $fontSizeItem) {
1210
+ if($vicodeSettings['font_size'] == $fontSizeItem['value']) {
1211
+ $output .= '<label>Native Text Font Size:</label><b>'.$fontSizeItem['text'].'</b>';
1212
+ }
1213
+ }
1214
+ }
1215
+
1216
+ if(isset($vicodeSettings['optional_1']) && ($vicodeSettings['optional_1'] != '')) {
1217
+ $output .= '<label>Optional 1:</label><b>'.$vicodeSettings['optional_1'].'</b>';
1218
+ }
1219
+ if(isset($vicodeSettings['optional_2']) && ($vicodeSettings['optional_2'] != '')) {
1220
+ $output .= '<label>Optional 2:</label><b>'.$vicodeSettings['optional_1'].'</b>';
1221
+ }
1222
+ if(isset($vicodeSettings['optional_3']) && ($vicodeSettings['optional_3'] != '')) {
1223
+ $output .= '<label>Optional 3:</label><b>'.$vicodeSettings['optional_1'].'</b>';
1224
+ }
1225
+ $output .= '</p>';
1226
+ }
1227
+ return $output;
1228
+ }
1229
+ /* End Configure vi Code */
1230
+ ?>
views/dashboard-notices.php CHANGED
File without changes
views/settings.php CHANGED
@@ -15,13 +15,18 @@
15
  ?>
16
 
17
  <div id="poststuff">
18
- <div id="post-body" class="metabox-holder columns-2">
19
  <!-- Content -->
20
  <div id="post-body-content">
21
  <div id="normal-sortables" class="meta-box-sortables ui-sortable">
22
- <form action="edit.php?post_type=<?php echo $this->plugin->posttype; ?>&page=<?php echo $this->plugin->name; ?>" method="post">
 
 
 
 
 
23
  <div class="postbox">
24
- <h3 class="hndle"><?php _e( 'Where do you want ads to display?', $this->plugin->name ); ?></h3>
25
 
26
  <div class="inside">
27
  <p>
@@ -43,33 +48,31 @@
43
  }
44
  ?>
45
  </p>
46
- <p>
47
- <input name="submit" type="submit" name="Submit" class="button button-primary" value="<?php _e( 'Save Settings', $this->plugin->name ); ?>" />
48
- </p>
49
- </div>
50
- </div>
51
- <!-- /postbox -->
52
-
53
- <div class="postbox">
54
- <h3 class="hndle"><?php _e( 'Display Styling', $this->plugin->name ); ?></h3>
55
-
56
- <div class="inside">
57
- <p>
58
  <label for="css"><?php _e( 'Exclude CSS', $this->plugin->name ) ;?></label>
59
  <input type="checkbox" name="<?php echo $this->plugin->name; ?>[css]" value="1" id="css" <?php echo ( isset( $this->settings['css'] ) ? ' checked' : '' ); ?>/>
60
  </p>
61
  <p class="description">
62
  <?php _e( 'By default, Post Ads are wrapped in a container that has some CSS to aid layout. Developers may wish to use their own CSS, and should check this Exclude CSS option.', $this->plugin->name ); ?>
63
  </p>
64
-
65
  <p>
66
  <input name="submit" type="submit" name="Submit" class="button button-primary" value="<?php _e( 'Save Settings', $this->plugin->name ); ?>" />
67
  </p>
68
  </div>
69
  </div>
 
 
 
70
  <!-- /postbox -->
71
  <input type="hidden" name="_nonce" value= "<?php echo wp_create_nonce( $this->plugin->name . '-nonce' ); ?>" />
72
  </form>
 
 
 
 
 
 
 
73
  <!-- /postbox -->
74
  </div>
75
  <!-- /normal-sortables -->
@@ -77,9 +80,7 @@
77
  <!-- /post-body-content -->
78
 
79
  <!-- Sidebar -->
80
- <div id="postbox-container-1" class="postbox-container">
81
- <?php require_once( $this->plugin->folder . '/views/sidebar.php' ); ?>
82
- </div>
83
  <!-- /postbox-container -->
84
  </div>
85
  </div>
15
  ?>
16
 
17
  <div id="poststuff">
18
+ <div id="post-body" class="metabox-holder">
19
  <!-- Content -->
20
  <div id="post-body-content">
21
  <div id="normal-sortables" class="meta-box-sortables ui-sortable">
22
+ <div class="postbox">
23
+ <?php insert_ads_vi_plugin_card();
24
+ //insert_ads_inpostads_form_get_content('above');
25
+ ?>
26
+ </div>
27
+ <form action="edit.php?post_type=<?php echo $this->plugin->posttype; ?>&page=<?php echo $this->plugin->name; ?>" method="post" class="ins-settings">
28
  <div class="postbox">
29
+ <h3 class="hndle"><?php _e( 'Display Settings', $this->plugin->name ); ?></h3>
30
 
31
  <div class="inside">
32
  <p>
48
  }
49
  ?>
50
  </p>
51
+ <p style="margin-top:30px;">
 
 
 
 
 
 
 
 
 
 
 
52
  <label for="css"><?php _e( 'Exclude CSS', $this->plugin->name ) ;?></label>
53
  <input type="checkbox" name="<?php echo $this->plugin->name; ?>[css]" value="1" id="css" <?php echo ( isset( $this->settings['css'] ) ? ' checked' : '' ); ?>/>
54
  </p>
55
  <p class="description">
56
  <?php _e( 'By default, Post Ads are wrapped in a container that has some CSS to aid layout. Developers may wish to use their own CSS, and should check this Exclude CSS option.', $this->plugin->name ); ?>
57
  </p>
 
58
  <p>
59
  <input name="submit" type="submit" name="Submit" class="button button-primary" value="<?php _e( 'Save Settings', $this->plugin->name ); ?>" />
60
  </p>
61
  </div>
62
  </div>
63
+ <!-- /postbox -->
64
+
65
+
66
  <!-- /postbox -->
67
  <input type="hidden" name="_nonce" value= "<?php echo wp_create_nonce( $this->plugin->name . '-nonce' ); ?>" />
68
  </form>
69
+
70
+ <div class="postbox vi-choose">
71
+ <?php insert_ads_inpostads_plugin_card();
72
+ //insert_ads_inpostads_form_get_content('above');
73
+ ?>
74
+ </div>
75
+
76
  <!-- /postbox -->
77
  </div>
78
  <!-- /normal-sortables -->
80
  <!-- /post-body-content -->
81
 
82
  <!-- Sidebar -->
83
+
 
 
84
  <!-- /postbox-container -->
85
  </div>
86
  </div>
views/sidebar.php CHANGED
File without changes