Version Description
(2021-04-23) = - Bookings that require a deposit, but which have been abandoned before the deposit was paid now show in the admin bookings table with the status Payment Pending. - Added an option to the modify/cancel booking screen on the front end to pay the deposit. This applies to bookings that have either the Payment Pending or Payment Failed status. - Added an option, for Stripe payments, to have the credit card expiry date show as one input field. - Correcting an issue from v2.2.6 with the table and section inputs on the settings page.
Download this release
Release Info
Developer | Rustaurius |
Plugin | Restaurant Reservations |
Version | 2.2.7 |
Comparing to | |
See all releases |
Code changes from version 2.2.6 to 2.2.7
- assets/js/admin.js +2 -2
- includes/Settings.class.php +1 -1
- lib/simple-admin-pages/README.md +5 -5
- lib/simple-admin-pages/classes/AdminPage.Menu.class.php +1 -1
- lib/simple-admin-pages/classes/AdminPage.Submenu.class.php +1 -1
- lib/simple-admin-pages/classes/AdminPage.Themes.class.php +1 -1
- lib/simple-admin-pages/classes/AdminPage.class.php +3 -3
- lib/simple-admin-pages/classes/AdminPageSection.class.php +9 -12
- lib/simple-admin-pages/classes/AdminPageSetting.Address.class.php +2 -2
- lib/simple-admin-pages/classes/AdminPageSetting.Checkbox.class.php +7 -11
- lib/simple-admin-pages/classes/AdminPageSetting.ColorPicker.class.php +3 -3
- lib/simple-admin-pages/classes/AdminPageSetting.Count.class.php +3 -3
- lib/simple-admin-pages/classes/AdminPageSetting.Editor.class.php +1 -1
- lib/simple-admin-pages/classes/AdminPageSetting.FileUpload.class.php +0 -71
- lib/simple-admin-pages/classes/AdminPageSetting.HTML.class.php +1 -1
- lib/simple-admin-pages/classes/AdminPageSetting.Image.class.php +0 -62
- lib/simple-admin-pages/classes/AdminPageSetting.InfiniteTable.class.php +36 -23
- lib/simple-admin-pages/classes/AdminPageSetting.McApiKey.class.php +4 -6
- lib/simple-admin-pages/classes/AdminPageSetting.McListMerge.class.php +3 -3
- lib/simple-admin-pages/classes/AdminPageSetting.Number.class.php +0 -37
- lib/simple-admin-pages/classes/AdminPageSetting.OpeningHours.class.php +2 -2
- lib/simple-admin-pages/classes/AdminPageSetting.Ordering.class.php +0 -94
- lib/simple-admin-pages/classes/AdminPageSetting.Radio.class.php +5 -6
- lib/simple-admin-pages/classes/AdminPageSetting.Scheduler.class.php +11 -11
- lib/simple-admin-pages/classes/AdminPageSetting.Select.class.php +1 -1
- lib/simple-admin-pages/classes/AdminPageSetting.SelectMenu.class.php +0 -57
- lib/simple-admin-pages/classes/AdminPageSetting.SelectPost.class.php +1 -1
- lib/simple-admin-pages/classes/AdminPageSetting.SelectTaxonomy.class.php +1 -1
- lib/simple-admin-pages/classes/AdminPageSetting.Text.class.php +2 -2
- lib/simple-admin-pages/classes/AdminPageSetting.Textarea.class.php +1 -1
- lib/simple-admin-pages/classes/AdminPageSetting.Toggle.class.php +6 -8
- lib/simple-admin-pages/classes/AdminPageSetting.WarningTip.class.php +0 -41
- lib/simple-admin-pages/classes/AdminPageSetting.class.php +1 -15
- lib/simple-admin-pages/classes/Library.class.php +4 -32
- lib/simple-admin-pages/css/admin-settings.css +0 -654
- lib/simple-admin-pages/css/ordering.css +0 -27
- lib/simple-admin-pages/css/spectrum.css +0 -507
- lib/simple-admin-pages/img/options-asset-info.png +0 -0
- lib/simple-admin-pages/img/options-asset-lock.png +0 -0
- lib/simple-admin-pages/img/options-asset-star.png +0 -0
- lib/simple-admin-pages/img/options-asset-starX2.png +0 -0
- lib/simple-admin-pages/js/admin-settings.js +0 -78
- lib/simple-admin-pages/js/file_upload.js +0 -41
- lib/simple-admin-pages/js/image.js +0 -53
- lib/simple-admin-pages/js/infinite_table.js +88 -81
- lib/simple-admin-pages/js/ordering.js +0 -38
- lib/simple-admin-pages/js/scheduler.js +7 -1
- lib/simple-admin-pages/js/spectrum.js +0 -2317
- lib/simple-admin-pages/lib/pickadate/picker.date.js +1 -1
- lib/simple-admin-pages/lib/pickadate/picker.js +2 -2
- lib/simple-admin-pages/lib/pickadate/picker.time.js +1 -1
- lib/simple-admin-pages/lib/pickadate/translations/ja_JP.js +1 -1
- lib/stripe/.gitignore +0 -14
- readme.txt +7 -1
- restaurant-reservations.php +1 -1
assets/js/admin.js
CHANGED
@@ -1070,12 +1070,12 @@ jQuery(document).ready(function($){
|
|
1070 |
/*LOCK BOXES*/
|
1071 |
jQuery( document ).ready( function() {
|
1072 |
|
1073 |
-
setTimeout( resizeLockdownBoxes,
|
1074 |
|
1075 |
jQuery( window ).on( 'resize', resizeLockdownBoxes );
|
1076 |
|
1077 |
jQuery( '.mcfrtb-list-select select' ).on( 'click.resizeLockdownBoxes', function() {
|
1078 |
-
setTimeout( resizeLockdownBoxes,
|
1079 |
} );
|
1080 |
|
1081 |
});
|
1070 |
/*LOCK BOXES*/
|
1071 |
jQuery( document ).ready( function() {
|
1072 |
|
1073 |
+
setTimeout( resizeLockdownBoxes, 3000 );
|
1074 |
|
1075 |
jQuery( window ).on( 'resize', resizeLockdownBoxes );
|
1076 |
|
1077 |
jQuery( '.mcfrtb-list-select select' ).on( 'click.resizeLockdownBoxes', function() {
|
1078 |
+
setTimeout( resizeLockdownBoxes, 3000 );
|
1079 |
} );
|
1080 |
|
1081 |
});
|
includes/Settings.class.php
CHANGED
@@ -614,7 +614,7 @@ If you were not the one to cancel this booking, please contact us.
|
|
614 |
require_once( RTB_PLUGIN_DIR . '/lib/simple-admin-pages/simple-admin-pages.php' );
|
615 |
$sap = sap_initialize_library(
|
616 |
$args = array(
|
617 |
-
'version' => '2.
|
618 |
'lib_url' => RTB_PLUGIN_URL . '/lib/simple-admin-pages/',
|
619 |
)
|
620 |
);
|
614 |
require_once( RTB_PLUGIN_DIR . '/lib/simple-admin-pages/simple-admin-pages.php' );
|
615 |
$sap = sap_initialize_library(
|
616 |
$args = array(
|
617 |
+
'version' => '2.2.0',
|
618 |
'lib_url' => RTB_PLUGIN_URL . '/lib/simple-admin-pages/',
|
619 |
)
|
620 |
);
|
lib/simple-admin-pages/README.md
CHANGED
@@ -39,7 +39,7 @@ Here's an example of how you can use this library to create an admin page.
|
|
39 |
require_once( 'path/to/simple-admin-pages/simple-admin-pages.php' );
|
40 |
$sap = sap_initialize_library(
|
41 |
array(
|
42 |
-
'version' => '2.
|
43 |
'lib_url' => PLUGIN_URL . '/lib/simple-admin-pages/', // URL path to sap library
|
44 |
)
|
45 |
);
|
@@ -128,7 +128,7 @@ The lib_url is used to print stylesheets or scripts attached to the library.
|
|
128 |
require_once( 'path/to/simple-admin-pages/simple-admin-pages.php' );
|
129 |
$sap = sap_initialize_library(
|
130 |
$args = array(
|
131 |
-
'version' => '2.
|
132 |
'lib_url' => PLUGIN_URL . '/lib/simple-admin-pages/', // URL path to sap library
|
133 |
)
|
134 |
);
|
@@ -369,10 +369,10 @@ $all_page_settings[ $my_setting_id ];
|
|
369 |
|
370 |
## Changelog
|
371 |
|
372 |
-
- 2.
|
373 |
-
- Updating
|
374 |
|
375 |
-
- 2.
|
376 |
- Update pickadate.js to 3.6.1 to fix regression in Chromium
|
377 |
https://github.com/amsul/pickadate.js/issues/1138
|
378 |
|
39 |
require_once( 'path/to/simple-admin-pages/simple-admin-pages.php' );
|
40 |
$sap = sap_initialize_library(
|
41 |
array(
|
42 |
+
'version' => '2.2.0', // Version of the library
|
43 |
'lib_url' => PLUGIN_URL . '/lib/simple-admin-pages/', // URL path to sap library
|
44 |
)
|
45 |
);
|
128 |
require_once( 'path/to/simple-admin-pages/simple-admin-pages.php' );
|
129 |
$sap = sap_initialize_library(
|
130 |
$args = array(
|
131 |
+
'version' => '2.2.0', // Version of the library
|
132 |
'lib_url' => PLUGIN_URL . '/lib/simple-admin-pages/', // URL path to sap library
|
133 |
)
|
134 |
);
|
369 |
|
370 |
## Changelog
|
371 |
|
372 |
+
- 2.2.0 - 2019-03-18
|
373 |
+
- Updating version number to not conflict with Business Profile plugin
|
374 |
|
375 |
+
- 2.1.2 - 2019-03-18
|
376 |
- Update pickadate.js to 3.6.1 to fix regression in Chromium
|
377 |
https://github.com/amsul/pickadate.js/issues/1138
|
378 |
|
lib/simple-admin-pages/classes/AdminPage.Menu.class.php
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
* @package Simple Admin Pages
|
9 |
*/
|
10 |
|
11 |
-
class
|
12 |
|
13 |
public $setup_function = 'add_menu_page'; // WP function to register the page
|
14 |
|
8 |
* @package Simple Admin Pages
|
9 |
*/
|
10 |
|
11 |
+
class sapAdminPageMenu_2_2_0 extends sapAdminPage_2_2_0 {
|
12 |
|
13 |
public $setup_function = 'add_menu_page'; // WP function to register the page
|
14 |
|
lib/simple-admin-pages/classes/AdminPage.Submenu.class.php
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
* @package Simple Admin Pages
|
9 |
*/
|
10 |
|
11 |
-
class
|
12 |
|
13 |
public $setup_function = 'add_submenu_page'; // WP function to register the page
|
14 |
|
8 |
* @package Simple Admin Pages
|
9 |
*/
|
10 |
|
11 |
+
class sapAdminPageSubmenu_2_2_0 extends sapAdminPage_2_2_0 {
|
12 |
|
13 |
public $setup_function = 'add_submenu_page'; // WP function to register the page
|
14 |
|
lib/simple-admin-pages/classes/AdminPage.Themes.class.php
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
* @package Simple Admin Pages
|
9 |
*/
|
10 |
|
11 |
-
class
|
12 |
|
13 |
public $setup_function = 'add_theme_page'; // WP function to register the page
|
14 |
|
8 |
* @package Simple Admin Pages
|
9 |
*/
|
10 |
|
11 |
+
class sapAdminPageThemes_2_2_0 extends sapAdminPage_2_2_0 {
|
12 |
|
13 |
public $setup_function = 'add_theme_page'; // WP function to register the page
|
14 |
|
lib/simple-admin-pages/classes/AdminPage.class.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
* @package Simple Admin Pages
|
8 |
*/
|
9 |
|
10 |
-
class
|
11 |
|
12 |
public $title;
|
13 |
public $menu_title;
|
@@ -177,7 +177,7 @@ class sapAdminPage_2_5_0 {
|
|
177 |
|
178 |
?>
|
179 |
|
180 |
-
<div class="wrap
|
181 |
|
182 |
<?php $this->display_page_title(); ?>
|
183 |
|
@@ -205,7 +205,7 @@ class sapAdminPage_2_5_0 {
|
|
205 |
</h2>
|
206 |
<?php endif; ?>
|
207 |
|
208 |
-
<form method="post" action="options.php"
|
209 |
<?php settings_fields( $this->id ); ?>
|
210 |
<?php do_settings_sections( $current_page ); ?>
|
211 |
<?php if ( $this->show_button ) { submit_button(); } ?>
|
7 |
* @package Simple Admin Pages
|
8 |
*/
|
9 |
|
10 |
+
class sapAdminPage_2_2_0 {
|
11 |
|
12 |
public $title;
|
13 |
public $menu_title;
|
177 |
|
178 |
?>
|
179 |
|
180 |
+
<div class="wrap">
|
181 |
|
182 |
<?php $this->display_page_title(); ?>
|
183 |
|
205 |
</h2>
|
206 |
<?php endif; ?>
|
207 |
|
208 |
+
<form method="post" action="options.php">
|
209 |
<?php settings_fields( $this->id ); ?>
|
210 |
<?php do_settings_sections( $current_page ); ?>
|
211 |
<?php if ( $this->show_button ) { submit_button(); } ?>
|
lib/simple-admin-pages/classes/AdminPageSection.class.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
* @package Simple Admin Pages
|
8 |
*/
|
9 |
|
10 |
-
class
|
11 |
|
12 |
// Page defaults
|
13 |
public $id; // unique id for this section
|
@@ -129,20 +129,17 @@ class sapAdminPageSection_2_5_0 {
|
|
129 |
endif;
|
130 |
|
131 |
if ( $this->disabled and isset($this->disabled_image) ) {
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
<?php echo ( isset($this->purchase_link ) ? "<div class='sap-premium-options-table-overlay'>" : '' ); ?>
|
136 |
<div class="section-disabled">
|
137 |
-
<img src="<?php echo
|
138 |
-
<p>Access this section by upgrading to premium
|
139 |
-
<a href="
|
140 |
</div>
|
141 |
-
<?php echo ( isset(
|
142 |
-
|
143 |
-
<?php
|
144 |
-
|
145 |
}
|
|
|
146 |
}
|
147 |
|
148 |
/**
|
7 |
* @package Simple Admin Pages
|
8 |
*/
|
9 |
|
10 |
+
class sapAdminPageSection_2_2_0 {
|
11 |
|
12 |
// Page defaults
|
13 |
public $id; // unique id for this section
|
129 |
endif;
|
130 |
|
131 |
if ( $this->disabled and isset($this->disabled_image) ) {
|
132 |
+
?>
|
133 |
+
<?php echo ( isset($this->purchase_link ) ? "<div class='rtb-premium-options-table-overlay'>" : '' ); ?>
|
|
|
|
|
134 |
<div class="section-disabled">
|
135 |
+
<img src="<?php echo RTB_PLUGIN_URL; ?>/assets/img/options-asset-lock.png" alt="Upgrade to Five-Star Restaurant Reservations Premium">
|
136 |
+
<p>Access this section by upgrading to <?php echo ( isset($this->ultimate_needed) ? 'ultimate' : 'premium' ); ?></p>
|
137 |
+
<a href="https://www.fivestarplugins.com/plugins/five-star-restaurant-reservations/<?php echo ( isset($this->ultimate_needed) ? '#plugin-sales-ultimate-section' : '' ); ?>" class="rtb-dashboard-get-premium-widget-button" target="_blank">UPGRADE NOW</a>
|
138 |
</div>
|
139 |
+
<?php echo ( isset($this->purchase_link ) ? "</div>" : '' ); ?>
|
140 |
+
<?php
|
|
|
|
|
141 |
}
|
142 |
+
|
143 |
}
|
144 |
|
145 |
/**
|
lib/simple-admin-pages/classes/AdminPageSetting.Address.class.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
* @package Simple Admin Pages
|
8 |
*/
|
9 |
|
10 |
-
class
|
11 |
|
12 |
/*
|
13 |
* Size of this textarea
|
@@ -37,7 +37,7 @@ class sapAdminPageSettingAddress_2_5_0 extends sapAdminPageSetting_2_5_0 {
|
|
37 |
'sap-address' => array(
|
38 |
'path' => 'js/address.js',
|
39 |
'dependencies' => array( 'jquery' ),
|
40 |
-
'version' =>
|
41 |
'footer' => true,
|
42 |
),
|
43 |
);
|
7 |
* @package Simple Admin Pages
|
8 |
*/
|
9 |
|
10 |
+
class sapAdminPageSettingAddress_2_2_0 extends sapAdminPageSetting_2_2_0 {
|
11 |
|
12 |
/*
|
13 |
* Size of this textarea
|
37 |
'sap-address' => array(
|
38 |
'path' => 'js/address.js',
|
39 |
'dependencies' => array( 'jquery' ),
|
40 |
+
'version' => '2.1.1',
|
41 |
'footer' => true,
|
42 |
),
|
43 |
);
|
lib/simple-admin-pages/classes/AdminPageSetting.Checkbox.class.php
CHANGED
@@ -19,7 +19,7 @@
|
|
19 |
* @package Simple Admin Pages
|
20 |
*/
|
21 |
|
22 |
-
class
|
23 |
|
24 |
//public $sanitize_callback = 'sanitize_text_field';
|
25 |
|
@@ -30,15 +30,16 @@ class sapAdminPageSettingCheckbox_2_5_0 extends sapAdminPageSetting_2_5_0 {
|
|
30 |
public function display_setting() {
|
31 |
|
32 |
$input_name = $this->get_input_name();
|
33 |
-
$values = (
|
34 |
|
35 |
?>
|
36 |
-
<fieldset
|
37 |
-
<?php foreach ( $this->options as $id => $title ) : ?>
|
38 |
-
<label title="<?php echo
|
39 |
<input type="checkbox" name="<?php echo $input_name; ?>[]" id="<?php echo $input_name . "-" . $id; ?>" value="<?php echo $id; ?>" <?php echo ( in_array($id, $values) ? 'checked="checked"' : '' ) ?> <?php echo ( $this->disabled ? 'disabled' : ''); ?> />
|
40 |
-
<span class='
|
41 |
</label>
|
|
|
42 |
<?php endforeach; ?>
|
43 |
<?php $this->display_disabled(); ?>
|
44 |
</fieldset>
|
@@ -48,9 +49,4 @@ class sapAdminPageSettingCheckbox_2_5_0 extends sapAdminPageSetting_2_5_0 {
|
|
48 |
|
49 |
}
|
50 |
|
51 |
-
public function sanitize_callback_wrapper( $values ) {
|
52 |
-
|
53 |
-
return is_array( $values ) ? array_map( $this->sanitize_callback, $values ) : array();
|
54 |
-
}
|
55 |
-
|
56 |
}
|
19 |
* @package Simple Admin Pages
|
20 |
*/
|
21 |
|
22 |
+
class sapAdminPageSettingCheckbox_2_2_0 extends sapAdminPageSetting_2_2_0 {
|
23 |
|
24 |
//public $sanitize_callback = 'sanitize_text_field';
|
25 |
|
30 |
public function display_setting() {
|
31 |
|
32 |
$input_name = $this->get_input_name();
|
33 |
+
$values = (is_array($this->value) ? $this->value : array());
|
34 |
|
35 |
?>
|
36 |
+
<fieldset>
|
37 |
+
<?php foreach ( $this->options as $id => $title ) : ?>
|
38 |
+
<label title="<?php echo $title; ?>" class="rtb-admin-input-container">
|
39 |
<input type="checkbox" name="<?php echo $input_name; ?>[]" id="<?php echo $input_name . "-" . $id; ?>" value="<?php echo $id; ?>" <?php echo ( in_array($id, $values) ? 'checked="checked"' : '' ) ?> <?php echo ( $this->disabled ? 'disabled' : ''); ?> />
|
40 |
+
<span class='rtb-admin-checkbox'></span> <span><?php echo $title; ?></span>
|
41 |
</label>
|
42 |
+
<br />
|
43 |
<?php endforeach; ?>
|
44 |
<?php $this->display_disabled(); ?>
|
45 |
</fieldset>
|
49 |
|
50 |
}
|
51 |
|
|
|
|
|
|
|
|
|
|
|
52 |
}
|
lib/simple-admin-pages/classes/AdminPageSetting.ColorPicker.class.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
* @package Simple Admin Pages
|
8 |
*/
|
9 |
|
10 |
-
class
|
11 |
|
12 |
public $sanitize_callback = 'sanitize_text_field';
|
13 |
|
@@ -24,8 +24,8 @@ class sapAdminPageSettingColorPicker_2_5_0 extends sapAdminPageSetting_2_5_0 {
|
|
24 |
public function display_setting() {
|
25 |
?>
|
26 |
|
27 |
-
<fieldset
|
28 |
-
<input class="
|
29 |
|
30 |
<?php $this->display_disabled(); ?>
|
31 |
</fieldset>
|
7 |
* @package Simple Admin Pages
|
8 |
*/
|
9 |
|
10 |
+
class sapAdminPageSettingColorPicker_2_2_0 extends sapAdminPageSetting_2_2_0 {
|
11 |
|
12 |
public $sanitize_callback = 'sanitize_text_field';
|
13 |
|
24 |
public function display_setting() {
|
25 |
?>
|
26 |
|
27 |
+
<fieldset>
|
28 |
+
<input class="rtb-spectrum" name="<?php echo $this->get_input_name(); ?>" type="text" id="<?php echo $this->get_input_name(); ?>" value="<?php echo $this->value; ?>"<?php echo !empty( $this->placeholder ) ? ' placeholder="' . esc_attr( $this->placeholder ) . '"' : ''; ?> class="regular-text" <?php echo ( $this->disabled ? 'disabled' : ''); ?> />
|
29 |
|
30 |
<?php $this->display_disabled(); ?>
|
31 |
</fieldset>
|
lib/simple-admin-pages/classes/AdminPageSetting.Count.class.php
CHANGED
@@ -24,7 +24,7 @@
|
|
24 |
* @package Simple Admin Pages
|
25 |
*/
|
26 |
|
27 |
-
class
|
28 |
|
29 |
public $sanitize_callback = 'sanitize_text_field';
|
30 |
|
@@ -36,7 +36,7 @@ class sapAdminPageSettingCount_2_5_0 extends sapAdminPageSetting_2_5_0 {
|
|
36 |
'sap-count' => array(
|
37 |
'path' => 'js/count.js',
|
38 |
'dependencies' => array( 'jquery' ),
|
39 |
-
'version' =>
|
40 |
'footer' => true,
|
41 |
),
|
42 |
);
|
@@ -67,7 +67,7 @@ class sapAdminPageSettingCount_2_5_0 extends sapAdminPageSetting_2_5_0 {
|
|
67 |
|
68 |
$this->value = $this->value ? $this->value : $this->default;
|
69 |
|
70 |
-
$count =
|
71 |
$unit = substr( $this->value, strpos( $this->value, '_' ) + 1 );
|
72 |
|
73 |
?>
|
24 |
* @package Simple Admin Pages
|
25 |
*/
|
26 |
|
27 |
+
class sapAdminPageSettingCount_2_2_0 extends sapAdminPageSetting_2_2_0 {
|
28 |
|
29 |
public $sanitize_callback = 'sanitize_text_field';
|
30 |
|
36 |
'sap-count' => array(
|
37 |
'path' => 'js/count.js',
|
38 |
'dependencies' => array( 'jquery' ),
|
39 |
+
'version' => '2.2.0',
|
40 |
'footer' => true,
|
41 |
),
|
42 |
);
|
67 |
|
68 |
$this->value = $this->value ? $this->value : $this->default;
|
69 |
|
70 |
+
$count = substr( $this->value, 0, strpos( $this->value, '_' ) );
|
71 |
$unit = substr( $this->value, strpos( $this->value, '_' ) + 1 );
|
72 |
|
73 |
?>
|
lib/simple-admin-pages/classes/AdminPageSetting.Editor.class.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
* @package Simple Admin Pages
|
8 |
*/
|
9 |
|
10 |
-
class
|
11 |
|
12 |
public $sanitize_callback = 'wp_kses_post';
|
13 |
|
7 |
* @package Simple Admin Pages
|
8 |
*/
|
9 |
|
10 |
+
class sapAdminPageSettingEditor_2_2_0 extends sapAdminPageSetting_2_2_0 {
|
11 |
|
12 |
public $sanitize_callback = 'wp_kses_post';
|
13 |
|
lib/simple-admin-pages/classes/AdminPageSetting.FileUpload.class.php
DELETED
@@ -1,71 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Register, display and save an option for uploading an image/file.
|
5 |
-
*
|
6 |
-
* This setting accepts the following arguments in its constructor function.
|
7 |
-
*
|
8 |
-
* $args = array(
|
9 |
-
* 'id' => 'setting_id', // Unique id
|
10 |
-
* 'title' => 'My Setting', // Title or label for the setting
|
11 |
-
* 'description' => 'Description', // Help text description
|
12 |
-
* );
|
13 |
-
*
|
14 |
-
* @since 2.5
|
15 |
-
* @package Simple Admin Pages
|
16 |
-
*/
|
17 |
-
|
18 |
-
class sapAdminPageSettingFileUpload_2_5_0 extends sapAdminPageSetting_2_5_0 {
|
19 |
-
|
20 |
-
public $sanitize_callback = 'esc_url_raw';
|
21 |
-
|
22 |
-
/**
|
23 |
-
* Add in the JS requried to allow file uploading
|
24 |
-
* @since 2.5
|
25 |
-
*/
|
26 |
-
public $scripts = array(
|
27 |
-
'sap-file-upload' => array(
|
28 |
-
'path' => 'js/file_upload.js',
|
29 |
-
'dependencies' => array( 'jquery' ),
|
30 |
-
'version' => SAP_VERSION,
|
31 |
-
'footer' => true,
|
32 |
-
),
|
33 |
-
);
|
34 |
-
|
35 |
-
/**
|
36 |
-
* Display this setting
|
37 |
-
* @since 2.5
|
38 |
-
*/
|
39 |
-
public function display_setting() {
|
40 |
-
|
41 |
-
?>
|
42 |
-
|
43 |
-
<span class="sap-file-upload-preview">
|
44 |
-
|
45 |
-
<span class="sap-file-upload-preview-label">
|
46 |
-
<?php _e( 'Current image:', 'simple-admin-pages' ); ?>
|
47 |
-
</span>
|
48 |
-
|
49 |
-
<span class="sap-file-upload-preview-value">
|
50 |
-
<?php echo $this->value; ?>
|
51 |
-
</span>
|
52 |
-
|
53 |
-
</span>
|
54 |
-
|
55 |
-
<?php echo ( $this->value != '' ? '<br /><br />' : '' ); ?>
|
56 |
-
|
57 |
-
<input name="<?php echo $this->get_input_name(); ?>" type="hidden" id="<?php echo $this->get_input_name(); ?>" class="file-upload" value="<?php echo $this->value; ?>" />
|
58 |
-
|
59 |
-
<input class="button sap-file-upload-button" type="button" value="<?php _e( 'Upload Image', 'simple-admin-pages' ); ?>" />
|
60 |
-
|
61 |
-
<br /><br />
|
62 |
-
|
63 |
-
<?php $this->display_disabled(); ?>
|
64 |
-
|
65 |
-
<?php
|
66 |
-
|
67 |
-
$this->display_description();
|
68 |
-
|
69 |
-
}
|
70 |
-
|
71 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/simple-admin-pages/classes/AdminPageSetting.HTML.class.php
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
* @package Simple Admin Pages
|
15 |
*/
|
16 |
|
17 |
-
class
|
18 |
|
19 |
public $sanitize_callback = 'sanitize_text_field';
|
20 |
|
14 |
* @package Simple Admin Pages
|
15 |
*/
|
16 |
|
17 |
+
class sapAdminPageSettingHTML_2_2_0 extends sapAdminPageSetting_2_2_0 {
|
18 |
|
19 |
public $sanitize_callback = 'sanitize_text_field';
|
20 |
|
lib/simple-admin-pages/classes/AdminPageSetting.Image.class.php
DELETED
@@ -1,62 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Register, display and save an image field setting in the admin menu
|
5 |
-
*
|
6 |
-
* @since 1.0
|
7 |
-
* @package Simple Admin Pages
|
8 |
-
*/
|
9 |
-
|
10 |
-
class sapAdminPageSettingImage_2_5_0 extends sapAdminPageSetting_2_5_0 {
|
11 |
-
|
12 |
-
public $sanitize_callback = 'absint';
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Scripts that must be loaded for this component
|
16 |
-
* @since 2.1.0
|
17 |
-
*/
|
18 |
-
public $scripts = array(
|
19 |
-
'sap-image' => array(
|
20 |
-
'path' => 'js/image.js',
|
21 |
-
'dependencies' => array( 'jquery' ),
|
22 |
-
'version' => SAP_VERSION,
|
23 |
-
'footer' => true,
|
24 |
-
),
|
25 |
-
);
|
26 |
-
|
27 |
-
/**
|
28 |
-
* Translateable strings required for this component
|
29 |
-
* @since 2.1.0
|
30 |
-
*/
|
31 |
-
public $strings = array(
|
32 |
-
'add_image' => null, // __( 'Add Image', 'textdomain' ),
|
33 |
-
'change_image' => null, // __( 'Change Image', 'textdomain' ),
|
34 |
-
'remove_image' => null, // __( 'Remove Image', 'textdomain' ),
|
35 |
-
);
|
36 |
-
|
37 |
-
/**
|
38 |
-
* Display this setting
|
39 |
-
* @since 1.0
|
40 |
-
*/
|
41 |
-
public function display_setting() {
|
42 |
-
$image_url = $this->value ? wp_get_attachment_url( $this->value ) : '';
|
43 |
-
?>
|
44 |
-
|
45 |
-
<div class="sap-image-wrapper <?php echo $this->value ? 'sap-image-wrapper-has-image' : 'sap-image-wrapper-no-image'; ?>" data-id="sap-<?php echo $this->id; ?>">
|
46 |
-
<input name="<?php echo $this->get_input_name(); ?>" type="hidden" id="sap-<?php echo $this->id; ?>" value="<?php echo $this->value; ?>">
|
47 |
-
<img src="<?php echo esc_attr( $image_url ); ?>">
|
48 |
-
<button class="button sap-image-btn-add" id="sap-<?php echo $this->id; ?>-add"><?php echo esc_html( $this->strings['add_image'] ); ?></button>
|
49 |
-
<button class="button sap-image-btn-change" id="sap-<?php echo $this->id; ?>-change"><?php echo esc_html( $this->strings['change_image'] ); ?></button>
|
50 |
-
<button class="button sap-image-btn-remove" id="sap-<?php echo $this->id; ?>-remove"><?php echo esc_html( $this->strings['remove_image'] ); ?></button>
|
51 |
-
</div>
|
52 |
-
|
53 |
-
<?php
|
54 |
-
|
55 |
-
// global $wp_scripts;
|
56 |
-
// print_r( $wp_scripts );
|
57 |
-
|
58 |
-
$this->display_description();
|
59 |
-
|
60 |
-
}
|
61 |
-
|
62 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/simple-admin-pages/classes/AdminPageSetting.InfiniteTable.class.php
CHANGED
@@ -24,7 +24,7 @@
|
|
24 |
* @package Simple Admin Pages
|
25 |
*/
|
26 |
|
27 |
-
class
|
28 |
|
29 |
public $sanitize_callback = 'sanitize_text_field';
|
30 |
|
@@ -36,7 +36,7 @@ class sapAdminPageSettingInfiniteTable_2_5_0 extends sapAdminPageSetting_2_5_0 {
|
|
36 |
'sap-infinite-table' => array(
|
37 |
'path' => 'js/infinite_table.js',
|
38 |
'dependencies' => array( 'jquery' ),
|
39 |
-
'version' =>
|
40 |
'footer' => true,
|
41 |
),
|
42 |
);
|
@@ -49,8 +49,8 @@ class sapAdminPageSettingInfiniteTable_2_5_0 extends sapAdminPageSetting_2_5_0 {
|
|
49 |
'sap-infinite-table' => array(
|
50 |
'path' => 'css/infinite_table.css',
|
51 |
'dependencies' => array( ),
|
52 |
-
'version' =>
|
53 |
-
'media'
|
54 |
),
|
55 |
);
|
56 |
|
@@ -59,6 +59,8 @@ class sapAdminPageSettingInfiniteTable_2_5_0 extends sapAdminPageSetting_2_5_0 {
|
|
59 |
* @since 2.0
|
60 |
*/
|
61 |
public function display_setting() {
|
|
|
|
|
62 |
|
63 |
$input_name = $this->get_input_name();
|
64 |
$values = json_decode( html_entity_decode( $this->value ) );
|
@@ -76,8 +78,8 @@ class sapAdminPageSettingInfiniteTable_2_5_0 extends sapAdminPageSetting_2_5_0 {
|
|
76 |
|
77 |
<fieldset>
|
78 |
<div class='sap-infinite-table <?php echo ( $this->disabled ? 'disabled' : ''); ?>' data-fieldids='<?php echo $fields; ?>'>
|
79 |
-
<input type='hidden'
|
80 |
-
<table>
|
81 |
<thead>
|
82 |
<tr>
|
83 |
<?php foreach ($this->fields as $field) { ?>
|
@@ -88,18 +90,23 @@ class sapAdminPageSettingInfiniteTable_2_5_0 extends sapAdminPageSetting_2_5_0 {
|
|
88 |
</thead>
|
89 |
<tbody>
|
90 |
<?php foreach ($values as $row) { ?>
|
91 |
-
<tr class='sap-
|
92 |
<?php foreach ($this->fields as $field_id => $field) { ?>
|
93 |
<td>
|
|
|
|
|
|
|
94 |
<?php if ($field['type'] == 'text') : ?>
|
95 |
-
<input type='text'
|
|
|
|
|
|
|
96 |
<?php endif; ?>
|
97 |
-
<?php if ($field['type'] == '
|
98 |
-
<
|
99 |
-
<input type='hidden' data-name='<?php echo $field_id; ?>' value='<?php echo $row->$field_id; ?>' />
|
100 |
<?php endif; ?>
|
101 |
<?php if ($field['type'] == 'select') : ?>
|
102 |
-
<select
|
103 |
<?php foreach ($field['options'] as $option_value => $option_name) { ?>
|
104 |
<option value='<?php echo $option_value; ?>' <?php echo ($row->$field_id == $option_value ? 'selected="selected"' : ''); ?>><?php echo $option_name; ?></option>
|
105 |
<?php }?>
|
@@ -107,23 +114,29 @@ class sapAdminPageSettingInfiniteTable_2_5_0 extends sapAdminPageSetting_2_5_0 {
|
|
107 |
<?php endif; ?>
|
108 |
</td>
|
109 |
<?php } ?>
|
110 |
-
<td class='sap-infinite-table-row-delete'><?php
|
111 |
</tr>
|
|
|
112 |
<?php } ?>
|
113 |
</tbody>
|
114 |
<tfoot>
|
115 |
-
<tr class='sap-
|
116 |
<?php foreach ($this->fields as $field_id => $field) { ?>
|
117 |
<td>
|
|
|
|
|
|
|
118 |
<?php if ($field['type'] == 'text') : ?>
|
119 |
-
<input type='text'
|
|
|
|
|
|
|
120 |
<?php endif; ?>
|
121 |
-
<?php if ($field['type'] == '
|
122 |
-
<
|
123 |
-
<input type='hidden' data-name='<?php echo $field_id; ?>' value='' />
|
124 |
<?php endif; ?>
|
125 |
<?php if ($field['type'] == 'select') : ?>
|
126 |
-
<select
|
127 |
<?php foreach ($field['options'] as $option_value => $option_name) { ?>
|
128 |
<option value='<?php echo $option_value; ?>'><?php echo $option_name; ?></option>
|
129 |
<?php }?>
|
@@ -131,18 +144,18 @@ class sapAdminPageSettingInfiniteTable_2_5_0 extends sapAdminPageSetting_2_5_0 {
|
|
131 |
<?php endif; ?>
|
132 |
</td>
|
133 |
<?php } ?>
|
134 |
-
<td class='sap-infinite-table-row-delete'><?php
|
135 |
</tr>
|
136 |
<tr class='sap-infinite-table-add-row'>
|
137 |
-
<td colspan="
|
138 |
-
<a class="
|
139 |
</td>
|
140 |
</tr>
|
141 |
</tfoot>
|
142 |
</table>
|
143 |
</div>
|
144 |
|
145 |
-
<?php $this->display_disabled(); ?>
|
146 |
</fieldset>
|
147 |
|
148 |
<?php
|
24 |
* @package Simple Admin Pages
|
25 |
*/
|
26 |
|
27 |
+
class sapAdminPageSettingInfiniteTable_2_2_0 extends sapAdminPageSetting_2_2_0 {
|
28 |
|
29 |
public $sanitize_callback = 'sanitize_text_field';
|
30 |
|
36 |
'sap-infinite-table' => array(
|
37 |
'path' => 'js/infinite_table.js',
|
38 |
'dependencies' => array( 'jquery' ),
|
39 |
+
'version' => '2.0.a.5',
|
40 |
'footer' => true,
|
41 |
),
|
42 |
);
|
49 |
'sap-infinite-table' => array(
|
50 |
'path' => 'css/infinite_table.css',
|
51 |
'dependencies' => array( ),
|
52 |
+
'version' => '2.0.a.5',
|
53 |
+
'media' => 'all',
|
54 |
),
|
55 |
);
|
56 |
|
59 |
* @since 2.0
|
60 |
*/
|
61 |
public function display_setting() {
|
62 |
+
|
63 |
+
$row_count = 0;
|
64 |
|
65 |
$input_name = $this->get_input_name();
|
66 |
$values = json_decode( html_entity_decode( $this->value ) );
|
78 |
|
79 |
<fieldset>
|
80 |
<div class='sap-infinite-table <?php echo ( $this->disabled ? 'disabled' : ''); ?>' data-fieldids='<?php echo $fields; ?>'>
|
81 |
+
<input type='hidden' name='<?php echo $input_name; ?>' value='<?php echo $this->value; ?>' />
|
82 |
+
<table id='sap-table-<?php echo $this->id; ?>'>
|
83 |
<thead>
|
84 |
<tr>
|
85 |
<?php foreach ($this->fields as $field) { ?>
|
90 |
</thead>
|
91 |
<tbody>
|
92 |
<?php foreach ($values as $row) { ?>
|
93 |
+
<tr class='sap-inifinite-table-row' data-rowid='<?php echo $row_count; ?>'>
|
94 |
<?php foreach ($this->fields as $field_id => $field) { ?>
|
95 |
<td>
|
96 |
+
<?php if ($field['type'] == 'id') : ?>
|
97 |
+
<input type='hidden' name='<?php echo $field_id . "_" . $row_count; ?>' class='sap-infinite-table-<?php echo $field_id; ?> sap-infinite-table-id' value='<?php echo $row->$field_id; ?>' /> <?php echo $row->$field_id; ?>
|
98 |
+
<?php endif; ?>
|
99 |
<?php if ($field['type'] == 'text') : ?>
|
100 |
+
<input type='text' name='<?php echo $field_id . "_" . $row_count; ?>' class='sap-infinite-table-<?php echo $field_id; ?>' value='<?php echo $row->$field_id; ?>' />
|
101 |
+
<?php endif; ?>
|
102 |
+
<?php if ($field['type'] == 'number') : ?>
|
103 |
+
<input type='number' name='<?php echo $field_id . "_" . $row_count; ?>' class='sap-infinite-table-<?php echo $field_id; ?>' value='<?php echo $row->$field_id; ?>' />
|
104 |
<?php endif; ?>
|
105 |
+
<?php if ($field['type'] == 'textarea') : ?>
|
106 |
+
<textarea name='<?php echo $field_id . "_" . $row_count; ?>' class='sap-infinite-table-<?php echo $field_id; ?>'><?php echo $row->$field_id; ?></textarea>
|
|
|
107 |
<?php endif; ?>
|
108 |
<?php if ($field['type'] == 'select') : ?>
|
109 |
+
<select name='<?php echo $field_id . "_" . $row_count; ?>' class='sap-infinite-table-<?php echo $field_id; ?>'>
|
110 |
<?php foreach ($field['options'] as $option_value => $option_name) { ?>
|
111 |
<option value='<?php echo $option_value; ?>' <?php echo ($row->$field_id == $option_value ? 'selected="selected"' : ''); ?>><?php echo $option_name; ?></option>
|
112 |
<?php }?>
|
114 |
<?php endif; ?>
|
115 |
</td>
|
116 |
<?php } ?>
|
117 |
+
<td class='sap-infinite-table-row-delete'><?php _e('Delete'); ?></td>
|
118 |
</tr>
|
119 |
+
<?php $row_count++; ?>
|
120 |
<?php } ?>
|
121 |
</tbody>
|
122 |
<tfoot>
|
123 |
+
<tr class='sap-inifite-table-row-template sap-hidden'>
|
124 |
<?php foreach ($this->fields as $field_id => $field) { ?>
|
125 |
<td>
|
126 |
+
<?php if ($field['type'] == 'id') : ?>
|
127 |
+
<input type='hidden' name='<?php echo $field_id; ?>' class='sap-infinite-table-<?php echo $field_id; ?> sap-infinite-table-id' value='' /><span class='sap-infinite-table-id-html'></span>
|
128 |
+
<?php endif; ?>
|
129 |
<?php if ($field['type'] == 'text') : ?>
|
130 |
+
<input type='text' name='<?php echo $field_id; ?>' class='sap-infinite-table-<?php echo $field_id; ?>' value='' />
|
131 |
+
<?php endif; ?>
|
132 |
+
<?php if ($field['type'] == 'number') : ?>
|
133 |
+
<input type='number' name='<?php echo $field_id; ?>' class='sap-infinite-table-<?php echo $field_id; ?>' value='' />
|
134 |
<?php endif; ?>
|
135 |
+
<?php if ($field['type'] == 'textarea') : ?>
|
136 |
+
<textarea name='<?php echo $field_id; ?>' class='sap-infinite-table-<?php echo $field_id; ?>'></textarea>
|
|
|
137 |
<?php endif; ?>
|
138 |
<?php if ($field['type'] == 'select') : ?>
|
139 |
+
<select name='<?php echo $field_id; ?>' class='sap-infinite-table-<?php echo $field_id; ?>'>
|
140 |
<?php foreach ($field['options'] as $option_value => $option_name) { ?>
|
141 |
<option value='<?php echo $option_value; ?>'><?php echo $option_name; ?></option>
|
142 |
<?php }?>
|
144 |
<?php endif; ?>
|
145 |
</td>
|
146 |
<?php } ?>
|
147 |
+
<td class='sap-infinite-table-row-delete'><?php _e('Delete'); ?></td>
|
148 |
</tr>
|
149 |
<tr class='sap-infinite-table-add-row'>
|
150 |
+
<td colspan="<?php echo sizeOf( $this->fields ); ?>">
|
151 |
+
<a class="rtb-new-admin-add-button">+ <?php echo $this->add_label; ?></a>
|
152 |
</td>
|
153 |
</tr>
|
154 |
</tfoot>
|
155 |
</table>
|
156 |
</div>
|
157 |
|
158 |
+
<?php $this->display_disabled(); ?>
|
159 |
</fieldset>
|
160 |
|
161 |
<?php
|
lib/simple-admin-pages/classes/AdminPageSetting.McApiKey.class.php
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
*
|
15 |
*/
|
16 |
|
17 |
-
class
|
18 |
|
19 |
/**
|
20 |
* Scripts and styles to load for this component
|
@@ -163,7 +163,7 @@ class mcfrtbAdminPageSettingMcApiKey_2_5_0 {
|
|
163 |
* Sanitize the array of text inputs for this setting
|
164 |
*/
|
165 |
public function sanitize_callback_wrapper( $values ) {
|
166 |
-
|
167 |
|
168 |
$output = array(
|
169 |
'api_key' => '',
|
@@ -178,12 +178,10 @@ class mcfrtbAdminPageSettingMcApiKey_2_5_0 {
|
|
178 |
// Sanitize the API key
|
179 |
$output['api_key'] = sanitize_text_field( $values['api_key'] );
|
180 |
|
181 |
-
|
182 |
|
183 |
// Check for a valid API key
|
184 |
-
|
185 |
-
|
186 |
-
$output['status'] = strpos( $output['api_key'], '-' ) === false ? false : true;
|
187 |
|
188 |
return $output;
|
189 |
}
|
14 |
*
|
15 |
*/
|
16 |
|
17 |
+
class mcfrtbAdminPageSettingMcApiKey_2_2_0 {
|
18 |
|
19 |
/**
|
20 |
* Scripts and styles to load for this component
|
163 |
* Sanitize the array of text inputs for this setting
|
164 |
*/
|
165 |
public function sanitize_callback_wrapper( $values ) {
|
166 |
+
global $rtb_controller;
|
167 |
|
168 |
$output = array(
|
169 |
'api_key' => '',
|
178 |
// Sanitize the API key
|
179 |
$output['api_key'] = sanitize_text_field( $values['api_key'] );
|
180 |
|
181 |
+
$rtb_controller->mailchimp->load_api( $output['api_key'] );
|
182 |
|
183 |
// Check for a valid API key
|
184 |
+
$output['status'] = $rtb_controller->mailchimp->is_valid_api_key();
|
|
|
|
|
185 |
|
186 |
return $output;
|
187 |
}
|
lib/simple-admin-pages/classes/AdminPageSetting.McListMerge.class.php
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
*
|
15 |
*/
|
16 |
|
17 |
-
class
|
18 |
|
19 |
/**
|
20 |
* Scripts and styles to load for this component
|
@@ -153,9 +153,9 @@ class mcfrtbAdminPageSettingMcListMerge_2_5_0 {
|
|
153 |
|
154 |
?>
|
155 |
|
156 |
-
<span class="
|
157 |
|
158 |
-
<span class="
|
159 |
<span class="spinner"></span>
|
160 |
<span><?php echo $this->string_loading; ?></span>
|
161 |
</span>
|
14 |
*
|
15 |
*/
|
16 |
|
17 |
+
class mcfrtbAdminPageSettingMcListMerge_2_2_0 {
|
18 |
|
19 |
/**
|
20 |
* Scripts and styles to load for this component
|
153 |
|
154 |
?>
|
155 |
|
156 |
+
<span class="mcfrtb-list-select"></span>
|
157 |
|
158 |
+
<span class="mcfrtb_loading">
|
159 |
<span class="spinner"></span>
|
160 |
<span><?php echo $this->string_loading; ?></span>
|
161 |
</span>
|
lib/simple-admin-pages/classes/AdminPageSetting.Number.class.php
DELETED
@@ -1,37 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Register, display and save a text field setting in the admin menu
|
5 |
-
*
|
6 |
-
* @since 1.0
|
7 |
-
* @package Simple Admin Pages
|
8 |
-
*/
|
9 |
-
|
10 |
-
class sapAdminPageSettingNumber_2_5_0 extends sapAdminPageSetting_2_5_0 {
|
11 |
-
|
12 |
-
public $sanitize_callback = 'sanitize_text_field';
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Placeholder string for the input field
|
16 |
-
* @since 2.0
|
17 |
-
*/
|
18 |
-
public $placeholder = '';
|
19 |
-
|
20 |
-
/**
|
21 |
-
* Display this setting
|
22 |
-
* @since 1.0
|
23 |
-
*/
|
24 |
-
public function display_setting() {
|
25 |
-
?>
|
26 |
-
|
27 |
-
<input name="<?php echo $this->get_input_name(); ?>" type="number" id="<?php echo $this->get_input_name(); ?>" value="<?php echo $this->value; ?>"<?php echo !empty( $this->placeholder ) ? ' placeholder="' . esc_attr( $this->placeholder ) . '"' : ''; ?> class="regular-text" <?php echo ( $this->disabled ? 'disabled' : ''); ?> />
|
28 |
-
|
29 |
-
<?php $this->display_disabled(); ?>
|
30 |
-
|
31 |
-
<?php
|
32 |
-
|
33 |
-
$this->display_description();
|
34 |
-
|
35 |
-
}
|
36 |
-
|
37 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/simple-admin-pages/classes/AdminPageSetting.OpeningHours.class.php
CHANGED
@@ -25,7 +25,7 @@
|
|
25 |
* @package Simple Admin Pages
|
26 |
*/
|
27 |
|
28 |
-
class
|
29 |
|
30 |
public $sanitize_callback = 'sanitize_text_field';
|
31 |
|
@@ -37,7 +37,7 @@ class sapAdminPageSettingOpeningHours_2_5_0 extends sapAdminPageSetting_2_5_0 {
|
|
37 |
'sap-opening-hours' => array(
|
38 |
'path' => 'js/opening-hours.js',
|
39 |
'dependencies' => array( 'jquery' ),
|
40 |
-
'version' =>
|
41 |
'footer' => true,
|
42 |
),
|
43 |
);
|
25 |
* @package Simple Admin Pages
|
26 |
*/
|
27 |
|
28 |
+
class sapAdminPageSettingOpeningHours_2_2_0 extends sapAdminPageSetting_2_2_0 {
|
29 |
|
30 |
public $sanitize_callback = 'sanitize_text_field';
|
31 |
|
37 |
'sap-opening-hours' => array(
|
38 |
'path' => 'js/opening-hours.js',
|
39 |
'dependencies' => array( 'jquery' ),
|
40 |
+
'version' => '2.0.a.5',
|
41 |
'footer' => true,
|
42 |
),
|
43 |
);
|
lib/simple-admin-pages/classes/AdminPageSetting.Ordering.class.php
DELETED
@@ -1,94 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Register and display a table for saving the order of a list of items.
|
5 |
-
*
|
6 |
-
* This setting accepts the following arguments in its constructor function.
|
7 |
-
*
|
8 |
-
* $args = array(
|
9 |
-
* 'id' => 'setting_id', // Unique id
|
10 |
-
* 'title' => 'My Setting', // Title or label for the setting
|
11 |
-
* 'description' => 'Description', // Help text description
|
12 |
-
* 'items' => array(
|
13 |
-
* 'item' => 'Label' // The items to be re-ordered
|
14 |
-
* )
|
15 |
-
* );
|
16 |
-
*
|
17 |
-
* @since 2.5
|
18 |
-
* @package Simple Admin Pages
|
19 |
-
*/
|
20 |
-
|
21 |
-
class sapAdminPageSettingOrdering_2_5_0 extends sapAdminPageSetting_2_5_0 {
|
22 |
-
|
23 |
-
public $sanitize_callback = 'sanitize_text_field';
|
24 |
-
|
25 |
-
/**
|
26 |
-
* Add in the JS requried for the values to be stored
|
27 |
-
* @since 2.5
|
28 |
-
*/
|
29 |
-
public $scripts = array(
|
30 |
-
'sap-ordering-table' => array(
|
31 |
-
'path' => 'js/ordering.js',
|
32 |
-
'dependencies' => array( 'jquery' ),
|
33 |
-
'version' => SAP_VERSION,
|
34 |
-
'footer' => true,
|
35 |
-
),
|
36 |
-
);
|
37 |
-
|
38 |
-
/**
|
39 |
-
* Add in the CSS requried for rows to be displayed correctly
|
40 |
-
* @since 2.5
|
41 |
-
*/
|
42 |
-
public $styles = array(
|
43 |
-
'sap-ordering-table' => array(
|
44 |
-
'path' => 'css/ordering.css',
|
45 |
-
'dependencies' => array( ),
|
46 |
-
'version' => SAP_VERSION,
|
47 |
-
'media' => 'all',
|
48 |
-
),
|
49 |
-
);
|
50 |
-
|
51 |
-
/**
|
52 |
-
* Display this setting
|
53 |
-
* @since 2.0
|
54 |
-
*/
|
55 |
-
public function display_setting() {
|
56 |
-
|
57 |
-
$input_name = $this->get_input_name();
|
58 |
-
$values = is_array( $this->value ) ? $this->value : json_decode( html_entity_decode( $this->value ), true );
|
59 |
-
|
60 |
-
if ( ! is_array( $values ) )
|
61 |
-
$values = array();
|
62 |
-
|
63 |
-
if ( empty( $values ) and is_string( $this->items ) )
|
64 |
-
$values = array_merge( $values, json_decode( $this->items, true ) );
|
65 |
-
|
66 |
-
?>
|
67 |
-
|
68 |
-
<fieldset>
|
69 |
-
<div class='sap-ordering-table <?php echo ( $this->disabled ? 'disabled' : ''); ?>'>
|
70 |
-
<input type='hidden' id="sap-ordering-table-main-input" name='<?php echo $input_name; ?>' value='<?php echo esc_attr( json_encode( $values ) ); ?>' />
|
71 |
-
<table>
|
72 |
-
<tbody>
|
73 |
-
<?php foreach ( $values as $value => $label ) { ?>
|
74 |
-
<tr class='sap-ordering-table-row'>
|
75 |
-
<td>
|
76 |
-
<input type='hidden' value='<?php echo esc_attr( $value ); ?>' />
|
77 |
-
<span><?php echo esc_html( $label ); ?></span>
|
78 |
-
</td>
|
79 |
-
</tr>
|
80 |
-
<?php } ?>
|
81 |
-
</tbody>
|
82 |
-
</table>
|
83 |
-
</div>
|
84 |
-
|
85 |
-
<?php $this->display_disabled(); ?>
|
86 |
-
</fieldset>
|
87 |
-
|
88 |
-
<?php
|
89 |
-
|
90 |
-
$this->display_description();
|
91 |
-
|
92 |
-
}
|
93 |
-
|
94 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/simple-admin-pages/classes/AdminPageSetting.Radio.class.php
CHANGED
@@ -19,7 +19,7 @@
|
|
19 |
* @package Simple Admin Pages
|
20 |
*/
|
21 |
|
22 |
-
class
|
23 |
|
24 |
public $sanitize_callback = 'sanitize_text_field';
|
25 |
|
@@ -30,16 +30,15 @@ class sapAdminPageSettingRadio_2_5_0 extends sapAdminPageSetting_2_5_0 {
|
|
30 |
public function display_setting() {
|
31 |
|
32 |
$input_name = $this->get_input_name();
|
33 |
-
|
34 |
-
if ( empty( $this->value ) ) { $this->value = $this->get_default_setting(); }
|
35 |
|
36 |
?>
|
37 |
-
<fieldset
|
38 |
<?php foreach ( $this->options as $id => $title ) : ?>
|
39 |
-
<label title="<?php echo
|
40 |
<input type="radio" name="<?php echo $input_name; ?>" id="<?php echo $input_name . "-" . $id; ?>" value="<?php echo $id; ?>" <?php echo ( $id == $this->value ? 'checked="checked"' : '' ) ?> <?php echo ( $this->disabled ? 'disabled' : ''); ?> />
|
41 |
-
<span class='
|
42 |
</label>
|
|
|
43 |
<?php endforeach; ?>
|
44 |
|
45 |
<?php $this->display_disabled(); ?>
|
19 |
* @package Simple Admin Pages
|
20 |
*/
|
21 |
|
22 |
+
class sapAdminPageSettingRadio_2_2_0 extends sapAdminPageSetting_2_2_0 {
|
23 |
|
24 |
public $sanitize_callback = 'sanitize_text_field';
|
25 |
|
30 |
public function display_setting() {
|
31 |
|
32 |
$input_name = $this->get_input_name();
|
|
|
|
|
33 |
|
34 |
?>
|
35 |
+
<fieldset>
|
36 |
<?php foreach ( $this->options as $id => $title ) : ?>
|
37 |
+
<label title="<?php echo $title; ?>" class="rtb-admin-input-container">
|
38 |
<input type="radio" name="<?php echo $input_name; ?>" id="<?php echo $input_name . "-" . $id; ?>" value="<?php echo $id; ?>" <?php echo ( $id == $this->value ? 'checked="checked"' : '' ) ?> <?php echo ( $this->disabled ? 'disabled' : ''); ?> />
|
39 |
+
<span class='rtb-admin-radio-button'></span> <span><?php echo $title; ?></span>
|
40 |
</label>
|
41 |
+
<br />
|
42 |
<?php endforeach; ?>
|
43 |
|
44 |
<?php $this->display_disabled(); ?>
|
lib/simple-admin-pages/classes/AdminPageSetting.Scheduler.class.php
CHANGED
@@ -10,7 +10,7 @@
|
|
10 |
* @package Simple Admin Pages
|
11 |
*/
|
12 |
|
13 |
-
class
|
14 |
|
15 |
public $sanitize_callback = 'sanitize_text_field';
|
16 |
|
@@ -22,31 +22,31 @@ class sapAdminPageSettingScheduler_2_5_0 extends sapAdminPageSetting_2_5_0 {
|
|
22 |
'pickadate' => array(
|
23 |
'path' => 'lib/pickadate/picker.js',
|
24 |
'dependencies' => array( 'jquery' ),
|
25 |
-
'version' => '3.
|
26 |
'footer' => true,
|
27 |
),
|
28 |
'pickadate-date' => array(
|
29 |
'path' => 'lib/pickadate/picker.date.js',
|
30 |
'dependencies' => array( 'jquery' ),
|
31 |
-
'version' => '3.
|
32 |
'footer' => true,
|
33 |
),
|
34 |
'pickadate-time' => array(
|
35 |
'path' => 'lib/pickadate/picker.time.js',
|
36 |
'dependencies' => array( 'jquery' ),
|
37 |
-
'version' => '3.
|
38 |
'footer' => true,
|
39 |
),
|
40 |
'pickadate-legacy' => array(
|
41 |
'path' => 'lib/pickadate/legacy.js',
|
42 |
'dependencies' => array( 'jquery' ),
|
43 |
-
'version' => '3.
|
44 |
'footer' => true,
|
45 |
),
|
46 |
'sap-scheduler' => array(
|
47 |
'path' => 'js/scheduler.js',
|
48 |
'dependencies' => array( 'jquery' ),
|
49 |
-
'version' =>
|
50 |
'footer' => true,
|
51 |
),
|
52 |
// @todo there should be some way to load alternate language .js files
|
@@ -61,19 +61,19 @@ class sapAdminPageSettingScheduler_2_5_0 extends sapAdminPageSetting_2_5_0 {
|
|
61 |
'pickadate-default' => array(
|
62 |
'path' => 'lib/pickadate/themes/default.css',
|
63 |
'dependencies' => '',
|
64 |
-
'version' => '3.
|
65 |
'media' => null,
|
66 |
),
|
67 |
'pickadate-date' => array(
|
68 |
'path' => 'lib/pickadate/themes/default.date.css',
|
69 |
'dependencies' => '',
|
70 |
-
'version' => '3.
|
71 |
'media' => null,
|
72 |
),
|
73 |
'pickadate-time' => array(
|
74 |
'path' => 'lib/pickadate/themes/default.time.css',
|
75 |
'dependencies' => '',
|
76 |
-
'version' => '3.
|
77 |
'media' => null,
|
78 |
),
|
79 |
);
|
@@ -123,7 +123,7 @@ class sapAdminPageSettingScheduler_2_5_0 extends sapAdminPageSetting_2_5_0 {
|
|
123 |
'delete' => null, // _x( 'Delete rule', 'Delete a scheduling rule', 'textdomain' ),
|
124 |
'delete_schedule' => null, // __( 'Delete scheduling rule', 'textdomain' ),
|
125 |
'never' => null, // _x( 'Never', 'Brief default description of a scheduling rule when no weekdays or weeks are included in the rule', 'textdomain' ),
|
126 |
-
'weekly_always'
|
127 |
'monthly_weekdays' => null, // _x( '%s on the %s week of the month', 'Brief default description of a scheduling rule when some weekdays are included on only some weeks of the month. %s should be left alone and will be replaced by a comma-separated list of days and weeks in the following format: M, T, W on the first, second week of the month', 'textdomain' ),
|
128 |
'monthly_weeks' => null, // _x( '%s week of the month', 'Brief default description of a scheduling rule when some weeks of the month are included but all or no weekdays are selected. %s should be left alone and will be replaced by a comma-separated list of weeks in the following format: First, second week of the month', 'textdomain' ),
|
129 |
'all_day' => null, // _x( 'All day', 'Brief default description of a scheduling rule when no times are set', 'textdomain' ),
|
@@ -650,7 +650,7 @@ class sapAdminPageSettingScheduler_2_5_0 extends sapAdminPageSetting_2_5_0 {
|
|
650 |
if ( !is_array( $values ) || !count( $values ) ) {
|
651 |
return $output;
|
652 |
}
|
653 |
-
|
654 |
foreach ( $values as $i => $rule ) {
|
655 |
|
656 |
if ( !empty( $rule['weekdays'] ) ) {
|
10 |
* @package Simple Admin Pages
|
11 |
*/
|
12 |
|
13 |
+
class sapAdminPageSettingScheduler_2_2_0 extends sapAdminPageSetting_2_2_0 {
|
14 |
|
15 |
public $sanitize_callback = 'sanitize_text_field';
|
16 |
|
22 |
'pickadate' => array(
|
23 |
'path' => 'lib/pickadate/picker.js',
|
24 |
'dependencies' => array( 'jquery' ),
|
25 |
+
'version' => '3.5.5',
|
26 |
'footer' => true,
|
27 |
),
|
28 |
'pickadate-date' => array(
|
29 |
'path' => 'lib/pickadate/picker.date.js',
|
30 |
'dependencies' => array( 'jquery' ),
|
31 |
+
'version' => '3.5.5',
|
32 |
'footer' => true,
|
33 |
),
|
34 |
'pickadate-time' => array(
|
35 |
'path' => 'lib/pickadate/picker.time.js',
|
36 |
'dependencies' => array( 'jquery' ),
|
37 |
+
'version' => '3.5.5',
|
38 |
'footer' => true,
|
39 |
),
|
40 |
'pickadate-legacy' => array(
|
41 |
'path' => 'lib/pickadate/legacy.js',
|
42 |
'dependencies' => array( 'jquery' ),
|
43 |
+
'version' => '3.5.5',
|
44 |
'footer' => true,
|
45 |
),
|
46 |
'sap-scheduler' => array(
|
47 |
'path' => 'js/scheduler.js',
|
48 |
'dependencies' => array( 'jquery' ),
|
49 |
+
'version' => '2.0.a.9',
|
50 |
'footer' => true,
|
51 |
),
|
52 |
// @todo there should be some way to load alternate language .js files
|
61 |
'pickadate-default' => array(
|
62 |
'path' => 'lib/pickadate/themes/default.css',
|
63 |
'dependencies' => '',
|
64 |
+
'version' => '3.5.0',
|
65 |
'media' => null,
|
66 |
),
|
67 |
'pickadate-date' => array(
|
68 |
'path' => 'lib/pickadate/themes/default.date.css',
|
69 |
'dependencies' => '',
|
70 |
+
'version' => '3.5.0',
|
71 |
'media' => null,
|
72 |
),
|
73 |
'pickadate-time' => array(
|
74 |
'path' => 'lib/pickadate/themes/default.time.css',
|
75 |
'dependencies' => '',
|
76 |
+
'version' => '3.5.0',
|
77 |
'media' => null,
|
78 |
),
|
79 |
);
|
123 |
'delete' => null, // _x( 'Delete rule', 'Delete a scheduling rule', 'textdomain' ),
|
124 |
'delete_schedule' => null, // __( 'Delete scheduling rule', 'textdomain' ),
|
125 |
'never' => null, // _x( 'Never', 'Brief default description of a scheduling rule when no weekdays or weeks are included in the rule', 'textdomain' ),
|
126 |
+
'weekly_always' => null, // _x( 'Every day', 'Brief default description of a scheduling rule when all the weekdays/weeks are included in the rule', 'textdomain' ),
|
127 |
'monthly_weekdays' => null, // _x( '%s on the %s week of the month', 'Brief default description of a scheduling rule when some weekdays are included on only some weeks of the month. %s should be left alone and will be replaced by a comma-separated list of days and weeks in the following format: M, T, W on the first, second week of the month', 'textdomain' ),
|
128 |
'monthly_weeks' => null, // _x( '%s week of the month', 'Brief default description of a scheduling rule when some weeks of the month are included but all or no weekdays are selected. %s should be left alone and will be replaced by a comma-separated list of weeks in the following format: First, second week of the month', 'textdomain' ),
|
129 |
'all_day' => null, // _x( 'All day', 'Brief default description of a scheduling rule when no times are set', 'textdomain' ),
|
650 |
if ( !is_array( $values ) || !count( $values ) ) {
|
651 |
return $output;
|
652 |
}
|
653 |
+
|
654 |
foreach ( $values as $i => $rule ) {
|
655 |
|
656 |
if ( !empty( $rule['weekdays'] ) ) {
|
lib/simple-admin-pages/classes/AdminPageSetting.Select.class.php
CHANGED
@@ -21,7 +21,7 @@
|
|
21 |
* @package Simple Admin Pages
|
22 |
*/
|
23 |
|
24 |
-
class
|
25 |
|
26 |
public $sanitize_callback = 'sanitize_text_field';
|
27 |
|
21 |
* @package Simple Admin Pages
|
22 |
*/
|
23 |
|
24 |
+
class sapAdminPageSettingSelect_2_2_0 extends sapAdminPageSetting_2_2_0 {
|
25 |
|
26 |
public $sanitize_callback = 'sanitize_text_field';
|
27 |
|
lib/simple-admin-pages/classes/AdminPageSetting.SelectMenu.class.php
DELETED
@@ -1,57 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Register, display and save a selection with a drop-down list of any post type
|
5 |
-
*
|
6 |
-
* This setting accepts the following arguments in its constructor function.
|
7 |
-
*
|
8 |
-
* $args = array(
|
9 |
-
* 'id' => 'setting_id', // Unique id
|
10 |
-
* 'title' => 'My Setting', // Title or label for the setting
|
11 |
-
* 'description' => 'Description', // Help text description
|
12 |
-
* 'blank_option' => true, // Whether or not to show a blank option
|
13 |
-
* 'args' => array(); // Arguments to pass to WordPress's get_post() function
|
14 |
-
* );
|
15 |
-
*
|
16 |
-
* @since 1.0
|
17 |
-
* @package Simple Admin Pages
|
18 |
-
*/
|
19 |
-
|
20 |
-
class sapAdminPageSettingSelectMenu_2_5_0 extends sapAdminPageSetting_2_5_0 {
|
21 |
-
|
22 |
-
public $sanitize_callback = 'intval';
|
23 |
-
|
24 |
-
// Whether or not to display a blank option
|
25 |
-
public $blank_option = true;
|
26 |
-
|
27 |
-
/**
|
28 |
-
* An array of arguments accepted by get_posts().
|
29 |
-
* See: http://codex.wordpress.org/Template_Tags/get_posts
|
30 |
-
*/
|
31 |
-
public $args = array();
|
32 |
-
|
33 |
-
/**
|
34 |
-
* Display this setting
|
35 |
-
* @since 1.0
|
36 |
-
*/
|
37 |
-
public function display_setting() {
|
38 |
-
|
39 |
-
$menus = get_terms( 'nav_menu', array( 'hide_empty' => true ) );
|
40 |
-
?>
|
41 |
-
<select name="<?php echo $this->get_input_name(); ?>" id="<?php echo $this->get_input_name(); ?>">
|
42 |
-
|
43 |
-
<?php if ( $this->blank_option === true ) : ?>
|
44 |
-
<option></option>
|
45 |
-
<?php endif; ?>
|
46 |
-
|
47 |
-
<?php foreach($menus as $menu){ ?>
|
48 |
-
<option value="<?php echo absint( $menu->term_id ); ?>" <?php selected( $this->value, $menu->term_id ); ?>><?php echo esc_attr( $menu->name ); ?></option>
|
49 |
-
<?php } ?>
|
50 |
-
|
51 |
-
</select>
|
52 |
-
<?php
|
53 |
-
$this->display_description();
|
54 |
-
|
55 |
-
}
|
56 |
-
|
57 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/simple-admin-pages/classes/AdminPageSetting.SelectPost.class.php
CHANGED
@@ -17,7 +17,7 @@
|
|
17 |
* @package Simple Admin Pages
|
18 |
*/
|
19 |
|
20 |
-
class
|
21 |
|
22 |
public $sanitize_callback = 'intval';
|
23 |
|
17 |
* @package Simple Admin Pages
|
18 |
*/
|
19 |
|
20 |
+
class sapAdminPageSettingSelectPost_2_2_0 extends sapAdminPageSetting_2_2_0 {
|
21 |
|
22 |
public $sanitize_callback = 'intval';
|
23 |
|
lib/simple-admin-pages/classes/AdminPageSetting.SelectTaxonomy.class.php
CHANGED
@@ -19,7 +19,7 @@
|
|
19 |
* @package Simple Admin Pages
|
20 |
*/
|
21 |
|
22 |
-
class
|
23 |
|
24 |
public $sanitize_callback = 'intval';
|
25 |
|
19 |
* @package Simple Admin Pages
|
20 |
*/
|
21 |
|
22 |
+
class sapAdminPageSettingSelectTaxonomy_2_2_0 extends sapAdminPageSetting_2_2_0 {
|
23 |
|
24 |
public $sanitize_callback = 'intval';
|
25 |
|
lib/simple-admin-pages/classes/AdminPageSetting.Text.class.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
* @package Simple Admin Pages
|
8 |
*/
|
9 |
|
10 |
-
class
|
11 |
|
12 |
public $sanitize_callback = 'sanitize_text_field';
|
13 |
|
@@ -24,7 +24,7 @@ class sapAdminPageSettingText_2_5_0 extends sapAdminPageSetting_2_5_0 {
|
|
24 |
public function display_setting() {
|
25 |
?>
|
26 |
|
27 |
-
<input name="<?php echo $this->get_input_name(); ?>" type="text" id="<?php echo $this->get_input_name(); ?>" value="<?php echo $this->value; ?>"<?php echo !empty( $this->placeholder ) ? ' placeholder="' . esc_attr( $this->placeholder ) . '"' : ''; ?> class="regular-text
|
28 |
|
29 |
<?php $this->display_disabled(); ?>
|
30 |
|
7 |
* @package Simple Admin Pages
|
8 |
*/
|
9 |
|
10 |
+
class sapAdminPageSettingText_2_2_0 extends sapAdminPageSetting_2_2_0 {
|
11 |
|
12 |
public $sanitize_callback = 'sanitize_text_field';
|
13 |
|
24 |
public function display_setting() {
|
25 |
?>
|
26 |
|
27 |
+
<input name="<?php echo $this->get_input_name(); ?>" type="text" id="<?php echo $this->get_input_name(); ?>" value="<?php echo $this->value; ?>"<?php echo !empty( $this->placeholder ) ? ' placeholder="' . esc_attr( $this->placeholder ) . '"' : ''; ?> class="regular-text" <?php echo ( $this->disabled ? 'disabled' : ''); ?> />
|
28 |
|
29 |
<?php $this->display_disabled(); ?>
|
30 |
|
lib/simple-admin-pages/classes/AdminPageSetting.Textarea.class.php
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
* @todo textareas should have an option to swap new lines for <br>s
|
10 |
*/
|
11 |
|
12 |
-
class
|
13 |
|
14 |
/*
|
15 |
* Size of this textarea
|
9 |
* @todo textareas should have an option to swap new lines for <br>s
|
10 |
*/
|
11 |
|
12 |
+
class sapAdminPageSettingTextarea_2_2_0 extends sapAdminPageSetting_2_2_0 {
|
13 |
|
14 |
/*
|
15 |
* Size of this textarea
|
lib/simple-admin-pages/classes/AdminPageSetting.Toggle.class.php
CHANGED
@@ -17,7 +17,7 @@
|
|
17 |
* @package Simple Admin Pages
|
18 |
*/
|
19 |
|
20 |
-
class
|
21 |
|
22 |
public $sanitize_callback = 'sanitize_text_field';
|
23 |
|
@@ -29,18 +29,16 @@ class sapAdminPageSettingToggle_2_5_0 extends sapAdminPageSetting_2_5_0 {
|
|
29 |
|
30 |
$input_name = $this->get_input_name();
|
31 |
|
32 |
-
if ( ! isset( $this->value ) ) { $this->value = $this->get_default_setting(); }
|
33 |
-
|
34 |
?>
|
35 |
|
36 |
<fieldset>
|
37 |
-
<div class="
|
38 |
<input type="checkbox" name="<?php echo $input_name; ?>" id="<?php echo $input_name; ?>" value="1"<?php if( $this->value == '1' ) : ?> checked="checked"<?php endif; ?> <?php echo ( $this->disabled ? 'disabled' : ''); ?>>
|
39 |
-
<label for="<?php echo $input_name; ?>"><?php echo $this->
|
40 |
</div>
|
41 |
-
<label class="
|
42 |
-
<input type="checkbox" class="
|
43 |
-
<span class="
|
44 |
</label>
|
45 |
<?php $this->display_disabled(); ?>
|
46 |
</fieldset>
|
17 |
* @package Simple Admin Pages
|
18 |
*/
|
19 |
|
20 |
+
class sapAdminPageSettingToggle_2_2_0 extends sapAdminPageSetting_2_2_0 {
|
21 |
|
22 |
public $sanitize_callback = 'sanitize_text_field';
|
23 |
|
29 |
|
30 |
$input_name = $this->get_input_name();
|
31 |
|
|
|
|
|
32 |
?>
|
33 |
|
34 |
<fieldset>
|
35 |
+
<div class="rtb-admin-hide-radios">
|
36 |
<input type="checkbox" name="<?php echo $input_name; ?>" id="<?php echo $input_name; ?>" value="1"<?php if( $this->value == '1' ) : ?> checked="checked"<?php endif; ?> <?php echo ( $this->disabled ? 'disabled' : ''); ?>>
|
37 |
+
<label for="<?php echo $input_name; ?>"><?php echo $this->label; ?></label>
|
38 |
</div>
|
39 |
+
<label class="rtb-admin-switch">
|
40 |
+
<input type="checkbox" class="rtb-admin-option-toggle" data-inputname="<?php echo $input_name; ?>" <?php if($this->value == '1') {echo "checked='checked'";} ?> <?php echo ( $this->disabled ? 'disabled' : ''); ?>>
|
41 |
+
<span class="rtb-admin-switch-slider round"></span>
|
42 |
</label>
|
43 |
<?php $this->display_disabled(); ?>
|
44 |
</fieldset>
|
lib/simple-admin-pages/classes/AdminPageSetting.WarningTip.class.php
DELETED
@@ -1,41 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Register, display and save a warning/tip in the admin menu
|
5 |
-
*
|
6 |
-
* @since 2.3.0
|
7 |
-
* @package Simple Admin Pages
|
8 |
-
*/
|
9 |
-
|
10 |
-
class sapAdminPageSettingWarningTip_2_5_0 extends sapAdminPageSetting_2_5_0 {
|
11 |
-
|
12 |
-
public $sanitize_callback = 'sanitize_text_field';
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Placeholder string for the input field
|
16 |
-
* @since 2.0
|
17 |
-
*/
|
18 |
-
public $placeholder = '';
|
19 |
-
|
20 |
-
/**
|
21 |
-
* Display this setting
|
22 |
-
* @since 1.0
|
23 |
-
*/
|
24 |
-
public function display_setting() {
|
25 |
-
?>
|
26 |
-
|
27 |
-
<fieldset class="fdm-warning-tip">
|
28 |
-
<div class="fdm-shortcode-reminder">
|
29 |
-
<?php echo '<strong>' . $this->title . '</strong> ' . $this->placeholder; ?>
|
30 |
-
</div>
|
31 |
-
|
32 |
-
<?php $this->display_disabled(); ?>
|
33 |
-
</fieldset>
|
34 |
-
|
35 |
-
<?php
|
36 |
-
|
37 |
-
$this->display_description();
|
38 |
-
|
39 |
-
}
|
40 |
-
|
41 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/simple-admin-pages/classes/AdminPageSetting.class.php
CHANGED
@@ -16,7 +16,7 @@
|
|
16 |
* @package Simple Admin Pages
|
17 |
*/
|
18 |
|
19 |
-
abstract class
|
20 |
|
21 |
// Page defaults
|
22 |
public $id; // used in form fields and database to track and store setting
|
@@ -24,8 +24,6 @@ abstract class sapAdminPageSetting_2_5_0 {
|
|
24 |
public $description; // optional description of the setting
|
25 |
public $value; // value of the setting, if a value exists
|
26 |
public $disabled = false; // whether a setting should be disabled
|
27 |
-
public $small = false; // whether a text input should use the small styling
|
28 |
-
public $columns; // to be used for the number of columns for settings, like radio and checkbox, with lots of options/values
|
29 |
|
30 |
/**
|
31 |
* An array of arguments accepted by add_settings_field.
|
@@ -221,9 +219,6 @@ abstract class sapAdminPageSetting_2_5_0 {
|
|
221 |
* @since 1.0
|
222 |
*/
|
223 |
public function esc_value( $val ) {
|
224 |
-
|
225 |
-
if ( is_array( $val ) ) { return array_map( 'esc_attr', $val );}
|
226 |
-
|
227 |
return esc_attr( $val );
|
228 |
}
|
229 |
|
@@ -289,15 +284,6 @@ abstract class sapAdminPageSetting_2_5_0 {
|
|
289 |
return esc_attr( $this->page ) . '[' . esc_attr( $this->id ) . ']';
|
290 |
}
|
291 |
|
292 |
-
/**
|
293 |
-
* Get the default value for a setting if value is currently empty
|
294 |
-
*
|
295 |
-
* @since 2.4.1
|
296 |
-
*/
|
297 |
-
public function get_default_setting() {
|
298 |
-
return ! empty( $this->default ) ? $this->default : $this->value;
|
299 |
-
}
|
300 |
-
|
301 |
/**
|
302 |
* Add and register this setting
|
303 |
*
|
16 |
* @package Simple Admin Pages
|
17 |
*/
|
18 |
|
19 |
+
abstract class sapAdminPageSetting_2_2_0 {
|
20 |
|
21 |
// Page defaults
|
22 |
public $id; // used in form fields and database to track and store setting
|
24 |
public $description; // optional description of the setting
|
25 |
public $value; // value of the setting, if a value exists
|
26 |
public $disabled = false; // whether a setting should be disabled
|
|
|
|
|
27 |
|
28 |
/**
|
29 |
* An array of arguments accepted by add_settings_field.
|
219 |
* @since 1.0
|
220 |
*/
|
221 |
public function esc_value( $val ) {
|
|
|
|
|
|
|
222 |
return esc_attr( $val );
|
223 |
}
|
224 |
|
284 |
return esc_attr( $this->page ) . '[' . esc_attr( $this->id ) . ']';
|
285 |
}
|
286 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
287 |
/**
|
288 |
* Add and register this setting
|
289 |
*
|
lib/simple-admin-pages/classes/Library.class.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
if ( !class_exists( '
|
3 |
/**
|
4 |
* This library class loads and provides access to the correct version of the
|
5 |
* Simple Admin Pages library.
|
@@ -7,10 +7,10 @@ if ( !class_exists( 'sapLibrary_2_5_0' ) ) {
|
|
7 |
* @since 1.0
|
8 |
* @package Simple Admin Pages
|
9 |
*/
|
10 |
-
class
|
11 |
|
12 |
// Version of the library
|
13 |
-
private $version = '2.
|
14 |
|
15 |
// A full URL to the library which is used to correctly link scripts and
|
16 |
// stylesheets.
|
@@ -41,10 +41,6 @@ class sapLibrary_2_5_0 {
|
|
41 |
*/
|
42 |
public function __construct( $args ) {
|
43 |
|
44 |
-
if ( ! defined( 'SAP_VERSION' ) ) {
|
45 |
-
define( 'SAP_VERSION', '2.5.0' );
|
46 |
-
}
|
47 |
-
|
48 |
// If no URL path to the library is passed, we won't be able to add the
|
49 |
// CSS and Javascript to the admin panel
|
50 |
if ( !isset( $args['lib_url'] ) ) {
|
@@ -129,10 +125,6 @@ class sapLibrary_2_5_0 {
|
|
129 |
require_once('AdminPageSetting.Text.class.php');
|
130 |
return $this->get_versioned_classname( 'sapAdminPageSettingText' );
|
131 |
|
132 |
-
case 'number' :
|
133 |
-
require_once('AdminPageSetting.Number.class.php');
|
134 |
-
return $this->get_versioned_classname( 'sapAdminPageSettingNumber' );
|
135 |
-
|
136 |
case 'colorpicker' :
|
137 |
require_once('AdminPageSetting.ColorPicker.class.php');
|
138 |
return $this->get_versioned_classname( 'sapAdminPageSettingColorPicker' );
|
@@ -149,10 +141,6 @@ class sapLibrary_2_5_0 {
|
|
149 |
require_once('AdminPageSetting.Toggle.class.php');
|
150 |
return $this->get_versioned_classname( 'sapAdminPageSettingToggle' );
|
151 |
|
152 |
-
case 'image' :
|
153 |
-
require_once('AdminPageSetting.Image.class.php');
|
154 |
-
return $this->get_versioned_classname( 'sapAdminPageSettingImage' );
|
155 |
-
|
156 |
case 'radio' :
|
157 |
require_once('AdminPageSetting.Radio.class.php');
|
158 |
return $this->get_versioned_classname( 'sapAdminPageSettingRadio' );
|
@@ -173,10 +161,6 @@ class sapLibrary_2_5_0 {
|
|
173 |
require_once('AdminPageSetting.SelectPost.class.php');
|
174 |
return $this->get_versioned_classname( 'sapAdminPageSettingSelectPost' );
|
175 |
|
176 |
-
case 'menu' :
|
177 |
-
require_once('AdminPageSetting.SelectMenu.class.php');
|
178 |
-
return $this->get_versioned_classname( 'sapAdminPageSettingSelectMenu' );
|
179 |
-
|
180 |
case 'taxonomy' :
|
181 |
require_once('AdminPageSetting.SelectTaxonomy.class.php');
|
182 |
return $this->get_versioned_classname( 'sapAdminPageSettingSelectTaxonomy' );
|
@@ -201,14 +185,6 @@ class sapLibrary_2_5_0 {
|
|
201 |
require_once('AdminPageSetting.Address.class.php');
|
202 |
return $this->get_versioned_classname( 'sapAdminPageSettingAddress' );
|
203 |
|
204 |
-
case 'file-upload' :
|
205 |
-
require_once('AdminPageSetting.FileUpload.class.php');
|
206 |
-
return $this->get_versioned_classname( 'sapAdminPageSettingFileUpload' );
|
207 |
-
|
208 |
-
case 'ordering-table' :
|
209 |
-
require_once('AdminPageSetting.Ordering.class.php');
|
210 |
-
return $this->get_versioned_classname( 'sapAdminPageSettingOrdering' );
|
211 |
-
|
212 |
case 'mcapikey' :
|
213 |
require_once('AdminPageSetting.McApiKey.class.php');
|
214 |
return $this->get_versioned_classname( 'mcfrtbAdminPageSettingMcApiKey' );
|
@@ -440,11 +416,7 @@ class sapLibrary_2_5_0 {
|
|
440 |
|
441 |
// Only enqueue assets for the current page
|
442 |
if ( strpos( $screen->base, $page_id ) !== false ) {
|
443 |
-
wp_enqueue_style( 'sap-admin-style-' . $this->version, $this->lib_url . 'css/admin.css'
|
444 |
-
wp_enqueue_style( 'sap-spectrum-css-' . $this->version, $this->lib_url . 'css/spectrum.css', array(), $this->version );
|
445 |
-
wp_enqueue_style( 'sap-admin-settings-css-' . $this->version, $this->lib_url . 'css/admin-settings.css', array(), $this->version );
|
446 |
-
wp_enqueue_script( 'sap-spectrum-js-' . $this->version, $this->lib_url . 'js/spectrum.js', array( 'jquery' ), $this->version );
|
447 |
-
wp_enqueue_script( 'sap-admin-settings-js-' . $this->version, $this->lib_url . 'js/admin-settings.js', array( 'jquery', 'sap-spectrum-js-' . $this->version ), $this->version );
|
448 |
wp_enqueue_media();
|
449 |
|
450 |
foreach ( $page->sections as $section ) {
|
1 |
<?php
|
2 |
+
if ( !class_exists( 'sapLibrary_2_2_0' ) ) {
|
3 |
/**
|
4 |
* This library class loads and provides access to the correct version of the
|
5 |
* Simple Admin Pages library.
|
7 |
* @since 1.0
|
8 |
* @package Simple Admin Pages
|
9 |
*/
|
10 |
+
class sapLibrary_2_2_0 {
|
11 |
|
12 |
// Version of the library
|
13 |
+
private $version = '2.2.0';
|
14 |
|
15 |
// A full URL to the library which is used to correctly link scripts and
|
16 |
// stylesheets.
|
41 |
*/
|
42 |
public function __construct( $args ) {
|
43 |
|
|
|
|
|
|
|
|
|
44 |
// If no URL path to the library is passed, we won't be able to add the
|
45 |
// CSS and Javascript to the admin panel
|
46 |
if ( !isset( $args['lib_url'] ) ) {
|
125 |
require_once('AdminPageSetting.Text.class.php');
|
126 |
return $this->get_versioned_classname( 'sapAdminPageSettingText' );
|
127 |
|
|
|
|
|
|
|
|
|
128 |
case 'colorpicker' :
|
129 |
require_once('AdminPageSetting.ColorPicker.class.php');
|
130 |
return $this->get_versioned_classname( 'sapAdminPageSettingColorPicker' );
|
141 |
require_once('AdminPageSetting.Toggle.class.php');
|
142 |
return $this->get_versioned_classname( 'sapAdminPageSettingToggle' );
|
143 |
|
|
|
|
|
|
|
|
|
144 |
case 'radio' :
|
145 |
require_once('AdminPageSetting.Radio.class.php');
|
146 |
return $this->get_versioned_classname( 'sapAdminPageSettingRadio' );
|
161 |
require_once('AdminPageSetting.SelectPost.class.php');
|
162 |
return $this->get_versioned_classname( 'sapAdminPageSettingSelectPost' );
|
163 |
|
|
|
|
|
|
|
|
|
164 |
case 'taxonomy' :
|
165 |
require_once('AdminPageSetting.SelectTaxonomy.class.php');
|
166 |
return $this->get_versioned_classname( 'sapAdminPageSettingSelectTaxonomy' );
|
185 |
require_once('AdminPageSetting.Address.class.php');
|
186 |
return $this->get_versioned_classname( 'sapAdminPageSettingAddress' );
|
187 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
188 |
case 'mcapikey' :
|
189 |
require_once('AdminPageSetting.McApiKey.class.php');
|
190 |
return $this->get_versioned_classname( 'mcfrtbAdminPageSettingMcApiKey' );
|
416 |
|
417 |
// Only enqueue assets for the current page
|
418 |
if ( strpos( $screen->base, $page_id ) !== false ) {
|
419 |
+
wp_enqueue_style( 'sap-admin-style-' . $this->version, $this->lib_url . 'css/admin.css' );
|
|
|
|
|
|
|
|
|
420 |
wp_enqueue_media();
|
421 |
|
422 |
foreach ( $page->sections as $section ) {
|
lib/simple-admin-pages/css/admin-settings.css
DELETED
@@ -1,654 +0,0 @@
|
|
1 |
-
/************************/
|
2 |
-
/***** OPTIONS PAGE *****/
|
3 |
-
/************************/
|
4 |
-
|
5 |
-
/* Side Menu */
|
6 |
-
.wrap.sap-settings-page h2.nav-tab-wrapper {
|
7 |
-
position: relative;
|
8 |
-
float: left;
|
9 |
-
border: none;
|
10 |
-
width: 180px;
|
11 |
-
box-shadow: -1px 1px 8px #ccc;
|
12 |
-
overflow: hidden;
|
13 |
-
padding-top: 0;
|
14 |
-
margin-top: 20px;
|
15 |
-
}
|
16 |
-
.wrap.sap-settings-page h2.nav-tab-wrapper a {
|
17 |
-
clear: both;
|
18 |
-
display: block;
|
19 |
-
position: relative;
|
20 |
-
float: left;
|
21 |
-
background-color: #e2e2e2;
|
22 |
-
border: none;
|
23 |
-
border-bottom: 1px solid #f1f1f1;
|
24 |
-
color: #555;
|
25 |
-
font-weight: bold;
|
26 |
-
padding-left: 20px;
|
27 |
-
width: calc(100% - 20px);
|
28 |
-
text-align: left;
|
29 |
-
margin: 0;
|
30 |
-
height: 34px;
|
31 |
-
line-height: 34px;
|
32 |
-
font-size: 13px;
|
33 |
-
}
|
34 |
-
.wrap.sap-settings-page h2.nav-tab-wrapper a:last-of-type {
|
35 |
-
border-bottom: none;
|
36 |
-
}
|
37 |
-
.wrap.sap-settings-page h2.nav-tab-wrapper a.nav-tab-active {
|
38 |
-
box-shadow: none;
|
39 |
-
background-color: #fff !important;
|
40 |
-
color: #6026B4;
|
41 |
-
border-left: 4px solid #6026B4;
|
42 |
-
}
|
43 |
-
.wrap.sap-settings-page h2.nav-tab-wrapper a:hover {
|
44 |
-
color: #6026B4;
|
45 |
-
background-color: rgba(199,199,199, 0.5);
|
46 |
-
box-shadow: none;
|
47 |
-
border-left: 4px solid #6026B4;
|
48 |
-
}
|
49 |
-
.wrap.sap-settings-page h2.nav-tab-wrapper a.nav-tab-active:hover {
|
50 |
-
color: #6026B4;
|
51 |
-
background-color: #fff;
|
52 |
-
border-left: 4px solid #6026B4;
|
53 |
-
}
|
54 |
-
|
55 |
-
/* Right side */
|
56 |
-
.wrap.sap-settings-page form {
|
57 |
-
display: block;
|
58 |
-
position: relative;
|
59 |
-
float: left;
|
60 |
-
width: calc(100% - 276px);
|
61 |
-
padding: 32px 48px;
|
62 |
-
z-index: 999;
|
63 |
-
background:#fff;
|
64 |
-
margin: 20px 0 0 !important;
|
65 |
-
min-height: 400px;
|
66 |
-
border: none;
|
67 |
-
}
|
68 |
-
|
69 |
-
.wrap.sap-settings-page form h2:first-of-type {
|
70 |
-
font-size: 18px;
|
71 |
-
color: #6026B4;
|
72 |
-
margin: 0 0 32px !important;
|
73 |
-
}
|
74 |
-
|
75 |
-
.wrap.sap-settings-page form h2:nth-of-type(1n+2) {
|
76 |
-
position: relative;
|
77 |
-
float: left;
|
78 |
-
background: #6026B4;
|
79 |
-
margin: 8px 0 0;
|
80 |
-
font-size: 15px;
|
81 |
-
font-weight: bold;
|
82 |
-
color: #fff;
|
83 |
-
padding: 12px 2%;
|
84 |
-
width: 96%;
|
85 |
-
text-transform: uppercase;
|
86 |
-
z-index: 2;
|
87 |
-
}
|
88 |
-
.wrap.sap-settings-page form .form-table {
|
89 |
-
width: 100%;
|
90 |
-
box-sizing: border-box;
|
91 |
-
margin: 0 auto 16px;
|
92 |
-
box-shadow: 0 1px 12px #ddd;
|
93 |
-
display: block;
|
94 |
-
padding: 11px 5%;
|
95 |
-
}
|
96 |
-
.wrap.sap-settings-page form .form-table tr {
|
97 |
-
width: 20%;
|
98 |
-
}
|
99 |
-
.wrap.sap-settings-page form .form-table td {
|
100 |
-
width: 80%;
|
101 |
-
}
|
102 |
-
|
103 |
-
.wrap.sap-settings-page form p.description {
|
104 |
-
display: none;
|
105 |
-
}
|
106 |
-
.wrap.sap-settings-page form .form-table p.description {
|
107 |
-
display: block;
|
108 |
-
}
|
109 |
-
.wrap.sap-settings-page form .form-table p.description.disabled {
|
110 |
-
color: #b5b5b5;
|
111 |
-
}
|
112 |
-
|
113 |
-
|
114 |
-
.ulb-premium-options-table-overlay + table th,
|
115 |
-
.ulb-premium-options-table-overlay + table td {
|
116 |
-
color: #b5b5b5;
|
117 |
-
}
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
/************************
|
122 |
-
TOGGLE SWITCHES
|
123 |
-
************************/
|
124 |
-
.sap-admin-hide-radios {
|
125 |
-
display: none;
|
126 |
-
}
|
127 |
-
|
128 |
-
/* The switch - the box around the slider */
|
129 |
-
.sap-admin-switch {
|
130 |
-
position: relative;
|
131 |
-
display: inline-block;
|
132 |
-
width: 40px;
|
133 |
-
height: 22px;
|
134 |
-
}
|
135 |
-
|
136 |
-
/* Hide default HTML checkbox */
|
137 |
-
.sap-admin-switch input {
|
138 |
-
display: none;
|
139 |
-
}
|
140 |
-
|
141 |
-
/* The slider */
|
142 |
-
.sap-admin-switch-slider {
|
143 |
-
position: absolute;
|
144 |
-
cursor: pointer;
|
145 |
-
top: 0;
|
146 |
-
left: 0;
|
147 |
-
right: 0;
|
148 |
-
bottom: 0;
|
149 |
-
background-color: #ccc;
|
150 |
-
-webkit-transition: .4s;
|
151 |
-
transition: .4s;
|
152 |
-
}
|
153 |
-
|
154 |
-
.sap-admin-switch-slider:before {
|
155 |
-
position: absolute;
|
156 |
-
content: "";
|
157 |
-
height: 14px;
|
158 |
-
width: 14px;
|
159 |
-
left: 4px;
|
160 |
-
bottom: 4px;
|
161 |
-
background-color: white;
|
162 |
-
-webkit-transition: .4s;
|
163 |
-
transition: .4s;
|
164 |
-
}
|
165 |
-
|
166 |
-
input:checked + .sap-admin-switch-slider {
|
167 |
-
background-color: #0acbaa;
|
168 |
-
}
|
169 |
-
|
170 |
-
input:focus + .sap-admin-switch-slider {
|
171 |
-
box-shadow: 0 0 1px #0acbaa;
|
172 |
-
}
|
173 |
-
|
174 |
-
input:checked + .sap-admin-switch-slider:before {
|
175 |
-
-webkit-transform: translateX(18px);
|
176 |
-
-ms-transform: translateX(18px);
|
177 |
-
transform: translateX(18px);
|
178 |
-
}
|
179 |
-
|
180 |
-
/* Rounded sliders */
|
181 |
-
.sap-admin-switch-slider.round {
|
182 |
-
border-radius: 34px;
|
183 |
-
}
|
184 |
-
|
185 |
-
.sap-admin-switch-slider.round:before {
|
186 |
-
border-radius: 50%;
|
187 |
-
}
|
188 |
-
|
189 |
-
|
190 |
-
/* RADIO BUTTON AND CHECKBOX */
|
191 |
-
.wrap.sap-settings-page form .form-table fieldset label {
|
192 |
-
line-height: 1.4em;
|
193 |
-
margin: .25em 0 .5em;
|
194 |
-
display: inline-block;
|
195 |
-
font-size: 14px;
|
196 |
-
}
|
197 |
-
|
198 |
-
.sap-admin-input-container input, .sap-admin-input-container input:disabled {
|
199 |
-
position: absolute;
|
200 |
-
opacity: 0;
|
201 |
-
}
|
202 |
-
.sap-admin-radio-button {
|
203 |
-
position: relative;
|
204 |
-
float: left;
|
205 |
-
height: 14px;
|
206 |
-
width: 14px;
|
207 |
-
top: 1px;
|
208 |
-
margin-right: 12px;
|
209 |
-
background-color: #fff;
|
210 |
-
border: 2px solid #aaa;
|
211 |
-
border-radius: 50%;
|
212 |
-
}
|
213 |
-
.sap-admin-input-container:hover input ~ .sap-admin-radio-button {
|
214 |
-
background-color: #E6FFFB;
|
215 |
-
border-color: #6026B4;
|
216 |
-
}
|
217 |
-
.sap-admin-input-container input:checked ~ .sap-admin-radio-button {
|
218 |
-
border-color: #6026B4;
|
219 |
-
background-color: #fff;
|
220 |
-
}
|
221 |
-
.sap-admin-radio-button:after {
|
222 |
-
content: "";
|
223 |
-
position: absolute;
|
224 |
-
display: none;
|
225 |
-
}
|
226 |
-
.sap-admin-input-container input:checked ~ .sap-admin-radio-button:after {
|
227 |
-
display: block;
|
228 |
-
}
|
229 |
-
.sap-admin-input-container .sap-admin-radio-button:after {
|
230 |
-
top: 3px;
|
231 |
-
left: 3px;
|
232 |
-
width: 8px;
|
233 |
-
height: 8px;
|
234 |
-
border-radius: 50%;
|
235 |
-
background: #6026B4;
|
236 |
-
}
|
237 |
-
|
238 |
-
.sap-admin-checkbox {
|
239 |
-
position: relative;
|
240 |
-
float: left;
|
241 |
-
height: 14px;
|
242 |
-
width: 14px;
|
243 |
-
top: 1px;
|
244 |
-
margin-right: 12px;
|
245 |
-
background-color: #fff;
|
246 |
-
border: 2px solid #aaa;
|
247 |
-
}
|
248 |
-
.sap-admin-input-container:hover input ~ .sap-admin-checkbox {
|
249 |
-
background-color: #E6FFFB;
|
250 |
-
border-color: #6026B4;
|
251 |
-
}
|
252 |
-
.sap-admin-input-container input:checked ~ .sap-admin-checkbox {
|
253 |
-
border-color: #6026B4;
|
254 |
-
background-color: #fff;
|
255 |
-
}
|
256 |
-
.sap-admin-checkbox:after {
|
257 |
-
content: "";
|
258 |
-
position: absolute;
|
259 |
-
display: none;
|
260 |
-
}
|
261 |
-
.sap-admin-input-container input:checked ~ .sap-admin-checkbox:after {
|
262 |
-
display: block;
|
263 |
-
}
|
264 |
-
.sap-admin-input-container .sap-admin-checkbox:after {
|
265 |
-
left: 4px;
|
266 |
-
top: 1px;
|
267 |
-
width: 4px;
|
268 |
-
height: 8px;
|
269 |
-
border: solid #6026B4;
|
270 |
-
border-width: 0 2px 2px 0;
|
271 |
-
-webkit-transform: rotate(45deg);
|
272 |
-
-ms-transform: rotate(45deg);
|
273 |
-
transform: rotate(45deg);
|
274 |
-
}
|
275 |
-
|
276 |
-
/* Textbox and Text Area and Select boxes */
|
277 |
-
.wrap.sap-settings-page form .form-table input[type=text],
|
278 |
-
.wrap.sap-settings-page form .form-table input[type=search],
|
279 |
-
.wrap.sap-settings-page form .form-table input[type=tel],
|
280 |
-
.wrap.sap-settings-page form .form-table input[type=url],
|
281 |
-
.wrap.sap-settings-page form .form-table input[type=week],
|
282 |
-
.wrap.sap-settings-page form .form-table input[type=password],
|
283 |
-
.wrap.sap-settings-page form .form-table input[type=color],
|
284 |
-
.wrap.sap-settings-page form .form-table input[type=email],
|
285 |
-
.wrap.sap-settings-page form .form-table input[type=number],
|
286 |
-
.wrap.sap-settings-page form .form-table textarea,
|
287 |
-
.wrap.sap-settings-page form .form-table select {
|
288 |
-
border: 2px solid #ccc;
|
289 |
-
border-radius: 5px;
|
290 |
-
box-shadow: none;
|
291 |
-
}
|
292 |
-
.wrap.sap-settings-page form .form-table select,
|
293 |
-
.wrap.sap-settings-page form .form-table textarea {
|
294 |
-
width: auto !important;
|
295 |
-
min-width: 50%;
|
296 |
-
max-width: 100% !important;
|
297 |
-
}
|
298 |
-
#sap-dining-block-length_count,
|
299 |
-
#sap-dining-block-length_unit {
|
300 |
-
min-width: 0;
|
301 |
-
}
|
302 |
-
|
303 |
-
.wrap.sap-settings-page form .form-table textarea {
|
304 |
-
min-width: 300px;
|
305 |
-
min-height: 200px;
|
306 |
-
}
|
307 |
-
.wrap.sap-settings-page form .form-table .wp-editor-wrap textarea {
|
308 |
-
border: none;
|
309 |
-
border-radius: 0;
|
310 |
-
min-width: 0;
|
311 |
-
max-width: 100%;
|
312 |
-
min-height: 0;
|
313 |
-
}
|
314 |
-
|
315 |
-
|
316 |
-
/*SMALL TEXT INPUTS*/
|
317 |
-
.sap-small-text-input {
|
318 |
-
border-radius: 2px !important;
|
319 |
-
width: 100px;
|
320 |
-
}
|
321 |
-
|
322 |
-
|
323 |
-
/*SETTINGS COLUMNS*/
|
324 |
-
.sap-admin-input-container {
|
325 |
-
position: relative;
|
326 |
-
float: left;
|
327 |
-
width: 100%;
|
328 |
-
}
|
329 |
-
.sap-setting-columns-2 .sap-admin-input-container {
|
330 |
-
width: 50%;
|
331 |
-
}
|
332 |
-
.sap-setting-columns-3 .sap-admin-input-container {
|
333 |
-
width: 33.33333%;
|
334 |
-
width: calc(100% / 3);
|
335 |
-
}
|
336 |
-
.sap-setting-columns-8 .sap-admin-input-container {
|
337 |
-
width: 12.5%;
|
338 |
-
}
|
339 |
-
|
340 |
-
|
341 |
-
/*COLOUR PICKERS*/
|
342 |
-
fieldset.sap-colorpicker {
|
343 |
-
position: relative;
|
344 |
-
}
|
345 |
-
.sap-colorpicker input.sap-spectrum {
|
346 |
-
position: absolute;
|
347 |
-
right: 0;
|
348 |
-
bottom: 0;
|
349 |
-
border: none !important;
|
350 |
-
margin: 0 !important;
|
351 |
-
width: calc(100% - 42px);
|
352 |
-
border-radius: 0;
|
353 |
-
background: transparent !important;
|
354 |
-
color: #888 !important;
|
355 |
-
padding: 0;
|
356 |
-
font-size: 12px;
|
357 |
-
}
|
358 |
-
.sap-colorpicker .sp-replacer {
|
359 |
-
padding: 0 !important;
|
360 |
-
margin-right: 8px !important;
|
361 |
-
border-radius: 2px;
|
362 |
-
}
|
363 |
-
.sap-colorpicker .sp-preview {
|
364 |
-
width: 32px !important;
|
365 |
-
height: 32px !important;
|
366 |
-
margin: 0 !important;
|
367 |
-
border: none !important
|
368 |
-
}
|
369 |
-
.sap-colorpicker .sp-dd {
|
370 |
-
display: none !important;
|
371 |
-
}
|
372 |
-
|
373 |
-
|
374 |
-
/**************************
|
375 |
-
OTHER OPTION PAGE STYLING
|
376 |
-
**************************/
|
377 |
-
|
378 |
-
/*LOCK PREMIUM CONTENT*/
|
379 |
-
.sap-premium-options-table {
|
380 |
-
position: relative;
|
381 |
-
min-height: 240px;
|
382 |
-
}
|
383 |
-
.sap-premium-options-table.Yes {
|
384 |
-
min-height: 0;
|
385 |
-
}
|
386 |
-
.sap-premium-options-table-overlay {
|
387 |
-
position: absolute;
|
388 |
-
top: 0;
|
389 |
-
left: 0;
|
390 |
-
width: 1000px;
|
391 |
-
height: 500px;
|
392 |
-
background: rgba(0,0,0,.45);
|
393 |
-
z-index: 2;
|
394 |
-
}
|
395 |
-
.section-disabled {
|
396 |
-
position: absolute;
|
397 |
-
margin-top: 16px;
|
398 |
-
width: 200px;
|
399 |
-
height: 200px;
|
400 |
-
padding: 16px;
|
401 |
-
background: #fff;
|
402 |
-
left: calc(50% - 116px);
|
403 |
-
}
|
404 |
-
.section-disabled img {
|
405 |
-
position: relative;
|
406 |
-
float: left;
|
407 |
-
width: 40px;
|
408 |
-
height: auto;
|
409 |
-
margin: 16px 80px 24px;
|
410 |
-
}
|
411 |
-
.section-disabled p {
|
412 |
-
margin: 16px 0;
|
413 |
-
text-align: center;
|
414 |
-
color: #888;
|
415 |
-
}
|
416 |
-
.section-disabled .sap-dashboard-get-premium-widget-button {
|
417 |
-
clear: both;
|
418 |
-
position: relative;
|
419 |
-
float: left;
|
420 |
-
width: calc(100% - 20px);
|
421 |
-
margin: 16px 8px;
|
422 |
-
border: 2px solid #6026B4;
|
423 |
-
background-color: #6026B4;
|
424 |
-
color: #fff;
|
425 |
-
padding: 6px 0;
|
426 |
-
font-size: 12px;
|
427 |
-
text-decoration: none;
|
428 |
-
text-align: center;
|
429 |
-
font-weight: bold;
|
430 |
-
border-radius: 2px;
|
431 |
-
}
|
432 |
-
.section-disabled .sap-dashboard-get-premium-widget-button:hover {
|
433 |
-
background-color: #6f2fc9;
|
434 |
-
border-color: #6f2fc9;
|
435 |
-
color: #fff;
|
436 |
-
}
|
437 |
-
|
438 |
-
|
439 |
-
/*************
|
440 |
-
RESPONSIVE
|
441 |
-
*************/
|
442 |
-
@media screen and (max-width: 1099px) {
|
443 |
-
.wrap.sap-settings-page h2.nav-tab-wrapper {
|
444 |
-
clear: both;
|
445 |
-
width: 100%;
|
446 |
-
}
|
447 |
-
.wrap.sap-settings-page form {
|
448 |
-
clear: both;
|
449 |
-
width: calc(100% - 96px);
|
450 |
-
}
|
451 |
-
}
|
452 |
-
@media screen and (max-width: 782px) {
|
453 |
-
.wrap.sap-settings-page h2.nav-tab-wrapper {
|
454 |
-
margin: 0 0 20px 0;
|
455 |
-
}
|
456 |
-
.wrap.sap-settings-page form {
|
457 |
-
width: calc(100% - 96px);
|
458 |
-
}
|
459 |
-
.sap-admin-section-heading {
|
460 |
-
text-align: center;
|
461 |
-
}
|
462 |
-
.wrap.sap-settings-page form .form-table {
|
463 |
-
box-shadow: none;
|
464 |
-
}
|
465 |
-
.wrap.sap-settings-page form .form-table,
|
466 |
-
.wrap.sap-settings-page form .form-table tbody,
|
467 |
-
.wrap.sap-settings-page form .form-table tr,
|
468 |
-
.wrap.sap-settings-page form .form-table th,
|
469 |
-
.wrap.sap-settings-page form .form-table td {
|
470 |
-
clear: both;
|
471 |
-
float: left;
|
472 |
-
width: 100%;
|
473 |
-
}
|
474 |
-
.wrap.sap-settings-page form .form-table {
|
475 |
-
padding: 11px 0;
|
476 |
-
}
|
477 |
-
.wrap.sap-settings-page form .form-table th {
|
478 |
-
padding: 20px 5% 8px;
|
479 |
-
width: 90%;
|
480 |
-
height: auto;
|
481 |
-
margin: 0;
|
482 |
-
background-image: url(../images/options-asset-info.png);
|
483 |
-
background-position: 95% 20px;
|
484 |
-
background-size: 18px 18px;
|
485 |
-
background-repeat: no-repeat;
|
486 |
-
cursor: pointer;
|
487 |
-
}
|
488 |
-
.wrap.sap-settings-page form .form-table td {
|
489 |
-
padding-top: 4px;
|
490 |
-
}
|
491 |
-
.wrap.sap-settings-page form .form-table td fieldset {
|
492 |
-
position: relative;
|
493 |
-
}
|
494 |
-
.wrap.sap-settings-page form .form-table td label {
|
495 |
-
position: relative;
|
496 |
-
clear: both;
|
497 |
-
float: left;
|
498 |
-
width: 90%;
|
499 |
-
margin-left: 5% !important;
|
500 |
-
}
|
501 |
-
.wrap.sap-settings-page form .form-table td label.sap-admin-switch {
|
502 |
-
position: absolute;
|
503 |
-
width: 40px;
|
504 |
-
top: -35px;
|
505 |
-
right: 5%;
|
506 |
-
}
|
507 |
-
.wrap.sap-settings-page form .form-table td p {
|
508 |
-
display: none;
|
509 |
-
position: relative;
|
510 |
-
float: left;
|
511 |
-
width: 90%;
|
512 |
-
padding: 10px 5% 24px;
|
513 |
-
background: #f3f3f3;
|
514 |
-
border-bottom: 1px solid #ccc;
|
515 |
-
font-size: 13px;
|
516 |
-
}
|
517 |
-
.wrap.sap-settings-page form .form-table td input[type="button"] {
|
518 |
-
display: block;
|
519 |
-
margin: 10px auto 4px;
|
520 |
-
}
|
521 |
-
.sap-admin-input-container {
|
522 |
-
width: calc(100% - 16px);
|
523 |
-
padding-left: 16px;
|
524 |
-
}
|
525 |
-
}
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
/******************************************************************
|
530 |
-
NEW STYLING FOR ADD/DELETE AREAS LIKE CUSTOM FIELDS
|
531 |
-
******************************************************************/
|
532 |
-
.sap-infinite-table table th {
|
533 |
-
padding: 0 10px !important;
|
534 |
-
}
|
535 |
-
.sap-new-admin-add-button {
|
536 |
-
position: relative;
|
537 |
-
float: left;
|
538 |
-
width: calc(100% - 4px);
|
539 |
-
border: 2px dotted #bbb;
|
540 |
-
text-align: center;
|
541 |
-
padding: 12px 0;
|
542 |
-
color: #999;
|
543 |
-
}
|
544 |
-
.sap-new-admin-add-button:hover {
|
545 |
-
background: #f5f5f5;
|
546 |
-
color: #888;
|
547 |
-
}
|
548 |
-
.sap-infinite-table-row-delete,
|
549 |
-
.sap-custom-fields-add-nutrional-information {
|
550 |
-
cursor: pointer;
|
551 |
-
color: #6026B4;
|
552 |
-
}
|
553 |
-
.sap-infinite-table-row-delete:hover,
|
554 |
-
.sap-custom-fields-add-nutrional-information:hover {
|
555 |
-
color: #4366A6;
|
556 |
-
}
|
557 |
-
|
558 |
-
|
559 |
-
/******************************************************************
|
560 |
-
EXPORT BUTTON
|
561 |
-
******************************************************************/
|
562 |
-
.sap-export-button {
|
563 |
-
position: relative;
|
564 |
-
width: 150px;
|
565 |
-
padding: 0 !important;
|
566 |
-
}
|
567 |
-
.sap-export-button span {
|
568 |
-
position: absolute;
|
569 |
-
top: 4px;
|
570 |
-
left: 8px;
|
571 |
-
}
|
572 |
-
input[name="sap_export"] {
|
573 |
-
position: absolute;
|
574 |
-
top: 0;
|
575 |
-
left: 0;
|
576 |
-
width: 100%;
|
577 |
-
height: 100%;
|
578 |
-
box-sizing: border-box;
|
579 |
-
background: none;
|
580 |
-
border: none;
|
581 |
-
cursor: pointer;
|
582 |
-
color: #0071a1;
|
583 |
-
padding: 0 0 0 32px;
|
584 |
-
text-align: left;
|
585 |
-
}
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
/******************************************************************
|
590 |
-
CONTROLS AND ICONS SCREENS
|
591 |
-
******************************************************************/
|
592 |
-
|
593 |
-
/*
|
594 |
-
Lightbox control element selection
|
595 |
-
*/
|
596 |
-
.ulb-admin-one-third,
|
597 |
-
.ulb-admin-one-sixth {
|
598 |
-
float: left;
|
599 |
-
margin-bottom: 18px;
|
600 |
-
}
|
601 |
-
.ulb-admin-one-third {
|
602 |
-
width: 30%;
|
603 |
-
}
|
604 |
-
.ulb-admin-one-sixth {
|
605 |
-
width: auto;
|
606 |
-
}
|
607 |
-
|
608 |
-
.ulb-toolbar-control {
|
609 |
-
width: 40px;
|
610 |
-
float: left;
|
611 |
-
cursor: pointer;
|
612 |
-
}
|
613 |
-
.ewd-ulb-selected-control {
|
614 |
-
background: #333333;
|
615 |
-
color: #FFFFFF;
|
616 |
-
}
|
617 |
-
|
618 |
-
.ulb-add-button,
|
619 |
-
.ulb-remove-button {
|
620 |
-
width: 96px;
|
621 |
-
padding: 6px 0;
|
622 |
-
margin: 0 auto;
|
623 |
-
margin-bottom: 8px;
|
624 |
-
background: #111;
|
625 |
-
color: #fff;
|
626 |
-
border: 2px solid #111;
|
627 |
-
border-radius: 2px;
|
628 |
-
text-align: center;
|
629 |
-
cursor: pointer;
|
630 |
-
transition: background .3s, color .3s;
|
631 |
-
}
|
632 |
-
.ulb-add-button:hover,
|
633 |
-
.ulb-remove-button:hover {
|
634 |
-
background: transparent;
|
635 |
-
color: #111;
|
636 |
-
}
|
637 |
-
|
638 |
-
/*
|
639 |
-
Lightbox Icon Selection
|
640 |
-
*/
|
641 |
-
|
642 |
-
.ewd-ulb-control-icons span {
|
643 |
-
font-size: 1.8em;
|
644 |
-
letter-spacing: 3px;
|
645 |
-
}
|
646 |
-
|
647 |
-
/*TOOLBAR SELECT ITEMS*/
|
648 |
-
.ulb-toolbar-controls {
|
649 |
-
background: #f4f4f4;
|
650 |
-
padding: 8px;
|
651 |
-
margin-right: 8px;
|
652 |
-
margin-left: 8px;
|
653 |
-
height: 60px;
|
654 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/simple-admin-pages/css/ordering.css
DELETED
@@ -1,27 +0,0 @@
|
|
1 |
-
/****************************
|
2 |
-
ORDERING TABLE
|
3 |
-
****************************/
|
4 |
-
.sap-ordering-table table {
|
5 |
-
width: 100%;
|
6 |
-
border-collapse: collapse;
|
7 |
-
}
|
8 |
-
.sap-ordering-table table th, .sap-ordering-table table td {
|
9 |
-
background: #f1f1f1;
|
10 |
-
padding: 8px 16px;
|
11 |
-
width: calc(100% - 32px);
|
12 |
-
}
|
13 |
-
.sap-ordering-table table td {
|
14 |
-
border-bottom: 1px solid #ccc;
|
15 |
-
cursor: move;
|
16 |
-
}
|
17 |
-
.sap-ordering-table table td:first-of-type {
|
18 |
-
border-top: 1px solid #ccc;
|
19 |
-
}
|
20 |
-
.sap-ordering-table table tr:nth-of-type(2n+2) td {
|
21 |
-
background: #fafafa;
|
22 |
-
}
|
23 |
-
.sap-ordering-table table th {
|
24 |
-
background: #662D91;
|
25 |
-
color: #fff;
|
26 |
-
text-align: left;
|
27 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/simple-admin-pages/css/spectrum.css
DELETED
@@ -1,507 +0,0 @@
|
|
1 |
-
/***
|
2 |
-
Spectrum Colorpicker v1.7.1
|
3 |
-
https://github.com/bgrins/spectrum
|
4 |
-
Author: Brian Grinstead
|
5 |
-
License: MIT
|
6 |
-
***/
|
7 |
-
|
8 |
-
.sp-container {
|
9 |
-
position:absolute;
|
10 |
-
top:0;
|
11 |
-
left:0;
|
12 |
-
display:inline-block;
|
13 |
-
*display: inline;
|
14 |
-
*zoom: 1;
|
15 |
-
/* https://github.com/bgrins/spectrum/issues/40 */
|
16 |
-
z-index: 9999994;
|
17 |
-
overflow: hidden;
|
18 |
-
}
|
19 |
-
.sp-container.sp-flat {
|
20 |
-
position: relative;
|
21 |
-
}
|
22 |
-
|
23 |
-
/* Fix for * { box-sizing: border-box; } */
|
24 |
-
.sp-container,
|
25 |
-
.sp-container * {
|
26 |
-
-webkit-box-sizing: content-box;
|
27 |
-
-moz-box-sizing: content-box;
|
28 |
-
box-sizing: content-box;
|
29 |
-
}
|
30 |
-
|
31 |
-
/* http://ansciath.tumblr.com/post/7347495869/css-aspect-ratio */
|
32 |
-
.sp-top {
|
33 |
-
position:relative;
|
34 |
-
width: 100%;
|
35 |
-
display:inline-block;
|
36 |
-
}
|
37 |
-
.sp-top-inner {
|
38 |
-
position:absolute;
|
39 |
-
top:0;
|
40 |
-
left:0;
|
41 |
-
bottom:0;
|
42 |
-
right:0;
|
43 |
-
}
|
44 |
-
.sp-color {
|
45 |
-
position: absolute;
|
46 |
-
top:0;
|
47 |
-
left:0;
|
48 |
-
bottom:0;
|
49 |
-
right:20%;
|
50 |
-
}
|
51 |
-
.sp-hue {
|
52 |
-
position: absolute;
|
53 |
-
top:0;
|
54 |
-
right:0;
|
55 |
-
bottom:0;
|
56 |
-
left:84%;
|
57 |
-
height: 100%;
|
58 |
-
}
|
59 |
-
|
60 |
-
.sp-clear-enabled .sp-hue {
|
61 |
-
top:33px;
|
62 |
-
height: 77.5%;
|
63 |
-
}
|
64 |
-
|
65 |
-
.sp-fill {
|
66 |
-
padding-top: 80%;
|
67 |
-
}
|
68 |
-
.sp-sat, .sp-val {
|
69 |
-
position: absolute;
|
70 |
-
top:0;
|
71 |
-
left:0;
|
72 |
-
right:0;
|
73 |
-
bottom:0;
|
74 |
-
}
|
75 |
-
|
76 |
-
.sp-alpha-enabled .sp-top {
|
77 |
-
margin-bottom: 18px;
|
78 |
-
}
|
79 |
-
.sp-alpha-enabled .sp-alpha {
|
80 |
-
display: block;
|
81 |
-
}
|
82 |
-
.sp-alpha-handle {
|
83 |
-
position:absolute;
|
84 |
-
top:-4px;
|
85 |
-
bottom: -4px;
|
86 |
-
width: 6px;
|
87 |
-
left: 50%;
|
88 |
-
cursor: pointer;
|
89 |
-
border: 1px solid black;
|
90 |
-
background: white;
|
91 |
-
opacity: .8;
|
92 |
-
}
|
93 |
-
.sp-alpha {
|
94 |
-
display: none;
|
95 |
-
position: absolute;
|
96 |
-
bottom: -14px;
|
97 |
-
right: 0;
|
98 |
-
left: 0;
|
99 |
-
height: 8px;
|
100 |
-
}
|
101 |
-
.sp-alpha-inner {
|
102 |
-
border: solid 1px #333;
|
103 |
-
}
|
104 |
-
|
105 |
-
.sp-clear {
|
106 |
-
display: none;
|
107 |
-
}
|
108 |
-
|
109 |
-
.sp-clear.sp-clear-display {
|
110 |
-
background-position: center;
|
111 |
-
}
|
112 |
-
|
113 |
-
.sp-clear-enabled .sp-clear {
|
114 |
-
display: block;
|
115 |
-
position:absolute;
|
116 |
-
top:0px;
|
117 |
-
right:0;
|
118 |
-
bottom:0;
|
119 |
-
left:84%;
|
120 |
-
height: 28px;
|
121 |
-
}
|
122 |
-
|
123 |
-
/* Don't allow text selection */
|
124 |
-
.sp-container, .sp-replacer, .sp-preview, .sp-dragger, .sp-slider, .sp-alpha, .sp-clear, .sp-alpha-handle, .sp-container.sp-dragging .sp-input, .sp-container button {
|
125 |
-
-webkit-user-select:none;
|
126 |
-
-moz-user-select: -moz-none;
|
127 |
-
-o-user-select:none;
|
128 |
-
user-select: none;
|
129 |
-
}
|
130 |
-
|
131 |
-
.sp-container.sp-input-disabled .sp-input-container {
|
132 |
-
display: none;
|
133 |
-
}
|
134 |
-
.sp-container.sp-buttons-disabled .sp-button-container {
|
135 |
-
display: none;
|
136 |
-
}
|
137 |
-
.sp-container.sp-palette-buttons-disabled .sp-palette-button-container {
|
138 |
-
display: none;
|
139 |
-
}
|
140 |
-
.sp-palette-only .sp-picker-container {
|
141 |
-
display: none;
|
142 |
-
}
|
143 |
-
.sp-palette-disabled .sp-palette-container {
|
144 |
-
display: none;
|
145 |
-
}
|
146 |
-
|
147 |
-
.sp-initial-disabled .sp-initial {
|
148 |
-
display: none;
|
149 |
-
}
|
150 |
-
|
151 |
-
|
152 |
-
/* Gradients for hue, saturation and value instead of images. Not pretty... but it works */
|
153 |
-
.sp-sat {
|
154 |
-
background-image: -webkit-gradient(linear, 0 0, 100% 0, from(#FFF), to(rgba(204, 154, 129, 0)));
|
155 |
-
background-image: -webkit-linear-gradient(left, #FFF, rgba(204, 154, 129, 0));
|
156 |
-
background-image: -moz-linear-gradient(left, #fff, rgba(204, 154, 129, 0));
|
157 |
-
background-image: -o-linear-gradient(left, #fff, rgba(204, 154, 129, 0));
|
158 |
-
background-image: -ms-linear-gradient(left, #fff, rgba(204, 154, 129, 0));
|
159 |
-
background-image: linear-gradient(to right, #fff, rgba(204, 154, 129, 0));
|
160 |
-
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType = 1, startColorstr=#FFFFFFFF, endColorstr=#00CC9A81)";
|
161 |
-
filter : progid:DXImageTransform.Microsoft.gradient(GradientType = 1, startColorstr='#FFFFFFFF', endColorstr='#00CC9A81');
|
162 |
-
}
|
163 |
-
.sp-val {
|
164 |
-
background-image: -webkit-gradient(linear, 0 100%, 0 0, from(#000000), to(rgba(204, 154, 129, 0)));
|
165 |
-
background-image: -webkit-linear-gradient(bottom, #000000, rgba(204, 154, 129, 0));
|
166 |
-
background-image: -moz-linear-gradient(bottom, #000, rgba(204, 154, 129, 0));
|
167 |
-
background-image: -o-linear-gradient(bottom, #000, rgba(204, 154, 129, 0));
|
168 |
-
background-image: -ms-linear-gradient(bottom, #000, rgba(204, 154, 129, 0));
|
169 |
-
background-image: linear-gradient(to top, #000, rgba(204, 154, 129, 0));
|
170 |
-
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00CC9A81, endColorstr=#FF000000)";
|
171 |
-
filter : progid:DXImageTransform.Microsoft.gradient(startColorstr='#00CC9A81', endColorstr='#FF000000');
|
172 |
-
}
|
173 |
-
|
174 |
-
.sp-hue {
|
175 |
-
background: -moz-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
|
176 |
-
background: -ms-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
|
177 |
-
background: -o-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
|
178 |
-
background: -webkit-gradient(linear, left top, left bottom, from(#ff0000), color-stop(0.17, #ffff00), color-stop(0.33, #00ff00), color-stop(0.5, #00ffff), color-stop(0.67, #0000ff), color-stop(0.83, #ff00ff), to(#ff0000));
|
179 |
-
background: -webkit-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
|
180 |
-
background: linear-gradient(to bottom, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
|
181 |
-
}
|
182 |
-
|
183 |
-
/* IE filters do not support multiple color stops.
|
184 |
-
Generate 6 divs, line them up, and do two color gradients for each.
|
185 |
-
Yes, really.
|
186 |
-
*/
|
187 |
-
.sp-1 {
|
188 |
-
height:17%;
|
189 |
-
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0000', endColorstr='#ffff00');
|
190 |
-
}
|
191 |
-
.sp-2 {
|
192 |
-
height:16%;
|
193 |
-
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffff00', endColorstr='#00ff00');
|
194 |
-
}
|
195 |
-
.sp-3 {
|
196 |
-
height:17%;
|
197 |
-
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00ff00', endColorstr='#00ffff');
|
198 |
-
}
|
199 |
-
.sp-4 {
|
200 |
-
height:17%;
|
201 |
-
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00ffff', endColorstr='#0000ff');
|
202 |
-
}
|
203 |
-
.sp-5 {
|
204 |
-
height:16%;
|
205 |
-
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0000ff', endColorstr='#ff00ff');
|
206 |
-
}
|
207 |
-
.sp-6 {
|
208 |
-
height:17%;
|
209 |
-
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff00ff', endColorstr='#ff0000');
|
210 |
-
}
|
211 |
-
|
212 |
-
.sp-hidden {
|
213 |
-
display: none !important;
|
214 |
-
}
|
215 |
-
|
216 |
-
/* Clearfix hack */
|
217 |
-
.sp-cf:before, .sp-cf:after { content: ""; display: table; }
|
218 |
-
.sp-cf:after { clear: both; }
|
219 |
-
.sp-cf { *zoom: 1; }
|
220 |
-
|
221 |
-
/* Mobile devices, make hue slider bigger so it is easier to slide */
|
222 |
-
@media (max-device-width: 480px) {
|
223 |
-
.sp-color { right: 40%; }
|
224 |
-
.sp-hue { left: 63%; }
|
225 |
-
.sp-fill { padding-top: 60%; }
|
226 |
-
}
|
227 |
-
.sp-dragger {
|
228 |
-
border-radius: 5px;
|
229 |
-
height: 5px;
|
230 |
-
width: 5px;
|
231 |
-
border: 1px solid #fff;
|
232 |
-
background: #000;
|
233 |
-
cursor: pointer;
|
234 |
-
position:absolute;
|
235 |
-
top:0;
|
236 |
-
left: 0;
|
237 |
-
}
|
238 |
-
.sp-slider {
|
239 |
-
position: absolute;
|
240 |
-
top:0;
|
241 |
-
cursor:pointer;
|
242 |
-
height: 3px;
|
243 |
-
left: -1px;
|
244 |
-
right: -1px;
|
245 |
-
border: 1px solid #000;
|
246 |
-
background: white;
|
247 |
-
opacity: .8;
|
248 |
-
}
|
249 |
-
|
250 |
-
/*
|
251 |
-
Theme authors:
|
252 |
-
Here are the basic themeable display options (colors, fonts, global widths).
|
253 |
-
See http://bgrins.github.io/spectrum/themes/ for instructions.
|
254 |
-
*/
|
255 |
-
|
256 |
-
.sp-container {
|
257 |
-
border-radius: 0;
|
258 |
-
background-color: #ECECEC;
|
259 |
-
border: solid 1px #f0c49B;
|
260 |
-
padding: 0;
|
261 |
-
}
|
262 |
-
.sp-container, .sp-container button, .sp-container input, .sp-color, .sp-hue, .sp-clear {
|
263 |
-
font: normal 12px "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif;
|
264 |
-
-webkit-box-sizing: border-box;
|
265 |
-
-moz-box-sizing: border-box;
|
266 |
-
-ms-box-sizing: border-box;
|
267 |
-
box-sizing: border-box;
|
268 |
-
}
|
269 |
-
.sp-top {
|
270 |
-
margin-bottom: 3px;
|
271 |
-
}
|
272 |
-
.sp-color, .sp-hue, .sp-clear {
|
273 |
-
border: solid 1px #666;
|
274 |
-
}
|
275 |
-
|
276 |
-
/* Input */
|
277 |
-
.sp-input-container {
|
278 |
-
float:right;
|
279 |
-
width: 100px;
|
280 |
-
margin-bottom: 4px;
|
281 |
-
}
|
282 |
-
.sp-initial-disabled .sp-input-container {
|
283 |
-
width: 100%;
|
284 |
-
}
|
285 |
-
.sp-input {
|
286 |
-
font-size: 12px !important;
|
287 |
-
border: 1px inset;
|
288 |
-
padding: 4px 5px;
|
289 |
-
margin: 0;
|
290 |
-
width: 100%;
|
291 |
-
background:transparent;
|
292 |
-
border-radius: 3px;
|
293 |
-
color: #222;
|
294 |
-
}
|
295 |
-
.sp-input:focus {
|
296 |
-
border: 1px solid orange;
|
297 |
-
}
|
298 |
-
.sp-input.sp-validation-error {
|
299 |
-
border: 1px solid red;
|
300 |
-
background: #fdd;
|
301 |
-
}
|
302 |
-
.sp-picker-container , .sp-palette-container {
|
303 |
-
float:left;
|
304 |
-
position: relative;
|
305 |
-
padding: 10px;
|
306 |
-
padding-bottom: 300px;
|
307 |
-
margin-bottom: -290px;
|
308 |
-
}
|
309 |
-
.sp-picker-container {
|
310 |
-
width: 172px;
|
311 |
-
border-left: solid 1px #fff;
|
312 |
-
}
|
313 |
-
|
314 |
-
/* Palettes */
|
315 |
-
.sp-palette-container {
|
316 |
-
border-right: solid 1px #ccc;
|
317 |
-
}
|
318 |
-
|
319 |
-
.sp-palette-only .sp-palette-container {
|
320 |
-
border: 0;
|
321 |
-
}
|
322 |
-
|
323 |
-
.sp-palette .sp-thumb-el {
|
324 |
-
display: block;
|
325 |
-
position:relative;
|
326 |
-
float:left;
|
327 |
-
width: 24px;
|
328 |
-
height: 15px;
|
329 |
-
margin: 3px;
|
330 |
-
cursor: pointer;
|
331 |
-
border:solid 2px transparent;
|
332 |
-
}
|
333 |
-
.sp-palette .sp-thumb-el:hover, .sp-palette .sp-thumb-el.sp-thumb-active {
|
334 |
-
border-color: orange;
|
335 |
-
}
|
336 |
-
.sp-thumb-el {
|
337 |
-
position:relative;
|
338 |
-
}
|
339 |
-
|
340 |
-
/* Initial */
|
341 |
-
.sp-initial {
|
342 |
-
float: left;
|
343 |
-
border: solid 1px #333;
|
344 |
-
}
|
345 |
-
.sp-initial span {
|
346 |
-
width: 30px;
|
347 |
-
height: 25px;
|
348 |
-
border:none;
|
349 |
-
display:block;
|
350 |
-
float:left;
|
351 |
-
margin:0;
|
352 |
-
}
|
353 |
-
|
354 |
-
.sp-initial .sp-clear-display {
|
355 |
-
background-position: center;
|
356 |
-
}
|
357 |
-
|
358 |
-
/* Buttons */
|
359 |
-
.sp-palette-button-container,
|
360 |
-
.sp-button-container {
|
361 |
-
float: right;
|
362 |
-
}
|
363 |
-
|
364 |
-
/* Replacer (the little preview div that shows up instead of the <input>) */
|
365 |
-
.sp-replacer {
|
366 |
-
margin:0;
|
367 |
-
overflow:hidden;
|
368 |
-
cursor:pointer;
|
369 |
-
padding: 4px;
|
370 |
-
display:inline-block;
|
371 |
-
*zoom: 1;
|
372 |
-
*display: inline;
|
373 |
-
border: solid 1px #91765d;
|
374 |
-
background: #eee;
|
375 |
-
color: #333;
|
376 |
-
vertical-align: middle;
|
377 |
-
}
|
378 |
-
.sp-replacer:hover, .sp-replacer.sp-active {
|
379 |
-
border-color: #F0C49B;
|
380 |
-
color: #111;
|
381 |
-
}
|
382 |
-
.sp-replacer.sp-disabled {
|
383 |
-
cursor:default;
|
384 |
-
border-color: silver;
|
385 |
-
color: silver;
|
386 |
-
}
|
387 |
-
.sp-dd {
|
388 |
-
padding: 2px 0;
|
389 |
-
height: 16px;
|
390 |
-
line-height: 16px;
|
391 |
-
float:left;
|
392 |
-
font-size:10px;
|
393 |
-
}
|
394 |
-
.sp-preview {
|
395 |
-
position:relative;
|
396 |
-
width:25px;
|
397 |
-
height: 20px;
|
398 |
-
border: solid 1px #222;
|
399 |
-
margin-right: 5px;
|
400 |
-
float:left;
|
401 |
-
z-index: 0;
|
402 |
-
}
|
403 |
-
|
404 |
-
.sp-palette {
|
405 |
-
*width: 220px;
|
406 |
-
max-width: 220px;
|
407 |
-
}
|
408 |
-
.sp-palette .sp-thumb-el {
|
409 |
-
width:16px;
|
410 |
-
height: 16px;
|
411 |
-
margin:2px 1px;
|
412 |
-
border: solid 1px #d0d0d0;
|
413 |
-
}
|
414 |
-
|
415 |
-
.sp-container {
|
416 |
-
padding-bottom:0;
|
417 |
-
}
|
418 |
-
|
419 |
-
|
420 |
-
/* Buttons: http://hellohappy.org/css3-buttons/ */
|
421 |
-
.sp-container button {
|
422 |
-
background-color: #eeeeee;
|
423 |
-
background-image: -webkit-linear-gradient(top, #eeeeee, #cccccc);
|
424 |
-
background-image: -moz-linear-gradient(top, #eeeeee, #cccccc);
|
425 |
-
background-image: -ms-linear-gradient(top, #eeeeee, #cccccc);
|
426 |
-
background-image: -o-linear-gradient(top, #eeeeee, #cccccc);
|
427 |
-
background-image: linear-gradient(to bottom, #eeeeee, #cccccc);
|
428 |
-
border: 1px solid #ccc;
|
429 |
-
border-bottom: 1px solid #bbb;
|
430 |
-
border-radius: 3px;
|
431 |
-
color: #333;
|
432 |
-
font-size: 14px;
|
433 |
-
line-height: 1;
|
434 |
-
padding: 5px 4px;
|
435 |
-
text-align: center;
|
436 |
-
text-shadow: 0 1px 0 #eee;
|
437 |
-
vertical-align: middle;
|
438 |
-
}
|
439 |
-
.sp-container button:hover {
|
440 |
-
background-color: #dddddd;
|
441 |
-
background-image: -webkit-linear-gradient(top, #dddddd, #bbbbbb);
|
442 |
-
background-image: -moz-linear-gradient(top, #dddddd, #bbbbbb);
|
443 |
-
background-image: -ms-linear-gradient(top, #dddddd, #bbbbbb);
|
444 |
-
background-image: -o-linear-gradient(top, #dddddd, #bbbbbb);
|
445 |
-
background-image: linear-gradient(to bottom, #dddddd, #bbbbbb);
|
446 |
-
border: 1px solid #bbb;
|
447 |
-
border-bottom: 1px solid #999;
|
448 |
-
cursor: pointer;
|
449 |
-
text-shadow: 0 1px 0 #ddd;
|
450 |
-
}
|
451 |
-
.sp-container button:active {
|
452 |
-
border: 1px solid #aaa;
|
453 |
-
border-bottom: 1px solid #888;
|
454 |
-
-webkit-box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;
|
455 |
-
-moz-box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;
|
456 |
-
-ms-box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;
|
457 |
-
-o-box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;
|
458 |
-
box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;
|
459 |
-
}
|
460 |
-
.sp-cancel {
|
461 |
-
font-size: 11px;
|
462 |
-
color: #d93f3f !important;
|
463 |
-
margin:0;
|
464 |
-
padding:2px;
|
465 |
-
margin-right: 5px;
|
466 |
-
vertical-align: middle;
|
467 |
-
text-decoration:none;
|
468 |
-
|
469 |
-
}
|
470 |
-
.sp-cancel:hover {
|
471 |
-
color: #d93f3f !important;
|
472 |
-
text-decoration: underline;
|
473 |
-
}
|
474 |
-
|
475 |
-
|
476 |
-
.sp-palette span:hover, .sp-palette span.sp-thumb-active {
|
477 |
-
border-color: #000;
|
478 |
-
}
|
479 |
-
|
480 |
-
.sp-preview, .sp-alpha, .sp-thumb-el {
|
481 |
-
position:relative;
|
482 |
-
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCGIasIUwhT25BVBADtzYNYrHvv4gAAAABJRU5ErkJggg==);
|
483 |
-
}
|
484 |
-
.sp-preview-inner, .sp-alpha-inner, .sp-thumb-inner {
|
485 |
-
display:block;
|
486 |
-
position:absolute;
|
487 |
-
top:0;left:0;bottom:0;right:0;
|
488 |
-
}
|
489 |
-
|
490 |
-
.sp-palette .sp-thumb-inner {
|
491 |
-
background-position: 50% 50%;
|
492 |
-
background-repeat: no-repeat;
|
493 |
-
}
|
494 |
-
|
495 |
-
.sp-palette .sp-thumb-light.sp-thumb-active .sp-thumb-inner {
|
496 |
-
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAIVJREFUeNpiYBhsgJFMffxAXABlN5JruT4Q3wfi/0DsT64h8UD8HmpIPCWG/KemIfOJCUB+Aoacx6EGBZyHBqI+WsDCwuQ9mhxeg2A210Ntfo8klk9sOMijaURm7yc1UP2RNCMbKE9ODK1HM6iegYLkfx8pligC9lCD7KmRof0ZhjQACDAAceovrtpVBRkAAAAASUVORK5CYII=);
|
497 |
-
}
|
498 |
-
|
499 |
-
.sp-palette .sp-thumb-dark.sp-thumb-active .sp-thumb-inner {
|
500 |
-
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjEwMPRyoQAAAMdJREFUOE+tkgsNwzAMRMugEAahEAahEAZhEAqlEAZhEAohEAYh81X2dIm8fKpEspLGvudPOsUYpxE2BIJCroJmEW9qJ+MKaBFhEMNabSy9oIcIPwrB+afvAUFoK4H0tMaQ3XtlrggDhOVVMuT4E5MMG0FBbCEYzjYT7OxLEvIHQLY2zWwQ3D+9luyOQTfKDiFD3iUIfPk8VqrKjgAiSfGFPecrg6HN6m/iBcwiDAo7WiBeawa+Kwh7tZoSCGLMqwlSAzVDhoK+6vH4G0P5wdkAAAAASUVORK5CYII=);
|
501 |
-
}
|
502 |
-
|
503 |
-
.sp-clear-display {
|
504 |
-
background-repeat:no-repeat;
|
505 |
-
background-position: center;
|
506 |
-
background-image: url(data:image/gif;base64,R0lGODlhFAAUAPcAAAAAAJmZmZ2dnZ6enqKioqOjo6SkpKWlpaampqenp6ioqKmpqaqqqqurq/Hx8fLy8vT09PX19ff39/j4+Pn5+fr6+vv7+wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAP8ALAAAAAAUABQAAAihAP9FoPCvoMGDBy08+EdhQAIJCCMybCDAAYUEARBAlFiQQoMABQhKUJBxY0SPICEYHBnggEmDKAuoPMjS5cGYMxHW3IiT478JJA8M/CjTZ0GgLRekNGpwAsYABHIypcAgQMsITDtWJYBR6NSqMico9cqR6tKfY7GeBCuVwlipDNmefAtTrkSzB1RaIAoXodsABiZAEFB06gIBWC1mLVgBa0AAOw==);
|
507 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/simple-admin-pages/img/options-asset-info.png
DELETED
Binary file
|
lib/simple-admin-pages/img/options-asset-lock.png
DELETED
Binary file
|
lib/simple-admin-pages/img/options-asset-star.png
DELETED
Binary file
|
lib/simple-admin-pages/img/options-asset-starX2.png
DELETED
Binary file
|
lib/simple-admin-pages/js/admin-settings.js
DELETED
@@ -1,78 +0,0 @@
|
|
1 |
-
jQuery(document).ready(function() {
|
2 |
-
jQuery('.sap-spectrum').spectrum({
|
3 |
-
showInput: true,
|
4 |
-
showInitial: true,
|
5 |
-
preferredFormat: "hex",
|
6 |
-
allowEmpty: true
|
7 |
-
});
|
8 |
-
|
9 |
-
jQuery('.sap-spectrum').css('display', 'inline');
|
10 |
-
|
11 |
-
jQuery('.sap-spectrum').on('change', function() {
|
12 |
-
if (jQuery(this).val() != "") {
|
13 |
-
jQuery(this).css('background', jQuery(this).val());
|
14 |
-
var rgb = EWD_SAP_hexToRgb(jQuery(this).val());
|
15 |
-
var Brightness = (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;
|
16 |
-
if (Brightness < 100) {jQuery(this).css('color', '#ffffff');}
|
17 |
-
else {jQuery(this).css('color', '#000000');}
|
18 |
-
}
|
19 |
-
else {
|
20 |
-
jQuery(this).css('background', 'none');
|
21 |
-
}
|
22 |
-
});
|
23 |
-
|
24 |
-
jQuery('.sap-spectrum').each(function() {
|
25 |
-
if (jQuery(this).val() != "") {
|
26 |
-
jQuery(this).css('background', jQuery(this).val());
|
27 |
-
var rgb = EWD_SAP_hexToRgb(jQuery(this).val());
|
28 |
-
var Brightness = (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;
|
29 |
-
if (Brightness < 100) {jQuery(this).css('color', '#ffffff');}
|
30 |
-
else {jQuery(this).css('color', '#000000');}
|
31 |
-
}
|
32 |
-
});
|
33 |
-
});
|
34 |
-
|
35 |
-
function EWD_SAP_hexToRgb(hex) {
|
36 |
-
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
37 |
-
return result ? {
|
38 |
-
r: parseInt(result[1], 16),
|
39 |
-
g: parseInt(result[2], 16),
|
40 |
-
b: parseInt(result[3], 16)
|
41 |
-
} : null;
|
42 |
-
}
|
43 |
-
|
44 |
-
//OPTIONS PAGE YES/NO TOGGLE SWITCHES
|
45 |
-
jQuery(document).ready(function($){
|
46 |
-
$('.sap-admin-option-toggle').on('change', function() {
|
47 |
-
var Input_Name = $(this).data('inputname'); console.log(Input_Name);
|
48 |
-
if ($(this).is(':checked')) {
|
49 |
-
$('input[name="' + Input_Name + '"][value="1"]').prop('checked', true).trigger('change');
|
50 |
-
$('input[name="' + Input_Name + '"][value=""]').prop('checked', false);
|
51 |
-
}
|
52 |
-
else {
|
53 |
-
$('input[name="' + Input_Name + '"][value="1"]').prop('checked', false).trigger('change');
|
54 |
-
$('input[name="' + Input_Name + '"][value=""]').prop('checked', true);
|
55 |
-
}
|
56 |
-
});
|
57 |
-
});
|
58 |
-
|
59 |
-
/*LOCK BOXES*/
|
60 |
-
jQuery( document ).ready( function() {
|
61 |
-
setTimeout( resizeLockdownBoxes, 750 );
|
62 |
-
jQuery( window ).on( 'resize', resizeLockdownBoxes );
|
63 |
-
});
|
64 |
-
|
65 |
-
function resizeLockdownBoxes() {
|
66 |
-
jQuery('.sap-premium-options-table-overlay').each(function(){
|
67 |
-
|
68 |
-
var eachProTableOverlay = jQuery( this );
|
69 |
-
var associatedTable = eachProTableOverlay.next();
|
70 |
-
associatedTable.css('min-height', '260px');
|
71 |
-
var tablePosition = associatedTable.position();
|
72 |
-
|
73 |
-
eachProTableOverlay.css( 'width', associatedTable.outerWidth(true) + 'px' );
|
74 |
-
eachProTableOverlay.css( 'height', associatedTable.outerHeight() + 'px' );
|
75 |
-
eachProTableOverlay.css( 'left', tablePosition.left + 'px' );
|
76 |
-
eachProTableOverlay.css( 'top', tablePosition.top + 'px' );
|
77 |
-
});
|
78 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/simple-admin-pages/js/file_upload.js
DELETED
@@ -1,41 +0,0 @@
|
|
1 |
-
jQuery(document).ready(function($){
|
2 |
-
|
3 |
-
var custom_uploader;
|
4 |
-
var input_field;
|
5 |
-
var preview_value;
|
6 |
-
|
7 |
-
jQuery( '.sap-file-upload-button' ).click(function(e) {
|
8 |
-
|
9 |
-
e.preventDefault();
|
10 |
-
|
11 |
-
input_field = jQuery( this ).parent().find( 'input[type="hidden"]' );
|
12 |
-
preview_value = jQuery( this ).parent().find( '.sap-file-upload-preview-value' );
|
13 |
-
|
14 |
-
//If the uploader object has already been created, reopen the dialog
|
15 |
-
if ( custom_uploader ) {
|
16 |
-
custom_uploader.open();
|
17 |
-
return;
|
18 |
-
}
|
19 |
-
|
20 |
-
//Extend the wp.media object
|
21 |
-
custom_uploader = wp.media.frames.file_frame = wp.media({
|
22 |
-
title: 'Choose File',
|
23 |
-
button: {
|
24 |
-
text: 'Choose File'
|
25 |
-
},
|
26 |
-
multiple: false
|
27 |
-
});
|
28 |
-
|
29 |
-
//When a file is selected, grab the URL and set it as the text field's value
|
30 |
-
custom_uploader.on( 'select', function() {
|
31 |
-
|
32 |
-
attachment = custom_uploader.state().get( 'selection' ).first().toJSON();
|
33 |
-
input_field.val( attachment.url );
|
34 |
-
preview_value.html( attachment.url );
|
35 |
-
});
|
36 |
-
|
37 |
-
//Open the uploader dialog
|
38 |
-
custom_uploader.open();
|
39 |
-
|
40 |
-
});
|
41 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/simple-admin-pages/js/image.js
DELETED
@@ -1,53 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* Javascript functions for Image component
|
3 |
-
*
|
4 |
-
* @package Simple Admin Pages
|
5 |
-
*/
|
6 |
-
|
7 |
-
jQuery(document).ready(function ($) {
|
8 |
-
|
9 |
-
var current_setting_id;
|
10 |
-
|
11 |
-
function openMediaManager(e) {
|
12 |
-
e.stopPropagation();
|
13 |
-
e.preventDefault();
|
14 |
-
current_setting_id = $( this ).parents( '.sap-image-wrapper' ).data( 'id' );
|
15 |
-
wp.media.frames.sap_frame.open();
|
16 |
-
}
|
17 |
-
|
18 |
-
function setImage( setting_id, image_id, image_url ) {
|
19 |
-
var $control = $( '.sap-image-wrapper[data-id="' + setting_id + '"]' );
|
20 |
-
$control.find( 'img' ).attr( 'src', image_url );
|
21 |
-
$control.find( '#' + setting_id ).val( image_id );
|
22 |
-
$control.removeClass( 'sap-image-wrapper-no-image' ).addClass( 'sap-image-wrapper-has-image' );
|
23 |
-
}
|
24 |
-
|
25 |
-
function removeImage(e) {
|
26 |
-
e.stopPropagation();
|
27 |
-
e.preventDefault();
|
28 |
-
var $control = $( this ).parents( '.sap-image-wrapper' );
|
29 |
-
$control.find( 'img' ).attr( 'src', '' );
|
30 |
-
$control.find( '#' + $control.data( 'id' ) ).val( '' );
|
31 |
-
$control.removeClass( 'sap-image-wrapper-has-image' ).addClass( 'sap-image-wrapper-no-image' );
|
32 |
-
}
|
33 |
-
|
34 |
-
wp.media.frames.sap_frame = wp.media( {
|
35 |
-
title: 'Select image',
|
36 |
-
multiple: false,
|
37 |
-
library: {
|
38 |
-
type: 'image',
|
39 |
-
},
|
40 |
-
button: {
|
41 |
-
text: 'Use selected image',
|
42 |
-
},
|
43 |
-
} );
|
44 |
-
|
45 |
-
wp.media.frames.sap_frame.on( 'select', function() {
|
46 |
-
var image = wp.media.frames.sap_frame.state().get( 'selection' ).first().toJSON();
|
47 |
-
setImage( current_setting_id, image.id, image.url );
|
48 |
-
});
|
49 |
-
|
50 |
-
$( '.sap-image-wrapper .sap-image-btn-add, .sap-image-wrapper .sap-image-btn-change' ).click( openMediaManager );
|
51 |
-
|
52 |
-
$( '.sap-image-wrapper .sap-image-btn-remove' ).click( removeImage );
|
53 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/simple-admin-pages/js/infinite_table.js
CHANGED
@@ -1,83 +1,90 @@
|
|
1 |
-
/**
|
2 |
-
* Javascript functions for Infinite Table
|
3 |
-
*
|
4 |
-
* @package Simple Admin Pages
|
5 |
-
*/
|
6 |
-
|
7 |
jQuery(document).ready(function ($) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
var _form = $(this), ignore;
|
21 |
-
|
22 |
-
$('.sap-infinite-table').each( function() {
|
23 |
-
|
24 |
-
var main_input = $(this).find('#sap-infinite-table-main-input');
|
25 |
-
|
26 |
-
var main_input_val = [];
|
27 |
-
|
28 |
-
$(this).find('table tbody tr').each((idx_tr, tr) => {
|
29 |
-
let record = {}; ignore = false;
|
30 |
-
|
31 |
-
$(tr).find('td').each((idx_td, td) => {
|
32 |
-
let elm = $(td).find('select, input');
|
33 |
-
|
34 |
-
ignore = 'cf_field_name' == elm.data('name') && elm.val().length < 1 ? true : ignore;
|
35 |
-
|
36 |
-
if(!ignore) {
|
37 |
-
record[elm.data('name')] = elm.val();
|
38 |
-
}
|
39 |
-
});
|
40 |
-
|
41 |
-
!ignore ? main_input_val.push(record) : null;
|
42 |
-
});
|
43 |
-
|
44 |
-
main_input.val(JSON.stringify(main_input_val));
|
45 |
-
|
46 |
-
});
|
47 |
-
});
|
48 |
-
|
49 |
-
// Add new field
|
50 |
-
$('.sap-infinite-table-add-row .sap-new-admin-add-button').on('click', function (ev) {
|
51 |
-
let _template_tr = $( this ).parents( 'tfoot' ).find( '.sap-infinite-table-row-template' ).clone();
|
52 |
-
_template_tr
|
53 |
-
.hide()
|
54 |
-
.removeClass()
|
55 |
-
.addClass('sap-infinite-table-row');
|
56 |
-
$( this ).parents( 'table' ).first().find( 'tbody' ).append(_template_tr);
|
57 |
-
_template_tr.fadeIn('fast');
|
58 |
-
_template_tr.find('[data-name="cf_options"]').prop('readonly', true);
|
59 |
-
});
|
60 |
-
|
61 |
-
// update options field
|
62 |
-
$(document).on('change', '.sap-infinite-table-row [data-name="cf_type"]', function (ev) {
|
63 |
-
let parent_tr = $(this).parents('tr').eq(0);
|
64 |
-
|
65 |
-
if(!['dropdown', 'checkbox', 'radio'].includes($(this).val())) {
|
66 |
-
parent_tr.find('[data-name="cf_options"]').val('').prop('readonly', true);
|
67 |
-
}
|
68 |
-
else {
|
69 |
-
parent_tr.find('[data-name="cf_options"]').prop('readonly', false);
|
70 |
-
}
|
71 |
-
});
|
72 |
-
|
73 |
-
// Remvoe field
|
74 |
-
$(document).on('click', '.sap-infinite-table-row .sap-infinite-table-row-delete', function (ev) {
|
75 |
-
let parent_tr = $(this).parents('tr').eq(0);
|
76 |
-
parent_tr.fadeOut('fast', () => parent_tr.remove());
|
77 |
-
});
|
78 |
-
|
79 |
-
$('.sap-infinite-table table tbody').sortable({
|
80 |
-
axis: 'y'
|
81 |
-
});
|
82 |
-
|
83 |
-
})
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
jQuery(document).ready(function ($) {
|
2 |
+
jQuery( '.sap-infinite-table-add-row' ).on( 'click', function() {
|
3 |
+
var max_row = findInfiniteTableMaxRow();
|
4 |
+
|
5 |
+
var tfoot = jQuery( this ).closest( 'tfoot' );
|
6 |
+
var tbody = jQuery( this ).closest( '.sap-infinite-table' ).find( 'tbody' );
|
7 |
+
|
8 |
+
tfoot.find( '.sap-inifite-table-row-template' ).clone().appendTo( tbody );
|
9 |
+
|
10 |
+
jQuery( '.sap-infinite-table tbody .sap-inifite-table-row-template' ).removeClass( 'sap-inifite-table-row-template' ).addClass( 'sap-inifinite-table-row' ).addClass( 'sap-new-infinite-row' );
|
11 |
+
jQuery( '.sap-new-infinite-row' ).data('rowid', max_row + 1);
|
12 |
+
jQuery( '.sap-new-infinite-row input, .sap-new-infinite-row select, .sap-new-infinite-row textarea' ).each(function() {
|
13 |
+
jQuery(this).attr( 'name', jQuery(this).attr( 'name' ) + '_' + (max_row + 1));
|
14 |
+
});
|
15 |
+
|
16 |
+
jQuery( '.sap-new-infinite-row' ).find('.sap-infinite-table-id').val( max_row + 1 );
|
17 |
+
jQuery( '.sap-new-infinite-row' ).find('.sap-infinite-table-id-html').html( max_row + 1 );
|
18 |
+
|
19 |
+
jQuery( '.sap-new-infinite-row' ).removeClass( 'sap-new-infinite-row' ).removeClass( 'sap-hidden' );
|
20 |
+
|
21 |
+
setInfiniteTableDeleteHandlers();
|
22 |
+
setInfiniteTableUpdateHandlers();
|
23 |
+
});
|
24 |
+
|
25 |
+
setInfiniteTableDeleteHandlers();
|
26 |
+
setInfiniteTableUpdateHandlers();
|
27 |
+
|
28 |
+
});
|
29 |
+
|
30 |
+
function findInfiniteTableMaxRow() {
|
31 |
+
var max_row = 0;
|
32 |
+
|
33 |
+
jQuery( '.sap-inifinite-table-row' ).each(function() {
|
34 |
+
max_row = Math.max(jQuery(this).data( 'rowid' ), max_row);
|
35 |
+
});
|
36 |
+
|
37 |
+
return max_row;
|
38 |
+
}
|
39 |
+
|
40 |
+
function setInfiniteTableDeleteHandlers() {
|
41 |
+
jQuery( '.sap-infinite-table-row-delete' ).off( 'click.delete_row' );
|
42 |
+
jQuery( '.sap-infinite-table-row-delete' ).on( 'click.delete_row', function() {
|
43 |
+
var table = jQuery( this ).closest( '.sap-infinite-table' );
|
44 |
+
var row = jQuery( this );
|
45 |
+
|
46 |
+
// give anything hooked into the delete action a chance to process before removing
|
47 |
+
setTimeout( function() {
|
48 |
+
row.parent().remove();
|
49 |
+
|
50 |
+
infiniteTableSaveData( table );
|
51 |
+
}, 200);
|
52 |
+
});
|
53 |
+
}
|
54 |
+
|
55 |
+
function setInfiniteTableUpdateHandlers() {
|
56 |
+
jQuery( '.sap-inifinite-table-row input, .sap-inifinite-table-row textarea' ).off( 'keyup.update_fields' );
|
57 |
+
jQuery( '.sap-inifinite-table-row input, .sap-inifinite-table-row textarea' ).on( 'keyup.update_fields', function() {
|
58 |
+
infiniteTableSaveData( jQuery( this ).closest( '.sap-infinite-table' ) );
|
59 |
+
});
|
60 |
+
|
61 |
+
jQuery( '.sap-inifinite-table-row input[type="number"]' ).off( 'click.update_fields' );
|
62 |
+
jQuery( '.sap-inifinite-table-row input[type="number"]' ).on( 'click.update_fields', function() {
|
63 |
+
infiniteTableSaveData( jQuery( this ).closest( '.sap-infinite-table' ) );
|
64 |
+
});
|
65 |
+
|
66 |
+
jQuery( '.sap-inifinite-table-row select' ).off( 'change.update_fields' );
|
67 |
+
jQuery( '.sap-inifinite-table-row select' ).on( 'change.update_fields', function() {
|
68 |
+
infiniteTableSaveData( jQuery( this ).closest( '.sap-infinite-table' ) );
|
69 |
+
});
|
70 |
+
}
|
71 |
+
|
72 |
+
function infiniteTableSaveData( table ) {
|
73 |
+
var fields = table.data( 'fieldids' ).split( ',' );
|
74 |
+
var data = [];
|
75 |
+
|
76 |
+
jQuery( table ).find( '.sap-inifinite-table-row' ).each(function() {
|
77 |
+
var row_id = jQuery(this).data('rowid');
|
78 |
+
var row_data = {};
|
79 |
|
80 |
+
jQuery(fields).each(function(index, field) {
|
81 |
+
if ( jQuery( 'input[name="' + field + '_' + row_id + '"]' ).length ) { row_data[field] = jQuery( 'input[name="' + field + '_' + row_id + '"]' ).val(); }
|
82 |
+
else if ( jQuery( 'select[name="' + field + '_' + row_id + '"]' ).length ) { row_data[field] = jQuery( 'select[name="' + field + '_' + row_id + '"]' ).val(); }
|
83 |
+
else if ( jQuery( 'textarea[name="' + field + '_' + row_id + '"]' ).length ) { row_data[field] = jQuery( 'textarea[name="' + field + '_' + row_id + '"]' ).val(); }
|
84 |
+
});
|
85 |
+
|
86 |
+
data.push(row_data);
|
87 |
+
});
|
88 |
+
|
89 |
+
jQuery( table ).find( 'input[type="hidden"]:not( .sap-infinite-table-id )' ).val(JSON.stringify(data));
|
90 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/simple-admin-pages/js/ordering.js
DELETED
@@ -1,38 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* Javascript functions for Ordering Table
|
3 |
-
*
|
4 |
-
* @package Simple Admin Pages
|
5 |
-
*/
|
6 |
-
|
7 |
-
jQuery(document).ready(function ($) {
|
8 |
-
|
9 |
-
// process fields
|
10 |
-
$('.sap-parent-form').on('submit', function (ev) {
|
11 |
-
var _form = $(this), ignore;
|
12 |
-
|
13 |
-
$('.sap-ordering-table').each( function() {
|
14 |
-
|
15 |
-
var main_input = $(this).find('#sap-ordering-table-main-input');
|
16 |
-
|
17 |
-
var main_input_val = {};
|
18 |
-
|
19 |
-
$(this).find('table tbody tr').each((idx_tr, tr) => {
|
20 |
-
|
21 |
-
$(tr).find('td').each((idx_td, td) => {
|
22 |
-
let elm = $(td).find('input');
|
23 |
-
|
24 |
-
main_input_val[elm.val()] = $(td).find('span').html();
|
25 |
-
});
|
26 |
-
|
27 |
-
});
|
28 |
-
|
29 |
-
main_input.val(JSON.stringify(main_input_val));
|
30 |
-
|
31 |
-
});
|
32 |
-
});
|
33 |
-
|
34 |
-
$('.sap-ordering-table table tbody').sortable({
|
35 |
-
axis: 'y'
|
36 |
-
});
|
37 |
-
|
38 |
-
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/simple-admin-pages/js/scheduler.js
CHANGED
@@ -372,12 +372,18 @@ jQuery(document).ready(function ($) {
|
|
372 |
|
373 |
var scheduler = $(this).parent().siblings( '.sap-scheduler' );
|
374 |
var scheduler_id = scheduler.attr( 'id' );
|
375 |
-
var scheduler_settings = sap_scheduler.settings[ scheduler_id ];
|
376 |
scheduler.append( scheduler_settings.template.replace( /\[0\]/g, '[' + scheduler.children( '.sap-scheduler-rule' ).length + ']' ) );
|
377 |
sap_scheduler_register_datepicker( scheduler.last( '#' + scheduler_id + ' .sap-scheduler-rule' ).find( '.sap-scheduler-date-input input[type="text"]' ) );
|
378 |
sap_scheduler_register_timepicker( scheduler.last( '#' + scheduler_id + ' .sap-scheduler-rule' ).find( '.sap-scheduler-time-input input[type="text"]' ) );
|
379 |
sap_scheduler_register_events();
|
380 |
|
|
|
|
|
|
|
|
|
|
|
|
|
381 |
// Hide the add rule button if we've disabled multiple rules
|
382 |
if ( sap_scheduler.settings[scheduler_id].disable_multiple ) {
|
383 |
sap_scheduler_toggle_button( false, scheduler );
|
372 |
|
373 |
var scheduler = $(this).parent().siblings( '.sap-scheduler' );
|
374 |
var scheduler_id = scheduler.attr( 'id' );
|
375 |
+
var scheduler_settings = sap_scheduler.settings[ scheduler_id ];
|
376 |
scheduler.append( scheduler_settings.template.replace( /\[0\]/g, '[' + scheduler.children( '.sap-scheduler-rule' ).length + ']' ) );
|
377 |
sap_scheduler_register_datepicker( scheduler.last( '#' + scheduler_id + ' .sap-scheduler-rule' ).find( '.sap-scheduler-date-input input[type="text"]' ) );
|
378 |
sap_scheduler_register_timepicker( scheduler.last( '#' + scheduler_id + ' .sap-scheduler-rule' ).find( '.sap-scheduler-time-input input[type="text"]' ) );
|
379 |
sap_scheduler_register_events();
|
380 |
|
381 |
+
// display the "Time" section first if a new rule is being added
|
382 |
+
var schedule_time_selector = scheduler.last( '#' + scheduler_id + ' .sap-scheduler-rule' ).find('.sap-scheduler-rule').last().find('.sap-scheduler-time');
|
383 |
+
schedule_time_selector.removeClass('all-day').addClass('time-slot');
|
384 |
+
schedule_time_selector.find('.sap-selector').first().find('a[data-format="all-day"]').removeClass('selected');
|
385 |
+
schedule_time_selector.find('.sap-selector').first().find('a[data-format="time-slot"]').addClass('selected');
|
386 |
+
|
387 |
// Hide the add rule button if we've disabled multiple rules
|
388 |
if ( sap_scheduler.settings[scheduler_id].disable_multiple ) {
|
389 |
sap_scheduler_toggle_button( false, scheduler );
|
lib/simple-admin-pages/js/spectrum.js
DELETED
@@ -1,2317 +0,0 @@
|
|
1 |
-
// Spectrum Colorpicker v1.7.1
|
2 |
-
// https://github.com/bgrins/spectrum
|
3 |
-
// Author: Brian Grinstead
|
4 |
-
// License: MIT
|
5 |
-
|
6 |
-
(function (factory) {
|
7 |
-
"use strict";
|
8 |
-
|
9 |
-
if (typeof define === 'function' && define.amd) { // AMD
|
10 |
-
define(['jquery'], factory);
|
11 |
-
}
|
12 |
-
else if (typeof exports == "object" && typeof module == "object") { // CommonJS
|
13 |
-
module.exports = factory;
|
14 |
-
}
|
15 |
-
else { // Browser
|
16 |
-
factory(jQuery);
|
17 |
-
}
|
18 |
-
})(function($, undefined) {
|
19 |
-
"use strict";
|
20 |
-
|
21 |
-
var defaultOpts = {
|
22 |
-
|
23 |
-
// Callbacks
|
24 |
-
beforeShow: noop,
|
25 |
-
move: noop,
|
26 |
-
change: noop,
|
27 |
-
show: noop,
|
28 |
-
hide: noop,
|
29 |
-
|
30 |
-
// Options
|
31 |
-
color: false,
|
32 |
-
flat: false,
|
33 |
-
showInput: false,
|
34 |
-
allowEmpty: false,
|
35 |
-
showButtons: true,
|
36 |
-
clickoutFiresChange: true,
|
37 |
-
showInitial: false,
|
38 |
-
showPalette: false,
|
39 |
-
showPaletteOnly: false,
|
40 |
-
hideAfterPaletteSelect: false,
|
41 |
-
togglePaletteOnly: false,
|
42 |
-
showSelectionPalette: true,
|
43 |
-
localStorageKey: false,
|
44 |
-
appendTo: "body",
|
45 |
-
maxSelectionSize: 7,
|
46 |
-
cancelText: "cancel",
|
47 |
-
chooseText: "choose",
|
48 |
-
togglePaletteMoreText: "more",
|
49 |
-
togglePaletteLessText: "less",
|
50 |
-
clearText: "Clear Color Selection",
|
51 |
-
noColorSelectedText: "No Color Selected",
|
52 |
-
preferredFormat: false,
|
53 |
-
className: "", // Deprecated - use containerClassName and replacerClassName instead.
|
54 |
-
containerClassName: "",
|
55 |
-
replacerClassName: "",
|
56 |
-
showAlpha: false,
|
57 |
-
theme: "sp-light",
|
58 |
-
palette: [["#ffffff", "#000000", "#ff0000", "#ff8000", "#ffff00", "#008000", "#0000ff", "#4b0082", "#9400d3"]],
|
59 |
-
selectionPalette: [],
|
60 |
-
disabled: false,
|
61 |
-
offset: null
|
62 |
-
},
|
63 |
-
spectrums = [],
|
64 |
-
IE = !!/msie/i.exec( window.navigator.userAgent ),
|
65 |
-
rgbaSupport = (function() {
|
66 |
-
function contains( str, substr ) {
|
67 |
-
return !!~('' + str).indexOf(substr);
|
68 |
-
}
|
69 |
-
|
70 |
-
var elem = document.createElement('div');
|
71 |
-
var style = elem.style;
|
72 |
-
style.cssText = 'background-color:rgba(0,0,0,.5)';
|
73 |
-
return contains(style.backgroundColor, 'rgba') || contains(style.backgroundColor, 'hsla');
|
74 |
-
})(),
|
75 |
-
replaceInput = [
|
76 |
-
"<div class='sp-replacer'>",
|
77 |
-
"<div class='sp-preview'><div class='sp-preview-inner'></div></div>",
|
78 |
-
"<div class='sp-dd'>▼</div>",
|
79 |
-
"</div>"
|
80 |
-
].join(''),
|
81 |
-
markup = (function () {
|
82 |
-
|
83 |
-
// IE does not support gradients with multiple stops, so we need to simulate
|
84 |
-
// that for the rainbow slider with 8 divs that each have a single gradient
|
85 |
-
var gradientFix = "";
|
86 |
-
if (IE) {
|
87 |
-
for (var i = 1; i <= 6; i++) {
|
88 |
-
gradientFix += "<div class='sp-" + i + "'></div>";
|
89 |
-
}
|
90 |
-
}
|
91 |
-
|
92 |
-
return [
|
93 |
-
"<div class='sp-container sp-hidden'>",
|
94 |
-
"<div class='sp-palette-container'>",
|
95 |
-
"<div class='sp-palette sp-thumb sp-cf'></div>",
|
96 |
-
"<div class='sp-palette-button-container sp-cf'>",
|
97 |
-
"<button type='button' class='sp-palette-toggle'></button>",
|
98 |
-
"</div>",
|
99 |
-
"</div>",
|
100 |
-
"<div class='sp-picker-container'>",
|
101 |
-
"<div class='sp-top sp-cf'>",
|
102 |
-
"<div class='sp-fill'></div>",
|
103 |
-
"<div class='sp-top-inner'>",
|
104 |
-
"<div class='sp-color'>",
|
105 |
-
"<div class='sp-sat'>",
|
106 |
-
"<div class='sp-val'>",
|
107 |
-
"<div class='sp-dragger'></div>",
|
108 |
-
"</div>",
|
109 |
-
"</div>",
|
110 |
-
"</div>",
|
111 |
-
"<div class='sp-clear sp-clear-display'>",
|
112 |
-
"</div>",
|
113 |
-
"<div class='sp-hue'>",
|
114 |
-
"<div class='sp-slider'></div>",
|
115 |
-
gradientFix,
|
116 |
-
"</div>",
|
117 |
-
"</div>",
|
118 |
-
"<div class='sp-alpha'><div class='sp-alpha-inner'><div class='sp-alpha-handle'></div></div></div>",
|
119 |
-
"</div>",
|
120 |
-
"<div class='sp-input-container sp-cf'>",
|
121 |
-
"<input class='sp-input' type='text' spellcheck='false' />",
|
122 |
-
"</div>",
|
123 |
-
"<div class='sp-initial sp-thumb sp-cf'></div>",
|
124 |
-
"<div class='sp-button-container sp-cf'>",
|
125 |
-
"<a class='sp-cancel' href='#'></a>",
|
126 |
-
"<button type='button' class='sp-choose'></button>",
|
127 |
-
"</div>",
|
128 |
-
"</div>",
|
129 |
-
"</div>"
|
130 |
-
].join("");
|
131 |
-
})();
|
132 |
-
|
133 |
-
function paletteTemplate (p, color, className, opts) {
|
134 |
-
var html = [];
|
135 |
-
for (var i = 0; i < p.length; i++) {
|
136 |
-
var current = p[i];
|
137 |
-
if(current) {
|
138 |
-
var tiny = tinycolor(current);
|
139 |
-
var c = tiny.toHsl().l < 0.5 ? "sp-thumb-el sp-thumb-dark" : "sp-thumb-el sp-thumb-light";
|
140 |
-
c += (tinycolor.equals(color, current)) ? " sp-thumb-active" : "";
|
141 |
-
var formattedString = tiny.toString(opts.preferredFormat || "rgb");
|
142 |
-
var swatchStyle = rgbaSupport ? ("background-color:" + tiny.toRgbString()) : "filter:" + tiny.toFilter();
|
143 |
-
html.push('<span title="' + formattedString + '" data-color="' + tiny.toRgbString() + '" class="' + c + '"><span class="sp-thumb-inner" style="' + swatchStyle + ';" /></span>');
|
144 |
-
} else {
|
145 |
-
var cls = 'sp-clear-display';
|
146 |
-
html.push($('<div />')
|
147 |
-
.append($('<span data-color="" style="background-color:transparent;" class="' + cls + '"></span>')
|
148 |
-
.attr('title', opts.noColorSelectedText)
|
149 |
-
)
|
150 |
-
.html()
|
151 |
-
);
|
152 |
-
}
|
153 |
-
}
|
154 |
-
return "<div class='sp-cf " + className + "'>" + html.join('') + "</div>";
|
155 |
-
}
|
156 |
-
|
157 |
-
function hideAll() {
|
158 |
-
for (var i = 0; i < spectrums.length; i++) {
|
159 |
-
if (spectrums[i]) {
|
160 |
-
spectrums[i].hide();
|
161 |
-
}
|
162 |
-
}
|
163 |
-
}
|
164 |
-
|
165 |
-
function instanceOptions(o, callbackContext) {
|
166 |
-
var opts = $.extend({}, defaultOpts, o);
|
167 |
-
opts.callbacks = {
|
168 |
-
'move': bind(opts.move, callbackContext),
|
169 |
-
'change': bind(opts.change, callbackContext),
|
170 |
-
'show': bind(opts.show, callbackContext),
|
171 |
-
'hide': bind(opts.hide, callbackContext),
|
172 |
-
'beforeShow': bind(opts.beforeShow, callbackContext)
|
173 |
-
};
|
174 |
-
|
175 |
-
return opts;
|
176 |
-
}
|
177 |
-
|
178 |
-
function spectrum(element, o) {
|
179 |
-
|
180 |
-
var opts = instanceOptions(o, element),
|
181 |
-
flat = opts.flat,
|
182 |
-
showSelectionPalette = opts.showSelectionPalette,
|
183 |
-
localStorageKey = opts.localStorageKey,
|
184 |
-
theme = opts.theme,
|
185 |
-
callbacks = opts.callbacks,
|
186 |
-
resize = throttle(reflow, 10),
|
187 |
-
visible = false,
|
188 |
-
isDragging = false,
|
189 |
-
dragWidth = 0,
|
190 |
-
dragHeight = 0,
|
191 |
-
dragHelperHeight = 0,
|
192 |
-
slideHeight = 0,
|
193 |
-
slideWidth = 0,
|
194 |
-
alphaWidth = 0,
|
195 |
-
alphaSlideHelperWidth = 0,
|
196 |
-
slideHelperHeight = 0,
|
197 |
-
currentHue = 0,
|
198 |
-
currentSaturation = 0,
|
199 |
-
currentValue = 0,
|
200 |
-
currentAlpha = 1,
|
201 |
-
palette = [],
|
202 |
-
paletteArray = [],
|
203 |
-
paletteLookup = {},
|
204 |
-
selectionPalette = opts.selectionPalette.slice(0),
|
205 |
-
maxSelectionSize = opts.maxSelectionSize,
|
206 |
-
draggingClass = "sp-dragging",
|
207 |
-
shiftMovementDirection = null;
|
208 |
-
|
209 |
-
var doc = element.ownerDocument,
|
210 |
-
body = doc.body,
|
211 |
-
boundElement = $(element),
|
212 |
-
disabled = false,
|
213 |
-
container = $(markup, doc).addClass(theme),
|
214 |
-
pickerContainer = container.find(".sp-picker-container"),
|
215 |
-
dragger = container.find(".sp-color"),
|
216 |
-
dragHelper = container.find(".sp-dragger"),
|
217 |
-
slider = container.find(".sp-hue"),
|
218 |
-
slideHelper = container.find(".sp-slider"),
|
219 |
-
alphaSliderInner = container.find(".sp-alpha-inner"),
|
220 |
-
alphaSlider = container.find(".sp-alpha"),
|
221 |
-
alphaSlideHelper = container.find(".sp-alpha-handle"),
|
222 |
-
textInput = container.find(".sp-input"),
|
223 |
-
paletteContainer = container.find(".sp-palette"),
|
224 |
-
initialColorContainer = container.find(".sp-initial"),
|
225 |
-
cancelButton = container.find(".sp-cancel"),
|
226 |
-
clearButton = container.find(".sp-clear"),
|
227 |
-
chooseButton = container.find(".sp-choose"),
|
228 |
-
toggleButton = container.find(".sp-palette-toggle"),
|
229 |
-
isInput = boundElement.is("input"),
|
230 |
-
isInputTypeColor = isInput && boundElement.attr("type") === "color" && inputTypeColorSupport(),
|
231 |
-
shouldReplace = isInput && !flat,
|
232 |
-
replacer = (shouldReplace) ? $(replaceInput).addClass(theme).addClass(opts.className).addClass(opts.replacerClassName) : $([]),
|
233 |
-
offsetElement = (shouldReplace) ? replacer : boundElement,
|
234 |
-
previewElement = replacer.find(".sp-preview-inner"),
|
235 |
-
initialColor = opts.color || (isInput && boundElement.val()),
|
236 |
-
colorOnShow = false,
|
237 |
-
preferredFormat = opts.preferredFormat,
|
238 |
-
currentPreferredFormat = preferredFormat,
|
239 |
-
clickoutFiresChange = !opts.showButtons || opts.clickoutFiresChange,
|
240 |
-
isEmpty = !initialColor,
|
241 |
-
allowEmpty = opts.allowEmpty && !isInputTypeColor;
|
242 |
-
|
243 |
-
function applyOptions() {
|
244 |
-
|
245 |
-
if (opts.showPaletteOnly) {
|
246 |
-
opts.showPalette = true;
|
247 |
-
}
|
248 |
-
|
249 |
-
toggleButton.text(opts.showPaletteOnly ? opts.togglePaletteMoreText : opts.togglePaletteLessText);
|
250 |
-
|
251 |
-
if (opts.palette) {
|
252 |
-
palette = opts.palette.slice(0);
|
253 |
-
paletteArray = $.isArray(palette[0]) ? palette : [palette];
|
254 |
-
paletteLookup = {};
|
255 |
-
for (var i = 0; i < paletteArray.length; i++) {
|
256 |
-
for (var j = 0; j < paletteArray[i].length; j++) {
|
257 |
-
var rgb = tinycolor(paletteArray[i][j]).toRgbString();
|
258 |
-
paletteLookup[rgb] = true;
|
259 |
-
}
|
260 |
-
}
|
261 |
-
}
|
262 |
-
|
263 |
-
container.toggleClass("sp-flat", flat);
|
264 |
-
container.toggleClass("sp-input-disabled", !opts.showInput);
|
265 |
-
container.toggleClass("sp-alpha-enabled", opts.showAlpha);
|
266 |
-
container.toggleClass("sp-clear-enabled", allowEmpty);
|
267 |
-
container.toggleClass("sp-buttons-disabled", !opts.showButtons);
|
268 |
-
container.toggleClass("sp-palette-buttons-disabled", !opts.togglePaletteOnly);
|
269 |
-
container.toggleClass("sp-palette-disabled", !opts.showPalette);
|
270 |
-
container.toggleClass("sp-palette-only", opts.showPaletteOnly);
|
271 |
-
container.toggleClass("sp-initial-disabled", !opts.showInitial);
|
272 |
-
container.addClass(opts.className).addClass(opts.containerClassName);
|
273 |
-
|
274 |
-
reflow();
|
275 |
-
}
|
276 |
-
|
277 |
-
function initialize() {
|
278 |
-
|
279 |
-
if (IE) {
|
280 |
-
container.find("*:not(input)").attr("unselectable", "on");
|
281 |
-
}
|
282 |
-
|
283 |
-
applyOptions();
|
284 |
-
|
285 |
-
if (shouldReplace) {
|
286 |
-
boundElement.after(replacer).hide();
|
287 |
-
}
|
288 |
-
|
289 |
-
if (!allowEmpty) {
|
290 |
-
clearButton.hide();
|
291 |
-
}
|
292 |
-
|
293 |
-
if (flat) {
|
294 |
-
boundElement.after(container).hide();
|
295 |
-
}
|
296 |
-
else {
|
297 |
-
|
298 |
-
var appendTo = opts.appendTo === "parent" ? boundElement.parent() : $(opts.appendTo);
|
299 |
-
if (appendTo.length !== 1) {
|
300 |
-
appendTo = $("body");
|
301 |
-
}
|
302 |
-
|
303 |
-
appendTo.append(container);
|
304 |
-
}
|
305 |
-
|
306 |
-
updateSelectionPaletteFromStorage();
|
307 |
-
|
308 |
-
offsetElement.bind("click.spectrum touchstart.spectrum", function (e) {
|
309 |
-
if (!disabled) {
|
310 |
-
toggle();
|
311 |
-
}
|
312 |
-
|
313 |
-
e.stopPropagation();
|
314 |
-
|
315 |
-
if (!$(e.target).is("input")) {
|
316 |
-
e.preventDefault();
|
317 |
-
}
|
318 |
-
});
|
319 |
-
|
320 |
-
if(boundElement.is(":disabled") || (opts.disabled === true)) {
|
321 |
-
disable();
|
322 |
-
}
|
323 |
-
|
324 |
-
// Prevent clicks from bubbling up to document. This would cause it to be hidden.
|
325 |
-
container.click(stopPropagation);
|
326 |
-
|
327 |
-
// Handle user typed input
|
328 |
-
textInput.change(setFromTextInput);
|
329 |
-
textInput.bind("paste", function () {
|
330 |
-
setTimeout(setFromTextInput, 1);
|
331 |
-
});
|
332 |
-
textInput.keydown(function (e) { if (e.keyCode == 13) { setFromTextInput(); } });
|
333 |
-
|
334 |
-
cancelButton.text(opts.cancelText);
|
335 |
-
cancelButton.bind("click.spectrum", function (e) {
|
336 |
-
e.stopPropagation();
|
337 |
-
e.preventDefault();
|
338 |
-
revert();
|
339 |
-
hide();
|
340 |
-
});
|
341 |
-
|
342 |
-
clearButton.attr("title", opts.clearText);
|
343 |
-
clearButton.bind("click.spectrum", function (e) {
|
344 |
-
e.stopPropagation();
|
345 |
-
e.preventDefault();
|
346 |
-
isEmpty = true;
|
347 |
-
move();
|
348 |
-
|
349 |
-
if(flat) {
|
350 |
-
//for the flat style, this is a change event
|
351 |
-
updateOriginalInput(true);
|
352 |
-
}
|
353 |
-
});
|
354 |
-
|
355 |
-
chooseButton.text(opts.chooseText);
|
356 |
-
chooseButton.bind("click.spectrum", function (e) {
|
357 |
-
e.stopPropagation();
|
358 |
-
e.preventDefault();
|
359 |
-
|
360 |
-
if (IE && textInput.is(":focus")) {
|
361 |
-
textInput.trigger('change');
|
362 |
-
}
|
363 |
-
|
364 |
-
if (isValid()) {
|
365 |
-
updateOriginalInput(true);
|
366 |
-
hide();
|
367 |
-
}
|
368 |
-
});
|
369 |
-
|
370 |
-
toggleButton.text(opts.showPaletteOnly ? opts.togglePaletteMoreText : opts.togglePaletteLessText);
|
371 |
-
toggleButton.bind("click.spectrum", function (e) {
|
372 |
-
e.stopPropagation();
|
373 |
-
e.preventDefault();
|
374 |
-
|
375 |
-
opts.showPaletteOnly = !opts.showPaletteOnly;
|
376 |
-
|
377 |
-
// To make sure the Picker area is drawn on the right, next to the
|
378 |
-
// Palette area (and not below the palette), first move the Palette
|
379 |
-
// to the left to make space for the picker, plus 5px extra.
|
380 |
-
// The 'applyOptions' function puts the whole container back into place
|
381 |
-
// and takes care of the button-text and the sp-palette-only CSS class.
|
382 |
-
if (!opts.showPaletteOnly && !flat) {
|
383 |
-
container.css('left', '-=' + (pickerContainer.outerWidth(true) + 5));
|
384 |
-
}
|
385 |
-
applyOptions();
|
386 |
-
});
|
387 |
-
|
388 |
-
draggable(alphaSlider, function (dragX, dragY, e) {
|
389 |
-
currentAlpha = (dragX / alphaWidth);
|
390 |
-
isEmpty = false;
|
391 |
-
if (e.shiftKey) {
|
392 |
-
currentAlpha = Math.round(currentAlpha * 10) / 10;
|
393 |
-
}
|
394 |
-
|
395 |
-
move();
|
396 |
-
}, dragStart, dragStop);
|
397 |
-
|
398 |
-
draggable(slider, function (dragX, dragY) {
|
399 |
-
currentHue = parseFloat(dragY / slideHeight);
|
400 |
-
isEmpty = false;
|
401 |
-
if (!opts.showAlpha) {
|
402 |
-
currentAlpha = 1;
|
403 |
-
}
|
404 |
-
move();
|
405 |
-
}, dragStart, dragStop);
|
406 |
-
|
407 |
-
draggable(dragger, function (dragX, dragY, e) {
|
408 |
-
|
409 |
-
// shift+drag should snap the movement to either the x or y axis.
|
410 |
-
if (!e.shiftKey) {
|
411 |
-
shiftMovementDirection = null;
|
412 |
-
}
|
413 |
-
else if (!shiftMovementDirection) {
|
414 |
-
var oldDragX = currentSaturation * dragWidth;
|
415 |
-
var oldDragY = dragHeight - (currentValue * dragHeight);
|
416 |
-
var furtherFromX = Math.abs(dragX - oldDragX) > Math.abs(dragY - oldDragY);
|
417 |
-
|
418 |
-
shiftMovementDirection = furtherFromX ? "x" : "y";
|
419 |
-
}
|
420 |
-
|
421 |
-
var setSaturation = !shiftMovementDirection || shiftMovementDirection === "x";
|
422 |
-
var setValue = !shiftMovementDirection || shiftMovementDirection === "y";
|
423 |
-
|
424 |
-
if (setSaturation) {
|
425 |
-
currentSaturation = parseFloat(dragX / dragWidth);
|
426 |
-
}
|
427 |
-
if (setValue) {
|
428 |
-
currentValue = parseFloat((dragHeight - dragY) / dragHeight);
|
429 |
-
}
|
430 |
-
|
431 |
-
isEmpty = false;
|
432 |
-
if (!opts.showAlpha) {
|
433 |
-
currentAlpha = 1;
|
434 |
-
}
|
435 |
-
|
436 |
-
move();
|
437 |
-
|
438 |
-
}, dragStart, dragStop);
|
439 |
-
|
440 |
-
if (!!initialColor) {
|
441 |
-
set(initialColor);
|
442 |
-
|
443 |
-
// In case color was black - update the preview UI and set the format
|
444 |
-
// since the set function will not run (default color is black).
|
445 |
-
updateUI();
|
446 |
-
currentPreferredFormat = preferredFormat || tinycolor(initialColor).format;
|
447 |
-
|
448 |
-
addColorToSelectionPalette(initialColor);
|
449 |
-
}
|
450 |
-
else {
|
451 |
-
updateUI();
|
452 |
-
}
|
453 |
-
|
454 |
-
if (flat) {
|
455 |
-
show();
|
456 |
-
}
|
457 |
-
|
458 |
-
function paletteElementClick(e) {
|
459 |
-
if (e.data && e.data.ignore) {
|
460 |
-
set($(e.target).closest(".sp-thumb-el").data("color"));
|
461 |
-
move();
|
462 |
-
}
|
463 |
-
else {
|
464 |
-
set($(e.target).closest(".sp-thumb-el").data("color"));
|
465 |
-
move();
|
466 |
-
updateOriginalInput(true);
|
467 |
-
if (opts.hideAfterPaletteSelect) {
|
468 |
-
hide();
|
469 |
-
}
|
470 |
-
}
|
471 |
-
|
472 |
-
return false;
|
473 |
-
}
|
474 |
-
|
475 |
-
var paletteEvent = IE ? "mousedown.spectrum" : "click.spectrum touchstart.spectrum";
|
476 |
-
paletteContainer.delegate(".sp-thumb-el", paletteEvent, paletteElementClick);
|
477 |
-
initialColorContainer.delegate(".sp-thumb-el:nth-child(1)", paletteEvent, { ignore: true }, paletteElementClick);
|
478 |
-
}
|
479 |
-
|
480 |
-
function updateSelectionPaletteFromStorage() {
|
481 |
-
|
482 |
-
if (localStorageKey && window.localStorage) {
|
483 |
-
|
484 |
-
// Migrate old palettes over to new format. May want to remove this eventually.
|
485 |
-
try {
|
486 |
-
var oldPalette = window.localStorage[localStorageKey].split(",#");
|
487 |
-
if (oldPalette.length > 1) {
|
488 |
-
delete window.localStorage[localStorageKey];
|
489 |
-
$.each(oldPalette, function(i, c) {
|
490 |
-
addColorToSelectionPalette(c);
|
491 |
-
});
|
492 |
-
}
|
493 |
-
}
|
494 |
-
catch(e) { }
|
495 |
-
|
496 |
-
try {
|
497 |
-
selectionPalette = window.localStorage[localStorageKey].split(";");
|
498 |
-
}
|
499 |
-
catch (e) { }
|
500 |
-
}
|
501 |
-
}
|
502 |
-
|
503 |
-
function addColorToSelectionPalette(color) {
|
504 |
-
if (showSelectionPalette) {
|
505 |
-
var rgb = tinycolor(color).toRgbString();
|
506 |
-
if (!paletteLookup[rgb] && $.inArray(rgb, selectionPalette) === -1) {
|
507 |
-
selectionPalette.push(rgb);
|
508 |
-
while(selectionPalette.length > maxSelectionSize) {
|
509 |
-
selectionPalette.shift();
|
510 |
-
}
|
511 |
-
}
|
512 |
-
|
513 |
-
if (localStorageKey && window.localStorage) {
|
514 |
-
try {
|
515 |
-
window.localStorage[localStorageKey] = selectionPalette.join(";");
|
516 |
-
}
|
517 |
-
catch(e) { }
|
518 |
-
}
|
519 |
-
}
|
520 |
-
}
|
521 |
-
|
522 |
-
function getUniqueSelectionPalette() {
|
523 |
-
var unique = [];
|
524 |
-
if (opts.showPalette) {
|
525 |
-
for (var i = 0; i < selectionPalette.length; i++) {
|
526 |
-
var rgb = tinycolor(selectionPalette[i]).toRgbString();
|
527 |
-
|
528 |
-
if (!paletteLookup[rgb]) {
|
529 |
-
unique.push(selectionPalette[i]);
|
530 |
-
}
|
531 |
-
}
|
532 |
-
}
|
533 |
-
|
534 |
-
return unique.reverse().slice(0, opts.maxSelectionSize);
|
535 |
-
}
|
536 |
-
|
537 |
-
function drawPalette() {
|
538 |
-
|
539 |
-
var currentColor = get();
|
540 |
-
|
541 |
-
var html = $.map(paletteArray, function (palette, i) {
|
542 |
-
return paletteTemplate(palette, currentColor, "sp-palette-row sp-palette-row-" + i, opts);
|
543 |
-
});
|
544 |
-
|
545 |
-
updateSelectionPaletteFromStorage();
|
546 |
-
|
547 |
-
if (selectionPalette) {
|
548 |
-
html.push(paletteTemplate(getUniqueSelectionPalette(), currentColor, "sp-palette-row sp-palette-row-selection", opts));
|
549 |
-
}
|
550 |
-
|
551 |
-
paletteContainer.html(html.join(""));
|
552 |
-
}
|
553 |
-
|
554 |
-
function drawInitial() {
|
555 |
-
if (opts.showInitial) {
|
556 |
-
var initial = colorOnShow;
|
557 |
-
var current = get();
|
558 |
-
initialColorContainer.html(paletteTemplate([initial, current], current, "sp-palette-row-initial", opts));
|
559 |
-
}
|
560 |
-
}
|
561 |
-
|
562 |
-
function dragStart() {
|
563 |
-
if (dragHeight <= 0 || dragWidth <= 0 || slideHeight <= 0) {
|
564 |
-
reflow();
|
565 |
-
}
|
566 |
-
isDragging = true;
|
567 |
-
container.addClass(draggingClass);
|
568 |
-
shiftMovementDirection = null;
|
569 |
-
boundElement.trigger('dragstart.spectrum', [ get() ]);
|
570 |
-
}
|
571 |
-
|
572 |
-
function dragStop() {
|
573 |
-
isDragging = false;
|
574 |
-
container.removeClass(draggingClass);
|
575 |
-
boundElement.trigger('dragstop.spectrum', [ get() ]);
|
576 |
-
}
|
577 |
-
|
578 |
-
function setFromTextInput() {
|
579 |
-
|
580 |
-
var value = textInput.val();
|
581 |
-
|
582 |
-
if ((value === null || value === "") && allowEmpty) {
|
583 |
-
set(null);
|
584 |
-
updateOriginalInput(true);
|
585 |
-
}
|
586 |
-
else {
|
587 |
-
var tiny = tinycolor(value);
|
588 |
-
if (tiny.isValid()) {
|
589 |
-
set(tiny);
|
590 |
-
updateOriginalInput(true);
|
591 |
-
}
|
592 |
-
else {
|
593 |
-
textInput.addClass("sp-validation-error");
|
594 |
-
}
|
595 |
-
}
|
596 |
-
}
|
597 |
-
|
598 |
-
function toggle() {
|
599 |
-
if (visible) {
|
600 |
-
hide();
|
601 |
-
}
|
602 |
-
else {
|
603 |
-
show();
|
604 |
-
}
|
605 |
-
}
|
606 |
-
|
607 |
-
function show() {
|
608 |
-
var event = $.Event('beforeShow.spectrum');
|
609 |
-
|
610 |
-
if (visible) {
|
611 |
-
reflow();
|
612 |
-
return;
|
613 |
-
}
|
614 |
-
|
615 |
-
boundElement.trigger(event, [ get() ]);
|
616 |
-
|
617 |
-
if (callbacks.beforeShow(get()) === false || event.isDefaultPrevented()) {
|
618 |
-
return;
|
619 |
-
}
|
620 |
-
|
621 |
-
hideAll();
|
622 |
-
visible = true;
|
623 |
-
|
624 |
-
$(doc).bind("keydown.spectrum", onkeydown);
|
625 |
-
$(doc).bind("click.spectrum", clickout);
|
626 |
-
$(window).bind("resize.spectrum", resize);
|
627 |
-
replacer.addClass("sp-active");
|
628 |
-
container.removeClass("sp-hidden");
|
629 |
-
|
630 |
-
reflow();
|
631 |
-
updateUI();
|
632 |
-
|
633 |
-
colorOnShow = get();
|
634 |
-
|
635 |
-
drawInitial();
|
636 |
-
callbacks.show(colorOnShow);
|
637 |
-
boundElement.trigger('show.spectrum', [ colorOnShow ]);
|
638 |
-
}
|
639 |
-
|
640 |
-
function onkeydown(e) {
|
641 |
-
// Close on ESC
|
642 |
-
if (e.keyCode === 27) {
|
643 |
-
hide();
|
644 |
-
}
|
645 |
-
}
|
646 |
-
|
647 |
-
function clickout(e) {
|
648 |
-
// Return on right click.
|
649 |
-
if (e.button == 2) { return; }
|
650 |
-
|
651 |
-
// If a drag event was happening during the mouseup, don't hide
|
652 |
-
// on click.
|
653 |
-
if (isDragging) { return; }
|
654 |
-
|
655 |
-
if (clickoutFiresChange) {
|
656 |
-
updateOriginalInput(true);
|
657 |
-
}
|
658 |
-
else {
|
659 |
-
revert();
|
660 |
-
}
|
661 |
-
hide();
|
662 |
-
}
|
663 |
-
|
664 |
-
function hide() {
|
665 |
-
// Return if hiding is unnecessary
|
666 |
-
if (!visible || flat) { return; }
|
667 |
-
visible = false;
|
668 |
-
|
669 |
-
$(doc).unbind("keydown.spectrum", onkeydown);
|
670 |
-
$(doc).unbind("click.spectrum", clickout);
|
671 |
-
$(window).unbind("resize.spectrum", resize);
|
672 |
-
|
673 |
-
replacer.removeClass("sp-active");
|
674 |
-
container.addClass("sp-hidden");
|
675 |
-
|
676 |
-
callbacks.hide(get());
|
677 |
-
boundElement.trigger('hide.spectrum', [ get() ]);
|
678 |
-
}
|
679 |
-
|
680 |
-
function revert() {
|
681 |
-
set(colorOnShow, true);
|
682 |
-
}
|
683 |
-
|
684 |
-
function set(color, ignoreFormatChange) {
|
685 |
-
if (tinycolor.equals(color, get())) {
|
686 |
-
// Update UI just in case a validation error needs
|
687 |
-
// to be cleared.
|
688 |
-
updateUI();
|
689 |
-
return;
|
690 |
-
}
|
691 |
-
|
692 |
-
var newColor, newHsv;
|
693 |
-
if (!color && allowEmpty) {
|
694 |
-
isEmpty = true;
|
695 |
-
} else {
|
696 |
-
isEmpty = false;
|
697 |
-
newColor = tinycolor(color);
|
698 |
-
newHsv = newColor.toHsv();
|
699 |
-
|
700 |
-
currentHue = (newHsv.h % 360) / 360;
|
701 |
-
currentSaturation = newHsv.s;
|
702 |
-
currentValue = newHsv.v;
|
703 |
-
currentAlpha = newHsv.a;
|
704 |
-
}
|
705 |
-
updateUI();
|
706 |
-
|
707 |
-
if (newColor && newColor.isValid() && !ignoreFormatChange) {
|
708 |
-
currentPreferredFormat = preferredFormat || newColor.getFormat();
|
709 |
-
}
|
710 |
-
}
|
711 |
-
|
712 |
-
function get(opts) {
|
713 |
-
opts = opts || { };
|
714 |
-
|
715 |
-
if (allowEmpty && isEmpty) {
|
716 |
-
return null;
|
717 |
-
}
|
718 |
-
|
719 |
-
return tinycolor.fromRatio({
|
720 |
-
h: currentHue,
|
721 |
-
s: currentSaturation,
|
722 |
-
v: currentValue,
|
723 |
-
a: Math.round(currentAlpha * 100) / 100
|
724 |
-
}, { format: opts.format || currentPreferredFormat });
|
725 |
-
}
|
726 |
-
|
727 |
-
function isValid() {
|
728 |
-
return !textInput.hasClass("sp-validation-error");
|
729 |
-
}
|
730 |
-
|
731 |
-
function move() {
|
732 |
-
updateUI();
|
733 |
-
|
734 |
-
callbacks.move(get());
|
735 |
-
boundElement.trigger('move.spectrum', [ get() ]);
|
736 |
-
}
|
737 |
-
|
738 |
-
function updateUI() {
|
739 |
-
|
740 |
-
textInput.removeClass("sp-validation-error");
|
741 |
-
|
742 |
-
updateHelperLocations();
|
743 |
-
|
744 |
-
// Update dragger background color (gradients take care of saturation and value).
|
745 |
-
var flatColor = tinycolor.fromRatio({ h: currentHue, s: 1, v: 1 });
|
746 |
-
dragger.css("background-color", flatColor.toHexString());
|
747 |
-
|
748 |
-
// Get a format that alpha will be included in (hex and names ignore alpha)
|
749 |
-
var format = currentPreferredFormat;
|
750 |
-
if (currentAlpha < 1 && !(currentAlpha === 0 && format === "name")) {
|
751 |
-
if (format === "hex" || format === "hex3" || format === "hex6" || format === "name") {
|
752 |
-
format = "rgb";
|
753 |
-
}
|
754 |
-
}
|
755 |
-
|
756 |
-
var realColor = get({ format: format }),
|
757 |
-
displayColor = '';
|
758 |
-
|
759 |
-
//reset background info for preview element
|
760 |
-
previewElement.removeClass("sp-clear-display");
|
761 |
-
previewElement.css('background-color', 'transparent');
|
762 |
-
|
763 |
-
if (!realColor && allowEmpty) {
|
764 |
-
// Update the replaced elements background with icon indicating no color selection
|
765 |
-
previewElement.addClass("sp-clear-display");
|
766 |
-
}
|
767 |
-
else {
|
768 |
-
var realHex = realColor.toHexString(),
|
769 |
-
realRgb = realColor.toRgbString();
|
770 |
-
|
771 |
-
// Update the replaced elements background color (with actual selected color)
|
772 |
-
if (rgbaSupport || realColor.alpha === 1) {
|
773 |
-
previewElement.css("background-color", realRgb);
|
774 |
-
}
|
775 |
-
else {
|
776 |
-
previewElement.css("background-color", "transparent");
|
777 |
-
previewElement.css("filter", realColor.toFilter());
|
778 |
-
}
|
779 |
-
|
780 |
-
if (opts.showAlpha) {
|
781 |
-
var rgb = realColor.toRgb();
|
782 |
-
rgb.a = 0;
|
783 |
-
var realAlpha = tinycolor(rgb).toRgbString();
|
784 |
-
var gradient = "linear-gradient(left, " + realAlpha + ", " + realHex + ")";
|
785 |
-
|
786 |
-
if (IE) {
|
787 |
-
alphaSliderInner.css("filter", tinycolor(realAlpha).toFilter({ gradientType: 1 }, realHex));
|
788 |
-
}
|
789 |
-
else {
|
790 |
-
alphaSliderInner.css("background", "-webkit-" + gradient);
|
791 |
-
alphaSliderInner.css("background", "-moz-" + gradient);
|
792 |
-
alphaSliderInner.css("background", "-ms-" + gradient);
|
793 |
-
// Use current syntax gradient on unprefixed property.
|
794 |
-
alphaSliderInner.css("background",
|
795 |
-
"linear-gradient(to right, " + realAlpha + ", " + realHex + ")");
|
796 |
-
}
|
797 |
-
}
|
798 |
-
|
799 |
-
displayColor = realColor.toString(format);
|
800 |
-
}
|
801 |
-
|
802 |
-
// Update the text entry input as it changes happen
|
803 |
-
if (opts.showInput) {
|
804 |
-
textInput.val(displayColor);
|
805 |
-
}
|
806 |
-
|
807 |
-
if (opts.showPalette) {
|
808 |
-
drawPalette();
|
809 |
-
}
|
810 |
-
|
811 |
-
drawInitial();
|
812 |
-
}
|
813 |
-
|
814 |
-
function updateHelperLocations() {
|
815 |
-
var s = currentSaturation;
|
816 |
-
var v = currentValue;
|
817 |
-
|
818 |
-
if(allowEmpty && isEmpty) {
|
819 |
-
//if selected color is empty, hide the helpers
|
820 |
-
alphaSlideHelper.hide();
|
821 |
-
slideHelper.hide();
|
822 |
-
dragHelper.hide();
|
823 |
-
}
|
824 |
-
else {
|
825 |
-
//make sure helpers are visible
|
826 |
-
alphaSlideHelper.show();
|
827 |
-
slideHelper.show();
|
828 |
-
dragHelper.show();
|
829 |
-
|
830 |
-
// Where to show the little circle in that displays your current selected color
|
831 |
-
var dragX = s * dragWidth;
|
832 |
-
var dragY = dragHeight - (v * dragHeight);
|
833 |
-
dragX = Math.max(
|
834 |
-
-dragHelperHeight,
|
835 |
-
Math.min(dragWidth - dragHelperHeight, dragX - dragHelperHeight)
|
836 |
-
);
|
837 |
-
dragY = Math.max(
|
838 |
-
-dragHelperHeight,
|
839 |
-
Math.min(dragHeight - dragHelperHeight, dragY - dragHelperHeight)
|
840 |
-
);
|
841 |
-
dragHelper.css({
|
842 |
-
"top": dragY + "px",
|
843 |
-
"left": dragX + "px"
|
844 |
-
});
|
845 |
-
|
846 |
-
var alphaX = currentAlpha * alphaWidth;
|
847 |
-
alphaSlideHelper.css({
|
848 |
-
"left": (alphaX - (alphaSlideHelperWidth / 2)) + "px"
|
849 |
-
});
|
850 |
-
|
851 |
-
// Where to show the bar that displays your current selected hue
|
852 |
-
var slideY = (currentHue) * slideHeight;
|
853 |
-
slideHelper.css({
|
854 |
-
"top": (slideY - slideHelperHeight) + "px"
|
855 |
-
});
|
856 |
-
}
|
857 |
-
}
|
858 |
-
|
859 |
-
function updateOriginalInput(fireCallback) {
|
860 |
-
var color = get(),
|
861 |
-
displayColor = '',
|
862 |
-
hasChanged = !tinycolor.equals(color, colorOnShow);
|
863 |
-
|
864 |
-
if (color) {
|
865 |
-
displayColor = color.toString(currentPreferredFormat);
|
866 |
-
// Update the selection palette with the current color
|
867 |
-
addColorToSelectionPalette(color);
|
868 |
-
}
|
869 |
-
|
870 |
-
if (isInput) {
|
871 |
-
boundElement.val(displayColor);
|
872 |
-
}
|
873 |
-
|
874 |
-
if (fireCallback && hasChanged) {
|
875 |
-
callbacks.change(color);
|
876 |
-
boundElement.trigger('change', [ color ]);
|
877 |
-
}
|
878 |
-
}
|
879 |
-
|
880 |
-
function reflow() {
|
881 |
-
dragWidth = dragger.width();
|
882 |
-
dragHeight = dragger.height();
|
883 |
-
dragHelperHeight = dragHelper.height();
|
884 |
-
slideWidth = slider.width();
|
885 |
-
slideHeight = slider.height();
|
886 |
-
slideHelperHeight = slideHelper.height();
|
887 |
-
alphaWidth = alphaSlider.width();
|
888 |
-
alphaSlideHelperWidth = alphaSlideHelper.width();
|
889 |
-
|
890 |
-
if (!flat) {
|
891 |
-
container.css("position", "absolute");
|
892 |
-
if (opts.offset) {
|
893 |
-
container.offset(opts.offset);
|
894 |
-
} else {
|
895 |
-
container.offset(getOffset(container, offsetElement));
|
896 |
-
}
|
897 |
-
}
|
898 |
-
|
899 |
-
updateHelperLocations();
|
900 |
-
|
901 |
-
if (opts.showPalette) {
|
902 |
-
drawPalette();
|
903 |
-
}
|
904 |
-
|
905 |
-
boundElement.trigger('reflow.spectrum');
|
906 |
-
}
|
907 |
-
|
908 |
-
function destroy() {
|
909 |
-
boundElement.show();
|
910 |
-
offsetElement.unbind("click.spectrum touchstart.spectrum");
|
911 |
-
container.remove();
|
912 |
-
replacer.remove();
|
913 |
-
spectrums[spect.id] = null;
|
914 |
-
}
|
915 |
-
|
916 |
-
function option(optionName, optionValue) {
|
917 |
-
if (optionName === undefined) {
|
918 |
-
return $.extend({}, opts);
|
919 |
-
}
|
920 |
-
if (optionValue === undefined) {
|
921 |
-
return opts[optionName];
|
922 |
-
}
|
923 |
-
|
924 |
-
opts[optionName] = optionValue;
|
925 |
-
applyOptions();
|
926 |
-
}
|
927 |
-
|
928 |
-
function enable() {
|
929 |
-
disabled = false;
|
930 |
-
boundElement.attr("disabled", false);
|
931 |
-
offsetElement.removeClass("sp-disabled");
|
932 |
-
}
|
933 |
-
|
934 |
-
function disable() {
|
935 |
-
hide();
|
936 |
-
disabled = true;
|
937 |
-
boundElement.attr("disabled", true);
|
938 |
-
offsetElement.addClass("sp-disabled");
|
939 |
-
}
|
940 |
-
|
941 |
-
function setOffset(coord) {
|
942 |
-
opts.offset = coord;
|
943 |
-
reflow();
|
944 |
-
}
|
945 |
-
|
946 |
-
initialize();
|
947 |
-
|
948 |
-
var spect = {
|
949 |
-
show: show,
|
950 |
-
hide: hide,
|
951 |
-
toggle: toggle,
|
952 |
-
reflow: reflow,
|
953 |
-
option: option,
|
954 |
-
enable: enable,
|
955 |
-
disable: disable,
|
956 |
-
offset: setOffset,
|
957 |
-
set: function (c) {
|
958 |
-
set(c);
|
959 |
-
updateOriginalInput();
|
960 |
-
},
|
961 |
-
get: get,
|
962 |
-
destroy: destroy,
|
963 |
-
container: container
|
964 |
-
};
|
965 |
-
|
966 |
-
spect.id = spectrums.push(spect) - 1;
|
967 |
-
|
968 |
-
return spect;
|
969 |
-
}
|
970 |
-
|
971 |
-
/**
|
972 |
-
* checkOffset - get the offset below/above and left/right element depending on screen position
|
973 |
-
* Thanks https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.datepicker.js
|
974 |
-
*/
|
975 |
-
function getOffset(picker, input) {
|
976 |
-
var extraY = 0;
|
977 |
-
var dpWidth = picker.outerWidth();
|
978 |
-
var dpHeight = picker.outerHeight();
|
979 |
-
var inputHeight = input.outerHeight();
|
980 |
-
var doc = picker[0].ownerDocument;
|
981 |
-
var docElem = doc.documentElement;
|
982 |
-
var viewWidth = docElem.clientWidth + $(doc).scrollLeft();
|
983 |
-
var viewHeight = docElem.clientHeight + $(doc).scrollTop();
|
984 |
-
var offset = input.offset();
|
985 |
-
offset.top += inputHeight;
|
986 |
-
|
987 |
-
offset.left -=
|
988 |
-
Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ?
|
989 |
-
Math.abs(offset.left + dpWidth - viewWidth) : 0);
|
990 |
-
|
991 |
-
offset.top -=
|
992 |
-
Math.min(offset.top, ((offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ?
|
993 |
-
Math.abs(dpHeight + inputHeight - extraY) : extraY));
|
994 |
-
|
995 |
-
return offset;
|
996 |
-
}
|
997 |
-
|
998 |
-
/**
|
999 |
-
* noop - do nothing
|
1000 |
-
*/
|
1001 |
-
function noop() {
|
1002 |
-
|
1003 |
-
}
|
1004 |
-
|
1005 |
-
/**
|
1006 |
-
* stopPropagation - makes the code only doing this a little easier to read in line
|
1007 |
-
*/
|
1008 |
-
function stopPropagation(e) {
|
1009 |
-
e.stopPropagation();
|
1010 |
-
}
|
1011 |
-
|
1012 |
-
/**
|
1013 |
-
* Create a function bound to a given object
|
1014 |
-
* Thanks to underscore.js
|
1015 |
-
*/
|
1016 |
-
function bind(func, obj) {
|
1017 |
-
var slice = Array.prototype.slice;
|
1018 |
-
var args = slice.call(arguments, 2);
|
1019 |
-
return function () {
|
1020 |
-
return func.apply(obj, args.concat(slice.call(arguments)));
|
1021 |
-
};
|
1022 |
-
}
|
1023 |
-
|
1024 |
-
/**
|
1025 |
-
* Lightweight drag helper. Handles containment within the element, so that
|
1026 |
-
* when dragging, the x is within [0,element.width] and y is within [0,element.height]
|
1027 |
-
*/
|
1028 |
-
function draggable(element, onmove, onstart, onstop) {
|
1029 |
-
onmove = onmove || function () { };
|
1030 |
-
onstart = onstart || function () { };
|
1031 |
-
onstop = onstop || function () { };
|
1032 |
-
var doc = document;
|
1033 |
-
var dragging = false;
|
1034 |
-
var offset = {};
|
1035 |
-
var maxHeight = 0;
|
1036 |
-
var maxWidth = 0;
|
1037 |
-
var hasTouch = ('ontouchstart' in window);
|
1038 |
-
|
1039 |
-
var duringDragEvents = {};
|
1040 |
-
duringDragEvents["selectstart"] = prevent;
|
1041 |
-
duringDragEvents["dragstart"] = prevent;
|
1042 |
-
duringDragEvents["touchmove mousemove"] = move;
|
1043 |
-
duringDragEvents["touchend mouseup"] = stop;
|
1044 |
-
|
1045 |
-
function prevent(e) {
|
1046 |
-
if (e.stopPropagation) {
|
1047 |
-
e.stopPropagation();
|
1048 |
-
}
|
1049 |
-
if (e.preventDefault) {
|
1050 |
-
e.preventDefault();
|
1051 |
-
}
|
1052 |
-
e.returnValue = false;
|
1053 |
-
}
|
1054 |
-
|
1055 |
-
function move(e) {
|
1056 |
-
if (dragging) {
|
1057 |
-
// Mouseup happened outside of window
|
1058 |
-
if (IE && doc.documentMode < 9 && !e.button) {
|
1059 |
-
return stop();
|
1060 |
-
}
|
1061 |
-
|
1062 |
-
var t0 = e.originalEvent && e.originalEvent.touches && e.originalEvent.touches[0];
|
1063 |
-
var pageX = t0 && t0.pageX || e.pageX;
|
1064 |
-
var pageY = t0 && t0.pageY || e.pageY;
|
1065 |
-
|
1066 |
-
var dragX = Math.max(0, Math.min(pageX - offset.left, maxWidth));
|
1067 |
-
var dragY = Math.max(0, Math.min(pageY - offset.top, maxHeight));
|
1068 |
-
|
1069 |
-
if (hasTouch) {
|
1070 |
-
// Stop scrolling in iOS
|
1071 |
-
prevent(e);
|
1072 |
-
}
|
1073 |
-
|
1074 |
-
onmove.apply(element, [dragX, dragY, e]);
|
1075 |
-
}
|
1076 |
-
}
|
1077 |
-
|
1078 |
-
function start(e) {
|
1079 |
-
var rightclick = (e.which) ? (e.which == 3) : (e.button == 2);
|
1080 |
-
|
1081 |
-
if (!rightclick && !dragging) {
|
1082 |
-
if (onstart.apply(element, arguments) !== false) {
|
1083 |
-
dragging = true;
|
1084 |
-
maxHeight = $(element).height();
|
1085 |
-
maxWidth = $(element).width();
|
1086 |
-
offset = $(element).offset();
|
1087 |
-
|
1088 |
-
$(doc).bind(duringDragEvents);
|
1089 |
-
$(doc.body).addClass("sp-dragging");
|
1090 |
-
|
1091 |
-
move(e);
|
1092 |
-
|
1093 |
-
prevent(e);
|
1094 |
-
}
|
1095 |
-
}
|
1096 |
-
}
|
1097 |
-
|
1098 |
-
function stop() {
|
1099 |
-
if (dragging) {
|
1100 |
-
$(doc).unbind(duringDragEvents);
|
1101 |
-
$(doc.body).removeClass("sp-dragging");
|
1102 |
-
|
1103 |
-
// Wait a tick before notifying observers to allow the click event
|
1104 |
-
// to fire in Chrome.
|
1105 |
-
setTimeout(function() {
|
1106 |
-
onstop.apply(element, arguments);
|
1107 |
-
}, 0);
|
1108 |
-
}
|
1109 |
-
dragging = false;
|
1110 |
-
}
|
1111 |
-
|
1112 |
-
$(element).bind("touchstart mousedown", start);
|
1113 |
-
}
|
1114 |
-
|
1115 |
-
function throttle(func, wait, debounce) {
|
1116 |
-
var timeout;
|
1117 |
-
return function () {
|
1118 |
-
var context = this, args = arguments;
|
1119 |
-
var throttler = function () {
|
1120 |
-
timeout = null;
|
1121 |
-
func.apply(context, args);
|
1122 |
-
};
|
1123 |
-
if (debounce) clearTimeout(timeout);
|
1124 |
-
if (debounce || !timeout) timeout = setTimeout(throttler, wait);
|
1125 |
-
};
|
1126 |
-
}
|
1127 |
-
|
1128 |
-
function inputTypeColorSupport() {
|
1129 |
-
return $.fn.spectrum.inputTypeColorSupport();
|
1130 |
-
}
|
1131 |
-
|
1132 |
-
/**
|
1133 |
-
* Define a jQuery plugin
|
1134 |
-
*/
|
1135 |
-
var dataID = "spectrum.id";
|
1136 |
-
$.fn.spectrum = function (opts, extra) {
|
1137 |
-
|
1138 |
-
if (typeof opts == "string") {
|
1139 |
-
|
1140 |
-
var returnValue = this;
|
1141 |
-
var args = Array.prototype.slice.call( arguments, 1 );
|
1142 |
-
|
1143 |
-
this.each(function () {
|
1144 |
-
var spect = spectrums[$(this).data(dataID)];
|
1145 |
-
if (spect) {
|
1146 |
-
var method = spect[opts];
|
1147 |
-
if (!method) {
|
1148 |
-
throw new Error( "Spectrum: no such method: '" + opts + "'" );
|
1149 |
-
}
|
1150 |
-
|
1151 |
-
if (opts == "get") {
|
1152 |
-
returnValue = spect.get();
|
1153 |
-
}
|
1154 |
-
else if (opts == "container") {
|
1155 |
-
returnValue = spect.container;
|
1156 |
-
}
|
1157 |
-
else if (opts == "option") {
|
1158 |
-
returnValue = spect.option.apply(spect, args);
|
1159 |
-
}
|
1160 |
-
else if (opts == "destroy") {
|
1161 |
-
spect.destroy();
|
1162 |
-
$(this).removeData(dataID);
|
1163 |
-
}
|
1164 |
-
else {
|
1165 |
-
method.apply(spect, args);
|
1166 |
-
}
|
1167 |
-
}
|
1168 |
-
});
|
1169 |
-
|
1170 |
-
return returnValue;
|
1171 |
-
}
|
1172 |
-
|
1173 |
-
// Initializing a new instance of spectrum
|
1174 |
-
return this.spectrum("destroy").each(function () {
|
1175 |
-
var options = $.extend({}, opts, $(this).data());
|
1176 |
-
var spect = spectrum(this, options);
|
1177 |
-
$(this).data(dataID, spect.id);
|
1178 |
-
});
|
1179 |
-
};
|
1180 |
-
|
1181 |
-
$.fn.spectrum.load = true;
|
1182 |
-
$.fn.spectrum.loadOpts = {};
|
1183 |
-
$.fn.spectrum.draggable = draggable;
|
1184 |
-
$.fn.spectrum.defaults = defaultOpts;
|
1185 |
-
$.fn.spectrum.inputTypeColorSupport = function inputTypeColorSupport() {
|
1186 |
-
if (typeof inputTypeColorSupport._cachedResult === "undefined") {
|
1187 |
-
var colorInput = $("<input type='color'/>")[0]; // if color element is supported, value will default to not null
|
1188 |
-
inputTypeColorSupport._cachedResult = colorInput.type === "color" && colorInput.value !== "";
|
1189 |
-
}
|
1190 |
-
return inputTypeColorSupport._cachedResult;
|
1191 |
-
};
|
1192 |
-
|
1193 |
-
$.spectrum = { };
|
1194 |
-
$.spectrum.localization = { };
|
1195 |
-
$.spectrum.palettes = { };
|
1196 |
-
|
1197 |
-
$.fn.spectrum.processNativeColorInputs = function () {
|
1198 |
-
var colorInputs = $("input[type=color]");
|
1199 |
-
if (colorInputs.length && !inputTypeColorSupport()) {
|
1200 |
-
colorInputs.spectrum({
|
1201 |
-
preferredFormat: "hex6"
|
1202 |
-
});
|
1203 |
-
}
|
1204 |
-
};
|
1205 |
-
|
1206 |
-
// TinyColor v1.1.2
|
1207 |
-
// https://github.com/bgrins/TinyColor
|
1208 |
-
// Brian Grinstead, MIT License
|
1209 |
-
|
1210 |
-
(function() {
|
1211 |
-
|
1212 |
-
var trimLeft = /^[\s,#]+/,
|
1213 |
-
trimRight = /\s+$/,
|
1214 |
-
tinyCounter = 0,
|
1215 |
-
math = Math,
|
1216 |
-
mathRound = math.round,
|
1217 |
-
mathMin = math.min,
|
1218 |
-
mathMax = math.max,
|
1219 |
-
mathRandom = math.random;
|
1220 |
-
|
1221 |
-
var tinycolor = function(color, opts) {
|
1222 |
-
|
1223 |
-
color = (color) ? color : '';
|
1224 |
-
opts = opts || { };
|
1225 |
-
|
1226 |
-
// If input is already a tinycolor, return itself
|
1227 |
-
if (color instanceof tinycolor) {
|
1228 |
-
return color;
|
1229 |
-
}
|
1230 |
-
// If we are called as a function, call using new instead
|
1231 |
-
if (!(this instanceof tinycolor)) {
|
1232 |
-
return new tinycolor(color, opts);
|
1233 |
-
}
|
1234 |
-
|
1235 |
-
var rgb = inputToRGB(color);
|
1236 |
-
this._originalInput = color,
|
1237 |
-
this._r = rgb.r,
|
1238 |
-
this._g = rgb.g,
|
1239 |
-
this._b = rgb.b,
|
1240 |
-
this._a = rgb.a,
|
1241 |
-
this._roundA = mathRound(100*this._a) / 100,
|
1242 |
-
this._format = opts.format || rgb.format;
|
1243 |
-
this._gradientType = opts.gradientType;
|
1244 |
-
|
1245 |
-
// Don't let the range of [0,255] come back in [0,1].
|
1246 |
-
// Potentially lose a little bit of precision here, but will fix issues where
|
1247 |
-
// .5 gets interpreted as half of the total, instead of half of 1
|
1248 |
-
// If it was supposed to be 128, this was already taken care of by `inputToRgb`
|
1249 |
-
if (this._r < 1) { this._r = mathRound(this._r); }
|
1250 |
-
if (this._g < 1) { this._g = mathRound(this._g); }
|
1251 |
-
if (this._b < 1) { this._b = mathRound(this._b); }
|
1252 |
-
|
1253 |
-
this._ok = rgb.ok;
|
1254 |
-
this._tc_id = tinyCounter++;
|
1255 |
-
};
|
1256 |
-
|
1257 |
-
tinycolor.prototype = {
|
1258 |
-
isDark: function() {
|
1259 |
-
return this.getBrightness() < 128;
|
1260 |
-
},
|
1261 |
-
isLight: function() {
|
1262 |
-
return !this.isDark();
|
1263 |
-
},
|
1264 |
-
isValid: function() {
|
1265 |
-
return this._ok;
|
1266 |
-
},
|
1267 |
-
getOriginalInput: function() {
|
1268 |
-
return this._originalInput;
|
1269 |
-
},
|
1270 |
-
getFormat: function() {
|
1271 |
-
return this._format;
|
1272 |
-
},
|
1273 |
-
getAlpha: function() {
|
1274 |
-
return this._a;
|
1275 |
-
},
|
1276 |
-
getBrightness: function() {
|
1277 |
-
var rgb = this.toRgb();
|
1278 |
-
return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;
|
1279 |
-
},
|
1280 |
-
setAlpha: function(value) {
|
1281 |
-
this._a = boundAlpha(value);
|
1282 |
-
this._roundA = mathRound(100*this._a) / 100;
|
1283 |
-
return this;
|
1284 |
-
},
|
1285 |
-
toHsv: function() {
|
1286 |
-
var hsv = rgbToHsv(this._r, this._g, this._b);
|
1287 |
-
return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this._a };
|
1288 |
-
},
|
1289 |
-
toHsvString: function() {
|
1290 |
-
var hsv = rgbToHsv(this._r, this._g, this._b);
|
1291 |
-
var h = mathRound(hsv.h * 360), s = mathRound(hsv.s * 100), v = mathRound(hsv.v * 100);
|
1292 |
-
return (this._a == 1) ?
|
1293 |
-
"hsv(" + h + ", " + s + "%, " + v + "%)" :
|
1294 |
-
"hsva(" + h + ", " + s + "%, " + v + "%, "+ this._roundA + ")";
|
1295 |
-
},
|
1296 |
-
toHsl: function() {
|
1297 |
-
var hsl = rgbToHsl(this._r, this._g, this._b);
|
1298 |
-
return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this._a };
|
1299 |
-
},
|
1300 |
-
toHslString: function() {
|
1301 |
-
var hsl = rgbToHsl(this._r, this._g, this._b);
|
1302 |
-
var h = mathRound(hsl.h * 360), s = mathRound(hsl.s * 100), l = mathRound(hsl.l * 100);
|
1303 |
-
return (this._a == 1) ?
|
1304 |
-
"hsl(" + h + ", " + s + "%, " + l + "%)" :
|
1305 |
-
"hsla(" + h + ", " + s + "%, " + l + "%, "+ this._roundA + ")";
|
1306 |
-
},
|
1307 |
-
toHex: function(allow3Char) {
|
1308 |
-
return rgbToHex(this._r, this._g, this._b, allow3Char);
|
1309 |
-
},
|
1310 |
-
toHexString: function(allow3Char) {
|
1311 |
-
return '#' + this.toHex(allow3Char);
|
1312 |
-
},
|
1313 |
-
toHex8: function() {
|
1314 |
-
return rgbaToHex(this._r, this._g, this._b, this._a);
|
1315 |
-
},
|
1316 |
-
toHex8String: function() {
|
1317 |
-
return '#' + this.toHex8();
|
1318 |
-
},
|
1319 |
-
toRgb: function() {
|
1320 |
-
return { r: mathRound(this._r), g: mathRound(this._g), b: mathRound(this._b), a: this._a };
|
1321 |
-
},
|
1322 |
-
toRgbString: function() {
|
1323 |
-
return (this._a == 1) ?
|
1324 |
-
"rgb(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ")" :
|
1325 |
-
"rgba(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ", " + this._roundA + ")";
|
1326 |
-
},
|
1327 |
-
toPercentageRgb: function() {
|
1328 |
-
return { r: mathRound(bound01(this._r, 255) * 100) + "%", g: mathRound(bound01(this._g, 255) * 100) + "%", b: mathRound(bound01(this._b, 255) * 100) + "%", a: this._a };
|
1329 |
-
},
|
1330 |
-
toPercentageRgbString: function() {
|
1331 |
-
return (this._a == 1) ?
|
1332 |
-
"rgb(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%)" :
|
1333 |
-
"rgba(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")";
|
1334 |
-
},
|
1335 |
-
toName: function() {
|
1336 |
-
if (this._a === 0) {
|
1337 |
-
return "transparent";
|
1338 |
-
}
|
1339 |
-
|
1340 |
-
if (this._a < 1) {
|
1341 |
-
return false;
|
1342 |
-
}
|
1343 |
-
|
1344 |
-
return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;
|
1345 |
-
},
|
1346 |
-
toFilter: function(secondColor) {
|
1347 |
-
var hex8String = '#' + rgbaToHex(this._r, this._g, this._b, this._a);
|
1348 |
-
var secondHex8String = hex8String;
|
1349 |
-
var gradientType = this._gradientType ? "GradientType = 1, " : "";
|
1350 |
-
|
1351 |
-
if (secondColor) {
|
1352 |
-
var s = tinycolor(secondColor);
|
1353 |
-
secondHex8String = s.toHex8String();
|
1354 |
-
}
|
1355 |
-
|
1356 |
-
return "progid:DXImageTransform.Microsoft.gradient("+gradientType+"startColorstr="+hex8String+",endColorstr="+secondHex8String+")";
|
1357 |
-
},
|
1358 |
-
toString: function(format) {
|
1359 |
-
var formatSet = !!format;
|
1360 |
-
format = format || this._format;
|
1361 |
-
|
1362 |
-
var formattedString = false;
|
1363 |
-
var hasAlpha = this._a < 1 && this._a >= 0;
|
1364 |
-
var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "name");
|
1365 |
-
|
1366 |
-
if (needsAlphaFormat) {
|
1367 |
-
// Special case for "transparent", all other non-alpha formats
|
1368 |
-
// will return rgba when there is transparency.
|
1369 |
-
if (format === "name" && this._a === 0) {
|
1370 |
-
return this.toName();
|
1371 |
-
}
|
1372 |
-
return this.toRgbString();
|
1373 |
-
}
|
1374 |
-
if (format === "rgb") {
|
1375 |
-
formattedString = this.toRgbString();
|
1376 |
-
}
|
1377 |
-
if (format === "prgb") {
|
1378 |
-
formattedString = this.toPercentageRgbString();
|
1379 |
-
}
|
1380 |
-
if (format === "hex" || format === "hex6") {
|
1381 |
-
formattedString = this.toHexString();
|
1382 |
-
}
|
1383 |
-
if (format === "hex3") {
|
1384 |
-
formattedString = this.toHexString(true);
|
1385 |
-
}
|
1386 |
-
if (format === "hex8") {
|
1387 |
-
formattedString = this.toHex8String();
|
1388 |
-
}
|
1389 |
-
if (format === "name") {
|
1390 |
-
formattedString = this.toName();
|
1391 |
-
}
|
1392 |
-
if (format === "hsl") {
|
1393 |
-
formattedString = this.toHslString();
|
1394 |
-
}
|
1395 |
-
if (format === "hsv") {
|
1396 |
-
formattedString = this.toHsvString();
|
1397 |
-
}
|
1398 |
-
|
1399 |
-
return formattedString || this.toHexString();
|
1400 |
-
},
|
1401 |
-
|
1402 |
-
_applyModification: function(fn, args) {
|
1403 |
-
var color = fn.apply(null, [this].concat([].slice.call(args)));
|
1404 |
-
this._r = color._r;
|
1405 |
-
this._g = color._g;
|
1406 |
-
this._b = color._b;
|
1407 |
-
this.setAlpha(color._a);
|
1408 |
-
return this;
|
1409 |
-
},
|
1410 |
-
lighten: function() {
|
1411 |
-
return this._applyModification(lighten, arguments);
|
1412 |
-
},
|
1413 |
-
brighten: function() {
|
1414 |
-
return this._applyModification(brighten, arguments);
|
1415 |
-
},
|
1416 |
-
darken: function() {
|
1417 |
-
return this._applyModification(darken, arguments);
|
1418 |
-
},
|
1419 |
-
desaturate: function() {
|
1420 |
-
return this._applyModification(desaturate, arguments);
|
1421 |
-
},
|
1422 |
-
saturate: function() {
|
1423 |
-
return this._applyModification(saturate, arguments);
|
1424 |
-
},
|
1425 |
-
greyscale: function() {
|
1426 |
-
return this._applyModification(greyscale, arguments);
|
1427 |
-
},
|
1428 |
-
spin: function() {
|
1429 |
-
return this._applyModification(spin, arguments);
|
1430 |
-
},
|
1431 |
-
|
1432 |
-
_applyCombination: function(fn, args) {
|
1433 |
-
return fn.apply(null, [this].concat([].slice.call(args)));
|
1434 |
-
},
|
1435 |
-
analogous: function() {
|
1436 |
-
return this._applyCombination(analogous, arguments);
|
1437 |
-
},
|
1438 |
-
complement: function() {
|
1439 |
-
return this._applyCombination(complement, arguments);
|
1440 |
-
},
|
1441 |
-
monochromatic: function() {
|
1442 |
-
return this._applyCombination(monochromatic, arguments);
|
1443 |
-
},
|
1444 |
-
splitcomplement: function() {
|
1445 |
-
return this._applyCombination(splitcomplement, arguments);
|
1446 |
-
},
|
1447 |
-
triad: function() {
|
1448 |
-
return this._applyCombination(triad, arguments);
|
1449 |
-
},
|
1450 |
-
tetrad: function() {
|
1451 |
-
return this._applyCombination(tetrad, arguments);
|
1452 |
-
}
|
1453 |
-
};
|
1454 |
-
|
1455 |
-
// If input is an object, force 1 into "1.0" to handle ratios properly
|
1456 |
-
// String input requires "1.0" as input, so 1 will be treated as 1
|
1457 |
-
tinycolor.fromRatio = function(color, opts) {
|
1458 |
-
if (typeof color == "object") {
|
1459 |
-
var newColor = {};
|
1460 |
-
for (var i in color) {
|
1461 |
-
if (color.hasOwnProperty(i)) {
|
1462 |
-
if (i === "a") {
|
1463 |
-
newColor[i] = color[i];
|
1464 |
-
}
|
1465 |
-
else {
|
1466 |
-
newColor[i] = convertToPercentage(color[i]);
|
1467 |
-
}
|
1468 |
-
}
|
1469 |
-
}
|
1470 |
-
color = newColor;
|
1471 |
-
}
|
1472 |
-
|
1473 |
-
return tinycolor(color, opts);
|
1474 |
-
};
|
1475 |
-
|
1476 |
-
// Given a string or object, convert that input to RGB
|
1477 |
-
// Possible string inputs:
|
1478 |
-
//
|
1479 |
-
// "red"
|
1480 |
-
// "#f00" or "f00"
|
1481 |
-
// "#ff0000" or "ff0000"
|
1482 |
-
// "#ff000000" or "ff000000"
|
1483 |
-
// "rgb 255 0 0" or "rgb (255, 0, 0)"
|
1484 |
-
// "rgb 1.0 0 0" or "rgb (1, 0, 0)"
|
1485 |
-
// "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1"
|
1486 |
-
// "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1"
|
1487 |
-
// "hsl(0, 100%, 50%)" or "hsl 0 100% 50%"
|
1488 |
-
// "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1"
|
1489 |
-
// "hsv(0, 100%, 100%)" or "hsv 0 100% 100%"
|
1490 |
-
//
|
1491 |
-
function inputToRGB(color) {
|
1492 |
-
|
1493 |
-
var rgb = { r: 0, g: 0, b: 0 };
|
1494 |
-
var a = 1;
|
1495 |
-
var ok = false;
|
1496 |
-
var format = false;
|
1497 |
-
|
1498 |
-
if (typeof color == "string") {
|
1499 |
-
color = stringInputToObject(color);
|
1500 |
-
}
|
1501 |
-
|
1502 |
-
if (typeof color == "object") {
|
1503 |
-
if (color.hasOwnProperty("r") && color.hasOwnProperty("g") && color.hasOwnProperty("b")) {
|
1504 |
-
rgb = rgbToRgb(color.r, color.g, color.b);
|
1505 |
-
ok = true;
|
1506 |
-
format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
|
1507 |
-
}
|
1508 |
-
else if (color.hasOwnProperty("h") && color.hasOwnProperty("s") && color.hasOwnProperty("v")) {
|
1509 |
-
color.s = convertToPercentage(color.s);
|
1510 |
-
color.v = convertToPercentage(color.v);
|
1511 |
-
rgb = hsvToRgb(color.h, color.s, color.v);
|
1512 |
-
ok = true;
|
1513 |
-
format = "hsv";
|
1514 |
-
}
|
1515 |
-
else if (color.hasOwnProperty("h") && color.hasOwnProperty("s") && color.hasOwnProperty("l")) {
|
1516 |
-
color.s = convertToPercentage(color.s);
|
1517 |
-
color.l = convertToPercentage(color.l);
|
1518 |
-
rgb = hslToRgb(color.h, color.s, color.l);
|
1519 |
-
ok = true;
|
1520 |
-
format = "hsl";
|
1521 |
-
}
|
1522 |
-
|
1523 |
-
if (color.hasOwnProperty("a")) {
|
1524 |
-
a = color.a;
|
1525 |
-
}
|
1526 |
-
}
|
1527 |
-
|
1528 |
-
a = boundAlpha(a);
|
1529 |
-
|
1530 |
-
return {
|
1531 |
-
ok: ok,
|
1532 |
-
format: color.format || format,
|
1533 |
-
r: mathMin(255, mathMax(rgb.r, 0)),
|
1534 |
-
g: mathMin(255, mathMax(rgb.g, 0)),
|
1535 |
-
b: mathMin(255, mathMax(rgb.b, 0)),
|
1536 |
-
a: a
|
1537 |
-
};
|
1538 |
-
}
|
1539 |
-
|
1540 |
-
|
1541 |
-
// Conversion Functions
|
1542 |
-
// --------------------
|
1543 |
-
|
1544 |
-
// `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from:
|
1545 |
-
// <http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript>
|
1546 |
-
|
1547 |
-
// `rgbToRgb`
|
1548 |
-
// Handle bounds / percentage checking to conform to CSS color spec
|
1549 |
-
// <http://www.w3.org/TR/css3-color/>
|
1550 |
-
// *Assumes:* r, g, b in [0, 255] or [0, 1]
|
1551 |
-
// *Returns:* { r, g, b } in [0, 255]
|
1552 |
-
function rgbToRgb(r, g, b){
|
1553 |
-
return {
|
1554 |
-
r: bound01(r, 255) * 255,
|
1555 |
-
g: bound01(g, 255) * 255,
|
1556 |
-
b: bound01(b, 255) * 255
|
1557 |
-
};
|
1558 |
-
}
|
1559 |
-
|
1560 |
-
// `rgbToHsl`
|
1561 |
-
// Converts an RGB color value to HSL.
|
1562 |
-
// *Assumes:* r, g, and b are contained in [0, 255] or [0, 1]
|
1563 |
-
// *Returns:* { h, s, l } in [0,1]
|
1564 |
-
function rgbToHsl(r, g, b) {
|
1565 |
-
|
1566 |
-
r = bound01(r, 255);
|
1567 |
-
g = bound01(g, 255);
|
1568 |
-
b = bound01(b, 255);
|
1569 |
-
|
1570 |
-
var max = mathMax(r, g, b), min = mathMin(r, g, b);
|
1571 |
-
var h, s, l = (max + min) / 2;
|
1572 |
-
|
1573 |
-
if(max == min) {
|
1574 |
-
h = s = 0; // achromatic
|
1575 |
-
}
|
1576 |
-
else {
|
1577 |
-
var d = max - min;
|
1578 |
-
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
1579 |
-
switch(max) {
|
1580 |
-
case r: h = (g - b) / d + (g < b ? 6 : 0); break;
|
1581 |
-
case g: h = (b - r) / d + 2; break;
|
1582 |
-
case b: h = (r - g) / d + 4; break;
|
1583 |
-
}
|
1584 |
-
|
1585 |
-
h /= 6;
|
1586 |
-
}
|
1587 |
-
|
1588 |
-
return { h: h, s: s, l: l };
|
1589 |
-
}
|
1590 |
-
|
1591 |
-
// `hslToRgb`
|
1592 |
-
// Converts an HSL color value to RGB.
|
1593 |
-
// *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100]
|
1594 |
-
// *Returns:* { r, g, b } in the set [0, 255]
|
1595 |
-
function hslToRgb(h, s, l) {
|
1596 |
-
var r, g, b;
|
1597 |
-
|
1598 |
-
h = bound01(h, 360);
|
1599 |
-
s = bound01(s, 100);
|
1600 |
-
l = bound01(l, 100);
|
1601 |
-
|
1602 |
-
function hue2rgb(p, q, t) {
|
1603 |
-
if(t < 0) t += 1;
|
1604 |
-
if(t > 1) t -= 1;
|
1605 |
-
if(t < 1/6) return p + (q - p) * 6 * t;
|
1606 |
-
if(t < 1/2) return q;
|
1607 |
-
if(t < 2/3) return p + (q - p) * (2/3 - t) * 6;
|
1608 |
-
return p;
|
1609 |
-
}
|
1610 |
-
|
1611 |
-
if(s === 0) {
|
1612 |
-
r = g = b = l; // achromatic
|
1613 |
-
}
|
1614 |
-
else {
|
1615 |
-
var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
1616 |
-
var p = 2 * l - q;
|
1617 |
-
r = hue2rgb(p, q, h + 1/3);
|
1618 |
-
g = hue2rgb(p, q, h);
|
1619 |
-
b = hue2rgb(p, q, h - 1/3);
|
1620 |
-
}
|
1621 |
-
|
1622 |
-
return { r: r * 255, g: g * 255, b: b * 255 };
|
1623 |
-
}
|
1624 |
-
|
1625 |
-
// `rgbToHsv`
|
1626 |
-
// Converts an RGB color value to HSV
|
1627 |
-
// *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1]
|
1628 |
-
// *Returns:* { h, s, v } in [0,1]
|
1629 |
-
function rgbToHsv(r, g, b) {
|
1630 |
-
|
1631 |
-
r = bound01(r, 255);
|
1632 |
-
g = bound01(g, 255);
|
1633 |
-
b = bound01(b, 255);
|
1634 |
-
|
1635 |
-
var max = mathMax(r, g, b), min = mathMin(r, g, b);
|
1636 |
-
var h, s, v = max;
|
1637 |
-
|
1638 |
-
var d = max - min;
|
1639 |
-
s = max === 0 ? 0 : d / max;
|
1640 |
-
|
1641 |
-
if(max == min) {
|
1642 |
-
h = 0; // achromatic
|
1643 |
-
}
|
1644 |
-
else {
|
1645 |
-
switch(max) {
|
1646 |
-
case r: h = (g - b) / d + (g < b ? 6 : 0); break;
|
1647 |
-
case g: h = (b - r) / d + 2; break;
|
1648 |
-
case b: h = (r - g) / d + 4; break;
|
1649 |
-
}
|
1650 |
-
h /= 6;
|
1651 |
-
}
|
1652 |
-
return { h: h, s: s, v: v };
|
1653 |
-
}
|
1654 |
-
|
1655 |
-
// `hsvToRgb`
|
1656 |
-
// Converts an HSV color value to RGB.
|
1657 |
-
// *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100]
|
1658 |
-
// *Returns:* { r, g, b } in the set [0, 255]
|
1659 |
-
function hsvToRgb(h, s, v) {
|
1660 |
-
|
1661 |
-
h = bound01(h, 360) * 6;
|
1662 |
-
s = bound01(s, 100);
|
1663 |
-
v = bound01(v, 100);
|
1664 |
-
|
1665 |
-
var i = math.floor(h),
|
1666 |
-
f = h - i,
|
1667 |
-
p = v * (1 - s),
|
1668 |
-
q = v * (1 - f * s),
|
1669 |
-
t = v * (1 - (1 - f) * s),
|
1670 |
-
mod = i % 6,
|
1671 |
-
r = [v, q, p, p, t, v][mod],
|
1672 |
-
g = [t, v, v, q, p, p][mod],
|
1673 |
-
b = [p, p, t, v, v, q][mod];
|
1674 |
-
|
1675 |
-
return { r: r * 255, g: g * 255, b: b * 255 };
|
1676 |
-
}
|
1677 |
-
|
1678 |
-
// `rgbToHex`
|
1679 |
-
// Converts an RGB color to hex
|
1680 |
-
// Assumes r, g, and b are contained in the set [0, 255]
|
1681 |
-
// Returns a 3 or 6 character hex
|
1682 |
-
function rgbToHex(r, g, b, allow3Char) {
|
1683 |
-
|
1684 |
-
var hex = [
|
1685 |
-
pad2(mathRound(r).toString(16)),
|
1686 |
-
pad2(mathRound(g).toString(16)),
|
1687 |
-
pad2(mathRound(b).toString(16))
|
1688 |
-
];
|
1689 |
-
|
1690 |
-
// Return a 3 character hex if possible
|
1691 |
-
if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {
|
1692 |
-
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
|
1693 |
-
}
|
1694 |
-
|
1695 |
-
return hex.join("");
|
1696 |
-
}
|
1697 |
-
// `rgbaToHex`
|
1698 |
-
// Converts an RGBA color plus alpha transparency to hex
|
1699 |
-
// Assumes r, g, b and a are contained in the set [0, 255]
|
1700 |
-
// Returns an 8 character hex
|
1701 |
-
function rgbaToHex(r, g, b, a) {
|
1702 |
-
|
1703 |
-
var hex = [
|
1704 |
-
pad2(convertDecimalToHex(a)),
|
1705 |
-
pad2(mathRound(r).toString(16)),
|
1706 |
-
pad2(mathRound(g).toString(16)),
|
1707 |
-
pad2(mathRound(b).toString(16))
|
1708 |
-
];
|
1709 |
-
|
1710 |
-
return hex.join("");
|
1711 |
-
}
|
1712 |
-
|
1713 |
-
// `equals`
|
1714 |
-
// Can be called with any tinycolor input
|
1715 |
-
tinycolor.equals = function (color1, color2) {
|
1716 |
-
if (!color1 || !color2) { return false; }
|
1717 |
-
return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString();
|
1718 |
-
};
|
1719 |
-
tinycolor.random = function() {
|
1720 |
-
return tinycolor.fromRatio({
|
1721 |
-
r: mathRandom(),
|
1722 |
-
g: mathRandom(),
|
1723 |
-
b: mathRandom()
|
1724 |
-
});
|
1725 |
-
};
|
1726 |
-
|
1727 |
-
|
1728 |
-
// Modification Functions
|
1729 |
-
// ----------------------
|
1730 |
-
// Thanks to less.js for some of the basics here
|
1731 |
-
// <https://github.com/cloudhead/less.js/blob/master/lib/less/functions.js>
|
1732 |
-
|
1733 |
-
function desaturate(color, amount) {
|
1734 |
-
amount = (amount === 0) ? 0 : (amount || 10);
|
1735 |
-
var hsl = tinycolor(color).toHsl();
|
1736 |
-
hsl.s -= amount / 100;
|
1737 |
-
hsl.s = clamp01(hsl.s);
|
1738 |
-
return tinycolor(hsl);
|
1739 |
-
}
|
1740 |
-
|
1741 |
-
function saturate(color, amount) {
|
1742 |
-
amount = (amount === 0) ? 0 : (amount || 10);
|
1743 |
-
var hsl = tinycolor(color).toHsl();
|
1744 |
-
hsl.s += amount / 100;
|
1745 |
-
hsl.s = clamp01(hsl.s);
|
1746 |
-
return tinycolor(hsl);
|
1747 |
-
}
|
1748 |
-
|
1749 |
-
function greyscale(color) {
|
1750 |
-
return tinycolor(color).desaturate(100);
|
1751 |
-
}
|
1752 |
-
|
1753 |
-
function lighten (color, amount) {
|
1754 |
-
amount = (amount === 0) ? 0 : (amount || 10);
|
1755 |
-
var hsl = tinycolor(color).toHsl();
|
1756 |
-
hsl.l += amount / 100;
|
1757 |
-
hsl.l = clamp01(hsl.l);
|
1758 |
-
return tinycolor(hsl);
|
1759 |
-
}
|
1760 |
-
|
1761 |
-
function brighten(color, amount) {
|
1762 |
-
amount = (amount === 0) ? 0 : (amount || 10);
|
1763 |
-
var rgb = tinycolor(color).toRgb();
|
1764 |
-
rgb.r = mathMax(0, mathMin(255, rgb.r - mathRound(255 * - (amount / 100))));
|
1765 |
-
rgb.g = mathMax(0, mathMin(255, rgb.g - mathRound(255 * - (amount / 100))));
|
1766 |
-
rgb.b = mathMax(0, mathMin(255, rgb.b - mathRound(255 * - (amount / 100))));
|
1767 |
-
return tinycolor(rgb);
|
1768 |
-
}
|
1769 |
-
|
1770 |
-
function darken (color, amount) {
|
1771 |
-
amount = (amount === 0) ? 0 : (amount || 10);
|
1772 |
-
var hsl = tinycolor(color).toHsl();
|
1773 |
-
hsl.l -= amount / 100;
|
1774 |
-
hsl.l = clamp01(hsl.l);
|
1775 |
-
return tinycolor(hsl);
|
1776 |
-
}
|
1777 |
-
|
1778 |
-
// Spin takes a positive or negative amount within [-360, 360] indicating the change of hue.
|
1779 |
-
// Values outside of this range will be wrapped into this range.
|
1780 |
-
function spin(color, amount) {
|
1781 |
-
var hsl = tinycolor(color).toHsl();
|
1782 |
-
var hue = (mathRound(hsl.h) + amount) % 360;
|
1783 |
-
hsl.h = hue < 0 ? 360 + hue : hue;
|
1784 |
-
return tinycolor(hsl);
|
1785 |
-
}
|
1786 |
-
|
1787 |
-
// Combination Functions
|
1788 |
-
// ---------------------
|
1789 |
-
// Thanks to jQuery xColor for some of the ideas behind these
|
1790 |
-
// <https://github.com/infusion/jQuery-xcolor/blob/master/jquery.xcolor.js>
|
1791 |
-
|
1792 |
-
function complement(color) {
|
1793 |
-
var hsl = tinycolor(color).toHsl();
|
1794 |
-
hsl.h = (hsl.h + 180) % 360;
|
1795 |
-
return tinycolor(hsl);
|
1796 |
-
}
|
1797 |
-
|
1798 |
-
function triad(color) {
|
1799 |
-
var hsl = tinycolor(color).toHsl();
|
1800 |
-
var h = hsl.h;
|
1801 |
-
return [
|
1802 |
-
tinycolor(color),
|
1803 |
-
tinycolor({ h: (h + 120) % 360, s: hsl.s, l: hsl.l }),
|
1804 |
-
tinycolor({ h: (h + 240) % 360, s: hsl.s, l: hsl.l })
|
1805 |
-
];
|
1806 |
-
}
|
1807 |
-
|
1808 |
-
function tetrad(color) {
|
1809 |
-
var hsl = tinycolor(color).toHsl();
|
1810 |
-
var h = hsl.h;
|
1811 |
-
return [
|
1812 |
-
tinycolor(color),
|
1813 |
-
tinycolor({ h: (h + 90) % 360, s: hsl.s, l: hsl.l }),
|
1814 |
-
tinycolor({ h: (h + 180) % 360, s: hsl.s, l: hsl.l }),
|
1815 |
-
tinycolor({ h: (h + 270) % 360, s: hsl.s, l: hsl.l })
|
1816 |
-
];
|
1817 |
-
}
|
1818 |
-
|
1819 |
-
function splitcomplement(color) {
|
1820 |
-
var hsl = tinycolor(color).toHsl();
|
1821 |
-
var h = hsl.h;
|
1822 |
-
return [
|
1823 |
-
tinycolor(color),
|
1824 |
-
tinycolor({ h: (h + 72) % 360, s: hsl.s, l: hsl.l}),
|
1825 |
-
tinycolor({ h: (h + 216) % 360, s: hsl.s, l: hsl.l})
|
1826 |
-
];
|
1827 |
-
}
|
1828 |
-
|
1829 |
-
function analogous(color, results, slices) {
|
1830 |
-
results = results || 6;
|
1831 |
-
slices = slices || 30;
|
1832 |
-
|
1833 |
-
var hsl = tinycolor(color).toHsl();
|
1834 |
-
var part = 360 / slices;
|
1835 |
-
var ret = [tinycolor(color)];
|
1836 |
-
|
1837 |
-
for (hsl.h = ((hsl.h - (part * results >> 1)) + 720) % 360; --results; ) {
|
1838 |
-
hsl.h = (hsl.h + part) % 360;
|
1839 |
-
ret.push(tinycolor(hsl));
|
1840 |
-
}
|
1841 |
-
return ret;
|
1842 |
-
}
|
1843 |
-
|
1844 |
-
function monochromatic(color, results) {
|
1845 |
-
results = results || 6;
|
1846 |
-
var hsv = tinycolor(color).toHsv();
|
1847 |
-
var h = hsv.h, s = hsv.s, v = hsv.v;
|
1848 |
-
var ret = [];
|
1849 |
-
var modification = 1 / results;
|
1850 |
-
|
1851 |
-
while (results--) {
|
1852 |
-
ret.push(tinycolor({ h: h, s: s, v: v}));
|
1853 |
-
v = (v + modification) % 1;
|
1854 |
-
}
|
1855 |
-
|
1856 |
-
return ret;
|
1857 |
-
}
|
1858 |
-
|
1859 |
-
// Utility Functions
|
1860 |
-
// ---------------------
|
1861 |
-
|
1862 |
-
tinycolor.mix = function(color1, color2, amount) {
|
1863 |
-
amount = (amount === 0) ? 0 : (amount || 50);
|
1864 |
-
|
1865 |
-
var rgb1 = tinycolor(color1).toRgb();
|
1866 |
-
var rgb2 = tinycolor(color2).toRgb();
|
1867 |
-
|
1868 |
-
var p = amount / 100;
|
1869 |
-
var w = p * 2 - 1;
|
1870 |
-
var a = rgb2.a - rgb1.a;
|
1871 |
-
|
1872 |
-
var w1;
|
1873 |
-
|
1874 |
-
if (w * a == -1) {
|
1875 |
-
w1 = w;
|
1876 |
-
} else {
|
1877 |
-
w1 = (w + a) / (1 + w * a);
|
1878 |
-
}
|
1879 |
-
|
1880 |
-
w1 = (w1 + 1) / 2;
|
1881 |
-
|
1882 |
-
var w2 = 1 - w1;
|
1883 |
-
|
1884 |
-
var rgba = {
|
1885 |
-
r: rgb2.r * w1 + rgb1.r * w2,
|
1886 |
-
g: rgb2.g * w1 + rgb1.g * w2,
|
1887 |
-
b: rgb2.b * w1 + rgb1.b * w2,
|
1888 |
-
a: rgb2.a * p + rgb1.a * (1 - p)
|
1889 |
-
};
|
1890 |
-
|
1891 |
-
return tinycolor(rgba);
|
1892 |
-
};
|
1893 |
-
|
1894 |
-
|
1895 |
-
// Readability Functions
|
1896 |
-
// ---------------------
|
1897 |
-
// <http://www.w3.org/TR/AERT#color-contrast>
|
1898 |
-
|
1899 |
-
// `readability`
|
1900 |
-
// Analyze the 2 colors and returns an object with the following properties:
|
1901 |
-
// `brightness`: difference in brightness between the two colors
|
1902 |
-
// `color`: difference in color/hue between the two colors
|
1903 |
-
tinycolor.readability = function(color1, color2) {
|
1904 |
-
var c1 = tinycolor(color1);
|
1905 |
-
var c2 = tinycolor(color2);
|
1906 |
-
var rgb1 = c1.toRgb();
|
1907 |
-
var rgb2 = c2.toRgb();
|
1908 |
-
var brightnessA = c1.getBrightness();
|
1909 |
-
var brightnessB = c2.getBrightness();
|
1910 |
-
var colorDiff = (
|
1911 |
-
Math.max(rgb1.r, rgb2.r) - Math.min(rgb1.r, rgb2.r) +
|
1912 |
-
Math.max(rgb1.g, rgb2.g) - Math.min(rgb1.g, rgb2.g) +
|
1913 |
-
Math.max(rgb1.b, rgb2.b) - Math.min(rgb1.b, rgb2.b)
|
1914 |
-
);
|
1915 |
-
|
1916 |
-
return {
|
1917 |
-
brightness: Math.abs(brightnessA - brightnessB),
|
1918 |
-
color: colorDiff
|
1919 |
-
};
|
1920 |
-
};
|
1921 |
-
|
1922 |
-
// `readable`
|
1923 |
-
// http://www.w3.org/TR/AERT#color-contrast
|
1924 |
-
// Ensure that foreground and background color combinations provide sufficient contrast.
|
1925 |
-
// *Example*
|
1926 |
-
// tinycolor.isReadable("#000", "#111") => false
|
1927 |
-
tinycolor.isReadable = function(color1, color2) {
|
1928 |
-
var readability = tinycolor.readability(color1, color2);
|
1929 |
-
return readability.brightness > 125 && readability.color > 500;
|
1930 |
-
};
|
1931 |
-
|
1932 |
-
// `mostReadable`
|
1933 |
-
// Given a base color and a list of possible foreground or background
|
1934 |
-
// colors for that base, returns the most readable color.
|
1935 |
-
// *Example*
|
1936 |
-
// tinycolor.mostReadable("#123", ["#fff", "#000"]) => "#000"
|
1937 |
-
tinycolor.mostReadable = function(baseColor, colorList) {
|
1938 |
-
var bestColor = null;
|
1939 |
-
var bestScore = 0;
|
1940 |
-
var bestIsReadable = false;
|
1941 |
-
for (var i=0; i < colorList.length; i++) {
|
1942 |
-
|
1943 |
-
// We normalize both around the "acceptable" breaking point,
|
1944 |
-
// but rank brightness constrast higher than hue.
|
1945 |
-
|
1946 |
-
var readability = tinycolor.readability(baseColor, colorList[i]);
|
1947 |
-
var readable = readability.brightness > 125 && readability.color > 500;
|
1948 |
-
var score = 3 * (readability.brightness / 125) + (readability.color / 500);
|
1949 |
-
|
1950 |
-
if ((readable && ! bestIsReadable) ||
|
1951 |
-
(readable && bestIsReadable && score > bestScore) ||
|
1952 |
-
((! readable) && (! bestIsReadable) && score > bestScore)) {
|
1953 |
-
bestIsReadable = readable;
|
1954 |
-
bestScore = score;
|
1955 |
-
bestColor = tinycolor(colorList[i]);
|
1956 |
-
}
|
1957 |
-
}
|
1958 |
-
return bestColor;
|
1959 |
-
};
|
1960 |
-
|
1961 |
-
|
1962 |
-
// Big List of Colors
|
1963 |
-
// ------------------
|
1964 |
-
// <http://www.w3.org/TR/css3-color/#svg-color>
|
1965 |
-
var names = tinycolor.names = {
|
1966 |
-
aliceblue: "f0f8ff",
|
1967 |
-
antiquewhite: "faebd7",
|
1968 |
-
aqua: "0ff",
|
1969 |
-
aquamarine: "7fffd4",
|
1970 |
-
azure: "f0ffff",
|
1971 |
-
beige: "f5f5dc",
|
1972 |
-
bisque: "ffe4c4",
|
1973 |
-
black: "000",
|
1974 |
-
blanchedalmond: "ffebcd",
|
1975 |
-
blue: "00f",
|
1976 |
-
blueviolet: "8a2be2",
|
1977 |
-
brown: "a52a2a",
|
1978 |
-
burlywood: "deb887",
|
1979 |
-
burntsienna: "ea7e5d",
|
1980 |
-
cadetblue: "5f9ea0",
|
1981 |
-
chartreuse: "7fff00",
|
1982 |
-
chocolate: "d2691e",
|
1983 |
-
coral: "ff7f50",
|
1984 |
-
cornflowerblue: "6495ed",
|
1985 |
-
cornsilk: "fff8dc",
|
1986 |
-
crimson: "dc143c",
|
1987 |
-
cyan: "0ff",
|
1988 |
-
darkblue: "00008b",
|
1989 |
-
darkcyan: "008b8b",
|
1990 |
-
darkgoldenrod: "b8860b",
|
1991 |
-
darkgray: "a9a9a9",
|
1992 |
-
darkgreen: "006400",
|
1993 |
-
darkgrey: "a9a9a9",
|
1994 |
-
darkkhaki: "bdb76b",
|
1995 |
-
darkmagenta: "8b008b",
|
1996 |
-
darkolivegreen: "556b2f",
|
1997 |
-
darkorange: "ff8c00",
|
1998 |
-
darkorchid: "9932cc",
|
1999 |
-
darkred: "8b0000",
|
2000 |
-
darksalmon: "e9967a",
|
2001 |
-
darkseagreen: "8fbc8f",
|
2002 |
-
darkslateblue: "483d8b",
|
2003 |
-
darkslategray: "2f4f4f",
|
2004 |
-
darkslategrey: "2f4f4f",
|
2005 |
-
darkturquoise: "00ced1",
|
2006 |
-
darkviolet: "9400d3",
|
2007 |
-
deeppink: "ff1493",
|
2008 |
-
deepskyblue: "00bfff",
|
2009 |
-
dimgray: "696969",
|
2010 |
-
dimgrey: "696969",
|
2011 |
-
dodgerblue: "1e90ff",
|
2012 |
-
firebrick: "b22222",
|
2013 |
-
floralwhite: "fffaf0",
|
2014 |
-
forestgreen: "228b22",
|
2015 |
-
fuchsia: "f0f",
|
2016 |
-
gainsboro: "dcdcdc",
|
2017 |
-
ghostwhite: "f8f8ff",
|
2018 |
-
gold: "ffd700",
|
2019 |
-
goldenrod: "daa520",
|
2020 |
-
gray: "808080",
|
2021 |
-
green: "008000",
|
2022 |
-
greenyellow: "adff2f",
|
2023 |
-
grey: "808080",
|
2024 |
-
honeydew: "f0fff0",
|
2025 |
-
hotpink: "ff69b4",
|
2026 |
-
indianred: "cd5c5c",
|
2027 |
-
indigo: "4b0082",
|
2028 |
-
ivory: "fffff0",
|
2029 |
-
khaki: "f0e68c",
|
2030 |
-
lavender: "e6e6fa",
|
2031 |
-
lavenderblush: "fff0f5",
|
2032 |
-
lawngreen: "7cfc00",
|
2033 |
-
lemonchiffon: "fffacd",
|
2034 |
-
lightblue: "add8e6",
|
2035 |
-
lightcoral: "f08080",
|
2036 |
-
lightcyan: "e0ffff",
|
2037 |
-
lightgoldenrodyellow: "fafad2",
|
2038 |
-
lightgray: "d3d3d3",
|
2039 |
-
lightgreen: "90ee90",
|
2040 |
-
lightgrey: "d3d3d3",
|
2041 |
-
lightpink: "ffb6c1",
|
2042 |
-
lightsalmon: "ffa07a",
|
2043 |
-
lightseagreen: "20b2aa",
|
2044 |
-
lightskyblue: "87cefa",
|
2045 |
-
lightslategray: "789",
|
2046 |
-
lightslategrey: "789",
|
2047 |
-
lightsteelblue: "b0c4de",
|
2048 |
-
lightyellow: "ffffe0",
|
2049 |
-
lime: "0f0",
|
2050 |
-
limegreen: "32cd32",
|
2051 |
-
linen: "faf0e6",
|
2052 |
-
magenta: "f0f",
|
2053 |
-
maroon: "800000",
|
2054 |
-
mediumaquamarine: "66cdaa",
|
2055 |
-
mediumblue: "0000cd",
|
2056 |
-
mediumorchid: "ba55d3",
|
2057 |
-
mediumpurple: "9370db",
|
2058 |
-
mediumseagreen: "3cb371",
|
2059 |
-
mediumslateblue: "7b68ee",
|
2060 |
-
mediumspringgreen: "00fa9a",
|
2061 |
-
mediumturquoise: "48d1cc",
|
2062 |
-
mediumvioletred: "c71585",
|
2063 |
-
midnightblue: "191970",
|
2064 |
-
mintcream: "f5fffa",
|
2065 |
-
mistyrose: "ffe4e1",
|
2066 |
-
moccasin: "ffe4b5",
|
2067 |
-
navajowhite: "ffdead",
|
2068 |
-
navy: "000080",
|
2069 |
-
oldlace: "fdf5e6",
|
2070 |
-
olive: "808000",
|
2071 |
-
olivedrab: "6b8e23",
|
2072 |
-
orange: "ffa500",
|
2073 |
-
orangered: "ff4500",
|
2074 |
-
orchid: "da70d6",
|
2075 |
-
palegoldenrod: "eee8aa",
|
2076 |
-
palegreen: "98fb98",
|
2077 |
-
paleturquoise: "afeeee",
|
2078 |
-
palevioletred: "db7093",
|
2079 |
-
papayawhip: "ffefd5",
|
2080 |
-
peachpuff: "ffdab9",
|
2081 |
-
peru: "cd853f",
|
2082 |
-
pink: "ffc0cb",
|
2083 |
-
plum: "dda0dd",
|
2084 |
-
powderblue: "b0e0e6",
|
2085 |
-
purple: "800080",
|
2086 |
-
rebeccapurple: "663399",
|
2087 |
-
red: "f00",
|
2088 |
-
rosybrown: "bc8f8f",
|
2089 |
-
royalblue: "4169e1",
|
2090 |
-
saddlebrown: "8b4513",
|
2091 |
-
salmon: "fa8072",
|
2092 |
-
sandybrown: "f4a460",
|
2093 |
-
seagreen: "2e8b57",
|
2094 |
-
seashell: "fff5ee",
|
2095 |
-
sienna: "a0522d",
|
2096 |
-
silver: "c0c0c0",
|
2097 |
-
skyblue: "87ceeb",
|
2098 |
-
slateblue: "6a5acd",
|
2099 |
-
slategray: "708090",
|
2100 |
-
slategrey: "708090",
|
2101 |
-
snow: "fffafa",
|
2102 |
-
springgreen: "00ff7f",
|
2103 |
-
steelblue: "4682b4",
|
2104 |
-
tan: "d2b48c",
|
2105 |
-
teal: "008080",
|
2106 |
-
thistle: "d8bfd8",
|
2107 |
-
tomato: "ff6347",
|
2108 |
-
turquoise: "40e0d0",
|
2109 |
-
violet: "ee82ee",
|
2110 |
-
wheat: "f5deb3",
|
2111 |
-
white: "fff",
|
2112 |
-
whitesmoke: "f5f5f5",
|
2113 |
-
yellow: "ff0",
|
2114 |
-
yellowgreen: "9acd32"
|
2115 |
-
};
|
2116 |
-
|
2117 |
-
// Make it easy to access colors via `hexNames[hex]`
|
2118 |
-
var hexNames = tinycolor.hexNames = flip(names);
|
2119 |
-
|
2120 |
-
|
2121 |
-
// Utilities
|
2122 |
-
// ---------
|
2123 |
-
|
2124 |
-
// `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }`
|
2125 |
-
function flip(o) {
|
2126 |
-
var flipped = { };
|
2127 |
-
for (var i in o) {
|
2128 |
-
if (o.hasOwnProperty(i)) {
|
2129 |
-
flipped[o[i]] = i;
|
2130 |
-
}
|
2131 |
-
}
|
2132 |
-
return flipped;
|
2133 |
-
}
|
2134 |
-
|
2135 |
-
// Return a valid alpha value [0,1] with all invalid values being set to 1
|
2136 |
-
function boundAlpha(a) {
|
2137 |
-
a = parseFloat(a);
|
2138 |
-
|
2139 |
-
if (isNaN(a) || a < 0 || a > 1) {
|
2140 |
-
a = 1;
|
2141 |
-
}
|
2142 |
-
|
2143 |
-
return a;
|
2144 |
-
}
|
2145 |
-
|
2146 |
-
// Take input from [0, n] and return it as [0, 1]
|
2147 |
-
function bound01(n, max) {
|
2148 |
-
if (isOnePointZero(n)) { n = "100%"; }
|
2149 |
-
|
2150 |
-
var processPercent = isPercentage(n);
|
2151 |
-
n = mathMin(max, mathMax(0, parseFloat(n)));
|
2152 |
-
|
2153 |
-
// Automatically convert percentage into number
|
2154 |
-
if (processPercent) {
|
2155 |
-
n = parseInt(n * max, 10) / 100;
|
2156 |
-
}
|
2157 |
-
|
2158 |
-
// Handle floating point rounding errors
|
2159 |
-
if ((math.abs(n - max) < 0.000001)) {
|
2160 |
-
return 1;
|
2161 |
-
}
|
2162 |
-
|
2163 |
-
// Convert into [0, 1] range if it isn't already
|
2164 |
-
return (n % max) / parseFloat(max);
|
2165 |
-
}
|
2166 |
-
|
2167 |
-
// Force a number between 0 and 1
|
2168 |
-
function clamp01(val) {
|
2169 |
-
return mathMin(1, mathMax(0, val));
|
2170 |
-
}
|
2171 |
-
|
2172 |
-
// Parse a base-16 hex value into a base-10 integer
|
2173 |
-
function parseIntFromHex(val) {
|
2174 |
-
return parseInt(val, 16);
|
2175 |
-
}
|
2176 |
-
|
2177 |
-
// Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1
|
2178 |
-
// <http://stackoverflow.com/questions/7422072/javascript-how-to-detect-number-as-a-decimal-including-1-0>
|
2179 |
-
function isOnePointZero(n) {
|
2180 |
-
return typeof n == "string" && n.indexOf('.') != -1 && parseFloat(n) === 1;
|
2181 |
-
}
|
2182 |
-
|
2183 |
-
// Check to see if string passed in is a percentage
|
2184 |
-
function isPercentage(n) {
|
2185 |
-
return typeof n === "string" && n.indexOf('%') != -1;
|
2186 |
-
}
|
2187 |
-
|
2188 |
-
// Force a hex value to have 2 characters
|
2189 |
-
function pad2(c) {
|
2190 |
-
return c.length == 1 ? '0' + c : '' + c;
|
2191 |
-
}
|
2192 |
-
|
2193 |
-
// Replace a decimal with it's percentage value
|
2194 |
-
function convertToPercentage(n) {
|
2195 |
-
if (n <= 1) {
|
2196 |
-
n = (n * 100) + "%";
|
2197 |
-
}
|
2198 |
-
|
2199 |
-
return n;
|
2200 |
-
}
|
2201 |
-
|
2202 |
-
// Converts a decimal to a hex value
|
2203 |
-
function convertDecimalToHex(d) {
|
2204 |
-
return Math.round(parseFloat(d) * 255).toString(16);
|
2205 |
-
}
|
2206 |
-
// Converts a hex value to a decimal
|
2207 |
-
function convertHexToDecimal(h) {
|
2208 |
-
return (parseIntFromHex(h) / 255);
|
2209 |
-
}
|
2210 |
-
|
2211 |
-
var matchers = (function() {
|
2212 |
-
|
2213 |
-
// <http://www.w3.org/TR/css3-values/#integers>
|
2214 |
-
var CSS_INTEGER = "[-\\+]?\\d+%?";
|
2215 |
-
|
2216 |
-
// <http://www.w3.org/TR/css3-values/#number-value>
|
2217 |
-
var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
|
2218 |
-
|
2219 |
-
// Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome.
|
2220 |
-
var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")";
|
2221 |
-
|
2222 |
-
// Actual matching.
|
2223 |
-
// Parentheses and commas are optional, but not required.
|
2224 |
-
// Whitespace can take the place of commas or opening paren
|
2225 |
-
var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
|
2226 |
-
var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
|
2227 |
-
|
2228 |
-
return {
|
2229 |
-
rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
|
2230 |
-
rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
|
2231 |
-
hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
|
2232 |
-
hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
|
2233 |
-
hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
|
2234 |
-
hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
|
2235 |
-
hex3: /^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
2236 |
-
hex6: /^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
|
2237 |
-
hex8: /^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
|
2238 |
-
};
|
2239 |
-
})();
|
2240 |
-
|
2241 |
-
// `stringInputToObject`
|
2242 |
-
// Permissive string parsing. Take in a number of formats, and output an object
|
2243 |
-
// based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}`
|
2244 |
-
function stringInputToObject(color) {
|
2245 |
-
|
2246 |
-
color = color.replace(trimLeft,'').replace(trimRight, '').toLowerCase();
|
2247 |
-
var named = false;
|
2248 |
-
if (names[color]) {
|
2249 |
-
color = names[color];
|
2250 |
-
named = true;
|
2251 |
-
}
|
2252 |
-
else if (color == 'transparent') {
|
2253 |
-
return { r: 0, g: 0, b: 0, a: 0, format: "name" };
|
2254 |
-
}
|
2255 |
-
|
2256 |
-
// Try to match string input using regular expressions.
|
2257 |
-
// Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360]
|
2258 |
-
// Just return an object and let the conversion functions handle that.
|
2259 |
-
// This way the result will be the same whether the tinycolor is initialized with string or object.
|
2260 |
-
var match;
|
2261 |
-
if ((match = matchers.rgb.exec(color))) {
|
2262 |
-
return { r: match[1], g: match[2], b: match[3] };
|
2263 |
-
}
|
2264 |
-
if ((match = matchers.rgba.exec(color))) {
|
2265 |
-
return { r: match[1], g: match[2], b: match[3], a: match[4] };
|
2266 |
-
}
|
2267 |
-
if ((match = matchers.hsl.exec(color))) {
|
2268 |
-
return { h: match[1], s: match[2], l: match[3] };
|
2269 |
-
}
|
2270 |
-
if ((match = matchers.hsla.exec(color))) {
|
2271 |
-
return { h: match[1], s: match[2], l: match[3], a: match[4] };
|
2272 |
-
}
|
2273 |
-
if ((match = matchers.hsv.exec(color))) {
|
2274 |
-
return { h: match[1], s: match[2], v: match[3] };
|
2275 |
-
}
|
2276 |
-
if ((match = matchers.hsva.exec(color))) {
|
2277 |
-
return { h: match[1], s: match[2], v: match[3], a: match[4] };
|
2278 |
-
}
|
2279 |
-
if ((match = matchers.hex8.exec(color))) {
|
2280 |
-
return {
|
2281 |
-
a: convertHexToDecimal(match[1]),
|
2282 |
-
r: parseIntFromHex(match[2]),
|
2283 |
-
g: parseIntFromHex(match[3]),
|
2284 |
-
b: parseIntFromHex(match[4]),
|
2285 |
-
format: named ? "name" : "hex8"
|
2286 |
-
};
|
2287 |
-
}
|
2288 |
-
if ((match = matchers.hex6.exec(color))) {
|
2289 |
-
return {
|
2290 |
-
r: parseIntFromHex(match[1]),
|
2291 |
-
g: parseIntFromHex(match[2]),
|
2292 |
-
b: parseIntFromHex(match[3]),
|
2293 |
-
format: named ? "name" : "hex"
|
2294 |
-
};
|
2295 |
-
}
|
2296 |
-
if ((match = matchers.hex3.exec(color))) {
|
2297 |
-
return {
|
2298 |
-
r: parseIntFromHex(match[1] + '' + match[1]),
|
2299 |
-
g: parseIntFromHex(match[2] + '' + match[2]),
|
2300 |
-
b: parseIntFromHex(match[3] + '' + match[3]),
|
2301 |
-
format: named ? "name" : "hex"
|
2302 |
-
};
|
2303 |
-
}
|
2304 |
-
|
2305 |
-
return false;
|
2306 |
-
}
|
2307 |
-
|
2308 |
-
window.tinycolor = tinycolor;
|
2309 |
-
})();
|
2310 |
-
|
2311 |
-
$(function () {
|
2312 |
-
if ($.fn.spectrum.load) {
|
2313 |
-
$.fn.spectrum.processNativeColorInputs();
|
2314 |
-
}
|
2315 |
-
});
|
2316 |
-
|
2317 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/simple-admin-pages/lib/pickadate/picker.date.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
/*!
|
2 |
-
* Date picker for pickadate.js v3.6.
|
3 |
* http://amsul.github.io/pickadate.js/date.htm
|
4 |
*/
|
5 |
!function(a){"function"==typeof define&&define.amd?define(["./picker","jquery"],a):"object"==typeof exports?module.exports=a(require("./picker.js"),require("jquery")):a(Picker,jQuery)}(function(a,b){function c(a,b){var c=this,d=a.$node[0],e=d.value,f=a.$node.data("value"),g=f||e,h=f?b.formatSubmit:b.format,i=function(){return d.currentStyle?"rtl"==d.currentStyle.direction:"rtl"==getComputedStyle(a.$root[0]).direction};c.settings=b,c.$node=a.$node,c.queue={min:"measure create",max:"measure create",now:"now create",select:"parse create validate",highlight:"parse navigate create validate",view:"parse create validate viewset",disable:"deactivate",enable:"activate"},c.item={},c.item.clear=null,c.item.disable=(b.disable||[]).slice(0),c.item.enable=-function(a){return!0===a[0]?a.shift():-1}(c.item.disable),c.set("min",b.min).set("max",b.max).set("now"),g?c.set("select",g,{format:h,defaultValue:!0}):c.set("select",null).set("highlight",c.item.now),c.key={40:7,38:-7,39:function(){return i()?-1:1},37:function(){return i()?1:-1},go:function(a){var b=c.item.highlight,d=new Date(b.year,b.month,b.date+a);c.set("highlight",d,{interval:a}),this.render()}},a.on("render",function(){a.$root.find("."+b.klass.selectMonth).on("change",function(){var c=this.value;c&&(a.set("highlight",[a.get("view").year,c,a.get("highlight").date]),a.$root.find("."+b.klass.selectMonth).trigger("focus"))}),a.$root.find("."+b.klass.selectYear).on("change",function(){var c=this.value;c&&(a.set("highlight",[c,a.get("view").month,a.get("highlight").date]),a.$root.find("."+b.klass.selectYear).trigger("focus"))})},1).on("open",function(){var d="";c.disabled(c.get("now"))&&(d=":not(."+b.klass.buttonToday+")"),a.$root.find("button"+d+", select").attr("disabled",!1)},1).on("close",function(){a.$root.find("button, select").attr("disabled",!0)},1)}var d=7,e=a._;c.prototype.set=function(a,b,c){var d=this,e=d.item;return null===b?("clear"==a&&(a="select"),e[a]=b,d):(e["enable"==a?"disable":"flip"==a?"enable":a]=d.queue[a].split(" ").map(function(e){return b=d[e](a,b,c)}).pop(),"select"==a?d.set("highlight",e.select,c):"highlight"==a?d.set("view",e.highlight,c):a.match(/^(flip|min|max|disable|enable)$/)&&(e.select&&d.disabled(e.select)&&d.set("select",e.select,c),e.highlight&&d.disabled(e.highlight)&&d.set("highlight",e.highlight,c)),d)},c.prototype.get=function(a){return this.item[a]},c.prototype.create=function(a,c,d){var f,g=this;return c=void 0===c?a:c,c==-1/0||c==1/0?f=c:b.isPlainObject(c)&&e.isInteger(c.pick)?c=c.obj:b.isArray(c)?(c=new Date(c[0],c[1],c[2]),c=e.isDate(c)?c:g.create().obj):c=e.isInteger(c)||e.isDate(c)?g.normalize(new Date(c),d):g.now(a,c,d),{year:f||c.getFullYear(),month:f||c.getMonth(),date:f||c.getDate(),day:f||c.getDay(),obj:f||c,pick:f||c.getTime()}},c.prototype.createRange=function(a,c){var d=this,f=function(a){return!0===a||b.isArray(a)||e.isDate(a)?d.create(a):a};return e.isInteger(a)||(a=f(a)),e.isInteger(c)||(c=f(c)),e.isInteger(a)&&b.isPlainObject(c)?a=[c.year,c.month,c.date+a]:e.isInteger(c)&&b.isPlainObject(a)&&(c=[a.year,a.month,a.date+c]),{from:f(a),to:f(c)}},c.prototype.withinRange=function(a,b){return a=this.createRange(a.from,a.to),b.pick>=a.from.pick&&b.pick<=a.to.pick},c.prototype.overlapRanges=function(a,b){var c=this;return a=c.createRange(a.from,a.to),b=c.createRange(b.from,b.to),c.withinRange(a,b.from)||c.withinRange(a,b.to)||c.withinRange(b,a.from)||c.withinRange(b,a.to)},c.prototype.now=function(a,b,c){return b=new Date,c&&c.rel&&b.setDate(b.getDate()+c.rel),this.normalize(b,c)},c.prototype.navigate=function(a,c,d){var e,f,g,h,i=b.isArray(c),j=b.isPlainObject(c),k=this.item.view;if(i||j){for(j?(f=c.year,g=c.month,h=c.date):(f=+c[0],g=+c[1],h=+c[2]),d&&d.nav&&k&&k.month!==g&&(f=k.year,g=k.month),e=new Date(f,g+(d&&d.nav?d.nav:0),1),f=e.getFullYear(),g=e.getMonth();new Date(f,g,h).getMonth()!==g;)h-=1;c=[f,g,h]}return c},c.prototype.normalize=function(a){return a.setHours(0,0,0,0),a},c.prototype.measure=function(a,b){var c=this;return e.isInteger(b)?b=c.now(a,b,{rel:b}):b?"string"==typeof b&&(b=c.parse(a,b)):b="min"==a?-1/0:1/0,b},c.prototype.viewset=function(a,b){return this.create([b.year,b.month,1])},c.prototype.validate=function(a,c,d){var f,g,h,i,j=this,k=c,l=d&&d.interval?d.interval:1,m=-1===j.item.enable,n=j.item.min,o=j.item.max,p=m&&j.item.disable.filter(function(a){if(b.isArray(a)){var d=j.create(a).pick;d<c.pick?f=!0:d>c.pick&&(g=!0)}return e.isInteger(a)}).length;if((!d||!d.nav&&!d.defaultValue)&&(!m&&j.disabled(c)||m&&j.disabled(c)&&(p||f||g)||!m&&(c.pick<=n.pick||c.pick>=o.pick)))for(m&&!p&&(!g&&l>0||!f&&l<0)&&(l*=-1);j.disabled(c)&&(Math.abs(l)>1&&(c.month<k.month||c.month>k.month)&&(c=k,l=l>0?1:-1),c.pick<=n.pick?(h=!0,l=1,c=j.create([n.year,n.month,n.date+(c.pick===n.pick?0:-1)])):c.pick>=o.pick&&(i=!0,l=-1,c=j.create([o.year,o.month,o.date+(c.pick===o.pick?0:1)])),!h||!i);)c=j.create([c.year,c.month,c.date+l]);return c},c.prototype.disabled=function(a){var c=this,d=c.item.disable.filter(function(d){return e.isInteger(d)?a.day===(c.settings.firstDay?d:d-1)%7:b.isArray(d)||e.isDate(d)?a.pick===c.create(d).pick:b.isPlainObject(d)?c.withinRange(d,a):void 0});return d=d.length&&!d.filter(function(a){return b.isArray(a)&&"inverted"==a[3]||b.isPlainObject(a)&&a.inverted}).length,-1===c.item.enable?!d:d||a.pick<c.item.min.pick||a.pick>c.item.max.pick},c.prototype.parse=function(a,b,c){var d=this,f={};return b&&"string"==typeof b?(c&&c.format||(c=c||{},c.format=d.settings.format),d.formats.toArray(c.format).map(function(a){var c=d.formats[a],g=c?e.trigger(c,d,[b,f]):a.replace(/^!/,"").length;c&&(f[a]=b.substr(0,g)),b=b.substr(g)}),[f.yyyy||f.yy,+(f.mm||f.m)-1,f.dd||f.d]):b},c.prototype.formats=function(){function a(a,b,c){var d=a.match(/[^\x00-\x7F]+|\w+/)[0];return c.mm||c.m||(c.m=b.indexOf(d)+1),d.length}function b(a){return a.match(/\w+/)[0].length}return{d:function(a,b){return a?e.digits(a):b.date},dd:function(a,b){return a?2:e.lead(b.date)},ddd:function(a,c){return a?b(a):this.settings.weekdaysShort[c.day]},dddd:function(a,c){return a?b(a):this.settings.weekdaysFull[c.day]},m:function(a,b){return a?e.digits(a):b.month+1},mm:function(a,b){return a?2:e.lead(b.month+1)},mmm:function(b,c){var d=this.settings.monthsShort;return b?a(b,d,c):d[c.month]},mmmm:function(b,c){var d=this.settings.monthsFull;return b?a(b,d,c):d[c.month]},yy:function(a,b){return a?2:(""+b.year).slice(2)},yyyy:function(a,b){return a?4:b.year},toArray:function(a){return a.split(/(d{1,4}|m{1,4}|y{4}|yy|!.)/g)},toString:function(a,b){var c=this;return c.formats.toArray(a).map(function(a){return e.trigger(c.formats[a],c,[0,b])||a.replace(/^!/,"")}).join("")}}}(),c.prototype.isDateExact=function(a,c){var d=this;return e.isInteger(a)&&e.isInteger(c)||"boolean"==typeof a&&"boolean"==typeof c?a===c:(e.isDate(a)||b.isArray(a))&&(e.isDate(c)||b.isArray(c))?d.create(a).pick===d.create(c).pick:!(!b.isPlainObject(a)||!b.isPlainObject(c))&&d.isDateExact(a.from,c.from)&&d.isDateExact(a.to,c.to)},c.prototype.isDateOverlap=function(a,c){var d=this,f=d.settings.firstDay?1:0;return e.isInteger(a)&&(e.isDate(c)||b.isArray(c))?(a=a%7+f)===d.create(c).day+1:e.isInteger(c)&&(e.isDate(a)||b.isArray(a))?(c=c%7+f)===d.create(a).day+1:!(!b.isPlainObject(a)||!b.isPlainObject(c))&&d.overlapRanges(a,c)},c.prototype.flipEnable=function(a){var b=this.item;b.enable=a||(-1==b.enable?1:-1)},c.prototype.deactivate=function(a,c){var d=this,f=d.item.disable.slice(0);return"flip"==c?d.flipEnable():!1===c?(d.flipEnable(1),f=[]):!0===c?(d.flipEnable(-1),f=[]):c.map(function(a){for(var c,g=0;g<f.length;g+=1)if(d.isDateExact(a,f[g])){c=!0;break}c||(e.isInteger(a)||e.isDate(a)||b.isArray(a)||b.isPlainObject(a)&&a.from&&a.to)&&f.push(a)}),f},c.prototype.activate=function(a,c){var d=this,f=d.item.disable,g=f.length;return"flip"==c?d.flipEnable():!0===c?(d.flipEnable(1),f=[]):!1===c?(d.flipEnable(-1),f=[]):c.map(function(a){var c,h,i,j;for(i=0;i<g;i+=1){if(h=f[i],d.isDateExact(h,a)){c=f[i]=null,j=!0;break}if(d.isDateOverlap(h,a)){b.isPlainObject(a)?(a.inverted=!0,c=a):b.isArray(a)?(c=a,c[3]||c.push("inverted")):e.isDate(a)&&(c=[a.getFullYear(),a.getMonth(),a.getDate(),"inverted"]);break}}if(c)for(i=0;i<g;i+=1)if(d.isDateExact(f[i],a)){f[i]=null;break}if(j)for(i=0;i<g;i+=1)if(d.isDateOverlap(f[i],a)){f[i]=null;break}c&&f.push(c)}),f.filter(function(a){return null!=a})},c.prototype.nodes=function(a){var b=this,c=b.settings,f=b.item,g=f.now,h=f.select,i=f.highlight,j=f.view,k=f.disable,l=f.min,m=f.max,n=function(a,b){return c.firstDay&&(a.push(a.shift()),b.push(b.shift())),e.node("thead",e.node("tr",e.group({min:0,max:d-1,i:1,node:"th",item:function(d){return[a[d],c.klass.weekdays,'scope=col title="'+b[d]+'"']}})))}((c.showWeekdaysFull?c.weekdaysFull:c.weekdaysShort).slice(0),c.weekdaysFull.slice(0)),o=function(a){return e.node("div"," ",c.klass["nav"+(a?"Next":"Prev")]+(a&&j.year>=m.year&&j.month>=m.month||!a&&j.year<=l.year&&j.month<=l.month?" "+c.klass.navDisabled:""),"data-nav="+(a||-1)+" "+e.ariaAttr({role:"button",controls:b.$node[0].id+"_table"})+' title="'+(a?c.labelMonthNext:c.labelMonthPrev)+'"')},p=function(){var d=c.showMonthsShort?c.monthsShort:c.monthsFull;return c.selectMonths?e.node("select",e.group({min:0,max:11,i:1,node:"option",item:function(a){return[d[a],0,"value="+a+(j.month==a?" selected":"")+(j.year==l.year&&a<l.month||j.year==m.year&&a>m.month?" disabled":"")]}}),c.klass.selectMonth,(a?"":"disabled")+" "+e.ariaAttr({controls:b.$node[0].id+"_table"})+' title="'+c.labelMonthSelect+'"'):e.node("div",d[j.month],c.klass.month)},q=function(){var d=j.year,f=!0===c.selectYears?5:~~(c.selectYears/2);if(f){var g=l.year,h=m.year,i=d-f,k=d+f;if(g>i&&(k+=g-i,i=g),h<k){var n=i-g,o=k-h;i-=n>o?o:n,k=h}return e.node("select",e.group({min:i,max:k,i:1,node:"option",item:function(a){return[a,0,"value="+a+(d==a?" selected":"")]}}),c.klass.selectYear,(a?"":"disabled")+" "+e.ariaAttr({controls:b.$node[0].id+"_table"})+' title="'+c.labelYearSelect+'"')}return e.node("div",d,c.klass.year)};return e.node("div",(c.selectYears?q()+p():p()+q())+o()+o(1),c.klass.header)+e.node("table",n+e.node("tbody",e.group({min:0,max:5,i:1,node:"tr",item:function(a){var f=c.firstDay&&0===b.create([j.year,j.month,1]).day?-7:0;return[e.group({min:d*a-j.day+f+1,max:function(){return this.min+d-1},i:1,node:"td",item:function(a){a=b.create([j.year,j.month,a+(c.firstDay?1:0)]);var d=h&&h.pick==a.pick,f=i&&i.pick==a.pick,n=k&&b.disabled(a)||a.pick<l.pick||a.pick>m.pick,o=e.trigger(b.formats.toString,b,[c.format,a]);return[e.node("div",a.date,function(b){return b.push(j.month==a.month?c.klass.infocus:c.klass.outfocus),g.pick==a.pick&&b.push(c.klass.now),d&&b.push(c.klass.selected),f&&b.push(c.klass.highlighted),n&&b.push(c.klass.disabled),b.join(" ")}([c.klass.day]),"data-pick="+a.pick+" "+e.ariaAttr({role:"gridcell",label:o,selected:!(!d||b.$node.val()!==o)||null,activedescendant:!!f||null,disabled:!!n||null})),"",e.ariaAttr({role:"presentation"})]}})]}})),c.klass.table,'id="'+b.$node[0].id+'_table" '+e.ariaAttr({role:"grid",controls:b.$node[0].id,readonly:!0}))+e.node("div",e.node("button",c.today,c.klass.buttonToday,"type=button data-pick="+g.pick+(a&&!b.disabled(g)?"":" disabled")+" "+e.ariaAttr({controls:b.$node[0].id}))+e.node("button",c.clear,c.klass.buttonClear,"type=button data-clear=1"+(a?"":" disabled")+" "+e.ariaAttr({controls:b.$node[0].id}))+e.node("button",c.close,c.klass.buttonClose,"type=button data-close=true "+(a?"":" disabled")+" "+e.ariaAttr({controls:b.$node[0].id})),c.klass.footer)},c.defaults=function(a){return{labelMonthNext:"Next month",labelMonthPrev:"Previous month",labelMonthSelect:"Select a month",labelYearSelect:"Select a year",monthsFull:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekdaysFull:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdaysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],today:"Today",clear:"Clear",close:"Close",closeOnSelect:!0,closeOnClear:!0,updateInput:!0,format:"d mmmm, yyyy",klass:{table:a+"table",header:a+"header",navPrev:a+"nav--prev",navNext:a+"nav--next",navDisabled:a+"nav--disabled",month:a+"month",year:a+"year",selectMonth:a+"select--month",selectYear:a+"select--year",weekdays:a+"weekday",day:a+"day",disabled:a+"day--disabled",selected:a+"day--selected",highlighted:a+"day--highlighted",now:a+"day--today",infocus:a+"day--infocus",outfocus:a+"day--outfocus",footer:a+"footer",buttonClear:a+"button--clear",buttonToday:a+"button--today",buttonClose:a+"button--close"}}}(a.klasses().picker+"__"),a.extend("pickadate",c)});
|
1 |
/*!
|
2 |
+
* Date picker for pickadate.js v3.6.4
|
3 |
* http://amsul.github.io/pickadate.js/date.htm
|
4 |
*/
|
5 |
!function(a){"function"==typeof define&&define.amd?define(["./picker","jquery"],a):"object"==typeof exports?module.exports=a(require("./picker.js"),require("jquery")):a(Picker,jQuery)}(function(a,b){function c(a,b){var c=this,d=a.$node[0],e=d.value,f=a.$node.data("value"),g=f||e,h=f?b.formatSubmit:b.format,i=function(){return d.currentStyle?"rtl"==d.currentStyle.direction:"rtl"==getComputedStyle(a.$root[0]).direction};c.settings=b,c.$node=a.$node,c.queue={min:"measure create",max:"measure create",now:"now create",select:"parse create validate",highlight:"parse navigate create validate",view:"parse create validate viewset",disable:"deactivate",enable:"activate"},c.item={},c.item.clear=null,c.item.disable=(b.disable||[]).slice(0),c.item.enable=-function(a){return!0===a[0]?a.shift():-1}(c.item.disable),c.set("min",b.min).set("max",b.max).set("now"),g?c.set("select",g,{format:h,defaultValue:!0}):c.set("select",null).set("highlight",c.item.now),c.key={40:7,38:-7,39:function(){return i()?-1:1},37:function(){return i()?1:-1},go:function(a){var b=c.item.highlight,d=new Date(b.year,b.month,b.date+a);c.set("highlight",d,{interval:a}),this.render()}},a.on("render",function(){a.$root.find("."+b.klass.selectMonth).on("change",function(){var c=this.value;c&&(a.set("highlight",[a.get("view").year,c,a.get("highlight").date]),a.$root.find("."+b.klass.selectMonth).trigger("focus"))}),a.$root.find("."+b.klass.selectYear).on("change",function(){var c=this.value;c&&(a.set("highlight",[c,a.get("view").month,a.get("highlight").date]),a.$root.find("."+b.klass.selectYear).trigger("focus"))})},1).on("open",function(){var d="";c.disabled(c.get("now"))&&(d=":not(."+b.klass.buttonToday+")"),a.$root.find("button"+d+", select").attr("disabled",!1)},1).on("close",function(){a.$root.find("button, select").attr("disabled",!0)},1)}var d=7,e=a._;c.prototype.set=function(a,b,c){var d=this,e=d.item;return null===b?("clear"==a&&(a="select"),e[a]=b,d):(e["enable"==a?"disable":"flip"==a?"enable":a]=d.queue[a].split(" ").map(function(e){return b=d[e](a,b,c)}).pop(),"select"==a?d.set("highlight",e.select,c):"highlight"==a?d.set("view",e.highlight,c):a.match(/^(flip|min|max|disable|enable)$/)&&(e.select&&d.disabled(e.select)&&d.set("select",e.select,c),e.highlight&&d.disabled(e.highlight)&&d.set("highlight",e.highlight,c)),d)},c.prototype.get=function(a){return this.item[a]},c.prototype.create=function(a,c,d){var f,g=this;return c=void 0===c?a:c,c==-1/0||c==1/0?f=c:b.isPlainObject(c)&&e.isInteger(c.pick)?c=c.obj:b.isArray(c)?(c=new Date(c[0],c[1],c[2]),c=e.isDate(c)?c:g.create().obj):c=e.isInteger(c)||e.isDate(c)?g.normalize(new Date(c),d):g.now(a,c,d),{year:f||c.getFullYear(),month:f||c.getMonth(),date:f||c.getDate(),day:f||c.getDay(),obj:f||c,pick:f||c.getTime()}},c.prototype.createRange=function(a,c){var d=this,f=function(a){return!0===a||b.isArray(a)||e.isDate(a)?d.create(a):a};return e.isInteger(a)||(a=f(a)),e.isInteger(c)||(c=f(c)),e.isInteger(a)&&b.isPlainObject(c)?a=[c.year,c.month,c.date+a]:e.isInteger(c)&&b.isPlainObject(a)&&(c=[a.year,a.month,a.date+c]),{from:f(a),to:f(c)}},c.prototype.withinRange=function(a,b){return a=this.createRange(a.from,a.to),b.pick>=a.from.pick&&b.pick<=a.to.pick},c.prototype.overlapRanges=function(a,b){var c=this;return a=c.createRange(a.from,a.to),b=c.createRange(b.from,b.to),c.withinRange(a,b.from)||c.withinRange(a,b.to)||c.withinRange(b,a.from)||c.withinRange(b,a.to)},c.prototype.now=function(a,b,c){return b=new Date,c&&c.rel&&b.setDate(b.getDate()+c.rel),this.normalize(b,c)},c.prototype.navigate=function(a,c,d){var e,f,g,h,i=b.isArray(c),j=b.isPlainObject(c),k=this.item.view;if(i||j){for(j?(f=c.year,g=c.month,h=c.date):(f=+c[0],g=+c[1],h=+c[2]),d&&d.nav&&k&&k.month!==g&&(f=k.year,g=k.month),e=new Date(f,g+(d&&d.nav?d.nav:0),1),f=e.getFullYear(),g=e.getMonth();new Date(f,g,h).getMonth()!==g;)h-=1;c=[f,g,h]}return c},c.prototype.normalize=function(a){return a.setHours(0,0,0,0),a},c.prototype.measure=function(a,b){var c=this;return e.isInteger(b)?b=c.now(a,b,{rel:b}):b?"string"==typeof b&&(b=c.parse(a,b)):b="min"==a?-1/0:1/0,b},c.prototype.viewset=function(a,b){return this.create([b.year,b.month,1])},c.prototype.validate=function(a,c,d){var f,g,h,i,j=this,k=c,l=d&&d.interval?d.interval:1,m=-1===j.item.enable,n=j.item.min,o=j.item.max,p=m&&j.item.disable.filter(function(a){if(b.isArray(a)){var d=j.create(a).pick;d<c.pick?f=!0:d>c.pick&&(g=!0)}return e.isInteger(a)}).length;if((!d||!d.nav&&!d.defaultValue)&&(!m&&j.disabled(c)||m&&j.disabled(c)&&(p||f||g)||!m&&(c.pick<=n.pick||c.pick>=o.pick)))for(m&&!p&&(!g&&l>0||!f&&l<0)&&(l*=-1);j.disabled(c)&&(Math.abs(l)>1&&(c.month<k.month||c.month>k.month)&&(c=k,l=l>0?1:-1),c.pick<=n.pick?(h=!0,l=1,c=j.create([n.year,n.month,n.date+(c.pick===n.pick?0:-1)])):c.pick>=o.pick&&(i=!0,l=-1,c=j.create([o.year,o.month,o.date+(c.pick===o.pick?0:1)])),!h||!i);)c=j.create([c.year,c.month,c.date+l]);return c},c.prototype.disabled=function(a){var c=this,d=c.item.disable.filter(function(d){return e.isInteger(d)?a.day===(c.settings.firstDay?d:d-1)%7:b.isArray(d)||e.isDate(d)?a.pick===c.create(d).pick:b.isPlainObject(d)?c.withinRange(d,a):void 0});return d=d.length&&!d.filter(function(a){return b.isArray(a)&&"inverted"==a[3]||b.isPlainObject(a)&&a.inverted}).length,-1===c.item.enable?!d:d||a.pick<c.item.min.pick||a.pick>c.item.max.pick},c.prototype.parse=function(a,b,c){var d=this,f={};return b&&"string"==typeof b?(c&&c.format||(c=c||{},c.format=d.settings.format),d.formats.toArray(c.format).map(function(a){var c=d.formats[a],g=c?e.trigger(c,d,[b,f]):a.replace(/^!/,"").length;c&&(f[a]=b.substr(0,g)),b=b.substr(g)}),[f.yyyy||f.yy,+(f.mm||f.m)-1,f.dd||f.d]):b},c.prototype.formats=function(){function a(a,b,c){var d=a.match(/[^\x00-\x7F]+|\w+/)[0];return c.mm||c.m||(c.m=b.indexOf(d)+1),d.length}function b(a){return a.match(/\w+/)[0].length}return{d:function(a,b){return a?e.digits(a):b.date},dd:function(a,b){return a?2:e.lead(b.date)},ddd:function(a,c){return a?b(a):this.settings.weekdaysShort[c.day]},dddd:function(a,c){return a?b(a):this.settings.weekdaysFull[c.day]},m:function(a,b){return a?e.digits(a):b.month+1},mm:function(a,b){return a?2:e.lead(b.month+1)},mmm:function(b,c){var d=this.settings.monthsShort;return b?a(b,d,c):d[c.month]},mmmm:function(b,c){var d=this.settings.monthsFull;return b?a(b,d,c):d[c.month]},yy:function(a,b){return a?2:(""+b.year).slice(2)},yyyy:function(a,b){return a?4:b.year},toArray:function(a){return a.split(/(d{1,4}|m{1,4}|y{4}|yy|!.)/g)},toString:function(a,b){var c=this;return c.formats.toArray(a).map(function(a){return e.trigger(c.formats[a],c,[0,b])||a.replace(/^!/,"")}).join("")}}}(),c.prototype.isDateExact=function(a,c){var d=this;return e.isInteger(a)&&e.isInteger(c)||"boolean"==typeof a&&"boolean"==typeof c?a===c:(e.isDate(a)||b.isArray(a))&&(e.isDate(c)||b.isArray(c))?d.create(a).pick===d.create(c).pick:!(!b.isPlainObject(a)||!b.isPlainObject(c))&&d.isDateExact(a.from,c.from)&&d.isDateExact(a.to,c.to)},c.prototype.isDateOverlap=function(a,c){var d=this,f=d.settings.firstDay?1:0;return e.isInteger(a)&&(e.isDate(c)||b.isArray(c))?(a=a%7+f)===d.create(c).day+1:e.isInteger(c)&&(e.isDate(a)||b.isArray(a))?(c=c%7+f)===d.create(a).day+1:!(!b.isPlainObject(a)||!b.isPlainObject(c))&&d.overlapRanges(a,c)},c.prototype.flipEnable=function(a){var b=this.item;b.enable=a||(-1==b.enable?1:-1)},c.prototype.deactivate=function(a,c){var d=this,f=d.item.disable.slice(0);return"flip"==c?d.flipEnable():!1===c?(d.flipEnable(1),f=[]):!0===c?(d.flipEnable(-1),f=[]):c.map(function(a){for(var c,g=0;g<f.length;g+=1)if(d.isDateExact(a,f[g])){c=!0;break}c||(e.isInteger(a)||e.isDate(a)||b.isArray(a)||b.isPlainObject(a)&&a.from&&a.to)&&f.push(a)}),f},c.prototype.activate=function(a,c){var d=this,f=d.item.disable,g=f.length;return"flip"==c?d.flipEnable():!0===c?(d.flipEnable(1),f=[]):!1===c?(d.flipEnable(-1),f=[]):c.map(function(a){var c,h,i,j;for(i=0;i<g;i+=1){if(h=f[i],d.isDateExact(h,a)){c=f[i]=null,j=!0;break}if(d.isDateOverlap(h,a)){b.isPlainObject(a)?(a.inverted=!0,c=a):b.isArray(a)?(c=a,c[3]||c.push("inverted")):e.isDate(a)&&(c=[a.getFullYear(),a.getMonth(),a.getDate(),"inverted"]);break}}if(c)for(i=0;i<g;i+=1)if(d.isDateExact(f[i],a)){f[i]=null;break}if(j)for(i=0;i<g;i+=1)if(d.isDateOverlap(f[i],a)){f[i]=null;break}c&&f.push(c)}),f.filter(function(a){return null!=a})},c.prototype.nodes=function(a){var b=this,c=b.settings,f=b.item,g=f.now,h=f.select,i=f.highlight,j=f.view,k=f.disable,l=f.min,m=f.max,n=function(a,b){return c.firstDay&&(a.push(a.shift()),b.push(b.shift())),e.node("thead",e.node("tr",e.group({min:0,max:d-1,i:1,node:"th",item:function(d){return[a[d],c.klass.weekdays,'scope=col title="'+b[d]+'"']}})))}((c.showWeekdaysFull?c.weekdaysFull:c.weekdaysShort).slice(0),c.weekdaysFull.slice(0)),o=function(a){return e.node("div"," ",c.klass["nav"+(a?"Next":"Prev")]+(a&&j.year>=m.year&&j.month>=m.month||!a&&j.year<=l.year&&j.month<=l.month?" "+c.klass.navDisabled:""),"data-nav="+(a||-1)+" "+e.ariaAttr({role:"button",controls:b.$node[0].id+"_table"})+' title="'+(a?c.labelMonthNext:c.labelMonthPrev)+'"')},p=function(){var d=c.showMonthsShort?c.monthsShort:c.monthsFull;return c.selectMonths?e.node("select",e.group({min:0,max:11,i:1,node:"option",item:function(a){return[d[a],0,"value="+a+(j.month==a?" selected":"")+(j.year==l.year&&a<l.month||j.year==m.year&&a>m.month?" disabled":"")]}}),c.klass.selectMonth,(a?"":"disabled")+" "+e.ariaAttr({controls:b.$node[0].id+"_table"})+' title="'+c.labelMonthSelect+'"'):e.node("div",d[j.month],c.klass.month)},q=function(){var d=j.year,f=!0===c.selectYears?5:~~(c.selectYears/2);if(f){var g=l.year,h=m.year,i=d-f,k=d+f;if(g>i&&(k+=g-i,i=g),h<k){var n=i-g,o=k-h;i-=n>o?o:n,k=h}return e.node("select",e.group({min:i,max:k,i:1,node:"option",item:function(a){return[a,0,"value="+a+(d==a?" selected":"")]}}),c.klass.selectYear,(a?"":"disabled")+" "+e.ariaAttr({controls:b.$node[0].id+"_table"})+' title="'+c.labelYearSelect+'"')}return e.node("div",d,c.klass.year)};return e.node("div",(c.selectYears?q()+p():p()+q())+o()+o(1),c.klass.header)+e.node("table",n+e.node("tbody",e.group({min:0,max:5,i:1,node:"tr",item:function(a){var f=c.firstDay&&0===b.create([j.year,j.month,1]).day?-7:0;return[e.group({min:d*a-j.day+f+1,max:function(){return this.min+d-1},i:1,node:"td",item:function(a){a=b.create([j.year,j.month,a+(c.firstDay?1:0)]);var d=h&&h.pick==a.pick,f=i&&i.pick==a.pick,n=k&&b.disabled(a)||a.pick<l.pick||a.pick>m.pick,o=e.trigger(b.formats.toString,b,[c.format,a]);return[e.node("div",a.date,function(b){return b.push(j.month==a.month?c.klass.infocus:c.klass.outfocus),g.pick==a.pick&&b.push(c.klass.now),d&&b.push(c.klass.selected),f&&b.push(c.klass.highlighted),n&&b.push(c.klass.disabled),b.join(" ")}([c.klass.day]),"data-pick="+a.pick+" "+e.ariaAttr({role:"gridcell",label:o,selected:!(!d||b.$node.val()!==o)||null,activedescendant:!!f||null,disabled:!!n||null})),"",e.ariaAttr({role:"presentation"})]}})]}})),c.klass.table,'id="'+b.$node[0].id+'_table" '+e.ariaAttr({role:"grid",controls:b.$node[0].id,readonly:!0}))+e.node("div",e.node("button",c.today,c.klass.buttonToday,"type=button data-pick="+g.pick+(a&&!b.disabled(g)?"":" disabled")+" "+e.ariaAttr({controls:b.$node[0].id}))+e.node("button",c.clear,c.klass.buttonClear,"type=button data-clear=1"+(a?"":" disabled")+" "+e.ariaAttr({controls:b.$node[0].id}))+e.node("button",c.close,c.klass.buttonClose,"type=button data-close=true "+(a?"":" disabled")+" "+e.ariaAttr({controls:b.$node[0].id})),c.klass.footer)},c.defaults=function(a){return{labelMonthNext:"Next month",labelMonthPrev:"Previous month",labelMonthSelect:"Select a month",labelYearSelect:"Select a year",monthsFull:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekdaysFull:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdaysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],today:"Today",clear:"Clear",close:"Close",closeOnSelect:!0,closeOnClear:!0,updateInput:!0,format:"d mmmm, yyyy",klass:{table:a+"table",header:a+"header",navPrev:a+"nav--prev",navNext:a+"nav--next",navDisabled:a+"nav--disabled",month:a+"month",year:a+"year",selectMonth:a+"select--month",selectYear:a+"select--year",weekdays:a+"weekday",day:a+"day",disabled:a+"day--disabled",selected:a+"day--selected",highlighted:a+"day--highlighted",now:a+"day--today",infocus:a+"day--infocus",outfocus:a+"day--outfocus",footer:a+"footer",buttonClear:a+"button--clear",buttonToday:a+"button--today",buttonClose:a+"button--close"}}}(a.klasses().picker+"__"),a.extend("pickadate",c)});
|
lib/simple-admin-pages/lib/pickadate/picker.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
/*!
|
2 |
-
* pickadate.js v3.6.
|
3 |
* By Amsul, http://amsul.ca
|
4 |
* Hosted on http://amsul.github.io/pickadate.js
|
5 |
* Licensed under MIT
|
6 |
*/
|
7 |
-
!function(a){"function"==typeof define&&define.amd?define("picker",["jquery"],a):"object"==typeof exports?module.exports=a(require("jquery")):this.Picker=a(jQuery)}(function(a){function b(h,
|
1 |
/*!
|
2 |
+
* pickadate.js v3.6.4, 2019/05/25
|
3 |
* By Amsul, http://amsul.ca
|
4 |
* Hosted on http://amsul.github.io/pickadate.js
|
5 |
* Licensed under MIT
|
6 |
*/
|
7 |
+
!function(a){"function"==typeof define&&define.amd?define("picker",["jquery"],a):"object"==typeof exports?module.exports=a(require("jquery")):"object"==typeof window?window.Picker=a(jQuery):this.Picker=a(jQuery)}(function(a){function b(g,h,j,l){function n(){return b._.node("div",b._.node("div",b._.node("div",b._.node("div",B.component.nodes(w.open),y.box),y.wrap),y.frame),y.holder,'tabindex="-1"')}function o(){z.data(h,B).addClass(y.input).val(z.data("value")?B.get("select",x.format):g.value).on("focus."+w.id+" click."+w.id,function(a){a.preventDefault(),B.open()}).on("mousedown",function(){w.handlingOpen=!0;var b=function(){setTimeout(function(){a(document).off("mouseup",b),w.handlingOpen=!1},0)};a(document).on("mouseup",b)}),x.editable||z.on("keydown."+w.id,u),f(g,{haspopup:!0,expanded:!1,readonly:!1,owns:g.id+"_root"})}function p(){f(B.$root[0],"hidden",!0)}function q(){B.$holder.on({keydown:u,"focus.toOpen":t,blur:function(){z.removeClass(y.target)},focusin:function(a){B.$root.removeClass(y.focused),a.stopPropagation()},"mousedown click":function(b){var c=e(b,g);c!=B.$holder[0]&&(b.stopPropagation(),"mousedown"!=b.type||a(c).is("input, select, textarea, button, option")||(b.preventDefault(),B.$holder.eq(0).focus()))}}).on("click","[data-pick], [data-nav], [data-clear], [data-close]",function(){var b=a(this),c=b.data(),d=b.hasClass(y.navDisabled)||b.hasClass(y.disabled),e=i();e=e&&(e.type||e.href?e:null),(d||e&&!a.contains(B.$root[0],e))&&B.$holder.eq(0).focus(),!d&&c.nav?B.set("highlight",B.component.item.highlight,{nav:c.nav}):!d&&"pick"in c?(B.set("select",c.pick),x.closeOnSelect&&B.close(!0)):c.clear?(B.clear(),x.closeOnClear&&B.close(!0)):c.close&&B.close(!0)})}function r(){var b;!0===x.hiddenName?(b=g.name,g.name=""):(b=["string"==typeof x.hiddenPrefix?x.hiddenPrefix:"","string"==typeof x.hiddenSuffix?x.hiddenSuffix:"_submit"],b=b[0]+g.name+b[1]),B._hidden=a('<input type=hidden name="'+b+'"'+(z.data("value")||g.value?' value="'+B.get("select",x.formatSubmit)+'"':"")+">")[0],z.on("change."+w.id,function(){B._hidden.value=g.value?B.get("select",x.formatSubmit):""})}function s(){v&&m?B.$holder.find("."+y.frame).one("transitionend",function(){B.$holder.eq(0).focus()}):setTimeout(function(){B.$holder.eq(0).focus()},0)}function t(a){a.stopPropagation(),z.addClass(y.target),B.$root.addClass(y.focused),B.open()}function u(a){var b=a.keyCode,c=/^(8|46)$/.test(b);if(27==b)return B.close(!0),!1;(32==b||c||!w.open&&B.component.key[b])&&(a.preventDefault(),a.stopPropagation(),c?B.clear().close():B.open())}if(!g)return b;var v=!1,w={id:g.id||"P"+Math.abs(~~(Math.random()*new Date)),handlingOpen:!1},x=j?a.extend(!0,{},j.defaults,l):l||{},y=a.extend({},b.klasses(),x.klass),z=a(g),A=function(){return this.start()},B=A.prototype={constructor:A,$node:z,start:function(){return w&&w.start?B:(w.methods={},w.start=!0,w.open=!1,w.type=g.type,g.autofocus=g==i(),g.readOnly=!x.editable,g.id=g.id||w.id,"text"!=g.type&&(g.type="text"),B.component=new j(B,x),B.$root=a('<div class="'+y.picker+'" id="'+g.id+'_root" />'),p(),B.$holder=a(n()).appendTo(B.$root),q(),x.formatSubmit&&r(),o(),x.containerHidden?a(x.containerHidden).append(B._hidden):z.after(B._hidden),x.container?a(x.container).append(B.$root):z.after(B.$root),B.on({start:B.component.onStart,render:B.component.onRender,stop:B.component.onStop,open:B.component.onOpen,close:B.component.onClose,set:B.component.onSet}).on({start:x.onStart,render:x.onRender,stop:x.onStop,open:x.onOpen,close:x.onClose,set:x.onSet}),v=c(B.$holder[0]),g.autofocus&&B.open(),B.trigger("start").trigger("render"))},render:function(b){return b?(B.$holder=a(n()),q(),B.$root.html(B.$holder)):B.$root.find("."+y.box).html(B.component.nodes(w.open)),B.trigger("render")},stop:function(){return w.start?(B.close(),B._hidden&&B._hidden.parentNode.removeChild(B._hidden),B.$root.remove(),z.removeClass(y.input).removeData(h),setTimeout(function(){z.off("."+w.id)},0),g.type=w.type,g.readOnly=!1,B.trigger("stop"),w.methods={},w.start=!1,B):B},open:function(c){return w.open?B:(z.addClass(y.active),f(g,"expanded",!0),setTimeout(function(){B.$root.addClass(y.opened),f(B.$root[0],"hidden",!1)},0),!1!==c&&(w.open=!0,v&&a("body").css("overflow","hidden").css("padding-right","+="+d()),s(),k.on("click."+w.id+" focusin."+w.id,function(a){if(!w.handlingOpen){var b=e(a,g);a.isSimulated||b==g||b==document||3==a.which||B.close(b===B.$holder[0])}}).on("keydown."+w.id,function(c){var d=c.keyCode,f=B.component.key[d],h=e(c,g);27==d?B.close(!0):h!=B.$holder[0]||!f&&13!=d?a.contains(B.$root[0],h)&&13==d&&(c.preventDefault(),h.click()):(c.preventDefault(),f?b._.trigger(B.component.key.go,B,[b._.trigger(f)]):B.$root.find("."+y.highlighted).hasClass(y.disabled)||(B.set("select",B.component.item.highlight),x.closeOnSelect&&B.close(!0)))})),B.trigger("open"))},close:function(b){return b&&(x.editable?g.focus():(B.$holder.off("focus.toOpen").focus(),setTimeout(function(){B.$holder.on("focus.toOpen",t)},0))),z.removeClass(y.active),f(g,"expanded",!1),setTimeout(function(){B.$root.removeClass(y.opened+" "+y.focused),f(B.$root[0],"hidden",!0)},0),w.open?(w.open=!1,v&&a("body").css("overflow","").css("padding-right","-="+d()),k.off("."+w.id),B.trigger("close")):B},clear:function(a){return B.set("clear",null,a)},set:function(b,c,d){var e,f,g=a.isPlainObject(b),h=g?b:{};if(d=g&&a.isPlainObject(c)?c:d||{},b){g||(h[b]=c);for(e in h)f=h[e],e in B.component.item&&(void 0===f&&(f=null),B.component.set(e,f,d)),"select"!=e&&"clear"!=e||!x.updateInput||z.val("clear"==e?"":B.get(e,x.format)).trigger("change");B.render()}return d.muted?B:B.trigger("set",h)},get:function(a,c){if(a=a||"value",null!=w[a])return w[a];if("valueSubmit"==a){if(B._hidden)return B._hidden.value;a="value"}if("value"==a)return g.value;if(a in B.component.item){if("string"==typeof c){var d=B.component.get(a);return d?b._.trigger(B.component.formats.toString,B.component,[c,d]):""}return B.component.get(a)}},on:function(b,c,d){var e,f,g=a.isPlainObject(b),h=g?b:{};if(b){g||(h[b]=c);for(e in h)f=h[e],d&&(e="_"+e),w.methods[e]=w.methods[e]||[],w.methods[e].push(f)}return B},off:function(){var a,b,c=arguments;for(a=0,namesCount=c.length;a<namesCount;a+=1)(b=c[a])in w.methods&&delete w.methods[b];return B},trigger:function(a,c){var d=function(a){var d=w.methods[a];d&&d.map(function(a){b._.trigger(a,B,[c])})};return d("_"+a),d(a),B}};return new A}function c(a){var b,c="position";return a.currentStyle?b=a.currentStyle[c]:window.getComputedStyle&&(b=getComputedStyle(a)[c]),"fixed"==b}function d(){if(l.height()<=j.height())return 0;var b=a('<div style="visibility:hidden;width:100px" />').appendTo("body"),c=b[0].offsetWidth;b.css("overflow","scroll");var d=a('<div style="width:100%" />').appendTo(b),e=d[0].offsetWidth;return b.remove(),c-e}function e(a,b){var c=[];return a.path&&(c=a.path),a.originalEvent&&a.originalEvent.path&&(c=a.originalEvent.path),c&&c.length>0?b&&c.indexOf(b)>=0?b:c[0]:a.target}function f(b,c,d){if(a.isPlainObject(c))for(var e in c)g(b,e,c[e]);else g(b,c,d)}function g(a,b,c){a.setAttribute(("role"==b?"":"aria-")+b,c)}function h(b,c){a.isPlainObject(b)||(b={attribute:c}),c="";for(var d in b){var e=("role"==d?"":"aria-")+d;c+=null==b[d]?"":e+'="'+b[d]+'"'}return c}function i(){try{return document.activeElement}catch(a){}}var j=a(window),k=a(document),l=a(document.documentElement),m=null!=document.documentElement.style.transition;return b.klasses=function(a){return a=a||"picker",{picker:a,opened:a+"--opened",focused:a+"--focused",input:a+"__input",active:a+"__input--active",target:a+"__input--target",holder:a+"__holder",frame:a+"__frame",wrap:a+"__wrap",box:a+"__box"}},b._={group:function(a){for(var c,d="",e=b._.trigger(a.min,a);e<=b._.trigger(a.max,a,[e]);e+=a.i)c=b._.trigger(a.item,a,[e]),d+=b._.node(a.node,c[0],c[1],c[2]);return d},node:function(b,c,d,e){return c?(c=a.isArray(c)?c.join(""):c,d=d?' class="'+d+'"':"",e=e?" "+e:"","<"+b+d+e+">"+c+"</"+b+">"):""},lead:function(a){return(a<10?"0":"")+a},trigger:function(a,b,c){return"function"==typeof a?a.apply(b,c||[]):a},digits:function(a){return/\d/.test(a[1])?2:1},isDate:function(a){return{}.toString.call(a).indexOf("Date")>-1&&this.isInteger(a.getDate())},isInteger:function(a){return{}.toString.call(a).indexOf("Number")>-1&&a%1==0},ariaAttr:h},b.extend=function(c,d){a.fn[c]=function(e,f){var g=this.data(c);return"picker"==e?g:g&&"string"==typeof e?b._.trigger(g[e],g,[f]):this.each(function(){a(this).data(c)||new b(this,c,d,e)})},a.fn[c].defaults=d.defaults},b});
|
lib/simple-admin-pages/lib/pickadate/picker.time.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
/*!
|
2 |
-
* Time picker for pickadate.js v3.6.
|
3 |
* http://amsul.github.io/pickadate.js/time.htm
|
4 |
*/
|
5 |
!function(a){"function"==typeof define&&define.amd?define(["./picker","jquery"],a):"object"==typeof exports?module.exports=a(require("./picker.js"),require("jquery")):a(Picker,jQuery)}(function(a,b){function c(a,b){var c=this,d=a.$node[0].value,e=a.$node.data("value"),f=e||d,g=e?b.formatSubmit:b.format;c.settings=b,c.$node=a.$node,c.queue={interval:"i",min:"measure create",max:"measure create",now:"now create",select:"parse create validate",highlight:"parse create validate",view:"parse create validate",disable:"deactivate",enable:"activate"},c.item={},c.item.clear=null,c.item.interval=b.interval||30,c.item.disable=(b.disable||[]).slice(0),c.item.enable=-function(a){return!0===a[0]?a.shift():-1}(c.item.disable),c.set("min",b.min).set("max",b.max).set("now"),f?c.set("select",f,{format:g}):c.set("select",null).set("highlight",c.item.now),c.key={40:1,38:-1,39:1,37:-1,go:function(a){c.set("highlight",c.item.highlight.pick+a*c.item.interval,{interval:a*c.item.interval}),this.render()}},a.on("render",function(){var c=a.$root.children(),d=c.find("."+b.klass.viewset),e=function(a){return["webkit","moz","ms","o",""].map(function(b){return(b?"-"+b+"-":"")+a})},f=function(a,b){e("transform").map(function(c){a.css(c,b)}),e("transition").map(function(c){a.css(c,b)})};d.length&&(f(c,"none"),c[0].scrollTop=~~d.position().top-2*d[0].clientHeight,f(c,""))},1).on("open",function(){a.$root.find("button").attr("disabled",!1)},1).on("close",function(){a.$root.find("button").attr("disabled",!0)},1)}var d=24,e=60,f=12,g=d*e,h=a._;c.prototype.set=function(a,b,c){var d=this,e=d.item;return null===b?("clear"==a&&(a="select"),e[a]=b,d):(e["enable"==a?"disable":"flip"==a?"enable":a]=d.queue[a].split(" ").map(function(e){return b=d[e](a,b,c)}).pop(),"select"==a?d.set("highlight",e.select,c):"highlight"==a?d.set("view",e.highlight,c):"interval"==a?d.set("min",e.min,c).set("max",e.max,c):a.match(/^(flip|min|max|disable|enable)$/)&&(e.select&&d.disabled(e.select)&&d.set("select",b,c),e.highlight&&d.disabled(e.highlight)&&d.set("highlight",b,c),"min"==a&&d.set("max",e.max,c)),d)},c.prototype.get=function(a){return this.item[a]},c.prototype.create=function(a,c,f){var i=this;return c=void 0===c?a:c,h.isDate(c)&&(c=[c.getHours(),c.getMinutes()]),b.isPlainObject(c)&&h.isInteger(c.pick)?c=c.pick:b.isArray(c)?c=+c[0]*e+ +c[1]:h.isInteger(c)||(c=i.now(a,c,f)),"max"==a&&c<i.item.min.pick&&(c+=g),"min"!=a&&"max"!=a&&(c-i.item.min.pick)%i.item.interval!=0&&(c+=i.item.interval),c=i.normalize(a,c,f),{hour:~~(d+c/e)%d,mins:(e+c%e)%e,time:(g+c)%g,pick:c%g}},c.prototype.createRange=function(a,c){var d=this,e=function(a){return!0===a||b.isArray(a)||h.isDate(a)?d.create(a):a};return h.isInteger(a)||(a=e(a)),h.isInteger(c)||(c=e(c)),h.isInteger(a)&&b.isPlainObject(c)?a=[c.hour,c.mins+a*d.settings.interval]:h.isInteger(c)&&b.isPlainObject(a)&&(c=[a.hour,a.mins+c*d.settings.interval]),{from:e(a),to:e(c)}},c.prototype.withinRange=function(a,b){return a=this.createRange(a.from,a.to),b.pick>=a.from.pick&&b.pick<=a.to.pick},c.prototype.overlapRanges=function(a,b){var c=this;return a=c.createRange(a.from,a.to),b=c.createRange(b.from,b.to),c.withinRange(a,b.from)||c.withinRange(a,b.to)||c.withinRange(b,a.from)||c.withinRange(b,a.to)},c.prototype.now=function(a,b){var c,d=this.item.interval,f=new Date,g=f.getHours()*e+f.getMinutes(),i=h.isInteger(b);return g-=g%d,c=b<0&&d*b+g<=-d,g+="min"==a&&c?0:d,i&&(g+=d*(c&&"max"!=a?b+1:b)),g},c.prototype.normalize=function(a,b){var c=this.item.interval,d=this.item.min&&this.item.min.pick||0;return b-="min"==a?0:(b-d)%c},c.prototype.measure=function(a,c,f){var g=this;return c||(c="min"==a?[0,0]:[d-1,e-1]),"string"==typeof c?c=g.parse(a,c):!0===c||h.isInteger(c)?c=g.now(a,c,f):b.isPlainObject(c)&&h.isInteger(c.pick)&&(c=g.normalize(a,c.pick,f)),c},c.prototype.validate=function(a,b,c){var d=this,e=c&&c.interval?c.interval:d.item.interval;return d.disabled(b)&&(b=d.shift(b,e)),b=d.scope(b),d.disabled(b)&&(b=d.shift(b,-1*e)),b},c.prototype.disabled=function(a){var c=this,d=c.item.disable.filter(function(d){return h.isInteger(d)?a.hour==d:b.isArray(d)||h.isDate(d)?a.pick==c.create(d).pick:b.isPlainObject(d)?c.withinRange(d,a):void 0});return d=d.length&&!d.filter(function(a){return b.isArray(a)&&"inverted"==a[2]||b.isPlainObject(a)&&a.inverted}).length,-1===c.item.enable?!d:d||a.pick<c.item.min.pick||a.pick>c.item.max.pick},c.prototype.shift=function(a,b){var c=this,d=c.item.min.pick,e=c.item.max.pick;for(b=b||c.item.interval;c.disabled(a)&&(a=c.create(a.pick+=b),!(a.pick<=d||a.pick>=e)););return a},c.prototype.scope=function(a){var b=this.item.min.pick,c=this.item.max.pick;return this.create(a.pick>c?c:a.pick<b?b:a)},c.prototype.parse=function(a,b,c){var d,f,g,i,j,k=this,l={};if(!b||"string"!=typeof b)return b;c&&c.format||(c=c||{},c.format=k.settings.format),k.formats.toArray(c.format).map(function(a){var c,d=k.formats[a],e=d?h.trigger(d,k,[b,l]):a.replace(/^!/,"").length;d&&(c=b.substr(0,e),l[a]=c.match(/^\d+$/)?+c:c),b=b.substr(e)});for(i in l)j=l[i],h.isInteger(j)?i.match(/^(h|hh)$/i)?(d=j,"h"!=i&&"hh"!=i||(d%=12)):"i"==i&&(f=j):i.match(/^a$/i)&&j.match(/^p/i)&&("h"in l||"hh"in l)&&(g=!0);return(g?d+12:d)*e+f},c.prototype.formats={h:function(a,b){return a?h.digits(a):b.hour%f||f},hh:function(a,b){return a?2:h.lead(b.hour%f||f)},H:function(a,b){return a?h.digits(a):""+b.hour%24},HH:function(a,b){return a?h.digits(a):h.lead(b.hour%24)},i:function(a,b){return a?2:h.lead(b.mins)},a:function(a,b){return a?4:g/2>b.time%g?"a.m.":"p.m."},A:function(a,b){return a?2:g/2>b.time%g?"AM":"PM"},toArray:function(a){return a.split(/(h{1,2}|H{1,2}|i|a|A|!.)/g)},toString:function(a,b){var c=this;return c.formats.toArray(a).map(function(a){return h.trigger(c.formats[a],c,[0,b])||a.replace(/^!/,"")}).join("")}},c.prototype.isTimeExact=function(a,c){var d=this;return h.isInteger(a)&&h.isInteger(c)||"boolean"==typeof a&&"boolean"==typeof c?a===c:(h.isDate(a)||b.isArray(a))&&(h.isDate(c)||b.isArray(c))?d.create(a).pick===d.create(c).pick:!(!b.isPlainObject(a)||!b.isPlainObject(c))&&(d.isTimeExact(a.from,c.from)&&d.isTimeExact(a.to,c.to))},c.prototype.isTimeOverlap=function(a,c){var d=this;return h.isInteger(a)&&(h.isDate(c)||b.isArray(c))?a===d.create(c).hour:h.isInteger(c)&&(h.isDate(a)||b.isArray(a))?c===d.create(a).hour:!(!b.isPlainObject(a)||!b.isPlainObject(c))&&d.overlapRanges(a,c)},c.prototype.flipEnable=function(a){var b=this.item;b.enable=a||(-1==b.enable?1:-1)},c.prototype.deactivate=function(a,c){var d=this,e=d.item.disable.slice(0);return"flip"==c?d.flipEnable():!1===c?(d.flipEnable(1),e=[]):!0===c?(d.flipEnable(-1),e=[]):c.map(function(a){for(var c,f=0;f<e.length;f+=1)if(d.isTimeExact(a,e[f])){c=!0;break}c||(h.isInteger(a)||h.isDate(a)||b.isArray(a)||b.isPlainObject(a)&&a.from&&a.to)&&e.push(a)}),e},c.prototype.activate=function(a,c){var d=this,e=d.item.disable,f=e.length;return"flip"==c?d.flipEnable():!0===c?(d.flipEnable(1),e=[]):!1===c?(d.flipEnable(-1),e=[]):c.map(function(a){var c,g,i,j;for(i=0;i<f;i+=1){if(g=e[i],d.isTimeExact(g,a)){c=e[i]=null,j=!0;break}if(d.isTimeOverlap(g,a)){b.isPlainObject(a)?(a.inverted=!0,c=a):b.isArray(a)?(c=a,c[2]||c.push("inverted")):h.isDate(a)&&(c=[a.getFullYear(),a.getMonth(),a.getDate(),"inverted"]);break}}if(c)for(i=0;i<f;i+=1)if(d.isTimeExact(e[i],a)){e[i]=null;break}if(j)for(i=0;i<f;i+=1)if(d.isTimeOverlap(e[i],a)){e[i]=null;break}c&&e.push(c)}),e.filter(function(a){return null!=a})},c.prototype.i=function(a,b){return h.isInteger(b)&&b>0?b:this.item.interval},c.prototype.nodes=function(a){var b=this,c=b.settings,d=b.item.select,e=b.item.highlight,f=b.item.view,g=b.item.disable;return h.node("ul",h.group({min:b.item.min.pick,max:b.item.max.pick,i:b.item.interval,node:"li",item:function(a){a=b.create(a);var i=a.pick,j=d&&d.pick==i,k=e&&e.pick==i,l=g&&b.disabled(a),m=h.trigger(b.formats.toString,b,[c.format,a]);return[h.trigger(b.formats.toString,b,[h.trigger(c.formatLabel,b,[a])||c.format,a]),function(a){return j&&a.push(c.klass.selected),k&&a.push(c.klass.highlighted),f&&f.pick==i&&a.push(c.klass.viewset),l&&a.push(c.klass.disabled),a.join(" ")}([c.klass.listItem]),"data-pick="+a.pick+" "+h.ariaAttr({role:"option",label:m,selected:!(!j||b.$node.val()!==m)||null,activedescendant:!!k||null,disabled:!!l||null})]}})+h.node("li",h.node("button",c.clear,c.klass.buttonClear,"type=button data-clear=1"+(a?"":" disabled")+" "+h.ariaAttr({controls:b.$node[0].id})),"",h.ariaAttr({role:"presentation"})),c.klass.list,h.ariaAttr({role:"listbox",controls:b.$node[0].id}))},c.defaults=function(a){return{clear:"Clear",format:"h:i A",interval:30,closeOnSelect:!0,closeOnClear:!0,updateInput:!0,klass:{picker:a+" "+a+"--time",holder:a+"__holder",list:a+"__list",listItem:a+"__list-item",disabled:a+"__list-item--disabled",selected:a+"__list-item--selected",highlighted:a+"__list-item--highlighted",viewset:a+"__list-item--viewset",now:a+"__list-item--now",buttonClear:a+"__button--clear"}}}(a.klasses().picker),a.extend("pickatime",c)});
|
1 |
/*!
|
2 |
+
* Time picker for pickadate.js v3.6.4
|
3 |
* http://amsul.github.io/pickadate.js/time.htm
|
4 |
*/
|
5 |
!function(a){"function"==typeof define&&define.amd?define(["./picker","jquery"],a):"object"==typeof exports?module.exports=a(require("./picker.js"),require("jquery")):a(Picker,jQuery)}(function(a,b){function c(a,b){var c=this,d=a.$node[0].value,e=a.$node.data("value"),f=e||d,g=e?b.formatSubmit:b.format;c.settings=b,c.$node=a.$node,c.queue={interval:"i",min:"measure create",max:"measure create",now:"now create",select:"parse create validate",highlight:"parse create validate",view:"parse create validate",disable:"deactivate",enable:"activate"},c.item={},c.item.clear=null,c.item.interval=b.interval||30,c.item.disable=(b.disable||[]).slice(0),c.item.enable=-function(a){return!0===a[0]?a.shift():-1}(c.item.disable),c.set("min",b.min).set("max",b.max).set("now"),f?c.set("select",f,{format:g}):c.set("select",null).set("highlight",c.item.now),c.key={40:1,38:-1,39:1,37:-1,go:function(a){c.set("highlight",c.item.highlight.pick+a*c.item.interval,{interval:a*c.item.interval}),this.render()}},a.on("render",function(){var c=a.$root.children(),d=c.find("."+b.klass.viewset),e=function(a){return["webkit","moz","ms","o",""].map(function(b){return(b?"-"+b+"-":"")+a})},f=function(a,b){e("transform").map(function(c){a.css(c,b)}),e("transition").map(function(c){a.css(c,b)})};d.length&&(f(c,"none"),c[0].scrollTop=~~d.position().top-2*d[0].clientHeight,f(c,""))},1).on("open",function(){a.$root.find("button").attr("disabled",!1)},1).on("close",function(){a.$root.find("button").attr("disabled",!0)},1)}var d=24,e=60,f=12,g=d*e,h=a._;c.prototype.set=function(a,b,c){var d=this,e=d.item;return null===b?("clear"==a&&(a="select"),e[a]=b,d):(e["enable"==a?"disable":"flip"==a?"enable":a]=d.queue[a].split(" ").map(function(e){return b=d[e](a,b,c)}).pop(),"select"==a?d.set("highlight",e.select,c):"highlight"==a?d.set("view",e.highlight,c):"interval"==a?d.set("min",e.min,c).set("max",e.max,c):a.match(/^(flip|min|max|disable|enable)$/)&&(e.select&&d.disabled(e.select)&&d.set("select",b,c),e.highlight&&d.disabled(e.highlight)&&d.set("highlight",b,c),"min"==a&&d.set("max",e.max,c)),d)},c.prototype.get=function(a){return this.item[a]},c.prototype.create=function(a,c,f){var i=this;return c=void 0===c?a:c,h.isDate(c)&&(c=[c.getHours(),c.getMinutes()]),b.isPlainObject(c)&&h.isInteger(c.pick)?c=c.pick:b.isArray(c)?c=+c[0]*e+ +c[1]:h.isInteger(c)||(c=i.now(a,c,f)),"max"==a&&c<i.item.min.pick&&(c+=g),"min"!=a&&"max"!=a&&(c-i.item.min.pick)%i.item.interval!=0&&(c+=i.item.interval),c=i.normalize(a,c,f),{hour:~~(d+c/e)%d,mins:(e+c%e)%e,time:(g+c)%g,pick:c%g}},c.prototype.createRange=function(a,c){var d=this,e=function(a){return!0===a||b.isArray(a)||h.isDate(a)?d.create(a):a};return h.isInteger(a)||(a=e(a)),h.isInteger(c)||(c=e(c)),h.isInteger(a)&&b.isPlainObject(c)?a=[c.hour,c.mins+a*d.settings.interval]:h.isInteger(c)&&b.isPlainObject(a)&&(c=[a.hour,a.mins+c*d.settings.interval]),{from:e(a),to:e(c)}},c.prototype.withinRange=function(a,b){return a=this.createRange(a.from,a.to),b.pick>=a.from.pick&&b.pick<=a.to.pick},c.prototype.overlapRanges=function(a,b){var c=this;return a=c.createRange(a.from,a.to),b=c.createRange(b.from,b.to),c.withinRange(a,b.from)||c.withinRange(a,b.to)||c.withinRange(b,a.from)||c.withinRange(b,a.to)},c.prototype.now=function(a,b){var c,d=this.item.interval,f=new Date,g=f.getHours()*e+f.getMinutes(),i=h.isInteger(b);return g-=g%d,c=b<0&&d*b+g<=-d,g+="min"==a&&c?0:d,i&&(g+=d*(c&&"max"!=a?b+1:b)),g},c.prototype.normalize=function(a,b){var c=this.item.interval,d=this.item.min&&this.item.min.pick||0;return b-="min"==a?0:(b-d)%c},c.prototype.measure=function(a,c,f){var g=this;return c||(c="min"==a?[0,0]:[d-1,e-1]),"string"==typeof c?c=g.parse(a,c):!0===c||h.isInteger(c)?c=g.now(a,c,f):b.isPlainObject(c)&&h.isInteger(c.pick)&&(c=g.normalize(a,c.pick,f)),c},c.prototype.validate=function(a,b,c){var d=this,e=c&&c.interval?c.interval:d.item.interval;return d.disabled(b)&&(b=d.shift(b,e)),b=d.scope(b),d.disabled(b)&&(b=d.shift(b,-1*e)),b},c.prototype.disabled=function(a){var c=this,d=c.item.disable.filter(function(d){return h.isInteger(d)?a.hour==d:b.isArray(d)||h.isDate(d)?a.pick==c.create(d).pick:b.isPlainObject(d)?c.withinRange(d,a):void 0});return d=d.length&&!d.filter(function(a){return b.isArray(a)&&"inverted"==a[2]||b.isPlainObject(a)&&a.inverted}).length,-1===c.item.enable?!d:d||a.pick<c.item.min.pick||a.pick>c.item.max.pick},c.prototype.shift=function(a,b){var c=this,d=c.item.min.pick,e=c.item.max.pick;for(b=b||c.item.interval;c.disabled(a)&&(a=c.create(a.pick+=b),!(a.pick<=d||a.pick>=e)););return a},c.prototype.scope=function(a){var b=this.item.min.pick,c=this.item.max.pick;return this.create(a.pick>c?c:a.pick<b?b:a)},c.prototype.parse=function(a,b,c){var d,f,g,i,j,k=this,l={};if(!b||"string"!=typeof b)return b;c&&c.format||(c=c||{},c.format=k.settings.format),k.formats.toArray(c.format).map(function(a){var c,d=k.formats[a],e=d?h.trigger(d,k,[b,l]):a.replace(/^!/,"").length;d&&(c=b.substr(0,e),l[a]=c.match(/^\d+$/)?+c:c),b=b.substr(e)});for(i in l)j=l[i],h.isInteger(j)?i.match(/^(h|hh)$/i)?(d=j,"h"!=i&&"hh"!=i||(d%=12)):"i"==i&&(f=j):i.match(/^a$/i)&&j.match(/^p/i)&&("h"in l||"hh"in l)&&(g=!0);return(g?d+12:d)*e+f},c.prototype.formats={h:function(a,b){return a?h.digits(a):b.hour%f||f},hh:function(a,b){return a?2:h.lead(b.hour%f||f)},H:function(a,b){return a?h.digits(a):""+b.hour%24},HH:function(a,b){return a?h.digits(a):h.lead(b.hour%24)},i:function(a,b){return a?2:h.lead(b.mins)},a:function(a,b){return a?4:g/2>b.time%g?"a.m.":"p.m."},A:function(a,b){return a?2:g/2>b.time%g?"AM":"PM"},toArray:function(a){return a.split(/(h{1,2}|H{1,2}|i|a|A|!.)/g)},toString:function(a,b){var c=this;return c.formats.toArray(a).map(function(a){return h.trigger(c.formats[a],c,[0,b])||a.replace(/^!/,"")}).join("")}},c.prototype.isTimeExact=function(a,c){var d=this;return h.isInteger(a)&&h.isInteger(c)||"boolean"==typeof a&&"boolean"==typeof c?a===c:(h.isDate(a)||b.isArray(a))&&(h.isDate(c)||b.isArray(c))?d.create(a).pick===d.create(c).pick:!(!b.isPlainObject(a)||!b.isPlainObject(c))&&(d.isTimeExact(a.from,c.from)&&d.isTimeExact(a.to,c.to))},c.prototype.isTimeOverlap=function(a,c){var d=this;return h.isInteger(a)&&(h.isDate(c)||b.isArray(c))?a===d.create(c).hour:h.isInteger(c)&&(h.isDate(a)||b.isArray(a))?c===d.create(a).hour:!(!b.isPlainObject(a)||!b.isPlainObject(c))&&d.overlapRanges(a,c)},c.prototype.flipEnable=function(a){var b=this.item;b.enable=a||(-1==b.enable?1:-1)},c.prototype.deactivate=function(a,c){var d=this,e=d.item.disable.slice(0);return"flip"==c?d.flipEnable():!1===c?(d.flipEnable(1),e=[]):!0===c?(d.flipEnable(-1),e=[]):c.map(function(a){for(var c,f=0;f<e.length;f+=1)if(d.isTimeExact(a,e[f])){c=!0;break}c||(h.isInteger(a)||h.isDate(a)||b.isArray(a)||b.isPlainObject(a)&&a.from&&a.to)&&e.push(a)}),e},c.prototype.activate=function(a,c){var d=this,e=d.item.disable,f=e.length;return"flip"==c?d.flipEnable():!0===c?(d.flipEnable(1),e=[]):!1===c?(d.flipEnable(-1),e=[]):c.map(function(a){var c,g,i,j;for(i=0;i<f;i+=1){if(g=e[i],d.isTimeExact(g,a)){c=e[i]=null,j=!0;break}if(d.isTimeOverlap(g,a)){b.isPlainObject(a)?(a.inverted=!0,c=a):b.isArray(a)?(c=a,c[2]||c.push("inverted")):h.isDate(a)&&(c=[a.getFullYear(),a.getMonth(),a.getDate(),"inverted"]);break}}if(c)for(i=0;i<f;i+=1)if(d.isTimeExact(e[i],a)){e[i]=null;break}if(j)for(i=0;i<f;i+=1)if(d.isTimeOverlap(e[i],a)){e[i]=null;break}c&&e.push(c)}),e.filter(function(a){return null!=a})},c.prototype.i=function(a,b){return h.isInteger(b)&&b>0?b:this.item.interval},c.prototype.nodes=function(a){var b=this,c=b.settings,d=b.item.select,e=b.item.highlight,f=b.item.view,g=b.item.disable;return h.node("ul",h.group({min:b.item.min.pick,max:b.item.max.pick,i:b.item.interval,node:"li",item:function(a){a=b.create(a);var i=a.pick,j=d&&d.pick==i,k=e&&e.pick==i,l=g&&b.disabled(a),m=h.trigger(b.formats.toString,b,[c.format,a]);return[h.trigger(b.formats.toString,b,[h.trigger(c.formatLabel,b,[a])||c.format,a]),function(a){return j&&a.push(c.klass.selected),k&&a.push(c.klass.highlighted),f&&f.pick==i&&a.push(c.klass.viewset),l&&a.push(c.klass.disabled),a.join(" ")}([c.klass.listItem]),"data-pick="+a.pick+" "+h.ariaAttr({role:"option",label:m,selected:!(!j||b.$node.val()!==m)||null,activedescendant:!!k||null,disabled:!!l||null})]}})+h.node("li",h.node("button",c.clear,c.klass.buttonClear,"type=button data-clear=1"+(a?"":" disabled")+" "+h.ariaAttr({controls:b.$node[0].id})),"",h.ariaAttr({role:"presentation"})),c.klass.list,h.ariaAttr({role:"listbox",controls:b.$node[0].id}))},c.defaults=function(a){return{clear:"Clear",format:"h:i A",interval:30,closeOnSelect:!0,closeOnClear:!0,updateInput:!0,klass:{picker:a+" "+a+"--time",holder:a+"__holder",list:a+"__list",listItem:a+"__list-item",disabled:a+"__list-item--disabled",selected:a+"__list-item--selected",highlighted:a+"__list-item--highlighted",viewset:a+"__list-item--viewset",now:a+"__list-item--now",buttonClear:a+"__button--clear"}}}(a.klasses().picker),a.extend("pickatime",c)});
|
lib/simple-admin-pages/lib/pickadate/translations/ja_JP.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery.extend(jQuery.fn.pickadate.defaults,{monthsFull:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],monthsShort:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],weekdaysFull:["日曜日","月曜日","火曜日","水曜日","木曜日","金曜日","土曜日"],weekdaysShort:["日","月","火","水","木","金","土"],today:"今日",clear:"消去",firstDay:1,format:"yyyy
|
1 |
+
jQuery.extend(jQuery.fn.pickadate.defaults,{monthsFull:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],monthsShort:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],weekdaysFull:["日曜日","月曜日","火曜日","水曜日","木曜日","金曜日","土曜日"],weekdaysShort:["日","月","火","水","木","金","土"],today:"今日",clear:"消去",close:"閉じる",firstDay:1,format:"yyyy年mm月dd日",formatSubmit:"yyyy/mm/dd"}),jQuery.extend(jQuery.fn.pickatime.defaults,{clear:"消去"});
|
lib/stripe/.gitignore
DELETED
@@ -1,14 +0,0 @@
|
|
1 |
-
# Mac OS X dumps these all over the place.
|
2 |
-
.DS_Store
|
3 |
-
|
4 |
-
# Ignore the SimpleTest library if it is installed to /test/.
|
5 |
-
/test/simpletest/
|
6 |
-
|
7 |
-
# Ignore the /vendor/ directory for people using composer
|
8 |
-
/vendor/
|
9 |
-
|
10 |
-
# If the vendor directory isn't being commited the composer.lock file should also be ignored
|
11 |
-
composer.lock
|
12 |
-
|
13 |
-
# Ignore PHPUnit coverage file
|
14 |
-
clover.xml
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: FiveStarPlugins
|
|
3 |
Requires at Least: 4.4
|
4 |
Tested Up To: 5.7
|
5 |
Tags: reservation, reservations, restaurant reservations, reservation form, restaurant booking, restaurant reservation form, restaurant booking form, restaurant booking system, reservation system, online reservations, online restaurant booking, dinner reservations, restaurant form, gutenberg reservations, gutenberg restaurant reservations, gutenberg restaurant booking, mobile reservations, responsive reservations, table reservations, open table, book table, reserve table, easy reservations, simple reservations, quick restaurant reservations, custom reservation form, custom restaurant reservations
|
6 |
-
Stable tag: 2.2.
|
7 |
License: GPLv3
|
8 |
License URI:http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
Donate Link: https://www.etoilewebdesign.com/plugin-donations/
|
@@ -197,6 +197,12 @@ Find answers to even more questions in the [FAQ](http://doc.fivestarplugins.com/
|
|
197 |
|
198 |
== Changelog ==
|
199 |
|
|
|
|
|
|
|
|
|
|
|
|
|
200 |
= 2.2.6 (2021-04-21) =
|
201 |
- Changes from 2.2.5
|
202 |
- Updated to use the latest version of the SAP settings
|
3 |
Requires at Least: 4.4
|
4 |
Tested Up To: 5.7
|
5 |
Tags: reservation, reservations, restaurant reservations, reservation form, restaurant booking, restaurant reservation form, restaurant booking form, restaurant booking system, reservation system, online reservations, online restaurant booking, dinner reservations, restaurant form, gutenberg reservations, gutenberg restaurant reservations, gutenberg restaurant booking, mobile reservations, responsive reservations, table reservations, open table, book table, reserve table, easy reservations, simple reservations, quick restaurant reservations, custom reservation form, custom restaurant reservations
|
6 |
+
Stable tag: 2.2.7
|
7 |
License: GPLv3
|
8 |
License URI:http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
Donate Link: https://www.etoilewebdesign.com/plugin-donations/
|
197 |
|
198 |
== Changelog ==
|
199 |
|
200 |
+
= 2.2.7 (2021-04-23) =
|
201 |
+
- Bookings that require a deposit, but which have been abandoned before the deposit was paid now show in the admin bookings table with the status Payment Pending.
|
202 |
+
- Added an option to the modify/cancel booking screen on the front end to pay the deposit. This applies to bookings that have either the Payment Pending or Payment Failed status.
|
203 |
+
- Added an option, for Stripe payments, to have the credit card expiry date show as one input field.
|
204 |
+
- Correcting an issue from v2.2.6 with the table and section inputs on the settings page.
|
205 |
+
|
206 |
= 2.2.6 (2021-04-21) =
|
207 |
- Changes from 2.2.5
|
208 |
- Updated to use the latest version of the SAP settings
|
restaurant-reservations.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Five Star Restaurant Reservations - WordPress Booking Plugin
|
4 |
* Plugin URI: http://www.fivestarplugins.com/plugins/five-star-restaurant-reservations/
|
5 |
* Description: Restaurant reservations made easy. Accept bookings online. Quickly confirm or reject reservations, send email notifications, set booking times and more.
|
6 |
-
* Version: 2.2.
|
7 |
* Author: FiveStarPlugins
|
8 |
* Author URI: https://profiles.wordpress.org/fivestarplugins/
|
9 |
* Text Domain: restaurant-reservations
|
3 |
* Plugin Name: Five Star Restaurant Reservations - WordPress Booking Plugin
|
4 |
* Plugin URI: http://www.fivestarplugins.com/plugins/five-star-restaurant-reservations/
|
5 |
* Description: Restaurant reservations made easy. Accept bookings online. Quickly confirm or reject reservations, send email notifications, set booking times and more.
|
6 |
+
* Version: 2.2.7
|
7 |
* Author: FiveStarPlugins
|
8 |
* Author URI: https://profiles.wordpress.org/fivestarplugins/
|
9 |
* Text Domain: restaurant-reservations
|