Quick Adsense - Version 2.3

Version Description

  • Updated ads.txt modification logic
  • Introduced monetization with video intelligence AG
  • UI fixes
Download this release

Release Info

Developer quickadsense
Plugin Icon 128x128 Quick Adsense
Version 2.3
Comparing to
See all releases

Code changes from version 2.2 to 2.3

includes/ads.php DELETED
@@ -1,392 +0,0 @@
1
- <?php
2
- $ShownAds = 0;
3
- $AdsId = array();
4
- $beginend = 0;
5
- $wpvcomp = (bool)(version_compare($wp_version, '3.1', '>='));
6
-
7
- if($wpvcomp) {
8
- add_action('admin_print_footer_scripts', 'quick_adsense_2_admin_print_footer_scripts');
9
- }else{
10
- add_action('admin_head', 'quick_adsense_2_admin_print_footer_scripts');
11
- }
12
- function quick_adsense_2_admin_print_footer_scripts() {
13
- global $QData;
14
- global $wpvcomp;
15
- $options = quick_adsense_2_get_options_with_defaults();
16
- if (isset($options['QckTags']) && $options['QckTags']) { ?>
17
- <script type="text/javascript">
18
- wpvcomp = <?php echo(($wpvcomp==1)?"true":"false"); ?>;
19
- edaddID = new Array();
20
- edaddNm = new Array();
21
- if(typeof(edButtons)!='undefined') {
22
- edadd = edButtons.length;
23
- var dynads={"all":[
24
- <?php for ($i=1;$i<=$QData['Ads'];$i++) { if($options['AdsCode'.$i]!=''){echo('"1",');}else{echo('"0",');}; } ?>
25
- "0"]};
26
- for(i=1;i<=<?php echo($QData['Ads']) ?>;i++) {
27
- if(dynads.all[i-1]=="1") {
28
- edButtons[edButtons.length]=new edButton("ads"+i.toString(),"Ads"+i.toString(),"\n<!--Ads"+i.toString()+"-->\n","","",-1);
29
- edaddID[edaddID.length] = "ads"+i.toString();
30
- edaddNm[edaddNm.length] = "Ads"+i.toString();
31
- }
32
- }
33
- <?php if(!$options['QckRnds']){ ?>
34
- edButtons[edButtons.length]=new edButton("random_ads","RndAds","\n<!--RndAds-->\n","","",-1);
35
- edaddID[edaddID.length] = "random_ads";
36
- edaddNm[edaddNm.length] = "RndAds";
37
- <?php } ?>
38
- <?php if(!$options['QckOffs']){ ?>
39
- edButtons[edButtons.length]=new edButton("no_ads","NoAds","\n<!--NoAds-->\n","","",-1);
40
- edaddID[edaddID.length] = "no_ads";
41
- edaddNm[edaddNm.length] = "NoAds";
42
- edButtons[edButtons.length]=new edButton("off_def","OffDef","\n<!--OffDef-->\n","","",-1);
43
- edaddID[edaddID.length] = "off_def";
44
- edaddNm[edaddNm.length] = "OffDef";
45
- edButtons[edButtons.length]=new edButton("off_wid","OffWidget","\n<!--OffWidget-->\n","","",-1);
46
- edaddID[edaddID.length] = "off_wid";
47
- edaddNm[edaddNm.length] = "OffWidget";
48
- <?php } ?>
49
- <?php if(!$options['QckOfPs']){ ?>
50
- edButtons[edButtons.length]=new edButton("off_bgn","OffBegin","\n<!--OffBegin-->\n","","",-1);
51
- edaddID[edaddID.length] = "off_bgn";
52
- edaddNm[edaddNm.length] = "OffBegin";
53
- edButtons[edButtons.length]=new edButton("off_mid","OffMiddle","\n<!--OffMiddle-->\n","","",-1);
54
- edaddID[edaddID.length] = "off_mid";
55
- edaddNm[edaddNm.length] = "OffMiddle";
56
- edButtons[edButtons.length]=new edButton("off_end","OffEnd","\n<!--OffEnd-->\n","","",-1);
57
- edaddID[edaddID.length] = "off_end";
58
- edaddNm[edaddNm.length] = "OffEnd";
59
- edButtons[edButtons.length]=new edButton("off_more","OffAfMore","\n<!--OffAfMore-->\n","","",-1);
60
- edaddID[edaddID.length] = "off_more";
61
- edaddNm[edaddNm.length] = "OffAfMore";
62
- edButtons[edButtons.length]=new edButton("off_last","OffBfLastPara","\n<!--OffBfLastPara-->\n","","",-1);
63
- edaddID[edaddID.length] = "off_last";
64
- edaddNm[edaddNm.length] = "OffBfLastPara";
65
- <?php } ?>
66
- };
67
- (function(){
68
- if(typeof(edButtons)!='undefined' && typeof(jQuery)!='undefined' && wpvcomp){
69
- jQuery(document).ready(function(){
70
- for(i=0;i<edaddID.length;i++) {
71
- jQuery("#ed_toolbar").append('<input type="button" value="' + edaddNm[i] +'" id="' + edaddID[i] +'" class="ed_button" onclick="edInsertTag(edCanvas, ' + (edadd+i) + ');" title="' + edaddNm[i] +'" />');
72
- }
73
- });
74
- }
75
- }());
76
- </script>
77
- <?php }
78
- }
79
-
80
- add_filter('the_content', 'quick_adsense_2_the_content');
81
- function quick_adsense_2_the_content($content) {
82
- global $QData;
83
- global $ShownAds;
84
- global $AdsId;
85
- global $beginend;
86
- $options = quick_adsense_2_get_options_with_defaults();
87
-
88
- /* verifying */
89
- if( (is_feed()) ||
90
- (strpos($content,'<!--NoAds-->')!==false) ||
91
- (strpos($content,'<!--OffAds-->')!==false) ||
92
- (is_single() && !(isset($options['AppPost']))) ||
93
- (is_page() && !(isset($options['AppPage']))) ||
94
- (is_home() && !(isset($options['AppHome']))) ||
95
- (is_category() && !(isset($options['AppCate']))) ||
96
- (is_archive() && !(isset($options['AppArch']))) ||
97
- (is_tag() && !(isset($options['AppTags']))) ||
98
- (is_user_logged_in() && (isset($options['AppLogg']))) ) {
99
- $content = quick_adsense_2_clean_tags($content); return $content;
100
- }
101
-
102
- $AdsToShow = $options['AdsDisp'];
103
- if (strpos($content,'<!--OffWidget-->')===false) {
104
- for($i=1;$i<=$QData['AdsWid'];$i++) {
105
- $wadsid = sanitize_title(str_replace(array('(',')'),'',sprintf($QData['AdsWidName'],$i)));
106
- $AdsToShow -= (is_active_widget(true, $wadsid)) ? 1 : 0 ;
107
- }
108
- }
109
- if( $ShownAds >= $AdsToShow ) { $content = quick_adsense_2_clean_tags($content); return $content; };
110
-
111
- if( !count($AdsId) ) {
112
- for($i=1;$i<=$QData['Ads'];$i++) {
113
- $tmp = trim(((isset($options['AdsCode'.$i]))?$options['AdsCode'.$i]:''));
114
- if( !empty($tmp) ) {
115
- array_push($AdsId, $i);
116
- }
117
- }
118
- }
119
- if( !count($AdsId) ) { $content = quick_adsense_2_clean_tags($content); return $content; };
120
-
121
- /* ... Tidy up content ... */
122
- $content = str_replace("<p></p>", "##QA-TP1##", $content);
123
- $content = str_replace("<p>&nbsp;</p>", "##QA-TP2##", $content);
124
- $offdef = (strpos($content,'<!--OffDef-->')!==false);
125
- if( !$offdef ) {
126
- $AdsIdCus = array();
127
- $cusads = 'CusAds'; $cusrnd = 'CusRnd';
128
- $more1 = ((isset($options['MoreAds']))?$options['MoreAds']:''); $more2 = ((isset($options['MoreRnd']))?$options['MoreRnd']:'');
129
- $lapa1 = ((isset($options['LapaAds']))?$options['LapaAds']:''); $lapa2 = ((isset($options['LapaRnd']))?$options['LapaRnd']:'');
130
- $begn1 = ((isset($options['BegnAds']))?$options['BegnAds']:''); $begn2 = ((isset($options['BegnRnd']))?$options['BegnRnd']:'');
131
- $midd1 = ((isset($options['MiddAds']))?$options['MiddAds']:''); $midd2 = ((isset($options['MiddRnd']))?$options['MiddRnd']:'');
132
- $endi1 = ((isset($options['EndiAds']))?$options['EndiAds']:''); $endi2 = ((isset($options['EndiRnd']))?$options['EndiRnd']:'');
133
- $rc=3;
134
- for($i=1;$i<=$rc;$i++) {
135
- $para1[$i] = ((isset($options['Par'.$i.'Ads']))?$options['Par'.$i.'Ads']:'');
136
- $para2[$i] = ((isset($options['Par'.$i.'Rnd']))?$options['Par'.$i.'Rnd']:'');
137
- $para3[$i] = ((isset($options['Par'.$i.'Nup']))?$options['Par'.$i.'Nup']:'');
138
- $para4[$i] = ((isset($options['Par'.$i.'Con']))?$options['Par'.$i.'Con']:'');
139
- }
140
- $imge1 = ((isset($options['Img1Ads']))?$options['Img1Ads']:'');
141
- $imge2 = ((isset($options['Img1Rnd']))?$options['Img1Rnd']:'');
142
- $imge3 = ((isset($options['Img1Nup']))?$options['Img1Nup']:'');
143
- $imge4 = ((isset($options['Img1Con']))?$options['Img1Con']:'');
144
- if ( $begn2 == 0 ) { $b1 = $cusrnd; } else { $b1 = $cusads.$begn2; array_push($AdsIdCus, $begn2); };
145
- if ( $more2 == 0 ) { $r1 = $cusrnd; } else { $r1 = $cusads.$more2; array_push($AdsIdCus, $more2); };
146
- if ( $midd2 == 0 ) { $m1 = $cusrnd; } else { $m1 = $cusads.$midd2; array_push($AdsIdCus, $midd2); };
147
- if ( $lapa2 == 0 ) { $g1 = $cusrnd; } else { $g1 = $cusads.$lapa2; array_push($AdsIdCus, $lapa2); };
148
- if ( $endi2 == 0 ) { $b2 = $cusrnd; } else { $b2 = $cusads.$endi2; array_push($AdsIdCus, $endi2); };
149
- for($i=1;$i<=$rc;$i++) {
150
- if ( $para2[$i] == 0 ) { $b3[$i] = $cusrnd; } else { $b3[$i] = $cusads.$para2[$i]; array_push($AdsIdCus, $para2[$i]); };
151
- }
152
- if ( $imge2 == 0 ) { $b4 = $cusrnd; } else { $b4 = $cusads.$imge2; array_push($AdsIdCus, $imge2); };
153
- if( $midd1 && strpos($content,'<!--OffMiddle-->')===false) {
154
- if( substr_count(strtolower($content), '</p>')>=2 ) {
155
- $sch = "</p>";
156
- $content = str_replace("</P>", $sch, $content);
157
- $arr = explode($sch, $content);
158
- $nn = 0; $mm = strlen($content)/2;
159
- for($i=0;$i<count($arr);$i++) {
160
- $nn += strlen($arr[$i]) + 4;
161
- if($nn>$mm) {
162
- if( ($mm - ($nn - strlen($arr[$i]))) > ($nn - $mm) && $i+1<count($arr) ) {
163
- $arr[$i+1] = '<!--'.$m1.'-->'.$arr[$i+1];
164
- } else {
165
- $arr[$i] = '<!--'.$m1.'-->'.$arr[$i];
166
- }
167
- break;
168
- }
169
- }
170
- $content = implode($sch, $arr);
171
- }
172
- }
173
- if( $more1 && strpos($content,'<!--OffAfMore-->')===false) {
174
- $mmr = '<!--'.$r1.'-->';
175
- $postid = get_the_ID();
176
- $content = str_replace('<span id="more-'.$postid.'"></span>', $mmr, $content);
177
- }
178
- if( $begn1 && strpos($content,'<!--OffBegin-->')===false) {
179
- $content = '<!--'.$b1.'-->'.$content;
180
- }
181
- if( $endi1 && strpos($content,'<!--OffEnd-->')===false) {
182
- $content = $content.'<!--'.$b2.'-->';
183
- }
184
- if( $lapa1 && strpos($content,'<!--OffBfLastPara-->')===false){
185
- $sch = "<p>";
186
- $content = str_replace("<P>", $sch, $content);
187
- $arr = explode($sch, $content);
188
- if ( count($arr) > 2 ) {
189
- $content = implode($sch, array_slice($arr, 0, count($arr)-1)) .'<!--'.$g1.'-->'. $sch. $arr[count($arr)-1];
190
- }
191
- }
192
- for($i=$rc;$i>=1;$i--) {
193
- if ( $para1[$i] ){
194
- $sch = "</p>";
195
- $content = str_replace("</P>", $sch, $content);
196
- $arr = explode($sch, $content);
197
- if ( (int)$para3[$i] < count($arr) ) {
198
- $content = implode($sch, array_slice($arr, 0, $para3[$i])).$sch .'<!--'.$b3[$i].'-->'. implode($sch, array_slice($arr, $para3[$i]));
199
- } elseif ($para4[$i]) {
200
- $content = implode($sch, $arr).'<!--'.$b3[$i].'-->';
201
- }
202
- }
203
- }
204
- if ( $imge1 ){
205
- $sch = "<img"; $bch = ">"; $cph = "[/caption]"; $csa = "</a>";
206
- $content = str_replace("<IMG", $sch, $content);
207
- $content = str_replace("</A>", $csa, $content);
208
- $arr = explode($sch, $content);
209
- if ( (int)$imge3 < count($arr) ) {
210
- $trr = explode($bch, $arr[$imge3]);
211
- if ( count($trr) > 1 ) {
212
- $tss = explode($cph, $arr[$imge3]);
213
- $ccp = ( count($tss) > 1 ) ? strpos(strtolower($tss[0]),'[caption ')===false : false ;
214
- $tuu = explode($csa, $arr[$imge3]);
215
- $cdu = ( count($tuu) > 1 ) ? strpos(strtolower($tuu[0]),'<a href')===false : false ;
216
- if ( $imge4 && $ccp ) {
217
- $arr[$imge3] = implode($cph, array_slice($tss, 0, 1)).$cph. "\r\n".'<!--'.$b4.'-->'."\r\n". implode($cph, array_slice($tss, 1));
218
- }else if ( $cdu ) {
219
- $arr[$imge3] = implode($csa, array_slice($tuu, 0, 1)).$csa. "\r\n".'<!--'.$b4.'-->'."\r\n". implode($csa, array_slice($tuu, 1));
220
- }else{
221
- $arr[$imge3] = implode($bch, array_slice($trr, 0, 1)).$bch. "\r\n".'<!--'.$b4.'-->'."\r\n". implode($bch, array_slice($trr, 1));
222
- }
223
- }
224
- $content = implode($sch, $arr);
225
- }
226
- }
227
- }
228
-
229
- /* ... Tidy up content ... */
230
- $content = '<!--EmptyClear-->'.$content."\n".'<div style="font-size:0px;height:0px;line-height:0px;margin:0;padding:0;clear:both"></div>';
231
- $content = quick_adsense_2_clean_tags($content, true);
232
- $ismany = (!is_single() && !is_page());
233
- $showall = ((isset($options['AppMaxA']))?$options['AppMaxA']:'');
234
-
235
- /* ... Replace Beginning/Middle/End Ads1-10 ... */
236
- if( !$offdef ) {
237
- for( $i=1; $i<=count($AdsIdCus); $i++ ) {
238
- if( $showall || !$ismany || $beginend != $i ) {
239
- if( strpos($content,'<!--'.$cusads.$AdsIdCus[$i-1].'-->')!==false && in_array($AdsIdCus[$i-1], $AdsId)) {
240
- $content = quick_adsense_2_replace_ads( $content, $cusads.$AdsIdCus[$i-1], $AdsIdCus[$i-1] ); $AdsId = quick_adsense_2_del_element($AdsId, array_search($AdsIdCus[$i-1], $AdsId)) ;
241
- $ShownAds += 1; if( $ShownAds >= $AdsToShow || !count($AdsId) ){ $content = quick_adsense_2_clean_tags($content); return $content; };
242
- $beginend = $i; if(!$showall && $ismany){break;}
243
- }
244
- }
245
- }
246
- }
247
-
248
- /* ... Replace Ads1 to Ads10 ... */
249
- if( $showall || !$ismany ) {
250
- $tcn = count($AdsId); $tt = 0;
251
- for( $i=1; $i<=$tcn; $i++ ) {
252
- if( strpos($content, '<!--Ads'.$AdsId[$tt].'-->')!==false ) {
253
- $content = quick_adsense_2_replace_ads( $content, 'Ads'.$AdsId[$tt], $AdsId[$tt] ); $AdsId = quick_adsense_2_del_element($AdsId, $tt) ;
254
- $ShownAds += 1; if( $ShownAds >= $AdsToShow || !count($AdsId) ){ $content = quick_adsense_2_clean_tags($content); return $content; };
255
- } else {
256
- $tt += 1;
257
- }
258
- }
259
- }
260
-
261
- /* ... Replace Beginning/Middle/End random Ads ... */
262
- if( strpos($content, '<!--'.$cusrnd.'-->')!==false && ($showall || !$ismany) ) {
263
- $tcx = count($AdsId);
264
- $tcy = substr_count($content, '<!--'.$cusrnd.'-->');
265
- for( $i=$tcx; $i<=$tcy-1; $i++ ) {
266
- array_push($AdsId, -1);
267
- }
268
- shuffle($AdsId);
269
- for( $i=1; $i<=$tcy; $i++ ) {
270
- $content = quick_adsense_2_replace_ads( $content, $cusrnd, $AdsId[0] ); $AdsId = quick_adsense_2_del_element($AdsId, 0) ;
271
- $ShownAds += 1; if( $ShownAds >= $AdsToShow || !count($AdsId) ){ $content = quick_adsense_2_clean_tags($content); return $content; };
272
- }
273
- }
274
-
275
- /* ... Replace RndAds ... */
276
- if( strpos($content, '<!--RndAds-->')!==false && ($showall || !$ismany) ) {
277
- $AdsIdTmp = array();
278
- shuffle($AdsId);
279
- for( $i=1; $i<=$AdsToShow-$ShownAds; $i++ ) {
280
- if( $i <= count($AdsId) ) {
281
- array_push($AdsIdTmp, $AdsId[$i-1]);
282
- }
283
- }
284
- $tcx = count($AdsIdTmp);
285
- $tcy = substr_count($content, '<!--RndAds-->');
286
- for( $i=$tcx; $i<=$tcy-1; $i++ ) {
287
- array_push($AdsIdTmp, -1);
288
- }
289
- shuffle($AdsIdTmp);
290
- for( $i=1; $i<=$tcy; $i++ ) {
291
- $tmp = $AdsIdTmp[0];
292
- $content = quick_adsense_2_replace_ads( $content, 'RndAds', $AdsIdTmp[0] ); $AdsIdTmp = quick_adsense_2_del_element($AdsIdTmp, 0) ;
293
- if($tmp != -1){$ShownAds += 1;}; if( $ShownAds >= $AdsToShow || !count($AdsIdTmp) ){ $content = quick_adsense_2_clean_tags($content); return $content; };
294
- }
295
- }
296
-
297
- /* ... That's it. DONE :) ... */
298
- $content = quick_adsense_2_clean_tags($content); return $content;
299
- }
300
-
301
- function quick_adsense_2_clean_tags($content, $trimonly = false) {
302
- global $QData;
303
- global $ShownAds;
304
- global $AdsId;
305
- global $beginend;
306
- $tagnames = array('EmptyClear','RndAds','NoAds','OffDef','OffAds','OffWidget','OffBegin','OffMiddle','OffEnd','OffBfMore','OffAfLastPara','CusRnd');
307
- for($i=1;$i<=$QData['Ads'];$i++) { array_push($tagnames, 'CusAds'.$i); array_push($tagnames, 'Ads'.$i); };
308
- foreach ($tagnames as $tgn) {
309
- if(strpos($content,'<!--'.$tgn.'-->')!==false || $tgn=='EmptyClear') {
310
- if($trimonly) {
311
- $content = str_replace('<p><!--'.$tgn.'--></p>', '<!--'.$tgn.'-->', $content);
312
- }else{
313
- $content = str_replace(array('<p><!--'.$tgn.'--></p>','<!--'.$tgn.'-->'), '', $content);
314
- $content = str_replace("##QA-TP1##", "<p></p>", $content);
315
- $content = str_replace("##QA-TP2##", "<p>&nbsp;</p>", $content);
316
- }
317
- }
318
- }
319
- if(!$trimonly && (is_single() || is_page()) ) {
320
- $ShownAds = 0;
321
- $AdsId = array();
322
- $beginend = 0;
323
- }
324
- return $content;
325
- }
326
-
327
- function quick_adsense_2_replace_ads($content, $nme, $adn) {
328
- if( strpos($content,'<!--'.$nme.'-->')===false ) { return $content; }
329
- global $QData;
330
- $options = quick_adsense_2_get_options_with_defaults();
331
- if ($adn != -1) {
332
- $arr = array('',
333
- 'float:left;margin:%1$dpx %1$dpx %1$dpx 0;',
334
- 'float:none;margin:%1$dpx 0 %1$dpx 0;text-align:center;',
335
- 'float:right;margin:%1$dpx 0 %1$dpx %1$dpx;',
336
- 'float:none;margin:0px;');
337
- $adsalign = ((isset($options['AdsAlign'.$adn]))?$options['AdsAlign'.$adn]:'');
338
- $adsmargin = ((isset($options['AdsMargin'.$adn]))?$options['AdsMargin'.$adn]:'');
339
- $style = sprintf($arr[(int)$adsalign], $adsmargin);
340
- $adscode = ((isset($options['AdsCode'.$adn]))?$options['AdsCode'.$adn]:'');
341
- $adscode =
342
- "\n".'<!-- '.$QData['Name'].' Wordpress Plugin: '.$QData['URI'].' -->'."\n".
343
- '<div style="'.$style.'">'."\n".
344
- $adscode."\n".
345
- '</div>'."\n";
346
- } else {
347
- $adscode ='';
348
- }
349
- $cont = explode('<!--'.$nme.'-->', $content, 2);
350
- return $cont[0].$adscode.$cont[1];
351
- }
352
-
353
- function quick_adsense_2_del_element($array, $idx) {
354
- $copy = array();
355
- for( $i=0; $i<count($array) ;$i++) {
356
- if ( $idx != $i ) {
357
- array_push($copy, $array[$i]);
358
- }
359
- }
360
- return $copy;
361
- }
362
-
363
- add_action('init', 'quick_adsense_2_ads_widget_register');
364
- function quick_adsense_2_ads_widget_register() {
365
- global $QData;
366
- $options = quick_adsense_2_get_options_with_defaults();
367
- if (!function_exists('wp_register_sidebar_widget')) { return; };
368
- for($i=1;$i<=$QData['AdsWid'];$i++) {
369
- if(isset($options['WidCode'.$i]) && ($options['WidCode'.$i]!='')) {
370
- $displaystr =
371
- '$cont = get_the_content();'.
372
- '$options = quick_adsense_2_get_options_with_defaults();'.
373
- 'if( strpos($cont,"<!--OffAds-->")===false && strpos($cont,"<!--OffWidget-->")===false && !(is_home()&&$options["AppSide"]) ) {'.
374
- 'extract($args);'.
375
- '$title = ((isset($options["WidCode-title-'.$i.'"]))?$options["WidCode-title-'.$i.'"]:"");'.
376
- '$codetxt = $options["WidCode'.$i.'"];'.
377
- 'echo "\n"."<!-- Quick Adsense Wordpress Plugin: http://quickadsense.com/ -->"."\n";'.
378
- 'echo $before_widget."\n";'.
379
- 'if (!empty($title)) { '.
380
- 'echo $before_title.$title.$after_title."\n"; '.
381
- '};'.
382
- 'echo $codetxt;'.
383
- 'echo "\n".$after_widget;'.
384
- '}';
385
- $displaycall[$i] = create_function('$args', $displaystr);
386
- $wadnam = sprintf($QData['AdsWidName'],$i);
387
- $wadsid = sanitize_title(str_replace(array('(',')'),'',$wadnam));
388
- wp_register_sidebar_widget($wadsid, $wadnam, $displaycall[$i], array('description' => 'Quick Adsense on Sidebar Widget'));
389
- }
390
- }
391
- }
392
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/adsense.php ADDED
@@ -0,0 +1,255 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*Begin Scripts */
3
+ add_action('admin_footer', 'quick_adsense_vi_admin_notice_admin_footer');
4
+ function quick_adsense_vi_admin_notice_admin_footer() {
5
+ echo '<script type="text/javascript">';
6
+ echo "jQuery(document).ready(function() {";
7
+ echo "jQuery('.quick_adsense_adstxt_adsense_notice').on('click', '.notice-dismiss', function() {";
8
+ echo "jQuery.post(";
9
+ echo "jQuery('#quick_adsense_adstxt_adsense_admin_notice_ajax').val(), {";
10
+ echo "'action': 'quick_adsense_adstxt_adsense_admin_notice_dismiss',";
11
+ echo "'quick_adsense_adstxt_adsense_admin_notice_nonce': jQuery('#quick_adsense_adstxt_adsense_admin_notice_nonce').val(),";
12
+ echo "}, function(response) { }";
13
+ echo ");";
14
+ echo "});";
15
+ echo "});";
16
+ echo '</script>';
17
+ }
18
+ /*End Scripts */
19
+
20
+ /* Begin Admin Notice */
21
+ add_action('init', 'quick_adsense_adstxt_adsense_admin_notice_reactivate');
22
+ function quick_adsense_adstxt_adsense_admin_notice_reactivate() {
23
+ if(isset($_GET['quick_adsense_adstxt_adsense_reset'])) {
24
+ delete_option('quick_adsense_adstxt_adsense_admin_notice_dismissed');
25
+ delete_transient('quick_adsense_adstxt_adsense_autocheck_content');
26
+ wp_redirect(esc_url(admin_url('/admin.php?page=quick-adsense')));
27
+ }
28
+ }
29
+
30
+ add_action('admin_notices', 'quick_adsense_adstxt_adsense_admin_notice');
31
+ function quick_adsense_adstxt_adsense_admin_notice($isAjax = false) {
32
+ if(current_user_can('manage_options')) {
33
+ if(!get_option('quick_adsense_adstxt_adsense_admin_notice_dismissed')) {
34
+ $adstxtNewAdsenseEntries = get_transient('quick_adsense_adstxt_adsense_autocheck_content');
35
+ if($adstxtNewAdsenseEntries == '###CHECKED###') {
36
+ } else {
37
+ if(!isset($adstxtNewAdsenseEntries) || ($adstxtNewAdsenseEntries === false)) {
38
+ $adstxtNewAdsenseEntries = quick_adsense_adstxt_adsense_get_status();
39
+ }
40
+ if($adstxtNewAdsenseEntries !== false) {
41
+ set_transient('quick_adsense_adstxt_adsense_autocheck_content', $adstxtNewAdsenseEntries, DAY_IN_SECONDS);
42
+ echo '<div class="notice notice-error quick_adsense_adstxt_adsense_notice is-dismissible" style="padding: 15px;">';
43
+ echo '<p><b>Quick Adsense</b> had detected that your ads.txt file does not have all your Google Adsense Publisher IDs.<br />This will severely impact your adsense earnings and your immediate attention is required.</p>';
44
+ echo '<p>Your recommended google entries for ads.txt is as given below.<br />You can manually copy this to your ads.txt file or ';
45
+ $screen = get_current_screen();
46
+ if(!$isAjax && $screen->id != 'toplevel_page_quick-adsense') {
47
+ echo '<a href="'.esc_url(admin_url('/admin.php?page=quick-adsense#quick_adsense_adstxt_adsense_auto_update')).'">CLICK HERE</a>';
48
+ } else {
49
+ echo '<a href="javascript:;" onclick="quick_adsense_adstxt_adsense_auto_update()">CLICK HERE</a>';
50
+ }
51
+ echo ' to instruct Quick Adsense to try and add the entries automatically.</p>';
52
+ echo '<p><code style="display: block; padding: 2px 10px;">'.implode("<br />", $adstxtNewAdsenseEntries).'</code></p>';
53
+ echo '<p><small><i><b>We recommend you not to dismiss this notice for continued daily ads.txt monitoring. This notice will stop appearing automatically once Quick Adsense detects correct entries in ads.txt (rechecked daily).</b></i></small></p>';
54
+ echo '<div class="clear"></div>';
55
+ echo '<input type="hidden" id="quick_adsense_adstxt_adsense_admin_notice_nonce" name="quick_adsense_adstxt_adsense_admin_notice_nonce" value="'.wp_create_nonce('quick-adsense-adstxt-adsense-admin-notice').'" />';
56
+ echo '<input type="hidden" id="quick_adsense_adstxt_adsense_admin_notice_ajax" name="quick_adsense_adstxt_adsense_admin_notice_ajax" value="'.admin_url('admin-ajax.php').'" />';
57
+ if($isAjax) {
58
+ echo '<button type="button" class="notice-dismiss" onclick="javascript:jQuery(this).parent().remove()"><span class="screen-reader-text">Dismiss this notice.</span></button>';
59
+ }
60
+ echo '</div>';
61
+ } else {
62
+ set_transient('quick_adsense_adstxt_adsense_autocheck_content', '###CHECKED###', DAY_IN_SECONDS);
63
+ }
64
+ }
65
+ }
66
+ }
67
+ }
68
+
69
+ add_action('wp_ajax_quick_adsense_adstxt_adsense_admin_notice_check', 'quick_adsense_adstxt_adsense_admin_notice_check');
70
+ function quick_adsense_adstxt_adsense_admin_notice_check() {
71
+ check_ajax_referer('quick-adsense', 'quick_adsense_nonce');
72
+ delete_transient('quick_adsense_adstxt_adsense_autocheck_content');
73
+ $adminNotice = quick_adsense_adstxt_adsense_admin_notice(true);
74
+ if(isset($adminNotice) && ($adminNotice != '')) {
75
+ echo '###SUCCESS###';
76
+ echo $adminNotice;
77
+ echo quick_adsense_vi_admin_notice_admin_footer();
78
+ }
79
+ die();
80
+ }
81
+
82
+ add_action('wp_ajax_quick_adsense_adstxt_adsense_admin_notice_dismiss', 'quick_adsense_adstxt_adsense_admin_notice_dismiss');
83
+ function quick_adsense_adstxt_adsense_admin_notice_dismiss() {
84
+ check_ajax_referer('quick-adsense-adstxt-adsense-admin-notice', 'quick_adsense_adstxt_adsense_admin_notice_nonce');
85
+ update_option('quick_adsense_adstxt_adsense_admin_notice_dismissed', 'true');
86
+ die();
87
+ }
88
+ /* End Admin Notice */
89
+
90
+ /* Begin Auto Update Ads.txt (Adsense) */
91
+ add_action('wp_ajax_quick_adsense_adstxt_adsense_auto_update', 'quick_adsense_adstxt_adsense_auto_update');
92
+ function quick_adsense_adstxt_adsense_auto_update() {
93
+ check_ajax_referer('quick-adsense-adstxt-adsense-admin-notice', 'quick_adsense_adstxt_adsense_admin_notice_nonce');
94
+ $adstxtNewAdsenseEntries = quick_adsense_adstxt_adsense_get_status();
95
+ if($adstxtNewAdsenseEntries !== false) {
96
+ $adstxtContent = quick_adsense_adstxt_get_content();
97
+ $adstxtContentData = array_filter(explode("\n", trim($adstxtContent)), 'trim');
98
+ $adstxtUpdatedContent = array_filter(array_merge($adstxtContentData, $adstxtNewAdsenseEntries), 'trim');
99
+ }
100
+
101
+ if(isset($adstxtUpdatedContent) && is_array($adstxtUpdatedContent) && (count($adstxtUpdatedContent) > 0)) {
102
+ $adstxtUpdatedContent = implode("\n", $adstxtUpdatedContent);
103
+ if(quick_adsense_adstxt_update_content($adstxtUpdatedContent)) {
104
+ echo '###SUCCESS###';
105
+ } else {
106
+ echo quick_adsense_adstxt_updation_failed_message($adstxtUpdatedContent);
107
+ }
108
+ }
109
+ die();
110
+ }
111
+ /* End Auto Update Ads.txt (Adsense) */
112
+
113
+ /* Begin ads.txt Adsense Check */
114
+ function quick_adsense_adstxt_adsense_get_status() {
115
+ if(quick_adsense_adstxt_file_exists()) {
116
+ $adsensePublisherIds = quick_adsense_adstxt_adsense_get_publisherids();
117
+ $adstxtContent = quick_adsense_adstxt_get_content();
118
+ $adstxtContentData = array_filter(explode("\n", trim($adstxtContent)), 'trim');
119
+ $adstxtExistingAdsenseEntries = array();
120
+ foreach($adstxtContentData as $line) {
121
+ if(strpos($line, 'google.com') !== false) {
122
+ $adstxtExistingAdsenseEntries[] = $line;
123
+ }
124
+ }
125
+
126
+ $adstxtNewAdsenseEntries = array();
127
+ if(count($adstxtExistingAdsenseEntries) == 0) {
128
+ if(is_array($adsensePublisherIds) && (count($adsensePublisherIds) > 0)) {
129
+ foreach($adsensePublisherIds as $adsensePublisherId) {
130
+ $adstxtNewAdsenseEntries[] = 'google.com, '.$adsensePublisherId.', DIRECT, f08c47fec0942fa0';
131
+ }
132
+ }
133
+ } else {
134
+ if(is_array($adsensePublisherIds) && (count($adsensePublisherIds) > 0)) {
135
+ foreach($adsensePublisherIds as $adsensePublisherId) {
136
+ $entryExists = false;
137
+ foreach($adstxtExistingAdsenseEntries as $adstxtExistingAdsenseEntry) {
138
+ if(strpos($adstxtExistingAdsenseEntry, $adsensePublisherId) !== false) {
139
+ $entryExists = true;
140
+ }
141
+ }
142
+ if($entryExists == false) {
143
+ $adstxtNewAdsenseEntries[] = 'google.com, '.$adsensePublisherId.', DIRECT, f08c47fec0942fa0';
144
+ }
145
+ }
146
+ }
147
+ }
148
+ }
149
+ if(isset($adstxtNewAdsenseEntries) && count($adstxtNewAdsenseEntries) > 0) {
150
+ return $adstxtNewAdsenseEntries;
151
+ }
152
+ return false;
153
+ }
154
+ /* End ads.txt Adsense Check */
155
+
156
+ /* Begin Extract Publisher Ids from Ads */
157
+ function quick_adsense_adstxt_adsense_get_publisherids() {
158
+ $adsensePublisherIds = array();
159
+
160
+ $settings = get_option('quick_adsense_settings');
161
+ if(isset($settings) && is_array($settings)) {
162
+ for($i = 1; $i <= 10; $i++) {
163
+ if(isset($settings['onpost_ad_'.$i.'_content']) && ($settings['onpost_ad_'.$i.'_content'] != '')) {
164
+ $temp = quick_adsense_adstxt_adsense_extract_publisherids($settings['onpost_ad_'.$i.'_content']);
165
+ if($temp !== false) {
166
+ $adsensePublisherIds = array_merge($adsensePublisherIds, $temp);
167
+ }
168
+ }
169
+
170
+ if(isset($settings['widget_ad_'.$i.'_content']) && ($settings['widget_ad_'.$i.'_content'] != '')) {
171
+ $temp = quick_adsense_adstxt_adsense_extract_publisherids($settings['widget_ad_'.$i.'_content']);
172
+ if($temp !== false) {
173
+ $adsensePublisherIds = array_merge($adsensePublisherIds, $temp);
174
+ }
175
+ }
176
+ }
177
+ }
178
+
179
+ $adsensePublisherIds = array_unique($adsensePublisherIds);
180
+
181
+ if(count($adsensePublisherIds) > 0) {
182
+ return $adsensePublisherIds;
183
+ }
184
+ return false;
185
+ }
186
+
187
+ function quick_adsense_adstxt_adsense_extract_publisherids($adCode) {
188
+ $publisherIds = array();
189
+ if(isset($adCode) && ($adCode != '')) {
190
+ if(preg_match('/googlesyndication.com/', $adCode)) {
191
+ if(preg_match('/data-ad-client=/', $adCode)) { //ASYNS AD CODE
192
+ $adCodeParts = explode('data-ad-client', $adCode);
193
+ } else {
194
+ $adCodeParts = explode('google_ad_client', $adCode); //ORDINARY AD CODE
195
+ }
196
+ if(isset($adCodeParts[1]) && ($adCodeParts[1] != '')) {
197
+ preg_match('#"([a-zA-Z0-9-\s]+)"#', stripslashes($adCodeParts[1]), $matches);
198
+ if(isset($matches[1]) && ($matches[1] != '')) {
199
+ $publisherIds[] = str_replace(array('"', ' ', 'ca-'), array(''), $matches[1]);
200
+ }
201
+ }
202
+ }
203
+ }
204
+
205
+ if(count($publisherIds) > 0) {
206
+ return $publisherIds;
207
+ }
208
+ return false;
209
+ }
210
+ /* End Extract Publisher Ids from Ads */
211
+
212
+ /* Begin Common Functions */
213
+ function quick_adsense_adstxt_file_exists() {
214
+ if(file_exists(trailingslashit(get_home_path()).'ads.txt')) {
215
+ return true;
216
+ }
217
+ return false;
218
+ }
219
+
220
+ function quick_adsense_adstxt_get_content() {
221
+ if(quick_adsense_adstxt_file_exists()) {
222
+ return @file_get_contents(trailingslashit(get_home_path()).'ads.txt');
223
+ }
224
+ return '';
225
+ }
226
+
227
+ function quick_adsense_adstxt_update_content($content) {
228
+ delete_transient('quick_adsense_adstxt_adsense_autocheck_content');
229
+ if(get_filesystem_method() === 'direct') {
230
+ $creds = request_filesystem_credentials(site_url().'/wp-admin/', '', false, false, array());
231
+ if(!WP_Filesystem($creds)) {
232
+ return false;
233
+ }
234
+ global $wp_filesystem;
235
+ if(!$wp_filesystem->put_contents(trailingslashit(get_home_path()).'ads.txt', $content, FS_CHMOD_FILE)) {
236
+ return false;
237
+ }
238
+ } else {
239
+ return false;
240
+ }
241
+ return true;
242
+ }
243
+
244
+ function quick_adsense_adstxt_updation_failed_message($content) {
245
+ $output = '<div class="quick_adsense_popup_content_wrapper">';
246
+ $output .= '<p>Auto Creation / Updation of ads.txt failed due to access permission restrictions on the server.</p>';
247
+ $output .= '<p>You have to manually upload the file using your Host\'s File manager or your favourite FTP program</p>';
248
+ $output .= '<p>ads.txt should be located in the root of your server. After manually uploading the file click <a href="'.site_url().'/ads.txt">here</a> to check if its accessible from the correct location</p>';
249
+ $output .= '<textarea style="display: none;" id="quick_adsense_adstxt_content">'.$content.'</textarea>';
250
+ $output .= '<p><a onclick="quick_adsense_adstxt_content_download()" class="button button-primary" href="javascript:;">Download ads.txt</a></p>';
251
+ $output .= '</div>';
252
+ return $output;
253
+ }
254
+ /* End Common Functions */
255
+ ?>
includes/api/vi-constants.php ADDED
@@ -0,0 +1,444 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ function quick_adsense_vi_get_constant_fonts() {
3
+ return array(
4
+ array('text' => 'Select font family', 'value' => 'select'),
5
+ array('text' => 'Georgia', 'value' => 'Georgia'),
6
+ array('text' => 'Palatino Linotype', 'value' => 'Palatino Linotype'),
7
+ array('text' => 'Times New Roman', 'value' => 'Times New Roman'),
8
+ array('text' => 'Arial', 'value' => 'Arial'),
9
+ array('text' => 'Arial Black', 'value' => 'Arial Black'),
10
+ array('text' => 'Comic Sans MS', 'value' => 'Comic Sans MS'),
11
+ array('text' => 'Impact', 'value' => 'Impact'),
12
+ array('text' => 'Lucida Sans Unicode', 'value' => 'Lucida Sans Unicode'),
13
+ array('text' => 'Tahoma', 'value' => 'Tahoma'),
14
+ array('text' => 'Trebuchet MS', 'value' => 'Trebuchet MS'),
15
+ array('text' => 'Verdana', 'value' => 'Verdana'),
16
+ array('text' => 'Courier New', 'value' => 'Courier New'),
17
+ array('text' => 'Lucida Console', 'value' => 'Lucida Console')
18
+ );
19
+ }
20
+
21
+ function quick_adsense_vi_get_constant_font_sizes() {
22
+ return array(
23
+ array('text' => 'Select', 'value' => 'select'),
24
+ array('text' => '8px', 'value' => '8'),
25
+ array('text' => '9px', 'value' => '9'),
26
+ array('text' => '10px', 'value' => '10'),
27
+ array('text' => '11px', 'value' => '11'),
28
+ array('text' => '12px', 'value' => '12'),
29
+ array('text' => '14px', 'value' => '14'),
30
+ array('text' => '16px', 'value' => '16'),
31
+ array('text' => '18px', 'value' => '18'),
32
+ array('text' => '20px', 'value' => '20'),
33
+ array('text' => '22px', 'value' => '22'),
34
+ array('text' => '24px', 'value' => '24'),
35
+ array('text' => '26px', 'value' => '26'),
36
+ array('text' => '28px', 'value' => '28'),
37
+ array('text' => '36px', 'value' => '36')
38
+ );
39
+ }
40
+
41
+ function quick_adsense_vi_get_constant_iab_parent_categories() {
42
+ return array(
43
+ array('text' => 'Select tier 1 category', 'value' => 'select'),
44
+ array('text' => 'Arts & Entertainment', 'value' => 'IAB1'),
45
+ array('text' => 'Automotive', 'value' => 'IAB2'),
46
+ array('text' => 'Business', 'value' => 'IAB3'),
47
+ array('text' => 'Careers', 'value' => 'IAB4'),
48
+ array('text' => 'Education', 'value' => 'IAB5'),
49
+ array('text' => 'Family & Parenting', 'value' => 'IAB6'),
50
+ array('text' => 'Health & Fitness', 'value' => 'IAB7'),
51
+ array('text' => 'Food & Drink', 'value' => 'IAB8'),
52
+ array('text' => 'Hobbies & Interests', 'value' => 'IAB9'),
53
+ array('text' => 'Home & Garden', 'value' => 'IAB10'),
54
+ array('text' => 'Law, Gov’t & Politics', 'value' => 'IAB11'),
55
+ array('text' => 'News', 'value' => 'IAB12'),
56
+ array('text' => 'Personal Finance', 'value' => 'IAB13'),
57
+ array('text' => 'Society', 'value' => 'IAB14'),
58
+ array('text' => 'Science', 'value' => 'IAB15'),
59
+ array('text' => 'Pets', 'value' => 'IAB16'),
60
+ array('text' => 'Sports', 'value' => 'IAB17'),
61
+ array('text' => 'Style & Fashion', 'value' => 'IAB18'),
62
+ array('text' => 'Technology & Computing', 'value' => 'IAB19'),
63
+ array('text' => 'Travel', 'value' => 'IAB20'),
64
+ array('text' => 'Real Estate', 'value' => 'IAB21'),
65
+ array('text' => 'Shopping', 'value' => 'IAB22'),
66
+ array('text' => 'Religion & Spirituality', 'value' => 'IAB23'),
67
+ array('text' => 'Uncategorized', 'value' => 'IAB24'),
68
+ array('text' => 'Non-Standard Content', 'value' => 'IAB25'),
69
+ array('text' => 'Illegal Content', 'value' => 'IAB26')
70
+ );
71
+ }
72
+
73
+ function quick_adsense_vi_get_constant_iab_child_categories() {
74
+ return array(
75
+ array('text' => 'Select tier 2 category', 'value' => 'select'),
76
+ array('text' => 'Books & Literature', 'value' => 'IAB1-1', 'metadata' => array('parent' => 'IAB1')),
77
+ array('text' => 'Celebrity Fan/Gossip', 'value' => 'IAB1-2', 'metadata' => array('parent' => 'IAB1')),
78
+ array('text' => 'Fine Art', 'value' => 'IAB1-3', 'metadata' => array('parent' => 'IAB1')),
79
+ array('text' => 'Humor', 'value' => 'IAB1-4', 'metadata' => array('parent' => 'IAB1')),
80
+ array('text' => 'Movies', 'value' => 'IAB1-5', 'metadata' => array('parent' => 'IAB1')),
81
+ array('text' => 'Music', 'value' => 'IAB1-6', 'metadata' => array('parent' => 'IAB1')),
82
+ array('text' => 'Television', 'value' => 'IAB1-7', 'metadata' => array('parent' => 'IAB1')),
83
+ array('text' => 'Auto Parts', 'value' => 'IAB2-1', 'metadata' => array('parent' => 'IAB2')),
84
+ array('text' => 'Auto Repair', 'value' => 'IAB2-2', 'metadata' => array('parent' => 'IAB2')),
85
+ array('text' => 'Buying/Selling Cars', 'value' => 'IAB2-3', 'metadata' => array('parent' => 'IAB2')),
86
+ array('text' => 'Car Culture', 'value' => 'IAB2-4', 'metadata' => array('parent' => 'IAB2')),
87
+ array('text' => 'Certified Pre-Owned', 'value' => 'IAB2-5', 'metadata' => array('parent' => 'IAB2')),
88
+ array('text' => 'Convertible', 'value' => 'IAB2-6', 'metadata' => array('parent' => 'IAB2')),
89
+ array('text' => 'Coupe', 'value' => 'IAB2-7', 'metadata' => array('parent' => 'IAB2')),
90
+ array('text' => 'Crossover', 'value' => 'IAB2-8', 'metadata' => array('parent' => 'IAB2')),
91
+ array('text' => 'Diesel', 'value' => 'IAB2-9', 'metadata' => array('parent' => 'IAB2')),
92
+ array('text' => 'Electric Vehicle', 'value' => 'IAB2-10', 'metadata' => array('parent' => 'IAB2')),
93
+ array('text' => 'Hatchback', 'value' => 'IAB2-11', 'metadata' => array('parent' => 'IAB2')),
94
+ array('text' => 'Hybrid', 'value' => 'IAB2-12', 'metadata' => array('parent' => 'IAB2')),
95
+ array('text' => 'Luxury', 'value' => 'IAB2-13', 'metadata' => array('parent' => 'IAB2')),
96
+ array('text' => 'MiniVan', 'value' => 'IAB2-14', 'metadata' => array('parent' => 'IAB2')),
97
+ array('text' => 'Mororcycles', 'value' => 'IAB2-15', 'metadata' => array('parent' => 'IAB2')),
98
+ array('text' => 'Off-Road Vehicles', 'value' => 'IAB2-16', 'metadata' => array('parent' => 'IAB2')),
99
+ array('text' => 'Performance Vehicles', 'value' => 'IAB2-17', 'metadata' => array('parent' => 'IAB2')),
100
+ array('text' => 'Pickup', 'value' => 'IAB2-18', 'metadata' => array('parent' => 'IAB2')),
101
+ array('text' => 'Road-Side Assistance', 'value' => 'IAB2-19', 'metadata' => array('parent' => 'IAB2')),
102
+ array('text' => 'Sedan', 'value' => 'IAB2-20', 'metadata' => array('parent' => 'IAB2')),
103
+ array('text' => 'Trucks & Accessories', 'value' => 'IAB2-21', 'metadata' => array('parent' => 'IAB2')),
104
+ array('text' => 'Vintage Cars', 'value' => 'IAB2-22', 'metadata' => array('parent' => 'IAB2')),
105
+ array('text' => 'Wagon', 'value' => 'IAB2-23', 'metadata' => array('parent' => 'IAB2')),
106
+ array('text' => 'Advertising', 'value' => 'IAB3-1', 'metadata' => array('parent' => 'IAB3')),
107
+ array('text' => 'Agriculture', 'value' => 'IAB3-2', 'metadata' => array('parent' => 'IAB3')),
108
+ array('text' => 'Biotech/Biomedical', 'value' => 'IAB3-3', 'metadata' => array('parent' => 'IAB3')),
109
+ array('text' => 'Business Software', 'value' => 'IAB3-4', 'metadata' => array('parent' => 'IAB3')),
110
+ array('text' => 'Construction', 'value' => 'IAB3-5', 'metadata' => array('parent' => 'IAB3')),
111
+ array('text' => 'Forestry', 'value' => 'IAB3-6', 'metadata' => array('parent' => 'IAB3')),
112
+ array('text' => 'Government', 'value' => 'IAB3-7', 'metadata' => array('parent' => 'IAB3')),
113
+ array('text' => 'Green Solutions', 'value' => 'IAB3-8', 'metadata' => array('parent' => 'IAB3')),
114
+ array('text' => 'Human Resources', 'value' => 'IAB3-9', 'metadata' => array('parent' => 'IAB3')),
115
+ array('text' => 'Logistics', 'value' => 'IAB3-10', 'metadata' => array('parent' => 'IAB3')),
116
+ array('text' => 'Marketing', 'value' => 'IAB3-11', 'metadata' => array('parent' => 'IAB3')),
117
+ array('text' => 'Metals', 'value' => 'IAB3-12', 'metadata' => array('parent' => 'IAB3')),
118
+ array('text' => 'Career Planning', 'value' => 'IAB4-1', 'metadata' => array('parent' => 'IAB4')),
119
+ array('text' => 'College', 'value' => 'IAB4-2', 'metadata' => array('parent' => 'IAB4')),
120
+ array('text' => 'Financial Aid', 'value' => 'IAB4-3', 'metadata' => array('parent' => 'IAB4')),
121
+ array('text' => 'Job Fairs', 'value' => 'IAB4-4', 'metadata' => array('parent' => 'IAB4')),
122
+ array('text' => 'Job Search', 'value' => 'IAB4-5', 'metadata' => array('parent' => 'IAB4')),
123
+ array('text' => 'Resume Writing/Advice', 'value' => 'IAB4-6', 'metadata' => array('parent' => 'IAB4')),
124
+ array('text' => 'Nursing', 'value' => 'IAB4-7', 'metadata' => array('parent' => 'IAB4')),
125
+ array('text' => 'Scholarships', 'value' => 'IAB4-8', 'metadata' => array('parent' => 'IAB4')),
126
+ array('text' => 'Telecommuting', 'value' => 'IAB4-9', 'metadata' => array('parent' => 'IAB4')),
127
+ array('text' => 'U.S. Military', 'value' => 'IAB4-10', 'metadata' => array('parent' => 'IAB4')),
128
+ array('text' => 'Career Advice', 'value' => 'IAB4-11', 'metadata' => array('parent' => 'IAB4')),
129
+ array('text' => '7-12 Education', 'value' => 'IAB5-1', 'metadata' => array('parent' => 'IAB5')),
130
+ array('text' => 'Adult Education', 'value' => 'IAB5-2', 'metadata' => array('parent' => 'IAB5')),
131
+ array('text' => 'Art History', 'value' => 'IAB5-3', 'metadata' => array('parent' => 'IAB5')),
132
+ array('text' => 'Colledge Administration', 'value' => 'IAB5-4', 'metadata' => array('parent' => 'IAB5')),
133
+ array('text' => 'College Life', 'value' => 'IAB5-5', 'metadata' => array('parent' => 'IAB5')),
134
+ array('text' => 'Distance Learning', 'value' => 'IAB5-6', 'metadata' => array('parent' => 'IAB5')),
135
+ array('text' => 'English as a 2nd Language', 'value' => 'IAB5-7', 'metadata' => array('parent' => 'IAB5')),
136
+ array('text' => 'Language Learning', 'value' => 'IAB5-8', 'metadata' => array('parent' => 'IAB5')),
137
+ array('text' => 'Graduate School', 'value' => 'IAB5-9', 'metadata' => array('parent' => 'IAB5')),
138
+ array('text' => 'Homeschooling', 'value' => 'IAB5-10', 'metadata' => array('parent' => 'IAB5')),
139
+ array('text' => 'Homework/Study Tips', 'value' => 'IAB5-11', 'metadata' => array('parent' => 'IAB5')),
140
+ array('text' => 'K-6 Educators', 'value' => 'IAB5-12', 'metadata' => array('parent' => 'IAB5')),
141
+ array('text' => 'Private School', 'value' => 'IAB5-13', 'metadata' => array('parent' => 'IAB5')),
142
+ array('text' => 'Special Education', 'value' => 'IAB5-14', 'metadata' => array('parent' => 'IAB5')),
143
+ array('text' => 'Studying Business', 'value' => 'IAB5-15', 'metadata' => array('parent' => 'IAB5')),
144
+ array('text' => 'Adoption', 'value' => 'IAB6-1', 'metadata' => array('parent' => 'IAB6')),
145
+ array('text' => 'Babies & Toddlers', 'value' => 'IAB6-2', 'metadata' => array('parent' => 'IAB6')),
146
+ array('text' => 'Daycare/Pre School', 'value' => 'IAB6-3', 'metadata' => array('parent' => 'IAB6')),
147
+ array('text' => 'Family Internet', 'value' => 'IAB6-4', 'metadata' => array('parent' => 'IAB6')),
148
+ array('text' => 'Parenting – K-6 Kids', 'value' => 'IAB6-5', 'metadata' => array('parent' => 'IAB6')),
149
+ array('text' => 'Parenting teens', 'value' => 'IAB6-6', 'metadata' => array('parent' => 'IAB6')),
150
+ array('text' => 'Pregnancy', 'value' => 'IAB6-7', 'metadata' => array('parent' => 'IAB6')),
151
+ array('text' => 'Special Needs Kids', 'value' => 'IAB6-8', 'metadata' => array('parent' => 'IAB6')),
152
+ array('text' => 'Eldercare', 'value' => 'IAB6-9', 'metadata' => array('parent' => 'IAB6')),
153
+ array('text' => 'Exercise', 'value' => 'IAB7-1', 'metadata' => array('parent' => 'IAB7')),
154
+ array('text' => 'A.D.D.', 'value' => 'IAB7-2', 'metadata' => array('parent' => 'IAB7')),
155
+ array('text' => 'AIDS/HIV', 'value' => 'IAB7-3', 'metadata' => array('parent' => 'IAB7')),
156
+ array('text' => 'Allergies', 'value' => 'IAB7-4', 'metadata' => array('parent' => 'IAB7')),
157
+ array('text' => 'Alternative Medicine', 'value' => 'IAB7-5', 'metadata' => array('parent' => 'IAB7')),
158
+ array('text' => 'Arthritis', 'value' => 'IAB7-6', 'metadata' => array('parent' => 'IAB7')),
159
+ array('text' => 'Asthma', 'value' => 'IAB7-7', 'metadata' => array('parent' => 'IAB7')),
160
+ array('text' => 'Autism/PDD', 'value' => 'IAB7-8', 'metadata' => array('parent' => 'IAB7')),
161
+ array('text' => 'Bipolar Disorder', 'value' => 'IAB7-9', 'metadata' => array('parent' => 'IAB7')),
162
+ array('text' => 'Brain Tumor', 'value' => 'IAB7-10', 'metadata' => array('parent' => 'IAB7')),
163
+ array('text' => 'Cancer', 'value' => 'IAB7-11', 'metadata' => array('parent' => 'IAB7')),
164
+ array('text' => 'Cholesterol', 'value' => 'IAB7-12', 'metadata' => array('parent' => 'IAB7')),
165
+ array('text' => 'Chronic Fatigue Syndrome', 'value' => 'IAB7-13', 'metadata' => array('parent' => 'IAB7')),
166
+ array('text' => 'Chronic Pain', 'value' => 'IAB7-14', 'metadata' => array('parent' => 'IAB7')),
167
+ array('text' => 'Cold & Flu', 'value' => 'IAB7-15', 'metadata' => array('parent' => 'IAB7')),
168
+ array('text' => 'Deafness', 'value' => 'IAB7-16', 'metadata' => array('parent' => 'IAB7')),
169
+ array('text' => 'Dental Care', 'value' => 'IAB7-17', 'metadata' => array('parent' => 'IAB7')),
170
+ array('text' => 'Depression', 'value' => 'IAB7-18', 'metadata' => array('parent' => 'IAB7')),
171
+ array('text' => 'Dermatology', 'value' => 'IAB7-19', 'metadata' => array('parent' => 'IAB7')),
172
+ array('text' => 'Diabetes', 'value' => 'IAB7-20', 'metadata' => array('parent' => 'IAB7')),
173
+ array('text' => 'Epilepsy', 'value' => 'IAB7-21', 'metadata' => array('parent' => 'IAB7')),
174
+ array('text' => 'GERD/Acid Reflux', 'value' => 'IAB7-22', 'metadata' => array('parent' => 'IAB7')),
175
+ array('text' => 'Headaches/Migraines', 'value' => 'IAB7-23', 'metadata' => array('parent' => 'IAB7')),
176
+ array('text' => 'Heart Disease', 'value' => 'IAB7-24', 'metadata' => array('parent' => 'IAB7')),
177
+ array('text' => 'Herbs for Health', 'value' => 'IAB7-25', 'metadata' => array('parent' => 'IAB7')),
178
+ array('text' => 'Holistic Healing', 'value' => 'IAB7-26', 'metadata' => array('parent' => 'IAB7')),
179
+ array('text' => 'IBS/Crohn’s Disease', 'value' => 'IAB7-27', 'metadata' => array('parent' => 'IAB7')),
180
+ array('text' => 'Incest/Abuse Support', 'value' => 'IAB7-28', 'metadata' => array('parent' => 'IAB7')),
181
+ array('text' => 'Incontinence', 'value' => 'IAB7-29', 'metadata' => array('parent' => 'IAB7')),
182
+ array('text' => 'Infertility', 'value' => 'IAB7-30', 'metadata' => array('parent' => 'IAB7')),
183
+ array('text' => 'Men’s Health', 'value' => 'IAB7-31', 'metadata' => array('parent' => 'IAB7')),
184
+ array('text' => 'Nutrition', 'value' => 'IAB7-32', 'metadata' => array('parent' => 'IAB7')),
185
+ array('text' => 'Orthopedics', 'value' => 'IAB7-33', 'metadata' => array('parent' => 'IAB7')),
186
+ array('text' => 'Panic/Anxiety Disorders', 'value' => 'IAB7-34', 'metadata' => array('parent' => 'IAB7')),
187
+ array('text' => 'Pediatrics', 'value' => 'IAB7-35', 'metadata' => array('parent' => 'IAB7')),
188
+ array('text' => 'Physical Therapy', 'value' => 'IAB7-36', 'metadata' => array('parent' => 'IAB7')),
189
+ array('text' => 'Psychology/Psychiatry', 'value' => 'IAB7-37', 'metadata' => array('parent' => 'IAB7')),
190
+ array('text' => 'Senor Health', 'value' => 'IAB7-38', 'metadata' => array('parent' => 'IAB7')),
191
+ array('text' => 'Sexuality', 'value' => 'IAB7-39', 'metadata' => array('parent' => 'IAB7')),
192
+ array('text' => 'Sleep Disorders', 'value' => 'IAB7-40', 'metadata' => array('parent' => 'IAB7')),
193
+ array('text' => 'Smoking Cessation', 'value' => 'IAB7-41', 'metadata' => array('parent' => 'IAB7')),
194
+ array('text' => 'Substance Abuse', 'value' => 'IAB7-42', 'metadata' => array('parent' => 'IAB7')),
195
+ array('text' => 'Thyroid Disease', 'value' => 'IAB7-43', 'metadata' => array('parent' => 'IAB7')),
196
+ array('text' => 'Weight Loss', 'value' => 'IAB7-44', 'metadata' => array('parent' => 'IAB7')),
197
+ array('text' => 'Women’s Health', 'value' => 'IAB7-45', 'metadata' => array('parent' => 'IAB7')),
198
+ array('text' => 'American Cuisine', 'value' => 'IAB8-1', 'metadata' => array('parent' => 'IAB8')),
199
+ array('text' => 'Barbecues & Grilling', 'value' => 'IAB8-2', 'metadata' => array('parent' => 'IAB8')),
200
+ array('text' => 'Cajun/Creole', 'value' => 'IAB8-3', 'metadata' => array('parent' => 'IAB8')),
201
+ array('text' => 'Chinese Cuisine', 'value' => 'IAB8-4', 'metadata' => array('parent' => 'IAB8')),
202
+ array('text' => 'Cocktails/Beer', 'value' => 'IAB8-5', 'metadata' => array('parent' => 'IAB8')),
203
+ array('text' => 'Coffee/Tea', 'value' => 'IAB8-6', 'metadata' => array('parent' => 'IAB8')),
204
+ array('text' => 'Cuisine-Specific', 'value' => 'IAB8-7', 'metadata' => array('parent' => 'IAB8')),
205
+ array('text' => 'Desserts & Baking', 'value' => 'IAB8-8', 'metadata' => array('parent' => 'IAB8')),
206
+ array('text' => 'Dining Out', 'value' => 'IAB8-9', 'metadata' => array('parent' => 'IAB8')),
207
+ array('text' => 'Food Allergies', 'value' => 'IAB8-10', 'metadata' => array('parent' => 'IAB8')),
208
+ array('text' => 'French Cuisine', 'value' => 'IAB8-11', 'metadata' => array('parent' => 'IAB8')),
209
+ array('text' => 'Health/Lowfat Cooking', 'value' => 'IAB8-12', 'metadata' => array('parent' => 'IAB8')),
210
+ array('text' => 'Italian Cuisine', 'value' => 'IAB8-13', 'metadata' => array('parent' => 'IAB8')),
211
+ array('text' => 'Japanese Cuisine', 'value' => 'IAB8-14', 'metadata' => array('parent' => 'IAB8')),
212
+ array('text' => 'Mexican Cuisine', 'value' => 'IAB8-15', 'metadata' => array('parent' => 'IAB8')),
213
+ array('text' => 'Vegan', 'value' => 'IAB8-16', 'metadata' => array('parent' => 'IAB8')),
214
+ array('text' => 'Vegetarian', 'value' => 'IAB8-17', 'metadata' => array('parent' => 'IAB8')),
215
+ array('text' => 'Wine', 'value' => 'IAB8-18', 'metadata' => array('parent' => 'IAB8')),
216
+ array('text' => 'Art/Technology', 'value' => 'IAB9-1', 'metadata' => array('parent' => 'IAB9')),
217
+ array('text' => 'Arts & Crafts', 'value' => 'IAB9-2', 'metadata' => array('parent' => 'IAB9')),
218
+ array('text' => 'Beadwork', 'value' => 'IAB9-3', 'metadata' => array('parent' => 'IAB9')),
219
+ array('text' => 'Birdwatching', 'value' => 'IAB9-4', 'metadata' => array('parent' => 'IAB9')),
220
+ array('text' => 'Board Games/Puzzles', 'value' => 'IAB9-5', 'metadata' => array('parent' => 'IAB9')),
221
+ array('text' => 'Candle & Soap Making', 'value' => 'IAB9-6', 'metadata' => array('parent' => 'IAB9')),
222
+ array('text' => 'Card Games', 'value' => 'IAB9-7', 'metadata' => array('parent' => 'IAB9')),
223
+ array('text' => 'Chess', 'value' => 'IAB9-8', 'metadata' => array('parent' => 'IAB9')),
224
+ array('text' => 'Cigars', 'value' => 'IAB9-9', 'metadata' => array('parent' => 'IAB9')),
225
+ array('text' => 'Collecting', 'value' => 'IAB9-10', 'metadata' => array('parent' => 'IAB9')),
226
+ array('text' => 'Comic Books', 'value' => 'IAB9-11', 'metadata' => array('parent' => 'IAB9')),
227
+ array('text' => 'Drawing/Sketching', 'value' => 'IAB9-12', 'metadata' => array('parent' => 'IAB9')),
228
+ array('text' => 'Freelance Writing', 'value' => 'IAB9-13', 'metadata' => array('parent' => 'IAB9')),
229
+ array('text' => 'Genealogy', 'value' => 'IAB9-14', 'metadata' => array('parent' => 'IAB9')),
230
+ array('text' => 'Getting Published', 'value' => 'IAB9-15', 'metadata' => array('parent' => 'IAB9')),
231
+ array('text' => 'Guitar', 'value' => 'IAB9-16', 'metadata' => array('parent' => 'IAB9')),
232
+ array('text' => 'Home Recording', 'value' => 'IAB9-17', 'metadata' => array('parent' => 'IAB9')),
233
+ array('text' => 'Investors & Patents', 'value' => 'IAB9-18', 'metadata' => array('parent' => 'IAB9')),
234
+ array('text' => 'Jewelry Making', 'value' => 'IAB9-19', 'metadata' => array('parent' => 'IAB9')),
235
+ array('text' => 'Magic & Illusion', 'value' => 'IAB9-20', 'metadata' => array('parent' => 'IAB9')),
236
+ array('text' => 'Needlework', 'value' => 'IAB9-21', 'metadata' => array('parent' => 'IAB9')),
237
+ array('text' => 'Painting', 'value' => 'IAB9-22', 'metadata' => array('parent' => 'IAB9')),
238
+ array('text' => 'Photography', 'value' => 'IAB9-23', 'metadata' => array('parent' => 'IAB9')),
239
+ array('text' => 'Radio', 'value' => 'IAB9-24', 'metadata' => array('parent' => 'IAB9')),
240
+ array('text' => 'Roleplaying Games', 'value' => 'IAB9-25', 'metadata' => array('parent' => 'IAB9')),
241
+ array('text' => 'Sci-Fi & Fantasy', 'value' => 'IAB9-26', 'metadata' => array('parent' => 'IAB9')),
242
+ array('text' => 'Scrapbooking', 'value' => 'IAB9-27', 'metadata' => array('parent' => 'IAB9')),
243
+ array('text' => 'Screenwriting', 'value' => 'IAB9-28', 'metadata' => array('parent' => 'IAB9')),
244
+ array('text' => 'Stamps & Coins', 'value' => 'IAB9-29', 'metadata' => array('parent' => 'IAB9')),
245
+ array('text' => 'Video & Computer Games', 'value' => 'IAB9-30', 'metadata' => array('parent' => 'IAB9')),
246
+ array('text' => 'Woodworking', 'value' => 'IAB9-31', 'metadata' => array('parent' => 'IAB9')),
247
+ array('text' => 'Appliances', 'value' => 'IAB10-1', 'metadata' => array('parent' => 'IAB10')),
248
+ array('text' => 'Entertaining', 'value' => 'IAB10-2', 'metadata' => array('parent' => 'IAB10')),
249
+ array('text' => 'Environmental Safety', 'value' => 'IAB10-3', 'metadata' => array('parent' => 'IAB10')),
250
+ array('text' => 'Gardening', 'value' => 'IAB10-4', 'metadata' => array('parent' => 'IAB10')),
251
+ array('text' => 'Home Repair', 'value' => 'IAB10-5', 'metadata' => array('parent' => 'IAB10')),
252
+ array('text' => 'Home Theater', 'value' => 'IAB10-6', 'metadata' => array('parent' => 'IAB10')),
253
+ array('text' => 'Interior Decorating', 'value' => 'IAB10-7', 'metadata' => array('parent' => 'IAB10')),
254
+ array('text' => 'Landscaping', 'value' => 'IAB10-8', 'metadata' => array('parent' => 'IAB10')),
255
+ array('text' => 'Remodeling & Construction', 'value' => 'IAB10-9', 'metadata' => array('parent' => 'IAB10')),
256
+ array('text' => 'Immigration', 'value' => 'IAB11-1', 'metadata' => array('parent' => 'IAB11')),
257
+ array('text' => 'Legal Issues', 'value' => 'IAB11-2', 'metadata' => array('parent' => 'IAB11')),
258
+ array('text' => 'U.S. Government Resources', 'value' => 'IAB11-3', 'metadata' => array('parent' => 'IAB11')),
259
+ array('text' => 'Politics', 'value' => 'IAB11-4', 'metadata' => array('parent' => 'IAB11')),
260
+ array('text' => 'Commentary', 'value' => 'IAB11-5', 'metadata' => array('parent' => 'IAB11')),
261
+ array('text' => 'International News', 'value' => 'IAB12-1', 'metadata' => array('parent' => 'IAB12')),
262
+ array('text' => 'National News', 'value' => 'IAB12-2', 'metadata' => array('parent' => 'IAB12')),
263
+ array('text' => 'Local News', 'value' => 'IAB12-3', 'metadata' => array('parent' => 'IAB12')),
264
+ array('text' => 'Beginning Investing', 'value' => 'IAB13-1', 'metadata' => array('parent' => 'IAB13')),
265
+ array('text' => 'Credit/Debt & Loans', 'value' => 'IAB13-2', 'metadata' => array('parent' => 'IAB13')),
266
+ array('text' => 'Financial News', 'value' => 'IAB13-3', 'metadata' => array('parent' => 'IAB13')),
267
+ array('text' => 'Financial Planning', 'value' => 'IAB13-4', 'metadata' => array('parent' => 'IAB13')),
268
+ array('text' => 'Hedge Fund', 'value' => 'IAB13-5', 'metadata' => array('parent' => 'IAB13')),
269
+ array('text' => 'Insurance', 'value' => 'IAB13-6', 'metadata' => array('parent' => 'IAB13')),
270
+ array('text' => 'Investing', 'value' => 'IAB13-7', 'metadata' => array('parent' => 'IAB13')),
271
+ array('text' => 'Mutual Funds', 'value' => 'IAB13-8', 'metadata' => array('parent' => 'IAB13')),
272
+ array('text' => 'Options', 'value' => 'IAB13-9', 'metadata' => array('parent' => 'IAB13')),
273
+ array('text' => 'Retirement Planning', 'value' => 'IAB13-10', 'metadata' => array('parent' => 'IAB13')),
274
+ array('text' => 'Stocks', 'value' => 'IAB13-11', 'metadata' => array('parent' => 'IAB13')),
275
+ array('text' => 'Tax Planning', 'value' => 'IAB13-12', 'metadata' => array('parent' => 'IAB13')),
276
+ array('text' => 'Dating', 'value' => 'IAB14-1', 'metadata' => array('parent' => 'IAB14')),
277
+ array('text' => 'Divorce Support', 'value' => 'IAB14-2', 'metadata' => array('parent' => 'IAB14')),
278
+ array('text' => 'Gay Life', 'value' => 'IAB14-3', 'metadata' => array('parent' => 'IAB14')),
279
+ array('text' => 'Marriage', 'value' => 'IAB14-4', 'metadata' => array('parent' => 'IAB14')),
280
+ array('text' => 'Senior Living', 'value' => 'IAB14-5', 'metadata' => array('parent' => 'IAB14')),
281
+ array('text' => 'Teens', 'value' => 'IAB14-6', 'metadata' => array('parent' => 'IAB14')),
282
+ array('text' => 'Weddings', 'value' => 'IAB14-7', 'metadata' => array('parent' => 'IAB14')),
283
+ array('text' => 'Ethnic Specific', 'value' => 'IAB14-8', 'metadata' => array('parent' => 'IAB14')),
284
+ array('text' => 'Astrology', 'value' => 'IAB15-1', 'metadata' => array('parent' => 'IAB15')),
285
+ array('text' => 'Biology', 'value' => 'IAB15-2', 'metadata' => array('parent' => 'IAB15')),
286
+ array('text' => 'Chemistry', 'value' => 'IAB15-3', 'metadata' => array('parent' => 'IAB15')),
287
+ array('text' => 'Geology', 'value' => 'IAB15-4', 'metadata' => array('parent' => 'IAB15')),
288
+ array('text' => 'Paranormal Phenomena', 'value' => 'IAB15-5', 'metadata' => array('parent' => 'IAB15')),
289
+ array('text' => 'Physics', 'value' => 'IAB15-6', 'metadata' => array('parent' => 'IAB15')),
290
+ array('text' => 'Space/Astronomy', 'value' => 'IAB15-7', 'metadata' => array('parent' => 'IAB15')),
291
+ array('text' => 'Geography', 'value' => 'IAB15-8', 'metadata' => array('parent' => 'IAB15')),
292
+ array('text' => 'Botany', 'value' => 'IAB15-9', 'metadata' => array('parent' => 'IAB15')),
293
+ array('text' => 'Weather', 'value' => 'IAB15-10', 'metadata' => array('parent' => 'IAB15')),
294
+ array('text' => 'Aquariums', 'value' => 'IAB16-1', 'metadata' => array('parent' => 'IAB16')),
295
+ array('text' => 'Birds', 'value' => 'IAB16-2', 'metadata' => array('parent' => 'IAB16')),
296
+ array('text' => 'Cats', 'value' => 'IAB16-3', 'metadata' => array('parent' => 'IAB16')),
297
+ array('text' => 'Dogs', 'value' => 'IAB16-4', 'metadata' => array('parent' => 'IAB16')),
298
+ array('text' => 'Large Animals', 'value' => 'IAB16-5', 'metadata' => array('parent' => 'IAB16')),
299
+ array('text' => 'Reptiles', 'value' => 'IAB16-6', 'metadata' => array('parent' => 'IAB16')),
300
+ array('text' => 'Veterinary Medicine', 'value' => 'IAB16-7', 'metadata' => array('parent' => 'IAB16')),
301
+ array('text' => 'Auto Racing', 'value' => 'IAB17-1', 'metadata' => array('parent' => 'IAB17')),
302
+ array('text' => 'Baseball', 'value' => 'IAB17-2', 'metadata' => array('parent' => 'IAB17')),
303
+ array('text' => 'Bicycling', 'value' => 'IAB17-3', 'metadata' => array('parent' => 'IAB17')),
304
+ array('text' => 'Bodybuilding', 'value' => 'IAB17-4', 'metadata' => array('parent' => 'IAB17')),
305
+ array('text' => 'Boxing', 'value' => 'IAB17-5', 'metadata' => array('parent' => 'IAB17')),
306
+ array('text' => 'Canoeing/Kayaking', 'value' => 'IAB17-6', 'metadata' => array('parent' => 'IAB17')),
307
+ array('text' => 'Cheerleading', 'value' => 'IAB17-7', 'metadata' => array('parent' => 'IAB17')),
308
+ array('text' => 'Climbing', 'value' => 'IAB17-8', 'metadata' => array('parent' => 'IAB17')),
309
+ array('text' => 'Cricket', 'value' => 'IAB17-9', 'metadata' => array('parent' => 'IAB17')),
310
+ array('text' => 'Figure Skating', 'value' => 'IAB17-10', 'metadata' => array('parent' => 'IAB17')),
311
+ array('text' => 'Fly Fishing', 'value' => 'IAB17-11', 'metadata' => array('parent' => 'IAB17')),
312
+ array('text' => 'Football', 'value' => 'IAB17-12', 'metadata' => array('parent' => 'IAB17')),
313
+ array('text' => 'Freshwater Fishing', 'value' => 'IAB17-13', 'metadata' => array('parent' => 'IAB17')),
314
+ array('text' => 'Game & Fish', 'value' => 'IAB17-14', 'metadata' => array('parent' => 'IAB17')),
315
+ array('text' => 'Golf', 'value' => 'IAB17-15', 'metadata' => array('parent' => 'IAB17')),
316
+ array('text' => 'Horse Racing', 'value' => 'IAB17-16', 'metadata' => array('parent' => 'IAB17')),
317
+ array('text' => 'Horses', 'value' => 'IAB17-17', 'metadata' => array('parent' => 'IAB17')),
318
+ array('text' => 'Hunting/Shooting', 'value' => 'IAB17-18', 'metadata' => array('parent' => 'IAB17')),
319
+ array('text' => 'Inline Skating', 'value' => 'IAB17-19', 'metadata' => array('parent' => 'IAB17')),
320
+ array('text' => 'Martial Arts', 'value' => 'IAB17-20', 'metadata' => array('parent' => 'IAB17')),
321
+ array('text' => 'Mountain Biking', 'value' => 'IAB17-21', 'metadata' => array('parent' => 'IAB17')),
322
+ array('text' => 'NASCAR Racing', 'value' => 'IAB17-22', 'metadata' => array('parent' => 'IAB17')),
323
+ array('text' => 'Olympics', 'value' => 'IAB17-23', 'metadata' => array('parent' => 'IAB17')),
324
+ array('text' => 'Paintball', 'value' => 'IAB17-24', 'metadata' => array('parent' => 'IAB17')),
325
+ array('text' => 'Power & Motorcycles', 'value' => 'IAB17-25', 'metadata' => array('parent' => 'IAB17')),
326
+ array('text' => 'Pro Basketball', 'value' => 'IAB17-26', 'metadata' => array('parent' => 'IAB17')),
327
+ array('text' => 'Pro Ice Hockey', 'value' => 'IAB17-27', 'metadata' => array('parent' => 'IAB17')),
328
+ array('text' => 'Rodeo', 'value' => 'IAB17-28', 'metadata' => array('parent' => 'IAB17')),
329
+ array('text' => 'Rugby', 'value' => 'IAB17-29', 'metadata' => array('parent' => 'IAB17')),
330
+ array('text' => 'Running/Jogging', 'value' => 'IAB17-30', 'metadata' => array('parent' => 'IAB17')),
331
+ array('text' => 'Sailing', 'value' => 'IAB17-31', 'metadata' => array('parent' => 'IAB17')),
332
+ array('text' => 'Saltwater Fishing', 'value' => 'IAB17-32', 'metadata' => array('parent' => 'IAB17')),
333
+ array('text' => 'Scuba Diving', 'value' => 'IAB17-33', 'metadata' => array('parent' => 'IAB17')),
334
+ array('text' => 'Skateboarding', 'value' => 'IAB17-34', 'metadata' => array('parent' => 'IAB17')),
335
+ array('text' => 'Skiing', 'value' => 'IAB17-35', 'metadata' => array('parent' => 'IAB17')),
336
+ array('text' => 'Snowboarding', 'value' => 'IAB17-36', 'metadata' => array('parent' => 'IAB17')),
337
+ array('text' => 'Surfing/Bodyboarding', 'value' => 'IAB17-37', 'metadata' => array('parent' => 'IAB17')),
338
+ array('text' => 'Swimming', 'value' => 'IAB17-38', 'metadata' => array('parent' => 'IAB17')),
339
+ array('text' => 'Table Tennis/Ping-Pong', 'value' => 'IAB17-39', 'metadata' => array('parent' => 'IAB17')),
340
+ array('text' => 'Tennis', 'value' => 'IAB17-40', 'metadata' => array('parent' => 'IAB17')),
341
+ array('text' => 'Volleyball', 'value' => 'IAB17-41', 'metadata' => array('parent' => 'IAB17')),
342
+ array('text' => 'Walking', 'value' => 'IAB17-42', 'metadata' => array('parent' => 'IAB17')),
343
+ array('text' => 'Waterski/Wakeboard', 'value' => 'IAB17-43', 'metadata' => array('parent' => 'IAB17')),
344
+ array('text' => 'World Soccer', 'value' => 'IAB17-44', 'metadata' => array('parent' => 'IAB17')),
345
+ array('text' => 'Beauty', 'value' => 'IAB18-1', 'metadata' => array('parent' => 'IAB18')),
346
+ array('text' => 'Body Art', 'value' => 'IAB18-2', 'metadata' => array('parent' => 'IAB18')),
347
+ array('text' => 'Fashion', 'value' => 'IAB18-3', 'metadata' => array('parent' => 'IAB18')),
348
+ array('text' => 'Jewelry', 'value' => 'IAB18-4', 'metadata' => array('parent' => 'IAB18')),
349
+ array('text' => 'Clothing', 'value' => 'IAB18-5', 'metadata' => array('parent' => 'IAB18')),
350
+ array('text' => 'Accessories', 'value' => 'IAB18-6', 'metadata' => array('parent' => 'IAB18')),
351
+ array('text' => '3-D Graphics', 'value' => 'IAB19-1', 'metadata' => array('parent' => 'IAB19')),
352
+ array('text' => 'Animation', 'value' => 'IAB19-2', 'metadata' => array('parent' => 'IAB19')),
353
+ array('text' => 'Antivirus Software', 'value' => 'IAB19-3', 'metadata' => array('parent' => 'IAB19')),
354
+ array('text' => 'C/C++', 'value' => 'IAB19-4', 'metadata' => array('parent' => 'IAB19')),
355
+ array('text' => 'Cameras & Camcorders', 'value' => 'IAB19-5', 'metadata' => array('parent' => 'IAB19')),
356
+ array('text' => 'Cell Phones', 'value' => 'IAB19-6', 'metadata' => array('parent' => 'IAB19')),
357
+ array('text' => 'Computer Certification', 'value' => 'IAB19-7', 'metadata' => array('parent' => 'IAB19')),
358
+ array('text' => 'Computer Networking', 'value' => 'IAB19-8', 'metadata' => array('parent' => 'IAB19')),
359
+ array('text' => 'Computer Peripherals', 'value' => 'IAB19-9', 'metadata' => array('parent' => 'IAB19')),
360
+ array('text' => 'Computer Reviews', 'value' => 'IAB19-10', 'metadata' => array('parent' => 'IAB19')),
361
+ array('text' => 'Data Centers', 'value' => 'IAB19-11', 'metadata' => array('parent' => 'IAB19')),
362
+ array('text' => 'Databases', 'value' => 'IAB19-12', 'metadata' => array('parent' => 'IAB19')),
363
+ array('text' => 'Desktop Publishing', 'value' => 'IAB19-13', 'metadata' => array('parent' => 'IAB19')),
364
+ array('text' => 'Desktop Video', 'value' => 'IAB19-14', 'metadata' => array('parent' => 'IAB19')),
365
+ array('text' => 'Email', 'value' => 'IAB19-15', 'metadata' => array('parent' => 'IAB19')),
366
+ array('text' => 'Graphics Software', 'value' => 'IAB19-16', 'metadata' => array('parent' => 'IAB19')),
367
+ array('text' => 'Home Video/DVD', 'value' => 'IAB19-17', 'metadata' => array('parent' => 'IAB19')),
368
+ array('text' => 'Internet Technology', 'value' => 'IAB19-18', 'metadata' => array('parent' => 'IAB19')),
369
+ array('text' => 'Java', 'value' => 'IAB19-19', 'metadata' => array('parent' => 'IAB19')),
370
+ array('text' => 'JavaScript', 'value' => 'IAB19-20', 'metadata' => array('parent' => 'IAB19')),
371
+ array('text' => 'Mac Support', 'value' => 'IAB19-21', 'metadata' => array('parent' => 'IAB19')),
372
+ array('text' => 'MP3/MIDI', 'value' => 'IAB19-22', 'metadata' => array('parent' => 'IAB19')),
373
+ array('text' => 'Net Conferencing', 'value' => 'IAB19-23', 'metadata' => array('parent' => 'IAB19')),
374
+ array('text' => 'Net for Beginners', 'value' => 'IAB19-24', 'metadata' => array('parent' => 'IAB19')),
375
+ array('text' => 'Network Security', 'value' => 'IAB19-25', 'metadata' => array('parent' => 'IAB19')),
376
+ array('text' => 'Palmtops/PDAs', 'value' => 'IAB19-26', 'metadata' => array('parent' => 'IAB19')),
377
+ array('text' => 'PC Support', 'value' => 'IAB19-27', 'metadata' => array('parent' => 'IAB19')),
378
+ array('text' => 'Portable', 'value' => 'IAB19-28', 'metadata' => array('parent' => 'IAB19')),
379
+ array('text' => 'Entertainment', 'value' => 'IAB19-29', 'metadata' => array('parent' => 'IAB19')),
380
+ array('text' => 'Shareware/Freeware', 'value' => 'IAB19-30', 'metadata' => array('parent' => 'IAB19')),
381
+ array('text' => 'Unix', 'value' => 'IAB19-31', 'metadata' => array('parent' => 'IAB19')),
382
+ array('text' => 'Visual Basic', 'value' => 'IAB19-32', 'metadata' => array('parent' => 'IAB19')),
383
+ array('text' => 'Web Clip Art', 'value' => 'IAB19-33', 'metadata' => array('parent' => 'IAB19')),
384
+ array('text' => 'Web Design/HTML', 'value' => 'IAB19-34', 'metadata' => array('parent' => 'IAB19')),
385
+ array('text' => 'Web Search', 'value' => 'IAB19-35', 'metadata' => array('parent' => 'IAB19')),
386
+ array('text' => 'Windows', 'value' => 'IAB19-36', 'metadata' => array('parent' => 'IAB19')),
387
+ array('text' => 'Adventure Travel', 'value' => 'IAB20-1', 'metadata' => array('parent' => 'IAB20')),
388
+ array('text' => 'Africa', 'value' => 'IAB20-2', 'metadata' => array('parent' => 'IAB20')),
389
+ array('text' => 'Air Travel', 'value' => 'IAB20-3', 'metadata' => array('parent' => 'IAB20')),
390
+ array('text' => 'Australia & New Zealand', 'value' => 'IAB20-4', 'metadata' => array('parent' => 'IAB20')),
391
+ array('text' => 'Bed & Breakfasts', 'value' => 'IAB20-5', 'metadata' => array('parent' => 'IAB20')),
392
+ array('text' => 'Budget Travel', 'value' => 'IAB20-6', 'metadata' => array('parent' => 'IAB20')),
393
+ array('text' => 'Business Travel', 'value' => 'IAB20-7', 'metadata' => array('parent' => 'IAB20')),
394
+ array('text' => 'By US Locale', 'value' => 'IAB20-8', 'metadata' => array('parent' => 'IAB20')),
395
+ array('text' => 'Camping', 'value' => 'IAB20-9', 'metadata' => array('parent' => 'IAB20')),
396
+ array('text' => 'Canada', 'value' => 'IAB20-10', 'metadata' => array('parent' => 'IAB20')),
397
+ array('text' => 'Caribbean', 'value' => 'IAB20-11', 'metadata' => array('parent' => 'IAB20')),
398
+ array('text' => 'Cruises', 'value' => 'IAB20-12', 'metadata' => array('parent' => 'IAB20')),
399
+ array('text' => 'Eastern Europe', 'value' => 'IAB20-13', 'metadata' => array('parent' => 'IAB20')),
400
+ array('text' => 'Europe', 'value' => 'IAB20-14', 'metadata' => array('parent' => 'IAB20')),
401
+ array('text' => 'France', 'value' => 'IAB20-15', 'metadata' => array('parent' => 'IAB20')),
402
+ array('text' => 'Greece', 'value' => 'IAB20-16', 'metadata' => array('parent' => 'IAB20')),
403
+ array('text' => 'Honeymoons/Getaways', 'value' => 'IAB20-17', 'metadata' => array('parent' => 'IAB20')),
404
+ array('text' => 'Hotels', 'value' => 'IAB20-18', 'metadata' => array('parent' => 'IAB20')),
405
+ array('text' => 'Italy', 'value' => 'IAB20-19', 'metadata' => array('parent' => 'IAB20')),
406
+ array('text' => 'Japan', 'value' => 'IAB20-20', 'metadata' => array('parent' => 'IAB20')),
407
+ array('text' => 'Mexico & Central America', 'value' => 'IAB20-21', 'metadata' => array('parent' => 'IAB20')),
408
+ array('text' => 'National Parks', 'value' => 'IAB20-22', 'metadata' => array('parent' => 'IAB20')),
409
+ array('text' => 'South America', 'value' => 'IAB20-23', 'metadata' => array('parent' => 'IAB20')),
410
+ array('text' => 'Spas', 'value' => 'IAB20-24', 'metadata' => array('parent' => 'IAB20')),
411
+ array('text' => 'Theme Parks', 'value' => 'IAB20-25', 'metadata' => array('parent' => 'IAB20')),
412
+ array('text' => 'Traveling with Kids', 'value' => 'IAB20-26', 'metadata' => array('parent' => 'IAB20')),
413
+ array('text' => 'United Kingdom', 'value' => 'IAB20-27', 'metadata' => array('parent' => 'IAB20')),
414
+ array('text' => 'Apartments', 'value' => 'IAB21-1', 'metadata' => array('parent' => 'IAB21')),
415
+ array('text' => 'Architects', 'value' => 'IAB21-2', 'metadata' => array('parent' => 'IAB21')),
416
+ array('text' => 'Buying/Selling Homes', 'value' => 'IAB21-3', 'metadata' => array('parent' => 'IAB21')),
417
+ array('text' => 'Contests & Freebies', 'value' => 'IAB22-1', 'metadata' => array('parent' => 'IAB22')),
418
+ array('text' => 'Couponing', 'value' => 'IAB22-2', 'metadata' => array('parent' => 'IAB22')),
419
+ array('text' => 'Comparison', 'value' => 'IAB22-3', 'metadata' => array('parent' => 'IAB22')),
420
+ array('text' => 'Engines', 'value' => 'IAB22-4', 'metadata' => array('parent' => 'IAB22')),
421
+ array('text' => 'Alternative Religions', 'value' => 'IAB23-1', 'metadata' => array('parent' => 'IAB23')),
422
+ array('text' => 'Atheism/Agnosticism', 'value' => 'IAB23-2', 'metadata' => array('parent' => 'IAB23')),
423
+ array('text' => 'Buddhism', 'value' => 'IAB23-3', 'metadata' => array('parent' => 'IAB23')),
424
+ array('text' => 'Catholicism', 'value' => 'IAB23-4', 'metadata' => array('parent' => 'IAB23')),
425
+ array('text' => 'Christianity', 'value' => 'IAB23-5', 'metadata' => array('parent' => 'IAB23')),
426
+ array('text' => 'Hinduism', 'value' => 'IAB23-6', 'metadata' => array('parent' => 'IAB23')),
427
+ array('text' => 'Islam', 'value' => 'IAB23-7', 'metadata' => array('parent' => 'IAB23')),
428
+ array('text' => 'Judaism', 'value' => 'IAB23-8', 'metadata' => array('parent' => 'IAB23')),
429
+ array('text' => 'Latter-Day Saints', 'value' => 'IAB23-9', 'metadata' => array('parent' => 'IAB23')),
430
+ array('text' => 'Pagan/Wiccan', 'value' => 'IAB23-10', 'metadata' => array('parent' => 'IAB23')),
431
+ array('text' => 'Unmoderated UGC', 'value' => 'IAB25-1', 'metadata' => array('parent' => 'IAB25')),
432
+ array('text' => 'Extreme Graphic/Explicit Violence', 'value' => 'IAB25-2', 'metadata' => array('parent' => 'IAB25')),
433
+ array('text' => 'Pornography', 'value' => 'IAB25-3', 'metadata' => array('parent' => 'IAB25')),
434
+ array('text' => 'Profane Content', 'value' => 'IAB25-4', 'metadata' => array('parent' => 'IAB25')),
435
+ array('text' => 'Hate Content', 'value' => 'IAB25-5', 'metadata' => array('parent' => 'IAB25')),
436
+ array('text' => 'Under Construction', 'value' => 'IAB25-6', 'metadata' => array('parent' => 'IAB25')),
437
+ array('text' => 'Incentivized', 'value' => 'IAB25-7', 'metadata' => array('parent' => 'IAB25')),
438
+ array('text' => 'Illegal Content', 'value' => 'IAB26-1', 'metadata' => array('parent' => 'IAB26')),
439
+ array('text' => 'Warez', 'value' => 'IAB26-2', 'metadata' => array('parent' => 'IAB26')),
440
+ array('text' => 'Spyware/Malware', 'value' => 'IAB26-3', 'metadata' => array('parent' => 'IAB26')),
441
+ array('text' => 'Copyright Infringement', 'value' => 'IAB26-4', 'metadata' => array('parent' => 'IAB26'))
442
+ );
443
+ }
444
+ ?>
includes/api/vi.php ADDED
@@ -0,0 +1,422 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ function quick_adsense_vi_api_get_settings() {
3
+ $viSettings = get_transient('quick_adsense_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('quick_adsense_vi_api_settings');
23
+ set_transient('quick_adsense_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 quick_adsense_vi_api_get_signupurl() {
36
+ $viSettings = quick_adsense_vi_api_get_settings();
37
+ if(($viSettings != false) && is_array($viSettings)) {
38
+ return $viSettings['signupURL'];
39
+ }
40
+ return false;
41
+ }
42
+
43
+ function quick_adsense_vi_api_get_dashboardurl() {
44
+ $viSettings = quick_adsense_vi_api_get_settings();
45
+ if(($viSettings != false) && is_array($viSettings)) {
46
+ return $viSettings['dashboardURL'];
47
+ }
48
+ return false;
49
+ }
50
+
51
+ function quick_adsense_vi_api_get_iabCategoriesURL() {
52
+ $viSettings = quick_adsense_vi_api_get_settings();
53
+ if(($viSettings != false) && is_array($viSettings)) {
54
+ return $viSettings['iabCategoriesURL'];
55
+ }
56
+ return false;
57
+ }
58
+
59
+ function quick_adsense_vi_api_get_languages() {
60
+ $viSettings = quick_adsense_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 quick_adsense_vi_api_get_adstxt_content() {
78
+ $viSettings = quick_adsense_vi_api_get_settings();
79
+ if(($viSettings != false) && is_array($viSettings)) {
80
+ $viToken = quick_adsense_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 quick_adsense_vi_api_login($email, $password) {
117
+ if(($email != '') && ($password != '')) {
118
+ $viSettings = quick_adsense_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('quick_adsense_vi_api_authetication_token');
155
+ set_transient('quick_adsense_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 quick_adsense_vi_api_logout() {
202
+ delete_transient('quick_adsense_vi_api_authetication_token');
203
+ //delete_transient('quick_adsense_vi_api_settings');
204
+ }
205
+
206
+ function quick_adsense_vi_api_get_publisher_id() {
207
+ $viToken = get_transient('quick_adsense_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 quick_adsense_vi_api_get_publisher_token() {
221
+ $viToken = get_transient('quick_adsense_vi_api_authetication_token');
222
+ if($viToken === false) {
223
+ return false;
224
+ }
225
+ return $viToken;
226
+ }
227
+
228
+ function quick_adsense_vi_api_is_loggedin() {
229
+ $viToken = get_transient('quick_adsense_vi_api_authetication_token');
230
+ if($viToken === false) {
231
+ return false;
232
+ }
233
+ return true;
234
+ }
235
+
236
+ function quick_adsense_vi_api_get_revenue_data() {
237
+ $viSettings = quick_adsense_vi_api_get_settings();
238
+ if(($viSettings != false) && is_array($viSettings)) {
239
+ $viToken = quick_adsense_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 quick_adsense_vi_api_set_vi_code($args = null) {
276
+ $domain = quick_adsense_get_domain_name_from_url(get_bloginfo('url'));
277
+ $selectedArgs = array();
278
+ $selectedArgs['domain'] = $domain;
279
+ $selectedArgs['divId'] = 'quick_adsense_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 = quick_adsense_vi_api_get_settings();
330
+ if(($viSettings != false) && is_array($viSettings)) {
331
+ $viToken = quick_adsense_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('quick_adsense_vi_api_jstag');
366
+ set_transient('quick_adsense_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 quick_adsense_vi_api_get_vi_code($settingsKey = '') {
407
+ //delete_transient('quick_adsense_vi_api_jstag');
408
+ $jsTag = get_transient('quick_adsense_vi_api_jstag');
409
+ if(($jsTag === false) || ($jsTag == '') || is_array($jsTag)) {
410
+ if($settingsKey != '') {
411
+ $vicodeSettings = get_option($settingsKey);
412
+ $jsTag = quick_adsense_vi_api_set_vi_code($vicodeSettings);
413
+ } else {
414
+ $jsTag = quick_adsense_vi_api_set_vi_code();
415
+ }
416
+ if(($jsTag === false) || ($jsTag == '') || is_array($jsTag)) {
417
+ return false;
418
+ }
419
+ }
420
+ return '<script type="text/javascript">'.$jsTag.'</script>';
421
+ }
422
+ ?>
includes/content.php ADDED
@@ -0,0 +1,442 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $quickAdsenseAdsDisplayed = 0;
3
+ $quickAdsenseAdsId = array();
4
+ $quickAdsenseBeginEnd = 0;
5
+
6
+ add_filter('the_content', 'quick_adsense_the_content');
7
+ function quick_adsense_the_content($content) {
8
+ global $quickAdsenseAdsDisplayed;
9
+ global $quickAdsenseAdsId;
10
+ global $quickAdsenseBeginEnd;
11
+ $settings = get_option('quick_adsense_settings');
12
+
13
+ if(!quick_adsense_postads_isactive($settings, $content)) {
14
+ $content = quick_adsense_content_clean_tags($content);
15
+ return $content;
16
+ }
17
+
18
+ /* Begin Enforce Max Ads Per Page Rule */
19
+ $quickAdsenseAdsToDisplay = $settings['max_ads_per_page'];
20
+ if (strpos($content, '<!--OffWidget-->') === false) {
21
+ for($i = 1; $i <= 10; $i++) {
22
+ $widgetID = sanitize_title(str_replace(array('(', ')'), '', sprintf('AdsWidget%d (Quick Adsense)', $i)));
23
+ $quickAdsenseAdsToDisplay -= (is_active_widget(true, $widgetID))?1:0;
24
+ }
25
+ }
26
+ if($quickAdsenseAdsDisplayed >= $quickAdsenseAdsToDisplay) {
27
+ $content = quick_adsense_content_clean_tags($content);
28
+ return $content;
29
+ };
30
+ /* End Enforce Max Ads Per Page Rule */
31
+
32
+ /* Begin Check for Available Ad Blocks */
33
+ if(!count($quickAdsenseAdsId)) {
34
+ for($i = 1; $i <= 10; $i++) {
35
+ if(isset($settings['onpost_ad_'.$i.'_content']) && !empty(trim($settings['onpost_ad_'.$i.'_content']))) {
36
+ array_push($quickAdsenseAdsId, $i);
37
+ }
38
+ }
39
+ }
40
+ array_push($quickAdsenseAdsId, 100);
41
+
42
+ if(!count($quickAdsenseAdsId) ) {
43
+ $content = quick_adsense_content_clean_tags($content);
44
+ return $content;
45
+ };
46
+ /* End Check for Available Ad Blocks */
47
+
48
+ /* Begin Insert StandIns for all Ad Blocks */
49
+ $content = str_replace('<p></p>', '##QA-TP1##', $content);
50
+ $content = str_replace('<p>&nbsp;</p>', '##QA-TP2##', $content);
51
+ $offdef = (strpos($content, '<!--OffDef-->') !== false);
52
+ if(!$offdef) {
53
+ $quickAdsenseAdsIdCus = array();
54
+ $cusads = 'CusAds';
55
+ $cusrnd = 'CusRnd';
56
+ $cusadsvi = 'CusAdsVi';
57
+ $cusrndvi = 'CusRndVi';
58
+
59
+ $quickAdsenseEnablePositionAfterMoreTag = ((isset($settings['enable_position_after_more_tag']))?$settings['enable_position_after_more_tag']:'');
60
+ $quickAdsenseAdAfterMoreTag = ((isset($settings['ad_after_more_tag']))?$settings['ad_after_more_tag']:'');
61
+
62
+ $quickAdsenseEnablePositionBeforeLastPara = ((isset($settings['enable_position_before_last_para']))?$settings['enable_position_before_last_para']:'');
63
+ $quickAdsenseAdBeforeLastPara = ((isset($settings['ad_before_last_para']))?$settings['ad_before_last_para']:'');
64
+
65
+ $quickAdsenseEnablePositionBeginningOfPost = ((isset($settings['enable_position_beginning_of_post']))?$settings['enable_position_beginning_of_post']:'');
66
+ $quickAdsenseAdBeginningOfPost = ((isset($settings['ad_beginning_of_post']))?$settings['ad_beginning_of_post']:'');
67
+
68
+ $quickAdsenseEnablePositionMiddleOfPost = ((isset($settings['enable_position_middle_of_post']))?$settings['enable_position_middle_of_post']:'');
69
+ $quickAdsenseAdMiddleOfPost = ((isset($settings['ad_middle_of_post']))?$settings['ad_middle_of_post']:'');
70
+
71
+ $quickAdsenseEnablePositionEndOfPost = ((isset($settings['enable_position_end_of_post']))?$settings['enable_position_end_of_post']:'');
72
+ $quickAdsenseAdEndOfPost = ((isset($settings['ad_end_of_post']))?$settings['ad_end_of_post']:'');
73
+
74
+ for($i = 1; $i <= 3; $i++) {
75
+ $quickAdsenseEnablePositionAfterPara[$i] = ((isset($settings['enable_position_after_para_option_'.$i]))?$settings['enable_position_after_para_option_'.$i]:'');
76
+ $quickAdsenseAdAfterPara[$i] = ((isset($settings['ad_after_para_option_'.$i]))?$settings['ad_after_para_option_'.$i]:'');
77
+ $quickAdsensePositionAfterPara[$i] = ((isset($settings['position_after_para_option_'.$i]))?$settings['position_after_para_option_'.$i]:'');
78
+ $quickAdsenseEnableJumpPositionAfterPara[$i] = ((isset($settings['enable_jump_position_after_para_option_'.$i]))?$settings['enable_jump_position_after_para_option_'.$i]:'');
79
+ }
80
+
81
+ for($i = 1; $i <= 1; $i++) {
82
+ $quickAdsenseEnablePositionAfterImage = ((isset($settings['enable_position_after_image_option_'.$i]))?$settings['enable_position_after_image_option_'.$i]:'');
83
+ $quickAdsenseAdAfterImage = ((isset($settings['ad_after_image_option_'.$i]))?$settings['ad_after_image_option_'.$i]:'');
84
+ $quickAdsensePositionAfterImage = ((isset($settings['position_after_image_option_'.$i]))?$settings['position_after_image_option_'.$i]:'');
85
+ $quickAdsenseEnableJumpPositionAfterImage = ((isset($settings['enable_jump_position_after_image_option_'.$i]))?$settings['enable_jump_position_after_image_option_'.$i]:'');
86
+ }
87
+
88
+ if($quickAdsenseAdBeginningOfPost == 0) {
89
+ $quickAdsenseAdBeginningOfPostStandIn = $cusrndvi;
90
+ } else {
91
+ $quickAdsenseAdBeginningOfPostStandIn = $cusadsvi.$quickAdsenseAdBeginningOfPost;
92
+ array_push($quickAdsenseAdsIdCus, $quickAdsenseAdBeginningOfPost);
93
+ };
94
+ if($quickAdsenseAdAfterMoreTag == 0) {
95
+ $quickAdsenseAdAfterMoreTagStandIn = $cusrnd;
96
+ } else {
97
+ $quickAdsenseAdAfterMoreTagStandIn = $cusads.$quickAdsenseAdAfterMoreTag;
98
+ array_push($quickAdsenseAdsIdCus, $quickAdsenseAdAfterMoreTag);
99
+ };
100
+ if($quickAdsenseAdMiddleOfPost == 0) {
101
+ $quickAdsenseAdMiddleOfPostStandIn = $cusrndvi;
102
+ } else {
103
+ $quickAdsenseAdMiddleOfPostStandIn = $cusadsvi.$quickAdsenseAdMiddleOfPost;
104
+ array_push($quickAdsenseAdsIdCus, $quickAdsenseAdMiddleOfPost);
105
+ };
106
+ if($quickAdsenseAdBeforeLastPara == 0) {
107
+ $quickAdsenseAdBeforeLastParaStandIn = $cusrnd;
108
+ } else {
109
+ $quickAdsenseAdBeforeLastParaStandIn = $cusads.$quickAdsenseAdBeforeLastPara;
110
+ array_push($quickAdsenseAdsIdCus, $quickAdsenseAdBeforeLastPara);
111
+ };
112
+ if($quickAdsenseAdEndOfPost == 0) {
113
+ $quickAdsenseAdEndOfPostStandIn = $cusrnd;
114
+ } else {
115
+ $quickAdsenseAdEndOfPostStandIn = $cusads.$quickAdsenseAdEndOfPost;
116
+ array_push($quickAdsenseAdsIdCus, $quickAdsenseAdEndOfPost);
117
+ };
118
+ for($i = 1; $i <= 3; $i++) {
119
+ if($quickAdsenseAdAfterPara[$i] == 0) {
120
+ $quickAdsenseAdAfterParaStandIn[$i] = $cusrnd;
121
+ } else {
122
+ $quickAdsenseAdAfterParaStandIn[$i] = $cusads.$quickAdsenseAdAfterPara[$i];
123
+ array_push($quickAdsenseAdsIdCus, $quickAdsenseAdAfterPara[$i]);
124
+ };
125
+ }
126
+ if($quickAdsenseAdAfterImage == 0) {
127
+ $quickAdsenseAdAfterImageStandIn = $cusrnd;
128
+ } else {
129
+ $quickAdsenseAdAfterImageStandIn = $cusads.$quickAdsenseAdAfterImage;
130
+ array_push($quickAdsenseAdsIdCus, $quickAdsenseAdAfterImage);
131
+ };
132
+
133
+ if($quickAdsenseEnablePositionMiddleOfPost && (strpos($content, '<!--OffMiddle-->') === false)) {
134
+ if(substr_count(strtolower($content), '</p>') >= 2) {
135
+ $quickAdsenseSelectedTag = "</p>";
136
+ $content = str_replace("</P>", $quickAdsenseSelectedTag, $content);
137
+ $quickAdsenseTempArray = explode($quickAdsenseSelectedTag, $content);
138
+ $j = 0;
139
+ $k = strlen($content)/2;
140
+ for($i = 0; $i < count($quickAdsenseTempArray); $i++) {
141
+ $j += strlen($quickAdsenseTempArray[$i]) + 4;
142
+ if($j > $k) {
143
+ if(($k - ($j - strlen($quickAdsenseTempArray[$i]))) > ($j - $k) && $i+1 < count($quickAdsenseTempArray)) {
144
+ $quickAdsenseTempArray[$i+1] = '<!--'.$quickAdsenseAdMiddleOfPostStandIn.'-->'.$quickAdsenseTempArray[$i+1];
145
+ } else {
146
+ $quickAdsenseTempArray[$i] = '<!--'.$quickAdsenseAdMiddleOfPostStandIn.'-->'.$quickAdsenseTempArray[$i];
147
+ }
148
+ break;
149
+ }
150
+ }
151
+ $content = implode($quickAdsenseSelectedTag, $quickAdsenseTempArray);
152
+ }
153
+ }
154
+ if($quickAdsenseEnablePositionAfterMoreTag && (strpos($content,'<!--OffAfMore-->') === false)) {
155
+ $content = str_replace('<span id="more-'.get_the_ID().'"></span>', '<!--'.$quickAdsenseAdAfterMoreTagStandIn.'-->', $content);
156
+ }
157
+ if($quickAdsenseEnablePositionBeginningOfPost && (strpos($content,'<!--OffBegin-->') === false)) {
158
+ $content = '<!--'.$quickAdsenseAdBeginningOfPostStandIn.'-->'.$content;
159
+ }
160
+ if($quickAdsenseEnablePositionEndOfPost && (strpos($content,'<!--OffEnd-->') === false)) {
161
+ $content = $content.'<!--'.$quickAdsenseAdEndOfPostStandIn.'-->';
162
+ }
163
+ if($quickAdsenseEnablePositionBeforeLastPara && (strpos($content,'<!--OffBfLastPara-->') === false)){
164
+ $quickAdsenseSelectedTag = "<p>";
165
+ $content = str_replace("<P>", $quickAdsenseSelectedTag, $content);
166
+ $quickAdsenseTempArray = explode($quickAdsenseSelectedTag, $content);
167
+ if(count($quickAdsenseTempArray) > 2) {
168
+ $content = implode($quickAdsenseSelectedTag, array_slice($quickAdsenseTempArray, 0, count($quickAdsenseTempArray)-1)).'<!--'.$quickAdsenseAdBeforeLastParaStandIn.'-->'.$quickAdsenseSelectedTag.$quickAdsenseTempArray[count($quickAdsenseTempArray)-1];
169
+ }
170
+ }
171
+ for($i = 1; $i <= 3; $i++) {
172
+ if($quickAdsenseEnablePositionAfterPara[$i]) {
173
+ $quickAdsenseSelectedTag = "</p>";
174
+ $content = str_replace("</P>", $quickAdsenseSelectedTag, $content);
175
+ $quickAdsenseTempArray = explode($quickAdsenseSelectedTag, $content);
176
+ if((int)$quickAdsensePositionAfterPara[$i] < count($quickAdsenseTempArray)) {
177
+ $content = implode($quickAdsenseSelectedTag, array_slice($quickAdsenseTempArray, 0, $quickAdsensePositionAfterPara[$i])).$quickAdsenseSelectedTag.'<!--'.$quickAdsenseAdAfterParaStandIn[$i].'-->'.implode($quickAdsenseSelectedTag, array_slice($quickAdsenseTempArray, $quickAdsensePositionAfterPara[$i]));
178
+ } elseif ($quickAdsenseEnableJumpPositionAfterPara[$i]) {
179
+ $content = implode($quickAdsenseSelectedTag, $quickAdsenseTempArray).'<!--'.$quickAdsenseAdAfterParaStandIn[$i].'-->';
180
+ }
181
+ }
182
+ }
183
+ if($quickAdsenseEnablePositionAfterImage) {
184
+ $quickAdsenseSelectedTag = "<img";
185
+ $j = ">";
186
+ $k = "[/caption]";
187
+ $l = "</a>";
188
+ $content = str_replace("<IMG", $quickAdsenseSelectedTag, $content);
189
+ $content = str_replace("</A>", $l, $content);
190
+ $quickAdsenseTempArray = explode($quickAdsenseSelectedTag, $content);
191
+ if((int)$quickAdsensePositionAfterImage < count($quickAdsenseTempArray)) {
192
+ $m = explode($j, $quickAdsenseTempArray[$quickAdsensePositionAfterImage]);
193
+ if(count($m) > 1) {
194
+ $n = explode($k, $quickAdsenseTempArray[$quickAdsensePositionAfterImage]);
195
+ $o = (count($n) > 1)?(strpos(strtolower($n[0]), '[caption ') === false):false ;
196
+ $p = explode($l, $quickAdsenseTempArray[$quickAdsensePositionAfterImage]);
197
+ $q = (count($p) > 1 )?(strpos(strtolower($p[0]), '<a href') === false):false ;
198
+ if($quickAdsenseEnableJumpPositionAfterImage && $o) {
199
+ $quickAdsenseTempArray[$quickAdsensePositionAfterImage] = implode($k, array_slice($n, 0, 1)).$k."\r\n".'<!--'.$quickAdsenseAdAfterImageStandIn.'-->'."\r\n". implode($k, array_slice($n, 1));
200
+ }else if ( $q ) {
201
+ $quickAdsenseTempArray[$quickAdsensePositionAfterImage] = implode($l, array_slice($p, 0, 1)).$l."\r\n".'<!--'.$quickAdsenseAdAfterImageStandIn.'-->'."\r\n". implode($l, array_slice($p, 1));
202
+ }else{
203
+ $quickAdsenseTempArray[$quickAdsensePositionAfterImage] = implode($j, array_slice($m, 0, 1)).$j."\r\n".'<!--'.$quickAdsenseAdAfterImageStandIn.'-->'."\r\n". implode($j, array_slice($m, 1));
204
+ }
205
+ }
206
+ $content = implode($quickAdsenseSelectedTag, $quickAdsenseTempArray);
207
+ }
208
+ }
209
+ }
210
+ /* End Insert StandIns for all Ad Blocks */
211
+
212
+
213
+ /* Begin Replace StandIns for all Ad Blocks */
214
+ $content = '<!--EmptyClear-->'.$content."\n".'<div style="font-size: 0px; height: 0px; line-height: 0px; margin: 0; padding: 0; clear: both;"></div>';
215
+ $content = quick_adsense_content_clean_tags($content, true);
216
+ $ismany = (!is_single() && !is_page());
217
+ $showall = ((isset($settings['enable_all_possible_ads']))?$settings['enable_all_possible_ads']:'');
218
+
219
+ if(!$offdef) {
220
+ for($i = 1; $i <= count($quickAdsenseAdsIdCus); $i++) {
221
+ if($showall || !$ismany || $quickAdsenseBeginEnd != $i) {
222
+ if(((strpos($content, '<!--'.$cusadsvi.$quickAdsenseAdsIdCus[$i-1].'-->') !== false) || (strpos($content, '<!--'.$cusads.$quickAdsenseAdsIdCus[$i-1].'-->') !== false)) && in_array($quickAdsenseAdsIdCus[$i-1], $quickAdsenseAdsId)) {
223
+ $content = quick_adsense_content_replace_ads($content, $cusadsvi.$quickAdsenseAdsIdCus[$i-1], $quickAdsenseAdsIdCus[$i-1]);
224
+ $content = quick_adsense_content_replace_ads($content, $cusads.$quickAdsenseAdsIdCus[$i-1], $quickAdsenseAdsIdCus[$i-1]);
225
+ $quickAdsenseAdsId = quick_adsense_content_del_element($quickAdsenseAdsId, array_search($quickAdsenseAdsIdCus[$i-1], $quickAdsenseAdsId)) ;
226
+ $quickAdsenseAdsDisplayed += 1;
227
+ if($quickAdsenseAdsDisplayed >= $quickAdsenseAdsToDisplay || !count($quickAdsenseAdsId)) {
228
+ $content = quick_adsense_content_clean_tags($content);
229
+ return $content;
230
+ };
231
+ $quickAdsenseBeginEnd = $i;
232
+ if(!$showall && $ismany) {
233
+ break;
234
+ }
235
+ }
236
+ }
237
+ }
238
+ }
239
+
240
+ if($showall || !$ismany) {
241
+ $j = 0;
242
+ for($i = 1; $i <= count($quickAdsenseAdsId); $i++ ) {
243
+ if(strpos($content, '<!--Ads'.$quickAdsenseAdsId[$j].'-->')!==false) {
244
+ $content = quick_adsense_content_replace_ads($content, 'Ads'.$quickAdsenseAdsId[$j], $quickAdsenseAdsId[$j]);
245
+ $quickAdsenseAdsId = quick_adsense_content_del_element($quickAdsenseAdsId, $j);
246
+ $quickAdsenseAdsDisplayed += 1;
247
+ if(($quickAdsenseAdsDisplayed >= $quickAdsenseAdsToDisplay) || !count($quickAdsenseAdsId)) {
248
+ $content = quick_adsense_content_clean_tags($content);
249
+ return $content;
250
+ };
251
+ } else {
252
+ $j += 1;
253
+ }
254
+ }
255
+ }
256
+
257
+ if((strpos($content, '<!--'.$cusrndvi.'-->') !== false) && ($showall || !$ismany)) {
258
+ $j = substr_count($content, '<!--'.$cusrndvi.'-->');
259
+ for($i = count($quickAdsenseAdsId); $i <= $j-1; $i++) {
260
+ array_push($quickAdsenseAdsId, -1);
261
+ }
262
+ shuffle($quickAdsenseAdsId);
263
+ for($i = 1; $i <= $j; $i++) {
264
+ $content = quick_adsense_content_replace_ads($content, $cusrndvi, $quickAdsenseAdsId[0]);
265
+ $quickAdsenseAdsId = quick_adsense_content_del_element($quickAdsenseAdsId, 0) ;
266
+ $quickAdsenseAdsDisplayed += 1;
267
+ if(($quickAdsenseAdsDisplayed >= $quickAdsenseAdsToDisplay) || !count($quickAdsenseAdsId)) {
268
+ $content = quick_adsense_content_clean_tags($content);
269
+ return $content;
270
+ };
271
+ }
272
+ }
273
+ if((strpos($content, '<!--'.$cusrnd.'-->') !== false) && ($showall || !$ismany)) {
274
+ $quickAdsenseAdsId = $quickAdsenseAdsId;
275
+ if (($key = array_search('100', $quickAdsenseAdsId)) !== false) {
276
+ unset($quickAdsenseAdsId[$key]);
277
+ }
278
+ $j = substr_count($content, '<!--'.$cusrnd.'-->');
279
+ for($i = count($quickAdsenseAdsId); $i <= $j-1; $i++) {
280
+ array_push($quickAdsenseAdsId, -1);
281
+ }
282
+ shuffle($quickAdsenseAdsId);
283
+ for($i = 1; $i <= $j; $i++) {
284
+ $content = quick_adsense_content_replace_ads($content, $cusrnd, $quickAdsenseAdsId[0]);
285
+ $quickAdsenseAdsId = quick_adsense_content_del_element($quickAdsenseAdsId, 0) ;
286
+ $quickAdsenseAdsDisplayed += 1;
287
+ if(($quickAdsenseAdsDisplayed >= $quickAdsenseAdsToDisplay) || !count($quickAdsenseAdsId)) {
288
+ $content = quick_adsense_content_clean_tags($content);
289
+ return $content;
290
+ };
291
+ }
292
+ }
293
+
294
+ if(strpos($content, '<!--RndAds-->')!==false && ($showall || !$ismany)) {
295
+ $quickAdsenseAdsIdTmp = array();
296
+ shuffle($quickAdsenseAdsId);
297
+ for($i = 1; $i <= ($quickAdsenseAdsToDisplay - $quickAdsenseAdsDisplayed); $i++) {
298
+ if($i <= count($quickAdsenseAdsId)) {
299
+ array_push($quickAdsenseAdsIdTmp, $quickAdsenseAdsId[$i-1]);
300
+ }
301
+ }
302
+ $j = substr_count($content, '<!--RndAds-->');
303
+ for($i = count($quickAdsenseAdsIdTmp); $i <= $j-1; $i++) {
304
+ array_push($quickAdsenseAdsIdTmp, -1);
305
+ }
306
+ shuffle($quickAdsenseAdsIdTmp);
307
+ for($i = 1; $i <= $j; $i++) {
308
+ $tmp = $quickAdsenseAdsIdTmp[0];
309
+ $content = quick_adsense_content_replace_ads($content, 'RndAds', $quickAdsenseAdsIdTmp[0]);
310
+ $quickAdsenseAdsIdTmp = quick_adsense_content_del_element($quickAdsenseAdsIdTmp, 0) ;
311
+ if($tmp != -1) {
312
+ $quickAdsenseAdsDisplayed += 1;
313
+ };
314
+ if($quickAdsenseAdsDisplayed >= $quickAdsenseAdsToDisplay || !count($quickAdsenseAdsIdTmp)) {
315
+ $content = quick_adsense_content_clean_tags($content);
316
+ return $content;
317
+ };
318
+ }
319
+ }
320
+ /* End Replace StandIns for all Ad Blocks */
321
+
322
+ $content = quick_adsense_content_clean_tags($content);
323
+ return $content;
324
+ }
325
+
326
+ function quick_adsense_postads_isactive($settings, $content) {
327
+ if(is_feed()) {
328
+ return false;
329
+ } else if(strpos($content, '<!--NoAds-->') !== false) {
330
+ return false;
331
+ } else if(strpos($content, '<!--OffAds-->') !== false) {
332
+ return false;
333
+ } else if(is_single() && !(isset($settings['enable_on_posts']))) {
334
+ return false;
335
+ } else if(is_page() && !(isset($settings['enable_on_pages']))) {
336
+ return false;
337
+ } else if(is_home() && !(isset($settings['enable_on_homepage']))) {
338
+ return false;
339
+ } else if(is_category() && !(isset($settings['enable_on_categories']))) {
340
+ return false;
341
+ } else if(is_archive() && !(isset($settings['enable_on_archives']))) {
342
+ return false;
343
+ } else if(is_tag() && !(isset($settings['enable_on_tags']))) {
344
+ return false;
345
+ } else if(is_user_logged_in() && (isset($settings['disable_for_loggedin_users']))) {
346
+ return false;
347
+ } else {
348
+ return true;
349
+ }
350
+ }
351
+
352
+ function quick_adsense_content_clean_tags($content, $trimonly = false) {
353
+ global $quickAdsenseAdsDisplayed;
354
+ global $quickAdsenseAdsId;
355
+ global $quickAdsenseBeginEnd;
356
+ $quicktags = array(
357
+ 'EmptyClear',
358
+ 'RndAds',
359
+ 'NoAds',
360
+ 'OffDef',
361
+ 'OffAds',
362
+ 'OffWidget',
363
+ 'OffBegin',
364
+ 'OffMiddle',
365
+ 'OffEnd',
366
+ 'OffBfMore',
367
+ 'OffAfLastPara',
368
+ 'CusRnd'
369
+ );
370
+ for($i = 1; $i <= 10; $i++) {
371
+ array_push($quicktags, 'CusAds'.$i);
372
+ array_push($quicktags, 'Ads'.$i);
373
+ };
374
+ foreach($quicktags as $quicktag) {
375
+ if((strpos($content,'<!--'.$quicktag.'-->') !== false) || ($quicktag == 'EmptyClear')) {
376
+ if($trimonly) {
377
+ $content = str_replace('<p><!--'.$quicktag.'--></p>', '<!--'.$quicktag.'-->', $content);
378
+ } else {
379
+ $content = str_replace(array('<p><!--'.$quicktag.'--></p>', '<!--'.$quicktag.'-->'), '', $content);
380
+ $content = str_replace("##QA-TP1##", "<p></p>", $content);
381
+ $content = str_replace("##QA-TP2##", "<p>&nbsp;</p>", $content);
382
+ }
383
+ }
384
+ }
385
+ if(!$trimonly && (is_single() || is_page())) {
386
+ $quickAdsenseAdsDisplayed = 0;
387
+ $quickAdsenseAdsId = array();
388
+ $quickAdsenseBeginEnd = 0;
389
+ }
390
+ return $content;
391
+ }
392
+
393
+ function quick_adsense_content_replace_ads($content, $quicktag, $adIndex) {
394
+ if(strpos($content, '<!--'.$quicktag.'-->') === false ) {
395
+ return $content;
396
+ }
397
+ $settings = get_option('quick_adsense_settings');
398
+ $onpostAdStyles = array(
399
+ '',
400
+ 'float: left; margin: %1$dpx %1$dpx %1$dpx 0;',
401
+ 'float: none; margin:%1$dpx 0 %1$dpx 0; text-align:center;',
402
+ 'float: right; margin:%1$dpx 0 %1$dpx %1$dpx;',
403
+ 'float: none; margin:0px;'
404
+ );
405
+
406
+ if(strpos($quicktag, 'Vi') !== false ) {
407
+ if(($adIndex != -1) && ($adIndex != 100)) {
408
+ $onpostAdAlignment = ((isset($settings['onpost_ad_'.$adIndex.'_alignment']))?$settings['onpost_ad_'.$adIndex.'_alignment']:'');
409
+ $onpostAdMargin = ((isset($settings['onpost_ad_'.$adIndex.'_margin']))?$settings['onpost_ad_'.$adIndex.'_margin']:'');
410
+ $onpostAdStyle = sprintf($onpostAdStyles[(int)$onpostAdAlignment], $onpostAdMargin);
411
+ $onpostAdCode = ((isset($settings['onpost_ad_'.$adIndex.'_content']))?$settings['onpost_ad_'.$adIndex.'_content']:'');
412
+ $onpostAdCode = "\n".'<!-- Quick Adsense Wordpress Plugin: http://quickadsense.com/ -->'."\n".'<div style="'.$onpostAdStyle.'">'."\n".$onpostAdCode."\n".'</div>'."\n";
413
+ } else if($adIndex == 100) {
414
+ $onpostAdCode = "\n".'<!-- Quick Adsense Wordpress Plugin: http://quickadsense.com/ -->'."\n".'<div style="float: none; margin: 10px auto; text-align: center;">'."\n".'<div id="quick_adsense_vi_ad">'.quick_adsense_vi_api_get_vi_code('quick_adsense_vi_code_settings').'</div>'."\n".'</div>'."\n";
415
+ } else {
416
+ $onpostAdCode = '';
417
+ }
418
+ } else {
419
+ if(($adIndex != -1)) {
420
+ $onpostAdAlignment = ((isset($settings['onpost_ad_'.$adIndex.'_alignment']))?$settings['onpost_ad_'.$adIndex.'_alignment']:'');
421
+ $onpostAdMargin = ((isset($settings['onpost_ad_'.$adIndex.'_margin']))?$settings['onpost_ad_'.$adIndex.'_margin']:'');
422
+ $onpostAdStyle = sprintf($onpostAdStyles[(int)$onpostAdAlignment], $onpostAdMargin);
423
+ $onpostAdCode = ((isset($settings['onpost_ad_'.$adIndex.'_content']))?$settings['onpost_ad_'.$adIndex.'_content']:'');
424
+ $onpostAdCode = "\n".'<!-- Quick Adsense Wordpress Plugin: http://quickadsense.com/ -->'."\n".'<div style="'.$onpostAdStyle.'">'."\n".$onpostAdCode."\n".'</div>'."\n";
425
+ } else {
426
+ $onpostAdCode = '';
427
+ }
428
+ }
429
+ $content = explode('<!--'.$quicktag.'-->', $content, 2);
430
+ return $content[0].$onpostAdCode.$content[1];
431
+ }
432
+
433
+ function quick_adsense_content_del_element($quickAdsenseTempArray, $idx) {
434
+ $copy = array();
435
+ for($i=0; $i<count($quickAdsenseTempArray) ;$i++) {
436
+ if($idx != $i) {
437
+ array_push($copy, $quickAdsenseTempArray[$i]);
438
+ }
439
+ }
440
+ return $copy;
441
+ }
442
+ ?>
includes/controls.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if(!function_exists('quickadsense_get_control')) {
3
+ function quickadsense_get_control($type, $label, $id, $name, $value = '', $data = null, $class = 'input widefat', $style = '', $placeholder = '') {
4
+ $output = '';
5
+ switch($type) {
6
+ case 'hidden':
7
+ $output .= '<input type="text" id="'.$id.'" name="'.$name.'" value="'.$value.'" style="display: none;" />';
8
+ break;
9
+ case 'text':
10
+ if($label != '') {
11
+ $output .= '<label for="'.$name.'">'.$label.'</label>';
12
+ }
13
+ $output .= '<input type="text" id="'.$id.'" name="'.$name.'" value="'.$value.'" class="multilanguage-input '.$class.'" style="'.$style.'" placeholder="'.$placeholder.'" />';
14
+ break;
15
+ case 'password':
16
+ if($label != '') {
17
+ $output .= '<label for="'.$name.'">'.$label.'</label>';
18
+ }
19
+ $output .= '<input type="password" id="'.$id.'" name="'.$name.'" value="'.$value.'" class="multilanguage-input '.$class.'" style="'.$style.'" placeholder="'.$placeholder.'" />';
20
+ break;
21
+ case 'number':
22
+ if($label != '') {
23
+ $output .= '<label for="'.$name.'">'.$label.'</label>';
24
+ }
25
+ $output .= '<input type="number" id="'.$id.'" name="'.$name.'" value="'.$value.'" class="multilanguage-input '.$class.'" style="'.$style.'" placeholder="'.$placeholder.'" />';
26
+ break;
27
+ case 'checkbox':
28
+ $output .= '<input type="checkbox" id="'.$id.'" name="'.$name.'" value="1" class="input" '.checked($value, 1, false).' style="'.$style.'" />';
29
+ if($label != '') {
30
+ $output .= '<label for="'.$name.'">'.$label.'</label>';
31
+ }
32
+ break;
33
+ case 'textarea':
34
+ if($label != '') {
35
+ $output .= '<label for="'.$name.'">'.$label.'</label><br />';
36
+ }
37
+ $output .= '<textarea id="'.$id.'" name="'.$name.'" class="multilanguage-input '.$class.'" class="height: 100px;" style="'.$style.'" placeholder="'.$placeholder.'">'.$value.'</textarea>';
38
+ break;
39
+ case 'select':
40
+ if($label != '') {
41
+ $output .= '<label for="'.$name.'">'.$label.'</label>';
42
+ }
43
+ $output .= '<select id="'.$id.'" name="'.$name.'" class="'.$class.'" style="'.$style.'" >';
44
+ if($data) {
45
+ foreach($data as $option) {
46
+ $metadata = '';
47
+ if(isset($option['metadata']) && is_array($option['metadata'])) {
48
+ foreach($option['metadata'] as $key => $metavalue) {
49
+ $metadata .= 'data-'.$key.'="'.$metavalue.'"';
50
+ }
51
+ }
52
+ $output .= '<option '.$metadata.' value="'.$option['value'].'" '.selected($value, $option['value'], false).'>'.$option['text'].'</option>';
53
+ }
54
+ }
55
+ $output .= '</select>';
56
+ break;
57
+ case 'upload':
58
+ if($label != '') {
59
+ $output .= '<label for="'.$name.'">'.$label.'</label><br />';
60
+ }
61
+ $output .= '<input type="text" id="'.$id.'" name="'.$name.'" value="'.$value.'" class="'.$class.'" class="width: 74%;" style="'.$style.'" />';
62
+ $output .= '<input type="button" value="Upload Image" class="boates_uploader_button" id="upload_image_button" class="width: 25%;" />';
63
+ break;
64
+ case 'multiselect':
65
+ if($label != '') {
66
+ $output .= '<label for="'.$name.'">'.$label.'</label><br />';
67
+ }
68
+ $output .= '<select id="'.$id.'" name="'.$name.'" class="'.$class.'" multiple="multiple" class="height: 220px" style="'.$style.'" >';
69
+ if($data) {
70
+ foreach($data as $option) {
71
+ if(is_array($value) && in_array($option['value'], $value)) {
72
+ $output .= '<option value="'.$option['value'].'" selected="selected">'.$option['text'].'</option>';
73
+ } else {
74
+ $output .= '<option value="'.$option['value'].'">'.$option['text'].'</option>';
75
+ }
76
+ }
77
+ }
78
+ $output .= '</select>';
79
+ break;
80
+ }
81
+ return $output;
82
+ }
83
+ }
84
+ ?>
includes/css/admin.css ADDED
@@ -0,0 +1,970 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #quick_adsense_settings_form .ui-tabs .ui-tabs-nav {
2
+ background: none;
3
+ border-radius: 0;
4
+ border-top: none;
5
+ border-left: none;
6
+ border-right: none;
7
+ }
8
+
9
+ #quick_adsense_settings_form #quick_adsense_settings_tabs {
10
+ background: none;
11
+ border: none;
12
+ }
13
+
14
+ #quick_adsense_settings_form #quick_adsense_settings_tabs .ui-tabs-nav li {
15
+ background: #F1F1F1;
16
+ border-radius: 0;
17
+ margin-left: 4px;
18
+ margin-right: 4px;
19
+ }
20
+
21
+ #quick_adsense_settings_form #quick_adsense_settings_tabs .ui-tabs-nav li a {
22
+ background: #E5E5E5;
23
+ border-bottom: none;
24
+ font-weight: 600;
25
+ color: #000;
26
+ padding: 7px 25px 8px 25px;
27
+ }
28
+
29
+ #quick_adsense_settings_form #quick_adsense_settings_tabs .ui-tabs-nav li a:focus {
30
+ border: none;
31
+ box-shadow: none;
32
+ }
33
+
34
+ #quick_adsense_settings_form #quick_adsense_settings_tabs .ui-tabs-nav li.ui-tabs-active a {
35
+ background: #F1F1F1;
36
+ }
37
+ #quick_adsense_top_sections_wrapper {
38
+ margin-top: 20px;
39
+ }
40
+
41
+ .quick_adsense_block {
42
+ margin: 0 0 15px;
43
+ }
44
+
45
+ .quick_adsense_block_labels {
46
+ font-family: 'Arial';
47
+ font-size: 14px;
48
+ font-weight: bold;
49
+ color: rgba(0, 0, 0, 1);
50
+ line-height: 18px;
51
+ width: 160px;
52
+ float: left;
53
+ }
54
+
55
+ .quick_adsense_block_labels span {
56
+ font-size: 16px;
57
+ }
58
+
59
+ .quick_adsense_block_controls {
60
+ font-family: 'Arial';
61
+ font-size: 14px;
62
+ float: left;
63
+ color: rgba(0,0,0,1);
64
+ color: #000000;
65
+ }
66
+
67
+ .quick_adsense_block_controls p,
68
+ .quick_adsense_block_controls li {
69
+ margin: 0 0 10px;
70
+ color: #727272;
71
+ font-size: 14px;
72
+ }
73
+
74
+ .quick_adsense_block_controls p b,
75
+ .quick_adsense_block_controls li b {
76
+ color: #000000;
77
+ font-weight: 200;
78
+ }
79
+
80
+ .quick_adsense_block_controls p i {
81
+ color: #000000;
82
+ }
83
+
84
+ .quick_adsense_block_controls p.disabled,
85
+ .quick_adsense_block_controls p span.disabled,
86
+ .quick_adsense_block_controls input.disabled,
87
+ .quick_adsense_block_controls label b.disabled {
88
+ opacity: 0.5;
89
+ }
90
+
91
+ .quick_adsense_block_controls a {
92
+ color: rgba(0, 115, 170, 1);
93
+ }
94
+
95
+ .quick_adsense_block .clear {
96
+ height: 15px;
97
+ }
98
+
99
+ #quick_adsense_block_bottom p {
100
+ margin: 0;
101
+ color: #000000;
102
+ font-size: 14px;
103
+ }
104
+
105
+ #quick_adsense_bottom_sections_wrapper {
106
+ padding: 10px 0 0;
107
+ color: #000000;
108
+ }
109
+
110
+ #quick_adsense_bottom_sections_wrapper p.quick_adsense_onpost_adunits_styling_controls,
111
+ #quick_adsense_bottom_sections_wrapper p.quick_adsense_widget_adunits_styling_controls {
112
+ margin: 0;
113
+ font-size: 14px;
114
+ }
115
+
116
+ #quick_adsense_bottom_sections_wrapper p.quick_adsense_onpost_adunits_styling_controls.disabled,
117
+ #quick_adsense_bottom_sections_wrapper p.quick_adsense_widget_adunits_styling_controls.disabled {
118
+ opacity: 0.5;
119
+ }
120
+
121
+ #quick_adsense_bottom_sections_wrapper p.quick_adsense_onpost_adunits_styling_controls wbr,
122
+ #quick_adsense_bottom_sections_wrapper p.quick_adsense_widget_adunits_styling_controls wbr {
123
+ display: none;
124
+ }
125
+
126
+ #quick_adsense_bottom_left_section_wrapper {
127
+ float: left;
128
+ width: calc(50% - 58px);
129
+ margin-right: 58px;
130
+ position: relative;
131
+ max-width: 580px;
132
+ }
133
+
134
+ #quick_adsense_bottom_right_section_wrapper {
135
+ float: left;
136
+ width: calc(50% - 58px);
137
+ position: relative;
138
+ max-width: 580px;
139
+ }
140
+
141
+ #quick_adsense_bottom_left_section_wrapper h2, #quick_adsense_bottom_right_section_wrapper h2 {
142
+ font-family: 'Arial';
143
+ font-size: 14px;
144
+ font-weight: bold;
145
+ color: #000000;
146
+ text-align: left;
147
+ margin: 0 0 25px;
148
+ }
149
+
150
+ #quick_adsense_onpost_content_controls_wrapper {
151
+ }
152
+
153
+ #quick_adsense_onpost_content_controls_wrapper #quick_adsense_onpost_content_global_controls_wrapper {
154
+ margin-left: 160px;
155
+ margin-bottom: 20px;
156
+ }
157
+
158
+ #quick_adsense_onpost_content_controls_wrapper #quick_adsense_onpost_content_global_controls_wrapper span {
159
+ margin-right: 25px;
160
+ }
161
+
162
+ #quick_adsense_onpost_content_controls_wrapper .quick_adsense_onpost_adunits_control_wrapper {
163
+ margin: 0 0 10px 0;
164
+ min-height: 115px;
165
+ }
166
+
167
+ #quick_adsense_onpost_content_controls_wrapper #quick_adsense_onpost_content_adunits_wrapper {
168
+ }
169
+
170
+ #quick_adsense_onpost_content_controls_wrapper #quick_adsense_onpost_content_adunits_wrapper .quick_adsense_onpost_adunits_label {
171
+ font-family: 'Arial';
172
+ font-size: 14px;
173
+ color: #000000;
174
+ text-align: left;
175
+ width: 145px;
176
+ float: left;
177
+ margin-top: 5px;
178
+ }
179
+
180
+ #quick_adsense_onpost_content_controls_wrapper #quick_adsense_onpost_content_adunits_wrapper .quick_adsense_onpost_adunits_control {
181
+ width: calc(100% - 145px);
182
+ float: left;
183
+ }
184
+
185
+ #quick_adsense_onpost_content_controls_wrapper #quick_adsense_onpost_content_adunits_wrapper .quick_adsense_onpost_adunits_control textarea {
186
+ width: 435px;
187
+ min-height: 62px;
188
+ max-width: 100%;
189
+ }
190
+
191
+ #quick_adsense_widget_controls_wrapper {
192
+ }
193
+
194
+ #quick_adsense_widget_controls_wrapper #quick_adsense_widget_global_controls_wrapper {
195
+ margin-left: 160px;
196
+ margin-bottom: 20px;
197
+ }
198
+
199
+ #quick_adsense_widget_controls_wrapper #quick_adsense_widget_global_controls_wrapper span {
200
+ margin-right: 25px;
201
+ }
202
+
203
+ #quick_adsense_widget_controls_wrapper #quick_adsense_widget_adunits_wrapper .quick_adsense_widget_adunits_control_wrapper {
204
+ margin: 0 0 10px 0;
205
+ min-height: 115px;
206
+ }
207
+
208
+ #quick_adsense_widget_controls_wrapper #quick_adsense_widget_adunits_wrapper .quick_adsense_widget_adunits_label {
209
+ font-family: 'Arial';
210
+ font-size: 14px;
211
+ color: #000000;
212
+ text-align: left;
213
+ width: 145px;
214
+ float: left;
215
+ margin-top: 5px;
216
+ }
217
+
218
+ #quick_adsense_widget_controls_wrapper #quick_adsense_widget_adunits_wrapper .quick_adsense_widget_adunits_control {
219
+ width: calc(100% - 145px);
220
+ float: left;
221
+ }
222
+
223
+ #quick_adsense_widget_controls_wrapper #quick_adsense_widget_adunits_wrapper .quick_adsense_widget_adunits_control textarea {
224
+ width: 435px;
225
+ min-height: 100px;
226
+ max-width: 100%;
227
+ }
228
+
229
+ #quick_adsense_onpost_content_adunits_initial_wrapper,
230
+ #quick_adsense_onpost_content_adunits_all_wrapper,
231
+ #quick_adsense_widget_adunits_initial_wrapper,
232
+ #quick_adsense_widget_adunits_all_wrapper {
233
+ overflow: hidden;
234
+ }
235
+
236
+ #quick_adsense_onpost_content_adunits_wrapper a.button-secondary,
237
+ #quick_adsense_widget_adunits_wrapper a.button-secondary {
238
+ padding: 0;
239
+ min-width: 140px;
240
+ text-align: center;
241
+ color: #5f5f5f;
242
+ font-family: arial;
243
+ font-size: 12px;
244
+ font-weight: 600;
245
+ height: 30px;
246
+ line-height: 30px;
247
+ position: absolute;
248
+ right: 0;
249
+ }
250
+
251
+ #quick_adsense_onpost_content_adunits_wrapper a.button-secondary span.dashicons,
252
+ #quick_adsense_widget_adunits_wrapper a.button-secondary span.dashicons {
253
+ font-size: 15px;
254
+ line-height: 30px;
255
+ margin-left: -10px;
256
+ }
257
+
258
+
259
+ /* Begin vi */
260
+ .quick_adsense_ajaxloader {
261
+ background: url(../images/ajax-loader.gif) no-repeat center center;
262
+ max-width: 320px;
263
+ min-width: 100px;
264
+ height: 100px;
265
+ margin: auto;
266
+ }
267
+
268
+ .quick_adsense_ajaxloader_flat {
269
+ background: url(../images/ajax-loader-flat.gif) no-repeat center center;
270
+ max-width: 320px;
271
+ min-width: 100px;
272
+ height: 50px;
273
+ margin: auto;
274
+ }
275
+
276
+ p.viError {
277
+ font-weight: bold;
278
+ color: #fd5740;
279
+ }
280
+
281
+ .quick_adsense_vi_login_error {
282
+ color: #ff0000;
283
+ font-size: 10px;
284
+ margin: -10px 0 0;
285
+ }
286
+
287
+
288
+ .quick_adsense_vi_block {
289
+ border: 1px solid #E7E7E7;
290
+ background: #fff;
291
+ margin: 20px 0 40px;
292
+ }
293
+
294
+ .quick_adsense_vi_block .quick_adsense_vi_block_header {
295
+ color: #23282d;
296
+ font-family: 'Arial';
297
+ font-size: 14px;
298
+ font-weight: 600;
299
+ line-height: 17px;
300
+ margin: 0;
301
+ border-bottom: 1px solid #eeeeee;
302
+ padding: 14px 26px;
303
+ }
304
+
305
+ .quick_adsense_vi_block .quick_adsense_vi_block_content {
306
+ font-family: arial;
307
+ font-size: 14px;
308
+ line-height: 18px;
309
+ color: #232323;
310
+ padding: 20px 26px 10px;
311
+ border-bottom: 1px solid #eeeeee;
312
+ }
313
+
314
+ .quick_adsense_vi_block .quick_adsense_vi_block_content p {
315
+ font-family: arial;
316
+ font-size: 14px;
317
+ line-height: 18px;
318
+ color: #232323;
319
+ margin: 0 0 10px;
320
+ }
321
+
322
+
323
+ .quick_adsense_vi_block .quick_adsense_vi_block_content p strong {
324
+ color: #232323;
325
+ font-size: 14px;
326
+ font-weight: bold;
327
+ }
328
+
329
+ .quick_adsense_vi_block .quick_adsense_vi_block_content ul {
330
+ margin: 10px 0 10px 10px;
331
+ padding: 0 0 0 15px;
332
+ }
333
+
334
+ .quick_adsense_vi_block .quick_adsense_vi_block_content ul li {
335
+ list-style-type: disc;
336
+ margin: 0 0 5px;
337
+ padding: 0 0 0 7px;
338
+ line-height: 18px;
339
+ list-style-position: outside;
340
+ }
341
+
342
+ .quick_adsense_vi_block .quick_adsense_vi_block_footer {
343
+ background: #ffffff;
344
+ text-align: right;
345
+ padding: 11px 26px 11px;
346
+ }
347
+
348
+ .quick_adsense_vi_block .quick_adsense_vi_block_footer span {
349
+ display: inline;
350
+ float: left;
351
+ text-align: left;
352
+ width: calc(100% - 200px);
353
+ font-family: Arial;
354
+ font-size: 13px;
355
+ color: #444444;
356
+ text-align: left;
357
+ line-height: 18px;
358
+ margin: 7px 0 0;
359
+ }
360
+
361
+ .quick_adsense_vi_block .quick_adsense_vi_block_footer .button {
362
+ height: 32px;
363
+ line-height: 28px;
364
+ padding: 0 15px;
365
+ margin: 0;
366
+ }
367
+
368
+ .quick_adsense_vi_block .quick_adsense_vi_block_footer .button#quick_adsense_vi_signup {
369
+ margin: 0 0 0 15px;
370
+ }
371
+
372
+ .quick_adsense_vi_block #quick_adsense_vi_earnings_wrapper {
373
+ margin-top: 5px;
374
+ }
375
+
376
+ .quick_adsense_vi_block #quick_adsense_vi_earnings_wrapper p {
377
+ font-size: 13px;
378
+ color: #444444;
379
+ }
380
+
381
+ .quick_adsense_vi_block #quick_adsense_vi_earnings_wrapper #quick_adsense_vi_earnings {
382
+ float: left;
383
+ width: 270px;
384
+ margin-bottom: 15px;
385
+ }
386
+
387
+ .quick_adsense_vi_block #quick_adsense_vi_earnings_wrapper #quick_adsense_vi_earnings #quick_adsense_vi_earnings_label {
388
+ color: rgb(35, 40, 45);
389
+ display: block;
390
+ font-size: 14px;
391
+ line-height: 18px;
392
+ font-family: Arial;
393
+ margin-top: 50px;
394
+ }
395
+
396
+ .quick_adsense_vi_block #quick_adsense_vi_earnings_wrapper #quick_adsense_vi_earnings #quick_adsense_vi_earnings_value {
397
+ color: rgb(35, 40, 45);
398
+ display: block;
399
+ font-size: 40px;
400
+ font-weight: bold;
401
+ line-height: 44px;
402
+ font-family: Arial;
403
+ margin-top: 10px;
404
+ }
405
+
406
+ .quick_adsense_vi_block #quick_adsense_vi_earnings_wrapper #quick_adsense_vi_chart_wrapper {
407
+ float: right;
408
+ height: 180px;
409
+ width: calc(100% - 270px);
410
+ }
411
+
412
+ .quick_adsense_vi_block #quick_adsense_vi_earnings_wrapper #quick_adsense_vi_chart_wrapper canvas {
413
+ border: 1px solid #ddd;
414
+ }
415
+
416
+ .quick_adsense_vi_login_error {
417
+ color: #ff0000;
418
+ font-size: 10px;
419
+ margin: -10px 0 0;
420
+ }
421
+
422
+ #quick_adsense_vi_customize_adcode {
423
+ margin-left: 10px;
424
+ }
425
+
426
+ .quick_adsense_popup_content_wrapper .quick_adsense_vi_popup_right_column {
427
+ width: calc(50% - 30px);
428
+ float: right;
429
+ margin-top: 10px;
430
+ }
431
+
432
+ .quick_adsense_popup_content_wrapper .quick_adsense_vi_popup_left_column {
433
+ width: calc(50% - 30px);
434
+ float: left;
435
+ margin-top: 10px;
436
+ font-family: Arial;
437
+ font-size: 13px;
438
+ line-height: 18px;
439
+ }
440
+
441
+ .quick_adsense_popup_content_wrapper .quick_adsense_vi_popup_left_column p {
442
+ position: relative;
443
+ }
444
+
445
+ .quick_adsense_popup_content_wrapper .quick_adsense_vi_popup_left_column p label {
446
+ float: left;
447
+ display: inline-block;
448
+ width: 180px;
449
+ }
450
+
451
+ .quick_adsense_popup_content_wrapper .quick_adsense_vi_popup_left_column p br {
452
+ display: none;
453
+ }
454
+
455
+ .quick_adsense_popup_content_wrapper .quick_adsense_vi_popup_left_column p input,
456
+ .quick_adsense_popup_content_wrapper .quick_adsense_vi_popup_left_column p select,
457
+ .quick_adsense_popup_content_wrapper .quick_adsense_vi_popup_left_column p textarea {
458
+ float: right;
459
+ width: calc(100% - 210px);
460
+ display: inline-block;
461
+ clear: none;
462
+ margin-right: 20px;
463
+ }
464
+
465
+ .quick_adsense_popup_content_wrapper .quick_adsense_vi_popup_left_column p textarea {
466
+ height: 100px;
467
+ }
468
+
469
+ .quick_adsense_popup_content_wrapper .quick_adsense_vi_popup_left_column p span.tooltipWrapper {
470
+ position: absolute;
471
+ display: inline-block;
472
+ background: #bababa;
473
+ width: 13px;
474
+ height: 13px;
475
+ border-radius: 7px;
476
+ right: 0;
477
+ top: 5px;
478
+ cursor: pointer;
479
+ }
480
+
481
+ .quick_adsense_popup_content_wrapper .quick_adsense_vi_popup_left_column p span.tooltipWrapper:after {
482
+ content: "i";
483
+ font-size: 10px;
484
+ font-weight: 600;
485
+ color: #fff;
486
+ line-height: 13px;
487
+ position: relative;
488
+ left: 0;
489
+ right: 0;
490
+ margin: 0 auto 0;
491
+ width: 13px;
492
+ height: 13px;
493
+ display: block;
494
+ text-align: center;
495
+ }
496
+
497
+ .quick_adsense_popup_content_wrapper .quick_adsense_vi_popup_left_column p span.tooltipWrapper:hover {
498
+ background: #000000;
499
+ }
500
+
501
+ .quick_adsense_popup_content_wrapper .quick_adsense_vi_popup_left_column p span.tooltipWrapper span.tooltip {
502
+ visibility: hidden;
503
+ width: 142px;
504
+ background-color: #363636;
505
+ color: #fff;
506
+ text-align: left;
507
+ padding: 5px;
508
+ border-radius: 4px;
509
+ position: absolute;
510
+ top: -10px;
511
+ left: 20px;
512
+ z-index: 1;
513
+ font-size: 11px;
514
+ }
515
+
516
+ .quick_adsense_popup_content_wrapper .quick_adsense_vi_popup_left_column p span.tooltipWrapper span.tooltip br {
517
+ display: block;
518
+ }
519
+
520
+ .quick_adsense_popup_content_wrapper .quick_adsense_vi_popup_left_column p span.tooltipWrapper:hover span.tooltip {
521
+ visibility: visible;
522
+ }
523
+
524
+ .quick_adsense_popup_content_wrapper .quick_adsense_vi_popup_left_column p span.tooltipWrapper span.tooltip::after {
525
+ /*content: " ";
526
+ position: absolute;
527
+ top: 50%;
528
+ right: 100%;
529
+ margin-top: -5px;
530
+ border-width: 5px;
531
+ border-style: solid;
532
+ border-color: transparent black transparent transparent;*/
533
+ }
534
+
535
+ .quick_adsense_popup_content_wrapper .quick_adsense_vi_popup_left_column .minicolors {
536
+ width: calc(100% - 190px);
537
+ float: right;
538
+ }
539
+
540
+ .quick_adsense_popup_content_wrapper .quick_adsense_vi_popup_left_column .minicolors input {
541
+ width: calc(100% - 20px);
542
+ height: 30px;
543
+ }
544
+
545
+ .quick_adsense_popup_content_wrapper .quick_adsense_vi_popup_left_column p small {
546
+ clear: both;
547
+ height: 1px;
548
+ width: 100%;
549
+ display: block;
550
+ }
551
+
552
+ .quick_adsense_popup_content_wrapper .quick_adsense_vi_popup_left_column p a.textTip {
553
+ position: absolute;
554
+ right: -92px;
555
+ top: 5px;
556
+ font-size: 11px;
557
+ display: block;
558
+ font-style: italic;
559
+ }
560
+
561
+ .quick_adsense_popup_content_wrapper .quick_adsense_vi_delay_notice {
562
+ float: right;
563
+ width: calc(100% - 210px);
564
+ display: inline-block;
565
+ clear: both;
566
+ margin: 0 20px 0 0;
567
+ color: #5f5f5f;
568
+ font-size: 13px;
569
+ font-style: italic;
570
+ }
571
+
572
+ .quick_adsense_popup_content_wrapper .quick_adsense_vi_code_data_wrapper {
573
+ line-height: 24px;
574
+ margin: 18px 0 20px;
575
+ }
576
+
577
+ .quick_adsense_popup_content_wrapper .quick_adsense_vi_code_data_wrapper label {
578
+ width: 144px;
579
+ display: block;
580
+ font-size: 12px;
581
+ font-family: Arial;
582
+ position: absolute;
583
+ color: #444444;
584
+ }
585
+
586
+ .quick_adsense_popup_content_wrapper .quick_adsense_vi_code_data_wrapper b {
587
+ margin-left: 164px;
588
+ display: block;
589
+ font-size: 13px;
590
+ font-family: Arial;
591
+ color: #444444;
592
+ }
593
+ /* End vi */
594
+
595
+ /* Begin Minicolors */
596
+ .minicolors {
597
+ position: relative;
598
+ }
599
+
600
+ .minicolors-sprite {
601
+ background-image: url(../images/jquery.minicolors.png);
602
+ }
603
+
604
+ .minicolors-swatch {
605
+ position: absolute;
606
+ vertical-align: middle;
607
+ background-position: -80px 0;
608
+ border: solid 1px #ccc;
609
+ cursor: text;
610
+ padding: 0;
611
+ margin: 0;
612
+ display: inline-block;
613
+ }
614
+
615
+ .minicolors-swatch-color {
616
+ position: absolute;
617
+ top: 0;
618
+ left: 0;
619
+ right: 0;
620
+ bottom: 0;
621
+ }
622
+
623
+ .minicolors input[type=hidden] + .minicolors-swatch {
624
+ width: 28px;
625
+ position: static;
626
+ cursor: pointer;
627
+ }
628
+
629
+ .minicolors input[type=hidden][disabled] + .minicolors-swatch {
630
+ cursor: default;
631
+ }
632
+
633
+ /* Panel */
634
+ .minicolors-panel {
635
+ position: absolute;
636
+ width: 173px;
637
+ background: white;
638
+ border: solid 1px #CCC;
639
+ box-shadow: 0 0 20px rgba(0, 0, 0, .2);
640
+ z-index: 99999;
641
+ box-sizing: content-box;
642
+ display: none;
643
+ }
644
+
645
+ .minicolors-panel.minicolors-visible {
646
+ display: block;
647
+ }
648
+
649
+ /* Panel positioning */
650
+ .minicolors-position-top .minicolors-panel {
651
+ top: -154px;
652
+ }
653
+
654
+ .minicolors-position-right .minicolors-panel {
655
+ right: 0;
656
+ }
657
+
658
+ .minicolors-position-bottom .minicolors-panel {
659
+ top: 30px;
660
+ }
661
+
662
+ .minicolors-position-left .minicolors-panel {
663
+ left: 0;
664
+ }
665
+
666
+ .minicolors-with-opacity .minicolors-panel {
667
+ width: 194px;
668
+ }
669
+
670
+ .minicolors .minicolors-grid {
671
+ position: relative;
672
+ top: 1px;
673
+ left: 1px;
674
+ width: 150px;
675
+ height: 150px;
676
+ background-position: -120px 0;
677
+ cursor: crosshair;
678
+ }
679
+
680
+ .minicolors .minicolors-grid-inner {
681
+ position: absolute;
682
+ top: 0;
683
+ left: 0;
684
+ width: 150px;
685
+ height: 150px;
686
+ }
687
+
688
+ .minicolors-slider-saturation .minicolors-grid {
689
+ background-position: -420px 0;
690
+ }
691
+
692
+ .minicolors-slider-saturation .minicolors-grid-inner {
693
+ background-position: -270px 0;
694
+ background-image: inherit;
695
+ }
696
+
697
+ .minicolors-slider-brightness .minicolors-grid {
698
+ background-position: -570px 0;
699
+ }
700
+
701
+ .minicolors-slider-brightness .minicolors-grid-inner {
702
+ background-color: black;
703
+ }
704
+
705
+ .minicolors-slider-wheel .minicolors-grid {
706
+ background-position: -720px 0;
707
+ }
708
+
709
+ .minicolors-slider,
710
+ .minicolors-opacity-slider {
711
+ position: absolute;
712
+ top: 1px;
713
+ left: 152px;
714
+ width: 20px;
715
+ height: 150px;
716
+ background-color: white;
717
+ background-position: 0 0;
718
+ cursor: row-resize;
719
+ }
720
+
721
+ .minicolors-slider-saturation .minicolors-slider {
722
+ background-position: -60px 0;
723
+ }
724
+
725
+ .minicolors-slider-brightness .minicolors-slider {
726
+ background-position: -20px 0;
727
+ }
728
+
729
+ .minicolors-slider-wheel .minicolors-slider {
730
+ background-position: -20px 0;
731
+ }
732
+
733
+ .minicolors-opacity-slider {
734
+ left: 173px;
735
+ background-position: -40px 0;
736
+ display: none;
737
+ }
738
+
739
+ .minicolors-with-opacity .minicolors-opacity-slider {
740
+ display: block;
741
+ }
742
+
743
+ /* Pickers */
744
+ .minicolors-grid .minicolors-picker {
745
+ position: absolute;
746
+ top: 70px;
747
+ left: 70px;
748
+ width: 12px;
749
+ height: 12px;
750
+ border: solid 1px black;
751
+ border-radius: 10px;
752
+ margin-top: -6px;
753
+ margin-left: -6px;
754
+ background: none;
755
+ }
756
+
757
+ .minicolors-grid .minicolors-picker > div {
758
+ position: absolute;
759
+ top: 0;
760
+ left: 0;
761
+ width: 8px;
762
+ height: 8px;
763
+ border-radius: 8px;
764
+ border: solid 2px white;
765
+ box-sizing: content-box;
766
+ }
767
+
768
+ .minicolors-picker {
769
+ position: absolute;
770
+ top: 0;
771
+ left: 0;
772
+ width: 18px;
773
+ height: 2px;
774
+ background: white;
775
+ border: solid 1px black;
776
+ margin-top: -2px;
777
+ box-sizing: content-box;
778
+ }
779
+
780
+ /* Swatches */
781
+ .minicolors-swatches,
782
+ .minicolors-swatches li {
783
+ margin: 5px 0 3px 5px;
784
+ padding: 0;
785
+ list-style: none;
786
+ overflow: hidden;
787
+ }
788
+
789
+ .minicolors-swatches .minicolors-swatch {
790
+ position: relative;
791
+ float: left;
792
+ cursor: pointer;
793
+ margin:0 4px 0 0;
794
+ }
795
+
796
+ .minicolors-with-opacity .minicolors-swatches .minicolors-swatch {
797
+ margin-right: 7px;
798
+ }
799
+
800
+ .minicolors-swatch.selected {
801
+ border-color: #000;
802
+ }
803
+
804
+ .minicolors-inline {
805
+ display: inline-block;
806
+ }
807
+
808
+ .minicolors-inline .minicolors-input {
809
+ display: none !important;
810
+ }
811
+
812
+ .minicolors-inline .minicolors-panel {
813
+ position: relative;
814
+ top: auto;
815
+ left: auto;
816
+ box-shadow: none;
817
+ z-index: auto;
818
+ display: inline-block;
819
+ }
820
+
821
+ .minicolors-theme-default .minicolors-swatch {
822
+ top: 5px;
823
+ left: 5px;
824
+ width: 18px;
825
+ height: 18px;
826
+ }
827
+
828
+ .minicolors-theme-default .minicolors-swatches .minicolors-swatch {
829
+ margin-bottom: 2px;
830
+ top: 0;
831
+ left: 0;
832
+ width: 18px;
833
+ height: 18px;
834
+ }
835
+
836
+ .minicolors-theme-default.minicolors-position-right .minicolors-swatch {
837
+ left: auto;
838
+ right: 5px;
839
+ }
840
+
841
+ .minicolors-theme-default.minicolors {
842
+ width: auto;
843
+ display: inline-block;
844
+ }
845
+
846
+ .minicolors-theme-default .minicolors-input {
847
+ height: 20px;
848
+ width: auto;
849
+ display: inline-block;
850
+ padding-left: 26px;
851
+ }
852
+
853
+ .minicolors-theme-default.minicolors-position-right .minicolors-input {
854
+ padding-right: 26px;
855
+ padding-left: inherit;
856
+ }
857
+
858
+ .minicolors-theme-bootstrap .minicolors-swatch {
859
+ z-index: 2;
860
+ top: 3px;
861
+ left: 3px;
862
+ width: 28px;
863
+ height: 28px;
864
+ border-radius: 3px;
865
+ }
866
+
867
+ .minicolors-theme-bootstrap .minicolors-swatches .minicolors-swatch {
868
+ margin-bottom: 2px;
869
+ top: 0;
870
+ left: 0;
871
+ width: 20px;
872
+ height: 20px;
873
+ }
874
+
875
+ .minicolors-theme-bootstrap .minicolors-swatch-color {
876
+ border-radius: inherit;
877
+ }
878
+
879
+ .minicolors-theme-bootstrap.minicolors-position-right > .minicolors-swatch {
880
+ left: auto;
881
+ right: 3px;
882
+ }
883
+
884
+ .minicolors-theme-bootstrap .minicolors-input {
885
+ float: none;
886
+ padding-left: 44px;
887
+ }
888
+
889
+ .minicolors-theme-bootstrap.minicolors-position-right .minicolors-input {
890
+ padding-right: 44px;
891
+ padding-left: 12px;
892
+ }
893
+
894
+ .minicolors-theme-bootstrap .minicolors-input.input-lg + .minicolors-swatch {
895
+ top: 4px;
896
+ left: 4px;
897
+ width: 37px;
898
+ height: 37px;
899
+ border-radius: 5px;
900
+ }
901
+
902
+ .minicolors-theme-bootstrap .minicolors-input.input-sm + .minicolors-swatch {
903
+ width: 24px;
904
+ height: 24px;
905
+ }
906
+
907
+ .minicolors-theme-bootstrap .minicolors-input.input-xs + .minicolors-swatch {
908
+ width: 18px;
909
+ height: 18px;
910
+ }
911
+
912
+ .input-group .minicolors-theme-bootstrap:not(:first-child) .minicolors-input {
913
+ border-top-left-radius: 0;
914
+ border-bottom-left-radius: 0;
915
+ }
916
+
917
+ .minicolors-theme-semanticui .minicolors-swatch {
918
+ top: 0;
919
+ left: 0;
920
+ padding: 18px;
921
+ }
922
+
923
+ .minicolors-theme-semanticui input {
924
+ text-indent: 30px;
925
+ }
926
+ /* End Minicolors */
927
+
928
+ @media only screen and (max-width: 1200px) {
929
+ #quick_adsense_bottom_left_section_wrapper {
930
+ float: none;
931
+ width: 100%;
932
+ margin: 0 0 30px;
933
+ max-width: 100%;
934
+ }
935
+
936
+ #quick_adsense_bottom_right_section_wrapper {
937
+ float: none;
938
+ width: 100%;
939
+ margin: 0 0 30px;
940
+ max-width: 100%;
941
+ }
942
+
943
+ #quick_adsense_onpost_content_adunits_wrapper a.button-secondary,
944
+ #quick_adsense_widget_adunits_wrapper a.button-secondary {
945
+ position: relative;
946
+ }
947
+ }
948
+
949
+ @media only screen and (max-width: 768px) {
950
+ #quick_adsense_bottom_sections_wrapper p.quick_adsense_onpost_adunits_styling_controls wbr {
951
+ display: block;
952
+ margin-top: 10px;
953
+ }
954
+
955
+ #quick_adsense_bottom_sections_wrapper p.quick_adsense_onpost_adunits_styling_controls select {
956
+ width: 240px !important;
957
+ display: inline-block;
958
+ }
959
+
960
+ #quick_adsense_bottom_sections_wrapper p.quick_adsense_onpost_adunits_styling_controls input[type="number"] {
961
+ width: 240px !important;
962
+ margin-left: 27px !important;
963
+ display: inline-block;
964
+ }
965
+
966
+ #quick_adsense_onpost_content_adunits_wrapper a.button-secondary,
967
+ #quick_adsense_widget_adunits_wrapper a.button-secondary {
968
+ margin-left: 0;
969
+ }
970
+ }
includes/defaults.php ADDED
@@ -0,0 +1,196 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ add_action('init', 'quick_adsense_defaults_init');
3
+ function quick_adsense_defaults_init() {
4
+ $settings = get_option('quick_adsense_settings');
5
+ if(isset($settings) && is_array($settings)) { // Existing 2.1 User
6
+ return;
7
+ } else { // New User OR V2.0 User OR V1.X User
8
+ $quickAdsense2 = get_option('quick_adsense_2_settings');
9
+ if(isset($quickAdsense2) && is_array($quickAdsense2) && (count($quickAdsense2) > 1)) { // V2.0 User
10
+ $settings = quick_adsense_get_defaults();
11
+ if(isset($quickAdsense2['AdsDisp']) && ($quickAdsense2['AdsDisp'] != '')) { $settings['max_ads_per_page'] = $quickAdsense2['AdsDisp']; }
12
+
13
+ if(isset($quickAdsense2['BegnAds']) && ($quickAdsense2['BegnAds'] != '')) { $settings['enable_position_beginning_of_post'] = $quickAdsense2['BegnAds']; }
14
+ if(isset($quickAdsense2['BegnRnd']) && ($quickAdsense2['BegnRnd'] != '')) { $settings['ad_beginning_of_post'] = $quickAdsense2['BegnRnd']; }
15
+ if(isset($quickAdsense2['MiddAds']) && ($quickAdsense2['MiddAds'] != '')) { $settings['enable_position_middle_of_post'] = $quickAdsense2['MiddAds']; }
16
+ if(isset($quickAdsense2['MiddRnd']) && ($quickAdsense2['MiddRnd'] != '')) { $settings['ad_middle_of_post'] = $quickAdsense2['MiddRnd']; }
17
+ if(isset($quickAdsense2['EndiAds']) && ($quickAdsense2['EndiAds'] != '')) { $settings['enable_position_end_of_post'] = $quickAdsense2['EndiAds']; }
18
+ if(isset($quickAdsense2['EndiRnd']) && ($quickAdsense2['EndiRnd'] != '')) { $settings['ad_end_of_post'] = $quickAdsense2['EndiRnd']; }
19
+
20
+ if(isset($quickAdsense2['MoreAds']) && ($quickAdsense2['MoreAds'] != '')) { $settings['enable_position_after_more_tag'] = $quickAdsense2['MoreAds']; }
21
+ if(isset($quickAdsense2['MoreRnd']) && ($quickAdsense2['MoreRnd'] != '')) { $settings['ad_after_more_tag'] = $quickAdsense2['MoreRnd']; }
22
+ if(isset($quickAdsense2['LapaAds']) && ($quickAdsense2['LapaAds'] != '')) { $settings['enable_position_before_last_para'] = $quickAdsense2['LapaAds']; }
23
+ if(isset($quickAdsense2['LapaRnd']) && ($quickAdsense2['LapaRnd'] != '')) { $settings['ad_before_last_para'] = $quickAdsense2['LapaRnd']; }
24
+
25
+ for($i = 1; $i <= 3; $i++) {
26
+ if(isset($quickAdsense2['Par'.$i.'Ads']) && ($quickAdsense2['Par'.$i.'Ads'] != '')) { $settings['enable_position_after_para_option_'.$i] = $quickAdsense2['Par'.$i.'Ads']; }
27
+ if(isset($quickAdsense2['Par'.$i.'Rnd']) && ($quickAdsense2['Par'.$i.'Rnd'] != '')) { $settings['ad_after_para_option_'.$i] = $quickAdsense2['Par'.$i.'Rnd']; }
28
+ if(isset($quickAdsense2['Par'.$i.'Nup']) && ($quickAdsense2['Par'.$i.'Nup'] != '')) { $settings['position_after_para_option_'.$i] = $quickAdsense2['Par'.$i.'Nup']; }
29
+ if(isset($quickAdsense2['Par'.$i.'Con']) && ($quickAdsense2['Par'.$i.'Con'] != '')) { $settings['enable_jump_position_after_para_option_'.$i] = $quickAdsense2['Par'.$i.'Con']; }
30
+ }
31
+
32
+ for($i = 1; $i <= 1; $i++) {
33
+ if(isset($quickAdsense2['Img'.$i.'Ads']) && ($quickAdsense2['Img'.$i.'Ads'] != '')) { $settings['enable_position_after_image_option_'.$i] = $quickAdsense2['Img'.$i.'Ads']; }
34
+ if(isset($quickAdsense2['Img'.$i.'Rnd']) && ($quickAdsense2['Img'.$i.'Rnd'] != '')) { $settings['ad_after_image_option_'.$i] = $quickAdsense2['Img'.$i.'Rnd']; }
35
+ if(isset($quickAdsense2['Img'.$i.'Nup']) && ($quickAdsense2['Img'.$i.'Nup'] != '')) { $settings['position_after_image_option_'.$i] = $quickAdsense2['Img'.$i.'Nup']; }
36
+ if(isset($quickAdsense2['Img'.$i.'Con']) && ($quickAdsense2['Img'.$i.'Con'] != '')) { $settings['enable_jump_position_after_image_option_'.$i] = $quickAdsense2['Img'.$i.'Con']; }
37
+ }
38
+
39
+ if(isset($quickAdsense2['AppPost']) && ($quickAdsense2['AppPost'] != '')) { $settings['enable_on_posts'] = $quickAdsense2['AppPost']; }
40
+ if(isset($quickAdsense2['AppPage']) && ($quickAdsense2['AppPage'] != '')) { $settings['enable_on_pages'] = $quickAdsense2['AppPage']; }
41
+
42
+ if(isset($quickAdsense2['AppHome']) && ($quickAdsense2['AppHome'] != '')) { $settings['enable_on_homepage'] = $quickAdsense2['AppHome']; }
43
+ if(isset($quickAdsense2['AppCate']) && ($quickAdsense2['AppCate'] != '')) { $settings['enable_on_categories'] = $quickAdsense2['AppCate']; }
44
+ if(isset($quickAdsense2['AppArch']) && ($quickAdsense2['AppArch'] != '')) { $settings['enable_on_archives'] = $quickAdsense2['AppArch']; }
45
+ if(isset($quickAdsense2['AppTags']) && ($quickAdsense2['AppTags'] != '')) { $settings['enable_on_tags'] = $quickAdsense2['AppTags']; }
46
+ if(isset($quickAdsense2['AppMaxA']) && ($quickAdsense2['AppMaxA'] != '')) { $settings['enable_all_possible_ads'] = $quickAdsense2['AppMaxA']; }
47
+
48
+ if(isset($quickAdsense2['AppSide']) && ($quickAdsense2['AppSide'] != '')) { $settings['disable_widgets_on_homepage'] = $quickAdsense2['AppSide']; }
49
+
50
+ if(isset($quickAdsense2['AppLogg']) && ($quickAdsense2['AppLogg'] != '')) { $settings['disable_for_loggedin_users'] = $quickAdsense2['AppLogg']; }
51
+
52
+ if(isset($quickAdsense2['QckTags']) && ($quickAdsense2['QckTags'] != '')) { $settings['enable_quicktag_buttons'] = $quickAdsense2['QckTags']; }
53
+ if(isset($quickAdsense2['QckRnds']) && ($quickAdsense2['QckRnds'] != '')) { $settings['disable_randomads_quicktag_button'] = $quickAdsense2['QckRnds']; }
54
+ if(isset($quickAdsense2['QckOffs']) && ($quickAdsense2['QckOffs'] != '')) { $settings['disable_disablead_quicktag_buttons'] = $quickAdsense2['QckOffs']; }
55
+ if(isset($quickAdsense2['QckOfPs']) && ($quickAdsense2['QckOfPs'] != '')) { $settings['disable_positionad_quicktag_buttons'] = $quickAdsense2['QckOfPs']; }
56
+
57
+ for($i = 1; $i <= 10; $i++) {
58
+ if(isset($quickAdsense2['AdsCode'.$i]) && ($quickAdsense2['AdsCode'.$i] != '')) { $settings['onpost_ad_'.$i.'_content'] = $quickAdsense2['AdsCode'.$i]; }
59
+ if(isset($quickAdsense2['AdsAlign'.$i]) && ($quickAdsense2['AdsAlign'.$i] != '')) { $settings['onpost_ad_'.$i.'_alignment'] = $quickAdsense2['AdsAlign'.$i]; }
60
+ if(isset($quickAdsense2['AdsMargin'.$i]) && ($quickAdsense2['AdsMargin'.$i] != '')) { $settings['onpost_ad_'.$i.'_margin'] = $quickAdsense2['AdsMargin'.$i]; }
61
+
62
+ if(isset($quickAdsense2['WidCode'.$i]) && ($quickAdsense2['WidCode'.$i] != '')) { $settings['widget_ad_'.$i.'_content'] = $quickAdsense2['WidCode'.$i]; }
63
+ }
64
+ update_option('quick_adsense_settings', $settings);
65
+ update_option('quick_adsense_2_settings_bak', $quickAdsense2);
66
+ delete_option('quick_adsense_2_settings');
67
+ } else { // New User OR V1.X User
68
+ $quickAdsense1AdsDisp = get_option('AdsDisp');
69
+ if(isset($quickAdsense1AdsDisp) && in_array($quickAdsense1AdsDisp, array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10'))) { // V1.X User
70
+ $settings = quick_adsense_get_defaults();
71
+ $temp = get_option('AdsDisp'); if(isset($temp) && ($temp != '')) { $settings['max_ads_per_page'] = $temp; }
72
+
73
+ $temp = get_option('BegnAds'); if(isset($temp) && ($temp != '')) { $settings['enable_position_beginning_of_post'] = $temp; }
74
+ $temp = get_option('BegnRnd'); if(isset($temp) && ($temp != '')) { $settings['ad_beginning_of_post'] = $temp; }
75
+ $temp = get_option('MiddAds'); if(isset($temp) && ($temp != '')) { $settings['enable_position_middle_of_post'] = $temp; }
76
+ $temp = get_option('MiddRnd'); if(isset($temp) && ($temp != '')) { $settings['ad_middle_of_post'] = $temp; }
77
+ $temp = get_option('EndiAds'); if(isset($temp) && ($temp != '')) { $settings['enable_position_end_of_post'] = $temp; }
78
+ $temp = get_option('EndiRnd'); if(isset($temp) && ($temp != '')) { $settings['ad_end_of_post'] = $temp; }
79
+
80
+ $temp = get_option('MoreAds'); if(isset($temp) && ($temp != '')) { $settings['enable_position_after_more_tag'] = $temp; }
81
+ $temp = get_option('MoreRnd'); if(isset($temp) && ($temp != '')) { $settings['ad_after_more_tag'] = $temp; }
82
+ $temp = get_option('LapaAds'); if(isset($temp) && ($temp != '')) { $settings['enable_position_before_last_para'] = $temp; }
83
+ $temp = get_option('LapaRnd'); if(isset($temp) && ($temp != '')) { $settings['ad_before_last_para'] = $temp; }
84
+
85
+ for($i = 1; $i <= 3; $i++) {
86
+ $temp = get_option('Par'.$i.'Ads'); if(isset($temp) && ($temp != '')) { $settings['enable_position_after_para_option_'.$i] = $temp; }
87
+ $temp = get_option('Par'.$i.'Rnd'); if(isset($temp) && ($temp != '')) { $settings['ad_after_para_option_'.$i] = $temp; }
88
+ $temp = get_option('Par'.$i.'Nup'); if(isset($temp) && ($temp != '')) { $settings['position_after_para_option_'.$i] = $temp; }
89
+ $temp = get_option('Par'.$i.'Con'); if(isset($temp) && ($temp != '')) { $settings['enable_jump_position_after_para_option_'.$i] = $temp; }
90
+ }
91
+
92
+ for($i = 1; $i <= 1; $i++) {
93
+ $temp = get_option('Img'.$i.'Ads'); if(isset($temp) && ($temp != '')) { $settings['enable_position_after_image_option_'.$i] = $temp; }
94
+ $temp = get_option('Img'.$i.'Rnd'); if(isset($temp) && ($temp != '')) { $settings['ad_after_image_option_'.$i] = $temp; }
95
+ $temp = get_option('Img'.$i.'Nup'); if(isset($temp) && ($temp != '')) { $settings['position_after_image_option_'.$i] = $temp; }
96
+ $temp = get_option('Img'.$i.'Con'); if(isset($temp) && ($temp != '')) { $settings['enable_jump_position_after_image_option_'.$i] = $temp; }
97
+ }
98
+
99
+ $temp = get_option('AppPost'); if(isset($temp) && ($temp != '')) { $settings['enable_on_posts'] = $temp; }
100
+ $temp = get_option('AppPage'); if(isset($temp) && ($temp != '')) { $settings['enable_on_pages'] = $temp; }
101
+
102
+ $temp = get_option('AppHome'); if(isset($temp) && ($temp != '')) { $settings['enable_on_homepage'] = $temp; }
103
+ $temp = get_option('AppCate'); if(isset($temp) && ($temp != '')) { $settings['enable_on_categories'] = $temp; }
104
+ $temp = get_option('AppArch'); if(isset($temp) && ($temp != '')) { $settings['enable_on_archives'] = $temp; }
105
+ $temp = get_option('AppTags'); if(isset($temp) && ($temp != '')) { $settings['enable_on_tags'] = $temp; }
106
+ $temp = get_option('AppMaxA'); if(isset($temp) && ($temp != '')) { $settings['enable_all_possible_ads'] = $temp; }
107
+
108
+ $temp = get_option('AppSide'); if(isset($temp) && ($temp != '')) { $settings['disable_widgets_on_homepage'] = $temp; }
109
+
110
+ $temp = get_option('AppLogg'); if(isset($temp) && ($temp != '')) { $settings['disable_for_loggedin_users'] = $temp; }
111
+
112
+ $temp = get_option('QckTags'); if(isset($temp) && ($temp != '')) { $settings['enable_quicktag_buttons'] = $temp; }
113
+ $temp = get_option('QckRnds'); if(isset($temp) && ($temp != '')) { $settings['disable_randomads_quicktag_button'] = $temp; }
114
+ $temp = get_option('QckOffs'); if(isset($temp) && ($temp != '')) { $settings['disable_disablead_quicktag_buttons'] = $temp; }
115
+ $temp = get_option('QckOfPs'); if(isset($temp) && ($temp != '')) { $settings['disable_positionad_quicktag_buttons'] = $temp; }
116
+
117
+ for($i = 1; $i <= 10; $i++) {
118
+ $temp = get_option('AdsCode'.$i); if(isset($temp)) { $settings['onpost_ad_'.$i.'_content'] = $temp; }
119
+ $temp = get_option('AdsAlign'.$i); if(isset($temp) && ($temp != '')) { $settings['onpost_ad_'.$i.'_alignment'] = $temp; }
120
+ $temp = get_option('AdsMargin'.$i); if(isset($temp) && ($temp != '')) { $settings['onpost_ad_'.$i.'_margin'] = $temp; }
121
+
122
+ $temp = get_option('WidCode'.$i); if(isset($temp)) { $settings['widget_ad_'.$i.'_content'] = $temp; }
123
+ }
124
+
125
+ update_option('quick_adsense_settings', $settings);
126
+ delete_option('AdsDisp');
127
+ } else { // New User
128
+ update_option('quick_adsense_settings', quick_adsense_get_defaults());
129
+ }
130
+ }
131
+ }
132
+ }
133
+
134
+ function quick_adsense_get_defaults() {
135
+ $settings = array();
136
+
137
+ $settings['max_ads_per_page'] = '3';
138
+
139
+ $settings['enable_position_beginning_of_post'] = '1';
140
+ $settings['ad_beginning_of_post'] = '1';
141
+ $settings['enable_position_middle_of_post'] = '0';
142
+ $settings['ad_middle_of_post'] = '0';
143
+ $settings['enable_position_end_of_post'] = '1';
144
+ $settings['ad_end_of_post'] = '0';
145
+
146
+ $settings['enable_position_after_more_tag'] = '0';
147
+ $settings['ad_after_more_tag'] = '0';
148
+ $settings['enable_position_before_last_para'] = '0';
149
+ $settings['ad_before_last_para'] = '0';
150
+
151
+ for($i = 1; $i <= 3; $i++) {
152
+ $settings['enable_position_after_para_option_'.$i] = '0';
153
+ $settings['ad_after_para_option_'.$i] = '0';
154
+ $settings['position_after_para_option_'.$i] = '1';
155
+ $settings['enable_jump_position_after_para_option_'.$i] = '0';
156
+ }
157
+
158
+ for($i = 1; $i <= 1; $i++) {
159
+ $settings['enable_position_after_image_option_'.$i] = '0';
160
+ $settings['ad_after_image_option_'.$i] = '0';
161
+ $settings['position_after_image_option_'.$i] = '1';
162
+ $settings['enable_jump_position_after_image_option_'.$i] = '0';
163
+ }
164
+
165
+ $settings['enable_on_posts'] = '1';
166
+ $settings['enable_on_pages'] = '1';
167
+
168
+ $settings['enable_on_homepage'] = '0';
169
+ $settings['enable_on_categories'] = '0';
170
+ $settings['enable_on_archives'] = '0';
171
+ $settings['enable_on_tags'] = '0';
172
+ $settings['enable_all_possible_ads'] = '0';
173
+
174
+ $settings['disable_widgets_on_homepage'] = '0';
175
+
176
+ $settings['disable_for_loggedin_users'] = '0';
177
+
178
+ $settings['enable_quicktag_buttons'] = '1';
179
+ $settings['disable_randomads_quicktag_button'] = '0';
180
+ $settings['disable_disablead_quicktag_buttons'] = '0';
181
+ $settings['disable_positionad_quicktag_buttons'] = '0';
182
+
183
+ $settings['onpost_enable_global_style'] = '0';
184
+ $settings['onpost_global_alignment'] = '2';
185
+ $settings['onpost_global_margin'] = '10';
186
+
187
+ for($i = 1; $i <= 10; $i++) {
188
+ $settings['onpost_ad_'.$i.'_content'] = '';
189
+ $settings['onpost_ad_'.$i.'_alignment'] = '2';
190
+ $settings['onpost_ad_'.$i.'_margin'] = '10';
191
+
192
+ $settings['widget_ad_'.$i.'_content'] = '';
193
+ }
194
+ return $settings;
195
+ }
196
+ ?>
includes/images/advertisement-preview.png ADDED
Binary file
includes/images/ajax-loader-flat.gif ADDED
Binary file
includes/images/ajax-loader.gif ADDED
Binary file
includes/images/jquery.minicolors.png ADDED
Binary file
includes/images/vi-big-logo.png ADDED
Binary file
includes/images/vi-empty-graph.jpg ADDED
Binary file
includes/images/vi-logo-large.png ADDED
Binary file
includes/images/vi-logo-small.png ADDED
Binary file
includes/images/vi-logo-square.png ADDED
Binary file
includes/images/vi-no-data.jpg ADDED
Binary file
includes/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)});
includes/js/admin.js ADDED
@@ -0,0 +1,1004 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function() {
2
+ jQuery('#quick_adsense_settings_reset_to_default').click(quick_adsense_settings_reset_to_default);
3
+
4
+ jQuery('#quick_adsense_settings_enable_position_beginning_of_post').click(quick_adsense_settings_enable_position_beginning_of_post);
5
+ jQuery('#quick_adsense_settings_enable_position_middle_of_post').click(quick_adsense_settings_enable_position_middle_of_post);
6
+ jQuery('#quick_adsense_settings_enable_position_end_of_post').click(quick_adsense_settings_enable_position_end_of_post);
7
+ jQuery('#quick_adsense_settings_enable_position_after_more_tag').click(quick_adsense_settings_enable_position_after_more_tag);
8
+ jQuery('#quick_adsense_settings_enable_position_before_last_para').click(quick_adsense_settings_enable_position_before_last_para);
9
+ jQuery('#quick_adsense_settings_enable_position_after_para_option_1').click(quick_adsense_settings_enable_position_after_para_option_1);
10
+ jQuery('#quick_adsense_settings_enable_position_after_para_option_2').click(quick_adsense_settings_enable_position_after_para_option_2);
11
+ jQuery('#quick_adsense_settings_enable_position_after_para_option_3').click(quick_adsense_settings_enable_position_after_para_option_3);
12
+ jQuery('#quick_adsense_settings_enable_position_after_image_option_1').click(quick_adsense_settings_enable_position_after_image_option_1);
13
+ jQuery('#quick_adsense_settings_enable_on_posts').click(quick_adsense_settings_enable_on_posts);
14
+ jQuery('#quick_adsense_settings_enable_on_pages').click(quick_adsense_settings_enable_on_pages);
15
+ jQuery('#quick_adsense_settings_enable_on_homepage').click(quick_adsense_settings_enable_on_homepage);
16
+ jQuery('#quick_adsense_settings_enable_on_categories').click(quick_adsense_settings_enable_on_categories);
17
+ jQuery('#quick_adsense_settings_enable_on_archives').click(quick_adsense_settings_enable_on_archives);
18
+ jQuery('#quick_adsense_settings_enable_on_tags').click(quick_adsense_settings_enable_on_tags);
19
+ jQuery('#quick_adsense_settings_enable_all_possible_ads').click(quick_adsense_settings_enable_all_possible_ads);
20
+ jQuery('#quick_adsense_settings_disable_widgets_on_homepage').click(quick_adsense_settings_disable_widgets_on_homepage);
21
+ jQuery('#quick_adsense_settings_disable_for_loggedin_users').click(quick_adsense_settings_disable_for_loggedin_users);
22
+ jQuery('#quick_adsense_settings_enable_quicktag_buttons').click(quick_adsense_settings_enable_quicktag_buttons);
23
+ jQuery('#quick_adsense_settings_disable_randomads_quicktag_button').click(quick_adsense_settings_disable_randomads_quicktag_button);
24
+ jQuery('#quick_adsense_settings_disable_disablead_quicktag_buttons').click(quick_adsense_settings_disable_disablead_quicktag_buttons);
25
+ jQuery('#quick_adsense_settings_disable_positionad_quicktag_buttons').click(quick_adsense_settings_disable_positionad_quicktag_buttons);
26
+
27
+ jQuery('#quick_adsense_settings_onpost_enable_global_style').click(quick_adsense_settings_onpost_enable_global_style);
28
+ jQuery('#quick_adsense_settings_onpost_global_alignment').click(quick_adsense_settings_onpost_enable_global_style);
29
+ jQuery('#quick_adsense_settings_onpost_global_margin').click(quick_adsense_settings_onpost_enable_global_style);
30
+
31
+ jQuery('#quick_adsense_settings_ad_beginning_of_post').change(function() {
32
+ quick_adsense_vi_check_status(this);
33
+ quick_adsense_settings_handle_vi_single_selection();
34
+ });
35
+
36
+ jQuery('#quick_adsense_settings_ad_middle_of_post').change(function() {
37
+ quick_adsense_vi_check_status(this);
38
+ quick_adsense_settings_handle_vi_single_selection();
39
+ });
40
+
41
+ quick_adsense_settings_enable_position_beginning_of_post();
42
+ quick_adsense_settings_enable_position_middle_of_post();
43
+ quick_adsense_settings_enable_position_end_of_post();
44
+ quick_adsense_settings_enable_position_after_more_tag();
45
+ quick_adsense_settings_enable_position_before_last_para();
46
+ quick_adsense_settings_enable_position_after_para_option_1();
47
+ quick_adsense_settings_enable_position_after_para_option_2();
48
+ quick_adsense_settings_enable_position_after_para_option_3();
49
+ quick_adsense_settings_enable_position_after_image_option_1();
50
+ quick_adsense_settings_enable_on_posts();
51
+ quick_adsense_settings_enable_on_pages();
52
+ quick_adsense_settings_enable_on_homepage();
53
+ quick_adsense_settings_enable_on_categories();
54
+ quick_adsense_settings_enable_on_archives();
55
+ quick_adsense_settings_enable_on_tags();
56
+ quick_adsense_settings_enable_all_possible_ads();
57
+ quick_adsense_settings_disable_widgets_on_homepage();
58
+ quick_adsense_settings_disable_for_loggedin_users();
59
+ quick_adsense_settings_enable_quicktag_buttons();
60
+ quick_adsense_settings_disable_randomads_quicktag_button();
61
+ quick_adsense_settings_disable_disablead_quicktag_buttons();
62
+ quick_adsense_settings_disable_positionad_quicktag_buttons();
63
+ quick_adsense_settings_onpost_enable_global_style();
64
+ quick_adsense_settings_handle_vi_single_selection();
65
+
66
+ jQuery('#quick_adsense_onpost_content_adunits_showall_button').click(function() {
67
+ if(jQuery('#quick_adsense_onpost_content_adunits_showall_button').text() == ' Show All') {
68
+ jQuery('#quick_adsense_onpost_content_adunits_all_wrapper').slideDown();
69
+ jQuery('#quick_adsense_onpost_content_adunits_showall_button').html('<span class="dashicons dashicons-arrow-up"></span> <b>Show Less</b>');
70
+ } else {
71
+ jQuery('#quick_adsense_onpost_content_adunits_all_wrapper').slideUp();
72
+ jQuery('#quick_adsense_onpost_content_adunits_showall_button').html('<span class="dashicons dashicons-arrow-down"></span> <b>Show All</b>');
73
+ }
74
+ });
75
+
76
+ jQuery('#quick_adsense_widget_adunits_showall_button').click(function() {
77
+ if(jQuery('#quick_adsense_widget_adunits_showall_button').text() == ' Show All') {
78
+ jQuery('#quick_adsense_widget_adunits_all_wrapper').slideDown();
79
+ jQuery('#quick_adsense_widget_adunits_showall_button').html('<span class="dashicons dashicons-arrow-up"></span> <b>Show Less</b>');
80
+ } else {
81
+ jQuery('#quick_adsense_widget_adunits_all_wrapper').slideUp();
82
+ jQuery('#quick_adsense_widget_adunits_showall_button').html('<span class="dashicons dashicons-arrow-down"></span> <b>Show All</b>');
83
+ }
84
+ });
85
+
86
+ jQuery('#quick_adsense_settings_form').submit(function() {
87
+ jQuery('#quick_adsense_settings_form select').each(function() {
88
+ if(jQuery(this).prop('disabled') == true) {
89
+ jQuery(this).prop('disabled', false);
90
+ }
91
+ });
92
+ });
93
+
94
+ jQuery('#quick_adsense_settings_form').fadeIn();
95
+ if(window.location.href.indexOf('#quick_adsense_adstxt_adsense_auto_update') > -1) {
96
+ quick_adsense_adstxt_adsense_auto_update();
97
+ }
98
+ });
99
+
100
+ function quick_adsense_adstxt_adsense_auto_update() {
101
+ jQuery.post(
102
+ jQuery('#quick_adsense_adstxt_adsense_admin_notice_ajax').val(), {
103
+ 'action': 'quick_adsense_adstxt_adsense_auto_update',
104
+ 'quick_adsense_adstxt_adsense_admin_notice_nonce': jQuery('#quick_adsense_adstxt_adsense_admin_notice_nonce').val(),
105
+ }, function(response) {
106
+ if(response != '###SUCCESS###') {
107
+ jQuery(response).dialog({
108
+ 'modal': true,
109
+ 'resizable': false,
110
+ 'title': 'Ads.txt Auto Updation Failed',
111
+ 'width': jQuery("body").width() * 0.5,
112
+ 'maxWidth': jQuery("body").width() * 0.5,
113
+ 'maxHeight': jQuery("body").height() * 0.9,
114
+ position: { my: 'center', at: 'center', of: window },
115
+ open: function (event, ui) {
116
+ jQuery('.ui-dialog').css({'z-index': 999999, 'max-width': '90%'});
117
+ jQuery('.ui-widget-overlay').css({'z-index': 999998, 'opacity': 0.8, 'background': '#000000'});
118
+ },
119
+ buttons : {
120
+ 'Cancel': function() {
121
+ jQuery(this).dialog("close");
122
+ }
123
+ },
124
+ close: function() {
125
+ jQuery(this).dialog('destroy');
126
+ }
127
+ });
128
+ } else {
129
+ jQuery('.quick_adsense_adstxt_adsense_notice').hide();
130
+ }
131
+ }
132
+ );
133
+ }
134
+
135
+ function quick_adsense_settings_reset_to_default() {
136
+ jQuery('#quick_adsense_settings_max_ads_per_page').val('3');
137
+
138
+ jQuery('#quick_adsense_settings_enable_position_beginning_of_post').prop('checked', true);
139
+ jQuery('#quick_adsense_settings_ad_beginning_of_post').val('1');
140
+ jQuery('#quick_adsense_settings_enable_position_middle_of_post').prop('checked', false);
141
+ jQuery('#quick_adsense_settings_ad_middle_of_post').val('0');
142
+ jQuery('#quick_adsense_settings_enable_position_end_of_post').prop('checked', true);
143
+ jQuery('#quick_adsense_settings_ad_end_of_post').val('0');
144
+
145
+ jQuery('#quick_adsense_settings_enable_position_after_more_tag').prop('checked', false);
146
+ jQuery('#quick_adsense_settings_ad_after_more_tag').val('0');
147
+ jQuery('#quick_adsense_settings_enable_position_before_last_para').prop('checked', false);
148
+ jQuery('#quick_adsense_settings_ad_before_last_para').val('0');
149
+
150
+ for(var i = 1; i <= 3; i++) {
151
+ jQuery('#quick_adsense_settings_enable_position_after_para_option_'+i).prop('checked', false);
152
+ jQuery('#quick_adsense_settings_ad_after_para_option_'+i).val('0');
153
+ jQuery('#quick_adsense_settings_position_after_para_option_'+i).val('1');
154
+ jQuery('#quick_adsense_settings_enable_jump_position_after_para_option_'+i).prop('checked', false);
155
+ }
156
+
157
+ for(var i = 1; i <= 1; i++) {
158
+ jQuery('#quick_adsense_settings_enable_position_after_image_option_'+i).prop('checked', false);
159
+ jQuery('#quick_adsense_settings_ad_after_image_option_'+i).val('0');
160
+ jQuery('#quick_adsense_settings_position_after_image_option_'+i).val('1');
161
+ jQuery('#quick_adsense_settings_enable_jump_position_after_image_option_'+i).prop('checked', false);
162
+ }
163
+
164
+ jQuery('#quick_adsense_settings_enable_on_posts').prop('checked', true);
165
+ jQuery('#quick_adsense_settings_enable_on_pages').prop('checked', true);
166
+
167
+ jQuery('#quick_adsense_settings_enable_on_homepage').prop('checked', false);
168
+ jQuery('#quick_adsense_settings_enable_on_categories').prop('checked', false);
169
+ jQuery('#quick_adsense_settings_enable_on_archives').prop('checked', false);
170
+ jQuery('#quick_adsense_settings_enable_on_tags').prop('checked', false);
171
+ jQuery('#quick_adsense_settings_enable_all_possible_ads').prop('checked', false);
172
+
173
+ jQuery('#quick_adsense_settings_disable_widgets_on_homepage').prop('checked', false);
174
+
175
+ jQuery('#quick_adsense_settings_disable_for_loggedin_users').prop('checked', false);
176
+
177
+ jQuery('#quick_adsense_settings_enable_quicktag_buttons').prop('checked', true);
178
+ jQuery('#quick_adsense_settings_disable_randomads_quicktag_button').prop('checked', false);
179
+ jQuery('#quick_adsense_settings_disable_disablead_quicktag_buttons').prop('checked', false);
180
+ jQuery('#quick_adsense_settings_disable_positionad_quicktag_buttons').prop('checked', false);
181
+
182
+ jQuery('#quick_adsense_settings_onpost_enable_global_style').prop('checked', false);
183
+ jQuery('#quick_adsense_settings_onpost_global_alignment').val('2');
184
+ jQuery('#quick_adsense_settings_onpost_global_margin').val('10');
185
+
186
+ for(var i = 1; i <= 10; i++) {
187
+ jQuery('#quick_adsense_settings_onpost_ad_'+i+'_content').val('');
188
+ jQuery('#quick_adsense_settings_onpost_ad_'+i+'_alignment').val('2');
189
+ jQuery('#quick_adsense_settings_onpost_ad_'+i+'_margin').val('10');
190
+
191
+ jQuery('#quick_adsense_settings_widget_ad_'+i+'_content').val('');
192
+ }
193
+
194
+ quick_adsense_settings_enable_position_beginning_of_post();
195
+ quick_adsense_settings_enable_position_middle_of_post();
196
+ quick_adsense_settings_enable_position_end_of_post();
197
+ quick_adsense_settings_enable_position_after_more_tag();
198
+ quick_adsense_settings_enable_position_before_last_para();
199
+ quick_adsense_settings_enable_position_after_para_option_1();
200
+ quick_adsense_settings_enable_position_after_para_option_2();
201
+ quick_adsense_settings_enable_position_after_para_option_3();
202
+ quick_adsense_settings_enable_position_after_image_option_1();
203
+ quick_adsense_settings_enable_on_posts();
204
+ quick_adsense_settings_enable_on_pages();
205
+ quick_adsense_settings_enable_on_homepage();
206
+ quick_adsense_settings_enable_on_categories();
207
+ quick_adsense_settings_enable_on_archives();
208
+ quick_adsense_settings_enable_on_tags();
209
+ quick_adsense_settings_enable_all_possible_ads();
210
+ quick_adsense_settings_disable_widgets_on_homepage();
211
+ quick_adsense_settings_disable_for_loggedin_users();
212
+ quick_adsense_settings_enable_quicktag_buttons();
213
+ quick_adsense_settings_disable_randomads_quicktag_button();
214
+ quick_adsense_settings_disable_disablead_quicktag_buttons();
215
+ quick_adsense_settings_disable_positionad_quicktag_buttons();
216
+ quick_adsense_settings_onpost_enable_global_style();
217
+ quick_adsense_settings_handle_vi_single_selection();
218
+ }
219
+
220
+ function quick_adsense_settings_enable_position_beginning_of_post() {
221
+ if(jQuery('#quick_adsense_settings_enable_position_beginning_of_post').prop('checked') == true) {
222
+ jQuery('#quick_adsense_settings_ad_beginning_of_post').prop('disabled', false);
223
+ jQuery('#quick_adsense_settings_ad_beginning_of_post').parent().removeClass('disabled');
224
+ } else {
225
+ jQuery('#quick_adsense_settings_ad_beginning_of_post').prop('disabled', true);
226
+ jQuery('#quick_adsense_settings_ad_beginning_of_post').parent().addClass('disabled');
227
+ }
228
+ quick_adsense_settings_handle_vi_single_selection();
229
+ }
230
+
231
+ function quick_adsense_settings_enable_position_middle_of_post() {
232
+ if(jQuery('#quick_adsense_settings_enable_position_middle_of_post').prop('checked') == true) {
233
+ jQuery('#quick_adsense_settings_ad_middle_of_post').prop('disabled', false);
234
+ jQuery('#quick_adsense_settings_ad_middle_of_post').parent().removeClass('disabled');
235
+ } else {
236
+ jQuery('#quick_adsense_settings_ad_middle_of_post').prop('disabled', true);
237
+ jQuery('#quick_adsense_settings_ad_middle_of_post').parent().addClass('disabled');
238
+ }
239
+ quick_adsense_settings_handle_vi_single_selection();
240
+ }
241
+
242
+ function quick_adsense_settings_enable_position_end_of_post() {
243
+ if(jQuery('#quick_adsense_settings_enable_position_end_of_post').prop('checked') == true) {
244
+ jQuery('#quick_adsense_settings_ad_end_of_post').prop('disabled', false);
245
+ jQuery('#quick_adsense_settings_ad_end_of_post').parent().removeClass('disabled');
246
+ } else {
247
+ jQuery('#quick_adsense_settings_ad_end_of_post').prop('disabled', true);
248
+ jQuery('#quick_adsense_settings_ad_end_of_post').parent().addClass('disabled');
249
+ }
250
+ }
251
+
252
+ function quick_adsense_settings_enable_position_after_more_tag() {
253
+ if(jQuery('#quick_adsense_settings_enable_position_after_more_tag').prop('checked') == true) {
254
+ jQuery('#quick_adsense_settings_ad_after_more_tag').prop('disabled', false);
255
+ jQuery('#quick_adsense_settings_ad_after_more_tag').parent().removeClass('disabled');
256
+ } else {
257
+ jQuery('#quick_adsense_settings_ad_after_more_tag').prop('disabled', true);
258
+ jQuery('#quick_adsense_settings_ad_after_more_tag').parent().addClass('disabled');
259
+ }
260
+ }
261
+
262
+ function quick_adsense_settings_enable_position_before_last_para() {
263
+ if(jQuery('#quick_adsense_settings_enable_position_before_last_para').prop('checked') == true) {
264
+ jQuery('#quick_adsense_settings_ad_before_last_para').prop('disabled', false);
265
+ jQuery('#quick_adsense_settings_ad_before_last_para').parent().removeClass('disabled');
266
+ } else {
267
+ jQuery('#quick_adsense_settings_ad_before_last_para').prop('disabled', true);
268
+ jQuery('#quick_adsense_settings_ad_before_last_para').parent().addClass('disabled');
269
+ }
270
+ }
271
+
272
+ function quick_adsense_settings_enable_position_after_para_option_1() {
273
+ if(jQuery('#quick_adsense_settings_enable_position_after_para_option_1').prop('checked') == true) {
274
+ jQuery('#quick_adsense_settings_ad_after_para_option_1').prop('disabled', false);
275
+ jQuery('#quick_adsense_settings_position_after_para_option_1').prop('disabled', false);
276
+ jQuery('#quick_adsense_settings_enable_jump_position_after_para_option_1').prop('disabled', false);
277
+ jQuery('#quick_adsense_settings_ad_after_para_option_1').parent().removeClass('disabled');
278
+ } else {
279
+ jQuery('#quick_adsense_settings_ad_after_para_option_1').prop('disabled', true);
280
+ jQuery('#quick_adsense_settings_position_after_para_option_1').prop('disabled', true);
281
+ jQuery('#quick_adsense_settings_enable_jump_position_after_para_option_1').prop('disabled', true);
282
+ jQuery('#quick_adsense_settings_ad_after_para_option_1').parent().addClass('disabled');
283
+ }
284
+ }
285
+
286
+ function quick_adsense_settings_enable_position_after_para_option_2() {
287
+ if(jQuery('#quick_adsense_settings_enable_position_after_para_option_2').prop('checked') == true) {
288
+ jQuery('#quick_adsense_settings_ad_after_para_option_2').prop('disabled', false);
289
+ jQuery('#quick_adsense_settings_position_after_para_option_2').prop('disabled', false);
290
+ jQuery('#quick_adsense_settings_enable_jump_position_after_para_option_2').prop('disabled', false);
291
+ jQuery('#quick_adsense_settings_ad_after_para_option_2').parent().removeClass('disabled');
292
+ } else {
293
+ jQuery('#quick_adsense_settings_ad_after_para_option_2').prop('disabled', true);
294
+ jQuery('#quick_adsense_settings_position_after_para_option_2').prop('disabled', true);
295
+ jQuery('#quick_adsense_settings_enable_jump_position_after_para_option_2').prop('disabled', true);
296
+ jQuery('#quick_adsense_settings_ad_after_para_option_2').parent().addClass('disabled');
297
+ }
298
+ }
299
+
300
+ function quick_adsense_settings_enable_position_after_para_option_3() {
301
+ if(jQuery('#quick_adsense_settings_enable_position_after_para_option_3').prop('checked') == true) {
302
+ jQuery('#quick_adsense_settings_ad_after_para_option_3').prop('disabled', false);
303
+ jQuery('#quick_adsense_settings_position_after_para_option_3').prop('disabled', false);
304
+ jQuery('#quick_adsense_settings_enable_jump_position_after_para_option_3').prop('disabled', false);
305
+ jQuery('#quick_adsense_settings_ad_after_para_option_3').parent().removeClass('disabled');
306
+ } else {
307
+ jQuery('#quick_adsense_settings_ad_after_para_option_3').prop('disabled', true);
308
+ jQuery('#quick_adsense_settings_position_after_para_option_3').prop('disabled', true);
309
+ jQuery('#quick_adsense_settings_enable_jump_position_after_para_option_3').prop('disabled', true);
310
+ jQuery('#quick_adsense_settings_ad_after_para_option_3').parent().addClass('disabled');
311
+ }
312
+ }
313
+
314
+ function quick_adsense_settings_enable_position_after_image_option_1() {
315
+ if(jQuery('#quick_adsense_settings_enable_position_after_image_option_1').prop('checked') == true) {
316
+ jQuery('#quick_adsense_settings_ad_after_image_option_1').prop('disabled', false);
317
+ jQuery('#quick_adsense_settings_position_after_image_option_1').prop('disabled', false);
318
+ jQuery('#quick_adsense_settings_enable_jump_position_after_image_option_1').prop('disabled', false);
319
+ jQuery('#quick_adsense_settings_ad_after_image_option_1').parent().removeClass('disabled');
320
+ } else {
321
+ jQuery('#quick_adsense_settings_ad_after_image_option_1').prop('disabled', true);
322
+ jQuery('#quick_adsense_settings_position_after_image_option_1').prop('disabled', true);
323
+ jQuery('#quick_adsense_settings_enable_jump_position_after_image_option_1').prop('disabled', true);
324
+ jQuery('#quick_adsense_settings_ad_after_image_option_1').parent().addClass('disabled');
325
+ }
326
+ }
327
+
328
+ function quick_adsense_settings_enable_on_posts() {
329
+ if(jQuery('#quick_adsense_settings_enable_on_posts').prop('checked') == true) {
330
+ jQuery('#quick_adsense_settings_enable_on_posts').parent().removeClass('disabled');
331
+ } else {
332
+ jQuery('#quick_adsense_settings_enable_on_posts').parent().addClass('disabled');
333
+ }
334
+ }
335
+
336
+ function quick_adsense_settings_enable_on_pages() {
337
+ if(jQuery('#quick_adsense_settings_enable_on_pages').prop('checked') == true) {
338
+ jQuery('#quick_adsense_settings_enable_on_pages').parent().removeClass('disabled');
339
+ } else {
340
+ jQuery('#quick_adsense_settings_enable_on_pages').parent().addClass('disabled');
341
+ }
342
+ }
343
+
344
+ function quick_adsense_settings_enable_on_homepage() {
345
+ if(jQuery('#quick_adsense_settings_enable_on_homepage').prop('checked') == true) {
346
+ jQuery('#quick_adsense_settings_enable_on_homepage').parent().removeClass('disabled');
347
+ } else {
348
+ jQuery('#quick_adsense_settings_enable_on_homepage').parent().addClass('disabled');
349
+ }
350
+ }
351
+
352
+ function quick_adsense_settings_enable_on_categories() {
353
+ if(jQuery('#quick_adsense_settings_enable_on_categories').prop('checked') == true) {
354
+ jQuery('#quick_adsense_settings_enable_on_categories').parent().removeClass('disabled');
355
+ } else {
356
+ jQuery('#quick_adsense_settings_enable_on_categories').parent().addClass('disabled');
357
+ }
358
+ }
359
+
360
+ function quick_adsense_settings_enable_on_archives() {
361
+ if(jQuery('#quick_adsense_settings_enable_on_archives').prop('checked') == true) {
362
+ jQuery('#quick_adsense_settings_enable_on_archives').parent().removeClass('disabled');
363
+ } else {
364
+ jQuery('#quick_adsense_settings_enable_on_archives').parent().addClass('disabled');
365
+ }
366
+ }
367
+
368
+ function quick_adsense_settings_enable_on_tags() {
369
+ if(jQuery('#quick_adsense_settings_enable_on_tags').prop('checked') == true) {
370
+ jQuery('#quick_adsense_settings_enable_on_tags').parent().removeClass('disabled');
371
+ } else {
372
+ jQuery('#quick_adsense_settings_enable_on_tags').parent().addClass('disabled');
373
+ }
374
+ }
375
+
376
+ function quick_adsense_settings_enable_all_possible_ads() {
377
+ if(jQuery('#quick_adsense_settings_enable_all_possible_ads').prop('checked') == true) {
378
+ jQuery('#quick_adsense_settings_enable_all_possible_ads').parent().removeClass('disabled');
379
+ } else {
380
+ jQuery('#quick_adsense_settings_enable_all_possible_ads').parent().addClass('disabled');
381
+ }
382
+ }
383
+
384
+ function quick_adsense_settings_disable_widgets_on_homepage() {
385
+ if(jQuery('#quick_adsense_settings_disable_widgets_on_homepage').prop('checked') == true) {
386
+ jQuery('#quick_adsense_settings_disable_widgets_on_homepage').parent().removeClass('disabled');
387
+ } else {
388
+ jQuery('#quick_adsense_settings_disable_widgets_on_homepage').parent().addClass('disabled');
389
+ }
390
+ }
391
+
392
+ function quick_adsense_settings_disable_for_loggedin_users() {
393
+ if(jQuery('#quick_adsense_settings_disable_for_loggedin_users').prop('checked') == true) {
394
+ jQuery('#quick_adsense_settings_disable_for_loggedin_users').parent().removeClass('disabled');
395
+ } else {
396
+ jQuery('#quick_adsense_settings_disable_for_loggedin_users').parent().addClass('disabled');
397
+ }
398
+ }
399
+
400
+ function quick_adsense_settings_enable_quicktag_buttons() {
401
+ if(jQuery('#quick_adsense_settings_enable_quicktag_buttons').prop('checked') == true) {
402
+ jQuery('#quick_adsense_settings_enable_quicktag_buttons').parent().removeClass('disabled');
403
+ } else {
404
+ jQuery('#quick_adsense_settings_enable_quicktag_buttons').parent().addClass('disabled');
405
+ }
406
+ }
407
+
408
+ function quick_adsense_settings_disable_randomads_quicktag_button() {
409
+ if(jQuery('#quick_adsense_settings_disable_randomads_quicktag_button').prop('checked') == true) {
410
+ jQuery('#quick_adsense_settings_disable_randomads_quicktag_button').parent().removeClass('disabled');
411
+ } else {
412
+ jQuery('#quick_adsense_settings_disable_randomads_quicktag_button').parent().addClass('disabled');
413
+ }
414
+ }
415
+
416
+ function quick_adsense_settings_disable_disablead_quicktag_buttons() {
417
+ if(jQuery('#quick_adsense_settings_disable_disablead_quicktag_buttons').prop('checked') == true) {
418
+ jQuery('#quick_adsense_settings_disable_disablead_quicktag_buttons').parent().removeClass('disabled');
419
+ } else {
420
+ jQuery('#quick_adsense_settings_disable_disablead_quicktag_buttons').parent().addClass('disabled');
421
+ }
422
+ }
423
+
424
+ function quick_adsense_settings_disable_positionad_quicktag_buttons() {
425
+ if(jQuery('#quick_adsense_settings_disable_positionad_quicktag_buttons').prop('checked') == true) {
426
+ jQuery('#quick_adsense_settings_disable_positionad_quicktag_buttons').parent().removeClass('disabled');
427
+ } else {
428
+ jQuery('#quick_adsense_settings_disable_positionad_quicktag_buttons').parent().addClass('disabled');
429
+ }
430
+ }
431
+
432
+ function quick_adsense_settings_onpost_enable_global_style() {
433
+ if(jQuery('#quick_adsense_settings_onpost_enable_global_style').prop('checked') == true) {
434
+ jQuery('#quick_adsense_settings_onpost_enable_global_style').parent().removeClass('disabled');
435
+ jQuery('#quick_adsense_settings_onpost_global_alignment').prop('disabled', false);
436
+ jQuery('#quick_adsense_settings_onpost_global_margin').prop('disabled', false);
437
+ for(var i = 1; i <= 10; i++) {
438
+ jQuery('#quick_adsense_settings_onpost_ad_'+i+'_alignment').val(jQuery('#quick_adsense_settings_onpost_global_alignment').val());
439
+ jQuery('#quick_adsense_settings_onpost_ad_'+i+'_margin').val(jQuery('#quick_adsense_settings_onpost_global_margin').val());
440
+ jQuery('#quick_adsense_settings_onpost_ad_'+i+'_alignment').prop('disabled', true);
441
+ jQuery('#quick_adsense_settings_onpost_ad_'+i+'_margin').prop('disabled', true);
442
+ jQuery('#quick_adsense_settings_onpost_ad_'+i+'_alignment').parent().addClass('disabled');
443
+ }
444
+ } else {
445
+ jQuery('#quick_adsense_settings_onpost_enable_global_style').parent().addClass('disabled');
446
+ jQuery('#quick_adsense_settings_onpost_global_alignment').prop('disabled', true);
447
+ jQuery('#quick_adsense_settings_onpost_global_margin').prop('disabled', true);
448
+ for(var i = 1; i <= 10; i++) {
449
+ jQuery('#quick_adsense_settings_onpost_ad_'+i+'_alignment').prop('disabled', false);
450
+ jQuery('#quick_adsense_settings_onpost_ad_'+i+'_margin').prop('disabled', false);
451
+ jQuery('#quick_adsense_settings_onpost_ad_'+i+'_alignment').parent().removeClass('disabled');
452
+ }
453
+ }
454
+ }
455
+
456
+ function quick_adsense_settings_handle_vi_single_selection() {
457
+ /*
458
+ Logic Table for vi Single Selection
459
+ Beginning Enabled, Other Beginning Enabled, vi Beginning Disabled, Other Beginning Disabled, vi
460
+
461
+ Middle Enabled, Other B1, M1 B1, M0 B0, M1 B0, M1, Random - B
462
+
463
+ Middle Enabled, vi B0, M1 ------ B0, M1 B0, M1, Random - B
464
+
465
+ Middle Disabled, Other B1, M0 B1, M0 B0, M0 B0, M0, Random B
466
+
467
+ Middle Disabled, vi B1, M0, Random - M B1, M0, Random - M B0, M0, Random M B0, M0, Random B, Random M
468
+ */
469
+ if(jQuery('#quick_adsense_settings_enable_position_middle_of_post').prop('checked') == true) {
470
+ if(jQuery('#quick_adsense_settings_ad_middle_of_post').val() != '100') {
471
+ if(jQuery('#quick_adsense_settings_enable_position_beginning_of_post').prop('checked') == true) {
472
+ if(jQuery('#quick_adsense_settings_ad_beginning_of_post').val() != '100') { //Middle Enabled, Other + Beginning Enabled, Other = B1, M1
473
+ jQuery('#quick_adsense_settings_ad_beginning_of_post').children('option[value="100"]').prop('disabled', false);
474
+ jQuery('#quick_adsense_settings_ad_middle_of_post').children('option[value="100"]').prop('disabled', false);
475
+ } else { //Middle Enabled, Other + Beginning Enabled, vi = B1, M0
476
+ jQuery('#quick_adsense_settings_ad_beginning_of_post').children('option[value="100"]').prop('disabled', false);
477
+ jQuery('#quick_adsense_settings_ad_middle_of_post').children('option[value="100"]').prop('disabled', true);
478
+ }
479
+ } else {
480
+ if(jQuery('#quick_adsense_settings_ad_beginning_of_post').val() != '100') { //Middle Enabled, Other + Beginning Disabled, Other = B0, M1
481
+ jQuery('#quick_adsense_settings_ad_beginning_of_post').children('option[value="100"]').prop('disabled', true);
482
+ jQuery('#quick_adsense_settings_ad_middle_of_post').children('option[value="100"]').prop('disabled', false);
483
+ } else { //Middle Enabled, Other + Beginning Disabled, vi = B0, M1, Random - B
484
+ jQuery('#quick_adsense_settings_ad_beginning_of_post').children('option[value="100"]').prop('disabled', true);
485
+ jQuery('#quick_adsense_settings_ad_middle_of_post').children('option[value="100"]').prop('disabled', false);
486
+ jQuery('#quick_adsense_settings_ad_beginning_of_post').val('0');
487
+ }
488
+ }
489
+ } else {
490
+ if(jQuery('#quick_adsense_settings_enable_position_beginning_of_post').prop('checked') == true) {
491
+ if(jQuery('#quick_adsense_settings_ad_beginning_of_post').val() != '100') { //Middle Enabled, vi + Beginning Enabled, Other = B0, M1
492
+ jQuery('#quick_adsense_settings_ad_beginning_of_post').children('option[value="100"]').prop('disabled', true);
493
+ jQuery('#quick_adsense_settings_ad_middle_of_post').children('option[value="100"]').prop('disabled', false);
494
+ } else { //Middle Enabled, vi + Beginning Enabled, vi = ------
495
+ // This state should never be reached - Error
496
+ alert('Error');
497
+ }
498
+ } else {
499
+ if(jQuery('#quick_adsense_settings_ad_beginning_of_post').val() != '100') { //Middle Enabled, vi + Beginning Disabled, Other = B0, M1
500
+ jQuery('#quick_adsense_settings_ad_beginning_of_post').children('option[value="100"]').prop('disabled', true);
501
+ jQuery('#quick_adsense_settings_ad_middle_of_post').children('option[value="100"]').prop('disabled', false);
502
+ } else { //Middle Enabled, vi + Beginning Disabled, vi = B0, M1, Random - B
503
+ jQuery('#quick_adsense_settings_ad_beginning_of_post').children('option[value="100"]').prop('disabled', true);
504
+ jQuery('#quick_adsense_settings_ad_middle_of_post').children('option[value="100"]').prop('disabled', false);
505
+ jQuery('#quick_adsense_settings_ad_beginning_of_post').val('0');
506
+ }
507
+ }
508
+ }
509
+ } else {
510
+ if(jQuery('#quick_adsense_settings_ad_middle_of_post').val() != '100') {
511
+ if(jQuery('#quick_adsense_settings_enable_position_beginning_of_post').prop('checked') == true) {
512
+ if(jQuery('#quick_adsense_settings_ad_beginning_of_post').val() != '100') { //Middle Disabled, Other + Beginning Enabled, Other = B1, M0
513
+ jQuery('#quick_adsense_settings_ad_beginning_of_post').children('option[value="100"]').prop('disabled', false);
514
+ jQuery('#quick_adsense_settings_ad_middle_of_post').children('option[value="100"]').prop('disabled', true);
515
+ } else { //Middle Disabled, Other + Beginning Enabled, vi = B1, M0
516
+ jQuery('#quick_adsense_settings_ad_beginning_of_post').children('option[value="100"]').prop('disabled', false);
517
+ jQuery('#quick_adsense_settings_ad_middle_of_post').children('option[value="100"]').prop('disabled', true);
518
+ }
519
+ } else {
520
+ if(jQuery('#quick_adsense_settings_ad_beginning_of_post').val() != '100') { //Middle Disabled, Other + Beginning Disabled, Other = B0, M0
521
+ jQuery('#quick_adsense_settings_ad_beginning_of_post').children('option[value="100"]').prop('disabled', true);
522
+ jQuery('#quick_adsense_settings_ad_middle_of_post').children('option[value="100"]').prop('disabled', true);
523
+ } else { //Middle Disabled, Other + Beginning Disabled, vi = B0, M0, Random B
524
+ jQuery('#quick_adsense_settings_ad_beginning_of_post').children('option[value="100"]').prop('disabled', true);
525
+ jQuery('#quick_adsense_settings_ad_middle_of_post').children('option[value="100"]').prop('disabled', true);
526
+ jQuery('#quick_adsense_settings_ad_beginning_of_post').val('0');
527
+ }
528
+ }
529
+ } else {
530
+ if(jQuery('#quick_adsense_settings_enable_position_beginning_of_post').prop('checked') == true) {
531
+ if(jQuery('#quick_adsense_settings_ad_beginning_of_post').val() != '100') { //Middle Enabled, vi + Beginning Enabled, Other = B1, M0, Random - M
532
+ jQuery('#quick_adsense_settings_ad_beginning_of_post').children('option[value="100"]').prop('disabled', false);
533
+ jQuery('#quick_adsense_settings_ad_middle_of_post').children('option[value="100"]').prop('disabled', true);
534
+ jQuery('#quick_adsense_settings_ad_middle_of_post').val('0');
535
+ } else { //Middle Enabled, vi + Beginning Enabled, vi = B1, M0, Random - M
536
+ jQuery('#quick_adsense_settings_ad_beginning_of_post').children('option[value="100"]').prop('disabled', false);
537
+ jQuery('#quick_adsense_settings_ad_middle_of_post').children('option[value="100"]').prop('disabled', true);
538
+ jQuery('#quick_adsense_settings_ad_middle_of_post').val('0');
539
+ }
540
+ } else {
541
+ if(jQuery('#quick_adsense_settings_ad_beginning_of_post').val() != '100') { //Middle Enabled, vi + Beginning Disabled, Other = B0, M0, Random M
542
+ jQuery('#quick_adsense_settings_ad_beginning_of_post').children('option[value="100"]').prop('disabled', true);
543
+ jQuery('#quick_adsense_settings_ad_middle_of_post').children('option[value="100"]').prop('disabled', true);
544
+ jQuery('#quick_adsense_settings_ad_middle_of_post').val('0');
545
+ } else { //Middle Enabled, vi + Beginning Disabled, vi = B0, M0, Random B, Random M
546
+ jQuery('#quick_adsense_settings_ad_beginning_of_post').children('option[value="100"]').prop('disabled', true);
547
+ jQuery('#quick_adsense_settings_ad_middle_of_post').children('option[value="100"]').prop('disabled', true);
548
+ jQuery('#quick_adsense_settings_ad_middle_of_post').val('0');
549
+ }
550
+ }
551
+ }
552
+ }
553
+ }
554
+
555
+ jQuery(document).ready(function() {
556
+ quick_adsense_vi_signup_handler();
557
+ quick_adsense_vi_login_handler();
558
+ quick_adsense_vi_logout_handler();
559
+ quick_adsense_vi_customize_adcode();
560
+ quick_adsense_vi_chart_draw();
561
+ jQuery(window).resize(function() {
562
+ quick_adsense_vi_chart_draw();
563
+ });
564
+
565
+ if(jQuery('#quick_adsense_vi_signup').length) {
566
+ jQuery('.quick_adsense_notice').show();
567
+ if(window.location.href.indexOf('#vi-remote-signup') > -1) {
568
+ jQuery('#quick_adsense_vi_signup').click();
569
+ }
570
+ } else {
571
+ jQuery('.quick_adsense_notice').hide();
572
+ }
573
+ });
574
+
575
+ function quick_adsense_vi_signup_handler() {
576
+ quick_adsense_click_handler(
577
+ 'quick_adsense_vi_signup',
578
+ 'video intelligence: Signup',
579
+ '870',
580
+ '554',
581
+ function() { },
582
+ function() { },
583
+ function() { }
584
+ );
585
+ }
586
+
587
+ function quick_adsense_vi_login_handler() {
588
+ quick_adsense_click_handler(
589
+ 'quick_adsense_vi_login',
590
+ 'video intelligence: Login',
591
+ '540',
592
+ '540',
593
+ function() {
594
+ jQuery('.ui-dialog-buttonset').find('button').first().unbind('click').click(function() {
595
+ if((jQuery('#quick_adsense_vi_login_username').val() != '') && (jQuery('#quick_adsense_vi_login_password').val() != '')) {
596
+ jQuery('.ui-dialog-buttonset').find('button').first().button('disable');
597
+ jQuery('.ui-dialog-buttonset').find('button').last().button('disable');
598
+ jQuery('.ui-dialog-titlebar').find('button').last().button('disable');
599
+ var quick_adsense_vi_login_username = jQuery('#quick_adsense_vi_login_username').val();
600
+ var quick_adsense_vi_login_password = jQuery('#quick_adsense_vi_login_password').val();
601
+ jQuery('.ui-dialog-content').html('<div class="quick_adsense_ajaxloader"></div>');
602
+ jQuery('.quick_adsense_ajaxloader').show();
603
+ jQuery.post(
604
+ jQuery('#quick_adsense_admin_ajax').val(), {
605
+ 'action': 'quick_adsense_vi_login_form_save_action',
606
+ 'quick_adsense_nonce': jQuery('#quick_adsense_nonce').val(),
607
+ 'quick_adsense_vi_login_username': quick_adsense_vi_login_username,
608
+ 'quick_adsense_vi_login_password': quick_adsense_vi_login_password,
609
+ }, function(response) {
610
+ if(response.indexOf('###SUCCESS###') !== -1) {
611
+ jQuery.post(
612
+ jQuery('#quick_adsense_admin_ajax').val(), {
613
+ 'action': 'quick_adsense_vi_update_adstxt',
614
+ 'quick_adsense_nonce': jQuery('#quick_adsense_nonce').val(),
615
+ }, function(response) {
616
+ if(response.indexOf('###SUCCESS###') !== -1) {
617
+ jQuery('.wrap #quick_adsense_title').after(response.replace('###SUCCESS###', ''));
618
+ jQuery.post(
619
+ jQuery('#quick_adsense_admin_ajax').val(), {
620
+ 'action': 'quick_adsense_adstxt_adsense_admin_notice_check',
621
+ 'quick_adsense_nonce': jQuery('#quick_adsense_nonce').val(),
622
+ }, function(innerResponse) {
623
+ if(response.indexOf('###SUCCESS###') !== -1) {
624
+ jQuery('.wrap #quick_adsense_title').after(innerResponse.replace('###SUCCESS###', ''));
625
+
626
+
627
+ }
628
+ }
629
+ );
630
+ } else if(response.indexOf('###FAIL###') !== -1) {
631
+ jQuery('.wrap #quick_adsense_title').after(response.replace('###FAIL###', ''));
632
+ } else {
633
+ }
634
+ }
635
+ );
636
+ jQuery('.quick_adsense_vi_block .quick_adsense_vi_block_footer, .quick_adsense_vi_block .quick_adsense_vi_block_content').animate({'opacity': 0}, 1000);
637
+ jQuery('.quick_adsense_vi_block').html(response.replace('###SUCCESS###', ''));
638
+ quick_adsense_vi_logout_handler();
639
+ quick_adsense_vi_customize_adcode();
640
+ quick_adsense_vi_chart_draw();
641
+ jQuery('.quick_adsense_vi_block .quick_adsense_vi_block_footer, .quick_adsense_vi_block .quick_adsense_vi_block_content').animate({'opacity': 1}, 1000);
642
+ if(jQuery('.quick_adsense_notice')) {
643
+ jQuery('.quick_adsense_notice').hide();
644
+ }
645
+ jQuery('.ui-dialog-titlebar').find('button').last().button('enable').click();
646
+ } else {
647
+ jQuery('.ui-dialog-buttonset').find('button').first().button('enable');
648
+ jQuery('.ui-dialog-buttonset').find('button').last().button('enable');
649
+ jQuery('.ui-dialog-titlebar').find('button').last().button('enable');
650
+ jQuery('.ui-dialog-content').html(response);
651
+ if(jQuery('.quick_adsense_notice')) {
652
+ jQuery('.quick_adsense_notice').show();
653
+ }
654
+ }
655
+ }
656
+ );
657
+ } else {
658
+ jQuery('#quick_adsense_vi_login_username').css('border-color', '#dddddd');
659
+ jQuery('#quick_adsense_vi_login_password').css('border-color', '#dddddd');
660
+ if(jQuery('#quick_adsense_vi_login_username').val() == '') {
661
+ jQuery('#quick_adsense_vi_login_username').css('border-color', '#ff0000');
662
+ }
663
+ if(jQuery('#quick_adsense_vi_login_password').val() == '') {
664
+ jQuery('#quick_adsense_vi_login_password').css('border-color', '#ff0000');
665
+ }
666
+ }
667
+ });
668
+ },
669
+ function() { },
670
+ function() { }
671
+ );
672
+ }
673
+
674
+ function quick_adsense_vi_logout_handler() {
675
+ jQuery('#quick_adsense_vi_logout').click(function() {
676
+ jQuery.post(
677
+ jQuery('#quick_adsense_admin_ajax').val(), {
678
+ 'action': 'quick_adsense_vi_logout_action',
679
+ 'quick_adsense_nonce': jQuery('#quick_adsense_nonce').val(),
680
+ }, function(response) {
681
+ if(response.indexOf('###SUCCESS###') !== -1) {
682
+ jQuery('.quick_adsense_vi_block').html(response.replace('###SUCCESS###', ''));
683
+ quick_adsense_vi_signup_handler();
684
+ quick_adsense_vi_login_handler();
685
+ if(jQuery('.quick_adsense_notice')) {
686
+ jQuery('.quick_adsense_notice').show();
687
+ }
688
+ }
689
+ jQuery('.quick_adsense_vi_block .quick_adsense_vi_block_footer, .quick_adsense_vi_block .quick_adsense_vi_block_content').animate({'opacity': 1}, 1000);
690
+ }
691
+ );
692
+ jQuery('.quick_adsense_vi_block .quick_adsense_vi_block_footer, .quick_adsense_vi_block .quick_adsense_vi_block_content').animate({'opacity': 0}, 1000);
693
+
694
+ });
695
+ }
696
+
697
+ function quick_adsense_vi_check_status(sender) {
698
+ if((jQuery(sender).val() == '100') && (jQuery('#quick_adsense_vi_embedcode_status').val() == 'NotConfigured')) { // Vi Selected in Beginning Of Post
699
+ jQuery("<p>Visit 'Monetization with vi stories' page to customize your ad unit</p>").dialog({
700
+ 'modal': true,
701
+ 'resizable': false,
702
+ 'title': 'Configure vi stories',
703
+ position: { my: 'center', at: 'center', of: window },
704
+ open: function (event, ui) {
705
+ jQuery('.ui-dialog').css({'z-index': 999999, 'max-width': '90%'});
706
+ jQuery('.ui-widget-overlay').css({'z-index': 999998, 'opacity': 0.8, 'background': '#000000'});
707
+ },
708
+ buttons : {
709
+ 'Ok': function() {
710
+ jQuery('#quick_adsense_settings_tabs').tabs('option', 'active', 1);
711
+ jQuery(this).dialog("close");
712
+ }
713
+ },
714
+ close: function() {
715
+ jQuery(this).dialog('destroy');
716
+ }
717
+ });
718
+ }
719
+ }
720
+
721
+ function quick_adsense_vi_customize_adcode() {
722
+ quick_adsense_click_handler(
723
+ 'quick_adsense_vi_customize_adcode',
724
+ 'video intelligence: Customize vi Code',
725
+ jQuery("body").width() * 0.8,
726
+ jQuery("body").height() * 0.8,
727
+ function() {
728
+ jQuery('#quick_adsense_vi_code_settings_keywords').attr('maxlength', '200');
729
+ jQuery('#quick_adsense_vi_code_settings_optional_1').attr('maxlength', '200');
730
+ jQuery('#quick_adsense_vi_code_settings_optional_2').attr('maxlength', '200');
731
+ jQuery('#quick_adsense_vi_code_settings_optional_3').attr('maxlength', '200');
732
+ jQuery('.ui-dialog-buttonset').find('button').first().unbind('click').click(function() {
733
+ 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;
734
+ if(
735
+ (jQuery('#quick_adsense_vi_code_settings_ad_unit_type').val() != 'select') &&
736
+ (jQuery('#quick_adsense_vi_code_settings_iab_category_child').val() != 'select') &&
737
+ (jQuery('#quick_adsense_vi_code_settings_language').val() != 'select') &&
738
+ ((jQuery('#quick_adsense_vi_code_settings_keywords').val() == '') || ((jQuery(jQuery('#quick_adsense_vi_code_settings_keywords').val().match(/./g)).not(jQuery('#quick_adsense_vi_code_settings_keywords').val().match(keywordsRegex)).get().length == 0) && (jQuery('#quick_adsense_vi_code_settings_keywords').val().length < 200)))
739
+ ) {
740
+ jQuery('.ui-dialog-buttonset').find('button').first().button('disable');
741
+ jQuery('.ui-dialog-buttonset').find('button').last().button('disable');
742
+ jQuery('.ui-dialog-titlebar').find('button').last().button('disable');
743
+ var quick_adsense_vi_code_settings_ad_unit_type = jQuery('#quick_adsense_vi_code_settings_ad_unit_type').val();
744
+ var quick_adsense_vi_code_settings_keywords = jQuery('#quick_adsense_vi_code_settings_keywords').val();
745
+ var quick_adsense_vi_code_settings_iab_category_parent = jQuery('#quick_adsense_vi_code_settings_iab_category_parent').val();
746
+ var quick_adsense_vi_code_settings_iab_category_child = jQuery('#quick_adsense_vi_code_settings_iab_category_child').val();
747
+ var quick_adsense_vi_code_settings_language = jQuery('#quick_adsense_vi_code_settings_language').val();
748
+ var quick_adsense_vi_code_settings_native_bg_color = jQuery('#quick_adsense_vi_code_settings_native_bg_color').val();
749
+ var quick_adsense_vi_code_settings_native_text_color = jQuery('#quick_adsense_vi_code_settings_native_text_color').val();
750
+ var quick_adsense_vi_code_settings_font_family = jQuery('#quick_adsense_vi_code_settings_font_family').val();
751
+ var quick_adsense_vi_code_settings_font_size = jQuery('#quick_adsense_vi_code_settings_font_size').val();
752
+ var quick_adsense_vi_code_settings_optional_1 = jQuery('#quick_adsense_vi_code_settings_optional_1').val();
753
+ var quick_adsense_vi_code_settings_optional_2 = jQuery('#quick_adsense_vi_code_settings_optional_2').val();
754
+ var quick_adsense_vi_code_settings_optional_3 = jQuery('#quick_adsense_vi_code_settings_optional_3').val();
755
+ jQuery('.ui-dialog-content').html('<div class="quick_adsense_ajaxloader"></div>');
756
+ jQuery('.quick_adsense_ajaxloader').show();
757
+ jQuery.post(
758
+ jQuery('#quick_adsense_admin_ajax').val(), {
759
+ 'action': 'quick_adsense_vi_customize_adcode_form_save_action',
760
+ 'quick_adsense_nonce': jQuery('#quick_adsense_nonce').val(),
761
+ 'quick_adsense_vi_code_settings_ad_unit_type': quick_adsense_vi_code_settings_ad_unit_type,
762
+ 'quick_adsense_vi_code_settings_keywords': quick_adsense_vi_code_settings_keywords,
763
+ 'quick_adsense_vi_code_settings_iab_category_parent': quick_adsense_vi_code_settings_iab_category_parent,
764
+ 'quick_adsense_vi_code_settings_iab_category_child': quick_adsense_vi_code_settings_iab_category_child,
765
+ 'quick_adsense_vi_code_settings_language': quick_adsense_vi_code_settings_language,
766
+ 'quick_adsense_vi_code_settings_native_bg_color': quick_adsense_vi_code_settings_native_bg_color,
767
+ 'quick_adsense_vi_code_settings_native_text_color': quick_adsense_vi_code_settings_native_text_color,
768
+ 'quick_adsense_vi_code_settings_font_family': quick_adsense_vi_code_settings_font_family,
769
+ 'quick_adsense_vi_code_settings_font_size': quick_adsense_vi_code_settings_font_size,
770
+ 'quick_adsense_vi_code_settings_optional_1': quick_adsense_vi_code_settings_optional_1,
771
+ 'quick_adsense_vi_code_settings_optional_2': quick_adsense_vi_code_settings_optional_2,
772
+ 'quick_adsense_vi_code_settings_optional_3': quick_adsense_vi_code_settings_optional_3,
773
+ }, function(response) {
774
+ if(response.indexOf('###SUCCESS###') !== -1) {
775
+ jQuery('#quick_adsense_vi_embedcode_status').val('Configured');
776
+ jQuery('.ui-dialog-titlebar').find('button').last().button('enable').click();
777
+ } else {
778
+ jQuery('#quick_adsense_vi_embedcode_status').val('NotConfigured');
779
+ jQuery('.ui-dialog-buttonset').find('button').first().button('disable');
780
+ jQuery('.ui-dialog-buttonset').find('button').last().button('enable');
781
+ jQuery('.ui-dialog-titlebar').find('button').last().button('enable');
782
+ jQuery('.ui-dialog-content').html(response.replace('###FAIL###', ''));
783
+ }
784
+ }
785
+ );
786
+ } else {
787
+ jQuery('#quick_adsense_vi_customize_adcode_keywords_required_error').hide();
788
+ jQuery('#quick_adsense_vi_customize_adcode_keywords_error').hide();
789
+ jQuery('#quick_adsense_vi_customize_adcode_required_error').hide();
790
+ jQuery('#quick_adsense_vi_code_settings_ad_unit_type').css('border-color', '#dddddd');
791
+ jQuery('#quick_adsense_vi_code_settings_iab_category_parent').css('border-color', '#dddddd');
792
+ jQuery('#quick_adsense_vi_code_settings_iab_category_child').css('border-color', '#dddddd');
793
+ jQuery('#quick_adsense_vi_code_settings_language').css('border-color', '#dddddd');
794
+ jQuery('#quick_adsense_vi_code_settings_keywords').css('border-color', '#dddddd');
795
+ var quick_adsense_vi_customize_adcode_keywords_error = false;
796
+ var quick_adsense_vi_customize_adcode_required_error = false;
797
+ if(jQuery('#quick_adsense_vi_code_settings_ad_unit_type').val() == 'select') {
798
+ jQuery('#quick_adsense_vi_code_settings_ad_unit_type').css('border-color', '#ff0000');
799
+ quick_adsense_vi_customize_adcode_required_error = true;
800
+ }
801
+ if(jQuery('#quick_adsense_vi_code_settings_iab_category_parent').val() == 'select') {
802
+ jQuery('#quick_adsense_vi_code_settings_iab_category_parent').css('border-color', '#ff0000');
803
+ quick_adsense_vi_customize_adcode_required_error = true;
804
+ }
805
+ if(jQuery('#quick_adsense_vi_code_settings_iab_category_child').val() == 'select') {
806
+ jQuery('#quick_adsense_vi_code_settings_iab_category_child').css('border-color', '#ff0000');
807
+ quick_adsense_vi_customize_adcode_required_error = true;
808
+ }
809
+ if(jQuery('#quick_adsense_vi_code_settings_language').val() == 'select') {
810
+ jQuery('#quick_adsense_vi_code_settings_language').css('border-color', '#ff0000');
811
+ quick_adsense_vi_customize_adcode_required_error = true;
812
+ }
813
+ if(jQuery('#quick_adsense_vi_code_settings_keywords').val() != '') {
814
+ if(jQuery('#quick_adsense_vi_code_settings_keywords').val().length > 200) {
815
+ jQuery('#quick_adsense_vi_code_settings_keywords').css('border-color', '#ff0000');
816
+ quick_adsense_vi_customize_adcode_keywords_error = true;
817
+ }
818
+ if(jQuery(jQuery('#quick_adsense_vi_code_settings_keywords').val().match(/./g)).not(jQuery('#quick_adsense_vi_code_settings_keywords').val().match(keywordsRegex)).get().length != 0) {
819
+ jQuery('#quick_adsense_vi_code_settings_keywords').css('border-color', '#ff0000');
820
+ quick_adsense_vi_customize_adcode_keywords_error = true;
821
+ }
822
+ }
823
+ if(quick_adsense_vi_customize_adcode_keywords_error && quick_adsense_vi_customize_adcode_required_error) {
824
+ jQuery('#quick_adsense_vi_customize_adcode_keywords_required_error').show();
825
+ } else if(quick_adsense_vi_customize_adcode_keywords_error) {
826
+ jQuery('#quick_adsense_vi_customize_adcode_keywords_error').show();
827
+ } else if(quick_adsense_vi_customize_adcode_required_error) {
828
+ jQuery('#quick_adsense_vi_customize_adcode_required_error').show();
829
+ } else {}
830
+ }
831
+ });
832
+ },
833
+ function() { },
834
+ function() { }
835
+ );
836
+ }
837
+
838
+ function quick_adsense_vi_code_iab_category_parent_change() {
839
+ jQuery('#quick_adsense_vi_code_settings_iab_category_parent').change(function() {
840
+ var quick_adsense_vi_code_iab_category = jQuery(this).val();
841
+ if(quick_adsense_vi_code_iab_category != 'select') {
842
+ jQuery('#quick_adsense_vi_code_settings_iab_category_child').prop('disabled', true);
843
+ jQuery('#quick_adsense_vi_code_settings_iab_category_child option').prop('disabled', true).hide();
844
+ jQuery('#quick_adsense_vi_code_settings_iab_category_child option').each(function() {
845
+ if((jQuery(this).attr('data-parent') == quick_adsense_vi_code_iab_category) || (jQuery(this).val() == 'select')) {
846
+ jQuery(this).prop('disabled', false).show();
847
+ }
848
+ });
849
+ if(jQuery('#quick_adsense_vi_code_settings_iab_category_child option:selected').prop('disabled') != false) {
850
+ jQuery('#quick_adsense_vi_code_settings_iab_category_child').val('select');
851
+ }
852
+ jQuery('#quick_adsense_vi_code_settings_iab_category_child').prop('disabled', false);
853
+ } else {
854
+ jQuery('#quick_adsense_vi_code_settings_iab_category_child').prop('disabled', true);
855
+ jQuery('#quick_adsense_vi_code_settings_iab_category_child').val('select');
856
+ }
857
+ });
858
+ jQuery('#quick_adsense_vi_code_settings_iab_category_parent').change();
859
+ }
860
+
861
+ function quick_adsense_vi_chart_draw() {
862
+ if(jQuery('#quick_adsense_vi_earnings_wrapper').length) {
863
+ jQuery.post(
864
+ jQuery('#quick_adsense_admin_ajax').val(), {
865
+ 'action': 'quick_adsense_vi_get_chart',
866
+ 'quick_adsense_nonce': jQuery('#quick_adsense_nonce').val(),
867
+ }, function(response) {
868
+ if(response.indexOf('###SUCCESS###') !== -1) {
869
+ jQuery('#quick_adsense_vi_earnings_wrapper').html(response.replace('###SUCCESS###', ''));
870
+ jQuery('#quick_adsense_vi_chart_wrapper canvas').attr('width', jQuery('#quick_adsense_vi_chart_wrapper').width()+'px');
871
+ jQuery('#quick_adsense_vi_chart_wrapper canvas').attr('height', jQuery('#quick_adsense_vi_chart_wrapper').height()+'px');
872
+ if(jQuery('#quick_adsense_vi_chart_data').length) {
873
+ var ctx = document.getElementById("myChart");
874
+ var quick_adsense_vi_chart = new Chart(jQuery('#quick_adsense_vi_chart'), {
875
+ type: 'line',
876
+ responsive: false,
877
+ data: {
878
+ datasets: [{
879
+ data: JSON.parse(jQuery('#quick_adsense_vi_chart_data').val()),
880
+ backgroundColor: '#EDF5FB',
881
+ borderColor: '#186EAE',/*E8EBEF*/
882
+ borderWidth: 1
883
+ }]
884
+ },
885
+ options: {
886
+ title: {
887
+ display: false,
888
+ backgroundColor: '#EDF5FB'
889
+ },
890
+ legend: {
891
+ display: false,
892
+ },
893
+ scales: {
894
+ xAxes: [{
895
+ type: "time",
896
+ display: true,
897
+ scaleLabel: {
898
+ display: false
899
+ },
900
+ gridLines: {
901
+ display: false,
902
+ drawTicks: false
903
+ },
904
+ ticks: {
905
+ display: false
906
+ }
907
+ }],
908
+ yAxes: [{
909
+ display: true,
910
+ scaleLabel: {
911
+ display: false
912
+ },
913
+ gridLines: {
914
+ display: true,
915
+ drawTicks: false
916
+ },
917
+ ticks: {
918
+ display: false
919
+ }
920
+ }]
921
+ },
922
+ tooltips: {
923
+ displayColors: false,
924
+ callbacks: {
925
+ label: function(tooltipItem, data) {
926
+ return '$ '+parseFloat(tooltipItem.yLabel).toFixed(2);
927
+ },
928
+ title: function(tooltipItem, data) {
929
+ var monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
930
+ var dateParts = tooltipItem[0].xLabel.split('/');
931
+ var date = new Date(dateParts[2], dateParts[0]-1, dateParts[1]);
932
+ return monthNames[date.getMonth()]+' '+date.getDate();
933
+ }
934
+ }
935
+ }
936
+ }
937
+ });
938
+ }
939
+ } else {
940
+ jQuery('#quick_adsense_vi_earnings_wrapper').parent().html(response);
941
+ }
942
+ /*jQuery(window).resize();*/
943
+ }
944
+ );
945
+ }
946
+ }
947
+
948
+ function quick_adsense_click_handler(target, title, width, height, openAction, UpdateAction, closeAction) {
949
+ jQuery('#'+target).click(function() {
950
+ jQuery('<div id="'+target+'_dialog"></div>').html('<div class="quick_adsense_ajaxloader"></div>').dialog({
951
+ 'modal': true,
952
+ 'resizable': false,
953
+ 'width': width,
954
+ 'maxWidth': width,
955
+ 'maxHeight': height,
956
+ 'title': title,
957
+ position: { my: 'center', at: 'center', of: window },
958
+ open: function (event, ui) {
959
+ jQuery('.ui-dialog').css({'z-index': 999999, 'max-width': '90%'});
960
+ jQuery('.ui-widget-overlay').css({'z-index': 999998, 'opacity': 0.8, 'background': '#000000'});
961
+ jQuery('.ui-dialog-buttonpane button:contains("Update")').button('disable');
962
+ jQuery.post(
963
+ jQuery('#quick_adsense_admin_ajax').val(), {
964
+ 'action': target+'_form_get_content',
965
+ 'quick_adsense_nonce': jQuery('#quick_adsense_nonce').val()
966
+ }, function(response) {
967
+ jQuery('.quick_adsense_ajaxloader').hide();
968
+ jQuery('.ui-dialog-content').html(response);
969
+ jQuery('.ui-accordion .ui-accordion-content').css('max-height', (jQuery("body").height() * 0.45));
970
+ jQuery('.ui-dialog-buttonpane button:contains("Update")').button('enable');
971
+ openAction();
972
+ jQuery('.ui-dialog').css({'position': 'fixed'});
973
+ jQuery('#'+target+'_dialog').delay(500).dialog({position: { my: 'center', at: 'center', of: window }});
974
+
975
+ }
976
+ );
977
+ },
978
+ buttons: {
979
+ 'Update': {
980
+ text: 'Update',
981
+ icons: { primary: "ui-icon-gear" },
982
+ click: function() {
983
+ if(UpdateAction() != 'false') {
984
+ jQuery(this).dialog('close');
985
+ }
986
+ }
987
+ },
988
+ Cancel: {
989
+ text: 'Cancel',
990
+ icons: { primary: "ui-icon-cancel" },
991
+ click: function() {
992
+ if(closeAction() != 'false') {
993
+ jQuery(this).dialog('close');
994
+ }
995
+ }
996
+ }
997
+ },
998
+ close: function() {
999
+ closeAction();
1000
+ jQuery(this).dialog('destroy');
1001
+ }
1002
+ })
1003
+ });
1004
+ }
includes/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
+ }));
includes/migrate.php DELETED
@@ -1,246 +0,0 @@
1
- <?php
2
- global $QData;
3
- $QData['AdsWid'] = 10;
4
- $QData['Ads'] = 10;
5
- $QData['Name'] = 'Quick Adsense';
6
- $QData['Version'] = '2.2';
7
- $QData['URI'] = 'http://quickadsense.com/';
8
- $QData['AdsWidName'] = 'AdsWidget%d (Quick Adsense)';
9
- $QData['Default'] = array(
10
- 'AdsDisp' => '3',
11
- 'BegnAds' => true,
12
- 'BegnRnd' => '1',
13
- 'EndiAds' => true,
14
- 'EndiRnd' => '0',
15
- 'MiddAds' => false,
16
- 'MiddRnd' => '0',
17
- 'MoreAds' => false,
18
- 'MoreRnd' => '0',
19
- 'LapaAds' => false,
20
- 'LapaRnd' => '0',
21
- 'Par1Ads' => false,
22
- 'Par1Rnd' => '0',
23
- 'Par1Nup' => '0',
24
- 'Par1Con' => false,
25
- 'Par2Ads' => false,
26
- 'Par2Rnd' => '0',
27
- 'Par2Nup' => '0',
28
- 'Par2Con' => false,
29
- 'Par3Ads' => false,
30
- 'Par3Rnd' => '0',
31
- 'Par3Nup' => '0',
32
- 'Par3Con' => false,
33
- 'Img1Ads' => false,
34
- 'Img1Rnd' => '0',
35
- 'Img1Nup' => '0',
36
- 'Img1Con' => true,
37
- 'AppPost' => true,
38
- 'AppPage' => true,
39
- 'AppHome' => false,
40
- 'AppCate' => false,
41
- 'AppArch' => false,
42
- 'AppTags' => false,
43
- 'AppMaxA' => false,
44
- 'AppSide' => false,
45
- 'AppLogg' => false,
46
- 'QckTags' => true,
47
- 'QckRnds' => false,
48
- 'QckOffs' => false,
49
- 'QckOfPs' => false
50
- );
51
-
52
- $QData['DefaultAdsOpt'] = array(
53
- 'AdsMargin' => '10',
54
- 'AdsAlign' => '2'
55
- );
56
- $QData['DefaultAdsName'] = array();
57
-
58
- for($i = 1; $i <= $QData['Ads']; $i++) {
59
- array_push($QData['DefaultAdsName'], 'AdsCode'.$i);
60
- array_push($QData['DefaultAdsName'], 'AdsAlign'.$i);
61
- array_push($QData['DefaultAdsName'], 'AdsMargin'.$i);
62
- };
63
-
64
- for($i = 1; $i <= $QData['AdsWid']; $i++) {
65
- array_push($QData['DefaultAdsName'], 'WidCode'.$i);
66
- };
67
-
68
-
69
- function quick_adsense_2_get_options_with_defaults() {
70
- global $QData;
71
- //delete_option('quick_adsense_2_options');
72
- $options = get_option('quick_adsense_2_options');
73
- if(!is_array($options) || (count($options) < 1)) {
74
- $oldData = get_option('AdsDisp');
75
- if(isset($oldData) && in_array($oldData, array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10'))) {
76
- $options = array ();
77
- $temp = get_option('AdsDisp'); if(isset($temp) && ($temp != '')) { $options['AdsDisp'] = $temp; }
78
- $temp = get_option('BegnAds'); if(isset($temp) && ($temp != '')) { $options['BegnAds'] = $temp; }
79
- $temp = get_option('BegnRnd'); if(isset($temp) && ($temp != '')) { $options['BegnRnd'] = $temp; }
80
- $temp = get_option('MiddAds'); if(isset($temp) && ($temp != '')) { $options['MiddAds'] = $temp; }
81
- $temp = get_option('MiddRnd'); if(isset($temp) && ($temp != '')) { $options['MiddRnd'] = $temp; }
82
- $temp = get_option('EndiAds'); if(isset($temp) && ($temp != '')) { $options['EndiAds'] = $temp; }
83
- $temp = get_option('EndiRnd'); if(isset($temp) && ($temp != '')) { $options['EndiRnd'] = $temp; }
84
- $temp = get_option('MoreAds'); if(isset($temp) && ($temp != '')) { $options['MoreAds'] = $temp; }
85
- $temp = get_option('MoreRnd'); if(isset($temp) && ($temp != '')) { $options['MoreRnd'] = $temp; }
86
- $temp = get_option('LapaAds'); if(isset($temp) && ($temp != '')) { $options['LapaAds'] = $temp; }
87
- $temp = get_option('LapaRnd'); if(isset($temp) && ($temp != '')) { $options['LapaRnd'] = $temp; }
88
- $temp = get_option('Par1Ads'); if(isset($temp) && ($temp != '')) { $options['Par1Ads'] = $temp; }
89
- $temp = get_option('Par1Rnd'); if(isset($temp) && ($temp != '')) { $options['Par1Rnd'] = $temp; }
90
- $temp = get_option('Par1Nup'); if(isset($temp) && ($temp != '')) { $options['Par1Nup'] = $temp; }
91
- $temp = get_option('Par1Con'); if(isset($temp) && ($temp != '')) { $options['Par1Con'] = $temp; }
92
- $temp = get_option('Par2Ads'); if(isset($temp) && ($temp != '')) { $options['Par2Ads'] = $temp; }
93
- $temp = get_option('Par2Rnd'); if(isset($temp) && ($temp != '')) { $options['Par2Rnd'] = $temp; }
94
- $temp = get_option('Par2Nup'); if(isset($temp) && ($temp != '')) { $options['Par2Nup'] = $temp; }
95
- $temp = get_option('Par2Con'); if(isset($temp) && ($temp != '')) { $options['Par2Con'] = $temp; }
96
- $temp = get_option('Par3Ads'); if(isset($temp) && ($temp != '')) { $options['Par3Ads'] = $temp; }
97
- $temp = get_option('Par3Rnd'); if(isset($temp) && ($temp != '')) { $options['Par3Rnd'] = $temp; }
98
- $temp = get_option('Par3Nup'); if(isset($temp) && ($temp != '')) { $options['Par3Nup'] = $temp; }
99
- $temp = get_option('Par3Con'); if(isset($temp) && ($temp != '')) { $options['Par3Con'] = $temp; }
100
- $temp = get_option('Img1Ads'); if(isset($temp) && ($temp != '')) { $options['Img1Ads'] = $temp; }
101
- $temp = get_option('Img1Rnd'); if(isset($temp) && ($temp != '')) { $options['Img1Rnd'] = $temp; }
102
- $temp = get_option('Img1Nup'); if(isset($temp) && ($temp != '')) { $options['Img1Nup'] = $temp; }
103
- $temp = get_option('Img1Con'); if(isset($temp) && ($temp != '')) { $options['Img1Con'] = $temp; }
104
- $temp = get_option('AppPost'); if(isset($temp) && ($temp != '')) { $options['AppPost'] = $temp; }
105
- $temp = get_option('AppPage'); if(isset($temp) && ($temp != '')) { $options['AppPage'] = $temp; }
106
- $temp = get_option('AppHome'); if(isset($temp) && ($temp != '')) { $options['AppHome'] = $temp; }
107
- $temp = get_option('AppCate'); if(isset($temp) && ($temp != '')) { $options['AppCate'] = $temp; }
108
- $temp = get_option('AppArch'); if(isset($temp) && ($temp != '')) { $options['AppArch'] = $temp; }
109
- $temp = get_option('AppTags'); if(isset($temp) && ($temp != '')) { $options['AppTags'] = $temp; }
110
- $temp = get_option('AppMaxA'); if(isset($temp) && ($temp != '')) { $options['AppMaxA'] = $temp; }
111
- $temp = get_option('AppSide'); if(isset($temp) && ($temp != '')) { $options['AppSide'] = $temp; }
112
- $temp = get_option('AppLogg'); if(isset($temp) && ($temp != '')) { $options['AppLogg'] = $temp; }
113
- $temp = get_option('QckTags'); if(isset($temp) && ($temp != '')) { $options['QckTags'] = $temp; }
114
- $temp = get_option('QckRnds'); if(isset($temp) && ($temp != '')) { $options['QckRnds'] = $temp; }
115
- $temp = get_option('QckOffs'); if(isset($temp) && ($temp != '')) { $options['QckOffs'] = $temp; }
116
- $temp = get_option('QckOfPs'); if(isset($temp) && ($temp != '')) { $options['QckOfPs'] = $temp; }
117
- $temp = get_option('AdsCode1'); if(isset($temp)) { $options['AdsCode1'] = $temp; }
118
- $temp = get_option('AdsAlign1'); if(isset($temp) && ($temp != '')) { $options['AdsAlign1'] = $temp; }
119
- $temp = get_option('AdsMargin1'); if(isset($temp) && ($temp != '')) { $options['AdsMargin1'] = $temp; }
120
- $temp = get_option('AdsCode2'); if(isset($temp)) { $options['AdsCode2'] = $temp; }
121
- $temp = get_option('AdsAlign2'); if(isset($temp) && ($temp != '')) { $options['AdsAlign2'] = $temp; }
122
- $temp = get_option('AdsMargin2'); if(isset($temp) && ($temp != '')) { $options['AdsMargin2'] = $temp; }
123
- $temp = get_option('AdsCode3'); if(isset($temp)) { $options['AdsCode3'] = $temp; }
124
- $temp = get_option('AdsAlign3'); if(isset($temp) && ($temp != '')) { $options['AdsAlign3'] = $temp; }
125
- $temp = get_option('AdsMargin3'); if(isset($temp) && ($temp != '')) { $options['AdsMargin3'] = $temp; }
126
- $temp = get_option('AdsCode4'); if(isset($temp)) { $options['AdsCode4'] = $temp; }
127
- $temp = get_option('AdsAlign4'); if(isset($temp) && ($temp != '')) { $options['AdsAlign4'] = $temp; }
128
- $temp = get_option('AdsMargin4'); if(isset($temp) && ($temp != '')) { $options['AdsMargin4'] = $temp; }
129
- $temp = get_option('AdsCode5'); if(isset($temp)) { $options['AdsCode5'] = $temp; }
130
- $temp = get_option('AdsAlign5'); if(isset($temp) && ($temp != '')) { $options['AdsAlign5'] = $temp; }
131
- $temp = get_option('AdsMargin5'); if(isset($temp) && ($temp != '')) { $options['AdsMargin5'] = $temp; }
132
- $temp = get_option('AdsCode6'); if(isset($temp)) { $options['AdsCode6'] = $temp; }
133
- $temp = get_option('AdsAlign6'); if(isset($temp) && ($temp != '')) { $options['AdsAlign6'] = $temp; }
134
- $temp = get_option('AdsMargin6'); if(isset($temp) && ($temp != '')) { $options['AdsMargin6'] = $temp; }
135
- $temp = get_option('AdsCode7'); if(isset($temp)) { $options['AdsCode7'] = $temp; }
136
- $temp = get_option('AdsAlign7'); if(isset($temp) && ($temp != '')) { $options['AdsAlign7'] = $temp; }
137
- $temp = get_option('AdsMargin7'); if(isset($temp) && ($temp != '')) { $options['AdsMargin7'] = $temp; }
138
- $temp = get_option('AdsCode8'); if(isset($temp)) { $options['AdsCode8'] = $temp; }
139
- $temp = get_option('AdsAlign8'); if(isset($temp) && ($temp != '')) { $options['AdsAlign8'] = $temp; }
140
- $temp = get_option('AdsMargin8'); if(isset($temp) && ($temp != '')) { $options['AdsMargin8'] = $temp; }
141
- $temp = get_option('AdsCode9'); if(isset($temp)) { $options['AdsCode9'] = $temp; }
142
- $temp = get_option('AdsAlign9'); if(isset($temp) && ($temp != '')) { $options['AdsAlign9'] = $temp; }
143
- $temp = get_option('AdsMargin9'); if(isset($temp) && ($temp != '')) { $options['AdsMargin9'] = $temp; }
144
- $temp = get_option('AdsCode10'); if(isset($temp)) { $options['AdsCode10'] = $temp; }
145
- $temp = get_option('AdsAlign10'); if(isset($temp) && ($temp != '')) { $options['AdsAlign10'] = $temp; }
146
- $temp = get_option('AdsMargin10'); if(isset($temp) && ($temp != '')) { $options['AdsMargin10'] = $temp; }
147
- $temp = get_option('WidCode1'); if(isset($temp)) { $options['WidCode1'] = $temp; }
148
- $temp = get_option('WidCode2'); if(isset($temp)) { $options['WidCode2'] = $temp; }
149
- $temp = get_option('WidCode3'); if(isset($temp)) { $options['WidCode3'] = $temp; }
150
- $temp = get_option('WidCode4'); if(isset($temp)) { $options['WidCode4'] = $temp; }
151
- $temp = get_option('WidCode5'); if(isset($temp)) { $options['WidCode5'] = $temp; }
152
- $temp = get_option('WidCode6'); if(isset($temp)) { $options['WidCode6'] = $temp; }
153
- $temp = get_option('WidCode7'); if(isset($temp)) { $options['WidCode7'] = $temp; }
154
- $temp = get_option('WidCode8'); if(isset($temp)) { $options['WidCode8'] = $temp; }
155
- $temp = get_option('WidCode9'); if(isset($temp)) { $options['WidCode9'] = $temp; }
156
- $temp = get_option('WidCode10'); if(isset($temp)) { $options['WidCode10'] = $temp; }
157
- delete_option('AdsDisp');
158
- } else {
159
- $options = array (
160
- 'AdsDisp' => $QData['Default']['AdsDisp'],
161
- 'BegnAds' => $QData['Default']['BegnAds'],
162
- 'BegnRnd' => $QData['Default']['BegnRnd'],
163
- 'MiddAds' => $QData['Default']['MiddAds'],
164
- 'MiddRnd' => $QData['Default']['MiddRnd'],
165
- 'EndiAds' => $QData['Default']['EndiAds'],
166
- 'EndiRnd' => $QData['Default']['EndiRnd'],
167
- 'MoreAds' => $QData['Default']['MoreAds'],
168
- 'MoreRnd' => $QData['Default']['MoreRnd'],
169
- 'LapaAds' => $QData['Default']['LapaAds'],
170
- 'LapaRnd' => $QData['Default']['LapaRnd'],
171
- 'Par1Ads' => $QData['Default']['Par1Ads'],
172
- 'Par1Rnd' => $QData['Default']['Par1Rnd'],
173
- 'Par1Nup' => $QData['Default']['Par1Nup'],
174
- 'Par1Con' => $QData['Default']['Par1Con'],
175
- 'Par2Ads' => $QData['Default']['Par2Ads'],
176
- 'Par2Rnd' => $QData['Default']['Par2Rnd'],
177
- 'Par2Nup' => $QData['Default']['Par2Nup'],
178
- 'Par2Con' => $QData['Default']['Par2Con'],
179
- 'Par3Ads' => $QData['Default']['Par3Ads'],
180
- 'Par3Rnd' => $QData['Default']['Par3Rnd'],
181
- 'Par3Nup' => $QData['Default']['Par3Nup'],
182
- 'Par3Con' => $QData['Default']['Par3Con'],
183
- 'Img1Ads' => $QData['Default']['Img1Ads'],
184
- 'Img1Rnd' => $QData['Default']['Img1Rnd'],
185
- 'Img1Nup' => $QData['Default']['Img1Nup'],
186
- 'Img1Con' => $QData['Default']['Img1Con'],
187
- 'AppPost' => $QData['Default']['AppPost'],
188
- 'AppPage' => $QData['Default']['AppPage'],
189
- 'AppHome' => $QData['Default']['AppHome'],
190
- 'AppCate' => $QData['Default']['AppCate'],
191
- 'AppArch' => $QData['Default']['AppArch'],
192
- 'AppTags' => $QData['Default']['AppTags'],
193
- 'AppMaxA' => $QData['Default']['AppMaxA'],
194
- 'AppSide' => $QData['Default']['AppSide'],
195
- 'AppLogg' => $QData['Default']['AppLogg'],
196
- 'QckTags' => $QData['Default']['QckTags'],
197
- 'QckRnds' => $QData['Default']['QckRnds'],
198
- 'QckOffs' => $QData['Default']['QckOffs'],
199
- 'QckOfPs' => $QData['Default']['QckOfPs'],
200
- 'AdsCode1' => '',
201
- 'AdsAlign1' => 2,
202
- 'AdsMargin1' => 10,
203
- 'AdsCode2' => '',
204
- 'AdsAlign2' => 2,
205
- 'AdsMargin2' => 10,
206
- 'AdsCode3' => '',
207
- 'AdsAlign3' => 2,
208
- 'AdsMargin3' => 10,
209
- 'AdsCode4' => '',
210
- 'AdsAlign4' => 2,
211
- 'AdsMargin4' => 10,
212
- 'AdsCode5' => '',
213
- 'AdsAlign5' => 2,
214
- 'AdsMargin5' => 10,
215
- 'AdsCode6' => '',
216
- 'AdsAlign6' => 2,
217
- 'AdsMargin6' => 10,
218
- 'AdsCode7' => '',
219
- 'AdsAlign7' => 2,
220
- 'AdsMargin7' => 10,
221
- 'AdsCode8' => '',
222
- 'AdsAlign8' => 2,
223
- 'AdsMargin8' => 10,
224
- 'AdsCode9' => '',
225
- 'AdsAlign9' => 2,
226
- 'AdsMargin9' => 10,
227
- 'AdsCode10' => '',
228
- 'AdsAlign10' => 2,
229
- 'AdsMargin10' => 10,
230
- 'WidCode1' => '',
231
- 'WidCode2' => '',
232
- 'WidCode3' => '',
233
- 'WidCode4' => '',
234
- 'WidCode5' => '',
235
- 'WidCode6' => '',
236
- 'WidCode7' => '',
237
- 'WidCode8' => '',
238
- 'WidCode9' => '',
239
- 'WidCode10' => ''
240
- );
241
- }
242
- update_option('quick_adsense_2_options', $options);
243
- }
244
- return $options;
245
- }
246
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/quicktags.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ add_action('admin_print_footer_scripts', 'quick_adsense_quicktag_admin_print_footer_scripts');
3
+ function quick_adsense_quicktag_admin_print_footer_scripts() {
4
+ if (wp_script_is('quicktags')) {
5
+ $settings = get_option('quick_adsense_settings');
6
+ echo '<script type="text/javascript">';
7
+ if(isset($settings['enable_quicktag_buttons']) && ($settings['enable_quicktag_buttons'])) {
8
+ for($i = 1; $i <= 10; $i++) {
9
+ if(isset($settings['onpost_ad_'.$i.'_content']) && ($settings['onpost_ad_'.$i.'_content'] != '')) {
10
+ echo 'QTags.addButton("quick_adsense_quicktag_onpost_ad_'.$i.'", "Ads'.$i.'", "\n<!--Ads'.$i.'-->\n", "", "", "Ads'.$i.'", 201);';
11
+ }
12
+ }
13
+ if(!isset($settings['disable_randomads_quicktag_button']) || (!$settings['disable_randomads_quicktag_button'])) {
14
+ echo 'QTags.addButton("quick_adsense_quicktag_randomads", "RndAds", "\n<!--RndAds-->\n", "", "", "Random Ads", 201);';
15
+ }
16
+ if(!isset($settings['disable_disablead_quicktag_buttons']) || (!$settings['disable_disablead_quicktag_buttons'])) {
17
+ echo 'QTags.addButton("quick_adsense_quicktag_noads", "NoAds", "\n<!--NoAds-->\n", "", "", "No Ads", 201);';
18
+ echo 'QTags.addButton("quick_adsense_quicktag_noads", "OffDef", "\n<!--OffDef-->\n", "", "", "No Def", 201);';
19
+ echo 'QTags.addButton("quick_adsense_quicktag_noads", "OffWidget", "\n<!--OffWidget-->\n", "", "", "No AdWidgets", 201);';
20
+ }
21
+ if(!isset($settings['disable_positionad_quicktag_buttons']) || (!$settings['disable_positionad_quicktag_buttons'])) {
22
+ echo 'QTags.addButton("quick_adsense_quicktag_noads", "OffBegin", "\n<!--OffBegin-->\n", "", "", "Disable Beginning of Post Ads", 201);';
23
+ echo 'QTags.addButton("quick_adsense_quicktag_noads", "OffMiddle", "\n<!--OffMiddle-->\n", "", "", "Disable Middle of Post Ads", 201);';
24
+ echo 'QTags.addButton("quick_adsense_quicktag_noads", "OffEnd", "\n<!--OffEnd-->\n", "", "", "Disable End of Post Ads", 201);';
25
+ echo 'QTags.addButton("quick_adsense_quicktag_noads", "OffAfMore", "\n<!--OffAfMore-->\n", "", "", "OffAfMore", 201);';
26
+ echo 'QTags.addButton("quick_adsense_quicktag_noads", "OffBfLastPara", "\n<!--OffBfLastPara-->\n", "", "", "OffBfLastPara", 201);';
27
+ }
28
+ }
29
+
30
+ echo '</script>';
31
+ }
32
+ }
33
+ ?>
includes/settings.php CHANGED
@@ -1,330 +1,392 @@
1
  <?php
2
- add_action('admin_menu', 'quick_adsense_2_add_menu');
3
- function quick_adsense_2_add_menu() {
4
- $page = add_options_page('Quick Adsense Options', 'Quick Adsense', 'manage_options', 'quick-adsense-2', 'quick_adsense_2_settings_page');
 
 
 
 
5
  }
6
 
7
- add_action('admin_init', 'quick_adsense_2_admin_init');
8
- function quick_adsense_2_admin_init() {
9
- register_setting('quick_adsense_2_options', 'quick_adsense_2_options', 'quick_adsense_2_validate');
10
- add_settings_section('quick_adsense_2_main', '', 'quick_adsense_2_section_text', 'quick-adsense-2');
11
  }
12
 
13
- add_filter('plugin_action_links', 'quick_adsense_2_plugin_action_links', 10, 2);
14
- function quick_adsense_2_plugin_action_links($links, $file) {
15
- if($file == 'quick-adsense/quick-adsense.php') {
16
- array_unshift($links,'<a href="options-general.php?page=quick-adsense-2">'.__('Setting').'</a>');
17
- }
18
- return $links;
 
 
 
 
 
 
 
19
  }
20
 
21
- function quick_adsense_2_settings_page() { ?>
 
 
 
 
 
 
 
 
 
22
  <div class="wrap">
23
- <h2>Quick Adsense Setting <span style="font-size: 9pt; font-style: italic">( Version 2.2 )</span></h2>
24
- <form method="post" action="options.php" name="wp_auto_commenter_form">
25
- <?php settings_fields('quick_adsense_2_options'); ?>
26
- <?php do_settings_sections('quick-adsense-2'); ?>
27
- <?php submit_button(); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  </form>
 
 
 
 
 
 
 
29
  </div>
30
  <?php
31
  }
32
 
33
- function quick_adsense_2_section_text() {
34
- global $QData;
35
- $options = quick_adsense_2_get_options_with_defaults();
36
- ?>
37
- <script type="text/javascript">
38
- function defaultoptions() {
39
- document.getElementById("DisTot<?php echo($QData['Default']['AdsDisp']) ?>").selected = true;
40
- document.getElementById("BegnAds").checked = <?php echo(quick_adsense_2_truefalse($QData['Default']['BegnAds'])) ?>;
41
- document.getElementById("BegnRnd").selectedIndex = <?php echo($QData['Default']['BegnRnd']) ?>;
42
- document.getElementById("MiddAds").checked = <?php echo(quick_adsense_2_truefalse($QData['Default']['MiddAds'])) ?>;
43
- document.getElementById("MiddRnd").selectedIndex = <?php echo($QData['Default']['MiddRnd']) ?>;
44
- document.getElementById("EndiAds").checked = <?php echo(quick_adsense_2_truefalse($QData['Default']['EndiAds'])) ?>;
45
- document.getElementById("EndiRnd").selectedIndex = <?php echo($QData['Default']['EndiRnd']) ?>;
46
- document.getElementById("MoreAds").checked = <?php echo(quick_adsense_2_truefalse($QData['Default']['MoreAds'])) ?>;
47
- document.getElementById("MoreRnd").selectedIndex = <?php echo($QData['Default']['MoreRnd']) ?>;
48
- document.getElementById("LapaAds").checked = <?php echo(quick_adsense_2_truefalse($QData['Default']['LapaAds'])) ?>;
49
- document.getElementById("LapaRnd").selectedIndex = <?php echo($QData['Default']['LapaRnd']) ?>;
50
- <?php for ($j=1;$j<=3;$j++) { ?>
51
- document.getElementById("Par<?php echo $j; ?>Ads").checked = <?php echo(quick_adsense_2_truefalse($QData['Default']['Par'.$j.'Ads'])) ?>;
52
- document.getElementById("Par<?php echo $j; ?>Rnd").selectedIndex = <?php echo($QData['Default']['Par'.$j.'Rnd']) ?>;
53
- document.getElementById("Par<?php echo $j; ?>Nup").selectedIndex = <?php echo($QData['Default']['Par'.$j.'Nup']) ?>;
54
- document.getElementById("Par<?php echo $j; ?>Con").checked = <?php echo(quick_adsense_2_truefalse($QData['Default']['Par'.$j.'Con'])) ?>;
55
- <?php } ?>
56
- document.getElementById("Img1Ads").checked = <?php echo(quick_adsense_2_truefalse($QData['Default']['Img1Ads'])) ?>;
57
- document.getElementById("Img1Rnd").selectedIndex = <?php echo($QData['Default']['Img1Rnd']) ?>;
58
- document.getElementById("Img1Nup").selectedIndex = <?php echo($QData['Default']['Img1Nup']) ?>;
59
- document.getElementById("Img1Con").checked = <?php echo(quick_adsense_2_truefalse($QData['Default']['Img1Con'])) ?>;
60
- document.getElementById("AppHome").checked = <?php echo(quick_adsense_2_truefalse($QData['Default']['AppHome'])) ?>;
61
- document.getElementById("AppPost").checked = <?php echo(quick_adsense_2_truefalse($QData['Default']['AppPost'])) ?>;
62
- document.getElementById("AppPage").checked = <?php echo(quick_adsense_2_truefalse($QData['Default']['AppPage'])) ?>;
63
- document.getElementById("AppCate").checked = <?php echo(quick_adsense_2_truefalse($QData['Default']['AppCate'])) ?>;
64
- document.getElementById("AppArch").checked = <?php echo(quick_adsense_2_truefalse($QData['Default']['AppArch'])) ?>;
65
- document.getElementById("AppTags").checked = <?php echo(quick_adsense_2_truefalse($QData['Default']['AppTags'])) ?>;
66
- document.getElementById("AppMaxA").checked = <?php echo(quick_adsense_2_truefalse($QData['Default']['AppMaxA'])) ?>;
67
- document.getElementById("AppSide").checked = <?php echo(quick_adsense_2_truefalse($QData['Default']['AppSide'])) ?>;
68
- document.getElementById("AppLogg").checked = <?php echo(quick_adsense_2_truefalse($QData['Default']['AppLogg'])) ?>;
69
- document.getElementById("QckTags").checked = <?php echo(quick_adsense_2_truefalse($QData['Default']['QckTags'])) ?>;
70
- document.getElementById("QckRnds").checked = <?php echo(quick_adsense_2_truefalse($QData['Default']['QckRnds'])) ?>;
71
- document.getElementById("QckOffs").checked = <?php echo(quick_adsense_2_truefalse($QData['Default']['QckOffs'])) ?>;
72
- document.getElementById("QckOfPs").checked = <?php echo(quick_adsense_2_truefalse($QData['Default']['QckOfPs'])) ?>;
73
- for(i=1;i<=<?php echo($QData['Ads']) ?>;i++){
74
- tp=document.getElementById("AdsCode"+i.toString()).innerHTML;
75
- if(tp==''){
76
- document.getElementById("AdsMargin"+i.toString()).value = "<?php echo($QData['DefaultAdsOpt']['AdsMargin']) ?>";
77
- document.getElementById("OptAgn"+i.toString()+"<?php echo($QData['DefaultAdsOpt']['AdsAlign']) ?>").selected = true;
78
  }
79
- }
80
- deftcheckinfo();
81
- }
82
-
83
- function selectinfo(ts) {
84
- if (ts.selectedIndex == 0) { return; }
85
- cek = new Array(
86
- document.getElementById('BegnRnd'),
87
- document.getElementById('MiddRnd'),
88
- document.getElementById('EndiRnd'),
89
- document.getElementById('MoreRnd'),
90
- document.getElementById('LapaRnd'),
91
- document.getElementById('Par1Rnd'),
92
- document.getElementById('Par2Rnd'),
93
- document.getElementById('Par3Rnd'),
94
- document.getElementById('Img1Rnd') );
95
- for (i=0;i<cek.length;i++) {
96
- if (ts != cek[i] && ts.selectedIndex == cek[i].selectedIndex) {
97
- cek[i].selectedIndex = 0;
 
 
 
98
  }
99
- }
100
- }
101
-
102
- function checkinfo1(selnme,ts) {
103
- document.getElementById(selnme).disabled=!ts.checked;
104
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
 
106
- function checkinfo2(ts,selnm1,selnm2,selnm3,selnm4) {
107
- if(selnm1){document.getElementById(selnm1).disabled=!ts.checked};
108
- if(selnm2){document.getElementById(selnm2).disabled=!ts.checked};
109
- if(selnm3){document.getElementById(selnm3).disabled=!ts.checked};
110
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
 
112
- function deftcheckinfo() {
113
- checkinfo1('BegnRnd',document.getElementById('BegnAds'));
114
- checkinfo1('MiddRnd',document.getElementById('MiddAds'));
115
- checkinfo1('EndiRnd',document.getElementById('EndiAds'));
116
- checkinfo1('MoreRnd',document.getElementById('MoreAds'));
117
- checkinfo1('LapaRnd',document.getElementById('LapaAds'));
118
- for (i=1;i<=3;i++) {
119
- checkinfo2(document.getElementById('Par'+i+'Ads'),'Par'+i+'Rnd','Par'+i+'Nup','Par'+i+'Con');
120
- }
121
- checkinfo2(document.getElementById('Img1Ads'),'Img1Rnd','Img1Nup','Img1Con');
122
- }
123
- </script>
124
- <h3 style="font-size: 120%"><?php _e('Options'); ?></h3>
125
- <table border="0" cellspacing="0" cellpadding="0">
126
- <tr valign="top">
127
- <td style="width: 110px"><?php _e('Adsense :'); ?></td>
128
- <td><?php _e('Place up to '); ?>
129
- <?php
130
- if(!$options['AdsDisp']&&is_bool($options['AdsDisp'])) {
131
- $options['AdsDisp'] = $QData['Default']['AdsDisp'];
132
- }
133
- ?>
134
- <select name="quick_adsense_2_options[AdsDisp]" style="width: 50px; font-weight: bold;">
135
- <?php for ($i = 0; $i <= (int)$QData['Ads']; $i++) { ?>
136
- <option id="DisTot<?php echo $i; ?>" value="<?php echo $i; ?>" <?php if(isset($options['AdsDisp']) && $options['AdsDisp']==(string)$i){echo('selected');} ?>><?php echo $i; ?></option>
137
- <?php } ?>
138
- </select><?php _e(' Ads on a page.'); ?>
139
- </td>
140
- </tr>
141
- <tr valign="top">
142
- <td style="width:110px"><?php _e('Position :<br/>(Default)'); ?></td>
143
- <td>
144
- <input type="checkbox" id="BegnAds" name="quick_adsense_2_options[BegnAds]" value="true" <?php if(isset($options['BegnAds'])){echo('checked');} ?> onchange="checkinfo1('BegnRnd',this)" />
145
- <?php _e('Assign') ; ?>
146
- <select id="BegnRnd" name="quick_adsense_2_options[BegnRnd]" onchange="selectinfo(this)">
147
- <?php for ($i=0;$i<=$QData['Ads'];$i++) { ?>
148
- <option id="OptBegn<?php echo $i; ?>" value="<?php echo $i; ?>" <?php if(isset($options['BegnRnd']) && $options['BegnRnd']==(string)$i){echo('selected');} ?>><?php _e(($i==0)?'Random Ads':'Ads'.$i) ; ?></option>
149
- <?php } ?>
150
- </select>
151
- <?php _e('to <b>Beginning of Post</b>') ?><br/>
152
-
153
- <input type="checkbox" id="MiddAds" name="quick_adsense_2_options[MiddAds]" value="false" <?php if(isset($options['MiddAds'])){echo('checked');} ?> onchange="checkinfo1('MiddRnd',this)" />
154
- <?php _e('Assign') ; ?>
155
- <select id="MiddRnd" name="quick_adsense_2_options[MiddRnd]" onchange="selectinfo(this)">
156
- <?php for ($i=0;$i<=$QData['Ads'];$i++) { ?>
157
- <option id="OptMidd<?php echo $i; ?>" value="<?php echo $i; ?>" <?php if(isset($options['MiddRnd']) && $options['MiddRnd']==(string)$i){echo('selected');} ?>><?php _e(($i==0)?'Random Ads':'Ads'.$i) ; ?></option>
158
- <?php } ?>
159
- </select>
160
- <?php _e('to <b>Middle of Post</b>') ?><br/>
161
-
162
- <input type="checkbox" id="EndiAds" name="quick_adsense_2_options[EndiAds]" value="false" <?php if(isset($options['EndiAds'])){echo('checked');} ?> onchange="checkinfo1('EndiRnd',this)" />
163
- <?php _e('Assign') ; ?>
164
- <select id="EndiRnd" name="quick_adsense_2_options[EndiRnd]" onchange="selectinfo(this)">
165
- <?php for ($i=0;$i<=$QData['Ads'];$i++) { ?>
166
- <option id="OptEndi<?php echo $i; ?>" value="<?php echo $i; ?>" <?php if(isset($options['EndiRnd']) && $options['EndiRnd']==(string)$i){echo('selected');} ?>><?php _e(($i==0)?'Random Ads':'Ads'.$i) ; ?></option>
167
- <?php } ?>
168
- </select>
169
- <?php _e('to <b>End of Post</b>') ?><br/>
170
-
171
- <input type="checkbox" id="MoreAds" name="quick_adsense_2_options[MoreAds]" value="false" <?php if(isset($options['MoreAds'])){echo('checked');} ?> onchange="checkinfo1('MoreRnd',this)" />
172
- <?php _e('Assign') ; ?>
173
- <select id="MoreRnd" name="quick_adsense_2_options[MoreRnd]" onchange="selectinfo(this)">
174
- <?php for ($i=0;$i<=$QData['Ads'];$i++) { ?>
175
- <option id="OptMore<?php echo $i; ?>" value="<?php echo $i; ?>" <?php if(isset($options['MoreRnd']) && $options['MoreRnd']==(string)$i){echo('selected');} ?>><?php _e(($i==0)?'Random Ads':'Ads'.$i) ; ?></option>
176
- <?php } ?>
177
- </select>
178
- <?php _e('right after <b>the') ?>
179
- <span style="font-family:Courier New,Courier,Fixed;">&lt;!--more--&gt;</span> <?php _e('tag') ?></b><br/>
180
-
181
- <input type="checkbox" id="LapaAds" name="quick_adsense_2_options[LapaAds]" value="false" <?php if(isset($options['LapaAds'])){echo('checked');} ?> onchange="checkinfo1('LapaRnd',this)" />
182
- <?php _e('Assign') ; ?>
183
- <select id="LapaRnd" name="quick_adsense_2_options[LapaRnd]" onchange="selectinfo(this)">
184
- <?php for ($i=0;$i<=$QData['Ads'];$i++) { ?>
185
- <option id="OptLapa<?php echo $i; ?>" value="<?php echo $i; ?>" <?php if(isset($options['LapaRnd']) && $options['LapaRnd']==(string)$i){echo('selected');} ?>><?php _e(($i==0)?'Random Ads':'Ads'.$i) ; ?></option>
186
- <?php } ?>
187
- </select>
188
- <?php _e('right before <b>the last Paragraph</b>') ?><span style="color:#a00;"> <b>(New)</b></span><br/>
189
-
190
- <?php for($j = 1; $j <= 3; $j++) { ?>
191
- <input type="checkbox" id="Par<?php echo $j; ?>Ads" name="quick_adsense_2_options[Par<?php echo $j; ?>Ads]" value="false" <?php if(isset($options['Par'.$j.'Ads'])){echo('checked');} ?> onchange="checkinfo2(this,'Par<?php echo $j; ?>Rnd','Par<?php echo $j; ?>Nup','Par<?php echo $j; ?>Con')" />
192
- <?php _e('Assign') ; ?>
193
- <select id="Par<?php echo $j; ?>Rnd" name="quick_adsense_2_options[Par<?php echo $j; ?>Rnd]" onchange="selectinfo(this)">
194
- <?php for ($i = 0; $i <= $QData['Ads']; $i++) { ?>
195
- <option id="OptPar<?php echo $j; ?><?php echo $i; ?>" value="<?php echo $i; ?>" <?php if(isset($options['Par'.$j.'Rnd']) && $options['Par'.$j.'Rnd']==(string)$i){echo('selected');} ?>><?php _e(($i==0)?'Random Ads':'Ads'.$i) ; ?></option>
196
- <?php } ?>
197
- </select>
198
-
199
- <?php _e('<b>After Paragraph</b> ') ?>
200
- <select id="Par<?php echo $j; ?>Nup" name="quick_adsense_2_options[Par<?php echo $j; ?>Nup]">
201
- <?php for ($i=1;$i<=50;$i++) { ?>
202
- <option id="Opt<?php echo $j; ?>Nu<?php echo $i; ?>" value="<?php echo $i; ?>" <?php if(isset($options['Par'.$j.'Nup']) && $options['Par'.$j.'Nup']==(string)$i){echo('selected');} ?>><?php echo $i; ?></option>
203
- <?php } ?>
204
- </select> &rarr;
205
-
206
- <input type="checkbox" id="Par<?php echo $j; ?>Con" name="quick_adsense_2_options[Par<?php echo $j; ?>Con]" value="false" <?php if(isset($options['Par'.$j.'Con'])){echo('checked');} ?> />
207
- <?php _e('to <b>End of Post</b> if fewer paragraphs are found.') ; ?><br/>
208
- <?php } ?>
209
-
210
- <input type="checkbox" id="Img1Ads" name="quick_adsense_2_options[Img1Ads]" value="false" <?php if(isset($options['Img1Ads'])){echo('checked');} ?> onchange="checkinfo2(this,'Img1Rnd','Img1Nup','Img1Con')" />
211
- <?php _e('Assign') ; ?>
212
- <select id="Img1Rnd" name="quick_adsense_2_options[Img1Rnd]" onchange="selectinfo(this)">
213
- <?php for ($i = 0; $i <= $QData['Ads']; $i++) { ?>
214
- <option id="OptImg1<?php echo $i; ?>" value="<?php echo $i; ?>" <?php if(isset($options['Img1Rnd']) && $options['Img1Rnd']==(string)$i){echo('selected');} ?>><?php _e(($i==0)?'Random Ads':'Ads'.$i) ; ?></option>
215
- <?php } ?>
216
- </select>
217
- <?php _e('<b>After Image</b> ') ?>
218
- <select id="Img1Nup" name="quick_adsense_2_options[Img1Nup]">
219
- <?php for ($i = 1; $i <= 50; $i++) { ?>
220
- <option id="Opt1Im<?php echo $i; ?>" value="<?php echo $i; ?>" <?php if(isset($options['Img1Nup']) && $options['Img1Nup']==(string)$i){echo('selected');} ?>><?php echo $i; ?></option>
221
- <?php } ?>
222
- </select> &rarr;
223
- <input type="checkbox" id="Img1Con" name="quick_adsense_2_options[Img1Con]" value="false" <?php if(isset($options['Img1Con'])){echo('checked');} ?> />
224
- <?php _e('after <b>Image&#39;s outer</b>'); ?>
225
- <b><span style="font-family:Courier New,Courier,Fixed;"> &lt;div&gt; wp-caption</span></b> if any.<span style="color:#a00;"> <b>(New)</b></span><br/><br/>
226
- <script type="text/javascript">deftcheckinfo();</script>
227
- </td>
228
- </tr>
229
- <tr valign="top">
230
- <td style="width:110px"><?php _e('Appearance :'); ?></td>
231
- <td>
232
- <span>[ </span>
233
- <input type="checkbox" id="AppPost" name="quick_adsense_2_options[AppPost]" value="true" <?php if(isset($options['AppPost'])){echo('checked');} ?> /> <?php _e('Posts'); ?>
234
- <input type="checkbox" id="AppPage" name="quick_adsense_2_options[AppPage]" value="true" <?php if(isset($options['AppPage'])){echo('checked');} ?> /> <?php _e('Pages'); ?>
235
- <span> ]</span><br/>
236
- <span>[ </span>
237
- <input type="checkbox" id="AppHome" name="quick_adsense_2_options[AppHome]" value="true" <?php if(isset($options['AppHome'])){echo('checked');} ?> /> <?php _e('Homepage'); ?>
238
- <input type="checkbox" id="AppCate" name="quick_adsense_2_options[AppCate]" value="true" <?php if(isset($options['AppCate'])){echo('checked');} ?> /> <?php _e('Categories'); ?>
239
- <input type="checkbox" id="AppArch" name="quick_adsense_2_options[AppArch]" value="true" <?php if(isset($options['AppArch'])){echo('checked');} ?> /> <?php _e('Archives'); ?>
240
- <input type="checkbox" id="AppTags" name="quick_adsense_2_options[AppTags]" value="true" <?php if(isset($options['AppTags'])){echo('checked');} ?> /> <?php _e('Tags'); ?>
241
- <span> ] &rarr; </span>
242
- <input type="checkbox" id="AppMaxA" name="quick_adsense_2_options[AppMaxA]" value="true" <?php if(isset($options['AppMaxA'])){echo('checked');} ?> /> <?php _e('Place all possible Ads on these pages.'); ?><br/>
243
- <span>[ </span>
244
- <input type="checkbox" id="AppSide" name="quick_adsense_2_options[AppSide]" value="true" <?php if(isset($options['AppSide'])){echo('checked');} ?> /> <?php _e('Disable AdsWidget on Homepage'); ?>
245
- <span> ]</span><br/>
246
- <span>[ </span>
247
- <input type="checkbox" id="AppLogg" name="quick_adsense_2_options[AppLogg]" value="true" <?php if(isset($options['AppLogg'])){echo('checked');} ?> /> <?php _e('Hide Ads when user is logged in to Wordpress'); ?>
248
- <span> ]</span><br/><br/>
249
- </td>
250
- </tr>
251
- <tr valign="top">
252
- <td style="width:110px"><?php _e('Quicktag :'); ?></td>
253
- <td>
254
- <span style="display:block;font-style:normal;padding-bottom:0px"><?php _e('Insert Ads into a post, on-the-fly :'); ?></span>
255
- <ol style="margin-top:5px;">
256
- <li><?php _e('Insert <span style="font-family:Courier New,Courier,Fixed;color:#050">&lt;!--Ads1--&gt;</span>, <span style="font-family:Courier New,Courier,Fixed;color:#050">&lt;!--Ads2--&gt;</span>, etc. into a post to show the <b>Particular Ads</b> at specific location.'); ?></li>
257
- <li><?php _e('Insert <span style="font-family:Courier New,Courier,Fixed;color:#050">&lt;!--RndAds--&gt;</span> (or more) into a post to show the <b>Random Ads</b> at specific location.'); ?></li>
258
- </ol>
259
- <span style="display:block;font-style:normal;padding-bottom:0px"><?php _e('Disable Ads in a post, on-the-fly :'); ?></span>
260
- <ol style="margin-top:5px;">
261
- <li><?php _e('Insert <span style="font-family:Courier New,Courier,Fixed;color:#050">&lt;!--NoAds--&gt;</span> to <b>disable all Ads</b> in a post.'); ?><span class="description" style="font-style:italic"><?php _e(' (does not affect Ads on Sidebar)'); ?></span></li>
262
- <li><?php _e('Insert <span style="font-family:Courier New,Courier,Fixed;color:#050">&lt;!--OffDef--&gt;</span> to <b>disable the default positioned Ads</b>, and use <span style="font-family:Courier New,Courier,Fixed;">&lt;!--Ads1--&gt;</span>, <span style="font-family:Courier New,Courier,Fixed;">&lt;!--Ads2--&gt;</span>, etc. to insert Ads.'); ?><span class="description" style="font-style:italic"><?php _e(' (does not affect Ads on Sidebar)'); ?></span></li>
263
- <li><?php _e('Insert <span style="font-family:Courier New,Courier,Fixed;color:#050">&lt;!--OffWidget--&gt;</span> to <b>disable all Ads on Sidebar</b>.'); ?><span style="color:#a00;"> <b>(New)</b></span></li>
264
- <li><?php _e('Insert <span style="font-family:Courier New,Courier,Fixed;color:#050">&lt;!--OffBegin--&gt;</span>, <span style="font-family:Courier New,Courier,Fixed;color:#050">&lt;!--OffMiddle--&gt;</span>, <span style="font-family:Courier New,Courier,Fixed;color:#050">&lt;!--OffEnd--&gt;</span> to <b>disable Ads at Beginning, Middle</b> or <b>End of Post</b>.'); ?><span style="color:#a00;"> <b>(New)</b></span></li>
265
- <li><?php _e('Insert <span style="font-family:Courier New,Courier,Fixed;color:#050">&lt;!--OffAfMore--&gt;</span>, <span style="font-family:Courier New,Courier,Fixed;color:#050">&lt;!--OffBfLastPara--&gt;</span> to <b>disable Ads right after the <span style="font-family:Courier New,Courier,Fixed;">&lt;!--more--&gt;</span> tag</b>, or <b>right before the last Paragraph</b>.'); ?><span style="color:#a00;"> <b>(New)</b></span></li>
266
- </ol>
267
- [ <input type="checkbox" id="QckTags" name="quick_adsense_2_options[QckTags]" value="true" <?php if(isset($options['QckTags'])){echo('checked');} ?> /> <?php _e('Show Quicktag Buttons on the HTML Edit Post SubPanel'); ?> ]<br/>
268
- [ <input type="checkbox" id="QckRnds" name="quick_adsense_2_options[QckRnds]" value="true" <?php if(isset($options['QckRnds'])){echo('checked');} ?> /> <?php _e('Hide <span style="font-family:Courier New,Courier,Fixed;color:#050">&lt;!--RndAds--&gt;</span> from Quicktag Buttons'); ?> ]<br/>
269
- [ <input type="checkbox" id="QckOffs" name="quick_adsense_2_options[QckOffs]" value="true" <?php if(isset($options['QckOffs'])){echo('checked');} ?> /> <?php _e('Hide <span style="font-family:Courier New,Courier,Fixed;color:#050">&lt;!--NoAds--&gt;</span>, <span style="font-family:Courier New,Courier,Fixed;color:#050">&lt;!--OffDef--&gt;</span>, <span style="font-family:Courier New,Courier,Fixed;color:#050">&lt;!--OffWidget--&gt;</span> from Quicktag Buttons'); ?> ]<br/>
270
- [ <input type="checkbox" id="QckOfPs" name="quick_adsense_2_options[QckOfPs]" value="true" <?php if(isset($options['QckOfPs'])){echo('checked');} ?> /> <?php _e('Hide <span style="font-family:Courier New,Courier,Fixed;color:#050">&lt;!--OffBegin--&gt;</span>, <span style="font-family:Courier New,Courier,Fixed;color:#050">&lt;!--OffMiddle--&gt;</span>, <span style="font-family:Courier New,Courier,Fixed;color:#050">&lt;!--OffEnd--&gt;</span>, <span style="font-family:Courier New,Courier,Fixed;color:#050">&lt;!--OffAfMore--&gt;</span>, <span style="font-family:Courier New,Courier,Fixed;color:#050">&lt;!--OffBfLastPara--&gt;</span> from Quicktag Buttons'); ?> ]<br/>
271
- <span class="description" style="display:block;font-style:italic;padding-top:10px"><?php _e('Tags can be inserted into a post via the additional Quicktag Buttons at the HTML Edit Post SubPanel.'); ?></span><br/>
272
- </td>
273
- </tr>
274
- <tr valign="top">
275
- <td style="width:110px"><?php _e('Infomation :'); ?></td>
276
- <td>
277
- <span><?php echo(__('A link from your blog to <a href="http://quickadsense.com/" target="_blank">http://quickadsense.com/</a> would be appreciated.')); ?></span>
278
- </td>
279
- </tr>
280
- </table>
281
- <p style="margin-top:20px">( <a href="javascript:defaultoptions()"><?php _e('Load Default Setting') ?></a> )<br/><br/></p>
282
 
283
- <h3 style="font-size:120%;margin-bottom:5px"><?php _e('Adsense Codes'); ?></h3>
284
- <p style="margin-top:0px"><span class="description"><?php _e('Paste up to <b>'.$QData['Ads'].' Ads codes</b> on Post Body as assigned above, and up to <b>'.$QData['AdsWid'].' Ads codes</b> on Sidebar Widget. Ads codes provided must <b>not</b> be identical, repeated codes may result the Ads not being display correctly. Ads will never displays more than once in a page.') ?></span></p>
 
 
 
 
 
 
285
 
286
- <h4><?php _e('Ads on Post Body :'); ?></h4>
287
- <table border="0" cellspacing="0" cellpadding="0">
288
- <?php for ($i = 1; $i <= $QData['Ads']; $i++) { ?>
289
- <tr valign="top">
290
- <td align="left" style="width:110px">Ads<?php echo $i; ?> :</td>
291
- <td align="left"><textarea style="margin:0 5px 3px 0" id="AdsCode<?php echo $i; ?>" name="quick_adsense_2_options[AdsCode<?php echo $i; ?>]" rows="3" cols="50"><?php echo htmlentities($options['AdsCode'.$i]); ?></textarea></td>
292
- <td align="left">
293
- <select name="quick_adsense_2_options[AdsAlign<?php echo $i; ?>]">
294
- <option id="OptAgn<?php echo $i; ?>1" value="1" <?php if(isset($options['AdsAlign'.$i]) && $options['AdsAlign'.$i]=="1"){echo('selected');} ?>><?php _e('Left') ; ?></option>
295
- <option id="OptAgn<?php echo $i; ?>2" value="2" <?php if(isset($options['AdsAlign'.$i]) && $options['AdsAlign'.$i]=="2"){echo('selected');} ?>><?php _e('Center') ; ?></option>
296
- <option id="OptAgn<?php echo $i; ?>3" value="3" <?php if(isset($options['AdsAlign'.$i]) && $options['AdsAlign'.$i]=="3"){echo('selected');} ?>><?php _e('Right') ; ?></option>
297
- <option id="OptAgn<?php echo $i; ?>4" value="4" <?php if(isset($options['AdsAlign'.$i]) && $options['AdsAlign'.$i]=="4"){echo('selected');} ?>><?php _e('None') ; ?></option>
298
- </select>
299
- <?php _e('alignment'); ?><br/>
300
- <input style="width:35px;text-align:right;" id="AdsMargin<?php echo $i; ?>" name="quick_adsense_2_options[AdsMargin<?php echo $i; ?>]" value="<?php echo stripslashes(htmlspecialchars($options['AdsMargin'.$i])); ?>" />px <?php _e('margin'); ?><br/>
301
- </td>
302
- </tr>
303
- <?php } ?>
304
- </table>
 
 
 
 
 
 
305
 
306
- <h4><?php _e('Ads on Sidebar Widget '); ?><span style="font-weight:normal">(<a href="widgets.php"><?php _e('Drag to Sidebar'); ?></a>)</span> :</h4>
307
- <table border="0" cellspacing="0" cellpadding="0">
308
- <?php
309
- for ($i=1;$i<=$QData['AdsWid'];$i++) { ?>
310
- <tr valign="top">
311
- <td align="left" style="width:110px">AdsWidget<?php echo $i; ?> :</td>
312
- <td align="left"><textarea style="margin:0 5px 3px 0" id="WidCode<?php echo $i; ?>" name="quick_adsense_2_options[WidCode<?php echo $i; ?>]" rows="3" cols="50"><?php echo htmlentities($options['WidCode'.$i]); ?></textarea></td>
313
- </tr>
314
- <?php } ?>
315
- </table>
316
- <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
317
  }
318
 
319
- function quick_adsense_2_truefalse($arg) {
320
- if($arg){
321
- return 'true';
322
- } else {
323
- return 'false';
 
 
 
 
 
 
324
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
325
  }
326
 
327
- function quick_adsense_2_validate($input) {
 
328
  return $input;
329
  }
330
  ?>
1
  <?php
2
+ add_action('plugin_action_links_quick-adsense/quick-adsense.php', 'quick_adsense_action_links');
3
+ function quick_adsense_action_links($links) {
4
+ $links = array_merge(
5
+ array('<a href="'.esc_url(admin_url('/admin.php?page=quick-adsense')).'">Settings</a>'),
6
+ $links
7
+ );
8
+ return $links;
9
  }
10
 
11
+ add_action('admin_menu', 'quick_adsense_add_menu');
12
+ function quick_adsense_add_menu() {
13
+ add_menu_page('Quick Adsense Options', 'Quick Adsense', 'manage_options', 'quick-adsense', 'quick_adsense_settings_page');
 
14
  }
15
 
16
+ add_action('admin_enqueue_scripts', 'quick_adsense_admin_enqueue_scripts');
17
+ function quick_adsense_admin_enqueue_scripts($hook) {
18
+ if($hook != 'toplevel_page_quick-adsense') {
19
+ return;
20
+ }
21
+ wp_register_script('quick-adsense-minicolors', plugins_url('/js/jquery.minicolors.js', __FILE__), array('jquery', 'jquery-ui-core'));
22
+ wp_enqueue_script('quick-adsense-minicolors');
23
+ wp_register_script('quick-adsense-chart-js', plugins_url('/js/Chart.bundle.min.js', __FILE__), array('jquery', 'jquery-ui-core', 'jquery-ui-accordion', 'jquery-ui-dialog'));
24
+ wp_enqueue_script('quick-adsense-chart-js');
25
+ wp_register_style('quick-adsense-jquery-ui', 'https://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css');
26
+ wp_enqueue_style('quick-adsense-jquery-ui');
27
+ wp_enqueue_style('quick_adsense_admin_css', plugins_url('/css/admin.css', __FILE__));
28
+ wp_enqueue_script('quick_adsense_admin_js', plugins_url('/js/admin.js', __FILE__), array('jquery', 'jquery-ui-core', 'jquery-ui-tabs'));
29
  }
30
 
31
+ add_action('admin_init', 'quick_adsense_admin_init');
32
+ function quick_adsense_admin_init() {
33
+ register_setting('quick_adsense_settings', 'quick_adsense_settings', 'quick_adsense_validate');
34
+ add_settings_section('quick_adsense_vi', '', 'quick_adsense_vi_plugin_card', 'quick-adsense-vi');
35
+ add_settings_section('quick_adsense_general', '', 'quick_adsense_general_content', 'quick-adsense-general');
36
+ add_settings_section('quick_adsense_onpost', '', 'quick_adsense_onpost_content', 'quick-adsense-onpost');
37
+ add_settings_section('quick_adsense_widgets', '', 'quick_adsense_widgets_content', 'quick-adsense-widgets');
38
+ }
39
+
40
+ function quick_adsense_settings_page() { ?>
41
  <div class="wrap">
42
+ <h2 id="quick_adsense_title">Quick Adsense Setting <span style="font-size: 14px;">(Version 2.3)</span></h2>
43
+ <form id="quick_adsense_settings_form" method="post" action="options.php" name="wp_auto_commenter_form" style="display: none;">
44
+ <?php settings_fields('quick_adsense_settings'); ?>
45
+ <div id="quick_adsense_settings_tabs">
46
+ <ul>
47
+ <li><a href="#tabs-settings">Settings</a></li>
48
+ <li><a href="#tabs-vi"> Monetization with vi stories </a></li>
49
+ </ul>
50
+ <div id="tabs-settings">
51
+ <div id="quick_adsense_top_sections_wrapper">
52
+ <?php do_settings_sections('quick-adsense-general'); ?>
53
+ </div>
54
+ <div id="quick_adsense_bottom_sections_wrapper">
55
+ <div id="quick_adsense_bottom_left_section_wrapper">
56
+ <?php do_settings_sections('quick-adsense-onpost'); ?>
57
+ </div>
58
+ <div id="quick_adsense_bottom_right_section_wrapper">
59
+ <?php do_settings_sections('quick-adsense-widgets'); ?>
60
+ </div>
61
+ <div class="clear"></div>
62
+ </div>
63
+ <?php submit_button('Save Changes'); ?>
64
+ </div>
65
+ <div id="tabs-vi">
66
+ <?php do_settings_sections('quick-adsense-vi'); ?>
67
+ </div>
68
+ </div>
69
  </form>
70
+ <input type="hidden" id="quick_adsense_admin_ajax" name="quick_adsense_admin_ajax" value="<?php echo admin_url('admin-ajax.php'); ?>" />
71
+ <input type="hidden" id="quick_adsense_nonce" name="quick_adsense_nonce" value="<?php echo wp_create_nonce('quick-adsense'); ?>" />
72
+ <script type="text/javascript">
73
+ jQuery(document).ready(function() {
74
+ jQuery("#quick_adsense_settings_tabs").tabs();
75
+ });
76
+ </script>
77
  </div>
78
  <?php
79
  }
80
 
81
+ function quick_adsense_vi_plugin_card() {
82
+ echo '<div class="quick_adsense_vi_block">';
83
+ if(quick_adsense_vi_api_is_loggedin()) {
84
+ quick_adsense_vi_plugin_card_content(true);
85
+ } else {
86
+ quick_adsense_vi_plugin_card_content(false);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  }
88
+ echo '</div>';
89
+ }
90
+
91
+ function quick_adsense_general_content() {
92
+ $settings = get_option('quick_adsense_settings');
93
+ echo '<div class="quick_adsense_block">';
94
+ echo '<div class="quick_adsense_block_labels">';
95
+ echo '<span>Options</span>';
96
+ echo '</div>';
97
+ echo '<div class="quick_adsense_block_controls">';
98
+ echo '<a id="quick_adsense_settings_reset_to_default" href="javascript:;">Reset to Default Settings</a>';
99
+ echo '</div>';
100
+ echo '<div class="clear"></div>';
101
+
102
+ echo '<div class="quick_adsense_block_labels">';
103
+ echo 'Adsense';
104
+ echo '</div>';
105
+ echo '<div class="quick_adsense_block_controls">';
106
+ echo 'Place up to';
107
+ $maxAdsCount = array();
108
+ for($i = 0; $i <= 10; $i++) {
109
+ $maxAdsCount[] = array('text' => $i, 'value' => $i);
110
  }
111
+ echo quickadsense_get_control('select', '', 'quick_adsense_settings_max_ads_per_page', 'quick_adsense_settings[max_ads_per_page]', ((isset($settings['max_ads_per_page']))?$settings['max_ads_per_page']:''), $maxAdsCount, 'input', 'margin: -2px 10px 0 40px;');
112
+ echo 'Ads on a page';
113
+ echo '</div>';
114
+ echo '<div class="clear"></div>';
115
+ echo '<div class="clear"></div>';
116
+ echo '<div class="quick_adsense_block_labels">';
117
+ echo 'Assign position<br />(Default)';
118
+ echo '</div>';
119
+ echo '<div class="quick_adsense_block_controls">';
120
+ $adPositions = array(
121
+ array('text' => 'Random Ads', 'value' => '0')
122
+ );
123
+ $viSupportedAdPosition = array(
124
+ array('text' => 'Random Ads', 'value' => '0'),
125
+ array('text' => 'vi stories', 'value' => '100'),
126
+ );
127
+ for($i = 1; $i <= 10; $i++) {
128
+ $adPositions[] = array('text' => 'Ads'.$i, 'value' => $i);
129
+ $viSupportedAdPosition[] = array('text' => 'Ads'.$i, 'value' => $i);
130
+ }
131
+
132
+ $elementCount = array();
133
+ for($i = 1; $i <= 50; $i++) {
134
+ $elementCount[] = array('text' => $i, 'value' => $i);
135
+ }
136
+ echo '<p>';
137
+ echo quickadsense_get_control('checkbox', '', 'quick_adsense_settings_enable_position_beginning_of_post', 'quick_adsense_settings[enable_position_beginning_of_post]', ((isset($settings['enable_position_beginning_of_post']))?$settings['enable_position_beginning_of_post']:''), null, 'input', '');
138
+ echo quickadsense_get_control('select', '', 'quick_adsense_settings_ad_beginning_of_post', 'quick_adsense_settings[ad_beginning_of_post]', ((isset($settings['ad_beginning_of_post']))?$settings['ad_beginning_of_post']:''), $viSupportedAdPosition, 'input quick_adsense_vi_supported_ad_position', 'margin: -2px 10px 0 20px;');
139
+ echo '<b style="width: 120px; display: inline-block;">Beginning of Post</b>';
140
+ echo '<span style="color: #FF2800;">NEW: vi stories</span>';
141
+ echo '</p>';
142
+ echo '<p>';
143
+ echo quickadsense_get_control('checkbox', '', 'quick_adsense_settings_enable_position_middle_of_post', 'quick_adsense_settings[enable_position_middle_of_post]', ((isset($settings['enable_position_middle_of_post']))?$settings['enable_position_middle_of_post']:''), null, 'input', '');
144
+ echo quickadsense_get_control('select', '', 'quick_adsense_settings_ad_middle_of_post', 'quick_adsense_settings[ad_middle_of_post]', ((isset($settings['ad_middle_of_post']))?$settings['ad_middle_of_post']:''), $viSupportedAdPosition, 'input quick_adsense_vi_supported_ad_position', 'margin: -2px 10px 0 20px;');
145
+ echo '<b style="width: 120px; display: inline-block;">Middle of Post</b>';
146
+ echo '<span style="color: #FF2800;">NEW: vi stories</span>';
147
+ echo '</p>';
148
+ echo '<p>';
149
+ echo quickadsense_get_control('checkbox', '', 'quick_adsense_settings_enable_position_end_of_post', 'quick_adsense_settings[enable_position_end_of_post]', ((isset($settings['enable_position_end_of_post']))?$settings['enable_position_end_of_post']:''), null, 'input', '');
150
+ echo quickadsense_get_control('select', '', 'quick_adsense_settings_ad_end_of_post', 'quick_adsense_settings[ad_end_of_post]', ((isset($settings['ad_end_of_post']))?$settings['ad_end_of_post']:''), $adPositions, 'input', 'margin: -2px 10px 0 20px;');
151
+ echo '<b>End of Post</b>';
152
+ echo '</p>';
153
+ echo '<div class="clear"></div>';
154
+ echo '<p>';
155
+ echo quickadsense_get_control('checkbox', '', 'quick_adsense_settings_enable_position_after_more_tag', 'quick_adsense_settings[enable_position_after_more_tag]', ((isset($settings['enable_position_after_more_tag']))?$settings['enable_position_after_more_tag']:''), null, 'input', '');
156
+ echo quickadsense_get_control('select', '', 'quick_adsense_settings_ad_after_more_tag', 'quick_adsense_settings[ad_after_more_tag]', ((isset($settings['ad_after_more_tag']))?$settings['ad_after_more_tag']:''), $adPositions, 'input', 'margin: -2px 10px 0 20px;');
157
+ echo 'right after <b>the &lt;!--more--&gt; tag</b>';
158
+ echo '</p>';
159
+ echo '<p>';
160
+ echo quickadsense_get_control('checkbox', '', 'quick_adsense_settings_enable_position_before_last_para', 'quick_adsense_settings[enable_position_before_last_para]', ((isset($settings['enable_position_before_last_para']))?$settings['enable_position_before_last_para']:''), null, 'input', '');
161
+ echo quickadsense_get_control('select', '', 'quick_adsense_settings_ad_before_last_para', 'quick_adsense_settings[ad_before_last_para]', ((isset($settings['ad_before_last_para']))?$settings['ad_before_last_para']:''), $adPositions, 'input', 'margin: -2px 10px 0 20px;');
162
+ echo 'right before <b>the last Paragraph</b>';
163
+ echo '</p>';
164
+ echo '<div class="clear"></div>';
165
+ for($i = 1; $i <= 3; $i++) {
166
+ echo '<p>';
167
+ echo quickadsense_get_control('checkbox', '', 'quick_adsense_settings_enable_position_after_para_option_'.$i, 'quick_adsense_settings[enable_position_after_para_option_'.$i.']', ((isset($settings['enable_position_after_para_option_'.$i]))?$settings['enable_position_after_para_option_'.$i]:''), null, 'input', '');
168
+ echo quickadsense_get_control('select', '', 'quick_adsense_settings_ad_after_para_option_'.$i, 'quick_adsense_settings[ad_after_para_option_'.$i.']', ((isset($settings['ad_after_para_option_'.$i]))?$settings['ad_after_para_option_'.$i]:''), $adPositions, 'input', 'margin: -2px 10px 0 20px;');
169
+ echo '<span style="width: 110px;display: inline-block;"><b>after Paragraph</b></span>';
170
+ echo quickadsense_get_control('select', '', 'quick_adsense_settings_position_after_para_option_'.$i, 'quick_adsense_settings[position_after_para_option_'.$i.']', ((isset($settings['position_after_para_option_'.$i]))?$settings['position_after_para_option_'.$i]:''), $elementCount, 'input', 'margin: -2px 10px 0 10px;');
171
+ echo 'repeat';
172
+ echo quickadsense_get_control('checkbox', '', 'quick_adsense_settings_enable_jump_position_after_para_option_'.$i, 'quick_adsense_settings[enable_jump_position_after_para_option_'.$i.']', ((isset($settings['enable_jump_position_after_para_option_'.$i]))?$settings['enable_jump_position_after_para_option_'.$i]:''), null, 'input', 'margin: -1px 10px 0;');
173
+ echo '<b>to End of Post</b> if fewer paragraphs are found';
174
+ echo '</p>';
175
+ }
176
+ echo '<div class="clear"></div>';
177
+ for($i = 1; $i <= 1; $i++) {
178
+ echo '<p>';
179
+ echo quickadsense_get_control('checkbox', '', 'quick_adsense_settings_enable_position_after_image_option_'.$i, 'quick_adsense_settings[enable_position_after_image_option_'.$i.']', ((isset($settings['enable_position_after_image_option_'.$i]))?$settings['enable_position_after_image_option_'.$i]:''), null, 'input', '');
180
+ echo quickadsense_get_control('select', '', 'quick_adsense_settings_ad_after_image_option_'.$i, 'quick_adsense_settings[ad_after_image_option_'.$i.']', ((isset($settings['ad_after_image_option_'.$i]))?$settings['ad_after_image_option_'.$i]:''), $adPositions, 'input', 'margin: -2px 10px 0 20px;');
181
+ echo '<span style="width: 110px;display: inline-block;">after Image</span>';
182
+ echo quickadsense_get_control('select', '', 'quick_adsense_settings_position_after_image_option_'.$i, 'quick_adsense_settings[position_after_image_option_'.$i.']', ((isset($settings['position_after_image_option_'.$i]))?$settings['position_after_image_option_'.$i]:''), $elementCount, 'input', 'margin: -2px 10px 0 10px;');
183
+ echo 'repeat';
184
+ echo quickadsense_get_control('checkbox', '', 'quick_adsense_settings_enable_jump_position_after_image_option_'.$i, 'quick_adsense_settings[enable_jump_position_after_image_option_'.$i.']', ((isset($settings['enable_jump_position_after_image_option_'.$i]))?$settings['enable_jump_position_after_image_option_'.$i]:''), null, 'input', 'margin: -1px 10px 0;');
185
+ echo 'after <b>Image\'s outer &lt;div&gt; wp-caption</b> if any';
186
+ echo '</p>';
187
+ }
188
+ echo '</div>';
189
+ echo '<div class="clear"></div>';
190
+ echo '</div>';
191
 
192
+ echo '<div class="quick_adsense_block">';
193
+ echo '<div class="quick_adsense_block_labels">';
194
+ echo 'Appearance';
195
+ echo '</div>';
196
+ echo '<div class="quick_adsense_block_controls">';
197
+ echo '<p>';
198
+ echo '<span>'.quickadsense_get_control('checkbox', '<b id="quick_adsense_settings_enable_on_posts_label">Posts</b>', 'quick_adsense_settings_enable_on_posts', 'quick_adsense_settings[enable_on_posts]', ((isset($settings['enable_on_posts']))?$settings['enable_on_posts']:''), null, 'input', 'margin: -1px 10px 0 0;').'</span>';
199
+ echo '<span>'.quickadsense_get_control('checkbox', '<b id="quick_adsense_settings_enable_on_pages_label">Pages</b>', 'quick_adsense_settings_enable_on_pages', 'quick_adsense_settings[enable_on_pages]', ((isset($settings['enable_on_pages']))?$settings['enable_on_pages']:''), null, 'input', 'margin: -1px 10px 0 15px;').'</span>';
200
+ echo '</p>';
201
+ echo '<p>';
202
+ echo '<span>'.quickadsense_get_control('checkbox', '<b id="quick_adsense_settings_enable_on_homepage_label">Homepage</b>', 'quick_adsense_settings_enable_on_homepage', 'quick_adsense_settings[enable_on_homepage]', ((isset($settings['enable_on_homepage']))?$settings['enable_on_homepage']:''), null, 'input', 'margin: -1px 10px 0 0;').'</span>';
203
+ echo '<span>'.quickadsense_get_control('checkbox', '<b id="quick_adsense_settings_enable_on_categories_label">Categories</b>', 'quick_adsense_settings_enable_on_categories', 'quick_adsense_settings[enable_on_categories]', ((isset($settings['enable_on_categories']))?$settings['enable_on_categories']:''), null, 'input', 'margin: -1px 10px 0 15px;').'</span>';
204
+ echo '<span>'.quickadsense_get_control('checkbox', '<b id="quick_adsense_settings_enable_on_archives_label">Archives</b>', 'quick_adsense_settings_enable_on_archives', 'quick_adsense_settings[enable_on_archives]', ((isset($settings['enable_on_archives']))?$settings['enable_on_archives']:''), null, 'input', 'margin: -1px 10px 0 15px;').'</span>';
205
+ echo '<span>'.quickadsense_get_control('checkbox', '<b id="quick_adsense_settings_enable_on_tags_label">Tags</b>', 'quick_adsense_settings_enable_on_tags', 'quick_adsense_settings[enable_on_tags]', ((isset($settings['enable_on_tags']))?$settings['enable_on_tags']:''), null, 'input', 'margin: -1px 10px 0 15px;').'</span>';
206
+ echo '<span>'.quickadsense_get_control('checkbox', '<b id="quick_adsense_settings_enable_all_possible_ads_label">Place all possible Ads on these pages</b>', 'quick_adsense_settings_enable_all_possible_ads', 'quick_adsense_settings[enable_all_possible_ads]', ((isset($settings['enable_all_possible_ads']))?$settings['enable_all_possible_ads']:''), null, 'input', 'margin: -1px 10px 0 35px;').'</span>';
207
+ echo '</p>';
208
+ echo '<p>';
209
+ echo '<span>'.quickadsense_get_control('checkbox', '<b id="quick_adsense_settings_disable_widgets_on_homepage_label">Disable AdsWidget on Homepage</b>', 'quick_adsense_settings_disable_widgets_on_homepage', 'quick_adsense_settings[disable_widgets_on_homepage]', ((isset($settings['disable_widgets_on_homepage']))?$settings['disable_widgets_on_homepage']:''), null, 'input', 'margin: -1px 10px 0 0;').'</span>';
210
+ echo '</p>';
211
+ echo '<p>';
212
+ echo '<span>'.quickadsense_get_control('checkbox', '<b id="quick_adsense_settings_disable_for_loggedin_users_label">Hide Ads when user is logged in to Wordpress</b>', 'quick_adsense_settings_disable_for_loggedin_users', 'quick_adsense_settings[disable_for_loggedin_users]', ((isset($settings['disable_for_loggedin_users']))?$settings['disable_for_loggedin_users']:''), null, 'input', 'margin: -1px 10px 0 0;').'</span>';
213
+ echo '</p>';
214
+ echo '</div>';
215
+ echo '<div class="clear"></div>';
216
+ echo '</div>';
217
 
218
+ echo '<div class="quick_adsense_block">';
219
+ echo '<div class="quick_adsense_block_labels">';
220
+ echo 'Quicktag';
221
+ echo '</div>';
222
+ echo '<div class="quick_adsense_block_controls">';
223
+ echo '<p>';
224
+ echo quickadsense_get_control('checkbox', '<b>Show Quicktag Buttons on the HTML Edit Post SubPanel</b>', 'quick_adsense_settings_enable_quicktag_buttons', 'quick_adsense_settings[enable_quicktag_buttons]', ((isset($settings['enable_quicktag_buttons']))?$settings['enable_quicktag_buttons']:''), null, 'input', 'margin: -1px 10px 0 0;');
225
+ echo '</p>';
226
+ echo '<p>';
227
+ echo quickadsense_get_control('checkbox', 'Hide <b>&lt;!--RndAds--&gt;</b> from Quicktag Buttons', 'quick_adsense_settings_disable_randomads_quicktag_button', 'quick_adsense_settings[disable_randomads_quicktag_button]', ((isset($settings['disable_randomads_quicktag_button']))?$settings['disable_randomads_quicktag_button']:''), null, 'input', 'margin: -1px 10px 0 0;');
228
+ echo '</p>';
229
+ echo '<p>';
230
+ echo quickadsense_get_control('checkbox', 'Hide <b>&lt;!--NoAds--&gt;</b>, <b>&lt;!--OffDef--&gt;</b>, <b>&lt;!--OffWidget--&gt;</b> from Quicktag Buttons', 'quick_adsense_settings_disable_disablead_quicktag_buttons', 'quick_adsense_settings[disable_disablead_quicktag_buttons]', ((isset($settings['disable_disablead_quicktag_buttons']))?$settings['disable_disablead_quicktag_buttons']:''), null, 'input', 'margin: -1px 10px 0 0;');
231
+ echo '</p>';
232
+ echo '<p>';
233
+ echo quickadsense_get_control('checkbox', 'Hide <b>&lt;!--OffBegin--&gt;</b>, <b>&lt;!--OffMiddle--&gt;</b>, <b>&lt;!--OffEnd--&gt;</b>, <b>&lt;!--OffAfMore--&gt;</b>, <b>&lt;!--OffBfLastPara--&gt;</b> from Quicktag Buttons', 'quick_adsense_settings_disable_positionad_quicktag_buttons', 'quick_adsense_settings[disable_positionad_quicktag_buttons]', ((isset($settings['disable_positionad_quicktag_buttons']))?$settings['disable_positionad_quicktag_buttons']:''), null, 'input', 'margin: -1px 10px 0 0;');
234
+ echo '</p>';
235
+ echo '<div class="clear"></div>';
236
+ echo 'Insert Ads into a post, on-the-fly:';
237
+ echo '<ol>';
238
+ echo '<li>Insert <b>&lt;!--Ads1--&gt;</b>, <b>&lt;!--Ads2--&gt;</b> etc. into a post to show the <b>Particular Ads</b> at specific location.</li>';
239
+ echo '<li>Insert <b>&lt;!--RndAds--&gt;</b> (or more) into a post to show the <b>Random Ads</b> at specific location.</li>';
240
+ echo '</ol>';
241
+ echo '<div class="clear"></div>';
242
+ echo 'Disable Ads in a post, on-the-fly:';
243
+ echo '<ol>';
244
+ echo '<li>Insert <b><!--NoAds--></b> to disable all Ads in a post <i>(does not affect Ads on Sidebar)</i>.</li>';
245
+ echo '<li>Insert <b><!--OffDef--></b> to disable the default positioned Ads, and use <!--Ads1-->, <!--Ads2-->, etc. to insert Ad <i>(does not affect Ads on Sidebar)</i>.</li>';
246
+ echo '<li>Insert <b><!--OffWidget--></b> to disable all Ads on Sidebar.</li>';
247
+ echo '<li>Insert <b><!--OffBegin--></b>, <b><!--OffMiddle--></b>, <b><!--OffEnd--></b> to <b>disable Ads at Beginning</b>, <b>Middle or End of Post</b>.</li>';
248
+ echo '<li>Insert <b><!--OffAfMore--></b>, <b><!--OffBfLastPara--></b> to <b>disable Ads right after the <!--more--> tag</b>, or <b>right before the last Paragraph</b>.</li>';
249
+ echo '</ol>';
250
+ echo '<div class="clear"></div>';
251
+ echo '<i>Tags can be inserted into a post via the additional Quicktag Buttons at the HTML Edit Post SubPanel.</i>';
252
+ echo '</div>';
253
+ echo '<div class="clear"></div>';
254
+ echo '</div>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
255
 
256
+ echo '<div id="quick_adsense_block_bottom" class="quick_adsense_block">';
257
+ echo '<div class="quick_adsense_block_labels">';
258
+ echo '<span>Adsense Codes</span>';
259
+ echo '</div>';
260
+ echo '<div class="clear"></div>';
261
+ echo '<p>Paste up to 10 Ads codes on Post Body as assigned above, and up to 10 Ads codes on Sidebar Widget. Ads codes provided must not be identical, repeated codes may result the Ads not being display correctly. Ads will never displays more than once in a page.</p>';
262
+ echo '</div>';
263
+ }
264
 
265
+ function quick_adsense_onpost_content() {
266
+ $settings = get_option('quick_adsense_settings');
267
+ $alignmentOptions = array(
268
+ array('text' => 'Left', 'value' => '1'),
269
+ array('text' => 'Center', 'value' => '2'),
270
+ array('text' => 'Right', 'value' => '3'),
271
+ array('text' => 'None', 'value' => '4')
272
+ );
273
+ $marginOptions = array();
274
+ for($i = 1; $i <= 50; $i++) {
275
+ $marginOptions[] = array('text' => $i, 'value' => $i);
276
+ }
277
+ echo '<h2>Ads on Post Body</h2>';
278
+ echo '<div id="quick_adsense_onpost_content_controls_wrapper">';
279
+ echo '<div id="quick_adsense_onpost_content_global_controls_wrapper" style="visibility: hidden;">';
280
+ echo '<p class="quick_adsense_onpost_adunits_styling_controls">';
281
+ echo quickadsense_get_control('checkbox', '', 'quick_adsense_settings_onpost_enable_global_style', 'quick_adsense_settings[onpost_enable_global_style]', ((isset($settings['onpost_enable_global_style']))?$settings['onpost_enable_global_style']:''), null, 'input', 'margin: -3px 10px 0 0;');
282
+ echo '<span>Use for all</span>';
283
+ echo '<wbr />Alignment';
284
+ echo quickadsense_get_control('select', '', 'quick_adsense_settings_onpost_global_alignment', 'quick_adsense_settings[onpost_global_alignment]', ((isset($settings['onpost_global_alignment']))?$settings['onpost_global_alignment']:''), $alignmentOptions, 'input', 'margin: -6px 20px 0 10px; width: 73px;');
285
+ echo '<wbr />margin';
286
+ echo quickadsense_get_control('number', '', 'quick_adsense_settings_onpost_global_margin', 'quick_adsense_settings[onpost_global_margin]', ((isset($settings['onpost_global_margin']))?$settings['onpost_global_margin']:''), $marginOptions, 'input', 'margin: -1px 10px 0 10px; width: 62px;');
287
+ echo 'px';
288
+ echo '</p>';
289
+ echo '</div>';
290
 
291
+ echo '<div id="quick_adsense_onpost_content_adunits_wrapper">';
292
+ echo '<div id="quick_adsense_onpost_content_adunits_initial_wrapper">';
293
+ for($i = 1; $i <= 3; $i++) {
294
+ echo '<div id="quick_adsense_onpost_adunits_control_'.$i.'" class="quick_adsense_onpost_adunits_control_wrapper">';
295
+ echo '<div class="quick_adsense_onpost_adunits_label">Ads'.$i.'</div>';
296
+ echo '<div class="quick_adsense_onpost_adunits_control">';
297
+ echo quickadsense_get_control('textarea', '', 'quick_adsense_settings_onpost_ad_'.$i.'_content', 'quick_adsense_settings[onpost_ad_'.$i.'_content]', ((isset($settings['onpost_ad_'.$i.'_content']))?$settings['onpost_ad_'.$i.'_content']:''), null, 'input', 'display: block; margin: 0 0 10px 0', 'Enter Code');
298
+ echo '<p class="quick_adsense_onpost_adunits_styling_controls">';
299
+ echo 'Alignment';
300
+ echo quickadsense_get_control('select', '', 'quick_adsense_settings_onpost_ad_'.$i.'_alignment', 'quick_adsense_settings[onpost_ad_'.$i.'_alignment]', ((isset($settings['onpost_ad_'.$i.'_alignment']))?$settings['onpost_ad_'.$i.'_alignment']:''), $alignmentOptions, 'input', 'margin: -2px 20px 0 10px;');
301
+ echo '<wbr />margin';
302
+ echo quickadsense_get_control('number', '', 'quick_adsense_settings_onpost_ad_'.$i.'_margin', 'quick_adsense_settings[onpost_ad_'.$i.'_margin]', ((isset($settings['onpost_ad_'.$i.'_margin']))?$settings['onpost_ad_'.$i.'_margin']:''), $marginOptions, 'input', 'margin: -2px 10px 0 10px; width: 52px;');
303
+ echo 'px';
304
+ echo '</p>';
305
+ echo '</div>';
306
+ echo '<div class="clear"></div>';
307
+ echo '</div>';
308
+ }
309
+ echo '</div>';
310
+ echo '<div id="quick_adsense_onpost_content_adunits_all_wrapper" style="display: none;">';
311
+ for($i = 4; $i <= 10; $i++) {
312
+ echo '<div id="quick_adsense_onpost_adunits_control_'.$i.'" class="quick_adsense_onpost_adunits_control_wrapper">';
313
+ echo '<div class="quick_adsense_onpost_adunits_label">Ads'.$i.'</div>';
314
+ echo '<div class="quick_adsense_onpost_adunits_control">';
315
+ echo quickadsense_get_control('textarea', '', 'quick_adsense_settings_onpost_ad_'.$i.'_content', 'quick_adsense_settings[onpost_ad_'.$i.'_content]', ((isset($settings['onpost_ad_'.$i.'_content']))?$settings['onpost_ad_'.$i.'_content']:''), null, 'input', 'display: block; margin: 0 0 10px 0', 'Enter Code');
316
+ echo '<p class="quick_adsense_onpost_adunits_styling_controls">';
317
+ echo 'Alignment';
318
+ echo quickadsense_get_control('select', '', 'quick_adsense_settings_onpost_ad_'.$i.'_alignment', 'quick_adsense_settings[onpost_ad_'.$i.'_alignment]', ((isset($settings['onpost_ad_'.$i.'_alignment']))?$settings['onpost_ad_'.$i.'_alignment']:''), $alignmentOptions, 'input', 'margin: -2px 20px 0 10px;');
319
+ echo '<wbr />margin';
320
+ echo quickadsense_get_control('number', '', 'quick_adsense_settings_onpost_ad_'.$i.'_margin', 'quick_adsense_settings[onpost_ad_'.$i.'_margin]', ((isset($settings['onpost_ad_'.$i.'_margin']))?$settings['onpost_ad_'.$i.'_margin']:''), $marginOptions, 'input', 'margin: -2px 10px 0 10px; width: 62px;');
321
+ echo 'px';
322
+ echo '</p>';
323
+ echo '</div>';
324
+ echo '<div class="clear"></div>';
325
+ echo '</div>';
326
+ }
327
+ echo '</div>';
328
+ echo '<a id="quick_adsense_onpost_content_adunits_showall_button" class="input button-secondary"><span class="dashicons dashicons-arrow-down"></span> <b>Show All</b></a>';
329
+ echo '</div>';
330
+ echo '</div>';
331
  }
332
 
333
+ function quick_adsense_widgets_content() {
334
+ $settings = get_option('quick_adsense_settings');
335
+ $alignmentOptions = array(
336
+ array('text' => 'Left', 'value' => '1'),
337
+ array('text' => 'Center', 'value' => '2'),
338
+ array('text' => 'Right', 'value' => '3'),
339
+ array('text' => 'None', 'value' => '4')
340
+ );
341
+ $marginOptions = array();
342
+ for($i = 1; $i <= 50; $i++) {
343
+ $marginOptions[] = array('text' => $i, 'value' => $i);
344
  }
345
+
346
+ echo '<h2><a href="'.admin_url('widgets.php').'">Sidebar WIdget</a></h2>';
347
+ echo '<div id="quick_adsense_widget_controls_wrapper">';
348
+ echo '<div id="quick_adsense_widget_global_controls_wrapper" style="visibility: hidden;">';
349
+ echo '<p class="quick_adsense_widget_adunits_styling_controls">';
350
+ echo quickadsense_get_control('checkbox', '', 'quick_adsense_settings_widget_enable_global_style', 'quick_adsense_settings[widget_enable_global_style]', ((isset($settings['widget_enable_global_style']))?$settings['widget_enable_global_style']:''), null, 'input', 'margin: -3px 10px 0 0;');
351
+ echo '<span>Use for all</span>';
352
+ echo '<wbr />Alignment';
353
+ echo quickadsense_get_control('select', '', 'quick_adsense_settings_widget_global_alignment', 'quick_adsense_settings[widget_global_alignment]', ((isset($settings['widget_global_alignment']))?$settings['widget_global_alignment']:''), $alignmentOptions, 'input', 'margin: -6px 20px 0 10px; width: 73px;');
354
+ echo '<wbr />margin';
355
+ echo quickadsense_get_control('number', '', 'quick_adsense_settings_widget_global_margin', 'quick_adsense_settings[widget_global_margin]', ((isset($settings['widget_global_margin']))?$settings['widget_global_margin']:''), $marginOptions, 'input', 'margin: -1px 10px 0 10px; width: 62px;');
356
+ echo 'px';
357
+ echo '</p>';
358
+ echo '</div>';
359
+
360
+ echo '<div id="quick_adsense_widget_adunits_wrapper">';
361
+ echo '<div id="quick_adsense_widget_adunits_initial_wrapper">';
362
+ for($i = 1; $i <= 3; $i++) {
363
+ echo '<div id="quick_adsense_widget_adunits_control_'.$i.'" class="quick_adsense_widget_adunits_control_wrapper">';
364
+ echo '<div class="quick_adsense_widget_adunits_label">AdsWidget'.$i.'</div>';
365
+ echo '<div class="quick_adsense_widget_adunits_control">';
366
+ echo quickadsense_get_control('textarea', '', 'quick_adsense_settings_widget_ad_'.$i.'_content', 'quick_adsense_settings[widget_ad_'.$i.'_content]', ((isset($settings['widget_ad_'.$i.'_content']))?$settings['widget_ad_'.$i.'_content']:''), null, 'input', 'display: block; margin: 0 0 10px 0', 'Enter Code');
367
+ echo '</div>';
368
+ echo '<div class="clear"></div>';
369
+ echo '</div>';
370
+ }
371
+ echo '</div>';
372
+ echo '<div id="quick_adsense_widget_adunits_all_wrapper" style="display: none;">';
373
+ for($i = 4; $i <= 10; $i++) {
374
+ echo '<div id="quick_adsense_widget_adunits_control_'.$i.'" class="quick_adsense_widget_adunits_control_wrapper">';
375
+ echo '<div class="quick_adsense_widget_adunits_label">AdsWidget'.$i.'</div>';
376
+ echo '<div class="quick_adsense_widget_adunits_control">';
377
+ echo quickadsense_get_control('textarea', '', 'quick_adsense_settings_widget_ad_'.$i.'_content', 'quick_adsense_settings[widget_ad_'.$i.'_content]', ((isset($settings['widget_ad_'.$i.'_content']))?$settings['widget_ad_'.$i.'_content']:''), null, 'input', 'display: block; margin: 0 0 10px 0', 'Enter Code');
378
+ echo '</div>';
379
+ echo '<div class="clear"></div>';
380
+ echo '</div>';
381
+ }
382
+ echo '</div>';
383
+ echo '<a id="quick_adsense_widget_adunits_showall_button" class="input button-secondary"><span class="dashicons dashicons-arrow-down"></span> <b>Show All</b></a>';
384
+ echo '</div>';
385
+ echo '</div>';
386
  }
387
 
388
+ function quick_adsense_validate($input) {
389
+ delete_transient('quick_adsense_adstxt_adsense_autocheck_content');
390
  return $input;
391
  }
392
  ?>
includes/vi.php ADDED
@@ -0,0 +1,517 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*Begin Vi Admin Notice */
3
+ add_action('admin_footer', 'quick_adsense_vi_adstxt_adsense_admin_footer');
4
+ function quick_adsense_vi_adstxt_adsense_admin_footer() {
5
+ echo '<script type="text/javascript">';
6
+ echo "jQuery(document).ready(function() {";
7
+ echo "jQuery.post(";
8
+ echo "jQuery('#quick_adsense_admin_notice_ajax').val(), {";
9
+ echo "'action': 'quick_adsense_vi_admin_notice_dismiss',";
10
+ echo "'quick_adsense_admin_notice_nonce': jQuery('#quick_adsense_admin_notice_nonce').val(),";
11
+ echo "}, function(response) { }";
12
+ echo ");";
13
+ echo "});";
14
+ echo '</script>';
15
+ }
16
+
17
+ add_action('admin_notices', 'quick_adsense_vi_admin_notices');
18
+ function quick_adsense_vi_admin_notices() {
19
+ if(current_user_can('manage_options')) {
20
+ $userId = get_current_user_id();
21
+ $screen = get_current_screen();
22
+ //delete_user_meta($userId, 'quick_adsense_2_1_admin_notice_dismissed');
23
+ if(!get_user_meta($userId, 'quick_adsense_2_1_admin_notice_dismissed', true)) {
24
+ echo '<div class="notice notice-success quick_adsense_notice is-dismissible" '.((quick_adsense_vi_api_is_loggedin() && ($screen->id != 'toplevel_page_quick-adsense'))?'style="display: none;"':'').'>';
25
+ echo '<div id="quick_adsense_notice_container">';
26
+ echo '<img id="quick_adsense_notice_vi_logo" src="'.plugins_url('/images/vi-big-logo.png', __FILE__).'" />';
27
+ echo '<p class="quick_adsense_notice_title_para">Thank you for updating Quick Adsense!</p>';
28
+ echo '<p class="quick_adsense_notice_content_para">This update features <b>vi stories</b> 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>';
29
+ echo '<p class="quick_adsense_notice_content_para"> To begin earning sign up to vi stories and place the ad live now! Read the <a href="https://www.vi.ai/frequently-asked-questions-vi-stories-for-wordpress/?utm_source=WordPress&utm_medium=Plugin%20FAQ&utm_campaign=Quick%20Adsense" target="_blank">FAQ</a>.</p>';
30
+ echo '<p class="quick_adsense_notice_info_para">Click the \'Monetize Now\' button to activate vi stories. You\'ll agree to share your domain, affiliate ID and email with video intelligence, and begin your journey to video publisher.</p>';
31
+ if($screen->id != 'toplevel_page_quick-adsense') {
32
+ echo '<a id="quick_adsense_notice_monetize_button" href="'.esc_url(admin_url('/admin.php?page=quick-adsense#vi-remote-signup')).'">Monetize Now</a>';
33
+ } else {
34
+ echo '<a id="quick_adsense_notice_monetize_button" href="javascript:;" onclick="jQuery(\'#quick_adsense_vi_signup\').click()">Monetize Now</a>';
35
+ }
36
+ echo '</div>';
37
+ echo '<div class="clear"></div>';
38
+ echo '<input type="hidden" id="quick_adsense_admin_notice_nonce" name="quick_adsense_admin_notice_nonce" value="'.wp_create_nonce('quick-adsense-admin-notice').'" />';
39
+ echo '<input type="hidden" id="quick_adsense_admin_notice_ajax" name="quick_adsense_admin_notice_ajax" value="'.admin_url('admin-ajax.php').'" />';
40
+ echo '<style type="text/css">';
41
+ echo '.quick_adsense_notice { padding: 15px; border-left: 4px solid #000; }';
42
+ echo '.quick_adsense_notice #quick_adsense_notice_container { font-size: 14px; font-family: Arial; line-height: 18px; color: #232323; }';
43
+ echo '.quick_adsense_notice #quick_adsense_notice_container #quick_adsense_notice_vi_logo { float: right; margin: 13px 20px 0 20px; }';
44
+ echo '.quick_adsense_notice #quick_adsense_notice_container .quick_adsense_notice_title_para { font-size: 16px; line-height: 18px; margin: 0 0 10px; }';
45
+ echo '.quick_adsense_notice #quick_adsense_notice_container .quick_adsense_notice_content_para { font-size: 14px; line-height: 18px; margin: 0; }';
46
+ echo '.quick_adsense_notice #quick_adsense_notice_container .quick_adsense_notice_info_para { font-size: 13px; font-style: italic; line-height: 18px; margin: 20px 100px 0 0;float: left;width: calc(100% - 265px); }';
47
+ echo '.quick_adsense_notice #quick_adsense_notice_container #quick_adsense_notice_monetize_button { font-size: 16px; color: #000; line-height: 18px; margin: 17px 0 0; background: #fff200; padding: 12px 20px 10px; text-decoration: none; box-shadow: 0px 1px 0px 0px #000000; border: 1px solid #f0e400; border-radius: 3px; display: inline-block; float: left; font-weight: 600; }';
48
+ echo '@media only screen and (max-width: 992px) {';
49
+ echo '.quick_adsense_notice #quick_adsense_notice_container #quick_adsense_notice_vi_logo { clear: both; float: none; margin: 0 0 10px; }';
50
+ echo '.quick_adsense_notice #quick_adsense_notice_container .quick_adsense_notice_info_para { width: 100%; float: none; clear: both; margin: 10px 0 0; }';
51
+ echo '}';
52
+ echo '</style>';
53
+ echo '</div>';
54
+ }
55
+ }
56
+ }
57
+
58
+ add_action('wp_ajax_quick_adsense_vi_admin_notice_dismiss', 'quick_adsense_vi_admin_notice_dismiss');
59
+ function quick_adsense_vi_admin_notice_dismiss() {
60
+ check_ajax_referer('quick-adsense-admin-notice', 'quick_adsense_admin_notice_nonce');
61
+ $userId = get_current_user_id();
62
+ update_user_meta($userId, 'quick_adsense_2_1_admin_notice_dismissed', 'true');
63
+ die();
64
+ }
65
+
66
+ function quick_adsense_vi_admin_notice_reactivate() {
67
+ $userId = get_current_user_id();
68
+ delete_user_meta($userId, 'quick_adsense_2_1_admin_notice_dismissed');
69
+ }
70
+ /*End Vi Admin Notice */
71
+
72
+ function quick_adsense_vi_plugin_card_content($isLoggedin = false, $isAjaxRequest = false) {
73
+ if(!$isLoggedin) {
74
+ echo '<div class="quick_adsense_vi_block_header">Start earning with <a href="https://www.vi.ai/publisher-video-monetization/?aid=WP_quickadsense&utm_source=Wordpress&utm_medium=wp_quickadsense">vi stories</a></div>';
75
+ echo '<div class="quick_adsense_vi_block_content" '.(($isAjaxRequest)?'style="opacity: 0;"':'').'>';
76
+ echo '<p>With <strong>vi stories</strong> you’ll see video ads that are matched to your site’s content 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.</p>';
77
+ echo '<ul>';
78
+ echo '<li>The set up takes only a few minutes</li>';
79
+ echo '<li>Up to 10x higher CPM than traditional display advertising</li>';
80
+ echo '<li>Users spend longer on your site thanks to professional video content</li>';
81
+ echo '<li>The video player is customizable to match your site</li>';
82
+ echo '</ul>';
83
+ echo '<p>Install it now to increase time-on-page, and your revenue thanks to high CPMs.</p>';
84
+ echo '</div>';
85
+ echo '<div class="quick_adsense_vi_block_footer" '.(($isAjaxRequest)?'style="opacity: 0;"':'').'>';
86
+ echo '<span>By clicking sign up you agree to send your current domain, email and affiliate ID to video intelligence & Quick AdSense.</span>';
87
+ echo '<a id="quick_adsense_vi_login" href="javascript:;" class="button button-secondary">Log In</a>';
88
+ echo '<a id="quick_adsense_vi_signup" href="javascript:;" class="button button-primary">Sign Up</a>';
89
+ echo '<div class="clear"></div>';
90
+ echo '</div>';
91
+ } else {
92
+ $dashboardURL = quick_adsense_vi_api_get_dashboardurl();
93
+ echo '<div class="quick_adsense_vi_block_header">Monetization with vi stories</div>';
94
+ echo '<div class="quick_adsense_vi_block_content" '.(($isAjaxRequest)?'style="opacity: 0;"':'').'>';
95
+ echo '<div id="quick_adsense_vi_earnings_wrapper">';
96
+ echo '<div class="quick_adsense_ajaxloader"></div>';
97
+ echo '</div>';
98
+ echo '</div>';
99
+ echo '<div class="quick_adsense_vi_block_footer" '.(($isAjaxRequest)?'style="opacity: 0;"':'').'>';
100
+ echo '<a id="quick_adsense_vi_dashboard" href="'.$dashboardURL.'" target="_blank" class="button button-primary alignleft">Publisher Dashboard</a>';
101
+ echo '<a id="quick_adsense_vi_customize_adcode" href="javascript:;" class="button button-primary alignleft">Configure vi Code</a>';
102
+ echo '<a id="quick_adsense_vi_logout" href="javascript:;" class="button button-secondary">Log Out</a>';
103
+ echo '<div class="clear"></div>';
104
+ echo '</div>';
105
+ }
106
+ if(quick_adsense_vi_api_get_vi_code() !== false) {
107
+ echo '<input id="quick_adsense_vi_embedcode_status" type="hidden" value="Configured" />';
108
+ } else {
109
+ echo '<input id="quick_adsense_vi_embedcode_status" type="hidden" value="NotConfigured" />';
110
+ }
111
+ }
112
+
113
+ add_action('wp_ajax_quick_adsense_vi_get_chart', 'quick_adsense_vi_get_chart');
114
+ function quick_adsense_vi_get_chart() {
115
+ check_ajax_referer('quick-adsense', 'quick_adsense_nonce');
116
+ $revenueData = quick_adsense_vi_api_get_revenue_data();
117
+ if(isset($revenueData) && is_array($revenueData)) {
118
+ echo '###SUCCESS###';
119
+ echo '<div id="quick_adsense_vi_earnings">';
120
+ echo '<p>Below you can see your current revenues.</p>';
121
+ echo '<span id="quick_adsense_vi_earnings_label">Total Earnings</span>';
122
+ echo '<span id="quick_adsense_vi_earnings_value">$'.$revenueData['netRevenue'].'</span>';
123
+ echo '</div>';
124
+ echo '<div id="quick_adsense_vi_chart_wrapper">';
125
+ echo '<canvas id="quick_adsense_vi_chart" width="1377" height="180"></canvas>';
126
+ echo '<textarea id="quick_adsense_vi_chart_data" style="display: none;">[';
127
+ if(isset($revenueData['mtdReport']) && is_array($revenueData['mtdReport']) & (count($revenueData['mtdReport']) > 0)) {
128
+ $isFirstItem = true;
129
+ foreach($revenueData['mtdReport'] as $reportData) {
130
+ if(!$isFirstItem) {
131
+ echo ',';
132
+ }
133
+ $date = DateTime::createFromFormat('d-m-Y', $reportData['date']);
134
+ echo '{"x": "'.$date->format('m/d/Y').'", "y": "'.$reportData['revenue'].'"}';
135
+ $isFirstItem = false;;
136
+ }
137
+ } else {
138
+ echo '{"x": "'.date('m/d/Y').'", "y": "0.00"}';
139
+ }
140
+ echo ']</textarea>';
141
+ echo '</div>';
142
+ echo '<div class="clear"></div>';
143
+ } else {
144
+ echo '<p class="viError">There was an error processing your request, our team was notified.<br />Please try again later.</p>';
145
+ echo '<div id="quick_adsense_vi_earnings_wrapper">';
146
+ echo '<div id="quick_adsense_vi_earnings">';
147
+ echo '<span id="quick_adsense_vi_earnings_label">Total Earnings</span>';
148
+ echo '<span id="quick_adsense_vi_earnings_value"><img src="'.plugins_url('/images/vi-no-data.jpg', __FILE__).'"></span>';
149
+ echo '</div>';
150
+ echo '<div id="quick_adsense_vi_chart_wrapper">';
151
+ echo '<img width="348" height="139" src="'.plugins_url('/images/vi-empty-graph.jpg', __FILE__).'">';
152
+ echo '</div>';
153
+ echo '<div class="clear"></div>';
154
+ echo '</div>';
155
+ }
156
+ die();
157
+ }
158
+
159
+ /* Begin Signup Form */
160
+ add_action('wp_ajax_quick_adsense_vi_signup_form_get_content', 'quick_adsense_vi_signup_form_get_content');
161
+ function quick_adsense_vi_signup_form_get_content() {
162
+ check_ajax_referer('quick-adsense', 'quick_adsense_nonce');
163
+ $signupURL = quick_adsense_vi_api_get_signupurl();
164
+ if(($signupURL != false) && ($signupURL != '')) {
165
+ echo '<div class="quick_adsense_popup_content_wrapper">';
166
+ echo '<iframe src="'.$signupURL.'?aid=WP_quickadsense&utm_source=Wordpress&utm_medium=WP_quickadsense&utm_campaign=white&utm_content=WP_quickadsense&email='.get_bloginfo('admin_email').'&domain='.quick_adsense_get_domain_name_from_url(get_bloginfo('url')).'" style="width: 100%; max-width: 870px; min-height: 554px;"></iframe>';
167
+ echo '<script type="text/javascript">';
168
+ echo 'jQuery(".ui-dialog-buttonset").find("button").first().remove();';
169
+ echo 'jQuery(".ui-dialog-buttonset").find("button").first().find("span:nth-child(2)").hide().after("<span class=\'ui-button-text\'>Close</span>");';
170
+ echo '</script>';
171
+ echo '</div>';
172
+ } else {
173
+ echo '<div class="quick_adsense_popup_content_wrapper">';
174
+ echo '<p> There was an error processing your request. Please try again later. </p>';
175
+ echo '</div>';
176
+ }
177
+ die();
178
+ }
179
+
180
+ function quick_adsense_get_domain_name_from_url($url){
181
+ $pieces = parse_url($url);
182
+ $domain = isset($pieces['host']) ? $pieces['host'] : '';
183
+ if(preg_match('/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.[a-z\.]{2,6})$/i', $domain, $regs)){
184
+ return $regs['domain'];
185
+ }
186
+ return false;
187
+ }
188
+ /* End Signup Form */
189
+
190
+ /* Begin Login Form */
191
+ add_action('wp_ajax_quick_adsense_vi_login_form_get_content', 'quick_adsense_vi_login_form_get_content');
192
+ function quick_adsense_vi_login_form_get_content() {
193
+ check_ajax_referer('quick-adsense', 'quick_adsense_nonce');
194
+ echo '<div class="quick_adsense_popup_content_wrapper">';
195
+ echo '<div class="quick_adsense_vi_loginform_wrapper">';
196
+ quick_adsense_vi_login_form_get_controls();
197
+ echo '</div>';
198
+ echo '<script type="text/javascript">';
199
+ echo 'jQuery(".ui-dialog-buttonset").find("button").first().find("span:nth-child(2)").hide().after("<span class=\'ui-button-text\'>Login</span>");';
200
+ echo 'jQuery(".ui-dialog-buttonset").find("button").first().find("span:nth-child(1)").attr("class", "ui-button-icon-primary ui-icon ui-icon-key");';
201
+ echo '</script>';
202
+ echo '</div>';
203
+ die();
204
+ }
205
+
206
+ add_action('wp_ajax_quick_adsense_vi_login_form_save_action', 'quick_adsense_vi_login_form_save_action');
207
+ function quick_adsense_vi_login_form_save_action() {
208
+ check_ajax_referer('quick-adsense', 'quick_adsense_nonce');
209
+ if(isset($_POST['quick_adsense_vi_login_username']) && ($_POST['quick_adsense_vi_login_username'] != '') && isset($_POST['quick_adsense_vi_login_password']) && ($_POST['quick_adsense_vi_login_password'] != '')) {
210
+ $token = quick_adsense_vi_api_login($_POST['quick_adsense_vi_login_username'], $_POST['quick_adsense_vi_login_password']);
211
+ if(is_array($token) && (isset($token['status'])) && ($token['status'] == 'error')) {
212
+ quick_adsense_vi_login_form_get_controls();
213
+ if($token['errorCode'] == 'WIVI008') {
214
+ echo '<p class="quick_adsense_vi_login_error">'.$token['message'].'</p>';
215
+ } else {
216
+ echo '<p class="quick_adsense_vi_login_error">Error Code: '.$token['errorCode'].'<br />Please contact support or try again later!'.'</p>';
217
+ }
218
+ } else {
219
+ echo '###SUCCESS###';
220
+ quick_adsense_vi_plugin_card_content(true, true);
221
+ }
222
+ }
223
+ die();
224
+ }
225
+
226
+ function quick_adsense_vi_login_form_get_controls() {
227
+ echo '<div style="margin: 15px 0; padding: 5px; border: 1px solid #999999; border-radius: 5px; position: relative;">';
228
+ echo '<label style="font-weight: bold; position: absolute; left: 15px; top: -10px; background: #FFFFFF; color: #111111; padding: 0px 10px;">Login</label>';
229
+ echo '<div style="margin: 10px 0 10px; padding: 0 10px; position: relative;">';
230
+ echo '<p>Please log in with the received credentials to complete the integration:</p>';
231
+ echo '<p>';
232
+ echo quickadsense_get_control('text', 'Email', 'quick_adsense_vi_login_username', 'quick_adsense_vi_login_username');
233
+ echo '</p>';
234
+ echo '<p>';
235
+ echo quickadsense_get_control('password', 'Password', 'quick_adsense_vi_login_password', 'quick_adsense_vi_login_password');
236
+ echo '</p>';
237
+ echo '</div>';
238
+ echo '</div>';
239
+ }
240
+ /* End Login Form */
241
+
242
+ /* Begin Logout */
243
+ add_action('wp_ajax_quick_adsense_vi_logout_action', 'quick_adsense_vi_logout_action');
244
+ function quick_adsense_vi_logout_action() {
245
+ check_ajax_referer('quick-adsense', 'quick_adsense_nonce');
246
+ quick_adsense_vi_api_logout();
247
+ echo '###SUCCESS###';
248
+ quick_adsense_vi_plugin_card_content(false, true);
249
+ die();
250
+ }
251
+ /* End Logout */
252
+
253
+ /* Begin Configure vi Code */
254
+ add_action('wp_ajax_quick_adsense_vi_customize_adcode_form_get_content', 'quick_adsense_vi_customize_adcode_form_get_content');
255
+ function quick_adsense_vi_customize_adcode_form_get_content() {
256
+ check_ajax_referer('quick-adsense', 'quick_adsense_nonce');
257
+ $vicodeSettings = get_option('quick_adsense_vi_code_settings');
258
+ echo '<div style="margin: 15px 0; padding: 5px; border: 1px solid #999999; border-radius: 5px; position: relative;">';
259
+ echo '<label style="font-weight: bold; position: absolute; left: 15px; top: -10px; background: #FFFFFF; color: #111111; padding: 0px 10px;">vi stories: customize your video player</label>';
260
+ echo '<div style="margin: 10px 0 10px; padding: 0 10px; position: relative;">';
261
+ echo '<div class="quick_adsense_popup_content_wrapper">';
262
+ echo '<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>Ad - Beginning of Post</i> and <i>Ad - Middle of Post</i></p>';
263
+ echo '<div class="quick_adsense_vi_popup_right_column">';
264
+ echo '<img style="margin: 0 auto; display: block;" src="'.plugins_url('/images/advertisement-preview.png', __FILE__).'" />';
265
+ echo '</div>';
266
+ echo '<div class="quick_adsense_vi_popup_left_column">';
267
+ echo '<p id="quick_adsense_vi_customize_adcode_keywords_required_error" style="display: none;" class="viError">Keywords contains invalid characters, Some required fields are missing</p>';
268
+ echo '<p id="quick_adsense_vi_customize_adcode_keywords_error" style="display: none;" class="viError">Keywords contains invalid characters</p>';
269
+ echo '<p id="quick_adsense_vi_customize_adcode_required_error" style="display: none;" class="viError">Some required fields are missing</p>';
270
+ $adUnitOptions = array(
271
+ array('text' => 'vi stories', 'value' => 'NATIVE_VIDEO_UNIT'),
272
+ );
273
+ echo '<p>';
274
+ echo quickadsense_get_control('select', 'Ad Unit*', 'quick_adsense_vi_code_settings_ad_unit_type', 'quick_adsense_vi_code_settings_ad_unit_type', ((isset($vicodeSettings['ad_unit_type']))?$vicodeSettings['ad_unit_type']:''), $adUnitOptions);
275
+ echo '<small></small><span class="tooltipWrapper"><span class="tooltip">- vi stories (video advertising + video content)</span></span><small></small>';
276
+ echo '</p>';
277
+ echo '<p>';
278
+ echo quickadsense_get_control('textarea', 'Keywords', 'quick_adsense_vi_code_settings_keywords', 'quick_adsense_vi_code_settings_keywords', ((isset($vicodeSettings['keywords']))?$vicodeSettings['keywords']:''), null, 'input widefat', '', 'Max length 200 chars. a-z, A-Z, numbers, dashes, umlauts and accents are allowed.');
279
+ echo '<small></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></small>';
280
+ echo '</p>';
281
+ echo '<p>';
282
+ echo quickadsense_get_control('select', 'IAB Category*', 'quick_adsense_vi_code_settings_iab_category_parent', 'quick_adsense_vi_code_settings_iab_category_parent', ((isset($vicodeSettings['iab_category_parent']))?$vicodeSettings['iab_category_parent']:''), quick_adsense_vi_get_constant_iab_parent_categories());
283
+ echo '<small></small><a class="textTip" target="_blank" href="'.quick_adsense_vi_api_get_iabCategoriesURL().'">See Complete List</a><small></small>';
284
+ echo '</p>';
285
+ echo '<p>';
286
+ echo quickadsense_get_control('select', '&nbsp;', 'quick_adsense_vi_code_settings_iab_category_child', 'quick_adsense_vi_code_settings_iab_category_child', ((isset($vicodeSettings['iab_category_child']))?$vicodeSettings['iab_category_child']:''), quick_adsense_vi_get_constant_iab_child_categories());
287
+ echo '<small></small>';
288
+ echo '</p>';
289
+ $languages = quick_adsense_vi_api_get_languages();
290
+ $languageOptions = array(
291
+ array('text' => 'Select language', 'value' => 'select'),
292
+ );
293
+ if($languages != false) {
294
+ foreach($languages as $key => $value) {
295
+ $languageOptions[] = array('text' => $value, 'value' => $key);
296
+ }
297
+ }
298
+ echo '<p>';
299
+ echo quickadsense_get_control('select', 'Language', 'quick_adsense_vi_code_settings_language', 'quick_adsense_vi_code_settings_language', ((isset($vicodeSettings['language']))?$vicodeSettings['language']:''), $languageOptions);
300
+ echo '<small></small>';
301
+ echo '</p>';
302
+ echo '<p>';
303
+ echo quickadsense_get_control('text', 'Native Background color', 'quick_adsense_vi_code_settings_native_bg_color', 'quick_adsense_vi_code_settings_native_bg_color', ((isset($vicodeSettings['native_bg_color']))?$vicodeSettings['native_bg_color']:''), null, 'input widefat', '', 'Select color');
304
+ echo '<small></small>';
305
+ echo '</p>';
306
+ echo '<p>';
307
+ echo quickadsense_get_control('text', 'Native Text color', 'quick_adsense_vi_code_settings_native_text_color', 'quick_adsense_vi_code_settings_native_text_color', ((isset($vicodeSettings['native_text_color']))?$vicodeSettings['native_text_color']:''), null, 'input widefat', '', 'Select color');
308
+ echo '<small></small>';
309
+ echo '</p>';
310
+ echo '<p>';
311
+ echo quickadsense_get_control('select', 'Native Text Font Family', 'quick_adsense_vi_code_settings_font_family', 'quick_adsense_vi_code_settings_font_family', ((isset($vicodeSettings['font_family']))?$vicodeSettings['font_family']:''), quick_adsense_vi_get_constant_fonts());
312
+ echo '<small></small>';
313
+ echo '</p>';
314
+ echo '<p>';
315
+ echo quickadsense_get_control('select', 'Native Text Font Size', 'quick_adsense_vi_code_settings_font_size', 'quick_adsense_vi_code_settings_font_size', ((isset($vicodeSettings['font_size']))?$vicodeSettings['font_size']:''), quick_adsense_vi_get_constant_font_sizes());
316
+ echo '<small></small>';
317
+ echo '</p>';
318
+ echo '<p>';
319
+ echo quickadsense_get_control('textarea', 'Optional 1', 'quick_adsense_vi_code_settings_optional_1', 'quick_adsense_vi_code_settings_optional_1', ((isset($vicodeSettings['optional_1']))?$vicodeSettings['optional_1']:''), null, 'input widefat', '', 'Max length 200 chars');
320
+ echo '<small></small>';
321
+ echo '</p>';
322
+ echo '<p>';
323
+ echo quickadsense_get_control('textarea', 'Optional 2', 'quick_adsense_vi_code_settings_optional_2', 'quick_adsense_vi_code_settings_optional_2', ((isset($vicodeSettings['optional_2']))?$vicodeSettings['optional_2']:''), null, 'input widefat', '', 'Max length 200 chars');
324
+ echo '<small></small>';
325
+ echo '</p>';
326
+ echo '<p>';
327
+ echo quickadsense_get_control('textarea', 'Optional 3', 'quick_adsense_vi_code_settings_optional_3', 'quick_adsense_vi_code_settings_optional_3', ((isset($vicodeSettings['optional_3']))?$vicodeSettings['optional_3']:''), null, 'input widefat', '', 'Max length 200 chars');
328
+ echo '<small></small>';
329
+ echo '</p>';
330
+ echo '<p class="quick_adsense_vi_delay_notice">vi Ad Changes might take some time to take into effect</p>';
331
+ echo '</div>';
332
+ echo '<div class="clear"></div>';
333
+ echo '</div>';
334
+ echo '</div>';
335
+ echo '</div>';
336
+ echo '<script type="text/javascript">';
337
+ echo 'jQuery(".ui-dialog-buttonset").find("button").first().find("span:nth-child(2)").hide().after("<span class=\'ui-button-text\' style=\'background: #0085ba; border-color: #0073aa #006799 #006799; color: #fff; padding-left: 1em;\'>Save changes</span>");';
338
+ echo 'jQuery(".ui-dialog-buttonset").find("button").first().find("span:nth-child(1)").hide();';
339
+ echo 'quick_adsense_vi_code_iab_category_parent_change();';
340
+ echo 'jQuery("#quick_adsense_vi_code_settings_native_bg_color").minicolors();';
341
+ echo 'jQuery("#quick_adsense_vi_code_settings_native_text_color").minicolors();';
342
+ echo '</script>';
343
+ die();
344
+ }
345
+
346
+ add_action('wp_ajax_quick_adsense_vi_customize_adcode_form_save_action', 'quick_adsense_vi_customize_adcode_form_save_action');
347
+ function quick_adsense_vi_customize_adcode_form_save_action() {
348
+ check_ajax_referer('quick-adsense', 'quick_adsense_nonce');
349
+ $vicodeSettings = array();
350
+ $vicodeSettings['ad_unit_type'] = ((isset($_POST['quick_adsense_vi_code_settings_ad_unit_type']))?$_POST['quick_adsense_vi_code_settings_ad_unit_type']:'');
351
+ $vicodeSettings['keywords'] = ((isset($_POST['quick_adsense_vi_code_settings_keywords']))?$_POST['quick_adsense_vi_code_settings_keywords']:'');
352
+ $vicodeSettings['iab_category_parent'] = ((isset($_POST['quick_adsense_vi_code_settings_iab_category_parent']))?$_POST['quick_adsense_vi_code_settings_iab_category_parent']:'');
353
+ $vicodeSettings['iab_category_child'] = ((isset($_POST['quick_adsense_vi_code_settings_iab_category_child']))?$_POST['quick_adsense_vi_code_settings_iab_category_child']:'');
354
+ $vicodeSettings['language'] = ((isset($_POST['quick_adsense_vi_code_settings_language']))?$_POST['quick_adsense_vi_code_settings_language']:'');
355
+ $vicodeSettings['native_bg_color'] = ((isset($_POST['quick_adsense_vi_code_settings_native_bg_color']))?$_POST['quick_adsense_vi_code_settings_native_bg_color']:'');
356
+ $vicodeSettings['native_text_color'] = ((isset($_POST['quick_adsense_vi_code_settings_native_text_color']))?$_POST['quick_adsense_vi_code_settings_native_text_color']:'');
357
+ $vicodeSettings['font_family'] = ((isset($_POST['quick_adsense_vi_code_settings_font_family']))?$_POST['quick_adsense_vi_code_settings_font_family']:'');
358
+ $vicodeSettings['font_size'] = ((isset($_POST['quick_adsense_vi_code_settings_font_size']))?$_POST['quick_adsense_vi_code_settings_font_size']:'');
359
+ $vicodeSettings['optional_1'] = ((isset($_POST['quick_adsense_vi_code_settings_optional_1']))?$_POST['quick_adsense_vi_code_settings_optional_1']:'');
360
+ $vicodeSettings['optional_2'] = ((isset($_POST['quick_adsense_vi_code_settings_optional_2']))?$_POST['quick_adsense_vi_code_settings_optional_2']:'');
361
+ $vicodeSettings['optional_3'] = ((isset($_POST['quick_adsense_vi_code_settings_optional_3']))?$_POST['quick_adsense_vi_code_settings_optional_3']:'');
362
+ update_option('quick_adsense_vi_code_settings', $vicodeSettings);
363
+ $viCodeStatus = quick_adsense_vi_api_set_vi_code($vicodeSettings);
364
+ if(is_array($viCodeStatus) && (isset($viCodeStatus['status'])) && ($viCodeStatus['status'] == 'error')) {
365
+ if($viCodeStatus['errorCode'] == 'WIVI108') {
366
+ echo '###FAIL###';
367
+ echo '<p class="viError">'.$viCodeStatus['message'].'</p>';
368
+ } else {
369
+ echo '###FAIL###';
370
+ echo '<p class="viError">There was an error processing your request, our team was notified.<br />Please try again later.</p>';
371
+ }
372
+ } else {
373
+ echo '###SUCCESS###';
374
+ }
375
+ die();
376
+ }
377
+
378
+ function quick_adsense_vi_customize_adcode_get_settings() {
379
+ $vicodeSettings = get_option('quick_adsense_vi_code_settings');
380
+
381
+ $output = '';
382
+ if(isset($vicodeSettings) && is_array($vicodeSettings)) {
383
+ $output .= '<p class="quick_adsense_vi_code_data_wrapper">';
384
+ if(isset($vicodeSettings['ad_unit_type']) && ($vicodeSettings['ad_unit_type'] != '') && ($vicodeSettings['ad_unit_type'] != 'select')) {
385
+ $output .= '<label>Ad Unit:</label><b>vi stories</b>';
386
+ }
387
+
388
+ if(isset($vicodeSettings['keywords']) && ($vicodeSettings['keywords'] != '')) {
389
+ $output .= '<label>Keywords:</label><b>'.$vicodeSettings['keywords'].'</b>';
390
+ }
391
+
392
+ if(isset($vicodeSettings['iab_category_child']) && ($vicodeSettings['iab_category_child'] != '') && ($vicodeSettings['iab_category_child'] != 'select')) {
393
+ $IABChildCategories = quick_adsense_vi_get_constant_iab_child_categories();
394
+ foreach($IABChildCategories as $IABChildCategoryItem) {
395
+ if($vicodeSettings['iab_category_child'] == $IABChildCategoryItem['value']) {
396
+ $output .= '<label>IAB Category:</label><b>'.$IABChildCategoryItem['text'].'</b>';
397
+ }
398
+ }
399
+ }
400
+
401
+ $languages = quick_adsense_vi_api_get_languages();
402
+ if(isset($vicodeSettings['language']) && ($vicodeSettings['language'] != '') && ($vicodeSettings['language'] != 'select')) {
403
+ if($languages != false) {
404
+ foreach($languages as $key => $value) {
405
+ if($vicodeSettings['language'] == $key) {
406
+ $output .= '<label>Language:</label><b>'.$value.'</b>';
407
+ }
408
+ }
409
+ }
410
+ }
411
+
412
+ if(isset($vicodeSettings['native_bg_color']) && ($vicodeSettings['native_bg_color'] != '')) {
413
+ $output .= '<label>Native Background color:</label><b>'.$vicodeSettings['native_bg_color'].'</b>';
414
+ }
415
+
416
+ if(isset($vicodeSettings['native_text_color']) && ($vicodeSettings['native_text_color'] != '')) {
417
+ $output .= '<label>Native Text color:</label><b>'.$vicodeSettings['native_text_color'].'</b>';
418
+ }
419
+
420
+ if(isset($vicodeSettings['font_family']) && ($vicodeSettings['font_family'] != '') && ($vicodeSettings['font_family'] != 'select')) {
421
+ $fontFamily = quick_adsense_vi_get_constant_fonts();
422
+ foreach($fontFamily as $fontFamilyItem) {
423
+ if($vicodeSettings['font_family'] == $fontFamilyItem['value']) {
424
+ $output .= '<label>Native Text Font Family:</label><b>'.$fontFamilyItem['text'].'</b>';
425
+ }
426
+ }
427
+ }
428
+
429
+ if(isset($vicodeSettings['font_size']) && ($vicodeSettings['font_size'] != '') && ($vicodeSettings['font_size'] != 'select')) {
430
+ $fontSize = quick_adsense_vi_get_constant_font_sizes();
431
+ foreach($fontSize as $fontSizeItem) {
432
+ if($vicodeSettings['font_size'] == $fontSizeItem['value']) {
433
+ $output .= '<label>Native Text Font Size:</label><b>'.$fontSizeItem['text'].'</b>';
434
+ }
435
+ }
436
+ }
437
+
438
+ if(isset($vicodeSettings['optional_1']) && ($vicodeSettings['optional_1'] != '')) {
439
+ $output .= '<label>Optional 1:</label><b>'.$vicodeSettings['optional_1'].'</b>';
440
+ }
441
+ if(isset($vicodeSettings['optional_2']) && ($vicodeSettings['optional_2'] != '')) {
442
+ $output .= '<label>Optional 2:</label><b>'.$vicodeSettings['optional_1'].'</b>';
443
+ }
444
+ if(isset($vicodeSettings['optional_3']) && ($vicodeSettings['optional_3'] != '')) {
445
+ $output .= '<label>Optional 3:</label><b>'.$vicodeSettings['optional_1'].'</b>';
446
+ }
447
+ $output .= '</p>';
448
+ }
449
+ return $output;
450
+ }
451
+ /* End Configure vi Code */
452
+
453
+ /* Begin ads.txt */
454
+ add_action('wp_ajax_quick_adsense_vi_update_adstxt', 'quick_adsense_vi_update_adstxt');
455
+ function quick_adsense_vi_update_adstxt() {
456
+ check_ajax_referer('quick-adsense', 'quick_adsense_nonce');
457
+ $adstxtContent = quick_adsense_adstxt_get_content();
458
+ $adstxtContentData = array_filter(explode("\n", trim($adstxtContent)), 'trim');
459
+ $viEntry = quick_adsense_vi_api_get_adstxt_content();
460
+ if(strpos(str_replace(array("\r", "\n", " "), '', $adstxtContent), str_replace(array("\r", "\n", " "), '', $viEntry)) !== false) {
461
+ die();
462
+ } else {
463
+ $updatedAdstxtContent = '';
464
+ if(strpos($adstxtContent, '# 41b5eef6') !== false) {
465
+ foreach($adstxtContentData as $line) {
466
+ if(strpos($line, '# 41b5eef6') !== false) {
467
+
468
+ } else {
469
+ $updatedAdstxtContent .= str_replace(array("\r", "\n", " "), '', $line)."\r\n";
470
+ }
471
+ }
472
+ $updatedAdstxtContent .= $viEntry;
473
+ } else {
474
+ $updatedAdstxtContent .= $adstxtContent."\r\n".$viEntry;
475
+ }
476
+
477
+ $adsTxtExists = quick_adsense_adstxt_file_exists();
478
+ if(quick_adsense_adstxt_update_content($updatedAdstxtContent)) {
479
+ echo '###SUCCESS###';
480
+
481
+ if(!$adsTxtExists) {
482
+ echo '<div class="notice notice-warning quick_adsense_adsstxt_notice is-dismissible" style="padding: 5px 15px;">';
483
+ echo '<div style="font-size: 14px; font-family: Arial; line-height: 18px; color: #232323;">';
484
+ echo '<p><b>Quick AdSense has created ads.txt file in the root folder of your web site.</b></p>';
485
+ echo '<p>Without this file vi can\'t sell your inventory.<br />If you happen to use another plugin and Google AdSense, please make sure that Google AdSense Publisher ID is added into the ads.txt file. Otherwise, Google might stop delivering ads into that plugin.<br /><br />Check <a href="https://www.vi.ai/faq-ads-txt/?utm_source=Wordpress&utm_medium=wp_quickadsense" target="_blank">FAQ</a> for more information on ads.txt project.</p>';
486
+ echo '</div>';
487
+ echo '<button type="button" class="notice-dismiss" onclick="javascript:jQuery(this).parent().remove()"><span class="screen-reader-text">Dismiss this notice.</span></button>';
488
+ echo '</div>';
489
+ } else {
490
+ echo '<div class="notice notice-warning quick_adsense_adsstxt_notice is-dismissible" style="padding: 5px 15px;">';
491
+ echo '<div style="float: left; max-width: 875px; font-size: 14px; font-family: Arial; line-height: 18px; color: #232323;">';
492
+ echo '<p><b>ADS.TXT has been added</b></p>';
493
+ echo '<p>Quick Adsense 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/?aid=WP_quickadsense&utm_source=Wordpress&utm_medium=wp_quickadsense">FAQ</a>.</p>';
494
+ echo '</div>';
495
+ echo '<img style="float: right; margin-right: 20px; margin-top: 13px;" src="'.plugins_url('/images/vi-big-logo.png', __FILE__).'" />';
496
+ echo '<div class="clear"></div>';
497
+ echo '<button type="button" class="notice-dismiss" onclick="javascript:jQuery(this).parent().remove()"><span class="screen-reader-text">Dismiss this notice.</span></button>';
498
+ echo '</div>';
499
+ }
500
+ } else {
501
+ echo '###FAIL###';
502
+ echo '<div class="notice notice-error quick_adsense_adsstxt_notice is-dismissible" style="padding: 5px 15px;">';
503
+ echo '<div style="float: left; max-width: 875px; font-size: 14px; font-family: Arial; line-height: 18px; color: #232323;">';
504
+ echo '<p><b>ADS.TXT couldn’t be added</b></p>';
505
+ echo '<p>Important note: Quick Adsense hasn’t been able to update your ads.txt file. Please make sure that you enter the following lines manually:</p>';
506
+ 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>';
507
+ echo '</div>';
508
+ echo '<img style="float: right; margin-right: 20px; margin-top: 13px;" src="'.plugins_url('/images/vi-big-logo.png', __FILE__).'" />';
509
+ echo '<div class="clear"></div>';
510
+ echo '<button type="button" class="notice-dismiss" onclick="javascript:jQuery(this).parent().remove()"><span class="screen-reader-text">Dismiss this notice.</span></button>';
511
+ echo '</div>';
512
+ }
513
+ }
514
+ die();
515
+ }
516
+ /* End ads.txt */
517
+ ?>
includes/widgets.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ add_action('widgets_init', 'quick_adsense_widgets_init');
3
+ function quick_adsense_widgets_init() {
4
+ $settings = get_option('quick_adsense_settings');
5
+ for($i = 1; $i <= 10; $i++) {
6
+ if(isset($settings['widget_ad_'.$i.'_content']) && ($settings['widget_ad_'.$i.'_content'] != '')) {
7
+ register_widget(new quickAdsenseAdWidget($i));
8
+ }
9
+ }
10
+ }
11
+
12
+ class quickAdsenseAdWidget extends WP_Widget {
13
+ public function __construct($id) {
14
+ parent::__construct(sanitize_title(str_replace(array('(',')'), '', 'AdsWidget'.$id.' (Quick Adsense)')), 'AdsWidget'.$id.' (Quick Adsense)', array('description' => 'Quick Adsense on Sidebar Widget'));
15
+ }
16
+
17
+ public function widget($args, $instance) {
18
+ extract($args);
19
+ $content = get_the_content();
20
+ $settings = get_option('quick_adsense_settings');
21
+ if((strpos($content, "<!--OffAds-->") === false) && (strpos($content, "<!--OffWidget-->") === false) && !(is_home() && $settings['disable_widgets_on_homepage'])) {
22
+ $widgetIndex = str_replace(array('AdsWidget', ' (Quick Adsense)'), '', $args['widget_name']);
23
+ echo "\n"."<!-- Quick Adsense Wordpress Plugin: http://quickadsense.com/ -->"."\n";
24
+ echo $before_widget;
25
+ echo ((isset($settings['widget_ad_'.$widgetIndex.'_content']))?$settings['widget_ad_'.$widgetIndex.'_content']:'');
26
+ echo $after_widget;
27
+ }
28
+ }
29
+
30
+ public function update($new_opts, $old_opts) {
31
+ return $new_opts;
32
+ }
33
+
34
+ public function form($instance) {
35
+ echo '<p>There are no options for this widget.</p>';
36
+ }
37
+ }
38
+ ?>
quick-adsense.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin URI: http://quickadsense.com/
5
  Description: Quick Adsense offers a quicker & flexible way to insert Google Adsense or any Ads code into a blog post.
6
  Author: Quicksense
7
- Version: 2.2
8
  Author URI: http://quickadsense.com/
9
  */
10
  /*
@@ -22,7 +22,18 @@
22
  along with this program; if not, write to the Free Software
23
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24
  */
 
 
 
25
  require_once(dirname(__FILE__).'/includes/settings.php');
26
- require_once(dirname(__FILE__).'/includes/ads.php');
27
- require_once(dirname(__FILE__).'/includes/migrate.php');
 
 
 
 
 
 
 
 
28
  ?>
4
  Plugin URI: http://quickadsense.com/
5
  Description: Quick Adsense offers a quicker & flexible way to insert Google Adsense or any Ads code into a blog post.
6
  Author: Quicksense
7
+ Version: 2.3
8
  Author URI: http://quickadsense.com/
9
  */
10
  /*
22
  along with this program; if not, write to the Free Software
23
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24
  */
25
+ /*Begin Include Files*/
26
+ require_once(dirname(__FILE__).'/includes/defaults.php');
27
+ require_once(dirname(__FILE__).'/includes/controls.php');
28
  require_once(dirname(__FILE__).'/includes/settings.php');
29
+ require_once(dirname(__FILE__).'/includes/widgets.php');
30
+ require_once(dirname(__FILE__).'/includes/quicktags.php');
31
+ require_once(dirname(__FILE__).'/includes/content.php');
32
+ require_once(dirname(__FILE__).'/includes/api/vi.php');
33
+ require_once(dirname(__FILE__).'/includes/api/vi-constants.php');
34
+ require_once(dirname(__FILE__).'/includes/vi.php');
35
+ require_once(dirname(__FILE__).'/includes/adsense.php');
36
+ /*End Include Files*/
37
+
38
+ register_deactivation_hook(__FILE__, 'quick_adsense_admin_notice_reactivate');
39
  ?>
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: quickadsense
3
  Tags: WordPress Plugin, adsense, google adsense, random adsense, random ads, advertising, adsense insertion, ad manager, ad, yahoo, google, ads, text insertion, widget, sidebar, admin, posts, plugin
4
  Requires at least: 4.0
5
  Tested up to: 4.9.4
6
- Stable tag: 2.2
7
 
8
  Quick Adsense offers a quicker & flexible way to insert Google Adsense or any Ads code into a blog post.
9
 
@@ -46,8 +46,13 @@ Sign up for a [Google Adsense Account](http://adsense.google.com/) to generate r
46
  == Frequently Asked Questions ==
47
 
48
  Please feedback to [http://quickadsense.com/](http://quickadsense.com/) for any bug you might have found, or any suggestion you like to add.
49
-
50
  == Change Log ==
 
 
 
 
 
51
  = 2.2 =
52
  * Fixed functionality issues
53
 
3
  Tags: WordPress Plugin, adsense, google adsense, random adsense, random ads, advertising, adsense insertion, ad manager, ad, yahoo, google, ads, text insertion, widget, sidebar, admin, posts, plugin
4
  Requires at least: 4.0
5
  Tested up to: 4.9.4
6
+ Stable tag: 2.3
7
 
8
  Quick Adsense offers a quicker & flexible way to insert Google Adsense or any Ads code into a blog post.
9
 
46
  == Frequently Asked Questions ==
47
 
48
  Please feedback to [http://quickadsense.com/](http://quickadsense.com/) for any bug you might have found, or any suggestion you like to add.
49
+
50
  == Change Log ==
51
+ = 2.3 =
52
+ * Updated ads.txt modification logic
53
+ * Introduced monetization with video intelligence AG
54
+ * UI fixes
55
+
56
  = 2.2 =
57
  * Fixed functionality issues
58
 
screenshot-1.png CHANGED
Binary file
screenshot-2.png CHANGED
Binary file