Version Description
- New: VI Integration
- New: Compatible up to WP 4.9
Download this release
Release Info
Developer | ReneHermi |
Plugin | AdSense Plugin WP QUADS |
Version | 1.7.0 |
Comparing to | |
See all releases |
Code changes from version 1.6.1 to 1.7.0
- assets/css/quads-admin.css +204 -1
- assets/css/quads-admin.min.css +1 -1
- assets/images/align_left.png +0 -0
- assets/images/align_middle.png +0 -0
- assets/images/align_right.png +0 -0
- assets/images/vi-logo-black.png +0 -0
- assets/images/vi-logo-white.png +0 -0
- assets/js/jscolor.js +1844 -0
- assets/js/jscolor.min.js +10 -0
- assets/js/quads-admin.js +1792 -1600
- assets/js/quads-admin.min.js +199 -3
- includes/Autoloader.php +154 -0
- includes/Cron/Cron.php +51 -45
- includes/DI/InjectionAware.php +39 -0
- includes/Forms/Elements.php +300 -0
- includes/Forms/Elements/Check.php +66 -0
- includes/Forms/Elements/Date.php +28 -0
- includes/Forms/Elements/DateTime.php +26 -0
- includes/Forms/Elements/Email.php +28 -0
- includes/Forms/Elements/File.php +28 -0
- includes/Forms/Elements/Hidden.php +29 -0
- includes/Forms/Elements/Interfaces/InterfaceElement.php +135 -0
- includes/Forms/Elements/Interfaces/InterfaceElementWithOptions.php +34 -0
- includes/Forms/Elements/Numerical.php +26 -0
- includes/Forms/Elements/Password.php +29 -0
- includes/Forms/Elements/Radio.php +44 -0
- includes/Forms/Elements/Select.php +59 -0
- includes/Forms/Elements/SelectMultiple.php +58 -0
- includes/Forms/Elements/Text.php +28 -0
- includes/Forms/Elements/TextArea.php +28 -0
- includes/Forms/Elements/TextAreaHidden.php +28 -0
- includes/Forms/ElementsWithOptions.php +76 -0
- includes/Forms/Form.php +60 -0
- includes/admin/admin-actions.php +90 -4
- includes/admin/admin-notices.php +184 -11
- includes/admin/adsTxt.php +106 -0
- includes/admin/settings/display-settings.php +7 -4
- includes/admin/settings/register-settings.php +111 -5
- includes/admin/upgrades/upgrade-functions.php +31 -0
- includes/admin/views/notices.php +18 -0
- includes/class-template.php +45 -0
- includes/conditions.php +6 -6
- includes/scripts.php +15 -2
- includes/template-functions.php +1 -38
- includes/vendor/google/adsense.php +94 -0
- includes/vendor/vi/conditions.php +161 -0
- includes/vendor/vi/public/js/vi.js +196 -0
- includes/vendor/vi/render.php +222 -0
- includes/vendor/vi/templates/ad.php +12 -0
- includes/vendor/vi/vi.php +618 -0
- includes/vendor/vi/views/Forms/adSettings.php +630 -0
- includes/vendor/vi/views/ad_settings.php +112 -0
- includes/vendor/vi/views/error.php +13 -0
- includes/vendor/vi/views/logged_in.php +14 -0
- includes/vendor/vi/views/login.php +34 -0
- includes/vendor/vi/views/not_logged_in.php +59 -0
- includes/vendor/vi/views/notices.php +18 -0
- includes/vendor/vi/views/partials/footer.php +8 -0
- includes/vendor/vi/views/partials/header.php +8 -0
- includes/vendor/vi/views/revenue.php +30 -0
- includes/vendor/vi/views/signup.php +12 -0
- includes/viIntegration.php +0 -96
- quick-adsense-reloaded.php +497 -423
- readme.txt +211 -205
- uninstall.php +11 -0
assets/css/quads-admin.css
CHANGED
@@ -984,4 +984,207 @@ p.submit{
|
|
984 |
text-align: center;
|
985 |
width: 20px;
|
986 |
-webkit-font-smoothing: antialiased;
|
987 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
984 |
text-align: center;
|
985 |
width: 20px;
|
986 |
-webkit-font-smoothing: antialiased;
|
987 |
+
}
|
988 |
+
|
989 |
+
.quads-widget-buttons {
|
990 |
+
float:right;
|
991 |
+
}
|
992 |
+
.quads-widget-buttons a{
|
993 |
+
min-width: 80px;text-align: center;font-weight: 600;
|
994 |
+
}
|
995 |
+
|
996 |
+
#quads-vi-widget ul {
|
997 |
+
margin: 0;
|
998 |
+
margin-left:25px;
|
999 |
+
padding: 0;
|
1000 |
+
background: #fff;
|
1001 |
+
float: none;
|
1002 |
+
padding-top: 0px;
|
1003 |
+
list-style-type: square;
|
1004 |
+
}
|
1005 |
+
|
1006 |
+
#quads-vi-signup-fullscreen{
|
1007 |
+
display:none;
|
1008 |
+
z-index: 999999;
|
1009 |
+
box-sizing:border-box;
|
1010 |
+
-webkit-box-sizing:border-box;
|
1011 |
+
-moz-box-sizing:border-box;
|
1012 |
+
height: 100%;
|
1013 |
+
width: 100%;
|
1014 |
+
position: absolute;
|
1015 |
+
top: 50%;
|
1016 |
+
left: 50%;
|
1017 |
+
transform: translate(-50%, -50%);
|
1018 |
+
background-color:#f0f0f0;
|
1019 |
+
|
1020 |
+
}
|
1021 |
+
|
1022 |
+
#quads-vi-signup-container {
|
1023 |
+
width:99%;
|
1024 |
+
height:99%;
|
1025 |
+
max-width:868px;
|
1026 |
+
max-height:552px;
|
1027 |
+
}
|
1028 |
+
|
1029 |
+
#quads-vi-close{
|
1030 |
+
cursor:pointer;
|
1031 |
+
position: relative;
|
1032 |
+
display: inline-block;
|
1033 |
+
width: 20px;
|
1034 |
+
height: 20px;
|
1035 |
+
overflow: hidden;
|
1036 |
+
float: right;
|
1037 |
+
margin-right: 20px;
|
1038 |
+
margin-top: 20px;
|
1039 |
+
}
|
1040 |
+
|
1041 |
+
#quads-vi-close::before, #quads-vi-close::after {
|
1042 |
+
content: '';
|
1043 |
+
position: absolute;
|
1044 |
+
height: 2px;
|
1045 |
+
width: 100%;
|
1046 |
+
top: 50%;
|
1047 |
+
left: 0;
|
1048 |
+
margin-top: -1px;
|
1049 |
+
background: #7d7d7d;
|
1050 |
+
}
|
1051 |
+
|
1052 |
+
#quads-vi-close::before {
|
1053 |
+
-webkit-transform: rotate(45deg);
|
1054 |
+
-moz-transform: rotate(45deg);
|
1055 |
+
-ms-transform: rotate(45deg);
|
1056 |
+
-o-transform: rotate(45deg);
|
1057 |
+
transform: rotate(45deg);
|
1058 |
+
}
|
1059 |
+
#quads-vi-close::after {
|
1060 |
+
-webkit-transform: rotate(-45deg);
|
1061 |
+
-moz-transform: rotate(-45deg);
|
1062 |
+
-ms-transform: rotate(-45deg);
|
1063 |
+
-o-transform: rotate(-45deg);
|
1064 |
+
transform: rotate(-45deg);
|
1065 |
+
}
|
1066 |
+
|
1067 |
+
|
1068 |
+
#quads-vi-signup-fullscreen iframe{
|
1069 |
+
width:100%;
|
1070 |
+
height:100%;
|
1071 |
+
z-index: 999999;
|
1072 |
+
display: block;
|
1073 |
+
background:#FFF;
|
1074 |
+
border:none;
|
1075 |
+
}
|
1076 |
+
|
1077 |
+
.quads-spinner {
|
1078 |
+
background: url('/wp-admin/images/spinner.gif') no-repeat;
|
1079 |
+
background-size: 16px 16px;
|
1080 |
+
display: none;
|
1081 |
+
float: left;
|
1082 |
+
opacity: .7;
|
1083 |
+
filter: alpha(opacity=70);
|
1084 |
+
width: 160px;
|
1085 |
+
height: 16px;
|
1086 |
+
margin: 5px 5px 0;
|
1087 |
+
clear:both;
|
1088 |
+
}
|
1089 |
+
|
1090 |
+
#quads-vi-revenue-wrapper{
|
1091 |
+
margin-top: 10px;
|
1092 |
+
min-width: 565px;
|
1093 |
+
min-height: 350px;
|
1094 |
+
}
|
1095 |
+
|
1096 |
+
#quads-vi-revenue-sum {
|
1097 |
+
font-weight: bold;
|
1098 |
+
font-size: 36px;
|
1099 |
+
}
|
1100 |
+
|
1101 |
+
#quads-vi-revenue-sum-wrapper{
|
1102 |
+
margin-top: 20px;
|
1103 |
+
line-height: 26px;
|
1104 |
+
}
|
1105 |
+
|
1106 |
+
#quads-vi-customize-player label {
|
1107 |
+
display:inline-block;
|
1108 |
+
width:170px;
|
1109 |
+
color:black;
|
1110 |
+
font-weight: 500;
|
1111 |
+
}
|
1112 |
+
#quads-vi-shortcodes label {
|
1113 |
+
display:inline-block;
|
1114 |
+
width:170px;
|
1115 |
+
}
|
1116 |
+
#quads-vi-save-settings {
|
1117 |
+
margin-top:20px;
|
1118 |
+
}
|
1119 |
+
|
1120 |
+
#quads-vi-welcome ul {
|
1121 |
+
float:none;
|
1122 |
+
list-style: square;
|
1123 |
+
margin-left:25px;
|
1124 |
+
}
|
1125 |
+
|
1126 |
+
.quads-tooltip {
|
1127 |
+
border-radius: 50%;
|
1128 |
+
border: 2px solid #fff;
|
1129 |
+
background-color: #e7db00;
|
1130 |
+
width: 15px;
|
1131 |
+
height: 15px;
|
1132 |
+
display: inline-block;
|
1133 |
+
position: relative;
|
1134 |
+
top: 4px;
|
1135 |
+
margin-top: -4px;
|
1136 |
+
cursor: pointer;
|
1137 |
+
margin-left: 2px;
|
1138 |
+
}
|
1139 |
+
|
1140 |
+
.quads-tooltip:after {
|
1141 |
+
height: 20px;
|
1142 |
+
font-family: sans-serif;
|
1143 |
+
content: "?";
|
1144 |
+
color: #fff;
|
1145 |
+
font-size: 11px;
|
1146 |
+
font-weight: 700;
|
1147 |
+
left: 4px;
|
1148 |
+
top:-2px;
|
1149 |
+
position: absolute;
|
1150 |
+
}
|
1151 |
+
|
1152 |
+
.quads-tooltip-message {
|
1153 |
+
padding: 10px;
|
1154 |
+
border: 1px solid #FBFBFB;
|
1155 |
+
border-radius: 2px;
|
1156 |
+
background-color: #F8F8F8;
|
1157 |
+
position: absolute;
|
1158 |
+
max-width: 500px;
|
1159 |
+
z-index: 9999;
|
1160 |
+
display: none;
|
1161 |
+
box-shadow: 0 0 5px rgba(0,0,0,.2);
|
1162 |
+
font-weight: 400;
|
1163 |
+
}
|
1164 |
+
|
1165 |
+
#quads-vi-layout label{
|
1166 |
+
width: 100px;
|
1167 |
+
}
|
1168 |
+
|
1169 |
+
#quads_vi_ads-ads-1-align-left-label{
|
1170 |
+
content: url('../images/align_left.png');
|
1171 |
+
}
|
1172 |
+
#quads_vi_ads-ads-1-align-right-label{
|
1173 |
+
content: url('../images/align_right.png');
|
1174 |
+
}
|
1175 |
+
#quads_vi_ads-ads-1-align-middle-label{
|
1176 |
+
content: url('../images/align_middle.png');
|
1177 |
+
}
|
1178 |
+
|
1179 |
+
/*.quads-vi-welcome-white {
|
1180 |
+
text-decoration: underline;
|
1181 |
+
border-bottom:3px solid yellow;
|
1182 |
+
font-weight: bold;
|
1183 |
+
color:black;
|
1184 |
+
}
|
1185 |
+
.quads-vi-welcome-black {
|
1186 |
+
text-decoration: underline;
|
1187 |
+
border-bottom:3px solid yellow;
|
1188 |
+
font-weight: bold;
|
1189 |
+
color:white;
|
1190 |
+
}*/
|
assets/css/quads-admin.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.quads-share-button-container{margin:5px 0}.quads-share-button-container p{margin:0 0 10px}.quads-share-button{display:inline-block}.quads-share-button a{text-decoration:none}.quads-share-button .quads-share{font-family:sans-serif;font-weight:700;text-decoration:none;text-align:center;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;color:#FFF;display:inline;font-size:16px;width:40px;padding:4px 8px}.quads-share-button-twitter .quads-share{background-color:#00ABF0}.quads-share-button-facebook .quads-share{background-color:#3b5998}.quads-share-button-googleplus .quads-share{background-color:#F53424}.quads-share-button-facebook .share:active,.quads-share-button-googleplus .share:active,.quads-share-button-twitter .share:active{background-color:#353535}@media (max-width:925px){.quads-share-button .quads-share{font-size:15px;padding:8px 16px}}.quads-richeditor{font-size:11px}#quads-add-ons h2{margin:0 0 15px}#quads-add-ons .quadsshare-addons{float:left;margin:0 15px 15px 0;background:#f0f0f0;border:1px solid #ccc;width:320px;padding:8px;height:315px;position:relative}#quads-add-ons .quadsshare-addons h3{margin:0 0 8px;font-size:13px}#quads-add-ons .quadsshare-addons .button-secondary{position:absolute;bottom:8px;left:8px}#quads-add-ons .quadsshare-addons .third-party{display:none}#system-info-textarea{width:580px;height:400px;font-family:Menlo,Monaco,monospace;background:0 0;white-space:pre;overflow:auto;display:block}.quads-select-chosen{width:300px}input.large-text,textarea.large-text{max-width:600px}input.medium-text,textarea.medium-text{min-width:190px}#quads_tab_container ul{list-style:none;margin:0;padding:0;background:#fff;float:left}#quads_tab_container ul li:first-child.selected-tab{border-top:none}#quads_tab_container ul li a.selected-tab{font-weight:700;text-decoration:none}#quads_tab_container .quads-row{padding-top:12px;padding-bottom:12px}#quads_tab_container .quads-row label strong,#tab_container .quads-row strong{font-weight:700}.quads-tabs a{padding:5px;color:#a1a1a1;text-transform:uppercase}.quads-tabs a strong{font-weight:700}li.quads-tabs{float:left;margin-left:0;background-color:#e5e5e5}#quads_tab_container>ul>li.quads-tabs.active{background-color:#fff}#quads_tab_container>ul>li.quads-tabs.active a{color:#83c11f}#quads_tab_container .quads-panel-container{background:#FFF;padding:20px;overflow:auto;text-align:left;margin-bottom:10px;max-width:640px;float:left;clear:both}.form-table{margin-top:-20px}#quads_tab_container .form-table th{vertical-align:top;text-align:left;padding:20px 10px 20px 0;line-height:1.3;font-weight:700;font-size:14px;color:#484848;width:30%}#quads_tab_container .form-table tr{border-bottom:1px solid #E7E7E7}#quads_tab_container span.description{display:block;font-weight:400;font-style:normal;font-size:13px;margin-top:7px;color:#484848}#quads_tab_container .col-title{font-size:18px;color:#484848}@media only screen and (max-width:680px){#quads_tab_container ul{float:none;background:#fff}#quads_tab_container .form-table tr>th{width:100%}#quads_tab_container span.description{font-size:14px}#quads_tab_container .form-table tr>th,#tab_container .form-table tr>td{padding:10px}#quads_tab_container .quads-tabs a{text-align:left}#quads_tab_container li.quads-tabs{float:none;margin-left:0}}#quads_tab_container ul li.quads-tabs{margin-bottom:0}#quads_tab_container ul li.quads-tabs a{display:block;padding:10px;text-decoration:none;font-weight:700}#quads_tab_container ul li.quads-tabs a:hover{color:#383838}#quads_tab_container ul li.quads-tabs a.active{text-decoration:underline}#quads_tab_container table tbody tr:nth-child(1)>th>div{font-size:20px}#quadstabcontainer>.quadstabs{background-color:#fff}#quadstabcontainer ul .active{background-color:#00adef;color:#fff;border-bottom-color:#0098D2}#quadstabcontainer ul .active:hover{background-color:#00A4E2;color:#fff;border-bottom-color:#0098D2}#quadstabcontainer ul li a{padding:10px 14px;background-color:#f3f3f3}#quadstabcontainer .quadstab-container{border:0 solid #ececec}.quads-quote-docs{font-family:Courier New,Courier,Fixed;color:#050}.quads-desc{display:block;font-style:italic;padding-top:10px}.quads-postbox{padding:10px;position:relative;min-width:255px;border:1px solid #e5e5e5;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.04);box-shadow:0 1px 1px rgba(0,0,0,.04);background:#fff;margin-bottom:20px}.nav-tab-active{background-color:#fff;border-bottom:0}#quads-add-ons{padding:20px}.quads-toggle{position:absolute;right:0;top:0}.quads-box-close .quads-close-open-icon{background-position:0 -38px}.quads-close-open-icon{width:38px;height:38px;background:url(../images/arrow-close.png) repeat-y #f4f4f4}.quads-ad-toggle-header{position:relative;background-color:#f4f4f4;margin-bottom:2px;padding:10px 10px 10px 15px;-moz-user-select:-moz-none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none;user-select:none;cursor:pointer!important;min-height:20px}.quads-ad-toggle-container{padding:20px;background-color:#f4f4f4}.quads-toogle-title{font-size:16px;font-weight:700}.adsense-size-title,.quads-advanced-description label{font-weight:600;font-size:12px;text-transform:uppercase;float:left}.quads-advanced-description label{width:215px}.quads-advanced-ad-box{clear:both;margin-top:20px;margin-bottom:20px}.adsense-size-title{margin-right:0;line-height:32px;margin-left:14px;min-width:100px}.quads-select-style-overwrite{border:1px solid #e6e6e6;width:150px;overflow:hidden;background:url(../images/box_arrow.png) 120px 0 repeat-y #fff;margin:0 0 5px}.quads-select-style-overwrite select{width:150px}.quads-size-input{position:relative;top:-1px;width:110%;border:none;box-shadow:none;background:0 0;-webkit-appearance:none;font-family:'Open Sans',arial,sans-serif;color:#555;font-size:12px}.quads-pro-overlay{height:200px}.quads-license-error-notice,.quads-license-expires-soon-notice{background-color:#fff;padding:10px;overflow:auto;-webkit-box-shadow:0 1px 1px 0 rgba(0,0,0,.1);box-shadow:0 1px 1px 0 rgba(0,0,0,.1);border:1px solid #ECECEC;border-radius:3px}.quads-license-error-notice a{color:#0097df;text-decoration:underline}.quads-license-error-notice{border-left:4px solid #dd3d36}.quads-license-expiration-date-notice,.quads-license-lifetime-notice,.quads-license-null{padding:0}.quads-license-expiration-date-notice .quads-license-data p,.quads-license-lifetime-notice .quads-license-data p{color:#666;font-size:14px;font-style:italic;margin:4px 0 0}#quads_settingslicenses_header-nav{display:none}#quads_settingslicenses_header{max-width:640px}#quads_settingslicenses_header .quads-row.th{min-width:250px}.quads-notice{background:#fff;border-left:4px solid #46b450;-webkit-box-shadow:0 1px 1px 0 rgba(0,0,0,.1);box-shadow:0 1px 1px 0 rgba(0,0,0,.1);margin:5px 15px 2px;padding:1px 12px}.quads_admin h2.nav-tab-wrapper{border:0}.quads_admin .nav-tab{border:0;text-transform:uppercase;color:#a1a1a1;font-weight:700}.quads-h1{margin-bottom:1.35rem;font-size:2.5em;line-height:3.68rem;letter-spacing:normal}.quads-h2{margin-top:0;margin-bottom:1.2rem;font-size:30px;line-height:2.5rem}.quads-heading-pro{color:#83c11f;font-weight:700}.quads-button.green{display:inline-block;background-color:#83c11f;padding:10px;min-width:170px;color:#fff;font-size:16px;text-decoration:none;text-align:center;margin-top:20px}#quads-add-ons .quads-footer{clear:both;margin-top:20px;font-style:italic}#quads-add-ons li{font-size:18px;line-height:29px;position:relative;padding-left:23px;list-style:none!important}#quads-add-ons li:before{width:1em;height:100%;background:url(data:image/svg+xml;charset=utf8,%3Csvg%20width%3D%221792%22%20height%3D%221792%22%20viewBox%3D%220%200%201792%201792%22%20xmlns%3D%22http%3A%2F%2Fwww%2Ew3%2Eorg%2F2000%2Fsvg%22%3E%3Cpath%20fill%3D%22%2377B227%22%20d%3D%22M1671%20566q0%2040%2D28%2068l%2D724%20724%2D136%20136q%2D28%2028%2D68%2028t%2D68%2D28l%2D136%2D136%2D362%2D362q%2D28%2D28%2D28%2D68t28%2D68l136%2D136q28%2D28%2068%2D28t68%2028l294%20295%20656%2D657q28%2D28%2068%2D28t68%2028l136%20136q28%2028%2028%2068z%22%2F%3E%3C%2Fsvg%3E) left .4em no-repeat;background-size:contain;content:"";position:absolute;top:0;left:0;color:#77b227}.adsense_admin_header{font-size:14px;font-weight:500}#quads-adsense-bg-div{position:fixed;top:0;left:0;width:100%;height:100%;background-color:rgba(0,0,0,.65);z-index:250000}#quads-adsense-container{text-align:center;width:480px;margin:85px auto 0;background-color:#fff;padding:2%;border-radius:2px}#quads-adsense-container h3{margin-top:0}#quads-adsense-container textarea,.quads-ad-toggle-container textarea{width:100%}.quads-ad-toggle-container input{margin-top:7px;margin-bottom:10px}.quads-adsense-code label,input{margin-right:2px}#quads_settings\5b ad2\5d \5b g_data_ad_client\5d{width:200px}.quads-ad-toggle-container label{display:inline-block;margin-right:2px;margin-top:-3px}.quads_adsense_code .quads-add-adsense{margin:20px 5px 20px 0}.quads-label-left{min-width:71px}#quads-label-Type{min-width:67px}.quads-medium-size{width:110px}#quads-msg{display:none;margin:5px;background-color:#c55c5c;color:#fff}.quads-loader,.quads-success-modal{display:block;position:fixed;top:45%;left:25%;width:200px;height:auto;padding:5px 20px;z-index:1002;overflow:auto}.quads-form-table{width:100%}.quads-left-box{width:45%;min-height:100px;float:left;line-height:35px;min-width:300px}@media screen and (max-width:700px){.adsense-size-title{margin-left:0}.quads-left-box{width:45%;min-height:100px;float:none;line-height:35px;min-width:300px}.quads-style img{max-width:50px}}.quads-general-helper,.quads-helper{background-color:#83c11f;width:15px;cursor:pointer}.adsense_admin_header ul li{margin-top:2px;margin-left:20px;list-style-type:square}.quads-helper{border-radius:50%;border:2px solid #fff;height:15px;display:inline-block;position:relative;top:4px;margin-top:-4px;margin-left:2px}.quads-general-helper:after,.quads-helper:after{height:20px;font-family:sans-serif;content:"?";font-size:11px;font-weight:700;left:4px;position:absolute;color:#fff}.quads-helper:after{margin-top:-10px}.quads-general-helper:after{margin-top:-2px}#quads-add-new-ad:before,.quads-delete-ad:before{font-family:quads;margin-right:5px}.quads-general-helper{border-radius:50%;border:2px solid #fff;height:15px;display:inline-block;position:relative;top:4px;margin-top:-4px;margin-left:2px}.quads-message{padding:10px;border:1px solid #FBFBFB;border-radius:2px;background-color:#F8F8F8;position:absolute;max-width:500px;z-index:9999;display:none;box-shadow:0 0 5px rgba(0,0,0,.2);font-weight:400;line-height:20px;text-transform:none;font-size:14px}#quads-pro-hover{background-color:#83c11f;padding:20px;min-width:150px;color:#fff;display:block;position:relative;margin-top:-100px;margin-left:50%}#quads-pro-hover-background{width:100%;height:100%;background:rgba(0,0,0,.6)}#quads-open-toggle{clear:both;float:left;margin-top:10px}#quads_settingsadsense_header input[type=number].small-text{width:55px}.quads_adsense_code input.quads-bggrey{background-color:#f5f5f5;color:#939393}.quads-amp-code{color:#939393;height:130px}.quads-chosen-select .chosen-choices li.search-field input{min-height:25px}#quads-validate{display:block;margin-left:2px;margin-bottom:20px;font-weight:700;clear:both}#quads-add-new-ad,.quads-delete-ad{font-size:14px;font-weight:600;color:#383838;display:block;text-decoration:none}@font-face{font-family:quads;src:url(data:application/octet-stream;base64,d09GRgABAAAAAAxYAA8AAAAAFUQAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABWAAAADsAAABUIIslek9TLzIAAAGUAAAAQwAAAFY+IEkBY21hcAAAAdgAAABQAAABfohD7KljdnQgAAACKAAAABMAAAAgBtX/BGZwZ20AAAI8AAAFkAAAC3CKkZBZZ2FzcAAAB8wAAAAIAAAACAAAABBnbHlmAAAH1AAAAdIAAAJWlz85pGhlYWQAAAmoAAAAMwAAADYNxZM1aGhlYQAACdwAAAAfAAAAJAc6A1BobXR4AAAJ/AAAAAwAAAAMClL//WxvY2EAAAoIAAAACAAAAAgAxAErbWF4cAAAChAAAAAgAAAAIAESDApuYW1lAAAKMAAAAXcAAALNzJ0dH3Bvc3QAAAuoAAAAMwAAAESFVFBUcHJlcAAAC9wAAAB6AAAAhuVBK7x4nGNgZGBg4GIwYLBjYHJx8wlh4MtJLMljkGJgYYAAkDwymzEnMz2RgQPGA8qxgGkOIGaDiAIAJjsFSAB4nGNgZC5knMDAysDAVMW0h4GBoQdCMz5gMGRkAooysDIzYAUBaa4pDA4vGF4wMgf9z2KIYg5imAYUZgTJAQDj3AufAHic7ZCxDYAwDATPiaFAjEFBwTBU7F+yRfK2GYOX7qR/uTKwAF1cwsEejMit1XLvbLk7R9547K+NIRNW93STVv7s6fNrLf5U1OcK2gTMuAtdeJxjYEADEhDIHPQ/C4QBEmwD3QB4nK1WaXfTRhQdeUmchCwlCy1qYcTEabBGJmzBgAlBsmMgXZytlaCLFDvpvvGJ3+Bf82Tac+g3flrvGy8kkLTncJqTo3fnzdXM22USWpLYC+uRlJsvxdTWJo3sPAnphk3LUXwoO3shZYrJ3wVREK2W2rcdh0REIlC1rrBEEPseWZpkfOhRRsu2pFdNyi096S5b40G9Vd9+GjrKsTuhpGYzdGg9siVVGFWiSKY9UtKmZaj6K0krvL/CzFfNUMKITiJpvBnG0EjeG2e0ymg1tuMoimyy3ChSJJrhQRR5lNUS5+SKCQzKB82Q8sqnEeXD/Iis2KOcVrBLttP8vi95p3c5P7Ffb1G25EAfyI7s4Ox0JV+EW1th3LST7ShUEXbXd0Js2exU/2aP8ppGA7crMr3QjGCpfIUQKz+hzP4hWS2cT/mSR6NaspETQetlTuxLPoHW44gpcc0YWdDd0QkR1P2SMwz2mD4e/PHeKZYLEwJ4HMt6RyWcCBMpYXM0SdowcmAlZYsqqfWumDjldVrEW8J+7drRl85o41B3YjxbDx1bOVHJ8WhSp5lMndpJzaMpDaKUdCZ4zK8DKD+iSV5tYzWJlUfTOGbGhEQiAi3cS1NBLDuxpCkEzaMZvbkbprl2LVqkyQP13KP39OZWuLnTU9oO9LNGf1anYjrYC9PpaeQv8Wna5SJF6frpGX5M4kHWAjKRLTbDlIMHb/0O0svXlhyF1wbY7u3zK6h91kTwpAH7G9AeT9UpCUyFmFWIVkBirWtZlsnVrBapyNR3Q5pWvqzTBIpyHBfHvoxx/V8zM5aYEr7fidOzIy49c+1LCNMcfJt1PZrXqcVyAXFmeU6nWZbv6zTH8gOd5lme1+kIS1unoyw/1GmB5Uc6HWN5QQuadN/BkIsw5AIOkDCEpQNDWF6CISwVDGG5CENYFmEIyyUYwvJjGMJyGYawvKxl1dRTSePamVgGbEJgYo4eucxF5WoquVRCu2hUakOeEm6VVBTPqn9loF488oY5sBZIl8iaXzHOlY9G5fjWFS1vGjtXwLHqbx+O9jnxUtaLhT8F/9XWVCW9Ys3Dk6vwG4aebCeqNql4dE2Xz1U9uv5fVFRYC/QbSIVYKMqybHBnIoSPOp2GaqCVQ8xszDy063XLmp/D/TcxQhZQ/fg3FBoL3INOWUlZ7eCs1dfbstw7g3I4EyxJMTfz+lb4IiOz0n6RWcqej3wecAWMSmXYagOtFbzZJzEPmd4kzwRxW1E2SNrYzgSJDRzzgHnznQQmYeqqDeRO4YYN+AVhbsF5J1yieqMsh+5F7PMopPxbp+JE9qhojMCz2Rthr+9Cym9xDCQ0+aV+DFQVoakYNRXQNFJuqAZfxtm6bULGDvQjKnbDsqziw8cW95WSbRmEfKSI1aOjn9Zeok6q3H5mFJfvnb4FwSA1MX9733RxkMq7WskyR20DU7calVPXmkPjVYfq5lH1vePsEzlrmm66Jx56X9Oq28HFXCyw9m0O0lImF9T1YYUNosvFpVDqZTRJ77gHGBYY0O9Qio3/q/rYfJ4rVYXRcSTfTtS30edgDPwP2H9H9QPQ92Pocg0uz/eaE59u9OFsma6iF+un6Dcwa625WboG3NB0A+IhR62OuMoNfKcGcXqkuRzpIeBj3RXiAcAmgMXgE921jOZTAKP5jDk+wOfMYdBkDoMt5jDYZs4awA5zGOwyh8Eecxh8wZx1gC+ZwyBkDoOIOQyeMCcAeMocBl8xh8HXzGHwDXPuA3zLHAYxcxgkzGGwr+nWMMwtXtBdoLZBVaADU09Y3MPiUFNlyP6OF4b9vUHM/sEgpv6o6faQ+hMvDPVng5j6i0FM/VXTnSH1N14Y6u8GMfUPg5j6TL8Yy2UGv4x8lwoHlF1sPufvifcP28VAuQABAAH//wAPeJyFkc9r1EAUx9+bTGYmk21i7CSLWHfZZDdBV9aS7A+wuHb9wbawINiCLaW1hS0eSj1IvXjw7sX9M7zoob0IIngp4tE/Q/TQiydhUyf1UC/iY/jw/b73hTfwgAGcHhoXDRtcqMINWIC78ATGizuP7hMmrtYueRYyQDI0DaIFQ9inhABnwPfAAUs41rY7Q0RJEoaCbQG3bb4KnNtrYHN7tDve2dpYX3n4YLQ8HNxWdRUXFV0wrzTRU6yJYdzx2t0FTIPyf/ysV/NUBbNa2kfMkjiJGDf9IqODUS2MEy8K41tYpHt97GVpUEUNrEhRF/IMk3P5WvI/ksulvCQEwa9EiPzVr8vUPGQUf0jRbTfy+UYbO0XubWJdD47K16zknZD4Pv9UNHFQ8B86HxNvelJSUiqyOzARzRW9cXrSunenRWbPPrHpz2FFbUogp1N9h8f6DhHMw2CxP4OAVaQGGRKtDARj30SD6rcHHBA4bgNljK4CpWwNGGUj34/qjaiuhDnXxE475pFGEoWM+xplXwW9TKOcpd1ep4ByMGyRPqYVJG8CZxI4Q1fhxAlQuefm6Nnnb1+eshcff354iTeX9HSiBzqu3L9N9vz44OD4e4HfFf9hawAAeJxjYGRgYADiN4uE5eP5bb4ycDO/AIowXE1YfgpG///7fyPzC2ZuIJeDgQkkCgB97A5TAHicY2BkYGAO+p8FJF/8//v/F/MLBqAICmAGALYGB48AA+gAAAMRAAADWf/9AAAAAADEASsAAQAAAAMAaAAGAAAAAAACACAAMABzAAAAdQtwAAAAAHicdZDdasIwGIbfzJ9tCtvYYKfL0VDG6g8MQRAEh55sJzI8HbXWtlIbSaPgbewedjG7iV3LXts4hrKWNM/35MuXrwFwjW8I5M8TR84CZ4xyPsEpepYL9M+Wi+QXyyVU8Wa5TP9uuYIHBJaruMEHK4jiOaMFPi0LXIlLyye4EHeWC/SPlovknuUSbsWr5TK9Z7mCiUgtV3EvvgZqtdVREBpZG9Rlu9nqyOlWKqoocWPprk2odCr7cq4S48excjy13PPYD9axq/fhfp74Oo1UIltOc69GfuJr1/izXfV0E7SNmcu5Vks5tBlypdXC94wTGrPqNhp/z8MACitsoRHxqkIYSNRo65zbaKKFDmnKDMnMPCtCAhcxjYs1d4TZSsq4zzFnlND6zIjJDjx+l0d+TAq4P2YVfbR6GE9IuzOizEv25bC7w6wRKcky3czOfntPseFpbVrDXbsuddaVxPCghuR97NYWNB69k92Koe2iwfef//sB5m6EUQB4nGNgYoAALgbsgJmRiZGZkYWBu6QosThDNzW3oKSSpyCntFg3ObMoOSc1hYEBAI3CCXgAeJxj8N7BcCIoYiMjY1/kBsadHAwcDMkFGxlYnTYxMDJogRibuZgYOSAsPgYwi81pF9MBoDQnkM3utIvBAcJmZnDZqMLYERixwaEjYiNzistGNRBvF0cDAyOLQ0dySARISSQQbOZhYuTR2sH4v3UDS+9GJgYXAAx2I/QAAA==) format('woff'),url(data:application/octet-stream;base64,AAEAAAAPAIAAAwBwR1NVQiCLJXoAAAD8AAAAVE9TLzI+IEkBAAABUAAAAFZjbWFwiEPsqQAAAagAAAF+Y3Z0IAbV/wQAAAksAAAAIGZwZ22KkZBZAAAJTAAAC3BnYXNwAAAAEAAACSQAAAAIZ2x5Zpc/OaQAAAMoAAACVmhlYWQNxZM1AAAFgAAAADZoaGVhBzoDUAAABbgAAAAkaG10eApS//0AAAXcAAAADGxvY2EAxAErAAAF6AAAAAhtYXhwARIMCgAABfAAAAAgbmFtZcydHR8AAAYQAAACzXBvc3SFVFBUAAAI4AAAAERwcmVw5UErvAAAFLwAAACGAAEAAAAKADAAPgACREZMVAAObGF0bgAaAAQAAAAAAAAAAQAAAAQAAAAAAAAAAQAAAAFsaWdhAAgAAAABAAAAAQAEAAQAAAABAAgAAQAGAAAAAQAAAAEDcQGQAAUAAAJ6ArwAAACMAnoCvAAAAeAAMQECAAACAAUDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFBmRWQAQOgA6AEDUv9qAFoDUgCWAAAAAQAAAAAAAAAAAAUAAAADAAAALAAAAAQAAAFWAAEAAAAAAFAAAwABAAAALAADAAoAAAFWAAQAJAAAAAQABAABAADoAf//AADoAP//AAAAAQAEAAAAAQACAAABBgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAoAAAAAAAAAAIAAOgAAADoAAAAAAEAAOgBAADoAQAAAAIAAAAGAAD/sQMSAwsADwAfAC8AOwBDAGcAZEBhV0UCBggpIRkRCQEGAAECRwUDAgEGAAYBAG0EAgIABwYAB2sADgAJCA4JYA8NAggMCgIGAQgGXgAHCwsHVAAHBwtYAAsHC0xlZGFeW1lTUk9MSUdBPxQkFCYmJiYmIxAFHSsBERQGKwEiJjURNDY7ATIWFxEUBisBIiY1ETQ2OwEyFhcRFAYrASImNRE0NjsBMhYTESERFB4BMyEyPgEBMycmJyMGBwUVFAYrAREUBiMhIiYnESMiJj0BNDY7ATc+ATczMhYfATMyFgEeCggkCAoKCCQICo8KCCQICgoIJAgKjgoHJAgKCggkBwpI/gwICAIB0AIICP6J+hsEBbEGBAHrCgg2NCX+MCU0ATUICgoIrCcJLBayFyoJJ60ICgG3/r8ICgoIAUEICgoI/r8ICgoIAUEICgoI/r8ICgoIAUEICgr+ZAIR/e8MFAoKFAJlQQUBAQVTJAgK/e8uREIuAhMKCCQICl0VHAEeFF0KAAL//f+xA18DCwAjADAAQUA+DQEAAR8BBAMCRwIBAAEDAQADbQUBAwQBAwRrAAcAAQAHAWAABAYGBFQABAQGWAAGBAZMFRUjJCUjJBQIBRwrATU0JgcjNTQmJyMiBgcVIyIGFxUUFjczFRQWFzMyNjc1MzI2NxQOASIuAj4BMh4BAqcWDo8WDkcPFAGPDhYBFA+PFg5HDxQBjw4WsnLG6MhuBnq89Lp+ATpIDhYBjw8UARYOjxQPSA4WAY8PFAEWDo8UM3XEdHTE6sR0dMQAAAABAAAAAQAA7KITH18PPPUACwPoAAAAANVgp8oAAAAA1WCnyv/9/7ED6AMLAAAACAACAAAAAAAAAAEAAANS/2oAAAPo//3/+gPoAAEAAAAAAAAAAAAAAAAAAAADA+gAAAMRAAADWf/9AAAAAADEASsAAQAAAAMAaAAGAAAAAAACACAAMABzAAAAdQtwAAAAAAAAABIA3gABAAAAAAAAADUAAAABAAAAAAABAAgANQABAAAAAAACAAcAPQABAAAAAAADAAgARAABAAAAAAAEAAgATAABAAAAAAAFAAsAVAABAAAAAAAGAAgAXwABAAAAAAAKACsAZwABAAAAAAALABMAkgADAAEECQAAAGoApQADAAEECQABABABDwADAAEECQACAA4BHwADAAEECQADABABLQADAAEECQAEABABPQADAAEECQAFABYBTQADAAEECQAGABABYwADAAEECQAKAFYBcwADAAEECQALACYByUNvcHlyaWdodCAoQykgMjAxNyBieSBvcmlnaW5hbCBhdXRob3JzIEAgZm9udGVsbG8uY29tZm9udGVsbG9SZWd1bGFyZm9udGVsbG9mb250ZWxsb1ZlcnNpb24gMS4wZm9udGVsbG9HZW5lcmF0ZWQgYnkgc3ZnMnR0ZiBmcm9tIEZvbnRlbGxvIHByb2plY3QuaHR0cDovL2ZvbnRlbGxvLmNvbQBDAG8AcAB5AHIAaQBnAGgAdAAgACgAQwApACAAMgAwADEANwAgAGIAeQAgAG8AcgBpAGcAaQBuAGEAbAAgAGEAdQB0AGgAbwByAHMAIABAACAAZgBvAG4AdABlAGwAbABvAC4AYwBvAG0AZgBvAG4AdABlAGwAbABvAFIAZQBnAHUAbABhAHIAZgBvAG4AdABlAGwAbABvAGYAbwBuAHQAZQBsAGwAbwBWAGUAcgBzAGkAbwBuACAAMQAuADAAZgBvAG4AdABlAGwAbABvAEcAZQBuAGUAcgBhAHQAZQBkACAAYgB5ACAAcwB2AGcAMgB0AHQAZgAgAGYAcgBvAG0AIABGAG8AbgB0AGUAbABsAG8AIABwAHIAbwBqAGUAYwB0AC4AaAB0AHQAcAA6AC8ALwBmAG8AbgB0AGUAbABsAG8ALgBjAG8AbQAAAAACAAAAAAAAAAoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMBAgEDAQQAC3RyYXNoLWVtcHR5DHBsdXMtY2lyY2xlZAAAAAEAAf//AA8AAAAAAAAAAAAAAAAAAAAAABgAGAAYABgDUv9qA1L/arAALCCwAFVYRVkgIEu4AA5RS7AGU1pYsDQbsChZYGYgilVYsAIlYbkIAAgAY2MjYhshIbAAWbAAQyNEsgABAENgQi2wASywIGBmLbACLCBkILDAULAEJlqyKAEKQ0VjRVJbWCEjIRuKWCCwUFBYIbBAWRsgsDhQWCGwOFlZILEBCkNFY0VhZLAoUFghsQEKQ0VjRSCwMFBYIbAwWRsgsMBQWCBmIIqKYSCwClBYYBsgsCBQWCGwCmAbILA2UFghsDZgG2BZWVkbsAErWVkjsABQWGVZWS2wAywgRSCwBCVhZCCwBUNQWLAFI0KwBiNCGyEhWbABYC2wBCwjISMhIGSxBWJCILAGI0KxAQpDRWOxAQpDsAFgRWOwAyohILAGQyCKIIqwASuxMAUlsAQmUVhgUBthUllYI1khILBAU1iwASsbIbBAWSOwAFBYZVktsAUssAdDK7IAAgBDYEItsAYssAcjQiMgsAAjQmGwAmJmsAFjsAFgsAUqLbAHLCAgRSCwC0NjuAQAYiCwAFBYsEBgWWawAWNgRLABYC2wCCyyBwsAQ0VCKiGyAAEAQ2BCLbAJLLAAQyNEsgABAENgQi2wCiwgIEUgsAErI7AAQ7AEJWAgRYojYSBkILAgUFghsAAbsDBQWLAgG7BAWVkjsABQWGVZsAMlI2FERLABYC2wCywgIEUgsAErI7AAQ7AEJWAgRYojYSBksCRQWLAAG7BAWSOwAFBYZVmwAyUjYUREsAFgLbAMLCCwACNCsgsKA0VYIRsjIVkqIS2wDSyxAgJFsGRhRC2wDiywAWAgILAMQ0qwAFBYILAMI0JZsA1DSrAAUlggsA0jQlktsA8sILAQYmawAWMguAQAY4ojYbAOQ2AgimAgsA4jQiMtsBAsS1RYsQRkRFkksA1lI3gtsBEsS1FYS1NYsQRkRFkbIVkksBNlI3gtsBIssQAPQ1VYsQ8PQ7ABYUKwDytZsABDsAIlQrEMAiVCsQ0CJUKwARYjILADJVBYsQEAQ2CwBCVCioogiiNhsA4qISOwAWEgiiNhsA4qIRuxAQBDYLACJUKwAiVhsA4qIVmwDENHsA1DR2CwAmIgsABQWLBAYFlmsAFjILALQ2O4BABiILAAUFiwQGBZZrABY2CxAAATI0SwAUOwAD6yAQEBQ2BCLbATLACxAAJFVFiwDyNCIEWwCyNCsAojsAFgQiBgsAFhtRAQAQAOAEJCimCxEgYrsHIrGyJZLbAULLEAEystsBUssQETKy2wFiyxAhMrLbAXLLEDEystsBgssQQTKy2wGSyxBRMrLbAaLLEGEystsBsssQcTKy2wHCyxCBMrLbAdLLEJEystsB4sALANK7EAAkVUWLAPI0IgRbALI0KwCiOwAWBCIGCwAWG1EBABAA4AQkKKYLESBiuwcisbIlktsB8ssQAeKy2wICyxAR4rLbAhLLECHistsCIssQMeKy2wIyyxBB4rLbAkLLEFHistsCUssQYeKy2wJiyxBx4rLbAnLLEIHistsCgssQkeKy2wKSwgPLABYC2wKiwgYLAQYCBDI7ABYEOwAiVhsAFgsCkqIS2wKyywKiuwKiotsCwsICBHICCwC0NjuAQAYiCwAFBYsEBgWWawAWNgI2E4IyCKVVggRyAgsAtDY7gEAGIgsABQWLBAYFlmsAFjYCNhOBshWS2wLSwAsQACRVRYsAEWsCwqsAEVMBsiWS2wLiwAsA0rsQACRVRYsAEWsCwqsAEVMBsiWS2wLywgNbABYC2wMCwAsAFFY7gEAGIgsABQWLBAYFlmsAFjsAErsAtDY7gEAGIgsABQWLBAYFlmsAFjsAErsAAWtAAAAAAARD4jOLEvARUqLbAxLCA8IEcgsAtDY7gEAGIgsABQWLBAYFlmsAFjYLAAQ2E4LbAyLC4XPC2wMywgPCBHILALQ2O4BABiILAAUFiwQGBZZrABY2CwAENhsAFDYzgtsDQssQIAFiUgLiBHsAAjQrACJUmKikcjRyNhIFhiGyFZsAEjQrIzAQEVFCotsDUssAAWsAQlsAQlRyNHI2GwCUMrZYouIyAgPIo4LbA2LLAAFrAEJbAEJSAuRyNHI2EgsAQjQrAJQysgsGBQWCCwQFFYswIgAyAbswImAxpZQkIjILAIQyCKI0cjRyNhI0ZgsARDsAJiILAAUFiwQGBZZrABY2AgsAErIIqKYSCwAkNgZCOwA0NhZFBYsAJDYRuwA0NgWbADJbACYiCwAFBYsEBgWWawAWNhIyAgsAQmI0ZhOBsjsAhDRrACJbAIQ0cjRyNhYCCwBEOwAmIgsABQWLBAYFlmsAFjYCMgsAErI7AEQ2CwASuwBSVhsAUlsAJiILAAUFiwQGBZZrABY7AEJmEgsAQlYGQjsAMlYGRQWCEbIyFZIyAgsAQmI0ZhOFktsDcssAAWICAgsAUmIC5HI0cjYSM8OC2wOCywABYgsAgjQiAgIEYjR7ABKyNhOC2wOSywABawAyWwAiVHI0cjYbAAVFguIDwjIRuwAiWwAiVHI0cjYSCwBSWwBCVHI0cjYbAGJbAFJUmwAiVhuQgACABjYyMgWGIbIVljuAQAYiCwAFBYsEBgWWawAWNgIy4jICA8ijgjIVktsDossAAWILAIQyAuRyNHI2EgYLAgYGawAmIgsABQWLBAYFlmsAFjIyAgPIo4LbA7LCMgLkawAiVGUlggPFkusSsBFCstsDwsIyAuRrACJUZQWCA8WS6xKwEUKy2wPSwjIC5GsAIlRlJYIDxZIyAuRrACJUZQWCA8WS6xKwEUKy2wPiywNSsjIC5GsAIlRlJYIDxZLrErARQrLbA/LLA2K4ogIDywBCNCijgjIC5GsAIlRlJYIDxZLrErARQrsARDLrArKy2wQCywABawBCWwBCYgLkcjRyNhsAlDKyMgPCAuIzixKwEUKy2wQSyxCAQlQrAAFrAEJbAEJSAuRyNHI2EgsAQjQrAJQysgsGBQWCCwQFFYswIgAyAbswImAxpZQkIjIEewBEOwAmIgsABQWLBAYFlmsAFjYCCwASsgiophILACQ2BkI7ADQ2FkUFiwAkNhG7ADQ2BZsAMlsAJiILAAUFiwQGBZZrABY2GwAiVGYTgjIDwjOBshICBGI0ewASsjYTghWbErARQrLbBCLLA1Ky6xKwEUKy2wQyywNishIyAgPLAEI0IjOLErARQrsARDLrArKy2wRCywABUgR7AAI0KyAAEBFRQTLrAxKi2wRSywABUgR7AAI0KyAAEBFRQTLrAxKi2wRiyxAAEUE7AyKi2wRyywNCotsEgssAAWRSMgLiBGiiNhOLErARQrLbBJLLAII0KwSCstsEossgAAQSstsEsssgABQSstsEwssgEAQSstsE0ssgEBQSstsE4ssgAAQistsE8ssgABQistsFAssgEAQistsFEssgEBQistsFIssgAAPistsFMssgABPistsFQssgEAPistsFUssgEBPistsFYssgAAQCstsFcssgABQCstsFgssgEAQCstsFkssgEBQCstsFossgAAQystsFsssgABQystsFwssgEAQystsF0ssgEBQystsF4ssgAAPystsF8ssgABPystsGAssgEAPystsGEssgEBPystsGIssDcrLrErARQrLbBjLLA3K7A7Ky2wZCywNyuwPCstsGUssAAWsDcrsD0rLbBmLLA4Ky6xKwEUKy2wZyywOCuwOystsGgssDgrsDwrLbBpLLA4K7A9Ky2waiywOSsusSsBFCstsGsssDkrsDsrLbBsLLA5K7A8Ky2wbSywOSuwPSstsG4ssDorLrErARQrLbBvLLA6K7A7Ky2wcCywOiuwPCstsHEssDorsD0rLbByLLMJBAIDRVghGyMhWUIrsAhlsAMkUHiwARUwLQBLuADIUlixAQGOWbABuQgACABjcLEABUKyAAEAKrEABUKzCgIBCCqxAAVCsw4AAQgqsQAGQroCwAABAAkqsQAHQroAQAABAAkqsQMARLEkAYhRWLBAiFixA2REsSYBiFFYugiAAAEEQIhjVFixAwBEWVlZWbMMAgEMKrgB/4WwBI2xAgBEAAA=) format('truetype')}#quads-add-new-ad:before{content:'\e801';text-decoration:none;color:#383838}#quads-add-new-ad{margin-left:3px;margin-top:5px;margin-bottom:20px}#quads-submit-button{z-index:999999}p.submit{float:left;padding-top:0;padding-bottom:0}.quads-delete-ad{clear:both;//background:url(../images/remove-icon.png);//background-size:20px 20px;//background-repeat:no-repeat;//height:20px;//padding-left:30px;margin-right:5px}.quads-delete-ad:before{content:'\e800';color:#383838}#backup-settings-textarea{width:580px;height:400px;font-family:Menlo,Monaco,monospace;background:0 0;white-space:normal;overflow:auto;display:block}@media (max-width:506px){.quads-banner-columns{display:block!important}.quads-banner-sidebar-second{width:100%!important}}@media (max-width:780px){.quads-banner-wrapper{margin-right:12px!important}}.quads-banner-wrapper{display:flex;flex-direction:column;clear:both;background:#fff;-webkit-box-shadow:0 1px 1px 0 rgba(0,0,0,.1);box-shadow:0 1px 1px 0 rgba(0,0,0,.1);margin:5px 20px 2px 5px;padding:1px 12px}.quads-banner-content{display:flex;flex:1;color:#000}.quads-banner-columns{display:flex;flex:1;-ms-flex-align:center;-webkit-align-items:center;-webkit-box-align:center;align-items:center}.quads-banner-main{flex:1;order:2}.quads-banner-sidebar-first{min-width:160px;width:13%;order:1}.quads-banner-sidebar-second{width:19%;order:3}.quads-button-primary{display:inline-block;font-size:16px;line-height:32px;height:36px;margin:0;padding:0 13px 1px;cursor:pointer;border-width:1px;border-style:solid;-webkit-appearance:none;-webkit-border-radius:3px;border-radius:3px;white-space:nowrap;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;font-weight:700;background:#0085ba;border-color:#0073aa #006799 #006799;-webkit-box-shadow:0 1px 0 #006799;box-shadow:0 1px 0 #006799;color:#fff;text-decoration:none;text-shadow:0 -1px 1px #006799,1px 0 1px #006799,0 1px 1px #006799,-1px 0 1px #006799}.quads-notice-dismiss{display:inline-block;position:relative;top:0;right:1px;border:none;margin:0;padding:0;background:0 0;color:#72777c;cursor:pointer}.quads-notice-dismiss:before{display:inline-block;background:0 0;color:#72777c;content:"\f153";font:400 16px/20px dashicons;speak:none;height:20px;text-align:center;width:20px;-webkit-font-smoothing:antialiased}
|
1 |
+
.quads-share-button-container{margin:5px 0}.quads-share-button-container p{margin:0 0 10px}.quads-share-button{display:inline-block}.quads-share-button a{text-decoration:none}.quads-share-button .quads-share{font-family:sans-serif;font-weight:700;text-decoration:none;text-align:center;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;color:#FFF;display:inline;font-size:16px;width:40px;padding:4px 8px}.quads-share-button-twitter .quads-share{background-color:#00ABF0}.quads-share-button-facebook .quads-share{background-color:#3b5998}.quads-share-button-googleplus .quads-share{background-color:#F53424}.quads-share-button-facebook .share:active,.quads-share-button-googleplus .share:active,.quads-share-button-twitter .share:active{background-color:#353535}@media (max-width:925px){.quads-share-button .quads-share{font-size:15px;padding:8px 16px}}.quads-richeditor{font-size:11px}#quads-add-ons h2{margin:0 0 15px}#quads-add-ons .quadsshare-addons{float:left;margin:0 15px 15px 0;background:#f0f0f0;border:1px solid #ccc;width:320px;padding:8px;height:315px;position:relative}#quads-add-ons .quadsshare-addons h3{margin:0 0 8px;font-size:13px}#quads-add-ons .quadsshare-addons .button-secondary{position:absolute;bottom:8px;left:8px}#quads-add-ons .quadsshare-addons .third-party{display:none}#system-info-textarea{width:580px;height:400px;font-family:Menlo,Monaco,monospace;background:0 0;white-space:pre;overflow:auto;display:block}.quads-select-chosen{width:300px}input.large-text,textarea.large-text{max-width:600px}input.medium-text,textarea.medium-text{min-width:190px}#quads_tab_container ul{list-style:none;margin:0;padding:0;background:#fff;float:left}#quads_tab_container ul li:first-child.selected-tab{border-top:none}#quads_tab_container ul li a.selected-tab{font-weight:700;text-decoration:none}#quads_tab_container .quads-row{padding-top:12px;padding-bottom:12px}#quads_tab_container .quads-row label strong,#tab_container .quads-row strong{font-weight:700}.quads-tabs a{padding:5px;color:#a1a1a1;text-transform:uppercase}.quads-tabs a strong{font-weight:700}li.quads-tabs{float:left;margin-left:0;background-color:#e5e5e5}#quads_tab_container>ul>li.quads-tabs.active{background-color:#fff}#quads_tab_container>ul>li.quads-tabs.active a{color:#83c11f}#quads_tab_container .quads-panel-container{background:#FFF;padding:20px;overflow:auto;text-align:left;margin-bottom:10px;max-width:640px;float:left;clear:both}.form-table{margin-top:-20px}#quads_tab_container .form-table th{vertical-align:top;text-align:left;padding:20px 10px 20px 0;line-height:1.3;font-weight:700;font-size:14px;color:#484848;width:30%}#quads_tab_container .form-table tr{border-bottom:1px solid #E7E7E7}#quads_tab_container span.description{display:block;font-weight:400;font-style:normal;font-size:13px;margin-top:7px;color:#484848}#quads_tab_container .col-title{font-size:18px;color:#484848}@media only screen and (max-width:680px){#quads_tab_container ul{float:none;background:#fff}#quads_tab_container .form-table tr>th{width:100%}#quads_tab_container span.description{font-size:14px}#quads_tab_container .form-table tr>th,#tab_container .form-table tr>td{padding:10px}#quads_tab_container .quads-tabs a{text-align:left}#quads_tab_container li.quads-tabs{float:none;margin-left:0}}#quads_tab_container ul li.quads-tabs{margin-bottom:0}#quads_tab_container ul li.quads-tabs a{display:block;padding:10px;text-decoration:none;font-weight:700}#quads_tab_container ul li.quads-tabs a:hover{color:#383838}#quads_tab_container ul li.quads-tabs a.active{text-decoration:underline}#quads_tab_container table tbody tr:nth-child(1)>th>div{font-size:20px}#quadstabcontainer>.quadstabs{background-color:#fff}#quadstabcontainer ul .active{background-color:#00adef;color:#fff;border-bottom-color:#0098D2}#quadstabcontainer ul .active:hover{background-color:#00A4E2;color:#fff;border-bottom-color:#0098D2}#quadstabcontainer ul li a{padding:10px 14px;background-color:#f3f3f3}#quadstabcontainer .quadstab-container{border:0 solid #ececec}.quads-quote-docs{font-family:Courier New,Courier,Fixed;color:#050}.quads-desc{display:block;font-style:italic;padding-top:10px}.quads-postbox{padding:10px;position:relative;min-width:255px;border:1px solid #e5e5e5;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.04);box-shadow:0 1px 1px rgba(0,0,0,.04);background:#fff;margin-bottom:20px}.nav-tab-active{background-color:#fff;border-bottom:0}#quads-add-ons{padding:20px}.quads-toggle{position:absolute;right:0;top:0}.quads-box-close .quads-close-open-icon{background-position:0 -38px}.quads-close-open-icon{width:38px;height:38px;background:url(../images/arrow-close.png) repeat-y #f4f4f4}.quads-ad-toggle-header{position:relative;background-color:#f4f4f4;margin-bottom:2px;padding:10px 10px 10px 15px;-moz-user-select:-moz-none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none;user-select:none;cursor:pointer!important;min-height:20px}.quads-ad-toggle-container{padding:20px;background-color:#f4f4f4}.quads-toogle-title{font-size:16px;font-weight:700}.adsense-size-title,.quads-advanced-description label{font-weight:600;font-size:12px;text-transform:uppercase;float:left}.quads-advanced-description label{width:215px}.quads-advanced-ad-box{clear:both;margin-top:20px;margin-bottom:20px}.adsense-size-title{margin-right:0;line-height:32px;margin-left:14px;min-width:100px}.quads-select-style-overwrite{border:1px solid #e6e6e6;width:150px;overflow:hidden;background:url(../images/box_arrow.png) 120px 0 repeat-y #fff;margin:0 0 5px}.quads-select-style-overwrite select{width:150px}.quads-size-input{position:relative;top:-1px;width:110%;border:none;box-shadow:none;background:0 0;-webkit-appearance:none;font-family:'Open Sans',arial,sans-serif;color:#555;font-size:12px}.quads-pro-overlay{height:200px}.quads-license-error-notice,.quads-license-expires-soon-notice{background-color:#fff;padding:10px;overflow:auto;-webkit-box-shadow:0 1px 1px 0 rgba(0,0,0,.1);box-shadow:0 1px 1px 0 rgba(0,0,0,.1);border:1px solid #ECECEC;border-radius:3px}.quads-license-error-notice a{color:#0097df;text-decoration:underline}.quads-license-error-notice{border-left:4px solid #dd3d36}.quads-license-expiration-date-notice,.quads-license-lifetime-notice,.quads-license-null{padding:0}.quads-license-expiration-date-notice .quads-license-data p,.quads-license-lifetime-notice .quads-license-data p{color:#666;font-size:14px;font-style:italic;margin:4px 0 0}#quads_settingslicenses_header-nav{display:none}#quads_settingslicenses_header{max-width:640px}#quads_settingslicenses_header .quads-row.th{min-width:250px}.quads-notice{background:#fff;border-left:4px solid #46b450;-webkit-box-shadow:0 1px 1px 0 rgba(0,0,0,.1);box-shadow:0 1px 1px 0 rgba(0,0,0,.1);margin:5px 15px 2px;padding:1px 12px}.quads_admin h2.nav-tab-wrapper{border:0}.quads_admin .nav-tab{border:0;text-transform:uppercase;color:#a1a1a1;font-weight:700}.quads-h1{margin-bottom:1.35rem;font-size:2.5em;line-height:3.68rem;letter-spacing:normal}.quads-h2{margin-top:0;margin-bottom:1.2rem;font-size:30px;line-height:2.5rem}.quads-heading-pro{color:#83c11f;font-weight:700}.quads-button.green{display:inline-block;background-color:#83c11f;padding:10px;min-width:170px;color:#fff;font-size:16px;text-decoration:none;text-align:center;margin-top:20px}#quads-add-ons .quads-footer{clear:both;margin-top:20px;font-style:italic}#quads-add-ons li{font-size:18px;line-height:29px;position:relative;padding-left:23px;list-style:none!important}#quads-add-ons li:before{width:1em;height:100%;background:url(data:image/svg+xml;charset=utf8,%3Csvg%20width%3D%221792%22%20height%3D%221792%22%20viewBox%3D%220%200%201792%201792%22%20xmlns%3D%22http%3A%2F%2Fwww%2Ew3%2Eorg%2F2000%2Fsvg%22%3E%3Cpath%20fill%3D%22%2377B227%22%20d%3D%22M1671%20566q0%2040%2D28%2068l%2D724%20724%2D136%20136q%2D28%2028%2D68%2028t%2D68%2D28l%2D136%2D136%2D362%2D362q%2D28%2D28%2D28%2D68t28%2D68l136%2D136q28%2D28%2068%2D28t68%2028l294%20295%20656%2D657q28%2D28%2068%2D28t68%2028l136%20136q28%2028%2028%2068z%22%2F%3E%3C%2Fsvg%3E) left .4em no-repeat;background-size:contain;content:"";position:absolute;top:0;left:0;color:#77b227}.adsense_admin_header{font-size:14px;font-weight:500}#quads-adsense-bg-div{position:fixed;top:0;left:0;width:100%;height:100%;background-color:rgba(0,0,0,.65);z-index:250000}#quads-adsense-container{text-align:center;width:480px;margin:85px auto 0;background-color:#fff;padding:2%;border-radius:2px}#quads-adsense-container h3{margin-top:0}#quads-adsense-container textarea,.quads-ad-toggle-container textarea{width:100%}.quads-ad-toggle-container input{margin-top:7px;margin-bottom:10px}.quads-adsense-code label,input{margin-right:2px}#quads_settings\5b ad2\5d \5b g_data_ad_client\5d{width:200px}.quads-ad-toggle-container label{display:inline-block;margin-right:2px;margin-top:-3px}.quads_adsense_code .quads-add-adsense{margin:20px 5px 20px 0}.quads-label-left{min-width:71px}#quads-label-Type{min-width:67px}.quads-medium-size{width:110px}#quads-msg{display:none;margin:5px;background-color:#c55c5c;color:#fff}.quads-loader,.quads-success-modal{display:block;position:fixed;top:45%;left:25%;width:200px;height:auto;padding:5px 20px;z-index:1002;overflow:auto}.quads-general-helper,.quads-helper{background-color:#83c11f;display:inline-block}.quads-form-table{width:100%}.quads-left-box{width:45%;min-height:100px;float:left;line-height:35px;min-width:300px}@media screen and (max-width:700px){.adsense-size-title{margin-left:0}.quads-left-box{width:45%;min-height:100px;float:none;line-height:35px;min-width:300px}.quads-style img{max-width:50px}}.adsense_admin_header ul li{margin-top:2px;margin-left:20px;list-style-type:square}.quads-helper{border-radius:50%;border:2px solid #fff;width:15px;height:15px;position:relative;top:4px;margin-top:-4px;cursor:pointer;margin-left:2px}.quads-general-helper:after,.quads-helper:after{height:20px;font-family:sans-serif;content:"?";font-size:11px;font-weight:700;left:4px;position:absolute;color:#fff}.quads-helper:after{margin-top:-10px}.quads-general-helper:after{margin-top:-2px}#quads-add-new-ad:before,.quads-delete-ad:before{font-family:quads;margin-right:5px}.quads-general-helper{border-radius:50%;border:2px solid #fff;width:15px;height:15px;position:relative;top:4px;margin-top:-4px;cursor:pointer;margin-left:2px}.quads-message{padding:10px;border:1px solid #FBFBFB;border-radius:2px;background-color:#F8F8F8;position:absolute;max-width:500px;z-index:9999;display:none;box-shadow:0 0 5px rgba(0,0,0,.2);font-weight:400;line-height:20px;text-transform:none;font-size:14px}#quads-pro-hover{background-color:#83c11f;padding:20px;min-width:150px;color:#fff;display:block;position:relative;margin-top:-100px;margin-left:50%}#quads-pro-hover-background{width:100%;height:100%;background:rgba(0,0,0,.6)}#quads-open-toggle{clear:both;float:left;margin-top:10px}#quads_settingsadsense_header input[type=number].small-text{width:55px}.quads_adsense_code input.quads-bggrey{background-color:#f5f5f5;color:#939393}.quads-amp-code{color:#939393;height:130px}.quads-chosen-select .chosen-choices li.search-field input{min-height:25px}#quads-validate{display:block;margin-left:2px;margin-bottom:20px;font-weight:700;clear:both}#quads-add-new-ad,.quads-delete-ad{font-size:14px;font-weight:600;color:#383838;display:block;text-decoration:none}@font-face{font-family:quads;src:url(data:application/octet-stream;base64,d09GRgABAAAAAAxYAA8AAAAAFUQAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABWAAAADsAAABUIIslek9TLzIAAAGUAAAAQwAAAFY+IEkBY21hcAAAAdgAAABQAAABfohD7KljdnQgAAACKAAAABMAAAAgBtX/BGZwZ20AAAI8AAAFkAAAC3CKkZBZZ2FzcAAAB8wAAAAIAAAACAAAABBnbHlmAAAH1AAAAdIAAAJWlz85pGhlYWQAAAmoAAAAMwAAADYNxZM1aGhlYQAACdwAAAAfAAAAJAc6A1BobXR4AAAJ/AAAAAwAAAAMClL//WxvY2EAAAoIAAAACAAAAAgAxAErbWF4cAAAChAAAAAgAAAAIAESDApuYW1lAAAKMAAAAXcAAALNzJ0dH3Bvc3QAAAuoAAAAMwAAAESFVFBUcHJlcAAAC9wAAAB6AAAAhuVBK7x4nGNgZGBg4GIwYLBjYHJx8wlh4MtJLMljkGJgYYAAkDwymzEnMz2RgQPGA8qxgGkOIGaDiAIAJjsFSAB4nGNgZC5knMDAysDAVMW0h4GBoQdCMz5gMGRkAooysDIzYAUBaa4pDA4vGF4wMgf9z2KIYg5imAYUZgTJAQDj3AufAHic7ZCxDYAwDATPiaFAjEFBwTBU7F+yRfK2GYOX7qR/uTKwAF1cwsEejMit1XLvbLk7R9547K+NIRNW93STVv7s6fNrLf5U1OcK2gTMuAtdeJxjYEADEhDIHPQ/C4QBEmwD3QB4nK1WaXfTRhQdeUmchCwlCy1qYcTEabBGJmzBgAlBsmMgXZytlaCLFDvpvvGJ3+Bf82Tac+g3flrvGy8kkLTncJqTo3fnzdXM22USWpLYC+uRlJsvxdTWJo3sPAnphk3LUXwoO3shZYrJ3wVREK2W2rcdh0REIlC1rrBEEPseWZpkfOhRRsu2pFdNyi096S5b40G9Vd9+GjrKsTuhpGYzdGg9siVVGFWiSKY9UtKmZaj6K0krvL/CzFfNUMKITiJpvBnG0EjeG2e0ymg1tuMoimyy3ChSJJrhQRR5lNUS5+SKCQzKB82Q8sqnEeXD/Iis2KOcVrBLttP8vi95p3c5P7Ffb1G25EAfyI7s4Ox0JV+EW1th3LST7ShUEXbXd0Js2exU/2aP8ppGA7crMr3QjGCpfIUQKz+hzP4hWS2cT/mSR6NaspETQetlTuxLPoHW44gpcc0YWdDd0QkR1P2SMwz2mD4e/PHeKZYLEwJ4HMt6RyWcCBMpYXM0SdowcmAlZYsqqfWumDjldVrEW8J+7drRl85o41B3YjxbDx1bOVHJ8WhSp5lMndpJzaMpDaKUdCZ4zK8DKD+iSV5tYzWJlUfTOGbGhEQiAi3cS1NBLDuxpCkEzaMZvbkbprl2LVqkyQP13KP39OZWuLnTU9oO9LNGf1anYjrYC9PpaeQv8Wna5SJF6frpGX5M4kHWAjKRLTbDlIMHb/0O0svXlhyF1wbY7u3zK6h91kTwpAH7G9AeT9UpCUyFmFWIVkBirWtZlsnVrBapyNR3Q5pWvqzTBIpyHBfHvoxx/V8zM5aYEr7fidOzIy49c+1LCNMcfJt1PZrXqcVyAXFmeU6nWZbv6zTH8gOd5lme1+kIS1unoyw/1GmB5Uc6HWN5QQuadN/BkIsw5AIOkDCEpQNDWF6CISwVDGG5CENYFmEIyyUYwvJjGMJyGYawvKxl1dRTSePamVgGbEJgYo4eucxF5WoquVRCu2hUakOeEm6VVBTPqn9loF488oY5sBZIl8iaXzHOlY9G5fjWFS1vGjtXwLHqbx+O9jnxUtaLhT8F/9XWVCW9Ys3Dk6vwG4aebCeqNql4dE2Xz1U9uv5fVFRYC/QbSIVYKMqybHBnIoSPOp2GaqCVQ8xszDy063XLmp/D/TcxQhZQ/fg3FBoL3INOWUlZ7eCs1dfbstw7g3I4EyxJMTfz+lb4IiOz0n6RWcqej3wecAWMSmXYagOtFbzZJzEPmd4kzwRxW1E2SNrYzgSJDRzzgHnznQQmYeqqDeRO4YYN+AVhbsF5J1yieqMsh+5F7PMopPxbp+JE9qhojMCz2Rthr+9Cym9xDCQ0+aV+DFQVoakYNRXQNFJuqAZfxtm6bULGDvQjKnbDsqziw8cW95WSbRmEfKSI1aOjn9Zeok6q3H5mFJfvnb4FwSA1MX9733RxkMq7WskyR20DU7calVPXmkPjVYfq5lH1vePsEzlrmm66Jx56X9Oq28HFXCyw9m0O0lImF9T1YYUNosvFpVDqZTRJ77gHGBYY0O9Qio3/q/rYfJ4rVYXRcSTfTtS30edgDPwP2H9H9QPQ92Pocg0uz/eaE59u9OFsma6iF+un6Dcwa625WboG3NB0A+IhR62OuMoNfKcGcXqkuRzpIeBj3RXiAcAmgMXgE921jOZTAKP5jDk+wOfMYdBkDoMt5jDYZs4awA5zGOwyh8Eecxh8wZx1gC+ZwyBkDoOIOQyeMCcAeMocBl8xh8HXzGHwDXPuA3zLHAYxcxgkzGGwr+nWMMwtXtBdoLZBVaADU09Y3MPiUFNlyP6OF4b9vUHM/sEgpv6o6faQ+hMvDPVng5j6i0FM/VXTnSH1N14Y6u8GMfUPg5j6TL8Yy2UGv4x8lwoHlF1sPufvifcP28VAuQABAAH//wAPeJyFkc9r1EAUx9+bTGYmk21i7CSLWHfZZDdBV9aS7A+wuHb9wbawINiCLaW1hS0eSj1IvXjw7sX9M7zoob0IIngp4tE/Q/TQiydhUyf1UC/iY/jw/b73hTfwgAGcHhoXDRtcqMINWIC78ATGizuP7hMmrtYueRYyQDI0DaIFQ9inhABnwPfAAUs41rY7Q0RJEoaCbQG3bb4KnNtrYHN7tDve2dpYX3n4YLQ8HNxWdRUXFV0wrzTRU6yJYdzx2t0FTIPyf/ysV/NUBbNa2kfMkjiJGDf9IqODUS2MEy8K41tYpHt97GVpUEUNrEhRF/IMk3P5WvI/ksulvCQEwa9EiPzVr8vUPGQUf0jRbTfy+UYbO0XubWJdD47K16zknZD4Pv9UNHFQ8B86HxNvelJSUiqyOzARzRW9cXrSunenRWbPPrHpz2FFbUogp1N9h8f6DhHMw2CxP4OAVaQGGRKtDARj30SD6rcHHBA4bgNljK4CpWwNGGUj34/qjaiuhDnXxE475pFGEoWM+xplXwW9TKOcpd1ep4ByMGyRPqYVJG8CZxI4Q1fhxAlQuefm6Nnnb1+eshcff354iTeX9HSiBzqu3L9N9vz44OD4e4HfFf9hawAAeJxjYGRgYADiN4uE5eP5bb4ycDO/AIowXE1YfgpG///7fyPzC2ZuIJeDgQkkCgB97A5TAHicY2BkYGAO+p8FJF/8//v/F/MLBqAICmAGALYGB48AA+gAAAMRAAADWf/9AAAAAADEASsAAQAAAAMAaAAGAAAAAAACACAAMABzAAAAdQtwAAAAAHicdZDdasIwGIbfzJ9tCtvYYKfL0VDG6g8MQRAEh55sJzI8HbXWtlIbSaPgbewedjG7iV3LXts4hrKWNM/35MuXrwFwjW8I5M8TR84CZ4xyPsEpepYL9M+Wi+QXyyVU8Wa5TP9uuYIHBJaruMEHK4jiOaMFPi0LXIlLyye4EHeWC/SPlovknuUSbsWr5TK9Z7mCiUgtV3EvvgZqtdVREBpZG9Rlu9nqyOlWKqoocWPprk2odCr7cq4S48excjy13PPYD9axq/fhfp74Oo1UIltOc69GfuJr1/izXfV0E7SNmcu5Vks5tBlypdXC94wTGrPqNhp/z8MACitsoRHxqkIYSNRo65zbaKKFDmnKDMnMPCtCAhcxjYs1d4TZSsq4zzFnlND6zIjJDjx+l0d+TAq4P2YVfbR6GE9IuzOizEv25bC7w6wRKcky3czOfntPseFpbVrDXbsuddaVxPCghuR97NYWNB69k92Koe2iwfef//sB5m6EUQB4nGNgYoAALgbsgJmRiZGZkYWBu6QosThDNzW3oKSSpyCntFg3ObMoOSc1hYEBAI3CCXgAeJxj8N7BcCIoYiMjY1/kBsadHAwcDMkFGxlYnTYxMDJogRibuZgYOSAsPgYwi81pF9MBoDQnkM3utIvBAcJmZnDZqMLYERixwaEjYiNzistGNRBvF0cDAyOLQ0dySARISSQQbOZhYuTR2sH4v3UDS+9GJgYXAAx2I/QAAA==) format('woff'),url(data:application/octet-stream;base64,AAEAAAAPAIAAAwBwR1NVQiCLJXoAAAD8AAAAVE9TLzI+IEkBAAABUAAAAFZjbWFwiEPsqQAAAagAAAF+Y3Z0IAbV/wQAAAksAAAAIGZwZ22KkZBZAAAJTAAAC3BnYXNwAAAAEAAACSQAAAAIZ2x5Zpc/OaQAAAMoAAACVmhlYWQNxZM1AAAFgAAAADZoaGVhBzoDUAAABbgAAAAkaG10eApS//0AAAXcAAAADGxvY2EAxAErAAAF6AAAAAhtYXhwARIMCgAABfAAAAAgbmFtZcydHR8AAAYQAAACzXBvc3SFVFBUAAAI4AAAAERwcmVw5UErvAAAFLwAAACGAAEAAAAKADAAPgACREZMVAAObGF0bgAaAAQAAAAAAAAAAQAAAAQAAAAAAAAAAQAAAAFsaWdhAAgAAAABAAAAAQAEAAQAAAABAAgAAQAGAAAAAQAAAAEDcQGQAAUAAAJ6ArwAAACMAnoCvAAAAeAAMQECAAACAAUDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFBmRWQAQOgA6AEDUv9qAFoDUgCWAAAAAQAAAAAAAAAAAAUAAAADAAAALAAAAAQAAAFWAAEAAAAAAFAAAwABAAAALAADAAoAAAFWAAQAJAAAAAQABAABAADoAf//AADoAP//AAAAAQAEAAAAAQACAAABBgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAoAAAAAAAAAAIAAOgAAADoAAAAAAEAAOgBAADoAQAAAAIAAAAGAAD/sQMSAwsADwAfAC8AOwBDAGcAZEBhV0UCBggpIRkRCQEGAAECRwUDAgEGAAYBAG0EAgIABwYAB2sADgAJCA4JYA8NAggMCgIGAQgGXgAHCwsHVAAHBwtYAAsHC0xlZGFeW1lTUk9MSUdBPxQkFCYmJiYmIxAFHSsBERQGKwEiJjURNDY7ATIWFxEUBisBIiY1ETQ2OwEyFhcRFAYrASImNRE0NjsBMhYTESERFB4BMyEyPgEBMycmJyMGBwUVFAYrAREUBiMhIiYnESMiJj0BNDY7ATc+ATczMhYfATMyFgEeCggkCAoKCCQICo8KCCQICgoIJAgKjgoHJAgKCggkBwpI/gwICAIB0AIICP6J+hsEBbEGBAHrCgg2NCX+MCU0ATUICgoIrCcJLBayFyoJJ60ICgG3/r8ICgoIAUEICgoI/r8ICgoIAUEICgoI/r8ICgoIAUEICgr+ZAIR/e8MFAoKFAJlQQUBAQVTJAgK/e8uREIuAhMKCCQICl0VHAEeFF0KAAL//f+xA18DCwAjADAAQUA+DQEAAR8BBAMCRwIBAAEDAQADbQUBAwQBAwRrAAcAAQAHAWAABAYGBFQABAQGWAAGBAZMFRUjJCUjJBQIBRwrATU0JgcjNTQmJyMiBgcVIyIGFxUUFjczFRQWFzMyNjc1MzI2NxQOASIuAj4BMh4BAqcWDo8WDkcPFAGPDhYBFA+PFg5HDxQBjw4WsnLG6MhuBnq89Lp+ATpIDhYBjw8UARYOjxQPSA4WAY8PFAEWDo8UM3XEdHTE6sR0dMQAAAABAAAAAQAA7KITH18PPPUACwPoAAAAANVgp8oAAAAA1WCnyv/9/7ED6AMLAAAACAACAAAAAAAAAAEAAANS/2oAAAPo//3/+gPoAAEAAAAAAAAAAAAAAAAAAAADA+gAAAMRAAADWf/9AAAAAADEASsAAQAAAAMAaAAGAAAAAAACACAAMABzAAAAdQtwAAAAAAAAABIA3gABAAAAAAAAADUAAAABAAAAAAABAAgANQABAAAAAAACAAcAPQABAAAAAAADAAgARAABAAAAAAAEAAgATAABAAAAAAAFAAsAVAABAAAAAAAGAAgAXwABAAAAAAAKACsAZwABAAAAAAALABMAkgADAAEECQAAAGoApQADAAEECQABABABDwADAAEECQACAA4BHwADAAEECQADABABLQADAAEECQAEABABPQADAAEECQAFABYBTQADAAEECQAGABABYwADAAEECQAKAFYBcwADAAEECQALACYByUNvcHlyaWdodCAoQykgMjAxNyBieSBvcmlnaW5hbCBhdXRob3JzIEAgZm9udGVsbG8uY29tZm9udGVsbG9SZWd1bGFyZm9udGVsbG9mb250ZWxsb1ZlcnNpb24gMS4wZm9udGVsbG9HZW5lcmF0ZWQgYnkgc3ZnMnR0ZiBmcm9tIEZvbnRlbGxvIHByb2plY3QuaHR0cDovL2ZvbnRlbGxvLmNvbQBDAG8AcAB5AHIAaQBnAGgAdAAgACgAQwApACAAMgAwADEANwAgAGIAeQAgAG8AcgBpAGcAaQBuAGEAbAAgAGEAdQB0AGgAbwByAHMAIABAACAAZgBvAG4AdABlAGwAbABvAC4AYwBvAG0AZgBvAG4AdABlAGwAbABvAFIAZQBnAHUAbABhAHIAZgBvAG4AdABlAGwAbABvAGYAbwBuAHQAZQBsAGwAbwBWAGUAcgBzAGkAbwBuACAAMQAuADAAZgBvAG4AdABlAGwAbABvAEcAZQBuAGUAcgBhAHQAZQBkACAAYgB5ACAAcwB2AGcAMgB0AHQAZgAgAGYAcgBvAG0AIABGAG8AbgB0AGUAbABsAG8AIABwAHIAbwBqAGUAYwB0AC4AaAB0AHQAcAA6AC8ALwBmAG8AbgB0AGUAbABsAG8ALgBjAG8AbQAAAAACAAAAAAAAAAoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMBAgEDAQQAC3RyYXNoLWVtcHR5DHBsdXMtY2lyY2xlZAAAAAEAAf//AA8AAAAAAAAAAAAAAAAAAAAAABgAGAAYABgDUv9qA1L/arAALCCwAFVYRVkgIEu4AA5RS7AGU1pYsDQbsChZYGYgilVYsAIlYbkIAAgAY2MjYhshIbAAWbAAQyNEsgABAENgQi2wASywIGBmLbACLCBkILDAULAEJlqyKAEKQ0VjRVJbWCEjIRuKWCCwUFBYIbBAWRsgsDhQWCGwOFlZILEBCkNFY0VhZLAoUFghsQEKQ0VjRSCwMFBYIbAwWRsgsMBQWCBmIIqKYSCwClBYYBsgsCBQWCGwCmAbILA2UFghsDZgG2BZWVkbsAErWVkjsABQWGVZWS2wAywgRSCwBCVhZCCwBUNQWLAFI0KwBiNCGyEhWbABYC2wBCwjISMhIGSxBWJCILAGI0KxAQpDRWOxAQpDsAFgRWOwAyohILAGQyCKIIqwASuxMAUlsAQmUVhgUBthUllYI1khILBAU1iwASsbIbBAWSOwAFBYZVktsAUssAdDK7IAAgBDYEItsAYssAcjQiMgsAAjQmGwAmJmsAFjsAFgsAUqLbAHLCAgRSCwC0NjuAQAYiCwAFBYsEBgWWawAWNgRLABYC2wCCyyBwsAQ0VCKiGyAAEAQ2BCLbAJLLAAQyNEsgABAENgQi2wCiwgIEUgsAErI7AAQ7AEJWAgRYojYSBkILAgUFghsAAbsDBQWLAgG7BAWVkjsABQWGVZsAMlI2FERLABYC2wCywgIEUgsAErI7AAQ7AEJWAgRYojYSBksCRQWLAAG7BAWSOwAFBYZVmwAyUjYUREsAFgLbAMLCCwACNCsgsKA0VYIRsjIVkqIS2wDSyxAgJFsGRhRC2wDiywAWAgILAMQ0qwAFBYILAMI0JZsA1DSrAAUlggsA0jQlktsA8sILAQYmawAWMguAQAY4ojYbAOQ2AgimAgsA4jQiMtsBAsS1RYsQRkRFkksA1lI3gtsBEsS1FYS1NYsQRkRFkbIVkksBNlI3gtsBIssQAPQ1VYsQ8PQ7ABYUKwDytZsABDsAIlQrEMAiVCsQ0CJUKwARYjILADJVBYsQEAQ2CwBCVCioogiiNhsA4qISOwAWEgiiNhsA4qIRuxAQBDYLACJUKwAiVhsA4qIVmwDENHsA1DR2CwAmIgsABQWLBAYFlmsAFjILALQ2O4BABiILAAUFiwQGBZZrABY2CxAAATI0SwAUOwAD6yAQEBQ2BCLbATLACxAAJFVFiwDyNCIEWwCyNCsAojsAFgQiBgsAFhtRAQAQAOAEJCimCxEgYrsHIrGyJZLbAULLEAEystsBUssQETKy2wFiyxAhMrLbAXLLEDEystsBgssQQTKy2wGSyxBRMrLbAaLLEGEystsBsssQcTKy2wHCyxCBMrLbAdLLEJEystsB4sALANK7EAAkVUWLAPI0IgRbALI0KwCiOwAWBCIGCwAWG1EBABAA4AQkKKYLESBiuwcisbIlktsB8ssQAeKy2wICyxAR4rLbAhLLECHistsCIssQMeKy2wIyyxBB4rLbAkLLEFHistsCUssQYeKy2wJiyxBx4rLbAnLLEIHistsCgssQkeKy2wKSwgPLABYC2wKiwgYLAQYCBDI7ABYEOwAiVhsAFgsCkqIS2wKyywKiuwKiotsCwsICBHICCwC0NjuAQAYiCwAFBYsEBgWWawAWNgI2E4IyCKVVggRyAgsAtDY7gEAGIgsABQWLBAYFlmsAFjYCNhOBshWS2wLSwAsQACRVRYsAEWsCwqsAEVMBsiWS2wLiwAsA0rsQACRVRYsAEWsCwqsAEVMBsiWS2wLywgNbABYC2wMCwAsAFFY7gEAGIgsABQWLBAYFlmsAFjsAErsAtDY7gEAGIgsABQWLBAYFlmsAFjsAErsAAWtAAAAAAARD4jOLEvARUqLbAxLCA8IEcgsAtDY7gEAGIgsABQWLBAYFlmsAFjYLAAQ2E4LbAyLC4XPC2wMywgPCBHILALQ2O4BABiILAAUFiwQGBZZrABY2CwAENhsAFDYzgtsDQssQIAFiUgLiBHsAAjQrACJUmKikcjRyNhIFhiGyFZsAEjQrIzAQEVFCotsDUssAAWsAQlsAQlRyNHI2GwCUMrZYouIyAgPIo4LbA2LLAAFrAEJbAEJSAuRyNHI2EgsAQjQrAJQysgsGBQWCCwQFFYswIgAyAbswImAxpZQkIjILAIQyCKI0cjRyNhI0ZgsARDsAJiILAAUFiwQGBZZrABY2AgsAErIIqKYSCwAkNgZCOwA0NhZFBYsAJDYRuwA0NgWbADJbACYiCwAFBYsEBgWWawAWNhIyAgsAQmI0ZhOBsjsAhDRrACJbAIQ0cjRyNhYCCwBEOwAmIgsABQWLBAYFlmsAFjYCMgsAErI7AEQ2CwASuwBSVhsAUlsAJiILAAUFiwQGBZZrABY7AEJmEgsAQlYGQjsAMlYGRQWCEbIyFZIyAgsAQmI0ZhOFktsDcssAAWICAgsAUmIC5HI0cjYSM8OC2wOCywABYgsAgjQiAgIEYjR7ABKyNhOC2wOSywABawAyWwAiVHI0cjYbAAVFguIDwjIRuwAiWwAiVHI0cjYSCwBSWwBCVHI0cjYbAGJbAFJUmwAiVhuQgACABjYyMgWGIbIVljuAQAYiCwAFBYsEBgWWawAWNgIy4jICA8ijgjIVktsDossAAWILAIQyAuRyNHI2EgYLAgYGawAmIgsABQWLBAYFlmsAFjIyAgPIo4LbA7LCMgLkawAiVGUlggPFkusSsBFCstsDwsIyAuRrACJUZQWCA8WS6xKwEUKy2wPSwjIC5GsAIlRlJYIDxZIyAuRrACJUZQWCA8WS6xKwEUKy2wPiywNSsjIC5GsAIlRlJYIDxZLrErARQrLbA/LLA2K4ogIDywBCNCijgjIC5GsAIlRlJYIDxZLrErARQrsARDLrArKy2wQCywABawBCWwBCYgLkcjRyNhsAlDKyMgPCAuIzixKwEUKy2wQSyxCAQlQrAAFrAEJbAEJSAuRyNHI2EgsAQjQrAJQysgsGBQWCCwQFFYswIgAyAbswImAxpZQkIjIEewBEOwAmIgsABQWLBAYFlmsAFjYCCwASsgiophILACQ2BkI7ADQ2FkUFiwAkNhG7ADQ2BZsAMlsAJiILAAUFiwQGBZZrABY2GwAiVGYTgjIDwjOBshICBGI0ewASsjYTghWbErARQrLbBCLLA1Ky6xKwEUKy2wQyywNishIyAgPLAEI0IjOLErARQrsARDLrArKy2wRCywABUgR7AAI0KyAAEBFRQTLrAxKi2wRSywABUgR7AAI0KyAAEBFRQTLrAxKi2wRiyxAAEUE7AyKi2wRyywNCotsEgssAAWRSMgLiBGiiNhOLErARQrLbBJLLAII0KwSCstsEossgAAQSstsEsssgABQSstsEwssgEAQSstsE0ssgEBQSstsE4ssgAAQistsE8ssgABQistsFAssgEAQistsFEssgEBQistsFIssgAAPistsFMssgABPistsFQssgEAPistsFUssgEBPistsFYssgAAQCstsFcssgABQCstsFgssgEAQCstsFkssgEBQCstsFossgAAQystsFsssgABQystsFwssgEAQystsF0ssgEBQystsF4ssgAAPystsF8ssgABPystsGAssgEAPystsGEssgEBPystsGIssDcrLrErARQrLbBjLLA3K7A7Ky2wZCywNyuwPCstsGUssAAWsDcrsD0rLbBmLLA4Ky6xKwEUKy2wZyywOCuwOystsGgssDgrsDwrLbBpLLA4K7A9Ky2waiywOSsusSsBFCstsGsssDkrsDsrLbBsLLA5K7A8Ky2wbSywOSuwPSstsG4ssDorLrErARQrLbBvLLA6K7A7Ky2wcCywOiuwPCstsHEssDorsD0rLbByLLMJBAIDRVghGyMhWUIrsAhlsAMkUHiwARUwLQBLuADIUlixAQGOWbABuQgACABjcLEABUKyAAEAKrEABUKzCgIBCCqxAAVCsw4AAQgqsQAGQroCwAABAAkqsQAHQroAQAABAAkqsQMARLEkAYhRWLBAiFixA2REsSYBiFFYugiAAAEEQIhjVFixAwBEWVlZWbMMAgEMKrgB/4WwBI2xAgBEAAA=) format('truetype')}#quads-add-new-ad:before{content:'\e801';text-decoration:none;color:#383838}#quads-add-new-ad{margin-left:3px;margin-top:5px;margin-bottom:20px}#quads-submit-button{z-index:999999}p.submit{float:left;padding-top:0;padding-bottom:0}.quads-delete-ad{clear:both;//background:url(../images/remove-icon.png);//background-size:20px 20px;//background-repeat:no-repeat;//height:20px;//padding-left:30px;margin-right:5px}.quads-delete-ad:before{content:'\e800';color:#383838}#backup-settings-textarea{width:580px;height:400px;font-family:Menlo,Monaco,monospace;background:0 0;white-space:normal;overflow:auto;display:block}@media (max-width:506px){.quads-banner-columns{display:block!important}.quads-banner-sidebar-second{width:100%!important}}@media (max-width:780px){.quads-banner-wrapper{margin-right:12px!important}}.quads-banner-wrapper{display:flex;flex-direction:column;clear:both;background:#fff;-webkit-box-shadow:0 1px 1px 0 rgba(0,0,0,.1);box-shadow:0 1px 1px 0 rgba(0,0,0,.1);margin:5px 20px 2px 5px;padding:1px 12px}.quads-banner-content{display:flex;flex:1;color:#000}.quads-banner-columns{display:flex;flex:1;-ms-flex-align:center;-webkit-align-items:center;-webkit-box-align:center;align-items:center}.quads-banner-main{flex:1;order:2}.quads-banner-sidebar-first{min-width:160px;width:13%;order:1}.quads-banner-sidebar-second{width:19%;order:3}.quads-button-primary{display:inline-block;font-size:16px;line-height:32px;height:36px;margin:0;padding:0 13px 1px;cursor:pointer;border-width:1px;border-style:solid;-webkit-appearance:none;-webkit-border-radius:3px;border-radius:3px;white-space:nowrap;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;font-weight:700;background:#0085ba;border-color:#0073aa #006799 #006799;-webkit-box-shadow:0 1px 0 #006799;box-shadow:0 1px 0 #006799;color:#fff;text-decoration:none;text-shadow:0 -1px 1px #006799,1px 0 1px #006799,0 1px 1px #006799,-1px 0 1px #006799}.quads-notice-dismiss{display:inline-block;position:relative;top:0;right:1px;border:none;margin:0;padding:0;background:0 0;color:#72777c;cursor:pointer}.quads-notice-dismiss:before{display:inline-block;background:0 0;color:#72777c;content:"\f153";font:400 16px/20px dashicons;speak:none;height:20px;text-align:center;width:20px;-webkit-font-smoothing:antialiased}.quads-widget-buttons{float:right}.quads-widget-buttons a{min-width:80px;text-align:center;font-weight:600}#quads-vi-widget ul{margin:0 0 0 25px;padding:0;background:#fff;float:none;list-style-type:square}#quads-vi-signup-fullscreen{display:none;z-index:999999;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;height:100%;width:100%;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);background-color:#f0f0f0}#quads-vi-signup-container{width:99%;height:99%;max-width:868px;max-height:552px}#quads-vi-close{cursor:pointer;position:relative;display:inline-block;width:20px;height:20px;overflow:hidden;float:right;margin-right:20px;margin-top:20px}#quads-vi-close::after,#quads-vi-close::before{content:'';position:absolute;height:2px;width:100%;top:50%;left:0;margin-top:-1px;background:#7d7d7d}#quads-vi-close::before{-webkit-transform:rotate(45deg);-moz-transform:rotate(45deg);-ms-transform:rotate(45deg);-o-transform:rotate(45deg);transform:rotate(45deg)}#quads-vi-close::after{-webkit-transform:rotate(-45deg);-moz-transform:rotate(-45deg);-ms-transform:rotate(-45deg);-o-transform:rotate(-45deg);transform:rotate(-45deg)}#quads-vi-signup-fullscreen iframe{width:100%;height:100%;z-index:999999;display:block;background:#FFF;border:none}.quads-spinner{background:url(/wp-admin/images/spinner.gif) no-repeat;background-size:16px 16px;display:none;float:left;opacity:.7;filter:alpha(opacity=70);width:160px;height:16px;margin:5px 5px 0;clear:both}#quads-vi-customize-player label,#quads-vi-shortcodes label{width:170px;display:inline-block}#quads-vi-revenue-wrapper{margin-top:10px;min-width:565px;min-height:350px}#quads-vi-revenue-sum{font-weight:700;font-size:36px}#quads-vi-revenue-sum-wrapper{margin-top:20px;line-height:26px}#quads-vi-customize-player label{color:#000;font-weight:500}#quads-vi-save-settings{margin-top:20px}#quads-vi-welcome ul{float:none;list-style:square;margin-left:25px}.quads-tooltip{border-radius:50%;border:2px solid #fff;background-color:#e7db00;width:15px;height:15px;display:inline-block;position:relative;top:4px;margin-top:-4px;cursor:pointer;margin-left:2px}.quads-tooltip:after{height:20px;font-family:sans-serif;content:"?";color:#fff;font-size:11px;font-weight:700;left:4px;top:-2px;position:absolute}.quads-tooltip-message{padding:10px;border:1px solid #FBFBFB;border-radius:2px;background-color:#F8F8F8;position:absolute;max-width:500px;z-index:9999;display:none;box-shadow:0 0 5px rgba(0,0,0,.2);font-weight:400}#quads-vi-layout label{width:100px}#quads_vi_ads-ads-1-align-left-label{content:url(../images/align_left.png)}#quads_vi_ads-ads-1-align-right-label{content:url(../images/align_right.png)}#quads_vi_ads-ads-1-align-middle-label{content:url(../images/align_middle.png)}
|
assets/images/align_left.png
ADDED
Binary file
|
assets/images/align_middle.png
ADDED
Binary file
|
assets/images/align_right.png
ADDED
Binary file
|
assets/images/vi-logo-black.png
ADDED
Binary file
|
assets/images/vi-logo-white.png
ADDED
Binary file
|
assets/js/jscolor.js
ADDED
@@ -0,0 +1,1844 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* jscolor - JavaScript Color Picker
|
3 |
+
*
|
4 |
+
* @link http://jscolor.com
|
5 |
+
* @license For open source use: GPLv3
|
6 |
+
* For commercial use: JSColor Commercial License
|
7 |
+
* @author Jan Odvarko
|
8 |
+
* @version 2.0.4
|
9 |
+
*
|
10 |
+
* See usage examples at http://jscolor.com/examples/
|
11 |
+
*/
|
12 |
+
|
13 |
+
|
14 |
+
"use strict";
|
15 |
+
|
16 |
+
|
17 |
+
if (!window.jscolor) { window.jscolor = (function () {
|
18 |
+
|
19 |
+
|
20 |
+
var jsc = {
|
21 |
+
|
22 |
+
|
23 |
+
register : function () {
|
24 |
+
jsc.attachDOMReadyEvent(jsc.init);
|
25 |
+
jsc.attachEvent(document, 'mousedown', jsc.onDocumentMouseDown);
|
26 |
+
jsc.attachEvent(document, 'touchstart', jsc.onDocumentTouchStart);
|
27 |
+
jsc.attachEvent(window, 'resize', jsc.onWindowResize);
|
28 |
+
},
|
29 |
+
|
30 |
+
|
31 |
+
init : function () {
|
32 |
+
if (jsc.jscolor.lookupClass) {
|
33 |
+
jsc.jscolor.installByClassName(jsc.jscolor.lookupClass);
|
34 |
+
}
|
35 |
+
},
|
36 |
+
|
37 |
+
|
38 |
+
tryInstallOnElements : function (elms, className) {
|
39 |
+
var matchClass = new RegExp('(^|\\s)(' + className + ')(\\s*(\\{[^}]*\\})|\\s|$)', 'i');
|
40 |
+
|
41 |
+
for (var i = 0; i < elms.length; i += 1) {
|
42 |
+
if (elms[i].type !== undefined && elms[i].type.toLowerCase() == 'color') {
|
43 |
+
if (jsc.isColorAttrSupported) {
|
44 |
+
// skip inputs of type 'color' if supported by the browser
|
45 |
+
continue;
|
46 |
+
}
|
47 |
+
}
|
48 |
+
var m;
|
49 |
+
if (!elms[i].jscolor && elms[i].className && (m = elms[i].className.match(matchClass))) {
|
50 |
+
var targetElm = elms[i];
|
51 |
+
var optsStr = null;
|
52 |
+
|
53 |
+
var dataOptions = jsc.getDataAttr(targetElm, 'jscolor');
|
54 |
+
if (dataOptions !== null) {
|
55 |
+
optsStr = dataOptions;
|
56 |
+
} else if (m[4]) {
|
57 |
+
optsStr = m[4];
|
58 |
+
}
|
59 |
+
|
60 |
+
var opts = {};
|
61 |
+
if (optsStr) {
|
62 |
+
try {
|
63 |
+
opts = (new Function ('return (' + optsStr + ')'))();
|
64 |
+
} catch(eParseError) {
|
65 |
+
jsc.warn('Error parsing jscolor options: ' + eParseError + ':\n' + optsStr);
|
66 |
+
}
|
67 |
+
}
|
68 |
+
targetElm.jscolor = new jsc.jscolor(targetElm, opts);
|
69 |
+
}
|
70 |
+
}
|
71 |
+
},
|
72 |
+
|
73 |
+
|
74 |
+
isColorAttrSupported : (function () {
|
75 |
+
var elm = document.createElement('input');
|
76 |
+
if (elm.setAttribute) {
|
77 |
+
elm.setAttribute('type', 'color');
|
78 |
+
if (elm.type.toLowerCase() == 'color') {
|
79 |
+
return true;
|
80 |
+
}
|
81 |
+
}
|
82 |
+
return false;
|
83 |
+
})(),
|
84 |
+
|
85 |
+
|
86 |
+
isCanvasSupported : (function () {
|
87 |
+
var elm = document.createElement('canvas');
|
88 |
+
return !!(elm.getContext && elm.getContext('2d'));
|
89 |
+
})(),
|
90 |
+
|
91 |
+
|
92 |
+
fetchElement : function (mixed) {
|
93 |
+
return typeof mixed === 'string' ? document.getElementById(mixed) : mixed;
|
94 |
+
},
|
95 |
+
|
96 |
+
|
97 |
+
isElementType : function (elm, type) {
|
98 |
+
return elm.nodeName.toLowerCase() === type.toLowerCase();
|
99 |
+
},
|
100 |
+
|
101 |
+
|
102 |
+
getDataAttr : function (el, name) {
|
103 |
+
var attrName = 'data-' + name;
|
104 |
+
var attrValue = el.getAttribute(attrName);
|
105 |
+
if (attrValue !== null) {
|
106 |
+
return attrValue;
|
107 |
+
}
|
108 |
+
return null;
|
109 |
+
},
|
110 |
+
|
111 |
+
|
112 |
+
attachEvent : function (el, evnt, func) {
|
113 |
+
if (el.addEventListener) {
|
114 |
+
el.addEventListener(evnt, func, false);
|
115 |
+
} else if (el.attachEvent) {
|
116 |
+
el.attachEvent('on' + evnt, func);
|
117 |
+
}
|
118 |
+
},
|
119 |
+
|
120 |
+
|
121 |
+
detachEvent : function (el, evnt, func) {
|
122 |
+
if (el.removeEventListener) {
|
123 |
+
el.removeEventListener(evnt, func, false);
|
124 |
+
} else if (el.detachEvent) {
|
125 |
+
el.detachEvent('on' + evnt, func);
|
126 |
+
}
|
127 |
+
},
|
128 |
+
|
129 |
+
|
130 |
+
_attachedGroupEvents : {},
|
131 |
+
|
132 |
+
|
133 |
+
attachGroupEvent : function (groupName, el, evnt, func) {
|
134 |
+
if (!jsc._attachedGroupEvents.hasOwnProperty(groupName)) {
|
135 |
+
jsc._attachedGroupEvents[groupName] = [];
|
136 |
+
}
|
137 |
+
jsc._attachedGroupEvents[groupName].push([el, evnt, func]);
|
138 |
+
jsc.attachEvent(el, evnt, func);
|
139 |
+
},
|
140 |
+
|
141 |
+
|
142 |
+
detachGroupEvents : function (groupName) {
|
143 |
+
if (jsc._attachedGroupEvents.hasOwnProperty(groupName)) {
|
144 |
+
for (var i = 0; i < jsc._attachedGroupEvents[groupName].length; i += 1) {
|
145 |
+
var evt = jsc._attachedGroupEvents[groupName][i];
|
146 |
+
jsc.detachEvent(evt[0], evt[1], evt[2]);
|
147 |
+
}
|
148 |
+
delete jsc._attachedGroupEvents[groupName];
|
149 |
+
}
|
150 |
+
},
|
151 |
+
|
152 |
+
|
153 |
+
attachDOMReadyEvent : function (func) {
|
154 |
+
var fired = false;
|
155 |
+
var fireOnce = function () {
|
156 |
+
if (!fired) {
|
157 |
+
fired = true;
|
158 |
+
func();
|
159 |
+
}
|
160 |
+
};
|
161 |
+
|
162 |
+
if (document.readyState === 'complete') {
|
163 |
+
setTimeout(fireOnce, 1); // async
|
164 |
+
return;
|
165 |
+
}
|
166 |
+
|
167 |
+
if (document.addEventListener) {
|
168 |
+
document.addEventListener('DOMContentLoaded', fireOnce, false);
|
169 |
+
|
170 |
+
// Fallback
|
171 |
+
window.addEventListener('load', fireOnce, false);
|
172 |
+
|
173 |
+
} else if (document.attachEvent) {
|
174 |
+
// IE
|
175 |
+
document.attachEvent('onreadystatechange', function () {
|
176 |
+
if (document.readyState === 'complete') {
|
177 |
+
document.detachEvent('onreadystatechange', arguments.callee);
|
178 |
+
fireOnce();
|
179 |
+
}
|
180 |
+
})
|
181 |
+
|
182 |
+
// Fallback
|
183 |
+
window.attachEvent('onload', fireOnce);
|
184 |
+
|
185 |
+
// IE7/8
|
186 |
+
if (document.documentElement.doScroll && window == window.top) {
|
187 |
+
var tryScroll = function () {
|
188 |
+
if (!document.body) { return; }
|
189 |
+
try {
|
190 |
+
document.documentElement.doScroll('left');
|
191 |
+
fireOnce();
|
192 |
+
} catch (e) {
|
193 |
+
setTimeout(tryScroll, 1);
|
194 |
+
}
|
195 |
+
};
|
196 |
+
tryScroll();
|
197 |
+
}
|
198 |
+
}
|
199 |
+
},
|
200 |
+
|
201 |
+
|
202 |
+
warn : function (msg) {
|
203 |
+
if (window.console && window.console.warn) {
|
204 |
+
window.console.warn(msg);
|
205 |
+
}
|
206 |
+
},
|
207 |
+
|
208 |
+
|
209 |
+
preventDefault : function (e) {
|
210 |
+
if (e.preventDefault) { e.preventDefault(); }
|
211 |
+
e.returnValue = false;
|
212 |
+
},
|
213 |
+
|
214 |
+
|
215 |
+
captureTarget : function (target) {
|
216 |
+
// IE
|
217 |
+
if (target.setCapture) {
|
218 |
+
jsc._capturedTarget = target;
|
219 |
+
jsc._capturedTarget.setCapture();
|
220 |
+
}
|
221 |
+
},
|
222 |
+
|
223 |
+
|
224 |
+
releaseTarget : function () {
|
225 |
+
// IE
|
226 |
+
if (jsc._capturedTarget) {
|
227 |
+
jsc._capturedTarget.releaseCapture();
|
228 |
+
jsc._capturedTarget = null;
|
229 |
+
}
|
230 |
+
},
|
231 |
+
|
232 |
+
|
233 |
+
fireEvent : function (el, evnt) {
|
234 |
+
if (!el) {
|
235 |
+
return;
|
236 |
+
}
|
237 |
+
if (document.createEvent) {
|
238 |
+
var ev = document.createEvent('HTMLEvents');
|
239 |
+
ev.initEvent(evnt, true, true);
|
240 |
+
el.dispatchEvent(ev);
|
241 |
+
} else if (document.createEventObject) {
|
242 |
+
var ev = document.createEventObject();
|
243 |
+
el.fireEvent('on' + evnt, ev);
|
244 |
+
} else if (el['on' + evnt]) { // alternatively use the traditional event model
|
245 |
+
el['on' + evnt]();
|
246 |
+
}
|
247 |
+
},
|
248 |
+
|
249 |
+
|
250 |
+
classNameToList : function (className) {
|
251 |
+
return className.replace(/^\s+|\s+$/g, '').split(/\s+/);
|
252 |
+
},
|
253 |
+
|
254 |
+
|
255 |
+
// The className parameter (str) can only contain a single class name
|
256 |
+
hasClass : function (elm, className) {
|
257 |
+
if (!className) {
|
258 |
+
return false;
|
259 |
+
}
|
260 |
+
return -1 != (' ' + elm.className.replace(/\s+/g, ' ') + ' ').indexOf(' ' + className + ' ');
|
261 |
+
},
|
262 |
+
|
263 |
+
|
264 |
+
// The className parameter (str) can contain multiple class names separated by whitespace
|
265 |
+
setClass : function (elm, className) {
|
266 |
+
var classList = jsc.classNameToList(className);
|
267 |
+
for (var i = 0; i < classList.length; i += 1) {
|
268 |
+
if (!jsc.hasClass(elm, classList[i])) {
|
269 |
+
elm.className += (elm.className ? ' ' : '') + classList[i];
|
270 |
+
}
|
271 |
+
}
|
272 |
+
},
|
273 |
+
|
274 |
+
|
275 |
+
// The className parameter (str) can contain multiple class names separated by whitespace
|
276 |
+
unsetClass : function (elm, className) {
|
277 |
+
var classList = jsc.classNameToList(className);
|
278 |
+
for (var i = 0; i < classList.length; i += 1) {
|
279 |
+
var repl = new RegExp(
|
280 |
+
'^\\s*' + classList[i] + '\\s*|' +
|
281 |
+
'\\s*' + classList[i] + '\\s*$|' +
|
282 |
+
'\\s+' + classList[i] + '(\\s+)',
|
283 |
+
'g'
|
284 |
+
);
|
285 |
+
elm.className = elm.className.replace(repl, '$1');
|
286 |
+
}
|
287 |
+
},
|
288 |
+
|
289 |
+
|
290 |
+
getStyle : function (elm) {
|
291 |
+
return window.getComputedStyle ? window.getComputedStyle(elm) : elm.currentStyle;
|
292 |
+
},
|
293 |
+
|
294 |
+
|
295 |
+
setStyle : (function () {
|
296 |
+
var helper = document.createElement('div');
|
297 |
+
var getSupportedProp = function (names) {
|
298 |
+
for (var i = 0; i < names.length; i += 1) {
|
299 |
+
if (names[i] in helper.style) {
|
300 |
+
return names[i];
|
301 |
+
}
|
302 |
+
}
|
303 |
+
};
|
304 |
+
var props = {
|
305 |
+
borderRadius: getSupportedProp(['borderRadius', 'MozBorderRadius', 'webkitBorderRadius']),
|
306 |
+
boxShadow: getSupportedProp(['boxShadow', 'MozBoxShadow', 'webkitBoxShadow'])
|
307 |
+
};
|
308 |
+
return function (elm, prop, value) {
|
309 |
+
switch (prop.toLowerCase()) {
|
310 |
+
case 'opacity':
|
311 |
+
var alphaOpacity = Math.round(parseFloat(value) * 100);
|
312 |
+
elm.style.opacity = value;
|
313 |
+
elm.style.filter = 'alpha(opacity=' + alphaOpacity + ')';
|
314 |
+
break;
|
315 |
+
default:
|
316 |
+
elm.style[props[prop]] = value;
|
317 |
+
break;
|
318 |
+
}
|
319 |
+
};
|
320 |
+
})(),
|
321 |
+
|
322 |
+
|
323 |
+
setBorderRadius : function (elm, value) {
|
324 |
+
jsc.setStyle(elm, 'borderRadius', value || '0');
|
325 |
+
},
|
326 |
+
|
327 |
+
|
328 |
+
setBoxShadow : function (elm, value) {
|
329 |
+
jsc.setStyle(elm, 'boxShadow', value || 'none');
|
330 |
+
},
|
331 |
+
|
332 |
+
|
333 |
+
getElementPos : function (e, relativeToViewport) {
|
334 |
+
var x=0, y=0;
|
335 |
+
var rect = e.getBoundingClientRect();
|
336 |
+
x = rect.left;
|
337 |
+
y = rect.top;
|
338 |
+
if (!relativeToViewport) {
|
339 |
+
var viewPos = jsc.getViewPos();
|
340 |
+
x += viewPos[0];
|
341 |
+
y += viewPos[1];
|
342 |
+
}
|
343 |
+
return [x, y];
|
344 |
+
},
|
345 |
+
|
346 |
+
|
347 |
+
getElementSize : function (e) {
|
348 |
+
return [e.offsetWidth, e.offsetHeight];
|
349 |
+
},
|
350 |
+
|
351 |
+
|
352 |
+
// get pointer's X/Y coordinates relative to viewport
|
353 |
+
getAbsPointerPos : function (e) {
|
354 |
+
if (!e) { e = window.event; }
|
355 |
+
var x = 0, y = 0;
|
356 |
+
if (typeof e.changedTouches !== 'undefined' && e.changedTouches.length) {
|
357 |
+
// touch devices
|
358 |
+
x = e.changedTouches[0].clientX;
|
359 |
+
y = e.changedTouches[0].clientY;
|
360 |
+
} else if (typeof e.clientX === 'number') {
|
361 |
+
x = e.clientX;
|
362 |
+
y = e.clientY;
|
363 |
+
}
|
364 |
+
return { x: x, y: y };
|
365 |
+
},
|
366 |
+
|
367 |
+
|
368 |
+
// get pointer's X/Y coordinates relative to target element
|
369 |
+
getRelPointerPos : function (e) {
|
370 |
+
if (!e) { e = window.event; }
|
371 |
+
var target = e.target || e.srcElement;
|
372 |
+
var targetRect = target.getBoundingClientRect();
|
373 |
+
|
374 |
+
var x = 0, y = 0;
|
375 |
+
|
376 |
+
var clientX = 0, clientY = 0;
|
377 |
+
if (typeof e.changedTouches !== 'undefined' && e.changedTouches.length) {
|
378 |
+
// touch devices
|
379 |
+
clientX = e.changedTouches[0].clientX;
|
380 |
+
clientY = e.changedTouches[0].clientY;
|
381 |
+
} else if (typeof e.clientX === 'number') {
|
382 |
+
clientX = e.clientX;
|
383 |
+
clientY = e.clientY;
|
384 |
+
}
|
385 |
+
|
386 |
+
x = clientX - targetRect.left;
|
387 |
+
y = clientY - targetRect.top;
|
388 |
+
return { x: x, y: y };
|
389 |
+
},
|
390 |
+
|
391 |
+
|
392 |
+
getViewPos : function () {
|
393 |
+
var doc = document.documentElement;
|
394 |
+
return [
|
395 |
+
(window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0),
|
396 |
+
(window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0)
|
397 |
+
];
|
398 |
+
},
|
399 |
+
|
400 |
+
|
401 |
+
getViewSize : function () {
|
402 |
+
var doc = document.documentElement;
|
403 |
+
return [
|
404 |
+
(window.innerWidth || doc.clientWidth),
|
405 |
+
(window.innerHeight || doc.clientHeight),
|
406 |
+
];
|
407 |
+
},
|
408 |
+
|
409 |
+
|
410 |
+
redrawPosition : function () {
|
411 |
+
|
412 |
+
if (jsc.picker && jsc.picker.owner) {
|
413 |
+
var thisObj = jsc.picker.owner;
|
414 |
+
|
415 |
+
var tp, vp;
|
416 |
+
|
417 |
+
if (thisObj.fixed) {
|
418 |
+
// Fixed elements are positioned relative to viewport,
|
419 |
+
// therefore we can ignore the scroll offset
|
420 |
+
tp = jsc.getElementPos(thisObj.targetElement, true); // target pos
|
421 |
+
vp = [0, 0]; // view pos
|
422 |
+
} else {
|
423 |
+
tp = jsc.getElementPos(thisObj.targetElement); // target pos
|
424 |
+
vp = jsc.getViewPos(); // view pos
|
425 |
+
}
|
426 |
+
|
427 |
+
var ts = jsc.getElementSize(thisObj.targetElement); // target size
|
428 |
+
var vs = jsc.getViewSize(); // view size
|
429 |
+
var ps = jsc.getPickerOuterDims(thisObj); // picker size
|
430 |
+
var a, b, c;
|
431 |
+
switch (thisObj.position.toLowerCase()) {
|
432 |
+
case 'left': a=1; b=0; c=-1; break;
|
433 |
+
case 'right':a=1; b=0; c=1; break;
|
434 |
+
case 'top': a=0; b=1; c=-1; break;
|
435 |
+
default: a=0; b=1; c=1; break;
|
436 |
+
}
|
437 |
+
var l = (ts[b]+ps[b])/2;
|
438 |
+
|
439 |
+
// compute picker position
|
440 |
+
if (!thisObj.smartPosition) {
|
441 |
+
var pp = [
|
442 |
+
tp[a],
|
443 |
+
tp[b]+ts[b]-l+l*c
|
444 |
+
];
|
445 |
+
} else {
|
446 |
+
var pp = [
|
447 |
+
-vp[a]+tp[a]+ps[a] > vs[a] ?
|
448 |
+
(-vp[a]+tp[a]+ts[a]/2 > vs[a]/2 && tp[a]+ts[a]-ps[a] >= 0 ? tp[a]+ts[a]-ps[a] : tp[a]) :
|
449 |
+
tp[a],
|
450 |
+
-vp[b]+tp[b]+ts[b]+ps[b]-l+l*c > vs[b] ?
|
451 |
+
(-vp[b]+tp[b]+ts[b]/2 > vs[b]/2 && tp[b]+ts[b]-l-l*c >= 0 ? tp[b]+ts[b]-l-l*c : tp[b]+ts[b]-l+l*c) :
|
452 |
+
(tp[b]+ts[b]-l+l*c >= 0 ? tp[b]+ts[b]-l+l*c : tp[b]+ts[b]-l-l*c)
|
453 |
+
];
|
454 |
+
}
|
455 |
+
|
456 |
+
var x = pp[a];
|
457 |
+
var y = pp[b];
|
458 |
+
var positionValue = thisObj.fixed ? 'fixed' : 'absolute';
|
459 |
+
var contractShadow =
|
460 |
+
(pp[0] + ps[0] > tp[0] || pp[0] < tp[0] + ts[0]) &&
|
461 |
+
(pp[1] + ps[1] < tp[1] + ts[1]);
|
462 |
+
|
463 |
+
jsc._drawPosition(thisObj, x, y, positionValue, contractShadow);
|
464 |
+
}
|
465 |
+
},
|
466 |
+
|
467 |
+
|
468 |
+
_drawPosition : function (thisObj, x, y, positionValue, contractShadow) {
|
469 |
+
var vShadow = contractShadow ? 0 : thisObj.shadowBlur; // px
|
470 |
+
|
471 |
+
jsc.picker.wrap.style.position = positionValue;
|
472 |
+
jsc.picker.wrap.style.left = x + 'px';
|
473 |
+
jsc.picker.wrap.style.top = y + 'px';
|
474 |
+
|
475 |
+
jsc.setBoxShadow(
|
476 |
+
jsc.picker.boxS,
|
477 |
+
thisObj.shadow ?
|
478 |
+
new jsc.BoxShadow(0, vShadow, thisObj.shadowBlur, 0, thisObj.shadowColor) :
|
479 |
+
null);
|
480 |
+
},
|
481 |
+
|
482 |
+
|
483 |
+
getPickerDims : function (thisObj) {
|
484 |
+
var displaySlider = !!jsc.getSliderComponent(thisObj);
|
485 |
+
var dims = [
|
486 |
+
2 * thisObj.insetWidth + 2 * thisObj.padding + thisObj.width +
|
487 |
+
(displaySlider ? 2 * thisObj.insetWidth + jsc.getPadToSliderPadding(thisObj) + thisObj.sliderSize : 0),
|
488 |
+
2 * thisObj.insetWidth + 2 * thisObj.padding + thisObj.height +
|
489 |
+
(thisObj.closable ? 2 * thisObj.insetWidth + thisObj.padding + thisObj.buttonHeight : 0)
|
490 |
+
];
|
491 |
+
return dims;
|
492 |
+
},
|
493 |
+
|
494 |
+
|
495 |
+
getPickerOuterDims : function (thisObj) {
|
496 |
+
var dims = jsc.getPickerDims(thisObj);
|
497 |
+
return [
|
498 |
+
dims[0] + 2 * thisObj.borderWidth,
|
499 |
+
dims[1] + 2 * thisObj.borderWidth
|
500 |
+
];
|
501 |
+
},
|
502 |
+
|
503 |
+
|
504 |
+
getPadToSliderPadding : function (thisObj) {
|
505 |
+
return Math.max(thisObj.padding, 1.5 * (2 * thisObj.pointerBorderWidth + thisObj.pointerThickness));
|
506 |
+
},
|
507 |
+
|
508 |
+
|
509 |
+
getPadYComponent : function (thisObj) {
|
510 |
+
switch (thisObj.mode.charAt(1).toLowerCase()) {
|
511 |
+
case 'v': return 'v'; break;
|
512 |
+
}
|
513 |
+
return 's';
|
514 |
+
},
|
515 |
+
|
516 |
+
|
517 |
+
getSliderComponent : function (thisObj) {
|
518 |
+
if (thisObj.mode.length > 2) {
|
519 |
+
switch (thisObj.mode.charAt(2).toLowerCase()) {
|
520 |
+
case 's': return 's'; break;
|
521 |
+
case 'v': return 'v'; break;
|
522 |
+
}
|
523 |
+
}
|
524 |
+
return null;
|
525 |
+
},
|
526 |
+
|
527 |
+
|
528 |
+
onDocumentMouseDown : function (e) {
|
529 |
+
if (!e) { e = window.event; }
|
530 |
+
var target = e.target || e.srcElement;
|
531 |
+
|
532 |
+
if (target._jscLinkedInstance) {
|
533 |
+
if (target._jscLinkedInstance.showOnClick) {
|
534 |
+
target._jscLinkedInstance.show();
|
535 |
+
}
|
536 |
+
} else if (target._jscControlName) {
|
537 |
+
jsc.onControlPointerStart(e, target, target._jscControlName, 'mouse');
|
538 |
+
} else {
|
539 |
+
// Mouse is outside the picker controls -> hide the color picker!
|
540 |
+
if (jsc.picker && jsc.picker.owner) {
|
541 |
+
jsc.picker.owner.hide();
|
542 |
+
}
|
543 |
+
}
|
544 |
+
},
|
545 |
+
|
546 |
+
|
547 |
+
onDocumentTouchStart : function (e) {
|
548 |
+
if (!e) { e = window.event; }
|
549 |
+
var target = e.target || e.srcElement;
|
550 |
+
|
551 |
+
if (target._jscLinkedInstance) {
|
552 |
+
if (target._jscLinkedInstance.showOnClick) {
|
553 |
+
target._jscLinkedInstance.show();
|
554 |
+
}
|
555 |
+
} else if (target._jscControlName) {
|
556 |
+
jsc.onControlPointerStart(e, target, target._jscControlName, 'touch');
|
557 |
+
} else {
|
558 |
+
if (jsc.picker && jsc.picker.owner) {
|
559 |
+
jsc.picker.owner.hide();
|
560 |
+
}
|
561 |
+
}
|
562 |
+
},
|
563 |
+
|
564 |
+
|
565 |
+
onWindowResize : function (e) {
|
566 |
+
jsc.redrawPosition();
|
567 |
+
},
|
568 |
+
|
569 |
+
|
570 |
+
onParentScroll : function (e) {
|
571 |
+
// hide the picker when one of the parent elements is scrolled
|
572 |
+
if (jsc.picker && jsc.picker.owner) {
|
573 |
+
jsc.picker.owner.hide();
|
574 |
+
}
|
575 |
+
},
|
576 |
+
|
577 |
+
|
578 |
+
_pointerMoveEvent : {
|
579 |
+
mouse: 'mousemove',
|
580 |
+
touch: 'touchmove'
|
581 |
+
},
|
582 |
+
_pointerEndEvent : {
|
583 |
+
mouse: 'mouseup',
|
584 |
+
touch: 'touchend'
|
585 |
+
},
|
586 |
+
|
587 |
+
|
588 |
+
_pointerOrigin : null,
|
589 |
+
_capturedTarget : null,
|
590 |
+
|
591 |
+
|
592 |
+
onControlPointerStart : function (e, target, controlName, pointerType) {
|
593 |
+
var thisObj = target._jscInstance;
|
594 |
+
|
595 |
+
jsc.preventDefault(e);
|
596 |
+
jsc.captureTarget(target);
|
597 |
+
|
598 |
+
var registerDragEvents = function (doc, offset) {
|
599 |
+
jsc.attachGroupEvent('drag', doc, jsc._pointerMoveEvent[pointerType],
|
600 |
+
jsc.onDocumentPointerMove(e, target, controlName, pointerType, offset));
|
601 |
+
jsc.attachGroupEvent('drag', doc, jsc._pointerEndEvent[pointerType],
|
602 |
+
jsc.onDocumentPointerEnd(e, target, controlName, pointerType));
|
603 |
+
};
|
604 |
+
|
605 |
+
registerDragEvents(document, [0, 0]);
|
606 |
+
|
607 |
+
if (window.parent && window.frameElement) {
|
608 |
+
var rect = window.frameElement.getBoundingClientRect();
|
609 |
+
var ofs = [-rect.left, -rect.top];
|
610 |
+
registerDragEvents(window.parent.window.document, ofs);
|
611 |
+
}
|
612 |
+
|
613 |
+
var abs = jsc.getAbsPointerPos(e);
|
614 |
+
var rel = jsc.getRelPointerPos(e);
|
615 |
+
jsc._pointerOrigin = {
|
616 |
+
x: abs.x - rel.x,
|
617 |
+
y: abs.y - rel.y
|
618 |
+
};
|
619 |
+
|
620 |
+
switch (controlName) {
|
621 |
+
case 'pad':
|
622 |
+
// if the slider is at the bottom, move it up
|
623 |
+
switch (jsc.getSliderComponent(thisObj)) {
|
624 |
+
case 's': if (thisObj.hsv[1] === 0) { thisObj.fromHSV(null, 100, null); }; break;
|
625 |
+
case 'v': if (thisObj.hsv[2] === 0) { thisObj.fromHSV(null, null, 100); }; break;
|
626 |
+
}
|
627 |
+
jsc.setPad(thisObj, e, 0, 0);
|
628 |
+
break;
|
629 |
+
|
630 |
+
case 'sld':
|
631 |
+
jsc.setSld(thisObj, e, 0);
|
632 |
+
break;
|
633 |
+
}
|
634 |
+
|
635 |
+
jsc.dispatchFineChange(thisObj);
|
636 |
+
},
|
637 |
+
|
638 |
+
|
639 |
+
onDocumentPointerMove : function (e, target, controlName, pointerType, offset) {
|
640 |
+
return function (e) {
|
641 |
+
var thisObj = target._jscInstance;
|
642 |
+
switch (controlName) {
|
643 |
+
case 'pad':
|
644 |
+
if (!e) { e = window.event; }
|
645 |
+
jsc.setPad(thisObj, e, offset[0], offset[1]);
|
646 |
+
jsc.dispatchFineChange(thisObj);
|
647 |
+
break;
|
648 |
+
|
649 |
+
case 'sld':
|
650 |
+
if (!e) { e = window.event; }
|
651 |
+
jsc.setSld(thisObj, e, offset[1]);
|
652 |
+
jsc.dispatchFineChange(thisObj);
|
653 |
+
break;
|
654 |
+
}
|
655 |
+
}
|
656 |
+
},
|
657 |
+
|
658 |
+
|
659 |
+
onDocumentPointerEnd : function (e, target, controlName, pointerType) {
|
660 |
+
return function (e) {
|
661 |
+
var thisObj = target._jscInstance;
|
662 |
+
jsc.detachGroupEvents('drag');
|
663 |
+
jsc.releaseTarget();
|
664 |
+
// Always dispatch changes after detaching outstanding mouse handlers,
|
665 |
+
// in case some user interaction will occur in user's onchange callback
|
666 |
+
// that would intrude with current mouse events
|
667 |
+
jsc.dispatchChange(thisObj);
|
668 |
+
};
|
669 |
+
},
|
670 |
+
|
671 |
+
|
672 |
+
dispatchChange : function (thisObj) {
|
673 |
+
if (thisObj.valueElement) {
|
674 |
+
if (jsc.isElementType(thisObj.valueElement, 'input')) {
|
675 |
+
jsc.fireEvent(thisObj.valueElement, 'change');
|
676 |
+
}
|
677 |
+
}
|
678 |
+
},
|
679 |
+
|
680 |
+
|
681 |
+
dispatchFineChange : function (thisObj) {
|
682 |
+
if (thisObj.onFineChange) {
|
683 |
+
var callback;
|
684 |
+
if (typeof thisObj.onFineChange === 'string') {
|
685 |
+
callback = new Function (thisObj.onFineChange);
|
686 |
+
} else {
|
687 |
+
callback = thisObj.onFineChange;
|
688 |
+
}
|
689 |
+
callback.call(thisObj);
|
690 |
+
}
|
691 |
+
},
|
692 |
+
|
693 |
+
|
694 |
+
setPad : function (thisObj, e, ofsX, ofsY) {
|
695 |
+
var pointerAbs = jsc.getAbsPointerPos(e);
|
696 |
+
var x = ofsX + pointerAbs.x - jsc._pointerOrigin.x - thisObj.padding - thisObj.insetWidth;
|
697 |
+
var y = ofsY + pointerAbs.y - jsc._pointerOrigin.y - thisObj.padding - thisObj.insetWidth;
|
698 |
+
|
699 |
+
var xVal = x * (360 / (thisObj.width - 1));
|
700 |
+
var yVal = 100 - (y * (100 / (thisObj.height - 1)));
|
701 |
+
|
702 |
+
switch (jsc.getPadYComponent(thisObj)) {
|
703 |
+
case 's': thisObj.fromHSV(xVal, yVal, null, jsc.leaveSld); break;
|
704 |
+
case 'v': thisObj.fromHSV(xVal, null, yVal, jsc.leaveSld); break;
|
705 |
+
}
|
706 |
+
},
|
707 |
+
|
708 |
+
|
709 |
+
setSld : function (thisObj, e, ofsY) {
|
710 |
+
var pointerAbs = jsc.getAbsPointerPos(e);
|
711 |
+
var y = ofsY + pointerAbs.y - jsc._pointerOrigin.y - thisObj.padding - thisObj.insetWidth;
|
712 |
+
|
713 |
+
var yVal = 100 - (y * (100 / (thisObj.height - 1)));
|
714 |
+
|
715 |
+
switch (jsc.getSliderComponent(thisObj)) {
|
716 |
+
case 's': thisObj.fromHSV(null, yVal, null, jsc.leavePad); break;
|
717 |
+
case 'v': thisObj.fromHSV(null, null, yVal, jsc.leavePad); break;
|
718 |
+
}
|
719 |
+
},
|
720 |
+
|
721 |
+
|
722 |
+
_vmlNS : 'jsc_vml_',
|
723 |
+
_vmlCSS : 'jsc_vml_css_',
|
724 |
+
_vmlReady : false,
|
725 |
+
|
726 |
+
|
727 |
+
initVML : function () {
|
728 |
+
if (!jsc._vmlReady) {
|
729 |
+
// init VML namespace
|
730 |
+
var doc = document;
|
731 |
+
if (!doc.namespaces[jsc._vmlNS]) {
|
732 |
+
doc.namespaces.add(jsc._vmlNS, 'urn:schemas-microsoft-com:vml');
|
733 |
+
}
|
734 |
+
if (!doc.styleSheets[jsc._vmlCSS]) {
|
735 |
+
var tags = ['shape', 'shapetype', 'group', 'background', 'path', 'formulas', 'handles', 'fill', 'stroke', 'shadow', 'textbox', 'textpath', 'imagedata', 'line', 'polyline', 'curve', 'rect', 'roundrect', 'oval', 'arc', 'image'];
|
736 |
+
var ss = doc.createStyleSheet();
|
737 |
+
ss.owningElement.id = jsc._vmlCSS;
|
738 |
+
for (var i = 0; i < tags.length; i += 1) {
|
739 |
+
ss.addRule(jsc._vmlNS + '\\:' + tags[i], 'behavior:url(#default#VML);');
|
740 |
+
}
|
741 |
+
}
|
742 |
+
jsc._vmlReady = true;
|
743 |
+
}
|
744 |
+
},
|
745 |
+
|
746 |
+
|
747 |
+
createPalette : function () {
|
748 |
+
|
749 |
+
var paletteObj = {
|
750 |
+
elm: null,
|
751 |
+
draw: null
|
752 |
+
};
|
753 |
+
|
754 |
+
if (jsc.isCanvasSupported) {
|
755 |
+
// Canvas implementation for modern browsers
|
756 |
+
|
757 |
+
var canvas = document.createElement('canvas');
|
758 |
+
var ctx = canvas.getContext('2d');
|
759 |
+
|
760 |
+
var drawFunc = function (width, height, type) {
|
761 |
+
canvas.width = width;
|
762 |
+
canvas.height = height;
|
763 |
+
|
764 |
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
765 |
+
|
766 |
+
var hGrad = ctx.createLinearGradient(0, 0, canvas.width, 0);
|
767 |
+
hGrad.addColorStop(0 / 6, '#F00');
|
768 |
+
hGrad.addColorStop(1 / 6, '#FF0');
|
769 |
+
hGrad.addColorStop(2 / 6, '#0F0');
|
770 |
+
hGrad.addColorStop(3 / 6, '#0FF');
|
771 |
+
hGrad.addColorStop(4 / 6, '#00F');
|
772 |
+
hGrad.addColorStop(5 / 6, '#F0F');
|
773 |
+
hGrad.addColorStop(6 / 6, '#F00');
|
774 |
+
|
775 |
+
ctx.fillStyle = hGrad;
|
776 |
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
777 |
+
|
778 |
+
var vGrad = ctx.createLinearGradient(0, 0, 0, canvas.height);
|
779 |
+
switch (type.toLowerCase()) {
|
780 |
+
case 's':
|
781 |
+
vGrad.addColorStop(0, 'rgba(255,255,255,0)');
|
782 |
+
vGrad.addColorStop(1, 'rgba(255,255,255,1)');
|
783 |
+
break;
|
784 |
+
case 'v':
|
785 |
+
vGrad.addColorStop(0, 'rgba(0,0,0,0)');
|
786 |
+
vGrad.addColorStop(1, 'rgba(0,0,0,1)');
|
787 |
+
break;
|
788 |
+
}
|
789 |
+
ctx.fillStyle = vGrad;
|
790 |
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
791 |
+
};
|
792 |
+
|
793 |
+
paletteObj.elm = canvas;
|
794 |
+
paletteObj.draw = drawFunc;
|
795 |
+
|
796 |
+
} else {
|
797 |
+
// VML fallback for IE 7 and 8
|
798 |
+
|
799 |
+
jsc.initVML();
|
800 |
+
|
801 |
+
var vmlContainer = document.createElement('div');
|
802 |
+
vmlContainer.style.position = 'relative';
|
803 |
+
vmlContainer.style.overflow = 'hidden';
|
804 |
+
|
805 |
+
var hGrad = document.createElement(jsc._vmlNS + ':fill');
|
806 |
+
hGrad.type = 'gradient';
|
807 |
+
hGrad.method = 'linear';
|
808 |
+
hGrad.angle = '90';
|
809 |
+
hGrad.colors = '16.67% #F0F, 33.33% #00F, 50% #0FF, 66.67% #0F0, 83.33% #FF0'
|
810 |
+
|
811 |
+
var hRect = document.createElement(jsc._vmlNS + ':rect');
|
812 |
+
hRect.style.position = 'absolute';
|
813 |
+
hRect.style.left = -1 + 'px';
|
814 |
+
hRect.style.top = -1 + 'px';
|
815 |
+
hRect.stroked = false;
|
816 |
+
hRect.appendChild(hGrad);
|
817 |
+
vmlContainer.appendChild(hRect);
|
818 |
+
|
819 |
+
var vGrad = document.createElement(jsc._vmlNS + ':fill');
|
820 |
+
vGrad.type = 'gradient';
|
821 |
+
vGrad.method = 'linear';
|
822 |
+
vGrad.angle = '180';
|
823 |
+
vGrad.opacity = '0';
|
824 |
+
|
825 |
+
var vRect = document.createElement(jsc._vmlNS + ':rect');
|
826 |
+
vRect.style.position = 'absolute';
|
827 |
+
vRect.style.left = -1 + 'px';
|
828 |
+
vRect.style.top = -1 + 'px';
|
829 |
+
vRect.stroked = false;
|
830 |
+
vRect.appendChild(vGrad);
|
831 |
+
vmlContainer.appendChild(vRect);
|
832 |
+
|
833 |
+
var drawFunc = function (width, height, type) {
|
834 |
+
vmlContainer.style.width = width + 'px';
|
835 |
+
vmlContainer.style.height = height + 'px';
|
836 |
+
|
837 |
+
hRect.style.width =
|
838 |
+
vRect.style.width =
|
839 |
+
(width + 1) + 'px';
|
840 |
+
hRect.style.height =
|
841 |
+
vRect.style.height =
|
842 |
+
(height + 1) + 'px';
|
843 |
+
|
844 |
+
// Colors must be specified during every redraw, otherwise IE won't display
|
845 |
+
// a full gradient during a subsequential redraw
|
846 |
+
hGrad.color = '#F00';
|
847 |
+
hGrad.color2 = '#F00';
|
848 |
+
|
849 |
+
switch (type.toLowerCase()) {
|
850 |
+
case 's':
|
851 |
+
vGrad.color = vGrad.color2 = '#FFF';
|
852 |
+
break;
|
853 |
+
case 'v':
|
854 |
+
vGrad.color = vGrad.color2 = '#000';
|
855 |
+
break;
|
856 |
+
}
|
857 |
+
};
|
858 |
+
|
859 |
+
paletteObj.elm = vmlContainer;
|
860 |
+
paletteObj.draw = drawFunc;
|
861 |
+
}
|
862 |
+
|
863 |
+
return paletteObj;
|
864 |
+
},
|
865 |
+
|
866 |
+
|
867 |
+
createSliderGradient : function () {
|
868 |
+
|
869 |
+
var sliderObj = {
|
870 |
+
elm: null,
|
871 |
+
draw: null
|
872 |
+
};
|
873 |
+
|
874 |
+
if (jsc.isCanvasSupported) {
|
875 |
+
// Canvas implementation for modern browsers
|
876 |
+
|
877 |
+
var canvas = document.createElement('canvas');
|
878 |
+
var ctx = canvas.getContext('2d');
|
879 |
+
|
880 |
+
var drawFunc = function (width, height, color1, color2) {
|
881 |
+
canvas.width = width;
|
882 |
+
canvas.height = height;
|
883 |
+
|
884 |
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
885 |
+
|
886 |
+
var grad = ctx.createLinearGradient(0, 0, 0, canvas.height);
|
887 |
+
grad.addColorStop(0, color1);
|
888 |
+
grad.addColorStop(1, color2);
|
889 |
+
|
890 |
+
ctx.fillStyle = grad;
|
891 |
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
892 |
+
};
|
893 |
+
|
894 |
+
sliderObj.elm = canvas;
|
895 |
+
sliderObj.draw = drawFunc;
|
896 |
+
|
897 |
+
} else {
|
898 |
+
// VML fallback for IE 7 and 8
|
899 |
+
|
900 |
+
jsc.initVML();
|
901 |
+
|
902 |
+
var vmlContainer = document.createElement('div');
|
903 |
+
vmlContainer.style.position = 'relative';
|
904 |
+
vmlContainer.style.overflow = 'hidden';
|
905 |
+
|
906 |
+
var grad = document.createElement(jsc._vmlNS + ':fill');
|
907 |
+
grad.type = 'gradient';
|
908 |
+
grad.method = 'linear';
|
909 |
+
grad.angle = '180';
|
910 |
+
|
911 |
+
var rect = document.createElement(jsc._vmlNS + ':rect');
|
912 |
+
rect.style.position = 'absolute';
|
913 |
+
rect.style.left = -1 + 'px';
|
914 |
+
rect.style.top = -1 + 'px';
|
915 |
+
rect.stroked = false;
|
916 |
+
rect.appendChild(grad);
|
917 |
+
vmlContainer.appendChild(rect);
|
918 |
+
|
919 |
+
var drawFunc = function (width, height, color1, color2) {
|
920 |
+
vmlContainer.style.width = width + 'px';
|
921 |
+
vmlContainer.style.height = height + 'px';
|
922 |
+
|
923 |
+
rect.style.width = (width + 1) + 'px';
|
924 |
+
rect.style.height = (height + 1) + 'px';
|
925 |
+
|
926 |
+
grad.color = color1;
|
927 |
+
grad.color2 = color2;
|
928 |
+
};
|
929 |
+
|
930 |
+
sliderObj.elm = vmlContainer;
|
931 |
+
sliderObj.draw = drawFunc;
|
932 |
+
}
|
933 |
+
|
934 |
+
return sliderObj;
|
935 |
+
},
|
936 |
+
|
937 |
+
|
938 |
+
leaveValue : 1<<0,
|
939 |
+
leaveStyle : 1<<1,
|
940 |
+
leavePad : 1<<2,
|
941 |
+
leaveSld : 1<<3,
|
942 |
+
|
943 |
+
|
944 |
+
BoxShadow : (function () {
|
945 |
+
var BoxShadow = function (hShadow, vShadow, blur, spread, color, inset) {
|
946 |
+
this.hShadow = hShadow;
|
947 |
+
this.vShadow = vShadow;
|
948 |
+
this.blur = blur;
|
949 |
+
this.spread = spread;
|
950 |
+
this.color = color;
|
951 |
+
this.inset = !!inset;
|
952 |
+
};
|
953 |
+
|
954 |
+
BoxShadow.prototype.toString = function () {
|
955 |
+
var vals = [
|
956 |
+
Math.round(this.hShadow) + 'px',
|
957 |
+
Math.round(this.vShadow) + 'px',
|
958 |
+
Math.round(this.blur) + 'px',
|
959 |
+
Math.round(this.spread) + 'px',
|
960 |
+
this.color
|
961 |
+
];
|
962 |
+
if (this.inset) {
|
963 |
+
vals.push('inset');
|
964 |
+
}
|
965 |
+
return vals.join(' ');
|
966 |
+
};
|
967 |
+
|
968 |
+
return BoxShadow;
|
969 |
+
})(),
|
970 |
+
|
971 |
+
|
972 |
+
//
|
973 |
+
// Usage:
|
974 |
+
// var myColor = new jscolor(<targetElement> [, <options>])
|
975 |
+
//
|
976 |
+
|
977 |
+
jscolor : function (targetElement, options) {
|
978 |
+
|
979 |
+
// General options
|
980 |
+
//
|
981 |
+
this.value = null; // initial HEX color. To change it later, use methods fromString(), fromHSV() and fromRGB()
|
982 |
+
this.valueElement = targetElement; // element that will be used to display and input the color code
|
983 |
+
this.styleElement = targetElement; // element that will preview the picked color using CSS backgroundColor
|
984 |
+
this.required = true; // whether the associated text <input> can be left empty
|
985 |
+
this.refine = true; // whether to refine the entered color code (e.g. uppercase it and remove whitespace)
|
986 |
+
this.hash = false; // whether to prefix the HEX color code with # symbol
|
987 |
+
this.uppercase = true; // whether to uppercase the color code
|
988 |
+
this.onFineChange = null; // called instantly every time the color changes (value can be either a function or a string with javascript code)
|
989 |
+
this.activeClass = 'jscolor-active'; // class to be set to the target element when a picker window is open on it
|
990 |
+
this.minS = 0; // min allowed saturation (0 - 100)
|
991 |
+
this.maxS = 100; // max allowed saturation (0 - 100)
|
992 |
+
this.minV = 0; // min allowed value (brightness) (0 - 100)
|
993 |
+
this.maxV = 100; // max allowed value (brightness) (0 - 100)
|
994 |
+
|
995 |
+
// Accessing the picked color
|
996 |
+
//
|
997 |
+
this.hsv = [0, 0, 100]; // read-only [0-360, 0-100, 0-100]
|
998 |
+
this.rgb = [255, 255, 255]; // read-only [0-255, 0-255, 0-255]
|
999 |
+
|
1000 |
+
// Color Picker options
|
1001 |
+
//
|
1002 |
+
this.width = 181; // width of color palette (in px)
|
1003 |
+
this.height = 101; // height of color palette (in px)
|
1004 |
+
this.showOnClick = true; // whether to display the color picker when user clicks on its target element
|
1005 |
+
this.mode = 'HSV'; // HSV | HVS | HS | HV - layout of the color picker controls
|
1006 |
+
this.position = 'bottom'; // left | right | top | bottom - position relative to the target element
|
1007 |
+
this.smartPosition = true; // automatically change picker position when there is not enough space for it
|
1008 |
+
this.sliderSize = 16; // px
|
1009 |
+
this.crossSize = 8; // px
|
1010 |
+
this.closable = false; // whether to display the Close button
|
1011 |
+
this.closeText = 'Close';
|
1012 |
+
this.buttonColor = '#000000'; // CSS color
|
1013 |
+
this.buttonHeight = 18; // px
|
1014 |
+
this.padding = 12; // px
|
1015 |
+
this.backgroundColor = '#FFFFFF'; // CSS color
|
1016 |
+
this.borderWidth = 1; // px
|
1017 |
+
this.borderColor = '#BBBBBB'; // CSS color
|
1018 |
+
this.borderRadius = 8; // px
|
1019 |
+
this.insetWidth = 1; // px
|
1020 |
+
this.insetColor = '#BBBBBB'; // CSS color
|
1021 |
+
this.shadow = true; // whether to display shadow
|
1022 |
+
this.shadowBlur = 15; // px
|
1023 |
+
this.shadowColor = 'rgba(0,0,0,0.2)'; // CSS color
|
1024 |
+
this.pointerColor = '#4C4C4C'; // px
|
1025 |
+
this.pointerBorderColor = '#FFFFFF'; // px
|
1026 |
+
this.pointerBorderWidth = 1; // px
|
1027 |
+
this.pointerThickness = 2; // px
|
1028 |
+
this.zIndex = 1000;
|
1029 |
+
this.container = null; // where to append the color picker (BODY element by default)
|
1030 |
+
|
1031 |
+
|
1032 |
+
for (var opt in options) {
|
1033 |
+
if (options.hasOwnProperty(opt)) {
|
1034 |
+
this[opt] = options[opt];
|
1035 |
+
}
|
1036 |
+
}
|
1037 |
+
|
1038 |
+
|
1039 |
+
this.hide = function () {
|
1040 |
+
if (isPickerOwner()) {
|
1041 |
+
detachPicker();
|
1042 |
+
}
|
1043 |
+
};
|
1044 |
+
|
1045 |
+
|
1046 |
+
this.show = function () {
|
1047 |
+
drawPicker();
|
1048 |
+
};
|
1049 |
+
|
1050 |
+
|
1051 |
+
this.redraw = function () {
|
1052 |
+
if (isPickerOwner()) {
|
1053 |
+
drawPicker();
|
1054 |
+
}
|
1055 |
+
};
|
1056 |
+
|
1057 |
+
|
1058 |
+
this.importColor = function () {
|
1059 |
+
if (!this.valueElement) {
|
1060 |
+
this.exportColor();
|
1061 |
+
} else {
|
1062 |
+
if (jsc.isElementType(this.valueElement, 'input')) {
|
1063 |
+
if (!this.refine) {
|
1064 |
+
if (!this.fromString(this.valueElement.value, jsc.leaveValue)) {
|
1065 |
+
if (this.styleElement) {
|
1066 |
+
this.styleElement.style.backgroundImage = this.styleElement._jscOrigStyle.backgroundImage;
|
1067 |
+
this.styleElement.style.backgroundColor = this.styleElement._jscOrigStyle.backgroundColor;
|
1068 |
+
this.styleElement.style.color = this.styleElement._jscOrigStyle.color;
|
1069 |
+
}
|
1070 |
+
this.exportColor(jsc.leaveValue | jsc.leaveStyle);
|
1071 |
+
}
|
1072 |
+
} else if (!this.required && /^\s*$/.test(this.valueElement.value)) {
|
1073 |
+
this.valueElement.value = '';
|
1074 |
+
if (this.styleElement) {
|
1075 |
+
this.styleElement.style.backgroundImage = this.styleElement._jscOrigStyle.backgroundImage;
|
1076 |
+
this.styleElement.style.backgroundColor = this.styleElement._jscOrigStyle.backgroundColor;
|
1077 |
+
this.styleElement.style.color = this.styleElement._jscOrigStyle.color;
|
1078 |
+
}
|
1079 |
+
this.exportColor(jsc.leaveValue | jsc.leaveStyle);
|
1080 |
+
|
1081 |
+
} else if (this.fromString(this.valueElement.value)) {
|
1082 |
+
// managed to import color successfully from the value -> OK, don't do anything
|
1083 |
+
} else {
|
1084 |
+
this.exportColor();
|
1085 |
+
}
|
1086 |
+
} else {
|
1087 |
+
// not an input element -> doesn't have any value
|
1088 |
+
this.exportColor();
|
1089 |
+
}
|
1090 |
+
}
|
1091 |
+
};
|
1092 |
+
|
1093 |
+
|
1094 |
+
this.exportColor = function (flags) {
|
1095 |
+
if (!(flags & jsc.leaveValue) && this.valueElement) {
|
1096 |
+
var value = this.toString();
|
1097 |
+
if (this.uppercase) { value = value.toUpperCase(); }
|
1098 |
+
if (this.hash) { value = '#' + value; }
|
1099 |
+
|
1100 |
+
if (jsc.isElementType(this.valueElement, 'input')) {
|
1101 |
+
this.valueElement.value = value;
|
1102 |
+
} else {
|
1103 |
+
this.valueElement.innerHTML = value;
|
1104 |
+
}
|
1105 |
+
}
|
1106 |
+
if (!(flags & jsc.leaveStyle)) {
|
1107 |
+
if (this.styleElement) {
|
1108 |
+
this.styleElement.style.backgroundImage = 'none';
|
1109 |
+
this.styleElement.style.backgroundColor = '#' + this.toString();
|
1110 |
+
this.styleElement.style.color = this.isLight() ? '#000' : '#FFF';
|
1111 |
+
}
|
1112 |
+
}
|
1113 |
+
if (!(flags & jsc.leavePad) && isPickerOwner()) {
|
1114 |
+
redrawPad();
|
1115 |
+
}
|
1116 |
+
if (!(flags & jsc.leaveSld) && isPickerOwner()) {
|
1117 |
+
redrawSld();
|
1118 |
+
}
|
1119 |
+
};
|
1120 |
+
|
1121 |
+
|
1122 |
+
// h: 0-360
|
1123 |
+
// s: 0-100
|
1124 |
+
// v: 0-100
|
1125 |
+
//
|
1126 |
+
this.fromHSV = function (h, s, v, flags) { // null = don't change
|
1127 |
+
if (h !== null) {
|
1128 |
+
if (isNaN(h)) { return false; }
|
1129 |
+
h = Math.max(0, Math.min(360, h));
|
1130 |
+
}
|
1131 |
+
if (s !== null) {
|
1132 |
+
if (isNaN(s)) { return false; }
|
1133 |
+
s = Math.max(0, Math.min(100, this.maxS, s), this.minS);
|
1134 |
+
}
|
1135 |
+
if (v !== null) {
|
1136 |
+
if (isNaN(v)) { return false; }
|
1137 |
+
v = Math.max(0, Math.min(100, this.maxV, v), this.minV);
|
1138 |
+
}
|
1139 |
+
|
1140 |
+
this.rgb = HSV_RGB(
|
1141 |
+
h===null ? this.hsv[0] : (this.hsv[0]=h),
|
1142 |
+
s===null ? this.hsv[1] : (this.hsv[1]=s),
|
1143 |
+
v===null ? this.hsv[2] : (this.hsv[2]=v)
|
1144 |
+
);
|
1145 |
+
|
1146 |
+
this.exportColor(flags);
|
1147 |
+
};
|
1148 |
+
|
1149 |
+
|
1150 |
+
// r: 0-255
|
1151 |
+
// g: 0-255
|
1152 |
+
// b: 0-255
|
1153 |
+
//
|
1154 |
+
this.fromRGB = function (r, g, b, flags) { // null = don't change
|
1155 |
+
if (r !== null) {
|
1156 |
+
if (isNaN(r)) { return false; }
|
1157 |
+
r = Math.max(0, Math.min(255, r));
|
1158 |
+
}
|
1159 |
+
if (g !== null) {
|
1160 |
+
if (isNaN(g)) { return false; }
|
1161 |
+
g = Math.max(0, Math.min(255, g));
|
1162 |
+
}
|
1163 |
+
if (b !== null) {
|
1164 |
+
if (isNaN(b)) { return false; }
|
1165 |
+
b = Math.max(0, Math.min(255, b));
|
1166 |
+
}
|
1167 |
+
|
1168 |
+
var hsv = RGB_HSV(
|
1169 |
+
r===null ? this.rgb[0] : r,
|
1170 |
+
g===null ? this.rgb[1] : g,
|
1171 |
+
b===null ? this.rgb[2] : b
|
1172 |
+
);
|
1173 |
+
if (hsv[0] !== null) {
|
1174 |
+
this.hsv[0] = Math.max(0, Math.min(360, hsv[0]));
|
1175 |
+
}
|
1176 |
+
if (hsv[2] !== 0) {
|
1177 |
+
this.hsv[1] = hsv[1]===null ? null : Math.max(0, this.minS, Math.min(100, this.maxS, hsv[1]));
|
1178 |
+
}
|
1179 |
+
this.hsv[2] = hsv[2]===null ? null : Math.max(0, this.minV, Math.min(100, this.maxV, hsv[2]));
|
1180 |
+
|
1181 |
+
// update RGB according to final HSV, as some values might be trimmed
|
1182 |
+
var rgb = HSV_RGB(this.hsv[0], this.hsv[1], this.hsv[2]);
|
1183 |
+
this.rgb[0] = rgb[0];
|
1184 |
+
this.rgb[1] = rgb[1];
|
1185 |
+
this.rgb[2] = rgb[2];
|
1186 |
+
|
1187 |
+
this.exportColor(flags);
|
1188 |
+
};
|
1189 |
+
|
1190 |
+
|
1191 |
+
this.fromString = function (str, flags) {
|
1192 |
+
var m;
|
1193 |
+
if (m = str.match(/^\W*([0-9A-F]{3}([0-9A-F]{3})?)\W*$/i)) {
|
1194 |
+
// HEX notation
|
1195 |
+
//
|
1196 |
+
|
1197 |
+
if (m[1].length === 6) {
|
1198 |
+
// 6-char notation
|
1199 |
+
this.fromRGB(
|
1200 |
+
parseInt(m[1].substr(0,2),16),
|
1201 |
+
parseInt(m[1].substr(2,2),16),
|
1202 |
+
parseInt(m[1].substr(4,2),16),
|
1203 |
+
flags
|
1204 |
+
);
|
1205 |
+
} else {
|
1206 |
+
// 3-char notation
|
1207 |
+
this.fromRGB(
|
1208 |
+
parseInt(m[1].charAt(0) + m[1].charAt(0),16),
|
1209 |
+
parseInt(m[1].charAt(1) + m[1].charAt(1),16),
|
1210 |
+
parseInt(m[1].charAt(2) + m[1].charAt(2),16),
|
1211 |
+
flags
|
1212 |
+
);
|
1213 |
+
}
|
1214 |
+
return true;
|
1215 |
+
|
1216 |
+
} else if (m = str.match(/^\W*rgba?\(([^)]*)\)\W*$/i)) {
|
1217 |
+
var params = m[1].split(',');
|
1218 |
+
var re = /^\s*(\d*)(\.\d+)?\s*$/;
|
1219 |
+
var mR, mG, mB;
|
1220 |
+
if (
|
1221 |
+
params.length >= 3 &&
|
1222 |
+
(mR = params[0].match(re)) &&
|
1223 |
+
(mG = params[1].match(re)) &&
|
1224 |
+
(mB = params[2].match(re))
|
1225 |
+
) {
|
1226 |
+
var r = parseFloat((mR[1] || '0') + (mR[2] || ''));
|
1227 |
+
var g = parseFloat((mG[1] || '0') + (mG[2] || ''));
|
1228 |
+
var b = parseFloat((mB[1] || '0') + (mB[2] || ''));
|
1229 |
+
this.fromRGB(r, g, b, flags);
|
1230 |
+
return true;
|
1231 |
+
}
|
1232 |
+
}
|
1233 |
+
return false;
|
1234 |
+
};
|
1235 |
+
|
1236 |
+
|
1237 |
+
this.toString = function () {
|
1238 |
+
return (
|
1239 |
+
(0x100 | Math.round(this.rgb[0])).toString(16).substr(1) +
|
1240 |
+
(0x100 | Math.round(this.rgb[1])).toString(16).substr(1) +
|
1241 |
+
(0x100 | Math.round(this.rgb[2])).toString(16).substr(1)
|
1242 |
+
);
|
1243 |
+
};
|
1244 |
+
|
1245 |
+
|
1246 |
+
this.toHEXString = function () {
|
1247 |
+
return '#' + this.toString().toUpperCase();
|
1248 |
+
};
|
1249 |
+
|
1250 |
+
|
1251 |
+
this.toRGBString = function () {
|
1252 |
+
return ('rgb(' +
|
1253 |
+
Math.round(this.rgb[0]) + ',' +
|
1254 |
+
Math.round(this.rgb[1]) + ',' +
|
1255 |
+
Math.round(this.rgb[2]) + ')'
|
1256 |
+
);
|
1257 |
+
};
|
1258 |
+
|
1259 |
+
|
1260 |
+
this.isLight = function () {
|
1261 |
+
return (
|
1262 |
+
0.213 * this.rgb[0] +
|
1263 |
+
0.715 * this.rgb[1] +
|
1264 |
+
0.072 * this.rgb[2] >
|
1265 |
+
255 / 2
|
1266 |
+
);
|
1267 |
+
};
|
1268 |
+
|
1269 |
+
|
1270 |
+
this._processParentElementsInDOM = function () {
|
1271 |
+
if (this._linkedElementsProcessed) { return; }
|
1272 |
+
this._linkedElementsProcessed = true;
|
1273 |
+
|
1274 |
+
var elm = this.targetElement;
|
1275 |
+
do {
|
1276 |
+
// If the target element or one of its parent nodes has fixed position,
|
1277 |
+
// then use fixed positioning instead
|
1278 |
+
//
|
1279 |
+
// Note: In Firefox, getComputedStyle returns null in a hidden iframe,
|
1280 |
+
// that's why we need to check if the returned style object is non-empty
|
1281 |
+
var currStyle = jsc.getStyle(elm);
|
1282 |
+
if (currStyle && currStyle.position.toLowerCase() === 'fixed') {
|
1283 |
+
this.fixed = true;
|
1284 |
+
}
|
1285 |
+
|
1286 |
+
if (elm !== this.targetElement) {
|
1287 |
+
// Ensure to attach onParentScroll only once to each parent element
|
1288 |
+
// (multiple targetElements can share the same parent nodes)
|
1289 |
+
//
|
1290 |
+
// Note: It's not just offsetParents that can be scrollable,
|
1291 |
+
// that's why we loop through all parent nodes
|
1292 |
+
if (!elm._jscEventsAttached) {
|
1293 |
+
jsc.attachEvent(elm, 'scroll', jsc.onParentScroll);
|
1294 |
+
elm._jscEventsAttached = true;
|
1295 |
+
}
|
1296 |
+
}
|
1297 |
+
} while ((elm = elm.parentNode) && !jsc.isElementType(elm, 'body'));
|
1298 |
+
};
|
1299 |
+
|
1300 |
+
|
1301 |
+
// r: 0-255
|
1302 |
+
// g: 0-255
|
1303 |
+
// b: 0-255
|
1304 |
+
//
|
1305 |
+
// returns: [ 0-360, 0-100, 0-100 ]
|
1306 |
+
//
|
1307 |
+
function RGB_HSV (r, g, b) {
|
1308 |
+
r /= 255;
|
1309 |
+
g /= 255;
|
1310 |
+
b /= 255;
|
1311 |
+
var n = Math.min(Math.min(r,g),b);
|
1312 |
+
var v = Math.max(Math.max(r,g),b);
|
1313 |
+
var m = v - n;
|
1314 |
+
if (m === 0) { return [ null, 0, 100 * v ]; }
|
1315 |
+
var h = r===n ? 3+(b-g)/m : (g===n ? 5+(r-b)/m : 1+(g-r)/m);
|
1316 |
+
return [
|
1317 |
+
60 * (h===6?0:h),
|
1318 |
+
100 * (m/v),
|
1319 |
+
100 * v
|
1320 |
+
];
|
1321 |
+
}
|
1322 |
+
|
1323 |
+
|
1324 |
+
// h: 0-360
|
1325 |
+
// s: 0-100
|
1326 |
+
// v: 0-100
|
1327 |
+
//
|
1328 |
+
// returns: [ 0-255, 0-255, 0-255 ]
|
1329 |
+
//
|
1330 |
+
function HSV_RGB (h, s, v) {
|
1331 |
+
var u = 255 * (v / 100);
|
1332 |
+
|
1333 |
+
if (h === null) {
|
1334 |
+
return [ u, u, u ];
|
1335 |
+
}
|
1336 |
+
|
1337 |
+
h /= 60;
|
1338 |
+
s /= 100;
|
1339 |
+
|
1340 |
+
var i = Math.floor(h);
|
1341 |
+
var f = i%2 ? h-i : 1-(h-i);
|
1342 |
+
var m = u * (1 - s);
|
1343 |
+
var n = u * (1 - s * f);
|
1344 |
+
switch (i) {
|
1345 |
+
case 6:
|
1346 |
+
case 0: return [u,n,m];
|
1347 |
+
case 1: return [n,u,m];
|
1348 |
+
case 2: return [m,u,n];
|
1349 |
+
case 3: return [m,n,u];
|
1350 |
+
case 4: return [n,m,u];
|
1351 |
+
case 5: return [u,m,n];
|
1352 |
+
}
|
1353 |
+
}
|
1354 |
+
|
1355 |
+
|
1356 |
+
function detachPicker () {
|
1357 |
+
jsc.unsetClass(THIS.targetElement, THIS.activeClass);
|
1358 |
+
jsc.picker.wrap.parentNode.removeChild(jsc.picker.wrap);
|
1359 |
+
delete jsc.picker.owner;
|
1360 |
+
}
|
1361 |
+
|
1362 |
+
|
1363 |
+
function drawPicker () {
|
1364 |
+
|
1365 |
+
// At this point, when drawing the picker, we know what the parent elements are
|
1366 |
+
// and we can do all related DOM operations, such as registering events on them
|
1367 |
+
// or checking their positioning
|
1368 |
+
THIS._processParentElementsInDOM();
|
1369 |
+
|
1370 |
+
if (!jsc.picker) {
|
1371 |
+
jsc.picker = {
|
1372 |
+
owner: null,
|
1373 |
+
wrap : document.createElement('div'),
|
1374 |
+
box : document.createElement('div'),
|
1375 |
+
boxS : document.createElement('div'), // shadow area
|
1376 |
+
boxB : document.createElement('div'), // border
|
1377 |
+
pad : document.createElement('div'),
|
1378 |
+
padB : document.createElement('div'), // border
|
1379 |
+
padM : document.createElement('div'), // mouse/touch area
|
1380 |
+
padPal : jsc.createPalette(),
|
1381 |
+
cross : document.createElement('div'),
|
1382 |
+
crossBY : document.createElement('div'), // border Y
|
1383 |
+
crossBX : document.createElement('div'), // border X
|
1384 |
+
crossLY : document.createElement('div'), // line Y
|
1385 |
+
crossLX : document.createElement('div'), // line X
|
1386 |
+
sld : document.createElement('div'),
|
1387 |
+
sldB : document.createElement('div'), // border
|
1388 |
+
sldM : document.createElement('div'), // mouse/touch area
|
1389 |
+
sldGrad : jsc.createSliderGradient(),
|
1390 |
+
sldPtrS : document.createElement('div'), // slider pointer spacer
|
1391 |
+
sldPtrIB : document.createElement('div'), // slider pointer inner border
|
1392 |
+
sldPtrMB : document.createElement('div'), // slider pointer middle border
|
1393 |
+
sldPtrOB : document.createElement('div'), // slider pointer outer border
|
1394 |
+
btn : document.createElement('div'),
|
1395 |
+
btnT : document.createElement('span') // text
|
1396 |
+
};
|
1397 |
+
|
1398 |
+
jsc.picker.pad.appendChild(jsc.picker.padPal.elm);
|
1399 |
+
jsc.picker.padB.appendChild(jsc.picker.pad);
|
1400 |
+
jsc.picker.cross.appendChild(jsc.picker.crossBY);
|
1401 |
+
jsc.picker.cross.appendChild(jsc.picker.crossBX);
|
1402 |
+
jsc.picker.cross.appendChild(jsc.picker.crossLY);
|
1403 |
+
jsc.picker.cross.appendChild(jsc.picker.crossLX);
|
1404 |
+
jsc.picker.padB.appendChild(jsc.picker.cross);
|
1405 |
+
jsc.picker.box.appendChild(jsc.picker.padB);
|
1406 |
+
jsc.picker.box.appendChild(jsc.picker.padM);
|
1407 |
+
|
1408 |
+
jsc.picker.sld.appendChild(jsc.picker.sldGrad.elm);
|
1409 |
+
jsc.picker.sldB.appendChild(jsc.picker.sld);
|
1410 |
+
jsc.picker.sldB.appendChild(jsc.picker.sldPtrOB);
|
1411 |
+
jsc.picker.sldPtrOB.appendChild(jsc.picker.sldPtrMB);
|
1412 |
+
jsc.picker.sldPtrMB.appendChild(jsc.picker.sldPtrIB);
|
1413 |
+
jsc.picker.sldPtrIB.appendChild(jsc.picker.sldPtrS);
|
1414 |
+
jsc.picker.box.appendChild(jsc.picker.sldB);
|
1415 |
+
jsc.picker.box.appendChild(jsc.picker.sldM);
|
1416 |
+
|
1417 |
+
jsc.picker.btn.appendChild(jsc.picker.btnT);
|
1418 |
+
jsc.picker.box.appendChild(jsc.picker.btn);
|
1419 |
+
|
1420 |
+
jsc.picker.boxB.appendChild(jsc.picker.box);
|
1421 |
+
jsc.picker.wrap.appendChild(jsc.picker.boxS);
|
1422 |
+
jsc.picker.wrap.appendChild(jsc.picker.boxB);
|
1423 |
+
}
|
1424 |
+
|
1425 |
+
var p = jsc.picker;
|
1426 |
+
|
1427 |
+
var displaySlider = !!jsc.getSliderComponent(THIS);
|
1428 |
+
var dims = jsc.getPickerDims(THIS);
|
1429 |
+
var crossOuterSize = (2 * THIS.pointerBorderWidth + THIS.pointerThickness + 2 * THIS.crossSize);
|
1430 |
+
var padToSliderPadding = jsc.getPadToSliderPadding(THIS);
|
1431 |
+
var borderRadius = Math.min(
|
1432 |
+
THIS.borderRadius,
|
1433 |
+
Math.round(THIS.padding * Math.PI)); // px
|
1434 |
+
var padCursor = 'crosshair';
|
1435 |
+
|
1436 |
+
// wrap
|
1437 |
+
p.wrap.style.clear = 'both';
|
1438 |
+
p.wrap.style.width = (dims[0] + 2 * THIS.borderWidth) + 'px';
|
1439 |
+
p.wrap.style.height = (dims[1] + 2 * THIS.borderWidth) + 'px';
|
1440 |
+
p.wrap.style.zIndex = THIS.zIndex;
|
1441 |
+
|
1442 |
+
// picker
|
1443 |
+
p.box.style.width = dims[0] + 'px';
|
1444 |
+
p.box.style.height = dims[1] + 'px';
|
1445 |
+
|
1446 |
+
p.boxS.style.position = 'absolute';
|
1447 |
+
p.boxS.style.left = '0';
|
1448 |
+
p.boxS.style.top = '0';
|
1449 |
+
p.boxS.style.width = '100%';
|
1450 |
+
p.boxS.style.height = '100%';
|
1451 |
+
jsc.setBorderRadius(p.boxS, borderRadius + 'px');
|
1452 |
+
|
1453 |
+
// picker border
|
1454 |
+
p.boxB.style.position = 'relative';
|
1455 |
+
p.boxB.style.border = THIS.borderWidth + 'px solid';
|
1456 |
+
p.boxB.style.borderColor = THIS.borderColor;
|
1457 |
+
p.boxB.style.background = THIS.backgroundColor;
|
1458 |
+
jsc.setBorderRadius(p.boxB, borderRadius + 'px');
|
1459 |
+
|
1460 |
+
// IE hack:
|
1461 |
+
// If the element is transparent, IE will trigger the event on the elements under it,
|
1462 |
+
// e.g. on Canvas or on elements with border
|
1463 |
+
p.padM.style.background =
|
1464 |
+
p.sldM.style.background =
|
1465 |
+
'#FFF';
|
1466 |
+
jsc.setStyle(p.padM, 'opacity', '0');
|
1467 |
+
jsc.setStyle(p.sldM, 'opacity', '0');
|
1468 |
+
|
1469 |
+
// pad
|
1470 |
+
p.pad.style.position = 'relative';
|
1471 |
+
p.pad.style.width = THIS.width + 'px';
|
1472 |
+
p.pad.style.height = THIS.height + 'px';
|
1473 |
+
|
1474 |
+
// pad palettes (HSV and HVS)
|
1475 |
+
p.padPal.draw(THIS.width, THIS.height, jsc.getPadYComponent(THIS));
|
1476 |
+
|
1477 |
+
// pad border
|
1478 |
+
p.padB.style.position = 'absolute';
|
1479 |
+
p.padB.style.left = THIS.padding + 'px';
|
1480 |
+
p.padB.style.top = THIS.padding + 'px';
|
1481 |
+
p.padB.style.border = THIS.insetWidth + 'px solid';
|
1482 |
+
p.padB.style.borderColor = THIS.insetColor;
|
1483 |
+
|
1484 |
+
// pad mouse area
|
1485 |
+
p.padM._jscInstance = THIS;
|
1486 |
+
p.padM._jscControlName = 'pad';
|
1487 |
+
p.padM.style.position = 'absolute';
|
1488 |
+
p.padM.style.left = '0';
|
1489 |
+
p.padM.style.top = '0';
|
1490 |
+
p.padM.style.width = (THIS.padding + 2 * THIS.insetWidth + THIS.width + padToSliderPadding / 2) + 'px';
|
1491 |
+
p.padM.style.height = dims[1] + 'px';
|
1492 |
+
p.padM.style.cursor = padCursor;
|
1493 |
+
|
1494 |
+
// pad cross
|
1495 |
+
p.cross.style.position = 'absolute';
|
1496 |
+
p.cross.style.left =
|
1497 |
+
p.cross.style.top =
|
1498 |
+
'0';
|
1499 |
+
p.cross.style.width =
|
1500 |
+
p.cross.style.height =
|
1501 |
+
crossOuterSize + 'px';
|
1502 |
+
|
1503 |
+
// pad cross border Y and X
|
1504 |
+
p.crossBY.style.position =
|
1505 |
+
p.crossBX.style.position =
|
1506 |
+
'absolute';
|
1507 |
+
p.crossBY.style.background =
|
1508 |
+
p.crossBX.style.background =
|
1509 |
+
THIS.pointerBorderColor;
|
1510 |
+
p.crossBY.style.width =
|
1511 |
+
p.crossBX.style.height =
|
1512 |
+
(2 * THIS.pointerBorderWidth + THIS.pointerThickness) + 'px';
|
1513 |
+
p.crossBY.style.height =
|
1514 |
+
p.crossBX.style.width =
|
1515 |
+
crossOuterSize + 'px';
|
1516 |
+
p.crossBY.style.left =
|
1517 |
+
p.crossBX.style.top =
|
1518 |
+
(Math.floor(crossOuterSize / 2) - Math.floor(THIS.pointerThickness / 2) - THIS.pointerBorderWidth) + 'px';
|
1519 |
+
p.crossBY.style.top =
|
1520 |
+
p.crossBX.style.left =
|
1521 |
+
'0';
|
1522 |
+
|
1523 |
+
// pad cross line Y and X
|
1524 |
+
p.crossLY.style.position =
|
1525 |
+
p.crossLX.style.position =
|
1526 |
+
'absolute';
|
1527 |
+
p.crossLY.style.background =
|
1528 |
+
p.crossLX.style.background =
|
1529 |
+
THIS.pointerColor;
|
1530 |
+
p.crossLY.style.height =
|
1531 |
+
p.crossLX.style.width =
|
1532 |
+
(crossOuterSize - 2 * THIS.pointerBorderWidth) + 'px';
|
1533 |
+
p.crossLY.style.width =
|
1534 |
+
p.crossLX.style.height =
|
1535 |
+
THIS.pointerThickness + 'px';
|
1536 |
+
p.crossLY.style.left =
|
1537 |
+
p.crossLX.style.top =
|
1538 |
+
(Math.floor(crossOuterSize / 2) - Math.floor(THIS.pointerThickness / 2)) + 'px';
|
1539 |
+
p.crossLY.style.top =
|
1540 |
+
p.crossLX.style.left =
|
1541 |
+
THIS.pointerBorderWidth + 'px';
|
1542 |
+
|
1543 |
+
// slider
|
1544 |
+
p.sld.style.overflow = 'hidden';
|
1545 |
+
p.sld.style.width = THIS.sliderSize + 'px';
|
1546 |
+
p.sld.style.height = THIS.height + 'px';
|
1547 |
+
|
1548 |
+
// slider gradient
|
1549 |
+
p.sldGrad.draw(THIS.sliderSize, THIS.height, '#000', '#000');
|
1550 |
+
|
1551 |
+
// slider border
|
1552 |
+
p.sldB.style.display = displaySlider ? 'block' : 'none';
|
1553 |
+
p.sldB.style.position = 'absolute';
|
1554 |
+
p.sldB.style.right = THIS.padding + 'px';
|
1555 |
+
p.sldB.style.top = THIS.padding + 'px';
|
1556 |
+
p.sldB.style.border = THIS.insetWidth + 'px solid';
|
1557 |
+
p.sldB.style.borderColor = THIS.insetColor;
|
1558 |
+
|
1559 |
+
// slider mouse area
|
1560 |
+
p.sldM._jscInstance = THIS;
|
1561 |
+
p.sldM._jscControlName = 'sld';
|
1562 |
+
p.sldM.style.display = displaySlider ? 'block' : 'none';
|
1563 |
+
p.sldM.style.position = 'absolute';
|
1564 |
+
p.sldM.style.right = '0';
|
1565 |
+
p.sldM.style.top = '0';
|
1566 |
+
p.sldM.style.width = (THIS.sliderSize + padToSliderPadding / 2 + THIS.padding + 2 * THIS.insetWidth) + 'px';
|
1567 |
+
p.sldM.style.height = dims[1] + 'px';
|
1568 |
+
p.sldM.style.cursor = 'default';
|
1569 |
+
|
1570 |
+
// slider pointer inner and outer border
|
1571 |
+
p.sldPtrIB.style.border =
|
1572 |
+
p.sldPtrOB.style.border =
|
1573 |
+
THIS.pointerBorderWidth + 'px solid ' + THIS.pointerBorderColor;
|
1574 |
+
|
1575 |
+
// slider pointer outer border
|
1576 |
+
p.sldPtrOB.style.position = 'absolute';
|
1577 |
+
p.sldPtrOB.style.left = -(2 * THIS.pointerBorderWidth + THIS.pointerThickness) + 'px';
|
1578 |
+
p.sldPtrOB.style.top = '0';
|
1579 |
+
|
1580 |
+
// slider pointer middle border
|
1581 |
+
p.sldPtrMB.style.border = THIS.pointerThickness + 'px solid ' + THIS.pointerColor;
|
1582 |
+
|
1583 |
+
// slider pointer spacer
|
1584 |
+
p.sldPtrS.style.width = THIS.sliderSize + 'px';
|
1585 |
+
p.sldPtrS.style.height = sliderPtrSpace + 'px';
|
1586 |
+
|
1587 |
+
// the Close button
|
1588 |
+
function setBtnBorder () {
|
1589 |
+
var insetColors = THIS.insetColor.split(/\s+/);
|
1590 |
+
var outsetColor = insetColors.length < 2 ? insetColors[0] : insetColors[1] + ' ' + insetColors[0] + ' ' + insetColors[0] + ' ' + insetColors[1];
|
1591 |
+
p.btn.style.borderColor = outsetColor;
|
1592 |
+
}
|
1593 |
+
p.btn.style.display = THIS.closable ? 'block' : 'none';
|
1594 |
+
p.btn.style.position = 'absolute';
|
1595 |
+
p.btn.style.left = THIS.padding + 'px';
|
1596 |
+
p.btn.style.bottom = THIS.padding + 'px';
|
1597 |
+
p.btn.style.padding = '0 15px';
|
1598 |
+
p.btn.style.height = THIS.buttonHeight + 'px';
|
1599 |
+
p.btn.style.border = THIS.insetWidth + 'px solid';
|
1600 |
+
setBtnBorder();
|
1601 |
+
p.btn.style.color = THIS.buttonColor;
|
1602 |
+
p.btn.style.font = '12px sans-serif';
|
1603 |
+
p.btn.style.textAlign = 'center';
|
1604 |
+
try {
|
1605 |
+
p.btn.style.cursor = 'pointer';
|
1606 |
+
} catch(eOldIE) {
|
1607 |
+
p.btn.style.cursor = 'hand';
|
1608 |
+
}
|
1609 |
+
p.btn.onmousedown = function () {
|
1610 |
+
THIS.hide();
|
1611 |
+
};
|
1612 |
+
p.btnT.style.lineHeight = THIS.buttonHeight + 'px';
|
1613 |
+
p.btnT.innerHTML = '';
|
1614 |
+
p.btnT.appendChild(document.createTextNode(THIS.closeText));
|
1615 |
+
|
1616 |
+
// place pointers
|
1617 |
+
redrawPad();
|
1618 |
+
redrawSld();
|
1619 |
+
|
1620 |
+
// If we are changing the owner without first closing the picker,
|
1621 |
+
// make sure to first deal with the old owner
|
1622 |
+
if (jsc.picker.owner && jsc.picker.owner !== THIS) {
|
1623 |
+
jsc.unsetClass(jsc.picker.owner.targetElement, THIS.activeClass);
|
1624 |
+
}
|
1625 |
+
|
1626 |
+
// Set the new picker owner
|
1627 |
+
jsc.picker.owner = THIS;
|
1628 |
+
|
1629 |
+
// The redrawPosition() method needs picker.owner to be set, that's why we call it here,
|
1630 |
+
// after setting the owner
|
1631 |
+
if (jsc.isElementType(container, 'body')) {
|
1632 |
+
jsc.redrawPosition();
|
1633 |
+
} else {
|
1634 |
+
jsc._drawPosition(THIS, 0, 0, 'relative', false);
|
1635 |
+
}
|
1636 |
+
|
1637 |
+
if (p.wrap.parentNode != container) {
|
1638 |
+
container.appendChild(p.wrap);
|
1639 |
+
}
|
1640 |
+
|
1641 |
+
jsc.setClass(THIS.targetElement, THIS.activeClass);
|
1642 |
+
}
|
1643 |
+
|
1644 |
+
|
1645 |
+
function redrawPad () {
|
1646 |
+
// redraw the pad pointer
|
1647 |
+
switch (jsc.getPadYComponent(THIS)) {
|
1648 |
+
case 's': var yComponent = 1; break;
|
1649 |
+
case 'v': var yComponent = 2; break;
|
1650 |
+
}
|
1651 |
+
var x = Math.round((THIS.hsv[0] / 360) * (THIS.width - 1));
|
1652 |
+
var y = Math.round((1 - THIS.hsv[yComponent] / 100) * (THIS.height - 1));
|
1653 |
+
var crossOuterSize = (2 * THIS.pointerBorderWidth + THIS.pointerThickness + 2 * THIS.crossSize);
|
1654 |
+
var ofs = -Math.floor(crossOuterSize / 2);
|
1655 |
+
jsc.picker.cross.style.left = (x + ofs) + 'px';
|
1656 |
+
jsc.picker.cross.style.top = (y + ofs) + 'px';
|
1657 |
+
|
1658 |
+
// redraw the slider
|
1659 |
+
switch (jsc.getSliderComponent(THIS)) {
|
1660 |
+
case 's':
|
1661 |
+
var rgb1 = HSV_RGB(THIS.hsv[0], 100, THIS.hsv[2]);
|
1662 |
+
var rgb2 = HSV_RGB(THIS.hsv[0], 0, THIS.hsv[2]);
|
1663 |
+
var color1 = 'rgb(' +
|
1664 |
+
Math.round(rgb1[0]) + ',' +
|
1665 |
+
Math.round(rgb1[1]) + ',' +
|
1666 |
+
Math.round(rgb1[2]) + ')';
|
1667 |
+
var color2 = 'rgb(' +
|
1668 |
+
Math.round(rgb2[0]) + ',' +
|
1669 |
+
Math.round(rgb2[1]) + ',' +
|
1670 |
+
Math.round(rgb2[2]) + ')';
|
1671 |
+
jsc.picker.sldGrad.draw(THIS.sliderSize, THIS.height, color1, color2);
|
1672 |
+
break;
|
1673 |
+
case 'v':
|
1674 |
+
var rgb = HSV_RGB(THIS.hsv[0], THIS.hsv[1], 100);
|
1675 |
+
var color1 = 'rgb(' +
|
1676 |
+
Math.round(rgb[0]) + ',' +
|
1677 |
+
Math.round(rgb[1]) + ',' +
|
1678 |
+
Math.round(rgb[2]) + ')';
|
1679 |
+
var color2 = '#000';
|
1680 |
+
jsc.picker.sldGrad.draw(THIS.sliderSize, THIS.height, color1, color2);
|
1681 |
+
break;
|
1682 |
+
}
|
1683 |
+
}
|
1684 |
+
|
1685 |
+
|
1686 |
+
function redrawSld () {
|
1687 |
+
var sldComponent = jsc.getSliderComponent(THIS);
|
1688 |
+
if (sldComponent) {
|
1689 |
+
// redraw the slider pointer
|
1690 |
+
switch (sldComponent) {
|
1691 |
+
case 's': var yComponent = 1; break;
|
1692 |
+
case 'v': var yComponent = 2; break;
|
1693 |
+
}
|
1694 |
+
var y = Math.round((1 - THIS.hsv[yComponent] / 100) * (THIS.height - 1));
|
1695 |
+
jsc.picker.sldPtrOB.style.top = (y - (2 * THIS.pointerBorderWidth + THIS.pointerThickness) - Math.floor(sliderPtrSpace / 2)) + 'px';
|
1696 |
+
}
|
1697 |
+
}
|
1698 |
+
|
1699 |
+
|
1700 |
+
function isPickerOwner () {
|
1701 |
+
return jsc.picker && jsc.picker.owner === THIS;
|
1702 |
+
}
|
1703 |
+
|
1704 |
+
|
1705 |
+
function blurValue () {
|
1706 |
+
THIS.importColor();
|
1707 |
+
}
|
1708 |
+
|
1709 |
+
|
1710 |
+
// Find the target element
|
1711 |
+
if (typeof targetElement === 'string') {
|
1712 |
+
var id = targetElement;
|
1713 |
+
var elm = document.getElementById(id);
|
1714 |
+
if (elm) {
|
1715 |
+
this.targetElement = elm;
|
1716 |
+
} else {
|
1717 |
+
jsc.warn('Could not find target element with ID \'' + id + '\'');
|
1718 |
+
}
|
1719 |
+
} else if (targetElement) {
|
1720 |
+
this.targetElement = targetElement;
|
1721 |
+
} else {
|
1722 |
+
jsc.warn('Invalid target element: \'' + targetElement + '\'');
|
1723 |
+
}
|
1724 |
+
|
1725 |
+
if (this.targetElement._jscLinkedInstance) {
|
1726 |
+
jsc.warn('Cannot link jscolor twice to the same element. Skipping.');
|
1727 |
+
return;
|
1728 |
+
}
|
1729 |
+
this.targetElement._jscLinkedInstance = this;
|
1730 |
+
|
1731 |
+
// Find the value element
|
1732 |
+
this.valueElement = jsc.fetchElement(this.valueElement);
|
1733 |
+
// Find the style element
|
1734 |
+
this.styleElement = jsc.fetchElement(this.styleElement);
|
1735 |
+
|
1736 |
+
var THIS = this;
|
1737 |
+
var container =
|
1738 |
+
this.container ?
|
1739 |
+
jsc.fetchElement(this.container) :
|
1740 |
+
document.getElementsByTagName('body')[0];
|
1741 |
+
var sliderPtrSpace = 3; // px
|
1742 |
+
|
1743 |
+
// For BUTTON elements it's important to stop them from sending the form when clicked
|
1744 |
+
// (e.g. in Safari)
|
1745 |
+
if (jsc.isElementType(this.targetElement, 'button')) {
|
1746 |
+
if (this.targetElement.onclick) {
|
1747 |
+
var origCallback = this.targetElement.onclick;
|
1748 |
+
this.targetElement.onclick = function (evt) {
|
1749 |
+
origCallback.call(this, evt);
|
1750 |
+
return false;
|
1751 |
+
};
|
1752 |
+
} else {
|
1753 |
+
this.targetElement.onclick = function () { return false; };
|
1754 |
+
}
|
1755 |
+
}
|
1756 |
+
|
1757 |
+
/*
|
1758 |
+
var elm = this.targetElement;
|
1759 |
+
do {
|
1760 |
+
// If the target element or one of its offsetParents has fixed position,
|
1761 |
+
// then use fixed positioning instead
|
1762 |
+
//
|
1763 |
+
// Note: In Firefox, getComputedStyle returns null in a hidden iframe,
|
1764 |
+
// that's why we need to check if the returned style object is non-empty
|
1765 |
+
var currStyle = jsc.getStyle(elm);
|
1766 |
+
if (currStyle && currStyle.position.toLowerCase() === 'fixed') {
|
1767 |
+
this.fixed = true;
|
1768 |
+
}
|
1769 |
+
|
1770 |
+
if (elm !== this.targetElement) {
|
1771 |
+
// attach onParentScroll so that we can recompute the picker position
|
1772 |
+
// when one of the offsetParents is scrolled
|
1773 |
+
if (!elm._jscEventsAttached) {
|
1774 |
+
jsc.attachEvent(elm, 'scroll', jsc.onParentScroll);
|
1775 |
+
elm._jscEventsAttached = true;
|
1776 |
+
}
|
1777 |
+
}
|
1778 |
+
} while ((elm = elm.offsetParent) && !jsc.isElementType(elm, 'body'));
|
1779 |
+
*/
|
1780 |
+
|
1781 |
+
// valueElement
|
1782 |
+
if (this.valueElement) {
|
1783 |
+
if (jsc.isElementType(this.valueElement, 'input')) {
|
1784 |
+
var updateField = function () {
|
1785 |
+
THIS.fromString(THIS.valueElement.value, jsc.leaveValue);
|
1786 |
+
jsc.dispatchFineChange(THIS);
|
1787 |
+
};
|
1788 |
+
jsc.attachEvent(this.valueElement, 'keyup', updateField);
|
1789 |
+
jsc.attachEvent(this.valueElement, 'input', updateField);
|
1790 |
+
jsc.attachEvent(this.valueElement, 'blur', blurValue);
|
1791 |
+
this.valueElement.setAttribute('autocomplete', 'off');
|
1792 |
+
}
|
1793 |
+
}
|
1794 |
+
|
1795 |
+
// styleElement
|
1796 |
+
if (this.styleElement) {
|
1797 |
+
this.styleElement._jscOrigStyle = {
|
1798 |
+
backgroundImage : this.styleElement.style.backgroundImage,
|
1799 |
+
backgroundColor : this.styleElement.style.backgroundColor,
|
1800 |
+
color : this.styleElement.style.color
|
1801 |
+
};
|
1802 |
+
}
|
1803 |
+
|
1804 |
+
if (this.value) {
|
1805 |
+
// Try to set the color from the .value option and if unsuccessful,
|
1806 |
+
// export the current color
|
1807 |
+
this.fromString(this.value) || this.exportColor();
|
1808 |
+
} else {
|
1809 |
+
this.importColor();
|
1810 |
+
}
|
1811 |
+
}
|
1812 |
+
|
1813 |
+
};
|
1814 |
+
|
1815 |
+
|
1816 |
+
//================================
|
1817 |
+
// Public properties and methods
|
1818 |
+
//================================
|
1819 |
+
|
1820 |
+
|
1821 |
+
// By default, search for all elements with class="jscolor" and install a color picker on them.
|
1822 |
+
//
|
1823 |
+
// You can change what class name will be looked for by setting the property jscolor.lookupClass
|
1824 |
+
// anywhere in your HTML document. To completely disable the automatic lookup, set it to null.
|
1825 |
+
//
|
1826 |
+
jsc.jscolor.lookupClass = 'jscolor';
|
1827 |
+
|
1828 |
+
|
1829 |
+
jsc.jscolor.installByClassName = function (className) {
|
1830 |
+
var inputElms = document.getElementsByTagName('input');
|
1831 |
+
var buttonElms = document.getElementsByTagName('button');
|
1832 |
+
|
1833 |
+
jsc.tryInstallOnElements(inputElms, className);
|
1834 |
+
jsc.tryInstallOnElements(buttonElms, className);
|
1835 |
+
};
|
1836 |
+
|
1837 |
+
|
1838 |
+
jsc.register();
|
1839 |
+
|
1840 |
+
|
1841 |
+
return jsc.jscolor;
|
1842 |
+
|
1843 |
+
|
1844 |
+
})(); }
|
assets/js/jscolor.min.js
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* jscolor - JavaScript Color Picker
|
3 |
+
*
|
4 |
+
* @link http://jscolor.com
|
5 |
+
* @license For open source use: GPLv3
|
6 |
+
* For commercial use: JSColor Commercial License
|
7 |
+
* @author Jan Odvarko
|
8 |
+
*
|
9 |
+
* See usage examples at http://jscolor.com/examples/
|
10 |
+
*/"use strict";window.jscolor||(window.jscolor=function(){var e={register:function(){e.attachDOMReadyEvent(e.init),e.attachEvent(document,"mousedown",e.onDocumentMouseDown),e.attachEvent(document,"touchstart",e.onDocumentTouchStart),e.attachEvent(window,"resize",e.onWindowResize)},init:function(){e.jscolor.lookupClass&&e.jscolor.installByClassName(e.jscolor.lookupClass)},tryInstallOnElements:function(t,n){var r=new RegExp("(^|\\s)("+n+")(\\s*(\\{[^}]*\\})|\\s|$)","i");for(var i=0;i<t.length;i+=1){if(t[i].type!==undefined&&t[i].type.toLowerCase()=="color"&&e.isColorAttrSupported)continue;var s;if(!t[i].jscolor&&t[i].className&&(s=t[i].className.match(r))){var o=t[i],u=null,a=e.getDataAttr(o,"jscolor");a!==null?u=a:s[4]&&(u=s[4]);var f={};if(u)try{f=(new Function("return ("+u+")"))()}catch(l){e.warn("Error parsing jscolor options: "+l+":\n"+u)}o.jscolor=new e.jscolor(o,f)}}},isColorAttrSupported:function(){var e=document.createElement("input");if(e.setAttribute){e.setAttribute("type","color");if(e.type.toLowerCase()=="color")return!0}return!1}(),isCanvasSupported:function(){var e=document.createElement("canvas");return!!e.getContext&&!!e.getContext("2d")}(),fetchElement:function(e){return typeof e=="string"?document.getElementById(e):e},isElementType:function(e,t){return e.nodeName.toLowerCase()===t.toLowerCase()},getDataAttr:function(e,t){var n="data-"+t,r=e.getAttribute(n);return r!==null?r:null},attachEvent:function(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent&&e.attachEvent("on"+t,n)},detachEvent:function(e,t,n){e.removeEventListener?e.removeEventListener(t,n,!1):e.detachEvent&&e.detachEvent("on"+t,n)},_attachedGroupEvents:{},attachGroupEvent:function(t,n,r,i){e._attachedGroupEvents.hasOwnProperty(t)||(e._attachedGroupEvents[t]=[]),e._attachedGroupEvents[t].push([n,r,i]),e.attachEvent(n,r,i)},detachGroupEvents:function(t){if(e._attachedGroupEvents.hasOwnProperty(t)){for(var n=0;n<e._attachedGroupEvents[t].length;n+=1){var r=e._attachedGroupEvents[t][n];e.detachEvent(r[0],r[1],r[2])}delete e._attachedGroupEvents[t]}},attachDOMReadyEvent:function(e){var t=!1,n=function(){t||(t=!0,e())};if(document.readyState==="complete"){setTimeout(n,1);return}if(document.addEventListener)document.addEventListener("DOMContentLoaded",n,!1),window.addEventListener("load",n,!1);else if(document.attachEvent){document.attachEvent("onreadystatechange",function(){document.readyState==="complete"&&(document.detachEvent("onreadystatechange",arguments.callee),n())}),window.attachEvent("onload",n);if(document.documentElement.doScroll&&window==window.top){var r=function(){if(!document.body)return;try{document.documentElement.doScroll("left"),n()}catch(e){setTimeout(r,1)}};r()}}},warn:function(e){window.console&&window.console.warn&&window.console.warn(e)},preventDefault:function(e){e.preventDefault&&e.preventDefault(),e.returnValue=!1},captureTarget:function(t){t.setCapture&&(e._capturedTarget=t,e._capturedTarget.setCapture())},releaseTarget:function(){e._capturedTarget&&(e._capturedTarget.releaseCapture(),e._capturedTarget=null)},fireEvent:function(e,t){if(!e)return;if(document.createEvent){var n=document.createEvent("HTMLEvents");n.initEvent(t,!0,!0),e.dispatchEvent(n)}else if(document.createEventObject){var n=document.createEventObject();e.fireEvent("on"+t,n)}else e["on"+t]&&e["on"+t]()},classNameToList:function(e){return e.replace(/^\s+|\s+$/g,"").split(/\s+/)},hasClass:function(e,t){return t?-1!=(" "+e.className.replace(/\s+/g," ")+" ").indexOf(" "+t+" "):!1},setClass:function(t,n){var r=e.classNameToList(n);for(var i=0;i<r.length;i+=1)e.hasClass(t,r[i])||(t.className+=(t.className?" ":"")+r[i])},unsetClass:function(t,n){var r=e.classNameToList(n);for(var i=0;i<r.length;i+=1){var s=new RegExp("^\\s*"+r[i]+"\\s*|"+"\\s*"+r[i]+"\\s*$|"+"\\s+"+r[i]+"(\\s+)","g");t.className=t.className.replace(s,"$1")}},getStyle:function(e){return window.getComputedStyle?window.getComputedStyle(e):e.currentStyle},setStyle:function(){var e=document.createElement("div"),t=function(t){for(var n=0;n<t.length;n+=1)if(t[n]in e.style)return t[n]},n={borderRadius:t(["borderRadius","MozBorderRadius","webkitBorderRadius"]),boxShadow:t(["boxShadow","MozBoxShadow","webkitBoxShadow"])};return function(e,t,r){switch(t.toLowerCase()){case"opacity":var i=Math.round(parseFloat(r)*100);e.style.opacity=r,e.style.filter="alpha(opacity="+i+")";break;default:e.style[n[t]]=r}}}(),setBorderRadius:function(t,n){e.setStyle(t,"borderRadius",n||"0")},setBoxShadow:function(t,n){e.setStyle(t,"boxShadow",n||"none")},getElementPos:function(t,n){var r=0,i=0,s=t.getBoundingClientRect();r=s.left,i=s.top;if(!n){var o=e.getViewPos();r+=o[0],i+=o[1]}return[r,i]},getElementSize:function(e){return[e.offsetWidth,e.offsetHeight]},getAbsPointerPos:function(e){e||(e=window.event);var t=0,n=0;return typeof e.changedTouches!="undefined"&&e.changedTouches.length?(t=e.changedTouches[0].clientX,n=e.changedTouches[0].clientY):typeof e.clientX=="number"&&(t=e.clientX,n=e.clientY),{x:t,y:n}},getRelPointerPos:function(e){e||(e=window.event);var t=e.target||e.srcElement,n=t.getBoundingClientRect(),r=0,i=0,s=0,o=0;return typeof e.changedTouches!="undefined"&&e.changedTouches.length?(s=e.changedTouches[0].clientX,o=e.changedTouches[0].clientY):typeof e.clientX=="number"&&(s=e.clientX,o=e.clientY),r=s-n.left,i=o-n.top,{x:r,y:i}},getViewPos:function(){var e=document.documentElement;return[(window.pageXOffset||e.scrollLeft)-(e.clientLeft||0),(window.pageYOffset||e.scrollTop)-(e.clientTop||0)]},getViewSize:function(){var e=document.documentElement;return[window.innerWidth||e.clientWidth,window.innerHeight||e.clientHeight]},redrawPosition:function(){if(e.picker&&e.picker.owner){var t=e.picker.owner,n,r;t.fixed?(n=e.getElementPos(t.targetElement,!0),r=[0,0]):(n=e.getElementPos(t.targetElement),r=e.getViewPos());var i=e.getElementSize(t.targetElement),s=e.getViewSize(),o=e.getPickerOuterDims(t),u,a,f;switch(t.position.toLowerCase()){case"left":u=1,a=0,f=-1;break;case"right":u=1,a=0,f=1;break;case"top":u=0,a=1,f=-1;break;default:u=0,a=1,f=1}var l=(i[a]+o[a])/2;if(!t.smartPosition)var c=[n[u],n[a]+i[a]-l+l*f];else var c=[-r[u]+n[u]+o[u]>s[u]?-r[u]+n[u]+i[u]/2>s[u]/2&&n[u]+i[u]-o[u]>=0?n[u]+i[u]-o[u]:n[u]:n[u],-r[a]+n[a]+i[a]+o[a]-l+l*f>s[a]?-r[a]+n[a]+i[a]/2>s[a]/2&&n[a]+i[a]-l-l*f>=0?n[a]+i[a]-l-l*f:n[a]+i[a]-l+l*f:n[a]+i[a]-l+l*f>=0?n[a]+i[a]-l+l*f:n[a]+i[a]-l-l*f];var h=c[u],p=c[a],d=t.fixed?"fixed":"absolute",v=(c[0]+o[0]>n[0]||c[0]<n[0]+i[0])&&c[1]+o[1]<n[1]+i[1];e._drawPosition(t,h,p,d,v)}},_drawPosition:function(t,n,r,i,s){var o=s?0:t.shadowBlur;e.picker.wrap.style.position=i,e.picker.wrap.style.left=n+"px",e.picker.wrap.style.top=r+"px",e.setBoxShadow(e.picker.boxS,t.shadow?new e.BoxShadow(0,o,t.shadowBlur,0,t.shadowColor):null)},getPickerDims:function(t){var n=!!e.getSliderComponent(t),r=[2*t.insetWidth+2*t.padding+t.width+(n?2*t.insetWidth+e.getPadToSliderPadding(t)+t.sliderSize:0),2*t.insetWidth+2*t.padding+t.height+(t.closable?2*t.insetWidth+t.padding+t.buttonHeight:0)];return r},getPickerOuterDims:function(t){var n=e.getPickerDims(t);return[n[0]+2*t.borderWidth,n[1]+2*t.borderWidth]},getPadToSliderPadding:function(e){return Math.max(e.padding,1.5*(2*e.pointerBorderWidth+e.pointerThickness))},getPadYComponent:function(e){switch(e.mode.charAt(1).toLowerCase()){case"v":return"v"}return"s"},getSliderComponent:function(e){if(e.mode.length>2)switch(e.mode.charAt(2).toLowerCase()){case"s":return"s";case"v":return"v"}return null},onDocumentMouseDown:function(t){t||(t=window.event);var n=t.target||t.srcElement;n._jscLinkedInstance?n._jscLinkedInstance.showOnClick&&n._jscLinkedInstance.show():n._jscControlName?e.onControlPointerStart(t,n,n._jscControlName,"mouse"):e.picker&&e.picker.owner&&e.picker.owner.hide()},onDocumentTouchStart:function(t){t||(t=window.event);var n=t.target||t.srcElement;n._jscLinkedInstance?n._jscLinkedInstance.showOnClick&&n._jscLinkedInstance.show():n._jscControlName?e.onControlPointerStart(t,n,n._jscControlName,"touch"):e.picker&&e.picker.owner&&e.picker.owner.hide()},onWindowResize:function(t){e.redrawPosition()},onParentScroll:function(t){e.picker&&e.picker.owner&&e.picker.owner.hide()},_pointerMoveEvent:{mouse:"mousemove",touch:"touchmove"},_pointerEndEvent:{mouse:"mouseup",touch:"touchend"},_pointerOrigin:null,_capturedTarget:null,onControlPointerStart:function(t,n,r,i){var s=n._jscInstance;e.preventDefault(t),e.captureTarget(n);var o=function(s,o){e.attachGroupEvent("drag",s,e._pointerMoveEvent[i],e.onDocumentPointerMove(t,n,r,i,o)),e.attachGroupEvent("drag",s,e._pointerEndEvent[i],e.onDocumentPointerEnd(t,n,r,i))};o(document,[0,0]);if(window.parent&&window.frameElement){var u=window.frameElement.getBoundingClientRect(),a=[-u.left,-u.top];o(window.parent.window.document,a)}var f=e.getAbsPointerPos(t),l=e.getRelPointerPos(t);e._pointerOrigin={x:f.x-l.x,y:f.y-l.y};switch(r){case"pad":switch(e.getSliderComponent(s)){case"s":s.hsv[1]===0&&s.fromHSV(null,100,null);break;case"v":s.hsv[2]===0&&s.fromHSV(null,null,100)}e.setPad(s,t,0,0);break;case"sld":e.setSld(s,t,0)}e.dispatchFineChange(s)},onDocumentPointerMove:function(t,n,r,i,s){return function(t){var i=n._jscInstance;switch(r){case"pad":t||(t=window.event),e.setPad(i,t,s[0],s[1]),e.dispatchFineChange(i);break;case"sld":t||(t=window.event),e.setSld(i,t,s[1]),e.dispatchFineChange(i)}}},onDocumentPointerEnd:function(t,n,r,i){return function(t){var r=n._jscInstance;e.detachGroupEvents("drag"),e.releaseTarget(),e.dispatchChange(r)}},dispatchChange:function(t){t.valueElement&&e.isElementType(t.valueElement,"input")&&e.fireEvent(t.valueElement,"change")},dispatchFineChange:function(e){if(e.onFineChange){var t;typeof e.onFineChange=="string"?t=new Function(e.onFineChange):t=e.onFineChange,t.call(e)}},setPad:function(t,n,r,i){var s=e.getAbsPointerPos(n),o=r+s.x-e._pointerOrigin.x-t.padding-t.insetWidth,u=i+s.y-e._pointerOrigin.y-t.padding-t.insetWidth,a=o*(360/(t.width-1)),f=100-u*(100/(t.height-1));switch(e.getPadYComponent(t)){case"s":t.fromHSV(a,f,null,e.leaveSld);break;case"v":t.fromHSV(a,null,f,e.leaveSld)}},setSld:function(t,n,r){var i=e.getAbsPointerPos(n),s=r+i.y-e._pointerOrigin.y-t.padding-t.insetWidth,o=100-s*(100/(t.height-1));switch(e.getSliderComponent(t)){case"s":t.fromHSV(null,o,null,e.leavePad);break;case"v":t.fromHSV(null,null,o,e.leavePad)}},_vmlNS:"jsc_vml_",_vmlCSS:"jsc_vml_css_",_vmlReady:!1,initVML:function(){if(!e._vmlReady){var t=document;t.namespaces[e._vmlNS]||t.namespaces.add(e._vmlNS,"urn:schemas-microsoft-com:vml");if(!t.styleSheets[e._vmlCSS]){var n=["shape","shapetype","group","background","path","formulas","handles","fill","stroke","shadow","textbox","textpath","imagedata","line","polyline","curve","rect","roundrect","oval","arc","image"],r=t.createStyleSheet();r.owningElement.id=e._vmlCSS;for(var i=0;i<n.length;i+=1)r.addRule(e._vmlNS+"\\:"+n[i],"behavior:url(#default#VML);")}e._vmlReady=!0}},createPalette:function(){var t={elm:null,draw:null};if(e.isCanvasSupported){var n=document.createElement("canvas"),r=n.getContext("2d"),i=function(e,t,i){n.width=e,n.height=t,r.clearRect(0,0,n.width,n.height);var s=r.createLinearGradient(0,0,n.width,0);s.addColorStop(0,"#F00"),s.addColorStop(1/6,"#FF0"),s.addColorStop(2/6,"#0F0"),s.addColorStop(.5,"#0FF"),s.addColorStop(4/6,"#00F"),s.addColorStop(5/6,"#F0F"),s.addColorStop(1,"#F00"),r.fillStyle=s,r.fillRect(0,0,n.width,n.height);var o=r.createLinearGradient(0,0,0,n.height);switch(i.toLowerCase()){case"s":o.addColorStop(0,"rgba(255,255,255,0)"),o.addColorStop(1,"rgba(255,255,255,1)");break;case"v":o.addColorStop(0,"rgba(0,0,0,0)"),o.addColorStop(1,"rgba(0,0,0,1)")}r.fillStyle=o,r.fillRect(0,0,n.width,n.height)};t.elm=n,t.draw=i}else{e.initVML();var s=document.createElement("div");s.style.position="relative",s.style.overflow="hidden";var o=document.createElement(e._vmlNS+":fill");o.type="gradient",o.method="linear",o.angle="90",o.colors="16.67% #F0F, 33.33% #00F, 50% #0FF, 66.67% #0F0, 83.33% #FF0";var u=document.createElement(e._vmlNS+":rect");u.style.position="absolute",u.style.left="-1px",u.style.top="-1px",u.stroked=!1,u.appendChild(o),s.appendChild(u);var a=document.createElement(e._vmlNS+":fill");a.type="gradient",a.method="linear",a.angle="180",a.opacity="0";var f=document.createElement(e._vmlNS+":rect");f.style.position="absolute",f.style.left="-1px",f.style.top="-1px",f.stroked=!1,f.appendChild(a),s.appendChild(f);var i=function(e,t,n){s.style.width=e+"px",s.style.height=t+"px",u.style.width=f.style.width=e+1+"px",u.style.height=f.style.height=t+1+"px",o.color="#F00",o.color2="#F00";switch(n.toLowerCase()){case"s":a.color=a.color2="#FFF";break;case"v":a.color=a.color2="#000"}};t.elm=s,t.draw=i}return t},createSliderGradient:function(){var t={elm:null,draw:null};if(e.isCanvasSupported){var n=document.createElement("canvas"),r=n.getContext("2d"),i=function(e,t,i,s){n.width=e,n.height=t,r.clearRect(0,0,n.width,n.height);var o=r.createLinearGradient(0,0,0,n.height);o.addColorStop(0,i),o.addColorStop(1,s),r.fillStyle=o,r.fillRect(0,0,n.width,n.height)};t.elm=n,t.draw=i}else{e.initVML();var s=document.createElement("div");s.style.position="relative",s.style.overflow="hidden";var o=document.createElement(e._vmlNS+":fill");o.type="gradient",o.method="linear",o.angle="180";var u=document.createElement(e._vmlNS+":rect");u.style.position="absolute",u.style.left="-1px",u.style.top="-1px",u.stroked=!1,u.appendChild(o),s.appendChild(u);var i=function(e,t,n,r){s.style.width=e+"px",s.style.height=t+"px",u.style.width=e+1+"px",u.style.height=t+1+"px",o.color=n,o.color2=r};t.elm=s,t.draw=i}return t},leaveValue:1,leaveStyle:2,leavePad:4,leaveSld:8,BoxShadow:function(){var e=function(e,t,n,r,i,s){this.hShadow=e,this.vShadow=t,this.blur=n,this.spread=r,this.color=i,this.inset=!!s};return e.prototype.toString=function(){var e=[Math.round(this.hShadow)+"px",Math.round(this.vShadow)+"px",Math.round(this.blur)+"px",Math.round(this.spread)+"px",this.color];return this.inset&&e.push("inset"),e.join(" ")},e}(),jscolor:function(t,n){function i(e,t,n){e/=255,t/=255,n/=255;var r=Math.min(Math.min(e,t),n),i=Math.max(Math.max(e,t),n),s=i-r;if(s===0)return[null,0,100*i];var o=e===r?3+(n-t)/s:t===r?5+(e-n)/s:1+(t-e)/s;return[60*(o===6?0:o),100*(s/i),100*i]}function s(e,t,n){var r=255*(n/100);if(e===null)return[r,r,r];e/=60,t/=100;var i=Math.floor(e),s=i%2?e-i:1-(e-i),o=r*(1-t),u=r*(1-t*s);switch(i){case 6:case 0:return[r,u,o];case 1:return[u,r,o];case 2:return[o,r,u];case 3:return[o,u,r];case 4:return[u,o,r];case 5:return[r,o,u]}}function o(){e.unsetClass(d.targetElement,d.activeClass),e.picker.wrap.parentNode.removeChild(e.picker.wrap),delete e.picker.owner}function u(){function l(){var e=d.insetColor.split(/\s+/),n=e.length<2?e[0]:e[1]+" "+e[0]+" "+e[0]+" "+e[1];t.btn.style.borderColor=n}d._processParentElementsInDOM(),e.picker||(e.picker={owner:null,wrap:document.createElement("div"),box:document.createElement("div"),boxS:document.createElement("div"),boxB:document.createElement("div"),pad:document.createElement("div"),padB:document.createElement("div"),padM:document.createElement("div"),padPal:e.createPalette(),cross:document.createElement("div"),crossBY:document.createElement("div"),crossBX:document.createElement("div"),crossLY:document.createElement("div"),crossLX:document.createElement("div"),sld:document.createElement("div"),sldB:document.createElement("div"),sldM:document.createElement("div"),sldGrad:e.createSliderGradient(),sldPtrS:document.createElement("div"),sldPtrIB:document.createElement("div"),sldPtrMB:document.createElement("div"),sldPtrOB:document.createElement("div"),btn:document.createElement("div"),btnT:document.createElement("span")},e.picker.pad.appendChild(e.picker.padPal.elm),e.picker.padB.appendChild(e.picker.pad),e.picker.cross.appendChild(e.picker.crossBY),e.picker.cross.appendChild(e.picker.crossBX),e.picker.cross.appendChild(e.picker.crossLY),e.picker.cross.appendChild(e.picker.crossLX),e.picker.padB.appendChild(e.picker.cross),e.picker.box.appendChild(e.picker.padB),e.picker.box.appendChild(e.picker.padM),e.picker.sld.appendChild(e.picker.sldGrad.elm),e.picker.sldB.appendChild(e.picker.sld),e.picker.sldB.appendChild(e.picker.sldPtrOB),e.picker.sldPtrOB.appendChild(e.picker.sldPtrMB),e.picker.sldPtrMB.appendChild(e.picker.sldPtrIB),e.picker.sldPtrIB.appendChild(e.picker.sldPtrS),e.picker.box.appendChild(e.picker.sldB),e.picker.box.appendChild(e.picker.sldM),e.picker.btn.appendChild(e.picker.btnT),e.picker.box.appendChild(e.picker.btn),e.picker.boxB.appendChild(e.picker.box),e.picker.wrap.appendChild(e.picker.boxS),e.picker.wrap.appendChild(e.picker.boxB));var t=e.picker,n=!!e.getSliderComponent(d),r=e.getPickerDims(d),i=2*d.pointerBorderWidth+d.pointerThickness+2*d.crossSize,s=e.getPadToSliderPadding(d),o=Math.min(d.borderRadius,Math.round(d.padding*Math.PI)),u="crosshair";t.wrap.style.clear="both",t.wrap.style.width=r[0]+2*d.borderWidth+"px",t.wrap.style.height=r[1]+2*d.borderWidth+"px",t.wrap.style.zIndex=d.zIndex,t.box.style.width=r[0]+"px",t.box.style.height=r[1]+"px",t.boxS.style.position="absolute",t.boxS.style.left="0",t.boxS.style.top="0",t.boxS.style.width="100%",t.boxS.style.height="100%",e.setBorderRadius(t.boxS,o+"px"),t.boxB.style.position="relative",t.boxB.style.border=d.borderWidth+"px solid",t.boxB.style.borderColor=d.borderColor,t.boxB.style.background=d.backgroundColor,e.setBorderRadius(t.boxB,o+"px"),t.padM.style.background=t.sldM.style.background="#FFF",e.setStyle(t.padM,"opacity","0"),e.setStyle(t.sldM,"opacity","0"),t.pad.style.position="relative",t.pad.style.width=d.width+"px",t.pad.style.height=d.height+"px",t.padPal.draw(d.width,d.height,e.getPadYComponent(d)),t.padB.style.position="absolute",t.padB.style.left=d.padding+"px",t.padB.style.top=d.padding+"px",t.padB.style.border=d.insetWidth+"px solid",t.padB.style.borderColor=d.insetColor,t.padM._jscInstance=d,t.padM._jscControlName="pad",t.padM.style.position="absolute",t.padM.style.left="0",t.padM.style.top="0",t.padM.style.width=d.padding+2*d.insetWidth+d.width+s/2+"px",t.padM.style.height=r[1]+"px",t.padM.style.cursor=u,t.cross.style.position="absolute",t.cross.style.left=t.cross.style.top="0",t.cross.style.width=t.cross.style.height=i+"px",t.crossBY.style.position=t.crossBX.style.position="absolute",t.crossBY.style.background=t.crossBX.style.background=d.pointerBorderColor,t.crossBY.style.width=t.crossBX.style.height=2*d.pointerBorderWidth+d.pointerThickness+"px",t.crossBY.style.height=t.crossBX.style.width=i+"px",t.crossBY.style.left=t.crossBX.style.top=Math.floor(i/2)-Math.floor(d.pointerThickness/2)-d.pointerBorderWidth+"px",t.crossBY.style.top=t.crossBX.style.left="0",t.crossLY.style.position=t.crossLX.style.position="absolute",t.crossLY.style.background=t.crossLX.style.background=d.pointerColor,t.crossLY.style.height=t.crossLX.style.width=i-2*d.pointerBorderWidth+"px",t.crossLY.style.width=t.crossLX.style.height=d.pointerThickness+"px",t.crossLY.style.left=t.crossLX.style.top=Math.floor(i/2)-Math.floor(d.pointerThickness/2)+"px",t.crossLY.style.top=t.crossLX.style.left=d.pointerBorderWidth+"px",t.sld.style.overflow="hidden",t.sld.style.width=d.sliderSize+"px",t.sld.style.height=d.height+"px",t.sldGrad.draw(d.sliderSize,d.height,"#000","#000"),t.sldB.style.display=n?"block":"none",t.sldB.style.position="absolute",t.sldB.style.right=d.padding+"px",t.sldB.style.top=d.padding+"px",t.sldB.style.border=d.insetWidth+"px solid",t.sldB.style.borderColor=d.insetColor,t.sldM._jscInstance=d,t.sldM._jscControlName="sld",t.sldM.style.display=n?"block":"none",t.sldM.style.position="absolute",t.sldM.style.right="0",t.sldM.style.top="0",t.sldM.style.width=d.sliderSize+s/2+d.padding+2*d.insetWidth+"px",t.sldM.style.height=r[1]+"px",t.sldM.style.cursor="default",t.sldPtrIB.style.border=t.sldPtrOB.style.border=d.pointerBorderWidth+"px solid "+d.pointerBorderColor,t.sldPtrOB.style.position="absolute",t.sldPtrOB.style.left=-(2*d.pointerBorderWidth+d.pointerThickness)+"px",t.sldPtrOB.style.top="0",t.sldPtrMB.style.border=d.pointerThickness+"px solid "+d.pointerColor,t.sldPtrS.style.width=d.sliderSize+"px",t.sldPtrS.style.height=m+"px",t.btn.style.display=d.closable?"block":"none",t.btn.style.position="absolute",t.btn.style.left=d.padding+"px",t.btn.style.bottom=d.padding+"px",t.btn.style.padding="0 15px",t.btn.style.height=d.buttonHeight+"px",t.btn.style.border=d.insetWidth+"px solid",l(),t.btn.style.color=d.buttonColor,t.btn.style.font="12px sans-serif",t.btn.style.textAlign="center";try{t.btn.style.cursor="pointer"}catch(c){t.btn.style.cursor="hand"}t.btn.onmousedown=function(){d.hide()},t.btnT.style.lineHeight=d.buttonHeight+"px",t.btnT.innerHTML="",t.btnT.appendChild(document.createTextNode(d.closeText)),a(),f(),e.picker.owner&&e.picker.owner!==d&&e.unsetClass(e.picker.owner.targetElement,d.activeClass),e.picker.owner=d,e.isElementType(v,"body")?e.redrawPosition():e._drawPosition(d,0,0,"relative",!1),t.wrap.parentNode!=v&&v.appendChild(t.wrap),e.setClass(d.targetElement,d.activeClass)}function a(){switch(e.getPadYComponent(d)){case"s":var t=1;break;case"v":var t=2}var n=Math.round(d.hsv[0]/360*(d.width-1)),r=Math.round((1-d.hsv[t]/100)*(d.height-1)),i=2*d.pointerBorderWidth+d.pointerThickness+2*d.crossSize,o=-Math.floor(i/2);e.picker.cross.style.left=n+o+"px",e.picker.cross.style.top=r+o+"px";switch(e.getSliderComponent(d)){case"s":var u=s(d.hsv[0],100,d.hsv[2]),a=s(d.hsv[0],0,d.hsv[2]),f="rgb("+Math.round(u[0])+","+Math.round(u[1])+","+Math.round(u[2])+")",l="rgb("+Math.round(a[0])+","+Math.round(a[1])+","+Math.round(a[2])+")";e.picker.sldGrad.draw(d.sliderSize,d.height,f,l);break;case"v":var c=s(d.hsv[0],d.hsv[1],100),f="rgb("+Math.round(c[0])+","+Math.round(c[1])+","+Math.round(c[2])+")",l="#000";e.picker.sldGrad.draw(d.sliderSize,d.height,f,l)}}function f(){var t=e.getSliderComponent(d);if(t){switch(t){case"s":var n=1;break;case"v":var n=2}var r=Math.round((1-d.hsv[n]/100)*(d.height-1));e.picker.sldPtrOB.style.top=r-(2*d.pointerBorderWidth+d.pointerThickness)-Math.floor(m/2)+"px"}}function l(){return e.picker&&e.picker.owner===d}function c(){d.importColor()}this.value=null,this.valueElement=t,this.styleElement=t,this.required=!0,this.refine=!0,this.hash=!1,this.uppercase=!0,this.onFineChange=null,this.activeClass="jscolor-active",this.minS=0,this.maxS=100,this.minV=0,this.maxV=100,this.hsv=[0,0,100],this.rgb=[255,255,255],this.width=181,this.height=101,this.showOnClick=!0,this.mode="HSV",this.position="bottom",this.smartPosition=!0,this.sliderSize=16,this.crossSize=8,this.closable=!1,this.closeText="Close",this.buttonColor="#000000",this.buttonHeight=18,this.padding=12,this.backgroundColor="#FFFFFF",this.borderWidth=1,this.borderColor="#BBBBBB",this.borderRadius=8,this.insetWidth=1,this.insetColor="#BBBBBB",this.shadow=!0,this.shadowBlur=15,this.shadowColor="rgba(0,0,0,0.2)",this.pointerColor="#4C4C4C",this.pointerBorderColor="#FFFFFF",this.pointerBorderWidth=1,this.pointerThickness=2,this.zIndex=1e3,this.container=null;for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.hide=function(){l()&&o()},this.show=function(){u()},this.redraw=function(){l()&&u()},this.importColor=function(){this.valueElement?e.isElementType(this.valueElement,"input")?this.refine?!this.required&&/^\s*$/.test(this.valueElement.value)?(this.valueElement.value="",this.styleElement&&(this.styleElement.style.backgroundImage=this.styleElement._jscOrigStyle.backgroundImage,this.styleElement.style.backgroundColor=this.styleElement._jscOrigStyle.backgroundColor,this.styleElement.style.color=this.styleElement._jscOrigStyle.color),this.exportColor(e.leaveValue|e.leaveStyle)):this.fromString(this.valueElement.value)||this.exportColor():this.fromString(this.valueElement.value,e.leaveValue)||(this.styleElement&&(this.styleElement.style.backgroundImage=this.styleElement._jscOrigStyle.backgroundImage,this.styleElement.style.backgroundColor=this.styleElement._jscOrigStyle.backgroundColor,this.styleElement.style.color=this.styleElement._jscOrigStyle.color),this.exportColor(e.leaveValue|e.leaveStyle)):this.exportColor():this.exportColor()},this.exportColor=function(t){if(!(t&e.leaveValue)&&this.valueElement){var n=this.toString();this.uppercase&&(n=n.toUpperCase()),this.hash&&(n="#"+n),e.isElementType(this.valueElement,"input")?this.valueElement.value=n:this.valueElement.innerHTML=n}t&e.leaveStyle||this.styleElement&&(this.styleElement.style.backgroundImage="none",this.styleElement.style.backgroundColor="#"+this.toString(),this.styleElement.style.color=this.isLight()?"#000":"#FFF"),!(t&e.leavePad)&&l()&&a(),!(t&e.leaveSld)&&l()&&f()},this.fromHSV=function(e,t,n,r){if(e!==null){if(isNaN(e))return!1;e=Math.max(0,Math.min(360,e))}if(t!==null){if(isNaN(t))return!1;t=Math.max(0,Math.min(100,this.maxS,t),this.minS)}if(n!==null){if(isNaN(n))return!1;n=Math.max(0,Math.min(100,this.maxV,n),this.minV)}this.rgb=s(e===null?this.hsv[0]:this.hsv[0]=e,t===null?this.hsv[1]:this.hsv[1]=t,n===null?this.hsv[2]:this.hsv[2]=n),this.exportColor(r)},this.fromRGB=function(e,t,n,r){if(e!==null){if(isNaN(e))return!1;e=Math.max(0,Math.min(255,e))}if(t!==null){if(isNaN(t))return!1;t=Math.max(0,Math.min(255,t))}if(n!==null){if(isNaN(n))return!1;n=Math.max(0,Math.min(255,n))}var o=i(e===null?this.rgb[0]:e,t===null?this.rgb[1]:t,n===null?this.rgb[2]:n);o[0]!==null&&(this.hsv[0]=Math.max(0,Math.min(360,o[0]))),o[2]!==0&&(this.hsv[1]=o[1]===null?null:Math.max(0,this.minS,Math.min(100,this.maxS,o[1]))),this.hsv[2]=o[2]===null?null:Math.max(0,this.minV,Math.min(100,this.maxV,o[2]));var u=s(this.hsv[0],this.hsv[1],this.hsv[2]);this.rgb[0]=u[0],this.rgb[1]=u[1],this.rgb[2]=u[2],this.exportColor(r)},this.fromString=function(e,t){var n;if(n=e.match(/^\W*([0-9A-F]{3}([0-9A-F]{3})?)\W*$/i))return n[1].length===6?this.fromRGB(parseInt(n[1].substr(0,2),16),parseInt(n[1].substr(2,2),16),parseInt(n[1].substr(4,2),16),t):this.fromRGB(parseInt(n[1].charAt(0)+n[1].charAt(0),16),parseInt(n[1].charAt(1)+n[1].charAt(1),16),parseInt(n[1].charAt(2)+n[1].charAt(2),16),t),!0;if(n=e.match(/^\W*rgba?\(([^)]*)\)\W*$/i)){var r=n[1].split(","),i=/^\s*(\d*)(\.\d+)?\s*$/,s,o,u;if(r.length>=3&&(s=r[0].match(i))&&(o=r[1].match(i))&&(u=r[2].match(i))){var a=parseFloat((s[1]||"0")+(s[2]||"")),f=parseFloat((o[1]||"0")+(o[2]||"")),l=parseFloat((u[1]||"0")+(u[2]||""));return this.fromRGB(a,f,l,t),!0}}return!1},this.toString=function(){return(256|Math.round(this.rgb[0])).toString(16).substr(1)+(256|Math.round(this.rgb[1])).toString(16).substr(1)+(256|Math.round(this.rgb[2])).toString(16).substr(1)},this.toHEXString=function(){return"#"+this.toString().toUpperCase()},this.toRGBString=function(){return"rgb("+Math.round(this.rgb[0])+","+Math.round(this.rgb[1])+","+Math.round(this.rgb[2])+")"},this.isLight=function(){return.213*this.rgb[0]+.715*this.rgb[1]+.072*this.rgb[2]>127.5},this._processParentElementsInDOM=function(){if(this._linkedElementsProcessed)return;this._linkedElementsProcessed=!0;var t=this.targetElement;do{var n=e.getStyle(t);n&&n.position.toLowerCase()==="fixed"&&(this.fixed=!0),t!==this.targetElement&&(t._jscEventsAttached||(e.attachEvent(t,"scroll",e.onParentScroll),t._jscEventsAttached=!0))}while((t=t.parentNode)&&!e.isElementType(t,"body"))};if(typeof t=="string"){var h=t,p=document.getElementById(h);p?this.targetElement=p:e.warn("Could not find target element with ID '"+h+"'")}else t?this.targetElement=t:e.warn("Invalid target element: '"+t+"'");if(this.targetElement._jscLinkedInstance){e.warn("Cannot link jscolor twice to the same element. Skipping.");return}this.targetElement._jscLinkedInstance=this,this.valueElement=e.fetchElement(this.valueElement),this.styleElement=e.fetchElement(this.styleElement);var d=this,v=this.container?e.fetchElement(this.container):document.getElementsByTagName("body")[0],m=3;if(e.isElementType(this.targetElement,"button"))if(this.targetElement.onclick){var g=this.targetElement.onclick;this.targetElement.onclick=function(e){return g.call(this,e),!1}}else this.targetElement.onclick=function(){return!1};if(this.valueElement&&e.isElementType(this.valueElement,"input")){var y=function(){d.fromString(d.valueElement.value,e.leaveValue),e.dispatchFineChange(d)};e.attachEvent(this.valueElement,"keyup",y),e.attachEvent(this.valueElement,"input",y),e.attachEvent(this.valueElement,"blur",c),this.valueElement.setAttribute("autocomplete","off")}this.styleElement&&(this.styleElement._jscOrigStyle={backgroundImage:this.styleElement.style.backgroundImage,backgroundColor:this.styleElement.style.backgroundColor,color:this.styleElement.style.color}),this.value?this.fromString(this.value)||this.exportColor():this.importColor()}};return e.jscolor.lookupClass="jscolor",e.jscolor.installByClassName=function(t){var n=document.getElementsByTagName("input"),r=document.getElementsByTagName("button");e.tryInstallOnElements(n,t),e.tryInstallOnElements(r,t)},e.register(),e.jscolor}());
|
assets/js/quads-admin.js
CHANGED
@@ -1,1601 +1,1793 @@
|
|
1 |
-
var strict;
|
2 |
-
|
3 |
-
|
4 |
-
jQuery(document).ready(function ($) {
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
} else {
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
$(
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
//
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
function
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
/**
|
193 |
-
*
|
194 |
-
*/
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
*
|
214 |
-
|
215 |
-
|
216 |
-
function
|
217 |
-
|
218 |
-
var
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
var
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
}
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
//
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
$('#quads-adsense-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
}
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
}
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
});
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
return
|
615 |
-
}
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
-
|
854 |
-
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
}
|
861 |
-
}
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
};
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
q.
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
};
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
|
938 |
-
|
939 |
-
|
940 |
-
|
941 |
-
|
942 |
-
}
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
f.tabs.filter("." + r.
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
|
987 |
-
|
988 |
-
|
989 |
-
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
};
|
998 |
-
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
return x
|
1006 |
-
};
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
}
|
1042 |
-
}
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
-
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
}
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
-
|
1105 |
-
|
1106 |
-
|
1107 |
-
|
1108 |
-
|
1109 |
-
|
1110 |
-
|
1111 |
-
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
|
1116 |
-
|
1117 |
-
|
1118 |
-
|
1119 |
-
|
1120 |
-
|
1121 |
-
|
1122 |
-
|
1123 |
-
|
1124 |
-
|
1125 |
-
|
1126 |
-
|
1127 |
-
|
1128 |
-
|
1129 |
-
|
1130 |
-
|
1131 |
-
|
1132 |
-
|
1133 |
-
|
1134 |
-
|
1135 |
-
|
1136 |
-
|
1137 |
-
|
1138 |
-
|
1139 |
-
|
1140 |
-
|
1141 |
-
|
1142 |
-
|
1143 |
-
|
1144 |
-
|
1145 |
-
|
1146 |
-
|
1147 |
-
}
|
1148 |
-
|
1149 |
-
|
1150 |
-
|
1151 |
-
|
1152 |
-
|
1153 |
-
|
1154 |
-
|
1155 |
-
|
1156 |
-
|
1157 |
-
|
1158 |
-
|
1159 |
-
y:
|
1160 |
-
|
1161 |
-
|
1162 |
-
|
1163 |
-
|
1164 |
-
|
1165 |
-
|
1166 |
-
|
1167 |
-
|
1168 |
-
|
1169 |
-
|
1170 |
-
|
1171 |
-
|
1172 |
-
|
1173 |
-
|
1174 |
-
|
1175 |
-
|
1176 |
-
|
1177 |
-
|
1178 |
-
|
1179 |
-
|
1180 |
-
}
|
1181 |
-
|
1182 |
-
|
1183 |
-
|
1184 |
-
|
1185 |
-
|
1186 |
-
|
1187 |
-
|
1188 |
-
|
1189 |
-
|
1190 |
-
|
1191 |
-
|
1192 |
-
|
1193 |
-
|
1194 |
-
|
1195 |
-
|
1196 |
-
|
1197 |
-
|
1198 |
-
|
1199 |
-
|
1200 |
-
|
1201 |
-
|
1202 |
-
|
1203 |
-
|
1204 |
-
|
1205 |
-
|
1206 |
-
|
1207 |
-
|
1208 |
-
|
1209 |
-
}
|
1210 |
-
|
1211 |
-
|
1212 |
-
|
1213 |
-
|
1214 |
-
|
1215 |
-
|
1216 |
-
|
1217 |
-
|
1218 |
-
|
1219 |
-
|
1220 |
-
|
1221 |
-
|
1222 |
-
|
1223 |
-
|
1224 |
-
|
1225 |
-
|
1226 |
-
|
1227 |
-
|
1228 |
-
|
1229 |
-
|
1230 |
-
|
1231 |
-
|
1232 |
-
|
1233 |
-
|
1234 |
-
|
1235 |
-
|
1236 |
-
|
1237 |
-
|
1238 |
-
|
1239 |
-
|
1240 |
-
|
1241 |
-
|
1242 |
-
|
1243 |
-
|
1244 |
-
|
1245 |
-
|
1246 |
-
|
1247 |
-
|
1248 |
-
|
1249 |
-
|
1250 |
-
|
1251 |
-
|
1252 |
-
|
1253 |
-
|
1254 |
-
|
1255 |
-
}
|
1256 |
-
|
1257 |
-
|
1258 |
-
|
1259 |
-
|
1260 |
-
|
1261 |
-
|
1262 |
-
|
1263 |
-
|
1264 |
-
|
1265 |
-
|
1266 |
-
|
1267 |
-
|
1268 |
-
|
1269 |
-
|
1270 |
-
|
1271 |
-
|
1272 |
-
|
1273 |
-
|
1274 |
-
|
1275 |
-
|
1276 |
-
|
1277 |
-
|
1278 |
-
|
1279 |
-
|
1280 |
-
|
1281 |
-
|
1282 |
-
|
1283 |
-
|
1284 |
-
|
1285 |
-
|
1286 |
-
cal.data('colpick').
|
1287 |
-
|
1288 |
-
|
1289 |
-
|
1290 |
-
|
1291 |
-
|
1292 |
-
|
1293 |
-
|
1294 |
-
}
|
1295 |
-
|
1296 |
-
|
1297 |
-
|
1298 |
-
|
1299 |
-
|
1300 |
-
|
1301 |
-
|
1302 |
-
|
1303 |
-
|
1304 |
-
|
1305 |
-
|
1306 |
-
|
1307 |
-
|
1308 |
-
|
1309 |
-
$(
|
1310 |
-
|
1311 |
-
|
1312 |
-
|
1313 |
-
|
1314 |
-
|
1315 |
-
|
1316 |
-
|
1317 |
-
|
1318 |
-
|
1319 |
-
|
1320 |
-
|
1321 |
-
|
1322 |
-
|
1323 |
-
|
1324 |
-
|
1325 |
-
|
1326 |
-
|
1327 |
-
|
1328 |
-
|
1329 |
-
|
1330 |
-
|
1331 |
-
|
1332 |
-
|
1333 |
-
|
1334 |
-
|
1335 |
-
|
1336 |
-
|
1337 |
-
|
1338 |
-
|
1339 |
-
|
1340 |
-
|
1341 |
-
|
1342 |
-
|
1343 |
-
|
1344 |
-
|
1345 |
-
|
1346 |
-
|
1347 |
-
var
|
1348 |
-
|
1349 |
-
|
1350 |
-
|
1351 |
-
|
1352 |
-
|
1353 |
-
|
1354 |
-
|
1355 |
-
|
1356 |
-
|
1357 |
-
|
1358 |
-
|
1359 |
-
|
1360 |
-
|
1361 |
-
|
1362 |
-
|
1363 |
-
|
1364 |
-
|
1365 |
-
|
1366 |
-
|
1367 |
-
|
1368 |
-
|
1369 |
-
|
1370 |
-
|
1371 |
-
|
1372 |
-
|
1373 |
-
|
1374 |
-
|
1375 |
-
|
1376 |
-
|
1377 |
-
|
1378 |
-
$(this).
|
1379 |
-
|
1380 |
-
|
1381 |
-
|
1382 |
-
|
1383 |
-
|
1384 |
-
|
1385 |
-
cal.
|
1386 |
-
|
1387 |
-
|
1388 |
-
|
1389 |
-
|
1390 |
-
|
1391 |
-
|
1392 |
-
|
1393 |
-
|
1394 |
-
|
1395 |
-
|
1396 |
-
|
1397 |
-
|
1398 |
-
|
1399 |
-
|
1400 |
-
|
1401 |
-
|
1402 |
-
|
1403 |
-
|
1404 |
-
|
1405 |
-
|
1406 |
-
|
1407 |
-
|
1408 |
-
|
1409 |
-
|
1410 |
-
|
1411 |
-
|
1412 |
-
|
1413 |
-
|
1414 |
-
|
1415 |
-
|
1416 |
-
|
1417 |
-
|
1418 |
-
|
1419 |
-
|
1420 |
-
|
1421 |
-
|
1422 |
-
|
1423 |
-
|
1424 |
-
|
1425 |
-
|
1426 |
-
|
1427 |
-
|
1428 |
-
|
1429 |
-
|
1430 |
-
|
1431 |
-
|
1432 |
-
|
1433 |
-
|
1434 |
-
|
1435 |
-
|
1436 |
-
|
1437 |
-
|
1438 |
-
|
1439 |
-
|
1440 |
-
|
1441 |
-
|
1442 |
-
|
1443 |
-
|
1444 |
-
|
1445 |
-
|
1446 |
-
|
1447 |
-
|
1448 |
-
|
1449 |
-
|
1450 |
-
|
1451 |
-
|
1452 |
-
|
1453 |
-
|
1454 |
-
|
1455 |
-
|
1456 |
-
|
1457 |
-
|
1458 |
-
|
1459 |
-
|
1460 |
-
|
1461 |
-
|
1462 |
-
|
1463 |
-
|
1464 |
-
|
1465 |
-
|
1466 |
-
|
1467 |
-
|
1468 |
-
col =
|
1469 |
-
|
1470 |
-
|
1471 |
-
|
1472 |
-
|
1473 |
-
|
1474 |
-
|
1475 |
-
|
1476 |
-
|
1477 |
-
|
1478 |
-
|
1479 |
-
|
1480 |
-
|
1481 |
-
|
1482 |
-
|
1483 |
-
|
1484 |
-
|
1485 |
-
|
1486 |
-
|
1487 |
-
|
1488 |
-
|
1489 |
-
|
1490 |
-
|
1491 |
-
|
1492 |
-
|
1493 |
-
|
1494 |
-
|
1495 |
-
|
1496 |
-
|
1497 |
-
|
1498 |
-
|
1499 |
-
|
1500 |
-
|
1501 |
-
|
1502 |
-
|
1503 |
-
|
1504 |
-
|
1505 |
-
|
1506 |
-
|
1507 |
-
|
1508 |
-
|
1509 |
-
|
1510 |
-
|
1511 |
-
|
1512 |
-
|
1513 |
-
|
1514 |
-
|
1515 |
-
|
1516 |
-
|
1517 |
-
|
1518 |
-
|
1519 |
-
|
1520 |
-
|
1521 |
-
|
1522 |
-
|
1523 |
-
|
1524 |
-
|
1525 |
-
|
1526 |
-
|
1527 |
-
|
1528 |
-
|
1529 |
-
|
1530 |
-
|
1531 |
-
|
1532 |
-
|
1533 |
-
|
1534 |
-
|
1535 |
-
|
1536 |
-
|
1537 |
-
|
1538 |
-
|
1539 |
-
|
1540 |
-
|
1541 |
-
|
1542 |
-
|
1543 |
-
|
1544 |
-
|
1545 |
-
|
1546 |
-
|
1547 |
-
|
1548 |
-
|
1549 |
-
|
1550 |
-
|
1551 |
-
|
1552 |
-
|
1553 |
-
|
1554 |
-
|
1555 |
-
|
1556 |
-
|
1557 |
-
|
1558 |
-
|
1559 |
-
|
1560 |
-
|
1561 |
-
|
1562 |
-
|
1563 |
-
|
1564 |
-
|
1565 |
-
|
1566 |
-
|
1567 |
-
|
1568 |
-
|
1569 |
-
|
1570 |
-
|
1571 |
-
|
1572 |
-
|
1573 |
-
|
1574 |
-
|
1575 |
-
|
1576 |
-
|
1577 |
-
|
1578 |
-
|
1579 |
-
|
1580 |
-
|
1581 |
-
|
1582 |
-
|
1583 |
-
|
1584 |
-
|
1585 |
-
|
1586 |
-
|
1587 |
-
|
1588 |
-
|
1589 |
-
|
1590 |
-
|
1591 |
-
|
1592 |
-
|
1593 |
-
|
1594 |
-
|
1595 |
-
|
1596 |
-
|
1597 |
-
|
1598 |
-
|
1599 |
-
|
1600 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1601 |
})(jQuery);
|
1 |
+
var strict;
|
2 |
+
|
3 |
+
|
4 |
+
jQuery(document).ready(function ($) {
|
5 |
+
|
6 |
+
// show / hide helper description
|
7 |
+
$('.quads-tooltip').click(function (e) {
|
8 |
+
e.preventDefault();
|
9 |
+
var icon = $(this),
|
10 |
+
bubble = $(this).next();
|
11 |
+
|
12 |
+
// Close any that are already open
|
13 |
+
$('.quads-tooltip-message').not(bubble).hide();
|
14 |
+
|
15 |
+
var position = icon.position();
|
16 |
+
if (bubble.hasClass('bottom')) {
|
17 |
+
bubble.css({
|
18 |
+
'left': (position.left - bubble.width() / 2) + 'px',
|
19 |
+
'top': (position.top + icon.height() + 9) + 'px'
|
20 |
+
});
|
21 |
+
} else {
|
22 |
+
bubble.css({
|
23 |
+
'left': (position.left + icon.width() + 9) + 'px',
|
24 |
+
'top': (position.top + icon.height() / 2 - 18) + 'px'
|
25 |
+
});
|
26 |
+
}
|
27 |
+
|
28 |
+
bubble.toggle();
|
29 |
+
e.stopPropagation();
|
30 |
+
});
|
31 |
+
|
32 |
+
$('body').click(function () {
|
33 |
+
$('.quads-tooltip-message').hide();
|
34 |
+
});
|
35 |
+
|
36 |
+
$('.quads-tooltip-message').click(function (e) {
|
37 |
+
e.stopPropagation();
|
38 |
+
});
|
39 |
+
|
40 |
+
|
41 |
+
// vi login process
|
42 |
+
$("#quads_vi_login_submit").click(function(e){
|
43 |
+
e.preventDefault();
|
44 |
+
username = $("#email").val();
|
45 |
+
password = $("#password").val();
|
46 |
+
|
47 |
+
var data = '{"email":"' + username + '", "password":"' + password + '"}';
|
48 |
+
|
49 |
+
$.ajax({
|
50 |
+
type: "POST",
|
51 |
+
//url: "https://dashboard-api-test.vidint.net/v1/api/authenticate",
|
52 |
+
url: quads.vi_login_url,
|
53 |
+
contentType: 'application/json',
|
54 |
+
data: data,
|
55 |
+
statusCode: {
|
56 |
+
502: function () {
|
57 |
+
$("#quads_add_err").html("502 Bad Gateway. Contact support[at]vi.ai");
|
58 |
+
console.log('502 Bad Gateway.');
|
59 |
+
return false;
|
60 |
+
},
|
61 |
+
500: function () {
|
62 |
+
$("#quads_add_err").html("500 Bad Gateway. Contact support[at]vi.ai");
|
63 |
+
console.log('500 Bad Gateway.');
|
64 |
+
return false;
|
65 |
+
}
|
66 |
+
},
|
67 |
+
success: function(response){
|
68 |
+
$("#quads_add_err").css('display', 'none', 'important').css('visibility', 'hidden');
|
69 |
+
$("#quads_add_err").hide();
|
70 |
+
if (typeof response.data !== 'undefined') {
|
71 |
+
$("#quads_add_err").html("We are logging you in");
|
72 |
+
console.log('We are logging you in' + response);
|
73 |
+
saveViToken(response.data);
|
74 |
+
}
|
75 |
+
else {
|
76 |
+
$("#quads_add_err").html("No valid API response. Can not log you in. Contact support[at]vi.ai");
|
77 |
+
console.log('no valid api response' + response);
|
78 |
+
}
|
79 |
+
},
|
80 |
+
error: function(response){
|
81 |
+
// check if xhr.status is defined in $.ajax.statusCode
|
82 |
+
// if true, return false to stop this function
|
83 |
+
if (typeof this.statusCode[response.status] != 'undefined') {
|
84 |
+
return false;
|
85 |
+
}
|
86 |
+
|
87 |
+
var result = typeof response.responseText !== 'undefined' ? JSON.parse(response.responseText) : '';
|
88 |
+
$("#quads_add_err").html(result.error.message + ' ' + result.error.description);
|
89 |
+
$("#quads_add_err").css('display', 'inline', 'important').css('visibility', 'visible');
|
90 |
+
$("#quads_add_err").show();
|
91 |
+
$("#quads_add_err").removeClass('quads-spinner');
|
92 |
+
console.log(result);
|
93 |
+
//exit;
|
94 |
+
},
|
95 |
+
beforeSend:function()
|
96 |
+
{
|
97 |
+
$("#quads_vi_loading").css('display', 'inline', 'important').css('visibility', 'visible');
|
98 |
+
$("#quads_add_err").show();
|
99 |
+
},
|
100 |
+
|
101 |
+
complete:function()
|
102 |
+
{
|
103 |
+
$("#quads_vi_loading").css('display', 'none', 'important').css('visibility', 'hidden');
|
104 |
+
}
|
105 |
+
|
106 |
+
});
|
107 |
+
return false;
|
108 |
+
});
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Save vi token
|
112 |
+
*/
|
113 |
+
function saveViToken(token){
|
114 |
+
var data = {
|
115 |
+
'action': 'quads_save_vi_token',
|
116 |
+
'token': token
|
117 |
+
};
|
118 |
+
$.ajax({
|
119 |
+
type: "POST",
|
120 |
+
url: ajaxurl,
|
121 |
+
data: data,
|
122 |
+
//contentType: 'application/json',
|
123 |
+
success: function(response){
|
124 |
+
console.log(response.error);
|
125 |
+
$("#quads_add_err").css('display', 'none', 'important').css('visibility', 'hidden');
|
126 |
+
$("#quads_add_err").hide();
|
127 |
+
if (response.status == 'success') {
|
128 |
+
console.log('Success, login succesfull, token stored' + response);
|
129 |
+
window.location.href = quads.path + '/wp-admin/?page=quads-settings&tab=general#quads_settingsvi_header';
|
130 |
+
} else {
|
131 |
+
console.log("Can not store token");
|
132 |
+
window.location.href = quads.path + '/wp-admin/?page=quads-settings&tab=general#quads_settingsvi_header';
|
133 |
+
}
|
134 |
+
},
|
135 |
+
beforeSend:function()
|
136 |
+
{
|
137 |
+
$("#quads_add_err").css('display', 'inline', 'important').css('visibility', 'visible');
|
138 |
+
$("#quads_add_err").show();
|
139 |
+
},
|
140 |
+
complete:function()
|
141 |
+
{
|
142 |
+
$("#quads_add_err").css('display', 'none', 'important').css('visibility', 'hidden');
|
143 |
+
$("#quads_add_err").hide();
|
144 |
+
}
|
145 |
+
|
146 |
+
});
|
147 |
+
}
|
148 |
+
|
149 |
+
|
150 |
+
|
151 |
+
// Remove several unused elements from vi page
|
152 |
+
if (document.location.href.indexOf('vi_header') > - 1) {
|
153 |
+
$('#quads-submit-button').hide();
|
154 |
+
$('#quads-validate').hide();
|
155 |
+
$('#quads-footer').hide();
|
156 |
+
} else {
|
157 |
+
$('#quads-submit-button').show();
|
158 |
+
$('#quads-validate').show();
|
159 |
+
$('#quads-footer').show();
|
160 |
+
}
|
161 |
+
$(window).bind('easytabs:after', function(){
|
162 |
+
if (document.location.href.indexOf('vi_header') > - 1) {
|
163 |
+
$('#quads-submit-button').hide();
|
164 |
+
$('#quads-validate').hide();
|
165 |
+
$('#quads-footer').hide();
|
166 |
+
} else {
|
167 |
+
|
168 |
+
$('#quads-submit-button').show();
|
169 |
+
$('#quads-validate').show();
|
170 |
+
$('#quads-footer').show();
|
171 |
+
}
|
172 |
+
});
|
173 |
+
|
174 |
+
|
175 |
+
|
176 |
+
|
177 |
+
|
178 |
+
// VI signup form
|
179 |
+
$('#quads-vi-signup').click(function(e){
|
180 |
+
e.preventDefault();
|
181 |
+
// scroll to top
|
182 |
+
$(window).scrollTop(0);
|
183 |
+
// hide save button
|
184 |
+
$('#quads-submit-button').hide();
|
185 |
+
$('#quads-vi-signup-fullscreen').fadeIn();
|
186 |
+
});
|
187 |
+
$('#quads-vi-close').click(function(e){
|
188 |
+
e.preventDefault();
|
189 |
+
$('#quads-vi-signup-fullscreen').fadeOut();
|
190 |
+
});
|
191 |
+
|
192 |
+
/**
|
193 |
+
* General Tab
|
194 |
+
*/
|
195 |
+
// Inactive select fields are greyed out
|
196 |
+
$('.quads-assign').each(function(e){
|
197 |
+
if (!$(this).prop('checked')){
|
198 |
+
$(this).next('select').css('background-color', 'whitesmoke').css('color', '#939393');
|
199 |
+
}else {
|
200 |
+
$(this).next('select').css('background-color', 'white').css('color', 'black');
|
201 |
+
}
|
202 |
+
});
|
203 |
+
|
204 |
+
$('.quads-assign').click(function(){
|
205 |
+
if (!$(this).prop('checked')){
|
206 |
+
$(this).next('select').css('background-color', 'whitesmoke').css('color', '#939393');
|
207 |
+
} else {
|
208 |
+
$(this).next('select').css('background-color', 'white').css('color', 'black');
|
209 |
+
}
|
210 |
+
});
|
211 |
+
|
212 |
+
/**
|
213 |
+
* AdSense Code Tab
|
214 |
+
*/
|
215 |
+
// Check if submit button is visible than stick it to the bottom of the page
|
216 |
+
$(window).scroll(function() {
|
217 |
+
|
218 |
+
var elem = '#quads_tab_container .submit';
|
219 |
+
|
220 |
+
if ($(elem).length < 1){
|
221 |
+
return;
|
222 |
+
}
|
223 |
+
|
224 |
+
var top_of_element = $(elem).offset().top;
|
225 |
+
var bottom_of_element = $(elem).offset().top + $(elem).outerHeight(false);
|
226 |
+
var bottom_of_screen = $(window).scrollTop() + $(window).height();
|
227 |
+
if (bottom_of_screen > top_of_element){
|
228 |
+
// The element is visible, do something
|
229 |
+
$('#quads-submit-button').css('position', 'relative').css('bottom', '20px');
|
230 |
+
} else {
|
231 |
+
// The element is NOT visible, do something else
|
232 |
+
$('#quads-submit-button').css('position', 'fixed').css('bottom', '20px');
|
233 |
+
}
|
234 |
+
});
|
235 |
+
|
236 |
+
// Activate chosen select boxes
|
237 |
+
// $(".quads-chosen-select").chosen({
|
238 |
+
// inherit_select_classes: true
|
239 |
+
// });
|
240 |
+
|
241 |
+
|
242 |
+
|
243 |
+
// Hid or show AMP code form on click on amp checkbox
|
244 |
+
$('.quads-activate-amp').click(function(){
|
245 |
+
var parent = $(this).parents('.quads-ad-toggle-container').attr('id');
|
246 |
+
if ($(this).attr('checked') === 'checked') {
|
247 |
+
$('#' + parent).find('.quads-amp-code').show();
|
248 |
+
} else {
|
249 |
+
$('#' + parent).find('.quads-amp-code').hide();
|
250 |
+
}
|
251 |
+
});
|
252 |
+
|
253 |
+
|
254 |
+
// Hide or show AMP code form on loading
|
255 |
+
$('.quads-ad-toggle-container').find('.quads-activate-amp').each(function (index, value) {
|
256 |
+
var parentContainerID = $(this).parents('.quads-ad-toggle-container').attr('id');
|
257 |
+
if ($(this).attr( 'checked') === 'checked' ) {
|
258 |
+
$('#' + parentContainerID).find('.quads-amp-code').show();
|
259 |
+
}else {
|
260 |
+
$('#' + parentContainerID).find('.quads-amp-code').hide();
|
261 |
+
}
|
262 |
+
});
|
263 |
+
|
264 |
+
|
265 |
+
|
266 |
+
/**
|
267 |
+
* Toggle Button | Open All Ads
|
268 |
+
*/
|
269 |
+
$('#quads-open-toggle').click(function(){
|
270 |
+
if ($('#quads-open-toggle').text() === 'Open All Ads' ){
|
271 |
+
$('.quads-ad-toggle-container').show();
|
272 |
+
$('#quads-open-toggle').html('Close Ads');
|
273 |
+
}else{
|
274 |
+
$('.quads-ad-toggle-container').hide();
|
275 |
+
$('#quads-open-toggle').html('Open All Ads');
|
276 |
+
}
|
277 |
+
});
|
278 |
+
|
279 |
+
// show / hide helper description
|
280 |
+
$('.quads-helper').click(function (e) {
|
281 |
+
e.preventDefault();
|
282 |
+
var icon = $(this),
|
283 |
+
bubble = $(this).next();
|
284 |
+
|
285 |
+
// Close any that are already open
|
286 |
+
$('.quads-message').not(bubble).hide();
|
287 |
+
|
288 |
+
var position = icon.position();
|
289 |
+
if (bubble.hasClass('bottom')) {
|
290 |
+
bubble.css({
|
291 |
+
'left': (position.left - bubble.width() / 2) + 'px',
|
292 |
+
'top': (position.top + icon.height() + 9) + 'px'
|
293 |
+
});
|
294 |
+
} else {
|
295 |
+
bubble.css({
|
296 |
+
'left': (position.left + icon.width() + 9) + 'px',
|
297 |
+
'top': (position.top + icon.height() / 2 - 18) + 'px'
|
298 |
+
});
|
299 |
+
}
|
300 |
+
|
301 |
+
bubble.toggle();
|
302 |
+
e.stopPropagation();
|
303 |
+
});
|
304 |
+
$('.quads-general-helper').click(function (e) {
|
305 |
+
e.preventDefault();
|
306 |
+
var icon = $(this),
|
307 |
+
bubble = $(this).next();
|
308 |
+
|
309 |
+
// Close any that are already open
|
310 |
+
$('.quads-message').not(bubble).hide();
|
311 |
+
|
312 |
+
var position = icon.position();
|
313 |
+
if (bubble.hasClass('bottom')) {
|
314 |
+
bubble.css({
|
315 |
+
'left': (position.left - bubble.width() / 2) + 'px',
|
316 |
+
'top': (position.top + icon.height() + 9) + 'px'
|
317 |
+
});
|
318 |
+
} else {
|
319 |
+
bubble.css({
|
320 |
+
'left': (position.left + icon.width() + 9) + 'px',
|
321 |
+
'top': (position.top + icon.height() / 2 - 18) + 'px'
|
322 |
+
});
|
323 |
+
}
|
324 |
+
|
325 |
+
bubble.toggle();
|
326 |
+
e.stopPropagation();
|
327 |
+
});
|
328 |
+
|
329 |
+
$('body').click(function () {
|
330 |
+
$('.quads-message').hide();
|
331 |
+
});
|
332 |
+
|
333 |
+
$('.quads-message').click(function (e) {
|
334 |
+
e.stopPropagation();
|
335 |
+
});
|
336 |
+
|
337 |
+
/**
|
338 |
+
* Save settings via ajax
|
339 |
+
*/
|
340 |
+
|
341 |
+
jQuery('#quads_settings').submit(function() {
|
342 |
+
|
343 |
+
// Check if ad name has been changed and prepare new data for saving
|
344 |
+
$('.quads-toogle-title').each(function(){
|
345 |
+
$(this).children('input').val($(this).text());
|
346 |
+
});
|
347 |
+
|
348 |
+
|
349 |
+
// Check current url / settings page
|
350 |
+
var url = window.location.search;
|
351 |
+
var tab_imexport = url.search("page=quads-settings&tab=imexport");
|
352 |
+
var tab_licenses = url.search("page=quads-settings&tab=licenses");
|
353 |
+
|
354 |
+
jQuery('#quads-save-result').html("<div id='quads-loader' class='quads-loader'></div>");
|
355 |
+
jQuery('#quads-loader').append('<p><img src="'+quads.path+'/wp-content/plugins/quick-adsense-reloaded/assets/images/loader1.gif"></p>').show();
|
356 |
+
jQuery(this).ajaxSubmit({
|
357 |
+
|
358 |
+
success: function(){
|
359 |
+
jQuery('#quads-save-result').html("<div id='quads-save-message' class='quads-success-modal'></div>");
|
360 |
+
jQuery('#quads-save-message').append('<p><img src="'+quads.path+'/wp-content/plugins/quick-adsense-reloaded/assets/images/saved.gif"></p>').show();
|
361 |
+
quads_hide_success_message();
|
362 |
+
},
|
363 |
+
//,timeout: 0,
|
364 |
+
|
365 |
+
error: function(){
|
366 |
+
//Do not show alert on import/export tab
|
367 |
+
if ( tab_imexport === -1 && tab_licenses === -1 ){
|
368 |
+
alert ('Error: Can not save settings. Try again');
|
369 |
+
}
|
370 |
+
jQuery('#quads-save-result').hide('fast');
|
371 |
+
}
|
372 |
+
});
|
373 |
+
// Do not use ajax saving on import/export and licenses tab
|
374 |
+
if ( tab_imexport === -1 && tab_licenses ===-1 ){
|
375 |
+
return false;
|
376 |
+
}
|
377 |
+
});
|
378 |
+
|
379 |
+
function quads_hide_success_message(){
|
380 |
+
setTimeout("jQuery('#quads-save-message').hide()", 1000);
|
381 |
+
}
|
382 |
+
|
383 |
+
|
384 |
+
/**
|
385 |
+
* Paste AdSense Code form
|
386 |
+
*/
|
387 |
+
$(document).on('click', '#quads-paste-button', function () {
|
388 |
+
|
389 |
+
var content = $('#quads-adsense-form').val();
|
390 |
+
var parseResult = quadsParseAdSenseCode(content);
|
391 |
+
if (false !== parseResult) {
|
392 |
+
console.log(parseResult);
|
393 |
+
setDetailsFromAdCode(parseResult);
|
394 |
+
}else{
|
395 |
+
$('#quads-msg').html('Can not parse AdSense Code. Is the code valid?');
|
396 |
+
$('#quads-msg').show();
|
397 |
+
}
|
398 |
+
});
|
399 |
+
|
400 |
+
|
401 |
+
/**
|
402 |
+
* Populate AdSense Date Fields
|
403 |
+
*
|
404 |
+
* @param object adsense
|
405 |
+
* @param2 string id of the parent container
|
406 |
+
* @returns false
|
407 |
+
*/
|
408 |
+
function setDetailsFromAdCode(GoogleAd) {
|
409 |
+
|
410 |
+
var containerID = $('#quads-adsense-id').val();
|
411 |
+
|
412 |
+
var id = containerID.replace("quads-toggle", "");
|
413 |
+
|
414 |
+
$('#quads_settings\\[ads\\]\\[' + id + '\\]\\[g_data_ad_slot\\]').val(GoogleAd.slotId);
|
415 |
+
$('#quads_settings\\[ads\\]\\[' + id + '\\]\\[g_data_ad_client\\]').val(GoogleAd.pubId);
|
416 |
+
if ('normal' == GoogleAd.type) {
|
417 |
+
console.log($('#quads_settings\\[ads\\]\\[' + id + '\\]\\[adsense_type\\]'));
|
418 |
+
$('#quads_settings\\[ads\\]\\[' + id + '\\]\\[adsense_type\\]').val('normal');
|
419 |
+
$('#quads_settings\\[ads\\]\\[' + id + '\\]\\[g_data_ad_width\\]').val(GoogleAd.width);
|
420 |
+
$('#quads_settings\\[ads\\]\\[' + id + '\\]\\[g_data_ad_height\\]').val(GoogleAd.height);
|
421 |
+
}
|
422 |
+
if ('responsive' == GoogleAd.type) {
|
423 |
+
$('#quads_settings\\[ads\\]\\[' + id + '\\]\\[adsense_type\\]').val('responsive');
|
424 |
+
//$('#ad-resize-type').val('auto');
|
425 |
+
$('#quads_settings\\[ads\\]\\[' + id + '\\]\\[g_data_ad_width\\]').val('');
|
426 |
+
$('#quads_settings\\[ads\\]\\[' + id + '\\]\\[g_data_ad_height\\]').val('');
|
427 |
+
}
|
428 |
+
// Trigger the ad type select
|
429 |
+
$('.quads-select-Type').trigger('change');
|
430 |
+
// Hide the overlay
|
431 |
+
$('#quads-adsense-bg-div').hide();
|
432 |
+
// Ad code input form must not be empty!
|
433 |
+
if ($('#' + containerID).children('textarea').val().length === 0){
|
434 |
+
$('#' + containerID).children('textarea').val('adsense');
|
435 |
+
}
|
436 |
+
|
437 |
+
|
438 |
+
}
|
439 |
+
|
440 |
+
/**
|
441 |
+
* Parse the adsense ad content
|
442 |
+
* @param {type} content
|
443 |
+
* @returns {quads-admin.min_L3.parseAdContent.GoogleAd|Boolean}
|
444 |
+
*/
|
445 |
+
function quadsParseAdSenseCode(content) {
|
446 |
+
|
447 |
+
var rawContent = ('undefined' != typeof (content)) ? content.trim() : '';
|
448 |
+
var GoogleAd = {};
|
449 |
+
var theContent = $('<div />').html(rawContent);
|
450 |
+
var asyncGoogleAd = theContent.find('ins');
|
451 |
+
//var syncGoogleAd = theContent.search('google_ad_client');
|
452 |
+
|
453 |
+
// Its a async adsense ad
|
454 |
+
if (asyncGoogleAd.length > 0) {
|
455 |
+
console.log('async ad');
|
456 |
+
|
457 |
+
// Ad Slot ID
|
458 |
+
GoogleAd.slotId = asyncGoogleAd.attr('data-ad-slot');
|
459 |
+
|
460 |
+
if ('undefined' != typeof (asyncGoogleAd.attr('data-ad-client'))) {
|
461 |
+
// Ad Publisher ID
|
462 |
+
GoogleAd.pubId = asyncGoogleAd.attr('data-ad-client').substr(3);
|
463 |
+
}
|
464 |
+
|
465 |
+
if (undefined !== GoogleAd.slotId && '' != GoogleAd.pubId) {
|
466 |
+
GoogleAd.display = asyncGoogleAd.css('display');
|
467 |
+
GoogleAd.format = asyncGoogleAd.attr('data-ad-format');
|
468 |
+
GoogleAd.style = asyncGoogleAd.attr('style');
|
469 |
+
|
470 |
+
if ('undefined' == typeof (GoogleAd.format) && -1 != GoogleAd.style.indexOf('width')) {
|
471 |
+
/* normal ad */
|
472 |
+
GoogleAd.type = 'normal';
|
473 |
+
GoogleAd.width = asyncGoogleAd.css('width').replace('px', '');
|
474 |
+
GoogleAd.height = asyncGoogleAd.css('height').replace('px', '');
|
475 |
+
return GoogleAd;
|
476 |
+
}
|
477 |
+
|
478 |
+
if ('undefined' != typeof (GoogleAd.format) && 'auto' == GoogleAd.format) {
|
479 |
+
/* Responsive ad, auto resize */
|
480 |
+
GoogleAd.type = 'responsive';
|
481 |
+
return GoogleAd;
|
482 |
+
}
|
483 |
+
return GoogleAd;
|
484 |
+
}
|
485 |
+
|
486 |
+
return false;
|
487 |
+
}
|
488 |
+
|
489 |
+
// Google syncronous ad
|
490 |
+
if (rawContent.search('google_ad_client') > 0) {
|
491 |
+
console.log('syncronous code');
|
492 |
+
|
493 |
+
// Ad Slot ID
|
494 |
+
GoogleAd.slotId = get_google_ad_slot(content);
|
495 |
+
|
496 |
+
console.log(get_google_ad_slot(content));
|
497 |
+
console.log(get_google_ad_client(content));
|
498 |
+
console.log(get_google_ad_height(content));
|
499 |
+
console.log(get_google_ad_width(content));
|
500 |
+
|
501 |
+
if (!quadsIsEmpty(get_google_ad_client(content))) {
|
502 |
+
// Ad Publisher ID
|
503 |
+
GoogleAd.pubId = 'ca-pub-' + get_google_ad_client(content);
|
504 |
+
}else{
|
505 |
+
return false;
|
506 |
+
}
|
507 |
+
|
508 |
+
if (!quadsIsEmpty(GoogleAd.slotId) && !quadsIsEmpty(GoogleAd.pubId)) {
|
509 |
+
|
510 |
+
if (!quadsIsEmpty(get_google_ad_width(content))) {
|
511 |
+
GoogleAd.type = 'normal';
|
512 |
+
GoogleAd.width = get_google_ad_width(content);
|
513 |
+
GoogleAd.height = get_google_ad_height(content);
|
514 |
+
return GoogleAd;
|
515 |
+
}
|
516 |
+
}
|
517 |
+
return false;
|
518 |
+
}
|
519 |
+
|
520 |
+
return false;
|
521 |
+
}
|
522 |
+
|
523 |
+
function get_google_ad_slot(content) {
|
524 |
+
const regex = /google_ad_slot\s*=\s*"(\d*)";/g;
|
525 |
+
const str = content;
|
526 |
+
var m;
|
527 |
+
var result = {};
|
528 |
+
|
529 |
+
while ((m = regex.exec(str)) !== null) {
|
530 |
+
// This is necessary to avoid infinite loops with zero-width matches
|
531 |
+
if (m.index === regex.lastIndex) {
|
532 |
+
regex.lastIndex++;
|
533 |
+
}
|
534 |
+
|
535 |
+
// The result can be accessed through the `m`-variable.
|
536 |
+
m.forEach(function(match, index){
|
537 |
+
//console.log(`Found match, group ${groupIndex}: ${match}`);
|
538 |
+
console.log(match);
|
539 |
+
result = match;
|
540 |
+
});
|
541 |
+
}
|
542 |
+
return result;
|
543 |
+
}
|
544 |
+
function get_google_ad_client(content) {
|
545 |
+
const regex = /google_ad_client\s*=\s*"ca-pub-(\d*)";/g;
|
546 |
+
const str = content;
|
547 |
+
var m;
|
548 |
+
var result = {};
|
549 |
+
|
550 |
+
while ((m = regex.exec(str)) !== null) {
|
551 |
+
// This is necessary to avoid infinite loops with zero-width matches
|
552 |
+
if (m.index === regex.lastIndex) {
|
553 |
+
regex.lastIndex++;
|
554 |
+
}
|
555 |
+
|
556 |
+
// The result can be accessed through the `m`-variable.
|
557 |
+
m.forEach(function(match, index){
|
558 |
+
//console.log(`Found match, group ${groupIndex}: ${match}`);
|
559 |
+
console.log(match);
|
560 |
+
result = match;
|
561 |
+
});
|
562 |
+
}
|
563 |
+
return result;
|
564 |
+
}
|
565 |
+
function get_google_ad_width(content) {
|
566 |
+
const regex = /google_ad_width\s*=\s*(\d*);/g;
|
567 |
+
const str = content;
|
568 |
+
var m;
|
569 |
+
var result = {};
|
570 |
+
|
571 |
+
while ((m = regex.exec(str)) !== null) {
|
572 |
+
// This is necessary to avoid infinite loops with zero-width matches
|
573 |
+
if (m.index === regex.lastIndex) {
|
574 |
+
regex.lastIndex++;
|
575 |
+
}
|
576 |
+
|
577 |
+
// The result can be accessed through the `m`-variable.
|
578 |
+
m.forEach(function(match, index){
|
579 |
+
//console.log(`Found match, group ${groupIndex}: ${match}`);
|
580 |
+
console.log(match);
|
581 |
+
result = match;
|
582 |
+
});
|
583 |
+
}
|
584 |
+
return result;
|
585 |
+
}
|
586 |
+
function get_google_ad_height(content) {
|
587 |
+
const regex = /google_ad_height\s*=\s*(\d*);/g;
|
588 |
+
const str = content;
|
589 |
+
var m;
|
590 |
+
var result = {};
|
591 |
+
|
592 |
+
while ((m = regex.exec(str)) !== null) {
|
593 |
+
// This is necessary to avoid infinite loops with zero-width matches
|
594 |
+
if (m.index === regex.lastIndex) {
|
595 |
+
regex.lastIndex++;
|
596 |
+
}
|
597 |
+
|
598 |
+
// The result can be accessed through the `m`-variable.
|
599 |
+
m.forEach(function(match, index){
|
600 |
+
//console.log(`Found match, group ${groupIndex}: ${match}`);
|
601 |
+
console.log(match);
|
602 |
+
result = match;
|
603 |
+
});
|
604 |
+
}
|
605 |
+
return result;
|
606 |
+
}
|
607 |
+
|
608 |
+
/**
|
609 |
+
* Check if return value is empty or not
|
610 |
+
* @param {type} str
|
611 |
+
* @returns {Boolean}
|
612 |
+
*/
|
613 |
+
function quadsIsEmpty(str) {
|
614 |
+
return (!str || 0 === str.length);
|
615 |
+
}
|
616 |
+
|
617 |
+
// AdSense Code Input Form
|
618 |
+
$(document).on('click', '.quads-add-adsense', function (e) {
|
619 |
+
e.preventDefault();
|
620 |
+
var parentContainerID = $(this).parents('.quads-ad-toggle-container').attr('id');
|
621 |
+
// Empty the ad plain text form
|
622 |
+
$('#quads-adsense-form').val('');
|
623 |
+
$('#quads-adsense-id').val(parentContainerID);
|
624 |
+
$('#quads-adsense-bg-div').show();
|
625 |
+
});
|
626 |
+
$(document).on('click', '#quads-close-button', function (e) {
|
627 |
+
e.preventDefault();
|
628 |
+
$('#quads-adsense-bg-div').hide();
|
629 |
+
});
|
630 |
+
|
631 |
+
|
632 |
+
// Toggle between AdSense or Plain Text option
|
633 |
+
$(document).on('click', '.quads_adsense_type', function () {
|
634 |
+
|
635 |
+
var parentContainerID = $(this).parents('.quads-ad-toggle-container').attr('id');
|
636 |
+
|
637 |
+
if ($(this).val() === 'adsense') {
|
638 |
+
$('#' + parentContainerID).children('textarea').hide();
|
639 |
+
$('#' + parentContainerID).find('div.quads_adsense_code').show();
|
640 |
+
$('#' + parentContainerID).find('.quads-sizes').show();
|
641 |
+
$('#' + parentContainerID).find('.quads-sizes-container').css('clear','');
|
642 |
+
|
643 |
+
}
|
644 |
+
if ($(this).val() === 'plain_text') {
|
645 |
+
$('#' + parentContainerID).children('textarea').show();
|
646 |
+
$('#' + parentContainerID).children('div.quads_adsense_code').hide();
|
647 |
+
$('#' + parentContainerID).find('.quads-sizes').hide();
|
648 |
+
$('#' + parentContainerID).find('.quads-sizes-container').css('clear','both');
|
649 |
+
}
|
650 |
+
});
|
651 |
+
|
652 |
+
|
653 |
+
// Hide or show AdSense elements on loading
|
654 |
+
$('.quads-ad-toggle-container').find('.quads_adsense_type').each(function (index, value) {
|
655 |
+
|
656 |
+
var parentContainerID = $(this).parents('.quads-ad-toggle-container').attr('id');
|
657 |
+
|
658 |
+
if ($(this).attr('checked') === 'checked' && $(this).val() === 'adsense') {
|
659 |
+
$('#' + parentContainerID).children('textarea').fadeOut();
|
660 |
+
$('#' + parentContainerID).find('div.quads_adsense_code').show();
|
661 |
+
}
|
662 |
+
if ($(this).attr('checked') === 'checked' && $(this).val() === 'plain_text') {
|
663 |
+
$('#' + parentContainerID).children('textarea').fadeIn();
|
664 |
+
$('#' + parentContainerID).children('div.quads_adsense_code').hide();
|
665 |
+
}
|
666 |
+
});
|
667 |
+
|
668 |
+
|
669 |
+
// Hide or show AdSense width and height on loading
|
670 |
+
$('.quads-ad-toggle-container').find('.quads-select-Type').each(function (index, value) {
|
671 |
+
|
672 |
+
var parentContainerID = $(this).parents('.quads-ad-toggle-container').attr('id');
|
673 |
+
|
674 |
+
if ($(this).val() === 'responsive') {
|
675 |
+
$('#' + parentContainerID).find('.quads-type-normal').hide();
|
676 |
+
$('#' + parentContainerID).find('.quads-pro-notice').show();
|
677 |
+
$('#' + parentContainerID).find('.quads-sizes').show();
|
678 |
+
$('#' + parentContainerID).find('.quads-sizes-container').css('clear','');
|
679 |
+
}
|
680 |
+
if ($(this).val() === 'normal') {
|
681 |
+
$('#' + parentContainerID).find('.quads-type-normal').show();
|
682 |
+
$('#' + parentContainerID).find('.quads-pro-notice').hide();
|
683 |
+
$('#' + parentContainerID).find('.quads-sizes').hide();
|
684 |
+
$('#' + parentContainerID).find('.quads-sizes-container').css('clear','both');
|
685 |
+
}
|
686 |
+
});
|
687 |
+
|
688 |
+
|
689 |
+
// Toggle between Fixed Size or Responsive ad type
|
690 |
+
$(document).on('change', '.quads-select-Type', function () {
|
691 |
+
var parentContainerID = $(this).parents('.quads-ad-toggle-container').attr('id');
|
692 |
+
|
693 |
+
if ($(this).val() === 'responsive') {
|
694 |
+
$('#' + parentContainerID).find('.quads-type-normal').hide();
|
695 |
+
$('#' + parentContainerID).find('.quads-pro-notice').show();
|
696 |
+
$('#' + parentContainerID).find('.quads-sizes').show();
|
697 |
+
$('#' + parentContainerID).find('.quads-sizes-container').css('clear','');
|
698 |
+
}
|
699 |
+
if ($(this).val() === 'normal') {
|
700 |
+
$('#' + parentContainerID).find('.quads-type-normal').show();
|
701 |
+
$('#' + parentContainerID).find('.quads-pro-notice').hide();
|
702 |
+
$('#' + parentContainerID).find('.quads-sizes').hide();
|
703 |
+
$('#' + parentContainerID).find('.quads-sizes-container').css('clear','both');
|
704 |
+
}
|
705 |
+
});
|
706 |
+
|
707 |
+
//*[@id="quads-togglead1"]/div[2]
|
708 |
+
/**
|
709 |
+
* Toggle the adsense container
|
710 |
+
*/
|
711 |
+
//$('.quads-ad-toggle-header').click(function (e) {
|
712 |
+
$('.quads-form-table').on('click', '.quads-ad-toggle-header', function(e) {
|
713 |
+
e.preventDefault();
|
714 |
+
|
715 |
+
var container = $('#' + $(this).data('box-id'));
|
716 |
+
//console.log(container);
|
717 |
+
container.toggle(0, function () {
|
718 |
+
if (container.parents('.quads-ad-toggle-header').hasClass('quads-box-close')) {
|
719 |
+
// open the box
|
720 |
+
container.parents('.quads-ad-toggle-header').removeClass('quads-box-close');
|
721 |
+
} else {
|
722 |
+
container.parents('.quads-ad-toggle-header').addClass('quads-box-close');
|
723 |
+
}
|
724 |
+
});
|
725 |
+
});
|
726 |
+
|
727 |
+
/*
|
728 |
+
* Quick Adsense import process
|
729 |
+
*/
|
730 |
+
|
731 |
+
jQuery('.quads-import-settings').click(function (e) {
|
732 |
+
e.preventDefault();
|
733 |
+
|
734 |
+
if (!confirm('Importing settings from Quick AdSense will overwrite all your current settings. Are you sure?'))
|
735 |
+
return;
|
736 |
+
|
737 |
+
jQuery('#quads-import-settings').addClass('loading');
|
738 |
+
var data = {
|
739 |
+
action: 'quads_import_quick_adsense',
|
740 |
+
nonce: quads.nonce,
|
741 |
+
};
|
742 |
+
$.post(ajaxurl, data, function (resp, status, xhr) {
|
743 |
+
|
744 |
+
//console.log('success:' + resp + status + xhr);
|
745 |
+
quads_show_message(resp);
|
746 |
+
|
747 |
+
}).fail(function (xhr) { // Will be executed when $.post() fails
|
748 |
+
quads_show_message('Ajax Error: ' + xhr.status + ' ' + xhr.statusText);
|
749 |
+
//console.log('error: ' + xhr.statusText);
|
750 |
+
});
|
751 |
+
});
|
752 |
+
|
753 |
+
jQuery('#quads_insert_ads_action').click(function (e) {
|
754 |
+
e.preventDefault();
|
755 |
+
jQuery('#quads_insert_ads_box').toggle();
|
756 |
+
});
|
757 |
+
|
758 |
+
jQuery('#quads_disable_ads_action').click(function (e) {
|
759 |
+
e.preventDefault();
|
760 |
+
jQuery('#quads_disable_ads_box').toggle();
|
761 |
+
});
|
762 |
+
|
763 |
+
|
764 |
+
/**
|
765 |
+
* Show error message and die()
|
766 |
+
* Writes error message into log file
|
767 |
+
*
|
768 |
+
* @param {string} $error notice
|
769 |
+
* @returns void
|
770 |
+
*/
|
771 |
+
function quads_show_message(error) {
|
772 |
+
$('#quads-error-details').show();
|
773 |
+
$('#quads-error-details').html(error);
|
774 |
+
console.log(error);
|
775 |
+
}
|
776 |
+
|
777 |
+
|
778 |
+
/**
|
779 |
+
* Start easytabs()
|
780 |
+
*/
|
781 |
+
if ($(".quads-tabs").length) {
|
782 |
+
$('#quads_tab_container').easytabs({
|
783 |
+
animate: true,
|
784 |
+
updateHash: true,
|
785 |
+
animationSpeed: 'fast'
|
786 |
+
});
|
787 |
+
}
|
788 |
+
|
789 |
+
|
790 |
+
|
791 |
+
|
792 |
+
}); // document ready
|
793 |
+
|
794 |
+
/*
|
795 |
+
* jQuery hashchange event - v1.3 - 7/21/2010
|
796 |
+
* http://benalman.com/projects/jquery-hashchange-plugin/
|
797 |
+
*
|
798 |
+
* Copyright (c) 2010 "Cowboy" Ben Alman
|
799 |
+
* Dual licensed under the MIT and GPL licenses.
|
800 |
+
* http://benalman.com/about/license/
|
801 |
+
*/
|
802 |
+
(function ($, e, b) {
|
803 |
+
var c = "hashchange", h = document, f, g = $.event.special, i = h.documentMode, d = "on" + c in e && (i === b || i > 7);
|
804 |
+
function a(j) {
|
805 |
+
j = j || location.href;
|
806 |
+
return"#" + j.replace(/^[^#]*#?(.*)$/, "$1")
|
807 |
+
}
|
808 |
+
$.fn[c] = function (j) {
|
809 |
+
return j ? this.bind(c, j) : this.trigger(c)
|
810 |
+
};
|
811 |
+
$.fn[c].delay = 50;
|
812 |
+
g[c] = $.extend(g[c], {setup: function () {
|
813 |
+
if (d) {
|
814 |
+
return false
|
815 |
+
}
|
816 |
+
$(f.start)
|
817 |
+
}, teardown: function () {
|
818 |
+
if (d) {
|
819 |
+
return false
|
820 |
+
}
|
821 |
+
$(f.stop)
|
822 |
+
}});
|
823 |
+
f = (function () {
|
824 |
+
var j = {}, p, m = a(), k = function (q) {
|
825 |
+
return q
|
826 |
+
}, l = k, o = k;
|
827 |
+
j.start = function () {
|
828 |
+
p || n()
|
829 |
+
};
|
830 |
+
j.stop = function () {
|
831 |
+
p && clearTimeout(p);
|
832 |
+
p = b
|
833 |
+
};
|
834 |
+
function n() {
|
835 |
+
var r = a(), q = o(m);
|
836 |
+
if (r !== m) {
|
837 |
+
l(m = r, q);
|
838 |
+
$(e).trigger(c)
|
839 |
+
} else {
|
840 |
+
if (q !== m) {
|
841 |
+
location.href = location.href.replace(/#.*/, "") + q
|
842 |
+
}
|
843 |
+
}
|
844 |
+
p = setTimeout(n, $.fn[c].delay)
|
845 |
+
}
|
846 |
+
$.browser.msie && !d && (function () {
|
847 |
+
var q, r;
|
848 |
+
j.start = function () {
|
849 |
+
if (!q) {
|
850 |
+
r = $.fn[c].src;
|
851 |
+
r = r && r + a();
|
852 |
+
q = $('<iframe tabindex="-1" title="empty"/>').hide().one("load", function () {
|
853 |
+
r || l(a());
|
854 |
+
n()
|
855 |
+
}).attr("src", r || "javascript:0").insertAfter("body")[0].contentWindow;
|
856 |
+
h.onpropertychange = function () {
|
857 |
+
try {
|
858 |
+
if (event.propertyName === "title") {
|
859 |
+
q.document.title = h.title
|
860 |
+
}
|
861 |
+
} catch (s) {
|
862 |
+
}
|
863 |
+
}
|
864 |
+
}
|
865 |
+
};
|
866 |
+
j.stop = k;
|
867 |
+
o = function () {
|
868 |
+
return a(q.location.href)
|
869 |
+
};
|
870 |
+
l = function (v, s) {
|
871 |
+
var u = q.document, t = $.fn[c].domain;
|
872 |
+
if (v !== s) {
|
873 |
+
u.title = h.title;
|
874 |
+
u.open();
|
875 |
+
t && u.write('<script>document.domain="' + t + '"<\/script>');
|
876 |
+
u.close();
|
877 |
+
q.location.hash = v
|
878 |
+
}
|
879 |
+
}
|
880 |
+
})();
|
881 |
+
return j
|
882 |
+
})()
|
883 |
+
})(jQuery, this);
|
884 |
+
|
885 |
+
/*
|
886 |
+
* jQuery EasyTabs plugin 3.2.0
|
887 |
+
*
|
888 |
+
* Copyright (c) 2010-2011 Steve Schwartz (JangoSteve)
|
889 |
+
*
|
890 |
+
* Dual licensed under the MIT and GPL licenses:
|
891 |
+
* http://www.opensource.org/licenses/mit-license.php
|
892 |
+
* http://www.gnu.org/licenses/gpl.html
|
893 |
+
*
|
894 |
+
* Date: Thu May 09 17:30:00 2013 -0500
|
895 |
+
*/
|
896 |
+
(function (a) {
|
897 |
+
a.easytabs = function (j, e) {
|
898 |
+
var f = this, q = a(j), i = {animate: true, panelActiveClass: "active", tabActiveClass: "active", defaultTab: "li:first-child", animationSpeed: "fast", tabs: "> ul > li", updateHash: true, cycle: false, collapsible: false, collapsedClass: "collapsed", collapsedByDefault: true, uiTabs: false, transitionIn: "fadeIn", transitionOut: "fadeOut", transitionInEasing: "swing", transitionOutEasing: "swing", transitionCollapse: "slideUp", transitionUncollapse: "slideDown", transitionCollapseEasing: "swing", transitionUncollapseEasing: "swing", containerClass: "", tabsClass: "", tabClass: "", panelClass: "", cache: true, event: "click", panelContext: q}, h, l, v, m, d, t = {fast: 200, normal: 400, slow: 600}, r;
|
899 |
+
f.init = function () {
|
900 |
+
f.settings = r = a.extend({}, i, e);
|
901 |
+
r.bind_str = r.event + ".easytabs";
|
902 |
+
if (r.uiTabs) {
|
903 |
+
r.tabActiveClass = "ui-tabs-selected";
|
904 |
+
r.containerClass = "ui-tabs ui-widget ui-widget-content ui-corner-all";
|
905 |
+
r.tabsClass = "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all";
|
906 |
+
r.tabClass = "ui-state-default ui-corner-top";
|
907 |
+
r.panelClass = "ui-tabs-panel ui-widget-content ui-corner-bottom"
|
908 |
+
}
|
909 |
+
if (r.collapsible && e.defaultTab !== undefined && e.collpasedByDefault === undefined) {
|
910 |
+
r.collapsedByDefault = false
|
911 |
+
}
|
912 |
+
if (typeof (r.animationSpeed) === "string") {
|
913 |
+
r.animationSpeed = t[r.animationSpeed]
|
914 |
+
}
|
915 |
+
a("a.anchor").remove().prependTo("body");
|
916 |
+
q.data("easytabs", {});
|
917 |
+
f.setTransitions();
|
918 |
+
f.getTabs();
|
919 |
+
b();
|
920 |
+
g();
|
921 |
+
w();
|
922 |
+
n();
|
923 |
+
c();
|
924 |
+
q.attr("data-easytabs", true)
|
925 |
+
};
|
926 |
+
f.setTransitions = function () {
|
927 |
+
v = (r.animate) ? {show: r.transitionIn, hide: r.transitionOut, speed: r.animationSpeed, collapse: r.transitionCollapse, uncollapse: r.transitionUncollapse, halfSpeed: r.animationSpeed / 2} : {show: "show", hide: "hide", speed: 0, collapse: "hide", uncollapse: "show", halfSpeed: 0}
|
928 |
+
};
|
929 |
+
f.getTabs = function () {
|
930 |
+
var x;
|
931 |
+
f.tabs = q.find(r.tabs), f.panels = a(), f.tabs.each(function () {
|
932 |
+
var A = a(this), z = A.children("a"), y = A.children("a").data("target");
|
933 |
+
A.data("easytabs", {});
|
934 |
+
if (y !== undefined && y !== null) {
|
935 |
+
A.data("easytabs").ajax = z.attr("href")
|
936 |
+
} else {
|
937 |
+
y = z.attr("href")
|
938 |
+
}
|
939 |
+
y = y.match(/#([^\?]+)/)[1];
|
940 |
+
x = r.panelContext.find("#" + y);
|
941 |
+
if (x.length) {
|
942 |
+
x.data("easytabs", {position: x.css("position"), visibility: x.css("visibility")});
|
943 |
+
x.not(r.panelActiveClass).hide();
|
944 |
+
f.panels = f.panels.add(x);
|
945 |
+
A.data("easytabs").panel = x
|
946 |
+
} else {
|
947 |
+
f.tabs = f.tabs.not(A);
|
948 |
+
if ("console" in window) {
|
949 |
+
console.warn("Warning: tab without matching panel for selector '#" + y + "' removed from set")
|
950 |
+
}
|
951 |
+
}
|
952 |
+
})
|
953 |
+
};
|
954 |
+
f.selectTab = function (x, C) {
|
955 |
+
var y = window.location, B = y.hash.match(/^[^\?]*/)[0], z = x.parent().data("easytabs").panel, A = x.parent().data("easytabs").ajax;
|
956 |
+
if (r.collapsible && !d && (x.hasClass(r.tabActiveClass) || x.hasClass(r.collapsedClass))) {
|
957 |
+
f.toggleTabCollapse(x, z, A, C)
|
958 |
+
} else {
|
959 |
+
if (!x.hasClass(r.tabActiveClass) || !z.hasClass(r.panelActiveClass)) {
|
960 |
+
o(x, z, A, C)
|
961 |
+
} else {
|
962 |
+
if (!r.cache) {
|
963 |
+
o(x, z, A, C)
|
964 |
+
}
|
965 |
+
}
|
966 |
+
}
|
967 |
+
};
|
968 |
+
f.toggleTabCollapse = function (x, y, z, A) {
|
969 |
+
f.panels.stop(true, true);
|
970 |
+
if (u(q, "easytabs:before", [x, y, r])) {
|
971 |
+
f.tabs.filter("." + r.tabActiveClass).removeClass(r.tabActiveClass).children().removeClass(r.tabActiveClass);
|
972 |
+
if (x.hasClass(r.collapsedClass)) {
|
973 |
+
if (z && (!r.cache || !x.parent().data("easytabs").cached)) {
|
974 |
+
q.trigger("easytabs:ajax:beforeSend", [x, y]);
|
975 |
+
y.load(z, function (C, B, D) {
|
976 |
+
x.parent().data("easytabs").cached = true;
|
977 |
+
q.trigger("easytabs:ajax:complete", [x, y, C, B, D])
|
978 |
+
})
|
979 |
+
}
|
980 |
+
x.parent().removeClass(r.collapsedClass).addClass(r.tabActiveClass).children().removeClass(r.collapsedClass).addClass(r.tabActiveClass);
|
981 |
+
y.addClass(r.panelActiveClass)[v.uncollapse](v.speed, r.transitionUncollapseEasing, function () {
|
982 |
+
q.trigger("easytabs:midTransition", [x, y, r]);
|
983 |
+
if (typeof A == "function") {
|
984 |
+
A()
|
985 |
+
}
|
986 |
+
})
|
987 |
+
} else {
|
988 |
+
x.addClass(r.collapsedClass).parent().addClass(r.collapsedClass);
|
989 |
+
y.removeClass(r.panelActiveClass)[v.collapse](v.speed, r.transitionCollapseEasing, function () {
|
990 |
+
q.trigger("easytabs:midTransition", [x, y, r]);
|
991 |
+
if (typeof A == "function") {
|
992 |
+
A()
|
993 |
+
}
|
994 |
+
})
|
995 |
+
}
|
996 |
+
}
|
997 |
+
};
|
998 |
+
f.matchTab = function (x) {
|
999 |
+
return f.tabs.find("[href='" + x + "'],[data-target='" + x + "']").first()
|
1000 |
+
};
|
1001 |
+
f.matchInPanel = function (x) {
|
1002 |
+
return(x && f.validId(x) ? f.panels.filter(":has(" + x + ")").first() : [])
|
1003 |
+
};
|
1004 |
+
f.validId = function (x) {
|
1005 |
+
return x.substr(1).match(/^[A-Za-z]+[A-Za-z0-9\-_:\.].$/)
|
1006 |
+
};
|
1007 |
+
f.selectTabFromHashChange = function () {
|
1008 |
+
var y = window.location.hash.match(/^[^\?]*/)[0], x = f.matchTab(y), z;
|
1009 |
+
if (r.updateHash) {
|
1010 |
+
if (x.length) {
|
1011 |
+
d = true;
|
1012 |
+
f.selectTab(x)
|
1013 |
+
} else {
|
1014 |
+
z = f.matchInPanel(y);
|
1015 |
+
if (z.length) {
|
1016 |
+
y = "#" + z.attr("id");
|
1017 |
+
x = f.matchTab(y);
|
1018 |
+
d = true;
|
1019 |
+
f.selectTab(x)
|
1020 |
+
} else {
|
1021 |
+
if (!h.hasClass(r.tabActiveClass) && !r.cycle) {
|
1022 |
+
if (y === "" || f.matchTab(m).length || q.closest(y).length) {
|
1023 |
+
d = true;
|
1024 |
+
f.selectTab(l)
|
1025 |
+
}
|
1026 |
+
}
|
1027 |
+
}
|
1028 |
+
}
|
1029 |
+
}
|
1030 |
+
};
|
1031 |
+
f.cycleTabs = function (x) {
|
1032 |
+
if (r.cycle) {
|
1033 |
+
x = x % f.tabs.length;
|
1034 |
+
$tab = a(f.tabs[x]).children("a").first();
|
1035 |
+
d = true;
|
1036 |
+
f.selectTab($tab, function () {
|
1037 |
+
setTimeout(function () {
|
1038 |
+
f.cycleTabs(x + 1)
|
1039 |
+
}, r.cycle)
|
1040 |
+
})
|
1041 |
+
}
|
1042 |
+
};
|
1043 |
+
f.publicMethods = {select: function (x) {
|
1044 |
+
var y;
|
1045 |
+
if ((y = f.tabs.filter(x)).length === 0) {
|
1046 |
+
if ((y = f.tabs.find("a[href='" + x + "']")).length === 0) {
|
1047 |
+
if ((y = f.tabs.find("a" + x)).length === 0) {
|
1048 |
+
if ((y = f.tabs.find("[data-target='" + x + "']")).length === 0) {
|
1049 |
+
if ((y = f.tabs.find("a[href$='" + x + "']")).length === 0) {
|
1050 |
+
a.error("Tab '" + x + "' does not exist in tab set")
|
1051 |
+
}
|
1052 |
+
}
|
1053 |
+
}
|
1054 |
+
}
|
1055 |
+
} else {
|
1056 |
+
y = y.children("a").first()
|
1057 |
+
}
|
1058 |
+
f.selectTab(y)
|
1059 |
+
}};
|
1060 |
+
var u = function (A, x, z) {
|
1061 |
+
var y = a.Event(x);
|
1062 |
+
A.trigger(y, z);
|
1063 |
+
return y.result !== false
|
1064 |
+
};
|
1065 |
+
var b = function () {
|
1066 |
+
q.addClass(r.containerClass);
|
1067 |
+
f.tabs.parent().addClass(r.tabsClass);
|
1068 |
+
f.tabs.addClass(r.tabClass);
|
1069 |
+
f.panels.addClass(r.panelClass)
|
1070 |
+
};
|
1071 |
+
var g = function () {
|
1072 |
+
var y = window.location.hash.match(/^[^\?]*/)[0], x = f.matchTab(y).parent(), z;
|
1073 |
+
if (x.length === 1) {
|
1074 |
+
h = x;
|
1075 |
+
r.cycle = false
|
1076 |
+
} else {
|
1077 |
+
z = f.matchInPanel(y);
|
1078 |
+
if (z.length) {
|
1079 |
+
y = "#" + z.attr("id");
|
1080 |
+
h = f.matchTab(y).parent()
|
1081 |
+
} else {
|
1082 |
+
h = f.tabs.parent().find(r.defaultTab);
|
1083 |
+
if (h.length === 0) {
|
1084 |
+
a.error("The specified default tab ('" + r.defaultTab + "') could not be found in the tab set ('" + r.tabs + "') out of " + f.tabs.length + " tabs.")
|
1085 |
+
}
|
1086 |
+
}
|
1087 |
+
}
|
1088 |
+
l = h.children("a").first();
|
1089 |
+
p(x)
|
1090 |
+
};
|
1091 |
+
var p = function (z) {
|
1092 |
+
var y, x;
|
1093 |
+
if (r.collapsible && z.length === 0 && r.collapsedByDefault) {
|
1094 |
+
h.addClass(r.collapsedClass).children().addClass(r.collapsedClass)
|
1095 |
+
} else {
|
1096 |
+
y = a(h.data("easytabs").panel);
|
1097 |
+
x = h.data("easytabs").ajax;
|
1098 |
+
if (x && (!r.cache || !h.data("easytabs").cached)) {
|
1099 |
+
q.trigger("easytabs:ajax:beforeSend", [l, y]);
|
1100 |
+
y.load(x, function (B, A, C) {
|
1101 |
+
h.data("easytabs").cached = true;
|
1102 |
+
q.trigger("easytabs:ajax:complete", [l, y, B, A, C])
|
1103 |
+
})
|
1104 |
+
}
|
1105 |
+
h.data("easytabs").panel.show().addClass(r.panelActiveClass);
|
1106 |
+
h.addClass(r.tabActiveClass).children().addClass(r.tabActiveClass)
|
1107 |
+
}
|
1108 |
+
q.trigger("easytabs:initialised", [l, y])
|
1109 |
+
};
|
1110 |
+
var w = function () {
|
1111 |
+
f.tabs.children("a").bind(r.bind_str, function (x) {
|
1112 |
+
r.cycle = false;
|
1113 |
+
d = false;
|
1114 |
+
f.selectTab(a(this));
|
1115 |
+
x.preventDefault ? x.preventDefault() : x.returnValue = false
|
1116 |
+
})
|
1117 |
+
};
|
1118 |
+
var o = function (z, D, E, H) {
|
1119 |
+
f.panels.stop(true, true);
|
1120 |
+
if (u(q, "easytabs:before", [z, D, r])) {
|
1121 |
+
var A = f.panels.filter(":visible"), y = D.parent(), F, x, C, G, B = window.location.hash.match(/^[^\?]*/)[0];
|
1122 |
+
if (r.animate) {
|
1123 |
+
F = s(D);
|
1124 |
+
x = A.length ? k(A) : 0;
|
1125 |
+
C = F - x
|
1126 |
+
}
|
1127 |
+
m = B;
|
1128 |
+
G = function () {
|
1129 |
+
q.trigger("easytabs:midTransition", [z, D, r]);
|
1130 |
+
if (r.animate && r.transitionIn == "fadeIn") {
|
1131 |
+
if (C < 0) {
|
1132 |
+
y.animate({height: y.height() + C}, v.halfSpeed).css({"min-height": ""})
|
1133 |
+
}
|
1134 |
+
}
|
1135 |
+
if (r.updateHash && !d) {
|
1136 |
+
window.location.hash = "#" + D.attr("id")
|
1137 |
+
} else {
|
1138 |
+
d = false
|
1139 |
+
}
|
1140 |
+
D[v.show](v.speed, r.transitionInEasing, function () {
|
1141 |
+
y.css({height: "", "min-height": ""});
|
1142 |
+
q.trigger("easytabs:after", [z, D, r]);
|
1143 |
+
if (typeof H == "function") {
|
1144 |
+
H()
|
1145 |
+
}
|
1146 |
+
})
|
1147 |
+
};
|
1148 |
+
if (E && (!r.cache || !z.parent().data("easytabs").cached)) {
|
1149 |
+
q.trigger("easytabs:ajax:beforeSend", [z, D]);
|
1150 |
+
D.load(E, function (J, I, K) {
|
1151 |
+
z.parent().data("easytabs").cached = true;
|
1152 |
+
q.trigger("easytabs:ajax:complete", [z, D, J, I, K])
|
1153 |
+
})
|
1154 |
+
}
|
1155 |
+
if (r.animate && r.transitionOut == "fadeOut") {
|
1156 |
+
if (C > 0) {
|
1157 |
+
y.animate({height: (y.height() + C)}, v.halfSpeed)
|
1158 |
+
} else {
|
1159 |
+
y.css({"min-height": y.height()})
|
1160 |
+
}
|
1161 |
+
}
|
1162 |
+
f.tabs.filter("." + r.tabActiveClass).removeClass(r.tabActiveClass).children().removeClass(r.tabActiveClass);
|
1163 |
+
f.tabs.filter("." + r.collapsedClass).removeClass(r.collapsedClass).children().removeClass(r.collapsedClass);
|
1164 |
+
z.parent().addClass(r.tabActiveClass).children().addClass(r.tabActiveClass);
|
1165 |
+
f.panels.filter("." + r.panelActiveClass).removeClass(r.panelActiveClass);
|
1166 |
+
D.addClass(r.panelActiveClass);
|
1167 |
+
if (A.length) {
|
1168 |
+
A[v.hide](v.speed, r.transitionOutEasing, G)
|
1169 |
+
} else {
|
1170 |
+
D[v.uncollapse](v.speed, r.transitionUncollapseEasing, G)
|
1171 |
+
}
|
1172 |
+
}
|
1173 |
+
};
|
1174 |
+
var s = function (z) {
|
1175 |
+
if (z.data("easytabs") && z.data("easytabs").lastHeight) {
|
1176 |
+
return z.data("easytabs").lastHeight
|
1177 |
+
}
|
1178 |
+
var B = z.css("display"), y, x;
|
1179 |
+
try {
|
1180 |
+
y = a("<div></div>", {position: "absolute", visibility: "hidden", overflow: "hidden"})
|
1181 |
+
} catch (A) {
|
1182 |
+
y = a("<div></div>", {visibility: "hidden", overflow: "hidden"})
|
1183 |
+
}
|
1184 |
+
x = z.wrap(y).css({position: "relative", visibility: "hidden", display: "block"}).outerHeight();
|
1185 |
+
z.unwrap();
|
1186 |
+
z.css({position: z.data("easytabs").position, visibility: z.data("easytabs").visibility, display: B});
|
1187 |
+
z.data("easytabs").lastHeight = x;
|
1188 |
+
return x
|
1189 |
+
};
|
1190 |
+
var k = function (y) {
|
1191 |
+
var x = y.outerHeight();
|
1192 |
+
if (y.data("easytabs")) {
|
1193 |
+
y.data("easytabs").lastHeight = x
|
1194 |
+
} else {
|
1195 |
+
y.data("easytabs", {lastHeight: x})
|
1196 |
+
}
|
1197 |
+
return x
|
1198 |
+
};
|
1199 |
+
var n = function () {
|
1200 |
+
if (typeof a(window).hashchange === "function") {
|
1201 |
+
a(window).hashchange(function () {
|
1202 |
+
f.selectTabFromHashChange()
|
1203 |
+
})
|
1204 |
+
} else {
|
1205 |
+
if (a.address && typeof a.address.change === "function") {
|
1206 |
+
a.address.change(function () {
|
1207 |
+
f.selectTabFromHashChange()
|
1208 |
+
})
|
1209 |
+
}
|
1210 |
+
}
|
1211 |
+
};
|
1212 |
+
var c = function () {
|
1213 |
+
var x;
|
1214 |
+
if (r.cycle) {
|
1215 |
+
x = f.tabs.index(h);
|
1216 |
+
setTimeout(function () {
|
1217 |
+
f.cycleTabs(x + 1)
|
1218 |
+
}, r.cycle)
|
1219 |
+
}
|
1220 |
+
};
|
1221 |
+
f.init()
|
1222 |
+
};
|
1223 |
+
a.fn.easytabs = function (c) {
|
1224 |
+
var b = arguments;
|
1225 |
+
return this.each(function () {
|
1226 |
+
var e = a(this), d = e.data("easytabs");
|
1227 |
+
if (undefined === d) {
|
1228 |
+
d = new a.easytabs(this, c);
|
1229 |
+
e.data("easytabs", d)
|
1230 |
+
}
|
1231 |
+
if (d.publicMethods[c]) {
|
1232 |
+
return d.publicMethods[c](Array.prototype.slice.call(b, 1))
|
1233 |
+
}
|
1234 |
+
})
|
1235 |
+
}
|
1236 |
+
})(jQuery);
|
1237 |
+
|
1238 |
+
|
1239 |
+
/*
|
1240 |
+
colpick Color Picker
|
1241 |
+
Copyright 2013 Jose Vargas. Licensed under GPL license. Based on Stefan Petre's Color Picker www.eyecon.ro, dual licensed under the MIT and GPL licenses
|
1242 |
+
|
1243 |
+
For usage and examples: colpick.com/plugin
|
1244 |
+
*/
|
1245 |
+
|
1246 |
+
(function ($) {
|
1247 |
+
var colpick = function () {
|
1248 |
+
var
|
1249 |
+
tpl = '<div class="colpick"><div class="colpick_color"><div class="colpick_color_overlay1"><div class="colpick_color_overlay2"><div class="colpick_selector_outer"><div class="colpick_selector_inner"></div></div></div></div></div><div class="colpick_hue"><div class="colpick_hue_arrs"><div class="colpick_hue_larr"></div><div class="colpick_hue_rarr"></div></div></div><div class="colpick_new_color"></div><div class="colpick_current_color"></div><div class="colpick_hex_field"><div class="colpick_field_letter">#</div><input type="text" maxlength="6" size="6" /></div><div class="colpick_rgb_r colpick_field"><div class="colpick_field_letter">R</div><input type="text" maxlength="3" size="3" /><div class="colpick_field_arrs"><div class="colpick_field_uarr"></div><div class="colpick_field_darr"></div></div></div><div class="colpick_rgb_g colpick_field"><div class="colpick_field_letter">G</div><input type="text" maxlength="3" size="3" /><div class="colpick_field_arrs"><div class="colpick_field_uarr"></div><div class="colpick_field_darr"></div></div></div><div class="colpick_rgb_b colpick_field"><div class="colpick_field_letter">B</div><input type="text" maxlength="3" size="3" /><div class="colpick_field_arrs"><div class="colpick_field_uarr"></div><div class="colpick_field_darr"></div></div></div><div class="colpick_hsb_h colpick_field"><div class="colpick_field_letter">H</div><input type="text" maxlength="3" size="3" /><div class="colpick_field_arrs"><div class="colpick_field_uarr"></div><div class="colpick_field_darr"></div></div></div><div class="colpick_hsb_s colpick_field"><div class="colpick_field_letter">S</div><input type="text" maxlength="3" size="3" /><div class="colpick_field_arrs"><div class="colpick_field_uarr"></div><div class="colpick_field_darr"></div></div></div><div class="colpick_hsb_b colpick_field"><div class="colpick_field_letter">B</div><input type="text" maxlength="3" size="3" /><div class="colpick_field_arrs"><div class="colpick_field_uarr"></div><div class="colpick_field_darr"></div></div></div><div class="colpick_submit"></div></div>',
|
1250 |
+
defaults = {
|
1251 |
+
showEvent: 'click',
|
1252 |
+
onShow: function () {
|
1253 |
+
},
|
1254 |
+
onBeforeShow: function () {
|
1255 |
+
},
|
1256 |
+
onHide: function () {
|
1257 |
+
},
|
1258 |
+
onChange: function () {
|
1259 |
+
},
|
1260 |
+
onSubmit: function () {
|
1261 |
+
},
|
1262 |
+
colorScheme: 'light',
|
1263 |
+
color: '3289c7',
|
1264 |
+
livePreview: true,
|
1265 |
+
flat: false,
|
1266 |
+
layout: 'full',
|
1267 |
+
submit: 1,
|
1268 |
+
submitText: 'OK',
|
1269 |
+
height: 156
|
1270 |
+
},
|
1271 |
+
//Fill the inputs of the plugin
|
1272 |
+
fillRGBFields = function (hsb, cal) {
|
1273 |
+
var rgb = hsbToRgb(hsb);
|
1274 |
+
$(cal).data('colpick').fields
|
1275 |
+
.eq(1).val(rgb.r).end()
|
1276 |
+
.eq(2).val(rgb.g).end()
|
1277 |
+
.eq(3).val(rgb.b).end();
|
1278 |
+
},
|
1279 |
+
fillHSBFields = function (hsb, cal) {
|
1280 |
+
$(cal).data('colpick').fields
|
1281 |
+
.eq(4).val(Math.round(hsb.h)).end()
|
1282 |
+
.eq(5).val(Math.round(hsb.s)).end()
|
1283 |
+
.eq(6).val(Math.round(hsb.b)).end();
|
1284 |
+
},
|
1285 |
+
fillHexFields = function (hsb, cal) {
|
1286 |
+
$(cal).data('colpick').fields.eq(0).val(hsbToHex(hsb));
|
1287 |
+
},
|
1288 |
+
//Set the round selector position
|
1289 |
+
setSelector = function (hsb, cal) {
|
1290 |
+
$(cal).data('colpick').selector.css('backgroundColor', '#' + hsbToHex({h: hsb.h, s: 100, b: 100}));
|
1291 |
+
$(cal).data('colpick').selectorIndic.css({
|
1292 |
+
left: parseInt($(cal).data('colpick').height * hsb.s / 100, 10),
|
1293 |
+
top: parseInt($(cal).data('colpick').height * (100 - hsb.b) / 100, 10)
|
1294 |
+
});
|
1295 |
+
},
|
1296 |
+
//Set the hue selector position
|
1297 |
+
setHue = function (hsb, cal) {
|
1298 |
+
$(cal).data('colpick').hue.css('top', parseInt($(cal).data('colpick').height - $(cal).data('colpick').height * hsb.h / 360, 10));
|
1299 |
+
},
|
1300 |
+
//Set current and new colors
|
1301 |
+
setCurrentColor = function (hsb, cal) {
|
1302 |
+
$(cal).data('colpick').currentColor.css('backgroundColor', '#' + hsbToHex(hsb));
|
1303 |
+
},
|
1304 |
+
setNewColor = function (hsb, cal) {
|
1305 |
+
$(cal).data('colpick').newColor.css('backgroundColor', '#' + hsbToHex(hsb));
|
1306 |
+
},
|
1307 |
+
//Called when the new color is changed
|
1308 |
+
change = function (ev) {
|
1309 |
+
var cal = $(this).parent().parent(), col;
|
1310 |
+
if (this.parentNode.className.indexOf('_hex') > 0) {
|
1311 |
+
cal.data('colpick').color = col = hexToHsb(fixHex(this.value));
|
1312 |
+
fillRGBFields(col, cal.get(0));
|
1313 |
+
fillHSBFields(col, cal.get(0));
|
1314 |
+
} else if (this.parentNode.className.indexOf('_hsb') > 0) {
|
1315 |
+
cal.data('colpick').color = col = fixHSB({
|
1316 |
+
h: parseInt(cal.data('colpick').fields.eq(4).val(), 10),
|
1317 |
+
s: parseInt(cal.data('colpick').fields.eq(5).val(), 10),
|
1318 |
+
b: parseInt(cal.data('colpick').fields.eq(6).val(), 10)
|
1319 |
+
});
|
1320 |
+
fillRGBFields(col, cal.get(0));
|
1321 |
+
fillHexFields(col, cal.get(0));
|
1322 |
+
} else {
|
1323 |
+
cal.data('colpick').color = col = rgbToHsb(fixRGB({
|
1324 |
+
r: parseInt(cal.data('colpick').fields.eq(1).val(), 10),
|
1325 |
+
g: parseInt(cal.data('colpick').fields.eq(2).val(), 10),
|
1326 |
+
b: parseInt(cal.data('colpick').fields.eq(3).val(), 10)
|
1327 |
+
}));
|
1328 |
+
fillHexFields(col, cal.get(0));
|
1329 |
+
fillHSBFields(col, cal.get(0));
|
1330 |
+
}
|
1331 |
+
setSelector(col, cal.get(0));
|
1332 |
+
setHue(col, cal.get(0));
|
1333 |
+
setNewColor(col, cal.get(0));
|
1334 |
+
cal.data('colpick').onChange.apply(cal.parent(), [col, hsbToHex(col), hsbToRgb(col), cal.data('colpick').el, 0]);
|
1335 |
+
},
|
1336 |
+
//Change style on blur and on focus of inputs
|
1337 |
+
blur = function (ev) {
|
1338 |
+
$(this).parent().removeClass('colpick_focus');
|
1339 |
+
},
|
1340 |
+
focus = function () {
|
1341 |
+
$(this).parent().parent().data('colpick').fields.parent().removeClass('colpick_focus');
|
1342 |
+
$(this).parent().addClass('colpick_focus');
|
1343 |
+
},
|
1344 |
+
//Increment/decrement arrows functions
|
1345 |
+
downIncrement = function (ev) {
|
1346 |
+
ev.preventDefault ? ev.preventDefault() : ev.returnValue = false;
|
1347 |
+
var field = $(this).parent().find('input').focus();
|
1348 |
+
var current = {
|
1349 |
+
el: $(this).parent().addClass('colpick_slider'),
|
1350 |
+
max: this.parentNode.className.indexOf('_hsb_h') > 0 ? 360 : (this.parentNode.className.indexOf('_hsb') > 0 ? 100 : 255),
|
1351 |
+
y: ev.pageY,
|
1352 |
+
field: field,
|
1353 |
+
val: parseInt(field.val(), 10),
|
1354 |
+
preview: $(this).parent().parent().data('colpick').livePreview
|
1355 |
+
};
|
1356 |
+
$(document).mouseup(current, upIncrement);
|
1357 |
+
$(document).mousemove(current, moveIncrement);
|
1358 |
+
},
|
1359 |
+
moveIncrement = function (ev) {
|
1360 |
+
ev.data.field.val(Math.max(0, Math.min(ev.data.max, parseInt(ev.data.val - ev.pageY + ev.data.y, 10))));
|
1361 |
+
if (ev.data.preview) {
|
1362 |
+
change.apply(ev.data.field.get(0), [true]);
|
1363 |
+
}
|
1364 |
+
return false;
|
1365 |
+
},
|
1366 |
+
upIncrement = function (ev) {
|
1367 |
+
change.apply(ev.data.field.get(0), [true]);
|
1368 |
+
ev.data.el.removeClass('colpick_slider').find('input').focus();
|
1369 |
+
$(document).off('mouseup', upIncrement);
|
1370 |
+
$(document).off('mousemove', moveIncrement);
|
1371 |
+
return false;
|
1372 |
+
},
|
1373 |
+
//Hue slider functions
|
1374 |
+
downHue = function (ev) {
|
1375 |
+
ev.preventDefault ? ev.preventDefault() : ev.returnValue = false;
|
1376 |
+
var current = {
|
1377 |
+
cal: $(this).parent(),
|
1378 |
+
y: $(this).offset().top
|
1379 |
+
};
|
1380 |
+
$(document).on('mouseup touchend', current, upHue);
|
1381 |
+
$(document).on('mousemove touchmove', current, moveHue);
|
1382 |
+
|
1383 |
+
var pageY = ((ev.type == 'touchstart') ? ev.originalEvent.changedTouches[0].pageY : ev.pageY);
|
1384 |
+
change.apply(
|
1385 |
+
current.cal.data('colpick')
|
1386 |
+
.fields.eq(4).val(parseInt(360 * (current.cal.data('colpick').height - (pageY - current.y)) / current.cal.data('colpick').height, 10))
|
1387 |
+
.get(0),
|
1388 |
+
[current.cal.data('colpick').livePreview]
|
1389 |
+
);
|
1390 |
+
return false;
|
1391 |
+
},
|
1392 |
+
moveHue = function (ev) {
|
1393 |
+
var pageY = ((ev.type == 'touchmove') ? ev.originalEvent.changedTouches[0].pageY : ev.pageY);
|
1394 |
+
change.apply(
|
1395 |
+
ev.data.cal.data('colpick')
|
1396 |
+
.fields.eq(4).val(parseInt(360 * (ev.data.cal.data('colpick').height - Math.max(0, Math.min(ev.data.cal.data('colpick').height, (pageY - ev.data.y)))) / ev.data.cal.data('colpick').height, 10))
|
1397 |
+
.get(0),
|
1398 |
+
[ev.data.preview]
|
1399 |
+
);
|
1400 |
+
return false;
|
1401 |
+
},
|
1402 |
+
upHue = function (ev) {
|
1403 |
+
fillRGBFields(ev.data.cal.data('colpick').color, ev.data.cal.get(0));
|
1404 |
+
fillHexFields(ev.data.cal.data('colpick').color, ev.data.cal.get(0));
|
1405 |
+
$(document).off('mouseup touchend', upHue);
|
1406 |
+
$(document).off('mousemove touchmove', moveHue);
|
1407 |
+
return false;
|
1408 |
+
},
|
1409 |
+
//Color selector functions
|
1410 |
+
downSelector = function (ev) {
|
1411 |
+
ev.preventDefault ? ev.preventDefault() : ev.returnValue = false;
|
1412 |
+
var current = {
|
1413 |
+
cal: $(this).parent(),
|
1414 |
+
pos: $(this).offset()
|
1415 |
+
};
|
1416 |
+
current.preview = current.cal.data('colpick').livePreview;
|
1417 |
+
|
1418 |
+
$(document).on('mouseup touchend', current, upSelector);
|
1419 |
+
$(document).on('mousemove touchmove', current, moveSelector);
|
1420 |
+
|
1421 |
+
var payeX, pageY;
|
1422 |
+
if (ev.type == 'touchstart') {
|
1423 |
+
pageX = ev.originalEvent.changedTouches[0].pageX,
|
1424 |
+
pageY = ev.originalEvent.changedTouches[0].pageY;
|
1425 |
+
} else {
|
1426 |
+
pageX = ev.pageX;
|
1427 |
+
pageY = ev.pageY;
|
1428 |
+
}
|
1429 |
+
|
1430 |
+
change.apply(
|
1431 |
+
current.cal.data('colpick').fields
|
1432 |
+
.eq(6).val(parseInt(100 * (current.cal.data('colpick').height - (pageY - current.pos.top)) / current.cal.data('colpick').height, 10)).end()
|
1433 |
+
.eq(5).val(parseInt(100 * (pageX - current.pos.left) / current.cal.data('colpick').height, 10))
|
1434 |
+
.get(0),
|
1435 |
+
[current.preview]
|
1436 |
+
);
|
1437 |
+
return false;
|
1438 |
+
},
|
1439 |
+
moveSelector = function (ev) {
|
1440 |
+
var payeX, pageY;
|
1441 |
+
if (ev.type == 'touchmove') {
|
1442 |
+
pageX = ev.originalEvent.changedTouches[0].pageX,
|
1443 |
+
pageY = ev.originalEvent.changedTouches[0].pageY;
|
1444 |
+
} else {
|
1445 |
+
pageX = ev.pageX;
|
1446 |
+
pageY = ev.pageY;
|
1447 |
+
}
|
1448 |
+
|
1449 |
+
change.apply(
|
1450 |
+
ev.data.cal.data('colpick').fields
|
1451 |
+
.eq(6).val(parseInt(100 * (ev.data.cal.data('colpick').height - Math.max(0, Math.min(ev.data.cal.data('colpick').height, (pageY - ev.data.pos.top)))) / ev.data.cal.data('colpick').height, 10)).end()
|
1452 |
+
.eq(5).val(parseInt(100 * (Math.max(0, Math.min(ev.data.cal.data('colpick').height, (pageX - ev.data.pos.left)))) / ev.data.cal.data('colpick').height, 10))
|
1453 |
+
.get(0),
|
1454 |
+
[ev.data.preview]
|
1455 |
+
);
|
1456 |
+
return false;
|
1457 |
+
},
|
1458 |
+
upSelector = function (ev) {
|
1459 |
+
fillRGBFields(ev.data.cal.data('colpick').color, ev.data.cal.get(0));
|
1460 |
+
fillHexFields(ev.data.cal.data('colpick').color, ev.data.cal.get(0));
|
1461 |
+
$(document).off('mouseup touchend', upSelector);
|
1462 |
+
$(document).off('mousemove touchmove', moveSelector);
|
1463 |
+
return false;
|
1464 |
+
},
|
1465 |
+
//Submit button
|
1466 |
+
clickSubmit = function (ev) {
|
1467 |
+
var cal = $(this).parent();
|
1468 |
+
var col = cal.data('colpick').color;
|
1469 |
+
cal.data('colpick').origColor = col;
|
1470 |
+
setCurrentColor(col, cal.get(0));
|
1471 |
+
cal.data('colpick').onSubmit(col, hsbToHex(col), hsbToRgb(col), cal.data('colpick').el);
|
1472 |
+
},
|
1473 |
+
//Show/hide the color picker
|
1474 |
+
show = function (ev) {
|
1475 |
+
// Prevent the trigger of any direct parent
|
1476 |
+
ev.stopPropagation();
|
1477 |
+
var cal = $('#' + $(this).data('colpickId'));
|
1478 |
+
cal.data('colpick').onBeforeShow.apply(this, [cal.get(0)]);
|
1479 |
+
var pos = $(this).offset();
|
1480 |
+
var top = pos.top + this.offsetHeight;
|
1481 |
+
var left = pos.left;
|
1482 |
+
var viewPort = getViewport();
|
1483 |
+
var calW = cal.width();
|
1484 |
+
if (left + calW > viewPort.l + viewPort.w) {
|
1485 |
+
left -= calW;
|
1486 |
+
}
|
1487 |
+
cal.css({left: left + 'px', top: top + 'px'});
|
1488 |
+
if (cal.data('colpick').onShow.apply(this, [cal.get(0)]) != false) {
|
1489 |
+
cal.show();
|
1490 |
+
}
|
1491 |
+
//Hide when user clicks outside
|
1492 |
+
$('html').mousedown({cal: cal}, hide);
|
1493 |
+
cal.mousedown(function (ev) {
|
1494 |
+
ev.stopPropagation();
|
1495 |
+
})
|
1496 |
+
},
|
1497 |
+
hide = function (ev) {
|
1498 |
+
if (ev.data.cal.data('colpick').onHide.apply(this, [ev.data.cal.get(0)]) != false) {
|
1499 |
+
ev.data.cal.hide();
|
1500 |
+
}
|
1501 |
+
$('html').off('mousedown', hide);
|
1502 |
+
},
|
1503 |
+
getViewport = function () {
|
1504 |
+
var m = document.compatMode == 'CSS1Compat';
|
1505 |
+
return {
|
1506 |
+
l: window.pageXOffset || (m ? document.documentElement.scrollLeft : document.body.scrollLeft),
|
1507 |
+
w: window.innerWidth || (m ? document.documentElement.clientWidth : document.body.clientWidth)
|
1508 |
+
};
|
1509 |
+
},
|
1510 |
+
//Fix the values if the user enters a negative or high value
|
1511 |
+
fixHSB = function (hsb) {
|
1512 |
+
return {
|
1513 |
+
h: Math.min(360, Math.max(0, hsb.h)),
|
1514 |
+
s: Math.min(100, Math.max(0, hsb.s)),
|
1515 |
+
b: Math.min(100, Math.max(0, hsb.b))
|
1516 |
+
};
|
1517 |
+
},
|
1518 |
+
fixRGB = function (rgb) {
|
1519 |
+
return {
|
1520 |
+
r: Math.min(255, Math.max(0, rgb.r)),
|
1521 |
+
g: Math.min(255, Math.max(0, rgb.g)),
|
1522 |
+
b: Math.min(255, Math.max(0, rgb.b))
|
1523 |
+
};
|
1524 |
+
},
|
1525 |
+
fixHex = function (hex) {
|
1526 |
+
var len = 6 - hex.length;
|
1527 |
+
if (len > 0) {
|
1528 |
+
var o = [];
|
1529 |
+
for (var i = 0; i < len; i++) {
|
1530 |
+
o.push('0');
|
1531 |
+
}
|
1532 |
+
o.push(hex);
|
1533 |
+
hex = o.join('');
|
1534 |
+
}
|
1535 |
+
return hex;
|
1536 |
+
},
|
1537 |
+
restoreOriginal = function () {
|
1538 |
+
var cal = $(this).parent();
|
1539 |
+
var col = cal.data('colpick').origColor;
|
1540 |
+
cal.data('colpick').color = col;
|
1541 |
+
fillRGBFields(col, cal.get(0));
|
1542 |
+
fillHexFields(col, cal.get(0));
|
1543 |
+
fillHSBFields(col, cal.get(0));
|
1544 |
+
setSelector(col, cal.get(0));
|
1545 |
+
setHue(col, cal.get(0));
|
1546 |
+
setNewColor(col, cal.get(0));
|
1547 |
+
};
|
1548 |
+
return {
|
1549 |
+
init: function (opt) {
|
1550 |
+
opt = $.extend({}, defaults, opt || {});
|
1551 |
+
//Set color
|
1552 |
+
if (typeof opt.color == 'string') {
|
1553 |
+
opt.color = hexToHsb(opt.color);
|
1554 |
+
} else if (opt.color.r != undefined && opt.color.g != undefined && opt.color.b != undefined) {
|
1555 |
+
opt.color = rgbToHsb(opt.color);
|
1556 |
+
} else if (opt.color.h != undefined && opt.color.s != undefined && opt.color.b != undefined) {
|
1557 |
+
opt.color = fixHSB(opt.color);
|
1558 |
+
} else {
|
1559 |
+
return this;
|
1560 |
+
}
|
1561 |
+
|
1562 |
+
//For each selected DOM element
|
1563 |
+
return this.each(function () {
|
1564 |
+
//If the element does not have an ID
|
1565 |
+
if (!$(this).data('colpickId')) {
|
1566 |
+
var options = $.extend({}, opt);
|
1567 |
+
options.origColor = opt.color;
|
1568 |
+
//Generate and assign a random ID
|
1569 |
+
var id = 'collorpicker_' + parseInt(Math.random() * 1000);
|
1570 |
+
$(this).data('colpickId', id);
|
1571 |
+
//Set the tpl's ID and get the HTML
|
1572 |
+
var cal = $(tpl).attr('id', id);
|
1573 |
+
//Add class according to layout
|
1574 |
+
cal.addClass('colpick_' + options.layout + (options.submit ? '' : ' colpick_' + options.layout + '_ns'));
|
1575 |
+
//Add class if the color scheme is not default
|
1576 |
+
if (options.colorScheme != 'light') {
|
1577 |
+
cal.addClass('colpick_' + options.colorScheme);
|
1578 |
+
}
|
1579 |
+
//Setup submit button
|
1580 |
+
cal.find('div.colpick_submit').html(options.submitText).click(clickSubmit);
|
1581 |
+
//Setup input fields
|
1582 |
+
options.fields = cal.find('input').change(change).blur(blur).focus(focus);
|
1583 |
+
cal.find('div.colpick_field_arrs').mousedown(downIncrement).end().find('div.colpick_current_color').click(restoreOriginal);
|
1584 |
+
//Setup hue selector
|
1585 |
+
options.selector = cal.find('div.colpick_color').on('mousedown touchstart', downSelector);
|
1586 |
+
options.selectorIndic = options.selector.find('div.colpick_selector_outer');
|
1587 |
+
//Store parts of the plugin
|
1588 |
+
options.el = this;
|
1589 |
+
options.hue = cal.find('div.colpick_hue_arrs');
|
1590 |
+
huebar = options.hue.parent();
|
1591 |
+
//Paint the hue bar
|
1592 |
+
var UA = navigator.userAgent.toLowerCase();
|
1593 |
+
var isIE = navigator.appName === 'Microsoft Internet Explorer';
|
1594 |
+
var IEver = isIE ? parseFloat(UA.match(/msie ([0-9]{1,}[\.0-9]{0,})/)[1]) : 0;
|
1595 |
+
var ngIE = (isIE && IEver < 10);
|
1596 |
+
var stops = ['#ff0000', '#ff0080', '#ff00ff', '#8000ff', '#0000ff', '#0080ff', '#00ffff', '#00ff80', '#00ff00', '#80ff00', '#ffff00', '#ff8000', '#ff0000'];
|
1597 |
+
if (ngIE) {
|
1598 |
+
var i, div;
|
1599 |
+
for (i = 0; i <= 11; i++) {
|
1600 |
+
div = $('<div></div>').attr('style', 'height:8.333333%; filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=' + stops[i] + ', endColorstr=' + stops[i + 1] + '); -ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=' + stops[i] + ', endColorstr=' + stops[i + 1] + ')";');
|
1601 |
+
huebar.append(div);
|
1602 |
+
}
|
1603 |
+
} else {
|
1604 |
+
stopList = stops.join(',');
|
1605 |
+
huebar.attr('style', 'background:-webkit-linear-gradient(top,' + stopList + '); background: -o-linear-gradient(top,' + stopList + '); background: -ms-linear-gradient(top,' + stopList + '); background:-moz-linear-gradient(top,' + stopList + '); -webkit-linear-gradient(top,' + stopList + '); background:linear-gradient(to bottom,' + stopList + '); ');
|
1606 |
+
}
|
1607 |
+
cal.find('div.colpick_hue').on('mousedown touchstart', downHue);
|
1608 |
+
options.newColor = cal.find('div.colpick_new_color');
|
1609 |
+
options.currentColor = cal.find('div.colpick_current_color');
|
1610 |
+
//Store options and fill with default color
|
1611 |
+
cal.data('colpick', options);
|
1612 |
+
fillRGBFields(options.color, cal.get(0));
|
1613 |
+
fillHSBFields(options.color, cal.get(0));
|
1614 |
+
fillHexFields(options.color, cal.get(0));
|
1615 |
+
setHue(options.color, cal.get(0));
|
1616 |
+
setSelector(options.color, cal.get(0));
|
1617 |
+
setCurrentColor(options.color, cal.get(0));
|
1618 |
+
setNewColor(options.color, cal.get(0));
|
1619 |
+
//Append to body if flat=false, else show in place
|
1620 |
+
if (options.flat) {
|
1621 |
+
cal.appendTo(this).show();
|
1622 |
+
cal.css({
|
1623 |
+
position: 'relative',
|
1624 |
+
display: 'block'
|
1625 |
+
});
|
1626 |
+
} else {
|
1627 |
+
cal.appendTo(document.body);
|
1628 |
+
$(this).on(options.showEvent, show);
|
1629 |
+
cal.css({
|
1630 |
+
position: 'absolute'
|
1631 |
+
});
|
1632 |
+
}
|
1633 |
+
}
|
1634 |
+
});
|
1635 |
+
},
|
1636 |
+
//Shows the picker
|
1637 |
+
showPicker: function () {
|
1638 |
+
return this.each(function () {
|
1639 |
+
if ($(this).data('colpickId')) {
|
1640 |
+
show.apply(this);
|
1641 |
+
}
|
1642 |
+
});
|
1643 |
+
},
|
1644 |
+
//Hides the picker
|
1645 |
+
hidePicker: function () {
|
1646 |
+
return this.each(function () {
|
1647 |
+
if ($(this).data('colpickId')) {
|
1648 |
+
$('#' + $(this).data('colpickId')).hide();
|
1649 |
+
}
|
1650 |
+
});
|
1651 |
+
},
|
1652 |
+
//Sets a color as new and current (default)
|
1653 |
+
setColor: function (col, setCurrent) {
|
1654 |
+
setCurrent = (typeof setCurrent === "undefined") ? 1 : setCurrent;
|
1655 |
+
if (typeof col == 'string') {
|
1656 |
+
col = hexToHsb(col);
|
1657 |
+
} else if (col.r != undefined && col.g != undefined && col.b != undefined) {
|
1658 |
+
col = rgbToHsb(col);
|
1659 |
+
} else if (col.h != undefined && col.s != undefined && col.b != undefined) {
|
1660 |
+
col = fixHSB(col);
|
1661 |
+
} else {
|
1662 |
+
return this;
|
1663 |
+
}
|
1664 |
+
return this.each(function () {
|
1665 |
+
if ($(this).data('colpickId')) {
|
1666 |
+
var cal = $('#' + $(this).data('colpickId'));
|
1667 |
+
cal.data('colpick').color = col;
|
1668 |
+
cal.data('colpick').origColor = col;
|
1669 |
+
fillRGBFields(col, cal.get(0));
|
1670 |
+
fillHSBFields(col, cal.get(0));
|
1671 |
+
fillHexFields(col, cal.get(0));
|
1672 |
+
setHue(col, cal.get(0));
|
1673 |
+
setSelector(col, cal.get(0));
|
1674 |
+
|
1675 |
+
setNewColor(col, cal.get(0));
|
1676 |
+
cal.data('colpick').onChange.apply(cal.parent(), [col, hsbToHex(col), hsbToRgb(col), cal.data('colpick').el, 1]);
|
1677 |
+
if (setCurrent) {
|
1678 |
+
setCurrentColor(col, cal.get(0));
|
1679 |
+
}
|
1680 |
+
}
|
1681 |
+
});
|
1682 |
+
}
|
1683 |
+
};
|
1684 |
+
}();
|
1685 |
+
//Color space convertions
|
1686 |
+
var hexToRgb = function (hex) {
|
1687 |
+
var hex = parseInt(((hex.indexOf('#') > -1) ? hex.substring(1) : hex), 16);
|
1688 |
+
return {r: hex >> 16, g: (hex & 0x00FF00) >> 8, b: (hex & 0x0000FF)};
|
1689 |
+
};
|
1690 |
+
var hexToHsb = function (hex) {
|
1691 |
+
return rgbToHsb(hexToRgb(hex));
|
1692 |
+
};
|
1693 |
+
var rgbToHsb = function (rgb) {
|
1694 |
+
var hsb = {h: 0, s: 0, b: 0};
|
1695 |
+
var min = Math.min(rgb.r, rgb.g, rgb.b);
|
1696 |
+
var max = Math.max(rgb.r, rgb.g, rgb.b);
|
1697 |
+
var delta = max - min;
|
1698 |
+
hsb.b = max;
|
1699 |
+
hsb.s = max != 0 ? 255 * delta / max : 0;
|
1700 |
+
if (hsb.s != 0) {
|
1701 |
+
if (rgb.r == max)
|
1702 |
+
hsb.h = (rgb.g - rgb.b) / delta;
|
1703 |
+
else if (rgb.g == max)
|
1704 |
+
hsb.h = 2 + (rgb.b - rgb.r) / delta;
|
1705 |
+
else
|
1706 |
+
hsb.h = 4 + (rgb.r - rgb.g) / delta;
|
1707 |
+
} else
|
1708 |
+
hsb.h = -1;
|
1709 |
+
hsb.h *= 60;
|
1710 |
+
if (hsb.h < 0)
|
1711 |
+
hsb.h += 360;
|
1712 |
+
hsb.s *= 100 / 255;
|
1713 |
+
hsb.b *= 100 / 255;
|
1714 |
+
return hsb;
|
1715 |
+
};
|
1716 |
+
var hsbToRgb = function (hsb) {
|
1717 |
+
var rgb = {};
|
1718 |
+
var h = hsb.h;
|
1719 |
+
var s = hsb.s * 255 / 100;
|
1720 |
+
var v = hsb.b * 255 / 100;
|
1721 |
+
if (s == 0) {
|
1722 |
+
rgb.r = rgb.g = rgb.b = v;
|
1723 |
+
} else {
|
1724 |
+
var t1 = v;
|
1725 |
+
var t2 = (255 - s) * v / 255;
|
1726 |
+
var t3 = (t1 - t2) * (h % 60) / 60;
|
1727 |
+
if (h == 360)
|
1728 |
+
h = 0;
|
1729 |
+
if (h < 60) {
|
1730 |
+
rgb.r = t1;
|
1731 |
+
rgb.b = t2;
|
1732 |
+
rgb.g = t2 + t3
|
1733 |
+
} else if (h < 120) {
|
1734 |
+
rgb.g = t1;
|
1735 |
+
rgb.b = t2;
|
1736 |
+
rgb.r = t1 - t3
|
1737 |
+
} else if (h < 180) {
|
1738 |
+
rgb.g = t1;
|
1739 |
+
rgb.r = t2;
|
1740 |
+
rgb.b = t2 + t3
|
1741 |
+
} else if (h < 240) {
|
1742 |
+
rgb.b = t1;
|
1743 |
+
rgb.r = t2;
|
1744 |
+
rgb.g = t1 - t3
|
1745 |
+
} else if (h < 300) {
|
1746 |
+
rgb.b = t1;
|
1747 |
+
rgb.g = t2;
|
1748 |
+
rgb.r = t2 + t3
|
1749 |
+
} else if (h < 360) {
|
1750 |
+
rgb.r = t1;
|
1751 |
+
rgb.g = t2;
|
1752 |
+
rgb.b = t1 - t3
|
1753 |
+
} else {
|
1754 |
+
rgb.r = 0;
|
1755 |
+
rgb.g = 0;
|
1756 |
+
rgb.b = 0
|
1757 |
+
}
|
1758 |
+
}
|
1759 |
+
return {r: Math.round(rgb.r), g: Math.round(rgb.g), b: Math.round(rgb.b)};
|
1760 |
+
};
|
1761 |
+
var rgbToHex = function (rgb) {
|
1762 |
+
var hex = [
|
1763 |
+
rgb.r.toString(16),
|
1764 |
+
rgb.g.toString(16),
|
1765 |
+
rgb.b.toString(16)
|
1766 |
+
];
|
1767 |
+
$.each(hex, function (nr, val) {
|
1768 |
+
if (val.length == 1) {
|
1769 |
+
hex[nr] = '0' + val;
|
1770 |
+
}
|
1771 |
+
});
|
1772 |
+
return hex.join('');
|
1773 |
+
};
|
1774 |
+
var hsbToHex = function (hsb) {
|
1775 |
+
return rgbToHex(hsbToRgb(hsb));
|
1776 |
+
};
|
1777 |
+
$.fn.extend({
|
1778 |
+
colpick: colpick.init,
|
1779 |
+
colpickHide: colpick.hidePicker,
|
1780 |
+
colpickShow: colpick.showPicker,
|
1781 |
+
colpickSetColor: colpick.setColor
|
1782 |
+
});
|
1783 |
+
$.extend({
|
1784 |
+
colpick: {
|
1785 |
+
rgbToHex: rgbToHex,
|
1786 |
+
rgbToHsb: rgbToHsb,
|
1787 |
+
hsbToHex: hsbToHex,
|
1788 |
+
hsbToRgb: hsbToRgb,
|
1789 |
+
hexToHsb: hexToHsb,
|
1790 |
+
hexToRgb: hexToRgb
|
1791 |
+
}
|
1792 |
+
});
|
1793 |
})(jQuery);
|
assets/js/quads-admin.min.js
CHANGED
@@ -2,6 +2,194 @@ var strict;
|
|
2 |
|
3 |
|
4 |
jQuery(document).ready(function ($) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
/**
|
7 |
* General Tab
|
@@ -28,7 +216,13 @@ jQuery(document).ready(function ($) {
|
|
28 |
*/
|
29 |
// Check if submit button is visible than stick it to the bottom of the page
|
30 |
$(window).scroll(function() {
|
|
|
31 |
var elem = '#quads_tab_container .submit';
|
|
|
|
|
|
|
|
|
|
|
32 |
var top_of_element = $(elem).offset().top;
|
33 |
var bottom_of_element = $(elem).offset().top + $(elem).outerHeight(false);
|
34 |
var bottom_of_screen = $(window).scrollTop() + $(window).height();
|
@@ -42,9 +236,11 @@ jQuery(document).ready(function ($) {
|
|
42 |
});
|
43 |
|
44 |
// Activate chosen select boxes
|
45 |
-
$(".quads-chosen-select").chosen({
|
46 |
-
inherit_select_classes: true
|
47 |
-
});
|
|
|
|
|
48 |
|
49 |
// Hid or show AMP code form on click on amp checkbox
|
50 |
$('.quads-activate-amp').click(function(){
|
2 |
|
3 |
|
4 |
jQuery(document).ready(function ($) {
|
5 |
+
|
6 |
+
// show / hide helper description
|
7 |
+
$('.quads-tooltip').click(function (e) {
|
8 |
+
e.preventDefault();
|
9 |
+
var icon = $(this),
|
10 |
+
bubble = $(this).next();
|
11 |
+
|
12 |
+
// Close any that are already open
|
13 |
+
$('.quads-tooltip-message').not(bubble).hide();
|
14 |
+
|
15 |
+
var position = icon.position();
|
16 |
+
if (bubble.hasClass('bottom')) {
|
17 |
+
bubble.css({
|
18 |
+
'left': (position.left - bubble.width() / 2) + 'px',
|
19 |
+
'top': (position.top + icon.height() + 9) + 'px'
|
20 |
+
});
|
21 |
+
} else {
|
22 |
+
bubble.css({
|
23 |
+
'left': (position.left + icon.width() + 9) + 'px',
|
24 |
+
'top': (position.top + icon.height() / 2 - 18) + 'px'
|
25 |
+
});
|
26 |
+
}
|
27 |
+
|
28 |
+
bubble.toggle();
|
29 |
+
e.stopPropagation();
|
30 |
+
});
|
31 |
+
|
32 |
+
$('body').click(function () {
|
33 |
+
$('.quads-tooltip-message').hide();
|
34 |
+
});
|
35 |
+
|
36 |
+
$('.quads-tooltip-message').click(function (e) {
|
37 |
+
e.stopPropagation();
|
38 |
+
});
|
39 |
+
|
40 |
+
|
41 |
+
// vi login process
|
42 |
+
$("#quads_vi_login_submit").click(function(e){
|
43 |
+
e.preventDefault();
|
44 |
+
username = $("#email").val();
|
45 |
+
password = $("#password").val();
|
46 |
+
|
47 |
+
var data = '{"email":"' + username + '", "password":"' + password + '"}';
|
48 |
+
|
49 |
+
$.ajax({
|
50 |
+
type: "POST",
|
51 |
+
//url: "https://dashboard-api-test.vidint.net/v1/api/authenticate",
|
52 |
+
url: quads.vi_login_url,
|
53 |
+
contentType: 'application/json',
|
54 |
+
data: data,
|
55 |
+
statusCode: {
|
56 |
+
502: function () {
|
57 |
+
$("#quads_add_err").html("502 Bad Gateway. Contact support[at]vi.ai");
|
58 |
+
console.log('502 Bad Gateway.');
|
59 |
+
return false;
|
60 |
+
},
|
61 |
+
500: function () {
|
62 |
+
$("#quads_add_err").html("500 Bad Gateway. Contact support[at]vi.ai");
|
63 |
+
console.log('500 Bad Gateway.');
|
64 |
+
return false;
|
65 |
+
}
|
66 |
+
},
|
67 |
+
success: function(response){
|
68 |
+
$("#quads_add_err").css('display', 'none', 'important').css('visibility', 'hidden');
|
69 |
+
$("#quads_add_err").hide();
|
70 |
+
if (typeof response.data !== 'undefined') {
|
71 |
+
$("#quads_add_err").html("We are logging you in");
|
72 |
+
console.log('We are logging you in' + response);
|
73 |
+
saveViToken(response.data);
|
74 |
+
}
|
75 |
+
else {
|
76 |
+
$("#quads_add_err").html("No valid API response. Can not log you in. Contact support[at]vi.ai");
|
77 |
+
console.log('no valid api response' + response);
|
78 |
+
}
|
79 |
+
},
|
80 |
+
error: function(response){
|
81 |
+
// check if xhr.status is defined in $.ajax.statusCode
|
82 |
+
// if true, return false to stop this function
|
83 |
+
if (typeof this.statusCode[response.status] != 'undefined') {
|
84 |
+
return false;
|
85 |
+
}
|
86 |
+
|
87 |
+
var result = typeof response.responseText !== 'undefined' ? JSON.parse(response.responseText) : '';
|
88 |
+
$("#quads_add_err").html(result.error.message + ' ' + result.error.description);
|
89 |
+
$("#quads_add_err").css('display', 'inline', 'important').css('visibility', 'visible');
|
90 |
+
$("#quads_add_err").show();
|
91 |
+
$("#quads_add_err").removeClass('quads-spinner');
|
92 |
+
console.log(result);
|
93 |
+
//exit;
|
94 |
+
},
|
95 |
+
beforeSend:function()
|
96 |
+
{
|
97 |
+
$("#quads_vi_loading").css('display', 'inline', 'important').css('visibility', 'visible');
|
98 |
+
$("#quads_add_err").show();
|
99 |
+
},
|
100 |
+
|
101 |
+
complete:function()
|
102 |
+
{
|
103 |
+
$("#quads_vi_loading").css('display', 'none', 'important').css('visibility', 'hidden');
|
104 |
+
}
|
105 |
+
|
106 |
+
});
|
107 |
+
return false;
|
108 |
+
});
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Save vi token
|
112 |
+
*/
|
113 |
+
function saveViToken(token){
|
114 |
+
var data = {
|
115 |
+
'action': 'quads_save_vi_token',
|
116 |
+
'token': token
|
117 |
+
};
|
118 |
+
$.ajax({
|
119 |
+
type: "POST",
|
120 |
+
url: ajaxurl,
|
121 |
+
data: data,
|
122 |
+
//contentType: 'application/json',
|
123 |
+
success: function(response){
|
124 |
+
console.log(response.status);
|
125 |
+
$("#quads_add_err").css('display', 'none', 'important').css('visibility', 'hidden');
|
126 |
+
$("#quads_add_err").hide();
|
127 |
+
if (response.status == 'success') {
|
128 |
+
console.log('Success, login succesfull, token stored' + response);
|
129 |
+
window.location.href = quads.path + '/wp-admin/?page=quads-settings&tab=general#quads_settingsvi_header';
|
130 |
+
}
|
131 |
+
else {
|
132 |
+
console.log("Can not store token");
|
133 |
+
window.location.href = quads.path + '/wp-admin/?page=quads-settings&tab=general#quads_settingsvi_header';
|
134 |
+
}
|
135 |
+
},
|
136 |
+
beforeSend:function()
|
137 |
+
{
|
138 |
+
$("#quads_add_err").css('display', 'inline', 'important').css('visibility', 'visible');
|
139 |
+
$("#quads_add_err").show();
|
140 |
+
},
|
141 |
+
complete:function()
|
142 |
+
{
|
143 |
+
$("#quads_add_err").css('display', 'none', 'important').css('visibility', 'hidden');
|
144 |
+
$("#quads_add_err").hide();
|
145 |
+
}
|
146 |
+
|
147 |
+
});
|
148 |
+
}
|
149 |
+
|
150 |
+
|
151 |
+
|
152 |
+
|
153 |
+
// Remove several unused elements from vi page
|
154 |
+
if (document.location.href.indexOf('vi_header') > - 1) {
|
155 |
+
$('#quads-submit-button').hide();
|
156 |
+
$('#quads-validate').hide();
|
157 |
+
$('#quads-footer').hide();
|
158 |
+
} else {
|
159 |
+
$('#quads-submit-button').show();
|
160 |
+
$('#quads-validate').show();
|
161 |
+
$('#quads-footer').show();
|
162 |
+
}
|
163 |
+
$(window).bind('easytabs:after', function(){
|
164 |
+
if (document.location.href.indexOf('vi_header') > - 1) {
|
165 |
+
$('#quads-submit-button').hide();
|
166 |
+
$('#quads-validate').hide();
|
167 |
+
$('#quads-footer').hide();
|
168 |
+
} else {
|
169 |
+
|
170 |
+
$('#quads-submit-button').show();
|
171 |
+
$('#quads-validate').show();
|
172 |
+
$('#quads-footer').show();
|
173 |
+
}
|
174 |
+
});
|
175 |
+
|
176 |
+
|
177 |
+
|
178 |
+
|
179 |
+
|
180 |
+
// VI signup form
|
181 |
+
$('#quads-vi-signup').click(function(e){
|
182 |
+
e.preventDefault();
|
183 |
+
// scroll to top
|
184 |
+
$(window).scrollTop(0);
|
185 |
+
// hide save button
|
186 |
+
$('#quads-submit-button').hide();
|
187 |
+
$('#quads-vi-signup-fullscreen').fadeIn();
|
188 |
+
});
|
189 |
+
$('#quads-vi-close').click(function(e){
|
190 |
+
e.preventDefault();
|
191 |
+
$('#quads-vi-signup-fullscreen').fadeOut();
|
192 |
+
});
|
193 |
|
194 |
/**
|
195 |
* General Tab
|
216 |
*/
|
217 |
// Check if submit button is visible than stick it to the bottom of the page
|
218 |
$(window).scroll(function() {
|
219 |
+
|
220 |
var elem = '#quads_tab_container .submit';
|
221 |
+
|
222 |
+
if ($(elem).length < 1){
|
223 |
+
return;
|
224 |
+
}
|
225 |
+
|
226 |
var top_of_element = $(elem).offset().top;
|
227 |
var bottom_of_element = $(elem).offset().top + $(elem).outerHeight(false);
|
228 |
var bottom_of_screen = $(window).scrollTop() + $(window).height();
|
236 |
});
|
237 |
|
238 |
// Activate chosen select boxes
|
239 |
+
// $(".quads-chosen-select").chosen({
|
240 |
+
// inherit_select_classes: true
|
241 |
+
// });
|
242 |
+
|
243 |
+
|
244 |
|
245 |
// Hid or show AMP code form on click on amp checkbox
|
246 |
$('.quads-activate-amp').click(function(){
|
includes/Autoloader.php
ADDED
@@ -0,0 +1,154 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace wpquads;
|
3 |
+
|
4 |
+
/**
|
5 |
+
* Class Autoloader
|
6 |
+
* @package quads
|
7 |
+
*/
|
8 |
+
class Autoloader
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* An associative array; "namespace" => "directory"
|
12 |
+
* @var array
|
13 |
+
*/
|
14 |
+
private $namespaces;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Register multiple namespaces
|
18 |
+
* @param array $namespaces
|
19 |
+
*/
|
20 |
+
public function registerNamespaces($namespaces)
|
21 |
+
{
|
22 |
+
foreach($namespaces as $namespace => $baseDirectory)
|
23 |
+
{
|
24 |
+
// A string
|
25 |
+
if (is_string($baseDirectory))
|
26 |
+
{
|
27 |
+
$this->registerNamespace($namespace, $baseDirectory);
|
28 |
+
continue;
|
29 |
+
}
|
30 |
+
|
31 |
+
// Multiple directories
|
32 |
+
foreach ($baseDirectory as $directory)
|
33 |
+
{
|
34 |
+
$this->registerNamespace($namespace, $directory);
|
35 |
+
}
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Register a namespace
|
41 |
+
* @param string $namespace
|
42 |
+
* @param string $baseDirectory
|
43 |
+
* @param bool $prepend
|
44 |
+
*/
|
45 |
+
public function registerNamespace($namespace, $baseDirectory, $prepend = false)
|
46 |
+
{
|
47 |
+
// Normalization
|
48 |
+
// Normalize namespace
|
49 |
+
$namespace = trim($namespace, "\\") . "\\";
|
50 |
+
// Normalize base directory
|
51 |
+
$baseDirectory = rtrim($baseDirectory, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
|
52 |
+
|
53 |
+
// Namespace is not set
|
54 |
+
if (false === isset($this->namespaces[$namespace]))
|
55 |
+
{
|
56 |
+
$this->namespaces[$namespace] = array();
|
57 |
+
}
|
58 |
+
|
59 |
+
// Prepend or add
|
60 |
+
if ($prepend)
|
61 |
+
{
|
62 |
+
array_unshift($this->namespaces[$namespace], $baseDirectory);
|
63 |
+
}
|
64 |
+
else
|
65 |
+
{
|
66 |
+
array_push($this->namespaces[$namespace], $baseDirectory);
|
67 |
+
}
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Loads the class file for given class name
|
72 |
+
* @param string $class
|
73 |
+
* @return bool
|
74 |
+
*/
|
75 |
+
public function load($class)
|
76 |
+
{
|
77 |
+
$namespace = $class;
|
78 |
+
|
79 |
+
// As long as we have a namespace
|
80 |
+
while (false !== ($pos = strrpos($namespace, "\\")))
|
81 |
+
{
|
82 |
+
// Basic variables
|
83 |
+
$namespace = substr($class, 0, $pos +1);
|
84 |
+
$className = substr($class, $pos + 1);
|
85 |
+
|
86 |
+
// Find file for given namespace & class name
|
87 |
+
if ($this->findFile($namespace, $className))
|
88 |
+
{
|
89 |
+
return true;
|
90 |
+
}
|
91 |
+
|
92 |
+
// Trim to search another namespace
|
93 |
+
$namespace = rtrim($namespace, "\\");
|
94 |
+
}
|
95 |
+
|
96 |
+
// Class not found
|
97 |
+
return false;
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Attempts to find file for given namespace and class
|
102 |
+
* @param string $namespace
|
103 |
+
* @param string $class
|
104 |
+
* @return bool
|
105 |
+
*/
|
106 |
+
protected function findFile($namespace, $class)
|
107 |
+
{
|
108 |
+
// No registered base directory for given namespace
|
109 |
+
if (false === isset($this->namespaces[$namespace]))
|
110 |
+
{
|
111 |
+
return false;
|
112 |
+
}
|
113 |
+
|
114 |
+
foreach ($this->namespaces[$namespace] as $baseDirectory)
|
115 |
+
{
|
116 |
+
// Look through base directory for given namespace
|
117 |
+
$file = $baseDirectory . str_replace("\\", DIRECTORY_SEPARATOR, $class) . ".php";
|
118 |
+
|
119 |
+
// File found
|
120 |
+
if ($this->requireFile($file))
|
121 |
+
{
|
122 |
+
return true;
|
123 |
+
}
|
124 |
+
}
|
125 |
+
|
126 |
+
// No file found
|
127 |
+
return false;
|
128 |
+
}
|
129 |
+
|
130 |
+
/**
|
131 |
+
* Requires file from FS if it exists
|
132 |
+
* @param string $file
|
133 |
+
* @return bool
|
134 |
+
*/
|
135 |
+
protected function requireFile($file)
|
136 |
+
{
|
137 |
+
// File not found
|
138 |
+
if (!file_exists($file))
|
139 |
+
{
|
140 |
+
return false;
|
141 |
+
}
|
142 |
+
|
143 |
+
require_once $file;
|
144 |
+
return true;
|
145 |
+
}
|
146 |
+
|
147 |
+
/**
|
148 |
+
* Registers autoloader with SPL autoloader stack
|
149 |
+
*/
|
150 |
+
public function register()
|
151 |
+
{
|
152 |
+
spl_autoload_register(array($this, "load"));
|
153 |
+
}
|
154 |
+
}
|
includes/Cron/Cron.php
CHANGED
@@ -1,45 +1,51 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Chron relevant stuff
|
5 |
-
*/
|
6 |
-
|
7 |
-
// No Direct Access
|
8 |
-
if( !defined( "WPINC" ) ) {
|
9 |
-
die;
|
10 |
-
}
|
11 |
-
|
12 |
-
class quadsCron {
|
13 |
-
|
14 |
-
public function __construct() {
|
15 |
-
add_filter( 'cron_schedules', array($this, 'add_new_intervals') );
|
16 |
-
}
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Add new intervals for wp cron jobs
|
20 |
-
* @param type $schedules
|
21 |
-
* @return type
|
22 |
-
*/
|
23 |
-
public function add_new_intervals( $schedules ) {
|
24 |
-
// add weekly and monthly intervals
|
25 |
-
$schedules['weekly'] = array(
|
26 |
-
'interval' => 604800,
|
27 |
-
'display' => __( 'Once Weekly' )
|
28 |
-
);
|
29 |
-
|
30 |
-
$schedules['monthly'] = array(
|
31 |
-
'interval' => 2635200,
|
32 |
-
'display' => __( 'Once a month' )
|
33 |
-
);
|
34 |
-
|
35 |
-
return $schedules;
|
36 |
-
}
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Chron relevant stuff
|
5 |
+
*/
|
6 |
+
|
7 |
+
// No Direct Access
|
8 |
+
if( !defined( "WPINC" ) ) {
|
9 |
+
die;
|
10 |
+
}
|
11 |
+
|
12 |
+
class quadsCron {
|
13 |
+
|
14 |
+
public function __construct() {
|
15 |
+
add_filter( 'cron_schedules', array($this, 'add_new_intervals') );
|
16 |
+
}
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Add new intervals for wp cron jobs
|
20 |
+
* @param type $schedules
|
21 |
+
* @return type
|
22 |
+
*/
|
23 |
+
public function add_new_intervals( $schedules ) {
|
24 |
+
// add weekly and monthly intervals
|
25 |
+
$schedules['weekly'] = array(
|
26 |
+
'interval' => 604800,
|
27 |
+
'display' => __( 'Once Weekly' )
|
28 |
+
);
|
29 |
+
|
30 |
+
$schedules['monthly'] = array(
|
31 |
+
'interval' => 2635200,
|
32 |
+
'display' => __( 'Once a month' )
|
33 |
+
);
|
34 |
+
|
35 |
+
return $schedules;
|
36 |
+
}
|
37 |
+
|
38 |
+
|
39 |
+
|
40 |
+
|
41 |
+
public function schedule_event() {
|
42 |
+
if( !wp_next_scheduled( 'quads_weekly_event' ) ) {
|
43 |
+
wp_schedule_event( time(), 'weekly', 'quads_weekly_event' );
|
44 |
+
}
|
45 |
+
if( !wp_next_scheduled( 'quads_daily_event' ) ) {
|
46 |
+
wp_schedule_event( time(), 'daily', 'quads_daily_event' );
|
47 |
+
}
|
48 |
+
}
|
49 |
+
}
|
50 |
+
|
51 |
+
$quadsCron = new quadsCron();
|
includes/DI/InjectionAware.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace WPStaging\DI;
|
3 |
+
|
4 |
+
use WPStaging\WPStaging;
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Class InjectionAware
|
8 |
+
* @package WPStaging\DI
|
9 |
+
*/
|
10 |
+
abstract class InjectionAware
|
11 |
+
{
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @var WPStaging
|
15 |
+
*/
|
16 |
+
protected $di;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* InjectionAware constructor.
|
20 |
+
* @param $di
|
21 |
+
*/
|
22 |
+
public function __construct($di)
|
23 |
+
{
|
24 |
+
$this->di = $di;
|
25 |
+
|
26 |
+
if (method_exists($this, "initialize"))
|
27 |
+
{
|
28 |
+
$this->initialize();
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* @return WPStaging
|
34 |
+
*/
|
35 |
+
public function getDI()
|
36 |
+
{
|
37 |
+
return $this->di;
|
38 |
+
}
|
39 |
+
}
|
includes/Forms/Elements.php
ADDED
@@ -0,0 +1,300 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace wpquads;
|
3 |
+
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Class Elements
|
7 |
+
* @package WPStaging\Forms
|
8 |
+
*/
|
9 |
+
abstract class Elements implements InterfaceElement
|
10 |
+
{
|
11 |
+
|
12 |
+
/**
|
13 |
+
* @var null|string
|
14 |
+
*/
|
15 |
+
protected $name;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* @var array
|
19 |
+
*/
|
20 |
+
protected $attributes = array();
|
21 |
+
|
22 |
+
/**
|
23 |
+
* @var null|string
|
24 |
+
*/
|
25 |
+
protected $label;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @var null|string|array
|
29 |
+
*/
|
30 |
+
protected $default;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* @var array
|
34 |
+
*/
|
35 |
+
protected $filters = array();
|
36 |
+
|
37 |
+
/**
|
38 |
+
* @var array
|
39 |
+
*/
|
40 |
+
protected $validations = array();
|
41 |
+
|
42 |
+
/**
|
43 |
+
* @var string
|
44 |
+
*/
|
45 |
+
protected $renderFile;
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Text constructor.
|
49 |
+
* @param string $name
|
50 |
+
* @param array $attributes
|
51 |
+
*/
|
52 |
+
public function __construct($name, $attributes)
|
53 |
+
{
|
54 |
+
$this->setName($name);
|
55 |
+
$this->setAttributes($attributes);
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* @param string $name
|
60 |
+
* @return $this
|
61 |
+
*/
|
62 |
+
public function setName($name)
|
63 |
+
{
|
64 |
+
$this->name = $name;
|
65 |
+
|
66 |
+
return $this;
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* @return null|string
|
71 |
+
*/
|
72 |
+
public function getName()
|
73 |
+
{
|
74 |
+
return $this->name;
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* @param string $name
|
79 |
+
* @param string $value
|
80 |
+
* @return $this
|
81 |
+
*/
|
82 |
+
public function setAttribute($name, $value)
|
83 |
+
{
|
84 |
+
$this->attributes[$name] = $value;
|
85 |
+
|
86 |
+
return $this;
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* @param array $attributes
|
91 |
+
* @return $this
|
92 |
+
*/
|
93 |
+
public function setAttributes($attributes)
|
94 |
+
{
|
95 |
+
foreach ($attributes as $name => $value)
|
96 |
+
{
|
97 |
+
$this->setAttribute($name, $value);
|
98 |
+
}
|
99 |
+
|
100 |
+
return $this;
|
101 |
+
}
|
102 |
+
|
103 |
+
/**
|
104 |
+
* @return string
|
105 |
+
*/
|
106 |
+
public function prepareAttributes()
|
107 |
+
{
|
108 |
+
$attributes = '';
|
109 |
+
foreach ($this->attributes as $name => $value)
|
110 |
+
{
|
111 |
+
$attributes .= "{$name}='{$value}' ";
|
112 |
+
}
|
113 |
+
|
114 |
+
return rtrim($attributes, ' ');
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* @return array
|
119 |
+
*/
|
120 |
+
public function getAttributes()
|
121 |
+
{
|
122 |
+
return $this->attributes;
|
123 |
+
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* @param string $label
|
127 |
+
* @return $this
|
128 |
+
*/
|
129 |
+
public function setLabel($label)
|
130 |
+
{
|
131 |
+
$this->label = $label;
|
132 |
+
|
133 |
+
return $this;
|
134 |
+
}
|
135 |
+
|
136 |
+
/**
|
137 |
+
* @return null|string
|
138 |
+
*/
|
139 |
+
public function getLabel()
|
140 |
+
{
|
141 |
+
return $this->label;
|
142 |
+
}
|
143 |
+
|
144 |
+
/**
|
145 |
+
* @return string
|
146 |
+
*/
|
147 |
+
public function prepareLabel()
|
148 |
+
{
|
149 |
+
return "<label for='{$this->getId()}'>{$this->label}</label>";
|
150 |
+
}
|
151 |
+
/**
|
152 |
+
* @param string $label
|
153 |
+
* @return $this
|
154 |
+
*/
|
155 |
+
public function setTooltip($tooltip)
|
156 |
+
{
|
157 |
+
$this->tooltip = $tooltip;
|
158 |
+
|
159 |
+
return $this;
|
160 |
+
}
|
161 |
+
|
162 |
+
/**
|
163 |
+
* @return null|string
|
164 |
+
*/
|
165 |
+
public function getTooltip()
|
166 |
+
{
|
167 |
+
return $this->tooltip;
|
168 |
+
}
|
169 |
+
|
170 |
+
/**
|
171 |
+
* @return string
|
172 |
+
*/
|
173 |
+
public function prepareTooltip()
|
174 |
+
{
|
175 |
+
return "<a class='quads-tooltip' href='#'></a><div class='quads-tooltip-message'>{$this->tooltip}</div>";
|
176 |
+
}
|
177 |
+
|
178 |
+
/**
|
179 |
+
* @param array|string $filters
|
180 |
+
* @return $this
|
181 |
+
*/
|
182 |
+
public function setFilters($filters)
|
183 |
+
{
|
184 |
+
if (is_string($filters))
|
185 |
+
{
|
186 |
+
$this->filters[] = $filters;
|
187 |
+
}
|
188 |
+
else
|
189 |
+
{
|
190 |
+
array_merge($this->filters, $filters);
|
191 |
+
}
|
192 |
+
|
193 |
+
return $this;
|
194 |
+
}
|
195 |
+
|
196 |
+
/**
|
197 |
+
* @return array
|
198 |
+
*/
|
199 |
+
public function getFilters()
|
200 |
+
{
|
201 |
+
return $this->filters;
|
202 |
+
}
|
203 |
+
|
204 |
+
/**
|
205 |
+
* @param string|array $value
|
206 |
+
* @return $this
|
207 |
+
*/
|
208 |
+
public function setDefault($value)
|
209 |
+
{
|
210 |
+
$this->default = $value;
|
211 |
+
|
212 |
+
return $this;
|
213 |
+
}
|
214 |
+
|
215 |
+
/**
|
216 |
+
* @return null|string|array
|
217 |
+
*/
|
218 |
+
public function getDefault()
|
219 |
+
{
|
220 |
+
return $this->default;
|
221 |
+
}
|
222 |
+
|
223 |
+
/**
|
224 |
+
* @param object $validation
|
225 |
+
* @return $this
|
226 |
+
*/
|
227 |
+
public function addValidation($validation)
|
228 |
+
{
|
229 |
+
$this->validations[] = $validation;
|
230 |
+
|
231 |
+
return $this;
|
232 |
+
}
|
233 |
+
|
234 |
+
/**
|
235 |
+
* @return array
|
236 |
+
*/
|
237 |
+
public function getValidations()
|
238 |
+
{
|
239 |
+
return $this->validations;
|
240 |
+
}
|
241 |
+
|
242 |
+
/**
|
243 |
+
* @param string $file
|
244 |
+
* @return $this
|
245 |
+
*/
|
246 |
+
public function setRenderFile($file)
|
247 |
+
{
|
248 |
+
if (file_exists($file) && is_readable($file))
|
249 |
+
{
|
250 |
+
$this->renderFile = $file;
|
251 |
+
}
|
252 |
+
|
253 |
+
return $this;
|
254 |
+
}
|
255 |
+
|
256 |
+
/**
|
257 |
+
* @return string
|
258 |
+
*/
|
259 |
+
public function getRenderFile()
|
260 |
+
{
|
261 |
+
return $this->renderFile;
|
262 |
+
}
|
263 |
+
|
264 |
+
/**
|
265 |
+
* @return string
|
266 |
+
*/
|
267 |
+
public function __toString()
|
268 |
+
{
|
269 |
+
return $this->render();
|
270 |
+
}
|
271 |
+
|
272 |
+
/**
|
273 |
+
* @param null|string $name
|
274 |
+
* @return string
|
275 |
+
*/
|
276 |
+
public function getId($name = null)
|
277 |
+
{
|
278 |
+
if (null === $name)
|
279 |
+
{
|
280 |
+
$name = $this->name;
|
281 |
+
}
|
282 |
+
|
283 |
+
if (!$name)
|
284 |
+
{
|
285 |
+
return '';
|
286 |
+
}
|
287 |
+
|
288 |
+
return str_replace(' ', '_', $name);
|
289 |
+
}
|
290 |
+
|
291 |
+
/**
|
292 |
+
* @return string
|
293 |
+
*/
|
294 |
+
abstract protected function prepareOutput();
|
295 |
+
|
296 |
+
/**
|
297 |
+
* @return string
|
298 |
+
*/
|
299 |
+
abstract public function render();
|
300 |
+
}
|
includes/Forms/Elements/Check.php
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace wpquads;
|
3 |
+
|
4 |
+
|
5 |
+
use wpquads\ElementsWithOptions;
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Class Check
|
9 |
+
* @package WPStaging\Forms\Elements
|
10 |
+
*/
|
11 |
+
class Check extends ElementsWithOptions
|
12 |
+
{
|
13 |
+
|
14 |
+
/**
|
15 |
+
* @return string
|
16 |
+
*/
|
17 |
+
protected function prepareOutput()
|
18 |
+
{
|
19 |
+
$output = '';
|
20 |
+
|
21 |
+
foreach ($this->options as $id => $value)
|
22 |
+
{
|
23 |
+
$checked = ($this->isChecked($id)) ? " checked=''" : '';
|
24 |
+
|
25 |
+
$attributeId = $this->getId() . '_' . $this->getId($id);
|
26 |
+
|
27 |
+
$output .= "<input type='checkbox' name='{$this->getId()}' id='{$attributeId}' value='{$id}' {$checked}/>";
|
28 |
+
|
29 |
+
if ($value)
|
30 |
+
{
|
31 |
+
$output .= "<label for='{$attributeId}'>{$value}</label>";
|
32 |
+
}
|
33 |
+
}
|
34 |
+
|
35 |
+
return $output;
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* @param string $value
|
40 |
+
* @return bool
|
41 |
+
*/
|
42 |
+
private function isChecked($value)
|
43 |
+
{
|
44 |
+
if (
|
45 |
+
$this->default &&
|
46 |
+
(
|
47 |
+
(is_string($this->default) && $this->default === $value) ||
|
48 |
+
(is_int($value) && (int) $this->default == $value) ||
|
49 |
+
(is_array($this->default) && in_array($value, $this->default))
|
50 |
+
)
|
51 |
+
)
|
52 |
+
{
|
53 |
+
return true;
|
54 |
+
}
|
55 |
+
|
56 |
+
return false;
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* @return string
|
61 |
+
*/
|
62 |
+
public function render()
|
63 |
+
{
|
64 |
+
return ($this->renderFile) ? @file_get_contents($this->renderFile) : $this->prepareOutput();
|
65 |
+
}
|
66 |
+
}
|
includes/Forms/Elements/Date.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace wpquads;
|
3 |
+
|
4 |
+
use wpquads\Elements;
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Class Date
|
8 |
+
* @package WPStaging\Forms\Elements
|
9 |
+
*/
|
10 |
+
class Date extends Elements
|
11 |
+
{
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @return string
|
15 |
+
*/
|
16 |
+
protected function prepareOutput()
|
17 |
+
{
|
18 |
+
return "<input id='{$this->getId()}' name='{$this->getName()}' type='date' {$this->prepareAttributes()} value='{$this->default}' />";
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* @return string
|
23 |
+
*/
|
24 |
+
public function render()
|
25 |
+
{
|
26 |
+
return ($this->renderFile) ? @file_get_contents($this->renderFile) : $this->prepareOutput();
|
27 |
+
}
|
28 |
+
}
|
includes/Forms/Elements/DateTime.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace wpquads;
|
3 |
+
|
4 |
+
/**
|
5 |
+
* Class Date
|
6 |
+
* @package WPStaging\Forms\Elements
|
7 |
+
*/
|
8 |
+
class DateTime extends Elements
|
9 |
+
{
|
10 |
+
|
11 |
+
/**
|
12 |
+
* @return string
|
13 |
+
*/
|
14 |
+
protected function prepareOutput()
|
15 |
+
{
|
16 |
+
return "<input id='{$this->getId()}' name='{$this->getName()}' type='datetime' {$this->prepareAttributes()} value='{$this->default}' />";
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* @return string
|
21 |
+
*/
|
22 |
+
public function render()
|
23 |
+
{
|
24 |
+
return ($this->renderFile) ? @file_get_contents($this->renderFile) : $this->prepareOutput();
|
25 |
+
}
|
26 |
+
}
|
includes/Forms/Elements/Email.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace wpquads;
|
3 |
+
|
4 |
+
use wpquads\Elements;
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Class Email
|
8 |
+
* @package WPStaging\Forms\Elements
|
9 |
+
*/
|
10 |
+
class Email extends Elements
|
11 |
+
{
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @return string
|
15 |
+
*/
|
16 |
+
protected function prepareOutput()
|
17 |
+
{
|
18 |
+
return "<input id='{$this->getId()}' name='{$this->getName()}' type='email' {$this->prepareAttributes()} value='{$this->default}' />";
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* @return string
|
23 |
+
*/
|
24 |
+
public function render()
|
25 |
+
{
|
26 |
+
return ($this->renderFile) ? @file_get_contents($this->renderFile) : $this->prepareOutput();
|
27 |
+
}
|
28 |
+
}
|
includes/Forms/Elements/File.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace wpquads;
|
3 |
+
|
4 |
+
use wpquads\Elements;
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Class File
|
8 |
+
* @package WPStaging\Forms\Elements
|
9 |
+
*/
|
10 |
+
class File extends Elements
|
11 |
+
{
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @return string
|
15 |
+
*/
|
16 |
+
protected function prepareOutput()
|
17 |
+
{
|
18 |
+
return "<input id='{$this->getId()}' name='{$this->getName()}' type='file' {$this->prepareAttributes()} value='{$this->default}' />";
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* @return string
|
23 |
+
*/
|
24 |
+
public function render()
|
25 |
+
{
|
26 |
+
return ($this->renderFile) ? @file_get_contents($this->renderFile) : $this->prepareOutput();
|
27 |
+
}
|
28 |
+
}
|
includes/Forms/Elements/Hidden.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace wpquads;
|
3 |
+
|
4 |
+
|
5 |
+
use wpquads\ElementsWithOptions;
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Class Hidden
|
9 |
+
* @package WPStaging\Forms\Elements
|
10 |
+
*/
|
11 |
+
class Hidden extends Elements
|
12 |
+
{
|
13 |
+
|
14 |
+
/**
|
15 |
+
* @return string
|
16 |
+
*/
|
17 |
+
protected function prepareOutput()
|
18 |
+
{
|
19 |
+
return "<input id='{$this->getId()}' name='{$this->getName()}' type='hidden' {$this->prepareAttributes()} value='{$this->default}' />";
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* @return string
|
24 |
+
*/
|
25 |
+
public function render()
|
26 |
+
{
|
27 |
+
return ($this->renderFile) ? @file_get_contents($this->renderFile) : $this->prepareOutput();
|
28 |
+
}
|
29 |
+
}
|
includes/Forms/Elements/Interfaces/InterfaceElement.php
ADDED
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace wpquads;
|
3 |
+
|
4 |
+
/**
|
5 |
+
* Interface InterfaceElement
|
6 |
+
* @package WPStaging\Forms\Elements\Interfaces
|
7 |
+
*/
|
8 |
+
interface InterfaceElement
|
9 |
+
{
|
10 |
+
|
11 |
+
/**
|
12 |
+
* @param string $name
|
13 |
+
* return $this
|
14 |
+
*/
|
15 |
+
public function setName($name);
|
16 |
+
|
17 |
+
/**
|
18 |
+
* @return null|string
|
19 |
+
*/
|
20 |
+
public function getName();
|
21 |
+
|
22 |
+
/**
|
23 |
+
* @param string $name
|
24 |
+
* @param string $value
|
25 |
+
* return $this
|
26 |
+
*/
|
27 |
+
public function setAttribute($name, $value);
|
28 |
+
|
29 |
+
/**
|
30 |
+
* @param array $attributes
|
31 |
+
* return $this
|
32 |
+
*/
|
33 |
+
public function setAttributes($attributes);
|
34 |
+
|
35 |
+
/**
|
36 |
+
* @return string
|
37 |
+
*/
|
38 |
+
public function prepareAttributes();
|
39 |
+
|
40 |
+
/**
|
41 |
+
* @return array
|
42 |
+
*/
|
43 |
+
public function getAttributes();
|
44 |
+
|
45 |
+
/**
|
46 |
+
* @param string $label
|
47 |
+
* return $this
|
48 |
+
*/
|
49 |
+
public function setLabel($label);
|
50 |
+
|
51 |
+
/**
|
52 |
+
* @return null|string
|
53 |
+
*/
|
54 |
+
public function getLabel();
|
55 |
+
/**
|
56 |
+
* @param string $label
|
57 |
+
* return $this
|
58 |
+
*/
|
59 |
+
public function setTooltip($tooltip);
|
60 |
+
|
61 |
+
/**
|
62 |
+
* @return null|string
|
63 |
+
*/
|
64 |
+
public function getTooltip();
|
65 |
+
|
66 |
+
/**
|
67 |
+
* @return string
|
68 |
+
*/
|
69 |
+
public function prepareLabel();
|
70 |
+
|
71 |
+
/**
|
72 |
+
* @return string
|
73 |
+
*/
|
74 |
+
public function prepareTooltip();
|
75 |
+
|
76 |
+
/**
|
77 |
+
* @param array|string $filters
|
78 |
+
* return $this
|
79 |
+
*/
|
80 |
+
public function setFilters($filters);
|
81 |
+
|
82 |
+
/**
|
83 |
+
* @return array
|
84 |
+
*/
|
85 |
+
public function getFilters();
|
86 |
+
|
87 |
+
/**
|
88 |
+
* @param string $value
|
89 |
+
* return $this
|
90 |
+
*/
|
91 |
+
public function setDefault($value);
|
92 |
+
|
93 |
+
/**
|
94 |
+
* @return null|string
|
95 |
+
*/
|
96 |
+
public function getDefault();
|
97 |
+
|
98 |
+
/**
|
99 |
+
* @param object $validation
|
100 |
+
* return $this
|
101 |
+
*/
|
102 |
+
public function addValidation($validation);
|
103 |
+
|
104 |
+
/**
|
105 |
+
* @return array
|
106 |
+
*/
|
107 |
+
public function getValidations();
|
108 |
+
|
109 |
+
/**
|
110 |
+
* @param string $file
|
111 |
+
* return $this
|
112 |
+
*/
|
113 |
+
public function setRenderFile($file);
|
114 |
+
|
115 |
+
/**
|
116 |
+
* @return string
|
117 |
+
*/
|
118 |
+
public function getRenderFile();
|
119 |
+
|
120 |
+
/**
|
121 |
+
* @param null|string $name
|
122 |
+
* @return string
|
123 |
+
*/
|
124 |
+
public function getId($name = null);
|
125 |
+
|
126 |
+
/**
|
127 |
+
* @return string
|
128 |
+
*/
|
129 |
+
public function __toString();
|
130 |
+
|
131 |
+
/**
|
132 |
+
* @return mixed
|
133 |
+
*/
|
134 |
+
public function render();
|
135 |
+
}
|
includes/Forms/Elements/Interfaces/InterfaceElementWithOptions.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace wpquads;
|
3 |
+
|
4 |
+
/**
|
5 |
+
* Interface InterfaceElementWithOptions
|
6 |
+
* @package WPStaging\Forms\Elements\Interfaces
|
7 |
+
*/
|
8 |
+
interface InterfaceElementWithOptions
|
9 |
+
{
|
10 |
+
|
11 |
+
/**
|
12 |
+
* @param string $id
|
13 |
+
* @param string $name
|
14 |
+
* @return void
|
15 |
+
*/
|
16 |
+
public function addOption($id, $name);
|
17 |
+
|
18 |
+
/**
|
19 |
+
* @param string $id
|
20 |
+
* @return void
|
21 |
+
*/
|
22 |
+
public function removeOption($id);
|
23 |
+
|
24 |
+
/**
|
25 |
+
* @param array $options
|
26 |
+
* @return void
|
27 |
+
*/
|
28 |
+
public function addOptions($options);
|
29 |
+
|
30 |
+
/**
|
31 |
+
* @return array
|
32 |
+
*/
|
33 |
+
public function getOptions();
|
34 |
+
}
|
includes/Forms/Elements/Numerical.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace wpquads;
|
3 |
+
|
4 |
+
/**
|
5 |
+
* Class Numerical
|
6 |
+
* @package WPStaging\Forms\Elements
|
7 |
+
*/
|
8 |
+
class Numerical extends Elements
|
9 |
+
{
|
10 |
+
|
11 |
+
/**
|
12 |
+
* @return string
|
13 |
+
*/
|
14 |
+
protected function prepareOutput()
|
15 |
+
{
|
16 |
+
return "<input id='{$this->getId()}' name='{$this->getName()}' type='number' {$this->prepareAttributes()} value='{$this->default}' />";
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* @return string
|
21 |
+
*/
|
22 |
+
public function render()
|
23 |
+
{
|
24 |
+
return ($this->renderFile) ? @file_get_contents($this->renderFile) : $this->prepareOutput();
|
25 |
+
}
|
26 |
+
}
|
includes/Forms/Elements/Password.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace wpquads;
|
3 |
+
|
4 |
+
|
5 |
+
use wpquads\ElementsWithOptions;
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Class Password
|
9 |
+
* @package WPStaging\Forms\Elements
|
10 |
+
*/
|
11 |
+
class Password extends Elements
|
12 |
+
{
|
13 |
+
|
14 |
+
/**
|
15 |
+
* @return string
|
16 |
+
*/
|
17 |
+
protected function prepareOutput()
|
18 |
+
{
|
19 |
+
return "<input id='{$this->getId()}' name='{$this->getName()}' type='password' {$this->prepareAttributes()} value='{$this->default}' />";
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* @return string
|
24 |
+
*/
|
25 |
+
public function render()
|
26 |
+
{
|
27 |
+
return ($this->renderFile) ? @file_get_contents($this->renderFile) : $this->prepareOutput();
|
28 |
+
}
|
29 |
+
}
|
includes/Forms/Elements/Radio.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace wpquads;
|
3 |
+
|
4 |
+
|
5 |
+
use wpquads\ElementsWithOptions;
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Class Radio
|
9 |
+
* @package WPStaging\Forms\Elements
|
10 |
+
*/
|
11 |
+
//class Radio extends Elements
|
12 |
+
class Radio extends ElementsWithOptions
|
13 |
+
{
|
14 |
+
|
15 |
+
/**
|
16 |
+
* @return string
|
17 |
+
*/
|
18 |
+
protected function prepareOutput()
|
19 |
+
{
|
20 |
+
$output = '';
|
21 |
+
|
22 |
+
foreach ($this->options as $id => $value)
|
23 |
+
{
|
24 |
+
$checked = ($this->default && $this->default === $value) ? " checked=''" : '';
|
25 |
+
|
26 |
+
$attributeId = $this->getId($id);
|
27 |
+
|
28 |
+
$sanitize = str_replace (array('][', '[', ']'), '-', $this->getId()) ;
|
29 |
+
|
30 |
+
$output .= "<input type='radio' name='{$this->getId()}' id='{$sanitize}{$attributeId}' value='{$id}' {$checked}/>";
|
31 |
+
$output .= "<label for='{$sanitize}{$attributeId}' id='{$sanitize}{$attributeId}-label'>{$value}</label>";
|
32 |
+
}
|
33 |
+
|
34 |
+
return $output;
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* @return string
|
39 |
+
*/
|
40 |
+
public function render()
|
41 |
+
{
|
42 |
+
return ($this->renderFile) ? @file_get_contents($this->renderFile) : $this->prepareOutput();
|
43 |
+
}
|
44 |
+
}
|
includes/Forms/Elements/Select.php
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace wpquads;
|
3 |
+
|
4 |
+
//use wpquads\includes\Forms\ElementsWithOptions;
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Class Select
|
8 |
+
* @package WPStaging\Forms\Elements
|
9 |
+
*/
|
10 |
+
class Select extends ElementsWithOptions
|
11 |
+
{
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @return string
|
15 |
+
*/
|
16 |
+
protected function prepareOutput()
|
17 |
+
{
|
18 |
+
$output = "<select id='{$this->getId()}' name='{$this->name}' {$this->prepareAttributes()}>";
|
19 |
+
|
20 |
+
foreach ($this->options as $id => $value)
|
21 |
+
{
|
22 |
+
$selected = ($this->isSelected($id)) ? " selected=''" : '';
|
23 |
+
|
24 |
+
$output .= "<option value='{$id}'{$selected}>{$value}</option>";
|
25 |
+
}
|
26 |
+
|
27 |
+
$output.= "</select>";
|
28 |
+
|
29 |
+
return $output;
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* @param string $value
|
34 |
+
* @return bool
|
35 |
+
*/
|
36 |
+
private function isSelected($value)
|
37 |
+
{
|
38 |
+
if (
|
39 |
+
$this->default &&
|
40 |
+
(
|
41 |
+
(is_string($this->default) && $this->default == $value) ||
|
42 |
+
(is_array($this->default) && in_array($value, $this->default))
|
43 |
+
)
|
44 |
+
)
|
45 |
+
{
|
46 |
+
return true;
|
47 |
+
}
|
48 |
+
|
49 |
+
return false;
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* @return string
|
54 |
+
*/
|
55 |
+
public function render()
|
56 |
+
{
|
57 |
+
return ($this->renderFile) ? @file_get_contents($this->renderFile) : $this->prepareOutput();
|
58 |
+
}
|
59 |
+
}
|
includes/Forms/Elements/SelectMultiple.php
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace wpquads;
|
3 |
+
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Class Select
|
7 |
+
* @package WPStaging\Forms\Elements
|
8 |
+
*/
|
9 |
+
class SelectMultiple extends ElementsWithOptions
|
10 |
+
{
|
11 |
+
|
12 |
+
/**
|
13 |
+
* @return string
|
14 |
+
*/
|
15 |
+
protected function prepareOutput()
|
16 |
+
{
|
17 |
+
$output = "<select multiple id='{$this->getId()}' name='{$this->name}[]' {$this->prepareAttributes()}>";
|
18 |
+
|
19 |
+
foreach ($this->options as $id => $value)
|
20 |
+
{
|
21 |
+
$selected = ($this->isSelected($id)) ? " selected=''" : '';
|
22 |
+
|
23 |
+
$output .= "<option value='{$id}'{$selected}>{$value}</option>";
|
24 |
+
}
|
25 |
+
|
26 |
+
$output.= "</select>";
|
27 |
+
|
28 |
+
return $output;
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* @param string $value
|
33 |
+
* @return bool
|
34 |
+
*/
|
35 |
+
private function isSelected($value)
|
36 |
+
{
|
37 |
+
if (
|
38 |
+
$this->default &&
|
39 |
+
(
|
40 |
+
(is_string($this->default) && $this->default === $value) ||
|
41 |
+
(is_array($this->default) && in_array($value, $this->default))
|
42 |
+
)
|
43 |
+
)
|
44 |
+
{
|
45 |
+
return true;
|
46 |
+
}
|
47 |
+
|
48 |
+
return false;
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* @return string
|
53 |
+
*/
|
54 |
+
public function render()
|
55 |
+
{
|
56 |
+
return ($this->renderFile) ? @file_get_contents($this->renderFile) : $this->prepareOutput();
|
57 |
+
}
|
58 |
+
}
|
includes/Forms/Elements/Text.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace wpquads;
|
3 |
+
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Class Text
|
7 |
+
* @package WPStaging\Forms\Elements
|
8 |
+
*/
|
9 |
+
class Text extends Elements
|
10 |
+
{
|
11 |
+
|
12 |
+
/**
|
13 |
+
* @return string
|
14 |
+
*/
|
15 |
+
protected function prepareOutput()
|
16 |
+
{
|
17 |
+
return "<input id='{$this->getId()}' name='{$this->getName()}' type='text' {$this->prepareAttributes()} value='{$this->default}' />";
|
18 |
+
}
|
19 |
+
|
20 |
+
|
21 |
+
/**
|
22 |
+
* @return string
|
23 |
+
*/
|
24 |
+
public function render()
|
25 |
+
{
|
26 |
+
return ($this->renderFile) ? @file_get_contents($this->renderFile) : $this->prepareOutput();
|
27 |
+
}
|
28 |
+
}
|
includes/Forms/Elements/TextArea.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace wpquads;
|
3 |
+
|
4 |
+
use wpquads;
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Class TextArea
|
8 |
+
* @package WPStaging\Forms\Elements
|
9 |
+
*/
|
10 |
+
class TextArea extends Elements
|
11 |
+
{
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @return string
|
15 |
+
*/
|
16 |
+
protected function prepareOutput()
|
17 |
+
{
|
18 |
+
return "<textarea id='{$this->getId()}' name='{$this->getName()}' {$this->prepareAttributes()}>{$this->default}</textarea>";
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* @return string
|
23 |
+
*/
|
24 |
+
public function render()
|
25 |
+
{
|
26 |
+
return ($this->renderFile) ? @file_get_contents($this->renderFile) : $this->prepareOutput();
|
27 |
+
}
|
28 |
+
}
|
includes/Forms/Elements/TextAreaHidden.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace wpquads;
|
3 |
+
|
4 |
+
use wpquads;
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Class TextArea
|
8 |
+
* @package WPStaging\Forms\Elements
|
9 |
+
*/
|
10 |
+
class TextAreaHidden extends Elements
|
11 |
+
{
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @return string
|
15 |
+
*/
|
16 |
+
protected function prepareOutput()
|
17 |
+
{
|
18 |
+
return "<textarea style='display:none;' id='{$this->getId()}' name='{$this->getName()}' {$this->prepareAttributes()}>{$this->default}</textarea>";
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* @return string
|
23 |
+
*/
|
24 |
+
public function render()
|
25 |
+
{
|
26 |
+
return ($this->renderFile) ? @file_get_contents($this->renderFile) : $this->prepareOutput();
|
27 |
+
}
|
28 |
+
}
|
includes/Forms/ElementsWithOptions.php
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace wpquads;
|
3 |
+
|
4 |
+
/**
|
5 |
+
* Class Elements
|
6 |
+
* @package WPStaging\Forms
|
7 |
+
*/
|
8 |
+
abstract class ElementsWithOptions extends Elements implements InterfaceElementWithOptions
|
9 |
+
{
|
10 |
+
|
11 |
+
/**
|
12 |
+
* @var array
|
13 |
+
*/
|
14 |
+
protected $options = array();
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Text constructor.
|
18 |
+
* @param string $name
|
19 |
+
* @param array $options
|
20 |
+
* @param array $attributes
|
21 |
+
*/
|
22 |
+
public function __construct($name, $options = array(), $attributes = array())
|
23 |
+
{
|
24 |
+
$this->setName($name);
|
25 |
+
$this->addOptions($options);
|
26 |
+
$this->setAttributes($attributes);
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* @param string $id
|
31 |
+
* @param string $name
|
32 |
+
* @return $this
|
33 |
+
*/
|
34 |
+
public function addOption($id, $name)
|
35 |
+
{
|
36 |
+
$this->options[$id] = $name;
|
37 |
+
|
38 |
+
return $this;
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* @param string $id
|
43 |
+
* @return $this
|
44 |
+
*/
|
45 |
+
public function removeOption($id)
|
46 |
+
{
|
47 |
+
if (isset($this->options[$id]))
|
48 |
+
{
|
49 |
+
unset($this->options[$id]);
|
50 |
+
}
|
51 |
+
|
52 |
+
return $this;
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* @param array $options
|
57 |
+
* @return $this
|
58 |
+
*/
|
59 |
+
public function addOptions($options)
|
60 |
+
{
|
61 |
+
foreach ($options as $id => $name)
|
62 |
+
{
|
63 |
+
$this->addOption($id, $name);
|
64 |
+
}
|
65 |
+
|
66 |
+
return $this;
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* @return array
|
71 |
+
*/
|
72 |
+
public function getOptions()
|
73 |
+
{
|
74 |
+
return $this->options;
|
75 |
+
}
|
76 |
+
}
|
includes/Forms/Form.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace wpquads;
|
3 |
+
|
4 |
+
//use wpquads\InterfaceElement;
|
5 |
+
//use wpquads\InterfaceElementWithOptions;
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Class Form
|
9 |
+
* @package WPStaging\Forms
|
10 |
+
*/
|
11 |
+
class Form
|
12 |
+
{
|
13 |
+
|
14 |
+
protected $elements = array();
|
15 |
+
|
16 |
+
public function __construct()
|
17 |
+
{
|
18 |
+
|
19 |
+
}
|
20 |
+
|
21 |
+
public function add($element)
|
22 |
+
{
|
23 |
+
if (!($element instanceof InterfaceElement) && !($element instanceof InterfaceElementWithOptions))
|
24 |
+
{
|
25 |
+
return;
|
26 |
+
}
|
27 |
+
|
28 |
+
$this->elements[$element->getName()] = $element;
|
29 |
+
}
|
30 |
+
|
31 |
+
public function render($name)
|
32 |
+
{
|
33 |
+
if (!isset($this->elements[$name]))
|
34 |
+
{
|
35 |
+
return false;
|
36 |
+
}
|
37 |
+
|
38 |
+
return $this->elements[$name]->render();
|
39 |
+
}
|
40 |
+
|
41 |
+
public function label($name)
|
42 |
+
{
|
43 |
+
if (!isset($this->elements[$name]))
|
44 |
+
{
|
45 |
+
return false;
|
46 |
+
}
|
47 |
+
|
48 |
+
return $this->elements[$name]->prepareLabel();
|
49 |
+
}
|
50 |
+
|
51 |
+
public function tooltip($name)
|
52 |
+
{
|
53 |
+
if (!isset($this->elements[$name]))
|
54 |
+
{
|
55 |
+
return false;
|
56 |
+
}
|
57 |
+
|
58 |
+
return $this->elements[$name]->prepareTooltip();
|
59 |
+
}
|
60 |
+
}
|
includes/admin/admin-actions.php
CHANGED
@@ -43,11 +43,19 @@ add_action('quads_close_upgrade_notice', 'quads_close_upgrade_notice');
|
|
43 |
/**
|
44 |
* Close vi notice and do not show again
|
45 |
*/
|
46 |
-
function quads_close_vi_notice(){
|
47 |
-
update_option ('quads_close_vi_notice', 'yes');
|
48 |
-
delete_option('quads_show_vi_notice_later');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
}
|
50 |
-
add_action('
|
51 |
|
52 |
/**
|
53 |
* Close vi update notice and show it one week later again
|
@@ -61,3 +69,81 @@ function quads_show_vi_notice_later(){
|
|
61 |
}
|
62 |
add_action('quads_show_vi_notice_later', 'quads_show_vi_notice_later');
|
63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
/**
|
44 |
* Close vi notice and do not show again
|
45 |
*/
|
46 |
+
//function quads_close_vi_notice(){
|
47 |
+
// update_option ('quads_close_vi_notice', 'yes');
|
48 |
+
// delete_option('quads_show_vi_notice_later');
|
49 |
+
//}
|
50 |
+
//add_action('quads_close_vi_notice', 'quads_close_vi_notice');
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Close vi welcome notice and do not show again
|
54 |
+
*/
|
55 |
+
function quads_close_vi_welcome_notice(){
|
56 |
+
update_option ('quads_close_vi_welcome_notice', 'yes');
|
57 |
}
|
58 |
+
add_action('quads_close_vi_welcome_notice', 'quads_close_vi_welcome_notice');
|
59 |
|
60 |
/**
|
61 |
* Close vi update notice and show it one week later again
|
69 |
}
|
70 |
add_action('quads_show_vi_notice_later', 'quads_show_vi_notice_later');
|
71 |
|
72 |
+
/**
|
73 |
+
* Save vi token
|
74 |
+
*/
|
75 |
+
function quads_save_vi_token(){
|
76 |
+
global $quads_options;
|
77 |
+
|
78 |
+
if (empty($_POST['token'])){
|
79 |
+
echo json_encode( array("status" => "failed") );
|
80 |
+
exit;
|
81 |
+
}
|
82 |
+
|
83 |
+
// Save token before trying to create ads.txt
|
84 |
+
update_option('quads_vi_token', $_POST['token']);
|
85 |
+
|
86 |
+
$vi = new wpquads\vi();
|
87 |
+
|
88 |
+
if($vi->createAdsTxt()){
|
89 |
+
set_transient('quads_vi_ads_txt_notice', true, 300);
|
90 |
+
delete_transient('quads_vi_ads_txt_error');
|
91 |
+
} else {
|
92 |
+
set_transient('quads_vi_ads_txt_error', true, 300);
|
93 |
+
delete_transient('quads_vi_ads_txt_notice');
|
94 |
+
}
|
95 |
+
|
96 |
+
|
97 |
+
// Create AdSense ads.txt entries
|
98 |
+
$adsense = new \wpquads\adsense($quads_options);
|
99 |
+
$adsense->writeAdsTxt();
|
100 |
+
|
101 |
+
//sleep(5);
|
102 |
+
echo json_encode( array("status" => "success", "token" => $_POST['token']) );
|
103 |
+
exit;
|
104 |
+
}
|
105 |
+
add_action( 'wp_ajax_quads_save_vi_token', 'quads_save_vi_token' );
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Save vi ad settings and create ad code
|
109 |
+
*/
|
110 |
+
function quads_save_vi_ads(){
|
111 |
+
global $quads;
|
112 |
+
|
113 |
+
$return = $quads->vi->setAdCode();
|
114 |
+
|
115 |
+
if ($return){
|
116 |
+
wp_die($return);
|
117 |
+
} else {
|
118 |
+
wp_die(array('status' => 'error', 'message' => 'Unknown API Error. Can not get vi ad code'));
|
119 |
+
}
|
120 |
+
}
|
121 |
+
add_action( 'wp_ajax_quads_save_vi_ads', 'quads_save_vi_ads' );
|
122 |
+
|
123 |
+
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Logout of vi
|
127 |
+
*/
|
128 |
+
function quads_logout_vi(){
|
129 |
+
delete_option('quads_vi_token');
|
130 |
+
}
|
131 |
+
add_action('quads_logout_vi', 'quads_logout_vi');
|
132 |
+
|
133 |
+
/**
|
134 |
+
* Hide ads txt information notice
|
135 |
+
*/
|
136 |
+
function quads_close_ads_txt_notice(){
|
137 |
+
delete_transient('quads_ads_txt_notice');
|
138 |
+
}
|
139 |
+
add_action('quads_close_ads_txt_notice', 'quads_close_ads_txt_notice');
|
140 |
+
|
141 |
+
/**
|
142 |
+
* Hide ads txt error notice
|
143 |
+
*/
|
144 |
+
function quads_close_ads_txt_error(){
|
145 |
+
delete_transient('quads_ads_txt_error');
|
146 |
+
}
|
147 |
+
add_action('quads_close_ads_txt_error', 'quads_close_ads_txt_error');
|
148 |
+
|
149 |
+
|
includes/admin/admin-notices.php
CHANGED
@@ -35,6 +35,10 @@ function quads_admin_messages() {
|
|
35 |
quads_update_notice_1_5_3();
|
36 |
|
37 |
echo quads_get_vi_notice();
|
|
|
|
|
|
|
|
|
38 |
|
39 |
if( quads_is_admin_page() ) {
|
40 |
echo '<div class="notice notice-error" id="wpquads-adblock-notice" style="display:none;">' . sprintf( __( '<strong><p>You need to deactivate your ad blocker to use WP QUADS settings.</strong> Your ad blocker browser extension is removing WP QUADS css ressources and is breaking the settings screen! Deactivating the ad blocker will resolve it. WP QUADS is used on 60.000 websites and is into focus of the big adblocking companies. That\'s the downside of our success but nothing you need to worry about.</p>', 'quick-adsense-reloaded' ), admin_url() . 'admin.php?page=quads-settings#quads_settingsgeneral_header' ) . '</div>';
|
@@ -265,7 +269,7 @@ function quads_update_notice() {
|
|
265 |
*/
|
266 |
function quads_update_notice_v2(){
|
267 |
|
268 |
-
if( quads_is_pro_active() && (version_compare( QUADS_PRO_VERSION, '1.3.6', '<' ) ) ) {
|
269 |
$message = sprintf( __( 'You need to update <strong>WP QUADS PRO to version 1.3.6</strong> or higher. Your version of <strong>WP QUADS Pro</strong> is '.QUADS_PRO_VERSION. '.<br>WP QUADS Pro '.QUADS_PRO_VERSION.' supports unlimited amount of ads. <br>Updating requires a valid <a href="%s" target="_new">license key</a>.', 'quick-adsense-reloaded' ), 'https://wpquads.com/#buy-wpquads?utm_source=plugin_notice&utm_medium=admin&utm_campaign=activate_license' );
|
270 |
?>
|
271 |
<div class="notice notice-error">
|
@@ -399,31 +403,100 @@ function quads_ads_empty() {
|
|
399 |
return false;
|
400 |
}
|
401 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
402 |
/**
|
403 |
* Return VI admin notice
|
404 |
* @return string
|
405 |
*/
|
406 |
function quads_get_vi_notice() {
|
407 |
-
|
|
|
|
|
408 |
return false;
|
409 |
}
|
410 |
|
411 |
-
$
|
412 |
-
|
413 |
-
|
414 |
|
415 |
-
$
|
416 |
<section class="quads-banner-content">
|
417 |
<div class="quads-banner-columns">
|
418 |
-
<main class="quads-banner-main"><p>' .
|
419 |
-
|
420 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
421 |
</div>
|
422 |
-
<aside class="quads-banner-close"><div style="margin-top:5px;"><a href="'.admin_url().'admin.php?page=quads-settings&quads-action=
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
423 |
</section>
|
424 |
</div>';
|
425 |
|
426 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
427 |
}
|
428 |
|
429 |
/**
|
@@ -447,3 +520,103 @@ function quads_show_vi_notice_again() {
|
|
447 |
return true;
|
448 |
}
|
449 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
quads_update_notice_1_5_3();
|
36 |
|
37 |
echo quads_get_vi_notice();
|
38 |
+
|
39 |
+
echo quads_show_vi_notices();
|
40 |
+
|
41 |
+
quads_show_ads_txt_notice();
|
42 |
|
43 |
if( quads_is_admin_page() ) {
|
44 |
echo '<div class="notice notice-error" id="wpquads-adblock-notice" style="display:none;">' . sprintf( __( '<strong><p>You need to deactivate your ad blocker to use WP QUADS settings.</strong> Your ad blocker browser extension is removing WP QUADS css ressources and is breaking the settings screen! Deactivating the ad blocker will resolve it. WP QUADS is used on 60.000 websites and is into focus of the big adblocking companies. That\'s the downside of our success but nothing you need to worry about.</p>', 'quick-adsense-reloaded' ), admin_url() . 'admin.php?page=quads-settings#quads_settingsgeneral_header' ) . '</div>';
|
269 |
*/
|
270 |
function quads_update_notice_v2(){
|
271 |
|
272 |
+
if( quads_is_pro_active() && (version_compare( QUADS_PRO_VERSION, '1.3.6', '<' ) ) && quads_is_admin_page() ) {
|
273 |
$message = sprintf( __( 'You need to update <strong>WP QUADS PRO to version 1.3.6</strong> or higher. Your version of <strong>WP QUADS Pro</strong> is '.QUADS_PRO_VERSION. '.<br>WP QUADS Pro '.QUADS_PRO_VERSION.' supports unlimited amount of ads. <br>Updating requires a valid <a href="%s" target="_new">license key</a>.', 'quick-adsense-reloaded' ), 'https://wpquads.com/#buy-wpquads?utm_source=plugin_notice&utm_medium=admin&utm_campaign=activate_license' );
|
274 |
?>
|
275 |
<div class="notice notice-error">
|
403 |
return false;
|
404 |
}
|
405 |
|
406 |
+
/**
|
407 |
+
* Return VI admin notice
|
408 |
+
* @return string
|
409 |
+
*/
|
410 |
+
//function quads_get_vi_notice() {
|
411 |
+
// if (false !== get_option ('quads_close_vi_notice') && false == quads_show_vi_notice_again() ) {
|
412 |
+
// return false;
|
413 |
+
// }
|
414 |
+
//
|
415 |
+
// $html = '<div class="quads-banner-wrapper">
|
416 |
+
// <section class="quads-banner-content">
|
417 |
+
// <div class="quads-banner-columns">
|
418 |
+
// <main class="quads-banner-main"><p>' . sprintf(__('Available soon: the upcoming update to <strong>WP QUADS</strong> will feature a native video ad unit powered by video intelligence that will results in up to 10x higher revenue (RPM) </p>'
|
419 |
+
// . '<p><a href="%s" target="_blank" rel="external nofollow">https://www.vi.ai/publisher-video-monetization</a>'), 'https://www.vi.ai/publisher-video-monetization/?utm_source=WordPress&utm_medium=Plugin%20blurb&utm_campaign=wpquads') . '</p></main>
|
420 |
+
// <aside class="quads-banner-sidebar-first"><p><img src="' . QUADS_PLUGIN_URL . 'assets/images/vi_quads_logo.png" width="152" height="70"></p></aside>
|
421 |
+
// <aside class="quads-banner-sidebar-second"><p style="text-align:center;"><a href="https://www.vi.ai/publisher-video-monetization/?utm_source=WordPress&utm_medium=Plugin%20blurb&utm_campaign=wpquads" class="quads-button-primary" target="_blank" rel="external nofollow">Learn More</a><a href="'.admin_url().'admin.php?page=quads-settings&quads-action=show_vi_notice_later" style="line-height:25px;"><br>Show again later</a></p></aside>
|
422 |
+
// </div>
|
423 |
+
// <aside class="quads-banner-close"><div style="margin-top:5px;"><a href="'.admin_url().'admin.php?page=quads-settings&quads-action=close_vi_notice" class="quads-notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></a></div></aside>
|
424 |
+
// </section>
|
425 |
+
//</div>';
|
426 |
+
//
|
427 |
+
// return $html;
|
428 |
+
//}
|
429 |
/**
|
430 |
* Return VI admin notice
|
431 |
* @return string
|
432 |
*/
|
433 |
function quads_get_vi_notice() {
|
434 |
+
global $quads;
|
435 |
+
|
436 |
+
if (false !== get_option ('quads_close_vi_welcome_notice') ) {
|
437 |
return false;
|
438 |
}
|
439 |
|
440 |
+
$mail = get_option('admin_email');
|
441 |
+
$domain = $quads->vi->getDomain();
|
442 |
+
|
443 |
|
444 |
+
$white = '<div class="quads-banner-wrapper">
|
445 |
<section class="quads-banner-content">
|
446 |
<div class="quads-banner-columns">
|
447 |
+
<main class="quads-banner-main"><p>' .
|
448 |
+
sprintf(
|
449 |
+
__('This update features vi stories from <strong>video intelligence</strong>. This video player will supply you with both video
|
450 |
+
content and video advertising.<br>
|
451 |
+
To begin earning, visit the WP QUADS plugin page, <a href="%1$s" target="_blank" class="quads-vi-welcome-white" style="text-decoration: none;border-bottom:3px solid yellow;font-weight: bold;color:black;">sign up</a> to vi stories and <a href="%2$s" class="quads-vi-welcome-white" style="text-decoration: none;border-bottom:3px solid yellow;font-weight: bold;color:black;">place the ad live now!</a> Read the <a href="%3$s" target="_blank">FAQ</a>.
|
452 |
+
<p style="font-size:10px;">By clicking <strong>sign up</strong> you agree to send your current domain, email and affiliate ID to video intelligence & WP QUADS</p>', 'quick-adsense-reloaed'),
|
453 |
+
'https://www.vi.ai/publisher-registration/?aid=WP_Quads&domain='.$domain.'&email='.$mail.'&utm_source=Wordpress&utm_medium=wp%20quads&utm_campaign=white',
|
454 |
+
admin_url() . 'admin.php?page=quads-settings#quads_settingsvi_header',
|
455 |
+
'https://www.vi.ai/publisherfaq/?aid=WP_Quads&utm_source=Wordpress&utm_medium=wp%20quads&utm_campaign=white'
|
456 |
+
)
|
457 |
+
. '</p></main>
|
458 |
+
<!--<aside class="quads-banner-sidebar-first"><p><a href="https://www.vi.ai/?utm_source=Wordpress&utm_medium=wp%20quads&utm_campaign=white"><img src="' . QUADS_PLUGIN_URL . 'assets/images/vi_quads_logo.png" width="168" height="72"></a></p></aside>//-->
|
459 |
+
<aside class="quads-banner-sidebar-second"><p style="text-align:center;"><a href="https://www.vi.ai/?aid=WP_Quads&utm_source=Wordpress&utm_medium=wp%20quads&utm_campaign=white"><img src="' . QUADS_PLUGIN_URL . 'assets/images/vi-logo-white.png" width="168" height="72"></a></p></aside>
|
460 |
</div>
|
461 |
+
<aside class="quads-banner-close"><div style="margin-top:5px;"><a href="'.admin_url().'admin.php?page=quads-settings&quads-action=close_vi_welcome_notice" class="quads-notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></a></div></aside>
|
462 |
+
</section>
|
463 |
+
</div>';
|
464 |
+
|
465 |
+
|
466 |
+
$black = '<div class="quads-banner-wrapper" style="background-color:black;">
|
467 |
+
<section class="quads-banner-content">
|
468 |
+
<div class="quads-banner-columns">
|
469 |
+
<main class="quads-banner-main" style="color:white;"><p>' .
|
470 |
+
sprintf(
|
471 |
+
__('This update features vi stories from <strong>video intelligence</strong>. This video player will supply you with both video
|
472 |
+
content and video advertising.<br>
|
473 |
+
To begin earning, visit the WP QUADS plugin page, <a href="%1$s" target="_blank" class="quads-vi-welcome-black" style="text-decoration: none;border-bottom:3px solid yellow;font-weight: bold;color:white;">sign up</a> to vi stories and <a href="%2$s" class="quads-vi-welcome-black" style="text-decoration: none;border-bottom:3px solid yellow;font-weight: bold;color:white;">place the ad live now!</a> Read the <a href="%3$s" target="_blank">FAQ</a>.
|
474 |
+
<p style="font-size:10px;">By clicking <strong>sign up</strong> you agree to send your current domain, email and affiliate ID to video intelligence & WP QUADS</p>', 'quick-adsense-reloaded'),
|
475 |
+
'https://www.vi.ai/publisher-registration/?aid=WP_Quads&domain='.$domain.'&email='.$mail.'&utm_source=Wordpress&utm_medium=wp%20quads&utm_campaign=white',
|
476 |
+
admin_url() . 'admin.php?page=quads-settings#quads_settingsvi_header',
|
477 |
+
'https://www.vi.ai/publisherfaq/?aid=WP_Quads&utm_source=Wordpress&utm_medium=wp%20quads&utm_campaign=white'
|
478 |
+
)
|
479 |
+
. '</p></main>
|
480 |
+
<!--<aside class="quads-banner-sidebar-first"><p><a href="https://www.vi.ai/?utm_source=Wordpress&utm_medium=wp%20quads&utm_campaign=white"><img src="' . QUADS_PLUGIN_URL . 'assets/images/vi_quads_logo.png" width="168" height="72"></a></p></aside>//-->
|
481 |
+
<aside class="quads-banner-sidebar-second"><p style="text-align:center;"><a href="https://www.vi.ai/?aid=WP_Quads&utm_source=Wordpress&utm_medium=wp%20quads&utm_campaign=white"><img src="' . QUADS_PLUGIN_URL . 'assets/images/vi-logo-black.png" width="168" height="72"></a></p></aside>
|
482 |
+
</div>
|
483 |
+
<aside class="quads-banner-close"><div style="margin-top:5px;"><a href="'.admin_url().'admin.php?page=quads-settings&quads-action=close_vi_welcome_notice" class="quads-notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></a></div></aside>
|
484 |
</section>
|
485 |
</div>';
|
486 |
|
487 |
+
$variant = get_option('quads_vi_variant');
|
488 |
+
|
489 |
+
switch ($variant) {
|
490 |
+
case 'a':
|
491 |
+
return $white;
|
492 |
+
break;
|
493 |
+
case 'b':
|
494 |
+
return $black;
|
495 |
+
break;
|
496 |
+
default:
|
497 |
+
return $white;
|
498 |
+
break;
|
499 |
+
}
|
500 |
}
|
501 |
|
502 |
/**
|
520 |
return true;
|
521 |
}
|
522 |
}
|
523 |
+
|
524 |
+
/**
|
525 |
+
* Show all vi notices
|
526 |
+
*/
|
527 |
+
function quads_show_vi_notices(){
|
528 |
+
global $quads, $quads_options;
|
529 |
+
|
530 |
+
if (!quads_is_admin_page())
|
531 |
+
return false;
|
532 |
+
|
533 |
+
// show ad.txt update notice
|
534 |
+
if (get_transient('quads_vi_ads_txt_notice')) {
|
535 |
+
$notice['message'] = '<strong>ADS.TXT has been added</strong><br><br><strong>WP QUADS</strong> has updated your ads.txt '
|
536 |
+
. 'file with lines that declare video inteligence as a legitmate seller of your inventory and enables you to make more money through video inteligence. <a href="https://www.vi.ai/publisher-video-monetization/?utm_source=WordPress&utm_medium=Plugin%20blurb&utm_campaign=wpquads" target="blank" rel="external nofollow">FAQ</a>';
|
537 |
+
$notice['type'] = 'update-nag';
|
538 |
+
$adsUpdated = new wpquads\template('/includes/vendor/vi/views/notices', $notice);
|
539 |
+
echo $adsUpdated->render();
|
540 |
+
}
|
541 |
+
|
542 |
+
// show ad.txt update notice
|
543 |
+
if (get_transient('quads_vi_ads_txt_error')) {
|
544 |
+
|
545 |
+
|
546 |
+
// Check if adsense is used and add the adsense publisherId to ads.txt blurb as well
|
547 |
+
$adsense = new wpquads\adsense($quads_options);
|
548 |
+
$adsensePublisherId = $adsense->getPublisherID();
|
549 |
+
|
550 |
+
$adsenseAdsTxtText = '';
|
551 |
+
if ($adsensePublisherId){
|
552 |
+
$adsenseAdsTxtText = "google.com " . $adsensePublisherId . " DIRECT, f08c47fec0942fa0";
|
553 |
+
}
|
554 |
+
|
555 |
+
// ads.txt content
|
556 |
+
$notice['message'] = "<p><strong>ADS.TXT couldn't be added</strong><br><br>Important note: WP QUADS hasn't been able to update your ads.txt file automatically. Please make sure to enter the following line manually into <br><strong>" . get_home_path() . "ads.txt</strong>:"
|
557 |
+
. "<p>"
|
558 |
+
. "<pre>vi.ai " . $quads->vi->getPublisherId() . " DIRECT # 41b5eef6<br>"
|
559 |
+
. $adsenseAdsTxtText
|
560 |
+
. "</pre></p>"
|
561 |
+
. "Only by doing so you are able to make more money through video inteligence.</p>";
|
562 |
+
$notice['type'] = 'error';
|
563 |
+
|
564 |
+
// render blurb
|
565 |
+
$adsTxtError = new wpquads\template('/includes/vendor/vi/views/notices', $notice);
|
566 |
+
echo $adsTxtError->render();
|
567 |
+
}
|
568 |
+
|
569 |
+
}
|
570 |
+
|
571 |
+
/**
|
572 |
+
* Show a ads.txt notices
|
573 |
+
*/
|
574 |
+
function quads_show_ads_txt_notice(){
|
575 |
+
global $quads, $quads_options;
|
576 |
+
|
577 |
+
if (!quads_is_admin_page())
|
578 |
+
return false;
|
579 |
+
|
580 |
+
// show ad.txt update notice
|
581 |
+
if (get_transient('quads_ads_txt_notice')) {
|
582 |
+
$notice['message'] = '<strong>ADS.TXT has been added</strong><br><br><strong>WP QUADS</strong> has updated the file '.ABSPATH .'ads.txt '
|
583 |
+
. 'file with lines that declare Google.com as a legitmate seller of your inventory and is recommended setting by AdSense.<br><a href="https://wpquads.com/make-more-revenue-by-using-an-ads-txt-in-your-website-root-domain/" target="blank" rel="external nofollow">What is ads.txt?</a>';
|
584 |
+
$notice['type'] = 'update-nag';
|
585 |
+
$notice['action'] = 'close_ads_txt_notice';
|
586 |
+
$adsUpdated = new wpquads\template('/includes/admin/views/notices', $notice);
|
587 |
+
echo $adsUpdated->render();
|
588 |
+
}
|
589 |
+
|
590 |
+
// show ads.txt error notice
|
591 |
+
if (get_transient('close_ads_txt_error')) {
|
592 |
+
|
593 |
+
// Check if adsense is used and add the adsense publisherId to ads.txt blurb as well
|
594 |
+
$adsense = new wpquads\adsense($quads_options);
|
595 |
+
$adsensePublisherId = $adsense->getPublisherID();
|
596 |
+
|
597 |
+
$adsenseAdsTxtText = '';
|
598 |
+
if ($adsensePublisherId){
|
599 |
+
$adsenseAdsTxtText = "google.com " . $adsensePublisherId . " DIRECT, f08c47fec0942fa0";
|
600 |
+
}
|
601 |
+
|
602 |
+
$viAdsTxtText = '';
|
603 |
+
if ($quads->vi->getPublisherId()) {
|
604 |
+
$viAdsTxtText = $quads->vi->getAdsTxtContent();
|
605 |
+
}
|
606 |
+
|
607 |
+
// ads.txt content
|
608 |
+
$notice['message'] = "<p><strong>ADS.TXT couldn't be updated</strong><br><br>Important note: WP QUADS hasn't been able to update your ads.txt file automatically. Please make sure to enter the following line manually into <strong>" . get_home_path() . "ads.txt</strong>:"
|
609 |
+
. "<p>"
|
610 |
+
. "<pre>".$viAdsTxtText."<br>"
|
611 |
+
. $adsenseAdsTxtText
|
612 |
+
. "</pre></p>"
|
613 |
+
. "Only by doing so AdSense ads are shown on your site.</p>";
|
614 |
+
$notice['type'] = 'error';
|
615 |
+
$notice['action'] = 'quads_ads_txt_error';
|
616 |
+
|
617 |
+
// render blurb
|
618 |
+
$adsTxtError = new wpquads\template('/includes/admin/views/notices', $notice);
|
619 |
+
echo $adsTxtError->render();
|
620 |
+
}
|
621 |
+
|
622 |
+
}
|
includes/admin/adsTxt.php
ADDED
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace wpquads;
|
4 |
+
|
5 |
+
class adsTxt {
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Content to add
|
9 |
+
* @var string
|
10 |
+
*/
|
11 |
+
private $content;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Pattern to search and replace
|
15 |
+
* @var string
|
16 |
+
*/
|
17 |
+
private $pattern;
|
18 |
+
|
19 |
+
/**
|
20 |
+
*
|
21 |
+
* @param array $content to add
|
22 |
+
* @param string $pattern for content to remove
|
23 |
+
*/
|
24 |
+
public function __construct($content = array(), $pattern = '') {
|
25 |
+
$this->content = $content;
|
26 |
+
|
27 |
+
$this->pattern = $pattern;
|
28 |
+
|
29 |
+
$this->filename = ABSPATH . 'ads.txt';
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Check if we need to create an ads.txt
|
34 |
+
* @return boolean
|
35 |
+
*/
|
36 |
+
public function needsAdsTxt(){
|
37 |
+
if (!is_file($this->filename)){
|
38 |
+
return true;
|
39 |
+
}
|
40 |
+
|
41 |
+
// get everything from ads.txt and convert to array
|
42 |
+
$contentText = file_get_contents($this->filename);
|
43 |
+
|
44 |
+
// Pattern not find
|
45 |
+
if (strpos($contentText, $this->pattern) === false) {
|
46 |
+
return true;
|
47 |
+
} else {
|
48 |
+
return false;
|
49 |
+
}
|
50 |
+
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Write ads.txt
|
55 |
+
* @return bool
|
56 |
+
*/
|
57 |
+
public function writeAdsTxt() {
|
58 |
+
if (false !== file_put_contents($this->filename, $this->getContent())) {
|
59 |
+
// show notice that ads.txt has been created
|
60 |
+
set_transient('quads_vi_ads_txt_notice', true, 300);
|
61 |
+
return true;
|
62 |
+
}
|
63 |
+
// show error admin notice
|
64 |
+
set_transient('quads_vi_ads_txt_error', true, 300);
|
65 |
+
return false;
|
66 |
+
}
|
67 |
+
|
68 |
+
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Create and return the content
|
72 |
+
* @return string
|
73 |
+
*/
|
74 |
+
public function getContent() {
|
75 |
+
// ads.txt does not exists
|
76 |
+
if (!is_file($this->filename)) {
|
77 |
+
return $this->content . "\r\n";
|
78 |
+
}
|
79 |
+
|
80 |
+
// get everything from ads.txt and convert to array
|
81 |
+
$contentText = file_get_contents($this->filename);
|
82 |
+
|
83 |
+
// Change all \r\n to \n
|
84 |
+
//$contentText = str_replace(array("\r\n", "\n"), '', $contentText);
|
85 |
+
|
86 |
+
//$content = array_filter(explode("\n", trim($contentText)), 'trim');
|
87 |
+
$content = explode("\n", $contentText);
|
88 |
+
|
89 |
+
// Pattern not find so append new content to ads.txt existing content
|
90 |
+
if (strpos($contentText, $this->pattern) === false) {
|
91 |
+
return $contentText . "\r\n" . $this->content;
|
92 |
+
}
|
93 |
+
|
94 |
+
// Pattern found, so remove everything first and add new stuff from api response
|
95 |
+
$newContent = '';
|
96 |
+
foreach ($content as $entry) {
|
97 |
+
if (strpos($entry, $this->pattern) !== false) {
|
98 |
+
continue;
|
99 |
+
}
|
100 |
+
$newContent .= str_replace(array("\r", "\n"), '', $entry) . "\r\n";
|
101 |
+
|
102 |
+
}
|
103 |
+
return $newContent . $this->content;
|
104 |
+
}
|
105 |
+
|
106 |
+
}
|
includes/admin/settings/display-settings.php
CHANGED
@@ -154,7 +154,9 @@ function quads_is_excluded_title($string){
|
|
154 |
'ad7_widget',
|
155 |
'ad8_widget',
|
156 |
'ad9_widget',
|
157 |
-
'ad10_widget'
|
|
|
|
|
158 |
);
|
159 |
|
160 |
if (in_array($string, $haystack)){
|
@@ -224,9 +226,7 @@ function quads_options_page() {
|
|
224 |
<?php
|
225 |
settings_fields( 'quads_settings' );
|
226 |
quads_do_settings_fields( 'quads_settings_' . $active_tab, 'quads_settings_' . $active_tab );
|
227 |
-
?>
|
228 |
-
<!--</table>-->
|
229 |
-
|
230 |
<?php settings_errors(); ?>
|
231 |
<?php
|
232 |
// do not show save button on add-on page
|
@@ -242,7 +242,9 @@ function quads_options_page() {
|
|
242 |
}
|
243 |
?>
|
244 |
</form>
|
|
|
245 |
<?php
|
|
|
246 |
if ($active_tab !== 'addons' && $active_tab !== 'licenses'){
|
247 |
echo sprintf( __( '<strong>If you like this plugin please do us a BIG favor and give us a 5 star rating <a href="%s" target="_blank">here</a> . If you have issues, open a <a href="%2s" target="_blank">support ticket</a>, so that we can sort it out. Thank you!</strong>', 'quick-adsense-reloaded' ),
|
248 |
'https://wordpress.org/support/plugin/quick-adsense-reloaded/reviews/#new-post',
|
@@ -253,6 +255,7 @@ function quads_options_page() {
|
|
253 |
);
|
254 |
}
|
255 |
?>
|
|
|
256 |
</div> <!-- new //-->
|
257 |
<?php quads_get_advertising(); ?>
|
258 |
</div><!-- #tab_container-->
|
154 |
'ad7_widget',
|
155 |
'ad8_widget',
|
156 |
'ad9_widget',
|
157 |
+
'ad10_widget',
|
158 |
+
'vi_header',
|
159 |
+
'vi_signup'
|
160 |
);
|
161 |
|
162 |
if (in_array($string, $haystack)){
|
226 |
<?php
|
227 |
settings_fields( 'quads_settings' );
|
228 |
quads_do_settings_fields( 'quads_settings_' . $active_tab, 'quads_settings_' . $active_tab );
|
229 |
+
?>
|
|
|
|
|
230 |
<?php settings_errors(); ?>
|
231 |
<?php
|
232 |
// do not show save button on add-on page
|
242 |
}
|
243 |
?>
|
244 |
</form>
|
245 |
+
<div id="quads-footer">
|
246 |
<?php
|
247 |
+
|
248 |
if ($active_tab !== 'addons' && $active_tab !== 'licenses'){
|
249 |
echo sprintf( __( '<strong>If you like this plugin please do us a BIG favor and give us a 5 star rating <a href="%s" target="_blank">here</a> . If you have issues, open a <a href="%2s" target="_blank">support ticket</a>, so that we can sort it out. Thank you!</strong>', 'quick-adsense-reloaded' ),
|
250 |
'https://wordpress.org/support/plugin/quick-adsense-reloaded/reviews/#new-post',
|
255 |
);
|
256 |
}
|
257 |
?>
|
258 |
+
</div>
|
259 |
</div> <!-- new //-->
|
260 |
<?php quads_get_advertising(); ?>
|
261 |
</div><!-- #tab_container-->
|
includes/admin/settings/register-settings.php
CHANGED
@@ -51,6 +51,8 @@ function quads_get_settings() {
|
|
51 |
$settings = array_merge( $general_settings, $ext_settings, $imexport_settings, $help_settings );
|
52 |
|
53 |
update_option( 'quads_settings', $settings );
|
|
|
|
|
54 |
}
|
55 |
return apply_filters( 'quads_get_settings', $settings );
|
56 |
}
|
@@ -97,12 +99,12 @@ function quads_register_settings() {
|
|
97 |
|
98 |
// Store adsense values
|
99 |
quads_store_adsense_args();
|
|
|
100 |
// Store AdSense value
|
101 |
//quads_fix_ad_not_shown();
|
102 |
// Creates our settings in the options table
|
103 |
register_setting( 'quads_settings', 'quads_settings', 'quads_settings_sanitize' );
|
104 |
}
|
105 |
-
|
106 |
add_action( 'admin_init', 'quads_register_settings' );
|
107 |
|
108 |
/**
|
@@ -178,12 +180,29 @@ function quads_get_registered_settings() {
|
|
178 |
"options" => quads_get_post_types(),
|
179 |
"placeholder" => __( "Select Post Type", "quick-adsense-reloaded" )
|
180 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
181 |
array(
|
182 |
'id' => 'quicktags',
|
183 |
'name' => __( 'Quicktags', 'quick-adsense-reloaded' ),
|
184 |
'desc' => __( '', 'quick-adsense-reloaded' ),
|
185 |
'type' => 'quicktags'
|
186 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
187 |
/* 'load_scripts_footer' => array(
|
188 |
'id' => 'load_scripts_footer',
|
189 |
'name' => __( 'JS Load Order', 'quick-adsense-reloaded' ),
|
@@ -2047,13 +2066,10 @@ function quads_adsense_code_callback( $args ) {
|
|
2047 |
global $quads_options;
|
2048 |
|
2049 |
foreach ( $quads_options as $id => $ads ) {
|
2050 |
-
//$quads_options['ads'][$key]['code'];
|
2051 |
-
//echo 'id:' . $id . ' - ' . $ads['ads'];
|
2052 |
if (!is_array($ads)){
|
2053 |
continue;
|
2054 |
}
|
2055 |
foreach ($ads as $key => $value) {
|
2056 |
-
//echo $key . $value['code'] . '<br>';
|
2057 |
if( is_array( $value ) && array_key_exists( 'code', $value ) && !empty( $value['code'] ) ) {
|
2058 |
|
2059 |
//check to see if it is google ad
|
@@ -2158,4 +2174,94 @@ function quads_adsense_code_callback( $args ) {
|
|
2158 |
$html .= '</select>';
|
2159 |
echo $html;
|
2160 |
}
|
2161 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
$settings = array_merge( $general_settings, $ext_settings, $imexport_settings, $help_settings );
|
52 |
|
53 |
update_option( 'quads_settings', $settings );
|
54 |
+
|
55 |
+
|
56 |
}
|
57 |
return apply_filters( 'quads_get_settings', $settings );
|
58 |
}
|
99 |
|
100 |
// Store adsense values
|
101 |
quads_store_adsense_args();
|
102 |
+
|
103 |
// Store AdSense value
|
104 |
//quads_fix_ad_not_shown();
|
105 |
// Creates our settings in the options table
|
106 |
register_setting( 'quads_settings', 'quads_settings', 'quads_settings_sanitize' );
|
107 |
}
|
|
|
108 |
add_action( 'admin_init', 'quads_register_settings' );
|
109 |
|
110 |
/**
|
180 |
"options" => quads_get_post_types(),
|
181 |
"placeholder" => __( "Select Post Type", "quick-adsense-reloaded" )
|
182 |
),
|
183 |
+
array(
|
184 |
+
'id' => 'hide_ajax',
|
185 |
+
'name' => __( 'Hide Ads From Ajax Requests', 'quick-adsense-reloaded' ),
|
186 |
+
'desc' => __( 'If your site is using ajax based infinite loading it might happen that ads are loaded without any further post content. Disable this here.', 'quick-adsense-reloaded' ),
|
187 |
+
'type' => 'checkbox'
|
188 |
+
),
|
189 |
array(
|
190 |
'id' => 'quicktags',
|
191 |
'name' => __( 'Quicktags', 'quick-adsense-reloaded' ),
|
192 |
'desc' => __( '', 'quick-adsense-reloaded' ),
|
193 |
'type' => 'quicktags'
|
194 |
),
|
195 |
+
array(
|
196 |
+
'id' => 'vi_header',
|
197 |
+
'name' => '<strong>' . __( 'New: vi', 'quick-adsense-reloaded' ) . '</strong>',
|
198 |
+
'desc' => '<strong>Native video ad units powered by video intelligence</strong>',
|
199 |
+
'type' => 'header'
|
200 |
+
),
|
201 |
+
array(
|
202 |
+
'id' => 'vi_signup',
|
203 |
+
'name' =>__( '', 'quick-adsense-reloaded' ) . '</strong>',
|
204 |
+
'type' => 'vi_signup'
|
205 |
+
),
|
206 |
/* 'load_scripts_footer' => array(
|
207 |
'id' => 'load_scripts_footer',
|
208 |
'name' => __( 'JS Load Order', 'quick-adsense-reloaded' ),
|
2066 |
global $quads_options;
|
2067 |
|
2068 |
foreach ( $quads_options as $id => $ads ) {
|
|
|
|
|
2069 |
if (!is_array($ads)){
|
2070 |
continue;
|
2071 |
}
|
2072 |
foreach ($ads as $key => $value) {
|
|
|
2073 |
if( is_array( $value ) && array_key_exists( 'code', $value ) && !empty( $value['code'] ) ) {
|
2074 |
|
2075 |
//check to see if it is google ad
|
2174 |
$html .= '</select>';
|
2175 |
echo $html;
|
2176 |
}
|
2177 |
+
|
2178 |
+
/**
|
2179 |
+
* VI Integration
|
2180 |
+
* @global type $quads
|
2181 |
+
*
|
2182 |
+
*/
|
2183 |
+
function quads_vi_signup_callback() {
|
2184 |
+
global $quads, $quads_options;
|
2185 |
+
|
2186 |
+
$header = new \wpquads\template('/includes/vendor/vi/views/partials/header', array());
|
2187 |
+
$footer = new \wpquads\template('/includes/vendor/vi/views/partials/footer', array());
|
2188 |
+
$error = new \wpquads\template('/includes/vendor/vi/views/error', array());
|
2189 |
+
|
2190 |
+
// Try to initially load vi settings
|
2191 |
+
$settings = $quads->vi->getSettings();
|
2192 |
+
if ( false === $settings || empty($settings)){
|
2193 |
+
if (!$quads->vi->setSettings()) {
|
2194 |
+
echo $header->render();
|
2195 |
+
echo $error->render();
|
2196 |
+
echo $footer->render();
|
2197 |
+
return true;
|
2198 |
+
}
|
2199 |
+
}
|
2200 |
+
|
2201 |
+
$data = !empty($quads->vi->getSettings()->data) ? (array) $quads->vi->getSettings()->data : array();
|
2202 |
+
|
2203 |
+
$data['jsTag'] = $quads->vi->getAdCode();
|
2204 |
+
|
2205 |
+
$logged_in = new \wpquads\template('/includes/vendor/vi/views/logged_in', $data);
|
2206 |
+
$not_logged_in = new \wpquads\template('/includes/vendor/vi/views/not_logged_in', $data);
|
2207 |
+
$adform = new \wpquads\template('/includes/vendor/vi/views/ad_settings', $data);
|
2208 |
+
$revenue = new \wpquads\template('/includes/vendor/vi/views/revenue', $data);
|
2209 |
+
|
2210 |
+
// header
|
2211 |
+
echo $header->render();
|
2212 |
+
|
2213 |
+
|
2214 |
+
// Not logged in
|
2215 |
+
if (empty($data) || false === $quads->vi->setRevenue()) {
|
2216 |
+
echo $not_logged_in->render();
|
2217 |
+
} else {
|
2218 |
+
// Is logged in
|
2219 |
+
//if ($quads->vi->setRevenue()) {
|
2220 |
+
echo $revenue->render();
|
2221 |
+
echo $adform->render();
|
2222 |
+
}
|
2223 |
+
|
2224 |
+
// footer
|
2225 |
+
echo $footer->render();
|
2226 |
+
|
2227 |
+
|
2228 |
+
}
|
2229 |
+
|
2230 |
+
/**
|
2231 |
+
* Create ads.txt for Google AdSense
|
2232 |
+
* @return boolean
|
2233 |
+
*/
|
2234 |
+
function quads_write_adsense_ads_txt() {
|
2235 |
+
global $quads_options;
|
2236 |
+
// Create AdSense ads.txt entries
|
2237 |
+
$adsense = new \wpquads\adsense($quads_options);
|
2238 |
+
if ($adsense->writeAdsTxt()){
|
2239 |
+
set_transient('quads_ads_txt_notice', 'true', 3000);
|
2240 |
+
return true;
|
2241 |
+
} else {
|
2242 |
+
// Make sure an error message is shown when ads.txt is available but can not be modified
|
2243 |
+
// Otherwise google adsense ads are not shown
|
2244 |
+
if (is_file(ABSPATH . 'ads.txt')) {
|
2245 |
+
set_transient('quads_ads_txt_error', 'true', 3000);
|
2246 |
+
}
|
2247 |
+
return false;
|
2248 |
+
}
|
2249 |
+
}
|
2250 |
+
add_action('update_option_quads_settings', 'quads_write_adsense_ads_txt');
|
2251 |
+
|
2252 |
+
|
2253 |
+
/**
|
2254 |
+
* Periodically update ads.txt once a day for vi and adsense
|
2255 |
+
* This is to ensure that the file is recreated in case it was deleted
|
2256 |
+
* @return boolean
|
2257 |
+
*/
|
2258 |
+
function updateAdsTxt(){
|
2259 |
+
global $quads, $quads_options;
|
2260 |
+
if(is_file('ads.txt')){
|
2261 |
+
return false;
|
2262 |
+
}
|
2263 |
+
$quads->vi->createAdsTxt();
|
2264 |
+
$adsense = new wpquads\adsense($quads_options);
|
2265 |
+
$adsense->writeAdsTxt();
|
2266 |
+
}
|
2267 |
+
add_action('quads_daily_event', 'updateAdsTxt');
|
includes/admin/upgrades/upgrade-functions.php
CHANGED
@@ -28,6 +28,8 @@ function quads_do_automatic_upgrades() {
|
|
28 |
// Previous version
|
29 |
$previous_version = get_option( 'quads_version_upgraded_from' );
|
30 |
|
|
|
|
|
31 |
|
32 |
// if( version_compare( $quads_version, '1.2.5', '<' ) ) {
|
33 |
// quads_store_adsense_args();
|
@@ -57,6 +59,13 @@ function quads_do_automatic_upgrades() {
|
|
57 |
if( $did_upgrade ) {
|
58 |
update_option( 'quads_version', preg_replace( '/[^0-9.].*/', '', QUADS_VERSION ) );
|
59 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
}
|
61 |
add_action( 'admin_init', 'quads_do_automatic_upgrades' );
|
62 |
|
@@ -252,3 +261,25 @@ function quads_import_post_type_settings(){
|
|
252 |
}
|
253 |
update_option('quads_settings', $quads_options);
|
254 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
// Previous version
|
29 |
$previous_version = get_option( 'quads_version_upgraded_from' );
|
30 |
|
31 |
+
quads_set_vi_ab_variant();
|
32 |
+
|
33 |
|
34 |
// if( version_compare( $quads_version, '1.2.5', '<' ) ) {
|
35 |
// quads_store_adsense_args();
|
59 |
if( $did_upgrade ) {
|
60 |
update_option( 'quads_version', preg_replace( '/[^0-9.].*/', '', QUADS_VERSION ) );
|
61 |
}
|
62 |
+
|
63 |
+
// Install vi api settings
|
64 |
+
if (false === get_option('quads_vi_settings')){
|
65 |
+
global $quads;
|
66 |
+
$quads->vi->setSettings();
|
67 |
+
}
|
68 |
+
|
69 |
}
|
70 |
add_action( 'admin_init', 'quads_do_automatic_upgrades' );
|
71 |
|
261 |
}
|
262 |
update_option('quads_settings', $quads_options);
|
263 |
}
|
264 |
+
|
265 |
+
|
266 |
+
/**
|
267 |
+
* Store randomly a value which is used for simple 50/50 A/B Testing of different things
|
268 |
+
* @return string
|
269 |
+
*/
|
270 |
+
function quads_set_vi_ab_variant() {
|
271 |
+
$quads_vi_variant = get_option('quads_vi_variant');
|
272 |
+
|
273 |
+
if ($quads_vi_variant && !empty($quads_vi_variant)) {
|
274 |
+
return $quads_vi_variant;
|
275 |
+
}
|
276 |
+
|
277 |
+
$strings = array(
|
278 |
+
'a',
|
279 |
+
'b',
|
280 |
+
);
|
281 |
+
$key = array_rand($strings);
|
282 |
+
|
283 |
+
update_option('quads_vi_variant', $strings[$key]);
|
284 |
+
return $strings[$key];
|
285 |
+
}
|
includes/admin/views/notices.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* WP QUADS Notices
|
4 |
+
*/
|
5 |
+
?>
|
6 |
+
|
7 |
+
|
8 |
+
|
9 |
+
<div class="quads-banner-wrapper notice <?php echo $type; ?>">
|
10 |
+
<section class="quads-banner-content">
|
11 |
+
<div class="quads-banner-columns">
|
12 |
+
<main class="quads-banner-main"><p><?php echo $message; ?></p></main>
|
13 |
+
<aside class="quads-banner-sidebar-second" style="margin-right:30px;"></p></aside>
|
14 |
+
</div>
|
15 |
+
<aside class="quads-banner-close"><div style="margin-top:5px;"><a href="<?php echo admin_url();?>admin.php?page=quads-settings&quads-action=<?php echo $action; ?>" class="quads-notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></a></div></aside>
|
16 |
+
</section>
|
17 |
+
</div>
|
18 |
+
|
includes/class-template.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace wpquads;
|
4 |
+
|
5 |
+
/*
|
6 |
+
* Class for rendering templates
|
7 |
+
*/
|
8 |
+
|
9 |
+
class template {
|
10 |
+
protected $path, $data;
|
11 |
+
|
12 |
+
/**
|
13 |
+
*
|
14 |
+
* @param string $path
|
15 |
+
* @param array $data
|
16 |
+
*/
|
17 |
+
public function __construct($path, $data = array()) {
|
18 |
+
$this->path = QUADS_PLUGIN_DIR . DIRECTORY_SEPARATOR . $path . '.php';
|
19 |
+
$this->data = $data;
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
*
|
24 |
+
* @return string HTML
|
25 |
+
*/
|
26 |
+
public function render() {
|
27 |
+
if(file_exists($this->path)){
|
28 |
+
//Extracts vars to current view scope
|
29 |
+
extract($this->data);
|
30 |
+
|
31 |
+
//Starts output buffering
|
32 |
+
ob_start();
|
33 |
+
|
34 |
+
//Includes contents
|
35 |
+
include $this->path;
|
36 |
+
$buffer = ob_get_contents();
|
37 |
+
@ob_end_clean();
|
38 |
+
|
39 |
+
//Returns output buffer
|
40 |
+
return $buffer;
|
41 |
+
} else {
|
42 |
+
//Throws exception
|
43 |
+
}
|
44 |
+
}
|
45 |
+
}
|
includes/conditions.php
CHANGED
@@ -23,15 +23,16 @@
|
|
23 |
function quads_ad_is_allowed( $content = null ) {
|
24 |
global $quads_options;
|
25 |
|
|
|
26 |
// Never show ads in ajax calls
|
27 |
-
if ( defined('DOING_AJAX') && DOING_AJAX ||
|
28 |
-
|
29 |
-
)
|
30 |
{
|
31 |
/* it's an AJAX call */
|
32 |
return false;
|
33 |
}
|
34 |
-
|
35 |
$hide_ads = apply_filters('quads_hide_ads', false);
|
36 |
|
37 |
// User Roles check
|
@@ -58,8 +59,7 @@ function quads_ad_is_allowed( $content = null ) {
|
|
58 |
(is_user_logged_in() && ( isset( $quads_options['visibility']['AppLogg'] ) ) ) ||
|
59 |
true === $hide_ads
|
60 |
) {
|
61 |
-
return
|
62 |
-
//return false;
|
63 |
}
|
64 |
// else
|
65 |
return true;
|
23 |
function quads_ad_is_allowed( $content = null ) {
|
24 |
global $quads_options;
|
25 |
|
26 |
+
|
27 |
// Never show ads in ajax calls
|
28 |
+
if ( isset($quads_options['is_ajax']) && (defined('DOING_AJAX') && DOING_AJAX ||
|
29 |
+
(! empty( $_SERVER[ 'HTTP_X_REQUESTED_WITH' ] ) && strtolower( $_SERVER[ 'HTTP_X_REQUESTED_WITH' ]) == 'xmlhttprequest' )
|
30 |
+
))
|
31 |
{
|
32 |
/* it's an AJAX call */
|
33 |
return false;
|
34 |
}
|
35 |
+
|
36 |
$hide_ads = apply_filters('quads_hide_ads', false);
|
37 |
|
38 |
// User Roles check
|
59 |
(is_user_logged_in() && ( isset( $quads_options['visibility']['AppLogg'] ) ) ) ||
|
60 |
true === $hide_ads
|
61 |
) {
|
62 |
+
return false;
|
|
|
63 |
}
|
64 |
// else
|
65 |
return true;
|
includes/scripts.php
CHANGED
@@ -56,7 +56,7 @@ function quads_load_admin_scripts( $hook ) {
|
|
56 |
if( !apply_filters( 'quads_load_admin_scripts', quads_is_admin_page(), $hook ) ) {
|
57 |
return;
|
58 |
}
|
59 |
-
global $wp_version;
|
60 |
|
61 |
$js_dir = QUADS_PLUGIN_URL . 'assets/js/';
|
62 |
$css_dir = QUADS_PLUGIN_URL . 'assets/css/';
|
@@ -68,16 +68,29 @@ function quads_load_admin_scripts( $hook ) {
|
|
68 |
// These have to be global
|
69 |
wp_enqueue_script( 'quads-admin-ads', $js_dir . 'ads.js', array('jquery'), QUADS_VERSION, false );
|
70 |
wp_enqueue_script( 'quads-admin-scripts', $js_dir . 'quads-admin' . $suffix . '.js', array('jquery'), QUADS_VERSION, false );
|
|
|
71 |
wp_enqueue_script( 'jquery-chosen', $js_dir . 'chosen.jquery' . $suffix . '.js', array('jquery'), QUADS_VERSION, false );
|
72 |
wp_enqueue_script( 'jquery-form' );
|
|
|
|
|
|
|
|
|
73 |
|
74 |
wp_enqueue_style( 'quads-admin', $css_dir . 'quads-admin' . $suffix . '.css', QUADS_VERSION );
|
75 |
wp_enqueue_style( 'jquery-chosen', $css_dir . 'chosen' . $suffix . '.css', QUADS_VERSION );
|
76 |
-
|
|
|
|
|
77 |
wp_localize_script( 'quads-admin-scripts', 'quads', array(
|
78 |
'nonce' => wp_create_nonce( 'quads_ajax_nonce' ),
|
79 |
'error' => __( "error", 'quick-adsense-reloaded' ),
|
80 |
'path' => get_option( 'siteurl' ),
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
) );
|
82 |
}
|
83 |
|
56 |
if( !apply_filters( 'quads_load_admin_scripts', quads_is_admin_page(), $hook ) ) {
|
57 |
return;
|
58 |
}
|
59 |
+
global $wp_version, $quads;
|
60 |
|
61 |
$js_dir = QUADS_PLUGIN_URL . 'assets/js/';
|
62 |
$css_dir = QUADS_PLUGIN_URL . 'assets/css/';
|
68 |
// These have to be global
|
69 |
wp_enqueue_script( 'quads-admin-ads', $js_dir . 'ads.js', array('jquery'), QUADS_VERSION, false );
|
70 |
wp_enqueue_script( 'quads-admin-scripts', $js_dir . 'quads-admin' . $suffix . '.js', array('jquery'), QUADS_VERSION, false );
|
71 |
+
wp_enqueue_script( 'quads-jscolor', $js_dir . 'jscolor' . $suffix . '.js', array(), QUADS_VERSION, false );
|
72 |
wp_enqueue_script( 'jquery-chosen', $js_dir . 'chosen.jquery' . $suffix . '.js', array('jquery'), QUADS_VERSION, false );
|
73 |
wp_enqueue_script( 'jquery-form' );
|
74 |
+
|
75 |
+
$vi_dir = QUADS_PLUGIN_URL . 'includes/vendor/vi/public/js/';
|
76 |
+
wp_enqueue_script('quads-vi', $vi_dir . 'vi.js', array(), QUADS_VERSION, false);
|
77 |
+
|
78 |
|
79 |
wp_enqueue_style( 'quads-admin', $css_dir . 'quads-admin' . $suffix . '.css', QUADS_VERSION );
|
80 |
wp_enqueue_style( 'jquery-chosen', $css_dir . 'chosen' . $suffix . '.css', QUADS_VERSION );
|
81 |
+
|
82 |
+
$signupURL = $quads->vi->getSettings()->data->signupURL;
|
83 |
+
|
84 |
wp_localize_script( 'quads-admin-scripts', 'quads', array(
|
85 |
'nonce' => wp_create_nonce( 'quads_ajax_nonce' ),
|
86 |
'error' => __( "error", 'quick-adsense-reloaded' ),
|
87 |
'path' => get_option( 'siteurl' ),
|
88 |
+
'vi_revenue' => !empty($quads->vi->getRevenue()->mtdReport) ? $quads->vi->getRevenue()->mtdReport : '',
|
89 |
+
'vi_login_url' => $quads->vi->getLoginURL(),
|
90 |
+
'vi_signup_url' => !empty($signupURL) ? $signupURL : '',
|
91 |
+
'domain' => $quads->vi->getDomain(),
|
92 |
+
'email' => get_option('admin_email'),
|
93 |
+
'aid' => 'WP_Quads'
|
94 |
) );
|
95 |
}
|
96 |
|
includes/template-functions.php
CHANGED
@@ -163,24 +163,12 @@ function quads_get_number_widget_ads() {
|
|
163 |
function quads_get_active_ads() {
|
164 |
global $quads_options;
|
165 |
|
166 |
-
// Max amount of different content ads we can have
|
167 |
-
//$numberAds = 20;
|
168 |
-
|
169 |
-
//$adsArray = array();
|
170 |
|
171 |
// Return early
|
172 |
if (empty($quads_options['ads'])){
|
173 |
return 0;
|
174 |
}
|
175 |
|
176 |
-
// Array of ad codes
|
177 |
-
// for ( $i = 1; $i <= $numberAds; $i++ ) {
|
178 |
-
// $tmp = isset( $quads_options['ads']['ad' . $i]['code'] ) ? trim( $quads_options['ads']['ad' . $i]['code'] ) : '';
|
179 |
-
// // id is valid if there is either the plain text field populated or the adsense ad slot and the ad client id
|
180 |
-
// if( !empty( $tmp ) || (!empty( $quads_options['ads']['ad' . $i]['g_data_ad_slot'] ) && !empty( $quads_options['ads']['ad' . $i]['g_data_ad_client'] ) ) ) {
|
181 |
-
// $adsArray[] = $i;
|
182 |
-
// }
|
183 |
-
// }
|
184 |
// count valid ads
|
185 |
$i = 0;
|
186 |
foreach ( $quads_options['ads'] as $ads) {
|
@@ -191,34 +179,9 @@ function quads_get_active_ads() {
|
|
191 |
}
|
192 |
$i++;
|
193 |
}
|
194 |
-
|
195 |
-
return (count($adsArray) > 0) ? $adsArray : 0;
|
196 |
}
|
197 |
|
198 |
-
/**
|
199 |
-
* Get complete array of valid ads
|
200 |
-
* @global arr $quads_options
|
201 |
-
*/
|
202 |
-
//function quads_get_ad_content() {
|
203 |
-
// global $quads_options;
|
204 |
-
//
|
205 |
-
// // Max amount of different content ads we can have
|
206 |
-
// $numberAds = 10;
|
207 |
-
//
|
208 |
-
// $adsArray = array();
|
209 |
-
//
|
210 |
-
// // Array of ad codes
|
211 |
-
// for ( $i = 1; $i <= $numberAds; $i++ ) {
|
212 |
-
// $tmp = isset( $quads_options['ads']['ad' . $i]['code'] ) ? trim( $quads_options['ads']['ad' . $i]['code'] ) : '';
|
213 |
-
// // id is valid if there is either the plain text field populated or the adsense ad slot and the ad client id
|
214 |
-
// if( !empty( $tmp ) || (!empty( $quads_options['ads']['ad' . $i]['g_data_ad_slot'] ) && !empty( $quads_options['ads']['ad' . $i]['g_data_ad_client'] ) ) ) {
|
215 |
-
// $adsArray[] = $quads_options['ads']['ad' . $i];
|
216 |
-
// }
|
217 |
-
// }
|
218 |
-
//
|
219 |
-
// return count($adsArray) ? $adsArray : 0;
|
220 |
-
//}
|
221 |
-
|
222 |
|
223 |
/**
|
224 |
* Get max allowed numbers of ads
|
163 |
function quads_get_active_ads() {
|
164 |
global $quads_options;
|
165 |
|
|
|
|
|
|
|
|
|
166 |
|
167 |
// Return early
|
168 |
if (empty($quads_options['ads'])){
|
169 |
return 0;
|
170 |
}
|
171 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
// count valid ads
|
173 |
$i = 0;
|
174 |
foreach ( $quads_options['ads'] as $ads) {
|
179 |
}
|
180 |
$i++;
|
181 |
}
|
182 |
+
return (isset($adsArray) && count($adsArray) > 0) ? $adsArray : 0;
|
|
|
183 |
}
|
184 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
185 |
|
186 |
/**
|
187 |
* Get max allowed numbers of ads
|
includes/vendor/google/adsense.php
ADDED
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace wpquads;
|
4 |
+
|
5 |
+
/*
|
6 |
+
* Google AdSense integration for WP QUADS
|
7 |
+
* @author René Hermenau
|
8 |
+
* @email info@mashshare.net
|
9 |
+
*
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Main class for wp quads google adsense integration
|
14 |
+
*
|
15 |
+
* @author René Hermenau
|
16 |
+
*/
|
17 |
+
class adsense {
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Settings
|
21 |
+
* @var array
|
22 |
+
*/
|
23 |
+
private $settings;
|
24 |
+
|
25 |
+
public function __construct($settings) {
|
26 |
+
$this->settings = $settings;
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Get AdSense Publisher ID
|
31 |
+
* @return string
|
32 |
+
*/
|
33 |
+
public function getPublisherID() {
|
34 |
+
// loop through all adsense g_data_ad_client fields and check if there is any adsense publisher id
|
35 |
+
foreach ($this->settings['ads'] as $key => $value) {
|
36 |
+
if (!empty($this->settings['ads'][$key]['g_data_ad_client'])){
|
37 |
+
return $this->settings['ads'][$key]['g_data_ad_client'];
|
38 |
+
}
|
39 |
+
}
|
40 |
+
|
41 |
+
// Loop through all other possible ad codes and check if there is any possible google publisher id
|
42 |
+
$quads_options = $this->settings;
|
43 |
+
|
44 |
+
foreach ($quads_options as $id => $ads) {
|
45 |
+
if (!is_array($ads)) {
|
46 |
+
continue;
|
47 |
+
}
|
48 |
+
foreach ($ads as $key => $value) {
|
49 |
+
if (is_array($value) && array_key_exists('code', $value) && !empty($value['code'])) {
|
50 |
+
|
51 |
+
// Check to see if it is google ad
|
52 |
+
if (preg_match('/googlesyndication.com/', $value['code'])) {
|
53 |
+
|
54 |
+
// Test if its google asyncron ad
|
55 |
+
if (preg_match('/data-ad-client=/', $value['code'])) {
|
56 |
+
//*** GOOGLE ASYNCRON *************
|
57 |
+
//get g_data_ad_client
|
58 |
+
$explode_ad_code = explode('data-ad-client', $value['code']);
|
59 |
+
preg_match('#"([a-zA-Z0-9-\s]+)"#', $explode_ad_code[1], $matches_add_client);
|
60 |
+
return str_replace(array('"', ' '), array(''), $matches_add_client[1]);
|
61 |
+
} else {
|
62 |
+
//*** GOOGLE SYNCRON *************
|
63 |
+
//get g_data_ad_client
|
64 |
+
$explode_ad_code = explode('google_ad_client', $value['code']);
|
65 |
+
preg_match('#"([a-zA-Z0-9-\s]+)"#', $explode_ad_code[1], $matches_add_client);
|
66 |
+
return str_replace(array('"', ' '), array(''), $matches_add_client[1]);
|
67 |
+
}
|
68 |
+
}
|
69 |
+
}
|
70 |
+
}
|
71 |
+
}
|
72 |
+
|
73 |
+
return '';
|
74 |
+
}
|
75 |
+
|
76 |
+
|
77 |
+
/**
|
78 |
+
* Write ads.txt
|
79 |
+
* @return boolean
|
80 |
+
*/
|
81 |
+
public function writeAdsTxt(){
|
82 |
+
|
83 |
+
$publisherId = $this->getPublisherID();
|
84 |
+
|
85 |
+
if (empty($publisherId)){
|
86 |
+
return false;
|
87 |
+
}
|
88 |
+
|
89 |
+
$content = 'google.com, ' . str_replace('ca-', '', $this->getPublisherID()) . ', DIRECT f08c47fec0942fa0';
|
90 |
+
$adsTxt = new adsTxt($content, 'f08c47fec0942fa0');
|
91 |
+
return $adsTxt->writeAdsTxt();
|
92 |
+
}
|
93 |
+
|
94 |
+
}
|
includes/vendor/vi/conditions.php
ADDED
@@ -0,0 +1,161 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace wpquads\conditions;
|
4 |
+
|
5 |
+
/*
|
6 |
+
* vi conditions for WP QUADS
|
7 |
+
* @author René Hermenau
|
8 |
+
* @email info@mashshare.net
|
9 |
+
*
|
10 |
+
*/
|
11 |
+
|
12 |
+
class conditions {
|
13 |
+
|
14 |
+
protected function isExcluded() {
|
15 |
+
global $quads_options;
|
16 |
+
|
17 |
+
if (is_feed())
|
18 |
+
return true;
|
19 |
+
|
20 |
+
if (is_404())
|
21 |
+
return true;
|
22 |
+
|
23 |
+
if (is_user_logged_in() && ( isset($quads_options['visibility']['AppLogg'])))
|
24 |
+
return true;
|
25 |
+
|
26 |
+
if (is_front_page() && !isset( $quads_options['visibility']['AppHome'] ) )
|
27 |
+
return true;
|
28 |
+
|
29 |
+
if (is_category() && !(isset($quads_options['visibility']['AppCate']) ))
|
30 |
+
return true;
|
31 |
+
|
32 |
+
if (is_archive() && !( isset($quads_options['visibility']['AppArch']) ))
|
33 |
+
return true;
|
34 |
+
|
35 |
+
if (is_tag() && !( isset($quads_options['visibility']['AppTags']) ))
|
36 |
+
return true;
|
37 |
+
|
38 |
+
if (quads_is_amp_endpoint())
|
39 |
+
return true;
|
40 |
+
|
41 |
+
if ($this->isExcludedUserRole())
|
42 |
+
return true;
|
43 |
+
|
44 |
+
if ($this->isExcludedPostTypes())
|
45 |
+
return true;
|
46 |
+
|
47 |
+
if ($this->isExcludedPageId())
|
48 |
+
return true;
|
49 |
+
|
50 |
+
if ($this->isExcludedByMetaKey())
|
51 |
+
return true;
|
52 |
+
|
53 |
+
|
54 |
+
// Default
|
55 |
+
return false;
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Excluded user roles
|
60 |
+
* @return boolean
|
61 |
+
*/
|
62 |
+
private function isExcludedUserRole() {
|
63 |
+
|
64 |
+
if (!isset($this->ads['ads'][$this->id]['excludedUserRoles']) ||
|
65 |
+
empty($this->ads['ads'][$this->id]['excludedUserRoles'])
|
66 |
+
) {
|
67 |
+
return false;
|
68 |
+
}
|
69 |
+
|
70 |
+
if (isset($this->ads['ads'][$this->id]['excludedUserRoles']) &&
|
71 |
+
count(array_intersect($this->ads['ads'][$this->id]['excludedUserRoles'], wp_get_current_user()->roles)) >= 1) {
|
72 |
+
return true;
|
73 |
+
}
|
74 |
+
|
75 |
+
return false;
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Check if post id is excluded
|
80 |
+
* @global array $post
|
81 |
+
* @return boolean
|
82 |
+
*/
|
83 |
+
private function isExcludedPageId() {
|
84 |
+
global $post;
|
85 |
+
|
86 |
+
|
87 |
+
if (!isset($post->ID)) {
|
88 |
+
return true;
|
89 |
+
}
|
90 |
+
|
91 |
+
if (!isset($this->ads['ads'][$this->id]['excludedPostIds']) ||
|
92 |
+
empty($this->ads['ads'][$this->id]['excludedPostIds'])
|
93 |
+
) {
|
94 |
+
return false;
|
95 |
+
}
|
96 |
+
|
97 |
+
if (strpos($this->ads['ads'][$this->id]['excludedPostIds'], ',') !== false) {
|
98 |
+
$excluded = explode(',', $this->ads['ads'][$this->id]['excludedPostIds']);
|
99 |
+
if (in_array($post->ID, $excluded)) {
|
100 |
+
return true;
|
101 |
+
}
|
102 |
+
}
|
103 |
+
if ($post->ID == $this->ads['ads'][$this->id]['excludedPostIds']) {
|
104 |
+
return true;
|
105 |
+
}
|
106 |
+
|
107 |
+
// default condition
|
108 |
+
return false;
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Check if ad is allowed on specific post_type
|
113 |
+
*
|
114 |
+
* @global array $quads_options
|
115 |
+
* @global array $post
|
116 |
+
* @return boolean true if post_type is allowed
|
117 |
+
*/
|
118 |
+
private function isExcludedPostTypes() {
|
119 |
+
global $post;
|
120 |
+
|
121 |
+
if (!isset($post)) {
|
122 |
+
return true;
|
123 |
+
}
|
124 |
+
|
125 |
+
if (!isset($this->ads['ads'][$this->id]['excludedPostTypes']) ||
|
126 |
+
empty($this->ads['ads'][$this->id]['excludedPostTypes']) ||
|
127 |
+
!is_array($this->ads['ads'][$this->id]['excludedPostTypes']) ||
|
128 |
+
$this->ads['ads'][$this->id]['excludedPostTypes'] == 'noPostTypes'
|
129 |
+
) {
|
130 |
+
return false;
|
131 |
+
}
|
132 |
+
|
133 |
+
$current_post_type = get_post_type($post->ID);
|
134 |
+
if (in_array($current_post_type, $this->ads['ads'][$this->id]['excludedPostTypes'])) {
|
135 |
+
return true;
|
136 |
+
}
|
137 |
+
|
138 |
+
return false;
|
139 |
+
}
|
140 |
+
|
141 |
+
/**
|
142 |
+
* Check if ad is deactivated by wp quads meta settings in post editor
|
143 |
+
* @return boolean
|
144 |
+
*/
|
145 |
+
private function isExcludedByMetaKey() {
|
146 |
+
global $post;
|
147 |
+
|
148 |
+
if (!isset($post->ID))
|
149 |
+
return false;
|
150 |
+
|
151 |
+
$value_arr = get_post_meta($post->ID, '_quads_config_visibility', true);
|
152 |
+
|
153 |
+
$value_key = isset($value_arr['NoAds']) ? $value_arr['NoAds'] : null;
|
154 |
+
|
155 |
+
if (!empty($value_key) && $value_key == 1) {
|
156 |
+
return true;
|
157 |
+
}
|
158 |
+
return false;
|
159 |
+
}
|
160 |
+
|
161 |
+
}
|
includes/vendor/vi/public/js/vi.js
ADDED
@@ -0,0 +1,196 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
* Chart.js
|
3 |
+
* http://chartjs.org/
|
4 |
+
* Version: 2.4.0
|
5 |
+
*
|
6 |
+
* Copyright 2016 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{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.Chart=t()}}(function(){return function t(e,a,i){function n(r,l){if(!a[r]){if(!e[r]){var s="function"==typeof require&&require;if(!l&&s)return s(r,!0);if(o)return o(r,!0);var d=new Error("Cannot find module '"+r+"'");throw d.code="MODULE_NOT_FOUND",d}var u=a[r]={exports:{}};e[r][0].call(u.exports,function(t){var a=e[r][1][t];return n(a?a:t)},u,u.exports,t,e,a,i)}return a[r].exports}for(var o="function"==typeof require&&require,r=0;r<i.length;r++)n(i[r]);return n}({1:[function(t,e,a){},{}],2:[function(t,e,a){function i(t){if(t){var e=/^#([a-fA-F0-9]{3})$/,a=/^#([a-fA-F0-9]{6})$/,i=/^rgba?\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/,n=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/,o=/(\w+)/,r=[0,0,0],l=1,s=t.match(e);if(s){s=s[1];for(var d=0;d<r.length;d++)r[d]=parseInt(s[d]+s[d],16)}else if(s=t.match(a)){s=s[1];for(var d=0;d<r.length;d++)r[d]=parseInt(s.slice(2*d,2*d+2),16)}else if(s=t.match(i)){for(var d=0;d<r.length;d++)r[d]=parseInt(s[d+1]);l=parseFloat(s[4])}else if(s=t.match(n)){for(var d=0;d<r.length;d++)r[d]=Math.round(2.55*parseFloat(s[d+1]));l=parseFloat(s[4])}else if(s=t.match(o)){if("transparent"==s[1])return[0,0,0,0];if(r=y[s[1]],!r)return}for(var d=0;d<r.length;d++)r[d]=v(r[d],0,255);return l=l||0==l?v(l,0,1):1,r[3]=l,r}}function n(t){if(t){var e=/^hsla?\(\s*([+-]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)/,a=t.match(e);if(a){var i=parseFloat(a[4]),n=v(parseInt(a[1]),0,360),o=v(parseFloat(a[2]),0,100),r=v(parseFloat(a[3]),0,100),l=v(isNaN(i)?1:i,0,1);return[n,o,r,l]}}}function o(t){if(t){var e=/^hwb\(\s*([+-]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)/,a=t.match(e);if(a){var i=parseFloat(a[4]),n=v(parseInt(a[1]),0,360),o=v(parseFloat(a[2]),0,100),r=v(parseFloat(a[3]),0,100),l=v(isNaN(i)?1:i,0,1);return[n,o,r,l]}}}function r(t){var e=i(t);return e&&e.slice(0,3)}function l(t){var e=n(t);return e&&e.slice(0,3)}function s(t){var e=i(t);return e?e[3]:(e=n(t))?e[3]:(e=o(t))?e[3]:void 0}function d(t){return"#"+x(t[0])+x(t[1])+x(t[2])}function u(t,e){return 1>e||t[3]&&t[3]<1?c(t,e):"rgb("+t[0]+", "+t[1]+", "+t[2]+")"}function c(t,e){return void 0===e&&(e=void 0!==t[3]?t[3]:1),"rgba("+t[0]+", "+t[1]+", "+t[2]+", "+e+")"}function h(t,e){if(1>e||t[3]&&t[3]<1)return f(t,e);var a=Math.round(t[0]/255*100),i=Math.round(t[1]/255*100),n=Math.round(t[2]/255*100);return"rgb("+a+"%, "+i+"%, "+n+"%)"}function f(t,e){var a=Math.round(t[0]/255*100),i=Math.round(t[1]/255*100),n=Math.round(t[2]/255*100);return"rgba("+a+"%, "+i+"%, "+n+"%, "+(e||t[3]||1)+")"}function g(t,e){return 1>e||t[3]&&t[3]<1?p(t,e):"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)"}function p(t,e){return void 0===e&&(e=void 0!==t[3]?t[3]:1),"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+e+")"}function m(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:"")+")"}function b(t){return k[t.slice(0,3)]}function v(t,e,a){return Math.min(Math.max(e,t),a)}function x(t){var e=t.toString(16).toUpperCase();return e.length<2?"0"+e:e}var y=t(6);e.exports={getRgba:i,getHsla:n,getRgb:r,getHsl:l,getHwb:o,getAlpha:s,hexString:d,rgbString:u,rgbaString:c,percentString:h,percentaString:f,hslString:g,hslaString:p,hwbString:m,keyword:b};var k={};for(var S in y)k[y[S]]=S},{6:6}],3:[function(t,e,a){var i=t(5),n=t(2),o=function(t){if(t instanceof o)return t;if(!(this instanceof o))return new o(t);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;if("string"==typeof t)if(e=n.getRgba(t))this.setValues("rgb",e);else if(e=n.getHsla(t))this.setValues("hsl",e);else{if(!(e=n.getHwb(t)))throw new Error('Unable to parse color from string "'+t+'"');this.setValues("hwb",e)}else if("object"==typeof t)if(e=t,void 0!==e.r||void 0!==e.red)this.setValues("rgb",e);else if(void 0!==e.l||void 0!==e.lightness)this.setValues("hsl",e);else if(void 0!==e.v||void 0!==e.value)this.setValues("hsv",e);else if(void 0!==e.w||void 0!==e.whiteness)this.setValues("hwb",e);else{if(void 0===e.c&&void 0===e.cyan)throw new Error("Unable to parse color from object "+JSON.stringify(t));this.setValues("cmyk",e)}};o.prototype={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%=360,t=0>t?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 n.hexString(this.values.rgb)},rgbString:function(){return n.rgbString(this.values.rgb,this.values.alpha)},rgbaString:function(){return n.rgbaString(this.values.rgb,this.values.alpha)},percentString:function(){return n.percentString(this.values.rgb,this.values.alpha)},hslString:function(){return n.hslString(this.values.hsl,this.values.alpha)},hslaString:function(){return n.hslaString(this.values.hsl,this.values.alpha)},hwbString:function(){return n.hwbString(this.values.hwb,this.values.alpha)},keyword:function(){return n.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=[],a=0;a<t.length;a++){var i=t[a]/255;e[a]=.03928>=i?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(),a=t.luminosity();return e>a?(e+.05)/(a+.05):(a+.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,e=(299*t[0]+587*t[1]+114*t[2])/1e3;return 128>e},light:function(){return!this.dark()},negate:function(){for(var t=[],e=0;3>e;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,a=(e[0]+t)%360;return e[0]=0>a?360+a:a,this.setValues("hsl",e),this},mix:function(t,e){var a=this,i=t,n=void 0===e?.5:e,o=2*n-1,r=a.alpha()-i.alpha(),l=((o*r===-1?o:(o+r)/(1+o*r))+1)/2,s=1-l;return this.rgb(l*a.red()+s*i.red(),l*a.green()+s*i.green(),l*a.blue()+s*i.blue()).alpha(a.alpha()*n+i.alpha()*(1-n))},toJSON:function(){return this.rgb()},clone:function(){var t,e,a=new o,i=this.values,n=a.values;for(var r in i)i.hasOwnProperty(r)&&(t=i[r],e={}.toString.call(t),"[object Array]"===e?n[r]=t.slice(0):"[object Number]"===e?n[r]=t:console.error("unexpected color value:",t));return a}},o.prototype.spaces={rgb:["red","green","blue"],hsl:["hue","saturation","lightness"],hsv:["hue","saturation","value"],hwb:["hue","whiteness","blackness"],cmyk:["cyan","magenta","yellow","black"]},o.prototype.maxes={rgb:[255,255,255],hsl:[360,100,100],hsv:[360,100,100],hwb:[360,100,100],cmyk:[100,100,100,100]},o.prototype.getValues=function(t){for(var e=this.values,a={},i=0;i<t.length;i++)a[t.charAt(i)]=e[t][i];return 1!==e.alpha&&(a.a=e.alpha),a},o.prototype.setValues=function(t,e){var a,n=this.values,o=this.spaces,r=this.maxes,l=1;if("alpha"===t)l=e;else if(e.length)n[t]=e.slice(0,t.length),l=e[t.length];else if(void 0!==e[t.charAt(0)]){for(a=0;a<t.length;a++)n[t][a]=e[t.charAt(a)];l=e.a}else if(void 0!==e[o[t][0]]){var s=o[t];for(a=0;a<t.length;a++)n[t][a]=e[s[a]];l=e.alpha}if(n.alpha=Math.max(0,Math.min(1,void 0===l?n.alpha:l)),"alpha"===t)return!1;var d;for(a=0;a<t.length;a++)d=Math.max(0,Math.min(r[t][a],n[t][a])),n[t][a]=Math.round(d);for(var u in o)u!==t&&(n[u]=i[t][u](n[t]));return!0},o.prototype.setSpace=function(t,e){var a=e[0];return void 0===a?this.getValues(t):("number"==typeof a&&(a=Array.prototype.slice.call(e)),this.setValues(t,a),this)},o.prototype.setChannel=function(t,e,a){var i=this.values[t];return void 0===a?i[e]:a===i[e]?this:(i[e]=a,this.setValues(t,i),this)},"undefined"!=typeof window&&(window.Color=o),e.exports=o},{2:2,5:5}],4:[function(t,e,a){function i(t){var e,a,i,n=t[0]/255,o=t[1]/255,r=t[2]/255,l=Math.min(n,o,r),s=Math.max(n,o,r),d=s-l;return s==l?e=0:n==s?e=(o-r)/d:o==s?e=2+(r-n)/d:r==s&&(e=4+(n-o)/d),e=Math.min(60*e,360),0>e&&(e+=360),i=(l+s)/2,a=s==l?0:.5>=i?d/(s+l):d/(2-s-l),[e,100*a,100*i]}function n(t){var e,a,i,n=t[0],o=t[1],r=t[2],l=Math.min(n,o,r),s=Math.max(n,o,r),d=s-l;return a=0==s?0:d/s*1e3/10,s==l?e=0:n==s?e=(o-r)/d:o==s?e=2+(r-n)/d:r==s&&(e=4+(n-o)/d),e=Math.min(60*e,360),0>e&&(e+=360),i=s/255*1e3/10,[e,a,i]}function o(t){var e=t[0],a=t[1],n=t[2],o=i(t)[0],r=1/255*Math.min(e,Math.min(a,n)),n=1-1/255*Math.max(e,Math.max(a,n));return[o,100*r,100*n]}function l(t){var e,a,i,n,o=t[0]/255,r=t[1]/255,l=t[2]/255;return n=Math.min(1-o,1-r,1-l),e=(1-o-n)/(1-n)||0,a=(1-r-n)/(1-n)||0,i=(1-l-n)/(1-n)||0,[100*e,100*a,100*i,100*n]}function s(t){return G[JSON.stringify(t)]}function d(t){var e=t[0]/255,a=t[1]/255,i=t[2]/255;e=e>.04045?Math.pow((e+.055)/1.055,2.4):e/12.92,a=a>.04045?Math.pow((a+.055)/1.055,2.4):a/12.92,i=i>.04045?Math.pow((i+.055)/1.055,2.4):i/12.92;var n=.4124*e+.3576*a+.1805*i,o=.2126*e+.7152*a+.0722*i,r=.0193*e+.1192*a+.9505*i;return[100*n,100*o,100*r]}function u(t){var e,a,i,n=d(t),o=n[0],r=n[1],l=n[2];return o/=95.047,r/=100,l/=108.883,o=o>.008856?Math.pow(o,1/3):7.787*o+16/116,r=r>.008856?Math.pow(r,1/3):7.787*r+16/116,l=l>.008856?Math.pow(l,1/3):7.787*l+16/116,e=116*r-16,a=500*(o-r),i=200*(r-l),[e,a,i]}function c(t){return W(u(t))}function h(t){var e,a,i,n,o,r=t[0]/360,l=t[1]/100,s=t[2]/100;if(0==l)return o=255*s,[o,o,o];a=.5>s?s*(1+l):s+l-s*l,e=2*s-a,n=[0,0,0];for(var d=0;3>d;d++)i=r+1/3*-(d-1),0>i&&i++,i>1&&i--,o=1>6*i?e+6*(a-e)*i:1>2*i?a:2>3*i?e+(a-e)*(2/3-i)*6:e,n[d]=255*o;return n}function f(t){var e,a,i=t[0],n=t[1]/100,o=t[2]/100;return 0===o?[0,0,0]:(o*=2,n*=1>=o?o:2-o,a=(o+n)/2,e=2*n/(o+n),[i,100*e,100*a])}function p(t){return o(h(t))}function m(t){return l(h(t))}function v(t){return s(h(t))}function x(t){var e=t[0]/60,a=t[1]/100,i=t[2]/100,n=Math.floor(e)%6,o=e-Math.floor(e),r=255*i*(1-a),l=255*i*(1-a*o),s=255*i*(1-a*(1-o)),i=255*i;switch(n){case 0:return[i,s,r];case 1:return[l,i,r];case 2:return[r,i,s];case 3:return[r,l,i];case 4:return[s,r,i];case 5:return[i,r,l]}}function y(t){var e,a,i=t[0],n=t[1]/100,o=t[2]/100;return a=(2-n)*o,e=n*o,e/=1>=a?a:2-a,e=e||0,a/=2,[i,100*e,100*a]}function k(t){return o(x(t))}function S(t){return l(x(t))}function w(t){return s(x(t))}function M(t){var e,a,i,n,o=t[0]/360,l=t[1]/100,s=t[2]/100,d=l+s;switch(d>1&&(l/=d,s/=d),e=Math.floor(6*o),a=1-s,i=6*o-e,0!=(1&e)&&(i=1-i),n=l+i*(a-l),e){default:case 6:case 0:r=a,g=n,b=l;break;case 1:r=n,g=a,b=l;break;case 2:r=l,g=a,b=n;break;case 3:r=l,g=n,b=a;break;case 4:r=n,g=l,b=a;break;case 5:r=a,g=l,b=n}return[255*r,255*g,255*b]}function C(t){return i(M(t))}function D(t){return n(M(t))}function I(t){return l(M(t))}function A(t){return s(M(t))}function T(t){var e,a,i,n=t[0]/100,o=t[1]/100,r=t[2]/100,l=t[3]/100;return e=1-Math.min(1,n*(1-l)+l),a=1-Math.min(1,o*(1-l)+l),i=1-Math.min(1,r*(1-l)+l),[255*e,255*a,255*i]}function P(t){return i(T(t))}function F(t){return n(T(t))}function _(t){return o(T(t))}function R(t){return s(T(t))}function V(t){var e,a,i,n=t[0]/100,o=t[1]/100,r=t[2]/100;return e=3.2406*n+-1.5372*o+r*-.4986,a=n*-.9689+1.8758*o+.0415*r,i=.0557*n+o*-.204+1.057*r,e=e>.0031308?1.055*Math.pow(e,1/2.4)-.055:e=12.92*e,a=a>.0031308?1.055*Math.pow(a,1/2.4)-.055:a=12.92*a,i=i>.0031308?1.055*Math.pow(i,1/2.4)-.055:i=12.92*i,e=Math.min(Math.max(0,e),1),a=Math.min(Math.max(0,a),1),i=Math.min(Math.max(0,i),1),[255*e,255*a,255*i]}function L(t){var e,a,i,n=t[0],o=t[1],r=t[2];return n/=95.047,o/=100,r/=108.883,n=n>.008856?Math.pow(n,1/3):7.787*n+16/116,o=o>.008856?Math.pow(o,1/3):7.787*o+16/116,r=r>.008856?Math.pow(r,1/3):7.787*r+16/116,e=116*o-16,a=500*(n-o),i=200*(o-r),[e,a,i]}function O(t){return W(L(t))}function B(t){var e,a,i,n,o=t[0],r=t[1],l=t[2];return 8>=o?(a=100*o/903.3,n=7.787*(a/100)+16/116):(a=100*Math.pow((o+16)/116,3),n=Math.pow(a/100,1/3)),e=.008856>=e/95.047?e=95.047*(r/500+n-16/116)/7.787:95.047*Math.pow(r/500+n,3),i=.008859>=i/108.883?i=108.883*(n-l/200-16/116)/7.787:108.883*Math.pow(n-l/200,3),[e,a,i]}function W(t){var e,a,i,n=t[0],o=t[1],r=t[2];return e=Math.atan2(r,o),a=360*e/2/Math.PI,0>a&&(a+=360),i=Math.sqrt(o*o+r*r),[n,i,a]}function z(t){return V(B(t))}function N(t){var e,a,i,n=t[0],o=t[1],r=t[2];return i=r/360*2*Math.PI,e=o*Math.cos(i),a=o*Math.sin(i),[n,e,a]}function E(t){return B(N(t))}function H(t){return z(N(t))}function U(t){return Z[t]}function j(t){return i(U(t))}function q(t){return n(U(t))}function Y(t){return o(U(t))}function X(t){return l(U(t))}function K(t){return u(U(t))}function J(t){return d(U(t))}e.exports={rgb2hsl:i,rgb2hsv:n,rgb2hwb:o,rgb2cmyk:l,rgb2keyword:s,rgb2xyz:d,rgb2lab:u,rgb2lch:c,hsl2rgb:h,hsl2hsv:f,hsl2hwb:p,hsl2cmyk:m,hsl2keyword:v,hsv2rgb:x,hsv2hsl:y,hsv2hwb:k,hsv2cmyk:S,hsv2keyword:w,hwb2rgb:M,hwb2hsl:C,hwb2hsv:D,hwb2cmyk:I,hwb2keyword:A,cmyk2rgb:T,cmyk2hsl:P,cmyk2hsv:F,cmyk2hwb:_,cmyk2keyword:R,keyword2rgb:U,keyword2hsl:j,keyword2hsv:q,keyword2hwb:Y,keyword2cmyk:X,keyword2lab:K,keyword2xyz:J,xyz2rgb:V,xyz2lab:L,xyz2lch:O,lab2xyz:B,lab2rgb:z,lab2lch:W,lch2lab:N,lch2xyz:E,lch2rgb:H};var Z={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]},G={};for(var Q in Z)G[JSON.stringify(Z[Q])]=Q},{}],5:[function(t,e,a){var i=t(4),n=function(){return new d};for(var o in i){n[o+"Raw"]=function(t){return function(e){return"number"==typeof e&&(e=Array.prototype.slice.call(arguments)),i[t](e)}}(o);var r=/(\w+)2(\w+)/.exec(o),l=r[1],s=r[2];n[l]=n[l]||{},n[l][s]=n[o]=function(t){return function(e){"number"==typeof e&&(e=Array.prototype.slice.call(arguments));var a=i[t](e);if("string"==typeof a||void 0===a)return a;for(var n=0;n<a.length;n++)a[n]=Math.round(a[n]);return a}}(o)}var d=function(){this.convs={}};d.prototype.routeSpace=function(t,e){var a=e[0];return void 0===a?this.getValues(t):("number"==typeof a&&(a=Array.prototype.slice.call(e)),this.setValues(t,a))},d.prototype.setValues=function(t,e){return this.space=t,this.convs={},this.convs[t]=e,this},d.prototype.getValues=function(t){var e=this.convs[t];if(!e){var a=this.space,i=this.convs[a];e=n[a][t](i),this.convs[t]=e}return e},["rgb","hsl","hsv","cmyk","keyword"].forEach(function(t){d.prototype[t]=function(e){return this.routeSpace(t,arguments)}}),e.exports=n},{4:4}],6:[function(t,e,a){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]}},{}],7:[function(t,e,a){var i=t(28)();t(26)(i),t(22)(i),t(25)(i),t(21)(i),t(23)(i),t(24)(i),t(29)(i),t(33)(i),t(31)(i),t(34)(i),t(32)(i),t(35)(i),t(30)(i),t(27)(i),t(36)(i),t(37)(i),t(38)(i),t(39)(i),t(40)(i),t(43)(i),t(41)(i),t(42)(i),t(44)(i),t(45)(i),t(46)(i),t(15)(i),t(16)(i),t(17)(i),t(18)(i),t(19)(i),t(20)(i),t(8)(i),t(9)(i),t(10)(i),t(11)(i),t(12)(i),t(13)(i),t(14)(i),window.Chart=e.exports=i},{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,34:34,35:35,36:36,37:37,38:38,39:39,40:40,41:41,42:42,43:43,44:44,45:45,46:46,8:8,9:9}],8:[function(t,e,a){"use strict";e.exports=function(t){t.Bar=function(e,a){return a.type="bar",new t(e,a)}}},{}],9:[function(t,e,a){"use strict";e.exports=function(t){t.Bubble=function(e,a){return a.type="bubble",new t(e,a)}}},{}],10:[function(t,e,a){"use strict";e.exports=function(t){t.Doughnut=function(e,a){return a.type="doughnut",new t(e,a)}}},{}],11:[function(t,e,a){"use strict";e.exports=function(t){t.Line=function(e,a){return a.type="line",new t(e,a)}}},{}],12:[function(t,e,a){"use strict";e.exports=function(t){t.PolarArea=function(e,a){return a.type="polarArea",new t(e,a)}}},{}],13:[function(t,e,a){"use strict";e.exports=function(t){t.Radar=function(e,a){return a.type="radar",new t(e,a)}}},{}],14:[function(t,e,a){"use strict";e.exports=function(t){var e={hover:{mode:"single"},scales:{xAxes:[{type:"linear",position:"bottom",id:"x-axis-1"}],yAxes:[{type:"linear",position:"left",id:"y-axis-1"}]},tooltips:{callbacks:{title:function(){return""},label:function(t){return"("+t.xLabel+", "+t.yLabel+")"}}}};t.defaults.scatter=e,t.controllers.scatter=t.controllers.line,t.Scatter=function(e,a){return a.type="scatter",new t(e,a)}}},{}],15:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers;t.defaults.bar={hover:{mode:"label"},scales:{xAxes:[{type:"category",categoryPercentage:.8,barPercentage:.9,gridLines:{offsetGridLines:!0}}],yAxes:[{type:"linear"}]}},t.controllers.bar=t.DatasetController.extend({dataElementType:t.elements.Rectangle,initialize:function(e,a){t.DatasetController.prototype.initialize.call(this,e,a),this.getMeta().bar=!0},getBarCount:function(){var t=this,a=0;return e.each(t.chart.data.datasets,function(e,i){var n=t.chart.getDatasetMeta(i);n.bar&&t.chart.isDatasetVisible(i)&&++a},t),a},update:function(t){var a=this;e.each(a.getMeta().data,function(e,i){a.updateElement(e,i,t)},a)},updateElement:function(t,a,i){var n=this,o=n.getMeta(),r=n.getScaleForId(o.xAxisID),l=n.getScaleForId(o.yAxisID),s=l.getBasePixel(),d=n.chart.options.elements.rectangle,u=t.custom||{},c=n.getDataset();t._xScale=r,t._yScale=l,t._datasetIndex=n.index,t._index=a;var h=n.getRuler(a);t._model={x:n.calculateBarX(a,n.index,h),y:i?s:n.calculateBarY(a,n.index),label:n.chart.data.labels[a],datasetLabel:c.label,base:i?s:n.calculateBarBase(n.index,a),width:n.calculateBarWidth(h),backgroundColor:u.backgroundColor?u.backgroundColor:e.getValueAtIndexOrDefault(c.backgroundColor,a,d.backgroundColor),borderSkipped:u.borderSkipped?u.borderSkipped:d.borderSkipped,borderColor:u.borderColor?u.borderColor:e.getValueAtIndexOrDefault(c.borderColor,a,d.borderColor),borderWidth:u.borderWidth?u.borderWidth:e.getValueAtIndexOrDefault(c.borderWidth,a,d.borderWidth)},t.pivot()},calculateBarBase:function(t,e){var a=this,i=a.getMeta(),n=a.getScaleForId(i.yAxisID),o=0;if(n.options.stacked){for(var r=a.chart,l=r.data.datasets,s=Number(l[t].data[e]),d=0;t>d;d++){var u=l[d],c=r.getDatasetMeta(d);if(c.bar&&c.yAxisID===n.id&&r.isDatasetVisible(d)){var h=Number(u.data[e]);o+=0>s?Math.min(h,0):Math.max(h,0)}}return n.getPixelForValue(o)}return n.getBasePixel()},getRuler:function(t){var e,a=this,i=a.getMeta(),n=a.getScaleForId(i.xAxisID),o=a.getBarCount();e="category"===n.options.type?n.getPixelForTick(t+1)-n.getPixelForTick(t):n.width/n.ticks.length;var r=e*n.options.categoryPercentage,l=(e-e*n.options.categoryPercentage)/2,s=r/o;if(n.ticks.length!==a.chart.data.labels.length){var d=n.ticks.length/a.chart.data.labels.length;s*=d}var u=s*n.options.barPercentage,c=s-s*n.options.barPercentage;return{datasetCount:o,tickWidth:e,categoryWidth:r,categorySpacing:l,fullBarWidth:s,barWidth:u,barSpacing:c}},calculateBarWidth:function(t){var e=this.getScaleForId(this.getMeta().xAxisID);return e.options.barThickness?e.options.barThickness:e.options.stacked?t.categoryWidth:t.barWidth},getBarIndex:function(t){var e,a,i=0;for(a=0;t>a;++a)e=this.chart.getDatasetMeta(a),e.bar&&this.chart.isDatasetVisible(a)&&++i;return i},calculateBarX:function(t,e,a){var i=this,n=i.getMeta(),o=i.getScaleForId(n.xAxisID),r=i.getBarIndex(e),l=o.getPixelForValue(null,t,e,i.chart.isCombo);return l-=i.chart.isCombo?a.tickWidth/2:0,o.options.stacked?l+a.categoryWidth/2+a.categorySpacing:l+a.barWidth/2+a.categorySpacing+a.barWidth*r+a.barSpacing/2+a.barSpacing*r},calculateBarY:function(t,e){var a=this,i=a.getMeta(),n=a.getScaleForId(i.yAxisID),o=Number(a.getDataset().data[t]);if(n.options.stacked){for(var r=0,l=0,s=0;e>s;s++){var d=a.chart.data.datasets[s],u=a.chart.getDatasetMeta(s);if(u.bar&&u.yAxisID===n.id&&a.chart.isDatasetVisible(s)){var c=Number(d.data[t]);0>c?l+=c||0:r+=c||0}}return 0>o?n.getPixelForValue(l+o):n.getPixelForValue(r+o)}return n.getPixelForValue(o)},draw:function(t){var e,a,i=this,n=t||1,o=i.getMeta().data,r=i.getDataset();for(e=0,a=o.length;a>e;++e){var l=r.data[e];null===l||void 0===l||isNaN(l)||o[e].transition(n).draw()}},setHoverStyle:function(t){var a=this.chart.data.datasets[t._datasetIndex],i=t._index,n=t.custom||{},o=t._model;o.backgroundColor=n.hoverBackgroundColor?n.hoverBackgroundColor:e.getValueAtIndexOrDefault(a.hoverBackgroundColor,i,e.getHoverColor(o.backgroundColor)),o.borderColor=n.hoverBorderColor?n.hoverBorderColor:e.getValueAtIndexOrDefault(a.hoverBorderColor,i,e.getHoverColor(o.borderColor)),o.borderWidth=n.hoverBorderWidth?n.hoverBorderWidth:e.getValueAtIndexOrDefault(a.hoverBorderWidth,i,o.borderWidth)},removeHoverStyle:function(t){var a=this.chart.data.datasets[t._datasetIndex],i=t._index,n=t.custom||{},o=t._model,r=this.chart.options.elements.rectangle;o.backgroundColor=n.backgroundColor?n.backgroundColor:e.getValueAtIndexOrDefault(a.backgroundColor,i,r.backgroundColor),o.borderColor=n.borderColor?n.borderColor:e.getValueAtIndexOrDefault(a.borderColor,i,r.borderColor),o.borderWidth=n.borderWidth?n.borderWidth:e.getValueAtIndexOrDefault(a.borderWidth,i,r.borderWidth)}}),t.defaults.horizontalBar={hover:{mode:"label"},scales:{xAxes:[{type:"linear",position:"bottom"}],yAxes:[{position:"left",type:"category",categoryPercentage:.8,barPercentage:.9,gridLines:{offsetGridLines:!0}}]},elements:{rectangle:{borderSkipped:"left"}},tooltips:{callbacks:{title:function(t,e){var a="";return t.length>0&&(t[0].yLabel?a=t[0].yLabel:e.labels.length>0&&t[0].index<e.labels.length&&(a=e.labels[t[0].index])),a},label:function(t,e){var a=e.datasets[t.datasetIndex].label||"";return a+": "+t.xLabel}}}},t.controllers.horizontalBar=t.controllers.bar.extend({updateElement:function(t,a,i){var n=this,o=n.getMeta(),r=n.getScaleForId(o.xAxisID),l=n.getScaleForId(o.yAxisID),s=r.getBasePixel(),d=t.custom||{},u=n.getDataset(),c=n.chart.options.elements.rectangle;t._xScale=r,t._yScale=l,t._datasetIndex=n.index,t._index=a;var h=n.getRuler(a);t._model={x:i?s:n.calculateBarX(a,n.index),y:n.calculateBarY(a,n.index,h),label:n.chart.data.labels[a],datasetLabel:u.label,base:i?s:n.calculateBarBase(n.index,a),height:n.calculateBarHeight(h),backgroundColor:d.backgroundColor?d.backgroundColor:e.getValueAtIndexOrDefault(u.backgroundColor,a,c.backgroundColor),borderSkipped:d.borderSkipped?d.borderSkipped:c.borderSkipped,borderColor:d.borderColor?d.borderColor:e.getValueAtIndexOrDefault(u.borderColor,a,c.borderColor),borderWidth:d.borderWidth?d.borderWidth:e.getValueAtIndexOrDefault(u.borderWidth,a,c.borderWidth)},t.draw=function(){function t(t){return s[(u+t)%4]}var e=this._chart.ctx,a=this._view,i=a.height/2,n=a.y-i,o=a.y+i,r=a.base-(a.base-a.x),l=a.borderWidth/2;a.borderWidth&&(n+=l,o-=l,r+=l),e.beginPath(),e.fillStyle=a.backgroundColor,e.strokeStyle=a.borderColor,e.lineWidth=a.borderWidth;var s=[[a.base,o],[a.base,n],[r,n],[r,o]],d=["bottom","left","top","right"],u=d.indexOf(a.borderSkipped,0);-1===u&&(u=0),e.moveTo.apply(e,t(0));for(var c=1;4>c;c++)e.lineTo.apply(e,t(c));e.fill(),a.borderWidth&&e.stroke()},t.pivot()},calculateBarBase:function(t,e){var a=this,i=a.getMeta(),n=a.getScaleForId(i.xAxisID),o=0;if(n.options.stacked){for(var r=a.chart,l=r.data.datasets,s=Number(l[t].data[e]),d=0;t>d;d++){var u=l[d],c=r.getDatasetMeta(d);if(c.bar&&c.xAxisID===n.id&&r.isDatasetVisible(d)){
|
11 |
+
var h=Number(u.data[e]);o+=0>s?Math.min(h,0):Math.max(h,0)}}return n.getPixelForValue(o)}return n.getBasePixel()},getRuler:function(t){var e,a=this,i=a.getMeta(),n=a.getScaleForId(i.yAxisID),o=a.getBarCount();e="category"===n.options.type?n.getPixelForTick(t+1)-n.getPixelForTick(t):n.width/n.ticks.length;var r=e*n.options.categoryPercentage,l=(e-e*n.options.categoryPercentage)/2,s=r/o;if(n.ticks.length!==a.chart.data.labels.length){var d=n.ticks.length/a.chart.data.labels.length;s*=d}var u=s*n.options.barPercentage,c=s-s*n.options.barPercentage;return{datasetCount:o,tickHeight:e,categoryHeight:r,categorySpacing:l,fullBarHeight:s,barHeight:u,barSpacing:c}},calculateBarHeight:function(t){var e=this,a=e.getScaleForId(e.getMeta().yAxisID);return a.options.barThickness?a.options.barThickness:a.options.stacked?t.categoryHeight:t.barHeight},calculateBarX:function(t,e){var a=this,i=a.getMeta(),n=a.getScaleForId(i.xAxisID),o=Number(a.getDataset().data[t]);if(n.options.stacked){for(var r=0,l=0,s=0;e>s;s++){var d=a.chart.data.datasets[s],u=a.chart.getDatasetMeta(s);if(u.bar&&u.xAxisID===n.id&&a.chart.isDatasetVisible(s)){var c=Number(d.data[t]);0>c?l+=c||0:r+=c||0}}return 0>o?n.getPixelForValue(l+o):n.getPixelForValue(r+o)}return n.getPixelForValue(o)},calculateBarY:function(t,e,a){var i=this,n=i.getMeta(),o=i.getScaleForId(n.yAxisID),r=i.getBarIndex(e),l=o.getPixelForValue(null,t,e,i.chart.isCombo);return l-=i.chart.isCombo?a.tickHeight/2:0,o.options.stacked?l+a.categoryHeight/2+a.categorySpacing:l+a.barHeight/2+a.categorySpacing+a.barHeight*r+a.barSpacing/2+a.barSpacing*r}})}},{}],16:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers;t.defaults.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 a=e.datasets[t.datasetIndex].label||"",i=e.datasets[t.datasetIndex].data[t.index];return a+": ("+t.xLabel+", "+t.yLabel+", "+i.r+")"}}}},t.controllers.bubble=t.DatasetController.extend({dataElementType:t.elements.Point,update:function(t){var a=this,i=a.getMeta(),n=i.data;e.each(n,function(e,i){a.updateElement(e,i,t)})},updateElement:function(a,i,n){var o=this,r=o.getMeta(),l=o.getScaleForId(r.xAxisID),s=o.getScaleForId(r.yAxisID),d=a.custom||{},u=o.getDataset(),c=u.data[i],h=o.chart.options.elements.point,f=o.index;e.extend(a,{_xScale:l,_yScale:s,_datasetIndex:f,_index:i,_model:{x:n?l.getPixelForDecimal(.5):l.getPixelForValue("object"==typeof c?c:NaN,i,f,o.chart.isCombo),y:n?s.getBasePixel():s.getPixelForValue(c,i,f),radius:n?0:d.radius?d.radius:o.getRadius(c),hitRadius:d.hitRadius?d.hitRadius:e.getValueAtIndexOrDefault(u.hitRadius,i,h.hitRadius)}}),t.DatasetController.prototype.removeHoverStyle.call(o,a,h);var g=a._model;g.skip=d.skip?d.skip:isNaN(g.x)||isNaN(g.y),a.pivot()},getRadius:function(t){return t.r||this.chart.options.elements.point.radius},setHoverStyle:function(a){var i=this;t.DatasetController.prototype.setHoverStyle.call(i,a);var n=i.chart.data.datasets[a._datasetIndex],o=a._index,r=a.custom||{},l=a._model;l.radius=r.hoverRadius?r.hoverRadius:e.getValueAtIndexOrDefault(n.hoverRadius,o,i.chart.options.elements.point.hoverRadius)+i.getRadius(n.data[o])},removeHoverStyle:function(e){var a=this;t.DatasetController.prototype.removeHoverStyle.call(a,e,a.chart.options.elements.point);var i=a.chart.data.datasets[e._datasetIndex].data[e._index],n=e.custom||{},o=e._model;o.radius=n.radius?n.radius:a.getRadius(i)}})}},{}],17:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers,a=t.defaults;a.doughnut={animation:{animateRotate:!0,animateScale:!1},aspectRatio:1,hover:{mode:"single"},legendCallback:function(t){var e=[];e.push('<ul class="'+t.id+'-legend">');var a=t.data,i=a.datasets,n=a.labels;if(i.length)for(var o=0;o<i[0].data.length;++o)e.push('<li><span style="background-color:'+i[0].backgroundColor[o]+'"></span>'),n[o]&&e.push(n[o]),e.push("</li>");return e.push("</ul>"),e.join("")},legend:{labels:{generateLabels:function(t){var a=t.data;return a.labels.length&&a.datasets.length?a.labels.map(function(i,n){var o=t.getDatasetMeta(0),r=a.datasets[0],l=o.data[n],s=l&&l.custom||{},d=e.getValueAtIndexOrDefault,u=t.options.elements.arc,c=s.backgroundColor?s.backgroundColor:d(r.backgroundColor,n,u.backgroundColor),h=s.borderColor?s.borderColor:d(r.borderColor,n,u.borderColor),f=s.borderWidth?s.borderWidth:d(r.borderWidth,n,u.borderWidth);return{text:i,fillStyle:c,strokeStyle:h,lineWidth:f,hidden:isNaN(r.data[n])||o.data[n].hidden,index:n}}):[]}},onClick:function(t,e){var a,i,n,o=e.index,r=this.chart;for(a=0,i=(r.data.datasets||[]).length;i>a;++a)n=r.getDatasetMeta(a),n.data[o]&&(n.data[o].hidden=!n.data[o].hidden);r.update()}},cutoutPercentage:50,rotation:Math.PI*-.5,circumference:2*Math.PI,tooltips:{callbacks:{title:function(){return""},label:function(t,a){var i=a.labels[t.index],n=": "+a.datasets[t.datasetIndex].data[t.index];return e.isArray(i)?(i=i.slice(),i[0]+=n):i+=n,i}}}},a.pie=e.clone(a.doughnut),e.extend(a.pie,{cutoutPercentage:0}),t.controllers.doughnut=t.controllers.pie=t.DatasetController.extend({dataElementType:t.elements.Arc,linkScales:e.noop,getRingIndex:function(t){for(var e=0,a=0;t>a;++a)this.chart.isDatasetVisible(a)&&++e;return e},update:function(t){var a=this,i=a.chart,n=i.chartArea,o=i.options,r=o.elements.arc,l=n.right-n.left-r.borderWidth,s=n.bottom-n.top-r.borderWidth,d=Math.min(l,s),u={x:0,y:0},c=a.getMeta(),h=o.cutoutPercentage,f=o.circumference;if(f<2*Math.PI){var g=o.rotation%(2*Math.PI);g+=2*Math.PI*(g>=Math.PI?-1:g<-Math.PI?1:0);var p=g+f,m={x:Math.cos(g),y:Math.sin(g)},b={x:Math.cos(p),y:Math.sin(p)},v=0>=g&&p>=0||g<=2*Math.PI&&2*Math.PI<=p,x=g<=.5*Math.PI&&.5*Math.PI<=p||g<=2.5*Math.PI&&2.5*Math.PI<=p,y=g<=-Math.PI&&-Math.PI<=p||g<=Math.PI&&Math.PI<=p,k=g<=.5*-Math.PI&&.5*-Math.PI<=p||g<=1.5*Math.PI&&1.5*Math.PI<=p,S=h/100,w={x:y?-1:Math.min(m.x*(m.x<0?1:S),b.x*(b.x<0?1:S)),y:k?-1:Math.min(m.y*(m.y<0?1:S),b.y*(b.y<0?1:S))},M={x:v?1:Math.max(m.x*(m.x>0?1:S),b.x*(b.x>0?1:S)),y:x?1:Math.max(m.y*(m.y>0?1:S),b.y*(b.y>0?1:S))},C={width:.5*(M.x-w.x),height:.5*(M.y-w.y)};d=Math.min(l/C.width,s/C.height),u={x:(M.x+w.x)*-.5,y:(M.y+w.y)*-.5}}i.borderWidth=a.getMaxBorderWidth(c.data),i.outerRadius=Math.max((d-i.borderWidth)/2,0),i.innerRadius=Math.max(h?i.outerRadius/100*h:1,0),i.radiusLength=(i.outerRadius-i.innerRadius)/i.getVisibleDatasetCount(),i.offsetX=u.x*i.outerRadius,i.offsetY=u.y*i.outerRadius,c.total=a.calculateTotal(),a.outerRadius=i.outerRadius-i.radiusLength*a.getRingIndex(a.index),a.innerRadius=a.outerRadius-i.radiusLength,e.each(c.data,function(e,i){a.updateElement(e,i,t)})},updateElement:function(t,a,i){var n=this,o=n.chart,r=o.chartArea,l=o.options,s=l.animation,d=(r.left+r.right)/2,u=(r.top+r.bottom)/2,c=l.rotation,h=l.rotation,f=n.getDataset(),g=i&&s.animateRotate?0:t.hidden?0:n.calculateCircumference(f.data[a])*(l.circumference/(2*Math.PI)),p=i&&s.animateScale?0:n.innerRadius,m=i&&s.animateScale?0:n.outerRadius,b=e.getValueAtIndexOrDefault;e.extend(t,{_datasetIndex:n.index,_index:a,_model:{x:d+o.offsetX,y:u+o.offsetY,startAngle:c,endAngle:h,circumference:g,outerRadius:m,innerRadius:p,label:b(f.label,a,o.data.labels[a])}});var v=t._model;this.removeHoverStyle(t),i&&s.animateRotate||(0===a?v.startAngle=l.rotation:v.startAngle=n.getMeta().data[a-1]._model.endAngle,v.endAngle=v.startAngle+v.circumference),t.pivot()},removeHoverStyle:function(e){t.DatasetController.prototype.removeHoverStyle.call(this,e,this.chart.options.elements.arc)},calculateTotal:function(){var t,a=this.getDataset(),i=this.getMeta(),n=0;return e.each(i.data,function(e,i){t=a.data[i],isNaN(t)||e.hidden||(n+=Math.abs(t))}),n},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,a,i=0,n=this.index,o=t.length,r=0;o>r;r++)e=t[r]._model?t[r]._model.borderWidth:0,a=t[r]._chart?t[r]._chart.config.data.datasets[n].hoverBorderWidth:0,i=e>i?e:i,i=a>i?a:i;return i}})}},{}],18:[function(t,e,a){"use strict";e.exports=function(t){function e(t,e){return a.getValueOrDefault(t.showLine,e.showLines)}var a=t.helpers;t.defaults.line={showLines:!0,spanGaps:!1,hover:{mode:"label"},scales:{xAxes:[{type:"category",id:"x-axis-0"}],yAxes:[{type:"linear",id:"y-axis-0"}]}},t.controllers.line=t.DatasetController.extend({datasetElementType:t.elements.Line,dataElementType:t.elements.Point,update:function(t){var i,n,o,r=this,l=r.getMeta(),s=l.dataset,d=l.data||[],u=r.chart.options,c=u.elements.line,h=r.getScaleForId(l.yAxisID),f=r.getDataset(),g=e(f,u);for(g&&(o=s.custom||{},void 0!==f.tension&&void 0===f.lineTension&&(f.lineTension=f.tension),s._scale=h,s._datasetIndex=r.index,s._children=d,s._model={spanGaps:f.spanGaps?f.spanGaps:u.spanGaps,tension:o.tension?o.tension:a.getValueOrDefault(f.lineTension,c.tension),backgroundColor:o.backgroundColor?o.backgroundColor:f.backgroundColor||c.backgroundColor,borderWidth:o.borderWidth?o.borderWidth:f.borderWidth||c.borderWidth,borderColor:o.borderColor?o.borderColor:f.borderColor||c.borderColor,borderCapStyle:o.borderCapStyle?o.borderCapStyle:f.borderCapStyle||c.borderCapStyle,borderDash:o.borderDash?o.borderDash:f.borderDash||c.borderDash,borderDashOffset:o.borderDashOffset?o.borderDashOffset:f.borderDashOffset||c.borderDashOffset,borderJoinStyle:o.borderJoinStyle?o.borderJoinStyle:f.borderJoinStyle||c.borderJoinStyle,fill:o.fill?o.fill:void 0!==f.fill?f.fill:c.fill,steppedLine:o.steppedLine?o.steppedLine:a.getValueOrDefault(f.steppedLine,c.stepped),cubicInterpolationMode:o.cubicInterpolationMode?o.cubicInterpolationMode:a.getValueOrDefault(f.cubicInterpolationMode,c.cubicInterpolationMode),scaleTop:h.top,scaleBottom:h.bottom,scaleZero:h.getBasePixel()},s.pivot()),i=0,n=d.length;n>i;++i)r.updateElement(d[i],i,t);for(g&&0!==s._model.tension&&r.updateBezierControlPoints(),i=0,n=d.length;n>i;++i)d[i].pivot()},getPointBackgroundColor:function(t,e){var i=this.chart.options.elements.point.backgroundColor,n=this.getDataset(),o=t.custom||{};return o.backgroundColor?i=o.backgroundColor:n.pointBackgroundColor?i=a.getValueAtIndexOrDefault(n.pointBackgroundColor,e,i):n.backgroundColor&&(i=n.backgroundColor),i},getPointBorderColor:function(t,e){var i=this.chart.options.elements.point.borderColor,n=this.getDataset(),o=t.custom||{};return o.borderColor?i=o.borderColor:n.pointBorderColor?i=a.getValueAtIndexOrDefault(n.pointBorderColor,e,i):n.borderColor&&(i=n.borderColor),i},getPointBorderWidth:function(t,e){var i=this.chart.options.elements.point.borderWidth,n=this.getDataset(),o=t.custom||{};return o.borderWidth?i=o.borderWidth:n.pointBorderWidth?i=a.getValueAtIndexOrDefault(n.pointBorderWidth,e,i):n.borderWidth&&(i=n.borderWidth),i},updateElement:function(t,e,i){var n,o,r=this,l=r.getMeta(),s=t.custom||{},d=r.getDataset(),u=r.index,c=d.data[e],h=r.getScaleForId(l.yAxisID),f=r.getScaleForId(l.xAxisID),g=r.chart.options.elements.point,p=r.chart.data.labels||[],m=1===p.length||1===d.data.length||r.chart.isCombo;void 0!==d.radius&&void 0===d.pointRadius&&(d.pointRadius=d.radius),void 0!==d.hitRadius&&void 0===d.pointHitRadius&&(d.pointHitRadius=d.hitRadius),n=f.getPixelForValue("object"==typeof c?c:NaN,e,u,m),o=i?h.getBasePixel():r.calculatePointY(c,e,u),t._xScale=f,t._yScale=h,t._datasetIndex=u,t._index=e,t._model={x:n,y:o,skip:s.skip||isNaN(n)||isNaN(o),radius:s.radius||a.getValueAtIndexOrDefault(d.pointRadius,e,g.radius),pointStyle:s.pointStyle||a.getValueAtIndexOrDefault(d.pointStyle,e,g.pointStyle),backgroundColor:r.getPointBackgroundColor(t,e),borderColor:r.getPointBorderColor(t,e),borderWidth:r.getPointBorderWidth(t,e),tension:l.dataset._model?l.dataset._model.tension:0,steppedLine:l.dataset._model?l.dataset._model.steppedLine:!1,hitRadius:s.hitRadius||a.getValueAtIndexOrDefault(d.pointHitRadius,e,g.hitRadius)}},calculatePointY:function(t,e,a){var i,n,o,r=this,l=r.chart,s=r.getMeta(),d=r.getScaleForId(s.yAxisID),u=0,c=0;if(d.options.stacked){for(i=0;a>i;i++)if(n=l.data.datasets[i],o=l.getDatasetMeta(i),"line"===o.type&&o.yAxisID===d.id&&l.isDatasetVisible(i)){var h=Number(d.getRightValue(n.data[e]));0>h?c+=h||0:u+=h||0}var f=Number(d.getRightValue(t));return 0>f?d.getPixelForValue(c+f):d.getPixelForValue(u+f)}return d.getPixelForValue(t)},updateBezierControlPoints:function(){function t(t,e,a){return Math.max(Math.min(t,a),e)}var e,i,n,o,r,l=this,s=l.getMeta(),d=l.chart.chartArea,u=s.data||[];if(s.dataset._model.spanGaps&&(u=u.filter(function(t){return!t._model.skip})),"monotone"===s.dataset._model.cubicInterpolationMode)a.splineCurveMonotone(u);else for(e=0,i=u.length;i>e;++e)n=u[e],o=n._model,r=a.splineCurve(a.previousItem(u,e)._model,o,a.nextItem(u,e)._model,s.dataset._model.tension),o.controlPointPreviousX=r.previous.x,o.controlPointPreviousY=r.previous.y,o.controlPointNextX=r.next.x,o.controlPointNextY=r.next.y;if(l.chart.options.elements.line.capBezierPoints)for(e=0,i=u.length;i>e;++e)o=u[e]._model,o.controlPointPreviousX=t(o.controlPointPreviousX,d.left,d.right),o.controlPointPreviousY=t(o.controlPointPreviousY,d.top,d.bottom),o.controlPointNextX=t(o.controlPointNextX,d.left,d.right),o.controlPointNextY=t(o.controlPointNextY,d.top,d.bottom)},draw:function(t){var a,i,n=this,o=n.getMeta(),r=o.data||[],l=t||1;for(a=0,i=r.length;i>a;++a)r[a].transition(l);for(e(n.getDataset(),n.chart.options)&&o.dataset.transition(l).draw(),a=0,i=r.length;i>a;++a)r[a].draw()},setHoverStyle:function(t){var e=this.chart.data.datasets[t._datasetIndex],i=t._index,n=t.custom||{},o=t._model;o.radius=n.hoverRadius||a.getValueAtIndexOrDefault(e.pointHoverRadius,i,this.chart.options.elements.point.hoverRadius),o.backgroundColor=n.hoverBackgroundColor||a.getValueAtIndexOrDefault(e.pointHoverBackgroundColor,i,a.getHoverColor(o.backgroundColor)),o.borderColor=n.hoverBorderColor||a.getValueAtIndexOrDefault(e.pointHoverBorderColor,i,a.getHoverColor(o.borderColor)),o.borderWidth=n.hoverBorderWidth||a.getValueAtIndexOrDefault(e.pointHoverBorderWidth,i,o.borderWidth)},removeHoverStyle:function(t){var e=this,i=e.chart.data.datasets[t._datasetIndex],n=t._index,o=t.custom||{},r=t._model;void 0!==i.radius&&void 0===i.pointRadius&&(i.pointRadius=i.radius),r.radius=o.radius||a.getValueAtIndexOrDefault(i.pointRadius,n,e.chart.options.elements.point.radius),r.backgroundColor=e.getPointBackgroundColor(t,n),r.borderColor=e.getPointBorderColor(t,n),r.borderWidth=e.getPointBorderWidth(t,n)}})}},{}],19:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers;t.defaults.polarArea={scale:{type:"radialLinear",lineArc:!0,ticks:{beginAtZero:!0}},animation:{animateRotate:!0,animateScale:!0},startAngle:-.5*Math.PI,aspectRatio:1,legendCallback:function(t){var e=[];e.push('<ul class="'+t.id+'-legend">');var a=t.data,i=a.datasets,n=a.labels;if(i.length)for(var o=0;o<i[0].data.length;++o)e.push('<li><span style="background-color:'+i[0].backgroundColor[o]+'"></span>'),n[o]&&e.push(n[o]),e.push("</li>");return e.push("</ul>"),e.join("")},legend:{labels:{generateLabels:function(t){var a=t.data;return a.labels.length&&a.datasets.length?a.labels.map(function(i,n){var o=t.getDatasetMeta(0),r=a.datasets[0],l=o.data[n],s=l.custom||{},d=e.getValueAtIndexOrDefault,u=t.options.elements.arc,c=s.backgroundColor?s.backgroundColor:d(r.backgroundColor,n,u.backgroundColor),h=s.borderColor?s.borderColor:d(r.borderColor,n,u.borderColor),f=s.borderWidth?s.borderWidth:d(r.borderWidth,n,u.borderWidth);return{text:i,fillStyle:c,strokeStyle:h,lineWidth:f,hidden:isNaN(r.data[n])||o.data[n].hidden,index:n}}):[]}},onClick:function(t,e){var a,i,n,o=e.index,r=this.chart;for(a=0,i=(r.data.datasets||[]).length;i>a;++a)n=r.getDatasetMeta(a),n.data[o].hidden=!n.data[o].hidden;r.update()}},tooltips:{callbacks:{title:function(){return""},label:function(t,e){return e.labels[t.index]+": "+t.yLabel}}}},t.controllers.polarArea=t.DatasetController.extend({dataElementType:t.elements.Arc,linkScales:e.noop,update:function(t){var a=this,i=a.chart,n=i.chartArea,o=a.getMeta(),r=i.options,l=r.elements.arc,s=Math.min(n.right-n.left,n.bottom-n.top);i.outerRadius=Math.max((s-l.borderWidth/2)/2,0),i.innerRadius=Math.max(r.cutoutPercentage?i.outerRadius/100*r.cutoutPercentage:1,0),i.radiusLength=(i.outerRadius-i.innerRadius)/i.getVisibleDatasetCount(),a.outerRadius=i.outerRadius-i.radiusLength*a.index,a.innerRadius=a.outerRadius-i.radiusLength,o.count=a.countVisibleElements(),e.each(o.data,function(e,i){a.updateElement(e,i,t)})},updateElement:function(t,a,i){for(var n=this,o=n.chart,r=n.getDataset(),l=o.options,s=l.animation,d=o.scale,u=e.getValueAtIndexOrDefault,c=o.data.labels,h=n.calculateCircumference(r.data[a]),f=d.xCenter,g=d.yCenter,p=0,m=n.getMeta(),b=0;a>b;++b)isNaN(r.data[b])||m.data[b].hidden||++p;var v=l.startAngle,x=t.hidden?0:d.getDistanceFromCenterForValue(r.data[a]),y=v+h*p,k=y+(t.hidden?0:h),S=s.animateScale?0:d.getDistanceFromCenterForValue(r.data[a]);e.extend(t,{_datasetIndex:n.index,_index:a,_scale:d,_model:{x:f,y:g,innerRadius:0,outerRadius:i?S:x,startAngle:i&&s.animateRotate?v:y,endAngle:i&&s.animateRotate?v:k,label:u(c,a,c[a])}}),n.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(),a=this.getMeta(),i=0;return e.each(a.data,function(e,a){isNaN(t.data[a])||e.hidden||i++}),i},calculateCircumference:function(t){var e=this.getMeta().count;return e>0&&!isNaN(t)?2*Math.PI/e:0}})}},{}],20:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers;t.defaults.radar={aspectRatio:1,scale:{type:"radialLinear"},elements:{line:{tension:0}}},t.controllers.radar=t.DatasetController.extend({datasetElementType:t.elements.Line,dataElementType:t.elements.Point,linkScales:e.noop,update:function(t){var a=this,i=a.getMeta(),n=i.dataset,o=i.data,r=n.custom||{},l=a.getDataset(),s=a.chart.options.elements.line,d=a.chart.scale;void 0!==l.tension&&void 0===l.lineTension&&(l.lineTension=l.tension),e.extend(i.dataset,{_datasetIndex:a.index,_children:o,_loop:!0,_model:{tension:r.tension?r.tension:e.getValueOrDefault(l.lineTension,s.tension),backgroundColor:r.backgroundColor?r.backgroundColor:l.backgroundColor||s.backgroundColor,borderWidth:r.borderWidth?r.borderWidth:l.borderWidth||s.borderWidth,borderColor:r.borderColor?r.borderColor:l.borderColor||s.borderColor,fill:r.fill?r.fill:void 0!==l.fill?l.fill:s.fill,borderCapStyle:r.borderCapStyle?r.borderCapStyle:l.borderCapStyle||s.borderCapStyle,borderDash:r.borderDash?r.borderDash:l.borderDash||s.borderDash,borderDashOffset:r.borderDashOffset?r.borderDashOffset:l.borderDashOffset||s.borderDashOffset,borderJoinStyle:r.borderJoinStyle?r.borderJoinStyle:l.borderJoinStyle||s.borderJoinStyle,scaleTop:d.top,scaleBottom:d.bottom,scaleZero:d.getBasePosition()}}),i.dataset.pivot(),e.each(o,function(e,i){a.updateElement(e,i,t)},a),a.updateBezierControlPoints()},updateElement:function(t,a,i){var n=this,o=t.custom||{},r=n.getDataset(),l=n.chart.scale,s=n.chart.options.elements.point,d=l.getPointPositionForValue(a,r.data[a]);e.extend(t,{_datasetIndex:n.index,_index:a,_scale:l,_model:{x:i?l.xCenter:d.x,y:i?l.yCenter:d.y,tension:o.tension?o.tension:e.getValueOrDefault(r.tension,n.chart.options.elements.line.tension),radius:o.radius?o.radius:e.getValueAtIndexOrDefault(r.pointRadius,a,s.radius),backgroundColor:o.backgroundColor?o.backgroundColor:e.getValueAtIndexOrDefault(r.pointBackgroundColor,a,s.backgroundColor),borderColor:o.borderColor?o.borderColor:e.getValueAtIndexOrDefault(r.pointBorderColor,a,s.borderColor),borderWidth:o.borderWidth?o.borderWidth:e.getValueAtIndexOrDefault(r.pointBorderWidth,a,s.borderWidth),pointStyle:o.pointStyle?o.pointStyle:e.getValueAtIndexOrDefault(r.pointStyle,a,s.pointStyle),hitRadius:o.hitRadius?o.hitRadius:e.getValueAtIndexOrDefault(r.hitRadius,a,s.hitRadius)}}),t._model.skip=o.skip?o.skip:isNaN(t._model.x)||isNaN(t._model.y)},updateBezierControlPoints:function(){var t=this.chart.chartArea,a=this.getMeta();e.each(a.data,function(i,n){var o=i._model,r=e.splineCurve(e.previousItem(a.data,n,!0)._model,o,e.nextItem(a.data,n,!0)._model,o.tension);o.controlPointPreviousX=Math.max(Math.min(r.previous.x,t.right),t.left),o.controlPointPreviousY=Math.max(Math.min(r.previous.y,t.bottom),t.top),o.controlPointNextX=Math.max(Math.min(r.next.x,t.right),t.left),o.controlPointNextY=Math.max(Math.min(r.next.y,t.bottom),t.top),i.pivot()})},draw:function(t){var a=this.getMeta(),i=t||1;e.each(a.data,function(t){t.transition(i)}),a.dataset.transition(i).draw(),e.each(a.data,function(t){t.draw()})},setHoverStyle:function(t){var a=this.chart.data.datasets[t._datasetIndex],i=t.custom||{},n=t._index,o=t._model;o.radius=i.hoverRadius?i.hoverRadius:e.getValueAtIndexOrDefault(a.pointHoverRadius,n,this.chart.options.elements.point.hoverRadius),o.backgroundColor=i.hoverBackgroundColor?i.hoverBackgroundColor:e.getValueAtIndexOrDefault(a.pointHoverBackgroundColor,n,e.getHoverColor(o.backgroundColor)),o.borderColor=i.hoverBorderColor?i.hoverBorderColor:e.getValueAtIndexOrDefault(a.pointHoverBorderColor,n,e.getHoverColor(o.borderColor)),o.borderWidth=i.hoverBorderWidth?i.hoverBorderWidth:e.getValueAtIndexOrDefault(a.pointHoverBorderWidth,n,o.borderWidth)},removeHoverStyle:function(t){var a=this.chart.data.datasets[t._datasetIndex],i=t.custom||{},n=t._index,o=t._model,r=this.chart.options.elements.point;o.radius=i.radius?i.radius:e.getValueAtIndexOrDefault(a.radius,n,r.radius),o.backgroundColor=i.backgroundColor?i.backgroundColor:e.getValueAtIndexOrDefault(a.pointBackgroundColor,n,r.backgroundColor),o.borderColor=i.borderColor?i.borderColor:e.getValueAtIndexOrDefault(a.pointBorderColor,n,r.borderColor),o.borderWidth=i.borderWidth?i.borderWidth:e.getValueAtIndexOrDefault(a.pointBorderWidth,n,r.borderWidth)}})}},{}],21:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers;t.defaults.global.animation={duration:1e3,easing:"easeOutQuart",onProgress:e.noop,onComplete:e.noop},t.Animation=t.Element.extend({currentStep:null,numSteps:60,easing:"",render:null,onAnimationProgress:null,onAnimationComplete:null}),t.animationService={frameDuration:17,animations:[],dropFrames:0,request:null,addAnimation:function(t,e,a,i){var n=this;i||(t.animating=!0);for(var o=0;o<n.animations.length;++o)if(n.animations[o].chartInstance===t)return void(n.animations[o].animationObject=e);n.animations.push({chartInstance:t,animationObject:e}),1===n.animations.length&&n.requestAnimationFrame()},cancelAnimation:function(t){var a=e.findIndex(this.animations,function(e){return e.chartInstance===t});-1!==a&&(this.animations.splice(a,1),t.animating=!1)},requestAnimationFrame:function(){var t=this;null===t.request&&(t.request=e.requestAnimFrame.call(window,function(){t.request=null,t.startDigest()}))},startDigest:function(){var t=this,e=Date.now(),a=0;t.dropFrames>1&&(a=Math.floor(t.dropFrames),t.dropFrames=t.dropFrames%1);for(var i=0;i<t.animations.length;)null===t.animations[i].animationObject.currentStep&&(t.animations[i].animationObject.currentStep=0),t.animations[i].animationObject.currentStep+=1+a,t.animations[i].animationObject.currentStep>t.animations[i].animationObject.numSteps&&(t.animations[i].animationObject.currentStep=t.animations[i].animationObject.numSteps),t.animations[i].animationObject.render(t.animations[i].chartInstance,t.animations[i].animationObject),t.animations[i].animationObject.onAnimationProgress&&t.animations[i].animationObject.onAnimationProgress.call&&t.animations[i].animationObject.onAnimationProgress.call(t.animations[i].chartInstance,t.animations[i]),t.animations[i].animationObject.currentStep===t.animations[i].animationObject.numSteps?(t.animations[i].animationObject.onAnimationComplete&&t.animations[i].animationObject.onAnimationComplete.call&&t.animations[i].animationObject.onAnimationComplete.call(t.animations[i].chartInstance,t.animations[i]),t.animations[i].chartInstance.animating=!1,t.animations.splice(i,1)):++i;var n=Date.now(),o=(n-e)/t.frameDuration;t.dropFrames+=o,t.animations.length>0&&t.requestAnimationFrame()}}}},{}],22:[function(t,e,a){"use strict";e.exports=function(t){var e=t.canvasHelpers={};e.drawPoint=function(t,e,a,i,n){var o,r,l,s,d,u;if("object"==typeof e&&(o=e.toString(),"[object HTMLImageElement]"===o||"[object HTMLCanvasElement]"===o))return void t.drawImage(e,i-e.width/2,n-e.height/2);if(!(isNaN(a)||0>=a)){switch(e){default:t.beginPath(),t.arc(i,n,a,0,2*Math.PI),t.closePath(),t.fill();break;case"triangle":t.beginPath(),r=3*a/Math.sqrt(3),d=r*Math.sqrt(3)/2,t.moveTo(i-r/2,n+d/3),t.lineTo(i+r/2,n+d/3),t.lineTo(i,n-2*d/3),t.closePath(),t.fill();break;case"rect":u=1/Math.SQRT2*a,t.beginPath(),t.fillRect(i-u,n-u,2*u,2*u),t.strokeRect(i-u,n-u,2*u,2*u);break;case"rectRot":u=1/Math.SQRT2*a,t.beginPath(),t.moveTo(i-u,n),t.lineTo(i,n+u),t.lineTo(i+u,n),t.lineTo(i,n-u),t.closePath(),t.fill();break;case"cross":t.beginPath(),t.moveTo(i,n+a),t.lineTo(i,n-a),t.moveTo(i-a,n),t.lineTo(i+a,n),t.closePath();break;case"crossRot":t.beginPath(),l=Math.cos(Math.PI/4)*a,s=Math.sin(Math.PI/4)*a,t.moveTo(i-l,n-s),t.lineTo(i+l,n+s),t.moveTo(i-l,n+s),t.lineTo(i+l,n-s),t.closePath();break;case"star":t.beginPath(),t.moveTo(i,n+a),t.lineTo(i,n-a),t.moveTo(i-a,n),t.lineTo(i+a,n),l=Math.cos(Math.PI/4)*a,s=Math.sin(Math.PI/4)*a,t.moveTo(i-l,n-s),t.lineTo(i+l,n+s),t.moveTo(i-l,n+s),t.lineTo(i+l,n-s),t.closePath();break;case"line":t.beginPath(),t.moveTo(i-a,n),t.lineTo(i+a,n),t.closePath();break;case"dash":t.beginPath(),t.moveTo(i,n),t.lineTo(i+a,n),t.closePath()}t.stroke()}}}},{}],23:[function(t,e,a){"use strict";e.exports=function(t){function e(t,e){var a=r.getStyle(t,e),i=a&&a.match(/(\d+)px/);return i?Number(i[1]):void 0}function a(t,a){var i=t.style,n=t.getAttribute("height"),o=t.getAttribute("width");if(t._chartjs={initial:{height:n,width:o,style:{display:i.display,height:i.height,width:i.width}}},i.display=i.display||"block",null===o||""===o){var r=e(t,"width");void 0!==r&&(t.width=r)}if(null===n||""===n)if(""===t.style.height)t.height=t.width/(a.options.aspectRatio||2);else{var l=e(t,"height");void 0!==r&&(t.height=l)}return t}function i(t){if(t._chartjs){var e=t._chartjs.initial;["height","width"].forEach(function(a){var i=e[a];void 0===i||null===i?t.removeAttribute(a):t.setAttribute(a,i)}),r.each(e.style||{},function(e,a){t.style[a]=e}),t.width=t.width,delete t._chartjs}}function n(t,e){if("string"==typeof t?t=document.getElementById(t):t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t instanceof HTMLCanvasElement){var i=t.getContext&&t.getContext("2d");if(i instanceof CanvasRenderingContext2D)return a(t,e),i}return null}function o(e){e=e||{};var a=e.data=e.data||{};return a.datasets=a.datasets||[],a.labels=a.labels||[],e.options=r.configMerge(t.defaults.global,t.defaults[e.type],e.options||{}),e}var r=t.helpers;t.types={},t.instances={},t.controllers={},t.Controller=function(e,a,i){var l=this;a=o(a);var s=n(e,a),d=s&&s.canvas,u=d&&d.height,c=d&&d.width;return i.ctx=s,i.canvas=d,i.config=a,i.width=c,i.height=u,i.aspectRatio=u?c/u:null,l.id=r.uid(),l.chart=i,l.config=a,l.options=a.options,l._bufferedRender=!1,t.instances[l.id]=l,Object.defineProperty(l,"data",{get:function(){return l.config.data}}),s&&d?(r.retinaScale(i),l.options.responsive&&(r.addResizeListener(d.parentNode,function(){l.resize()}),l.resize(!0)),l.initialize(),l):(console.error("Failed to create chart: can't acquire context from the given item"),l)},r.extend(t.Controller.prototype,{initialize:function(){var e=this;return t.plugins.notify("beforeInit",[e]),e.bindEvents(),e.ensureScalesHaveIDs(),e.buildOrUpdateControllers(),e.buildScales(),e.updateLayout(),e.resetElements(),e.initToolTip(),e.update(),t.plugins.notify("afterInit",[e]),e},clear:function(){return r.clear(this.chart),this},stop:function(){return t.animationService.cancelAnimation(this),this},resize:function(e){var a=this,i=a.chart,n=a.options,o=i.canvas,l=n.maintainAspectRatio&&i.aspectRatio||null,s=Math.floor(r.getMaximumWidth(o)),d=Math.floor(l?s/l:r.getMaximumHeight(o));if(i.width!==s||i.height!==d){o.width=i.width=s,o.height=i.height=d,o.style.width=s+"px",o.style.height=d+"px",r.retinaScale(i);var u={width:s,height:d};t.plugins.notify("resize",[a,u]),a.options.onResize&&a.options.onResize(a,u),e||(a.stop(),a.update(a.options.responsiveAnimationDuration))}},ensureScalesHaveIDs:function(){var t=this.options,e=t.scales||{},a=t.scale;r.each(e.xAxes,function(t,e){t.id=t.id||"x-axis-"+e}),r.each(e.yAxes,function(t,e){t.id=t.id||"y-axis-"+e}),a&&(a.id=a.id||"scale")},buildScales:function(){var e=this,a=e.options,i=e.scales={},n=[];a.scales&&(n=n.concat((a.scales.xAxes||[]).map(function(t){return{options:t,dtype:"category"}}),(a.scales.yAxes||[]).map(function(t){return{options:t,dtype:"linear"}}))),a.scale&&n.push({options:a.scale,dtype:"radialLinear",isDefault:!0}),r.each(n,function(a){var n=a.options,o=r.getValueOrDefault(n.type,a.dtype),l=t.scaleService.getScaleConstructor(o);if(l){var s=new l({id:n.id,options:n,ctx:e.chart.ctx,chart:e});i[s.id]=s,a.isDefault&&(e.scale=s)}}),t.scaleService.addScalesToLayout(this)},updateLayout:function(){t.layoutService.update(this,this.chart.width,this.chart.height)},buildOrUpdateControllers:function(){var e=this,a=[],i=[];if(r.each(e.data.datasets,function(n,o){var r=e.getDatasetMeta(o);r.type||(r.type=n.type||e.config.type),a.push(r.type),r.controller?r.controller.updateIndex(o):(r.controller=new t.controllers[r.type](e,o),i.push(r.controller))},e),a.length>1)for(var n=1;n<a.length;n++)if(a[n]!==a[n-1]){e.isCombo=!0;break}return i},resetElements:function(){var t=this;r.each(t.data.datasets,function(e,a){t.getDatasetMeta(a).controller.reset()},t)},reset:function(){this.resetElements(),this.tooltip.initialize()},update:function(e,a){var i=this;t.plugins.notify("beforeUpdate",[i]),i.tooltip._data=i.data;var n=i.buildOrUpdateControllers();r.each(i.data.datasets,function(t,e){i.getDatasetMeta(e).controller.buildOrUpdateElements()},i),t.layoutService.update(i,i.chart.width,i.chart.height),t.plugins.notify("afterScaleUpdate",[i]),r.each(n,function(t){t.reset()}),i.updateDatasets(),t.plugins.notify("afterUpdate",[i]),i._bufferedRender?i._bufferedRequest={lazy:a,duration:e}:i.render(e,a)},updateDatasets:function(){var e,a,i=this;if(t.plugins.notify("beforeDatasetsUpdate",[i])){for(e=0,a=i.data.datasets.length;a>e;++e)i.getDatasetMeta(e).controller.update();t.plugins.notify("afterDatasetsUpdate",[i])}},render:function(e,a){var i=this;t.plugins.notify("beforeRender",[i]);var n=i.options.animation;if(n&&("undefined"!=typeof e&&0!==e||"undefined"==typeof e&&0!==n.duration)){var o=new t.Animation;o.numSteps=(e||n.duration)/16.66,o.easing=n.easing,o.render=function(t,e){var a=r.easingEffects[e.easing],i=e.currentStep/e.numSteps,n=a(i);t.draw(n,i,e.currentStep)},o.onAnimationProgress=n.onProgress,o.onAnimationComplete=n.onComplete,t.animationService.addAnimation(i,o,e,a)}else i.draw(),n&&n.onComplete&&n.onComplete.call&&n.onComplete.call(i);return i},draw:function(e){var a=this,i=e||1;a.clear(),t.plugins.notify("beforeDraw",[a,i]),r.each(a.boxes,function(t){t.draw(a.chartArea)},a),a.scale&&a.scale.draw(),t.plugins.notify("beforeDatasetsDraw",[a,i]),r.each(a.data.datasets,function(t,i){a.isDatasetVisible(i)&&a.getDatasetMeta(i).controller.draw(e)},a,!0),t.plugins.notify("afterDatasetsDraw",[a,i]),a.tooltip.transition(i).draw(),t.plugins.notify("afterDraw",[a,i])},getElementAtEvent:function(e){return t.Interaction.modes.single(this,e)},getElementsAtEvent:function(e){return t.Interaction.modes.label(this,e,{intersect:!0})},getElementsAtXAxis:function(e){return t.Interaction.modes["x-axis"](this,e,{intersect:!0})},getElementsAtEventForMode:function(e,a,i){var n=t.Interaction.modes[a];return"function"==typeof n?n(this,e,i):[]},getDatasetAtEvent:function(e){return t.Interaction.modes.dataset(this,e)},getDatasetMeta:function(t){var e=this,a=e.data.datasets[t];a._meta||(a._meta={});
|
12 |
+
var i=a._meta[e.id];return i||(i=a._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,a=this.data.datasets.length;a>e;++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)},destroy:function(){var e,a,n,o=this,l=o.chart.canvas;for(o.stop(),a=0,n=o.data.datasets.length;n>a;++a)e=o.getDatasetMeta(a),e.controller&&(e.controller.destroy(),e.controller=null);l&&(r.unbindEvents(o,o.events),r.removeResizeListener(l.parentNode),r.clear(o.chart),i(l),o.chart.canvas=null,o.chart.ctx=null),t.plugins.notify("destroy",[o]),delete t.instances[o.id]},toBase64Image:function(){return this.chart.canvas.toDataURL.apply(this.chart.canvas,arguments)},initToolTip:function(){var e=this;e.tooltip=new t.Tooltip({_chart:e.chart,_chartInstance:e,_data:e.data,_options:e.options.tooltips},e),e.tooltip.initialize()},bindEvents:function(){var t=this;r.bindEvents(t,t.options.events,function(e){t.eventHandler(e)})},updateHoverStyle:function(t,e,a){var i,n,o,r=a?"setHoverStyle":"removeHoverStyle";for(n=0,o=t.length;o>n;++n)i=t[n],i&&this.getDatasetMeta(i._datasetIndex).controller[r](i)},eventHandler:function(t){var e=this,a=e.legend,i=e.tooltip,n=e.options.hover;e._bufferedRender=!0,e._bufferedRequest=null;var o=e.handleEvent(t);o|=a&&a.handleEvent(t),o|=i&&i.handleEvent(t);var r=e._bufferedRequest;return r?e.render(r.duration,r.lazy):o&&!e.animating&&(e.stop(),e.render(n.animationDuration,!0)),e._bufferedRender=!1,e._bufferedRequest=null,e},handleEvent:function(t){var e=this,a=e.options||{},i=a.hover,n=!1;return e.lastActive=e.lastActive||[],"mouseout"===t.type?e.active=[]:e.active=e.getElementsAtEventForMode(t,i.mode,i),i.onHover&&i.onHover.call(e,e.active),("mouseup"===t.type||"click"===t.type)&&a.onClick&&a.onClick.call(e,t,e.active),e.lastActive.length&&e.updateHoverStyle(e.lastActive,i.mode,!1),e.active.length&&i.mode&&e.updateHoverStyle(e.active,i.mode,!0),n=!r.arrayEquals(e.active,e.lastActive),e.lastActive=e.active,n}})}},{}],24:[function(t,e,a){"use strict";e.exports=function(t){function e(t,e){return t._chartjs?void t._chartjs.listeners.push(e):(Object.defineProperty(t,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[e]}}),void n.forEach(function(e){var a="onData"+e.charAt(0).toUpperCase()+e.slice(1),n=t[e];Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:function(){var e=Array.prototype.slice.call(arguments),o=n.apply(this,e);return i.each(t._chartjs.listeners,function(t){"function"==typeof t[a]&&t[a].apply(t,e)}),o}})}))}function a(t,e){var a=t._chartjs;if(a){var i=a.listeners,o=i.indexOf(e);-1!==o&&i.splice(o,1),i.length>0||(n.forEach(function(e){delete t[e]}),delete t._chartjs)}}var i=t.helpers,n=["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 a=this;a.chart=t,a.index=e,a.linkScales(),a.addElements()},updateIndex:function(t){this.index=t},linkScales:function(){var t=this,e=t.getMeta(),a=t.getDataset();null===e.xAxisID&&(e.xAxisID=a.xAxisID||t.chart.options.scales.xAxes[0].id),null===e.yAxisID&&(e.yAxisID=a.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&&a(this._data,this)},createMetaDataset:function(){var t=this,e=t.datasetElementType;return e&&new e({_chart:t.chart.chart,_datasetIndex:t.index})},createMetaData:function(t){var e=this,a=e.dataElementType;return a&&new a({_chart:e.chart.chart,_datasetIndex:e.index,_index:t})},addElements:function(){var t,e,a=this,i=a.getMeta(),n=a.getDataset().data||[],o=i.data;for(t=0,e=n.length;e>t;++t)o[t]=o[t]||a.createMetaData(t);i.dataset=i.dataset||a.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(),n=i.data||(i.data=[]);t._data!==n&&(t._data&&a(t._data,t),e(n,t),t._data=n),t.resyncElements()},update:i.noop,draw:function(t){var e,a,i=t||1,n=this.getMeta().data;for(e=0,a=n.length;a>e;++e)n[e].transition(i).draw()},removeHoverStyle:function(t,e){var a=this.chart.data.datasets[t._datasetIndex],n=t._index,o=t.custom||{},r=i.getValueAtIndexOrDefault,l=t._model;l.backgroundColor=o.backgroundColor?o.backgroundColor:r(a.backgroundColor,n,e.backgroundColor),l.borderColor=o.borderColor?o.borderColor:r(a.borderColor,n,e.borderColor),l.borderWidth=o.borderWidth?o.borderWidth:r(a.borderWidth,n,e.borderWidth)},setHoverStyle:function(t){var e=this.chart.data.datasets[t._datasetIndex],a=t._index,n=t.custom||{},o=i.getValueAtIndexOrDefault,r=i.getHoverColor,l=t._model;l.backgroundColor=n.hoverBackgroundColor?n.hoverBackgroundColor:o(e.hoverBackgroundColor,a,r(l.backgroundColor)),l.borderColor=n.hoverBorderColor?n.hoverBorderColor:o(e.hoverBorderColor,a,r(l.borderColor)),l.borderWidth=n.hoverBorderWidth?n.hoverBorderWidth:o(e.hoverBorderWidth,a,l.borderWidth)},resyncElements:function(){var t=this,e=t.getMeta(),a=t.getDataset().data,i=e.data.length,n=a.length;i>n?e.data.splice(n,i-n):n>i&&t.insertElements(i,n-i)},insertElements:function(t,e){for(var a=0;e>a;++a)this.addElementAndReset(t+a)},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}},{}],25:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers;t.elements={},t.Element=function(t){e.extend(this,t),this.initialize.apply(this,arguments)},e.extend(t.Element.prototype,{initialize:function(){this.hidden=!1},pivot:function(){var t=this;return t._view||(t._view=e.clone(t._model)),t._start=e.clone(t._view),t},transition:function(t){var a=this;return a._view||(a._view=e.clone(a._model)),1===t?(a._view=a._model,a._start=null,a):(a._start||a.pivot(),e.each(a._model,function(i,n){if("_"===n[0]);else if(a._view.hasOwnProperty(n))if(i===a._view[n]);else if("string"==typeof i)try{var o=e.color(a._model[n]).mix(e.color(a._start[n]),t);a._view[n]=o.rgbString()}catch(r){a._view[n]=i}else if("number"==typeof i){var l=void 0!==a._start[n]&&isNaN(a._start[n])===!1?a._start[n]:0;a._view[n]=(a._model[n]-l)*t+l}else a._view[n]=i;else"number"!=typeof i||isNaN(a._view[n])?a._view[n]=i:a._view[n]=i*t},a),a)},tooltipPosition:function(){return{x:this._model.x,y:this._model.y}},hasValue:function(){return e.isNumber(this._model.x)&&e.isNumber(this._model.y)}}),t.Element.extend=e.inherits}},{}],26:[function(t,e,a){"use strict";var i=t(3);e.exports=function(t){function e(t,e,a){var i;return"string"==typeof t?(i=parseInt(t,10),-1!==t.indexOf("%")&&(i=i/100*e.parentNode[a])):i=t,i}function a(t){return void 0!==t&&null!==t&&"none"!==t}function n(t,i,n){var o=document.defaultView,r=t.parentNode,l=o.getComputedStyle(t)[i],s=o.getComputedStyle(r)[i],d=a(l),u=a(s),c=Number.POSITIVE_INFINITY;return d||u?Math.min(d?e(l,t,n):c,u?e(s,r,n):c):"none"}var o=t.helpers={};o.each=function(t,e,a,i){var n,r;if(o.isArray(t))if(r=t.length,i)for(n=r-1;n>=0;n--)e.call(a,t[n],n);else for(n=0;r>n;n++)e.call(a,t[n],n);else if("object"==typeof t){var l=Object.keys(t);for(r=l.length,n=0;r>n;n++)e.call(a,t[l[n]],l[n])}},o.clone=function(t){var e={};return o.each(t,function(t,a){o.isArray(t)?e[a]=t.slice(0):"object"==typeof t&&null!==t?e[a]=o.clone(t):e[a]=t}),e},o.extend=function(t){for(var e=function(e,a){t[a]=e},a=1,i=arguments.length;i>a;a++)o.each(arguments[a],e);return t},o.configMerge=function(e){var a=o.clone(e);return o.each(Array.prototype.slice.call(arguments,1),function(e){o.each(e,function(e,i){var n=a.hasOwnProperty(i),r=n?a[i]:{};"scales"===i?a[i]=o.scaleMerge(r,e):"scale"===i?a[i]=o.configMerge(r,t.scaleService.getScaleDefaults(e.type),e):!n||"object"!=typeof r||o.isArray(r)||null===r||"object"!=typeof e||o.isArray(e)?a[i]=e:a[i]=o.configMerge(r,e)})}),a},o.scaleMerge=function(e,a){var i=o.clone(e);return o.each(a,function(e,a){"xAxes"===a||"yAxes"===a?i.hasOwnProperty(a)?o.each(e,function(e,n){var r=o.getValueOrDefault(e.type,"xAxes"===a?"category":"linear"),l=t.scaleService.getScaleDefaults(r);n>=i[a].length||!i[a][n].type?i[a].push(o.configMerge(l,e)):e.type&&e.type!==i[a][n].type?i[a][n]=o.configMerge(i[a][n],l,e):i[a][n]=o.configMerge(i[a][n],e)}):(i[a]=[],o.each(e,function(e){var n=o.getValueOrDefault(e.type,"xAxes"===a?"category":"linear");i[a].push(o.configMerge(t.scaleService.getScaleDefaults(n),e))})):i.hasOwnProperty(a)&&"object"==typeof i[a]&&null!==i[a]&&"object"==typeof e?i[a]=o.configMerge(i[a],e):i[a]=e}),i},o.getValueAtIndexOrDefault=function(t,e,a){return void 0===t||null===t?a:o.isArray(t)?e<t.length?t[e]:a:t},o.getValueOrDefault=function(t,e){return void 0===t?e:t},o.indexOf=Array.prototype.indexOf?function(t,e){return t.indexOf(e)}:function(t,e){for(var a=0,i=t.length;i>a;++a)if(t[a]===e)return a;return-1},o.where=function(t,e){if(o.isArray(t)&&Array.prototype.filter)return t.filter(e);var a=[];return o.each(t,function(t){e(t)&&a.push(t)}),a},o.findIndex=Array.prototype.findIndex?function(t,e,a){return t.findIndex(e,a)}:function(t,e,a){a=void 0===a?t:a;for(var i=0,n=t.length;n>i;++i)if(e.call(a,t[i],i,t))return i;return-1},o.findNextWhere=function(t,e,a){(void 0===a||null===a)&&(a=-1);for(var i=a+1;i<t.length;i++){var n=t[i];if(e(n))return n}},o.findPreviousWhere=function(t,e,a){(void 0===a||null===a)&&(a=t.length);for(var i=a-1;i>=0;i--){var n=t[i];if(e(n))return n}},o.inherits=function(t){var e=this,a=t&&t.hasOwnProperty("constructor")?t.constructor:function(){return e.apply(this,arguments)},i=function(){this.constructor=a};return i.prototype=e.prototype,a.prototype=new i,a.extend=o.inherits,t&&o.extend(a.prototype,t),a.__super__=e.prototype,a},o.noop=function(){},o.uid=function(){var t=0;return function(){return t++}}(),o.isNumber=function(t){return!isNaN(parseFloat(t))&&isFinite(t)},o.almostEquals=function(t,e,a){return Math.abs(t-e)<a},o.max=function(t){return t.reduce(function(t,e){return isNaN(e)?t:Math.max(t,e)},Number.NEGATIVE_INFINITY)},o.min=function(t){return t.reduce(function(t,e){return isNaN(e)?t:Math.min(t,e)},Number.POSITIVE_INFINITY)},o.sign=Math.sign?function(t){return Math.sign(t)}:function(t){return t=+t,0===t||isNaN(t)?t:t>0?1:-1},o.log10=Math.log10?function(t){return Math.log10(t)}:function(t){return Math.log(t)/Math.LN10},o.toRadians=function(t){return t*(Math.PI/180)},o.toDegrees=function(t){return t*(180/Math.PI)},o.getAngleFromPoint=function(t,e){var a=e.x-t.x,i=e.y-t.y,n=Math.sqrt(a*a+i*i),o=Math.atan2(i,a);return o<-.5*Math.PI&&(o+=2*Math.PI),{angle:o,distance:n}},o.distanceBetweenPoints=function(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))},o.aliasPixel=function(t){return t%2===0?0:.5},o.splineCurve=function(t,e,a,i){var n=t.skip?e:t,o=e,r=a.skip?e:a,l=Math.sqrt(Math.pow(o.x-n.x,2)+Math.pow(o.y-n.y,2)),s=Math.sqrt(Math.pow(r.x-o.x,2)+Math.pow(r.y-o.y,2)),d=l/(l+s),u=s/(l+s);d=isNaN(d)?0:d,u=isNaN(u)?0:u;var c=i*d,h=i*u;return{previous:{x:o.x-c*(r.x-n.x),y:o.y-c*(r.y-n.y)},next:{x:o.x+h*(r.x-n.x),y:o.y+h*(r.y-n.y)}}},o.EPSILON=Number.EPSILON||1e-14,o.splineCurveMonotone=function(t){var e,a,i,n,r=(t||[]).map(function(t){return{model:t._model,deltaK:0,mK:0}}),l=r.length;for(e=0;l>e;++e)i=r[e],i.model.skip||(a=e>0?r[e-1]:null,n=l-1>e?r[e+1]:null,n&&!n.model.skip&&(i.deltaK=(n.model.y-i.model.y)/(n.model.x-i.model.x)),!a||a.model.skip?i.mK=i.deltaK:!n||n.model.skip?i.mK=a.deltaK:this.sign(a.deltaK)!==this.sign(i.deltaK)?i.mK=0:i.mK=(a.deltaK+i.deltaK)/2);var s,d,u,c;for(e=0;l-1>e;++e)i=r[e],n=r[e+1],i.model.skip||n.model.skip||(o.almostEquals(i.deltaK,0,this.EPSILON)?i.mK=n.mK=0:(s=i.mK/i.deltaK,d=n.mK/i.deltaK,c=Math.pow(s,2)+Math.pow(d,2),9>=c||(u=3/Math.sqrt(c),i.mK=s*u*i.deltaK,n.mK=d*u*i.deltaK)));var h;for(e=0;l>e;++e)i=r[e],i.model.skip||(a=e>0?r[e-1]:null,n=l-1>e?r[e+1]:null,a&&!a.model.skip&&(h=(i.model.x-a.model.x)/3,i.model.controlPointPreviousX=i.model.x-h,i.model.controlPointPreviousY=i.model.y-h*i.mK),n&&!n.model.skip&&(h=(n.model.x-i.model.x)/3,i.model.controlPointNextX=i.model.x+h,i.model.controlPointNextY=i.model.y+h*i.mK))},o.nextItem=function(t,e,a){return a?e>=t.length-1?t[0]:t[e+1]:e>=t.length-1?t[t.length-1]:t[e+1]},o.previousItem=function(t,e,a){return a?0>=e?t[t.length-1]:t[e-1]:0>=e?t[0]:t[e-1]},o.niceNum=function(t,e){var a,i=Math.floor(o.log10(t)),n=t/Math.pow(10,i);return a=e?1.5>n?1:3>n?2:7>n?5:10:1>=n?1:2>=n?2:5>=n?5:10,a*Math.pow(10,i)};var r=o.easingEffects={linear:function(t){return t},easeInQuad:function(t){return t*t},easeOutQuad:function(t){return-1*t*(t-2)},easeInOutQuad:function(t){return(t/=.5)<1?.5*t*t:-0.5*(--t*(t-2)-1)},easeInCubic:function(t){return t*t*t},easeOutCubic:function(t){return 1*((t=t/1-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-1*((t=t/1-1)*t*t*t-1)},easeInOutQuart:function(t){return(t/=.5)<1?.5*t*t*t*t:-0.5*((t-=2)*t*t*t-2)},easeInQuint:function(t){return 1*(t/=1)*t*t*t*t},easeOutQuint:function(t){return 1*((t=t/1-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/1*(Math.PI/2))+1},easeOutSine:function(t){return 1*Math.sin(t/1*(Math.PI/2))},easeInOutSine:function(t){return-0.5*(Math.cos(Math.PI*t/1)-1)},easeInExpo:function(t){return 0===t?1:1*Math.pow(2,10*(t/1-1))},easeOutExpo:function(t){return 1===t?1:1*(-Math.pow(2,-10*t/1)+1)},easeInOutExpo:function(t){return 0===t?0:1===t?1:(t/=.5)<1?.5*Math.pow(2,10*(t-1)):.5*(-Math.pow(2,-10*--t)+2)},easeInCirc:function(t){return t>=1?t:-1*(Math.sqrt(1-(t/=1)*t)-1)},easeOutCirc:function(t){return 1*Math.sqrt(1-(t=t/1-1)*t)},easeInOutCirc:function(t){return(t/=.5)<1?-0.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},easeInElastic:function(t){var e=1.70158,a=0,i=1;return 0===t?0:1===(t/=1)?1:(a||(a=.3),i<Math.abs(1)?(i=1,e=a/4):e=a/(2*Math.PI)*Math.asin(1/i),-(i*Math.pow(2,10*(t-=1))*Math.sin((1*t-e)*(2*Math.PI)/a)))},easeOutElastic:function(t){var e=1.70158,a=0,i=1;return 0===t?0:1===(t/=1)?1:(a||(a=.3),i<Math.abs(1)?(i=1,e=a/4):e=a/(2*Math.PI)*Math.asin(1/i),i*Math.pow(2,-10*t)*Math.sin((1*t-e)*(2*Math.PI)/a)+1)},easeInOutElastic:function(t){var e=1.70158,a=0,i=1;return 0===t?0:2===(t/=.5)?1:(a||(a=1*(.3*1.5)),i<Math.abs(1)?(i=1,e=a/4):e=a/(2*Math.PI)*Math.asin(1/i),1>t?-.5*(i*Math.pow(2,10*(t-=1))*Math.sin((1*t-e)*(2*Math.PI)/a)):i*Math.pow(2,-10*(t-=1))*Math.sin((1*t-e)*(2*Math.PI)/a)*.5+1)},easeInBack:function(t){var e=1.70158;return 1*(t/=1)*t*((e+1)*t-e)},easeOutBack:function(t){var e=1.70158;return 1*((t=t/1-1)*t*((e+1)*t+e)+1)},easeInOutBack:function(t){var e=1.70158;return(t/=.5)<1?.5*(t*t*(((e*=1.525)+1)*t-e)):.5*((t-=2)*t*(((e*=1.525)+1)*t+e)+2)},easeInBounce:function(t){return 1-r.easeOutBounce(1-t)},easeOutBounce:function(t){return(t/=1)<1/2.75?1*(7.5625*t*t):2/2.75>t?1*(7.5625*(t-=1.5/2.75)*t+.75):2.5/2.75>t?1*(7.5625*(t-=2.25/2.75)*t+.9375):1*(7.5625*(t-=2.625/2.75)*t+.984375)},easeInOutBounce:function(t){return.5>t?.5*r.easeInBounce(2*t):.5*r.easeOutBounce(2*t-1)+.5}};o.requestAnimFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){return window.setTimeout(t,1e3/60)}}(),o.cancelAnimFrame=function(){return window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.oCancelAnimationFrame||window.msCancelAnimationFrame||function(t){return window.clearTimeout(t,1e3/60)}}(),o.getRelativePosition=function(t,e){var a,i,n=t.originalEvent||t,r=t.currentTarget||t.srcElement,l=r.getBoundingClientRect(),s=n.touches;s&&s.length>0?(a=s[0].clientX,i=s[0].clientY):(a=n.clientX,i=n.clientY);var d=parseFloat(o.getStyle(r,"padding-left")),u=parseFloat(o.getStyle(r,"padding-top")),c=parseFloat(o.getStyle(r,"padding-right")),h=parseFloat(o.getStyle(r,"padding-bottom")),f=l.right-l.left-d-c,g=l.bottom-l.top-u-h;return a=Math.round((a-l.left-d)/f*r.width/e.currentDevicePixelRatio),i=Math.round((i-l.top-u)/g*r.height/e.currentDevicePixelRatio),{x:a,y:i}},o.addEvent=function(t,e,a){t.addEventListener?t.addEventListener(e,a):t.attachEvent?t.attachEvent("on"+e,a):t["on"+e]=a},o.removeEvent=function(t,e,a){t.removeEventListener?t.removeEventListener(e,a,!1):t.detachEvent?t.detachEvent("on"+e,a):t["on"+e]=o.noop},o.bindEvents=function(t,e,a){var i=t.events=t.events||{};o.each(e,function(e){i[e]=function(){a.apply(t,arguments)},o.addEvent(t.chart.canvas,e,i[e])})},o.unbindEvents=function(t,e){var a=t.chart.canvas;o.each(e,function(t,e){o.removeEvent(a,e,t)})},o.getConstraintWidth=function(t){return n(t,"max-width","clientWidth")},o.getConstraintHeight=function(t){return n(t,"max-height","clientHeight")},o.getMaximumWidth=function(t){var e=t.parentNode,a=parseInt(o.getStyle(e,"padding-left"),10),i=parseInt(o.getStyle(e,"padding-right"),10),n=e.clientWidth-a-i,r=o.getConstraintWidth(t);return isNaN(r)?n:Math.min(n,r)},o.getMaximumHeight=function(t){var e=t.parentNode,a=parseInt(o.getStyle(e,"padding-top"),10),i=parseInt(o.getStyle(e,"padding-bottom"),10),n=e.clientHeight-a-i,r=o.getConstraintHeight(t);return isNaN(r)?n:Math.min(n,r)},o.getStyle=function(t,e){return t.currentStyle?t.currentStyle[e]:document.defaultView.getComputedStyle(t,null).getPropertyValue(e)},o.retinaScale=function(t){var e=t.currentDevicePixelRatio=window.devicePixelRatio||1;if(1!==e){var a=t.canvas,i=t.height,n=t.width;a.height=i*e,a.width=n*e,t.ctx.scale(e,e),a.style.height=i+"px",a.style.width=n+"px"}},o.clear=function(t){t.ctx.clearRect(0,0,t.width,t.height)},o.fontString=function(t,e,a){return e+" "+t+"px "+a},o.longestText=function(t,e,a,i){i=i||{};var n=i.data=i.data||{},r=i.garbageCollect=i.garbageCollect||[];i.font!==e&&(n=i.data={},r=i.garbageCollect=[],i.font=e),t.font=e;var l=0;o.each(a,function(e){void 0!==e&&null!==e&&o.isArray(e)!==!0?l=o.measureText(t,n,r,l,e):o.isArray(e)&&o.each(e,function(e){void 0===e||null===e||o.isArray(e)||(l=o.measureText(t,n,r,l,e))})});var s=r.length/2;if(s>a.length){for(var d=0;s>d;d++)delete n[r[d]];r.splice(0,s)}return l},o.measureText=function(t,e,a,i,n){var o=e[n];return o||(o=e[n]=t.measureText(n).width,a.push(n)),o>i&&(i=o),i},o.numberOfLabelLines=function(t){var e=1;return o.each(t,function(t){o.isArray(t)&&t.length>e&&(e=t.length)}),e},o.drawRoundedRectangle=function(t,e,a,i,n,o){t.beginPath(),t.moveTo(e+o,a),t.lineTo(e+i-o,a),t.quadraticCurveTo(e+i,a,e+i,a+o),t.lineTo(e+i,a+n-o),t.quadraticCurveTo(e+i,a+n,e+i-o,a+n),t.lineTo(e+o,a+n),t.quadraticCurveTo(e,a+n,e,a+n-o),t.lineTo(e,a+o),t.quadraticCurveTo(e,a,e+o,a),t.closePath()},o.color=function(e){return i?i(e instanceof CanvasGradient?t.defaults.global.defaultColor:e):(console.error("Color.js not found!"),e)},o.addResizeListener=function(t,e){var a=document.createElement("iframe");a.className="chartjs-hidden-iframe",a.style.cssText="display:block;overflow:hidden;border:0;margin:0;top:0;left:0;bottom:0;right:0;height:100%;width:100%;position:absolute;pointer-events:none;z-index:-1;",a.tabIndex=-1;var i=t._chartjs={resizer:a,ticking:!1},n=function(){i.ticking||(i.ticking=!0,o.requestAnimFrame.call(window,function(){return i.resizer?(i.ticking=!1,e()):void 0}))};o.addEvent(a,"load",function(){o.addEvent(a.contentWindow||a,"resize",n),n()}),t.insertBefore(a,t.firstChild)},o.removeResizeListener=function(t){if(t&&t._chartjs){var e=t._chartjs.resizer;e&&(e.parentNode.removeChild(e),t._chartjs.resizer=null),delete t._chartjs}},o.isArray=Array.isArray?function(t){return Array.isArray(t)}:function(t){return"[object Array]"===Object.prototype.toString.call(t)},o.arrayEquals=function(t,e){var a,i,n,r;if(!t||!e||t.length!==e.length)return!1;for(a=0,i=t.length;i>a;++a)if(n=t[a],r=e[a],n instanceof Array&&r instanceof Array){if(!o.arrayEquals(n,r))return!1}else if(n!==r)return!1;return!0},o.callCallback=function(t,e,a){t&&"function"==typeof t.call&&t.apply(a,e)},o.getHoverColor=function(t){return t instanceof CanvasPattern?t:o.color(t).saturate(.5).darken(.1).rgbString()}}},{3:3}],27:[function(t,e,a){"use strict";e.exports=function(t){function e(t,e){var a,i,n,o,r,l=t.data.datasets;for(i=0,o=l.length;o>i;++i)if(t.isDatasetVisible(i))for(a=t.getDatasetMeta(i),n=0,r=a.data.length;r>n;++n){var s=a.data[n];s._view.skip||e(s)}}function a(t,a){var i=[];return e(t,function(t){t.inRange(a.x,a.y)&&i.push(t)}),i}function i(t,a,i,n){var r=Number.POSITIVE_INFINITY,l=[];return n||(n=o.distanceBetweenPoints),e(t,function(t){if(!i||t.inRange(a.x,a.y)){var e=t.getCenterPoint(),o=n(a,e);r>o?(l=[t],r=o):o===r&&l.push(t)}}),l}function n(t,e,n){var r=o.getRelativePosition(e,t.chart),l=function(t,e){return Math.abs(t.x-e.x)},s=n.intersect?a(t,r):i(t,r,!1,l),d=[];return s.length?(t.data.datasets.forEach(function(e,a){if(t.isDatasetVisible(a)){var i=t.getDatasetMeta(a),n=i.data[s[0]._index];n&&!n._view.skip&&d.push(n)}}),d):[]}var o=t.helpers;t.Interaction={modes:{single:function(t,a){var i=o.getRelativePosition(a,t.chart),n=[];return e(t,function(t){return t.inRange(i.x,i.y)?(n.push(t),n):void 0}),n.slice(0,1)},label:n,index:n,dataset:function(t,e,n){var r=o.getRelativePosition(e,t.chart),l=n.intersect?a(t,r):i(t,r,!1);return l.length>0&&(l=t.getDatasetMeta(l[0]._datasetIndex).data),l},"x-axis":function(t,e){return n(t,e,!0)},point:function(t,e){var i=o.getRelativePosition(e,t.chart);return a(t,i)},nearest:function(t,e,a){var n=o.getRelativePosition(e,t.chart),r=i(t,n,a.intersect);return r.length>1&&r.sort(function(t,e){var a=t.getArea(),i=e.getArea(),n=a-i;return 0===n&&(n=t._datasetIndex-e._datasetIndex),n}),r.slice(0,1)},x:function(t,a,i){var n=o.getRelativePosition(a,t.chart),r=[],l=!1;return e(t,function(t){t.inXRange(n.x)&&r.push(t),t.inRange(n.x,n.y)&&(l=!0)}),i.intersect&&!l&&(r=[]),r},y:function(t,a,i){var n=o.getRelativePosition(a,t.chart),r=[],l=!1;return e(t,function(t){t.inYRange(n.y)&&r.push(t),t.inRange(n.x,n.y)&&(l=!0)}),i.intersect&&!l&&(r=[]),r}}}}},{}],28:[function(t,e,a){"use strict";e.exports=function(){var t=function(e,a){return this.controller=new t.Controller(e,a,this),this.controller};return t.defaults={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:{},legendCallback:function(t){var e=[];e.push('<ul class="'+t.id+'-legend">');for(var a=0;a<t.data.datasets.length;a++)e.push('<li><span style="background-color:'+t.data.datasets[a].backgroundColor+'"></span>'),t.data.datasets[a].label&&e.push(t.data.datasets[a].label),e.push("</li>");return e.push("</ul>"),e.join("")}}},t.Chart=t,t}},{}],29:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers;t.layoutService={defaults:{},addBox:function(t,e){t.boxes||(t.boxes=[]),t.boxes.push(e)},removeBox:function(t,e){t.boxes&&t.boxes.splice(t.boxes.indexOf(e),1)},update:function(t,a,i){function n(t){var e,a=t.isHorizontal();a?(e=t.update(t.options.fullWidth?x:C,M),D-=e.height):(e=t.update(w,S),C-=e.width),I.push({horizontal:a,minSize:e,box:t})}function o(t){var a=e.findNextWhere(I,function(e){return e.box===t});if(a)if(t.isHorizontal()){var i={left:A,right:T,top:0,bottom:0};t.update(t.options.fullWidth?x:C,y/2,i)}else t.update(a.minSize.width,D)}function r(t){var a=e.findNextWhere(I,function(e){return e.box===t}),i={left:0,right:0,top:P,bottom:F};a&&t.update(a.minSize.width,D,i)}function l(t){t.isHorizontal()?(t.left=t.options.fullWidth?u:A,t.right=t.options.fullWidth?a-c:A+C,t.top=L,t.bottom=L+t.height,L=t.bottom):(t.left=V,t.right=V+t.width,t.top=P,t.bottom=P+D,V=t.right)}if(t){var s=t.options.layout,d=s?s.padding:null,u=0,c=0,h=0,f=0;isNaN(d)?(u=d.left||0,c=d.right||0,h=d.top||0,f=d.bottom||0):(u=d,c=d,h=d,f=d);var g=e.where(t.boxes,function(t){return"left"===t.options.position}),p=e.where(t.boxes,function(t){return"right"===t.options.position}),m=e.where(t.boxes,function(t){return"top"===t.options.position}),b=e.where(t.boxes,function(t){return"bottom"===t.options.position}),v=e.where(t.boxes,function(t){return"chartArea"===t.options.position});m.sort(function(t,e){return(e.options.fullWidth?1:0)-(t.options.fullWidth?1:0)}),b.sort(function(t,e){return(t.options.fullWidth?1:0)-(e.options.fullWidth?1:0)});var x=a-u-c,y=i-h-f,k=x/2,S=y/2,w=(a-k)/(g.length+p.length),M=(i-S)/(m.length+b.length),C=x,D=y,I=[];e.each(g.concat(p,m,b),n);var A=u,T=c,P=h,F=f;e.each(g.concat(p),o),e.each(g,function(t){A+=t.width}),e.each(p,function(t){T+=t.width}),e.each(m.concat(b),o),e.each(m,function(t){P+=t.height}),e.each(b,function(t){F+=t.height}),e.each(g.concat(p),r),A=u,T=c,P=h,F=f,e.each(g,function(t){A+=t.width}),e.each(p,function(t){T+=t.width}),e.each(m,function(t){P+=t.height}),e.each(b,function(t){F+=t.height});var _=i-P-F,R=a-A-T;(R!==C||_!==D)&&(e.each(g,function(t){t.height=_}),e.each(p,function(t){t.height=_}),e.each(m,function(t){t.options.fullWidth||(t.width=R)}),e.each(b,function(t){t.options.fullWidth||(t.width=R)}),D=_,C=R);var V=u,L=h;e.each(g.concat(m),l),V+=C,L+=D,e.each(p,l),e.each(b,l),t.chartArea={left:A,top:P,right:A+C,bottom:P+D},e.each(v,function(e){e.left=t.chartArea.left,e.top=t.chartArea.top,e.right=t.chartArea.right,e.bottom=t.chartArea.bottom,e.update(C,D)})}}}}},{}],30:[function(t,e,a){"use strict";e.exports=function(t){function e(t,e){return t.usePointStyle?e*Math.SQRT2:t.boxWidth}var a=t.helpers,i=a.noop;t.defaults.global.legend={display:!0,position:"top",fullWidth:!0,reverse:!1,onClick:function(t,e){var a=e.datasetIndex,i=this.chart,n=i.getDatasetMeta(a);n.hidden=null===n.hidden?!i.data.datasets[a].hidden:null,i.update()},onHover:null,labels:{boxWidth:40,padding:10,generateLabels:function(t){var e=t.data;return a.isArray(e.datasets)?e.datasets.map(function(e,i){return{text:e.label,fillStyle:a.isArray(e.backgroundColor)?e.backgroundColor[0]:e.backgroundColor,hidden:!t.isDatasetVisible(i),lineCap:e.borderCapStyle,lineDash:e.borderDash,lineDashOffset:e.borderDashOffset,lineJoin:e.borderJoinStyle,lineWidth:e.borderWidth,strokeStyle:e.borderColor,pointStyle:e.pointStyle,datasetIndex:i}},this):[]}}},t.Legend=t.Element.extend({initialize:function(t){a.extend(this,t),this.legendHitBoxes=[],this.doughnutMode=!1},beforeUpdate:i,update:function(t,e,a){var i=this;return i.beforeUpdate(),i.maxWidth=t,i.maxHeight=e,i.margins=a,i.beforeSetDimensions(),i.setDimensions(),i.afterSetDimensions(),i.beforeBuildLabels(),i.buildLabels(),i.afterBuildLabels(),i.beforeFit(),i.fit(),i.afterFit(),i.afterUpdate(),i.minSize},afterUpdate:i,beforeSetDimensions:i,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:i,beforeBuildLabels:i,buildLabels:function(){var t=this;t.legendItems=t.options.labels.generateLabels.call(t,t.chart),t.options.reverse&&t.legendItems.reverse()},afterBuildLabels:i,beforeFit:i,fit:function(){var i=this,n=i.options,o=n.labels,r=n.display,l=i.ctx,s=t.defaults.global,d=a.getValueOrDefault,u=d(o.fontSize,s.defaultFontSize),c=d(o.fontStyle,s.defaultFontStyle),h=d(o.fontFamily,s.defaultFontFamily),f=a.fontString(u,c,h),g=i.legendHitBoxes=[],p=i.minSize,m=i.isHorizontal();if(m?(p.width=i.maxWidth,p.height=r?10:0):(p.width=r?10:0,p.height=i.maxHeight),r)if(l.font=f,m){var b=i.lineWidths=[0],v=i.legendItems.length?u+o.padding:0;l.textAlign="left",l.textBaseline="top",a.each(i.legendItems,function(t,a){var n=e(o,u),r=n+u/2+l.measureText(t.text).width;b[b.length-1]+r+o.padding>=i.width&&(v+=u+o.padding,b[b.length]=i.left),g[a]={left:0,top:0,width:r,height:u},b[b.length-1]+=r+o.padding}),p.height+=v}else{var x=o.padding,y=i.columnWidths=[],k=o.padding,S=0,w=0,M=u+x;a.each(i.legendItems,function(t,a){var i=e(o,u),n=i+u/2+l.measureText(t.text).width;w+M>p.height&&(k+=S+o.padding,y.push(S),S=0,w=0),S=Math.max(S,n),w+=M,g[a]={left:0,top:0,width:n,height:u}}),k+=S,y.push(S),p.width+=k}i.width=p.width,i.height=p.height},afterFit:i,isHorizontal:function(){return"top"===this.options.position||"bottom"===this.options.position},draw:function(){var i=this,n=i.options,o=n.labels,r=t.defaults.global,l=r.elements.line,s=i.width,d=i.lineWidths;if(n.display){var u,c=i.ctx,h=a.getValueOrDefault,f=h(o.fontColor,r.defaultFontColor),g=h(o.fontSize,r.defaultFontSize),p=h(o.fontStyle,r.defaultFontStyle),m=h(o.fontFamily,r.defaultFontFamily),b=a.fontString(g,p,m);c.textAlign="left",c.textBaseline="top",c.lineWidth=.5,c.strokeStyle=f,c.fillStyle=f,c.font=b;var v=e(o,g),x=i.legendHitBoxes,y=function(e,a,i){if(!(isNaN(v)||0>=v)){c.save(),c.fillStyle=h(i.fillStyle,r.defaultColor),c.lineCap=h(i.lineCap,l.borderCapStyle),c.lineDashOffset=h(i.lineDashOffset,l.borderDashOffset),c.lineJoin=h(i.lineJoin,l.borderJoinStyle),c.lineWidth=h(i.lineWidth,l.borderWidth),c.strokeStyle=h(i.strokeStyle,r.defaultColor);var o=0===h(i.lineWidth,l.borderWidth);if(c.setLineDash&&c.setLineDash(h(i.lineDash,l.borderDash)),n.labels&&n.labels.usePointStyle){var s=g*Math.SQRT2/2,d=s/Math.SQRT2,u=e+d,f=a+d;t.canvasHelpers.drawPoint(c,i.pointStyle,s,u,f)}else o||c.strokeRect(e,a,v,g),c.fillRect(e,a,v,g);c.restore()}},k=function(t,e,a,i){c.fillText(a.text,v+g/2+t,e),a.hidden&&(c.beginPath(),c.lineWidth=2,c.moveTo(v+g/2+t,e+g/2),c.lineTo(v+g/2+t+i,e+g/2),c.stroke())},S=i.isHorizontal();u=S?{x:i.left+(s-d[0])/2,y:i.top+o.padding,line:0}:{x:i.left+o.padding,y:i.top+o.padding,line:0};var w=g+o.padding;a.each(i.legendItems,function(t,e){var a=c.measureText(t.text).width,n=v+g/2+a,r=u.x,l=u.y;S?r+n>=s&&(l=u.y+=w,u.line++,r=u.x=i.left+(s-d[u.line])/2):l+w>i.bottom&&(r=u.x=r+i.columnWidths[u.line]+o.padding,l=u.y=i.top,u.line++),y(r,l,t),x[e].left=r,x[e].top=l,k(r,l,t,a),S?u.x+=n+o.padding:u.y+=w})}},handleEvent:function(t){var e=this,i=e.options,n="mouseup"===t.type?"click":t.type,o=!1;if("mousemove"===n){if(!i.onHover)return}else{if("click"!==n)return;if(!i.onClick)return}var r=a.getRelativePosition(t,e.chart.chart),l=r.x,s=r.y;if(l>=e.left&&l<=e.right&&s>=e.top&&s<=e.bottom)for(var d=e.legendHitBoxes,u=0;u<d.length;++u){var c=d[u];if(l>=c.left&&l<=c.left+c.width&&s>=c.top&&s<=c.top+c.height){if("click"===n){i.onClick.call(e,t,e.legendItems[u]),o=!0;break}if("mousemove"===n){i.onHover.call(e,t,e.legendItems[u]),o=!0;break}}}return o}}),t.plugins.register({beforeInit:function(e){var a=e.options,i=a.legend;i&&(e.legend=new t.Legend({ctx:e.chart.ctx,options:i,chart:e}),t.layoutService.addBox(e,e.legend))}})}},{}],31:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers.noop;t.plugins={_plugins:[],register:function(t){var e=this._plugins;[].concat(t).forEach(function(t){-1===e.indexOf(t)&&e.push(t)})},unregister:function(t){var e=this._plugins;[].concat(t).forEach(function(t){var a=e.indexOf(t);-1!==a&&e.splice(a,1)})},clear:function(){this._plugins=[]},count:function(){return this._plugins.length},getAll:function(){return this._plugins},notify:function(t,e){var a,i,n=this._plugins,o=n.length;
|
13 |
+
for(a=0;o>a;++a)if(i=n[a],"function"==typeof i[t]&&i[t].apply(i,e||[])===!1)return!1;return!0}},t.PluginBase=t.Element.extend({beforeInit:e,afterInit:e,beforeUpdate:e,afterUpdate:e,beforeDraw:e,afterDraw:e,destroy:e}),t.pluginService=t.plugins}},{}],32:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers;t.defaults.scale={display:!0,position:"left",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)",offsetGridLines:!1,borderDash:[],borderDashOffset:0},scaleLabel:{labelString:"",display:!1},ticks:{beginAtZero:!1,minRotation:0,maxRotation:50,mirror:!1,padding:10,reverse:!1,display:!0,autoSkip:!0,autoSkipPadding:0,labelOffset:0,callback:t.Ticks.formatters.values}},t.Scale=t.Element.extend({beforeUpdate:function(){e.callCallback(this.options.beforeUpdate,[this])},update:function(t,a,i){var n=this;return n.beforeUpdate(),n.maxWidth=t,n.maxHeight=a,n.margins=e.extend({left:0,right:0,top:0,bottom:0},i),n.beforeSetDimensions(),n.setDimensions(),n.afterSetDimensions(),n.beforeDataLimits(),n.determineDataLimits(),n.afterDataLimits(),n.beforeBuildTicks(),n.buildTicks(),n.afterBuildTicks(),n.beforeTickToLabelConversion(),n.convertTicksToLabels(),n.afterTickToLabelConversion(),n.beforeCalculateTickRotation(),n.calculateTickRotation(),n.afterCalculateTickRotation(),n.beforeFit(),n.fit(),n.afterFit(),n.afterUpdate(),n.minSize},afterUpdate:function(){e.callCallback(this.options.afterUpdate,[this])},beforeSetDimensions:function(){e.callCallback(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(){e.callCallback(this.options.afterSetDimensions,[this])},beforeDataLimits:function(){e.callCallback(this.options.beforeDataLimits,[this])},determineDataLimits:e.noop,afterDataLimits:function(){e.callCallback(this.options.afterDataLimits,[this])},beforeBuildTicks:function(){e.callCallback(this.options.beforeBuildTicks,[this])},buildTicks:e.noop,afterBuildTicks:function(){e.callCallback(this.options.afterBuildTicks,[this])},beforeTickToLabelConversion:function(){e.callCallback(this.options.beforeTickToLabelConversion,[this])},convertTicksToLabels:function(){var t=this,e=t.options.ticks;t.ticks=t.ticks.map(e.userCallback||e.callback)},afterTickToLabelConversion:function(){e.callCallback(this.options.afterTickToLabelConversion,[this])},beforeCalculateTickRotation:function(){e.callCallback(this.options.beforeCalculateTickRotation,[this])},calculateTickRotation:function(){var a=this,i=a.ctx,n=t.defaults.global,o=a.options.ticks,r=e.getValueOrDefault(o.fontSize,n.defaultFontSize),l=e.getValueOrDefault(o.fontStyle,n.defaultFontStyle),s=e.getValueOrDefault(o.fontFamily,n.defaultFontFamily),d=e.fontString(r,l,s);i.font=d;var u,c=i.measureText(a.ticks[0]).width,h=i.measureText(a.ticks[a.ticks.length-1]).width;if(a.labelRotation=o.minRotation||0,a.paddingRight=0,a.paddingLeft=0,a.options.display&&a.isHorizontal()){a.paddingRight=h/2+3,a.paddingLeft=c/2+3,a.longestTextCache||(a.longestTextCache={});for(var f,g,p=e.longestText(i,d,a.ticks,a.longestTextCache),m=p,b=a.getPixelForTick(1)-a.getPixelForTick(0)-6;m>b&&a.labelRotation<o.maxRotation;){if(f=Math.cos(e.toRadians(a.labelRotation)),g=Math.sin(e.toRadians(a.labelRotation)),u=f*c,u+r/2>a.yLabelWidth&&(a.paddingLeft=u+r/2),a.paddingRight=r/2,g*p>a.maxHeight){a.labelRotation--;break}a.labelRotation++,m=f*p}}a.margins&&(a.paddingLeft=Math.max(a.paddingLeft-a.margins.left,0),a.paddingRight=Math.max(a.paddingRight-a.margins.right,0))},afterCalculateTickRotation:function(){e.callCallback(this.options.afterCalculateTickRotation,[this])},beforeFit:function(){e.callCallback(this.options.beforeFit,[this])},fit:function(){var a=this,i=a.minSize={width:0,height:0},n=a.options,o=t.defaults.global,r=n.ticks,l=n.scaleLabel,s=n.gridLines,d=n.display,u=a.isHorizontal(),c=e.getValueOrDefault(r.fontSize,o.defaultFontSize),h=e.getValueOrDefault(r.fontStyle,o.defaultFontStyle),f=e.getValueOrDefault(r.fontFamily,o.defaultFontFamily),g=e.fontString(c,h,f),p=e.getValueOrDefault(l.fontSize,o.defaultFontSize),m=n.gridLines.tickMarkLength;if(u?i.width=a.isFullWidth()?a.maxWidth-a.margins.left-a.margins.right:a.maxWidth:i.width=d&&s.drawTicks?m:0,u?i.height=d&&s.drawTicks?m:0:i.height=a.maxHeight,l.display&&d&&(u?i.height+=1.5*p:i.width+=1.5*p),r.display&&d){a.longestTextCache||(a.longestTextCache={});var b=e.longestText(a.ctx,g,a.ticks,a.longestTextCache),v=e.numberOfLabelLines(a.ticks),x=.5*c;if(u){a.longestLabelWidth=b;var y=Math.sin(e.toRadians(a.labelRotation))*a.longestLabelWidth+c*v+x*v;i.height=Math.min(a.maxHeight,i.height+y),a.ctx.font=g;var k=a.ctx.measureText(a.ticks[0]).width,S=a.ctx.measureText(a.ticks[a.ticks.length-1]).width,w=Math.cos(e.toRadians(a.labelRotation)),M=Math.sin(e.toRadians(a.labelRotation));a.paddingLeft=0!==a.labelRotation?w*k+3:k/2+3,a.paddingRight=0!==a.labelRotation?M*(c/2)+3:S/2+3}else{var C=a.maxWidth-i.width,D=r.mirror;D?b=0:b+=a.options.ticks.padding,C>b?i.width+=b:i.width=a.maxWidth,a.paddingTop=c/2,a.paddingBottom=c/2}}a.margins&&(a.paddingLeft=Math.max(a.paddingLeft-a.margins.left,0),a.paddingTop=Math.max(a.paddingTop-a.margins.top,0),a.paddingRight=Math.max(a.paddingRight-a.margins.right,0),a.paddingBottom=Math.max(a.paddingBottom-a.margins.bottom,0)),a.width=i.width,a.height=i.height},afterFit:function(){e.callCallback(this.options.afterFit,[this])},isHorizontal:function(){return"top"===this.options.position||"bottom"===this.options.position},isFullWidth:function(){return this.options.fullWidth},getRightValue:function(t){return null===t||"undefined"==typeof t?NaN:"number"!=typeof t||isFinite(t)?"object"==typeof t?t instanceof Date||t.isValid?t:this.getRightValue(this.isHorizontal()?t.x:t.y):t:NaN},getLabelForIndex:e.noop,getPixelForValue:e.noop,getValueForPixel:e.noop,getPixelForTick:function(t,e){var a=this;if(a.isHorizontal()){var i=a.width-(a.paddingLeft+a.paddingRight),n=i/Math.max(a.ticks.length-(a.options.gridLines.offsetGridLines?0:1),1),o=n*t+a.paddingLeft;e&&(o+=n/2);var r=a.left+Math.round(o);return r+=a.isFullWidth()?a.margins.left:0}var l=a.height-(a.paddingTop+a.paddingBottom);return a.top+t*(l/(a.ticks.length-1))},getPixelForDecimal:function(t){var e=this;if(e.isHorizontal()){var a=e.width-(e.paddingLeft+e.paddingRight),i=a*t+e.paddingLeft,n=e.left+Math.round(i);return n+=e.isFullWidth()?e.margins.left:0}return e.top+t*e.height},getBasePixel:function(){var t=this,e=t.min,a=t.max;return t.getPixelForValue(t.beginAtZero?0:0>e&&0>a?a:e>0&&a>0?e:0)},draw:function(a){var i=this,n=i.options;if(n.display){var o,r,l=i.ctx,s=t.defaults.global,d=n.ticks,u=n.gridLines,c=n.scaleLabel,h=0!==i.labelRotation,f=d.autoSkip,g=i.isHorizontal();d.maxTicksLimit&&(r=d.maxTicksLimit);var p=e.getValueOrDefault(d.fontColor,s.defaultFontColor),m=e.getValueOrDefault(d.fontSize,s.defaultFontSize),b=e.getValueOrDefault(d.fontStyle,s.defaultFontStyle),v=e.getValueOrDefault(d.fontFamily,s.defaultFontFamily),x=e.fontString(m,b,v),y=u.tickMarkLength,k=e.getValueOrDefault(u.borderDash,s.borderDash),S=e.getValueOrDefault(u.borderDashOffset,s.borderDashOffset),w=e.getValueOrDefault(c.fontColor,s.defaultFontColor),M=e.getValueOrDefault(c.fontSize,s.defaultFontSize),C=e.getValueOrDefault(c.fontStyle,s.defaultFontStyle),D=e.getValueOrDefault(c.fontFamily,s.defaultFontFamily),I=e.fontString(M,C,D),A=e.toRadians(i.labelRotation),T=Math.cos(A),P=i.longestLabelWidth*T;l.fillStyle=p;var F=[];if(g){if(o=!1,h&&(P/=2),(P+d.autoSkipPadding)*i.ticks.length>i.width-(i.paddingLeft+i.paddingRight)&&(o=1+Math.floor((P+d.autoSkipPadding)*i.ticks.length/(i.width-(i.paddingLeft+i.paddingRight)))),r&&i.ticks.length>r)for(;!o||i.ticks.length/(o||1)>r;)o||(o=1),o+=1;f||(o=!1)}var _="right"===n.position?i.left:i.right-y,R="right"===n.position?i.left+y:i.right,V="bottom"===n.position?i.top:i.bottom-y,L="bottom"===n.position?i.top+y:i.bottom;if(e.each(i.ticks,function(t,r){if(void 0!==t&&null!==t){var l=i.ticks.length===r+1,s=o>1&&r%o>0||r%o===0&&r+o>=i.ticks.length;if((!s||l)&&void 0!==t&&null!==t){var c,f;r===("undefined"!=typeof i.zeroLineIndex?i.zeroLineIndex:0)?(c=u.zeroLineWidth,f=u.zeroLineColor):(c=e.getValueAtIndexOrDefault(u.lineWidth,r),f=e.getValueAtIndexOrDefault(u.color,r));var p,m,b,v,x,w,M,C,D,I,T="middle",P="middle";if(g){h||(P="top"===n.position?"bottom":"top"),T=h?"right":"center";var O=i.getPixelForTick(r)+e.aliasPixel(c);D=i.getPixelForTick(r,u.offsetGridLines)+d.labelOffset,I=h?i.top+12:"top"===n.position?i.bottom-y:i.top+y,p=b=x=M=O,m=V,v=L,w=a.top,C=a.bottom}else{"left"===n.position?d.mirror?(D=i.right+d.padding,T="left"):(D=i.right-d.padding,T="right"):d.mirror?(D=i.left-d.padding,T="right"):(D=i.left+d.padding,T="left");var B=i.getPixelForTick(r);B+=e.aliasPixel(c),I=i.getPixelForTick(r,u.offsetGridLines),p=_,b=R,x=a.left,M=a.right,m=v=w=C=B}F.push({tx1:p,ty1:m,tx2:b,ty2:v,x1:x,y1:w,x2:M,y2:C,labelX:D,labelY:I,glWidth:c,glColor:f,glBorderDash:k,glBorderDashOffset:S,rotation:-1*A,label:t,textBaseline:P,textAlign:T})}}}),e.each(F,function(t){if(u.display&&(l.save(),l.lineWidth=t.glWidth,l.strokeStyle=t.glColor,l.setLineDash&&(l.setLineDash(t.glBorderDash),l.lineDashOffset=t.glBorderDashOffset),l.beginPath(),u.drawTicks&&(l.moveTo(t.tx1,t.ty1),l.lineTo(t.tx2,t.ty2)),u.drawOnChartArea&&(l.moveTo(t.x1,t.y1),l.lineTo(t.x2,t.y2)),l.stroke(),l.restore()),d.display){l.save(),l.translate(t.labelX,t.labelY),l.rotate(t.rotation),l.font=x,l.textBaseline=t.textBaseline,l.textAlign=t.textAlign;var a=t.label;if(e.isArray(a))for(var i=0,n=-(a.length-1)*m*.75;i<a.length;++i)l.fillText(""+a[i],0,n),n+=1.5*m;else l.fillText(a,0,0);l.restore()}}),c.display){var O,B,W=0;if(g)O=i.left+(i.right-i.left)/2,B="bottom"===n.position?i.bottom-M/2:i.top+M/2;else{var z="left"===n.position;O=z?i.left+M/2:i.right-M/2,B=i.top+(i.bottom-i.top)/2,W=z?-.5*Math.PI:.5*Math.PI}l.save(),l.translate(O,B),l.rotate(W),l.textAlign="center",l.textBaseline="middle",l.fillStyle=w,l.font=I,l.fillText(c.labelString,0,0),l.restore()}if(u.drawBorder){l.lineWidth=e.getValueAtIndexOrDefault(u.lineWidth,0),l.strokeStyle=e.getValueAtIndexOrDefault(u.color,0);var N=i.left,E=i.right,H=i.top,U=i.bottom,j=e.aliasPixel(l.lineWidth);g?(H=U="top"===n.position?i.bottom:i.top,H+=j,U+=j):(N=E="left"===n.position?i.right:i.left,N+=j,E+=j),l.beginPath(),l.moveTo(N,H),l.lineTo(E,U),l.stroke()}}}})}},{}],33:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers;t.scaleService={constructors:{},defaults:{},registerScaleType:function(t,a,i){this.constructors[t]=a,this.defaults[t]=e.clone(i)},getScaleConstructor:function(t){return this.constructors.hasOwnProperty(t)?this.constructors[t]:void 0},getScaleDefaults:function(a){return this.defaults.hasOwnProperty(a)?e.scaleMerge(t.defaults.scale,this.defaults[a]):{}},updateScaleDefaults:function(t,a){var i=this.defaults;i.hasOwnProperty(t)&&(i[t]=e.extend(i[t],a))},addScalesToLayout:function(a){e.each(a.scales,function(e){t.layoutService.addBox(a,e)})}}}},{}],34:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers;t.Ticks={generators:{linear:function(t,a){var i,n=[];if(t.stepSize&&t.stepSize>0)i=t.stepSize;else{var o=e.niceNum(a.max-a.min,!1);i=e.niceNum(o/(t.maxTicks-1),!0)}var r=Math.floor(a.min/i)*i,l=Math.ceil(a.max/i)*i;if(t.min&&t.max&&t.stepSize){var s=(t.max-t.min)%t.stepSize===0;s&&(r=t.min,l=t.max)}var d=(l-r)/i;d=e.almostEquals(d,Math.round(d),i/1e3)?Math.round(d):Math.ceil(d),n.push(void 0!==t.min?t.min:r);for(var u=1;d>u;++u)n.push(r+u*i);return n.push(void 0!==t.max?t.max:l),n},logarithmic:function(t,a){for(var i=[],n=e.getValueOrDefault,o=n(t.min,Math.pow(10,Math.floor(e.log10(a.min))));o<a.max;){i.push(o);var r,l;0===o?(r=Math.floor(e.log10(a.minNotZero)),l=Math.round(a.minNotZero/Math.pow(10,r))):(r=Math.floor(e.log10(o)),l=Math.floor(o/Math.pow(10,r))+1),10===l&&(l=1,++r),o=l*Math.pow(10,r)}var s=n(t.max,o);return i.push(s),i}},formatters:{values:function(t){return e.isArray(t)?t:""+t},linear:function(t,a,i){var n=i.length>3?i[2]-i[1]:i[1]-i[0];Math.abs(n)>1&&t!==Math.floor(t)&&(n=t-Math.floor(t));var o=e.log10(Math.abs(n)),r="";if(0!==t){var l=-1*Math.floor(o);l=Math.max(Math.min(l,20),0),r=t.toFixed(l)}else r="0";return r},logarithmic:function(t,a,i){var n=t/Math.pow(10,Math.floor(e.log10(t)));return 0===t?"0":1===n||2===n||5===n||0===a||a===i.length-1?t.toExponential():""}}}}},{}],35:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers;t.defaults.global.title={display:!1,position:"top",fullWidth:!0,fontStyle:"bold",padding:10,text:""};var a=e.noop;t.Title=t.Element.extend({initialize:function(a){var i=this;e.extend(i,a),i.options=e.configMerge(t.defaults.global.title,a.options),i.legendHitBoxes=[]},beforeUpdate:function(){var a=this.chart.options;a&&a.title&&(this.options=e.configMerge(t.defaults.global.title,a.title))},update:function(t,e,a){var i=this;return i.beforeUpdate(),i.maxWidth=t,i.maxHeight=e,i.margins=a,i.beforeSetDimensions(),i.setDimensions(),i.afterSetDimensions(),i.beforeBuildLabels(),i.buildLabels(),i.afterBuildLabels(),i.beforeFit(),i.fit(),i.afterFit(),i.afterUpdate(),i.minSize},afterUpdate:a,beforeSetDimensions:a,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:a,beforeBuildLabels:a,buildLabels:a,afterBuildLabels:a,beforeFit:a,fit:function(){var a=this,i=e.getValueOrDefault,n=a.options,o=t.defaults.global,r=n.display,l=i(n.fontSize,o.defaultFontSize),s=a.minSize;a.isHorizontal()?(s.width=a.maxWidth,s.height=r?l+2*n.padding:0):(s.width=r?l+2*n.padding:0,s.height=a.maxHeight),a.width=s.width,a.height=s.height},afterFit:a,isHorizontal:function(){var t=this.options.position;return"top"===t||"bottom"===t},draw:function(){var a=this,i=a.ctx,n=e.getValueOrDefault,o=a.options,r=t.defaults.global;if(o.display){var l,s,d,u=n(o.fontSize,r.defaultFontSize),c=n(o.fontStyle,r.defaultFontStyle),h=n(o.fontFamily,r.defaultFontFamily),f=e.fontString(u,c,h),g=0,p=a.top,m=a.left,b=a.bottom,v=a.right;i.fillStyle=n(o.fontColor,r.defaultFontColor),i.font=f,a.isHorizontal()?(l=m+(v-m)/2,s=p+(b-p)/2,d=v-m):(l="left"===o.position?m+u/2:v-u/2,s=p+(b-p)/2,d=b-p,g=Math.PI*("left"===o.position?-.5:.5)),i.save(),i.translate(l,s),i.rotate(g),i.textAlign="center",i.textBaseline="middle",i.fillText(o.text,0,0,d),i.restore()}}}),t.plugins.register({beforeInit:function(e){var a=e.options,i=a.title;i&&(e.titleBlock=new t.Title({ctx:e.chart.ctx,options:i,chart:e}),t.layoutService.addBox(e,e.titleBlock))}})}},{}],36:[function(t,e,a){"use strict";e.exports=function(t){function e(t,e){var a=s.color(t);return a.alpha(e*a.alpha()).rgbaString()}function a(t,e){return e&&(s.isArray(e)?Array.prototype.push.apply(t,e):t.push(e)),t}function i(t){var e=t._xScale,a=t._yScale||t._scale,i=t._index,n=t._datasetIndex;return{xLabel:e?e.getLabelForIndex(i,n):"",yLabel:a?a.getLabelForIndex(i,n):"",index:i,datasetIndex:n,x:t._model.x,y:t._model.y}}function n(e){var a=t.defaults.global,i=s.getValueOrDefault;return{xPadding:e.xPadding,yPadding:e.yPadding,xAlign:e.xAlign,yAlign:e.yAlign,bodyFontColor:e.bodyFontColor,_bodyFontFamily:i(e.bodyFontFamily,a.defaultFontFamily),_bodyFontStyle:i(e.bodyFontStyle,a.defaultFontStyle),_bodyAlign:e.bodyAlign,bodyFontSize:i(e.bodyFontSize,a.defaultFontSize),bodySpacing:e.bodySpacing,titleFontColor:e.titleFontColor,_titleFontFamily:i(e.titleFontFamily,a.defaultFontFamily),_titleFontStyle:i(e.titleFontStyle,a.defaultFontStyle),titleFontSize:i(e.titleFontSize,a.defaultFontSize),_titleAlign:e.titleAlign,titleSpacing:e.titleSpacing,titleMarginBottom:e.titleMarginBottom,footerFontColor:e.footerFontColor,_footerFontFamily:i(e.footerFontFamily,a.defaultFontFamily),_footerFontStyle:i(e.footerFontStyle,a.defaultFontStyle),footerFontSize:i(e.footerFontSize,a.defaultFontSize),_footerAlign:e.footerAlign,footerSpacing:e.footerSpacing,footerMarginTop:e.footerMarginTop,caretSize:e.caretSize,cornerRadius:e.cornerRadius,backgroundColor:e.backgroundColor,opacity:0,legendColorBackground:e.multiKeyBackground,displayColors:e.displayColors}}function o(t,e){var a=t._chart.ctx,i=2*e.yPadding,n=0,o=e.body,r=o.reduce(function(t,e){return t+e.before.length+e.lines.length+e.after.length},0);r+=e.beforeBody.length+e.afterBody.length;var l=e.title.length,d=e.footer.length,u=e.titleFontSize,c=e.bodyFontSize,h=e.footerFontSize;i+=l*u,i+=l?(l-1)*e.titleSpacing:0,i+=l?e.titleMarginBottom:0,i+=r*c,i+=r?(r-1)*e.bodySpacing:0,i+=d?e.footerMarginTop:0,i+=d*h,i+=d?(d-1)*e.footerSpacing:0;var f=0,g=function(t){n=Math.max(n,a.measureText(t).width+f)};return a.font=s.fontString(u,e._titleFontStyle,e._titleFontFamily),s.each(e.title,g),a.font=s.fontString(c,e._bodyFontStyle,e._bodyFontFamily),s.each(e.beforeBody.concat(e.afterBody),g),f=e.displayColors?c+2:0,s.each(o,function(t){s.each(t.before,g),s.each(t.lines,g),s.each(t.after,g)}),f=0,a.font=s.fontString(h,e._footerFontStyle,e._footerFontFamily),s.each(e.footer,g),n+=2*e.xPadding,{width:n,height:i}}function r(t,e){var a=t._model,i=t._chart,n=t._chartInstance.chartArea,o="center",r="center";a.y<e.height?r="top":a.y>i.height-e.height&&(r="bottom");var l,s,d,u,c,h=(n.left+n.right)/2,f=(n.top+n.bottom)/2;"center"===r?(l=function(t){return h>=t},s=function(t){return t>h}):(l=function(t){return t<=e.width/2},s=function(t){return t>=i.width-e.width/2}),d=function(t){return t+e.width>i.width},u=function(t){return t-e.width<0},c=function(t){return f>=t?"top":"bottom"},l(a.x)?(o="left",d(a.x)&&(o="center",r=c(a.y))):s(a.x)&&(o="right",u(a.x)&&(o="center",r=c(a.y)));var g=t._options;return{xAlign:g.xAlign?g.xAlign:o,yAlign:g.yAlign?g.yAlign:r}}function l(t,e,a){var i=t.x,n=t.y,o=t.caretSize,r=t.caretPadding,l=t.cornerRadius,s=a.xAlign,d=a.yAlign,u=o+r,c=l+r;return"right"===s?i-=e.width:"center"===s&&(i-=e.width/2),"top"===d?n+=u:n-="bottom"===d?e.height+u:e.height/2,"center"===d?"left"===s?i+=u:"right"===s&&(i-=u):"left"===s?i-=c:"right"===s&&(i+=c),{x:i,y:n}}var s=t.helpers;t.defaults.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,caretSize:5,cornerRadius:6,multiKeyBackground:"#fff",displayColors:!0,callbacks:{beforeTitle:s.noop,title:function(t,e){var a="",i=e.labels,n=i?i.length:0;if(t.length>0){var o=t[0];o.xLabel?a=o.xLabel:n>0&&o.index<n&&(a=i[o.index])}return a},afterTitle:s.noop,beforeBody:s.noop,beforeLabel:s.noop,label:function(t,e){var a=e.datasets[t.datasetIndex].label||"";return a+": "+t.yLabel},labelColor:function(t,e){var a=e.getDatasetMeta(t.datasetIndex),i=a.data[t.index],n=i._view;return{borderColor:n.borderColor,backgroundColor:n.backgroundColor}},afterLabel:s.noop,afterBody:s.noop,beforeFooter:s.noop,footer:s.noop,afterFooter:s.noop}},t.Tooltip=t.Element.extend({initialize:function(){this._model=n(this._options)},getTitle:function(){var t=this,e=t._options,i=e.callbacks,n=i.beforeTitle.apply(t,arguments),o=i.title.apply(t,arguments),r=i.afterTitle.apply(t,arguments),l=[];return l=a(l,n),l=a(l,o),l=a(l,r)},getBeforeBody:function(){var t=this._options.callbacks.beforeBody.apply(this,arguments);return s.isArray(t)?t:void 0!==t?[t]:[]},getBody:function(t,e){var i=this,n=i._options.callbacks,o=[];return s.each(t,function(t){var r={before:[],lines:[],after:[]};a(r.before,n.beforeLabel.call(i,t,e)),a(r.lines,n.label.call(i,t,e)),a(r.after,n.afterLabel.call(i,t,e)),o.push(r)}),o},getAfterBody:function(){var t=this._options.callbacks.afterBody.apply(this,arguments);return s.isArray(t)?t:void 0!==t?[t]:[]},getFooter:function(){var t=this,e=t._options.callbacks,i=e.beforeFooter.apply(t,arguments),n=e.footer.apply(t,arguments),o=e.afterFooter.apply(t,arguments),r=[];return r=a(r,i),r=a(r,n),r=a(r,o)},update:function(e){var a,d,u=this,c=u._options,h=u._model,f=u._model=n(c),g=u._active,p=u._data,m=u._chartInstance,b={xAlign:h.xAlign,yAlign:h.yAlign},v={x:h.x,y:h.y},x={width:h.width,height:h.height},y={x:h.caretX,y:h.caretY};if(g.length){f.opacity=1;var k=[];y=t.Tooltip.positioners[c.position](g,u._eventPosition);var S=[];for(a=0,d=g.length;d>a;++a)S.push(i(g[a]));c.filter&&(S=S.filter(function(t){return c.filter(t,p)})),c.itemSort&&(S=S.sort(function(t,e){return c.itemSort(t,e,p)})),s.each(S,function(t){k.push(c.callbacks.labelColor.call(u,t,m))}),f.title=u.getTitle(S,p),f.beforeBody=u.getBeforeBody(S,p),f.body=u.getBody(S,p),f.afterBody=u.getAfterBody(S,p),f.footer=u.getFooter(S,p),f.x=Math.round(y.x),f.y=Math.round(y.y),f.caretPadding=s.getValueOrDefault(y.padding,2),f.labelColors=k,f.dataPoints=S,x=o(this,f),b=r(this,x),v=l(f,x,b)}else f.opacity=0;return f.xAlign=b.xAlign,f.yAlign=b.yAlign,f.x=v.x,f.y=v.y,f.width=x.width,f.height=x.height,f.caretX=y.x,f.caretY=y.y,u._model=f,e&&c.custom&&c.custom.call(u,f),u},drawCaret:function(t,a,i){var n,o,r,l,s,d,u=this._view,c=this._chart.ctx,h=u.caretSize,f=u.cornerRadius,g=u.xAlign,p=u.yAlign,m=t.x,b=t.y,v=a.width,x=a.height;"center"===p?("left"===g?(n=m,o=n-h,r=n):(n=m+v,o=n+h,r=n),s=b+x/2,l=s-h,d=s+h):("left"===g?(n=m+f,o=n+h,r=o+h):"right"===g?(n=m+v-f,o=n-h,r=o-h):(o=m+v/2,n=o-h,r=o+h),"top"===p?(l=b,s=l-h,d=l):(l=b+x,s=l+h,d=l)),c.fillStyle=e(u.backgroundColor,i),c.beginPath(),c.moveTo(n,l),c.lineTo(o,s),c.lineTo(r,d),c.closePath(),c.fill()},drawTitle:function(t,a,i,n){var o=a.title;if(o.length){i.textAlign=a._titleAlign,i.textBaseline="top";var r=a.titleFontSize,l=a.titleSpacing;i.fillStyle=e(a.titleFontColor,n),i.font=s.fontString(r,a._titleFontStyle,a._titleFontFamily);var d,u;for(d=0,u=o.length;u>d;++d)i.fillText(o[d],t.x,t.y),t.y+=r+l,d+1===o.length&&(t.y+=a.titleMarginBottom-l)}},drawBody:function(t,a,i,n){var o=a.bodyFontSize,r=a.bodySpacing,l=a.body;i.textAlign=a._bodyAlign,i.textBaseline="top";var d=e(a.bodyFontColor,n);i.fillStyle=d,i.font=s.fontString(o,a._bodyFontStyle,a._bodyFontFamily);var u=0,c=function(e){i.fillText(e,t.x+u,t.y),t.y+=o+r};s.each(a.beforeBody,c);var h=a.displayColors;u=h?o+2:0,s.each(l,function(r,l){s.each(r.before,c),s.each(r.lines,function(r){h&&(i.fillStyle=e(a.legendColorBackground,n),i.fillRect(t.x,t.y,o,o),i.strokeStyle=e(a.labelColors[l].borderColor,n),i.strokeRect(t.x,t.y,o,o),i.fillStyle=e(a.labelColors[l].backgroundColor,n),i.fillRect(t.x+1,t.y+1,o-2,o-2),i.fillStyle=d),c(r)}),s.each(r.after,c)}),u=0,s.each(a.afterBody,c),t.y-=r},drawFooter:function(t,a,i,n){var o=a.footer;o.length&&(t.y+=a.footerMarginTop,i.textAlign=a._footerAlign,i.textBaseline="top",i.fillStyle=e(a.footerFontColor,n),i.font=s.fontString(a.footerFontSize,a._footerFontStyle,a._footerFontFamily),s.each(o,function(e){i.fillText(e,t.x,t.y),t.y+=a.footerFontSize+a.footerSpacing}))},drawBackground:function(t,a,i,n,o){i.fillStyle=e(a.backgroundColor,o),s.drawRoundedRectangle(i,t.x,t.y,n.width,n.height,a.cornerRadius),i.fill()},draw:function(){var t=this._chart.ctx,e=this._view;if(0!==e.opacity){var a={width:e.width,height:e.height},i={x:e.x,y:e.y},n=Math.abs(e.opacity<.001)?0:e.opacity;this._options.enabled&&(this.drawBackground(i,e,t,a,n),this.drawCaret(i,a,n),i.x+=e.xPadding,i.y+=e.yPadding,this.drawTitle(i,e,t,n),this.drawBody(i,e,t,n),this.drawFooter(i,e,t,n))}},handleEvent:function(t){var e=this,a=e._options,i=!1;if(e._lastActive=e._lastActive||[],"mouseout"===t.type?e._active=[]:e._active=e._chartInstance.getElementsAtEventForMode(t,a.mode,a),i=!s.arrayEquals(e._active,e._lastActive),e._lastActive=e._active,a.enabled||a.custom){e._eventPosition=s.getRelativePosition(t,e._chart);var n=e._model;e.update(!0),e.pivot(),i|=n.x!==e._model.x||n.y!==e._model.y}return i}}),t.Tooltip.positioners={average:function(t){if(!t.length)return!1;var e,a,i=0,n=0,o=0;for(e=0,a=t.length;a>e;++e){var r=t[e];if(r&&r.hasValue()){var l=r.tooltipPosition();i+=l.x,n+=l.y,++o}}return{x:Math.round(i/o),y:Math.round(n/o)}},nearest:function(t,e){var a,i,n,o=e.x,r=e.y,l=Number.POSITIVE_INFINITY;for(i=0,n=t.length;n>i;++i){var d=t[i];if(d&&d.hasValue()){var u=d.getCenterPoint(),c=s.distanceBetweenPoints(e,u);l>c&&(l=c,a=d)}}if(a){var h=a.tooltipPosition();o=h.x,r=h.y}return{x:o,y:r}}}}},{}],37:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers,a=t.defaults.global;a.elements.arc={backgroundColor:a.defaultColor,borderColor:"#fff",borderWidth:2},t.elements.Arc=t.Element.extend({inLabelRange:function(t){var e=this._view;return e?Math.pow(t-e.x,2)<Math.pow(e.radius+e.hoverRadius,2):!1},inRange:function(t,a){var i=this._view;if(i){for(var n=e.getAngleFromPoint(i,{x:t,y:a}),o=n.angle,r=n.distance,l=i.startAngle,s=i.endAngle;l>s;)s+=2*Math.PI;for(;o>s;)o-=2*Math.PI;for(;l>o;)o+=2*Math.PI;var d=o>=l&&s>=o,u=r>=i.innerRadius&&r<=i.outerRadius;return d&&u}return!1},getCenterPoint:function(){var t=this._view,e=(t.startAngle+t.endAngle)/2,a=(t.innerRadius+t.outerRadius)/2;return{x:t.x+Math.cos(e)*a,y:t.y+Math.sin(e)*a}},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,a=(t.outerRadius-t.innerRadius)/2+t.innerRadius;return{x:t.x+Math.cos(e)*a,y:t.y+Math.sin(e)*a}},draw:function(){var t=this._chart.ctx,e=this._view,a=e.startAngle,i=e.endAngle;t.beginPath(),t.arc(e.x,e.y,e.outerRadius,a,i),t.arc(e.x,e.y,e.innerRadius,i,a,!0),t.closePath(),t.strokeStyle=e.borderColor,t.lineWidth=e.borderWidth,t.fillStyle=e.backgroundColor,t.fill(),t.lineJoin="bevel",e.borderWidth&&t.stroke()}})}},{}],38:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers,a=t.defaults.global;t.defaults.global.elements.line={tension:.4,backgroundColor:a.defaultColor,borderWidth:3,borderColor:a.defaultColor,borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",capBezierPoints:!0,fill:!0},t.elements.Line=t.Element.extend({draw:function(){function t(t,e){var a=e._view;e._view.steppedLine===!0?(s.lineTo(a.x,t._view.y),s.lineTo(a.x,a.y)):0===e._view.tension?s.lineTo(a.x,a.y):s.bezierCurveTo(t._view.controlPointNextX,t._view.controlPointNextY,a.controlPointPreviousX,a.controlPointPreviousY,a.x,a.y)}var i=this,n=i._view,o=n.spanGaps,r=n.scaleZero,l=i._loop;l||("top"===n.fill?r=n.scaleTop:"bottom"===n.fill&&(r=n.scaleBottom));var s=i._chart.ctx;s.save();var d=i._children.slice(),u=-1;l&&d.length&&d.push(d[0]);var c,h,f,g;if(d.length&&n.fill){for(s.beginPath(),c=0;c<d.length;++c)h=d[c],f=e.previousItem(d,c),g=h._view,0===c?(l?s.moveTo(r.x,r.y):s.moveTo(g.x,r),g.skip||(u=c,s.lineTo(g.x,g.y))):(f=-1===u?f:d[u],g.skip?o||u!==c-1||(l?s.lineTo(r.x,r.y):s.lineTo(f._view.x,r)):(u!==c-1?o&&-1!==u?t(f,h):l?s.lineTo(g.x,g.y):(s.lineTo(g.x,r),s.lineTo(g.x,g.y)):t(f,h),u=c));l||-1===u||s.lineTo(d[u]._view.x,r),s.fillStyle=n.backgroundColor||a.defaultColor,s.closePath(),s.fill()}var p=a.elements.line;for(s.lineCap=n.borderCapStyle||p.borderCapStyle,s.setLineDash&&s.setLineDash(n.borderDash||p.borderDash),s.lineDashOffset=n.borderDashOffset||p.borderDashOffset,s.lineJoin=n.borderJoinStyle||p.borderJoinStyle,s.lineWidth=n.borderWidth||p.borderWidth,s.strokeStyle=n.borderColor||a.defaultColor,s.beginPath(),u=-1,c=0;c<d.length;++c)h=d[c],f=e.previousItem(d,c),g=h._view,0===c?g.skip||(s.moveTo(g.x,g.y),u=c):(f=-1===u?f:d[u],g.skip||(u!==c-1&&!o||-1===u?s.moveTo(g.x,g.y):t(f,h),u=c));s.stroke(),s.restore()}})}},{}],39:[function(t,e,a){"use strict";e.exports=function(t){function e(t){var e=this._view;return e?Math.pow(t-e.x,2)<Math.pow(e.radius+e.hitRadius,2):!1}function a(t){var e=this._view;return e?Math.pow(t-e.y,2)<Math.pow(e.radius+e.hitRadius,2):!1}var i=t.helpers,n=t.defaults.global,o=n.defaultColor;n.elements.point={radius:3,pointStyle:"circle",backgroundColor:o,borderWidth:1,borderColor:o,hitRadius:1,hoverRadius:4,hoverBorderWidth:1},t.elements.Point=t.Element.extend({inRange:function(t,e){var a=this._view;return a?Math.pow(t-a.x,2)+Math.pow(e-a.y,2)<Math.pow(a.hitRadius+a.radius,2):!1},inLabelRange:e,inXRange:e,inYRange:a,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(){var e=this._view,a=this._chart.ctx,r=e.pointStyle,l=e.radius,s=e.x,d=e.y;e.skip||(a.strokeStyle=e.borderColor||o,a.lineWidth=i.getValueOrDefault(e.borderWidth,n.elements.point.borderWidth),a.fillStyle=e.backgroundColor||o,t.canvasHelpers.drawPoint(a,r,l,s,d))}})}},{}],40:[function(t,e,a){"use strict";e.exports=function(t){function e(t){return void 0!==t._view.width}function a(t){var a,i,n,o,r=t._view;if(e(t)){var l=r.width/2;a=r.x-l,i=r.x+l,n=Math.min(r.y,r.base),o=Math.max(r.y,r.base)}else{var s=r.height/2;a=Math.min(r.x,r.base),i=Math.max(r.x,r.base),n=r.y-s,o=r.y+s}return{left:a,top:n,right:i,bottom:o}}var i=t.defaults.global;i.elements.rectangle={backgroundColor:i.defaultColor,borderWidth:0,borderColor:i.defaultColor,borderSkipped:"bottom"},t.elements.Rectangle=t.Element.extend({draw:function(){function t(t){return s[(u+t)%4]}var e=this._chart.ctx,a=this._view,i=a.width/2,n=a.x-i,o=a.x+i,r=a.base-(a.base-a.y),l=a.borderWidth/2;a.borderWidth&&(n+=l,o-=l,r+=l),e.beginPath(),e.fillStyle=a.backgroundColor,e.strokeStyle=a.borderColor,e.lineWidth=a.borderWidth;var s=[[n,a.base],[n,r],[o,r],[o,a.base]],d=["bottom","left","top","right"],u=d.indexOf(a.borderSkipped,0);-1===u&&(u=0);var c=t(0);e.moveTo(c[0],c[1]);for(var h=1;4>h;h++)c=t(h),e.lineTo(c[0],c[1]);e.fill(),a.borderWidth&&e.stroke()},height:function(){var t=this._view;return t.base-t.y},inRange:function(t,e){var i=!1;if(this._view){var n=a(this);i=t>=n.left&&t<=n.right&&e>=n.top&&e<=n.bottom}return i},inLabelRange:function(t,i){var n=this;if(!n._view)return!1;var o=!1,r=a(n);return o=e(n)?t>=r.left&&t<=r.right:i>=r.top&&i<=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,a,i=this._view;return e(this)?(t=i.x,a=(i.y+i.base)/2):(t=(i.x+i.base)/2,a=i.y),{x:t,y:a}},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}}})}},{}],41:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers,a={position:"bottom"},i=t.Scale.extend({getLabels:function(){var t=this.chart.data;return(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels},determineDataLimits:function(){var t=this,a=t.getLabels();t.minIndex=0,t.maxIndex=a.length-1;var i;void 0!==t.options.ticks.min&&(i=e.indexOf(a,t.options.ticks.min),t.minIndex=-1!==i?i:t.minIndex),void 0!==t.options.ticks.max&&(i=e.indexOf(a,t.options.ticks.max),t.maxIndex=-1!==i?i:t.maxIndex),t.min=a[t.minIndex],t.max=a[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 a=this,i=a.chart.data,n=a.isHorizontal();return i.xLabels&&n||i.yLabels&&!n?a.getRightValue(i.datasets[e].data[t]):a.ticks[t]},getPixelForValue:function(t,e,a,i){var n=this,o=Math.max(n.maxIndex+1-n.minIndex-(n.options.gridLines.offsetGridLines?0:1),1);if(void 0!==t&&isNaN(e)){var r=n.getLabels(),l=r.indexOf(t);e=-1!==l?l:e}if(n.isHorizontal()){var s=n.width-(n.paddingLeft+n.paddingRight),d=s/o,u=d*(e-n.minIndex)+n.paddingLeft;return(n.options.gridLines.offsetGridLines&&i||n.maxIndex===n.minIndex&&i)&&(u+=d/2),
|
14 |
+
n.left+Math.round(u)}var c=n.height-(n.paddingTop+n.paddingBottom),h=c/o,f=h*(e-n.minIndex)+n.paddingTop;return n.options.gridLines.offsetGridLines&&i&&(f+=h/2),n.top+Math.round(f)},getPixelForTick:function(t,e){return this.getPixelForValue(this.ticks[t],t+this.minIndex,null,e)},getValueForPixel:function(t){var e,a=this,i=Math.max(a.ticks.length-(a.options.gridLines.offsetGridLines?0:1),1),n=a.isHorizontal(),o=n?a.width-(a.paddingLeft+a.paddingRight):a.height-(a.paddingTop+a.paddingBottom),r=o/i;return t-=n?a.left:a.top,a.options.gridLines.offsetGridLines&&(t-=r/2),t-=n?a.paddingLeft:a.paddingTop,e=0>=t?0:Math.round(t/r)},getBasePixel:function(){return this.bottom}});t.scaleService.registerScaleType("category",i,a)}},{}],42:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers,a={position:"left",ticks:{callback:t.Ticks.formatters.linear}},i=t.LinearScaleBase.extend({determineDataLimits:function(){function t(t){return l?t.xAxisID===a.id:t.yAxisID===a.id}var a=this,i=a.options,n=a.chart,o=n.data,r=o.datasets,l=a.isHorizontal();if(a.min=null,a.max=null,i.stacked){var s={};e.each(r,function(o,r){var l=n.getDatasetMeta(r);void 0===s[l.type]&&(s[l.type]={positiveValues:[],negativeValues:[]});var d=s[l.type].positiveValues,u=s[l.type].negativeValues;n.isDatasetVisible(r)&&t(l)&&e.each(o.data,function(t,e){var n=+a.getRightValue(t);isNaN(n)||l.data[e].hidden||(d[e]=d[e]||0,u[e]=u[e]||0,i.relativePoints?d[e]=100:0>n?u[e]+=n:d[e]+=n)})}),e.each(s,function(t){var i=t.positiveValues.concat(t.negativeValues),n=e.min(i),o=e.max(i);a.min=null===a.min?n:Math.min(a.min,n),a.max=null===a.max?o:Math.max(a.max,o)})}else e.each(r,function(i,o){var r=n.getDatasetMeta(o);n.isDatasetVisible(o)&&t(r)&&e.each(i.data,function(t,e){var i=+a.getRightValue(t);isNaN(i)||r.data[e].hidden||(null===a.min?a.min=i:i<a.min&&(a.min=i),null===a.max?a.max=i:i>a.max&&(a.max=i))})});this.handleTickRangeOptions()},getTickLimit:function(){var a,i=this,n=i.options.ticks;if(i.isHorizontal())a=Math.min(n.maxTicksLimit?n.maxTicksLimit:11,Math.ceil(i.width/50));else{var o=e.getValueOrDefault(n.fontSize,t.defaults.global.defaultFontSize);a=Math.min(n.maxTicksLimit?n.maxTicksLimit:11,Math.ceil(i.height/(2*o)))}return a},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,a,i=this,n=i.paddingLeft,o=i.paddingBottom,r=i.start,l=+i.getRightValue(t),s=i.end-r;return i.isHorizontal()?(a=i.width-(n+i.paddingRight),e=i.left+a/s*(l-r),Math.round(e+n)):(a=i.height-(i.paddingTop+o),e=i.bottom-o-a/s*(l-r),Math.round(e))},getValueForPixel:function(t){var e=this,a=e.isHorizontal(),i=e.paddingLeft,n=e.paddingBottom,o=a?e.width-(i+e.paddingRight):e.height-(e.paddingTop+n),r=(a?t-e.left-i:e.bottom-n-t)/o;return e.start+(e.end-e.start)*r},getPixelForTick:function(t){return this.getPixelForValue(this.ticksAsNumbers[t])}});t.scaleService.registerScaleType("linear",i,a)}},{}],43:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers,a=e.noop;t.LinearScaleBase=t.Scale.extend({handleTickRangeOptions:function(){var t=this,a=t.options,i=a.ticks;if(i.beginAtZero){var n=e.sign(t.min),o=e.sign(t.max);0>n&&0>o?t.max=0:n>0&&o>0&&(t.min=0)}void 0!==i.min?t.min=i.min:void 0!==i.suggestedMin&&(t.min=Math.min(t.min,i.suggestedMin)),void 0!==i.max?t.max=i.max:void 0!==i.suggestedMax&&(t.max=Math.max(t.max,i.suggestedMax)),t.min===t.max&&(t.max++,i.beginAtZero||t.min--)},getTickLimit:a,handleDirectionalChanges:a,buildTicks:function(){var a=this,i=a.options,n=i.ticks,o=a.getTickLimit();o=Math.max(2,o);var r={maxTicks:o,min:n.min,max:n.max,stepSize:e.getValueOrDefault(n.fixedStepSize,n.stepSize)},l=a.ticks=t.Ticks.generators.linear(r,a);a.handleDirectionalChanges(),a.max=e.max(l),a.min=e.min(l),n.reverse?(l.reverse(),a.start=a.max,a.end=a.min):(a.start=a.min,a.end=a.max)},convertTicksToLabels:function(){var e=this;e.ticksAsNumbers=e.ticks.slice(),e.zeroLineIndex=e.ticks.indexOf(0),t.Scale.prototype.convertTicksToLabels.call(e)}})}},{}],44:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers,a={position:"left",ticks:{callback:t.Ticks.formatters.logarithmic}},i=t.Scale.extend({determineDataLimits:function(){function t(t){return d?t.xAxisID===a.id:t.yAxisID===a.id}var a=this,i=a.options,n=i.ticks,o=a.chart,r=o.data,l=r.datasets,s=e.getValueOrDefault,d=a.isHorizontal();if(a.min=null,a.max=null,a.minNotZero=null,i.stacked){var u={};e.each(l,function(n,r){var l=o.getDatasetMeta(r);o.isDatasetVisible(r)&&t(l)&&(void 0===u[l.type]&&(u[l.type]=[]),e.each(n.data,function(t,e){var n=u[l.type],o=+a.getRightValue(t);isNaN(o)||l.data[e].hidden||(n[e]=n[e]||0,i.relativePoints?n[e]=100:n[e]+=o)}))}),e.each(u,function(t){var i=e.min(t),n=e.max(t);a.min=null===a.min?i:Math.min(a.min,i),a.max=null===a.max?n:Math.max(a.max,n)})}else e.each(l,function(i,n){var r=o.getDatasetMeta(n);o.isDatasetVisible(n)&&t(r)&&e.each(i.data,function(t,e){var i=+a.getRightValue(t);isNaN(i)||r.data[e].hidden||(null===a.min?a.min=i:i<a.min&&(a.min=i),null===a.max?a.max=i:i>a.max&&(a.max=i),0!==i&&(null===a.minNotZero||i<a.minNotZero)&&(a.minNotZero=i))})});a.min=s(n.min,a.min),a.max=s(n.max,a.max),a.min===a.max&&(0!==a.min&&null!==a.min?(a.min=Math.pow(10,Math.floor(e.log10(a.min))-1),a.max=Math.pow(10,Math.floor(e.log10(a.max))+1)):(a.min=1,a.max=10))},buildTicks:function(){var a=this,i=a.options,n=i.ticks,o={min:n.min,max:n.max},r=a.ticks=t.Ticks.generators.logarithmic(o,a);a.isHorizontal()||r.reverse(),a.max=e.max(r),a.min=e.min(r),n.reverse?(r.reverse(),a.start=a.max,a.end=a.min):(a.start=a.min,a.end=a.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 a,i,n,o=this,r=o.start,l=+o.getRightValue(t),s=o.paddingTop,d=o.paddingBottom,u=o.paddingLeft,c=o.options,h=c.ticks;return o.isHorizontal()?(n=e.log10(o.end)-e.log10(r),0===l?i=o.left+u:(a=o.width-(u+o.paddingRight),i=o.left+a/n*(e.log10(l)-e.log10(r)),i+=u)):(a=o.height-(s+d),0!==r||h.reverse?0===o.end&&h.reverse?(n=e.log10(o.start)-e.log10(o.minNotZero),i=l===o.end?o.top+s:l===o.minNotZero?o.top+s+.02*a:o.top+s+.02*a+.98*a/n*(e.log10(l)-e.log10(o.minNotZero))):(n=e.log10(o.end)-e.log10(r),a=o.height-(s+d),i=o.bottom-d-a/n*(e.log10(l)-e.log10(r))):(n=e.log10(o.end)-e.log10(o.minNotZero),i=l===r?o.bottom-d:l===o.minNotZero?o.bottom-d-.02*a:o.bottom-d-.02*a-.98*a/n*(e.log10(l)-e.log10(o.minNotZero)))),i},getValueForPixel:function(t){var a,i,n=this,o=e.log10(n.end)-e.log10(n.start);return n.isHorizontal()?(i=n.width-(n.paddingLeft+n.paddingRight),a=n.start*Math.pow(10,(t-n.left-n.paddingLeft)*o/i)):(i=n.height-(n.paddingTop+n.paddingBottom),a=Math.pow(10,(n.bottom-n.paddingBottom-t)*o/i)/n.start),a}});t.scaleService.registerScaleType("logarithmic",i,a)}},{}],45:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers,a=t.defaults.global,i={display:!0,animate:!0,lineArc:!1,position:"chartArea",angleLines:{display:!0,color:"rgba(0, 0, 0, 0.1)",lineWidth:1},ticks:{showLabelBackdrop:!0,backdropColor:"rgba(255,255,255,0.75)",backdropPaddingY:2,backdropPaddingX:2,callback:t.Ticks.formatters.linear},pointLabels:{fontSize:10,callback:function(t){return t}}},n=t.LinearScaleBase.extend({getValueCount:function(){return this.chart.data.labels.length},setDimensions:function(){var t=this,i=t.options,n=i.ticks;t.width=t.maxWidth,t.height=t.maxHeight,t.xCenter=Math.round(t.width/2),t.yCenter=Math.round(t.height/2);var o=e.min([t.height,t.width]),r=e.getValueOrDefault(n.fontSize,a.defaultFontSize);t.drawingArea=i.display?o/2-(r/2+n.backdropPaddingY):o/2},determineDataLimits:function(){var t=this,a=t.chart;t.min=null,t.max=null,e.each(a.data.datasets,function(i,n){if(a.isDatasetVisible(n)){var o=a.getDatasetMeta(n);e.each(i.data,function(e,a){var i=+t.getRightValue(e);isNaN(i)||o.data[a].hidden||(null===t.min?t.min=i:i<t.min&&(t.min=i),null===t.max?t.max=i:i>t.max&&(t.max=i))})}}),t.handleTickRangeOptions()},getTickLimit:function(){var t=this.options.ticks,i=e.getValueOrDefault(t.fontSize,a.defaultFontSize);return Math.min(t.maxTicksLimit?t.maxTicksLimit:11,Math.ceil(this.drawingArea/(1.5*i)))},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(){var t,i,n,o,r,l,s,d,u,c,h,f,g=this.options.pointLabels,p=e.getValueOrDefault(g.fontSize,a.defaultFontSize),m=e.getValueOrDefault(g.fontStyle,a.defaultFontStyle),b=e.getValueOrDefault(g.fontFamily,a.defaultFontFamily),v=e.fontString(p,m,b),x=e.min([this.height/2-p-5,this.width/2]),y=this.width,k=0;for(this.ctx.font=v,i=0;i<this.getValueCount();i++){t=this.getPointPosition(i,x),n=this.ctx.measureText(this.pointLabels[i]?this.pointLabels[i]:"").width+5;var S=this.getIndexAngle(i)+Math.PI/2,w=360*S/(2*Math.PI)%360;0===w||180===w?(o=n/2,t.x+o>y&&(y=t.x+o,r=i),t.x-o<k&&(k=t.x-o,s=i)):180>w?t.x+n>y&&(y=t.x+n,r=i):t.x-n<k&&(k=t.x-n,s=i)}u=k,c=Math.ceil(y-this.width),l=this.getIndexAngle(r),d=this.getIndexAngle(s),h=c/Math.sin(l+Math.PI/2),f=u/Math.sin(d+Math.PI/2),h=e.isNumber(h)?h:0,f=e.isNumber(f)?f:0,this.drawingArea=Math.round(x-(f+h)/2),this.setCenterPoint(f,h)},setCenterPoint:function(t,e){var a=this,i=a.width-e-a.drawingArea,n=t+a.drawingArea;a.xCenter=Math.round((n+i)/2+a.left),a.yCenter=Math.round(a.height/2+a.top)},getIndexAngle:function(t){var e=2*Math.PI/this.getValueCount(),a=this.chart.options&&this.chart.options.startAngle?this.chart.options.startAngle:0,i=a*Math.PI*2/360;return t*e-Math.PI/2+i},getDistanceFromCenterForValue:function(t){var e=this;if(null===t)return 0;var a=e.drawingArea/(e.max-e.min);return e.options.reverse?(e.max-t)*a:(t-e.min)*a},getPointPosition:function(t,e){var a=this,i=a.getIndexAngle(t);return{x:Math.round(Math.cos(i)*e)+a.xCenter,y:Math.round(Math.sin(i)*e)+a.yCenter}},getPointPositionForValue:function(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))},getBasePosition:function(){var t=this,e=t.min,a=t.max;return t.getPointPositionForValue(0,t.beginAtZero?0:0>e&&0>a?a:e>0&&a>0?e:0)},draw:function(){var t=this,i=t.options,n=i.gridLines,o=i.ticks,r=i.angleLines,l=i.pointLabels,s=e.getValueOrDefault;if(i.display){var d=t.ctx,u=s(o.fontSize,a.defaultFontSize),c=s(o.fontStyle,a.defaultFontStyle),h=s(o.fontFamily,a.defaultFontFamily),f=e.fontString(u,c,h);if(e.each(t.ticks,function(r,l){if(l>0||i.reverse){var c=t.getDistanceFromCenterForValue(t.ticksAsNumbers[l]),h=t.yCenter-c;if(n.display&&0!==l)if(d.strokeStyle=e.getValueAtIndexOrDefault(n.color,l-1),d.lineWidth=e.getValueAtIndexOrDefault(n.lineWidth,l-1),i.lineArc)d.beginPath(),d.arc(t.xCenter,t.yCenter,c,0,2*Math.PI),d.closePath(),d.stroke();else{d.beginPath();for(var g=0;g<t.getValueCount();g++){var p=t.getPointPosition(g,c);0===g?d.moveTo(p.x,p.y):d.lineTo(p.x,p.y)}d.closePath(),d.stroke()}if(o.display){var m=s(o.fontColor,a.defaultFontColor);if(d.font=f,o.showLabelBackdrop){var b=d.measureText(r).width;d.fillStyle=o.backdropColor,d.fillRect(t.xCenter-b/2-o.backdropPaddingX,h-u/2-o.backdropPaddingY,b+2*o.backdropPaddingX,u+2*o.backdropPaddingY)}d.textAlign="center",d.textBaseline="middle",d.fillStyle=m,d.fillText(r,t.xCenter,h)}}}),!i.lineArc){d.lineWidth=r.lineWidth,d.strokeStyle=r.color;for(var g=t.getDistanceFromCenterForValue(i.reverse?t.min:t.max),p=s(l.fontSize,a.defaultFontSize),m=s(l.fontStyle,a.defaultFontStyle),b=s(l.fontFamily,a.defaultFontFamily),v=e.fontString(p,m,b),x=t.getValueCount()-1;x>=0;x--){if(r.display){var y=t.getPointPosition(x,g);d.beginPath(),d.moveTo(t.xCenter,t.yCenter),d.lineTo(y.x,y.y),d.stroke(),d.closePath()}var k=t.getPointPosition(x,g+5),S=s(l.fontColor,a.defaultFontColor);d.font=v,d.fillStyle=S;var w=t.pointLabels,M=this.getIndexAngle(x)+Math.PI/2,C=360*M/(2*Math.PI)%360;0===C||180===C?d.textAlign="center":180>C?d.textAlign="left":d.textAlign="right",90===C||270===C?d.textBaseline="middle":C>270||90>C?d.textBaseline="bottom":d.textBaseline="top",d.fillText(w[x]?w[x]:"",k.x,k.y)}}}}});t.scaleService.registerScaleType("radialLinear",n,i)}},{}],46:[function(t,e,a){"use strict";var i=t(1);i="function"==typeof i?i:window.moment,e.exports=function(t){var e=t.helpers,a={units:[{name:"millisecond",steps:[1,2,5,10,20,50,100,250,500]},{name:"second",steps:[1,2,5,10,30]},{name:"minute",steps:[1,2,5,10,30]},{name:"hour",steps:[1,2,3,6,12]},{name:"day",steps:[1,2,5]},{name:"week",maxStep:4},{name:"month",maxStep:3},{name:"quarter",maxStep:4},{name:"year",maxStep:!1}]},n={position:"bottom",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:ss a",hour:"MMM D, hA",day:"ll",week:"ll",month:"MMM YYYY",quarter:"[Q]Q - YYYY",year:"YYYY"}},ticks:{autoSkip:!1}},o=t.Scale.extend({initialize:function(){if(!i)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");t.Scale.prototype.initialize.call(this)},getLabelMoment:function(t,e){return null===t||null===e?null:"undefined"!=typeof this.labelMoments[t]?this.labelMoments[t][e]:null},getLabelDiff:function(t,e){var a=this;return null===t||null===e?null:(void 0===a.labelDiffs&&a.buildLabelDiffs(),"undefined"!=typeof a.labelDiffs[t]?a.labelDiffs[t][e]:null)},getMomentStartOf:function(t){var e=this;return"week"===e.options.time.unit&&e.options.time.isoWeekday!==!1?t.clone().startOf("isoWeek").isoWeekday(e.options.time.isoWeekday):t.clone().startOf(e.tickUnit)},determineDataLimits:function(){var t=this;t.labelMoments=[];var a=[];t.chart.data.labels&&t.chart.data.labels.length>0?(e.each(t.chart.data.labels,function(e){var i=t.parseTime(e);i.isValid()&&(t.options.time.round&&i.startOf(t.options.time.round),a.push(i))},t),t.firstTick=i.min.call(t,a),t.lastTick=i.max.call(t,a)):(t.firstTick=null,t.lastTick=null),e.each(t.chart.data.datasets,function(n,o){var r=[],l=t.chart.isDatasetVisible(o);"object"==typeof n.data[0]&&null!==n.data[0]?e.each(n.data,function(e){var a=t.parseTime(t.getRightValue(e));a.isValid()&&(t.options.time.round&&a.startOf(t.options.time.round),r.push(a),l&&(t.firstTick=null!==t.firstTick?i.min(t.firstTick,a):a,t.lastTick=null!==t.lastTick?i.max(t.lastTick,a):a))},t):r=a,t.labelMoments.push(r)},t),t.options.time.min&&(t.firstTick=t.parseTime(t.options.time.min)),t.options.time.max&&(t.lastTick=t.parseTime(t.options.time.max)),t.firstTick=(t.firstTick||i()).clone(),t.lastTick=(t.lastTick||i()).clone()},buildLabelDiffs:function(){var t=this;t.labelDiffs=[];var a=[];t.chart.data.labels&&t.chart.data.labels.length>0&&e.each(t.chart.data.labels,function(e){var i=t.parseTime(e);i.isValid()&&(t.options.time.round&&i.startOf(t.options.time.round),a.push(i.diff(t.firstTick,t.tickUnit,!0)))},t),e.each(t.chart.data.datasets,function(i){var n=[];"object"==typeof i.data[0]&&null!==i.data[0]?e.each(i.data,function(e){var a=t.parseTime(t.getRightValue(e));a.isValid()&&(t.options.time.round&&a.startOf(t.options.time.round),n.push(a.diff(t.firstTick,t.tickUnit,!0)))},t):n=a,t.labelDiffs.push(n)},t)},buildTicks:function(){var i=this;i.ctx.save();var n=e.getValueOrDefault(i.options.ticks.fontSize,t.defaults.global.defaultFontSize),o=e.getValueOrDefault(i.options.ticks.fontStyle,t.defaults.global.defaultFontStyle),r=e.getValueOrDefault(i.options.ticks.fontFamily,t.defaults.global.defaultFontFamily),l=e.fontString(n,o,r);if(i.ctx.font=l,i.ticks=[],i.unitScale=1,i.scaleSizeInUnits=0,i.options.time.unit)i.tickUnit=i.options.time.unit||"day",i.displayFormat=i.options.time.displayFormats[i.tickUnit],i.scaleSizeInUnits=i.lastTick.diff(i.firstTick,i.tickUnit,!0),i.unitScale=e.getValueOrDefault(i.options.time.unitStepSize,1);else{var s=i.isHorizontal()?i.width-(i.paddingLeft+i.paddingRight):i.height-(i.paddingTop+i.paddingBottom),d=i.tickFormatFunction(i.firstTick,0,[]),u=i.ctx.measureText(d).width,c=Math.cos(e.toRadians(i.options.ticks.maxRotation)),h=Math.sin(e.toRadians(i.options.ticks.maxRotation));u=u*c+n*h;var f=s/u;i.tickUnit=i.options.time.minUnit,i.scaleSizeInUnits=i.lastTick.diff(i.firstTick,i.tickUnit,!0),i.displayFormat=i.options.time.displayFormats[i.tickUnit];for(var g=0,p=a.units[g];g<a.units.length;){if(i.unitScale=1,e.isArray(p.steps)&&Math.ceil(i.scaleSizeInUnits/f)<e.max(p.steps)){for(var m=0;m<p.steps.length;++m)if(p.steps[m]>=Math.ceil(i.scaleSizeInUnits/f)){i.unitScale=e.getValueOrDefault(i.options.time.unitStepSize,p.steps[m]);break}break}if(p.maxStep===!1||Math.ceil(i.scaleSizeInUnits/f)<p.maxStep){i.unitScale=e.getValueOrDefault(i.options.time.unitStepSize,Math.ceil(i.scaleSizeInUnits/f));break}++g,p=a.units[g],i.tickUnit=p.name;var b=i.firstTick.diff(i.getMomentStartOf(i.firstTick),i.tickUnit,!0),v=i.getMomentStartOf(i.lastTick.clone().add(1,i.tickUnit)).diff(i.lastTick,i.tickUnit,!0);i.scaleSizeInUnits=i.lastTick.diff(i.firstTick,i.tickUnit,!0)+b+v,i.displayFormat=i.options.time.displayFormats[p.name]}}var x;if(i.options.time.min?x=i.getMomentStartOf(i.firstTick):(i.firstTick=i.getMomentStartOf(i.firstTick),x=i.firstTick),!i.options.time.max){var y=i.getMomentStartOf(i.lastTick),k=y.diff(i.lastTick,i.tickUnit,!0);0>k?i.lastTick=i.getMomentStartOf(i.lastTick.add(1,i.tickUnit)):k>=0&&(i.lastTick=y),i.scaleSizeInUnits=i.lastTick.diff(i.firstTick,i.tickUnit,!0)}i.options.time.displayFormat&&(i.displayFormat=i.options.time.displayFormat),i.ticks.push(i.firstTick.clone());for(var S=1;S<=i.scaleSizeInUnits;++S){var w=x.clone().add(S,i.tickUnit);if(i.options.time.max&&w.diff(i.lastTick,i.tickUnit,!0)>=0)break;S%i.unitScale===0&&i.ticks.push(w)}var M=i.ticks[i.ticks.length-1].diff(i.lastTick,i.tickUnit);(0!==M||0===i.scaleSizeInUnits)&&(i.options.time.max?(i.ticks.push(i.lastTick.clone()),i.scaleSizeInUnits=i.lastTick.diff(i.ticks[0],i.tickUnit,!0)):(i.ticks.push(i.lastTick.clone()),i.scaleSizeInUnits=i.lastTick.diff(i.firstTick,i.tickUnit,!0))),i.ctx.restore(),i.labelDiffs=void 0},getLabelForIndex:function(t,e){var a=this,i=a.chart.data.labels&&t<a.chart.data.labels.length?a.chart.data.labels[t]:"";return"object"==typeof a.chart.data.datasets[e].data[0]&&(i=a.getRightValue(a.chart.data.datasets[e].data[t])),a.options.time.tooltipFormat&&(i=a.parseTime(i).format(a.options.time.tooltipFormat)),i},tickFormatFunction:function(t,a,i){var n=t.format(this.displayFormat),o=this.options.ticks,r=e.getValueOrDefault(o.callback,o.userCallback);return r?r(n,a,i):n},convertTicksToLabels:function(){var t=this;t.tickMoments=t.ticks,t.ticks=t.ticks.map(t.tickFormatFunction,t)},getPixelForValue:function(t,e,a){var i=this,n=null;if(void 0!==e&&void 0!==a&&(n=i.getLabelDiff(a,e)),null===n&&(t&&t.isValid||(t=i.parseTime(i.getRightValue(t))),t&&t.isValid&&t.isValid()&&(n=t.diff(i.firstTick,i.tickUnit,!0))),null!==n){var o=0!==n?n/i.scaleSizeInUnits:n;if(i.isHorizontal()){var r=i.width-(i.paddingLeft+i.paddingRight),l=r*o+i.paddingLeft;return i.left+Math.round(l)}var s=i.height-(i.paddingTop+i.paddingBottom),d=s*o+i.paddingTop;return i.top+Math.round(d)}},getPixelForTick:function(t){return this.getPixelForValue(this.tickMoments[t],null,null)},getValueForPixel:function(t){var e=this,a=e.isHorizontal()?e.width-(e.paddingLeft+e.paddingRight):e.height-(e.paddingTop+e.paddingBottom),n=(t-(e.isHorizontal()?e.left+e.paddingLeft:e.top+e.paddingTop))/a;return n*=e.scaleSizeInUnits,e.firstTick.clone().add(i.duration(n,e.tickUnit).asSeconds(),"seconds")},parseTime:function(t){var e=this;return"string"==typeof e.options.time.parser?i(t,e.options.time.parser):"function"==typeof e.options.time.parser?e.options.time.parser(t):"function"==typeof t.getMonth||"number"==typeof t?i(t):t.isValid&&t.isValid()?t:"string"!=typeof e.options.time.format&&e.options.time.format.call?(console.warn("options.time.format is deprecated and replaced by options.time.parser. See http://nnnick.github.io/Chart.js/docs-v2/#scales-time-scale"),e.options.time.format(t)):i(t,e.options.time.format)}});t.scaleService.registerScaleType("time",o,n)}},{1:1}]},{},[7])(7)});
|
15 |
+
|
16 |
+
jQuery(document).ready(function ($) {
|
17 |
+
|
18 |
+
// Load
|
19 |
+
$("#quads-vi-signup").click(function () {
|
20 |
+
console.log(quads.vi_signup_url + '?email='+quads.email + '&domain'+quads.domain + '&aid=WP_Quads')
|
21 |
+
$("#quads_vi_signup_iframe").attr("src", quads.vi_signup_url + '?email='+quads.email + '&domain='+quads.domain + '&aid=WP_Quads');
|
22 |
+
quads_verify_vi_signup();
|
23 |
+
});
|
24 |
+
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Load iAB categories in correct tier 1 and tier 2 hirachy
|
28 |
+
*/
|
29 |
+
if (document.getElementById('quads_vi_ads[ads][1][iab1]')){
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Change iab2 tier 2 category by iab tier 1 selection
|
33 |
+
*/
|
34 |
+
|
35 |
+
var iab1Val = jQuery('#quads_vi_ads\\[ads\\]\\[1\\]\\[iab1\\]').val();
|
36 |
+
replace_iab2_options(iab1Val);
|
37 |
+
|
38 |
+
|
39 |
+
jQuery('#quads_vi_ads\\[ads\\]\\[1\\]\\[iab1\\]').load(function(){
|
40 |
+
var $this = $(this);
|
41 |
+
//console.log($this.val());
|
42 |
+
replace_iab2_options($this.val());
|
43 |
+
})
|
44 |
+
|
45 |
+
|
46 |
+
jQuery('#quads_vi_ads\\[ads\\]\\[1\\]\\[iab1\\]').change(function(){
|
47 |
+
var $this = $(this);
|
48 |
+
replace_iab2_options($this.val());
|
49 |
+
})
|
50 |
+
|
51 |
+
function replace_iab2_options(element){
|
52 |
+
jQuery('#quads_vi_ads\\[ads\\]\\[1\\]\\[iab2\\] option').each(function(i){
|
53 |
+
var re = new RegExp("\\" + element, "ig");
|
54 |
+
if ($(this).val().match(re) ){
|
55 |
+
//console.log('match');
|
56 |
+
$(this).prop('disabled', false).show();
|
57 |
+
} else {
|
58 |
+
$(this).prop('disabled', true).hide();
|
59 |
+
}
|
60 |
+
if(jQuery('#quads_vi_ads\\[ads\\]\\[1\\]\\[iab2\\] option:selected').prop('disabled') != false) {
|
61 |
+
jQuery('#quads_vi_ads\\[ads\\]\\[1\\]\\[iab2\\]').val('select');
|
62 |
+
}
|
63 |
+
//console.log(element);
|
64 |
+
});
|
65 |
+
};
|
66 |
+
|
67 |
+
}
|
68 |
+
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Create vi Revenue Chart
|
72 |
+
*/
|
73 |
+
var quadsViRevenueInit = function(x, y){
|
74 |
+
var ctx = document.getElementById('quads-vi-revenue').getContext('2d');
|
75 |
+
var chart = new Chart(ctx, {
|
76 |
+
// The type of chart we want to create
|
77 |
+
type: 'line',
|
78 |
+
// The data for our dataset
|
79 |
+
data: {
|
80 |
+
labels: x,
|
81 |
+
datasets: [{
|
82 |
+
label: "VI Revenue",
|
83 |
+
backgroundColor: 'rgb(236,245,251)',
|
84 |
+
borderColor: 'rgb(34,149,195)',
|
85 |
+
data: y,
|
86 |
+
}]
|
87 |
+
},
|
88 |
+
// Configuration options go here
|
89 |
+
options: {}
|
90 |
+
});
|
91 |
+
}
|
92 |
+
|
93 |
+
// Get values for revenue widget
|
94 |
+
if (document.getElementById('quads-vi-revenue')){
|
95 |
+
var x = [];
|
96 |
+
var y = [];
|
97 |
+
// Get array of x values
|
98 |
+
jQuery.each(quads.vi_revenue, function(index, value){
|
99 |
+
x.push(value['date']);
|
100 |
+
});
|
101 |
+
// Get array of y values
|
102 |
+
jQuery.each(quads.vi_revenue, function(index, value){
|
103 |
+
y.push(value['revenue']);
|
104 |
+
});
|
105 |
+
quadsViRevenueInit(x, y);
|
106 |
+
}
|
107 |
+
|
108 |
+
// Create vi ad and save it via ajax
|
109 |
+
jQuery('#quads_vi_save_settings_submit').click(function(){
|
110 |
+
|
111 |
+
jQuery("#quads-vi-save-notice").css('display','block');
|
112 |
+
jQuery("#quads-vi-save-notice").html('Saving settings...');
|
113 |
+
setTimeout(function(){
|
114 |
+
jQuery("#quads-vi-save-notice").html('Building ad code ...');
|
115 |
+
console.log('saved vi ad settings');
|
116 |
+
save_quads_vi_ad_settings();
|
117 |
+
},3000);
|
118 |
+
});
|
119 |
+
|
120 |
+
/**
|
121 |
+
* Save vi token
|
122 |
+
*/
|
123 |
+
var save_quads_vi_ad_settings = function (){
|
124 |
+
|
125 |
+
|
126 |
+
var data = {
|
127 |
+
'action': 'quads_save_vi_ads',
|
128 |
+
};
|
129 |
+
jQuery.ajax({
|
130 |
+
type: "POST",
|
131 |
+
url: ajaxurl,
|
132 |
+
data: data,
|
133 |
+
//contentType: 'application/json',
|
134 |
+
success: function(response){
|
135 |
+
console.log(response);
|
136 |
+
response = JSON.parse(response);
|
137 |
+
|
138 |
+
if(response.status && response.status == 'error'){
|
139 |
+
var resp = 'Error:' + response.error.message + ' ' + (response.error.description ? response.error.description : '');
|
140 |
+
} else {
|
141 |
+
var resp = 'Success: vi Ad Changes might take some time to take into effect.';
|
142 |
+
}
|
143 |
+
//console.log('success' + response);
|
144 |
+
jQuery("#quads-vi-save-notice").html(resp);
|
145 |
+
},
|
146 |
+
error: function(response){
|
147 |
+
console.log(response);
|
148 |
+
jQuery("#quads-vi-save-notice").html(response);
|
149 |
+
},
|
150 |
+
|
151 |
+
beforeSend:function()
|
152 |
+
{
|
153 |
+
jQuery("#quads-vi-save-notice quads-spinner").css('display','block');
|
154 |
+
},
|
155 |
+
complete:function()
|
156 |
+
{
|
157 |
+
jQuery("#quads-vi-save-notice quads-spinner").css('display','none');
|
158 |
+
}
|
159 |
+
});
|
160 |
+
}
|
161 |
+
|
162 |
+
/**
|
163 |
+
* verify vi sign up
|
164 |
+
* This is done once after sign up to the vi api and creating a new user account
|
165 |
+
* Data is used only for matching of wp quads and vi customer databases and is send only after confirmation of the user
|
166 |
+
*/
|
167 |
+
var quads_verify_vi_signup = function (){
|
168 |
+
|
169 |
+
var data = {
|
170 |
+
'domain': quads.domain,
|
171 |
+
'mail': quads.email,
|
172 |
+
};
|
173 |
+
jQuery.ajax({
|
174 |
+
type: "POST",
|
175 |
+
url: 'https://wpquads.com/wpquads-api/signup/create.php',
|
176 |
+
data: JSON.stringify(data),
|
177 |
+
contentType: 'application/json',
|
178 |
+
success: function(response){
|
179 |
+
console.log(response);
|
180 |
+
//response = JSON.parse(response);
|
181 |
+
|
182 |
+
if(response){
|
183 |
+
console.log('Send sign up data to wp quads');
|
184 |
+
}
|
185 |
+
},
|
186 |
+
error: function(response){
|
187 |
+
console.log(response);
|
188 |
+
console.log('Error: Can not send sign up data to wp quads');
|
189 |
+
},
|
190 |
+
complete:function()
|
191 |
+
{
|
192 |
+
}
|
193 |
+
});
|
194 |
+
}
|
195 |
+
|
196 |
+
});
|
includes/vendor/vi/render.php
ADDED
@@ -0,0 +1,222 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace wpquads;
|
4 |
+
|
5 |
+
/*
|
6 |
+
* vi ad render for WP QUADS used on front page
|
7 |
+
*
|
8 |
+
* @author René Hermenau
|
9 |
+
* @email info@mashshare.net
|
10 |
+
*
|
11 |
+
*/
|
12 |
+
|
13 |
+
class render extends conditions\conditions {
|
14 |
+
|
15 |
+
/**
|
16 |
+
* All Ad Settings
|
17 |
+
* @var array
|
18 |
+
*/
|
19 |
+
protected $ads;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Curent ad id
|
23 |
+
* @var int
|
24 |
+
*/
|
25 |
+
protected $id;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Filtered Content
|
29 |
+
* @var string
|
30 |
+
*/
|
31 |
+
protected $content;
|
32 |
+
|
33 |
+
|
34 |
+
public function __construct() {
|
35 |
+
|
36 |
+
if (is_admin()) {
|
37 |
+
return false;
|
38 |
+
}
|
39 |
+
|
40 |
+
$this->ads = get_option('quads_vi_ads');
|
41 |
+
|
42 |
+
add_filter('the_content', array($this, 'prepareOutput'));
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Loop through all ads
|
47 |
+
* @param string $content
|
48 |
+
* @return string
|
49 |
+
*/
|
50 |
+
public function prepareOutput($content) {
|
51 |
+
|
52 |
+
if (empty($this->ads['ads'])) {
|
53 |
+
return $content;
|
54 |
+
}
|
55 |
+
|
56 |
+
If (empty($this->content)) {
|
57 |
+
$this->content = $content;
|
58 |
+
}
|
59 |
+
|
60 |
+
// Loop through all available ads and use the return value as new $content
|
61 |
+
foreach ($this->ads['ads'] as $key => $value) {
|
62 |
+
$this->id = $key;
|
63 |
+
$this->content = $this->filterContent();
|
64 |
+
}
|
65 |
+
|
66 |
+
return $this->content;
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Loop through all available filter methods
|
71 |
+
* New filter can be added by adding methods with prefix 'filter'
|
72 |
+
* @param string $content
|
73 |
+
* @param int $id
|
74 |
+
*/
|
75 |
+
public function filterContent() {
|
76 |
+
|
77 |
+
// Loop through all available filter methods and run them until one of the filters returns sucessfully
|
78 |
+
$methods = get_class_methods(get_class());
|
79 |
+
$loop = true;
|
80 |
+
foreach ($methods as $method) {
|
81 |
+
|
82 |
+
if ($loop == false) {
|
83 |
+
break;
|
84 |
+
}
|
85 |
+
// Do not use method filterContent()
|
86 |
+
if (strpos($method, 'filter') !== false && $method != 'filterContent') {
|
87 |
+
// Set content to filtered content
|
88 |
+
if (true == $this->$method()) {
|
89 |
+
$loop = false;
|
90 |
+
}
|
91 |
+
}
|
92 |
+
}
|
93 |
+
return do_shortcode($this->content);
|
94 |
+
}
|
95 |
+
|
96 |
+
private function filterNoPost() {
|
97 |
+
if (isset($this->ads['ads'][$this->id]['position']) &&
|
98 |
+
$this->ads['ads'][$this->id]['position'] === 'notShown') {
|
99 |
+
$this->content = $this->content;
|
100 |
+
return true;
|
101 |
+
}
|
102 |
+
return false;
|
103 |
+
}
|
104 |
+
|
105 |
+
private function filterAbovePost() {
|
106 |
+
if (isset($this->ads['ads'][$this->id]['position']) &&
|
107 |
+
$this->ads['ads'][$this->id]['position'] === 'abovePost') {
|
108 |
+
$this->content = $this->render($this->id) . $this->content;
|
109 |
+
return true;
|
110 |
+
}
|
111 |
+
return false;
|
112 |
+
}
|
113 |
+
|
114 |
+
private function filterBelowPost() {
|
115 |
+
if (isset($this->ads['ads'][$this->id]['position']) &&
|
116 |
+
$this->ads['ads'][$this->id]['position'] === 'belowPost') {
|
117 |
+
|
118 |
+
$this->content = $this->content . $this->render();
|
119 |
+
return true;
|
120 |
+
}
|
121 |
+
return false;
|
122 |
+
}
|
123 |
+
|
124 |
+
private function filterMiddlePost() {
|
125 |
+
if (isset($this->ads['ads'][$this->id]['position']) &&
|
126 |
+
$this->ads['ads'][$this->id]['position'] === 'middlePost') {
|
127 |
+
|
128 |
+
$paragraphCount = $this->get_paragraph_count();
|
129 |
+
$middle = round($paragraphCount / 2);
|
130 |
+
if ($paragraphCount > 1) {
|
131 |
+
$content = explode("</p>", $this->content);
|
132 |
+
array_splice($content, $middle, 0, $this->render()); // splice in at middle position
|
133 |
+
$this->content = implode($content, "</p>");
|
134 |
+
}
|
135 |
+
|
136 |
+
$this->content = $this->content . $this->render();
|
137 |
+
return true;
|
138 |
+
}
|
139 |
+
return false;
|
140 |
+
}
|
141 |
+
|
142 |
+
/**
|
143 |
+
* Count paragraphs
|
144 |
+
* @return int
|
145 |
+
*/
|
146 |
+
private function get_paragraph_count() {
|
147 |
+
$paragraphs = explode('/p>', $this->content);
|
148 |
+
$paragraphCount = 0;
|
149 |
+
if (is_array($paragraphs)) {
|
150 |
+
foreach ($paragraphs as $paragraph) {
|
151 |
+
if (strlen($paragraph) > 1) {
|
152 |
+
$paragraphCount++;
|
153 |
+
}
|
154 |
+
}
|
155 |
+
}
|
156 |
+
return $paragraphCount;
|
157 |
+
}
|
158 |
+
|
159 |
+
private function getInlineStyle() {
|
160 |
+
$style = '';
|
161 |
+
// Layout Alignment
|
162 |
+
if (isset($this->ads['ads'][$this->id]['align']) &&
|
163 |
+
$this->ads['ads'][$this->id]['align'] !== 'default') {
|
164 |
+
|
165 |
+
switch ($this->ads['ads'][$this->id]['align']) {
|
166 |
+
case 'left':
|
167 |
+
$style .= "float:left;";
|
168 |
+
break;
|
169 |
+
case 'right':
|
170 |
+
$style .= "float:right;";
|
171 |
+
break;
|
172 |
+
case 'middle':
|
173 |
+
$style .="text-align:center;";
|
174 |
+
break;
|
175 |
+
}
|
176 |
+
}
|
177 |
+
return $style;
|
178 |
+
}
|
179 |
+
|
180 |
+
|
181 |
+
/**
|
182 |
+
* Check if vi api is active
|
183 |
+
* @return boolean
|
184 |
+
*/
|
185 |
+
private function isActive(){
|
186 |
+
$isActive = get_option('quads_vi_active');
|
187 |
+
if($isActive && $isActive == 'false') {
|
188 |
+
return false;
|
189 |
+
}
|
190 |
+
return true;
|
191 |
+
}
|
192 |
+
|
193 |
+
/**
|
194 |
+
* Render ads
|
195 |
+
* @return string
|
196 |
+
*/
|
197 |
+
public function render() {
|
198 |
+
|
199 |
+
if ($this->isExcluded() || !$this->isActive()) {
|
200 |
+
return '';
|
201 |
+
}
|
202 |
+
|
203 |
+
|
204 |
+
if (!isset($this->ads['ads'][$this->id]['code'])) {
|
205 |
+
return '';
|
206 |
+
}
|
207 |
+
|
208 |
+
$html = '';
|
209 |
+
$args = array(
|
210 |
+
'adId' => $this->id,
|
211 |
+
'adCode' => $this->ads['ads'][$this->id]['code'],
|
212 |
+
'style' => $this->getInlineStyle()
|
213 |
+
);
|
214 |
+
$output = new \wpquads\template('/includes/vendor/vi/templates/ad', $args);
|
215 |
+
$html .= $output->render();
|
216 |
+
|
217 |
+
return $html;
|
218 |
+
}
|
219 |
+
|
220 |
+
}
|
221 |
+
|
222 |
+
$render = new render();
|
includes/vendor/vi/templates/ad.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* vi ad template
|
4 |
+
*/
|
5 |
+
?>
|
6 |
+
|
7 |
+
<!-- WP QUADS v. <?php echo QUADS_VERSION; ?> automatic embeded vi ad -->
|
8 |
+
<div class="quads-location quads-vi-ad<?php echo $adId; ?>" id="quads-vi-ad<?php echo $adId; ?>" style="min-width:336px;<?php echo $style; ?>">
|
9 |
+
<script>
|
10 |
+
<?php echo do_shortcode($adCode); ?>
|
11 |
+
</script>
|
12 |
+
</div>
|
includes/vendor/vi/vi.php
ADDED
@@ -0,0 +1,618 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace wpquads;
|
4 |
+
|
5 |
+
/*
|
6 |
+
* vi integration for WP QUADS
|
7 |
+
* @author René Hermenau
|
8 |
+
* @email info@mashshare.net
|
9 |
+
*
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Main class for wp quads vi integration used in wp-admin section
|
14 |
+
*
|
15 |
+
* @author René Hermenau
|
16 |
+
*/
|
17 |
+
class vi {
|
18 |
+
|
19 |
+
/**
|
20 |
+
* vi settings
|
21 |
+
* @var type
|
22 |
+
*/
|
23 |
+
public $settings;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Debug mode
|
27 |
+
* @var bool
|
28 |
+
*/
|
29 |
+
private $debug = false;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Base64 decoded jwt token
|
33 |
+
* @var obj
|
34 |
+
*/
|
35 |
+
public $token;
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Available ads
|
39 |
+
* @var obj
|
40 |
+
*/
|
41 |
+
public $ads;
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Ad Settings
|
45 |
+
* @var obj
|
46 |
+
*/
|
47 |
+
public $adsSettings;
|
48 |
+
|
49 |
+
public function __construct() {
|
50 |
+
|
51 |
+
if ($this->debug) {
|
52 |
+
// Test endpoints
|
53 |
+
$this->urlSettings = 'https://dashboard-api-test.vidint.net/v1/api/widget/settings';
|
54 |
+
} else {
|
55 |
+
// Production endpoints
|
56 |
+
$this->urlSettings = 'https://dashboard-api.vidint.net/v1/api/widget/settings';
|
57 |
+
}
|
58 |
+
|
59 |
+
$this->getToken();
|
60 |
+
|
61 |
+
$this->hooks();
|
62 |
+
|
63 |
+
$this->settings = get_option('quads_vi_settings');
|
64 |
+
|
65 |
+
$this->ads = get_option('quads_vi_ads');
|
66 |
+
}
|
67 |
+
|
68 |
+
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Load hooks
|
72 |
+
*/
|
73 |
+
public function hooks() {
|
74 |
+
// Register the vi ad settings
|
75 |
+
add_action('admin_init', array($this, 'registerSettings'));
|
76 |
+
|
77 |
+
|
78 |
+
// Only run the following actions when vi is activated and user confirmed his registration
|
79 |
+
// We need to ensure publishers privacy and do not want to send more personal information than absolutely necessary
|
80 |
+
if (!empty($this->token)) {
|
81 |
+
// Cron Check vi api settings daily
|
82 |
+
add_action('quads_weekly_event', array($this, 'setSettings'));
|
83 |
+
add_action('quads_daily_event', array($this, 'setActive'));
|
84 |
+
add_action('quads_daily_event', array($this, 'setRevenue'));
|
85 |
+
add_action('quads_weekly_event', array($this, 'verifyViAdCode'));
|
86 |
+
}
|
87 |
+
|
88 |
+
// Shortcodes
|
89 |
+
add_shortcode('quadsvi', array($this, 'getShortcode'));
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Register the vi ad settings
|
94 |
+
*/
|
95 |
+
public function registerSettings() {
|
96 |
+
register_setting('quads_settings', 'quads_vi_ads');
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Shortcode to include vi ad
|
101 |
+
*
|
102 |
+
* @param array $atts
|
103 |
+
*/
|
104 |
+
public function getShortcode($atts) {
|
105 |
+
global $quads_options;
|
106 |
+
|
107 |
+
if (quads_check_meta_setting('NoAds') === '1') {
|
108 |
+
return;
|
109 |
+
}
|
110 |
+
|
111 |
+
if (quads_is_amp_endpoint()) {
|
112 |
+
return;
|
113 |
+
}
|
114 |
+
|
115 |
+
// The ad id
|
116 |
+
$id = isset($atts['id']) ? (int) $atts['id'] : 1;
|
117 |
+
|
118 |
+
$viad = $this->getAdCode();
|
119 |
+
|
120 |
+
$style = 'min-width:363px;min-height:363px;';
|
121 |
+
|
122 |
+
$code = "\n" . '<!-- WP QUADS v. ' . QUADS_VERSION . ' Shortcode vi ad -->' . "\n";
|
123 |
+
$code .= '<div class="quads-location' . $id . '" id="quads-vi-ad' . $id . '" style="' . $style . '">' . "\n";
|
124 |
+
$code .= "<script>";
|
125 |
+
$code .= do_shortcode($viad['ads'][1]['code']);
|
126 |
+
$code .= '</script>' . "\n";
|
127 |
+
$code .= '</div>' . "\n";
|
128 |
+
|
129 |
+
return $code;
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* vi Settings API
|
134 |
+
* @return bool
|
135 |
+
* See https://docs.vi.ai/
|
136 |
+
* {
|
137 |
+
"status": "ok",
|
138 |
+
"error": null,
|
139 |
+
"data": {
|
140 |
+
"_id": [string],
|
141 |
+
"signupURL": [string],
|
142 |
+
"demoPageURL": [string],
|
143 |
+
"loginAPI": [string],
|
144 |
+
"directSellURL": [string],
|
145 |
+
"dashboardURL": [string],
|
146 |
+
"IABcategoriesUrl": [string],
|
147 |
+
"revenueAPI": [string],
|
148 |
+
"adsTxtAPI": [string],
|
149 |
+
“languages”: [ {“string” : “string”}, ... ]
|
150 |
+
"jsTagAPI": [string]
|
151 |
+
}
|
152 |
+
}
|
153 |
+
*/
|
154 |
+
public function setSettings() {
|
155 |
+
|
156 |
+
$args = array(
|
157 |
+
'method' => 'GET',
|
158 |
+
'headers' => array(),
|
159 |
+
'timeout' => 45
|
160 |
+
);
|
161 |
+
$response = wp_remote_post($this->urlSettings, $args);
|
162 |
+
|
163 |
+
$response = json_decode($response['body']);
|
164 |
+
|
165 |
+
if (isset($response->status) && $response->status == 'ok') {
|
166 |
+
update_option('quads_vi_settings', $response);
|
167 |
+
return true;
|
168 |
+
}
|
169 |
+
return false;
|
170 |
+
}
|
171 |
+
|
172 |
+
/**
|
173 |
+
* Get vi settings
|
174 |
+
* @return obj
|
175 |
+
*/
|
176 |
+
public function getSettings() {
|
177 |
+
return get_option('quads_vi_settings');
|
178 |
+
}
|
179 |
+
|
180 |
+
/**
|
181 |
+
* Get languges
|
182 |
+
* @return array
|
183 |
+
*/
|
184 |
+
public function getLanguages() {
|
185 |
+
|
186 |
+
if (!isset($this->settings->data->languages)) {
|
187 |
+
return array();
|
188 |
+
}
|
189 |
+
|
190 |
+
$languages = array();
|
191 |
+
foreach ($this->settings->data->languages as $language) {
|
192 |
+
foreach ($language as $key => $value) {
|
193 |
+
$languages[$key] = $value;
|
194 |
+
}
|
195 |
+
}
|
196 |
+
if (count($languages) > 0) {
|
197 |
+
return $languages;
|
198 |
+
} else {
|
199 |
+
return array();
|
200 |
+
}
|
201 |
+
|
202 |
+
return array();
|
203 |
+
}
|
204 |
+
|
205 |
+
/**
|
206 |
+
* Get font family
|
207 |
+
* @return array
|
208 |
+
*/
|
209 |
+
public function getFontFamily() {
|
210 |
+
return array('Arial' => 'Arial',
|
211 |
+
'Times New Roman' => 'Times New Roman',
|
212 |
+
'Georgia' => 'Georgia',
|
213 |
+
'Palatino Linotype' => 'Palatino Linotype',
|
214 |
+
'Arial' => 'Arial',
|
215 |
+
'Arial Black' => 'Arial Black',
|
216 |
+
'Comic Sans MS' => 'Comic Sans MS',
|
217 |
+
'Impact' => 'Impact',
|
218 |
+
'Lucida Sans Unicode' => 'Lucida Sans Unicode',
|
219 |
+
'Tahoma' => 'Tahoma',
|
220 |
+
'Trebuchet MS' => 'Trebuchet MS',
|
221 |
+
'Verdana' => 'Verdana',
|
222 |
+
'Courier New' => 'Courier New',
|
223 |
+
'Lucida Console' => 'Lucida Console',
|
224 |
+
);
|
225 |
+
}
|
226 |
+
|
227 |
+
/**
|
228 |
+
* Login to vi account
|
229 |
+
* @param string $email
|
230 |
+
* @param string $password
|
231 |
+
* @return string json
|
232 |
+
*/
|
233 |
+
public function login($email, $password) {
|
234 |
+
$args = array(
|
235 |
+
'method' => 'POST',
|
236 |
+
'headers' => array(),
|
237 |
+
'timeout' => 45,
|
238 |
+
'body' => array('email' => $email, 'password' => $password)
|
239 |
+
);
|
240 |
+
|
241 |
+
$response = wp_remote_post($this->urlAuthenticate, $args);
|
242 |
+
if (is_array($response)) {
|
243 |
+
return $response['body'];
|
244 |
+
}
|
245 |
+
return json_encode('Unknown error: Can not retrive vi login information');
|
246 |
+
}
|
247 |
+
|
248 |
+
/**
|
249 |
+
*
|
250 |
+
* @return string
|
251 |
+
*/
|
252 |
+
public function getDashboard() {
|
253 |
+
$response = wp_remote_get($this->urlDashboard);
|
254 |
+
if (is_array($response)) {
|
255 |
+
return $response['body']; // use the content
|
256 |
+
}
|
257 |
+
return '';
|
258 |
+
}
|
259 |
+
|
260 |
+
/**
|
261 |
+
* Can write to the root of WordPress
|
262 |
+
* @return boolean
|
263 |
+
*/
|
264 |
+
private function canWriteRoot() {
|
265 |
+
if (is_writable(get_home_path())) {
|
266 |
+
return true;
|
267 |
+
}
|
268 |
+
return false;
|
269 |
+
}
|
270 |
+
|
271 |
+
/**
|
272 |
+
* Create ads.txt
|
273 |
+
* @return boolean
|
274 |
+
*/
|
275 |
+
public function createAdsTxt() {
|
276 |
+
|
277 |
+
if (!isset($this->token->publisherId)){
|
278 |
+
return false;
|
279 |
+
}
|
280 |
+
|
281 |
+
$file = ABSPATH . 'ads.txt';
|
282 |
+
|
283 |
+
// Default ads.txt content used when api is not returning anything
|
284 |
+
$vi = "vi.ai " . $this->token->publisherId . " DIRECT #41b5eef6" . "\r\n";
|
285 |
+
$vi .= "spotxchange.com, 74964, RESELLER, 7842df1d2fe2db34 #41b5eef6" . "\r\n";
|
286 |
+
$vi .= "spotx.tv, 74964, RESELLER, 7842df1d2fe2db34 #41b5eef6" . "\r\n";
|
287 |
+
$vi .= "spotx.tv, 104684, RESELLER, 7842df1d2fe2db34 #41b5eef6" . "\r\n";
|
288 |
+
$vi .= "spotx.tv, 122515, RESELLER, 7842df1d2fe2db34 #41b5eef6" . "\r\n";
|
289 |
+
$vi .= "freewheel.tv, 364193, RESELLER #41b5eef6" . "\r\n";
|
290 |
+
$vi .= "freewheel.tv, 369249, RESELLER #41b5eef6" . "\r\n";
|
291 |
+
$vi .= "freewheel.tv, 440657, RESELLER #41b5eef6" . "\r\n";
|
292 |
+
$vi .= "freewheel.tv, 440673, RESELLER #41b5eef6" . "\r\n";
|
293 |
+
|
294 |
+
// Try to get ads.txt content from vi api
|
295 |
+
if (false !== ( $adcode = $this->getAdsTxtContent() )) {
|
296 |
+
$vi = $adcode;
|
297 |
+
}
|
298 |
+
|
299 |
+
$adsTxt = new \wpquads\adsTxt($vi, '41b5eef6');
|
300 |
+
return $adsTxt->writeAdsTxt();
|
301 |
+
}
|
302 |
+
|
303 |
+
|
304 |
+
|
305 |
+
|
306 |
+
/**
|
307 |
+
* Get ads.txt from vi api
|
308 |
+
* @return mixed string | bool
|
309 |
+
*/
|
310 |
+
public function getAdsTxtContent() {
|
311 |
+
$vi_token = get_option('quads_vi_token');
|
312 |
+
if (!$vi_token)
|
313 |
+
return false;
|
314 |
+
|
315 |
+
|
316 |
+
$args = array(
|
317 |
+
'headers' => array(
|
318 |
+
'Authorization' => $vi_token
|
319 |
+
)
|
320 |
+
);
|
321 |
+
$response = wp_remote_request($this->settings->data->adsTxtAPI, $args);
|
322 |
+
|
323 |
+
if (is_wp_error($response))
|
324 |
+
return false;
|
325 |
+
if (wp_remote_retrieve_response_code($response) == '404' || wp_remote_retrieve_response_code($response) == '401')
|
326 |
+
return false;
|
327 |
+
if (empty($response))
|
328 |
+
return false;
|
329 |
+
|
330 |
+
// convert into object
|
331 |
+
$response = json_decode($response['body']);
|
332 |
+
|
333 |
+
if (!isset($response->status) || $response->status !== 'ok') {
|
334 |
+
return false;
|
335 |
+
}
|
336 |
+
|
337 |
+
// else
|
338 |
+
return $response->data;
|
339 |
+
}
|
340 |
+
|
341 |
+
/**
|
342 |
+
* Get the access token
|
343 |
+
*/
|
344 |
+
private function getToken() {
|
345 |
+
$token = get_option('quads_vi_token', '');
|
346 |
+
|
347 |
+
if (empty($token)) {
|
348 |
+
$this->token = '';
|
349 |
+
return false;
|
350 |
+
;
|
351 |
+
}
|
352 |
+
|
353 |
+
preg_match("/(\w*).(\w*)/", $token, $output);
|
354 |
+
|
355 |
+
$this->token = json_decode(base64_decode($output[2]));
|
356 |
+
}
|
357 |
+
|
358 |
+
public function getAds() {
|
359 |
+
$this->ads = get_option('quads_vi_ads');
|
360 |
+
}
|
361 |
+
|
362 |
+
public function setAds() {
|
363 |
+
update_option('quads_vi_ads', $this->ads);
|
364 |
+
}
|
365 |
+
|
366 |
+
/**
|
367 |
+
* Get revenue from API and store it in db
|
368 |
+
* @return mixed string | bool
|
369 |
+
*/
|
370 |
+
public function setRevenue() {
|
371 |
+
$vi_token = get_option('quads_vi_token');
|
372 |
+
if (!$vi_token)
|
373 |
+
return false;
|
374 |
+
|
375 |
+
if (!isset($this->settings->data->revenueAPI))
|
376 |
+
return false;
|
377 |
+
|
378 |
+
|
379 |
+
$args = array(
|
380 |
+
'headers' => array(
|
381 |
+
'Authorization' => $vi_token
|
382 |
+
)
|
383 |
+
);
|
384 |
+
//$response = wp_remote_request('https://dashboard-api-test.vidint.net/v1/api/publishers/report/revenue', $args);
|
385 |
+
$response = wp_remote_request($this->settings->data->revenueAPI, $args);
|
386 |
+
|
387 |
+
if (is_wp_error($response))
|
388 |
+
return false;
|
389 |
+
if (wp_remote_retrieve_response_code($response) == '404' || wp_remote_retrieve_response_code($response) == '401')
|
390 |
+
return false;
|
391 |
+
if (empty($response))
|
392 |
+
return false;
|
393 |
+
|
394 |
+
// convert into object
|
395 |
+
$response = json_decode($response['body']);
|
396 |
+
|
397 |
+
if (!isset($response->status) || $response->status !== 'ok') {
|
398 |
+
return false;
|
399 |
+
}
|
400 |
+
|
401 |
+
// else
|
402 |
+
//return $response->data;
|
403 |
+
update_option('quads_vi_revenue', $response->data);
|
404 |
+
return true;
|
405 |
+
}
|
406 |
+
|
407 |
+
/**
|
408 |
+
* Get Revenue from db
|
409 |
+
* @return object
|
410 |
+
*/
|
411 |
+
public function getRevenue() {
|
412 |
+
return get_option('quads_vi_revenue');
|
413 |
+
}
|
414 |
+
|
415 |
+
/**
|
416 |
+
* Get ad code from api and store it in database
|
417 |
+
* @return mixed string | bool
|
418 |
+
*/
|
419 |
+
public function setAdCode() {
|
420 |
+
$vi_token = get_option('quads_vi_token');
|
421 |
+
|
422 |
+
$ads = get_option('quads_vi_ads');
|
423 |
+
|
424 |
+
if (!$vi_token)
|
425 |
+
return false;
|
426 |
+
|
427 |
+
$viParam = array(
|
428 |
+
'domain' => $this->getDomain(),
|
429 |
+
//'adUnitType' => 'FLOATING_OUTSTREAM',
|
430 |
+
'adUnitType' => 'NATIVE_VIDEO_UNIT',
|
431 |
+
'divId' => 'div_id',
|
432 |
+
'language' => isset($ads['ads'][1]['language']) ? $ads['ads'][1]['language'] : 'en-en',
|
433 |
+
'iabCategory' => isset($ads['ads'][1]['iab2']) && 'select' != $ads['ads'][1]['iab2'] ? $ads['ads'][1]['iab2'] : 'IAB2-16',
|
434 |
+
'font' => isset($ads['ads'][1]['txt_font_family']) ? $ads['ads'][1]['txt_font_family'] : 'Courier New',
|
435 |
+
'fontSize' => isset($ads['ads'][1]['font_size']) ? $ads['ads'][1]['font_size'] : 12,
|
436 |
+
'keywords' => isset($ads['ads'][1]['keywords']) ? $ads['ads'][1]['keywords'] : 'key,words',
|
437 |
+
'textColor' => isset($ads['ads'][1]['text_color']) ? '#'.$ads['ads'][1]['text_color'] : '#00ff00',
|
438 |
+
'backgroundColor' => isset($ads['ads'][1]['bg_color']) ? '#'.$ads['ads'][1]['bg_color'] : '#00ff00',
|
439 |
+
'vioptional1' => isset($ads['ads'][1]['optional1']) ? $ads['ads'][1]['optional1'] : 'optional1',
|
440 |
+
'vioptional2' => isset($ads['ads'][1]['optional2']) ? $ads['ads'][1]['optional2'] : 'optional2',
|
441 |
+
'vioptional3' => isset($ads['ads'][1]['optional3']) ? $ads['ads'][1]['optional3'] : 'optional3',
|
442 |
+
'float' => true,
|
443 |
+
'logoUrl' => 'http://url.com/logo.jpg',
|
444 |
+
'dfpSupport' => true,
|
445 |
+
'sponsoredText' => 'Sponsored text',
|
446 |
+
'poweredByText' => 'Powered by VI'
|
447 |
+
);
|
448 |
+
|
449 |
+
$args = array(
|
450 |
+
'method' => 'POST',
|
451 |
+
'timeout' => 15,
|
452 |
+
'headers' => array(
|
453 |
+
'Authorization' => $vi_token,
|
454 |
+
'Content-Type' => 'application/json; charset=utf-8'
|
455 |
+
),
|
456 |
+
'body' => json_encode($viParam)
|
457 |
+
);
|
458 |
+
|
459 |
+
$response = wp_remote_post($this->settings->data->jsTagAPI, $args);
|
460 |
+
|
461 |
+
if (is_wp_error($response))
|
462 |
+
return false;
|
463 |
+
if (wp_remote_retrieve_response_code($response) == '404' || wp_remote_retrieve_response_code($response) == '401')
|
464 |
+
return false;
|
465 |
+
if (empty($response))
|
466 |
+
return false;
|
467 |
+
|
468 |
+
// convert into object
|
469 |
+
$response = json_decode($response['body']);
|
470 |
+
|
471 |
+
|
472 |
+
// Die()
|
473 |
+
if ($response->status !== 'ok' || empty($response->data)) {
|
474 |
+
return json_encode($response);
|
475 |
+
}
|
476 |
+
|
477 |
+
// Add ad code to key 1 as long as there are no more vi ad codes
|
478 |
+
// Later we need to loop through the $ads array to store values
|
479 |
+
$ads['ads'][1]['code'] = $response->data;
|
480 |
+
|
481 |
+
//return $response->data;
|
482 |
+
update_option('quads_vi_ads', $ads);
|
483 |
+
|
484 |
+
//return $response->data;
|
485 |
+
return json_encode($response);
|
486 |
+
}
|
487 |
+
|
488 |
+
public function getAdCode() {
|
489 |
+
return get_option('quads_vi_ads');
|
490 |
+
}
|
491 |
+
|
492 |
+
/**
|
493 |
+
* Get Publisher ID
|
494 |
+
* @return string
|
495 |
+
*/
|
496 |
+
public function getPublisherId() {
|
497 |
+
|
498 |
+
return isset($this->token->publisherId) ? $this->token->publisherId : '';
|
499 |
+
}
|
500 |
+
|
501 |
+
public function getDomain() {
|
502 |
+
$domain = str_replace('www.', '', get_home_url());
|
503 |
+
$domain = str_replace('https://', '', $domain);
|
504 |
+
$domain = str_replace('http://', '', $domain);
|
505 |
+
|
506 |
+
return $domain;
|
507 |
+
}
|
508 |
+
|
509 |
+
/**
|
510 |
+
* Daily check to make sure the vi API is available
|
511 |
+
* No personal data is logged nor transfered to any other party
|
512 |
+
* All referals and ip adresses are anonymized server internally
|
513 |
+
* @return bool
|
514 |
+
*/
|
515 |
+
public function setActive() {
|
516 |
+
$url = 'https://wpquads.com/vi.html';
|
517 |
+
$args = array(
|
518 |
+
'method' => 'GET',
|
519 |
+
'timeout' => 15,
|
520 |
+
'headers' => array(
|
521 |
+
'Content-Type' => 'application/json; charset=utf-8'
|
522 |
+
),
|
523 |
+
'body' => ''
|
524 |
+
);
|
525 |
+
|
526 |
+
$response = wp_remote_post($url, $args);
|
527 |
+
|
528 |
+
// set active per default
|
529 |
+
if (is_wp_error($response)) {
|
530 |
+
delete_option('quads_vi_active');
|
531 |
+
return true;
|
532 |
+
}
|
533 |
+
if (wp_remote_retrieve_response_code($response) == '404' || wp_remote_retrieve_response_code($response) == '401') {
|
534 |
+
delete_option('quads_vi_active');
|
535 |
+
return true;
|
536 |
+
}
|
537 |
+
if (empty($response)) {
|
538 |
+
delete_option('quads_vi_active');
|
539 |
+
return true;
|
540 |
+
}
|
541 |
+
|
542 |
+
if ($response['body'] == 'true') {
|
543 |
+
delete_option('quads_vi_active');
|
544 |
+
return true;
|
545 |
+
}
|
546 |
+
|
547 |
+
// vi is deactivated
|
548 |
+
if ($response['body'] == 'false') {
|
549 |
+
update_option('quads_vi_active', 'false');
|
550 |
+
return false;
|
551 |
+
}
|
552 |
+
}
|
553 |
+
/**
|
554 |
+
* Weekly check to ensure vi ad code has not been changed unintentionally
|
555 |
+
* @return bool
|
556 |
+
*/
|
557 |
+
public function verifyViAdCode() {
|
558 |
+
|
559 |
+
//$url = 'https://wpquads.com/wpquads-api/signup/create.php?domain='.$this->getDomain().'&hash=' . $this->getHash();
|
560 |
+
$url = 'https://wpquads.com/wpquads-api/signup/create.php';
|
561 |
+
$args = array(
|
562 |
+
'method' => 'POST',
|
563 |
+
'timeout' => 15,
|
564 |
+
'headers' => array(
|
565 |
+
'Content-Type' => 'application/json; charset=utf-8'
|
566 |
+
),
|
567 |
+
'body' => json_encode(array(
|
568 |
+
'domain' => $this->getDomain(),
|
569 |
+
'hash' => $this->getHash(),
|
570 |
+
))
|
571 |
+
);
|
572 |
+
|
573 |
+
$response = wp_remote_post($url, $args);
|
574 |
+
|
575 |
+
// set active per default
|
576 |
+
if (is_wp_error($response)) {
|
577 |
+
return true;
|
578 |
+
}
|
579 |
+
if (wp_remote_retrieve_response_code($response) == '404' || wp_remote_retrieve_response_code($response) == '401') {
|
580 |
+
return true;
|
581 |
+
}
|
582 |
+
if (empty($response)) {
|
583 |
+
return true;
|
584 |
+
}
|
585 |
+
|
586 |
+
// vi is deactivated
|
587 |
+
if ($response['body'] == 'false') {
|
588 |
+
return false;
|
589 |
+
}
|
590 |
+
}
|
591 |
+
|
592 |
+
/**
|
593 |
+
* Create a hash to ensure that ad code has not been manippulated or changed unintentionally
|
594 |
+
* Use hashing instead sending sensitive publisher data back and forth
|
595 |
+
*/
|
596 |
+
private function getHash(){
|
597 |
+
$string = get_option('quads_vi_ads');
|
598 |
+
|
599 |
+
if (isset($string['ads'][1]['code'])){
|
600 |
+
return md5($string['ads'][1]['code']);
|
601 |
+
}
|
602 |
+
return '';
|
603 |
+
}
|
604 |
+
|
605 |
+
/**
|
606 |
+
* Get login URL
|
607 |
+
* @return string
|
608 |
+
*/
|
609 |
+
public function getLoginURL(){
|
610 |
+
if (isset($this->settings->data->loginAPI) &&
|
611 |
+
!empty($this->settings->data->loginAPI)){
|
612 |
+
return $this->settings->data->loginAPI;
|
613 |
+
}
|
614 |
+
return '';
|
615 |
+
}
|
616 |
+
|
617 |
+
|
618 |
+
}
|
includes/vendor/vi/views/Forms/adSettings.php
ADDED
@@ -0,0 +1,630 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace wpquads;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Class Settings
|
7 |
+
* @package quads
|
8 |
+
*/
|
9 |
+
class adSettings {
|
10 |
+
|
11 |
+
/**
|
12 |
+
* @var array
|
13 |
+
*/
|
14 |
+
private $form = array();
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Settings constructor.
|
18 |
+
* @param Tabs $tabs
|
19 |
+
*/
|
20 |
+
public function __construct() {
|
21 |
+
|
22 |
+
$this->setAdForm();
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
*
|
27 |
+
*/
|
28 |
+
public function setAdForm() {
|
29 |
+
|
30 |
+
$this->form = new Form();
|
31 |
+
|
32 |
+
$this->vi = new vi();
|
33 |
+
|
34 |
+
$settings = json_decode(json_encode(get_option("quads_vi_ads", array())));
|
35 |
+
// Get the key width value 1 only as long as we do not have more than one (1) different vi ad
|
36 |
+
$settings = isset($settings->ads->{'1'}) ? $settings->ads->{'1'} : new \stdClass();
|
37 |
+
|
38 |
+
// Ad type
|
39 |
+
$options = array('vi_stories' => 'vi_stories', 'outstream' => 'Outstream');
|
40 |
+
$element = new Select(
|
41 |
+
"quads_vi_ads[ads][1][type]", $options, array(
|
42 |
+
"class" => "medium-text",
|
43 |
+
"step" => 1,
|
44 |
+
"max" => 999999,
|
45 |
+
"min" => 0
|
46 |
+
)
|
47 |
+
);
|
48 |
+
|
49 |
+
$this->form->add(
|
50 |
+
$element->setLabel("Ad Unit*")->setDefault(isset($settings->type) ? $settings->type : 'vi_stories')
|
51 |
+
);
|
52 |
+
|
53 |
+
|
54 |
+
// Keywords
|
55 |
+
$element = new Text('quads_vi_ads[ads][1][keywords]', array());
|
56 |
+
$this->form->add(
|
57 |
+
$element->setLabel("Keywords")->setTooltip("Comma separated values describing the content of the page e.g. 'cooking, grilling, pulled pork")->setDefault(isset($settings->keywords) ? $settings->keywords : '')
|
58 |
+
);
|
59 |
+
|
60 |
+
// iAB tier 1 category
|
61 |
+
$iab_options = array(
|
62 |
+
array("val0" => "select", "val1" => "Select tier 1 category"),
|
63 |
+
array("val0" => "IAB1", "val1" => "Arts & Entertainment"),
|
64 |
+
array("val0" => "IAB2", "val1" => "Automotive"),
|
65 |
+
array("val0" => "IAB3", "val1" => "Business"),
|
66 |
+
array("val0" => "IAB4", "val1" => "Careers"),
|
67 |
+
array("val0" => "IAB5", "val1" => "Education"),
|
68 |
+
array("val0" => "IAB6", "val1" => "Family & Parenting"),
|
69 |
+
array("val0" => "IAB7", "val1" => "Health & Fitness"),
|
70 |
+
array("val0" => "IAB8", "val1" => "Food & Drink"),
|
71 |
+
array("val0" => "IAB9", "val1" => "Hobbies & Interests"),
|
72 |
+
array("val0" => "IAB10", "val1" => "Home & Garden"),
|
73 |
+
array("val0" => "IAB11", "val1" => "Law, Gov’t & Politics"),
|
74 |
+
array("val0" => "IAB12", "val1" => "News"),
|
75 |
+
array("val0" => "IAB13", "val1" => "Personal Finance"),
|
76 |
+
array("val0" => "IAB14", "val1" => "Society"),
|
77 |
+
array("val0" => "IAB15", "val1" => "Science"),
|
78 |
+
array("val0" => "IAB16", "val1" => "Pets"),
|
79 |
+
array("val0" => "IAB17", "val1" => "Sports"),
|
80 |
+
array("val0" => "IAB18", "val1" => "Style & Fashion"),
|
81 |
+
array("val0" => "IAB19", "val1" => "Technology & Computing"),
|
82 |
+
array("val0" => "IAB20", "val1" => "Travel"),
|
83 |
+
array("val0" => "IAB21", "val1" => "Real Estate"),
|
84 |
+
array("val0" => "IAB22", "val1" => "Shopping"),
|
85 |
+
array("val0" => "IAB23", "val1" => "Religion & Spirituality"),
|
86 |
+
array("val0" => "IAB24", "val1" => "Uncategorized"),
|
87 |
+
array("val0" => "IAB26", "val1" => "Illegal Content"),
|
88 |
+
|
89 |
+
);
|
90 |
+
|
91 |
+
// Change the array to one nested level
|
92 |
+
$optionsNew = array();
|
93 |
+
foreach ($iab_options as $key => $value) {
|
94 |
+
$optionsNew[$value['val0']] = $value['val1'];
|
95 |
+
}
|
96 |
+
|
97 |
+
$element = new Select(
|
98 |
+
"quads_vi_ads[ads][1][iab1]", $optionsNew, array(
|
99 |
+
"class" => "large-text",
|
100 |
+
"step" => 1,
|
101 |
+
"max" => 999999,
|
102 |
+
"min" => 0
|
103 |
+
)
|
104 |
+
);
|
105 |
+
|
106 |
+
$this->form->add(
|
107 |
+
$element->setLabel("IAB Category*")->setDefault(isset($settings->iab1) ? $settings->iab1 : 'select')
|
108 |
+
);
|
109 |
+
|
110 |
+
// iAB tier 2 category
|
111 |
+
$iab2_options = array(
|
112 |
+
array("val0" => "select", "val1" => "Select tier 2 category"),
|
113 |
+
array("val0" => "IAB1-1", "val1" => "Books & Literature"),
|
114 |
+
array("val0" => "IAB1-2", "val1" => "Celebrity Fan/Gossip"),
|
115 |
+
array("val0" => "IAB1-3", "val1" => "Fine Art"),
|
116 |
+
array("val0" => "IAB1-4", "val1" => "Humor"),
|
117 |
+
array("val0" => "IAB1-5", "val1" => "Movies"),
|
118 |
+
array("val0" => "IAB1-6", "val1" => "Music"),
|
119 |
+
array("val0" => "IAB1-7", "val1" => "Television"),
|
120 |
+
array("val0" => "IAB2-1", "val1" => "Auto Parts"),
|
121 |
+
array("val0" => "IAB2-2", "val1" => "Auto Repair"),
|
122 |
+
array("val0" => "IAB2-3", "val1" => "Buying/Selling Cars"),
|
123 |
+
array("val0" => "IAB2-4", "val1" => "Car Culture"),
|
124 |
+
array("val0" => "IAB2-5", "val1" => "Certified Pre-Owned"),
|
125 |
+
array("val0" => "IAB2-6", "val1" => "Convertible"),
|
126 |
+
array("val0" => "IAB2-7", "val1" => "Coupe"),
|
127 |
+
array("val0" => "IAB2-8", "val1" => "Crossover"),
|
128 |
+
array("val0" => "IAB2-9", "val1" => "Diesel"),
|
129 |
+
array("val0" => "IAB2-10", "val1" => "Electric Vehicle"),
|
130 |
+
array("val0" => "IAB2-11", "val1" => "Hatchback"),
|
131 |
+
array("val0" => "IAB2-12", "val1" => "Hybrid"),
|
132 |
+
array("val0" => "IAB2-13", "val1" => "Luxury"),
|
133 |
+
array("val0" => "IAB2-14", "val1" => "MiniVan"),
|
134 |
+
array("val0" => "IAB2-15", "val1" => "Mororcycles"),
|
135 |
+
array("val0" => "IAB2-16", "val1" => "Off-Road Vehicles"),
|
136 |
+
array("val0" => "IAB2-17", "val1" => "Performance Vehicles"),
|
137 |
+
array("val0" => "IAB2-18", "val1" => "Pickup"),
|
138 |
+
array("val0" => "IAB2-19", "val1" => "Road-Side Assistance"),
|
139 |
+
array("val0" => "IAB2-20", "val1" => "Sedan"),
|
140 |
+
array("val0" => "IAB2-21", "val1" => "Trucks & Accessories"),
|
141 |
+
array("val0" => "IAB2-22", "val1" => "Vintage Cars"),
|
142 |
+
array("val0" => "IAB2-23", "val1" => "Wagon"),
|
143 |
+
array("val0" => "IAB3-1", "val1" => "Advertising"),
|
144 |
+
array("val0" => "IAB3-2", "val1" => "Agriculture"),
|
145 |
+
array("val0" => "IAB3-3", "val1" => "Biotech/Biomedical"),
|
146 |
+
array("val0" => "IAB3-4", "val1" => "Business Software"),
|
147 |
+
array("val0" => "IAB3-5", "val1" => "Construction"),
|
148 |
+
array("val0" => "IAB3-6", "val1" => "Forestry"),
|
149 |
+
array("val0" => "IAB3-7", "val1" => "Government"),
|
150 |
+
array("val0" => "IAB3-8", "val1" => "Green Solutions"),
|
151 |
+
array("val0" => "IAB3-9", "val1" => "Human Resources"),
|
152 |
+
array("val0" => "IAB3-10", "val1" => "Logistics"),
|
153 |
+
array("val0" => "IAB3-11", "val1" => "Marketing"),
|
154 |
+
array("val0" => "IAB3-12", "val1" => "Metals"),
|
155 |
+
array("val0" => "IAB4-1", "val1" => "Career Planning"),
|
156 |
+
array("val0" => "IAB4-2", "val1" => "College"),
|
157 |
+
array("val0" => "IAB4-3", "val1" => "Financial Aid"),
|
158 |
+
array("val0" => "IAB4-4", "val1" => "Job Fairs"),
|
159 |
+
array("val0" => "IAB4-5", "val1" => "Job Search"),
|
160 |
+
array("val0" => "IAB4-6", "val1" => "Resume Writing/Advice"),
|
161 |
+
array("val0" => "IAB4-7", "val1" => "Nursing"),
|
162 |
+
array("val0" => "IAB4-8", "val1" => "Scholarships"),
|
163 |
+
array("val0" => "IAB4-9", "val1" => "Telecommuting"),
|
164 |
+
array("val0" => "IAB4-10", "val1" => "U.S. Military"),
|
165 |
+
array("val0" => "IAB4-11", "val1" => "Career Advice"),
|
166 |
+
array("val0" => "IAB5-1", "val1" => "7-12 Education"),
|
167 |
+
array("val0" => "IAB5-2", "val1" => "Adult Education"),
|
168 |
+
array("val0" => "IAB5-3", "val1" => "Art History"),
|
169 |
+
array("val0" => "IAB5-4", "val1" => "Colledge Administration"),
|
170 |
+
array("val0" => "IAB5-5", "val1" => "College Life"),
|
171 |
+
array("val0" => "IAB5-6", "val1" => "Distance Learning"),
|
172 |
+
array("val0" => "IAB5-7", "val1" => "English as a 2nd Language"),
|
173 |
+
array("val0" => "IAB5-8", "val1" => "Language Learning"),
|
174 |
+
array("val0" => "IAB5-9", "val1" => "Graduate School"),
|
175 |
+
array("val0" => "IAB5-10", "val1" => "Homeschooling"),
|
176 |
+
array("val0" => "IAB5-11", "val1" => "Homework/Study Tips"),
|
177 |
+
array("val0" => "IAB5-12", "val1" => "K-6 Educators"),
|
178 |
+
array("val0" => "IAB5-13", "val1" => "Private School"),
|
179 |
+
array("val0" => "IAB5-14", "val1" => "Special Education"),
|
180 |
+
array("val0" => "IAB5-15", "val1" => "Studying Business"),
|
181 |
+
array("val0" => "IAB6-1", "val1" => "Adoption"),
|
182 |
+
array("val0" => "IAB6-2", "val1" => "Babies & Toddlers"),
|
183 |
+
array("val0" => "IAB6-3", "val1" => "Daycare/Pre School"),
|
184 |
+
array("val0" => "IAB6-4", "val1" => "Family Internet"),
|
185 |
+
array("val0" => "IAB6-5", "val1" => "Parenting – K-6 Kids"),
|
186 |
+
array("val0" => "IAB6-6", "val1" => "Parenting teens"),
|
187 |
+
array("val0" => "IAB6-7", "val1" => "Pregnancy"),
|
188 |
+
array("val0" => "IAB6-8", "val1" => "Special Needs Kids"),
|
189 |
+
array("val0" => "IAB6-9", "val1" => "Eldercare"),
|
190 |
+
array("val0" => "IAB7-1", "val1" => "Exercise"),
|
191 |
+
array("val0" => "IAB7-2", "val1" => "A.D.D."),
|
192 |
+
array("val0" => "IAB7-3", "val1" => "AIDS/HIV"),
|
193 |
+
array("val0" => "IAB7-4", "val1" => "Allergies"),
|
194 |
+
array("val0" => "IAB7-5", "val1" => "Alternative Medicine"),
|
195 |
+
array("val0" => "IAB7-6", "val1" => "Arthritis"),
|
196 |
+
array("val0" => "IAB7-7", "val1" => "Asthma"),
|
197 |
+
array("val0" => "IAB7-8", "val1" => "Autism/PDD"),
|
198 |
+
array("val0" => "IAB7-9", "val1" => "Bipolar Disorder"),
|
199 |
+
array("val0" => "IAB7-10", "val1" => "Brain Tumor"),
|
200 |
+
array("val0" => "IAB7-11", "val1" => "Cancer"),
|
201 |
+
array("val0" => "IAB7-12", "val1" => "Cholesterol"),
|
202 |
+
array("val0" => "IAB7-13", "val1" => "Chronic Fatigue Syndrome"),
|
203 |
+
array("val0" => "IAB7-14", "val1" => "Chronic Pain"),
|
204 |
+
array("val0" => "IAB7-15", "val1" => "Cold & Flu"),
|
205 |
+
array("val0" => "IAB7-16", "val1" => "Deafness"),
|
206 |
+
array("val0" => "IAB7-17", "val1" => "Dental Care"),
|
207 |
+
array("val0" => "IAB7-18", "val1" => "Depression"),
|
208 |
+
array("val0" => "IAB7-19", "val1" => "Dermatology"),
|
209 |
+
array("val0" => "IAB7-20", "val1" => "Diabetes"),
|
210 |
+
array("val0" => "IAB7-21", "val1" => "Epilepsy"),
|
211 |
+
array("val0" => "IAB7-22", "val1" => "GERD/Acid Reflux"),
|
212 |
+
array("val0" => "IAB7-23", "val1" => "Headaches/Migraines"),
|
213 |
+
array("val0" => "IAB7-24", "val1" => "Heart Disease"),
|
214 |
+
array("val0" => "IAB7-25", "val1" => "Herbs for Health"),
|
215 |
+
array("val0" => "IAB7-26", "val1" => "Holistic Healing"),
|
216 |
+
array("val0" => "IAB7-27", "val1" => "IBS/Crohn’s Disease"),
|
217 |
+
array("val0" => "IAB7-28", "val1" => "Incest/Abuse Support"),
|
218 |
+
array("val0" => "IAB7-29", "val1" => "Incontinence"),
|
219 |
+
array("val0" => "IAB7-30", "val1" => "Infertility"),
|
220 |
+
array("val0" => "IAB7-31", "val1" => "Men’s Health"),
|
221 |
+
array("val0" => "IAB7-32", "val1" => "Nutrition"),
|
222 |
+
array("val0" => "IAB7-33", "val1" => "Orthopedics"),
|
223 |
+
array("val0" => "IAB7-34", "val1" => "Panic/Anxiety Disorders"),
|
224 |
+
array("val0" => "IAB7-35", "val1" => "Pediatrics"),
|
225 |
+
array("val0" => "IAB7-36", "val1" => "Physical Therapy"),
|
226 |
+
array("val0" => "IAB7-37", "val1" => "Psychology/Psychiatry"),
|
227 |
+
array("val0" => "IAB7-38", "val1" => "Senor Health"),
|
228 |
+
array("val0" => "IAB7-39", "val1" => "Sexuality"),
|
229 |
+
array("val0" => "IAB7-40", "val1" => "Sleep Disorders"),
|
230 |
+
array("val0" => "IAB7-41", "val1" => "Smoking Cessation"),
|
231 |
+
array("val0" => "IAB7-42", "val1" => "Substance Abuse"),
|
232 |
+
array("val0" => "IAB7-43", "val1" => "Thyroid Disease"),
|
233 |
+
array("val0" => "IAB7-44", "val1" => "Weight Loss"),
|
234 |
+
array("val0" => "IAB7-45", "val1" => "Women’s Health"),
|
235 |
+
array("val0" => "IAB8-1", "val1" => "American Cuisine"),
|
236 |
+
array("val0" => "IAB8-2", "val1" => "Barbecues & Grilling"),
|
237 |
+
array("val0" => "IAB8-3", "val1" => "Cajun/Creole"),
|
238 |
+
array("val0" => "IAB8-4", "val1" => "Chinese Cuisine"),
|
239 |
+
array("val0" => "IAB8-5", "val1" => "Cocktails/Beer"),
|
240 |
+
array("val0" => "IAB8-6", "val1" => "Coffee/Tea"),
|
241 |
+
array("val0" => "IAB8-7", "val1" => "Cuisine-Specific"),
|
242 |
+
array("val0" => "IAB8-8", "val1" => "Desserts & Baking"),
|
243 |
+
array("val0" => "IAB8-9", "val1" => "Dining Out"),
|
244 |
+
array("val0" => "IAB8-10", "val1" => "Food Allergies"),
|
245 |
+
array("val0" => "IAB8-11", "val1" => "French Cuisine"),
|
246 |
+
array("val0" => "IAB8-12", "val1" => "Health/Lowfat Cooking"),
|
247 |
+
array("val0" => "IAB8-13", "val1" => "Italian Cuisine"),
|
248 |
+
array("val0" => "IAB8-14", "val1" => "Japanese Cuisine"),
|
249 |
+
array("val0" => "IAB8-15", "val1" => "Mexican Cuisine"),
|
250 |
+
array("val0" => "IAB8-16", "val1" => "Vegan"),
|
251 |
+
array("val0" => "IAB8-17", "val1" => "Vegetarian"),
|
252 |
+
array("val0" => "IAB8-18", "val1" => "Wine"),
|
253 |
+
array("val0" => "IAB9-1", "val1" => "Art/Technology"),
|
254 |
+
array("val0" => "IAB9-2", "val1" => "Arts & Crafts"),
|
255 |
+
array("val0" => "IAB9-3", "val1" => "Beadwork"),
|
256 |
+
array("val0" => "IAB9-4", "val1" => "Birdwatching"),
|
257 |
+
array("val0" => "IAB9-5", "val1" => "Board Games/Puzzles"),
|
258 |
+
array("val0" => "IAB9-6", "val1" => "Candle & Soap Making"),
|
259 |
+
array("val0" => "IAB9-7", "val1" => "Card Games"),
|
260 |
+
array("val0" => "IAB9-8", "val1" => "Chess"),
|
261 |
+
array("val0" => "IAB9-9", "val1" => "Cigars"),
|
262 |
+
array("val0" => "IAB9-10", "val1" => "Collecting"),
|
263 |
+
array("val0" => "IAB9-11", "val1" => "Comic Books"),
|
264 |
+
array("val0" => "IAB9-12", "val1" => "Drawing/Sketching"),
|
265 |
+
array("val0" => "IAB9-13", "val1" => "Freelance Writing"),
|
266 |
+
array("val0" => "IAB9-14", "val1" => "Genealogy"),
|
267 |
+
array("val0" => "IAB9-15", "val1" => "Getting Published"),
|
268 |
+
array("val0" => "IAB9-16", "val1" => "Guitar"),
|
269 |
+
array("val0" => "IAB9-17", "val1" => "Home Recording"),
|
270 |
+
array("val0" => "IAB9-18", "val1" => "Investors & Patents"),
|
271 |
+
array("val0" => "IAB9-19", "val1" => "Jewelry Making"),
|
272 |
+
array("val0" => "IAB9-20", "val1" => "Magic & Illusion"),
|
273 |
+
array("val0" => "IAB9-21", "val1" => "Needlework"),
|
274 |
+
array("val0" => "IAB9-22", "val1" => "Painting"),
|
275 |
+
array("val0" => "IAB9-23", "val1" => "Photography"),
|
276 |
+
array("val0" => "IAB9-24", "val1" => "Radio"),
|
277 |
+
array("val0" => "IAB9-25", "val1" => "Roleplaying Games"),
|
278 |
+
array("val0" => "IAB9-26", "val1" => "Sci-Fi & Fantasy"),
|
279 |
+
array("val0" => "IAB9-27", "val1" => "Scrapbooking"),
|
280 |
+
array("val0" => "IAB9-28", "val1" => "Screenwriting"),
|
281 |
+
array("val0" => "IAB9-29", "val1" => "Stamps & Coins"),
|
282 |
+
array("val0" => "IAB9-30", "val1" => "Video & Computer Games"),
|
283 |
+
array("val0" => "IAB9-31", "val1" => "Woodworking"),
|
284 |
+
array("val0" => "IAB10-1", "val1" => "Appliances"),
|
285 |
+
array("val0" => "IAB10-2", "val1" => "Entertaining"),
|
286 |
+
array("val0" => "IAB10-3", "val1" => "Environmental Safety"),
|
287 |
+
array("val0" => "IAB10-4", "val1" => "Gardening"),
|
288 |
+
array("val0" => "IAB10-5", "val1" => "Home Repair"),
|
289 |
+
array("val0" => "IAB10-6", "val1" => "Home Theater"),
|
290 |
+
array("val0" => "IAB10-7", "val1" => "Interior Decorating"),
|
291 |
+
array("val0" => "IAB10-8", "val1" => "Landscaping"),
|
292 |
+
array("val0" => "IAB10-9", "val1" => "Remodeling & Construction"),
|
293 |
+
array("val0" => "IAB11-1", "val1" => "Immigration"),
|
294 |
+
array("val0" => "IAB11-2", "val1" => "Legal Issues"),
|
295 |
+
array("val0" => "IAB11-3", "val1" => "U.S. Government Resources"),
|
296 |
+
array("val0" => "IAB11-4", "val1" => "Politics"),
|
297 |
+
array("val0" => "IAB11-5", "val1" => "Commentary"),
|
298 |
+
array("val0" => "IAB12-1", "val1" => "International News"),
|
299 |
+
array("val0" => "IAB12-2", "val1" => "National News"),
|
300 |
+
array("val0" => "IAB12-3", "val1" => "Local News"),
|
301 |
+
array("val0" => "IAB13-1", "val1" => "Beginning Investing"),
|
302 |
+
array("val0" => "IAB13-2", "val1" => "Credit/Debt & Loans"),
|
303 |
+
array("val0" => "IAB13-3", "val1" => "Financial News"),
|
304 |
+
array("val0" => "IAB13-4", "val1" => "Financial Planning"),
|
305 |
+
array("val0" => "IAB13-5", "val1" => "Hedge Fund"),
|
306 |
+
array("val0" => "IAB13-6", "val1" => "Insurance"),
|
307 |
+
array("val0" => "IAB13-7", "val1" => "Investing"),
|
308 |
+
array("val0" => "IAB13-8", "val1" => "Mutual Funds"),
|
309 |
+
array("val0" => "IAB13-9", "val1" => "Options"),
|
310 |
+
array("val0" => "IAB13-10", "val1" => "Retirement Planning"),
|
311 |
+
array("val0" => "IAB13-11", "val1" => "Stocks"),
|
312 |
+
array("val0" => "IAB13-12", "val1" => "Tax Planning"),
|
313 |
+
array("val0" => "IAB14-1", "val1" => "Dating"),
|
314 |
+
array("val0" => "IAB14-2", "val1" => "Divorce Support"),
|
315 |
+
array("val0" => "IAB14-3", "val1" => "Gay Life"),
|
316 |
+
array("val0" => "IAB14-4", "val1" => "Marriage"),
|
317 |
+
array("val0" => "IAB14-5", "val1" => "Senior Living"),
|
318 |
+
array("val0" => "IAB14-6", "val1" => "Teens"),
|
319 |
+
array("val0" => "IAB14-7", "val1" => "Weddings"),
|
320 |
+
array("val0" => "IAB14-8", "val1" => "Ethnic Specific"),
|
321 |
+
array("val0" => "IAB15-1", "val1" => "Astrology"),
|
322 |
+
array("val0" => "IAB15-2", "val1" => "Biology"),
|
323 |
+
array("val0" => "IAB15-3", "val1" => "Chemistry"),
|
324 |
+
array("val0" => "IAB15-4", "val1" => "Geology"),
|
325 |
+
array("val0" => "IAB15-5", "val1" => "Paranormal Phenomena"),
|
326 |
+
array("val0" => "IAB15-6", "val1" => "Physics"),
|
327 |
+
array("val0" => "IAB15-7", "val1" => "Space/Astronomy"),
|
328 |
+
array("val0" => "IAB15-8", "val1" => "Geography"),
|
329 |
+
array("val0" => "IAB15-9", "val1" => "Botany"),
|
330 |
+
array("val0" => "IAB15-10", "val1" => "Weather"),
|
331 |
+
array("val0" => "IAB16-1", "val1" => "Aquariums"),
|
332 |
+
array("val0" => "IAB16-2", "val1" => "Birds"),
|
333 |
+
array("val0" => "IAB16-3", "val1" => "Cats"),
|
334 |
+
array("val0" => "IAB16-4", "val1" => "Dogs"),
|
335 |
+
array("val0" => "IAB16-5", "val1" => "Large Animals"),
|
336 |
+
array("val0" => "IAB16-6", "val1" => "Reptiles"),
|
337 |
+
array("val0" => "IAB16-7", "val1" => "Veterinary Medicine"),
|
338 |
+
array("val0" => "IAB17-1", "val1" => "Auto Racing"),
|
339 |
+
array("val0" => "IAB17-2", "val1" => "Baseball"),
|
340 |
+
array("val0" => "IAB17-3", "val1" => "Bicycling"),
|
341 |
+
array("val0" => "IAB17-4", "val1" => "Bodybuilding"),
|
342 |
+
array("val0" => "IAB17-5", "val1" => "Boxing"),
|
343 |
+
array("val0" => "IAB17-6", "val1" => "Canoeing/Kayaking"),
|
344 |
+
array("val0" => "IAB17-7", "val1" => "Cheerleading"),
|
345 |
+
array("val0" => "IAB17-8", "val1" => "Climbing"),
|
346 |
+
array("val0" => "IAB17-9", "val1" => "Cricket"),
|
347 |
+
array("val0" => "IAB17-10", "val1" => "Figure Skating"),
|
348 |
+
array("val0" => "IAB17-11", "val1" => "Fly Fishing"),
|
349 |
+
array("val0" => "IAB17-12", "val1" => "Football"),
|
350 |
+
array("val0" => "IAB17-13", "val1" => "Freshwater Fishing"),
|
351 |
+
array("val0" => "IAB17-14", "val1" => "Game & Fish"),
|
352 |
+
array("val0" => "IAB17-15", "val1" => "Golf"),
|
353 |
+
array("val0" => "IAB17-16", "val1" => "Horse Racing"),
|
354 |
+
array("val0" => "IAB17-17", "val1" => "Horses"),
|
355 |
+
array("val0" => "IAB17-18", "val1" => "Hunting/Shooting"),
|
356 |
+
array("val0" => "IAB17-19", "val1" => "Inline Skating"),
|
357 |
+
array("val0" => "IAB17-20", "val1" => "Martial Arts"),
|
358 |
+
array("val0" => "IAB17-21", "val1" => "Mountain Biking"),
|
359 |
+
array("val0" => "IAB17-22", "val1" => "NASCAR Racing"),
|
360 |
+
array("val0" => "IAB17-23", "val1" => "Olympics"),
|
361 |
+
array("val0" => "IAB17-24", "val1" => "Paintball"),
|
362 |
+
array("val0" => "IAB17-25", "val1" => "Power & Motorcycles"),
|
363 |
+
array("val0" => "IAB17-26", "val1" => "Pro Basketball"),
|
364 |
+
array("val0" => "IAB17-27", "val1" => "Pro Ice Hockey"),
|
365 |
+
array("val0" => "IAB17-28", "val1" => "Rodeo"),
|
366 |
+
array("val0" => "IAB17-29", "val1" => "Rugby"),
|
367 |
+
array("val0" => "IAB17-30", "val1" => "Running/Jogging"),
|
368 |
+
array("val0" => "IAB17-31", "val1" => "Sailing"),
|
369 |
+
array("val0" => "IAB17-32", "val1" => "Saltwater Fishing"),
|
370 |
+
array("val0" => "IAB17-33", "val1" => "Scuba Diving"),
|
371 |
+
array("val0" => "IAB17-34", "val1" => "Skateboarding"),
|
372 |
+
array("val0" => "IAB17-35", "val1" => "Skiing"),
|
373 |
+
array("val0" => "IAB17-36", "val1" => "Snowboarding"),
|
374 |
+
array("val0" => "IAB17-37", "val1" => "Surfing/Bodyboarding"),
|
375 |
+
array("val0" => "IAB17-38", "val1" => "Swimming"),
|
376 |
+
array("val0" => "IAB17-39", "val1" => "Table Tennis/Ping-Pong"),
|
377 |
+
array("val0" => "IAB17-40", "val1" => "Tennis"),
|
378 |
+
array("val0" => "IAB17-41", "val1" => "Volleyball"),
|
379 |
+
array("val0" => "IAB17-42", "val1" => "Walking"),
|
380 |
+
array("val0" => "IAB17-43", "val1" => "Waterski/Wakeboard"),
|
381 |
+
array("val0" => "IAB17-44", "val1" => "World Soccer"),
|
382 |
+
array("val0" => "IAB18-1", "val1" => "Beauty"),
|
383 |
+
array("val0" => "IAB18-2", "val1" => "Body Art"),
|
384 |
+
array("val0" => "IAB18-3", "val1" => "Fashion"),
|
385 |
+
array("val0" => "IAB18-4", "val1" => "Jewelry"),
|
386 |
+
array("val0" => "IAB18-5", "val1" => "Clothing"),
|
387 |
+
array("val0" => "IAB18-6", "val1" => "Accessories"),
|
388 |
+
array("val0" => "IAB19-1", "val1" => "3-D Graphics"),
|
389 |
+
array("val0" => "IAB19-2", "val1" => "Animation"),
|
390 |
+
array("val0" => "IAB19-3", "val1" => "Antivirus Software"),
|
391 |
+
array("val0" => "IAB19-4", "val1" => "C/C++"),
|
392 |
+
array("val0" => "IAB19-5", "val1" => "Cameras & Camcorders"),
|
393 |
+
array("val0" => "IAB19-6", "val1" => "Cell Phones"),
|
394 |
+
array("val0" => "IAB19-7", "val1" => "Computer Certification"),
|
395 |
+
array("val0" => "IAB19-8", "val1" => "Computer Networking"),
|
396 |
+
array("val0" => "IAB19-9", "val1" => "Computer Peripherals"),
|
397 |
+
array("val0" => "IAB19-10", "val1" => "Computer Reviews"),
|
398 |
+
array("val0" => "IAB19-11", "val1" => "Data Centers"),
|
399 |
+
array("val0" => "IAB19-12", "val1" => "Databases"),
|
400 |
+
array("val0" => "IAB19-13", "val1" => "Desktop Publishing"),
|
401 |
+
array("val0" => "IAB19-14", "val1" => "Desktop Video"),
|
402 |
+
array("val0" => "IAB19-15", "val1" => "Email"),
|
403 |
+
array("val0" => "IAB19-16", "val1" => "Graphics Software"),
|
404 |
+
array("val0" => "IAB19-17", "val1" => "Home Video/DVD"),
|
405 |
+
array("val0" => "IAB19-18", "val1" => "Internet Technology"),
|
406 |
+
array("val0" => "IAB19-19", "val1" => "Java"),
|
407 |
+
array("val0" => "IAB19-20", "val1" => "JavaScript"),
|
408 |
+
array("val0" => "IAB19-21", "val1" => "Mac Support"),
|
409 |
+
array("val0" => "IAB19-22", "val1" => "MP3/MIDI"),
|
410 |
+
array("val0" => "IAB19-23", "val1" => "Net Conferencing"),
|
411 |
+
array("val0" => "IAB19-24", "val1" => "Net for Beginners"),
|
412 |
+
array("val0" => "IAB19-25", "val1" => "Network Security"),
|
413 |
+
array("val0" => "IAB19-26", "val1" => "Palmtops/PDAs"),
|
414 |
+
array("val0" => "IAB19-27", "val1" => "PC Support"),
|
415 |
+
array("val0" => "IAB19-28", "val1" => "Portable"),
|
416 |
+
array("val0" => "IAB19-29", "val1" => "Entertainment"),
|
417 |
+
array("val0" => "IAB19-30", "val1" => "Shareware/Freeware"),
|
418 |
+
array("val0" => "IAB19-31", "val1" => "Unix"),
|
419 |
+
array("val0" => "IAB19-32", "val1" => "Visual Basic"),
|
420 |
+
array("val0" => "IAB19-33", "val1" => "Web Clip Art"),
|
421 |
+
array("val0" => "IAB19-34", "val1" => "Web Design/HTML"),
|
422 |
+
array("val0" => "IAB19-35", "val1" => "Web Search"),
|
423 |
+
array("val0" => "IAB19-36", "val1" => "Windows"),
|
424 |
+
array("val0" => "IAB20-1", "val1" => "Adventure Travel"),
|
425 |
+
array("val0" => "IAB20-2", "val1" => "Africa"),
|
426 |
+
array("val0" => "IAB20-3", "val1" => "Air Travel"),
|
427 |
+
array("val0" => "IAB20-4", "val1" => "Australia & New Zealand"),
|
428 |
+
array("val0" => "IAB20-5", "val1" => "Bed & Breakfasts"),
|
429 |
+
array("val0" => "IAB20-6", "val1" => "Budget Travel"),
|
430 |
+
array("val0" => "IAB20-7", "val1" => "Business Travel"),
|
431 |
+
array("val0" => "IAB20-8", "val1" => "By US Locale"),
|
432 |
+
array("val0" => "IAB20-9", "val1" => "Camping"),
|
433 |
+
array("val0" => "IAB20-10", "val1" => "Canada"),
|
434 |
+
array("val0" => "IAB20-11", "val1" => "Caribbean"),
|
435 |
+
array("val0" => "IAB20-12", "val1" => "Cruises"),
|
436 |
+
array("val0" => "IAB20-13", "val1" => "Eastern Europe"),
|
437 |
+
array("val0" => "IAB20-14", "val1" => "Europe"),
|
438 |
+
array("val0" => "IAB20-15", "val1" => "France"),
|
439 |
+
array("val0" => "IAB20-16", "val1" => "Greece"),
|
440 |
+
array("val0" => "IAB20-17", "val1" => "Honeymoons/Getaways"),
|
441 |
+
array("val0" => "IAB20-18", "val1" => "Hotels"),
|
442 |
+
array("val0" => "IAB20-19", "val1" => "Italy"),
|
443 |
+
array("val0" => "IAB20-20", "val1" => "Japan"),
|
444 |
+
array("val0" => "IAB20-21", "val1" => "Mexico & Central America"),
|
445 |
+
array("val0" => "IAB20-22", "val1" => "National Parks"),
|
446 |
+
array("val0" => "IAB20-23", "val1" => "South America"),
|
447 |
+
array("val0" => "IAB20-24", "val1" => "Spas"),
|
448 |
+
array("val0" => "IAB20-25", "val1" => "Theme Parks"),
|
449 |
+
array("val0" => "IAB20-26", "val1" => "Traveling with Kids"),
|
450 |
+
array("val0" => "IAB20-27", "val1" => "United Kingdom"),
|
451 |
+
array("val0" => "IAB21-1", "val1" => "Apartments"),
|
452 |
+
array("val0" => "IAB21-2", "val1" => "Architects"),
|
453 |
+
array("val0" => "IAB21-3", "val1" => "Buying/Selling Homes"),
|
454 |
+
array("val0" => "IAB22-1", "val1" => "Contests & Freebies"),
|
455 |
+
array("val0" => "IAB22-2", "val1" => "Couponing"),
|
456 |
+
array("val0" => "IAB22-3", "val1" => "Comparison"),
|
457 |
+
array("val0" => "IAB22-4", "val1" => "Engines"),
|
458 |
+
array("val0" => "IAB23-1", "val1" => "Alternative Religions"),
|
459 |
+
array("val0" => "IAB23-2", "val1" => "Atheism/Agnosticism"),
|
460 |
+
array("val0" => "IAB23-3", "val1" => "Buddhism"),
|
461 |
+
array("val0" => "IAB23-4", "val1" => "Catholicism"),
|
462 |
+
array("val0" => "IAB23-5", "val1" => "Christianity"),
|
463 |
+
array("val0" => "IAB23-6", "val1" => "Hinduism"),
|
464 |
+
array("val0" => "IAB23-7", "val1" => "Islam"),
|
465 |
+
array("val0" => "IAB23-8", "val1" => "Judaism"),
|
466 |
+
array("val0" => "IAB23-9", "val1" => "Latter-Day Saints"),
|
467 |
+
array("val0" => "IAB23-10", "val1" => "Pagan/Wiccan"),
|
468 |
+
array("val0" => "IAB25", "val1" => "Non-Standard Content"),
|
469 |
+
array("val0" => "IAB25-1", "val1" => "Unmoderated UGC"),
|
470 |
+
array("val0" => "IAB25-2", "val1" => "Extreme Graphic/Explicit Violence"),
|
471 |
+
array("val0" => "IAB25-3", "val1" => "Pornography"),
|
472 |
+
array("val0" => "IAB25-4", "val1" => "Profane Content"),
|
473 |
+
array("val0" => "IAB25-5", "val1" => "Hate Content"),
|
474 |
+
array("val0" => "IAB25-6", "val1" => "Under Construction"),
|
475 |
+
array("val0" => "IAB25-7", "val1" => "Incentivized"),
|
476 |
+
array("val0" => "IAB26-1", "val1" => "Illegal Content"),
|
477 |
+
array("val0" => "IAB26-2", "val1" => "Warez"),
|
478 |
+
array("val0" => "IAB26-3", "val1" => "Spyware/Malware"),
|
479 |
+
array("val0" => "IAB26-4", "val1" => "Copyright Infringement")
|
480 |
+
);
|
481 |
+
|
482 |
+
// Change the array to one nested level
|
483 |
+
$iab2New = array();
|
484 |
+
foreach ($iab2_options as $key => $value) {
|
485 |
+
$iab2New[$value['val0']] = $value['val1'];
|
486 |
+
}
|
487 |
+
|
488 |
+
$element = new Select(
|
489 |
+
"quads_vi_ads[ads][1][iab2]", $iab2New, array(
|
490 |
+
"class" => "large-text"
|
491 |
+
)
|
492 |
+
);
|
493 |
+
|
494 |
+
$this->form->add(
|
495 |
+
$element->setLabel("IAB Category Tier2 *")->setDefault(isset($settings->iab2) ? $settings->iab2 : 'select')
|
496 |
+
);
|
497 |
+
|
498 |
+
$options = $this->vi->getLanguages();
|
499 |
+
|
500 |
+
// language
|
501 |
+
$element = new Select('quads_vi_ads[ads][1][language]', $options);
|
502 |
+
$this->form->add(
|
503 |
+
$element->setLabel("Language")->setDefault(isset($settings->language) ? $settings->language : '')
|
504 |
+
);
|
505 |
+
|
506 |
+
|
507 |
+
// bg_color
|
508 |
+
$element = new Text('quads_vi_ads[ads][1][bg_color]', array("class" => "jscolor"), array());
|
509 |
+
$this->form->add(
|
510 |
+
$element->setLabel("Background Color")->setDefault(isset($settings->bg_color) ? $settings->bg_color : '')
|
511 |
+
);
|
512 |
+
// text_color
|
513 |
+
$element = new Text('quads_vi_ads[ads][1][text_color]', array("class" => "jscolor"), array());
|
514 |
+
$this->form->add(
|
515 |
+
$element->setLabel("Text Color")->setDefault(isset($settings->text_color) ? $settings->text_color : '')
|
516 |
+
);
|
517 |
+
// txt_font_family
|
518 |
+
$element = new Select('quads_vi_ads[ads][1][txt_font_family]', $this->vi->getFontFamily(), array() );
|
519 |
+
$this->form->add(
|
520 |
+
$element->setLabel("Text Font Family")->setDefault(isset($settings->txt_font_family) ? $settings->txt_font_family : '')
|
521 |
+
);
|
522 |
+
// font_size
|
523 |
+
$element = new Numerical('quads_vi_ads[ads][1][font_size]', array());
|
524 |
+
$this->form->add(
|
525 |
+
$element->setLabel("Text Font Size")->setDefault(isset($settings->font_size) ? $settings->font_size : 12)
|
526 |
+
);
|
527 |
+
// optional1
|
528 |
+
$element = new Text('quads_vi_ads[ads][1][optional1]', array());
|
529 |
+
$this->form->add(
|
530 |
+
$element->setLabel("Optional 1")->setDefault(isset($settings->optional1) ? $settings->optional1 : '')
|
531 |
+
);
|
532 |
+
// optional3
|
533 |
+
$element = new Text('quads_vi_ads[ads][1][optional2]', array());
|
534 |
+
$this->form->add(
|
535 |
+
$element->setLabel("Optional 2")->setDefault(isset($settings->optional2) ? $settings->optional2 : '')
|
536 |
+
);
|
537 |
+
// optional3
|
538 |
+
$element = new Text('quads_vi_ads[ads][1][optional3]', array());
|
539 |
+
$this->form->add(
|
540 |
+
$element->setLabel("Optional 3")->setDefault(isset($settings->optional3) ? $settings->optional3 : '')
|
541 |
+
);
|
542 |
+
|
543 |
+
// ad code
|
544 |
+
$element = new TextAreaHidden('quads_vi_ads[ads][1][code]', array());
|
545 |
+
$this->form->add(
|
546 |
+
$element->setLabel("Ad Code")->setDefault(isset($settings->code) ? $settings->code : '')
|
547 |
+
);
|
548 |
+
|
549 |
+
|
550 |
+
|
551 |
+
// Layout
|
552 |
+
$element = new Radio('quads_vi_ads[ads][1][align]', array('default' => 'default', 'left' => 'left', 'middle' => 'middle', 'right' => 'right'));
|
553 |
+
$this->form->add(
|
554 |
+
$element->setLabel("align")->setDefault(isset($settings->align) ? $settings->align : '')
|
555 |
+
);
|
556 |
+
|
557 |
+
|
558 |
+
|
559 |
+
// Position
|
560 |
+
$options = array(
|
561 |
+
'notShown' => 'Do not show vi ad',
|
562 |
+
'abovePost' => 'Above Content',
|
563 |
+
'middlePost' => 'Middle of Content',
|
564 |
+
'belowPost' => 'Below of Content'
|
565 |
+
);
|
566 |
+
|
567 |
+
$element = new Select('quads_vi_ads[ads][1][position]', $options);
|
568 |
+
$this->form->add(
|
569 |
+
$element->setLabel("Position")->setDefault(isset($settings->position) ? $settings->position : 'abovePost')
|
570 |
+
);
|
571 |
+
|
572 |
+
// Condition Post Types
|
573 |
+
$options = array_merge (array('noPostTypes' => 'Exclude nothing'), get_post_types());
|
574 |
+
|
575 |
+
$element = new SelectMultiple('quads_vi_ads[ads][1][excludedPostTypes]', $options);
|
576 |
+
$this->form->add(
|
577 |
+
$element->setLabel("Exclude Post Types")->
|
578 |
+
setTooltip("Exclude ads from beeing shown on specific post types by selecting post type user_roles. Select multiple values by holding down ctrl key.")->
|
579 |
+
setDefault(isset($settings->excludedPostTypes) ? $settings->excludedPostTypes : 'noPostTypes')
|
580 |
+
);
|
581 |
+
|
582 |
+
// Hide Ads On Posts
|
583 |
+
$element = new Text('quads_vi_ads[ads][1][excludedPostIds]', array());
|
584 |
+
$this->form->add(
|
585 |
+
$element->setLabel("Exclude Posts")->
|
586 |
+
setTooltip("Exclude ads from beeing shown on specific pages by adding comma separated post ids here.")->
|
587 |
+
setDefault(isset($settings->excludedPostIds) ? $settings->excludedPostIds : '')
|
588 |
+
);
|
589 |
+
|
590 |
+
// Condition User Roles
|
591 |
+
$options = array_merge (array('noUserRoles' => 'Exclude nothing'), $this->quads_get_user_roles());
|
592 |
+
$element = new SelectMultiple('quads_vi_ads[ads][1][excludedUserRoles]', $options);
|
593 |
+
$this->form->add(
|
594 |
+
$element->setLabel("Exclude User Roles ")->
|
595 |
+
setTooltip("Show ads on specific user_roles only by selecting coresponding user_roles. Select multiple values by holding down ctrl key.")->
|
596 |
+
setDefault(isset($settings->excludedUserRoles) ? $settings->excludedUserRoles : 'allUserRoles')
|
597 |
+
);
|
598 |
+
|
599 |
+
}
|
600 |
+
|
601 |
+
/**
|
602 |
+
* @param string $name
|
603 |
+
* @return array|Form
|
604 |
+
*/
|
605 |
+
public function get($name = null) {
|
606 |
+
return (null === $name) ? $this->form : $this->form;
|
607 |
+
}
|
608 |
+
|
609 |
+
|
610 |
+
/**
|
611 |
+
*
|
612 |
+
* Get all user roles
|
613 |
+
*
|
614 |
+
* @global array $wp_roles
|
615 |
+
* @return array
|
616 |
+
*/
|
617 |
+
private function quads_get_user_roles() {
|
618 |
+
global $wp_roles;
|
619 |
+
$roles = array();
|
620 |
+
|
621 |
+
foreach ($wp_roles->roles as $role) {
|
622 |
+
//if( isset( $role["capabilities"]["edit_posts"] ) && $role["capabilities"]["edit_posts"] === true ) {
|
623 |
+
$value = str_replace(' ', null, strtolower($role["name"]));
|
624 |
+
$roles[$value] = $role["name"];
|
625 |
+
//}
|
626 |
+
}
|
627 |
+
return $roles;
|
628 |
+
}
|
629 |
+
|
630 |
+
}
|
includes/vendor/vi/views/ad_settings.php
ADDED
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* VI Widget
|
4 |
+
*/
|
5 |
+
?>
|
6 |
+
|
7 |
+
<div id="quads-vi-ad-integration">
|
8 |
+
<div id="quads-vi-customize-player">
|
9 |
+
|
10 |
+
<h4 style="font-weight: 500;font-size:18px;color:black;">vi stories: customize your video player</h4>
|
11 |
+
<?php
|
12 |
+
$form = new \wpquads\adSettings();
|
13 |
+
|
14 |
+
|
15 |
+
//echo $form->get()->label("quads_vi_ads[ads][1][type]");
|
16 |
+
//echo $form->get()->render("quads_vi_ads[ads][1][type]");
|
17 |
+
//echo '<br>';
|
18 |
+
echo $form->get()->label("quads_vi_ads[ads][1][keywords]");
|
19 |
+
echo $form->get()->render("quads_vi_ads[ads][1][keywords]");
|
20 |
+
echo $form->get()->tooltip("quads_vi_ads[ads][1][keywords]");
|
21 |
+
echo '<br>';
|
22 |
+
echo $form->get()->label("quads_vi_ads[ads][1][iab1]");
|
23 |
+
echo $form->get()->render("quads_vi_ads[ads][1][iab1]");
|
24 |
+
echo '<br>';
|
25 |
+
echo $form->get()->label("quads_vi_ads[ads][1][iab2]");
|
26 |
+
echo $form->get()->render("quads_vi_ads[ads][1][iab2]");
|
27 |
+
echo '<br>';
|
28 |
+
echo $form->get()->label("quads_vi_ads[ads][1][language]");
|
29 |
+
echo $form->get()->render("quads_vi_ads[ads][1][language]");
|
30 |
+
echo '<br>';
|
31 |
+
echo $form->get()->label("quads_vi_ads[ads][1][bg_color]");
|
32 |
+
echo $form->get()->render("quads_vi_ads[ads][1][bg_color]");
|
33 |
+
echo '<br>';
|
34 |
+
echo $form->get()->label("quads_vi_ads[ads][1][text_color]");
|
35 |
+
echo $form->get()->render("quads_vi_ads[ads][1][text_color]");
|
36 |
+
echo '<br>';
|
37 |
+
echo $form->get()->label("quads_vi_ads[ads][1][txt_font_family]");
|
38 |
+
echo $form->get()->render("quads_vi_ads[ads][1][txt_font_family]");
|
39 |
+
echo '<br>';
|
40 |
+
echo $form->get()->label("quads_vi_ads[ads][1][font_size]");
|
41 |
+
echo $form->get()->render("quads_vi_ads[ads][1][font_size]");
|
42 |
+
echo '<br>';
|
43 |
+
echo $form->get()->label("quads_vi_ads[ads][1][optional1]");
|
44 |
+
echo $form->get()->render("quads_vi_ads[ads][1][optional1]");
|
45 |
+
echo '<br>';
|
46 |
+
echo $form->get()->label("quads_vi_ads[ads][1][optional2]");
|
47 |
+
echo $form->get()->render("quads_vi_ads[ads][1][optional2]");
|
48 |
+
echo '<br>';
|
49 |
+
echo $form->get()->label("quads_vi_ads[ads][1][optional3]");
|
50 |
+
echo $form->get()->render("quads_vi_ads[ads][1][optional3]");
|
51 |
+
echo '<br>';
|
52 |
+
echo $form->get()->render("quads_vi_ads[ads][1][code]");
|
53 |
+
?>
|
54 |
+
<div id="quads-vi-layout">
|
55 |
+
<h3 style="margin-bottom:8px;">Layout</h3>
|
56 |
+
<br>
|
57 |
+
<?php echo $form->get()->render("quads_vi_ads[ads][1][align]"); ?>
|
58 |
+
<br>
|
59 |
+
</div>
|
60 |
+
<h3 style="margin-bottom:8px;">Automatic Integration</h3>
|
61 |
+
<div style="border-top: 1px solid #c3c3c3;"></div>
|
62 |
+
<h3>Where:</h3>
|
63 |
+
|
64 |
+
<?php
|
65 |
+
echo $form->get()->label("quads_vi_ads[ads][1][position]");
|
66 |
+
echo $form->get()->render("quads_vi_ads[ads][1][position]");
|
67 |
+
?>
|
68 |
+
<br>
|
69 |
+
<h3>Exclude Ad From:</h3>
|
70 |
+
<?php
|
71 |
+
echo $form->get()->label("quads_vi_ads[ads][1][excludedPostTypes]");
|
72 |
+
echo $form->get()->render("quads_vi_ads[ads][1][excludedPostTypes]");
|
73 |
+
echo $form->get()->tooltip("quads_vi_ads[ads][1][excludedPostTypes]");
|
74 |
+
?>
|
75 |
+
<br>
|
76 |
+
<?php
|
77 |
+
echo $form->get()->label("quads_vi_ads[ads][1][excludedUserRoles]");
|
78 |
+
echo $form->get()->render("quads_vi_ads[ads][1][excludedUserRoles]");
|
79 |
+
echo $form->get()->tooltip("quads_vi_ads[ads][1][excludedUserRoles]");
|
80 |
+
?>
|
81 |
+
<br>
|
82 |
+
<?php
|
83 |
+
echo $form->get()->label("quads_vi_ads[ads][1][excludedPostIds]");
|
84 |
+
echo $form->get()->render("quads_vi_ads[ads][1][excludedPostIds]");
|
85 |
+
echo $form->get()->tooltip("quads_vi_ads[ads][1][excludedPostIds]");
|
86 |
+
?>
|
87 |
+
<br>
|
88 |
+
<br>
|
89 |
+
<div id="quads-vi-save-notice"><span class="quads-spinner" style="float:none;"></span></div>
|
90 |
+
<div id="quads-vi-save-settings">
|
91 |
+
<input type="submit" id="quads_vi_save_settings_submit" style="" class='button button-primary' value="Save Video Settings">
|
92 |
+
</div>
|
93 |
+
|
94 |
+
</div>
|
95 |
+
<div id="quads-vi-shortcodes">
|
96 |
+
<h4 style="font-weight: 500;font-size:18px;color:black;">Manual Integration</h4>
|
97 |
+
<label>Shortcode:</label>
|
98 |
+
<input readonly="" id="quads_shortcode_1" type="text" onclick="this.focus();
|
99 |
+
this.select()" value="[quadsvi id=1]" title="Optional: Copy and paste the shortcode into the post editor, click below then press Ctrl + C (PC) or Cmd + C (Mac).">
|
100 |
+
<br>
|
101 |
+
<br>
|
102 |
+
<label>PHP Shortcode: </label>
|
103 |
+
<input readonly="" id="quads_php_shortcode_1" type="text" onclick="this.focus();
|
104 |
+
this.select()" style="width:310px;" value="<?php echo do_shortcode('[quadsvi id=1]'); ?>" title="Optional: Copy and paste the PHP code into your theme files, click below then press Ctrl + C (PC) or Cmd + C (Mac).">
|
105 |
+
<p></p>
|
106 |
+
</div>
|
107 |
+
</div>
|
108 |
+
|
109 |
+
|
110 |
+
|
111 |
+
|
112 |
+
|
includes/vendor/vi/views/error.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* VI Revenue
|
4 |
+
*/
|
5 |
+
?>
|
6 |
+
|
7 |
+
<div id="quads-vi-revenue-wrapper" >
|
8 |
+
<p>Can not access vi. There seems to be a technical issue. Try again later</p>
|
9 |
+
</div>
|
10 |
+
<div id="quads-vi-loggedin-buttons" style="clear:both;display:inline-block;width:100%;">
|
11 |
+
<div style="width:50%;float:left;"><a href="<?php echo $dashboardURL; ?>" class="button button-primary" id="quads-vi-dashboard" target="_blank"> Publisher Dashboard </a> </div>
|
12 |
+
</div>
|
13 |
+
<div style="clear:both;"></div>
|
includes/vendor/vi/views/logged_in.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* VI Widget
|
4 |
+
*/
|
5 |
+
?>
|
6 |
+
|
7 |
+
<div id="quads-vi-loggedin-buttons" style="clear:both;display:inline-block;width:100%;">
|
8 |
+
<div style="width:50%;float:left;"><a href="<?php echo $dashboardURL; ?>" class="button button-primary" id="quads-vi-dashboard" target="_blank"> Publisher Dashboard </a> </div>
|
9 |
+
<div style="width:50%;float:left;"><a href="<?php echo admin_url() . '?quads-action=logout_vi&page=quads-settings#quads_settingsvi_header' ?>" class="button button-secondary"> Logout </a></div>
|
10 |
+
</div>
|
11 |
+
|
12 |
+
|
13 |
+
|
14 |
+
|
includes/vendor/vi/views/login.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* VI Login
|
4 |
+
*/
|
5 |
+
?>
|
6 |
+
|
7 |
+
<div id="quads-vi-welcome">
|
8 |
+
<p>
|
9 |
+
Advertisers pay more for video advertising when it's matched with video content. This new video player will insert both on your page. It increases time on site, and commands a higher CPM than display advertising.
|
10 |
+
</p>
|
11 |
+
<p>
|
12 |
+
You'll see video content that is matched to your sites keywords straight away. A few days after activation you'll begin to receive revenue from advertising served before this video content.
|
13 |
+
</p>
|
14 |
+
<ul>
|
15 |
+
<li> The set up takes only a few minutes</li>
|
16 |
+
<li> Up to 10x higher CPM than traditional display advertising</li>
|
17 |
+
<li> Users spend longer on your site thanks to professional video content</li>
|
18 |
+
<li> The video player is customizable to match your site</li>
|
19 |
+
</ul>
|
20 |
+
<p>
|
21 |
+
Watch a <a href="<?php echo $demoPageURL; ?>" rel="external nofollow" target="_blank">demo</a> of how vi stories works.
|
22 |
+
<p>
|
23 |
+
By clicking sign up you agree to send your current domain, email and affiliate ID to video intelligence & WP QUADS. Your data is used only for the purpose of delivering video content and video ads to your site.
|
24 |
+
Before you click on the sign up button read the <a href="https://www-test.vi.ai/privacy-policy/">Privacy Policy</a>.
|
25 |
+
|
26 |
+
</p>
|
27 |
+
<div class="quads-widget-buttons">
|
28 |
+
<a href="<?php echo $loginAPI; ?>" class="button button-secondary" id="quads_vi_login_submit"> Login </a>
|
29 |
+
<a href="<?php echo $signupURL; ?>?email=<?php echo bloginfo('admin_email'); ?>&domain=<?php echo get_site_url(); ?>" class="button button-primary" id="quads-vi-signup"> Signup </a>
|
30 |
+
</div>
|
31 |
+
</div>
|
32 |
+
|
33 |
+
|
34 |
+
|
includes/vendor/vi/views/not_logged_in.php
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* VI Widget
|
4 |
+
*/
|
5 |
+
|
6 |
+
?>
|
7 |
+
|
8 |
+
<div id="quads-vi-welcome">
|
9 |
+
<p>
|
10 |
+
Advertisers pay more for video advertising when it's matched with video content. This new video player will insert both on your page. It increases time on site, and commands a higher CPM than display advertising.
|
11 |
+
</p>
|
12 |
+
<p>
|
13 |
+
You'll see video content that is matched to your sites keywords straight away. A few days after activation you'll begin to receive revenue from advertising served before this video content.
|
14 |
+
</p>
|
15 |
+
<ul>
|
16 |
+
<li> The set up takes only a few minutes</li>
|
17 |
+
<li> Up to 10x higher CPM than traditional display advertising</li>
|
18 |
+
<li> Users spend longer on your site thanks to professional video content</li>
|
19 |
+
<li> The video player is customizable to match your site</li>
|
20 |
+
</ul>
|
21 |
+
<p>
|
22 |
+
Watch a <a href="<?php echo isset($demoPageURL) ? $demoPageURL : ''; ?>" rel="external nofollow" target="_blank">demo</a> of how vi stories works.
|
23 |
+
<p>
|
24 |
+
|
25 |
+
<i>By clicking signup you agree to send your current domain, email and affiliate ID to video intelligence & WP QUADS. Your data is used only for the purpose of delivering video content and video ads to your site.</i>
|
26 |
+
</p>
|
27 |
+
<div class="quads-widget-buttons">
|
28 |
+
<a href="<?php echo $loginAPI; ?>" class="button button-secondary" id="quads_vi_login_submit"> Login </a>
|
29 |
+
<a href="<?php echo $signupURL; ?>" class="button button-primary" id="quads-vi-signup"> Signup </a>
|
30 |
+
</div>
|
31 |
+
</div>
|
32 |
+
|
33 |
+
<div id="quads-vi-signup-fullscreen">
|
34 |
+
<div id="quads-vi-signup-container">
|
35 |
+
<div id="quads-vi-close"></div>
|
36 |
+
<!--<iframe id="quads_vi_signup_iframe" src="<?php //echo $signupURL; ?>?email=<?php //echo bloginfo('admin_email'); ?>&domain=<?php //echo get_site_url(); ?>&aid=WP_Quads" scrolling="no"></iframe>//-->
|
37 |
+
<iframe id="quads_vi_signup_iframe" src="" scrolling="no"></iframe>
|
38 |
+
</div>
|
39 |
+
|
40 |
+
</div>
|
41 |
+
|
42 |
+
<div id="quads-vi-login">
|
43 |
+
<form action="<?php echo admin_url() . '?quads_action=vi_login' ?>">
|
44 |
+
<div class="quads-container">
|
45 |
+
<label><b>E-Mail</b></label>
|
46 |
+
<input type="text" placeholder="Enter Mail Address" name="email" id="email" novalidate>
|
47 |
+
|
48 |
+
<label><b>Password</b></label>
|
49 |
+
<input type="password" placeholder="Enter Password" name="password" id="password" novalidate>
|
50 |
+
|
51 |
+
<button type="submit" id="quads_vi_login_submit" style="display:none;">Login</button>
|
52 |
+
</div>
|
53 |
+
<div class="quads-spinner" id="quads_vi_loading"></div>
|
54 |
+
<div id="quads_add_err" style="min-height: 40px;"></div>
|
55 |
+
</form>
|
56 |
+
</div>
|
57 |
+
|
58 |
+
|
59 |
+
|
includes/vendor/vi/views/notices.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Vi Notices
|
4 |
+
*/
|
5 |
+
?>
|
6 |
+
|
7 |
+
|
8 |
+
|
9 |
+
<div class="quads-banner-wrapper notice <?php echo $type; ?>">
|
10 |
+
<section class="quads-banner-content">
|
11 |
+
<div class="quads-banner-columns">
|
12 |
+
<main class="quads-banner-main"><?php echo $message; ?></main>
|
13 |
+
<aside class="quads-banner-sidebar-second" style="margin-right:30px;"><p style="text-align:center;"><img src="<?php echo QUADS_PLUGIN_URL; ?>assets/images/vi_quads_logo.png" width="152" height="70"></p></aside>
|
14 |
+
</div>
|
15 |
+
<!--<aside class="quads-banner-close"><div style="margin-top:5px;"><a href="'.admin_url().'admin.php?page=quads-settings&quads-action=close_vi_notice" class="quads-notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></a></div></aside>//-->
|
16 |
+
</section>
|
17 |
+
</div>
|
18 |
+
|
includes/vendor/vi/views/partials/footer.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Vi Widget footer
|
4 |
+
*/
|
5 |
+
?>
|
6 |
+
|
7 |
+
</div>
|
8 |
+
|
includes/vendor/vi/views/partials/header.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* VI Widget
|
4 |
+
*/
|
5 |
+
|
6 |
+
?>
|
7 |
+
|
8 |
+
<div id="quads-vi-widget">
|
includes/vendor/vi/views/revenue.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* VI Revenue
|
4 |
+
*/
|
5 |
+
?>
|
6 |
+
|
7 |
+
<div id="quads-vi-revenue-wrapper" >
|
8 |
+
<div style="clear:both;">
|
9 |
+
<strong>vi Stories</strong> is a native video unit, creating a premium ad unit opportunity and monetizing it.
|
10 |
+
It engages your users and increase the time on site due to <strong>contextual video content.</strong>
|
11 |
+
</div>
|
12 |
+
|
13 |
+
<div id="quads-vi-revenue-sum-wrapper" style="float:left;width:50%;">
|
14 |
+
Total earnings<br>
|
15 |
+
<span id="quads-vi-revenue-sum">
|
16 |
+
<?php
|
17 |
+
global $quads;
|
18 |
+
echo $quads->vi->getRevenue()->netRevenue;
|
19 |
+
?>
|
20 |
+
</span>
|
21 |
+
</div>
|
22 |
+
<div style="position: relative; height:200px; width:300px">
|
23 |
+
<canvas id="quads-vi-revenue" width="300" height="200"></canvas>
|
24 |
+
</div>
|
25 |
+
</div>
|
26 |
+
<div style="clear:both;"></div>
|
27 |
+
<div id="quads-vi-loggedin-buttons" style="clear:both;display:inline-block;width:100%;">
|
28 |
+
<div style="width:50%;float:left;"><a href="<?php echo $dashboardURL; ?>" class="button button-primary" id="quads-vi-dashboard" target="_blank"> Publisher Dashboard </a> </div>
|
29 |
+
<div style="width:50%;float:left;"><a href="<?php echo admin_url() . '?quads-action=logout_vi&page=quads-settings#quads_settingsvi_header' ?>" class="button button-secondary"> Logout </a></div>
|
30 |
+
</div>
|
includes/vendor/vi/views/signup.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* VI Signup
|
4 |
+
*/
|
5 |
+
?>
|
6 |
+
|
7 |
+
<div>
|
8 |
+
<iframe src="<?php echo $signupURL; ?>" scrolling="no"></iframe>
|
9 |
+
</div>
|
10 |
+
|
11 |
+
|
12 |
+
|
includes/viIntegration.php
DELETED
@@ -1,96 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace wpquads;
|
4 |
-
|
5 |
-
/*
|
6 |
-
* vi integration for WP QUADS
|
7 |
-
* @author René Hermenau
|
8 |
-
* @email info@mashshare.net
|
9 |
-
*
|
10 |
-
*/
|
11 |
-
|
12 |
-
/**
|
13 |
-
* Main class for wp quads vi integration
|
14 |
-
* Description of viIntegration
|
15 |
-
*
|
16 |
-
* @author René Hermenau
|
17 |
-
*/
|
18 |
-
class vi {
|
19 |
-
|
20 |
-
/**
|
21 |
-
* vi API
|
22 |
-
* @var type
|
23 |
-
*/
|
24 |
-
public $api;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Debug mode
|
28 |
-
* @var bool
|
29 |
-
*/
|
30 |
-
private $debug = false;
|
31 |
-
|
32 |
-
public function __construct() {
|
33 |
-
$this->debug = true;
|
34 |
-
|
35 |
-
if ($this->debug) {
|
36 |
-
// Test endpoints
|
37 |
-
$this->urlSettings = 'https://dashboard-api-test.vidint.net/v1/api/widget/settings';
|
38 |
-
$this->urlDashboard = 'https://dashboard-test.vi.ai';
|
39 |
-
$this->urlSignup = 'https://dashboard-api-test.vidint.net/v1/api/signup';
|
40 |
-
$this->urlAuthenticate = 'https://dashboard-api-test.vidint.net/v1/api/authenticate';
|
41 |
-
$this->urlRevenue = 'https://dashboard-api-test.vidint.net/v1/api/publishers/report/revenue';
|
42 |
-
$this->urlJs = 'https://dashboard-api-test.vidint.net/v1/api/inventory/jstag';
|
43 |
-
} else {
|
44 |
-
// Production endpoints
|
45 |
-
$this->urlSettings = 'https://dashboard-api-test.vidint.net/v1/api/widget/settings';
|
46 |
-
$this->urlDashboard = 'https://dashboard-test.vi.ai';
|
47 |
-
$this->urlSignup = 'https://dashboard-api-test.vidint.net/v1/api/signup';
|
48 |
-
$this->urlAuthenticate = 'https://dashboard-api-test.vidint.net/v1/api/authenticate';
|
49 |
-
$this->urlRevenue = 'https://dashboard-api-test.vidint.net/v1/api/publishers/report/revenue';
|
50 |
-
$this->urlJs = 'https://dashboard-api-test.vidint.net/v1/api/inventory/jstag';
|
51 |
-
}
|
52 |
-
}
|
53 |
-
|
54 |
-
/**
|
55 |
-
* Login to vi account
|
56 |
-
* @param string $email
|
57 |
-
* @param string $password
|
58 |
-
* @return string json
|
59 |
-
*/
|
60 |
-
public function login($email, $password) {
|
61 |
-
$response = wp_remote_get($this->urlAuthenticate);
|
62 |
-
if (is_array($response)) {
|
63 |
-
return $response['body'];
|
64 |
-
}
|
65 |
-
return '';
|
66 |
-
}
|
67 |
-
|
68 |
-
public function getApi() {
|
69 |
-
return $this->api;
|
70 |
-
}
|
71 |
-
|
72 |
-
/**
|
73 |
-
*
|
74 |
-
* @return string
|
75 |
-
*/
|
76 |
-
public function getDashboard() {
|
77 |
-
$response = wp_remote_get($this->urlDashboard);
|
78 |
-
if (is_array($response)) {
|
79 |
-
return $response['body']; // use the content
|
80 |
-
}
|
81 |
-
return '';
|
82 |
-
}
|
83 |
-
|
84 |
-
/**
|
85 |
-
*
|
86 |
-
* @return string
|
87 |
-
*/
|
88 |
-
public function getSettings() {
|
89 |
-
$response = wp_remote_get($this->urlSettings);
|
90 |
-
if (is_array($response)) {
|
91 |
-
return $response['body']; // use the content
|
92 |
-
}
|
93 |
-
return '';
|
94 |
-
}
|
95 |
-
|
96 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
quick-adsense-reloaded.php
CHANGED
@@ -1,423 +1,497 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Plugin Name: AdSense Integration WP QUADS
|
5 |
-
* Plugin URI: https://wordpress.org/plugins/quick-adsense-reloaded/
|
6 |
-
* Description: Insert Google AdSense
|
7 |
-
* Author: Rene Hermenau, WP-Staging
|
8 |
-
* Author URI: https://wordpress.org/plugins/quick-adsense-reloaded/
|
9 |
-
* Version: 1.
|
10 |
-
* Text Domain: quick-adsense-reloaded
|
11 |
-
* Domain Path: languages
|
12 |
-
* Credits: WP QUADS - Quick AdSense Reloaded is a fork of Quick AdSense
|
13 |
-
*
|
14 |
-
* WP QUADS is free software: you can redistribute it and/or modify
|
15 |
-
* it under the terms of the GNU General Public License as published by
|
16 |
-
* the Free Software Foundation, either version 2 of the License, or
|
17 |
-
* any later version.
|
18 |
-
*
|
19 |
-
* WP QUADS is distributed in the hope that it will be useful,
|
20 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
21 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
22 |
-
* GNU General Public License for more details.
|
23 |
-
*
|
24 |
-
* You should have received a copy of the GNU General Public License
|
25 |
-
* along with plugin. If not, see <http://www.gnu.org/licenses/>.
|
26 |
-
*
|
27 |
-
* @package QUADS
|
28 |
-
* @category Core
|
29 |
-
* @author René Hermenau
|
30 |
-
* @version 0.9.0
|
31 |
-
*/
|
32 |
-
// Exit if accessed directly
|
33 |
-
if( !defined( 'ABSPATH' ) )
|
34 |
-
exit;
|
35 |
-
|
36 |
-
// Plugin version
|
37 |
-
if( !defined( 'QUADS_VERSION' ) ) {
|
38 |
-
define( 'QUADS_VERSION', '1.
|
39 |
-
}
|
40 |
-
|
41 |
-
// Plugin name
|
42 |
-
if( !defined( 'QUADS_NAME' ) ) {
|
43 |
-
define( 'QUADS_NAME', 'WP QUADS - Quick AdSense Reloaded' );
|
44 |
-
}
|
45 |
-
|
46 |
-
// Debug
|
47 |
-
if( !defined( 'QUADS_DEBUG' ) ) {
|
48 |
-
define( 'QUADS_DEBUG', false );
|
49 |
-
}
|
50 |
-
|
51 |
-
// Files that needs to be loaded early
|
52 |
-
if( !class_exists( 'QUADS_Utils' ) ) {
|
53 |
-
require dirname( __FILE__ ) . '/includes/quads-utils.php';
|
54 |
-
}
|
55 |
-
|
56 |
-
// Define some globals
|
57 |
-
$visibleContentAds = 0; // Amount of ads which are shown
|
58 |
-
$visibleShortcodeAds = 0; // Number of active ads which are shown via shortcodes
|
59 |
-
$visibleContentAdsGlobal = 0; // Number of active ads which are shown in the_content
|
60 |
-
$ad_count_custom = 0; // Number of active custom ads which are shown on the site
|
61 |
-
$ad_count_widget = 0; // Number of active ads in widgets
|
62 |
-
$AdsId = array(); // Array of active ad id's
|
63 |
-
$maxWidgets = 10; // number of widgets
|
64 |
-
|
65 |
-
|
66 |
-
if( !class_exists( 'QuickAdsenseReloaded' ) ) :
|
67 |
-
|
68 |
-
/**
|
69 |
-
* Main QuickAdsenseReloaded Class
|
70 |
-
*
|
71 |
-
* @since 1.0.0
|
72 |
-
*/
|
73 |
-
final class QuickAdsenseReloaded {
|
74 |
-
/** Singleton ************************************************************ */
|
75 |
-
|
76 |
-
/**
|
77 |
-
* @var QuickAdsenseReloaded The one and only QuickAdsenseReloaded
|
78 |
-
* @since 1.0
|
79 |
-
*/
|
80 |
-
private static $instance;
|
81 |
-
|
82 |
-
/**
|
83 |
-
* QUADS HTML Element Helper Object
|
84 |
-
*
|
85 |
-
* @var object
|
86 |
-
* @since 2.0.0
|
87 |
-
*/
|
88 |
-
public $html;
|
89 |
-
|
90 |
-
/* QUADS LOGGER Class
|
91 |
-
*
|
92 |
-
*/
|
93 |
-
public $logger;
|
94 |
-
|
95 |
-
/**
|
96 |
-
*
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
*
|
106 |
-
*
|
107 |
-
*
|
108 |
-
*
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
*
|
140 |
-
*
|
141 |
-
* @
|
142 |
-
* @
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
*
|
152 |
-
*
|
153 |
-
* @access
|
154 |
-
* @
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
require_once QUADS_PLUGIN_DIR . 'includes/
|
198 |
-
|
199 |
-
|
200 |
-
require_once QUADS_PLUGIN_DIR . 'includes/
|
201 |
-
require_once QUADS_PLUGIN_DIR . 'includes/
|
202 |
-
require_once QUADS_PLUGIN_DIR . 'includes/
|
203 |
-
require_once QUADS_PLUGIN_DIR . 'includes/
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
*
|
295 |
-
*
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
$
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
//
|
310 |
-
|
311 |
-
$
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
function
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Plugin Name: AdSense Integration WP QUADS
|
5 |
+
* Plugin URI: https://wordpress.org/plugins/quick-adsense-reloaded/
|
6 |
+
* Description: Insert Google AdSense and other ad formats fully automatic into your website
|
7 |
+
* Author: Rene Hermenau, WP-Staging
|
8 |
+
* Author URI: https://wordpress.org/plugins/quick-adsense-reloaded/
|
9 |
+
* Version: 1.7.0
|
10 |
+
* Text Domain: quick-adsense-reloaded
|
11 |
+
* Domain Path: languages
|
12 |
+
* Credits: WP QUADS - Quick AdSense Reloaded is a fork of Quick AdSense
|
13 |
+
*
|
14 |
+
* WP QUADS is free software: you can redistribute it and/or modify
|
15 |
+
* it under the terms of the GNU General Public License as published by
|
16 |
+
* the Free Software Foundation, either version 2 of the License, or
|
17 |
+
* any later version.
|
18 |
+
*
|
19 |
+
* WP QUADS is distributed in the hope that it will be useful,
|
20 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
21 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
22 |
+
* GNU General Public License for more details.
|
23 |
+
*
|
24 |
+
* You should have received a copy of the GNU General Public License
|
25 |
+
* along with plugin. If not, see <http://www.gnu.org/licenses/>.
|
26 |
+
*
|
27 |
+
* @package QUADS
|
28 |
+
* @category Core
|
29 |
+
* @author René Hermenau
|
30 |
+
* @version 0.9.0
|
31 |
+
*/
|
32 |
+
// Exit if accessed directly
|
33 |
+
if( !defined( 'ABSPATH' ) )
|
34 |
+
exit;
|
35 |
+
|
36 |
+
// Plugin version
|
37 |
+
if( !defined( 'QUADS_VERSION' ) ) {
|
38 |
+
define( 'QUADS_VERSION', '1.7.0' );
|
39 |
+
}
|
40 |
+
|
41 |
+
// Plugin name
|
42 |
+
if( !defined( 'QUADS_NAME' ) ) {
|
43 |
+
define( 'QUADS_NAME', 'WP QUADS - Quick AdSense Reloaded' );
|
44 |
+
}
|
45 |
+
|
46 |
+
// Debug
|
47 |
+
if( !defined( 'QUADS_DEBUG' ) ) {
|
48 |
+
define( 'QUADS_DEBUG', false );
|
49 |
+
}
|
50 |
+
|
51 |
+
// Files that needs to be loaded early
|
52 |
+
if( !class_exists( 'QUADS_Utils' ) ) {
|
53 |
+
require dirname( __FILE__ ) . '/includes/quads-utils.php';
|
54 |
+
}
|
55 |
+
|
56 |
+
// Define some globals
|
57 |
+
$visibleContentAds = 0; // Amount of ads which are shown
|
58 |
+
$visibleShortcodeAds = 0; // Number of active ads which are shown via shortcodes
|
59 |
+
$visibleContentAdsGlobal = 0; // Number of active ads which are shown in the_content
|
60 |
+
$ad_count_custom = 0; // Number of active custom ads which are shown on the site
|
61 |
+
$ad_count_widget = 0; // Number of active ads in widgets
|
62 |
+
$AdsId = array(); // Array of active ad id's
|
63 |
+
$maxWidgets = 10; // number of widgets
|
64 |
+
|
65 |
+
|
66 |
+
if( !class_exists( 'QuickAdsenseReloaded' ) ) :
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Main QuickAdsenseReloaded Class
|
70 |
+
*
|
71 |
+
* @since 1.0.0
|
72 |
+
*/
|
73 |
+
final class QuickAdsenseReloaded {
|
74 |
+
/** Singleton ************************************************************ */
|
75 |
+
|
76 |
+
/**
|
77 |
+
* @var QuickAdsenseReloaded The one and only QuickAdsenseReloaded
|
78 |
+
* @since 1.0
|
79 |
+
*/
|
80 |
+
private static $instance;
|
81 |
+
|
82 |
+
/**
|
83 |
+
* QUADS HTML Element Helper Object
|
84 |
+
*
|
85 |
+
* @var object
|
86 |
+
* @since 2.0.0
|
87 |
+
*/
|
88 |
+
public $html;
|
89 |
+
|
90 |
+
/* QUADS LOGGER Class
|
91 |
+
*
|
92 |
+
*/
|
93 |
+
public $logger;
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Public vi class
|
97 |
+
*/
|
98 |
+
public $vi;
|
99 |
+
|
100 |
+
public function __construct() {
|
101 |
+
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Main QuickAdsenseReloaded Instance
|
106 |
+
*
|
107 |
+
* Insures that only one instance of QuickAdsenseReloaded exists in memory at any one
|
108 |
+
* time. Also prevents needing to define globals all over the place.
|
109 |
+
*
|
110 |
+
* @since 1.0
|
111 |
+
* @static
|
112 |
+
* @static var array $instance
|
113 |
+
* @uses QuickAdsenseReloaded::setup_constants() Setup the constants needed
|
114 |
+
* @uses QuickAdsenseReloaded::includes() Include the required files
|
115 |
+
* @uses QuickAdsenseReloaded::load_textdomain() load the language files
|
116 |
+
* @see QUADS()
|
117 |
+
* @return The one true QuickAdsenseReloaded
|
118 |
+
*/
|
119 |
+
public static function instance() {
|
120 |
+
if( !isset( self::$instance ) && !( self::$instance instanceof QuickAdsenseReloaded ) ) {
|
121 |
+
self::$instance = new QuickAdsenseReloaded;
|
122 |
+
self::$instance->setup_constants();
|
123 |
+
self::$instance->includes();
|
124 |
+
self::$instance->load_textdomain();
|
125 |
+
self::$instance->load_hooks();
|
126 |
+
self::$instance->logger = new quadsLogger( "quick_adsense_log_" . date( "Y-m-d" ) . ".log", quadsLogger::INFO );
|
127 |
+
self::$instance->html = new QUADS_HTML_Elements();
|
128 |
+
self::$instance->vi = new wpquads\vi();
|
129 |
+
self::$instance->adsense = new wpquads\adsense(get_option('quads_settings'));
|
130 |
+
}
|
131 |
+
return self::$instance;
|
132 |
+
}
|
133 |
+
|
134 |
+
/**
|
135 |
+
* Throw error on object clone
|
136 |
+
*
|
137 |
+
* The whole idea of the singleton design pattern is that there is a single
|
138 |
+
* object therefore, we don't want the object to be cloned.
|
139 |
+
*
|
140 |
+
* @since 1.0
|
141 |
+
* @access protected
|
142 |
+
* @return void
|
143 |
+
*/
|
144 |
+
public function __clone() {
|
145 |
+
// Cloning instances of the class is forbidden
|
146 |
+
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'QUADS' ), '1.0' );
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Disable unserializing of the class
|
151 |
+
*
|
152 |
+
* @since 1.0
|
153 |
+
* @access protected
|
154 |
+
* @return void
|
155 |
+
*/
|
156 |
+
public function __wakeup() {
|
157 |
+
// Unserializing instances of the class is forbidden
|
158 |
+
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'QUADS' ), '1.0' );
|
159 |
+
}
|
160 |
+
|
161 |
+
/**
|
162 |
+
* Setup plugin constants
|
163 |
+
*
|
164 |
+
* @access private
|
165 |
+
* @since 1.0
|
166 |
+
* @return void
|
167 |
+
*/
|
168 |
+
private function setup_constants() {
|
169 |
+
//global $wpdb;
|
170 |
+
|
171 |
+
// Plugin Folder Path
|
172 |
+
if( !defined( 'QUADS_PLUGIN_DIR' ) ) {
|
173 |
+
define( 'QUADS_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
174 |
+
}
|
175 |
+
|
176 |
+
// Plugin Folder URL
|
177 |
+
if( !defined( 'QUADS_PLUGIN_URL' ) ) {
|
178 |
+
define( 'QUADS_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
179 |
+
}
|
180 |
+
|
181 |
+
// Plugin Root File
|
182 |
+
if( !defined( 'QUADS_PLUGIN_FILE' ) ) {
|
183 |
+
define( 'QUADS_PLUGIN_FILE', __FILE__ );
|
184 |
+
}
|
185 |
+
}
|
186 |
+
|
187 |
+
/**
|
188 |
+
* Include required files
|
189 |
+
*
|
190 |
+
* @access private
|
191 |
+
* @since 1.0
|
192 |
+
* @return void
|
193 |
+
*/
|
194 |
+
private function includes() {
|
195 |
+
global $quads_options;
|
196 |
+
|
197 |
+
require_once QUADS_PLUGIN_DIR . 'includes/admin/settings/register-settings.php';
|
198 |
+
$quads_options = quads_get_settings();
|
199 |
+
|
200 |
+
require_once QUADS_PLUGIN_DIR . 'includes/post_types.php';
|
201 |
+
require_once QUADS_PLUGIN_DIR . 'includes/user_roles.php';
|
202 |
+
require_once QUADS_PLUGIN_DIR . 'includes/widgets.php';
|
203 |
+
require_once QUADS_PLUGIN_DIR . 'includes/template-functions.php';
|
204 |
+
require_once QUADS_PLUGIN_DIR . 'includes/class-quads-license-handler.php';
|
205 |
+
require_once QUADS_PLUGIN_DIR . 'includes/logger.php';
|
206 |
+
require_once QUADS_PLUGIN_DIR . 'includes/class-quads-html-elements.php';
|
207 |
+
require_once QUADS_PLUGIN_DIR . 'includes/shortcodes.php';
|
208 |
+
require_once QUADS_PLUGIN_DIR . 'includes/api.php';
|
209 |
+
require_once QUADS_PLUGIN_DIR . 'includes/render-ad-functions.php';
|
210 |
+
require_once QUADS_PLUGIN_DIR . 'includes/scripts.php';
|
211 |
+
require_once QUADS_PLUGIN_DIR . 'includes/automattic-amp-ad.php';
|
212 |
+
require_once QUADS_PLUGIN_DIR . 'includes/helper-functions.php';
|
213 |
+
require_once QUADS_PLUGIN_DIR . 'includes/conditions.php';
|
214 |
+
require_once QUADS_PLUGIN_DIR . 'includes/frontend-checks.php';
|
215 |
+
require_once QUADS_PLUGIN_DIR . 'includes/Cron/Cron.php';
|
216 |
+
require_once QUADS_PLUGIN_DIR . 'includes/vendor/vi/conditions.php';
|
217 |
+
require_once QUADS_PLUGIN_DIR . 'includes/vendor/vi/vi.php';
|
218 |
+
require_once QUADS_PLUGIN_DIR . 'includes/vendor/vi/render.php';
|
219 |
+
require_once QUADS_PLUGIN_DIR . 'includes/vendor/google/adsense.php';
|
220 |
+
require_once QUADS_PLUGIN_DIR . 'includes/class-template.php';
|
221 |
+
require_once QUADS_PLUGIN_DIR . 'includes/admin/adsTxt.php';
|
222 |
+
|
223 |
+
|
224 |
+
if( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
|
225 |
+
require_once QUADS_PLUGIN_DIR . 'includes/admin/add-ons.php';
|
226 |
+
require_once QUADS_PLUGIN_DIR . 'includes/admin/admin-actions.php';
|
227 |
+
require_once QUADS_PLUGIN_DIR . 'includes/admin/admin-footer.php';
|
228 |
+
require_once QUADS_PLUGIN_DIR . 'includes/admin/admin-pages.php';
|
229 |
+
require_once QUADS_PLUGIN_DIR . 'includes/admin/plugins.php';
|
230 |
+
require_once QUADS_PLUGIN_DIR . 'includes/admin/welcome.php';
|
231 |
+
require_once QUADS_PLUGIN_DIR . 'includes/admin/settings/display-settings.php';
|
232 |
+
require_once QUADS_PLUGIN_DIR . 'includes/admin/settings/contextual-help.php';
|
233 |
+
require_once QUADS_PLUGIN_DIR . 'includes/admin/tools.php';
|
234 |
+
require_once QUADS_PLUGIN_DIR . 'includes/meta-boxes.php';
|
235 |
+
require_once QUADS_PLUGIN_DIR . 'includes/quicktags.php';
|
236 |
+
require_once QUADS_PLUGIN_DIR . 'includes/admin/admin-notices.php';
|
237 |
+
require_once QUADS_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php';
|
238 |
+
require_once QUADS_PLUGIN_DIR . 'includes/Forms/Form.php';
|
239 |
+
require_once QUADS_PLUGIN_DIR . 'includes/Autoloader.php';
|
240 |
+
require_once QUADS_PLUGIN_DIR . 'includes/vendor/vi/views/Forms/adSettings.php';
|
241 |
+
$this->registerNamespaces();
|
242 |
+
|
243 |
+
}
|
244 |
+
}
|
245 |
+
|
246 |
+
/**
|
247 |
+
* Register used namespaces
|
248 |
+
*/
|
249 |
+
private function registerNamespaces() {
|
250 |
+
$autoloader = new wpquads\Autoloader();
|
251 |
+
|
252 |
+
// Autoloader
|
253 |
+
$autoloader->registerNamespaces( array(
|
254 |
+
"wpquads" => array(
|
255 |
+
QUADS_PLUGIN_DIR,
|
256 |
+
QUADS_PLUGIN_DIR . 'includes' . DIRECTORY_SEPARATOR . 'Forms',
|
257 |
+
QUADS_PLUGIN_DIR . 'includes' . DIRECTORY_SEPARATOR . 'Forms' . DIRECTORY_SEPARATOR . 'Elements',
|
258 |
+
QUADS_PLUGIN_DIR . 'includes' . DIRECTORY_SEPARATOR . 'Forms' . DIRECTORY_SEPARATOR . 'Elements' . DIRECTORY_SEPARATOR . 'Interfaces',
|
259 |
+
QUADS_PLUGIN_DIR . 'includes' . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'vi',
|
260 |
+
QUADS_PLUGIN_DIR . 'includes' . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'vi' . DIRECTORY_SEPARATOR . 'views',
|
261 |
+
)
|
262 |
+
) );
|
263 |
+
|
264 |
+
|
265 |
+
// Register namespaces
|
266 |
+
$autoloader->register();
|
267 |
+
}
|
268 |
+
|
269 |
+
/**
|
270 |
+
* Set a variable to DI with given name
|
271 |
+
* @param string $name
|
272 |
+
* @param mixed $variable
|
273 |
+
* @return $this
|
274 |
+
*/
|
275 |
+
// public function set( $name, $variable ) {
|
276 |
+
// // It is a function
|
277 |
+
// if( is_callable( $variable ) )
|
278 |
+
// $variable = $variable();
|
279 |
+
//
|
280 |
+
// // Add it to services
|
281 |
+
// $this->services[$name] = $variable;
|
282 |
+
//
|
283 |
+
// return $this;
|
284 |
+
// }
|
285 |
+
|
286 |
+
|
287 |
+
public function load_hooks() {
|
288 |
+
if( is_admin() && quads_is_plugins_page() ) {
|
289 |
+
add_filter( 'admin_footer', 'quads_add_deactivation_feedback_modal' );
|
290 |
+
}
|
291 |
+
}
|
292 |
+
|
293 |
+
/**
|
294 |
+
* Loads the plugin language files
|
295 |
+
*
|
296 |
+
* @access public
|
297 |
+
* @since 1.0
|
298 |
+
* @return void
|
299 |
+
*/
|
300 |
+
public function load_textdomain() {
|
301 |
+
// Set filter for plugin's languages directory
|
302 |
+
$quads_lang_dir = dirname( plugin_basename( QUADS_PLUGIN_FILE ) ) . '/languages/';
|
303 |
+
$quads_lang_dir = apply_filters( 'quads_languages_directory', $quads_lang_dir );
|
304 |
+
|
305 |
+
// Traditional WordPress plugin locale filter
|
306 |
+
$locale = apply_filters( 'plugin_locale', get_locale(), 'quick-adsense-reloaded' );
|
307 |
+
$mofile = sprintf( '%1$s-%2$s.mo', 'quick-adsense-reloaded', $locale );
|
308 |
+
|
309 |
+
// Setup paths to current locale file
|
310 |
+
$mofile_local = $quads_lang_dir . $mofile;
|
311 |
+
$mofile_global = WP_LANG_DIR . '/quads/' . $mofile;
|
312 |
+
//echo $mofile_local;
|
313 |
+
if( file_exists( $mofile_global ) ) {
|
314 |
+
// Look in global /wp-content/languages/quads folder
|
315 |
+
load_textdomain( 'quick-adsense-reloaded', $mofile_global );
|
316 |
+
} elseif( file_exists( $mofile_local ) ) {
|
317 |
+
// Look in local /wp-content/plugins/quick-adsense-reloaded/languages/ folder
|
318 |
+
load_textdomain( 'quick-adsense-reloaded', $mofile_local );
|
319 |
+
} else {
|
320 |
+
// Load the default language files
|
321 |
+
load_plugin_textdomain( 'quick-adsense-reloaded', false, $quads_lang_dir );
|
322 |
+
}
|
323 |
+
}
|
324 |
+
|
325 |
+
/*
|
326 |
+
* Activation function fires when the plugin is activated.
|
327 |
+
* Checks first if multisite is enabled
|
328 |
+
* @since 1.0.0
|
329 |
+
*
|
330 |
+
*/
|
331 |
+
|
332 |
+
public static function activation( $networkwide ) {
|
333 |
+
global $wpdb;
|
334 |
+
|
335 |
+
if( function_exists( 'is_multisite' ) && is_multisite() ) {
|
336 |
+
// check if it is a network activation - if so, run the activation function for each blog id
|
337 |
+
if( $networkwide ) {
|
338 |
+
$old_blog = $wpdb->blogid;
|
339 |
+
// Get all blog ids
|
340 |
+
$blogids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" );
|
341 |
+
foreach ( $blogids as $blog_id ) {
|
342 |
+
switch_to_blog( $blog_id );
|
343 |
+
QuickAdsenseReloaded::during_activation();
|
344 |
+
}
|
345 |
+
switch_to_blog( $old_blog );
|
346 |
+
return;
|
347 |
+
}
|
348 |
+
}
|
349 |
+
QuickAdsenseReloaded::during_activation();
|
350 |
+
}
|
351 |
+
|
352 |
+
/**
|
353 |
+
* This function is fired from the activation method.
|
354 |
+
*
|
355 |
+
* @since 2.1.1
|
356 |
+
* @access public
|
357 |
+
*
|
358 |
+
* @return void
|
359 |
+
*/
|
360 |
+
public static function during_activation() {
|
361 |
+
|
362 |
+
// Add cron event
|
363 |
+
require_once plugin_dir_path( __FILE__ ) . 'includes/Cron/Cron.php';
|
364 |
+
$cron = new quadsCron();
|
365 |
+
$cron->schedule_event();
|
366 |
+
|
367 |
+
// Create vi api endpints and settings
|
368 |
+
self::instance()->vi->setSettings();
|
369 |
+
|
370 |
+
// Add Upgraded From Option
|
371 |
+
$current_version = get_option( 'quads_version' );
|
372 |
+
if( $current_version ) {
|
373 |
+
update_option( 'quads_version_upgraded_from', $current_version );
|
374 |
+
}
|
375 |
+
// First time installation
|
376 |
+
// Get all settings and update them only if they are empty
|
377 |
+
$quads_options = get_option( 'quads_settings' );
|
378 |
+
if( !$quads_options ) {
|
379 |
+
$quads_options['post_types'] = array('post', 'page');
|
380 |
+
$quads_options['visibility']['AppHome'] = "1";
|
381 |
+
$quads_options['visibility']['AppCate'] = "1";
|
382 |
+
$quads_options['visibility']['AppArch'] = "1";
|
383 |
+
$quads_options['visibility']['AppTags'] = "1";
|
384 |
+
$quads_options['quicktags']['QckTags'] = "1";
|
385 |
+
|
386 |
+
update_option( 'quads_settings', $quads_options );
|
387 |
+
}
|
388 |
+
|
389 |
+
// Update the current version
|
390 |
+
//update_option( 'quads_version', QUADS_VERSION );
|
391 |
+
// Add plugin installation date and variable for rating div
|
392 |
+
add_option( 'quads_install_date', date( 'Y-m-d h:i:s' ) );
|
393 |
+
add_option( 'quads_rating_div', 'no' );
|
394 |
+
add_option( 'quads_show_theme_notice', 'yes' );
|
395 |
+
|
396 |
+
// Add the transient to redirect (not for multisites)
|
397 |
+
set_transient( 'quads_activation_redirect', true, 3600 );
|
398 |
+
}
|
399 |
+
|
400 |
+
/**
|
401 |
+
* Get all wp quads settings
|
402 |
+
* @return array
|
403 |
+
*/
|
404 |
+
private function startAdsense(){
|
405 |
+
new wpquads\adsense(get_option( 'quads_settings' ));
|
406 |
+
}
|
407 |
+
|
408 |
+
}
|
409 |
+
|
410 |
+
endif; // End if class_exists check
|
411 |
+
|
412 |
+
/**
|
413 |
+
* The main function responsible for returning the one true QuickAdsenseReloaded
|
414 |
+
* Instance to functions everywhere.
|
415 |
+
*
|
416 |
+
* Use this function like you would a global variable, except without needing
|
417 |
+
* to declare the global.
|
418 |
+
*
|
419 |
+
* Example: $QUADS = QUADS();
|
420 |
+
*
|
421 |
+
* @since 2.0.0
|
422 |
+
* @return object The one true QuickAdsenseReloaded Instance
|
423 |
+
*/
|
424 |
+
|
425 |
+
/**
|
426 |
+
* Populate the $quads global with an instance of the QuickAdsenseReloaded class and return it.
|
427 |
+
*
|
428 |
+
* @return $quads a global instance class of the QuickAdsenseReloaded class.
|
429 |
+
*/
|
430 |
+
function quads_loaded() {
|
431 |
+
|
432 |
+
global $quads;
|
433 |
+
|
434 |
+
if( !is_null( $quads ) ) {
|
435 |
+
return $quads;
|
436 |
+
}
|
437 |
+
|
438 |
+
$quads_instance = new QuickAdsenseReloaded;
|
439 |
+
$quads = $quads_instance->instance();
|
440 |
+
return $quads;
|
441 |
+
}
|
442 |
+
|
443 |
+
add_action( 'plugins_loaded', 'quads_loaded' );
|
444 |
+
|
445 |
+
/**
|
446 |
+
* The activation hook is called outside of the singleton because WordPress doesn't
|
447 |
+
* register the call from within the class hence, needs to be called outside and the
|
448 |
+
* function also needs to be static.
|
449 |
+
*/
|
450 |
+
register_activation_hook( __FILE__, array('QuickAdsenseReloaded', 'activation') );
|
451 |
+
|
452 |
+
/**
|
453 |
+
* Check if pro version is installed and active
|
454 |
+
*/
|
455 |
+
function quads_is_pro_active() {
|
456 |
+
$needle = 'wp-quads-pro';
|
457 |
+
$plugins = get_option( 'active_plugins', array() );
|
458 |
+
foreach ( $plugins as $key => $value ) {
|
459 |
+
if( strpos( $value, $needle ) !== false ) {
|
460 |
+
return true;
|
461 |
+
}
|
462 |
+
}
|
463 |
+
return false;
|
464 |
+
}
|
465 |
+
|
466 |
+
|
467 |
+
/**
|
468 |
+
* Check if advanced settings are available
|
469 |
+
*
|
470 |
+
* @return boolean
|
471 |
+
*/
|
472 |
+
function quads_is_advanced() {
|
473 |
+
if( function_exists( 'quads_is_active_pro' ) ) {
|
474 |
+
return quads_is_active_pro();
|
475 |
+
} else {
|
476 |
+
return quads_is_active_deprecated();
|
477 |
+
}
|
478 |
+
return false;
|
479 |
+
}
|
480 |
+
|
481 |
+
/**
|
482 |
+
* Check if wp quads pro is active and installed
|
483 |
+
*
|
484 |
+
* @deprecated since version 1.3.0
|
485 |
+
* @return boolean
|
486 |
+
*/
|
487 |
+
function quads_is_active_deprecated() {
|
488 |
+
|
489 |
+
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
490 |
+
$plugin = 'wp-quads-pro/wp-quads-pro.php';
|
491 |
+
|
492 |
+
if( is_plugin_active( $plugin ) ) {
|
493 |
+
return true;
|
494 |
+
}
|
495 |
+
|
496 |
+
return false;
|
497 |
+
}
|
readme.txt
CHANGED
@@ -1,205 +1,211 @@
|
|
1 |
-
=== AdSense Plugin WP QUADS ===
|
2 |
-
|
3 |
-
Author URL: https://profiles.wordpress.org/renehermi/
|
4 |
-
Plugin URL: https://wpquads.com
|
5 |
-
Contributors: ReneHermi, WP-Staging
|
6 |
-
Donate link: https://wpquads.com
|
7 |
-
License: GPLv2 or later
|
8 |
-
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
-
Tags: adsense, ads, ad, google adsense, advertising, amp, ad injection, ad inserter, ad manager
|
10 |
-
Requires at least: 3.6+
|
11 |
-
Tested up to: 4.
|
12 |
-
Stable tag: 1.
|
13 |
-
|
14 |
-
Quick Adsense Reloaded! Quickest way to insert Google AdSense & other ads into your website. Google AdSense integration with Google AMP support
|
15 |
-
|
16 |
-
== Description ==
|
17 |
-
|
18 |
-
#### WPQUADS - Quick AdSense Reloaded
|
19 |
-
This free Google AdSense inserting plugin is an improvement of the successfull but discontinued plugin Quick AdSense which is used on more than 100.000 websites.
|
20 |
-
WP QUADS is coded well with no overhead and is used on huge websites with millions of monthly page impressions.
|
21 |
-
<br />
|
22 |
-
[See all features](https://wpquads.com/)
|
23 |
-
<br />
|
24 |
-
* AMP support! Add AMP ads automatically to your site (WP QUADS PRO needed)<br />
|
25 |
-
* Use mobile optimized and responsive AdSense ads<br />
|
26 |
-
* Disable AdSense ads on phone, tablet or desktop devices<br />
|
27 |
-
* Define AdSense sizes for different devices<br />
|
28 |
-
|
29 |
-
AMP feature requires [Automattic AMP plugin](http://wpquads.com/?utm_source=wp_org&utm_medium=plugin_page&utm_term=check_out_wp_quads&utm_campaign=wpquads) or any other AMP plugin installed <br />
|
30 |
-
Get WP QUADS PRO: [wpquads.com](http://wpquads.com/?utm_source=wp_org&utm_medium=plugin_page&utm_term=check_out_wp_quads&utm_campaign=wpquads) <br />
|
31 |
-
|
32 |
-
This AdSense plugin is rewritten from scratch with a solid code
|
33 |
-
base and will be maintained and updated to be compatible with all future WordPress versions<br />
|
34 |
-
Found a issue? Open a ticket in the [support forum](https://wordpress.org/support/plugin/quick-adsense-reloaded/ "support forum").
|
35 |
-
|
36 |
-
= Why a Quick AdSense fork? =
|
37 |
-
|
38 |
-
Quick Adsense is a great plugin and used by more than 100.000 websites.
|
39 |
-
Although is not under maintainance and development for more than 3 years by the original author it is still downloaded hundred times a day.
|
40 |
-
So i decided to continue the project to make sure the plugin will also work in future with new WordPress versions.
|
41 |
-
|
42 |
-
Deprecated functions removed, bugs fixed and new filters and hooks created to make this plugin extensible by third party developers!
|
43 |
-
|
44 |
-
<strong>We Guarantee: </strong><br>
|
45 |
-
No revenue sharing from your Google AdSense advertising income. We never show our ads on your website.<br>
|
46 |
-
We are an active and engaged member of the WordPress community and we are following strongly the WordPress Codex in terms of code quality and good behave.
|
47 |
-
|
48 |
-
= Main Features =
|
49 |
-
|
50 |
-
* Import all ads settings from Quick AdSense v. 1.9.2 and convert them into serialized options.
|
51 |
-
* Visibility conditions, show / hide ads based on post type and user roles (needs WP QUADS PRO)
|
52 |
-
* Quicktags of Quick Adsense are 100% compatible to Quick AdSense Reloaded
|
53 |
-
* No external script dependencies. All plugin code reside on your site.
|
54 |
-
* Dynamic AdSense positioning: Assign Google AdSense ads to the beginning, middle and end of post, assign ads after 'more' tag, before last paragraph, after certain paragraphs & assign Ads after certain images.
|
55 |
-
* Insert Google AdSense ads specifically or randomly anywhere within a post.
|
56 |
-
* Support any Ads code, not limited to Google Adsense ads only.
|
57 |
-
* Display up to a maximum of 10 Ads on a page. Google TOS allows publishers to place up to 3 Google Adsense for Content on a page. If you are using other ads, you may display up to 10 Ads.
|
58 |
-
* Support up to a maximum of 10 Ads codes on Sidebar Widgets.
|
59 |
-
* Support up to a maximum of 10 Ads codes for specific placement & randomization within a post.
|
60 |
-
* Insert Google AdSense ads on-the-fly, insert <!--Ads1-->, <!--Ads2--> ... , <!--RndAds--> to a post to accomplish this.
|
61 |
-
* Disable Ads on-the-fly, insert <!--NoAds-->, <!--OffDef-->, <!--OffWidget-->, <!--OffBegin--> ... and more to a post to accomplish this.
|
62 |
-
* The above quicktags can be inserted into a post easily via the additional Quicktag Buttons added to the HTML Edit Post SubPanel.
|
63 |
-
* Use shortcodes within ads (Suppport advertisements from other ad plugins for example Simple Ads Manager or AdRotate)
|
64 |
-
|
65 |
-
= Improvements to original Quick AdSense Ads plugin =
|
66 |
-
|
67 |
-
* Performance improvements
|
68 |
-
* Serialized storing of Ad options instead storing every single option as separate table entry all over
|
69 |
-
* Multi language support
|
70 |
-
* Remove of small coding issues like "unexpected output" message when plugin is activated on several sites
|
71 |
-
* Import / Export function makes plugin migrating to other sites easier. Copy your ads code to other sites.
|
72 |
-
|
73 |
-
= Safety improvements =
|
74 |
-
|
75 |
-
* Exit code if Quick AdSense plugin is not called by WordPress directly
|
76 |
-
* Better sanitizing of user input
|
77 |
-
|
78 |
-
= We Distance Ourself From =
|
79 |
-
These are known AdSense plugins which are removed from the WordPress repository because of non ethic behavior:
|
80 |
-
|
81 |
-
* AdSense Extreme
|
82 |
-
* AdSense Insert
|
83 |
-
|
84 |
-
Make sure to switch to WP QUADS or any other AdSense plugin if you are still using these plugins!
|
85 |
-
|
86 |
-
<h3>WP QUADS PRO:</h3>
|
87 |
-
|
88 |
-
* Support for responsive Google AdSense ads
|
89 |
-
* GUI improvements
|
90 |
-
|
91 |
-
Check out WP QUADS PRO: [wpquads.com](http://wpquads.com/?utm_source=wp_org&utm_medium=plugin_page&utm_term=check_out_wp_quads&utm_campaign=wpquads) <br />
|
92 |
-
|
93 |
-
Do you have suggestions for more features?
|
94 |
-
|
95 |
-
= High Performance =
|
96 |
-
|
97 |
-
Quick AdSense Reloaded is *coded well and developed for high performance*.
|
98 |
-
It loads only the code it needs at the moment of execution, making it small and fast and with a lot of hooks easy extensible by third party developers.
|
99 |
-
|
100 |
-
** GitHub **
|
101 |
-
Follow the development and improve the plugin.
|
102 |
-
You find it on [GitHub](https://github.com/rene-hermenau/quick-adsense-reloaded/)
|
103 |
-
|
104 |
-
|
105 |
-
== Frequently Asked Questions ==
|
106 |
-
|
107 |
-
Post your question in the [support forum](https://wordpress.org/support/plugin/quick-adsense-reloaded)
|
108 |
-
|
109 |
-
== Installation ==
|
110 |
-
|
111 |
-
Recommended Installation:
|
112 |
-
|
113 |
-
1. Go to YourWebsite->Plugins->Add New
|
114 |
-
2. Search for "Quick Adsense reloaded" or "WP QUADS"
|
115 |
-
3. Click "install Now"
|
116 |
-
|
117 |
-
Alternative Installation:
|
118 |
-
|
119 |
-
1. [Download the plugin](https://downloads.wordpress.org/plugin/quick-adsense-reloaded.latest-stable.zip) , unzip and place it in your wp-content/plugins/ folder.
|
120 |
-
2. Activate the plugin through the 'Plugins' menu in WordPress.
|
121 |
-
|
122 |
-
== Screenshots ==
|
123 |
-
|
124 |
-
1. The Quick AdSense Settings page
|
125 |
-
2. General Settings
|
126 |
-
3. AdSense Widgets
|
127 |
-
4. AdSense Options from the post editor
|
128 |
-
|
129 |
-
|
130 |
-
== Changelog ==
|
131 |
-
|
132 |
-
= 1.
|
133 |
-
*
|
134 |
-
* New:
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
* Fix:
|
141 |
-
* New:
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
*
|
148 |
-
|
149 |
-
|
150 |
-
*
|
151 |
-
|
152 |
-
|
153 |
-
*
|
154 |
-
|
155 |
-
|
156 |
-
*
|
157 |
-
*
|
158 |
-
* Fix:
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
* Fix:
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
*
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
*
|
172 |
-
*
|
173 |
-
*
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
*
|
179 |
-
* Fix:
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
*
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
*
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
*
|
198 |
-
* Tweak:
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== AdSense Plugin WP QUADS ===
|
2 |
+
|
3 |
+
Author URL: https://profiles.wordpress.org/renehermi/
|
4 |
+
Plugin URL: https://wpquads.com
|
5 |
+
Contributors: ReneHermi, WP-Staging
|
6 |
+
Donate link: https://wpquads.com
|
7 |
+
License: GPLv2 or later
|
8 |
+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
+
Tags: adsense, ads, ad, google adsense, advertising, amp, ad injection, ad inserter, ad manager
|
10 |
+
Requires at least: 3.6+
|
11 |
+
Tested up to: 4.9
|
12 |
+
Stable tag: 1.7.0
|
13 |
+
|
14 |
+
Quick Adsense Reloaded! Quickest way to insert Google AdSense & other ads into your website. Google AdSense integration with Google AMP support
|
15 |
+
|
16 |
+
== Description ==
|
17 |
+
|
18 |
+
#### WPQUADS - Quick AdSense Reloaded
|
19 |
+
This free Google AdSense inserting plugin is an improvement of the successfull but discontinued plugin Quick AdSense which is used on more than 100.000 websites.
|
20 |
+
WP QUADS is coded well with no overhead and is used on huge websites with millions of monthly page impressions.
|
21 |
+
<br />
|
22 |
+
[See all features](https://wpquads.com/)
|
23 |
+
<br />
|
24 |
+
* AMP support! Add AMP ads automatically to your site (WP QUADS PRO needed)<br />
|
25 |
+
* Use mobile optimized and responsive AdSense ads<br />
|
26 |
+
* Disable AdSense ads on phone, tablet or desktop devices<br />
|
27 |
+
* Define AdSense sizes for different devices<br />
|
28 |
+
|
29 |
+
AMP feature requires [Automattic AMP plugin](http://wpquads.com/?utm_source=wp_org&utm_medium=plugin_page&utm_term=check_out_wp_quads&utm_campaign=wpquads) or any other AMP plugin installed <br />
|
30 |
+
Get WP QUADS PRO: [wpquads.com](http://wpquads.com/?utm_source=wp_org&utm_medium=plugin_page&utm_term=check_out_wp_quads&utm_campaign=wpquads) <br />
|
31 |
+
|
32 |
+
This AdSense plugin is rewritten from scratch with a solid code
|
33 |
+
base and will be maintained and updated to be compatible with all future WordPress versions<br />
|
34 |
+
Found a issue? Open a ticket in the [support forum](https://wordpress.org/support/plugin/quick-adsense-reloaded/ "support forum").
|
35 |
+
|
36 |
+
= Why a Quick AdSense fork? =
|
37 |
+
|
38 |
+
Quick Adsense is a great plugin and used by more than 100.000 websites.
|
39 |
+
Although is not under maintainance and development for more than 3 years by the original author it is still downloaded hundred times a day.
|
40 |
+
So i decided to continue the project to make sure the plugin will also work in future with new WordPress versions.
|
41 |
+
|
42 |
+
Deprecated functions removed, bugs fixed and new filters and hooks created to make this plugin extensible by third party developers!
|
43 |
+
|
44 |
+
<strong>We Guarantee: </strong><br>
|
45 |
+
No revenue sharing from your Google AdSense advertising income. We never show our ads on your website.<br>
|
46 |
+
We are an active and engaged member of the WordPress community and we are following strongly the WordPress Codex in terms of code quality and good behave.
|
47 |
+
|
48 |
+
= Main Features =
|
49 |
+
|
50 |
+
* Import all ads settings from Quick AdSense v. 1.9.2 and convert them into serialized options.
|
51 |
+
* Visibility conditions, show / hide ads based on post type and user roles (needs WP QUADS PRO)
|
52 |
+
* Quicktags of Quick Adsense are 100% compatible to Quick AdSense Reloaded
|
53 |
+
* No external script dependencies. All plugin code reside on your site.
|
54 |
+
* Dynamic AdSense positioning: Assign Google AdSense ads to the beginning, middle and end of post, assign ads after 'more' tag, before last paragraph, after certain paragraphs & assign Ads after certain images.
|
55 |
+
* Insert Google AdSense ads specifically or randomly anywhere within a post.
|
56 |
+
* Support any Ads code, not limited to Google Adsense ads only.
|
57 |
+
* Display up to a maximum of 10 Ads on a page. Google TOS allows publishers to place up to 3 Google Adsense for Content on a page. If you are using other ads, you may display up to 10 Ads.
|
58 |
+
* Support up to a maximum of 10 Ads codes on Sidebar Widgets.
|
59 |
+
* Support up to a maximum of 10 Ads codes for specific placement & randomization within a post.
|
60 |
+
* Insert Google AdSense ads on-the-fly, insert <!--Ads1-->, <!--Ads2--> ... , <!--RndAds--> to a post to accomplish this.
|
61 |
+
* Disable Ads on-the-fly, insert <!--NoAds-->, <!--OffDef-->, <!--OffWidget-->, <!--OffBegin--> ... and more to a post to accomplish this.
|
62 |
+
* The above quicktags can be inserted into a post easily via the additional Quicktag Buttons added to the HTML Edit Post SubPanel.
|
63 |
+
* Use shortcodes within ads (Suppport advertisements from other ad plugins for example Simple Ads Manager or AdRotate)
|
64 |
+
|
65 |
+
= Improvements to original Quick AdSense Ads plugin =
|
66 |
+
|
67 |
+
* Performance improvements
|
68 |
+
* Serialized storing of Ad options instead storing every single option as separate table entry all over
|
69 |
+
* Multi language support
|
70 |
+
* Remove of small coding issues like "unexpected output" message when plugin is activated on several sites
|
71 |
+
* Import / Export function makes plugin migrating to other sites easier. Copy your ads code to other sites.
|
72 |
+
|
73 |
+
= Safety improvements =
|
74 |
+
|
75 |
+
* Exit code if Quick AdSense plugin is not called by WordPress directly
|
76 |
+
* Better sanitizing of user input
|
77 |
+
|
78 |
+
= We Distance Ourself From =
|
79 |
+
These are known AdSense plugins which are removed from the WordPress repository because of non ethic behavior:
|
80 |
+
|
81 |
+
* AdSense Extreme
|
82 |
+
* AdSense Insert
|
83 |
+
|
84 |
+
Make sure to switch to WP QUADS or any other AdSense plugin if you are still using these plugins!
|
85 |
+
|
86 |
+
<h3>WP QUADS PRO:</h3>
|
87 |
+
|
88 |
+
* Support for responsive Google AdSense ads
|
89 |
+
* GUI improvements
|
90 |
+
|
91 |
+
Check out WP QUADS PRO: [wpquads.com](http://wpquads.com/?utm_source=wp_org&utm_medium=plugin_page&utm_term=check_out_wp_quads&utm_campaign=wpquads) <br />
|
92 |
+
|
93 |
+
Do you have suggestions for more features?
|
94 |
+
|
95 |
+
= High Performance =
|
96 |
+
|
97 |
+
Quick AdSense Reloaded is *coded well and developed for high performance*.
|
98 |
+
It loads only the code it needs at the moment of execution, making it small and fast and with a lot of hooks easy extensible by third party developers.
|
99 |
+
|
100 |
+
** GitHub **
|
101 |
+
Follow the development and improve the plugin.
|
102 |
+
You find it on [GitHub](https://github.com/rene-hermenau/quick-adsense-reloaded/)
|
103 |
+
|
104 |
+
|
105 |
+
== Frequently Asked Questions ==
|
106 |
+
|
107 |
+
Post your question in the [support forum](https://wordpress.org/support/plugin/quick-adsense-reloaded)
|
108 |
+
|
109 |
+
== Installation ==
|
110 |
+
|
111 |
+
Recommended Installation:
|
112 |
+
|
113 |
+
1. Go to YourWebsite->Plugins->Add New
|
114 |
+
2. Search for "Quick Adsense reloaded" or "WP QUADS"
|
115 |
+
3. Click "install Now"
|
116 |
+
|
117 |
+
Alternative Installation:
|
118 |
+
|
119 |
+
1. [Download the plugin](https://downloads.wordpress.org/plugin/quick-adsense-reloaded.latest-stable.zip) , unzip and place it in your wp-content/plugins/ folder.
|
120 |
+
2. Activate the plugin through the 'Plugins' menu in WordPress.
|
121 |
+
|
122 |
+
== Screenshots ==
|
123 |
+
|
124 |
+
1. The Quick AdSense Settings page
|
125 |
+
2. General Settings
|
126 |
+
3. AdSense Widgets
|
127 |
+
4. AdSense Options from the post editor
|
128 |
+
|
129 |
+
|
130 |
+
== Changelog ==
|
131 |
+
|
132 |
+
= 1.7.0 =
|
133 |
+
* New: VI Integration
|
134 |
+
* New: Compatible up to WP 4.9
|
135 |
+
|
136 |
+
= 1.6.2 =
|
137 |
+
* New: Make ajax condition activateable
|
138 |
+
|
139 |
+
= 1.6.1 =
|
140 |
+
* Fix: Never show ads on ajax generated pages
|
141 |
+
* New: Filter to ignore display conditions for short code generated ads
|
142 |
+
* New: Announcement for the integration of the video SSP vi.ai
|
143 |
+
|
144 |
+
= 1.6.0 =
|
145 |
+
* Fix: Remove empty div after adsense ads
|
146 |
+
* Fix: Margin and alignment option not working for widget ads
|
147 |
+
* New: Add id on select elements
|
148 |
+
|
149 |
+
= 1.5.8 / 1.5.9=
|
150 |
+
* Fix: Not more than 10 adsense ads at the same time possible
|
151 |
+
|
152 |
+
= 1.5.7 =
|
153 |
+
* Tweak: Remove external empty quads.css file
|
154 |
+
* Tweak: Better wordings for ad blocker notice
|
155 |
+
* Tweak: Make code more robust
|
156 |
+
* Tweak: Simpler notice for renewing license keys
|
157 |
+
* Tweak: Change admin bar warning color from red to a more suitable orange
|
158 |
+
* Fix: Remove jQuery frontpage check
|
159 |
+
* Fix: Rating notice not hiding
|
160 |
+
|
161 |
+
= 1.5.6 =
|
162 |
+
* Fix: License tab not shown after update of WP QUADS to version 1.5.5 and WP QUADS PRO is lower than version 1.3.3
|
163 |
+
* Fix: Quicktags button in editor not shown
|
164 |
+
* Fix: Margin option not working when ad layout floating option is default
|
165 |
+
|
166 |
+
= 1.5.5 =
|
167 |
+
* Fix: No ad position visible after new installation
|
168 |
+
* Fix: Show Add new Ad button only when wp quads pro is installed
|
169 |
+
|
170 |
+
= 1.5.4 =
|
171 |
+
* Fix: Hide widget on homepage option not working
|
172 |
+
* Tweak: Change default value of ad limitation to unlimited ads
|
173 |
+
* Tweak: Clean up code
|
174 |
+
|
175 |
+
= 1.5.3 =
|
176 |
+
* New: Unlimited amount of ads can be used with WP QUADS PRO
|
177 |
+
* Tweak: Move debug setting to tab plugin settings
|
178 |
+
* Fix: Security Update! If you are using WP QUADS Pro you need to update WP QUADS Pro to version 1.3.6.
|
179 |
+
* Fix: If page or post is used as frontpage the home page condition is ignored
|
180 |
+
* Fix: Better sanitization - remove all whitespaces in settings
|
181 |
+
* Fix: Ads are not shown on tablet device if mobile device visibility is disabled
|
182 |
+
|
183 |
+
= 1.5.2 =
|
184 |
+
* Tweak: Make sure that for AdSense ads only the AdSense ad option is used and not the plain text one
|
185 |
+
* Fix: Spelling issue
|
186 |
+
|
187 |
+
= 1.5.1 =
|
188 |
+
* Tweak: Change description in readme.txt
|
189 |
+
* Fix: Show only active and not empty widgets in widget admin section of wordpress
|
190 |
+
|
191 |
+
= 1.5.0 =
|
192 |
+
* Fix: PHP7 compatibility fixes
|
193 |
+
* Fix: Check if element wpquads-adblock-notice exists before accessing it
|
194 |
+
* Fix: Remove deprecated functions
|
195 |
+
|
196 |
+
= 1.4.9 =
|
197 |
+
* Fix: Adblock plugin is breaking wp quads admin settings. Create a admin notice to deactivate ad blocker browser extension
|
198 |
+
* Tweak: Remove 'Get WP QUADS Pro' button if wp quads pro is already installed
|
199 |
+
|
200 |
+
= 1.4.8 =
|
201 |
+
* New: Ability to rename adsense ads to better identify them
|
202 |
+
* New: Allow unlimited number of adsense ads on a single page
|
203 |
+
* New: Tested up to WP 4.7.3
|
204 |
+
* Tweak: Rename adsense widgets
|
205 |
+
|
206 |
+
Complete changelog: https://wpquads.com/changelog
|
207 |
+
|
208 |
+
== Upgrade Notice ==
|
209 |
+
|
210 |
+
= 1.5.3 =
|
211 |
+
1.4.3 This new version brings a ton of improvements and small fixes - WP QUADS<a href="https://wordpress.org/plugins/quick-adsense-reloaded/changelog/" style="color:white;text-decoration: underline;">Complete changelog! </a>
|
uninstall.php
CHANGED
@@ -39,6 +39,17 @@ if( quads_get_option_uninstall( 'uninstall_on_delete' ) ) {
|
|
39 |
delete_option( 'quads_show_update_notice' );
|
40 |
delete_option( 'quads_settings_1_5_2' );
|
41 |
delete_option( 'quads_show_update_notice_1_5_2' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
/* Delete all post meta options */
|
44 |
delete_post_meta_by_key( 'quads_timestamp' );
|
39 |
delete_option( 'quads_show_update_notice' );
|
40 |
delete_option( 'quads_settings_1_5_2' );
|
41 |
delete_option( 'quads_show_update_notice_1_5_2' );
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Delete all vi settings
|
45 |
+
*/
|
46 |
+
delete_option( 'quads_close_vi_welcome_notice' );
|
47 |
+
delete_option( 'quads_close_vi_notice' );
|
48 |
+
delete_option( 'quads_vi_ads' );
|
49 |
+
delete_option( 'quads_vi_settings' );
|
50 |
+
delete_option( 'quads_vi_revenue' );
|
51 |
+
delete_option( 'quads_vi_variant' );
|
52 |
+
delete_option( 'quads_vi_token' );
|
53 |
|
54 |
/* Delete all post meta options */
|
55 |
delete_post_meta_by_key( 'quads_timestamp' );
|