Version Description
- Fixed: Conflict with WP5.6.
Download this release
Release Info
Developer | 10web |
Plugin | WD Google Analytics |
Version | 1.2.10 |
Comparing to | |
See all releases |
Code changes from version 1.2.9 to 1.2.10
- admin/pages/browser.php +10 -10
- admin/pages/real_time.php +16 -16
- admin/pages/visitors.php +10 -10
- config.php +19 -19
- google-analytics-wd.php +331 -331
- inc/css/bootstrap-chosen.css +330 -330
- inc/css/bootstrap-select.css +281 -281
- inc/css/daterangepicker.css +233 -233
- inc/css/font_awesome.css +3 -3
- inc/css/gawd_front.css +4 -4
- inc/css/jquery-ui.css +565 -565
- inc/css/jquery.datetimepicker.css +418 -418
- inc/js/StackBlur.js +654 -654
- inc/js/bootstrap-select.js +1709 -1709
- inc/js/canvg.js +3095 -3095
- inc/js/chosen.jquery.js +1284 -1284
- inc/js/gawd_admin.js +3738 -3738
- inc/js/gawd_overview.js +158 -156
- inc/js/images/lens.svg +6 -6
- inc/js/jquery.cookie.js +117 -117
- inc/js/js_highlight.js +1 -1
- inc/js/loader.js +0 -91
admin/pages/browser.php
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
<div class="">
|
4 |
-
<div class="opacity_div_compact">
|
5 |
-
<div class="loading_div_compact">
|
6 |
-
<img src="<?php echo GAWD_URL . '/assets/ajax_loader.gif'; ?>" style="margin-top: 200px; width:50px;">
|
7 |
-
</div>
|
8 |
-
</div>
|
9 |
-
<div id="gawd_browser_meta"></div>
|
10 |
-
</div>
|
1 |
+
|
2 |
+
|
3 |
+
<div class="">
|
4 |
+
<div class="opacity_div_compact">
|
5 |
+
<div class="loading_div_compact">
|
6 |
+
<img src="<?php echo GAWD_URL . '/assets/ajax_loader.gif'; ?>" style="margin-top: 200px; width:50px;">
|
7 |
+
</div>
|
8 |
+
</div>
|
9 |
+
<div id="gawd_browser_meta"></div>
|
10 |
+
</div>
|
admin/pages/real_time.php
CHANGED
@@ -1,17 +1,17 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
<div class="">
|
4 |
-
<div class="opacity_div_compact">
|
5 |
-
<div class="loading_div_compact">
|
6 |
-
<img src="<?php echo GAWD_URL . '/assets/ajax_loader.gif'; ?>" style="margin-top: 30px; width:50px;">
|
7 |
-
</div>
|
8 |
-
</div>
|
9 |
-
|
10 |
-
<div id="gawd_real_time_meta"></div>
|
11 |
-
</div>
|
12 |
-
<script>
|
13 |
-
jQuery(document).ready(function(){
|
14 |
-
gawd_widget_real_time('#gawd_real_time_meta');
|
15 |
-
|
16 |
-
})
|
17 |
</script>
|
1 |
+
|
2 |
+
|
3 |
+
<div class="">
|
4 |
+
<div class="opacity_div_compact">
|
5 |
+
<div class="loading_div_compact">
|
6 |
+
<img src="<?php echo GAWD_URL . '/assets/ajax_loader.gif'; ?>" style="margin-top: 30px; width:50px;">
|
7 |
+
</div>
|
8 |
+
</div>
|
9 |
+
|
10 |
+
<div id="gawd_real_time_meta"></div>
|
11 |
+
</div>
|
12 |
+
<script>
|
13 |
+
jQuery(document).ready(function(){
|
14 |
+
gawd_widget_real_time('#gawd_real_time_meta');
|
15 |
+
|
16 |
+
})
|
17 |
</script>
|
admin/pages/visitors.php
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
<div class="">
|
4 |
-
<div class="opacity_div_compact">
|
5 |
-
<div class="loading_div_compact">
|
6 |
-
<img src="<?php echo GAWD_URL . '/assets/ajax_loader.gif'; ?>" style="margin-top: 200px; width:50px;">
|
7 |
-
</div>
|
8 |
-
</div>
|
9 |
-
<div id="gawd_visitors_meta"></div>
|
10 |
-
</div>
|
1 |
+
|
2 |
+
|
3 |
+
<div class="">
|
4 |
+
<div class="opacity_div_compact">
|
5 |
+
<div class="loading_div_compact">
|
6 |
+
<img src="<?php echo GAWD_URL . '/assets/ajax_loader.gif'; ?>" style="margin-top: 200px; width:50px;">
|
7 |
+
</div>
|
8 |
+
</div>
|
9 |
+
<div id="gawd_visitors_meta"></div>
|
10 |
+
</div>
|
config.php
CHANGED
@@ -1,20 +1,20 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Created by PhpStorm.
|
4 |
-
* User: mher
|
5 |
-
* Date: 1/19/18
|
6 |
-
* Time: 4:34 PM
|
7 |
-
*/
|
8 |
-
|
9 |
-
if(!defined('GAWD_DIR')) {
|
10 |
-
|
11 |
-
define('GAWD_DIR', dirname(__FILE__));
|
12 |
-
define('GAWD_LIB_DIR', GAWD_DIR . '/library');
|
13 |
-
define('GWD_NAME', plugin_basename(dirname(__FILE__)));
|
14 |
-
define('GAWD_URL', plugins_url(plugin_basename(dirname(__FILE__))));
|
15 |
-
define('GAWD_INC', GAWD_URL . '/inc');
|
16 |
-
define('GAWD_VERSION', '1.2.
|
17 |
-
|
18 |
-
$upload_dir = wp_upload_dir();
|
19 |
-
define('GAWD_UPLOAD_DIR', $upload_dir['basedir'] . '/' . plugin_basename(dirname(__FILE__)));
|
20 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: mher
|
5 |
+
* Date: 1/19/18
|
6 |
+
* Time: 4:34 PM
|
7 |
+
*/
|
8 |
+
|
9 |
+
if(!defined('GAWD_DIR')) {
|
10 |
+
|
11 |
+
define('GAWD_DIR', dirname(__FILE__));
|
12 |
+
define('GAWD_LIB_DIR', GAWD_DIR . '/library');
|
13 |
+
define('GWD_NAME', plugin_basename(dirname(__FILE__)));
|
14 |
+
define('GAWD_URL', plugins_url(plugin_basename(dirname(__FILE__))));
|
15 |
+
define('GAWD_INC', GAWD_URL . '/inc');
|
16 |
+
define('GAWD_VERSION', '1.2.10');
|
17 |
+
|
18 |
+
$upload_dir = wp_upload_dir();
|
19 |
+
define('GAWD_UPLOAD_DIR', $upload_dir['basedir'] . '/' . plugin_basename(dirname(__FILE__)));
|
20 |
}
|
google-analytics-wd.php
CHANGED
@@ -1,332 +1,332 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Plugin Name: 10WebAnalytics
|
4 |
-
* Plugin URI: https://10web.io/plugins/wordpress-google-analytics/
|
5 |
-
* Version: 1.2.
|
6 |
-
* Author: 10Web
|
7 |
-
* Author URI: https://10web.io/plugins/
|
8 |
-
* License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
-
*/
|
10 |
-
|
11 |
-
require_once "config.php";
|
12 |
-
|
13 |
-
if(version_compare(PHP_VERSION, '5.4.0') >= 0) {
|
14 |
-
|
15 |
-
|
16 |
-
require_once 'library/gawd-logs.php';
|
17 |
-
require_once 'library/gawd-helper-class.php';
|
18 |
-
|
19 |
-
|
20 |
-
add_action('pre_update_option_gawd_user_data', array('GAWD_helper', 'gawd_user_data_updated'), 3, 10);
|
21 |
-
|
22 |
-
if(isset($_REQUEST['gawd_ajax']) && $_REQUEST['gawd_ajax'] === '1') {
|
23 |
-
|
24 |
-
require_once('library/gawd-custom-ajax-class.php');
|
25 |
-
require_once('library/gawd-exception-handler.php');
|
26 |
-
$gawd_ajax = new GAWD_custom_ajax_class();
|
27 |
-
|
28 |
-
} else {
|
29 |
-
add_action("init", "gawd_web_init", 9);
|
30 |
-
|
31 |
-
require_once('gawd_class.php');
|
32 |
-
add_action('plugins_loaded', array('GAWD', 'get_instance'));
|
33 |
-
|
34 |
-
register_activation_hook(__FILE__, array('GAWD', 'global_activate'));
|
35 |
-
register_deactivation_hook(__FILE__, array('GAWD', 'deactivate'));
|
36 |
-
}
|
37 |
-
} else {
|
38 |
-
add_action('admin_notices', 'gawd_php_version_admin_notice');
|
39 |
-
}
|
40 |
-
|
41 |
-
function gawd_php_version_admin_notice(){
|
42 |
-
?>
|
43 |
-
<div class="notice notice-error">
|
44 |
-
<h3>10Web Analytics</h3>
|
45 |
-
<p><?php _e('This version of the plugin uses the latest Google library requiring PHP 5.4.0 or higher.', 'gawd'); ?></p>
|
46 |
-
<p><?php _e('We recommend you to update PHP or ask your hosting provider to do that. ', 'gawd');
|
47 |
-
printf(__('If it is not possible and you previously had 10Web Analytics Premium version installed, please ask 10Web to send you an older version of the plugin supporting PHP 5.3 %s', 'gawd'),
|
48 |
-
'<a href="https://help.10web.io/hc/en-us/requests/new" target="_blank">' . __('Contact us', 'gawd') . '</a>'
|
49 |
-
); ?></p>
|
50 |
-
|
51 |
-
</div>
|
52 |
-
<?php
|
53 |
-
}
|
54 |
-
|
55 |
-
function gawd_web_init() {
|
56 |
-
if (is_admin() && !isset($_REQUEST['ajax'])) {
|
57 |
-
global $gawd_options;
|
58 |
-
if ( !class_exists("TenWebLib") ) {
|
59 |
-
$plugin_dir = apply_filters('tenweb_free_users_lib_path', array(
|
60 |
-
'version' => '1.1.1',
|
61 |
-
'path' => GAWD_DIR,
|
62 |
-
));
|
63 |
-
require_once($plugin_dir['path'] . '/wd/start.php');
|
64 |
-
}
|
65 |
-
$gawd_options = array(
|
66 |
-
"prefix" => "gawd",
|
67 |
-
"wd_plugin_id" => 158,
|
68 |
-
"plugin_id" => 45,
|
69 |
-
"plugin_title" => "10Web Analytics",
|
70 |
-
"plugin_wordpress_slug" => "wd-google-analytics",
|
71 |
-
"plugin_dir" => GAWD_DIR,
|
72 |
-
"plugin_main_file" => __FILE__,
|
73 |
-
"description" => __('Analytics by 10Web WordPress plugin - a certified member of Google Analytics Technology Partners Program.
|
74 |
-
With a large number of detailed and user-friendly reports, 10Web Analytics plugin is just the right choice for you!', 'gawd'),
|
75 |
-
"addons" => NULL,
|
76 |
-
"plugin_features" => array(
|
77 |
-
0 => array(
|
78 |
-
"title" => __("Tracking Code and Options", "gawd"),
|
79 |
-
"description" => __("You can add Google Analytics tracking to your website using this plugin. Various options let you configure desired tracking settings. You can also exclude traffic from certain users, role types, IP address, country, city or region.", "gawd"),
|
80 |
-
),
|
81 |
-
1 => array(
|
82 |
-
"title" => __("All Analytics Reports", "gawd"),
|
83 |
-
"description" => __("10Web Analytics provides various reports, including Age, Gender, Demographics and Interests, Behavior and Technology, as well as Ecommerce tracking, Custom Dimensions and Custom Reports. Just as in Google Analytics, you can compare tracking reports of two metrics with elegantly designed Line, Pie and Column charts.", "gawd"),
|
84 |
-
),
|
85 |
-
2 => array(
|
86 |
-
"title" => __("Page and Post Reports", "gawd"),
|
87 |
-
"description" => __("Each of your publications can have their own reports of Google Analytics. This lets authors to keep track of sessions on their posts and pages, giving full information about user activities.", "gawd"),
|
88 |
-
),
|
89 |
-
3 => array(
|
90 |
-
"title" => __("Frontend Reports", "gawd"),
|
91 |
-
"description" => __("Permit Editors, Authors or other user roles to check page or post statistics, while reviewing content from the frontend of your website. A quick report will provide key information about activities within that particular post.", "gawd"),
|
92 |
-
),
|
93 |
-
4 => array(
|
94 |
-
"title" => __("Ecommerce Tracking", "gawd"),
|
95 |
-
"description" => __("You can check revenues and performance of sales of your online shop. The plugin lets you keep up with product or category tracking, as well as product SKU and transaction IDs.", "gawd"),
|
96 |
-
),
|
97 |
-
),
|
98 |
-
"user_guide" => array(
|
99 |
-
0 => array(
|
100 |
-
"main_title" => __("Installing 10Web Analytics", "gawd"),
|
101 |
-
"url" => "https://help.10web.io/hc/en-us/articles/360017502592-Introducing-WordPress-Google-Analytics",
|
102 |
-
"titles" => array(),
|
103 |
-
),
|
104 |
-
1 => array(
|
105 |
-
"main_title" => __("Quick Start", "gawd"),
|
106 |
-
"url" => "https://help.10web.io/hc/en-us/articles/360017505232-Authenticating-Google-Analytics",
|
107 |
-
"titles" => array(
|
108 |
-
array(
|
109 |
-
"title" => __("Overview", "gawd"),
|
110 |
-
"url" => "https://help.10web.io/hc/en-us/articles/360017502592-Introducing-WordPress-Google-Analytics",
|
111 |
-
),
|
112 |
-
),
|
113 |
-
),
|
114 |
-
2 => array(
|
115 |
-
"main_title" => __("Report Types", "gawd"),
|
116 |
-
"url" => "https://help.10web.io/hc/en-us/articles/360017506312-Google-Analytics-Reports",
|
117 |
-
"titles" => array(),
|
118 |
-
),
|
119 |
-
3 => array(
|
120 |
-
"main_title" => __("Global description", "gawd"),
|
121 |
-
"url" => "https://help.10web.io/hc/en-us/articles/360017506312-Google-Analytics-Reports",
|
122 |
-
"titles" => array(
|
123 |
-
array(
|
124 |
-
"title" => __("Metrics", "gawd"),
|
125 |
-
"url" => "https://help.10web.io/hc/en-us/articles/360017506312-Google-Analytics-Reports",
|
126 |
-
),
|
127 |
-
array(
|
128 |
-
"title" => __("Charts", "gawd"),
|
129 |
-
"url" => "https://help.10web.io/hc/en-us/articles/360017506312-Google-Analytics-Reports",
|
130 |
-
),
|
131 |
-
array(
|
132 |
-
"title" => __("Date range", "gawd"),
|
133 |
-
"url" => "https://help.10web.io/hc/en-us/articles/360017506312-Google-Analytics-Reports",
|
134 |
-
),
|
135 |
-
array(
|
136 |
-
"title" => __("Compare Date", "gawd"),
|
137 |
-
"url" => "https://help.10web.io/hc/en-us/articles/360017506312-Google-Analytics-Reports",
|
138 |
-
),
|
139 |
-
array(
|
140 |
-
"title" => __("Export and Email", "gawd"),
|
141 |
-
"url" => "https://help.10web.io/hc/en-us/articles/360017506312-Google-Analytics-Reports",
|
142 |
-
),
|
143 |
-
),
|
144 |
-
),
|
145 |
-
4 => array(
|
146 |
-
"main_title" => __("Settings", "gawd"),
|
147 |
-
"url" => "https://help.10web.io/hc/en-us/articles/360018132671-Google-Analytics-Settings",
|
148 |
-
"titles" => array(
|
149 |
-
array(
|
150 |
-
"title" => __("Use your own project", "gawd"),
|
151 |
-
"url" => "https://help.10web.io/hc/en-us/articles/360018132771-Using-Your-Own-Project",
|
152 |
-
),
|
153 |
-
array(
|
154 |
-
"title" => __("Alerts & Pushover", "gawd"),
|
155 |
-
"url" => "https://web-dorado.com/wordpress-google-analytics/settings/alerts-pushover.html",
|
156 |
-
),
|
157 |
-
array(
|
158 |
-
"title" => __("Filters", "gawd"),
|
159 |
-
"url" => "https://web-dorado.com/wordpress-google-analytics/settings/filters.html",
|
160 |
-
),
|
161 |
-
array(
|
162 |
-
"title" => __("Emails", "gawd"),
|
163 |
-
"url" => "https://web-dorado.com/wordpress-google-analytics/settings/emails.html",
|
164 |
-
),
|
165 |
-
array(
|
166 |
-
"title" => __("Advanced", "gawd"),
|
167 |
-
"url" => "https://web-dorado.com/wordpress-google-analytics/settings/advanced.html",
|
168 |
-
),
|
169 |
-
array(
|
170 |
-
"title" => __("AdSense and AdWords account linking", "gawd"),
|
171 |
-
"url" => "https://web-dorado.com/wordpress-google-analytics/settings/adsense-and-adwords-account-linking.html",
|
172 |
-
),
|
173 |
-
),
|
174 |
-
),
|
175 |
-
5 => array(
|
176 |
-
"main_title" => __("Tracking", "gawd"),
|
177 |
-
"url" => "https://web-dorado.com/wordpress-google-analytics/tracking.html",
|
178 |
-
"titles" => array(
|
179 |
-
array(
|
180 |
-
"title" => __("Custom Dimensions", "gawd"),
|
181 |
-
"url" => "https://web-dorado.com/wordpress-google-analytics/tracking/custom-dimensions.html",
|
182 |
-
),
|
183 |
-
array(
|
184 |
-
"title" => __("Exclude", "gawd"),
|
185 |
-
"url" => "https://web-dorado.com/wordpress-google-analytics/tracking/exclude.html",
|
186 |
-
),
|
187 |
-
),
|
188 |
-
),
|
189 |
-
6 => array(
|
190 |
-
"main_title" => __("Goal Management", "gawd"),
|
191 |
-
"url" => "https://web-dorado.com/wordpress-google-analytics/goal-management.html",
|
192 |
-
"titles" => array(),
|
193 |
-
),
|
194 |
-
7 => array(
|
195 |
-
"main_title" => __("Custom Reports", "gawd"),
|
196 |
-
"url" => "https://help.10web.io/hc/en-us/articles/360018133271-Custom-Reports",
|
197 |
-
"titles" => array(),
|
198 |
-
),
|
199 |
-
),
|
200 |
-
"video_youtube_id" => "n1f7ECVFNPI",
|
201 |
-
"plugin_wd_url" => "https://10web.io/plugins/wordpress-google-analytics/?utm_source=10web_analytics&utm_medium=free_plugin",
|
202 |
-
"plugin_wd_demo_link" => "https://admindemo.10web.io/?product_name=google-analytics",
|
203 |
-
"plugin_wd_addons_link" => "",
|
204 |
-
"plugin_wizard_link" => NULL,
|
205 |
-
"plugin_wd_docs_link" => "https://help.10web.io/hc/en-us/sections/360002488232-Google-Analytics",
|
206 |
-
"after_subscribe" => admin_url('admin.php?page=gawd_settings'),
|
207 |
-
"plugin_menu_title" => "Analytics",
|
208 |
-
"plugin_menu_icon" => GAWD_URL . '/assets/main_icon.png',
|
209 |
-
"menu_position" => "25, 13",
|
210 |
-
"custom_post" => "gawd_analytics",
|
211 |
-
"menu_capability" => "read",
|
212 |
-
"deactivate" => TRUE,
|
213 |
-
"subscribe" => TRUE,
|
214 |
-
"display_overview" => FALSE,
|
215 |
-
);
|
216 |
-
ten_web_lib_init($gawd_options);
|
217 |
-
}
|
218 |
-
}
|
219 |
-
|
220 |
-
add_filter('wp_get_default_privacy_policy_content', 'gawd_privacy_policy');
|
221 |
-
function gawd_privacy_policy($content){
|
222 |
-
$title = __('10Web Analytics', "gawd");
|
223 |
-
|
224 |
-
$pp_link = '<a target="_blank" href="https://policies.google.com/privacy">' . __('Privacy Policy', "gawd") . '</a>';
|
225 |
-
$text = sprintf(__('If you enable tracking code, explain that your site uses Google Analytics. Whether it will send any personal data to Google, depends on how you set up your website. For example, do not expose emails or other personally identifiable information to Google via URLs. Do not send form submissions via analytics to Google. By default, all the IPs of visitors are anonymized. If you change that setting, you must inform your website visitors on that. Personal data processing by Google is explained in their %s.', "gawd"), $pp_link);
|
226 |
-
$text .= "<br/>";
|
227 |
-
$text .= __('10Web Disclaimer: The above text is for informational purposes only and is not a legal advice. You must not rely on it as an alternative to legal advice. You should contact your legal counsel to obtain advice with respect to your particular case.', "gawd");
|
228 |
-
$pp_text = '<h3>' . $title . '</h3>' . '<p class="wp-policy-help">' . $text . '</p>';
|
229 |
-
|
230 |
-
$content .= $pp_text;
|
231 |
-
return $content;
|
232 |
-
}
|
233 |
-
|
234 |
-
if(!function_exists('gawd_wd_bp_install_notice')) {
|
235 |
-
|
236 |
-
if(get_option('wds_bk_notice_status') === '' || get_option('wds_bk_notice_status') === '1') {
|
237 |
-
return;
|
238 |
-
}
|
239 |
-
|
240 |
-
function gawd_wd_bp_script_style(){
|
241 |
-
$wd_bp_plugin_url = GAWD_URL;
|
242 |
-
|
243 |
-
$get_current = get_current_screen();
|
244 |
-
$current_screen_id = array(
|
245 |
-
'toplevel_page_gawd_analytics',
|
246 |
-
'analytics_page_gawd_reports',
|
247 |
-
'analytics_page_gawd_settings',
|
248 |
-
'analytics_page_gawd_tracking',
|
249 |
-
'analytics_page_gawd_goals',
|
250 |
-
'analytics_page_gawd_custom_reports',
|
251 |
-
'analytics_page_gawd_uninstall',
|
252 |
-
'analytics_page_overview_gawd',
|
253 |
-
'analytics_page_gawd_updates',
|
254 |
-
);
|
255 |
-
|
256 |
-
if(in_array($get_current->id, $current_screen_id)) {
|
257 |
-
wp_enqueue_script('wd_bck_install', $wd_bp_plugin_url . '/inc/js/wd_bp_install.js', array('jquery'));
|
258 |
-
wp_enqueue_style('wd_bck_install', $wd_bp_plugin_url . '/inc/css/wd_bp_install.css');
|
259 |
-
}
|
260 |
-
|
261 |
-
}
|
262 |
-
|
263 |
-
add_action('admin_enqueue_scripts', 'gawd_wd_bp_script_style');
|
264 |
-
|
265 |
-
/**
|
266 |
-
* Show notice to install backup plugin
|
267 |
-
*/
|
268 |
-
function gawd_wd_bp_install_notice(){
|
269 |
-
$wd_bp_plugin_url = GAWD_URL;
|
270 |
-
|
271 |
-
$get_current = get_current_screen();
|
272 |
-
$current_screen_id = array(
|
273 |
-
'toplevel_page_gawd_analytics',
|
274 |
-
'analytics_page_gawd_reports',
|
275 |
-
'analytics_page_gawd_settings',
|
276 |
-
'analytics_page_gawd_tracking',
|
277 |
-
'analytics_page_gawd_goals',
|
278 |
-
'analytics_page_gawd_custom_reports',
|
279 |
-
'analytics_page_gawd_uninstall',
|
280 |
-
'analytics_page_overview_gawd',
|
281 |
-
'analytics_page_gawd_updates',
|
282 |
-
);
|
283 |
-
|
284 |
-
if(!in_array($get_current->id, $current_screen_id)) {
|
285 |
-
return;
|
286 |
-
}
|
287 |
-
|
288 |
-
$prefix = 'gawd';
|
289 |
-
|
290 |
-
$meta_value = get_option('wd_seo_notice_status');
|
291 |
-
if ($meta_value === '' || $meta_value === false) {
|
292 |
-
ob_start();
|
293 |
-
?>
|
294 |
-
<div class="notice notice-info" id="wd_bp_notice_cont">
|
295 |
-
<p>
|
296 |
-
<img id="wd_bp_logo_notice" src="<?php echo $wd_bp_plugin_url . '/assets/seo_logo.png'; ?>">
|
297 |
-
<?php _e("10Web Analytics advises: Optimize your web pages for search engines with the", $prefix) ?>
|
298 |
-
<a href="https://wordpress.org/plugins/seo-by-10web/" title="<?php _e("More details", $prefix) ?>"
|
299 |
-
target="_blank"><?php _e("FREE SEO", $prefix) ?></a>
|
300 |
-
<?php _e("plugin.", $prefix) ?>
|
301 |
-
<a class="button button-primary"
|
302 |
-
href="<?php echo esc_url(wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=seo-by-10web'), 'install-plugin_seo-by-10web')); ?>">
|
303 |
-
<span onclick="wd_bp_notice_install()"><?php _e("Install", $prefix); ?></span>
|
304 |
-
</a>
|
305 |
-
</p>
|
306 |
-
<button type="button" class="wd_bp_notice_dissmiss notice-dismiss"><span class="screen-reader-text"></span>
|
307 |
-
</button>
|
308 |
-
</div>
|
309 |
-
<script>wd_bp_url = '<?php echo add_query_arg(array('action' => 'wd_seo_dismiss',), admin_url('admin-ajax.php')); ?>'</script>
|
310 |
-
|
311 |
-
<?php
|
312 |
-
echo ob_get_clean();
|
313 |
-
}
|
314 |
-
}
|
315 |
-
|
316 |
-
if (!is_dir(plugin_dir_path(dirname(__FILE__)) . 'seo-by-10web')) {
|
317 |
-
add_action('admin_notices', 'gawd_wd_bp_install_notice');
|
318 |
-
}
|
319 |
-
|
320 |
-
/**
|
321 |
-
* Add usermeta to db
|
322 |
-
*
|
323 |
-
* empty: notice,
|
324 |
-
* 1 : never show again
|
325 |
-
*/
|
326 |
-
|
327 |
-
function gawd_wd_bp_install_notice_status() {
|
328 |
-
update_option('wd_seo_notice_status', '1', 'no');
|
329 |
-
}
|
330 |
-
add_action('wp_ajax_wd_seo_dismiss', 'gawd_wd_bp_install_notice_status');
|
331 |
-
|
332 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Plugin Name: 10WebAnalytics
|
4 |
+
* Plugin URI: https://10web.io/plugins/wordpress-google-analytics/
|
5 |
+
* Version: 1.2.10
|
6 |
+
* Author: 10Web
|
7 |
+
* Author URI: https://10web.io/plugins/
|
8 |
+
* License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
+
*/
|
10 |
+
|
11 |
+
require_once "config.php";
|
12 |
+
|
13 |
+
if(version_compare(PHP_VERSION, '5.4.0') >= 0) {
|
14 |
+
|
15 |
+
|
16 |
+
require_once 'library/gawd-logs.php';
|
17 |
+
require_once 'library/gawd-helper-class.php';
|
18 |
+
|
19 |
+
|
20 |
+
add_action('pre_update_option_gawd_user_data', array('GAWD_helper', 'gawd_user_data_updated'), 3, 10);
|
21 |
+
|
22 |
+
if(isset($_REQUEST['gawd_ajax']) && $_REQUEST['gawd_ajax'] === '1') {
|
23 |
+
|
24 |
+
require_once('library/gawd-custom-ajax-class.php');
|
25 |
+
require_once('library/gawd-exception-handler.php');
|
26 |
+
$gawd_ajax = new GAWD_custom_ajax_class();
|
27 |
+
|
28 |
+
} else {
|
29 |
+
add_action("init", "gawd_web_init", 9);
|
30 |
+
|
31 |
+
require_once('gawd_class.php');
|
32 |
+
add_action('plugins_loaded', array('GAWD', 'get_instance'));
|
33 |
+
|
34 |
+
register_activation_hook(__FILE__, array('GAWD', 'global_activate'));
|
35 |
+
register_deactivation_hook(__FILE__, array('GAWD', 'deactivate'));
|
36 |
+
}
|
37 |
+
} else {
|
38 |
+
add_action('admin_notices', 'gawd_php_version_admin_notice');
|
39 |
+
}
|
40 |
+
|
41 |
+
function gawd_php_version_admin_notice(){
|
42 |
+
?>
|
43 |
+
<div class="notice notice-error">
|
44 |
+
<h3>10Web Analytics</h3>
|
45 |
+
<p><?php _e('This version of the plugin uses the latest Google library requiring PHP 5.4.0 or higher.', 'gawd'); ?></p>
|
46 |
+
<p><?php _e('We recommend you to update PHP or ask your hosting provider to do that. ', 'gawd');
|
47 |
+
printf(__('If it is not possible and you previously had 10Web Analytics Premium version installed, please ask 10Web to send you an older version of the plugin supporting PHP 5.3 %s', 'gawd'),
|
48 |
+
'<a href="https://help.10web.io/hc/en-us/requests/new" target="_blank">' . __('Contact us', 'gawd') . '</a>'
|
49 |
+
); ?></p>
|
50 |
+
|
51 |
+
</div>
|
52 |
+
<?php
|
53 |
+
}
|
54 |
+
|
55 |
+
function gawd_web_init() {
|
56 |
+
if (is_admin() && !isset($_REQUEST['ajax'])) {
|
57 |
+
global $gawd_options;
|
58 |
+
if ( !class_exists("TenWebLib") ) {
|
59 |
+
$plugin_dir = apply_filters('tenweb_free_users_lib_path', array(
|
60 |
+
'version' => '1.1.1',
|
61 |
+
'path' => GAWD_DIR,
|
62 |
+
));
|
63 |
+
require_once($plugin_dir['path'] . '/wd/start.php');
|
64 |
+
}
|
65 |
+
$gawd_options = array(
|
66 |
+
"prefix" => "gawd",
|
67 |
+
"wd_plugin_id" => 158,
|
68 |
+
"plugin_id" => 45,
|
69 |
+
"plugin_title" => "10Web Analytics",
|
70 |
+
"plugin_wordpress_slug" => "wd-google-analytics",
|
71 |
+
"plugin_dir" => GAWD_DIR,
|
72 |
+
"plugin_main_file" => __FILE__,
|
73 |
+
"description" => __('Analytics by 10Web WordPress plugin - a certified member of Google Analytics Technology Partners Program.
|
74 |
+
With a large number of detailed and user-friendly reports, 10Web Analytics plugin is just the right choice for you!', 'gawd'),
|
75 |
+
"addons" => NULL,
|
76 |
+
"plugin_features" => array(
|
77 |
+
0 => array(
|
78 |
+
"title" => __("Tracking Code and Options", "gawd"),
|
79 |
+
"description" => __("You can add Google Analytics tracking to your website using this plugin. Various options let you configure desired tracking settings. You can also exclude traffic from certain users, role types, IP address, country, city or region.", "gawd"),
|
80 |
+
),
|
81 |
+
1 => array(
|
82 |
+
"title" => __("All Analytics Reports", "gawd"),
|
83 |
+
"description" => __("10Web Analytics provides various reports, including Age, Gender, Demographics and Interests, Behavior and Technology, as well as Ecommerce tracking, Custom Dimensions and Custom Reports. Just as in Google Analytics, you can compare tracking reports of two metrics with elegantly designed Line, Pie and Column charts.", "gawd"),
|
84 |
+
),
|
85 |
+
2 => array(
|
86 |
+
"title" => __("Page and Post Reports", "gawd"),
|
87 |
+
"description" => __("Each of your publications can have their own reports of Google Analytics. This lets authors to keep track of sessions on their posts and pages, giving full information about user activities.", "gawd"),
|
88 |
+
),
|
89 |
+
3 => array(
|
90 |
+
"title" => __("Frontend Reports", "gawd"),
|
91 |
+
"description" => __("Permit Editors, Authors or other user roles to check page or post statistics, while reviewing content from the frontend of your website. A quick report will provide key information about activities within that particular post.", "gawd"),
|
92 |
+
),
|
93 |
+
4 => array(
|
94 |
+
"title" => __("Ecommerce Tracking", "gawd"),
|
95 |
+
"description" => __("You can check revenues and performance of sales of your online shop. The plugin lets you keep up with product or category tracking, as well as product SKU and transaction IDs.", "gawd"),
|
96 |
+
),
|
97 |
+
),
|
98 |
+
"user_guide" => array(
|
99 |
+
0 => array(
|
100 |
+
"main_title" => __("Installing 10Web Analytics", "gawd"),
|
101 |
+
"url" => "https://help.10web.io/hc/en-us/articles/360017502592-Introducing-WordPress-Google-Analytics",
|
102 |
+
"titles" => array(),
|
103 |
+
),
|
104 |
+
1 => array(
|
105 |
+
"main_title" => __("Quick Start", "gawd"),
|
106 |
+
"url" => "https://help.10web.io/hc/en-us/articles/360017505232-Authenticating-Google-Analytics",
|
107 |
+
"titles" => array(
|
108 |
+
array(
|
109 |
+
"title" => __("Overview", "gawd"),
|
110 |
+
"url" => "https://help.10web.io/hc/en-us/articles/360017502592-Introducing-WordPress-Google-Analytics",
|
111 |
+
),
|
112 |
+
),
|
113 |
+
),
|
114 |
+
2 => array(
|
115 |
+
"main_title" => __("Report Types", "gawd"),
|
116 |
+
"url" => "https://help.10web.io/hc/en-us/articles/360017506312-Google-Analytics-Reports",
|
117 |
+
"titles" => array(),
|
118 |
+
),
|
119 |
+
3 => array(
|
120 |
+
"main_title" => __("Global description", "gawd"),
|
121 |
+
"url" => "https://help.10web.io/hc/en-us/articles/360017506312-Google-Analytics-Reports",
|
122 |
+
"titles" => array(
|
123 |
+
array(
|
124 |
+
"title" => __("Metrics", "gawd"),
|
125 |
+
"url" => "https://help.10web.io/hc/en-us/articles/360017506312-Google-Analytics-Reports",
|
126 |
+
),
|
127 |
+
array(
|
128 |
+
"title" => __("Charts", "gawd"),
|
129 |
+
"url" => "https://help.10web.io/hc/en-us/articles/360017506312-Google-Analytics-Reports",
|
130 |
+
),
|
131 |
+
array(
|
132 |
+
"title" => __("Date range", "gawd"),
|
133 |
+
"url" => "https://help.10web.io/hc/en-us/articles/360017506312-Google-Analytics-Reports",
|
134 |
+
),
|
135 |
+
array(
|
136 |
+
"title" => __("Compare Date", "gawd"),
|
137 |
+
"url" => "https://help.10web.io/hc/en-us/articles/360017506312-Google-Analytics-Reports",
|
138 |
+
),
|
139 |
+
array(
|
140 |
+
"title" => __("Export and Email", "gawd"),
|
141 |
+
"url" => "https://help.10web.io/hc/en-us/articles/360017506312-Google-Analytics-Reports",
|
142 |
+
),
|
143 |
+
),
|
144 |
+
),
|
145 |
+
4 => array(
|
146 |
+
"main_title" => __("Settings", "gawd"),
|
147 |
+
"url" => "https://help.10web.io/hc/en-us/articles/360018132671-Google-Analytics-Settings",
|
148 |
+
"titles" => array(
|
149 |
+
array(
|
150 |
+
"title" => __("Use your own project", "gawd"),
|
151 |
+
"url" => "https://help.10web.io/hc/en-us/articles/360018132771-Using-Your-Own-Project",
|
152 |
+
),
|
153 |
+
array(
|
154 |
+
"title" => __("Alerts & Pushover", "gawd"),
|
155 |
+
"url" => "https://web-dorado.com/wordpress-google-analytics/settings/alerts-pushover.html",
|
156 |
+
),
|
157 |
+
array(
|
158 |
+
"title" => __("Filters", "gawd"),
|
159 |
+
"url" => "https://web-dorado.com/wordpress-google-analytics/settings/filters.html",
|
160 |
+
),
|
161 |
+
array(
|
162 |
+
"title" => __("Emails", "gawd"),
|
163 |
+
"url" => "https://web-dorado.com/wordpress-google-analytics/settings/emails.html",
|
164 |
+
),
|
165 |
+
array(
|
166 |
+
"title" => __("Advanced", "gawd"),
|
167 |
+
"url" => "https://web-dorado.com/wordpress-google-analytics/settings/advanced.html",
|
168 |
+
),
|
169 |
+
array(
|
170 |
+
"title" => __("AdSense and AdWords account linking", "gawd"),
|
171 |
+
"url" => "https://web-dorado.com/wordpress-google-analytics/settings/adsense-and-adwords-account-linking.html",
|
172 |
+
),
|
173 |
+
),
|
174 |
+
),
|
175 |
+
5 => array(
|
176 |
+
"main_title" => __("Tracking", "gawd"),
|
177 |
+
"url" => "https://web-dorado.com/wordpress-google-analytics/tracking.html",
|
178 |
+
"titles" => array(
|
179 |
+
array(
|
180 |
+
"title" => __("Custom Dimensions", "gawd"),
|
181 |
+
"url" => "https://web-dorado.com/wordpress-google-analytics/tracking/custom-dimensions.html",
|
182 |
+
),
|
183 |
+
array(
|
184 |
+
"title" => __("Exclude", "gawd"),
|
185 |
+
"url" => "https://web-dorado.com/wordpress-google-analytics/tracking/exclude.html",
|
186 |
+
),
|
187 |
+
),
|
188 |
+
),
|
189 |
+
6 => array(
|
190 |
+
"main_title" => __("Goal Management", "gawd"),
|
191 |
+
"url" => "https://web-dorado.com/wordpress-google-analytics/goal-management.html",
|
192 |
+
"titles" => array(),
|
193 |
+
),
|
194 |
+
7 => array(
|
195 |
+
"main_title" => __("Custom Reports", "gawd"),
|
196 |
+
"url" => "https://help.10web.io/hc/en-us/articles/360018133271-Custom-Reports",
|
197 |
+
"titles" => array(),
|
198 |
+
),
|
199 |
+
),
|
200 |
+
"video_youtube_id" => "n1f7ECVFNPI",
|
201 |
+
"plugin_wd_url" => "https://10web.io/plugins/wordpress-google-analytics/?utm_source=10web_analytics&utm_medium=free_plugin",
|
202 |
+
"plugin_wd_demo_link" => "https://admindemo.10web.io/?product_name=google-analytics",
|
203 |
+
"plugin_wd_addons_link" => "",
|
204 |
+
"plugin_wizard_link" => NULL,
|
205 |
+
"plugin_wd_docs_link" => "https://help.10web.io/hc/en-us/sections/360002488232-Google-Analytics",
|
206 |
+
"after_subscribe" => admin_url('admin.php?page=gawd_settings'),
|
207 |
+
"plugin_menu_title" => "Analytics",
|
208 |
+
"plugin_menu_icon" => GAWD_URL . '/assets/main_icon.png',
|
209 |
+
"menu_position" => "25, 13",
|
210 |
+
"custom_post" => "gawd_analytics",
|
211 |
+
"menu_capability" => "read",
|
212 |
+
"deactivate" => TRUE,
|
213 |
+
"subscribe" => TRUE,
|
214 |
+
"display_overview" => FALSE,
|
215 |
+
);
|
216 |
+
ten_web_lib_init($gawd_options);
|
217 |
+
}
|
218 |
+
}
|
219 |
+
|
220 |
+
add_filter('wp_get_default_privacy_policy_content', 'gawd_privacy_policy');
|
221 |
+
function gawd_privacy_policy($content){
|
222 |
+
$title = __('10Web Analytics', "gawd");
|
223 |
+
|
224 |
+
$pp_link = '<a target="_blank" href="https://policies.google.com/privacy">' . __('Privacy Policy', "gawd") . '</a>';
|
225 |
+
$text = sprintf(__('If you enable tracking code, explain that your site uses Google Analytics. Whether it will send any personal data to Google, depends on how you set up your website. For example, do not expose emails or other personally identifiable information to Google via URLs. Do not send form submissions via analytics to Google. By default, all the IPs of visitors are anonymized. If you change that setting, you must inform your website visitors on that. Personal data processing by Google is explained in their %s.', "gawd"), $pp_link);
|
226 |
+
$text .= "<br/>";
|
227 |
+
$text .= __('10Web Disclaimer: The above text is for informational purposes only and is not a legal advice. You must not rely on it as an alternative to legal advice. You should contact your legal counsel to obtain advice with respect to your particular case.', "gawd");
|
228 |
+
$pp_text = '<h3>' . $title . '</h3>' . '<p class="wp-policy-help">' . $text . '</p>';
|
229 |
+
|
230 |
+
$content .= $pp_text;
|
231 |
+
return $content;
|
232 |
+
}
|
233 |
+
|
234 |
+
if(!function_exists('gawd_wd_bp_install_notice')) {
|
235 |
+
|
236 |
+
if(get_option('wds_bk_notice_status') === '' || get_option('wds_bk_notice_status') === '1') {
|
237 |
+
return;
|
238 |
+
}
|
239 |
+
|
240 |
+
function gawd_wd_bp_script_style(){
|
241 |
+
$wd_bp_plugin_url = GAWD_URL;
|
242 |
+
|
243 |
+
$get_current = get_current_screen();
|
244 |
+
$current_screen_id = array(
|
245 |
+
'toplevel_page_gawd_analytics',
|
246 |
+
'analytics_page_gawd_reports',
|
247 |
+
'analytics_page_gawd_settings',
|
248 |
+
'analytics_page_gawd_tracking',
|
249 |
+
'analytics_page_gawd_goals',
|
250 |
+
'analytics_page_gawd_custom_reports',
|
251 |
+
'analytics_page_gawd_uninstall',
|
252 |
+
'analytics_page_overview_gawd',
|
253 |
+
'analytics_page_gawd_updates',
|
254 |
+
);
|
255 |
+
|
256 |
+
if(in_array($get_current->id, $current_screen_id)) {
|
257 |
+
wp_enqueue_script('wd_bck_install', $wd_bp_plugin_url . '/inc/js/wd_bp_install.js', array('jquery'));
|
258 |
+
wp_enqueue_style('wd_bck_install', $wd_bp_plugin_url . '/inc/css/wd_bp_install.css');
|
259 |
+
}
|
260 |
+
|
261 |
+
}
|
262 |
+
|
263 |
+
add_action('admin_enqueue_scripts', 'gawd_wd_bp_script_style');
|
264 |
+
|
265 |
+
/**
|
266 |
+
* Show notice to install backup plugin
|
267 |
+
*/
|
268 |
+
function gawd_wd_bp_install_notice(){
|
269 |
+
$wd_bp_plugin_url = GAWD_URL;
|
270 |
+
|
271 |
+
$get_current = get_current_screen();
|
272 |
+
$current_screen_id = array(
|
273 |
+
'toplevel_page_gawd_analytics',
|
274 |
+
'analytics_page_gawd_reports',
|
275 |
+
'analytics_page_gawd_settings',
|
276 |
+
'analytics_page_gawd_tracking',
|
277 |
+
'analytics_page_gawd_goals',
|
278 |
+
'analytics_page_gawd_custom_reports',
|
279 |
+
'analytics_page_gawd_uninstall',
|
280 |
+
'analytics_page_overview_gawd',
|
281 |
+
'analytics_page_gawd_updates',
|
282 |
+
);
|
283 |
+
|
284 |
+
if(!in_array($get_current->id, $current_screen_id)) {
|
285 |
+
return;
|
286 |
+
}
|
287 |
+
|
288 |
+
$prefix = 'gawd';
|
289 |
+
|
290 |
+
$meta_value = get_option('wd_seo_notice_status');
|
291 |
+
if ($meta_value === '' || $meta_value === false) {
|
292 |
+
ob_start();
|
293 |
+
?>
|
294 |
+
<div class="notice notice-info" id="wd_bp_notice_cont">
|
295 |
+
<p>
|
296 |
+
<img id="wd_bp_logo_notice" src="<?php echo $wd_bp_plugin_url . '/assets/seo_logo.png'; ?>">
|
297 |
+
<?php _e("10Web Analytics advises: Optimize your web pages for search engines with the", $prefix) ?>
|
298 |
+
<a href="https://wordpress.org/plugins/seo-by-10web/" title="<?php _e("More details", $prefix) ?>"
|
299 |
+
target="_blank"><?php _e("FREE SEO", $prefix) ?></a>
|
300 |
+
<?php _e("plugin.", $prefix) ?>
|
301 |
+
<a class="button button-primary"
|
302 |
+
href="<?php echo esc_url(wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=seo-by-10web'), 'install-plugin_seo-by-10web')); ?>">
|
303 |
+
<span onclick="wd_bp_notice_install()"><?php _e("Install", $prefix); ?></span>
|
304 |
+
</a>
|
305 |
+
</p>
|
306 |
+
<button type="button" class="wd_bp_notice_dissmiss notice-dismiss"><span class="screen-reader-text"></span>
|
307 |
+
</button>
|
308 |
+
</div>
|
309 |
+
<script>wd_bp_url = '<?php echo add_query_arg(array('action' => 'wd_seo_dismiss',), admin_url('admin-ajax.php')); ?>'</script>
|
310 |
+
|
311 |
+
<?php
|
312 |
+
echo ob_get_clean();
|
313 |
+
}
|
314 |
+
}
|
315 |
+
|
316 |
+
if (!is_dir(plugin_dir_path(dirname(__FILE__)) . 'seo-by-10web')) {
|
317 |
+
add_action('admin_notices', 'gawd_wd_bp_install_notice');
|
318 |
+
}
|
319 |
+
|
320 |
+
/**
|
321 |
+
* Add usermeta to db
|
322 |
+
*
|
323 |
+
* empty: notice,
|
324 |
+
* 1 : never show again
|
325 |
+
*/
|
326 |
+
|
327 |
+
function gawd_wd_bp_install_notice_status() {
|
328 |
+
update_option('wd_seo_notice_status', '1', 'no');
|
329 |
+
}
|
330 |
+
add_action('wp_ajax_wd_seo_dismiss', 'gawd_wd_bp_install_notice_status');
|
331 |
+
|
332 |
}
|
inc/css/bootstrap-chosen.css
CHANGED
@@ -1,330 +1,330 @@
|
|
1 |
-
.chosen-select {
|
2 |
-
width: 100%; }
|
3 |
-
|
4 |
-
.chosen-select-deselect {
|
5 |
-
width: 100%; }
|
6 |
-
|
7 |
-
.chosen-container {
|
8 |
-
display: inline-block;
|
9 |
-
font-size: 14px;
|
10 |
-
position: relative;
|
11 |
-
vertical-align: middle; }
|
12 |
-
.chosen-container .chosen-drop {
|
13 |
-
background: #fff;
|
14 |
-
border: 1px solid #ccc;
|
15 |
-
|
16 |
-
-webkit-box-shadow: 0 8px 8px rgba(0, 0, 0, 0.25);
|
17 |
-
box-shadow: 0 8px 8px rgba(0, 0, 0, 0.25);
|
18 |
-
margin-top: -1px;
|
19 |
-
position: absolute;
|
20 |
-
top: 100%;
|
21 |
-
left: -9000px;
|
22 |
-
z-index: 1060; }
|
23 |
-
.chosen-container.chosen-with-drop .chosen-drop {
|
24 |
-
left: 0;
|
25 |
-
right: 0; }
|
26 |
-
.chosen-container .chosen-results {
|
27 |
-
color: #555555;
|
28 |
-
margin: 0 4px 4px 0;
|
29 |
-
max-height: 240px;
|
30 |
-
padding: 0 0 0 4px;
|
31 |
-
position: relative;
|
32 |
-
overflow-x: hidden;
|
33 |
-
overflow-y: auto;
|
34 |
-
-webkit-overflow-scrolling: touch; }
|
35 |
-
.chosen-container .chosen-results li {
|
36 |
-
display: none;
|
37 |
-
line-height: 1.42857;
|
38 |
-
list-style: none;
|
39 |
-
margin: 0;
|
40 |
-
padding: 5px 6px; }
|
41 |
-
.chosen-container .chosen-results li em {
|
42 |
-
background: #feffde;
|
43 |
-
font-style: normal; }
|
44 |
-
.chosen-container .chosen-results li.group-result {
|
45 |
-
display: list-item;
|
46 |
-
cursor: default;
|
47 |
-
color: #999;
|
48 |
-
font-weight: bold; }
|
49 |
-
.chosen-container .chosen-results li.group-option {
|
50 |
-
padding-left: 15px; }
|
51 |
-
.chosen-container .chosen-results li.active-result {
|
52 |
-
cursor: pointer;
|
53 |
-
display: list-item; }
|
54 |
-
.chosen-container .chosen-results li.highlighted {
|
55 |
-
background-color: #337ab7;
|
56 |
-
background-image: none;
|
57 |
-
color: white; }
|
58 |
-
.chosen-container .chosen-results li.highlighted em {
|
59 |
-
background: transparent; }
|
60 |
-
.chosen-container .chosen-results li.disabled-result {
|
61 |
-
display: list-item;
|
62 |
-
color: #777777; }
|
63 |
-
.chosen-container .chosen-results .no-results {
|
64 |
-
background: #eeeeee;
|
65 |
-
display: list-item; }
|
66 |
-
.chosen-container .chosen-results-scroll {
|
67 |
-
background: white;
|
68 |
-
margin: 0 4px;
|
69 |
-
position: absolute;
|
70 |
-
text-align: center;
|
71 |
-
width: 321px;
|
72 |
-
z-index: 1; }
|
73 |
-
.chosen-container .chosen-results-scroll span {
|
74 |
-
display: inline-block;
|
75 |
-
height: 1.42857;
|
76 |
-
text-indent: -5000px;
|
77 |
-
width: 9px; }
|
78 |
-
.chosen-container .chosen-results-scroll-down {
|
79 |
-
bottom: 0; }
|
80 |
-
.chosen-container .chosen-results-scroll-down span {
|
81 |
-
background: url("chosen-sprite.png") no-repeat -4px -3px; }
|
82 |
-
.chosen-container .chosen-results-scroll-up span {
|
83 |
-
background: url("chosen-sprite.png") no-repeat -22px -3px; }
|
84 |
-
|
85 |
-
.chosen-container-single .chosen-single {
|
86 |
-
background-color: #fff;
|
87 |
-
-webkit-background-clip: padding-box;
|
88 |
-
-moz-background-clip: padding;
|
89 |
-
background-clip: padding-box;
|
90 |
-
border: 1px solid #ccc;
|
91 |
-
|
92 |
-
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
|
93 |
-
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
|
94 |
-
color: #555555;
|
95 |
-
display: block;
|
96 |
-
height: 34px;
|
97 |
-
overflow: hidden;
|
98 |
-
line-height: 34px;
|
99 |
-
padding: 0 0 0 8px;
|
100 |
-
position: relative;
|
101 |
-
text-decoration: none;
|
102 |
-
white-space: nowrap; }
|
103 |
-
.chosen-container-single .chosen-single span {
|
104 |
-
display: block;
|
105 |
-
margin-right: 26px;
|
106 |
-
overflow: hidden;
|
107 |
-
text-overflow: ellipsis;
|
108 |
-
white-space: nowrap; }
|
109 |
-
.chosen-container-single .chosen-single abbr {
|
110 |
-
background: url("chosen-sprite.png") right top no-repeat;
|
111 |
-
display: block;
|
112 |
-
font-size: 1px;
|
113 |
-
height: 10px;
|
114 |
-
position: absolute;
|
115 |
-
right: 26px;
|
116 |
-
top: 12px;
|
117 |
-
width: 12px; }
|
118 |
-
.chosen-container-single .chosen-single abbr:hover {
|
119 |
-
background-position: right -11px; }
|
120 |
-
.chosen-container-single .chosen-single.chosen-disabled .chosen-single abbr:hover {
|
121 |
-
background-position: right 2px; }
|
122 |
-
.chosen-container-single .chosen-single div {
|
123 |
-
display: block;
|
124 |
-
height: 100%;
|
125 |
-
position: absolute;
|
126 |
-
top: 0;
|
127 |
-
right: 0;
|
128 |
-
width: 18px; }
|
129 |
-
.chosen-container-single .chosen-single div b {
|
130 |
-
background: url("chosen-sprite.png") no-repeat 0 7px;
|
131 |
-
display: block;
|
132 |
-
height: 100%;
|
133 |
-
width: 100%; }
|
134 |
-
.chosen-container-single .chosen-default {
|
135 |
-
color: #777777; }
|
136 |
-
.chosen-container-single .chosen-search {
|
137 |
-
margin: 0;
|
138 |
-
padding: 3px 4px;
|
139 |
-
position: relative;
|
140 |
-
white-space: nowrap;
|
141 |
-
z-index: 1000; }
|
142 |
-
.chosen-container-single .chosen-search input[type="text"] {
|
143 |
-
background: url("chosen-sprite.png") no-repeat 100% -20px, #fff;
|
144 |
-
border: 1px solid #ccc;
|
145 |
-
|
146 |
-
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
|
147 |
-
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
|
148 |
-
margin: 1px 0;
|
149 |
-
padding: 4px 20px 4px 4px;
|
150 |
-
width: 100%; }
|
151 |
-
.chosen-container-single .chosen-drop {
|
152 |
-
margin-top: -1px;
|
153 |
-
|
154 |
-
-webkit-background-clip: padding-box;
|
155 |
-
-moz-background-clip: padding;
|
156 |
-
background-clip: padding-box; }
|
157 |
-
|
158 |
-
.chosen-container-single-nosearch .chosen-search input[type="text"] {
|
159 |
-
position: absolute;
|
160 |
-
left: -9000px; }
|
161 |
-
|
162 |
-
.chosen-container-multi .chosen-choices {
|
163 |
-
background-color: #fff;
|
164 |
-
border: 1px solid #ccc;
|
165 |
-
height:auto;
|
166 |
-
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
|
167 |
-
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
|
168 |
-
cursor: text;
|
169 |
-
/* //height: auto !important;
|
170 |
-
//height: 1%; */
|
171 |
-
margin: 0;
|
172 |
-
overflow: hidden;
|
173 |
-
padding: 0;
|
174 |
-
position: relative; }
|
175 |
-
.chosen-container-multi .chosen-choices li {
|
176 |
-
float: left;
|
177 |
-
list-style: none; }
|
178 |
-
.chosen-container-multi .chosen-choices .search-field {
|
179 |
-
margin: 0;
|
180 |
-
padding: 0;
|
181 |
-
white-space: nowrap; }
|
182 |
-
.chosen-container-multi .chosen-choices .search-field input[type="text"] {
|
183 |
-
background: transparent !important;
|
184 |
-
border: 0 !important;
|
185 |
-
-webkit-box-shadow: none;
|
186 |
-
box-shadow: none;
|
187 |
-
color: #555555;
|
188 |
-
height: 28px;
|
189 |
-
margin: 0;
|
190 |
-
padding: 4px;
|
191 |
-
outline: 0; }
|
192 |
-
.chosen-container-multi .chosen-choices .search-field .default {
|
193 |
-
color: #999; }
|
194 |
-
.chosen-container-multi .chosen-choices .search-choice {
|
195 |
-
-webkit-background-clip: padding-box;
|
196 |
-
-moz-background-clip: padding;
|
197 |
-
background-clip: padding-box;
|
198 |
-
background-color: #eeeeee;
|
199 |
-
border: 1px solid #ccc;
|
200 |
-
|
201 |
-
background-image: -webkit-linear-gradient(top, white 0%, #eeeeee 100%);
|
202 |
-
background-image: -o-linear-gradient(top, white 0%, #eeeeee 100%);
|
203 |
-
background-image: linear-gradient(to bottom, white 0%, #eeeeee 100%);
|
204 |
-
background-repeat: repeat-x;
|
205 |
-
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0);
|
206 |
-
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
|
207 |
-
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
|
208 |
-
color: #333333;
|
209 |
-
cursor: default;
|
210 |
-
line-height: 13px;
|
211 |
-
margin: 4px 0 3px 5px;
|
212 |
-
padding: 3px 20px 3px 5px;
|
213 |
-
position: relative; }
|
214 |
-
.chosen-container-multi .chosen-choices .search-choice .search-choice-close {
|
215 |
-
background: url("chosen-sprite.png") right top no-repeat;
|
216 |
-
display: block;
|
217 |
-
font-size: 1px;
|
218 |
-
height: 10px;
|
219 |
-
position: absolute;
|
220 |
-
right: 4px;
|
221 |
-
top: 5px;
|
222 |
-
width: 12px;
|
223 |
-
cursor: pointer; }
|
224 |
-
|
225 |
-
.chosen-container-multi .chosen-choices .search-choice-focus {
|
226 |
-
background: #d4d4d4; }
|
227 |
-
.chosen-container-multi .chosen-choices .search-choice-focus .search-choice-close {
|
228 |
-
background-position: right -11px; }
|
229 |
-
.chosen-container-multi .chosen-results {
|
230 |
-
margin: 0 0 0 0;
|
231 |
-
padding: 0; }
|
232 |
-
.chosen-container-multi .chosen-drop .result-selected {
|
233 |
-
display: none; }
|
234 |
-
|
235 |
-
.chosen-container-active .chosen-single {
|
236 |
-
border: 1px solid #66afe9;
|
237 |
-
/* -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px #66afe9;
|
238 |
-
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px #66afe9;
|
239 |
-
-webkit-transition: border linear 0.2s, box-shadow linear 0.2s;
|
240 |
-
-o-transition: border linear 0.2s, box-shadow linear 0.2s;
|
241 |
-
transition: border linear 0.2s, box-shadow linear 0.2s;*/ }
|
242 |
-
.chosen-container-active.chosen-with-drop .chosen-single {
|
243 |
-
background-color: #fff;
|
244 |
-
border: 1px solid #66afe9;
|
245 |
-
|
246 |
-
/* -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px #66afe9;
|
247 |
-
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px #66afe9;
|
248 |
-
-webkit-transition: border linear 0.2s, box-shadow linear 0.2s;
|
249 |
-
-o-transition: border linear 0.2s, box-shadow linear 0.2s;
|
250 |
-
transition: border linear 0.2s, box-shadow linear 0.2s; */ }
|
251 |
-
.chosen-container-active.chosen-with-drop .chosen-single div {
|
252 |
-
background: transparent;
|
253 |
-
border-left: none; }
|
254 |
-
.chosen-container-active.chosen-with-drop .chosen-single div b {
|
255 |
-
background-position: -18px 7px; }
|
256 |
-
.chosen-container-active .chosen-choices {
|
257 |
-
border: 1px solid #66afe9;
|
258 |
-
border-bottom-right-radius: 0;
|
259 |
-
border-bottom-left-radius: 0;
|
260 |
-
/* -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px #66afe9;
|
261 |
-
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px #66afe9;
|
262 |
-
-webkit-transition: border linear 0.2s, box-shadow linear 0.2s;
|
263 |
-
-o-transition: border linear 0.2s, box-shadow linear 0.2s;
|
264 |
-
transition: border linear 0.2s, box-shadow linear 0.2s; */ }
|
265 |
-
.chosen-container-active .chosen-choices .search-field input[type="text"] {
|
266 |
-
color: #111 !important; }
|
267 |
-
.chosen-container-active.chosen-with-drop .chosen-choices {
|
268 |
-
border-bottom-right-radius: 0;
|
269 |
-
border-bottom-left-radius: 0; }
|
270 |
-
|
271 |
-
.chosen-disabled {
|
272 |
-
cursor: default;
|
273 |
-
opacity: 0.5 !important; }
|
274 |
-
.chosen-disabled .chosen-single {
|
275 |
-
cursor: default; }
|
276 |
-
.chosen-disabled .chosen-choices .search-choice .search-choice-close {
|
277 |
-
cursor: default; }
|
278 |
-
|
279 |
-
.chosen-rtl {
|
280 |
-
text-align: right; }
|
281 |
-
.chosen-rtl .chosen-single {
|
282 |
-
padding: 0 8px 0 0;
|
283 |
-
overflow: visible; }
|
284 |
-
.chosen-rtl .chosen-single span {
|
285 |
-
margin-left: 26px;
|
286 |
-
margin-right: 0;
|
287 |
-
direction: rtl; }
|
288 |
-
.chosen-rtl .chosen-single div {
|
289 |
-
left: 7px;
|
290 |
-
right: auto; }
|
291 |
-
.chosen-rtl .chosen-single abbr {
|
292 |
-
left: 26px;
|
293 |
-
right: auto; }
|
294 |
-
.chosen-rtl .chosen-choices .search-field input[type="text"] {
|
295 |
-
direction: rtl; }
|
296 |
-
.chosen-rtl .chosen-choices li {
|
297 |
-
float: right; }
|
298 |
-
.chosen-rtl .chosen-choices .search-choice {
|
299 |
-
margin: 6px 5px 3px 0;
|
300 |
-
padding: 3px 5px 3px 19px; }
|
301 |
-
.chosen-rtl .chosen-choices .search-choice .search-choice-close {
|
302 |
-
background-position: right top;
|
303 |
-
left: 4px;
|
304 |
-
right: auto; }
|
305 |
-
.chosen-rtl.chosen-container-single .chosen-results {
|
306 |
-
margin: 0 0 4px 4px;
|
307 |
-
padding: 0 4px 0 0; }
|
308 |
-
.chosen-rtl .chosen-results .group-option {
|
309 |
-
padding-left: 0;
|
310 |
-
padding-right: 15px; }
|
311 |
-
.chosen-rtl.chosen-container-active.chosen-with-drop .chosen-single div {
|
312 |
-
border-right: none; }
|
313 |
-
.chosen-rtl .chosen-search input[type="text"] {
|
314 |
-
background: url("chosen-sprite.png") no-repeat -28px -20px, #fff;
|
315 |
-
direction: rtl;
|
316 |
-
padding: 4px 5px 4px 20px; }
|
317 |
-
|
318 |
-
@media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min-resolution: 2dppx) {
|
319 |
-
.chosen-rtl .chosen-search input[type="text"],
|
320 |
-
.chosen-container-single .chosen-single abbr,
|
321 |
-
.chosen-container-single .chosen-single div b,
|
322 |
-
.chosen-container-single .chosen-search input[type="text"],
|
323 |
-
.chosen-container-multi .chosen-choices .search-choice .search-choice-close,
|
324 |
-
.chosen-container .chosen-results-scroll-down span,
|
325 |
-
.chosen-container .chosen-results-scroll-up span {
|
326 |
-
background-image: url("chosen-sprite@2x.png") !important;
|
327 |
-
background-size: 52px 37px !important;
|
328 |
-
background-repeat: no-repeat !important; } }
|
329 |
-
|
330 |
-
/*# sourceMappingURL=bootstrap-chosen.css.map */
|
1 |
+
.chosen-select {
|
2 |
+
width: 100%; }
|
3 |
+
|
4 |
+
.chosen-select-deselect {
|
5 |
+
width: 100%; }
|
6 |
+
|
7 |
+
.chosen-container {
|
8 |
+
display: inline-block;
|
9 |
+
font-size: 14px;
|
10 |
+
position: relative;
|
11 |
+
vertical-align: middle; }
|
12 |
+
.chosen-container .chosen-drop {
|
13 |
+
background: #fff;
|
14 |
+
border: 1px solid #ccc;
|
15 |
+
|
16 |
+
-webkit-box-shadow: 0 8px 8px rgba(0, 0, 0, 0.25);
|
17 |
+
box-shadow: 0 8px 8px rgba(0, 0, 0, 0.25);
|
18 |
+
margin-top: -1px;
|
19 |
+
position: absolute;
|
20 |
+
top: 100%;
|
21 |
+
left: -9000px;
|
22 |
+
z-index: 1060; }
|
23 |
+
.chosen-container.chosen-with-drop .chosen-drop {
|
24 |
+
left: 0;
|
25 |
+
right: 0; }
|
26 |
+
.chosen-container .chosen-results {
|
27 |
+
color: #555555;
|
28 |
+
margin: 0 4px 4px 0;
|
29 |
+
max-height: 240px;
|
30 |
+
padding: 0 0 0 4px;
|
31 |
+
position: relative;
|
32 |
+
overflow-x: hidden;
|
33 |
+
overflow-y: auto;
|
34 |
+
-webkit-overflow-scrolling: touch; }
|
35 |
+
.chosen-container .chosen-results li {
|
36 |
+
display: none;
|
37 |
+
line-height: 1.42857;
|
38 |
+
list-style: none;
|
39 |
+
margin: 0;
|
40 |
+
padding: 5px 6px; }
|
41 |
+
.chosen-container .chosen-results li em {
|
42 |
+
background: #feffde;
|
43 |
+
font-style: normal; }
|
44 |
+
.chosen-container .chosen-results li.group-result {
|
45 |
+
display: list-item;
|
46 |
+
cursor: default;
|
47 |
+
color: #999;
|
48 |
+
font-weight: bold; }
|
49 |
+
.chosen-container .chosen-results li.group-option {
|
50 |
+
padding-left: 15px; }
|
51 |
+
.chosen-container .chosen-results li.active-result {
|
52 |
+
cursor: pointer;
|
53 |
+
display: list-item; }
|
54 |
+
.chosen-container .chosen-results li.highlighted {
|
55 |
+
background-color: #337ab7;
|
56 |
+
background-image: none;
|
57 |
+
color: white; }
|
58 |
+
.chosen-container .chosen-results li.highlighted em {
|
59 |
+
background: transparent; }
|
60 |
+
.chosen-container .chosen-results li.disabled-result {
|
61 |
+
display: list-item;
|
62 |
+
color: #777777; }
|
63 |
+
.chosen-container .chosen-results .no-results {
|
64 |
+
background: #eeeeee;
|
65 |
+
display: list-item; }
|
66 |
+
.chosen-container .chosen-results-scroll {
|
67 |
+
background: white;
|
68 |
+
margin: 0 4px;
|
69 |
+
position: absolute;
|
70 |
+
text-align: center;
|
71 |
+
width: 321px;
|
72 |
+
z-index: 1; }
|
73 |
+
.chosen-container .chosen-results-scroll span {
|
74 |
+
display: inline-block;
|
75 |
+
height: 1.42857;
|
76 |
+
text-indent: -5000px;
|
77 |
+
width: 9px; }
|
78 |
+
.chosen-container .chosen-results-scroll-down {
|
79 |
+
bottom: 0; }
|
80 |
+
.chosen-container .chosen-results-scroll-down span {
|
81 |
+
background: url("chosen-sprite.png") no-repeat -4px -3px; }
|
82 |
+
.chosen-container .chosen-results-scroll-up span {
|
83 |
+
background: url("chosen-sprite.png") no-repeat -22px -3px; }
|
84 |
+
|
85 |
+
.chosen-container-single .chosen-single {
|
86 |
+
background-color: #fff;
|
87 |
+
-webkit-background-clip: padding-box;
|
88 |
+
-moz-background-clip: padding;
|
89 |
+
background-clip: padding-box;
|
90 |
+
border: 1px solid #ccc;
|
91 |
+
|
92 |
+
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
|
93 |
+
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
|
94 |
+
color: #555555;
|
95 |
+
display: block;
|
96 |
+
height: 34px;
|
97 |
+
overflow: hidden;
|
98 |
+
line-height: 34px;
|
99 |
+
padding: 0 0 0 8px;
|
100 |
+
position: relative;
|
101 |
+
text-decoration: none;
|
102 |
+
white-space: nowrap; }
|
103 |
+
.chosen-container-single .chosen-single span {
|
104 |
+
display: block;
|
105 |
+
margin-right: 26px;
|
106 |
+
overflow: hidden;
|
107 |
+
text-overflow: ellipsis;
|
108 |
+
white-space: nowrap; }
|
109 |
+
.chosen-container-single .chosen-single abbr {
|
110 |
+
background: url("chosen-sprite.png") right top no-repeat;
|
111 |
+
display: block;
|
112 |
+
font-size: 1px;
|
113 |
+
height: 10px;
|
114 |
+
position: absolute;
|
115 |
+
right: 26px;
|
116 |
+
top: 12px;
|
117 |
+
width: 12px; }
|
118 |
+
.chosen-container-single .chosen-single abbr:hover {
|
119 |
+
background-position: right -11px; }
|
120 |
+
.chosen-container-single .chosen-single.chosen-disabled .chosen-single abbr:hover {
|
121 |
+
background-position: right 2px; }
|
122 |
+
.chosen-container-single .chosen-single div {
|
123 |
+
display: block;
|
124 |
+
height: 100%;
|
125 |
+
position: absolute;
|
126 |
+
top: 0;
|
127 |
+
right: 0;
|
128 |
+
width: 18px; }
|
129 |
+
.chosen-container-single .chosen-single div b {
|
130 |
+
background: url("chosen-sprite.png") no-repeat 0 7px;
|
131 |
+
display: block;
|
132 |
+
height: 100%;
|
133 |
+
width: 100%; }
|
134 |
+
.chosen-container-single .chosen-default {
|
135 |
+
color: #777777; }
|
136 |
+
.chosen-container-single .chosen-search {
|
137 |
+
margin: 0;
|
138 |
+
padding: 3px 4px;
|
139 |
+
position: relative;
|
140 |
+
white-space: nowrap;
|
141 |
+
z-index: 1000; }
|
142 |
+
.chosen-container-single .chosen-search input[type="text"] {
|
143 |
+
background: url("chosen-sprite.png") no-repeat 100% -20px, #fff;
|
144 |
+
border: 1px solid #ccc;
|
145 |
+
|
146 |
+
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
|
147 |
+
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
|
148 |
+
margin: 1px 0;
|
149 |
+
padding: 4px 20px 4px 4px;
|
150 |
+
width: 100%; }
|
151 |
+
.chosen-container-single .chosen-drop {
|
152 |
+
margin-top: -1px;
|
153 |
+
|
154 |
+
-webkit-background-clip: padding-box;
|
155 |
+
-moz-background-clip: padding;
|
156 |
+
background-clip: padding-box; }
|
157 |
+
|
158 |
+
.chosen-container-single-nosearch .chosen-search input[type="text"] {
|
159 |
+
position: absolute;
|
160 |
+
left: -9000px; }
|
161 |
+
|
162 |
+
.chosen-container-multi .chosen-choices {
|
163 |
+
background-color: #fff;
|
164 |
+
border: 1px solid #ccc;
|
165 |
+
height:auto;
|
166 |
+
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
|
167 |
+
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
|
168 |
+
cursor: text;
|
169 |
+
/* //height: auto !important;
|
170 |
+
//height: 1%; */
|
171 |
+
margin: 0;
|
172 |
+
overflow: hidden;
|
173 |
+
padding: 0;
|
174 |
+
position: relative; }
|
175 |
+
.chosen-container-multi .chosen-choices li {
|
176 |
+
float: left;
|
177 |
+
list-style: none; }
|
178 |
+
.chosen-container-multi .chosen-choices .search-field {
|
179 |
+
margin: 0;
|
180 |
+
padding: 0;
|
181 |
+
white-space: nowrap; }
|
182 |
+
.chosen-container-multi .chosen-choices .search-field input[type="text"] {
|
183 |
+
background: transparent !important;
|
184 |
+
border: 0 !important;
|
185 |
+
-webkit-box-shadow: none;
|
186 |
+
box-shadow: none;
|
187 |
+
color: #555555;
|
188 |
+
height: 28px;
|
189 |
+
margin: 0;
|
190 |
+
padding: 4px;
|
191 |
+
outline: 0; }
|
192 |
+
.chosen-container-multi .chosen-choices .search-field .default {
|
193 |
+
color: #999; }
|
194 |
+
.chosen-container-multi .chosen-choices .search-choice {
|
195 |
+
-webkit-background-clip: padding-box;
|
196 |
+
-moz-background-clip: padding;
|
197 |
+
background-clip: padding-box;
|
198 |
+
background-color: #eeeeee;
|
199 |
+
border: 1px solid #ccc;
|
200 |
+
|
201 |
+
background-image: -webkit-linear-gradient(top, white 0%, #eeeeee 100%);
|
202 |
+
background-image: -o-linear-gradient(top, white 0%, #eeeeee 100%);
|
203 |
+
background-image: linear-gradient(to bottom, white 0%, #eeeeee 100%);
|
204 |
+
background-repeat: repeat-x;
|
205 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0);
|
206 |
+
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
|
207 |
+
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
|
208 |
+
color: #333333;
|
209 |
+
cursor: default;
|
210 |
+
line-height: 13px;
|
211 |
+
margin: 4px 0 3px 5px;
|
212 |
+
padding: 3px 20px 3px 5px;
|
213 |
+
position: relative; }
|
214 |
+
.chosen-container-multi .chosen-choices .search-choice .search-choice-close {
|
215 |
+
background: url("chosen-sprite.png") right top no-repeat;
|
216 |
+
display: block;
|
217 |
+
font-size: 1px;
|
218 |
+
height: 10px;
|
219 |
+
position: absolute;
|
220 |
+
right: 4px;
|
221 |
+
top: 5px;
|
222 |
+
width: 12px;
|
223 |
+
cursor: pointer; }
|
224 |
+
|
225 |
+
.chosen-container-multi .chosen-choices .search-choice-focus {
|
226 |
+
background: #d4d4d4; }
|
227 |
+
.chosen-container-multi .chosen-choices .search-choice-focus .search-choice-close {
|
228 |
+
background-position: right -11px; }
|
229 |
+
.chosen-container-multi .chosen-results {
|
230 |
+
margin: 0 0 0 0;
|
231 |
+
padding: 0; }
|
232 |
+
.chosen-container-multi .chosen-drop .result-selected {
|
233 |
+
display: none; }
|
234 |
+
|
235 |
+
.chosen-container-active .chosen-single {
|
236 |
+
border: 1px solid #66afe9;
|
237 |
+
/* -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px #66afe9;
|
238 |
+
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px #66afe9;
|
239 |
+
-webkit-transition: border linear 0.2s, box-shadow linear 0.2s;
|
240 |
+
-o-transition: border linear 0.2s, box-shadow linear 0.2s;
|
241 |
+
transition: border linear 0.2s, box-shadow linear 0.2s;*/ }
|
242 |
+
.chosen-container-active.chosen-with-drop .chosen-single {
|
243 |
+
background-color: #fff;
|
244 |
+
border: 1px solid #66afe9;
|
245 |
+
|
246 |
+
/* -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px #66afe9;
|
247 |
+
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px #66afe9;
|
248 |
+
-webkit-transition: border linear 0.2s, box-shadow linear 0.2s;
|
249 |
+
-o-transition: border linear 0.2s, box-shadow linear 0.2s;
|
250 |
+
transition: border linear 0.2s, box-shadow linear 0.2s; */ }
|
251 |
+
.chosen-container-active.chosen-with-drop .chosen-single div {
|
252 |
+
background: transparent;
|
253 |
+
border-left: none; }
|
254 |
+
.chosen-container-active.chosen-with-drop .chosen-single div b {
|
255 |
+
background-position: -18px 7px; }
|
256 |
+
.chosen-container-active .chosen-choices {
|
257 |
+
border: 1px solid #66afe9;
|
258 |
+
border-bottom-right-radius: 0;
|
259 |
+
border-bottom-left-radius: 0;
|
260 |
+
/* -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px #66afe9;
|
261 |
+
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px #66afe9;
|
262 |
+
-webkit-transition: border linear 0.2s, box-shadow linear 0.2s;
|
263 |
+
-o-transition: border linear 0.2s, box-shadow linear 0.2s;
|
264 |
+
transition: border linear 0.2s, box-shadow linear 0.2s; */ }
|
265 |
+
.chosen-container-active .chosen-choices .search-field input[type="text"] {
|
266 |
+
color: #111 !important; }
|
267 |
+
.chosen-container-active.chosen-with-drop .chosen-choices {
|
268 |
+
border-bottom-right-radius: 0;
|
269 |
+
border-bottom-left-radius: 0; }
|
270 |
+
|
271 |
+
.chosen-disabled {
|
272 |
+
cursor: default;
|
273 |
+
opacity: 0.5 !important; }
|
274 |
+
.chosen-disabled .chosen-single {
|
275 |
+
cursor: default; }
|
276 |
+
.chosen-disabled .chosen-choices .search-choice .search-choice-close {
|
277 |
+
cursor: default; }
|
278 |
+
|
279 |
+
.chosen-rtl {
|
280 |
+
text-align: right; }
|
281 |
+
.chosen-rtl .chosen-single {
|
282 |
+
padding: 0 8px 0 0;
|
283 |
+
overflow: visible; }
|
284 |
+
.chosen-rtl .chosen-single span {
|
285 |
+
margin-left: 26px;
|
286 |
+
margin-right: 0;
|
287 |
+
direction: rtl; }
|
288 |
+
.chosen-rtl .chosen-single div {
|
289 |
+
left: 7px;
|
290 |
+
right: auto; }
|
291 |
+
.chosen-rtl .chosen-single abbr {
|
292 |
+
left: 26px;
|
293 |
+
right: auto; }
|
294 |
+
.chosen-rtl .chosen-choices .search-field input[type="text"] {
|
295 |
+
direction: rtl; }
|
296 |
+
.chosen-rtl .chosen-choices li {
|
297 |
+
float: right; }
|
298 |
+
.chosen-rtl .chosen-choices .search-choice {
|
299 |
+
margin: 6px 5px 3px 0;
|
300 |
+
padding: 3px 5px 3px 19px; }
|
301 |
+
.chosen-rtl .chosen-choices .search-choice .search-choice-close {
|
302 |
+
background-position: right top;
|
303 |
+
left: 4px;
|
304 |
+
right: auto; }
|
305 |
+
.chosen-rtl.chosen-container-single .chosen-results {
|
306 |
+
margin: 0 0 4px 4px;
|
307 |
+
padding: 0 4px 0 0; }
|
308 |
+
.chosen-rtl .chosen-results .group-option {
|
309 |
+
padding-left: 0;
|
310 |
+
padding-right: 15px; }
|
311 |
+
.chosen-rtl.chosen-container-active.chosen-with-drop .chosen-single div {
|
312 |
+
border-right: none; }
|
313 |
+
.chosen-rtl .chosen-search input[type="text"] {
|
314 |
+
background: url("chosen-sprite.png") no-repeat -28px -20px, #fff;
|
315 |
+
direction: rtl;
|
316 |
+
padding: 4px 5px 4px 20px; }
|
317 |
+
|
318 |
+
@media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min-resolution: 2dppx) {
|
319 |
+
.chosen-rtl .chosen-search input[type="text"],
|
320 |
+
.chosen-container-single .chosen-single abbr,
|
321 |
+
.chosen-container-single .chosen-single div b,
|
322 |
+
.chosen-container-single .chosen-search input[type="text"],
|
323 |
+
.chosen-container-multi .chosen-choices .search-choice .search-choice-close,
|
324 |
+
.chosen-container .chosen-results-scroll-down span,
|
325 |
+
.chosen-container .chosen-results-scroll-up span {
|
326 |
+
background-image: url("chosen-sprite@2x.png") !important;
|
327 |
+
background-size: 52px 37px !important;
|
328 |
+
background-repeat: no-repeat !important; } }
|
329 |
+
|
330 |
+
/*# sourceMappingURL=bootstrap-chosen.css.map */
|
inc/css/bootstrap-select.css
CHANGED
@@ -1,282 +1,282 @@
|
|
1 |
-
/*!
|
2 |
-
* Bootstrap-select v1.10.0 (http://silviomoreto.github.io/bootstrap-select)
|
3 |
-
*
|
4 |
-
* Copyright 2013-2016 bootstrap-select
|
5 |
-
* Licensed under MIT (https://github.com/silviomoreto/bootstrap-select/blob/master/LICENSE)
|
6 |
-
*/
|
7 |
-
|
8 |
-
select.bs-select-hidden,
|
9 |
-
select.selectpicker {
|
10 |
-
display: none !important;
|
11 |
-
}
|
12 |
-
.bootstrap-select {
|
13 |
-
width: 220px \0;
|
14 |
-
/*IE9 and below*/
|
15 |
-
}
|
16 |
-
.bootstrap-select > .dropdown-toggle {
|
17 |
-
width: 100%;
|
18 |
-
padding-right: 25px;
|
19 |
-
z-index: 1;
|
20 |
-
}
|
21 |
-
.bootstrap-select > select {
|
22 |
-
position: absolute !important;
|
23 |
-
bottom: 0;
|
24 |
-
left: 50%;
|
25 |
-
display: block !important;
|
26 |
-
width: 0.5px !important;
|
27 |
-
height: 100% !important;
|
28 |
-
padding: 0 !important;
|
29 |
-
opacity: 0 !important;
|
30 |
-
border: none;
|
31 |
-
}
|
32 |
-
.bootstrap-select > select.mobile-device {
|
33 |
-
top: 0;
|
34 |
-
left: 0;
|
35 |
-
display: block !important;
|
36 |
-
width: 100% !important;
|
37 |
-
z-index: 2;
|
38 |
-
}
|
39 |
-
.has-error .bootstrap-select .dropdown-toggle,
|
40 |
-
.error .bootstrap-select .dropdown-toggle {
|
41 |
-
border-color: #b94a48;
|
42 |
-
}
|
43 |
-
.bootstrap-select.fit-width {
|
44 |
-
width: auto !important;
|
45 |
-
}
|
46 |
-
.bootstrap-select:not([class*="col-"]):not([class*="form-control"]):not(.input-group-btn) {
|
47 |
-
width: 96%;
|
48 |
-
}
|
49 |
-
.bootstrap-select .dropdown-toggle:focus {
|
50 |
-
outline: thin dotted #333333 !important;
|
51 |
-
outline: 5px auto -webkit-focus-ring-color !important;
|
52 |
-
outline-offset: -2px;
|
53 |
-
}
|
54 |
-
.bootstrap-select.form-control {
|
55 |
-
margin-bottom: 0;
|
56 |
-
padding: 0;
|
57 |
-
border: none;
|
58 |
-
}
|
59 |
-
.bootstrap-select.form-control:not([class*="col-"]) {
|
60 |
-
width: 100%;
|
61 |
-
}
|
62 |
-
.bootstrap-select.form-control.input-group-btn {
|
63 |
-
z-index: auto;
|
64 |
-
}
|
65 |
-
.bootstrap-select.btn-group:not(.input-group-btn),
|
66 |
-
.bootstrap-select.btn-group[class*="col-"] {
|
67 |
-
float: none;
|
68 |
-
display: inline-block;
|
69 |
-
margin-left: 0;
|
70 |
-
}
|
71 |
-
.bootstrap-select.btn-group.dropdown-menu-right,
|
72 |
-
.bootstrap-select.btn-group[class*="col-"].dropdown-menu-right,
|
73 |
-
.row .bootstrap-select.btn-group[class*="col-"].dropdown-menu-right {
|
74 |
-
float: right;
|
75 |
-
}
|
76 |
-
.form-inline .bootstrap-select.btn-group,
|
77 |
-
.form-horizontal .bootstrap-select.btn-group,
|
78 |
-
.form-group .bootstrap-select.btn-group {
|
79 |
-
margin-bottom: 0;
|
80 |
-
}
|
81 |
-
.form-group-lg .bootstrap-select.btn-group.form-control,
|
82 |
-
.form-group-sm .bootstrap-select.btn-group.form-control {
|
83 |
-
padding: 0;
|
84 |
-
}
|
85 |
-
.form-inline .bootstrap-select.btn-group .form-control {
|
86 |
-
width: 100%;
|
87 |
-
}
|
88 |
-
.bootstrap-select.btn-group.disabled,
|
89 |
-
.bootstrap-select.btn-group > .disabled {
|
90 |
-
cursor: not-allowed;
|
91 |
-
}
|
92 |
-
.bootstrap-select.btn-group.disabled:focus,
|
93 |
-
.bootstrap-select.btn-group > .disabled:focus {
|
94 |
-
outline: none !important;
|
95 |
-
}
|
96 |
-
.bootstrap-select.btn-group.bs-container {
|
97 |
-
position: absolute;
|
98 |
-
}
|
99 |
-
.bootstrap-select.btn-group.bs-container .dropdown-menu {
|
100 |
-
z-index: 1060;
|
101 |
-
}
|
102 |
-
.bootstrap-select.btn-group .dropdown-toggle .filter-option {
|
103 |
-
display: inline-block;
|
104 |
-
overflow: hidden;
|
105 |
-
width: 100%;
|
106 |
-
text-align: left;
|
107 |
-
}
|
108 |
-
.bootstrap-select.btn-group .dropdown-toggle .caret {
|
109 |
-
position: absolute;
|
110 |
-
top: 50%;
|
111 |
-
right: 12px;
|
112 |
-
margin-top: -2px;
|
113 |
-
vertical-align: middle;
|
114 |
-
}
|
115 |
-
.bootstrap-select.btn-group[class*="col-"] .dropdown-toggle {
|
116 |
-
width: 100%;
|
117 |
-
}
|
118 |
-
.bootstrap-select.btn-group .dropdown-menu {
|
119 |
-
min-width: 100%;
|
120 |
-
-webkit-box-sizing: border-box;
|
121 |
-
-moz-box-sizing: border-box;
|
122 |
-
box-sizing: border-box;
|
123 |
-
}
|
124 |
-
.bootstrap-select.btn-group .dropdown-menu.inner {
|
125 |
-
position: static;
|
126 |
-
float: none;
|
127 |
-
border: 0;
|
128 |
-
padding: 0;
|
129 |
-
margin: 0;
|
130 |
-
border-radius: 0;
|
131 |
-
-webkit-box-shadow: none;
|
132 |
-
box-shadow: none;
|
133 |
-
}
|
134 |
-
.bootstrap-select.btn-group .dropdown-menu li {
|
135 |
-
position: relative;
|
136 |
-
}
|
137 |
-
.bootstrap-select.btn-group .dropdown-menu li.active small {
|
138 |
-
color: #fff;
|
139 |
-
}
|
140 |
-
.bootstrap-select.btn-group .dropdown-menu li.disabled a {
|
141 |
-
cursor: not-allowed;
|
142 |
-
}
|
143 |
-
.bootstrap-select.btn-group .dropdown-menu li a {
|
144 |
-
cursor: pointer;
|
145 |
-
-webkit-user-select: none;
|
146 |
-
-moz-user-select: none;
|
147 |
-
-ms-user-select: none;
|
148 |
-
user-select: none;
|
149 |
-
}
|
150 |
-
.bootstrap-select.btn-group .dropdown-menu li a.opt {
|
151 |
-
position: relative;
|
152 |
-
padding-left: 2.25em;
|
153 |
-
}
|
154 |
-
.bootstrap-select.btn-group .dropdown-menu li a span.check-mark {
|
155 |
-
display: none;
|
156 |
-
}
|
157 |
-
.bootstrap-select.btn-group .dropdown-menu li a span.text {
|
158 |
-
display: inline-block;
|
159 |
-
}
|
160 |
-
.bootstrap-select.btn-group .dropdown-menu li small {
|
161 |
-
padding-left: 0.5em;
|
162 |
-
}
|
163 |
-
.bootstrap-select.btn-group .dropdown-menu .notify {
|
164 |
-
position: absolute;
|
165 |
-
bottom: 5px;
|
166 |
-
width: 96%;
|
167 |
-
margin: 0 2%;
|
168 |
-
min-height: 26px;
|
169 |
-
padding: 3px 5px;
|
170 |
-
background: #f5f5f5;
|
171 |
-
border: 1px solid #e3e3e3;
|
172 |
-
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
|
173 |
-
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
|
174 |
-
pointer-events: none;
|
175 |
-
opacity: 0.9;
|
176 |
-
-webkit-box-sizing: border-box;
|
177 |
-
-moz-box-sizing: border-box;
|
178 |
-
box-sizing: border-box;
|
179 |
-
}
|
180 |
-
.bootstrap-select.btn-group .no-results {
|
181 |
-
padding: 3px;
|
182 |
-
background: #f5f5f5;
|
183 |
-
margin: 0 5px;
|
184 |
-
white-space: nowrap;
|
185 |
-
}
|
186 |
-
.bootstrap-select.btn-group.fit-width .dropdown-toggle .filter-option {
|
187 |
-
position: static;
|
188 |
-
}
|
189 |
-
.bootstrap-select.btn-group.fit-width .dropdown-toggle .caret {
|
190 |
-
position: static;
|
191 |
-
top: auto;
|
192 |
-
margin-top: -1px;
|
193 |
-
}
|
194 |
-
.bootstrap-select.btn-group.show-tick .dropdown-menu li.selected a span.check-mark {
|
195 |
-
position: absolute;
|
196 |
-
display: inline-block;
|
197 |
-
right: 15px;
|
198 |
-
margin-top: 5px;
|
199 |
-
}
|
200 |
-
.bootstrap-select.btn-group.show-tick .dropdown-menu li a span.text {
|
201 |
-
margin-right: 34px;
|
202 |
-
}
|
203 |
-
.bootstrap-select.show-menu-arrow.open > .dropdown-toggle {
|
204 |
-
z-index: 1061;
|
205 |
-
}
|
206 |
-
.bootstrap-select.show-menu-arrow .dropdown-toggle:before {
|
207 |
-
content: '';
|
208 |
-
border-left: 7px solid transparent;
|
209 |
-
border-right: 7px solid transparent;
|
210 |
-
border-bottom: 7px solid rgba(204, 204, 204, 0.2);
|
211 |
-
position: absolute;
|
212 |
-
bottom: -4px;
|
213 |
-
left: 9px;
|
214 |
-
display: none;
|
215 |
-
}
|
216 |
-
.bootstrap-select.show-menu-arrow .dropdown-toggle:after {
|
217 |
-
content: '';
|
218 |
-
border-left: 6px solid transparent;
|
219 |
-
border-right: 6px solid transparent;
|
220 |
-
border-bottom: 6px solid white;
|
221 |
-
position: absolute;
|
222 |
-
bottom: -4px;
|
223 |
-
left: 10px;
|
224 |
-
display: none;
|
225 |
-
}
|
226 |
-
.bootstrap-select.show-menu-arrow.dropup .dropdown-toggle:before {
|
227 |
-
bottom: auto;
|
228 |
-
top: -3px;
|
229 |
-
border-top: 7px solid rgba(204, 204, 204, 0.2);
|
230 |
-
border-bottom: 0;
|
231 |
-
}
|
232 |
-
.bootstrap-select.show-menu-arrow.dropup .dropdown-toggle:after {
|
233 |
-
bottom: auto;
|
234 |
-
top: -3px;
|
235 |
-
border-top: 6px solid white;
|
236 |
-
border-bottom: 0;
|
237 |
-
}
|
238 |
-
.bootstrap-select.show-menu-arrow.pull-right .dropdown-toggle:before {
|
239 |
-
right: 12px;
|
240 |
-
left: auto;
|
241 |
-
}
|
242 |
-
.bootstrap-select.show-menu-arrow.pull-right .dropdown-toggle:after {
|
243 |
-
right: 13px;
|
244 |
-
left: auto;
|
245 |
-
}
|
246 |
-
.bootstrap-select.show-menu-arrow.open > .dropdown-toggle:before,
|
247 |
-
.bootstrap-select.show-menu-arrow.open > .dropdown-toggle:after {
|
248 |
-
display: block;
|
249 |
-
}
|
250 |
-
.bs-searchbox,
|
251 |
-
.bs-actionsbox,
|
252 |
-
.bs-donebutton {
|
253 |
-
padding: 4px 8px;
|
254 |
-
}
|
255 |
-
.bs-actionsbox {
|
256 |
-
width: 100%;
|
257 |
-
-webkit-box-sizing: border-box;
|
258 |
-
-moz-box-sizing: border-box;
|
259 |
-
box-sizing: border-box;
|
260 |
-
}
|
261 |
-
.bs-actionsbox .btn-group button {
|
262 |
-
width: 50%;
|
263 |
-
}
|
264 |
-
.bs-donebutton {
|
265 |
-
float: left;
|
266 |
-
width: 100%;
|
267 |
-
-webkit-box-sizing: border-box;
|
268 |
-
-moz-box-sizing: border-box;
|
269 |
-
box-sizing: border-box;
|
270 |
-
}
|
271 |
-
.bs-donebutton .btn-group button {
|
272 |
-
width: 100%;
|
273 |
-
}
|
274 |
-
.bs-searchbox + .bs-actionsbox {
|
275 |
-
padding: 0 8px 4px;
|
276 |
-
}
|
277 |
-
.bs-searchbox .form-control {
|
278 |
-
margin-bottom: 0;
|
279 |
-
width: 100%;
|
280 |
-
float: none;
|
281 |
-
}
|
282 |
/*# sourceMappingURL=bootstrap-select.css.map */
|
1 |
+
/*!
|
2 |
+
* Bootstrap-select v1.10.0 (http://silviomoreto.github.io/bootstrap-select)
|
3 |
+
*
|
4 |
+
* Copyright 2013-2016 bootstrap-select
|
5 |
+
* Licensed under MIT (https://github.com/silviomoreto/bootstrap-select/blob/master/LICENSE)
|
6 |
+
*/
|
7 |
+
|
8 |
+
select.bs-select-hidden,
|
9 |
+
select.selectpicker {
|
10 |
+
display: none !important;
|
11 |
+
}
|
12 |
+
.bootstrap-select {
|
13 |
+
width: 220px \0;
|
14 |
+
/*IE9 and below*/
|
15 |
+
}
|
16 |
+
.bootstrap-select > .dropdown-toggle {
|
17 |
+
width: 100%;
|
18 |
+
padding-right: 25px;
|
19 |
+
z-index: 1;
|
20 |
+
}
|
21 |
+
.bootstrap-select > select {
|
22 |
+
position: absolute !important;
|
23 |
+
bottom: 0;
|
24 |
+
left: 50%;
|
25 |
+
display: block !important;
|
26 |
+
width: 0.5px !important;
|
27 |
+
height: 100% !important;
|
28 |
+
padding: 0 !important;
|
29 |
+
opacity: 0 !important;
|
30 |
+
border: none;
|
31 |
+
}
|
32 |
+
.bootstrap-select > select.mobile-device {
|
33 |
+
top: 0;
|
34 |
+
left: 0;
|
35 |
+
display: block !important;
|
36 |
+
width: 100% !important;
|
37 |
+
z-index: 2;
|
38 |
+
}
|
39 |
+
.has-error .bootstrap-select .dropdown-toggle,
|
40 |
+
.error .bootstrap-select .dropdown-toggle {
|
41 |
+
border-color: #b94a48;
|
42 |
+
}
|
43 |
+
.bootstrap-select.fit-width {
|
44 |
+
width: auto !important;
|
45 |
+
}
|
46 |
+
.bootstrap-select:not([class*="col-"]):not([class*="form-control"]):not(.input-group-btn) {
|
47 |
+
width: 96%;
|
48 |
+
}
|
49 |
+
.bootstrap-select .dropdown-toggle:focus {
|
50 |
+
outline: thin dotted #333333 !important;
|
51 |
+
outline: 5px auto -webkit-focus-ring-color !important;
|
52 |
+
outline-offset: -2px;
|
53 |
+
}
|
54 |
+
.bootstrap-select.form-control {
|
55 |
+
margin-bottom: 0;
|
56 |
+
padding: 0;
|
57 |
+
border: none;
|
58 |
+
}
|
59 |
+
.bootstrap-select.form-control:not([class*="col-"]) {
|
60 |
+
width: 100%;
|
61 |
+
}
|
62 |
+
.bootstrap-select.form-control.input-group-btn {
|
63 |
+
z-index: auto;
|
64 |
+
}
|
65 |
+
.bootstrap-select.btn-group:not(.input-group-btn),
|
66 |
+
.bootstrap-select.btn-group[class*="col-"] {
|
67 |
+
float: none;
|
68 |
+
display: inline-block;
|
69 |
+
margin-left: 0;
|
70 |
+
}
|
71 |
+
.bootstrap-select.btn-group.dropdown-menu-right,
|
72 |
+
.bootstrap-select.btn-group[class*="col-"].dropdown-menu-right,
|
73 |
+
.row .bootstrap-select.btn-group[class*="col-"].dropdown-menu-right {
|
74 |
+
float: right;
|
75 |
+
}
|
76 |
+
.form-inline .bootstrap-select.btn-group,
|
77 |
+
.form-horizontal .bootstrap-select.btn-group,
|
78 |
+
.form-group .bootstrap-select.btn-group {
|
79 |
+
margin-bottom: 0;
|
80 |
+
}
|
81 |
+
.form-group-lg .bootstrap-select.btn-group.form-control,
|
82 |
+
.form-group-sm .bootstrap-select.btn-group.form-control {
|
83 |
+
padding: 0;
|
84 |
+
}
|
85 |
+
.form-inline .bootstrap-select.btn-group .form-control {
|
86 |
+
width: 100%;
|
87 |
+
}
|
88 |
+
.bootstrap-select.btn-group.disabled,
|
89 |
+
.bootstrap-select.btn-group > .disabled {
|
90 |
+
cursor: not-allowed;
|
91 |
+
}
|
92 |
+
.bootstrap-select.btn-group.disabled:focus,
|
93 |
+
.bootstrap-select.btn-group > .disabled:focus {
|
94 |
+
outline: none !important;
|
95 |
+
}
|
96 |
+
.bootstrap-select.btn-group.bs-container {
|
97 |
+
position: absolute;
|
98 |
+
}
|
99 |
+
.bootstrap-select.btn-group.bs-container .dropdown-menu {
|
100 |
+
z-index: 1060;
|
101 |
+
}
|
102 |
+
.bootstrap-select.btn-group .dropdown-toggle .filter-option {
|
103 |
+
display: inline-block;
|
104 |
+
overflow: hidden;
|
105 |
+
width: 100%;
|
106 |
+
text-align: left;
|
107 |
+
}
|
108 |
+
.bootstrap-select.btn-group .dropdown-toggle .caret {
|
109 |
+
position: absolute;
|
110 |
+
top: 50%;
|
111 |
+
right: 12px;
|
112 |
+
margin-top: -2px;
|
113 |
+
vertical-align: middle;
|
114 |
+
}
|
115 |
+
.bootstrap-select.btn-group[class*="col-"] .dropdown-toggle {
|
116 |
+
width: 100%;
|
117 |
+
}
|
118 |
+
.bootstrap-select.btn-group .dropdown-menu {
|
119 |
+
min-width: 100%;
|
120 |
+
-webkit-box-sizing: border-box;
|
121 |
+
-moz-box-sizing: border-box;
|
122 |
+
box-sizing: border-box;
|
123 |
+
}
|
124 |
+
.bootstrap-select.btn-group .dropdown-menu.inner {
|
125 |
+
position: static;
|
126 |
+
float: none;
|
127 |
+
border: 0;
|
128 |
+
padding: 0;
|
129 |
+
margin: 0;
|
130 |
+
border-radius: 0;
|
131 |
+
-webkit-box-shadow: none;
|
132 |
+
box-shadow: none;
|
133 |
+
}
|
134 |
+
.bootstrap-select.btn-group .dropdown-menu li {
|
135 |
+
position: relative;
|
136 |
+
}
|
137 |
+
.bootstrap-select.btn-group .dropdown-menu li.active small {
|
138 |
+
color: #fff;
|
139 |
+
}
|
140 |
+
.bootstrap-select.btn-group .dropdown-menu li.disabled a {
|
141 |
+
cursor: not-allowed;
|
142 |
+
}
|
143 |
+
.bootstrap-select.btn-group .dropdown-menu li a {
|
144 |
+
cursor: pointer;
|
145 |
+
-webkit-user-select: none;
|
146 |
+
-moz-user-select: none;
|
147 |
+
-ms-user-select: none;
|
148 |
+
user-select: none;
|
149 |
+
}
|
150 |
+
.bootstrap-select.btn-group .dropdown-menu li a.opt {
|
151 |
+
position: relative;
|
152 |
+
padding-left: 2.25em;
|
153 |
+
}
|
154 |
+
.bootstrap-select.btn-group .dropdown-menu li a span.check-mark {
|
155 |
+
display: none;
|
156 |
+
}
|
157 |
+
.bootstrap-select.btn-group .dropdown-menu li a span.text {
|
158 |
+
display: inline-block;
|
159 |
+
}
|
160 |
+
.bootstrap-select.btn-group .dropdown-menu li small {
|
161 |
+
padding-left: 0.5em;
|
162 |
+
}
|
163 |
+
.bootstrap-select.btn-group .dropdown-menu .notify {
|
164 |
+
position: absolute;
|
165 |
+
bottom: 5px;
|
166 |
+
width: 96%;
|
167 |
+
margin: 0 2%;
|
168 |
+
min-height: 26px;
|
169 |
+
padding: 3px 5px;
|
170 |
+
background: #f5f5f5;
|
171 |
+
border: 1px solid #e3e3e3;
|
172 |
+
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
|
173 |
+
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
|
174 |
+
pointer-events: none;
|
175 |
+
opacity: 0.9;
|
176 |
+
-webkit-box-sizing: border-box;
|
177 |
+
-moz-box-sizing: border-box;
|
178 |
+
box-sizing: border-box;
|
179 |
+
}
|
180 |
+
.bootstrap-select.btn-group .no-results {
|
181 |
+
padding: 3px;
|
182 |
+
background: #f5f5f5;
|
183 |
+
margin: 0 5px;
|
184 |
+
white-space: nowrap;
|
185 |
+
}
|
186 |
+
.bootstrap-select.btn-group.fit-width .dropdown-toggle .filter-option {
|
187 |
+
position: static;
|
188 |
+
}
|
189 |
+
.bootstrap-select.btn-group.fit-width .dropdown-toggle .caret {
|
190 |
+
position: static;
|
191 |
+
top: auto;
|
192 |
+
margin-top: -1px;
|
193 |
+
}
|
194 |
+
.bootstrap-select.btn-group.show-tick .dropdown-menu li.selected a span.check-mark {
|
195 |
+
position: absolute;
|
196 |
+
display: inline-block;
|
197 |
+
right: 15px;
|
198 |
+
margin-top: 5px;
|
199 |
+
}
|
200 |
+
.bootstrap-select.btn-group.show-tick .dropdown-menu li a span.text {
|
201 |
+
margin-right: 34px;
|
202 |
+
}
|
203 |
+
.bootstrap-select.show-menu-arrow.open > .dropdown-toggle {
|
204 |
+
z-index: 1061;
|
205 |
+
}
|
206 |
+
.bootstrap-select.show-menu-arrow .dropdown-toggle:before {
|
207 |
+
content: '';
|
208 |
+
border-left: 7px solid transparent;
|
209 |
+
border-right: 7px solid transparent;
|
210 |
+
border-bottom: 7px solid rgba(204, 204, 204, 0.2);
|
211 |
+
position: absolute;
|
212 |
+
bottom: -4px;
|
213 |
+
left: 9px;
|
214 |
+
display: none;
|
215 |
+
}
|
216 |
+
.bootstrap-select.show-menu-arrow .dropdown-toggle:after {
|
217 |
+
content: '';
|
218 |
+
border-left: 6px solid transparent;
|
219 |
+
border-right: 6px solid transparent;
|
220 |
+
border-bottom: 6px solid white;
|
221 |
+
position: absolute;
|
222 |
+
bottom: -4px;
|
223 |
+
left: 10px;
|
224 |
+
display: none;
|
225 |
+
}
|
226 |
+
.bootstrap-select.show-menu-arrow.dropup .dropdown-toggle:before {
|
227 |
+
bottom: auto;
|
228 |
+
top: -3px;
|
229 |
+
border-top: 7px solid rgba(204, 204, 204, 0.2);
|
230 |
+
border-bottom: 0;
|
231 |
+
}
|
232 |
+
.bootstrap-select.show-menu-arrow.dropup .dropdown-toggle:after {
|
233 |
+
bottom: auto;
|
234 |
+
top: -3px;
|
235 |
+
border-top: 6px solid white;
|
236 |
+
border-bottom: 0;
|
237 |
+
}
|
238 |
+
.bootstrap-select.show-menu-arrow.pull-right .dropdown-toggle:before {
|
239 |
+
right: 12px;
|
240 |
+
left: auto;
|
241 |
+
}
|
242 |
+
.bootstrap-select.show-menu-arrow.pull-right .dropdown-toggle:after {
|
243 |
+
right: 13px;
|
244 |
+
left: auto;
|
245 |
+
}
|
246 |
+
.bootstrap-select.show-menu-arrow.open > .dropdown-toggle:before,
|
247 |
+
.bootstrap-select.show-menu-arrow.open > .dropdown-toggle:after {
|
248 |
+
display: block;
|
249 |
+
}
|
250 |
+
.bs-searchbox,
|
251 |
+
.bs-actionsbox,
|
252 |
+
.bs-donebutton {
|
253 |
+
padding: 4px 8px;
|
254 |
+
}
|
255 |
+
.bs-actionsbox {
|
256 |
+
width: 100%;
|
257 |
+
-webkit-box-sizing: border-box;
|
258 |
+
-moz-box-sizing: border-box;
|
259 |
+
box-sizing: border-box;
|
260 |
+
}
|
261 |
+
.bs-actionsbox .btn-group button {
|
262 |
+
width: 50%;
|
263 |
+
}
|
264 |
+
.bs-donebutton {
|
265 |
+
float: left;
|
266 |
+
width: 100%;
|
267 |
+
-webkit-box-sizing: border-box;
|
268 |
+
-moz-box-sizing: border-box;
|
269 |
+
box-sizing: border-box;
|
270 |
+
}
|
271 |
+
.bs-donebutton .btn-group button {
|
272 |
+
width: 100%;
|
273 |
+
}
|
274 |
+
.bs-searchbox + .bs-actionsbox {
|
275 |
+
padding: 0 8px 4px;
|
276 |
+
}
|
277 |
+
.bs-searchbox .form-control {
|
278 |
+
margin-bottom: 0;
|
279 |
+
width: 100%;
|
280 |
+
float: none;
|
281 |
+
}
|
282 |
/*# sourceMappingURL=bootstrap-select.css.map */
|
inc/css/daterangepicker.css
CHANGED
@@ -1,233 +1,233 @@
|
|
1 |
-
.daterangepicker {
|
2 |
-
position: absolute;
|
3 |
-
color: inherit;
|
4 |
-
background: #fff;
|
5 |
-
border-radius: 4px;
|
6 |
-
width: 278px;
|
7 |
-
padding: 4px;
|
8 |
-
margin-top: 1px;
|
9 |
-
top: 100px;
|
10 |
-
left: 20px;
|
11 |
-
/* Calendars */ }
|
12 |
-
.daterangepicker:before, .daterangepicker:after {
|
13 |
-
position: absolute;
|
14 |
-
display: inline-block;
|
15 |
-
border-bottom-color: rgba(0, 0, 0, 0.2);
|
16 |
-
content: ''; }
|
17 |
-
.daterangepicker:before {
|
18 |
-
top: -7px;
|
19 |
-
border-right: 7px solid transparent;
|
20 |
-
border-left: 7px solid transparent;
|
21 |
-
border-bottom: 7px solid #ccc; }
|
22 |
-
.daterangepicker:after {
|
23 |
-
top: -6px;
|
24 |
-
border-right: 6px solid transparent;
|
25 |
-
border-bottom: 6px solid #fff;
|
26 |
-
border-left: 6px solid transparent; }
|
27 |
-
.daterangepicker.opensleft:before {
|
28 |
-
right: 9px; }
|
29 |
-
.daterangepicker.opensleft:after {
|
30 |
-
right: 10px; }
|
31 |
-
.daterangepicker.openscenter:before {
|
32 |
-
left: 0;
|
33 |
-
right: 0;
|
34 |
-
width: 0;
|
35 |
-
margin-left: auto;
|
36 |
-
margin-right: auto; }
|
37 |
-
.daterangepicker.openscenter:after {
|
38 |
-
left: 0;
|
39 |
-
right: 0;
|
40 |
-
width: 0;
|
41 |
-
margin-left: auto;
|
42 |
-
margin-right: auto; }
|
43 |
-
.daterangepicker.opensright:before {
|
44 |
-
left: 9px; }
|
45 |
-
.daterangepicker.opensright:after {
|
46 |
-
left: 10px; }
|
47 |
-
.daterangepicker.dropup {
|
48 |
-
margin-top: -5px; }
|
49 |
-
.daterangepicker.dropup:before {
|
50 |
-
top: initial;
|
51 |
-
bottom: -7px;
|
52 |
-
border-bottom: initial;
|
53 |
-
border-top: 7px solid #ccc; }
|
54 |
-
.daterangepicker.dropup:after {
|
55 |
-
top: initial;
|
56 |
-
bottom: -6px;
|
57 |
-
border-bottom: initial;
|
58 |
-
border-top: 6px solid #fff; }
|
59 |
-
.daterangepicker.dropdown-menu {
|
60 |
-
max-width: none;
|
61 |
-
z-index: 3001; }
|
62 |
-
.daterangepicker.single .ranges, .daterangepicker.single .calendar {
|
63 |
-
float: none; }
|
64 |
-
.daterangepicker.show-calendar .calendar {
|
65 |
-
display: block; }
|
66 |
-
.daterangepicker .calendar {
|
67 |
-
display: none;
|
68 |
-
max-width: 270px;
|
69 |
-
margin: 4px; }
|
70 |
-
.daterangepicker .calendar.single .calendar-table {
|
71 |
-
border: none; }
|
72 |
-
.daterangepicker .calendar th, .daterangepicker .calendar td {
|
73 |
-
white-space: nowrap;
|
74 |
-
text-align: center;
|
75 |
-
min-width: 32px; }
|
76 |
-
.daterangepicker .calendar-table {
|
77 |
-
border: 1px solid #fff;
|
78 |
-
padding: 4px;
|
79 |
-
border-radius: 4px;
|
80 |
-
background: #fff; }
|
81 |
-
.daterangepicker table {
|
82 |
-
width: 100%;
|
83 |
-
margin: 0; }
|
84 |
-
.daterangepicker td, .daterangepicker th {
|
85 |
-
text-align: center;
|
86 |
-
width: 20px;
|
87 |
-
height: 20px;
|
88 |
-
//border-radius: 4px;
|
89 |
-
border: 1px solid transparent;
|
90 |
-
white-space: nowrap;
|
91 |
-
cursor: pointer; }
|
92 |
-
.daterangepicker td.available:hover, .daterangepicker th.available:hover {
|
93 |
-
background: #eee; }
|
94 |
-
.daterangepicker td.week, .daterangepicker th.week {
|
95 |
-
font-size: 80%;
|
96 |
-
color: #ccc; }
|
97 |
-
.daterangepicker td.off, .daterangepicker td.off.in-range, .daterangepicker td.off.start-date, .daterangepicker td.off.end-date {
|
98 |
-
background-color: #fff;
|
99 |
-
border-color: transparent;
|
100 |
-
color: #999; }
|
101 |
-
.daterangepicker td.in-range {
|
102 |
-
background-color: #b7d9e8;
|
103 |
-
border-color: transparent;
|
104 |
-
color: #000;
|
105 |
-
border-radius: 0; }
|
106 |
-
.daterangepicker td.start-date {
|
107 |
-
border-radius: 4px 0 0 4px; }
|
108 |
-
.daterangepicker td.end-date {
|
109 |
-
border-radius: 0 4px 4px 0; }
|
110 |
-
.daterangepicker td.start-date.end-date {
|
111 |
-
border-radius: 4px; }
|
112 |
-
.daterangepicker td.active, .daterangepicker td.active:hover {
|
113 |
-
background-color: #357ebd;
|
114 |
-
border-color: transparent;
|
115 |
-
color: #fff; }
|
116 |
-
.daterangepicker th.month {
|
117 |
-
width: auto; }
|
118 |
-
.daterangepicker td.disabled, .daterangepicker option.disabled {
|
119 |
-
color: #999;
|
120 |
-
cursor: not-allowed;
|
121 |
-
/*text-decoration: line-through;*/ }
|
122 |
-
.daterangepicker select.monthselect, .daterangepicker select.yearselect {
|
123 |
-
font-size: 12px;
|
124 |
-
padding: 1px;
|
125 |
-
height: auto;
|
126 |
-
margin: 0;
|
127 |
-
cursor: default; }
|
128 |
-
.daterangepicker select.monthselect {
|
129 |
-
margin-right: 2%;
|
130 |
-
width: 56%; }
|
131 |
-
.daterangepicker select.yearselect {
|
132 |
-
width: 40%; }
|
133 |
-
.daterangepicker select.hourselect, .daterangepicker select.minuteselect, .daterangepicker select.secondselect, .daterangepicker select.ampmselect {
|
134 |
-
width: 50px;
|
135 |
-
margin-bottom: 0; }
|
136 |
-
.daterangepicker .input-mini {
|
137 |
-
border: 1px solid #ccc;
|
138 |
-
border-radius: 4px;
|
139 |
-
color: #555;
|
140 |
-
height: 30px;
|
141 |
-
line-height: 30px;
|
142 |
-
display: block;
|
143 |
-
vertical-align: middle;
|
144 |
-
margin: 0 0 5px 0;
|
145 |
-
padding: 0 6px 0 28px;
|
146 |
-
width:100% }
|
147 |
-
.daterangepicker .input-mini.active {
|
148 |
-
border: 1px solid #08c;
|
149 |
-
border-radius: 4px; }
|
150 |
-
.daterangepicker .daterangepicker_input {
|
151 |
-
position: relative;
|
152 |
-
background-color:#fff
|
153 |
-
}
|
154 |
-
.daterangepicker .daterangepicker_input i {
|
155 |
-
position: absolute;
|
156 |
-
left: 8px;
|
157 |
-
top: 8px; }
|
158 |
-
.daterangepicker .calendar-time {
|
159 |
-
text-align: center;
|
160 |
-
margin: 5px auto;
|
161 |
-
line-height: 30px;
|
162 |
-
position: relative;
|
163 |
-
padding-left: 28px; }
|
164 |
-
.daterangepicker .calendar-time select.disabled {
|
165 |
-
color: #ccc;
|
166 |
-
cursor: not-allowed; }
|
167 |
-
|
168 |
-
.ranges {
|
169 |
-
font-size: 11px;
|
170 |
-
float: none;
|
171 |
-
margin: 4px;
|
172 |
-
text-align: left; }
|
173 |
-
.ranges ul {
|
174 |
-
list-style: none;
|
175 |
-
margin: 0 auto;
|
176 |
-
padding: 0;
|
177 |
-
width: 100%; }
|
178 |
-
.ranges li {
|
179 |
-
font-size: 13px;
|
180 |
-
background: #f5f5f5;
|
181 |
-
border: 1px solid #f5f5f5;
|
182 |
-
border-radius: 4px;
|
183 |
-
color: #08c;
|
184 |
-
padding: 3px 12px;
|
185 |
-
margin-bottom: 8px;
|
186 |
-
cursor: pointer; }
|
187 |
-
.ranges li:hover {
|
188 |
-
background: #08c;
|
189 |
-
border: 1px solid #08c;
|
190 |
-
color: #fff; }
|
191 |
-
.ranges li.active {
|
192 |
-
background: #08c;
|
193 |
-
border: 1px solid #08c;
|
194 |
-
color: #fff; }
|
195 |
-
|
196 |
-
/* Larger Screen Styling */
|
197 |
-
@media (min-width: 564px) {
|
198 |
-
.daterangepicker {
|
199 |
-
width: auto; }
|
200 |
-
.daterangepicker .ranges ul {
|
201 |
-
width: 160px; }
|
202 |
-
.daterangepicker.single .ranges ul {
|
203 |
-
width: 100%; }
|
204 |
-
.daterangepicker.single .calendar.left {
|
205 |
-
clear: none; }
|
206 |
-
.daterangepicker.single .ranges, .daterangepicker.single .calendar {
|
207 |
-
float: left; }
|
208 |
-
.daterangepicker .calendar.left {
|
209 |
-
clear: left;
|
210 |
-
margin-right: 0; }
|
211 |
-
.daterangepicker .calendar.left .calendar-table {
|
212 |
-
border-right: none;
|
213 |
-
border-top-right-radius: 0;
|
214 |
-
border-bottom-right-radius: 0; }
|
215 |
-
.daterangepicker .calendar.right {
|
216 |
-
margin-left: 0; }
|
217 |
-
.daterangepicker .calendar.right .calendar-table {
|
218 |
-
border-left: none;
|
219 |
-
border-top-left-radius: 0;
|
220 |
-
border-bottom-left-radius: 0; }
|
221 |
-
.daterangepicker .left .daterangepicker_input {
|
222 |
-
padding-right: 12px; }
|
223 |
-
.daterangepicker .calendar.left .calendar-table {
|
224 |
-
padding-right: 12px; }
|
225 |
-
.daterangepicker .ranges, .daterangepicker .calendar {
|
226 |
-
float: left; } }
|
227 |
-
|
228 |
-
@media (min-width: 730px) {
|
229 |
-
.daterangepicker .ranges {
|
230 |
-
width: auto;
|
231 |
-
float: left; }
|
232 |
-
.daterangepicker .calendar.left {
|
233 |
-
clear: none; } }
|
1 |
+
.daterangepicker {
|
2 |
+
position: absolute;
|
3 |
+
color: inherit;
|
4 |
+
background: #fff;
|
5 |
+
border-radius: 4px;
|
6 |
+
width: 278px;
|
7 |
+
padding: 4px;
|
8 |
+
margin-top: 1px;
|
9 |
+
top: 100px;
|
10 |
+
left: 20px;
|
11 |
+
/* Calendars */ }
|
12 |
+
.daterangepicker:before, .daterangepicker:after {
|
13 |
+
position: absolute;
|
14 |
+
display: inline-block;
|
15 |
+
border-bottom-color: rgba(0, 0, 0, 0.2);
|
16 |
+
content: ''; }
|
17 |
+
.daterangepicker:before {
|
18 |
+
top: -7px;
|
19 |
+
border-right: 7px solid transparent;
|
20 |
+
border-left: 7px solid transparent;
|
21 |
+
border-bottom: 7px solid #ccc; }
|
22 |
+
.daterangepicker:after {
|
23 |
+
top: -6px;
|
24 |
+
border-right: 6px solid transparent;
|
25 |
+
border-bottom: 6px solid #fff;
|
26 |
+
border-left: 6px solid transparent; }
|
27 |
+
.daterangepicker.opensleft:before {
|
28 |
+
right: 9px; }
|
29 |
+
.daterangepicker.opensleft:after {
|
30 |
+
right: 10px; }
|
31 |
+
.daterangepicker.openscenter:before {
|
32 |
+
left: 0;
|
33 |
+
right: 0;
|
34 |
+
width: 0;
|
35 |
+
margin-left: auto;
|
36 |
+
margin-right: auto; }
|
37 |
+
.daterangepicker.openscenter:after {
|
38 |
+
left: 0;
|
39 |
+
right: 0;
|
40 |
+
width: 0;
|
41 |
+
margin-left: auto;
|
42 |
+
margin-right: auto; }
|
43 |
+
.daterangepicker.opensright:before {
|
44 |
+
left: 9px; }
|
45 |
+
.daterangepicker.opensright:after {
|
46 |
+
left: 10px; }
|
47 |
+
.daterangepicker.dropup {
|
48 |
+
margin-top: -5px; }
|
49 |
+
.daterangepicker.dropup:before {
|
50 |
+
top: initial;
|
51 |
+
bottom: -7px;
|
52 |
+
border-bottom: initial;
|
53 |
+
border-top: 7px solid #ccc; }
|
54 |
+
.daterangepicker.dropup:after {
|
55 |
+
top: initial;
|
56 |
+
bottom: -6px;
|
57 |
+
border-bottom: initial;
|
58 |
+
border-top: 6px solid #fff; }
|
59 |
+
.daterangepicker.dropdown-menu {
|
60 |
+
max-width: none;
|
61 |
+
z-index: 3001; }
|
62 |
+
.daterangepicker.single .ranges, .daterangepicker.single .calendar {
|
63 |
+
float: none; }
|
64 |
+
.daterangepicker.show-calendar .calendar {
|
65 |
+
display: block; }
|
66 |
+
.daterangepicker .calendar {
|
67 |
+
display: none;
|
68 |
+
max-width: 270px;
|
69 |
+
margin: 4px; }
|
70 |
+
.daterangepicker .calendar.single .calendar-table {
|
71 |
+
border: none; }
|
72 |
+
.daterangepicker .calendar th, .daterangepicker .calendar td {
|
73 |
+
white-space: nowrap;
|
74 |
+
text-align: center;
|
75 |
+
min-width: 32px; }
|
76 |
+
.daterangepicker .calendar-table {
|
77 |
+
border: 1px solid #fff;
|
78 |
+
padding: 4px;
|
79 |
+
border-radius: 4px;
|
80 |
+
background: #fff; }
|
81 |
+
.daterangepicker table {
|
82 |
+
width: 100%;
|
83 |
+
margin: 0; }
|
84 |
+
.daterangepicker td, .daterangepicker th {
|
85 |
+
text-align: center;
|
86 |
+
width: 20px;
|
87 |
+
height: 20px;
|
88 |
+
//border-radius: 4px;
|
89 |
+
border: 1px solid transparent;
|
90 |
+
white-space: nowrap;
|
91 |
+
cursor: pointer; }
|
92 |
+
.daterangepicker td.available:hover, .daterangepicker th.available:hover {
|
93 |
+
background: #eee; }
|
94 |
+
.daterangepicker td.week, .daterangepicker th.week {
|
95 |
+
font-size: 80%;
|
96 |
+
color: #ccc; }
|
97 |
+
.daterangepicker td.off, .daterangepicker td.off.in-range, .daterangepicker td.off.start-date, .daterangepicker td.off.end-date {
|
98 |
+
background-color: #fff;
|
99 |
+
border-color: transparent;
|
100 |
+
color: #999; }
|
101 |
+
.daterangepicker td.in-range {
|
102 |
+
background-color: #b7d9e8;
|
103 |
+
border-color: transparent;
|
104 |
+
color: #000;
|
105 |
+
border-radius: 0; }
|
106 |
+
.daterangepicker td.start-date {
|
107 |
+
border-radius: 4px 0 0 4px; }
|
108 |
+
.daterangepicker td.end-date {
|
109 |
+
border-radius: 0 4px 4px 0; }
|
110 |
+
.daterangepicker td.start-date.end-date {
|
111 |
+
border-radius: 4px; }
|
112 |
+
.daterangepicker td.active, .daterangepicker td.active:hover {
|
113 |
+
background-color: #357ebd;
|
114 |
+
border-color: transparent;
|
115 |
+
color: #fff; }
|
116 |
+
.daterangepicker th.month {
|
117 |
+
width: auto; }
|
118 |
+
.daterangepicker td.disabled, .daterangepicker option.disabled {
|
119 |
+
color: #999;
|
120 |
+
cursor: not-allowed;
|
121 |
+
/*text-decoration: line-through;*/ }
|
122 |
+
.daterangepicker select.monthselect, .daterangepicker select.yearselect {
|
123 |
+
font-size: 12px;
|
124 |
+
padding: 1px;
|
125 |
+
height: auto;
|
126 |
+
margin: 0;
|
127 |
+
cursor: default; }
|
128 |
+
.daterangepicker select.monthselect {
|
129 |
+
margin-right: 2%;
|
130 |
+
width: 56%; }
|
131 |
+
.daterangepicker select.yearselect {
|
132 |
+
width: 40%; }
|
133 |
+
.daterangepicker select.hourselect, .daterangepicker select.minuteselect, .daterangepicker select.secondselect, .daterangepicker select.ampmselect {
|
134 |
+
width: 50px;
|
135 |
+
margin-bottom: 0; }
|
136 |
+
.daterangepicker .input-mini {
|
137 |
+
border: 1px solid #ccc;
|
138 |
+
border-radius: 4px;
|
139 |
+
color: #555;
|
140 |
+
height: 30px;
|
141 |
+
line-height: 30px;
|
142 |
+
display: block;
|
143 |
+
vertical-align: middle;
|
144 |
+
margin: 0 0 5px 0;
|
145 |
+
padding: 0 6px 0 28px;
|
146 |
+
width:100% }
|
147 |
+
.daterangepicker .input-mini.active {
|
148 |
+
border: 1px solid #08c;
|
149 |
+
border-radius: 4px; }
|
150 |
+
.daterangepicker .daterangepicker_input {
|
151 |
+
position: relative;
|
152 |
+
background-color:#fff
|
153 |
+
}
|
154 |
+
.daterangepicker .daterangepicker_input i {
|
155 |
+
position: absolute;
|
156 |
+
left: 8px;
|
157 |
+
top: 8px; }
|
158 |
+
.daterangepicker .calendar-time {
|
159 |
+
text-align: center;
|
160 |
+
margin: 5px auto;
|
161 |
+
line-height: 30px;
|
162 |
+
position: relative;
|
163 |
+
padding-left: 28px; }
|
164 |
+
.daterangepicker .calendar-time select.disabled {
|
165 |
+
color: #ccc;
|
166 |
+
cursor: not-allowed; }
|
167 |
+
|
168 |
+
.ranges {
|
169 |
+
font-size: 11px;
|
170 |
+
float: none;
|
171 |
+
margin: 4px;
|
172 |
+
text-align: left; }
|
173 |
+
.ranges ul {
|
174 |
+
list-style: none;
|
175 |
+
margin: 0 auto;
|
176 |
+
padding: 0;
|
177 |
+
width: 100%; }
|
178 |
+
.ranges li {
|
179 |
+
font-size: 13px;
|
180 |
+
background: #f5f5f5;
|
181 |
+
border: 1px solid #f5f5f5;
|
182 |
+
border-radius: 4px;
|
183 |
+
color: #08c;
|
184 |
+
padding: 3px 12px;
|
185 |
+
margin-bottom: 8px;
|
186 |
+
cursor: pointer; }
|
187 |
+
.ranges li:hover {
|
188 |
+
background: #08c;
|
189 |
+
border: 1px solid #08c;
|
190 |
+
color: #fff; }
|
191 |
+
.ranges li.active {
|
192 |
+
background: #08c;
|
193 |
+
border: 1px solid #08c;
|
194 |
+
color: #fff; }
|
195 |
+
|
196 |
+
/* Larger Screen Styling */
|
197 |
+
@media (min-width: 564px) {
|
198 |
+
.daterangepicker {
|
199 |
+
width: auto; }
|
200 |
+
.daterangepicker .ranges ul {
|
201 |
+
width: 160px; }
|
202 |
+
.daterangepicker.single .ranges ul {
|
203 |
+
width: 100%; }
|
204 |
+
.daterangepicker.single .calendar.left {
|
205 |
+
clear: none; }
|
206 |
+
.daterangepicker.single .ranges, .daterangepicker.single .calendar {
|
207 |
+
float: left; }
|
208 |
+
.daterangepicker .calendar.left {
|
209 |
+
clear: left;
|
210 |
+
margin-right: 0; }
|
211 |
+
.daterangepicker .calendar.left .calendar-table {
|
212 |
+
border-right: none;
|
213 |
+
border-top-right-radius: 0;
|
214 |
+
border-bottom-right-radius: 0; }
|
215 |
+
.daterangepicker .calendar.right {
|
216 |
+
margin-left: 0; }
|
217 |
+
.daterangepicker .calendar.right .calendar-table {
|
218 |
+
border-left: none;
|
219 |
+
border-top-left-radius: 0;
|
220 |
+
border-bottom-left-radius: 0; }
|
221 |
+
.daterangepicker .left .daterangepicker_input {
|
222 |
+
padding-right: 12px; }
|
223 |
+
.daterangepicker .calendar.left .calendar-table {
|
224 |
+
padding-right: 12px; }
|
225 |
+
.daterangepicker .ranges, .daterangepicker .calendar {
|
226 |
+
float: left; } }
|
227 |
+
|
228 |
+
@media (min-width: 730px) {
|
229 |
+
.daterangepicker .ranges {
|
230 |
+
width: auto;
|
231 |
+
float: left; }
|
232 |
+
.daterangepicker .calendar.left {
|
233 |
+
clear: none; } }
|
inc/css/font_awesome.css
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
/*!
|
2 |
-
* Font Awesome 4.3.0 by @davegandy - http://fontawesome.io - @fontawesome
|
3 |
-
* License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License)
|
4 |
*/@font-face{font-family:'FontAwesome';src:url('../fonts/fontawesome-webfont.eot?v=4.3.0');src:url('../fonts/fontawesome-webfont.eot?#iefix&v=4.3.0') format('embedded-opentype'),url('../fonts/fontawesome-webfont.woff2?v=4.3.0') format('woff2'),url('../fonts/fontawesome-webfont.woff?v=4.3.0') format('woff'),url('../fonts/fontawesome-webfont.ttf?v=4.3.0') format('truetype'),url('../fonts/fontawesome-webfont.svg?v=4.3.0#fontawesomeregular') format('svg');font-weight:normal;font-style:normal}.fa{display:inline-block;font:normal normal normal 14px/1 FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;transform:translate(0, 0)}.fa-lg{font-size:1.33333333em;line-height:.75em;vertical-align:-15%}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-fw{width:1.28571429em;text-align:center}.fa-ul{padding-left:0;margin-left:2.14285714em;list-style-type:none}.fa-ul>li{position:relative}.fa-li{position:absolute;left:-2.14285714em;width:2.14285714em;top:.14285714em;text-align:center}.fa-li.fa-lg{left:-1.85714286em}.fa-border{padding:.2em .25em .15em;border:solid .08em #eee;border-radius:.1em}.pull-right{float:right}.pull-left{float:left}.fa.pull-left{margin-right:.3em}.fa.pull-right{margin-left:.3em}.fa-spin{-webkit-animation:fa-spin 2s infinite linear;animation:fa-spin 2s infinite linear}.fa-pulse{-webkit-animation:fa-spin 1s infinite steps(8);animation:fa-spin 1s infinite steps(8)}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.fa-rotate-90{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=1);-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2);-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=3);-webkit-transform:rotate(270deg);-ms-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1);-webkit-transform:scale(-1, 1);-ms-transform:scale(-1, 1);transform:scale(-1, 1)}.fa-flip-vertical{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1);-webkit-transform:scale(1, -1);-ms-transform:scale(1, -1);transform:scale(1, -1)}:root .fa-rotate-90,:root .fa-rotate-180,:root .fa-rotate-270,:root .fa-flip-horizontal,:root .fa-flip-vertical{filter:none}.fa-stack{position:relative;display:inline-block;width:2em;height:2em;line-height:2em;vertical-align:middle}.fa-stack-1x,.fa-stack-2x{position:absolute;left:0;width:100%;text-align:center}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:#fff}.fa-glass:before{content:"\f000"}.fa-music:before{content:"\f001"}.fa-search:before{content:"\f002"}.fa-envelope-o:before{content:"\f003"}.fa-heart:before{content:"\f004"}.fa-star:before{content:"\f005"}.fa-star-o:before{content:"\f006"}.fa-user:before{content:"\f007"}.fa-film:before{content:"\f008"}.fa-th-large:before{content:"\f009"}.fa-th:before{content:"\f00a"}.fa-th-list:before{content:"\f00b"}.fa-check:before{content:"\f00c"}.fa-remove:before,.fa-close:before,.fa-times:before{content:"\f00d"}.fa-search-plus:before{content:"\f00e"}.fa-search-minus:before{content:"\f010"}.fa-power-off:before{content:"\f011"}.fa-signal:before{content:"\f012"}.fa-gear:before,.fa-cog:before{content:"\f013"}.fa-trash-o:before{content:"\f014"}.fa-home:before{content:"\f015"}.fa-file-o:before{content:"\f016"}.fa-clock-o:before{content:"\f017"}.fa-road:before{content:"\f018"}.fa-download:before{content:"\f019"}.fa-arrow-circle-o-down:before{content:"\f01a"}.fa-arrow-circle-o-up:before{content:"\f01b"}.fa-inbox:before{content:"\f01c"}.fa-play-circle-o:before{content:"\f01d"}.fa-rotate-right:before,.fa-repeat:before{content:"\f01e"}.fa-refresh:before{content:"\f021"}.fa-list-alt:before{content:"\f022"}.fa-lock:before{content:"\f023"}.fa-flag:before{content:"\f024"}.fa-headphones:before{content:"\f025"}.fa-volume-off:before{content:"\f026"}.fa-volume-down:before{content:"\f027"}.fa-volume-up:before{content:"\f028"}.fa-qrcode:before{content:"\f029"}.fa-barcode:before{content:"\f02a"}.fa-tag:before{content:"\f02b"}.fa-tags:before{content:"\f02c"}.fa-book:before{content:"\f02d"}.fa-bookmark:before{content:"\f02e"}.fa-print:before{content:"\f02f"}.fa-camera:before{content:"\f030"}.fa-font:before{content:"\f031"}.fa-bold:before{content:"\f032"}.fa-italic:before{content:"\f033"}.fa-text-height:before{content:"\f034"}.fa-text-width:before{content:"\f035"}.fa-align-left:before{content:"\f036"}.fa-align-center:before{content:"\f037"}.fa-align-right:before{content:"\f038"}.fa-align-justify:before{content:"\f039"}.fa-list:before{content:"\f03a"}.fa-dedent:before,.fa-outdent:before{content:"\f03b"}.fa-indent:before{content:"\f03c"}.fa-video-camera:before{content:"\f03d"}.fa-photo:before,.fa-image:before,.fa-picture-o:before{content:"\f03e"}.fa-pencil:before{content:"\f040"}.fa-map-marker:before{content:"\f041"}.fa-adjust:before{content:"\f042"}.fa-tint:before{content:"\f043"}.fa-edit:before,.fa-pencil-square-o:before{content:"\f044"}.fa-share-square-o:before{content:"\f045"}.fa-check-square-o:before{content:"\f046"}.fa-arrows:before{content:"\f047"}.fa-step-backward:before{content:"\f048"}.fa-fast-backward:before{content:"\f049"}.fa-backward:before{content:"\f04a"}.fa-play:before{content:"\f04b"}.fa-pause:before{content:"\f04c"}.fa-stop:before{content:"\f04d"}.fa-forward:before{content:"\f04e"}.fa-fast-forward:before{content:"\f050"}.fa-step-forward:before{content:"\f051"}.fa-eject:before{content:"\f052"}.fa-chevron-left:before{content:"\f053"}.fa-chevron-right:before{content:"\f054"}.fa-plus-circle:before{content:"\f055"}.fa-minus-circle:before{content:"\f056"}.fa-times-circle:before{content:"\f057"}.fa-check-circle:before{content:"\f058"}.fa-question-circle:before{content:"\f059"}.fa-info-circle:before{content:"\f05a"}.fa-crosshairs:before{content:"\f05b"}.fa-times-circle-o:before{content:"\f05c"}.fa-check-circle-o:before{content:"\f05d"}.fa-ban:before{content:"\f05e"}.fa-arrow-left:before{content:"\f060"}.fa-arrow-right:before{content:"\f061"}.fa-arrow-up:before{content:"\f062"}.fa-arrow-down:before{content:"\f063"}.fa-mail-forward:before,.fa-share:before{content:"\f064"}.fa-expand:before{content:"\f065"}.fa-compress:before{content:"\f066"}.fa-plus:before{content:"\f067"}.fa-minus:before{content:"\f068"}.fa-asterisk:before{content:"\f069"}.fa-exclamation-circle:before{content:"\f06a"}.fa-gift:before{content:"\f06b"}.fa-leaf:before{content:"\f06c"}.fa-fire:before{content:"\f06d"}.fa-eye:before{content:"\f06e"}.fa-eye-slash:before{content:"\f070"}.fa-warning:before,.fa-exclamation-triangle:before{content:"\f071"}.fa-plane:before{content:"\f072"}.fa-calendar:before{content:"\f073"}.fa-random:before{content:"\f074"}.fa-comment:before{content:"\f075"}.fa-magnet:before{content:"\f076"}.fa-chevron-up:before{content:"\f077"}.fa-chevron-down:before{content:"\f078"}.fa-retweet:before{content:"\f079"}.fa-shopping-cart:before{content:"\f07a"}.fa-folder:before{content:"\f07b"}.fa-folder-open:before{content:"\f07c"}.fa-arrows-v:before{content:"\f07d"}.fa-arrows-h:before{content:"\f07e"}.fa-bar-chart-o:before,.fa-bar-chart:before{content:"\f080"}.fa-twitter-square:before{content:"\f081"}.fa-facebook-square:before{content:"\f082"}.fa-camera-retro:before{content:"\f083"}.fa-key:before{content:"\f084"}.fa-gears:before,.fa-cogs:before{content:"\f085"}.fa-comments:before{content:"\f086"}.fa-thumbs-o-up:before{content:"\f087"}.fa-thumbs-o-down:before{content:"\f088"}.fa-star-half:before{content:"\f089"}.fa-heart-o:before{content:"\f08a"}.fa-sign-out:before{content:"\f08b"}.fa-linkedin-square:before{content:"\f08c"}.fa-thumb-tack:before{content:"\f08d"}.fa-external-link:before{content:"\f08e"}.fa-sign-in:before{content:"\f090"}.fa-trophy:before{content:"\f091"}.fa-github-square:before{content:"\f092"}.fa-upload:before{content:"\f093"}.fa-lemon-o:before{content:"\f094"}.fa-phone:before{content:"\f095"}.fa-square-o:before{content:"\f096"}.fa-bookmark-o:before{content:"\f097"}.fa-phone-square:before{content:"\f098"}.fa-twitter:before{content:"\f099"}.fa-facebook-f:before,.fa-facebook:before{content:"\f09a"}.fa-github:before{content:"\f09b"}.fa-unlock:before{content:"\f09c"}.fa-credit-card:before{content:"\f09d"}.fa-rss:before{content:"\f09e"}.fa-hdd-o:before{content:"\f0a0"}.fa-bullhorn:before{content:"\f0a1"}.fa-bell:before{content:"\f0f3"}.fa-certificate:before{content:"\f0a3"}.fa-hand-o-right:before{content:"\f0a4"}.fa-hand-o-left:before{content:"\f0a5"}.fa-hand-o-up:before{content:"\f0a6"}.fa-hand-o-down:before{content:"\f0a7"}.fa-arrow-circle-left:before{content:"\f0a8"}.fa-arrow-circle-right:before{content:"\f0a9"}.fa-arrow-circle-up:before{content:"\f0aa"}.fa-arrow-circle-down:before{content:"\f0ab"}.fa-globe:before{content:"\f0ac"}.fa-wrench:before{content:"\f0ad"}.fa-tasks:before{content:"\f0ae"}.fa-filter:before{content:"\f0b0"}.fa-briefcase:before{content:"\f0b1"}.fa-arrows-alt:before{content:"\f0b2"}.fa-group:before,.fa-users:before{content:"\f0c0"}.fa-chain:before,.fa-link:before{content:"\f0c1"}.fa-cloud:before{content:"\f0c2"}.fa-flask:before{content:"\f0c3"}.fa-cut:before,.fa-scissors:before{content:"\f0c4"}.fa-copy:before,.fa-files-o:before{content:"\f0c5"}.fa-paperclip:before{content:"\f0c6"}.fa-save:before,.fa-floppy-o:before{content:"\f0c7"}.fa-square:before{content:"\f0c8"}.fa-navicon:before,.fa-reorder:before,.fa-bars:before{content:"\f0c9"}.fa-list-ul:before{content:"\f0ca"}.fa-list-ol:before{content:"\f0cb"}.fa-strikethrough:before{content:"\f0cc"}.fa-underline:before{content:"\f0cd"}.fa-table:before{content:"\f0ce"}.fa-magic:before{content:"\f0d0"}.fa-truck:before{content:"\f0d1"}.fa-pinterest:before{content:"\f0d2"}.fa-pinterest-square:before{content:"\f0d3"}.fa-google-plus-square:before{content:"\f0d4"}.fa-google-plus:before{content:"\f0d5"}.fa-money:before{content:"\f0d6"}.fa-caret-down:before{content:"\f0d7"}.fa-caret-up:before{content:"\f0d8"}.fa-caret-left:before{content:"\f0d9"}.fa-caret-right:before{content:"\f0da"}.fa-columns:before{content:"\f0db"}.fa-unsorted:before,.fa-sort:before{content:"\f0dc"}.fa-sort-down:before,.fa-sort-desc:before{content:"\f0dd"}.fa-sort-up:before,.fa-sort-asc:before{content:"\f0de"}.fa-envelope:before{content:"\f0e0"}.fa-linkedin:before{content:"\f0e1"}.fa-rotate-left:before,.fa-undo:before{content:"\f0e2"}.fa-legal:before,.fa-gavel:before{content:"\f0e3"}.fa-dashboard:before,.fa-tachometer:before{content:"\f0e4"}.fa-comment-o:before{content:"\f0e5"}.fa-comments-o:before{content:"\f0e6"}.fa-flash:before,.fa-bolt:before{content:"\f0e7"}.fa-sitemap:before{content:"\f0e8"}.fa-umbrella:before{content:"\f0e9"}.fa-paste:before,.fa-clipboard:before{content:"\f0ea"}.fa-lightbulb-o:before{content:"\f0eb"}.fa-exchange:before{content:"\f0ec"}.fa-cloud-download:before{content:"\f0ed"}.fa-cloud-upload:before{content:"\f0ee"}.fa-user-md:before{content:"\f0f0"}.fa-stethoscope:before{content:"\f0f1"}.fa-suitcase:before{content:"\f0f2"}.fa-bell-o:before{content:"\f0a2"}.fa-coffee:before{content:"\f0f4"}.fa-cutlery:before{content:"\f0f5"}.fa-file-text-o:before{content:"\f0f6"}.fa-building-o:before{content:"\f0f7"}.fa-hospital-o:before{content:"\f0f8"}.fa-ambulance:before{content:"\f0f9"}.fa-medkit:before{content:"\f0fa"}.fa-fighter-jet:before{content:"\f0fb"}.fa-beer:before{content:"\f0fc"}.fa-h-square:before{content:"\f0fd"}.fa-plus-square:before{content:"\f0fe"}.fa-angle-double-left:before{content:"\f100"}.fa-angle-double-right:before{content:"\f101"}.fa-angle-double-up:before{content:"\f102"}.fa-angle-double-down:before{content:"\f103"}.fa-angle-left:before{content:"\f104"}.fa-angle-right:before{content:"\f105"}.fa-angle-up:before{content:"\f106"}.fa-angle-down:before{content:"\f107"}.fa-desktop:before{content:"\f108"}.fa-laptop:before{content:"\f109"}.fa-tablet:before{content:"\f10a"}.fa-mobile-phone:before,.fa-mobile:before{content:"\f10b"}.fa-circle-o:before{content:"\f10c"}.fa-quote-left:before{content:"\f10d"}.fa-quote-right:before{content:"\f10e"}.fa-spinner:before{content:"\f110"}.fa-circle:before{content:"\f111"}.fa-mail-reply:before,.fa-reply:before{content:"\f112"}.fa-github-alt:before{content:"\f113"}.fa-folder-o:before{content:"\f114"}.fa-folder-open-o:before{content:"\f115"}.fa-smile-o:before{content:"\f118"}.fa-frown-o:before{content:"\f119"}.fa-meh-o:before{content:"\f11a"}.fa-gamepad:before{content:"\f11b"}.fa-keyboard-o:before{content:"\f11c"}.fa-flag-o:before{content:"\f11d"}.fa-flag-checkered:before{content:"\f11e"}.fa-terminal:before{content:"\f120"}.fa-code:before{content:"\f121"}.fa-mail-reply-all:before,.fa-reply-all:before{content:"\f122"}.fa-star-half-empty:before,.fa-star-half-full:before,.fa-star-half-o:before{content:"\f123"}.fa-location-arrow:before{content:"\f124"}.fa-crop:before{content:"\f125"}.fa-code-fork:before{content:"\f126"}.fa-unlink:before,.fa-chain-broken:before{content:"\f127"}.fa-question:before{content:"\f128"}.fa-info:before{content:"\f129"}.fa-exclamation:before{content:"\f12a"}.fa-superscript:before{content:"\f12b"}.fa-subscript:before{content:"\f12c"}.fa-eraser:before{content:"\f12d"}.fa-puzzle-piece:before{content:"\f12e"}.fa-microphone:before{content:"\f130"}.fa-microphone-slash:before{content:"\f131"}.fa-shield:before{content:"\f132"}.fa-calendar-o:before{content:"\f133"}.fa-fire-extinguisher:before{content:"\f134"}.fa-rocket:before{content:"\f135"}.fa-maxcdn:before{content:"\f136"}.fa-chevron-circle-left:before{content:"\f137"}.fa-chevron-circle-right:before{content:"\f138"}.fa-chevron-circle-up:before{content:"\f139"}.fa-chevron-circle-down:before{content:"\f13a"}.fa-html5:before{content:"\f13b"}.fa-css3:before{content:"\f13c"}.fa-anchor:before{content:"\f13d"}.fa-unlock-alt:before{content:"\f13e"}.fa-bullseye:before{content:"\f140"}.fa-ellipsis-h:before{content:"\f141"}.fa-ellipsis-v:before{content:"\f142"}.fa-rss-square:before{content:"\f143"}.fa-play-circle:before{content:"\f144"}.fa-ticket:before{content:"\f145"}.fa-minus-square:before{content:"\f146"}.fa-minus-square-o:before{content:"\f147"}.fa-level-up:before{content:"\f148"}.fa-level-down:before{content:"\f149"}.fa-check-square:before{content:"\f14a"}.fa-pencil-square:before{content:"\f14b"}.fa-external-link-square:before{content:"\f14c"}.fa-share-square:before{content:"\f14d"}.fa-compass:before{content:"\f14e"}.fa-toggle-down:before,.fa-caret-square-o-down:before{content:"\f150"}.fa-toggle-up:before,.fa-caret-square-o-up:before{content:"\f151"}.fa-toggle-right:before,.fa-caret-square-o-right:before{content:"\f152"}.fa-euro:before,.fa-eur:before{content:"\f153"}.fa-gbp:before{content:"\f154"}.fa-dollar:before,.fa-usd:before{content:"\f155"}.fa-rupee:before,.fa-inr:before{content:"\f156"}.fa-cny:before,.fa-rmb:before,.fa-yen:before,.fa-jpy:before{content:"\f157"}.fa-ruble:before,.fa-rouble:before,.fa-rub:before{content:"\f158"}.fa-won:before,.fa-krw:before{content:"\f159"}.fa-bitcoin:before,.fa-btc:before{content:"\f15a"}.fa-file:before{content:"\f15b"}.fa-file-text:before{content:"\f15c"}.fa-sort-alpha-asc:before{content:"\f15d"}.fa-sort-alpha-desc:before{content:"\f15e"}.fa-sort-amount-asc:before{content:"\f160"}.fa-sort-amount-desc:before{content:"\f161"}.fa-sort-numeric-asc:before{content:"\f162"}.fa-sort-numeric-desc:before{content:"\f163"}.fa-thumbs-up:before{content:"\f164"}.fa-thumbs-down:before{content:"\f165"}.fa-youtube-square:before{content:"\f166"}.fa-youtube:before{content:"\f167"}.fa-xing:before{content:"\f168"}.fa-xing-square:before{content:"\f169"}.fa-youtube-play:before{content:"\f16a"}.fa-dropbox:before{content:"\f16b"}.fa-stack-overflow:before{content:"\f16c"}.fa-instagram:before{content:"\f16d"}.fa-flickr:before{content:"\f16e"}.fa-adn:before{content:"\f170"}.fa-bitbucket:before{content:"\f171"}.fa-bitbucket-square:before{content:"\f172"}.fa-tumblr:before{content:"\f173"}.fa-tumblr-square:before{content:"\f174"}.fa-long-arrow-down:before{content:"\f175"}.fa-long-arrow-up:before{content:"\f176"}.fa-long-arrow-left:before{content:"\f177"}.fa-long-arrow-right:before{content:"\f178"}.fa-apple:before{content:"\f179"}.fa-windows:before{content:"\f17a"}.fa-android:before{content:"\f17b"}.fa-linux:before{content:"\f17c"}.fa-dribbble:before{content:"\f17d"}.fa-skype:before{content:"\f17e"}.fa-foursquare:before{content:"\f180"}.fa-trello:before{content:"\f181"}.fa-female:before{content:"\f182"}.fa-male:before{content:"\f183"}.fa-gittip:before,.fa-gratipay:before{content:"\f184"}.fa-sun-o:before{content:"\f185"}.fa-moon-o:before{content:"\f186"}.fa-archive:before{content:"\f187"}.fa-bug:before{content:"\f188"}.fa-vk:before{content:"\f189"}.fa-weibo:before{content:"\f18a"}.fa-renren:before{content:"\f18b"}.fa-pagelines:before{content:"\f18c"}.fa-stack-exchange:before{content:"\f18d"}.fa-arrow-circle-o-right:before{content:"\f18e"}.fa-arrow-circle-o-left:before{content:"\f190"}.fa-toggle-left:before,.fa-caret-square-o-left:before{content:"\f191"}.fa-dot-circle-o:before{content:"\f192"}.fa-wheelchair:before{content:"\f193"}.fa-vimeo-square:before{content:"\f194"}.fa-turkish-lira:before,.fa-try:before{content:"\f195"}.fa-plus-square-o:before{content:"\f196"}.fa-space-shuttle:before{content:"\f197"}.fa-slack:before{content:"\f198"}.fa-envelope-square:before{content:"\f199"}.fa-wordpress:before{content:"\f19a"}.fa-openid:before{content:"\f19b"}.fa-institution:before,.fa-bank:before,.fa-university:before{content:"\f19c"}.fa-mortar-board:before,.fa-graduation-cap:before{content:"\f19d"}.fa-yahoo:before{content:"\f19e"}.fa-google:before{content:"\f1a0"}.fa-reddit:before{content:"\f1a1"}.fa-reddit-square:before{content:"\f1a2"}.fa-stumbleupon-circle:before{content:"\f1a3"}.fa-stumbleupon:before{content:"\f1a4"}.fa-delicious:before{content:"\f1a5"}.fa-digg:before{content:"\f1a6"}.fa-pied-piper:before{content:"\f1a7"}.fa-pied-piper-alt:before{content:"\f1a8"}.fa-drupal:before{content:"\f1a9"}.fa-joomla:before{content:"\f1aa"}.fa-language:before{content:"\f1ab"}.fa-fax:before{content:"\f1ac"}.fa-building:before{content:"\f1ad"}.fa-child:before{content:"\f1ae"}.fa-paw:before{content:"\f1b0"}.fa-spoon:before{content:"\f1b1"}.fa-cube:before{content:"\f1b2"}.fa-cubes:before{content:"\f1b3"}.fa-behance:before{content:"\f1b4"}.fa-behance-square:before{content:"\f1b5"}.fa-steam:before{content:"\f1b6"}.fa-steam-square:before{content:"\f1b7"}.fa-recycle:before{content:"\f1b8"}.fa-automobile:before,.fa-car:before{content:"\f1b9"}.fa-cab:before,.fa-taxi:before{content:"\f1ba"}.fa-tree:before{content:"\f1bb"}.fa-spotify:before{content:"\f1bc"}.fa-deviantart:before{content:"\f1bd"}.fa-soundcloud:before{content:"\f1be"}.fa-database:before{content:"\f1c0"}.fa-file-pdf-o:before{content:"\f1c1"}.fa-file-word-o:before{content:"\f1c2"}.fa-file-excel-o:before{content:"\f1c3"}.fa-file-powerpoint-o:before{content:"\f1c4"}.fa-file-photo-o:before,.fa-file-picture-o:before,.fa-file-image-o:before{content:"\f1c5"}.fa-file-zip-o:before,.fa-file-archive-o:before{content:"\f1c6"}.fa-file-sound-o:before,.fa-file-audio-o:before{content:"\f1c7"}.fa-file-movie-o:before,.fa-file-video-o:before{content:"\f1c8"}.fa-file-code-o:before{content:"\f1c9"}.fa-vine:before{content:"\f1ca"}.fa-codepen:before{content:"\f1cb"}.fa-jsfiddle:before{content:"\f1cc"}.fa-life-bouy:before,.fa-life-buoy:before,.fa-life-saver:before,.fa-support:before,.fa-life-ring:before{content:"\f1cd"}.fa-circle-o-notch:before{content:"\f1ce"}.fa-ra:before,.fa-rebel:before{content:"\f1d0"}.fa-ge:before,.fa-empire:before{content:"\f1d1"}.fa-git-square:before{content:"\f1d2"}.fa-git:before{content:"\f1d3"}.fa-hacker-news:before{content:"\f1d4"}.fa-tencent-weibo:before{content:"\f1d5"}.fa-qq:before{content:"\f1d6"}.fa-wechat:before,.fa-weixin:before{content:"\f1d7"}.fa-send:before,.fa-paper-plane:before{content:"\f1d8"}.fa-send-o:before,.fa-paper-plane-o:before{content:"\f1d9"}.fa-history:before{content:"\f1da"}.fa-genderless:before,.fa-circle-thin:before{content:"\f1db"}.fa-header:before{content:"\f1dc"}.fa-paragraph:before{content:"\f1dd"}.fa-sliders:before{content:"\f1de"}.fa-share-alt:before{content:"\f1e0"}.fa-share-alt-square:before{content:"\f1e1"}.fa-bomb:before{content:"\f1e2"}.fa-soccer-ball-o:before,.fa-futbol-o:before{content:"\f1e3"}.fa-tty:before{content:"\f1e4"}.fa-binoculars:before{content:"\f1e5"}.fa-plug:before{content:"\f1e6"}.fa-slideshare:before{content:"\f1e7"}.fa-twitch:before{content:"\f1e8"}.fa-yelp:before{content:"\f1e9"}.fa-newspaper-o:before{content:"\f1ea"}.fa-wifi:before{content:"\f1eb"}.fa-calculator:before{content:"\f1ec"}.fa-paypal:before{content:"\f1ed"}.fa-google-wallet:before{content:"\f1ee"}.fa-cc-visa:before{content:"\f1f0"}.fa-cc-mastercard:before{content:"\f1f1"}.fa-cc-discover:before{content:"\f1f2"}.fa-cc-amex:before{content:"\f1f3"}.fa-cc-paypal:before{content:"\f1f4"}.fa-cc-stripe:before{content:"\f1f5"}.fa-bell-slash:before{content:"\f1f6"}.fa-bell-slash-o:before{content:"\f1f7"}.fa-trash:before{content:"\f1f8"}.fa-copyright:before{content:"\f1f9"}.fa-at:before{content:"\f1fa"}.fa-eyedropper:before{content:"\f1fb"}.fa-paint-brush:before{content:"\f1fc"}.fa-birthday-cake:before{content:"\f1fd"}.fa-area-chart:before{content:"\f1fe"}.fa-pie-chart:before{content:"\f200"}.fa-line-chart:before{content:"\f201"}.fa-lastfm:before{content:"\f202"}.fa-lastfm-square:before{content:"\f203"}.fa-toggle-off:before{content:"\f204"}.fa-toggle-on:before{content:"\f205"}.fa-bicycle:before{content:"\f206"}.fa-bus:before{content:"\f207"}.fa-ioxhost:before{content:"\f208"}.fa-angellist:before{content:"\f209"}.fa-cc:before{content:"\f20a"}.fa-shekel:before,.fa-sheqel:before,.fa-ils:before{content:"\f20b"}.fa-meanpath:before{content:"\f20c"}.fa-buysellads:before{content:"\f20d"}.fa-connectdevelop:before{content:"\f20e"}.fa-dashcube:before{content:"\f210"}.fa-forumbee:before{content:"\f211"}.fa-leanpub:before{content:"\f212"}.fa-sellsy:before{content:"\f213"}.fa-shirtsinbulk:before{content:"\f214"}.fa-simplybuilt:before{content:"\f215"}.fa-skyatlas:before{content:"\f216"}.fa-cart-plus:before{content:"\f217"}.fa-cart-arrow-down:before{content:"\f218"}.fa-diamond:before{content:"\f219"}.fa-ship:before{content:"\f21a"}.fa-user-secret:before{content:"\f21b"}.fa-motorcycle:before{content:"\f21c"}.fa-street-view:before{content:"\f21d"}.fa-heartbeat:before{content:"\f21e"}.fa-venus:before{content:"\f221"}.fa-mars:before{content:"\f222"}.fa-mercury:before{content:"\f223"}.fa-transgender:before{content:"\f224"}.fa-transgender-alt:before{content:"\f225"}.fa-venus-double:before{content:"\f226"}.fa-mars-double:before{content:"\f227"}.fa-venus-mars:before{content:"\f228"}.fa-mars-stroke:before{content:"\f229"}.fa-mars-stroke-v:before{content:"\f22a"}.fa-mars-stroke-h:before{content:"\f22b"}.fa-neuter:before{content:"\f22c"}.fa-facebook-official:before{content:"\f230"}.fa-pinterest-p:before{content:"\f231"}.fa-whatsapp:before{content:"\f232"}.fa-server:before{content:"\f233"}.fa-user-plus:before{content:"\f234"}.fa-user-times:before{content:"\f235"}.fa-hotel:before,.fa-bed:before{content:"\f236"}.fa-viacoin:before{content:"\f237"}.fa-train:before{content:"\f238"}.fa-subway:before{content:"\f239"}.fa-medium:before{content:"\f23a"}
|
1 |
+
/*!
|
2 |
+
* Font Awesome 4.3.0 by @davegandy - http://fontawesome.io - @fontawesome
|
3 |
+
* License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License)
|
4 |
*/@font-face{font-family:'FontAwesome';src:url('../fonts/fontawesome-webfont.eot?v=4.3.0');src:url('../fonts/fontawesome-webfont.eot?#iefix&v=4.3.0') format('embedded-opentype'),url('../fonts/fontawesome-webfont.woff2?v=4.3.0') format('woff2'),url('../fonts/fontawesome-webfont.woff?v=4.3.0') format('woff'),url('../fonts/fontawesome-webfont.ttf?v=4.3.0') format('truetype'),url('../fonts/fontawesome-webfont.svg?v=4.3.0#fontawesomeregular') format('svg');font-weight:normal;font-style:normal}.fa{display:inline-block;font:normal normal normal 14px/1 FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;transform:translate(0, 0)}.fa-lg{font-size:1.33333333em;line-height:.75em;vertical-align:-15%}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-fw{width:1.28571429em;text-align:center}.fa-ul{padding-left:0;margin-left:2.14285714em;list-style-type:none}.fa-ul>li{position:relative}.fa-li{position:absolute;left:-2.14285714em;width:2.14285714em;top:.14285714em;text-align:center}.fa-li.fa-lg{left:-1.85714286em}.fa-border{padding:.2em .25em .15em;border:solid .08em #eee;border-radius:.1em}.pull-right{float:right}.pull-left{float:left}.fa.pull-left{margin-right:.3em}.fa.pull-right{margin-left:.3em}.fa-spin{-webkit-animation:fa-spin 2s infinite linear;animation:fa-spin 2s infinite linear}.fa-pulse{-webkit-animation:fa-spin 1s infinite steps(8);animation:fa-spin 1s infinite steps(8)}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.fa-rotate-90{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=1);-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2);-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=3);-webkit-transform:rotate(270deg);-ms-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1);-webkit-transform:scale(-1, 1);-ms-transform:scale(-1, 1);transform:scale(-1, 1)}.fa-flip-vertical{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1);-webkit-transform:scale(1, -1);-ms-transform:scale(1, -1);transform:scale(1, -1)}:root .fa-rotate-90,:root .fa-rotate-180,:root .fa-rotate-270,:root .fa-flip-horizontal,:root .fa-flip-vertical{filter:none}.fa-stack{position:relative;display:inline-block;width:2em;height:2em;line-height:2em;vertical-align:middle}.fa-stack-1x,.fa-stack-2x{position:absolute;left:0;width:100%;text-align:center}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:#fff}.fa-glass:before{content:"\f000"}.fa-music:before{content:"\f001"}.fa-search:before{content:"\f002"}.fa-envelope-o:before{content:"\f003"}.fa-heart:before{content:"\f004"}.fa-star:before{content:"\f005"}.fa-star-o:before{content:"\f006"}.fa-user:before{content:"\f007"}.fa-film:before{content:"\f008"}.fa-th-large:before{content:"\f009"}.fa-th:before{content:"\f00a"}.fa-th-list:before{content:"\f00b"}.fa-check:before{content:"\f00c"}.fa-remove:before,.fa-close:before,.fa-times:before{content:"\f00d"}.fa-search-plus:before{content:"\f00e"}.fa-search-minus:before{content:"\f010"}.fa-power-off:before{content:"\f011"}.fa-signal:before{content:"\f012"}.fa-gear:before,.fa-cog:before{content:"\f013"}.fa-trash-o:before{content:"\f014"}.fa-home:before{content:"\f015"}.fa-file-o:before{content:"\f016"}.fa-clock-o:before{content:"\f017"}.fa-road:before{content:"\f018"}.fa-download:before{content:"\f019"}.fa-arrow-circle-o-down:before{content:"\f01a"}.fa-arrow-circle-o-up:before{content:"\f01b"}.fa-inbox:before{content:"\f01c"}.fa-play-circle-o:before{content:"\f01d"}.fa-rotate-right:before,.fa-repeat:before{content:"\f01e"}.fa-refresh:before{content:"\f021"}.fa-list-alt:before{content:"\f022"}.fa-lock:before{content:"\f023"}.fa-flag:before{content:"\f024"}.fa-headphones:before{content:"\f025"}.fa-volume-off:before{content:"\f026"}.fa-volume-down:before{content:"\f027"}.fa-volume-up:before{content:"\f028"}.fa-qrcode:before{content:"\f029"}.fa-barcode:before{content:"\f02a"}.fa-tag:before{content:"\f02b"}.fa-tags:before{content:"\f02c"}.fa-book:before{content:"\f02d"}.fa-bookmark:before{content:"\f02e"}.fa-print:before{content:"\f02f"}.fa-camera:before{content:"\f030"}.fa-font:before{content:"\f031"}.fa-bold:before{content:"\f032"}.fa-italic:before{content:"\f033"}.fa-text-height:before{content:"\f034"}.fa-text-width:before{content:"\f035"}.fa-align-left:before{content:"\f036"}.fa-align-center:before{content:"\f037"}.fa-align-right:before{content:"\f038"}.fa-align-justify:before{content:"\f039"}.fa-list:before{content:"\f03a"}.fa-dedent:before,.fa-outdent:before{content:"\f03b"}.fa-indent:before{content:"\f03c"}.fa-video-camera:before{content:"\f03d"}.fa-photo:before,.fa-image:before,.fa-picture-o:before{content:"\f03e"}.fa-pencil:before{content:"\f040"}.fa-map-marker:before{content:"\f041"}.fa-adjust:before{content:"\f042"}.fa-tint:before{content:"\f043"}.fa-edit:before,.fa-pencil-square-o:before{content:"\f044"}.fa-share-square-o:before{content:"\f045"}.fa-check-square-o:before{content:"\f046"}.fa-arrows:before{content:"\f047"}.fa-step-backward:before{content:"\f048"}.fa-fast-backward:before{content:"\f049"}.fa-backward:before{content:"\f04a"}.fa-play:before{content:"\f04b"}.fa-pause:before{content:"\f04c"}.fa-stop:before{content:"\f04d"}.fa-forward:before{content:"\f04e"}.fa-fast-forward:before{content:"\f050"}.fa-step-forward:before{content:"\f051"}.fa-eject:before{content:"\f052"}.fa-chevron-left:before{content:"\f053"}.fa-chevron-right:before{content:"\f054"}.fa-plus-circle:before{content:"\f055"}.fa-minus-circle:before{content:"\f056"}.fa-times-circle:before{content:"\f057"}.fa-check-circle:before{content:"\f058"}.fa-question-circle:before{content:"\f059"}.fa-info-circle:before{content:"\f05a"}.fa-crosshairs:before{content:"\f05b"}.fa-times-circle-o:before{content:"\f05c"}.fa-check-circle-o:before{content:"\f05d"}.fa-ban:before{content:"\f05e"}.fa-arrow-left:before{content:"\f060"}.fa-arrow-right:before{content:"\f061"}.fa-arrow-up:before{content:"\f062"}.fa-arrow-down:before{content:"\f063"}.fa-mail-forward:before,.fa-share:before{content:"\f064"}.fa-expand:before{content:"\f065"}.fa-compress:before{content:"\f066"}.fa-plus:before{content:"\f067"}.fa-minus:before{content:"\f068"}.fa-asterisk:before{content:"\f069"}.fa-exclamation-circle:before{content:"\f06a"}.fa-gift:before{content:"\f06b"}.fa-leaf:before{content:"\f06c"}.fa-fire:before{content:"\f06d"}.fa-eye:before{content:"\f06e"}.fa-eye-slash:before{content:"\f070"}.fa-warning:before,.fa-exclamation-triangle:before{content:"\f071"}.fa-plane:before{content:"\f072"}.fa-calendar:before{content:"\f073"}.fa-random:before{content:"\f074"}.fa-comment:before{content:"\f075"}.fa-magnet:before{content:"\f076"}.fa-chevron-up:before{content:"\f077"}.fa-chevron-down:before{content:"\f078"}.fa-retweet:before{content:"\f079"}.fa-shopping-cart:before{content:"\f07a"}.fa-folder:before{content:"\f07b"}.fa-folder-open:before{content:"\f07c"}.fa-arrows-v:before{content:"\f07d"}.fa-arrows-h:before{content:"\f07e"}.fa-bar-chart-o:before,.fa-bar-chart:before{content:"\f080"}.fa-twitter-square:before{content:"\f081"}.fa-facebook-square:before{content:"\f082"}.fa-camera-retro:before{content:"\f083"}.fa-key:before{content:"\f084"}.fa-gears:before,.fa-cogs:before{content:"\f085"}.fa-comments:before{content:"\f086"}.fa-thumbs-o-up:before{content:"\f087"}.fa-thumbs-o-down:before{content:"\f088"}.fa-star-half:before{content:"\f089"}.fa-heart-o:before{content:"\f08a"}.fa-sign-out:before{content:"\f08b"}.fa-linkedin-square:before{content:"\f08c"}.fa-thumb-tack:before{content:"\f08d"}.fa-external-link:before{content:"\f08e"}.fa-sign-in:before{content:"\f090"}.fa-trophy:before{content:"\f091"}.fa-github-square:before{content:"\f092"}.fa-upload:before{content:"\f093"}.fa-lemon-o:before{content:"\f094"}.fa-phone:before{content:"\f095"}.fa-square-o:before{content:"\f096"}.fa-bookmark-o:before{content:"\f097"}.fa-phone-square:before{content:"\f098"}.fa-twitter:before{content:"\f099"}.fa-facebook-f:before,.fa-facebook:before{content:"\f09a"}.fa-github:before{content:"\f09b"}.fa-unlock:before{content:"\f09c"}.fa-credit-card:before{content:"\f09d"}.fa-rss:before{content:"\f09e"}.fa-hdd-o:before{content:"\f0a0"}.fa-bullhorn:before{content:"\f0a1"}.fa-bell:before{content:"\f0f3"}.fa-certificate:before{content:"\f0a3"}.fa-hand-o-right:before{content:"\f0a4"}.fa-hand-o-left:before{content:"\f0a5"}.fa-hand-o-up:before{content:"\f0a6"}.fa-hand-o-down:before{content:"\f0a7"}.fa-arrow-circle-left:before{content:"\f0a8"}.fa-arrow-circle-right:before{content:"\f0a9"}.fa-arrow-circle-up:before{content:"\f0aa"}.fa-arrow-circle-down:before{content:"\f0ab"}.fa-globe:before{content:"\f0ac"}.fa-wrench:before{content:"\f0ad"}.fa-tasks:before{content:"\f0ae"}.fa-filter:before{content:"\f0b0"}.fa-briefcase:before{content:"\f0b1"}.fa-arrows-alt:before{content:"\f0b2"}.fa-group:before,.fa-users:before{content:"\f0c0"}.fa-chain:before,.fa-link:before{content:"\f0c1"}.fa-cloud:before{content:"\f0c2"}.fa-flask:before{content:"\f0c3"}.fa-cut:before,.fa-scissors:before{content:"\f0c4"}.fa-copy:before,.fa-files-o:before{content:"\f0c5"}.fa-paperclip:before{content:"\f0c6"}.fa-save:before,.fa-floppy-o:before{content:"\f0c7"}.fa-square:before{content:"\f0c8"}.fa-navicon:before,.fa-reorder:before,.fa-bars:before{content:"\f0c9"}.fa-list-ul:before{content:"\f0ca"}.fa-list-ol:before{content:"\f0cb"}.fa-strikethrough:before{content:"\f0cc"}.fa-underline:before{content:"\f0cd"}.fa-table:before{content:"\f0ce"}.fa-magic:before{content:"\f0d0"}.fa-truck:before{content:"\f0d1"}.fa-pinterest:before{content:"\f0d2"}.fa-pinterest-square:before{content:"\f0d3"}.fa-google-plus-square:before{content:"\f0d4"}.fa-google-plus:before{content:"\f0d5"}.fa-money:before{content:"\f0d6"}.fa-caret-down:before{content:"\f0d7"}.fa-caret-up:before{content:"\f0d8"}.fa-caret-left:before{content:"\f0d9"}.fa-caret-right:before{content:"\f0da"}.fa-columns:before{content:"\f0db"}.fa-unsorted:before,.fa-sort:before{content:"\f0dc"}.fa-sort-down:before,.fa-sort-desc:before{content:"\f0dd"}.fa-sort-up:before,.fa-sort-asc:before{content:"\f0de"}.fa-envelope:before{content:"\f0e0"}.fa-linkedin:before{content:"\f0e1"}.fa-rotate-left:before,.fa-undo:before{content:"\f0e2"}.fa-legal:before,.fa-gavel:before{content:"\f0e3"}.fa-dashboard:before,.fa-tachometer:before{content:"\f0e4"}.fa-comment-o:before{content:"\f0e5"}.fa-comments-o:before{content:"\f0e6"}.fa-flash:before,.fa-bolt:before{content:"\f0e7"}.fa-sitemap:before{content:"\f0e8"}.fa-umbrella:before{content:"\f0e9"}.fa-paste:before,.fa-clipboard:before{content:"\f0ea"}.fa-lightbulb-o:before{content:"\f0eb"}.fa-exchange:before{content:"\f0ec"}.fa-cloud-download:before{content:"\f0ed"}.fa-cloud-upload:before{content:"\f0ee"}.fa-user-md:before{content:"\f0f0"}.fa-stethoscope:before{content:"\f0f1"}.fa-suitcase:before{content:"\f0f2"}.fa-bell-o:before{content:"\f0a2"}.fa-coffee:before{content:"\f0f4"}.fa-cutlery:before{content:"\f0f5"}.fa-file-text-o:before{content:"\f0f6"}.fa-building-o:before{content:"\f0f7"}.fa-hospital-o:before{content:"\f0f8"}.fa-ambulance:before{content:"\f0f9"}.fa-medkit:before{content:"\f0fa"}.fa-fighter-jet:before{content:"\f0fb"}.fa-beer:before{content:"\f0fc"}.fa-h-square:before{content:"\f0fd"}.fa-plus-square:before{content:"\f0fe"}.fa-angle-double-left:before{content:"\f100"}.fa-angle-double-right:before{content:"\f101"}.fa-angle-double-up:before{content:"\f102"}.fa-angle-double-down:before{content:"\f103"}.fa-angle-left:before{content:"\f104"}.fa-angle-right:before{content:"\f105"}.fa-angle-up:before{content:"\f106"}.fa-angle-down:before{content:"\f107"}.fa-desktop:before{content:"\f108"}.fa-laptop:before{content:"\f109"}.fa-tablet:before{content:"\f10a"}.fa-mobile-phone:before,.fa-mobile:before{content:"\f10b"}.fa-circle-o:before{content:"\f10c"}.fa-quote-left:before{content:"\f10d"}.fa-quote-right:before{content:"\f10e"}.fa-spinner:before{content:"\f110"}.fa-circle:before{content:"\f111"}.fa-mail-reply:before,.fa-reply:before{content:"\f112"}.fa-github-alt:before{content:"\f113"}.fa-folder-o:before{content:"\f114"}.fa-folder-open-o:before{content:"\f115"}.fa-smile-o:before{content:"\f118"}.fa-frown-o:before{content:"\f119"}.fa-meh-o:before{content:"\f11a"}.fa-gamepad:before{content:"\f11b"}.fa-keyboard-o:before{content:"\f11c"}.fa-flag-o:before{content:"\f11d"}.fa-flag-checkered:before{content:"\f11e"}.fa-terminal:before{content:"\f120"}.fa-code:before{content:"\f121"}.fa-mail-reply-all:before,.fa-reply-all:before{content:"\f122"}.fa-star-half-empty:before,.fa-star-half-full:before,.fa-star-half-o:before{content:"\f123"}.fa-location-arrow:before{content:"\f124"}.fa-crop:before{content:"\f125"}.fa-code-fork:before{content:"\f126"}.fa-unlink:before,.fa-chain-broken:before{content:"\f127"}.fa-question:before{content:"\f128"}.fa-info:before{content:"\f129"}.fa-exclamation:before{content:"\f12a"}.fa-superscript:before{content:"\f12b"}.fa-subscript:before{content:"\f12c"}.fa-eraser:before{content:"\f12d"}.fa-puzzle-piece:before{content:"\f12e"}.fa-microphone:before{content:"\f130"}.fa-microphone-slash:before{content:"\f131"}.fa-shield:before{content:"\f132"}.fa-calendar-o:before{content:"\f133"}.fa-fire-extinguisher:before{content:"\f134"}.fa-rocket:before{content:"\f135"}.fa-maxcdn:before{content:"\f136"}.fa-chevron-circle-left:before{content:"\f137"}.fa-chevron-circle-right:before{content:"\f138"}.fa-chevron-circle-up:before{content:"\f139"}.fa-chevron-circle-down:before{content:"\f13a"}.fa-html5:before{content:"\f13b"}.fa-css3:before{content:"\f13c"}.fa-anchor:before{content:"\f13d"}.fa-unlock-alt:before{content:"\f13e"}.fa-bullseye:before{content:"\f140"}.fa-ellipsis-h:before{content:"\f141"}.fa-ellipsis-v:before{content:"\f142"}.fa-rss-square:before{content:"\f143"}.fa-play-circle:before{content:"\f144"}.fa-ticket:before{content:"\f145"}.fa-minus-square:before{content:"\f146"}.fa-minus-square-o:before{content:"\f147"}.fa-level-up:before{content:"\f148"}.fa-level-down:before{content:"\f149"}.fa-check-square:before{content:"\f14a"}.fa-pencil-square:before{content:"\f14b"}.fa-external-link-square:before{content:"\f14c"}.fa-share-square:before{content:"\f14d"}.fa-compass:before{content:"\f14e"}.fa-toggle-down:before,.fa-caret-square-o-down:before{content:"\f150"}.fa-toggle-up:before,.fa-caret-square-o-up:before{content:"\f151"}.fa-toggle-right:before,.fa-caret-square-o-right:before{content:"\f152"}.fa-euro:before,.fa-eur:before{content:"\f153"}.fa-gbp:before{content:"\f154"}.fa-dollar:before,.fa-usd:before{content:"\f155"}.fa-rupee:before,.fa-inr:before{content:"\f156"}.fa-cny:before,.fa-rmb:before,.fa-yen:before,.fa-jpy:before{content:"\f157"}.fa-ruble:before,.fa-rouble:before,.fa-rub:before{content:"\f158"}.fa-won:before,.fa-krw:before{content:"\f159"}.fa-bitcoin:before,.fa-btc:before{content:"\f15a"}.fa-file:before{content:"\f15b"}.fa-file-text:before{content:"\f15c"}.fa-sort-alpha-asc:before{content:"\f15d"}.fa-sort-alpha-desc:before{content:"\f15e"}.fa-sort-amount-asc:before{content:"\f160"}.fa-sort-amount-desc:before{content:"\f161"}.fa-sort-numeric-asc:before{content:"\f162"}.fa-sort-numeric-desc:before{content:"\f163"}.fa-thumbs-up:before{content:"\f164"}.fa-thumbs-down:before{content:"\f165"}.fa-youtube-square:before{content:"\f166"}.fa-youtube:before{content:"\f167"}.fa-xing:before{content:"\f168"}.fa-xing-square:before{content:"\f169"}.fa-youtube-play:before{content:"\f16a"}.fa-dropbox:before{content:"\f16b"}.fa-stack-overflow:before{content:"\f16c"}.fa-instagram:before{content:"\f16d"}.fa-flickr:before{content:"\f16e"}.fa-adn:before{content:"\f170"}.fa-bitbucket:before{content:"\f171"}.fa-bitbucket-square:before{content:"\f172"}.fa-tumblr:before{content:"\f173"}.fa-tumblr-square:before{content:"\f174"}.fa-long-arrow-down:before{content:"\f175"}.fa-long-arrow-up:before{content:"\f176"}.fa-long-arrow-left:before{content:"\f177"}.fa-long-arrow-right:before{content:"\f178"}.fa-apple:before{content:"\f179"}.fa-windows:before{content:"\f17a"}.fa-android:before{content:"\f17b"}.fa-linux:before{content:"\f17c"}.fa-dribbble:before{content:"\f17d"}.fa-skype:before{content:"\f17e"}.fa-foursquare:before{content:"\f180"}.fa-trello:before{content:"\f181"}.fa-female:before{content:"\f182"}.fa-male:before{content:"\f183"}.fa-gittip:before,.fa-gratipay:before{content:"\f184"}.fa-sun-o:before{content:"\f185"}.fa-moon-o:before{content:"\f186"}.fa-archive:before{content:"\f187"}.fa-bug:before{content:"\f188"}.fa-vk:before{content:"\f189"}.fa-weibo:before{content:"\f18a"}.fa-renren:before{content:"\f18b"}.fa-pagelines:before{content:"\f18c"}.fa-stack-exchange:before{content:"\f18d"}.fa-arrow-circle-o-right:before{content:"\f18e"}.fa-arrow-circle-o-left:before{content:"\f190"}.fa-toggle-left:before,.fa-caret-square-o-left:before{content:"\f191"}.fa-dot-circle-o:before{content:"\f192"}.fa-wheelchair:before{content:"\f193"}.fa-vimeo-square:before{content:"\f194"}.fa-turkish-lira:before,.fa-try:before{content:"\f195"}.fa-plus-square-o:before{content:"\f196"}.fa-space-shuttle:before{content:"\f197"}.fa-slack:before{content:"\f198"}.fa-envelope-square:before{content:"\f199"}.fa-wordpress:before{content:"\f19a"}.fa-openid:before{content:"\f19b"}.fa-institution:before,.fa-bank:before,.fa-university:before{content:"\f19c"}.fa-mortar-board:before,.fa-graduation-cap:before{content:"\f19d"}.fa-yahoo:before{content:"\f19e"}.fa-google:before{content:"\f1a0"}.fa-reddit:before{content:"\f1a1"}.fa-reddit-square:before{content:"\f1a2"}.fa-stumbleupon-circle:before{content:"\f1a3"}.fa-stumbleupon:before{content:"\f1a4"}.fa-delicious:before{content:"\f1a5"}.fa-digg:before{content:"\f1a6"}.fa-pied-piper:before{content:"\f1a7"}.fa-pied-piper-alt:before{content:"\f1a8"}.fa-drupal:before{content:"\f1a9"}.fa-joomla:before{content:"\f1aa"}.fa-language:before{content:"\f1ab"}.fa-fax:before{content:"\f1ac"}.fa-building:before{content:"\f1ad"}.fa-child:before{content:"\f1ae"}.fa-paw:before{content:"\f1b0"}.fa-spoon:before{content:"\f1b1"}.fa-cube:before{content:"\f1b2"}.fa-cubes:before{content:"\f1b3"}.fa-behance:before{content:"\f1b4"}.fa-behance-square:before{content:"\f1b5"}.fa-steam:before{content:"\f1b6"}.fa-steam-square:before{content:"\f1b7"}.fa-recycle:before{content:"\f1b8"}.fa-automobile:before,.fa-car:before{content:"\f1b9"}.fa-cab:before,.fa-taxi:before{content:"\f1ba"}.fa-tree:before{content:"\f1bb"}.fa-spotify:before{content:"\f1bc"}.fa-deviantart:before{content:"\f1bd"}.fa-soundcloud:before{content:"\f1be"}.fa-database:before{content:"\f1c0"}.fa-file-pdf-o:before{content:"\f1c1"}.fa-file-word-o:before{content:"\f1c2"}.fa-file-excel-o:before{content:"\f1c3"}.fa-file-powerpoint-o:before{content:"\f1c4"}.fa-file-photo-o:before,.fa-file-picture-o:before,.fa-file-image-o:before{content:"\f1c5"}.fa-file-zip-o:before,.fa-file-archive-o:before{content:"\f1c6"}.fa-file-sound-o:before,.fa-file-audio-o:before{content:"\f1c7"}.fa-file-movie-o:before,.fa-file-video-o:before{content:"\f1c8"}.fa-file-code-o:before{content:"\f1c9"}.fa-vine:before{content:"\f1ca"}.fa-codepen:before{content:"\f1cb"}.fa-jsfiddle:before{content:"\f1cc"}.fa-life-bouy:before,.fa-life-buoy:before,.fa-life-saver:before,.fa-support:before,.fa-life-ring:before{content:"\f1cd"}.fa-circle-o-notch:before{content:"\f1ce"}.fa-ra:before,.fa-rebel:before{content:"\f1d0"}.fa-ge:before,.fa-empire:before{content:"\f1d1"}.fa-git-square:before{content:"\f1d2"}.fa-git:before{content:"\f1d3"}.fa-hacker-news:before{content:"\f1d4"}.fa-tencent-weibo:before{content:"\f1d5"}.fa-qq:before{content:"\f1d6"}.fa-wechat:before,.fa-weixin:before{content:"\f1d7"}.fa-send:before,.fa-paper-plane:before{content:"\f1d8"}.fa-send-o:before,.fa-paper-plane-o:before{content:"\f1d9"}.fa-history:before{content:"\f1da"}.fa-genderless:before,.fa-circle-thin:before{content:"\f1db"}.fa-header:before{content:"\f1dc"}.fa-paragraph:before{content:"\f1dd"}.fa-sliders:before{content:"\f1de"}.fa-share-alt:before{content:"\f1e0"}.fa-share-alt-square:before{content:"\f1e1"}.fa-bomb:before{content:"\f1e2"}.fa-soccer-ball-o:before,.fa-futbol-o:before{content:"\f1e3"}.fa-tty:before{content:"\f1e4"}.fa-binoculars:before{content:"\f1e5"}.fa-plug:before{content:"\f1e6"}.fa-slideshare:before{content:"\f1e7"}.fa-twitch:before{content:"\f1e8"}.fa-yelp:before{content:"\f1e9"}.fa-newspaper-o:before{content:"\f1ea"}.fa-wifi:before{content:"\f1eb"}.fa-calculator:before{content:"\f1ec"}.fa-paypal:before{content:"\f1ed"}.fa-google-wallet:before{content:"\f1ee"}.fa-cc-visa:before{content:"\f1f0"}.fa-cc-mastercard:before{content:"\f1f1"}.fa-cc-discover:before{content:"\f1f2"}.fa-cc-amex:before{content:"\f1f3"}.fa-cc-paypal:before{content:"\f1f4"}.fa-cc-stripe:before{content:"\f1f5"}.fa-bell-slash:before{content:"\f1f6"}.fa-bell-slash-o:before{content:"\f1f7"}.fa-trash:before{content:"\f1f8"}.fa-copyright:before{content:"\f1f9"}.fa-at:before{content:"\f1fa"}.fa-eyedropper:before{content:"\f1fb"}.fa-paint-brush:before{content:"\f1fc"}.fa-birthday-cake:before{content:"\f1fd"}.fa-area-chart:before{content:"\f1fe"}.fa-pie-chart:before{content:"\f200"}.fa-line-chart:before{content:"\f201"}.fa-lastfm:before{content:"\f202"}.fa-lastfm-square:before{content:"\f203"}.fa-toggle-off:before{content:"\f204"}.fa-toggle-on:before{content:"\f205"}.fa-bicycle:before{content:"\f206"}.fa-bus:before{content:"\f207"}.fa-ioxhost:before{content:"\f208"}.fa-angellist:before{content:"\f209"}.fa-cc:before{content:"\f20a"}.fa-shekel:before,.fa-sheqel:before,.fa-ils:before{content:"\f20b"}.fa-meanpath:before{content:"\f20c"}.fa-buysellads:before{content:"\f20d"}.fa-connectdevelop:before{content:"\f20e"}.fa-dashcube:before{content:"\f210"}.fa-forumbee:before{content:"\f211"}.fa-leanpub:before{content:"\f212"}.fa-sellsy:before{content:"\f213"}.fa-shirtsinbulk:before{content:"\f214"}.fa-simplybuilt:before{content:"\f215"}.fa-skyatlas:before{content:"\f216"}.fa-cart-plus:before{content:"\f217"}.fa-cart-arrow-down:before{content:"\f218"}.fa-diamond:before{content:"\f219"}.fa-ship:before{content:"\f21a"}.fa-user-secret:before{content:"\f21b"}.fa-motorcycle:before{content:"\f21c"}.fa-street-view:before{content:"\f21d"}.fa-heartbeat:before{content:"\f21e"}.fa-venus:before{content:"\f221"}.fa-mars:before{content:"\f222"}.fa-mercury:before{content:"\f223"}.fa-transgender:before{content:"\f224"}.fa-transgender-alt:before{content:"\f225"}.fa-venus-double:before{content:"\f226"}.fa-mars-double:before{content:"\f227"}.fa-venus-mars:before{content:"\f228"}.fa-mars-stroke:before{content:"\f229"}.fa-mars-stroke-v:before{content:"\f22a"}.fa-mars-stroke-h:before{content:"\f22b"}.fa-neuter:before{content:"\f22c"}.fa-facebook-official:before{content:"\f230"}.fa-pinterest-p:before{content:"\f231"}.fa-whatsapp:before{content:"\f232"}.fa-server:before{content:"\f233"}.fa-user-plus:before{content:"\f234"}.fa-user-times:before{content:"\f235"}.fa-hotel:before,.fa-bed:before{content:"\f236"}.fa-viacoin:before{content:"\f237"}.fa-train:before{content:"\f238"}.fa-subway:before{content:"\f239"}.fa-medium:before{content:"\f23a"}
|
inc/css/gawd_front.css
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
-
.gawd_draw_analytics_front{
|
2 |
-
padding: 2px;
|
3 |
-
line-height: 28px;
|
4 |
-
height: 28px;
|
5 |
}
|
1 |
+
.gawd_draw_analytics_front{
|
2 |
+
padding: 2px;
|
3 |
+
line-height: 28px;
|
4 |
+
height: 28px;
|
5 |
}
|
inc/css/jquery-ui.css
CHANGED
@@ -1,566 +1,566 @@
|
|
1 |
-
/*
|
2 |
-
* jQuery UI CSS Framework 1.8.14
|
3 |
-
*
|
4 |
-
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
5 |
-
* Dual licensed under the MIT or GPL Version 2 licenses.
|
6 |
-
* http://jquery.org/license
|
7 |
-
*
|
8 |
-
* http://docs.jquery.com/UI/Theming/API
|
9 |
-
*/
|
10 |
-
|
11 |
-
/* Layout helpers
|
12 |
-
----------------------------------*/
|
13 |
-
.ui-helper-hidden { display: none; }
|
14 |
-
.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
|
15 |
-
.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
|
16 |
-
.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
|
17 |
-
.ui-helper-clearfix { display: inline-block; }
|
18 |
-
/* required comment for clearfix to work in Opera \*/
|
19 |
-
* html .ui-helper-clearfix { height:1%; }
|
20 |
-
.ui-helper-clearfix { display:block; }
|
21 |
-
/* end clearfix */
|
22 |
-
.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
|
23 |
-
|
24 |
-
|
25 |
-
/* Interaction Cues
|
26 |
-
----------------------------------*/
|
27 |
-
.ui-state-disabled { cursor: default !important; }
|
28 |
-
|
29 |
-
|
30 |
-
/* Icons
|
31 |
-
----------------------------------*/
|
32 |
-
|
33 |
-
/* states and images */
|
34 |
-
.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
|
35 |
-
|
36 |
-
|
37 |
-
/* Misc visuals
|
38 |
-
----------------------------------*/
|
39 |
-
|
40 |
-
/* Overlays */
|
41 |
-
.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
|
42 |
-
/*
|
43 |
-
* jQuery UI Accordion 1.8.14
|
44 |
-
*
|
45 |
-
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
46 |
-
* Dual licensed under the MIT or GPL Version 2 licenses.
|
47 |
-
* http://jquery.org/license
|
48 |
-
*
|
49 |
-
* http://docs.jquery.com/UI/Accordion#theming
|
50 |
-
*/
|
51 |
-
/* IE/Win - Fix animation bug - #4615 */
|
52 |
-
.ui-accordion { width: 100%; }
|
53 |
-
.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; }
|
54 |
-
.ui-accordion .ui-accordion-li-fix { display: inline; }
|
55 |
-
.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; }
|
56 |
-
.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; }
|
57 |
-
.ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; }
|
58 |
-
.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
|
59 |
-
.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; }
|
60 |
-
.ui-accordion .ui-accordion-content-active { display: block; }
|
61 |
-
/*
|
62 |
-
* jQuery UI Autocomplete 1.8.14
|
63 |
-
*
|
64 |
-
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
65 |
-
* Dual licensed under the MIT or GPL Version 2 licenses.
|
66 |
-
* http://jquery.org/license
|
67 |
-
*
|
68 |
-
* http://docs.jquery.com/UI/Autocomplete#theming
|
69 |
-
*/
|
70 |
-
.ui-autocomplete { position: absolute; cursor: default; }
|
71 |
-
|
72 |
-
/* workarounds */
|
73 |
-
* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
|
74 |
-
|
75 |
-
/*
|
76 |
-
* jQuery UI Menu 1.8.14
|
77 |
-
*
|
78 |
-
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
|
79 |
-
* Dual licensed under the MIT or GPL Version 2 licenses.
|
80 |
-
* http://jquery.org/license
|
81 |
-
*
|
82 |
-
* http://docs.jquery.com/UI/Menu#theming
|
83 |
-
*/
|
84 |
-
.ui-menu {
|
85 |
-
list-style:none;
|
86 |
-
padding: 2px;
|
87 |
-
margin: 0;
|
88 |
-
display:block;
|
89 |
-
float: left;
|
90 |
-
}
|
91 |
-
.ui-menu .ui-menu {
|
92 |
-
margin-top: -3px;
|
93 |
-
}
|
94 |
-
.ui-menu .ui-menu-item {
|
95 |
-
margin:0;
|
96 |
-
padding: 0;
|
97 |
-
zoom: 1;
|
98 |
-
float: left;
|
99 |
-
clear: left;
|
100 |
-
width: 100%;
|
101 |
-
}
|
102 |
-
.ui-menu .ui-menu-item a {
|
103 |
-
text-decoration:none;
|
104 |
-
display:block;
|
105 |
-
padding:.2em .4em;
|
106 |
-
line-height:1.5;
|
107 |
-
zoom:1;
|
108 |
-
}
|
109 |
-
.ui-menu .ui-menu-item a.ui-state-hover,
|
110 |
-
.ui-menu .ui-menu-item a.ui-state-active {
|
111 |
-
font-weight: normal;
|
112 |
-
margin: -1px;
|
113 |
-
}
|
114 |
-
/*
|
115 |
-
* jQuery UI Button 1.8.14
|
116 |
-
*
|
117 |
-
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
118 |
-
* Dual licensed under the MIT or GPL Version 2 licenses.
|
119 |
-
* http://jquery.org/license
|
120 |
-
*
|
121 |
-
* http://docs.jquery.com/UI/Button#theming
|
122 |
-
*/
|
123 |
-
.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */
|
124 |
-
.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */
|
125 |
-
button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */
|
126 |
-
.ui-button-icons-only { width: 3.4em; }
|
127 |
-
button.ui-button-icons-only { width: 3.7em; }
|
128 |
-
|
129 |
-
/*button text element */
|
130 |
-
.ui-button .ui-button-text { display: block; line-height: 1.4; }
|
131 |
-
.ui-button-text-only .ui-button-text { padding: .4em 1em; }
|
132 |
-
.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; }
|
133 |
-
.ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; }
|
134 |
-
.ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; }
|
135 |
-
.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; }
|
136 |
-
/* no icon support for input elements, provide padding by default */
|
137 |
-
input.ui-button { padding: .4em 1em; }
|
138 |
-
|
139 |
-
/*button icon element(s) */
|
140 |
-
.ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; }
|
141 |
-
.ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; }
|
142 |
-
.ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; }
|
143 |
-
.ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
|
144 |
-
.ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
|
145 |
-
|
146 |
-
/*button sets*/
|
147 |
-
.ui-buttonset { margin-right: 7px; }
|
148 |
-
.ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; }
|
149 |
-
|
150 |
-
/* workarounds */
|
151 |
-
button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */
|
152 |
-
/*
|
153 |
-
* jQuery UI Datepicker 1.8.14
|
154 |
-
*
|
155 |
-
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
156 |
-
* Dual licensed under the MIT or GPL Version 2 licenses.
|
157 |
-
* http://jquery.org/license
|
158 |
-
*
|
159 |
-
* http://docs.jquery.com/UI/Datepicker#theming
|
160 |
-
*/
|
161 |
-
.ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; }
|
162 |
-
.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
|
163 |
-
.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
|
164 |
-
.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
|
165 |
-
.ui-datepicker .ui-datepicker-prev { left:2px; }
|
166 |
-
.ui-datepicker .ui-datepicker-next { right:2px; }
|
167 |
-
.ui-datepicker .ui-datepicker-prev-hover { left:1px; }
|
168 |
-
.ui-datepicker .ui-datepicker-next-hover { right:1px; }
|
169 |
-
.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
|
170 |
-
.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
|
171 |
-
.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
|
172 |
-
.ui-datepicker select.ui-datepicker-month-year {width: 100%;}
|
173 |
-
.ui-datepicker select.ui-datepicker-month,
|
174 |
-
.ui-datepicker select.ui-datepicker-year { width: 49%;}
|
175 |
-
.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
|
176 |
-
.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
|
177 |
-
.ui-datepicker td { border: 0; padding: 1px; }
|
178 |
-
.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
|
179 |
-
.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
|
180 |
-
.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
|
181 |
-
.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
|
182 |
-
|
183 |
-
/* with multiple calendars */
|
184 |
-
.ui-datepicker.ui-datepicker-multi { width:auto; }
|
185 |
-
.ui-datepicker-multi .ui-datepicker-group { float:left; }
|
186 |
-
.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
|
187 |
-
.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
|
188 |
-
.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
|
189 |
-
.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
|
190 |
-
.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
|
191 |
-
.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
|
192 |
-
.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
|
193 |
-
.ui-datepicker-row-break { clear:both; width:100%; font-size:0em; }
|
194 |
-
|
195 |
-
/* RTL support */
|
196 |
-
.ui-datepicker-rtl { direction: rtl; }
|
197 |
-
.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
|
198 |
-
.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
|
199 |
-
.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
|
200 |
-
.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
|
201 |
-
.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
|
202 |
-
.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
|
203 |
-
.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
|
204 |
-
.ui-datepicker-rtl .ui-datepicker-group { float:right; }
|
205 |
-
.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
|
206 |
-
.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
|
207 |
-
|
208 |
-
/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
|
209 |
-
.ui-datepicker-cover {
|
210 |
-
display: none; /*sorry for IE5*/
|
211 |
-
display/**/: block; /*sorry for IE5*/
|
212 |
-
position: absolute; /*must have*/
|
213 |
-
z-index: -1; /*must have*/
|
214 |
-
filter: mask(); /*must have*/
|
215 |
-
top: -4px; /*must have*/
|
216 |
-
left: -4px; /*must have*/
|
217 |
-
width: 200px; /*must have*/
|
218 |
-
height: 200px; /*must have*/
|
219 |
-
}/*
|
220 |
-
* jQuery UI Dialog 1.8.14
|
221 |
-
*
|
222 |
-
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
223 |
-
* Dual licensed under the MIT or GPL Version 2 licenses.
|
224 |
-
* http://jquery.org/license
|
225 |
-
*
|
226 |
-
* http://docs.jquery.com/UI/Dialog#theming
|
227 |
-
*/
|
228 |
-
.ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; }
|
229 |
-
.ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; }
|
230 |
-
.ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; }
|
231 |
-
.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
|
232 |
-
.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
|
233 |
-
.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
|
234 |
-
.ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
|
235 |
-
.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
|
236 |
-
.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; }
|
237 |
-
.ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; }
|
238 |
-
.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
|
239 |
-
.ui-draggable .ui-dialog-titlebar { cursor: move; }
|
240 |
-
/*
|
241 |
-
* jQuery UI Progressbar 1.8.14
|
242 |
-
*
|
243 |
-
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
244 |
-
* Dual licensed under the MIT or GPL Version 2 licenses.
|
245 |
-
* http://jquery.org/license
|
246 |
-
*
|
247 |
-
* http://docs.jquery.com/UI/Progressbar#theming
|
248 |
-
*/
|
249 |
-
.ui-progressbar { height:2em; text-align: left; }
|
250 |
-
.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }/*
|
251 |
-
* jQuery UI Resizable 1.8.14
|
252 |
-
*
|
253 |
-
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
254 |
-
* Dual licensed under the MIT or GPL Version 2 licenses.
|
255 |
-
* http://jquery.org/license
|
256 |
-
*
|
257 |
-
* http://docs.jquery.com/UI/Resizable#theming
|
258 |
-
*/
|
259 |
-
.ui-resizable { position: relative;}
|
260 |
-
.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block; }
|
261 |
-
.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
|
262 |
-
.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }
|
263 |
-
.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }
|
264 |
-
.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; }
|
265 |
-
.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; }
|
266 |
-
.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
|
267 |
-
.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
|
268 |
-
.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
|
269 |
-
.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/*
|
270 |
-
* jQuery UI Selectable 1.8.14
|
271 |
-
*
|
272 |
-
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
273 |
-
* Dual licensed under the MIT or GPL Version 2 licenses.
|
274 |
-
* http://jquery.org/license
|
275 |
-
*
|
276 |
-
* http://docs.jquery.com/UI/Selectable#theming
|
277 |
-
*/
|
278 |
-
.ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; }
|
279 |
-
/*
|
280 |
-
* jQuery UI Slider 1.8.14
|
281 |
-
*
|
282 |
-
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
283 |
-
* Dual licensed under the MIT or GPL Version 2 licenses.
|
284 |
-
* http://jquery.org/license
|
285 |
-
*
|
286 |
-
* http://docs.jquery.com/UI/Slider#theming
|
287 |
-
*/
|
288 |
-
.ui-slider { position: relative; text-align: left; }
|
289 |
-
.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
|
290 |
-
.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
|
291 |
-
|
292 |
-
.ui-slider-horizontal { height: .8em; }
|
293 |
-
.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
|
294 |
-
.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
|
295 |
-
.ui-slider-horizontal .ui-slider-range-min { left: 0; }
|
296 |
-
.ui-slider-horizontal .ui-slider-range-max { right: 0; }
|
297 |
-
|
298 |
-
.ui-slider-vertical { width: .8em; height: 100px; }
|
299 |
-
.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
|
300 |
-
.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
|
301 |
-
.ui-slider-vertical .ui-slider-range-min { bottom: 0; }
|
302 |
-
.ui-slider-vertical .ui-slider-range-max { top: 0; }/*
|
303 |
-
* jQuery UI Tabs 1.8.14
|
304 |
-
*
|
305 |
-
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
306 |
-
* Dual licensed under the MIT or GPL Version 2 licenses.
|
307 |
-
* http://jquery.org/license
|
308 |
-
*
|
309 |
-
* http://docs.jquery.com/UI/Tabs#theming
|
310 |
-
*/
|
311 |
-
.ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
|
312 |
-
.ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; }
|
313 |
-
.ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; }
|
314 |
-
.ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; }
|
315 |
-
.ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; }
|
316 |
-
.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; }
|
317 |
-
.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
|
318 |
-
.ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; }
|
319 |
-
.ui-tabs .ui-tabs-hide { display: none !important; }
|
320 |
-
/*
|
321 |
-
* jQuery UI CSS Framework 1.8.14
|
322 |
-
*
|
323 |
-
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
324 |
-
* Dual licensed under the MIT or GPL Version 2 licenses.
|
325 |
-
* http://jquery.org/license
|
326 |
-
*
|
327 |
-
* http://docs.jquery.com/UI/Theming/API
|
328 |
-
*
|
329 |
-
* To view and modify this theme, visit http://jqueryui.com/themeroller/
|
330 |
-
*/
|
331 |
-
|
332 |
-
|
333 |
-
/* Component containers
|
334 |
-
----------------------------------*/
|
335 |
-
.ui-widget { font-family: Verdana,Arial,sans-serif/*{ffDefault}*/; font-size: 1.1em/*{fsDefault}*/; }
|
336 |
-
.ui-widget .ui-widget { font-size: 1em; }
|
337 |
-
.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif/*{ffDefault}*/; font-size: 1em; }
|
338 |
-
.ui-widget-content { border: 1px solid #aaaaaa/*{borderColorContent}*/; background: #ffffff/*{bgColorContent}*/ url(images/ui-bg_flat_75_ffffff_40x100.png)/*{bgImgUrlContent}*/ 50%/*{bgContentXPos}*/ 50%/*{bgContentYPos}*/ repeat-x/*{bgContentRepeat}*/; color: #949494/*{fcContent}*/; }
|
339 |
-
.ui-widget-content a { color: #949494/*{fcContent}*/; }
|
340 |
-
.ui-widget-header { border: 1px solid #aaaaaa/*{borderColorHeader}*/; background: #cccccc/*{bgColorHeader}*/ url(images/ui-bg_highlight-soft_75_cccccc_1x100.png)/*{bgImgUrlHeader}*/ 50%/*{bgHeaderXPos}*/ 50%/*{bgHeaderYPos}*/ repeat-x/*{bgHeaderRepeat}*/; color: #949494/*{fcHeader}*/; font-weight: bold; }
|
341 |
-
.ui-widget-header a { color: #222222/*{fcHeader}*/; }
|
342 |
-
|
343 |
-
/* Interaction states
|
344 |
-
----------------------------------*/
|
345 |
-
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3/*{borderColorDefault}*/; background: #7DB5D8/*{bgColorDefault}*/ /*{bgImgUrlDefault}*/ 50%/*{bgDefaultXPos}*/ 50%/*{bgDefaultYPos}*/ repeat-x/*{bgDefaultRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #fff/*{fcDefault}*/; }
|
346 |
-
.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555/*{fcDefault}*/; text-decoration: none; }
|
347 |
-
.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #999999/*{borderColorHover}*/; background: #7DB5D8/*{bgColorHover}*/ /*{bgImgUrlHover}*/ 50%/*{bgHoverXPos}*/ 50%/*{bgHoverYPos}*/ repeat-x/*{bgHoverRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #fff/*{fcHover}*/; }
|
348 |
-
.ui-state-hover a, .ui-state-hover a:hover { color: #212121/*{fcHover}*/; text-decoration: none; }
|
349 |
-
.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa/*{borderColorActive}*/; background: #ffffff/*{bgColorActive}*/ url(images/ui-bg_glass_65_ffffff_1x400.png)/*{bgImgUrlActive}*/ 50%/*{bgActiveXPos}*/ 50%/*{bgActiveYPos}*/ repeat-x/*{bgActiveRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #212121/*{fcActive}*/; }
|
350 |
-
.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121/*{fcActive}*/; text-decoration: none; }
|
351 |
-
.ui-widget :active { outline: none; }
|
352 |
-
|
353 |
-
/* Interaction Cues
|
354 |
-
----------------------------------*/
|
355 |
-
.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fcefa1/*{borderColorHighlight}*/; background: #fbf9ee/*{bgColorHighlight}*/ url(images/ui-bg_glass_55_fbf9ee_1x400.png)/*{bgImgUrlHighlight}*/ 50%/*{bgHighlightXPos}*/ 50%/*{bgHighlightYPos}*/ repeat-x/*{bgHighlightRepeat}*/; color: #363636/*{fcHighlight}*/; }
|
356 |
-
.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636/*{fcHighlight}*/; }
|
357 |
-
.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a/*{borderColorError}*/; background: #fef1ec/*{bgColorError}*/ url(images/ui-bg_glass_95_fef1ec_1x400.png)/*{bgImgUrlError}*/ 50%/*{bgErrorXPos}*/ 50%/*{bgErrorYPos}*/ repeat-x/*{bgErrorRepeat}*/; color: #cd0a0a/*{fcError}*/; }
|
358 |
-
.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a/*{fcError}*/; }
|
359 |
-
.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a/*{fcError}*/; }
|
360 |
-
.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
|
361 |
-
.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
|
362 |
-
.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
|
363 |
-
|
364 |
-
/* Icons
|
365 |
-
----------------------------------*/
|
366 |
-
|
367 |
-
/* states and images */
|
368 |
-
.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png)/*{iconsContent}*/; }
|
369 |
-
.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png)/*{iconsContent}*/; }
|
370 |
-
.ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png)/*{iconsHeader}*/; }
|
371 |
-
.ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png)/*{iconsDefault}*/; }
|
372 |
-
.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_454545_256x240.png)/*{iconsHover}*/; }
|
373 |
-
.ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png)/*{iconsActive}*/; }
|
374 |
-
.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png)/*{iconsHighlight}*/; }
|
375 |
-
.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png)/*{iconsError}*/; }
|
376 |
-
|
377 |
-
/* positioning */
|
378 |
-
.ui-icon-carat-1-n { background-position: 0 0; }
|
379 |
-
.ui-icon-carat-1-ne { background-position: -16px 0; }
|
380 |
-
.ui-icon-carat-1-e { background-position: -32px 0; }
|
381 |
-
.ui-icon-carat-1-se { background-position: -48px 0; }
|
382 |
-
.ui-icon-carat-1-s { background-position: -64px 0; }
|
383 |
-
.ui-icon-carat-1-sw { background-position: -80px 0; }
|
384 |
-
.ui-icon-carat-1-w { background-position: -96px 0; }
|
385 |
-
.ui-icon-carat-1-nw { background-position: -112px 0; }
|
386 |
-
.ui-icon-carat-2-n-s { background-position: -128px 0; }
|
387 |
-
.ui-icon-carat-2-e-w { background-position: -144px 0; }
|
388 |
-
.ui-icon-triangle-1-n { background-position: 0 -16px; }
|
389 |
-
.ui-icon-triangle-1-ne { background-position: -16px -16px; }
|
390 |
-
.ui-icon-triangle-1-e { background-position: -32px -16px; }
|
391 |
-
.ui-icon-triangle-1-se { background-position: -48px -16px; }
|
392 |
-
.ui-icon-triangle-1-s { background-position: -64px -16px; }
|
393 |
-
.ui-icon-triangle-1-sw { background-position: -80px -16px; }
|
394 |
-
.ui-icon-triangle-1-w { background-position: -96px -16px; }
|
395 |
-
.ui-icon-triangle-1-nw { background-position: -112px -16px; }
|
396 |
-
.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
|
397 |
-
.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
|
398 |
-
.ui-icon-arrow-1-n { background-position: 0 -32px; }
|
399 |
-
.ui-icon-arrow-1-ne { background-position: -16px -32px; }
|
400 |
-
.ui-icon-arrow-1-e { background-position: -32px -32px; }
|
401 |
-
.ui-icon-arrow-1-se { background-position: -48px -32px; }
|
402 |
-
.ui-icon-arrow-1-s { background-position: -64px -32px; }
|
403 |
-
.ui-icon-arrow-1-sw { background-position: -80px -32px; }
|
404 |
-
.ui-icon-arrow-1-w { background-position: -96px -32px; }
|
405 |
-
.ui-icon-arrow-1-nw { background-position: -112px -32px; }
|
406 |
-
.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
|
407 |
-
.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
|
408 |
-
.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
|
409 |
-
.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
|
410 |
-
.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
|
411 |
-
.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
|
412 |
-
.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
|
413 |
-
.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
|
414 |
-
.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
|
415 |
-
.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
|
416 |
-
.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
|
417 |
-
.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
|
418 |
-
.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
|
419 |
-
.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
|
420 |
-
.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
|
421 |
-
.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
|
422 |
-
.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
|
423 |
-
.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
|
424 |
-
.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
|
425 |
-
.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
|
426 |
-
.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
|
427 |
-
.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
|
428 |
-
.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
|
429 |
-
.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
|
430 |
-
.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
|
431 |
-
.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
|
432 |
-
.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
|
433 |
-
.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
|
434 |
-
.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
|
435 |
-
.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
|
436 |
-
.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
|
437 |
-
.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
|
438 |
-
.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
|
439 |
-
.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
|
440 |
-
.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
|
441 |
-
.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
|
442 |
-
.ui-icon-arrow-4 { background-position: 0 -80px; }
|
443 |
-
.ui-icon-arrow-4-diag { background-position: -16px -80px; }
|
444 |
-
.ui-icon-extlink { background-position: -32px -80px; }
|
445 |
-
.ui-icon-newwin { background-position: -48px -80px; }
|
446 |
-
.ui-icon-refresh { background-position: -64px -80px; }
|
447 |
-
.ui-icon-shuffle { background-position: -80px -80px; }
|
448 |
-
.ui-icon-transfer-e-w { background-position: -96px -80px; }
|
449 |
-
.ui-icon-transferthick-e-w { background-position: -112px -80px; }
|
450 |
-
.ui-icon-folder-collapsed { background-position: 0 -96px; }
|
451 |
-
.ui-icon-folder-open { background-position: -16px -96px; }
|
452 |
-
.ui-icon-document { background-position: -32px -96px; }
|
453 |
-
.ui-icon-document-b { background-position: -48px -96px; }
|
454 |
-
.ui-icon-note { background-position: -64px -96px; }
|
455 |
-
.ui-icon-mail-closed { background-position: -80px -96px; }
|
456 |
-
.ui-icon-mail-open { background-position: -96px -96px; }
|
457 |
-
.ui-icon-suitcase { background-position: -112px -96px; }
|
458 |
-
.ui-icon-comment { background-position: -128px -96px; }
|
459 |
-
.ui-icon-person { background-position: -144px -96px; }
|
460 |
-
.ui-icon-print { background-position: -160px -96px; }
|
461 |
-
.ui-icon-trash { background-position: -176px -96px; }
|
462 |
-
.ui-icon-locked { background-position: -192px -96px; }
|
463 |
-
.ui-icon-unlocked { background-position: -208px -96px; }
|
464 |
-
.ui-icon-bookmark { background-position: -224px -96px; }
|
465 |
-
.ui-icon-tag { background-position: -240px -96px; }
|
466 |
-
.ui-icon-home { background-position: 0 -112px; }
|
467 |
-
.ui-icon-flag { background-position: -16px -112px; }
|
468 |
-
.ui-icon-calendar { background-position: -32px -112px; }
|
469 |
-
.ui-icon-cart { background-position: -48px -112px; }
|
470 |
-
.ui-icon-pencil { background-position: -64px -112px; }
|
471 |
-
.ui-icon-clock { background-position: -80px -112px; }
|
472 |
-
.ui-icon-disk { background-position: -96px -112px; }
|
473 |
-
.ui-icon-calculator { background-position: -112px -112px; }
|
474 |
-
.ui-icon-zoomin { background-position: -128px -112px; }
|
475 |
-
.ui-icon-zoomout { background-position: -144px -112px; }
|
476 |
-
.ui-icon-search { background-position: -160px -112px; }
|
477 |
-
.ui-icon-wrench { background-position: -176px -112px; }
|
478 |
-
.ui-icon-gear { background-position: -192px -112px; }
|
479 |
-
.ui-icon-heart { background-position: -208px -112px; }
|
480 |
-
.ui-icon-star { background-position: -224px -112px; }
|
481 |
-
.ui-icon-link { background-position: -240px -112px; }
|
482 |
-
.ui-icon-cancel { background-position: 0 -128px; }
|
483 |
-
.ui-icon-plus { background-position: -16px -128px; }
|
484 |
-
.ui-icon-plusthick { background-position: -32px -128px; }
|
485 |
-
.ui-icon-minus { background-position: -48px -128px; }
|
486 |
-
.ui-icon-minusthick { background-position: -64px -128px; }
|
487 |
-
.ui-icon-close { background-position: -80px -128px; }
|
488 |
-
.ui-icon-closethick { background-position: -96px -128px; }
|
489 |
-
.ui-icon-key { background-position: -112px -128px; }
|
490 |
-
.ui-icon-lightbulb { background-position: -128px -128px; }
|
491 |
-
.ui-icon-scissors { background-position: -144px -128px; }
|
492 |
-
.ui-icon-clipboard { background-position: -160px -128px; }
|
493 |
-
.ui-icon-copy { background-position: -176px -128px; }
|
494 |
-
.ui-icon-contact { background-position: -192px -128px; }
|
495 |
-
.ui-icon-image { background-position: -208px -128px; }
|
496 |
-
.ui-icon-video { background-position: -224px -128px; }
|
497 |
-
.ui-icon-script { background-position: -240px -128px; }
|
498 |
-
.ui-icon-alert { background-position: 0 -144px; }
|
499 |
-
.ui-icon-info { background-position: -16px -144px; }
|
500 |
-
.ui-icon-notice { background-position: -32px -144px; }
|
501 |
-
.ui-icon-help { background-position: -48px -144px; }
|
502 |
-
.ui-icon-check { background-position: -64px -144px; }
|
503 |
-
.ui-icon-bullet { background-position: -80px -144px; }
|
504 |
-
.ui-icon-radio-off { background-position: -96px -144px; }
|
505 |
-
.ui-icon-radio-on { background-position: -112px -144px; }
|
506 |
-
.ui-icon-pin-w { background-position: -128px -144px; }
|
507 |
-
.ui-icon-pin-s { background-position: -144px -144px; }
|
508 |
-
.ui-icon-play { background-position: 0 -160px; }
|
509 |
-
.ui-icon-pause { background-position: -16px -160px; }
|
510 |
-
.ui-icon-seek-next { background-position: -32px -160px; }
|
511 |
-
.ui-icon-seek-prev { background-position: -48px -160px; }
|
512 |
-
.ui-icon-seek-end { background-position: -64px -160px; }
|
513 |
-
.ui-icon-seek-start { background-position: -80px -160px; }
|
514 |
-
/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
|
515 |
-
.ui-icon-seek-first { background-position: -80px -160px; }
|
516 |
-
.ui-icon-stop { background-position: -96px -160px; }
|
517 |
-
.ui-icon-eject { background-position: -112px -160px; }
|
518 |
-
.ui-icon-volume-off { background-position: -128px -160px; }
|
519 |
-
.ui-icon-volume-on { background-position: -144px -160px; }
|
520 |
-
.ui-icon-power { background-position: 0 -176px; }
|
521 |
-
.ui-icon-signal-diag { background-position: -16px -176px; }
|
522 |
-
.ui-icon-signal { background-position: -32px -176px; }
|
523 |
-
.ui-icon-battery-0 { background-position: -48px -176px; }
|
524 |
-
.ui-icon-battery-1 { background-position: -64px -176px; }
|
525 |
-
.ui-icon-battery-2 { background-position: -80px -176px; }
|
526 |
-
.ui-icon-battery-3 { background-position: -96px -176px; }
|
527 |
-
.ui-icon-circle-plus { background-position: 0 -192px; }
|
528 |
-
.ui-icon-circle-minus { background-position: -16px -192px; }
|
529 |
-
.ui-icon-circle-close { background-position: -32px -192px; }
|
530 |
-
.ui-icon-circle-triangle-e { background-position: -48px -192px; }
|
531 |
-
.ui-icon-circle-triangle-s { background-position: -64px -192px; }
|
532 |
-
.ui-icon-circle-triangle-w { background-position: -80px -192px; }
|
533 |
-
.ui-icon-circle-triangle-n { background-position: -96px -192px; }
|
534 |
-
.ui-icon-circle-arrow-e { background-position: -112px -192px; }
|
535 |
-
.ui-icon-circle-arrow-s { background-position: -128px -192px; }
|
536 |
-
.ui-icon-circle-arrow-w { background-position: -144px -192px; }
|
537 |
-
.ui-icon-circle-arrow-n { background-position: -160px -192px; }
|
538 |
-
.ui-icon-circle-zoomin { background-position: -176px -192px; }
|
539 |
-
.ui-icon-circle-zoomout { background-position: -192px -192px; }
|
540 |
-
.ui-icon-circle-check { background-position: -208px -192px; }
|
541 |
-
.ui-icon-circlesmall-plus { background-position: 0 -208px; }
|
542 |
-
.ui-icon-circlesmall-minus { background-position: -16px -208px; }
|
543 |
-
.ui-icon-circlesmall-close { background-position: -32px -208px; }
|
544 |
-
.ui-icon-squaresmall-plus { background-position: -48px -208px; }
|
545 |
-
.ui-icon-squaresmall-minus { background-position: -64px -208px; }
|
546 |
-
.ui-icon-squaresmall-close { background-position: -80px -208px; }
|
547 |
-
.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
|
548 |
-
.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
|
549 |
-
.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
|
550 |
-
.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
|
551 |
-
.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
|
552 |
-
.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
|
553 |
-
|
554 |
-
|
555 |
-
/* Misc visuals
|
556 |
-
----------------------------------*/
|
557 |
-
|
558 |
-
/* Corner radius */
|
559 |
-
.ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 4px/*{cornerRadius}*/; -webkit-border-top-left-radius: 4px/*{cornerRadius}*/; -khtml-border-top-left-radius: 4px/*{cornerRadius}*/; border-top-left-radius: 4px/*{cornerRadius}*/; }
|
560 |
-
.ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 4px/*{cornerRadius}*/; -webkit-border-top-right-radius: 4px/*{cornerRadius}*/; -khtml-border-top-right-radius: 4px/*{cornerRadius}*/; border-top-right-radius: 4px/*{cornerRadius}*/; }
|
561 |
-
.ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 4px/*{cornerRadius}*/; -webkit-border-bottom-left-radius: 4px/*{cornerRadius}*/; -khtml-border-bottom-left-radius: 4px/*{cornerRadius}*/; border-bottom-left-radius: 4px/*{cornerRadius}*/; }
|
562 |
-
.ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 4px/*{cornerRadius}*/; -webkit-border-bottom-right-radius: 4px/*{cornerRadius}*/; -khtml-border-bottom-right-radius: 4px/*{cornerRadius}*/; border-bottom-right-radius: 4px/*{cornerRadius}*/; }
|
563 |
-
|
564 |
-
/* Overlays */
|
565 |
-
.ui-widget-overlay { background: #aaaaaa/*{bgColorOverlay}*/ url(images/ui-bg_flat_0_aaaaaa_40x100.png)/*{bgImgUrlOverlay}*/ 50%/*{bgOverlayXPos}*/ 50%/*{bgOverlayYPos}*/ repeat-x/*{bgOverlayRepeat}*/; opacity: .3;filter:Alpha(Opacity=30)/*{opacityOverlay}*/; }
|
566 |
.ui-widget-shadow { margin: -8px/*{offsetTopShadow}*/ 0 0 -8px/*{offsetLeftShadow}*/; padding: 8px/*{thicknessShadow}*/; background: #aaaaaa/*{bgColorShadow}*/ url(images/ui-bg_flat_0_aaaaaa_40x100.png)/*{bgImgUrlShadow}*/ 50%/*{bgShadowXPos}*/ 50%/*{bgShadowYPos}*/ repeat-x/*{bgShadowRepeat}*/; opacity: .3;filter:Alpha(Opacity=30)/*{opacityShadow}*/; -moz-border-radius: 8px/*{cornerRadiusShadow}*/; -khtml-border-radius: 8px/*{cornerRadiusShadow}*/; -webkit-border-radius: 8px/*{cornerRadiusShadow}*/; border-radius: 8px/*{cornerRadiusShadow}*/; }
|
1 |
+
/*
|
2 |
+
* jQuery UI CSS Framework 1.8.14
|
3 |
+
*
|
4 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
5 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
6 |
+
* http://jquery.org/license
|
7 |
+
*
|
8 |
+
* http://docs.jquery.com/UI/Theming/API
|
9 |
+
*/
|
10 |
+
|
11 |
+
/* Layout helpers
|
12 |
+
----------------------------------*/
|
13 |
+
.ui-helper-hidden { display: none; }
|
14 |
+
.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
|
15 |
+
.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
|
16 |
+
.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
|
17 |
+
.ui-helper-clearfix { display: inline-block; }
|
18 |
+
/* required comment for clearfix to work in Opera \*/
|
19 |
+
* html .ui-helper-clearfix { height:1%; }
|
20 |
+
.ui-helper-clearfix { display:block; }
|
21 |
+
/* end clearfix */
|
22 |
+
.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
|
23 |
+
|
24 |
+
|
25 |
+
/* Interaction Cues
|
26 |
+
----------------------------------*/
|
27 |
+
.ui-state-disabled { cursor: default !important; }
|
28 |
+
|
29 |
+
|
30 |
+
/* Icons
|
31 |
+
----------------------------------*/
|
32 |
+
|
33 |
+
/* states and images */
|
34 |
+
.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
|
35 |
+
|
36 |
+
|
37 |
+
/* Misc visuals
|
38 |
+
----------------------------------*/
|
39 |
+
|
40 |
+
/* Overlays */
|
41 |
+
.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
|
42 |
+
/*
|
43 |
+
* jQuery UI Accordion 1.8.14
|
44 |
+
*
|
45 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
46 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
47 |
+
* http://jquery.org/license
|
48 |
+
*
|
49 |
+
* http://docs.jquery.com/UI/Accordion#theming
|
50 |
+
*/
|
51 |
+
/* IE/Win - Fix animation bug - #4615 */
|
52 |
+
.ui-accordion { width: 100%; }
|
53 |
+
.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; }
|
54 |
+
.ui-accordion .ui-accordion-li-fix { display: inline; }
|
55 |
+
.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; }
|
56 |
+
.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; }
|
57 |
+
.ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; }
|
58 |
+
.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
|
59 |
+
.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; }
|
60 |
+
.ui-accordion .ui-accordion-content-active { display: block; }
|
61 |
+
/*
|
62 |
+
* jQuery UI Autocomplete 1.8.14
|
63 |
+
*
|
64 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
65 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
66 |
+
* http://jquery.org/license
|
67 |
+
*
|
68 |
+
* http://docs.jquery.com/UI/Autocomplete#theming
|
69 |
+
*/
|
70 |
+
.ui-autocomplete { position: absolute; cursor: default; }
|
71 |
+
|
72 |
+
/* workarounds */
|
73 |
+
* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
|
74 |
+
|
75 |
+
/*
|
76 |
+
* jQuery UI Menu 1.8.14
|
77 |
+
*
|
78 |
+
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
|
79 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
80 |
+
* http://jquery.org/license
|
81 |
+
*
|
82 |
+
* http://docs.jquery.com/UI/Menu#theming
|
83 |
+
*/
|
84 |
+
.ui-menu {
|
85 |
+
list-style:none;
|
86 |
+
padding: 2px;
|
87 |
+
margin: 0;
|
88 |
+
display:block;
|
89 |
+
float: left;
|
90 |
+
}
|
91 |
+
.ui-menu .ui-menu {
|
92 |
+
margin-top: -3px;
|
93 |
+
}
|
94 |
+
.ui-menu .ui-menu-item {
|
95 |
+
margin:0;
|
96 |
+
padding: 0;
|
97 |
+
zoom: 1;
|
98 |
+
float: left;
|
99 |
+
clear: left;
|
100 |
+
width: 100%;
|
101 |
+
}
|
102 |
+
.ui-menu .ui-menu-item a {
|
103 |
+
text-decoration:none;
|
104 |
+
display:block;
|
105 |
+
padding:.2em .4em;
|
106 |
+
line-height:1.5;
|
107 |
+
zoom:1;
|
108 |
+
}
|
109 |
+
.ui-menu .ui-menu-item a.ui-state-hover,
|
110 |
+
.ui-menu .ui-menu-item a.ui-state-active {
|
111 |
+
font-weight: normal;
|
112 |
+
margin: -1px;
|
113 |
+
}
|
114 |
+
/*
|
115 |
+
* jQuery UI Button 1.8.14
|
116 |
+
*
|
117 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
118 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
119 |
+
* http://jquery.org/license
|
120 |
+
*
|
121 |
+
* http://docs.jquery.com/UI/Button#theming
|
122 |
+
*/
|
123 |
+
.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */
|
124 |
+
.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */
|
125 |
+
button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */
|
126 |
+
.ui-button-icons-only { width: 3.4em; }
|
127 |
+
button.ui-button-icons-only { width: 3.7em; }
|
128 |
+
|
129 |
+
/*button text element */
|
130 |
+
.ui-button .ui-button-text { display: block; line-height: 1.4; }
|
131 |
+
.ui-button-text-only .ui-button-text { padding: .4em 1em; }
|
132 |
+
.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; }
|
133 |
+
.ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; }
|
134 |
+
.ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; }
|
135 |
+
.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; }
|
136 |
+
/* no icon support for input elements, provide padding by default */
|
137 |
+
input.ui-button { padding: .4em 1em; }
|
138 |
+
|
139 |
+
/*button icon element(s) */
|
140 |
+
.ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; }
|
141 |
+
.ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; }
|
142 |
+
.ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; }
|
143 |
+
.ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
|
144 |
+
.ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
|
145 |
+
|
146 |
+
/*button sets*/
|
147 |
+
.ui-buttonset { margin-right: 7px; }
|
148 |
+
.ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; }
|
149 |
+
|
150 |
+
/* workarounds */
|
151 |
+
button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */
|
152 |
+
/*
|
153 |
+
* jQuery UI Datepicker 1.8.14
|
154 |
+
*
|
155 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
156 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
157 |
+
* http://jquery.org/license
|
158 |
+
*
|
159 |
+
* http://docs.jquery.com/UI/Datepicker#theming
|
160 |
+
*/
|
161 |
+
.ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; }
|
162 |
+
.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
|
163 |
+
.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
|
164 |
+
.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
|
165 |
+
.ui-datepicker .ui-datepicker-prev { left:2px; }
|
166 |
+
.ui-datepicker .ui-datepicker-next { right:2px; }
|
167 |
+
.ui-datepicker .ui-datepicker-prev-hover { left:1px; }
|
168 |
+
.ui-datepicker .ui-datepicker-next-hover { right:1px; }
|
169 |
+
.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
|
170 |
+
.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
|
171 |
+
.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
|
172 |
+
.ui-datepicker select.ui-datepicker-month-year {width: 100%;}
|
173 |
+
.ui-datepicker select.ui-datepicker-month,
|
174 |
+
.ui-datepicker select.ui-datepicker-year { width: 49%;}
|
175 |
+
.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
|
176 |
+
.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
|
177 |
+
.ui-datepicker td { border: 0; padding: 1px; }
|
178 |
+
.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
|
179 |
+
.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
|
180 |
+
.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
|
181 |
+
.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
|
182 |
+
|
183 |
+
/* with multiple calendars */
|
184 |
+
.ui-datepicker.ui-datepicker-multi { width:auto; }
|
185 |
+
.ui-datepicker-multi .ui-datepicker-group { float:left; }
|
186 |
+
.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
|
187 |
+
.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
|
188 |
+
.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
|
189 |
+
.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
|
190 |
+
.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
|
191 |
+
.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
|
192 |
+
.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
|
193 |
+
.ui-datepicker-row-break { clear:both; width:100%; font-size:0em; }
|
194 |
+
|
195 |
+
/* RTL support */
|
196 |
+
.ui-datepicker-rtl { direction: rtl; }
|
197 |
+
.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
|
198 |
+
.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
|
199 |
+
.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
|
200 |
+
.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
|
201 |
+
.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
|
202 |
+
.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
|
203 |
+
.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
|
204 |
+
.ui-datepicker-rtl .ui-datepicker-group { float:right; }
|
205 |
+
.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
|
206 |
+
.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
|
207 |
+
|
208 |
+
/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
|
209 |
+
.ui-datepicker-cover {
|
210 |
+
display: none; /*sorry for IE5*/
|
211 |
+
display/**/: block; /*sorry for IE5*/
|
212 |
+
position: absolute; /*must have*/
|
213 |
+
z-index: -1; /*must have*/
|
214 |
+
filter: mask(); /*must have*/
|
215 |
+
top: -4px; /*must have*/
|
216 |
+
left: -4px; /*must have*/
|
217 |
+
width: 200px; /*must have*/
|
218 |
+
height: 200px; /*must have*/
|
219 |
+
}/*
|
220 |
+
* jQuery UI Dialog 1.8.14
|
221 |
+
*
|
222 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
223 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
224 |
+
* http://jquery.org/license
|
225 |
+
*
|
226 |
+
* http://docs.jquery.com/UI/Dialog#theming
|
227 |
+
*/
|
228 |
+
.ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; }
|
229 |
+
.ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; }
|
230 |
+
.ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; }
|
231 |
+
.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
|
232 |
+
.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
|
233 |
+
.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
|
234 |
+
.ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
|
235 |
+
.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
|
236 |
+
.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; }
|
237 |
+
.ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; }
|
238 |
+
.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
|
239 |
+
.ui-draggable .ui-dialog-titlebar { cursor: move; }
|
240 |
+
/*
|
241 |
+
* jQuery UI Progressbar 1.8.14
|
242 |
+
*
|
243 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
244 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
245 |
+
* http://jquery.org/license
|
246 |
+
*
|
247 |
+
* http://docs.jquery.com/UI/Progressbar#theming
|
248 |
+
*/
|
249 |
+
.ui-progressbar { height:2em; text-align: left; }
|
250 |
+
.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }/*
|
251 |
+
* jQuery UI Resizable 1.8.14
|
252 |
+
*
|
253 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
254 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
255 |
+
* http://jquery.org/license
|
256 |
+
*
|
257 |
+
* http://docs.jquery.com/UI/Resizable#theming
|
258 |
+
*/
|
259 |
+
.ui-resizable { position: relative;}
|
260 |
+
.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block; }
|
261 |
+
.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
|
262 |
+
.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }
|
263 |
+
.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }
|
264 |
+
.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; }
|
265 |
+
.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; }
|
266 |
+
.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
|
267 |
+
.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
|
268 |
+
.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
|
269 |
+
.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/*
|
270 |
+
* jQuery UI Selectable 1.8.14
|
271 |
+
*
|
272 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
273 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
274 |
+
* http://jquery.org/license
|
275 |
+
*
|
276 |
+
* http://docs.jquery.com/UI/Selectable#theming
|
277 |
+
*/
|
278 |
+
.ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; }
|
279 |
+
/*
|
280 |
+
* jQuery UI Slider 1.8.14
|
281 |
+
*
|
282 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
283 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
284 |
+
* http://jquery.org/license
|
285 |
+
*
|
286 |
+
* http://docs.jquery.com/UI/Slider#theming
|
287 |
+
*/
|
288 |
+
.ui-slider { position: relative; text-align: left; }
|
289 |
+
.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
|
290 |
+
.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
|
291 |
+
|
292 |
+
.ui-slider-horizontal { height: .8em; }
|
293 |
+
.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
|
294 |
+
.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
|
295 |
+
.ui-slider-horizontal .ui-slider-range-min { left: 0; }
|
296 |
+
.ui-slider-horizontal .ui-slider-range-max { right: 0; }
|
297 |
+
|
298 |
+
.ui-slider-vertical { width: .8em; height: 100px; }
|
299 |
+
.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
|
300 |
+
.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
|
301 |
+
.ui-slider-vertical .ui-slider-range-min { bottom: 0; }
|
302 |
+
.ui-slider-vertical .ui-slider-range-max { top: 0; }/*
|
303 |
+
* jQuery UI Tabs 1.8.14
|
304 |
+
*
|
305 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
306 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
307 |
+
* http://jquery.org/license
|
308 |
+
*
|
309 |
+
* http://docs.jquery.com/UI/Tabs#theming
|
310 |
+
*/
|
311 |
+
.ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
|
312 |
+
.ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; }
|
313 |
+
.ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; }
|
314 |
+
.ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; }
|
315 |
+
.ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; }
|
316 |
+
.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; }
|
317 |
+
.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
|
318 |
+
.ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; }
|
319 |
+
.ui-tabs .ui-tabs-hide { display: none !important; }
|
320 |
+
/*
|
321 |
+
* jQuery UI CSS Framework 1.8.14
|
322 |
+
*
|
323 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
324 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
325 |
+
* http://jquery.org/license
|
326 |
+
*
|
327 |
+
* http://docs.jquery.com/UI/Theming/API
|
328 |
+
*
|
329 |
+
* To view and modify this theme, visit http://jqueryui.com/themeroller/
|
330 |
+
*/
|
331 |
+
|
332 |
+
|
333 |
+
/* Component containers
|
334 |
+
----------------------------------*/
|
335 |
+
.ui-widget { font-family: Verdana,Arial,sans-serif/*{ffDefault}*/; font-size: 1.1em/*{fsDefault}*/; }
|
336 |
+
.ui-widget .ui-widget { font-size: 1em; }
|
337 |
+
.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif/*{ffDefault}*/; font-size: 1em; }
|
338 |
+
.ui-widget-content { border: 1px solid #aaaaaa/*{borderColorContent}*/; background: #ffffff/*{bgColorContent}*/ url(images/ui-bg_flat_75_ffffff_40x100.png)/*{bgImgUrlContent}*/ 50%/*{bgContentXPos}*/ 50%/*{bgContentYPos}*/ repeat-x/*{bgContentRepeat}*/; color: #949494/*{fcContent}*/; }
|
339 |
+
.ui-widget-content a { color: #949494/*{fcContent}*/; }
|
340 |
+
.ui-widget-header { border: 1px solid #aaaaaa/*{borderColorHeader}*/; background: #cccccc/*{bgColorHeader}*/ url(images/ui-bg_highlight-soft_75_cccccc_1x100.png)/*{bgImgUrlHeader}*/ 50%/*{bgHeaderXPos}*/ 50%/*{bgHeaderYPos}*/ repeat-x/*{bgHeaderRepeat}*/; color: #949494/*{fcHeader}*/; font-weight: bold; }
|
341 |
+
.ui-widget-header a { color: #222222/*{fcHeader}*/; }
|
342 |
+
|
343 |
+
/* Interaction states
|
344 |
+
----------------------------------*/
|
345 |
+
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3/*{borderColorDefault}*/; background: #7DB5D8/*{bgColorDefault}*/ /*{bgImgUrlDefault}*/ 50%/*{bgDefaultXPos}*/ 50%/*{bgDefaultYPos}*/ repeat-x/*{bgDefaultRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #fff/*{fcDefault}*/; }
|
346 |
+
.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555/*{fcDefault}*/; text-decoration: none; }
|
347 |
+
.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #999999/*{borderColorHover}*/; background: #7DB5D8/*{bgColorHover}*/ /*{bgImgUrlHover}*/ 50%/*{bgHoverXPos}*/ 50%/*{bgHoverYPos}*/ repeat-x/*{bgHoverRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #fff/*{fcHover}*/; }
|
348 |
+
.ui-state-hover a, .ui-state-hover a:hover { color: #212121/*{fcHover}*/; text-decoration: none; }
|
349 |
+
.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa/*{borderColorActive}*/; background: #ffffff/*{bgColorActive}*/ url(images/ui-bg_glass_65_ffffff_1x400.png)/*{bgImgUrlActive}*/ 50%/*{bgActiveXPos}*/ 50%/*{bgActiveYPos}*/ repeat-x/*{bgActiveRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #212121/*{fcActive}*/; }
|
350 |
+
.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121/*{fcActive}*/; text-decoration: none; }
|
351 |
+
.ui-widget :active { outline: none; }
|
352 |
+
|
353 |
+
/* Interaction Cues
|
354 |
+
----------------------------------*/
|
355 |
+
.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fcefa1/*{borderColorHighlight}*/; background: #fbf9ee/*{bgColorHighlight}*/ url(images/ui-bg_glass_55_fbf9ee_1x400.png)/*{bgImgUrlHighlight}*/ 50%/*{bgHighlightXPos}*/ 50%/*{bgHighlightYPos}*/ repeat-x/*{bgHighlightRepeat}*/; color: #363636/*{fcHighlight}*/; }
|
356 |
+
.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636/*{fcHighlight}*/; }
|
357 |
+
.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a/*{borderColorError}*/; background: #fef1ec/*{bgColorError}*/ url(images/ui-bg_glass_95_fef1ec_1x400.png)/*{bgImgUrlError}*/ 50%/*{bgErrorXPos}*/ 50%/*{bgErrorYPos}*/ repeat-x/*{bgErrorRepeat}*/; color: #cd0a0a/*{fcError}*/; }
|
358 |
+
.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a/*{fcError}*/; }
|
359 |
+
.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a/*{fcError}*/; }
|
360 |
+
.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
|
361 |
+
.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
|
362 |
+
.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
|
363 |
+
|
364 |
+
/* Icons
|
365 |
+
----------------------------------*/
|
366 |
+
|
367 |
+
/* states and images */
|
368 |
+
.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png)/*{iconsContent}*/; }
|
369 |
+
.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png)/*{iconsContent}*/; }
|
370 |
+
.ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png)/*{iconsHeader}*/; }
|
371 |
+
.ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png)/*{iconsDefault}*/; }
|
372 |
+
.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_454545_256x240.png)/*{iconsHover}*/; }
|
373 |
+
.ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png)/*{iconsActive}*/; }
|
374 |
+
.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png)/*{iconsHighlight}*/; }
|
375 |
+
.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png)/*{iconsError}*/; }
|
376 |
+
|
377 |
+
/* positioning */
|
378 |
+
.ui-icon-carat-1-n { background-position: 0 0; }
|
379 |
+
.ui-icon-carat-1-ne { background-position: -16px 0; }
|
380 |
+
.ui-icon-carat-1-e { background-position: -32px 0; }
|
381 |
+
.ui-icon-carat-1-se { background-position: -48px 0; }
|
382 |
+
.ui-icon-carat-1-s { background-position: -64px 0; }
|
383 |
+
.ui-icon-carat-1-sw { background-position: -80px 0; }
|
384 |
+
.ui-icon-carat-1-w { background-position: -96px 0; }
|
385 |
+
.ui-icon-carat-1-nw { background-position: -112px 0; }
|
386 |
+
.ui-icon-carat-2-n-s { background-position: -128px 0; }
|
387 |
+
.ui-icon-carat-2-e-w { background-position: -144px 0; }
|
388 |
+
.ui-icon-triangle-1-n { background-position: 0 -16px; }
|
389 |
+
.ui-icon-triangle-1-ne { background-position: -16px -16px; }
|
390 |
+
.ui-icon-triangle-1-e { background-position: -32px -16px; }
|
391 |
+
.ui-icon-triangle-1-se { background-position: -48px -16px; }
|
392 |
+
.ui-icon-triangle-1-s { background-position: -64px -16px; }
|
393 |
+
.ui-icon-triangle-1-sw { background-position: -80px -16px; }
|
394 |
+
.ui-icon-triangle-1-w { background-position: -96px -16px; }
|
395 |
+
.ui-icon-triangle-1-nw { background-position: -112px -16px; }
|
396 |
+
.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
|
397 |
+
.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
|
398 |
+
.ui-icon-arrow-1-n { background-position: 0 -32px; }
|
399 |
+
.ui-icon-arrow-1-ne { background-position: -16px -32px; }
|
400 |
+
.ui-icon-arrow-1-e { background-position: -32px -32px; }
|
401 |
+
.ui-icon-arrow-1-se { background-position: -48px -32px; }
|
402 |
+
.ui-icon-arrow-1-s { background-position: -64px -32px; }
|
403 |
+
.ui-icon-arrow-1-sw { background-position: -80px -32px; }
|
404 |
+
.ui-icon-arrow-1-w { background-position: -96px -32px; }
|
405 |
+
.ui-icon-arrow-1-nw { background-position: -112px -32px; }
|
406 |
+
.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
|
407 |
+
.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
|
408 |
+
.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
|
409 |
+
.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
|
410 |
+
.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
|
411 |
+
.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
|
412 |
+
.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
|
413 |
+
.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
|
414 |
+
.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
|
415 |
+
.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
|
416 |
+
.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
|
417 |
+
.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
|
418 |
+
.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
|
419 |
+
.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
|
420 |
+
.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
|
421 |
+
.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
|
422 |
+
.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
|
423 |
+
.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
|
424 |
+
.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
|
425 |
+
.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
|
426 |
+
.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
|
427 |
+
.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
|
428 |
+
.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
|
429 |
+
.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
|
430 |
+
.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
|
431 |
+
.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
|
432 |
+
.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
|
433 |
+
.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
|
434 |
+
.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
|
435 |
+
.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
|
436 |
+
.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
|
437 |
+
.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
|
438 |
+
.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
|
439 |
+
.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
|
440 |
+
.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
|
441 |
+
.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
|
442 |
+
.ui-icon-arrow-4 { background-position: 0 -80px; }
|
443 |
+
.ui-icon-arrow-4-diag { background-position: -16px -80px; }
|
444 |
+
.ui-icon-extlink { background-position: -32px -80px; }
|
445 |
+
.ui-icon-newwin { background-position: -48px -80px; }
|
446 |
+
.ui-icon-refresh { background-position: -64px -80px; }
|
447 |
+
.ui-icon-shuffle { background-position: -80px -80px; }
|
448 |
+
.ui-icon-transfer-e-w { background-position: -96px -80px; }
|
449 |
+
.ui-icon-transferthick-e-w { background-position: -112px -80px; }
|
450 |
+
.ui-icon-folder-collapsed { background-position: 0 -96px; }
|
451 |
+
.ui-icon-folder-open { background-position: -16px -96px; }
|
452 |
+
.ui-icon-document { background-position: -32px -96px; }
|
453 |
+
.ui-icon-document-b { background-position: -48px -96px; }
|
454 |
+
.ui-icon-note { background-position: -64px -96px; }
|
455 |
+
.ui-icon-mail-closed { background-position: -80px -96px; }
|
456 |
+
.ui-icon-mail-open { background-position: -96px -96px; }
|
457 |
+
.ui-icon-suitcase { background-position: -112px -96px; }
|
458 |
+
.ui-icon-comment { background-position: -128px -96px; }
|
459 |
+
.ui-icon-person { background-position: -144px -96px; }
|
460 |
+
.ui-icon-print { background-position: -160px -96px; }
|
461 |
+
.ui-icon-trash { background-position: -176px -96px; }
|
462 |
+
.ui-icon-locked { background-position: -192px -96px; }
|
463 |
+
.ui-icon-unlocked { background-position: -208px -96px; }
|
464 |
+
.ui-icon-bookmark { background-position: -224px -96px; }
|
465 |
+
.ui-icon-tag { background-position: -240px -96px; }
|
466 |
+
.ui-icon-home { background-position: 0 -112px; }
|
467 |
+
.ui-icon-flag { background-position: -16px -112px; }
|
468 |
+
.ui-icon-calendar { background-position: -32px -112px; }
|
469 |
+
.ui-icon-cart { background-position: -48px -112px; }
|
470 |
+
.ui-icon-pencil { background-position: -64px -112px; }
|
471 |
+
.ui-icon-clock { background-position: -80px -112px; }
|
472 |
+
.ui-icon-disk { background-position: -96px -112px; }
|
473 |
+
.ui-icon-calculator { background-position: -112px -112px; }
|
474 |
+
.ui-icon-zoomin { background-position: -128px -112px; }
|
475 |
+
.ui-icon-zoomout { background-position: -144px -112px; }
|
476 |
+
.ui-icon-search { background-position: -160px -112px; }
|
477 |
+
.ui-icon-wrench { background-position: -176px -112px; }
|
478 |
+
.ui-icon-gear { background-position: -192px -112px; }
|
479 |
+
.ui-icon-heart { background-position: -208px -112px; }
|
480 |
+
.ui-icon-star { background-position: -224px -112px; }
|
481 |
+
.ui-icon-link { background-position: -240px -112px; }
|
482 |
+
.ui-icon-cancel { background-position: 0 -128px; }
|
483 |
+
.ui-icon-plus { background-position: -16px -128px; }
|
484 |
+
.ui-icon-plusthick { background-position: -32px -128px; }
|
485 |
+
.ui-icon-minus { background-position: -48px -128px; }
|
486 |
+
.ui-icon-minusthick { background-position: -64px -128px; }
|
487 |
+
.ui-icon-close { background-position: -80px -128px; }
|
488 |
+
.ui-icon-closethick { background-position: -96px -128px; }
|
489 |
+
.ui-icon-key { background-position: -112px -128px; }
|
490 |
+
.ui-icon-lightbulb { background-position: -128px -128px; }
|
491 |
+
.ui-icon-scissors { background-position: -144px -128px; }
|
492 |
+
.ui-icon-clipboard { background-position: -160px -128px; }
|
493 |
+
.ui-icon-copy { background-position: -176px -128px; }
|
494 |
+
.ui-icon-contact { background-position: -192px -128px; }
|
495 |
+
.ui-icon-image { background-position: -208px -128px; }
|
496 |
+
.ui-icon-video { background-position: -224px -128px; }
|
497 |
+
.ui-icon-script { background-position: -240px -128px; }
|
498 |
+
.ui-icon-alert { background-position: 0 -144px; }
|
499 |
+
.ui-icon-info { background-position: -16px -144px; }
|
500 |
+
.ui-icon-notice { background-position: -32px -144px; }
|
501 |
+
.ui-icon-help { background-position: -48px -144px; }
|
502 |
+
.ui-icon-check { background-position: -64px -144px; }
|
503 |
+
.ui-icon-bullet { background-position: -80px -144px; }
|
504 |
+
.ui-icon-radio-off { background-position: -96px -144px; }
|
505 |
+
.ui-icon-radio-on { background-position: -112px -144px; }
|
506 |
+
.ui-icon-pin-w { background-position: -128px -144px; }
|
507 |
+
.ui-icon-pin-s { background-position: -144px -144px; }
|
508 |
+
.ui-icon-play { background-position: 0 -160px; }
|
509 |
+
.ui-icon-pause { background-position: -16px -160px; }
|
510 |
+
.ui-icon-seek-next { background-position: -32px -160px; }
|
511 |
+
.ui-icon-seek-prev { background-position: -48px -160px; }
|
512 |
+
.ui-icon-seek-end { background-position: -64px -160px; }
|
513 |
+
.ui-icon-seek-start { background-position: -80px -160px; }
|
514 |
+
/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
|
515 |
+
.ui-icon-seek-first { background-position: -80px -160px; }
|
516 |
+
.ui-icon-stop { background-position: -96px -160px; }
|
517 |
+
.ui-icon-eject { background-position: -112px -160px; }
|
518 |
+
.ui-icon-volume-off { background-position: -128px -160px; }
|
519 |
+
.ui-icon-volume-on { background-position: -144px -160px; }
|
520 |
+
.ui-icon-power { background-position: 0 -176px; }
|
521 |
+
.ui-icon-signal-diag { background-position: -16px -176px; }
|
522 |
+
.ui-icon-signal { background-position: -32px -176px; }
|
523 |
+
.ui-icon-battery-0 { background-position: -48px -176px; }
|
524 |
+
.ui-icon-battery-1 { background-position: -64px -176px; }
|
525 |
+
.ui-icon-battery-2 { background-position: -80px -176px; }
|
526 |
+
.ui-icon-battery-3 { background-position: -96px -176px; }
|
527 |
+
.ui-icon-circle-plus { background-position: 0 -192px; }
|
528 |
+
.ui-icon-circle-minus { background-position: -16px -192px; }
|
529 |
+
.ui-icon-circle-close { background-position: -32px -192px; }
|
530 |
+
.ui-icon-circle-triangle-e { background-position: -48px -192px; }
|
531 |
+
.ui-icon-circle-triangle-s { background-position: -64px -192px; }
|
532 |
+
.ui-icon-circle-triangle-w { background-position: -80px -192px; }
|
533 |
+
.ui-icon-circle-triangle-n { background-position: -96px -192px; }
|
534 |
+
.ui-icon-circle-arrow-e { background-position: -112px -192px; }
|
535 |
+
.ui-icon-circle-arrow-s { background-position: -128px -192px; }
|
536 |
+
.ui-icon-circle-arrow-w { background-position: -144px -192px; }
|
537 |
+
.ui-icon-circle-arrow-n { background-position: -160px -192px; }
|
538 |
+
.ui-icon-circle-zoomin { background-position: -176px -192px; }
|
539 |
+
.ui-icon-circle-zoomout { background-position: -192px -192px; }
|
540 |
+
.ui-icon-circle-check { background-position: -208px -192px; }
|
541 |
+
.ui-icon-circlesmall-plus { background-position: 0 -208px; }
|
542 |
+
.ui-icon-circlesmall-minus { background-position: -16px -208px; }
|
543 |
+
.ui-icon-circlesmall-close { background-position: -32px -208px; }
|
544 |
+
.ui-icon-squaresmall-plus { background-position: -48px -208px; }
|
545 |
+
.ui-icon-squaresmall-minus { background-position: -64px -208px; }
|
546 |
+
.ui-icon-squaresmall-close { background-position: -80px -208px; }
|
547 |
+
.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
|
548 |
+
.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
|
549 |
+
.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
|
550 |
+
.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
|
551 |
+
.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
|
552 |
+
.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
|
553 |
+
|
554 |
+
|
555 |
+
/* Misc visuals
|
556 |
+
----------------------------------*/
|
557 |
+
|
558 |
+
/* Corner radius */
|
559 |
+
.ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 4px/*{cornerRadius}*/; -webkit-border-top-left-radius: 4px/*{cornerRadius}*/; -khtml-border-top-left-radius: 4px/*{cornerRadius}*/; border-top-left-radius: 4px/*{cornerRadius}*/; }
|
560 |
+
.ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 4px/*{cornerRadius}*/; -webkit-border-top-right-radius: 4px/*{cornerRadius}*/; -khtml-border-top-right-radius: 4px/*{cornerRadius}*/; border-top-right-radius: 4px/*{cornerRadius}*/; }
|
561 |
+
.ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 4px/*{cornerRadius}*/; -webkit-border-bottom-left-radius: 4px/*{cornerRadius}*/; -khtml-border-bottom-left-radius: 4px/*{cornerRadius}*/; border-bottom-left-radius: 4px/*{cornerRadius}*/; }
|
562 |
+
.ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 4px/*{cornerRadius}*/; -webkit-border-bottom-right-radius: 4px/*{cornerRadius}*/; -khtml-border-bottom-right-radius: 4px/*{cornerRadius}*/; border-bottom-right-radius: 4px/*{cornerRadius}*/; }
|
563 |
+
|
564 |
+
/* Overlays */
|
565 |
+
.ui-widget-overlay { background: #aaaaaa/*{bgColorOverlay}*/ url(images/ui-bg_flat_0_aaaaaa_40x100.png)/*{bgImgUrlOverlay}*/ 50%/*{bgOverlayXPos}*/ 50%/*{bgOverlayYPos}*/ repeat-x/*{bgOverlayRepeat}*/; opacity: .3;filter:Alpha(Opacity=30)/*{opacityOverlay}*/; }
|
566 |
.ui-widget-shadow { margin: -8px/*{offsetTopShadow}*/ 0 0 -8px/*{offsetLeftShadow}*/; padding: 8px/*{thicknessShadow}*/; background: #aaaaaa/*{bgColorShadow}*/ url(images/ui-bg_flat_0_aaaaaa_40x100.png)/*{bgImgUrlShadow}*/ 50%/*{bgShadowXPos}*/ 50%/*{bgShadowYPos}*/ repeat-x/*{bgShadowRepeat}*/; opacity: .3;filter:Alpha(Opacity=30)/*{opacityShadow}*/; -moz-border-radius: 8px/*{cornerRadiusShadow}*/; -khtml-border-radius: 8px/*{cornerRadiusShadow}*/; -webkit-border-radius: 8px/*{cornerRadiusShadow}*/; border-radius: 8px/*{cornerRadiusShadow}*/; }
|
inc/css/jquery.datetimepicker.css
CHANGED
@@ -1,418 +1,418 @@
|
|
1 |
-
.xdsoft_datetimepicker{
|
2 |
-
box-shadow: 0 5px 15px -5px rgba(0, 0, 0, 0.506);
|
3 |
-
background: #FFFFFF;
|
4 |
-
border-bottom: 1px solid #BBBBBB;
|
5 |
-
border-left: 1px solid #CCCCCC;
|
6 |
-
border-right: 1px solid #CCCCCC;
|
7 |
-
border-top: 1px solid #CCCCCC;
|
8 |
-
color: #333333;
|
9 |
-
font-family: "Helvetica Neue", "Helvetica", "Arial", sans-serif;
|
10 |
-
padding: 8px;
|
11 |
-
padding-left: 0;
|
12 |
-
padding-top: 2px;
|
13 |
-
position: absolute;
|
14 |
-
z-index: 9999;
|
15 |
-
-moz-box-sizing: border-box;
|
16 |
-
box-sizing: border-box;
|
17 |
-
display:none;
|
18 |
-
}
|
19 |
-
|
20 |
-
.xdsoft_datetimepicker iframe {
|
21 |
-
position: absolute;
|
22 |
-
left: 0;
|
23 |
-
top: 0;
|
24 |
-
width: 75px;
|
25 |
-
height: 210px;
|
26 |
-
background: transparent;
|
27 |
-
border:none;
|
28 |
-
}
|
29 |
-
/*For IE8 or lower*/
|
30 |
-
.xdsoft_datetimepicker button {
|
31 |
-
border:none !important;
|
32 |
-
}
|
33 |
-
|
34 |
-
.xdsoft_noselect{
|
35 |
-
-webkit-touch-callout: none;
|
36 |
-
-webkit-user-select: none;
|
37 |
-
-khtml-user-select: none;
|
38 |
-
-moz-user-select: none;
|
39 |
-
-ms-user-select: none;
|
40 |
-
-o-user-select: none;
|
41 |
-
user-select: none;
|
42 |
-
}
|
43 |
-
.xdsoft_noselect::selection { background: transparent; }
|
44 |
-
.xdsoft_noselect::-moz-selection { background: transparent; }
|
45 |
-
.xdsoft_datetimepicker.xdsoft_inline{
|
46 |
-
display: inline-block;
|
47 |
-
position: static;
|
48 |
-
box-shadow: none;
|
49 |
-
}
|
50 |
-
.xdsoft_datetimepicker *{
|
51 |
-
-moz-box-sizing: border-box;
|
52 |
-
box-sizing: border-box;
|
53 |
-
padding: 0;
|
54 |
-
margin: 0;
|
55 |
-
}
|
56 |
-
.xdsoft_datetimepicker .xdsoft_datepicker, .xdsoft_datetimepicker .xdsoft_timepicker{
|
57 |
-
display:none;
|
58 |
-
}
|
59 |
-
.xdsoft_datetimepicker .xdsoft_datepicker.active, .xdsoft_datetimepicker .xdsoft_timepicker.active{
|
60 |
-
display:block;
|
61 |
-
}
|
62 |
-
.xdsoft_datetimepicker .xdsoft_datepicker{
|
63 |
-
width: 224px;
|
64 |
-
float:left;
|
65 |
-
margin-left:8px;
|
66 |
-
}
|
67 |
-
.xdsoft_datetimepicker.xdsoft_showweeks .xdsoft_datepicker{
|
68 |
-
width: 256px;
|
69 |
-
}
|
70 |
-
.xdsoft_datetimepicker .xdsoft_timepicker{
|
71 |
-
width: 58px;
|
72 |
-
float:left;
|
73 |
-
text-align:center;
|
74 |
-
margin-left:8px;
|
75 |
-
margin-top: 0;
|
76 |
-
}
|
77 |
-
.xdsoft_datetimepicker .xdsoft_datepicker.active+.xdsoft_timepicker{
|
78 |
-
margin-top:8px;
|
79 |
-
margin-bottom:3px
|
80 |
-
}
|
81 |
-
.xdsoft_datetimepicker .xdsoft_mounthpicker{
|
82 |
-
position: relative;
|
83 |
-
text-align: center;
|
84 |
-
}
|
85 |
-
|
86 |
-
.xdsoft_datetimepicker .xdsoft_label i,
|
87 |
-
.xdsoft_datetimepicker .xdsoft_prev,
|
88 |
-
.xdsoft_datetimepicker .xdsoft_next,
|
89 |
-
.xdsoft_datetimepicker .xdsoft_today_button{
|
90 |
-
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAAeCAYAAADaW7vzAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6Q0NBRjI1NjM0M0UwMTFFNDk4NkFGMzJFQkQzQjEwRUIiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6Q0NBRjI1NjQ0M0UwMTFFNDk4NkFGMzJFQkQzQjEwRUIiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpDQ0FGMjU2MTQzRTAxMUU0OTg2QUYzMkVCRDNCMTBFQiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpDQ0FGMjU2MjQzRTAxMUU0OTg2QUYzMkVCRDNCMTBFQiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PoNEP54AAAIOSURBVHja7Jq9TsMwEMcxrZD4WpBYeKUCe+kTMCACHZh4BFfHO/AAIHZGFhYkBBsSEqxsLCAgXKhbXYOTxh9pfJVP+qutnZ5s/5Lz2Y5I03QhWji2GIcgAokWgfCxNvcOCCGKqiSqhUp0laHOne05vdEyGMfkdxJDVjgwDlEQgYQBgx+ULJaWSXXS6r/ER5FBVR8VfGftTKcITNs+a1XpcFoExREIDF14AVIFxgQUS+h520cdud6wNkC0UBw6BCO/HoCYwBhD8QCkQ/x1mwDyD4plh4D6DDV0TAGyo4HcawLIBBSLDkHeH0Mg2yVP3l4TQMZQDDsEOl/MgHQqhMNuE0D+oBh0CIr8MAKyazBH9WyBuKxDWgbXfjNf32TZ1KWm/Ap1oSk/R53UtQ5xTh3LUlMmT8gt6g51Q9p+SobxgJQ/qmsfZhWywGFSl0yBjCLJCMgXail3b7+rumdVJ2YRss4cN+r6qAHDkPWjPjdJCF4n9RmAD/V9A/Wp4NQassDjwlB6XBiCxcJQWmZZb8THFilfy/lfrTvLghq2TqTHrRMTKNJ0sIhdo15RT+RpyWwFdY96UZ/LdQKBGjcXpcc1AlSFEfLmouD+1knuxBDUVrvOBmoOC/rEcN7OQxKVeJTCiAdUzUJhA2Oez9QTkp72OTVcxDcXY8iKNkxGAJXmJCOQwOa6dhyXsOa6XwEGAKdeb5ET3rQdAAAAAElFTkSuQmCC);
|
91 |
-
}
|
92 |
-
|
93 |
-
.xdsoft_datetimepicker .xdsoft_label i{
|
94 |
-
opacity:0.5;
|
95 |
-
background-position:-92px -19px;
|
96 |
-
display: inline-block;
|
97 |
-
width: 9px;
|
98 |
-
height: 20px;
|
99 |
-
vertical-align: middle;
|
100 |
-
}
|
101 |
-
|
102 |
-
.xdsoft_datetimepicker .xdsoft_prev{
|
103 |
-
float: left;
|
104 |
-
background-position:-20px 0;
|
105 |
-
}
|
106 |
-
.xdsoft_datetimepicker .xdsoft_today_button{
|
107 |
-
float: left;
|
108 |
-
background-position:-70px 0;
|
109 |
-
margin-left:5px;
|
110 |
-
}
|
111 |
-
|
112 |
-
.xdsoft_datetimepicker .xdsoft_next{
|
113 |
-
float: right;
|
114 |
-
background-position: 0 0;
|
115 |
-
}
|
116 |
-
|
117 |
-
.xdsoft_datetimepicker .xdsoft_next,
|
118 |
-
.xdsoft_datetimepicker .xdsoft_prev ,
|
119 |
-
.xdsoft_datetimepicker .xdsoft_today_button{
|
120 |
-
background-color: transparent;
|
121 |
-
background-repeat: no-repeat;
|
122 |
-
border: 0 none currentColor;
|
123 |
-
cursor: pointer;
|
124 |
-
display: block;
|
125 |
-
height: 30px;
|
126 |
-
opacity: 0.5;
|
127 |
-
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
|
128 |
-
outline: medium none currentColor;
|
129 |
-
overflow: hidden;
|
130 |
-
padding: 0;
|
131 |
-
position: relative;
|
132 |
-
text-indent: 100%;
|
133 |
-
white-space: nowrap;
|
134 |
-
width: 20px;
|
135 |
-
}
|
136 |
-
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_prev,
|
137 |
-
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_next{
|
138 |
-
float:none;
|
139 |
-
background-position:-40px -15px;
|
140 |
-
height: 15px;
|
141 |
-
width: 30px;
|
142 |
-
display: block;
|
143 |
-
margin-left:14px;
|
144 |
-
margin-top:7px;
|
145 |
-
}
|
146 |
-
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_prev{
|
147 |
-
background-position:-40px 0;
|
148 |
-
margin-bottom:7px;
|
149 |
-
margin-top: 0;
|
150 |
-
}
|
151 |
-
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box{
|
152 |
-
height:151px;
|
153 |
-
overflow:hidden;
|
154 |
-
border-bottom:1px solid #DDDDDD;
|
155 |
-
}
|
156 |
-
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div >div{
|
157 |
-
background: #F5F5F5;
|
158 |
-
border-top:1px solid #DDDDDD;
|
159 |
-
color: #666666;
|
160 |
-
font-size: 12px;
|
161 |
-
text-align: center;
|
162 |
-
border-collapse:collapse;
|
163 |
-
cursor:pointer;
|
164 |
-
border-bottom-width: 0;
|
165 |
-
height:25px;
|
166 |
-
line-height:25px;
|
167 |
-
}
|
168 |
-
|
169 |
-
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div > div:first-child{
|
170 |
-
border-top-width: 0;
|
171 |
-
}
|
172 |
-
.xdsoft_datetimepicker .xdsoft_today_button:hover,
|
173 |
-
.xdsoft_datetimepicker .xdsoft_next:hover,
|
174 |
-
.xdsoft_datetimepicker .xdsoft_prev:hover {
|
175 |
-
opacity: 1;
|
176 |
-
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
|
177 |
-
}
|
178 |
-
.xdsoft_datetimepicker .xdsoft_label{
|
179 |
-
display: inline;
|
180 |
-
position: relative;
|
181 |
-
z-index: 9999;
|
182 |
-
margin: 0;
|
183 |
-
padding: 5px 3px;
|
184 |
-
font-size: 14px;
|
185 |
-
line-height: 20px;
|
186 |
-
font-weight: bold;
|
187 |
-
background-color: #fff;
|
188 |
-
float:left;
|
189 |
-
width:182px;
|
190 |
-
text-align:center;
|
191 |
-
cursor:pointer;
|
192 |
-
}
|
193 |
-
.xdsoft_datetimepicker .xdsoft_label:hover>span{
|
194 |
-
text-decoration:underline;
|
195 |
-
}
|
196 |
-
.xdsoft_datetimepicker .xdsoft_label:hover i{
|
197 |
-
opacity:1.0;
|
198 |
-
}
|
199 |
-
.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select{
|
200 |
-
border:1px solid #ccc;
|
201 |
-
position:absolute;
|
202 |
-
right: 0;
|
203 |
-
top:30px;
|
204 |
-
z-index:101;
|
205 |
-
display:none;
|
206 |
-
background:#fff;
|
207 |
-
max-height:160px;
|
208 |
-
overflow-y:hidden;
|
209 |
-
}
|
210 |
-
.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select.xdsoft_monthselect{right:-7px;}
|
211 |
-
.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select.xdsoft_yearselect{right:2px;}
|
212 |
-
.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select > div > .xdsoft_option:hover{
|
213 |
-
color: #fff;
|
214 |
-
background: #ff8000;
|
215 |
-
}
|
216 |
-
.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select > div > .xdsoft_option{
|
217 |
-
padding:2px 10px 2px 5px;
|
218 |
-
text-decoration:none !important;
|
219 |
-
}
|
220 |
-
.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select > div > .xdsoft_option.xdsoft_current{
|
221 |
-
background: #33AAFF;
|
222 |
-
box-shadow: #178FE5 0 1px 3px 0 inset;
|
223 |
-
color:#fff;
|
224 |
-
font-weight: 700;
|
225 |
-
}
|
226 |
-
.xdsoft_datetimepicker .xdsoft_month{
|
227 |
-
width:100px;
|
228 |
-
text-align:right;
|
229 |
-
}
|
230 |
-
.xdsoft_datetimepicker .xdsoft_calendar{
|
231 |
-
clear:both;
|
232 |
-
}
|
233 |
-
.xdsoft_datetimepicker .xdsoft_year{
|
234 |
-
width: 48px;
|
235 |
-
margin-left: 5px;
|
236 |
-
}
|
237 |
-
.xdsoft_datetimepicker .xdsoft_calendar table{
|
238 |
-
border-collapse:collapse;
|
239 |
-
width:100%;
|
240 |
-
|
241 |
-
}
|
242 |
-
.xdsoft_datetimepicker .xdsoft_calendar td > div{
|
243 |
-
padding-right:5px;
|
244 |
-
}
|
245 |
-
.xdsoft_datetimepicker .xdsoft_calendar th{
|
246 |
-
height: 25px;
|
247 |
-
}
|
248 |
-
.xdsoft_datetimepicker .xdsoft_calendar td,.xdsoft_datetimepicker .xdsoft_calendar th{
|
249 |
-
width:14.2857142%;
|
250 |
-
background: #F5F5F5;
|
251 |
-
border:1px solid #DDDDDD;
|
252 |
-
color: #666666;
|
253 |
-
font-size: 12px;
|
254 |
-
text-align: right;
|
255 |
-
vertical-align: middle;
|
256 |
-
padding: 0;
|
257 |
-
border-collapse:collapse;
|
258 |
-
cursor:pointer;
|
259 |
-
height: 25px;
|
260 |
-
}
|
261 |
-
.xdsoft_datetimepicker.xdsoft_showweeks .xdsoft_calendar td,.xdsoft_datetimepicker.xdsoft_showweeks .xdsoft_calendar th{
|
262 |
-
width:12.5%;
|
263 |
-
}
|
264 |
-
.xdsoft_datetimepicker .xdsoft_calendar th{
|
265 |
-
background: #F1F1F1;
|
266 |
-
}
|
267 |
-
.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_today{
|
268 |
-
color:#33AAFF;
|
269 |
-
}
|
270 |
-
.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_default,
|
271 |
-
.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_current,
|
272 |
-
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div >div.xdsoft_current{
|
273 |
-
background: #33AAFF;
|
274 |
-
box-shadow: #178FE5 0 1px 3px 0 inset;
|
275 |
-
color:#fff;
|
276 |
-
font-weight: 700;
|
277 |
-
}
|
278 |
-
.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_other_month,
|
279 |
-
.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_disabled,
|
280 |
-
.xdsoft_datetimepicker .xdsoft_time_box >div >div.xdsoft_disabled{
|
281 |
-
opacity:0.5;
|
282 |
-
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
|
283 |
-
}
|
284 |
-
.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_other_month.xdsoft_disabled{
|
285 |
-
opacity:0.2;
|
286 |
-
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=20)";
|
287 |
-
}
|
288 |
-
.xdsoft_datetimepicker .xdsoft_calendar td:hover,
|
289 |
-
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div >div:hover{
|
290 |
-
color: #fff !important;
|
291 |
-
background: #ff8000 !important;
|
292 |
-
box-shadow: none !important;
|
293 |
-
}
|
294 |
-
.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_disabled:hover,
|
295 |
-
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div >div.xdsoft_disabled:hover{
|
296 |
-
color: inherit !important;
|
297 |
-
background: inherit !important;
|
298 |
-
box-shadow: inherit !important;
|
299 |
-
}
|
300 |
-
.xdsoft_datetimepicker .xdsoft_calendar th{
|
301 |
-
font-weight: 700;
|
302 |
-
text-align: center;
|
303 |
-
color: #999;
|
304 |
-
cursor:default;
|
305 |
-
}
|
306 |
-
.xdsoft_datetimepicker .xdsoft_copyright{ color:#ccc !important; font-size:10px;clear:both;float:none;margin-left:8px;}
|
307 |
-
.xdsoft_datetimepicker .xdsoft_copyright a{ color:#eee !important;}
|
308 |
-
.xdsoft_datetimepicker .xdsoft_copyright a:hover{ color:#aaa !important;}
|
309 |
-
|
310 |
-
|
311 |
-
.xdsoft_time_box{
|
312 |
-
position:relative;
|
313 |
-
border:1px solid #ccc;
|
314 |
-
}
|
315 |
-
.xdsoft_scrollbar >.xdsoft_scroller{
|
316 |
-
background:#ccc !important;
|
317 |
-
height:20px;
|
318 |
-
border-radius:3px;
|
319 |
-
}
|
320 |
-
.xdsoft_scrollbar{
|
321 |
-
position:absolute;
|
322 |
-
width:7px;
|
323 |
-
right: 0;
|
324 |
-
top: 0;
|
325 |
-
bottom: 0;
|
326 |
-
cursor:pointer;
|
327 |
-
}
|
328 |
-
.xdsoft_scroller_box{
|
329 |
-
position:relative;
|
330 |
-
}
|
331 |
-
|
332 |
-
|
333 |
-
.xdsoft_datetimepicker.xdsoft_dark{
|
334 |
-
box-shadow: 0 5px 15px -5px rgba(255, 255, 255, 0.506);
|
335 |
-
background: #000000;
|
336 |
-
border-bottom: 1px solid #444444;
|
337 |
-
border-left: 1px solid #333333;
|
338 |
-
border-right: 1px solid #333333;
|
339 |
-
border-top: 1px solid #333333;
|
340 |
-
color: #cccccc;
|
341 |
-
}
|
342 |
-
|
343 |
-
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_timepicker .xdsoft_time_box{
|
344 |
-
border-bottom:1px solid #222222;
|
345 |
-
}
|
346 |
-
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_timepicker .xdsoft_time_box >div >div{
|
347 |
-
background: #0a0a0a;
|
348 |
-
border-top:1px solid #222222;
|
349 |
-
color: #999999;
|
350 |
-
}
|
351 |
-
|
352 |
-
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_label{
|
353 |
-
background-color: #000;
|
354 |
-
}
|
355 |
-
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_label > .xdsoft_select{
|
356 |
-
border:1px solid #333;
|
357 |
-
background:#000;
|
358 |
-
}
|
359 |
-
|
360 |
-
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_label > .xdsoft_select > div > .xdsoft_option:hover{
|
361 |
-
color: #000;
|
362 |
-
background: #007fff;
|
363 |
-
}
|
364 |
-
|
365 |
-
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_label > .xdsoft_select > div > .xdsoft_option.xdsoft_current{
|
366 |
-
background: #cc5500;
|
367 |
-
box-shadow: #b03e00 0 1px 3px 0 inset;
|
368 |
-
color:#000;
|
369 |
-
}
|
370 |
-
|
371 |
-
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_label i,
|
372 |
-
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_prev,
|
373 |
-
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_next,
|
374 |
-
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_today_button{
|
375 |
-
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAAeCAYAAADaW7vzAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QUExQUUzOTA0M0UyMTFFNDlBM0FFQTJENTExRDVBODYiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QUExQUUzOTE0M0UyMTFFNDlBM0FFQTJENTExRDVBODYiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpBQTFBRTM4RTQzRTIxMUU0OUEzQUVBMkQ1MTFENUE4NiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpBQTFBRTM4RjQzRTIxMUU0OUEzQUVBMkQ1MTFENUE4NiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pp0VxGEAAAIASURBVHja7JrNSgMxEMebtgh+3MSLr1T1Xn2CHoSKB08+QmR8Bx9A8e7RixdB9CKCoNdexIugxFlJa7rNZneTbLIpM/CnNLsdMvNjM8l0mRCiQ9Ye61IKCAgZAUnH+mU3MMZaHYChBnJUDzWOFZdVfc5+ZFLbrWDeXPwbxIqrLLfaeS0hEBVGIRQCEiZoHQwtlGSByCCdYBl8g8egTTAWoKQMRBRBcZxYlhzhKegqMOageErsCHVkk3hXIFooDgHB1KkHIHVgzKB4ADJQ/A1jAFmAYhkQqA5TOBtocrKrgXwQA8gcFIuAIO8sQSA7hidvPwaQGZSaAYHOUWJABhWWw2EMIH9QagQERU4SArJXo0ZZL18uvaxejXt/Em8xjVBXmvFr1KVm/AJ10tRe2XnraNqaJvKE3KHuUbfK1E+VHB0q40/y3sdQSxY4FHWeKJCunP8UyDdqJZenT3ntVV5jIYCAh20vT7ioP8tpf6E2lfEMwERe+whV1MHjwZB7PBiCxcGQWwKZKD62lfGNnP/1poFAA60T7rF1UgcKd2id3KDeUS+oLWV8DfWAepOfq00CgQabi9zjcgJVYVD7PVzQUAUGAQkbNJTBICDhgwYTjDYD6XeW08ZKh+A4pYkzenOxXUbvZcWz7E8ykRMnIHGX1XPl+1m2vPYpL+2qdb8CDAARlKFEz/ZVkAAAAABJRU5ErkJggg==);
|
376 |
-
}
|
377 |
-
|
378 |
-
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td,
|
379 |
-
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar th{
|
380 |
-
background: #0a0a0a;
|
381 |
-
border:1px solid #222222;
|
382 |
-
color: #999999;
|
383 |
-
}
|
384 |
-
|
385 |
-
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar th{
|
386 |
-
background: #0e0e0e;
|
387 |
-
}
|
388 |
-
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td.xdsoft_today{
|
389 |
-
color:#cc5500;
|
390 |
-
}
|
391 |
-
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td.xdsoft_default,
|
392 |
-
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td.xdsoft_current,
|
393 |
-
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_timepicker .xdsoft_time_box >div >div.xdsoft_current{
|
394 |
-
background: #cc5500;
|
395 |
-
box-shadow: #b03e00 0 1px 3px 0 inset;
|
396 |
-
color:#000;
|
397 |
-
}
|
398 |
-
|
399 |
-
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td:hover,
|
400 |
-
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_timepicker .xdsoft_time_box >div >div:hover{
|
401 |
-
color: #000 !important;
|
402 |
-
background: #007fff !important;
|
403 |
-
}
|
404 |
-
|
405 |
-
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar th{
|
406 |
-
color: #666;
|
407 |
-
}
|
408 |
-
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_copyright{ color:#333 !important;}
|
409 |
-
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_copyright a{ color:#111 !important;}
|
410 |
-
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_copyright a:hover{ color:#555 !important;}
|
411 |
-
|
412 |
-
|
413 |
-
.xdsoft_dark .xdsoft_time_box{
|
414 |
-
border:1px solid #333;
|
415 |
-
}
|
416 |
-
.xdsoft_dark .xdsoft_scrollbar >.xdsoft_scroller{
|
417 |
-
background:#333 !important;
|
418 |
-
}
|
1 |
+
.xdsoft_datetimepicker{
|
2 |
+
box-shadow: 0 5px 15px -5px rgba(0, 0, 0, 0.506);
|
3 |
+
background: #FFFFFF;
|
4 |
+
border-bottom: 1px solid #BBBBBB;
|
5 |
+
border-left: 1px solid #CCCCCC;
|
6 |
+
border-right: 1px solid #CCCCCC;
|
7 |
+
border-top: 1px solid #CCCCCC;
|
8 |
+
color: #333333;
|
9 |
+
font-family: "Helvetica Neue", "Helvetica", "Arial", sans-serif;
|
10 |
+
padding: 8px;
|
11 |
+
padding-left: 0;
|
12 |
+
padding-top: 2px;
|
13 |
+
position: absolute;
|
14 |
+
z-index: 9999;
|
15 |
+
-moz-box-sizing: border-box;
|
16 |
+
box-sizing: border-box;
|
17 |
+
display:none;
|
18 |
+
}
|
19 |
+
|
20 |
+
.xdsoft_datetimepicker iframe {
|
21 |
+
position: absolute;
|
22 |
+
left: 0;
|
23 |
+
top: 0;
|
24 |
+
width: 75px;
|
25 |
+
height: 210px;
|
26 |
+
background: transparent;
|
27 |
+
border:none;
|
28 |
+
}
|
29 |
+
/*For IE8 or lower*/
|
30 |
+
.xdsoft_datetimepicker button {
|
31 |
+
border:none !important;
|
32 |
+
}
|
33 |
+
|
34 |
+
.xdsoft_noselect{
|
35 |
+
-webkit-touch-callout: none;
|
36 |
+
-webkit-user-select: none;
|
37 |
+
-khtml-user-select: none;
|
38 |
+
-moz-user-select: none;
|
39 |
+
-ms-user-select: none;
|
40 |
+
-o-user-select: none;
|
41 |
+
user-select: none;
|
42 |
+
}
|
43 |
+
.xdsoft_noselect::selection { background: transparent; }
|
44 |
+
.xdsoft_noselect::-moz-selection { background: transparent; }
|
45 |
+
.xdsoft_datetimepicker.xdsoft_inline{
|
46 |
+
display: inline-block;
|
47 |
+
position: static;
|
48 |
+
box-shadow: none;
|
49 |
+
}
|
50 |
+
.xdsoft_datetimepicker *{
|
51 |
+
-moz-box-sizing: border-box;
|
52 |
+
box-sizing: border-box;
|
53 |
+
padding: 0;
|
54 |
+
margin: 0;
|
55 |
+
}
|
56 |
+
.xdsoft_datetimepicker .xdsoft_datepicker, .xdsoft_datetimepicker .xdsoft_timepicker{
|
57 |
+
display:none;
|
58 |
+
}
|
59 |
+
.xdsoft_datetimepicker .xdsoft_datepicker.active, .xdsoft_datetimepicker .xdsoft_timepicker.active{
|
60 |
+
display:block;
|
61 |
+
}
|
62 |
+
.xdsoft_datetimepicker .xdsoft_datepicker{
|
63 |
+
width: 224px;
|
64 |
+
float:left;
|
65 |
+
margin-left:8px;
|
66 |
+
}
|
67 |
+
.xdsoft_datetimepicker.xdsoft_showweeks .xdsoft_datepicker{
|
68 |
+
width: 256px;
|
69 |
+
}
|
70 |
+
.xdsoft_datetimepicker .xdsoft_timepicker{
|
71 |
+
width: 58px;
|
72 |
+
float:left;
|
73 |
+
text-align:center;
|
74 |
+
margin-left:8px;
|
75 |
+
margin-top: 0;
|
76 |
+
}
|
77 |
+
.xdsoft_datetimepicker .xdsoft_datepicker.active+.xdsoft_timepicker{
|
78 |
+
margin-top:8px;
|
79 |
+
margin-bottom:3px
|
80 |
+
}
|
81 |
+
.xdsoft_datetimepicker .xdsoft_mounthpicker{
|
82 |
+
position: relative;
|
83 |
+
text-align: center;
|
84 |
+
}
|
85 |
+
|
86 |
+
.xdsoft_datetimepicker .xdsoft_label i,
|
87 |
+
.xdsoft_datetimepicker .xdsoft_prev,
|
88 |
+
.xdsoft_datetimepicker .xdsoft_next,
|
89 |
+
.xdsoft_datetimepicker .xdsoft_today_button{
|
90 |
+
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAAeCAYAAADaW7vzAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6Q0NBRjI1NjM0M0UwMTFFNDk4NkFGMzJFQkQzQjEwRUIiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6Q0NBRjI1NjQ0M0UwMTFFNDk4NkFGMzJFQkQzQjEwRUIiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpDQ0FGMjU2MTQzRTAxMUU0OTg2QUYzMkVCRDNCMTBFQiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpDQ0FGMjU2MjQzRTAxMUU0OTg2QUYzMkVCRDNCMTBFQiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PoNEP54AAAIOSURBVHja7Jq9TsMwEMcxrZD4WpBYeKUCe+kTMCACHZh4BFfHO/AAIHZGFhYkBBsSEqxsLCAgXKhbXYOTxh9pfJVP+qutnZ5s/5Lz2Y5I03QhWji2GIcgAokWgfCxNvcOCCGKqiSqhUp0laHOne05vdEyGMfkdxJDVjgwDlEQgYQBgx+ULJaWSXXS6r/ER5FBVR8VfGftTKcITNs+a1XpcFoExREIDF14AVIFxgQUS+h520cdud6wNkC0UBw6BCO/HoCYwBhD8QCkQ/x1mwDyD4plh4D6DDV0TAGyo4HcawLIBBSLDkHeH0Mg2yVP3l4TQMZQDDsEOl/MgHQqhMNuE0D+oBh0CIr8MAKyazBH9WyBuKxDWgbXfjNf32TZ1KWm/Ap1oSk/R53UtQ5xTh3LUlMmT8gt6g51Q9p+SobxgJQ/qmsfZhWywGFSl0yBjCLJCMgXail3b7+rumdVJ2YRss4cN+r6qAHDkPWjPjdJCF4n9RmAD/V9A/Wp4NQassDjwlB6XBiCxcJQWmZZb8THFilfy/lfrTvLghq2TqTHrRMTKNJ0sIhdo15RT+RpyWwFdY96UZ/LdQKBGjcXpcc1AlSFEfLmouD+1knuxBDUVrvOBmoOC/rEcN7OQxKVeJTCiAdUzUJhA2Oez9QTkp72OTVcxDcXY8iKNkxGAJXmJCOQwOa6dhyXsOa6XwEGAKdeb5ET3rQdAAAAAElFTkSuQmCC);
|
91 |
+
}
|
92 |
+
|
93 |
+
.xdsoft_datetimepicker .xdsoft_label i{
|
94 |
+
opacity:0.5;
|
95 |
+
background-position:-92px -19px;
|
96 |
+
display: inline-block;
|
97 |
+
width: 9px;
|
98 |
+
height: 20px;
|
99 |
+
vertical-align: middle;
|
100 |
+
}
|
101 |
+
|
102 |
+
.xdsoft_datetimepicker .xdsoft_prev{
|
103 |
+
float: left;
|
104 |
+
background-position:-20px 0;
|
105 |
+
}
|
106 |
+
.xdsoft_datetimepicker .xdsoft_today_button{
|
107 |
+
float: left;
|
108 |
+
background-position:-70px 0;
|
109 |
+
margin-left:5px;
|
110 |
+
}
|
111 |
+
|
112 |
+
.xdsoft_datetimepicker .xdsoft_next{
|
113 |
+
float: right;
|
114 |
+
background-position: 0 0;
|
115 |
+
}
|
116 |
+
|
117 |
+
.xdsoft_datetimepicker .xdsoft_next,
|
118 |
+
.xdsoft_datetimepicker .xdsoft_prev ,
|
119 |
+
.xdsoft_datetimepicker .xdsoft_today_button{
|
120 |
+
background-color: transparent;
|
121 |
+
background-repeat: no-repeat;
|
122 |
+
border: 0 none currentColor;
|
123 |
+
cursor: pointer;
|
124 |
+
display: block;
|
125 |
+
height: 30px;
|
126 |
+
opacity: 0.5;
|
127 |
+
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
|
128 |
+
outline: medium none currentColor;
|
129 |
+
overflow: hidden;
|
130 |
+
padding: 0;
|
131 |
+
position: relative;
|
132 |
+
text-indent: 100%;
|
133 |
+
white-space: nowrap;
|
134 |
+
width: 20px;
|
135 |
+
}
|
136 |
+
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_prev,
|
137 |
+
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_next{
|
138 |
+
float:none;
|
139 |
+
background-position:-40px -15px;
|
140 |
+
height: 15px;
|
141 |
+
width: 30px;
|
142 |
+
display: block;
|
143 |
+
margin-left:14px;
|
144 |
+
margin-top:7px;
|
145 |
+
}
|
146 |
+
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_prev{
|
147 |
+
background-position:-40px 0;
|
148 |
+
margin-bottom:7px;
|
149 |
+
margin-top: 0;
|
150 |
+
}
|
151 |
+
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box{
|
152 |
+
height:151px;
|
153 |
+
overflow:hidden;
|
154 |
+
border-bottom:1px solid #DDDDDD;
|
155 |
+
}
|
156 |
+
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div >div{
|
157 |
+
background: #F5F5F5;
|
158 |
+
border-top:1px solid #DDDDDD;
|
159 |
+
color: #666666;
|
160 |
+
font-size: 12px;
|
161 |
+
text-align: center;
|
162 |
+
border-collapse:collapse;
|
163 |
+
cursor:pointer;
|
164 |
+
border-bottom-width: 0;
|
165 |
+
height:25px;
|
166 |
+
line-height:25px;
|
167 |
+
}
|
168 |
+
|
169 |
+
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div > div:first-child{
|
170 |
+
border-top-width: 0;
|
171 |
+
}
|
172 |
+
.xdsoft_datetimepicker .xdsoft_today_button:hover,
|
173 |
+
.xdsoft_datetimepicker .xdsoft_next:hover,
|
174 |
+
.xdsoft_datetimepicker .xdsoft_prev:hover {
|
175 |
+
opacity: 1;
|
176 |
+
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
|
177 |
+
}
|
178 |
+
.xdsoft_datetimepicker .xdsoft_label{
|
179 |
+
display: inline;
|
180 |
+
position: relative;
|
181 |
+
z-index: 9999;
|
182 |
+
margin: 0;
|
183 |
+
padding: 5px 3px;
|
184 |
+
font-size: 14px;
|
185 |
+
line-height: 20px;
|
186 |
+
font-weight: bold;
|
187 |
+
background-color: #fff;
|
188 |
+
float:left;
|
189 |
+
width:182px;
|
190 |
+
text-align:center;
|
191 |
+
cursor:pointer;
|
192 |
+
}
|
193 |
+
.xdsoft_datetimepicker .xdsoft_label:hover>span{
|
194 |
+
text-decoration:underline;
|
195 |
+
}
|
196 |
+
.xdsoft_datetimepicker .xdsoft_label:hover i{
|
197 |
+
opacity:1.0;
|
198 |
+
}
|
199 |
+
.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select{
|
200 |
+
border:1px solid #ccc;
|
201 |
+
position:absolute;
|
202 |
+
right: 0;
|
203 |
+
top:30px;
|
204 |
+
z-index:101;
|
205 |
+
display:none;
|
206 |
+
background:#fff;
|
207 |
+
max-height:160px;
|
208 |
+
overflow-y:hidden;
|
209 |
+
}
|
210 |
+
.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select.xdsoft_monthselect{right:-7px;}
|
211 |
+
.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select.xdsoft_yearselect{right:2px;}
|
212 |
+
.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select > div > .xdsoft_option:hover{
|
213 |
+
color: #fff;
|
214 |
+
background: #ff8000;
|
215 |
+
}
|
216 |
+
.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select > div > .xdsoft_option{
|
217 |
+
padding:2px 10px 2px 5px;
|
218 |
+
text-decoration:none !important;
|
219 |
+
}
|
220 |
+
.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select > div > .xdsoft_option.xdsoft_current{
|
221 |
+
background: #33AAFF;
|
222 |
+
box-shadow: #178FE5 0 1px 3px 0 inset;
|
223 |
+
color:#fff;
|
224 |
+
font-weight: 700;
|
225 |
+
}
|
226 |
+
.xdsoft_datetimepicker .xdsoft_month{
|
227 |
+
width:100px;
|
228 |
+
text-align:right;
|
229 |
+
}
|
230 |
+
.xdsoft_datetimepicker .xdsoft_calendar{
|
231 |
+
clear:both;
|
232 |
+
}
|
233 |
+
.xdsoft_datetimepicker .xdsoft_year{
|
234 |
+
width: 48px;
|
235 |
+
margin-left: 5px;
|
236 |
+
}
|
237 |
+
.xdsoft_datetimepicker .xdsoft_calendar table{
|
238 |
+
border-collapse:collapse;
|
239 |
+
width:100%;
|
240 |
+
|
241 |
+
}
|
242 |
+
.xdsoft_datetimepicker .xdsoft_calendar td > div{
|
243 |
+
padding-right:5px;
|
244 |
+
}
|
245 |
+
.xdsoft_datetimepicker .xdsoft_calendar th{
|
246 |
+
height: 25px;
|
247 |
+
}
|
248 |
+
.xdsoft_datetimepicker .xdsoft_calendar td,.xdsoft_datetimepicker .xdsoft_calendar th{
|
249 |
+
width:14.2857142%;
|
250 |
+
background: #F5F5F5;
|
251 |
+
border:1px solid #DDDDDD;
|
252 |
+
color: #666666;
|
253 |
+
font-size: 12px;
|
254 |
+
text-align: right;
|
255 |
+
vertical-align: middle;
|
256 |
+
padding: 0;
|
257 |
+
border-collapse:collapse;
|
258 |
+
cursor:pointer;
|
259 |
+
height: 25px;
|
260 |
+
}
|
261 |
+
.xdsoft_datetimepicker.xdsoft_showweeks .xdsoft_calendar td,.xdsoft_datetimepicker.xdsoft_showweeks .xdsoft_calendar th{
|
262 |
+
width:12.5%;
|
263 |
+
}
|
264 |
+
.xdsoft_datetimepicker .xdsoft_calendar th{
|
265 |
+
background: #F1F1F1;
|
266 |
+
}
|
267 |
+
.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_today{
|
268 |
+
color:#33AAFF;
|
269 |
+
}
|
270 |
+
.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_default,
|
271 |
+
.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_current,
|
272 |
+
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div >div.xdsoft_current{
|
273 |
+
background: #33AAFF;
|
274 |
+
box-shadow: #178FE5 0 1px 3px 0 inset;
|
275 |
+
color:#fff;
|
276 |
+
font-weight: 700;
|
277 |
+
}
|
278 |
+
.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_other_month,
|
279 |
+
.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_disabled,
|
280 |
+
.xdsoft_datetimepicker .xdsoft_time_box >div >div.xdsoft_disabled{
|
281 |
+
opacity:0.5;
|
282 |
+
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
|
283 |
+
}
|
284 |
+
.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_other_month.xdsoft_disabled{
|
285 |
+
opacity:0.2;
|
286 |
+
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=20)";
|
287 |
+
}
|
288 |
+
.xdsoft_datetimepicker .xdsoft_calendar td:hover,
|
289 |
+
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div >div:hover{
|
290 |
+
color: #fff !important;
|
291 |
+
background: #ff8000 !important;
|
292 |
+
box-shadow: none !important;
|
293 |
+
}
|
294 |
+
.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_disabled:hover,
|
295 |
+
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div >div.xdsoft_disabled:hover{
|
296 |
+
color: inherit !important;
|
297 |
+
background: inherit !important;
|
298 |
+
box-shadow: inherit !important;
|
299 |
+
}
|
300 |
+
.xdsoft_datetimepicker .xdsoft_calendar th{
|
301 |
+
font-weight: 700;
|
302 |
+
text-align: center;
|
303 |
+
color: #999;
|
304 |
+
cursor:default;
|
305 |
+
}
|
306 |
+
.xdsoft_datetimepicker .xdsoft_copyright{ color:#ccc !important; font-size:10px;clear:both;float:none;margin-left:8px;}
|
307 |
+
.xdsoft_datetimepicker .xdsoft_copyright a{ color:#eee !important;}
|
308 |
+
.xdsoft_datetimepicker .xdsoft_copyright a:hover{ color:#aaa !important;}
|
309 |
+
|
310 |
+
|
311 |
+
.xdsoft_time_box{
|
312 |
+
position:relative;
|
313 |
+
border:1px solid #ccc;
|
314 |
+
}
|
315 |
+
.xdsoft_scrollbar >.xdsoft_scroller{
|
316 |
+
background:#ccc !important;
|
317 |
+
height:20px;
|
318 |
+
border-radius:3px;
|
319 |
+
}
|
320 |
+
.xdsoft_scrollbar{
|
321 |
+
position:absolute;
|
322 |
+
width:7px;
|
323 |
+
right: 0;
|
324 |
+
top: 0;
|
325 |
+
bottom: 0;
|
326 |
+
cursor:pointer;
|
327 |
+
}
|
328 |
+
.xdsoft_scroller_box{
|
329 |
+
position:relative;
|
330 |
+
}
|
331 |
+
|
332 |
+
|
333 |
+
.xdsoft_datetimepicker.xdsoft_dark{
|
334 |
+
box-shadow: 0 5px 15px -5px rgba(255, 255, 255, 0.506);
|
335 |
+
background: #000000;
|
336 |
+
border-bottom: 1px solid #444444;
|
337 |
+
border-left: 1px solid #333333;
|
338 |
+
border-right: 1px solid #333333;
|
339 |
+
border-top: 1px solid #333333;
|
340 |
+
color: #cccccc;
|
341 |
+
}
|
342 |
+
|
343 |
+
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_timepicker .xdsoft_time_box{
|
344 |
+
border-bottom:1px solid #222222;
|
345 |
+
}
|
346 |
+
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_timepicker .xdsoft_time_box >div >div{
|
347 |
+
background: #0a0a0a;
|
348 |
+
border-top:1px solid #222222;
|
349 |
+
color: #999999;
|
350 |
+
}
|
351 |
+
|
352 |
+
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_label{
|
353 |
+
background-color: #000;
|
354 |
+
}
|
355 |
+
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_label > .xdsoft_select{
|
356 |
+
border:1px solid #333;
|
357 |
+
background:#000;
|
358 |
+
}
|
359 |
+
|
360 |
+
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_label > .xdsoft_select > div > .xdsoft_option:hover{
|
361 |
+
color: #000;
|
362 |
+
background: #007fff;
|
363 |
+
}
|
364 |
+
|
365 |
+
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_label > .xdsoft_select > div > .xdsoft_option.xdsoft_current{
|
366 |
+
background: #cc5500;
|
367 |
+
box-shadow: #b03e00 0 1px 3px 0 inset;
|
368 |
+
color:#000;
|
369 |
+
}
|
370 |
+
|
371 |
+
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_label i,
|
372 |
+
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_prev,
|
373 |
+
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_next,
|
374 |
+
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_today_button{
|
375 |
+
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAAeCAYAAADaW7vzAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QUExQUUzOTA0M0UyMTFFNDlBM0FFQTJENTExRDVBODYiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QUExQUUzOTE0M0UyMTFFNDlBM0FFQTJENTExRDVBODYiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpBQTFBRTM4RTQzRTIxMUU0OUEzQUVBMkQ1MTFENUE4NiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpBQTFBRTM4RjQzRTIxMUU0OUEzQUVBMkQ1MTFENUE4NiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pp0VxGEAAAIASURBVHja7JrNSgMxEMebtgh+3MSLr1T1Xn2CHoSKB08+QmR8Bx9A8e7RixdB9CKCoNdexIugxFlJa7rNZneTbLIpM/CnNLsdMvNjM8l0mRCiQ9Ye61IKCAgZAUnH+mU3MMZaHYChBnJUDzWOFZdVfc5+ZFLbrWDeXPwbxIqrLLfaeS0hEBVGIRQCEiZoHQwtlGSByCCdYBl8g8egTTAWoKQMRBRBcZxYlhzhKegqMOageErsCHVkk3hXIFooDgHB1KkHIHVgzKB4ADJQ/A1jAFmAYhkQqA5TOBtocrKrgXwQA8gcFIuAIO8sQSA7hidvPwaQGZSaAYHOUWJABhWWw2EMIH9QagQERU4SArJXo0ZZL18uvaxejXt/Em8xjVBXmvFr1KVm/AJ10tRe2XnraNqaJvKE3KHuUbfK1E+VHB0q40/y3sdQSxY4FHWeKJCunP8UyDdqJZenT3ntVV5jIYCAh20vT7ioP8tpf6E2lfEMwERe+whV1MHjwZB7PBiCxcGQWwKZKD62lfGNnP/1poFAA60T7rF1UgcKd2id3KDeUS+oLWV8DfWAepOfq00CgQabi9zjcgJVYVD7PVzQUAUGAQkbNJTBICDhgwYTjDYD6XeW08ZKh+A4pYkzenOxXUbvZcWz7E8ykRMnIHGX1XPl+1m2vPYpL+2qdb8CDAARlKFEz/ZVkAAAAABJRU5ErkJggg==);
|
376 |
+
}
|
377 |
+
|
378 |
+
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td,
|
379 |
+
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar th{
|
380 |
+
background: #0a0a0a;
|
381 |
+
border:1px solid #222222;
|
382 |
+
color: #999999;
|
383 |
+
}
|
384 |
+
|
385 |
+
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar th{
|
386 |
+
background: #0e0e0e;
|
387 |
+
}
|
388 |
+
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td.xdsoft_today{
|
389 |
+
color:#cc5500;
|
390 |
+
}
|
391 |
+
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td.xdsoft_default,
|
392 |
+
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td.xdsoft_current,
|
393 |
+
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_timepicker .xdsoft_time_box >div >div.xdsoft_current{
|
394 |
+
background: #cc5500;
|
395 |
+
box-shadow: #b03e00 0 1px 3px 0 inset;
|
396 |
+
color:#000;
|
397 |
+
}
|
398 |
+
|
399 |
+
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td:hover,
|
400 |
+
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_timepicker .xdsoft_time_box >div >div:hover{
|
401 |
+
color: #000 !important;
|
402 |
+
background: #007fff !important;
|
403 |
+
}
|
404 |
+
|
405 |
+
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar th{
|
406 |
+
color: #666;
|
407 |
+
}
|
408 |
+
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_copyright{ color:#333 !important;}
|
409 |
+
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_copyright a{ color:#111 !important;}
|
410 |
+
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_copyright a:hover{ color:#555 !important;}
|
411 |
+
|
412 |
+
|
413 |
+
.xdsoft_dark .xdsoft_time_box{
|
414 |
+
border:1px solid #333;
|
415 |
+
}
|
416 |
+
.xdsoft_dark .xdsoft_scrollbar >.xdsoft_scroller{
|
417 |
+
background:#333 !important;
|
418 |
+
}
|
inc/js/StackBlur.js
CHANGED
@@ -1,655 +1,655 @@
|
|
1 |
-
/*
|
2 |
-
|
3 |
-
StackBlur - a fast almost Gaussian Blur For Canvas
|
4 |
-
|
5 |
-
Version: 0.5
|
6 |
-
Author: Mario Klingemann
|
7 |
-
Contact: mario@quasimondo.com
|
8 |
-
Website: http://www.quasimondo.com/StackBlurForCanvas
|
9 |
-
Twitter: @quasimondo
|
10 |
-
|
11 |
-
In case you find this class useful - especially in commercial projects -
|
12 |
-
I am not totally unhappy for a small donation to my PayPal account
|
13 |
-
mario@quasimondo.de
|
14 |
-
|
15 |
-
Or support me on flattr:
|
16 |
-
https://flattr.com/thing/72791/StackBlur-a-fast-almost-Gaussian-Blur-Effect-for-CanvasJavascript
|
17 |
-
|
18 |
-
Copyright (c) 2010 Mario Klingemann
|
19 |
-
|
20 |
-
Permission is hereby granted, free of charge, to any person
|
21 |
-
obtaining a copy of this software and associated documentation
|
22 |
-
files (the "Software"), to deal in the Software without
|
23 |
-
restriction, including without limitation the rights to use,
|
24 |
-
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
25 |
-
copies of the Software, and to permit persons to whom the
|
26 |
-
Software is furnished to do so, subject to the following
|
27 |
-
conditions:
|
28 |
-
|
29 |
-
The above copyright notice and this permission notice shall be
|
30 |
-
included in all copies or substantial portions of the Software.
|
31 |
-
|
32 |
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
33 |
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
34 |
-
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
35 |
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
36 |
-
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
37 |
-
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
38 |
-
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
39 |
-
OTHER DEALINGS IN THE SOFTWARE.
|
40 |
-
*/
|
41 |
-
|
42 |
-
(function ( global ) {
|
43 |
-
|
44 |
-
var mul_table = [
|
45 |
-
512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,
|
46 |
-
454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,
|
47 |
-
482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,
|
48 |
-
437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,
|
49 |
-
497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,
|
50 |
-
320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,
|
51 |
-
446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,
|
52 |
-
329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,
|
53 |
-
505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,
|
54 |
-
399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,
|
55 |
-
324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,
|
56 |
-
268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,
|
57 |
-
451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,
|
58 |
-
385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,
|
59 |
-
332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,
|
60 |
-
289,287,285,282,280,278,275,273,271,269,267,265,263,261,259];
|
61 |
-
|
62 |
-
|
63 |
-
var shg_table = [
|
64 |
-
9, 11, 12, 13, 13, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17,
|
65 |
-
17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19,
|
66 |
-
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20,
|
67 |
-
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21,
|
68 |
-
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
|
69 |
-
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22,
|
70 |
-
22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
|
71 |
-
22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23,
|
72 |
-
23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
|
73 |
-
23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
|
74 |
-
23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
|
75 |
-
23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
76 |
-
24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
77 |
-
24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
78 |
-
24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
79 |
-
24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24 ];
|
80 |
-
|
81 |
-
function premultiplyAlpha(imageData)
|
82 |
-
{
|
83 |
-
var pixels = imageData.data;
|
84 |
-
var size = imageData.width * imageData.height * 4;
|
85 |
-
|
86 |
-
for (var i=0; i<size; i+=4)
|
87 |
-
{
|
88 |
-
var a = pixels[i+3] / 255;
|
89 |
-
pixels[i ] *= a;
|
90 |
-
pixels[i+1] *= a;
|
91 |
-
pixels[i+2] *= a;
|
92 |
-
}
|
93 |
-
}
|
94 |
-
|
95 |
-
function unpremultiplyAlpha(imageData)
|
96 |
-
{
|
97 |
-
var pixels = imageData.data;
|
98 |
-
var size = imageData.width * imageData.height * 4;
|
99 |
-
|
100 |
-
for (var i=0; i<size; i+=4)
|
101 |
-
{
|
102 |
-
var a = pixels[i+3];
|
103 |
-
if (a != 0)
|
104 |
-
{
|
105 |
-
a = 255 / a;
|
106 |
-
pixels[i ] *= a;
|
107 |
-
pixels[i+1] *= a;
|
108 |
-
pixels[i+2] *= a;
|
109 |
-
}
|
110 |
-
}
|
111 |
-
}
|
112 |
-
|
113 |
-
function stackBlurImage( imageID, canvasID, radius, blurAlphaChannel )
|
114 |
-
{
|
115 |
-
|
116 |
-
var img = document.getElementById( imageID );
|
117 |
-
var w = img.naturalWidth;
|
118 |
-
var h = img.naturalHeight;
|
119 |
-
|
120 |
-
var canvas = document.getElementById( canvasID );
|
121 |
-
|
122 |
-
canvas.style.width = w + "px";
|
123 |
-
canvas.style.height = h + "px";
|
124 |
-
canvas.width = w;
|
125 |
-
canvas.height = h;
|
126 |
-
|
127 |
-
var context = canvas.getContext("2d");
|
128 |
-
context.clearRect( 0, 0, w, h );
|
129 |
-
context.drawImage( img, 0, 0 );
|
130 |
-
|
131 |
-
if ( isNaN(radius) || radius < 1 ) return;
|
132 |
-
|
133 |
-
if ( blurAlphaChannel )
|
134 |
-
stackBlurCanvasRGBA( canvasID, 0, 0, w, h, radius );
|
135 |
-
else
|
136 |
-
stackBlurCanvasRGB( canvasID, 0, 0, w, h, radius );
|
137 |
-
}
|
138 |
-
|
139 |
-
|
140 |
-
function stackBlurCanvasRGBA( id, top_x, top_y, width, height, radius )
|
141 |
-
{
|
142 |
-
if ( isNaN(radius) || radius < 1 ) return;
|
143 |
-
radius |= 0;
|
144 |
-
|
145 |
-
var canvas = document.getElementById( id );
|
146 |
-
var context = canvas.getContext("2d");
|
147 |
-
var imageData;
|
148 |
-
|
149 |
-
try {
|
150 |
-
try {
|
151 |
-
imageData = context.getImageData( top_x, top_y, width, height );
|
152 |
-
} catch(e) {
|
153 |
-
|
154 |
-
// NOTE: this part is supposedly only needed if you want to work with local files
|
155 |
-
// so it might be okay to remove the whole try/catch block and just use
|
156 |
-
// imageData = context.getImageData( top_x, top_y, width, height );
|
157 |
-
try {
|
158 |
-
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
|
159 |
-
imageData = context.getImageData( top_x, top_y, width, height );
|
160 |
-
} catch(e) {
|
161 |
-
alert("Cannot access local image");
|
162 |
-
throw new Error("unable to access local image data: " + e);
|
163 |
-
return;
|
164 |
-
}
|
165 |
-
}
|
166 |
-
} catch(e) {
|
167 |
-
alert("Cannot access image");
|
168 |
-
throw new Error("unable to access image data: " + e);
|
169 |
-
}
|
170 |
-
|
171 |
-
premultiplyAlpha(imageData);
|
172 |
-
|
173 |
-
var pixels = imageData.data;
|
174 |
-
|
175 |
-
var x, y, i, p, yp, yi, yw, r_sum, g_sum, b_sum, a_sum,
|
176 |
-
r_out_sum, g_out_sum, b_out_sum, a_out_sum,
|
177 |
-
r_in_sum, g_in_sum, b_in_sum, a_in_sum,
|
178 |
-
pr, pg, pb, pa, rbs;
|
179 |
-
|
180 |
-
var div = radius + radius + 1;
|
181 |
-
var w4 = width << 2;
|
182 |
-
var widthMinus1 = width - 1;
|
183 |
-
var heightMinus1 = height - 1;
|
184 |
-
var radiusPlus1 = radius + 1;
|
185 |
-
var sumFactor = radiusPlus1 * ( radiusPlus1 + 1 ) / 2;
|
186 |
-
|
187 |
-
var stackStart = new BlurStack();
|
188 |
-
var stack = stackStart;
|
189 |
-
for ( i = 1; i < div; i++ )
|
190 |
-
{
|
191 |
-
stack = stack.next = new BlurStack();
|
192 |
-
if ( i == radiusPlus1 ) var stackEnd = stack;
|
193 |
-
}
|
194 |
-
stack.next = stackStart;
|
195 |
-
var stackIn = null;
|
196 |
-
var stackOut = null;
|
197 |
-
|
198 |
-
yw = yi = 0;
|
199 |
-
|
200 |
-
var mul_sum = mul_table[radius];
|
201 |
-
var shg_sum = shg_table[radius];
|
202 |
-
|
203 |
-
for ( y = 0; y < height; y++ )
|
204 |
-
{
|
205 |
-
r_in_sum = g_in_sum = b_in_sum = a_in_sum = r_sum = g_sum = b_sum = a_sum = 0;
|
206 |
-
|
207 |
-
r_out_sum = radiusPlus1 * ( pr = pixels[yi] );
|
208 |
-
g_out_sum = radiusPlus1 * ( pg = pixels[yi+1] );
|
209 |
-
b_out_sum = radiusPlus1 * ( pb = pixels[yi+2] );
|
210 |
-
a_out_sum = radiusPlus1 * ( pa = pixels[yi+3] );
|
211 |
-
|
212 |
-
r_sum += sumFactor * pr;
|
213 |
-
g_sum += sumFactor * pg;
|
214 |
-
b_sum += sumFactor * pb;
|
215 |
-
a_sum += sumFactor * pa;
|
216 |
-
|
217 |
-
stack = stackStart;
|
218 |
-
|
219 |
-
for( i = 0; i < radiusPlus1; i++ )
|
220 |
-
{
|
221 |
-
stack.r = pr;
|
222 |
-
stack.g = pg;
|
223 |
-
stack.b = pb;
|
224 |
-
stack.a = pa;
|
225 |
-
stack = stack.next;
|
226 |
-
}
|
227 |
-
|
228 |
-
for( i = 1; i < radiusPlus1; i++ )
|
229 |
-
{
|
230 |
-
p = yi + (( widthMinus1 < i ? widthMinus1 : i ) << 2 );
|
231 |
-
r_sum += ( stack.r = ( pr = pixels[p])) * ( rbs = radiusPlus1 - i );
|
232 |
-
g_sum += ( stack.g = ( pg = pixels[p+1])) * rbs;
|
233 |
-
b_sum += ( stack.b = ( pb = pixels[p+2])) * rbs;
|
234 |
-
a_sum += ( stack.a = ( pa = pixels[p+3])) * rbs;
|
235 |
-
|
236 |
-
r_in_sum += pr;
|
237 |
-
g_in_sum += pg;
|
238 |
-
b_in_sum += pb;
|
239 |
-
a_in_sum += pa;
|
240 |
-
|
241 |
-
stack = stack.next;
|
242 |
-
}
|
243 |
-
|
244 |
-
stackIn = stackStart;
|
245 |
-
stackOut = stackEnd;
|
246 |
-
for ( x = 0; x < width; x++ )
|
247 |
-
{
|
248 |
-
pixels[yi] = (r_sum * mul_sum) >> shg_sum;
|
249 |
-
pixels[yi+1] = (g_sum * mul_sum) >> shg_sum;
|
250 |
-
pixels[yi+2] = (b_sum * mul_sum) >> shg_sum;
|
251 |
-
pixels[yi+3] = (a_sum * mul_sum) >> shg_sum;
|
252 |
-
|
253 |
-
r_sum -= r_out_sum;
|
254 |
-
g_sum -= g_out_sum;
|
255 |
-
b_sum -= b_out_sum;
|
256 |
-
a_sum -= a_out_sum;
|
257 |
-
|
258 |
-
r_out_sum -= stackIn.r;
|
259 |
-
g_out_sum -= stackIn.g;
|
260 |
-
b_out_sum -= stackIn.b;
|
261 |
-
a_out_sum -= stackIn.a;
|
262 |
-
|
263 |
-
p = ( yw + ( ( p = x + radius + 1 ) < widthMinus1 ? p : widthMinus1 ) ) << 2;
|
264 |
-
|
265 |
-
r_in_sum += ( stackIn.r = pixels[p]);
|
266 |
-
g_in_sum += ( stackIn.g = pixels[p+1]);
|
267 |
-
b_in_sum += ( stackIn.b = pixels[p+2]);
|
268 |
-
a_in_sum += ( stackIn.a = pixels[p+3]);
|
269 |
-
|
270 |
-
r_sum += r_in_sum;
|
271 |
-
g_sum += g_in_sum;
|
272 |
-
b_sum += b_in_sum;
|
273 |
-
a_sum += a_in_sum;
|
274 |
-
|
275 |
-
stackIn = stackIn.next;
|
276 |
-
|
277 |
-
r_out_sum += ( pr = stackOut.r );
|
278 |
-
g_out_sum += ( pg = stackOut.g );
|
279 |
-
b_out_sum += ( pb = stackOut.b );
|
280 |
-
a_out_sum += ( pa = stackOut.a );
|
281 |
-
|
282 |
-
r_in_sum -= pr;
|
283 |
-
g_in_sum -= pg;
|
284 |
-
b_in_sum -= pb;
|
285 |
-
a_in_sum -= pa;
|
286 |
-
|
287 |
-
stackOut = stackOut.next;
|
288 |
-
|
289 |
-
yi += 4;
|
290 |
-
}
|
291 |
-
yw += width;
|
292 |
-
}
|
293 |
-
|
294 |
-
|
295 |
-
for ( x = 0; x < width; x++ )
|
296 |
-
{
|
297 |
-
g_in_sum = b_in_sum = a_in_sum = r_in_sum = g_sum = b_sum = a_sum = r_sum = 0;
|
298 |
-
|
299 |
-
yi = x << 2;
|
300 |
-
r_out_sum = radiusPlus1 * ( pr = pixels[yi]);
|
301 |
-
g_out_sum = radiusPlus1 * ( pg = pixels[yi+1]);
|
302 |
-
b_out_sum = radiusPlus1 * ( pb = pixels[yi+2]);
|
303 |
-
a_out_sum = radiusPlus1 * ( pa = pixels[yi+3]);
|
304 |
-
|
305 |
-
r_sum += sumFactor * pr;
|
306 |
-
g_sum += sumFactor * pg;
|
307 |
-
b_sum += sumFactor * pb;
|
308 |
-
a_sum += sumFactor * pa;
|
309 |
-
|
310 |
-
stack = stackStart;
|
311 |
-
|
312 |
-
for( i = 0; i < radiusPlus1; i++ )
|
313 |
-
{
|
314 |
-
stack.r = pr;
|
315 |
-
stack.g = pg;
|
316 |
-
stack.b = pb;
|
317 |
-
stack.a = pa;
|
318 |
-
stack = stack.next;
|
319 |
-
}
|
320 |
-
|
321 |
-
yp = width;
|
322 |
-
|
323 |
-
for( i = 1; i <= radius; i++ )
|
324 |
-
{
|
325 |
-
yi = ( yp + x ) << 2;
|
326 |
-
|
327 |
-
r_sum += ( stack.r = ( pr = pixels[yi])) * ( rbs = radiusPlus1 - i );
|
328 |
-
g_sum += ( stack.g = ( pg = pixels[yi+1])) * rbs;
|
329 |
-
b_sum += ( stack.b = ( pb = pixels[yi+2])) * rbs;
|
330 |
-
a_sum += ( stack.a = ( pa = pixels[yi+3])) * rbs;
|
331 |
-
|
332 |
-
r_in_sum += pr;
|
333 |
-
g_in_sum += pg;
|
334 |
-
b_in_sum += pb;
|
335 |
-
a_in_sum += pa;
|
336 |
-
|
337 |
-
stack = stack.next;
|
338 |
-
|
339 |
-
if( i < heightMinus1 )
|
340 |
-
{
|
341 |
-
yp += width;
|
342 |
-
}
|
343 |
-
}
|
344 |
-
|
345 |
-
yi = x;
|
346 |
-
stackIn = stackStart;
|
347 |
-
stackOut = stackEnd;
|
348 |
-
for ( y = 0; y < height; y++ )
|
349 |
-
{
|
350 |
-
p = yi << 2;
|
351 |
-
pixels[p] = (r_sum * mul_sum) >> shg_sum;
|
352 |
-
pixels[p+1] = (g_sum * mul_sum) >> shg_sum;
|
353 |
-
pixels[p+2] = (b_sum * mul_sum) >> shg_sum;
|
354 |
-
pixels[p+3] = (a_sum * mul_sum) >> shg_sum;
|
355 |
-
|
356 |
-
r_sum -= r_out_sum;
|
357 |
-
g_sum -= g_out_sum;
|
358 |
-
b_sum -= b_out_sum;
|
359 |
-
a_sum -= a_out_sum;
|
360 |
-
|
361 |
-
r_out_sum -= stackIn.r;
|
362 |
-
g_out_sum -= stackIn.g;
|
363 |
-
b_out_sum -= stackIn.b;
|
364 |
-
a_out_sum -= stackIn.a;
|
365 |
-
|
366 |
-
p = ( x + (( ( p = y + radiusPlus1) < heightMinus1 ? p : heightMinus1 ) * width )) << 2;
|
367 |
-
|
368 |
-
r_sum += ( r_in_sum += ( stackIn.r = pixels[p]));
|
369 |
-
g_sum += ( g_in_sum += ( stackIn.g = pixels[p+1]));
|
370 |
-
b_sum += ( b_in_sum += ( stackIn.b = pixels[p+2]));
|
371 |
-
a_sum += ( a_in_sum += ( stackIn.a = pixels[p+3]));
|
372 |
-
|
373 |
-
stackIn = stackIn.next;
|
374 |
-
|
375 |
-
r_out_sum += ( pr = stackOut.r );
|
376 |
-
g_out_sum += ( pg = stackOut.g );
|
377 |
-
b_out_sum += ( pb = stackOut.b );
|
378 |
-
a_out_sum += ( pa = stackOut.a );
|
379 |
-
|
380 |
-
r_in_sum -= pr;
|
381 |
-
g_in_sum -= pg;
|
382 |
-
b_in_sum -= pb;
|
383 |
-
a_in_sum -= pa;
|
384 |
-
|
385 |
-
stackOut = stackOut.next;
|
386 |
-
|
387 |
-
yi += width;
|
388 |
-
}
|
389 |
-
}
|
390 |
-
|
391 |
-
unpremultiplyAlpha(imageData);
|
392 |
-
|
393 |
-
context.putImageData( imageData, top_x, top_y );
|
394 |
-
}
|
395 |
-
|
396 |
-
|
397 |
-
function stackBlurCanvasRGB( id, top_x, top_y, width, height, radius )
|
398 |
-
{
|
399 |
-
if ( isNaN(radius) || radius < 1 ) return;
|
400 |
-
radius |= 0;
|
401 |
-
|
402 |
-
var canvas = document.getElementById( id );
|
403 |
-
var context = canvas.getContext("2d");
|
404 |
-
var imageData;
|
405 |
-
|
406 |
-
try {
|
407 |
-
try {
|
408 |
-
imageData = context.getImageData( top_x, top_y, width, height );
|
409 |
-
} catch(e) {
|
410 |
-
|
411 |
-
// NOTE: this part is supposedly only needed if you want to work with local files
|
412 |
-
// so it might be okay to remove the whole try/catch block and just use
|
413 |
-
// imageData = context.getImageData( top_x, top_y, width, height );
|
414 |
-
try {
|
415 |
-
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
|
416 |
-
imageData = context.getImageData( top_x, top_y, width, height );
|
417 |
-
} catch(e) {
|
418 |
-
alert("Cannot access local image");
|
419 |
-
throw new Error("unable to access local image data: " + e);
|
420 |
-
return;
|
421 |
-
}
|
422 |
-
}
|
423 |
-
} catch(e) {
|
424 |
-
alert("Cannot access image");
|
425 |
-
throw new Error("unable to access image data: " + e);
|
426 |
-
}
|
427 |
-
|
428 |
-
var pixels = imageData.data;
|
429 |
-
|
430 |
-
var x, y, i, p, yp, yi, yw, r_sum, g_sum, b_sum,
|
431 |
-
r_out_sum, g_out_sum, b_out_sum,
|
432 |
-
r_in_sum, g_in_sum, b_in_sum,
|
433 |
-
pr, pg, pb, rbs;
|
434 |
-
|
435 |
-
var div = radius + radius + 1;
|
436 |
-
var w4 = width << 2;
|
437 |
-
var widthMinus1 = width - 1;
|
438 |
-
var heightMinus1 = height - 1;
|
439 |
-
var radiusPlus1 = radius + 1;
|
440 |
-
var sumFactor = radiusPlus1 * ( radiusPlus1 + 1 ) / 2;
|
441 |
-
|
442 |
-
var stackStart = new BlurStack();
|
443 |
-
var stack = stackStart;
|
444 |
-
for ( i = 1; i < div; i++ )
|
445 |
-
{
|
446 |
-
stack = stack.next = new BlurStack();
|
447 |
-
if ( i == radiusPlus1 ) var stackEnd = stack;
|
448 |
-
}
|
449 |
-
stack.next = stackStart;
|
450 |
-
var stackIn = null;
|
451 |
-
var stackOut = null;
|
452 |
-
|
453 |
-
yw = yi = 0;
|
454 |
-
|
455 |
-
var mul_sum = mul_table[radius];
|
456 |
-
var shg_sum = shg_table[radius];
|
457 |
-
|
458 |
-
for ( y = 0; y < height; y++ )
|
459 |
-
{
|
460 |
-
r_in_sum = g_in_sum = b_in_sum = r_sum = g_sum = b_sum = 0;
|
461 |
-
|
462 |
-
r_out_sum = radiusPlus1 * ( pr = pixels[yi] );
|
463 |
-
g_out_sum = radiusPlus1 * ( pg = pixels[yi+1] );
|
464 |
-
b_out_sum = radiusPlus1 * ( pb = pixels[yi+2] );
|
465 |
-
|
466 |
-
r_sum += sumFactor * pr;
|
467 |
-
g_sum += sumFactor * pg;
|
468 |
-
b_sum += sumFactor * pb;
|
469 |
-
|
470 |
-
stack = stackStart;
|
471 |
-
|
472 |
-
for( i = 0; i < radiusPlus1; i++ )
|
473 |
-
{
|
474 |
-
stack.r = pr;
|
475 |
-
stack.g = pg;
|
476 |
-
stack.b = pb;
|
477 |
-
stack = stack.next;
|
478 |
-
}
|
479 |
-
|
480 |
-
for( i = 1; i < radiusPlus1; i++ )
|
481 |
-
{
|
482 |
-
p = yi + (( widthMinus1 < i ? widthMinus1 : i ) << 2 );
|
483 |
-
r_sum += ( stack.r = ( pr = pixels[p])) * ( rbs = radiusPlus1 - i );
|
484 |
-
g_sum += ( stack.g = ( pg = pixels[p+1])) * rbs;
|
485 |
-
b_sum += ( stack.b = ( pb = pixels[p+2])) * rbs;
|
486 |
-
|
487 |
-
r_in_sum += pr;
|
488 |
-
g_in_sum += pg;
|
489 |
-
b_in_sum += pb;
|
490 |
-
|
491 |
-
stack = stack.next;
|
492 |
-
}
|
493 |
-
|
494 |
-
|
495 |
-
stackIn = stackStart;
|
496 |
-
stackOut = stackEnd;
|
497 |
-
for ( x = 0; x < width; x++ )
|
498 |
-
{
|
499 |
-
pixels[yi] = (r_sum * mul_sum) >> shg_sum;
|
500 |
-
pixels[yi+1] = (g_sum * mul_sum) >> shg_sum;
|
501 |
-
pixels[yi+2] = (b_sum * mul_sum) >> shg_sum;
|
502 |
-
|
503 |
-
r_sum -= r_out_sum;
|
504 |
-
g_sum -= g_out_sum;
|
505 |
-
b_sum -= b_out_sum;
|
506 |
-
|
507 |
-
r_out_sum -= stackIn.r;
|
508 |
-
g_out_sum -= stackIn.g;
|
509 |
-
b_out_sum -= stackIn.b;
|
510 |
-
|
511 |
-
p = ( yw + ( ( p = x + radius + 1 ) < widthMinus1 ? p : widthMinus1 ) ) << 2;
|
512 |
-
|
513 |
-
r_in_sum += ( stackIn.r = pixels[p]);
|
514 |
-
g_in_sum += ( stackIn.g = pixels[p+1]);
|
515 |
-
b_in_sum += ( stackIn.b = pixels[p+2]);
|
516 |
-
|
517 |
-
r_sum += r_in_sum;
|
518 |
-
g_sum += g_in_sum;
|
519 |
-
b_sum += b_in_sum;
|
520 |
-
|
521 |
-
stackIn = stackIn.next;
|
522 |
-
|
523 |
-
r_out_sum += ( pr = stackOut.r );
|
524 |
-
g_out_sum += ( pg = stackOut.g );
|
525 |
-
b_out_sum += ( pb = stackOut.b );
|
526 |
-
|
527 |
-
r_in_sum -= pr;
|
528 |
-
g_in_sum -= pg;
|
529 |
-
b_in_sum -= pb;
|
530 |
-
|
531 |
-
stackOut = stackOut.next;
|
532 |
-
|
533 |
-
yi += 4;
|
534 |
-
}
|
535 |
-
yw += width;
|
536 |
-
}
|
537 |
-
|
538 |
-
|
539 |
-
for ( x = 0; x < width; x++ )
|
540 |
-
{
|
541 |
-
g_in_sum = b_in_sum = r_in_sum = g_sum = b_sum = r_sum = 0;
|
542 |
-
|
543 |
-
yi = x << 2;
|
544 |
-
r_out_sum = radiusPlus1 * ( pr = pixels[yi]);
|
545 |
-
g_out_sum = radiusPlus1 * ( pg = pixels[yi+1]);
|
546 |
-
b_out_sum = radiusPlus1 * ( pb = pixels[yi+2]);
|
547 |
-
|
548 |
-
r_sum += sumFactor * pr;
|
549 |
-
g_sum += sumFactor * pg;
|
550 |
-
b_sum += sumFactor * pb;
|
551 |
-
|
552 |
-
stack = stackStart;
|
553 |
-
|
554 |
-
for( i = 0; i < radiusPlus1; i++ )
|
555 |
-
{
|
556 |
-
stack.r = pr;
|
557 |
-
stack.g = pg;
|
558 |
-
stack.b = pb;
|
559 |
-
stack = stack.next;
|
560 |
-
}
|
561 |
-
|
562 |
-
yp = width;
|
563 |
-
|
564 |
-
for( i = 1; i <= radius; i++ )
|
565 |
-
{
|
566 |
-
yi = ( yp + x ) << 2;
|
567 |
-
|
568 |
-
r_sum += ( stack.r = ( pr = pixels[yi])) * ( rbs = radiusPlus1 - i );
|
569 |
-
g_sum += ( stack.g = ( pg = pixels[yi+1])) * rbs;
|
570 |
-
b_sum += ( stack.b = ( pb = pixels[yi+2])) * rbs;
|
571 |
-
|
572 |
-
r_in_sum += pr;
|
573 |
-
g_in_sum += pg;
|
574 |
-
b_in_sum += pb;
|
575 |
-
|
576 |
-
stack = stack.next;
|
577 |
-
|
578 |
-
if( i < heightMinus1 )
|
579 |
-
{
|
580 |
-
yp += width;
|
581 |
-
}
|
582 |
-
}
|
583 |
-
|
584 |
-
yi = x;
|
585 |
-
stackIn = stackStart;
|
586 |
-
stackOut = stackEnd;
|
587 |
-
for ( y = 0; y < height; y++ )
|
588 |
-
{
|
589 |
-
p = yi << 2;
|
590 |
-
pixels[p] = (r_sum * mul_sum) >> shg_sum;
|
591 |
-
pixels[p+1] = (g_sum * mul_sum) >> shg_sum;
|
592 |
-
pixels[p+2] = (b_sum * mul_sum) >> shg_sum;
|
593 |
-
|
594 |
-
r_sum -= r_out_sum;
|
595 |
-
g_sum -= g_out_sum;
|
596 |
-
b_sum -= b_out_sum;
|
597 |
-
|
598 |
-
r_out_sum -= stackIn.r;
|
599 |
-
g_out_sum -= stackIn.g;
|
600 |
-
b_out_sum -= stackIn.b;
|
601 |
-
|
602 |
-
p = ( x + (( ( p = y + radiusPlus1) < heightMinus1 ? p : heightMinus1 ) * width )) << 2;
|
603 |
-
|
604 |
-
r_sum += ( r_in_sum += ( stackIn.r = pixels[p]));
|
605 |
-
g_sum += ( g_in_sum += ( stackIn.g = pixels[p+1]));
|
606 |
-
b_sum += ( b_in_sum += ( stackIn.b = pixels[p+2]));
|
607 |
-
|
608 |
-
stackIn = stackIn.next;
|
609 |
-
|
610 |
-
r_out_sum += ( pr = stackOut.r );
|
611 |
-
g_out_sum += ( pg = stackOut.g );
|
612 |
-
b_out_sum += ( pb = stackOut.b );
|
613 |
-
|
614 |
-
r_in_sum -= pr;
|
615 |
-
g_in_sum -= pg;
|
616 |
-
b_in_sum -= pb;
|
617 |
-
|
618 |
-
stackOut = stackOut.next;
|
619 |
-
|
620 |
-
yi += width;
|
621 |
-
}
|
622 |
-
}
|
623 |
-
|
624 |
-
context.putImageData( imageData, top_x, top_y );
|
625 |
-
|
626 |
-
}
|
627 |
-
|
628 |
-
function BlurStack()
|
629 |
-
{
|
630 |
-
this.r = 0;
|
631 |
-
this.g = 0;
|
632 |
-
this.b = 0;
|
633 |
-
this.a = 0;
|
634 |
-
this.next = null;
|
635 |
-
}
|
636 |
-
|
637 |
-
var stackBlur = {
|
638 |
-
image: stackBlurImage,
|
639 |
-
canvasRGBA: stackBlurCanvasRGBA,
|
640 |
-
canvasRGB: stackBlurCanvasRGB
|
641 |
-
};
|
642 |
-
|
643 |
-
// export as AMD...
|
644 |
-
if ( typeof define !== 'undefined' && define.amd ) {
|
645 |
-
define( function () { return stackBlur; });
|
646 |
-
}
|
647 |
-
|
648 |
-
// ...or as browserify
|
649 |
-
else if ( typeof module !== 'undefined' && module.exports ) {
|
650 |
-
module.exports = stackBlur;
|
651 |
-
}
|
652 |
-
|
653 |
-
global.stackBlur = stackBlur;
|
654 |
-
|
655 |
}( typeof window !== 'undefined' ? window : this ));
|
1 |
+
/*
|
2 |
+
|
3 |
+
StackBlur - a fast almost Gaussian Blur For Canvas
|
4 |
+
|
5 |
+
Version: 0.5
|
6 |
+
Author: Mario Klingemann
|
7 |
+
Contact: mario@quasimondo.com
|
8 |
+
Website: http://www.quasimondo.com/StackBlurForCanvas
|
9 |
+
Twitter: @quasimondo
|
10 |
+
|
11 |
+
In case you find this class useful - especially in commercial projects -
|
12 |
+
I am not totally unhappy for a small donation to my PayPal account
|
13 |
+
mario@quasimondo.de
|
14 |
+
|
15 |
+
Or support me on flattr:
|
16 |
+
https://flattr.com/thing/72791/StackBlur-a-fast-almost-Gaussian-Blur-Effect-for-CanvasJavascript
|
17 |
+
|
18 |
+
Copyright (c) 2010 Mario Klingemann
|
19 |
+
|
20 |
+
Permission is hereby granted, free of charge, to any person
|
21 |
+
obtaining a copy of this software and associated documentation
|
22 |
+
files (the "Software"), to deal in the Software without
|
23 |
+
restriction, including without limitation the rights to use,
|
24 |
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
25 |
+
copies of the Software, and to permit persons to whom the
|
26 |
+
Software is furnished to do so, subject to the following
|
27 |
+
conditions:
|
28 |
+
|
29 |
+
The above copyright notice and this permission notice shall be
|
30 |
+
included in all copies or substantial portions of the Software.
|
31 |
+
|
32 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
33 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
34 |
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
35 |
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
36 |
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
37 |
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
38 |
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
39 |
+
OTHER DEALINGS IN THE SOFTWARE.
|
40 |
+
*/
|
41 |
+
|
42 |
+
(function ( global ) {
|
43 |
+
|
44 |
+
var mul_table = [
|
45 |
+
512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,
|
46 |
+
454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,
|
47 |
+
482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,
|
48 |
+
437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,
|
49 |
+
497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,
|
50 |
+
320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,
|
51 |
+
446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,
|
52 |
+
329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,
|
53 |
+
505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,
|
54 |
+
399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,
|
55 |
+
324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,
|
56 |
+
268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,
|
57 |
+
451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,
|
58 |
+
385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,
|
59 |
+
332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,
|
60 |
+
289,287,285,282,280,278,275,273,271,269,267,265,263,261,259];
|
61 |
+
|
62 |
+
|
63 |
+
var shg_table = [
|
64 |
+
9, 11, 12, 13, 13, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17,
|
65 |
+
17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19,
|
66 |
+
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20,
|
67 |
+
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21,
|
68 |
+
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
|
69 |
+
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22,
|
70 |
+
22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
|
71 |
+
22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23,
|
72 |
+
23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
|
73 |
+
23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
|
74 |
+
23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
|
75 |
+
23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
76 |
+
24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
77 |
+
24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
78 |
+
24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
79 |
+
24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24 ];
|
80 |
+
|
81 |
+
function premultiplyAlpha(imageData)
|
82 |
+
{
|
83 |
+
var pixels = imageData.data;
|
84 |
+
var size = imageData.width * imageData.height * 4;
|
85 |
+
|
86 |
+
for (var i=0; i<size; i+=4)
|
87 |
+
{
|
88 |
+
var a = pixels[i+3] / 255;
|
89 |
+
pixels[i ] *= a;
|
90 |
+
pixels[i+1] *= a;
|
91 |
+
pixels[i+2] *= a;
|
92 |
+
}
|
93 |
+
}
|
94 |
+
|
95 |
+
function unpremultiplyAlpha(imageData)
|
96 |
+
{
|
97 |
+
var pixels = imageData.data;
|
98 |
+
var size = imageData.width * imageData.height * 4;
|
99 |
+
|
100 |
+
for (var i=0; i<size; i+=4)
|
101 |
+
{
|
102 |
+
var a = pixels[i+3];
|
103 |
+
if (a != 0)
|
104 |
+
{
|
105 |
+
a = 255 / a;
|
106 |
+
pixels[i ] *= a;
|
107 |
+
pixels[i+1] *= a;
|
108 |
+
pixels[i+2] *= a;
|
109 |
+
}
|
110 |
+
}
|
111 |
+
}
|
112 |
+
|
113 |
+
function stackBlurImage( imageID, canvasID, radius, blurAlphaChannel )
|
114 |
+
{
|
115 |
+
|
116 |
+
var img = document.getElementById( imageID );
|
117 |
+
var w = img.naturalWidth;
|
118 |
+
var h = img.naturalHeight;
|
119 |
+
|
120 |
+
var canvas = document.getElementById( canvasID );
|
121 |
+
|
122 |
+
canvas.style.width = w + "px";
|
123 |
+
canvas.style.height = h + "px";
|
124 |
+
canvas.width = w;
|
125 |
+
canvas.height = h;
|
126 |
+
|
127 |
+
var context = canvas.getContext("2d");
|
128 |
+
context.clearRect( 0, 0, w, h );
|
129 |
+
context.drawImage( img, 0, 0 );
|
130 |
+
|
131 |
+
if ( isNaN(radius) || radius < 1 ) return;
|
132 |
+
|
133 |
+
if ( blurAlphaChannel )
|
134 |
+
stackBlurCanvasRGBA( canvasID, 0, 0, w, h, radius );
|
135 |
+
else
|
136 |
+
stackBlurCanvasRGB( canvasID, 0, 0, w, h, radius );
|
137 |
+
}
|
138 |
+
|
139 |
+
|
140 |
+
function stackBlurCanvasRGBA( id, top_x, top_y, width, height, radius )
|
141 |
+
{
|
142 |
+
if ( isNaN(radius) || radius < 1 ) return;
|
143 |
+
radius |= 0;
|
144 |
+
|
145 |
+
var canvas = document.getElementById( id );
|
146 |
+
var context = canvas.getContext("2d");
|
147 |
+
var imageData;
|
148 |
+
|
149 |
+
try {
|
150 |
+
try {
|
151 |
+
imageData = context.getImageData( top_x, top_y, width, height );
|
152 |
+
} catch(e) {
|
153 |
+
|
154 |
+
// NOTE: this part is supposedly only needed if you want to work with local files
|
155 |
+
// so it might be okay to remove the whole try/catch block and just use
|
156 |
+
// imageData = context.getImageData( top_x, top_y, width, height );
|
157 |
+
try {
|
158 |
+
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
|
159 |
+
imageData = context.getImageData( top_x, top_y, width, height );
|
160 |
+
} catch(e) {
|
161 |
+
alert("Cannot access local image");
|
162 |
+
throw new Error("unable to access local image data: " + e);
|
163 |
+
return;
|
164 |
+
}
|
165 |
+
}
|
166 |
+
} catch(e) {
|
167 |
+
alert("Cannot access image");
|
168 |
+
throw new Error("unable to access image data: " + e);
|
169 |
+
}
|
170 |
+
|
171 |
+
premultiplyAlpha(imageData);
|
172 |
+
|
173 |
+
var pixels = imageData.data;
|
174 |
+
|
175 |
+
var x, y, i, p, yp, yi, yw, r_sum, g_sum, b_sum, a_sum,
|
176 |
+
r_out_sum, g_out_sum, b_out_sum, a_out_sum,
|
177 |
+
r_in_sum, g_in_sum, b_in_sum, a_in_sum,
|
178 |
+
pr, pg, pb, pa, rbs;
|
179 |
+
|
180 |
+
var div = radius + radius + 1;
|
181 |
+
var w4 = width << 2;
|
182 |
+
var widthMinus1 = width - 1;
|
183 |
+
var heightMinus1 = height - 1;
|
184 |
+
var radiusPlus1 = radius + 1;
|
185 |
+
var sumFactor = radiusPlus1 * ( radiusPlus1 + 1 ) / 2;
|
186 |
+
|
187 |
+
var stackStart = new BlurStack();
|
188 |
+
var stack = stackStart;
|
189 |
+
for ( i = 1; i < div; i++ )
|
190 |
+
{
|
191 |
+
stack = stack.next = new BlurStack();
|
192 |
+
if ( i == radiusPlus1 ) var stackEnd = stack;
|
193 |
+
}
|
194 |
+
stack.next = stackStart;
|
195 |
+
var stackIn = null;
|
196 |
+
var stackOut = null;
|
197 |
+
|
198 |
+
yw = yi = 0;
|
199 |
+
|
200 |
+
var mul_sum = mul_table[radius];
|
201 |
+
var shg_sum = shg_table[radius];
|
202 |
+
|
203 |
+
for ( y = 0; y < height; y++ )
|
204 |
+
{
|
205 |
+
r_in_sum = g_in_sum = b_in_sum = a_in_sum = r_sum = g_sum = b_sum = a_sum = 0;
|
206 |
+
|
207 |
+
r_out_sum = radiusPlus1 * ( pr = pixels[yi] );
|
208 |
+
g_out_sum = radiusPlus1 * ( pg = pixels[yi+1] );
|
209 |
+
b_out_sum = radiusPlus1 * ( pb = pixels[yi+2] );
|
210 |
+
a_out_sum = radiusPlus1 * ( pa = pixels[yi+3] );
|
211 |
+
|
212 |
+
r_sum += sumFactor * pr;
|
213 |
+
g_sum += sumFactor * pg;
|
214 |
+
b_sum += sumFactor * pb;
|
215 |
+
a_sum += sumFactor * pa;
|
216 |
+
|
217 |
+
stack = stackStart;
|
218 |
+
|
219 |
+
for( i = 0; i < radiusPlus1; i++ )
|
220 |
+
{
|
221 |
+
stack.r = pr;
|
222 |
+
stack.g = pg;
|
223 |
+
stack.b = pb;
|
224 |
+
stack.a = pa;
|
225 |
+
stack = stack.next;
|
226 |
+
}
|
227 |
+
|
228 |
+
for( i = 1; i < radiusPlus1; i++ )
|
229 |
+
{
|
230 |
+
p = yi + (( widthMinus1 < i ? widthMinus1 : i ) << 2 );
|
231 |
+
r_sum += ( stack.r = ( pr = pixels[p])) * ( rbs = radiusPlus1 - i );
|
232 |
+
g_sum += ( stack.g = ( pg = pixels[p+1])) * rbs;
|
233 |
+
b_sum += ( stack.b = ( pb = pixels[p+2])) * rbs;
|
234 |
+
a_sum += ( stack.a = ( pa = pixels[p+3])) * rbs;
|
235 |
+
|
236 |
+
r_in_sum += pr;
|
237 |
+
g_in_sum += pg;
|
238 |
+
b_in_sum += pb;
|
239 |
+
a_in_sum += pa;
|
240 |
+
|
241 |
+
stack = stack.next;
|
242 |
+
}
|
243 |
+
|
244 |
+
stackIn = stackStart;
|
245 |
+
stackOut = stackEnd;
|
246 |
+
for ( x = 0; x < width; x++ )
|
247 |
+
{
|
248 |
+
pixels[yi] = (r_sum * mul_sum) >> shg_sum;
|
249 |
+
pixels[yi+1] = (g_sum * mul_sum) >> shg_sum;
|
250 |
+
pixels[yi+2] = (b_sum * mul_sum) >> shg_sum;
|
251 |
+
pixels[yi+3] = (a_sum * mul_sum) >> shg_sum;
|
252 |
+
|
253 |
+
r_sum -= r_out_sum;
|
254 |
+
g_sum -= g_out_sum;
|
255 |
+
b_sum -= b_out_sum;
|
256 |
+
a_sum -= a_out_sum;
|
257 |
+
|
258 |
+
r_out_sum -= stackIn.r;
|
259 |
+
g_out_sum -= stackIn.g;
|
260 |
+
b_out_sum -= stackIn.b;
|
261 |
+
a_out_sum -= stackIn.a;
|
262 |
+
|
263 |
+
p = ( yw + ( ( p = x + radius + 1 ) < widthMinus1 ? p : widthMinus1 ) ) << 2;
|
264 |
+
|
265 |
+
r_in_sum += ( stackIn.r = pixels[p]);
|
266 |
+
g_in_sum += ( stackIn.g = pixels[p+1]);
|
267 |
+
b_in_sum += ( stackIn.b = pixels[p+2]);
|
268 |
+
a_in_sum += ( stackIn.a = pixels[p+3]);
|
269 |
+
|
270 |
+
r_sum += r_in_sum;
|
271 |
+
g_sum += g_in_sum;
|
272 |
+
b_sum += b_in_sum;
|
273 |
+
a_sum += a_in_sum;
|
274 |
+
|
275 |
+
stackIn = stackIn.next;
|
276 |
+
|
277 |
+
r_out_sum += ( pr = stackOut.r );
|
278 |
+
g_out_sum += ( pg = stackOut.g );
|
279 |
+
b_out_sum += ( pb = stackOut.b );
|
280 |
+
a_out_sum += ( pa = stackOut.a );
|
281 |
+
|
282 |
+
r_in_sum -= pr;
|
283 |
+
g_in_sum -= pg;
|
284 |
+
b_in_sum -= pb;
|
285 |
+
a_in_sum -= pa;
|
286 |
+
|
287 |
+
stackOut = stackOut.next;
|
288 |
+
|
289 |
+
yi += 4;
|
290 |
+
}
|
291 |
+
yw += width;
|
292 |
+
}
|
293 |
+
|
294 |
+
|
295 |
+
for ( x = 0; x < width; x++ )
|
296 |
+
{
|
297 |
+
g_in_sum = b_in_sum = a_in_sum = r_in_sum = g_sum = b_sum = a_sum = r_sum = 0;
|
298 |
+
|
299 |
+
yi = x << 2;
|
300 |
+
r_out_sum = radiusPlus1 * ( pr = pixels[yi]);
|
301 |
+
g_out_sum = radiusPlus1 * ( pg = pixels[yi+1]);
|
302 |
+
b_out_sum = radiusPlus1 * ( pb = pixels[yi+2]);
|
303 |
+
a_out_sum = radiusPlus1 * ( pa = pixels[yi+3]);
|
304 |
+
|
305 |
+
r_sum += sumFactor * pr;
|
306 |
+
g_sum += sumFactor * pg;
|
307 |
+
b_sum += sumFactor * pb;
|
308 |
+
a_sum += sumFactor * pa;
|
309 |
+
|
310 |
+
stack = stackStart;
|
311 |
+
|
312 |
+
for( i = 0; i < radiusPlus1; i++ )
|
313 |
+
{
|
314 |
+
stack.r = pr;
|
315 |
+
stack.g = pg;
|
316 |
+
stack.b = pb;
|
317 |
+
stack.a = pa;
|
318 |
+
stack = stack.next;
|
319 |
+
}
|
320 |
+
|
321 |
+
yp = width;
|
322 |
+
|
323 |
+
for( i = 1; i <= radius; i++ )
|
324 |
+
{
|
325 |
+
yi = ( yp + x ) << 2;
|
326 |
+
|
327 |
+
r_sum += ( stack.r = ( pr = pixels[yi])) * ( rbs = radiusPlus1 - i );
|
328 |
+
g_sum += ( stack.g = ( pg = pixels[yi+1])) * rbs;
|
329 |
+
b_sum += ( stack.b = ( pb = pixels[yi+2])) * rbs;
|
330 |
+
a_sum += ( stack.a = ( pa = pixels[yi+3])) * rbs;
|
331 |
+
|
332 |
+
r_in_sum += pr;
|
333 |
+
g_in_sum += pg;
|
334 |
+
b_in_sum += pb;
|
335 |
+
a_in_sum += pa;
|
336 |
+
|
337 |
+
stack = stack.next;
|
338 |
+
|
339 |
+
if( i < heightMinus1 )
|
340 |
+
{
|
341 |
+
yp += width;
|
342 |
+
}
|
343 |
+
}
|
344 |
+
|
345 |
+
yi = x;
|
346 |
+
stackIn = stackStart;
|
347 |
+
stackOut = stackEnd;
|
348 |
+
for ( y = 0; y < height; y++ )
|
349 |
+
{
|
350 |
+
p = yi << 2;
|
351 |
+
pixels[p] = (r_sum * mul_sum) >> shg_sum;
|
352 |
+
pixels[p+1] = (g_sum * mul_sum) >> shg_sum;
|
353 |
+
pixels[p+2] = (b_sum * mul_sum) >> shg_sum;
|
354 |
+
pixels[p+3] = (a_sum * mul_sum) >> shg_sum;
|
355 |
+
|
356 |
+
r_sum -= r_out_sum;
|
357 |
+
g_sum -= g_out_sum;
|
358 |
+
b_sum -= b_out_sum;
|
359 |
+
a_sum -= a_out_sum;
|
360 |
+
|
361 |
+
r_out_sum -= stackIn.r;
|
362 |
+
g_out_sum -= stackIn.g;
|
363 |
+
b_out_sum -= stackIn.b;
|
364 |
+
a_out_sum -= stackIn.a;
|
365 |
+
|
366 |
+
p = ( x + (( ( p = y + radiusPlus1) < heightMinus1 ? p : heightMinus1 ) * width )) << 2;
|
367 |
+
|
368 |
+
r_sum += ( r_in_sum += ( stackIn.r = pixels[p]));
|
369 |
+
g_sum += ( g_in_sum += ( stackIn.g = pixels[p+1]));
|
370 |
+
b_sum += ( b_in_sum += ( stackIn.b = pixels[p+2]));
|
371 |
+
a_sum += ( a_in_sum += ( stackIn.a = pixels[p+3]));
|
372 |
+
|
373 |
+
stackIn = stackIn.next;
|
374 |
+
|
375 |
+
r_out_sum += ( pr = stackOut.r );
|
376 |
+
g_out_sum += ( pg = stackOut.g );
|
377 |
+
b_out_sum += ( pb = stackOut.b );
|
378 |
+
a_out_sum += ( pa = stackOut.a );
|
379 |
+
|
380 |
+
r_in_sum -= pr;
|
381 |
+
g_in_sum -= pg;
|
382 |
+
b_in_sum -= pb;
|
383 |
+
a_in_sum -= pa;
|
384 |
+
|
385 |
+
stackOut = stackOut.next;
|
386 |
+
|
387 |
+
yi += width;
|
388 |
+
}
|
389 |
+
}
|
390 |
+
|
391 |
+
unpremultiplyAlpha(imageData);
|
392 |
+
|
393 |
+
context.putImageData( imageData, top_x, top_y );
|
394 |
+
}
|
395 |
+
|
396 |
+
|
397 |
+
function stackBlurCanvasRGB( id, top_x, top_y, width, height, radius )
|
398 |
+
{
|
399 |
+
if ( isNaN(radius) || radius < 1 ) return;
|
400 |
+
radius |= 0;
|
401 |
+
|
402 |
+
var canvas = document.getElementById( id );
|
403 |
+
var context = canvas.getContext("2d");
|
404 |
+
var imageData;
|
405 |
+
|
406 |
+
try {
|
407 |
+
try {
|
408 |
+
imageData = context.getImageData( top_x, top_y, width, height );
|
409 |
+
} catch(e) {
|
410 |
+
|
411 |
+
// NOTE: this part is supposedly only needed if you want to work with local files
|
412 |
+
// so it might be okay to remove the whole try/catch block and just use
|
413 |
+
// imageData = context.getImageData( top_x, top_y, width, height );
|
414 |
+
try {
|
415 |
+
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
|
416 |
+
imageData = context.getImageData( top_x, top_y, width, height );
|
417 |
+
} catch(e) {
|
418 |
+
alert("Cannot access local image");
|
419 |
+
throw new Error("unable to access local image data: " + e);
|
420 |
+
return;
|
421 |
+
}
|
422 |
+
}
|
423 |
+
} catch(e) {
|
424 |
+
alert("Cannot access image");
|
425 |
+
throw new Error("unable to access image data: " + e);
|
426 |
+
}
|
427 |
+
|
428 |
+
var pixels = imageData.data;
|
429 |
+
|
430 |
+
var x, y, i, p, yp, yi, yw, r_sum, g_sum, b_sum,
|
431 |
+
r_out_sum, g_out_sum, b_out_sum,
|
432 |
+
r_in_sum, g_in_sum, b_in_sum,
|
433 |
+
pr, pg, pb, rbs;
|
434 |
+
|
435 |
+
var div = radius + radius + 1;
|
436 |
+
var w4 = width << 2;
|
437 |
+
var widthMinus1 = width - 1;
|
438 |
+
var heightMinus1 = height - 1;
|
439 |
+
var radiusPlus1 = radius + 1;
|
440 |
+
var sumFactor = radiusPlus1 * ( radiusPlus1 + 1 ) / 2;
|
441 |
+
|
442 |
+
var stackStart = new BlurStack();
|
443 |
+
var stack = stackStart;
|
444 |
+
for ( i = 1; i < div; i++ )
|
445 |
+
{
|
446 |
+
stack = stack.next = new BlurStack();
|
447 |
+
if ( i == radiusPlus1 ) var stackEnd = stack;
|
448 |
+
}
|
449 |
+
stack.next = stackStart;
|
450 |
+
var stackIn = null;
|
451 |
+
var stackOut = null;
|
452 |
+
|
453 |
+
yw = yi = 0;
|
454 |
+
|
455 |
+
var mul_sum = mul_table[radius];
|
456 |
+
var shg_sum = shg_table[radius];
|
457 |
+
|
458 |
+
for ( y = 0; y < height; y++ )
|
459 |
+
{
|
460 |
+
r_in_sum = g_in_sum = b_in_sum = r_sum = g_sum = b_sum = 0;
|
461 |
+
|
462 |
+
r_out_sum = radiusPlus1 * ( pr = pixels[yi] );
|
463 |
+
g_out_sum = radiusPlus1 * ( pg = pixels[yi+1] );
|
464 |
+
b_out_sum = radiusPlus1 * ( pb = pixels[yi+2] );
|
465 |
+
|
466 |
+
r_sum += sumFactor * pr;
|
467 |
+
g_sum += sumFactor * pg;
|
468 |
+
b_sum += sumFactor * pb;
|
469 |
+
|
470 |
+
stack = stackStart;
|
471 |
+
|
472 |
+
for( i = 0; i < radiusPlus1; i++ )
|
473 |
+
{
|
474 |
+
stack.r = pr;
|
475 |
+
stack.g = pg;
|
476 |
+
stack.b = pb;
|
477 |
+
stack = stack.next;
|
478 |
+
}
|
479 |
+
|
480 |
+
for( i = 1; i < radiusPlus1; i++ )
|
481 |
+
{
|
482 |
+
p = yi + (( widthMinus1 < i ? widthMinus1 : i ) << 2 );
|
483 |
+
r_sum += ( stack.r = ( pr = pixels[p])) * ( rbs = radiusPlus1 - i );
|
484 |
+
g_sum += ( stack.g = ( pg = pixels[p+1])) * rbs;
|
485 |
+
b_sum += ( stack.b = ( pb = pixels[p+2])) * rbs;
|
486 |
+
|
487 |
+
r_in_sum += pr;
|
488 |
+
g_in_sum += pg;
|
489 |
+
b_in_sum += pb;
|
490 |
+
|
491 |
+
stack = stack.next;
|
492 |
+
}
|
493 |
+
|
494 |
+
|
495 |
+
stackIn = stackStart;
|
496 |
+
stackOut = stackEnd;
|
497 |
+
for ( x = 0; x < width; x++ )
|
498 |
+
{
|
499 |
+
pixels[yi] = (r_sum * mul_sum) >> shg_sum;
|
500 |
+
pixels[yi+1] = (g_sum * mul_sum) >> shg_sum;
|
501 |
+
pixels[yi+2] = (b_sum * mul_sum) >> shg_sum;
|
502 |
+
|
503 |
+
r_sum -= r_out_sum;
|
504 |
+
g_sum -= g_out_sum;
|
505 |
+
b_sum -= b_out_sum;
|
506 |
+
|
507 |
+
r_out_sum -= stackIn.r;
|
508 |
+
g_out_sum -= stackIn.g;
|
509 |
+
b_out_sum -= stackIn.b;
|
510 |
+
|
511 |
+
p = ( yw + ( ( p = x + radius + 1 ) < widthMinus1 ? p : widthMinus1 ) ) << 2;
|
512 |
+
|
513 |
+
r_in_sum += ( stackIn.r = pixels[p]);
|
514 |
+
g_in_sum += ( stackIn.g = pixels[p+1]);
|
515 |
+
b_in_sum += ( stackIn.b = pixels[p+2]);
|
516 |
+
|
517 |
+
r_sum += r_in_sum;
|
518 |
+
g_sum += g_in_sum;
|
519 |
+
b_sum += b_in_sum;
|
520 |
+
|
521 |
+
stackIn = stackIn.next;
|
522 |
+
|
523 |
+
r_out_sum += ( pr = stackOut.r );
|
524 |
+
g_out_sum += ( pg = stackOut.g );
|
525 |
+
b_out_sum += ( pb = stackOut.b );
|
526 |
+
|
527 |
+
r_in_sum -= pr;
|
528 |
+
g_in_sum -= pg;
|
529 |
+
b_in_sum -= pb;
|
530 |
+
|
531 |
+
stackOut = stackOut.next;
|
532 |
+
|
533 |
+
yi += 4;
|
534 |
+
}
|
535 |
+
yw += width;
|
536 |
+
}
|
537 |
+
|
538 |
+
|
539 |
+
for ( x = 0; x < width; x++ )
|
540 |
+
{
|
541 |
+
g_in_sum = b_in_sum = r_in_sum = g_sum = b_sum = r_sum = 0;
|
542 |
+
|
543 |
+
yi = x << 2;
|
544 |
+
r_out_sum = radiusPlus1 * ( pr = pixels[yi]);
|
545 |
+
g_out_sum = radiusPlus1 * ( pg = pixels[yi+1]);
|
546 |
+
b_out_sum = radiusPlus1 * ( pb = pixels[yi+2]);
|
547 |
+
|
548 |
+
r_sum += sumFactor * pr;
|
549 |
+
g_sum += sumFactor * pg;
|
550 |
+
b_sum += sumFactor * pb;
|
551 |
+
|
552 |
+
stack = stackStart;
|
553 |
+
|
554 |
+
for( i = 0; i < radiusPlus1; i++ )
|
555 |
+
{
|
556 |
+
stack.r = pr;
|
557 |
+
stack.g = pg;
|
558 |
+
stack.b = pb;
|
559 |
+
stack = stack.next;
|
560 |
+
}
|
561 |
+
|
562 |
+
yp = width;
|
563 |
+
|
564 |
+
for( i = 1; i <= radius; i++ )
|
565 |
+
{
|
566 |
+
yi = ( yp + x ) << 2;
|
567 |
+
|
568 |
+
r_sum += ( stack.r = ( pr = pixels[yi])) * ( rbs = radiusPlus1 - i );
|
569 |
+
g_sum += ( stack.g = ( pg = pixels[yi+1])) * rbs;
|
570 |
+
b_sum += ( stack.b = ( pb = pixels[yi+2])) * rbs;
|
571 |
+
|
572 |
+
r_in_sum += pr;
|
573 |
+
g_in_sum += pg;
|
574 |
+
b_in_sum += pb;
|
575 |
+
|
576 |
+
stack = stack.next;
|
577 |
+
|
578 |
+
if( i < heightMinus1 )
|
579 |
+
{
|
580 |
+
yp += width;
|
581 |
+
}
|
582 |
+
}
|
583 |
+
|
584 |
+
yi = x;
|
585 |
+
stackIn = stackStart;
|
586 |
+
stackOut = stackEnd;
|
587 |
+
for ( y = 0; y < height; y++ )
|
588 |
+
{
|
589 |
+
p = yi << 2;
|
590 |
+
pixels[p] = (r_sum * mul_sum) >> shg_sum;
|
591 |
+
pixels[p+1] = (g_sum * mul_sum) >> shg_sum;
|
592 |
+
pixels[p+2] = (b_sum * mul_sum) >> shg_sum;
|
593 |
+
|
594 |
+
r_sum -= r_out_sum;
|
595 |
+
g_sum -= g_out_sum;
|
596 |
+
b_sum -= b_out_sum;
|
597 |
+
|
598 |
+
r_out_sum -= stackIn.r;
|
599 |
+
g_out_sum -= stackIn.g;
|
600 |
+
b_out_sum -= stackIn.b;
|
601 |
+
|
602 |
+
p = ( x + (( ( p = y + radiusPlus1) < heightMinus1 ? p : heightMinus1 ) * width )) << 2;
|
603 |
+
|
604 |
+
r_sum += ( r_in_sum += ( stackIn.r = pixels[p]));
|
605 |
+
g_sum += ( g_in_sum += ( stackIn.g = pixels[p+1]));
|
606 |
+
b_sum += ( b_in_sum += ( stackIn.b = pixels[p+2]));
|
607 |
+
|
608 |
+
stackIn = stackIn.next;
|
609 |
+
|
610 |
+
r_out_sum += ( pr = stackOut.r );
|
611 |
+
g_out_sum += ( pg = stackOut.g );
|
612 |
+
b_out_sum += ( pb = stackOut.b );
|
613 |
+
|
614 |
+
r_in_sum -= pr;
|
615 |
+
g_in_sum -= pg;
|
616 |
+
b_in_sum -= pb;
|
617 |
+
|
618 |
+
stackOut = stackOut.next;
|
619 |
+
|
620 |
+
yi += width;
|
621 |
+
}
|
622 |
+
}
|
623 |
+
|
624 |
+
context.putImageData( imageData, top_x, top_y );
|
625 |
+
|
626 |
+
}
|
627 |
+
|
628 |
+
function BlurStack()
|
629 |
+
{
|
630 |
+
this.r = 0;
|
631 |
+
this.g = 0;
|
632 |
+
this.b = 0;
|
633 |
+
this.a = 0;
|
634 |
+
this.next = null;
|
635 |
+
}
|
636 |
+
|
637 |
+
var stackBlur = {
|
638 |
+
image: stackBlurImage,
|
639 |
+
canvasRGBA: stackBlurCanvasRGBA,
|
640 |
+
canvasRGB: stackBlurCanvasRGB
|
641 |
+
};
|
642 |
+
|
643 |
+
// export as AMD...
|
644 |
+
if ( typeof define !== 'undefined' && define.amd ) {
|
645 |
+
define( function () { return stackBlur; });
|
646 |
+
}
|
647 |
+
|
648 |
+
// ...or as browserify
|
649 |
+
else if ( typeof module !== 'undefined' && module.exports ) {
|
650 |
+
module.exports = stackBlur;
|
651 |
+
}
|
652 |
+
|
653 |
+
global.stackBlur = stackBlur;
|
654 |
+
|
655 |
}( typeof window !== 'undefined' ? window : this ));
|
inc/js/bootstrap-select.js
CHANGED
@@ -1,1709 +1,1709 @@
|
|
1 |
-
(function ($) {
|
2 |
-
'use strict';
|
3 |
-
|
4 |
-
//<editor-fold desc="Shims">
|
5 |
-
if (!String.prototype.includes) {
|
6 |
-
(function () {
|
7 |
-
'use strict'; // needed to support `apply`/`call` with `undefined`/`null`
|
8 |
-
var toString = {}.toString;
|
9 |
-
var defineProperty = (function () {
|
10 |
-
// IE 8 only supports `Object.defineProperty` on DOM elements
|
11 |
-
try {
|
12 |
-
var object = {};
|
13 |
-
var $defineProperty = Object.defineProperty;
|
14 |
-
var result = $defineProperty(object, object, object) && $defineProperty;
|
15 |
-
} catch (error) {
|
16 |
-
}
|
17 |
-
return result;
|
18 |
-
}());
|
19 |
-
var indexOf = ''.indexOf;
|
20 |
-
var includes = function (search) {
|
21 |
-
if (this == null) {
|
22 |
-
throw new TypeError();
|
23 |
-
}
|
24 |
-
var string = String(this);
|
25 |
-
if (search && toString.call(search) == '[object RegExp]') {
|
26 |
-
throw new TypeError();
|
27 |
-
}
|
28 |
-
var stringLength = string.length;
|
29 |
-
var searchString = String(search);
|
30 |
-
var searchLength = searchString.length;
|
31 |
-
var position = arguments.length > 1 ? arguments[1] : undefined;
|
32 |
-
// `ToInteger`
|
33 |
-
var pos = position ? Number(position) : 0;
|
34 |
-
if (pos != pos) { // better `isNaN`
|
35 |
-
pos = 0;
|
36 |
-
}
|
37 |
-
var start = Math.min(Math.max(pos, 0), stringLength);
|
38 |
-
// Avoid the `indexOf` call if no match is possible
|
39 |
-
if (searchLength + start > stringLength) {
|
40 |
-
return false;
|
41 |
-
}
|
42 |
-
return indexOf.call(string, searchString, pos) != -1;
|
43 |
-
};
|
44 |
-
if (defineProperty) {
|
45 |
-
defineProperty(String.prototype, 'includes', {
|
46 |
-
'value': includes,
|
47 |
-
'configurable': true,
|
48 |
-
'writable': true
|
49 |
-
});
|
50 |
-
} else {
|
51 |
-
String.prototype.includes = includes;
|
52 |
-
}
|
53 |
-
}());
|
54 |
-
}
|
55 |
-
|
56 |
-
if (!String.prototype.startsWith) {
|
57 |
-
(function () {
|
58 |
-
'use strict'; // needed to support `apply`/`call` with `undefined`/`null`
|
59 |
-
var defineProperty = (function () {
|
60 |
-
// IE 8 only supports `Object.defineProperty` on DOM elements
|
61 |
-
try {
|
62 |
-
var object = {};
|
63 |
-
var $defineProperty = Object.defineProperty;
|
64 |
-
var result = $defineProperty(object, object, object) && $defineProperty;
|
65 |
-
} catch (error) {
|
66 |
-
}
|
67 |
-
return result;
|
68 |
-
}());
|
69 |
-
var toString = {}.toString;
|
70 |
-
var startsWith = function (search) {
|
71 |
-
if (this == null) {
|
72 |
-
throw new TypeError();
|
73 |
-
}
|
74 |
-
var string = String(this);
|
75 |
-
if (search && toString.call(search) == '[object RegExp]') {
|
76 |
-
throw new TypeError();
|
77 |
-
}
|
78 |
-
var stringLength = string.length;
|
79 |
-
var searchString = String(search);
|
80 |
-
var searchLength = searchString.length;
|
81 |
-
var position = arguments.length > 1 ? arguments[1] : undefined;
|
82 |
-
// `ToInteger`
|
83 |
-
var pos = position ? Number(position) : 0;
|
84 |
-
if (pos != pos) { // better `isNaN`
|
85 |
-
pos = 0;
|
86 |
-
}
|
87 |
-
var start = Math.min(Math.max(pos, 0), stringLength);
|
88 |
-
// Avoid the `indexOf` call if no match is possible
|
89 |
-
if (searchLength + start > stringLength) {
|
90 |
-
return false;
|
91 |
-
}
|
92 |
-
var index = -1;
|
93 |
-
while (++index < searchLength) {
|
94 |
-
if (string.charCodeAt(start + index) != searchString.charCodeAt(index)) {
|
95 |
-
return false;
|
96 |
-
}
|
97 |
-
}
|
98 |
-
return true;
|
99 |
-
};
|
100 |
-
if (defineProperty) {
|
101 |
-
defineProperty(String.prototype, 'startsWith', {
|
102 |
-
'value': startsWith,
|
103 |
-
'configurable': true,
|
104 |
-
'writable': true
|
105 |
-
});
|
106 |
-
} else {
|
107 |
-
String.prototype.startsWith = startsWith;
|
108 |
-
}
|
109 |
-
}());
|
110 |
-
}
|
111 |
-
|
112 |
-
if (!Object.keys) {
|
113 |
-
Object.keys = function (
|
114 |
-
o, // object
|
115 |
-
k, // key
|
116 |
-
r // result array
|
117 |
-
){
|
118 |
-
// initialize object and result
|
119 |
-
r=[];
|
120 |
-
// iterate over object keys
|
121 |
-
for (k in o)
|
122 |
-
// fill result array with non-prototypical keys
|
123 |
-
r.hasOwnProperty.call(o, k) && r.push(k);
|
124 |
-
// return result
|
125 |
-
return r;
|
126 |
-
};
|
127 |
-
}
|
128 |
-
|
129 |
-
$.fn.triggerNative = function (eventName) {
|
130 |
-
var el = this[0],
|
131 |
-
event;
|
132 |
-
|
133 |
-
if (el.dispatchEvent) {
|
134 |
-
if (typeof Event === 'function') {
|
135 |
-
// For modern browsers
|
136 |
-
event = new Event(eventName, {
|
137 |
-
bubbles: true
|
138 |
-
});
|
139 |
-
} else {
|
140 |
-
// For IE since it doesn't support Event constructor
|
141 |
-
event = document.createEvent('Event');
|
142 |
-
event.initEvent(eventName, true, false);
|
143 |
-
}
|
144 |
-
|
145 |
-
el.dispatchEvent(event);
|
146 |
-
} else {
|
147 |
-
if (el.fireEvent) {
|
148 |
-
event = document.createEventObject();
|
149 |
-
event.eventType = eventName;
|
150 |
-
el.fireEvent('on' + eventName, event);
|
151 |
-
}
|
152 |
-
|
153 |
-
this.trigger(eventName);
|
154 |
-
}
|
155 |
-
};
|
156 |
-
//</editor-fold>
|
157 |
-
|
158 |
-
// Case insensitive contains search
|
159 |
-
$.expr[':'].icontains = function (obj, index, meta) {
|
160 |
-
var $obj = $(obj);
|
161 |
-
var haystack = ($obj.data('tokens') || $obj.text()).toUpperCase();
|
162 |
-
return haystack.includes(meta[3].toUpperCase());
|
163 |
-
};
|
164 |
-
|
165 |
-
// Case insensitive begins search
|
166 |
-
$.expr[':'].ibegins = function (obj, index, meta) {
|
167 |
-
var $obj = $(obj);
|
168 |
-
var haystack = ($obj.data('tokens') || $obj.text()).toUpperCase();
|
169 |
-
return haystack.startsWith(meta[3].toUpperCase());
|
170 |
-
};
|
171 |
-
|
172 |
-
// Case and accent insensitive contains search
|
173 |
-
$.expr[':'].aicontains = function (obj, index, meta) {
|
174 |
-
var $obj = $(obj);
|
175 |
-
var haystack = ($obj.data('tokens') || $obj.data('normalizedText') || $obj.text()).toUpperCase();
|
176 |
-
return haystack.includes(meta[3].toUpperCase());
|
177 |
-
};
|
178 |
-
|
179 |
-
// Case and accent insensitive begins search
|
180 |
-
$.expr[':'].aibegins = function (obj, index, meta) {
|
181 |
-
var $obj = $(obj);
|
182 |
-
var haystack = ($obj.data('tokens') || $obj.data('normalizedText') || $obj.text()).toUpperCase();
|
183 |
-
return haystack.startsWith(meta[3].toUpperCase());
|
184 |
-
};
|
185 |
-
|
186 |
-
/**
|
187 |
-
* Remove all diatrics from the given text.
|
188 |
-
* @access private
|
189 |
-
* @param {String} text
|
190 |
-
* @returns {String}
|
191 |
-
*/
|
192 |
-
function normalizeToBase(text) {
|
193 |
-
var rExps = [
|
194 |
-
{re: /[\xC0-\xC6]/g, ch: "A"},
|
195 |
-
{re: /[\xE0-\xE6]/g, ch: "a"},
|
196 |
-
{re: /[\xC8-\xCB]/g, ch: "E"},
|
197 |
-
{re: /[\xE8-\xEB]/g, ch: "e"},
|
198 |
-
{re: /[\xCC-\xCF]/g, ch: "I"},
|
199 |
-
{re: /[\xEC-\xEF]/g, ch: "i"},
|
200 |
-
{re: /[\xD2-\xD6]/g, ch: "O"},
|
201 |
-
{re: /[\xF2-\xF6]/g, ch: "o"},
|
202 |
-
{re: /[\xD9-\xDC]/g, ch: "U"},
|
203 |
-
{re: /[\xF9-\xFC]/g, ch: "u"},
|
204 |
-
{re: /[\xC7-\xE7]/g, ch: "c"},
|
205 |
-
{re: /[\xD1]/g, ch: "N"},
|
206 |
-
{re: /[\xF1]/g, ch: "n"}
|
207 |
-
];
|
208 |
-
$.each(rExps, function () {
|
209 |
-
text = text.replace(this.re, this.ch);
|
210 |
-
});
|
211 |
-
return text;
|
212 |
-
}
|
213 |
-
|
214 |
-
|
215 |
-
function htmlEscape(html) {
|
216 |
-
var escapeMap = {
|
217 |
-
'&': '&',
|
218 |
-
'<': '<',
|
219 |
-
'>': '>',
|
220 |
-
'"': '"',
|
221 |
-
"'": ''',
|
222 |
-
'`': '`'
|
223 |
-
};
|
224 |
-
var source = '(?:' + Object.keys(escapeMap).join('|') + ')',
|
225 |
-
testRegexp = new RegExp(source),
|
226 |
-
replaceRegexp = new RegExp(source, 'g'),
|
227 |
-
string = html == null ? '' : '' + html;
|
228 |
-
return testRegexp.test(string) ? string.replace(replaceRegexp, function (match) {
|
229 |
-
return escapeMap[match];
|
230 |
-
}) : string;
|
231 |
-
}
|
232 |
-
|
233 |
-
var Selectpicker = function (element, options, e) {
|
234 |
-
if (e) {
|
235 |
-
e.stopPropagation();
|
236 |
-
e.preventDefault();
|
237 |
-
}
|
238 |
-
|
239 |
-
this.$element = $(element);
|
240 |
-
this.$newElement = null;
|
241 |
-
this.$button = null;
|
242 |
-
this.$menu = null;
|
243 |
-
this.$lis = null;
|
244 |
-
this.options = options;
|
245 |
-
|
246 |
-
// If we have no title yet, try to pull it from the html title attribute (jQuery doesnt' pick it up as it's not a
|
247 |
-
// data-attribute)
|
248 |
-
if (this.options.title === null) {
|
249 |
-
this.options.title = this.$element.attr('title');
|
250 |
-
}
|
251 |
-
|
252 |
-
//Expose public methods
|
253 |
-
this.val = Selectpicker.prototype.val;
|
254 |
-
this.render = Selectpicker.prototype.render;
|
255 |
-
this.refresh = Selectpicker.prototype.refresh;
|
256 |
-
this.setStyle = Selectpicker.prototype.setStyle;
|
257 |
-
this.selectAll = Selectpicker.prototype.selectAll;
|
258 |
-
this.deselectAll = Selectpicker.prototype.deselectAll;
|
259 |
-
this.destroy = Selectpicker.prototype.destroy;
|
260 |
-
this.remove = Selectpicker.prototype.remove;
|
261 |
-
this.show = Selectpicker.prototype.show;
|
262 |
-
this.hide = Selectpicker.prototype.hide;
|
263 |
-
|
264 |
-
this.init();
|
265 |
-
};
|
266 |
-
|
267 |
-
Selectpicker.VERSION = '1.10.0';
|
268 |
-
|
269 |
-
// part of this is duplicated in i18n/defaults-en_US.js. Make sure to update both.
|
270 |
-
Selectpicker.DEFAULTS = {
|
271 |
-
noneSelectedText: 'Nothing selected',
|
272 |
-
noneResultsText: 'No results matched {0}',
|
273 |
-
countSelectedText: function (numSelected, numTotal) {
|
274 |
-
return (numSelected == 1) ? "{0} item selected" : "{0} items selected";
|
275 |
-
},
|
276 |
-
maxOptionsText: function (numAll, numGroup) {
|
277 |
-
return [
|
278 |
-
(numAll == 1) ? 'Limit reached ({n} item max)' : 'Limit reached ({n} items max)',
|
279 |
-
(numGroup == 1) ? 'Group limit reached ({n} item max)' : 'Group limit reached ({n} items max)'
|
280 |
-
];
|
281 |
-
},
|
282 |
-
selectAllText: 'Select All',
|
283 |
-
deselectAllText: 'Deselect All',
|
284 |
-
doneButton: false,
|
285 |
-
doneButtonText: 'Close',
|
286 |
-
multipleSeparator: ', ',
|
287 |
-
styleBase: 'btn',
|
288 |
-
style: 'btn-default',
|
289 |
-
size: 'auto',
|
290 |
-
title: null,
|
291 |
-
selectedTextFormat: 'values',
|
292 |
-
width: false,
|
293 |
-
container: false,
|
294 |
-
hideDisabled: false,
|
295 |
-
showSubtext: false,
|
296 |
-
showIcon: true,
|
297 |
-
showContent: true,
|
298 |
-
dropupAuto: true,
|
299 |
-
header: false,
|
300 |
-
liveSearch: false,
|
301 |
-
liveSearchPlaceholder: null,
|
302 |
-
liveSearchNormalize: false,
|
303 |
-
liveSearchStyle: 'contains',
|
304 |
-
actionsBox: false,
|
305 |
-
iconBase: 'glyphicon',
|
306 |
-
tickIcon: 'glyphicon-ok',
|
307 |
-
showTick: false,
|
308 |
-
template: {
|
309 |
-
caret: '<span class="caret"></span>'
|
310 |
-
},
|
311 |
-
maxOptions: false,
|
312 |
-
mobile: false,
|
313 |
-
selectOnTab: false,
|
314 |
-
dropdownAlignRight: false
|
315 |
-
};
|
316 |
-
|
317 |
-
Selectpicker.prototype = {
|
318 |
-
|
319 |
-
constructor: Selectpicker,
|
320 |
-
|
321 |
-
init: function () {
|
322 |
-
var that = this,
|
323 |
-
id = this.$element.attr('id');
|
324 |
-
|
325 |
-
this.$element.addClass('bs-select-hidden');
|
326 |
-
|
327 |
-
// store originalIndex (key) and newIndex (value) in this.liObj for fast accessibility
|
328 |
-
// allows us to do this.$lis.eq(that.liObj[index]) instead of this.$lis.filter('[data-original-index="' + index + '"]')
|
329 |
-
this.liObj = {};
|
330 |
-
this.multiple = this.$element.prop('multiple');
|
331 |
-
this.autofocus = this.$element.prop('autofocus');
|
332 |
-
this.$newElement = this.createView();
|
333 |
-
this.$element
|
334 |
-
.after(this.$newElement)
|
335 |
-
.appendTo(this.$newElement);
|
336 |
-
this.$button = this.$newElement.children('button');
|
337 |
-
this.$menu = this.$newElement.children('.dropdown-menu');
|
338 |
-
this.$menuInner = this.$menu.children('.inner');
|
339 |
-
this.$searchbox = this.$menu.find('input');
|
340 |
-
|
341 |
-
this.$element.removeClass('bs-select-hidden');
|
342 |
-
|
343 |
-
if (this.options.dropdownAlignRight)
|
344 |
-
this.$menu.addClass('dropdown-menu-right');
|
345 |
-
|
346 |
-
if (typeof id !== 'undefined') {
|
347 |
-
this.$button.attr('data-id', id);
|
348 |
-
$('label[for="' + id + '"]').click(function (e) {
|
349 |
-
e.preventDefault();
|
350 |
-
that.$button.focus();
|
351 |
-
});
|
352 |
-
}
|
353 |
-
|
354 |
-
this.checkDisabled();
|
355 |
-
this.clickListener();
|
356 |
-
if (this.options.liveSearch) this.liveSearchListener();
|
357 |
-
this.render();
|
358 |
-
this.setStyle();
|
359 |
-
this.setWidth();
|
360 |
-
if (this.options.container) this.selectPosition();
|
361 |
-
this.$menu.data('this', this);
|
362 |
-
this.$newElement.data('this', this);
|
363 |
-
if (this.options.mobile) this.mobile();
|
364 |
-
|
365 |
-
this.$newElement.on({
|
366 |
-
'hide.bs.dropdown': function (e) {
|
367 |
-
that.$element.trigger('hide.bs.select', e);
|
368 |
-
},
|
369 |
-
'hidden.bs.dropdown': function (e) {
|
370 |
-
that.$element.trigger('hidden.bs.select', e);
|
371 |
-
},
|
372 |
-
'show.bs.dropdown': function (e) {
|
373 |
-
that.$element.trigger('show.bs.select', e);
|
374 |
-
},
|
375 |
-
'shown.bs.dropdown': function (e) {
|
376 |
-
that.$element.trigger('shown.bs.select', e);
|
377 |
-
}
|
378 |
-
});
|
379 |
-
|
380 |
-
if (that.$element[0].hasAttribute('required')) {
|
381 |
-
this.$element.on('invalid', function () {
|
382 |
-
that.$button
|
383 |
-
.addClass('bs-invalid')
|
384 |
-
.focus();
|
385 |
-
|
386 |
-
that.$element.on({
|
387 |
-
'focus.bs.select': function () {
|
388 |
-
that.$button.focus();
|
389 |
-
that.$element.off('focus.bs.select');
|
390 |
-
},
|
391 |
-
'shown.bs.select': function () {
|
392 |
-
that.$element
|
393 |
-
.val(that.$element.val()) // set the value to hide the validation message in Chrome when menu is opened
|
394 |
-
.off('shown.bs.select');
|
395 |
-
},
|
396 |
-
'rendered.bs.select': function () {
|
397 |
-
// if select is no longer invalid, remove the bs-invalid class
|
398 |
-
if (this.validity.valid) that.$button.removeClass('bs-invalid');
|
399 |
-
that.$element.off('rendered.bs.select');
|
400 |
-
}
|
401 |
-
});
|
402 |
-
|
403 |
-
});
|
404 |
-
}
|
405 |
-
|
406 |
-
setTimeout(function () {
|
407 |
-
that.$element.trigger('loaded.bs.select');
|
408 |
-
});
|
409 |
-
},
|
410 |
-
|
411 |
-
createDropdown: function () {
|
412 |
-
// Options
|
413 |
-
// If we are multiple or showTick option is set, then add the show-tick class
|
414 |
-
var showTick = (this.multiple || this.options.showTick) ? ' show-tick' : '',
|
415 |
-
inputGroup = this.$element.parent().hasClass('input-group') ? ' input-group-btn' : '',
|
416 |
-
autofocus = this.autofocus ? ' autofocus' : '';
|
417 |
-
// Elements
|
418 |
-
var header = this.options.header ? '<div class="popover-title"><button type="button" class="close" aria-hidden="true">×</button>' + this.options.header + '</div>' : '';
|
419 |
-
var searchbox = this.options.liveSearch ?
|
420 |
-
'<div class="bs-searchbox">' +
|
421 |
-
'<input type="text" class="form-control" autocomplete="off"' +
|
422 |
-
(null === this.options.liveSearchPlaceholder ? '' : ' placeholder="' + htmlEscape(this.options.liveSearchPlaceholder) + '"') + '>' +
|
423 |
-
'</div>'
|
424 |
-
: '';
|
425 |
-
var actionsbox = this.multiple && this.options.actionsBox ?
|
426 |
-
'<div class="bs-actionsbox">' +
|
427 |
-
'<div class="btn-group btn-group-sm btn-block">' +
|
428 |
-
'<button type="button" class="actions-btn bs-select-all btn btn-default">' +
|
429 |
-
this.options.selectAllText +
|
430 |
-
'</button>' +
|
431 |
-
'<button type="button" class="actions-btn bs-deselect-all btn btn-default">' +
|
432 |
-
this.options.deselectAllText +
|
433 |
-
'</button>' +
|
434 |
-
'</div>' +
|
435 |
-
'</div>'
|
436 |
-
: '';
|
437 |
-
var donebutton = this.multiple && this.options.doneButton ?
|
438 |
-
'<div class="bs-donebutton">' +
|
439 |
-
'<div class="btn-group btn-block">' +
|
440 |
-
'<button type="button" class="btn btn-sm btn-default">' +
|
441 |
-
this.options.doneButtonText +
|
442 |
-
'</button>' +
|
443 |
-
'</div>' +
|
444 |
-
'</div>'
|
445 |
-
: '';
|
446 |
-
var drop =
|
447 |
-
'<div class="btn-group bootstrap-select' + showTick + inputGroup + '">' +
|
448 |
-
'<button type="button" class="' + this.options.styleBase + ' dropdown-toggle" data-toggle="dropdown"' + autofocus + '>' +
|
449 |
-
'<span class="filter-option pull-left"></span> ' +
|
450 |
-
'<span class="bs-caret">' +
|
451 |
-
this.options.template.caret +
|
452 |
-
'</span>' +
|
453 |
-
'</button>' +
|
454 |
-
'<div class="dropdown-menu open">' +
|
455 |
-
header +
|
456 |
-
searchbox +
|
457 |
-
actionsbox +
|
458 |
-
'<ul class="dropdown-menu inner" role="menu">' +
|
459 |
-
'</ul>' +
|
460 |
-
donebutton +
|
461 |
-
'</div>' +
|
462 |
-
'</div>';
|
463 |
-
|
464 |
-
return $(drop);
|
465 |
-
},
|
466 |
-
|
467 |
-
createView: function () {
|
468 |
-
var $drop = this.createDropdown(),
|
469 |
-
li = this.createLi();
|
470 |
-
|
471 |
-
$drop.find('ul')[0].innerHTML = li;
|
472 |
-
return $drop;
|
473 |
-
},
|
474 |
-
|
475 |
-
reloadLi: function () {
|
476 |
-
//Remove all children.
|
477 |
-
this.destroyLi();
|
478 |
-
//Re build
|
479 |
-
var li = this.createLi();
|
480 |
-
this.$menuInner[0].innerHTML = li;
|
481 |
-
},
|
482 |
-
|
483 |
-
destroyLi: function () {
|
484 |
-
this.$menu.find('li').remove();
|
485 |
-
},
|
486 |
-
|
487 |
-
createLi: function () {
|
488 |
-
var that = this,
|
489 |
-
_li = [],
|
490 |
-
optID = 0,
|
491 |
-
titleOption = document.createElement('option'),
|
492 |
-
liIndex = -1; // increment liIndex whenever a new <li> element is created to ensure liObj is correct
|
493 |
-
|
494 |
-
// Helper functions
|
495 |
-
/**
|
496 |
-
* @param content
|
497 |
-
* @param [index]
|
498 |
-
* @param [classes]
|
499 |
-
* @param [optgroup]
|
500 |
-
* @returns {string}
|
501 |
-
*/
|
502 |
-
var generateLI = function (content, index, classes, optgroup) {
|
503 |
-
return '<li' +
|
504 |
-
((typeof classes !== 'undefined' & '' !== classes) ? ' class="' + classes + '"' : '') +
|
505 |
-
((typeof index !== 'undefined' & null !== index) ? ' data-original-index="' + index + '"' : '') +
|
506 |
-
((typeof optgroup !== 'undefined' & null !== optgroup) ? 'data-optgroup="' + optgroup + '"' : '') +
|
507 |
-
'>' + content + '</li>';
|
508 |
-
};
|
509 |
-
|
510 |
-
/**
|
511 |
-
* @param text
|
512 |
-
* @param [classes]
|
513 |
-
* @param [inline]
|
514 |
-
* @param [tokens]
|
515 |
-
* @returns {string}
|
516 |
-
*/
|
517 |
-
var generateA = function (text, classes, inline, tokens) {
|
518 |
-
return '<a tabindex="0"' +
|
519 |
-
(typeof classes !== 'undefined' ? ' class="' + classes + '"' : '') +
|
520 |
-
(typeof inline !== 'undefined' ? ' style="' + inline + '"' : '') +
|
521 |
-
(that.options.liveSearchNormalize ? ' data-normalized-text="' + normalizeToBase(htmlEscape(text)) + '"' : '') +
|
522 |
-
(typeof tokens !== 'undefined' || tokens !== null ? ' data-tokens="' + tokens + '"' : '') +
|
523 |
-
'>' + text +
|
524 |
-
'<span class="' + that.options.iconBase + ' ' + that.options.tickIcon + ' check-mark"></span>' +
|
525 |
-
'</a>';
|
526 |
-
};
|
527 |
-
|
528 |
-
if (this.options.title && !this.multiple) {
|
529 |
-
// this option doesn't create a new <li> element, but does add a new option, so liIndex is decreased
|
530 |
-
// since liObj is recalculated on every refresh, liIndex needs to be decreased even if the titleOption is already appended
|
531 |
-
liIndex--;
|
532 |
-
|
533 |
-
if (!this.$element.find('.bs-title-option').length) {
|
534 |
-
// Use native JS to prepend option (faster)
|
535 |
-
var element = this.$element[0];
|
536 |
-
titleOption.className = 'bs-title-option';
|
537 |
-
titleOption.appendChild(document.createTextNode(this.options.title));
|
538 |
-
titleOption.value = '';
|
539 |
-
element.insertBefore(titleOption, element.firstChild);
|
540 |
-
// Check if selected attribute is already set on an option. If not, select the titleOption option.
|
541 |
-
if ($(element.options[element.selectedIndex]).attr('selected') === undefined) titleOption.selected = true;
|
542 |
-
}
|
543 |
-
}
|
544 |
-
|
545 |
-
this.$element.find('option').each(function (index) {
|
546 |
-
var $this = $(this);
|
547 |
-
|
548 |
-
liIndex++;
|
549 |
-
|
550 |
-
if ($this.hasClass('bs-title-option')) return;
|
551 |
-
|
552 |
-
// Get the class and text for the option
|
553 |
-
var optionClass = this.className || '',
|
554 |
-
inline = this.style.cssText,
|
555 |
-
text = $this.data('content') ? $this.data('content') : $this.html(),
|
556 |
-
tokens = $this.data('tokens') ? $this.data('tokens') : null,
|
557 |
-
subtext = typeof $this.data('subtext') !== 'undefined' ? '<small class="text-muted">' + $this.data('subtext') + '</small>' : '',
|
558 |
-
icon = typeof $this.data('icon') !== 'undefined' ? '<span class="' + that.options.iconBase + ' ' + $this.data('icon') + '"></span> ' : '',
|
559 |
-
isOptgroup = this.parentNode.tagName === 'OPTGROUP',
|
560 |
-
isDisabled = this.disabled || (isOptgroup && this.parentNode.disabled);
|
561 |
-
|
562 |
-
if (icon !== '' && isDisabled) {
|
563 |
-
icon = '<span>' + icon + '</span>';
|
564 |
-
}
|
565 |
-
|
566 |
-
if (that.options.hideDisabled && isDisabled && !isOptgroup) {
|
567 |
-
liIndex--;
|
568 |
-
return;
|
569 |
-
}
|
570 |
-
|
571 |
-
if (!$this.data('content')) {
|
572 |
-
// Prepend any icon and append any subtext to the main text.
|
573 |
-
text = icon + '<span class="text">' + text + subtext + '</span>';
|
574 |
-
}
|
575 |
-
|
576 |
-
if (isOptgroup && $this.data('divider') !== true) {
|
577 |
-
var optGroupClass = ' ' + this.parentNode.className || '';
|
578 |
-
|
579 |
-
if ($this.index() === 0) { // Is it the first option of the optgroup?
|
580 |
-
optID += 1;
|
581 |
-
|
582 |
-
// Get the opt group label
|
583 |
-
var label = this.parentNode.label,
|
584 |
-
labelSubtext = typeof $this.parent().data('subtext') !== 'undefined' ? '<small class="text-muted">' + $this.parent().data('subtext') + '</small>' : '',
|
585 |
-
labelIcon = $this.parent().data('icon') ? '<span class="' + that.options.iconBase + ' ' + $this.parent().data('icon') + '"></span> ' : '';
|
586 |
-
|
587 |
-
label = labelIcon + '<span class="text">' + label + labelSubtext + '</span>';
|
588 |
-
|
589 |
-
if (index !== 0 && _li.length > 0) { // Is it NOT the first option of the select && are there elements in the dropdown?
|
590 |
-
liIndex++;
|
591 |
-
_li.push(generateLI('', null, 'divider', optID + 'div'));
|
592 |
-
}
|
593 |
-
liIndex++;
|
594 |
-
_li.push(generateLI(label, null, 'dropdown-header' + optGroupClass, optID));
|
595 |
-
}
|
596 |
-
|
597 |
-
if (that.options.hideDisabled && isDisabled) {
|
598 |
-
liIndex--;
|
599 |
-
return;
|
600 |
-
}
|
601 |
-
|
602 |
-
_li.push(generateLI(generateA(text, 'opt ' + optionClass + optGroupClass, inline, tokens), index, '', optID));
|
603 |
-
} else if ($this.data('divider') === true) {
|
604 |
-
_li.push(generateLI('', index, 'divider'));
|
605 |
-
} else if ($this.data('hidden') === true) {
|
606 |
-
_li.push(generateLI(generateA(text, optionClass, inline, tokens), index, 'hidden is-hidden'));
|
607 |
-
} else {
|
608 |
-
if (this.previousElementSibling && this.previousElementSibling.tagName === 'OPTGROUP') {
|
609 |
-
liIndex++;
|
610 |
-
_li.push(generateLI('', null, 'divider', optID + 'div'));
|
611 |
-
}
|
612 |
-
_li.push(generateLI(generateA(text, optionClass, inline, tokens), index));
|
613 |
-
}
|
614 |
-
|
615 |
-
that.liObj[index] = liIndex;
|
616 |
-
});
|
617 |
-
|
618 |
-
//If we are not multiple, we don't have a selected item, and we don't have a title, select the first element so something is set in the button
|
619 |
-
if (!this.multiple && this.$element.find('option:selected').length === 0 && !this.options.title) {
|
620 |
-
this.$element.find('option').eq(0).prop('selected', true).attr('selected', 'selected');
|
621 |
-
}
|
622 |
-
|
623 |
-
return _li.join('');
|
624 |
-
},
|
625 |
-
|
626 |
-
findLis: function () {
|
627 |
-
if (this.$lis == null) this.$lis = this.$menu.find('li');
|
628 |
-
return this.$lis;
|
629 |
-
},
|
630 |
-
|
631 |
-
/**
|
632 |
-
* @param [updateLi] defaults to true
|
633 |
-
*/
|
634 |
-
render: function (updateLi) {
|
635 |
-
var that = this,
|
636 |
-
notDisabled;
|
637 |
-
|
638 |
-
//Update the LI to match the SELECT
|
639 |
-
if (updateLi !== false) {
|
640 |
-
this.$element.find('option').each(function (index) {
|
641 |
-
var $lis = that.findLis().eq(that.liObj[index]);
|
642 |
-
|
643 |
-
that.setDisabled(index, this.disabled || this.parentNode.tagName === 'OPTGROUP' && this.parentNode.disabled, $lis);
|
644 |
-
that.setSelected(index, this.selected, $lis);
|
645 |
-
});
|
646 |
-
}
|
647 |
-
|
648 |
-
this.tabIndex();
|
649 |
-
|
650 |
-
var selectedItems = this.$element.find('option').map(function () {
|
651 |
-
if (this.selected) {
|
652 |
-
if (that.options.hideDisabled && (this.disabled || this.parentNode.tagName === 'OPTGROUP' && this.parentNode.disabled)) return;
|
653 |
-
|
654 |
-
var $this = $(this),
|
655 |
-
icon = $this.data('icon') && that.options.showIcon ? '<i class="' + that.options.iconBase + ' ' + $this.data('icon') + '"></i> ' : '',
|
656 |
-
subtext;
|
657 |
-
|
658 |
-
if (that.options.showSubtext && $this.data('subtext') && !that.multiple) {
|
659 |
-
subtext = ' <small class="text-muted">' + $this.data('subtext') + '</small>';
|
660 |
-
} else {
|
661 |
-
subtext = '';
|
662 |
-
}
|
663 |
-
if (typeof $this.attr('title') !== 'undefined') {
|
664 |
-
return $this.attr('title');
|
665 |
-
} else if ($this.data('content') && that.options.showContent) {
|
666 |
-
return $this.data('content');
|
667 |
-
} else {
|
668 |
-
return icon + $this.html() + subtext;
|
669 |
-
}
|
670 |
-
}
|
671 |
-
}).toArray();
|
672 |
-
|
673 |
-
//Fixes issue in IE10 occurring when no default option is selected and at least one option is disabled
|
674 |
-
//Convert all the values into a comma delimited string
|
675 |
-
var title = !this.multiple ? selectedItems[0] : selectedItems.join(this.options.multipleSeparator);
|
676 |
-
|
677 |
-
//If this is multi select, and the selectText type is count, the show 1 of 2 selected etc..
|
678 |
-
if (this.multiple && this.options.selectedTextFormat.indexOf('count') > -1) {
|
679 |
-
var max = this.options.selectedTextFormat.split('>');
|
680 |
-
if ((max.length > 1 && selectedItems.length > max[1]) || (max.length == 1 && selectedItems.length >= 2)) {
|
681 |
-
notDisabled = this.options.hideDisabled ? ', [disabled]' : '';
|
682 |
-
var totalCount = this.$element.find('option').not('[data-divider="true"], [data-hidden="true"]' + notDisabled).length,
|
683 |
-
tr8nText = (typeof this.options.countSelectedText === 'function') ? this.options.countSelectedText(selectedItems.length, totalCount) : this.options.countSelectedText;
|
684 |
-
title = tr8nText.replace('{0}', selectedItems.length.toString()).replace('{1}', totalCount.toString());
|
685 |
-
}
|
686 |
-
}
|
687 |
-
|
688 |
-
if (this.options.title == undefined) {
|
689 |
-
this.options.title = this.$element.attr('title');
|
690 |
-
}
|
691 |
-
|
692 |
-
if (this.options.selectedTextFormat == 'static') {
|
693 |
-
title = this.options.title;
|
694 |
-
}
|
695 |
-
|
696 |
-
//If we dont have a title, then use the default, or if nothing is set at all, use the not selected text
|
697 |
-
if (!title) {
|
698 |
-
title = typeof this.options.title !== 'undefined' ? this.options.title : this.options.noneSelectedText;
|
699 |
-
}
|
700 |
-
|
701 |
-
//strip all html-tags and trim the result
|
702 |
-
// this.$button.attr('title', $.trim(title.replace(/<[^>]*>?/g, '')));
|
703 |
-
this.$button.children('.filter-option').html(title);
|
704 |
-
|
705 |
-
this.$element.trigger('rendered.bs.select');
|
706 |
-
},
|
707 |
-
|
708 |
-
/**
|
709 |
-
* @param [style]
|
710 |
-
* @param [status]
|
711 |
-
*/
|
712 |
-
setStyle: function (style, status) {
|
713 |
-
if (this.$element.attr('class')) {
|
714 |
-
this.$newElement.addClass(this.$element.attr('class').replace(/selectpicker|mobile-device|bs-select-hidden|validate\[.*\]/gi, ''));
|
715 |
-
}
|
716 |
-
|
717 |
-
var buttonClass = style ? style : this.options.style;
|
718 |
-
|
719 |
-
if (status == 'add') {
|
720 |
-
this.$button.addClass(buttonClass);
|
721 |
-
} else if (status == 'remove') {
|
722 |
-
this.$button.removeClass(buttonClass);
|
723 |
-
} else {
|
724 |
-
this.$button.removeClass(this.options.style);
|
725 |
-
this.$button.addClass(buttonClass);
|
726 |
-
}
|
727 |
-
},
|
728 |
-
|
729 |
-
liHeight: function (refresh) {
|
730 |
-
if (!refresh && (this.options.size === false || this.sizeInfo)) return;
|
731 |
-
|
732 |
-
var newElement = document.createElement('div'),
|
733 |
-
menu = document.createElement('div'),
|
734 |
-
menuInner = document.createElement('ul'),
|
735 |
-
divider = document.createElement('li'),
|
736 |
-
li = document.createElement('li'),
|
737 |
-
a = document.createElement('a'),
|
738 |
-
text = document.createElement('span'),
|
739 |
-
header = this.options.header && this.$menu.find('.popover-title').length > 0 ? this.$menu.find('.popover-title')[0].cloneNode(true) : null,
|
740 |
-
search = this.options.liveSearch ? document.createElement('div') : null,
|
741 |
-
actions = this.options.actionsBox && this.multiple && this.$menu.find('.bs-actionsbox').length > 0 ? this.$menu.find('.bs-actionsbox')[0].cloneNode(true) : null,
|
742 |
-
doneButton = this.options.doneButton && this.multiple && this.$menu.find('.bs-donebutton').length > 0 ? this.$menu.find('.bs-donebutton')[0].cloneNode(true) : null;
|
743 |
-
|
744 |
-
text.className = 'text';
|
745 |
-
newElement.className = this.$menu[0].parentNode.className + ' open';
|
746 |
-
menu.className = 'dropdown-menu open';
|
747 |
-
menuInner.className = 'dropdown-menu inner';
|
748 |
-
divider.className = 'divider';
|
749 |
-
|
750 |
-
text.appendChild(document.createTextNode('Inner text'));
|
751 |
-
a.appendChild(text);
|
752 |
-
li.appendChild(a);
|
753 |
-
menuInner.appendChild(li);
|
754 |
-
menuInner.appendChild(divider);
|
755 |
-
if (header) menu.appendChild(header);
|
756 |
-
if (search) {
|
757 |
-
// create a span instead of input as creating an input element is slower
|
758 |
-
var input = document.createElement('span');
|
759 |
-
search.className = 'bs-searchbox';
|
760 |
-
input.className = 'form-control';
|
761 |
-
search.appendChild(input);
|
762 |
-
menu.appendChild(search);
|
763 |
-
}
|
764 |
-
if (actions) menu.appendChild(actions);
|
765 |
-
menu.appendChild(menuInner);
|
766 |
-
if (doneButton) menu.appendChild(doneButton);
|
767 |
-
newElement.appendChild(menu);
|
768 |
-
|
769 |
-
document.body.appendChild(newElement);
|
770 |
-
|
771 |
-
var liHeight = a.offsetHeight,
|
772 |
-
headerHeight = header ? header.offsetHeight : 0,
|
773 |
-
searchHeight = search ? search.offsetHeight : 0,
|
774 |
-
actionsHeight = actions ? actions.offsetHeight : 0,
|
775 |
-
doneButtonHeight = doneButton ? doneButton.offsetHeight : 0,
|
776 |
-
dividerHeight = $(divider).outerHeight(true),
|
777 |
-
// fall back to jQuery if getComputedStyle is not supported
|
778 |
-
menuStyle = typeof getComputedStyle === 'function' ? getComputedStyle(menu) : false,
|
779 |
-
$menu = menuStyle ? null : $(menu),
|
780 |
-
menuPadding = parseInt(menuStyle ? menuStyle.paddingTop : $menu.css('paddingTop')) +
|
781 |
-
parseInt(menuStyle ? menuStyle.paddingBottom : $menu.css('paddingBottom')) +
|
782 |
-
parseInt(menuStyle ? menuStyle.borderTopWidth : $menu.css('borderTopWidth')) +
|
783 |
-
parseInt(menuStyle ? menuStyle.borderBottomWidth : $menu.css('borderBottomWidth')),
|
784 |
-
menuExtras = menuPadding +
|
785 |
-
parseInt(menuStyle ? menuStyle.marginTop : $menu.css('marginTop')) +
|
786 |
-
parseInt(menuStyle ? menuStyle.marginBottom : $menu.css('marginBottom')) + 2;
|
787 |
-
|
788 |
-
document.body.removeChild(newElement);
|
789 |
-
|
790 |
-
this.sizeInfo = {
|
791 |
-
liHeight: liHeight,
|
792 |
-
headerHeight: headerHeight,
|
793 |
-
searchHeight: searchHeight,
|
794 |
-
actionsHeight: actionsHeight,
|
795 |
-
doneButtonHeight: doneButtonHeight,
|
796 |
-
dividerHeight: dividerHeight,
|
797 |
-
menuPadding: menuPadding,
|
798 |
-
menuExtras: menuExtras
|
799 |
-
};
|
800 |
-
},
|
801 |
-
|
802 |
-
setSize: function () {
|
803 |
-
this.findLis();
|
804 |
-
this.liHeight();
|
805 |
-
|
806 |
-
if (this.options.header) this.$menu.css('padding-top', 0);
|
807 |
-
if (this.options.size === false) return;
|
808 |
-
|
809 |
-
var that = this,
|
810 |
-
$menu = this.$menu,
|
811 |
-
$menuInner = this.$menuInner,
|
812 |
-
$window = $(window),
|
813 |
-
selectHeight = this.$newElement[0].offsetHeight,
|
814 |
-
liHeight = this.sizeInfo['liHeight'],
|
815 |
-
headerHeight = this.sizeInfo['headerHeight'],
|
816 |
-
searchHeight = this.sizeInfo['searchHeight'],
|
817 |
-
actionsHeight = this.sizeInfo['actionsHeight'],
|
818 |
-
doneButtonHeight = this.sizeInfo['doneButtonHeight'],
|
819 |
-
divHeight = this.sizeInfo['dividerHeight'],
|
820 |
-
menuPadding = this.sizeInfo['menuPadding'],
|
821 |
-
menuExtras = this.sizeInfo['menuExtras'],
|
822 |
-
notDisabled = this.options.hideDisabled ? '.disabled' : '',
|
823 |
-
menuHeight,
|
824 |
-
getHeight,
|
825 |
-
selectOffsetTop,
|
826 |
-
selectOffsetBot,
|
827 |
-
posVert = function () {
|
828 |
-
selectOffsetTop = that.$newElement.offset().top - $window.scrollTop();
|
829 |
-
selectOffsetBot = $window.height() - selectOffsetTop - selectHeight;
|
830 |
-
};
|
831 |
-
|
832 |
-
posVert();
|
833 |
-
|
834 |
-
if (this.options.size === 'auto') {
|
835 |
-
var getSize = function () {
|
836 |
-
var minHeight,
|
837 |
-
hasClass = function (className, include) {
|
838 |
-
return function (element) {
|
839 |
-
if (include) {
|
840 |
-
return (element.classList ? element.classList.contains(className) : $(element).hasClass(className));
|
841 |
-
} else {
|
842 |
-
return !(element.classList ? element.classList.contains(className) : $(element).hasClass(className));
|
843 |
-
}
|
844 |
-
};
|
845 |
-
},
|
846 |
-
lis = that.$menuInner[0].getElementsByTagName('li'),
|
847 |
-
lisVisible = Array.prototype.filter ? Array.prototype.filter.call(lis, hasClass('hidden', false)) : that.$lis.not('.hidden'),
|
848 |
-
optGroup = Array.prototype.filter ? Array.prototype.filter.call(lisVisible, hasClass('dropdown-header', true)) : lisVisible.filter('.dropdown-header');
|
849 |
-
|
850 |
-
posVert();
|
851 |
-
menuHeight = selectOffsetBot - menuExtras;
|
852 |
-
|
853 |
-
if (that.options.container) {
|
854 |
-
if (!$menu.data('height')) $menu.data('height', $menu.height());
|
855 |
-
getHeight = $menu.data('height');
|
856 |
-
} else {
|
857 |
-
getHeight = $menu.height();
|
858 |
-
}
|
859 |
-
|
860 |
-
if (that.options.dropupAuto) {
|
861 |
-
that.$newElement.toggleClass('dropup', selectOffsetTop > selectOffsetBot && (menuHeight - menuExtras) < getHeight);
|
862 |
-
}
|
863 |
-
if (that.$newElement.hasClass('dropup')) {
|
864 |
-
menuHeight = selectOffsetTop - menuExtras;
|
865 |
-
}
|
866 |
-
|
867 |
-
if ((lisVisible.length + optGroup.length) > 3) {
|
868 |
-
minHeight = liHeight * 3 + menuExtras - 2;
|
869 |
-
} else {
|
870 |
-
minHeight = 0;
|
871 |
-
}
|
872 |
-
|
873 |
-
$menu.css({
|
874 |
-
'max-height': menuHeight + 'px',
|
875 |
-
'overflow': 'hidden',
|
876 |
-
'min-height': minHeight + headerHeight + searchHeight + actionsHeight + doneButtonHeight + 'px'
|
877 |
-
});
|
878 |
-
$menuInner.css({
|
879 |
-
'max-height': menuHeight - headerHeight - searchHeight - actionsHeight - doneButtonHeight - menuPadding + 'px',
|
880 |
-
'overflow-y': 'auto',
|
881 |
-
'min-height': Math.max(minHeight - menuPadding, 0) + 'px'
|
882 |
-
});
|
883 |
-
};
|
884 |
-
getSize();
|
885 |
-
this.$searchbox.off('input.getSize propertychange.getSize').on('input.getSize propertychange.getSize', getSize);
|
886 |
-
$window.off('resize.getSize scroll.getSize').on('resize.getSize scroll.getSize', getSize);
|
887 |
-
} else if (this.options.size && this.options.size != 'auto' && this.$lis.not(notDisabled).length > this.options.size) {
|
888 |
-
var optIndex = this.$lis.not('.divider').not(notDisabled).children().slice(0, this.options.size).last().parent().index(),
|
889 |
-
divLength = this.$lis.slice(0, optIndex + 1).filter('.divider').length;
|
890 |
-
menuHeight = liHeight * this.options.size + divLength * divHeight + menuPadding;
|
891 |
-
|
892 |
-
if (that.options.container) {
|
893 |
-
if (!$menu.data('height')) $menu.data('height', $menu.height());
|
894 |
-
getHeight = $menu.data('height');
|
895 |
-
} else {
|
896 |
-
getHeight = $menu.height();
|
897 |
-
}
|
898 |
-
|
899 |
-
if (that.options.dropupAuto) {
|
900 |
-
//noinspection JSUnusedAssignment
|
901 |
-
this.$newElement.toggleClass('dropup', selectOffsetTop > selectOffsetBot && (menuHeight - menuExtras) < getHeight);
|
902 |
-
}
|
903 |
-
$menu.css({
|
904 |
-
'max-height': menuHeight + headerHeight + searchHeight + actionsHeight + doneButtonHeight + 'px',
|
905 |
-
'overflow': 'hidden',
|
906 |
-
'min-height': ''
|
907 |
-
});
|
908 |
-
$menuInner.css({
|
909 |
-
'max-height': menuHeight - menuPadding + 'px',
|
910 |
-
'overflow-y': 'auto',
|
911 |
-
'min-height': ''
|
912 |
-
});
|
913 |
-
}
|
914 |
-
},
|
915 |
-
|
916 |
-
setWidth: function () {
|
917 |
-
if (this.options.width === 'auto') {
|
918 |
-
this.$menu.css('min-width', '0');
|
919 |
-
|
920 |
-
// Get correct width if element is hidden
|
921 |
-
var $selectClone = this.$menu.parent().clone().appendTo('body'),
|
922 |
-
$selectClone2 = this.options.container ? this.$newElement.clone().appendTo('body') : $selectClone,
|
923 |
-
ulWidth = $selectClone.children('.dropdown-menu').outerWidth(),
|
924 |
-
btnWidth = $selectClone2.css('width', 'auto').children('button').outerWidth();
|
925 |
-
|
926 |
-
$selectClone.remove();
|
927 |
-
$selectClone2.remove();
|
928 |
-
|
929 |
-
// Set width to whatever's larger, button title or longest option
|
930 |
-
this.$newElement.css('width', Math.max(ulWidth, btnWidth) + 'px');
|
931 |
-
} else if (this.options.width === 'fit') {
|
932 |
-
// Remove inline min-width so width can be changed from 'auto'
|
933 |
-
this.$menu.css('min-width', '');
|
934 |
-
this.$newElement.css('width', '').addClass('fit-width');
|
935 |
-
} else if (this.options.width) {
|
936 |
-
// Remove inline min-width so width can be changed from 'auto'
|
937 |
-
this.$menu.css('min-width', '');
|
938 |
-
this.$newElement.css('width', this.options.width);
|
939 |
-
} else {
|
940 |
-
// Remove inline min-width/width so width can be changed
|
941 |
-
this.$menu.css('min-width', '');
|
942 |
-
this.$newElement.css('width', '');
|
943 |
-
}
|
944 |
-
// Remove fit-width class if width is changed programmatically
|
945 |
-
if (this.$newElement.hasClass('fit-width') && this.options.width !== 'fit') {
|
946 |
-
this.$newElement.removeClass('fit-width');
|
947 |
-
}
|
948 |
-
},
|
949 |
-
|
950 |
-
selectPosition: function () {
|
951 |
-
this.$bsContainer = $('<div class="bs-container" />');
|
952 |
-
|
953 |
-
var that = this,
|
954 |
-
pos,
|
955 |
-
actualHeight,
|
956 |
-
getPlacement = function ($element) {
|
957 |
-
that.$bsContainer.addClass($element.attr('class').replace(/form-control|fit-width/gi, '')).toggleClass('dropup', $element.hasClass('dropup'));
|
958 |
-
pos = $element.offset();
|
959 |
-
actualHeight = $element.hasClass('dropup') ? 0 : $element[0].offsetHeight;
|
960 |
-
that.$bsContainer.css({
|
961 |
-
'top': pos.top + actualHeight,
|
962 |
-
'left': pos.left,
|
963 |
-
'width': $element[0].offsetWidth
|
964 |
-
});
|
965 |
-
};
|
966 |
-
|
967 |
-
this.$button.on('click', function () {
|
968 |
-
var $this = $(this);
|
969 |
-
|
970 |
-
if (that.isDisabled()) {
|
971 |
-
return;
|
972 |
-
}
|
973 |
-
|
974 |
-
getPlacement(that.$newElement);
|
975 |
-
|
976 |
-
that.$bsContainer
|
977 |
-
.appendTo(that.options.container)
|
978 |
-
.toggleClass('open', !$this.hasClass('open'))
|
979 |
-
.append(that.$menu);
|
980 |
-
});
|
981 |
-
|
982 |
-
$(window).on('resize scroll', function () {
|
983 |
-
getPlacement(that.$newElement);
|
984 |
-
});
|
985 |
-
|
986 |
-
this.$element.on('hide.bs.select', function () {
|
987 |
-
that.$menu.data('height', that.$menu.height());
|
988 |
-
that.$bsContainer.detach();
|
989 |
-
});
|
990 |
-
},
|
991 |
-
|
992 |
-
setSelected: function (index, selected, $lis) {
|
993 |
-
if (!$lis) {
|
994 |
-
$lis = this.findLis().eq(this.liObj[index]);
|
995 |
-
}
|
996 |
-
|
997 |
-
$lis.toggleClass('selected', selected);
|
998 |
-
},
|
999 |
-
|
1000 |
-
setDisabled: function (index, disabled, $lis) {
|
1001 |
-
if (!$lis) {
|
1002 |
-
$lis = this.findLis().eq(this.liObj[index]);
|
1003 |
-
}
|
1004 |
-
|
1005 |
-
if (disabled) {
|
1006 |
-
$lis.addClass('disabled').children('a').attr('href', '#').attr('tabindex', -1);
|
1007 |
-
} else {
|
1008 |
-
$lis.removeClass('disabled').children('a').removeAttr('href').attr('tabindex', 0);
|
1009 |
-
}
|
1010 |
-
},
|
1011 |
-
|
1012 |
-
isDisabled: function () {
|
1013 |
-
return this.$element[0].disabled;
|
1014 |
-
},
|
1015 |
-
|
1016 |
-
checkDisabled: function () {
|
1017 |
-
var that = this;
|
1018 |
-
|
1019 |
-
if (this.isDisabled()) {
|
1020 |
-
this.$newElement.addClass('disabled');
|
1021 |
-
this.$button.addClass('disabled').attr('tabindex', -1);
|
1022 |
-
} else {
|
1023 |
-
if (this.$button.hasClass('disabled')) {
|
1024 |
-
this.$newElement.removeClass('disabled');
|
1025 |
-
this.$button.removeClass('disabled');
|
1026 |
-
}
|
1027 |
-
|
1028 |
-
if (this.$button.attr('tabindex') == -1 && !this.$element.data('tabindex')) {
|
1029 |
-
this.$button.removeAttr('tabindex');
|
1030 |
-
}
|
1031 |
-
}
|
1032 |
-
|
1033 |
-
this.$button.click(function () {
|
1034 |
-
return !that.isDisabled();
|
1035 |
-
});
|
1036 |
-
},
|
1037 |
-
|
1038 |
-
tabIndex: function () {
|
1039 |
-
if (this.$element.data('tabindex') !== this.$element.attr('tabindex') &&
|
1040 |
-
(this.$element.attr('tabindex') !== -98 && this.$element.attr('tabindex') !== '-98')) {
|
1041 |
-
this.$element.data('tabindex', this.$element.attr('tabindex'));
|
1042 |
-
this.$button.attr('tabindex', this.$element.data('tabindex'));
|
1043 |
-
}
|
1044 |
-
|
1045 |
-
this.$element.attr('tabindex', -98);
|
1046 |
-
},
|
1047 |
-
|
1048 |
-
clickListener: function () {
|
1049 |
-
var that = this,
|
1050 |
-
$document = $(document);
|
1051 |
-
|
1052 |
-
this.$newElement.on('touchstart.dropdown', '.dropdown-menu', function (e) {
|
1053 |
-
e.stopPropagation();
|
1054 |
-
});
|
1055 |
-
|
1056 |
-
$document.data('spaceSelect', false);
|
1057 |
-
|
1058 |
-
this.$button.on('keyup', function (e) {
|
1059 |
-
if (/(32)/.test(e.keyCode.toString(10)) && $document.data('spaceSelect')) {
|
1060 |
-
e.preventDefault();
|
1061 |
-
$document.data('spaceSelect', false);
|
1062 |
-
}
|
1063 |
-
});
|
1064 |
-
|
1065 |
-
this.$button.on('click', function () {
|
1066 |
-
that.setSize();
|
1067 |
-
});
|
1068 |
-
|
1069 |
-
this.$element.on('shown.bs.select', function () {
|
1070 |
-
if (!that.options.liveSearch && !that.multiple) {
|
1071 |
-
that.$menuInner.find('.selected a').focus();
|
1072 |
-
} else if (!that.multiple) {
|
1073 |
-
var selectedIndex = that.liObj[that.$element[0].selectedIndex];
|
1074 |
-
|
1075 |
-
if (typeof selectedIndex !== 'number' || that.options.size === false) return;
|
1076 |
-
|
1077 |
-
// scroll to selected option
|
1078 |
-
var offset = that.$lis.eq(selectedIndex)[0].offsetTop - that.$menuInner[0].offsetTop;
|
1079 |
-
offset = offset - that.$menuInner[0].offsetHeight/2 + that.sizeInfo.liHeight/2;
|
1080 |
-
that.$menuInner[0].scrollTop = offset;
|
1081 |
-
}
|
1082 |
-
});
|
1083 |
-
|
1084 |
-
this.$menuInner.on('click', 'li a', function (e) {
|
1085 |
-
var $this = $(this),
|
1086 |
-
clickedIndex = $this.parent().data('originalIndex'),
|
1087 |
-
prevValue = that.$element.val(),
|
1088 |
-
prevIndex = that.$element.prop('selectedIndex');
|
1089 |
-
|
1090 |
-
// Don't close on multi choice menu
|
1091 |
-
if (that.multiple) {
|
1092 |
-
e.stopPropagation();
|
1093 |
-
}
|
1094 |
-
|
1095 |
-
e.preventDefault();
|
1096 |
-
|
1097 |
-
//Don't run if we have been disabled
|
1098 |
-
if (!that.isDisabled() && !$this.parent().hasClass('disabled')) {
|
1099 |
-
var $options = that.$element.find('option'),
|
1100 |
-
$option = $options.eq(clickedIndex),
|
1101 |
-
state = $option.prop('selected'),
|
1102 |
-
$optgroup = $option.parent('optgroup'),
|
1103 |
-
maxOptions = that.options.maxOptions,
|
1104 |
-
maxOptionsGrp = $optgroup.data('maxOptions') || false;
|
1105 |
-
|
1106 |
-
if (!that.multiple) { // Deselect all others if not multi select box
|
1107 |
-
$options.prop('selected', false);
|
1108 |
-
$option.prop('selected', true);
|
1109 |
-
that.$menuInner.find('.selected').removeClass('selected');
|
1110 |
-
that.setSelected(clickedIndex, true);
|
1111 |
-
} else { // Toggle the one we have chosen if we are multi select.
|
1112 |
-
$option.prop('selected', !state);
|
1113 |
-
that.setSelected(clickedIndex, !state);
|
1114 |
-
$this.blur();
|
1115 |
-
|
1116 |
-
if (maxOptions !== false || maxOptionsGrp !== false) {
|
1117 |
-
var maxReached = maxOptions < $options.filter(':selected').length,
|
1118 |
-
maxReachedGrp = maxOptionsGrp < $optgroup.find('option:selected').length;
|
1119 |
-
|
1120 |
-
if ((maxOptions && maxReached) || (maxOptionsGrp && maxReachedGrp)) {
|
1121 |
-
if (maxOptions && maxOptions == 1) {
|
1122 |
-
$options.prop('selected', false);
|
1123 |
-
$option.prop('selected', true);
|
1124 |
-
that.$menuInner.find('.selected').removeClass('selected');
|
1125 |
-
that.setSelected(clickedIndex, true);
|
1126 |
-
} else if (maxOptionsGrp && maxOptionsGrp == 1) {
|
1127 |
-
$optgroup.find('option:selected').prop('selected', false);
|
1128 |
-
$option.prop('selected', true);
|
1129 |
-
var optgroupID = $this.parent().data('optgroup');
|
1130 |
-
that.$menuInner.find('[data-optgroup="' + optgroupID + '"]').removeClass('selected');
|
1131 |
-
that.setSelected(clickedIndex, true);
|
1132 |
-
} else {
|
1133 |
-
var maxOptionsArr = (typeof that.options.maxOptionsText === 'function') ?
|
1134 |
-
that.options.maxOptionsText(maxOptions, maxOptionsGrp) : that.options.maxOptionsText,
|
1135 |
-
maxTxt = maxOptionsArr[0].replace('{n}', maxOptions),
|
1136 |
-
maxTxtGrp = maxOptionsArr[1].replace('{n}', maxOptionsGrp),
|
1137 |
-
$notify = $('<div class="notify"></div>');
|
1138 |
-
// If {var} is set in array, replace it
|
1139 |
-
/** @deprecated */
|
1140 |
-
if (maxOptionsArr[2]) {
|
1141 |
-
maxTxt = maxTxt.replace('{var}', maxOptionsArr[2][maxOptions > 1 ? 0 : 1]);
|
1142 |
-
maxTxtGrp = maxTxtGrp.replace('{var}', maxOptionsArr[2][maxOptionsGrp > 1 ? 0 : 1]);
|
1143 |
-
}
|
1144 |
-
|
1145 |
-
$option.prop('selected', false);
|
1146 |
-
|
1147 |
-
that.$menu.append($notify);
|
1148 |
-
|
1149 |
-
if (maxOptions && maxReached) {
|
1150 |
-
$notify.append($('<div>' + maxTxt + '</div>'));
|
1151 |
-
that.$element.trigger('maxReached.bs.select');
|
1152 |
-
}
|
1153 |
-
|
1154 |
-
if (maxOptionsGrp && maxReachedGrp) {
|
1155 |
-
$notify.append($('<div>' + maxTxtGrp + '</div>'));
|
1156 |
-
that.$element.trigger('maxReachedGrp.bs.select');
|
1157 |
-
}
|
1158 |
-
|
1159 |
-
setTimeout(function () {
|
1160 |
-
that.setSelected(clickedIndex, false);
|
1161 |
-
}, 10);
|
1162 |
-
|
1163 |
-
$notify.delay(750).fadeOut(300, function () {
|
1164 |
-
$(this).remove();
|
1165 |
-
});
|
1166 |
-
}
|
1167 |
-
}
|
1168 |
-
}
|
1169 |
-
}
|
1170 |
-
|
1171 |
-
if (!that.multiple) {
|
1172 |
-
that.$button.focus();
|
1173 |
-
} else if (that.options.liveSearch) {
|
1174 |
-
that.$searchbox.focus();
|
1175 |
-
}
|
1176 |
-
|
1177 |
-
// Trigger select 'change'
|
1178 |
-
if ((prevValue != that.$element.val() && that.multiple) || (prevIndex != that.$element.prop('selectedIndex') && !that.multiple)) {
|
1179 |
-
// $option.prop('selected') is current option state (selected/unselected). state is previous option state.
|
1180 |
-
that.$element
|
1181 |
-
.trigger('changed.bs.select', [clickedIndex, $option.prop('selected'), state])
|
1182 |
-
.triggerNative('change');
|
1183 |
-
}
|
1184 |
-
}
|
1185 |
-
});
|
1186 |
-
|
1187 |
-
this.$menu.on('click', 'li.disabled a, .popover-title, .popover-title :not(.close)', function (e) {
|
1188 |
-
if (e.currentTarget == this) {
|
1189 |
-
e.preventDefault();
|
1190 |
-
e.stopPropagation();
|
1191 |
-
if (that.options.liveSearch && !$(e.target).hasClass('close')) {
|
1192 |
-
that.$searchbox.focus();
|
1193 |
-
} else {
|
1194 |
-
that.$button.focus();
|
1195 |
-
}
|
1196 |
-
}
|
1197 |
-
});
|
1198 |
-
|
1199 |
-
this.$menuInner.on('click', '.divider, .dropdown-header', function (e) {
|
1200 |
-
e.preventDefault();
|
1201 |
-
e.stopPropagation();
|
1202 |
-
if (that.options.liveSearch) {
|
1203 |
-
that.$searchbox.focus();
|
1204 |
-
} else {
|
1205 |
-
that.$button.focus();
|
1206 |
-
}
|
1207 |
-
});
|
1208 |
-
|
1209 |
-
this.$menu.on('click', '.popover-title .close', function () {
|
1210 |
-
that.$button.click();
|
1211 |
-
});
|
1212 |
-
|
1213 |
-
this.$searchbox.on('click', function (e) {
|
1214 |
-
e.stopPropagation();
|
1215 |
-
});
|
1216 |
-
|
1217 |
-
this.$menu.on('click', '.actions-btn', function (e) {
|
1218 |
-
if (that.options.liveSearch) {
|
1219 |
-
that.$searchbox.focus();
|
1220 |
-
} else {
|
1221 |
-
that.$button.focus();
|
1222 |
-
}
|
1223 |
-
|
1224 |
-
e.preventDefault();
|
1225 |
-
e.stopPropagation();
|
1226 |
-
|
1227 |
-
if ($(this).hasClass('bs-select-all')) {
|
1228 |
-
that.selectAll();
|
1229 |
-
} else {
|
1230 |
-
that.deselectAll();
|
1231 |
-
}
|
1232 |
-
});
|
1233 |
-
|
1234 |
-
this.$element.change(function () {
|
1235 |
-
that.render(false);
|
1236 |
-
});
|
1237 |
-
},
|
1238 |
-
|
1239 |
-
liveSearchListener: function () {
|
1240 |
-
var that = this,
|
1241 |
-
$no_results = $('<li class="no-results"></li>');
|
1242 |
-
|
1243 |
-
this.$button.on('click.dropdown.data-api touchstart.dropdown.data-api', function () {
|
1244 |
-
that.$menuInner.find('.active').removeClass('active');
|
1245 |
-
if (!!that.$searchbox.val()) {
|
1246 |
-
that.$searchbox.val('');
|
1247 |
-
that.$lis.not('.is-hidden').removeClass('hidden');
|
1248 |
-
if (!!$no_results.parent().length) $no_results.remove();
|
1249 |
-
}
|
1250 |
-
if (!that.multiple) that.$menuInner.find('.selected').addClass('active');
|
1251 |
-
setTimeout(function () {
|
1252 |
-
that.$searchbox.focus();
|
1253 |
-
}, 10);
|
1254 |
-
});
|
1255 |
-
|
1256 |
-
this.$searchbox.on('click.dropdown.data-api focus.dropdown.data-api touchend.dropdown.data-api', function (e) {
|
1257 |
-
e.stopPropagation();
|
1258 |
-
});
|
1259 |
-
|
1260 |
-
this.$searchbox.on('input propertychange', function () {
|
1261 |
-
if (that.$searchbox.val()) {
|
1262 |
-
var $searchBase = that.$lis.not('.is-hidden').removeClass('hidden').children('a');
|
1263 |
-
if (that.options.liveSearchNormalize) {
|
1264 |
-
$searchBase = $searchBase.not(':a' + that._searchStyle() + '("' + normalizeToBase(that.$searchbox.val()) + '")');
|
1265 |
-
} else {
|
1266 |
-
$searchBase = $searchBase.not(':' + that._searchStyle() + '("' + that.$searchbox.val() + '")');
|
1267 |
-
}
|
1268 |
-
$searchBase.parent().addClass('hidden');
|
1269 |
-
|
1270 |
-
that.$lis.filter('.dropdown-header').each(function () {
|
1271 |
-
var $this = $(this),
|
1272 |
-
optgroup = $this.data('optgroup');
|
1273 |
-
|
1274 |
-
if (that.$lis.filter('[data-optgroup=' + optgroup + ']').not($this).not('.hidden').length === 0) {
|
1275 |
-
$this.addClass('hidden');
|
1276 |
-
that.$lis.filter('[data-optgroup=' + optgroup + 'div]').addClass('hidden');
|
1277 |
-
}
|
1278 |
-
});
|
1279 |
-
|
1280 |
-
var $lisVisible = that.$lis.not('.hidden');
|
1281 |
-
|
1282 |
-
// hide divider if first or last visible, or if followed by another divider
|
1283 |
-
$lisVisible.each(function (index) {
|
1284 |
-
var $this = $(this);
|
1285 |
-
|
1286 |
-
if ($this.hasClass('divider') && (
|
1287 |
-
$this.index() === $lisVisible.first().index() ||
|
1288 |
-
$this.index() === $lisVisible.last().index() ||
|
1289 |
-
$lisVisible.eq(index + 1).hasClass('divider'))) {
|
1290 |
-
$this.addClass('hidden');
|
1291 |
-
}
|
1292 |
-
});
|
1293 |
-
|
1294 |
-
if (!that.$lis.not('.hidden, .no-results').length) {
|
1295 |
-
if (!!$no_results.parent().length) {
|
1296 |
-
$no_results.remove();
|
1297 |
-
}
|
1298 |
-
$no_results.html(that.options.noneResultsText.replace('{0}', '"' + htmlEscape(that.$searchbox.val()) + '"')).show();
|
1299 |
-
that.$menuInner.append($no_results);
|
1300 |
-
} else if (!!$no_results.parent().length) {
|
1301 |
-
$no_results.remove();
|
1302 |
-
}
|
1303 |
-
} else {
|
1304 |
-
that.$lis.not('.is-hidden').removeClass('hidden');
|
1305 |
-
if (!!$no_results.parent().length) {
|
1306 |
-
$no_results.remove();
|
1307 |
-
}
|
1308 |
-
}
|
1309 |
-
|
1310 |
-
that.$lis.filter('.active').removeClass('active');
|
1311 |
-
if (that.$searchbox.val()) that.$lis.not('.hidden, .divider, .dropdown-header').eq(0).addClass('active').children('a').focus();
|
1312 |
-
$(this).focus();
|
1313 |
-
});
|
1314 |
-
},
|
1315 |
-
|
1316 |
-
_searchStyle: function () {
|
1317 |
-
var styles = {
|
1318 |
-
begins: 'ibegins',
|
1319 |
-
startsWith: 'ibegins'
|
1320 |
-
};
|
1321 |
-
|
1322 |
-
return styles[this.options.liveSearchStyle] || 'icontains';
|
1323 |
-
},
|
1324 |
-
|
1325 |
-
val: function (value) {
|
1326 |
-
if (typeof value !== 'undefined') {
|
1327 |
-
this.$element.val(value);
|
1328 |
-
this.render();
|
1329 |
-
|
1330 |
-
return this.$element;
|
1331 |
-
} else {
|
1332 |
-
return this.$element.val();
|
1333 |
-
}
|
1334 |
-
},
|
1335 |
-
|
1336 |
-
changeAll: function (status) {
|
1337 |
-
if (typeof status === 'undefined') status = true;
|
1338 |
-
|
1339 |
-
this.findLis();
|
1340 |
-
|
1341 |
-
var $options = this.$element.find('option'),
|
1342 |
-
$lisVisible = this.$lis.not('.divider, .dropdown-header, .disabled, .hidden').toggleClass('selected', status),
|
1343 |
-
lisVisLen = $lisVisible.length,
|
1344 |
-
selectedOptions = [];
|
1345 |
-
|
1346 |
-
for (var i = 0; i < lisVisLen; i++) {
|
1347 |
-
var origIndex = $lisVisible[i].getAttribute('data-original-index');
|
1348 |
-
selectedOptions[selectedOptions.length] = $options.eq(origIndex)[0];
|
1349 |
-
}
|
1350 |
-
|
1351 |
-
$(selectedOptions).prop('selected', status);
|
1352 |
-
|
1353 |
-
this.render(false);
|
1354 |
-
|
1355 |
-
this.$element
|
1356 |
-
.trigger('changed.bs.select')
|
1357 |
-
.triggerNative('change');
|
1358 |
-
},
|
1359 |
-
|
1360 |
-
selectAll: function () {
|
1361 |
-
return this.changeAll(true);
|
1362 |
-
},
|
1363 |
-
|
1364 |
-
deselectAll: function () {
|
1365 |
-
return this.changeAll(false);
|
1366 |
-
},
|
1367 |
-
|
1368 |
-
toggle: function (e) {
|
1369 |
-
e = e || window.event;
|
1370 |
-
|
1371 |
-
if (e) e.stopPropagation();
|
1372 |
-
|
1373 |
-
this.$button.trigger('click');
|
1374 |
-
},
|
1375 |
-
|
1376 |
-
keydown: function (e) {
|
1377 |
-
var $this = $(this),
|
1378 |
-
$parent = $this.is('input') ? $this.parent().parent() : $this.parent(),
|
1379 |
-
$items,
|
1380 |
-
that = $parent.data('this'),
|
1381 |
-
index,
|
1382 |
-
next,
|
1383 |
-
first,
|
1384 |
-
last,
|
1385 |
-
prev,
|
1386 |
-
nextPrev,
|
1387 |
-
prevIndex,
|
1388 |
-
isActive,
|
1389 |
-
selector = ':not(.disabled, .hidden, .dropdown-header, .divider)',
|
1390 |
-
keyCodeMap = {
|
1391 |
-
32: ' ',
|
1392 |
-
48: '0',
|
1393 |
-
49: '1',
|
1394 |
-
50: '2',
|
1395 |
-
51: '3',
|
1396 |
-
52: '4',
|
1397 |
-
53: '5',
|
1398 |
-
54: '6',
|
1399 |
-
55: '7',
|
1400 |
-
56: '8',
|
1401 |
-
57: '9',
|
1402 |
-
59: ';',
|
1403 |
-
65: 'a',
|
1404 |
-
66: 'b',
|
1405 |
-
67: 'c',
|
1406 |
-
68: 'd',
|
1407 |
-
69: 'e',
|
1408 |
-
70: 'f',
|
1409 |
-
71: 'g',
|
1410 |
-
72: 'h',
|
1411 |
-
73: 'i',
|
1412 |
-
74: 'j',
|
1413 |
-
75: 'k',
|
1414 |
-
76: 'l',
|
1415 |
-
77: 'm',
|
1416 |
-
78: 'n',
|
1417 |
-
79: 'o',
|
1418 |
-
80: 'p',
|
1419 |
-
81: 'q',
|
1420 |
-
82: 'r',
|
1421 |
-
83: 's',
|
1422 |
-
84: 't',
|
1423 |
-
85: 'u',
|
1424 |
-
86: 'v',
|
1425 |
-
87: 'w',
|
1426 |
-
88: 'x',
|
1427 |
-
89: 'y',
|
1428 |
-
90: 'z',
|
1429 |
-
96: '0',
|
1430 |
-
97: '1',
|
1431 |
-
98: '2',
|
1432 |
-
99: '3',
|
1433 |
-
100: '4',
|
1434 |
-
101: '5',
|
1435 |
-
102: '6',
|
1436 |
-
103: '7',
|
1437 |
-
104: '8',
|
1438 |
-
105: '9'
|
1439 |
-
};
|
1440 |
-
|
1441 |
-
if (that.options.liveSearch) $parent = $this.parent().parent();
|
1442 |
-
|
1443 |
-
if (that.options.container) $parent = that.$menu;
|
1444 |
-
|
1445 |
-
$items = $('[role=menu] li', $parent);
|
1446 |
-
|
1447 |
-
isActive = that.$newElement.hasClass('open');
|
1448 |
-
|
1449 |
-
if (!isActive && (e.keyCode >= 48 && e.keyCode <= 57 || e.keyCode >= 96 && e.keyCode <= 105 || e.keyCode >= 65 && e.keyCode <= 90)) {
|
1450 |
-
if (!that.options.container) {
|
1451 |
-
that.setSize();
|
1452 |
-
that.$menu.parent().addClass('open');
|
1453 |
-
isActive = true;
|
1454 |
-
} else {
|
1455 |
-
that.$button.trigger('click');
|
1456 |
-
}
|
1457 |
-
that.$searchbox.focus();
|
1458 |
-
}
|
1459 |
-
|
1460 |
-
if (that.options.liveSearch) {
|
1461 |
-
if (/(^9$|27)/.test(e.keyCode.toString(10)) && isActive && that.$menu.find('.active').length === 0) {
|
1462 |
-
e.preventDefault();
|
1463 |
-
that.$menu.parent().removeClass('open');
|
1464 |
-
if (that.options.container) that.$newElement.removeClass('open');
|
1465 |
-
that.$button.focus();
|
1466 |
-
}
|
1467 |
-
// $items contains li elements when liveSearch is enabled
|
1468 |
-
$items = $('[role=menu] li' + selector, $parent);
|
1469 |
-
if (!$this.val() && !/(38|40)/.test(e.keyCode.toString(10))) {
|
1470 |
-
if ($items.filter('.active').length === 0) {
|
1471 |
-
$items = that.$menuInner.find('li');
|
1472 |
-
if (that.options.liveSearchNormalize) {
|
1473 |
-
$items = $items.filter(':a' + that._searchStyle() + '(' + normalizeToBase(keyCodeMap[e.keyCode]) + ')');
|
1474 |
-
} else {
|
1475 |
-
$items = $items.filter(':' + that._searchStyle() + '(' + keyCodeMap[e.keyCode] + ')');
|
1476 |
-
}
|
1477 |
-
}
|
1478 |
-
}
|
1479 |
-
}
|
1480 |
-
|
1481 |
-
if (!$items.length) return;
|
1482 |
-
|
1483 |
-
if (/(38|40)/.test(e.keyCode.toString(10))) {
|
1484 |
-
index = $items.index($items.find('a').filter(':focus').parent());
|
1485 |
-
first = $items.filter(selector).first().index();
|
1486 |
-
last = $items.filter(selector).last().index();
|
1487 |
-
next = $items.eq(index).nextAll(selector).eq(0).index();
|
1488 |
-
prev = $items.eq(index).prevAll(selector).eq(0).index();
|
1489 |
-
nextPrev = $items.eq(next).prevAll(selector).eq(0).index();
|
1490 |
-
|
1491 |
-
if (that.options.liveSearch) {
|
1492 |
-
$items.each(function (i) {
|
1493 |
-
if (!$(this).hasClass('disabled')) {
|
1494 |
-
$(this).data('index', i);
|
1495 |
-
}
|
1496 |
-
});
|
1497 |
-
index = $items.index($items.filter('.active'));
|
1498 |
-
first = $items.first().data('index');
|
1499 |
-
last = $items.last().data('index');
|
1500 |
-
next = $items.eq(index).nextAll().eq(0).data('index');
|
1501 |
-
prev = $items.eq(index).prevAll().eq(0).data('index');
|
1502 |
-
nextPrev = $items.eq(next).prevAll().eq(0).data('index');
|
1503 |
-
}
|
1504 |
-
|
1505 |
-
prevIndex = $this.data('prevIndex');
|
1506 |
-
|
1507 |
-
if (e.keyCode == 38) {
|
1508 |
-
if (that.options.liveSearch) index--;
|
1509 |
-
if (index != nextPrev && index > prev) index = prev;
|
1510 |
-
if (index < first) index = first;
|
1511 |
-
if (index == prevIndex) index = last;
|
1512 |
-
} else if (e.keyCode == 40) {
|
1513 |
-
if (that.options.liveSearch) index++;
|
1514 |
-
if (index == -1) index = 0;
|
1515 |
-
if (index != nextPrev && index < next) index = next;
|
1516 |
-
if (index > last) index = last;
|
1517 |
-
if (index == prevIndex) index = first;
|
1518 |
-
}
|
1519 |
-
|
1520 |
-
$this.data('prevIndex', index);
|
1521 |
-
|
1522 |
-
if (!that.options.liveSearch) {
|
1523 |
-
$items.eq(index).children('a').focus();
|
1524 |
-
} else {
|
1525 |
-
e.preventDefault();
|
1526 |
-
if (!$this.hasClass('dropdown-toggle')) {
|
1527 |
-
$items.removeClass('active').eq(index).addClass('active').children('a').focus();
|
1528 |
-
$this.focus();
|
1529 |
-
}
|
1530 |
-
}
|
1531 |
-
|
1532 |
-
} else if (!$this.is('input')) {
|
1533 |
-
var keyIndex = [],
|
1534 |
-
count,
|
1535 |
-
prevKey;
|
1536 |
-
|
1537 |
-
$items.each(function () {
|
1538 |
-
if (!$(this).hasClass('disabled')) {
|
1539 |
-
if ($.trim($(this).children('a').text().toLowerCase()).substring(0, 1) == keyCodeMap[e.keyCode]) {
|
1540 |
-
keyIndex.push($(this).index());
|
1541 |
-
}
|
1542 |
-
}
|
1543 |
-
});
|
1544 |
-
|
1545 |
-
count = $(document).data('keycount');
|
1546 |
-
count++;
|
1547 |
-
$(document).data('keycount', count);
|
1548 |
-
|
1549 |
-
prevKey = $.trim($(':focus').text().toLowerCase()).substring(0, 1);
|
1550 |
-
|
1551 |
-
if (prevKey != keyCodeMap[e.keyCode]) {
|
1552 |
-
count = 1;
|
1553 |
-
$(document).data('keycount', count);
|
1554 |
-
} else if (count >= keyIndex.length) {
|
1555 |
-
$(document).data('keycount', 0);
|
1556 |
-
if (count > keyIndex.length) count = 1;
|
1557 |
-
}
|
1558 |
-
|
1559 |
-
$items.eq(keyIndex[count - 1]).children('a').focus();
|
1560 |
-
}
|
1561 |
-
|
1562 |
-
// Select focused option if "Enter", "Spacebar" or "Tab" (when selectOnTab is true) are pressed inside the menu.
|
1563 |
-
if ((/(13|32)/.test(e.keyCode.toString(10)) || (/(^9$)/.test(e.keyCode.toString(10)) && that.options.selectOnTab)) && isActive) {
|
1564 |
-
if (!/(32)/.test(e.keyCode.toString(10))) e.preventDefault();
|
1565 |
-
if (!that.options.liveSearch) {
|
1566 |
-
var elem = $(':focus');
|
1567 |
-
elem.click();
|
1568 |
-
// Bring back focus for multiselects
|
1569 |
-
elem.focus();
|
1570 |
-
// Prevent screen from scrolling if the user hit the spacebar
|
1571 |
-
e.preventDefault();
|
1572 |
-
// Fixes spacebar selection of dropdown items in FF & IE
|
1573 |
-
$(document).data('spaceSelect', true);
|
1574 |
-
} else if (!/(32)/.test(e.keyCode.toString(10))) {
|
1575 |
-
that.$menuInner.find('.active a').click();
|
1576 |
-
$this.focus();
|
1577 |
-
}
|
1578 |
-
$(document).data('keycount', 0);
|
1579 |
-
}
|
1580 |
-
|
1581 |
-
if ((/(^9$|27)/.test(e.keyCode.toString(10)) && isActive && (that.multiple || that.options.liveSearch)) || (/(27)/.test(e.keyCode.toString(10)) && !isActive)) {
|
1582 |
-
that.$menu.parent().removeClass('open');
|
1583 |
-
if (that.options.container) that.$newElement.removeClass('open');
|
1584 |
-
that.$button.focus();
|
1585 |
-
}
|
1586 |
-
},
|
1587 |
-
|
1588 |
-
mobile: function () {
|
1589 |
-
this.$element.addClass('mobile-device');
|
1590 |
-
},
|
1591 |
-
|
1592 |
-
refresh: function () {
|
1593 |
-
this.$lis = null;
|
1594 |
-
this.liObj = {};
|
1595 |
-
this.reloadLi();
|
1596 |
-
this.render();
|
1597 |
-
this.checkDisabled();
|
1598 |
-
this.liHeight(true);
|
1599 |
-
this.setStyle();
|
1600 |
-
this.setWidth();
|
1601 |
-
if (this.$lis) this.$searchbox.trigger('propertychange');
|
1602 |
-
|
1603 |
-
this.$element.trigger('refreshed.bs.select');
|
1604 |
-
},
|
1605 |
-
|
1606 |
-
hide: function () {
|
1607 |
-
this.$newElement.hide();
|
1608 |
-
},
|
1609 |
-
|
1610 |
-
show: function () {
|
1611 |
-
this.$newElement.show();
|
1612 |
-
},
|
1613 |
-
|
1614 |
-
remove: function () {
|
1615 |
-
this.$newElement.remove();
|
1616 |
-
this.$element.remove();
|
1617 |
-
},
|
1618 |
-
|
1619 |
-
destroy: function () {
|
1620 |
-
this.$newElement.before(this.$element).remove();
|
1621 |
-
|
1622 |
-
if (this.$bsContainer) {
|
1623 |
-
this.$bsContainer.remove();
|
1624 |
-
} else {
|
1625 |
-
this.$menu.remove();
|
1626 |
-
}
|
1627 |
-
|
1628 |
-
this.$element
|
1629 |
-
.off('.bs.select')
|
1630 |
-
.removeData('selectpicker')
|
1631 |
-
.removeClass('bs-select-hidden selectpicker');
|
1632 |
-
}
|
1633 |
-
};
|
1634 |
-
|
1635 |
-
// SELECTPICKER PLUGIN DEFINITION
|
1636 |
-
// ==============================
|
1637 |
-
function Plugin(option, event) {
|
1638 |
-
// get the args of the outer function..
|
1639 |
-
var args = arguments;
|
1640 |
-
// The arguments of the function are explicitly re-defined from the argument list, because the shift causes them
|
1641 |
-
// to get lost/corrupted in android 2.3 and IE9 #715 #775
|
1642 |
-
var _option = option,
|
1643 |
-
_event = event;
|
1644 |
-
[].shift.apply(args);
|
1645 |
-
|
1646 |
-
var value;
|
1647 |
-
var chain = this.each(function () {
|
1648 |
-
var $this = $(this);
|
1649 |
-
if ($this.is('select')) {
|
1650 |
-
var data = $this.data('selectpicker'),
|
1651 |
-
options = typeof _option == 'object' && _option;
|
1652 |
-
|
1653 |
-
if (!data) {
|
1654 |
-
var config = $.extend({}, Selectpicker.DEFAULTS, $.fn.selectpicker.defaults || {}, $this.data(), options);
|
1655 |
-
config.template = $.extend({}, Selectpicker.DEFAULTS.template, ($.fn.selectpicker.defaults ? $.fn.selectpicker.defaults.template : {}), $this.data().template, options.template);
|
1656 |
-
$this.data('selectpicker', (data = new Selectpicker(this, config, _event)));
|
1657 |
-
} else if (options) {
|
1658 |
-
for (var i in options) {
|
1659 |
-
if (options.hasOwnProperty(i)) {
|
1660 |
-
data.options[i] = options[i];
|
1661 |
-
}
|
1662 |
-
}
|
1663 |
-
}
|
1664 |
-
|
1665 |
-
if (typeof _option == 'string') {
|
1666 |
-
if (data[_option] instanceof Function) {
|
1667 |
-
value = data[_option].apply(data, args);
|
1668 |
-
} else {
|
1669 |
-
value = data.options[_option];
|
1670 |
-
}
|
1671 |
-
}
|
1672 |
-
}
|
1673 |
-
});
|
1674 |
-
|
1675 |
-
if (typeof value !== 'undefined') {
|
1676 |
-
//noinspection JSUnusedAssignment
|
1677 |
-
return value;
|
1678 |
-
} else {
|
1679 |
-
return chain;
|
1680 |
-
}
|
1681 |
-
}
|
1682 |
-
|
1683 |
-
var old = $.fn.selectpicker;
|
1684 |
-
$.fn.selectpicker = Plugin;
|
1685 |
-
$.fn.selectpicker.Constructor = Selectpicker;
|
1686 |
-
|
1687 |
-
// SELECTPICKER NO CONFLICT
|
1688 |
-
// ========================
|
1689 |
-
$.fn.selectpicker.noConflict = function () {
|
1690 |
-
$.fn.selectpicker = old;
|
1691 |
-
return this;
|
1692 |
-
};
|
1693 |
-
|
1694 |
-
$(document)
|
1695 |
-
.data('keycount', 0)
|
1696 |
-
.on('keydown.bs.select', '.bootstrap-select [data-toggle=dropdown], .bootstrap-select [role="menu"], .bs-searchbox input', Selectpicker.prototype.keydown)
|
1697 |
-
.on('focusin.modal', '.bootstrap-select [data-toggle=dropdown], .bootstrap-select [role="menu"], .bs-searchbox input', function (e) {
|
1698 |
-
e.stopPropagation();
|
1699 |
-
});
|
1700 |
-
|
1701 |
-
// SELECTPICKER DATA-API
|
1702 |
-
// =====================
|
1703 |
-
$(window).on('load.bs.select.data-api', function () {
|
1704 |
-
$('.selectpicker').each(function () {
|
1705 |
-
var $selectpicker = $(this);
|
1706 |
-
Plugin.call($selectpicker, $selectpicker.data());
|
1707 |
-
})
|
1708 |
-
});
|
1709 |
-
})(jQuery);
|
1 |
+
(function ($) {
|
2 |
+
'use strict';
|
3 |
+
|
4 |
+
//<editor-fold desc="Shims">
|
5 |
+
if (!String.prototype.includes) {
|
6 |
+
(function () {
|
7 |
+
'use strict'; // needed to support `apply`/`call` with `undefined`/`null`
|
8 |
+
var toString = {}.toString;
|
9 |
+
var defineProperty = (function () {
|
10 |
+
// IE 8 only supports `Object.defineProperty` on DOM elements
|
11 |
+
try {
|
12 |
+
var object = {};
|
13 |
+
var $defineProperty = Object.defineProperty;
|
14 |
+
var result = $defineProperty(object, object, object) && $defineProperty;
|
15 |
+
} catch (error) {
|
16 |
+
}
|
17 |
+
return result;
|
18 |
+
}());
|
19 |
+
var indexOf = ''.indexOf;
|
20 |
+
var includes = function (search) {
|
21 |
+
if (this == null) {
|
22 |
+
throw new TypeError();
|
23 |
+
}
|
24 |
+
var string = String(this);
|
25 |
+
if (search && toString.call(search) == '[object RegExp]') {
|
26 |
+
throw new TypeError();
|
27 |
+
}
|
28 |
+
var stringLength = string.length;
|
29 |
+
var searchString = String(search);
|
30 |
+
var searchLength = searchString.length;
|
31 |
+
var position = arguments.length > 1 ? arguments[1] : undefined;
|
32 |
+
// `ToInteger`
|
33 |
+
var pos = position ? Number(position) : 0;
|
34 |
+
if (pos != pos) { // better `isNaN`
|
35 |
+
pos = 0;
|
36 |
+
}
|
37 |
+
var start = Math.min(Math.max(pos, 0), stringLength);
|
38 |
+
// Avoid the `indexOf` call if no match is possible
|
39 |
+
if (searchLength + start > stringLength) {
|
40 |
+
return false;
|
41 |
+
}
|
42 |
+
return indexOf.call(string, searchString, pos) != -1;
|
43 |
+
};
|
44 |
+
if (defineProperty) {
|
45 |
+
defineProperty(String.prototype, 'includes', {
|
46 |
+
'value': includes,
|
47 |
+
'configurable': true,
|
48 |
+
'writable': true
|
49 |
+
});
|
50 |
+
} else {
|
51 |
+
String.prototype.includes = includes;
|
52 |
+
}
|
53 |
+
}());
|
54 |
+
}
|
55 |
+
|
56 |
+
if (!String.prototype.startsWith) {
|
57 |
+
(function () {
|
58 |
+
'use strict'; // needed to support `apply`/`call` with `undefined`/`null`
|
59 |
+
var defineProperty = (function () {
|
60 |
+
// IE 8 only supports `Object.defineProperty` on DOM elements
|
61 |
+
try {
|
62 |
+
var object = {};
|
63 |
+
var $defineProperty = Object.defineProperty;
|
64 |
+
var result = $defineProperty(object, object, object) && $defineProperty;
|
65 |
+
} catch (error) {
|
66 |
+
}
|
67 |
+
return result;
|
68 |
+
}());
|
69 |
+
var toString = {}.toString;
|
70 |
+
var startsWith = function (search) {
|
71 |
+
if (this == null) {
|
72 |
+
throw new TypeError();
|
73 |
+
}
|
74 |
+
var string = String(this);
|
75 |
+
if (search && toString.call(search) == '[object RegExp]') {
|
76 |
+
throw new TypeError();
|
77 |
+
}
|
78 |
+
var stringLength = string.length;
|
79 |
+
var searchString = String(search);
|
80 |
+
var searchLength = searchString.length;
|
81 |
+
var position = arguments.length > 1 ? arguments[1] : undefined;
|
82 |
+
// `ToInteger`
|
83 |
+
var pos = position ? Number(position) : 0;
|
84 |
+
if (pos != pos) { // better `isNaN`
|
85 |
+
pos = 0;
|
86 |
+
}
|
87 |
+
var start = Math.min(Math.max(pos, 0), stringLength);
|
88 |
+
// Avoid the `indexOf` call if no match is possible
|
89 |
+
if (searchLength + start > stringLength) {
|
90 |
+
return false;
|
91 |
+
}
|
92 |
+
var index = -1;
|
93 |
+
while (++index < searchLength) {
|
94 |
+
if (string.charCodeAt(start + index) != searchString.charCodeAt(index)) {
|
95 |
+
return false;
|
96 |
+
}
|
97 |
+
}
|
98 |
+
return true;
|
99 |
+
};
|
100 |
+
if (defineProperty) {
|
101 |
+
defineProperty(String.prototype, 'startsWith', {
|
102 |
+
'value': startsWith,
|
103 |
+
'configurable': true,
|
104 |
+
'writable': true
|
105 |
+
});
|
106 |
+
} else {
|
107 |
+
String.prototype.startsWith = startsWith;
|
108 |
+
}
|
109 |
+
}());
|
110 |
+
}
|
111 |
+
|
112 |
+
if (!Object.keys) {
|
113 |
+
Object.keys = function (
|
114 |
+
o, // object
|
115 |
+
k, // key
|
116 |
+
r // result array
|
117 |
+
){
|
118 |
+
// initialize object and result
|
119 |
+
r=[];
|
120 |
+
// iterate over object keys
|
121 |
+
for (k in o)
|
122 |
+
// fill result array with non-prototypical keys
|
123 |
+
r.hasOwnProperty.call(o, k) && r.push(k);
|
124 |
+
// return result
|
125 |
+
return r;
|
126 |
+
};
|
127 |
+
}
|
128 |
+
|
129 |
+
$.fn.triggerNative = function (eventName) {
|
130 |
+
var el = this[0],
|
131 |
+
event;
|
132 |
+
|
133 |
+
if (el.dispatchEvent) {
|
134 |
+
if (typeof Event === 'function') {
|
135 |
+
// For modern browsers
|
136 |
+
event = new Event(eventName, {
|
137 |
+
bubbles: true
|
138 |
+
});
|
139 |
+
} else {
|
140 |
+
// For IE since it doesn't support Event constructor
|
141 |
+
event = document.createEvent('Event');
|
142 |
+
event.initEvent(eventName, true, false);
|
143 |
+
}
|
144 |
+
|
145 |
+
el.dispatchEvent(event);
|
146 |
+
} else {
|
147 |
+
if (el.fireEvent) {
|
148 |
+
event = document.createEventObject();
|
149 |
+
event.eventType = eventName;
|
150 |
+
el.fireEvent('on' + eventName, event);
|
151 |
+
}
|
152 |
+
|
153 |
+
this.trigger(eventName);
|
154 |
+
}
|
155 |
+
};
|
156 |
+
//</editor-fold>
|
157 |
+
|
158 |
+
// Case insensitive contains search
|
159 |
+
$.expr[':'].icontains = function (obj, index, meta) {
|
160 |
+
var $obj = $(obj);
|
161 |
+
var haystack = ($obj.data('tokens') || $obj.text()).toUpperCase();
|
162 |
+
return haystack.includes(meta[3].toUpperCase());
|
163 |
+
};
|
164 |
+
|
165 |
+
// Case insensitive begins search
|
166 |
+
$.expr[':'].ibegins = function (obj, index, meta) {
|
167 |
+
var $obj = $(obj);
|
168 |
+
var haystack = ($obj.data('tokens') || $obj.text()).toUpperCase();
|
169 |
+
return haystack.startsWith(meta[3].toUpperCase());
|
170 |
+
};
|
171 |
+
|
172 |
+
// Case and accent insensitive contains search
|
173 |
+
$.expr[':'].aicontains = function (obj, index, meta) {
|
174 |
+
var $obj = $(obj);
|
175 |
+
var haystack = ($obj.data('tokens') || $obj.data('normalizedText') || $obj.text()).toUpperCase();
|
176 |
+
return haystack.includes(meta[3].toUpperCase());
|
177 |
+
};
|
178 |
+
|
179 |
+
// Case and accent insensitive begins search
|
180 |
+
$.expr[':'].aibegins = function (obj, index, meta) {
|
181 |
+
var $obj = $(obj);
|
182 |
+
var haystack = ($obj.data('tokens') || $obj.data('normalizedText') || $obj.text()).toUpperCase();
|
183 |
+
return haystack.startsWith(meta[3].toUpperCase());
|
184 |
+
};
|
185 |
+
|
186 |
+
/**
|
187 |
+
* Remove all diatrics from the given text.
|
188 |
+
* @access private
|
189 |
+
* @param {String} text
|
190 |
+
* @returns {String}
|
191 |
+
*/
|
192 |
+
function normalizeToBase(text) {
|
193 |
+
var rExps = [
|
194 |
+
{re: /[\xC0-\xC6]/g, ch: "A"},
|
195 |
+
{re: /[\xE0-\xE6]/g, ch: "a"},
|
196 |
+
{re: /[\xC8-\xCB]/g, ch: "E"},
|
197 |
+
{re: /[\xE8-\xEB]/g, ch: "e"},
|
198 |
+
{re: /[\xCC-\xCF]/g, ch: "I"},
|
199 |
+
{re: /[\xEC-\xEF]/g, ch: "i"},
|
200 |
+
{re: /[\xD2-\xD6]/g, ch: "O"},
|
201 |
+
{re: /[\xF2-\xF6]/g, ch: "o"},
|
202 |
+
{re: /[\xD9-\xDC]/g, ch: "U"},
|
203 |
+
{re: /[\xF9-\xFC]/g, ch: "u"},
|
204 |
+
{re: /[\xC7-\xE7]/g, ch: "c"},
|
205 |
+
{re: /[\xD1]/g, ch: "N"},
|
206 |
+
{re: /[\xF1]/g, ch: "n"}
|
207 |
+
];
|
208 |
+
$.each(rExps, function () {
|
209 |
+
text = text.replace(this.re, this.ch);
|
210 |
+
});
|
211 |
+
return text;
|
212 |
+
}
|
213 |
+
|
214 |
+
|
215 |
+
function htmlEscape(html) {
|
216 |
+
var escapeMap = {
|
217 |
+
'&': '&',
|
218 |
+
'<': '<',
|
219 |
+
'>': '>',
|
220 |
+
'"': '"',
|
221 |
+
"'": ''',
|
222 |
+
'`': '`'
|
223 |
+
};
|
224 |
+
var source = '(?:' + Object.keys(escapeMap).join('|') + ')',
|
225 |
+
testRegexp = new RegExp(source),
|
226 |
+
replaceRegexp = new RegExp(source, 'g'),
|
227 |
+
string = html == null ? '' : '' + html;
|
228 |
+
return testRegexp.test(string) ? string.replace(replaceRegexp, function (match) {
|
229 |
+
return escapeMap[match];
|
230 |
+
}) : string;
|
231 |
+
}
|
232 |
+
|
233 |
+
var Selectpicker = function (element, options, e) {
|
234 |
+
if (e) {
|
235 |
+
e.stopPropagation();
|
236 |
+
e.preventDefault();
|
237 |
+
}
|
238 |
+
|
239 |
+
this.$element = $(element);
|
240 |
+
this.$newElement = null;
|
241 |
+
this.$button = null;
|
242 |
+
this.$menu = null;
|
243 |
+
this.$lis = null;
|
244 |
+
this.options = options;
|
245 |
+
|
246 |
+
// If we have no title yet, try to pull it from the html title attribute (jQuery doesnt' pick it up as it's not a
|
247 |
+
// data-attribute)
|
248 |
+
if (this.options.title === null) {
|
249 |
+
this.options.title = this.$element.attr('title');
|
250 |
+
}
|
251 |
+
|
252 |
+
//Expose public methods
|
253 |
+
this.val = Selectpicker.prototype.val;
|
254 |
+
this.render = Selectpicker.prototype.render;
|
255 |
+
this.refresh = Selectpicker.prototype.refresh;
|
256 |
+
this.setStyle = Selectpicker.prototype.setStyle;
|
257 |
+
this.selectAll = Selectpicker.prototype.selectAll;
|
258 |
+
this.deselectAll = Selectpicker.prototype.deselectAll;
|
259 |
+
this.destroy = Selectpicker.prototype.destroy;
|
260 |
+
this.remove = Selectpicker.prototype.remove;
|
261 |
+
this.show = Selectpicker.prototype.show;
|
262 |
+
this.hide = Selectpicker.prototype.hide;
|
263 |
+
|
264 |
+
this.init();
|
265 |
+
};
|
266 |
+
|
267 |
+
Selectpicker.VERSION = '1.10.0';
|
268 |
+
|
269 |
+
// part of this is duplicated in i18n/defaults-en_US.js. Make sure to update both.
|
270 |
+
Selectpicker.DEFAULTS = {
|
271 |
+
noneSelectedText: 'Nothing selected',
|
272 |
+
noneResultsText: 'No results matched {0}',
|
273 |
+
countSelectedText: function (numSelected, numTotal) {
|
274 |
+
return (numSelected == 1) ? "{0} item selected" : "{0} items selected";
|
275 |
+
},
|
276 |
+
maxOptionsText: function (numAll, numGroup) {
|
277 |
+
return [
|
278 |
+
(numAll == 1) ? 'Limit reached ({n} item max)' : 'Limit reached ({n} items max)',
|
279 |
+
(numGroup == 1) ? 'Group limit reached ({n} item max)' : 'Group limit reached ({n} items max)'
|
280 |
+
];
|
281 |
+
},
|
282 |
+
selectAllText: 'Select All',
|
283 |
+
deselectAllText: 'Deselect All',
|
284 |
+
doneButton: false,
|
285 |
+
doneButtonText: 'Close',
|
286 |
+
multipleSeparator: ', ',
|
287 |
+
styleBase: 'btn',
|
288 |
+
style: 'btn-default',
|
289 |
+
size: 'auto',
|
290 |
+
title: null,
|
291 |
+
selectedTextFormat: 'values',
|
292 |
+
width: false,
|
293 |
+
container: false,
|
294 |
+
hideDisabled: false,
|
295 |
+
showSubtext: false,
|
296 |
+
showIcon: true,
|
297 |
+
showContent: true,
|
298 |
+
dropupAuto: true,
|
299 |
+
header: false,
|
300 |
+
liveSearch: false,
|
301 |
+
liveSearchPlaceholder: null,
|
302 |
+
liveSearchNormalize: false,
|
303 |
+
liveSearchStyle: 'contains',
|
304 |
+
actionsBox: false,
|
305 |
+
iconBase: 'glyphicon',
|
306 |
+
tickIcon: 'glyphicon-ok',
|
307 |
+
showTick: false,
|
308 |
+
template: {
|
309 |
+
caret: '<span class="caret"></span>'
|
310 |
+
},
|
311 |
+
maxOptions: false,
|
312 |
+
mobile: false,
|
313 |
+
selectOnTab: false,
|
314 |
+
dropdownAlignRight: false
|
315 |
+
};
|
316 |
+
|
317 |
+
Selectpicker.prototype = {
|
318 |
+
|
319 |
+
constructor: Selectpicker,
|
320 |
+
|
321 |
+
init: function () {
|
322 |
+
var that = this,
|
323 |
+
id = this.$element.attr('id');
|
324 |
+
|
325 |
+
this.$element.addClass('bs-select-hidden');
|
326 |
+
|
327 |
+
// store originalIndex (key) and newIndex (value) in this.liObj for fast accessibility
|
328 |
+
// allows us to do this.$lis.eq(that.liObj[index]) instead of this.$lis.filter('[data-original-index="' + index + '"]')
|
329 |
+
this.liObj = {};
|
330 |
+
this.multiple = this.$element.prop('multiple');
|
331 |
+
this.autofocus = this.$element.prop('autofocus');
|
332 |
+
this.$newElement = this.createView();
|
333 |
+
this.$element
|
334 |
+
.after(this.$newElement)
|
335 |
+
.appendTo(this.$newElement);
|
336 |
+
this.$button = this.$newElement.children('button');
|
337 |
+
this.$menu = this.$newElement.children('.dropdown-menu');
|
338 |
+
this.$menuInner = this.$menu.children('.inner');
|
339 |
+
this.$searchbox = this.$menu.find('input');
|
340 |
+
|
341 |
+
this.$element.removeClass('bs-select-hidden');
|
342 |
+
|
343 |
+
if (this.options.dropdownAlignRight)
|
344 |
+
this.$menu.addClass('dropdown-menu-right');
|
345 |
+
|
346 |
+
if (typeof id !== 'undefined') {
|
347 |
+
this.$button.attr('data-id', id);
|
348 |
+
$('label[for="' + id + '"]').click(function (e) {
|
349 |
+
e.preventDefault();
|
350 |
+
that.$button.focus();
|
351 |
+
});
|
352 |
+
}
|
353 |
+
|
354 |
+
this.checkDisabled();
|
355 |
+
this.clickListener();
|
356 |
+
if (this.options.liveSearch) this.liveSearchListener();
|
357 |
+
this.render();
|
358 |
+
this.setStyle();
|
359 |
+
this.setWidth();
|
360 |
+
if (this.options.container) this.selectPosition();
|
361 |
+
this.$menu.data('this', this);
|
362 |
+
this.$newElement.data('this', this);
|
363 |
+
if (this.options.mobile) this.mobile();
|
364 |
+
|
365 |
+
this.$newElement.on({
|
366 |
+
'hide.bs.dropdown': function (e) {
|
367 |
+
that.$element.trigger('hide.bs.select', e);
|
368 |
+
},
|
369 |
+
'hidden.bs.dropdown': function (e) {
|
370 |
+
that.$element.trigger('hidden.bs.select', e);
|
371 |
+
},
|
372 |
+
'show.bs.dropdown': function (e) {
|
373 |
+
that.$element.trigger('show.bs.select', e);
|
374 |
+
},
|
375 |
+
'shown.bs.dropdown': function (e) {
|
376 |
+
that.$element.trigger('shown.bs.select', e);
|
377 |
+
}
|
378 |
+
});
|
379 |
+
|
380 |
+
if (that.$element[0].hasAttribute('required')) {
|
381 |
+
this.$element.on('invalid', function () {
|
382 |
+
that.$button
|
383 |
+
.addClass('bs-invalid')
|
384 |
+
.focus();
|
385 |
+
|
386 |
+
that.$element.on({
|
387 |
+
'focus.bs.select': function () {
|
388 |
+
that.$button.focus();
|
389 |
+
that.$element.off('focus.bs.select');
|
390 |
+
},
|
391 |
+
'shown.bs.select': function () {
|
392 |
+
that.$element
|
393 |
+
.val(that.$element.val()) // set the value to hide the validation message in Chrome when menu is opened
|
394 |
+
.off('shown.bs.select');
|
395 |
+
},
|
396 |
+
'rendered.bs.select': function () {
|
397 |
+
// if select is no longer invalid, remove the bs-invalid class
|
398 |
+
if (this.validity.valid) that.$button.removeClass('bs-invalid');
|
399 |
+
that.$element.off('rendered.bs.select');
|
400 |
+
}
|
401 |
+
});
|
402 |
+
|
403 |
+
});
|
404 |
+
}
|
405 |
+
|
406 |
+
setTimeout(function () {
|
407 |
+
that.$element.trigger('loaded.bs.select');
|
408 |
+
});
|
409 |
+
},
|
410 |
+
|
411 |
+
createDropdown: function () {
|
412 |
+
// Options
|
413 |
+
// If we are multiple or showTick option is set, then add the show-tick class
|
414 |
+
var showTick = (this.multiple || this.options.showTick) ? ' show-tick' : '',
|
415 |
+
inputGroup = this.$element.parent().hasClass('input-group') ? ' input-group-btn' : '',
|
416 |
+
autofocus = this.autofocus ? ' autofocus' : '';
|
417 |
+
// Elements
|
418 |
+
var header = this.options.header ? '<div class="popover-title"><button type="button" class="close" aria-hidden="true">×</button>' + this.options.header + '</div>' : '';
|
419 |
+
var searchbox = this.options.liveSearch ?
|
420 |
+
'<div class="bs-searchbox">' +
|
421 |
+
'<input type="text" class="form-control" autocomplete="off"' +
|
422 |
+
(null === this.options.liveSearchPlaceholder ? '' : ' placeholder="' + htmlEscape(this.options.liveSearchPlaceholder) + '"') + '>' +
|
423 |
+
'</div>'
|
424 |
+
: '';
|
425 |
+
var actionsbox = this.multiple && this.options.actionsBox ?
|
426 |
+
'<div class="bs-actionsbox">' +
|
427 |
+
'<div class="btn-group btn-group-sm btn-block">' +
|
428 |
+
'<button type="button" class="actions-btn bs-select-all btn btn-default">' +
|
429 |
+
this.options.selectAllText +
|
430 |
+
'</button>' +
|
431 |
+
'<button type="button" class="actions-btn bs-deselect-all btn btn-default">' +
|
432 |
+
this.options.deselectAllText +
|
433 |
+
'</button>' +
|
434 |
+
'</div>' +
|
435 |
+
'</div>'
|
436 |
+
: '';
|
437 |
+
var donebutton = this.multiple && this.options.doneButton ?
|
438 |
+
'<div class="bs-donebutton">' +
|
439 |
+
'<div class="btn-group btn-block">' +
|
440 |
+
'<button type="button" class="btn btn-sm btn-default">' +
|
441 |
+
this.options.doneButtonText +
|
442 |
+
'</button>' +
|
443 |
+
'</div>' +
|
444 |
+
'</div>'
|
445 |
+
: '';
|
446 |
+
var drop =
|
447 |
+
'<div class="btn-group bootstrap-select' + showTick + inputGroup + '">' +
|
448 |
+
'<button type="button" class="' + this.options.styleBase + ' dropdown-toggle" data-toggle="dropdown"' + autofocus + '>' +
|
449 |
+
'<span class="filter-option pull-left"></span> ' +
|
450 |
+
'<span class="bs-caret">' +
|
451 |
+
this.options.template.caret +
|
452 |
+
'</span>' +
|
453 |
+
'</button>' +
|
454 |
+
'<div class="dropdown-menu open">' +
|
455 |
+
header +
|
456 |
+
searchbox +
|
457 |
+
actionsbox +
|
458 |
+
'<ul class="dropdown-menu inner" role="menu">' +
|
459 |
+
'</ul>' +
|
460 |
+
donebutton +
|
461 |
+
'</div>' +
|
462 |
+
'</div>';
|
463 |
+
|
464 |
+
return $(drop);
|
465 |
+
},
|
466 |
+
|
467 |
+
createView: function () {
|
468 |
+
var $drop = this.createDropdown(),
|
469 |
+
li = this.createLi();
|
470 |
+
|
471 |
+
$drop.find('ul')[0].innerHTML = li;
|
472 |
+
return $drop;
|
473 |
+
},
|
474 |
+
|
475 |
+
reloadLi: function () {
|
476 |
+
//Remove all children.
|
477 |
+
this.destroyLi();
|
478 |
+
//Re build
|
479 |
+
var li = this.createLi();
|
480 |
+
this.$menuInner[0].innerHTML = li;
|
481 |
+
},
|
482 |
+
|
483 |
+
destroyLi: function () {
|
484 |
+
this.$menu.find('li').remove();
|
485 |
+
},
|
486 |
+
|
487 |
+
createLi: function () {
|
488 |
+
var that = this,
|
489 |
+
_li = [],
|
490 |
+
optID = 0,
|
491 |
+
titleOption = document.createElement('option'),
|
492 |
+
liIndex = -1; // increment liIndex whenever a new <li> element is created to ensure liObj is correct
|
493 |
+
|
494 |
+
// Helper functions
|
495 |
+
/**
|
496 |
+
* @param content
|
497 |
+
* @param [index]
|
498 |
+
* @param [classes]
|
499 |
+
* @param [optgroup]
|
500 |
+
* @returns {string}
|
501 |
+
*/
|
502 |
+
var generateLI = function (content, index, classes, optgroup) {
|
503 |
+
return '<li' +
|
504 |
+
((typeof classes !== 'undefined' & '' !== classes) ? ' class="' + classes + '"' : '') +
|
505 |
+
((typeof index !== 'undefined' & null !== index) ? ' data-original-index="' + index + '"' : '') +
|
506 |
+
((typeof optgroup !== 'undefined' & null !== optgroup) ? 'data-optgroup="' + optgroup + '"' : '') +
|
507 |
+
'>' + content + '</li>';
|
508 |
+
};
|
509 |
+
|
510 |
+
/**
|
511 |
+
* @param text
|
512 |
+
* @param [classes]
|
513 |
+
* @param [inline]
|
514 |
+
* @param [tokens]
|
515 |
+
* @returns {string}
|
516 |
+
*/
|
517 |
+
var generateA = function (text, classes, inline, tokens) {
|
518 |
+
return '<a tabindex="0"' +
|
519 |
+
(typeof classes !== 'undefined' ? ' class="' + classes + '"' : '') +
|
520 |
+
(typeof inline !== 'undefined' ? ' style="' + inline + '"' : '') +
|
521 |
+
(that.options.liveSearchNormalize ? ' data-normalized-text="' + normalizeToBase(htmlEscape(text)) + '"' : '') +
|
522 |
+
(typeof tokens !== 'undefined' || tokens !== null ? ' data-tokens="' + tokens + '"' : '') +
|
523 |
+
'>' + text +
|
524 |
+
'<span class="' + that.options.iconBase + ' ' + that.options.tickIcon + ' check-mark"></span>' +
|
525 |
+
'</a>';
|
526 |
+
};
|
527 |
+
|
528 |
+
if (this.options.title && !this.multiple) {
|
529 |
+
// this option doesn't create a new <li> element, but does add a new option, so liIndex is decreased
|
530 |
+
// since liObj is recalculated on every refresh, liIndex needs to be decreased even if the titleOption is already appended
|
531 |
+
liIndex--;
|
532 |
+
|
533 |
+
if (!this.$element.find('.bs-title-option').length) {
|
534 |
+
// Use native JS to prepend option (faster)
|
535 |
+
var element = this.$element[0];
|
536 |
+
titleOption.className = 'bs-title-option';
|
537 |
+
titleOption.appendChild(document.createTextNode(this.options.title));
|
538 |
+
titleOption.value = '';
|
539 |
+
element.insertBefore(titleOption, element.firstChild);
|
540 |
+
// Check if selected attribute is already set on an option. If not, select the titleOption option.
|
541 |
+
if ($(element.options[element.selectedIndex]).attr('selected') === undefined) titleOption.selected = true;
|
542 |
+
}
|
543 |
+
}
|
544 |
+
|
545 |
+
this.$element.find('option').each(function (index) {
|
546 |
+
var $this = $(this);
|
547 |
+
|
548 |
+
liIndex++;
|
549 |
+
|
550 |
+
if ($this.hasClass('bs-title-option')) return;
|
551 |
+
|
552 |
+
// Get the class and text for the option
|
553 |
+
var optionClass = this.className || '',
|
554 |
+
inline = this.style.cssText,
|
555 |
+
text = $this.data('content') ? $this.data('content') : $this.html(),
|
556 |
+
tokens = $this.data('tokens') ? $this.data('tokens') : null,
|
557 |
+
subtext = typeof $this.data('subtext') !== 'undefined' ? '<small class="text-muted">' + $this.data('subtext') + '</small>' : '',
|
558 |
+
icon = typeof $this.data('icon') !== 'undefined' ? '<span class="' + that.options.iconBase + ' ' + $this.data('icon') + '"></span> ' : '',
|
559 |
+
isOptgroup = this.parentNode.tagName === 'OPTGROUP',
|
560 |
+
isDisabled = this.disabled || (isOptgroup && this.parentNode.disabled);
|
561 |
+
|
562 |
+
if (icon !== '' && isDisabled) {
|
563 |
+
icon = '<span>' + icon + '</span>';
|
564 |
+
}
|
565 |
+
|
566 |
+
if (that.options.hideDisabled && isDisabled && !isOptgroup) {
|
567 |
+
liIndex--;
|
568 |
+
return;
|
569 |
+
}
|
570 |
+
|
571 |
+
if (!$this.data('content')) {
|
572 |
+
// Prepend any icon and append any subtext to the main text.
|
573 |
+
text = icon + '<span class="text">' + text + subtext + '</span>';
|
574 |
+
}
|
575 |
+
|
576 |
+
if (isOptgroup && $this.data('divider') !== true) {
|
577 |
+
var optGroupClass = ' ' + this.parentNode.className || '';
|
578 |
+
|
579 |
+
if ($this.index() === 0) { // Is it the first option of the optgroup?
|
580 |
+
optID += 1;
|
581 |
+
|
582 |
+
// Get the opt group label
|
583 |
+
var label = this.parentNode.label,
|
584 |
+
labelSubtext = typeof $this.parent().data('subtext') !== 'undefined' ? '<small class="text-muted">' + $this.parent().data('subtext') + '</small>' : '',
|
585 |
+
labelIcon = $this.parent().data('icon') ? '<span class="' + that.options.iconBase + ' ' + $this.parent().data('icon') + '"></span> ' : '';
|
586 |
+
|
587 |
+
label = labelIcon + '<span class="text">' + label + labelSubtext + '</span>';
|
588 |
+
|
589 |
+
if (index !== 0 && _li.length > 0) { // Is it NOT the first option of the select && are there elements in the dropdown?
|
590 |
+
liIndex++;
|
591 |
+
_li.push(generateLI('', null, 'divider', optID + 'div'));
|
592 |
+
}
|
593 |
+
liIndex++;
|
594 |
+
_li.push(generateLI(label, null, 'dropdown-header' + optGroupClass, optID));
|
595 |
+
}
|
596 |
+
|
597 |
+
if (that.options.hideDisabled && isDisabled) {
|
598 |
+
liIndex--;
|
599 |
+
return;
|
600 |
+
}
|
601 |
+
|
602 |
+
_li.push(generateLI(generateA(text, 'opt ' + optionClass + optGroupClass, inline, tokens), index, '', optID));
|
603 |
+
} else if ($this.data('divider') === true) {
|
604 |
+
_li.push(generateLI('', index, 'divider'));
|
605 |
+
} else if ($this.data('hidden') === true) {
|
606 |
+
_li.push(generateLI(generateA(text, optionClass, inline, tokens), index, 'hidden is-hidden'));
|
607 |
+
} else {
|
608 |
+
if (this.previousElementSibling && this.previousElementSibling.tagName === 'OPTGROUP') {
|
609 |
+
liIndex++;
|
610 |
+
_li.push(generateLI('', null, 'divider', optID + 'div'));
|
611 |
+
}
|
612 |
+
_li.push(generateLI(generateA(text, optionClass, inline, tokens), index));
|
613 |
+
}
|
614 |
+
|
615 |
+
that.liObj[index] = liIndex;
|
616 |
+
});
|
617 |
+
|
618 |
+
//If we are not multiple, we don't have a selected item, and we don't have a title, select the first element so something is set in the button
|
619 |
+
if (!this.multiple && this.$element.find('option:selected').length === 0 && !this.options.title) {
|
620 |
+
this.$element.find('option').eq(0).prop('selected', true).attr('selected', 'selected');
|
621 |
+
}
|
622 |
+
|
623 |
+
return _li.join('');
|
624 |
+
},
|
625 |
+
|
626 |
+
findLis: function () {
|
627 |
+
if (this.$lis == null) this.$lis = this.$menu.find('li');
|
628 |
+
return this.$lis;
|
629 |
+
},
|
630 |
+
|
631 |
+
/**
|
632 |
+
* @param [updateLi] defaults to true
|
633 |
+
*/
|
634 |
+
render: function (updateLi) {
|
635 |
+
var that = this,
|
636 |
+
notDisabled;
|
637 |
+
|
638 |
+
//Update the LI to match the SELECT
|
639 |
+
if (updateLi !== false) {
|
640 |
+
this.$element.find('option').each(function (index) {
|
641 |
+
var $lis = that.findLis().eq(that.liObj[index]);
|
642 |
+
|
643 |
+
that.setDisabled(index, this.disabled || this.parentNode.tagName === 'OPTGROUP' && this.parentNode.disabled, $lis);
|
644 |
+
that.setSelected(index, this.selected, $lis);
|
645 |
+
});
|
646 |
+
}
|
647 |
+
|
648 |
+
this.tabIndex();
|
649 |
+
|
650 |
+
var selectedItems = this.$element.find('option').map(function () {
|
651 |
+
if (this.selected) {
|
652 |
+
if (that.options.hideDisabled && (this.disabled || this.parentNode.tagName === 'OPTGROUP' && this.parentNode.disabled)) return;
|
653 |
+
|
654 |
+
var $this = $(this),
|
655 |
+
icon = $this.data('icon') && that.options.showIcon ? '<i class="' + that.options.iconBase + ' ' + $this.data('icon') + '"></i> ' : '',
|
656 |
+
subtext;
|
657 |
+
|
658 |
+
if (that.options.showSubtext && $this.data('subtext') && !that.multiple) {
|
659 |
+
subtext = ' <small class="text-muted">' + $this.data('subtext') + '</small>';
|
660 |
+
} else {
|
661 |
+
subtext = '';
|
662 |
+
}
|
663 |
+
if (typeof $this.attr('title') !== 'undefined') {
|
664 |
+
return $this.attr('title');
|
665 |
+
} else if ($this.data('content') && that.options.showContent) {
|
666 |
+
return $this.data('content');
|
667 |
+
} else {
|
668 |
+
return icon + $this.html() + subtext;
|
669 |
+
}
|
670 |
+
}
|
671 |
+
}).toArray();
|
672 |
+
|
673 |
+
//Fixes issue in IE10 occurring when no default option is selected and at least one option is disabled
|
674 |
+
//Convert all the values into a comma delimited string
|
675 |
+
var title = !this.multiple ? selectedItems[0] : selectedItems.join(this.options.multipleSeparator);
|
676 |
+
|
677 |
+
//If this is multi select, and the selectText type is count, the show 1 of 2 selected etc..
|
678 |
+
if (this.multiple && this.options.selectedTextFormat.indexOf('count') > -1) {
|
679 |
+
var max = this.options.selectedTextFormat.split('>');
|
680 |
+
if ((max.length > 1 && selectedItems.length > max[1]) || (max.length == 1 && selectedItems.length >= 2)) {
|
681 |
+
notDisabled = this.options.hideDisabled ? ', [disabled]' : '';
|
682 |
+
var totalCount = this.$element.find('option').not('[data-divider="true"], [data-hidden="true"]' + notDisabled).length,
|
683 |
+
tr8nText = (typeof this.options.countSelectedText === 'function') ? this.options.countSelectedText(selectedItems.length, totalCount) : this.options.countSelectedText;
|
684 |
+
title = tr8nText.replace('{0}', selectedItems.length.toString()).replace('{1}', totalCount.toString());
|
685 |
+
}
|
686 |
+
}
|
687 |
+
|
688 |
+
if (this.options.title == undefined) {
|
689 |
+
this.options.title = this.$element.attr('title');
|
690 |
+
}
|
691 |
+
|
692 |
+
if (this.options.selectedTextFormat == 'static') {
|
693 |
+
title = this.options.title;
|
694 |
+
}
|
695 |
+
|
696 |
+
//If we dont have a title, then use the default, or if nothing is set at all, use the not selected text
|
697 |
+
if (!title) {
|
698 |
+
title = typeof this.options.title !== 'undefined' ? this.options.title : this.options.noneSelectedText;
|
699 |
+
}
|
700 |
+
|
701 |
+
//strip all html-tags and trim the result
|
702 |
+
// this.$button.attr('title', $.trim(title.replace(/<[^>]*>?/g, '')));
|
703 |
+
this.$button.children('.filter-option').html(title);
|
704 |
+
|
705 |
+
this.$element.trigger('rendered.bs.select');
|
706 |
+
},
|
707 |
+
|
708 |
+
/**
|
709 |
+
* @param [style]
|
710 |
+
* @param [status]
|
711 |
+
*/
|
712 |
+
setStyle: function (style, status) {
|
713 |
+
if (this.$element.attr('class')) {
|
714 |
+
this.$newElement.addClass(this.$element.attr('class').replace(/selectpicker|mobile-device|bs-select-hidden|validate\[.*\]/gi, ''));
|
715 |
+
}
|
716 |
+
|
717 |
+
var buttonClass = style ? style : this.options.style;
|
718 |
+
|
719 |
+
if (status == 'add') {
|
720 |
+
this.$button.addClass(buttonClass);
|
721 |
+
} else if (status == 'remove') {
|
722 |
+
this.$button.removeClass(buttonClass);
|
723 |
+
} else {
|
724 |
+
this.$button.removeClass(this.options.style);
|
725 |
+
this.$button.addClass(buttonClass);
|
726 |
+
}
|
727 |
+
},
|
728 |
+
|
729 |
+
liHeight: function (refresh) {
|
730 |
+
if (!refresh && (this.options.size === false || this.sizeInfo)) return;
|
731 |
+
|
732 |
+
var newElement = document.createElement('div'),
|
733 |
+
menu = document.createElement('div'),
|
734 |
+
menuInner = document.createElement('ul'),
|
735 |
+
divider = document.createElement('li'),
|
736 |
+
li = document.createElement('li'),
|
737 |
+
a = document.createElement('a'),
|
738 |
+
text = document.createElement('span'),
|
739 |
+
header = this.options.header && this.$menu.find('.popover-title').length > 0 ? this.$menu.find('.popover-title')[0].cloneNode(true) : null,
|
740 |
+
search = this.options.liveSearch ? document.createElement('div') : null,
|
741 |
+
actions = this.options.actionsBox && this.multiple && this.$menu.find('.bs-actionsbox').length > 0 ? this.$menu.find('.bs-actionsbox')[0].cloneNode(true) : null,
|
742 |
+
doneButton = this.options.doneButton && this.multiple && this.$menu.find('.bs-donebutton').length > 0 ? this.$menu.find('.bs-donebutton')[0].cloneNode(true) : null;
|
743 |
+
|
744 |
+
text.className = 'text';
|
745 |
+
newElement.className = this.$menu[0].parentNode.className + ' open';
|
746 |
+
menu.className = 'dropdown-menu open';
|
747 |
+
menuInner.className = 'dropdown-menu inner';
|
748 |
+
divider.className = 'divider';
|
749 |
+
|
750 |
+
text.appendChild(document.createTextNode('Inner text'));
|
751 |
+
a.appendChild(text);
|
752 |
+
li.appendChild(a);
|
753 |
+
menuInner.appendChild(li);
|
754 |
+
menuInner.appendChild(divider);
|
755 |
+
if (header) menu.appendChild(header);
|
756 |
+
if (search) {
|
757 |
+
// create a span instead of input as creating an input element is slower
|
758 |
+
var input = document.createElement('span');
|
759 |
+
search.className = 'bs-searchbox';
|
760 |
+
input.className = 'form-control';
|
761 |
+
search.appendChild(input);
|
762 |
+
menu.appendChild(search);
|
763 |
+
}
|
764 |
+
if (actions) menu.appendChild(actions);
|
765 |
+
menu.appendChild(menuInner);
|
766 |
+
if (doneButton) menu.appendChild(doneButton);
|
767 |
+
newElement.appendChild(menu);
|
768 |
+
|
769 |
+
document.body.appendChild(newElement);
|
770 |
+
|
771 |
+
var liHeight = a.offsetHeight,
|
772 |
+
headerHeight = header ? header.offsetHeight : 0,
|
773 |
+
searchHeight = search ? search.offsetHeight : 0,
|
774 |
+
actionsHeight = actions ? actions.offsetHeight : 0,
|
775 |
+
doneButtonHeight = doneButton ? doneButton.offsetHeight : 0,
|
776 |
+
dividerHeight = $(divider).outerHeight(true),
|
777 |
+
// fall back to jQuery if getComputedStyle is not supported
|
778 |
+
menuStyle = typeof getComputedStyle === 'function' ? getComputedStyle(menu) : false,
|
779 |
+
$menu = menuStyle ? null : $(menu),
|
780 |
+
menuPadding = parseInt(menuStyle ? menuStyle.paddingTop : $menu.css('paddingTop')) +
|
781 |
+
parseInt(menuStyle ? menuStyle.paddingBottom : $menu.css('paddingBottom')) +
|
782 |
+
parseInt(menuStyle ? menuStyle.borderTopWidth : $menu.css('borderTopWidth')) +
|
783 |
+
parseInt(menuStyle ? menuStyle.borderBottomWidth : $menu.css('borderBottomWidth')),
|
784 |
+
menuExtras = menuPadding +
|
785 |
+
parseInt(menuStyle ? menuStyle.marginTop : $menu.css('marginTop')) +
|
786 |
+
parseInt(menuStyle ? menuStyle.marginBottom : $menu.css('marginBottom')) + 2;
|
787 |
+
|
788 |
+
document.body.removeChild(newElement);
|
789 |
+
|
790 |
+
this.sizeInfo = {
|
791 |
+
liHeight: liHeight,
|
792 |
+
headerHeight: headerHeight,
|
793 |
+
searchHeight: searchHeight,
|
794 |
+
actionsHeight: actionsHeight,
|
795 |
+
doneButtonHeight: doneButtonHeight,
|
796 |
+
dividerHeight: dividerHeight,
|
797 |
+
menuPadding: menuPadding,
|
798 |
+
menuExtras: menuExtras
|
799 |
+
};
|
800 |
+
},
|
801 |
+
|
802 |
+
setSize: function () {
|
803 |
+
this.findLis();
|
804 |
+
this.liHeight();
|
805 |
+
|
806 |
+
if (this.options.header) this.$menu.css('padding-top', 0);
|
807 |
+
if (this.options.size === false) return;
|
808 |
+
|
809 |
+
var that = this,
|
810 |
+
$menu = this.$menu,
|
811 |
+
$menuInner = this.$menuInner,
|
812 |
+
$window = $(window),
|
813 |
+
selectHeight = this.$newElement[0].offsetHeight,
|
814 |
+
liHeight = this.sizeInfo['liHeight'],
|
815 |
+
headerHeight = this.sizeInfo['headerHeight'],
|
816 |
+
searchHeight = this.sizeInfo['searchHeight'],
|
817 |
+
actionsHeight = this.sizeInfo['actionsHeight'],
|
818 |
+
doneButtonHeight = this.sizeInfo['doneButtonHeight'],
|
819 |
+
divHeight = this.sizeInfo['dividerHeight'],
|
820 |
+
menuPadding = this.sizeInfo['menuPadding'],
|
821 |
+
menuExtras = this.sizeInfo['menuExtras'],
|
822 |
+
notDisabled = this.options.hideDisabled ? '.disabled' : '',
|
823 |
+
menuHeight,
|
824 |
+
getHeight,
|
825 |
+
selectOffsetTop,
|
826 |
+
selectOffsetBot,
|
827 |
+
posVert = function () {
|
828 |
+
selectOffsetTop = that.$newElement.offset().top - $window.scrollTop();
|
829 |
+
selectOffsetBot = $window.height() - selectOffsetTop - selectHeight;
|
830 |
+
};
|
831 |
+
|
832 |
+
posVert();
|
833 |
+
|
834 |
+
if (this.options.size === 'auto') {
|
835 |
+
var getSize = function () {
|
836 |
+
var minHeight,
|
837 |
+
hasClass = function (className, include) {
|
838 |
+
return function (element) {
|
839 |
+
if (include) {
|
840 |
+
return (element.classList ? element.classList.contains(className) : $(element).hasClass(className));
|
841 |
+
} else {
|
842 |
+
return !(element.classList ? element.classList.contains(className) : $(element).hasClass(className));
|
843 |
+
}
|
844 |
+
};
|
845 |
+
},
|
846 |
+
lis = that.$menuInner[0].getElementsByTagName('li'),
|
847 |
+
lisVisible = Array.prototype.filter ? Array.prototype.filter.call(lis, hasClass('hidden', false)) : that.$lis.not('.hidden'),
|
848 |
+
optGroup = Array.prototype.filter ? Array.prototype.filter.call(lisVisible, hasClass('dropdown-header', true)) : lisVisible.filter('.dropdown-header');
|
849 |
+
|
850 |
+
posVert();
|
851 |
+
menuHeight = selectOffsetBot - menuExtras;
|
852 |
+
|
853 |
+
if (that.options.container) {
|
854 |
+
if (!$menu.data('height')) $menu.data('height', $menu.height());
|
855 |
+
getHeight = $menu.data('height');
|
856 |
+
} else {
|
857 |
+
getHeight = $menu.height();
|
858 |
+
}
|
859 |
+
|
860 |
+
if (that.options.dropupAuto) {
|
861 |
+
that.$newElement.toggleClass('dropup', selectOffsetTop > selectOffsetBot && (menuHeight - menuExtras) < getHeight);
|
862 |
+
}
|
863 |
+
if (that.$newElement.hasClass('dropup')) {
|
864 |
+
menuHeight = selectOffsetTop - menuExtras;
|
865 |
+
}
|
866 |
+
|
867 |
+
if ((lisVisible.length + optGroup.length) > 3) {
|
868 |
+
minHeight = liHeight * 3 + menuExtras - 2;
|
869 |
+
} else {
|
870 |
+
minHeight = 0;
|
871 |
+
}
|
872 |
+
|
873 |
+
$menu.css({
|
874 |
+
'max-height': menuHeight + 'px',
|
875 |
+
'overflow': 'hidden',
|
876 |
+
'min-height': minHeight + headerHeight + searchHeight + actionsHeight + doneButtonHeight + 'px'
|
877 |
+
});
|
878 |
+
$menuInner.css({
|
879 |
+
'max-height': menuHeight - headerHeight - searchHeight - actionsHeight - doneButtonHeight - menuPadding + 'px',
|
880 |
+
'overflow-y': 'auto',
|
881 |
+
'min-height': Math.max(minHeight - menuPadding, 0) + 'px'
|
882 |
+
});
|
883 |
+
};
|
884 |
+
getSize();
|
885 |
+
this.$searchbox.off('input.getSize propertychange.getSize').on('input.getSize propertychange.getSize', getSize);
|
886 |
+
$window.off('resize.getSize scroll.getSize').on('resize.getSize scroll.getSize', getSize);
|
887 |
+
} else if (this.options.size && this.options.size != 'auto' && this.$lis.not(notDisabled).length > this.options.size) {
|
888 |
+
var optIndex = this.$lis.not('.divider').not(notDisabled).children().slice(0, this.options.size).last().parent().index(),
|
889 |
+
divLength = this.$lis.slice(0, optIndex + 1).filter('.divider').length;
|
890 |
+
menuHeight = liHeight * this.options.size + divLength * divHeight + menuPadding;
|
891 |
+
|
892 |
+
if (that.options.container) {
|
893 |
+
if (!$menu.data('height')) $menu.data('height', $menu.height());
|
894 |
+
getHeight = $menu.data('height');
|
895 |
+
} else {
|
896 |
+
getHeight = $menu.height();
|
897 |
+
}
|
898 |
+
|
899 |
+
if (that.options.dropupAuto) {
|
900 |
+
//noinspection JSUnusedAssignment
|
901 |
+
this.$newElement.toggleClass('dropup', selectOffsetTop > selectOffsetBot && (menuHeight - menuExtras) < getHeight);
|
902 |
+
}
|
903 |
+
$menu.css({
|
904 |
+
'max-height': menuHeight + headerHeight + searchHeight + actionsHeight + doneButtonHeight + 'px',
|
905 |
+
'overflow': 'hidden',
|
906 |
+
'min-height': ''
|
907 |
+
});
|
908 |
+
$menuInner.css({
|
909 |
+
'max-height': menuHeight - menuPadding + 'px',
|
910 |
+
'overflow-y': 'auto',
|
911 |
+
'min-height': ''
|
912 |
+
});
|
913 |
+
}
|
914 |
+
},
|
915 |
+
|
916 |
+
setWidth: function () {
|
917 |
+
if (this.options.width === 'auto') {
|
918 |
+
this.$menu.css('min-width', '0');
|
919 |
+
|
920 |
+
// Get correct width if element is hidden
|
921 |
+
var $selectClone = this.$menu.parent().clone().appendTo('body'),
|
922 |
+
$selectClone2 = this.options.container ? this.$newElement.clone().appendTo('body') : $selectClone,
|
923 |
+
ulWidth = $selectClone.children('.dropdown-menu').outerWidth(),
|
924 |
+
btnWidth = $selectClone2.css('width', 'auto').children('button').outerWidth();
|
925 |
+
|
926 |
+
$selectClone.remove();
|
927 |
+
$selectClone2.remove();
|
928 |
+
|
929 |
+
// Set width to whatever's larger, button title or longest option
|
930 |
+
this.$newElement.css('width', Math.max(ulWidth, btnWidth) + 'px');
|
931 |
+
} else if (this.options.width === 'fit') {
|
932 |
+
// Remove inline min-width so width can be changed from 'auto'
|
933 |
+
this.$menu.css('min-width', '');
|
934 |
+
this.$newElement.css('width', '').addClass('fit-width');
|
935 |
+
} else if (this.options.width) {
|
936 |
+
// Remove inline min-width so width can be changed from 'auto'
|
937 |
+
this.$menu.css('min-width', '');
|
938 |
+
this.$newElement.css('width', this.options.width);
|
939 |
+
} else {
|
940 |
+
// Remove inline min-width/width so width can be changed
|
941 |
+
this.$menu.css('min-width', '');
|
942 |
+
this.$newElement.css('width', '');
|
943 |
+
}
|
944 |
+
// Remove fit-width class if width is changed programmatically
|
945 |
+
if (this.$newElement.hasClass('fit-width') && this.options.width !== 'fit') {
|
946 |
+
this.$newElement.removeClass('fit-width');
|
947 |
+
}
|
948 |
+
},
|
949 |
+
|
950 |
+
selectPosition: function () {
|
951 |
+
this.$bsContainer = $('<div class="bs-container" />');
|
952 |
+
|
953 |
+
var that = this,
|
954 |
+
pos,
|
955 |
+
actualHeight,
|
956 |
+
getPlacement = function ($element) {
|
957 |
+
that.$bsContainer.addClass($element.attr('class').replace(/form-control|fit-width/gi, '')).toggleClass('dropup', $element.hasClass('dropup'));
|
958 |
+
pos = $element.offset();
|
959 |
+
actualHeight = $element.hasClass('dropup') ? 0 : $element[0].offsetHeight;
|
960 |
+
that.$bsContainer.css({
|
961 |
+
'top': pos.top + actualHeight,
|
962 |
+
'left': pos.left,
|
963 |
+
'width': $element[0].offsetWidth
|
964 |
+
});
|
965 |
+
};
|
966 |
+
|
967 |
+
this.$button.on('click', function () {
|
968 |
+
var $this = $(this);
|
969 |
+
|
970 |
+
if (that.isDisabled()) {
|
971 |
+
return;
|
972 |
+
}
|
973 |
+
|
974 |
+
getPlacement(that.$newElement);
|
975 |
+
|
976 |
+
that.$bsContainer
|
977 |
+
.appendTo(that.options.container)
|
978 |
+
.toggleClass('open', !$this.hasClass('open'))
|
979 |
+
.append(that.$menu);
|
980 |
+
});
|
981 |
+
|
982 |
+
$(window).on('resize scroll', function () {
|
983 |
+
getPlacement(that.$newElement);
|
984 |
+
});
|
985 |
+
|
986 |
+
this.$element.on('hide.bs.select', function () {
|
987 |
+
that.$menu.data('height', that.$menu.height());
|
988 |
+
that.$bsContainer.detach();
|
989 |
+
});
|
990 |
+
},
|
991 |
+
|
992 |
+
setSelected: function (index, selected, $lis) {
|
993 |
+
if (!$lis) {
|
994 |
+
$lis = this.findLis().eq(this.liObj[index]);
|
995 |
+
}
|
996 |
+
|
997 |
+
$lis.toggleClass('selected', selected);
|
998 |
+
},
|
999 |
+
|
1000 |
+
setDisabled: function (index, disabled, $lis) {
|
1001 |
+
if (!$lis) {
|
1002 |
+
$lis = this.findLis().eq(this.liObj[index]);
|
1003 |
+
}
|
1004 |
+
|
1005 |
+
if (disabled) {
|
1006 |
+
$lis.addClass('disabled').children('a').attr('href', '#').attr('tabindex', -1);
|
1007 |
+
} else {
|
1008 |
+
$lis.removeClass('disabled').children('a').removeAttr('href').attr('tabindex', 0);
|
1009 |
+
}
|
1010 |
+
},
|
1011 |
+
|
1012 |
+
isDisabled: function () {
|
1013 |
+
return this.$element[0].disabled;
|
1014 |
+
},
|
1015 |
+
|
1016 |
+
checkDisabled: function () {
|
1017 |
+
var that = this;
|
1018 |
+
|
1019 |
+
if (this.isDisabled()) {
|
1020 |
+
this.$newElement.addClass('disabled');
|
1021 |
+
this.$button.addClass('disabled').attr('tabindex', -1);
|
1022 |
+
} else {
|
1023 |
+
if (this.$button.hasClass('disabled')) {
|
1024 |
+
this.$newElement.removeClass('disabled');
|
1025 |
+
this.$button.removeClass('disabled');
|
1026 |
+
}
|
1027 |
+
|
1028 |
+
if (this.$button.attr('tabindex') == -1 && !this.$element.data('tabindex')) {
|
1029 |
+
this.$button.removeAttr('tabindex');
|
1030 |
+
}
|
1031 |
+
}
|
1032 |
+
|
1033 |
+
this.$button.click(function () {
|
1034 |
+
return !that.isDisabled();
|
1035 |
+
});
|
1036 |
+
},
|
1037 |
+
|
1038 |
+
tabIndex: function () {
|
1039 |
+
if (this.$element.data('tabindex') !== this.$element.attr('tabindex') &&
|
1040 |
+
(this.$element.attr('tabindex') !== -98 && this.$element.attr('tabindex') !== '-98')) {
|
1041 |
+
this.$element.data('tabindex', this.$element.attr('tabindex'));
|
1042 |
+
this.$button.attr('tabindex', this.$element.data('tabindex'));
|
1043 |
+
}
|
1044 |
+
|
1045 |
+
this.$element.attr('tabindex', -98);
|
1046 |
+
},
|
1047 |
+
|
1048 |
+
clickListener: function () {
|
1049 |
+
var that = this,
|
1050 |
+
$document = $(document);
|
1051 |
+
|
1052 |
+
this.$newElement.on('touchstart.dropdown', '.dropdown-menu', function (e) {
|
1053 |
+
e.stopPropagation();
|
1054 |
+
});
|
1055 |
+
|
1056 |
+
$document.data('spaceSelect', false);
|
1057 |
+
|
1058 |
+
this.$button.on('keyup', function (e) {
|
1059 |
+
if (/(32)/.test(e.keyCode.toString(10)) && $document.data('spaceSelect')) {
|
1060 |
+
e.preventDefault();
|
1061 |
+
$document.data('spaceSelect', false);
|
1062 |
+
}
|
1063 |
+
});
|
1064 |
+
|
1065 |
+
this.$button.on('click', function () {
|
1066 |
+
that.setSize();
|
1067 |
+
});
|
1068 |
+
|
1069 |
+
this.$element.on('shown.bs.select', function () {
|
1070 |
+
if (!that.options.liveSearch && !that.multiple) {
|
1071 |
+
that.$menuInner.find('.selected a').focus();
|
1072 |
+
} else if (!that.multiple) {
|
1073 |
+
var selectedIndex = that.liObj[that.$element[0].selectedIndex];
|
1074 |
+
|
1075 |
+
if (typeof selectedIndex !== 'number' || that.options.size === false) return;
|
1076 |
+
|
1077 |
+
// scroll to selected option
|
1078 |
+
var offset = that.$lis.eq(selectedIndex)[0].offsetTop - that.$menuInner[0].offsetTop;
|
1079 |
+
offset = offset - that.$menuInner[0].offsetHeight/2 + that.sizeInfo.liHeight/2;
|
1080 |
+
that.$menuInner[0].scrollTop = offset;
|
1081 |
+
}
|
1082 |
+
});
|
1083 |
+
|
1084 |
+
this.$menuInner.on('click', 'li a', function (e) {
|
1085 |
+
var $this = $(this),
|
1086 |
+
clickedIndex = $this.parent().data('originalIndex'),
|
1087 |
+
prevValue = that.$element.val(),
|
1088 |
+
prevIndex = that.$element.prop('selectedIndex');
|
1089 |
+
|
1090 |
+
// Don't close on multi choice menu
|
1091 |
+
if (that.multiple) {
|
1092 |
+
e.stopPropagation();
|
1093 |
+
}
|
1094 |
+
|
1095 |
+
e.preventDefault();
|
1096 |
+
|
1097 |
+
//Don't run if we have been disabled
|
1098 |
+
if (!that.isDisabled() && !$this.parent().hasClass('disabled')) {
|
1099 |
+
var $options = that.$element.find('option'),
|
1100 |
+
$option = $options.eq(clickedIndex),
|
1101 |
+
state = $option.prop('selected'),
|
1102 |
+
$optgroup = $option.parent('optgroup'),
|
1103 |
+
maxOptions = that.options.maxOptions,
|
1104 |
+
maxOptionsGrp = $optgroup.data('maxOptions') || false;
|
1105 |
+
|
1106 |
+
if (!that.multiple) { // Deselect all others if not multi select box
|
1107 |
+
$options.prop('selected', false);
|
1108 |
+
$option.prop('selected', true);
|
1109 |
+
that.$menuInner.find('.selected').removeClass('selected');
|
1110 |
+
that.setSelected(clickedIndex, true);
|
1111 |
+
} else { // Toggle the one we have chosen if we are multi select.
|
1112 |
+
$option.prop('selected', !state);
|
1113 |
+
that.setSelected(clickedIndex, !state);
|
1114 |
+
$this.blur();
|
1115 |
+
|
1116 |
+
if (maxOptions !== false || maxOptionsGrp !== false) {
|
1117 |
+
var maxReached = maxOptions < $options.filter(':selected').length,
|
1118 |
+
maxReachedGrp = maxOptionsGrp < $optgroup.find('option:selected').length;
|
1119 |
+
|
1120 |
+
if ((maxOptions && maxReached) || (maxOptionsGrp && maxReachedGrp)) {
|
1121 |
+
if (maxOptions && maxOptions == 1) {
|
1122 |
+
$options.prop('selected', false);
|
1123 |
+
$option.prop('selected', true);
|
1124 |
+
that.$menuInner.find('.selected').removeClass('selected');
|
1125 |
+
that.setSelected(clickedIndex, true);
|
1126 |
+
} else if (maxOptionsGrp && maxOptionsGrp == 1) {
|
1127 |
+
$optgroup.find('option:selected').prop('selected', false);
|
1128 |
+
$option.prop('selected', true);
|
1129 |
+
var optgroupID = $this.parent().data('optgroup');
|
1130 |
+
that.$menuInner.find('[data-optgroup="' + optgroupID + '"]').removeClass('selected');
|
1131 |
+
that.setSelected(clickedIndex, true);
|
1132 |
+
} else {
|
1133 |
+
var maxOptionsArr = (typeof that.options.maxOptionsText === 'function') ?
|
1134 |
+
that.options.maxOptionsText(maxOptions, maxOptionsGrp) : that.options.maxOptionsText,
|
1135 |
+
maxTxt = maxOptionsArr[0].replace('{n}', maxOptions),
|
1136 |
+
maxTxtGrp = maxOptionsArr[1].replace('{n}', maxOptionsGrp),
|
1137 |
+
$notify = $('<div class="notify"></div>');
|
1138 |
+
// If {var} is set in array, replace it
|
1139 |
+
/** @deprecated */
|
1140 |
+
if (maxOptionsArr[2]) {
|
1141 |
+
maxTxt = maxTxt.replace('{var}', maxOptionsArr[2][maxOptions > 1 ? 0 : 1]);
|
1142 |
+
maxTxtGrp = maxTxtGrp.replace('{var}', maxOptionsArr[2][maxOptionsGrp > 1 ? 0 : 1]);
|
1143 |
+
}
|
1144 |
+
|
1145 |
+
$option.prop('selected', false);
|
1146 |
+
|
1147 |
+
that.$menu.append($notify);
|
1148 |
+
|
1149 |
+
if (maxOptions && maxReached) {
|
1150 |
+
$notify.append($('<div>' + maxTxt + '</div>'));
|
1151 |
+
that.$element.trigger('maxReached.bs.select');
|
1152 |
+
}
|
1153 |
+
|
1154 |
+
if (maxOptionsGrp && maxReachedGrp) {
|
1155 |
+
$notify.append($('<div>' + maxTxtGrp + '</div>'));
|
1156 |
+
that.$element.trigger('maxReachedGrp.bs.select');
|
1157 |
+
}
|
1158 |
+
|
1159 |
+
setTimeout(function () {
|
1160 |
+
that.setSelected(clickedIndex, false);
|
1161 |
+
}, 10);
|
1162 |
+
|
1163 |
+
$notify.delay(750).fadeOut(300, function () {
|
1164 |
+
$(this).remove();
|
1165 |
+
});
|
1166 |
+
}
|
1167 |
+
}
|
1168 |
+
}
|
1169 |
+
}
|
1170 |
+
|
1171 |
+
if (!that.multiple) {
|
1172 |
+
that.$button.focus();
|
1173 |
+
} else if (that.options.liveSearch) {
|
1174 |
+
that.$searchbox.focus();
|
1175 |
+
}
|
1176 |
+
|
1177 |
+
// Trigger select 'change'
|
1178 |
+
if ((prevValue != that.$element.val() && that.multiple) || (prevIndex != that.$element.prop('selectedIndex') && !that.multiple)) {
|
1179 |
+
// $option.prop('selected') is current option state (selected/unselected). state is previous option state.
|
1180 |
+
that.$element
|
1181 |
+
.trigger('changed.bs.select', [clickedIndex, $option.prop('selected'), state])
|
1182 |
+
.triggerNative('change');
|
1183 |
+
}
|
1184 |
+
}
|
1185 |
+
});
|
1186 |
+
|
1187 |
+
this.$menu.on('click', 'li.disabled a, .popover-title, .popover-title :not(.close)', function (e) {
|
1188 |
+
if (e.currentTarget == this) {
|
1189 |
+
e.preventDefault();
|
1190 |
+
e.stopPropagation();
|
1191 |
+
if (that.options.liveSearch && !$(e.target).hasClass('close')) {
|
1192 |
+
that.$searchbox.focus();
|
1193 |
+
} else {
|
1194 |
+
that.$button.focus();
|
1195 |
+
}
|
1196 |
+
}
|
1197 |
+
});
|
1198 |
+
|
1199 |
+
this.$menuInner.on('click', '.divider, .dropdown-header', function (e) {
|
1200 |
+
e.preventDefault();
|
1201 |
+
e.stopPropagation();
|
1202 |
+
if (that.options.liveSearch) {
|
1203 |
+
that.$searchbox.focus();
|
1204 |
+
} else {
|
1205 |
+
that.$button.focus();
|
1206 |
+
}
|
1207 |
+
});
|
1208 |
+
|
1209 |
+
this.$menu.on('click', '.popover-title .close', function () {
|
1210 |
+
that.$button.click();
|
1211 |
+
});
|
1212 |
+
|
1213 |
+
this.$searchbox.on('click', function (e) {
|
1214 |
+
e.stopPropagation();
|
1215 |
+
});
|
1216 |
+
|
1217 |
+
this.$menu.on('click', '.actions-btn', function (e) {
|
1218 |
+
if (that.options.liveSearch) {
|
1219 |
+
that.$searchbox.focus();
|
1220 |
+
} else {
|
1221 |
+
that.$button.focus();
|
1222 |
+
}
|
1223 |
+
|
1224 |
+
e.preventDefault();
|
1225 |
+
e.stopPropagation();
|
1226 |
+
|
1227 |
+
if ($(this).hasClass('bs-select-all')) {
|
1228 |
+
that.selectAll();
|
1229 |
+
} else {
|
1230 |
+
that.deselectAll();
|
1231 |
+
}
|
1232 |
+
});
|
1233 |
+
|
1234 |
+
this.$element.change(function () {
|
1235 |
+
that.render(false);
|
1236 |
+
});
|
1237 |
+
},
|
1238 |
+
|
1239 |
+
liveSearchListener: function () {
|
1240 |
+
var that = this,
|
1241 |
+
$no_results = $('<li class="no-results"></li>');
|
1242 |
+
|
1243 |
+
this.$button.on('click.dropdown.data-api touchstart.dropdown.data-api', function () {
|
1244 |
+
that.$menuInner.find('.active').removeClass('active');
|
1245 |
+
if (!!that.$searchbox.val()) {
|
1246 |
+
that.$searchbox.val('');
|
1247 |
+
that.$lis.not('.is-hidden').removeClass('hidden');
|
1248 |
+
if (!!$no_results.parent().length) $no_results.remove();
|
1249 |
+
}
|
1250 |
+
if (!that.multiple) that.$menuInner.find('.selected').addClass('active');
|
1251 |
+
setTimeout(function () {
|
1252 |
+
that.$searchbox.focus();
|
1253 |
+
}, 10);
|
1254 |
+
});
|
1255 |
+
|
1256 |
+
this.$searchbox.on('click.dropdown.data-api focus.dropdown.data-api touchend.dropdown.data-api', function (e) {
|
1257 |
+
e.stopPropagation();
|
1258 |
+
});
|
1259 |
+
|
1260 |
+
this.$searchbox.on('input propertychange', function () {
|
1261 |
+
if (that.$searchbox.val()) {
|
1262 |
+
var $searchBase = that.$lis.not('.is-hidden').removeClass('hidden').children('a');
|
1263 |
+
if (that.options.liveSearchNormalize) {
|
1264 |
+
$searchBase = $searchBase.not(':a' + that._searchStyle() + '("' + normalizeToBase(that.$searchbox.val()) + '")');
|
1265 |
+
} else {
|
1266 |
+
$searchBase = $searchBase.not(':' + that._searchStyle() + '("' + that.$searchbox.val() + '")');
|
1267 |
+
}
|
1268 |
+
$searchBase.parent().addClass('hidden');
|
1269 |
+
|
1270 |
+
that.$lis.filter('.dropdown-header').each(function () {
|
1271 |
+
var $this = $(this),
|
1272 |
+
optgroup = $this.data('optgroup');
|
1273 |
+
|
1274 |
+
if (that.$lis.filter('[data-optgroup=' + optgroup + ']').not($this).not('.hidden').length === 0) {
|
1275 |
+
$this.addClass('hidden');
|
1276 |
+
that.$lis.filter('[data-optgroup=' + optgroup + 'div]').addClass('hidden');
|
1277 |
+
}
|
1278 |
+
});
|
1279 |
+
|
1280 |
+
var $lisVisible = that.$lis.not('.hidden');
|
1281 |
+
|
1282 |
+
// hide divider if first or last visible, or if followed by another divider
|
1283 |
+
$lisVisible.each(function (index) {
|
1284 |
+
var $this = $(this);
|
1285 |
+
|
1286 |
+
if ($this.hasClass('divider') && (
|
1287 |
+
$this.index() === $lisVisible.first().index() ||
|
1288 |
+
$this.index() === $lisVisible.last().index() ||
|
1289 |
+
$lisVisible.eq(index + 1).hasClass('divider'))) {
|
1290 |
+
$this.addClass('hidden');
|
1291 |
+
}
|
1292 |
+
});
|
1293 |
+
|
1294 |
+
if (!that.$lis.not('.hidden, .no-results').length) {
|
1295 |
+
if (!!$no_results.parent().length) {
|
1296 |
+
$no_results.remove();
|
1297 |
+
}
|
1298 |
+
$no_results.html(that.options.noneResultsText.replace('{0}', '"' + htmlEscape(that.$searchbox.val()) + '"')).show();
|
1299 |
+
that.$menuInner.append($no_results);
|
1300 |
+
} else if (!!$no_results.parent().length) {
|
1301 |
+
$no_results.remove();
|
1302 |
+
}
|
1303 |
+
} else {
|
1304 |
+
that.$lis.not('.is-hidden').removeClass('hidden');
|
1305 |
+
if (!!$no_results.parent().length) {
|
1306 |
+
$no_results.remove();
|
1307 |
+
}
|
1308 |
+
}
|
1309 |
+
|
1310 |
+
that.$lis.filter('.active').removeClass('active');
|
1311 |
+
if (that.$searchbox.val()) that.$lis.not('.hidden, .divider, .dropdown-header').eq(0).addClass('active').children('a').focus();
|
1312 |
+
$(this).focus();
|
1313 |
+
});
|
1314 |
+
},
|
1315 |
+
|
1316 |
+
_searchStyle: function () {
|
1317 |
+
var styles = {
|
1318 |
+
begins: 'ibegins',
|
1319 |
+
startsWith: 'ibegins'
|
1320 |
+
};
|
1321 |
+
|
1322 |
+
return styles[this.options.liveSearchStyle] || 'icontains';
|
1323 |
+
},
|
1324 |
+
|
1325 |
+
val: function (value) {
|
1326 |
+
if (typeof value !== 'undefined') {
|
1327 |
+
this.$element.val(value);
|
1328 |
+
this.render();
|
1329 |
+
|
1330 |
+
return this.$element;
|
1331 |
+
} else {
|
1332 |
+
return this.$element.val();
|
1333 |
+
}
|
1334 |
+
},
|
1335 |
+
|
1336 |
+
changeAll: function (status) {
|
1337 |
+
if (typeof status === 'undefined') status = true;
|
1338 |
+
|
1339 |
+
this.findLis();
|
1340 |
+
|
1341 |
+
var $options = this.$element.find('option'),
|
1342 |
+
$lisVisible = this.$lis.not('.divider, .dropdown-header, .disabled, .hidden').toggleClass('selected', status),
|
1343 |
+
lisVisLen = $lisVisible.length,
|
1344 |
+
selectedOptions = [];
|
1345 |
+
|
1346 |
+
for (var i = 0; i < lisVisLen; i++) {
|
1347 |
+
var origIndex = $lisVisible[i].getAttribute('data-original-index');
|
1348 |
+
selectedOptions[selectedOptions.length] = $options.eq(origIndex)[0];
|
1349 |
+
}
|
1350 |
+
|
1351 |
+
$(selectedOptions).prop('selected', status);
|
1352 |
+
|
1353 |
+
this.render(false);
|
1354 |
+
|
1355 |
+
this.$element
|
1356 |
+
.trigger('changed.bs.select')
|
1357 |
+
.triggerNative('change');
|
1358 |
+
},
|
1359 |
+
|
1360 |
+
selectAll: function () {
|
1361 |
+
return this.changeAll(true);
|
1362 |
+
},
|
1363 |
+
|
1364 |
+
deselectAll: function () {
|
1365 |
+
return this.changeAll(false);
|
1366 |
+
},
|
1367 |
+
|
1368 |
+
toggle: function (e) {
|
1369 |
+
e = e || window.event;
|
1370 |
+
|
1371 |
+
if (e) e.stopPropagation();
|
1372 |
+
|
1373 |
+
this.$button.trigger('click');
|
1374 |
+
},
|
1375 |
+
|
1376 |
+
keydown: function (e) {
|
1377 |
+
var $this = $(this),
|
1378 |
+
$parent = $this.is('input') ? $this.parent().parent() : $this.parent(),
|
1379 |
+
$items,
|
1380 |
+
that = $parent.data('this'),
|
1381 |
+
index,
|
1382 |
+
next,
|
1383 |
+
first,
|
1384 |
+
last,
|
1385 |
+
prev,
|
1386 |
+
nextPrev,
|
1387 |
+
prevIndex,
|
1388 |
+
isActive,
|
1389 |
+
selector = ':not(.disabled, .hidden, .dropdown-header, .divider)',
|
1390 |
+
keyCodeMap = {
|
1391 |
+
32: ' ',
|
1392 |
+
48: '0',
|
1393 |
+
49: '1',
|
1394 |
+
50: '2',
|
1395 |
+
51: '3',
|
1396 |
+
52: '4',
|
1397 |
+
53: '5',
|
1398 |
+
54: '6',
|
1399 |
+
55: '7',
|
1400 |
+
56: '8',
|
1401 |
+
57: '9',
|
1402 |
+
59: ';',
|
1403 |
+
65: 'a',
|
1404 |
+
66: 'b',
|
1405 |
+
67: 'c',
|
1406 |
+
68: 'd',
|
1407 |
+
69: 'e',
|
1408 |
+
70: 'f',
|
1409 |
+
71: 'g',
|
1410 |
+
72: 'h',
|
1411 |
+
73: 'i',
|
1412 |
+
74: 'j',
|
1413 |
+
75: 'k',
|
1414 |
+
76: 'l',
|
1415 |
+
77: 'm',
|
1416 |
+
78: 'n',
|
1417 |
+
79: 'o',
|
1418 |
+
80: 'p',
|
1419 |
+
81: 'q',
|
1420 |
+
82: 'r',
|
1421 |
+
83: 's',
|
1422 |
+
84: 't',
|
1423 |
+
85: 'u',
|
1424 |
+
86: 'v',
|
1425 |
+
87: 'w',
|
1426 |
+
88: 'x',
|
1427 |
+
89: 'y',
|
1428 |
+
90: 'z',
|
1429 |
+
96: '0',
|
1430 |
+
97: '1',
|
1431 |
+
98: '2',
|
1432 |
+
99: '3',
|
1433 |
+
100: '4',
|
1434 |
+
101: '5',
|
1435 |
+
102: '6',
|
1436 |
+
103: '7',
|
1437 |
+
104: '8',
|
1438 |
+
105: '9'
|
1439 |
+
};
|
1440 |
+
|
1441 |
+
if (that.options.liveSearch) $parent = $this.parent().parent();
|
1442 |
+
|
1443 |
+
if (that.options.container) $parent = that.$menu;
|
1444 |
+
|
1445 |
+
$items = $('[role=menu] li', $parent);
|
1446 |
+
|
1447 |
+
isActive = that.$newElement.hasClass('open');
|
1448 |
+
|
1449 |
+
if (!isActive && (e.keyCode >= 48 && e.keyCode <= 57 || e.keyCode >= 96 && e.keyCode <= 105 || e.keyCode >= 65 && e.keyCode <= 90)) {
|
1450 |
+
if (!that.options.container) {
|
1451 |
+
that.setSize();
|
1452 |
+
that.$menu.parent().addClass('open');
|
1453 |
+
isActive = true;
|
1454 |
+
} else {
|
1455 |
+
that.$button.trigger('click');
|
1456 |
+
}
|
1457 |
+
that.$searchbox.focus();
|
1458 |
+
}
|
1459 |
+
|
1460 |
+
if (that.options.liveSearch) {
|
1461 |
+
if (/(^9$|27)/.test(e.keyCode.toString(10)) && isActive && that.$menu.find('.active').length === 0) {
|
1462 |
+
e.preventDefault();
|
1463 |
+
that.$menu.parent().removeClass('open');
|
1464 |
+
if (that.options.container) that.$newElement.removeClass('open');
|
1465 |
+
that.$button.focus();
|
1466 |
+
}
|
1467 |
+
// $items contains li elements when liveSearch is enabled
|
1468 |
+
$items = $('[role=menu] li' + selector, $parent);
|
1469 |
+
if (!$this.val() && !/(38|40)/.test(e.keyCode.toString(10))) {
|
1470 |
+
if ($items.filter('.active').length === 0) {
|
1471 |
+
$items = that.$menuInner.find('li');
|
1472 |
+
if (that.options.liveSearchNormalize) {
|
1473 |
+
$items = $items.filter(':a' + that._searchStyle() + '(' + normalizeToBase(keyCodeMap[e.keyCode]) + ')');
|
1474 |
+
} else {
|
1475 |
+
$items = $items.filter(':' + that._searchStyle() + '(' + keyCodeMap[e.keyCode] + ')');
|
1476 |
+
}
|
1477 |
+
}
|
1478 |
+
}
|
1479 |
+
}
|
1480 |
+
|
1481 |
+
if (!$items.length) return;
|
1482 |
+
|
1483 |
+
if (/(38|40)/.test(e.keyCode.toString(10))) {
|
1484 |
+
index = $items.index($items.find('a').filter(':focus').parent());
|
1485 |
+
first = $items.filter(selector).first().index();
|
1486 |
+
last = $items.filter(selector).last().index();
|
1487 |
+
next = $items.eq(index).nextAll(selector).eq(0).index();
|
1488 |
+
prev = $items.eq(index).prevAll(selector).eq(0).index();
|
1489 |
+
nextPrev = $items.eq(next).prevAll(selector).eq(0).index();
|
1490 |
+
|
1491 |
+
if (that.options.liveSearch) {
|
1492 |
+
$items.each(function (i) {
|
1493 |
+
if (!$(this).hasClass('disabled')) {
|
1494 |
+
$(this).data('index', i);
|
1495 |
+
}
|
1496 |
+
});
|
1497 |
+
index = $items.index($items.filter('.active'));
|
1498 |
+
first = $items.first().data('index');
|
1499 |
+
last = $items.last().data('index');
|
1500 |
+
next = $items.eq(index).nextAll().eq(0).data('index');
|
1501 |
+
prev = $items.eq(index).prevAll().eq(0).data('index');
|
1502 |
+
nextPrev = $items.eq(next).prevAll().eq(0).data('index');
|
1503 |
+
}
|
1504 |
+
|
1505 |
+
prevIndex = $this.data('prevIndex');
|
1506 |
+
|
1507 |
+
if (e.keyCode == 38) {
|
1508 |
+
if (that.options.liveSearch) index--;
|
1509 |
+
if (index != nextPrev && index > prev) index = prev;
|
1510 |
+
if (index < first) index = first;
|
1511 |
+
if (index == prevIndex) index = last;
|
1512 |
+
} else if (e.keyCode == 40) {
|
1513 |
+
if (that.options.liveSearch) index++;
|
1514 |
+
if (index == -1) index = 0;
|
1515 |
+
if (index != nextPrev && index < next) index = next;
|
1516 |
+
if (index > last) index = last;
|
1517 |
+
if (index == prevIndex) index = first;
|
1518 |
+
}
|
1519 |
+
|
1520 |
+
$this.data('prevIndex', index);
|
1521 |
+
|
1522 |
+
if (!that.options.liveSearch) {
|
1523 |
+
$items.eq(index).children('a').focus();
|
1524 |
+
} else {
|
1525 |
+
e.preventDefault();
|
1526 |
+
if (!$this.hasClass('dropdown-toggle')) {
|
1527 |
+
$items.removeClass('active').eq(index).addClass('active').children('a').focus();
|
1528 |
+
$this.focus();
|
1529 |
+
}
|
1530 |
+
}
|
1531 |
+
|
1532 |
+
} else if (!$this.is('input')) {
|
1533 |
+
var keyIndex = [],
|
1534 |
+
count,
|
1535 |
+
prevKey;
|
1536 |
+
|
1537 |
+
$items.each(function () {
|
1538 |
+
if (!$(this).hasClass('disabled')) {
|
1539 |
+
if ($.trim($(this).children('a').text().toLowerCase()).substring(0, 1) == keyCodeMap[e.keyCode]) {
|
1540 |
+
keyIndex.push($(this).index());
|
1541 |
+
}
|
1542 |
+
}
|
1543 |
+
});
|
1544 |
+
|
1545 |
+
count = $(document).data('keycount');
|
1546 |
+
count++;
|
1547 |
+
$(document).data('keycount', count);
|
1548 |
+
|
1549 |
+
prevKey = $.trim($(':focus').text().toLowerCase()).substring(0, 1);
|
1550 |
+
|
1551 |
+
if (prevKey != keyCodeMap[e.keyCode]) {
|
1552 |
+
count = 1;
|
1553 |
+
$(document).data('keycount', count);
|
1554 |
+
} else if (count >= keyIndex.length) {
|
1555 |
+
$(document).data('keycount', 0);
|
1556 |
+
if (count > keyIndex.length) count = 1;
|
1557 |
+
}
|
1558 |
+
|
1559 |
+
$items.eq(keyIndex[count - 1]).children('a').focus();
|
1560 |
+
}
|
1561 |
+
|
1562 |
+
// Select focused option if "Enter", "Spacebar" or "Tab" (when selectOnTab is true) are pressed inside the menu.
|
1563 |
+
if ((/(13|32)/.test(e.keyCode.toString(10)) || (/(^9$)/.test(e.keyCode.toString(10)) && that.options.selectOnTab)) && isActive) {
|
1564 |
+
if (!/(32)/.test(e.keyCode.toString(10))) e.preventDefault();
|
1565 |
+
if (!that.options.liveSearch) {
|
1566 |
+
var elem = $(':focus');
|
1567 |
+
elem.click();
|
1568 |
+
// Bring back focus for multiselects
|
1569 |
+
elem.focus();
|
1570 |
+
// Prevent screen from scrolling if the user hit the spacebar
|
1571 |
+
e.preventDefault();
|
1572 |
+
// Fixes spacebar selection of dropdown items in FF & IE
|
1573 |
+
$(document).data('spaceSelect', true);
|
1574 |
+
} else if (!/(32)/.test(e.keyCode.toString(10))) {
|
1575 |
+
that.$menuInner.find('.active a').click();
|
1576 |
+
$this.focus();
|
1577 |
+
}
|
1578 |
+
$(document).data('keycount', 0);
|
1579 |
+
}
|
1580 |
+
|
1581 |
+
if ((/(^9$|27)/.test(e.keyCode.toString(10)) && isActive && (that.multiple || that.options.liveSearch)) || (/(27)/.test(e.keyCode.toString(10)) && !isActive)) {
|
1582 |
+
that.$menu.parent().removeClass('open');
|
1583 |
+
if (that.options.container) that.$newElement.removeClass('open');
|
1584 |
+
that.$button.focus();
|
1585 |
+
}
|
1586 |
+
},
|
1587 |
+
|
1588 |
+
mobile: function () {
|
1589 |
+
this.$element.addClass('mobile-device');
|
1590 |
+
},
|
1591 |
+
|
1592 |
+
refresh: function () {
|
1593 |
+
this.$lis = null;
|
1594 |
+
this.liObj = {};
|
1595 |
+
this.reloadLi();
|
1596 |
+
this.render();
|
1597 |
+
this.checkDisabled();
|
1598 |
+
this.liHeight(true);
|
1599 |
+
this.setStyle();
|
1600 |
+
this.setWidth();
|
1601 |
+
if (this.$lis) this.$searchbox.trigger('propertychange');
|
1602 |
+
|
1603 |
+
this.$element.trigger('refreshed.bs.select');
|
1604 |
+
},
|
1605 |
+
|
1606 |
+
hide: function () {
|
1607 |
+
this.$newElement.hide();
|
1608 |
+
},
|
1609 |
+
|
1610 |
+
show: function () {
|
1611 |
+
this.$newElement.show();
|
1612 |
+
},
|
1613 |
+
|
1614 |
+
remove: function () {
|
1615 |
+
this.$newElement.remove();
|
1616 |
+
this.$element.remove();
|
1617 |
+
},
|
1618 |
+
|
1619 |
+
destroy: function () {
|
1620 |
+
this.$newElement.before(this.$element).remove();
|
1621 |
+
|
1622 |
+
if (this.$bsContainer) {
|
1623 |
+
this.$bsContainer.remove();
|
1624 |
+
} else {
|
1625 |
+
this.$menu.remove();
|
1626 |
+
}
|
1627 |
+
|
1628 |
+
this.$element
|
1629 |
+
.off('.bs.select')
|
1630 |
+
.removeData('selectpicker')
|
1631 |
+
.removeClass('bs-select-hidden selectpicker');
|
1632 |
+
}
|
1633 |
+
};
|
1634 |
+
|
1635 |
+
// SELECTPICKER PLUGIN DEFINITION
|
1636 |
+
// ==============================
|
1637 |
+
function Plugin(option, event) {
|
1638 |
+
// get the args of the outer function..
|
1639 |
+
var args = arguments;
|
1640 |
+
// The arguments of the function are explicitly re-defined from the argument list, because the shift causes them
|
1641 |
+
// to get lost/corrupted in android 2.3 and IE9 #715 #775
|
1642 |
+
var _option = option,
|
1643 |
+
_event = event;
|
1644 |
+
[].shift.apply(args);
|
1645 |
+
|
1646 |
+
var value;
|
1647 |
+
var chain = this.each(function () {
|
1648 |
+
var $this = $(this);
|
1649 |
+
if ($this.is('select')) {
|
1650 |
+
var data = $this.data('selectpicker'),
|
1651 |
+
options = typeof _option == 'object' && _option;
|
1652 |
+
|
1653 |
+
if (!data) {
|
1654 |
+
var config = $.extend({}, Selectpicker.DEFAULTS, $.fn.selectpicker.defaults || {}, $this.data(), options);
|
1655 |
+
config.template = $.extend({}, Selectpicker.DEFAULTS.template, ($.fn.selectpicker.defaults ? $.fn.selectpicker.defaults.template : {}), $this.data().template, options.template);
|
1656 |
+
$this.data('selectpicker', (data = new Selectpicker(this, config, _event)));
|
1657 |
+
} else if (options) {
|
1658 |
+
for (var i in options) {
|
1659 |
+
if (options.hasOwnProperty(i)) {
|
1660 |
+
data.options[i] = options[i];
|
1661 |
+
}
|
1662 |
+
}
|
1663 |
+
}
|
1664 |
+
|
1665 |
+
if (typeof _option == 'string') {
|
1666 |
+
if (data[_option] instanceof Function) {
|
1667 |
+
value = data[_option].apply(data, args);
|
1668 |
+
} else {
|
1669 |
+
value = data.options[_option];
|
1670 |
+
}
|
1671 |
+
}
|
1672 |
+
}
|
1673 |
+
});
|
1674 |
+
|
1675 |
+
if (typeof value !== 'undefined') {
|
1676 |
+
//noinspection JSUnusedAssignment
|
1677 |
+
return value;
|
1678 |
+
} else {
|
1679 |
+
return chain;
|
1680 |
+
}
|
1681 |
+
}
|
1682 |
+
|
1683 |
+
var old = $.fn.selectpicker;
|
1684 |
+
$.fn.selectpicker = Plugin;
|
1685 |
+
$.fn.selectpicker.Constructor = Selectpicker;
|
1686 |
+
|
1687 |
+
// SELECTPICKER NO CONFLICT
|
1688 |
+
// ========================
|
1689 |
+
$.fn.selectpicker.noConflict = function () {
|
1690 |
+
$.fn.selectpicker = old;
|
1691 |
+
return this;
|
1692 |
+
};
|
1693 |
+
|
1694 |
+
$(document)
|
1695 |
+
.data('keycount', 0)
|
1696 |
+
.on('keydown.bs.select', '.bootstrap-select [data-toggle=dropdown], .bootstrap-select [role="menu"], .bs-searchbox input', Selectpicker.prototype.keydown)
|
1697 |
+
.on('focusin.modal', '.bootstrap-select [data-toggle=dropdown], .bootstrap-select [role="menu"], .bs-searchbox input', function (e) {
|
1698 |
+
e.stopPropagation();
|
1699 |
+
});
|
1700 |
+
|
1701 |
+
// SELECTPICKER DATA-API
|
1702 |
+
// =====================
|
1703 |
+
$(window).on('load.bs.select.data-api', function () {
|
1704 |
+
$('.selectpicker').each(function () {
|
1705 |
+
var $selectpicker = $(this);
|
1706 |
+
Plugin.call($selectpicker, $selectpicker.data());
|
1707 |
+
})
|
1708 |
+
});
|
1709 |
+
})(jQuery);
|
inc/js/canvg.js
CHANGED
@@ -1,3095 +1,3095 @@
|
|
1 |
-
/*
|
2 |
-
* canvg.js - Javascript SVG parser and renderer on Canvas
|
3 |
-
* MIT Licensed
|
4 |
-
* Gabe Lerner (gabelerner@gmail.com)
|
5 |
-
* http://code.google.com/p/canvg/
|
6 |
-
*
|
7 |
-
* Requires: rgbcolor.js - http://www.phpied.com/rgb-color-parser-in-javascript/
|
8 |
-
*/
|
9 |
-
(function ( global, factory ) {
|
10 |
-
|
11 |
-
'use strict';
|
12 |
-
|
13 |
-
// export as AMD...
|
14 |
-
if ( typeof define !== 'undefined' && define.amd ) {
|
15 |
-
define('canvgModule', [ 'rgbcolor', 'stackblur' ], factory );
|
16 |
-
}
|
17 |
-
|
18 |
-
// ...or as browserify
|
19 |
-
else if ( typeof module !== 'undefined' && module.exports ) {
|
20 |
-
module.exports = factory( require( 'rgbcolor' ), require( 'stackblur' ) );
|
21 |
-
}
|
22 |
-
|
23 |
-
global.canvg = factory( global.RGBColor, global.stackBlur );
|
24 |
-
|
25 |
-
}( typeof window !== 'undefined' ? window : this, function ( RGBColor, stackBlur ) {
|
26 |
-
|
27 |
-
// canvg(target, s)
|
28 |
-
// empty parameters: replace all 'svg' elements on page with 'canvas' elements
|
29 |
-
// target: canvas element or the id of a canvas element
|
30 |
-
// s: svg string, url to svg file, or xml document
|
31 |
-
// opts: optional hash of options
|
32 |
-
// ignoreMouse: true => ignore mouse events
|
33 |
-
// ignoreAnimation: true => ignore animations
|
34 |
-
// ignoreDimensions: true => does not try to resize canvas
|
35 |
-
// ignoreClear: true => does not clear canvas
|
36 |
-
// offsetX: int => draws at a x offset
|
37 |
-
// offsetY: int => draws at a y offset
|
38 |
-
// scaleWidth: int => scales horizontally to width
|
39 |
-
// scaleHeight: int => scales vertically to height
|
40 |
-
// renderCallback: function => will call the function after the first render is completed
|
41 |
-
// forceRedraw: function => will call the function on every frame, if it returns true, will redraw
|
42 |
-
var canvg = function (target, s, opts) {
|
43 |
-
// no parameters
|
44 |
-
if (target == null && s == null && opts == null) {
|
45 |
-
var svgTags = document.querySelectorAll('svg');
|
46 |
-
for (var i=0; i<svgTags.length; i++) {
|
47 |
-
var svgTag = svgTags[i];
|
48 |
-
var c = document.createElement('canvas');
|
49 |
-
c.width = svgTag.clientWidth;
|
50 |
-
c.height = svgTag.clientHeight;
|
51 |
-
svgTag.parentNode.insertBefore(c, svgTag);
|
52 |
-
svgTag.parentNode.removeChild(svgTag);
|
53 |
-
var div = document.createElement('div');
|
54 |
-
div.appendChild(svgTag);
|
55 |
-
canvg(c, div.innerHTML);
|
56 |
-
}
|
57 |
-
return;
|
58 |
-
}
|
59 |
-
|
60 |
-
if (typeof target == 'string') {
|
61 |
-
target = document.getElementById(target);
|
62 |
-
}
|
63 |
-
|
64 |
-
// store class on canvas
|
65 |
-
if (target.svg != null) target.svg.stop();
|
66 |
-
var svg = build(opts || {});
|
67 |
-
// on i.e. 8 for flash canvas, we can't assign the property so check for it
|
68 |
-
if (!(target.childNodes.length == 1 && target.childNodes[0].nodeName == 'OBJECT')) target.svg = svg;
|
69 |
-
|
70 |
-
var ctx = target.getContext('2d');
|
71 |
-
if (typeof s.documentElement != 'undefined') {
|
72 |
-
// load from xml doc
|
73 |
-
svg.loadXmlDoc(ctx, s);
|
74 |
-
}
|
75 |
-
else if (s.substr(0,1) == '<') {
|
76 |
-
// load from xml string
|
77 |
-
svg.loadXml(ctx, s);
|
78 |
-
}
|
79 |
-
else {
|
80 |
-
// load from url
|
81 |
-
svg.load(ctx, s);
|
82 |
-
}
|
83 |
-
}
|
84 |
-
|
85 |
-
// see https://developer.mozilla.org/en-US/docs/Web/API/Element.matches
|
86 |
-
var matchesSelector;
|
87 |
-
if (typeof Element.prototype.matches != 'undefined') {
|
88 |
-
matchesSelector = function(node, selector) {
|
89 |
-
return node.matches(selector);
|
90 |
-
};
|
91 |
-
} else if (typeof Element.prototype.webkitMatchesSelector != 'undefined') {
|
92 |
-
matchesSelector = function(node, selector) {
|
93 |
-
return node.webkitMatchesSelector(selector);
|
94 |
-
};
|
95 |
-
} else if (typeof Element.prototype.mozMatchesSelector != 'undefined') {
|
96 |
-
matchesSelector = function(node, selector) {
|
97 |
-
return node.mozMatchesSelector(selector);
|
98 |
-
};
|
99 |
-
} else if (typeof Element.prototype.msMatchesSelector != 'undefined') {
|
100 |
-
matchesSelector = function(node, selector) {
|
101 |
-
return node.msMatchesSelector(selector);
|
102 |
-
};
|
103 |
-
} else if (typeof Element.prototype.oMatchesSelector != 'undefined') {
|
104 |
-
matchesSelector = function(node, selector) {
|
105 |
-
return node.oMatchesSelector(selector);
|
106 |
-
};
|
107 |
-
} else {
|
108 |
-
// requires Sizzle: https://github.com/jquery/sizzle/wiki/Sizzle-Documentation
|
109 |
-
// or jQuery: http://jquery.com/download/
|
110 |
-
// or Zepto: http://zeptojs.com/#
|
111 |
-
// without it, this is a ReferenceError
|
112 |
-
|
113 |
-
if (typeof jQuery === 'function' || typeof Zepto === 'function') {
|
114 |
-
matchesSelector = function (node, selector) {
|
115 |
-
return $(node).is(selector);
|
116 |
-
};
|
117 |
-
}
|
118 |
-
|
119 |
-
if (typeof matchesSelector === 'undefined') {
|
120 |
-
matchesSelector = Sizzle.matchesSelector;
|
121 |
-
}
|
122 |
-
}
|
123 |
-
|
124 |
-
// slightly modified version of https://github.com/keeganstreet/specificity/blob/master/specificity.js
|
125 |
-
var attributeRegex = /(\[[^\]]+\])/g;
|
126 |
-
var idRegex = /(#[^\s\+>~\.\[:]+)/g;
|
127 |
-
var classRegex = /(\.[^\s\+>~\.\[:]+)/g;
|
128 |
-
var pseudoElementRegex = /(::[^\s\+>~\.\[:]+|:first-line|:first-letter|:before|:after)/gi;
|
129 |
-
var pseudoClassWithBracketsRegex = /(:[\w-]+\([^\)]*\))/gi;
|
130 |
-
var pseudoClassRegex = /(:[^\s\+>~\.\[:]+)/g;
|
131 |
-
var elementRegex = /([^\s\+>~\.\[:]+)/g;
|
132 |
-
function getSelectorSpecificity(selector) {
|
133 |
-
var typeCount = [0, 0, 0];
|
134 |
-
var findMatch = function(regex, type) {
|
135 |
-
var matches = selector.match(regex);
|
136 |
-
if (matches == null) {
|
137 |
-
return;
|
138 |
-
}
|
139 |
-
typeCount[type] += matches.length;
|
140 |
-
selector = selector.replace(regex, ' ');
|
141 |
-
};
|
142 |
-
|
143 |
-
selector = selector.replace(/:not\(([^\)]*)\)/g, ' $1 ');
|
144 |
-
selector = selector.replace(/{[\s\S]*/gm, ' ');
|
145 |
-
findMatch(attributeRegex, 1);
|
146 |
-
findMatch(idRegex, 0);
|
147 |
-
findMatch(classRegex, 1);
|
148 |
-
findMatch(pseudoElementRegex, 2);
|
149 |
-
findMatch(pseudoClassWithBracketsRegex, 1);
|
150 |
-
findMatch(pseudoClassRegex, 1);
|
151 |
-
selector = selector.replace(/[\*\s\+>~]/g, ' ');
|
152 |
-
selector = selector.replace(/[#\.]/g, ' ');
|
153 |
-
findMatch(elementRegex, 2);
|
154 |
-
return typeCount.join('');
|
155 |
-
}
|
156 |
-
|
157 |
-
function build(opts) {
|
158 |
-
var svg = { opts: opts };
|
159 |
-
|
160 |
-
svg.FRAMERATE = 30;
|
161 |
-
svg.MAX_VIRTUAL_PIXELS = 30000;
|
162 |
-
|
163 |
-
svg.log = function(msg) {};
|
164 |
-
if (svg.opts['log'] == true && typeof console != 'undefined') {
|
165 |
-
svg.log = function(msg) { console.log(msg); };
|
166 |
-
};
|
167 |
-
|
168 |
-
// globals
|
169 |
-
svg.init = function(ctx) {
|
170 |
-
var uniqueId = 0;
|
171 |
-
svg.UniqueId = function () { uniqueId++; return 'canvg' + uniqueId; };
|
172 |
-
svg.Definitions = {};
|
173 |
-
svg.Styles = {};
|
174 |
-
svg.StylesSpecificity = {};
|
175 |
-
svg.Animations = [];
|
176 |
-
svg.Images = [];
|
177 |
-
svg.ctx = ctx;
|
178 |
-
svg.ViewPort = new (function () {
|
179 |
-
this.viewPorts = [];
|
180 |
-
this.Clear = function() { this.viewPorts = []; }
|
181 |
-
this.SetCurrent = function(width, height) { this.viewPorts.push({ width: width, height: height }); }
|
182 |
-
this.RemoveCurrent = function() { this.viewPorts.pop(); }
|
183 |
-
this.Current = function() { return this.viewPorts[this.viewPorts.length - 1]; }
|
184 |
-
this.width = function() { return this.Current().width; }
|
185 |
-
this.height = function() { return this.Current().height; }
|
186 |
-
this.ComputeSize = function(d) {
|
187 |
-
if (d != null && typeof d == 'number') return d;
|
188 |
-
if (d == 'x') return this.width();
|
189 |
-
if (d == 'y') return this.height();
|
190 |
-
return Math.sqrt(Math.pow(this.width(), 2) + Math.pow(this.height(), 2)) / Math.sqrt(2);
|
191 |
-
}
|
192 |
-
});
|
193 |
-
}
|
194 |
-
svg.init();
|
195 |
-
|
196 |
-
// images loaded
|
197 |
-
svg.ImagesLoaded = function() {
|
198 |
-
for (var i=0; i<svg.Images.length; i++) {
|
199 |
-
if (!svg.Images[i].loaded) return false;
|
200 |
-
}
|
201 |
-
return true;
|
202 |
-
}
|
203 |
-
|
204 |
-
// trim
|
205 |
-
svg.trim = function(s) { return s.replace(/^\s+|\s+$/g, ''); }
|
206 |
-
|
207 |
-
// compress spaces
|
208 |
-
svg.compressSpaces = function(s) { return s.replace(/[\s\r\t\n]+/gm,' '); }
|
209 |
-
|
210 |
-
// ajax
|
211 |
-
svg.ajax = function(url) {
|
212 |
-
var AJAX;
|
213 |
-
if(window.XMLHttpRequest){AJAX=new XMLHttpRequest();}
|
214 |
-
else{AJAX=new ActiveXObject('Microsoft.XMLHTTP');}
|
215 |
-
if(AJAX){
|
216 |
-
AJAX.open('GET',url,false);
|
217 |
-
AJAX.send(null);
|
218 |
-
return AJAX.responseText;
|
219 |
-
}
|
220 |
-
return null;
|
221 |
-
}
|
222 |
-
|
223 |
-
// parse xml
|
224 |
-
svg.parseXml = function(xml) {
|
225 |
-
if (typeof Windows != 'undefined' && typeof Windows.Data != 'undefined' && typeof Windows.Data.Xml != 'undefined') {
|
226 |
-
var xmlDoc = new Windows.Data.Xml.Dom.XmlDocument();
|
227 |
-
var settings = new Windows.Data.Xml.Dom.XmlLoadSettings();
|
228 |
-
settings.prohibitDtd = false;
|
229 |
-
xmlDoc.loadXml(xml, settings);
|
230 |
-
return xmlDoc;
|
231 |
-
}
|
232 |
-
else if (window.DOMParser)
|
233 |
-
{
|
234 |
-
var parser = new DOMParser();
|
235 |
-
return parser.parseFromString(xml, 'text/xml');
|
236 |
-
}
|
237 |
-
else
|
238 |
-
{
|
239 |
-
xml = xml.replace(/<!DOCTYPE svg[^>]*>/, '');
|
240 |
-
var xmlDoc = new ActiveXObject('Microsoft.XMLDOM');
|
241 |
-
xmlDoc.async = 'false';
|
242 |
-
xmlDoc.loadXML(xml);
|
243 |
-
return xmlDoc;
|
244 |
-
}
|
245 |
-
}
|
246 |
-
|
247 |
-
svg.Property = function(name, value) {
|
248 |
-
this.name = name;
|
249 |
-
this.value = value;
|
250 |
-
}
|
251 |
-
svg.Property.prototype.getValue = function() {
|
252 |
-
return this.value;
|
253 |
-
}
|
254 |
-
|
255 |
-
svg.Property.prototype.hasValue = function() {
|
256 |
-
return (this.value != null && this.value !== '');
|
257 |
-
}
|
258 |
-
|
259 |
-
// return the numerical value of the property
|
260 |
-
svg.Property.prototype.numValue = function() {
|
261 |
-
if (!this.hasValue()) return 0;
|
262 |
-
|
263 |
-
var n = parseFloat(this.value);
|
264 |
-
if ((this.value + '').match(/%$/)) {
|
265 |
-
n = n / 100.0;
|
266 |
-
}
|
267 |
-
return n;
|
268 |
-
}
|
269 |
-
|
270 |
-
svg.Property.prototype.valueOrDefault = function(def) {
|
271 |
-
if (this.hasValue()) return this.value;
|
272 |
-
return def;
|
273 |
-
}
|
274 |
-
|
275 |
-
svg.Property.prototype.numValueOrDefault = function(def) {
|
276 |
-
if (this.hasValue()) return this.numValue();
|
277 |
-
return def;
|
278 |
-
}
|
279 |
-
|
280 |
-
// color extensions
|
281 |
-
// augment the current color value with the opacity
|
282 |
-
svg.Property.prototype.addOpacity = function(opacityProp) {
|
283 |
-
var newValue = this.value;
|
284 |
-
if (opacityProp.value != null && opacityProp.value != '' && typeof this.value == 'string') { // can only add opacity to colors, not patterns
|
285 |
-
var color = new RGBColor(this.value);
|
286 |
-
if (color.ok) {
|
287 |
-
newValue = 'rgba(' + color.r + ', ' + color.g + ', ' + color.b + ', ' + opacityProp.numValue() + ')';
|
288 |
-
}
|
289 |
-
}
|
290 |
-
return new svg.Property(this.name, newValue);
|
291 |
-
}
|
292 |
-
|
293 |
-
// definition extensions
|
294 |
-
// get the definition from the definitions table
|
295 |
-
svg.Property.prototype.getDefinition = function() {
|
296 |
-
var name = this.value.match(/#([^\)'"]+)/);
|
297 |
-
if (name) { name = name[1]; }
|
298 |
-
if (!name) { name = this.value; }
|
299 |
-
return svg.Definitions[name];
|
300 |
-
}
|
301 |
-
|
302 |
-
svg.Property.prototype.isUrlDefinition = function() {
|
303 |
-
return this.value.indexOf('url(') == 0
|
304 |
-
}
|
305 |
-
|
306 |
-
svg.Property.prototype.getFillStyleDefinition = function(e, opacityProp) {
|
307 |
-
var def = this.getDefinition();
|
308 |
-
|
309 |
-
// gradient
|
310 |
-
if (def != null && def.createGradient) {
|
311 |
-
return def.createGradient(svg.ctx, e, opacityProp);
|
312 |
-
}
|
313 |
-
|
314 |
-
// pattern
|
315 |
-
if (def != null && def.createPattern) {
|
316 |
-
if (def.getHrefAttribute().hasValue()) {
|
317 |
-
var pt = def.attribute('patternTransform');
|
318 |
-
def = def.getHrefAttribute().getDefinition();
|
319 |
-
if (pt.hasValue()) { def.attribute('patternTransform', true).value = pt.value; }
|
320 |
-
}
|
321 |
-
return def.createPattern(svg.ctx, e);
|
322 |
-
}
|
323 |
-
|
324 |
-
return null;
|
325 |
-
}
|
326 |
-
|
327 |
-
// length extensions
|
328 |
-
svg.Property.prototype.getDPI = function(viewPort) {
|
329 |
-
return 96.0; // TODO: compute?
|
330 |
-
}
|
331 |
-
|
332 |
-
svg.Property.prototype.getEM = function(viewPort) {
|
333 |
-
var em = 12;
|
334 |
-
|
335 |
-
var fontSize = new svg.Property('fontSize', svg.Font.Parse(svg.ctx.font).fontSize);
|
336 |
-
if (fontSize.hasValue()) em = fontSize.toPixels(viewPort);
|
337 |
-
|
338 |
-
return em;
|
339 |
-
}
|
340 |
-
|
341 |
-
svg.Property.prototype.getUnits = function() {
|
342 |
-
var s = this.value+'';
|
343 |
-
return s.replace(/[0-9\.\-]/g,'');
|
344 |
-
}
|
345 |
-
|
346 |
-
// get the length as pixels
|
347 |
-
svg.Property.prototype.toPixels = function(viewPort, processPercent) {
|
348 |
-
if (!this.hasValue()) return 0;
|
349 |
-
var s = this.value+'';
|
350 |
-
if (s.match(/em$/)) return this.numValue() * this.getEM(viewPort);
|
351 |
-
if (s.match(/ex$/)) return this.numValue() * this.getEM(viewPort) / 2.0;
|
352 |
-
if (s.match(/px$/)) return this.numValue();
|
353 |
-
if (s.match(/pt$/)) return this.numValue() * this.getDPI(viewPort) * (1.0 / 72.0);
|
354 |
-
if (s.match(/pc$/)) return this.numValue() * 15;
|
355 |
-
if (s.match(/cm$/)) return this.numValue() * this.getDPI(viewPort) / 2.54;
|
356 |
-
if (s.match(/mm$/)) return this.numValue() * this.getDPI(viewPort) / 25.4;
|
357 |
-
if (s.match(/in$/)) return this.numValue() * this.getDPI(viewPort);
|
358 |
-
if (s.match(/%$/)) return this.numValue() * svg.ViewPort.ComputeSize(viewPort);
|
359 |
-
var n = this.numValue();
|
360 |
-
if (processPercent && n < 1.0) return n * svg.ViewPort.ComputeSize(viewPort);
|
361 |
-
return n;
|
362 |
-
}
|
363 |
-
|
364 |
-
// time extensions
|
365 |
-
// get the time as milliseconds
|
366 |
-
svg.Property.prototype.toMilliseconds = function() {
|
367 |
-
if (!this.hasValue()) return 0;
|
368 |
-
var s = this.value+'';
|
369 |
-
if (s.match(/s$/)) return this.numValue() * 1000;
|
370 |
-
if (s.match(/ms$/)) return this.numValue();
|
371 |
-
return this.numValue();
|
372 |
-
}
|
373 |
-
|
374 |
-
// angle extensions
|
375 |
-
// get the angle as radians
|
376 |
-
svg.Property.prototype.toRadians = function() {
|
377 |
-
if (!this.hasValue()) return 0;
|
378 |
-
var s = this.value+'';
|
379 |
-
if (s.match(/deg$/)) return this.numValue() * (Math.PI / 180.0);
|
380 |
-
if (s.match(/grad$/)) return this.numValue() * (Math.PI / 200.0);
|
381 |
-
if (s.match(/rad$/)) return this.numValue();
|
382 |
-
return this.numValue() * (Math.PI / 180.0);
|
383 |
-
}
|
384 |
-
|
385 |
-
// text extensions
|
386 |
-
// get the text baseline
|
387 |
-
var textBaselineMapping = {
|
388 |
-
'baseline': 'alphabetic',
|
389 |
-
'before-edge': 'top',
|
390 |
-
'text-before-edge': 'top',
|
391 |
-
'middle': 'middle',
|
392 |
-
'central': 'middle',
|
393 |
-
'after-edge': 'bottom',
|
394 |
-
'text-after-edge': 'bottom',
|
395 |
-
'ideographic': 'ideographic',
|
396 |
-
'alphabetic': 'alphabetic',
|
397 |
-
'hanging': 'hanging',
|
398 |
-
'mathematical': 'alphabetic'
|
399 |
-
};
|
400 |
-
svg.Property.prototype.toTextBaseline = function () {
|
401 |
-
if (!this.hasValue()) return null;
|
402 |
-
return textBaselineMapping[this.value];
|
403 |
-
}
|
404 |
-
|
405 |
-
// fonts
|
406 |
-
svg.Font = new (function() {
|
407 |
-
this.Styles = 'normal|italic|oblique|inherit';
|
408 |
-
this.Variants = 'normal|small-caps|inherit';
|
409 |
-
this.Weights = 'normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900|inherit';
|
410 |
-
|
411 |
-
this.CreateFont = function(fontStyle, fontVariant, fontWeight, fontSize, fontFamily, inherit) {
|
412 |
-
var f = inherit != null ? this.Parse(inherit) : this.CreateFont('', '', '', '', '', svg.ctx.font);
|
413 |
-
return {
|
414 |
-
fontFamily: fontFamily || f.fontFamily,
|
415 |
-
fontSize: fontSize || f.fontSize,
|
416 |
-
fontStyle: fontStyle || f.fontStyle,
|
417 |
-
fontWeight: fontWeight || f.fontWeight,
|
418 |
-
fontVariant: fontVariant || f.fontVariant,
|
419 |
-
toString: function () { return [this.fontStyle, this.fontVariant, this.fontWeight, this.fontSize, this.fontFamily].join(' ') }
|
420 |
-
}
|
421 |
-
}
|
422 |
-
|
423 |
-
var that = this;
|
424 |
-
this.Parse = function(s) {
|
425 |
-
var f = {};
|
426 |
-
var d = svg.trim(svg.compressSpaces(s || '')).split(' ');
|
427 |
-
var set = { fontSize: false, fontStyle: false, fontWeight: false, fontVariant: false }
|
428 |
-
var ff = '';
|
429 |
-
for (var i=0; i<d.length; i++) {
|
430 |
-
if (!set.fontStyle && that.Styles.indexOf(d[i]) != -1) { if (d[i] != 'inherit') f.fontStyle = d[i]; set.fontStyle = true; }
|
431 |
-
else if (!set.fontVariant && that.Variants.indexOf(d[i]) != -1) { if (d[i] != 'inherit') f.fontVariant = d[i]; set.fontStyle = set.fontVariant = true; }
|
432 |
-
else if (!set.fontWeight && that.Weights.indexOf(d[i]) != -1) { if (d[i] != 'inherit') f.fontWeight = d[i]; set.fontStyle = set.fontVariant = set.fontWeight = true; }
|
433 |
-
else if (!set.fontSize) { if (d[i] != 'inherit') f.fontSize = d[i].split('/')[0]; set.fontStyle = set.fontVariant = set.fontWeight = set.fontSize = true; }
|
434 |
-
else { if (d[i] != 'inherit') ff += d[i]; }
|
435 |
-
} if (ff != '') f.fontFamily = ff;
|
436 |
-
return f;
|
437 |
-
}
|
438 |
-
});
|
439 |
-
|
440 |
-
// points and paths
|
441 |
-
svg.ToNumberArray = function(s) {
|
442 |
-
var a = svg.trim(svg.compressSpaces((s || '').replace(/,/g, ' '))).split(' ');
|
443 |
-
for (var i=0; i<a.length; i++) {
|
444 |
-
a[i] = parseFloat(a[i]);
|
445 |
-
}
|
446 |
-
return a;
|
447 |
-
}
|
448 |
-
svg.Point = function(x, y) {
|
449 |
-
this.x = x;
|
450 |
-
this.y = y;
|
451 |
-
}
|
452 |
-
svg.Point.prototype.angleTo = function(p) {
|
453 |
-
return Math.atan2(p.y - this.y, p.x - this.x);
|
454 |
-
}
|
455 |
-
|
456 |
-
svg.Point.prototype.applyTransform = function(v) {
|
457 |
-
var xp = this.x * v[0] + this.y * v[2] + v[4];
|
458 |
-
var yp = this.x * v[1] + this.y * v[3] + v[5];
|
459 |
-
this.x = xp;
|
460 |
-
this.y = yp;
|
461 |
-
}
|
462 |
-
|
463 |
-
svg.CreatePoint = function(s) {
|
464 |
-
var a = svg.ToNumberArray(s);
|
465 |
-
return new svg.Point(a[0], a[1]);
|
466 |
-
}
|
467 |
-
svg.CreatePath = function(s) {
|
468 |
-
var a = svg.ToNumberArray(s);
|
469 |
-
var path = [];
|
470 |
-
for (var i=0; i<a.length; i+=2) {
|
471 |
-
path.push(new svg.Point(a[i], a[i+1]));
|
472 |
-
}
|
473 |
-
return path;
|
474 |
-
}
|
475 |
-
|
476 |
-
// bounding box
|
477 |
-
svg.BoundingBox = function(x1, y1, x2, y2) { // pass in initial points if you want
|
478 |
-
this.x1 = Number.NaN;
|
479 |
-
this.y1 = Number.NaN;
|
480 |
-
this.x2 = Number.NaN;
|
481 |
-
this.y2 = Number.NaN;
|
482 |
-
|
483 |
-
this.x = function() { return this.x1; }
|
484 |
-
this.y = function() { return this.y1; }
|
485 |
-
this.width = function() { return this.x2 - this.x1; }
|
486 |
-
this.height = function() { return this.y2 - this.y1; }
|
487 |
-
|
488 |
-
this.addPoint = function(x, y) {
|
489 |
-
if (x != null) {
|
490 |
-
if (isNaN(this.x1) || isNaN(this.x2)) {
|
491 |
-
this.x1 = x;
|
492 |
-
this.x2 = x;
|
493 |
-
}
|
494 |
-
if (x < this.x1) this.x1 = x;
|
495 |
-
if (x > this.x2) this.x2 = x;
|
496 |
-
}
|
497 |
-
|
498 |
-
if (y != null) {
|
499 |
-
if (isNaN(this.y1) || isNaN(this.y2)) {
|
500 |
-
this.y1 = y;
|
501 |
-
this.y2 = y;
|
502 |
-
}
|
503 |
-
if (y < this.y1) this.y1 = y;
|
504 |
-
if (y > this.y2) this.y2 = y;
|
505 |
-
}
|
506 |
-
}
|
507 |
-
this.addX = function(x) { this.addPoint(x, null); }
|
508 |
-
this.addY = function(y) { this.addPoint(null, y); }
|
509 |
-
|
510 |
-
this.addBoundingBox = function(bb) {
|
511 |
-
this.addPoint(bb.x1, bb.y1);
|
512 |
-
this.addPoint(bb.x2, bb.y2);
|
513 |
-
}
|
514 |
-
|
515 |
-
this.addQuadraticCurve = function(p0x, p0y, p1x, p1y, p2x, p2y) {
|
516 |
-
var cp1x = p0x + 2/3 * (p1x - p0x); // CP1 = QP0 + 2/3 *(QP1-QP0)
|
517 |
-
var cp1y = p0y + 2/3 * (p1y - p0y); // CP1 = QP0 + 2/3 *(QP1-QP0)
|
518 |
-
var cp2x = cp1x + 1/3 * (p2x - p0x); // CP2 = CP1 + 1/3 *(QP2-QP0)
|
519 |
-
var cp2y = cp1y + 1/3 * (p2y - p0y); // CP2 = CP1 + 1/3 *(QP2-QP0)
|
520 |
-
this.addBezierCurve(p0x, p0y, cp1x, cp2x, cp1y, cp2y, p2x, p2y);
|
521 |
-
}
|
522 |
-
|
523 |
-
this.addBezierCurve = function(p0x, p0y, p1x, p1y, p2x, p2y, p3x, p3y) {
|
524 |
-
// from http://blog.hackers-cafe.net/2009/06/how-to-calculate-bezier-curves-bounding.html
|
525 |
-
var p0 = [p0x, p0y], p1 = [p1x, p1y], p2 = [p2x, p2y], p3 = [p3x, p3y];
|
526 |
-
this.addPoint(p0[0], p0[1]);
|
527 |
-
this.addPoint(p3[0], p3[1]);
|
528 |
-
|
529 |
-
for (i=0; i<=1; i++) {
|
530 |
-
var f = function(t) {
|
531 |
-
return Math.pow(1-t, 3) * p0[i]
|
532 |
-
+ 3 * Math.pow(1-t, 2) * t * p1[i]
|
533 |
-
+ 3 * (1-t) * Math.pow(t, 2) * p2[i]
|
534 |
-
+ Math.pow(t, 3) * p3[i];
|
535 |
-
}
|
536 |
-
|
537 |
-
var b = 6 * p0[i] - 12 * p1[i] + 6 * p2[i];
|
538 |
-
var a = -3 * p0[i] + 9 * p1[i] - 9 * p2[i] + 3 * p3[i];
|
539 |
-
var c = 3 * p1[i] - 3 * p0[i];
|
540 |
-
|
541 |
-
if (a == 0) {
|
542 |
-
if (b == 0) continue;
|
543 |
-
var t = -c / b;
|
544 |
-
if (0 < t && t < 1) {
|
545 |
-
if (i == 0) this.addX(f(t));
|
546 |
-
if (i == 1) this.addY(f(t));
|
547 |
-
}
|
548 |
-
continue;
|
549 |
-
}
|
550 |
-
|
551 |
-
var b2ac = Math.pow(b, 2) - 4 * c * a;
|
552 |
-
if (b2ac < 0) continue;
|
553 |
-
var t1 = (-b + Math.sqrt(b2ac)) / (2 * a);
|
554 |
-
if (0 < t1 && t1 < 1) {
|
555 |
-
if (i == 0) this.addX(f(t1));
|
556 |
-
if (i == 1) this.addY(f(t1));
|
557 |
-
}
|
558 |
-
var t2 = (-b - Math.sqrt(b2ac)) / (2 * a);
|
559 |
-
if (0 < t2 && t2 < 1) {
|
560 |
-
if (i == 0) this.addX(f(t2));
|
561 |
-
if (i == 1) this.addY(f(t2));
|
562 |
-
}
|
563 |
-
}
|
564 |
-
}
|
565 |
-
|
566 |
-
this.isPointInBox = function(x, y) {
|
567 |
-
return (this.x1 <= x && x <= this.x2 && this.y1 <= y && y <= this.y2);
|
568 |
-
}
|
569 |
-
|
570 |
-
this.addPoint(x1, y1);
|
571 |
-
this.addPoint(x2, y2);
|
572 |
-
}
|
573 |
-
|
574 |
-
// transforms
|
575 |
-
svg.Transform = function(v) {
|
576 |
-
var that = this;
|
577 |
-
this.Type = {}
|
578 |
-
|
579 |
-
// translate
|
580 |
-
this.Type.translate = function(s) {
|
581 |
-
this.p = svg.CreatePoint(s);
|
582 |
-
this.apply = function(ctx) {
|
583 |
-
ctx.translate(this.p.x || 0.0, this.p.y || 0.0);
|
584 |
-
}
|
585 |
-
this.unapply = function(ctx) {
|
586 |
-
ctx.translate(-1.0 * this.p.x || 0.0, -1.0 * this.p.y || 0.0);
|
587 |
-
}
|
588 |
-
this.applyToPoint = function(p) {
|
589 |
-
p.applyTransform([1, 0, 0, 1, this.p.x || 0.0, this.p.y || 0.0]);
|
590 |
-
}
|
591 |
-
}
|
592 |
-
|
593 |
-
// rotate
|
594 |
-
this.Type.rotate = function(s) {
|
595 |
-
var a = svg.ToNumberArray(s);
|
596 |
-
this.angle = new svg.Property('angle', a[0]);
|
597 |
-
this.cx = a[1] || 0;
|
598 |
-
this.cy = a[2] || 0;
|
599 |
-
this.apply = function(ctx) {
|
600 |
-
ctx.translate(this.cx, this.cy);
|
601 |
-
ctx.rotate(this.angle.toRadians());
|
602 |
-
ctx.translate(-this.cx, -this.cy);
|
603 |
-
}
|
604 |
-
this.unapply = function(ctx) {
|
605 |
-
ctx.translate(this.cx, this.cy);
|
606 |
-
ctx.rotate(-1.0 * this.angle.toRadians());
|
607 |
-
ctx.translate(-this.cx, -this.cy);
|
608 |
-
}
|
609 |
-
this.applyToPoint = function(p) {
|
610 |
-
var a = this.angle.toRadians();
|
611 |
-
p.applyTransform([1, 0, 0, 1, this.p.x || 0.0, this.p.y || 0.0]);
|
612 |
-
p.applyTransform([Math.cos(a), Math.sin(a), -Math.sin(a), Math.cos(a), 0, 0]);
|
613 |
-
p.applyTransform([1, 0, 0, 1, -this.p.x || 0.0, -this.p.y || 0.0]);
|
614 |
-
}
|
615 |
-
}
|
616 |
-
|
617 |
-
this.Type.scale = function(s) {
|
618 |
-
this.p = svg.CreatePoint(s);
|
619 |
-
this.apply = function(ctx) {
|
620 |
-
ctx.scale(this.p.x || 1.0, this.p.y || this.p.x || 1.0);
|
621 |
-
}
|
622 |
-
this.unapply = function(ctx) {
|
623 |
-
ctx.scale(1.0 / this.p.x || 1.0, 1.0 / this.p.y || this.p.x || 1.0);
|
624 |
-
}
|
625 |
-
this.applyToPoint = function(p) {
|
626 |
-
p.applyTransform([this.p.x || 0.0, 0, 0, this.p.y || 0.0, 0, 0]);
|
627 |
-
}
|
628 |
-
}
|
629 |
-
|
630 |
-
this.Type.matrix = function(s) {
|
631 |
-
this.m = svg.ToNumberArray(s);
|
632 |
-
this.apply = function(ctx) {
|
633 |
-
ctx.transform(this.m[0], this.m[1], this.m[2], this.m[3], this.m[4], this.m[5]);
|
634 |
-
}
|
635 |
-
this.unapply = function(ctx) {
|
636 |
-
var a = this.m[0];
|
637 |
-
var b = this.m[2];
|
638 |
-
var c = this.m[4];
|
639 |
-
var d = this.m[1];
|
640 |
-
var e = this.m[3];
|
641 |
-
var f = this.m[5];
|
642 |
-
var g = 0.0;
|
643 |
-
var h = 0.0;
|
644 |
-
var i = 1.0;
|
645 |
-
var det = 1 / (a*(e*i-f*h)-b*(d*i-f*g)+c*(d*h-e*g));
|
646 |
-
ctx.transform(
|
647 |
-
det*(e*i-f*h),
|
648 |
-
det*(f*g-d*i),
|
649 |
-
det*(c*h-b*i),
|
650 |
-
det*(a*i-c*g),
|
651 |
-
det*(b*f-c*e),
|
652 |
-
det*(c*d-a*f)
|
653 |
-
);
|
654 |
-
}
|
655 |
-
this.applyToPoint = function(p) {
|
656 |
-
p.applyTransform(this.m);
|
657 |
-
}
|
658 |
-
}
|
659 |
-
|
660 |
-
this.Type.SkewBase = function(s) {
|
661 |
-
this.base = that.Type.matrix;
|
662 |
-
this.base(s);
|
663 |
-
this.angle = new svg.Property('angle', s);
|
664 |
-
}
|
665 |
-
this.Type.SkewBase.prototype = new this.Type.matrix;
|
666 |
-
|
667 |
-
this.Type.skewX = function(s) {
|
668 |
-
this.base = that.Type.SkewBase;
|
669 |
-
this.base(s);
|
670 |
-
this.m = [1, 0, Math.tan(this.angle.toRadians()), 1, 0, 0];
|
671 |
-
}
|
672 |
-
this.Type.skewX.prototype = new this.Type.SkewBase;
|
673 |
-
|
674 |
-
this.Type.skewY = function(s) {
|
675 |
-
this.base = that.Type.SkewBase;
|
676 |
-
this.base(s);
|
677 |
-
this.m = [1, Math.tan(this.angle.toRadians()), 0, 1, 0, 0];
|
678 |
-
}
|
679 |
-
this.Type.skewY.prototype = new this.Type.SkewBase;
|
680 |
-
|
681 |
-
this.transforms = [];
|
682 |
-
|
683 |
-
this.apply = function(ctx) {
|
684 |
-
for (var i=0; i<this.transforms.length; i++) {
|
685 |
-
this.transforms[i].apply(ctx);
|
686 |
-
}
|
687 |
-
}
|
688 |
-
|
689 |
-
this.unapply = function(ctx) {
|
690 |
-
for (var i=this.transforms.length-1; i>=0; i--) {
|
691 |
-
this.transforms[i].unapply(ctx);
|
692 |
-
}
|
693 |
-
}
|
694 |
-
|
695 |
-
this.applyToPoint = function(p) {
|
696 |
-
for (var i=0; i<this.transforms.length; i++) {
|
697 |
-
this.transforms[i].applyToPoint(p);
|
698 |
-
}
|
699 |
-
}
|
700 |
-
|
701 |
-
var data = svg.trim(svg.compressSpaces(v)).replace(/\)([a-zA-Z])/g, ') $1').replace(/\)(\s?,\s?)/g,') ').split(/\s(?=[a-z])/);
|
702 |
-
for (var i=0; i<data.length; i++) {
|
703 |
-
var type = svg.trim(data[i].split('(')[0]);
|
704 |
-
var s = data[i].split('(')[1].replace(')','');
|
705 |
-
var transformType = this.Type[type];
|
706 |
-
if (typeof transformType != 'undefined') {
|
707 |
-
var transform = new transformType(s);
|
708 |
-
transform.type = type;
|
709 |
-
this.transforms.push(transform);
|
710 |
-
}
|
711 |
-
}
|
712 |
-
}
|
713 |
-
|
714 |
-
// aspect ratio
|
715 |
-
svg.AspectRatio = function(ctx, aspectRatio, width, desiredWidth, height, desiredHeight, minX, minY, refX, refY) {
|
716 |
-
// aspect ratio - http://www.w3.org/TR/SVG/coords.html#PreserveAspectRatioAttribute
|
717 |
-
aspectRatio = svg.compressSpaces(aspectRatio);
|
718 |
-
aspectRatio = aspectRatio.replace(/^defer\s/,''); // ignore defer
|
719 |
-
var align = aspectRatio.split(' ')[0] || 'xMidYMid';
|
720 |
-
var meetOrSlice = aspectRatio.split(' ')[1] || 'meet';
|
721 |
-
|
722 |
-
// calculate scale
|
723 |
-
var scaleX = width / desiredWidth;
|
724 |
-
var scaleY = height / desiredHeight;
|
725 |
-
var scaleMin = Math.min(scaleX, scaleY);
|
726 |
-
var scaleMax = Math.max(scaleX, scaleY);
|
727 |
-
if (meetOrSlice == 'meet') { desiredWidth *= scaleMin; desiredHeight *= scaleMin; }
|
728 |
-
if (meetOrSlice == 'slice') { desiredWidth *= scaleMax; desiredHeight *= scaleMax; }
|
729 |
-
|
730 |
-
refX = new svg.Property('refX', refX);
|
731 |
-
refY = new svg.Property('refY', refY);
|
732 |
-
if (refX.hasValue() && refY.hasValue()) {
|
733 |
-
ctx.translate(-scaleMin * refX.toPixels('x'), -scaleMin * refY.toPixels('y'));
|
734 |
-
}
|
735 |
-
else {
|
736 |
-
// align
|
737 |
-
if (align.match(/^xMid/) && ((meetOrSlice == 'meet' && scaleMin == scaleY) || (meetOrSlice == 'slice' && scaleMax == scaleY))) ctx.translate(width / 2.0 - desiredWidth / 2.0, 0);
|
738 |
-
if (align.match(/YMid$/) && ((meetOrSlice == 'meet' && scaleMin == scaleX) || (meetOrSlice == 'slice' && scaleMax == scaleX))) ctx.translate(0, height / 2.0 - desiredHeight / 2.0);
|
739 |
-
if (align.match(/^xMax/) && ((meetOrSlice == 'meet' && scaleMin == scaleY) || (meetOrSlice == 'slice' && scaleMax == scaleY))) ctx.translate(width - desiredWidth, 0);
|
740 |
-
if (align.match(/YMax$/) && ((meetOrSlice == 'meet' && scaleMin == scaleX) || (meetOrSlice == 'slice' && scaleMax == scaleX))) ctx.translate(0, height - desiredHeight);
|
741 |
-
}
|
742 |
-
|
743 |
-
// scale
|
744 |
-
if (align == 'none') ctx.scale(scaleX, scaleY);
|
745 |
-
else if (meetOrSlice == 'meet') ctx.scale(scaleMin, scaleMin);
|
746 |
-
else if (meetOrSlice == 'slice') ctx.scale(scaleMax, scaleMax);
|
747 |
-
|
748 |
-
// translate
|
749 |
-
ctx.translate(minX == null ? 0 : -minX, minY == null ? 0 : -minY);
|
750 |
-
}
|
751 |
-
|
752 |
-
// elements
|
753 |
-
svg.Element = {}
|
754 |
-
|
755 |
-
svg.EmptyProperty = new svg.Property('EMPTY', '');
|
756 |
-
|
757 |
-
svg.Element.ElementBase = function(node) {
|
758 |
-
this.attributes = {};
|
759 |
-
this.styles = {};
|
760 |
-
this.stylesSpecificity = {};
|
761 |
-
this.children = [];
|
762 |
-
|
763 |
-
// get or create attribute
|
764 |
-
this.attribute = function(name, createIfNotExists) {
|
765 |
-
var a = this.attributes[name];
|
766 |
-
if (a != null) return a;
|
767 |
-
|
768 |
-
if (createIfNotExists == true) { a = new svg.Property(name, ''); this.attributes[name] = a; }
|
769 |
-
return a || svg.EmptyProperty;
|
770 |
-
}
|
771 |
-
|
772 |
-
this.getHrefAttribute = function() {
|
773 |
-
for (var a in this.attributes) {
|
774 |
-
if (a == 'href' || a.match(/:href$/)) {
|
775 |
-
return this.attributes[a];
|
776 |
-
}
|
777 |
-
}
|
778 |
-
return svg.EmptyProperty;
|
779 |
-
}
|
780 |
-
|
781 |
-
// get or create style, crawls up node tree
|
782 |
-
this.style = function(name, createIfNotExists, skipAncestors) {
|
783 |
-
var s = this.styles[name];
|
784 |
-
if (s != null) return s;
|
785 |
-
|
786 |
-
var a = this.attribute(name);
|
787 |
-
if (a != null && a.hasValue()) {
|
788 |
-
this.styles[name] = a; // move up to me to cache
|
789 |
-
return a;
|
790 |
-
}
|
791 |
-
|
792 |
-
if (skipAncestors != true) {
|
793 |
-
var p = this.parent;
|
794 |
-
if (p != null) {
|
795 |
-
var ps = p.style(name);
|
796 |
-
if (ps != null && ps.hasValue()) {
|
797 |
-
return ps;
|
798 |
-
}
|
799 |
-
}
|
800 |
-
}
|
801 |
-
|
802 |
-
if (createIfNotExists == true) { s = new svg.Property(name, ''); this.styles[name] = s; }
|
803 |
-
return s || svg.EmptyProperty;
|
804 |
-
}
|
805 |
-
|
806 |
-
// base render
|
807 |
-
this.render = function(ctx) {
|
808 |
-
// don't render display=none
|
809 |
-
if (this.style('display').value == 'none') return;
|
810 |
-
|
811 |
-
// don't render visibility=hidden
|
812 |
-
if (this.style('visibility').value == 'hidden') return;
|
813 |
-
|
814 |
-
ctx.save();
|
815 |
-
if (this.style('mask').hasValue()) { // mask
|
816 |
-
var mask = this.style('mask').getDefinition();
|
817 |
-
if (mask != null) mask.apply(ctx, this);
|
818 |
-
}
|
819 |
-
else if (this.style('filter').hasValue()) { // filter
|
820 |
-
var filter = this.style('filter').getDefinition();
|
821 |
-
if (filter != null) filter.apply(ctx, this);
|
822 |
-
}
|
823 |
-
else {
|
824 |
-
this.setContext(ctx);
|
825 |
-
this.renderChildren(ctx);
|
826 |
-
this.clearContext(ctx);
|
827 |
-
}
|
828 |
-
ctx.restore();
|
829 |
-
}
|
830 |
-
|
831 |
-
// base set context
|
832 |
-
this.setContext = function(ctx) {
|
833 |
-
// OVERRIDE ME!
|
834 |
-
}
|
835 |
-
|
836 |
-
// base clear context
|
837 |
-
this.clearContext = function(ctx) {
|
838 |
-
// OVERRIDE ME!
|
839 |
-
}
|
840 |
-
|
841 |
-
// base render children
|
842 |
-
this.renderChildren = function(ctx) {
|
843 |
-
for (var i=0; i<this.children.length; i++) {
|
844 |
-
this.children[i].render(ctx);
|
845 |
-
}
|
846 |
-
}
|
847 |
-
|
848 |
-
this.addChild = function(childNode, create) {
|
849 |
-
var child = childNode;
|
850 |
-
if (create) child = svg.CreateElement(childNode);
|
851 |
-
child.parent = this;
|
852 |
-
if (child.type != 'title') { this.children.push(child); }
|
853 |
-
}
|
854 |
-
|
855 |
-
this.addStylesFromStyleDefinition = function () {
|
856 |
-
// add styles
|
857 |
-
for (var selector in svg.Styles) {
|
858 |
-
if (selector[0] != '@' && matchesSelector(node, selector)) {
|
859 |
-
var styles = svg.Styles[selector];
|
860 |
-
var specificity = svg.StylesSpecificity[selector];
|
861 |
-
if (styles != null) {
|
862 |
-
for (var name in styles) {
|
863 |
-
var existingSpecificity = this.stylesSpecificity[name];
|
864 |
-
if (typeof existingSpecificity == 'undefined') {
|
865 |
-
existingSpecificity = '000';
|
866 |
-
}
|
867 |
-
if (specificity > existingSpecificity) {
|
868 |
-
this.styles[name] = styles[name];
|
869 |
-
this.stylesSpecificity[name] = specificity;
|
870 |
-
}
|
871 |
-
}
|
872 |
-
}
|
873 |
-
}
|
874 |
-
}
|
875 |
-
};
|
876 |
-
|
877 |
-
// Microsoft Edge fix
|
878 |
-
var allUppercase = new RegExp("^[A-Z\-]+$");
|
879 |
-
var normalizeAttributeName = function (name) {
|
880 |
-
if (allUppercase.test(name)) {
|
881 |
-
return name.toLowerCase();
|
882 |
-
}
|
883 |
-
return name;
|
884 |
-
};
|
885 |
-
|
886 |
-
if (node != null && node.nodeType == 1) { //ELEMENT_NODE
|
887 |
-
// add attributes
|
888 |
-
for (var i=0; i<node.attributes.length; i++) {
|
889 |
-
var attribute = node.attributes[i];
|
890 |
-
var nodeName = normalizeAttributeName(attribute.nodeName);
|
891 |
-
this.attributes[nodeName] = new svg.Property(nodeName, attribute.value);
|
892 |
-
}
|
893 |
-
|
894 |
-
this.addStylesFromStyleDefinition();
|
895 |
-
|
896 |
-
// add inline styles
|
897 |
-
if (this.attribute('style').hasValue()) {
|
898 |
-
var styles = this.attribute('style').value.split(';');
|
899 |
-
for (var i=0; i<styles.length; i++) {
|
900 |
-
if (svg.trim(styles[i]) != '') {
|
901 |
-
var style = styles[i].split(':');
|
902 |
-
var name = svg.trim(style[0]);
|
903 |
-
var value = svg.trim(style[1]);
|
904 |
-
this.styles[name] = new svg.Property(name, value);
|
905 |
-
}
|
906 |
-
}
|
907 |
-
}
|
908 |
-
|
909 |
-
// add id
|
910 |
-
if (this.attribute('id').hasValue()) {
|
911 |
-
if (svg.Definitions[this.attribute('id').value] == null) {
|
912 |
-
svg.Definitions[this.attribute('id').value] = this;
|
913 |
-
}
|
914 |
-
}
|
915 |
-
|
916 |
-
// add children
|
917 |
-
for (var i=0; i<node.childNodes.length; i++) {
|
918 |
-
var childNode = node.childNodes[i];
|
919 |
-
if (childNode.nodeType == 1) this.addChild(childNode, true); //ELEMENT_NODE
|
920 |
-
if (this.captureTextNodes && (childNode.nodeType == 3 || childNode.nodeType == 4)) {
|
921 |
-
var text = childNode.value || childNode.text || childNode.textContent || '';
|
922 |
-
if (svg.compressSpaces(text) != '') {
|
923 |
-
this.addChild(new svg.Element.tspan(childNode), false); // TEXT_NODE
|
924 |
-
}
|
925 |
-
}
|
926 |
-
}
|
927 |
-
}
|
928 |
-
}
|
929 |
-
|
930 |
-
svg.Element.RenderedElementBase = function(node) {
|
931 |
-
this.base = svg.Element.ElementBase;
|
932 |
-
this.base(node);
|
933 |
-
|
934 |
-
this.setContext = function(ctx) {
|
935 |
-
// fill
|
936 |
-
if (this.style('fill').isUrlDefinition()) {
|
937 |
-
var fs = this.style('fill').getFillStyleDefinition(this, this.style('fill-opacity'));
|
938 |
-
if (fs != null) ctx.fillStyle = fs;
|
939 |
-
}
|
940 |
-
else if (this.style('fill').hasValue()) {
|
941 |
-
var fillStyle = this.style('fill');
|
942 |
-
if (fillStyle.value == 'currentColor') fillStyle.value = this.style('color').value;
|
943 |
-
if (fillStyle.value != 'inherit') ctx.fillStyle = (fillStyle.value == 'none' ? 'rgba(0,0,0,0)' : fillStyle.value);
|
944 |
-
}
|
945 |
-
if (this.style('fill-opacity').hasValue()) {
|
946 |
-
var fillStyle = new svg.Property('fill', ctx.fillStyle);
|
947 |
-
fillStyle = fillStyle.addOpacity(this.style('fill-opacity'));
|
948 |
-
ctx.fillStyle = fillStyle.value;
|
949 |
-
}
|
950 |
-
|
951 |
-
// stroke
|
952 |
-
if (this.style('stroke').isUrlDefinition()) {
|
953 |
-
var fs = this.style('stroke').getFillStyleDefinition(this, this.style('stroke-opacity'));
|
954 |
-
if (fs != null) ctx.strokeStyle = fs;
|
955 |
-
}
|
956 |
-
else if (this.style('stroke').hasValue()) {
|
957 |
-
var strokeStyle = this.style('stroke');
|
958 |
-
if (strokeStyle.value == 'currentColor') strokeStyle.value = this.style('color').value;
|
959 |
-
if (strokeStyle.value != 'inherit') ctx.strokeStyle = (strokeStyle.value == 'none' ? 'rgba(0,0,0,0)' : strokeStyle.value);
|
960 |
-
}
|
961 |
-
if (this.style('stroke-opacity').hasValue()) {
|
962 |
-
var strokeStyle = new svg.Property('stroke', ctx.strokeStyle);
|
963 |
-
strokeStyle = strokeStyle.addOpacity(this.style('stroke-opacity'));
|
964 |
-
ctx.strokeStyle = strokeStyle.value;
|
965 |
-
}
|
966 |
-
if (this.style('stroke-width').hasValue()) {
|
967 |
-
var newLineWidth = this.style('stroke-width').toPixels();
|
968 |
-
ctx.lineWidth = newLineWidth == 0 ? 0.001 : newLineWidth; // browsers don't respect 0
|
969 |
-
}
|
970 |
-
if (this.style('stroke-linecap').hasValue()) ctx.lineCap = this.style('stroke-linecap').value;
|
971 |
-
if (this.style('stroke-linejoin').hasValue()) ctx.lineJoin = this.style('stroke-linejoin').value;
|
972 |
-
if (this.style('stroke-miterlimit').hasValue()) ctx.miterLimit = this.style('stroke-miterlimit').value;
|
973 |
-
if (this.style('stroke-dasharray').hasValue() && this.style('stroke-dasharray').value != 'none') {
|
974 |
-
var gaps = svg.ToNumberArray(this.style('stroke-dasharray').value);
|
975 |
-
if (typeof ctx.setLineDash != 'undefined') { ctx.setLineDash(gaps); }
|
976 |
-
else if (typeof ctx.webkitLineDash != 'undefined') { ctx.webkitLineDash = gaps; }
|
977 |
-
else if (typeof ctx.mozDash != 'undefined' && !(gaps.length==1 && gaps[0]==0)) { ctx.mozDash = gaps; }
|
978 |
-
|
979 |
-
var offset = this.style('stroke-dashoffset').numValueOrDefault(1);
|
980 |
-
if (typeof ctx.lineDashOffset != 'undefined') { ctx.lineDashOffset = offset; }
|
981 |
-
else if (typeof ctx.webkitLineDashOffset != 'undefined') { ctx.webkitLineDashOffset = offset; }
|
982 |
-
else if (typeof ctx.mozDashOffset != 'undefined') { ctx.mozDashOffset = offset; }
|
983 |
-
}
|
984 |
-
|
985 |
-
// font
|
986 |
-
if (typeof ctx.font != 'undefined') {
|
987 |
-
ctx.font = svg.Font.CreateFont(
|
988 |
-
this.style('font-style').value,
|
989 |
-
this.style('font-variant').value,
|
990 |
-
this.style('font-weight').value,
|
991 |
-
this.style('font-size').hasValue() ? this.style('font-size').toPixels() + 'px' : '',
|
992 |
-
this.style('font-family').value).toString();
|
993 |
-
}
|
994 |
-
|
995 |
-
// transform
|
996 |
-
if (this.style('transform', false, true).hasValue()) {
|
997 |
-
var transform = new svg.Transform(this.style('transform', false, true).value);
|
998 |
-
transform.apply(ctx);
|
999 |
-
}
|
1000 |
-
|
1001 |
-
// clip
|
1002 |
-
if (this.style('clip-path', false, true).hasValue()) {
|
1003 |
-
var clip = this.style('clip-path', false, true).getDefinition();
|
1004 |
-
if (clip != null) clip.apply(ctx);
|
1005 |
-
}
|
1006 |
-
|
1007 |
-
// opacity
|
1008 |
-
if (this.style('opacity').hasValue()) {
|
1009 |
-
ctx.globalAlpha = this.style('opacity').numValue();
|
1010 |
-
}
|
1011 |
-
}
|
1012 |
-
}
|
1013 |
-
svg.Element.RenderedElementBase.prototype = new svg.Element.ElementBase;
|
1014 |
-
|
1015 |
-
svg.Element.PathElementBase = function(node) {
|
1016 |
-
this.base = svg.Element.RenderedElementBase;
|
1017 |
-
this.base(node);
|
1018 |
-
|
1019 |
-
this.path = function(ctx) {
|
1020 |
-
if (ctx != null) ctx.beginPath();
|
1021 |
-
return new svg.BoundingBox();
|
1022 |
-
}
|
1023 |
-
|
1024 |
-
this.renderChildren = function(ctx) {
|
1025 |
-
this.path(ctx);
|
1026 |
-
svg.Mouse.checkPath(this, ctx);
|
1027 |
-
if (ctx.fillStyle != '') {
|
1028 |
-
if (this.style('fill-rule').valueOrDefault('inherit') != 'inherit') { ctx.fill(this.style('fill-rule').value); }
|
1029 |
-
else { ctx.fill(); }
|
1030 |
-
}
|
1031 |
-
if (ctx.strokeStyle != '') ctx.stroke();
|
1032 |
-
|
1033 |
-
var markers = this.getMarkers();
|
1034 |
-
if (markers != null) {
|
1035 |
-
if (this.style('marker-start').isUrlDefinition()) {
|
1036 |
-
var marker = this.style('marker-start').getDefinition();
|
1037 |
-
marker.render(ctx, markers[0][0], markers[0][1]);
|
1038 |
-
}
|
1039 |
-
if (this.style('marker-mid').isUrlDefinition()) {
|
1040 |
-
var marker = this.style('marker-mid').getDefinition();
|
1041 |
-
for (var i=1;i<markers.length-1;i++) {
|
1042 |
-
marker.render(ctx, markers[i][0], markers[i][1]);
|
1043 |
-
}
|
1044 |
-
}
|
1045 |
-
if (this.style('marker-end').isUrlDefinition()) {
|
1046 |
-
var marker = this.style('marker-end').getDefinition();
|
1047 |
-
marker.render(ctx, markers[markers.length-1][0], markers[markers.length-1][1]);
|
1048 |
-
}
|
1049 |
-
}
|
1050 |
-
}
|
1051 |
-
|
1052 |
-
this.getBoundingBox = function() {
|
1053 |
-
return this.path();
|
1054 |
-
}
|
1055 |
-
|
1056 |
-
this.getMarkers = function() {
|
1057 |
-
return null;
|
1058 |
-
}
|
1059 |
-
}
|
1060 |
-
svg.Element.PathElementBase.prototype = new svg.Element.RenderedElementBase;
|
1061 |
-
|
1062 |
-
// svg element
|
1063 |
-
svg.Element.svg = function(node) {
|
1064 |
-
this.base = svg.Element.RenderedElementBase;
|
1065 |
-
this.base(node);
|
1066 |
-
|
1067 |
-
this.baseClearContext = this.clearContext;
|
1068 |
-
this.clearContext = function(ctx) {
|
1069 |
-
this.baseClearContext(ctx);
|
1070 |
-
svg.ViewPort.RemoveCurrent();
|
1071 |
-
}
|
1072 |
-
|
1073 |
-
this.baseSetContext = this.setContext;
|
1074 |
-
this.setContext = function(ctx) {
|
1075 |
-
// initial values and defaults
|
1076 |
-
ctx.strokeStyle = 'rgba(0,0,0,0)';
|
1077 |
-
ctx.lineCap = 'butt';
|
1078 |
-
ctx.lineJoin = 'miter';
|
1079 |
-
ctx.miterLimit = 4;
|
1080 |
-
if (typeof ctx.font != 'undefined' && typeof window.getComputedStyle != 'undefined') {
|
1081 |
-
ctx.font = window.getComputedStyle(ctx.canvas).getPropertyValue('font');
|
1082 |
-
}
|
1083 |
-
|
1084 |
-
this.baseSetContext(ctx);
|
1085 |
-
|
1086 |
-
// create new view port
|
1087 |
-
if (!this.attribute('x').hasValue()) this.attribute('x', true).value = 0;
|
1088 |
-
if (!this.attribute('y').hasValue()) this.attribute('y', true).value = 0;
|
1089 |
-
ctx.translate(this.attribute('x').toPixels('x'), this.attribute('y').toPixels('y'));
|
1090 |
-
|
1091 |
-
var width = svg.ViewPort.width();
|
1092 |
-
var height = svg.ViewPort.height();
|
1093 |
-
|
1094 |
-
if (!this.attribute('width').hasValue()) this.attribute('width', true).value = '100%';
|
1095 |
-
if (!this.attribute('height').hasValue()) this.attribute('height', true).value = '100%';
|
1096 |
-
if (typeof this.root == 'undefined') {
|
1097 |
-
width = this.attribute('width').toPixels('x');
|
1098 |
-
height = this.attribute('height').toPixels('y');
|
1099 |
-
|
1100 |
-
var x = 0;
|
1101 |
-
var y = 0;
|
1102 |
-
if (this.attribute('refX').hasValue() && this.attribute('refY').hasValue()) {
|
1103 |
-
x = -this.attribute('refX').toPixels('x');
|
1104 |
-
y = -this.attribute('refY').toPixels('y');
|
1105 |
-
}
|
1106 |
-
|
1107 |
-
if (this.attribute('overflow').valueOrDefault('hidden') != 'visible') {
|
1108 |
-
ctx.beginPath();
|
1109 |
-
ctx.moveTo(x, y);
|
1110 |
-
ctx.lineTo(width, y);
|
1111 |
-
ctx.lineTo(width, height);
|
1112 |
-
ctx.lineTo(x, height);
|
1113 |
-
ctx.closePath();
|
1114 |
-
ctx.clip();
|
1115 |
-
}
|
1116 |
-
}
|
1117 |
-
svg.ViewPort.SetCurrent(width, height);
|
1118 |
-
|
1119 |
-
// viewbox
|
1120 |
-
if (this.attribute('viewBox').hasValue()) {
|
1121 |
-
var viewBox = svg.ToNumberArray(this.attribute('viewBox').value);
|
1122 |
-
var minX = viewBox[0];
|
1123 |
-
var minY = viewBox[1];
|
1124 |
-
width = viewBox[2];
|
1125 |
-
height = viewBox[3];
|
1126 |
-
|
1127 |
-
svg.AspectRatio(ctx,
|
1128 |
-
this.attribute('preserveAspectRatio').value,
|
1129 |
-
svg.ViewPort.width(),
|
1130 |
-
width,
|
1131 |
-
svg.ViewPort.height(),
|
1132 |
-
height,
|
1133 |
-
minX,
|
1134 |
-
minY,
|
1135 |
-
this.attribute('refX').value,
|
1136 |
-
this.attribute('refY').value);
|
1137 |
-
|
1138 |
-
svg.ViewPort.RemoveCurrent();
|
1139 |
-
svg.ViewPort.SetCurrent(viewBox[2], viewBox[3]);
|
1140 |
-
}
|
1141 |
-
}
|
1142 |
-
}
|
1143 |
-
svg.Element.svg.prototype = new svg.Element.RenderedElementBase;
|
1144 |
-
|
1145 |
-
// rect element
|
1146 |
-
svg.Element.rect = function(node) {
|
1147 |
-
this.base = svg.Element.PathElementBase;
|
1148 |
-
this.base(node);
|
1149 |
-
|
1150 |
-
this.path = function(ctx) {
|
1151 |
-
var x = this.attribute('x').toPixels('x');
|
1152 |
-
var y = this.attribute('y').toPixels('y');
|
1153 |
-
var width = this.attribute('width').toPixels('x');
|
1154 |
-
var height = this.attribute('height').toPixels('y');
|
1155 |
-
var rx = this.attribute('rx').toPixels('x');
|
1156 |
-
var ry = this.attribute('ry').toPixels('y');
|
1157 |
-
if (this.attribute('rx').hasValue() && !this.attribute('ry').hasValue()) ry = rx;
|
1158 |
-
if (this.attribute('ry').hasValue() && !this.attribute('rx').hasValue()) rx = ry;
|
1159 |
-
rx = Math.min(rx, width / 2.0);
|
1160 |
-
ry = Math.min(ry, height / 2.0);
|
1161 |
-
if (ctx != null) {
|
1162 |
-
ctx.beginPath();
|
1163 |
-
ctx.moveTo(x + rx, y);
|
1164 |
-
ctx.lineTo(x + width - rx, y);
|
1165 |
-
ctx.quadraticCurveTo(x + width, y, x + width, y + ry)
|
1166 |
-
ctx.lineTo(x + width, y + height - ry);
|
1167 |
-
ctx.quadraticCurveTo(x + width, y + height, x + width - rx, y + height)
|
1168 |
-
ctx.lineTo(x + rx, y + height);
|
1169 |
-
ctx.quadraticCurveTo(x, y + height, x, y + height - ry)
|
1170 |
-
ctx.lineTo(x, y + ry);
|
1171 |
-
ctx.quadraticCurveTo(x, y, x + rx, y)
|
1172 |
-
ctx.closePath();
|
1173 |
-
}
|
1174 |
-
|
1175 |
-
return new svg.BoundingBox(x, y, x + width, y + height);
|
1176 |
-
}
|
1177 |
-
}
|
1178 |
-
svg.Element.rect.prototype = new svg.Element.PathElementBase;
|
1179 |
-
|
1180 |
-
// circle element
|
1181 |
-
svg.Element.circle = function(node) {
|
1182 |
-
this.base = svg.Element.PathElementBase;
|
1183 |
-
this.base(node);
|
1184 |
-
|
1185 |
-
this.path = function(ctx) {
|
1186 |
-
var cx = this.attribute('cx').toPixels('x');
|
1187 |
-
var cy = this.attribute('cy').toPixels('y');
|
1188 |
-
var r = this.attribute('r').toPixels();
|
1189 |
-
|
1190 |
-
if (ctx != null) {
|
1191 |
-
ctx.beginPath();
|
1192 |
-
ctx.arc(cx, cy, r, 0, Math.PI * 2, true);
|
1193 |
-
ctx.closePath();
|
1194 |
-
}
|
1195 |
-
|
1196 |
-
return new svg.BoundingBox(cx - r, cy - r, cx + r, cy + r);
|
1197 |
-
}
|
1198 |
-
}
|
1199 |
-
svg.Element.circle.prototype = new svg.Element.PathElementBase;
|
1200 |
-
|
1201 |
-
// ellipse element
|
1202 |
-
svg.Element.ellipse = function(node) {
|
1203 |
-
this.base = svg.Element.PathElementBase;
|
1204 |
-
this.base(node);
|
1205 |
-
|
1206 |
-
this.path = function(ctx) {
|
1207 |
-
var KAPPA = 4 * ((Math.sqrt(2) - 1) / 3);
|
1208 |
-
var rx = this.attribute('rx').toPixels('x');
|
1209 |
-
var ry = this.attribute('ry').toPixels('y');
|
1210 |
-
var cx = this.attribute('cx').toPixels('x');
|
1211 |
-
var cy = this.attribute('cy').toPixels('y');
|
1212 |
-
|
1213 |
-
if (ctx != null) {
|
1214 |
-
ctx.beginPath();
|
1215 |
-
ctx.moveTo(cx, cy - ry);
|
1216 |
-
ctx.bezierCurveTo(cx + (KAPPA * rx), cy - ry, cx + rx, cy - (KAPPA * ry), cx + rx, cy);
|
1217 |
-
ctx.bezierCurveTo(cx + rx, cy + (KAPPA * ry), cx + (KAPPA * rx), cy + ry, cx, cy + ry);
|
1218 |
-
ctx.bezierCurveTo(cx - (KAPPA * rx), cy + ry, cx - rx, cy + (KAPPA * ry), cx - rx, cy);
|
1219 |
-
ctx.bezierCurveTo(cx - rx, cy - (KAPPA * ry), cx - (KAPPA * rx), cy - ry, cx, cy - ry);
|
1220 |
-
ctx.closePath();
|
1221 |
-
}
|
1222 |
-
|
1223 |
-
return new svg.BoundingBox(cx - rx, cy - ry, cx + rx, cy + ry);
|
1224 |
-
}
|
1225 |
-
}
|
1226 |
-
svg.Element.ellipse.prototype = new svg.Element.PathElementBase;
|
1227 |
-
|
1228 |
-
// line element
|
1229 |
-
svg.Element.line = function(node) {
|
1230 |
-
this.base = svg.Element.PathElementBase;
|
1231 |
-
this.base(node);
|
1232 |
-
|
1233 |
-
this.getPoints = function() {
|
1234 |
-
return [
|
1235 |
-
new svg.Point(this.attribute('x1').toPixels('x'), this.attribute('y1').toPixels('y')),
|
1236 |
-
new svg.Point(this.attribute('x2').toPixels('x'), this.attribute('y2').toPixels('y'))];
|
1237 |
-
}
|
1238 |
-
|
1239 |
-
this.path = function(ctx) {
|
1240 |
-
var points = this.getPoints();
|
1241 |
-
|
1242 |
-
if (ctx != null) {
|
1243 |
-
ctx.beginPath();
|
1244 |
-
ctx.moveTo(points[0].x, points[0].y);
|
1245 |
-
ctx.lineTo(points[1].x, points[1].y);
|
1246 |
-
}
|
1247 |
-
|
1248 |
-
return new svg.BoundingBox(points[0].x, points[0].y, points[1].x, points[1].y);
|
1249 |
-
}
|
1250 |
-
|
1251 |
-
this.getMarkers = function() {
|
1252 |
-
var points = this.getPoints();
|
1253 |
-
var a = points[0].angleTo(points[1]);
|
1254 |
-
return [[points[0], a], [points[1], a]];
|
1255 |
-
}
|
1256 |
-
}
|
1257 |
-
svg.Element.line.prototype = new svg.Element.PathElementBase;
|
1258 |
-
|
1259 |
-
// polyline element
|
1260 |
-
svg.Element.polyline = function(node) {
|
1261 |
-
this.base = svg.Element.PathElementBase;
|
1262 |
-
this.base(node);
|
1263 |
-
|
1264 |
-
this.points = svg.CreatePath(this.attribute('points').value);
|
1265 |
-
this.path = function(ctx) {
|
1266 |
-
var bb = new svg.BoundingBox(this.points[0].x, this.points[0].y);
|
1267 |
-
if (ctx != null) {
|
1268 |
-
ctx.beginPath();
|
1269 |
-
ctx.moveTo(this.points[0].x, this.points[0].y);
|
1270 |
-
}
|
1271 |
-
for (var i=1; i<this.points.length; i++) {
|
1272 |
-
bb.addPoint(this.points[i].x, this.points[i].y);
|
1273 |
-
if (ctx != null) ctx.lineTo(this.points[i].x, this.points[i].y);
|
1274 |
-
}
|
1275 |
-
return bb;
|
1276 |
-
}
|
1277 |
-
|
1278 |
-
this.getMarkers = function() {
|
1279 |
-
var markers = [];
|
1280 |
-
for (var i=0; i<this.points.length - 1; i++) {
|
1281 |
-
markers.push([this.points[i], this.points[i].angleTo(this.points[i+1])]);
|
1282 |
-
}
|
1283 |
-
if (markers.length > 0) {
|
1284 |
-
markers.push([this.points[this.points.length-1], markers[markers.length-1][1]]);
|
1285 |
-
}
|
1286 |
-
return markers;
|
1287 |
-
}
|
1288 |
-
}
|
1289 |
-
svg.Element.polyline.prototype = new svg.Element.PathElementBase;
|
1290 |
-
|
1291 |
-
// polygon element
|
1292 |
-
svg.Element.polygon = function(node) {
|
1293 |
-
this.base = svg.Element.polyline;
|
1294 |
-
this.base(node);
|
1295 |
-
|
1296 |
-
this.basePath = this.path;
|
1297 |
-
this.path = function(ctx) {
|
1298 |
-
var bb = this.basePath(ctx);
|
1299 |
-
if (ctx != null) {
|
1300 |
-
ctx.lineTo(this.points[0].x, this.points[0].y);
|
1301 |
-
ctx.closePath();
|
1302 |
-
}
|
1303 |
-
return bb;
|
1304 |
-
}
|
1305 |
-
}
|
1306 |
-
svg.Element.polygon.prototype = new svg.Element.polyline;
|
1307 |
-
|
1308 |
-
// path element
|
1309 |
-
svg.Element.path = function(node) {
|
1310 |
-
this.base = svg.Element.PathElementBase;
|
1311 |
-
this.base(node);
|
1312 |
-
|
1313 |
-
var d = this.attribute('d').value;
|
1314 |
-
// TODO: convert to real lexer based on http://www.w3.org/TR/SVG11/paths.html#PathDataBNF
|
1315 |
-
d = d.replace(/,/gm,' '); // get rid of all commas
|
1316 |
-
// As the end of a match can also be the start of the next match, we need to run this replace twice.
|
1317 |
-
for(var i=0; i<2; i++)
|
1318 |
-
d = d.replace(/([MmZzLlHhVvCcSsQqTtAa])([^\s])/gm,'$1 $2'); // suffix commands with spaces
|
1319 |
-
d = d.replace(/([^\s])([MmZzLlHhVvCcSsQqTtAa])/gm,'$1 $2'); // prefix commands with spaces
|
1320 |
-
d = d.replace(/([0-9])([+\-])/gm,'$1 $2'); // separate digits on +- signs
|
1321 |
-
// Again, we need to run this twice to find all occurances
|
1322 |
-
for(var i=0; i<2; i++)
|
1323 |
-
d = d.replace(/(\.[0-9]*)(\.)/gm,'$1 $2'); // separate digits when they start with a comma
|
1324 |
-
d = d.replace(/([Aa](\s+[0-9]+){3})\s+([01])\s*([01])/gm,'$1 $3 $4 '); // shorthand elliptical arc path syntax
|
1325 |
-
d = svg.compressSpaces(d); // compress multiple spaces
|
1326 |
-
d = svg.trim(d);
|
1327 |
-
this.PathParser = new (function(d) {
|
1328 |
-
this.tokens = d.split(' ');
|
1329 |
-
|
1330 |
-
this.reset = function() {
|
1331 |
-
this.i = -1;
|
1332 |
-
this.command = '';
|
1333 |
-
this.previousCommand = '';
|
1334 |
-
this.start = new svg.Point(0, 0);
|
1335 |
-
this.control = new svg.Point(0, 0);
|
1336 |
-
this.current = new svg.Point(0, 0);
|
1337 |
-
this.points = [];
|
1338 |
-
this.angles = [];
|
1339 |
-
}
|
1340 |
-
|
1341 |
-
this.isEnd = function() {
|
1342 |
-
return this.i >= this.tokens.length - 1;
|
1343 |
-
}
|
1344 |
-
|
1345 |
-
this.isCommandOrEnd = function() {
|
1346 |
-
if (this.isEnd()) return true;
|
1347 |
-
return this.tokens[this.i + 1].match(/^[A-Za-z]$/) != null;
|
1348 |
-
}
|
1349 |
-
|
1350 |
-
this.isRelativeCommand = function() {
|
1351 |
-
switch(this.command)
|
1352 |
-
{
|
1353 |
-
case 'm':
|
1354 |
-
case 'l':
|
1355 |
-
case 'h':
|
1356 |
-
case 'v':
|
1357 |
-
case 'c':
|
1358 |
-
case 's':
|
1359 |
-
case 'q':
|
1360 |
-
case 't':
|
1361 |
-
case 'a':
|
1362 |
-
case 'z':
|
1363 |
-
return true;
|
1364 |
-
break;
|
1365 |
-
}
|
1366 |
-
return false;
|
1367 |
-
}
|
1368 |
-
|
1369 |
-
this.getToken = function() {
|
1370 |
-
this.i++;
|
1371 |
-
return this.tokens[this.i];
|
1372 |
-
}
|
1373 |
-
|
1374 |
-
this.getScalar = function() {
|
1375 |
-
return parseFloat(this.getToken());
|
1376 |
-
}
|
1377 |
-
|
1378 |
-
this.nextCommand = function() {
|
1379 |
-
this.previousCommand = this.command;
|
1380 |
-
this.command = this.getToken();
|
1381 |
-
}
|
1382 |
-
|
1383 |
-
this.getPoint = function() {
|
1384 |
-
var p = new svg.Point(this.getScalar(), this.getScalar());
|
1385 |
-
return this.makeAbsolute(p);
|
1386 |
-
}
|
1387 |
-
|
1388 |
-
this.getAsControlPoint = function() {
|
1389 |
-
var p = this.getPoint();
|
1390 |
-
this.control = p;
|
1391 |
-
return p;
|
1392 |
-
}
|
1393 |
-
|
1394 |
-
this.getAsCurrentPoint = function() {
|
1395 |
-
var p = this.getPoint();
|
1396 |
-
this.current = p;
|
1397 |
-
return p;
|
1398 |
-
}
|
1399 |
-
|
1400 |
-
this.getReflectedControlPoint = function() {
|
1401 |
-
if (this.previousCommand.toLowerCase() != 'c' &&
|
1402 |
-
this.previousCommand.toLowerCase() != 's' &&
|
1403 |
-
this.previousCommand.toLowerCase() != 'q' &&
|
1404 |
-
this.previousCommand.toLowerCase() != 't' ){
|
1405 |
-
return this.current;
|
1406 |
-
}
|
1407 |
-
|
1408 |
-
// reflect point
|
1409 |
-
var p = new svg.Point(2 * this.current.x - this.control.x, 2 * this.current.y - this.control.y);
|
1410 |
-
return p;
|
1411 |
-
}
|
1412 |
-
|
1413 |
-
this.makeAbsolute = function(p) {
|
1414 |
-
if (this.isRelativeCommand()) {
|
1415 |
-
p.x += this.current.x;
|
1416 |
-
p.y += this.current.y;
|
1417 |
-
}
|
1418 |
-
return p;
|
1419 |
-
}
|
1420 |
-
|
1421 |
-
this.addMarker = function(p, from, priorTo) {
|
1422 |
-
// if the last angle isn't filled in because we didn't have this point yet ...
|
1423 |
-
if (priorTo != null && this.angles.length > 0 && this.angles[this.angles.length-1] == null) {
|
1424 |
-
this.angles[this.angles.length-1] = this.points[this.points.length-1].angleTo(priorTo);
|
1425 |
-
}
|
1426 |
-
this.addMarkerAngle(p, from == null ? null : from.angleTo(p));
|
1427 |
-
}
|
1428 |
-
|
1429 |
-
this.addMarkerAngle = function(p, a) {
|
1430 |
-
this.points.push(p);
|
1431 |
-
this.angles.push(a);
|
1432 |
-
}
|
1433 |
-
|
1434 |
-
this.getMarkerPoints = function() { return this.points; }
|
1435 |
-
this.getMarkerAngles = function() {
|
1436 |
-
for (var i=0; i<this.angles.length; i++) {
|
1437 |
-
if (this.angles[i] == null) {
|
1438 |
-
for (var j=i+1; j<this.angles.length; j++) {
|
1439 |
-
if (this.angles[j] != null) {
|
1440 |
-
this.angles[i] = this.angles[j];
|
1441 |
-
break;
|
1442 |
-
}
|
1443 |
-
}
|
1444 |
-
}
|
1445 |
-
}
|
1446 |
-
return this.angles;
|
1447 |
-
}
|
1448 |
-
})(d);
|
1449 |
-
|
1450 |
-
this.path = function(ctx) {
|
1451 |
-
var pp = this.PathParser;
|
1452 |
-
pp.reset();
|
1453 |
-
|
1454 |
-
var bb = new svg.BoundingBox();
|
1455 |
-
if (ctx != null) ctx.beginPath();
|
1456 |
-
while (!pp.isEnd()) {
|
1457 |
-
pp.nextCommand();
|
1458 |
-
switch (pp.command) {
|
1459 |
-
case 'M':
|
1460 |
-
case 'm':
|
1461 |
-
var p = pp.getAsCurrentPoint();
|
1462 |
-
pp.addMarker(p);
|
1463 |
-
bb.addPoint(p.x, p.y);
|
1464 |
-
if (ctx != null) ctx.moveTo(p.x, p.y);
|
1465 |
-
pp.start = pp.current;
|
1466 |
-
while (!pp.isCommandOrEnd()) {
|
1467 |
-
var p = pp.getAsCurrentPoint();
|
1468 |
-
pp.addMarker(p, pp.start);
|
1469 |
-
bb.addPoint(p.x, p.y);
|
1470 |
-
if (ctx != null) ctx.lineTo(p.x, p.y);
|
1471 |
-
}
|
1472 |
-
break;
|
1473 |
-
case 'L':
|
1474 |
-
case 'l':
|
1475 |
-
while (!pp.isCommandOrEnd()) {
|
1476 |
-
var c = pp.current;
|
1477 |
-
var p = pp.getAsCurrentPoint();
|
1478 |
-
pp.addMarker(p, c);
|
1479 |
-
bb.addPoint(p.x, p.y);
|
1480 |
-
if (ctx != null) ctx.lineTo(p.x, p.y);
|
1481 |
-
}
|
1482 |
-
break;
|
1483 |
-
case 'H':
|
1484 |
-
case 'h':
|
1485 |
-
while (!pp.isCommandOrEnd()) {
|
1486 |
-
var newP = new svg.Point((pp.isRelativeCommand() ? pp.current.x : 0) + pp.getScalar(), pp.current.y);
|
1487 |
-
pp.addMarker(newP, pp.current);
|
1488 |
-
pp.current = newP;
|
1489 |
-
bb.addPoint(pp.current.x, pp.current.y);
|
1490 |
-
if (ctx != null) ctx.lineTo(pp.current.x, pp.current.y);
|
1491 |
-
}
|
1492 |
-
break;
|
1493 |
-
case 'V':
|
1494 |
-
case 'v':
|
1495 |
-
while (!pp.isCommandOrEnd()) {
|
1496 |
-
var newP = new svg.Point(pp.current.x, (pp.isRelativeCommand() ? pp.current.y : 0) + pp.getScalar());
|
1497 |
-
pp.addMarker(newP, pp.current);
|
1498 |
-
pp.current = newP;
|
1499 |
-
bb.addPoint(pp.current.x, pp.current.y);
|
1500 |
-
if (ctx != null) ctx.lineTo(pp.current.x, pp.current.y);
|
1501 |
-
}
|
1502 |
-
break;
|
1503 |
-
case 'C':
|
1504 |
-
case 'c':
|
1505 |
-
while (!pp.isCommandOrEnd()) {
|
1506 |
-
var curr = pp.current;
|
1507 |
-
var p1 = pp.getPoint();
|
1508 |
-
var cntrl = pp.getAsControlPoint();
|
1509 |
-
var cp = pp.getAsCurrentPoint();
|
1510 |
-
pp.addMarker(cp, cntrl, p1);
|
1511 |
-
bb.addBezierCurve(curr.x, curr.y, p1.x, p1.y, cntrl.x, cntrl.y, cp.x, cp.y);
|
1512 |
-
if (ctx != null) ctx.bezierCurveTo(p1.x, p1.y, cntrl.x, cntrl.y, cp.x, cp.y);
|
1513 |
-
}
|
1514 |
-
break;
|
1515 |
-
case 'S':
|
1516 |
-
case 's':
|
1517 |
-
while (!pp.isCommandOrEnd()) {
|
1518 |
-
var curr = pp.current;
|
1519 |
-
var p1 = pp.getReflectedControlPoint();
|
1520 |
-
var cntrl = pp.getAsControlPoint();
|
1521 |
-
var cp = pp.getAsCurrentPoint();
|
1522 |
-
pp.addMarker(cp, cntrl, p1);
|
1523 |
-
bb.addBezierCurve(curr.x, curr.y, p1.x, p1.y, cntrl.x, cntrl.y, cp.x, cp.y);
|
1524 |
-
if (ctx != null) ctx.bezierCurveTo(p1.x, p1.y, cntrl.x, cntrl.y, cp.x, cp.y);
|
1525 |
-
}
|
1526 |
-
break;
|
1527 |
-
case 'Q':
|
1528 |
-
case 'q':
|
1529 |
-
while (!pp.isCommandOrEnd()) {
|
1530 |
-
var curr = pp.current;
|
1531 |
-
var cntrl = pp.getAsControlPoint();
|
1532 |
-
var cp = pp.getAsCurrentPoint();
|
1533 |
-
pp.addMarker(cp, cntrl, cntrl);
|
1534 |
-
bb.addQuadraticCurve(curr.x, curr.y, cntrl.x, cntrl.y, cp.x, cp.y);
|
1535 |
-
if (ctx != null) ctx.quadraticCurveTo(cntrl.x, cntrl.y, cp.x, cp.y);
|
1536 |
-
}
|
1537 |
-
break;
|
1538 |
-
case 'T':
|
1539 |
-
case 't':
|
1540 |
-
while (!pp.isCommandOrEnd()) {
|
1541 |
-
var curr = pp.current;
|
1542 |
-
var cntrl = pp.getReflectedControlPoint();
|
1543 |
-
pp.control = cntrl;
|
1544 |
-
var cp = pp.getAsCurrentPoint();
|
1545 |
-
pp.addMarker(cp, cntrl, cntrl);
|
1546 |
-
bb.addQuadraticCurve(curr.x, curr.y, cntrl.x, cntrl.y, cp.x, cp.y);
|
1547 |
-
if (ctx != null) ctx.quadraticCurveTo(cntrl.x, cntrl.y, cp.x, cp.y);
|
1548 |
-
}
|
1549 |
-
break;
|
1550 |
-
case 'A':
|
1551 |
-
case 'a':
|
1552 |
-
while (!pp.isCommandOrEnd()) {
|
1553 |
-
var curr = pp.current;
|
1554 |
-
var rx = pp.getScalar();
|
1555 |
-
var ry = pp.getScalar();
|
1556 |
-
var xAxisRotation = pp.getScalar() * (Math.PI / 180.0);
|
1557 |
-
var largeArcFlag = pp.getScalar();
|
1558 |
-
var sweepFlag = pp.getScalar();
|
1559 |
-
var cp = pp.getAsCurrentPoint();
|
1560 |
-
|
1561 |
-
// Conversion from endpoint to center parameterization
|
1562 |
-
// http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes
|
1563 |
-
// x1', y1'
|
1564 |
-
var currp = new svg.Point(
|
1565 |
-
Math.cos(xAxisRotation) * (curr.x - cp.x) / 2.0 + Math.sin(xAxisRotation) * (curr.y - cp.y) / 2.0,
|
1566 |
-
-Math.sin(xAxisRotation) * (curr.x - cp.x) / 2.0 + Math.cos(xAxisRotation) * (curr.y - cp.y) / 2.0
|
1567 |
-
);
|
1568 |
-
// adjust radii
|
1569 |
-
var l = Math.pow(currp.x,2)/Math.pow(rx,2)+Math.pow(currp.y,2)/Math.pow(ry,2);
|
1570 |
-
if (l > 1) {
|
1571 |
-
rx *= Math.sqrt(l);
|
1572 |
-
ry *= Math.sqrt(l);
|
1573 |
-
}
|
1574 |
-
// cx', cy'
|
1575 |
-
var s = (largeArcFlag == sweepFlag ? -1 : 1) * Math.sqrt(
|
1576 |
-
((Math.pow(rx,2)*Math.pow(ry,2))-(Math.pow(rx,2)*Math.pow(currp.y,2))-(Math.pow(ry,2)*Math.pow(currp.x,2))) /
|
1577 |
-
(Math.pow(rx,2)*Math.pow(currp.y,2)+Math.pow(ry,2)*Math.pow(currp.x,2))
|
1578 |
-
);
|
1579 |
-
if (isNaN(s)) s = 0;
|
1580 |
-
var cpp = new svg.Point(s * rx * currp.y / ry, s * -ry * currp.x / rx);
|
1581 |
-
// cx, cy
|
1582 |
-
var centp = new svg.Point(
|
1583 |
-
(curr.x + cp.x) / 2.0 + Math.cos(xAxisRotation) * cpp.x - Math.sin(xAxisRotation) * cpp.y,
|
1584 |
-
(curr.y + cp.y) / 2.0 + Math.sin(xAxisRotation) * cpp.x + Math.cos(xAxisRotation) * cpp.y
|
1585 |
-
);
|
1586 |
-
// vector magnitude
|
1587 |
-
var m = function(v) { return Math.sqrt(Math.pow(v[0],2) + Math.pow(v[1],2)); }
|
1588 |
-
// ratio between two vectors
|
1589 |
-
var r = function(u, v) { return (u[0]*v[0]+u[1]*v[1]) / (m(u)*m(v)) }
|
1590 |
-
// angle between two vectors
|
1591 |
-
var a = function(u, v) { return (u[0]*v[1] < u[1]*v[0] ? -1 : 1) * Math.acos(r(u,v)); }
|
1592 |
-
// initial angle
|
1593 |
-
var a1 = a([1,0], [(currp.x-cpp.x)/rx,(currp.y-cpp.y)/ry]);
|
1594 |
-
// angle delta
|
1595 |
-
var u = [(currp.x-cpp.x)/rx,(currp.y-cpp.y)/ry];
|
1596 |
-
var v = [(-currp.x-cpp.x)/rx,(-currp.y-cpp.y)/ry];
|
1597 |
-
var ad = a(u, v);
|
1598 |
-
if (r(u,v) <= -1) ad = Math.PI;
|
1599 |
-
if (r(u,v) >= 1) ad = 0;
|
1600 |
-
|
1601 |
-
// for markers
|
1602 |
-
var dir = 1 - sweepFlag ? 1.0 : -1.0;
|
1603 |
-
var ah = a1 + dir * (ad / 2.0);
|
1604 |
-
var halfWay = new svg.Point(
|
1605 |
-
centp.x + rx * Math.cos(ah),
|
1606 |
-
centp.y + ry * Math.sin(ah)
|
1607 |
-
);
|
1608 |
-
pp.addMarkerAngle(halfWay, ah - dir * Math.PI / 2);
|
1609 |
-
pp.addMarkerAngle(cp, ah - dir * Math.PI);
|
1610 |
-
|
1611 |
-
bb.addPoint(cp.x, cp.y); // TODO: this is too naive, make it better
|
1612 |
-
if (ctx != null) {
|
1613 |
-
var r = rx > ry ? rx : ry;
|
1614 |
-
var sx = rx > ry ? 1 : rx / ry;
|
1615 |
-
var sy = rx > ry ? ry / rx : 1;
|
1616 |
-
|
1617 |
-
ctx.translate(centp.x, centp.y);
|
1618 |
-
ctx.rotate(xAxisRotation);
|
1619 |
-
ctx.scale(sx, sy);
|
1620 |
-
ctx.arc(0, 0, r, a1, a1 + ad, 1 - sweepFlag);
|
1621 |
-
ctx.scale(1/sx, 1/sy);
|
1622 |
-
ctx.rotate(-xAxisRotation);
|
1623 |
-
ctx.translate(-centp.x, -centp.y);
|
1624 |
-
}
|
1625 |
-
}
|
1626 |
-
break;
|
1627 |
-
case 'Z':
|
1628 |
-
case 'z':
|
1629 |
-
if (ctx != null) ctx.closePath();
|
1630 |
-
pp.current = pp.start;
|
1631 |
-
}
|
1632 |
-
}
|
1633 |
-
|
1634 |
-
return bb;
|
1635 |
-
}
|
1636 |
-
|
1637 |
-
this.getMarkers = function() {
|
1638 |
-
var points = this.PathParser.getMarkerPoints();
|
1639 |
-
var angles = this.PathParser.getMarkerAngles();
|
1640 |
-
|
1641 |
-
var markers = [];
|
1642 |
-
for (var i=0; i<points.length; i++) {
|
1643 |
-
markers.push([points[i], angles[i]]);
|
1644 |
-
}
|
1645 |
-
return markers;
|
1646 |
-
}
|
1647 |
-
}
|
1648 |
-
svg.Element.path.prototype = new svg.Element.PathElementBase;
|
1649 |
-
|
1650 |
-
// pattern element
|
1651 |
-
svg.Element.pattern = function(node) {
|
1652 |
-
this.base = svg.Element.ElementBase;
|
1653 |
-
this.base(node);
|
1654 |
-
|
1655 |
-
this.createPattern = function(ctx, element) {
|
1656 |
-
var width = this.attribute('width').toPixels('x', true);
|
1657 |
-
var height = this.attribute('height').toPixels('y', true);
|
1658 |
-
|
1659 |
-
// render me using a temporary svg element
|
1660 |
-
var tempSvg = new svg.Element.svg();
|
1661 |
-
tempSvg.attributes['viewBox'] = new svg.Property('viewBox', this.attribute('viewBox').value);
|
1662 |
-
tempSvg.attributes['width'] = new svg.Property('width', width + 'px');
|
1663 |
-
tempSvg.attributes['height'] = new svg.Property('height', height + 'px');
|
1664 |
-
tempSvg.attributes['transform'] = new svg.Property('transform', this.attribute('patternTransform').value);
|
1665 |
-
tempSvg.children = this.children;
|
1666 |
-
|
1667 |
-
var c = document.createElement('canvas');
|
1668 |
-
c.width = width;
|
1669 |
-
c.height = height;
|
1670 |
-
var cctx = c.getContext('2d');
|
1671 |
-
if (this.attribute('x').hasValue() && this.attribute('y').hasValue()) {
|
1672 |
-
cctx.translate(this.attribute('x').toPixels('x', true), this.attribute('y').toPixels('y', true));
|
1673 |
-
}
|
1674 |
-
// render 3x3 grid so when we transform there's no white space on edges
|
1675 |
-
for (var x=-1; x<=1; x++) {
|
1676 |
-
for (var y=-1; y<=1; y++) {
|
1677 |
-
cctx.save();
|
1678 |
-
tempSvg.attributes['x'] = new svg.Property('x', x * c.width);
|
1679 |
-
tempSvg.attributes['y'] = new svg.Property('y', y * c.height);
|
1680 |
-
tempSvg.render(cctx);
|
1681 |
-
cctx.restore();
|
1682 |
-
}
|
1683 |
-
}
|
1684 |
-
var pattern = ctx.createPattern(c, 'repeat');
|
1685 |
-
return pattern;
|
1686 |
-
}
|
1687 |
-
}
|
1688 |
-
svg.Element.pattern.prototype = new svg.Element.ElementBase;
|
1689 |
-
|
1690 |
-
// marker element
|
1691 |
-
svg.Element.marker = function(node) {
|
1692 |
-
this.base = svg.Element.ElementBase;
|
1693 |
-
this.base(node);
|
1694 |
-
|
1695 |
-
this.baseRender = this.render;
|
1696 |
-
this.render = function(ctx, point, angle) {
|
1697 |
-
ctx.translate(point.x, point.y);
|
1698 |
-
if (this.attribute('orient').valueOrDefault('auto') == 'auto') ctx.rotate(angle);
|
1699 |
-
if (this.attribute('markerUnits').valueOrDefault('strokeWidth') == 'strokeWidth') ctx.scale(ctx.lineWidth, ctx.lineWidth);
|
1700 |
-
ctx.save();
|
1701 |
-
|
1702 |
-
// render me using a temporary svg element
|
1703 |
-
var tempSvg = new svg.Element.svg();
|
1704 |
-
tempSvg.attributes['viewBox'] = new svg.Property('viewBox', this.attribute('viewBox').value);
|
1705 |
-
tempSvg.attributes['refX'] = new svg.Property('refX', this.attribute('refX').value);
|
1706 |
-
tempSvg.attributes['refY'] = new svg.Property('refY', this.attribute('refY').value);
|
1707 |
-
tempSvg.attributes['width'] = new svg.Property('width', this.attribute('markerWidth').value);
|
1708 |
-
tempSvg.attributes['height'] = new svg.Property('height', this.attribute('markerHeight').value);
|
1709 |
-
tempSvg.attributes['fill'] = new svg.Property('fill', this.attribute('fill').valueOrDefault('black'));
|
1710 |
-
tempSvg.attributes['stroke'] = new svg.Property('stroke', this.attribute('stroke').valueOrDefault('none'));
|
1711 |
-
tempSvg.children = this.children;
|
1712 |
-
tempSvg.render(ctx);
|
1713 |
-
|
1714 |
-
ctx.restore();
|
1715 |
-
if (this.attribute('markerUnits').valueOrDefault('strokeWidth') == 'strokeWidth') ctx.scale(1/ctx.lineWidth, 1/ctx.lineWidth);
|
1716 |
-
if (this.attribute('orient').valueOrDefault('auto') == 'auto') ctx.rotate(-angle);
|
1717 |
-
ctx.translate(-point.x, -point.y);
|
1718 |
-
}
|
1719 |
-
}
|
1720 |
-
svg.Element.marker.prototype = new svg.Element.ElementBase;
|
1721 |
-
|
1722 |
-
// definitions element
|
1723 |
-
svg.Element.defs = function(node) {
|
1724 |
-
this.base = svg.Element.ElementBase;
|
1725 |
-
this.base(node);
|
1726 |
-
|
1727 |
-
this.render = function(ctx) {
|
1728 |
-
// NOOP
|
1729 |
-
}
|
1730 |
-
}
|
1731 |
-
svg.Element.defs.prototype = new svg.Element.ElementBase;
|
1732 |
-
|
1733 |
-
// base for gradients
|
1734 |
-
svg.Element.GradientBase = function(node) {
|
1735 |
-
this.base = svg.Element.ElementBase;
|
1736 |
-
this.base(node);
|
1737 |
-
|
1738 |
-
this.stops = [];
|
1739 |
-
for (var i=0; i<this.children.length; i++) {
|
1740 |
-
var child = this.children[i];
|
1741 |
-
if (child.type == 'stop') this.stops.push(child);
|
1742 |
-
}
|
1743 |
-
|
1744 |
-
this.getGradient = function() {
|
1745 |
-
// OVERRIDE ME!
|
1746 |
-
}
|
1747 |
-
|
1748 |
-
this.gradientUnits = function () {
|
1749 |
-
return this.attribute('gradientUnits').valueOrDefault('objectBoundingBox');
|
1750 |
-
}
|
1751 |
-
|
1752 |
-
this.attributesToInherit = ['gradientUnits'];
|
1753 |
-
|
1754 |
-
this.inheritStopContainer = function (stopsContainer) {
|
1755 |
-
for (var i=0; i<this.attributesToInherit.length; i++) {
|
1756 |
-
var attributeToInherit = this.attributesToInherit[i];
|
1757 |
-
if (!this.attribute(attributeToInherit).hasValue() && stopsContainer.attribute(attributeToInherit).hasValue()) {
|
1758 |
-
this.attribute(attributeToInherit, true).value = stopsContainer.attribute(attributeToInherit).value;
|
1759 |
-
}
|
1760 |
-
}
|
1761 |
-
}
|
1762 |
-
|
1763 |
-
this.createGradient = function(ctx, element, parentOpacityProp) {
|
1764 |
-
var stopsContainer = this;
|
1765 |
-
if (this.getHrefAttribute().hasValue()) {
|
1766 |
-
stopsContainer = this.getHrefAttribute().getDefinition();
|
1767 |
-
this.inheritStopContainer(stopsContainer);
|
1768 |
-
}
|
1769 |
-
|
1770 |
-
var addParentOpacity = function (color) {
|
1771 |
-
if (parentOpacityProp.hasValue()) {
|
1772 |
-
var p = new svg.Property('color', color);
|
1773 |
-
return p.addOpacity(parentOpacityProp).value;
|
1774 |
-
}
|
1775 |
-
return color;
|
1776 |
-
};
|
1777 |
-
|
1778 |
-
var g = this.getGradient(ctx, element);
|
1779 |
-
if (g == null) return addParentOpacity(stopsContainer.stops[stopsContainer.stops.length - 1].color);
|
1780 |
-
for (var i=0; i<stopsContainer.stops.length; i++) {
|
1781 |
-
g.addColorStop(stopsContainer.stops[i].offset, addParentOpacity(stopsContainer.stops[i].color));
|
1782 |
-
}
|
1783 |
-
|
1784 |
-
if (this.attribute('gradientTransform').hasValue()) {
|
1785 |
-
// render as transformed pattern on temporary canvas
|
1786 |
-
var rootView = svg.ViewPort.viewPorts[0];
|
1787 |
-
|
1788 |
-
var rect = new svg.Element.rect();
|
1789 |
-
rect.attributes['x'] = new svg.Property('x', -svg.MAX_VIRTUAL_PIXELS/3.0);
|
1790 |
-
rect.attributes['y'] = new svg.Property('y', -svg.MAX_VIRTUAL_PIXELS/3.0);
|
1791 |
-
rect.attributes['width'] = new svg.Property('width', svg.MAX_VIRTUAL_PIXELS);
|
1792 |
-
rect.attributes['height'] = new svg.Property('height', svg.MAX_VIRTUAL_PIXELS);
|
1793 |
-
|
1794 |
-
var group = new svg.Element.g();
|
1795 |
-
group.attributes['transform'] = new svg.Property('transform', this.attribute('gradientTransform').value);
|
1796 |
-
group.children = [ rect ];
|
1797 |
-
|
1798 |
-
var tempSvg = new svg.Element.svg();
|
1799 |
-
tempSvg.attributes['x'] = new svg.Property('x', 0);
|
1800 |
-
tempSvg.attributes['y'] = new svg.Property('y', 0);
|
1801 |
-
tempSvg.attributes['width'] = new svg.Property('width', rootView.width);
|
1802 |
-
tempSvg.attributes['height'] = new svg.Property('height', rootView.height);
|
1803 |
-
tempSvg.children = [ group ];
|
1804 |
-
|
1805 |
-
var c = document.createElement('canvas');
|
1806 |
-
c.width = rootView.width;
|
1807 |
-
c.height = rootView.height;
|
1808 |
-
var tempCtx = c.getContext('2d');
|
1809 |
-
tempCtx.fillStyle = g;
|
1810 |
-
tempSvg.render(tempCtx);
|
1811 |
-
return tempCtx.createPattern(c, 'no-repeat');
|
1812 |
-
}
|
1813 |
-
|
1814 |
-
return g;
|
1815 |
-
}
|
1816 |
-
}
|
1817 |
-
svg.Element.GradientBase.prototype = new svg.Element.ElementBase;
|
1818 |
-
|
1819 |
-
// linear gradient element
|
1820 |
-
svg.Element.linearGradient = function(node) {
|
1821 |
-
this.base = svg.Element.GradientBase;
|
1822 |
-
this.base(node);
|
1823 |
-
|
1824 |
-
this.attributesToInherit.push('x1');
|
1825 |
-
this.attributesToInherit.push('y1');
|
1826 |
-
this.attributesToInherit.push('x2');
|
1827 |
-
this.attributesToInherit.push('y2');
|
1828 |
-
|
1829 |
-
this.getGradient = function(ctx, element) {
|
1830 |
-
var bb = this.gradientUnits() == 'objectBoundingBox' ? element.getBoundingBox() : null;
|
1831 |
-
|
1832 |
-
if (!this.attribute('x1').hasValue()
|
1833 |
-
&& !this.attribute('y1').hasValue()
|
1834 |
-
&& !this.attribute('x2').hasValue()
|
1835 |
-
&& !this.attribute('y2').hasValue()) {
|
1836 |
-
this.attribute('x1', true).value = 0;
|
1837 |
-
this.attribute('y1', true).value = 0;
|
1838 |
-
this.attribute('x2', true).value = 1;
|
1839 |
-
this.attribute('y2', true).value = 0;
|
1840 |
-
}
|
1841 |
-
|
1842 |
-
var x1 = (this.gradientUnits() == 'objectBoundingBox'
|
1843 |
-
? bb.x() + bb.width() * this.attribute('x1').numValue()
|
1844 |
-
: this.attribute('x1').toPixels('x'));
|
1845 |
-
var y1 = (this.gradientUnits() == 'objectBoundingBox'
|
1846 |
-
? bb.y() + bb.height() * this.attribute('y1').numValue()
|
1847 |
-
: this.attribute('y1').toPixels('y'));
|
1848 |
-
var x2 = (this.gradientUnits() == 'objectBoundingBox'
|
1849 |
-
? bb.x() + bb.width() * this.attribute('x2').numValue()
|
1850 |
-
: this.attribute('x2').toPixels('x'));
|
1851 |
-
var y2 = (this.gradientUnits() == 'objectBoundingBox'
|
1852 |
-
? bb.y() + bb.height() * this.attribute('y2').numValue()
|
1853 |
-
: this.attribute('y2').toPixels('y'));
|
1854 |
-
|
1855 |
-
if (x1 == x2 && y1 == y2) return null;
|
1856 |
-
return ctx.createLinearGradient(x1, y1, x2, y2);
|
1857 |
-
}
|
1858 |
-
}
|
1859 |
-
svg.Element.linearGradient.prototype = new svg.Element.GradientBase;
|
1860 |
-
|
1861 |
-
// radial gradient element
|
1862 |
-
svg.Element.radialGradient = function(node) {
|
1863 |
-
this.base = svg.Element.GradientBase;
|
1864 |
-
this.base(node);
|
1865 |
-
|
1866 |
-
this.attributesToInherit.push('cx');
|
1867 |
-
this.attributesToInherit.push('cy');
|
1868 |
-
this.attributesToInherit.push('r');
|
1869 |
-
this.attributesToInherit.push('fx');
|
1870 |
-
this.attributesToInherit.push('fy');
|
1871 |
-
|
1872 |
-
this.getGradient = function(ctx, element) {
|
1873 |
-
var bb = element.getBoundingBox();
|
1874 |
-
|
1875 |
-
if (!this.attribute('cx').hasValue()) this.attribute('cx', true).value = '50%';
|
1876 |
-
if (!this.attribute('cy').hasValue()) this.attribute('cy', true).value = '50%';
|
1877 |
-
if (!this.attribute('r').hasValue()) this.attribute('r', true).value = '50%';
|
1878 |
-
|
1879 |
-
var cx = (this.gradientUnits() == 'objectBoundingBox'
|
1880 |
-
? bb.x() + bb.width() * this.attribute('cx').numValue()
|
1881 |
-
: this.attribute('cx').toPixels('x'));
|
1882 |
-
var cy = (this.gradientUnits() == 'objectBoundingBox'
|
1883 |
-
? bb.y() + bb.height() * this.attribute('cy').numValue()
|
1884 |
-
: this.attribute('cy').toPixels('y'));
|
1885 |
-
|
1886 |
-
var fx = cx;
|
1887 |
-
var fy = cy;
|
1888 |
-
if (this.attribute('fx').hasValue()) {
|
1889 |
-
fx = (this.gradientUnits() == 'objectBoundingBox'
|
1890 |
-
? bb.x() + bb.width() * this.attribute('fx').numValue()
|
1891 |
-
: this.attribute('fx').toPixels('x'));
|
1892 |
-
}
|
1893 |
-
if (this.attribute('fy').hasValue()) {
|
1894 |
-
fy = (this.gradientUnits() == 'objectBoundingBox'
|
1895 |
-
? bb.y() + bb.height() * this.attribute('fy').numValue()
|
1896 |
-
: this.attribute('fy').toPixels('y'));
|
1897 |
-
}
|
1898 |
-
|
1899 |
-
var r = (this.gradientUnits() == 'objectBoundingBox'
|
1900 |
-
? (bb.width() + bb.height()) / 2.0 * this.attribute('r').numValue()
|
1901 |
-
: this.attribute('r').toPixels());
|
1902 |
-
|
1903 |
-
return ctx.createRadialGradient(fx, fy, 0, cx, cy, r);
|
1904 |
-
}
|
1905 |
-
}
|
1906 |
-
svg.Element.radialGradient.prototype = new svg.Element.GradientBase;
|
1907 |
-
|
1908 |
-
// gradient stop element
|
1909 |
-
svg.Element.stop = function(node) {
|
1910 |
-
this.base = svg.Element.ElementBase;
|
1911 |
-
this.base(node);
|
1912 |
-
|
1913 |
-
this.offset = this.attribute('offset').numValue();
|
1914 |
-
if (this.offset < 0) this.offset = 0;
|
1915 |
-
if (this.offset > 1) this.offset = 1;
|
1916 |
-
|
1917 |
-
var stopColor = this.style('stop-color', true);
|
1918 |
-
if (stopColor.value === '') stopColor.value = '#000';
|
1919 |
-
if (this.style('stop-opacity').hasValue()) stopColor = stopColor.addOpacity(this.style('stop-opacity'));
|
1920 |
-
this.color = stopColor.value;
|
1921 |
-
}
|
1922 |
-
svg.Element.stop.prototype = new svg.Element.ElementBase;
|
1923 |
-
|
1924 |
-
// animation base element
|
1925 |
-
svg.Element.AnimateBase = function(node) {
|
1926 |
-
this.base = svg.Element.ElementBase;
|
1927 |
-
this.base(node);
|
1928 |
-
|
1929 |
-
svg.Animations.push(this);
|
1930 |
-
|
1931 |
-
this.duration = 0.0;
|
1932 |
-
this.begin = this.attribute('begin').toMilliseconds();
|
1933 |
-
this.maxDuration = this.begin + this.attribute('dur').toMilliseconds();
|
1934 |
-
|
1935 |
-
this.getProperty = function() {
|
1936 |
-
var attributeType = this.attribute('attributeType').value;
|
1937 |
-
var attributeName = this.attribute('attributeName').value;
|
1938 |
-
|
1939 |
-
if (attributeType == 'CSS') {
|
1940 |
-
return this.parent.style(attributeName, true);
|
1941 |
-
}
|
1942 |
-
return this.parent.attribute(attributeName, true);
|
1943 |
-
};
|
1944 |
-
|
1945 |
-
this.initialValue = null;
|
1946 |
-
this.initialUnits = '';
|
1947 |
-
this.removed = false;
|
1948 |
-
|
1949 |
-
this.calcValue = function() {
|
1950 |
-
// OVERRIDE ME!
|
1951 |
-
return '';
|
1952 |
-
}
|
1953 |
-
|
1954 |
-
this.update = function(delta) {
|
1955 |
-
// set initial value
|
1956 |
-
if (this.initialValue == null) {
|
1957 |
-
this.initialValue = this.getProperty().value;
|
1958 |
-
this.initialUnits = this.getProperty().getUnits();
|
1959 |
-
}
|
1960 |
-
|
1961 |
-
// if we're past the end time
|
1962 |
-
if (this.duration > this.maxDuration) {
|
1963 |
-
// loop for indefinitely repeating animations
|
1964 |
-
if (this.attribute('repeatCount').value == 'indefinite'
|
1965 |
-
|| this.attribute('repeatDur').value == 'indefinite') {
|
1966 |
-
this.duration = 0.0
|
1967 |
-
}
|
1968 |
-
else if (this.attribute('fill').valueOrDefault('remove') == 'freeze' && !this.frozen) {
|
1969 |
-
this.frozen = true;
|
1970 |
-
this.parent.animationFrozen = true;
|
1971 |
-
this.parent.animationFrozenValue = this.getProperty().value;
|
1972 |
-
}
|
1973 |
-
else if (this.attribute('fill').valueOrDefault('remove') == 'remove' && !this.removed) {
|
1974 |
-
this.removed = true;
|
1975 |
-
this.getProperty().value = this.parent.animationFrozen ? this.parent.animationFrozenValue : this.initialValue;
|
1976 |
-
return true;
|
1977 |
-
}
|
1978 |
-
return false;
|
1979 |
-
}
|
1980 |
-
this.duration = this.duration + delta;
|
1981 |
-
|
1982 |
-
// if we're past the begin time
|
1983 |
-
var updated = false;
|
1984 |
-
if (this.begin < this.duration) {
|
1985 |
-
var newValue = this.calcValue(); // tween
|
1986 |
-
|
1987 |
-
if (this.attribute('type').hasValue()) {
|
1988 |
-
// for transform, etc.
|
1989 |
-
var type = this.attribute('type').value;
|
1990 |
-
newValue = type + '(' + newValue + ')';
|
1991 |
-
}
|
1992 |
-
|
1993 |
-
this.getProperty().value = newValue;
|
1994 |
-
updated = true;
|
1995 |
-
}
|
1996 |
-
|
1997 |
-
return updated;
|
1998 |
-
}
|
1999 |
-
|
2000 |
-
this.from = this.attribute('from');
|
2001 |
-
this.to = this.attribute('to');
|
2002 |
-
this.values = this.attribute('values');
|
2003 |
-
if (this.values.hasValue()) this.values.value = this.values.value.split(';');
|
2004 |
-
|
2005 |
-
// fraction of duration we've covered
|
2006 |
-
this.progress = function() {
|
2007 |
-
var ret = { progress: (this.duration - this.begin) / (this.maxDuration - this.begin) };
|
2008 |
-
if (this.values.hasValue()) {
|
2009 |
-
var p = ret.progress * (this.values.value.length - 1);
|
2010 |
-
var lb = Math.floor(p), ub = Math.ceil(p);
|
2011 |
-
ret.from = new svg.Property('from', parseFloat(this.values.value[lb]));
|
2012 |
-
ret.to = new svg.Property('to', parseFloat(this.values.value[ub]));
|
2013 |
-
ret.progress = (p - lb) / (ub - lb);
|
2014 |
-
}
|
2015 |
-
else {
|
2016 |
-
ret.from = this.from;
|
2017 |
-
ret.to = this.to;
|
2018 |
-
}
|
2019 |
-
return ret;
|
2020 |
-
}
|
2021 |
-
}
|
2022 |
-
svg.Element.AnimateBase.prototype = new svg.Element.ElementBase;
|
2023 |
-
|
2024 |
-
// animate element
|
2025 |
-
svg.Element.animate = function(node) {
|
2026 |
-
this.base = svg.Element.AnimateBase;
|
2027 |
-
this.base(node);
|
2028 |
-
|
2029 |
-
this.calcValue = function() {
|
2030 |
-
var p = this.progress();
|
2031 |
-
|
2032 |
-
// tween value linearly
|
2033 |
-
var newValue = p.from.numValue() + (p.to.numValue() - p.from.numValue()) * p.progress;
|
2034 |
-
return newValue + this.initialUnits;
|
2035 |
-
};
|
2036 |
-
}
|
2037 |
-
svg.Element.animate.prototype = new svg.Element.AnimateBase;
|
2038 |
-
|
2039 |
-
// animate color element
|
2040 |
-
svg.Element.animateColor = function(node) {
|
2041 |
-
this.base = svg.Element.AnimateBase;
|
2042 |
-
this.base(node);
|
2043 |
-
|
2044 |
-
this.calcValue = function() {
|
2045 |
-
var p = this.progress();
|
2046 |
-
var from = new RGBColor(p.from.value);
|
2047 |
-
var to = new RGBColor(p.to.value);
|
2048 |
-
|
2049 |
-
if (from.ok && to.ok) {
|
2050 |
-
// tween color linearly
|
2051 |
-
var r = from.r + (to.r - from.r) * p.progress;
|
2052 |
-
var g = from.g + (to.g - from.g) * p.progress;
|
2053 |
-
var b = from.b + (to.b - from.b) * p.progress;
|
2054 |
-
return 'rgb('+parseInt(r,10)+','+parseInt(g,10)+','+parseInt(b,10)+')';
|
2055 |
-
}
|
2056 |
-
return this.attribute('from').value;
|
2057 |
-
};
|
2058 |
-
}
|
2059 |
-
svg.Element.animateColor.prototype = new svg.Element.AnimateBase;
|
2060 |
-
|
2061 |
-
// animate transform element
|
2062 |
-
svg.Element.animateTransform = function(node) {
|
2063 |
-
this.base = svg.Element.AnimateBase;
|
2064 |
-
this.base(node);
|
2065 |
-
|
2066 |
-
this.calcValue = function() {
|
2067 |
-
var p = this.progress();
|
2068 |
-
|
2069 |
-
// tween value linearly
|
2070 |
-
var from = svg.ToNumberArray(p.from.value);
|
2071 |
-
var to = svg.ToNumberArray(p.to.value);
|
2072 |
-
var newValue = '';
|
2073 |
-
for (var i=0; i<from.length; i++) {
|
2074 |
-
newValue += from[i] + (to[i] - from[i]) * p.progress + ' ';
|
2075 |
-
}
|
2076 |
-
return newValue;
|
2077 |
-
};
|
2078 |
-
}
|
2079 |
-
svg.Element.animateTransform.prototype = new svg.Element.animate;
|
2080 |
-
|
2081 |
-
// font element
|
2082 |
-
svg.Element.font = function(node) {
|
2083 |
-
this.base = svg.Element.ElementBase;
|
2084 |
-
this.base(node);
|
2085 |
-
|
2086 |
-
this.horizAdvX = this.attribute('horiz-adv-x').numValue();
|
2087 |
-
|
2088 |
-
this.isRTL = false;
|
2089 |
-
this.isArabic = false;
|
2090 |
-
this.fontFace = null;
|
2091 |
-
this.missingGlyph = null;
|
2092 |
-
this.glyphs = [];
|
2093 |
-
for (var i=0; i<this.children.length; i++) {
|
2094 |
-
var child = this.children[i];
|
2095 |
-
if (child.type == 'font-face') {
|
2096 |
-
this.fontFace = child;
|
2097 |
-
if (child.style('font-family').hasValue()) {
|
2098 |
-
svg.Definitions[child.style('font-family').value] = this;
|
2099 |
-
}
|
2100 |
-
}
|
2101 |
-
else if (child.type == 'missing-glyph') this.missingGlyph = child;
|
2102 |
-
else if (child.type == 'glyph') {
|
2103 |
-
if (child.arabicForm != '') {
|
2104 |
-
this.isRTL = true;
|
2105 |
-
this.isArabic = true;
|
2106 |
-
if (typeof this.glyphs[child.unicode] == 'undefined') this.glyphs[child.unicode] = [];
|
2107 |
-
this.glyphs[child.unicode][child.arabicForm] = child;
|
2108 |
-
}
|
2109 |
-
else {
|
2110 |
-
this.glyphs[child.unicode] = child;
|
2111 |
-
}
|
2112 |
-
}
|
2113 |
-
}
|
2114 |
-
}
|
2115 |
-
svg.Element.font.prototype = new svg.Element.ElementBase;
|
2116 |
-
|
2117 |
-
// font-face element
|
2118 |
-
svg.Element.fontface = function(node) {
|
2119 |
-
this.base = svg.Element.ElementBase;
|
2120 |
-
this.base(node);
|
2121 |
-
|
2122 |
-
this.ascent = this.attribute('ascent').value;
|
2123 |
-
this.descent = this.attribute('descent').value;
|
2124 |
-
this.unitsPerEm = this.attribute('units-per-em').numValue();
|
2125 |
-
}
|
2126 |
-
svg.Element.fontface.prototype = new svg.Element.ElementBase;
|
2127 |
-
|
2128 |
-
// missing-glyph element
|
2129 |
-
svg.Element.missingglyph = function(node) {
|
2130 |
-
this.base = svg.Element.path;
|
2131 |
-
this.base(node);
|
2132 |
-
|
2133 |
-
this.horizAdvX = 0;
|
2134 |
-
}
|
2135 |
-
svg.Element.missingglyph.prototype = new svg.Element.path;
|
2136 |
-
|
2137 |
-
// glyph element
|
2138 |
-
svg.Element.glyph = function(node) {
|
2139 |
-
this.base = svg.Element.path;
|
2140 |
-
this.base(node);
|
2141 |
-
|
2142 |
-
this.horizAdvX = this.attribute('horiz-adv-x').numValue();
|
2143 |
-
this.unicode = this.attribute('unicode').value;
|
2144 |
-
this.arabicForm = this.attribute('arabic-form').value;
|
2145 |
-
}
|
2146 |
-
svg.Element.glyph.prototype = new svg.Element.path;
|
2147 |
-
|
2148 |
-
// text element
|
2149 |
-
svg.Element.text = function(node) {
|
2150 |
-
this.captureTextNodes = true;
|
2151 |
-
this.base = svg.Element.RenderedElementBase;
|
2152 |
-
this.base(node);
|
2153 |
-
|
2154 |
-
this.baseSetContext = this.setContext;
|
2155 |
-
this.setContext = function(ctx) {
|
2156 |
-
this.baseSetContext(ctx);
|
2157 |
-
|
2158 |
-
var textBaseline = this.style('dominant-baseline').toTextBaseline();
|
2159 |
-
if (textBaseline == null) textBaseline = this.style('alignment-baseline').toTextBaseline();
|
2160 |
-
if (textBaseline != null) ctx.textBaseline = textBaseline;
|
2161 |
-
}
|
2162 |
-
|
2163 |
-
this.getBoundingBox = function () {
|
2164 |
-
var x = this.attribute('x').toPixels('x');
|
2165 |
-
var y = this.attribute('y').toPixels('y');
|
2166 |
-
var fontSize = this.parent.style('font-size').numValueOrDefault(svg.Font.Parse(svg.ctx.font).fontSize);
|
2167 |
-
return new svg.BoundingBox(x, y - fontSize, x + Math.floor(fontSize * 2.0 / 3.0) * this.children[0].getText().length, y);
|
2168 |
-
}
|
2169 |
-
|
2170 |
-
this.renderChildren = function(ctx) {
|
2171 |
-
this.x = this.attribute('x').toPixels('x');
|
2172 |
-
this.y = this.attribute('y').toPixels('y');
|
2173 |
-
if (this.attribute('dx').hasValue()) this.x += this.attribute('dx').toPixels('x');
|
2174 |
-
if (this.attribute('dy').hasValue()) this.y += this.attribute('dy').toPixels('y');
|
2175 |
-
this.x += this.getAnchorDelta(ctx, this, 0);
|
2176 |
-
for (var i=0; i<this.children.length; i++) {
|
2177 |
-
this.renderChild(ctx, this, this, i);
|
2178 |
-
}
|
2179 |
-
}
|
2180 |
-
|
2181 |
-
this.getAnchorDelta = function (ctx, parent, startI) {
|
2182 |
-
var textAnchor = this.style('text-anchor').valueOrDefault('start');
|
2183 |
-
if (textAnchor != 'start') {
|
2184 |
-
var width = 0;
|
2185 |
-
for (var i=startI; i<parent.children.length; i++) {
|
2186 |
-
var child = parent.children[i];
|
2187 |
-
if (i > startI && child.attribute('x').hasValue()) break; // new group
|
2188 |
-
width += child.measureTextRecursive(ctx);
|
2189 |
-
}
|
2190 |
-
return -1 * (textAnchor == 'end' ? width : width / 2.0);
|
2191 |
-
}
|
2192 |
-
return 0;
|
2193 |
-
}
|
2194 |
-
|
2195 |
-
this.renderChild = function(ctx, textParent, parent, i) {
|
2196 |
-
var child = parent.children[i];
|
2197 |
-
if (child.attribute('x').hasValue()) {
|
2198 |
-
child.x = child.attribute('x').toPixels('x') + textParent.getAnchorDelta(ctx, parent, i);
|
2199 |
-
if (child.attribute('dx').hasValue()) child.x += child.attribute('dx').toPixels('x');
|
2200 |
-
}
|
2201 |
-
else {
|
2202 |
-
if (child.attribute('dx').hasValue()) textParent.x += child.attribute('dx').toPixels('x');
|
2203 |
-
child.x = textParent.x;
|
2204 |
-
}
|
2205 |
-
textParent.x = child.x + child.measureText(ctx);
|
2206 |
-
|
2207 |
-
if (child.attribute('y').hasValue()) {
|
2208 |
-
child.y = child.attribute('y').toPixels('y');
|
2209 |
-
if (child.attribute('dy').hasValue()) child.y += child.attribute('dy').toPixels('y');
|
2210 |
-
}
|
2211 |
-
else {
|
2212 |
-
if (child.attribute('dy').hasValue()) textParent.y += child.attribute('dy').toPixels('y');
|
2213 |
-
child.y = textParent.y;
|
2214 |
-
}
|
2215 |
-
textParent.y = child.y;
|
2216 |
-
|
2217 |
-
child.render(ctx);
|
2218 |
-
|
2219 |
-
for (var i=0; i<child.children.length; i++) {
|
2220 |
-
textParent.renderChild(ctx, textParent, child, i);
|
2221 |
-
}
|
2222 |
-
}
|
2223 |
-
}
|
2224 |
-
svg.Element.text.prototype = new svg.Element.RenderedElementBase;
|
2225 |
-
|
2226 |
-
// text base
|
2227 |
-
svg.Element.TextElementBase = function(node) {
|
2228 |
-
this.base = svg.Element.RenderedElementBase;
|
2229 |
-
this.base(node);
|
2230 |
-
|
2231 |
-
this.getGlyph = function(font, text, i) {
|
2232 |
-
var c = text[i];
|
2233 |
-
var glyph = null;
|
2234 |
-
if (font.isArabic) {
|
2235 |
-
var arabicForm = 'isolated';
|
2236 |
-
if ((i==0 || text[i-1]==' ') && i<text.length-2 && text[i+1]!=' ') arabicForm = 'terminal';
|
2237 |
-
if (i>0 && text[i-1]!=' ' && i<text.length-2 && text[i+1]!=' ') arabicForm = 'medial';
|
2238 |
-
if (i>0 && text[i-1]!=' ' && (i == text.length-1 || text[i+1]==' ')) arabicForm = 'initial';
|
2239 |
-
if (typeof font.glyphs[c] != 'undefined') {
|
2240 |
-
glyph = font.glyphs[c][arabicForm];
|
2241 |
-
if (glyph == null && font.glyphs[c].type == 'glyph') glyph = font.glyphs[c];
|
2242 |
-
}
|
2243 |
-
}
|
2244 |
-
else {
|
2245 |
-
glyph = font.glyphs[c];
|
2246 |
-
}
|
2247 |
-
if (glyph == null) glyph = font.missingGlyph;
|
2248 |
-
return glyph;
|
2249 |
-
}
|
2250 |
-
|
2251 |
-
this.renderChildren = function(ctx) {
|
2252 |
-
var customFont = this.parent.style('font-family').getDefinition();
|
2253 |
-
if (customFont != null) {
|
2254 |
-
var fontSize = this.parent.style('font-size').numValueOrDefault(svg.Font.Parse(svg.ctx.font).fontSize);
|
2255 |
-
var fontStyle = this.parent.style('font-style').valueOrDefault(svg.Font.Parse(svg.ctx.font).fontStyle);
|
2256 |
-
var text = this.getText();
|
2257 |
-
if (customFont.isRTL) text = text.split("").reverse().join("");
|
2258 |
-
|
2259 |
-
var dx = svg.ToNumberArray(this.parent.attribute('dx').value);
|
2260 |
-
for (var i=0; i<text.length; i++) {
|
2261 |
-
var glyph = this.getGlyph(customFont, text, i);
|
2262 |
-
var scale = fontSize / customFont.fontFace.unitsPerEm;
|
2263 |
-
ctx.translate(this.x, this.y);
|
2264 |
-
ctx.scale(scale, -scale);
|
2265 |
-
var lw = ctx.lineWidth;
|
2266 |
-
ctx.lineWidth = ctx.lineWidth * customFont.fontFace.unitsPerEm / fontSize;
|
2267 |
-
if (fontStyle == 'italic') ctx.transform(1, 0, .4, 1, 0, 0);
|
2268 |
-
glyph.render(ctx);
|
2269 |
-
if (fontStyle == 'italic') ctx.transform(1, 0, -.4, 1, 0, 0);
|
2270 |
-
ctx.lineWidth = lw;
|
2271 |
-
ctx.scale(1/scale, -1/scale);
|
2272 |
-
ctx.translate(-this.x, -this.y);
|
2273 |
-
|
2274 |
-
this.x += fontSize * (glyph.horizAdvX || customFont.horizAdvX) / customFont.fontFace.unitsPerEm;
|
2275 |
-
if (typeof dx[i] != 'undefined' && !isNaN(dx[i])) {
|
2276 |
-
this.x += dx[i];
|
2277 |
-
}
|
2278 |
-
}
|
2279 |
-
return;
|
2280 |
-
}
|
2281 |
-
|
2282 |
-
if (ctx.fillStyle != '') ctx.fillText(svg.compressSpaces(this.getText()), this.x, this.y);
|
2283 |
-
if (ctx.strokeStyle != '') ctx.strokeText(svg.compressSpaces(this.getText()), this.x, this.y);
|
2284 |
-
}
|
2285 |
-
|
2286 |
-
this.getText = function() {
|
2287 |
-
// OVERRIDE ME
|
2288 |
-
}
|
2289 |
-
|
2290 |
-
this.measureTextRecursive = function(ctx) {
|
2291 |
-
var width = this.measureText(ctx);
|
2292 |
-
for (var i=0; i<this.children.length; i++) {
|
2293 |
-
width += this.children[i].measureTextRecursive(ctx);
|
2294 |
-
}
|
2295 |
-
return width;
|
2296 |
-
}
|
2297 |
-
|
2298 |
-
this.measureText = function(ctx) {
|
2299 |
-
var customFont = this.parent.style('font-family').getDefinition();
|
2300 |
-
if (customFont != null) {
|
2301 |
-
var fontSize = this.parent.style('font-size').numValueOrDefault(svg.Font.Parse(svg.ctx.font).fontSize);
|
2302 |
-
var measure = 0;
|
2303 |
-
var text = this.getText();
|
2304 |
-
if (customFont.isRTL) text = text.split("").reverse().join("");
|
2305 |
-
var dx = svg.ToNumberArray(this.parent.attribute('dx').value);
|
2306 |
-
for (var i=0; i<text.length; i++) {
|
2307 |
-
var glyph = this.getGlyph(customFont, text, i);
|
2308 |
-
measure += (glyph.horizAdvX || customFont.horizAdvX) * fontSize / customFont.fontFace.unitsPerEm;
|
2309 |
-
if (typeof dx[i] != 'undefined' && !isNaN(dx[i])) {
|
2310 |
-
measure += dx[i];
|
2311 |
-
}
|
2312 |
-
}
|
2313 |
-
return measure;
|
2314 |
-
}
|
2315 |
-
|
2316 |
-
var textToMeasure = svg.compressSpaces(this.getText());
|
2317 |
-
if (!ctx.measureText) return textToMeasure.length * 10;
|
2318 |
-
|
2319 |
-
ctx.save();
|
2320 |
-
this.setContext(ctx);
|
2321 |
-
var width = ctx.measureText(textToMeasure).width;
|
2322 |
-
ctx.restore();
|
2323 |
-
return width;
|
2324 |
-
}
|
2325 |
-
}
|
2326 |
-
svg.Element.TextElementBase.prototype = new svg.Element.RenderedElementBase;
|
2327 |
-
|
2328 |
-
// tspan
|
2329 |
-
svg.Element.tspan = function(node) {
|
2330 |
-
this.captureTextNodes = true;
|
2331 |
-
this.base = svg.Element.TextElementBase;
|
2332 |
-
this.base(node);
|
2333 |
-
|
2334 |
-
this.text = svg.compressSpaces(node.value || node.text || node.textContent || '');
|
2335 |
-
this.getText = function() {
|
2336 |
-
// if this node has children, then they own the text
|
2337 |
-
if (this.children.length > 0) { return ''; }
|
2338 |
-
return this.text;
|
2339 |
-
}
|
2340 |
-
}
|
2341 |
-
svg.Element.tspan.prototype = new svg.Element.TextElementBase;
|
2342 |
-
|
2343 |
-
// tref
|
2344 |
-
svg.Element.tref = function(node) {
|
2345 |
-
this.base = svg.Element.TextElementBase;
|
2346 |
-
this.base(node);
|
2347 |
-
|
2348 |
-
this.getText = function() {
|
2349 |
-
var element = this.getHrefAttribute().getDefinition();
|
2350 |
-
if (element != null) return element.children[0].getText();
|
2351 |
-
}
|
2352 |
-
}
|
2353 |
-
svg.Element.tref.prototype = new svg.Element.TextElementBase;
|
2354 |
-
|
2355 |
-
// a element
|
2356 |
-
svg.Element.a = function(node) {
|
2357 |
-
this.base = svg.Element.TextElementBase;
|
2358 |
-
this.base(node);
|
2359 |
-
|
2360 |
-
this.hasText = node.childNodes.length > 0;
|
2361 |
-
for (var i=0; i<node.childNodes.length; i++) {
|
2362 |
-
if (node.childNodes[i].nodeType != 3) this.hasText = false;
|
2363 |
-
}
|
2364 |
-
|
2365 |
-
// this might contain text
|
2366 |
-
this.text = this.hasText ? node.childNodes[0].value : '';
|
2367 |
-
this.getText = function() {
|
2368 |
-
return this.text;
|
2369 |
-
}
|
2370 |
-
|
2371 |
-
this.baseRenderChildren = this.renderChildren;
|
2372 |
-
this.renderChildren = function(ctx) {
|
2373 |
-
if (this.hasText) {
|
2374 |
-
// render as text element
|
2375 |
-
this.baseRenderChildren(ctx);
|
2376 |
-
var fontSize = new svg.Property('fontSize', svg.Font.Parse(svg.ctx.font).fontSize);
|
2377 |
-
svg.Mouse.checkBoundingBox(this, new svg.BoundingBox(this.x, this.y - fontSize.toPixels('y'), this.x + this.measureText(ctx), this.y));
|
2378 |
-
}
|
2379 |
-
else if (this.children.length > 0) {
|
2380 |
-
// render as temporary group
|
2381 |
-
var g = new svg.Element.g();
|
2382 |
-
g.children = this.children;
|
2383 |
-
g.parent = this;
|
2384 |
-
g.render(ctx);
|
2385 |
-
}
|
2386 |
-
}
|
2387 |
-
|
2388 |
-
this.onclick = function() {
|
2389 |
-
window.open(this.getHrefAttribute().value);
|
2390 |
-
}
|
2391 |
-
|
2392 |
-
this.onmousemove = function() {
|
2393 |
-
svg.ctx.canvas.style.cursor = 'pointer';
|
2394 |
-
}
|
2395 |
-
}
|
2396 |
-
svg.Element.a.prototype = new svg.Element.TextElementBase;
|
2397 |
-
|
2398 |
-
// image element
|
2399 |
-
svg.Element.image = function(node) {
|
2400 |
-
this.base = svg.Element.RenderedElementBase;
|
2401 |
-
this.base(node);
|
2402 |
-
|
2403 |
-
var href = this.getHrefAttribute().value;
|
2404 |
-
if (href == '') { return; }
|
2405 |
-
var isSvg = href.match(/\.svg$/)
|
2406 |
-
|
2407 |
-
svg.Images.push(this);
|
2408 |
-
this.loaded = false;
|
2409 |
-
if (!isSvg) {
|
2410 |
-
this.img = document.createElement('img');
|
2411 |
-
if (svg.opts['useCORS'] == true) { this.img.crossOrigin = 'Anonymous'; }
|
2412 |
-
var self = this;
|
2413 |
-
this.img.onload = function() { self.loaded = true; }
|
2414 |
-
this.img.onerror = function() { svg.log('ERROR: image "' + href + '" not found'); self.loaded = true; }
|
2415 |
-
this.img.src = href;
|
2416 |
-
}
|
2417 |
-
else {
|
2418 |
-
this.img = svg.ajax(href);
|
2419 |
-
this.loaded = true;
|
2420 |
-
}
|
2421 |
-
|
2422 |
-
this.renderChildren = function(ctx) {
|
2423 |
-
var x = this.attribute('x').toPixels('x');
|
2424 |
-
var y = this.attribute('y').toPixels('y');
|
2425 |
-
|
2426 |
-
var width = this.attribute('width').toPixels('x');
|
2427 |
-
var height = this.attribute('height').toPixels('y');
|
2428 |
-
if (width == 0 || height == 0) return;
|
2429 |
-
|
2430 |
-
ctx.save();
|
2431 |
-
if (isSvg) {
|
2432 |
-
ctx.drawSvg(this.img, x, y, width, height);
|
2433 |
-
}
|
2434 |
-
else {
|
2435 |
-
ctx.translate(x, y);
|
2436 |
-
svg.AspectRatio(ctx,
|
2437 |
-
this.attribute('preserveAspectRatio').value,
|
2438 |
-
width,
|
2439 |
-
this.img.width,
|
2440 |
-
height,
|
2441 |
-
this.img.height,
|
2442 |
-
0,
|
2443 |
-
0);
|
2444 |
-
ctx.drawImage(this.img, 0, 0);
|
2445 |
-
}
|
2446 |
-
ctx.restore();
|
2447 |
-
}
|
2448 |
-
|
2449 |
-
this.getBoundingBox = function() {
|
2450 |
-
var x = this.attribute('x').toPixels('x');
|
2451 |
-
var y = this.attribute('y').toPixels('y');
|
2452 |
-
var width = this.attribute('width').toPixels('x');
|
2453 |
-
var height = this.attribute('height').toPixels('y');
|
2454 |
-
return new svg.BoundingBox(x, y, x + width, y + height);
|
2455 |
-
}
|
2456 |
-
}
|
2457 |
-
svg.Element.image.prototype = new svg.Element.RenderedElementBase;
|
2458 |
-
|
2459 |
-
// group element
|
2460 |
-
svg.Element.g = function(node) {
|
2461 |
-
this.base = svg.Element.RenderedElementBase;
|
2462 |
-
this.base(node);
|
2463 |
-
|
2464 |
-
this.getBoundingBox = function() {
|
2465 |
-
var bb = new svg.BoundingBox();
|
2466 |
-
for (var i=0; i<this.children.length; i++) {
|
2467 |
-
bb.addBoundingBox(this.children[i].getBoundingBox());
|
2468 |
-
}
|
2469 |
-
return bb;
|
2470 |
-
};
|
2471 |
-
}
|
2472 |
-
svg.Element.g.prototype = new svg.Element.RenderedElementBase;
|
2473 |
-
|
2474 |
-
// symbol element
|
2475 |
-
svg.Element.symbol = function(node) {
|
2476 |
-
this.base = svg.Element.RenderedElementBase;
|
2477 |
-
this.base(node);
|
2478 |
-
|
2479 |
-
this.render = function(ctx) {
|
2480 |
-
// NO RENDER
|
2481 |
-
};
|
2482 |
-
}
|
2483 |
-
svg.Element.symbol.prototype = new svg.Element.RenderedElementBase;
|
2484 |
-
|
2485 |
-
// style element
|
2486 |
-
svg.Element.style = function(node) {
|
2487 |
-
this.base = svg.Element.ElementBase;
|
2488 |
-
this.base(node);
|
2489 |
-
|
2490 |
-
// text, or spaces then CDATA
|
2491 |
-
var css = ''
|
2492 |
-
for (var i=0; i<node.childNodes.length; i++) {
|
2493 |
-
css += node.childNodes[i].data;
|
2494 |
-
}
|
2495 |
-
css = css.replace(/(\/\*([^*]|[\r\n]|(\*+([^*\/]|[\r\n])))*\*+\/)|(^[\s]*\/\/.*)/gm, ''); // remove comments
|
2496 |
-
css = svg.compressSpaces(css); // replace whitespace
|
2497 |
-
var cssDefs = css.split('}');
|
2498 |
-
for (var i=0; i<cssDefs.length; i++) {
|
2499 |
-
if (svg.trim(cssDefs[i]) != '') {
|
2500 |
-
var cssDef = cssDefs[i].split('{');
|
2501 |
-
var cssClasses = cssDef[0].split(',');
|
2502 |
-
var cssProps = cssDef[1].split(';');
|
2503 |
-
for (var j=0; j<cssClasses.length; j++) {
|
2504 |
-
var cssClass = svg.trim(cssClasses[j]);
|
2505 |
-
if (cssClass != '') {
|
2506 |
-
var props = svg.Styles[cssClass] || {};
|
2507 |
-
for (var k=0; k<cssProps.length; k++) {
|
2508 |
-
var prop = cssProps[k].indexOf(':');
|
2509 |
-
var name = cssProps[k].substr(0, prop);
|
2510 |
-
var value = cssProps[k].substr(prop + 1, cssProps[k].length - prop);
|
2511 |
-
if (name != null && value != null) {
|
2512 |
-
props[svg.trim(name)] = new svg.Property(svg.trim(name), svg.trim(value));
|
2513 |
-
}
|
2514 |
-
}
|
2515 |
-
svg.Styles[cssClass] = props;
|
2516 |
-
svg.StylesSpecificity[cssClass] = getSelectorSpecificity(cssClass);
|
2517 |
-
if (cssClass == '@font-face') {
|
2518 |
-
var fontFamily = props['font-family'].value.replace(/"/g,'');
|
2519 |
-
var srcs = props['src'].value.split(',');
|
2520 |
-
for (var s=0; s<srcs.length; s++) {
|
2521 |
-
if (srcs[s].indexOf('format("svg")') > 0) {
|
2522 |
-
var urlStart = srcs[s].indexOf('url');
|
2523 |
-
var urlEnd = srcs[s].indexOf(')', urlStart);
|
2524 |
-
var url = srcs[s].substr(urlStart + 5, urlEnd - urlStart - 6);
|
2525 |
-
var doc = svg.parseXml(svg.ajax(url));
|
2526 |
-
var fonts = doc.getElementsByTagName('font');
|
2527 |
-
for (var f=0; f<fonts.length; f++) {
|
2528 |
-
var font = svg.CreateElement(fonts[f]);
|
2529 |
-
svg.Definitions[fontFamily] = font;
|
2530 |
-
}
|
2531 |
-
}
|
2532 |
-
}
|
2533 |
-
}
|
2534 |
-
}
|
2535 |
-
}
|
2536 |
-
}
|
2537 |
-
}
|
2538 |
-
}
|
2539 |
-
svg.Element.style.prototype = new svg.Element.ElementBase;
|
2540 |
-
|
2541 |
-
// use element
|
2542 |
-
svg.Element.use = function(node) {
|
2543 |
-
this.base = svg.Element.RenderedElementBase;
|
2544 |
-
this.base(node);
|
2545 |
-
|
2546 |
-
this.baseSetContext = this.setContext;
|
2547 |
-
this.setContext = function(ctx) {
|
2548 |
-
this.baseSetContext(ctx);
|
2549 |
-
if (this.attribute('x').hasValue()) ctx.translate(this.attribute('x').toPixels('x'), 0);
|
2550 |
-
if (this.attribute('y').hasValue()) ctx.translate(0, this.attribute('y').toPixels('y'));
|
2551 |
-
}
|
2552 |
-
|
2553 |
-
var element = this.getHrefAttribute().getDefinition();
|
2554 |
-
|
2555 |
-
this.path = function(ctx) {
|
2556 |
-
if (element != null) element.path(ctx);
|
2557 |
-
}
|
2558 |
-
|
2559 |
-
this.getBoundingBox = function() {
|
2560 |
-
if (element != null) return element.getBoundingBox();
|
2561 |
-
}
|
2562 |
-
|
2563 |
-
this.renderChildren = function(ctx) {
|
2564 |
-
if (element != null) {
|
2565 |
-
var tempSvg = element;
|
2566 |
-
if (element.type == 'symbol') {
|
2567 |
-
// render me using a temporary svg element in symbol cases (http://www.w3.org/TR/SVG/struct.html#UseElement)
|
2568 |
-
tempSvg = new svg.Element.svg();
|
2569 |
-
tempSvg.type = 'svg';
|
2570 |
-
tempSvg.attributes['viewBox'] = new svg.Property('viewBox', element.attribute('viewBox').value);
|
2571 |
-
tempSvg.attributes['preserveAspectRatio'] = new svg.Property('preserveAspectRatio', element.attribute('preserveAspectRatio').value);
|
2572 |
-
tempSvg.attributes['overflow'] = new svg.Property('overflow', element.attribute('overflow').value);
|
2573 |
-
tempSvg.children = element.children;
|
2574 |
-
}
|
2575 |
-
if (tempSvg.type == 'svg') {
|
2576 |
-
// if symbol or svg, inherit width/height from me
|
2577 |
-
if (this.attribute('width').hasValue()) tempSvg.attributes['width'] = new svg.Property('width', this.attribute('width').value);
|
2578 |
-
if (this.attribute('height').hasValue()) tempSvg.attributes['height'] = new svg.Property('height', this.attribute('height').value);
|
2579 |
-
}
|
2580 |
-
var oldParent = tempSvg.parent;
|
2581 |
-
tempSvg.parent = null;
|
2582 |
-
tempSvg.render(ctx);
|
2583 |
-
tempSvg.parent = oldParent;
|
2584 |
-
}
|
2585 |
-
}
|
2586 |
-
}
|
2587 |
-
svg.Element.use.prototype = new svg.Element.RenderedElementBase;
|
2588 |
-
|
2589 |
-
// mask element
|
2590 |
-
svg.Element.mask = function(node) {
|
2591 |
-
this.base = svg.Element.ElementBase;
|
2592 |
-
this.base(node);
|
2593 |
-
|
2594 |
-
this.apply = function(ctx, element) {
|
2595 |
-
// render as temp svg
|
2596 |
-
var x = this.attribute('x').toPixels('x');
|
2597 |
-
var y = this.attribute('y').toPixels('y');
|
2598 |
-
var width = this.attribute('width').toPixels('x');
|
2599 |
-
var height = this.attribute('height').toPixels('y');
|
2600 |
-
|
2601 |
-
if (width == 0 && height == 0) {
|
2602 |
-
var bb = new svg.BoundingBox();
|
2603 |
-
for (var i=0; i<this.children.length; i++) {
|
2604 |
-
bb.addBoundingBox(this.children[i].getBoundingBox());
|
2605 |
-
}
|
2606 |
-
var x = Math.floor(bb.x1);
|
2607 |
-
var y = Math.floor(bb.y1);
|
2608 |
-
var width = Math.floor(bb.width());
|
2609 |
-
var height = Math.floor(bb.height());
|
2610 |
-
}
|
2611 |
-
|
2612 |
-
// temporarily remove mask to avoid recursion
|
2613 |
-
var mask = element.attribute('mask').value;
|
2614 |
-
element.attribute('mask').value = '';
|
2615 |
-
|
2616 |
-
var cMask = document.createElement('canvas');
|
2617 |
-
cMask.width = x + width;
|
2618 |
-
cMask.height = y + height;
|
2619 |
-
var maskCtx = cMask.getContext('2d');
|
2620 |
-
this.renderChildren(maskCtx);
|
2621 |
-
|
2622 |
-
var c = document.createElement('canvas');
|
2623 |
-
c.width = x + width;
|
2624 |
-
c.height = y + height;
|
2625 |
-
var tempCtx = c.getContext('2d');
|
2626 |
-
element.render(tempCtx);
|
2627 |
-
tempCtx.globalCompositeOperation = 'destination-in';
|
2628 |
-
tempCtx.fillStyle = maskCtx.createPattern(cMask, 'no-repeat');
|
2629 |
-
tempCtx.fillRect(0, 0, x + width, y + height);
|
2630 |
-
|
2631 |
-
ctx.fillStyle = tempCtx.createPattern(c, 'no-repeat');
|
2632 |
-
ctx.fillRect(0, 0, x + width, y + height);
|
2633 |
-
|
2634 |
-
// reassign mask
|
2635 |
-
element.attribute('mask').value = mask;
|
2636 |
-
}
|
2637 |
-
|
2638 |
-
this.render = function(ctx) {
|
2639 |
-
// NO RENDER
|
2640 |
-
}
|
2641 |
-
}
|
2642 |
-
svg.Element.mask.prototype = new svg.Element.ElementBase;
|
2643 |
-
|
2644 |
-
// clip element
|
2645 |
-
svg.Element.clipPath = function(node) {
|
2646 |
-
this.base = svg.Element.ElementBase;
|
2647 |
-
this.base(node);
|
2648 |
-
|
2649 |
-
this.apply = function(ctx) {
|
2650 |
-
var oldBeginPath = CanvasRenderingContext2D.prototype.beginPath;
|
2651 |
-
CanvasRenderingContext2D.prototype.beginPath = function () { };
|
2652 |
-
|
2653 |
-
var oldClosePath = CanvasRenderingContext2D.prototype.closePath;
|
2654 |
-
CanvasRenderingContext2D.prototype.closePath = function () { };
|
2655 |
-
|
2656 |
-
oldBeginPath.call(ctx);
|
2657 |
-
for (var i=0; i<this.children.length; i++) {
|
2658 |
-
var child = this.children[i];
|
2659 |
-
if (typeof child.path != 'undefined') {
|
2660 |
-
var transform = null;
|
2661 |
-
if (child.style('transform', false, true).hasValue()) {
|
2662 |
-
transform = new svg.Transform(child.style('transform', false, true).value);
|
2663 |
-
transform.apply(ctx);
|
2664 |
-
}
|
2665 |
-
child.path(ctx);
|
2666 |
-
CanvasRenderingContext2D.prototype.closePath = oldClosePath;
|
2667 |
-
if (transform) { transform.unapply(ctx); }
|
2668 |
-
}
|
2669 |
-
}
|
2670 |
-
oldClosePath.call(ctx);
|
2671 |
-
ctx.clip();
|
2672 |
-
|
2673 |
-
CanvasRenderingContext2D.prototype.beginPath = oldBeginPath;
|
2674 |
-
CanvasRenderingContext2D.prototype.closePath = oldClosePath;
|
2675 |
-
}
|
2676 |
-
|
2677 |
-
this.render = function(ctx) {
|
2678 |
-
// NO RENDER
|
2679 |
-
}
|
2680 |
-
}
|
2681 |
-
svg.Element.clipPath.prototype = new svg.Element.ElementBase;
|
2682 |
-
|
2683 |
-
// filters
|
2684 |
-
svg.Element.filter = function(node) {
|
2685 |
-
this.base = svg.Element.ElementBase;
|
2686 |
-
this.base(node);
|
2687 |
-
|
2688 |
-
this.apply = function(ctx, element) {
|
2689 |
-
// render as temp svg
|
2690 |
-
var bb = element.getBoundingBox();
|
2691 |
-
var x = Math.floor(bb.x1);
|
2692 |
-
var y = Math.floor(bb.y1);
|
2693 |
-
var width = Math.floor(bb.width());
|
2694 |
-
var height = Math.floor(bb.height());
|
2695 |
-
|
2696 |
-
// temporarily remove filter to avoid recursion
|
2697 |
-
var filter = element.style('filter').value;
|
2698 |
-
element.style('filter').value = '';
|
2699 |
-
|
2700 |
-
var px = 0, py = 0;
|
2701 |
-
for (var i=0; i<this.children.length; i++) {
|
2702 |
-
var efd = this.children[i].extraFilterDistance || 0;
|
2703 |
-
px = Math.max(px, efd);
|
2704 |
-
py = Math.max(py, efd);
|
2705 |
-
}
|
2706 |
-
|
2707 |
-
var c = document.createElement('canvas');
|
2708 |
-
c.width = width + 2*px;
|
2709 |
-
c.height = height + 2*py;
|
2710 |
-
var tempCtx = c.getContext('2d');
|
2711 |
-
tempCtx.translate(-x + px, -y + py);
|
2712 |
-
element.render(tempCtx);
|
2713 |
-
|
2714 |
-
// apply filters
|
2715 |
-
for (var i=0; i<this.children.length; i++) {
|
2716 |
-
if (typeof this.children[i].apply == 'function') {
|
2717 |
-
this.children[i].apply(tempCtx, 0, 0, width + 2*px, height + 2*py);
|
2718 |
-
}
|
2719 |
-
}
|
2720 |
-
|
2721 |
-
// render on me
|
2722 |
-
ctx.drawImage(c, 0, 0, width + 2*px, height + 2*py, x - px, y - py, width + 2*px, height + 2*py);
|
2723 |
-
|
2724 |
-
// reassign filter
|
2725 |
-
element.style('filter', true).value = filter;
|
2726 |
-
}
|
2727 |
-
|
2728 |
-
this.render = function(ctx) {
|
2729 |
-
// NO RENDER
|
2730 |
-
}
|
2731 |
-
}
|
2732 |
-
svg.Element.filter.prototype = new svg.Element.ElementBase;
|
2733 |
-
|
2734 |
-
svg.Element.feMorphology = function(node) {
|
2735 |
-
this.base = svg.Element.ElementBase;
|
2736 |
-
this.base(node);
|
2737 |
-
|
2738 |
-
this.apply = function(ctx, x, y, width, height) {
|
2739 |
-
// TODO: implement
|
2740 |
-
}
|
2741 |
-
}
|
2742 |
-
svg.Element.feMorphology.prototype = new svg.Element.ElementBase;
|
2743 |
-
|
2744 |
-
svg.Element.feComposite = function(node) {
|
2745 |
-
this.base = svg.Element.ElementBase;
|
2746 |
-
this.base(node);
|
2747 |
-
|
2748 |
-
this.apply = function(ctx, x, y, width, height) {
|
2749 |
-
// TODO: implement
|
2750 |
-
}
|
2751 |
-
}
|
2752 |
-
svg.Element.feComposite.prototype = new svg.Element.ElementBase;
|
2753 |
-
|
2754 |
-
svg.Element.feColorMatrix = function(node) {
|
2755 |
-
this.base = svg.Element.ElementBase;
|
2756 |
-
this.base(node);
|
2757 |
-
|
2758 |
-
var matrix = svg.ToNumberArray(this.attribute('values').value);
|
2759 |
-
switch (this.attribute('type').valueOrDefault('matrix')) { // http://www.w3.org/TR/SVG/filters.html#feColorMatrixElement
|
2760 |
-
case 'saturate':
|
2761 |
-
var s = matrix[0];
|
2762 |
-
matrix = [0.213+0.787*s,0.715-0.715*s,0.072-0.072*s,0,0,
|
2763 |
-
0.213-0.213*s,0.715+0.285*s,0.072-0.072*s,0,0,
|
2764 |
-
0.213-0.213*s,0.715-0.715*s,0.072+0.928*s,0,0,
|
2765 |
-
0,0,0,1,0,
|
2766 |
-
0,0,0,0,1];
|
2767 |
-
break;
|
2768 |
-
case 'hueRotate':
|
2769 |
-
var a = matrix[0] * Math.PI / 180.0;
|
2770 |
-
var c = function (m1,m2,m3) { return m1 + Math.cos(a)*m2 + Math.sin(a)*m3; };
|
2771 |
-
matrix = [c(0.213,0.787,-0.213),c(0.715,-0.715,-0.715),c(0.072,-0.072,0.928),0,0,
|
2772 |
-
c(0.213,-0.213,0.143),c(0.715,0.285,0.140),c(0.072,-0.072,-0.283),0,0,
|
2773 |
-
c(0.213,-0.213,-0.787),c(0.715,-0.715,0.715),c(0.072,0.928,0.072),0,0,
|
2774 |
-
0,0,0,1,0,
|
2775 |
-
0,0,0,0,1];
|
2776 |
-
break;
|
2777 |
-
case 'luminanceToAlpha':
|
2778 |
-
matrix = [0,0,0,0,0,
|
2779 |
-
0,0,0,0,0,
|
2780 |
-
0,0,0,0,0,
|
2781 |
-
0.2125,0.7154,0.0721,0,0,
|
2782 |
-
0,0,0,0,1];
|
2783 |
-
break;
|
2784 |
-
}
|
2785 |
-
|
2786 |
-
function imGet(img, x, y, width, height, rgba) {
|
2787 |
-
return img[y*width*4 + x*4 + rgba];
|
2788 |
-
}
|
2789 |
-
|
2790 |
-
function imSet(img, x, y, width, height, rgba, val) {
|
2791 |
-
img[y*width*4 + x*4 + rgba] = val;
|
2792 |
-
}
|
2793 |
-
|
2794 |
-
function m(i, v) {
|
2795 |
-
var mi = matrix[i];
|
2796 |
-
return mi * (mi < 0 ? v - 255 : v);
|
2797 |
-
}
|
2798 |
-
|
2799 |
-
this.apply = function(ctx, x, y, width, height) {
|
2800 |
-
// assuming x==0 && y==0 for now
|
2801 |
-
var srcData = ctx.getImageData(0, 0, width, height);
|
2802 |
-
for (var y = 0; y < height; y++) {
|
2803 |
-
for (var x = 0; x < width; x++) {
|
2804 |
-
var r = imGet(srcData.data, x, y, width, height, 0);
|
2805 |
-
var g = imGet(srcData.data, x, y, width, height, 1);
|
2806 |
-
var b = imGet(srcData.data, x, y, width, height, 2);
|
2807 |
-
var a = imGet(srcData.data, x, y, width, height, 3);
|
2808 |
-
imSet(srcData.data, x, y, width, height, 0, m(0,r)+m(1,g)+m(2,b)+m(3,a)+m(4,1));
|
2809 |
-
imSet(srcData.data, x, y, width, height, 1, m(5,r)+m(6,g)+m(7,b)+m(8,a)+m(9,1));
|
2810 |
-
imSet(srcData.data, x, y, width, height, 2, m(10,r)+m(11,g)+m(12,b)+m(13,a)+m(14,1));
|
2811 |
-
imSet(srcData.data, x, y, width, height, 3, m(15,r)+m(16,g)+m(17,b)+m(18,a)+m(19,1));
|
2812 |
-
}
|
2813 |
-
}
|
2814 |
-
ctx.clearRect(0, 0, width, height);
|
2815 |
-
ctx.putImageData(srcData, 0, 0);
|
2816 |
-
}
|
2817 |
-
}
|
2818 |
-
svg.Element.feColorMatrix.prototype = new svg.Element.ElementBase;
|
2819 |
-
|
2820 |
-
svg.Element.feGaussianBlur = function(node) {
|
2821 |
-
this.base = svg.Element.ElementBase;
|
2822 |
-
this.base(node);
|
2823 |
-
|
2824 |
-
this.blurRadius = Math.floor(this.attribute('stdDeviation').numValue());
|
2825 |
-
this.extraFilterDistance = this.blurRadius;
|
2826 |
-
|
2827 |
-
this.apply = function(ctx, x, y, width, height) {
|
2828 |
-
if (typeof stackBlur.canvasRGBA == 'undefined') {
|
2829 |
-
svg.log('ERROR: StackBlur.js must be included for blur to work');
|
2830 |
-
return;
|
2831 |
-
}
|
2832 |
-
|
2833 |
-
// StackBlur requires canvas be on document
|
2834 |
-
ctx.canvas.id = svg.UniqueId();
|
2835 |
-
ctx.canvas.style.display = 'none';
|
2836 |
-
document.body.appendChild(ctx.canvas);
|
2837 |
-
stackBlur.canvasRGBA(ctx.canvas.id, x, y, width, height, this.blurRadius);
|
2838 |
-
document.body.removeChild(ctx.canvas);
|
2839 |
-
}
|
2840 |
-
}
|
2841 |
-
svg.Element.feGaussianBlur.prototype = new svg.Element.ElementBase;
|
2842 |
-
|
2843 |
-
// title element, do nothing
|
2844 |
-
svg.Element.title = function(node) {
|
2845 |
-
}
|
2846 |
-
svg.Element.title.prototype = new svg.Element.ElementBase;
|
2847 |
-
|
2848 |
-
// desc element, do nothing
|
2849 |
-
svg.Element.desc = function(node) {
|
2850 |
-
}
|
2851 |
-
svg.Element.desc.prototype = new svg.Element.ElementBase;
|
2852 |
-
|
2853 |
-
svg.Element.MISSING = function(node) {
|
2854 |
-
svg.log('ERROR: Element \'' + node.nodeName + '\' not yet implemented.');
|
2855 |
-
}
|
2856 |
-
svg.Element.MISSING.prototype = new svg.Element.ElementBase;
|
2857 |
-
|
2858 |
-
// element factory
|
2859 |
-
svg.CreateElement = function(node) {
|
2860 |
-
var className = node.nodeName.replace(/^[^:]+:/,''); // remove namespace
|
2861 |
-
className = className.replace(/\-/g,''); // remove dashes
|
2862 |
-
var e = null;
|
2863 |
-
if (typeof svg.Element[className] != 'undefined') {
|
2864 |
-
e = new svg.Element[className](node);
|
2865 |
-
}
|
2866 |
-
else {
|
2867 |
-
e = new svg.Element.MISSING(node);
|
2868 |
-
}
|
2869 |
-
|
2870 |
-
e.type = node.nodeName;
|
2871 |
-
return e;
|
2872 |
-
}
|
2873 |
-
|
2874 |
-
// load from url
|
2875 |
-
svg.load = function(ctx, url) {
|
2876 |
-
svg.loadXml(ctx, svg.ajax(url));
|
2877 |
-
}
|
2878 |
-
|
2879 |
-
// load from xml
|
2880 |
-
svg.loadXml = function(ctx, xml) {
|
2881 |
-
svg.loadXmlDoc(ctx, svg.parseXml(xml));
|
2882 |
-
}
|
2883 |
-
|
2884 |
-
svg.loadXmlDoc = function(ctx, dom) {
|
2885 |
-
svg.init(ctx);
|
2886 |
-
|
2887 |
-
var mapXY = function(p) {
|
2888 |
-
var e = ctx.canvas;
|
2889 |
-
while (e) {
|
2890 |
-
p.x -= e.offsetLeft;
|
2891 |
-
p.y -= e.offsetTop;
|
2892 |
-
e = e.offsetParent;
|
2893 |
-
}
|
2894 |
-
if (window.scrollX) p.x += window.scrollX;
|
2895 |
-
if (window.scrollY) p.y += window.scrollY;
|
2896 |
-
return p;
|
2897 |
-
}
|
2898 |
-
|
2899 |
-
// bind mouse
|
2900 |
-
if (svg.opts['ignoreMouse'] != true) {
|
2901 |
-
ctx.canvas.onclick = function(e) {
|
2902 |
-
var p = mapXY(new svg.Point(e != null ? e.clientX : event.clientX, e != null ? e.clientY : event.clientY));
|
2903 |
-
svg.Mouse.onclick(p.x, p.y);
|
2904 |
-
};
|
2905 |
-
ctx.canvas.onmousemove = function(e) {
|
2906 |
-
var p = mapXY(new svg.Point(e != null ? e.clientX : event.clientX, e != null ? e.clientY : event.clientY));
|
2907 |
-
svg.Mouse.onmousemove(p.x, p.y);
|
2908 |
-
};
|
2909 |
-
}
|
2910 |
-
|
2911 |
-
var e = svg.CreateElement(dom.documentElement);
|
2912 |
-
e.root = true;
|
2913 |
-
e.addStylesFromStyleDefinition();
|
2914 |
-
|
2915 |
-
// render loop
|
2916 |
-
var isFirstRender = true;
|
2917 |
-
var draw = function() {
|
2918 |
-
svg.ViewPort.Clear();
|
2919 |
-
if (ctx.canvas.parentNode) svg.ViewPort.SetCurrent(ctx.canvas.parentNode.clientWidth, ctx.canvas.parentNode.clientHeight);
|
2920 |
-
|
2921 |
-
if (svg.opts['ignoreDimensions'] != true) {
|
2922 |
-
// set canvas size
|
2923 |
-
if (e.style('width').hasValue()) {
|
2924 |
-
ctx.canvas.width = e.style('width').toPixels('x');
|
2925 |
-
ctx.canvas.style.width = ctx.canvas.width + 'px';
|
2926 |
-
}
|
2927 |
-
if (e.style('height').hasValue()) {
|
2928 |
-
ctx.canvas.height = e.style('height').toPixels('y');
|
2929 |
-
ctx.canvas.style.height = ctx.canvas.height + 'px';
|
2930 |
-
}
|
2931 |
-
}
|
2932 |
-
var cWidth = ctx.canvas.clientWidth || ctx.canvas.width;
|
2933 |
-
var cHeight = ctx.canvas.clientHeight || ctx.canvas.height;
|
2934 |
-
if (svg.opts['ignoreDimensions'] == true && e.style('width').hasValue() && e.style('height').hasValue()) {
|
2935 |
-
cWidth = e.style('width').toPixels('x');
|
2936 |
-
cHeight = e.style('height').toPixels('y');
|
2937 |
-
}
|
2938 |
-
svg.ViewPort.SetCurrent(cWidth, cHeight);
|
2939 |
-
|
2940 |
-
if (svg.opts['offsetX'] != null) e.attribute('x', true).value = svg.opts['offsetX'];
|
2941 |
-
if (svg.opts['offsetY'] != null) e.attribute('y', true).value = svg.opts['offsetY'];
|
2942 |
-
if (svg.opts['scaleWidth'] != null || svg.opts['scaleHeight'] != null) {
|
2943 |
-
var xRatio = null, yRatio = null, viewBox = svg.ToNumberArray(e.attribute('viewBox').value);
|
2944 |
-
|
2945 |
-
if (svg.opts['scaleWidth'] != null) {
|
2946 |
-
if (e.attribute('width').hasValue()) xRatio = e.attribute('width').toPixels('x') / svg.opts['scaleWidth'];
|
2947 |
-
else if (!isNaN(viewBox[2])) xRatio = viewBox[2] / svg.opts['scaleWidth'];
|
2948 |
-
}
|
2949 |
-
|
2950 |
-
if (svg.opts['scaleHeight'] != null) {
|
2951 |
-
if (e.attribute('height').hasValue()) yRatio = e.attribute('height').toPixels('y') / svg.opts['scaleHeight'];
|
2952 |
-
else if (!isNaN(viewBox[3])) yRatio = viewBox[3] / svg.opts['scaleHeight'];
|
2953 |
-
}
|
2954 |
-
|
2955 |
-
if (xRatio == null) { xRatio = yRatio; }
|
2956 |
-
if (yRatio == null) { yRatio = xRatio; }
|
2957 |
-
|
2958 |
-
e.attribute('width', true).value = svg.opts['scaleWidth'];
|
2959 |
-
e.attribute('height', true).value = svg.opts['scaleHeight'];
|
2960 |
-
e.style('transform', true, true).value += ' scale('+(1.0/xRatio)+','+(1.0/yRatio)+')';
|
2961 |
-
}
|
2962 |
-
|
2963 |
-
// clear and render
|
2964 |
-
if (svg.opts['ignoreClear'] != true) {
|
2965 |
-
ctx.clearRect(0, 0, cWidth, cHeight);
|
2966 |
-
}
|
2967 |
-
e.render(ctx);
|
2968 |
-
if (isFirstRender) {
|
2969 |
-
isFirstRender = false;
|
2970 |
-
if (typeof svg.opts['renderCallback'] == 'function') svg.opts['renderCallback'](dom);
|
2971 |
-
}
|
2972 |
-
}
|
2973 |
-
|
2974 |
-
var waitingForImages = true;
|
2975 |
-
if (svg.ImagesLoaded()) {
|
2976 |
-
waitingForImages = false;
|
2977 |
-
draw();
|
2978 |
-
}
|
2979 |
-
svg.intervalID = setInterval(function() {
|
2980 |
-
var needUpdate = false;
|
2981 |
-
|
2982 |
-
if (waitingForImages && svg.ImagesLoaded()) {
|
2983 |
-
waitingForImages = false;
|
2984 |
-
needUpdate = true;
|
2985 |
-
}
|
2986 |
-
|
2987 |
-
// need update from mouse events?
|
2988 |
-
if (svg.opts['ignoreMouse'] != true) {
|
2989 |
-
needUpdate = needUpdate | svg.Mouse.hasEvents();
|
2990 |
-
}
|
2991 |
-
|
2992 |
-
// need update from animations?
|
2993 |
-
if (svg.opts['ignoreAnimation'] != true) {
|
2994 |
-
for (var i=0; i<svg.Animations.length; i++) {
|
2995 |
-
needUpdate = needUpdate | svg.Animations[i].update(1000 / svg.FRAMERATE);
|
2996 |
-
}
|
2997 |
-
}
|
2998 |
-
|
2999 |
-
// need update from redraw?
|
3000 |
-
if (typeof svg.opts['forceRedraw'] == 'function') {
|
3001 |
-
if (svg.opts['forceRedraw']() == true) needUpdate = true;
|
3002 |
-
}
|
3003 |
-
|
3004 |
-
// render if needed
|
3005 |
-
if (needUpdate) {
|
3006 |
-
draw();
|
3007 |
-
svg.Mouse.runEvents(); // run and clear our events
|
3008 |
-
}
|
3009 |
-
}, 1000 / svg.FRAMERATE);
|
3010 |
-
}
|
3011 |
-
|
3012 |
-
svg.stop = function() {
|
3013 |
-
if (svg.intervalID) {
|
3014 |
-
clearInterval(svg.intervalID);
|
3015 |
-
}
|
3016 |
-
}
|
3017 |
-
|
3018 |
-
svg.Mouse = new (function() {
|
3019 |
-
this.events = [];
|
3020 |
-
this.hasEvents = function() { return this.events.length != 0; }
|
3021 |
-
|
3022 |
-
this.onclick = function(x, y) {
|
3023 |
-
this.events.push({ type: 'onclick', x: x, y: y,
|
3024 |
-
run: function(e) { if (e.onclick) e.onclick(); }
|
3025 |
-
});
|
3026 |
-
}
|
3027 |
-
|
3028 |
-
this.onmousemove = function(x, y) {
|
3029 |
-
this.events.push({ type: 'onmousemove', x: x, y: y,
|
3030 |
-
run: function(e) { if (e.onmousemove) e.onmousemove(); }
|
3031 |
-
});
|
3032 |
-
}
|
3033 |
-
|
3034 |
-
this.eventElements = [];
|
3035 |
-
|
3036 |
-
this.checkPath = function(element, ctx) {
|
3037 |
-
for (var i=0; i<this.events.length; i++) {
|
3038 |
-
var e = this.events[i];
|
3039 |
-
if (ctx.isPointInPath && ctx.isPointInPath(e.x, e.y)) this.eventElements[i] = element;
|
3040 |
-
}
|
3041 |
-
}
|
3042 |
-
|
3043 |
-
this.checkBoundingBox = function(element, bb) {
|
3044 |
-
for (var i=0; i<this.events.length; i++) {
|
3045 |
-
var e = this.events[i];
|
3046 |
-
if (bb.isPointInBox(e.x, e.y)) this.eventElements[i] = element;
|
3047 |
-
}
|
3048 |
-
}
|
3049 |
-
|
3050 |
-
this.runEvents = function() {
|
3051 |
-
svg.ctx.canvas.style.cursor = '';
|
3052 |
-
|
3053 |
-
for (var i=0; i<this.events.length; i++) {
|
3054 |
-
var e = this.events[i];
|
3055 |
-
var element = this.eventElements[i];
|
3056 |
-
while (element) {
|
3057 |
-
e.run(element);
|
3058 |
-
element = element.parent;
|
3059 |
-
}
|
3060 |
-
}
|
3061 |
-
|
3062 |
-
// done running, clear
|
3063 |
-
this.events = [];
|
3064 |
-
this.eventElements = [];
|
3065 |
-
}
|
3066 |
-
});
|
3067 |
-
|
3068 |
-
return svg;
|
3069 |
-
};
|
3070 |
-
|
3071 |
-
if (typeof CanvasRenderingContext2D != 'undefined') {
|
3072 |
-
CanvasRenderingContext2D.prototype.drawSvg = function(s, dx, dy, dw, dh, opts) {
|
3073 |
-
var cOpts = {
|
3074 |
-
ignoreMouse: true,
|
3075 |
-
ignoreAnimation: true,
|
3076 |
-
ignoreDimensions: true,
|
3077 |
-
ignoreClear: true,
|
3078 |
-
offsetX: dx,
|
3079 |
-
offsetY: dy,
|
3080 |
-
scaleWidth: dw,
|
3081 |
-
scaleHeight: dh
|
3082 |
-
}
|
3083 |
-
|
3084 |
-
for(var prop in opts) {
|
3085 |
-
if(opts.hasOwnProperty(prop)){
|
3086 |
-
cOpts[prop] = opts[prop];
|
3087 |
-
}
|
3088 |
-
}
|
3089 |
-
canvg(this.canvas, s, cOpts);
|
3090 |
-
}
|
3091 |
-
}
|
3092 |
-
|
3093 |
-
return canvg;
|
3094 |
-
|
3095 |
-
}));
|
1 |
+
/*
|
2 |
+
* canvg.js - Javascript SVG parser and renderer on Canvas
|
3 |
+
* MIT Licensed
|
4 |
+
* Gabe Lerner (gabelerner@gmail.com)
|
5 |
+
* http://code.google.com/p/canvg/
|
6 |
+
*
|
7 |
+
* Requires: rgbcolor.js - http://www.phpied.com/rgb-color-parser-in-javascript/
|
8 |
+
*/
|
9 |
+
(function ( global, factory ) {
|
10 |
+
|
11 |
+
'use strict';
|
12 |
+
|
13 |
+
// export as AMD...
|
14 |
+
if ( typeof define !== 'undefined' && define.amd ) {
|
15 |
+
define('canvgModule', [ 'rgbcolor', 'stackblur' ], factory );
|
16 |
+
}
|
17 |
+
|
18 |
+
// ...or as browserify
|
19 |
+
else if ( typeof module !== 'undefined' && module.exports ) {
|
20 |
+
module.exports = factory( require( 'rgbcolor' ), require( 'stackblur' ) );
|
21 |
+
}
|
22 |
+
|
23 |
+
global.canvg = factory( global.RGBColor, global.stackBlur );
|
24 |
+
|
25 |
+
}( typeof window !== 'undefined' ? window : this, function ( RGBColor, stackBlur ) {
|
26 |
+
|
27 |
+
// canvg(target, s)
|
28 |
+
// empty parameters: replace all 'svg' elements on page with 'canvas' elements
|
29 |
+
// target: canvas element or the id of a canvas element
|
30 |
+
// s: svg string, url to svg file, or xml document
|
31 |
+
// opts: optional hash of options
|
32 |
+
// ignoreMouse: true => ignore mouse events
|
33 |
+
// ignoreAnimation: true => ignore animations
|
34 |
+
// ignoreDimensions: true => does not try to resize canvas
|
35 |
+
// ignoreClear: true => does not clear canvas
|
36 |
+
// offsetX: int => draws at a x offset
|
37 |
+
// offsetY: int => draws at a y offset
|
38 |
+
// scaleWidth: int => scales horizontally to width
|
39 |
+
// scaleHeight: int => scales vertically to height
|
40 |
+
// renderCallback: function => will call the function after the first render is completed
|
41 |
+
// forceRedraw: function => will call the function on every frame, if it returns true, will redraw
|
42 |
+
var canvg = function (target, s, opts) {
|
43 |
+
// no parameters
|
44 |
+
if (target == null && s == null && opts == null) {
|
45 |
+
var svgTags = document.querySelectorAll('svg');
|
46 |
+
for (var i=0; i<svgTags.length; i++) {
|
47 |
+
var svgTag = svgTags[i];
|
48 |
+
var c = document.createElement('canvas');
|
49 |
+
c.width = svgTag.clientWidth;
|
50 |
+
c.height = svgTag.clientHeight;
|
51 |
+
svgTag.parentNode.insertBefore(c, svgTag);
|
52 |
+
svgTag.parentNode.removeChild(svgTag);
|
53 |
+
var div = document.createElement('div');
|
54 |
+
div.appendChild(svgTag);
|
55 |
+
canvg(c, div.innerHTML);
|
56 |
+
}
|
57 |
+
return;
|
58 |
+
}
|
59 |
+
|
60 |
+
if (typeof target == 'string') {
|
61 |
+
target = document.getElementById(target);
|
62 |
+
}
|
63 |
+
|
64 |
+
// store class on canvas
|
65 |
+
if (target.svg != null) target.svg.stop();
|
66 |
+
var svg = build(opts || {});
|
67 |
+
// on i.e. 8 for flash canvas, we can't assign the property so check for it
|
68 |
+
if (!(target.childNodes.length == 1 && target.childNodes[0].nodeName == 'OBJECT')) target.svg = svg;
|
69 |
+
|
70 |
+
var ctx = target.getContext('2d');
|
71 |
+
if (typeof s.documentElement != 'undefined') {
|
72 |
+
// load from xml doc
|
73 |
+
svg.loadXmlDoc(ctx, s);
|
74 |
+
}
|
75 |
+
else if (s.substr(0,1) == '<') {
|
76 |
+
// load from xml string
|
77 |
+
svg.loadXml(ctx, s);
|
78 |
+
}
|
79 |
+
else {
|
80 |
+
// load from url
|
81 |
+
svg.load(ctx, s);
|
82 |
+
}
|
83 |
+
}
|
84 |
+
|
85 |
+
// see https://developer.mozilla.org/en-US/docs/Web/API/Element.matches
|
86 |
+
var matchesSelector;
|
87 |
+
if (typeof Element.prototype.matches != 'undefined') {
|
88 |
+
matchesSelector = function(node, selector) {
|
89 |
+
return node.matches(selector);
|
90 |
+
};
|
91 |
+
} else if (typeof Element.prototype.webkitMatchesSelector != 'undefined') {
|
92 |
+
matchesSelector = function(node, selector) {
|
93 |
+
return node.webkitMatchesSelector(selector);
|
94 |
+
};
|
95 |
+
} else if (typeof Element.prototype.mozMatchesSelector != 'undefined') {
|
96 |
+
matchesSelector = function(node, selector) {
|
97 |
+
return node.mozMatchesSelector(selector);
|
98 |
+
};
|
99 |
+
} else if (typeof Element.prototype.msMatchesSelector != 'undefined') {
|
100 |
+
matchesSelector = function(node, selector) {
|
101 |
+
return node.msMatchesSelector(selector);
|
102 |
+
};
|
103 |
+
} else if (typeof Element.prototype.oMatchesSelector != 'undefined') {
|
104 |
+
matchesSelector = function(node, selector) {
|
105 |
+
return node.oMatchesSelector(selector);
|
106 |
+
};
|
107 |
+
} else {
|
108 |
+
// requires Sizzle: https://github.com/jquery/sizzle/wiki/Sizzle-Documentation
|
109 |
+
// or jQuery: http://jquery.com/download/
|
110 |
+
// or Zepto: http://zeptojs.com/#
|
111 |
+
// without it, this is a ReferenceError
|
112 |
+
|
113 |
+
if (typeof jQuery === 'function' || typeof Zepto === 'function') {
|
114 |
+
matchesSelector = function (node, selector) {
|
115 |
+
return $(node).is(selector);
|
116 |
+
};
|
117 |
+
}
|
118 |
+
|
119 |
+
if (typeof matchesSelector === 'undefined') {
|
120 |
+
matchesSelector = Sizzle.matchesSelector;
|
121 |
+
}
|
122 |
+
}
|
123 |
+
|
124 |
+
// slightly modified version of https://github.com/keeganstreet/specificity/blob/master/specificity.js
|
125 |
+
var attributeRegex = /(\[[^\]]+\])/g;
|
126 |
+
var idRegex = /(#[^\s\+>~\.\[:]+)/g;
|
127 |
+
var classRegex = /(\.[^\s\+>~\.\[:]+)/g;
|
128 |
+
var pseudoElementRegex = /(::[^\s\+>~\.\[:]+|:first-line|:first-letter|:before|:after)/gi;
|
129 |
+
var pseudoClassWithBracketsRegex = /(:[\w-]+\([^\)]*\))/gi;
|
130 |
+
var pseudoClassRegex = /(:[^\s\+>~\.\[:]+)/g;
|
131 |
+
var elementRegex = /([^\s\+>~\.\[:]+)/g;
|
132 |
+
function getSelectorSpecificity(selector) {
|
133 |
+
var typeCount = [0, 0, 0];
|
134 |
+
var findMatch = function(regex, type) {
|
135 |
+
var matches = selector.match(regex);
|
136 |
+
if (matches == null) {
|
137 |
+
return;
|
138 |
+
}
|
139 |
+
typeCount[type] += matches.length;
|
140 |
+
selector = selector.replace(regex, ' ');
|
141 |
+
};
|
142 |
+
|
143 |
+
selector = selector.replace(/:not\(([^\)]*)\)/g, ' $1 ');
|
144 |
+
selector = selector.replace(/{[\s\S]*/gm, ' ');
|
145 |
+
findMatch(attributeRegex, 1);
|
146 |
+
findMatch(idRegex, 0);
|
147 |
+
findMatch(classRegex, 1);
|
148 |
+
findMatch(pseudoElementRegex, 2);
|
149 |
+
findMatch(pseudoClassWithBracketsRegex, 1);
|
150 |
+
findMatch(pseudoClassRegex, 1);
|
151 |
+
selector = selector.replace(/[\*\s\+>~]/g, ' ');
|
152 |
+
selector = selector.replace(/[#\.]/g, ' ');
|
153 |
+
findMatch(elementRegex, 2);
|
154 |
+
return typeCount.join('');
|
155 |
+
}
|
156 |
+
|
157 |
+
function build(opts) {
|
158 |
+
var svg = { opts: opts };
|
159 |
+
|
160 |
+
svg.FRAMERATE = 30;
|
161 |
+
svg.MAX_VIRTUAL_PIXELS = 30000;
|
162 |
+
|
163 |
+
svg.log = function(msg) {};
|
164 |
+
if (svg.opts['log'] == true && typeof console != 'undefined') {
|
165 |
+
svg.log = function(msg) { console.log(msg); };
|
166 |
+
};
|
167 |
+
|
168 |
+
// globals
|
169 |
+
svg.init = function(ctx) {
|
170 |
+
var uniqueId = 0;
|
171 |
+
svg.UniqueId = function () { uniqueId++; return 'canvg' + uniqueId; };
|
172 |
+
svg.Definitions = {};
|
173 |
+
svg.Styles = {};
|
174 |
+
svg.StylesSpecificity = {};
|
175 |
+
svg.Animations = [];
|
176 |
+
svg.Images = [];
|
177 |
+
svg.ctx = ctx;
|
178 |
+
svg.ViewPort = new (function () {
|
179 |
+
this.viewPorts = [];
|
180 |
+
this.Clear = function() { this.viewPorts = []; }
|
181 |
+
this.SetCurrent = function(width, height) { this.viewPorts.push({ width: width, height: height }); }
|
182 |
+
this.RemoveCurrent = function() { this.viewPorts.pop(); }
|
183 |
+
this.Current = function() { return this.viewPorts[this.viewPorts.length - 1]; }
|
184 |
+
this.width = function() { return this.Current().width; }
|
185 |
+
this.height = function() { return this.Current().height; }
|
186 |
+
this.ComputeSize = function(d) {
|
187 |
+
if (d != null && typeof d == 'number') return d;
|
188 |
+
if (d == 'x') return this.width();
|
189 |
+
if (d == 'y') return this.height();
|
190 |
+
return Math.sqrt(Math.pow(this.width(), 2) + Math.pow(this.height(), 2)) / Math.sqrt(2);
|
191 |
+
}
|
192 |
+
});
|
193 |
+
}
|
194 |
+
svg.init();
|
195 |
+
|
196 |
+
// images loaded
|
197 |
+
svg.ImagesLoaded = function() {
|
198 |
+
for (var i=0; i<svg.Images.length; i++) {
|
199 |
+
if (!svg.Images[i].loaded) return false;
|
200 |
+
}
|
201 |
+
return true;
|
202 |
+
}
|
203 |
+
|
204 |
+
// trim
|
205 |
+
svg.trim = function(s) { return s.replace(/^\s+|\s+$/g, ''); }
|
206 |
+
|
207 |
+
// compress spaces
|
208 |
+
svg.compressSpaces = function(s) { return s.replace(/[\s\r\t\n]+/gm,' '); }
|
209 |
+
|
210 |
+
// ajax
|
211 |
+
svg.ajax = function(url) {
|
212 |
+
var AJAX;
|
213 |
+
if(window.XMLHttpRequest){AJAX=new XMLHttpRequest();}
|
214 |
+
else{AJAX=new ActiveXObject('Microsoft.XMLHTTP');}
|
215 |
+
if(AJAX){
|
216 |
+
AJAX.open('GET',url,false);
|
217 |
+
AJAX.send(null);
|
218 |
+
return AJAX.responseText;
|
219 |
+
}
|
220 |
+
return null;
|
221 |
+
}
|
222 |
+
|
223 |
+
// parse xml
|
224 |
+
svg.parseXml = function(xml) {
|
225 |
+
if (typeof Windows != 'undefined' && typeof Windows.Data != 'undefined' && typeof Windows.Data.Xml != 'undefined') {
|
226 |
+
var xmlDoc = new Windows.Data.Xml.Dom.XmlDocument();
|
227 |
+
var settings = new Windows.Data.Xml.Dom.XmlLoadSettings();
|
228 |
+
settings.prohibitDtd = false;
|
229 |
+
xmlDoc.loadXml(xml, settings);
|
230 |
+
return xmlDoc;
|
231 |
+
}
|
232 |
+
else if (window.DOMParser)
|
233 |
+
{
|
234 |
+
var parser = new DOMParser();
|
235 |
+
return parser.parseFromString(xml, 'text/xml');
|
236 |
+
}
|
237 |
+
else
|
238 |
+
{
|
239 |
+
xml = xml.replace(/<!DOCTYPE svg[^>]*>/, '');
|
240 |
+
var xmlDoc = new ActiveXObject('Microsoft.XMLDOM');
|
241 |
+
xmlDoc.async = 'false';
|
242 |
+
xmlDoc.loadXML(xml);
|
243 |
+
return xmlDoc;
|
244 |
+
}
|
245 |
+
}
|
246 |
+
|
247 |
+
svg.Property = function(name, value) {
|
248 |
+
this.name = name;
|
249 |
+
this.value = value;
|
250 |
+
}
|
251 |
+
svg.Property.prototype.getValue = function() {
|
252 |
+
return this.value;
|
253 |
+
}
|
254 |
+
|
255 |
+
svg.Property.prototype.hasValue = function() {
|
256 |
+
return (this.value != null && this.value !== '');
|
257 |
+
}
|
258 |
+
|
259 |
+
// return the numerical value of the property
|
260 |
+
svg.Property.prototype.numValue = function() {
|
261 |
+
if (!this.hasValue()) return 0;
|
262 |
+
|
263 |
+
var n = parseFloat(this.value);
|
264 |
+
if ((this.value + '').match(/%$/)) {
|
265 |
+
n = n / 100.0;
|
266 |
+
}
|
267 |
+
return n;
|
268 |
+
}
|
269 |
+
|
270 |
+
svg.Property.prototype.valueOrDefault = function(def) {
|
271 |
+
if (this.hasValue()) return this.value;
|
272 |
+
return def;
|
273 |
+
}
|
274 |
+
|
275 |
+
svg.Property.prototype.numValueOrDefault = function(def) {
|
276 |
+
if (this.hasValue()) return this.numValue();
|
277 |
+
return def;
|
278 |
+
}
|
279 |
+
|
280 |
+
// color extensions
|
281 |
+
// augment the current color value with the opacity
|
282 |
+
svg.Property.prototype.addOpacity = function(opacityProp) {
|
283 |
+
var newValue = this.value;
|
284 |
+
if (opacityProp.value != null && opacityProp.value != '' && typeof this.value == 'string') { // can only add opacity to colors, not patterns
|
285 |
+
var color = new RGBColor(this.value);
|
286 |
+
if (color.ok) {
|
287 |
+
newValue = 'rgba(' + color.r + ', ' + color.g + ', ' + color.b + ', ' + opacityProp.numValue() + ')';
|
288 |
+
}
|
289 |
+
}
|
290 |
+
return new svg.Property(this.name, newValue);
|
291 |
+
}
|
292 |
+
|
293 |
+
// definition extensions
|
294 |
+
// get the definition from the definitions table
|
295 |
+
svg.Property.prototype.getDefinition = function() {
|
296 |
+
var name = this.value.match(/#([^\)'"]+)/);
|
297 |
+
if (name) { name = name[1]; }
|
298 |
+
if (!name) { name = this.value; }
|
299 |
+
return svg.Definitions[name];
|
300 |
+
}
|
301 |
+
|
302 |
+
svg.Property.prototype.isUrlDefinition = function() {
|
303 |
+
return this.value.indexOf('url(') == 0
|
304 |
+
}
|
305 |
+
|
306 |
+
svg.Property.prototype.getFillStyleDefinition = function(e, opacityProp) {
|
307 |
+
var def = this.getDefinition();
|
308 |
+
|
309 |
+
// gradient
|
310 |
+
if (def != null && def.createGradient) {
|
311 |
+
return def.createGradient(svg.ctx, e, opacityProp);
|
312 |
+
}
|
313 |
+
|
314 |
+
// pattern
|
315 |
+
if (def != null && def.createPattern) {
|
316 |
+
if (def.getHrefAttribute().hasValue()) {
|
317 |
+
var pt = def.attribute('patternTransform');
|
318 |
+
def = def.getHrefAttribute().getDefinition();
|
319 |
+
if (pt.hasValue()) { def.attribute('patternTransform', true).value = pt.value; }
|
320 |
+
}
|
321 |
+
return def.createPattern(svg.ctx, e);
|
322 |
+
}
|
323 |
+
|
324 |
+
return null;
|
325 |
+
}
|
326 |
+
|
327 |
+
// length extensions
|
328 |
+
svg.Property.prototype.getDPI = function(viewPort) {
|
329 |
+
return 96.0; // TODO: compute?
|
330 |
+
}
|
331 |
+
|
332 |
+
svg.Property.prototype.getEM = function(viewPort) {
|
333 |
+
var em = 12;
|
334 |
+
|
335 |
+
var fontSize = new svg.Property('fontSize', svg.Font.Parse(svg.ctx.font).fontSize);
|
336 |
+
if (fontSize.hasValue()) em = fontSize.toPixels(viewPort);
|
337 |
+
|
338 |
+
return em;
|
339 |
+
}
|
340 |
+
|
341 |
+
svg.Property.prototype.getUnits = function() {
|
342 |
+
var s = this.value+'';
|
343 |
+
return s.replace(/[0-9\.\-]/g,'');
|
344 |
+
}
|
345 |
+
|
346 |
+
// get the length as pixels
|
347 |
+
svg.Property.prototype.toPixels = function(viewPort, processPercent) {
|
348 |
+
if (!this.hasValue()) return 0;
|
349 |
+
var s = this.value+'';
|
350 |
+
if (s.match(/em$/)) return this.numValue() * this.getEM(viewPort);
|
351 |
+
if (s.match(/ex$/)) return this.numValue() * this.getEM(viewPort) / 2.0;
|
352 |
+
if (s.match(/px$/)) return this.numValue();
|
353 |
+
if (s.match(/pt$/)) return this.numValue() * this.getDPI(viewPort) * (1.0 / 72.0);
|
354 |
+
if (s.match(/pc$/)) return this.numValue() * 15;
|
355 |
+
if (s.match(/cm$/)) return this.numValue() * this.getDPI(viewPort) / 2.54;
|
356 |
+
if (s.match(/mm$/)) return this.numValue() * this.getDPI(viewPort) / 25.4;
|
357 |
+
if (s.match(/in$/)) return this.numValue() * this.getDPI(viewPort);
|
358 |
+
if (s.match(/%$/)) return this.numValue() * svg.ViewPort.ComputeSize(viewPort);
|
359 |
+
var n = this.numValue();
|
360 |
+
if (processPercent && n < 1.0) return n * svg.ViewPort.ComputeSize(viewPort);
|
361 |
+
return n;
|
362 |
+
}
|
363 |
+
|
364 |
+
// time extensions
|
365 |
+
// get the time as milliseconds
|
366 |
+
svg.Property.prototype.toMilliseconds = function() {
|
367 |
+
if (!this.hasValue()) return 0;
|
368 |
+
var s = this.value+'';
|
369 |
+
if (s.match(/s$/)) return this.numValue() * 1000;
|
370 |
+
if (s.match(/ms$/)) return this.numValue();
|
371 |
+
return this.numValue();
|
372 |
+
}
|
373 |
+
|
374 |
+
// angle extensions
|
375 |
+
// get the angle as radians
|
376 |
+
svg.Property.prototype.toRadians = function() {
|
377 |
+
if (!this.hasValue()) return 0;
|
378 |
+
var s = this.value+'';
|
379 |
+
if (s.match(/deg$/)) return this.numValue() * (Math.PI / 180.0);
|
380 |
+
if (s.match(/grad$/)) return this.numValue() * (Math.PI / 200.0);
|
381 |
+
if (s.match(/rad$/)) return this.numValue();
|
382 |
+
return this.numValue() * (Math.PI / 180.0);
|
383 |
+
}
|
384 |
+
|
385 |
+
// text extensions
|
386 |
+
// get the text baseline
|
387 |
+
var textBaselineMapping = {
|
388 |
+
'baseline': 'alphabetic',
|
389 |
+
'before-edge': 'top',
|
390 |
+
'text-before-edge': 'top',
|
391 |
+
'middle': 'middle',
|
392 |
+
'central': 'middle',
|
393 |
+
'after-edge': 'bottom',
|
394 |
+
'text-after-edge': 'bottom',
|
395 |
+
'ideographic': 'ideographic',
|
396 |
+
'alphabetic': 'alphabetic',
|
397 |
+
'hanging': 'hanging',
|
398 |
+
'mathematical': 'alphabetic'
|
399 |
+
};
|
400 |
+
svg.Property.prototype.toTextBaseline = function () {
|
401 |
+
if (!this.hasValue()) return null;
|
402 |
+
return textBaselineMapping[this.value];
|
403 |
+
}
|
404 |
+
|
405 |
+
// fonts
|
406 |
+
svg.Font = new (function() {
|
407 |
+
this.Styles = 'normal|italic|oblique|inherit';
|
408 |
+
this.Variants = 'normal|small-caps|inherit';
|
409 |
+
this.Weights = 'normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900|inherit';
|
410 |
+
|
411 |
+
this.CreateFont = function(fontStyle, fontVariant, fontWeight, fontSize, fontFamily, inherit) {
|
412 |
+
var f = inherit != null ? this.Parse(inherit) : this.CreateFont('', '', '', '', '', svg.ctx.font);
|
413 |
+
return {
|
414 |
+
fontFamily: fontFamily || f.fontFamily,
|
415 |
+
fontSize: fontSize || f.fontSize,
|
416 |
+
fontStyle: fontStyle || f.fontStyle,
|
417 |
+
fontWeight: fontWeight || f.fontWeight,
|
418 |
+
fontVariant: fontVariant || f.fontVariant,
|
419 |
+
toString: function () { return [this.fontStyle, this.fontVariant, this.fontWeight, this.fontSize, this.fontFamily].join(' ') }
|
420 |
+
}
|
421 |
+
}
|
422 |
+
|
423 |
+
var that = this;
|
424 |
+
this.Parse = function(s) {
|
425 |
+
var f = {};
|
426 |
+
var d = svg.trim(svg.compressSpaces(s || '')).split(' ');
|
427 |
+
var set = { fontSize: false, fontStyle: false, fontWeight: false, fontVariant: false }
|
428 |
+
var ff = '';
|
429 |
+
for (var i=0; i<d.length; i++) {
|
430 |
+
if (!set.fontStyle && that.Styles.indexOf(d[i]) != -1) { if (d[i] != 'inherit') f.fontStyle = d[i]; set.fontStyle = true; }
|
431 |
+
else if (!set.fontVariant && that.Variants.indexOf(d[i]) != -1) { if (d[i] != 'inherit') f.fontVariant = d[i]; set.fontStyle = set.fontVariant = true; }
|
432 |
+
else if (!set.fontWeight && that.Weights.indexOf(d[i]) != -1) { if (d[i] != 'inherit') f.fontWeight = d[i]; set.fontStyle = set.fontVariant = set.fontWeight = true; }
|
433 |
+
else if (!set.fontSize) { if (d[i] != 'inherit') f.fontSize = d[i].split('/')[0]; set.fontStyle = set.fontVariant = set.fontWeight = set.fontSize = true; }
|
434 |
+
else { if (d[i] != 'inherit') ff += d[i]; }
|
435 |
+
} if (ff != '') f.fontFamily = ff;
|
436 |
+
return f;
|
437 |
+
}
|
438 |
+
});
|
439 |
+
|
440 |
+
// points and paths
|
441 |
+
svg.ToNumberArray = function(s) {
|
442 |
+
var a = svg.trim(svg.compressSpaces((s || '').replace(/,/g, ' '))).split(' ');
|
443 |
+
for (var i=0; i<a.length; i++) {
|
444 |
+
a[i] = parseFloat(a[i]);
|
445 |
+
}
|
446 |
+
return a;
|
447 |
+
}
|
448 |
+
svg.Point = function(x, y) {
|
449 |
+
this.x = x;
|
450 |
+
this.y = y;
|
451 |
+
}
|
452 |
+
svg.Point.prototype.angleTo = function(p) {
|
453 |
+
return Math.atan2(p.y - this.y, p.x - this.x);
|
454 |
+
}
|
455 |
+
|
456 |
+
svg.Point.prototype.applyTransform = function(v) {
|
457 |
+
var xp = this.x * v[0] + this.y * v[2] + v[4];
|
458 |
+
var yp = this.x * v[1] + this.y * v[3] + v[5];
|
459 |
+
this.x = xp;
|
460 |
+
this.y = yp;
|
461 |
+
}
|
462 |
+
|
463 |
+
svg.CreatePoint = function(s) {
|
464 |
+
var a = svg.ToNumberArray(s);
|
465 |
+
return new svg.Point(a[0], a[1]);
|
466 |
+
}
|
467 |
+
svg.CreatePath = function(s) {
|
468 |
+
var a = svg.ToNumberArray(s);
|
469 |
+
var path = [];
|
470 |
+
for (var i=0; i<a.length; i+=2) {
|
471 |
+
path.push(new svg.Point(a[i], a[i+1]));
|
472 |
+
}
|
473 |
+
return path;
|
474 |
+
}
|
475 |
+
|
476 |
+
// bounding box
|
477 |
+
svg.BoundingBox = function(x1, y1, x2, y2) { // pass in initial points if you want
|
478 |
+
this.x1 = Number.NaN;
|
479 |
+
this.y1 = Number.NaN;
|
480 |
+
this.x2 = Number.NaN;
|
481 |
+
this.y2 = Number.NaN;
|
482 |
+
|
483 |
+
this.x = function() { return this.x1; }
|
484 |
+
this.y = function() { return this.y1; }
|
485 |
+
this.width = function() { return this.x2 - this.x1; }
|
486 |
+
this.height = function() { return this.y2 - this.y1; }
|
487 |
+
|
488 |
+
this.addPoint = function(x, y) {
|
489 |
+
if (x != null) {
|
490 |
+
if (isNaN(this.x1) || isNaN(this.x2)) {
|
491 |
+
this.x1 = x;
|
492 |
+
this.x2 = x;
|
493 |
+
}
|
494 |
+
if (x < this.x1) this.x1 = x;
|
495 |
+
if (x > this.x2) this.x2 = x;
|
496 |
+
}
|
497 |
+
|
498 |
+
if (y != null) {
|
499 |
+
if (isNaN(this.y1) || isNaN(this.y2)) {
|
500 |
+
this.y1 = y;
|
501 |
+
this.y2 = y;
|
502 |
+
}
|
503 |
+
if (y < this.y1) this.y1 = y;
|
504 |
+
if (y > this.y2) this.y2 = y;
|
505 |
+
}
|
506 |
+
}
|
507 |
+
this.addX = function(x) { this.addPoint(x, null); }
|
508 |
+
this.addY = function(y) { this.addPoint(null, y); }
|
509 |
+
|
510 |
+
this.addBoundingBox = function(bb) {
|
511 |
+
this.addPoint(bb.x1, bb.y1);
|
512 |
+
this.addPoint(bb.x2, bb.y2);
|
513 |
+
}
|
514 |
+
|
515 |
+
this.addQuadraticCurve = function(p0x, p0y, p1x, p1y, p2x, p2y) {
|
516 |
+
var cp1x = p0x + 2/3 * (p1x - p0x); // CP1 = QP0 + 2/3 *(QP1-QP0)
|
517 |
+
var cp1y = p0y + 2/3 * (p1y - p0y); // CP1 = QP0 + 2/3 *(QP1-QP0)
|
518 |
+
var cp2x = cp1x + 1/3 * (p2x - p0x); // CP2 = CP1 + 1/3 *(QP2-QP0)
|
519 |
+
var cp2y = cp1y + 1/3 * (p2y - p0y); // CP2 = CP1 + 1/3 *(QP2-QP0)
|
520 |
+
this.addBezierCurve(p0x, p0y, cp1x, cp2x, cp1y, cp2y, p2x, p2y);
|
521 |
+
}
|
522 |
+
|
523 |
+
this.addBezierCurve = function(p0x, p0y, p1x, p1y, p2x, p2y, p3x, p3y) {
|
524 |
+
// from http://blog.hackers-cafe.net/2009/06/how-to-calculate-bezier-curves-bounding.html
|
525 |
+
var p0 = [p0x, p0y], p1 = [p1x, p1y], p2 = [p2x, p2y], p3 = [p3x, p3y];
|
526 |
+
this.addPoint(p0[0], p0[1]);
|
527 |
+
this.addPoint(p3[0], p3[1]);
|
528 |
+
|
529 |
+
for (i=0; i<=1; i++) {
|
530 |
+
var f = function(t) {
|
531 |
+
return Math.pow(1-t, 3) * p0[i]
|
532 |
+
+ 3 * Math.pow(1-t, 2) * t * p1[i]
|
533 |
+
+ 3 * (1-t) * Math.pow(t, 2) * p2[i]
|
534 |
+
+ Math.pow(t, 3) * p3[i];
|
535 |
+
}
|
536 |
+
|
537 |
+
var b = 6 * p0[i] - 12 * p1[i] + 6 * p2[i];
|
538 |
+
var a = -3 * p0[i] + 9 * p1[i] - 9 * p2[i] + 3 * p3[i];
|
539 |
+
var c = 3 * p1[i] - 3 * p0[i];
|
540 |
+
|
541 |
+
if (a == 0) {
|
542 |
+
if (b == 0) continue;
|
543 |
+
var t = -c / b;
|
544 |
+
if (0 < t && t < 1) {
|
545 |
+
if (i == 0) this.addX(f(t));
|
546 |
+
if (i == 1) this.addY(f(t));
|
547 |
+
}
|
548 |
+
continue;
|
549 |
+
}
|
550 |
+
|
551 |
+
var b2ac = Math.pow(b, 2) - 4 * c * a;
|
552 |
+
if (b2ac < 0) continue;
|
553 |
+
var t1 = (-b + Math.sqrt(b2ac)) / (2 * a);
|
554 |
+
if (0 < t1 && t1 < 1) {
|
555 |
+
if (i == 0) this.addX(f(t1));
|
556 |
+
if (i == 1) this.addY(f(t1));
|
557 |
+
}
|
558 |
+
var t2 = (-b - Math.sqrt(b2ac)) / (2 * a);
|
559 |
+
if (0 < t2 && t2 < 1) {
|
560 |
+
if (i == 0) this.addX(f(t2));
|
561 |
+
if (i == 1) this.addY(f(t2));
|
562 |
+
}
|
563 |
+
}
|
564 |
+
}
|
565 |
+
|
566 |
+
this.isPointInBox = function(x, y) {
|
567 |
+
return (this.x1 <= x && x <= this.x2 && this.y1 <= y && y <= this.y2);
|
568 |
+
}
|
569 |
+
|
570 |
+
this.addPoint(x1, y1);
|
571 |
+
this.addPoint(x2, y2);
|
572 |
+
}
|
573 |
+
|
574 |
+
// transforms
|
575 |
+
svg.Transform = function(v) {
|
576 |
+
var that = this;
|
577 |
+
this.Type = {}
|
578 |
+
|
579 |
+
// translate
|
580 |
+
this.Type.translate = function(s) {
|
581 |
+
this.p = svg.CreatePoint(s);
|
582 |
+
this.apply = function(ctx) {
|
583 |
+
ctx.translate(this.p.x || 0.0, this.p.y || 0.0);
|
584 |
+
}
|
585 |
+
this.unapply = function(ctx) {
|
586 |
+
ctx.translate(-1.0 * this.p.x || 0.0, -1.0 * this.p.y || 0.0);
|
587 |
+
}
|
588 |
+
this.applyToPoint = function(p) {
|
589 |
+
p.applyTransform([1, 0, 0, 1, this.p.x || 0.0, this.p.y || 0.0]);
|
590 |
+
}
|
591 |
+
}
|
592 |
+
|
593 |
+
// rotate
|
594 |
+
this.Type.rotate = function(s) {
|
595 |
+
var a = svg.ToNumberArray(s);
|
596 |
+
this.angle = new svg.Property('angle', a[0]);
|
597 |
+
this.cx = a[1] || 0;
|
598 |
+
this.cy = a[2] || 0;
|
599 |
+
this.apply = function(ctx) {
|
600 |
+
ctx.translate(this.cx, this.cy);
|
601 |
+
ctx.rotate(this.angle.toRadians());
|
602 |
+
ctx.translate(-this.cx, -this.cy);
|
603 |
+
}
|
604 |
+
this.unapply = function(ctx) {
|
605 |
+
ctx.translate(this.cx, this.cy);
|
606 |
+
ctx.rotate(-1.0 * this.angle.toRadians());
|
607 |
+
ctx.translate(-this.cx, -this.cy);
|
608 |
+
}
|
609 |
+
this.applyToPoint = function(p) {
|
610 |
+
var a = this.angle.toRadians();
|
611 |
+
p.applyTransform([1, 0, 0, 1, this.p.x || 0.0, this.p.y || 0.0]);
|
612 |
+
p.applyTransform([Math.cos(a), Math.sin(a), -Math.sin(a), Math.cos(a), 0, 0]);
|
613 |
+
p.applyTransform([1, 0, 0, 1, -this.p.x || 0.0, -this.p.y || 0.0]);
|
614 |
+
}
|
615 |
+
}
|
616 |
+
|
617 |
+
this.Type.scale = function(s) {
|
618 |
+
this.p = svg.CreatePoint(s);
|
619 |
+
this.apply = function(ctx) {
|
620 |
+
ctx.scale(this.p.x || 1.0, this.p.y || this.p.x || 1.0);
|
621 |
+
}
|
622 |
+
this.unapply = function(ctx) {
|
623 |
+
ctx.scale(1.0 / this.p.x || 1.0, 1.0 / this.p.y || this.p.x || 1.0);
|
624 |
+
}
|
625 |
+
this.applyToPoint = function(p) {
|
626 |
+
p.applyTransform([this.p.x || 0.0, 0, 0, this.p.y || 0.0, 0, 0]);
|
627 |
+
}
|
628 |
+
}
|
629 |
+
|
630 |
+
this.Type.matrix = function(s) {
|
631 |
+
this.m = svg.ToNumberArray(s);
|
632 |
+
this.apply = function(ctx) {
|
633 |
+
ctx.transform(this.m[0], this.m[1], this.m[2], this.m[3], this.m[4], this.m[5]);
|
634 |
+
}
|
635 |
+
this.unapply = function(ctx) {
|
636 |
+
var a = this.m[0];
|
637 |
+
var b = this.m[2];
|
638 |
+
var c = this.m[4];
|
639 |
+
var d = this.m[1];
|
640 |
+
var e = this.m[3];
|
641 |
+
var f = this.m[5];
|
642 |
+
var g = 0.0;
|
643 |
+
var h = 0.0;
|
644 |
+
var i = 1.0;
|
645 |
+
var det = 1 / (a*(e*i-f*h)-b*(d*i-f*g)+c*(d*h-e*g));
|
646 |
+
ctx.transform(
|
647 |
+
det*(e*i-f*h),
|
648 |
+
det*(f*g-d*i),
|
649 |
+
det*(c*h-b*i),
|
650 |
+
det*(a*i-c*g),
|
651 |
+
det*(b*f-c*e),
|
652 |
+
det*(c*d-a*f)
|
653 |
+
);
|
654 |
+
}
|
655 |
+
this.applyToPoint = function(p) {
|
656 |
+
p.applyTransform(this.m);
|
657 |
+
}
|
658 |
+
}
|
659 |
+
|
660 |
+
this.Type.SkewBase = function(s) {
|
661 |
+
this.base = that.Type.matrix;
|
662 |
+
this.base(s);
|
663 |
+
this.angle = new svg.Property('angle', s);
|
664 |
+
}
|
665 |
+
this.Type.SkewBase.prototype = new this.Type.matrix;
|
666 |
+
|
667 |
+
this.Type.skewX = function(s) {
|
668 |
+
this.base = that.Type.SkewBase;
|
669 |
+
this.base(s);
|
670 |
+
this.m = [1, 0, Math.tan(this.angle.toRadians()), 1, 0, 0];
|
671 |
+
}
|
672 |
+
this.Type.skewX.prototype = new this.Type.SkewBase;
|
673 |
+
|
674 |
+
this.Type.skewY = function(s) {
|
675 |
+
this.base = that.Type.SkewBase;
|
676 |
+
this.base(s);
|
677 |
+
this.m = [1, Math.tan(this.angle.toRadians()), 0, 1, 0, 0];
|
678 |
+
}
|
679 |
+
this.Type.skewY.prototype = new this.Type.SkewBase;
|
680 |
+
|
681 |
+
this.transforms = [];
|
682 |
+
|
683 |
+
this.apply = function(ctx) {
|
684 |
+
for (var i=0; i<this.transforms.length; i++) {
|
685 |
+
this.transforms[i].apply(ctx);
|
686 |
+
}
|
687 |
+
}
|
688 |
+
|
689 |
+
this.unapply = function(ctx) {
|
690 |
+
for (var i=this.transforms.length-1; i>=0; i--) {
|
691 |
+
this.transforms[i].unapply(ctx);
|
692 |
+
}
|
693 |
+
}
|
694 |
+
|
695 |
+
this.applyToPoint = function(p) {
|
696 |
+
for (var i=0; i<this.transforms.length; i++) {
|
697 |
+
this.transforms[i].applyToPoint(p);
|
698 |
+
}
|
699 |
+
}
|
700 |
+
|
701 |
+
var data = svg.trim(svg.compressSpaces(v)).replace(/\)([a-zA-Z])/g, ') $1').replace(/\)(\s?,\s?)/g,') ').split(/\s(?=[a-z])/);
|
702 |
+
for (var i=0; i<data.length; i++) {
|
703 |
+
var type = svg.trim(data[i].split('(')[0]);
|
704 |
+
var s = data[i].split('(')[1].replace(')','');
|
705 |
+
var transformType = this.Type[type];
|
706 |
+
if (typeof transformType != 'undefined') {
|
707 |
+
var transform = new transformType(s);
|
708 |
+
transform.type = type;
|
709 |
+
this.transforms.push(transform);
|
710 |
+
}
|
711 |
+
}
|
712 |
+
}
|
713 |
+
|
714 |
+
// aspect ratio
|
715 |
+
svg.AspectRatio = function(ctx, aspectRatio, width, desiredWidth, height, desiredHeight, minX, minY, refX, refY) {
|
716 |
+
// aspect ratio - http://www.w3.org/TR/SVG/coords.html#PreserveAspectRatioAttribute
|
717 |
+
aspectRatio = svg.compressSpaces(aspectRatio);
|
718 |
+
aspectRatio = aspectRatio.replace(/^defer\s/,''); // ignore defer
|
719 |
+
var align = aspectRatio.split(' ')[0] || 'xMidYMid';
|
720 |
+
var meetOrSlice = aspectRatio.split(' ')[1] || 'meet';
|
721 |
+
|
722 |
+
// calculate scale
|
723 |
+
var scaleX = width / desiredWidth;
|
724 |
+
var scaleY = height / desiredHeight;
|
725 |
+
var scaleMin = Math.min(scaleX, scaleY);
|
726 |
+
var scaleMax = Math.max(scaleX, scaleY);
|
727 |
+
if (meetOrSlice == 'meet') { desiredWidth *= scaleMin; desiredHeight *= scaleMin; }
|
728 |
+
if (meetOrSlice == 'slice') { desiredWidth *= scaleMax; desiredHeight *= scaleMax; }
|
729 |
+
|
730 |
+
refX = new svg.Property('refX', refX);
|
731 |
+
refY = new svg.Property('refY', refY);
|
732 |
+
if (refX.hasValue() && refY.hasValue()) {
|
733 |
+
ctx.translate(-scaleMin * refX.toPixels('x'), -scaleMin * refY.toPixels('y'));
|
734 |
+
}
|
735 |
+
else {
|
736 |
+
// align
|
737 |
+
if (align.match(/^xMid/) && ((meetOrSlice == 'meet' && scaleMin == scaleY) || (meetOrSlice == 'slice' && scaleMax == scaleY))) ctx.translate(width / 2.0 - desiredWidth / 2.0, 0);
|
738 |
+
if (align.match(/YMid$/) && ((meetOrSlice == 'meet' && scaleMin == scaleX) || (meetOrSlice == 'slice' && scaleMax == scaleX))) ctx.translate(0, height / 2.0 - desiredHeight / 2.0);
|
739 |
+
if (align.match(/^xMax/) && ((meetOrSlice == 'meet' && scaleMin == scaleY) || (meetOrSlice == 'slice' && scaleMax == scaleY))) ctx.translate(width - desiredWidth, 0);
|
740 |
+
if (align.match(/YMax$/) && ((meetOrSlice == 'meet' && scaleMin == scaleX) || (meetOrSlice == 'slice' && scaleMax == scaleX))) ctx.translate(0, height - desiredHeight);
|
741 |
+
}
|
742 |
+
|
743 |
+
// scale
|
744 |
+
if (align == 'none') ctx.scale(scaleX, scaleY);
|
745 |
+
else if (meetOrSlice == 'meet') ctx.scale(scaleMin, scaleMin);
|
746 |
+
else if (meetOrSlice == 'slice') ctx.scale(scaleMax, scaleMax);
|
747 |
+
|
748 |
+
// translate
|
749 |
+
ctx.translate(minX == null ? 0 : -minX, minY == null ? 0 : -minY);
|
750 |
+
}
|
751 |
+
|
752 |
+
// elements
|
753 |
+
svg.Element = {}
|
754 |
+
|
755 |
+
svg.EmptyProperty = new svg.Property('EMPTY', '');
|
756 |
+
|
757 |
+
svg.Element.ElementBase = function(node) {
|
758 |
+
this.attributes = {};
|
759 |
+
this.styles = {};
|
760 |
+
this.stylesSpecificity = {};
|
761 |
+
this.children = [];
|
762 |
+
|
763 |
+
// get or create attribute
|
764 |
+
this.attribute = function(name, createIfNotExists) {
|
765 |
+
var a = this.attributes[name];
|
766 |
+
if (a != null) return a;
|
767 |
+
|
768 |
+
if (createIfNotExists == true) { a = new svg.Property(name, ''); this.attributes[name] = a; }
|
769 |
+
return a || svg.EmptyProperty;
|
770 |
+
}
|
771 |
+
|
772 |
+
this.getHrefAttribute = function() {
|
773 |
+
for (var a in this.attributes) {
|
774 |
+
if (a == 'href' || a.match(/:href$/)) {
|
775 |
+
return this.attributes[a];
|
776 |
+
}
|
777 |
+
}
|
778 |
+
return svg.EmptyProperty;
|
779 |
+
}
|
780 |
+
|
781 |
+
// get or create style, crawls up node tree
|
782 |
+
this.style = function(name, createIfNotExists, skipAncestors) {
|
783 |
+
var s = this.styles[name];
|
784 |
+
if (s != null) return s;
|
785 |
+
|
786 |
+
var a = this.attribute(name);
|
787 |
+
if (a != null && a.hasValue()) {
|
788 |
+
this.styles[name] = a; // move up to me to cache
|
789 |
+
return a;
|
790 |
+
}
|
791 |
+
|
792 |
+
if (skipAncestors != true) {
|
793 |
+
var p = this.parent;
|
794 |
+
if (p != null) {
|
795 |
+
var ps = p.style(name);
|
796 |
+
if (ps != null && ps.hasValue()) {
|
797 |
+
return ps;
|
798 |
+
}
|
799 |
+
}
|
800 |
+
}
|
801 |
+
|
802 |
+
if (createIfNotExists == true) { s = new svg.Property(name, ''); this.styles[name] = s; }
|
803 |
+
return s || svg.EmptyProperty;
|
804 |
+
}
|
805 |
+
|
806 |
+
// base render
|
807 |
+
this.render = function(ctx) {
|
808 |
+
// don't render display=none
|
809 |
+
if (this.style('display').value == 'none') return;
|
810 |
+
|
811 |
+
// don't render visibility=hidden
|
812 |
+
if (this.style('visibility').value == 'hidden') return;
|
813 |
+
|
814 |
+
ctx.save();
|
815 |
+
if (this.style('mask').hasValue()) { // mask
|
816 |
+
var mask = this.style('mask').getDefinition();
|
817 |
+
if (mask != null) mask.apply(ctx, this);
|
818 |
+
}
|
819 |
+
else if (this.style('filter').hasValue()) { // filter
|
820 |
+
var filter = this.style('filter').getDefinition();
|
821 |
+
if (filter != null) filter.apply(ctx, this);
|
822 |
+
}
|
823 |
+
else {
|
824 |
+
this.setContext(ctx);
|
825 |
+
this.renderChildren(ctx);
|
826 |
+
this.clearContext(ctx);
|
827 |
+
}
|
828 |
+
ctx.restore();
|
829 |
+
}
|
830 |
+
|
831 |
+
// base set context
|
832 |
+
this.setContext = function(ctx) {
|
833 |
+
// OVERRIDE ME!
|
834 |
+
}
|
835 |
+
|
836 |
+
// base clear context
|
837 |
+
this.clearContext = function(ctx) {
|
838 |
+
// OVERRIDE ME!
|
839 |
+
}
|
840 |
+
|
841 |
+
// base render children
|
842 |
+
this.renderChildren = function(ctx) {
|
843 |
+
for (var i=0; i<this.children.length; i++) {
|
844 |
+
this.children[i].render(ctx);
|
845 |
+
}
|
846 |
+
}
|
847 |
+
|
848 |
+
this.addChild = function(childNode, create) {
|
849 |
+
var child = childNode;
|
850 |
+
if (create) child = svg.CreateElement(childNode);
|
851 |
+
child.parent = this;
|
852 |
+
if (child.type != 'title') { this.children.push(child); }
|
853 |
+
}
|
854 |
+
|
855 |
+
this.addStylesFromStyleDefinition = function () {
|
856 |
+
// add styles
|
857 |
+
for (var selector in svg.Styles) {
|
858 |
+
if (selector[0] != '@' && matchesSelector(node, selector)) {
|
859 |
+
var styles = svg.Styles[selector];
|
860 |
+
var specificity = svg.StylesSpecificity[selector];
|
861 |
+
if (styles != null) {
|
862 |
+
for (var name in styles) {
|
863 |
+
var existingSpecificity = this.stylesSpecificity[name];
|
864 |
+
if (typeof existingSpecificity == 'undefined') {
|
865 |
+
existingSpecificity = '000';
|
866 |
+
}
|
867 |
+
if (specificity > existingSpecificity) {
|
868 |
+
this.styles[name] = styles[name];
|
869 |
+
this.stylesSpecificity[name] = specificity;
|
870 |
+
}
|
871 |
+
}
|
872 |
+
}
|
873 |
+
}
|
874 |
+
}
|
875 |
+
};
|
876 |
+
|
877 |
+
// Microsoft Edge fix
|
878 |
+
var allUppercase = new RegExp("^[A-Z\-]+$");
|
879 |
+
var normalizeAttributeName = function (name) {
|
880 |
+
if (allUppercase.test(name)) {
|
881 |
+
return name.toLowerCase();
|
882 |
+
}
|
883 |
+
return name;
|
884 |
+
};
|
885 |
+
|
886 |
+
if (node != null && node.nodeType == 1) { //ELEMENT_NODE
|
887 |
+
// add attributes
|
888 |
+
for (var i=0; i<node.attributes.length; i++) {
|
889 |
+
var attribute = node.attributes[i];
|
890 |
+
var nodeName = normalizeAttributeName(attribute.nodeName);
|
891 |
+
this.attributes[nodeName] = new svg.Property(nodeName, attribute.value);
|
892 |
+
}
|
893 |
+
|
894 |
+
this.addStylesFromStyleDefinition();
|
895 |
+
|
896 |
+
// add inline styles
|
897 |
+
if (this.attribute('style').hasValue()) {
|
898 |
+
var styles = this.attribute('style').value.split(';');
|
899 |
+
for (var i=0; i<styles.length; i++) {
|
900 |
+
if (svg.trim(styles[i]) != '') {
|
901 |
+
var style = styles[i].split(':');
|
902 |
+
var name = svg.trim(style[0]);
|
903 |
+
var value = svg.trim(style[1]);
|
904 |
+
this.styles[name] = new svg.Property(name, value);
|
905 |
+
}
|
906 |
+
}
|
907 |
+
}
|
908 |
+
|
909 |
+
// add id
|
910 |
+
if (this.attribute('id').hasValue()) {
|
911 |
+
if (svg.Definitions[this.attribute('id').value] == null) {
|
912 |
+
svg.Definitions[this.attribute('id').value] = this;
|
913 |
+
}
|
914 |
+
}
|
915 |
+
|
916 |
+
// add children
|
917 |
+
for (var i=0; i<node.childNodes.length; i++) {
|
918 |
+
var childNode = node.childNodes[i];
|
919 |
+
if (childNode.nodeType == 1) this.addChild(childNode, true); //ELEMENT_NODE
|
920 |
+
if (this.captureTextNodes && (childNode.nodeType == 3 || childNode.nodeType == 4)) {
|
921 |
+
var text = childNode.value || childNode.text || childNode.textContent || '';
|
922 |
+
if (svg.compressSpaces(text) != '') {
|
923 |
+
this.addChild(new svg.Element.tspan(childNode), false); // TEXT_NODE
|
924 |
+
}
|
925 |
+
}
|
926 |
+
}
|
927 |
+
}
|
928 |
+
}
|
929 |
+
|
930 |
+
svg.Element.RenderedElementBase = function(node) {
|
931 |
+
this.base = svg.Element.ElementBase;
|
932 |
+
this.base(node);
|
933 |
+
|
934 |
+
this.setContext = function(ctx) {
|
935 |
+
// fill
|
936 |
+
if (this.style('fill').isUrlDefinition()) {
|
937 |
+
var fs = this.style('fill').getFillStyleDefinition(this, this.style('fill-opacity'));
|
938 |
+
if (fs != null) ctx.fillStyle = fs;
|
939 |
+
}
|
940 |
+
else if (this.style('fill').hasValue()) {
|
941 |
+
var fillStyle = this.style('fill');
|
942 |
+
if (fillStyle.value == 'currentColor') fillStyle.value = this.style('color').value;
|
943 |
+
if (fillStyle.value != 'inherit') ctx.fillStyle = (fillStyle.value == 'none' ? 'rgba(0,0,0,0)' : fillStyle.value);
|
944 |
+
}
|
945 |
+
if (this.style('fill-opacity').hasValue()) {
|
946 |
+
var fillStyle = new svg.Property('fill', ctx.fillStyle);
|
947 |
+
fillStyle = fillStyle.addOpacity(this.style('fill-opacity'));
|
948 |
+
ctx.fillStyle = fillStyle.value;
|
949 |
+
}
|
950 |
+
|
951 |
+
// stroke
|
952 |
+
if (this.style('stroke').isUrlDefinition()) {
|
953 |
+
var fs = this.style('stroke').getFillStyleDefinition(this, this.style('stroke-opacity'));
|
954 |
+
if (fs != null) ctx.strokeStyle = fs;
|
955 |
+
}
|
956 |
+
else if (this.style('stroke').hasValue()) {
|
957 |
+
var strokeStyle = this.style('stroke');
|
958 |
+
if (strokeStyle.value == 'currentColor') strokeStyle.value = this.style('color').value;
|
959 |
+
if (strokeStyle.value != 'inherit') ctx.strokeStyle = (strokeStyle.value == 'none' ? 'rgba(0,0,0,0)' : strokeStyle.value);
|
960 |
+
}
|
961 |
+
if (this.style('stroke-opacity').hasValue()) {
|
962 |
+
var strokeStyle = new svg.Property('stroke', ctx.strokeStyle);
|
963 |
+
strokeStyle = strokeStyle.addOpacity(this.style('stroke-opacity'));
|
964 |
+
ctx.strokeStyle = strokeStyle.value;
|
965 |
+
}
|
966 |
+
if (this.style('stroke-width').hasValue()) {
|
967 |
+
var newLineWidth = this.style('stroke-width').toPixels();
|
968 |
+
ctx.lineWidth = newLineWidth == 0 ? 0.001 : newLineWidth; // browsers don't respect 0
|
969 |
+
}
|
970 |
+
if (this.style('stroke-linecap').hasValue()) ctx.lineCap = this.style('stroke-linecap').value;
|
971 |
+
if (this.style('stroke-linejoin').hasValue()) ctx.lineJoin = this.style('stroke-linejoin').value;
|
972 |
+
if (this.style('stroke-miterlimit').hasValue()) ctx.miterLimit = this.style('stroke-miterlimit').value;
|
973 |
+
if (this.style('stroke-dasharray').hasValue() && this.style('stroke-dasharray').value != 'none') {
|
974 |
+
var gaps = svg.ToNumberArray(this.style('stroke-dasharray').value);
|
975 |
+
if (typeof ctx.setLineDash != 'undefined') { ctx.setLineDash(gaps); }
|
976 |
+
else if (typeof ctx.webkitLineDash != 'undefined') { ctx.webkitLineDash = gaps; }
|
977 |
+
else if (typeof ctx.mozDash != 'undefined' && !(gaps.length==1 && gaps[0]==0)) { ctx.mozDash = gaps; }
|
978 |
+
|
979 |
+
var offset = this.style('stroke-dashoffset').numValueOrDefault(1);
|
980 |
+
if (typeof ctx.lineDashOffset != 'undefined') { ctx.lineDashOffset = offset; }
|
981 |
+
else if (typeof ctx.webkitLineDashOffset != 'undefined') { ctx.webkitLineDashOffset = offset; }
|
982 |
+
else if (typeof ctx.mozDashOffset != 'undefined') { ctx.mozDashOffset = offset; }
|
983 |
+
}
|
984 |
+
|
985 |
+
// font
|
986 |
+
if (typeof ctx.font != 'undefined') {
|
987 |
+
ctx.font = svg.Font.CreateFont(
|
988 |
+
this.style('font-style').value,
|
989 |
+
this.style('font-variant').value,
|
990 |
+
this.style('font-weight').value,
|
991 |
+
this.style('font-size').hasValue() ? this.style('font-size').toPixels() + 'px' : '',
|
992 |
+
this.style('font-family').value).toString();
|
993 |
+
}
|
994 |
+
|
995 |
+
// transform
|
996 |
+
if (this.style('transform', false, true).hasValue()) {
|
997 |
+
var transform = new svg.Transform(this.style('transform', false, true).value);
|
998 |
+
transform.apply(ctx);
|
999 |
+
}
|
1000 |
+
|
1001 |
+
// clip
|
1002 |
+
if (this.style('clip-path', false, true).hasValue()) {
|
1003 |
+
var clip = this.style('clip-path', false, true).getDefinition();
|
1004 |
+
if (clip != null) clip.apply(ctx);
|
1005 |
+
}
|
1006 |
+
|
1007 |
+
// opacity
|
1008 |
+
if (this.style('opacity').hasValue()) {
|
1009 |
+
ctx.globalAlpha = this.style('opacity').numValue();
|
1010 |
+
}
|
1011 |
+
}
|
1012 |
+
}
|
1013 |
+
svg.Element.RenderedElementBase.prototype = new svg.Element.ElementBase;
|
1014 |
+
|
1015 |
+
svg.Element.PathElementBase = function(node) {
|
1016 |
+
this.base = svg.Element.RenderedElementBase;
|
1017 |
+
this.base(node);
|
1018 |
+
|
1019 |
+
this.path = function(ctx) {
|
1020 |
+
if (ctx != null) ctx.beginPath();
|
1021 |
+
return new svg.BoundingBox();
|
1022 |
+
}
|
1023 |
+
|
1024 |
+
this.renderChildren = function(ctx) {
|
1025 |
+
this.path(ctx);
|
1026 |
+
svg.Mouse.checkPath(this, ctx);
|
1027 |
+
if (ctx.fillStyle != '') {
|
1028 |
+
if (this.style('fill-rule').valueOrDefault('inherit') != 'inherit') { ctx.fill(this.style('fill-rule').value); }
|
1029 |
+
else { ctx.fill(); }
|
1030 |
+
}
|
1031 |
+
if (ctx.strokeStyle != '') ctx.stroke();
|
1032 |
+
|
1033 |
+
var markers = this.getMarkers();
|
1034 |
+
if (markers != null) {
|
1035 |
+
if (this.style('marker-start').isUrlDefinition()) {
|
1036 |
+
var marker = this.style('marker-start').getDefinition();
|
1037 |
+
marker.render(ctx, markers[0][0], markers[0][1]);
|
1038 |
+
}
|
1039 |
+
if (this.style('marker-mid').isUrlDefinition()) {
|
1040 |
+
var marker = this.style('marker-mid').getDefinition();
|
1041 |
+
for (var i=1;i<markers.length-1;i++) {
|
1042 |
+
marker.render(ctx, markers[i][0], markers[i][1]);
|
1043 |
+
}
|
1044 |
+
}
|
1045 |
+
if (this.style('marker-end').isUrlDefinition()) {
|
1046 |
+
var marker = this.style('marker-end').getDefinition();
|
1047 |
+
marker.render(ctx, markers[markers.length-1][0], markers[markers.length-1][1]);
|
1048 |
+
}
|
1049 |
+
}
|
1050 |
+
}
|
1051 |
+
|
1052 |
+
this.getBoundingBox = function() {
|
1053 |
+
return this.path();
|
1054 |
+
}
|
1055 |
+
|
1056 |
+
this.getMarkers = function() {
|
1057 |
+
return null;
|
1058 |
+
}
|
1059 |
+
}
|
1060 |
+
svg.Element.PathElementBase.prototype = new svg.Element.RenderedElementBase;
|
1061 |
+
|
1062 |
+
// svg element
|
1063 |
+
svg.Element.svg = function(node) {
|
1064 |
+
this.base = svg.Element.RenderedElementBase;
|
1065 |
+
this.base(node);
|
1066 |
+
|
1067 |
+
this.baseClearContext = this.clearContext;
|
1068 |
+
this.clearContext = function(ctx) {
|
1069 |
+
this.baseClearContext(ctx);
|
1070 |
+
svg.ViewPort.RemoveCurrent();
|
1071 |
+
}
|
1072 |
+
|
1073 |
+
this.baseSetContext = this.setContext;
|
1074 |
+
this.setContext = function(ctx) {
|
1075 |
+
// initial values and defaults
|
1076 |
+
ctx.strokeStyle = 'rgba(0,0,0,0)';
|
1077 |
+
ctx.lineCap = 'butt';
|
1078 |
+
ctx.lineJoin = 'miter';
|
1079 |
+
ctx.miterLimit = 4;
|
1080 |
+
if (typeof ctx.font != 'undefined' && typeof window.getComputedStyle != 'undefined') {
|
1081 |
+
ctx.font = window.getComputedStyle(ctx.canvas).getPropertyValue('font');
|
1082 |
+
}
|
1083 |
+
|
1084 |
+
this.baseSetContext(ctx);
|
1085 |
+
|
1086 |
+
// create new view port
|
1087 |
+
if (!this.attribute('x').hasValue()) this.attribute('x', true).value = 0;
|
1088 |
+
if (!this.attribute('y').hasValue()) this.attribute('y', true).value = 0;
|
1089 |
+
ctx.translate(this.attribute('x').toPixels('x'), this.attribute('y').toPixels('y'));
|
1090 |
+
|
1091 |
+
var width = svg.ViewPort.width();
|
1092 |
+
var height = svg.ViewPort.height();
|
1093 |
+
|
1094 |
+
if (!this.attribute('width').hasValue()) this.attribute('width', true).value = '100%';
|
1095 |
+
if (!this.attribute('height').hasValue()) this.attribute('height', true).value = '100%';
|
1096 |
+
if (typeof this.root == 'undefined') {
|
1097 |
+
width = this.attribute('width').toPixels('x');
|
1098 |
+
height = this.attribute('height').toPixels('y');
|
1099 |
+
|
1100 |
+
var x = 0;
|
1101 |
+
var y = 0;
|
1102 |
+
if (this.attribute('refX').hasValue() && this.attribute('refY').hasValue()) {
|
1103 |
+
x = -this.attribute('refX').toPixels('x');
|
1104 |
+
y = -this.attribute('refY').toPixels('y');
|
1105 |
+
}
|
1106 |
+
|
1107 |
+
if (this.attribute('overflow').valueOrDefault('hidden') != 'visible') {
|
1108 |
+
ctx.beginPath();
|
1109 |
+
ctx.moveTo(x, y);
|
1110 |
+
ctx.lineTo(width, y);
|
1111 |
+
ctx.lineTo(width, height);
|
1112 |
+
ctx.lineTo(x, height);
|
1113 |
+
ctx.closePath();
|
1114 |
+
ctx.clip();
|
1115 |
+
}
|
1116 |
+
}
|
1117 |
+
svg.ViewPort.SetCurrent(width, height);
|
1118 |
+
|
1119 |
+
// viewbox
|
1120 |
+
if (this.attribute('viewBox').hasValue()) {
|
1121 |
+
var viewBox = svg.ToNumberArray(this.attribute('viewBox').value);
|
1122 |
+
var minX = viewBox[0];
|
1123 |
+
var minY = viewBox[1];
|
1124 |
+
width = viewBox[2];
|
1125 |
+
height = viewBox[3];
|
1126 |
+
|
1127 |
+
svg.AspectRatio(ctx,
|
1128 |
+
this.attribute('preserveAspectRatio').value,
|
1129 |
+
svg.ViewPort.width(),
|
1130 |
+
width,
|
1131 |
+
svg.ViewPort.height(),
|
1132 |
+
height,
|
1133 |
+
minX,
|
1134 |
+
minY,
|
1135 |
+
this.attribute('refX').value,
|
1136 |
+
this.attribute('refY').value);
|
1137 |
+
|
1138 |
+
svg.ViewPort.RemoveCurrent();
|
1139 |
+
svg.ViewPort.SetCurrent(viewBox[2], viewBox[3]);
|
1140 |
+
}
|
1141 |
+
}
|
1142 |
+
}
|
1143 |
+
svg.Element.svg.prototype = new svg.Element.RenderedElementBase;
|
1144 |
+
|
1145 |
+
// rect element
|
1146 |
+
svg.Element.rect = function(node) {
|
1147 |
+
this.base = svg.Element.PathElementBase;
|
1148 |
+
this.base(node);
|
1149 |
+
|
1150 |
+
this.path = function(ctx) {
|
1151 |
+
var x = this.attribute('x').toPixels('x');
|
1152 |
+
var y = this.attribute('y').toPixels('y');
|
1153 |
+
var width = this.attribute('width').toPixels('x');
|
1154 |
+
var height = this.attribute('height').toPixels('y');
|
1155 |
+
var rx = this.attribute('rx').toPixels('x');
|
1156 |
+
var ry = this.attribute('ry').toPixels('y');
|
1157 |
+
if (this.attribute('rx').hasValue() && !this.attribute('ry').hasValue()) ry = rx;
|
1158 |
+
if (this.attribute('ry').hasValue() && !this.attribute('rx').hasValue()) rx = ry;
|
1159 |
+
rx = Math.min(rx, width / 2.0);
|
1160 |
+
ry = Math.min(ry, height / 2.0);
|
1161 |
+
if (ctx != null) {
|
1162 |
+
ctx.beginPath();
|
1163 |
+
ctx.moveTo(x + rx, y);
|
1164 |
+
ctx.lineTo(x + width - rx, y);
|
1165 |
+
ctx.quadraticCurveTo(x + width, y, x + width, y + ry)
|
1166 |
+
ctx.lineTo(x + width, y + height - ry);
|
1167 |
+
ctx.quadraticCurveTo(x + width, y + height, x + width - rx, y + height)
|
1168 |
+
ctx.lineTo(x + rx, y + height);
|
1169 |
+
ctx.quadraticCurveTo(x, y + height, x, y + height - ry)
|
1170 |
+
ctx.lineTo(x, y + ry);
|
1171 |
+
ctx.quadraticCurveTo(x, y, x + rx, y)
|
1172 |
+
ctx.closePath();
|
1173 |
+
}
|
1174 |
+
|
1175 |
+
return new svg.BoundingBox(x, y, x + width, y + height);
|
1176 |
+
}
|
1177 |
+
}
|
1178 |
+
svg.Element.rect.prototype = new svg.Element.PathElementBase;
|
1179 |
+
|
1180 |
+
// circle element
|
1181 |
+
svg.Element.circle = function(node) {
|
1182 |
+
this.base = svg.Element.PathElementBase;
|
1183 |
+
this.base(node);
|
1184 |
+
|
1185 |
+
this.path = function(ctx) {
|
1186 |
+
var cx = this.attribute('cx').toPixels('x');
|
1187 |
+
var cy = this.attribute('cy').toPixels('y');
|
1188 |
+
var r = this.attribute('r').toPixels();
|
1189 |
+
|
1190 |
+
if (ctx != null) {
|
1191 |
+
ctx.beginPath();
|
1192 |
+
ctx.arc(cx, cy, r, 0, Math.PI * 2, true);
|
1193 |
+
ctx.closePath();
|
1194 |
+
}
|
1195 |
+
|
1196 |
+
return new svg.BoundingBox(cx - r, cy - r, cx + r, cy + r);
|
1197 |
+
}
|
1198 |
+
}
|
1199 |
+
svg.Element.circle.prototype = new svg.Element.PathElementBase;
|
1200 |
+
|
1201 |
+
// ellipse element
|
1202 |
+
svg.Element.ellipse = function(node) {
|
1203 |
+
this.base = svg.Element.PathElementBase;
|
1204 |
+
this.base(node);
|
1205 |
+
|
1206 |
+
this.path = function(ctx) {
|
1207 |
+
var KAPPA = 4 * ((Math.sqrt(2) - 1) / 3);
|
1208 |
+
var rx = this.attribute('rx').toPixels('x');
|
1209 |
+
var ry = this.attribute('ry').toPixels('y');
|
1210 |
+
var cx = this.attribute('cx').toPixels('x');
|
1211 |
+
var cy = this.attribute('cy').toPixels('y');
|
1212 |
+
|
1213 |
+
if (ctx != null) {
|
1214 |
+
ctx.beginPath();
|
1215 |
+
ctx.moveTo(cx, cy - ry);
|
1216 |
+
ctx.bezierCurveTo(cx + (KAPPA * rx), cy - ry, cx + rx, cy - (KAPPA * ry), cx + rx, cy);
|
1217 |
+
ctx.bezierCurveTo(cx + rx, cy + (KAPPA * ry), cx + (KAPPA * rx), cy + ry, cx, cy + ry);
|
1218 |
+
ctx.bezierCurveTo(cx - (KAPPA * rx), cy + ry, cx - rx, cy + (KAPPA * ry), cx - rx, cy);
|
1219 |
+
ctx.bezierCurveTo(cx - rx, cy - (KAPPA * ry), cx - (KAPPA * rx), cy - ry, cx, cy - ry);
|
1220 |
+
ctx.closePath();
|
1221 |
+
}
|
1222 |
+
|
1223 |
+
return new svg.BoundingBox(cx - rx, cy - ry, cx + rx, cy + ry);
|
1224 |
+
}
|
1225 |
+
}
|
1226 |
+
svg.Element.ellipse.prototype = new svg.Element.PathElementBase;
|
1227 |
+
|
1228 |
+
// line element
|
1229 |
+
svg.Element.line = function(node) {
|
1230 |
+
this.base = svg.Element.PathElementBase;
|
1231 |
+
this.base(node);
|
1232 |
+
|
1233 |
+
this.getPoints = function() {
|
1234 |
+
return [
|
1235 |
+
new svg.Point(this.attribute('x1').toPixels('x'), this.attribute('y1').toPixels('y')),
|
1236 |
+
new svg.Point(this.attribute('x2').toPixels('x'), this.attribute('y2').toPixels('y'))];
|
1237 |
+
}
|
1238 |
+
|
1239 |
+
this.path = function(ctx) {
|
1240 |
+
var points = this.getPoints();
|
1241 |
+
|
1242 |
+
if (ctx != null) {
|
1243 |
+
ctx.beginPath();
|
1244 |
+
ctx.moveTo(points[0].x, points[0].y);
|
1245 |
+
ctx.lineTo(points[1].x, points[1].y);
|
1246 |
+
}
|
1247 |
+
|
1248 |
+
return new svg.BoundingBox(points[0].x, points[0].y, points[1].x, points[1].y);
|
1249 |
+
}
|
1250 |
+
|
1251 |
+
this.getMarkers = function() {
|
1252 |
+
var points = this.getPoints();
|
1253 |
+
var a = points[0].angleTo(points[1]);
|
1254 |
+
return [[points[0], a], [points[1], a]];
|
1255 |
+
}
|
1256 |
+
}
|
1257 |
+
svg.Element.line.prototype = new svg.Element.PathElementBase;
|
1258 |
+
|
1259 |
+
// polyline element
|
1260 |
+
svg.Element.polyline = function(node) {
|
1261 |
+
this.base = svg.Element.PathElementBase;
|
1262 |
+
this.base(node);
|
1263 |
+
|
1264 |
+
this.points = svg.CreatePath(this.attribute('points').value);
|
1265 |
+
this.path = function(ctx) {
|
1266 |
+
var bb = new svg.BoundingBox(this.points[0].x, this.points[0].y);
|
1267 |
+
if (ctx != null) {
|
1268 |
+
ctx.beginPath();
|
1269 |
+
ctx.moveTo(this.points[0].x, this.points[0].y);
|
1270 |
+
}
|
1271 |
+
for (var i=1; i<this.points.length; i++) {
|
1272 |
+
bb.addPoint(this.points[i].x, this.points[i].y);
|
1273 |
+
if (ctx != null) ctx.lineTo(this.points[i].x, this.points[i].y);
|
1274 |
+
}
|
1275 |
+
return bb;
|
1276 |
+
}
|
1277 |
+
|
1278 |
+
this.getMarkers = function() {
|
1279 |
+
var markers = [];
|
1280 |
+
for (var i=0; i<this.points.length - 1; i++) {
|
1281 |
+
markers.push([this.points[i], this.points[i].angleTo(this.points[i+1])]);
|
1282 |
+
}
|
1283 |
+
if (markers.length > 0) {
|
1284 |
+
markers.push([this.points[this.points.length-1], markers[markers.length-1][1]]);
|
1285 |
+
}
|
1286 |
+
return markers;
|
1287 |
+
}
|
1288 |
+
}
|
1289 |
+
svg.Element.polyline.prototype = new svg.Element.PathElementBase;
|
1290 |
+
|
1291 |
+
// polygon element
|
1292 |
+
svg.Element.polygon = function(node) {
|
1293 |
+
this.base = svg.Element.polyline;
|
1294 |
+
this.base(node);
|
1295 |
+
|
1296 |
+
this.basePath = this.path;
|
1297 |
+
this.path = function(ctx) {
|
1298 |
+
var bb = this.basePath(ctx);
|
1299 |
+
if (ctx != null) {
|
1300 |
+
ctx.lineTo(this.points[0].x, this.points[0].y);
|
1301 |
+
ctx.closePath();
|
1302 |
+
}
|
1303 |
+
return bb;
|
1304 |
+
}
|
1305 |
+
}
|
1306 |
+
svg.Element.polygon.prototype = new svg.Element.polyline;
|
1307 |
+
|
1308 |
+
// path element
|
1309 |
+
svg.Element.path = function(node) {
|
1310 |
+
this.base = svg.Element.PathElementBase;
|
1311 |
+
this.base(node);
|
1312 |
+
|
1313 |
+
var d = this.attribute('d').value;
|
1314 |
+
// TODO: convert to real lexer based on http://www.w3.org/TR/SVG11/paths.html#PathDataBNF
|
1315 |
+
d = d.replace(/,/gm,' '); // get rid of all commas
|
1316 |
+
// As the end of a match can also be the start of the next match, we need to run this replace twice.
|
1317 |
+
for(var i=0; i<2; i++)
|
1318 |
+
d = d.replace(/([MmZzLlHhVvCcSsQqTtAa])([^\s])/gm,'$1 $2'); // suffix commands with spaces
|
1319 |
+
d = d.replace(/([^\s])([MmZzLlHhVvCcSsQqTtAa])/gm,'$1 $2'); // prefix commands with spaces
|
1320 |
+
d = d.replace(/([0-9])([+\-])/gm,'$1 $2'); // separate digits on +- signs
|
1321 |
+
// Again, we need to run this twice to find all occurances
|
1322 |
+
for(var i=0; i<2; i++)
|
1323 |
+
d = d.replace(/(\.[0-9]*)(\.)/gm,'$1 $2'); // separate digits when they start with a comma
|
1324 |
+
d = d.replace(/([Aa](\s+[0-9]+){3})\s+([01])\s*([01])/gm,'$1 $3 $4 '); // shorthand elliptical arc path syntax
|
1325 |
+
d = svg.compressSpaces(d); // compress multiple spaces
|
1326 |
+
d = svg.trim(d);
|
1327 |
+
this.PathParser = new (function(d) {
|
1328 |
+
this.tokens = d.split(' ');
|
1329 |
+
|
1330 |
+
this.reset = function() {
|
1331 |
+
this.i = -1;
|
1332 |
+
this.command = '';
|
1333 |
+
this.previousCommand = '';
|
1334 |
+
this.start = new svg.Point(0, 0);
|
1335 |
+
this.control = new svg.Point(0, 0);
|
1336 |
+
this.current = new svg.Point(0, 0);
|
1337 |
+
this.points = [];
|
1338 |
+
this.angles = [];
|
1339 |
+
}
|
1340 |
+
|
1341 |
+
this.isEnd = function() {
|
1342 |
+
return this.i >= this.tokens.length - 1;
|
1343 |
+
}
|
1344 |
+
|
1345 |
+
this.isCommandOrEnd = function() {
|
1346 |
+
if (this.isEnd()) return true;
|
1347 |
+
return this.tokens[this.i + 1].match(/^[A-Za-z]$/) != null;
|
1348 |
+
}
|
1349 |
+
|
1350 |
+
this.isRelativeCommand = function() {
|
1351 |
+
switch(this.command)
|
1352 |
+
{
|
1353 |
+
case 'm':
|
1354 |
+
case 'l':
|
1355 |
+
case 'h':
|
1356 |
+
case 'v':
|
1357 |
+
case 'c':
|
1358 |
+
case 's':
|
1359 |
+
case 'q':
|
1360 |
+
case 't':
|
1361 |
+
case 'a':
|
1362 |
+
case 'z':
|
1363 |
+
return true;
|
1364 |
+
break;
|
1365 |
+
}
|
1366 |
+
return false;
|
1367 |
+
}
|
1368 |
+
|
1369 |
+
this.getToken = function() {
|
1370 |
+
this.i++;
|
1371 |
+
return this.tokens[this.i];
|
1372 |
+
}
|
1373 |
+
|
1374 |
+
this.getScalar = function() {
|
1375 |
+
return parseFloat(this.getToken());
|
1376 |
+
}
|
1377 |
+
|
1378 |
+
this.nextCommand = function() {
|
1379 |
+
this.previousCommand = this.command;
|
1380 |
+
this.command = this.getToken();
|
1381 |
+
}
|
1382 |
+
|
1383 |
+
this.getPoint = function() {
|
1384 |
+
var p = new svg.Point(this.getScalar(), this.getScalar());
|
1385 |
+
return this.makeAbsolute(p);
|
1386 |
+
}
|
1387 |
+
|
1388 |
+
this.getAsControlPoint = function() {
|
1389 |
+
var p = this.getPoint();
|
1390 |
+
this.control = p;
|
1391 |
+
return p;
|
1392 |
+
}
|
1393 |
+
|
1394 |
+
this.getAsCurrentPoint = function() {
|
1395 |
+
var p = this.getPoint();
|
1396 |
+
this.current = p;
|
1397 |
+
return p;
|
1398 |
+
}
|
1399 |
+
|
1400 |
+
this.getReflectedControlPoint = function() {
|
1401 |
+
if (this.previousCommand.toLowerCase() != 'c' &&
|
1402 |
+
this.previousCommand.toLowerCase() != 's' &&
|
1403 |
+
this.previousCommand.toLowerCase() != 'q' &&
|
1404 |
+
this.previousCommand.toLowerCase() != 't' ){
|
1405 |
+
return this.current;
|
1406 |
+
}
|
1407 |
+
|
1408 |
+
// reflect point
|
1409 |
+
var p = new svg.Point(2 * this.current.x - this.control.x, 2 * this.current.y - this.control.y);
|
1410 |
+
return p;
|
1411 |
+
}
|
1412 |
+
|
1413 |
+
this.makeAbsolute = function(p) {
|
1414 |
+
if (this.isRelativeCommand()) {
|
1415 |
+
p.x += this.current.x;
|
1416 |
+
p.y += this.current.y;
|
1417 |
+
}
|
1418 |
+
return p;
|
1419 |
+
}
|
1420 |
+
|
1421 |
+
this.addMarker = function(p, from, priorTo) {
|
1422 |
+
// if the last angle isn't filled in because we didn't have this point yet ...
|
1423 |
+
if (priorTo != null && this.angles.length > 0 && this.angles[this.angles.length-1] == null) {
|
1424 |
+
this.angles[this.angles.length-1] = this.points[this.points.length-1].angleTo(priorTo);
|
1425 |
+
}
|
1426 |
+
this.addMarkerAngle(p, from == null ? null : from.angleTo(p));
|
1427 |
+
}
|
1428 |
+
|
1429 |
+
this.addMarkerAngle = function(p, a) {
|
1430 |
+
this.points.push(p);
|
1431 |
+
this.angles.push(a);
|
1432 |
+
}
|
1433 |
+
|
1434 |
+
this.getMarkerPoints = function() { return this.points; }
|
1435 |
+
this.getMarkerAngles = function() {
|
1436 |
+
for (var i=0; i<this.angles.length; i++) {
|
1437 |
+
if (this.angles[i] == null) {
|
1438 |
+
for (var j=i+1; j<this.angles.length; j++) {
|
1439 |
+
if (this.angles[j] != null) {
|
1440 |
+
this.angles[i] = this.angles[j];
|
1441 |
+
break;
|
1442 |
+
}
|
1443 |
+
}
|
1444 |
+
}
|
1445 |
+
}
|
1446 |
+
return this.angles;
|
1447 |
+
}
|
1448 |
+
})(d);
|
1449 |
+
|
1450 |
+
this.path = function(ctx) {
|
1451 |
+
var pp = this.PathParser;
|
1452 |
+
pp.reset();
|
1453 |
+
|
1454 |
+
var bb = new svg.BoundingBox();
|
1455 |
+
if (ctx != null) ctx.beginPath();
|
1456 |
+
while (!pp.isEnd()) {
|
1457 |
+
pp.nextCommand();
|
1458 |
+
switch (pp.command) {
|
1459 |
+
case 'M':
|
1460 |
+
case 'm':
|
1461 |
+
var p = pp.getAsCurrentPoint();
|
1462 |
+
pp.addMarker(p);
|
1463 |
+
bb.addPoint(p.x, p.y);
|
1464 |
+
if (ctx != null) ctx.moveTo(p.x, p.y);
|
1465 |
+
pp.start = pp.current;
|
1466 |
+
while (!pp.isCommandOrEnd()) {
|
1467 |
+
var p = pp.getAsCurrentPoint();
|
1468 |
+
pp.addMarker(p, pp.start);
|
1469 |
+
bb.addPoint(p.x, p.y);
|
1470 |
+
if (ctx != null) ctx.lineTo(p.x, p.y);
|
1471 |
+
}
|
1472 |
+
break;
|
1473 |
+
case 'L':
|
1474 |
+
case 'l':
|
1475 |
+
while (!pp.isCommandOrEnd()) {
|
1476 |
+
var c = pp.current;
|
1477 |
+
var p = pp.getAsCurrentPoint();
|
1478 |
+
pp.addMarker(p, c);
|
1479 |
+
bb.addPoint(p.x, p.y);
|
1480 |
+
if (ctx != null) ctx.lineTo(p.x, p.y);
|
1481 |
+
}
|
1482 |
+
break;
|
1483 |
+
case 'H':
|
1484 |
+
case 'h':
|
1485 |
+
while (!pp.isCommandOrEnd()) {
|
1486 |
+
var newP = new svg.Point((pp.isRelativeCommand() ? pp.current.x : 0) + pp.getScalar(), pp.current.y);
|
1487 |
+
pp.addMarker(newP, pp.current);
|
1488 |
+
pp.current = newP;
|
1489 |
+
bb.addPoint(pp.current.x, pp.current.y);
|
1490 |
+
if (ctx != null) ctx.lineTo(pp.current.x, pp.current.y);
|
1491 |
+
}
|
1492 |
+
break;
|
1493 |
+
case 'V':
|
1494 |
+
case 'v':
|
1495 |
+
while (!pp.isCommandOrEnd()) {
|
1496 |
+
var newP = new svg.Point(pp.current.x, (pp.isRelativeCommand() ? pp.current.y : 0) + pp.getScalar());
|
1497 |
+
pp.addMarker(newP, pp.current);
|
1498 |
+
pp.current = newP;
|
1499 |
+
bb.addPoint(pp.current.x, pp.current.y);
|
1500 |
+
if (ctx != null) ctx.lineTo(pp.current.x, pp.current.y);
|
1501 |
+
}
|
1502 |
+
break;
|
1503 |
+
case 'C':
|
1504 |
+
case 'c':
|
1505 |
+
while (!pp.isCommandOrEnd()) {
|
1506 |
+
var curr = pp.current;
|
1507 |
+
var p1 = pp.getPoint();
|
1508 |
+
var cntrl = pp.getAsControlPoint();
|
1509 |
+
var cp = pp.getAsCurrentPoint();
|
1510 |
+
pp.addMarker(cp, cntrl, p1);
|
1511 |
+
bb.addBezierCurve(curr.x, curr.y, p1.x, p1.y, cntrl.x, cntrl.y, cp.x, cp.y);
|
1512 |
+
if (ctx != null) ctx.bezierCurveTo(p1.x, p1.y, cntrl.x, cntrl.y, cp.x, cp.y);
|
1513 |
+
}
|
1514 |
+
break;
|
1515 |
+
case 'S':
|
1516 |
+
case 's':
|
1517 |
+
while (!pp.isCommandOrEnd()) {
|
1518 |
+
var curr = pp.current;
|
1519 |
+
var p1 = pp.getReflectedControlPoint();
|
1520 |
+
var cntrl = pp.getAsControlPoint();
|
1521 |
+
var cp = pp.getAsCurrentPoint();
|
1522 |
+
pp.addMarker(cp, cntrl, p1);
|
1523 |
+
bb.addBezierCurve(curr.x, curr.y, p1.x, p1.y, cntrl.x, cntrl.y, cp.x, cp.y);
|
1524 |
+
if (ctx != null) ctx.bezierCurveTo(p1.x, p1.y, cntrl.x, cntrl.y, cp.x, cp.y);
|
1525 |
+
}
|
1526 |
+
break;
|
1527 |
+
case 'Q':
|
1528 |
+
case 'q':
|
1529 |
+
while (!pp.isCommandOrEnd()) {
|
1530 |
+
var curr = pp.current;
|
1531 |
+
var cntrl = pp.getAsControlPoint();
|
1532 |
+
var cp = pp.getAsCurrentPoint();
|
1533 |
+
pp.addMarker(cp, cntrl, cntrl);
|
1534 |
+
bb.addQuadraticCurve(curr.x, curr.y, cntrl.x, cntrl.y, cp.x, cp.y);
|
1535 |
+
if (ctx != null) ctx.quadraticCurveTo(cntrl.x, cntrl.y, cp.x, cp.y);
|
1536 |
+
}
|
1537 |
+
break;
|
1538 |
+
case 'T':
|
1539 |
+
case 't':
|
1540 |
+
while (!pp.isCommandOrEnd()) {
|
1541 |
+
var curr = pp.current;
|
1542 |
+
var cntrl = pp.getReflectedControlPoint();
|
1543 |
+
pp.control = cntrl;
|
1544 |
+
var cp = pp.getAsCurrentPoint();
|
1545 |
+
pp.addMarker(cp, cntrl, cntrl);
|
1546 |
+
bb.addQuadraticCurve(curr.x, curr.y, cntrl.x, cntrl.y, cp.x, cp.y);
|
1547 |
+
if (ctx != null) ctx.quadraticCurveTo(cntrl.x, cntrl.y, cp.x, cp.y);
|
1548 |
+
}
|
1549 |
+
break;
|
1550 |
+
case 'A':
|
1551 |
+
case 'a':
|
1552 |
+
while (!pp.isCommandOrEnd()) {
|
1553 |
+
var curr = pp.current;
|
1554 |
+
var rx = pp.getScalar();
|
1555 |
+
var ry = pp.getScalar();
|
1556 |
+
var xAxisRotation = pp.getScalar() * (Math.PI / 180.0);
|
1557 |
+
var largeArcFlag = pp.getScalar();
|
1558 |
+
var sweepFlag = pp.getScalar();
|
1559 |
+
var cp = pp.getAsCurrentPoint();
|
1560 |
+
|
1561 |
+
// Conversion from endpoint to center parameterization
|
1562 |
+
// http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes
|
1563 |
+
// x1', y1'
|
1564 |
+
var currp = new svg.Point(
|
1565 |
+
Math.cos(xAxisRotation) * (curr.x - cp.x) / 2.0 + Math.sin(xAxisRotation) * (curr.y - cp.y) / 2.0,
|
1566 |
+
-Math.sin(xAxisRotation) * (curr.x - cp.x) / 2.0 + Math.cos(xAxisRotation) * (curr.y - cp.y) / 2.0
|
1567 |
+
);
|
1568 |
+
// adjust radii
|
1569 |
+
var l = Math.pow(currp.x,2)/Math.pow(rx,2)+Math.pow(currp.y,2)/Math.pow(ry,2);
|
1570 |
+
if (l > 1) {
|
1571 |
+
rx *= Math.sqrt(l);
|
1572 |
+
ry *= Math.sqrt(l);
|
1573 |
+
}
|
1574 |
+
// cx', cy'
|
1575 |
+
var s = (largeArcFlag == sweepFlag ? -1 : 1) * Math.sqrt(
|
1576 |
+
((Math.pow(rx,2)*Math.pow(ry,2))-(Math.pow(rx,2)*Math.pow(currp.y,2))-(Math.pow(ry,2)*Math.pow(currp.x,2))) /
|
1577 |
+
(Math.pow(rx,2)*Math.pow(currp.y,2)+Math.pow(ry,2)*Math.pow(currp.x,2))
|
1578 |
+
);
|
1579 |
+
if (isNaN(s)) s = 0;
|
1580 |
+
var cpp = new svg.Point(s * rx * currp.y / ry, s * -ry * currp.x / rx);
|
1581 |
+
// cx, cy
|
1582 |
+
var centp = new svg.Point(
|
1583 |
+
(curr.x + cp.x) / 2.0 + Math.cos(xAxisRotation) * cpp.x - Math.sin(xAxisRotation) * cpp.y,
|
1584 |
+
(curr.y + cp.y) / 2.0 + Math.sin(xAxisRotation) * cpp.x + Math.cos(xAxisRotation) * cpp.y
|
1585 |
+
);
|
1586 |
+
// vector magnitude
|
1587 |
+
var m = function(v) { return Math.sqrt(Math.pow(v[0],2) + Math.pow(v[1],2)); }
|
1588 |
+
// ratio between two vectors
|
1589 |
+
var r = function(u, v) { return (u[0]*v[0]+u[1]*v[1]) / (m(u)*m(v)) }
|
1590 |
+
// angle between two vectors
|
1591 |
+
var a = function(u, v) { return (u[0]*v[1] < u[1]*v[0] ? -1 : 1) * Math.acos(r(u,v)); }
|
1592 |
+
// initial angle
|
1593 |
+
var a1 = a([1,0], [(currp.x-cpp.x)/rx,(currp.y-cpp.y)/ry]);
|
1594 |
+
// angle delta
|
1595 |
+
var u = [(currp.x-cpp.x)/rx,(currp.y-cpp.y)/ry];
|
1596 |
+
var v = [(-currp.x-cpp.x)/rx,(-currp.y-cpp.y)/ry];
|
1597 |
+
var ad = a(u, v);
|
1598 |
+
if (r(u,v) <= -1) ad = Math.PI;
|
1599 |
+
if (r(u,v) >= 1) ad = 0;
|
1600 |
+
|
1601 |
+
// for markers
|
1602 |
+
var dir = 1 - sweepFlag ? 1.0 : -1.0;
|
1603 |
+
var ah = a1 + dir * (ad / 2.0);
|
1604 |
+
var halfWay = new svg.Point(
|
1605 |
+
centp.x + rx * Math.cos(ah),
|
1606 |
+
centp.y + ry * Math.sin(ah)
|
1607 |
+
);
|
1608 |
+
pp.addMarkerAngle(halfWay, ah - dir * Math.PI / 2);
|
1609 |
+
pp.addMarkerAngle(cp, ah - dir * Math.PI);
|
1610 |
+
|
1611 |
+
bb.addPoint(cp.x, cp.y); // TODO: this is too naive, make it better
|
1612 |
+
if (ctx != null) {
|
1613 |
+
var r = rx > ry ? rx : ry;
|
1614 |
+
var sx = rx > ry ? 1 : rx / ry;
|
1615 |
+
var sy = rx > ry ? ry / rx : 1;
|
1616 |
+
|
1617 |
+
ctx.translate(centp.x, centp.y);
|
1618 |
+
ctx.rotate(xAxisRotation);
|
1619 |
+
ctx.scale(sx, sy);
|
1620 |
+
ctx.arc(0, 0, r, a1, a1 + ad, 1 - sweepFlag);
|
1621 |
+
ctx.scale(1/sx, 1/sy);
|
1622 |
+
ctx.rotate(-xAxisRotation);
|
1623 |
+
ctx.translate(-centp.x, -centp.y);
|
1624 |
+
}
|
1625 |
+
}
|
1626 |
+
break;
|
1627 |
+
case 'Z':
|
1628 |
+
case 'z':
|
1629 |
+
if (ctx != null) ctx.closePath();
|
1630 |
+
pp.current = pp.start;
|
1631 |
+
}
|
1632 |
+
}
|
1633 |
+
|
1634 |
+
return bb;
|
1635 |
+
}
|
1636 |
+
|
1637 |
+
this.getMarkers = function() {
|
1638 |
+
var points = this.PathParser.getMarkerPoints();
|
1639 |
+
var angles = this.PathParser.getMarkerAngles();
|
1640 |
+
|
1641 |
+
var markers = [];
|
1642 |
+
for (var i=0; i<points.length; i++) {
|
1643 |
+
markers.push([points[i], angles[i]]);
|
1644 |
+
}
|
1645 |
+
return markers;
|
1646 |
+
}
|
1647 |
+
}
|
1648 |
+
svg.Element.path.prototype = new svg.Element.PathElementBase;
|
1649 |
+
|
1650 |
+
// pattern element
|
1651 |
+
svg.Element.pattern = function(node) {
|
1652 |
+
this.base = svg.Element.ElementBase;
|
1653 |
+
this.base(node);
|
1654 |
+
|
1655 |
+
this.createPattern = function(ctx, element) {
|
1656 |
+
var width = this.attribute('width').toPixels('x', true);
|
1657 |
+
var height = this.attribute('height').toPixels('y', true);
|
1658 |
+
|
1659 |
+
// render me using a temporary svg element
|
1660 |
+
var tempSvg = new svg.Element.svg();
|
1661 |
+
tempSvg.attributes['viewBox'] = new svg.Property('viewBox', this.attribute('viewBox').value);
|
1662 |
+
tempSvg.attributes['width'] = new svg.Property('width', width + 'px');
|
1663 |
+
tempSvg.attributes['height'] = new svg.Property('height', height + 'px');
|
1664 |
+
tempSvg.attributes['transform'] = new svg.Property('transform', this.attribute('patternTransform').value);
|
1665 |
+
tempSvg.children = this.children;
|
1666 |
+
|
1667 |
+
var c = document.createElement('canvas');
|
1668 |
+
c.width = width;
|
1669 |
+
c.height = height;
|
1670 |
+
var cctx = c.getContext('2d');
|
1671 |
+
if (this.attribute('x').hasValue() && this.attribute('y').hasValue()) {
|
1672 |
+
cctx.translate(this.attribute('x').toPixels('x', true), this.attribute('y').toPixels('y', true));
|
1673 |
+
}
|
1674 |
+
// render 3x3 grid so when we transform there's no white space on edges
|
1675 |
+
for (var x=-1; x<=1; x++) {
|
1676 |
+
for (var y=-1; y<=1; y++) {
|
1677 |
+
cctx.save();
|
1678 |
+
tempSvg.attributes['x'] = new svg.Property('x', x * c.width);
|
1679 |
+
tempSvg.attributes['y'] = new svg.Property('y', y * c.height);
|
1680 |
+
tempSvg.render(cctx);
|
1681 |
+
cctx.restore();
|
1682 |
+
}
|
1683 |
+
}
|
1684 |
+
var pattern = ctx.createPattern(c, 'repeat');
|
1685 |
+
return pattern;
|
1686 |
+
}
|
1687 |
+
}
|
1688 |
+
svg.Element.pattern.prototype = new svg.Element.ElementBase;
|
1689 |
+
|
1690 |
+
// marker element
|
1691 |
+
svg.Element.marker = function(node) {
|
1692 |
+
this.base = svg.Element.ElementBase;
|
1693 |
+
this.base(node);
|
1694 |
+
|
1695 |
+
this.baseRender = this.render;
|
1696 |
+
this.render = function(ctx, point, angle) {
|
1697 |
+
ctx.translate(point.x, point.y);
|
1698 |
+
if (this.attribute('orient').valueOrDefault('auto') == 'auto') ctx.rotate(angle);
|
1699 |
+
if (this.attribute('markerUnits').valueOrDefault('strokeWidth') == 'strokeWidth') ctx.scale(ctx.lineWidth, ctx.lineWidth);
|
1700 |
+
ctx.save();
|
1701 |
+
|
1702 |
+
// render me using a temporary svg element
|
1703 |
+
var tempSvg = new svg.Element.svg();
|
1704 |
+
tempSvg.attributes['viewBox'] = new svg.Property('viewBox', this.attribute('viewBox').value);
|
1705 |
+
tempSvg.attributes['refX'] = new svg.Property('refX', this.attribute('refX').value);
|
1706 |
+
tempSvg.attributes['refY'] = new svg.Property('refY', this.attribute('refY').value);
|
1707 |
+
tempSvg.attributes['width'] = new svg.Property('width', this.attribute('markerWidth').value);
|
1708 |
+
tempSvg.attributes['height'] = new svg.Property('height', this.attribute('markerHeight').value);
|
1709 |
+
tempSvg.attributes['fill'] = new svg.Property('fill', this.attribute('fill').valueOrDefault('black'));
|
1710 |
+
tempSvg.attributes['stroke'] = new svg.Property('stroke', this.attribute('stroke').valueOrDefault('none'));
|
1711 |
+
tempSvg.children = this.children;
|
1712 |
+
tempSvg.render(ctx);
|
1713 |
+
|
1714 |
+
ctx.restore();
|
1715 |
+
if (this.attribute('markerUnits').valueOrDefault('strokeWidth') == 'strokeWidth') ctx.scale(1/ctx.lineWidth, 1/ctx.lineWidth);
|
1716 |
+
if (this.attribute('orient').valueOrDefault('auto') == 'auto') ctx.rotate(-angle);
|
1717 |
+
ctx.translate(-point.x, -point.y);
|
1718 |
+
}
|
1719 |
+
}
|
1720 |
+
svg.Element.marker.prototype = new svg.Element.ElementBase;
|
1721 |
+
|
1722 |
+
// definitions element
|
1723 |
+
svg.Element.defs = function(node) {
|
1724 |
+
this.base = svg.Element.ElementBase;
|
1725 |
+
this.base(node);
|
1726 |
+
|
1727 |
+
this.render = function(ctx) {
|
1728 |
+
// NOOP
|
1729 |
+
}
|
1730 |
+
}
|
1731 |
+
svg.Element.defs.prototype = new svg.Element.ElementBase;
|
1732 |
+
|
1733 |
+
// base for gradients
|
1734 |
+
svg.Element.GradientBase = function(node) {
|
1735 |
+
this.base = svg.Element.ElementBase;
|
1736 |
+
this.base(node);
|
1737 |
+
|
1738 |
+
this.stops = [];
|
1739 |
+
for (var i=0; i<this.children.length; i++) {
|
1740 |
+
var child = this.children[i];
|
1741 |
+
if (child.type == 'stop') this.stops.push(child);
|
1742 |
+
}
|
1743 |
+
|
1744 |
+
this.getGradient = function() {
|
1745 |
+
// OVERRIDE ME!
|
1746 |
+
}
|
1747 |
+
|
1748 |
+
this.gradientUnits = function () {
|
1749 |
+
return this.attribute('gradientUnits').valueOrDefault('objectBoundingBox');
|
1750 |
+
}
|
1751 |
+
|
1752 |
+
this.attributesToInherit = ['gradientUnits'];
|
1753 |
+
|
1754 |
+
this.inheritStopContainer = function (stopsContainer) {
|
1755 |
+
for (var i=0; i<this.attributesToInherit.length; i++) {
|
1756 |
+
var attributeToInherit = this.attributesToInherit[i];
|
1757 |
+
if (!this.attribute(attributeToInherit).hasValue() && stopsContainer.attribute(attributeToInherit).hasValue()) {
|
1758 |
+
this.attribute(attributeToInherit, true).value = stopsContainer.attribute(attributeToInherit).value;
|
1759 |
+
}
|
1760 |
+
}
|
1761 |
+
}
|
1762 |
+
|
1763 |
+
this.createGradient = function(ctx, element, parentOpacityProp) {
|
1764 |
+
var stopsContainer = this;
|
1765 |
+
if (this.getHrefAttribute().hasValue()) {
|
1766 |
+
stopsContainer = this.getHrefAttribute().getDefinition();
|
1767 |
+
this.inheritStopContainer(stopsContainer);
|
1768 |
+
}
|
1769 |
+
|
1770 |
+
var addParentOpacity = function (color) {
|
1771 |
+
if (parentOpacityProp.hasValue()) {
|
1772 |
+
var p = new svg.Property('color', color);
|
1773 |
+
return p.addOpacity(parentOpacityProp).value;
|
1774 |
+
}
|
1775 |
+
return color;
|
1776 |
+
};
|
1777 |
+
|
1778 |
+
var g = this.getGradient(ctx, element);
|
1779 |
+
if (g == null) return addParentOpacity(stopsContainer.stops[stopsContainer.stops.length - 1].color);
|
1780 |
+
for (var i=0; i<stopsContainer.stops.length; i++) {
|
1781 |
+
g.addColorStop(stopsContainer.stops[i].offset, addParentOpacity(stopsContainer.stops[i].color));
|
1782 |
+
}
|
1783 |
+
|
1784 |
+
if (this.attribute('gradientTransform').hasValue()) {
|
1785 |
+
// render as transformed pattern on temporary canvas
|
1786 |
+
var rootView = svg.ViewPort.viewPorts[0];
|
1787 |
+
|
1788 |
+
var rect = new svg.Element.rect();
|
1789 |
+
rect.attributes['x'] = new svg.Property('x', -svg.MAX_VIRTUAL_PIXELS/3.0);
|
1790 |
+
rect.attributes['y'] = new svg.Property('y', -svg.MAX_VIRTUAL_PIXELS/3.0);
|
1791 |
+
rect.attributes['width'] = new svg.Property('width', svg.MAX_VIRTUAL_PIXELS);
|
1792 |
+
rect.attributes['height'] = new svg.Property('height', svg.MAX_VIRTUAL_PIXELS);
|
1793 |
+
|
1794 |
+
var group = new svg.Element.g();
|
1795 |
+
group.attributes['transform'] = new svg.Property('transform', this.attribute('gradientTransform').value);
|
1796 |
+
group.children = [ rect ];
|
1797 |
+
|
1798 |
+
var tempSvg = new svg.Element.svg();
|
1799 |
+
tempSvg.attributes['x'] = new svg.Property('x', 0);
|
1800 |
+
tempSvg.attributes['y'] = new svg.Property('y', 0);
|
1801 |
+
tempSvg.attributes['width'] = new svg.Property('width', rootView.width);
|
1802 |
+
tempSvg.attributes['height'] = new svg.Property('height', rootView.height);
|
1803 |
+
tempSvg.children = [ group ];
|
1804 |
+
|
1805 |
+
var c = document.createElement('canvas');
|
1806 |
+
c.width = rootView.width;
|
1807 |
+
c.height = rootView.height;
|
1808 |
+
var tempCtx = c.getContext('2d');
|
1809 |
+
tempCtx.fillStyle = g;
|
1810 |
+
tempSvg.render(tempCtx);
|
1811 |
+
return tempCtx.createPattern(c, 'no-repeat');
|
1812 |
+
}
|
1813 |
+
|
1814 |
+
return g;
|
1815 |
+
}
|
1816 |
+
}
|
1817 |
+
svg.Element.GradientBase.prototype = new svg.Element.ElementBase;
|
1818 |
+
|
1819 |
+
// linear gradient element
|
1820 |
+
svg.Element.linearGradient = function(node) {
|
1821 |
+
this.base = svg.Element.GradientBase;
|
1822 |
+
this.base(node);
|
1823 |
+
|
1824 |
+
this.attributesToInherit.push('x1');
|
1825 |
+
this.attributesToInherit.push('y1');
|
1826 |
+
this.attributesToInherit.push('x2');
|
1827 |
+
this.attributesToInherit.push('y2');
|
1828 |
+
|
1829 |
+
this.getGradient = function(ctx, element) {
|
1830 |
+
var bb = this.gradientUnits() == 'objectBoundingBox' ? element.getBoundingBox() : null;
|
1831 |
+
|
1832 |
+
if (!this.attribute('x1').hasValue()
|
1833 |
+
&& !this.attribute('y1').hasValue()
|
1834 |
+
&& !this.attribute('x2').hasValue()
|
1835 |
+
&& !this.attribute('y2').hasValue()) {
|
1836 |
+
this.attribute('x1', true).value = 0;
|
1837 |
+
this.attribute('y1', true).value = 0;
|
1838 |
+
this.attribute('x2', true).value = 1;
|
1839 |
+
this.attribute('y2', true).value = 0;
|
1840 |
+
}
|
1841 |
+
|
1842 |
+
var x1 = (this.gradientUnits() == 'objectBoundingBox'
|
1843 |
+
? bb.x() + bb.width() * this.attribute('x1').numValue()
|
1844 |
+
: this.attribute('x1').toPixels('x'));
|
1845 |
+
var y1 = (this.gradientUnits() == 'objectBoundingBox'
|
1846 |
+
? bb.y() + bb.height() * this.attribute('y1').numValue()
|
1847 |
+
: this.attribute('y1').toPixels('y'));
|
1848 |
+
var x2 = (this.gradientUnits() == 'objectBoundingBox'
|
1849 |
+
? bb.x() + bb.width() * this.attribute('x2').numValue()
|
1850 |
+
: this.attribute('x2').toPixels('x'));
|
1851 |
+
var y2 = (this.gradientUnits() == 'objectBoundingBox'
|
1852 |
+
? bb.y() + bb.height() * this.attribute('y2').numValue()
|
1853 |
+
: this.attribute('y2').toPixels('y'));
|
1854 |
+
|
1855 |
+
if (x1 == x2 && y1 == y2) return null;
|
1856 |
+
return ctx.createLinearGradient(x1, y1, x2, y2);
|
1857 |
+
}
|
1858 |
+
}
|
1859 |
+
svg.Element.linearGradient.prototype = new svg.Element.GradientBase;
|
1860 |
+
|
1861 |
+
// radial gradient element
|
1862 |
+
svg.Element.radialGradient = function(node) {
|
1863 |
+
this.base = svg.Element.GradientBase;
|
1864 |
+
this.base(node);
|
1865 |
+
|
1866 |
+
this.attributesToInherit.push('cx');
|
1867 |
+
this.attributesToInherit.push('cy');
|
1868 |
+
this.attributesToInherit.push('r');
|
1869 |
+
this.attributesToInherit.push('fx');
|
1870 |
+
this.attributesToInherit.push('fy');
|
1871 |
+
|
1872 |
+
this.getGradient = function(ctx, element) {
|
1873 |
+
var bb = element.getBoundingBox();
|
1874 |
+
|
1875 |
+
if (!this.attribute('cx').hasValue()) this.attribute('cx', true).value = '50%';
|
1876 |
+
if (!this.attribute('cy').hasValue()) this.attribute('cy', true).value = '50%';
|
1877 |
+
if (!this.attribute('r').hasValue()) this.attribute('r', true).value = '50%';
|
1878 |
+
|
1879 |
+
var cx = (this.gradientUnits() == 'objectBoundingBox'
|
1880 |
+
? bb.x() + bb.width() * this.attribute('cx').numValue()
|
1881 |
+
: this.attribute('cx').toPixels('x'));
|
1882 |
+
var cy = (this.gradientUnits() == 'objectBoundingBox'
|
1883 |
+
? bb.y() + bb.height() * this.attribute('cy').numValue()
|
1884 |
+
: this.attribute('cy').toPixels('y'));
|
1885 |
+
|
1886 |
+
var fx = cx;
|
1887 |
+
var fy = cy;
|
1888 |
+
if (this.attribute('fx').hasValue()) {
|
1889 |
+
fx = (this.gradientUnits() == 'objectBoundingBox'
|
1890 |
+
? bb.x() + bb.width() * this.attribute('fx').numValue()
|
1891 |
+
: this.attribute('fx').toPixels('x'));
|
1892 |
+
}
|
1893 |
+
if (this.attribute('fy').hasValue()) {
|
1894 |
+
fy = (this.gradientUnits() == 'objectBoundingBox'
|
1895 |
+
? bb.y() + bb.height() * this.attribute('fy').numValue()
|
1896 |
+
: this.attribute('fy').toPixels('y'));
|
1897 |
+
}
|
1898 |
+
|
1899 |
+
var r = (this.gradientUnits() == 'objectBoundingBox'
|
1900 |
+
? (bb.width() + bb.height()) / 2.0 * this.attribute('r').numValue()
|
1901 |
+
: this.attribute('r').toPixels());
|
1902 |
+
|
1903 |
+
return ctx.createRadialGradient(fx, fy, 0, cx, cy, r);
|
1904 |
+
}
|
1905 |
+
}
|
1906 |
+
svg.Element.radialGradient.prototype = new svg.Element.GradientBase;
|
1907 |
+
|
1908 |
+
// gradient stop element
|
1909 |
+
svg.Element.stop = function(node) {
|
1910 |
+
this.base = svg.Element.ElementBase;
|
1911 |
+
this.base(node);
|
1912 |
+
|
1913 |
+
this.offset = this.attribute('offset').numValue();
|
1914 |
+
if (this.offset < 0) this.offset = 0;
|
1915 |
+
if (this.offset > 1) this.offset = 1;
|
1916 |
+
|
1917 |
+
var stopColor = this.style('stop-color', true);
|
1918 |
+
if (stopColor.value === '') stopColor.value = '#000';
|
1919 |
+
if (this.style('stop-opacity').hasValue()) stopColor = stopColor.addOpacity(this.style('stop-opacity'));
|
1920 |
+
this.color = stopColor.value;
|
1921 |
+
}
|
1922 |
+
svg.Element.stop.prototype = new svg.Element.ElementBase;
|
1923 |
+
|
1924 |
+
// animation base element
|
1925 |
+
svg.Element.AnimateBase = function(node) {
|
1926 |
+
this.base = svg.Element.ElementBase;
|
1927 |
+
this.base(node);
|
1928 |
+
|
1929 |
+
svg.Animations.push(this);
|
1930 |
+
|
1931 |
+
this.duration = 0.0;
|
1932 |
+
this.begin = this.attribute('begin').toMilliseconds();
|
1933 |
+
this.maxDuration = this.begin + this.attribute('dur').toMilliseconds();
|
1934 |
+
|
1935 |
+
this.getProperty = function() {
|
1936 |
+
var attributeType = this.attribute('attributeType').value;
|
1937 |
+
var attributeName = this.attribute('attributeName').value;
|
1938 |
+
|
1939 |
+
if (attributeType == 'CSS') {
|
1940 |
+
return this.parent.style(attributeName, true);
|
1941 |
+
}
|
1942 |
+
return this.parent.attribute(attributeName, true);
|
1943 |
+
};
|
1944 |
+
|
1945 |
+
this.initialValue = null;
|
1946 |
+
this.initialUnits = '';
|
1947 |
+
this.removed = false;
|
1948 |
+
|
1949 |
+
this.calcValue = function() {
|
1950 |
+
// OVERRIDE ME!
|
1951 |
+
return '';
|
1952 |
+
}
|
1953 |
+
|
1954 |
+
this.update = function(delta) {
|
1955 |
+
// set initial value
|
1956 |
+
if (this.initialValue == null) {
|
1957 |
+
this.initialValue = this.getProperty().value;
|
1958 |
+
this.initialUnits = this.getProperty().getUnits();
|
1959 |
+
}
|
1960 |
+
|
1961 |
+
// if we're past the end time
|
1962 |
+
if (this.duration > this.maxDuration) {
|
1963 |
+
// loop for indefinitely repeating animations
|
1964 |
+
if (this.attribute('repeatCount').value == 'indefinite'
|
1965 |
+
|| this.attribute('repeatDur').value == 'indefinite') {
|
1966 |
+
this.duration = 0.0
|
1967 |
+
}
|
1968 |
+
else if (this.attribute('fill').valueOrDefault('remove') == 'freeze' && !this.frozen) {
|
1969 |
+
this.frozen = true;
|
1970 |
+
this.parent.animationFrozen = true;
|
1971 |
+
this.parent.animationFrozenValue = this.getProperty().value;
|
1972 |
+
}
|
1973 |
+
else if (this.attribute('fill').valueOrDefault('remove') == 'remove' && !this.removed) {
|
1974 |
+
this.removed = true;
|
1975 |
+
this.getProperty().value = this.parent.animationFrozen ? this.parent.animationFrozenValue : this.initialValue;
|
1976 |
+
return true;
|
1977 |
+
}
|
1978 |
+
return false;
|
1979 |
+
}
|
1980 |
+
this.duration = this.duration + delta;
|
1981 |
+
|
1982 |
+
// if we're past the begin time
|
1983 |
+
var updated = false;
|
1984 |
+
if (this.begin < this.duration) {
|
1985 |
+
var newValue = this.calcValue(); // tween
|
1986 |
+
|
1987 |
+
if (this.attribute('type').hasValue()) {
|
1988 |
+
// for transform, etc.
|
1989 |
+
var type = this.attribute('type').value;
|
1990 |
+
newValue = type + '(' + newValue + ')';
|
1991 |
+
}
|
1992 |
+
|
1993 |
+
this.getProperty().value = newValue;
|
1994 |
+
updated = true;
|
1995 |
+
}
|
1996 |
+
|
1997 |
+
return updated;
|
1998 |
+
}
|
1999 |
+
|
2000 |
+
this.from = this.attribute('from');
|
2001 |
+
this.to = this.attribute('to');
|
2002 |
+
this.values = this.attribute('values');
|
2003 |
+
if (this.values.hasValue()) this.values.value = this.values.value.split(';');
|
2004 |
+
|
2005 |
+
// fraction of duration we've covered
|
2006 |
+
this.progress = function() {
|
2007 |
+
var ret = { progress: (this.duration - this.begin) / (this.maxDuration - this.begin) };
|
2008 |
+
if (this.values.hasValue()) {
|
2009 |
+
var p = ret.progress * (this.values.value.length - 1);
|
2010 |
+
var lb = Math.floor(p), ub = Math.ceil(p);
|
2011 |
+
ret.from = new svg.Property('from', parseFloat(this.values.value[lb]));
|
2012 |
+
ret.to = new svg.Property('to', parseFloat(this.values.value[ub]));
|
2013 |
+
ret.progress = (p - lb) / (ub - lb);
|
2014 |
+
}
|
2015 |
+
else {
|
2016 |
+
ret.from = this.from;
|
2017 |
+
ret.to = this.to;
|
2018 |
+
}
|
2019 |
+
return ret;
|
2020 |
+
}
|
2021 |
+
}
|
2022 |
+
svg.Element.AnimateBase.prototype = new svg.Element.ElementBase;
|
2023 |
+
|
2024 |
+
// animate element
|
2025 |
+
svg.Element.animate = function(node) {
|
2026 |
+
this.base = svg.Element.AnimateBase;
|
2027 |
+
this.base(node);
|
2028 |
+
|
2029 |
+
this.calcValue = function() {
|
2030 |
+
var p = this.progress();
|
2031 |
+
|
2032 |
+
// tween value linearly
|
2033 |
+
var newValue = p.from.numValue() + (p.to.numValue() - p.from.numValue()) * p.progress;
|
2034 |
+
return newValue + this.initialUnits;
|
2035 |
+
};
|
2036 |
+
}
|
2037 |
+
svg.Element.animate.prototype = new svg.Element.AnimateBase;
|
2038 |
+
|
2039 |
+
// animate color element
|
2040 |
+
svg.Element.animateColor = function(node) {
|
2041 |
+
this.base = svg.Element.AnimateBase;
|
2042 |
+
this.base(node);
|
2043 |
+
|
2044 |
+
this.calcValue = function() {
|
2045 |
+
var p = this.progress();
|
2046 |
+
var from = new RGBColor(p.from.value);
|
2047 |
+
var to = new RGBColor(p.to.value);
|
2048 |
+
|
2049 |
+
if (from.ok && to.ok) {
|
2050 |
+
// tween color linearly
|
2051 |
+
var r = from.r + (to.r - from.r) * p.progress;
|
2052 |
+
var g = from.g + (to.g - from.g) * p.progress;
|
2053 |
+
var b = from.b + (to.b - from.b) * p.progress;
|
2054 |
+
return 'rgb('+parseInt(r,10)+','+parseInt(g,10)+','+parseInt(b,10)+')';
|
2055 |
+
}
|
2056 |
+
return this.attribute('from').value;
|
2057 |
+
};
|
2058 |
+
}
|
2059 |
+
svg.Element.animateColor.prototype = new svg.Element.AnimateBase;
|
2060 |
+
|
2061 |
+
// animate transform element
|
2062 |
+
svg.Element.animateTransform = function(node) {
|
2063 |
+
this.base = svg.Element.AnimateBase;
|
2064 |
+
this.base(node);
|
2065 |
+
|
2066 |
+
this.calcValue = function() {
|
2067 |
+
var p = this.progress();
|
2068 |
+
|
2069 |
+
// tween value linearly
|
2070 |
+
var from = svg.ToNumberArray(p.from.value);
|
2071 |
+
var to = svg.ToNumberArray(p.to.value);
|
2072 |
+
var newValue = '';
|
2073 |
+
for (var i=0; i<from.length; i++) {
|
2074 |
+
newValue += from[i] + (to[i] - from[i]) * p.progress + ' ';
|
2075 |
+
}
|
2076 |
+
return newValue;
|
2077 |
+
};
|
2078 |
+
}
|
2079 |
+
svg.Element.animateTransform.prototype = new svg.Element.animate;
|
2080 |
+
|
2081 |
+
// font element
|
2082 |
+
svg.Element.font = function(node) {
|
2083 |
+
this.base = svg.Element.ElementBase;
|
2084 |
+
this.base(node);
|
2085 |
+
|
2086 |
+
this.horizAdvX = this.attribute('horiz-adv-x').numValue();
|
2087 |
+
|
2088 |
+
this.isRTL = false;
|
2089 |
+
this.isArabic = false;
|
2090 |
+
this.fontFace = null;
|
2091 |
+
this.missingGlyph = null;
|
2092 |
+
this.glyphs = [];
|
2093 |
+
for (var i=0; i<this.children.length; i++) {
|
2094 |
+
var child = this.children[i];
|
2095 |
+
if (child.type == 'font-face') {
|
2096 |
+
this.fontFace = child;
|
2097 |
+
if (child.style('font-family').hasValue()) {
|
2098 |
+
svg.Definitions[child.style('font-family').value] = this;
|
2099 |
+
}
|
2100 |
+
}
|
2101 |
+
else if (child.type == 'missing-glyph') this.missingGlyph = child;
|
2102 |
+
else if (child.type == 'glyph') {
|
2103 |
+
if (child.arabicForm != '') {
|
2104 |
+
this.isRTL = true;
|
2105 |
+
this.isArabic = true;
|
2106 |
+
if (typeof this.glyphs[child.unicode] == 'undefined') this.glyphs[child.unicode] = [];
|
2107 |
+
this.glyphs[child.unicode][child.arabicForm] = child;
|
2108 |
+
}
|
2109 |
+
else {
|
2110 |
+
this.glyphs[child.unicode] = child;
|
2111 |
+
}
|
2112 |
+
}
|
2113 |
+
}
|
2114 |
+
}
|
2115 |
+
svg.Element.font.prototype = new svg.Element.ElementBase;
|
2116 |
+
|
2117 |
+
// font-face element
|
2118 |
+
svg.Element.fontface = function(node) {
|
2119 |
+
this.base = svg.Element.ElementBase;
|
2120 |
+
this.base(node);
|
2121 |
+
|
2122 |
+
this.ascent = this.attribute('ascent').value;
|
2123 |
+
this.descent = this.attribute('descent').value;
|
2124 |
+
this.unitsPerEm = this.attribute('units-per-em').numValue();
|
2125 |
+
}
|
2126 |
+
svg.Element.fontface.prototype = new svg.Element.ElementBase;
|
2127 |
+
|
2128 |
+
// missing-glyph element
|
2129 |
+
svg.Element.missingglyph = function(node) {
|
2130 |
+
this.base = svg.Element.path;
|
2131 |
+
this.base(node);
|
2132 |
+
|
2133 |
+
this.horizAdvX = 0;
|
2134 |
+
}
|
2135 |
+
svg.Element.missingglyph.prototype = new svg.Element.path;
|
2136 |
+
|
2137 |
+
// glyph element
|
2138 |
+
svg.Element.glyph = function(node) {
|
2139 |
+
this.base = svg.Element.path;
|
2140 |
+
this.base(node);
|
2141 |
+
|
2142 |
+
this.horizAdvX = this.attribute('horiz-adv-x').numValue();
|
2143 |
+
this.unicode = this.attribute('unicode').value;
|
2144 |
+
this.arabicForm = this.attribute('arabic-form').value;
|
2145 |
+
}
|
2146 |
+
svg.Element.glyph.prototype = new svg.Element.path;
|
2147 |
+
|
2148 |
+
// text element
|
2149 |
+
svg.Element.text = function(node) {
|
2150 |
+
this.captureTextNodes = true;
|
2151 |
+
this.base = svg.Element.RenderedElementBase;
|
2152 |
+
this.base(node);
|
2153 |
+
|
2154 |
+
this.baseSetContext = this.setContext;
|
2155 |
+
this.setContext = function(ctx) {
|
2156 |
+
this.baseSetContext(ctx);
|
2157 |
+
|
2158 |
+
var textBaseline = this.style('dominant-baseline').toTextBaseline();
|
2159 |
+
if (textBaseline == null) textBaseline = this.style('alignment-baseline').toTextBaseline();
|
2160 |
+
if (textBaseline != null) ctx.textBaseline = textBaseline;
|
2161 |
+
}
|
2162 |
+
|
2163 |
+
this.getBoundingBox = function () {
|
2164 |
+
var x = this.attribute('x').toPixels('x');
|
2165 |
+
var y = this.attribute('y').toPixels('y');
|
2166 |
+
var fontSize = this.parent.style('font-size').numValueOrDefault(svg.Font.Parse(svg.ctx.font).fontSize);
|
2167 |
+
return new svg.BoundingBox(x, y - fontSize, x + Math.floor(fontSize * 2.0 / 3.0) * this.children[0].getText().length, y);
|
2168 |
+
}
|
2169 |
+
|
2170 |
+
this.renderChildren = function(ctx) {
|
2171 |
+
this.x = this.attribute('x').toPixels('x');
|
2172 |
+
this.y = this.attribute('y').toPixels('y');
|
2173 |
+
if (this.attribute('dx').hasValue()) this.x += this.attribute('dx').toPixels('x');
|
2174 |
+
if (this.attribute('dy').hasValue()) this.y += this.attribute('dy').toPixels('y');
|
2175 |
+
this.x += this.getAnchorDelta(ctx, this, 0);
|
2176 |
+
for (var i=0; i<this.children.length; i++) {
|
2177 |
+
this.renderChild(ctx, this, this, i);
|
2178 |
+
}
|
2179 |
+
}
|
2180 |
+
|
2181 |
+
this.getAnchorDelta = function (ctx, parent, startI) {
|
2182 |
+
var textAnchor = this.style('text-anchor').valueOrDefault('start');
|
2183 |
+
if (textAnchor != 'start') {
|
2184 |
+
var width = 0;
|
2185 |
+
for (var i=startI; i<parent.children.length; i++) {
|
2186 |
+
var child = parent.children[i];
|
2187 |
+
if (i > startI && child.attribute('x').hasValue()) break; // new group
|
2188 |
+
width += child.measureTextRecursive(ctx);
|
2189 |
+
}
|
2190 |
+
return -1 * (textAnchor == 'end' ? width : width / 2.0);
|
2191 |
+
}
|
2192 |
+
return 0;
|
2193 |
+
}
|
2194 |
+
|
2195 |
+
this.renderChild = function(ctx, textParent, parent, i) {
|
2196 |
+
var child = parent.children[i];
|
2197 |
+
if (child.attribute('x').hasValue()) {
|
2198 |
+
child.x = child.attribute('x').toPixels('x') + textParent.getAnchorDelta(ctx, parent, i);
|
2199 |
+
if (child.attribute('dx').hasValue()) child.x += child.attribute('dx').toPixels('x');
|
2200 |
+
}
|
2201 |
+
else {
|
2202 |
+
if (child.attribute('dx').hasValue()) textParent.x += child.attribute('dx').toPixels('x');
|
2203 |
+
child.x = textParent.x;
|
2204 |
+
}
|
2205 |
+
textParent.x = child.x + child.measureText(ctx);
|
2206 |
+
|
2207 |
+
if (child.attribute('y').hasValue()) {
|
2208 |
+
child.y = child.attribute('y').toPixels('y');
|
2209 |
+
if (child.attribute('dy').hasValue()) child.y += child.attribute('dy').toPixels('y');
|
2210 |
+
}
|
2211 |
+
else {
|
2212 |
+
if (child.attribute('dy').hasValue()) textParent.y += child.attribute('dy').toPixels('y');
|
2213 |
+
child.y = textParent.y;
|
2214 |
+
}
|
2215 |
+
textParent.y = child.y;
|
2216 |
+
|
2217 |
+
child.render(ctx);
|
2218 |
+
|
2219 |
+
for (var i=0; i<child.children.length; i++) {
|
2220 |
+
textParent.renderChild(ctx, textParent, child, i);
|
2221 |
+
}
|
2222 |
+
}
|
2223 |
+
}
|
2224 |
+
svg.Element.text.prototype = new svg.Element.RenderedElementBase;
|
2225 |
+
|
2226 |
+
// text base
|
2227 |
+
svg.Element.TextElementBase = function(node) {
|
2228 |
+
this.base = svg.Element.RenderedElementBase;
|
2229 |
+
this.base(node);
|
2230 |
+
|
2231 |
+
this.getGlyph = function(font, text, i) {
|
2232 |
+
var c = text[i];
|
2233 |
+
var glyph = null;
|
2234 |
+
if (font.isArabic) {
|
2235 |
+
var arabicForm = 'isolated';
|
2236 |
+
if ((i==0 || text[i-1]==' ') && i<text.length-2 && text[i+1]!=' ') arabicForm = 'terminal';
|
2237 |
+
if (i>0 && text[i-1]!=' ' && i<text.length-2 && text[i+1]!=' ') arabicForm = 'medial';
|
2238 |
+
if (i>0 && text[i-1]!=' ' && (i == text.length-1 || text[i+1]==' ')) arabicForm = 'initial';
|
2239 |
+
if (typeof font.glyphs[c] != 'undefined') {
|
2240 |
+
glyph = font.glyphs[c][arabicForm];
|
2241 |
+
if (glyph == null && font.glyphs[c].type == 'glyph') glyph = font.glyphs[c];
|
2242 |
+
}
|
2243 |
+
}
|
2244 |
+
else {
|
2245 |
+
glyph = font.glyphs[c];
|
2246 |
+
}
|
2247 |
+
if (glyph == null) glyph = font.missingGlyph;
|
2248 |
+
return glyph;
|
2249 |
+
}
|
2250 |
+
|
2251 |
+
this.renderChildren = function(ctx) {
|
2252 |
+
var customFont = this.parent.style('font-family').getDefinition();
|
2253 |
+
if (customFont != null) {
|
2254 |
+
var fontSize = this.parent.style('font-size').numValueOrDefault(svg.Font.Parse(svg.ctx.font).fontSize);
|
2255 |
+
var fontStyle = this.parent.style('font-style').valueOrDefault(svg.Font.Parse(svg.ctx.font).fontStyle);
|
2256 |
+
var text = this.getText();
|
2257 |
+
if (customFont.isRTL) text = text.split("").reverse().join("");
|
2258 |
+
|
2259 |
+
var dx = svg.ToNumberArray(this.parent.attribute('dx').value);
|
2260 |
+
for (var i=0; i<text.length; i++) {
|
2261 |
+
var glyph = this.getGlyph(customFont, text, i);
|
2262 |
+
var scale = fontSize / customFont.fontFace.unitsPerEm;
|
2263 |
+
ctx.translate(this.x, this.y);
|
2264 |
+
ctx.scale(scale, -scale);
|
2265 |
+
var lw = ctx.lineWidth;
|
2266 |
+
ctx.lineWidth = ctx.lineWidth * customFont.fontFace.unitsPerEm / fontSize;
|
2267 |
+
if (fontStyle == 'italic') ctx.transform(1, 0, .4, 1, 0, 0);
|
2268 |
+
glyph.render(ctx);
|
2269 |
+
if (fontStyle == 'italic') ctx.transform(1, 0, -.4, 1, 0, 0);
|
2270 |
+
ctx.lineWidth = lw;
|
2271 |
+
ctx.scale(1/scale, -1/scale);
|
2272 |
+
ctx.translate(-this.x, -this.y);
|
2273 |
+
|
2274 |
+
this.x += fontSize * (glyph.horizAdvX || customFont.horizAdvX) / customFont.fontFace.unitsPerEm;
|
2275 |
+
if (typeof dx[i] != 'undefined' && !isNaN(dx[i])) {
|
2276 |
+
this.x += dx[i];
|
2277 |
+
}
|
2278 |
+
}
|
2279 |
+
return;
|
2280 |
+
}
|
2281 |
+
|
2282 |
+
if (ctx.fillStyle != '') ctx.fillText(svg.compressSpaces(this.getText()), this.x, this.y);
|
2283 |
+
if (ctx.strokeStyle != '') ctx.strokeText(svg.compressSpaces(this.getText()), this.x, this.y);
|
2284 |
+
}
|
2285 |
+
|
2286 |
+
this.getText = function() {
|
2287 |
+
// OVERRIDE ME
|
2288 |
+
}
|
2289 |
+
|
2290 |
+
this.measureTextRecursive = function(ctx) {
|
2291 |
+
var width = this.measureText(ctx);
|
2292 |
+
for (var i=0; i<this.children.length; i++) {
|
2293 |
+
width += this.children[i].measureTextRecursive(ctx);
|
2294 |
+
}
|
2295 |
+
return width;
|
2296 |
+
}
|
2297 |
+
|
2298 |
+
this.measureText = function(ctx) {
|
2299 |
+
var customFont = this.parent.style('font-family').getDefinition();
|
2300 |
+
if (customFont != null) {
|
2301 |
+
var fontSize = this.parent.style('font-size').numValueOrDefault(svg.Font.Parse(svg.ctx.font).fontSize);
|
2302 |
+
var measure = 0;
|
2303 |
+
var text = this.getText();
|
2304 |
+
if (customFont.isRTL) text = text.split("").reverse().join("");
|
2305 |
+
var dx = svg.ToNumberArray(this.parent.attribute('dx').value);
|
2306 |
+
for (var i=0; i<text.length; i++) {
|
2307 |
+
var glyph = this.getGlyph(customFont, text, i);
|
2308 |
+
measure += (glyph.horizAdvX || customFont.horizAdvX) * fontSize / customFont.fontFace.unitsPerEm;
|
2309 |
+
if (typeof dx[i] != 'undefined' && !isNaN(dx[i])) {
|
2310 |
+
measure += dx[i];
|
2311 |
+
}
|
2312 |
+
}
|
2313 |
+
return measure;
|
2314 |
+
}
|
2315 |
+
|
2316 |
+
var textToMeasure = svg.compressSpaces(this.getText());
|
2317 |
+
if (!ctx.measureText) return textToMeasure.length * 10;
|
2318 |
+
|
2319 |
+
ctx.save();
|
2320 |
+
this.setContext(ctx);
|
2321 |
+
var width = ctx.measureText(textToMeasure).width;
|
2322 |
+
ctx.restore();
|
2323 |
+
return width;
|
2324 |
+
}
|
2325 |
+
}
|
2326 |
+
svg.Element.TextElementBase.prototype = new svg.Element.RenderedElementBase;
|
2327 |
+
|
2328 |
+
// tspan
|
2329 |
+
svg.Element.tspan = function(node) {
|
2330 |
+
this.captureTextNodes = true;
|
2331 |
+
this.base = svg.Element.TextElementBase;
|
2332 |
+
this.base(node);
|
2333 |
+
|
2334 |
+
this.text = svg.compressSpaces(node.value || node.text || node.textContent || '');
|
2335 |
+
this.getText = function() {
|
2336 |
+
// if this node has children, then they own the text
|
2337 |
+
if (this.children.length > 0) { return ''; }
|
2338 |
+
return this.text;
|
2339 |
+
}
|
2340 |
+
}
|
2341 |
+
svg.Element.tspan.prototype = new svg.Element.TextElementBase;
|
2342 |
+
|
2343 |
+
// tref
|
2344 |
+
svg.Element.tref = function(node) {
|
2345 |
+
this.base = svg.Element.TextElementBase;
|
2346 |
+
this.base(node);
|
2347 |
+
|
2348 |
+
this.getText = function() {
|
2349 |
+
var element = this.getHrefAttribute().getDefinition();
|
2350 |
+
if (element != null) return element.children[0].getText();
|
2351 |
+
}
|
2352 |
+
}
|
2353 |
+
svg.Element.tref.prototype = new svg.Element.TextElementBase;
|
2354 |
+
|
2355 |
+
// a element
|
2356 |
+
svg.Element.a = function(node) {
|
2357 |
+
this.base = svg.Element.TextElementBase;
|
2358 |
+
this.base(node);
|
2359 |
+
|
2360 |
+
this.hasText = node.childNodes.length > 0;
|
2361 |
+
for (var i=0; i<node.childNodes.length; i++) {
|
2362 |
+
if (node.childNodes[i].nodeType != 3) this.hasText = false;
|
2363 |
+
}
|
2364 |
+
|
2365 |
+
// this might contain text
|
2366 |
+
this.text = this.hasText ? node.childNodes[0].value : '';
|
2367 |
+
this.getText = function() {
|
2368 |
+
return this.text;
|
2369 |
+
}
|
2370 |
+
|
2371 |
+
this.baseRenderChildren = this.renderChildren;
|
2372 |
+
this.renderChildren = function(ctx) {
|
2373 |
+
if (this.hasText) {
|
2374 |
+
// render as text element
|
2375 |
+
this.baseRenderChildren(ctx);
|
2376 |
+
var fontSize = new svg.Property('fontSize', svg.Font.Parse(svg.ctx.font).fontSize);
|
2377 |
+
svg.Mouse.checkBoundingBox(this, new svg.BoundingBox(this.x, this.y - fontSize.toPixels('y'), this.x + this.measureText(ctx), this.y));
|
2378 |
+
}
|
2379 |
+
else if (this.children.length > 0) {
|
2380 |
+
// render as temporary group
|
2381 |
+
var g = new svg.Element.g();
|
2382 |
+
g.children = this.children;
|
2383 |
+
g.parent = this;
|
2384 |
+
g.render(ctx);
|
2385 |
+
}
|
2386 |
+
}
|
2387 |
+
|
2388 |
+
this.onclick = function() {
|
2389 |
+
window.open(this.getHrefAttribute().value);
|
2390 |
+
}
|
2391 |
+
|
2392 |
+
this.onmousemove = function() {
|
2393 |
+
svg.ctx.canvas.style.cursor = 'pointer';
|
2394 |
+
}
|
2395 |
+
}
|
2396 |
+
svg.Element.a.prototype = new svg.Element.TextElementBase;
|
2397 |
+
|
2398 |
+
// image element
|
2399 |
+
svg.Element.image = function(node) {
|
2400 |
+
this.base = svg.Element.RenderedElementBase;
|
2401 |
+
this.base(node);
|
2402 |
+
|
2403 |
+
var href = this.getHrefAttribute().value;
|
2404 |
+
if (href == '') { return; }
|
2405 |
+
var isSvg = href.match(/\.svg$/)
|
2406 |
+
|
2407 |
+
svg.Images.push(this);
|
2408 |
+
this.loaded = false;
|
2409 |
+
if (!isSvg) {
|
2410 |
+
this.img = document.createElement('img');
|
2411 |
+
if (svg.opts['useCORS'] == true) { this.img.crossOrigin = 'Anonymous'; }
|
2412 |
+
var self = this;
|
2413 |
+
this.img.onload = function() { self.loaded = true; }
|
2414 |
+
this.img.onerror = function() { svg.log('ERROR: image "' + href + '" not found'); self.loaded = true; }
|
2415 |
+
this.img.src = href;
|
2416 |
+
}
|
2417 |
+
else {
|
2418 |
+
this.img = svg.ajax(href);
|
2419 |
+
this.loaded = true;
|
2420 |
+
}
|
2421 |
+
|
2422 |
+
this.renderChildren = function(ctx) {
|
2423 |
+
var x = this.attribute('x').toPixels('x');
|
2424 |
+
var y = this.attribute('y').toPixels('y');
|
2425 |
+
|
2426 |
+
var width = this.attribute('width').toPixels('x');
|
2427 |
+
var height = this.attribute('height').toPixels('y');
|
2428 |
+
if (width == 0 || height == 0) return;
|
2429 |
+
|
2430 |
+
ctx.save();
|
2431 |
+
if (isSvg) {
|
2432 |
+
ctx.drawSvg(this.img, x, y, width, height);
|
2433 |
+
}
|
2434 |
+
else {
|
2435 |
+
ctx.translate(x, y);
|
2436 |
+
svg.AspectRatio(ctx,
|
2437 |
+
this.attribute('preserveAspectRatio').value,
|
2438 |
+
width,
|
2439 |
+
this.img.width,
|
2440 |
+
height,
|
2441 |
+
this.img.height,
|
2442 |
+
0,
|
2443 |
+
0);
|
2444 |
+
ctx.drawImage(this.img, 0, 0);
|
2445 |
+
}
|
2446 |
+
ctx.restore();
|
2447 |
+
}
|
2448 |
+
|
2449 |
+
this.getBoundingBox = function() {
|
2450 |
+
var x = this.attribute('x').toPixels('x');
|
2451 |
+
var y = this.attribute('y').toPixels('y');
|
2452 |
+
var width = this.attribute('width').toPixels('x');
|
2453 |
+
var height = this.attribute('height').toPixels('y');
|
2454 |
+
return new svg.BoundingBox(x, y, x + width, y + height);
|
2455 |
+
}
|
2456 |
+
}
|
2457 |
+
svg.Element.image.prototype = new svg.Element.RenderedElementBase;
|
2458 |
+
|
2459 |
+
// group element
|
2460 |
+
svg.Element.g = function(node) {
|
2461 |
+
this.base = svg.Element.RenderedElementBase;
|
2462 |
+
this.base(node);
|
2463 |
+
|
2464 |
+
this.getBoundingBox = function() {
|
2465 |
+
var bb = new svg.BoundingBox();
|
2466 |
+
for (var i=0; i<this.children.length; i++) {
|
2467 |
+
bb.addBoundingBox(this.children[i].getBoundingBox());
|
2468 |
+
}
|
2469 |
+
return bb;
|
2470 |
+
};
|
2471 |
+
}
|
2472 |
+
svg.Element.g.prototype = new svg.Element.RenderedElementBase;
|
2473 |
+
|
2474 |
+
// symbol element
|
2475 |
+
svg.Element.symbol = function(node) {
|
2476 |
+
this.base = svg.Element.RenderedElementBase;
|
2477 |
+
this.base(node);
|
2478 |
+
|
2479 |
+
this.render = function(ctx) {
|
2480 |
+
// NO RENDER
|
2481 |
+
};
|
2482 |
+
}
|
2483 |
+
svg.Element.symbol.prototype = new svg.Element.RenderedElementBase;
|
2484 |
+
|
2485 |
+
// style element
|
2486 |
+
svg.Element.style = function(node) {
|
2487 |
+
this.base = svg.Element.ElementBase;
|
2488 |
+
this.base(node);
|
2489 |
+
|
2490 |
+
// text, or spaces then CDATA
|
2491 |
+
var css = ''
|
2492 |
+
for (var i=0; i<node.childNodes.length; i++) {
|
2493 |
+
css += node.childNodes[i].data;
|
2494 |
+
}
|
2495 |
+
css = css.replace(/(\/\*([^*]|[\r\n]|(\*+([^*\/]|[\r\n])))*\*+\/)|(^[\s]*\/\/.*)/gm, ''); // remove comments
|
2496 |
+
css = svg.compressSpaces(css); // replace whitespace
|
2497 |
+
var cssDefs = css.split('}');
|
2498 |
+
for (var i=0; i<cssDefs.length; i++) {
|
2499 |
+
if (svg.trim(cssDefs[i]) != '') {
|
2500 |
+
var cssDef = cssDefs[i].split('{');
|
2501 |
+
var cssClasses = cssDef[0].split(',');
|
2502 |
+
var cssProps = cssDef[1].split(';');
|
2503 |
+
for (var j=0; j<cssClasses.length; j++) {
|
2504 |
+
var cssClass = svg.trim(cssClasses[j]);
|
2505 |
+
if (cssClass != '') {
|
2506 |
+
var props = svg.Styles[cssClass] || {};
|
2507 |
+
for (var k=0; k<cssProps.length; k++) {
|
2508 |
+
var prop = cssProps[k].indexOf(':');
|
2509 |
+
var name = cssProps[k].substr(0, prop);
|
2510 |
+
var value = cssProps[k].substr(prop + 1, cssProps[k].length - prop);
|
2511 |
+
if (name != null && value != null) {
|
2512 |
+
props[svg.trim(name)] = new svg.Property(svg.trim(name), svg.trim(value));
|
2513 |
+
}
|
2514 |
+
}
|
2515 |
+
svg.Styles[cssClass] = props;
|
2516 |
+
svg.StylesSpecificity[cssClass] = getSelectorSpecificity(cssClass);
|
2517 |
+
if (cssClass == '@font-face') {
|
2518 |
+
var fontFamily = props['font-family'].value.replace(/"/g,'');
|
2519 |
+
var srcs = props['src'].value.split(',');
|
2520 |
+
for (var s=0; s<srcs.length; s++) {
|
2521 |
+
if (srcs[s].indexOf('format("svg")') > 0) {
|
2522 |
+
var urlStart = srcs[s].indexOf('url');
|
2523 |
+
var urlEnd = srcs[s].indexOf(')', urlStart);
|
2524 |
+
var url = srcs[s].substr(urlStart + 5, urlEnd - urlStart - 6);
|
2525 |
+
var doc = svg.parseXml(svg.ajax(url));
|
2526 |
+
var fonts = doc.getElementsByTagName('font');
|
2527 |
+
for (var f=0; f<fonts.length; f++) {
|
2528 |
+
var font = svg.CreateElement(fonts[f]);
|
2529 |
+
svg.Definitions[fontFamily] = font;
|
2530 |
+
}
|
2531 |
+
}
|
2532 |
+
}
|
2533 |
+
}
|
2534 |
+
}
|
2535 |
+
}
|
2536 |
+
}
|
2537 |
+
}
|
2538 |
+
}
|
2539 |
+
svg.Element.style.prototype = new svg.Element.ElementBase;
|
2540 |
+
|
2541 |
+
// use element
|
2542 |
+
svg.Element.use = function(node) {
|
2543 |
+
this.base = svg.Element.RenderedElementBase;
|
2544 |
+
this.base(node);
|
2545 |
+
|
2546 |
+
this.baseSetContext = this.setContext;
|
2547 |
+
this.setContext = function(ctx) {
|
2548 |
+
this.baseSetContext(ctx);
|
2549 |
+
if (this.attribute('x').hasValue()) ctx.translate(this.attribute('x').toPixels('x'), 0);
|
2550 |
+
if (this.attribute('y').hasValue()) ctx.translate(0, this.attribute('y').toPixels('y'));
|
2551 |
+
}
|
2552 |
+
|
2553 |
+
var element = this.getHrefAttribute().getDefinition();
|
2554 |
+
|
2555 |
+
this.path = function(ctx) {
|
2556 |
+
if (element != null) element.path(ctx);
|
2557 |
+
}
|
2558 |
+
|
2559 |
+
this.getBoundingBox = function() {
|
2560 |
+
if (element != null) return element.getBoundingBox();
|
2561 |
+
}
|
2562 |
+
|
2563 |
+
this.renderChildren = function(ctx) {
|
2564 |
+
if (element != null) {
|
2565 |
+
var tempSvg = element;
|
2566 |
+
if (element.type == 'symbol') {
|
2567 |
+
// render me using a temporary svg element in symbol cases (http://www.w3.org/TR/SVG/struct.html#UseElement)
|
2568 |
+
tempSvg = new svg.Element.svg();
|
2569 |
+
tempSvg.type = 'svg';
|
2570 |
+
tempSvg.attributes['viewBox'] = new svg.Property('viewBox', element.attribute('viewBox').value);
|
2571 |
+
tempSvg.attributes['preserveAspectRatio'] = new svg.Property('preserveAspectRatio', element.attribute('preserveAspectRatio').value);
|
2572 |
+
tempSvg.attributes['overflow'] = new svg.Property('overflow', element.attribute('overflow').value);
|
2573 |
+
tempSvg.children = element.children;
|
2574 |
+
}
|
2575 |
+
if (tempSvg.type == 'svg') {
|
2576 |
+
// if symbol or svg, inherit width/height from me
|
2577 |
+
if (this.attribute('width').hasValue()) tempSvg.attributes['width'] = new svg.Property('width', this.attribute('width').value);
|
2578 |
+
if (this.attribute('height').hasValue()) tempSvg.attributes['height'] = new svg.Property('height', this.attribute('height').value);
|
2579 |
+
}
|
2580 |
+
var oldParent = tempSvg.parent;
|
2581 |
+
tempSvg.parent = null;
|
2582 |
+
tempSvg.render(ctx);
|
2583 |
+
tempSvg.parent = oldParent;
|
2584 |
+
}
|
2585 |
+
}
|
2586 |
+
}
|
2587 |
+
svg.Element.use.prototype = new svg.Element.RenderedElementBase;
|
2588 |
+
|
2589 |
+
// mask element
|
2590 |
+
svg.Element.mask = function(node) {
|
2591 |
+
this.base = svg.Element.ElementBase;
|
2592 |
+
this.base(node);
|
2593 |
+
|
2594 |
+
this.apply = function(ctx, element) {
|
2595 |
+
// render as temp svg
|
2596 |
+
var x = this.attribute('x').toPixels('x');
|
2597 |
+
var y = this.attribute('y').toPixels('y');
|
2598 |
+
var width = this.attribute('width').toPixels('x');
|
2599 |
+
var height = this.attribute('height').toPixels('y');
|
2600 |
+
|
2601 |
+
if (width == 0 && height == 0) {
|
2602 |
+
var bb = new svg.BoundingBox();
|
2603 |
+
for (var i=0; i<this.children.length; i++) {
|
2604 |
+
bb.addBoundingBox(this.children[i].getBoundingBox());
|
2605 |
+
}
|
2606 |
+
var x = Math.floor(bb.x1);
|
2607 |
+
var y = Math.floor(bb.y1);
|
2608 |
+
var width = Math.floor(bb.width());
|
2609 |
+
var height = Math.floor(bb.height());
|
2610 |
+
}
|
2611 |
+
|
2612 |
+
// temporarily remove mask to avoid recursion
|
2613 |
+
var mask = element.attribute('mask').value;
|
2614 |
+
element.attribute('mask').value = '';
|
2615 |
+
|
2616 |
+
var cMask = document.createElement('canvas');
|
2617 |
+
cMask.width = x + width;
|
2618 |
+
cMask.height = y + height;
|
2619 |
+
var maskCtx = cMask.getContext('2d');
|
2620 |
+
this.renderChildren(maskCtx);
|
2621 |
+
|
2622 |
+
var c = document.createElement('canvas');
|
2623 |
+
c.width = x + width;
|
2624 |
+
c.height = y + height;
|
2625 |
+
var tempCtx = c.getContext('2d');
|
2626 |
+
element.render(tempCtx);
|
2627 |
+
tempCtx.globalCompositeOperation = 'destination-in';
|
2628 |
+
tempCtx.fillStyle = maskCtx.createPattern(cMask, 'no-repeat');
|
2629 |
+
tempCtx.fillRect(0, 0, x + width, y + height);
|
2630 |
+
|
2631 |
+
ctx.fillStyle = tempCtx.createPattern(c, 'no-repeat');
|
2632 |
+
ctx.fillRect(0, 0, x + width, y + height);
|
2633 |
+
|
2634 |
+
// reassign mask
|
2635 |
+
element.attribute('mask').value = mask;
|
2636 |
+
}
|
2637 |
+
|
2638 |
+
this.render = function(ctx) {
|
2639 |
+
// NO RENDER
|
2640 |
+
}
|
2641 |
+
}
|
2642 |
+
svg.Element.mask.prototype = new svg.Element.ElementBase;
|
2643 |
+
|
2644 |
+
// clip element
|
2645 |
+
svg.Element.clipPath = function(node) {
|
2646 |
+
this.base = svg.Element.ElementBase;
|
2647 |
+
this.base(node);
|
2648 |
+
|
2649 |
+
this.apply = function(ctx) {
|
2650 |
+
var oldBeginPath = CanvasRenderingContext2D.prototype.beginPath;
|
2651 |
+
CanvasRenderingContext2D.prototype.beginPath = function () { };
|
2652 |
+
|
2653 |
+
var oldClosePath = CanvasRenderingContext2D.prototype.closePath;
|
2654 |
+
CanvasRenderingContext2D.prototype.closePath = function () { };
|
2655 |
+
|
2656 |
+
oldBeginPath.call(ctx);
|
2657 |
+
for (var i=0; i<this.children.length; i++) {
|
2658 |
+
var child = this.children[i];
|
2659 |
+
if (typeof child.path != 'undefined') {
|
2660 |
+
var transform = null;
|
2661 |
+
if (child.style('transform', false, true).hasValue()) {
|
2662 |
+
transform = new svg.Transform(child.style('transform', false, true).value);
|
2663 |
+
transform.apply(ctx);
|
2664 |
+
}
|
2665 |
+
child.path(ctx);
|
2666 |
+
CanvasRenderingContext2D.prototype.closePath = oldClosePath;
|
2667 |
+
if (transform) { transform.unapply(ctx); }
|
2668 |
+
}
|
2669 |
+
}
|
2670 |
+
oldClosePath.call(ctx);
|
2671 |
+
ctx.clip();
|
2672 |
+
|
2673 |
+
CanvasRenderingContext2D.prototype.beginPath = oldBeginPath;
|
2674 |
+
CanvasRenderingContext2D.prototype.closePath = oldClosePath;
|
2675 |
+
}
|
2676 |
+
|
2677 |
+
this.render = function(ctx) {
|
2678 |
+
// NO RENDER
|
2679 |
+
}
|
2680 |
+
}
|
2681 |
+
svg.Element.clipPath.prototype = new svg.Element.ElementBase;
|
2682 |
+
|
2683 |
+
// filters
|
2684 |
+
svg.Element.filter = function(node) {
|
2685 |
+
this.base = svg.Element.ElementBase;
|
2686 |
+
this.base(node);
|
2687 |
+
|
2688 |
+
this.apply = function(ctx, element) {
|
2689 |
+
// render as temp svg
|
2690 |
+
var bb = element.getBoundingBox();
|
2691 |
+
var x = Math.floor(bb.x1);
|
2692 |
+
var y = Math.floor(bb.y1);
|
2693 |
+
var width = Math.floor(bb.width());
|
2694 |
+
var height = Math.floor(bb.height());
|
2695 |
+
|
2696 |
+
// temporarily remove filter to avoid recursion
|
2697 |
+
var filter = element.style('filter').value;
|
2698 |
+
element.style('filter').value = '';
|
2699 |
+
|
2700 |
+
var px = 0, py = 0;
|
2701 |
+
for (var i=0; i<this.children.length; i++) {
|
2702 |
+
var efd = this.children[i].extraFilterDistance || 0;
|
2703 |
+
px = Math.max(px, efd);
|
2704 |
+
py = Math.max(py, efd);
|
2705 |
+
}
|
2706 |
+
|
2707 |
+
var c = document.createElement('canvas');
|
2708 |
+
c.width = width + 2*px;
|
2709 |
+
c.height = height + 2*py;
|
2710 |
+
var tempCtx = c.getContext('2d');
|
2711 |
+
tempCtx.translate(-x + px, -y + py);
|
2712 |
+
element.render(tempCtx);
|
2713 |
+
|
2714 |
+
// apply filters
|
2715 |
+
for (var i=0; i<this.children.length; i++) {
|
2716 |
+
if (typeof this.children[i].apply == 'function') {
|
2717 |
+
this.children[i].apply(tempCtx, 0, 0, width + 2*px, height + 2*py);
|
2718 |
+
}
|
2719 |
+
}
|
2720 |
+
|
2721 |
+
// render on me
|
2722 |
+
ctx.drawImage(c, 0, 0, width + 2*px, height + 2*py, x - px, y - py, width + 2*px, height + 2*py);
|
2723 |
+
|
2724 |
+
// reassign filter
|
2725 |
+
element.style('filter', true).value = filter;
|
2726 |
+
}
|
2727 |
+
|
2728 |
+
this.render = function(ctx) {
|
2729 |
+
// NO RENDER
|
2730 |
+
}
|
2731 |
+
}
|
2732 |
+
svg.Element.filter.prototype = new svg.Element.ElementBase;
|
2733 |
+
|
2734 |
+
svg.Element.feMorphology = function(node) {
|
2735 |
+
this.base = svg.Element.ElementBase;
|
2736 |
+
this.base(node);
|
2737 |
+
|
2738 |
+
this.apply = function(ctx, x, y, width, height) {
|
2739 |
+
// TODO: implement
|
2740 |
+
}
|
2741 |
+
}
|
2742 |
+
svg.Element.feMorphology.prototype = new svg.Element.ElementBase;
|
2743 |
+
|
2744 |
+
svg.Element.feComposite = function(node) {
|
2745 |
+
this.base = svg.Element.ElementBase;
|
2746 |
+
this.base(node);
|
2747 |
+
|
2748 |
+
this.apply = function(ctx, x, y, width, height) {
|
2749 |
+
// TODO: implement
|
2750 |
+
}
|
2751 |
+
}
|
2752 |
+
svg.Element.feComposite.prototype = new svg.Element.ElementBase;
|
2753 |
+
|
2754 |
+
svg.Element.feColorMatrix = function(node) {
|
2755 |
+
this.base = svg.Element.ElementBase;
|
2756 |
+
this.base(node);
|
2757 |
+
|
2758 |
+
var matrix = svg.ToNumberArray(this.attribute('values').value);
|
2759 |
+
switch (this.attribute('type').valueOrDefault('matrix')) { // http://www.w3.org/TR/SVG/filters.html#feColorMatrixElement
|
2760 |
+
case 'saturate':
|
2761 |
+
var s = matrix[0];
|
2762 |
+
matrix = [0.213+0.787*s,0.715-0.715*s,0.072-0.072*s,0,0,
|
2763 |
+
0.213-0.213*s,0.715+0.285*s,0.072-0.072*s,0,0,
|
2764 |
+
0.213-0.213*s,0.715-0.715*s,0.072+0.928*s,0,0,
|
2765 |
+
0,0,0,1,0,
|
2766 |
+
0,0,0,0,1];
|
2767 |
+
break;
|
2768 |
+
case 'hueRotate':
|
2769 |
+
var a = matrix[0] * Math.PI / 180.0;
|
2770 |
+
var c = function (m1,m2,m3) { return m1 + Math.cos(a)*m2 + Math.sin(a)*m3; };
|
2771 |
+
matrix = [c(0.213,0.787,-0.213),c(0.715,-0.715,-0.715),c(0.072,-0.072,0.928),0,0,
|
2772 |
+
c(0.213,-0.213,0.143),c(0.715,0.285,0.140),c(0.072,-0.072,-0.283),0,0,
|
2773 |
+
c(0.213,-0.213,-0.787),c(0.715,-0.715,0.715),c(0.072,0.928,0.072),0,0,
|
2774 |
+
0,0,0,1,0,
|
2775 |
+
0,0,0,0,1];
|
2776 |
+
break;
|
2777 |
+
case 'luminanceToAlpha':
|
2778 |
+
matrix = [0,0,0,0,0,
|
2779 |
+
0,0,0,0,0,
|
2780 |
+
0,0,0,0,0,
|
2781 |
+
0.2125,0.7154,0.0721,0,0,
|
2782 |
+
0,0,0,0,1];
|
2783 |
+
break;
|
2784 |
+
}
|
2785 |
+
|
2786 |
+
function imGet(img, x, y, width, height, rgba) {
|
2787 |
+
return img[y*width*4 + x*4 + rgba];
|
2788 |
+
}
|
2789 |
+
|
2790 |
+
function imSet(img, x, y, width, height, rgba, val) {
|
2791 |
+
img[y*width*4 + x*4 + rgba] = val;
|
2792 |
+
}
|
2793 |
+
|
2794 |
+
function m(i, v) {
|
2795 |
+
var mi = matrix[i];
|
2796 |
+
return mi * (mi < 0 ? v - 255 : v);
|
2797 |
+
}
|
2798 |
+
|
2799 |
+
this.apply = function(ctx, x, y, width, height) {
|
2800 |
+
// assuming x==0 && y==0 for now
|
2801 |
+
var srcData = ctx.getImageData(0, 0, width, height);
|
2802 |
+
for (var y = 0; y < height; y++) {
|
2803 |
+
for (var x = 0; x < width; x++) {
|
2804 |
+
var r = imGet(srcData.data, x, y, width, height, 0);
|
2805 |
+
var g = imGet(srcData.data, x, y, width, height, 1);
|
2806 |
+
var b = imGet(srcData.data, x, y, width, height, 2);
|
2807 |
+
var a = imGet(srcData.data, x, y, width, height, 3);
|
2808 |
+
imSet(srcData.data, x, y, width, height, 0, m(0,r)+m(1,g)+m(2,b)+m(3,a)+m(4,1));
|
2809 |
+
imSet(srcData.data, x, y, width, height, 1, m(5,r)+m(6,g)+m(7,b)+m(8,a)+m(9,1));
|
2810 |
+
imSet(srcData.data, x, y, width, height, 2, m(10,r)+m(11,g)+m(12,b)+m(13,a)+m(14,1));
|
2811 |
+
imSet(srcData.data, x, y, width, height, 3, m(15,r)+m(16,g)+m(17,b)+m(18,a)+m(19,1));
|
2812 |
+
}
|
2813 |
+
}
|
2814 |
+
ctx.clearRect(0, 0, width, height);
|
2815 |
+
ctx.putImageData(srcData, 0, 0);
|
2816 |
+
}
|
2817 |
+
}
|
2818 |
+
svg.Element.feColorMatrix.prototype = new svg.Element.ElementBase;
|
2819 |
+
|
2820 |
+
svg.Element.feGaussianBlur = function(node) {
|
2821 |
+
this.base = svg.Element.ElementBase;
|
2822 |
+
this.base(node);
|
2823 |
+
|
2824 |
+
this.blurRadius = Math.floor(this.attribute('stdDeviation').numValue());
|
2825 |
+
this.extraFilterDistance = this.blurRadius;
|
2826 |
+
|
2827 |
+
this.apply = function(ctx, x, y, width, height) {
|
2828 |
+
if (typeof stackBlur.canvasRGBA == 'undefined') {
|
2829 |
+
svg.log('ERROR: StackBlur.js must be included for blur to work');
|
2830 |
+
return;
|
2831 |
+
}
|
2832 |
+
|
2833 |
+
// StackBlur requires canvas be on document
|
2834 |
+
ctx.canvas.id = svg.UniqueId();
|
2835 |
+
ctx.canvas.style.display = 'none';
|
2836 |
+
document.body.appendChild(ctx.canvas);
|
2837 |
+
stackBlur.canvasRGBA(ctx.canvas.id, x, y, width, height, this.blurRadius);
|
2838 |
+
document.body.removeChild(ctx.canvas);
|
2839 |
+
}
|
2840 |
+
}
|
2841 |
+
svg.Element.feGaussianBlur.prototype = new svg.Element.ElementBase;
|
2842 |
+
|
2843 |
+
// title element, do nothing
|
2844 |
+
svg.Element.title = function(node) {
|
2845 |
+
}
|
2846 |
+
svg.Element.title.prototype = new svg.Element.ElementBase;
|
2847 |
+
|
2848 |
+
// desc element, do nothing
|
2849 |
+
svg.Element.desc = function(node) {
|
2850 |
+
}
|
2851 |
+
svg.Element.desc.prototype = new svg.Element.ElementBase;
|
2852 |
+
|
2853 |
+
svg.Element.MISSING = function(node) {
|
2854 |
+
svg.log('ERROR: Element \'' + node.nodeName + '\' not yet implemented.');
|
2855 |
+
}
|
2856 |
+
svg.Element.MISSING.prototype = new svg.Element.ElementBase;
|
2857 |
+
|
2858 |
+
// element factory
|
2859 |
+
svg.CreateElement = function(node) {
|
2860 |
+
var className = node.nodeName.replace(/^[^:]+:/,''); // remove namespace
|
2861 |
+
className = className.replace(/\-/g,''); // remove dashes
|
2862 |
+
var e = null;
|
2863 |
+
if (typeof svg.Element[className] != 'undefined') {
|
2864 |
+
e = new svg.Element[className](node);
|
2865 |
+
}
|
2866 |
+
else {
|
2867 |
+
e = new svg.Element.MISSING(node);
|
2868 |
+
}
|
2869 |
+
|
2870 |
+
e.type = node.nodeName;
|
2871 |
+
return e;
|
2872 |
+
}
|
2873 |
+
|
2874 |
+
// load from url
|
2875 |
+
svg.load = function(ctx, url) {
|
2876 |
+
svg.loadXml(ctx, svg.ajax(url));
|
2877 |
+
}
|
2878 |
+
|
2879 |
+
// load from xml
|
2880 |
+
svg.loadXml = function(ctx, xml) {
|
2881 |
+
svg.loadXmlDoc(ctx, svg.parseXml(xml));
|
2882 |
+
}
|
2883 |
+
|
2884 |
+
svg.loadXmlDoc = function(ctx, dom) {
|
2885 |
+
svg.init(ctx);
|
2886 |
+
|
2887 |
+
var mapXY = function(p) {
|
2888 |
+
var e = ctx.canvas;
|
2889 |
+
while (e) {
|
2890 |
+
p.x -= e.offsetLeft;
|
2891 |
+
p.y -= e.offsetTop;
|
2892 |
+
e = e.offsetParent;
|
2893 |
+
}
|
2894 |
+
if (window.scrollX) p.x += window.scrollX;
|
2895 |
+
if (window.scrollY) p.y += window.scrollY;
|
2896 |
+
return p;
|
2897 |
+
}
|
2898 |
+
|
2899 |
+
// bind mouse
|
2900 |
+
if (svg.opts['ignoreMouse'] != true) {
|
2901 |
+
ctx.canvas.onclick = function(e) {
|
2902 |
+
var p = mapXY(new svg.Point(e != null ? e.clientX : event.clientX, e != null ? e.clientY : event.clientY));
|
2903 |
+
svg.Mouse.onclick(p.x, p.y);
|
2904 |
+
};
|
2905 |
+
ctx.canvas.onmousemove = function(e) {
|
2906 |
+
var p = mapXY(new svg.Point(e != null ? e.clientX : event.clientX, e != null ? e.clientY : event.clientY));
|
2907 |
+
svg.Mouse.onmousemove(p.x, p.y);
|
2908 |
+
};
|
2909 |
+
}
|
2910 |
+
|
2911 |
+
var e = svg.CreateElement(dom.documentElement);
|
2912 |
+
e.root = true;
|
2913 |
+
e.addStylesFromStyleDefinition();
|
2914 |
+
|
2915 |
+
// render loop
|
2916 |
+
var isFirstRender = true;
|
2917 |
+
var draw = function() {
|
2918 |
+
svg.ViewPort.Clear();
|
2919 |
+
if (ctx.canvas.parentNode) svg.ViewPort.SetCurrent(ctx.canvas.parentNode.clientWidth, ctx.canvas.parentNode.clientHeight);
|
2920 |
+
|
2921 |
+
if (svg.opts['ignoreDimensions'] != true) {
|
2922 |
+
// set canvas size
|
2923 |
+
if (e.style('width').hasValue()) {
|
2924 |
+
ctx.canvas.width = e.style('width').toPixels('x');
|
2925 |
+
ctx.canvas.style.width = ctx.canvas.width + 'px';
|
2926 |
+
}
|
2927 |
+
if (e.style('height').hasValue()) {
|
2928 |
+
ctx.canvas.height = e.style('height').toPixels('y');
|
2929 |
+
ctx.canvas.style.height = ctx.canvas.height + 'px';
|
2930 |
+
}
|
2931 |
+
}
|
2932 |
+
var cWidth = ctx.canvas.clientWidth || ctx.canvas.width;
|
2933 |
+
var cHeight = ctx.canvas.clientHeight || ctx.canvas.height;
|
2934 |
+
if (svg.opts['ignoreDimensions'] == true && e.style('width').hasValue() && e.style('height').hasValue()) {
|
2935 |
+
cWidth = e.style('width').toPixels('x');
|
2936 |
+
cHeight = e.style('height').toPixels('y');
|
2937 |
+
}
|
2938 |
+
svg.ViewPort.SetCurrent(cWidth, cHeight);
|
2939 |
+
|
2940 |
+
if (svg.opts['offsetX'] != null) e.attribute('x', true).value = svg.opts['offsetX'];
|
2941 |
+
if (svg.opts['offsetY'] != null) e.attribute('y', true).value = svg.opts['offsetY'];
|
2942 |
+
if (svg.opts['scaleWidth'] != null || svg.opts['scaleHeight'] != null) {
|
2943 |
+
var xRatio = null, yRatio = null, viewBox = svg.ToNumberArray(e.attribute('viewBox').value);
|
2944 |
+
|
2945 |
+
if (svg.opts['scaleWidth'] != null) {
|
2946 |
+
if (e.attribute('width').hasValue()) xRatio = e.attribute('width').toPixels('x') / svg.opts['scaleWidth'];
|
2947 |
+
else if (!isNaN(viewBox[2])) xRatio = viewBox[2] / svg.opts['scaleWidth'];
|
2948 |
+
}
|
2949 |
+
|
2950 |
+
if (svg.opts['scaleHeight'] != null) {
|
2951 |
+
if (e.attribute('height').hasValue()) yRatio = e.attribute('height').toPixels('y') / svg.opts['scaleHeight'];
|
2952 |
+
else if (!isNaN(viewBox[3])) yRatio = viewBox[3] / svg.opts['scaleHeight'];
|
2953 |
+
}
|
2954 |
+
|
2955 |
+
if (xRatio == null) { xRatio = yRatio; }
|
2956 |
+
if (yRatio == null) { yRatio = xRatio; }
|
2957 |
+
|
2958 |
+
e.attribute('width', true).value = svg.opts['scaleWidth'];
|
2959 |
+
e.attribute('height', true).value = svg.opts['scaleHeight'];
|
2960 |
+
e.style('transform', true, true).value += ' scale('+(1.0/xRatio)+','+(1.0/yRatio)+')';
|
2961 |
+
}
|
2962 |
+
|
2963 |
+
// clear and render
|
2964 |
+
if (svg.opts['ignoreClear'] != true) {
|
2965 |
+
ctx.clearRect(0, 0, cWidth, cHeight);
|
2966 |
+
}
|
2967 |
+
e.render(ctx);
|
2968 |
+
if (isFirstRender) {
|
2969 |
+
isFirstRender = false;
|
2970 |
+
if (typeof svg.opts['renderCallback'] == 'function') svg.opts['renderCallback'](dom);
|
2971 |
+
}
|
2972 |
+
}
|
2973 |
+
|
2974 |
+
var waitingForImages = true;
|
2975 |
+
if (svg.ImagesLoaded()) {
|
2976 |
+
waitingForImages = false;
|
2977 |
+
draw();
|
2978 |
+
}
|
2979 |
+
svg.intervalID = setInterval(function() {
|
2980 |
+
var needUpdate = false;
|
2981 |
+
|
2982 |
+
if (waitingForImages && svg.ImagesLoaded()) {
|
2983 |
+
waitingForImages = false;
|
2984 |
+
needUpdate = true;
|
2985 |
+
}
|
2986 |
+
|
2987 |
+
// need update from mouse events?
|
2988 |
+
if (svg.opts['ignoreMouse'] != true) {
|
2989 |
+
needUpdate = needUpdate | svg.Mouse.hasEvents();
|
2990 |
+
}
|
2991 |
+
|
2992 |
+
// need update from animations?
|
2993 |
+
if (svg.opts['ignoreAnimation'] != true) {
|
2994 |
+
for (var i=0; i<svg.Animations.length; i++) {
|
2995 |
+
needUpdate = needUpdate | svg.Animations[i].update(1000 / svg.FRAMERATE);
|
2996 |
+
}
|
2997 |
+
}
|
2998 |
+
|
2999 |
+
// need update from redraw?
|
3000 |
+
if (typeof svg.opts['forceRedraw'] == 'function') {
|
3001 |
+
if (svg.opts['forceRedraw']() == true) needUpdate = true;
|
3002 |
+
}
|
3003 |
+
|
3004 |
+
// render if needed
|
3005 |
+
if (needUpdate) {
|
3006 |
+
draw();
|
3007 |
+
svg.Mouse.runEvents(); // run and clear our events
|
3008 |
+
}
|
3009 |
+
}, 1000 / svg.FRAMERATE);
|
3010 |
+
}
|
3011 |
+
|
3012 |
+
svg.stop = function() {
|
3013 |
+
if (svg.intervalID) {
|
3014 |
+
clearInterval(svg.intervalID);
|
3015 |
+
}
|
3016 |
+
}
|
3017 |
+
|
3018 |
+
svg.Mouse = new (function() {
|
3019 |
+
this.events = [];
|
3020 |
+
this.hasEvents = function() { return this.events.length != 0; }
|
3021 |
+
|
3022 |
+
this.onclick = function(x, y) {
|
3023 |
+
this.events.push({ type: 'onclick', x: x, y: y,
|
3024 |
+
run: function(e) { if (e.onclick) e.onclick(); }
|
3025 |
+
});
|
3026 |
+
}
|
3027 |
+
|
3028 |
+
this.onmousemove = function(x, y) {
|
3029 |
+
this.events.push({ type: 'onmousemove', x: x, y: y,
|
3030 |
+
run: function(e) { if (e.onmousemove) e.onmousemove(); }
|
3031 |
+
});
|
3032 |
+
}
|
3033 |
+
|
3034 |
+
this.eventElements = [];
|
3035 |
+
|
3036 |
+
this.checkPath = function(element, ctx) {
|
3037 |
+
for (var i=0; i<this.events.length; i++) {
|
3038 |
+
var e = this.events[i];
|
3039 |
+
if (ctx.isPointInPath && ctx.isPointInPath(e.x, e.y)) this.eventElements[i] = element;
|
3040 |
+
}
|
3041 |
+
}
|
3042 |
+
|
3043 |
+
this.checkBoundingBox = function(element, bb) {
|
3044 |
+
for (var i=0; i<this.events.length; i++) {
|
3045 |
+
var e = this.events[i];
|
3046 |
+
if (bb.isPointInBox(e.x, e.y)) this.eventElements[i] = element;
|
3047 |
+
}
|
3048 |
+
}
|
3049 |
+
|
3050 |
+
this.runEvents = function() {
|
3051 |
+
svg.ctx.canvas.style.cursor = '';
|
3052 |
+
|
3053 |
+
for (var i=0; i<this.events.length; i++) {
|
3054 |
+
var e = this.events[i];
|
3055 |
+
var element = this.eventElements[i];
|
3056 |
+
while (element) {
|
3057 |
+
e.run(element);
|
3058 |
+
element = element.parent;
|
3059 |
+
}
|
3060 |
+
}
|
3061 |
+
|
3062 |
+
// done running, clear
|
3063 |
+
this.events = [];
|
3064 |
+
this.eventElements = [];
|
3065 |
+
}
|
3066 |
+
});
|
3067 |
+
|
3068 |
+
return svg;
|
3069 |
+
};
|
3070 |
+
|
3071 |
+
if (typeof CanvasRenderingContext2D != 'undefined') {
|
3072 |
+
CanvasRenderingContext2D.prototype.drawSvg = function(s, dx, dy, dw, dh, opts) {
|
3073 |
+
var cOpts = {
|
3074 |
+
ignoreMouse: true,
|
3075 |
+
ignoreAnimation: true,
|
3076 |
+
ignoreDimensions: true,
|
3077 |
+
ignoreClear: true,
|
3078 |
+
offsetX: dx,
|
3079 |
+
offsetY: dy,
|
3080 |
+
scaleWidth: dw,
|
3081 |
+
scaleHeight: dh
|
3082 |
+
}
|
3083 |
+
|
3084 |
+
for(var prop in opts) {
|
3085 |
+
if(opts.hasOwnProperty(prop)){
|
3086 |
+
cOpts[prop] = opts[prop];
|
3087 |
+
}
|
3088 |
+
}
|
3089 |
+
canvg(this.canvas, s, cOpts);
|
3090 |
+
}
|
3091 |
+
}
|
3092 |
+
|
3093 |
+
return canvg;
|
3094 |
+
|
3095 |
+
}));
|
inc/js/chosen.jquery.js
CHANGED
@@ -1,1285 +1,1285 @@
|
|
1 |
-
/*!
|
2 |
-
Chosen, a Select Box Enhancer for jQuery and Prototype
|
3 |
-
by Patrick Filler for Harvest, http://getharvest.com
|
4 |
-
|
5 |
-
Version 1.5.1
|
6 |
-
Full source at https://github.com/harvesthq/chosen
|
7 |
-
Copyright (c) 2011-2016 Harvest http://getharvest.com
|
8 |
-
|
9 |
-
MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
|
10 |
-
This file is generated by `grunt build`, do not edit it by hand.
|
11 |
-
*/
|
12 |
-
|
13 |
-
(function() {
|
14 |
-
var $, AbstractChosen, Chosen, SelectParser, _ref,
|
15 |
-
__hasProp = {}.hasOwnProperty,
|
16 |
-
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
17 |
-
|
18 |
-
SelectParser = (function() {
|
19 |
-
function SelectParser() {
|
20 |
-
this.options_index = 0;
|
21 |
-
this.parsed = [];
|
22 |
-
}
|
23 |
-
|
24 |
-
SelectParser.prototype.add_node = function(child) {
|
25 |
-
if (child.nodeName.toUpperCase() === "OPTGROUP") {
|
26 |
-
return this.add_group(child);
|
27 |
-
} else {
|
28 |
-
return this.add_option(child);
|
29 |
-
}
|
30 |
-
};
|
31 |
-
|
32 |
-
SelectParser.prototype.add_group = function(group) {
|
33 |
-
var group_position, option, _i, _len, _ref, _results;
|
34 |
-
group_position = this.parsed.length;
|
35 |
-
this.parsed.push({
|
36 |
-
array_index: group_position,
|
37 |
-
group: true,
|
38 |
-
label: this.escapeExpression(group.label),
|
39 |
-
title: group.title ? group.title : void 0,
|
40 |
-
children: 0,
|
41 |
-
disabled: group.disabled,
|
42 |
-
classes: group.className
|
43 |
-
});
|
44 |
-
_ref = group.childNodes;
|
45 |
-
_results = [];
|
46 |
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
47 |
-
option = _ref[_i];
|
48 |
-
_results.push(this.add_option(option, group_position, group.disabled));
|
49 |
-
}
|
50 |
-
return _results;
|
51 |
-
};
|
52 |
-
|
53 |
-
SelectParser.prototype.add_option = function(option, group_position, group_disabled) {
|
54 |
-
if (option.nodeName.toUpperCase() === "OPTION") {
|
55 |
-
if (option.text !== "") {
|
56 |
-
if (group_position != null) {
|
57 |
-
this.parsed[group_position].children += 1;
|
58 |
-
}
|
59 |
-
this.parsed.push({
|
60 |
-
array_index: this.parsed.length,
|
61 |
-
options_index: this.options_index,
|
62 |
-
value: option.value,
|
63 |
-
text: option.text,
|
64 |
-
html: option.innerHTML,
|
65 |
-
title: option.title ? option.title : void 0,
|
66 |
-
selected: option.selected,
|
67 |
-
disabled: group_disabled === true ? group_disabled : option.disabled,
|
68 |
-
group_array_index: group_position,
|
69 |
-
group_label: group_position != null ? this.parsed[group_position].label : null,
|
70 |
-
classes: option.className,
|
71 |
-
style: option.style.cssText
|
72 |
-
});
|
73 |
-
} else {
|
74 |
-
this.parsed.push({
|
75 |
-
array_index: this.parsed.length,
|
76 |
-
options_index: this.options_index,
|
77 |
-
empty: true
|
78 |
-
});
|
79 |
-
}
|
80 |
-
return this.options_index += 1;
|
81 |
-
}
|
82 |
-
};
|
83 |
-
|
84 |
-
SelectParser.prototype.escapeExpression = function(text) {
|
85 |
-
var map, unsafe_chars;
|
86 |
-
if ((text == null) || text === false) {
|
87 |
-
return "";
|
88 |
-
}
|
89 |
-
if (!/[\&\<\>\"\'\`]/.test(text)) {
|
90 |
-
return text;
|
91 |
-
}
|
92 |
-
map = {
|
93 |
-
"<": "<",
|
94 |
-
">": ">",
|
95 |
-
'"': """,
|
96 |
-
"'": "'",
|
97 |
-
"`": "`"
|
98 |
-
};
|
99 |
-
unsafe_chars = /&(?!\w+;)|[\<\>\"\'\`]/g;
|
100 |
-
return text.replace(unsafe_chars, function(chr) {
|
101 |
-
return map[chr] || "&";
|
102 |
-
});
|
103 |
-
};
|
104 |
-
|
105 |
-
return SelectParser;
|
106 |
-
|
107 |
-
})();
|
108 |
-
|
109 |
-
SelectParser.select_to_array = function(select) {
|
110 |
-
var child, parser, _i, _len, _ref;
|
111 |
-
parser = new SelectParser();
|
112 |
-
_ref = select.childNodes;
|
113 |
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
114 |
-
child = _ref[_i];
|
115 |
-
parser.add_node(child);
|
116 |
-
}
|
117 |
-
return parser.parsed;
|
118 |
-
};
|
119 |
-
|
120 |
-
AbstractChosen = (function() {
|
121 |
-
function AbstractChosen(form_field, options) {
|
122 |
-
this.form_field = form_field;
|
123 |
-
this.options = options != null ? options : {};
|
124 |
-
if (!AbstractChosen.browser_is_supported()) {
|
125 |
-
return;
|
126 |
-
}
|
127 |
-
this.is_multiple = this.form_field.multiple;
|
128 |
-
this.set_default_text();
|
129 |
-
this.set_default_values();
|
130 |
-
this.setup();
|
131 |
-
this.set_up_html();
|
132 |
-
this.register_observers();
|
133 |
-
this.on_ready();
|
134 |
-
}
|
135 |
-
|
136 |
-
AbstractChosen.prototype.set_default_values = function() {
|
137 |
-
var _this = this;
|
138 |
-
this.click_test_action = function(evt) {
|
139 |
-
return _this.test_active_click(evt);
|
140 |
-
};
|
141 |
-
this.activate_action = function(evt) {
|
142 |
-
return _this.activate_field(evt);
|
143 |
-
};
|
144 |
-
this.active_field = false;
|
145 |
-
this.mouse_on_container = false;
|
146 |
-
this.results_showing = false;
|
147 |
-
this.result_highlighted = null;
|
148 |
-
this.allow_single_deselect = (this.options.allow_single_deselect != null) && (this.form_field.options[0] != null) && this.form_field.options[0].text === "" ? this.options.allow_single_deselect : false;
|
149 |
-
this.disable_search_threshold = this.options.disable_search_threshold || 0;
|
150 |
-
this.disable_search = this.options.disable_search || false;
|
151 |
-
this.enable_split_word_search = this.options.enable_split_word_search != null ? this.options.enable_split_word_search : true;
|
152 |
-
this.group_search = this.options.group_search != null ? this.options.group_search : true;
|
153 |
-
this.search_contains = this.options.search_contains || false;
|
154 |
-
this.single_backstroke_delete = this.options.single_backstroke_delete != null ? this.options.single_backstroke_delete : true;
|
155 |
-
this.max_selected_options = this.options.max_selected_options || Infinity;
|
156 |
-
this.inherit_select_classes = this.options.inherit_select_classes || false;
|
157 |
-
this.display_selected_options = this.options.display_selected_options != null ? this.options.display_selected_options : true;
|
158 |
-
this.display_disabled_options = this.options.display_disabled_options != null ? this.options.display_disabled_options : true;
|
159 |
-
this.include_group_label_in_selected = this.options.include_group_label_in_selected || false;
|
160 |
-
return this.max_shown_results = this.options.max_shown_results || Number.POSITIVE_INFINITY;
|
161 |
-
};
|
162 |
-
|
163 |
-
AbstractChosen.prototype.set_default_text = function() {
|
164 |
-
if (this.form_field.getAttribute("data-placeholder")) {
|
165 |
-
this.default_text = this.form_field.getAttribute("data-placeholder");
|
166 |
-
} else if (this.is_multiple) {
|
167 |
-
this.default_text = this.options.placeholder_text_multiple || this.options.placeholder_text || AbstractChosen.default_multiple_text;
|
168 |
-
} else {
|
169 |
-
this.default_text = this.options.placeholder_text_single || this.options.placeholder_text || AbstractChosen.default_single_text;
|
170 |
-
}
|
171 |
-
return this.results_none_found = this.form_field.getAttribute("data-no_results_text") || this.options.no_results_text || AbstractChosen.default_no_result_text;
|
172 |
-
};
|
173 |
-
|
174 |
-
AbstractChosen.prototype.choice_label = function(item) {
|
175 |
-
if (this.include_group_label_in_selected && (item.group_label != null)) {
|
176 |
-
return "<b class='group-name'>" + item.group_label + "</b>" + item.html;
|
177 |
-
} else {
|
178 |
-
return item.html;
|
179 |
-
}
|
180 |
-
};
|
181 |
-
|
182 |
-
AbstractChosen.prototype.mouse_enter = function() {
|
183 |
-
return this.mouse_on_container = true;
|
184 |
-
};
|
185 |
-
|
186 |
-
AbstractChosen.prototype.mouse_leave = function() {
|
187 |
-
return this.mouse_on_container = false;
|
188 |
-
};
|
189 |
-
|
190 |
-
AbstractChosen.prototype.input_focus = function(evt) {
|
191 |
-
var _this = this;
|
192 |
-
if (this.is_multiple) {
|
193 |
-
if (!this.active_field) {
|
194 |
-
return setTimeout((function() {
|
195 |
-
return _this.container_mousedown();
|
196 |
-
}), 50);
|
197 |
-
}
|
198 |
-
} else {
|
199 |
-
if (!this.active_field) {
|
200 |
-
return this.activate_field();
|
201 |
-
}
|
202 |
-
}
|
203 |
-
};
|
204 |
-
|
205 |
-
AbstractChosen.prototype.input_blur = function(evt) {
|
206 |
-
var _this = this;
|
207 |
-
if (!this.mouse_on_container) {
|
208 |
-
this.active_field = false;
|
209 |
-
return setTimeout((function() {
|
210 |
-
return _this.blur_test();
|
211 |
-
}), 100);
|
212 |
-
}
|
213 |
-
};
|
214 |
-
|
215 |
-
AbstractChosen.prototype.results_option_build = function(options) {
|
216 |
-
var content, data, data_content, shown_results, _i, _len, _ref;
|
217 |
-
content = '';
|
218 |
-
shown_results = 0;
|
219 |
-
_ref = this.results_data;
|
220 |
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
221 |
-
data = _ref[_i];
|
222 |
-
data_content = '';
|
223 |
-
if (data.group) {
|
224 |
-
data_content = this.result_add_group(data);
|
225 |
-
} else {
|
226 |
-
data_content = this.result_add_option(data);
|
227 |
-
}
|
228 |
-
if (data_content !== '') {
|
229 |
-
shown_results++;
|
230 |
-
content += data_content;
|
231 |
-
}
|
232 |
-
if (options != null ? options.first : void 0) {
|
233 |
-
if (data.selected && this.is_multiple) {
|
234 |
-
this.choice_build(data);
|
235 |
-
} else if (data.selected && !this.is_multiple) {
|
236 |
-
this.single_set_selected_text(this.choice_label(data));
|
237 |
-
}
|
238 |
-
}
|
239 |
-
if (shown_results >= this.max_shown_results) {
|
240 |
-
break;
|
241 |
-
}
|
242 |
-
}
|
243 |
-
return content;
|
244 |
-
};
|
245 |
-
|
246 |
-
AbstractChosen.prototype.result_add_option = function(option) {
|
247 |
-
var classes, option_el;
|
248 |
-
if (!option.search_match) {
|
249 |
-
return '';
|
250 |
-
}
|
251 |
-
if (!this.include_option_in_results(option)) {
|
252 |
-
return '';
|
253 |
-
}
|
254 |
-
classes = [];
|
255 |
-
if (!option.disabled && !(option.selected && this.is_multiple)) {
|
256 |
-
classes.push("active-result");
|
257 |
-
}
|
258 |
-
if (option.disabled && !(option.selected && this.is_multiple)) {
|
259 |
-
classes.push("disabled-result");
|
260 |
-
}
|
261 |
-
if (option.selected) {
|
262 |
-
classes.push("result-selected");
|
263 |
-
}
|
264 |
-
if (option.group_array_index != null) {
|
265 |
-
classes.push("group-option");
|
266 |
-
}
|
267 |
-
if (option.classes !== "") {
|
268 |
-
classes.push(option.classes);
|
269 |
-
}
|
270 |
-
option_el = document.createElement("li");
|
271 |
-
option_el.className = classes.join(" ");
|
272 |
-
option_el.style.cssText = option.style;
|
273 |
-
option_el.setAttribute("data-option-array-index", option.array_index);
|
274 |
-
option_el.innerHTML = option.search_text;
|
275 |
-
if (option.title) {
|
276 |
-
option_el.title = option.title;
|
277 |
-
}
|
278 |
-
return this.outerHTML(option_el);
|
279 |
-
};
|
280 |
-
|
281 |
-
AbstractChosen.prototype.result_add_group = function(group) {
|
282 |
-
var classes, group_el;
|
283 |
-
if (!(group.search_match || group.group_match)) {
|
284 |
-
return '';
|
285 |
-
}
|
286 |
-
if (!(group.active_options > 0)) {
|
287 |
-
return '';
|
288 |
-
}
|
289 |
-
classes = [];
|
290 |
-
classes.push("group-result");
|
291 |
-
if (group.classes) {
|
292 |
-
classes.push(group.classes);
|
293 |
-
}
|
294 |
-
group_el = document.createElement("li");
|
295 |
-
group_el.className = classes.join(" ");
|
296 |
-
group_el.innerHTML = group.search_text;
|
297 |
-
if (group.title) {
|
298 |
-
group_el.title = group.title;
|
299 |
-
}
|
300 |
-
return this.outerHTML(group_el);
|
301 |
-
};
|
302 |
-
|
303 |
-
AbstractChosen.prototype.results_update_field = function() {
|
304 |
-
this.set_default_text();
|
305 |
-
if (!this.is_multiple) {
|
306 |
-
this.results_reset_cleanup();
|
307 |
-
}
|
308 |
-
this.result_clear_highlight();
|
309 |
-
this.results_build();
|
310 |
-
if (this.results_showing) {
|
311 |
-
return this.winnow_results();
|
312 |
-
}
|
313 |
-
};
|
314 |
-
|
315 |
-
AbstractChosen.prototype.reset_single_select_options = function() {
|
316 |
-
var result, _i, _len, _ref, _results;
|
317 |
-
_ref = this.results_data;
|
318 |
-
_results = [];
|
319 |
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
320 |
-
result = _ref[_i];
|
321 |
-
if (result.selected) {
|
322 |
-
_results.push(result.selected = false);
|
323 |
-
} else {
|
324 |
-
_results.push(void 0);
|
325 |
-
}
|
326 |
-
}
|
327 |
-
return _results;
|
328 |
-
};
|
329 |
-
|
330 |
-
AbstractChosen.prototype.results_toggle = function() {
|
331 |
-
if (this.results_showing) {
|
332 |
-
return this.results_hide();
|
333 |
-
} else {
|
334 |
-
return this.results_show();
|
335 |
-
}
|
336 |
-
};
|
337 |
-
|
338 |
-
AbstractChosen.prototype.results_search = function(evt) {
|
339 |
-
if (this.results_showing) {
|
340 |
-
return this.winnow_results();
|
341 |
-
} else {
|
342 |
-
return this.results_show();
|
343 |
-
}
|
344 |
-
};
|
345 |
-
|
346 |
-
AbstractChosen.prototype.winnow_results = function() {
|
347 |
-
var escapedSearchText, option, regex, results, results_group, searchText, startpos, text, zregex, _i, _len, _ref;
|
348 |
-
this.no_results_clear();
|
349 |
-
results = 0;
|
350 |
-
searchText = this.get_search_text();
|
351 |
-
escapedSearchText = searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
352 |
-
zregex = new RegExp(escapedSearchText, 'i');
|
353 |
-
regex = this.get_search_regex(escapedSearchText);
|
354 |
-
_ref = this.results_data;
|
355 |
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
356 |
-
option = _ref[_i];
|
357 |
-
option.search_match = false;
|
358 |
-
results_group = null;
|
359 |
-
if (this.include_option_in_results(option)) {
|
360 |
-
if (option.group) {
|
361 |
-
option.group_match = false;
|
362 |
-
option.active_options = 0;
|
363 |
-
}
|
364 |
-
if ((option.group_array_index != null) && this.results_data[option.group_array_index]) {
|
365 |
-
results_group = this.results_data[option.group_array_index];
|
366 |
-
if (results_group.active_options === 0 && results_group.search_match) {
|
367 |
-
results += 1;
|
368 |
-
}
|
369 |
-
results_group.active_options += 1;
|
370 |
-
}
|
371 |
-
option.search_text = option.group ? option.label : option.html;
|
372 |
-
if (!(option.group && !this.group_search)) {
|
373 |
-
option.search_match = this.search_string_match(option.search_text, regex);
|
374 |
-
if (option.search_match && !option.group) {
|
375 |
-
results += 1;
|
376 |
-
}
|
377 |
-
if (option.search_match) {
|
378 |
-
if (searchText.length) {
|
379 |
-
startpos = option.search_text.search(zregex);
|
380 |
-
text = option.search_text.substr(0, startpos + searchText.length) + '</em>' + option.search_text.substr(startpos + searchText.length);
|
381 |
-
option.search_text = text.substr(0, startpos) + '<em>' + text.substr(startpos);
|
382 |
-
}
|
383 |
-
if (results_group != null) {
|
384 |
-
results_group.group_match = true;
|
385 |
-
}
|
386 |
-
} else if ((option.group_array_index != null) && this.results_data[option.group_array_index].search_match) {
|
387 |
-
option.search_match = true;
|
388 |
-
}
|
389 |
-
}
|
390 |
-
}
|
391 |
-
}
|
392 |
-
this.result_clear_highlight();
|
393 |
-
if (results < 1 && searchText.length) {
|
394 |
-
this.update_results_content("");
|
395 |
-
return this.no_results(searchText);
|
396 |
-
} else {
|
397 |
-
this.update_results_content(this.results_option_build());
|
398 |
-
return this.winnow_results_set_highlight();
|
399 |
-
}
|
400 |
-
};
|
401 |
-
|
402 |
-
AbstractChosen.prototype.get_search_regex = function(escaped_search_string) {
|
403 |
-
var regex_anchor;
|
404 |
-
regex_anchor = this.search_contains ? "" : "^";
|
405 |
-
return new RegExp(regex_anchor + escaped_search_string, 'i');
|
406 |
-
};
|
407 |
-
|
408 |
-
AbstractChosen.prototype.search_string_match = function(search_string, regex) {
|
409 |
-
var part, parts, _i, _len;
|
410 |
-
if (regex.test(search_string)) {
|
411 |
-
return true;
|
412 |
-
} else if (this.enable_split_word_search && (search_string.indexOf(" ") >= 0 || search_string.indexOf("[") === 0)) {
|
413 |
-
parts = search_string.replace(/\[|\]/g, "").split(" ");
|
414 |
-
if (parts.length) {
|
415 |
-
for (_i = 0, _len = parts.length; _i < _len; _i++) {
|
416 |
-
part = parts[_i];
|
417 |
-
if (regex.test(part)) {
|
418 |
-
return true;
|
419 |
-
}
|
420 |
-
}
|
421 |
-
}
|
422 |
-
}
|
423 |
-
};
|
424 |
-
|
425 |
-
AbstractChosen.prototype.choices_count = function() {
|
426 |
-
var option, _i, _len, _ref;
|
427 |
-
if (this.selected_option_count != null) {
|
428 |
-
return this.selected_option_count;
|
429 |
-
}
|
430 |
-
this.selected_option_count = 0;
|
431 |
-
_ref = this.form_field.options;
|
432 |
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
433 |
-
option = _ref[_i];
|
434 |
-
if (option.selected) {
|
435 |
-
this.selected_option_count += 1;
|
436 |
-
}
|
437 |
-
}
|
438 |
-
return this.selected_option_count;
|
439 |
-
};
|
440 |
-
|
441 |
-
AbstractChosen.prototype.choices_click = function(evt) {
|
442 |
-
evt.preventDefault();
|
443 |
-
if (!(this.results_showing || this.is_disabled)) {
|
444 |
-
return this.results_show();
|
445 |
-
}
|
446 |
-
};
|
447 |
-
|
448 |
-
AbstractChosen.prototype.keyup_checker = function(evt) {
|
449 |
-
var stroke, _ref;
|
450 |
-
stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
|
451 |
-
this.search_field_scale();
|
452 |
-
switch (stroke) {
|
453 |
-
case 8:
|
454 |
-
if (this.is_multiple && this.backstroke_length < 1 && this.choices_count() > 0) {
|
455 |
-
return this.keydown_backstroke();
|
456 |
-
} else if (!this.pending_backstroke) {
|
457 |
-
this.result_clear_highlight();
|
458 |
-
return this.results_search();
|
459 |
-
}
|
460 |
-
break;
|
461 |
-
case 13:
|
462 |
-
evt.preventDefault();
|
463 |
-
if (this.results_showing) {
|
464 |
-
return this.result_select(evt);
|
465 |
-
}
|
466 |
-
break;
|
467 |
-
case 27:
|
468 |
-
if (this.results_showing) {
|
469 |
-
this.results_hide();
|
470 |
-
}
|
471 |
-
return true;
|
472 |
-
case 9:
|
473 |
-
case 38:
|
474 |
-
case 40:
|
475 |
-
case 16:
|
476 |
-
case 91:
|
477 |
-
case 17:
|
478 |
-
case 18:
|
479 |
-
break;
|
480 |
-
default:
|
481 |
-
return this.results_search();
|
482 |
-
}
|
483 |
-
};
|
484 |
-
|
485 |
-
AbstractChosen.prototype.clipboard_event_checker = function(evt) {
|
486 |
-
var _this = this;
|
487 |
-
return setTimeout((function() {
|
488 |
-
return _this.results_search();
|
489 |
-
}), 50);
|
490 |
-
};
|
491 |
-
|
492 |
-
AbstractChosen.prototype.container_width = function() {
|
493 |
-
if (this.options.width != null) {
|
494 |
-
return this.options.width;
|
495 |
-
} else {
|
496 |
-
//return "" + this.form_field.offsetWidth + "px";
|
497 |
-
return "100%";
|
498 |
-
}
|
499 |
-
};
|
500 |
-
|
501 |
-
AbstractChosen.prototype.include_option_in_results = function(option) {
|
502 |
-
if (this.is_multiple && (!this.display_selected_options && option.selected)) {
|
503 |
-
return false;
|
504 |
-
}
|
505 |
-
if (!this.display_disabled_options && option.disabled) {
|
506 |
-
return false;
|
507 |
-
}
|
508 |
-
if (option.empty) {
|
509 |
-
return false;
|
510 |
-
}
|
511 |
-
return true;
|
512 |
-
};
|
513 |
-
|
514 |
-
AbstractChosen.prototype.search_results_touchstart = function(evt) {
|
515 |
-
this.touch_started = true;
|
516 |
-
return this.search_results_mouseover(evt);
|
517 |
-
};
|
518 |
-
|
519 |
-
AbstractChosen.prototype.search_results_touchmove = function(evt) {
|
520 |
-
this.touch_started = false;
|
521 |
-
return this.search_results_mouseout(evt);
|
522 |
-
};
|
523 |
-
|
524 |
-
AbstractChosen.prototype.search_results_touchend = function(evt) {
|
525 |
-
if (this.touch_started) {
|
526 |
-
return this.search_results_mouseup(evt);
|
527 |
-
}
|
528 |
-
};
|
529 |
-
|
530 |
-
AbstractChosen.prototype.outerHTML = function(element) {
|
531 |
-
var tmp;
|
532 |
-
if (element.outerHTML) {
|
533 |
-
return element.outerHTML;
|
534 |
-
}
|
535 |
-
tmp = document.createElement("div");
|
536 |
-
tmp.appendChild(element);
|
537 |
-
return tmp.innerHTML;
|
538 |
-
};
|
539 |
-
|
540 |
-
AbstractChosen.browser_is_supported = function() {
|
541 |
-
if (/iP(od|hone)/i.test(window.navigator.userAgent)) {
|
542 |
-
return false;
|
543 |
-
}
|
544 |
-
if (/Android/i.test(window.navigator.userAgent)) {
|
545 |
-
if (/Mobile/i.test(window.navigator.userAgent)) {
|
546 |
-
return false;
|
547 |
-
}
|
548 |
-
}
|
549 |
-
if (/IEMobile/i.test(window.navigator.userAgent)) {
|
550 |
-
return false;
|
551 |
-
}
|
552 |
-
if (/Windows Phone/i.test(window.navigator.userAgent)) {
|
553 |
-
return false;
|
554 |
-
}
|
555 |
-
if (/BlackBerry/i.test(window.navigator.userAgent)) {
|
556 |
-
return false;
|
557 |
-
}
|
558 |
-
if (/BB10/i.test(window.navigator.userAgent)) {
|
559 |
-
return false;
|
560 |
-
}
|
561 |
-
if (window.navigator.appName === "Microsoft Internet Explorer") {
|
562 |
-
return document.documentMode >= 8;
|
563 |
-
}
|
564 |
-
return true;
|
565 |
-
};
|
566 |
-
|
567 |
-
AbstractChosen.default_multiple_text = "Select report";
|
568 |
-
|
569 |
-
AbstractChosen.default_single_text = "Select an Option";
|
570 |
-
|
571 |
-
AbstractChosen.default_no_result_text = "No results match";
|
572 |
-
|
573 |
-
return AbstractChosen;
|
574 |
-
|
575 |
-
})();
|
576 |
-
|
577 |
-
$ = jQuery;
|
578 |
-
|
579 |
-
$.fn.extend({
|
580 |
-
chosen: function(options) {
|
581 |
-
if (!AbstractChosen.browser_is_supported()) {
|
582 |
-
return this;
|
583 |
-
}
|
584 |
-
return this.each(function(input_field) {
|
585 |
-
var $this, chosen;
|
586 |
-
$this = $(this);
|
587 |
-
chosen = $this.data('chosen');
|
588 |
-
if (options === 'destroy') {
|
589 |
-
if (chosen instanceof Chosen) {
|
590 |
-
chosen.destroy();
|
591 |
-
}
|
592 |
-
return;
|
593 |
-
}
|
594 |
-
if (!(chosen instanceof Chosen)) {
|
595 |
-
$this.data('chosen', new Chosen(this, options));
|
596 |
-
}
|
597 |
-
});
|
598 |
-
}
|
599 |
-
});
|
600 |
-
|
601 |
-
Chosen = (function(_super) {
|
602 |
-
__extends(Chosen, _super);
|
603 |
-
|
604 |
-
function Chosen() {
|
605 |
-
_ref = Chosen.__super__.constructor.apply(this, arguments);
|
606 |
-
return _ref;
|
607 |
-
}
|
608 |
-
|
609 |
-
Chosen.prototype.setup = function() {
|
610 |
-
this.form_field_jq = $(this.form_field);
|
611 |
-
this.current_selectedIndex = this.form_field.selectedIndex;
|
612 |
-
return this.is_rtl = this.form_field_jq.hasClass("chosen-rtl");
|
613 |
-
};
|
614 |
-
|
615 |
-
Chosen.prototype.set_up_html = function() {
|
616 |
-
var container_classes, container_props;
|
617 |
-
container_classes = ["chosen-container"];
|
618 |
-
container_classes.push("chosen-container-" + (this.is_multiple ? "multi" : "single"));
|
619 |
-
if (this.inherit_select_classes && this.form_field.className) {
|
620 |
-
container_classes.push(this.form_field.className);
|
621 |
-
}
|
622 |
-
if (this.is_rtl) {
|
623 |
-
container_classes.push("chosen-rtl");
|
624 |
-
}
|
625 |
-
container_props = {
|
626 |
-
'class': container_classes.join(' '),
|
627 |
-
'style': "width: " + (this.container_width()) + ";",
|
628 |
-
'title': this.form_field.title
|
629 |
-
};
|
630 |
-
if (this.form_field.id.length) {
|
631 |
-
container_props.id = this.form_field.id.replace(/[^\w]/g, '_') + "_chosen";
|
632 |
-
}
|
633 |
-
this.container = $("<div />", container_props);
|
634 |
-
if (this.is_multiple) {
|
635 |
-
this.container.html('<ul class="chosen-choices"><li class="search-field"><input type="text" value="' + this.default_text + '" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chosen-drop"><ul class="chosen-results"></ul></div>');
|
636 |
-
} else {
|
637 |
-
this.container.html('<a class="chosen-single chosen-default"><span>' + this.default_text + '</span><div><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" /></div><ul class="chosen-results"></ul></div>');
|
638 |
-
}
|
639 |
-
this.form_field_jq.hide().after(this.container);
|
640 |
-
this.dropdown = this.container.find('div.chosen-drop').first();
|
641 |
-
this.search_field = this.container.find('input').first();
|
642 |
-
this.search_results = this.container.find('ul.chosen-results').first();
|
643 |
-
this.search_field_scale();
|
644 |
-
this.search_no_results = this.container.find('li.no-results').first();
|
645 |
-
if (this.is_multiple) {
|
646 |
-
this.search_choices = this.container.find('ul.chosen-choices').first();
|
647 |
-
this.search_container = this.container.find('li.search-field').first();
|
648 |
-
} else {
|
649 |
-
this.search_container = this.container.find('div.chosen-search').first();
|
650 |
-
this.selected_item = this.container.find('.chosen-single').first();
|
651 |
-
}
|
652 |
-
this.results_build();
|
653 |
-
this.set_tab_index();
|
654 |
-
return this.set_label_behavior();
|
655 |
-
};
|
656 |
-
|
657 |
-
Chosen.prototype.on_ready = function() {
|
658 |
-
return this.form_field_jq.trigger("chosen:ready", {
|
659 |
-
chosen: this
|
660 |
-
});
|
661 |
-
};
|
662 |
-
|
663 |
-
Chosen.prototype.register_observers = function() {
|
664 |
-
var _this = this;
|
665 |
-
this.container.bind('touchstart.chosen', function(evt) {
|
666 |
-
_this.container_mousedown(evt);
|
667 |
-
return evt.preventDefault();
|
668 |
-
});
|
669 |
-
this.container.bind('touchend.chosen', function(evt) {
|
670 |
-
_this.container_mouseup(evt);
|
671 |
-
return evt.preventDefault();
|
672 |
-
});
|
673 |
-
this.container.bind('mousedown.chosen', function(evt) {
|
674 |
-
_this.container_mousedown(evt);
|
675 |
-
});
|
676 |
-
this.container.bind('mouseup.chosen', function(evt) {
|
677 |
-
_this.container_mouseup(evt);
|
678 |
-
});
|
679 |
-
this.container.bind('mouseenter.chosen', function(evt) {
|
680 |
-
_this.mouse_enter(evt);
|
681 |
-
});
|
682 |
-
this.container.bind('mouseleave.chosen', function(evt) {
|
683 |
-
_this.mouse_leave(evt);
|
684 |
-
});
|
685 |
-
this.search_results.bind('mouseup.chosen', function(evt) {
|
686 |
-
_this.search_results_mouseup(evt);
|
687 |
-
});
|
688 |
-
this.search_results.bind('mouseover.chosen', function(evt) {
|
689 |
-
_this.search_results_mouseover(evt);
|
690 |
-
});
|
691 |
-
this.search_results.bind('mouseout.chosen', function(evt) {
|
692 |
-
_this.search_results_mouseout(evt);
|
693 |
-
});
|
694 |
-
this.search_results.bind('mousewheel.chosen DOMMouseScroll.chosen', function(evt) {
|
695 |
-
_this.search_results_mousewheel(evt);
|
696 |
-
});
|
697 |
-
this.search_results.bind('touchstart.chosen', function(evt) {
|
698 |
-
_this.search_results_touchstart(evt);
|
699 |
-
});
|
700 |
-
this.search_results.bind('touchmove.chosen', function(evt) {
|
701 |
-
_this.search_results_touchmove(evt);
|
702 |
-
});
|
703 |
-
this.search_results.bind('touchend.chosen', function(evt) {
|
704 |
-
_this.search_results_touchend(evt);
|
705 |
-
});
|
706 |
-
this.form_field_jq.bind("chosen:updated.chosen", function(evt) {
|
707 |
-
_this.results_update_field(evt);
|
708 |
-
});
|
709 |
-
this.form_field_jq.bind("chosen:activate.chosen", function(evt) {
|
710 |
-
_this.activate_field(evt);
|
711 |
-
});
|
712 |
-
this.form_field_jq.bind("chosen:open.chosen", function(evt) {
|
713 |
-
_this.container_mousedown(evt);
|
714 |
-
});
|
715 |
-
this.form_field_jq.bind("chosen:close.chosen", function(evt) {
|
716 |
-
_this.input_blur(evt);
|
717 |
-
});
|
718 |
-
this.search_field.bind('blur.chosen', function(evt) {
|
719 |
-
_this.input_blur(evt);
|
720 |
-
});
|
721 |
-
this.search_field.bind('keyup.chosen', function(evt) {
|
722 |
-
_this.keyup_checker(evt);
|
723 |
-
});
|
724 |
-
this.search_field.bind('keydown.chosen', function(evt) {
|
725 |
-
_this.keydown_checker(evt);
|
726 |
-
});
|
727 |
-
this.search_field.bind('focus.chosen', function(evt) {
|
728 |
-
_this.input_focus(evt);
|
729 |
-
});
|
730 |
-
this.search_field.bind('cut.chosen', function(evt) {
|
731 |
-
_this.clipboard_event_checker(evt);
|
732 |
-
});
|
733 |
-
this.search_field.bind('paste.chosen', function(evt) {
|
734 |
-
_this.clipboard_event_checker(evt);
|
735 |
-
});
|
736 |
-
if (this.is_multiple) {
|
737 |
-
return this.search_choices.bind('click.chosen', function(evt) {
|
738 |
-
_this.choices_click(evt);
|
739 |
-
});
|
740 |
-
} else {
|
741 |
-
return this.container.bind('click.chosen', function(evt) {
|
742 |
-
evt.preventDefault();
|
743 |
-
});
|
744 |
-
}
|
745 |
-
};
|
746 |
-
|
747 |
-
Chosen.prototype.destroy = function() {
|
748 |
-
$(this.container[0].ownerDocument).unbind("click.chosen", this.click_test_action);
|
749 |
-
if (this.search_field[0].tabIndex) {
|
750 |
-
this.form_field_jq[0].tabIndex = this.search_field[0].tabIndex;
|
751 |
-
}
|
752 |
-
this.container.remove();
|
753 |
-
this.form_field_jq.removeData('chosen');
|
754 |
-
return this.form_field_jq.show();
|
755 |
-
};
|
756 |
-
|
757 |
-
Chosen.prototype.search_field_disabled = function() {
|
758 |
-
this.is_disabled = this.form_field_jq[0].disabled;
|
759 |
-
if (this.is_disabled) {
|
760 |
-
this.container.addClass('chosen-disabled');
|
761 |
-
this.search_field[0].disabled = true;
|
762 |
-
if (!this.is_multiple) {
|
763 |
-
this.selected_item.unbind("focus.chosen", this.activate_action);
|
764 |
-
}
|
765 |
-
return this.close_field();
|
766 |
-
} else {
|
767 |
-
this.container.removeClass('chosen-disabled');
|
768 |
-
this.search_field[0].disabled = false;
|
769 |
-
if (!this.is_multiple) {
|
770 |
-
return this.selected_item.bind("focus.chosen", this.activate_action);
|
771 |
-
}
|
772 |
-
}
|
773 |
-
};
|
774 |
-
|
775 |
-
Chosen.prototype.container_mousedown = function(evt) {
|
776 |
-
if (!this.is_disabled) {
|
777 |
-
if (evt && evt.type === "mousedown" && !this.results_showing) {
|
778 |
-
evt.preventDefault();
|
779 |
-
}
|
780 |
-
if (!((evt != null) && ($(evt.target)).hasClass("search-choice-close"))) {
|
781 |
-
if (!this.active_field) {
|
782 |
-
if (this.is_multiple) {
|
783 |
-
this.search_field.val("");
|
784 |
-
}
|
785 |
-
$(this.container[0].ownerDocument).bind('click.chosen', this.click_test_action);
|
786 |
-
this.results_show();
|
787 |
-
} else if (!this.is_multiple && evt && (($(evt.target)[0] === this.selected_item[0]) || $(evt.target).parents("a.chosen-single").length)) {
|
788 |
-
evt.preventDefault();
|
789 |
-
this.results_toggle();
|
790 |
-
}
|
791 |
-
return this.activate_field();
|
792 |
-
}
|
793 |
-
}
|
794 |
-
};
|
795 |
-
|
796 |
-
Chosen.prototype.container_mouseup = function(evt) {
|
797 |
-
if (evt.target.nodeName === "ABBR" && !this.is_disabled) {
|
798 |
-
return this.results_reset(evt);
|
799 |
-
}
|
800 |
-
};
|
801 |
-
|
802 |
-
Chosen.prototype.search_results_mousewheel = function(evt) {
|
803 |
-
var delta;
|
804 |
-
if (evt.originalEvent) {
|
805 |
-
delta = evt.originalEvent.deltaY || -evt.originalEvent.wheelDelta || evt.originalEvent.detail;
|
806 |
-
}
|
807 |
-
if (delta != null) {
|
808 |
-
evt.preventDefault();
|
809 |
-
if (evt.type === 'DOMMouseScroll') {
|
810 |
-
delta = delta * 40;
|
811 |
-
}
|
812 |
-
return this.search_results.scrollTop(delta + this.search_results.scrollTop());
|
813 |
-
}
|
814 |
-
};
|
815 |
-
|
816 |
-
Chosen.prototype.blur_test = function(evt) {
|
817 |
-
if (!this.active_field && this.container.hasClass("chosen-container-active")) {
|
818 |
-
return this.close_field();
|
819 |
-
}
|
820 |
-
};
|
821 |
-
|
822 |
-
Chosen.prototype.close_field = function() {
|
823 |
-
$(this.container[0].ownerDocument).unbind("click.chosen", this.click_test_action);
|
824 |
-
this.active_field = false;
|
825 |
-
this.results_hide();
|
826 |
-
this.container.removeClass("chosen-container-active");
|
827 |
-
this.clear_backstroke();
|
828 |
-
this.show_search_field_default();
|
829 |
-
return this.search_field_scale();
|
830 |
-
};
|
831 |
-
|
832 |
-
Chosen.prototype.activate_field = function() {
|
833 |
-
this.container.addClass("chosen-container-active");
|
834 |
-
this.active_field = true;
|
835 |
-
this.search_field.val(this.search_field.val());
|
836 |
-
return this.search_field.focus();
|
837 |
-
};
|
838 |
-
|
839 |
-
Chosen.prototype.test_active_click = function(evt) {
|
840 |
-
var active_container;
|
841 |
-
active_container = $(evt.target).closest('.chosen-container');
|
842 |
-
if (active_container.length && this.container[0] === active_container[0]) {
|
843 |
-
return this.active_field = true;
|
844 |
-
} else {
|
845 |
-
return this.close_field();
|
846 |
-
}
|
847 |
-
};
|
848 |
-
|
849 |
-
Chosen.prototype.results_build = function() {
|
850 |
-
this.parsing = true;
|
851 |
-
this.selected_option_count = null;
|
852 |
-
this.results_data = SelectParser.select_to_array(this.form_field);
|
853 |
-
if (this.is_multiple) {
|
854 |
-
this.search_choices.find("li.search-choice").remove();
|
855 |
-
} else if (!this.is_multiple) {
|
856 |
-
this.single_set_selected_text();
|
857 |
-
if (this.disable_search || this.form_field.options.length <= this.disable_search_threshold) {
|
858 |
-
this.search_field[0].readOnly = true;
|
859 |
-
this.container.addClass("chosen-container-single-nosearch");
|
860 |
-
} else {
|
861 |
-
this.search_field[0].readOnly = false;
|
862 |
-
this.container.removeClass("chosen-container-single-nosearch");
|
863 |
-
}
|
864 |
-
}
|
865 |
-
this.update_results_content(this.results_option_build({
|
866 |
-
first: true
|
867 |
-
}));
|
868 |
-
this.search_field_disabled();
|
869 |
-
this.show_search_field_default();
|
870 |
-
this.search_field_scale();
|
871 |
-
return this.parsing = false;
|
872 |
-
};
|
873 |
-
|
874 |
-
Chosen.prototype.result_do_highlight = function(el) {
|
875 |
-
var high_bottom, high_top, maxHeight, visible_bottom, visible_top;
|
876 |
-
if (el.length) {
|
877 |
-
this.result_clear_highlight();
|
878 |
-
this.result_highlight = el;
|
879 |
-
this.result_highlight.addClass("highlighted");
|
880 |
-
maxHeight = parseInt(this.search_results.css("maxHeight"), 10);
|
881 |
-
visible_top = this.search_results.scrollTop();
|
882 |
-
visible_bottom = maxHeight + visible_top;
|
883 |
-
high_top = this.result_highlight.position().top + this.search_results.scrollTop();
|
884 |
-
high_bottom = high_top + this.result_highlight.outerHeight();
|
885 |
-
if (high_bottom >= visible_bottom) {
|
886 |
-
return this.search_results.scrollTop((high_bottom - maxHeight) > 0 ? high_bottom - maxHeight : 0);
|
887 |
-
} else if (high_top < visible_top) {
|
888 |
-
return this.search_results.scrollTop(high_top);
|
889 |
-
}
|
890 |
-
}
|
891 |
-
};
|
892 |
-
|
893 |
-
Chosen.prototype.result_clear_highlight = function() {
|
894 |
-
if (this.result_highlight) {
|
895 |
-
this.result_highlight.removeClass("highlighted");
|
896 |
-
}
|
897 |
-
return this.result_highlight = null;
|
898 |
-
};
|
899 |
-
|
900 |
-
Chosen.prototype.results_show = function() {
|
901 |
-
if (this.is_multiple && this.max_selected_options <= this.choices_count()) {
|
902 |
-
this.form_field_jq.trigger("chosen:maxselected", {
|
903 |
-
chosen: this
|
904 |
-
});
|
905 |
-
return false;
|
906 |
-
}
|
907 |
-
this.container.addClass("chosen-with-drop");
|
908 |
-
this.results_showing = true;
|
909 |
-
this.search_field.focus();
|
910 |
-
this.search_field.val(this.search_field.val());
|
911 |
-
this.winnow_results();
|
912 |
-
return this.form_field_jq.trigger("chosen:showing_dropdown", {
|
913 |
-
chosen: this
|
914 |
-
});
|
915 |
-
};
|
916 |
-
|
917 |
-
Chosen.prototype.update_results_content = function(content) {
|
918 |
-
return this.search_results.html(content);
|
919 |
-
};
|
920 |
-
|
921 |
-
Chosen.prototype.results_hide = function() {
|
922 |
-
if (this.results_showing) {
|
923 |
-
this.result_clear_highlight();
|
924 |
-
this.container.removeClass("chosen-with-drop");
|
925 |
-
this.form_field_jq.trigger("chosen:hiding_dropdown", {
|
926 |
-
chosen: this
|
927 |
-
});
|
928 |
-
}
|
929 |
-
return this.results_showing = false;
|
930 |
-
};
|
931 |
-
|
932 |
-
Chosen.prototype.set_tab_index = function(el) {
|
933 |
-
var ti;
|
934 |
-
if (this.form_field.tabIndex) {
|
935 |
-
ti = this.form_field.tabIndex;
|
936 |
-
this.form_field.tabIndex = -1;
|
937 |
-
return this.search_field[0].tabIndex = ti;
|
938 |
-
}
|
939 |
-
};
|
940 |
-
|
941 |
-
Chosen.prototype.set_label_behavior = function() {
|
942 |
-
var _this = this;
|
943 |
-
this.form_field_label = this.form_field_jq.parents("label");
|
944 |
-
if (!this.form_field_label.length && this.form_field.id.length) {
|
945 |
-
this.form_field_label = $("label[for='" + this.form_field.id + "']");
|
946 |
-
}
|
947 |
-
if (this.form_field_label.length > 0) {
|
948 |
-
return this.form_field_label.bind('click.chosen', function(evt) {
|
949 |
-
if (_this.is_multiple) {
|
950 |
-
return _this.container_mousedown(evt);
|
951 |
-
} else {
|
952 |
-
return _this.activate_field();
|
953 |
-
}
|
954 |
-
});
|
955 |
-
}
|
956 |
-
};
|
957 |
-
|
958 |
-
Chosen.prototype.show_search_field_default = function() {
|
959 |
-
if (this.is_multiple && this.choices_count() < 1 && !this.active_field) {
|
960 |
-
this.search_field.val(this.default_text);
|
961 |
-
return this.search_field.addClass("default");
|
962 |
-
} else {
|
963 |
-
this.search_field.val("");
|
964 |
-
return this.search_field.removeClass("default");
|
965 |
-
}
|
966 |
-
};
|
967 |
-
|
968 |
-
Chosen.prototype.search_results_mouseup = function(evt) {
|
969 |
-
var target;
|
970 |
-
target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
|
971 |
-
if (target.length) {
|
972 |
-
this.result_highlight = target;
|
973 |
-
this.result_select(evt);
|
974 |
-
return this.search_field.focus();
|
975 |
-
}
|
976 |
-
};
|
977 |
-
|
978 |
-
Chosen.prototype.search_results_mouseover = function(evt) {
|
979 |
-
var target;
|
980 |
-
target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
|
981 |
-
if (target) {
|
982 |
-
return this.result_do_highlight(target);
|
983 |
-
}
|
984 |
-
};
|
985 |
-
|
986 |
-
Chosen.prototype.search_results_mouseout = function(evt) {
|
987 |
-
if ($(evt.target).hasClass("active-result" || $(evt.target).parents('.active-result').first())) {
|
988 |
-
return this.result_clear_highlight();
|
989 |
-
}
|
990 |
-
};
|
991 |
-
|
992 |
-
Chosen.prototype.choice_build = function(item) {
|
993 |
-
var choice, close_link,
|
994 |
-
_this = this;
|
995 |
-
choice = $('<li />', {
|
996 |
-
"class": "search-choice"
|
997 |
-
}).html("<span>" + (this.choice_label(item)) + "</span>");
|
998 |
-
if (item.disabled) {
|
999 |
-
choice.addClass('search-choice-disabled');
|
1000 |
-
} else {
|
1001 |
-
close_link = $('<a />', {
|
1002 |
-
"class": 'search-choice-close',
|
1003 |
-
'data-option-array-index': item.array_index
|
1004 |
-
});
|
1005 |
-
close_link.bind('click.chosen', function(evt) {
|
1006 |
-
return _this.choice_destroy_link_click(evt);
|
1007 |
-
});
|
1008 |
-
choice.append(close_link);
|
1009 |
-
}
|
1010 |
-
return this.search_container.before(choice);
|
1011 |
-
};
|
1012 |
-
|
1013 |
-
Chosen.prototype.choice_destroy_link_click = function(evt) {
|
1014 |
-
evt.preventDefault();
|
1015 |
-
evt.stopPropagation();
|
1016 |
-
if (!this.is_disabled) {
|
1017 |
-
return this.choice_destroy($(evt.target));
|
1018 |
-
}
|
1019 |
-
};
|
1020 |
-
|
1021 |
-
Chosen.prototype.choice_destroy = function(link) {
|
1022 |
-
if (this.result_deselect(link[0].getAttribute("data-option-array-index"))) {
|
1023 |
-
this.show_search_field_default();
|
1024 |
-
if (this.is_multiple && this.choices_count() > 0 && this.search_field.val().length < 1) {
|
1025 |
-
this.results_hide();
|
1026 |
-
}
|
1027 |
-
link.parents('li').first().remove();
|
1028 |
-
return this.search_field_scale();
|
1029 |
-
}
|
1030 |
-
};
|
1031 |
-
|
1032 |
-
Chosen.prototype.results_reset = function() {
|
1033 |
-
this.reset_single_select_options();
|
1034 |
-
this.form_field.options[0].selected = true;
|
1035 |
-
this.single_set_selected_text();
|
1036 |
-
this.show_search_field_default();
|
1037 |
-
this.results_reset_cleanup();
|
1038 |
-
this.form_field_jq.trigger("change");
|
1039 |
-
if (this.active_field) {
|
1040 |
-
return this.results_hide();
|
1041 |
-
}
|
1042 |
-
};
|
1043 |
-
|
1044 |
-
Chosen.prototype.results_reset_cleanup = function() {
|
1045 |
-
this.current_selectedIndex = this.form_field.selectedIndex;
|
1046 |
-
return this.selected_item.find("abbr").remove();
|
1047 |
-
};
|
1048 |
-
|
1049 |
-
Chosen.prototype.result_select = function(evt) {
|
1050 |
-
var high, item;
|
1051 |
-
if (this.result_highlight) {
|
1052 |
-
high = this.result_highlight;
|
1053 |
-
this.result_clear_highlight();
|
1054 |
-
if (this.is_multiple && this.max_selected_options <= this.choices_count()) {
|
1055 |
-
this.form_field_jq.trigger("chosen:maxselected", {
|
1056 |
-
chosen: this
|
1057 |
-
});
|
1058 |
-
return false;
|
1059 |
-
}
|
1060 |
-
if (this.is_multiple) {
|
1061 |
-
high.removeClass("active-result");
|
1062 |
-
} else {
|
1063 |
-
this.reset_single_select_options();
|
1064 |
-
}
|
1065 |
-
high.addClass("result-selected");
|
1066 |
-
item = this.results_data[high[0].getAttribute("data-option-array-index")];
|
1067 |
-
item.selected = true;
|
1068 |
-
this.form_field.options[item.options_index].selected = true;
|
1069 |
-
this.selected_option_count = null;
|
1070 |
-
if (this.is_multiple) {
|
1071 |
-
this.choice_build(item);
|
1072 |
-
} else {
|
1073 |
-
this.single_set_selected_text(this.choice_label(item));
|
1074 |
-
}
|
1075 |
-
if (!((evt.metaKey || evt.ctrlKey) && this.is_multiple)) {
|
1076 |
-
this.results_hide();
|
1077 |
-
}
|
1078 |
-
this.show_search_field_default();
|
1079 |
-
if (this.is_multiple || this.form_field.selectedIndex !== this.current_selectedIndex) {
|
1080 |
-
this.form_field_jq.trigger("change", {
|
1081 |
-
'selected': this.form_field.options[item.options_index].value
|
1082 |
-
});
|
1083 |
-
}
|
1084 |
-
this.current_selectedIndex = this.form_field.selectedIndex;
|
1085 |
-
evt.preventDefault();
|
1086 |
-
return this.search_field_scale();
|
1087 |
-
}
|
1088 |
-
};
|
1089 |
-
|
1090 |
-
Chosen.prototype.single_set_selected_text = function(text) {
|
1091 |
-
if (text == null) {
|
1092 |
-
text = this.default_text;
|
1093 |
-
}
|
1094 |
-
if (text === this.default_text) {
|
1095 |
-
this.selected_item.addClass("chosen-default");
|
1096 |
-
} else {
|
1097 |
-
this.single_deselect_control_build();
|
1098 |
-
this.selected_item.removeClass("chosen-default");
|
1099 |
-
}
|
1100 |
-
return this.selected_item.find("span").html(text);
|
1101 |
-
};
|
1102 |
-
|
1103 |
-
Chosen.prototype.result_deselect = function(pos) {
|
1104 |
-
var result_data;
|
1105 |
-
result_data = this.results_data[pos];
|
1106 |
-
if (!this.form_field.options[result_data.options_index].disabled) {
|
1107 |
-
result_data.selected = false;
|
1108 |
-
this.form_field.options[result_data.options_index].selected = false;
|
1109 |
-
this.selected_option_count = null;
|
1110 |
-
this.result_clear_highlight();
|
1111 |
-
if (this.results_showing) {
|
1112 |
-
this.winnow_results();
|
1113 |
-
}
|
1114 |
-
this.form_field_jq.trigger("change", {
|
1115 |
-
deselected: this.form_field.options[result_data.options_index].value
|
1116 |
-
});
|
1117 |
-
this.search_field_scale();
|
1118 |
-
return true;
|
1119 |
-
} else {
|
1120 |
-
return false;
|
1121 |
-
}
|
1122 |
-
};
|
1123 |
-
|
1124 |
-
Chosen.prototype.single_deselect_control_build = function() {
|
1125 |
-
if (!this.allow_single_deselect) {
|
1126 |
-
return;
|
1127 |
-
}
|
1128 |
-
if (!this.selected_item.find("abbr").length) {
|
1129 |
-
this.selected_item.find("span").first().after("<abbr class=\"search-choice-close\"></abbr>");
|
1130 |
-
}
|
1131 |
-
return this.selected_item.addClass("chosen-single-with-deselect");
|
1132 |
-
};
|
1133 |
-
|
1134 |
-
Chosen.prototype.get_search_text = function() {
|
1135 |
-
return $('<div/>').text($.trim(this.search_field.val())).html();
|
1136 |
-
};
|
1137 |
-
|
1138 |
-
Chosen.prototype.winnow_results_set_highlight = function() {
|
1139 |
-
var do_high, selected_results;
|
1140 |
-
selected_results = !this.is_multiple ? this.search_results.find(".result-selected.active-result") : [];
|
1141 |
-
do_high = selected_results.length ? selected_results.first() : this.search_results.find(".active-result").first();
|
1142 |
-
if (do_high != null) {
|
1143 |
-
return this.result_do_highlight(do_high);
|
1144 |
-
}
|
1145 |
-
};
|
1146 |
-
|
1147 |
-
Chosen.prototype.no_results = function(terms) {
|
1148 |
-
var no_results_html;
|
1149 |
-
no_results_html = $('<li class="no-results">' + this.results_none_found + ' "<span></span>"</li>');
|
1150 |
-
no_results_html.find("span").first().html(terms);
|
1151 |
-
this.search_results.append(no_results_html);
|
1152 |
-
return this.form_field_jq.trigger("chosen:no_results", {
|
1153 |
-
chosen: this
|
1154 |
-
});
|
1155 |
-
};
|
1156 |
-
|
1157 |
-
Chosen.prototype.no_results_clear = function() {
|
1158 |
-
return this.search_results.find(".no-results").remove();
|
1159 |
-
};
|
1160 |
-
|
1161 |
-
Chosen.prototype.keydown_arrow = function() {
|
1162 |
-
var next_sib;
|
1163 |
-
if (this.results_showing && this.result_highlight) {
|
1164 |
-
next_sib = this.result_highlight.nextAll("li.active-result").first();
|
1165 |
-
if (next_sib) {
|
1166 |
-
return this.result_do_highlight(next_sib);
|
1167 |
-
}
|
1168 |
-
} else {
|
1169 |
-
return this.results_show();
|
1170 |
-
}
|
1171 |
-
};
|
1172 |
-
|
1173 |
-
Chosen.prototype.keyup_arrow = function() {
|
1174 |
-
var prev_sibs;
|
1175 |
-
if (!this.results_showing && !this.is_multiple) {
|
1176 |
-
return this.results_show();
|
1177 |
-
} else if (this.result_highlight) {
|
1178 |
-
prev_sibs = this.result_highlight.prevAll("li.active-result");
|
1179 |
-
if (prev_sibs.length) {
|
1180 |
-
return this.result_do_highlight(prev_sibs.first());
|
1181 |
-
} else {
|
1182 |
-
if (this.choices_count() > 0) {
|
1183 |
-
this.results_hide();
|
1184 |
-
}
|
1185 |
-
return this.result_clear_highlight();
|
1186 |
-
}
|
1187 |
-
}
|
1188 |
-
};
|
1189 |
-
|
1190 |
-
Chosen.prototype.keydown_backstroke = function() {
|
1191 |
-
var next_available_destroy;
|
1192 |
-
if (this.pending_backstroke) {
|
1193 |
-
this.choice_destroy(this.pending_backstroke.find("a").first());
|
1194 |
-
return this.clear_backstroke();
|
1195 |
-
} else {
|
1196 |
-
next_available_destroy = this.search_container.siblings("li.search-choice").last();
|
1197 |
-
if (next_available_destroy.length && !next_available_destroy.hasClass("search-choice-disabled")) {
|
1198 |
-
this.pending_backstroke = next_available_destroy;
|
1199 |
-
if (this.single_backstroke_delete) {
|
1200 |
-
return this.keydown_backstroke();
|
1201 |
-
} else {
|
1202 |
-
return this.pending_backstroke.addClass("search-choice-focus");
|
1203 |
-
}
|
1204 |
-
}
|
1205 |
-
}
|
1206 |
-
};
|
1207 |
-
|
1208 |
-
Chosen.prototype.clear_backstroke = function() {
|
1209 |
-
if (this.pending_backstroke) {
|
1210 |
-
this.pending_backstroke.removeClass("search-choice-focus");
|
1211 |
-
}
|
1212 |
-
return this.pending_backstroke = null;
|
1213 |
-
};
|
1214 |
-
|
1215 |
-
Chosen.prototype.keydown_checker = function(evt) {
|
1216 |
-
var stroke, _ref1;
|
1217 |
-
stroke = (_ref1 = evt.which) != null ? _ref1 : evt.keyCode;
|
1218 |
-
this.search_field_scale();
|
1219 |
-
if (stroke !== 8 && this.pending_backstroke) {
|
1220 |
-
this.clear_backstroke();
|
1221 |
-
}
|
1222 |
-
switch (stroke) {
|
1223 |
-
case 8:
|
1224 |
-
this.backstroke_length = this.search_field.val().length;
|
1225 |
-
break;
|
1226 |
-
case 9:
|
1227 |
-
if (this.results_showing && !this.is_multiple) {
|
1228 |
-
this.result_select(evt);
|
1229 |
-
}
|
1230 |
-
this.mouse_on_container = false;
|
1231 |
-
break;
|
1232 |
-
case 13:
|
1233 |
-
if (this.results_showing) {
|
1234 |
-
evt.preventDefault();
|
1235 |
-
}
|
1236 |
-
break;
|
1237 |
-
case 32:
|
1238 |
-
if (this.disable_search) {
|
1239 |
-
evt.preventDefault();
|
1240 |
-
}
|
1241 |
-
break;
|
1242 |
-
case 38:
|
1243 |
-
evt.preventDefault();
|
1244 |
-
this.keyup_arrow();
|
1245 |
-
break;
|
1246 |
-
case 40:
|
1247 |
-
evt.preventDefault();
|
1248 |
-
this.keydown_arrow();
|
1249 |
-
break;
|
1250 |
-
}
|
1251 |
-
};
|
1252 |
-
|
1253 |
-
Chosen.prototype.search_field_scale = function() {
|
1254 |
-
var div, f_width, h, style, style_block, styles, w, _i, _len;
|
1255 |
-
if (this.is_multiple) {
|
1256 |
-
h = 0;
|
1257 |
-
w = 0;
|
1258 |
-
style_block = "position:absolute; left: -1000px; top: -1000px; display:none;";
|
1259 |
-
styles = ['font-size', 'font-style', 'font-weight', 'font-family', 'line-height', 'text-transform', 'letter-spacing'];
|
1260 |
-
for (_i = 0, _len = styles.length; _i < _len; _i++) {
|
1261 |
-
style = styles[_i];
|
1262 |
-
style_block += style + ":" + this.search_field.css(style) + ";";
|
1263 |
-
}
|
1264 |
-
div = $('<div />', {
|
1265 |
-
'style': style_block
|
1266 |
-
});
|
1267 |
-
div.text(this.search_field.val());
|
1268 |
-
$('body').append(div);
|
1269 |
-
w = div.width() + 25;
|
1270 |
-
div.remove();
|
1271 |
-
f_width = this.container.outerWidth();
|
1272 |
-
if (w > f_width - 10) {
|
1273 |
-
w = f_width - 10;
|
1274 |
-
}
|
1275 |
-
return this.search_field.css({
|
1276 |
-
'width': w + 'px'
|
1277 |
-
});
|
1278 |
-
}
|
1279 |
-
};
|
1280 |
-
|
1281 |
-
return Chosen;
|
1282 |
-
|
1283 |
-
})(AbstractChosen);
|
1284 |
-
|
1285 |
}).call(this);
|
1 |
+
/*!
|
2 |
+
Chosen, a Select Box Enhancer for jQuery and Prototype
|
3 |
+
by Patrick Filler for Harvest, http://getharvest.com
|
4 |
+
|
5 |
+
Version 1.5.1
|
6 |
+
Full source at https://github.com/harvesthq/chosen
|
7 |
+
Copyright (c) 2011-2016 Harvest http://getharvest.com
|
8 |
+
|
9 |
+
MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
|
10 |
+
This file is generated by `grunt build`, do not edit it by hand.
|
11 |
+
*/
|
12 |
+
|
13 |
+
(function() {
|
14 |
+
var $, AbstractChosen, Chosen, SelectParser, _ref,
|
15 |
+
__hasProp = {}.hasOwnProperty,
|
16 |
+
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
17 |
+
|
18 |
+
SelectParser = (function() {
|
19 |
+
function SelectParser() {
|
20 |
+
this.options_index = 0;
|
21 |
+
this.parsed = [];
|
22 |
+
}
|
23 |
+
|
24 |
+
SelectParser.prototype.add_node = function(child) {
|
25 |
+
if (child.nodeName.toUpperCase() === "OPTGROUP") {
|
26 |
+
return this.add_group(child);
|
27 |
+
} else {
|
28 |
+
return this.add_option(child);
|
29 |
+
}
|
30 |
+
};
|
31 |
+
|
32 |
+
SelectParser.prototype.add_group = function(group) {
|
33 |
+
var group_position, option, _i, _len, _ref, _results;
|
34 |
+
group_position = this.parsed.length;
|
35 |
+
this.parsed.push({
|
36 |
+
array_index: group_position,
|
37 |
+
group: true,
|
38 |
+
label: this.escapeExpression(group.label),
|
39 |
+
title: group.title ? group.title : void 0,
|
40 |
+
children: 0,
|
41 |
+
disabled: group.disabled,
|
42 |
+
classes: group.className
|
43 |
+
});
|
44 |
+
_ref = group.childNodes;
|
45 |
+
_results = [];
|
46 |
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
47 |
+
option = _ref[_i];
|
48 |
+
_results.push(this.add_option(option, group_position, group.disabled));
|
49 |
+
}
|
50 |
+
return _results;
|
51 |
+
};
|
52 |
+
|
53 |
+
SelectParser.prototype.add_option = function(option, group_position, group_disabled) {
|
54 |
+
if (option.nodeName.toUpperCase() === "OPTION") {
|
55 |
+
if (option.text !== "") {
|
56 |
+
if (group_position != null) {
|
57 |
+
this.parsed[group_position].children += 1;
|
58 |
+
}
|
59 |
+
this.parsed.push({
|
60 |
+
array_index: this.parsed.length,
|
61 |
+
options_index: this.options_index,
|
62 |
+
value: option.value,
|
63 |
+
text: option.text,
|
64 |
+
html: option.innerHTML,
|
65 |
+
title: option.title ? option.title : void 0,
|
66 |
+
selected: option.selected,
|
67 |
+
disabled: group_disabled === true ? group_disabled : option.disabled,
|
68 |
+
group_array_index: group_position,
|
69 |
+
group_label: group_position != null ? this.parsed[group_position].label : null,
|
70 |
+
classes: option.className,
|
71 |
+
style: option.style.cssText
|
72 |
+
});
|
73 |
+
} else {
|
74 |
+
this.parsed.push({
|
75 |
+
array_index: this.parsed.length,
|
76 |
+
options_index: this.options_index,
|
77 |
+
empty: true
|
78 |
+
});
|
79 |
+
}
|
80 |
+
return this.options_index += 1;
|
81 |
+
}
|
82 |
+
};
|
83 |
+
|
84 |
+
SelectParser.prototype.escapeExpression = function(text) {
|
85 |
+
var map, unsafe_chars;
|
86 |
+
if ((text == null) || text === false) {
|
87 |
+
return "";
|
88 |
+
}
|
89 |
+
if (!/[\&\<\>\"\'\`]/.test(text)) {
|
90 |
+
return text;
|
91 |
+
}
|
92 |
+
map = {
|
93 |
+
"<": "<",
|
94 |
+
">": ">",
|
95 |
+
'"': """,
|
96 |
+
"'": "'",
|
97 |
+
"`": "`"
|
98 |
+
};
|
99 |
+
unsafe_chars = /&(?!\w+;)|[\<\>\"\'\`]/g;
|
100 |
+
return text.replace(unsafe_chars, function(chr) {
|
101 |
+
return map[chr] || "&";
|
102 |
+
});
|
103 |
+
};
|
104 |
+
|
105 |
+
return SelectParser;
|
106 |
+
|
107 |
+
})();
|
108 |
+
|
109 |
+
SelectParser.select_to_array = function(select) {
|
110 |
+
var child, parser, _i, _len, _ref;
|
111 |
+
parser = new SelectParser();
|
112 |
+
_ref = select.childNodes;
|
113 |
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
114 |
+
child = _ref[_i];
|
115 |
+
parser.add_node(child);
|
116 |
+
}
|
117 |
+
return parser.parsed;
|
118 |
+
};
|
119 |
+
|
120 |
+
AbstractChosen = (function() {
|
121 |
+
function AbstractChosen(form_field, options) {
|
122 |
+
this.form_field = form_field;
|
123 |
+
this.options = options != null ? options : {};
|
124 |
+
if (!AbstractChosen.browser_is_supported()) {
|
125 |
+
return;
|
126 |
+
}
|
127 |
+
this.is_multiple = this.form_field.multiple;
|
128 |
+
this.set_default_text();
|
129 |
+
this.set_default_values();
|
130 |
+
this.setup();
|
131 |
+
this.set_up_html();
|
132 |
+
this.register_observers();
|
133 |
+
this.on_ready();
|
134 |
+
}
|
135 |
+
|
136 |
+
AbstractChosen.prototype.set_default_values = function() {
|
137 |
+
var _this = this;
|
138 |
+
this.click_test_action = function(evt) {
|
139 |
+
return _this.test_active_click(evt);
|
140 |
+
};
|
141 |
+
this.activate_action = function(evt) {
|
142 |
+
return _this.activate_field(evt);
|
143 |
+
};
|
144 |
+
this.active_field = false;
|
145 |
+
this.mouse_on_container = false;
|
146 |
+
this.results_showing = false;
|
147 |
+
this.result_highlighted = null;
|
148 |
+
this.allow_single_deselect = (this.options.allow_single_deselect != null) && (this.form_field.options[0] != null) && this.form_field.options[0].text === "" ? this.options.allow_single_deselect : false;
|
149 |
+
this.disable_search_threshold = this.options.disable_search_threshold || 0;
|
150 |
+
this.disable_search = this.options.disable_search || false;
|
151 |
+
this.enable_split_word_search = this.options.enable_split_word_search != null ? this.options.enable_split_word_search : true;
|
152 |
+
this.group_search = this.options.group_search != null ? this.options.group_search : true;
|
153 |
+
this.search_contains = this.options.search_contains || false;
|
154 |
+
this.single_backstroke_delete = this.options.single_backstroke_delete != null ? this.options.single_backstroke_delete : true;
|
155 |
+
this.max_selected_options = this.options.max_selected_options || Infinity;
|
156 |
+
this.inherit_select_classes = this.options.inherit_select_classes || false;
|
157 |
+
this.display_selected_options = this.options.display_selected_options != null ? this.options.display_selected_options : true;
|
158 |
+
this.display_disabled_options = this.options.display_disabled_options != null ? this.options.display_disabled_options : true;
|
159 |
+
this.include_group_label_in_selected = this.options.include_group_label_in_selected || false;
|
160 |
+
return this.max_shown_results = this.options.max_shown_results || Number.POSITIVE_INFINITY;
|
161 |
+
};
|
162 |
+
|
163 |
+
AbstractChosen.prototype.set_default_text = function() {
|
164 |
+
if (this.form_field.getAttribute("data-placeholder")) {
|
165 |
+
this.default_text = this.form_field.getAttribute("data-placeholder");
|
166 |
+
} else if (this.is_multiple) {
|
167 |
+
this.default_text = this.options.placeholder_text_multiple || this.options.placeholder_text || AbstractChosen.default_multiple_text;
|
168 |
+
} else {
|
169 |
+
this.default_text = this.options.placeholder_text_single || this.options.placeholder_text || AbstractChosen.default_single_text;
|
170 |
+
}
|
171 |
+
return this.results_none_found = this.form_field.getAttribute("data-no_results_text") || this.options.no_results_text || AbstractChosen.default_no_result_text;
|
172 |
+
};
|
173 |
+
|
174 |
+
AbstractChosen.prototype.choice_label = function(item) {
|
175 |
+
if (this.include_group_label_in_selected && (item.group_label != null)) {
|
176 |
+
return "<b class='group-name'>" + item.group_label + "</b>" + item.html;
|
177 |
+
} else {
|
178 |
+
return item.html;
|
179 |
+
}
|
180 |
+
};
|
181 |
+
|
182 |
+
AbstractChosen.prototype.mouse_enter = function() {
|
183 |
+
return this.mouse_on_container = true;
|
184 |
+
};
|
185 |
+
|
186 |
+
AbstractChosen.prototype.mouse_leave = function() {
|
187 |
+
return this.mouse_on_container = false;
|
188 |
+
};
|
189 |
+
|
190 |
+
AbstractChosen.prototype.input_focus = function(evt) {
|
191 |
+
var _this = this;
|
192 |
+
if (this.is_multiple) {
|
193 |
+
if (!this.active_field) {
|
194 |
+
return setTimeout((function() {
|
195 |
+
return _this.container_mousedown();
|
196 |
+
}), 50);
|
197 |
+
}
|
198 |
+
} else {
|
199 |
+
if (!this.active_field) {
|
200 |
+
return this.activate_field();
|
201 |
+
}
|
202 |
+
}
|
203 |
+
};
|
204 |
+
|
205 |
+
AbstractChosen.prototype.input_blur = function(evt) {
|
206 |
+
var _this = this;
|
207 |
+
if (!this.mouse_on_container) {
|
208 |
+
this.active_field = false;
|
209 |
+
return setTimeout((function() {
|
210 |
+
return _this.blur_test();
|
211 |
+
}), 100);
|
212 |
+
}
|
213 |
+
};
|
214 |
+
|
215 |
+
AbstractChosen.prototype.results_option_build = function(options) {
|
216 |
+
var content, data, data_content, shown_results, _i, _len, _ref;
|
217 |
+
content = '';
|
218 |
+
shown_results = 0;
|
219 |
+
_ref = this.results_data;
|
220 |
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
221 |
+
data = _ref[_i];
|
222 |
+
data_content = '';
|
223 |
+
if (data.group) {
|
224 |
+
data_content = this.result_add_group(data);
|
225 |
+
} else {
|
226 |
+
data_content = this.result_add_option(data);
|
227 |
+
}
|
228 |
+
if (data_content !== '') {
|
229 |
+
shown_results++;
|
230 |
+
content += data_content;
|
231 |
+
}
|
232 |
+
if (options != null ? options.first : void 0) {
|
233 |
+
if (data.selected && this.is_multiple) {
|
234 |
+
this.choice_build(data);
|
235 |
+
} else if (data.selected && !this.is_multiple) {
|
236 |
+
this.single_set_selected_text(this.choice_label(data));
|
237 |
+
}
|
238 |
+
}
|
239 |
+
if (shown_results >= this.max_shown_results) {
|
240 |
+
break;
|
241 |
+
}
|
242 |
+
}
|
243 |
+
return content;
|
244 |
+
};
|
245 |
+
|
246 |
+
AbstractChosen.prototype.result_add_option = function(option) {
|
247 |
+
var classes, option_el;
|
248 |
+
if (!option.search_match) {
|
249 |
+
return '';
|
250 |
+
}
|
251 |
+
if (!this.include_option_in_results(option)) {
|
252 |
+
return '';
|
253 |
+
}
|
254 |
+
classes = [];
|
255 |
+
if (!option.disabled && !(option.selected && this.is_multiple)) {
|
256 |
+
classes.push("active-result");
|
257 |
+
}
|
258 |
+
if (option.disabled && !(option.selected && this.is_multiple)) {
|
259 |
+
classes.push("disabled-result");
|
260 |
+
}
|
261 |
+
if (option.selected) {
|
262 |
+
classes.push("result-selected");
|
263 |
+
}
|
264 |
+
if (option.group_array_index != null) {
|
265 |
+
classes.push("group-option");
|
266 |
+
}
|
267 |
+
if (option.classes !== "") {
|
268 |
+
classes.push(option.classes);
|
269 |
+
}
|
270 |
+
option_el = document.createElement("li");
|
271 |
+
option_el.className = classes.join(" ");
|
272 |
+
option_el.style.cssText = option.style;
|
273 |
+
option_el.setAttribute("data-option-array-index", option.array_index);
|
274 |
+
option_el.innerHTML = option.search_text;
|
275 |
+
if (option.title) {
|
276 |
+
option_el.title = option.title;
|
277 |
+
}
|
278 |
+
return this.outerHTML(option_el);
|
279 |
+
};
|
280 |
+
|
281 |
+
AbstractChosen.prototype.result_add_group = function(group) {
|
282 |
+
var classes, group_el;
|
283 |
+
if (!(group.search_match || group.group_match)) {
|
284 |
+
return '';
|
285 |
+
}
|
286 |
+
if (!(group.active_options > 0)) {
|
287 |
+
return '';
|
288 |
+
}
|
289 |
+
classes = [];
|
290 |
+
classes.push("group-result");
|
291 |
+
if (group.classes) {
|
292 |
+
classes.push(group.classes);
|
293 |
+
}
|
294 |
+
group_el = document.createElement("li");
|
295 |
+
group_el.className = classes.join(" ");
|
296 |
+
group_el.innerHTML = group.search_text;
|
297 |
+
if (group.title) {
|
298 |
+
group_el.title = group.title;
|
299 |
+
}
|
300 |
+
return this.outerHTML(group_el);
|
301 |
+
};
|
302 |
+
|
303 |
+
AbstractChosen.prototype.results_update_field = function() {
|
304 |
+
this.set_default_text();
|
305 |
+
if (!this.is_multiple) {
|
306 |
+
this.results_reset_cleanup();
|
307 |
+
}
|
308 |
+
this.result_clear_highlight();
|
309 |
+
this.results_build();
|
310 |
+
if (this.results_showing) {
|
311 |
+
return this.winnow_results();
|
312 |
+
}
|
313 |
+
};
|
314 |
+
|
315 |
+
AbstractChosen.prototype.reset_single_select_options = function() {
|
316 |
+
var result, _i, _len, _ref, _results;
|
317 |
+
_ref = this.results_data;
|
318 |
+
_results = [];
|
319 |
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
320 |
+
result = _ref[_i];
|
321 |
+
if (result.selected) {
|
322 |
+
_results.push(result.selected = false);
|
323 |
+
} else {
|
324 |
+
_results.push(void 0);
|
325 |
+
}
|
326 |
+
}
|
327 |
+
return _results;
|
328 |
+
};
|
329 |
+
|
330 |
+
AbstractChosen.prototype.results_toggle = function() {
|
331 |
+
if (this.results_showing) {
|
332 |
+
return this.results_hide();
|
333 |
+
} else {
|
334 |
+
return this.results_show();
|
335 |
+
}
|
336 |
+
};
|
337 |
+
|
338 |
+
AbstractChosen.prototype.results_search = function(evt) {
|
339 |
+
if (this.results_showing) {
|
340 |
+
return this.winnow_results();
|
341 |
+
} else {
|
342 |
+
return this.results_show();
|
343 |
+
}
|
344 |
+
};
|
345 |
+
|
346 |
+
AbstractChosen.prototype.winnow_results = function() {
|
347 |
+
var escapedSearchText, option, regex, results, results_group, searchText, startpos, text, zregex, _i, _len, _ref;
|
348 |
+
this.no_results_clear();
|
349 |
+
results = 0;
|
350 |
+
searchText = this.get_search_text();
|
351 |
+
escapedSearchText = searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
352 |
+
zregex = new RegExp(escapedSearchText, 'i');
|
353 |
+
regex = this.get_search_regex(escapedSearchText);
|
354 |
+
_ref = this.results_data;
|
355 |
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
356 |
+
option = _ref[_i];
|
357 |
+
option.search_match = false;
|
358 |
+
results_group = null;
|
359 |
+
if (this.include_option_in_results(option)) {
|
360 |
+
if (option.group) {
|
361 |
+
option.group_match = false;
|
362 |
+
option.active_options = 0;
|
363 |
+
}
|
364 |
+
if ((option.group_array_index != null) && this.results_data[option.group_array_index]) {
|
365 |
+
results_group = this.results_data[option.group_array_index];
|
366 |
+
if (results_group.active_options === 0 && results_group.search_match) {
|
367 |
+
results += 1;
|
368 |
+
}
|
369 |
+
results_group.active_options += 1;
|
370 |
+
}
|
371 |
+
option.search_text = option.group ? option.label : option.html;
|
372 |
+
if (!(option.group && !this.group_search)) {
|
373 |
+
option.search_match = this.search_string_match(option.search_text, regex);
|
374 |
+
if (option.search_match && !option.group) {
|
375 |
+
results += 1;
|
376 |
+
}
|
377 |
+
if (option.search_match) {
|
378 |
+
if (searchText.length) {
|
379 |
+
startpos = option.search_text.search(zregex);
|
380 |
+
text = option.search_text.substr(0, startpos + searchText.length) + '</em>' + option.search_text.substr(startpos + searchText.length);
|
381 |
+
option.search_text = text.substr(0, startpos) + '<em>' + text.substr(startpos);
|
382 |
+
}
|
383 |
+
if (results_group != null) {
|
384 |
+
results_group.group_match = true;
|
385 |
+
}
|
386 |
+
} else if ((option.group_array_index != null) && this.results_data[option.group_array_index].search_match) {
|
387 |
+
option.search_match = true;
|
388 |
+
}
|
389 |
+
}
|
390 |
+
}
|
391 |
+
}
|
392 |
+
this.result_clear_highlight();
|
393 |
+
if (results < 1 && searchText.length) {
|
394 |
+
this.update_results_content("");
|
395 |
+
return this.no_results(searchText);
|
396 |
+
} else {
|
397 |
+
this.update_results_content(this.results_option_build());
|
398 |
+
return this.winnow_results_set_highlight();
|
399 |
+
}
|
400 |
+
};
|
401 |
+
|
402 |
+
AbstractChosen.prototype.get_search_regex = function(escaped_search_string) {
|
403 |
+
var regex_anchor;
|
404 |
+
regex_anchor = this.search_contains ? "" : "^";
|
405 |
+
return new RegExp(regex_anchor + escaped_search_string, 'i');
|
406 |
+
};
|
407 |
+
|
408 |
+
AbstractChosen.prototype.search_string_match = function(search_string, regex) {
|
409 |
+
var part, parts, _i, _len;
|
410 |
+
if (regex.test(search_string)) {
|
411 |
+
return true;
|
412 |
+
} else if (this.enable_split_word_search && (search_string.indexOf(" ") >= 0 || search_string.indexOf("[") === 0)) {
|
413 |
+
parts = search_string.replace(/\[|\]/g, "").split(" ");
|
414 |
+
if (parts.length) {
|
415 |
+
for (_i = 0, _len = parts.length; _i < _len; _i++) {
|
416 |
+
part = parts[_i];
|
417 |
+
if (regex.test(part)) {
|
418 |
+
return true;
|
419 |
+
}
|
420 |
+
}
|
421 |
+
}
|
422 |
+
}
|
423 |
+
};
|
424 |
+
|
425 |
+
AbstractChosen.prototype.choices_count = function() {
|
426 |
+
var option, _i, _len, _ref;
|
427 |
+
if (this.selected_option_count != null) {
|
428 |
+
return this.selected_option_count;
|
429 |
+
}
|
430 |
+
this.selected_option_count = 0;
|
431 |
+
_ref = this.form_field.options;
|
432 |
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
433 |
+
option = _ref[_i];
|
434 |
+
if (option.selected) {
|
435 |
+
this.selected_option_count += 1;
|
436 |
+
}
|
437 |
+
}
|
438 |
+
return this.selected_option_count;
|
439 |
+
};
|
440 |
+
|
441 |
+
AbstractChosen.prototype.choices_click = function(evt) {
|
442 |
+
evt.preventDefault();
|
443 |
+
if (!(this.results_showing || this.is_disabled)) {
|
444 |
+
return this.results_show();
|
445 |
+
}
|
446 |
+
};
|
447 |
+
|
448 |
+
AbstractChosen.prototype.keyup_checker = function(evt) {
|
449 |
+
var stroke, _ref;
|
450 |
+
stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
|
451 |
+
this.search_field_scale();
|
452 |
+
switch (stroke) {
|
453 |
+
case 8:
|
454 |
+
if (this.is_multiple && this.backstroke_length < 1 && this.choices_count() > 0) {
|
455 |
+
return this.keydown_backstroke();
|
456 |
+
} else if (!this.pending_backstroke) {
|
457 |
+
this.result_clear_highlight();
|
458 |
+
return this.results_search();
|
459 |
+
}
|
460 |
+
break;
|
461 |
+
case 13:
|
462 |
+
evt.preventDefault();
|
463 |
+
if (this.results_showing) {
|
464 |
+
return this.result_select(evt);
|
465 |
+
}
|
466 |
+
break;
|
467 |
+
case 27:
|
468 |
+
if (this.results_showing) {
|
469 |
+
this.results_hide();
|
470 |
+
}
|
471 |
+
return true;
|
472 |
+
case 9:
|
473 |
+
case 38:
|
474 |
+
case 40:
|
475 |
+
case 16:
|
476 |
+
case 91:
|
477 |
+
case 17:
|
478 |
+
case 18:
|
479 |
+
break;
|
480 |
+
default:
|
481 |
+
return this.results_search();
|
482 |
+
}
|
483 |
+
};
|
484 |
+
|
485 |
+
AbstractChosen.prototype.clipboard_event_checker = function(evt) {
|
486 |
+
var _this = this;
|
487 |
+
return setTimeout((function() {
|
488 |
+
return _this.results_search();
|
489 |
+
}), 50);
|
490 |
+
};
|
491 |
+
|
492 |
+
AbstractChosen.prototype.container_width = function() {
|
493 |
+
if (this.options.width != null) {
|
494 |
+
return this.options.width;
|
495 |
+
} else {
|
496 |
+
//return "" + this.form_field.offsetWidth + "px";
|
497 |
+
return "100%";
|
498 |
+
}
|
499 |
+
};
|
500 |
+
|
501 |
+
AbstractChosen.prototype.include_option_in_results = function(option) {
|
502 |
+
if (this.is_multiple && (!this.display_selected_options && option.selected)) {
|
503 |
+
return false;
|
504 |
+
}
|
505 |
+
if (!this.display_disabled_options && option.disabled) {
|
506 |
+
return false;
|
507 |
+
}
|
508 |
+
if (option.empty) {
|
509 |
+
return false;
|
510 |
+
}
|
511 |
+
return true;
|
512 |
+
};
|
513 |
+
|
514 |
+
AbstractChosen.prototype.search_results_touchstart = function(evt) {
|
515 |
+
this.touch_started = true;
|
516 |
+
return this.search_results_mouseover(evt);
|
517 |
+
};
|
518 |
+
|
519 |
+
AbstractChosen.prototype.search_results_touchmove = function(evt) {
|
520 |
+
this.touch_started = false;
|
521 |
+
return this.search_results_mouseout(evt);
|
522 |
+
};
|
523 |
+
|
524 |
+
AbstractChosen.prototype.search_results_touchend = function(evt) {
|
525 |
+
if (this.touch_started) {
|
526 |
+
return this.search_results_mouseup(evt);
|
527 |
+
}
|
528 |
+
};
|
529 |
+
|
530 |
+
AbstractChosen.prototype.outerHTML = function(element) {
|
531 |
+
var tmp;
|
532 |
+
if (element.outerHTML) {
|
533 |
+
return element.outerHTML;
|
534 |
+
}
|
535 |
+
tmp = document.createElement("div");
|
536 |
+
tmp.appendChild(element);
|
537 |
+
return tmp.innerHTML;
|
538 |
+
};
|
539 |
+
|
540 |
+
AbstractChosen.browser_is_supported = function() {
|
541 |
+
if (/iP(od|hone)/i.test(window.navigator.userAgent)) {
|
542 |
+
return false;
|
543 |
+
}
|
544 |
+
if (/Android/i.test(window.navigator.userAgent)) {
|
545 |
+
if (/Mobile/i.test(window.navigator.userAgent)) {
|
546 |
+
return false;
|
547 |
+
}
|
548 |
+
}
|
549 |
+
if (/IEMobile/i.test(window.navigator.userAgent)) {
|
550 |
+
return false;
|
551 |
+
}
|
552 |
+
if (/Windows Phone/i.test(window.navigator.userAgent)) {
|
553 |
+
return false;
|
554 |
+
}
|
555 |
+
if (/BlackBerry/i.test(window.navigator.userAgent)) {
|
556 |
+
return false;
|
557 |
+
}
|
558 |
+
if (/BB10/i.test(window.navigator.userAgent)) {
|
559 |
+
return false;
|
560 |
+
}
|
561 |
+
if (window.navigator.appName === "Microsoft Internet Explorer") {
|
562 |
+
return document.documentMode >= 8;
|
563 |
+
}
|
564 |
+
return true;
|
565 |
+
};
|
566 |
+
|
567 |
+
AbstractChosen.default_multiple_text = "Select report";
|
568 |
+
|
569 |
+
AbstractChosen.default_single_text = "Select an Option";
|
570 |
+
|
571 |
+
AbstractChosen.default_no_result_text = "No results match";
|
572 |
+
|
573 |
+
return AbstractChosen;
|
574 |
+
|
575 |
+
})();
|
576 |
+
|
577 |
+
$ = jQuery;
|
578 |
+
|
579 |
+
$.fn.extend({
|
580 |
+
chosen: function(options) {
|
581 |
+
if (!AbstractChosen.browser_is_supported()) {
|
582 |
+
return this;
|
583 |
+
}
|
584 |
+
return this.each(function(input_field) {
|
585 |
+
var $this, chosen;
|
586 |
+
$this = $(this);
|
587 |
+
chosen = $this.data('chosen');
|
588 |
+
if (options === 'destroy') {
|
589 |
+
if (chosen instanceof Chosen) {
|
590 |
+
chosen.destroy();
|
591 |
+
}
|
592 |
+
return;
|
593 |
+
}
|
594 |
+
if (!(chosen instanceof Chosen)) {
|
595 |
+
$this.data('chosen', new Chosen(this, options));
|
596 |
+
}
|
597 |
+
});
|
598 |
+
}
|
599 |
+
});
|
600 |
+
|
601 |
+
Chosen = (function(_super) {
|
602 |
+
__extends(Chosen, _super);
|
603 |
+
|
604 |
+
function Chosen() {
|
605 |
+
_ref = Chosen.__super__.constructor.apply(this, arguments);
|
606 |
+
return _ref;
|
607 |
+
}
|
608 |
+
|
609 |
+
Chosen.prototype.setup = function() {
|
610 |
+
this.form_field_jq = $(this.form_field);
|
611 |
+
this.current_selectedIndex = this.form_field.selectedIndex;
|
612 |
+
return this.is_rtl = this.form_field_jq.hasClass("chosen-rtl");
|
613 |
+
};
|
614 |
+
|
615 |
+
Chosen.prototype.set_up_html = function() {
|
616 |
+
var container_classes, container_props;
|
617 |
+
container_classes = ["chosen-container"];
|
618 |
+
container_classes.push("chosen-container-" + (this.is_multiple ? "multi" : "single"));
|
619 |
+
if (this.inherit_select_classes && this.form_field.className) {
|
620 |
+
container_classes.push(this.form_field.className);
|
621 |
+
}
|
622 |
+
if (this.is_rtl) {
|
623 |
+
container_classes.push("chosen-rtl");
|
624 |
+
}
|
625 |
+
container_props = {
|
626 |
+
'class': container_classes.join(' '),
|
627 |
+
'style': "width: " + (this.container_width()) + ";",
|
628 |
+
'title': this.form_field.title
|
629 |
+
};
|
630 |
+
if (this.form_field.id.length) {
|
631 |
+
container_props.id = this.form_field.id.replace(/[^\w]/g, '_') + "_chosen";
|
632 |
+
}
|
633 |
+
this.container = $("<div />", container_props);
|
634 |
+
if (this.is_multiple) {
|
635 |
+
this.container.html('<ul class="chosen-choices"><li class="search-field"><input type="text" value="' + this.default_text + '" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chosen-drop"><ul class="chosen-results"></ul></div>');
|
636 |
+
} else {
|
637 |
+
this.container.html('<a class="chosen-single chosen-default"><span>' + this.default_text + '</span><div><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" /></div><ul class="chosen-results"></ul></div>');
|
638 |
+
}
|
639 |
+
this.form_field_jq.hide().after(this.container);
|
640 |
+
this.dropdown = this.container.find('div.chosen-drop').first();
|
641 |
+
this.search_field = this.container.find('input').first();
|
642 |
+
this.search_results = this.container.find('ul.chosen-results').first();
|
643 |
+
this.search_field_scale();
|
644 |
+
this.search_no_results = this.container.find('li.no-results').first();
|
645 |
+
if (this.is_multiple) {
|
646 |
+
this.search_choices = this.container.find('ul.chosen-choices').first();
|
647 |
+
this.search_container = this.container.find('li.search-field').first();
|
648 |
+
} else {
|
649 |
+
this.search_container = this.container.find('div.chosen-search').first();
|
650 |
+
this.selected_item = this.container.find('.chosen-single').first();
|
651 |
+
}
|
652 |
+
this.results_build();
|
653 |
+
this.set_tab_index();
|
654 |
+
return this.set_label_behavior();
|
655 |
+
};
|
656 |
+
|
657 |
+
Chosen.prototype.on_ready = function() {
|
658 |
+
return this.form_field_jq.trigger("chosen:ready", {
|
659 |
+
chosen: this
|
660 |
+
});
|
661 |
+
};
|
662 |
+
|
663 |
+
Chosen.prototype.register_observers = function() {
|
664 |
+
var _this = this;
|
665 |
+
this.container.bind('touchstart.chosen', function(evt) {
|
666 |
+
_this.container_mousedown(evt);
|
667 |
+
return evt.preventDefault();
|
668 |
+
});
|
669 |
+
this.container.bind('touchend.chosen', function(evt) {
|
670 |
+
_this.container_mouseup(evt);
|
671 |
+
return evt.preventDefault();
|
672 |
+
});
|
673 |
+
this.container.bind('mousedown.chosen', function(evt) {
|
674 |
+
_this.container_mousedown(evt);
|
675 |
+
});
|
676 |
+
this.container.bind('mouseup.chosen', function(evt) {
|
677 |
+
_this.container_mouseup(evt);
|
678 |
+
});
|
679 |
+
this.container.bind('mouseenter.chosen', function(evt) {
|
680 |
+
_this.mouse_enter(evt);
|
681 |
+
});
|
682 |
+
this.container.bind('mouseleave.chosen', function(evt) {
|
683 |
+
_this.mouse_leave(evt);
|
684 |
+
});
|
685 |
+
this.search_results.bind('mouseup.chosen', function(evt) {
|
686 |
+
_this.search_results_mouseup(evt);
|
687 |
+
});
|
688 |
+
this.search_results.bind('mouseover.chosen', function(evt) {
|
689 |
+
_this.search_results_mouseover(evt);
|
690 |
+
});
|
691 |
+
this.search_results.bind('mouseout.chosen', function(evt) {
|
692 |
+
_this.search_results_mouseout(evt);
|
693 |
+
});
|
694 |
+
this.search_results.bind('mousewheel.chosen DOMMouseScroll.chosen', function(evt) {
|
695 |
+
_this.search_results_mousewheel(evt);
|
696 |
+
});
|
697 |
+
this.search_results.bind('touchstart.chosen', function(evt) {
|
698 |
+
_this.search_results_touchstart(evt);
|
699 |
+
});
|
700 |
+
this.search_results.bind('touchmove.chosen', function(evt) {
|
701 |
+
_this.search_results_touchmove(evt);
|
702 |
+
});
|
703 |
+
this.search_results.bind('touchend.chosen', function(evt) {
|
704 |
+
_this.search_results_touchend(evt);
|
705 |
+
});
|
706 |
+
this.form_field_jq.bind("chosen:updated.chosen", function(evt) {
|
707 |
+
_this.results_update_field(evt);
|
708 |
+
});
|
709 |
+
this.form_field_jq.bind("chosen:activate.chosen", function(evt) {
|
710 |
+
_this.activate_field(evt);
|
711 |
+
});
|
712 |
+
this.form_field_jq.bind("chosen:open.chosen", function(evt) {
|
713 |
+
_this.container_mousedown(evt);
|
714 |
+
});
|
715 |
+
this.form_field_jq.bind("chosen:close.chosen", function(evt) {
|
716 |
+
_this.input_blur(evt);
|
717 |
+
});
|
718 |
+
this.search_field.bind('blur.chosen', function(evt) {
|
719 |
+
_this.input_blur(evt);
|
720 |
+
});
|
721 |
+
this.search_field.bind('keyup.chosen', function(evt) {
|
722 |
+
_this.keyup_checker(evt);
|
723 |
+
});
|
724 |
+
this.search_field.bind('keydown.chosen', function(evt) {
|
725 |
+
_this.keydown_checker(evt);
|
726 |
+
});
|
727 |
+
this.search_field.bind('focus.chosen', function(evt) {
|
728 |
+
_this.input_focus(evt);
|
729 |
+
});
|
730 |
+
this.search_field.bind('cut.chosen', function(evt) {
|
731 |
+
_this.clipboard_event_checker(evt);
|
732 |
+
});
|
733 |
+
this.search_field.bind('paste.chosen', function(evt) {
|
734 |
+
_this.clipboard_event_checker(evt);
|
735 |
+
});
|
736 |
+
if (this.is_multiple) {
|
737 |
+
return this.search_choices.bind('click.chosen', function(evt) {
|
738 |
+
_this.choices_click(evt);
|
739 |
+
});
|
740 |
+
} else {
|
741 |
+
return this.container.bind('click.chosen', function(evt) {
|
742 |
+
evt.preventDefault();
|
743 |
+
});
|
744 |
+
}
|
745 |
+
};
|
746 |
+
|
747 |
+
Chosen.prototype.destroy = function() {
|
748 |
+
$(this.container[0].ownerDocument).unbind("click.chosen", this.click_test_action);
|
749 |
+
if (this.search_field[0].tabIndex) {
|
750 |
+
this.form_field_jq[0].tabIndex = this.search_field[0].tabIndex;
|
751 |
+
}
|
752 |
+
this.container.remove();
|
753 |
+
this.form_field_jq.removeData('chosen');
|
754 |
+
return this.form_field_jq.show();
|
755 |
+
};
|
756 |
+
|
757 |
+
Chosen.prototype.search_field_disabled = function() {
|
758 |
+
this.is_disabled = this.form_field_jq[0].disabled;
|
759 |
+
if (this.is_disabled) {
|
760 |
+
this.container.addClass('chosen-disabled');
|
761 |
+
this.search_field[0].disabled = true;
|
762 |
+
if (!this.is_multiple) {
|
763 |
+
this.selected_item.unbind("focus.chosen", this.activate_action);
|
764 |
+
}
|
765 |
+
return this.close_field();
|
766 |
+
} else {
|
767 |
+
this.container.removeClass('chosen-disabled');
|
768 |
+
this.search_field[0].disabled = false;
|
769 |
+
if (!this.is_multiple) {
|
770 |
+
return this.selected_item.bind("focus.chosen", this.activate_action);
|
771 |
+
}
|
772 |
+
}
|
773 |
+
};
|
774 |
+
|
775 |
+
Chosen.prototype.container_mousedown = function(evt) {
|
776 |
+
if (!this.is_disabled) {
|
777 |
+
if (evt && evt.type === "mousedown" && !this.results_showing) {
|
778 |
+
evt.preventDefault();
|
779 |
+
}
|
780 |
+
if (!((evt != null) && ($(evt.target)).hasClass("search-choice-close"))) {
|
781 |
+
if (!this.active_field) {
|
782 |
+
if (this.is_multiple) {
|
783 |
+
this.search_field.val("");
|
784 |
+
}
|
785 |
+
$(this.container[0].ownerDocument).bind('click.chosen', this.click_test_action);
|
786 |
+
this.results_show();
|
787 |
+
} else if (!this.is_multiple && evt && (($(evt.target)[0] === this.selected_item[0]) || $(evt.target).parents("a.chosen-single").length)) {
|
788 |
+
evt.preventDefault();
|
789 |
+
this.results_toggle();
|
790 |
+
}
|
791 |
+
return this.activate_field();
|
792 |
+
}
|
793 |
+
}
|
794 |
+
};
|
795 |
+
|
796 |
+
Chosen.prototype.container_mouseup = function(evt) {
|
797 |
+
if (evt.target.nodeName === "ABBR" && !this.is_disabled) {
|
798 |
+
return this.results_reset(evt);
|
799 |
+
}
|
800 |
+
};
|
801 |
+
|
802 |
+
Chosen.prototype.search_results_mousewheel = function(evt) {
|
803 |
+
var delta;
|
804 |
+
if (evt.originalEvent) {
|
805 |
+
delta = evt.originalEvent.deltaY || -evt.originalEvent.wheelDelta || evt.originalEvent.detail;
|
806 |
+
}
|
807 |
+
if (delta != null) {
|
808 |
+
evt.preventDefault();
|
809 |
+
if (evt.type === 'DOMMouseScroll') {
|
810 |
+
delta = delta * 40;
|
811 |
+
}
|
812 |
+
return this.search_results.scrollTop(delta + this.search_results.scrollTop());
|
813 |
+
}
|
814 |
+
};
|
815 |
+
|
816 |
+
Chosen.prototype.blur_test = function(evt) {
|
817 |
+
if (!this.active_field && this.container.hasClass("chosen-container-active")) {
|
818 |
+
return this.close_field();
|
819 |
+
}
|
820 |
+
};
|
821 |
+
|
822 |
+
Chosen.prototype.close_field = function() {
|
823 |
+
$(this.container[0].ownerDocument).unbind("click.chosen", this.click_test_action);
|
824 |
+
this.active_field = false;
|
825 |
+
this.results_hide();
|
826 |
+
this.container.removeClass("chosen-container-active");
|
827 |
+
this.clear_backstroke();
|
828 |
+
this.show_search_field_default();
|
829 |
+
return this.search_field_scale();
|
830 |
+
};
|
831 |
+
|
832 |
+
Chosen.prototype.activate_field = function() {
|
833 |
+
this.container.addClass("chosen-container-active");
|
834 |
+
this.active_field = true;
|
835 |
+
this.search_field.val(this.search_field.val());
|
836 |
+
return this.search_field.focus();
|
837 |
+
};
|
838 |
+
|
839 |
+
Chosen.prototype.test_active_click = function(evt) {
|
840 |
+
var active_container;
|
841 |
+
active_container = $(evt.target).closest('.chosen-container');
|
842 |
+
if (active_container.length && this.container[0] === active_container[0]) {
|
843 |
+
return this.active_field = true;
|
844 |
+
} else {
|
845 |
+
return this.close_field();
|
846 |
+
}
|
847 |
+
};
|
848 |
+
|
849 |
+
Chosen.prototype.results_build = function() {
|
850 |
+
this.parsing = true;
|
851 |
+
this.selected_option_count = null;
|
852 |
+
this.results_data = SelectParser.select_to_array(this.form_field);
|
853 |
+
if (this.is_multiple) {
|
854 |
+
this.search_choices.find("li.search-choice").remove();
|
855 |
+
} else if (!this.is_multiple) {
|
856 |
+
this.single_set_selected_text();
|
857 |
+
if (this.disable_search || this.form_field.options.length <= this.disable_search_threshold) {
|
858 |
+
this.search_field[0].readOnly = true;
|
859 |
+
this.container.addClass("chosen-container-single-nosearch");
|
860 |
+
} else {
|
861 |
+
this.search_field[0].readOnly = false;
|
862 |
+
this.container.removeClass("chosen-container-single-nosearch");
|
863 |
+
}
|
864 |
+
}
|
865 |
+
this.update_results_content(this.results_option_build({
|
866 |
+
first: true
|
867 |
+
}));
|
868 |
+
this.search_field_disabled();
|
869 |
+
this.show_search_field_default();
|
870 |
+
this.search_field_scale();
|
871 |
+
return this.parsing = false;
|
872 |
+
};
|
873 |
+
|
874 |
+
Chosen.prototype.result_do_highlight = function(el) {
|
875 |
+
var high_bottom, high_top, maxHeight, visible_bottom, visible_top;
|
876 |
+
if (el.length) {
|
877 |
+
this.result_clear_highlight();
|
878 |
+
this.result_highlight = el;
|
879 |
+
this.result_highlight.addClass("highlighted");
|
880 |
+
maxHeight = parseInt(this.search_results.css("maxHeight"), 10);
|
881 |
+
visible_top = this.search_results.scrollTop();
|
882 |
+
visible_bottom = maxHeight + visible_top;
|
883 |
+
high_top = this.result_highlight.position().top + this.search_results.scrollTop();
|
884 |
+
high_bottom = high_top + this.result_highlight.outerHeight();
|
885 |
+
if (high_bottom >= visible_bottom) {
|
886 |
+
return this.search_results.scrollTop((high_bottom - maxHeight) > 0 ? high_bottom - maxHeight : 0);
|
887 |
+
} else if (high_top < visible_top) {
|
888 |
+
return this.search_results.scrollTop(high_top);
|
889 |
+
}
|
890 |
+
}
|
891 |
+
};
|
892 |
+
|
893 |
+
Chosen.prototype.result_clear_highlight = function() {
|
894 |
+
if (this.result_highlight) {
|
895 |
+
this.result_highlight.removeClass("highlighted");
|
896 |
+
}
|
897 |
+
return this.result_highlight = null;
|
898 |
+
};
|
899 |
+
|
900 |
+
Chosen.prototype.results_show = function() {
|
901 |
+
if (this.is_multiple && this.max_selected_options <= this.choices_count()) {
|
902 |
+
this.form_field_jq.trigger("chosen:maxselected", {
|
903 |
+
chosen: this
|
904 |
+
});
|
905 |
+
return false;
|
906 |
+
}
|
907 |
+
this.container.addClass("chosen-with-drop");
|
908 |
+
this.results_showing = true;
|
909 |
+
this.search_field.focus();
|
910 |
+
this.search_field.val(this.search_field.val());
|
911 |
+
this.winnow_results();
|
912 |
+
return this.form_field_jq.trigger("chosen:showing_dropdown", {
|
913 |
+
chosen: this
|
914 |
+
});
|
915 |
+
};
|
916 |
+
|
917 |
+
Chosen.prototype.update_results_content = function(content) {
|
918 |
+
return this.search_results.html(content);
|
919 |
+
};
|
920 |
+
|
921 |
+
Chosen.prototype.results_hide = function() {
|
922 |
+
if (this.results_showing) {
|
923 |
+
this.result_clear_highlight();
|
924 |
+
this.container.removeClass("chosen-with-drop");
|
925 |
+
this.form_field_jq.trigger("chosen:hiding_dropdown", {
|
926 |
+
chosen: this
|
927 |
+
});
|
928 |
+
}
|
929 |
+
return this.results_showing = false;
|
930 |
+
};
|
931 |
+
|
932 |
+
Chosen.prototype.set_tab_index = function(el) {
|
933 |
+
var ti;
|
934 |
+
if (this.form_field.tabIndex) {
|
935 |
+
ti = this.form_field.tabIndex;
|
936 |
+
this.form_field.tabIndex = -1;
|
937 |
+
return this.search_field[0].tabIndex = ti;
|
938 |
+
}
|
939 |
+
};
|
940 |
+
|
941 |
+
Chosen.prototype.set_label_behavior = function() {
|
942 |
+
var _this = this;
|
943 |
+
this.form_field_label = this.form_field_jq.parents("label");
|
944 |
+
if (!this.form_field_label.length && this.form_field.id.length) {
|
945 |
+
this.form_field_label = $("label[for='" + this.form_field.id + "']");
|
946 |
+
}
|
947 |
+
if (this.form_field_label.length > 0) {
|
948 |
+
return this.form_field_label.bind('click.chosen', function(evt) {
|
949 |
+
if (_this.is_multiple) {
|
950 |
+
return _this.container_mousedown(evt);
|
951 |
+
} else {
|
952 |
+
return _this.activate_field();
|
953 |
+
}
|
954 |
+
});
|
955 |
+
}
|
956 |
+
};
|
957 |
+
|
958 |
+
Chosen.prototype.show_search_field_default = function() {
|
959 |
+
if (this.is_multiple && this.choices_count() < 1 && !this.active_field) {
|
960 |
+
this.search_field.val(this.default_text);
|
961 |
+
return this.search_field.addClass("default");
|
962 |
+
} else {
|
963 |
+
this.search_field.val("");
|
964 |
+
return this.search_field.removeClass("default");
|
965 |
+
}
|
966 |
+
};
|
967 |
+
|
968 |
+
Chosen.prototype.search_results_mouseup = function(evt) {
|
969 |
+
var target;
|
970 |
+
target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
|
971 |
+
if (target.length) {
|
972 |
+
this.result_highlight = target;
|
973 |
+
this.result_select(evt);
|
974 |
+
return this.search_field.focus();
|
975 |
+
}
|
976 |
+
};
|
977 |
+
|
978 |
+
Chosen.prototype.search_results_mouseover = function(evt) {
|
979 |
+
var target;
|
980 |
+
target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
|
981 |
+
if (target) {
|
982 |
+
return this.result_do_highlight(target);
|
983 |
+
}
|
984 |
+
};
|
985 |
+
|
986 |
+
Chosen.prototype.search_results_mouseout = function(evt) {
|
987 |
+
if ($(evt.target).hasClass("active-result" || $(evt.target).parents('.active-result').first())) {
|
988 |
+
return this.result_clear_highlight();
|
989 |
+
}
|
990 |
+
};
|
991 |
+
|
992 |
+
Chosen.prototype.choice_build = function(item) {
|
993 |
+
var choice, close_link,
|
994 |
+
_this = this;
|
995 |
+
choice = $('<li />', {
|
996 |
+
"class": "search-choice"
|
997 |
+
}).html("<span>" + (this.choice_label(item)) + "</span>");
|
998 |
+
if (item.disabled) {
|
999 |
+
choice.addClass('search-choice-disabled');
|
1000 |
+
} else {
|
1001 |
+
close_link = $('<a />', {
|
1002 |
+
"class": 'search-choice-close',
|
1003 |
+
'data-option-array-index': item.array_index
|
1004 |
+
});
|
1005 |
+
close_link.bind('click.chosen', function(evt) {
|
1006 |
+
return _this.choice_destroy_link_click(evt);
|
1007 |
+
});
|
1008 |
+
choice.append(close_link);
|
1009 |
+
}
|
1010 |
+
return this.search_container.before(choice);
|
1011 |
+
};
|
1012 |
+
|
1013 |
+
Chosen.prototype.choice_destroy_link_click = function(evt) {
|
1014 |
+
evt.preventDefault();
|
1015 |
+
evt.stopPropagation();
|
1016 |
+
if (!this.is_disabled) {
|
1017 |
+
return this.choice_destroy($(evt.target));
|
1018 |
+
}
|
1019 |
+
};
|
1020 |
+
|
1021 |
+
Chosen.prototype.choice_destroy = function(link) {
|
1022 |
+
if (this.result_deselect(link[0].getAttribute("data-option-array-index"))) {
|
1023 |
+
this.show_search_field_default();
|
1024 |
+
if (this.is_multiple && this.choices_count() > 0 && this.search_field.val().length < 1) {
|
1025 |
+
this.results_hide();
|
1026 |
+
}
|
1027 |
+
link.parents('li').first().remove();
|
1028 |
+
return this.search_field_scale();
|
1029 |
+
}
|
1030 |
+
};
|
1031 |
+
|
1032 |
+
Chosen.prototype.results_reset = function() {
|
1033 |
+
this.reset_single_select_options();
|
1034 |
+
this.form_field.options[0].selected = true;
|
1035 |
+
this.single_set_selected_text();
|
1036 |
+
this.show_search_field_default();
|
1037 |
+
this.results_reset_cleanup();
|
1038 |
+
this.form_field_jq.trigger("change");
|
1039 |
+
if (this.active_field) {
|
1040 |
+
return this.results_hide();
|
1041 |
+
}
|
1042 |
+
};
|
1043 |
+
|
1044 |
+
Chosen.prototype.results_reset_cleanup = function() {
|
1045 |
+
this.current_selectedIndex = this.form_field.selectedIndex;
|
1046 |
+
return this.selected_item.find("abbr").remove();
|
1047 |
+
};
|
1048 |
+
|
1049 |
+
Chosen.prototype.result_select = function(evt) {
|
1050 |
+
var high, item;
|
1051 |
+
if (this.result_highlight) {
|
1052 |
+
high = this.result_highlight;
|
1053 |
+
this.result_clear_highlight();
|
1054 |
+
if (this.is_multiple && this.max_selected_options <= this.choices_count()) {
|
1055 |
+
this.form_field_jq.trigger("chosen:maxselected", {
|
1056 |
+
chosen: this
|
1057 |
+
});
|
1058 |
+
return false;
|
1059 |
+
}
|
1060 |
+
if (this.is_multiple) {
|
1061 |
+
high.removeClass("active-result");
|
1062 |
+
} else {
|
1063 |
+
this.reset_single_select_options();
|
1064 |
+
}
|
1065 |
+
high.addClass("result-selected");
|
1066 |
+
item = this.results_data[high[0].getAttribute("data-option-array-index")];
|
1067 |
+
item.selected = true;
|
1068 |
+
this.form_field.options[item.options_index].selected = true;
|
1069 |
+
this.selected_option_count = null;
|
1070 |
+
if (this.is_multiple) {
|
1071 |
+
this.choice_build(item);
|
1072 |
+
} else {
|
1073 |
+
this.single_set_selected_text(this.choice_label(item));
|
1074 |
+
}
|
1075 |
+
if (!((evt.metaKey || evt.ctrlKey) && this.is_multiple)) {
|
1076 |
+
this.results_hide();
|
1077 |
+
}
|
1078 |
+
this.show_search_field_default();
|
1079 |
+
if (this.is_multiple || this.form_field.selectedIndex !== this.current_selectedIndex) {
|
1080 |
+
this.form_field_jq.trigger("change", {
|
1081 |
+
'selected': this.form_field.options[item.options_index].value
|
1082 |
+
});
|
1083 |
+
}
|
1084 |
+
this.current_selectedIndex = this.form_field.selectedIndex;
|
1085 |
+
evt.preventDefault();
|
1086 |
+
return this.search_field_scale();
|
1087 |
+
}
|
1088 |
+
};
|
1089 |
+
|
1090 |
+
Chosen.prototype.single_set_selected_text = function(text) {
|
1091 |
+
if (text == null) {
|
1092 |
+
text = this.default_text;
|
1093 |
+
}
|
1094 |
+
if (text === this.default_text) {
|
1095 |
+
this.selected_item.addClass("chosen-default");
|
1096 |
+
} else {
|
1097 |
+
this.single_deselect_control_build();
|
1098 |
+
this.selected_item.removeClass("chosen-default");
|
1099 |
+
}
|
1100 |
+
return this.selected_item.find("span").html(text);
|
1101 |
+
};
|
1102 |
+
|
1103 |
+
Chosen.prototype.result_deselect = function(pos) {
|
1104 |
+
var result_data;
|
1105 |
+
result_data = this.results_data[pos];
|
1106 |
+
if (!this.form_field.options[result_data.options_index].disabled) {
|
1107 |
+
result_data.selected = false;
|
1108 |
+
this.form_field.options[result_data.options_index].selected = false;
|
1109 |
+
this.selected_option_count = null;
|
1110 |
+
this.result_clear_highlight();
|
1111 |
+
if (this.results_showing) {
|
1112 |
+
this.winnow_results();
|
1113 |
+
}
|
1114 |
+
this.form_field_jq.trigger("change", {
|
1115 |
+
deselected: this.form_field.options[result_data.options_index].value
|
1116 |
+
});
|
1117 |
+
this.search_field_scale();
|
1118 |
+
return true;
|
1119 |
+
} else {
|
1120 |
+
return false;
|
1121 |
+
}
|
1122 |
+
};
|
1123 |
+
|
1124 |
+
Chosen.prototype.single_deselect_control_build = function() {
|
1125 |
+
if (!this.allow_single_deselect) {
|
1126 |
+
return;
|
1127 |
+
}
|
1128 |
+
if (!this.selected_item.find("abbr").length) {
|
1129 |
+
this.selected_item.find("span").first().after("<abbr class=\"search-choice-close\"></abbr>");
|
1130 |
+
}
|
1131 |
+
return this.selected_item.addClass("chosen-single-with-deselect");
|
1132 |
+
};
|
1133 |
+
|
1134 |
+
Chosen.prototype.get_search_text = function() {
|
1135 |
+
return $('<div/>').text($.trim(this.search_field.val())).html();
|
1136 |
+
};
|
1137 |
+
|
1138 |
+
Chosen.prototype.winnow_results_set_highlight = function() {
|
1139 |
+
var do_high, selected_results;
|
1140 |
+
selected_results = !this.is_multiple ? this.search_results.find(".result-selected.active-result") : [];
|
1141 |
+
do_high = selected_results.length ? selected_results.first() : this.search_results.find(".active-result").first();
|
1142 |
+
if (do_high != null) {
|
1143 |
+
return this.result_do_highlight(do_high);
|
1144 |
+
}
|
1145 |
+
};
|
1146 |
+
|
1147 |
+
Chosen.prototype.no_results = function(terms) {
|
1148 |
+
var no_results_html;
|
1149 |
+
no_results_html = $('<li class="no-results">' + this.results_none_found + ' "<span></span>"</li>');
|
1150 |
+
no_results_html.find("span").first().html(terms);
|
1151 |
+
this.search_results.append(no_results_html);
|
1152 |
+
return this.form_field_jq.trigger("chosen:no_results", {
|
1153 |
+
chosen: this
|
1154 |
+
});
|
1155 |
+
};
|
1156 |
+
|
1157 |
+
Chosen.prototype.no_results_clear = function() {
|
1158 |
+
return this.search_results.find(".no-results").remove();
|
1159 |
+
};
|
1160 |
+
|
1161 |
+
Chosen.prototype.keydown_arrow = function() {
|
1162 |
+
var next_sib;
|
1163 |
+
if (this.results_showing && this.result_highlight) {
|
1164 |
+
next_sib = this.result_highlight.nextAll("li.active-result").first();
|
1165 |
+
if (next_sib) {
|
1166 |
+
return this.result_do_highlight(next_sib);
|
1167 |
+
}
|
1168 |
+
} else {
|
1169 |
+
return this.results_show();
|
1170 |
+
}
|
1171 |
+
};
|
1172 |
+
|
1173 |
+
Chosen.prototype.keyup_arrow = function() {
|
1174 |
+
var prev_sibs;
|
1175 |
+
if (!this.results_showing && !this.is_multiple) {
|
1176 |
+
return this.results_show();
|
1177 |
+
} else if (this.result_highlight) {
|
1178 |
+
prev_sibs = this.result_highlight.prevAll("li.active-result");
|
1179 |
+
if (prev_sibs.length) {
|
1180 |
+
return this.result_do_highlight(prev_sibs.first());
|
1181 |
+
} else {
|
1182 |
+
if (this.choices_count() > 0) {
|
1183 |
+
this.results_hide();
|
1184 |
+
}
|
1185 |
+
return this.result_clear_highlight();
|
1186 |
+
}
|
1187 |
+
}
|
1188 |
+
};
|
1189 |
+
|
1190 |
+
Chosen.prototype.keydown_backstroke = function() {
|
1191 |
+
var next_available_destroy;
|
1192 |
+
if (this.pending_backstroke) {
|
1193 |
+
this.choice_destroy(this.pending_backstroke.find("a").first());
|
1194 |
+
return this.clear_backstroke();
|
1195 |
+
} else {
|
1196 |
+
next_available_destroy = this.search_container.siblings("li.search-choice").last();
|
1197 |
+
if (next_available_destroy.length && !next_available_destroy.hasClass("search-choice-disabled")) {
|
1198 |
+
this.pending_backstroke = next_available_destroy;
|
1199 |
+
if (this.single_backstroke_delete) {
|
1200 |
+
return this.keydown_backstroke();
|
1201 |
+
} else {
|
1202 |
+
return this.pending_backstroke.addClass("search-choice-focus");
|
1203 |
+
}
|
1204 |
+
}
|
1205 |
+
}
|
1206 |
+
};
|
1207 |
+
|
1208 |
+
Chosen.prototype.clear_backstroke = function() {
|
1209 |
+
if (this.pending_backstroke) {
|
1210 |
+
this.pending_backstroke.removeClass("search-choice-focus");
|
1211 |
+
}
|
1212 |
+
return this.pending_backstroke = null;
|
1213 |
+
};
|
1214 |
+
|
1215 |
+
Chosen.prototype.keydown_checker = function(evt) {
|
1216 |
+
var stroke, _ref1;
|
1217 |
+
stroke = (_ref1 = evt.which) != null ? _ref1 : evt.keyCode;
|
1218 |
+
this.search_field_scale();
|
1219 |
+
if (stroke !== 8 && this.pending_backstroke) {
|
1220 |
+
this.clear_backstroke();
|
1221 |
+
}
|
1222 |
+
switch (stroke) {
|
1223 |
+
case 8:
|
1224 |
+
this.backstroke_length = this.search_field.val().length;
|
1225 |
+
break;
|
1226 |
+
case 9:
|
1227 |
+
if (this.results_showing && !this.is_multiple) {
|
1228 |
+
this.result_select(evt);
|
1229 |
+
}
|
1230 |
+
this.mouse_on_container = false;
|
1231 |
+
break;
|
1232 |
+
case 13:
|
1233 |
+
if (this.results_showing) {
|
1234 |
+
evt.preventDefault();
|
1235 |
+
}
|
1236 |
+
break;
|
1237 |
+
case 32:
|
1238 |
+
if (this.disable_search) {
|
1239 |
+
evt.preventDefault();
|
1240 |
+
}
|
1241 |
+
break;
|
1242 |
+
case 38:
|
1243 |
+
evt.preventDefault();
|
1244 |
+
this.keyup_arrow();
|
1245 |
+
break;
|
1246 |
+
case 40:
|
1247 |
+
evt.preventDefault();
|
1248 |
+
this.keydown_arrow();
|
1249 |
+
break;
|
1250 |
+
}
|
1251 |
+
};
|
1252 |
+
|
1253 |
+
Chosen.prototype.search_field_scale = function() {
|
1254 |
+
var div, f_width, h, style, style_block, styles, w, _i, _len;
|
1255 |
+
if (this.is_multiple) {
|
1256 |
+
h = 0;
|
1257 |
+
w = 0;
|
1258 |
+
style_block = "position:absolute; left: -1000px; top: -1000px; display:none;";
|
1259 |
+
styles = ['font-size', 'font-style', 'font-weight', 'font-family', 'line-height', 'text-transform', 'letter-spacing'];
|
1260 |
+
for (_i = 0, _len = styles.length; _i < _len; _i++) {
|
1261 |
+
style = styles[_i];
|
1262 |
+
style_block += style + ":" + this.search_field.css(style) + ";";
|
1263 |
+
}
|
1264 |
+
div = $('<div />', {
|
1265 |
+
'style': style_block
|
1266 |
+
});
|
1267 |
+
div.text(this.search_field.val());
|
1268 |
+
$('body').append(div);
|
1269 |
+
w = div.width() + 25;
|
1270 |
+
div.remove();
|
1271 |
+
f_width = this.container.outerWidth();
|
1272 |
+
if (w > f_width - 10) {
|
1273 |
+
w = f_width - 10;
|
1274 |
+
}
|
1275 |
+
return this.search_field.css({
|
1276 |
+
'width': w + 'px'
|
1277 |
+
});
|
1278 |
+
}
|
1279 |
+
};
|
1280 |
+
|
1281 |
+
return Chosen;
|
1282 |
+
|
1283 |
+
})(AbstractChosen);
|
1284 |
+
|
1285 |
}).call(this);
|
inc/js/gawd_admin.js
CHANGED
@@ -1,3739 +1,3739 @@
|
|
1 |
-
var _data;
|
2 |
-
var data_of_compared;
|
3 |
-
var _data_compare = [];
|
4 |
-
var d_start_date = "";
|
5 |
-
var d_second_start_date = "";
|
6 |
-
var d_second_end_date = "";
|
7 |
-
var d_end_date = "";
|
8 |
-
var d_metric_export = "";
|
9 |
-
var d_metric_compare_export = "";
|
10 |
-
var d_dimension_export = "";
|
11 |
-
var d_tab_name = "";
|
12 |
-
var d_filter_type = "";
|
13 |
-
var d_geo_type = "";
|
14 |
-
var d_country_filter = "";
|
15 |
-
var d_custom = "";
|
16 |
-
var weekdays = new Array(7);
|
17 |
-
weekdays[0] = "Sunday";
|
18 |
-
weekdays[1] = "Monday";
|
19 |
-
weekdays[2] = "Tuesday";
|
20 |
-
weekdays[3] = "Wednesday";
|
21 |
-
weekdays[4] = "Thursday";
|
22 |
-
weekdays[5] = "Friday";
|
23 |
-
weekdays[6] = "Saturday";
|
24 |
-
var monthnames = new Array();
|
25 |
-
monthnames[01] = 'January';
|
26 |
-
monthnames[02] = 'February';
|
27 |
-
monthnames[03] = 'March';
|
28 |
-
monthnames[04] = 'April';
|
29 |
-
monthnames[05] = 'May';
|
30 |
-
monthnames[06] = 'June';
|
31 |
-
monthnames[07] = 'July';
|
32 |
-
monthnames[08] = 'August';
|
33 |
-
monthnames[09] = 'September';
|
34 |
-
monthnames[10] = 'October';
|
35 |
-
monthnames[11] = 'November';
|
36 |
-
monthnames[12] = 'December';
|
37 |
-
var gawd_chart_data = [];
|
38 |
-
var gawd_compare_request_last_args;
|
39 |
-
var gawd_request_last_args;
|
40 |
-
|
41 |
-
function gawd_compare() {
|
42 |
-
console.log("ajax111");
|
43 |
-
jQuery("#gawd_metric_compare").show();
|
44 |
-
jQuery("#filter_conteiner").show();
|
45 |
-
var _end_date = (Date.today().add(-1).days()).toString("yyyy-MM-dd");
|
46 |
-
var start_date_7 = (Date.today().add(-1).days()).add(-7).days().toString("yyyy-MM-dd");
|
47 |
-
var start_end_date_compare = jQuery('#gawd_start_end_date_compare').val().split('/-/');
|
48 |
-
var start_date_compare = start_end_date_compare[0] ? start_end_date_compare[0] : start_date_7;
|
49 |
-
var end_date_compare = start_end_date_compare[1] ? start_end_date_compare[1] : _end_date;
|
50 |
-
if (!start_date_compare && !end_date_compare) {
|
51 |
-
return;
|
52 |
-
}
|
53 |
-
|
54 |
-
var filter_type = jQuery("#gawd_filter_val").val();
|
55 |
-
metrics = [];
|
56 |
-
var metric = jQuery("#gawd_metric").val();
|
57 |
-
var metric_compare = jQuery("#gawd_metric_compare").val();
|
58 |
-
metrics.push("ga:" + metric);
|
59 |
-
if (metric_compare != 0) {
|
60 |
-
metrics.push("ga:" + metric_compare);
|
61 |
-
}
|
62 |
-
|
63 |
-
if (jQuery("#gawd_chart_type").val() == 'line') {
|
64 |
-
var chartType = 'line';
|
65 |
-
var fillAlphas = 0;
|
66 |
-
} else if (jQuery("#gawd_chart_type").val() == 'column') {
|
67 |
-
var chartType = 'column';
|
68 |
-
var fillAlphas = 1;
|
69 |
-
}
|
70 |
-
var dimension = jQuery("#gawd_tab").val();
|
71 |
-
|
72 |
-
if (dimension == 'date') {
|
73 |
-
var parseDates = true;
|
74 |
-
var rotateAngle = 0;
|
75 |
-
} else if (dimension == 'realTime') {
|
76 |
-
jQuery(".filter_conteiner").hide();
|
77 |
-
jQuery("#chartdiv").empty();
|
78 |
-
gawd_widget_real_time();
|
79 |
-
return;
|
80 |
-
} else if (dimension == 'custom') {
|
81 |
-
var custom = jQuery("#gawd_custom_option").val();
|
82 |
-
dimension = custom.substring(3);
|
83 |
-
} else {
|
84 |
-
var parseDates = false;
|
85 |
-
var rotateAngle = 90;
|
86 |
-
}
|
87 |
-
if (filter_type == "week" || filter_type == "month" || filter_type == "hour") {
|
88 |
-
var parseDates = false;
|
89 |
-
}
|
90 |
-
|
91 |
-
var args = gawd_custom_ajax_args();
|
92 |
-
args.type = 'POST';
|
93 |
-
args.async = true;
|
94 |
-
args.data.gawd_action = "gawd_show_data";
|
95 |
-
args.data.gawd_data = {
|
96 |
-
"start_date": start_date_compare,
|
97 |
-
"end_date": end_date_compare,
|
98 |
-
"metric": metrics,
|
99 |
-
"dimension": dimension,
|
100 |
-
"security": gawd_admin.ajaxnonce,
|
101 |
-
"filter_type": filter_type
|
102 |
-
};
|
103 |
-
|
104 |
-
args.beforeSend = function () {
|
105 |
-
jQuery('#opacity_div').show();
|
106 |
-
jQuery('#loading_div').show();
|
107 |
-
};
|
108 |
-
|
109 |
-
jQuery.ajax(args).done(function (data) {
|
110 |
-
gawd_compare_request_last_args = args;
|
111 |
-
jQuery('#compare_datepicker_wraper').css('background-color','#4F9A55');
|
112 |
-
jQuery('#opacity_div').hide();
|
113 |
-
jQuery('#loading_div').hide();
|
114 |
-
var data = JSON.parse(data.data.gawd_reports_data);
|
115 |
-
data_of_compared = data;
|
116 |
-
var data_compare = [];
|
117 |
-
var __data = JSON.parse(JSON.stringify(_data));
|
118 |
-
for (var i = 0; i < __data.chart_data.length; i++) {
|
119 |
-
var row = __data.chart_data[i];
|
120 |
-
|
121 |
-
// var __metrics = Object.keys(row);
|
122 |
-
var __metrics = [];
|
123 |
-
for(key in row){
|
124 |
-
__metrics.push(key);
|
125 |
-
}
|
126 |
-
|
127 |
-
if (typeof data.chart_data[i] != 'undefined') {
|
128 |
-
for (var j = 0; j < __metrics.length; j++) {
|
129 |
-
if (__metrics[j] == "color" || __metrics[j] == "No")
|
130 |
-
continue;
|
131 |
-
if(__metrics[j].indexOf('compare') == -1){
|
132 |
-
row[__metrics[j] + ' compare'] = data.chart_data[i][__metrics[j]];
|
133 |
-
}
|
134 |
-
}
|
135 |
-
}
|
136 |
-
data_compare.push(row);
|
137 |
-
}
|
138 |
-
var data_sum = data.data_sum;
|
139 |
-
var _data_sum = _data.data_sum;
|
140 |
-
var dataSums = {};
|
141 |
-
var d_second_start_date = start_date_compare;
|
142 |
-
var d_second_end_date = end_date_compare;
|
143 |
-
jQuery('#second_end_date').val(end_date_compare);
|
144 |
-
jQuery('#second_start_date').val(start_date_compare);
|
145 |
-
jQuery('#second_data_sum').val(JSON.stringify(data_sum));
|
146 |
-
jQuery('#first_data_sum').val(JSON.stringify(_data_sum));
|
147 |
-
if(dimension == 'pagePath' || dimension == 'landingPagePath'){
|
148 |
-
jQuery('#dimension').val(dimension);
|
149 |
-
jQuery('#second_data').val(JSON.stringify(data.chart_data));
|
150 |
-
jQuery('#first_data').val(JSON.stringify(_data.chart_data));
|
151 |
-
gawd_draw_table_pages_compare(JSON.stringify(_data.chart_data),JSON.stringify(data.chart_data), dimension, data_sum, _data_sum,start_date_compare,end_date_compare);
|
152 |
-
return;
|
153 |
-
}
|
154 |
-
if (dimension != "pagePath" && dimension != "landingPagePath") {
|
155 |
-
|
156 |
-
for (metric in data_sum) {
|
157 |
-
var dataSum = {};
|
158 |
-
dataSum[metric] = _data_sum[metric];
|
159 |
-
dataSum[metric + " compare"] = data_sum[metric];
|
160 |
-
dataSums[metric] = dataSum;
|
161 |
-
}
|
162 |
-
metric = jQuery("#gawd_metric").val();
|
163 |
-
var metric_compare_export = metric + ' compare';
|
164 |
-
metric = metric.replace(/([A-Z])/g, " $1").trim();
|
165 |
-
metric = metric.charAt(0).toUpperCase() + metric.slice(1);
|
166 |
-
metric = metric.replace(/ +/g, ' ');
|
167 |
-
var metric_export = metric;
|
168 |
-
var metric_compare = metric + ' compare';
|
169 |
-
/* metric_compare = metric_compare.replace(/([A-Z])/g, " $1").trim();
|
170 |
-
metric_compare = metric_compare.charAt(0).toUpperCase() + metric_compare.slice(1);
|
171 |
-
metric_compare = metric_compare.replace(/ +/g, ' '); */
|
172 |
-
var percent = (dataSums[metric][metric] - dataSums[metric][metric + " compare"])/dataSums[metric][metric + " compare"]*100;
|
173 |
-
percent = isNaN(percent) ? 0 : isFinite(percent) ? percent : 0;
|
174 |
-
percent = percent.toFixed(2)
|
175 |
-
var metric_value = parseInt(dataSums[metric][metric]).toLocaleString();
|
176 |
-
var metric_compare_value = parseInt(dataSums[metric][metric + " compare"]).toLocaleString();
|
177 |
-
if(metric + " compare" == 'Avg Session Duration compare' || metric + " compare" == 'Avg Page Load Time compare' || metric + " compare" == 'Avg Server Response Time compare' || metric + " compare" == 'Avg Redirection Time compare' || metric + " compare" == 'Avg Page Download Time compare'){
|
178 |
-
metric_compare_value = sec_to_normal(metric_compare_value);
|
179 |
-
}
|
180 |
-
else if(metric + " compare" == 'Percent New Sessions compare' || metric + " compare" == 'Bounce Rate compare'){
|
181 |
-
metric_compare_value = metric_compare_value + '%';
|
182 |
-
}
|
183 |
-
if(metric == 'Avg Session Duration' || metric == 'Avg Page Load Time' || metric == 'Avg Server Response Time' || metric == 'Avg Redirection Time' || metric == 'Avg Page Download Time'){
|
184 |
-
metric_value = sec_to_normal(metric_value);
|
185 |
-
}
|
186 |
-
else if(metric == 'Percent New Sessions' || metric == 'Bounce Rate'){
|
187 |
-
metric_value = metric_value + '%';
|
188 |
-
}
|
189 |
-
//percent = percent.substring(0, percent.indexOf(".") + 2);
|
190 |
-
var percent_color = percent < 0 || metric == 'bounceRate' ? "gawd_red" : "gawd_green";
|
191 |
-
jQuery(".sum_box").remove();
|
192 |
-
jQuery("._sum_box").remove();
|
193 |
-
var sumBox = "<div class='sum_box'>";
|
194 |
-
var metric_title = metric == 'Percent New Sessions' ? '% New Sessions' : metric;
|
195 |
-
sumBox += "<div class='box_left'>";
|
196 |
-
sumBox += "<div class='box_title'>" + metric_title + "</div>";
|
197 |
-
sumBox += "<div class='" + percent_color + "'>" + percent + " % </div>";
|
198 |
-
sumBox += "</div>";
|
199 |
-
sumBox += "<div class='vs_image_small'>";
|
200 |
-
sumBox += "<img src='" + gawd_admin.gawd_plugin_url + "/assets/vs_rev.png'>";
|
201 |
-
sumBox += "</div>";
|
202 |
-
sumBox += "<div class='box_right'>";
|
203 |
-
sumBox += "<div class='box_value'>" + metric_value + "</div>" + "<div class='box_value'>" + metric_compare_value + "</div>";
|
204 |
-
sumBox += "</div>";
|
205 |
-
sumBox += "<div class='clear'></div>";
|
206 |
-
sumBox += "</div>";
|
207 |
-
jQuery('#chartdiv').after(sumBox);
|
208 |
-
if (dimension == 'goals') {
|
209 |
-
dimension = 'date';
|
210 |
-
}
|
211 |
-
jQuery("#chartdiv").show();
|
212 |
-
dimension = dimension == 'date' || dimension == 'siteSpeed' || dimension == 'adsense' || dimension == 'sales_performance' ? filter_type == '' ? 'date' : filter_type : dimension;
|
213 |
-
//dimension = dimension == 'siteSpeed' || dimension == 'adsense' ? 'date' : dimension;
|
214 |
-
var dimension_export = dimension;
|
215 |
-
dimension = dimension.replace(/([A-Z])/g, " $1").trim();
|
216 |
-
dimension = dimension.charAt(0).toUpperCase() + dimension.slice(1);
|
217 |
-
_data_compare = data_compare;
|
218 |
-
var duration = "";
|
219 |
-
var durationUnits = "";
|
220 |
-
if(metric == 'Avg Session Duration'){
|
221 |
-
duration = "ss";
|
222 |
-
durationUnits = {
|
223 |
-
"mm": "m ",
|
224 |
-
"ss": "s"
|
225 |
-
};
|
226 |
-
}
|
227 |
-
|
228 |
-
if (chartType === "line" || chartType === "column") {
|
229 |
-
var chart = new gawd_charts_helper();
|
230 |
-
chart.print_reports_line_chart_compare(
|
231 |
-
gawd_chart_data,
|
232 |
-
data.chart_data,
|
233 |
-
dimension,
|
234 |
-
metric,
|
235 |
-
chartType,
|
236 |
-
'chartdiv'
|
237 |
-
);
|
238 |
-
}
|
239 |
-
|
240 |
-
|
241 |
-
//CANVAS//
|
242 |
-
|
243 |
-
|
244 |
-
var svg = document.getElementsByTagName('svg')[0];
|
245 |
-
var canvas = document.getElementById("canvass");
|
246 |
-
draw_canvas(svg, canvas);
|
247 |
-
url = canvas.toDataURL();
|
248 |
-
//CANVAS URL//
|
249 |
-
var tab_name = window.location.href.split('tab=');
|
250 |
-
|
251 |
-
d_start_date = start_date_compare;
|
252 |
-
d_end_date = end_date_compare;
|
253 |
-
d_metric_export = metric_export;
|
254 |
-
d_metric_compare_export = metric_compare_export;
|
255 |
-
d_dimension_export = dimension_export;
|
256 |
-
d_tab_name = tab_name;
|
257 |
-
d_filter_type = filter_type;
|
258 |
-
|
259 |
-
jQuery("#chartdiv").find('a').hide();
|
260 |
-
jQuery("#gbox_griddiv").remove();
|
261 |
-
var grid = '<table id="griddiv"></table><div id="pager"></div>';
|
262 |
-
jQuery('.gawd_chart_conteiner').append(grid);
|
263 |
-
gawd_draw_table(JSON.stringify(data_compare), metric, metric + ' compare', dimension, dataSums);
|
264 |
-
}
|
265 |
-
})
|
266 |
-
}
|
267 |
-
function gawd_draw_analytics_compact(metric, metric_compare, dimension, chart_type, chart_id) {
|
268 |
-
var _end_date = (Date.today().add(-1).days()).toString("yyyy-MM-dd");
|
269 |
-
var start_date_7 = (Date.today().add(-1).days()).add(-7).days().toString("yyyy-MM-dd");
|
270 |
-
var start_end_date = typeof jQuery('#gawd_start_end_date_compact').val() != 'undefined' ? jQuery('#gawd_start_end_date_compact').val() : start_date_7 + '/-/' + _end_date;
|
271 |
-
|
272 |
-
var start_end_date = start_end_date.split('/-/');
|
273 |
-
var start_date = start_end_date[0];
|
274 |
-
var end_date = start_end_date[1];
|
275 |
-
metrics = [];
|
276 |
-
metrics.push("ga:" + metric);
|
277 |
-
if (metric_compare != 0) {
|
278 |
-
metrics.push("ga:" + metric_compare);
|
279 |
-
}
|
280 |
-
|
281 |
-
if (dimension == 'date') {
|
282 |
-
var parseDates = true;
|
283 |
-
var rotateAngle = 90;
|
284 |
-
} else {
|
285 |
-
var parseDates = false;
|
286 |
-
var rotateAngle = 90;
|
287 |
-
}
|
288 |
-
if (chart_type == 'column') {
|
289 |
-
var fillAlphas = 1;
|
290 |
-
}
|
291 |
-
var timezone = -(new Date().getTimezoneOffset() / 60);
|
292 |
-
console.log("ajax03");
|
293 |
-
var args = gawd_custom_ajax_args();
|
294 |
-
args.type = 'POST';
|
295 |
-
args.async = true;
|
296 |
-
args.data.gawd_action = "gawd_show_data_compact";
|
297 |
-
args.data.gawd_data = {
|
298 |
-
"start_date": start_date,
|
299 |
-
"end_date": end_date,
|
300 |
-
"metric": metrics,
|
301 |
-
"dimension": dimension,
|
302 |
-
"security": gawd_admin.ajaxnonce,
|
303 |
-
"timezone": timezone,
|
304 |
-
};
|
305 |
-
args.beforeSend = function() {
|
306 |
-
jQuery('#' + chart_id).closest(".postbox").find('.opacity_div_compact').show();
|
307 |
-
jQuery('#' + chart_id).closest(".postbox").find('.loading_div_compact').show();
|
308 |
-
};
|
309 |
-
args.success = function (result){
|
310 |
-
|
311 |
-
jQuery('.opacity_div_compact').hide();
|
312 |
-
jQuery('.loading_div_compact').hide();
|
313 |
-
|
314 |
-
if(result.success === false){
|
315 |
-
if(chart_id === "gawd_country_meta" ) {
|
316 |
-
gawd_add_notice(result, '#gawd_overview_location');
|
317 |
-
}else{
|
318 |
-
gawd_add_notice(result, chart_id);
|
319 |
-
}
|
320 |
-
return;
|
321 |
-
}
|
322 |
-
dimension = dimension.replace(/([A-Z])/g, " $1").trim();
|
323 |
-
dimension = dimension.charAt(0).toUpperCase() + dimension.slice(1);
|
324 |
-
metric = metric.replace(/([A-Z])/g, " $1").trim();
|
325 |
-
metric = metric.charAt(0).toUpperCase() + metric.slice(1);
|
326 |
-
metric = metric.replace(/ +/g, ' ');
|
327 |
-
metric_compare = metric_compare.replace(/([A-Z])/g, " $1").trim();
|
328 |
-
metric_compare = metric_compare.charAt(0).toUpperCase() + metric_compare.slice(1);
|
329 |
-
metric_compare = metric_compare.replace(/ +/g, ' ');
|
330 |
-
if(dimension == 'Date'){
|
331 |
-
var data = JSON.parse(result.data.gawd_show_data_compact);
|
332 |
-
var c = '';
|
333 |
-
var duration = "";
|
334 |
-
var durationUnits = "";
|
335 |
-
if(metric == 'Avg Session Duration'){
|
336 |
-
duration = "ss";
|
337 |
-
durationUnits = {
|
338 |
-
"mm": "m ",
|
339 |
-
"ss": "s"
|
340 |
-
};
|
341 |
-
}
|
342 |
-
if (metric_compare != '' && metric_compare != 0) {
|
343 |
-
var _duration = '';
|
344 |
-
var _durationUnits = '';
|
345 |
-
metric_compare = metric_compare.replace(/([A-Z])/g, "$1").trim();
|
346 |
-
metric_compare = metric_compare.charAt(0).toUpperCase() + metric_compare.slice(1);
|
347 |
-
metric_compare = metric_compare.replace(/ +/g, ' ');
|
348 |
-
metric_compare_title = /* ' vs ' + */ metric_compare.charAt(0).toUpperCase() + metric_compare.slice(1) == "Percent New Sessions" ? '% New Sessions' : metric_compare.charAt(0).toUpperCase() + metric_compare.slice(1);
|
349 |
-
if(metric_compare == 'Avg Session Duration'){
|
350 |
-
_duration = "ss";
|
351 |
-
_durationUnits = {
|
352 |
-
"mm": "m ",
|
353 |
-
"ss": "s"
|
354 |
-
};
|
355 |
-
}
|
356 |
-
c = {
|
357 |
-
"id": "g2",
|
358 |
-
"axisAlpha": 0.4,
|
359 |
-
"position": "right",
|
360 |
-
"title": metric_compare_title,
|
361 |
-
"ignoreAxisWidth": false,
|
362 |
-
"duration": _duration,
|
363 |
-
"durationUnits": _durationUnits,
|
364 |
-
'minimum': 0
|
365 |
-
};
|
366 |
-
|
367 |
-
}
|
368 |
-
|
369 |
-
jQuery("#_sum_comp_" + chart_id).remove();
|
370 |
-
jQuery('#_sum_comp_' + chart_id).remove();
|
371 |
-
|
372 |
-
if(typeof data.data_sum != 'undefined'){
|
373 |
-
var float = '';
|
374 |
-
if (metric_compare != '' && metric_compare != 0){
|
375 |
-
float="style='float:left'";
|
376 |
-
var total = data.data_sum[metric_compare];
|
377 |
-
var avg = '';
|
378 |
-
var diff = ((Date.parse(end_date).getTime() - Date.parse(start_date).getTime()) / 3600 / 24 / 1000)+1;
|
379 |
-
var show_hide = 'gawd_show_total';
|
380 |
-
if(metric == 'Bounce Rate' || metric == 'Percent New Sessions' || metric == 'Pageviews Per Session'){
|
381 |
-
avg = parseFloat(total).toFixed(2);
|
382 |
-
if(metric != 'Pageviews Per Session'){
|
383 |
-
avg = avg + '%';
|
384 |
-
}
|
385 |
-
show_hide = 'gawd_hide_total';
|
386 |
-
}
|
387 |
-
else if(metric_compare == 'Avg Session Duration'){
|
388 |
-
avg = sec_to_normal(avg);
|
389 |
-
show_hide = 'gawd_hide_total';
|
390 |
-
}
|
391 |
-
else{
|
392 |
-
//avg = Math.ceil(total/diff);
|
393 |
-
avg = parseFloat(total/diff).toFixed(2);
|
394 |
-
}
|
395 |
-
var percent_color = total == 0 || metric_compare == 'Bounce Rate' ? "gawd_red" : "gawd_green";
|
396 |
-
var sumBox = "<div class='_sum_box' id='_sum_comp_" + chart_id + "'>";
|
397 |
-
metric_compare_title = metric_compare == 'Percent New Sessions' ? '% New Sessions' : metric_compare;
|
398 |
-
sumBox += "<div class='box_metric'>" + metric_compare_title + "</div>"
|
399 |
-
sumBox += "<div class='_box_left " + show_hide + "'>";
|
400 |
-
sumBox += "<div class='box_title'>Total</div>";
|
401 |
-
sumBox += "<div class='" + percent_color + "'>" + parseInt(total).toLocaleString() + "</div>";
|
402 |
-
sumBox += "</div>";
|
403 |
-
|
404 |
-
sumBox += "<div class='_box_right'>";
|
405 |
-
sumBox += "<div class='box_title'>Average</div>";
|
406 |
-
sumBox += "<div class='" + percent_color + "'>" + parseInt(avg).toLocaleString() + "</div>";
|
407 |
-
sumBox += "</div>";
|
408 |
-
sumBox += "<div class='clear'></div>";
|
409 |
-
sumBox += "</div>";
|
410 |
-
sumBox += "<div class='clear'></div>";
|
411 |
-
jQuery('#'+chart_id).after(sumBox);
|
412 |
-
}
|
413 |
-
var total = data.data_sum[metric];
|
414 |
-
|
415 |
-
var avg = '';
|
416 |
-
var diff = ((Date.parse(end_date).getTime() - Date.parse(start_date).getTime()) / 3600 / 24 / 1000)+1;
|
417 |
-
var show_hide = 'gawd_show_total';
|
418 |
-
if(metric == 'Bounce Rate' || metric == 'Percent New Sessions' || metric == 'Pageviews Per Session'){
|
419 |
-
avg = parseFloat(total).toFixed(2);
|
420 |
-
if(metric != 'Pageviews Per Session'){
|
421 |
-
avg = avg + '%';
|
422 |
-
}
|
423 |
-
show_hide = 'gawd_hide_total';
|
424 |
-
}
|
425 |
-
else if(metric == 'Avg Session Duration'){
|
426 |
-
avg = sec_to_normal(avg);
|
427 |
-
show_hide = 'gawd_hide_total';
|
428 |
-
}
|
429 |
-
else{
|
430 |
-
//avg = Math.ceil(total/diff);
|
431 |
-
avg = parseFloat(total/diff).toFixed(2);
|
432 |
-
}
|
433 |
-
var percent_color = total == 0 || metric == 'Bounce Rate' ? "gawd_red" : "gawd_green";
|
434 |
-
jQuery('#_sum_' + chart_id).remove();
|
435 |
-
var sumBox = "<div " + float + " class='_sum_box' id='_sum_" + chart_id + "'>";
|
436 |
-
var metric_title = metric == 'Percent New Sessions' ? '% New Sessions' : metric;
|
437 |
-
sumBox += "<div class='box_metric'>" + metric_title + "</div>"
|
438 |
-
sumBox += "<div class='_box_left " + show_hide + "'>";
|
439 |
-
sumBox += "<div class='box_title'>Total</div>";
|
440 |
-
sumBox += "<div class='" + percent_color + "'>" + parseInt(total).toLocaleString() + "</div>";
|
441 |
-
sumBox += "</div>";
|
442 |
-
|
443 |
-
sumBox += "<div class='_box_right'>";
|
444 |
-
sumBox += "<div class='box_title'>Average</div>";
|
445 |
-
sumBox += "<div class='" + percent_color + "'>" + parseInt(avg).toLocaleString() + "</div>";
|
446 |
-
sumBox += "</div>";
|
447 |
-
sumBox += "<div class='clear'></div>";
|
448 |
-
sumBox += "</div>";
|
449 |
-
jQuery('#'+chart_id).after(sumBox);
|
450 |
-
}
|
451 |
-
|
452 |
-
var chart = new gawd_charts_helper();
|
453 |
-
chart.print_compact_line_chart(data.chart_data, dimension, metric, metric_compare, chart_id);
|
454 |
-
}
|
455 |
-
else{
|
456 |
-
gawd_draw_table(result.data.gawd_show_data_compact, metric, 0, dimension);
|
457 |
-
}
|
458 |
-
};
|
459 |
-
|
460 |
-
args.error = function (data) {
|
461 |
-
jQuery(".opacity_div_compact").hide();
|
462 |
-
jQuery(".loading_div_compact").hide();
|
463 |
-
};
|
464 |
-
|
465 |
-
jQuery.ajax(args);
|
466 |
-
}
|
467 |
-
|
468 |
-
function gawd_draw_analytics() {
|
469 |
-
|
470 |
-
console.log("ajax2");
|
471 |
-
jQuery('#country_filter_reset').hide();
|
472 |
-
jQuery("#metric_compare").show();
|
473 |
-
jQuery(".vs_image").show();
|
474 |
-
jQuery(".sum_box").remove();
|
475 |
-
jQuery("#filter_conteiner").show();
|
476 |
-
//jQuery('#chartdiv').height(700);
|
477 |
-
jQuery("#chartdiv").show();
|
478 |
-
var _end_date = (Date.today().add(-1).days()).toString("yyyy-MM-dd");
|
479 |
-
var start_date_7 = (Date.today().add(-1).days()).add(-7).days().toString("yyyy-MM-dd");
|
480 |
-
var start_end_date = typeof jQuery('#gawd_start_end_date').val() != 'undefined' ? jQuery('#gawd_start_end_date').val() : start_date_7 + '/-/' + _end_date;
|
481 |
-
|
482 |
-
var start_end_date = start_end_date.split('/-/');
|
483 |
-
var start_date = start_end_date[0];
|
484 |
-
var end_date = start_end_date[1];
|
485 |
-
var filter_type = jQuery("#gawd_filter_val").val();
|
486 |
-
var timezone = -(new Date().getTimezoneOffset() / 60);
|
487 |
-
|
488 |
-
metrics = [];
|
489 |
-
var metric = jQuery("#gawd_metric").val();
|
490 |
-
var metric_compare = jQuery("#gawd_metric_compare").val();
|
491 |
-
metrics.push("ga:" + metric);
|
492 |
-
var metric_compare_title = '';
|
493 |
-
if (metric_compare != 0) {
|
494 |
-
metrics.push("ga:" + metric_compare);
|
495 |
-
} else {
|
496 |
-
metric_compare = '';
|
497 |
-
}
|
498 |
-
|
499 |
-
if (jQuery("#gawd_chart_type").val() == 'line') {
|
500 |
-
var chartType = 'line';
|
501 |
-
var fillAlphas = 0;
|
502 |
-
} else if (jQuery("#gawd_chart_type").val() == 'column') {
|
503 |
-
var chartType = 'column';
|
504 |
-
var fillAlphas = 1;
|
505 |
-
}
|
506 |
-
var dimension = jQuery("#gawd_tab").val();
|
507 |
-
var customReport = "";
|
508 |
-
|
509 |
-
if (dimension == 'socialActivityNetworkAction' || dimension == 'socialActivityAction' || dimension == 'socialActivityTagsSummary' || dimension == 'socialActivityPost' || dimension == 'socialActivityTimestamp' || dimension == 'socialActivityUserProfileUrl' || dimension == 'socialActivityContentUrl' || dimension == 'socialActivityUserPhotoUrl' || dimension == 'socialActivityUserHandle' || dimension == 'socialActivityEndorsingUrl' || dimension == 'socialEndorsingUrl' || dimension == 'socialActivityDisplayName') {
|
510 |
-
jQuery('#metric_compare').hide();
|
511 |
-
jQuery('.vs_image').hide();
|
512 |
-
}
|
513 |
-
var parseDates = false;
|
514 |
-
if (dimension == 'date') {
|
515 |
-
parseDates = true;
|
516 |
-
var rotateAngle = 0;
|
517 |
-
} else if (dimension == 'realTime') {
|
518 |
-
jQuery(".filter_conteiner").hide();
|
519 |
-
jQuery("#chartdiv").empty();
|
520 |
-
gawd_widget_real_time("#chartdiv");
|
521 |
-
return;
|
522 |
-
} else if (dimension == 'custom')
|
523 |
-
{
|
524 |
-
|
525 |
-
var custom = jQuery("#gawd_custom_option").val();
|
526 |
-
var not_exist = '<div id="gawd_error">There are no custom dimensions set for current profile.</div>';
|
527 |
-
if(custom === null || typeof custom === 'undefined'){
|
528 |
-
var args = gawd_custom_ajax_args();
|
529 |
-
args.type = 'POST';
|
530 |
-
args.async = true;
|
531 |
-
args.data.gawd_action = "get_custom_dimensions";
|
532 |
-
args.data.gawd_data = {
|
533 |
-
"is_last_viewed_profile": 1,
|
534 |
-
};
|
535 |
-
args.beforeSend = function() {
|
536 |
-
|
537 |
-
};
|
538 |
-
args.success = function (data){
|
539 |
-
if(data.data.length === 0){
|
540 |
-
|
541 |
-
jQuery("#wdi_no_custom_dimensions").css({
|
542 |
-
'display':'block'
|
543 |
-
});
|
544 |
-
jQuery('#chartdiv').append(not_exist);
|
545 |
-
return;
|
546 |
-
|
547 |
-
}
|
548 |
-
else{
|
549 |
-
jQuery("#gawd_custom_option").css({
|
550 |
-
'display':'block'
|
551 |
-
});
|
552 |
-
if(typeof data.data != "undefined"){
|
553 |
-
for(i in data.data){
|
554 |
-
var custom_dimension_el = data.data[i];
|
555 |
-
jQuery("#gawd_custom_option").append("<option value='"+custom_dimension_el['id']+"'>"+custom_dimension_el['name']+"</option>");
|
556 |
-
}
|
557 |
-
}
|
558 |
-
custom = jQuery("#gawd_custom_option").val();
|
559 |
-
if (typeof custom != 'undefined') {
|
560 |
-
dimension = custom.substring(3);
|
561 |
-
}
|
562 |
-
else {
|
563 |
-
if (jQuery('#gawd_error').length <= 0) {
|
564 |
-
jQuery('#chartdiv').append(not_exist);
|
565 |
-
}
|
566 |
-
return;
|
567 |
-
}
|
568 |
-
|
569 |
-
}
|
570 |
-
gawd_show_data_ajax();
|
571 |
-
}
|
572 |
-
args.error = function (data) {
|
573 |
-
jQuery("#wdi_no_custom_dimensions").css({
|
574 |
-
'display':'block'
|
575 |
-
});
|
576 |
-
}
|
577 |
-
jQuery.ajax(args);
|
578 |
-
return;
|
579 |
-
}else{
|
580 |
-
if (typeof custom != 'undefined') {
|
581 |
-
dimension = custom.substring(3);
|
582 |
-
}
|
583 |
-
else {
|
584 |
-
if (jQuery('#gawd_error').length <= 0) {
|
585 |
-
jQuery('#chartdiv').append(not_exist);
|
586 |
-
}
|
587 |
-
return;
|
588 |
-
}
|
589 |
-
gawd_show_data_ajax();
|
590 |
-
return;
|
591 |
-
}
|
592 |
-
/*ajax for custom */
|
593 |
-
}
|
594 |
-
else if(typeof dimension != "undefined" && dimension.indexOf("custom_") > -1){
|
595 |
-
customReport = true;
|
596 |
-
dimension = dimension.substring(7);
|
597 |
-
}
|
598 |
-
else {
|
599 |
-
var rotateAngle = 90;
|
600 |
-
}
|
601 |
-
|
602 |
-
gawd_show_data_ajax();
|
603 |
-
|
604 |
-
function gawd_show_data_ajax() {
|
605 |
-
var args = gawd_custom_ajax_args();
|
606 |
-
args.type = 'POST';
|
607 |
-
args.async = true;
|
608 |
-
args.data.gawd_action = "gawd_show_data";
|
609 |
-
args.data.gawd_data = {
|
610 |
-
"start_date": start_date,
|
611 |
-
"end_date": end_date,
|
612 |
-
"metric": metrics,
|
613 |
-
"dimension": dimension,
|
614 |
-
"security": gawd_admin.ajaxnonce,
|
615 |
-
"filter_type": filter_type,
|
616 |
-
"custom": customReport,
|
617 |
-
"timezone": timezone,
|
618 |
-
};
|
619 |
-
args.beforeSend = function() {
|
620 |
-
jQuery('#opacity_div').show();
|
621 |
-
jQuery('#loading_div').show();
|
622 |
-
};
|
623 |
-
args.success = function (data) {
|
624 |
-
jQuery('#opacity_div').hide();
|
625 |
-
jQuery('#loading_div').hide();
|
626 |
-
|
627 |
-
if(data.success === false){
|
628 |
-
gawd_add_notice(data);
|
629 |
-
return;
|
630 |
-
}
|
631 |
-
gawd_request_last_args = args;
|
632 |
-
data = data.data.gawd_reports_data;
|
633 |
-
|
634 |
-
var result = JSON.parse(data);
|
635 |
-
if (result.error_message != undefined) {
|
636 |
-
var not_exist = '<div id="gawd_error">' + result.error_message + '</div>';
|
637 |
-
if (jQuery('#gawd_error').length < 1) {
|
638 |
-
jQuery('#chartdiv').append(not_exist);
|
639 |
-
}
|
640 |
-
return;
|
641 |
-
}
|
642 |
-
_data = result;
|
643 |
-
|
644 |
-
if (result.chart_data) {
|
645 |
-
result = result.chart_data;
|
646 |
-
}
|
647 |
-
var result_length = result.length;
|
648 |
-
if (filter_type == "week" || filter_type == "month" || filter_type == "hour") {
|
649 |
-
parseDates = false;
|
650 |
-
result_length = 20;
|
651 |
-
}
|
652 |
-
if (dimension == 'goals') {
|
653 |
-
dimension = 'date';
|
654 |
-
}
|
655 |
-
|
656 |
-
if (dimension != "pagePath" && dimension != "landingPagePath" && dimension != "daysToTransaction" && dimension != "transactionId") {
|
657 |
-
jQuery("#chartdiv").show();
|
658 |
-
if (dimension == 'date' || dimension == 'siteSpeed' || dimension == 'adsense' || dimension == 'sales_performance') {
|
659 |
-
jQuery("#compare_time_conteiner").show();
|
660 |
-
var dimension_export = dimension;
|
661 |
-
if (filter_type == '') {
|
662 |
-
dimension = 'date';
|
663 |
-
} else {
|
664 |
-
dimension = filter_type;
|
665 |
-
}
|
666 |
-
dimension = dimension.replace(/([A-Z])/g, " $1").trim().charAt(0).toUpperCase() + dimension.replace(/([A-Z])/g, " $1").trim().slice(1);
|
667 |
-
} else {
|
668 |
-
dimension = dimension.replace(/([A-Z])/g, " $1").trim().charAt(0).toUpperCase() + dimension.replace(/([A-Z])/g, " $1").trim().slice(1);
|
669 |
-
var dimension_export = dimension;
|
670 |
-
}
|
671 |
-
metric = metric.replace(/([A-Z])/g, " $1").trim().charAt(0).toUpperCase() + metric.replace(/([A-Z])/g, " $1").trim().slice(1);
|
672 |
-
metric = metric.replace(/ +/g, ' ');
|
673 |
-
var metric_export = metric;
|
674 |
-
var metric_compare_export = metric_compare;
|
675 |
-
var c ='';
|
676 |
-
gawd_chart_data = result;
|
677 |
-
if (_data_compare.length > 0) {
|
678 |
-
gawd_compare();
|
679 |
-
return;
|
680 |
-
}
|
681 |
-
|
682 |
-
var duration = "";
|
683 |
-
var durationUnits = "";
|
684 |
-
if(metric == 'Avg Session Duration' || metric == 'Avg Session Duration' || metric == 'Duration' || metric == 'Avg Session Duration' || metric == 'Avg Page Load Time' || metric == 'Avg Server Response Time' || metric == 'Avg Redirection Time' || metric == 'Avg Page Download Time'){
|
685 |
-
duration = "ss";
|
686 |
-
durationUnits = {
|
687 |
-
"mm": "m ",
|
688 |
-
"ss": "s"
|
689 |
-
};
|
690 |
-
}
|
691 |
-
if (metric_compare != '') {
|
692 |
-
var _duration = '';
|
693 |
-
var _durationUnits = '';
|
694 |
-
metric_compare = metric_compare.replace(/([A-Z])/g, " $1").trim();
|
695 |
-
metric_compare = metric_compare.charAt(0).toUpperCase() + metric_compare.slice(1);
|
696 |
-
metric_compare = metric_compare.replace(/ +/g, ' ');
|
697 |
-
metric_compare_title = /* ' vs ' + */ metric_compare.charAt(0).toUpperCase() + metric_compare.slice(1) == "Percent New Sessions" ? '% New Sessions' : metric_compare.charAt(0).toUpperCase() + metric_compare.slice(1);
|
698 |
-
|
699 |
-
if(metric_compare == 'Avg Session Duration' || metric_compare == 'Duration' || metric_compare == 'Avg Session Duration' || metric_compare == 'Avg Page Load Time' || metric_compare == 'Avg Server Response Time' || metric_compare == 'Avg Redirection Time' || metric_compare == 'Avg Page Download Time'){
|
700 |
-
_duration = "ss";
|
701 |
-
_durationUnits = {
|
702 |
-
"mm": "m ",
|
703 |
-
"ss": "s"
|
704 |
-
};
|
705 |
-
}
|
706 |
-
c = {
|
707 |
-
"id": "g2",
|
708 |
-
"axisAlpha": 0.4,
|
709 |
-
"position": "right",
|
710 |
-
"title": metric_compare_title,
|
711 |
-
"ignoreAxisWidth": false,
|
712 |
-
"duration": _duration,
|
713 |
-
"durationUnits": _durationUnits,
|
714 |
-
'minimum': 0,
|
715 |
-
"boldLabels": true,
|
716 |
-
"zeroGridAlpha": 1
|
717 |
-
};
|
718 |
-
}
|
719 |
-
jQuery('#_sum_comp_chartdiv').remove();
|
720 |
-
jQuery('#_sum_box').remove();
|
721 |
-
if(typeof _data.data_sum != 'undefined'){
|
722 |
-
var float = '';
|
723 |
-
if(metric_compare != ''){
|
724 |
-
float="style='float:left'";
|
725 |
-
var total = _data.data_sum[metric_compare];
|
726 |
-
var avg = '';
|
727 |
-
var diff = ((Date.parse(end_date).getTime() - Date.parse(start_date).getTime()) / 3600 / 24 / 1000)+1;
|
728 |
-
var show_hide = 'gawd_show_total';
|
729 |
-
if(metric_compare == 'Bounce Rate' || metric_compare == 'Percent New Sessions' || metric_compare == 'Pageviews Per Session'){
|
730 |
-
avg = parseFloat(total).toFixed(2);
|
731 |
-
if(metric_compare != 'Pageviews Per Session'){
|
732 |
-
avg = avg + '%';
|
733 |
-
}
|
734 |
-
show_hide = 'gawd_hide_total';
|
735 |
-
}
|
736 |
-
else if(metric_compare == 'Avg Session Duration' || metric_compare == 'Avg Page Load Time' || metric_compare == 'Avg Server Response Time' || metric_compare == 'Avg Redirection Time' || metric_compare == 'Avg Page Download Time' || metric_compare == 'Duration'){
|
737 |
-
avg = sec_to_normal(total);
|
738 |
-
show_hide = 'gawd_hide_total';
|
739 |
-
}
|
740 |
-
else{
|
741 |
-
//avg = Math.ceil(total/diff);
|
742 |
-
avg = parseFloat(total/diff).toFixed(2);
|
743 |
-
}
|
744 |
-
|
745 |
-
var percent_color = total == 0 || metric_compare == 'Bounce Rate' ? "gawd_red" : "gawd_green";
|
746 |
-
var sumBox = "<div class='_sum_box' id='_sum_comp_chartdiv'>";
|
747 |
-
var metric_compare_title = metric_compare == 'Percent New Sessions' ? '% New Sessions' : metric_compare;
|
748 |
-
sumBox += "<div class='box_metric'>" + metric_compare_title + "</div>"
|
749 |
-
sumBox += "<div class='_box_left " + show_hide + "'>";
|
750 |
-
sumBox += "<div class='box_title'>Total</div>";
|
751 |
-
sumBox += "<div class='" + percent_color + "'>" + parseInt(total).toLocaleString() + "</div>";
|
752 |
-
sumBox += "</div>";
|
753 |
-
|
754 |
-
sumBox += "<div class='_box_right'>";
|
755 |
-
sumBox += "<div class='box_title'>Average</div>";
|
756 |
-
sumBox += "<div class='" + percent_color + "'>" + parseInt(avg).toLocaleString() + "</div>";
|
757 |
-
sumBox += "</div>";
|
758 |
-
sumBox += "<div class='clear'></div>";
|
759 |
-
sumBox += "</div>";
|
760 |
-
sumBox += "<div class='clear'></div>";
|
761 |
-
jQuery('#chartdiv').after(sumBox);
|
762 |
-
}
|
763 |
-
|
764 |
-
var total = _data.data_sum[metric];
|
765 |
-
var avg = '';
|
766 |
-
var diff = ((Date.parse(end_date).getTime() - Date.parse(start_date).getTime()) / 3600 / 24 / 1000)+1;
|
767 |
-
var show_hide = 'gawd_show_total';
|
768 |
-
if(metric == 'Bounce Rate' || metric == 'Percent New Sessions' || metric == 'Pageviews Per Session'){
|
769 |
-
avg = parseFloat(total).toFixed(2);
|
770 |
-
if(metric != 'Pageviews Per Session'){
|
771 |
-
avg = avg + '%';
|
772 |
-
}
|
773 |
-
show_hide = 'gawd_hide_total';
|
774 |
-
}
|
775 |
-
else if(metric == 'Avg Session Duration' || metric == 'Avg Page Load Time' || metric == 'Avg Server Response Time' || metric == 'Avg Redirection Time' || metric == 'Avg Page Download Time' || metric == 'Duration'){
|
776 |
-
avg = sec_to_normal(total);
|
777 |
-
show_hide = 'gawd_hide_total';
|
778 |
-
}
|
779 |
-
else{
|
780 |
-
//avg = Math.ceil(total/diff);
|
781 |
-
avg = parseFloat(total/diff).toFixed(2);
|
782 |
-
}
|
783 |
-
var percent_color = total == 0 || metric == 'Bounce Rate' ? "gawd_red" : "gawd_green";
|
784 |
-
var sumBox = "<div " + float + " class='_sum_box' id='_sum_box'>";
|
785 |
-
var metric_title = metric == 'Percent New Sessions' ? '% New Sessions' : metric;
|
786 |
-
sumBox += "<div class='box_metric'>" + metric_title + "</div>"
|
787 |
-
sumBox += "<div class='_box_left " + show_hide + "'>";
|
788 |
-
sumBox += "<div class='box_title'>Total</div>";
|
789 |
-
sumBox += "<div class='" + percent_color + "'>" + parseInt(total).toLocaleString() + "</div>";
|
790 |
-
sumBox += "</div>";
|
791 |
-
|
792 |
-
sumBox += "<div class='_box_right'>";
|
793 |
-
sumBox += "<div class='box_title'>Average</div>";
|
794 |
-
sumBox += "<div class='" + percent_color + "'>" + parseInt(avg).toLocaleString() + "</div>";
|
795 |
-
sumBox += "</div>";
|
796 |
-
sumBox += "<div class='clear'></div>";
|
797 |
-
sumBox += "</div>";
|
798 |
-
jQuery('#chartdiv').after(sumBox);
|
799 |
-
}
|
800 |
-
|
801 |
-
if (chartType === "line" || chartType === "column") {
|
802 |
-
var chart = new gawd_charts_helper();
|
803 |
-
chart.print_reports_line_chart(result, dimension, metric, metric_compare, chartType, 'chartdiv');
|
804 |
-
}
|
805 |
-
}
|
806 |
-
else {
|
807 |
-
var metric_export = metric;
|
808 |
-
var metric_compare_export = metric_compare;
|
809 |
-
var dimension_export = dimension;
|
810 |
-
jQuery("#chartdiv").hide();
|
811 |
-
//jQuery(".filter_conteiner").hide();
|
812 |
-
jQuery(".filter_conteiner").css({'height': '75px','position': 'relative'});
|
813 |
-
if(typeof jQuery.cookie("collapsed") != 'undefined' && jQuery.cookie("collapsed") == 1){
|
814 |
-
jQuery("#compare_time_conteiner").css({'float': 'none','width': '35%','position': 'absolute','right':'4%',"top": "35px"});
|
815 |
-
jQuery('#compare_datepicker_wraper').width('98.5%');
|
816 |
-
jQuery('.gawd_content').width('50.6%');
|
817 |
-
}
|
818 |
-
else{
|
819 |
-
jQuery("#compare_time_conteiner").css({'float': 'none','width': '36.6%','position': 'absolute','right':'2.3%',"top": "35px"});
|
820 |
-
jQuery('#compare_datepicker_wraper').width('98.5%');
|
821 |
-
}
|
822 |
-
|
823 |
-
jQuery("#date_chart_conteiner").css({'position': 'absolute','float': 'none','right':'0'});
|
824 |
-
jQuery(".gawd_date_filter_container").hide();
|
825 |
-
jQuery("#date_chart_conteiner .gawd_row:first-child").hide();
|
826 |
-
}
|
827 |
-
|
828 |
-
var tab_name = window.location.href.split('tab=');
|
829 |
-
d_start_date = start_date;
|
830 |
-
d_end_date = end_date;
|
831 |
-
d_second_start_date = start_date;
|
832 |
-
d_second_end_date = end_date;
|
833 |
-
d_metric_export = metric_export;
|
834 |
-
d_metric_compare_export = metric_compare_export;
|
835 |
-
d_dimension_export = dimension_export;
|
836 |
-
d_custom = customReport,
|
837 |
-
d_tab_name = tab_name;
|
838 |
-
d_filter_type = filter_type;
|
839 |
-
jQuery("#gbox_griddiv").remove();
|
840 |
-
var grid = '<table id="griddiv"></table><div id="pager"></div>';
|
841 |
-
jQuery('.gawd_chart_conteiner').append(grid);
|
842 |
-
|
843 |
-
if (typeof data_of_compared != 'undefined' && typeof data_of_compared['chart_data'] != 'undefined' && (dimension == "pagePath" || dimension == "landingPagePath")) {
|
844 |
-
gawd_compare();
|
845 |
-
return;
|
846 |
-
}
|
847 |
-
|
848 |
-
gawd_draw_table(data, metric, metric_compare, dimension);
|
849 |
-
}
|
850 |
-
args.error = function (data) {
|
851 |
-
}
|
852 |
-
jQuery.ajax(args).done(function () {
|
853 |
-
jQuery(".opacity_div_compact").hide();
|
854 |
-
jQuery(".loading_div_compact").hide();
|
855 |
-
|
856 |
-
jQuery('#opacity_div').hide();
|
857 |
-
jQuery('#loading_div').hide();
|
858 |
-
});
|
859 |
-
}
|
860 |
-
|
861 |
-
}
|
862 |
-
|
863 |
-
////////
|
864 |
-
jQuery(document).ready(function () {
|
865 |
-
|
866 |
-
jQuery('.gawd_export_button_csv').on('click', function (e) {
|
867 |
-
e.preventDefault();
|
868 |
-
|
869 |
-
var data = gawd_get_report_file_data();
|
870 |
-
data['action'] = 'gawd_create_csv_file';
|
871 |
-
|
872 |
-
|
873 |
-
jQuery.post(gawd_admin.ajaxurl, data ).done(function (response) {
|
874 |
-
response = JSON.parse(response);
|
875 |
-
if(response.success === true){
|
876 |
-
window.location.href =response['data']['download_url'];
|
877 |
-
}
|
878 |
-
|
879 |
-
});
|
880 |
-
|
881 |
-
return false;
|
882 |
-
});
|
883 |
-
|
884 |
-
jQuery('.gawd_export_button_csvs').on('click', function () {
|
885 |
-
|
886 |
-
if (typeof d_tab_name[1] == 'undefined') {
|
887 |
-
d_tab_name[1] = 'general';
|
888 |
-
}
|
889 |
-
/* var location = gawd_admin.exportUrl +
|
890 |
-
'&export_type=csv&gawd_start_date=' + d_start_date +
|
891 |
-
'&gawd_end_date=' + d_end_date +
|
892 |
-
'&gawd_metric=' + d_metric_export +
|
893 |
-
'&gawd_metric_compare=' + d_metric_compare_export +
|
894 |
-
'&gawd_dimension=' + d_dimension_export +
|
895 |
-
'&tab_name=' + d_tab_name[1] +
|
896 |
-
'&filter_type=' + d_filter_type +
|
897 |
-
'&report_type=alert&security=' + gawd_admin.ajaxnonce +
|
898 |
-
'&country_filter=' + d_country_filter +
|
899 |
-
'&geo_type=' + d_geo_type; */
|
900 |
-
|
901 |
-
var order = get_order_data_for_export();
|
902 |
-
|
903 |
-
//location += "&sort=" + order.order + "&sort_by=" + order.order_by;
|
904 |
-
// window.location = location;
|
905 |
-
var data = {
|
906 |
-
action: 'create_csv_file',
|
907 |
-
export_type: 'csv',
|
908 |
-
tab_name: d_tab_name[1],
|
909 |
-
report_type: 'alert',
|
910 |
-
security: gawd_admin.ajaxnonce,
|
911 |
-
sort: order.order,
|
912 |
-
sort_by: order.order_by
|
913 |
-
};
|
914 |
-
|
915 |
-
if(jQuery('#second_data').val() != ''){
|
916 |
-
if(d_tab_name[1] == 'pagePath' || d_tab_name[1] == 'landingPagePath'){
|
917 |
-
data.second_end_date = jQuery('#second_end_date').val();
|
918 |
-
data.second_start_date = jQuery('#second_start_date').val();
|
919 |
-
data.second_data_sum = jQuery('#second_data_sum').val();
|
920 |
-
data.first_data_sum = jQuery('#first_data_sum').val();
|
921 |
-
data.dimension = jQuery('#dimension').val();
|
922 |
-
data.second_data = jQuery('#second_data').val();
|
923 |
-
data.first_data = jQuery('#first_data').val();
|
924 |
-
}
|
925 |
-
}
|
926 |
-
else{
|
927 |
-
data._data_compare = _data_compare;
|
928 |
-
data.second_data_sum = jQuery('#second_data_sum').val(),
|
929 |
-
data.first_data_sum = jQuery('#first_data_sum').val(),
|
930 |
-
data.gawd_start_date = d_start_date,
|
931 |
-
data.gawd_end_date = d_end_date,
|
932 |
-
data.second_end_date = d_second_end_date,
|
933 |
-
data.second_start_date = d_second_start_date,
|
934 |
-
data.gawd_metric = d_metric_export,
|
935 |
-
data.gawd_metric_compare = d_metric_compare_export,
|
936 |
-
data.gawd_dimension = d_dimension_export,
|
937 |
-
data.filter_type = d_filter_type,
|
938 |
-
data.country_filter = d_country_filter,
|
939 |
-
data.geo_type = d_geo_type
|
940 |
-
}
|
941 |
-
console.log("ajax04");
|
942 |
-
jQuery.post(gawd_admin.ajaxurl, data ).done(function (url) {
|
943 |
-
jQuery('#opacity_div').hide();
|
944 |
-
jQuery('#loading_div').hide();
|
945 |
-
|
946 |
-
window.location.href = gawd_admin.exportUrl + '&export_type=csv&report_type=alert&sort=' + order.order + '&sort_by=' + order.order_by+'&security='+gawd_admin.ajaxnonce;
|
947 |
-
});
|
948 |
-
return false;
|
949 |
-
|
950 |
-
});
|
951 |
-
jQuery('.gawd_export_button_pdf').on('click', function () {
|
952 |
-
jQuery('#opacity_div').show();
|
953 |
-
jQuery('#loading_div').show();
|
954 |
-
|
955 |
-
var order = get_order_data_for_export();
|
956 |
-
|
957 |
-
var tab_name = window.location.href.split('tab=');
|
958 |
-
if (typeof tab_name[1] == 'undefined') {
|
959 |
-
tab_name[1] = 'general';
|
960 |
-
}
|
961 |
-
//CANVAS//
|
962 |
-
if (tab_name[1] != 'pagePath' && tab_name[1] != 'landingPagePath' && tab_name[1] != 'daysToTransaction' && tab_name[1] != 'pagePath#' && tab_name[1] != 'landingPagePath#' & tab_name[1] != 'daysToTransaction#') {
|
963 |
-
jQuery('svg').find('desc').remove();
|
964 |
-
var svg = document.getElementsByTagName('svg')[0];
|
965 |
-
var canvas = document.getElementById("canvass");
|
966 |
-
draw_canvas(svg, canvas);
|
967 |
-
url = canvas.toDataURL();
|
968 |
-
}
|
969 |
-
if (typeof url == 'undefined') {
|
970 |
-
url = '';
|
971 |
-
}
|
972 |
-
var data = {
|
973 |
-
action: 'create_pdf_file',
|
974 |
-
export_type: 'pdf',
|
975 |
-
tab_name: tab_name[1],
|
976 |
-
report_type: 'alert',
|
977 |
-
security: gawd_admin.ajaxnonce,
|
978 |
-
sort: order.order,
|
979 |
-
sort_by: order.order_by,
|
980 |
-
gawd_start_date: d_start_date,
|
981 |
-
gawd_end_date: d_end_date
|
982 |
-
};
|
983 |
-
|
984 |
-
if(d_custom) {
|
985 |
-
data.custom = d_custom;
|
986 |
-
}
|
987 |
-
|
988 |
-
if(jQuery('#second_data').val() != ''){
|
989 |
-
if(tab_name[1] == 'pagePath' || tab_name[1] == 'landingPagePath'){
|
990 |
-
data.second_end_date = jQuery('#second_end_date').val();
|
991 |
-
data.second_start_date = jQuery('#second_start_date').val();
|
992 |
-
data.second_data_sum = jQuery('#second_data_sum').val();
|
993 |
-
data.first_data_sum = jQuery('#first_data_sum').val();
|
994 |
-
data.dimension = jQuery('#dimension').val();
|
995 |
-
data.second_data = jQuery('#second_data').val();
|
996 |
-
data.first_data = jQuery('#first_data').val();
|
997 |
-
}
|
998 |
-
}
|
999 |
-
/* else if(_data_compare != ''){
|
1000 |
-
data.img = url;
|
1001 |
-
data._data_compare = _data_compare;
|
1002 |
-
} */
|
1003 |
-
else{
|
1004 |
-
data.img = url;
|
1005 |
-
data._data_compare = _data_compare;
|
1006 |
-
data.second_data_sum = jQuery('#second_data_sum').val(),
|
1007 |
-
data.first_data_sum = jQuery('#first_data_sum').val(),
|
1008 |
-
data.second_end_date = d_second_end_date;
|
1009 |
-
data.second_start_date = d_second_start_date;
|
1010 |
-
data.gawd_metric = d_metric_export,
|
1011 |
-
data.gawd_metric_compare = d_metric_compare_export,
|
1012 |
-
data.gawd_dimension = d_dimension_export,
|
1013 |
-
data.filter_type = d_filter_type,
|
1014 |
-
data.country_filter = d_country_filter,
|
1015 |
-
data.geo_type = d_geo_type
|
1016 |
-
}
|
1017 |
-
console.log("ajax05");
|
1018 |
-
jQuery.post(gawd_admin.ajaxurl, data ).done(function (url) {
|
1019 |
-
|
1020 |
-
jQuery('#opacity_div').hide();
|
1021 |
-
jQuery('#loading_div').hide();
|
1022 |
-
|
1023 |
-
window.location.href = gawd_admin.exportUrl + '&export_type=pdf&report_type=alert';
|
1024 |
-
});
|
1025 |
-
|
1026 |
-
|
1027 |
-
return false;
|
1028 |
-
});
|
1029 |
-
|
1030 |
-
/* FREE */
|
1031 |
-
|
1032 |
-
var pro_features_list = {
|
1033 |
-
'reports': {
|
1034 |
-
title1: 'The free version is limited up to 2 report types.',
|
1035 |
-
title2: 'Upgrade to Premium version to see the rest.',
|
1036 |
-
list: [
|
1037 |
-
'Аdvanced GA reports',
|
1038 |
-
'Ecommerce & AdWords reports',
|
1039 |
-
'Advanced tracking',
|
1040 |
-
// 'AdWords reports',
|
1041 |
-
// 'Google AdSense & AdWords reports',
|
1042 |
-
'Custom reports',
|
1043 |
-
//'Alerts and Pushover Notifications'
|
1044 |
-
]
|
1045 |
-
},
|
1046 |
-
'custom_reports': {
|
1047 |
-
title1: 'Custom reports are not available in free version.',
|
1048 |
-
title2: 'Upgrade to unlock all reports.',
|
1049 |
-
list: [
|
1050 |
-
'Аdvanced GA reports',
|
1051 |
-
'Ecommerce & AdWords reports',
|
1052 |
-
'Advanced tracking',
|
1053 |
-
// 'AdWords reports',
|
1054 |
-
// 'Google AdSense & AdWords reports',
|
1055 |
-
'Custom reports',
|
1056 |
-
//'Alerts and Pushover Notifications'
|
1057 |
-
]
|
1058 |
-
},
|
1059 |
-
'custom_dimensions': {
|
1060 |
-
title1: 'Custom dimensions are not available in free version.',
|
1061 |
-
title2: 'Upgrade to Premium version to configure custom tracking.',
|
1062 |
-
list: [
|
1063 |
-
'Аdvanced GA reports',
|
1064 |
-
'Ecommerce & AdWords reports',
|
1065 |
-
'Advanced tracking',
|
1066 |
-
// 'AdWords reports',
|
1067 |
-
// 'Google AdSense & AdWords reports',
|
1068 |
-
'Custom reports',
|
1069 |
-
//'Alerts and Pushover Notifications'
|
1070 |
-
]
|
1071 |
-
},
|
1072 |
-
'exclude_tracking': {
|
1073 |
-
title1: 'Custom tracking settings are not available.',
|
1074 |
-
title2: 'Upgrade to Premium version to customize tracking.',
|
1075 |
-
list: [
|
1076 |
-
'Аdvanced GA reports',
|
1077 |
-
'Ecommerce & AdWords reports',
|
1078 |
-
'Advanced tracking',
|
1079 |
-
// 'AdWords reports',
|
1080 |
-
// 'Google AdSense & AdWords reports',
|
1081 |
-
'Custom reports',
|
1082 |
-
//'Alerts and Pushover Notifications'
|
1083 |
-
]
|
1084 |
-
}
|
1085 |
-
};
|
1086 |
-
|
1087 |
-
jQuery('.gawd_inactive').each(function () {
|
1088 |
-
var $_this = jQuery(this);
|
1089 |
-
|
1090 |
-
if ($_this.find('.gawd_menu_ul_li').length > 0) {
|
1091 |
-
$_this.find('.gawd_menu_ul_li').on('click', {feature_key: 'reports'}, gawd_open_pro_popup);
|
1092 |
-
} else {
|
1093 |
-
$_this.on('click', {feature_key: 'reports'}, gawd_open_pro_popup);
|
1094 |
-
}
|
1095 |
-
|
1096 |
-
});
|
1097 |
-
|
1098 |
-
jQuery('.gawd_menu_coteiner_collapse .gawd_menu_ul span.gawd_menu_li_sub, .gawd_menu_coteiner_collapse .gawd_menu_ul a.gawd_menu_item').each(function(){
|
1099 |
-
var id = jQuery(this).attr('id');
|
1100 |
-
if(id !== 'gawd_general' && id !== 'gawd_realtime') {
|
1101 |
-
jQuery(this).on('click', {feature_key: 'reports'}, gawd_open_pro_popup);
|
1102 |
-
}
|
1103 |
-
});
|
1104 |
-
|
1105 |
-
jQuery('.gawd_pro_img').each(function(){
|
1106 |
-
var $_this = jQuery(this);
|
1107 |
-
$_this.on('click', {feature_key: $_this.data('gawd-screenshot')}, gawd_open_pro_popup);
|
1108 |
-
});
|
1109 |
-
|
1110 |
-
jQuery('.gawd_pro_popup_close_btn').on('click', gawd_close_pro_popup);
|
1111 |
-
jQuery('.gawd_pro_popup_overlay').on('click', gawd_close_pro_popup);
|
1112 |
-
|
1113 |
-
function gawd_open_pro_popup(args) {
|
1114 |
-
args.preventDefault();
|
1115 |
-
|
1116 |
-
var key = args.data.feature_key;
|
1117 |
-
|
1118 |
-
jQuery('.gawd_pro_popup').find('.gawd_pro_popup_title1').html(pro_features_list[key].title1);
|
1119 |
-
jQuery('.gawd_pro_popup').find('.gawd_pro_popup_title2').html(pro_features_list[key].title2);
|
1120 |
-
|
1121 |
-
var list_html = "";
|
1122 |
-
for (var i in pro_features_list[key].list) {
|
1123 |
-
list_html += "<li>" + pro_features_list[key].list[i] + "</li>";
|
1124 |
-
}
|
1125 |
-
|
1126 |
-
jQuery('.gawd_pro_popup').find('.gawd_pro_popup_content ul').html(list_html);
|
1127 |
-
|
1128 |
-
jQuery('.gawd_pro_popup_overlay').show();
|
1129 |
-
jQuery('.gawd_pro_popup').show();
|
1130 |
-
|
1131 |
-
return false;
|
1132 |
-
}
|
1133 |
-
|
1134 |
-
function gawd_close_pro_popup() {
|
1135 |
-
jQuery('.gawd_pro_popup_overlay').hide();
|
1136 |
-
jQuery('.gawd_pro_popup').hide();
|
1137 |
-
}
|
1138 |
-
/* END FREE*/
|
1139 |
-
});
|
1140 |
-
|
1141 |
-
function gawd_get_report_file_data(){
|
1142 |
-
if (typeof gawd_request_last_args === "undefined") {
|
1143 |
-
return false;
|
1144 |
-
}
|
1145 |
-
|
1146 |
-
var last_args = gawd_request_last_args.data;
|
1147 |
-
var compare_last_args = (typeof gawd_compare_request_last_args !== 'undefined' && typeof gawd_compare_request_last_args.data !== 'undefined') ? gawd_compare_request_last_args.data : null;
|
1148 |
-
|
1149 |
-
var compare_by = (typeof jQuery('#gawd_metric_compare').attr('disabled') === 'undefined') ? "metric" : "date";
|
1150 |
-
if(compare_by === "date"){
|
1151 |
-
var compare_metric_name = jQuery('#gawd_metric_compare').val();
|
1152 |
-
|
1153 |
-
if(last_args.gawd_data.metric.length > 1){
|
1154 |
-
|
1155 |
-
if (last_args.gawd_data.metric[0] === "ga:" + compare_metric_name) {
|
1156 |
-
last_args.gawd_data.metric = [last_args.gawd_data.metric[1]];
|
1157 |
-
} else if (last_args.gawd_data.metric[1] === "ga:" + compare_metric_name) {
|
1158 |
-
last_args.gawd_data.metric = [last_args.gawd_data.metric[0]];
|
1159 |
-
}
|
1160 |
-
|
1161 |
-
}
|
1162 |
-
}
|
1163 |
-
|
1164 |
-
var gawd_daterange = jQuery('.gawd_daterange .ranges li.active').text();
|
1165 |
-
if(gawd_daterange === ""){
|
1166 |
-
gawd_daterange = "Last 30 Days ";
|
1167 |
-
}
|
1168 |
-
|
1169 |
-
var gawd_compare_daterange = jQuery('.gawd_compare_daterange .ranges li.active').text();
|
1170 |
-
if(gawd_compare_daterange === ""){
|
1171 |
-
gawd_compare_daterange = "Previous period";
|
1172 |
-
}
|
1173 |
-
|
1174 |
-
var data = {
|
1175 |
-
security: gawd_admin.ajaxnonce,
|
1176 |
-
gawd_request_last_args: gawd_request_last_args.data,
|
1177 |
-
gawd_compare_request_last_args: (typeof gawd_compare_request_last_args !== 'undefined' && typeof gawd_compare_request_last_args.data !== 'undefined') ? gawd_compare_request_last_args.data : null,
|
1178 |
-
menu_name: jQuery('#gawd_page_title').text().trim(),
|
1179 |
-
compare_by: (typeof jQuery('#gawd_metric_compare').attr('disabled') === 'undefined') ? "metric" : "date",
|
1180 |
-
info: {
|
1181 |
-
'date_ranges': [gawd_daterange, gawd_compare_daterange]
|
1182 |
-
}
|
1183 |
-
};
|
1184 |
-
|
1185 |
-
return data;
|
1186 |
-
}
|
1187 |
-
|
1188 |
-
function get_order_data_for_export() {
|
1189 |
-
var el = jQuery('.ui-jqgrid-htable').find('th[aria-selected="true"]');
|
1190 |
-
if (el.length == 0) {
|
1191 |
-
el = jQuery('.ui-jqgrid-htable').find('th:first');
|
1192 |
-
}
|
1193 |
-
|
1194 |
-
var order_by = el.find('.ui-jqgrid-sortable').text();
|
1195 |
-
var order_el = el.find('span.s-ico').find('span').not('.ui-state-disabled');
|
1196 |
-
if (order_el.length == 0) {
|
1197 |
-
order_el = el.find('span.s-ico:first');
|
1198 |
-
}
|
1199 |
-
var order = order_el.attr('sort');
|
1200 |
-
return {
|
1201 |
-
'order': order,
|
1202 |
-
'order_by': order_by
|
1203 |
-
};
|
1204 |
-
}
|
1205 |
-
function draw_canvas(svg, canvas) {
|
1206 |
-
var serializer = new XMLSerializer();
|
1207 |
-
var svgString = serializer.serializeToString(svg);
|
1208 |
-
canvg(canvas, svgString);
|
1209 |
-
}
|
1210 |
-
function gawd_draw_analytics_widget() {
|
1211 |
-
var end_date = (Date.today().add(-1).days()).toString("yyyy-MM-dd");
|
1212 |
-
var start_date_30 = (Date.today().add(-1).days()).add(-30).days().toString("yyyy-MM-dd");
|
1213 |
-
var start_date_7 = (Date.today().add(-1).days()).days().toString("yyyy-MM-dd");
|
1214 |
-
start_date = typeof jQuery("#gawd_widget_date").val() != 'undefined' ? jQuery("#gawd_widget_date").val() : start_date_7;
|
1215 |
-
var metric = jQuery("#gawd_metric_widget").val();
|
1216 |
-
if (start_date == 'realTime') {
|
1217 |
-
jQuery("#gawd_metric_widget").hide();
|
1218 |
-
gawd_widget_real_time('#chart_widget');
|
1219 |
-
} else {
|
1220 |
-
jQuery("#gawd_metric_widget").show();
|
1221 |
-
gawd_widget_all(start_date, end_date, metric);
|
1222 |
-
}
|
1223 |
-
}
|
1224 |
-
|
1225 |
-
function gawd_widget_all(start_date, end_date, metric) {
|
1226 |
-
jQuery("#chart_widget").empty();
|
1227 |
-
jQuery('#chart_widget').height('300');
|
1228 |
-
jQuery(".opacity_div_compact").show();
|
1229 |
-
jQuery(".loading_div_compact").show();
|
1230 |
-
console.log("ajax06");
|
1231 |
-
var args = gawd_custom_ajax_args();
|
1232 |
-
args.type = 'POST';
|
1233 |
-
args.async = true;
|
1234 |
-
args.data.gawd_action = "gawd_show_data";
|
1235 |
-
args.data.gawd_data = {
|
1236 |
-
"start_date": start_date,
|
1237 |
-
"end_date": end_date,
|
1238 |
-
"metric": metric,
|
1239 |
-
};
|
1240 |
-
args.beforeSend = function () {
|
1241 |
-
|
1242 |
-
};
|
1243 |
-
args.success = function (data) {
|
1244 |
-
jQuery(".opacity_div_compact").hide();
|
1245 |
-
jQuery(".loading_div_compact").hide();
|
1246 |
-
if (data.success === false) {
|
1247 |
-
gawd_add_notice(data, '#chart_widget');
|
1248 |
-
return;
|
1249 |
-
}
|
1250 |
-
gawd_request_last_args = args;
|
1251 |
-
data = data.data.gawd_reports_data;
|
1252 |
-
data = JSON.parse(data);
|
1253 |
-
data = data.chart_data;
|
1254 |
-
metric = metric.replace(/([A-Z])/g, " $1").trim();
|
1255 |
-
metric = metric.charAt(0).toUpperCase() + metric.slice(1);
|
1256 |
-
metric = metric.replace(/ +/g, ' ');
|
1257 |
-
}
|
1258 |
-
args.error = function (data) {
|
1259 |
-
jQuery(".opacity_div_compact").hide();
|
1260 |
-
jQuery(".loading_div_compact").hide();
|
1261 |
-
}
|
1262 |
-
jQuery.ajax(args);
|
1263 |
-
|
1264 |
-
}
|
1265 |
-
function gawd_pie_chart() {
|
1266 |
-
//jQuery("#chart").empty();
|
1267 |
-
console.log('ajax2.5');
|
1268 |
-
var labels_enabled = true;
|
1269 |
-
if(jQuery(window).width()<=750){
|
1270 |
-
labels_enabled = false;
|
1271 |
-
}
|
1272 |
-
jQuery('#country_filter_reset').hide();
|
1273 |
-
jQuery("#metric_compare").hide();
|
1274 |
-
jQuery("#compare_time_conteiner").hide();
|
1275 |
-
jQuery(".vs_image").hide();
|
1276 |
-
var _end_date = (Date.today().add(-1).days()).toString("yyyy-MM-dd");
|
1277 |
-
var start_date_7 = (Date.today().add(-1).days()).add(-7).days().toString("yyyy-MM-dd");
|
1278 |
-
var start_end_date = typeof jQuery('#gawd_start_end_date').val() != 'undefined' ? jQuery('#gawd_start_end_date').val() : start_date_7 + '/-/' + _end_date;
|
1279 |
-
|
1280 |
-
var start_end_date = start_end_date.split('/-/');
|
1281 |
-
var start_date = start_end_date[0];
|
1282 |
-
var end_date = start_end_date[1];
|
1283 |
-
metrics = [];
|
1284 |
-
var metric = jQuery("#gawd_metric").val();
|
1285 |
-
var metric_compare = jQuery("#gawd_metric_compare").val();
|
1286 |
-
if(jQuery("#metric_compare").is(":visible") != true){
|
1287 |
-
metric_compare = 0;
|
1288 |
-
}
|
1289 |
-
metrics.push("ga:" + metric);
|
1290 |
-
if (metric_compare != 0) {
|
1291 |
-
metrics.push("ga:" + metric_compare);
|
1292 |
-
}
|
1293 |
-
|
1294 |
-
var dimension = jQuery("#gawd_tab").val();
|
1295 |
-
var customReport = "";
|
1296 |
-
if (dimension == 'custom') {
|
1297 |
-
var custom = jQuery("#gawd_custom_option").val();
|
1298 |
-
if (typeof jQuery("#gawd_custom_option").val() != 'undefined') {
|
1299 |
-
dimension = custom.substring(3);
|
1300 |
-
} else {
|
1301 |
-
var not_exist = '<div id="gawd_error">There are no custom dimensions set for current profile.</div>';
|
1302 |
-
if (jQuery('#gawd_error').length <= 0) {
|
1303 |
-
jQuery('#chartdiv').append(not_exist);
|
1304 |
-
}
|
1305 |
-
return;
|
1306 |
-
}
|
1307 |
-
} else if (typeof dimension != "undefined" && dimension.indexOf("custom_") > -1) {
|
1308 |
-
customReport = true;
|
1309 |
-
dimension = dimension.substring(7);
|
1310 |
-
}
|
1311 |
-
|
1312 |
-
var args = gawd_custom_ajax_args();
|
1313 |
-
args.type = 'POST';
|
1314 |
-
args.async = true;
|
1315 |
-
args.data.gawd_action = "gawd_show_data";
|
1316 |
-
args.data.gawd_data = {
|
1317 |
-
"start_date": start_date,
|
1318 |
-
"end_date": end_date,
|
1319 |
-
"metric": metrics,
|
1320 |
-
"security": gawd_admin.ajaxnonce,
|
1321 |
-
"dimension": dimension,
|
1322 |
-
"custom": customReport
|
1323 |
-
};
|
1324 |
-
args.beforeSend = function() {
|
1325 |
-
jQuery('#opacity_div').show();
|
1326 |
-
jQuery('#loading_div').show();
|
1327 |
-
};
|
1328 |
-
args.success = function (data) {
|
1329 |
-
jQuery('#opacity_div').hide();
|
1330 |
-
jQuery('#loading_div').hide();
|
1331 |
-
|
1332 |
-
if(data.success === false){
|
1333 |
-
gawd_add_notice(data);
|
1334 |
-
return;
|
1335 |
-
}
|
1336 |
-
gawd_request_last_args = args;
|
1337 |
-
data = data.data.gawd_reports_data;
|
1338 |
-
var result = JSON.parse(data);
|
1339 |
-
_data = result;
|
1340 |
-
if (result.error_message != undefined) {
|
1341 |
-
var not_exist = '<div id="gawd_error">' + result.error_message + '</div>';
|
1342 |
-
if (typeof jQuery('#gawd_error') == 'undefined') {
|
1343 |
-
jQuery('#chartdiv').append(not_exist);
|
1344 |
-
}
|
1345 |
-
return;
|
1346 |
-
}
|
1347 |
-
if (result.chart_data) {
|
1348 |
-
result = result.chart_data;
|
1349 |
-
}
|
1350 |
-
|
1351 |
-
//jQuery('#chartdiv').height(700);
|
1352 |
-
|
1353 |
-
if (dimension == 'goals') {
|
1354 |
-
dimension = 'date';
|
1355 |
-
}
|
1356 |
-
if (dimension == 'date' || dimension == 'siteSpeed' || dimension == 'adsense' || dimension == 'sales_performance') {
|
1357 |
-
//jQuery("#compare_time_conteiner").show();
|
1358 |
-
var dimension_export = dimension;
|
1359 |
-
if (filter_type == '' || typeof filter_type == 'undefined') {
|
1360 |
-
dimension = 'date';
|
1361 |
-
} else {
|
1362 |
-
dimension = filter_type;
|
1363 |
-
}
|
1364 |
-
|
1365 |
-
dimension = dimension.replace(/([A-Z])/g, " $1").trim().charAt(0).toUpperCase() + dimension.replace(/([A-Z])/g, " $1").trim().slice(1);
|
1366 |
-
}
|
1367 |
-
else {
|
1368 |
-
dimension = dimension.replace(/([A-Z])/g, " $1").trim().charAt(0).toUpperCase() + dimension.replace(/([A-Z])/g, " $1").trim().slice(1);
|
1369 |
-
var dimension_export = dimension;
|
1370 |
-
}
|
1371 |
-
|
1372 |
-
metric = metric.replace(/([A-Z])/g, " $1").trim();
|
1373 |
-
metric = metric.charAt(0).toUpperCase() + metric.slice(1);
|
1374 |
-
metric = metric.replace(/ +/g, ' ');
|
1375 |
-
var a = '';
|
1376 |
-
var baloon = true
|
1377 |
-
if(metric == "Bounce Rate" || metric == "Percent New Sessions"){
|
1378 |
-
a = '[[title]]: [[value]]%';
|
1379 |
-
baloon = false;
|
1380 |
-
}
|
1381 |
-
var metric_export = metric;
|
1382 |
-
var metric_compare_export = '';
|
1383 |
-
var filter_type = '';
|
1384 |
-
if(dimension.indexOf('Dimension') != -1){
|
1385 |
-
dimension = jQuery('#gawd_custom_option option:selected').text();
|
1386 |
-
}
|
1387 |
-
|
1388 |
-
var chart = new gawd_charts_helper();
|
1389 |
-
chart.print_pie_chart(result, dimension, metric, "chartdiv");
|
1390 |
-
|
1391 |
-
//CANVAS//
|
1392 |
-
var tab_name = window.location.href.split('tab=');
|
1393 |
-
if (tab_name[1] != 'pagePath' && tab_name[1] != 'landingPagePath' && tab_name[1] != 'daysToTransaction') {
|
1394 |
-
var svg = document.getElementsByTagName('svg')[0];
|
1395 |
-
var canvas = document.getElementById("canvass");
|
1396 |
-
if (typeof svg !== 'undefined') {
|
1397 |
-
draw_canvas(svg, canvas);
|
1398 |
-
url = canvas.toDataURL();
|
1399 |
-
}
|
1400 |
-
}
|
1401 |
-
if (typeof url == 'undefined') {
|
1402 |
-
url = '';
|
1403 |
-
}
|
1404 |
-
//CANVAS URL//
|
1405 |
-
|
1406 |
-
d_start_date = start_date;
|
1407 |
-
d_end_date = end_date;
|
1408 |
-
d_metric_export = metric_export;
|
1409 |
-
d_metric_compare_export = metric_compare_export;
|
1410 |
-
d_dimension_export = dimension_export;
|
1411 |
-
d_tab_name = tab_name;
|
1412 |
-
d_filter_type = filter_type;
|
1413 |
-
|
1414 |
-
jQuery("#gbox_griddiv").remove();
|
1415 |
-
var grid = '<table id="griddiv"></table><div id="pager"></div>';
|
1416 |
-
jQuery('.gawd_chart_conteiner').append(grid);
|
1417 |
-
gawd_draw_table(data, metric, metric_compare, dimension);
|
1418 |
-
};
|
1419 |
-
args.error = function (data) {
|
1420 |
-
jQuery(".opacity_div_compact").hide();
|
1421 |
-
jQuery(".loading_div_compact").hide();
|
1422 |
-
};
|
1423 |
-
jQuery.ajax(args);
|
1424 |
-
}
|
1425 |
-
function gawd_pie_chart_compact(metric, dimension, chart_type, chart_id) {
|
1426 |
-
var _end_date = (Date.today().add(-1).days()).toString("yyyy-MM-dd");
|
1427 |
-
var start_date_7 = (Date.today().add(-1).days()).add(-7).days().toString("yyyy-MM-dd");
|
1428 |
-
var start_end_date = typeof jQuery('#gawd_start_end_date_compact').val() != 'undefined' ? jQuery('#gawd_start_end_date_compact').val() : start_date_7 + '/-/' + _end_date;
|
1429 |
-
|
1430 |
-
var start_end_date = start_end_date.split('/-/');
|
1431 |
-
var start_date = start_end_date[0];
|
1432 |
-
var end_date = start_end_date[1];
|
1433 |
-
metrics = [];
|
1434 |
-
metrics.push("ga:" + metric);
|
1435 |
-
console.log("ajax07");
|
1436 |
-
|
1437 |
-
var args = gawd_custom_ajax_args();
|
1438 |
-
args.type = 'POST';
|
1439 |
-
args.async = true;
|
1440 |
-
args.data.gawd_action = "gawd_show_data_compact";
|
1441 |
-
args.data.gawd_data = {
|
1442 |
-
"start_date": start_date,
|
1443 |
-
"end_date": end_date,
|
1444 |
-
"metric": metrics,
|
1445 |
-
"security": gawd_admin.ajaxnonce,
|
1446 |
-
"dimension": dimension,
|
1447 |
-
};
|
1448 |
-
args.beforeSend = function() {
|
1449 |
-
jQuery('#' + chart_id).closest(".postbox").find('.opacity_div_compact').show();
|
1450 |
-
jQuery('#' + chart_id).closest(".postbox").find('.loading_div_compact').show();
|
1451 |
-
};
|
1452 |
-
args.success = function (result){
|
1453 |
-
jQuery('#' + chart_id).closest(".postbox").find('.opacity_div_compact').hide();
|
1454 |
-
jQuery('#' + chart_id).closest(".postbox").find('.loading_div_compact').hide();
|
1455 |
-
|
1456 |
-
if(result.success === false){
|
1457 |
-
gawd_add_notice(result, chart_id);
|
1458 |
-
return;
|
1459 |
-
}
|
1460 |
-
|
1461 |
-
result = JSON.parse(result.data.gawd_show_data_compact);
|
1462 |
-
dimension = dimension.replace(/([A-Z])/g, " $1").trim();
|
1463 |
-
dimension = dimension.charAt(0).toUpperCase() + dimension.slice(1);
|
1464 |
-
metric = metric.replace(/([A-Z])/g, " $1").trim();
|
1465 |
-
metric = metric.charAt(0).toUpperCase() + metric.slice(1);
|
1466 |
-
metric = metric.replace(/ +/g, ' ');
|
1467 |
-
var total = 0;
|
1468 |
-
if(typeof result.data_sum != 'undefined'){
|
1469 |
-
|
1470 |
-
total = result.data_sum[metric];
|
1471 |
-
var avg = '';
|
1472 |
-
var diff = ((Date.parse(end_date).getTime() - Date.parse(start_date).getTime()) / 3600 / 24 / 1000)+1;
|
1473 |
-
var show_hide = 'gawd_show_total';
|
1474 |
-
if(metric == 'Bounce Rate' || metric == 'Percent New Sessions' || metric == 'Pageviews Per Session'){
|
1475 |
-
avg = parseFloat(total).toFixed(2);
|
1476 |
-
if(metric != 'Pageviews Per Session'){
|
1477 |
-
avg = avg + '%';
|
1478 |
-
}
|
1479 |
-
show_hide = 'gawd_hide_total';
|
1480 |
-
}
|
1481 |
-
else if(metric == 'Avg Session Duration'){
|
1482 |
-
avg = sec_to_normal(avg);
|
1483 |
-
show_hide = 'gawd_hide_total';
|
1484 |
-
}
|
1485 |
-
else{
|
1486 |
-
//avg = Math.ceil(total/diff);
|
1487 |
-
avg = parseFloat(total/diff).toFixed(2);
|
1488 |
-
}
|
1489 |
-
var percent_color = total == 0 || metric == 'Bounce Rate' ? "gawd_red" : "gawd_green";
|
1490 |
-
jQuery('#_sum_' + chart_id).remove();
|
1491 |
-
var sumBox = "<div class='_sum_box' id='_sum_" + chart_id + "'>";
|
1492 |
-
var metric_title = metric == 'Percent New Sessions' ? '% New Sessions' : metric;
|
1493 |
-
sumBox += "<div class='box_metric'>" + metric_title + "</div>"
|
1494 |
-
sumBox += "<div class='_box_left " + show_hide + "'>";
|
1495 |
-
sumBox += "<div class='box_title'>Total</div>";
|
1496 |
-
sumBox += "<div class='" + percent_color + "'>" + parseInt(total).toLocaleString() + "</div>";
|
1497 |
-
sumBox += "</div>";
|
1498 |
-
|
1499 |
-
sumBox += "<div class='_box_right'>";
|
1500 |
-
sumBox += "<div class='box_title'>Average</div>";
|
1501 |
-
sumBox += "<div class='" + percent_color + "'>" + parseInt(avg).toLocaleString() + "</div>";
|
1502 |
-
sumBox += "</div>";
|
1503 |
-
sumBox += "<div class='clear'></div>";
|
1504 |
-
sumBox += "</div>";
|
1505 |
-
jQuery('#'+chart_id).after(sumBox);
|
1506 |
-
}
|
1507 |
-
result = result.chart_data;
|
1508 |
-
|
1509 |
-
if(total > 0) {
|
1510 |
-
var chart = new gawd_charts_helper();
|
1511 |
-
chart.print_pie_chart(result, dimension,metric, chart_id);
|
1512 |
-
}else{
|
1513 |
-
jQuery('#'+chart_id).height('auto');
|
1514 |
-
}
|
1515 |
-
};
|
1516 |
-
args.error = function (data) {
|
1517 |
-
|
1518 |
-
};
|
1519 |
-
jQuery.ajax(args);
|
1520 |
-
|
1521 |
-
}
|
1522 |
-
function gawd_chart_type() {
|
1523 |
-
if(typeof jQuery.cookie("collapsed") != 'undefined' && jQuery.cookie("collapsed") == 1){
|
1524 |
-
jQuery('.gawd_menu_coteiner').hide();
|
1525 |
-
jQuery('.gawd_menu_coteiner_collapse').show();
|
1526 |
-
jQuery('#gawd_right_conteiner').width('93%');
|
1527 |
-
}
|
1528 |
-
else{
|
1529 |
-
jQuery('.gawd_menu_coteiner').show();
|
1530 |
-
jQuery('.gawd_menu_coteiner_collapse').hide();
|
1531 |
-
jQuery('#gawd_right_conteiner').width('73%');
|
1532 |
-
jQuery('#compare_time_conteiner').css('width','31%');
|
1533 |
-
jQuery('#compare_time_conteiner').css('right','4%');
|
1534 |
-
jQuery('#compare_datepicker_wraper').width('98.5%');
|
1535 |
-
}
|
1536 |
-
var tab = jQuery('#gawd_body').data('gawd-tab');
|
1537 |
-
if(
|
1538 |
-
typeof tab !== 'undefined' &&
|
1539 |
-
( tab === 'adsense')
|
1540 |
-
){
|
1541 |
-
jQuery('#gawd_right_conteiner .filter_conteiner').hide();
|
1542 |
-
return;
|
1543 |
-
}
|
1544 |
-
if (jQuery("#gawd_chart_type").val() == 'pie') {
|
1545 |
-
gawd_pie_chart();
|
1546 |
-
} else {
|
1547 |
-
var current_tab_name = get_tab_name();
|
1548 |
-
if(current_tab_name === "goals" && jQuery("#gawd_metric").val()===null){
|
1549 |
-
var args = gawd_custom_ajax_args();
|
1550 |
-
args.type = 'POST';
|
1551 |
-
args.async = true;
|
1552 |
-
args.data.gawd_action = "gawd_get_management_goals";
|
1553 |
-
args.data.gawd_data = {
|
1554 |
-
|
1555 |
-
};
|
1556 |
-
args.beforeSend = function() {
|
1557 |
-
|
1558 |
-
};
|
1559 |
-
args.success = function (data) {
|
1560 |
-
data = JSON.parse(data.data.gawd_goals_data);
|
1561 |
-
for(i in data){
|
1562 |
-
jQuery("#gawd_metric").append( "<option class='gawd_metric_option' value='"+data[i]["name"]+"'>"+data[i]["name"]+"(Goal"+data[i]["id"]+" Completions</option>");
|
1563 |
-
jQuery("#gawd_metric_compare").append( "<option class='gawd_metric_option' value='"+data[i]["name"]+"'>"+data[i]["name"]+"(Goal"+data[i]["id"]+" Completions</option>");
|
1564 |
-
}
|
1565 |
-
gawd_draw_analytics();
|
1566 |
-
}
|
1567 |
-
args.error = function (data) {};
|
1568 |
-
jQuery.ajax(args);
|
1569 |
-
}
|
1570 |
-
else{
|
1571 |
-
gawd_draw_analytics();
|
1572 |
-
}
|
1573 |
-
|
1574 |
-
}
|
1575 |
-
var _end_date = (Date.today().add(-1).days()).toString("yyyy-MM-dd");
|
1576 |
-
var start_date_7 = (Date.today().add(-1).days()).add(-7).days().toString("yyyy-MM-dd");
|
1577 |
-
var start_end_date = typeof jQuery('#gawd_start_end_date').val() != 'undefined' ? jQuery('#gawd_start_end_date').val() : start_date_7 + '/-/' + _end_date;
|
1578 |
-
var start_end_date = start_end_date.split('/-/');
|
1579 |
-
var start_date = start_end_date[0];
|
1580 |
-
var end_date = start_end_date[1];
|
1581 |
-
var diff = ((Date.parse(end_date).getTime() - Date.parse(start_date).getTime()) / 3600 / 24 / 1000)+1;
|
1582 |
-
var period_compare_start_date = Date.parse(start_date).add(-diff).days().toString("yyyy-MM-dd");
|
1583 |
-
var year_compare_start_date = Date.parse(start_date).add(-1).years().toString("yyyy-MM-dd");
|
1584 |
-
var year_compare_end_date = Date.parse(end_date).add(-1).years().toString("yyyy-MM-dd");
|
1585 |
-
|
1586 |
-
var compare_daterange = jQuery('#compare_datepicker_wraper').daterangepicker({
|
1587 |
-
'ranges': {
|
1588 |
-
'Previous period': [moment(period_compare_start_date), moment(start_date).subtract(1, 'days')],
|
1589 |
-
'Previous year': [moment(year_compare_start_date), moment(year_compare_end_date)]
|
1590 |
-
},
|
1591 |
-
"startDate": moment(period_compare_start_date),
|
1592 |
-
"endDate": moment(start_date).subtract(1, 'days'),
|
1593 |
-
"maxDate": moment(),
|
1594 |
-
"alwaysShowCalendars": true,
|
1595 |
-
"opens": "left",
|
1596 |
-
"applyClass": 'gawd_compare_apply',
|
1597 |
-
"cancelClass": "gawd_compare_cancel"
|
1598 |
-
}, gawd_datepicker_compare);
|
1599 |
-
|
1600 |
-
if(typeof compare_daterange.data('daterangepicker') != "undefined"){
|
1601 |
-
compare_daterange.data('daterangepicker').container.addClass('gawd_compare_daterange');
|
1602 |
-
}
|
1603 |
-
|
1604 |
-
jQuery(document).mouseup(function (e) {
|
1605 |
-
|
1606 |
-
|
1607 |
-
|
1608 |
-
if (!jQuery('.gawd_compare_apply').is(e.target) && ( jQuery('.gawd_compare_cancel').is(e.target))) {
|
1609 |
-
jQuery('#gawd_metric_compare').attr('disabled',false);
|
1610 |
-
jQuery('#gawd_metric_compare').removeClass('gawd_disabled');
|
1611 |
-
}
|
1612 |
-
});
|
1613 |
-
jQuery('.cancelBtn').on('click', function () {
|
1614 |
-
_data_compare = [];
|
1615 |
-
data_of_compared = [];
|
1616 |
-
jQuery('#compare_datepicker_wraper').css('background-color','#AFAFAF');
|
1617 |
-
gawd_draw_analytics();
|
1618 |
-
});
|
1619 |
-
jQuery('.gawd_compare_apply').on('click', function () {
|
1620 |
-
if(jQuery('.ranges li.active').text() == 'Previous period' || jQuery('.ranges li.active').text() == 'Custom RangePrevious period' || jQuery('.ranges li.active').text() == 'Previous periodLast 30 Days' || jQuery('.ranges li.active').text() == 'Last 30 DaysPrevious period' || jQuery('.ranges li.active').text() == 'Previous periodLast 7 Days' || jQuery('.ranges li.active').text() == 'Last 7 DaysPrevious period' || jQuery('.ranges li.active').text() == 'Previous periodLast Week' || jQuery('.ranges li.active').text() == 'Last WeekPrevious period' || jQuery('.ranges li.active').text() == 'Previous periodThis Month' || jQuery('.ranges li.active').text() == 'This MonthPrevious period' || jQuery('.ranges li.active').text() == 'Previous periodLast Month' || jQuery('.ranges li.active').text() == 'Last MonthPrevious period' || jQuery('.ranges li.active').text() == 'Previous periodYesterday' || jQuery('.ranges li.active').text() == 'YesterdayPrevious period' || jQuery('.ranges li.active').text() == 'TodayPrevious period' || jQuery('.ranges li.active').text() == 'Previous periodToday'){
|
1621 |
-
|
1622 |
-
gawd_datepicker_compare(moment(period_compare_start_date), moment(start_date).subtract(1, 'days'));
|
1623 |
-
}
|
1624 |
-
//gawd_compare();
|
1625 |
-
})
|
1626 |
-
}
|
1627 |
-
function gawd_datepicker_compare(start, end) {
|
1628 |
-
jQuery('#compare_datepicker_wraper span').html(start.format('Y-MM-DD') + ' - ' + end.format('Y-MM-DD'));
|
1629 |
-
jQuery('#gawd_start_end_date_compare').val(start.format('Y-MM-DD') + '/-/' + end.format('Y-MM-DD'));
|
1630 |
-
gawd_compare();
|
1631 |
-
}
|
1632 |
-
function gawd_chart_type_post_page(uri, divID) {
|
1633 |
-
if (jQuery("#gawd_chart_type_post_page").val() == 'pie') {
|
1634 |
-
//gawd_pie_chart_post_page(uri, divID);
|
1635 |
-
} else {
|
1636 |
-
post_page_stats(uri, divID);
|
1637 |
-
}
|
1638 |
-
}
|
1639 |
-
|
1640 |
-
function post_page_stats(uri, divID) {
|
1641 |
-
jQuery(".opacity_div_compact").show();
|
1642 |
-
jQuery(".loading_div_compact").show();
|
1643 |
-
if (typeof divID == 'undefined') {
|
1644 |
-
divID = 'gawd_post_page_popup';
|
1645 |
-
}
|
1646 |
-
var chartType = 'line';
|
1647 |
-
var fillAlphas = 0;
|
1648 |
-
|
1649 |
-
if (jQuery("#gawd_chart_type_post_page").val() == 'line') {
|
1650 |
-
chartType = 'line';
|
1651 |
-
fillAlphas = 0;
|
1652 |
-
} else if (jQuery("#gawd_chart_type_post_page").val() == 'column') {
|
1653 |
-
chartType = 'column';
|
1654 |
-
fillAlphas = 1;
|
1655 |
-
}
|
1656 |
-
var metric = typeof jQuery("#gawd_metric_post_page").val() != 'undefined' ? jQuery("#gawd_metric_post_page").val() : (typeof jQuery("#gawd_metric_post_page_popup").val() != 'undefined' ? jQuery("#gawd_metric_post_page_popup").val() : 'sessions');
|
1657 |
-
var dimension = 'date';
|
1658 |
-
var date_30 = gawd_admin.date_30;
|
1659 |
-
var date_7 = gawd_admin.date_7;
|
1660 |
-
var date_yesterday = gawd_admin.date_yesterday;
|
1661 |
-
var date_today = gawd_admin.date_today;
|
1662 |
-
var date_this_month = gawd_admin.date_this_month;
|
1663 |
-
var date_last_month = gawd_admin.date_last_month;
|
1664 |
-
var date_last_week = gawd_admin.date_last_week;
|
1665 |
-
var _end_date = (Date.today().add(-1).days()).toString("yyyy-MM-dd");
|
1666 |
-
var start_date_7 = (Date.today().add(-1).days()).add(-7).days().toString("yyyy-MM-dd");
|
1667 |
-
var start_end_date = start_date_7 + '/-/' + _end_date;
|
1668 |
-
if (typeof jQuery('#gawd_start_end_date').val() != 'undefined') {
|
1669 |
-
start_end_date = jQuery('#gawd_start_end_date').val();
|
1670 |
-
}
|
1671 |
-
else {
|
1672 |
-
if (typeof jQuery('#gawd_post_page_popup_date').val() != 'undefined') {
|
1673 |
-
start_end_date = jQuery('#gawd_post_page_popup_date').val();
|
1674 |
-
}
|
1675 |
-
}
|
1676 |
-
var start_end_date = start_end_date.split('/-/');
|
1677 |
-
var start_date = start_end_date[0];
|
1678 |
-
var end_date = start_end_date[1];
|
1679 |
-
var timezone = -(new Date().getTimezoneOffset() / 60);
|
1680 |
-
if (divID == 'gawd_post_page_popup') {
|
1681 |
-
var chart_div = '<div id="opacity_div"></div><div id="loading_div" style="display:none; text-align: center; position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 9999;"><img src="' + gawd_admin.gawd_plugin_url + '/assets/ajax_loader.gif" style="position: absolute;top: calc(50% - 27px);left: calc(50% - 27px);width: 54px;height: 54px;"></div><div class="page_chart_div"><div class="close_button_cont"><button class="gawd_btn">X</button>';
|
1682 |
-
chart_div += '<select name="gawd_post_page_popup_date" id="gawd_post_page_popup_date">';
|
1683 |
-
chart_div += '<option value="' + date_7 + '">Last 7 Days</option><option value="' + date_30 + '">Last 30 Days</option>';
|
1684 |
-
chart_div += '<option value="' + date_last_month + '">Last month</option><option value="' + date_last_week + '">Last week</option>';
|
1685 |
-
chart_div += '<option value="' + date_this_month + '">This month</option><option value="' + date_yesterday + '">Yesterday</option>';
|
1686 |
-
chart_div += '<option value="' + date_today + '">Today</option>';
|
1687 |
-
chart_div += '</select>';
|
1688 |
-
chart_div += '<select name="gawd_metric_post_page_popup" id="gawd_metric_post_page_popup" >';
|
1689 |
-
chart_div += '<option value="sessions">Sessions</option><option value="users" >Users</option><option value="bounceRate" >Bounce Rate</option><option value="pageviews">Pageviews</option><option value="percentNewSessions">New Sessions</option><option value="avgSessionDuration">Session Duration</option><option value="pageviewsPerSession">Pages/Session</option>';
|
1690 |
-
chart_div += '</select>';
|
1691 |
-
chart_div += '<select name="gawd_chart_type_post_page" id="gawd_chart_type_post_page" class="gawd_draw_analytics">';
|
1692 |
-
chart_div += '<option value="line">Line Chart</option><option value="column">Column Chart</option>';
|
1693 |
-
chart_div += '</select>';
|
1694 |
-
chart_div += '<div id="gawd_post_page_popup"></div></div></div>';
|
1695 |
-
jQuery(".page_chart_div").remove();
|
1696 |
-
jQuery('#opacity_div').remove();
|
1697 |
-
|
1698 |
-
jQuery("body").append(chart_div);
|
1699 |
-
jQuery("#gawd_metric_post_page_popup").val(metric);
|
1700 |
-
jQuery("#gawd_chart_type_post_page").val(chartType);
|
1701 |
-
jQuery("#gawd_post_page_popup_date").val(start_date + '/-/' + end_date);
|
1702 |
-
jQuery("#loading_div").show();
|
1703 |
-
jQuery("#opacity_div").show();
|
1704 |
-
jQuery('#gawd_post_page_popup').height('400');
|
1705 |
-
jQuery('#gawd_metric_post_page_popup, #gawd_post_page_popup_date, #gawd_chart_type_post_page').on('change', function () {
|
1706 |
-
gawd_chart_type_post_page(uri, 'gawd_post_page_popup');
|
1707 |
-
})
|
1708 |
-
}
|
1709 |
-
jQuery("#gawd_post_page_meta").empty();
|
1710 |
-
jQuery('#gawd_post_page_meta').height('300');
|
1711 |
-
console.log("ajax10");
|
1712 |
-
var args = gawd_custom_ajax_args();
|
1713 |
-
args.type = 'POST';
|
1714 |
-
args.async = true;
|
1715 |
-
args.data.gawd_action = "gawd_show_post_page_data";
|
1716 |
-
args.data.gawd_data = {
|
1717 |
-
"metric": metric,
|
1718 |
-
"start_date": start_date,
|
1719 |
-
"end_date": end_date,
|
1720 |
-
"dimension": dimension,
|
1721 |
-
"timezone": timezone,
|
1722 |
-
"security": gawd_admin.ajaxnonce,
|
1723 |
-
"filter": uri,
|
1724 |
-
"chart": 'line',
|
1725 |
-
};
|
1726 |
-
args.beforeSend = function () {
|
1727 |
-
|
1728 |
-
};
|
1729 |
-
args.success = function (data) {
|
1730 |
-
var original_data = data;
|
1731 |
-
data = JSON.parse(data.data.gawd_page_post_data);
|
1732 |
-
data = data.chart_data ? data.chart_data : data;
|
1733 |
-
|
1734 |
-
jQuery(".opacity_div_compact").hide();
|
1735 |
-
jQuery(".loading_div_compact").hide();
|
1736 |
-
|
1737 |
-
if (divID == 'gawd_post_page_popup') {
|
1738 |
-
jQuery("#loading_div").hide();
|
1739 |
-
jQuery(".gawd_btn").show();
|
1740 |
-
jQuery('#opacity_div, .gawd_btn').on('click', function () {
|
1741 |
-
jQuery('#opacity_div').remove();
|
1742 |
-
jQuery(".gawd_btn").remove();
|
1743 |
-
jQuery(".page_chart_div").remove();
|
1744 |
-
jQuery("#loading_div").remove();
|
1745 |
-
})
|
1746 |
-
}
|
1747 |
-
|
1748 |
-
if (original_data.success === false) {
|
1749 |
-
gawd_add_notice(original_data, divID);
|
1750 |
-
return;
|
1751 |
-
}
|
1752 |
-
|
1753 |
-
if (data.length === 0) {
|
1754 |
-
return;
|
1755 |
-
}
|
1756 |
-
|
1757 |
-
|
1758 |
-
var x_key = 'date';
|
1759 |
-
var y_key = metric;
|
1760 |
-
|
1761 |
-
var chart = new gawd_charts_helper();
|
1762 |
-
chart.print_posts_chart(data, x_key, y_key, chartType, divID);
|
1763 |
-
|
1764 |
-
};
|
1765 |
-
args.error = function (data) {
|
1766 |
-
jQuery(".opacity_div_compact").hide();
|
1767 |
-
jQuery(".loading_div_compact").hide();
|
1768 |
-
};
|
1769 |
-
jQuery.ajax(args);
|
1770 |
-
|
1771 |
-
}
|
1772 |
-
function show_hide(obj) {
|
1773 |
-
jQuery('.gawd_resp_li').hide();
|
1774 |
-
obj.show();
|
1775 |
-
jQuery('.gawd_menu_coteiner').removeClass("gawd_open");
|
1776 |
-
}
|
1777 |
-
|
1778 |
-
function gawd_add_notice(data, chart_id) {
|
1779 |
-
if (typeof chart_id === 'undefined') {
|
1780 |
-
chart_id = "#chartdiv";
|
1781 |
-
}else{
|
1782 |
-
if(chart_id.charAt(0) !== '#'){
|
1783 |
-
chart_id = '#' + chart_id;
|
1784 |
-
}
|
1785 |
-
}
|
1786 |
-
|
1787 |
-
var notice = '';
|
1788 |
-
if (typeof data.error === 'undefined') {
|
1789 |
-
jQuery('#chartdiv').find('.gawd_chart_error_msg').remove();
|
1790 |
-
return notice;
|
1791 |
-
}
|
1792 |
-
|
1793 |
-
if (
|
1794 |
-
data.error.code === "show_data_error" &&
|
1795 |
-
data.error.msg === "Selected dimensions and metrics cannot be queried together"
|
1796 |
-
) {
|
1797 |
-
notice = '<div class="gawd_chart_error_msg">' + data.error.msg + '</div>';
|
1798 |
-
} else if (
|
1799 |
-
data.error.code === "gawd_no_property" ||
|
1800 |
-
data.error.code === 'show_data_error' ||
|
1801 |
-
data.error.code === 'show_data_compact_error' ||
|
1802 |
-
data.error.code === 'real_time_error' ||
|
1803 |
-
data.error.code === 'gawd_page_post_error'
|
1804 |
-
) {
|
1805 |
-
notice = '<div class="gawd_chart_error_msg">Can not get data for this property, maybe the property is deleted or changed. <a href="admin.php?page=gawd_settings">Refresh user info.</a></div>';
|
1806 |
-
}else{
|
1807 |
-
notice = '<div class="gawd_chart_error_msg">Some unknown error happened when getting report data. <a href="admin.php?page=gawd_settings">Refresh user info.</a></div>';
|
1808 |
-
}
|
1809 |
-
|
1810 |
-
if (notice !== '') {
|
1811 |
-
jQuery(chart_id).find('.gawd_chart_error_msg').remove();
|
1812 |
-
jQuery(chart_id).html("");
|
1813 |
-
jQuery(chart_id).append(notice);
|
1814 |
-
}
|
1815 |
-
|
1816 |
-
return notice;
|
1817 |
-
}
|
1818 |
-
|
1819 |
-
jQuery(document).ready(function () {
|
1820 |
-
|
1821 |
-
|
1822 |
-
jQuery('#gawd_email_time_input').timepicker({ 'scrollDefault': 'now','timeFormat': 'H:i' });
|
1823 |
-
|
1824 |
-
jQuery('#gawd_page_title').text(jQuery('.gawd_active_li').text());
|
1825 |
-
|
1826 |
-
if(jQuery('.gawd_menu_coteiner_collapse .gawd_active_li_text').closest('span').length > 0){
|
1827 |
-
jQuery('.gawd_menu_coteiner_collapse .gawd_active_li_text').closest('span').addClass('gawd_active_li');
|
1828 |
-
//jQuery('.gawd_menu_coteiner_collapse .collapse_ul .gawd_menu_item').removeClass('gawd_active_li');
|
1829 |
-
}
|
1830 |
-
jQuery('.collapse_ul').on('mouseover',function(){
|
1831 |
-
jQuery(this).show();
|
1832 |
-
} ,
|
1833 |
-
function(){
|
1834 |
-
jQuery(this).hide()
|
1835 |
-
});
|
1836 |
-
|
1837 |
-
jQuery('.gawd_collapse').on('click',function(){
|
1838 |
-
//jQuery('.gawd_menu_coteiner_collapse').toggle();
|
1839 |
-
//jQuery('.gawd_menu_coteiner').toggle();
|
1840 |
-
//jQuery('#gawd_right_conteiner').width('94%');
|
1841 |
-
jQuery.cookie("collapsed", "1");
|
1842 |
-
gawd_chart_type();
|
1843 |
-
})
|
1844 |
-
jQuery('.gawd_collapsed').on('click',function(){
|
1845 |
-
// jQuery('.gawd_menu_coteiner_collapse').toggle();
|
1846 |
-
// jQuery('#gawd_right_conteiner').width('73%');
|
1847 |
-
// jQuery('.gawd_menu_coteiner').toggle();
|
1848 |
-
jQuery.cookie("collapsed", "0");
|
1849 |
-
gawd_chart_type();
|
1850 |
-
})
|
1851 |
-
|
1852 |
-
jQuery('#gawd_got_it').on('click',function(){
|
1853 |
-
remove_zoom_message();
|
1854 |
-
})
|
1855 |
-
jQuery('#compare_datepicker_wraper').on('click',function(){
|
1856 |
-
jQuery('#gawd_metric_compare').attr('disabled',true);
|
1857 |
-
jQuery('#gawd_metric_compare').addClass('gawd_disabled');
|
1858 |
-
})
|
1859 |
-
// jQuery('.gawd_add_prop').width('51.2%');
|
1860 |
-
jQuery('.load_tooltip , .gawd_description').
|
1861 |
-
if(gawd_admin.enableHoverTooltip == 'on'){
|
1862 |
-
jQuery(this).attr('title',jQuery(this).data('hint'));
|
1863 |
-
}
|
1864 |
-
})
|
1865 |
-
jQuery('#gawd_dimensions_form, #gawd_custom_report_form').tooltip();
|
1866 |
-
jQuery('#gawd_goal_form').tooltip();
|
1867 |
-
jQuery(window).resize(function () {
|
1868 |
-
if(typeof jQuery.cookie("collapsed") == 'undefined' || jQuery.cookie("collapsed") == 0){
|
1869 |
-
jQuery('.gawd_menu_coteiner').show();
|
1870 |
-
}
|
1871 |
-
})
|
1872 |
-
|
1873 |
-
jQuery('#gawd_metric_compare').on('change', function () {
|
1874 |
-
if (jQuery(this).val() != '0') {
|
1875 |
-
jQuery('#metric_compare img').show();
|
1876 |
-
} else {
|
1877 |
-
jQuery('#_sum_comp_chartdiv').remove();
|
1878 |
-
jQuery('#metric_compare img').hide();
|
1879 |
-
}
|
1880 |
-
})
|
1881 |
-
jQuery('#metric_compare img').on('click', function () {
|
1882 |
-
jQuery('#gawd_metric_compare option:first-child').attr('selected', 'selected');
|
1883 |
-
jQuery(this).hide();
|
1884 |
-
jQuery('#_sum_comp_chartdiv').remove();
|
1885 |
-
gawd_chart_type();
|
1886 |
-
})
|
1887 |
-
|
1888 |
-
jQuery('.gawd_settings_menu_coteiner').show();
|
1889 |
-
jQuery('.resp_menu').on('click', function () {
|
1890 |
-
jQuery('.gawd_resp_li').show();
|
1891 |
-
if (jQuery('.gawd_menu_coteiner').hasClass("gawd_open")) {
|
1892 |
-
jQuery('.gawd_menu_coteiner').removeClass("gawd_open");
|
1893 |
-
var elId = window.location.hash ? window.location.hash.substring(0,window.location.hash.length-4) : "#gawd_authenicate";
|
1894 |
-
show_hide(jQuery(elId));
|
1895 |
-
//jQuery('.gawd_menu_coteiner').hide();
|
1896 |
-
}
|
1897 |
-
else {
|
1898 |
-
jQuery('.gawd_menu_coteiner').addClass("gawd_open");
|
1899 |
-
jQuery('.gawd_menu_coteiner').show();
|
1900 |
-
}
|
1901 |
-
})
|
1902 |
-
jQuery('.gawd_resp_li').on('click', function () {
|
1903 |
-
show_hide(jQuery(this));
|
1904 |
-
})
|
1905 |
-
jQuery('.resp_metrics_menu').on('click', function () {
|
1906 |
-
jQuery('.float_conteiner').toggle();
|
1907 |
-
jQuery('.filter_conteiner').toggle();
|
1908 |
-
})
|
1909 |
-
|
1910 |
-
jQuery('.gawd_page_post_stats').on('click', function () {
|
1911 |
-
var page_id = jQuery(this).parent().parent().find('th').find('input').val();
|
1912 |
-
var gawd_page_permalink = jQuery(this).data("permalink");
|
1913 |
-
gawd_chart_type_post_page(gawd_page_permalink);
|
1914 |
-
});
|
1915 |
-
|
1916 |
-
jQuery('.gawd_settings_wrapper').tooltip();
|
1917 |
-
if (jQuery('.gawd_menu_coteiner').length > 0) {
|
1918 |
-
jQuery('.settings_row, .gawd_checkbox, .gawd_goal_row, .gawd_own_wrap').tooltip();
|
1919 |
-
if(gawd_admin.enableHoverTooltip == 'on'){
|
1920 |
-
jQuery('.gawd_menu_coteiner, #gawd_right_conteiner').tooltip({position: {
|
1921 |
-
my: "center",
|
1922 |
-
at: "right+200",
|
1923 |
-
track: false,
|
1924 |
-
using: function(position, feedback) {
|
1925 |
-
jQuery(this).css(position);
|
1926 |
-
}
|
1927 |
-
}
|
1928 |
-
});
|
1929 |
-
}
|
1930 |
-
onDashboardLoad();
|
1931 |
-
}
|
1932 |
-
if (jQuery('.gawd_chart_conteiner').length > 0) {
|
1933 |
-
datepicker_js();
|
1934 |
-
}
|
1935 |
-
jQuery('#country_filter_reset').on('click', function () {
|
1936 |
-
gawd_chart_type();
|
1937 |
-
})
|
1938 |
-
jQuery('.gawd_menu_li_sub').on('click', function () {
|
1939 |
-
if (jQuery('#' + jQuery(this).closest('li').attr('id') + ' ul').is(":visible") != true) {
|
1940 |
-
jQuery('#' + jQuery(this).closest('li').attr('id') + ' ul').closest('li').find('.gawd_menu_li_sub_arrow').css("background-position", "83% 82.5%");
|
1941 |
-
} else {
|
1942 |
-
jQuery('#' + jQuery(this).closest('li').attr('id') + ' ul').closest('li').find('.gawd_menu_li_sub_arrow').css("background-position", "87% 85.6%");
|
1943 |
-
}
|
1944 |
-
jQuery(jQuery('#' + jQuery(this).closest('li').attr('id') + ' ul')).toggle(500);
|
1945 |
-
});
|
1946 |
-
if (jQuery('.gawd_active_li')) {
|
1947 |
-
jQuery('.gawd_active_li').closest('ul').show();
|
1948 |
-
}
|
1949 |
-
jQuery('.gawd_menu_li ul').each(function () {
|
1950 |
-
if (jQuery(this).is(':visible') == true) {
|
1951 |
-
jQuery(this).closest('li').find('.gawd_menu_li_sub_arrow').css("background-position", "83% 82.5%");
|
1952 |
-
} else {
|
1953 |
-
jQuery(this).closest('li').find('.gawd_menu_li_sub_arrow').css("background-position", "87% 85.6%");
|
1954 |
-
}
|
1955 |
-
});
|
1956 |
-
|
1957 |
-
jQuery('.gawd_list_item').on('click', function () {
|
1958 |
-
jQuery('.gawd_list_item a').css('color', '#fff');
|
1959 |
-
jQuery('#gawd_hour').css({'background-color': '#FB8583', 'border-color': '#FB8583'});
|
1960 |
-
jQuery('#gawd_day').css({'background-color': '#7DB5D8', 'border-color': '#7DB5D8'});
|
1961 |
-
jQuery('#gawd_week').css({'background-color': '#F0B358', 'border-color': '#F0B358'});
|
1962 |
-
jQuery('#gawd_month').css({'background-color': '#9DCFAC', 'border-color': '#9DCFAC'});
|
1963 |
-
jQuery(this).find('a').css('color', jQuery(this).css('border-top-color'));
|
1964 |
-
jQuery(this).css('background-color', '#fff');
|
1965 |
-
|
1966 |
-
jQuery('#gawd_filter_val').val(jQuery(this).find(".gawd_filter_item").attr('data-type'));
|
1967 |
-
gawd_chart_type();
|
1968 |
-
return false;
|
1969 |
-
})
|
1970 |
-
//google.charts.load('current', {'packages': ['table']});
|
1971 |
-
|
1972 |
-
jQuery(".gawd_draw_analytics").on("change", function () {
|
1973 |
-
if(jQuery(this).closest('#metric_conteiner').length > 0){
|
1974 |
-
var option = jQuery(this).val();
|
1975 |
-
var metric_id = "gawd_metric";
|
1976 |
-
var metric_compare_id = "gawd_metric_compare";
|
1977 |
-
var select_id = jQuery(this).attr("id");
|
1978 |
-
if(select_id == metric_id){
|
1979 |
-
jQuery("#"+metric_compare_id).find('option').show();
|
1980 |
-
jQuery("#"+metric_compare_id).find("option[value='"+option+"']").hide();
|
1981 |
-
}
|
1982 |
-
else if(select_id == metric_compare_id){
|
1983 |
-
jQuery("#"+metric_id).find('option').show();
|
1984 |
-
jQuery("#"+metric_id).find("option[value='"+option+"']").hide();
|
1985 |
-
}
|
1986 |
-
}
|
1987 |
-
gawd_chart_type();
|
1988 |
-
})
|
1989 |
-
|
1990 |
-
if (jQuery('#chart_widget').length > 0) {
|
1991 |
-
gawd_draw_analytics_widget();
|
1992 |
-
}
|
1993 |
-
gawd_tracking_display_manage();
|
1994 |
-
});
|
1995 |
-
function default_start() {
|
1996 |
-
if (gawd_admin.default_date != 'undefined') {
|
1997 |
-
|
1998 |
-
switch (gawd_admin.default_date) {
|
1999 |
-
case 'today':
|
2000 |
-
date = moment();
|
2001 |
-
break;
|
2002 |
-
case 'yesterday':
|
2003 |
-
date = moment().subtract(1, 'days');
|
2004 |
-
break;
|
2005 |
-
case 'last_7_days':
|
2006 |
-
date = moment().subtract(7, 'days');
|
2007 |
-
break;
|
2008 |
-
case 'last_week':
|
2009 |
-
date = moment().subtract(1, 'week').startOf('week');
|
2010 |
-
break;
|
2011 |
-
case 'this_month':
|
2012 |
-
date = moment().startOf('month');
|
2013 |
-
break;
|
2014 |
-
case 'last_30days':
|
2015 |
-
date = moment().subtract(30, 'days');
|
2016 |
-
break;
|
2017 |
-
case 'last_month':
|
2018 |
-
date = moment().subtract(1, 'month').startOf('month');
|
2019 |
-
break;
|
2020 |
-
default:
|
2021 |
-
date = moment().subtract(7, 'days');
|
2022 |
-
break;
|
2023 |
-
}
|
2024 |
-
return date;
|
2025 |
-
} else {
|
2026 |
-
return moment().subtract(7, 'days');
|
2027 |
-
}
|
2028 |
-
}
|
2029 |
-
function default_end() {
|
2030 |
-
if (gawd_admin.default_date != 'undefined') {
|
2031 |
-
switch (gawd_admin.default_date) {
|
2032 |
-
case 'today':
|
2033 |
-
date = moment();
|
2034 |
-
break;
|
2035 |
-
case 'yesterday':
|
2036 |
-
date = moment().subtract(1, 'days');
|
2037 |
-
break;
|
2038 |
-
case 'last_7_days':
|
2039 |
-
date = moment().subtract(1, 'days');
|
2040 |
-
break;
|
2041 |
-
case 'last_week':
|
2042 |
-
date = moment().subtract(1, 'week').endOf('week');
|
2043 |
-
break;
|
2044 |
-
case 'this_month':
|
2045 |
-
date = moment().subtract(1, 'days') <= moment().startOf('month') ? moment().startOf('month') : moment().subtract(1, 'days');
|
2046 |
-
break;
|
2047 |
-
case 'last_30days':
|
2048 |
-
date = moment().subtract(1, 'days');
|
2049 |
-
break;
|
2050 |
-
case 'last_month':
|
2051 |
-
date = moment().subtract(1, 'month').endOf('month')
|
2052 |
-
break;
|
2053 |
-
default:
|
2054 |
-
date = moment().subtract(1, 'days');
|
2055 |
-
break;
|
2056 |
-
}
|
2057 |
-
return date;
|
2058 |
-
} else {
|
2059 |
-
return moment().subtract(1, 'days');
|
2060 |
-
}
|
2061 |
-
}
|
2062 |
-
function datepicker_js(opens,callback) {
|
2063 |
-
if(typeof opens == 'undefined'){
|
2064 |
-
opens = 'left';
|
2065 |
-
}
|
2066 |
-
if(typeof callback == 'undefined'){
|
2067 |
-
callback = 'gawd_datepicker_main';
|
2068 |
-
}
|
2069 |
-
window[callback](default_start(), default_end());
|
2070 |
-
var daterange = jQuery('#reportrange').daterangepicker({
|
2071 |
-
"ranges": {
|
2072 |
-
'Today': [moment(), moment()],
|
2073 |
-
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
|
2074 |
-
'Last 7 Days': [moment().subtract(7, 'days'), moment().subtract(1, 'days')],
|
2075 |
-
'Last Week': [moment().subtract(1, 'week').startOf('week'), moment().subtract(1, 'week').endOf('week')],
|
2076 |
-
'Last 30 Days': [moment().subtract(30, 'days'), moment().subtract(1, 'days')],
|
2077 |
-
'This Month': [moment().startOf('month'), moment().endOf('month')],
|
2078 |
-
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
|
2079 |
-
},
|
2080 |
-
"startDate": default_start(),
|
2081 |
-
"endDate": default_end(),
|
2082 |
-
"maxDate": moment(),
|
2083 |
-
"alwaysShowCalendars": true,
|
2084 |
-
"opens": opens,
|
2085 |
-
"applyClass": 'gawd_main_apply'
|
2086 |
-
|
2087 |
-
}, window[callback]);
|
2088 |
-
var _end_date = (Date.today().add(-1).days()).toString("yyyy-MM-dd");
|
2089 |
-
var start_date_7 = (Date.today().add(-1).days()).add(-7).days().toString("yyyy-MM-dd");
|
2090 |
-
var start_end_date = typeof jQuery('#gawd_start_end_date').val() != 'undefined' ? jQuery('#gawd_start_end_date').val() : start_date_7 + '/-/' + _end_date;
|
2091 |
-
var start_end_date = start_end_date.split('/-/');
|
2092 |
-
var start_date = start_end_date[0];
|
2093 |
-
var end_date = start_end_date[1];
|
2094 |
-
if(typeof daterange.data('daterangepicker') != "undefined") {
|
2095 |
-
daterange.data('daterangepicker').container.addClass('gawd_daterange');
|
2096 |
-
}
|
2097 |
-
|
2098 |
-
}
|
2099 |
-
function onDashboardLoad() {
|
2100 |
-
jQuery(".gawd_email_week_day").on('click', function () {
|
2101 |
-
jQuery('#gawd_email_week_day_hidden').val(jQuery(this).attr('data-atribute'));
|
2102 |
-
jQuery(".gawd_email_week_day").removeClass('gawd_selected_day');
|
2103 |
-
jQuery(this).addClass('gawd_selected_day');
|
2104 |
-
})
|
2105 |
-
jQuery("#gawd_export_buttons, .gawd_exports, #ui-id-6").on({
|
2106 |
-
mouseover: function () {
|
2107 |
-
jQuery(".gawd_exports").show();
|
2108 |
-
},
|
2109 |
-
mouseleave: function () {
|
2110 |
-
jQuery(".gawd_exports").hide();
|
2111 |
-
}
|
2112 |
-
});
|
2113 |
-
jQuery("#gawd_email_button").on('click', function () {
|
2114 |
-
jQuery('.gawd_email_body').show();
|
2115 |
-
if(gawd_admin.enableHoverTooltip == 'on'){
|
2116 |
-
jQuery('.gawd_email_body').tooltip();
|
2117 |
-
}
|
2118 |
-
jQuery('.email_message_cont').html('');
|
2119 |
-
jQuery('.email_message_cont').hide();
|
2120 |
-
|
2121 |
-
jQuery('#gawd_email_to').val('');
|
2122 |
-
jQuery('#gawd_attachment_type').val('csv');
|
2123 |
-
jQuery('#gawd_email_period').find('select').val('once');
|
2124 |
-
jQuery('#gawd_email_body').val('');
|
2125 |
-
|
2126 |
-
jQuery('.gawd_email_row').find('.gawd_email_week_day_div').hide();
|
2127 |
-
jQuery('.gawd_email_row').find('.gawd_email_month_day_div').hide();
|
2128 |
-
jQuery('.gawd_email_time_row').hide();
|
2129 |
-
|
2130 |
-
|
2131 |
-
|
2132 |
-
|
2133 |
-
var _end_date = (Date.today().add(-1).days()).toString("yyyy-MM-dd");
|
2134 |
-
var start_date_7 = (Date.today().add(-1).days()).add(-7).days().toString("yyyy-MM-dd");
|
2135 |
-
var start_end_date = typeof jQuery('#gawd_start_end_date').val() != 'undefined' ? jQuery('#gawd_start_end_date').val() : start_date_7 + '/-/' + _end_date;
|
2136 |
-
|
2137 |
-
var start_end_date = start_end_date.split('/-/');
|
2138 |
-
var start_date = start_end_date[0];
|
2139 |
-
var end_date = start_end_date[1];
|
2140 |
-
jQuery("#gawd_start_date").val(start_date);
|
2141 |
-
jQuery("#gawd_end_date").val(end_date);
|
2142 |
-
if(_data_compare != ''){
|
2143 |
-
jQuery("#gawd_email_period select option").hide();
|
2144 |
-
jQuery("#gawd_email_period select option:first-child").show();
|
2145 |
-
}
|
2146 |
-
else{
|
2147 |
-
jQuery("#gawd_email_period select option").show();
|
2148 |
-
}
|
2149 |
-
jQuery(".gawd_email_popup").fadeIn('fast');
|
2150 |
-
jQuery(".gawd_email_popup_overlay").fadeIn('fast');
|
2151 |
-
jQuery(".gawd_btn").fadeIn('fast');
|
2152 |
-
var _tab_name = jQuery('#gawd_tab').val() == 'date' ? 'Audience' : jQuery('#gawd_tab').val();
|
2153 |
-
jQuery(".gawd_email_subject").val('Google Analytics: ' + _tab_name.replace(/([A-Z])/g, " $1").trim().charAt(0).toUpperCase() + _tab_name.replace(/([A-Z])/g, " $1").trim().slice(1) + ' (' + start_date + ' - ' + end_date + ')');
|
2154 |
-
})
|
2155 |
-
jQuery(".gawd_email_popup_overlay, .gawd_btn").on('click', function () {
|
2156 |
-
jQuery(".gawd_email_popup").fadeOut('fast');
|
2157 |
-
jQuery(".gawd_email_popup_overlay").fadeOut('fast');
|
2158 |
-
jQuery(".gawd_btn").fadeOut('fast');
|
2159 |
-
})
|
2160 |
-
jQuery("#gawd_email_period").on('change', function () {
|
2161 |
-
if (jQuery("#gawd_email_period :selected").val() == "gawd_weekly") {
|
2162 |
-
jQuery(".gawd_email_week_day_div").show();
|
2163 |
-
}
|
2164 |
-
else {
|
2165 |
-
jQuery(".gawd_email_week_day_div").hide();
|
2166 |
-
}
|
2167 |
-
if (jQuery("#gawd_email_period :selected").val() == "gawd_monthly") {
|
2168 |
-
jQuery(".gawd_email_month_day_div").show();
|
2169 |
-
}
|
2170 |
-
else {
|
2171 |
-
jQuery(".gawd_email_month_day_div").hide();
|
2172 |
-
}
|
2173 |
-
if (jQuery("#gawd_email_period :selected").val() != "once") {
|
2174 |
-
jQuery(".gawd_email_time_row").show();
|
2175 |
-
}
|
2176 |
-
else {
|
2177 |
-
jQuery(".gawd_email_time_row").hide();
|
2178 |
-
}
|
2179 |
-
})
|
2180 |
-
jQuery("#email_submit").on('click', function () {
|
2181 |
-
gawd_send_email_info();
|
2182 |
-
//email_popup();
|
2183 |
-
})
|
2184 |
-
}
|
2185 |
-
|
2186 |
-
function gawd_send_email_info() {
|
2187 |
-
|
2188 |
-
var email_info = {
|
2189 |
-
'period': jQuery("#gawd_email_period :selected").val(),
|
2190 |
-
'email_from': jQuery("#gawd_email_from").val(),
|
2191 |
-
'email_to': jQuery("#gawd_email_to").val(),
|
2192 |
-
'subject': jQuery(".gawd_email_subject").val(),
|
2193 |
-
'content': jQuery("#gawd_email_body").val(),
|
2194 |
-
'week_day': jQuery("#gawd_email_week_day_hidden").val(),
|
2195 |
-
'month_day': jQuery("#gawd_email_month_day_select").val(),
|
2196 |
-
'email_time': jQuery("#gawd_email_time_input").val(),
|
2197 |
-
'view_id': jQuery("#gawd_id option:selected").val(),
|
2198 |
-
};
|
2199 |
-
|
2200 |
-
var empty_subject = false;
|
2201 |
-
var is_valid_email = true;
|
2202 |
-
|
2203 |
-
jQuery("#gawd_email_to").removeClass('gawd_invalid')
|
2204 |
-
jQuery("#gawd_email_subject").removeClass('gawd_invalid')
|
2205 |
-
var emails = email_info.email_to.split(',');
|
2206 |
-
var invalid_emalis = [];
|
2207 |
-
for (var j = 0; j < emails.length; j++) {
|
2208 |
-
var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
2209 |
-
if (re.test(emails[j]) == false) {
|
2210 |
-
invalid_emalis.push(emails[j])
|
2211 |
-
}
|
2212 |
-
}
|
2213 |
-
if (invalid_emalis.length > 0) {
|
2214 |
-
is_valid_email = false;
|
2215 |
-
jQuery("#gawd_email_to").addClass('gawd_invalid');
|
2216 |
-
}
|
2217 |
-
if (email_info.subject == '') {
|
2218 |
-
empty_subject = true;
|
2219 |
-
jQuery("#gawd_email_subject").addClass('gawd_email_subject');
|
2220 |
-
}
|
2221 |
-
|
2222 |
-
|
2223 |
-
if (!(is_valid_email == true && empty_subject == false)) {
|
2224 |
-
return;
|
2225 |
-
}
|
2226 |
-
|
2227 |
-
var data = gawd_get_report_file_data();
|
2228 |
-
data['action'] = 'gawd_send_email';
|
2229 |
-
data['email_info'] = email_info;
|
2230 |
-
|
2231 |
-
jQuery('#loading_div').css('z-index','999999');
|
2232 |
-
jQuery('#loading_div').show();
|
2233 |
-
|
2234 |
-
jQuery.post(gawd_admin.ajaxurl, data).done(function (response) {
|
2235 |
-
response = JSON.parse(response);
|
2236 |
-
|
2237 |
-
jQuery('.gawd_email_body').hide();
|
2238 |
-
jQuery('#loading_div').css('z-index', '99999');
|
2239 |
-
jQuery('#loading_div').hide();
|
2240 |
-
jQuery('.email_message_cont').show();
|
2241 |
-
|
2242 |
-
jQuery('.email_message_cont').html(response.data.msg);
|
2243 |
-
|
2244 |
-
|
2245 |
-
});
|
2246 |
-
}
|
2247 |
-
|
2248 |
-
function email_popup() {
|
2249 |
-
jQuery("#gawd_email_metric").val(jQuery("#gawd_metric").val());
|
2250 |
-
var metric_compare_email = jQuery("#gawd_metric_compare").val();
|
2251 |
-
if(_data_compare != ''){
|
2252 |
-
metric_compare_email = jQuery("#gawd_metric").val() + ' compare';
|
2253 |
-
}
|
2254 |
-
var dimension = jQuery('#gawd_tab').val();
|
2255 |
-
if (dimension == 'custom') {
|
2256 |
-
// alert("bbbbbbbbbbbbb");
|
2257 |
-
var custom = jQuery("#gawd_custom_option").val();
|
2258 |
-
if (typeof jQuery("#gawd_custom_option").val() != 'undefined') {
|
2259 |
-
dimension = custom.substring(3);
|
2260 |
-
}
|
2261 |
-
}
|
2262 |
-
var url = '';
|
2263 |
-
if(dimension != "pagePath" && dimension != 'landingPagePath' && dimension != 'daysToTransaction'){
|
2264 |
-
jQuery('svg').find('desc').remove();
|
2265 |
-
var svg = document.getElementsByTagName('svg')[0];
|
2266 |
-
var canvas = document.getElementById("canvass");
|
2267 |
-
draw_canvas(svg, canvas);
|
2268 |
-
url = canvas.toDataURL();
|
2269 |
-
}
|
2270 |
-
if (typeof url == 'undefined') {
|
2271 |
-
url = '';
|
2272 |
-
}
|
2273 |
-
var gawd_email_period = jQuery("#gawd_email_period :selected").val();
|
2274 |
-
var filter_type = jQuery("#gawd_filter_val").val();
|
2275 |
-
var gawd_email_from = jQuery("#gawd_email_from").val();
|
2276 |
-
var gawd_email_to = jQuery("#gawd_email_to").val();
|
2277 |
-
var gawd_email_subject = jQuery(".gawd_email_subject").val();
|
2278 |
-
var start_date = jQuery("#gawd_start_date").val();
|
2279 |
-
var end_date = jQuery("#gawd_end_date").val();
|
2280 |
-
var metric = jQuery("#gawd_email_metric").val();
|
2281 |
-
var metric_compare = metric_compare_email;
|
2282 |
-
var export_type = jQuery("#gawd_attachment_type").val();
|
2283 |
-
var report_type = jQuery("#report_type").val();
|
2284 |
-
var gawd_email_body = jQuery("#gawd_email_body").val();
|
2285 |
-
var week_day = jQuery("#gawd_email_week_day_hidden").val();
|
2286 |
-
var month_day = jQuery("#gawd_email_month_day_select").val();
|
2287 |
-
var email_time = jQuery("#gawd_email_time_input").val();
|
2288 |
-
var view_id = jQuery("#gawd_id option:selected").closest('optgroup').attr('label');
|
2289 |
-
var empty_subject = false;
|
2290 |
-
var is_valid_email = true;
|
2291 |
-
jQuery("#gawd_email_to").removeClass('gawd_invalid')
|
2292 |
-
jQuery("#gawd_email_subject").removeClass('gawd_invalid')
|
2293 |
-
var emails = gawd_email_to.split(',');
|
2294 |
-
var invalid_emalis = [];
|
2295 |
-
for (var j = 0; j < emails.length; j++) {
|
2296 |
-
var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
2297 |
-
if (re.test(emails[j]) == false) {
|
2298 |
-
invalid_emalis.push(emails[j])
|
2299 |
-
}
|
2300 |
-
}
|
2301 |
-
if (invalid_emalis.length > 0) {
|
2302 |
-
is_valid_email = false;
|
2303 |
-
jQuery("#gawd_email_to").addClass('gawd_invalid');
|
2304 |
-
}
|
2305 |
-
if (gawd_email_subject == '') {
|
2306 |
-
empty_subject = true;
|
2307 |
-
jQuery("#gawd_email_subject").addClass('gawd_email_subject');
|
2308 |
-
}
|
2309 |
-
|
2310 |
-
var order = get_order_data_for_export();
|
2311 |
-
//jQuery("#gawd_email_form").submit();
|
2312 |
-
if (is_valid_email == true && empty_subject == false) {
|
2313 |
-
jQuery('#loading_div').css('z-index','999999');
|
2314 |
-
jQuery('#loading_div').show();
|
2315 |
-
console.log("ajax11");
|
2316 |
-
jQuery.post(gawd_admin.ajaxurl, {
|
2317 |
-
action: 'gawd_export',
|
2318 |
-
_data_compare: _data_compare,
|
2319 |
-
second_data_sum: jQuery('#second_data_sum').val(),
|
2320 |
-
first_data_sum: jQuery('#first_data_sum').val(),
|
2321 |
-
second_end_date: d_end_date,
|
2322 |
-
second_start_date: d_start_date,
|
2323 |
-
second_data: jQuery('#second_data').val(),
|
2324 |
-
first_data: jQuery('#first_data').val(),
|
2325 |
-
gawd_dimension: dimension,
|
2326 |
-
img:url,
|
2327 |
-
gawd_metric: metric,
|
2328 |
-
gawd_metric_compare: metric_compare,
|
2329 |
-
gawd_start_date: start_date,
|
2330 |
-
gawd_end_date: end_date,
|
2331 |
-
filter_type: filter_type,
|
2332 |
-
gawd_email_period: gawd_email_period,
|
2333 |
-
gawd_email_month_day: month_day,
|
2334 |
-
gawd_email_week_day: week_day,
|
2335 |
-
email_time: email_time,
|
2336 |
-
gawd_email_to: gawd_email_to,
|
2337 |
-
gawd_email_from: gawd_email_from,
|
2338 |
-
gawd_email_subject: gawd_email_subject,
|
2339 |
-
gawd_email_body: gawd_email_body,
|
2340 |
-
view_id: view_id,
|
2341 |
-
report_type: report_type,
|
2342 |
-
export_type: export_type,
|
2343 |
-
tab_name: d_tab_name[1],
|
2344 |
-
sort: order.order,
|
2345 |
-
sort_by: order.order_by,
|
2346 |
-
security: gawd_admin.ajaxnonce,
|
2347 |
-
}).done(function (data) {
|
2348 |
-
result = JSON.parse(data);
|
2349 |
-
if(result.status=='success'){
|
2350 |
-
jQuery('.gawd_email_body').hide();
|
2351 |
-
jQuery('#loading_div').css('z-index','99999');
|
2352 |
-
jQuery('#loading_div').hide();
|
2353 |
-
jQuery('.email_message_cont').show();
|
2354 |
-
jQuery('.email_message_cont').html(result.msg);
|
2355 |
-
}
|
2356 |
-
|
2357 |
-
})
|
2358 |
-
}
|
2359 |
-
}
|
2360 |
-
|
2361 |
-
function numFormat( cellvalue, options, rowObject ){
|
2362 |
-
if(typeof options != 'undefined' ){
|
2363 |
-
if(options.colModel.index != 'Pageviews Per Session' && options.colModel.index != 'Pageviews Per Session compare'){
|
2364 |
-
if(options.colModel.index.indexOf('compare') > -1){
|
2365 |
-
//options.colModel.index = options.colModel.index.replace(' compare','');
|
2366 |
-
var percentage_of_total = isNaN(cellvalue/data_of_compared.data_sum[options.colModel.index]) ? 0 : ((cellvalue/data_of_compared.data_sum[options.colModel.index])*100).toFixed(2);
|
2367 |
-
}
|
2368 |
-
else{
|
2369 |
-
if(typeof _data != 'undefined'){
|
2370 |
-
var percentage_of_total = isNaN(cellvalue/_data.data_sum[options.colModel.index]) ? 0 : ((cellvalue/_data.data_sum[options.colModel.index])*100).toFixed(2);
|
2371 |
-
}
|
2372 |
-
}
|
2373 |
-
var sum_percent = typeof percentage_of_total != 'undefined' ? ' <span class="row_percent">(' + percentage_of_total +'%)</span>' : '';
|
2374 |
-
return typeof cellvalue != 'undefined' ? cellvalue.toLocaleString() + sum_percent : '' ;
|
2375 |
-
}
|
2376 |
-
}
|
2377 |
-
return typeof cellvalue != 'undefined' ? cellvalue.toLocaleString() : '' ;
|
2378 |
-
}
|
2379 |
-
function timeFormat( cellvalue, options, rowObject ){
|
2380 |
-
if(typeof cellvalue == 'string'){
|
2381 |
-
if(cellvalue.indexOf(':') > -1){
|
2382 |
-
return cellvalue;
|
2383 |
-
}
|
2384 |
-
}
|
2385 |
-
var hours = (Math.floor(cellvalue / 3600)).toString().length < 2 ? '0' + Math.floor(cellvalue / 3600) : Math.floor(cellvalue / 3600);
|
2386 |
-
var mins = (Math.floor(cellvalue / 60 % 60)).toString().length < 2 ? '0' + Math.floor(cellvalue / 60 % 60) : Math.floor(cellvalue / 60 % 60);
|
2387 |
-
var secs = (Math.ceil(cellvalue % 60)).toString().length < 2 ? '0' + Math.ceil(cellvalue % 60) : Math.ceil(cellvalue % 60);
|
2388 |
-
metric_value = hours + ':' + mins + ':' + secs;
|
2389 |
-
return metric_value;
|
2390 |
-
}
|
2391 |
-
function percentFormat( cellvalue, options, rowObject ){
|
2392 |
-
return parseFloat(cellvalue).toFixed(2) + "%";
|
2393 |
-
}
|
2394 |
-
function dollarFormat( cellvalue, options, rowObject ){
|
2395 |
-
if(typeof options != 'undefined' ){
|
2396 |
-
var percentage_of_total = isNaN(cellvalue/_data.data_sum[options.colModel.index]) ? 0 : ((cellvalue/_data.data_sum[options.colModel.index])*100).toFixed(2);
|
2397 |
-
return '$<span class="row_percent">' + parseFloat(cellvalue).toFixed(2) + ' (' + percentage_of_total +'%)</span>';
|
2398 |
-
}
|
2399 |
-
return "$" + parseFloat(cellvalue).toFixed(2);
|
2400 |
-
}
|
2401 |
-
function secFormat( cellvalue, options, rowObject ){
|
2402 |
-
if(cellvalue == '1801'){
|
2403 |
-
return cellvalue.toLocaleString() + "+ seconds";
|
2404 |
-
}
|
2405 |
-
return cellvalue.toLocaleString() + " seconds";
|
2406 |
-
}
|
2407 |
-
function sec_to_normal(data){
|
2408 |
-
var hours = (Math.floor(data / 3600)).toString().length < 2 ? '0' + Math.floor(data / 3600) : Math.floor(data / 3600);
|
2409 |
-
var mins = (Math.floor(data / 60 % 60)).toString().length < 2 ? '0' + Math.floor(data / 60 % 60) : Math.floor(data / 60 % 60);
|
2410 |
-
var secs = (Math.ceil(data % 60)).toString().length < 2 ? '0' + Math.ceil(data % 60) : Math.ceil(data % 60);
|
2411 |
-
return data = hours + ':' + mins + ':' + secs;
|
2412 |
-
}
|
2413 |
-
var gawd_data_table = null;
|
2414 |
-
function gawd_draw_table_pages_compare(_data, data, dimension, data_sum, _data_sum,start_date, end_date){
|
2415 |
-
_data = JSON.parse(_data);
|
2416 |
-
data = JSON.parse(data);
|
2417 |
-
var metrics = Object.keys(_data[0]);
|
2418 |
-
var all_pages = new Array();
|
2419 |
-
var max_length_data = _data.length >= data.length ? _data : data;
|
2420 |
-
var min_length_data = _data.length >= data.length ? data : _data;
|
2421 |
-
|
2422 |
-
var max_length = max_length_data.length;
|
2423 |
-
var min_length = min_length_data.length;
|
2424 |
-
|
2425 |
-
var min_paths = [];
|
2426 |
-
for(var i=0 ;i<min_length; i++){
|
2427 |
-
min_paths.push(min_length_data[i][metrics[1]]);
|
2428 |
-
}
|
2429 |
-
|
2430 |
-
for(var i=0 ;i<max_length; i++){
|
2431 |
-
all_pages[max_length_data[i][metrics[1]]] = new Array();
|
2432 |
-
all_pages[max_length_data[i][metrics[1]]][0] = max_length_data[i];
|
2433 |
-
if(typeof min_length_data[i] == 'undefined' || min_paths.indexOf(max_length_data[i][metrics[1]]) == -1){
|
2434 |
-
all_pages[max_length_data[i][metrics[1]]][1] = 'no';
|
2435 |
-
}
|
2436 |
-
else{
|
2437 |
-
var key = i;
|
2438 |
-
for(var j=0; j<min_length; j++){
|
2439 |
-
if(min_length_data[j][metrics[1]] == max_length_data[i][metrics[1]]){
|
2440 |
-
key = j;
|
2441 |
-
break;
|
2442 |
-
}
|
2443 |
-
}
|
2444 |
-
all_pages[max_length_data[i][metrics[1]]][1] = min_length_data[key];
|
2445 |
-
}
|
2446 |
-
}
|
2447 |
-
|
2448 |
-
var table = '';
|
2449 |
-
table += '<thead>';
|
2450 |
-
table += '<tr>';
|
2451 |
-
for(var j=0 ;j<metrics.length; j++){
|
2452 |
-
table += '<th>' + metrics[j] + '</th>';
|
2453 |
-
}
|
2454 |
-
table += '</tr>';
|
2455 |
-
table += '<tr>';
|
2456 |
-
for(var j=0 ;j<metrics.length; j++){
|
2457 |
-
|
2458 |
-
if(metrics[j] == 'No' || metrics[j] == 'Page Path' || metrics[j] == 'Landing Page'){
|
2459 |
-
table += '<td></td>';
|
2460 |
-
}
|
2461 |
-
else{
|
2462 |
-
_data_sum[metrics[j]] = parseFloat(_data_sum[metrics[j]]);
|
2463 |
-
data_sum[metrics[j]] = parseFloat(data_sum[metrics[j]]);
|
2464 |
-
var arrow = '<img src=""/>';
|
2465 |
-
var percent = (((_data_sum[metrics[j]] - data_sum[metrics[j]])/data_sum[metrics[j]]) * 100).toFixed(2);
|
2466 |
-
if(isNaN(percent)){
|
2467 |
-
percent = 0;
|
2468 |
-
}
|
2469 |
-
else if(percent.indexOf('-') > -1){
|
2470 |
-
percent = percent.substr(1);
|
2471 |
-
arrow = '<img src="' + gawd_admin.gawd_plugin_url + '/assets/arrow-down.png"/>';
|
2472 |
-
}
|
2473 |
-
else{
|
2474 |
-
arrow = '<img src="' + gawd_admin.gawd_plugin_url + '/assets/arrow-up.png"/>';
|
2475 |
-
}
|
2476 |
-
percent = percent == 'Infinity' ? 100 : percent;
|
2477 |
-
table += '<td style="font-weight:bold; width: 9%;"><div>' + percent + '%' + arrow + '</div>';
|
2478 |
-
var data_sum_value = data_sum[metrics[j]].toLocaleString();
|
2479 |
-
var _data_sum_value = _data_sum[metrics[j]].toLocaleString();
|
2480 |
-
if(metrics[j] == 'Avg Time On Page' || metrics[j] == 'Avg Page Load Time' || metrics[j] == 'Avg Session Duration'){
|
2481 |
-
data_sum_value = sec_to_normal(parseFloat(data_sum_value));
|
2482 |
-
_data_sum_value = sec_to_normal(parseFloat(_data_sum_value));
|
2483 |
-
}
|
2484 |
-
if(metrics[j] == 'Bounce Rate' || metrics[j] == 'Exit Rate' || metrics[j] == 'Percent New Sessions' || metrics[j] == 'Ecommerce Conversion Rate'){
|
2485 |
-
_data_sum_value = parseFloat(_data_sum_value).toFixed(2) + '%';
|
2486 |
-
data_sum_value = parseFloat(data_sum_value).toFixed(2) + '%';
|
2487 |
-
}
|
2488 |
-
else if(metrics[j] == 'Page Value' || metrics[j] == 'Revenue'){
|
2489 |
-
_data_sum_value = '$' + parseFloat(_data_sum_value).toFixed(2);
|
2490 |
-
data_sum_value = '$' + parseFloat(data_sum_value).toFixed(2);
|
2491 |
-
}
|
2492 |
-
table += '<div>' + _data_sum_value + ' vs ' + data_sum_value + '</div>';
|
2493 |
-
table += '</td>';
|
2494 |
-
}
|
2495 |
-
}
|
2496 |
-
table += '</tr>';
|
2497 |
-
table += '</thead>';
|
2498 |
-
table += '<tbody class="gawd_datatable_hide_button">';
|
2499 |
-
|
2500 |
-
Object.size = function(obj) {
|
2501 |
-
var size = 0, key;
|
2502 |
-
for (key in obj) {
|
2503 |
-
if (obj.hasOwnProperty(key)) size++;
|
2504 |
-
}
|
2505 |
-
return size;
|
2506 |
-
};
|
2507 |
-
var length = Object.size(all_pages);
|
2508 |
-
var keys = Object.keys(all_pages);
|
2509 |
-
for(var i=0 ;i<length; i++){
|
2510 |
-
table += '<tr>';
|
2511 |
-
table += '<td>' + parseInt(i+1) +'</td>';
|
2512 |
-
table += '<td>' + keys[i] +'</td>';
|
2513 |
-
table += '<td></td>';
|
2514 |
-
table += '<td></td>';
|
2515 |
-
table += '<td></td>';
|
2516 |
-
table += '<td></td>';
|
2517 |
-
table += '<td></td>';
|
2518 |
-
table += '<td></td>';
|
2519 |
-
table += '<td></td>';
|
2520 |
-
table += '<td></td>';
|
2521 |
-
table += '</tr>';
|
2522 |
-
|
2523 |
-
table += '<tr>';
|
2524 |
-
for(var j = 0; j < metrics.length; j++){
|
2525 |
-
if(metrics[j] == 'No'){
|
2526 |
-
table += '<td ></td>';
|
2527 |
-
}
|
2528 |
-
else if(metrics[j] == 'Page Path' || metrics[j] == 'Landing Page'){
|
2529 |
-
table += '<td>' + Date.parse(d_start_date).toString('MMMM dd, yyyy') + ' - ' + Date.parse(d_end_date).toString('MMMM dd, yyyy') +'</td>';
|
2530 |
-
}
|
2531 |
-
else{
|
2532 |
-
if(all_pages[keys[i]][0] != 'no'){
|
2533 |
-
var line_value = all_pages[keys[i]][0][metrics[j]].toLocaleString();
|
2534 |
-
if(metrics[j] == 'Bounce Rate' || metrics[j] == 'Exit Rate' || metrics[j] == 'Percent New Sessions' || metrics[j] == 'Ecommerce Conversion Rate'){
|
2535 |
-
line_value = parseFloat(line_value).toFixed(2) + '%';
|
2536 |
-
}
|
2537 |
-
else if(metrics[j] == 'Page Value' || metrics[j] == 'Transaction Revenue' || metrics[j] == 'Revenue'){
|
2538 |
-
var percentage_of_total = isNaN(parseFloat(line_value)/_data_sum[metrics[j]]) ? 0 : ((parseFloat(line_value)/_data_sum[metrics[j]])*100).toFixed(2);
|
2539 |
-
line_value = parseFloat(line_value).toFixed(2) + '$ <span class="row_percent">(' + percentage_of_total +'%)</span>';
|
2540 |
-
}
|
2541 |
-
else if(metrics[j] == 'Avg Time On Page' || metrics[j] == 'Avg Page Load Time' || metrics[j] == 'Avg Session Duration'){
|
2542 |
-
line_value = line_value.indexOf(':') > -1 ? line_value : sec_to_normal(parseFloat(line_value));
|
2543 |
-
}
|
2544 |
-
else{
|
2545 |
-
var percentage_of_total = isNaN(parseFloat(line_value)/_data_sum[metrics[j]]) ? 0 : ((parseFloat(line_value)/_data_sum[metrics[j]])*100).toFixed(2);
|
2546 |
-
line_value = (line_value).toLocaleString() + ' <span class="row_percent">(' + percentage_of_total +'%)</span>';
|
2547 |
-
}
|
2548 |
-
table += '<td>' + line_value + '</td>';
|
2549 |
-
}
|
2550 |
-
else{
|
2551 |
-
table += '<td>0</td>';
|
2552 |
-
}
|
2553 |
-
}
|
2554 |
-
}
|
2555 |
-
table += '</tr>';
|
2556 |
-
table += '<tr>';
|
2557 |
-
for(var j = 0; j < metrics.length; j++){
|
2558 |
-
if(metrics[j] == 'No'){
|
2559 |
-
table += '<td></td>';
|
2560 |
-
}
|
2561 |
-
else if(metrics[j] == 'Page Path' || metrics[j] == 'Landing Page'){
|
2562 |
-
table += '<td>' + Date.parse(start_date).toString('MMMM dd, yyyy') + ' - ' + Date.parse(end_date).toString('MMMM dd, yyyy') +'</td>';
|
2563 |
-
}
|
2564 |
-
else{
|
2565 |
-
if(all_pages[keys[i]][1] != 'no'){
|
2566 |
-
var line_value = all_pages[keys[i]][1][metrics[j]].toLocaleString();
|
2567 |
-
if(metrics[j] == 'Bounce Rate' || metrics[j] == 'Exit Rate' || metrics[j] == 'Percent New Sessions' || metrics[j] == 'Ecommerce Conversion Rate'){
|
2568 |
-
line_value = parseFloat(line_value).toFixed(2) + '%';
|
2569 |
-
}
|
2570 |
-
else if(metrics[j] == 'Page Value' || metrics[j] == 'Transaction Revenue' || metrics[j] == 'Revenue'){
|
2571 |
-
var percentage_of_total = isNaN(parseFloat(line_value)/data_sum[metrics[j]]) ? 0 : ((parseFloat(line_value)/data_sum[metrics[j]])*100).toFixed(2);
|
2572 |
-
line_value = parseFloat(line_value).toFixed(2) + '$ <span class="row_percent">(' + percentage_of_total +'%)</span>';
|
2573 |
-
}
|
2574 |
-
else if(metrics[j] == 'Avg Time On Page' || metrics[j] == 'Avg Page Load Time' || metrics[j] == 'Avg Session Duration'){
|
2575 |
-
line_value = line_value.indexOf(':') > -1 ? line_value : sec_to_normal(parseFloat(line_value));
|
2576 |
-
}
|
2577 |
-
else{
|
2578 |
-
var percentage_of_total = isNaN(parseFloat(line_value)/data_sum[metrics[j]]) ? 0 : ((parseFloat(line_value)/data_sum[metrics[j]])*100).toFixed(2);
|
2579 |
-
line_value = (line_value).toLocaleString() + ' <span class="row_percent">(' + percentage_of_total +'%)</span>';
|
2580 |
-
}
|
2581 |
-
table += '<td>' + line_value + '</td>';
|
2582 |
-
}
|
2583 |
-
else{
|
2584 |
-
table += '<td>0</td>';
|
2585 |
-
}
|
2586 |
-
}
|
2587 |
-
}
|
2588 |
-
table += '</tr>';
|
2589 |
-
for(var j = 0; j < metrics.length; j++){
|
2590 |
-
if(metrics[j] == 'No'){
|
2591 |
-
table += '<td></td>';
|
2592 |
-
}
|
2593 |
-
else if(metrics[j] == 'Page Path' || metrics[j] == 'Landing Page'){
|
2594 |
-
table += '<td style="font-weight:bold;">% Change</td>';
|
2595 |
-
}
|
2596 |
-
else{
|
2597 |
-
if(all_pages[keys[i]][0] != 'no'){
|
2598 |
-
_single_data = all_pages[keys[i]][0][metrics[j]];
|
2599 |
-
}
|
2600 |
-
else{
|
2601 |
-
_single_data = 0;
|
2602 |
-
}
|
2603 |
-
if(all_pages[keys[i]][1] != 'no'){
|
2604 |
-
single_data = all_pages[keys[i]][1][metrics[j]];
|
2605 |
-
}
|
2606 |
-
else{
|
2607 |
-
single_data = 0;
|
2608 |
-
}
|
2609 |
-
if(metrics[j] == 'Avg Time On Page' || metrics[j] == 'Avg Page Load Time' || metrics[j] == 'Avg Session Duration'){
|
2610 |
-
|
2611 |
-
_single_data = _single_data.toString().split(":");
|
2612 |
-
|
2613 |
-
if(_single_data[0].indexOf('0') == 0){
|
2614 |
-
_single_data[0] = _single_data[0].substr(1);
|
2615 |
-
_single_data[0] = _single_data[0];
|
2616 |
-
}
|
2617 |
-
if(_single_data.length > 1){
|
2618 |
-
if(_single_data[1].indexOf('0') == 0){
|
2619 |
-
_single_data[1] = _single_data[1].substr(1);
|
2620 |
-
_single_data[1] = _single_data[1]*60;
|
2621 |
-
}
|
2622 |
-
if(_single_data[2].indexOf('0') == 0){
|
2623 |
-
_single_data[2] = _single_data[2].substr(1);
|
2624 |
-
_single_data[2] = _single_data[2];
|
2625 |
-
}
|
2626 |
-
}
|
2627 |
-
var a = typeof _single_data[0] == 'undefined' ? 0 : parseInt(_single_data[0]);
|
2628 |
-
var b = typeof _single_data[1] == 'undefined' ? 0 : parseInt(_single_data[1]);
|
2629 |
-
var c = typeof _single_data[2] == 'undefined' ? 0 : parseInt(_single_data[2]);
|
2630 |
-
_single_data = a + b + c;
|
2631 |
-
single_data = single_data.toString().split(":");
|
2632 |
-
if(single_data[0].indexOf('0') == 0){
|
2633 |
-
single_data[0] = single_data[0].substr(1);
|
2634 |
-
single_data[0] = single_data[0];
|
2635 |
-
}
|
2636 |
-
if(single_data.length > 1){
|
2637 |
-
if(single_data[1].indexOf('0') == 0){
|
2638 |
-
single_data[1] = single_data[1].substr(1);
|
2639 |
-
single_data[1] = single_data[1]*60;
|
2640 |
-
}
|
2641 |
-
if(single_data[2].indexOf('0') == 0){
|
2642 |
-
single_data[2] = single_data[2].substr(1);
|
2643 |
-
single_data[2] = single_data[2];
|
2644 |
-
}
|
2645 |
-
}
|
2646 |
-
var a = typeof single_data[0] == 'undefined' ? 0 : parseInt(single_data[0]);
|
2647 |
-
var b = typeof single_data[1] == 'undefined' ? 0 : parseInt(single_data[1]);
|
2648 |
-
var c = typeof single_data[2] == 'undefined' ? 0 : parseInt(single_data[2]);
|
2649 |
-
single_data = a + b + c;
|
2650 |
-
}
|
2651 |
-
var single_percent = (((_single_data - single_data)/single_data) * 100).toFixed(2);
|
2652 |
-
single_percent = isNaN(single_percent) ? '∞' : isFinite(single_percent) ? single_percent : '∞';
|
2653 |
-
table += '<td style="font-weight:bold;">' + single_percent + '%</td>';
|
2654 |
-
}
|
2655 |
-
}
|
2656 |
-
}
|
2657 |
-
table += '</tbody>';
|
2658 |
-
table += '</table>';
|
2659 |
-
|
2660 |
-
|
2661 |
-
if(gawd_data_table!=null){
|
2662 |
-
gawd_data_table.destroy();
|
2663 |
-
gawd_data_table = null;
|
2664 |
-
}
|
2665 |
-
|
2666 |
-
jQuery('.gawd_data_table table').html(table);
|
2667 |
-
gawd_data_table = jQuery('.gawd_data_table table').DataTable( {
|
2668 |
-
"ordering": false,
|
2669 |
-
searching: false
|
2670 |
-
});
|
2671 |
-
|
2672 |
-
}
|
2673 |
-
|
2674 |
-
function gawd_draw_table(data, metric, metric_compare, dimension, dataSums) {
|
2675 |
-
jQuery('.gawd_page_table').remove();
|
2676 |
-
jQuery('.paging-nav').remove();
|
2677 |
-
if(typeof data == 'undefined'){
|
2678 |
-
return;
|
2679 |
-
}
|
2680 |
-
if(typeof dataSums == 'undefined'){
|
2681 |
-
dataSums = false;
|
2682 |
-
}
|
2683 |
-
data = dimension != 'Active Page' ? JSON.parse(data) : data;
|
2684 |
-
var data_sum = 0;
|
2685 |
-
var data_sum_compare = 0;
|
2686 |
-
var col_total = false;
|
2687 |
-
if (typeof data.data_sum != "undefined" || dataSums){
|
2688 |
-
col_total = true;
|
2689 |
-
if(dimension == 'pagePath' || dimension == 'landingPagePath' || dimension == 'Active Page'){
|
2690 |
-
data_sum = data.data_sum;
|
2691 |
-
data = data.chart_data;
|
2692 |
-
|
2693 |
-
}
|
2694 |
-
else{
|
2695 |
-
metric = metric.replace(/([A-Z])/g, "$1").trim();
|
2696 |
-
metric = metric.charAt(0).toUpperCase() + metric.slice(1);
|
2697 |
-
metric = metric.replace(/ +/g, ' ');
|
2698 |
-
if(!dataSums){
|
2699 |
-
data_sum = data.data_sum[metric];
|
2700 |
-
data_sum_origin = data.data_sum[metric];
|
2701 |
-
if(data.data_sum[metric] == 0){
|
2702 |
-
data_sum = 1;
|
2703 |
-
}
|
2704 |
-
if(metric_compare != 0 || metric_compare != ""){
|
2705 |
-
data_sum_compare = data.data_sum[metric_compare];
|
2706 |
-
data_sum_compare_origin = data.data_sum[metric_compare];
|
2707 |
-
if(data.data_sum[metric_compare] == 0){
|
2708 |
-
data_sum_compare = 1;
|
2709 |
-
}
|
2710 |
-
}
|
2711 |
-
data = data.chart_data;
|
2712 |
-
}
|
2713 |
-
else{
|
2714 |
-
data_sum = dataSums[metric][metric];
|
2715 |
-
data_sum_compare = dataSums[metric][metric + ' compare'];
|
2716 |
-
data_sum_origin = dataSums[metric][metric];
|
2717 |
-
data_sum_compare_origin = dataSums[metric][metric + ' compare'];
|
2718 |
-
}
|
2719 |
-
}
|
2720 |
-
}
|
2721 |
-
|
2722 |
-
var count = 0;
|
2723 |
-
for (var property in data[0]) {
|
2724 |
-
if (Object.prototype.hasOwnProperty.call(data[0], property)) {
|
2725 |
-
count++;
|
2726 |
-
}
|
2727 |
-
}
|
2728 |
-
|
2729 |
-
if (dimension == "pagePath" || dimension == "landingPagePath" || dimension == "daysToTransaction" || dimension == "transactionId" ||(dimension == "date" && metric == 'transactionRevenue')) {
|
2730 |
-
if (typeof data[0] != 'undefined') {
|
2731 |
-
labels = Object.keys(data[0]);
|
2732 |
-
|
2733 |
-
} else {
|
2734 |
-
labels = ['No', dimension, metric];
|
2735 |
-
count = 3;
|
2736 |
-
}
|
2737 |
-
}
|
2738 |
-
else {
|
2739 |
-
if (metric_compare != 0) {
|
2740 |
-
if(metric+" compare" === metric_compare){
|
2741 |
-
labels = ['No', dimension, dimension + ' compare', metric, metric_compare];
|
2742 |
-
count = 5;
|
2743 |
-
}else{
|
2744 |
-
labels = ['No', dimension, metric, metric_compare];
|
2745 |
-
count = 4;
|
2746 |
-
}
|
2747 |
-
} else {
|
2748 |
-
labels = ['No', dimension, metric];
|
2749 |
-
count = 3;
|
2750 |
-
}
|
2751 |
-
}
|
2752 |
-
var colModel = [];
|
2753 |
-
var width = 15;
|
2754 |
-
if (dimension == "pagePath") {
|
2755 |
-
width = 40;
|
2756 |
-
}
|
2757 |
-
colModel.push({name: labels[0], index: labels[0], sorttype: 'int', width: width});
|
2758 |
-
if(labels[1] == 'Days To Transaction'){
|
2759 |
-
colModel.push({name: labels[1], index: labels[1], sorttype: 'int'});
|
2760 |
-
}
|
2761 |
-
else if(labels[1] == 'Session Duration Bucket'){
|
2762 |
-
colModel.push({name: labels[1], index: labels[1], formatter:secFormat});
|
2763 |
-
}
|
2764 |
-
else{
|
2765 |
-
colModel.push({name: labels[1], index: labels[1]});
|
2766 |
-
}
|
2767 |
-
for (var i = 2; i < count; i++) {
|
2768 |
-
if(labels[i] == 'Avg Session Duration' || labels[i] == 'Avg Session Duration compare' || labels[i] == 'Avg Page Load Time' || labels[i] == 'Avg Redirection Time' || labels[i] == 'Avg Server Response Time' || labels[i] == 'Avg Page Download Time' || labels[i] == 'Avg Page Load Time compare' || labels[i] == 'Avg Redirection Time compare' || labels[i] == 'Avg Server Response Time compare' || labels[i] == 'Avg Page Download Time compare' || labels[i] == 'Duration' || labels[i] == 'Avg Time On Page'){
|
2769 |
-
colModel.push({name: labels[i], index: labels[i], sorttype: 'int',editable: true, formatter:timeFormat});
|
2770 |
-
}
|
2771 |
-
else if(labels[i] == 'Bounce Rate' || labels[i] == 'Bounce Rate compare' || labels[i] == 'Transactions Per Session' || labels[i] == 'Transactions Per Session compare' || labels[i] == 'Exit Rate' || labels[i] == 'Percent New Sessions' || labels[i] == 'Percent New Sessions compare'){
|
2772 |
-
colModel.push({name: labels[i], index: labels[i], sorttype: 'int',editable: true, formatter:percentFormat});
|
2773 |
-
}
|
2774 |
-
else if(labels[i] == dimension + ' compare'){
|
2775 |
-
colModel.push({name: labels[i], index: labels[i] });
|
2776 |
-
}
|
2777 |
-
else if(labels[i].indexOf('Revenue') > -1 || labels[i] == 'Page Value'){
|
2778 |
-
colModel.push({name: labels[i], index: labels[i], sorttype: 'int',editable: true, formatter:dollarFormat});
|
2779 |
-
}
|
2780 |
-
else{
|
2781 |
-
colModel.push({name: labels[i], index: labels[i], sorttype: 'int',editable: true, formatter:numFormat});
|
2782 |
-
}
|
2783 |
-
}
|
2784 |
-
|
2785 |
-
|
2786 |
-
|
2787 |
-
if(gawd_data_table!=null){
|
2788 |
-
gawd_data_table.destroy();
|
2789 |
-
gawd_data_table = null;
|
2790 |
-
}
|
2791 |
-
var table_tfoot = "";
|
2792 |
-
|
2793 |
-
var table_columns = jQuery.map(colModel, function(value, index) {
|
2794 |
-
table_tfoot += '<th data-value="'+value.name+'"></th>';
|
2795 |
-
return {title: value.name};
|
2796 |
-
});
|
2797 |
-
|
2798 |
-
var array = jQuery.map(data, function(value, index) {
|
2799 |
-
var datatable_row_data = gawd_datatable_formater(colModel , value);
|
2800 |
-
return [datatable_row_data];
|
2801 |
-
});
|
2802 |
-
|
2803 |
-
jQuery('.gawd_data_table table').html("<thead></thead><tbody></tbody><tfoot><tr>"+table_tfoot+"</tr></tfoot>");
|
2804 |
-
|
2805 |
-
if(dimension == 'pagePath' || dimension == 'landingPagePath' || dimension == 'Active Page'){
|
2806 |
-
|
2807 |
-
metric = dimension == 'pagePath' ? ['Avg Page Load Time','Avg Time On Page','Bounce Rate','Entrances','Exit Rate','Page Value','Pageviews','Unique Pageviews'] : ['Sessions','Percent New Sessions','New Users','Bounce Rate','Pageviews Per Session','Avg Session Duration','Transactions','Transaction Revenue','Transactions Per Session'];
|
2808 |
-
for(var i = 0; i < metric.length; i++){
|
2809 |
-
_data_sum = data_sum[metric[i]];
|
2810 |
-
var sum = {};
|
2811 |
-
var colSum = parseFloat(_data_sum).toFixed(2);
|
2812 |
-
if(metric[i] == 'Avg Time On Page' || metric[i] == 'Avg Session Duration' || metric[i] == 'Avg Page Load Time'){
|
2813 |
-
colSum = sec_to_normal(colSum);
|
2814 |
-
}
|
2815 |
-
if(metric[i] == 'Percent New Sessions' || metric[i] == 'Avg Session Duration' || metric[i] == 'Transactions Per Session' || metric[i] == 'Avg Time On Page' || metric[i] == 'Exit Rate' || metric[i] == 'Pageviews Per Session'|| metric[i] == 'Bounce Rate' || metric[i] == 'Avg Page Load Time' || metric[i] == 'Page Value'){
|
2816 |
-
sum[metric[i]] = 'Avg: ' + colSum;
|
2817 |
-
if(metric[i] == 'Percent New Sessions' || metric[i] == 'Bounce Rate' || metric[i] == 'Transactions Per Session' || metric[i] == 'Exit Rate'){
|
2818 |
-
sum[metric[i]] = 'Avg: ' + colSum + '%';
|
2819 |
-
}
|
2820 |
-
else if(metric[i] == 'Page Value'){
|
2821 |
-
sum[metric[i]] = 'Avg: ' + '$' + colSum;
|
2822 |
-
}
|
2823 |
-
}
|
2824 |
-
else{
|
2825 |
-
sum[metric[i]] = 'Total: ' + colSum;
|
2826 |
-
}
|
2827 |
-
if(colSum != ""){
|
2828 |
-
gawd_datatable_footer(sum);
|
2829 |
-
}
|
2830 |
-
}
|
2831 |
-
}
|
2832 |
-
else{
|
2833 |
-
if(typeof data_sum_origin != "undefined"){
|
2834 |
-
var colSum = parseFloat(data_sum_origin).toLocaleString();
|
2835 |
-
}else{
|
2836 |
-
var colSum = "";
|
2837 |
-
}
|
2838 |
-
var sum = {};
|
2839 |
-
if(metric == 'Avg Session Duration' || metric == 'Avg Page Load Time' || metric == 'Avg Redirection Time' || metric == 'Avg Server Response Time' || metric == 'Avg Page Download Time' || metric == 'Duration'){
|
2840 |
-
colSum = sec_to_normal(colSum);
|
2841 |
-
//gawd_datatable_footer(colSum)
|
2842 |
-
}
|
2843 |
-
sum[metric] = metric == 'Avg Session Duration' || metric == 'Avg Page Load Time' || metric == 'Avg Redirection Time' || metric == 'Avg Server Response Time' || metric == 'Avg Page Download Time' || metric == 'Duration' ? 'Average: ' + colSum : metric == 'Percent New Sessions' || metric == 'Bounce Rate' || metric == 'Transactions Per Session' ? 'Average: ' + colSum + '%': 'Total: ' + colSum;
|
2844 |
-
if(colSum != ""){
|
2845 |
-
gawd_datatable_footer(sum);
|
2846 |
-
}
|
2847 |
-
if(metric_compare != 0 || metric_compare != "" ){
|
2848 |
-
|
2849 |
-
var colSum_compare = parseFloat(data_sum_compare_origin).toLocaleString();
|
2850 |
-
if(metric_compare == 'Avg Session Duration' || metric + ' compare' == 'Avg Session Duration compare' || metric_compare == 'Avg Page Load Time' || metric_compare == 'Avg Redirection Time' || metric_compare == 'Avg Server Response Time' || metric_compare == 'Avg Page Download Time' || metric + " compare" == 'Avg Page Load Time compare' || metric + " compare" == 'Avg Redirection Time compare' || metric + " compare" == 'Avg Server Response Time compare' || metric + " compare" == 'Avg Page Download Time compare' || metric_compare == 'Duration'){
|
2851 |
-
colSum_compare = sec_to_normal(colSum_compare);
|
2852 |
-
}
|
2853 |
-
var sum_compare = {};
|
2854 |
-
sum_compare[metric_compare] = metric_compare == 'Duration' || metric_compare == 'Avg Session Duration' || metric_compare == 'Avg Page Load Time' || metric_compare == 'Avg Redirection Time' || metric_compare == 'Avg Server Response Time' || metric_compare == 'Avg Page Download Time' || metric + " compare" == 'Avg Session Duration compare' || metric + " compare" == 'Avg Page Load Time compare' || metric + " compare" == 'Avg Redirection Time compare' || metric + " compare" == 'Avg Server Response Time compare' || metric + " compare" == 'Avg Page Download Time compare' ? 'Average: ' + colSum_compare : metric_compare == 'Percent New Sessions' || metric_compare == 'Bounce Rate' || metric_compare == 'Percent New Sessions compare' || metric_compare == 'Bounce Rate compare' || metric_compare == 'Transactions Per Session compare' || metric_compare == 'Pageviews Per Session' ? 'Average: ' + colSum_compare + '%' : 'Total: ' + colSum_compare;
|
2855 |
-
if(sum_compare != ""){
|
2856 |
-
gawd_datatable_footer(sum_compare);
|
2857 |
-
}
|
2858 |
-
}
|
2859 |
-
}
|
2860 |
-
|
2861 |
-
|
2862 |
-
|
2863 |
-
gawd_data_table = jQuery('.gawd_data_table table').DataTable( {
|
2864 |
-
data: array,
|
2865 |
-
columns: table_columns,
|
2866 |
-
responsive: true,
|
2867 |
-
});
|
2868 |
-
for (type in data[0]) {
|
2869 |
-
if(type != 'No'){
|
2870 |
-
geo_type = type;
|
2871 |
-
break;
|
2872 |
-
}
|
2873 |
-
}
|
2874 |
-
|
2875 |
-
|
2876 |
-
jQuery('#jqgh_griddiv_Language .s-ico').before('<span title="The language settings in your users browsers. Analytics uses the following ISO codes:Language 639 For example: en (English), en-us (English, United States), en-gb (English, Great Britain)" class="lang_info">?</span>');
|
2877 |
-
jQuery('#jqgh_griddiv_Language').tooltip();
|
2878 |
-
jQuery('.ui-search-toolbar th:first-child').css('background-color','#fff');
|
2879 |
-
jQuery('.ui-search-toolbar th:nth-child(2)').css('background-color','#fff');
|
2880 |
-
jQuery('.ui-search-toolbar th:last-child').css('background-color','#fff');
|
2881 |
-
jQuery('.ui-search-toolbar th:first-child table ').hide();
|
2882 |
-
jQuery('.ui-search-toolbar th:last-child table ').hide();
|
2883 |
-
if( jQuery('.ui-search-toolbar th').length >3){
|
2884 |
-
jQuery('.ui-search-toolbar th:nth-child(3)').css('background-color','#fff');
|
2885 |
-
jQuery('.ui-search-toolbar th:nth-child(3) table ').hide();
|
2886 |
-
}
|
2887 |
-
}
|
2888 |
-
function gawd_datatable_formater(colModel , rowObject) {
|
2889 |
-
var col_data = jQuery.map(colModel, function(value, index) {
|
2890 |
-
var col_model_name = value.index;
|
2891 |
-
var col_val;
|
2892 |
-
|
2893 |
-
if (
|
2894 |
-
typeof rowObject['date_period'] !== 'undefined' && rowObject['date_period'] !== '' &&
|
2895 |
-
(col_model_name === 'Week' || col_model_name === 'Week compare' || col_model_name === 'Month' || col_model_name === 'Month compare')
|
2896 |
-
) {
|
2897 |
-
if(col_model_name === 'Week compare' || col_model_name === 'Month compare'){
|
2898 |
-
col_val = rowObject['date_period compare'];
|
2899 |
-
}else{
|
2900 |
-
col_val = rowObject['date_period'];
|
2901 |
-
}
|
2902 |
-
} else {
|
2903 |
-
col_val = rowObject[col_model_name];
|
2904 |
-
}
|
2905 |
-
|
2906 |
-
|
2907 |
-
if(typeof value.formatter != "undefined" && typeof col_val != "undefined"){
|
2908 |
-
var col_value = value.formatter(col_val, {colModel:value}, rowObject);
|
2909 |
-
return col_value;
|
2910 |
-
}else{
|
2911 |
-
if(typeof col_val === "undefined"){
|
2912 |
-
col_val = "";
|
2913 |
-
}
|
2914 |
-
return col_val;
|
2915 |
-
}
|
2916 |
-
});
|
2917 |
-
return col_data;
|
2918 |
-
}
|
2919 |
-
function gawd_datatable_footer(sum) {
|
2920 |
-
jQuery.map(sum, function(value, index) {
|
2921 |
-
var table_footer_element = jQuery(".gawd_data_table table tfoot").find("[data-value='"+index+"']");
|
2922 |
-
table_footer_element.html(value);
|
2923 |
-
});
|
2924 |
-
|
2925 |
-
}
|
2926 |
-
function gawd_draw_analytics_country_type(country_name, geo_type) {
|
2927 |
-
if (jQuery("#gawd_chart_type").val() == 'pie') {
|
2928 |
-
gawd_draw_analytics_country_pie(country_name, geo_type);
|
2929 |
-
} else {
|
2930 |
-
gawd_draw_analytics_country(country_name, geo_type);
|
2931 |
-
}
|
2932 |
-
}
|
2933 |
-
function gawd_draw_analytics_country(country_name, geo_type) {
|
2934 |
-
console.log("ajax3");
|
2935 |
-
if (geo_type == 'Country') {
|
2936 |
-
jQuery('#country_filter_reset').show();
|
2937 |
-
}
|
2938 |
-
jQuery("#gawd_metric_compare").show();
|
2939 |
-
jQuery("#filter_conteiner").show();
|
2940 |
-
jQuery("#chartdiv").show();
|
2941 |
-
var _end_date = (Date.today().add(-1).days()).toString("yyyy-MM-dd");
|
2942 |
-
var start_date_7 = (Date.today().add(-1).days()).add(-7).days().toString("yyyy-MM-dd");
|
2943 |
-
var start_end_date = typeof jQuery('#gawd_start_end_date').val() != 'undefined' ? jQuery('#gawd_start_end_date').val() : start_date_7 + '/-/' + _end_date;
|
2944 |
-
|
2945 |
-
var start_end_date = start_end_date.split('/-/');
|
2946 |
-
var start_date = start_end_date[0];
|
2947 |
-
var end_date = start_end_date[1];
|
2948 |
-
var country_filter = country_name;
|
2949 |
-
metrics = [];
|
2950 |
-
var metric = jQuery("#gawd_metric").val();
|
2951 |
-
var metric_compare = jQuery("#gawd_metric_compare").val();
|
2952 |
-
metrics.push("ga:" + metric);
|
2953 |
-
if (metric_compare != 0) {
|
2954 |
-
metrics.push("ga:" + metric_compare);
|
2955 |
-
}
|
2956 |
-
if (jQuery("#gawd_chart_type").val() == 'line') {
|
2957 |
-
var chartType = 'line';
|
2958 |
-
var fillAlphas = 0;
|
2959 |
-
} else if (jQuery("#gawd_chart_type").val() == 'column') {
|
2960 |
-
var chartType = 'column';
|
2961 |
-
var fillAlphas = 1;
|
2962 |
-
}
|
2963 |
-
var dimension = country_filter == 'United States' ? 'Region' : 'City';
|
2964 |
-
var dimension_export = dimension;
|
2965 |
-
var metric_export = metric;
|
2966 |
-
var metric_compare_export = metric_compare == 0 ? '' : metric_compare;
|
2967 |
-
var parseDates = false;
|
2968 |
-
var rotateAngle = 90;
|
2969 |
-
var chartscrollbar = false;
|
2970 |
-
console.log("ajax12");
|
2971 |
-
jQuery.post(gawd_admin.ajaxurl, {
|
2972 |
-
action: 'show_data',
|
2973 |
-
start_date: start_date,
|
2974 |
-
end_date: end_date,
|
2975 |
-
metric: metrics,
|
2976 |
-
dimension: dimension,
|
2977 |
-
country_filter: country_filter,
|
2978 |
-
security: gawd_admin.ajaxnonce,
|
2979 |
-
geo_type: geo_type,
|
2980 |
-
beforeSend: function () {
|
2981 |
-
jQuery('#opacity_div').show();
|
2982 |
-
jQuery('#loading_div').show();
|
2983 |
-
}
|
2984 |
-
}).done(function (data) {
|
2985 |
-
jQuery('#opacity_div').hide();
|
2986 |
-
jQuery('#loading_div').hide();
|
2987 |
-
var result = JSON.parse(data).chart_data;
|
2988 |
-
jQuery("#chartdiv").show();
|
2989 |
-
metric = metric.replace(/([A-Z])/g, " $1").trim();
|
2990 |
-
metric = metric.charAt(0).toUpperCase() + metric.slice(1);
|
2991 |
-
metric = metric.replace(/ +/g, ' ');
|
2992 |
-
metric_compare = metric_compare.replace(/([A-Z])/g, " $1").trim();
|
2993 |
-
metric_compare = metric_compare.charAt(0).toUpperCase() + metric_compare.slice(1);
|
2994 |
-
metric_compare = metric_compare.replace(/ +/g, ' ');
|
2995 |
-
dimension = dimension.replace(/([A-Z])/g, " $1").trim();
|
2996 |
-
dimension = dimension.charAt(0).toUpperCase() + dimension.slice(1);
|
2997 |
-
filter_type = '';
|
2998 |
-
var tab_name = window.location.href.split('tab=');
|
2999 |
-
|
3000 |
-
d_start_date = start_date;
|
3001 |
-
d_end_date = end_date;
|
3002 |
-
d_metric_export = metric_export;
|
3003 |
-
d_metric_compare_export = metric_compare_export;
|
3004 |
-
d_dimension_export = dimension_export;
|
3005 |
-
|
3006 |
-
d_tab_name = tab_name;
|
3007 |
-
d_filter_type = filter_type;
|
3008 |
-
d_country_filter = country_name;
|
3009 |
-
d_geo_type = geo_type;
|
3010 |
-
/* jQuery("#gbox_griddiv").remove();
|
3011 |
-
var grid = '<table id="griddiv"></table>';
|
3012 |
-
jQuery('.gawd_chart_conteiner').append(grid); */
|
3013 |
-
jQuery("#gbox_griddiv").remove();
|
3014 |
-
var grid = '<table id="griddiv"></table><div id="pager"></div>';
|
3015 |
-
jQuery('.gawd_chart_conteiner').append(grid);
|
3016 |
-
gawd_draw_table(data, metric, metric_compare, dimension);
|
3017 |
-
})
|
3018 |
-
}
|
3019 |
-
|
3020 |
-
function gawd_draw_analytics_country_pie(country_name, geo_type) {
|
3021 |
-
if (geo_type == 'Country') {
|
3022 |
-
jQuery('#country_filter_reset').show();
|
3023 |
-
}
|
3024 |
-
jQuery("#gawd_metric_compare").show();
|
3025 |
-
jQuery("#filter_conteiner").show();
|
3026 |
-
jQuery("#chartdiv").show();
|
3027 |
-
var _end_date = (Date.today().add(-1).days()).toString("yyyy-MM-dd");
|
3028 |
-
var start_date_7 = (Date.today().add(-1).days()).add(-7).days().toString("yyyy-MM-dd");
|
3029 |
-
var start_end_date = typeof jQuery('#gawd_start_end_date').val() != 'undefined' ? jQuery('#gawd_start_end_date').val() : start_date_7 + '/-/' + _end_date;
|
3030 |
-
|
3031 |
-
var start_end_date = start_end_date.split('/-/');
|
3032 |
-
var start_date = start_end_date[0];
|
3033 |
-
var end_date = start_end_date[1];
|
3034 |
-
var country_filter = country_name;
|
3035 |
-
metrics = [];
|
3036 |
-
var metric = jQuery("#gawd_metric").val();
|
3037 |
-
var metric_compare = jQuery("#gawd_metric_compare").val();
|
3038 |
-
metrics.push("ga:" + metric);
|
3039 |
-
if (metric_compare != 0) {
|
3040 |
-
metrics.push("ga:" + metric_compare);
|
3041 |
-
}
|
3042 |
-
if (jQuery("#gawd_chart_type").val() == 'line') {
|
3043 |
-
var chartType = 'line';
|
3044 |
-
var fillAlphas = 0;
|
3045 |
-
} else if (jQuery("#gawd_chart_type").val() == 'column') {
|
3046 |
-
var chartType = 'column';
|
3047 |
-
var fillAlphas = 1;
|
3048 |
-
}
|
3049 |
-
var dimension = country_filter == 'United States' ? 'Region' : 'City';
|
3050 |
-
|
3051 |
-
var parseDates = false;
|
3052 |
-
var rotateAngle = 90;
|
3053 |
-
var chartscrollbar = false;
|
3054 |
-
console.log("ajax01");
|
3055 |
-
jQuery.post(gawd_admin.ajaxurl, {
|
3056 |
-
action: 'show_data',
|
3057 |
-
start_date: start_date,
|
3058 |
-
end_date: end_date,
|
3059 |
-
metric: metrics,
|
3060 |
-
dimension: dimension,
|
3061 |
-
country_filter: country_filter,
|
3062 |
-
security: gawd_admin.ajaxnonce,
|
3063 |
-
geo_type: geo_type,
|
3064 |
-
beforeSend: function () {
|
3065 |
-
jQuery('#opacity_div').show();
|
3066 |
-
jQuery('#loading_div').show();
|
3067 |
-
}
|
3068 |
-
}).done(function (data) {
|
3069 |
-
jQuery('#opacity_div').hide();
|
3070 |
-
jQuery('#loading_div').hide();
|
3071 |
-
var result = JSON.parse(data).chart_data;
|
3072 |
-
jQuery("#chartdiv").show();
|
3073 |
-
var dimension_export = dimension;
|
3074 |
-
var metric_export = metric;
|
3075 |
-
metric = metric.replace(/([A-Z])/g, " $1").trim();
|
3076 |
-
metric = metric.charAt(0).toUpperCase() + metric.slice(1);
|
3077 |
-
metric = metric.replace(/ +/g, ' ');
|
3078 |
-
var metric_compare_export = '';
|
3079 |
-
var filter_type = '';
|
3080 |
-
|
3081 |
-
//CANVAS//
|
3082 |
-
var tab_name = window.location.href.split('tab=');
|
3083 |
-
if (tab_name[1] != 'pagePath' && tab_name[1] != 'daysToTransaction') {
|
3084 |
-
var svg = document.getElementsByTagName('svg')[0];
|
3085 |
-
var canvas = document.getElementById("canvass");
|
3086 |
-
draw_canvas(svg, canvas);
|
3087 |
-
url = canvas.toDataURL();
|
3088 |
-
}
|
3089 |
-
if (typeof url == 'undefined') {
|
3090 |
-
url = '';
|
3091 |
-
}
|
3092 |
-
//CANVAS URL//
|
3093 |
-
var tab_name = window.location.href.split('tab=');
|
3094 |
-
|
3095 |
-
d_start_date = start_date;
|
3096 |
-
d_end_date = end_date;
|
3097 |
-
d_metric_export = metric_export;
|
3098 |
-
d_metric_compare_export = metric_compare_export;
|
3099 |
-
d_dimension_export = dimension_export;
|
3100 |
-
d_tab_name = tab_name;
|
3101 |
-
d_filter_type = filter_type;
|
3102 |
-
d_country_filter = country_name;
|
3103 |
-
d_geo_type = geo_type;
|
3104 |
-
jQuery("#gbox_griddiv").remove();
|
3105 |
-
var grid = '<table id="griddiv"></table><div id="pager"></div>';
|
3106 |
-
jQuery('.gawd_chart_conteiner').append(grid);
|
3107 |
-
gawd_draw_table(data, metric, metric_compare, dimension);
|
3108 |
-
})
|
3109 |
-
}
|
3110 |
-
function gawd_datepicker_main(start, end) {
|
3111 |
-
jQuery('#reportrange span').html(start.format('Y-MM-DD') + ' - ' + end.format('Y-MM-DD'));
|
3112 |
-
jQuery('#gawd_start_end_date').val(start.format('Y-MM-DD') + '/-/' + end.format('Y-MM-DD'));
|
3113 |
-
gawd_chart_type();
|
3114 |
-
}
|
3115 |
-
|
3116 |
-
function change_account(that) {
|
3117 |
-
jQuery('#web_property_name').val(jQuery(that).find(':selected').closest('optgroup').attr('label'));
|
3118 |
-
jQuery('#gawd_view').submit();
|
3119 |
-
}
|
3120 |
-
function gawd_tracking_display_manage() {
|
3121 |
-
hljs.configure({useBR: true});
|
3122 |
-
jQuery(document).ready(function () {
|
3123 |
-
jQuery('div code').each(function (i, block) {
|
3124 |
-
hljs.highlightBlock(block);
|
3125 |
-
});
|
3126 |
-
});
|
3127 |
-
jQuery('.gawd_tracking .onoffswitch-checkbox').on('change', function () {
|
3128 |
-
var name = jQuery(this).attr('name');
|
3129 |
-
var checked = jQuery(this).attr('checked');
|
3130 |
-
if ('checked' == checked) {
|
3131 |
-
jQuery('#' + name + '_code').show();
|
3132 |
-
} else {
|
3133 |
-
jQuery('#' + name + '_code').hide();
|
3134 |
-
}
|
3135 |
-
});
|
3136 |
-
jQuery('#gawd_tracking_enable').on('change', function() {
|
3137 |
-
checked = (jQuery(this).attr('checked'));
|
3138 |
-
if (checked == 'checked') {
|
3139 |
-
jQuery('.independent_switch').each(function() {
|
3140 |
-
jQuery(this).removeClass('onoffswitch_disabled');
|
3141 |
-
});
|
3142 |
-
jQuery('.independent_input').each(function() {
|
3143 |
-
jQuery(this).removeAttr('disabled');
|
3144 |
-
});
|
3145 |
-
} else {
|
3146 |
-
jQuery('.independent_switch').each(function() {
|
3147 |
-
jQuery(this).addClass('onoffswitch_disabled');
|
3148 |
-
});
|
3149 |
-
jQuery('.independent_input').each(function() {
|
3150 |
-
jQuery(this).attr('disabled','disabled');
|
3151 |
-
});
|
3152 |
-
}
|
3153 |
-
});
|
3154 |
-
}
|
3155 |
-
|
3156 |
-
|
3157 |
-
jQuery(document).ready(function () {
|
3158 |
-
jQuery("#gawd_refresh_management_accounts").on('click', function (e) {
|
3159 |
-
e.preventDefault();
|
3160 |
-
gawd_refresh_management_accounts();
|
3161 |
-
return false;
|
3162 |
-
});
|
3163 |
-
|
3164 |
-
jQuery('#gawd_add_property').on('click', function(e){
|
3165 |
-
e.preventDefault();
|
3166 |
-
|
3167 |
-
var property_name = jQuery('#gawd_property_name').val();
|
3168 |
-
|
3169 |
-
jQuery("#gawd_property_name").removeClass('gawd_invalid')
|
3170 |
-
if (property_name == '') {
|
3171 |
-
jQuery("#gawd_property_name").addClass('gawd_invalid');
|
3172 |
-
return false;
|
3173 |
-
}
|
3174 |
-
|
3175 |
-
var args = gawd_custom_ajax_args();
|
3176 |
-
args.type = 'POST';
|
3177 |
-
args.async = true;
|
3178 |
-
args.data.gawd_action = "add_property";
|
3179 |
-
args.data.gawd_data = {
|
3180 |
-
"gawd_account_select": jQuery('.gawd_account_select').val(),
|
3181 |
-
"gawd_property_name": property_name
|
3182 |
-
};
|
3183 |
-
|
3184 |
-
var $loader_container = jQuery("#gawd_right_conteiner");
|
3185 |
-
args.beforeSend = function () {
|
3186 |
-
gawd_add_loader($loader_container);
|
3187 |
-
};
|
3188 |
-
|
3189 |
-
args.success = function (response) {
|
3190 |
-
window.location.reload();
|
3191 |
-
};
|
3192 |
-
|
3193 |
-
args.error = function () {
|
3194 |
-
window.location.reload();
|
3195 |
-
};
|
3196 |
-
|
3197 |
-
jQuery.ajax(args).done(function () {
|
3198 |
-
gawd_remove_loader($loader_container);
|
3199 |
-
});
|
3200 |
-
|
3201 |
-
});
|
3202 |
-
|
3203 |
-
jQuery('#gawd_choose_property').on('click', function(e){
|
3204 |
-
e.preventDefault();
|
3205 |
-
|
3206 |
-
var $el = jQuery(".gawd_property_select")
|
3207 |
-
var property_val = $el.val();
|
3208 |
-
|
3209 |
-
if(property_val === '0'){
|
3210 |
-
$el.addClass('gawd_invalid');
|
3211 |
-
return false;
|
3212 |
-
}
|
3213 |
-
|
3214 |
-
var args = gawd_custom_ajax_args();
|
3215 |
-
args.type = 'POST';
|
3216 |
-
args.async = true;
|
3217 |
-
args.data.gawd_action = "choose_property";
|
3218 |
-
args.data.gawd_data = {
|
3219 |
-
"gawd_property": property_val
|
3220 |
-
};
|
3221 |
-
|
3222 |
-
var $loader_container = jQuery("#gawd_right_conteiner");
|
3223 |
-
args.beforeSend = function () {
|
3224 |
-
gawd_add_loader($loader_container);
|
3225 |
-
};
|
3226 |
-
|
3227 |
-
args.success = function (response) {
|
3228 |
-
window.location.reload();
|
3229 |
-
};
|
3230 |
-
|
3231 |
-
args.error = function () {
|
3232 |
-
window.location.reload();
|
3233 |
-
};
|
3234 |
-
|
3235 |
-
jQuery.ajax(args).done(function () {
|
3236 |
-
gawd_remove_loader($loader_container);
|
3237 |
-
});
|
3238 |
-
});
|
3239 |
-
|
3240 |
-
jQuery('.gawd_property_select').on('change',function(){
|
3241 |
-
if(jQuery(this).val() === '0'){
|
3242 |
-
jQuery('#gawd_choose_property').addClass('gawd_disabled_button');
|
3243 |
-
}else{
|
3244 |
-
jQuery('#gawd_choose_property').removeClass('gawd_disabled_button');
|
3245 |
-
jQuery(this).removeClass('gawd_invalid');
|
3246 |
-
}
|
3247 |
-
});
|
3248 |
-
|
3249 |
-
jQuery('#gawd_reset_credentials').on('click', function (e) {
|
3250 |
-
e.preventDefault();
|
3251 |
-
|
3252 |
-
var args = gawd_custom_ajax_args();
|
3253 |
-
args.type = 'POST';
|
3254 |
-
args.async = true;
|
3255 |
-
args.data.gawd_action = "delete_credentials";
|
3256 |
-
|
3257 |
-
var $loader_container = jQuery("#wpwrap");
|
3258 |
-
args.beforeSend = function () {
|
3259 |
-
gawd_add_loader($loader_container);
|
3260 |
-
};
|
3261 |
-
|
3262 |
-
args.success = function (response) {
|
3263 |
-
window.location.reload();
|
3264 |
-
};
|
3265 |
-
|
3266 |
-
args.error = function () {
|
3267 |
-
window.location.reload();
|
3268 |
-
};
|
3269 |
-
|
3270 |
-
jQuery.ajax(args).done(function () {
|
3271 |
-
gawd_remove_loader($loader_container);
|
3272 |
-
});
|
3273 |
-
|
3274 |
-
return false;
|
3275 |
-
});
|
3276 |
-
});
|
3277 |
-
|
3278 |
-
function gawd_refresh_user_info(hidden, remove_reports_data,reload) {
|
3279 |
-
|
3280 |
-
hidden = (typeof hidden === 'undefined' || hidden === false) ? false : true;
|
3281 |
-
remove_reports_data = (typeof remove_reports_data === 'undefined' || remove_reports_data === false) ? false : true;
|
3282 |
-
reload = (typeof reload === 'undefined' || reload === false) ? false : true;
|
3283 |
-
|
3284 |
-
var args = gawd_custom_ajax_args();
|
3285 |
-
args.type = 'POST';
|
3286 |
-
args.async = true;
|
3287 |
-
args.data.gawd_action = "refresh_user_info";
|
3288 |
-
args.data.gawd_data = {
|
3289 |
-
'add_notice': (hidden === true) ? '0' : '1',
|
3290 |
-
'remove_reports_data': (remove_reports_data === true) ? '1' : '0',
|
3291 |
-
};
|
3292 |
-
|
3293 |
-
var $loader_container = jQuery("#wpcontent");
|
3294 |
-
if (hidden === false) {
|
3295 |
-
args.beforeSend = function () {
|
3296 |
-
gawd_add_loader($loader_container);
|
3297 |
-
};
|
3298 |
-
|
3299 |
-
args.complete = function () {
|
3300 |
-
gawd_remove_loader($loader_container);
|
3301 |
-
};
|
3302 |
-
|
3303 |
-
args.success = function (response) {
|
3304 |
-
if(response.error.code === "no_properties"){
|
3305 |
-
window.location.hash = "#gawd_tracking_tab"
|
3306 |
-
}
|
3307 |
-
window.location.reload();
|
3308 |
-
};
|
3309 |
-
|
3310 |
-
args.error = function () {
|
3311 |
-
window.location.reload();
|
3312 |
-
};
|
3313 |
-
} else {
|
3314 |
-
args.error = function () {
|
3315 |
-
};
|
3316 |
-
|
3317 |
-
if(reload == true){
|
3318 |
-
window.location.reload();
|
3319 |
-
}
|
3320 |
-
}
|
3321 |
-
|
3322 |
-
jQuery.ajax(args);
|
3323 |
-
}
|
3324 |
-
|
3325 |
-
function gawd_refresh_management_accounts() {
|
3326 |
-
var args = gawd_custom_ajax_args();
|
3327 |
-
args.type = 'POST';
|
3328 |
-
args.async = true;
|
3329 |
-
args.data.gawd_action = "refresh_management_accounts";
|
3330 |
-
|
3331 |
-
var $loader_container = jQuery("#wpbody");
|
3332 |
-
args.beforeSend = function () {
|
3333 |
-
gawd_add_loader($loader_container);
|
3334 |
-
};
|
3335 |
-
|
3336 |
-
args.success = function (response) {
|
3337 |
-
if(response.success === true){
|
3338 |
-
gawd_refresh_user_info(true, true, true);
|
3339 |
-
}else{
|
3340 |
-
window.location.reload();
|
3341 |
-
}
|
3342 |
-
};
|
3343 |
-
|
3344 |
-
args.error = function () {
|
3345 |
-
window.location.reload();
|
3346 |
-
};
|
3347 |
-
|
3348 |
-
jQuery.ajax(args).done(function(){
|
3349 |
-
// gawd_remove_loader($loader_container);
|
3350 |
-
});
|
3351 |
-
}
|
3352 |
-
|
3353 |
-
|
3354 |
-
function gawd_auth_popup(w, h) {
|
3355 |
-
var left = (screen.width / 2) - (w / 2);
|
3356 |
-
var top = (screen.height / 8);
|
3357 |
-
jQuery('#gawd_auth_code').show();
|
3358 |
-
jQuery('.auth_description').hide();
|
3359 |
-
jQuery('#gawd_auth_url').hide();
|
3360 |
-
jQuery('.gawd_submit').hide();
|
3361 |
-
|
3362 |
-
var ajax_args = gawd_custom_ajax_args();
|
3363 |
-
ajax_args.data.gawd_action = "get_auth_url";
|
3364 |
-
ajax_args.success = function (response) {
|
3365 |
-
var url = response.data.url;
|
3366 |
-
window.open(url, 'gawd_auth_window', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
|
3367 |
-
|
3368 |
-
jQuery('#gawd_auth_code_submit').on('click', function () {
|
3369 |
-
gawd_auth_ajax();
|
3370 |
-
});
|
3371 |
-
|
3372 |
-
jQuery('#gawd_token').bind("enterKey", function (e) {
|
3373 |
-
if (jQuery('#gawd_token').val() != '') {
|
3374 |
-
gawd_auth_ajax();
|
3375 |
-
}
|
3376 |
-
});
|
3377 |
-
|
3378 |
-
jQuery('#gawd_token').keyup(function (e) {
|
3379 |
-
if (e.keyCode == 13) {
|
3380 |
-
jQuery(this).trigger("enterKey");
|
3381 |
-
}
|
3382 |
-
});
|
3383 |
-
|
3384 |
-
};
|
3385 |
-
|
3386 |
-
ajax_args.error = function () {
|
3387 |
-
//window.location.reload();
|
3388 |
-
};
|
3389 |
-
|
3390 |
-
jQuery.ajax(ajax_args);
|
3391 |
-
}
|
3392 |
-
|
3393 |
-
function gawd_auth_ajax() {
|
3394 |
-
var args = gawd_custom_ajax_args();
|
3395 |
-
args.type = 'POST';
|
3396 |
-
args.async = true;
|
3397 |
-
args.data.gawd_action = "authenticate";
|
3398 |
-
args.data.gawd_data = {'token': jQuery('#gawd_token').val()};
|
3399 |
-
|
3400 |
-
var $loader_container = jQuery(".gawd_auth_authenticate");
|
3401 |
-
args.beforeSend = function () {
|
3402 |
-
gawd_add_loader($loader_container);
|
3403 |
-
};
|
3404 |
-
|
3405 |
-
args.success = function (response) {
|
3406 |
-
|
3407 |
-
if(response.success === false){
|
3408 |
-
window.location.reload();
|
3409 |
-
return false;
|
3410 |
-
}
|
3411 |
-
|
3412 |
-
if (typeof response.data.redirect !== 'undefined') {
|
3413 |
-
if (response.data.redirect === "tracking_tab") {
|
3414 |
-
window.location.href += "#gawd_tracking_tab";
|
3415 |
-
window.location.reload();
|
3416 |
-
} else if (response.data.redirect === "dashboard") {
|
3417 |
-
window.location.href = gawd_admin.wp_admin_url + "admin.php?page=gawd_analytics";
|
3418 |
-
} else {
|
3419 |
-
window.location.reload();
|
3420 |
-
}
|
3421 |
-
}
|
3422 |
-
|
3423 |
-
window.location.reload();
|
3424 |
-
};
|
3425 |
-
|
3426 |
-
args.error = function (response) {
|
3427 |
-
window.location.reload();
|
3428 |
-
};
|
3429 |
-
|
3430 |
-
jQuery.ajax(args).done(function () {
|
3431 |
-
gawd_remove_loader($loader_container);
|
3432 |
-
});
|
3433 |
-
}
|
3434 |
-
|
3435 |
-
function gawd_widget_real_time(chart_id) {
|
3436 |
-
|
3437 |
-
var args = gawd_custom_ajax_args();
|
3438 |
-
args.type = 'POST';
|
3439 |
-
args.async = true;
|
3440 |
-
args.data.gawd_action = "get_real_time_data";
|
3441 |
-
|
3442 |
-
args.beforeSend = function() {
|
3443 |
-
jQuery('#opacity_div').show();
|
3444 |
-
jQuery('#loading_div').show();
|
3445 |
-
jQuery(chart_id).closest(".postbox").find('.opacity_div_compact').show();
|
3446 |
-
jQuery(chart_id).closest(".postbox").find('.loading_div_compact').show();
|
3447 |
-
};
|
3448 |
-
|
3449 |
-
args.success = function (data) {
|
3450 |
-
|
3451 |
-
if(data.success === false){
|
3452 |
-
gawd_add_notice(data, chart_id);
|
3453 |
-
return;
|
3454 |
-
}
|
3455 |
-
|
3456 |
-
var result = data.data.real_time_data;
|
3457 |
-
jQuery(chart_id).empty();
|
3458 |
-
jQuery("#gawd_right_conteiner").find('#gbox_griddiv').remove();
|
3459 |
-
var grid = '<table id="griddiv"></table><div id="pager"></div>';
|
3460 |
-
jQuery('#gawd_right_conteiner').append(grid);
|
3461 |
-
var array = [];
|
3462 |
-
var desktop = 0;
|
3463 |
-
var mobile = 0;
|
3464 |
-
|
3465 |
-
var country_data = {};
|
3466 |
-
|
3467 |
-
if (typeof result.rows != 'undefined') {
|
3468 |
-
|
3469 |
-
var country = '';
|
3470 |
-
jQuery.each(result.rows, function (index, value) {
|
3471 |
-
country = value[4];
|
3472 |
-
if (typeof country_data[country] == 'undefined') {
|
3473 |
-
country_data[country] = 0;
|
3474 |
-
}
|
3475 |
-
country_data[country] += Number(value[7]);
|
3476 |
-
|
3477 |
-
if (value[6] == 'DESKTOP') {
|
3478 |
-
desktop += Number(value[7]);
|
3479 |
-
} else if (value[6] == 'MOBILE') {
|
3480 |
-
mobile += Number(value[7]);
|
3481 |
-
}
|
3482 |
-
if (typeof array[value[0]] == 'undefined') {
|
3483 |
-
array[value[0]] = Number(value[7]);
|
3484 |
-
} else {
|
3485 |
-
array[value[0]] += Number(value[7]);
|
3486 |
-
}
|
3487 |
-
});
|
3488 |
-
var i = 0;
|
3489 |
-
var sortable = [];
|
3490 |
-
for (var key in array) {
|
3491 |
-
sortable.push([key, array[key]]);
|
3492 |
-
}
|
3493 |
-
sortable.sort(function (a, b) {
|
3494 |
-
return b[1] - a[1]
|
3495 |
-
});
|
3496 |
-
array = [];
|
3497 |
-
for (var j = 0; j < sortable.length; j++) {
|
3498 |
-
var row = {};
|
3499 |
-
row.No = (j + 1);
|
3500 |
-
row["Active Page"] = sortable[j][0];
|
3501 |
-
row["Active Users"] = sortable[j][1];
|
3502 |
-
array.push(row);
|
3503 |
-
}
|
3504 |
-
|
3505 |
-
var realtime_cont = '<div class="gawd_realtime_conteiner">' + (mobile + desktop) + '</div><div class="device_type"></div><div class="gawd_table_conteiner">';
|
3506 |
-
|
3507 |
-
} else {
|
3508 |
-
var realtime_cont = '<div class="gawd_realtime_conteiner">' + 0 + '</div>';
|
3509 |
-
}
|
3510 |
-
if (chart_id != "#chart_widget" && chart_id != "#gawd_real_time_meta") {
|
3511 |
-
var refresh_button = '<input class="button_gawd" type="button" id="gawd_real_time_refresh_button" value="Refresh" />';
|
3512 |
-
var d = (desktop !== 0) ? Math.round((desktop / (desktop + mobile)) * 100) : 0;
|
3513 |
-
var m = (mobile != 0) ? (100 - d) : 0;
|
3514 |
-
|
3515 |
-
var desktop_color = '#ed561b';
|
3516 |
-
var mobile_color = '#50b432';
|
3517 |
-
|
3518 |
-
var desktop_modile_bar = '';
|
3519 |
-
desktop_modile_bar += '<div>';
|
3520 |
-
|
3521 |
-
if (d != 0 || m != 0) {
|
3522 |
-
var bar_html = '<div class="realtime_bar">';
|
3523 |
-
var bar_color_html = '<div class="realtime_colors">';
|
3524 |
-
if (d != 0) {
|
3525 |
-
bar_color_html += '<span>';
|
3526 |
-
bar_color_html += '<em style="background-color:' + desktop_color + '"></em>';
|
3527 |
-
bar_color_html += '<span style="padding:6px;">Desktop</span></span>';
|
3528 |
-
|
3529 |
-
bar_html += '<div style="background-color:' + desktop_color + ';width:' + d + '%;">';
|
3530 |
-
bar_html += d + '%' + '</div>';
|
3531 |
-
}
|
3532 |
-
|
3533 |
-
if (m != 0) {
|
3534 |
-
bar_color_html += '<span>';
|
3535 |
-
bar_color_html += '<em style="background-color:' + mobile_color + '"></em>';
|
3536 |
-
bar_color_html += '<span style="padding-left: 6px;">Mobile</span></span>';
|
3537 |
-
|
3538 |
-
bar_html += '<div style="background-color:' + mobile_color + ';width:' + m + '%;">';
|
3539 |
-
bar_html += m + '%' + '</div>';
|
3540 |
-
|
3541 |
-
}
|
3542 |
-
bar_color_html += '</div>';
|
3543 |
-
bar_html += '</div>'
|
3544 |
-
desktop_modile_bar += bar_color_html + bar_html;
|
3545 |
-
}
|
3546 |
-
desktop_modile_bar += '</div>';
|
3547 |
-
|
3548 |
-
|
3549 |
-
jQuery('#chartdiv').css('height', 'auto');
|
3550 |
-
jQuery('#chartdiv').append(refresh_button);
|
3551 |
-
jQuery('#chartdiv').append(realtime_cont);
|
3552 |
-
jQuery('#chartdiv').append(desktop_modile_bar);
|
3553 |
-
|
3554 |
-
if (typeof result.rows != 'undefined') {
|
3555 |
-
jQuery('#chartdiv').append('<div id="realtime_map" style="height:auto;"></div>');
|
3556 |
-
jQuery('#chartdiv').css('margin-bottom', '20px');
|
3557 |
-
jQuery('#chartdiv').css('min-height', '60px');
|
3558 |
-
|
3559 |
-
//show_realtime_map(country_data);
|
3560 |
-
}
|
3561 |
-
gawd_draw_table(array, 'Active Users', 0, 'Active Page')
|
3562 |
-
}
|
3563 |
-
else {
|
3564 |
-
jQuery(chart_id).height('110');
|
3565 |
-
jQuery(chart_id).append(realtime_cont);
|
3566 |
-
jQuery('.gawd_table_conteiner').hide();
|
3567 |
-
}
|
3568 |
-
jQuery("#chart_widget").find('a').remove();
|
3569 |
-
|
3570 |
-
jQuery('#gawd_real_time_refresh_button').on('click', function () {
|
3571 |
-
gawd_widget_real_time('#chartdiv');
|
3572 |
-
});
|
3573 |
-
jQuery('#opacity_div').hide();
|
3574 |
-
jQuery('#loading_div').hide();
|
3575 |
-
jQuery(chart_id).closest(".postbox").find('.opacity_div_compact').hide();
|
3576 |
-
jQuery(chart_id).closest(".postbox").find('.loading_div_compact').hide();
|
3577 |
-
|
3578 |
-
}
|
3579 |
-
jQuery.ajax(args).done(function(){
|
3580 |
-
jQuery('#opacity_div').hide();
|
3581 |
-
jQuery('#loading_div').hide();
|
3582 |
-
jQuery(chart_id).closest(".postbox").find('.opacity_div_compact').hide();
|
3583 |
-
jQuery(chart_id).closest(".postbox").find('.loading_div_compact').hide();
|
3584 |
-
});
|
3585 |
-
}
|
3586 |
-
|
3587 |
-
function do_gawd_ajax(){
|
3588 |
-
|
3589 |
-
var args = gawd_custom_ajax_args();
|
3590 |
-
args.type = 'POST';
|
3591 |
-
args.data.gawd_action = "get_custom_dimensions";
|
3592 |
-
jQuery.ajax(args);
|
3593 |
-
}
|
3594 |
-
|
3595 |
-
function gawd_custom_ajax_args() {
|
3596 |
-
|
3597 |
-
return {
|
3598 |
-
'url': gawd_admin.ajaxurl,
|
3599 |
-
'type': "GET",
|
3600 |
-
'dataType': 'json',
|
3601 |
-
'async': false,
|
3602 |
-
'data': {
|
3603 |
-
'gawd_ajax': '1',
|
3604 |
-
'gawd_nonce': gawd_admin.gawd_custom_ajax_nonce,
|
3605 |
-
'gawd_nonce_data': gawd_admin.gawd_custom_ajax_nonce_data,
|
3606 |
-
'gawd_action': "",
|
3607 |
-
'gawd_data': []
|
3608 |
-
},
|
3609 |
-
success: function (data) {
|
3610 |
-
},
|
3611 |
-
error: function (data) {
|
3612 |
-
}
|
3613 |
-
};
|
3614 |
-
}
|
3615 |
-
|
3616 |
-
function gawd_reload_account() {
|
3617 |
-
jQuery(".gwd_refresh_page").removeClass('gawd_hidden');
|
3618 |
-
}
|
3619 |
-
function gawd_show_authenticate_form() {
|
3620 |
-
jQuery(".gawd_auth_authenticate").removeClass('gawd_hidden');
|
3621 |
-
jQuery(".no_account_content").addClass('gawd_hidden');
|
3622 |
-
}
|
3623 |
-
|
3624 |
-
function gawd_add_loader($container) {
|
3625 |
-
var html = "<div class='gawd_loader_opacity'></div>";
|
3626 |
-
html += "<div class='gawd_loader_container'>" +
|
3627 |
-
"<img src='" + gawd_admin.gawd_plugin_url + "/assets/ajax_loader.gif" + "'/>" +
|
3628 |
-
"</div>";
|
3629 |
-
$container.append(html);
|
3630 |
-
}
|
3631 |
-
|
3632 |
-
function gawd_remove_loader($container) {
|
3633 |
-
$container.find('.gawd_loader_opacity').remove();
|
3634 |
-
$container.find('.gawd_loader_container').remove();
|
3635 |
-
}
|
3636 |
-
|
3637 |
-
|
3638 |
-
function gawd_remove_item(dataKey,hidden){
|
3639 |
-
jQuery('#'+hidden).val(dataKey);
|
3640 |
-
jQuery('#gawd_form').submit();
|
3641 |
-
}
|
3642 |
-
function gawd_search() {
|
3643 |
-
jQuery('.gawd_menu_li').find("ul").show();
|
3644 |
-
var search, not_match = false;
|
3645 |
-
search = jQuery('.gawd_search_input').val();
|
3646 |
-
var search_text = new RegExp(search, "gi");
|
3647 |
-
var Exp = /^[a-z\d\-_\s]+$/gi;
|
3648 |
-
jQuery('.gawd_menu_li').show();
|
3649 |
-
jQuery('.gawd_menu_ul_li').show();
|
3650 |
-
jQuery('.gawd_active_li').closest('ul').show();
|
3651 |
-
if (search.length > 0 && search.match(Exp)) {
|
3652 |
-
jQuery('.gawd_menu_li').each(function (){
|
3653 |
-
var hide = true;
|
3654 |
-
if(jQuery(this).find('.gawd_menu_li_sub').length > 0){
|
3655 |
-
if (jQuery(this).find('.gawd_menu_li_sub').text().search(search_text) < 0 ) {
|
3656 |
-
jQuery(this).find('.gawd_menu_item').each(function (){
|
3657 |
-
if ((jQuery(this).text()).search(search_text) >= 0 ) {
|
3658 |
-
hide = false;
|
3659 |
-
return;
|
3660 |
-
}
|
3661 |
-
});
|
3662 |
-
}
|
3663 |
-
else{
|
3664 |
-
hide = false;
|
3665 |
-
}
|
3666 |
-
}
|
3667 |
-
else{
|
3668 |
-
jQuery(this).find('.gawd_menu_item').each(function (){
|
3669 |
-
if ((jQuery(this).text()).search(search_text) >= 0 ) {
|
3670 |
-
hide = false;
|
3671 |
-
jQuery(this).closest('ul').show();
|
3672 |
-
return;
|
3673 |
-
}
|
3674 |
-
});
|
3675 |
-
}
|
3676 |
-
if(hide){
|
3677 |
-
jQuery(this).hide();
|
3678 |
-
}
|
3679 |
-
/* if ((jQuery(this).text()).search(search_text) < 0 ) {
|
3680 |
-
jQuery(this).closest('li').hide();
|
3681 |
-
}
|
3682 |
-
else{
|
3683 |
-
jQuery(this).closest('li').show();
|
3684 |
-
if(not_match == false){
|
3685 |
-
not_match = true;
|
3686 |
-
}
|
3687 |
-
} */
|
3688 |
-
});
|
3689 |
-
}else{
|
3690 |
-
jQuery('.gawd_menu_li').find("ul").hide();
|
3691 |
-
}
|
3692 |
-
/*
|
3693 |
-
jQuery('.gawd_menu_item').each(function (){
|
3694 |
-
if ((jQuery(this).text()).search(search_text) < 0 ) {
|
3695 |
-
jQuery(this).closest('li').hide();
|
3696 |
-
}
|
3697 |
-
else{
|
3698 |
-
jQuery(this).closest('li').show();
|
3699 |
-
if(not_match == false){
|
3700 |
-
not_match = true;
|
3701 |
-
}
|
3702 |
-
}
|
3703 |
-
});
|
3704 |
-
jQuery('.gawd_menu_li').each(function (){
|
3705 |
-
var t = false;
|
3706 |
-
jQuery(this).find('li').each(function (){
|
3707 |
-
if(jQuery(this).is(':visible')){
|
3708 |
-
t = true;
|
3709 |
-
return;
|
3710 |
-
}
|
3711 |
-
});
|
3712 |
-
if(jQuery(this).find('li ').length >0 && t == false){
|
3713 |
-
jQuery(this).hide();
|
3714 |
-
}
|
3715 |
-
});
|
3716 |
-
*/
|
3717 |
-
if(not_match == false){
|
3718 |
-
|
3719 |
-
}
|
3720 |
-
}
|
3721 |
-
function remove_zoom_message(){
|
3722 |
-
var got_it = jQuery('#gawd_got_it').val();
|
3723 |
-
console.log("ajax12");
|
3724 |
-
jQuery.post(gawd_admin.ajaxurl, {
|
3725 |
-
action: 'remove_zoom_message',
|
3726 |
-
got_it: got_it,
|
3727 |
-
security: gawd_admin.ajaxnonce,
|
3728 |
-
}).done(function (data) {
|
3729 |
-
jQuery('.gawd_zoom_message').remove();
|
3730 |
-
})
|
3731 |
-
}
|
3732 |
-
|
3733 |
-
|
3734 |
-
function get_tab_name() {
|
3735 |
-
var tab_name = window.location.href.split('tab=');
|
3736 |
-
if(typeof tab_name[1] != "undefined"){
|
3737 |
-
return tab_name[1];
|
3738 |
-
}
|
3739 |
}
|
1 |
+
var _data;
|
2 |
+
var data_of_compared;
|
3 |
+
var _data_compare = [];
|
4 |
+
var d_start_date = "";
|
5 |
+
var d_second_start_date = "";
|
6 |
+
var d_second_end_date = "";
|
7 |
+
var d_end_date = "";
|
8 |
+
var d_metric_export = "";
|
9 |
+
var d_metric_compare_export = "";
|
10 |
+
var d_dimension_export = "";
|
11 |
+
var d_tab_name = "";
|
12 |
+
var d_filter_type = "";
|
13 |
+
var d_geo_type = "";
|
14 |
+
var d_country_filter = "";
|
15 |
+
var d_custom = "";
|
16 |
+
var weekdays = new Array(7);
|
17 |
+
weekdays[0] = "Sunday";
|
18 |
+
weekdays[1] = "Monday";
|
19 |
+
weekdays[2] = "Tuesday";
|
20 |
+
weekdays[3] = "Wednesday";
|
21 |
+
weekdays[4] = "Thursday";
|
22 |
+
weekdays[5] = "Friday";
|
23 |
+
weekdays[6] = "Saturday";
|
24 |
+
var monthnames = new Array();
|
25 |
+
monthnames[01] = 'January';
|
26 |
+
monthnames[02] = 'February';
|
27 |
+
monthnames[03] = 'March';
|
28 |
+
monthnames[04] = 'April';
|
29 |
+
monthnames[05] = 'May';
|
30 |
+
monthnames[06] = 'June';
|
31 |
+
monthnames[07] = 'July';
|
32 |
+
monthnames[08] = 'August';
|
33 |
+
monthnames[09] = 'September';
|
34 |
+
monthnames[10] = 'October';
|
35 |
+
monthnames[11] = 'November';
|
36 |
+
monthnames[12] = 'December';
|
37 |
+
var gawd_chart_data = [];
|
38 |
+
var gawd_compare_request_last_args;
|
39 |
+
var gawd_request_last_args;
|
40 |
+
|
41 |
+
function gawd_compare() {
|
42 |
+
console.log("ajax111");
|
43 |
+
jQuery("#gawd_metric_compare").show();
|
44 |
+
jQuery("#filter_conteiner").show();
|
45 |
+
var _end_date = (Date.today().add(-1).days()).toString("yyyy-MM-dd");
|
46 |
+
var start_date_7 = (Date.today().add(-1).days()).add(-7).days().toString("yyyy-MM-dd");
|
47 |
+
var start_end_date_compare = jQuery('#gawd_start_end_date_compare').val().split('/-/');
|
48 |
+
var start_date_compare = start_end_date_compare[0] ? start_end_date_compare[0] : start_date_7;
|
49 |
+
var end_date_compare = start_end_date_compare[1] ? start_end_date_compare[1] : _end_date;
|
50 |
+
if (!start_date_compare && !end_date_compare) {
|
51 |
+
return;
|
52 |
+
}
|
53 |
+
|
54 |
+
var filter_type = jQuery("#gawd_filter_val").val();
|
55 |
+
metrics = [];
|
56 |
+
var metric = jQuery("#gawd_metric").val();
|
57 |
+
var metric_compare = jQuery("#gawd_metric_compare").val();
|
58 |
+
metrics.push("ga:" + metric);
|
59 |
+
if (metric_compare != 0) {
|
60 |
+
metrics.push("ga:" + metric_compare);
|
61 |
+
}
|
62 |
+
|
63 |
+
if (jQuery("#gawd_chart_type").val() == 'line') {
|
64 |
+
var chartType = 'line';
|
65 |
+
var fillAlphas = 0;
|
66 |
+
} else if (jQuery("#gawd_chart_type").val() == 'column') {
|
67 |
+
var chartType = 'column';
|
68 |
+
var fillAlphas = 1;
|
69 |
+
}
|
70 |
+
var dimension = jQuery("#gawd_tab").val();
|
71 |
+
|
72 |
+
if (dimension == 'date') {
|
73 |
+
var parseDates = true;
|
74 |
+
var rotateAngle = 0;
|
75 |
+
} else if (dimension == 'realTime') {
|
76 |
+
jQuery(".filter_conteiner").hide();
|
77 |
+
jQuery("#chartdiv").empty();
|
78 |
+
gawd_widget_real_time();
|
79 |
+
return;
|
80 |
+
} else if (dimension == 'custom') {
|
81 |
+
var custom = jQuery("#gawd_custom_option").val();
|
82 |
+
dimension = custom.substring(3);
|
83 |
+
} else {
|
84 |
+
var parseDates = false;
|
85 |
+
var rotateAngle = 90;
|
86 |
+
}
|
87 |
+
if (filter_type == "week" || filter_type == "month" || filter_type == "hour") {
|
88 |
+
var parseDates = false;
|
89 |
+
}
|
90 |
+
|
91 |
+
var args = gawd_custom_ajax_args();
|
92 |
+
args.type = 'POST';
|
93 |
+
args.async = true;
|
94 |
+
args.data.gawd_action = "gawd_show_data";
|
95 |
+
args.data.gawd_data = {
|
96 |
+
"start_date": start_date_compare,
|
97 |
+
"end_date": end_date_compare,
|
98 |
+
"metric": metrics,
|
99 |
+
"dimension": dimension,
|
100 |
+
"security": gawd_admin.ajaxnonce,
|
101 |
+
"filter_type": filter_type
|
102 |
+
};
|
103 |
+
|
104 |
+
args.beforeSend = function () {
|
105 |
+
jQuery('#opacity_div').show();
|
106 |
+
jQuery('#loading_div').show();
|
107 |
+
};
|
108 |
+
|
109 |
+
jQuery.ajax(args).done(function (data) {
|
110 |
+
gawd_compare_request_last_args = args;
|
111 |
+
jQuery('#compare_datepicker_wraper').css('background-color','#4F9A55');
|
112 |
+
jQuery('#opacity_div').hide();
|
113 |
+
jQuery('#loading_div').hide();
|
114 |
+
var data = JSON.parse(data.data.gawd_reports_data);
|
115 |
+
data_of_compared = data;
|
116 |
+
var data_compare = [];
|
117 |
+
var __data = JSON.parse(JSON.stringify(_data));
|
118 |
+
for (var i = 0; i < __data.chart_data.length; i++) {
|
119 |
+
var row = __data.chart_data[i];
|
120 |
+
|
121 |
+
// var __metrics = Object.keys(row);
|
122 |
+
var __metrics = [];
|
123 |
+
for(key in row){
|
124 |
+
__metrics.push(key);
|
125 |
+
}
|
126 |
+
|
127 |
+
if (typeof data.chart_data[i] != 'undefined') {
|
128 |
+
for (var j = 0; j < __metrics.length; j++) {
|
129 |
+
if (__metrics[j] == "color" || __metrics[j] == "No")
|
130 |
+
continue;
|
131 |
+
if(__metrics[j].indexOf('compare') == -1){
|
132 |
+
row[__metrics[j] + ' compare'] = data.chart_data[i][__metrics[j]];
|
133 |
+
}
|
134 |
+
}
|
135 |
+
}
|
136 |
+
data_compare.push(row);
|
137 |
+
}
|
138 |
+
var data_sum = data.data_sum;
|
139 |
+
var _data_sum = _data.data_sum;
|
140 |
+
var dataSums = {};
|
141 |
+
var d_second_start_date = start_date_compare;
|
142 |
+
var d_second_end_date = end_date_compare;
|
143 |
+
jQuery('#second_end_date').val(end_date_compare);
|
144 |
+
jQuery('#second_start_date').val(start_date_compare);
|
145 |
+
jQuery('#second_data_sum').val(JSON.stringify(data_sum));
|
146 |
+
jQuery('#first_data_sum').val(JSON.stringify(_data_sum));
|
147 |
+
if(dimension == 'pagePath' || dimension == 'landingPagePath'){
|
148 |
+
jQuery('#dimension').val(dimension);
|
149 |
+
jQuery('#second_data').val(JSON.stringify(data.chart_data));
|
150 |
+
jQuery('#first_data').val(JSON.stringify(_data.chart_data));
|
151 |
+
gawd_draw_table_pages_compare(JSON.stringify(_data.chart_data),JSON.stringify(data.chart_data), dimension, data_sum, _data_sum,start_date_compare,end_date_compare);
|
152 |
+
return;
|
153 |
+
}
|
154 |
+
if (dimension != "pagePath" && dimension != "landingPagePath") {
|
155 |
+
|
156 |
+
for (metric in data_sum) {
|
157 |
+
var dataSum = {};
|
158 |
+
dataSum[metric] = _data_sum[metric];
|
159 |
+
dataSum[metric + " compare"] = data_sum[metric];
|
160 |
+
dataSums[metric] = dataSum;
|
161 |
+
}
|
162 |
+
metric = jQuery("#gawd_metric").val();
|
163 |
+
var metric_compare_export = metric + ' compare';
|
164 |
+
metric = metric.replace(/([A-Z])/g, " $1").trim();
|
165 |
+
metric = metric.charAt(0).toUpperCase() + metric.slice(1);
|
166 |
+
metric = metric.replace(/ +/g, ' ');
|
167 |
+
var metric_export = metric;
|
168 |
+
var metric_compare = metric + ' compare';
|
169 |
+
/* metric_compare = metric_compare.replace(/([A-Z])/g, " $1").trim();
|
170 |
+
metric_compare = metric_compare.charAt(0).toUpperCase() + metric_compare.slice(1);
|
171 |
+
metric_compare = metric_compare.replace(/ +/g, ' '); */
|
172 |
+
var percent = (dataSums[metric][metric] - dataSums[metric][metric + " compare"])/dataSums[metric][metric + " compare"]*100;
|
173 |
+
percent = isNaN(percent) ? 0 : isFinite(percent) ? percent : 0;
|
174 |
+
percent = percent.toFixed(2)
|
175 |
+
var metric_value = parseInt(dataSums[metric][metric]).toLocaleString();
|
176 |
+
var metric_compare_value = parseInt(dataSums[metric][metric + " compare"]).toLocaleString();
|
177 |
+
if(metric + " compare" == 'Avg Session Duration compare' || metric + " compare" == 'Avg Page Load Time compare' || metric + " compare" == 'Avg Server Response Time compare' || metric + " compare" == 'Avg Redirection Time compare' || metric + " compare" == 'Avg Page Download Time compare'){
|
178 |
+
metric_compare_value = sec_to_normal(metric_compare_value);
|
179 |
+
}
|
180 |
+
else if(metric + " compare" == 'Percent New Sessions compare' || metric + " compare" == 'Bounce Rate compare'){
|
181 |
+
metric_compare_value = metric_compare_value + '%';
|
182 |
+
}
|
183 |
+
if(metric == 'Avg Session Duration' || metric == 'Avg Page Load Time' || metric == 'Avg Server Response Time' || metric == 'Avg Redirection Time' || metric == 'Avg Page Download Time'){
|
184 |
+
metric_value = sec_to_normal(metric_value);
|
185 |
+
}
|
186 |
+
else if(metric == 'Percent New Sessions' || metric == 'Bounce Rate'){
|
187 |
+
metric_value = metric_value + '%';
|
188 |
+
}
|
189 |
+
//percent = percent.substring(0, percent.indexOf(".") + 2);
|
190 |
+
var percent_color = percent < 0 || metric == 'bounceRate' ? "gawd_red" : "gawd_green";
|
191 |
+
jQuery(".sum_box").remove();
|
192 |
+
jQuery("._sum_box").remove();
|
193 |
+
var sumBox = "<div class='sum_box'>";
|
194 |
+
var metric_title = metric == 'Percent New Sessions' ? '% New Sessions' : metric;
|
195 |
+
sumBox += "<div class='box_left'>";
|
196 |
+
sumBox += "<div class='box_title'>" + metric_title + "</div>";
|
197 |
+
sumBox += "<div class='" + percent_color + "'>" + percent + " % </div>";
|
198 |
+
sumBox += "</div>";
|
199 |
+
sumBox += "<div class='vs_image_small'>";
|
200 |
+
sumBox += "<img src='" + gawd_admin.gawd_plugin_url + "/assets/vs_rev.png'>";
|
201 |
+
sumBox += "</div>";
|
202 |
+
sumBox += "<div class='box_right'>";
|
203 |
+
sumBox += "<div class='box_value'>" + metric_value + "</div>" + "<div class='box_value'>" + metric_compare_value + "</div>";
|
204 |
+
sumBox += "</div>";
|
205 |
+
sumBox += "<div class='clear'></div>";
|
206 |
+
sumBox += "</div>";
|
207 |
+
jQuery('#chartdiv').after(sumBox);
|
208 |
+
if (dimension == 'goals') {
|
209 |
+
dimension = 'date';
|
210 |
+
}
|
211 |
+
jQuery("#chartdiv").show();
|
212 |
+
dimension = dimension == 'date' || dimension == 'siteSpeed' || dimension == 'adsense' || dimension == 'sales_performance' ? filter_type == '' ? 'date' : filter_type : dimension;
|
213 |
+
//dimension = dimension == 'siteSpeed' || dimension == 'adsense' ? 'date' : dimension;
|
214 |
+
var dimension_export = dimension;
|
215 |
+
dimension = dimension.replace(/([A-Z])/g, " $1").trim();
|
216 |
+
dimension = dimension.charAt(0).toUpperCase() + dimension.slice(1);
|
217 |
+
_data_compare = data_compare;
|
218 |
+
var duration = "";
|
219 |
+
var durationUnits = "";
|
220 |
+
if(metric == 'Avg Session Duration'){
|
221 |
+
duration = "ss";
|
222 |
+
durationUnits = {
|
223 |
+
"mm": "m ",
|
224 |
+
"ss": "s"
|
225 |
+
};
|
226 |
+
}
|
227 |
+
|
228 |
+
if (chartType === "line" || chartType === "column") {
|
229 |
+
var chart = new gawd_charts_helper();
|
230 |
+
chart.print_reports_line_chart_compare(
|
231 |
+
gawd_chart_data,
|
232 |
+
data.chart_data,
|
233 |
+
dimension,
|
234 |
+
metric,
|
235 |
+
chartType,
|
236 |
+
'chartdiv'
|
237 |
+
);
|
238 |
+
}
|
239 |
+
|
240 |
+
|
241 |
+
//CANVAS//
|
242 |
+
|
243 |
+
|
244 |
+
var svg = document.getElementsByTagName('svg')[0];
|
245 |
+
var canvas = document.getElementById("canvass");
|
246 |
+
draw_canvas(svg, canvas);
|
247 |
+
url = canvas.toDataURL();
|
248 |
+
//CANVAS URL//
|
249 |
+
var tab_name = window.location.href.split('tab=');
|
250 |
+
|
251 |
+
d_start_date = start_date_compare;
|
252 |
+
d_end_date = end_date_compare;
|
253 |
+
d_metric_export = metric_export;
|
254 |
+
d_metric_compare_export = metric_compare_export;
|
255 |
+
d_dimension_export = dimension_export;
|
256 |
+
d_tab_name = tab_name;
|
257 |
+
d_filter_type = filter_type;
|
258 |
+
|
259 |
+
jQuery("#chartdiv").find('a').hide();
|
260 |
+
jQuery("#gbox_griddiv").remove();
|
261 |
+
var grid = '<table id="griddiv"></table><div id="pager"></div>';
|
262 |
+
jQuery('.gawd_chart_conteiner').append(grid);
|
263 |
+
gawd_draw_table(JSON.stringify(data_compare), metric, metric + ' compare', dimension, dataSums);
|
264 |
+
}
|
265 |
+
})
|
266 |
+
}
|
267 |
+
function gawd_draw_analytics_compact(metric, metric_compare, dimension, chart_type, chart_id) {
|
268 |
+
var _end_date = (Date.today().add(-1).days()).toString("yyyy-MM-dd");
|
269 |
+
var start_date_7 = (Date.today().add(-1).days()).add(-7).days().toString("yyyy-MM-dd");
|
270 |
+
var start_end_date = typeof jQuery('#gawd_start_end_date_compact').val() != 'undefined' ? jQuery('#gawd_start_end_date_compact').val() : start_date_7 + '/-/' + _end_date;
|
271 |
+
|
272 |
+
var start_end_date = start_end_date.split('/-/');
|
273 |
+
var start_date = start_end_date[0];
|
274 |
+
var end_date = start_end_date[1];
|
275 |
+
metrics = [];
|
276 |
+
metrics.push("ga:" + metric);
|
277 |
+
if (metric_compare != 0) {
|
278 |
+
metrics.push("ga:" + metric_compare);
|
279 |
+
}
|
280 |
+
|
281 |
+
if (dimension == 'date') {
|
282 |
+
var parseDates = true;
|
283 |
+
var rotateAngle = 90;
|
284 |
+
} else {
|
285 |
+
var parseDates = false;
|
286 |
+
var rotateAngle = 90;
|
287 |
+
}
|
288 |
+
if (chart_type == 'column') {
|
289 |
+
var fillAlphas = 1;
|
290 |
+
}
|
291 |
+
var timezone = -(new Date().getTimezoneOffset() / 60);
|
292 |
+
console.log("ajax03");
|
293 |
+
var args = gawd_custom_ajax_args();
|
294 |
+
args.type = 'POST';
|
295 |
+
args.async = true;
|
296 |
+
args.data.gawd_action = "gawd_show_data_compact";
|
297 |
+
args.data.gawd_data = {
|
298 |
+
"start_date": start_date,
|
299 |
+
"end_date": end_date,
|
300 |
+
"metric": metrics,
|
301 |
+
"dimension": dimension,
|
302 |
+
"security": gawd_admin.ajaxnonce,
|
303 |
+
"timezone": timezone,
|
304 |
+
};
|
305 |
+
args.beforeSend = function() {
|
306 |
+
jQuery('#' + chart_id).closest(".postbox").find('.opacity_div_compact').show();
|
307 |
+
jQuery('#' + chart_id).closest(".postbox").find('.loading_div_compact').show();
|
308 |
+
};
|
309 |
+
args.success = function (result){
|
310 |
+
|
311 |
+
jQuery('.opacity_div_compact').hide();
|
312 |
+
jQuery('.loading_div_compact').hide();
|
313 |
+
|
314 |
+
if(result.success === false){
|
315 |
+
if(chart_id === "gawd_country_meta" ) {
|
316 |
+
gawd_add_notice(result, '#gawd_overview_location');
|
317 |
+
}else{
|
318 |
+
gawd_add_notice(result, chart_id);
|
319 |
+
}
|
320 |
+
return;
|
321 |
+
}
|
322 |
+
dimension = dimension.replace(/([A-Z])/g, " $1").trim();
|
323 |
+
dimension = dimension.charAt(0).toUpperCase() + dimension.slice(1);
|
324 |
+
metric = metric.replace(/([A-Z])/g, " $1").trim();
|
325 |
+
metric = metric.charAt(0).toUpperCase() + metric.slice(1);
|
326 |
+
metric = metric.replace(/ +/g, ' ');
|
327 |
+
metric_compare = metric_compare.replace(/([A-Z])/g, " $1").trim();
|
328 |
+
metric_compare = metric_compare.charAt(0).toUpperCase() + metric_compare.slice(1);
|
329 |
+
metric_compare = metric_compare.replace(/ +/g, ' ');
|
330 |
+
if(dimension == 'Date'){
|
331 |
+
var data = JSON.parse(result.data.gawd_show_data_compact);
|
332 |
+
var c = '';
|
333 |
+
var duration = "";
|
334 |
+
var durationUnits = "";
|
335 |
+
if(metric == 'Avg Session Duration'){
|
336 |
+
duration = "ss";
|
337 |
+
durationUnits = {
|
338 |
+
"mm": "m ",
|
339 |
+
"ss": "s"
|
340 |
+
};
|
341 |
+
}
|
342 |
+
if (metric_compare != '' && metric_compare != 0) {
|
343 |
+
var _duration = '';
|
344 |
+
var _durationUnits = '';
|
345 |
+
metric_compare = metric_compare.replace(/([A-Z])/g, "$1").trim();
|
346 |
+
metric_compare = metric_compare.charAt(0).toUpperCase() + metric_compare.slice(1);
|
347 |
+
metric_compare = metric_compare.replace(/ +/g, ' ');
|
348 |
+
metric_compare_title = /* ' vs ' + */ metric_compare.charAt(0).toUpperCase() + metric_compare.slice(1) == "Percent New Sessions" ? '% New Sessions' : metric_compare.charAt(0).toUpperCase() + metric_compare.slice(1);
|
349 |
+
if(metric_compare == 'Avg Session Duration'){
|
350 |
+
_duration = "ss";
|
351 |
+
_durationUnits = {
|
352 |
+
"mm": "m ",
|
353 |
+
"ss": "s"
|
354 |
+
};
|
355 |
+
}
|
356 |
+
c = {
|
357 |
+
"id": "g2",
|
358 |
+
"axisAlpha": 0.4,
|
359 |
+
"position": "right",
|
360 |
+
"title": metric_compare_title,
|
361 |
+
"ignoreAxisWidth": false,
|
362 |
+
"duration": _duration,
|
363 |
+
"durationUnits": _durationUnits,
|
364 |
+
'minimum': 0
|
365 |
+
};
|
366 |
+
|
367 |
+
}
|
368 |
+
|
369 |
+
jQuery("#_sum_comp_" + chart_id).remove();
|
370 |
+
jQuery('#_sum_comp_' + chart_id).remove();
|
371 |
+
|
372 |
+
if(typeof data.data_sum != 'undefined'){
|
373 |
+
var float = '';
|
374 |
+
if (metric_compare != '' && metric_compare != 0){
|
375 |
+
float="style='float:left'";
|
376 |
+
var total = data.data_sum[metric_compare];
|
377 |
+
var avg = '';
|
378 |
+
var diff = ((Date.parse(end_date).getTime() - Date.parse(start_date).getTime()) / 3600 / 24 / 1000)+1;
|
379 |
+
var show_hide = 'gawd_show_total';
|
380 |
+
if(metric == 'Bounce Rate' || metric == 'Percent New Sessions' || metric == 'Pageviews Per Session'){
|
381 |
+
avg = parseFloat(total).toFixed(2);
|
382 |
+
if(metric != 'Pageviews Per Session'){
|
383 |
+
avg = avg + '%';
|
384 |
+
}
|
385 |
+
show_hide = 'gawd_hide_total';
|
386 |
+
}
|
387 |
+
else if(metric_compare == 'Avg Session Duration'){
|
388 |
+
avg = sec_to_normal(avg);
|
389 |
+
show_hide = 'gawd_hide_total';
|
390 |
+
}
|
391 |
+
else{
|
392 |
+
//avg = Math.ceil(total/diff);
|
393 |
+
avg = parseFloat(total/diff).toFixed(2);
|
394 |
+
}
|
395 |
+
var percent_color = total == 0 || metric_compare == 'Bounce Rate' ? "gawd_red" : "gawd_green";
|
396 |
+
var sumBox = "<div class='_sum_box' id='_sum_comp_" + chart_id + "'>";
|
397 |
+
metric_compare_title = metric_compare == 'Percent New Sessions' ? '% New Sessions' : metric_compare;
|
398 |
+
sumBox += "<div class='box_metric'>" + metric_compare_title + "</div>"
|
399 |
+
sumBox += "<div class='_box_left " + show_hide + "'>";
|
400 |
+
sumBox += "<div class='box_title'>Total</div>";
|
401 |
+
sumBox += "<div class='" + percent_color + "'>" + parseInt(total).toLocaleString() + "</div>";
|
402 |
+
sumBox += "</div>";
|
403 |
+
|
404 |
+
sumBox += "<div class='_box_right'>";
|
405 |
+
sumBox += "<div class='box_title'>Average</div>";
|
406 |
+
sumBox += "<div class='" + percent_color + "'>" + parseInt(avg).toLocaleString() + "</div>";
|
407 |
+
sumBox += "</div>";
|
408 |
+
sumBox += "<div class='clear'></div>";
|
409 |
+
sumBox += "</div>";
|
410 |
+
sumBox += "<div class='clear'></div>";
|
411 |
+
jQuery('#'+chart_id).after(sumBox);
|
412 |
+
}
|
413 |
+
var total = data.data_sum[metric];
|
414 |
+
|
415 |
+
var avg = '';
|
416 |
+
var diff = ((Date.parse(end_date).getTime() - Date.parse(start_date).getTime()) / 3600 / 24 / 1000)+1;
|
417 |
+
var show_hide = 'gawd_show_total';
|
418 |
+
if(metric == 'Bounce Rate' || metric == 'Percent New Sessions' || metric == 'Pageviews Per Session'){
|
419 |
+
avg = parseFloat(total).toFixed(2);
|
420 |
+
if(metric != 'Pageviews Per Session'){
|
421 |
+
avg = avg + '%';
|
422 |
+
}
|
423 |
+
show_hide = 'gawd_hide_total';
|
424 |
+
}
|
425 |
+
else if(metric == 'Avg Session Duration'){
|
426 |
+
avg = sec_to_normal(avg);
|
427 |
+
show_hide = 'gawd_hide_total';
|
428 |
+
}
|
429 |
+
else{
|
430 |
+
//avg = Math.ceil(total/diff);
|
431 |
+
avg = parseFloat(total/diff).toFixed(2);
|
432 |
+
}
|
433 |
+
var percent_color = total == 0 || metric == 'Bounce Rate' ? "gawd_red" : "gawd_green";
|
434 |
+
jQuery('#_sum_' + chart_id).remove();
|
435 |
+
var sumBox = "<div " + float + " class='_sum_box' id='_sum_" + chart_id + "'>";
|
436 |
+
var metric_title = metric == 'Percent New Sessions' ? '% New Sessions' : metric;
|
437 |
+
sumBox += "<div class='box_metric'>" + metric_title + "</div>"
|
438 |
+
sumBox += "<div class='_box_left " + show_hide + "'>";
|
439 |
+
sumBox += "<div class='box_title'>Total</div>";
|
440 |
+
sumBox += "<div class='" + percent_color + "'>" + parseInt(total).toLocaleString() + "</div>";
|
441 |
+
sumBox += "</div>";
|
442 |
+
|
443 |
+
sumBox += "<div class='_box_right'>";
|
444 |
+
sumBox += "<div class='box_title'>Average</div>";
|
445 |
+
sumBox += "<div class='" + percent_color + "'>" + parseInt(avg).toLocaleString() + "</div>";
|
446 |
+
sumBox += "</div>";
|
447 |
+
sumBox += "<div class='clear'></div>";
|
448 |
+
sumBox += "</div>";
|
449 |
+
jQuery('#'+chart_id).after(sumBox);
|
450 |
+
}
|
451 |
+
|
452 |
+
var chart = new gawd_charts_helper();
|
453 |
+
chart.print_compact_line_chart(data.chart_data, dimension, metric, metric_compare, chart_id);
|
454 |
+
}
|
455 |
+
else{
|
456 |
+
gawd_draw_table(result.data.gawd_show_data_compact, metric, 0, dimension);
|
457 |
+
}
|
458 |
+
};
|
459 |
+
|
460 |
+
args.error = function (data) {
|
461 |
+
jQuery(".opacity_div_compact").hide();
|
462 |
+
jQuery(".loading_div_compact").hide();
|
463 |
+
};
|
464 |
+
|
465 |
+
jQuery.ajax(args);
|
466 |
+
}
|
467 |
+
|
468 |
+
function gawd_draw_analytics() {
|
469 |
+
|
470 |
+
console.log("ajax2");
|
471 |
+
jQuery('#country_filter_reset').hide();
|
472 |
+
jQuery("#metric_compare").show();
|
473 |
+
jQuery(".vs_image").show();
|
474 |
+
jQuery(".sum_box").remove();
|
475 |
+
jQuery("#filter_conteiner").show();
|
476 |
+
//jQuery('#chartdiv').height(700);
|
477 |
+
jQuery("#chartdiv").show();
|
478 |
+
var _end_date = (Date.today().add(-1).days()).toString("yyyy-MM-dd");
|
479 |
+
var start_date_7 = (Date.today().add(-1).days()).add(-7).days().toString("yyyy-MM-dd");
|
480 |
+
var start_end_date = typeof jQuery('#gawd_start_end_date').val() != 'undefined' ? jQuery('#gawd_start_end_date').val() : start_date_7 + '/-/' + _end_date;
|
481 |
+
|
482 |
+
var start_end_date = start_end_date.split('/-/');
|
483 |
+
var start_date = start_end_date[0];
|
484 |
+
var end_date = start_end_date[1];
|
485 |
+
var filter_type = jQuery("#gawd_filter_val").val();
|
486 |
+
var timezone = -(new Date().getTimezoneOffset() / 60);
|
487 |
+
|
488 |
+
metrics = [];
|
489 |
+
var metric = jQuery("#gawd_metric").val();
|
490 |
+
var metric_compare = jQuery("#gawd_metric_compare").val();
|
491 |
+
metrics.push("ga:" + metric);
|
492 |
+
var metric_compare_title = '';
|
493 |
+
if (metric_compare != 0) {
|
494 |
+
metrics.push("ga:" + metric_compare);
|
495 |
+
} else {
|
496 |
+
metric_compare = '';
|
497 |
+
}
|
498 |
+
|
499 |
+
if (jQuery("#gawd_chart_type").val() == 'line') {
|
500 |
+
var chartType = 'line';
|
501 |
+
var fillAlphas = 0;
|
502 |
+
} else if (jQuery("#gawd_chart_type").val() == 'column') {
|
503 |
+
var chartType = 'column';
|
504 |
+
var fillAlphas = 1;
|
505 |
+
}
|
506 |
+
var dimension = jQuery("#gawd_tab").val();
|
507 |
+
var customReport = "";
|
508 |
+
|
509 |
+
if (dimension == 'socialActivityNetworkAction' || dimension == 'socialActivityAction' || dimension == 'socialActivityTagsSummary' || dimension == 'socialActivityPost' || dimension == 'socialActivityTimestamp' || dimension == 'socialActivityUserProfileUrl' || dimension == 'socialActivityContentUrl' || dimension == 'socialActivityUserPhotoUrl' || dimension == 'socialActivityUserHandle' || dimension == 'socialActivityEndorsingUrl' || dimension == 'socialEndorsingUrl' || dimension == 'socialActivityDisplayName') {
|
510 |
+
jQuery('#metric_compare').hide();
|
511 |
+
jQuery('.vs_image').hide();
|
512 |
+
}
|
513 |
+
var parseDates = false;
|
514 |
+
if (dimension == 'date') {
|
515 |
+
parseDates = true;
|
516 |
+
var rotateAngle = 0;
|
517 |
+
} else if (dimension == 'realTime') {
|
518 |
+
jQuery(".filter_conteiner").hide();
|
519 |
+
jQuery("#chartdiv").empty();
|
520 |
+
gawd_widget_real_time("#chartdiv");
|
521 |
+
return;
|
522 |
+
} else if (dimension == 'custom')
|
523 |
+
{
|
524 |
+
|
525 |
+
var custom = jQuery("#gawd_custom_option").val();
|
526 |
+
var not_exist = '<div id="gawd_error">There are no custom dimensions set for current profile.</div>';
|
527 |
+
if(custom === null || typeof custom === 'undefined'){
|
528 |
+
var args = gawd_custom_ajax_args();
|
529 |
+
args.type = 'POST';
|
530 |
+
args.async = true;
|
531 |
+
args.data.gawd_action = "get_custom_dimensions";
|
532 |
+
args.data.gawd_data = {
|
533 |
+
"is_last_viewed_profile": 1,
|
534 |
+
};
|
535 |
+
args.beforeSend = function() {
|
536 |
+
|
537 |
+
};
|
538 |
+
args.success = function (data){
|
539 |
+
if(data.data.length === 0){
|
540 |
+
|
541 |
+
jQuery("#wdi_no_custom_dimensions").css({
|
542 |
+
'display':'block'
|
543 |
+
});
|
544 |
+
jQuery('#chartdiv').append(not_exist);
|
545 |
+
return;
|
546 |
+
|
547 |
+
}
|
548 |
+
else{
|
549 |
+
jQuery("#gawd_custom_option").css({
|
550 |
+
'display':'block'
|
551 |
+
});
|
552 |
+
if(typeof data.data != "undefined"){
|
553 |
+
for(i in data.data){
|
554 |
+
var custom_dimension_el = data.data[i];
|
555 |
+
jQuery("#gawd_custom_option").append("<option value='"+custom_dimension_el['id']+"'>"+custom_dimension_el['name']+"</option>");
|
556 |
+
}
|
557 |
+
}
|
558 |
+
custom = jQuery("#gawd_custom_option").val();
|
559 |
+
if (typeof custom != 'undefined') {
|
560 |
+
dimension = custom.substring(3);
|
561 |
+
}
|
562 |
+
else {
|
563 |
+
if (jQuery('#gawd_error').length <= 0) {
|
564 |
+
jQuery('#chartdiv').append(not_exist);
|
565 |
+
}
|
566 |
+
return;
|
567 |
+
}
|
568 |
+
|
569 |
+
}
|
570 |
+
gawd_show_data_ajax();
|
571 |
+
}
|
572 |
+
args.error = function (data) {
|
573 |
+
jQuery("#wdi_no_custom_dimensions").css({
|
574 |
+
'display':'block'
|
575 |
+
});
|
576 |
+
}
|
577 |
+
jQuery.ajax(args);
|
578 |
+
return;
|
579 |
+
}else{
|
580 |
+
if (typeof custom != 'undefined') {
|
581 |
+
dimension = custom.substring(3);
|
582 |
+
}
|
583 |
+
else {
|
584 |
+
if (jQuery('#gawd_error').length <= 0) {
|
585 |
+
jQuery('#chartdiv').append(not_exist);
|
586 |
+
}
|
587 |
+
return;
|
588 |
+
}
|
589 |
+
gawd_show_data_ajax();
|
590 |
+
return;
|
591 |
+
}
|
592 |
+
/*ajax for custom */
|
593 |
+
}
|
594 |
+
else if(typeof dimension != "undefined" && dimension.indexOf("custom_") > -1){
|
595 |
+
customReport = true;
|
596 |
+
dimension = dimension.substring(7);
|
597 |
+
}
|
598 |
+
else {
|
599 |
+
var rotateAngle = 90;
|
600 |
+
}
|
601 |
+
|
602 |
+
gawd_show_data_ajax();
|
603 |
+
|
604 |
+
function gawd_show_data_ajax() {
|
605 |
+
var args = gawd_custom_ajax_args();
|
606 |
+
args.type = 'POST';
|
607 |
+
args.async = true;
|
608 |
+
args.data.gawd_action = "gawd_show_data";
|
609 |
+
args.data.gawd_data = {
|
610 |
+
"start_date": start_date,
|
611 |
+
"end_date": end_date,
|
612 |
+
"metric": metrics,
|
613 |
+
"dimension": dimension,
|
614 |
+
"security": gawd_admin.ajaxnonce,
|
615 |
+
"filter_type": filter_type,
|
616 |
+
"custom": customReport,
|
617 |
+
"timezone": timezone,
|
618 |
+
};
|
619 |
+
args.beforeSend = function() {
|
620 |
+
jQuery('#opacity_div').show();
|
621 |
+
jQuery('#loading_div').show();
|
622 |
+
};
|
623 |
+
args.success = function (data) {
|
624 |
+
jQuery('#opacity_div').hide();
|
625 |
+
jQuery('#loading_div').hide();
|
626 |
+
|
627 |
+
if(data.success === false){
|
628 |
+
gawd_add_notice(data);
|
629 |
+
return;
|
630 |
+
}
|
631 |
+
gawd_request_last_args = args;
|
632 |
+
data = data.data.gawd_reports_data;
|
633 |
+
|
634 |
+
var result = JSON.parse(data);
|
635 |
+
if (result.error_message != undefined) {
|
636 |
+
var not_exist = '<div id="gawd_error">' + result.error_message + '</div>';
|
637 |
+
if (jQuery('#gawd_error').length < 1) {
|
638 |
+
jQuery('#chartdiv').append(not_exist);
|
639 |
+
}
|
640 |
+
return;
|
641 |
+
}
|
642 |
+
_data = result;
|
643 |
+
|
644 |
+
if (result.chart_data) {
|
645 |
+
result = result.chart_data;
|
646 |
+
}
|
647 |
+
var result_length = result.length;
|
648 |
+
if (filter_type == "week" || filter_type == "month" || filter_type == "hour") {
|
649 |
+
parseDates = false;
|
650 |
+
result_length = 20;
|
651 |
+
}
|
652 |
+
if (dimension == 'goals') {
|
653 |
+
dimension = 'date';
|
654 |
+
}
|
655 |
+
|
656 |
+
if (dimension != "pagePath" && dimension != "landingPagePath" && dimension != "daysToTransaction" && dimension != "transactionId") {
|
657 |
+
jQuery("#chartdiv").show();
|
658 |
+
if (dimension == 'date' || dimension == 'siteSpeed' || dimension == 'adsense' || dimension == 'sales_performance') {
|
659 |
+
jQuery("#compare_time_conteiner").show();
|
660 |
+
var dimension_export = dimension;
|
661 |
+
if (filter_type == '') {
|
662 |
+
dimension = 'date';
|
663 |
+
} else {
|
664 |
+
dimension = filter_type;
|
665 |
+
}
|
666 |
+
dimension = dimension.replace(/([A-Z])/g, " $1").trim().charAt(0).toUpperCase() + dimension.replace(/([A-Z])/g, " $1").trim().slice(1);
|
667 |
+
} else {
|
668 |
+
dimension = dimension.replace(/([A-Z])/g, " $1").trim().charAt(0).toUpperCase() + dimension.replace(/([A-Z])/g, " $1").trim().slice(1);
|
669 |
+
var dimension_export = dimension;
|
670 |
+
}
|
671 |
+
metric = metric.replace(/([A-Z])/g, " $1").trim().charAt(0).toUpperCase() + metric.replace(/([A-Z])/g, " $1").trim().slice(1);
|
672 |
+
metric = metric.replace(/ +/g, ' ');
|
673 |
+
var metric_export = metric;
|
674 |
+
var metric_compare_export = metric_compare;
|
675 |
+
var c ='';
|
676 |
+
gawd_chart_data = result;
|
677 |
+
if (_data_compare.length > 0) {
|
678 |
+
gawd_compare();
|
679 |
+
return;
|
680 |
+
}
|
681 |
+
|
682 |
+
var duration = "";
|
683 |
+
var durationUnits = "";
|
684 |
+
if(metric == 'Avg Session Duration' || metric == 'Avg Session Duration' || metric == 'Duration' || metric == 'Avg Session Duration' || metric == 'Avg Page Load Time' || metric == 'Avg Server Response Time' || metric == 'Avg Redirection Time' || metric == 'Avg Page Download Time'){
|
685 |
+
duration = "ss";
|
686 |
+
durationUnits = {
|
687 |
+
"mm": "m ",
|
688 |
+
"ss": "s"
|
689 |
+
};
|
690 |
+
}
|
691 |
+
if (metric_compare != '') {
|
692 |
+
var _duration = '';
|
693 |
+
var _durationUnits = '';
|
694 |
+
metric_compare = metric_compare.replace(/([A-Z])/g, " $1").trim();
|
695 |
+
metric_compare = metric_compare.charAt(0).toUpperCase() + metric_compare.slice(1);
|
696 |
+
metric_compare = metric_compare.replace(/ +/g, ' ');
|
697 |
+
metric_compare_title = /* ' vs ' + */ metric_compare.charAt(0).toUpperCase() + metric_compare.slice(1) == "Percent New Sessions" ? '% New Sessions' : metric_compare.charAt(0).toUpperCase() + metric_compare.slice(1);
|
698 |
+
|
699 |
+
if(metric_compare == 'Avg Session Duration' || metric_compare == 'Duration' || metric_compare == 'Avg Session Duration' || metric_compare == 'Avg Page Load Time' || metric_compare == 'Avg Server Response Time' || metric_compare == 'Avg Redirection Time' || metric_compare == 'Avg Page Download Time'){
|
700 |
+
_duration = "ss";
|
701 |
+
_durationUnits = {
|
702 |
+
"mm": "m ",
|
703 |
+
"ss": "s"
|
704 |
+
};
|
705 |
+
}
|
706 |
+
c = {
|
707 |
+
"id": "g2",
|
708 |
+
"axisAlpha": 0.4,
|
709 |
+
"position": "right",
|
710 |
+
"title": metric_compare_title,
|
711 |
+
"ignoreAxisWidth": false,
|
712 |
+
"duration": _duration,
|
713 |
+
"durationUnits": _durationUnits,
|
714 |
+
'minimum': 0,
|
715 |
+
"boldLabels": true,
|
716 |
+
"zeroGridAlpha": 1
|
717 |
+
};
|
718 |
+
}
|
719 |
+
jQuery('#_sum_comp_chartdiv').remove();
|
720 |
+
jQuery('#_sum_box').remove();
|
721 |
+
if(typeof _data.data_sum != 'undefined'){
|
722 |
+
var float = '';
|
723 |
+
if(metric_compare != ''){
|
724 |
+
float="style='float:left'";
|
725 |
+
var total = _data.data_sum[metric_compare];
|
726 |
+
var avg = '';
|
727 |
+
var diff = ((Date.parse(end_date).getTime() - Date.parse(start_date).getTime()) / 3600 / 24 / 1000)+1;
|
728 |
+
var show_hide = 'gawd_show_total';
|
729 |
+
if(metric_compare == 'Bounce Rate' || metric_compare == 'Percent New Sessions' || metric_compare == 'Pageviews Per Session'){
|
730 |
+
avg = parseFloat(total).toFixed(2);
|
731 |
+
if(metric_compare != 'Pageviews Per Session'){
|
732 |
+
avg = avg + '%';
|
733 |
+
}
|
734 |
+
show_hide = 'gawd_hide_total';
|
735 |
+
}
|
736 |
+
else if(metric_compare == 'Avg Session Duration' || metric_compare == 'Avg Page Load Time' || metric_compare == 'Avg Server Response Time' || metric_compare == 'Avg Redirection Time' || metric_compare == 'Avg Page Download Time' || metric_compare == 'Duration'){
|
737 |
+
avg = sec_to_normal(total);
|
738 |
+
show_hide = 'gawd_hide_total';
|
739 |
+
}
|
740 |
+
else{
|
741 |
+
//avg = Math.ceil(total/diff);
|
742 |
+
avg = parseFloat(total/diff).toFixed(2);
|
743 |
+
}
|
744 |
+
|
745 |
+
var percent_color = total == 0 || metric_compare == 'Bounce Rate' ? "gawd_red" : "gawd_green";
|
746 |
+
var sumBox = "<div class='_sum_box' id='_sum_comp_chartdiv'>";
|
747 |
+
var metric_compare_title = metric_compare == 'Percent New Sessions' ? '% New Sessions' : metric_compare;
|
748 |
+
sumBox += "<div class='box_metric'>" + metric_compare_title + "</div>"
|
749 |
+
sumBox += "<div class='_box_left " + show_hide + "'>";
|
750 |
+
sumBox += "<div class='box_title'>Total</div>";
|
751 |
+
sumBox += "<div class='" + percent_color + "'>" + parseInt(total).toLocaleString() + "</div>";
|
752 |
+
sumBox += "</div>";
|
753 |
+
|
754 |
+
sumBox += "<div class='_box_right'>";
|
755 |
+
sumBox += "<div class='box_title'>Average</div>";
|
756 |
+
sumBox += "<div class='" + percent_color + "'>" + parseInt(avg).toLocaleString() + "</div>";
|
757 |
+
sumBox += "</div>";
|
758 |
+
sumBox += "<div class='clear'></div>";
|
759 |
+
sumBox += "</div>";
|
760 |
+
sumBox += "<div class='clear'></div>";
|
761 |
+
jQuery('#chartdiv').after(sumBox);
|
762 |
+
}
|
763 |
+
|
764 |
+
var total = _data.data_sum[metric];
|
765 |
+
var avg = '';
|
766 |
+
var diff = ((Date.parse(end_date).getTime() - Date.parse(start_date).getTime()) / 3600 / 24 / 1000)+1;
|
767 |
+
var show_hide = 'gawd_show_total';
|
768 |
+
if(metric == 'Bounce Rate' || metric == 'Percent New Sessions' || metric == 'Pageviews Per Session'){
|
769 |
+
avg = parseFloat(total).toFixed(2);
|
770 |
+
if(metric != 'Pageviews Per Session'){
|
771 |
+
avg = avg + '%';
|
772 |
+
}
|
773 |
+
show_hide = 'gawd_hide_total';
|
774 |
+
}
|
775 |
+
else if(metric == 'Avg Session Duration' || metric == 'Avg Page Load Time' || metric == 'Avg Server Response Time' || metric == 'Avg Redirection Time' || metric == 'Avg Page Download Time' || metric == 'Duration'){
|
776 |
+
avg = sec_to_normal(total);
|
777 |
+
show_hide = 'gawd_hide_total';
|
778 |
+
}
|
779 |
+
else{
|
780 |
+
//avg = Math.ceil(total/diff);
|
781 |
+
avg = parseFloat(total/diff).toFixed(2);
|
782 |
+
}
|
783 |
+
var percent_color = total == 0 || metric == 'Bounce Rate' ? "gawd_red" : "gawd_green";
|
784 |
+
var sumBox = "<div " + float + " class='_sum_box' id='_sum_box'>";
|
785 |
+
var metric_title = metric == 'Percent New Sessions' ? '% New Sessions' : metric;
|
786 |
+
sumBox += "<div class='box_metric'>" + metric_title + "</div>"
|
787 |
+
sumBox += "<div class='_box_left " + show_hide + "'>";
|
788 |
+
sumBox += "<div class='box_title'>Total</div>";
|
789 |
+
sumBox += "<div class='" + percent_color + "'>" + parseInt(total).toLocaleString() + "</div>";
|
790 |
+
sumBox += "</div>";
|
791 |
+
|
792 |
+
sumBox += "<div class='_box_right'>";
|
793 |
+
sumBox += "<div class='box_title'>Average</div>";
|
794 |
+
sumBox += "<div class='" + percent_color + "'>" + parseInt(avg).toLocaleString() + "</div>";
|
795 |
+
sumBox += "</div>";
|
796 |
+
sumBox += "<div class='clear'></div>";
|
797 |
+
sumBox += "</div>";
|
798 |
+
jQuery('#chartdiv').after(sumBox);
|
799 |
+
}
|
800 |
+
|
801 |
+
if (chartType === "line" || chartType === "column") {
|
802 |
+
var chart = new gawd_charts_helper();
|
803 |
+
chart.print_reports_line_chart(result, dimension, metric, metric_compare, chartType, 'chartdiv');
|
804 |
+
}
|
805 |
+
}
|
806 |
+
else {
|
807 |
+
var metric_export = metric;
|
808 |
+
var metric_compare_export = metric_compare;
|
809 |
+
var dimension_export = dimension;
|
810 |
+
jQuery("#chartdiv").hide();
|
811 |
+
//jQuery(".filter_conteiner").hide();
|
812 |
+
jQuery(".filter_conteiner").css({'height': '75px','position': 'relative'});
|
813 |
+
if(typeof jQuery.cookie("collapsed") != 'undefined' && jQuery.cookie("collapsed") == 1){
|
814 |
+
jQuery("#compare_time_conteiner").css({'float': 'none','width': '35%','position': 'absolute','right':'4%',"top": "35px"});
|
815 |
+
jQuery('#compare_datepicker_wraper').width('98.5%');
|
816 |
+
jQuery('.gawd_content').width('50.6%');
|
817 |
+
}
|
818 |
+
else{
|
819 |
+
jQuery("#compare_time_conteiner").css({'float': 'none','width': '36.6%','position': 'absolute','right':'2.3%',"top": "35px"});
|
820 |
+
jQuery('#compare_datepicker_wraper').width('98.5%');
|
821 |
+
}
|
822 |
+
|
823 |
+
jQuery("#date_chart_conteiner").css({'position': 'absolute','float': 'none','right':'0'});
|
824 |
+
jQuery(".gawd_date_filter_container").hide();
|
825 |
+
jQuery("#date_chart_conteiner .gawd_row:first-child").hide();
|
826 |
+
}
|
827 |
+
|
828 |
+
var tab_name = window.location.href.split('tab=');
|
829 |
+
d_start_date = start_date;
|
830 |
+
d_end_date = end_date;
|
831 |
+
d_second_start_date = start_date;
|
832 |
+
d_second_end_date = end_date;
|
833 |
+
d_metric_export = metric_export;
|
834 |
+
d_metric_compare_export = metric_compare_export;
|
835 |
+
d_dimension_export = dimension_export;
|
836 |
+
d_custom = customReport,
|
837 |
+
d_tab_name = tab_name;
|
838 |
+
d_filter_type = filter_type;
|
839 |
+
jQuery("#gbox_griddiv").remove();
|
840 |
+
var grid = '<table id="griddiv"></table><div id="pager"></div>';
|
841 |
+
jQuery('.gawd_chart_conteiner').append(grid);
|
842 |
+
|
843 |
+
if (typeof data_of_compared != 'undefined' && typeof data_of_compared['chart_data'] != 'undefined' && (dimension == "pagePath" || dimension == "landingPagePath")) {
|
844 |
+
gawd_compare();
|
845 |
+
return;
|
846 |
+
}
|
847 |
+
|
848 |
+
gawd_draw_table(data, metric, metric_compare, dimension);
|
849 |
+
}
|
850 |
+
args.error = function (data) {
|
851 |
+
}
|
852 |
+
jQuery.ajax(args).done(function () {
|
853 |
+
jQuery(".opacity_div_compact").hide();
|
854 |
+
jQuery(".loading_div_compact").hide();
|
855 |
+
|
856 |
+
jQuery('#opacity_div').hide();
|
857 |
+
jQuery('#loading_div').hide();
|
858 |
+
});
|
859 |
+
}
|
860 |
+
|
861 |
+
}
|
862 |
+
|
863 |
+
////////
|
864 |
+
jQuery(document).ready(function () {
|
865 |
+
|
866 |
+
jQuery('.gawd_export_button_csv').on('click', function (e) {
|
867 |
+
e.preventDefault();
|
868 |
+
|
869 |
+
var data = gawd_get_report_file_data();
|
870 |
+
data['action'] = 'gawd_create_csv_file';
|
871 |
+
|
872 |
+
|
873 |
+
jQuery.post(gawd_admin.ajaxurl, data ).done(function (response) {
|
874 |
+
response = JSON.parse(response);
|
875 |
+
if(response.success === true){
|
876 |
+
window.location.href =response['data']['download_url'];
|
877 |
+
}
|
878 |
+
|
879 |
+
});
|
880 |
+
|
881 |
+
return false;
|
882 |
+
});
|
883 |
+
|
884 |
+
jQuery('.gawd_export_button_csvs').on('click', function () {
|
885 |
+
|
886 |
+
if (typeof d_tab_name[1] == 'undefined') {
|
887 |
+
d_tab_name[1] = 'general';
|
888 |
+
}
|
889 |
+
/* var location = gawd_admin.exportUrl +
|
890 |
+
'&export_type=csv&gawd_start_date=' + d_start_date +
|
891 |
+
'&gawd_end_date=' + d_end_date +
|
892 |
+
'&gawd_metric=' + d_metric_export +
|
893 |
+
'&gawd_metric_compare=' + d_metric_compare_export +
|
894 |
+
'&gawd_dimension=' + d_dimension_export +
|
895 |
+
'&tab_name=' + d_tab_name[1] +
|
896 |
+
'&filter_type=' + d_filter_type +
|
897 |
+
'&report_type=alert&security=' + gawd_admin.ajaxnonce +
|
898 |
+
'&country_filter=' + d_country_filter +
|
899 |
+
'&geo_type=' + d_geo_type; */
|
900 |
+
|
901 |
+
var order = get_order_data_for_export();
|
902 |
+
|
903 |
+
//location += "&sort=" + order.order + "&sort_by=" + order.order_by;
|
904 |
+
// window.location = location;
|
905 |
+
var data = {
|
906 |
+
action: 'create_csv_file',
|
907 |
+
export_type: 'csv',
|
908 |
+
tab_name: d_tab_name[1],
|
909 |
+
report_type: 'alert',
|
910 |
+
security: gawd_admin.ajaxnonce,
|
911 |
+
sort: order.order,
|
912 |
+
sort_by: order.order_by
|
913 |
+
};
|
914 |
+
|
915 |
+
if(jQuery('#second_data').val() != ''){
|
916 |
+
if(d_tab_name[1] == 'pagePath' || d_tab_name[1] == 'landingPagePath'){
|
917 |
+
data.second_end_date = jQuery('#second_end_date').val();
|
918 |
+
data.second_start_date = jQuery('#second_start_date').val();
|
919 |
+
data.second_data_sum = jQuery('#second_data_sum').val();
|
920 |
+
data.first_data_sum = jQuery('#first_data_sum').val();
|
921 |
+
data.dimension = jQuery('#dimension').val();
|
922 |
+
data.second_data = jQuery('#second_data').val();
|
923 |
+
data.first_data = jQuery('#first_data').val();
|
924 |
+
}
|
925 |
+
}
|
926 |
+
else{
|
927 |
+
data._data_compare = _data_compare;
|
928 |
+
data.second_data_sum = jQuery('#second_data_sum').val(),
|
929 |
+
data.first_data_sum = jQuery('#first_data_sum').val(),
|
930 |
+
data.gawd_start_date = d_start_date,
|
931 |
+
data.gawd_end_date = d_end_date,
|
932 |
+
data.second_end_date = d_second_end_date,
|
933 |
+
data.second_start_date = d_second_start_date,
|
934 |
+
data.gawd_metric = d_metric_export,
|
935 |
+
data.gawd_metric_compare = d_metric_compare_export,
|
936 |
+
data.gawd_dimension = d_dimension_export,
|
937 |
+
data.filter_type = d_filter_type,
|
938 |
+
data.country_filter = d_country_filter,
|
939 |
+
data.geo_type = d_geo_type
|
940 |
+
}
|
941 |
+
console.log("ajax04");
|
942 |
+
jQuery.post(gawd_admin.ajaxurl, data ).done(function (url) {
|
943 |
+
jQuery('#opacity_div').hide();
|
944 |
+
jQuery('#loading_div').hide();
|
945 |
+
|
946 |
+
window.location.href = gawd_admin.exportUrl + '&export_type=csv&report_type=alert&sort=' + order.order + '&sort_by=' + order.order_by+'&security='+gawd_admin.ajaxnonce;
|
947 |
+
});
|
948 |
+
return false;
|
949 |
+
|
950 |
+
});
|
951 |
+
jQuery('.gawd_export_button_pdf').on('click', function () {
|
952 |
+
jQuery('#opacity_div').show();
|
953 |
+
jQuery('#loading_div').show();
|
954 |
+
|
955 |
+
var order = get_order_data_for_export();
|
956 |
+
|
957 |
+
var tab_name = window.location.href.split('tab=');
|
958 |
+
if (typeof tab_name[1] == 'undefined') {
|
959 |
+
tab_name[1] = 'general';
|
960 |
+
}
|
961 |
+
//CANVAS//
|
962 |
+
if (tab_name[1] != 'pagePath' && tab_name[1] != 'landingPagePath' && tab_name[1] != 'daysToTransaction' && tab_name[1] != 'pagePath#' && tab_name[1] != 'landingPagePath#' & tab_name[1] != 'daysToTransaction#') {
|
963 |
+
jQuery('svg').find('desc').remove();
|
964 |
+
var svg = document.getElementsByTagName('svg')[0];
|
965 |
+
var canvas = document.getElementById("canvass");
|
966 |
+
draw_canvas(svg, canvas);
|
967 |
+
url = canvas.toDataURL();
|
968 |
+
}
|
969 |
+
if (typeof url == 'undefined') {
|
970 |
+
url = '';
|
971 |
+
}
|
972 |
+
var data = {
|
973 |
+
action: 'create_pdf_file',
|
974 |
+
export_type: 'pdf',
|
975 |
+
tab_name: tab_name[1],
|
976 |
+
report_type: 'alert',
|
977 |
+
security: gawd_admin.ajaxnonce,
|
978 |
+
sort: order.order,
|
979 |
+
sort_by: order.order_by,
|
980 |
+
gawd_start_date: d_start_date,
|
981 |
+
gawd_end_date: d_end_date
|
982 |
+
};
|
983 |
+
|
984 |
+
if(d_custom) {
|
985 |
+
data.custom = d_custom;
|
986 |
+
}
|
987 |
+
|
988 |
+
if(jQuery('#second_data').val() != ''){
|
989 |
+
if(tab_name[1] == 'pagePath' || tab_name[1] == 'landingPagePath'){
|
990 |
+
data.second_end_date = jQuery('#second_end_date').val();
|
991 |
+
data.second_start_date = jQuery('#second_start_date').val();
|
992 |
+
data.second_data_sum = jQuery('#second_data_sum').val();
|
993 |
+
data.first_data_sum = jQuery('#first_data_sum').val();
|
994 |
+
data.dimension = jQuery('#dimension').val();
|
995 |
+
data.second_data = jQuery('#second_data').val();
|
996 |
+
data.first_data = jQuery('#first_data').val();
|
997 |
+
}
|
998 |
+
}
|
999 |
+
/* else if(_data_compare != ''){
|
1000 |
+
data.img = url;
|
1001 |
+
data._data_compare = _data_compare;
|
1002 |
+
} */
|
1003 |
+
else{
|
1004 |
+
data.img = url;
|
1005 |
+
data._data_compare = _data_compare;
|
1006 |
+
data.second_data_sum = jQuery('#second_data_sum').val(),
|
1007 |
+
data.first_data_sum = jQuery('#first_data_sum').val(),
|
1008 |
+
data.second_end_date = d_second_end_date;
|
1009 |
+
data.second_start_date = d_second_start_date;
|
1010 |
+
data.gawd_metric = d_metric_export,
|
1011 |
+
data.gawd_metric_compare = d_metric_compare_export,
|
1012 |
+
data.gawd_dimension = d_dimension_export,
|
1013 |
+
data.filter_type = d_filter_type,
|
1014 |
+
data.country_filter = d_country_filter,
|
1015 |
+
data.geo_type = d_geo_type
|
1016 |
+
}
|
1017 |
+
console.log("ajax05");
|
1018 |
+
jQuery.post(gawd_admin.ajaxurl, data ).done(function (url) {
|
1019 |
+
|
1020 |
+
jQuery('#opacity_div').hide();
|
1021 |
+
jQuery('#loading_div').hide();
|
1022 |
+
|
1023 |
+
window.location.href = gawd_admin.exportUrl + '&export_type=pdf&report_type=alert';
|
1024 |
+
});
|
1025 |
+
|
1026 |
+
|
1027 |
+
return false;
|
1028 |
+
});
|
1029 |
+
|
1030 |
+
/* FREE */
|
1031 |
+
|
1032 |
+
var pro_features_list = {
|
1033 |
+
'reports': {
|
1034 |
+
title1: 'The free version is limited up to 2 report types.',
|
1035 |
+
title2: 'Upgrade to Premium version to see the rest.',
|
1036 |
+
list: [
|
1037 |
+
'Аdvanced GA reports',
|
1038 |
+
'Ecommerce & AdWords reports',
|
1039 |
+
'Advanced tracking',
|
1040 |
+
// 'AdWords reports',
|
1041 |
+
// 'Google AdSense & AdWords reports',
|
1042 |
+
'Custom reports',
|
1043 |
+
//'Alerts and Pushover Notifications'
|
1044 |
+
]
|
1045 |
+
},
|
1046 |
+
'custom_reports': {
|
1047 |
+
title1: 'Custom reports are not available in free version.',
|
1048 |
+
title2: 'Upgrade to unlock all reports.',
|
1049 |
+
list: [
|
1050 |
+
'Аdvanced GA reports',
|
1051 |
+
'Ecommerce & AdWords reports',
|
1052 |
+
'Advanced tracking',
|
1053 |
+
// 'AdWords reports',
|
1054 |
+
// 'Google AdSense & AdWords reports',
|
1055 |
+
'Custom reports',
|
1056 |
+
//'Alerts and Pushover Notifications'
|
1057 |
+
]
|
1058 |
+
},
|
1059 |
+
'custom_dimensions': {
|
1060 |
+
title1: 'Custom dimensions are not available in free version.',
|
1061 |
+
title2: 'Upgrade to Premium version to configure custom tracking.',
|
1062 |
+
list: [
|
1063 |
+
'Аdvanced GA reports',
|
1064 |
+
'Ecommerce & AdWords reports',
|
1065 |
+
'Advanced tracking',
|
1066 |
+
// 'AdWords reports',
|
1067 |
+
// 'Google AdSense & AdWords reports',
|
1068 |
+
'Custom reports',
|
1069 |
+
//'Alerts and Pushover Notifications'
|
1070 |
+
]
|
1071 |
+
},
|
1072 |
+
'exclude_tracking': {
|
1073 |
+
title1: 'Custom tracking settings are not available.',
|
1074 |
+
title2: 'Upgrade to Premium version to customize tracking.',
|
1075 |
+
list: [
|
1076 |
+
'Аdvanced GA reports',
|
1077 |
+
'Ecommerce & AdWords reports',
|
1078 |
+
'Advanced tracking',
|
1079 |
+
// 'AdWords reports',
|
1080 |
+
// 'Google AdSense & AdWords reports',
|
1081 |
+
'Custom reports',
|
1082 |
+
//'Alerts and Pushover Notifications'
|
1083 |
+
]
|
1084 |
+
}
|
1085 |
+
};
|
1086 |
+
|
1087 |
+
jQuery('.gawd_inactive').each(function () {
|
1088 |
+
var $_this = jQuery(this);
|
1089 |
+
|
1090 |
+
if ($_this.find('.gawd_menu_ul_li').length > 0) {
|
1091 |
+
$_this.find('.gawd_menu_ul_li').on('click', {feature_key: 'reports'}, gawd_open_pro_popup);
|
1092 |
+
} else {
|
1093 |
+
$_this.on('click', {feature_key: 'reports'}, gawd_open_pro_popup);
|
1094 |
+
}
|
1095 |
+
|
1096 |
+
});
|
1097 |
+
|
1098 |
+
jQuery('.gawd_menu_coteiner_collapse .gawd_menu_ul span.gawd_menu_li_sub, .gawd_menu_coteiner_collapse .gawd_menu_ul a.gawd_menu_item').each(function(){
|
1099 |
+
var id = jQuery(this).attr('id');
|
1100 |
+
if(id !== 'gawd_general' && id !== 'gawd_realtime') {
|
1101 |
+
jQuery(this).on('click', {feature_key: 'reports'}, gawd_open_pro_popup);
|
1102 |
+
}
|
1103 |
+
});
|
1104 |
+
|
1105 |
+
jQuery('.gawd_pro_img').each(function(){
|
1106 |
+
var $_this = jQuery(this);
|
1107 |
+
$_this.on('click', {feature_key: $_this.data('gawd-screenshot')}, gawd_open_pro_popup);
|
1108 |
+
});
|
1109 |
+
|
1110 |
+
jQuery('.gawd_pro_popup_close_btn').on('click', gawd_close_pro_popup);
|
1111 |
+
jQuery('.gawd_pro_popup_overlay').on('click', gawd_close_pro_popup);
|
1112 |
+
|
1113 |
+
function gawd_open_pro_popup(args) {
|
1114 |
+
args.preventDefault();
|
1115 |
+
|
1116 |
+
var key = args.data.feature_key;
|
1117 |
+
|
1118 |
+
jQuery('.gawd_pro_popup').find('.gawd_pro_popup_title1').html(pro_features_list[key].title1);
|
1119 |
+
jQuery('.gawd_pro_popup').find('.gawd_pro_popup_title2').html(pro_features_list[key].title2);
|
1120 |
+
|
1121 |
+
var list_html = "";
|
1122 |
+
for (var i in pro_features_list[key].list) {
|
1123 |
+
list_html += "<li>" + pro_features_list[key].list[i] + "</li>";
|
1124 |
+
}
|
1125 |
+
|
1126 |
+
jQuery('.gawd_pro_popup').find('.gawd_pro_popup_content ul').html(list_html);
|
1127 |
+
|
1128 |
+
jQuery('.gawd_pro_popup_overlay').show();
|
1129 |
+
jQuery('.gawd_pro_popup').show();
|
1130 |
+
|
1131 |
+
return false;
|
1132 |
+
}
|
1133 |
+
|
1134 |
+
function gawd_close_pro_popup() {
|
1135 |
+
jQuery('.gawd_pro_popup_overlay').hide();
|
1136 |
+
jQuery('.gawd_pro_popup').hide();
|
1137 |
+
}
|
1138 |
+
/* END FREE*/
|
1139 |
+
});
|
1140 |
+
|
1141 |
+
function gawd_get_report_file_data(){
|
1142 |
+
if (typeof gawd_request_last_args === "undefined") {
|
1143 |
+
return false;
|
1144 |
+
}
|
1145 |
+
|
1146 |
+
var last_args = gawd_request_last_args.data;
|
1147 |
+
var compare_last_args = (typeof gawd_compare_request_last_args !== 'undefined' && typeof gawd_compare_request_last_args.data !== 'undefined') ? gawd_compare_request_last_args.data : null;
|
1148 |
+
|
1149 |
+
var compare_by = (typeof jQuery('#gawd_metric_compare').attr('disabled') === 'undefined') ? "metric" : "date";
|
1150 |
+
if(compare_by === "date"){
|
1151 |
+
var compare_metric_name = jQuery('#gawd_metric_compare').val();
|
1152 |
+
|
1153 |
+
if(last_args.gawd_data.metric.length > 1){
|
1154 |
+
|
1155 |
+
if (last_args.gawd_data.metric[0] === "ga:" + compare_metric_name) {
|
1156 |
+
last_args.gawd_data.metric = [last_args.gawd_data.metric[1]];
|
1157 |
+
} else if (last_args.gawd_data.metric[1] === "ga:" + compare_metric_name) {
|
1158 |
+
last_args.gawd_data.metric = [last_args.gawd_data.metric[0]];
|
1159 |
+
}
|
1160 |
+
|
1161 |
+
}
|
1162 |
+
}
|
1163 |
+
|
1164 |
+
var gawd_daterange = jQuery('.gawd_daterange .ranges li.active').text();
|
1165 |
+
if(gawd_daterange === ""){
|
1166 |
+
gawd_daterange = "Last 30 Days ";
|
1167 |
+
}
|
1168 |
+
|
1169 |
+
var gawd_compare_daterange = jQuery('.gawd_compare_daterange .ranges li.active').text();
|
1170 |
+
if(gawd_compare_daterange === ""){
|
1171 |
+
gawd_compare_daterange = "Previous period";
|
1172 |
+
}
|
1173 |
+
|
1174 |
+
var data = {
|
1175 |
+
security: gawd_admin.ajaxnonce,
|
1176 |
+
gawd_request_last_args: gawd_request_last_args.data,
|
1177 |
+
gawd_compare_request_last_args: (typeof gawd_compare_request_last_args !== 'undefined' && typeof gawd_compare_request_last_args.data !== 'undefined') ? gawd_compare_request_last_args.data : null,
|
1178 |
+
menu_name: jQuery('#gawd_page_title').text().trim(),
|
1179 |
+
compare_by: (typeof jQuery('#gawd_metric_compare').attr('disabled') === 'undefined') ? "metric" : "date",
|
1180 |
+
info: {
|
1181 |
+
'date_ranges': [gawd_daterange, gawd_compare_daterange]
|
1182 |
+
}
|
1183 |
+
};
|
1184 |
+
|
1185 |
+
return data;
|
1186 |
+
}
|
1187 |
+
|
1188 |
+
function get_order_data_for_export() {
|
1189 |
+
var el = jQuery('.ui-jqgrid-htable').find('th[aria-selected="true"]');
|
1190 |
+
if (el.length == 0) {
|
1191 |
+
el = jQuery('.ui-jqgrid-htable').find('th:first');
|
1192 |
+
}
|
1193 |
+
|
1194 |
+
var order_by = el.find('.ui-jqgrid-sortable').text();
|
1195 |
+
var order_el = el.find('span.s-ico').find('span').not('.ui-state-disabled');
|
1196 |
+
if (order_el.length == 0) {
|
1197 |
+
order_el = el.find('span.s-ico:first');
|
1198 |
+
}
|
1199 |
+
var order = order_el.attr('sort');
|
1200 |
+
return {
|
1201 |
+
'order': order,
|
1202 |
+
'order_by': order_by
|
1203 |
+
};
|
1204 |
+
}
|
1205 |
+
function draw_canvas(svg, canvas) {
|
1206 |
+
var serializer = new XMLSerializer();
|
1207 |
+
var svgString = serializer.serializeToString(svg);
|
1208 |
+
canvg(canvas, svgString);
|
1209 |
+
}
|
1210 |
+
function gawd_draw_analytics_widget() {
|
1211 |
+
var end_date = (Date.today().add(-1).days()).toString("yyyy-MM-dd");
|
1212 |
+
var start_date_30 = (Date.today().add(-1).days()).add(-30).days().toString("yyyy-MM-dd");
|
1213 |
+
var start_date_7 = (Date.today().add(-1).days()).days().toString("yyyy-MM-dd");
|
1214 |
+
start_date = typeof jQuery("#gawd_widget_date").val() != 'undefined' ? jQuery("#gawd_widget_date").val() : start_date_7;
|
1215 |
+
var metric = jQuery("#gawd_metric_widget").val();
|
1216 |
+
if (start_date == 'realTime') {
|
1217 |
+
jQuery("#gawd_metric_widget").hide();
|
1218 |
+
gawd_widget_real_time('#chart_widget');
|
1219 |
+
} else {
|
1220 |
+
jQuery("#gawd_metric_widget").show();
|
1221 |
+
gawd_widget_all(start_date, end_date, metric);
|
1222 |
+
}
|
1223 |
+
}
|
1224 |
+
|
1225 |
+
function gawd_widget_all(start_date, end_date, metric) {
|
1226 |
+
jQuery("#chart_widget").empty();
|
1227 |
+
jQuery('#chart_widget').height('300');
|
1228 |
+
jQuery(".opacity_div_compact").show();
|
1229 |
+
jQuery(".loading_div_compact").show();
|
1230 |
+
console.log("ajax06");
|
1231 |
+
var args = gawd_custom_ajax_args();
|
1232 |
+
args.type = 'POST';
|
1233 |
+
args.async = true;
|
1234 |
+
args.data.gawd_action = "gawd_show_data";
|
1235 |
+
args.data.gawd_data = {
|
1236 |
+
"start_date": start_date,
|
1237 |
+
"end_date": end_date,
|
1238 |
+
"metric": metric,
|
1239 |
+
};
|
1240 |
+
args.beforeSend = function () {
|
1241 |
+
|
1242 |
+
};
|
1243 |
+
args.success = function (data) {
|
1244 |
+
jQuery(".opacity_div_compact").hide();
|
1245 |
+
jQuery(".loading_div_compact").hide();
|
1246 |
+
if (data.success === false) {
|
1247 |
+
gawd_add_notice(data, '#chart_widget');
|
1248 |
+
return;
|
1249 |
+
}
|
1250 |
+
gawd_request_last_args = args;
|
1251 |
+
data = data.data.gawd_reports_data;
|
1252 |
+
data = JSON.parse(data);
|
1253 |
+
data = data.chart_data;
|
1254 |
+
metric = metric.replace(/([A-Z])/g, " $1").trim();
|
1255 |
+
metric = metric.charAt(0).toUpperCase() + metric.slice(1);
|
1256 |
+
metric = metric.replace(/ +/g, ' ');
|
1257 |
+
}
|
1258 |
+
args.error = function (data) {
|
1259 |
+
jQuery(".opacity_div_compact").hide();
|
1260 |
+
jQuery(".loading_div_compact").hide();
|
1261 |
+
}
|
1262 |
+
jQuery.ajax(args);
|
1263 |
+
|
1264 |
+
}
|
1265 |
+
function gawd_pie_chart() {
|
1266 |
+
//jQuery("#chart").empty();
|
1267 |
+
console.log('ajax2.5');
|
1268 |
+
var labels_enabled = true;
|
1269 |
+
if(jQuery(window).width()<=750){
|
1270 |
+
labels_enabled = false;
|
1271 |
+
}
|
1272 |
+
jQuery('#country_filter_reset').hide();
|
1273 |
+
jQuery("#metric_compare").hide();
|
1274 |
+
jQuery("#compare_time_conteiner").hide();
|
1275 |
+
jQuery(".vs_image").hide();
|
1276 |
+
var _end_date = (Date.today().add(-1).days()).toString("yyyy-MM-dd");
|
1277 |
+
var start_date_7 = (Date.today().add(-1).days()).add(-7).days().toString("yyyy-MM-dd");
|
1278 |
+
var start_end_date = typeof jQuery('#gawd_start_end_date').val() != 'undefined' ? jQuery('#gawd_start_end_date').val() : start_date_7 + '/-/' + _end_date;
|
1279 |
+
|
1280 |
+
var start_end_date = start_end_date.split('/-/');
|
1281 |
+
var start_date = start_end_date[0];
|
1282 |
+
var end_date = start_end_date[1];
|
1283 |
+
metrics = [];
|
1284 |
+
var metric = jQuery("#gawd_metric").val();
|
1285 |
+
var metric_compare = jQuery("#gawd_metric_compare").val();
|
1286 |
+
if(jQuery("#metric_compare").is(":visible") != true){
|
1287 |
+
metric_compare = 0;
|
1288 |
+
}
|
1289 |
+
metrics.push("ga:" + metric);
|
1290 |
+
if (metric_compare != 0) {
|
1291 |
+
metrics.push("ga:" + metric_compare);
|
1292 |
+
}
|
1293 |
+
|
1294 |
+
var dimension = jQuery("#gawd_tab").val();
|
1295 |
+
var customReport = "";
|
1296 |
+
if (dimension == 'custom') {
|
1297 |
+
var custom = jQuery("#gawd_custom_option").val();
|
1298 |
+
if (typeof jQuery("#gawd_custom_option").val() != 'undefined') {
|
1299 |
+
dimension = custom.substring(3);
|
1300 |
+
} else {
|
1301 |
+
var not_exist = '<div id="gawd_error">There are no custom dimensions set for current profile.</div>';
|
1302 |
+
if (jQuery('#gawd_error').length <= 0) {
|
1303 |
+
jQuery('#chartdiv').append(not_exist);
|
1304 |
+
}
|
1305 |
+
return;
|
1306 |
+
}
|
1307 |
+
} else if (typeof dimension != "undefined" && dimension.indexOf("custom_") > -1) {
|
1308 |
+
customReport = true;
|
1309 |
+
dimension = dimension.substring(7);
|
1310 |
+
}
|
1311 |
+
|
1312 |
+
var args = gawd_custom_ajax_args();
|
1313 |
+
args.type = 'POST';
|
1314 |
+
args.async = true;
|
1315 |
+
args.data.gawd_action = "gawd_show_data";
|
1316 |
+
args.data.gawd_data = {
|
1317 |
+
"start_date": start_date,
|
1318 |
+
"end_date": end_date,
|
1319 |
+
"metric": metrics,
|
1320 |
+
"security": gawd_admin.ajaxnonce,
|
1321 |
+
"dimension": dimension,
|
1322 |
+
"custom": customReport
|
1323 |
+
};
|
1324 |
+
args.beforeSend = function() {
|
1325 |
+
jQuery('#opacity_div').show();
|
1326 |
+
jQuery('#loading_div').show();
|
1327 |
+
};
|
1328 |
+
args.success = function (data) {
|
1329 |
+
jQuery('#opacity_div').hide();
|
1330 |
+
jQuery('#loading_div').hide();
|
1331 |
+
|
1332 |
+
if(data.success === false){
|
1333 |
+
gawd_add_notice(data);
|
1334 |
+
return;
|
1335 |
+
}
|
1336 |
+
gawd_request_last_args = args;
|
1337 |
+
data = data.data.gawd_reports_data;
|
1338 |
+
var result = JSON.parse(data);
|
1339 |
+
_data = result;
|
1340 |
+
if (result.error_message != undefined) {
|
1341 |
+
var not_exist = '<div id="gawd_error">' + result.error_message + '</div>';
|
1342 |
+
if (typeof jQuery('#gawd_error') == 'undefined') {
|
1343 |
+
jQuery('#chartdiv').append(not_exist);
|
1344 |
+
}
|
1345 |
+
return;
|
1346 |
+
}
|
1347 |
+
if (result.chart_data) {
|
1348 |
+
result = result.chart_data;
|
1349 |
+
}
|
1350 |
+
|
1351 |
+
//jQuery('#chartdiv').height(700);
|
1352 |
+
|
1353 |
+
if (dimension == 'goals') {
|
1354 |
+
dimension = 'date';
|
1355 |
+
}
|
1356 |
+
if (dimension == 'date' || dimension == 'siteSpeed' || dimension == 'adsense' || dimension == 'sales_performance') {
|
1357 |
+
//jQuery("#compare_time_conteiner").show();
|
1358 |
+
var dimension_export = dimension;
|
1359 |
+
if (filter_type == '' || typeof filter_type == 'undefined') {
|
1360 |
+
dimension = 'date';
|
1361 |
+
} else {
|
1362 |
+
dimension = filter_type;
|
1363 |
+
}
|
1364 |
+
|
1365 |
+
dimension = dimension.replace(/([A-Z])/g, " $1").trim().charAt(0).toUpperCase() + dimension.replace(/([A-Z])/g, " $1").trim().slice(1);
|
1366 |
+
}
|
1367 |
+
else {
|
1368 |
+
dimension = dimension.replace(/([A-Z])/g, " $1").trim().charAt(0).toUpperCase() + dimension.replace(/([A-Z])/g, " $1").trim().slice(1);
|
1369 |
+
var dimension_export = dimension;
|
1370 |
+
}
|
1371 |
+
|
1372 |
+
metric = metric.replace(/([A-Z])/g, " $1").trim();
|
1373 |
+
metric = metric.charAt(0).toUpperCase() + metric.slice(1);
|
1374 |
+
metric = metric.replace(/ +/g, ' ');
|
1375 |
+
var a = '';
|
1376 |
+
var baloon = true
|
1377 |
+
if(metric == "Bounce Rate" || metric == "Percent New Sessions"){
|
1378 |
+
a = '[[title]]: [[value]]%';
|
1379 |
+
baloon = false;
|
1380 |
+
}
|
1381 |
+
var metric_export = metric;
|
1382 |
+
var metric_compare_export = '';
|
1383 |
+
var filter_type = '';
|
1384 |
+
if(dimension.indexOf('Dimension') != -1){
|
1385 |
+
dimension = jQuery('#gawd_custom_option option:selected').text();
|
1386 |
+
}
|
1387 |
+
|
1388 |
+
var chart = new gawd_charts_helper();
|
1389 |
+
chart.print_pie_chart(result, dimension, metric, "chartdiv");
|
1390 |
+
|
1391 |
+
//CANVAS//
|
1392 |
+
var tab_name = window.location.href.split('tab=');
|
1393 |
+
if (tab_name[1] != 'pagePath' && tab_name[1] != 'landingPagePath' && tab_name[1] != 'daysToTransaction') {
|
1394 |
+
var svg = document.getElementsByTagName('svg')[0];
|
1395 |
+
var canvas = document.getElementById("canvass");
|
1396 |
+
if (typeof svg !== 'undefined') {
|
1397 |
+
draw_canvas(svg, canvas);
|
1398 |
+
url = canvas.toDataURL();
|
1399 |
+
}
|
1400 |
+
}
|
1401 |
+
if (typeof url == 'undefined') {
|
1402 |
+
url = '';
|
1403 |
+
}
|
1404 |
+
//CANVAS URL//
|
1405 |
+
|
1406 |
+
d_start_date = start_date;
|
1407 |
+
d_end_date = end_date;
|
1408 |
+
d_metric_export = metric_export;
|
1409 |
+
d_metric_compare_export = metric_compare_export;
|
1410 |
+
d_dimension_export = dimension_export;
|
1411 |
+
d_tab_name = tab_name;
|
1412 |
+
d_filter_type = filter_type;
|
1413 |
+
|
1414 |
+
jQuery("#gbox_griddiv").remove();
|
1415 |
+
var grid = '<table id="griddiv"></table><div id="pager"></div>';
|
1416 |
+
jQuery('.gawd_chart_conteiner').append(grid);
|
1417 |
+
gawd_draw_table(data, metric, metric_compare, dimension);
|
1418 |
+
};
|
1419 |
+
args.error = function (data) {
|
1420 |
+
jQuery(".opacity_div_compact").hide();
|
1421 |
+
jQuery(".loading_div_compact").hide();
|
1422 |
+
};
|
1423 |
+
jQuery.ajax(args);
|
1424 |
+
}
|
1425 |
+
function gawd_pie_chart_compact(metric, dimension, chart_type, chart_id) {
|
1426 |
+
var _end_date = (Date.today().add(-1).days()).toString("yyyy-MM-dd");
|
1427 |
+
var start_date_7 = (Date.today().add(-1).days()).add(-7).days().toString("yyyy-MM-dd");
|
1428 |
+
var start_end_date = typeof jQuery('#gawd_start_end_date_compact').val() != 'undefined' ? jQuery('#gawd_start_end_date_compact').val() : start_date_7 + '/-/' + _end_date;
|
1429 |
+
|
1430 |
+
var start_end_date = start_end_date.split('/-/');
|
1431 |
+
var start_date = start_end_date[0];
|
1432 |
+
var end_date = start_end_date[1];
|
1433 |
+
metrics = [];
|
1434 |
+
metrics.push("ga:" + metric);
|
1435 |
+
console.log("ajax07");
|
1436 |
+
|
1437 |
+
var args = gawd_custom_ajax_args();
|
1438 |
+
args.type = 'POST';
|
1439 |
+
args.async = true;
|
1440 |
+
args.data.gawd_action = "gawd_show_data_compact";
|
1441 |
+
args.data.gawd_data = {
|
1442 |
+
"start_date": start_date,
|
1443 |
+
"end_date": end_date,
|
1444 |
+
"metric": metrics,
|
1445 |
+
"security": gawd_admin.ajaxnonce,
|
1446 |
+
"dimension": dimension,
|
1447 |
+
};
|
1448 |
+
args.beforeSend = function() {
|
1449 |
+
jQuery('#' + chart_id).closest(".postbox").find('.opacity_div_compact').show();
|
1450 |
+
jQuery('#' + chart_id).closest(".postbox").find('.loading_div_compact').show();
|
1451 |
+
};
|
1452 |
+
args.success = function (result){
|
1453 |
+
jQuery('#' + chart_id).closest(".postbox").find('.opacity_div_compact').hide();
|
1454 |
+
jQuery('#' + chart_id).closest(".postbox").find('.loading_div_compact').hide();
|
1455 |
+
|
1456 |
+
if(result.success === false){
|
1457 |
+
gawd_add_notice(result, chart_id);
|
1458 |
+
return;
|
1459 |
+
}
|
1460 |
+
|
1461 |
+
result = JSON.parse(result.data.gawd_show_data_compact);
|
1462 |
+
dimension = dimension.replace(/([A-Z])/g, " $1").trim();
|
1463 |
+
dimension = dimension.charAt(0).toUpperCase() + dimension.slice(1);
|
1464 |
+
metric = metric.replace(/([A-Z])/g, " $1").trim();
|
1465 |
+
metric = metric.charAt(0).toUpperCase() + metric.slice(1);
|
1466 |
+
metric = metric.replace(/ +/g, ' ');
|
1467 |
+
var total = 0;
|
1468 |
+
if(typeof result.data_sum != 'undefined'){
|
1469 |
+
|
1470 |
+
total = result.data_sum[metric];
|
1471 |
+
var avg = '';
|
1472 |
+
var diff = ((Date.parse(end_date).getTime() - Date.parse(start_date).getTime()) / 3600 / 24 / 1000)+1;
|
1473 |
+
var show_hide = 'gawd_show_total';
|
1474 |
+
if(metric == 'Bounce Rate' || metric == 'Percent New Sessions' || metric == 'Pageviews Per Session'){
|
1475 |
+
avg = parseFloat(total).toFixed(2);
|
1476 |
+
if(metric != 'Pageviews Per Session'){
|
1477 |
+
avg = avg + '%';
|
1478 |
+
}
|
1479 |
+
show_hide = 'gawd_hide_total';
|
1480 |
+
}
|
1481 |
+
else if(metric == 'Avg Session Duration'){
|
1482 |
+
avg = sec_to_normal(avg);
|
1483 |
+
show_hide = 'gawd_hide_total';
|
1484 |
+
}
|
1485 |
+
else{
|
1486 |
+
//avg = Math.ceil(total/diff);
|
1487 |
+
avg = parseFloat(total/diff).toFixed(2);
|
1488 |
+
}
|
1489 |
+
var percent_color = total == 0 || metric == 'Bounce Rate' ? "gawd_red" : "gawd_green";
|
1490 |
+
jQuery('#_sum_' + chart_id).remove();
|
1491 |
+
var sumBox = "<div class='_sum_box' id='_sum_" + chart_id + "'>";
|
1492 |
+
var metric_title = metric == 'Percent New Sessions' ? '% New Sessions' : metric;
|
1493 |
+
sumBox += "<div class='box_metric'>" + metric_title + "</div>"
|
1494 |
+
sumBox += "<div class='_box_left " + show_hide + "'>";
|
1495 |
+
sumBox += "<div class='box_title'>Total</div>";
|
1496 |
+
sumBox += "<div class='" + percent_color + "'>" + parseInt(total).toLocaleString() + "</div>";
|
1497 |
+
sumBox += "</div>";
|
1498 |
+
|
1499 |
+
sumBox += "<div class='_box_right'>";
|
1500 |
+
sumBox += "<div class='box_title'>Average</div>";
|
1501 |
+
sumBox += "<div class='" + percent_color + "'>" + parseInt(avg).toLocaleString() + "</div>";
|
1502 |
+
sumBox += "</div>";
|
1503 |
+
sumBox += "<div class='clear'></div>";
|
1504 |
+
sumBox += "</div>";
|
1505 |
+
jQuery('#'+chart_id).after(sumBox);
|
1506 |
+
}
|
1507 |
+
result = result.chart_data;
|
1508 |
+
|
1509 |
+
if(total > 0) {
|
1510 |
+
var chart = new gawd_charts_helper();
|
1511 |
+
chart.print_pie_chart(result, dimension,metric, chart_id);
|
1512 |
+
}else{
|
1513 |
+
jQuery('#'+chart_id).height('auto');
|
1514 |
+
}
|
1515 |
+
};
|
1516 |
+
args.error = function (data) {
|
1517 |
+
|
1518 |
+
};
|
1519 |
+
jQuery.ajax(args);
|
1520 |
+
|
1521 |
+
}
|
1522 |
+
function gawd_chart_type() {
|
1523 |
+
if(typeof jQuery.cookie("collapsed") != 'undefined' && jQuery.cookie("collapsed") == 1){
|
1524 |
+
jQuery('.gawd_menu_coteiner').hide();
|
1525 |
+
jQuery('.gawd_menu_coteiner_collapse').show();
|
1526 |
+
jQuery('#gawd_right_conteiner').width('93%');
|
1527 |
+
}
|
1528 |
+
else{
|
1529 |
+
jQuery('.gawd_menu_coteiner').show();
|
1530 |
+
jQuery('.gawd_menu_coteiner_collapse').hide();
|
1531 |
+
jQuery('#gawd_right_conteiner').width('73%');
|
1532 |
+
jQuery('#compare_time_conteiner').css('width','31%');
|
1533 |
+
jQuery('#compare_time_conteiner').css('right','4%');
|
1534 |
+
jQuery('#compare_datepicker_wraper').width('98.5%');
|
1535 |
+
}
|
1536 |
+
var tab = jQuery('#gawd_body').data('gawd-tab');
|
1537 |
+
if(
|
1538 |
+
typeof tab !== 'undefined' &&
|
1539 |
+
( tab === 'adsense')
|
1540 |
+
){
|
1541 |
+
jQuery('#gawd_right_conteiner .filter_conteiner').hide();
|
1542 |
+
return;
|
1543 |
+
}
|
1544 |
+
if (jQuery("#gawd_chart_type").val() == 'pie') {
|
1545 |
+
gawd_pie_chart();
|
1546 |
+
} else {
|
1547 |
+
var current_tab_name = get_tab_name();
|
1548 |
+
if(current_tab_name === "goals" && jQuery("#gawd_metric").val()===null){
|
1549 |
+
var args = gawd_custom_ajax_args();
|
1550 |
+
args.type = 'POST';
|
1551 |
+
args.async = true;
|
1552 |
+
args.data.gawd_action = "gawd_get_management_goals";
|
1553 |
+
args.data.gawd_data = {
|
1554 |
+
|
1555 |
+
};
|
1556 |
+
args.beforeSend = function() {
|
1557 |
+
|
1558 |
+
};
|
1559 |
+
args.success = function (data) {
|
1560 |
+
data = JSON.parse(data.data.gawd_goals_data);
|
1561 |
+
for(i in data){
|
1562 |
+
jQuery("#gawd_metric").append( "<option class='gawd_metric_option' value='"+data[i]["name"]+"'>"+data[i]["name"]+"(Goal"+data[i]["id"]+" Completions</option>");
|
1563 |
+
jQuery("#gawd_metric_compare").append( "<option class='gawd_metric_option' value='"+data[i]["name"]+"'>"+data[i]["name"]+"(Goal"+data[i]["id"]+" Completions</option>");
|
1564 |
+
}
|
1565 |
+
gawd_draw_analytics();
|
1566 |
+
}
|
1567 |
+
args.error = function (data) {};
|
1568 |
+
jQuery.ajax(args);
|
1569 |
+
}
|
1570 |
+
else{
|
1571 |
+
gawd_draw_analytics();
|
1572 |
+
}
|
1573 |
+
|
1574 |
+
}
|
1575 |
+
var _end_date = (Date.today().add(-1).days()).toString("yyyy-MM-dd");
|
1576 |
+
var start_date_7 = (Date.today().add(-1).days()).add(-7).days().toString("yyyy-MM-dd");
|
1577 |
+
var start_end_date = typeof jQuery('#gawd_start_end_date').val() != 'undefined' ? jQuery('#gawd_start_end_date').val() : start_date_7 + '/-/' + _end_date;
|
1578 |
+
var start_end_date = start_end_date.split('/-/');
|
1579 |
+
var start_date = start_end_date[0];
|
1580 |
+
var end_date = start_end_date[1];
|
1581 |
+
var diff = ((Date.parse(end_date).getTime() - Date.parse(start_date).getTime()) / 3600 / 24 / 1000)+1;
|
1582 |
+
var period_compare_start_date = Date.parse(start_date).add(-diff).days().toString("yyyy-MM-dd");
|
1583 |
+
var year_compare_start_date = Date.parse(start_date).add(-1).years().toString("yyyy-MM-dd");
|
1584 |
+
var year_compare_end_date = Date.parse(end_date).add(-1).years().toString("yyyy-MM-dd");
|
1585 |
+
|
1586 |
+
var compare_daterange = jQuery('#compare_datepicker_wraper').daterangepicker({
|
1587 |
+
'ranges': {
|
1588 |
+
'Previous period': [moment(period_compare_start_date), moment(start_date).subtract(1, 'days')],
|
1589 |
+
'Previous year': [moment(year_compare_start_date), moment(year_compare_end_date)]
|
1590 |
+
},
|
1591 |
+
"startDate": moment(period_compare_start_date),
|
1592 |
+
"endDate": moment(start_date).subtract(1, 'days'),
|
1593 |
+
"maxDate": moment(),
|
1594 |
+
"alwaysShowCalendars": true,
|
1595 |
+
"opens": "left",
|
1596 |
+
"applyClass": 'gawd_compare_apply',
|
1597 |
+
"cancelClass": "gawd_compare_cancel"
|
1598 |
+
}, gawd_datepicker_compare);
|
1599 |
+
|
1600 |
+
if(typeof compare_daterange.data('daterangepicker') != "undefined"){
|
1601 |
+
compare_daterange.data('daterangepicker').container.addClass('gawd_compare_daterange');
|
1602 |
+
}
|
1603 |
+
|
1604 |
+
jQuery(document).mouseup(function (e) {
|
1605 |
+
|
1606 |
+
|
1607 |
+
|
1608 |
+
if (!jQuery('.gawd_compare_apply').is(e.target) && ( jQuery('.gawd_compare_cancel').is(e.target))) {
|
1609 |
+
jQuery('#gawd_metric_compare').attr('disabled',false);
|
1610 |
+
jQuery('#gawd_metric_compare').removeClass('gawd_disabled');
|
1611 |
+
}
|
1612 |
+
});
|
1613 |
+
jQuery('.cancelBtn').on('click', function () {
|
1614 |
+
_data_compare = [];
|
1615 |
+
data_of_compared = [];
|
1616 |
+
jQuery('#compare_datepicker_wraper').css('background-color','#AFAFAF');
|
1617 |
+
gawd_draw_analytics();
|
1618 |
+
});
|
1619 |
+
jQuery('.gawd_compare_apply').on('click', function () {
|
1620 |
+
if(jQuery('.ranges li.active').text() == 'Previous period' || jQuery('.ranges li.active').text() == 'Custom RangePrevious period' || jQuery('.ranges li.active').text() == 'Previous periodLast 30 Days' || jQuery('.ranges li.active').text() == 'Last 30 DaysPrevious period' || jQuery('.ranges li.active').text() == 'Previous periodLast 7 Days' || jQuery('.ranges li.active').text() == 'Last 7 DaysPrevious period' || jQuery('.ranges li.active').text() == 'Previous periodLast Week' || jQuery('.ranges li.active').text() == 'Last WeekPrevious period' || jQuery('.ranges li.active').text() == 'Previous periodThis Month' || jQuery('.ranges li.active').text() == 'This MonthPrevious period' || jQuery('.ranges li.active').text() == 'Previous periodLast Month' || jQuery('.ranges li.active').text() == 'Last MonthPrevious period' || jQuery('.ranges li.active').text() == 'Previous periodYesterday' || jQuery('.ranges li.active').text() == 'YesterdayPrevious period' || jQuery('.ranges li.active').text() == 'TodayPrevious period' || jQuery('.ranges li.active').text() == 'Previous periodToday'){
|
1621 |
+
|
1622 |
+
gawd_datepicker_compare(moment(period_compare_start_date), moment(start_date).subtract(1, 'days'));
|
1623 |
+
}
|
1624 |
+
//gawd_compare();
|
1625 |
+
})
|
1626 |
+
}
|
1627 |
+
function gawd_datepicker_compare(start, end) {
|
1628 |
+
jQuery('#compare_datepicker_wraper span').html(start.format('Y-MM-DD') + ' - ' + end.format('Y-MM-DD'));
|
1629 |
+
jQuery('#gawd_start_end_date_compare').val(start.format('Y-MM-DD') + '/-/' + end.format('Y-MM-DD'));
|
1630 |
+
gawd_compare();
|
1631 |
+
}
|
1632 |
+
function gawd_chart_type_post_page(uri, divID) {
|
1633 |
+
if (jQuery("#gawd_chart_type_post_page").val() == 'pie') {
|
1634 |
+
//gawd_pie_chart_post_page(uri, divID);
|
1635 |
+
} else {
|
1636 |
+
post_page_stats(uri, divID);
|
1637 |
+
}
|
1638 |
+
}
|
1639 |
+
|
1640 |
+
function post_page_stats(uri, divID) {
|
1641 |
+
jQuery(".opacity_div_compact").show();
|
1642 |
+
jQuery(".loading_div_compact").show();
|
1643 |
+
if (typeof divID == 'undefined') {
|
1644 |
+
divID = 'gawd_post_page_popup';
|
1645 |
+
}
|
1646 |
+
var chartType = 'line';
|
1647 |
+
var fillAlphas = 0;
|
1648 |
+
|
1649 |
+
if (jQuery("#gawd_chart_type_post_page").val() == 'line') {
|
1650 |
+
chartType = 'line';
|
1651 |
+
fillAlphas = 0;
|
1652 |
+
} else if (jQuery("#gawd_chart_type_post_page").val() == 'column') {
|
1653 |
+
chartType = 'column';
|
1654 |
+
fillAlphas = 1;
|
1655 |
+
}
|
1656 |
+
var metric = typeof jQuery("#gawd_metric_post_page").val() != 'undefined' ? jQuery("#gawd_metric_post_page").val() : (typeof jQuery("#gawd_metric_post_page_popup").val() != 'undefined' ? jQuery("#gawd_metric_post_page_popup").val() : 'sessions');
|
1657 |
+
var dimension = 'date';
|
1658 |
+
var date_30 = gawd_admin.date_30;
|
1659 |
+
var date_7 = gawd_admin.date_7;
|
1660 |
+
var date_yesterday = gawd_admin.date_yesterday;
|
1661 |
+
var date_today = gawd_admin.date_today;
|
1662 |
+
var date_this_month = gawd_admin.date_this_month;
|
1663 |
+
var date_last_month = gawd_admin.date_last_month;
|
1664 |
+
var date_last_week = gawd_admin.date_last_week;
|
1665 |
+
var _end_date = (Date.today().add(-1).days()).toString("yyyy-MM-dd");
|
1666 |
+
var start_date_7 = (Date.today().add(-1).days()).add(-7).days().toString("yyyy-MM-dd");
|
1667 |
+
var start_end_date = start_date_7 + '/-/' + _end_date;
|
1668 |
+
if (typeof jQuery('#gawd_start_end_date').val() != 'undefined') {
|
1669 |
+
start_end_date = jQuery('#gawd_start_end_date').val();
|
1670 |
+
}
|
1671 |
+
else {
|
1672 |
+
if (typeof jQuery('#gawd_post_page_popup_date').val() != 'undefined') {
|
1673 |
+
start_end_date = jQuery('#gawd_post_page_popup_date').val();
|
1674 |
+
}
|
1675 |
+
}
|
1676 |
+
var start_end_date = start_end_date.split('/-/');
|
1677 |
+
var start_date = start_end_date[0];
|
1678 |
+
var end_date = start_end_date[1];
|
1679 |
+
var timezone = -(new Date().getTimezoneOffset() / 60);
|
1680 |
+
if (divID == 'gawd_post_page_popup') {
|
1681 |
+
var chart_div = '<div id="opacity_div"></div><div id="loading_div" style="display:none; text-align: center; position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 9999;"><img src="' + gawd_admin.gawd_plugin_url + '/assets/ajax_loader.gif" style="position: absolute;top: calc(50% - 27px);left: calc(50% - 27px);width: 54px;height: 54px;"></div><div class="page_chart_div"><div class="close_button_cont"><button class="gawd_btn">X</button>';
|
1682 |
+
chart_div += '<select name="gawd_post_page_popup_date" id="gawd_post_page_popup_date">';
|
1683 |
+
chart_div += '<option value="' + date_7 + '">Last 7 Days</option><option value="' + date_30 + '">Last 30 Days</option>';
|
1684 |
+
chart_div += '<option value="' + date_last_month + '">Last month</option><option value="' + date_last_week + '">Last week</option>';
|
1685 |
+
chart_div += '<option value="' + date_this_month + '">This month</option><option value="' + date_yesterday + '">Yesterday</option>';
|
1686 |
+
chart_div += '<option value="' + date_today + '">Today</option>';
|
1687 |
+
chart_div += '</select>';
|
1688 |
+
chart_div += '<select name="gawd_metric_post_page_popup" id="gawd_metric_post_page_popup" >';
|
1689 |
+
chart_div += '<option value="sessions">Sessions</option><option value="users" >Users</option><option value="bounceRate" >Bounce Rate</option><option value="pageviews">Pageviews</option><option value="percentNewSessions">New Sessions</option><option value="avgSessionDuration">Session Duration</option><option value="pageviewsPerSession">Pages/Session</option>';
|
1690 |
+
chart_div += '</select>';
|
1691 |
+
chart_div += '<select name="gawd_chart_type_post_page" id="gawd_chart_type_post_page" class="gawd_draw_analytics">';
|
1692 |
+
chart_div += '<option value="line">Line Chart</option><option value="column">Column Chart</option>';
|
1693 |
+
chart_div += '</select>';
|
1694 |
+
chart_div += '<div id="gawd_post_page_popup"></div></div></div>';
|
1695 |
+
jQuery(".page_chart_div").remove();
|
1696 |
+
jQuery('#opacity_div').remove();
|
1697 |
+
|
1698 |
+
jQuery("body").append(chart_div);
|
1699 |
+
jQuery("#gawd_metric_post_page_popup").val(metric);
|
1700 |
+
jQuery("#gawd_chart_type_post_page").val(chartType);
|
1701 |
+
jQuery("#gawd_post_page_popup_date").val(start_date + '/-/' + end_date);
|
1702 |
+
jQuery("#loading_div").show();
|
1703 |
+
jQuery("#opacity_div").show();
|
1704 |
+
jQuery('#gawd_post_page_popup').height('400');
|
1705 |
+
jQuery('#gawd_metric_post_page_popup, #gawd_post_page_popup_date, #gawd_chart_type_post_page').on('change', function () {
|
1706 |
+
gawd_chart_type_post_page(uri, 'gawd_post_page_popup');
|
1707 |
+
})
|
1708 |
+
}
|
1709 |
+
jQuery("#gawd_post_page_meta").empty();
|
1710 |
+
jQuery('#gawd_post_page_meta').height('300');
|
1711 |
+
console.log("ajax10");
|
1712 |
+
var args = gawd_custom_ajax_args();
|
1713 |
+
args.type = 'POST';
|
1714 |
+
args.async = true;
|
1715 |
+
args.data.gawd_action = "gawd_show_post_page_data";
|
1716 |
+
args.data.gawd_data = {
|
1717 |
+
"metric": metric,
|
1718 |
+
"start_date": start_date,
|
1719 |
+
"end_date": end_date,
|
1720 |
+
"dimension": dimension,
|
1721 |
+
"timezone": timezone,
|
1722 |
+
"security": gawd_admin.ajaxnonce,
|
1723 |
+
"filter": uri,
|
1724 |
+
"chart": 'line',
|
1725 |
+
};
|
1726 |
+
args.beforeSend = function () {
|
1727 |
+
|
1728 |
+
};
|
1729 |
+
args.success = function (data) {
|
1730 |
+
var original_data = data;
|
1731 |
+
data = JSON.parse(data.data.gawd_page_post_data);
|
1732 |
+
data = data.chart_data ? data.chart_data : data;
|
1733 |
+
|
1734 |
+
jQuery(".opacity_div_compact").hide();
|
1735 |
+
jQuery(".loading_div_compact").hide();
|
1736 |
+
|
1737 |
+
if (divID == 'gawd_post_page_popup') {
|
1738 |
+
jQuery("#loading_div").hide();
|
1739 |
+
jQuery(".gawd_btn").show();
|
1740 |
+
jQuery('#opacity_div, .gawd_btn').on('click', function () {
|
1741 |
+
jQuery('#opacity_div').remove();
|
1742 |
+
jQuery(".gawd_btn").remove();
|
1743 |
+
jQuery(".page_chart_div").remove();
|
1744 |
+
jQuery("#loading_div").remove();
|
1745 |
+
})
|
1746 |
+
}
|
1747 |
+
|
1748 |
+
if (original_data.success === false) {
|
1749 |
+
gawd_add_notice(original_data, divID);
|
1750 |
+
return;
|
1751 |
+
}
|
1752 |
+
|
1753 |
+
if (data.length === 0) {
|
1754 |
+
return;
|
1755 |
+
}
|
1756 |
+
|
1757 |
+
|
1758 |
+
var x_key = 'date';
|
1759 |
+
var y_key = metric;
|
1760 |
+
|
1761 |
+
var chart = new gawd_charts_helper();
|
1762 |
+
chart.print_posts_chart(data, x_key, y_key, chartType, divID);
|
1763 |
+
|
1764 |
+
};
|
1765 |
+
args.error = function (data) {
|
1766 |
+
jQuery(".opacity_div_compact").hide();
|
1767 |
+
jQuery(".loading_div_compact").hide();
|
1768 |
+
};
|
1769 |
+
jQuery.ajax(args);
|
1770 |
+
|
1771 |
+
}
|
1772 |
+
function show_hide(obj) {
|
1773 |
+
jQuery('.gawd_resp_li').hide();
|
1774 |
+
obj.show();
|
1775 |
+
jQuery('.gawd_menu_coteiner').removeClass("gawd_open");
|
1776 |
+
}
|
1777 |
+
|
1778 |
+
function gawd_add_notice(data, chart_id) {
|
1779 |
+
if (typeof chart_id === 'undefined') {
|
1780 |
+
chart_id = "#chartdiv";
|
1781 |
+
}else{
|
1782 |
+
if(chart_id.charAt(0) !== '#'){
|
1783 |
+
chart_id = '#' + chart_id;
|
1784 |
+
}
|
1785 |
+
}
|
1786 |
+
|
1787 |
+
var notice = '';
|
1788 |
+
if (typeof data.error === 'undefined') {
|
1789 |
+
jQuery('#chartdiv').find('.gawd_chart_error_msg').remove();
|
1790 |
+
return notice;
|
1791 |
+
}
|
1792 |
+
|
1793 |
+
if (
|
1794 |
+
data.error.code === "show_data_error" &&
|
1795 |
+
data.error.msg === "Selected dimensions and metrics cannot be queried together"
|
1796 |
+
) {
|
1797 |
+
notice = '<div class="gawd_chart_error_msg">' + data.error.msg + '</div>';
|
1798 |
+
} else if (
|
1799 |
+
data.error.code === "gawd_no_property" ||
|
1800 |
+
data.error.code === 'show_data_error' ||
|
1801 |
+
data.error.code === 'show_data_compact_error' ||
|
1802 |
+
data.error.code === 'real_time_error' ||
|
1803 |
+
data.error.code === 'gawd_page_post_error'
|
1804 |
+
) {
|
1805 |
+
notice = '<div class="gawd_chart_error_msg">Can not get data for this property, maybe the property is deleted or changed. <a href="admin.php?page=gawd_settings">Refresh user info.</a></div>';
|
1806 |
+
}else{
|
1807 |
+
notice = '<div class="gawd_chart_error_msg">Some unknown error happened when getting report data. <a href="admin.php?page=gawd_settings">Refresh user info.</a></div>';
|
1808 |
+
}
|
1809 |
+
|
1810 |
+
if (notice !== '') {
|
1811 |
+
jQuery(chart_id).find('.gawd_chart_error_msg').remove();
|
1812 |
+
jQuery(chart_id).html("");
|
1813 |
+
jQuery(chart_id).append(notice);
|
1814 |
+
}
|
1815 |
+
|
1816 |
+
return notice;
|
1817 |
+
}
|
1818 |
+
|
1819 |
+
jQuery(document).ready(function () {
|
1820 |
+
|
1821 |
+
|
1822 |
+
jQuery('#gawd_email_time_input').timepicker({ 'scrollDefault': 'now','timeFormat': 'H:i' });
|
1823 |
+
|
1824 |
+
jQuery('#gawd_page_title').text(jQuery('.gawd_active_li').text());
|
1825 |
+
|
1826 |
+
if(jQuery('.gawd_menu_coteiner_collapse .gawd_active_li_text').closest('span').length > 0){
|
1827 |
+
jQuery('.gawd_menu_coteiner_collapse .gawd_active_li_text').closest('span').addClass('gawd_active_li');
|
1828 |
+
//jQuery('.gawd_menu_coteiner_collapse .collapse_ul .gawd_menu_item').removeClass('gawd_active_li');
|
1829 |
+
}
|
1830 |
+
jQuery('.collapse_ul').on('mouseover',function(){
|
1831 |
+
jQuery(this).show();
|
1832 |
+
} ,
|
1833 |
+
function(){
|
1834 |
+
jQuery(this).hide()
|
1835 |
+
});
|
1836 |
+
|
1837 |
+
jQuery('.gawd_collapse').on('click',function(){
|
1838 |
+
//jQuery('.gawd_menu_coteiner_collapse').toggle();
|
1839 |
+
//jQuery('.gawd_menu_coteiner').toggle();
|
1840 |
+
//jQuery('#gawd_right_conteiner').width('94%');
|
1841 |
+
jQuery.cookie("collapsed", "1");
|
1842 |
+
gawd_chart_type();
|
1843 |
+
})
|
1844 |
+
jQuery('.gawd_collapsed').on('click',function(){
|
1845 |
+
// jQuery('.gawd_menu_coteiner_collapse').toggle();
|
1846 |
+
// jQuery('#gawd_right_conteiner').width('73%');
|
1847 |
+
// jQuery('.gawd_menu_coteiner').toggle();
|
1848 |
+
jQuery.cookie("collapsed", "0");
|
1849 |
+
gawd_chart_type();
|
1850 |
+
})
|
1851 |
+
|
1852 |
+
jQuery('#gawd_got_it').on('click',function(){
|
1853 |
+
remove_zoom_message();
|
1854 |
+
})
|
1855 |
+
jQuery('#compare_datepicker_wraper').on('click',function(){
|
1856 |
+
jQuery('#gawd_metric_compare').attr('disabled',true);
|
1857 |
+
jQuery('#gawd_metric_compare').addClass('gawd_disabled');
|
1858 |
+
})
|
1859 |
+
// jQuery('.gawd_add_prop').width('51.2%');
|
1860 |
+
jQuery('.load_tooltip , .gawd_description').mouseenter(function(){
|
1861 |
+
if(gawd_admin.enableHoverTooltip == 'on'){
|
1862 |
+
jQuery(this).attr('title',jQuery(this).data('hint'));
|
1863 |
+
}
|
1864 |
+
})
|
1865 |
+
jQuery('#gawd_dimensions_form, #gawd_custom_report_form').tooltip();
|
1866 |
+
jQuery('#gawd_goal_form').tooltip();
|
1867 |
+
jQuery(window).resize(function () {
|
1868 |
+
if(typeof jQuery.cookie("collapsed") == 'undefined' || jQuery.cookie("collapsed") == 0){
|
1869 |
+
jQuery('.gawd_menu_coteiner').show();
|
1870 |
+
}
|
1871 |
+
})
|
1872 |
+
|
1873 |
+
jQuery('#gawd_metric_compare').on('change', function () {
|
1874 |
+
if (jQuery(this).val() != '0') {
|
1875 |
+
jQuery('#metric_compare img').show();
|
1876 |
+
} else {
|
1877 |
+
jQuery('#_sum_comp_chartdiv').remove();
|
1878 |
+
jQuery('#metric_compare img').hide();
|
1879 |
+
}
|
1880 |
+
})
|
1881 |
+
jQuery('#metric_compare img').on('click', function () {
|
1882 |
+
jQuery('#gawd_metric_compare option:first-child').attr('selected', 'selected');
|
1883 |
+
jQuery(this).hide();
|
1884 |
+
jQuery('#_sum_comp_chartdiv').remove();
|
1885 |
+
gawd_chart_type();
|
1886 |
+
})
|
1887 |
+
|
1888 |
+
jQuery('.gawd_settings_menu_coteiner').show();
|
1889 |
+
jQuery('.resp_menu').on('click', function () {
|
1890 |
+
jQuery('.gawd_resp_li').show();
|
1891 |
+
if (jQuery('.gawd_menu_coteiner').hasClass("gawd_open")) {
|
1892 |
+
jQuery('.gawd_menu_coteiner').removeClass("gawd_open");
|
1893 |
+
var elId = window.location.hash ? window.location.hash.substring(0,window.location.hash.length-4) : "#gawd_authenicate";
|
1894 |
+
show_hide(jQuery(elId));
|
1895 |
+
//jQuery('.gawd_menu_coteiner').hide();
|
1896 |
+
}
|
1897 |
+
else {
|
1898 |
+
jQuery('.gawd_menu_coteiner').addClass("gawd_open");
|
1899 |
+
jQuery('.gawd_menu_coteiner').show();
|
1900 |
+
}
|
1901 |
+
})
|
1902 |
+
jQuery('.gawd_resp_li').on('click', function () {
|
1903 |
+
show_hide(jQuery(this));
|
1904 |
+
})
|
1905 |
+
jQuery('.resp_metrics_menu').on('click', function () {
|
1906 |
+
jQuery('.float_conteiner').toggle();
|
1907 |
+
jQuery('.filter_conteiner').toggle();
|
1908 |
+
})
|
1909 |
+
|
1910 |
+
jQuery('.gawd_page_post_stats').on('click', function () {
|
1911 |
+
var page_id = jQuery(this).parent().parent().find('th').find('input').val();
|
1912 |
+
var gawd_page_permalink = jQuery(this).data("permalink");
|
1913 |
+
gawd_chart_type_post_page(gawd_page_permalink);
|
1914 |
+
});
|
1915 |
+
|
1916 |
+
jQuery('.gawd_settings_wrapper').tooltip();
|
1917 |
+
if (jQuery('.gawd_menu_coteiner').length > 0) {
|
1918 |
+
jQuery('.settings_row, .gawd_checkbox, .gawd_goal_row, .gawd_own_wrap').tooltip();
|
1919 |
+
if(gawd_admin.enableHoverTooltip == 'on'){
|
1920 |
+
jQuery('.gawd_menu_coteiner, #gawd_right_conteiner').tooltip({position: {
|
1921 |
+
my: "center",
|
1922 |
+
at: "right+200",
|
1923 |
+
track: false,
|
1924 |
+
using: function(position, feedback) {
|
1925 |
+
jQuery(this).css(position);
|
1926 |
+
}
|
1927 |
+
}
|
1928 |
+
});
|
1929 |
+
}
|
1930 |
+
onDashboardLoad();
|
1931 |
+
}
|
1932 |
+
if (jQuery('.gawd_chart_conteiner').length > 0) {
|
1933 |
+
datepicker_js();
|
1934 |
+
}
|
1935 |
+
jQuery('#country_filter_reset').on('click', function () {
|
1936 |
+
gawd_chart_type();
|
1937 |
+
})
|
1938 |
+
jQuery('.gawd_menu_li_sub').on('click', function () {
|
1939 |
+
if (jQuery('#' + jQuery(this).closest('li').attr('id') + ' ul').is(":visible") != true) {
|
1940 |
+
jQuery('#' + jQuery(this).closest('li').attr('id') + ' ul').closest('li').find('.gawd_menu_li_sub_arrow').css("background-position", "83% 82.5%");
|
1941 |
+
} else {
|
1942 |
+
jQuery('#' + jQuery(this).closest('li').attr('id') + ' ul').closest('li').find('.gawd_menu_li_sub_arrow').css("background-position", "87% 85.6%");
|
1943 |
+
}
|
1944 |
+
jQuery(jQuery('#' + jQuery(this).closest('li').attr('id') + ' ul')).toggle(500);
|
1945 |
+
});
|
1946 |
+
if (jQuery('.gawd_active_li')) {
|
1947 |
+
jQuery('.gawd_active_li').closest('ul').show();
|
1948 |
+
}
|
1949 |
+
jQuery('.gawd_menu_li ul').each(function () {
|
1950 |
+
if (jQuery(this).is(':visible') == true) {
|
1951 |
+
jQuery(this).closest('li').find('.gawd_menu_li_sub_arrow').css("background-position", "83% 82.5%");
|
1952 |
+
} else {
|
1953 |
+
jQuery(this).closest('li').find('.gawd_menu_li_sub_arrow').css("background-position", "87% 85.6%");
|
1954 |
+
}
|
1955 |
+
});
|
1956 |
+
|
1957 |
+
jQuery('.gawd_list_item').on('click', function () {
|
1958 |
+
jQuery('.gawd_list_item a').css('color', '#fff');
|
1959 |
+
jQuery('#gawd_hour').css({'background-color': '#FB8583', 'border-color': '#FB8583'});
|
1960 |
+
jQuery('#gawd_day').css({'background-color': '#7DB5D8', 'border-color': '#7DB5D8'});
|
1961 |
+
jQuery('#gawd_week').css({'background-color': '#F0B358', 'border-color': '#F0B358'});
|
1962 |
+
jQuery('#gawd_month').css({'background-color': '#9DCFAC', 'border-color': '#9DCFAC'});
|
1963 |
+
jQuery(this).find('a').css('color', jQuery(this).css('border-top-color'));
|
1964 |
+
jQuery(this).css('background-color', '#fff');
|
1965 |
+
|
1966 |
+
jQuery('#gawd_filter_val').val(jQuery(this).find(".gawd_filter_item").attr('data-type'));
|
1967 |
+
gawd_chart_type();
|
1968 |
+
return false;
|
1969 |
+
})
|
1970 |
+
//google.charts.load('current', {'packages': ['table']});
|
1971 |
+
|
1972 |
+
jQuery(".gawd_draw_analytics").on("change", function () {
|
1973 |
+
if(jQuery(this).closest('#metric_conteiner').length > 0){
|
1974 |
+
var option = jQuery(this).val();
|
1975 |
+
var metric_id = "gawd_metric";
|
1976 |
+
var metric_compare_id = "gawd_metric_compare";
|
1977 |
+
var select_id = jQuery(this).attr("id");
|
1978 |
+
if(select_id == metric_id){
|
1979 |
+
jQuery("#"+metric_compare_id).find('option').show();
|
1980 |
+
jQuery("#"+metric_compare_id).find("option[value='"+option+"']").hide();
|
1981 |
+
}
|
1982 |
+
else if(select_id == metric_compare_id){
|
1983 |
+
jQuery("#"+metric_id).find('option').show();
|
1984 |
+
jQuery("#"+metric_id).find("option[value='"+option+"']").hide();
|
1985 |
+
}
|
1986 |
+
}
|
1987 |
+
gawd_chart_type();
|
1988 |
+
})
|
1989 |
+
|
1990 |
+
if (jQuery('#chart_widget').length > 0) {
|
1991 |
+
gawd_draw_analytics_widget();
|
1992 |
+
}
|
1993 |
+
gawd_tracking_display_manage();
|
1994 |
+
});
|
1995 |
+
function default_start() {
|
1996 |
+
if (gawd_admin.default_date != 'undefined') {
|
1997 |
+
|
1998 |
+
switch (gawd_admin.default_date) {
|
1999 |
+
case 'today':
|
2000 |
+
date = moment();
|
2001 |
+
break;
|
2002 |
+
case 'yesterday':
|
2003 |
+
date = moment().subtract(1, 'days');
|
2004 |
+
break;
|
2005 |
+
case 'last_7_days':
|
2006 |
+
date = moment().subtract(7, 'days');
|
2007 |
+
break;
|
2008 |
+
case 'last_week':
|
2009 |
+
date = moment().subtract(1, 'week').startOf('week');
|
2010 |
+
break;
|
2011 |
+
case 'this_month':
|
2012 |
+
date = moment().startOf('month');
|
2013 |
+
break;
|
2014 |
+
case 'last_30days':
|
2015 |
+
date = moment().subtract(30, 'days');
|
2016 |
+
break;
|
2017 |
+
case 'last_month':
|
2018 |
+
date = moment().subtract(1, 'month').startOf('month');
|
2019 |
+
break;
|
2020 |
+
default:
|
2021 |
+
date = moment().subtract(7, 'days');
|
2022 |
+
break;
|
2023 |
+
}
|
2024 |
+
return date;
|
2025 |
+
} else {
|
2026 |
+
return moment().subtract(7, 'days');
|
2027 |
+
}
|
2028 |
+
}
|
2029 |
+
function default_end() {
|
2030 |
+
if (gawd_admin.default_date != 'undefined') {
|
2031 |
+
switch (gawd_admin.default_date) {
|
2032 |
+
case 'today':
|
2033 |
+
date = moment();
|
2034 |
+
break;
|
2035 |
+
case 'yesterday':
|
2036 |
+
date = moment().subtract(1, 'days');
|
2037 |
+
break;
|
2038 |
+
case 'last_7_days':
|
2039 |
+
date = moment().subtract(1, 'days');
|
2040 |
+
break;
|
2041 |
+
case 'last_week':
|
2042 |
+
date = moment().subtract(1, 'week').endOf('week');
|
2043 |
+
break;
|
2044 |
+
case 'this_month':
|
2045 |
+
date = moment().subtract(1, 'days') <= moment().startOf('month') ? moment().startOf('month') : moment().subtract(1, 'days');
|
2046 |
+
break;
|
2047 |
+
case 'last_30days':
|
2048 |
+
date = moment().subtract(1, 'days');
|
2049 |
+
break;
|
2050 |
+
case 'last_month':
|
2051 |
+
date = moment().subtract(1, 'month').endOf('month')
|
2052 |
+
break;
|
2053 |
+
default:
|
2054 |
+
date = moment().subtract(1, 'days');
|
2055 |
+
break;
|
2056 |
+
}
|
2057 |
+
return date;
|
2058 |
+
} else {
|
2059 |
+
return moment().subtract(1, 'days');
|
2060 |
+
}
|
2061 |
+
}
|
2062 |
+
function datepicker_js(opens,callback) {
|
2063 |
+
if(typeof opens == 'undefined'){
|
2064 |
+
opens = 'left';
|
2065 |
+
}
|
2066 |
+
if(typeof callback == 'undefined'){
|
2067 |
+
callback = 'gawd_datepicker_main';
|
2068 |
+
}
|
2069 |
+
window[callback](default_start(), default_end());
|
2070 |
+
var daterange = jQuery('#reportrange').daterangepicker({
|
2071 |
+
"ranges": {
|
2072 |
+
'Today': [moment(), moment()],
|
2073 |
+
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
|
2074 |
+
'Last 7 Days': [moment().subtract(7, 'days'), moment().subtract(1, 'days')],
|
2075 |
+
'Last Week': [moment().subtract(1, 'week').startOf('week'), moment().subtract(1, 'week').endOf('week')],
|
2076 |
+
'Last 30 Days': [moment().subtract(30, 'days'), moment().subtract(1, 'days')],
|
2077 |
+
'This Month': [moment().startOf('month'), moment().endOf('month')],
|
2078 |
+
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
|
2079 |
+
},
|
2080 |
+
"startDate": default_start(),
|
2081 |
+
"endDate": default_end(),
|
2082 |
+
"maxDate": moment(),
|
2083 |
+
"alwaysShowCalendars": true,
|
2084 |
+
"opens": opens,
|
2085 |
+
"applyClass": 'gawd_main_apply'
|
2086 |
+
|
2087 |
+
}, window[callback]);
|
2088 |
+
var _end_date = (Date.today().add(-1).days()).toString("yyyy-MM-dd");
|
2089 |
+
var start_date_7 = (Date.today().add(-1).days()).add(-7).days().toString("yyyy-MM-dd");
|
2090 |
+
var start_end_date = typeof jQuery('#gawd_start_end_date').val() != 'undefined' ? jQuery('#gawd_start_end_date').val() : start_date_7 + '/-/' + _end_date;
|
2091 |
+
var start_end_date = start_end_date.split('/-/');
|
2092 |
+
var start_date = start_end_date[0];
|
2093 |
+
var end_date = start_end_date[1];
|
2094 |
+
if(typeof daterange.data('daterangepicker') != "undefined") {
|
2095 |
+
daterange.data('daterangepicker').container.addClass('gawd_daterange');
|
2096 |
+
}
|
2097 |
+
|
2098 |
+
}
|
2099 |
+
function onDashboardLoad() {
|
2100 |
+
jQuery(".gawd_email_week_day").on('click', function () {
|
2101 |
+
jQuery('#gawd_email_week_day_hidden').val(jQuery(this).attr('data-atribute'));
|
2102 |
+
jQuery(".gawd_email_week_day").removeClass('gawd_selected_day');
|
2103 |
+
jQuery(this).addClass('gawd_selected_day');
|
2104 |
+
})
|
2105 |
+
jQuery("#gawd_export_buttons, .gawd_exports, #ui-id-6").on({
|
2106 |
+
mouseover: function () {
|
2107 |
+
jQuery(".gawd_exports").show();
|
2108 |
+
},
|
2109 |
+
mouseleave: function () {
|
2110 |
+
jQuery(".gawd_exports").hide();
|
2111 |
+
}
|
2112 |
+
});
|
2113 |
+
jQuery("#gawd_email_button").on('click', function () {
|
2114 |
+
jQuery('.gawd_email_body').show();
|
2115 |
+
if(gawd_admin.enableHoverTooltip == 'on'){
|
2116 |
+
jQuery('.gawd_email_body').tooltip();
|
2117 |
+
}
|
2118 |
+
jQuery('.email_message_cont').html('');
|
2119 |
+
jQuery('.email_message_cont').hide();
|
2120 |
+
|
2121 |
+
jQuery('#gawd_email_to').val('');
|
2122 |
+
jQuery('#gawd_attachment_type').val('csv');
|
2123 |
+
jQuery('#gawd_email_period').find('select').val('once');
|
2124 |
+
jQuery('#gawd_email_body').val('');
|
2125 |
+
|
2126 |
+
jQuery('.gawd_email_row').find('.gawd_email_week_day_div').hide();
|
2127 |
+
jQuery('.gawd_email_row').find('.gawd_email_month_day_div').hide();
|
2128 |
+
jQuery('.gawd_email_time_row').hide();
|
2129 |
+
|
2130 |
+
|
2131 |
+
|
2132 |
+
|
2133 |
+
var _end_date = (Date.today().add(-1).days()).toString("yyyy-MM-dd");
|
2134 |
+
var start_date_7 = (Date.today().add(-1).days()).add(-7).days().toString("yyyy-MM-dd");
|
2135 |
+
var start_end_date = typeof jQuery('#gawd_start_end_date').val() != 'undefined' ? jQuery('#gawd_start_end_date').val() : start_date_7 + '/-/' + _end_date;
|
2136 |
+
|
2137 |
+
var start_end_date = start_end_date.split('/-/');
|
2138 |
+
var start_date = start_end_date[0];
|
2139 |
+
var end_date = start_end_date[1];
|
2140 |
+
jQuery("#gawd_start_date").val(start_date);
|
2141 |
+
jQuery("#gawd_end_date").val(end_date);
|
2142 |
+
if(_data_compare != ''){
|
2143 |
+
jQuery("#gawd_email_period select option").hide();
|
2144 |
+
jQuery("#gawd_email_period select option:first-child").show();
|
2145 |
+
}
|
2146 |
+
else{
|
2147 |
+
jQuery("#gawd_email_period select option").show();
|
2148 |
+
}
|
2149 |
+
jQuery(".gawd_email_popup").fadeIn('fast');
|
2150 |
+
jQuery(".gawd_email_popup_overlay").fadeIn('fast');
|
2151 |
+
jQuery(".gawd_btn").fadeIn('fast');
|
2152 |
+
var _tab_name = jQuery('#gawd_tab').val() == 'date' ? 'Audience' : jQuery('#gawd_tab').val();
|
2153 |
+
jQuery(".gawd_email_subject").val('Google Analytics: ' + _tab_name.replace(/([A-Z])/g, " $1").trim().charAt(0).toUpperCase() + _tab_name.replace(/([A-Z])/g, " $1").trim().slice(1) + ' (' + start_date + ' - ' + end_date + ')');
|
2154 |
+
})
|
2155 |
+
jQuery(".gawd_email_popup_overlay, .gawd_btn").on('click', function () {
|
2156 |
+
jQuery(".gawd_email_popup").fadeOut('fast');
|
2157 |
+
jQuery(".gawd_email_popup_overlay").fadeOut('fast');
|
2158 |
+
jQuery(".gawd_btn").fadeOut('fast');
|
2159 |
+
})
|
2160 |
+
jQuery("#gawd_email_period").on('change', function () {
|
2161 |
+
if (jQuery("#gawd_email_period :selected").val() == "gawd_weekly") {
|
2162 |
+
jQuery(".gawd_email_week_day_div").show();
|
2163 |
+
}
|
2164 |
+
else {
|
2165 |
+
jQuery(".gawd_email_week_day_div").hide();
|
2166 |
+
}
|
2167 |
+
if (jQuery("#gawd_email_period :selected").val() == "gawd_monthly") {
|
2168 |
+
jQuery(".gawd_email_month_day_div").show();
|
2169 |
+
}
|
2170 |
+
else {
|
2171 |
+
jQuery(".gawd_email_month_day_div").hide();
|
2172 |
+
}
|
2173 |
+
if (jQuery("#gawd_email_period :selected").val() != "once") {
|
2174 |
+
jQuery(".gawd_email_time_row").show();
|
2175 |
+
}
|
2176 |
+
else {
|
2177 |
+
jQuery(".gawd_email_time_row").hide();
|
2178 |
+
}
|
2179 |
+
})
|
2180 |
+
jQuery("#email_submit").on('click', function () {
|
2181 |
+
gawd_send_email_info();
|
2182 |
+
//email_popup();
|
2183 |
+
})
|
2184 |
+
}
|
2185 |
+
|
2186 |
+
function gawd_send_email_info() {
|
2187 |
+
|
2188 |
+
var email_info = {
|
2189 |
+
'period': jQuery("#gawd_email_period :selected").val(),
|
2190 |
+
'email_from': jQuery("#gawd_email_from").val(),
|
2191 |
+
'email_to': jQuery("#gawd_email_to").val(),
|
2192 |
+
'subject': jQuery(".gawd_email_subject").val(),
|
2193 |
+
'content': jQuery("#gawd_email_body").val(),
|
2194 |
+
'week_day': jQuery("#gawd_email_week_day_hidden").val(),
|
2195 |
+
'month_day': jQuery("#gawd_email_month_day_select").val(),
|
2196 |
+
'email_time': jQuery("#gawd_email_time_input").val(),
|
2197 |
+
'view_id': jQuery("#gawd_id option:selected").val(),
|
2198 |
+
};
|
2199 |
+
|
2200 |
+
var empty_subject = false;
|
2201 |
+
var is_valid_email = true;
|
2202 |
+
|
2203 |
+
jQuery("#gawd_email_to").removeClass('gawd_invalid')
|
2204 |
+
jQuery("#gawd_email_subject").removeClass('gawd_invalid')
|
2205 |
+
var emails = email_info.email_to.split(',');
|
2206 |
+
var invalid_emalis = [];
|
2207 |
+
for (var j = 0; j < emails.length; j++) {
|
2208 |
+
var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
2209 |
+
if (re.test(emails[j]) == false) {
|
2210 |
+
invalid_emalis.push(emails[j])
|
2211 |
+
}
|
2212 |
+
}
|
2213 |
+
if (invalid_emalis.length > 0) {
|
2214 |
+
is_valid_email = false;
|
2215 |
+
jQuery("#gawd_email_to").addClass('gawd_invalid');
|
2216 |
+
}
|
2217 |
+
if (email_info.subject == '') {
|
2218 |
+
empty_subject = true;
|
2219 |
+
jQuery("#gawd_email_subject").addClass('gawd_email_subject');
|
2220 |
+
}
|
2221 |
+
|
2222 |
+
|
2223 |
+
if (!(is_valid_email == true && empty_subject == false)) {
|
2224 |
+
return;
|
2225 |
+
}
|
2226 |
+
|
2227 |
+
var data = gawd_get_report_file_data();
|
2228 |
+
data['action'] = 'gawd_send_email';
|
2229 |
+
data['email_info'] = email_info;
|
2230 |
+
|
2231 |
+
jQuery('#loading_div').css('z-index','999999');
|
2232 |
+
jQuery('#loading_div').show();
|
2233 |
+
|
2234 |
+
jQuery.post(gawd_admin.ajaxurl, data).done(function (response) {
|
2235 |
+
response = JSON.parse(response);
|
2236 |
+
|
2237 |
+
jQuery('.gawd_email_body').hide();
|
2238 |
+
jQuery('#loading_div').css('z-index', '99999');
|
2239 |
+
jQuery('#loading_div').hide();
|
2240 |
+
jQuery('.email_message_cont').show();
|
2241 |
+
|
2242 |
+
jQuery('.email_message_cont').html(response.data.msg);
|
2243 |
+
|
2244 |
+
|
2245 |
+
});
|
2246 |
+
}
|
2247 |
+
|
2248 |
+
function email_popup() {
|
2249 |
+
jQuery("#gawd_email_metric").val(jQuery("#gawd_metric").val());
|
2250 |
+
var metric_compare_email = jQuery("#gawd_metric_compare").val();
|
2251 |
+
if(_data_compare != ''){
|
2252 |
+
metric_compare_email = jQuery("#gawd_metric").val() + ' compare';
|
2253 |
+
}
|
2254 |
+
var dimension = jQuery('#gawd_tab').val();
|
2255 |
+
if (dimension == 'custom') {
|
2256 |
+
// alert("bbbbbbbbbbbbb");
|
2257 |
+
var custom = jQuery("#gawd_custom_option").val();
|
2258 |
+
if (typeof jQuery("#gawd_custom_option").val() != 'undefined') {
|
2259 |
+
dimension = custom.substring(3);
|
2260 |
+
}
|
2261 |
+
}
|
2262 |
+
var url = '';
|
2263 |
+
if(dimension != "pagePath" && dimension != 'landingPagePath' && dimension != 'daysToTransaction'){
|
2264 |
+
jQuery('svg').find('desc').remove();
|
2265 |
+
var svg = document.getElementsByTagName('svg')[0];
|
2266 |
+
var canvas = document.getElementById("canvass");
|
2267 |
+
draw_canvas(svg, canvas);
|
2268 |
+
url = canvas.toDataURL();
|
2269 |
+
}
|
2270 |
+
if (typeof url == 'undefined') {
|
2271 |
+
url = '';
|
2272 |
+
}
|
2273 |
+
var gawd_email_period = jQuery("#gawd_email_period :selected").val();
|
2274 |
+
var filter_type = jQuery("#gawd_filter_val").val();
|
2275 |
+
var gawd_email_from = jQuery("#gawd_email_from").val();
|
2276 |
+
var gawd_email_to = jQuery("#gawd_email_to").val();
|
2277 |
+
var gawd_email_subject = jQuery(".gawd_email_subject").val();
|
2278 |
+
var start_date = jQuery("#gawd_start_date").val();
|
2279 |
+
var end_date = jQuery("#gawd_end_date").val();
|
2280 |
+
var metric = jQuery("#gawd_email_metric").val();
|
2281 |
+
var metric_compare = metric_compare_email;
|
2282 |
+
var export_type = jQuery("#gawd_attachment_type").val();
|
2283 |
+
var report_type = jQuery("#report_type").val();
|
2284 |
+
var gawd_email_body = jQuery("#gawd_email_body").val();
|
2285 |
+
var week_day = jQuery("#gawd_email_week_day_hidden").val();
|
2286 |
+
var month_day = jQuery("#gawd_email_month_day_select").val();
|
2287 |
+
var email_time = jQuery("#gawd_email_time_input").val();
|
2288 |
+
var view_id = jQuery("#gawd_id option:selected").closest('optgroup').attr('label');
|
2289 |
+
var empty_subject = false;
|
2290 |
+
var is_valid_email = true;
|
2291 |
+
jQuery("#gawd_email_to").removeClass('gawd_invalid')
|
2292 |
+
jQuery("#gawd_email_subject").removeClass('gawd_invalid')
|
2293 |
+
var emails = gawd_email_to.split(',');
|
2294 |
+
var invalid_emalis = [];
|
2295 |
+
for (var j = 0; j < emails.length; j++) {
|
2296 |
+
var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
2297 |
+
if (re.test(emails[j]) == false) {
|
2298 |
+
invalid_emalis.push(emails[j])
|
2299 |
+
}
|
2300 |
+
}
|
2301 |
+
if (invalid_emalis.length > 0) {
|
2302 |
+
is_valid_email = false;
|
2303 |
+
jQuery("#gawd_email_to").addClass('gawd_invalid');
|
2304 |
+
}
|
2305 |
+
if (gawd_email_subject == '') {
|
2306 |
+
empty_subject = true;
|
2307 |
+
jQuery("#gawd_email_subject").addClass('gawd_email_subject');
|
2308 |
+
}
|
2309 |
+
|
2310 |
+
var order = get_order_data_for_export();
|
2311 |
+
//jQuery("#gawd_email_form").submit();
|
2312 |
+
if (is_valid_email == true && empty_subject == false) {
|
2313 |
+
jQuery('#loading_div').css('z-index','999999');
|
2314 |
+
jQuery('#loading_div').show();
|
2315 |
+
console.log("ajax11");
|
2316 |
+
jQuery.post(gawd_admin.ajaxurl, {
|
2317 |
+
action: 'gawd_export',
|
2318 |
+
_data_compare: _data_compare,
|
2319 |
+
second_data_sum: jQuery('#second_data_sum').val(),
|
2320 |
+
first_data_sum: jQuery('#first_data_sum').val(),
|
2321 |
+
second_end_date: d_end_date,
|
2322 |
+
second_start_date: d_start_date,
|
2323 |
+
second_data: jQuery('#second_data').val(),
|
2324 |
+
first_data: jQuery('#first_data').val(),
|
2325 |
+
gawd_dimension: dimension,
|
2326 |
+
img:url,
|
2327 |
+
gawd_metric: metric,
|
2328 |
+
gawd_metric_compare: metric_compare,
|
2329 |
+
gawd_start_date: start_date,
|
2330 |
+
gawd_end_date: end_date,
|
2331 |
+
filter_type: filter_type,
|
2332 |
+
gawd_email_period: gawd_email_period,
|
2333 |
+
gawd_email_month_day: month_day,
|
2334 |
+
gawd_email_week_day: week_day,
|
2335 |
+
email_time: email_time,
|
2336 |
+
gawd_email_to: gawd_email_to,
|
2337 |
+
gawd_email_from: gawd_email_from,
|
2338 |
+
gawd_email_subject: gawd_email_subject,
|
2339 |
+
gawd_email_body: gawd_email_body,
|
2340 |
+
view_id: view_id,
|
2341 |
+
report_type: report_type,
|
2342 |
+
export_type: export_type,
|
2343 |
+
tab_name: d_tab_name[1],
|
2344 |
+
sort: order.order,
|
2345 |
+
sort_by: order.order_by,
|
2346 |
+
security: gawd_admin.ajaxnonce,
|
2347 |
+
}).done(function (data) {
|
2348 |
+
result = JSON.parse(data);
|
2349 |
+
if(result.status=='success'){
|
2350 |
+
jQuery('.gawd_email_body').hide();
|
2351 |
+
jQuery('#loading_div').css('z-index','99999');
|
2352 |
+
jQuery('#loading_div').hide();
|
2353 |
+
jQuery('.email_message_cont').show();
|
2354 |
+
jQuery('.email_message_cont').html(result.msg);
|
2355 |
+
}
|
2356 |
+
|
2357 |
+
})
|
2358 |
+
}
|
2359 |
+
}
|
2360 |
+
|
2361 |
+
function numFormat( cellvalue, options, rowObject ){
|
2362 |
+
if(typeof options != 'undefined' ){
|
2363 |
+
if(options.colModel.index != 'Pageviews Per Session' && options.colModel.index != 'Pageviews Per Session compare'){
|
2364 |
+
if(options.colModel.index.indexOf('compare') > -1){
|
2365 |
+
//options.colModel.index = options.colModel.index.replace(' compare','');
|
2366 |
+
var percentage_of_total = isNaN(cellvalue/data_of_compared.data_sum[options.colModel.index]) ? 0 : ((cellvalue/data_of_compared.data_sum[options.colModel.index])*100).toFixed(2);
|
2367 |
+
}
|
2368 |
+
else{
|
2369 |
+
if(typeof _data != 'undefined'){
|
2370 |
+
var percentage_of_total = isNaN(cellvalue/_data.data_sum[options.colModel.index]) ? 0 : ((cellvalue/_data.data_sum[options.colModel.index])*100).toFixed(2);
|
2371 |
+
}
|
2372 |
+
}
|
2373 |
+
var sum_percent = typeof percentage_of_total != 'undefined' ? ' <span class="row_percent">(' + percentage_of_total +'%)</span>' : '';
|
2374 |
+
return typeof cellvalue != 'undefined' ? cellvalue.toLocaleString() + sum_percent : '' ;
|
2375 |
+
}
|
2376 |
+
}
|
2377 |
+
return typeof cellvalue != 'undefined' ? cellvalue.toLocaleString() : '' ;
|
2378 |
+
}
|
2379 |
+
function timeFormat( cellvalue, options, rowObject ){
|
2380 |
+
if(typeof cellvalue == 'string'){
|
2381 |
+
if(cellvalue.indexOf(':') > -1){
|
2382 |
+
return cellvalue;
|
2383 |
+
}
|
2384 |
+
}
|
2385 |
+
var hours = (Math.floor(cellvalue / 3600)).toString().length < 2 ? '0' + Math.floor(cellvalue / 3600) : Math.floor(cellvalue / 3600);
|
2386 |
+
var mins = (Math.floor(cellvalue / 60 % 60)).toString().length < 2 ? '0' + Math.floor(cellvalue / 60 % 60) : Math.floor(cellvalue / 60 % 60);
|
2387 |
+
var secs = (Math.ceil(cellvalue % 60)).toString().length < 2 ? '0' + Math.ceil(cellvalue % 60) : Math.ceil(cellvalue % 60);
|
2388 |
+
metric_value = hours + ':' + mins + ':' + secs;
|
2389 |
+
return metric_value;
|
2390 |
+
}
|
2391 |
+
function percentFormat( cellvalue, options, rowObject ){
|
2392 |
+
return parseFloat(cellvalue).toFixed(2) + "%";
|
2393 |
+
}
|
2394 |
+
function dollarFormat( cellvalue, options, rowObject ){
|
2395 |
+
if(typeof options != 'undefined' ){
|
2396 |
+
var percentage_of_total = isNaN(cellvalue/_data.data_sum[options.colModel.index]) ? 0 : ((cellvalue/_data.data_sum[options.colModel.index])*100).toFixed(2);
|
2397 |
+
return '$<span class="row_percent">' + parseFloat(cellvalue).toFixed(2) + ' (' + percentage_of_total +'%)</span>';
|
2398 |
+
}
|
2399 |
+
return "$" + parseFloat(cellvalue).toFixed(2);
|
2400 |
+
}
|
2401 |
+
function secFormat( cellvalue, options, rowObject ){
|
2402 |
+
if(cellvalue == '1801'){
|
2403 |
+
return cellvalue.toLocaleString() + "+ seconds";
|
2404 |
+
}
|
2405 |
+
return cellvalue.toLocaleString() + " seconds";
|
2406 |
+
}
|
2407 |
+
function sec_to_normal(data){
|
2408 |
+
var hours = (Math.floor(data / 3600)).toString().length < 2 ? '0' + Math.floor(data / 3600) : Math.floor(data / 3600);
|
2409 |
+
var mins = (Math.floor(data / 60 % 60)).toString().length < 2 ? '0' + Math.floor(data / 60 % 60) : Math.floor(data / 60 % 60);
|
2410 |
+
var secs = (Math.ceil(data % 60)).toString().length < 2 ? '0' + Math.ceil(data % 60) : Math.ceil(data % 60);
|
2411 |
+
return data = hours + ':' + mins + ':' + secs;
|
2412 |
+
}
|
2413 |
+
var gawd_data_table = null;
|
2414 |
+
function gawd_draw_table_pages_compare(_data, data, dimension, data_sum, _data_sum,start_date, end_date){
|
2415 |
+
_data = JSON.parse(_data);
|
2416 |
+
data = JSON.parse(data);
|
2417 |
+
var metrics = Object.keys(_data[0]);
|
2418 |
+
var all_pages = new Array();
|
2419 |
+
var max_length_data = _data.length >= data.length ? _data : data;
|
2420 |
+
var min_length_data = _data.length >= data.length ? data : _data;
|
2421 |
+
|
2422 |
+
var max_length = max_length_data.length;
|
2423 |
+
var min_length = min_length_data.length;
|
2424 |
+
|
2425 |
+
var min_paths = [];
|
2426 |
+
for(var i=0 ;i<min_length; i++){
|
2427 |
+
min_paths.push(min_length_data[i][metrics[1]]);
|
2428 |
+
}
|
2429 |
+
|
2430 |
+
for(var i=0 ;i<max_length; i++){
|
2431 |
+
all_pages[max_length_data[i][metrics[1]]] = new Array();
|
2432 |
+
all_pages[max_length_data[i][metrics[1]]][0] = max_length_data[i];
|
2433 |
+
if(typeof min_length_data[i] == 'undefined' || min_paths.indexOf(max_length_data[i][metrics[1]]) == -1){
|
2434 |
+
all_pages[max_length_data[i][metrics[1]]][1] = 'no';
|
2435 |
+
}
|
2436 |
+
else{
|
2437 |
+
var key = i;
|
2438 |
+
for(var j=0; j<min_length; j++){
|
2439 |
+
if(min_length_data[j][metrics[1]] == max_length_data[i][metrics[1]]){
|
2440 |
+
key = j;
|
2441 |
+
break;
|
2442 |
+
}
|
2443 |
+
}
|
2444 |
+
all_pages[max_length_data[i][metrics[1]]][1] = min_length_data[key];
|
2445 |
+
}
|
2446 |
+
}
|
2447 |
+
|
2448 |
+
var table = '';
|
2449 |
+
table += '<thead>';
|
2450 |
+
table += '<tr>';
|
2451 |
+
for(var j=0 ;j<metrics.length; j++){
|
2452 |
+
table += '<th>' + metrics[j] + '</th>';
|
2453 |
+
}
|
2454 |
+
table += '</tr>';
|
2455 |
+
table += '<tr>';
|
2456 |
+
for(var j=0 ;j<metrics.length; j++){
|
2457 |
+
|
2458 |
+
if(metrics[j] == 'No' || metrics[j] == 'Page Path' || metrics[j] == 'Landing Page'){
|
2459 |
+
table += '<td></td>';
|
2460 |
+
}
|
2461 |
+
else{
|
2462 |
+
_data_sum[metrics[j]] = parseFloat(_data_sum[metrics[j]]);
|
2463 |
+
data_sum[metrics[j]] = parseFloat(data_sum[metrics[j]]);
|
2464 |
+
var arrow = '<img src=""/>';
|
2465 |
+
var percent = (((_data_sum[metrics[j]] - data_sum[metrics[j]])/data_sum[metrics[j]]) * 100).toFixed(2);
|
2466 |
+
if(isNaN(percent)){
|
2467 |
+
percent = 0;
|
2468 |
+
}
|
2469 |
+
else if(percent.indexOf('-') > -1){
|
2470 |
+
percent = percent.substr(1);
|
2471 |
+
arrow = '<img src="' + gawd_admin.gawd_plugin_url + '/assets/arrow-down.png"/>';
|
2472 |
+
}
|
2473 |
+
else{
|
2474 |
+
arrow = '<img src="' + gawd_admin.gawd_plugin_url + '/assets/arrow-up.png"/>';
|
2475 |
+
}
|
2476 |
+
percent = percent == 'Infinity' ? 100 : percent;
|
2477 |
+
table += '<td style="font-weight:bold; width: 9%;"><div>' + percent + '%' + arrow + '</div>';
|
2478 |
+
var data_sum_value = data_sum[metrics[j]].toLocaleString();
|
2479 |
+
var _data_sum_value = _data_sum[metrics[j]].toLocaleString();
|
2480 |
+
if(metrics[j] == 'Avg Time On Page' || metrics[j] == 'Avg Page Load Time' || metrics[j] == 'Avg Session Duration'){
|
2481 |
+
data_sum_value = sec_to_normal(parseFloat(data_sum_value));
|
2482 |
+
_data_sum_value = sec_to_normal(parseFloat(_data_sum_value));
|
2483 |
+
}
|
2484 |
+
if(metrics[j] == 'Bounce Rate' || metrics[j] == 'Exit Rate' || metrics[j] == 'Percent New Sessions' || metrics[j] == 'Ecommerce Conversion Rate'){
|
2485 |
+
_data_sum_value = parseFloat(_data_sum_value).toFixed(2) + '%';
|
2486 |
+
data_sum_value = parseFloat(data_sum_value).toFixed(2) + '%';
|
2487 |
+
}
|
2488 |
+
else if(metrics[j] == 'Page Value' || metrics[j] == 'Revenue'){
|
2489 |
+
_data_sum_value = '$' + parseFloat(_data_sum_value).toFixed(2);
|
2490 |
+
data_sum_value = '$' + parseFloat(data_sum_value).toFixed(2);
|
2491 |
+
}
|
2492 |
+
table += '<div>' + _data_sum_value + ' vs ' + data_sum_value + '</div>';
|
2493 |
+
table += '</td>';
|
2494 |
+
}
|
2495 |
+
}
|
2496 |
+
table += '</tr>';
|
2497 |
+
table += '</thead>';
|
2498 |
+
table += '<tbody class="gawd_datatable_hide_button">';
|
2499 |
+
|
2500 |
+
Object.size = function(obj) {
|
2501 |
+
var size = 0, key;
|
2502 |
+
for (key in obj) {
|
2503 |
+
if (obj.hasOwnProperty(key)) size++;
|
2504 |
+
}
|
2505 |
+
return size;
|
2506 |
+
};
|
2507 |
+
var length = Object.size(all_pages);
|
2508 |
+
var keys = Object.keys(all_pages);
|
2509 |
+
for(var i=0 ;i<length; i++){
|
2510 |
+
table += '<tr>';
|
2511 |
+
table += '<td>' + parseInt(i+1) +'</td>';
|
2512 |
+
table += '<td>' + keys[i] +'</td>';
|
2513 |
+
table += '<td></td>';
|
2514 |
+
table += '<td></td>';
|
2515 |
+
table += '<td></td>';
|
2516 |
+
table += '<td></td>';
|
2517 |
+
table += '<td></td>';
|
2518 |
+
table += '<td></td>';
|
2519 |
+
table += '<td></td>';
|
2520 |
+
table += '<td></td>';
|
2521 |
+
table += '</tr>';
|
2522 |
+
|
2523 |
+
table += '<tr>';
|
2524 |
+
for(var j = 0; j < metrics.length; j++){
|
2525 |
+
if(metrics[j] == 'No'){
|
2526 |
+
table += '<td ></td>';
|
2527 |
+
}
|
2528 |
+
else if(metrics[j] == 'Page Path' || metrics[j] == 'Landing Page'){
|
2529 |
+
table += '<td>' + Date.parse(d_start_date).toString('MMMM dd, yyyy') + ' - ' + Date.parse(d_end_date).toString('MMMM dd, yyyy') +'</td>';
|
2530 |
+
}
|
2531 |
+
else{
|
2532 |
+
if(all_pages[keys[i]][0] != 'no'){
|
2533 |
+
var line_value = all_pages[keys[i]][0][metrics[j]].toLocaleString();
|
2534 |
+
if(metrics[j] == 'Bounce Rate' || metrics[j] == 'Exit Rate' || metrics[j] == 'Percent New Sessions' || metrics[j] == 'Ecommerce Conversion Rate'){
|
2535 |
+
line_value = parseFloat(line_value).toFixed(2) + '%';
|
2536 |
+
}
|
2537 |
+
else if(metrics[j] == 'Page Value' || metrics[j] == 'Transaction Revenue' || metrics[j] == 'Revenue'){
|
2538 |
+
var percentage_of_total = isNaN(parseFloat(line_value)/_data_sum[metrics[j]]) ? 0 : ((parseFloat(line_value)/_data_sum[metrics[j]])*100).toFixed(2);
|
2539 |
+
line_value = parseFloat(line_value).toFixed(2) + '$ <span class="row_percent">(' + percentage_of_total +'%)</span>';
|
2540 |
+
}
|
2541 |
+
else if(metrics[j] == 'Avg Time On Page' || metrics[j] == 'Avg Page Load Time' || metrics[j] == 'Avg Session Duration'){
|
2542 |
+
line_value = line_value.indexOf(':') > -1 ? line_value : sec_to_normal(parseFloat(line_value));
|
2543 |
+
}
|
2544 |
+
else{
|
2545 |
+
var percentage_of_total = isNaN(parseFloat(line_value)/_data_sum[metrics[j]]) ? 0 : ((parseFloat(line_value)/_data_sum[metrics[j]])*100).toFixed(2);
|
2546 |
+
line_value = (line_value).toLocaleString() + ' <span class="row_percent">(' + percentage_of_total +'%)</span>';
|
2547 |
+
}
|
2548 |
+
table += '<td>' + line_value + '</td>';
|
2549 |
+
}
|
2550 |
+
else{
|
2551 |
+
table += '<td>0</td>';
|
2552 |
+
}
|
2553 |
+
}
|
2554 |
+
}
|
2555 |
+
table += '</tr>';
|
2556 |
+
table += '<tr>';
|
2557 |
+
for(var j = 0; j < metrics.length; j++){
|
2558 |
+
if(metrics[j] == 'No'){
|
2559 |
+
table += '<td></td>';
|
2560 |
+
}
|
2561 |
+
else if(metrics[j] == 'Page Path' || metrics[j] == 'Landing Page'){
|
2562 |
+
table += '<td>' + Date.parse(start_date).toString('MMMM dd, yyyy') + ' - ' + Date.parse(end_date).toString('MMMM dd, yyyy') +'</td>';
|
2563 |
+
}
|
2564 |
+
else{
|
2565 |
+
if(all_pages[keys[i]][1] != 'no'){
|
2566 |
+
var line_value = all_pages[keys[i]][1][metrics[j]].toLocaleString();
|
2567 |
+
if(metrics[j] == 'Bounce Rate' || metrics[j] == 'Exit Rate' || metrics[j] == 'Percent New Sessions' || metrics[j] == 'Ecommerce Conversion Rate'){
|
2568 |
+
line_value = parseFloat(line_value).toFixed(2) + '%';
|
2569 |
+
}
|
2570 |
+
else if(metrics[j] == 'Page Value' || metrics[j] == 'Transaction Revenue' || metrics[j] == 'Revenue'){
|
2571 |
+
var percentage_of_total = isNaN(parseFloat(line_value)/data_sum[metrics[j]]) ? 0 : ((parseFloat(line_value)/data_sum[metrics[j]])*100).toFixed(2);
|
2572 |
+
line_value = parseFloat(line_value).toFixed(2) + '$ <span class="row_percent">(' + percentage_of_total +'%)</span>';
|
2573 |
+
}
|
2574 |
+
else if(metrics[j] == 'Avg Time On Page' || metrics[j] == 'Avg Page Load Time' || metrics[j] == 'Avg Session Duration'){
|
2575 |
+
line_value = line_value.indexOf(':') > -1 ? line_value : sec_to_normal(parseFloat(line_value));
|
2576 |
+
}
|
2577 |
+
else{
|
2578 |
+
var percentage_of_total = isNaN(parseFloat(line_value)/data_sum[metrics[j]]) ? 0 : ((parseFloat(line_value)/data_sum[metrics[j]])*100).toFixed(2);
|
2579 |
+
line_value = (line_value).toLocaleString() + ' <span class="row_percent">(' + percentage_of_total +'%)</span>';
|
2580 |
+
}
|
2581 |
+
table += '<td>' + line_value + '</td>';
|
2582 |
+
}
|
2583 |
+
else{
|
2584 |
+
table += '<td>0</td>';
|
2585 |
+
}
|
2586 |
+
}
|
2587 |
+
}
|
2588 |
+
table += '</tr>';
|
2589 |
+
for(var j = 0; j < metrics.length; j++){
|
2590 |
+
if(metrics[j] == 'No'){
|
2591 |
+
table += '<td></td>';
|
2592 |
+
}
|
2593 |
+
else if(metrics[j] == 'Page Path' || metrics[j] == 'Landing Page'){
|
2594 |
+
table += '<td style="font-weight:bold;">% Change</td>';
|
2595 |
+
}
|
2596 |
+
else{
|
2597 |
+
if(all_pages[keys[i]][0] != 'no'){
|
2598 |
+
_single_data = all_pages[keys[i]][0][metrics[j]];
|
2599 |
+
}
|
2600 |
+
else{
|
2601 |
+
_single_data = 0;
|
2602 |
+
}
|
2603 |
+
if(all_pages[keys[i]][1] != 'no'){
|
2604 |
+
single_data = all_pages[keys[i]][1][metrics[j]];
|
2605 |
+
}
|
2606 |
+
else{
|
2607 |
+
single_data = 0;
|
2608 |
+
}
|
2609 |
+
if(metrics[j] == 'Avg Time On Page' || metrics[j] == 'Avg Page Load Time' || metrics[j] == 'Avg Session Duration'){
|
2610 |
+
|
2611 |
+
_single_data = _single_data.toString().split(":");
|
2612 |
+
|
2613 |
+
if(_single_data[0].indexOf('0') == 0){
|
2614 |
+
_single_data[0] = _single_data[0].substr(1);
|
2615 |
+
_single_data[0] = _single_data[0];
|
2616 |
+
}
|
2617 |
+
if(_single_data.length > 1){
|
2618 |
+
if(_single_data[1].indexOf('0') == 0){
|
2619 |
+
_single_data[1] = _single_data[1].substr(1);
|
2620 |
+
_single_data[1] = _single_data[1]*60;
|
2621 |
+
}
|
2622 |
+
if(_single_data[2].indexOf('0') == 0){
|
2623 |
+
_single_data[2] = _single_data[2].substr(1);
|
2624 |
+
_single_data[2] = _single_data[2];
|
2625 |
+
}
|
2626 |
+
}
|
2627 |
+
var a = typeof _single_data[0] == 'undefined' ? 0 : parseInt(_single_data[0]);
|
2628 |
+
var b = typeof _single_data[1] == 'undefined' ? 0 : parseInt(_single_data[1]);
|
2629 |
+
var c = typeof _single_data[2] == 'undefined' ? 0 : parseInt(_single_data[2]);
|
2630 |
+
_single_data = a + b + c;
|
2631 |
+
single_data = single_data.toString().split(":");
|
2632 |
+
if(single_data[0].indexOf('0') == 0){
|
2633 |
+
single_data[0] = single_data[0].substr(1);
|
2634 |
+
single_data[0] = single_data[0];
|
2635 |
+
}
|
2636 |
+
if(single_data.length > 1){
|
2637 |
+
if(single_data[1].indexOf('0') == 0){
|
2638 |
+
single_data[1] = single_data[1].substr(1);
|
2639 |
+
single_data[1] = single_data[1]*60;
|
2640 |
+
}
|
2641 |
+
if(single_data[2].indexOf('0') == 0){
|
2642 |
+
single_data[2] = single_data[2].substr(1);
|
2643 |
+
single_data[2] = single_data[2];
|
2644 |
+
}
|
2645 |
+
}
|
2646 |
+
var a = typeof single_data[0] == 'undefined' ? 0 : parseInt(single_data[0]);
|
2647 |
+
var b = typeof single_data[1] == 'undefined' ? 0 : parseInt(single_data[1]);
|
2648 |
+
var c = typeof single_data[2] == 'undefined' ? 0 : parseInt(single_data[2]);
|
2649 |
+
single_data = a + b + c;
|
2650 |
+
}
|
2651 |
+
var single_percent = (((_single_data - single_data)/single_data) * 100).toFixed(2);
|
2652 |
+
single_percent = isNaN(single_percent) ? '∞' : isFinite(single_percent) ? single_percent : '∞';
|
2653 |
+
table += '<td style="font-weight:bold;">' + single_percent + '%</td>';
|
2654 |
+
}
|
2655 |
+
}
|
2656 |
+
}
|
2657 |
+
table += '</tbody>';
|
2658 |
+
table += '</table>';
|
2659 |
+
|
2660 |
+
|
2661 |
+
if(gawd_data_table!=null){
|
2662 |
+
gawd_data_table.destroy();
|
2663 |
+
gawd_data_table = null;
|
2664 |
+
}
|
2665 |
+
|
2666 |
+
jQuery('.gawd_data_table table').html(table);
|
2667 |
+
gawd_data_table = jQuery('.gawd_data_table table').DataTable( {
|
2668 |
+
"ordering": false,
|
2669 |
+
searching: false
|
2670 |
+
});
|
2671 |
+
|
2672 |
+
}
|
2673 |
+
|
2674 |
+
function gawd_draw_table(data, metric, metric_compare, dimension, dataSums) {
|
2675 |
+
jQuery('.gawd_page_table').remove();
|
2676 |
+
jQuery('.paging-nav').remove();
|
2677 |
+
if(typeof data == 'undefined'){
|
2678 |
+
return;
|
2679 |
+
}
|
2680 |
+
if(typeof dataSums == 'undefined'){
|
2681 |
+
dataSums = false;
|
2682 |
+
}
|
2683 |
+
data = dimension != 'Active Page' ? JSON.parse(data) : data;
|
2684 |
+
var data_sum = 0;
|
2685 |
+
var data_sum_compare = 0;
|
2686 |
+
var col_total = false;
|
2687 |
+
if (typeof data.data_sum != "undefined" || dataSums){
|
2688 |
+
col_total = true;
|
2689 |
+
if(dimension == 'pagePath' || dimension == 'landingPagePath' || dimension == 'Active Page'){
|
2690 |
+
data_sum = data.data_sum;
|
2691 |
+
data = data.chart_data;
|
2692 |
+
|
2693 |
+
}
|
2694 |
+
else{
|
2695 |
+
metric = metric.replace(/([A-Z])/g, "$1").trim();
|
2696 |
+
metric = metric.charAt(0).toUpperCase() + metric.slice(1);
|
2697 |
+
metric = metric.replace(/ +/g, ' ');
|
2698 |
+
if(!dataSums){
|
2699 |
+
data_sum = data.data_sum[metric];
|
2700 |
+
data_sum_origin = data.data_sum[metric];
|
2701 |
+
if(data.data_sum[metric] == 0){
|
2702 |
+
data_sum = 1;
|
2703 |
+
}
|
2704 |
+
if(metric_compare != 0 || metric_compare != ""){
|
2705 |
+
data_sum_compare = data.data_sum[metric_compare];
|
2706 |
+
data_sum_compare_origin = data.data_sum[metric_compare];
|
2707 |
+
if(data.data_sum[metric_compare] == 0){
|
2708 |
+
data_sum_compare = 1;
|
2709 |
+
}
|
2710 |
+
}
|
2711 |
+
data = data.chart_data;
|
2712 |
+
}
|
2713 |
+
else{
|
2714 |
+
data_sum = dataSums[metric][metric];
|
2715 |
+
data_sum_compare = dataSums[metric][metric + ' compare'];
|
2716 |
+
data_sum_origin = dataSums[metric][metric];
|
2717 |
+
data_sum_compare_origin = dataSums[metric][metric + ' compare'];
|
2718 |
+
}
|
2719 |
+
}
|
2720 |
+
}
|
2721 |
+
|
2722 |
+
var count = 0;
|
2723 |
+
for (var property in data[0]) {
|
2724 |
+
if (Object.prototype.hasOwnProperty.call(data[0], property)) {
|
2725 |
+
count++;
|
2726 |
+
}
|
2727 |
+
}
|
2728 |
+
|
2729 |
+
if (dimension == "pagePath" || dimension == "landingPagePath" || dimension == "daysToTransaction" || dimension == "transactionId" ||(dimension == "date" && metric == 'transactionRevenue')) {
|
2730 |
+
if (typeof data[0] != 'undefined') {
|
2731 |
+
labels = Object.keys(data[0]);
|
2732 |
+
|
2733 |
+
} else {
|
2734 |
+
labels = ['No', dimension, metric];
|
2735 |
+
count = 3;
|
2736 |
+
}
|
2737 |
+
}
|
2738 |
+
else {
|
2739 |
+
if (metric_compare != 0) {
|
2740 |
+
if(metric+" compare" === metric_compare){
|
2741 |
+
labels = ['No', dimension, dimension + ' compare', metric, metric_compare];
|
2742 |
+
count = 5;
|
2743 |
+
}else{
|
2744 |
+
labels = ['No', dimension, metric, metric_compare];
|
2745 |
+
count = 4;
|
2746 |
+
}
|
2747 |
+
} else {
|
2748 |
+
labels = ['No', dimension, metric];
|
2749 |
+
count = 3;
|
2750 |
+
}
|
2751 |
+
}
|
2752 |
+
var colModel = [];
|
2753 |
+
var width = 15;
|
2754 |
+
if (dimension == "pagePath") {
|
2755 |
+
width = 40;
|
2756 |
+
}
|
2757 |
+
colModel.push({name: labels[0], index: labels[0], sorttype: 'int', width: width});
|
2758 |
+
if(labels[1] == 'Days To Transaction'){
|
2759 |
+
colModel.push({name: labels[1], index: labels[1], sorttype: 'int'});
|
2760 |
+
}
|
2761 |
+
else if(labels[1] == 'Session Duration Bucket'){
|
2762 |
+
colModel.push({name: labels[1], index: labels[1], formatter:secFormat});
|
2763 |
+
}
|
2764 |
+
else{
|
2765 |
+
colModel.push({name: labels[1], index: labels[1]});
|
2766 |
+
}
|
2767 |
+
for (var i = 2; i < count; i++) {
|
2768 |
+
if(labels[i] == 'Avg Session Duration' || labels[i] == 'Avg Session Duration compare' || labels[i] == 'Avg Page Load Time' || labels[i] == 'Avg Redirection Time' || labels[i] == 'Avg Server Response Time' || labels[i] == 'Avg Page Download Time' || labels[i] == 'Avg Page Load Time compare' || labels[i] == 'Avg Redirection Time compare' || labels[i] == 'Avg Server Response Time compare' || labels[i] == 'Avg Page Download Time compare' || labels[i] == 'Duration' || labels[i] == 'Avg Time On Page'){
|
2769 |
+
colModel.push({name: labels[i], index: labels[i], sorttype: 'int',editable: true, formatter:timeFormat});
|
2770 |
+
}
|
2771 |
+
else if(labels[i] == 'Bounce Rate' || labels[i] == 'Bounce Rate compare' || labels[i] == 'Transactions Per Session' || labels[i] == 'Transactions Per Session compare' || labels[i] == 'Exit Rate' || labels[i] == 'Percent New Sessions' || labels[i] == 'Percent New Sessions compare'){
|
2772 |
+
colModel.push({name: labels[i], index: labels[i], sorttype: 'int',editable: true, formatter:percentFormat});
|
2773 |
+
}
|
2774 |
+
else if(labels[i] == dimension + ' compare'){
|
2775 |
+
colModel.push({name: labels[i], index: labels[i] });
|
2776 |
+
}
|
2777 |
+
else if(labels[i].indexOf('Revenue') > -1 || labels[i] == 'Page Value'){
|
2778 |
+
colModel.push({name: labels[i], index: labels[i], sorttype: 'int',editable: true, formatter:dollarFormat});
|
2779 |
+
}
|
2780 |
+
else{
|
2781 |
+
colModel.push({name: labels[i], index: labels[i], sorttype: 'int',editable: true, formatter:numFormat});
|
2782 |
+
}
|
2783 |
+
}
|
2784 |
+
|
2785 |
+
|
2786 |
+
|
2787 |
+
if(gawd_data_table!=null){
|
2788 |
+
gawd_data_table.destroy();
|
2789 |
+
gawd_data_table = null;
|
2790 |
+
}
|
2791 |
+
var table_tfoot = "";
|
2792 |
+
|
2793 |
+
var table_columns = jQuery.map(colModel, function(value, index) {
|
2794 |
+
table_tfoot += '<th data-value="'+value.name+'"></th>';
|
2795 |
+
return {title: value.name};
|
2796 |
+
});
|
2797 |
+
|
2798 |
+
var array = jQuery.map(data, function(value, index) {
|
2799 |
+
var datatable_row_data = gawd_datatable_formater(colModel , value);
|
2800 |
+
return [datatable_row_data];
|
2801 |
+
});
|
2802 |
+
|
2803 |
+
jQuery('.gawd_data_table table').html("<thead></thead><tbody></tbody><tfoot><tr>"+table_tfoot+"</tr></tfoot>");
|
2804 |
+
|
2805 |
+
if(dimension == 'pagePath' || dimension == 'landingPagePath' || dimension == 'Active Page'){
|
2806 |
+
|
2807 |
+
metric = dimension == 'pagePath' ? ['Avg Page Load Time','Avg Time On Page','Bounce Rate','Entrances','Exit Rate','Page Value','Pageviews','Unique Pageviews'] : ['Sessions','Percent New Sessions','New Users','Bounce Rate','Pageviews Per Session','Avg Session Duration','Transactions','Transaction Revenue','Transactions Per Session'];
|
2808 |
+
for(var i = 0; i < metric.length; i++){
|
2809 |
+
_data_sum = data_sum[metric[i]];
|
2810 |
+
var sum = {};
|
2811 |
+
var colSum = parseFloat(_data_sum).toFixed(2);
|
2812 |
+
if(metric[i] == 'Avg Time On Page' || metric[i] == 'Avg Session Duration' || metric[i] == 'Avg Page Load Time'){
|
2813 |
+
colSum = sec_to_normal(colSum);
|
2814 |
+
}
|
2815 |
+
if(metric[i] == 'Percent New Sessions' || metric[i] == 'Avg Session Duration' || metric[i] == 'Transactions Per Session' || metric[i] == 'Avg Time On Page' || metric[i] == 'Exit Rate' || metric[i] == 'Pageviews Per Session'|| metric[i] == 'Bounce Rate' || metric[i] == 'Avg Page Load Time' || metric[i] == 'Page Value'){
|
2816 |
+
sum[metric[i]] = 'Avg: ' + colSum;
|
2817 |
+
if(metric[i] == 'Percent New Sessions' || metric[i] == 'Bounce Rate' || metric[i] == 'Transactions Per Session' || metric[i] == 'Exit Rate'){
|
2818 |
+
sum[metric[i]] = 'Avg: ' + colSum + '%';
|
2819 |
+
}
|
2820 |
+
else if(metric[i] == 'Page Value'){
|
2821 |
+
sum[metric[i]] = 'Avg: ' + '$' + colSum;
|
2822 |
+
}
|
2823 |
+
}
|
2824 |
+
else{
|
2825 |
+
sum[metric[i]] = 'Total: ' + colSum;
|
2826 |
+
}
|
2827 |
+
if(colSum != ""){
|
2828 |
+
gawd_datatable_footer(sum);
|
2829 |
+
}
|
2830 |
+
}
|
2831 |
+
}
|
2832 |
+
else{
|
2833 |
+
if(typeof data_sum_origin != "undefined"){
|
2834 |
+
var colSum = parseFloat(data_sum_origin).toLocaleString();
|
2835 |
+
}else{
|
2836 |
+
var colSum = "";
|
2837 |
+
}
|
2838 |
+
var sum = {};
|
2839 |
+
if(metric == 'Avg Session Duration' || metric == 'Avg Page Load Time' || metric == 'Avg Redirection Time' || metric == 'Avg Server Response Time' || metric == 'Avg Page Download Time' || metric == 'Duration'){
|
2840 |
+
colSum = sec_to_normal(colSum);
|
2841 |
+
//gawd_datatable_footer(colSum)
|
2842 |
+
}
|
2843 |
+
sum[metric] = metric == 'Avg Session Duration' || metric == 'Avg Page Load Time' || metric == 'Avg Redirection Time' || metric == 'Avg Server Response Time' || metric == 'Avg Page Download Time' || metric == 'Duration' ? 'Average: ' + colSum : metric == 'Percent New Sessions' || metric == 'Bounce Rate' || metric == 'Transactions Per Session' ? 'Average: ' + colSum + '%': 'Total: ' + colSum;
|
2844 |
+
if(colSum != ""){
|
2845 |
+
gawd_datatable_footer(sum);
|
2846 |
+
}
|
2847 |
+
if(metric_compare != 0 || metric_compare != "" ){
|
2848 |
+
|
2849 |
+
var colSum_compare = parseFloat(data_sum_compare_origin).toLocaleString();
|
2850 |
+
if(metric_compare == 'Avg Session Duration' || metric + ' compare' == 'Avg Session Duration compare' || metric_compare == 'Avg Page Load Time' || metric_compare == 'Avg Redirection Time' || metric_compare == 'Avg Server Response Time' || metric_compare == 'Avg Page Download Time' || metric + " compare" == 'Avg Page Load Time compare' || metric + " compare" == 'Avg Redirection Time compare' || metric + " compare" == 'Avg Server Response Time compare' || metric + " compare" == 'Avg Page Download Time compare' || metric_compare == 'Duration'){
|
2851 |
+
colSum_compare = sec_to_normal(colSum_compare);
|
2852 |
+
}
|
2853 |
+
var sum_compare = {};
|
2854 |
+
sum_compare[metric_compare] = metric_compare == 'Duration' || metric_compare == 'Avg Session Duration' || metric_compare == 'Avg Page Load Time' || metric_compare == 'Avg Redirection Time' || metric_compare == 'Avg Server Response Time' || metric_compare == 'Avg Page Download Time' || metric + " compare" == 'Avg Session Duration compare' || metric + " compare" == 'Avg Page Load Time compare' || metric + " compare" == 'Avg Redirection Time compare' || metric + " compare" == 'Avg Server Response Time compare' || metric + " compare" == 'Avg Page Download Time compare' ? 'Average: ' + colSum_compare : metric_compare == 'Percent New Sessions' || metric_compare == 'Bounce Rate' || metric_compare == 'Percent New Sessions compare' || metric_compare == 'Bounce Rate compare' || metric_compare == 'Transactions Per Session compare' || metric_compare == 'Pageviews Per Session' ? 'Average: ' + colSum_compare + '%' : 'Total: ' + colSum_compare;
|
2855 |
+
if(sum_compare != ""){
|
2856 |
+
gawd_datatable_footer(sum_compare);
|
2857 |
+
}
|
2858 |
+
}
|
2859 |
+
}
|
2860 |
+
|
2861 |
+
|
2862 |
+
|
2863 |
+
gawd_data_table = jQuery('.gawd_data_table table').DataTable( {
|
2864 |
+
data: array,
|
2865 |
+
columns: table_columns,
|
2866 |
+
responsive: true,
|
2867 |
+
});
|
2868 |
+
for (type in data[0]) {
|
2869 |
+
if(type != 'No'){
|
2870 |
+
geo_type = type;
|
2871 |
+
break;
|
2872 |
+
}
|
2873 |
+
}
|
2874 |
+
|
2875 |
+
|
2876 |
+
jQuery('#jqgh_griddiv_Language .s-ico').before('<span title="The language settings in your users browsers. Analytics uses the following ISO codes:Language 639 For example: en (English), en-us (English, United States), en-gb (English, Great Britain)" class="lang_info">?</span>');
|
2877 |
+
jQuery('#jqgh_griddiv_Language').tooltip();
|
2878 |
+
jQuery('.ui-search-toolbar th:first-child').css('background-color','#fff');
|
2879 |
+
jQuery('.ui-search-toolbar th:nth-child(2)').css('background-color','#fff');
|
2880 |
+
jQuery('.ui-search-toolbar th:last-child').css('background-color','#fff');
|
2881 |
+
jQuery('.ui-search-toolbar th:first-child table ').hide();
|
2882 |
+
jQuery('.ui-search-toolbar th:last-child table ').hide();
|
2883 |
+
if( jQuery('.ui-search-toolbar th').length >3){
|
2884 |
+
jQuery('.ui-search-toolbar th:nth-child(3)').css('background-color','#fff');
|
2885 |
+
jQuery('.ui-search-toolbar th:nth-child(3) table ').hide();
|
2886 |
+
}
|
2887 |
+
}
|
2888 |
+
function gawd_datatable_formater(colModel , rowObject) {
|
2889 |
+
var col_data = jQuery.map(colModel, function(value, index) {
|
2890 |
+
var col_model_name = value.index;
|
2891 |
+
var col_val;
|
2892 |
+
|
2893 |
+
if (
|
2894 |
+
typeof rowObject['date_period'] !== 'undefined' && rowObject['date_period'] !== '' &&
|
2895 |
+
(col_model_name === 'Week' || col_model_name === 'Week compare' || col_model_name === 'Month' || col_model_name === 'Month compare')
|
2896 |
+
) {
|
2897 |
+
if(col_model_name === 'Week compare' || col_model_name === 'Month compare'){
|
2898 |
+
col_val = rowObject['date_period compare'];
|
2899 |
+
}else{
|
2900 |
+
col_val = rowObject['date_period'];
|
2901 |
+
}
|
2902 |
+
} else {
|
2903 |
+
col_val = rowObject[col_model_name];
|
2904 |
+
}
|
2905 |
+
|
2906 |
+
|
2907 |
+
if(typeof value.formatter != "undefined" && typeof col_val != "undefined"){
|
2908 |
+
var col_value = value.formatter(col_val, {colModel:value}, rowObject);
|
2909 |
+
return col_value;
|
2910 |
+
}else{
|
2911 |
+
if(typeof col_val === "undefined"){
|
2912 |
+
col_val = "";
|
2913 |
+
}
|
2914 |
+
return col_val;
|
2915 |
+
}
|
2916 |
+
});
|
2917 |
+
return col_data;
|
2918 |
+
}
|
2919 |
+
function gawd_datatable_footer(sum) {
|
2920 |
+
jQuery.map(sum, function(value, index) {
|
2921 |
+
var table_footer_element = jQuery(".gawd_data_table table tfoot").find("[data-value='"+index+"']");
|
2922 |
+
table_footer_element.html(value);
|
2923 |
+
});
|
2924 |
+
|
2925 |
+
}
|
2926 |
+
function gawd_draw_analytics_country_type(country_name, geo_type) {
|
2927 |
+
if (jQuery("#gawd_chart_type").val() == 'pie') {
|
2928 |
+
gawd_draw_analytics_country_pie(country_name, geo_type);
|
2929 |
+
} else {
|
2930 |
+
gawd_draw_analytics_country(country_name, geo_type);
|
2931 |
+
}
|
2932 |
+
}
|
2933 |
+
function gawd_draw_analytics_country(country_name, geo_type) {
|
2934 |
+
console.log("ajax3");
|
2935 |
+
if (geo_type == 'Country') {
|
2936 |
+
jQuery('#country_filter_reset').show();
|
2937 |
+
}
|
2938 |
+
jQuery("#gawd_metric_compare").show();
|
2939 |
+
jQuery("#filter_conteiner").show();
|
2940 |
+
jQuery("#chartdiv").show();
|
2941 |
+
var _end_date = (Date.today().add(-1).days()).toString("yyyy-MM-dd");
|
2942 |
+
var start_date_7 = (Date.today().add(-1).days()).add(-7).days().toString("yyyy-MM-dd");
|
2943 |
+
var start_end_date = typeof jQuery('#gawd_start_end_date').val() != 'undefined' ? jQuery('#gawd_start_end_date').val() : start_date_7 + '/-/' + _end_date;
|
2944 |
+
|
2945 |
+
var start_end_date = start_end_date.split('/-/');
|
2946 |
+
var start_date = start_end_date[0];
|
2947 |
+
var end_date = start_end_date[1];
|
2948 |
+
var country_filter = country_name;
|
2949 |
+
metrics = [];
|
2950 |
+
var metric = jQuery("#gawd_metric").val();
|
2951 |
+
var metric_compare = jQuery("#gawd_metric_compare").val();
|
2952 |
+
metrics.push("ga:" + metric);
|
2953 |
+
if (metric_compare != 0) {
|
2954 |
+
metrics.push("ga:" + metric_compare);
|
2955 |
+
}
|
2956 |
+
if (jQuery("#gawd_chart_type").val() == 'line') {
|
2957 |
+
var chartType = 'line';
|
2958 |
+
var fillAlphas = 0;
|
2959 |
+
} else if (jQuery("#gawd_chart_type").val() == 'column') {
|
2960 |
+
var chartType = 'column';
|
2961 |
+
var fillAlphas = 1;
|
2962 |
+
}
|
2963 |
+
var dimension = country_filter == 'United States' ? 'Region' : 'City';
|
2964 |
+
var dimension_export = dimension;
|
2965 |
+
var metric_export = metric;
|
2966 |
+
var metric_compare_export = metric_compare == 0 ? '' : metric_compare;
|
2967 |
+
var parseDates = false;
|
2968 |
+
var rotateAngle = 90;
|
2969 |
+
var chartscrollbar = false;
|
2970 |
+
console.log("ajax12");
|
2971 |
+
jQuery.post(gawd_admin.ajaxurl, {
|
2972 |
+
action: 'show_data',
|
2973 |
+
start_date: start_date,
|
2974 |
+
end_date: end_date,
|
2975 |
+
metric: metrics,
|
2976 |
+
dimension: dimension,
|
2977 |
+
country_filter: country_filter,
|
2978 |
+
security: gawd_admin.ajaxnonce,
|
2979 |
+
geo_type: geo_type,
|
2980 |
+
beforeSend: function () {
|
2981 |
+
jQuery('#opacity_div').show();
|
2982 |
+
jQuery('#loading_div').show();
|
2983 |
+
}
|
2984 |
+
}).done(function (data) {
|
2985 |
+
jQuery('#opacity_div').hide();
|
2986 |
+
jQuery('#loading_div').hide();
|
2987 |
+
var result = JSON.parse(data).chart_data;
|
2988 |
+
jQuery("#chartdiv").show();
|
2989 |
+
metric = metric.replace(/([A-Z])/g, " $1").trim();
|
2990 |
+
metric = metric.charAt(0).toUpperCase() + metric.slice(1);
|
2991 |
+
metric = metric.replace(/ +/g, ' ');
|
2992 |
+
metric_compare = metric_compare.replace(/([A-Z])/g, " $1").trim();
|
2993 |
+
metric_compare = metric_compare.charAt(0).toUpperCase() + metric_compare.slice(1);
|
2994 |
+
metric_compare = metric_compare.replace(/ +/g, ' ');
|
2995 |
+
dimension = dimension.replace(/([A-Z])/g, " $1").trim();
|
2996 |
+
dimension = dimension.charAt(0).toUpperCase() + dimension.slice(1);
|
2997 |
+
filter_type = '';
|
2998 |
+
var tab_name = window.location.href.split('tab=');
|
2999 |
+
|
3000 |
+
d_start_date = start_date;
|
3001 |
+
d_end_date = end_date;
|
3002 |
+
d_metric_export = metric_export;
|
3003 |
+
d_metric_compare_export = metric_compare_export;
|
3004 |
+
d_dimension_export = dimension_export;
|
3005 |
+
|
3006 |
+
d_tab_name = tab_name;
|
3007 |
+
d_filter_type = filter_type;
|
3008 |
+
d_country_filter = country_name;
|
3009 |
+
d_geo_type = geo_type;
|
3010 |
+
/* jQuery("#gbox_griddiv").remove();
|
3011 |
+
var grid = '<table id="griddiv"></table>';
|
3012 |
+
jQuery('.gawd_chart_conteiner').append(grid); */
|
3013 |
+
jQuery("#gbox_griddiv").remove();
|
3014 |
+
var grid = '<table id="griddiv"></table><div id="pager"></div>';
|
3015 |
+
jQuery('.gawd_chart_conteiner').append(grid);
|
3016 |
+
gawd_draw_table(data, metric, metric_compare, dimension);
|
3017 |
+
})
|
3018 |
+
}
|
3019 |
+
|
3020 |
+
function gawd_draw_analytics_country_pie(country_name, geo_type) {
|
3021 |
+
if (geo_type == 'Country') {
|
3022 |
+
jQuery('#country_filter_reset').show();
|
3023 |
+
}
|
3024 |
+
jQuery("#gawd_metric_compare").show();
|
3025 |
+
jQuery("#filter_conteiner").show();
|
3026 |
+
jQuery("#chartdiv").show();
|
3027 |
+
var _end_date = (Date.today().add(-1).days()).toString("yyyy-MM-dd");
|
3028 |
+
var start_date_7 = (Date.today().add(-1).days()).add(-7).days().toString("yyyy-MM-dd");
|
3029 |
+
var start_end_date = typeof jQuery('#gawd_start_end_date').val() != 'undefined' ? jQuery('#gawd_start_end_date').val() : start_date_7 + '/-/' + _end_date;
|
3030 |
+
|
3031 |
+
var start_end_date = start_end_date.split('/-/');
|
3032 |
+
var start_date = start_end_date[0];
|
3033 |
+
var end_date = start_end_date[1];
|
3034 |
+
var country_filter = country_name;
|
3035 |
+
metrics = [];
|
3036 |
+
var metric = jQuery("#gawd_metric").val();
|
3037 |
+
var metric_compare = jQuery("#gawd_metric_compare").val();
|
3038 |
+
metrics.push("ga:" + metric);
|
3039 |
+
if (metric_compare != 0) {
|
3040 |
+
metrics.push("ga:" + metric_compare);
|
3041 |
+
}
|
3042 |
+
if (jQuery("#gawd_chart_type").val() == 'line') {
|
3043 |
+
var chartType = 'line';
|
3044 |
+
var fillAlphas = 0;
|
3045 |
+
} else if (jQuery("#gawd_chart_type").val() == 'column') {
|
3046 |
+
var chartType = 'column';
|
3047 |
+
var fillAlphas = 1;
|
3048 |
+
}
|
3049 |
+
var dimension = country_filter == 'United States' ? 'Region' : 'City';
|
3050 |
+
|
3051 |
+
var parseDates = false;
|
3052 |
+
var rotateAngle = 90;
|
3053 |
+
var chartscrollbar = false;
|
3054 |
+
console.log("ajax01");
|
3055 |
+
jQuery.post(gawd_admin.ajaxurl, {
|
3056 |
+
action: 'show_data',
|
3057 |
+
start_date: start_date,
|
3058 |
+
end_date: end_date,
|
3059 |
+
metric: metrics,
|
3060 |
+
dimension: dimension,
|
3061 |
+
country_filter: country_filter,
|
3062 |
+
security: gawd_admin.ajaxnonce,
|
3063 |
+
geo_type: geo_type,
|
3064 |
+
beforeSend: function () {
|
3065 |
+
jQuery('#opacity_div').show();
|
3066 |
+
jQuery('#loading_div').show();
|
3067 |
+
}
|
3068 |
+
}).done(function (data) {
|
3069 |
+
jQuery('#opacity_div').hide();
|
3070 |
+
jQuery('#loading_div').hide();
|
3071 |
+
var result = JSON.parse(data).chart_data;
|
3072 |
+
jQuery("#chartdiv").show();
|
3073 |
+
var dimension_export = dimension;
|
3074 |
+
var metric_export = metric;
|
3075 |
+
metric = metric.replace(/([A-Z])/g, " $1").trim();
|
3076 |
+
metric = metric.charAt(0).toUpperCase() + metric.slice(1);
|
3077 |
+
metric = metric.replace(/ +/g, ' ');
|
3078 |
+
var metric_compare_export = '';
|
3079 |
+
var filter_type = '';
|
3080 |
+
|
3081 |
+
//CANVAS//
|
3082 |
+
var tab_name = window.location.href.split('tab=');
|
3083 |
+
if (tab_name[1] != 'pagePath' && tab_name[1] != 'daysToTransaction') {
|
3084 |
+
var svg = document.getElementsByTagName('svg')[0];
|
3085 |
+
var canvas = document.getElementById("canvass");
|
3086 |
+
draw_canvas(svg, canvas);
|
3087 |
+
url = canvas.toDataURL();
|
3088 |
+
}
|
3089 |
+
if (typeof url == 'undefined') {
|
3090 |
+
url = '';
|
3091 |
+
}
|
3092 |
+
//CANVAS URL//
|
3093 |
+
var tab_name = window.location.href.split('tab=');
|
3094 |
+
|
3095 |
+
d_start_date = start_date;
|
3096 |
+
d_end_date = end_date;
|
3097 |
+
d_metric_export = metric_export;
|
3098 |
+
d_metric_compare_export = metric_compare_export;
|
3099 |
+
d_dimension_export = dimension_export;
|
3100 |
+
d_tab_name = tab_name;
|
3101 |
+
d_filter_type = filter_type;
|
3102 |
+
d_country_filter = country_name;
|
3103 |
+
d_geo_type = geo_type;
|
3104 |
+
jQuery("#gbox_griddiv").remove();
|
3105 |
+
var grid = '<table id="griddiv"></table><div id="pager"></div>';
|
3106 |
+
jQuery('.gawd_chart_conteiner').append(grid);
|
3107 |
+
gawd_draw_table(data, metric, metric_compare, dimension);
|
3108 |
+
})
|
3109 |
+
}
|
3110 |
+
function gawd_datepicker_main(start, end) {
|
3111 |
+
jQuery('#reportrange span').html(start.format('Y-MM-DD') + ' - ' + end.format('Y-MM-DD'));
|
3112 |
+
jQuery('#gawd_start_end_date').val(start.format('Y-MM-DD') + '/-/' + end.format('Y-MM-DD'));
|
3113 |
+
gawd_chart_type();
|
3114 |
+
}
|
3115 |
+
|
3116 |
+
function change_account(that) {
|
3117 |
+
jQuery('#web_property_name').val(jQuery(that).find(':selected').closest('optgroup').attr('label'));
|
3118 |
+
jQuery('#gawd_view').submit();
|
3119 |
+
}
|
3120 |
+
function gawd_tracking_display_manage() {
|
3121 |
+
hljs.configure({useBR: true});
|
3122 |
+
jQuery(document).ready(function () {
|
3123 |
+
jQuery('div code').each(function (i, block) {
|
3124 |
+
hljs.highlightBlock(block);
|
3125 |
+
});
|
3126 |
+
});
|
3127 |
+
jQuery('.gawd_tracking .onoffswitch-checkbox').on('change', function () {
|
3128 |
+
var name = jQuery(this).attr('name');
|
3129 |
+
var checked = jQuery(this).attr('checked');
|
3130 |
+
if ('checked' == checked) {
|
3131 |
+
jQuery('#' + name + '_code').show();
|
3132 |
+
} else {
|
3133 |
+
jQuery('#' + name + '_code').hide();
|
3134 |
+
}
|
3135 |
+
});
|
3136 |
+
jQuery('#gawd_tracking_enable').on('change', function() {
|
3137 |
+
checked = (jQuery(this).attr('checked'));
|
3138 |
+
if (checked == 'checked') {
|
3139 |
+
jQuery('.independent_switch').each(function() {
|
3140 |
+
jQuery(this).removeClass('onoffswitch_disabled');
|
3141 |
+
});
|
3142 |
+
jQuery('.independent_input').each(function() {
|
3143 |
+
jQuery(this).removeAttr('disabled');
|
3144 |
+
});
|
3145 |
+
} else {
|
3146 |
+
jQuery('.independent_switch').each(function() {
|
3147 |
+
jQuery(this).addClass('onoffswitch_disabled');
|
3148 |
+
});
|
3149 |
+
jQuery('.independent_input').each(function() {
|
3150 |
+
jQuery(this).attr('disabled','disabled');
|
3151 |
+
});
|
3152 |
+
}
|
3153 |
+
});
|
3154 |
+
}
|
3155 |
+
|
3156 |
+
|
3157 |
+
jQuery(document).ready(function () {
|
3158 |
+
jQuery("#gawd_refresh_management_accounts").on('click', function (e) {
|
3159 |
+
e.preventDefault();
|
3160 |
+
gawd_refresh_management_accounts();
|
3161 |
+
return false;
|
3162 |
+
});
|
3163 |
+
|
3164 |
+
jQuery('#gawd_add_property').on('click', function(e){
|
3165 |
+
e.preventDefault();
|
3166 |
+
|
3167 |
+
var property_name = jQuery('#gawd_property_name').val();
|
3168 |
+
|
3169 |
+
jQuery("#gawd_property_name").removeClass('gawd_invalid')
|
3170 |
+
if (property_name == '') {
|
3171 |
+
jQuery("#gawd_property_name").addClass('gawd_invalid');
|
3172 |
+
return false;
|
3173 |
+
}
|
3174 |
+
|
3175 |
+
var args = gawd_custom_ajax_args();
|
3176 |
+
args.type = 'POST';
|
3177 |
+
args.async = true;
|
3178 |
+
args.data.gawd_action = "add_property";
|
3179 |
+
args.data.gawd_data = {
|
3180 |
+
"gawd_account_select": jQuery('.gawd_account_select').val(),
|
3181 |
+
"gawd_property_name": property_name
|
3182 |
+
};
|
3183 |
+
|
3184 |
+
var $loader_container = jQuery("#gawd_right_conteiner");
|
3185 |
+
args.beforeSend = function () {
|
3186 |
+
gawd_add_loader($loader_container);
|
3187 |
+
};
|
3188 |
+
|
3189 |
+
args.success = function (response) {
|
3190 |
+
window.location.reload();
|
3191 |
+
};
|
3192 |
+
|
3193 |
+
args.error = function () {
|
3194 |
+
window.location.reload();
|
3195 |
+
};
|
3196 |
+
|
3197 |
+
jQuery.ajax(args).done(function () {
|
3198 |
+
gawd_remove_loader($loader_container);
|
3199 |
+
});
|
3200 |
+
|
3201 |
+
});
|
3202 |
+
|
3203 |
+
jQuery('#gawd_choose_property').on('click', function(e){
|
3204 |
+
e.preventDefault();
|
3205 |
+
|
3206 |
+
var $el = jQuery(".gawd_property_select")
|
3207 |
+
var property_val = $el.val();
|
3208 |
+
|
3209 |
+
if(property_val === '0'){
|
3210 |
+
$el.addClass('gawd_invalid');
|
3211 |
+
return false;
|
3212 |
+
}
|
3213 |
+
|
3214 |
+
var args = gawd_custom_ajax_args();
|
3215 |
+
args.type = 'POST';
|
3216 |
+
args.async = true;
|
3217 |
+
args.data.gawd_action = "choose_property";
|
3218 |
+
args.data.gawd_data = {
|
3219 |
+
"gawd_property": property_val
|
3220 |
+
};
|
3221 |
+
|
3222 |
+
var $loader_container = jQuery("#gawd_right_conteiner");
|
3223 |
+
args.beforeSend = function () {
|
3224 |
+
gawd_add_loader($loader_container);
|
3225 |
+
};
|
3226 |
+
|
3227 |
+
args.success = function (response) {
|
3228 |
+
window.location.reload();
|
3229 |
+
};
|
3230 |
+
|
3231 |
+
args.error = function () {
|
3232 |
+
window.location.reload();
|
3233 |
+
};
|
3234 |
+
|
3235 |
+
jQuery.ajax(args).done(function () {
|
3236 |
+
gawd_remove_loader($loader_container);
|
3237 |
+
});
|
3238 |
+
});
|
3239 |
+
|
3240 |
+
jQuery('.gawd_property_select').on('change',function(){
|
3241 |
+
if(jQuery(this).val() === '0'){
|
3242 |
+
jQuery('#gawd_choose_property').addClass('gawd_disabled_button');
|
3243 |
+
}else{
|
3244 |
+
jQuery('#gawd_choose_property').removeClass('gawd_disabled_button');
|
3245 |
+
jQuery(this).removeClass('gawd_invalid');
|
3246 |
+
}
|
3247 |
+
});
|
3248 |
+
|
3249 |
+
jQuery('#gawd_reset_credentials').on('click', function (e) {
|
3250 |
+
e.preventDefault();
|
3251 |
+
|
3252 |
+
var args = gawd_custom_ajax_args();
|
3253 |
+
args.type = 'POST';
|
3254 |
+
args.async = true;
|
3255 |
+
args.data.gawd_action = "delete_credentials";
|
3256 |
+
|
3257 |
+
var $loader_container = jQuery("#wpwrap");
|
3258 |
+
args.beforeSend = function () {
|
3259 |
+
gawd_add_loader($loader_container);
|
3260 |
+
};
|
3261 |
+
|
3262 |
+
args.success = function (response) {
|
3263 |
+
window.location.reload();
|
3264 |
+
};
|
3265 |
+
|
3266 |
+
args.error = function () {
|
3267 |
+
window.location.reload();
|
3268 |
+
};
|
3269 |
+
|
3270 |
+
jQuery.ajax(args).done(function () {
|
3271 |
+
gawd_remove_loader($loader_container);
|
3272 |
+
});
|
3273 |
+
|
3274 |
+
return false;
|
3275 |
+
});
|
3276 |
+
});
|
3277 |
+
|
3278 |
+
function gawd_refresh_user_info(hidden, remove_reports_data,reload) {
|
3279 |
+
|
3280 |
+
hidden = (typeof hidden === 'undefined' || hidden === false) ? false : true;
|
3281 |
+
remove_reports_data = (typeof remove_reports_data === 'undefined' || remove_reports_data === false) ? false : true;
|
3282 |
+
reload = (typeof reload === 'undefined' || reload === false) ? false : true;
|
3283 |
+
|
3284 |
+
var args = gawd_custom_ajax_args();
|
3285 |
+
args.type = 'POST';
|
3286 |
+
args.async = true;
|
3287 |
+
args.data.gawd_action = "refresh_user_info";
|
3288 |
+
args.data.gawd_data = {
|
3289 |
+
'add_notice': (hidden === true) ? '0' : '1',
|
3290 |
+
'remove_reports_data': (remove_reports_data === true) ? '1' : '0',
|
3291 |
+
};
|
3292 |
+
|
3293 |
+
var $loader_container = jQuery("#wpcontent");
|
3294 |
+
if (hidden === false) {
|
3295 |
+
args.beforeSend = function () {
|
3296 |
+
gawd_add_loader($loader_container);
|
3297 |
+
};
|
3298 |
+
|
3299 |
+
args.complete = function () {
|
3300 |
+
gawd_remove_loader($loader_container);
|
3301 |
+
};
|
3302 |
+
|
3303 |
+
args.success = function (response) {
|
3304 |
+
if(response.error.code === "no_properties"){
|
3305 |
+
window.location.hash = "#gawd_tracking_tab"
|
3306 |
+
}
|
3307 |
+
window.location.reload();
|
3308 |
+
};
|
3309 |
+
|
3310 |
+
args.error = function () {
|
3311 |
+
window.location.reload();
|
3312 |
+
};
|
3313 |
+
} else {
|
3314 |
+
args.error = function () {
|
3315 |
+
};
|
3316 |
+
|
3317 |
+
if(reload == true){
|
3318 |
+
window.location.reload();
|
3319 |
+
}
|
3320 |
+
}
|
3321 |
+
|
3322 |
+
jQuery.ajax(args);
|
3323 |
+
}
|
3324 |
+
|
3325 |
+
function gawd_refresh_management_accounts() {
|
3326 |
+
var args = gawd_custom_ajax_args();
|
3327 |
+
args.type = 'POST';
|
3328 |
+
args.async = true;
|
3329 |
+
args.data.gawd_action = "refresh_management_accounts";
|
3330 |
+
|
3331 |
+
var $loader_container = jQuery("#wpbody");
|
3332 |
+
args.beforeSend = function () {
|
3333 |
+
gawd_add_loader($loader_container);
|
3334 |
+
};
|
3335 |
+
|
3336 |
+
args.success = function (response) {
|
3337 |
+
if(response.success === true){
|
3338 |
+
gawd_refresh_user_info(true, true, true);
|
3339 |
+
}else{
|
3340 |
+
window.location.reload();
|
3341 |
+
}
|
3342 |
+
};
|
3343 |
+
|
3344 |
+
args.error = function () {
|
3345 |
+
window.location.reload();
|
3346 |
+
};
|
3347 |
+
|
3348 |
+
jQuery.ajax(args).done(function(){
|
3349 |
+
// gawd_remove_loader($loader_container);
|
3350 |
+
});
|
3351 |
+
}
|
3352 |
+
|
3353 |
+
|
3354 |
+
function gawd_auth_popup(w, h) {
|
3355 |
+
var left = (screen.width / 2) - (w / 2);
|
3356 |
+
var top = (screen.height / 8);
|
3357 |
+
jQuery('#gawd_auth_code').show();
|
3358 |
+
jQuery('.auth_description').hide();
|
3359 |
+
jQuery('#gawd_auth_url').hide();
|
3360 |
+
jQuery('.gawd_submit').hide();
|
3361 |
+
|
3362 |
+
var ajax_args = gawd_custom_ajax_args();
|
3363 |
+
ajax_args.data.gawd_action = "get_auth_url";
|
3364 |
+
ajax_args.success = function (response) {
|
3365 |
+
var url = response.data.url;
|
3366 |
+
window.open(url, 'gawd_auth_window', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
|
3367 |
+
|
3368 |
+
jQuery('#gawd_auth_code_submit').on('click', function () {
|
3369 |
+
gawd_auth_ajax();
|
3370 |
+
});
|
3371 |
+
|
3372 |
+
jQuery('#gawd_token').bind("enterKey", function (e) {
|
3373 |
+
if (jQuery('#gawd_token').val() != '') {
|
3374 |
+
gawd_auth_ajax();
|
3375 |
+
}
|
3376 |
+
});
|
3377 |
+
|
3378 |
+
jQuery('#gawd_token').keyup(function (e) {
|
3379 |
+
if (e.keyCode == 13) {
|
3380 |
+
jQuery(this).trigger("enterKey");
|
3381 |
+
}
|
3382 |
+
});
|
3383 |
+
|
3384 |
+
};
|
3385 |
+
|
3386 |
+
ajax_args.error = function () {
|
3387 |
+
//window.location.reload();
|
3388 |
+
};
|
3389 |
+
|
3390 |
+
jQuery.ajax(ajax_args);
|
3391 |
+
}
|
3392 |
+
|
3393 |
+
function gawd_auth_ajax() {
|
3394 |
+
var args = gawd_custom_ajax_args();
|
3395 |
+
args.type = 'POST';
|
3396 |
+
args.async = true;
|
3397 |
+
args.data.gawd_action = "authenticate";
|
3398 |
+
args.data.gawd_data = {'token': jQuery('#gawd_token').val()};
|
3399 |
+
|
3400 |
+
var $loader_container = jQuery(".gawd_auth_authenticate");
|
3401 |
+
args.beforeSend = function () {
|
3402 |
+
gawd_add_loader($loader_container);
|
3403 |
+
};
|
3404 |
+
|
3405 |
+
args.success = function (response) {
|
3406 |
+
|
3407 |
+
if(response.success === false){
|
3408 |
+
window.location.reload();
|
3409 |
+
return false;
|
3410 |
+
}
|
3411 |
+
|
3412 |
+
if (typeof response.data.redirect !== 'undefined') {
|
3413 |
+
if (response.data.redirect === "tracking_tab") {
|
3414 |
+
window.location.href += "#gawd_tracking_tab";
|
3415 |
+
window.location.reload();
|
3416 |
+
} else if (response.data.redirect === "dashboard") {
|
3417 |
+
window.location.href = gawd_admin.wp_admin_url + "admin.php?page=gawd_analytics";
|
3418 |
+
} else {
|
3419 |
+
window.location.reload();
|
3420 |
+
}
|
3421 |
+
}
|
3422 |
+
|
3423 |
+
window.location.reload();
|
3424 |
+
};
|
3425 |
+
|
3426 |
+
args.error = function (response) {
|
3427 |
+
window.location.reload();
|
3428 |
+
};
|
3429 |
+
|
3430 |
+
jQuery.ajax(args).done(function () {
|
3431 |
+
gawd_remove_loader($loader_container);
|
3432 |
+
});
|
3433 |
+
}
|
3434 |
+
|
3435 |
+
function gawd_widget_real_time(chart_id) {
|
3436 |
+
|
3437 |
+
var args = gawd_custom_ajax_args();
|
3438 |
+
args.type = 'POST';
|
3439 |
+
args.async = true;
|
3440 |
+
args.data.gawd_action = "get_real_time_data";
|
3441 |
+
|
3442 |
+
args.beforeSend = function() {
|
3443 |
+
jQuery('#opacity_div').show();
|
3444 |
+
jQuery('#loading_div').show();
|
3445 |
+
jQuery(chart_id).closest(".postbox").find('.opacity_div_compact').show();
|
3446 |
+
jQuery(chart_id).closest(".postbox").find('.loading_div_compact').show();
|
3447 |
+
};
|
3448 |
+
|
3449 |
+
args.success = function (data) {
|
3450 |
+
|
3451 |
+
if(data.success === false){
|
3452 |
+
gawd_add_notice(data, chart_id);
|
3453 |
+
return;
|
3454 |
+
}
|
3455 |
+
|
3456 |
+
var result = data.data.real_time_data;
|
3457 |
+
jQuery(chart_id).empty();
|
3458 |
+
jQuery("#gawd_right_conteiner").find('#gbox_griddiv').remove();
|
3459 |
+
var grid = '<table id="griddiv"></table><div id="pager"></div>';
|
3460 |
+
jQuery('#gawd_right_conteiner').append(grid);
|
3461 |
+
var array = [];
|
3462 |
+
var desktop = 0;
|
3463 |
+
var mobile = 0;
|
3464 |
+
|
3465 |
+
var country_data = {};
|
3466 |
+
|
3467 |
+
if (typeof result.rows != 'undefined') {
|
3468 |
+
|
3469 |
+
var country = '';
|
3470 |
+
jQuery.each(result.rows, function (index, value) {
|
3471 |
+
country = value[4];
|
3472 |
+
if (typeof country_data[country] == 'undefined') {
|
3473 |
+
country_data[country] = 0;
|
3474 |
+
}
|
3475 |
+
country_data[country] += Number(value[7]);
|
3476 |
+
|
3477 |
+
if (value[6] == 'DESKTOP') {
|
3478 |
+
desktop += Number(value[7]);
|
3479 |
+
} else if (value[6] == 'MOBILE') {
|
3480 |
+
mobile += Number(value[7]);
|
3481 |
+
}
|
3482 |
+
if (typeof array[value[0]] == 'undefined') {
|
3483 |
+
array[value[0]] = Number(value[7]);
|
3484 |
+
} else {
|
3485 |
+
array[value[0]] += Number(value[7]);
|
3486 |
+
}
|
3487 |
+
});
|
3488 |
+
var i = 0;
|
3489 |
+
var sortable = [];
|
3490 |
+
for (var key in array) {
|
3491 |
+
sortable.push([key, array[key]]);
|
3492 |
+
}
|
3493 |
+
sortable.sort(function (a, b) {
|
3494 |
+
return b[1] - a[1]
|
3495 |
+
});
|
3496 |
+
array = [];
|
3497 |
+
for (var j = 0; j < sortable.length; j++) {
|
3498 |
+
var row = {};
|
3499 |
+
row.No = (j + 1);
|
3500 |
+
row["Active Page"] = sortable[j][0];
|
3501 |
+
row["Active Users"] = sortable[j][1];
|
3502 |
+
array.push(row);
|
3503 |
+
}
|
3504 |
+
|
3505 |
+
var realtime_cont = '<div class="gawd_realtime_conteiner">' + (mobile + desktop) + '</div><div class="device_type"></div><div class="gawd_table_conteiner">';
|
3506 |
+
|
3507 |
+
} else {
|
3508 |
+
var realtime_cont = '<div class="gawd_realtime_conteiner">' + 0 + '</div>';
|
3509 |
+
}
|
3510 |
+
if (chart_id != "#chart_widget" && chart_id != "#gawd_real_time_meta") {
|
3511 |
+
var refresh_button = '<input class="button_gawd" type="button" id="gawd_real_time_refresh_button" value="Refresh" />';
|
3512 |
+
var d = (desktop !== 0) ? Math.round((desktop / (desktop + mobile)) * 100) : 0;
|
3513 |
+
var m = (mobile != 0) ? (100 - d) : 0;
|
3514 |
+
|
3515 |
+
var desktop_color = '#ed561b';
|
3516 |
+
var mobile_color = '#50b432';
|
3517 |
+
|
3518 |
+
var desktop_modile_bar = '';
|
3519 |
+
desktop_modile_bar += '<div>';
|
3520 |
+
|
3521 |
+
if (d != 0 || m != 0) {
|
3522 |
+
var bar_html = '<div class="realtime_bar">';
|
3523 |
+
var bar_color_html = '<div class="realtime_colors">';
|
3524 |
+
if (d != 0) {
|
3525 |
+
bar_color_html += '<span>';
|
3526 |
+
bar_color_html += '<em style="background-color:' + desktop_color + '"></em>';
|
3527 |
+
bar_color_html += '<span style="padding:6px;">Desktop</span></span>';
|
3528 |
+
|
3529 |
+
bar_html += '<div style="background-color:' + desktop_color + ';width:' + d + '%;">';
|
3530 |
+
bar_html += d + '%' + '</div>';
|
3531 |
+
}
|
3532 |
+
|
3533 |
+
if (m != 0) {
|
3534 |
+
bar_color_html += '<span>';
|
3535 |
+
bar_color_html += '<em style="background-color:' + mobile_color + '"></em>';
|
3536 |
+
bar_color_html += '<span style="padding-left: 6px;">Mobile</span></span>';
|
3537 |
+
|
3538 |
+
bar_html += '<div style="background-color:' + mobile_color + ';width:' + m + '%;">';
|
3539 |
+
bar_html += m + '%' + '</div>';
|
3540 |
+
|
3541 |
+
}
|
3542 |
+
bar_color_html += '</div>';
|
3543 |
+
bar_html += '</div>'
|
3544 |
+
desktop_modile_bar += bar_color_html + bar_html;
|
3545 |
+
}
|
3546 |
+
desktop_modile_bar += '</div>';
|
3547 |
+
|
3548 |
+
|
3549 |
+
jQuery('#chartdiv').css('height', 'auto');
|
3550 |
+
jQuery('#chartdiv').append(refresh_button);
|
3551 |
+
jQuery('#chartdiv').append(realtime_cont);
|
3552 |
+
jQuery('#chartdiv').append(desktop_modile_bar);
|
3553 |
+
|
3554 |
+
if (typeof result.rows != 'undefined') {
|
3555 |
+
jQuery('#chartdiv').append('<div id="realtime_map" style="height:auto;"></div>');
|
3556 |
+
jQuery('#chartdiv').css('margin-bottom', '20px');
|
3557 |
+
jQuery('#chartdiv').css('min-height', '60px');
|
3558 |
+
|
3559 |
+
//show_realtime_map(country_data);
|
3560 |
+
}
|
3561 |
+
gawd_draw_table(array, 'Active Users', 0, 'Active Page')
|
3562 |
+
}
|
3563 |
+
else {
|
3564 |
+
jQuery(chart_id).height('110');
|
3565 |
+
jQuery(chart_id).append(realtime_cont);
|
3566 |
+
jQuery('.gawd_table_conteiner').hide();
|
3567 |
+
}
|
3568 |
+
jQuery("#chart_widget").find('a').remove();
|
3569 |
+
|
3570 |
+
jQuery('#gawd_real_time_refresh_button').on('click', function () {
|
3571 |
+
gawd_widget_real_time('#chartdiv');
|
3572 |
+
});
|
3573 |
+
jQuery('#opacity_div').hide();
|
3574 |
+
jQuery('#loading_div').hide();
|
3575 |
+
jQuery(chart_id).closest(".postbox").find('.opacity_div_compact').hide();
|
3576 |
+
jQuery(chart_id).closest(".postbox").find('.loading_div_compact').hide();
|
3577 |
+
|
3578 |
+
}
|
3579 |
+
jQuery.ajax(args).done(function(){
|
3580 |
+
jQuery('#opacity_div').hide();
|
3581 |
+
jQuery('#loading_div').hide();
|
3582 |
+
jQuery(chart_id).closest(".postbox").find('.opacity_div_compact').hide();
|
3583 |
+
jQuery(chart_id).closest(".postbox").find('.loading_div_compact').hide();
|
3584 |
+
});
|
3585 |
+
}
|
3586 |
+
|
3587 |
+
function do_gawd_ajax(){
|
3588 |
+
|
3589 |
+
var args = gawd_custom_ajax_args();
|
3590 |
+
args.type = 'POST';
|
3591 |
+
args.data.gawd_action = "get_custom_dimensions";
|
3592 |
+
jQuery.ajax(args);
|
3593 |
+
}
|
3594 |
+
|
3595 |
+
function gawd_custom_ajax_args() {
|
3596 |
+
|
3597 |
+
return {
|
3598 |
+
'url': gawd_admin.ajaxurl,
|
3599 |
+
'type': "GET",
|
3600 |
+
'dataType': 'json',
|
3601 |
+
'async': false,
|
3602 |
+
'data': {
|
3603 |
+
'gawd_ajax': '1',
|
3604 |
+
'gawd_nonce': gawd_admin.gawd_custom_ajax_nonce,
|
3605 |
+
'gawd_nonce_data': gawd_admin.gawd_custom_ajax_nonce_data,
|
3606 |
+
'gawd_action': "",
|
3607 |
+
'gawd_data': []
|
3608 |
+
},
|
3609 |
+
success: function (data) {
|
3610 |
+
},
|
3611 |
+
error: function (data) {
|
3612 |
+
}
|
3613 |
+
};
|
3614 |
+
}
|
3615 |
+
|
3616 |
+
function gawd_reload_account() {
|
3617 |
+
jQuery(".gwd_refresh_page").removeClass('gawd_hidden');
|
3618 |
+
}
|
3619 |
+
function gawd_show_authenticate_form() {
|
3620 |
+
jQuery(".gawd_auth_authenticate").removeClass('gawd_hidden');
|
3621 |
+
jQuery(".no_account_content").addClass('gawd_hidden');
|
3622 |
+
}
|
3623 |
+
|
3624 |
+
function gawd_add_loader($container) {
|
3625 |
+
var html = "<div class='gawd_loader_opacity'></div>";
|
3626 |
+
html += "<div class='gawd_loader_container'>" +
|
3627 |
+
"<img src='" + gawd_admin.gawd_plugin_url + "/assets/ajax_loader.gif" + "'/>" +
|
3628 |
+
"</div>";
|
3629 |
+
$container.append(html);
|
3630 |
+
}
|
3631 |
+
|
3632 |
+
function gawd_remove_loader($container) {
|
3633 |
+
$container.find('.gawd_loader_opacity').remove();
|
3634 |
+
$container.find('.gawd_loader_container').remove();
|
3635 |
+
}
|
3636 |
+
|
3637 |
+
|
3638 |
+
function gawd_remove_item(dataKey,hidden){
|
3639 |
+
jQuery('#'+hidden).val(dataKey);
|
3640 |
+
jQuery('#gawd_form').submit();
|
3641 |
+
}
|
3642 |
+
function gawd_search() {
|
3643 |
+
jQuery('.gawd_menu_li').find("ul").show();
|
3644 |
+
var search, not_match = false;
|
3645 |
+
search = jQuery('.gawd_search_input').val();
|
3646 |
+
var search_text = new RegExp(search, "gi");
|
3647 |
+
var Exp = /^[a-z\d\-_\s]+$/gi;
|
3648 |
+
jQuery('.gawd_menu_li').show();
|
3649 |
+
jQuery('.gawd_menu_ul_li').show();
|
3650 |
+
jQuery('.gawd_active_li').closest('ul').show();
|
3651 |
+
if (search.length > 0 && search.match(Exp)) {
|
3652 |
+
jQuery('.gawd_menu_li').each(function (){
|
3653 |
+
var hide = true;
|
3654 |
+
if(jQuery(this).find('.gawd_menu_li_sub').length > 0){
|
3655 |
+
if (jQuery(this).find('.gawd_menu_li_sub').text().search(search_text) < 0 ) {
|
3656 |
+
jQuery(this).find('.gawd_menu_item').each(function (){
|
3657 |
+
if ((jQuery(this).text()).search(search_text) >= 0 ) {
|
3658 |
+
hide = false;
|
3659 |
+
return;
|
3660 |
+
}
|
3661 |
+
});
|
3662 |
+
}
|
3663 |
+
else{
|
3664 |
+
hide = false;
|
3665 |
+
}
|
3666 |
+
}
|
3667 |
+
else{
|
3668 |
+
jQuery(this).find('.gawd_menu_item').each(function (){
|
3669 |
+
if ((jQuery(this).text()).search(search_text) >= 0 ) {
|
3670 |
+
hide = false;
|
3671 |
+
jQuery(this).closest('ul').show();
|
3672 |
+
return;
|
3673 |
+
}
|
3674 |
+
});
|
3675 |
+
}
|
3676 |
+
if(hide){
|
3677 |
+
jQuery(this).hide();
|
3678 |
+
}
|
3679 |
+
/* if ((jQuery(this).text()).search(search_text) < 0 ) {
|
3680 |
+
jQuery(this).closest('li').hide();
|
3681 |
+
}
|
3682 |
+
else{
|
3683 |
+
jQuery(this).closest('li').show();
|
3684 |
+
if(not_match == false){
|
3685 |
+
not_match = true;
|
3686 |
+
}
|
3687 |
+
} */
|
3688 |
+
});
|
3689 |
+
}else{
|
3690 |
+
jQuery('.gawd_menu_li').find("ul").hide();
|
3691 |
+
}
|
3692 |
+
/*
|
3693 |
+
jQuery('.gawd_menu_item').each(function (){
|
3694 |
+
if ((jQuery(this).text()).search(search_text) < 0 ) {
|
3695 |
+
jQuery(this).closest('li').hide();
|
3696 |
+
}
|
3697 |
+
else{
|
3698 |
+
jQuery(this).closest('li').show();
|
3699 |
+
if(not_match == false){
|
3700 |
+
not_match = true;
|
3701 |
+
}
|
3702 |
+
}
|
3703 |
+
});
|
3704 |
+
jQuery('.gawd_menu_li').each(function (){
|
3705 |
+
var t = false;
|
3706 |
+
jQuery(this).find('li').each(function (){
|
3707 |
+
if(jQuery(this).is(':visible')){
|
3708 |
+
t = true;
|
3709 |
+
return;
|
3710 |
+
}
|
3711 |
+
});
|
3712 |
+
if(jQuery(this).find('li ').length >0 && t == false){
|
3713 |
+
jQuery(this).hide();
|
3714 |
+
}
|
3715 |
+
});
|
3716 |
+
*/
|
3717 |
+
if(not_match == false){
|
3718 |
+
|
3719 |
+
}
|
3720 |
+
}
|
3721 |
+
function remove_zoom_message(){
|
3722 |
+
var got_it = jQuery('#gawd_got_it').val();
|
3723 |
+
console.log("ajax12");
|
3724 |
+
jQuery.post(gawd_admin.ajaxurl, {
|
3725 |
+
action: 'remove_zoom_message',
|
3726 |
+
got_it: got_it,
|
3727 |
+
security: gawd_admin.ajaxnonce,
|
3728 |
+
}).done(function (data) {
|
3729 |
+
jQuery('.gawd_zoom_message').remove();
|
3730 |
+
})
|
3731 |
+
}
|
3732 |
+
|
3733 |
+
|
3734 |
+
function get_tab_name() {
|
3735 |
+
var tab_name = window.location.href.split('tab=');
|
3736 |
+
if(typeof tab_name[1] != "undefined"){
|
3737 |
+
return tab_name[1];
|
3738 |
+
}
|
3739 |
}
|
inc/js/gawd_overview.js
CHANGED
@@ -1,156 +1,158 @@
|
|
1 |
-
function gawd_onclick_refresh() {
|
2 |
-
var end_date = Date.today().add(-1).days().toString("yyyy-MM-dd");
|
3 |
-
var start_date_30 = (Date.today().add(-1).days()).add(-30).days().toString("yyyy-MM-dd");
|
4 |
-
var start_date_7 = (Date.today().add(-1).days()).add(-7).days().toString("yyyy-MM-dd");
|
5 |
-
start_date = start_date_7;
|
6 |
-
var current_id = jQuery(this).attr('id');
|
7 |
-
switch (current_id) {
|
8 |
-
case 'gawd-date-meta_refresh_button':
|
9 |
-
gawd_draw_analytics_compact('sessions', 'users', 'date', 'line', 'gawd_date_meta');
|
10 |
-
break;
|
11 |
-
|
12 |
-
case 'gawd-country-box_refresh_button':
|
13 |
-
gawd_draw_analytics_compact('sessions', '', 'country', 'column', 'gawd_country_meta');
|
14 |
-
break;
|
15 |
-
|
16 |
-
case 'gawd-real-time_refresh_button':
|
17 |
-
gawd_widget_real_time('#gawd_real_time_meta');
|
18 |
-
break;
|
19 |
-
|
20 |
-
case 'gawd-visitors-meta_refresh_button':
|
21 |
-
gawd_pie_chart_compact('sessions', 'userType', 'pie', 'gawd_visitors_meta');
|
22 |
-
break;
|
23 |
-
|
24 |
-
case 'gawd-browser-meta_refresh_button':
|
25 |
-
gawd_pie_chart_compact('sessions', 'browser', 'pie', 'gawd_browser_meta');
|
26 |
-
break;
|
27 |
-
}
|
28 |
-
}
|
29 |
-
function gawd_onclick_more() {
|
30 |
-
|
31 |
-
var current_id = jQuery(this).attr('id');
|
32 |
-
|
33 |
-
switch (current_id) {
|
34 |
-
case 'gawd-date-meta_more_button':
|
35 |
-
window.location.href = gawd_overview.wp_admin_url + 'admin.php?page=gawd_reports&tab=overview';
|
36 |
-
break;
|
37 |
-
|
38 |
-
case 'gawd-country-box_more_button':
|
39 |
-
window.location.href = gawd_overview.wp_admin_url + 'admin.php?page=gawd_reports&tab=location';
|
40 |
-
break;
|
41 |
-
|
42 |
-
case 'gawd-real-time_more_button':
|
43 |
-
window.location.href = gawd_overview.wp_admin_url + 'admin.php?page=gawd_reports&tab=realtime';
|
44 |
-
break;
|
45 |
-
|
46 |
-
case 'gawd-visitors-meta_more_button':
|
47 |
-
window.location.href = gawd_overview.wp_admin_url + 'admin.php?page=gawd_reports&tab=behaviour';
|
48 |
-
break;
|
49 |
-
|
50 |
-
case 'gawd-browser-meta_more_button':
|
51 |
-
window.location.href = gawd_overview.wp_admin_url + 'admin.php?page=gawd_reports&tab=browser';
|
52 |
-
break;
|
53 |
-
}
|
54 |
-
}
|
55 |
-
function gawd_onclick_toggle() {
|
56 |
-
if (jQuery(this).attr('aria-expanded') == 'true') {
|
57 |
-
jQuery(this).attr('aria-expanded', 'false');
|
58 |
-
jQuery(this).closest('.postbox').addClass('closed');
|
59 |
-
} else {
|
60 |
-
jQuery(this).attr('aria-expanded', 'true');
|
61 |
-
jQuery(this).closest('.postbox').removeClass('closed');
|
62 |
-
}
|
63 |
-
}
|
64 |
-
function hide_same_metric(el){
|
65 |
-
var option = jQuery(el).val();
|
66 |
-
var metric_id = "gawd_metric_compact";
|
67 |
-
var metric_compare_id = "gawd_metric_compare_compact";
|
68 |
-
var select_id = jQuery(el).attr("id");
|
69 |
-
if(select_id == metric_id){
|
70 |
-
jQuery("#"+metric_compare_id).find('option').show();
|
71 |
-
jQuery("#"+metric_compare_id).find("option[value='"+option+"']").hide();
|
72 |
-
}
|
73 |
-
else if(select_id == metric_compare_id){
|
74 |
-
jQuery("#"+metric_id).find('option').show();
|
75 |
-
jQuery("#"+metric_id).find("option[value='"+option+"']").hide();
|
76 |
-
}
|
77 |
-
}
|
78 |
-
jQuery(document).ready(function () {
|
79 |
-
|
80 |
-
if(gawd_overview.enableHoverTooltip == 'on'){
|
81 |
-
jQuery('.load_tooltip').
|
82 |
-
jQuery(this).attr('title',jQuery(this).data('hint'));
|
83 |
-
})
|
84 |
-
jQuery('.postbox-container, .gawd_wrap').tooltip({position: {
|
85 |
-
my: "center",
|
86 |
-
at: "right+200",
|
87 |
-
track: false,
|
88 |
-
using: function(position, feedback) {
|
89 |
-
jQuery(this).css(position);
|
90 |
-
}
|
91 |
-
}
|
92 |
-
});
|
93 |
-
}
|
94 |
-
jQuery('.gawd_wrap').find('.postbox').each(function () {
|
95 |
-
var temp = jQuery(this);
|
96 |
-
|
97 |
-
jQuery(this).find('.hndle span').html();
|
98 |
-
var temp_id = temp.attr('id');
|
99 |
-
var temp_html = temp.html();
|
100 |
-
new_text_refresh = buttons_refresh;
|
101 |
-
new_text_full = buttons_full;
|
102 |
-
var new_text ='</button>';
|
103 |
-
if(temp.attr('id') == 'gawd-real-time'){
|
104 |
-
new_text += new_text_refresh.replace('{{refreshid}}', temp_id + '_refresh_button');
|
105 |
-
|
106 |
-
|
107 |
-
}
|
108 |
-
new_text += new_text_full.replace( '{{moreid}}', temp_id + '_more_button' );
|
109 |
-
temp_html = temp_html.replace( '</button>', new_text );
|
110 |
-
temp.html( temp_html );
|
111 |
-
});
|
112 |
-
jQuery('.gawd-refresh').unbind('click').on('click', gawd_onclick_refresh);
|
113 |
-
jQuery('.gawd-more').unbind('click').on('click', gawd_onclick_more);
|
114 |
-
jQuery('.gawd_wrap').find('.toggle-indicator').closest('button').unbind('click').on('click', gawd_onclick_toggle);
|
115 |
-
|
116 |
-
})
|
117 |
-
|
118 |
-
function datepicker_js_compact() {
|
119 |
-
gawd_datepicker_main_compact(default_start(), default_end());
|
120 |
-
jQuery('#reportrange').daterangepicker({
|
121 |
-
ranges: {
|
122 |
-
'Today': [moment(), moment()],
|
123 |
-
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
|
124 |
-
'Last 7 Days': [moment().subtract(7, 'days'), moment().subtract(1, 'days')],
|
125 |
-
'Last Week': [moment().subtract(1, 'week').startOf('week'), moment().subtract(1, 'week').endOf('week')],
|
126 |
-
'Last 30 Days': [moment().subtract(30, 'days'), moment().subtract(1, 'days')],
|
127 |
-
'This Month': [moment().startOf('month'), moment().endOf('month')],
|
128 |
-
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
|
129 |
-
},
|
130 |
-
"startDate": default_start(),
|
131 |
-
"endDate": default_end(),
|
132 |
-
"maxDate": moment(),
|
133 |
-
"alwaysShowCalendars": true,
|
134 |
-
"opens": "right",
|
135 |
-
"applyClass": 'gawd_main_apply'
|
136 |
-
}, gawd_datepicker_main_compact);
|
137 |
-
|
138 |
-
function gawd_datepicker_main_compact(start, end) {
|
139 |
-
jQuery('#reportrange span').html(start.format('Y-MM-DD') + ' - ' + end.format('Y-MM-DD'));
|
140 |
-
jQuery('#gawd_start_end_date_compact').val(start.format('Y-MM-DD') + '/-/' + end.format('Y-MM-DD'));
|
141 |
-
gawd_draw_analytics_compact(jQuery('#gawd_metric_compact').val(), jQuery('#gawd_metric_compare_compact').val(), 'date', 'line', 'gawd_date_meta');
|
142 |
-
gawd_pie_chart_compact('sessions', 'userType', 'pie', 'gawd_visitors_meta');
|
143 |
-
gawd_draw_analytics_compact('sessions', '', 'country', 'column', 'gawd_country_meta');
|
144 |
-
gawd_pie_chart_compact('sessions', 'browser', 'pie', 'gawd_browser_meta');
|
145 |
-
jQuery('.gawd_wrap').find('.postbox').each(function () {
|
146 |
-
var text = jQuery(this).find('.hndle span').html();
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
|
|
|
1 |
+
function gawd_onclick_refresh() {
|
2 |
+
var end_date = Date.today().add(-1).days().toString("yyyy-MM-dd");
|
3 |
+
var start_date_30 = (Date.today().add(-1).days()).add(-30).days().toString("yyyy-MM-dd");
|
4 |
+
var start_date_7 = (Date.today().add(-1).days()).add(-7).days().toString("yyyy-MM-dd");
|
5 |
+
start_date = start_date_7;
|
6 |
+
var current_id = jQuery(this).attr('id');
|
7 |
+
switch (current_id) {
|
8 |
+
case 'gawd-date-meta_refresh_button':
|
9 |
+
gawd_draw_analytics_compact('sessions', 'users', 'date', 'line', 'gawd_date_meta');
|
10 |
+
break;
|
11 |
+
|
12 |
+
case 'gawd-country-box_refresh_button':
|
13 |
+
gawd_draw_analytics_compact('sessions', '', 'country', 'column', 'gawd_country_meta');
|
14 |
+
break;
|
15 |
+
|
16 |
+
case 'gawd-real-time_refresh_button':
|
17 |
+
gawd_widget_real_time('#gawd_real_time_meta');
|
18 |
+
break;
|
19 |
+
|
20 |
+
case 'gawd-visitors-meta_refresh_button':
|
21 |
+
gawd_pie_chart_compact('sessions', 'userType', 'pie', 'gawd_visitors_meta');
|
22 |
+
break;
|
23 |
+
|
24 |
+
case 'gawd-browser-meta_refresh_button':
|
25 |
+
gawd_pie_chart_compact('sessions', 'browser', 'pie', 'gawd_browser_meta');
|
26 |
+
break;
|
27 |
+
}
|
28 |
+
}
|
29 |
+
function gawd_onclick_more() {
|
30 |
+
|
31 |
+
var current_id = jQuery(this).attr('id');
|
32 |
+
|
33 |
+
switch (current_id) {
|
34 |
+
case 'gawd-date-meta_more_button':
|
35 |
+
window.location.href = gawd_overview.wp_admin_url + 'admin.php?page=gawd_reports&tab=overview';
|
36 |
+
break;
|
37 |
+
|
38 |
+
case 'gawd-country-box_more_button':
|
39 |
+
window.location.href = gawd_overview.wp_admin_url + 'admin.php?page=gawd_reports&tab=location';
|
40 |
+
break;
|
41 |
+
|
42 |
+
case 'gawd-real-time_more_button':
|
43 |
+
window.location.href = gawd_overview.wp_admin_url + 'admin.php?page=gawd_reports&tab=realtime';
|
44 |
+
break;
|
45 |
+
|
46 |
+
case 'gawd-visitors-meta_more_button':
|
47 |
+
window.location.href = gawd_overview.wp_admin_url + 'admin.php?page=gawd_reports&tab=behaviour';
|
48 |
+
break;
|
49 |
+
|
50 |
+
case 'gawd-browser-meta_more_button':
|
51 |
+
window.location.href = gawd_overview.wp_admin_url + 'admin.php?page=gawd_reports&tab=browser';
|
52 |
+
break;
|
53 |
+
}
|
54 |
+
}
|
55 |
+
function gawd_onclick_toggle() {
|
56 |
+
if (jQuery(this).attr('aria-expanded') == 'true') {
|
57 |
+
jQuery(this).attr('aria-expanded', 'false');
|
58 |
+
jQuery(this).closest('.postbox').addClass('closed');
|
59 |
+
} else {
|
60 |
+
jQuery(this).attr('aria-expanded', 'true');
|
61 |
+
jQuery(this).closest('.postbox').removeClass('closed');
|
62 |
+
}
|
63 |
+
}
|
64 |
+
function hide_same_metric(el){
|
65 |
+
var option = jQuery(el).val();
|
66 |
+
var metric_id = "gawd_metric_compact";
|
67 |
+
var metric_compare_id = "gawd_metric_compare_compact";
|
68 |
+
var select_id = jQuery(el).attr("id");
|
69 |
+
if(select_id == metric_id){
|
70 |
+
jQuery("#"+metric_compare_id).find('option').show();
|
71 |
+
jQuery("#"+metric_compare_id).find("option[value='"+option+"']").hide();
|
72 |
+
}
|
73 |
+
else if(select_id == metric_compare_id){
|
74 |
+
jQuery("#"+metric_id).find('option').show();
|
75 |
+
jQuery("#"+metric_id).find("option[value='"+option+"']").hide();
|
76 |
+
}
|
77 |
+
}
|
78 |
+
jQuery(document).ready(function () {
|
79 |
+
|
80 |
+
if(gawd_overview.enableHoverTooltip == 'on'){
|
81 |
+
jQuery('.load_tooltip').mouseenter(function(){
|
82 |
+
jQuery(this).attr('title',jQuery(this).data('hint'));
|
83 |
+
})
|
84 |
+
jQuery('.postbox-container, .gawd_wrap').tooltip({position: {
|
85 |
+
my: "center",
|
86 |
+
at: "right+200",
|
87 |
+
track: false,
|
88 |
+
using: function(position, feedback) {
|
89 |
+
jQuery(this).css(position);
|
90 |
+
}
|
91 |
+
}
|
92 |
+
});
|
93 |
+
}
|
94 |
+
jQuery('.gawd_wrap').find('.postbox').each(function () {
|
95 |
+
var temp = jQuery(this);
|
96 |
+
|
97 |
+
jQuery(this).find('.hndle span').html();
|
98 |
+
var temp_id = temp.attr('id');
|
99 |
+
var temp_html = temp.html();
|
100 |
+
new_text_refresh = buttons_refresh;
|
101 |
+
new_text_full = buttons_full;
|
102 |
+
var new_text ='</button>';
|
103 |
+
if(temp.attr('id') == 'gawd-real-time'){
|
104 |
+
new_text += new_text_refresh.replace('{{refreshid}}', temp_id + '_refresh_button');
|
105 |
+
|
106 |
+
|
107 |
+
}
|
108 |
+
new_text += new_text_full.replace( '{{moreid}}', temp_id + '_more_button' );
|
109 |
+
temp_html = temp_html.replace( '</button>', new_text );
|
110 |
+
temp.html( temp_html );
|
111 |
+
});
|
112 |
+
jQuery('.gawd-refresh').unbind('click').on('click', gawd_onclick_refresh);
|
113 |
+
jQuery('.gawd-more').unbind('click').on('click', gawd_onclick_more);
|
114 |
+
jQuery('.gawd_wrap').find('.toggle-indicator').closest('button').unbind('click').on('click', gawd_onclick_toggle);
|
115 |
+
|
116 |
+
})
|
117 |
+
|
118 |
+
function datepicker_js_compact() {
|
119 |
+
gawd_datepicker_main_compact(default_start(), default_end());
|
120 |
+
jQuery('#reportrange').daterangepicker({
|
121 |
+
ranges: {
|
122 |
+
'Today': [moment(), moment()],
|
123 |
+
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
|
124 |
+
'Last 7 Days': [moment().subtract(7, 'days'), moment().subtract(1, 'days')],
|
125 |
+
'Last Week': [moment().subtract(1, 'week').startOf('week'), moment().subtract(1, 'week').endOf('week')],
|
126 |
+
'Last 30 Days': [moment().subtract(30, 'days'), moment().subtract(1, 'days')],
|
127 |
+
'This Month': [moment().startOf('month'), moment().endOf('month')],
|
128 |
+
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
|
129 |
+
},
|
130 |
+
"startDate": default_start(),
|
131 |
+
"endDate": default_end(),
|
132 |
+
"maxDate": moment(),
|
133 |
+
"alwaysShowCalendars": true,
|
134 |
+
"opens": "right",
|
135 |
+
"applyClass": 'gawd_main_apply'
|
136 |
+
}, gawd_datepicker_main_compact);
|
137 |
+
|
138 |
+
function gawd_datepicker_main_compact(start, end) {
|
139 |
+
jQuery('#reportrange span').html(start.format('Y-MM-DD') + ' - ' + end.format('Y-MM-DD'));
|
140 |
+
jQuery('#gawd_start_end_date_compact').val(start.format('Y-MM-DD') + '/-/' + end.format('Y-MM-DD'));
|
141 |
+
gawd_draw_analytics_compact(jQuery('#gawd_metric_compact').val(), jQuery('#gawd_metric_compare_compact').val(), 'date', 'line', 'gawd_date_meta');
|
142 |
+
gawd_pie_chart_compact('sessions', 'userType', 'pie', 'gawd_visitors_meta');
|
143 |
+
gawd_draw_analytics_compact('sessions', '', 'country', 'column', 'gawd_country_meta');
|
144 |
+
gawd_pie_chart_compact('sessions', 'browser', 'pie', 'gawd_browser_meta');
|
145 |
+
jQuery('.gawd_wrap').find('.postbox').each(function () {
|
146 |
+
var text = jQuery(this).find('.hndle span').html();
|
147 |
+
if (typeof text !== "undefined") {
|
148 |
+
text = text.split(' (');
|
149 |
+
var new_text = text[0];
|
150 |
+
if (new_text != 'Real Time') {
|
151 |
+
new_text += ' (' + start.format('Y-MM-DD') + ' - ' + end.format('Y-MM-DD') + ')';
|
152 |
+
jQuery(this).find('.hndle span').html(new_text);
|
153 |
+
}
|
154 |
+
}
|
155 |
+
});
|
156 |
+
|
157 |
+
}
|
158 |
+
}
|
inc/js/images/lens.svg
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
-
<?xml version="1.0" encoding="utf-8"?>
|
2 |
-
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
3 |
-
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="19px" height="19px" viewBox="0 0 19 19">
|
4 |
-
<circle cx="9" cy="9" r="7" stroke="#000000" stroke-width="1.5" fill-opacity="0"/>
|
5 |
-
<line x1="6" y1="9" x2="12" y2="9" stroke="#000000" stroke-width="1.5"/>
|
6 |
-
<line x1="14" y1="14" x2="19" y2="19" stroke="#000000" stroke-width="1.5"/>
|
7 |
</svg>
|
1 |
+
<?xml version="1.0" encoding="utf-8"?>
|
2 |
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
3 |
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="19px" height="19px" viewBox="0 0 19 19">
|
4 |
+
<circle cx="9" cy="9" r="7" stroke="#000000" stroke-width="1.5" fill-opacity="0"/>
|
5 |
+
<line x1="6" y1="9" x2="12" y2="9" stroke="#000000" stroke-width="1.5"/>
|
6 |
+
<line x1="14" y1="14" x2="19" y2="19" stroke="#000000" stroke-width="1.5"/>
|
7 |
</svg>
|
inc/js/jquery.cookie.js
CHANGED
@@ -1,117 +1,117 @@
|
|
1 |
-
/*!
|
2 |
-
* jQuery Cookie Plugin v1.4.1
|
3 |
-
* https://github.com/carhartl/jquery-cookie
|
4 |
-
*
|
5 |
-
* Copyright 2013 Klaus Hartl
|
6 |
-
* Released under the MIT license
|
7 |
-
*/
|
8 |
-
(function (factory) {
|
9 |
-
if (typeof define === 'function' && define.amd) {
|
10 |
-
// AMD
|
11 |
-
define(['jquery'], factory);
|
12 |
-
} else if (typeof exports === 'object') {
|
13 |
-
// CommonJS
|
14 |
-
factory(require('jquery'));
|
15 |
-
} else {
|
16 |
-
// Browser globals
|
17 |
-
factory(jQuery);
|
18 |
-
}
|
19 |
-
}(function ($) {
|
20 |
-
|
21 |
-
var pluses = /\+/g;
|
22 |
-
|
23 |
-
function encode(s) {
|
24 |
-
return config.raw ? s : encodeURIComponent(s);
|
25 |
-
}
|
26 |
-
|
27 |
-
function decode(s) {
|
28 |
-
return config.raw ? s : decodeURIComponent(s);
|
29 |
-
}
|
30 |
-
|
31 |
-
function stringifyCookieValue(value) {
|
32 |
-
return encode(config.json ? JSON.stringify(value) : String(value));
|
33 |
-
}
|
34 |
-
|
35 |
-
function parseCookieValue(s) {
|
36 |
-
if (s.indexOf('"') === 0) {
|
37 |
-
// This is a quoted cookie as according to RFC2068, unescape...
|
38 |
-
s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
|
39 |
-
}
|
40 |
-
|
41 |
-
try {
|
42 |
-
// Replace server-side written pluses with spaces.
|
43 |
-
// If we can't decode the cookie, ignore it, it's unusable.
|
44 |
-
// If we can't parse the cookie, ignore it, it's unusable.
|
45 |
-
s = decodeURIComponent(s.replace(pluses, ' '));
|
46 |
-
return config.json ? JSON.parse(s) : s;
|
47 |
-
} catch(e) {}
|
48 |
-
}
|
49 |
-
|
50 |
-
function read(s, converter) {
|
51 |
-
var value = config.raw ? s : parseCookieValue(s);
|
52 |
-
return $.isFunction(converter) ? converter(value) : value;
|
53 |
-
}
|
54 |
-
|
55 |
-
var config = $.cookie = function (key, value, options) {
|
56 |
-
|
57 |
-
// Write
|
58 |
-
|
59 |
-
if (value !== undefined && !$.isFunction(value)) {
|
60 |
-
options = $.extend({}, config.defaults, options);
|
61 |
-
|
62 |
-
if (typeof options.expires === 'number') {
|
63 |
-
var days = options.expires, t = options.expires = new Date();
|
64 |
-
t.setTime(+t + days * 864e+5);
|
65 |
-
}
|
66 |
-
|
67 |
-
return (document.cookie = [
|
68 |
-
encode(key), '=', stringifyCookieValue(value),
|
69 |
-
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
|
70 |
-
options.path ? '; path=' + options.path : '',
|
71 |
-
options.domain ? '; domain=' + options.domain : '',
|
72 |
-
options.secure ? '; secure' : ''
|
73 |
-
].join(''));
|
74 |
-
}
|
75 |
-
|
76 |
-
// Read
|
77 |
-
|
78 |
-
var result = key ? undefined : {};
|
79 |
-
|
80 |
-
// To prevent the for loop in the first place assign an empty array
|
81 |
-
// in case there are no cookies at all. Also prevents odd result when
|
82 |
-
// calling $.cookie().
|
83 |
-
var cookies = document.cookie ? document.cookie.split('; ') : [];
|
84 |
-
|
85 |
-
for (var i = 0, l = cookies.length; i < l; i++) {
|
86 |
-
var parts = cookies[i].split('=');
|
87 |
-
var name = decode(parts.shift());
|
88 |
-
var cookie = parts.join('=');
|
89 |
-
|
90 |
-
if (key && key === name) {
|
91 |
-
// If second argument (value) is a function it's a converter...
|
92 |
-
result = read(cookie, value);
|
93 |
-
break;
|
94 |
-
}
|
95 |
-
|
96 |
-
// Prevent storing a cookie that we couldn't decode.
|
97 |
-
if (!key && (cookie = read(cookie)) !== undefined) {
|
98 |
-
result[name] = cookie;
|
99 |
-
}
|
100 |
-
}
|
101 |
-
|
102 |
-
return result;
|
103 |
-
};
|
104 |
-
|
105 |
-
config.defaults = {};
|
106 |
-
|
107 |
-
$.removeCookie = function (key, options) {
|
108 |
-
if ($.cookie(key) === undefined) {
|
109 |
-
return false;
|
110 |
-
}
|
111 |
-
|
112 |
-
// Must not alter options, thus extending a fresh object...
|
113 |
-
$.cookie(key, '', $.extend({}, options, { expires: -1 }));
|
114 |
-
return !$.cookie(key);
|
115 |
-
};
|
116 |
-
|
117 |
-
}));
|
1 |
+
/*!
|
2 |
+
* jQuery Cookie Plugin v1.4.1
|
3 |
+
* https://github.com/carhartl/jquery-cookie
|
4 |
+
*
|
5 |
+
* Copyright 2013 Klaus Hartl
|
6 |
+
* Released under the MIT license
|
7 |
+
*/
|
8 |
+
(function (factory) {
|
9 |
+
if (typeof define === 'function' && define.amd) {
|
10 |
+
// AMD
|
11 |
+
define(['jquery'], factory);
|
12 |
+
} else if (typeof exports === 'object') {
|
13 |
+
// CommonJS
|
14 |
+
factory(require('jquery'));
|
15 |
+
} else {
|
16 |
+
// Browser globals
|
17 |
+
factory(jQuery);
|
18 |
+
}
|
19 |
+
}(function ($) {
|
20 |
+
|
21 |
+
var pluses = /\+/g;
|
22 |
+
|
23 |
+
function encode(s) {
|
24 |
+
return config.raw ? s : encodeURIComponent(s);
|
25 |
+
}
|
26 |
+
|
27 |
+
function decode(s) {
|
28 |
+
return config.raw ? s : decodeURIComponent(s);
|
29 |
+
}
|
30 |
+
|
31 |
+
function stringifyCookieValue(value) {
|
32 |
+
return encode(config.json ? JSON.stringify(value) : String(value));
|
33 |
+
}
|
34 |
+
|
35 |
+
function parseCookieValue(s) {
|
36 |
+
if (s.indexOf('"') === 0) {
|
37 |
+
// This is a quoted cookie as according to RFC2068, unescape...
|
38 |
+
s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
|
39 |
+
}
|
40 |
+
|
41 |
+
try {
|
42 |
+
// Replace server-side written pluses with spaces.
|
43 |
+
// If we can't decode the cookie, ignore it, it's unusable.
|
44 |
+
// If we can't parse the cookie, ignore it, it's unusable.
|
45 |
+
s = decodeURIComponent(s.replace(pluses, ' '));
|
46 |
+
return config.json ? JSON.parse(s) : s;
|
47 |
+
} catch(e) {}
|
48 |
+
}
|
49 |
+
|
50 |
+
function read(s, converter) {
|
51 |
+
var value = config.raw ? s : parseCookieValue(s);
|
52 |
+
return $.isFunction(converter) ? converter(value) : value;
|
53 |
+
}
|
54 |
+
|
55 |
+
var config = $.cookie = function (key, value, options) {
|
56 |
+
|
57 |
+
// Write
|
58 |
+
|
59 |
+
if (value !== undefined && !$.isFunction(value)) {
|
60 |
+
options = $.extend({}, config.defaults, options);
|
61 |
+
|
62 |
+
if (typeof options.expires === 'number') {
|
63 |
+
var days = options.expires, t = options.expires = new Date();
|
64 |
+
t.setTime(+t + days * 864e+5);
|
65 |
+
}
|
66 |
+
|
67 |
+
return (document.cookie = [
|
68 |
+
encode(key), '=', stringifyCookieValue(value),
|
69 |
+
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
|
70 |
+
options.path ? '; path=' + options.path : '',
|
71 |
+
options.domain ? '; domain=' + options.domain : '',
|
72 |
+
options.secure ? '; secure' : ''
|
73 |
+
].join(''));
|
74 |
+
}
|
75 |
+
|
76 |
+
// Read
|
77 |
+
|
78 |
+
var result = key ? undefined : {};
|
79 |
+
|
80 |
+
// To prevent the for loop in the first place assign an empty array
|
81 |
+
// in case there are no cookies at all. Also prevents odd result when
|
82 |
+
// calling $.cookie().
|
83 |
+
var cookies = document.cookie ? document.cookie.split('; ') : [];
|
84 |
+
|
85 |
+
for (var i = 0, l = cookies.length; i < l; i++) {
|
86 |
+
var parts = cookies[i].split('=');
|
87 |
+
var name = decode(parts.shift());
|
88 |
+
var cookie = parts.join('=');
|
89 |
+
|
90 |
+
if (key && key === name) {
|
91 |
+
// If second argument (value) is a function it's a converter...
|
92 |
+
result = read(cookie, value);
|
93 |
+
break;
|
94 |
+
}
|
95 |
+
|
96 |
+
// Prevent storing a cookie that we couldn't decode.
|
97 |
+
if (!key && (cookie = read(cookie)) !== undefined) {
|
98 |
+
result[name] = cookie;
|
99 |
+
}
|
100 |
+
}
|
101 |
+
|
102 |
+
return result;
|
103 |
+
};
|
104 |
+
|
105 |
+
config.defaults = {};
|
106 |
+
|
107 |
+
$.removeCookie = function (key, options) {
|
108 |
+
if ($.cookie(key) === undefined) {
|
109 |
+
return false;
|
110 |
+
}
|
111 |
+
|
112 |
+
// Must not alter options, thus extending a fresh object...
|
113 |
+
$.cookie(key, '', $.extend({}, options, { expires: -1 }));
|
114 |
+
return !$.cookie(key);
|
115 |
+
};
|
116 |
+
|
117 |
+
}));
|
inc/js/js_highlight.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
/*! highlight.js v9.2.0 | BSD3 License | git.io/hljslicense */
|
2 |
!function(e){var n="object"==typeof window&&window||"object"==typeof self&&self;"undefined"!=typeof exports?e(exports):n&&(n.hljs=e({}),"function"==typeof define&&define.amd&&define([],function(){return n.hljs}))}(function(e){function n(e){return e.replace(/&/gm,"&").replace(/</gm,"<").replace(/>/gm,">")}function t(e){return e.nodeName.toLowerCase()}function r(e,n){var t=e&&e.exec(n);return t&&0==t.index}function a(e){return/^(no-?highlight|plain|text)$/i.test(e)}function i(e){var n,t,r,i=e.className+" ";if(i+=e.parentNode?e.parentNode.className:"",t=/\blang(?:uage)?-([\w-]+)\b/i.exec(i))return w(t[1])?t[1]:"no-highlight";for(i=i.split(/\s+/),n=0,r=i.length;r>n;n++)if(w(i[n])||a(i[n]))return i[n]}function o(e,n){var t,r={};for(t in e)r[t]=e[t];if(n)for(t in n)r[t]=n[t];return r}function u(e){var n=[];return function r(e,a){for(var i=e.firstChild;i;i=i.nextSibling)3==i.nodeType?a+=i.nodeValue.length:1==i.nodeType&&(n.push({event:"start",offset:a,node:i}),a=r(i,a),t(i).match(/br|hr|img|input/)||n.push({event:"stop",offset:a,node:i}));return a}(e,0),n}function c(e,r,a){function i(){return e.length&&r.length?e[0].offset!=r[0].offset?e[0].offset<r[0].offset?e:r:"start"==r[0].event?e:r:e.length?e:r}function o(e){function r(e){return" "+e.nodeName+'="'+n(e.value)+'"'}f+="<"+t(e)+Array.prototype.map.call(e.attributes,r).join("")+">"}function u(e){f+="</"+t(e)+">"}function c(e){("start"==e.event?o:u)(e.node)}for(var s=0,f="",l=[];e.length||r.length;){var g=i();if(f+=n(a.substr(s,g[0].offset-s)),s=g[0].offset,g==e){l.reverse().forEach(u);do c(g.splice(0,1)[0]),g=i();while(g==e&&g.length&&g[0].offset==s);l.reverse().forEach(o)}else"start"==g[0].event?l.push(g[0].node):l.pop(),c(g.splice(0,1)[0])}return f+n(a.substr(s))}function s(e){function n(e){return e&&e.source||e}function t(t,r){return new RegExp(n(t),"m"+(e.cI?"i":"")+(r?"g":""))}function r(a,i){if(!a.compiled){if(a.compiled=!0,a.k=a.k||a.bK,a.k){var u={},c=function(n,t){e.cI&&(t=t.toLowerCase()),t.split(" ").forEach(function(e){var t=e.split("|");u[t[0]]=[n,t[1]?Number(t[1]):1]})};"string"==typeof a.k?c("keyword",a.k):Object.keys(a.k).forEach(function(e){c(e,a.k[e])}),a.k=u}a.lR=t(a.l||/\b\w+\b/,!0),i&&(a.bK&&(a.b="\\b("+a.bK.split(" ").join("|")+")\\b"),a.b||(a.b=/\B|\b/),a.bR=t(a.b),a.e||a.eW||(a.e=/\B|\b/),a.e&&(a.eR=t(a.e)),a.tE=n(a.e)||"",a.eW&&i.tE&&(a.tE+=(a.e?"|":"")+i.tE)),a.i&&(a.iR=t(a.i)),void 0===a.r&&(a.r=1),a.c||(a.c=[]);var s=[];a.c.forEach(function(e){e.v?e.v.forEach(function(n){s.push(o(e,n))}):s.push("self"==e?a:e)}),a.c=s,a.c.forEach(function(e){r(e,a)}),a.starts&&r(a.starts,i);var f=a.c.map(function(e){return e.bK?"\\.?("+e.b+")\\.?":e.b}).concat([a.tE,a.i]).map(n).filter(Boolean);a.t=f.length?t(f.join("|"),!0):{exec:function(){return null}}}}r(e)}function f(e,t,a,i){function o(e,n){for(var t=0;t<n.c.length;t++)if(r(n.c[t].bR,e))return n.c[t]}function u(e,n){if(r(e.eR,n)){for(;e.endsParent&&e.parent;)e=e.parent;return e}return e.eW?u(e.parent,n):void 0}function c(e,n){return!a&&r(n.iR,e)}function g(e,n){var t=N.cI?n[0].toLowerCase():n[0];return e.k.hasOwnProperty(t)&&e.k[t]}function p(e,n,t,r){var a=r?"":E.classPrefix,i='<span class="'+a,o=t?"":"</span>";return i+=e+'">',i+n+o}function h(){if(!k.k)return n(M);var e="",t=0;k.lR.lastIndex=0;for(var r=k.lR.exec(M);r;){e+=n(M.substr(t,r.index-t));var a=g(k,r);a?(B+=a[1],e+=p(a[0],n(r[0]))):e+=n(r[0]),t=k.lR.lastIndex,r=k.lR.exec(M)}return e+n(M.substr(t))}function d(){var e="string"==typeof k.sL;if(e&&!R[k.sL])return n(M);var t=e?f(k.sL,M,!0,y[k.sL]):l(M,k.sL.length?k.sL:void 0);return k.r>0&&(B+=t.r),e&&(y[k.sL]=t.top),p(t.language,t.value,!1,!0)}function b(){L+=void 0!==k.sL?d():h(),M=""}function v(e,n){L+=e.cN?p(e.cN,"",!0):"",k=Object.create(e,{parent:{value:k}})}function m(e,n){if(M+=e,void 0===n)return b(),0;var t=o(n,k);if(t)return t.skip?M+=n:(t.eB&&(M+=n),b(),t.rB||t.eB||(M=n)),v(t,n),t.rB?0:n.length;var r=u(k,n);if(r){var a=k;a.skip?M+=n:(a.rE||a.eE||(M+=n),b(),a.eE&&(M=n));do k.cN&&(L+="</span>"),k.skip||(B+=k.r),k=k.parent;while(k!=r.parent);return r.starts&&v(r.starts,""),a.rE?0:n.length}if(c(n,k))throw new Error('Illegal lexeme "'+n+'" for mode "'+(k.cN||"<unnamed>")+'"');return M+=n,n.length||1}var N=w(e);if(!N)throw new Error('Unknown language: "'+e+'"');s(N);var x,k=i||N,y={},L="";for(x=k;x!=N;x=x.parent)x.cN&&(L=p(x.cN,"",!0)+L);var M="",B=0;try{for(var C,j,I=0;;){if(k.t.lastIndex=I,C=k.t.exec(t),!C)break;j=m(t.substr(I,C.index-I),C[0]),I=C.index+j}for(m(t.substr(I)),x=k;x.parent;x=x.parent)x.cN&&(L+="</span>");return{r:B,value:L,language:e,top:k}}catch(O){if(-1!=O.message.indexOf("Illegal"))return{r:0,value:n(t)};throw O}}function l(e,t){t=t||E.languages||Object.keys(R);var r={r:0,value:n(e)},a=r;return t.forEach(function(n){if(w(n)){var t=f(n,e,!1);t.language=n,t.r>a.r&&(a=t),t.r>r.r&&(a=r,r=t)}}),a.language&&(r.second_best=a),r}function g(e){return E.tabReplace&&(e=e.replace(/^((<[^>]+>|\t)+)/gm,function(e,n){return n.replace(/\t/g,E.tabReplace)})),E.useBR&&(e=e.replace(/\n/g,"<br>")),e}function p(e,n,t){var r=n?x[n]:t,a=[e.trim()];return e.match(/\bhljs\b/)||a.push("hljs"),-1===e.indexOf(r)&&a.push(r),a.join(" ").trim()}function h(e){var n=i(e);if(!a(n)){var t;E.useBR?(t=document.createElementNS("http://www.w3.org/1999/xhtml","div"),t.innerHTML=e.innerHTML.replace(/\n/g,"").replace(/<br[ \/]*>/g,"\n")):t=e;var r=t.textContent,o=n?f(n,r,!0):l(r),s=u(t);if(s.length){var h=document.createElementNS("http://www.w3.org/1999/xhtml","div");h.innerHTML=o.value,o.value=c(s,u(h),r)}o.value=g(o.value),e.innerHTML=o.value,e.className=p(e.className,n,o.language),e.result={language:o.language,re:o.r},o.second_best&&(e.second_best={language:o.second_best.language,re:o.second_best.r})}}function d(e){E=o(E,e)}function b(){if(!b.called){b.called=!0;var e=document.querySelectorAll("pre code");Array.prototype.forEach.call(e,h)}}function v(){addEventListener("DOMContentLoaded",b,!1),addEventListener("load",b,!1)}function m(n,t){var r=R[n]=t(e);r.aliases&&r.aliases.forEach(function(e){x[e]=n})}function N(){return Object.keys(R)}function w(e){return e=(e||"").toLowerCase(),R[e]||R[x[e]]}var E={classPrefix:"hljs-",tabReplace:null,useBR:!1,languages:void 0},R={},x={};return e.highlight=f,e.highlightAuto=l,e.fixMarkup=g,e.highlightBlock=h,e.configure=d,e.initHighlighting=b,e.initHighlightingOnLoad=v,e.registerLanguage=m,e.listLanguages=N,e.getLanguage=w,e.inherit=o,e.IR="[a-zA-Z]\\w*",e.UIR="[a-zA-Z_]\\w*",e.NR="\\b\\d+(\\.\\d+)?",e.CNR="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",e.BNR="\\b(0b[01]+)",e.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",e.BE={b:"\\\\[\\s\\S]",r:0},e.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[e.BE]},e.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[e.BE]},e.PWM={b:/\b(a|an|the|are|I|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|like)\b/},e.C=function(n,t,r){var a=e.inherit({cN:"comment",b:n,e:t,c:[]},r||{});return a.c.push(e.PWM),a.c.push({cN:"doctag",b:"(?:TODO|FIXME|NOTE|BUG|XXX):",r:0}),a},e.CLCM=e.C("//","$"),e.CBCM=e.C("/\\*","\\*/"),e.HCM=e.C("#","$"),e.NM={cN:"number",b:e.NR,r:0},e.CNM={cN:"number",b:e.CNR,r:0},e.BNM={cN:"number",b:e.BNR,r:0},e.CSSNM={cN:"number",b:e.NR+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",r:0},e.RM={cN:"regexp",b:/\//,e:/\/[gimuy]*/,i:/\n/,c:[e.BE,{b:/\[/,e:/\]/,r:0,c:[e.BE]}]},e.TM={cN:"title",b:e.IR,r:0},e.UTM={cN:"title",b:e.UIR,r:0},e.METHOD_GUARD={b:"\\.\\s*"+e.UIR,r:0},e});hljs.registerLanguage("javascript",function(e){return{aliases:["js","jsx"],k:{keyword:"in of if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const export super debugger as async await static import from as",literal:"true false null undefined NaN Infinity",built_in:"eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError Number Math Date String RegExp Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require module console window document Symbol Set Map WeakSet WeakMap Proxy Reflect Promise"},c:[{cN:"meta",r:10,b:/^\s*['"]use (strict|asm)['"]/},{cN:"meta",b:/^#!/,e:/$/},e.ASM,e.QSM,{cN:"string",b:"`",e:"`",c:[e.BE,{cN:"subst",b:"\\$\\{",e:"\\}"}]},e.CLCM,e.CBCM,{cN:"number",v:[{b:"\\b(0[bB][01]+)"},{b:"\\b(0[oO][0-7]+)"},{b:e.CNR}],r:0},{b:"("+e.RSR+"|\\b(case|return|throw)\\b)\\s*",k:"return throw case",c:[e.CLCM,e.CBCM,e.RM,{b:/</,e:/(\/\w+|\w+\/)>/,sL:"xml",c:[{b:/<\w+\/>/,skip:!0},{b:/<\w+/,e:/(\/\w+|\w+\/)>/,skip:!0,c:["self"]}]}],r:0},{cN:"function",bK:"function",e:/\{/,eE:!0,c:[e.inherit(e.TM,{b:/[A-Za-z$_][0-9A-Za-z$_]*/}),{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,c:[e.CLCM,e.CBCM]}],i:/\[|%/},{b:/\$[(.]/},e.METHOD_GUARD,{cN:"class",bK:"class",e:/[{;=]/,eE:!0,i:/[:"\[\]]/,c:[{bK:"extends"},e.UTM]},{bK:"constructor",e:/\{/,eE:!0}],i:/#(?!!)/}});hljs.registerLanguage("json",function(e){var i={literal:"true false null"},n=[e.QSM,e.CNM],r={e:",",eW:!0,eE:!0,c:n,k:i},t={b:"{",e:"}",c:[{cN:"attr",b:/"/,e:/"/,c:[e.BE],i:"\\n"},e.inherit(r,{b:/:/})],i:"\\S"},c={b:"\\[",e:"\\]",c:[e.inherit(r)],i:"\\S"};return n.splice(n.length,0,t,c),{c:n,k:i,i:"\\S"}});
|
1 |
+
/*! highlight.js v9.2.0 | BSD3 License | git.io/hljslicense */
|
2 |
!function(e){var n="object"==typeof window&&window||"object"==typeof self&&self;"undefined"!=typeof exports?e(exports):n&&(n.hljs=e({}),"function"==typeof define&&define.amd&&define([],function(){return n.hljs}))}(function(e){function n(e){return e.replace(/&/gm,"&").replace(/</gm,"<").replace(/>/gm,">")}function t(e){return e.nodeName.toLowerCase()}function r(e,n){var t=e&&e.exec(n);return t&&0==t.index}function a(e){return/^(no-?highlight|plain|text)$/i.test(e)}function i(e){var n,t,r,i=e.className+" ";if(i+=e.parentNode?e.parentNode.className:"",t=/\blang(?:uage)?-([\w-]+)\b/i.exec(i))return w(t[1])?t[1]:"no-highlight";for(i=i.split(/\s+/),n=0,r=i.length;r>n;n++)if(w(i[n])||a(i[n]))return i[n]}function o(e,n){var t,r={};for(t in e)r[t]=e[t];if(n)for(t in n)r[t]=n[t];return r}function u(e){var n=[];return function r(e,a){for(var i=e.firstChild;i;i=i.nextSibling)3==i.nodeType?a+=i.nodeValue.length:1==i.nodeType&&(n.push({event:"start",offset:a,node:i}),a=r(i,a),t(i).match(/br|hr|img|input/)||n.push({event:"stop",offset:a,node:i}));return a}(e,0),n}function c(e,r,a){function i(){return e.length&&r.length?e[0].offset!=r[0].offset?e[0].offset<r[0].offset?e:r:"start"==r[0].event?e:r:e.length?e:r}function o(e){function r(e){return" "+e.nodeName+'="'+n(e.value)+'"'}f+="<"+t(e)+Array.prototype.map.call(e.attributes,r).join("")+">"}function u(e){f+="</"+t(e)+">"}function c(e){("start"==e.event?o:u)(e.node)}for(var s=0,f="",l=[];e.length||r.length;){var g=i();if(f+=n(a.substr(s,g[0].offset-s)),s=g[0].offset,g==e){l.reverse().forEach(u);do c(g.splice(0,1)[0]),g=i();while(g==e&&g.length&&g[0].offset==s);l.reverse().forEach(o)}else"start"==g[0].event?l.push(g[0].node):l.pop(),c(g.splice(0,1)[0])}return f+n(a.substr(s))}function s(e){function n(e){return e&&e.source||e}function t(t,r){return new RegExp(n(t),"m"+(e.cI?"i":"")+(r?"g":""))}function r(a,i){if(!a.compiled){if(a.compiled=!0,a.k=a.k||a.bK,a.k){var u={},c=function(n,t){e.cI&&(t=t.toLowerCase()),t.split(" ").forEach(function(e){var t=e.split("|");u[t[0]]=[n,t[1]?Number(t[1]):1]})};"string"==typeof a.k?c("keyword",a.k):Object.keys(a.k).forEach(function(e){c(e,a.k[e])}),a.k=u}a.lR=t(a.l||/\b\w+\b/,!0),i&&(a.bK&&(a.b="\\b("+a.bK.split(" ").join("|")+")\\b"),a.b||(a.b=/\B|\b/),a.bR=t(a.b),a.e||a.eW||(a.e=/\B|\b/),a.e&&(a.eR=t(a.e)),a.tE=n(a.e)||"",a.eW&&i.tE&&(a.tE+=(a.e?"|":"")+i.tE)),a.i&&(a.iR=t(a.i)),void 0===a.r&&(a.r=1),a.c||(a.c=[]);var s=[];a.c.forEach(function(e){e.v?e.v.forEach(function(n){s.push(o(e,n))}):s.push("self"==e?a:e)}),a.c=s,a.c.forEach(function(e){r(e,a)}),a.starts&&r(a.starts,i);var f=a.c.map(function(e){return e.bK?"\\.?("+e.b+")\\.?":e.b}).concat([a.tE,a.i]).map(n).filter(Boolean);a.t=f.length?t(f.join("|"),!0):{exec:function(){return null}}}}r(e)}function f(e,t,a,i){function o(e,n){for(var t=0;t<n.c.length;t++)if(r(n.c[t].bR,e))return n.c[t]}function u(e,n){if(r(e.eR,n)){for(;e.endsParent&&e.parent;)e=e.parent;return e}return e.eW?u(e.parent,n):void 0}function c(e,n){return!a&&r(n.iR,e)}function g(e,n){var t=N.cI?n[0].toLowerCase():n[0];return e.k.hasOwnProperty(t)&&e.k[t]}function p(e,n,t,r){var a=r?"":E.classPrefix,i='<span class="'+a,o=t?"":"</span>";return i+=e+'">',i+n+o}function h(){if(!k.k)return n(M);var e="",t=0;k.lR.lastIndex=0;for(var r=k.lR.exec(M);r;){e+=n(M.substr(t,r.index-t));var a=g(k,r);a?(B+=a[1],e+=p(a[0],n(r[0]))):e+=n(r[0]),t=k.lR.lastIndex,r=k.lR.exec(M)}return e+n(M.substr(t))}function d(){var e="string"==typeof k.sL;if(e&&!R[k.sL])return n(M);var t=e?f(k.sL,M,!0,y[k.sL]):l(M,k.sL.length?k.sL:void 0);return k.r>0&&(B+=t.r),e&&(y[k.sL]=t.top),p(t.language,t.value,!1,!0)}function b(){L+=void 0!==k.sL?d():h(),M=""}function v(e,n){L+=e.cN?p(e.cN,"",!0):"",k=Object.create(e,{parent:{value:k}})}function m(e,n){if(M+=e,void 0===n)return b(),0;var t=o(n,k);if(t)return t.skip?M+=n:(t.eB&&(M+=n),b(),t.rB||t.eB||(M=n)),v(t,n),t.rB?0:n.length;var r=u(k,n);if(r){var a=k;a.skip?M+=n:(a.rE||a.eE||(M+=n),b(),a.eE&&(M=n));do k.cN&&(L+="</span>"),k.skip||(B+=k.r),k=k.parent;while(k!=r.parent);return r.starts&&v(r.starts,""),a.rE?0:n.length}if(c(n,k))throw new Error('Illegal lexeme "'+n+'" for mode "'+(k.cN||"<unnamed>")+'"');return M+=n,n.length||1}var N=w(e);if(!N)throw new Error('Unknown language: "'+e+'"');s(N);var x,k=i||N,y={},L="";for(x=k;x!=N;x=x.parent)x.cN&&(L=p(x.cN,"",!0)+L);var M="",B=0;try{for(var C,j,I=0;;){if(k.t.lastIndex=I,C=k.t.exec(t),!C)break;j=m(t.substr(I,C.index-I),C[0]),I=C.index+j}for(m(t.substr(I)),x=k;x.parent;x=x.parent)x.cN&&(L+="</span>");return{r:B,value:L,language:e,top:k}}catch(O){if(-1!=O.message.indexOf("Illegal"))return{r:0,value:n(t)};throw O}}function l(e,t){t=t||E.languages||Object.keys(R);var r={r:0,value:n(e)},a=r;return t.forEach(function(n){if(w(n)){var t=f(n,e,!1);t.language=n,t.r>a.r&&(a=t),t.r>r.r&&(a=r,r=t)}}),a.language&&(r.second_best=a),r}function g(e){return E.tabReplace&&(e=e.replace(/^((<[^>]+>|\t)+)/gm,function(e,n){return n.replace(/\t/g,E.tabReplace)})),E.useBR&&(e=e.replace(/\n/g,"<br>")),e}function p(e,n,t){var r=n?x[n]:t,a=[e.trim()];return e.match(/\bhljs\b/)||a.push("hljs"),-1===e.indexOf(r)&&a.push(r),a.join(" ").trim()}function h(e){var n=i(e);if(!a(n)){var t;E.useBR?(t=document.createElementNS("http://www.w3.org/1999/xhtml","div"),t.innerHTML=e.innerHTML.replace(/\n/g,"").replace(/<br[ \/]*>/g,"\n")):t=e;var r=t.textContent,o=n?f(n,r,!0):l(r),s=u(t);if(s.length){var h=document.createElementNS("http://www.w3.org/1999/xhtml","div");h.innerHTML=o.value,o.value=c(s,u(h),r)}o.value=g(o.value),e.innerHTML=o.value,e.className=p(e.className,n,o.language),e.result={language:o.language,re:o.r},o.second_best&&(e.second_best={language:o.second_best.language,re:o.second_best.r})}}function d(e){E=o(E,e)}function b(){if(!b.called){b.called=!0;var e=document.querySelectorAll("pre code");Array.prototype.forEach.call(e,h)}}function v(){addEventListener("DOMContentLoaded",b,!1),addEventListener("load",b,!1)}function m(n,t){var r=R[n]=t(e);r.aliases&&r.aliases.forEach(function(e){x[e]=n})}function N(){return Object.keys(R)}function w(e){return e=(e||"").toLowerCase(),R[e]||R[x[e]]}var E={classPrefix:"hljs-",tabReplace:null,useBR:!1,languages:void 0},R={},x={};return e.highlight=f,e.highlightAuto=l,e.fixMarkup=g,e.highlightBlock=h,e.configure=d,e.initHighlighting=b,e.initHighlightingOnLoad=v,e.registerLanguage=m,e.listLanguages=N,e.getLanguage=w,e.inherit=o,e.IR="[a-zA-Z]\\w*",e.UIR="[a-zA-Z_]\\w*",e.NR="\\b\\d+(\\.\\d+)?",e.CNR="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",e.BNR="\\b(0b[01]+)",e.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",e.BE={b:"\\\\[\\s\\S]",r:0},e.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[e.BE]},e.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[e.BE]},e.PWM={b:/\b(a|an|the|are|I|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|like)\b/},e.C=function(n,t,r){var a=e.inherit({cN:"comment",b:n,e:t,c:[]},r||{});return a.c.push(e.PWM),a.c.push({cN:"doctag",b:"(?:TODO|FIXME|NOTE|BUG|XXX):",r:0}),a},e.CLCM=e.C("//","$"),e.CBCM=e.C("/\\*","\\*/"),e.HCM=e.C("#","$"),e.NM={cN:"number",b:e.NR,r:0},e.CNM={cN:"number",b:e.CNR,r:0},e.BNM={cN:"number",b:e.BNR,r:0},e.CSSNM={cN:"number",b:e.NR+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",r:0},e.RM={cN:"regexp",b:/\//,e:/\/[gimuy]*/,i:/\n/,c:[e.BE,{b:/\[/,e:/\]/,r:0,c:[e.BE]}]},e.TM={cN:"title",b:e.IR,r:0},e.UTM={cN:"title",b:e.UIR,r:0},e.METHOD_GUARD={b:"\\.\\s*"+e.UIR,r:0},e});hljs.registerLanguage("javascript",function(e){return{aliases:["js","jsx"],k:{keyword:"in of if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const export super debugger as async await static import from as",literal:"true false null undefined NaN Infinity",built_in:"eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError Number Math Date String RegExp Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require module console window document Symbol Set Map WeakSet WeakMap Proxy Reflect Promise"},c:[{cN:"meta",r:10,b:/^\s*['"]use (strict|asm)['"]/},{cN:"meta",b:/^#!/,e:/$/},e.ASM,e.QSM,{cN:"string",b:"`",e:"`",c:[e.BE,{cN:"subst",b:"\\$\\{",e:"\\}"}]},e.CLCM,e.CBCM,{cN:"number",v:[{b:"\\b(0[bB][01]+)"},{b:"\\b(0[oO][0-7]+)"},{b:e.CNR}],r:0},{b:"("+e.RSR+"|\\b(case|return|throw)\\b)\\s*",k:"return throw case",c:[e.CLCM,e.CBCM,e.RM,{b:/</,e:/(\/\w+|\w+\/)>/,sL:"xml",c:[{b:/<\w+\/>/,skip:!0},{b:/<\w+/,e:/(\/\w+|\w+\/)>/,skip:!0,c:["self"]}]}],r:0},{cN:"function",bK:"function",e:/\{/,eE:!0,c:[e.inherit(e.TM,{b:/[A-Za-z$_][0-9A-Za-z$_]*/}),{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,c:[e.CLCM,e.CBCM]}],i:/\[|%/},{b:/\$[(.]/},e.METHOD_GUARD,{cN:"class",bK:"class",e:/[{;=]/,eE:!0,i:/[:"\[\]]/,c:[{bK:"extends"},e.UTM]},{bK:"constructor",e:/\{/,eE:!0}],i:/#(?!!)/}});hljs.registerLanguage("json",function(e){var i={literal:"true false null"},n=[e.QSM,e.CNM],r={e:",",eW:!0,eE:!0,c:n,k:i},t={b:"{",e:"}",c:[{cN:"attr",b:/"/,e:/"/,c:[e.BE],i:"\\n"},e.inherit(r,{b:/:/})],i:"\\S"},c={b:"\\[",e:"\\]",c:[e.inherit(r)],i:"\\S"};return n.splice(n.length,0,t,c),{c:n,k:i,i:"\\S"}});
|
inc/js/loader.js
CHANGED
@@ -1,147 +1,147 @@
|
|
1 |
-
(function (){ var b="",aa="\x00",ba="\n",ca="\n//# sourceURL=",da="\n;return exports});\n//# sourceURL=",k=" ",ea="  ",fa=" onreadystatechange='goog.onScriptLoad_(this, ",ga=" should not be enumerable in Object.prototype.",l='"',ha='");',ia='">\x3c/script>',ja="#",ka="$1",la="%s",q="&",ma="�",na="e",oa="'",pa="&",qa=">",ra="<",sa=""",ta="'",ua="(^",va=")' ",wa=")([a-z])",xa=");",ya=", ",za="-",Aa="-$1",r=".",Ba="..",Ca="...",u="/",Da="/loader.js",v="0",Ea="0,(function(){",w=": ",
|
2 |
-
x="<",Fa="\x3c/script>",Ga="<br />",Ha="<br>",Ia='<script type="text/javascript" src="',Ja='<script type="text/javascript">',Ka=">",La=">\x3c/script>",Ma="?",Na="Already loaded ",Pa="American Samoa",Qa="Antigua and Barbuda",Ra="Assertion failed",Sa="BY_WHOLE",y="Bolivia",z="Bosna i Hercegovina",Ta="Botswana",Ua="British Virgin Islands",Va="Cayman Islands",Wa="Christmas Island",Xa="Expected Element but got %s: %s.",Ya="Expected array but got %s: %s.",Za="Expected boolean but got %s: %s.",$a="Expected function but got %s: %s.",
|
3 |
-
ab="Expected instanceof %s but got %s.",bb="Expected number but got %s: %s.",cb="Expected object but got %s: %s.",db="Expected string but got %s: %s.",eb="Failure",fb="Falkland Islands",B="Ghana",gb="Guin\u00e9e \u00e9quatoriale",hb="Guyane fran\u00e7aise",ib="HEAD",jb="Honduras",kb="Indonesia",lb="Itoophiyaa",mb="JavaScript",nb="Kalaallit Nunaat",ob="Kiribati",pb="Load packages + dependencies - previous: ",qb="Loading css files: ",rb="LocaleNameConstants",sb="Luxembourg",tb="Madagascar",ub="Marshall Islands",
|
4 |
-
C="Micronesia",vb="Moldova, Republica",wb="Nederlandse Antillen",xb="New Zealand",D="Nigeria",yb="Norfolk Island",zb="Northern Mariana Islands",Ab="Nouvelle-Cal\u00e9donie",E="Papua New Guinea",Bb="Paraguay",Cb="Philippines",Db="Polyn\u00e9sie fran\u00e7aise",Eb="Puerto Rico",Fb="Rep\u00fablica Dominicana",F="Rwanda",Gb="Rywvaneth Unys",Hb="R\u00e9publique centrafricaine",Ib="R\u00e9publique d\u00e9mocratique du Congo",Jb="SCRIPT",Kb="Saint Kitts and Nevis",Lb="Saint Vincent and the Grenadines",Mb=
|
5 |
-
"Saint-Pierre-et-Miquelon",Nb="Serbia and Montenegro",Ob="Seychelles",Pb="Slovensk\u00e1 republika",Qb="Solomon Islands",G="South Africa",Rb="Svalbard og Jan Mayen",Ub="Swaziland",Vb="S\u00e3o Tom\u00e9 e Pr\u00edncipe",H="S\u00e9n\u00e9gal",Wb="Tanzania",Xb="Timor Leste",I="Tokelau",Yb="Turks and Caicos Islands",J="Tuvalu",K="T\u00fcrkiye",Zb="U.S. Virgin Islands",$b="United Kingdom",ac="United States",bc="United States Minor Outlying Islands",cc="Unknown or Invalid Region",L="Vanuatu",dc="Wallis-et-Futuna",
|
6 |
-
ec="[object Array]",fc="[object Function]",gc="[object Window]",hc="\\$1",ic="\\s",jc="\\u",kc="\\x",lc="\\x08",mc="]+",M="_",nc="amp",oc="annotatedtimeline",N="array",pc="base.js",qc="boolean",O="browserchart",rc="call",sc="callback after loading ",tc="charts",P="complete",uc="corechart",vc="div",wc="document",Q="dygraph",xc="e",yc="en",zc="end loadScript: ",Ac="error",R="function",Bc="g",Cc="get",Dc="goog",Ec="goog.loadModule(",Fc='goog.loadModule(function(exports) {"use strict";',Gc='goog.retrieveAndExecModule_("',
|
7 |
-
Hc="goog_",Ic="google",Jc="google.charts.load",Kc="google.charts.load version ",Lc="gt",Mc="head",Nc="href",Oc="id",Pc="iframe",S="imagechart",Qc="javascript",Rc="link",Sc="load",Tc="load-css-",Uc="loadCSSFile: ",Vc="loadScript: ",Wc="loading css failed: ",Xc="lt",Yc="native code",Zc="none",$c="null",ad="number",bd="o",T="object",cd="onload",dd="quot",ed="rel",fd="removeAttribute",gd="script",hd="splice",id="string",jd="stylesheet",kd="text/css",ld="text/javascript",U="top",md="type",V="ui",nd="ui_base",
|
8 |
-
od="unknown",pd="unknown type name",qd="var ",rd="var _evalTest_ = 1;",sd="visualization",td="webfontloader",ud="write",vd="{cssFile}",wd="{language}",xd="{package}",yd="{prefix}",zd="{prefix}/{version}/css/{cssFile}",Ad="{prefix}/{version}/third_party/{package}",Bd="{version}",Cd="|[",Dd="})",Ed="~",Fd="\u0080",Gd="\u010cesk\u00e1 republika",Hd="\u0411\u0435\u043b\u0430\u0440\u0443\u0441\u044c",Id="\u041a\u044b\u0440\u0433\u044b\u0437\u0441\u0442\u0430\u043d",Jd="\u043c\u043e\u043d\u0433\u043e\u043b\u044c\u0441\u043a\u0438\u0439",
|
9 |
-
Kd="\u0540\u0561\u0575\u0561\u057d\u057f\u0561\u0576\u056b \u0540\u0561\u0576\u0580\u0561\u057a\u0565\u057f\u0578\u0582\u0569\u056b\u0582\u0576",Ld="\u0627\u0641\u063a\u0627\u0646\u0633\u062a\u0627\u0646",Md="\u0627\u0644\u0627\u0645\u0627\u0631\u0627\u062a \u0627\u0644\u0639\u0631\u0628\u064a\u0629 \u0627\u0644\u0645\u062a\u062d\u062f\u0629",Nd="\u0627\u0644\u0635\u062d\u0631\u0627\u0621 \u0627\u0644\u063a\u0631\u0628\u064a\u0629",Od="\u0627\u0644\u0645\u0645\u0644\u0643\u0629 \u0627\u0644\u0639\u0631\u0628\u064a\u0629 \u0627\u0644\u0633\u0639\u0648\u062f\u064a\u0629",
|
10 |
-
Pd="\u0627\u0644\u0648\u0644\u0627\u064a\u0627\u062a \u0627\u0644\u0645\u062a\u062d\u062f\u0629 \u0627\u0644\u0623\u0645\u0631\u064a\u0643\u064a\u0629",Qd="\u062c\u0632\u0631 \u0627\u0644\u0642\u0645\u0631",Rd="\u067e\u0627\u06a9\u0633\u062a\u0627\u0646",W="\u092d\u093e\u0930\u0924",X="\u12a2\u1275\u12ee\u1335\u12eb",Sd="\uc870\uc120 \ubbfc\uc8fc\uc8fc\uc758 \uc778\ubbfc \uacf5\ud654\uad6d",Td="\ufffd";function Y(){return function(){}}var Z=Z||{};Z.global=this;Z.P=function(a){return void 0!==a};
|
11 |
-
Z.Aa=function(a,c,d){a=a.split(r);d=d||Z.global;a[0]in d||!d.execScript||d.execScript(qd+a[0]);for(var e;a.length&&(e=a.shift());)!a.length&&Z.P(c)?d[e]=c:d=d[e]?d[e]:d[e]={}};Z.ue=function(a,c){Z.Aa(a,c)};Z.H=!0;Z.Cd=yc;Z.ra=!0;Z.ec=!1;Z.Ob=!Z.H;Z.Ya=!1;Z.Gf=function(a){if(Z.La())throw Error("goog.provide can not be used within a goog.module.");Z.fb(a)};Z.fb=function(a,c){Z.Aa(a,c)};Z.mc=/^[a-zA-Z_$][a-zA-Z0-9._$]*$/;
|
12 |
-
Z.Oa=function(a){if(!Z.h(a)||!a||-1==a.search(Z.mc))throw Error("Invalid module identifier");if(!Z.La())throw Error("Module "+a+" has been loaded incorrectly.");if(Z.j.Pa)throw Error("goog.module may only be called once per module.");Z.j.Pa=a};Z.Oa.get=Y();Z.Oa.Ge=Y();Z.j=null;Z.La=function(){return null!=Z.j};Z.Oa.xa=function(){Z.j.xa=!0};Z.Zf=function(a){if(Z.Ob)throw a=a||b,Error("Importing test-only code into non-debug environment"+(a?w+a:r));};Z.Be=Y();
|
13 |
-
Z.kb=function(){for(var a=[Ic,tc,Sc],c=Z.global,d;d=a.shift();)if(Z.Ic(c[d]))c=c[d];else return null;return c};Z.Re=function(a,c){var d=c||Z.global,e;for(e in a)d[e]=a[e]};Z.Id=function(a,c,d,e){if(Z.Wa){var f;a=a.replace(/\\/g,u);var g=Z.i;e&&typeof e!==qc||(e=e?{module:Dc}:{});for(var h=0;f=c[h];h++)g.U[f]=a,g.Ra[a]=e.module==Dc;for(e=0;c=d[e];e++)a in g.G||(g.G[a]={}),g.G[a][c]=!0}};Z.yg=!1;Z.zd=!0;Z.uf=function(a){Z.global.console&&Z.global.console.error(a)};Z.Uf=Y();Z.F=b;Z.Bf=Y();
|
14 |
-
Z.Hd=function(){throw Error("unimplemented abstract method");};Z.Jd=function(a){a.Fe=function(){if(a.vb)return a.vb;Z.H&&(Z.wb[Z.wb.length]=a);return a.vb=new a}};Z.wb=[];Z.Vb=!0;Z.cc=Z.H;Z.Sc={};Z.Wa=!1;
|
15 |
-
Z.Wa&&(Z.i={Ra:{},U:{},G:{},Hb:{},qa:{},X:{}},Z.tb=function(){var a=Z.global.document;return null!=a&&ud in a},Z.Ac=function(){if(Z.P(Z.global.Lb))Z.F=Z.global.Lb;else if(Z.tb())for(var a=Z.global.document.getElementsByTagName(Jb),c=a.length-1;0<=c;--c){var d=a[c].src,e=d.lastIndexOf(Ma),e=-1==e?d.length:e;if(d.substr(e-7,7)==pc){Z.F=d.substr(0,e-7);break}}},Z.Ha=function(a,c){(Z.global.rd||Z.od)(a,c)&&(Z.i.qa[a]=!0)},Z.Ub=!(Z.global.atob||!Z.global.document||!Z.global.document.all),Z.Gc=function(a){Z.Ha(b,
|
16 |
-
Gc+a+ha)&&(Z.i.qa[a]=!0)},Z.Sa=[],Z.Ag=function(a,c){return Z.Vb&&Z.P(Z.global.JSON)?Ec+Z.global.JSON.stringify(c+ca+a+ba)+xa:Fc+c+da+a+ba},Z.Rc=function(){var a=Z.Sa.length;if(0<a){var c=Z.Sa;Z.Sa=[];for(var d=0;d<a;d++)Z.Bb(c[d])}},Z.vf=function(a){Z.xb(a)&&Z.nc(a)&&Z.Bb(Z.F+Z.Ga(a))},Z.xb=function(a){return(a=Z.Ga(a))&&Z.i.Ra[a]?Z.F+a in Z.i.X:!1},Z.nc=function(a){if((a=Z.Ga(a))&&a in Z.i.G)for(var c in Z.i.G[a])if(!Z.Mc(c)&&!Z.xb(c))return!1;return!0},Z.Bb=function(a){if(a in Z.i.X){var c=Z.i.X[a];
|
17 |
-
delete Z.i.X[a];Z.Fc(c)}},Z.tf=Y(),Z.sf=function(a){var c=Z.j;try{Z.j={Pa:void 0,xa:!1};var d;if(Z.yb(a))d=a.call(Z.global,{});else if(Z.h(a))d=Z.Pc.call(Z.global,a);else throw Error("Invalid module definition");var e=Z.j.Pa;if(!Z.h(e)||!e)throw Error('Invalid module name "'+e+l);Z.j.xa?Z.fb(e,d):Z.cc&&Object.seal&&Object.seal(d);Z.Sc[e]=d}finally{Z.j=c}},Z.Pc=function(a){eval(a);return{}},Z.md=function(a){Z.global.document.write(Ia+a+ia)},Z.pc=function(a){var c=Z.global.document,d=c.createElement(gd);
|
18 |
-
d.type=ld;d.src=a;d.defer=!1;d.async=!1;c.head.appendChild(d)},Z.od=function(a,c){if(Z.tb()){var d=Z.global.document;if(!Z.Ya&&d.readyState==P){if(/\bdeps.js$/.test(a))return!1;throw Error('Cannot write "'+a+'" after document load');}var e=Z.Ub;void 0===c?e?(e=fa+ ++Z.zb+va,d.write(Ia+a+l+e+La)):Z.Ya?Z.pc(a):Z.md(a):d.write(Ja+c+Fa);return!0}return!1},Z.zb=0,Z.Df=function(a,c){a.readyState==P&&Z.zb==c&&Z.Rc();return!0},Z.Bg=function(a){function c(a){if(!(a in f.qa||a in f.Hb)){f.Hb[a]=!0;if(a in f.G)for(var g in f.G[a])if(!Z.Mc(g))if(g in
|
19 |
-
f.U)c(f.U[g]);else throw Error("Undefined nameToPath for "+g);a in e||(e[a]=!0,d.push(a))}}var d=[],e={},f=Z.i;c(a);for(a=0;a<d.length;a++){var g=d[a];Z.i.qa[g]=!0}var h=Z.j;Z.j=null;for(a=0;a<d.length;a++)if(g=d[a])f.Ra[g]?Z.Gc(Z.F+g):Z.Ha(Z.F+g);else throw Z.j=h,Error("Undefined script input");Z.j=h},Z.Ga=function(a){return a in Z.i.U?Z.i.U[a]:null},Z.Ac(),Z.global.td||Z.Ha(Z.F+"deps.js"));
|
20 |
-
Z.yf=function(a){a=a.split(u);for(var c=0;c<a.length;)a[c]==r?a.splice(c,1):c&&a[c]==Ba&&a[c-1]&&a[c-1]!=Ba?a.splice(--c,2):c++;return a.join(u)};Z.rf=function(a){if(Z.global.Mb)return Z.global.Mb(a);var c=new Z.global.XMLHttpRequest;c.open(Cc,a,!1);c.send();return c.responseText};Z.Vf=Y();
|
21 |
-
Z.s=function(a){var c=typeof a;if(c==T)if(a){if(a instanceof Array)return N;if(a instanceof Object)return c;var d=Object.prototype.toString.call(a);if(d==gc)return T;if(d==ec||typeof a.length==ad&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable(hd))return N;if(d==fc||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable(rc))return R}else return $c;else if(c==R&&"undefined"==typeof a.call)return T;return c};
|
22 |
-
Z.gf=function(a){return null===a};Z.Ic=function(a){return null!=a};Z.isArray=function(a){return Z.s(a)==N};Z.Ja=function(a){var c=Z.s(a);return c==N||c==T&&typeof a.length==ad};Z.bf=function(a){return Z.$(a)&&typeof a.getFullYear==R};Z.h=function(a){return typeof a==id};Z.Hc=function(a){return typeof a==qc};Z.Lc=function(a){return typeof a==ad};Z.yb=function(a){return Z.s(a)==R};Z.$=function(a){var c=typeof a;return c==T&&null!=a||c==R};Z.qb=function(a){return a[Z.D]||(a[Z.D]=++Z.hd)};Z.Se=function(a){return!!a[Z.D]};
|
23 |
-
Z.Zc=function(a){null!==a&&fd in a&&a.removeAttribute(Z.D);try{delete a[Z.D]}catch(c){}};Z.D="closure_uid_"+(1E9*Math.random()>>>0);Z.hd=0;Z.De=Z.qb;Z.Rf=Z.Zc;Z.uc=function(a){var c=Z.s(a);if(c==T||c==N){if(a.clone)return a.clone();var c=c==N?[]:{},d;for(d in a)c[d]=Z.uc(a[d]);return c}return a};Z.tc=function(a,c,d){return a.call.apply(a.bind,arguments)};
|
24 |
-
Z.rc=function(a,c,d){if(!a)throw Error();if(2<arguments.length){var e=Array.prototype.slice.call(arguments,2);return function(){var d=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(d,e);return a.apply(c,d)}}return function(){return a.apply(c,arguments)}};Z.bind=function(a,c,d){Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf(Yc)?Z.bind=Z.tc:Z.bind=Z.rc;return Z.bind.apply(null,arguments)};
|
25 |
-
Z.Wc=function(a,c){var d=Array.prototype.slice.call(arguments,1);return function(){var c=d.slice();c.push.apply(c,arguments);return a.apply(this,c)}};Z.wf=function(a,c){for(var d in c)a[d]=c[d]};Z.now=Z.ra&&Date.now||function(){return+new Date};
|
26 |
-
Z.Fc=function(a){if(Z.global.execScript)Z.global.execScript(a,mb);else if(Z.global.eval){if(null==Z.Y)if(Z.global.eval(rd),"undefined"!=typeof Z.global._evalTest_){try{delete Z.global._evalTest_}catch(e){}Z.Y=!0}else Z.Y=!1;if(Z.Y)Z.global.eval(a);else{var c=Z.global.document,d=c.createElement(Jb);d.type=ld;d.defer=!1;d.appendChild(c.createTextNode(a));c.body.appendChild(d);c.body.removeChild(d)}}else throw Error("goog.globalEval not available");};Z.Y=null;
|
27 |
-
Z.Ce=function(a,c){function d(a){a=a.split(za);for(var c=[],d=0;d<a.length;d++)c.push(e(a[d]));return c.join(za)}function e(a){return Z.gb[a]||a}var f;f=Z.gb?Z.xc==Sa?e:d:function(a){return a};return c?a+za+f(c):f(a)};Z.Wf=function(a,c){Z.gb=a;Z.xc=c};Z.Je=function(a,c){c&&(a=a.replace(/\{\$([^}]+)}/g,function(a,e){return null!=c&&e in c?c[e]:a}));return a};Z.Ke=function(a){return a};Z.Ba=function(a,c){Z.Aa(a,c,void 0)};Z.ze=function(a,c,d){a[c]=d};
|
28 |
-
Z.Ia=function(a,c){function d(){}d.prototype=c.prototype;a.oa=c.prototype;a.prototype=new d;a.prototype.constructor=a;a.qc=function(a,d,g){for(var h=Array(arguments.length-2),m=2;m<arguments.length;m++)h[m-2]=arguments[m];return c.prototype[d].apply(a,h)}};
|
29 |
-
Z.qc=function(a,c,d){var e=arguments.callee.caller;if(Z.ec||Z.H&&!e)throw Error("arguments.caller not defined. goog.base() cannot be used with strict mode code. See http://www.ecma-international.org/ecma-262/5.1/#sec-C");if(e.oa){for(var f=Array(arguments.length-1),g=1;g<arguments.length;g++)f[g-1]=arguments[g];return e.oa.constructor.apply(a,f)}f=Array(arguments.length-2);for(g=2;g<arguments.length;g++)f[g-2]=arguments[g];for(var g=!1,h=a.constructor;h;h=h.oa&&h.oa.constructor)if(h.prototype[c]===
|
30 |
-
e)g=!0;else if(g)return h.prototype[c].apply(a,f);if(a[c]===e)return a.constructor.prototype[c].apply(a,f);throw Error("goog.base called from a method of one name to a method of a different name");};Z.scope=function(a){if(Z.La())throw Error("goog.scope is not supported within a goog.module.");a.call(Z.global)};
|
31 |
-
Z.u=function(a,c){var d=c.constructor,e=c.cd;d&&d!=Object.prototype.constructor||(d=function(){throw Error("cannot instantiate an interface (no constructor defined).");});d=Z.u.vc(d,a);a&&Z.Ia(d,a);delete c.constructor;delete c.cd;Z.u.$a(d.prototype,c);null!=e&&(e instanceof Function?e(d):Z.u.$a(d,e));return d};Z.u.bc=Z.H;
|
32 |
-
Z.u.vc=function(a,c){if(Z.u.bc&&Object.seal instanceof Function){if(c&&c.prototype&&c.prototype[Z.kc])return a;var d=function(){var c=a.apply(this,arguments)||this;c[Z.D]=c[Z.D];this.constructor===d&&Object.seal(c);return c};return d}return a};Z.u.Za="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");
|
33 |
-
Z.u.$a=function(a,c){for(var d in c)Object.prototype.hasOwnProperty.call(c,d)&&(a[d]=c[d]);for(var e=0;e<Z.u.Za.length;e++)d=Z.u.Za[e],Object.prototype.hasOwnProperty.call(c,d)&&(a[d]=c[d])};Z.gg=Y();Z.kc="goog_defineClass_legacy_unsealable";Z.debug={};Z.debug.Error=function(a){if(Error.captureStackTrace)Error.captureStackTrace(this,Z.debug.Error);else{var c=Error().stack;c&&(this.stack=c)}a&&(this.message=String(a))};Z.Ia(Z.debug.Error,Error);Z.debug.Error.prototype.name="CustomError";Z.hb={};Z.hb.$b={Pb:1,pd:2,Gd:3,qd:4,Bd:5,Ad:6,Fd:7,ud:8,wd:9,yd:10,xd:11,Dd:12};Z.c={};Z.c.Xa=!1;Z.c.Rb=!1;Z.c.lc={Yb:"\u00a0"};Z.c.startsWith=function(a,c){return 0==a.lastIndexOf(c,0)};Z.c.endsWith=function(a,c){var d=a.length-c.length;return 0<=d&&a.indexOf(c,d)==d};Z.c.je=function(a,c){return 0==Z.c.eb(c,a.substr(0,c.length))};Z.c.fe=function(a,c){return 0==Z.c.eb(c,a.substr(a.length-c.length,c.length))};Z.c.ge=function(a,c){return a.toLowerCase()==c.toLowerCase()};
|
34 |
-
Z.c.dd=function(a,c){for(var d=a.split(la),e=b,f=Array.prototype.slice.call(arguments,1);f.length&&1<d.length;)e+=d.shift()+f.shift();return e+d.join(la)};Z.c.le=function(a){return a.replace(/[\s\xa0]+/g,k).replace(/^\s+|\s+$/g,b)};Z.c.Ka=function(a){return/^[\s\xa0]*$/.test(a)};Z.c.df=function(a){return 0==a.length};Z.c.Jc=Z.c.Ka;Z.c.Kc=function(a){return Z.c.Ka(Z.c.Tc(a))};Z.c.cf=Z.c.Kc;Z.c.$e=function(a){return!/[^\t\n\r ]/.test(a)};Z.c.Ye=function(a){return!/[^a-zA-Z]/.test(a)};Z.c.hf=function(a){return!/[^0-9]/.test(a)};
|
35 |
-
Z.c.Ze=function(a){return!/[^a-zA-Z0-9]/.test(a)};Z.c.lf=function(a){return a==k};Z.c.mf=function(a){return 1==a.length&&a>=k&&a<=Ed||a>=Fd&&a<=Td};Z.c.eg=function(a){return a.replace(/(\r\n|\r|\n)+/g,k)};Z.c.Yd=function(a){return a.replace(/(\r\n|\r|\n)/g,ba)};Z.c.Af=function(a){return a.replace(/\xa0|\s/g,k)};Z.c.zf=function(a){return a.replace(/\xa0|[ \t]+/g,k)};Z.c.ke=function(a){return a.replace(/[\t\r\n ]+/g,k).replace(/^[\t\r\n ]+|[\t\r\n ]+$/g,b)};
|
36 |
-
Z.c.trim=Z.ra&&String.prototype.trim?function(a){return a.trim()}:function(a){return a.replace(/^[\s\xa0]+|[\s\xa0]+$/g,b)};Z.c.trimLeft=function(a){return a.replace(/^[\s\xa0]+/,b)};Z.c.trimRight=function(a){return a.replace(/[\s\xa0]+$/,b)};Z.c.eb=function(a,c){var d=String(a).toLowerCase(),e=String(c).toLowerCase();return d<e?-1:d==e?0:1};
|
37 |
-
Z.c.Db=function(a,c,d){if(a==c)return 0;if(!a)return-1;if(!c)return 1;for(var e=a.toLowerCase().match(d),f=c.toLowerCase().match(d),g=Math.min(e.length,f.length),h=0;h<g;h++){d=e[h];var m=f[h];if(d!=m)return a=parseInt(d,10),!isNaN(a)&&(c=parseInt(m,10),!isNaN(c)&&a-c)?a-c:d<m?-1:1}return e.length!=f.length?e.length-f.length:a<c?-1:1};Z.c.We=function(a,c){return Z.c.Db(a,c,/\d+|\D+/g)};Z.c.Dc=function(a,c){return Z.c.Db(a,c,/\d+|\.\d+|\D+/g)};Z.c.Cf=Z.c.Dc;Z.c.xg=function(a){return encodeURIComponent(String(a))};
|
38 |
-
Z.c.wg=function(a){return decodeURIComponent(a.replace(/\+/g,k))};Z.c.Uc=function(a,c){return a.replace(/(\r\n|\r|\n)/g,c?Ga:Ha)};Z.c.rb=function(a){if(!Z.c.Jb.test(a))return a;-1!=a.indexOf(q)&&(a=a.replace(Z.c.Kb,pa));-1!=a.indexOf(x)&&(a=a.replace(Z.c.Xb,ra));-1!=a.indexOf(Ka)&&(a=a.replace(Z.c.Sb,qa));-1!=a.indexOf(l)&&(a=a.replace(Z.c.ac,sa));-1!=a.indexOf(ta)&&(a=a.replace(Z.c.dc,oa));-1!=a.indexOf(aa)&&(a=a.replace(Z.c.Zb,ma));Z.c.Xa&&-1!=a.indexOf(xc)&&(a=a.replace(Z.c.Qb,na));return a};
|
39 |
-
Z.c.Kb=/&/g;Z.c.Xb=/</g;Z.c.Sb=/>/g;Z.c.ac=/"/g;Z.c.dc=/'/g;Z.c.Zb=/\x00/g;Z.c.Qb=/e/g;Z.c.Jb=Z.c.Xa?/[\x00&<>"'e]/:/[\x00&<>"']/;Z.c.Fb=function(a){return Z.c.contains(a,q)?!Z.c.Rb&&wc in Z.global?Z.c.Gb(a):Z.c.jd(a):a};Z.c.vg=function(a,c){return Z.c.contains(a,q)?Z.c.Gb(a,c):a};
|
40 |
-
Z.c.Gb=function(a,c){var d={"&":q,"<":x,">":Ka,""":l},e;e=c?c.createElement(vc):Z.global.document.createElement(vc);return a.replace(Z.c.Tb,function(a,c){var h=d[a];if(h)return h;if(c.charAt(0)==ja){var m=Number(v+c.substr(1));isNaN(m)||(h=String.fromCharCode(m))}h||(e.innerHTML=a+k,h=e.firstChild.nodeValue.slice(0,-1));return d[a]=h})};
|
41 |
-
Z.c.jd=function(a){return a.replace(/&([^;]+);/g,function(a,d){switch(d){case nc:return q;case Xc:return x;case Lc:return Ka;case dd:return l;default:if(d.charAt(0)==ja){var e=Number(v+d.substr(1));if(!isNaN(e))return String.fromCharCode(e)}return a}})};Z.c.Tb=/&([^;\s<&]+);?/g;Z.c.zg=function(a,c){return Z.c.Uc(a.replace(/ /g,ea),c)};Z.c.Ff=function(a){return a.replace(/(^|[\n ]) /g,ka+Z.c.lc.Yb)};
|
42 |
-
Z.c.fg=function(a,c){for(var d=c.length,e=0;e<d;e++){var f=1==d?c:c.charAt(e);if(a.charAt(0)==f&&a.charAt(a.length-1)==f)return a.substring(1,a.length-1)}return a};Z.c.truncate=function(a,c,d){d&&(a=Z.c.Fb(a));a.length>c&&(a=a.substring(0,c-3)+Ca);d&&(a=Z.c.rb(a));return a};
|
43 |
-
Z.c.rg=function(a,c,d,e){d&&(a=Z.c.Fb(a));if(e&&a.length>c)e>c&&(e=c),a=a.substring(0,c-e)+Ca+a.substring(a.length-e);else if(a.length>c){e=Math.floor(c/2);var f=a.length-e;a=a.substring(0,e+c%2)+Ca+a.substring(f)}d&&(a=Z.c.rb(a));return a};Z.c.Va={"\x00":"\\0","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\x0B":"\\x0B",'"':'\\"',"\\":"\\\\","<":x};Z.c.ea={"'":"\\'"};
|
44 |
-
Z.c.quote=function(a){a=String(a);for(var c=[l],d=0;d<a.length;d++){var e=a.charAt(d),f=e.charCodeAt(0);c[d+1]=Z.c.Va[e]||(31<f&&127>f?e:Z.c.ib(e))}c.push(l);return c.join(b)};Z.c.ye=function(a){for(var c=[],d=0;d<a.length;d++)c[d]=Z.c.ib(a.charAt(d));return c.join(b)};
|
45 |
-
Z.c.ib=function(a){if(a in Z.c.ea)return Z.c.ea[a];if(a in Z.c.Va)return Z.c.ea[a]=Z.c.Va[a];var c=a,d=a.charCodeAt(0);if(31<d&&127>d)c=a;else{if(256>d){if(c=kc,16>d||256<d)c+=v}else c=jc,4096>d&&(c+=v);c+=d.toString(16).toUpperCase()}return Z.c.ea[a]=c};Z.c.contains=function(a,c){return-1!=a.indexOf(c)};Z.c.$d=function(a,c){return Z.c.contains(a.toLowerCase(),c.toLowerCase())};Z.c.qe=function(a,c){return a&&c?a.split(c).length-1:0};
|
46 |
-
Z.c.L=function(a,c,d){var e=a;0<=c&&c<a.length&&0<d&&(e=a.substr(0,c)+a.substr(c+d,a.length-c-d));return e};Z.c.remove=function(a,c){var d=new RegExp(Z.c.Ta(c),b);return a.replace(d,b)};Z.c.Of=function(a,c){var d=new RegExp(Z.c.Ta(c),Bc);return a.replace(d,b)};Z.c.Ta=function(a){return String(a).replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g,hc).replace(/\x08/g,lc)};Z.c.repeat=String.prototype.repeat?function(a,c){return a.repeat(c)}:function(a,c){return Array(c+1).join(a)};
|
47 |
-
Z.c.Ef=function(a,c,d){a=Z.P(d)?a.toFixed(d):String(a);d=a.indexOf(r);-1==d&&(d=a.length);return Z.c.repeat(v,Math.max(0,c-d))+a};Z.c.Tc=function(a){return null==a?b:String(a)};Z.c.Xd=function(a){return Array.prototype.join.call(arguments,b)};Z.c.Ne=function(){return Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Z.now()).toString(36)};
|
48 |
-
Z.c.oe=function(a,c){for(var d=0,e=Z.c.trim(String(a)).split(r),f=Z.c.trim(String(c)).split(r),g=Math.max(e.length,f.length),h=0;0==d&&h<g;h++){var m=e[h]||b,n=f[h]||b,p=/(\d*)(\D*)/g,Oa=/(\d*)(\D*)/g;do{var A=p.exec(m)||[b,b,b],t=Oa.exec(n)||[b,b,b];if(0==A[0].length&&0==t[0].length)break;d=Z.c.ua(0==A[1].length?0:parseInt(A[1],10),0==t[1].length?0:parseInt(t[1],10))||Z.c.ua(0==A[2].length,0==t[2].length)||Z.c.ua(A[2],t[2])}while(0==d)}return d};Z.c.ua=function(a,c){return a<c?-1:a>c?1:0};
|
49 |
-
Z.c.Te=function(a){for(var c=0,d=0;d<a.length;++d)c=31*c+a.charCodeAt(d)>>>0;return c};Z.c.kd=2147483648*Math.random()|0;Z.c.re=function(){return Hc+Z.c.kd++};Z.c.jg=function(a){var c=Number(a);return 0==c&&Z.c.Ka(a)?NaN:c};Z.c.ef=function(a){return/^[a-z]+([A-Z][a-z]*)*$/.test(a)};Z.c.nf=function(a){return/^([A-Z][a-z]*)+$/.test(a)};Z.c.hg=function(a){return String(a).replace(/\-([a-z])/g,function(a,d){return d.toUpperCase()})};Z.c.pg=function(a){return String(a).replace(/([A-Z])/g,Aa).toLowerCase()};
|
50 |
-
Z.c.qg=function(a,c){var d=Z.h(c)?Z.c.Ta(c):ic;return a.replace(new RegExp(ua+(d?Cd+d+mc:b)+wa,Bc),function(a,c,d){return c+d.toUpperCase()})};Z.c.Zd=function(a){return String(a.charAt(0)).toUpperCase()+String(a.substr(1)).toLowerCase()};Z.c.parseInt=function(a){isFinite(a)&&(a=String(a));return Z.h(a)?/^\s*-?0x/i.test(a)?parseInt(a,16):parseInt(a,10):NaN};Z.c.cg=function(a,c,d){a=a.split(c);for(var e=[];0<d&&a.length;)e.push(a.shift()),d--;a.length&&e.push(a.join(c));return e};
|
51 |
-
Z.c.qf=function(a,c){if(c)typeof c==id&&(c=[c]);else return a;for(var d=-1,e=0;e<c.length;e++)if(c[e]!=b){var f=a.lastIndexOf(c[e]);f>d&&(d=f)}return-1==d?a:a.slice(d+1)};Z.c.we=function(a,c){var d=[],e=[];if(a==c)return 0;if(!a.length||!c.length)return Math.max(a.length,c.length);for(var f=0;f<c.length+1;f++)d[f]=f;for(f=0;f<a.length;f++){e[0]=f+1;for(var g=0;g<c.length;g++)e[g+1]=Math.min(e[g]+1,d[g+1]+1,d[g]+Number(a[f]!=c[g]));for(g=0;g<d.length;g++)d[g]=e[g]}return e[c.length]};Z.g={};Z.g.o=Z.H;Z.g.V=function(a,c){c.unshift(a);Z.debug.Error.call(this,Z.c.dd.apply(null,c));c.shift()};Z.Ia(Z.g.V,Z.debug.Error);Z.g.V.prototype.name="AssertionError";Z.g.Nb=function(a){throw a;};Z.g.ya=Z.g.Nb;Z.g.A=function(a,c,d,e){var f=Ra;if(d)var f=f+(w+d),g=e;else a&&(f+=w+a,g=c);a=new Z.g.V(b+f,g||[]);Z.g.ya(a)};Z.g.Xf=function(a){Z.g.o&&(Z.g.ya=a)};Z.g.assert=function(a,c,d){Z.g.o&&!a&&Z.g.A(b,null,c,Array.prototype.slice.call(arguments,2));return a};
|
52 |
-
Z.g.Ca=function(a,c){Z.g.o&&Z.g.ya(new Z.g.V(eb+(a?w+a:b),Array.prototype.slice.call(arguments,1)))};Z.g.Pd=function(a,c,d){Z.g.o&&!Z.Lc(a)&&Z.g.A(bb,[Z.s(a),a],c,Array.prototype.slice.call(arguments,2));return a};Z.g.Sd=function(a,c,d){Z.g.o&&!Z.h(a)&&Z.g.A(db,[Z.s(a),a],c,Array.prototype.slice.call(arguments,2));return a};Z.g.Nd=function(a,c,d){Z.g.o&&!Z.yb(a)&&Z.g.A($a,[Z.s(a),a],c,Array.prototype.slice.call(arguments,2));return a};
|
53 |
-
Z.g.Qd=function(a,c,d){Z.g.o&&!Z.$(a)&&Z.g.A(cb,[Z.s(a),a],c,Array.prototype.slice.call(arguments,2));return a};Z.g.Kd=function(a,c,d){Z.g.o&&!Z.isArray(a)&&Z.g.A(Ya,[Z.s(a),a],c,Array.prototype.slice.call(arguments,2));return a};Z.g.Ld=function(a,c,d){Z.g.o&&!Z.Hc(a)&&Z.g.A(Za,[Z.s(a),a],c,Array.prototype.slice.call(arguments,2));return a};Z.g.Md=function(a,c,d){!Z.g.o||Z.$(a)&&a.nodeType==Z.hb.$b.Pb||Z.g.A(Xa,[Z.s(a),a],c,Array.prototype.slice.call(arguments,2));return a};
|
54 |
-
Z.g.Od=function(a,c,d,e){!Z.g.o||a instanceof c||Z.g.A(ab,[Z.g.pb(c),Z.g.pb(a)],d,Array.prototype.slice.call(arguments,3));return a};Z.g.Rd=function(){for(var a in Object.prototype)Z.g.Ca(a+ga)};Z.g.pb=function(a){return a instanceof Function?a.displayName||a.name||pd:a instanceof Object?a.constructor.displayName||a.constructor.name||Object.prototype.toString.call(a):null===a?$c:typeof a};Z.f={};Z.w=Z.ra;Z.f.v=!1;Z.f.Xc=function(a){return a[a.length-1]};Z.f.pf=Z.f.Xc;Z.f.indexOf=Z.w&&(Z.f.v||Array.prototype.indexOf)?function(a,c,d){return Array.prototype.indexOf.call(a,c,d)}:function(a,c,d){d=null==d?0:0>d?Math.max(0,a.length+d):d;if(Z.h(a))return Z.h(c)&&1==c.length?a.indexOf(c,d):-1;for(;d<a.length;d++)if(d in a&&a[d]===c)return d;return-1};
|
55 |
-
Z.f.lastIndexOf=Z.w&&(Z.f.v||Array.prototype.lastIndexOf)?function(a,c,d){return Array.prototype.lastIndexOf.call(a,c,null==d?a.length-1:d)}:function(a,c,d){d=null==d?a.length-1:d;0>d&&(d=Math.max(0,a.length+d));if(Z.h(a))return Z.h(c)&&1==c.length?a.lastIndexOf(c,d):-1;for(;0<=d;d--)if(d in a&&a[d]===c)return d;return-1};
|
56 |
-
Z.f.forEach=Z.w&&(Z.f.v||Array.prototype.forEach)?function(a,c,d){Array.prototype.forEach.call(a,c,d)}:function(a,c,d){for(var e=a.length,f=Z.h(a)?a.split(b):a,g=0;g<e;g++)g in f&&c.call(d,f[g],g,a)};Z.f.jb=function(a,c){for(var d=Z.h(a)?a.split(b):a,e=a.length-1;0<=e;--e)e in d&&c.call(void 0,d[e],e,a)};
|
57 |
-
Z.f.filter=Z.w&&(Z.f.v||Array.prototype.filter)?function(a,c,d){return Array.prototype.filter.call(a,c,d)}:function(a,c,d){for(var e=a.length,f=[],g=0,h=Z.h(a)?a.split(b):a,m=0;m<e;m++)if(m in h){var n=h[m];c.call(d,n,m,a)&&(f[g++]=n)}return f};Z.f.map=Z.w&&(Z.f.v||Array.prototype.map)?function(a,c,d){return Array.prototype.map.call(a,c,d)}:function(a,c,d){for(var e=a.length,f=Array(e),g=Z.h(a)?a.split(b):a,h=0;h<e;h++)h in g&&(f[h]=c.call(d,g[h],h,a));return f};
|
58 |
-
Z.f.reduce=Z.w&&(Z.f.v||Array.prototype.reduce)?function(a,c,d,e){e&&(c=Z.bind(c,e));return Array.prototype.reduce.call(a,c,d)}:function(a,c,d,e){var f=d;Z.f.forEach(a,function(d,h){f=c.call(e,f,d,h,a)});return f};Z.f.reduceRight=Z.w&&(Z.f.v||Array.prototype.reduceRight)?function(a,c,d,e){e&&(c=Z.bind(c,e));return Array.prototype.reduceRight.call(a,c,d)}:function(a,c,d,e){var f=d;Z.f.jb(a,function(d,h){f=c.call(e,f,d,h,a)});return f};
|
59 |
-
Z.f.some=Z.w&&(Z.f.v||Array.prototype.some)?function(a,c,d){return Array.prototype.some.call(a,c,d)}:function(a,c,d){for(var e=a.length,f=Z.h(a)?a.split(b):a,g=0;g<e;g++)if(g in f&&c.call(d,f[g],g,a))return!0;return!1};Z.f.every=Z.w&&(Z.f.v||Array.prototype.every)?function(a,c,d){return Array.prototype.every.call(a,c,d)}:function(a,c,d){for(var e=a.length,f=Z.h(a)?a.split(b):a,g=0;g<e;g++)if(g in f&&!c.call(d,f[g],g,a))return!1;return!0};
|
60 |
-
Z.f.count=function(a,c,d){var e=0;Z.f.forEach(a,function(a,g,h){c.call(d,a,g,h)&&++e},d);return e};Z.f.find=function(a,c,d){c=Z.f.findIndex(a,c,d);return 0>c?null:Z.h(a)?a.charAt(c):a[c]};Z.f.findIndex=function(a,c,d){for(var e=a.length,f=Z.h(a)?a.split(b):a,g=0;g<e;g++)if(g in f&&c.call(d,f[g],g,a))return g;return-1};Z.f.Ae=function(a,c,d){c=Z.f.Bc(a,c,d);return 0>c?null:Z.h(a)?a.charAt(c):a[c]};
|
61 |
-
Z.f.Bc=function(a,c,d){for(var e=Z.h(a)?a.split(b):a,f=a.length-1;0<=f;f--)if(f in e&&c.call(d,e[f],f,a))return f;return-1};Z.f.contains=function(a,c){return 0<=Z.f.indexOf(a,c)};Z.f.Jc=function(a){return 0==a.length};Z.f.clear=function(a){if(!Z.isArray(a))for(var c=a.length-1;0<=c;c--)delete a[c];a.length=0};Z.f.Ue=function(a,c){Z.f.contains(a,c)||a.push(c)};Z.f.ub=function(a,c,d){Z.f.splice(a,d,0,c)};Z.f.Ve=function(a,c,d){Z.Wc(Z.f.splice,a,d,0).apply(null,c)};
|
62 |
-
Z.f.insertBefore=function(a,c,d){var e;2==arguments.length||0>(e=Z.f.indexOf(a,d))?a.push(c):Z.f.ub(a,c,e)};Z.f.remove=function(a,c){var d=Z.f.indexOf(a,c),e;(e=0<=d)&&Z.f.L(a,d);return e};Z.f.Tf=function(a,c){var d=Z.f.lastIndexOf(a,c);return 0<=d?(Z.f.L(a,d),!0):!1};Z.f.L=function(a,c){return 1==Array.prototype.splice.call(a,c,1).length};Z.f.Sf=function(a,c,d){c=Z.f.findIndex(a,c,d);return 0<=c?(Z.f.L(a,c),!0):!1};
|
63 |
-
Z.f.Pf=function(a,c,d){var e=0;Z.f.jb(a,function(f,g){c.call(d,f,g,a)&&Z.f.L(a,g)&&e++});return e};Z.f.concat=function(a){return Array.prototype.concat.apply(Array.prototype,arguments)};Z.f.join=function(a){return Array.prototype.concat.apply(Array.prototype,arguments)};Z.f.fd=function(a){var c=a.length;if(0<c){for(var d=Array(c),e=0;e<c;e++)d[e]=a[e];return d}return[]};Z.f.clone=Z.f.fd;
|
64 |
-
Z.f.extend=function(a,c){for(var d=1;d<arguments.length;d++){var e=arguments[d];if(Z.Ja(e)){var f=a.length||0,g=e.length||0;a.length=f+g;for(var h=0;h<g;h++)a[f+h]=e[h]}else a.push(e)}};Z.f.splice=function(a,c,d,e){return Array.prototype.splice.apply(a,Z.f.slice(arguments,1))};Z.f.slice=function(a,c,d){return 2>=arguments.length?Array.prototype.slice.call(a,c):Array.prototype.slice.call(a,c,d)};
|
65 |
-
Z.f.Qf=function(a,c,d){function e(a){return Z.$(a)?bd+Z.qb(a):(typeof a).charAt(0)+a}c=c||a;d=d||e;for(var f={},g=0,h=0;h<a.length;){var m=a[h++],n=d(m);Object.prototype.hasOwnProperty.call(f,n)||(f[n]=!0,c[g++]=m)}c.length=g};Z.f.bb=function(a,c,d){return Z.f.cb(a,d||Z.f.B,!1,c)};Z.f.Vd=function(a,c,d){return Z.f.cb(a,c,!0,void 0,d)};Z.f.cb=function(a,c,d,e,f){for(var g=0,h=a.length,m;g<h;){var n=g+h>>1,p;p=d?c.call(f,a[n],n,a):c(e,a[n]);0<p?g=n+1:(h=n,m=!p)}return m?g:~g};
|
66 |
-
Z.f.sort=function(a,c){a.sort(c||Z.f.B)};Z.f.dg=function(a,c){for(var d=Array(a.length),e=0;e<a.length;e++)d[e]={index:e,value:a[e]};var f=c||Z.f.B;Z.f.sort(d,function(a,c){return f(a.value,c.value)||a.index-c.index});for(e=0;e<a.length;e++)a[e]=d[e].value};Z.f.bd=function(a,c,d){var e=d||Z.f.B;Z.f.sort(a,function(a,d){return e(c(a),c(d))})};Z.f.ag=function(a,c,d){Z.f.bd(a,function(a){return a[c]},d)};
|
67 |
-
Z.f.kf=function(a,c,d){c=c||Z.f.B;for(var e=1;e<a.length;e++){var f=c(a[e-1],a[e]);if(0<f||0==f&&d)return!1}return!0};Z.f.xe=function(a,c,d){if(!Z.Ja(a)||!Z.Ja(c)||a.length!=c.length)return!1;var e=a.length;d=d||Z.f.yc;for(var f=0;f<e;f++)if(!d(a[f],c[f]))return!1;return!0};Z.f.me=function(a,c,d){d=d||Z.f.B;for(var e=Math.min(a.length,c.length),f=0;f<e;f++){var g=d(a[f],c[f]);if(0!=g)return g}return Z.f.B(a.length,c.length)};Z.f.B=function(a,c){return a>c?1:a<c?-1:0};
|
68 |
-
Z.f.Xe=function(a,c){return-Z.f.B(a,c)};Z.f.yc=function(a,c){return a===c};Z.f.Td=function(a,c,d){d=Z.f.bb(a,c,d);return 0>d?(Z.f.ub(a,c,-(d+1)),!0):!1};Z.f.Ud=function(a,c,d){c=Z.f.bb(a,c,d);return 0<=c?Z.f.L(a,c):!1};Z.f.Wd=function(a,c,d){for(var e={},f=0;f<a.length;f++){var g=a[f],h=c.call(d,g,f,a);Z.P(h)&&(e[h]||(e[h]=[])).push(g)}return e};Z.f.og=function(a,c,d){var e={};Z.f.forEach(a,function(f,g){e[c.call(d,f,g,a)]=f});return e};
|
69 |
-
Z.f.Hf=function(a,c,d){var e=[],f=0,g=a;d=d||1;void 0!==c&&(f=a,g=c);if(0>d*(g-f))return[];if(0<d)for(a=f;a<g;a+=d)e.push(a);else for(a=f;a>g;a+=d)e.push(a);return e};Z.f.repeat=function(a,c){for(var d=[],e=0;e<c;e++)d[e]=a;return d};Z.f.Cc=function(a){for(var c=[],d=0;d<arguments.length;d++){var e=arguments[d];if(Z.isArray(e))for(var f=0;f<e.length;f+=8192)for(var g=Z.f.Cc.apply(null,Z.f.slice(e,f,f+8192)),h=0;h<g.length;h++)c.push(g[h]);else c.push(e)}return c};
|
70 |
-
Z.f.rotate=function(a,c){a.length&&(c%=a.length,0<c?Array.prototype.unshift.apply(a,a.splice(-c,c)):0>c&&Array.prototype.push.apply(a,a.splice(0,-c)));return a};Z.f.xf=function(a,c,d){c=Array.prototype.splice.call(a,c,1);Array.prototype.splice.call(a,d,0,c[0])};
|
71 |
-
Z.f.Cg=function(a){if(!arguments.length)return[];for(var c=[],d=arguments[0].length,e=1;e<arguments.length;e++)arguments[e].length<d&&(d=arguments[e].length);for(e=0;e<d;e++){for(var f=[],g=0;g<arguments.length;g++)f.push(arguments[g][e]);c.push(f)}return c};Z.f.$f=function(a,c){for(var d=c||Math.random,e=a.length-1;0<e;e--){var f=Math.floor(d()*(e+1)),g=a[e];a[e]=a[f];a[f]=g}};Z.f.pe=function(a,c){var d=[];Z.f.forEach(c,function(c){d.push(a[c])});return d};Z.locale={};
|
72 |
-
Z.locale.J={COUNTRY:{AD:"Andorra",AE:Md,AF:Ld,AG:Qa,AI:"Anguilla",AL:"Shqip\u00ebria",AM:Kd,AN:wb,AO:"Angola",AQ:"Antarctica",AR:"Argentina",AS:Pa,AT:"\u00d6sterreich",AU:"Australia",AW:"Aruba",AX:"\u00c5land",AZ:"Az\u0259rbaycan",BA:z,BB:"Barbados",BD:"\u09ac\u09be\u0982\u09b2\u09be\u09a6\u09c7\u09b6",BE:"Belgi\u00eb",BF:"Burkina Faso",BG:"\u0411\u044a\u043b\u0433\u0430\u0440\u0438\u044f",BH:"\u0627\u0644\u0628\u062d\u0631\u064a\u0646",BI:"Burundi",BJ:"B\u00e9nin",BM:"Bermuda",BN:"Brunei",BO:y,BR:"Brasil",
|
73 |
-
BS:"Bahamas",BT:"\u092d\u0942\u091f\u093e\u0928",BV:"Bouvet Island",BW:Ta,BY:Hd,BZ:"Belize",CA:"Canada",CC:"Cocos (Keeling) Islands",CD:Ib,CF:Hb,CG:"Congo",CH:"Schweiz",CI:"C\u00f4te d\u2019Ivoire",CK:"Cook Islands",CL:"Chile",CM:"Cameroun",CN:"\u4e2d\u56fd",CO:"Colombia",CR:"Costa Rica",CS:Nb,CU:"Cuba",CV:"Cabo Verde",CX:Wa,CY:"\u039a\u03cd\u03c0\u03c1\u03bf\u03c2",CZ:Gd,DD:"East Germany",DE:"Deutschland",DJ:"Jabuuti",DK:"Danmark",DM:"Dominica",DO:Fb,DZ:"\u0627\u0644\u062c\u0632\u0627\u0626\u0631",
|
74 |
-
EC:"Ecuador",EE:"Eesti",EG:"\u0645\u0635\u0631",EH:Nd,ER:"\u0627\u0631\u064a\u062a\u0631\u064a\u0627",ES:"Espa\u00f1a",ET:X,FI:"Suomi",FJ:"\u092b\u093f\u091c\u0940",FK:fb,FM:C,FO:"F\u00f8royar",FR:"France",FX:"Metropolitan France",GA:"Gabon",GB:$b,GD:"Grenada",GE:"\u10e1\u10d0\u10e5\u10d0\u10e0\u10d7\u10d5\u10d4\u10da\u10dd",GF:hb,GG:"Guernsey",GH:B,GI:"Gibraltar",GL:nb,GM:"Gambia",GN:"Guin\u00e9e",GP:"Guadeloupe",GQ:gb,GR:"\u0395\u03bb\u03bb\u03ac\u03b4\u03b1",GS:"South Georgia and the South Sandwich Islands",
|
75 |
-
GT:"Guatemala",GU:"Guam",GW:"Guin\u00e9 Bissau",GY:"Guyana",HK:"\u9999\u6e2f",HM:"Heard Island and McDonald Islands",HN:jb,HR:"Hrvatska",HT:"Ha\u00efti",HU:"Magyarorsz\u00e1g",ID:kb,IE:"Ireland",IL:"\u05d9\u05e9\u05e8\u05d0\u05dc",IM:"Isle of Man",IN:W,IO:"British Indian Ocean Territory",IQ:"\u0627\u0644\u0639\u0631\u0627\u0642",IR:"\u0627\u06cc\u0631\u0627\u0646",IS:"\u00cdsland",IT:"Italia",JE:"Jersey",JM:"Jamaica",JO:"\u0627\u0644\u0623\u0631\u062f\u0646",JP:"\u65e5\u672c",KE:"Kenya",KG:Id,KH:"\u1780\u1798\u17d2\u1796\u17bb\u1787\u17b6",
|
76 |
-
KI:ob,KM:Qd,KN:Kb,KP:Sd,KR:"\ub300\ud55c\ubbfc\uad6d",KW:"\u0627\u0644\u0643\u0648\u064a\u062a",KY:Va,KZ:"\u041a\u0430\u0437\u0430\u0445\u0441\u0442\u0430\u043d",LA:"\u0e25\u0e32\u0e27",LB:"\u0644\u0628\u0646\u0627\u0646",LC:"Saint Lucia",LI:"Liechtenstein",LK:"\u0b87\u0bb2\u0b99\u0bcd\u0b95\u0bc8",LR:"Liberia",LS:"Lesotho",LT:"Lietuva",LU:sb,LV:"Latvija",LY:"\u0644\u064a\u0628\u064a\u0627",MA:"\u0627\u0644\u0645\u063a\u0631\u0628",MC:"Monaco",MD:vb,ME:"\u0426\u0440\u043d\u0430 \u0413\u043e\u0440\u0430",
|
77 |
-
MG:tb,MH:ub,MK:"\u041c\u0430\u043a\u0435\u0434\u043e\u043d\u0438\u0458\u0430",ML:"\u0645\u0627\u0644\u064a",MM:"Myanmar",MN:"\u8499\u53e4",MO:"\u6fb3\u95e8",MP:zb,MQ:"Martinique",MR:"\u0645\u0648\u0631\u064a\u062a\u0627\u0646\u064a\u0627",MS:"Montserrat",MT:"Malta",MU:"Mauritius",MV:"Maldives",MW:"Malawi",MX:"M\u00e9xico",MY:"Malaysia",MZ:"Mo\u00e7ambique",NA:"Namibia",NC:Ab,NE:"Niger",NF:yb,NG:D,NI:"Nicaragua",NL:"Nederland",NO:"Norge",NP:"\u0928\u0947\u092a\u093e\u0932",NR:"Nauru",NT:"Neutral Zone",
|
78 |
-
NU:"Niue",NZ:xb,OM:"\u0639\u0645\u0627\u0646",PA:"Panam\u00e1",PE:"Per\u00fa",PF:Db,PG:E,PH:Cb,PK:Rd,PL:"Polska",PM:Mb,PN:"Pitcairn",PR:Eb,PS:"\u0641\u0644\u0633\u0637\u064a\u0646",PT:"Portugal",PW:"Palau",PY:Bb,QA:"\u0642\u0637\u0631",QO:"Outlying Oceania",QU:"European Union",RE:"R\u00e9union",RO:"Rom\u00e2nia",RS:"\u0421\u0440\u0431\u0438\u0458\u0430",RU:"\u0420\u043e\u0441\u0441\u0438\u044f",RW:F,SA:Od,SB:Qb,SC:Ob,SD:"\u0627\u0644\u0633\u0648\u062f\u0627\u0646",SE:"Sverige",SG:"\u65b0\u52a0\u5761",
|
79 |
-
SH:"Saint Helena",SI:"Slovenija",SJ:Rb,SK:Pb,SL:"Sierra Leone",SM:"San Marino",SN:H,SO:"Somali",SR:"Suriname",ST:Vb,SU:"Union of Soviet Socialist Republics",SV:"El Salvador",SY:"\u0633\u0648\u0631\u064a\u0627",SZ:Ub,TC:Yb,TD:"\u062a\u0634\u0627\u062f",TF:"French Southern Territories",TG:"Togo",TH:"\u0e1b\u0e23\u0e30\u0e40\u0e17\u0e28\u0e44\u0e17\u0e22",TJ:"\u062a\u0627\u062c\u06cc\u06a9\u0633\u062a\u0627\u0646",TK:I,TL:Xb,TM:"\u0422\u0443\u0440\u043a\u043c\u0435\u043d\u0438\u0441\u0442\u0430\u043d",
|
80 |
-
TN:"\u062a\u0648\u0646\u0633",TO:"Tonga",TR:K,TT:"Trinidad y Tobago",TV:J,TW:"\u53f0\u6e7e",TZ:Wb,UA:"\u0423\u043a\u0440\u0430\u0457\u043d\u0430",UG:"Uganda",UM:bc,US:ac,UY:"Uruguay",UZ:"\u040e\u0437\u0431\u0435\u043a\u0438\u0441\u0442\u043e\u043d",VA:"Vaticano",VC:Lb,VE:"Venezuela",VG:Ua,VI:Zb,VN:"Vi\u1ec7t Nam",VU:L,WF:dc,WS:"Samoa",YD:"People's Democratic Republic of Yemen",YE:"\u0627\u0644\u064a\u0645\u0646",YT:"Mayotte",ZA:G,ZM:"Zambia",ZW:"Zimbabwe",ZZ:cc,aa_DJ:"Jabuuti",aa_ER:"\u00c9rythr\u00e9e",
|
81 |
-
aa_ER_SAAHO:"\u00c9rythr\u00e9e",aa_ET:lb,af_NA:"Namibi\u00eb",af_ZA:"Suid-Afrika",ak_GH:B,am_ET:X,ar_AE:Md,ar_BH:"\u0627\u0644\u0628\u062d\u0631\u064a\u0646",ar_DJ:"\u062c\u064a\u0628\u0648\u062a\u064a",ar_DZ:"\u0627\u0644\u062c\u0632\u0627\u0626\u0631",ar_EG:"\u0645\u0635\u0631",ar_EH:Nd,ar_ER:"\u0627\u0631\u064a\u062a\u0631\u064a\u0627",ar_IL:"\u0627\u0633\u0631\u0627\u0626\u064a\u0644",ar_IQ:"\u0627\u0644\u0639\u0631\u0627\u0642",ar_JO:"\u0627\u0644\u0623\u0631\u062f\u0646",ar_KM:Qd,ar_KW:"\u0627\u0644\u0643\u0648\u064a\u062a",
|
82 |
-
ar_LB:"\u0644\u0628\u0646\u0627\u0646",ar_LY:"\u0644\u064a\u0628\u064a\u0627",ar_MA:"\u0627\u0644\u0645\u063a\u0631\u0628",ar_MR:"\u0645\u0648\u0631\u064a\u062a\u0627\u0646\u064a\u0627",ar_OM:"\u0639\u0645\u0627\u0646",ar_PS:"\u0641\u0644\u0633\u0637\u064a\u0646",ar_QA:"\u0642\u0637\u0631",ar_SA:Od,ar_SD:"\u0627\u0644\u0633\u0648\u062f\u0627\u0646",ar_SY:"\u0633\u0648\u0631\u064a\u0627",ar_TD:"\u062a\u0634\u0627\u062f",ar_TN:"\u062a\u0648\u0646\u0633",ar_YE:"\u0627\u0644\u064a\u0645\u0646",as_IN:"\u09ad\u09be\u09f0\u09a4",
|
83 |
-
ay_BO:y,az_AZ:"Az\u0259rbaycan",az_Cyrl_AZ:"\u0410\u0437\u04d9\u0440\u0431\u0430\u0458\u04b9\u0430\u043d",az_Latn_AZ:"Azerbaycan",be_BY:Hd,bg_BG:"\u0411\u044a\u043b\u0433\u0430\u0440\u0438\u044f",bi_VU:L,bn_BD:"\u09ac\u09be\u0982\u09b2\u09be\u09a6\u09c7\u09b6",bn_IN:"\u09ad\u09be\u09b0\u09a4",bo_CN:"\u0f62\u0f92\u0fb1\u0f0b\u0f53\u0f42",bo_IN:"\u0f62\u0f92\u0fb1\u0f0b\u0f42\u0f62\u0f0b",bs_BA:z,byn_ER:"\u12a4\u122d\u1275\u122b",ca_AD:"Andorra",ca_ES:"Espanya",cch_NG:D,ch_GU:"Guam",chk_FM:C,cop_Arab_EG:"\u0645\u0635\u0631",
|
84 |
-
cop_Arab_US:Pd,cop_EG:"\u0645\u0635\u0631",cop_US:Pd,cs_CZ:Gd,cy_GB:"Prydain Fawr",da_DK:"Danmark",da_GL:"Gr\u00f8nland",de_AT:"\u00d6sterreich",de_BE:"Belgien",de_CH:"Schweiz",de_DE:"Deutschland",de_LI:"Liechtenstein",de_LU:"Luxemburg",dv_MV:"Maldives",dz_BT:"Bhutan",ee_GH:B,ee_TG:"Togo",efi_NG:D,el_CY:"\u039a\u03cd\u03c0\u03c1\u03bf\u03c2",el_GR:"\u0395\u03bb\u03bb\u03ac\u03b4\u03b1",en_AG:Qa,en_AI:"Anguilla",en_AS:Pa,en_AU:"Australia",en_BB:"Barbados",en_BE:"Belgium",en_BM:"Bermuda",en_BS:"Bahamas",
|
85 |
-
en_BW:Ta,en_BZ:"Belize",en_CA:"Canada",en_CC:"Cocos Islands",en_CK:"Cook Islands",en_CM:"Cameroon",en_CX:Wa,en_DM:"Dominica",en_FJ:"Fiji",en_FK:fb,en_FM:C,en_GB:$b,en_GD:"Grenada",en_GG:"Guernsey",en_GH:B,en_GI:"Gibraltar",en_GM:"Gambia",en_GU:"Guam",en_GY:"Guyana",en_HK:"Hong Kong",en_HN:jb,en_IE:"Ireland",en_IM:"Isle of Man",en_IN:"India",en_JE:"Jersey",en_JM:"Jamaica",en_KE:"Kenya",en_KI:ob,en_KN:Kb,en_KY:Va,en_LC:"Saint Lucia",en_LR:"Liberia",en_LS:"Lesotho",en_MH:ub,en_MP:zb,en_MS:"Montserrat",
|
86 |
-
en_MT:"Malta",en_MU:"Mauritius",en_MW:"Malawi",en_NA:"Namibia",en_NF:yb,en_NG:D,en_NR:"Nauru",en_NU:"Niue",en_NZ:xb,en_PG:E,en_PH:Cb,en_PK:"Pakistan",en_PN:"Pitcairn",en_PR:Eb,en_RW:F,en_SB:Qb,en_SC:Ob,en_SG:"Singapore",en_SH:"Saint Helena",en_SL:"Sierra Leone",en_SZ:Ub,en_TC:Yb,en_TK:I,en_TO:"Tonga",en_TT:"Trinidad and Tobago",en_TV:J,en_TZ:Wb,en_UG:"Uganda",en_UM:bc,en_US:ac,en_US_POSIX:ac,en_VC:Lb,en_VG:Ua,en_VI:Zb,en_VU:L,en_WS:"Samoa",en_ZA:G,en_ZM:"Zambia",en_ZW:"Zimbabwe",es_AR:"Argentina",
|
87 |
-
es_BO:y,es_CL:"Chile",es_CO:"Colombia",es_CR:"Costa Rica",es_CU:"Cuba",es_DO:Fb,es_EC:"Ecuador",es_ES:"Espa\u00f1a",es_GQ:"Guinea Ecuatorial",es_GT:"Guatemala",es_HN:jb,es_MX:"M\u00e9xico",es_NI:"Nicaragua",es_PA:"Panam\u00e1",es_PE:"Per\u00fa",es_PH:"Filipinas",es_PR:Eb,es_PY:Bb,es_SV:"El Salvador",es_US:"Estados Unidos",es_UY:"Uruguay",es_VE:"Venezuela",et_EE:"Eesti",eu_ES:"Espainia",fa_AF:Ld,fa_IR:"\u0627\u06cc\u0631\u0627\u0646",fi_FI:"Suomi",fil_PH:Cb,fj_FJ:"Fiji",fo_FO:"F\u00f8royar",fr_BE:"Belgique",
|
88 |
-
fr_BF:"Burkina Faso",fr_BI:"Burundi",fr_BJ:"B\u00e9nin",fr_CA:"Canada",fr_CD:Ib,fr_CF:Hb,fr_CG:"Congo",fr_CH:"Suisse",fr_CI:"C\u00f4te d\u2019Ivoire",fr_CM:"Cameroun",fr_DJ:"Djibouti",fr_DZ:"Alg\u00e9rie",fr_FR:"France",fr_GA:"Gabon",fr_GF:hb,fr_GN:"Guin\u00e9e",fr_GP:"Guadeloupe",fr_GQ:gb,fr_HT:"Ha\u00efti",fr_KM:"Comores",fr_LU:sb,fr_MA:"Maroc",fr_MC:"Monaco",fr_MG:tb,fr_ML:"Mali",fr_MQ:"Martinique",fr_MU:"Maurice",fr_NC:Ab,fr_NE:"Niger",fr_PF:Db,fr_PM:Mb,fr_RE:"R\u00e9union",fr_RW:F,fr_SC:Ob,fr_SN:H,
|
89 |
-
fr_SY:"Syrie",fr_TD:"Tchad",fr_TG:"Togo",fr_TN:"Tunisie",fr_VU:L,fr_WF:dc,fr_YT:"Mayotte",fur_IT:"Italia",ga_IE:"\u00c9ire",gaa_GH:B,gez_ER:"\u12a4\u122d\u1275\u122b",gez_ET:X,gil_KI:ob,gl_ES:"Espa\u00f1a",gn_PY:Bb,gu_IN:"\u0aad\u0abe\u0ab0\u0aa4",gv_GB:Gb,ha_Arab_NG:"\u0646\u064a\u062c\u064a\u0631\u064a\u0627",ha_GH:"\u063a\u0627\u0646\u0627",ha_Latn_GH:B,ha_Latn_NE:"Niger",ha_Latn_NG:"Nig\u00e9ria",ha_NE:"\u0627\u0644\u0646\u064a\u062c\u0631",ha_NG:"\u0646\u064a\u062c\u064a\u0631\u064a\u0627",haw_US:"\u02bbAmelika Hui P\u016b \u02bbIa",
|
90 |
-
he_IL:"\u05d9\u05e9\u05e8\u05d0\u05dc",hi_IN:W,ho_PG:E,hr_BA:z,hr_HR:"Hrvatska",ht_HT:"Ha\u00efti",hu_HU:"Magyarorsz\u00e1g",hy_AM:Kd,hy_AM_REVISED:Kd,id_ID:kb,ig_NG:D,ii_CN:"\ua34f\ua1e9",is_IS:"\u00cdsland",it_CH:"Svizzera",it_IT:"Italia",it_SM:"San Marino",ja_JP:"\u65e5\u672c",ka_GE:"\u10e1\u10d0\u10e5\u10d0\u10e0\u10d7\u10d5\u10d4\u10da\u10dd",kaj_NG:D,kam_KE:"Kenya",kcg_NG:D,kfo_NG:"Nig\u00e9ria",kk_KZ:"\u049a\u0430\u0437\u0430\u049b\u0441\u0442\u0430\u043d",kl_GL:nb,km_KH:"\u1780\u1798\u17d2\u1796\u17bb\u1787\u17b6",
|
91 |
-
kn_IN:"\u0cad\u0cbe\u0cb0\u0ca4",ko_KP:Sd,ko_KR:"\ub300\ud55c\ubbfc\uad6d",kok_IN:W,kos_FM:C,kpe_GN:"Guin\u00e9e",kpe_LR:"Lib\u00e9ria",ks_IN:W,ku_IQ:"Irak",ku_IR:"\u0130ran",ku_Latn_IQ:"Irak",ku_Latn_IR:"\u0130ran",ku_Latn_SY:"Suriye",ku_Latn_TR:K,ku_SY:"Suriye",ku_TR:K,kw_GB:Gb,ky_Cyrl_KG:Id,ky_KG:"K\u0131rg\u0131zistan",la_VA:"Vaticano",lb_LU:sb,ln_CD:Ib,ln_CG:"Kongo",lo_LA:"Laos",lt_LT:"Lietuva",lv_LV:"Latvija",mg_MG:tb,mh_MH:ub,mi_NZ:xb,mk_MK:"\u041c\u0430\u043a\u0435\u0434\u043e\u
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|