Version Description
- New extension: Backup & Demo Content (Note: It will not be visible in extensions list if old Backup extension is set as supported in theme manifest)
- Soft removed 3 extensions: Styling, Translation, Learning #874
- Added option type
short-slider
(same asslider
, but it's smaller) - Fixed html validation error. Added current url in
FW_Form
<form action="...">
- Option type
upload
: Addedfiles_ext
andextra_mime_types
parameters (docs) -
fw.Modal
: addedheaderElements
attribute to set html elements in modal header -
fw.soleModal
: addedbackdrop: null|bool
parameter to set backdrop transparent, white or dark - Added classes:
FW_Type
andFW_Type_Register
(used in the new Backup extension) - Fixed #993
- RTL fixes
- Other minor fixes (the diff)
Download this release
Release Info
Developer | Unyson |
Plugin | Unyson |
Version | 2.4.10 |
Comparing to | |
See all releases |
Code changes from version 2.4.9 to 2.4.10
- README.md +3 -4
- framework/LICENSE +1 -1
- framework/bootstrap.php +3 -1
- framework/core/components/extensions/manager/available-extensions.php +12 -0
- framework/core/components/extensions/manager/class--fw-extensions-manager.php +37 -4
- framework/core/components/extensions/manager/static/img/thumbnails/backups.jpg +0 -0
- framework/core/components/theme.php +7 -1
- framework/helpers/class-fw-form.php +1 -1
- framework/helpers/general.php +75 -0
- framework/helpers/type/class-fw-type-register.php +69 -0
- framework/helpers/type/class-fw-type.php +11 -0
- framework/includes/option-types/addable-popup/static/js/addable-popup.js +2 -0
- framework/includes/option-types/date-picker/static/js/scripts.js +5 -2
- framework/includes/option-types/datetime-picker/class-fw-option-type-datetime-picker.php +4 -0
- framework/includes/option-types/init.php +1 -0
- framework/includes/option-types/multi-picker/static/css/multi-picker.css +5 -1
- framework/includes/option-types/multi-upload/class-fw-option-type-multi-upload.php +22 -5
- framework/includes/option-types/multi-upload/static/js/any-files.js +88 -51
- framework/includes/option-types/multi-upload/static/js/images-only.js +105 -77
- framework/includes/option-types/popup/static/js/popup.js +1 -1
- framework/includes/option-types/radio-text/static/css/styles.css +12 -1
- framework/includes/option-types/range-slider/class-fw-option-type-range-slider.php +6 -2
- framework/includes/option-types/range-slider/static/js/scripts.js +2 -2
- framework/includes/option-types/range-slider/static/libs/ion-range-slider/ion.rangeSlider.min.js +76 -66
- framework/includes/option-types/rgba-color-picker/static/js/scripts.js +2 -2
- framework/includes/option-types/slider/class-fw-option-type-short-slider.php +17 -0
- framework/includes/option-types/slider/class-fw-option-type-slider.php +26 -13
- framework/includes/option-types/slider/static/css/styles.css +4 -0
- framework/includes/option-types/slider/static/js/scripts.js +2 -2
- framework/includes/option-types/slider/static/libs/ion-range-slider/ion.rangeSlider.min.js +76 -66
- framework/includes/option-types/upload/class-fw-option-type-upload.php +21 -3
- framework/includes/option-types/upload/static/js/any-files.js +40 -3
- framework/includes/option-types/upload/static/js/images-only.js +33 -3
- framework/manifest.php +1 -1
- framework/static/css/backend-options.css +76 -8
- framework/static/css/fw.css +19 -1
- framework/static/css/option-types.css +9 -1
- framework/static/js/fw.js +77 -23
- framework/views/backend-settings-form.php +46 -35
- readme.txt +14 -1
- unyson.php +1 -1
README.md
CHANGED
@@ -72,15 +72,12 @@ If you have a bug report or feature request related to a specific extension, fol
|
|
72 |
* [Sidebars](https://github.com/ThemeFuse/Unyson-Sidebars-Extension)
|
73 |
* [Sliders](https://github.com/ThemeFuse/Unyson-Sliders-Extension)
|
74 |
* [Portfolio](https://github.com/ThemeFuse/Unyson-Portfolio-Extension)
|
|
|
75 |
* [SEO](https://github.com/ThemeFuse/Unyson-SEO-Extension)
|
76 |
* [Forms](https://github.com/ThemeFuse/Unyson-Forms-Extension)
|
77 |
-
* [Styling](https://github.com/ThemeFuse/Unyson-Styling-Extension)
|
78 |
* [Feedback](https://github.com/ThemeFuse/Unyson-Feedback-Extension)
|
79 |
-
* [Backup](https://github.com/ThemeFuse/Unyson-Backup-Extension)
|
80 |
* [Breadcrumbs](https://github.com/ThemeFuse/Unyson-Breadcrumbs-Extension)
|
81 |
-
* [Learning](https://github.com/ThemeFuse/Unyson-Learning-Extension)
|
82 |
* [Events](https://github.com/ThemeFuse/Unyson-Events-Extension)
|
83 |
-
* [Translation](https://github.com/ThemeFuse/Unyson-Translation-Extension)
|
84 |
* [Update](https://github.com/ThemeFuse/Unyson-Update-Extension)
|
85 |
* [Analytics](https://github.com/ThemeFuse/Unyson-Analytics-Extension)
|
86 |
* [Builder](https://github.com/ThemeFuse/Unyson-Builder-Extension)
|
@@ -88,3 +85,5 @@ If you have a bug report or feature request related to a specific extension, fol
|
|
88 |
* [Social](https://github.com/ThemeFuse/Unyson-Social-Extension)
|
89 |
* [Population Methods](https://github.com/ThemeFuse/Unyson-PopulationMethods-Extension)
|
90 |
* [Blog Posts](https://github.com/ThemeFuse/Unyson-Blog-Extension)
|
|
|
|
72 |
* [Sidebars](https://github.com/ThemeFuse/Unyson-Sidebars-Extension)
|
73 |
* [Sliders](https://github.com/ThemeFuse/Unyson-Sliders-Extension)
|
74 |
* [Portfolio](https://github.com/ThemeFuse/Unyson-Portfolio-Extension)
|
75 |
+
* [Backup & Demo Content](https://github.com/ThemeFuse/Unyson-Backups-Extension)
|
76 |
* [SEO](https://github.com/ThemeFuse/Unyson-SEO-Extension)
|
77 |
* [Forms](https://github.com/ThemeFuse/Unyson-Forms-Extension)
|
|
|
78 |
* [Feedback](https://github.com/ThemeFuse/Unyson-Feedback-Extension)
|
|
|
79 |
* [Breadcrumbs](https://github.com/ThemeFuse/Unyson-Breadcrumbs-Extension)
|
|
|
80 |
* [Events](https://github.com/ThemeFuse/Unyson-Events-Extension)
|
|
|
81 |
* [Update](https://github.com/ThemeFuse/Unyson-Update-Extension)
|
82 |
* [Analytics](https://github.com/ThemeFuse/Unyson-Analytics-Extension)
|
83 |
* [Builder](https://github.com/ThemeFuse/Unyson-Builder-Extension)
|
85 |
* [Social](https://github.com/ThemeFuse/Unyson-Social-Extension)
|
86 |
* [Population Methods](https://github.com/ThemeFuse/Unyson-PopulationMethods-Extension)
|
87 |
* [Blog Posts](https://github.com/ThemeFuse/Unyson-Blog-Extension)
|
88 |
+
* [Learning](https://github.com/ThemeFuse/Unyson-Learning-Extension)
|
89 |
+
* [Translation](https://github.com/ThemeFuse/Unyson-Translation-Extension)
|
framework/LICENSE
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
GNU GENERAL PUBLIC LICENSE
|
2 |
Version 3, 29 June 2007
|
3 |
|
4 |
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
1 |
+
GNU GENERAL PUBLIC LICENSE
|
2 |
Version 3, 29 June 2007
|
3 |
|
4 |
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
framework/bootstrap.php
CHANGED
@@ -48,7 +48,9 @@ if (defined('FW')) {
|
|
48 |
'database',
|
49 |
'class-fw-flash-messages',
|
50 |
'class-fw-resize',
|
51 |
-
'class-fw-wp-list-table'
|
|
|
|
|
52 |
)
|
53 |
as $file
|
54 |
) {
|
48 |
'database',
|
49 |
'class-fw-flash-messages',
|
50 |
'class-fw-resize',
|
51 |
+
'class-fw-wp-list-table',
|
52 |
+
'type/class-fw-type',
|
53 |
+
'type/class-fw-type-register',
|
54 |
)
|
55 |
as $file
|
56 |
) {
|
framework/core/components/extensions/manager/available-extensions.php
CHANGED
@@ -162,6 +162,18 @@ $extensions = array(
|
|
162 |
),
|
163 |
),
|
164 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
165 |
'events' => array(
|
166 |
'display' => true,
|
167 |
'parent' => null,
|
162 |
),
|
163 |
),
|
164 |
),
|
165 |
+
'backups' => array(
|
166 |
+
'display' => true,
|
167 |
+
'parent' => null,
|
168 |
+
'name' => __( 'Backup & Demo Content', 'fw' ),
|
169 |
+
'description' => __( 'This extension lets you create an automated backup schedule, import demo content or even create a demo content archive for migration purposes.', 'fw' ),
|
170 |
+
'thumbnail' => $thumbnails_uri . '/backups.jpg',
|
171 |
+
'download' => array(
|
172 |
+
'github' => array(
|
173 |
+
'user_repo' => $github_account . '/Unyson-Backups-Extension',
|
174 |
+
),
|
175 |
+
),
|
176 |
+
),
|
177 |
'events' => array(
|
178 |
'display' => true,
|
179 |
'parent' => null,
|
framework/core/components/extensions/manager/class--fw-extensions-manager.php
CHANGED
@@ -103,16 +103,18 @@ final class _FW_Extensions_Manager
|
|
103 |
static $can_install = null;
|
104 |
|
105 |
if ($can_install === null) {
|
106 |
-
$
|
107 |
|
108 |
-
if (is_multisite()
|
109 |
// only network admin can change files that affects the entire network
|
110 |
-
$can_install =
|
|
|
|
|
111 |
}
|
112 |
|
113 |
if ($can_install) {
|
114 |
// also you can use this method to get the capability
|
115 |
-
$can_install =
|
116 |
}
|
117 |
}
|
118 |
|
@@ -192,6 +194,29 @@ final class _FW_Extensions_Manager
|
|
192 |
'extensions' => array()
|
193 |
) );
|
194 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
195 |
FW_Cache::set($cache_key, $vars['extensions']);
|
196 |
|
197 |
return $vars['extensions'];
|
@@ -2421,6 +2446,14 @@ final class _FW_Extensions_Manager
|
|
2421 |
$source_data['user_repo'], $response_code
|
2422 |
)
|
2423 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2424 |
} else {
|
2425 |
return new WP_Error(
|
2426 |
$wp_error_id,
|
103 |
static $can_install = null;
|
104 |
|
105 |
if ($can_install === null) {
|
106 |
+
$capability = 'install_plugins';
|
107 |
|
108 |
+
if (is_multisite()) {
|
109 |
// only network admin can change files that affects the entire network
|
110 |
+
$can_install = current_user_can_for_blog(get_current_blog_id(), $capability);
|
111 |
+
} else {
|
112 |
+
$can_install = current_user_can($capability);
|
113 |
}
|
114 |
|
115 |
if ($can_install) {
|
116 |
// also you can use this method to get the capability
|
117 |
+
$can_install = $capability;
|
118 |
}
|
119 |
}
|
120 |
|
194 |
'extensions' => array()
|
195 |
) );
|
196 |
|
197 |
+
{
|
198 |
+
$installed_extensions = $this->get_installed_extensions();
|
199 |
+
$supported_extensions = fw()->theme->manifest->get('supported_extensions', array());
|
200 |
+
|
201 |
+
if (isset($installed_extensions['backup'])) {
|
202 |
+
// make sure only Backup or Backups can be installed
|
203 |
+
unset($vars['extensions']['backups']);
|
204 |
+
}
|
205 |
+
|
206 |
+
foreach (
|
207 |
+
array('backup', 'styling', 'translation', 'learning')
|
208 |
+
as $obsolete_extension
|
209 |
+
) {
|
210 |
+
if (
|
211 |
+
!isset($supported_extensions[$obsolete_extension])
|
212 |
+
&&
|
213 |
+
!isset($installed_extensions[$obsolete_extension])
|
214 |
+
) {
|
215 |
+
unset($vars['extensions'][$obsolete_extension]);
|
216 |
+
}
|
217 |
+
}
|
218 |
+
}
|
219 |
+
|
220 |
FW_Cache::set($cache_key, $vars['extensions']);
|
221 |
|
222 |
return $vars['extensions'];
|
2446 |
$source_data['user_repo'], $response_code
|
2447 |
)
|
2448 |
);
|
2449 |
+
} elseif (is_wp_error($response)) {
|
2450 |
+
return new WP_Error(
|
2451 |
+
$wp_error_id,
|
2452 |
+
sprintf(
|
2453 |
+
__( 'Failed to access Github repository "%s" releases. (%s)', 'fw' ),
|
2454 |
+
$source_data['user_repo'], $response->get_error_message()
|
2455 |
+
)
|
2456 |
+
);
|
2457 |
} else {
|
2458 |
return new WP_Error(
|
2459 |
$wp_error_id,
|
framework/core/components/extensions/manager/static/img/thumbnails/backups.jpg
ADDED
Binary file
|
framework/core/components/theme.php
CHANGED
@@ -191,7 +191,13 @@ final class _FW_Component_Theme
|
|
191 |
*/
|
192 |
public function _action_fw_extensions_init()
|
193 |
{
|
194 |
-
if (
|
|
|
|
|
|
|
|
|
|
|
|
|
195 |
FW_Flash_Messages::add(
|
196 |
'fw_theme_requirements',
|
197 |
__('Theme requirements not met:', 'fw') .' '. fw()->theme->manifest->get_not_met_requirement_text(),
|
191 |
*/
|
192 |
public function _action_fw_extensions_init()
|
193 |
{
|
194 |
+
if (
|
195 |
+
is_admin()
|
196 |
+
&&
|
197 |
+
!fw()->theme->manifest->check_requirements()
|
198 |
+
&&
|
199 |
+
current_user_can('manage_options')
|
200 |
+
) {
|
201 |
FW_Flash_Messages::add(
|
202 |
'fw_theme_requirements',
|
203 |
__('Theme requirements not met:', 'fw') .' '. fw()->theme->manifest->get_not_met_requirement_text(),
|
framework/helpers/class-fw-form.php
CHANGED
@@ -106,7 +106,7 @@ class FW_Form {
|
|
106 |
}
|
107 |
|
108 |
if ( ! isset( $data['attr']['action'] ) ) {
|
109 |
-
$data['attr']['action'] =
|
110 |
}
|
111 |
|
112 |
$this->attr = $data['attr'];
|
106 |
}
|
107 |
|
108 |
if ( ! isset( $data['attr']['action'] ) ) {
|
109 |
+
$data['attr']['action'] = fw_current_url();
|
110 |
}
|
111 |
|
112 |
$this->attr = $data['attr'];
|
framework/helpers/general.php
CHANGED
@@ -1512,3 +1512,78 @@ function fw_string_to_icon_html($icon, array $attributes = array()) {
|
|
1512 |
|
1513 |
return fw_html_tag($tag, $attr);
|
1514 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1512 |
|
1513 |
return fw_html_tag($tag, $attr);
|
1514 |
}
|
1515 |
+
|
1516 |
+
/**
|
1517 |
+
* @return string|null
|
1518 |
+
* @since 2.4.10
|
1519 |
+
*/
|
1520 |
+
function fw_get_json_last_error_message() {
|
1521 |
+
switch (json_last_error()) {
|
1522 |
+
case JSON_ERROR_NONE:
|
1523 |
+
return null; // __('No errors', 'fw');
|
1524 |
+
break;
|
1525 |
+
case JSON_ERROR_DEPTH:
|
1526 |
+
return __('Maximum stack depth exceeded', 'fw');
|
1527 |
+
break;
|
1528 |
+
case JSON_ERROR_STATE_MISMATCH:
|
1529 |
+
return __('Underflow or the modes mismatch', 'fw');
|
1530 |
+
break;
|
1531 |
+
case JSON_ERROR_CTRL_CHAR:
|
1532 |
+
return __('Unexpected control character found', 'fw');
|
1533 |
+
break;
|
1534 |
+
case JSON_ERROR_SYNTAX:
|
1535 |
+
return __('Syntax error, malformed JSON', 'fw');
|
1536 |
+
break;
|
1537 |
+
case JSON_ERROR_UTF8:
|
1538 |
+
return __('Malformed UTF-8 characters, possibly incorrectly encoded', 'fw');
|
1539 |
+
break;
|
1540 |
+
default:
|
1541 |
+
return __('Unknown error', 'fw');
|
1542 |
+
break;
|
1543 |
+
}
|
1544 |
+
}
|
1545 |
+
|
1546 |
+
/**
|
1547 |
+
* Return mime_types by file extension ex : input : array( 'png', 'jpg', 'jpeg' ) => output : array( 'image/jpeg' ).
|
1548 |
+
*
|
1549 |
+
* @param array $type
|
1550 |
+
*
|
1551 |
+
* @return array
|
1552 |
+
*/
|
1553 |
+
function fw_get_mime_type_by_ext( $type = array() ) {
|
1554 |
+
$result = array();
|
1555 |
+
|
1556 |
+
foreach ( wp_get_mime_types() as $key => $mime_type ) {
|
1557 |
+
$types = explode( '|', $key );
|
1558 |
+
foreach ( $type as $item ) {
|
1559 |
+
if ( in_array( $item, $types ) && ! in_array( $mime_type, $result ) ) {
|
1560 |
+
$result[] = $mime_type;
|
1561 |
+
}
|
1562 |
+
}
|
1563 |
+
}
|
1564 |
+
|
1565 |
+
return $result;
|
1566 |
+
}
|
1567 |
+
|
1568 |
+
/**
|
1569 |
+
* Return types from file extensions ex : input array( 'png', 'jpg', 'zip' ) => output : array( 'image', 'archive' ).
|
1570 |
+
*
|
1571 |
+
* @see wp_ext2type() function.
|
1572 |
+
*
|
1573 |
+
* @param array $ext_array
|
1574 |
+
*
|
1575 |
+
* @return array
|
1576 |
+
*/
|
1577 |
+
function fw_multi_ext2type( $ext_array = array() ) {
|
1578 |
+
|
1579 |
+
$type_collector = array();
|
1580 |
+
|
1581 |
+
foreach ( $ext_array as $ext ) {
|
1582 |
+
$type = wp_ext2type( $ext );
|
1583 |
+
if ( ! in_array( $type, $type_collector ) ) {
|
1584 |
+
$type_collector[] = $type;
|
1585 |
+
}
|
1586 |
+
}
|
1587 |
+
|
1588 |
+
return $type_collector;
|
1589 |
+
}
|
framework/helpers/type/class-fw-type-register.php
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php if ( ! defined( 'FW' ) ) die( 'Forbidden' );
|
2 |
+
|
3 |
+
/**
|
4 |
+
* @since 2.4.10
|
5 |
+
*/
|
6 |
+
abstract class FW_Type_Register {
|
7 |
+
/**
|
8 |
+
* Check if the type is instance of the required class (or other requirements)
|
9 |
+
* @param FW_Type $type
|
10 |
+
* @return bool|WP_Error
|
11 |
+
*/
|
12 |
+
abstract protected function validate_type(FW_Type $type);
|
13 |
+
|
14 |
+
/**
|
15 |
+
* @var FW_Type[]
|
16 |
+
*/
|
17 |
+
private $types = array();
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Only these access keys will be able to access the registered types
|
21 |
+
* @var array {'key': true}
|
22 |
+
*/
|
23 |
+
private $access_keys = array();
|
24 |
+
|
25 |
+
final public function __construct($access_keys) {
|
26 |
+
{
|
27 |
+
if (is_string($access_keys)) {
|
28 |
+
$access_keys = array(
|
29 |
+
$access_keys => true,
|
30 |
+
);
|
31 |
+
} elseif (!is_array($access_keys)) {
|
32 |
+
trigger_error('Invalid access key', E_USER_ERROR);
|
33 |
+
}
|
34 |
+
|
35 |
+
$this->access_keys = $access_keys;
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
public function register(FW_Type $type) {
|
40 |
+
if (isset($this->task_types[$type->get_type()])) {
|
41 |
+
throw new Exception('Type '. $type->get_type() .' already registered');
|
42 |
+
} elseif (
|
43 |
+
is_wp_error($validation_result = $this->validate_type($type))
|
44 |
+
||
|
45 |
+
!$validation_result
|
46 |
+
) {
|
47 |
+
throw new Exception(
|
48 |
+
'Invalid type '. $type->get_type()
|
49 |
+
.(is_wp_error($validation_result) ? ': '. $validation_result->get_error_message() : '')
|
50 |
+
);
|
51 |
+
}
|
52 |
+
|
53 |
+
$this->types[$type->get_type()] = $type;
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* @param FW_Access_Key $access_key
|
58 |
+
*
|
59 |
+
* @return FW_Type[]
|
60 |
+
* @internal
|
61 |
+
*/
|
62 |
+
public function _get_types(FW_Access_Key $access_key) {
|
63 |
+
if (!isset($this->access_keys[$access_key->get_key()])) {
|
64 |
+
trigger_error('Method call denied', E_USER_ERROR);
|
65 |
+
}
|
66 |
+
|
67 |
+
return $this->types;
|
68 |
+
}
|
69 |
+
}
|
framework/helpers/type/class-fw-type.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php if ( ! defined( 'FW' ) ) die( 'Forbidden' );
|
2 |
+
|
3 |
+
/**
|
4 |
+
* @since 2.4.10
|
5 |
+
*/
|
6 |
+
abstract class FW_Type {
|
7 |
+
/**
|
8 |
+
* @return string Unique type
|
9 |
+
*/
|
10 |
+
abstract public function get_type();
|
11 |
+
}
|
framework/includes/option-types/addable-popup/static/js/addable-popup.js
CHANGED
@@ -98,6 +98,8 @@
|
|
98 |
/**
|
99 |
* may throw error in in template is used an option id added after some items was already saved
|
100 |
*/
|
|
|
|
|
101 |
template = _.template(
|
102 |
$.trim(data.template),
|
103 |
values,
|
98 |
/**
|
99 |
* may throw error in in template is used an option id added after some items was already saved
|
100 |
*/
|
101 |
+
values._context = $clonedItem.find('.content');
|
102 |
+
|
103 |
template = _.template(
|
104 |
$.trim(data.template),
|
105 |
values,
|
framework/includes/option-types/date-picker/static/js/scripts.js
CHANGED
@@ -36,13 +36,16 @@ function fw_option_type_date_picker_initialize(object) {
|
|
36 |
|
37 |
jQuery(document).ready(function ($) {
|
38 |
fwEvents.on('fw:options:init', function (data) {
|
39 |
-
var obj = data.$elements.find('.fw-option-type-date-picker');
|
40 |
|
41 |
-
if (!obj.length)
|
42 |
return;
|
|
|
43 |
|
44 |
for (var i = 0; i < obj.length; i++) {
|
45 |
fw_option_type_date_picker_initialize(jQuery(obj[i]));
|
46 |
}
|
|
|
|
|
47 |
});
|
48 |
});
|
36 |
|
37 |
jQuery(document).ready(function ($) {
|
38 |
fwEvents.on('fw:options:init', function (data) {
|
39 |
+
var obj = data.$elements.find('.fw-option-type-date-picker:not(.initialized)');
|
40 |
|
41 |
+
if (!obj.length) {
|
42 |
return;
|
43 |
+
}
|
44 |
|
45 |
for (var i = 0; i < obj.length; i++) {
|
46 |
fw_option_type_date_picker_initialize(jQuery(obj[i]));
|
47 |
}
|
48 |
+
|
49 |
+
obj.addClass('initialized');
|
50 |
});
|
51 |
});
|
framework/includes/option-types/datetime-picker/class-fw-option-type-datetime-picker.php
CHANGED
@@ -37,6 +37,10 @@ class FW_Option_Type_Datetime_Picker extends FW_Option_Type {
|
|
37 |
protected function _render( $id, $option, $data ) {
|
38 |
$wrapper_attr = $option['attr'];
|
39 |
|
|
|
|
|
|
|
|
|
40 |
$moment_format = $option['datetime-picker']['moment-format'];
|
41 |
|
42 |
$wrapper_attr['data-min-date'] = fw_akg('datetime-picker/minDate', $option, false );
|
37 |
protected function _render( $id, $option, $data ) {
|
38 |
$wrapper_attr = $option['attr'];
|
39 |
|
40 |
+
$defaults = $this->_get_defaults();
|
41 |
+
$default_datetime_picker = $defaults['datetime-picker'];
|
42 |
+
$option['datetime-picker'] = array_merge( $default_datetime_picker, $option['datetime-picker'] );
|
43 |
+
|
44 |
$moment_format = $option['datetime-picker']['moment-format'];
|
45 |
|
46 |
$wrapper_attr['data-min-date'] = fw_akg('datetime-picker/minDate', $option, false );
|
framework/includes/option-types/init.php
CHANGED
@@ -26,6 +26,7 @@ require $dir . '/datetime-picker/class-fw-option-type-datetime-picker.php';
|
|
26 |
require $dir . '/radio-text/class-fw-option-type-radio-text.php';
|
27 |
require $dir . '/popup/class-fw-option-type-popup.php';
|
28 |
require $dir . '/slider/class-fw-option-type-slider.php';
|
|
|
29 |
require $dir . '/range-slider/class-fw-option-type-range-slider.php';
|
30 |
require $dir . '/rgba-color-picker/class-fw-option-type-rgba-color-picker.php';
|
31 |
require $dir . '/typography-v2/class-fw-option-type-typography-v2.php';
|
26 |
require $dir . '/radio-text/class-fw-option-type-radio-text.php';
|
27 |
require $dir . '/popup/class-fw-option-type-popup.php';
|
28 |
require $dir . '/slider/class-fw-option-type-slider.php';
|
29 |
+
require $dir . '/slider/class-fw-option-type-short-slider.php';
|
30 |
require $dir . '/range-slider/class-fw-option-type-range-slider.php';
|
31 |
require $dir . '/rgba-color-picker/class-fw-option-type-rgba-color-picker.php';
|
32 |
require $dir . '/typography-v2/class-fw-option-type-typography-v2.php';
|
framework/includes/option-types/multi-picker/static/css/multi-picker.css
CHANGED
@@ -36,7 +36,7 @@
|
|
36 |
}
|
37 |
|
38 |
.fw-option-type-multi-picker.fw-option-type-multi-picker-with-borders.has-choice > .picker-group,
|
39 |
-
.fw-option-type-multi-picker.fw-option-type-multi-picker-with-borders > .choice-group > .fw-backend-option {
|
40 |
border-bottom-width: 1px;
|
41 |
}
|
42 |
|
@@ -50,6 +50,10 @@
|
|
50 |
padding-bottom: 0; /* prevent backend-option double padding */
|
51 |
}
|
52 |
|
|
|
|
|
|
|
|
|
53 |
.fw-backend-option-type-multi-picker.fw-backend-option-design-customizer .fw-option-type-multi-picker > .picker-group {
|
54 |
padding-bottom: 10px;
|
55 |
}
|
36 |
}
|
37 |
|
38 |
.fw-option-type-multi-picker.fw-option-type-multi-picker-with-borders.has-choice > .picker-group,
|
39 |
+
.fw-option-type-multi-picker.fw-option-type-multi-picker-with-borders > .choice-group > .fw-backend-option:not(:last-child) {
|
40 |
border-bottom-width: 1px;
|
41 |
}
|
42 |
|
50 |
padding-bottom: 0; /* prevent backend-option double padding */
|
51 |
}
|
52 |
|
53 |
+
.fw-option-type-multi-picker.fw-option-type-multi-picker-with-borders > .picker-group > .fw-backend-option {
|
54 |
+
padding-bottom: 21px;
|
55 |
+
}
|
56 |
+
|
57 |
.fw-backend-option-type-multi-picker.fw-backend-option-design-customizer .fw-option-type-multi-picker > .picker-group {
|
58 |
padding-bottom: 10px;
|
59 |
}
|
framework/includes/option-types/multi-upload/class-fw-option-type-multi-upload.php
CHANGED
@@ -15,12 +15,13 @@ class FW_Option_Type_Multi_Upload extends FW_Option_Type
|
|
15 |
/**
|
16 |
* @internal
|
17 |
*/
|
18 |
-
protected function _get_defaults()
|
19 |
-
{
|
20 |
return array(
|
21 |
-
'images_only'
|
22 |
-
'texts'
|
23 |
-
'value'
|
|
|
|
|
24 |
);
|
25 |
}
|
26 |
|
@@ -112,6 +113,22 @@ class FW_Option_Type_Multi_Upload extends FW_Option_Type
|
|
112 |
|
113 |
$l10n = $option['texts'];
|
114 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
if ($option['images_only']) {
|
116 |
return $this->render_images_only($input_attr, $wrapper_attr, $l10n);
|
117 |
} else {
|
15 |
/**
|
16 |
* @internal
|
17 |
*/
|
18 |
+
protected function _get_defaults() {
|
|
|
19 |
return array(
|
20 |
+
'images_only' => true,
|
21 |
+
'texts' => array(),
|
22 |
+
'value' => array(),
|
23 |
+
'files_ext' => array(),
|
24 |
+
'extra_mime_types' => array()
|
25 |
);
|
26 |
}
|
27 |
|
113 |
|
114 |
$l10n = $option['texts'];
|
115 |
|
116 |
+
if ( ! empty( $option['files_ext'] ) ) {
|
117 |
+
$ext_files = is_array( $option['files_ext'] ) ? $option['files_ext'] : explode( ',', $option['files_ext'] );
|
118 |
+
$ext_files = array_unique( $ext_files );
|
119 |
+
$mime_types = fw_get_mime_type_by_ext( $ext_files );
|
120 |
+
$collector = array(
|
121 |
+
'ext_files' => $ext_files,
|
122 |
+
'mime_types' => $mime_types,
|
123 |
+
'extra_mime_types' => $option['extra_mime_types']
|
124 |
+
);
|
125 |
+
|
126 |
+
$wrapper_attr['data-files-details'] = json_encode( $collector );
|
127 |
+
|
128 |
+
$check_file_types = fw_multi_ext2type( $ext_files );
|
129 |
+
$option['images_only'] = ( ! empty( $check_file_types ) && count( $check_file_types ) === 1 && $check_file_types[0] === 'image' );
|
130 |
+
}
|
131 |
+
|
132 |
if ($option['images_only']) {
|
133 |
return $this->render_images_only($input_attr, $wrapper_attr, $l10n);
|
134 |
} else {
|
framework/includes/option-types/multi-upload/static/js/any-files.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
(function($, fwe) {
|
2 |
|
3 |
-
var init = function() {
|
4 |
var $this = $(this),
|
5 |
elements = {
|
6 |
$container: $this,
|
@@ -15,62 +15,99 @@
|
|
15 |
filesOne: elements.$container.attr('data-l10n-files-one'),
|
16 |
filesMore: elements.$container.attr('data-l10n-files-more')
|
17 |
},
|
18 |
-
frame
|
19 |
-
createFrame = function() {
|
20 |
-
frame = wp.media({
|
21 |
-
multiple: true
|
22 |
-
});
|
23 |
|
24 |
-
|
25 |
-
frame.modal.$el.addClass('fw-option-type-multi-upload');
|
26 |
-
});
|
27 |
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
});
|
44 |
-
} catch(e) {
|
45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
});
|
|
|
48 |
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
attachments: attachments
|
69 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
});
|
71 |
-
|
|
|
|
|
|
|
|
|
72 |
|
73 |
-
elements.$uploadButton.on('click', function(e) {
|
74 |
e.preventDefault();
|
75 |
|
76 |
if (!frame) {
|
@@ -79,7 +116,7 @@
|
|
79 |
frame.open();
|
80 |
});
|
81 |
|
82 |
-
elements.$deleteButton.on('click', function(e) {
|
83 |
elements.$input.val('[]');
|
84 |
elements.$textField.text('');
|
85 |
elements.$uploadButton.text(l10n.buttonAdd);
|
@@ -92,7 +129,7 @@
|
|
92 |
});
|
93 |
};
|
94 |
|
95 |
-
fwe.on('fw:options:init', function(data) {
|
96 |
data.$elements
|
97 |
.find('.fw-option-type-multi-upload.any-files:not(.fw-option-initialized)').each(init)
|
98 |
.addClass('fw-option-initialized');
|
1 |
+
(function ($, fwe) {
|
2 |
|
3 |
+
var init = function () {
|
4 |
var $this = $(this),
|
5 |
elements = {
|
6 |
$container: $this,
|
15 |
filesOne: elements.$container.attr('data-l10n-files-one'),
|
16 |
filesMore: elements.$container.attr('data-l10n-files-more')
|
17 |
},
|
18 |
+
frame;
|
|
|
|
|
|
|
|
|
19 |
|
20 |
+
var haveFilesDetails = elements.$container.attr('data-files-details') !== undefined;
|
|
|
|
|
21 |
|
22 |
+
if (haveFilesDetails) {
|
23 |
+
var parsedFilesDetails = JSON.parse(elements.$container.attr('data-files-details'));
|
24 |
+
}
|
25 |
+
var createFrame = function () {
|
26 |
+
var frameOpts = haveFilesDetails ?
|
27 |
+
{
|
28 |
+
library: {
|
29 |
+
type: parsedFilesDetails.mime_types
|
30 |
+
},
|
31 |
+
multiple: true
|
32 |
+
} : {
|
33 |
+
multiple: true
|
34 |
+
};
|
35 |
+
|
36 |
+
frame = wp.media(frameOpts);
|
|
|
|
|
37 |
|
38 |
+
if (haveFilesDetails) {
|
39 |
+
frame.on('content:render', function () {
|
40 |
+
var $view = this.first().frame.views.get('.media-frame-uploader')[0];
|
41 |
+
|
42 |
+
if(parsedFilesDetails.extra_mime_types.length > 0 && _.isArray(parsedFilesDetails.extra_mime_types)){
|
43 |
+
_.each(parsedFilesDetails.extra_mime_types, function(mime_type){
|
44 |
+
mOxie.Mime.addMimeType(mime_type);
|
45 |
+
});
|
46 |
}
|
47 |
+
|
48 |
+
$view.options.uploader.plupload = {
|
49 |
+
filters: {
|
50 |
+
mime_types: [
|
51 |
+
{
|
52 |
+
title: 'Files : ' + parsedFilesDetails.ext_files.join(','),
|
53 |
+
extensions: parsedFilesDetails.ext_files.join(',')
|
54 |
+
}
|
55 |
+
]
|
56 |
+
}
|
57 |
+
};
|
58 |
});
|
59 |
+
}
|
60 |
|
61 |
+
frame.on('ready', function () {
|
62 |
+
frame.modal.$el.addClass('fw-option-type-multi-upload');
|
63 |
+
});
|
64 |
+
|
65 |
+
// opens the modal with the correct attachments already selected
|
66 |
+
frame.on('open', function () {
|
67 |
+
var selection = frame.state().get('selection'),
|
68 |
+
ids = elements.$input.val(),
|
69 |
+
parsedIds,
|
70 |
+
attachment;
|
71 |
+
|
72 |
+
frame.reset();
|
73 |
+
try {
|
74 |
+
parsedIds = JSON.parse(ids);
|
75 |
+
$.each(parsedIds, function (index, id) {
|
76 |
+
attachment = wp.media.attachment(id);
|
77 |
+
if (attachment.id) {
|
78 |
+
selection.add(attachment);
|
79 |
+
}
|
|
|
80 |
});
|
81 |
+
} catch (e) {
|
82 |
+
|
83 |
+
}
|
84 |
+
});
|
85 |
+
|
86 |
+
frame.on('select', function () {
|
87 |
+
var attachments = frame.state().get('selection'),
|
88 |
+
ids = attachments.map(function (attachment) {
|
89 |
+
return attachment.id;
|
90 |
+
}),
|
91 |
+
selectedText = ids.length === 1
|
92 |
+
? l10n.filesOne
|
93 |
+
: l10n.filesMore.replace('%u', ids.length);
|
94 |
+
|
95 |
+
elements.$input.val(JSON.stringify(ids));
|
96 |
+
elements.$textField.text(selectedText);
|
97 |
+
elements.$uploadButton.text(l10n.buttonEdit);
|
98 |
+
elements.$container.removeClass('empty');
|
99 |
+
|
100 |
+
fwe.trigger('fw:option-type:multi-upload:change', {
|
101 |
+
$element: elements.$container,
|
102 |
+
attachments: attachments
|
103 |
});
|
104 |
+
elements.$container.trigger('fw:option-type:multi-upload:change', {
|
105 |
+
attachments: attachments
|
106 |
+
});
|
107 |
+
});
|
108 |
+
};
|
109 |
|
110 |
+
elements.$uploadButton.on('click', function (e) {
|
111 |
e.preventDefault();
|
112 |
|
113 |
if (!frame) {
|
116 |
frame.open();
|
117 |
});
|
118 |
|
119 |
+
elements.$deleteButton.on('click', function (e) {
|
120 |
elements.$input.val('[]');
|
121 |
elements.$textField.text('');
|
122 |
elements.$uploadButton.text(l10n.buttonAdd);
|
129 |
});
|
130 |
};
|
131 |
|
132 |
+
fwe.on('fw:options:init', function (data) {
|
133 |
data.$elements
|
134 |
.find('.fw-option-type-multi-upload.any-files:not(.fw-option-initialized)').each(init)
|
135 |
.addClass('fw-option-initialized');
|
framework/includes/option-types/multi-upload/static/js/images-only.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
(function($, _, fwe) {
|
2 |
|
3 |
-
var init = function() {
|
4 |
var $this = $(this),
|
5 |
elements = {
|
6 |
$container: $this,
|
@@ -14,9 +14,9 @@
|
|
14 |
notEmpty: $this.find('.thumb-template-not-empty').attr('data-template')
|
15 |
}
|
16 |
},
|
17 |
-
collectThumbsIds = function() {
|
18 |
var ids = [];
|
19 |
-
elements.$thumbsContainer.find('.thumb').each(function() {
|
20 |
ids.push($(this).data('attid'));
|
21 |
});
|
22 |
return ids;
|
@@ -25,84 +25,112 @@
|
|
25 |
buttonAdd: elements.$container.attr('data-l10n-button-add'),
|
26 |
buttonEdit: elements.$container.attr('data-l10n-button-edit')
|
27 |
},
|
28 |
-
frame
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
}
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
parsedIds = JSON.parse(ids);
|
51 |
-
$.each(parsedIds, function(index, id) {
|
52 |
-
attachment = wp.media.attachment(id);
|
53 |
-
if (attachment.id) {
|
54 |
-
selection.add(attachment);
|
55 |
-
}
|
56 |
});
|
57 |
-
} catch(e) {
|
58 |
-
|
59 |
}
|
60 |
-
});
|
61 |
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
}
|
76 |
-
|
77 |
-
ids.push(attachment.id);
|
78 |
-
compiledTemplates.push(_.template(
|
79 |
-
templates.thumb.notEmpty,
|
80 |
-
{
|
81 |
-
src: src,
|
82 |
-
alt: attachment.get('filename'),
|
83 |
-
id: attachment.id,
|
84 |
-
originalSrc: attachment.get('url')
|
85 |
-
},
|
86 |
-
{variable: 'data'}
|
87 |
-
));
|
88 |
});
|
|
|
89 |
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
});
|
103 |
-
};
|
|
|
104 |
|
105 |
-
elements.$uploadButton.on('click', function(e) {
|
106 |
e.preventDefault();
|
107 |
|
108 |
if (!frame) {
|
@@ -111,11 +139,11 @@
|
|
111 |
frame.open();
|
112 |
});
|
113 |
|
114 |
-
elements.$container.on('click', '.no-image-img, .thumb img', function() {
|
115 |
elements.$uploadButton.trigger('click');
|
116 |
});
|
117 |
|
118 |
-
elements.$thumbsContainer.on('click', '.clear-uploads-thumb', function(e) {
|
119 |
var ids;
|
120 |
|
121 |
$(this).closest('.thumb').remove();
|
@@ -139,14 +167,14 @@
|
|
139 |
|
140 |
elements.$thumbsContainer.sortable({
|
141 |
cancel: '.no-image',
|
142 |
-
update: function() {
|
143 |
var ids = collectThumbsIds();
|
144 |
elements.$input.val(JSON.stringify(ids));
|
145 |
}
|
146 |
});
|
147 |
};
|
148 |
|
149 |
-
fwe.on('fw:options:init', function(data) {
|
150 |
data.$elements
|
151 |
.find('.fw-option-type-multi-upload.images-only:not(.fw-option-initialized)').each(init)
|
152 |
.addClass('fw-option-initialized');
|
1 |
+
(function ($, _, fwe) {
|
2 |
|
3 |
+
var init = function () {
|
4 |
var $this = $(this),
|
5 |
elements = {
|
6 |
$container: $this,
|
14 |
notEmpty: $this.find('.thumb-template-not-empty').attr('data-template')
|
15 |
}
|
16 |
},
|
17 |
+
collectThumbsIds = function () {
|
18 |
var ids = [];
|
19 |
+
elements.$thumbsContainer.find('.thumb').each(function () {
|
20 |
ids.push($(this).data('attid'));
|
21 |
});
|
22 |
return ids;
|
25 |
buttonAdd: elements.$container.attr('data-l10n-button-add'),
|
26 |
buttonEdit: elements.$container.attr('data-l10n-button-edit')
|
27 |
},
|
28 |
+
frame;
|
29 |
+
|
30 |
+
var haveFilesDetails = elements.$container.attr('data-files-details') !== undefined;
|
31 |
+
|
32 |
+
if (haveFilesDetails) {
|
33 |
+
var parsedFilesDetails = JSON.parse(elements.$container.attr('data-files-details'));
|
34 |
+
}
|
35 |
+
var createFrame = function () {
|
36 |
+
frame = wp.media({
|
37 |
+
library: {
|
38 |
+
type: haveFilesDetails ? parsedFilesDetails.mime_types : 'image'
|
39 |
+
},
|
40 |
+
multiple: true
|
41 |
+
});
|
42 |
+
|
43 |
+
if (haveFilesDetails) {
|
44 |
+
frame.on('content:render', function () {
|
45 |
+
var $view = this.first().frame.views.get('.media-frame-uploader')[0];
|
46 |
+
|
47 |
+
if(parsedFilesDetails.extra_mime_types.length > 0 && _.isArray(parsedFilesDetails.extra_mime_types)){
|
48 |
+
_.each(parsedFilesDetails.extra_mime_types, function(mime_type){
|
49 |
+
mOxie.Mime.addMimeType(mime_type);
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
});
|
|
|
|
|
51 |
}
|
|
|
52 |
|
53 |
+
$view.options.uploader.plupload = {
|
54 |
+
filters: {
|
55 |
+
mime_types: [
|
56 |
+
{
|
57 |
+
title: 'Images',
|
58 |
+
extensions: parsedFilesDetails.ext_files.join(',')
|
59 |
+
}
|
60 |
+
]
|
61 |
+
}
|
62 |
+
};
|
63 |
+
});
|
64 |
+
}
|
65 |
+
frame.on('ready', function () {
|
66 |
+
frame.modal.$el.addClass('fw-option-type-multi-upload');
|
67 |
+
});
|
68 |
+
|
69 |
+
// opens the modal with the correct attachments already selected
|
70 |
+
frame.on('open', function () {
|
71 |
+
var selection = frame.state().get('selection'),
|
72 |
+
ids = elements.$input.val(),
|
73 |
+
parsedIds,
|
74 |
+
attachment;
|
75 |
+
|
76 |
+
frame.reset();
|
77 |
+
try {
|
78 |
+
parsedIds = JSON.parse(ids);
|
79 |
+
$.each(parsedIds, function (index, id) {
|
80 |
+
attachment = wp.media.attachment(id);
|
81 |
+
if (attachment.id) {
|
82 |
+
selection.add(attachment);
|
83 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
});
|
85 |
+
} catch (e) {
|
86 |
|
87 |
+
}
|
88 |
+
});
|
89 |
+
|
90 |
+
frame.on('select', function () {
|
91 |
+
var attachments = frame.state().get('selection'),
|
92 |
+
ids = [],
|
93 |
+
compiledTemplates = [];
|
94 |
+
|
95 |
+
attachments.each(function (attachment) {
|
96 |
+
var src;
|
97 |
+
if (attachment.get('sizes')) {
|
98 |
+
src = attachment.get('sizes').thumbnail
|
99 |
+
? attachment.get('sizes').thumbnail.url
|
100 |
+
: attachment.get('sizes').full.url;
|
101 |
+
} else {
|
102 |
+
src = attachment.get('url');
|
103 |
+
}
|
104 |
|
105 |
+
ids.push(attachment.id);
|
106 |
+
compiledTemplates.push(_.template(
|
107 |
+
templates.thumb.notEmpty,
|
108 |
+
{
|
109 |
+
src: src,
|
110 |
+
alt: attachment.get('filename'),
|
111 |
+
id: attachment.id,
|
112 |
+
originalSrc: attachment.get('url')
|
113 |
+
},
|
114 |
+
{variable: 'data'}
|
115 |
+
));
|
116 |
+
});
|
117 |
+
|
118 |
+
elements.$input.val(JSON.stringify(ids));
|
119 |
+
elements.$uploadButton.text(l10n.buttonEdit);
|
120 |
+
elements.$thumbsContainer.html(compiledTemplates.join(''));
|
121 |
+
elements.$container.removeClass('empty');
|
122 |
+
|
123 |
+
fwe.trigger('fw:option-type:multi-upload:change', {
|
124 |
+
$element: elements.$container,
|
125 |
+
attachments: attachments
|
126 |
+
});
|
127 |
+
elements.$container.trigger('fw:option-type:multi-upload:change', {
|
128 |
+
attachments: attachments
|
129 |
});
|
130 |
+
});
|
131 |
+
};
|
132 |
|
133 |
+
elements.$uploadButton.on('click', function (e) {
|
134 |
e.preventDefault();
|
135 |
|
136 |
if (!frame) {
|
139 |
frame.open();
|
140 |
});
|
141 |
|
142 |
+
elements.$container.on('click', '.no-image-img, .thumb img', function () {
|
143 |
elements.$uploadButton.trigger('click');
|
144 |
});
|
145 |
|
146 |
+
elements.$thumbsContainer.on('click', '.clear-uploads-thumb', function (e) {
|
147 |
var ids;
|
148 |
|
149 |
$(this).closest('.thumb').remove();
|
167 |
|
168 |
elements.$thumbsContainer.sortable({
|
169 |
cancel: '.no-image',
|
170 |
+
update: function () {
|
171 |
var ids = collectThumbsIds();
|
172 |
elements.$input.val(JSON.stringify(ids));
|
173 |
}
|
174 |
});
|
175 |
};
|
176 |
|
177 |
+
fwe.on('fw:options:init', function (data) {
|
178 |
data.$elements
|
179 |
.find('.fw-option-type-multi-upload.images-only:not(.fw-option-initialized)').each(init)
|
180 |
.addClass('fw-option-initialized');
|
framework/includes/option-types/popup/static/js/popup.js
CHANGED
@@ -23,7 +23,7 @@
|
|
23 |
}
|
24 |
};
|
25 |
|
26 |
-
nodes.$itemsWrapper.on('click', '.item', function (e) {
|
27 |
e.preventDefault();
|
28 |
|
29 |
var values = {};
|
23 |
}
|
24 |
};
|
25 |
|
26 |
+
nodes.$itemsWrapper.on('click', '.item > .button', function (e) {
|
27 |
e.preventDefault();
|
28 |
|
29 |
var values = {};
|
framework/includes/option-types/radio-text/static/css/styles.css
CHANGED
@@ -13,10 +13,19 @@
|
|
13 |
margin-left: 10px;
|
14 |
}
|
15 |
|
|
|
|
|
|
|
|
|
|
|
16 |
.fw-option-type-radio-text .predefined .fw-option-type-radio div:first-child {
|
17 |
margin-left: inherit;
|
18 |
}
|
19 |
|
|
|
|
|
|
|
|
|
20 |
.fw-option-type-radio-text .custom input.fw-option-type-text{
|
21 |
width: 100px;
|
22 |
margin-left: 10px;
|
@@ -29,4 +38,6 @@
|
|
29 |
|
30 |
.fw-backend-option-input-type-radio-text .fw-option-help-in-input {
|
31 |
top: 4px !important;
|
32 |
-
}
|
|
|
|
13 |
margin-left: 10px;
|
14 |
}
|
15 |
|
16 |
+
body.rtl .fw-option-type-radio-text .predefined .fw-option-type-radio div {
|
17 |
+
margin-right: 10px;
|
18 |
+
margin-left: 0;
|
19 |
+
}
|
20 |
+
|
21 |
.fw-option-type-radio-text .predefined .fw-option-type-radio div:first-child {
|
22 |
margin-left: inherit;
|
23 |
}
|
24 |
|
25 |
+
body.rtl .fw-option-type-radio-text .predefined .fw-option-type-radio div:first-child {
|
26 |
+
margin-right: inherit;
|
27 |
+
}
|
28 |
+
|
29 |
.fw-option-type-radio-text .custom input.fw-option-type-text{
|
30 |
width: 100px;
|
31 |
margin-left: 10px;
|
38 |
|
39 |
.fw-backend-option-input-type-radio-text .fw-option-help-in-input {
|
40 |
top: 4px !important;
|
41 |
+
}
|
42 |
+
|
43 |
+
|
framework/includes/option-types/range-slider/class-fw-option-type-range-slider.php
CHANGED
@@ -17,14 +17,14 @@ class FW_Option_Type_Range_Slider extends FW_Option_Type {
|
|
17 |
wp_enqueue_style(
|
18 |
'fw-option-' . $this->get_type() . 'ion-range-slider',
|
19 |
fw_get_framework_directory_uri( '/includes/option-types/' . $this->get_type() . '/static/libs/ion-range-slider/ion.rangeSlider.css' ),
|
20 |
-
|
21 |
);
|
22 |
|
23 |
wp_enqueue_script(
|
24 |
'fw-option-' . $this->get_type() . 'ion-range-slider',
|
25 |
fw_get_framework_directory_uri( '/includes/option-types/' . $this->get_type() . '/static/libs/ion-range-slider/ion.rangeSlider.min.js' ),
|
26 |
array( 'jquery', 'fw-moment' ),
|
27 |
-
|
28 |
);
|
29 |
}
|
30 |
|
@@ -81,6 +81,10 @@ class FW_Option_Type_Range_Slider extends FW_Option_Type {
|
|
81 |
'min' => 0,
|
82 |
'max' => 100,
|
83 |
'step' => 1,
|
|
|
|
|
|
|
|
|
84 |
), $properties );
|
85 |
}
|
86 |
|
17 |
wp_enqueue_style(
|
18 |
'fw-option-' . $this->get_type() . 'ion-range-slider',
|
19 |
fw_get_framework_directory_uri( '/includes/option-types/' . $this->get_type() . '/static/libs/ion-range-slider/ion.rangeSlider.css' ),
|
20 |
+
fw()->manifest->get_version()
|
21 |
);
|
22 |
|
23 |
wp_enqueue_script(
|
24 |
'fw-option-' . $this->get_type() . 'ion-range-slider',
|
25 |
fw_get_framework_directory_uri( '/includes/option-types/' . $this->get_type() . '/static/libs/ion-range-slider/ion.rangeSlider.min.js' ),
|
26 |
array( 'jquery', 'fw-moment' ),
|
27 |
+
fw()->manifest->get_version()
|
28 |
);
|
29 |
}
|
30 |
|
81 |
'min' => 0,
|
82 |
'max' => 100,
|
83 |
'step' => 1,
|
84 |
+
/**
|
85 |
+
* For large ranges, this will create https://static.md/6340ebf52a36255649f10b3d0dff3b1c.png
|
86 |
+
*/
|
87 |
+
'grid_snap' => false,
|
88 |
), $properties );
|
89 |
}
|
90 |
|
framework/includes/option-types/range-slider/static/js/scripts.js
CHANGED
@@ -17,10 +17,10 @@
|
|
17 |
};
|
18 |
|
19 |
fwEvents.on('fw:options:init', function (data) {
|
20 |
-
data.$elements.find('.fw-option-type-range-slider').each(function () {
|
21 |
var options = JSON.parse($(this).attr('data-fw-irs-options'));
|
22 |
$(this).find('.fw-irs-range-slider').ionRangeSlider(_.defaults(options, defaults));
|
23 |
-
});
|
24 |
});
|
25 |
|
26 |
})(jQuery, fwEvents);
|
17 |
};
|
18 |
|
19 |
fwEvents.on('fw:options:init', function (data) {
|
20 |
+
data.$elements.find('.fw-option-type-range-slider:not(.initialized)').each(function () {
|
21 |
var options = JSON.parse($(this).attr('data-fw-irs-options'));
|
22 |
$(this).find('.fw-irs-range-slider').ionRangeSlider(_.defaults(options, defaults));
|
23 |
+
}).addClass('initialized');
|
24 |
});
|
25 |
|
26 |
})(jQuery, fwEvents);
|
framework/includes/option-types/range-slider/static/libs/ion-range-slider/ion.rangeSlider.min.js
CHANGED
@@ -1,66 +1,76 @@
|
|
1 |
-
// Ion.RangeSlider | version 2.
|
2 |
-
(function(
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
this
|
12 |
-
this.$cache.
|
13 |
-
this.$cache.cont.find(".
|
14 |
-
this.$cache.cont.
|
15 |
-
this
|
16 |
-
this.
|
17 |
-
this.
|
18 |
-
this.plugin_count
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
this.
|
23 |
-
this.
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
this.
|
29 |
-
|
30 |
-
this.
|
31 |
-
this.
|
32 |
-
|
33 |
-
this.coords.
|
34 |
-
this.
|
35 |
-
this.coords.
|
36 |
-
|
37 |
-
|
38 |
-
this
|
39 |
-
this
|
40 |
-
this.
|
41 |
-
this
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
(
|
50 |
-
this.
|
51 |
-
b
|
52 |
-
a=this.
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
a.
|
58 |
-
|
59 |
-
this.
|
60 |
-
(
|
61 |
-
this
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Ion.RangeSlider | version 2.1.2 | https://github.com/IonDen/ion.rangeSlider
|
2 |
+
;(function(f,r,h,t,v){var u=0,p=function(){var a=t.userAgent,b=/msie\s\d+/i;return 0<a.search(b)&&(a=b.exec(a).toString(),a=a.split(" ")[1],9>a)?(f("html").addClass("lt-ie9"),!0):!1}();Function.prototype.bind||(Function.prototype.bind=function(a){var b=this,d=[].slice;if("function"!=typeof b)throw new TypeError;var c=d.call(arguments,1),e=function(){if(this instanceof e){var g=function(){};g.prototype=b.prototype;var g=new g,l=b.apply(g,c.concat(d.call(arguments)));return Object(l)===l?l:g}return b.apply(a,
|
3 |
+
c.concat(d.call(arguments)))};return e});Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){var d;if(null==this)throw new TypeError('"this" is null or not defined');var c=Object(this),e=c.length>>>0;if(0===e)return-1;d=+b||0;Infinity===Math.abs(d)&&(d=0);if(d>=e)return-1;for(d=Math.max(0<=d?d:e-Math.abs(d),0);d<e;){if(d in c&&c[d]===a)return d;d++}return-1});var q=function(a,b,d){this.VERSION="2.1.2";this.input=a;this.plugin_count=d;this.old_to=this.old_from=this.update_tm=this.calc_count=
|
4 |
+
this.current_plugin=0;this.raf_id=this.old_min_interval=null;this.is_update=this.is_key=this.no_diapason=this.force_redraw=this.dragging=!1;this.is_start=!0;this.is_click=this.is_resize=this.is_active=this.is_finish=!1;this.$cache={win:f(h),body:f(r.body),input:f(a),cont:null,rs:null,min:null,max:null,from:null,to:null,single:null,bar:null,line:null,s_single:null,s_from:null,s_to:null,shad_single:null,shad_from:null,shad_to:null,edge:null,grid:null,grid_labels:[]};this.coords={x_gap:0,x_pointer:0,
|
5 |
+
w_rs:0,w_rs_old:0,w_handle:0,p_gap:0,p_gap_left:0,p_gap_right:0,p_step:0,p_pointer:0,p_handle:0,p_single_fake:0,p_single_real:0,p_from_fake:0,p_from_real:0,p_to_fake:0,p_to_real:0,p_bar_x:0,p_bar_w:0,grid_gap:0,big_num:0,big:[],big_w:[],big_p:[],big_x:[]};this.labels={w_min:0,w_max:0,w_from:0,w_to:0,w_single:0,p_min:0,p_max:0,p_from_fake:0,p_from_left:0,p_to_fake:0,p_to_left:0,p_single_fake:0,p_single_left:0};var c=this.$cache.input;a=c.prop("value");var e;d={type:"single",min:10,max:100,from:null,
|
6 |
+
to:null,step:1,min_interval:0,max_interval:0,drag_interval:!1,values:[],p_values:[],from_fixed:!1,from_min:null,from_max:null,from_shadow:!1,to_fixed:!1,to_min:null,to_max:null,to_shadow:!1,prettify_enabled:!0,prettify_separator:" ",prettify:null,force_edges:!1,keyboard:!1,keyboard_step:5,grid:!1,grid_margin:!0,grid_num:4,grid_snap:!1,hide_min_max:!1,hide_from_to:!1,prefix:"",postfix:"",max_postfix:"",decorate_both:!0,values_separator:" \u2014 ",input_values_separator:";",disable:!1,onStart:null,
|
7 |
+
onChange:null,onFinish:null,onUpdate:null};c={type:c.data("type"),min:c.data("min"),max:c.data("max"),from:c.data("from"),to:c.data("to"),step:c.data("step"),min_interval:c.data("minInterval"),max_interval:c.data("maxInterval"),drag_interval:c.data("dragInterval"),values:c.data("values"),from_fixed:c.data("fromFixed"),from_min:c.data("fromMin"),from_max:c.data("fromMax"),from_shadow:c.data("fromShadow"),to_fixed:c.data("toFixed"),to_min:c.data("toMin"),to_max:c.data("toMax"),to_shadow:c.data("toShadow"),
|
8 |
+
prettify_enabled:c.data("prettifyEnabled"),prettify_separator:c.data("prettifySeparator"),force_edges:c.data("forceEdges"),keyboard:c.data("keyboard"),keyboard_step:c.data("keyboardStep"),grid:c.data("grid"),grid_margin:c.data("gridMargin"),grid_num:c.data("gridNum"),grid_snap:c.data("gridSnap"),hide_min_max:c.data("hideMinMax"),hide_from_to:c.data("hideFromTo"),prefix:c.data("prefix"),postfix:c.data("postfix"),max_postfix:c.data("maxPostfix"),decorate_both:c.data("decorateBoth"),values_separator:c.data("valuesSeparator"),
|
9 |
+
input_values_separator:c.data("inputValuesSeparator"),disable:c.data("disable")};c.values=c.values&&c.values.split(",");for(e in c)c.hasOwnProperty(e)&&(c[e]||0===c[e]||delete c[e]);a&&(a=a.split(c.input_values_separator||b.input_values_separator||";"),a[0]&&a[0]==+a[0]&&(a[0]=+a[0]),a[1]&&a[1]==+a[1]&&(a[1]=+a[1]),b&&b.values&&b.values.length?(d.from=a[0]&&b.values.indexOf(a[0]),d.to=a[1]&&b.values.indexOf(a[1])):(d.from=a[0]&&+a[0],d.to=a[1]&&+a[1]));f.extend(d,b);f.extend(d,c);this.options=d;this.validate();
|
10 |
+
this.result={input:this.$cache.input,slider:null,min:this.options.min,max:this.options.max,from:this.options.from,from_percent:0,from_value:null,to:this.options.to,to_percent:0,to_value:null};this.init()};q.prototype={init:function(a){this.no_diapason=!1;this.coords.p_step=this.convertToPercent(this.options.step,!0);this.target="base";this.toggleInput();this.append();this.setMinMax();a?(this.force_redraw=!0,this.calc(!0),this.callOnUpdate()):(this.force_redraw=!0,this.calc(!0),this.callOnStart());
|
11 |
+
this.updateScene()},append:function(){this.$cache.input.before('<span class="irs js-irs-'+this.plugin_count+'"></span>');this.$cache.input.prop("readonly",!0);this.$cache.cont=this.$cache.input.prev();this.result.slider=this.$cache.cont;this.$cache.cont.html('<span class="irs"><span class="irs-line" tabindex="-1"><span class="irs-line-left"></span><span class="irs-line-mid"></span><span class="irs-line-right"></span></span><span class="irs-min">0</span><span class="irs-max">1</span><span class="irs-from">0</span><span class="irs-to">0</span><span class="irs-single">0</span></span><span class="irs-grid"></span><span class="irs-bar"></span>');
|
12 |
+
this.$cache.rs=this.$cache.cont.find(".irs");this.$cache.min=this.$cache.cont.find(".irs-min");this.$cache.max=this.$cache.cont.find(".irs-max");this.$cache.from=this.$cache.cont.find(".irs-from");this.$cache.to=this.$cache.cont.find(".irs-to");this.$cache.single=this.$cache.cont.find(".irs-single");this.$cache.bar=this.$cache.cont.find(".irs-bar");this.$cache.line=this.$cache.cont.find(".irs-line");this.$cache.grid=this.$cache.cont.find(".irs-grid");"single"===this.options.type?(this.$cache.cont.append('<span class="irs-bar-edge"></span><span class="irs-shadow shadow-single"></span><span class="irs-slider single"></span>'),
|
13 |
+
this.$cache.edge=this.$cache.cont.find(".irs-bar-edge"),this.$cache.s_single=this.$cache.cont.find(".single"),this.$cache.from[0].style.visibility="hidden",this.$cache.to[0].style.visibility="hidden",this.$cache.shad_single=this.$cache.cont.find(".shadow-single")):(this.$cache.cont.append('<span class="irs-shadow shadow-from"></span><span class="irs-shadow shadow-to"></span><span class="irs-slider from"></span><span class="irs-slider to"></span>'),this.$cache.s_from=this.$cache.cont.find(".from"),
|
14 |
+
this.$cache.s_to=this.$cache.cont.find(".to"),this.$cache.shad_from=this.$cache.cont.find(".shadow-from"),this.$cache.shad_to=this.$cache.cont.find(".shadow-to"),this.setTopHandler());this.options.hide_from_to&&(this.$cache.from[0].style.display="none",this.$cache.to[0].style.display="none",this.$cache.single[0].style.display="none");this.appendGrid();this.options.disable?(this.appendDisableMask(),this.$cache.input[0].disabled=!0):(this.$cache.cont.removeClass("irs-disabled"),this.$cache.input[0].disabled=
|
15 |
+
!1,this.bindEvents());this.options.drag_interval&&(this.$cache.bar[0].style.cursor="ew-resize")},setTopHandler:function(){var a=this.options.max,b=this.options.to;this.options.from>this.options.min&&b===a?this.$cache.s_from.addClass("type_last"):b<a&&this.$cache.s_to.addClass("type_last")},changeLevel:function(a){switch(a){case "single":this.coords.p_gap=this.toFixed(this.coords.p_pointer-this.coords.p_single_fake);break;case "from":this.coords.p_gap=this.toFixed(this.coords.p_pointer-this.coords.p_from_fake);
|
16 |
+
this.$cache.s_from.addClass("state_hover");this.$cache.s_from.addClass("type_last");this.$cache.s_to.removeClass("type_last");break;case "to":this.coords.p_gap=this.toFixed(this.coords.p_pointer-this.coords.p_to_fake);this.$cache.s_to.addClass("state_hover");this.$cache.s_to.addClass("type_last");this.$cache.s_from.removeClass("type_last");break;case "both":this.coords.p_gap_left=this.toFixed(this.coords.p_pointer-this.coords.p_from_fake),this.coords.p_gap_right=this.toFixed(this.coords.p_to_fake-
|
17 |
+
this.coords.p_pointer),this.$cache.s_to.removeClass("type_last"),this.$cache.s_from.removeClass("type_last")}},appendDisableMask:function(){this.$cache.cont.append('<span class="irs-disable-mask"></span>');this.$cache.cont.addClass("irs-disabled")},remove:function(){this.$cache.cont.remove();this.$cache.cont=null;this.$cache.line.off("keydown.irs_"+this.plugin_count);this.$cache.body.off("touchmove.irs_"+this.plugin_count);this.$cache.body.off("mousemove.irs_"+this.plugin_count);this.$cache.win.off("touchend.irs_"+
|
18 |
+
this.plugin_count);this.$cache.win.off("mouseup.irs_"+this.plugin_count);p&&(this.$cache.body.off("mouseup.irs_"+this.plugin_count),this.$cache.body.off("mouseleave.irs_"+this.plugin_count));this.$cache.grid_labels=[];this.coords.big=[];this.coords.big_w=[];this.coords.big_p=[];this.coords.big_x=[];cancelAnimationFrame(this.raf_id)},bindEvents:function(){if(!this.no_diapason){this.$cache.body.on("touchmove.irs_"+this.plugin_count,this.pointerMove.bind(this));this.$cache.body.on("mousemove.irs_"+this.plugin_count,
|
19 |
+
this.pointerMove.bind(this));this.$cache.win.on("touchend.irs_"+this.plugin_count,this.pointerUp.bind(this));this.$cache.win.on("mouseup.irs_"+this.plugin_count,this.pointerUp.bind(this));this.$cache.line.on("touchstart.irs_"+this.plugin_count,this.pointerClick.bind(this,"click"));this.$cache.line.on("mousedown.irs_"+this.plugin_count,this.pointerClick.bind(this,"click"));this.options.drag_interval&&"double"===this.options.type?(this.$cache.bar.on("touchstart.irs_"+this.plugin_count,this.pointerDown.bind(this,
|
20 |
+
"both")),this.$cache.bar.on("mousedown.irs_"+this.plugin_count,this.pointerDown.bind(this,"both"))):(this.$cache.bar.on("touchstart.irs_"+this.plugin_count,this.pointerClick.bind(this,"click")),this.$cache.bar.on("mousedown.irs_"+this.plugin_count,this.pointerClick.bind(this,"click")));"single"===this.options.type?(this.$cache.single.on("touchstart.irs_"+this.plugin_count,this.pointerDown.bind(this,"single")),this.$cache.s_single.on("touchstart.irs_"+this.plugin_count,this.pointerDown.bind(this,"single")),
|
21 |
+
this.$cache.shad_single.on("touchstart.irs_"+this.plugin_count,this.pointerClick.bind(this,"click")),this.$cache.single.on("mousedown.irs_"+this.plugin_count,this.pointerDown.bind(this,"single")),this.$cache.s_single.on("mousedown.irs_"+this.plugin_count,this.pointerDown.bind(this,"single")),this.$cache.edge.on("mousedown.irs_"+this.plugin_count,this.pointerClick.bind(this,"click")),this.$cache.shad_single.on("mousedown.irs_"+this.plugin_count,this.pointerClick.bind(this,"click"))):(this.$cache.single.on("touchstart.irs_"+
|
22 |
+
this.plugin_count,this.pointerDown.bind(this,null)),this.$cache.single.on("mousedown.irs_"+this.plugin_count,this.pointerDown.bind(this,null)),this.$cache.from.on("touchstart.irs_"+this.plugin_count,this.pointerDown.bind(this,"from")),this.$cache.s_from.on("touchstart.irs_"+this.plugin_count,this.pointerDown.bind(this,"from")),this.$cache.to.on("touchstart.irs_"+this.plugin_count,this.pointerDown.bind(this,"to")),this.$cache.s_to.on("touchstart.irs_"+this.plugin_count,this.pointerDown.bind(this,"to")),
|
23 |
+
this.$cache.shad_from.on("touchstart.irs_"+this.plugin_count,this.pointerClick.bind(this,"click")),this.$cache.shad_to.on("touchstart.irs_"+this.plugin_count,this.pointerClick.bind(this,"click")),this.$cache.from.on("mousedown.irs_"+this.plugin_count,this.pointerDown.bind(this,"from")),this.$cache.s_from.on("mousedown.irs_"+this.plugin_count,this.pointerDown.bind(this,"from")),this.$cache.to.on("mousedown.irs_"+this.plugin_count,this.pointerDown.bind(this,"to")),this.$cache.s_to.on("mousedown.irs_"+
|
24 |
+
this.plugin_count,this.pointerDown.bind(this,"to")),this.$cache.shad_from.on("mousedown.irs_"+this.plugin_count,this.pointerClick.bind(this,"click")),this.$cache.shad_to.on("mousedown.irs_"+this.plugin_count,this.pointerClick.bind(this,"click")));if(this.options.keyboard)this.$cache.line.on("keydown.irs_"+this.plugin_count,this.key.bind(this,"keyboard"));p&&(this.$cache.body.on("mouseup.irs_"+this.plugin_count,this.pointerUp.bind(this)),this.$cache.body.on("mouseleave.irs_"+this.plugin_count,this.pointerUp.bind(this)))}},
|
25 |
+
pointerMove:function(a){this.dragging&&(this.coords.x_pointer=(a.pageX||a.originalEvent.touches&&a.originalEvent.touches[0].pageX)-this.coords.x_gap,this.calc())},pointerUp:function(a){if(this.current_plugin===this.plugin_count&&this.is_active){this.is_active=!1;this.$cache.cont.find(".state_hover").removeClass("state_hover");this.force_redraw=!0;p&&f("*").prop("unselectable",!1);this.updateScene();this.restoreOriginalMinInterval();if(f.contains(this.$cache.cont[0],a.target)||this.dragging)this.is_finish=
|
26 |
+
!0,this.callOnFinish();this.dragging=!1}},pointerDown:function(a,b){b.preventDefault();var d=b.pageX||b.originalEvent.touches&&b.originalEvent.touches[0].pageX;2!==b.button&&("both"===a&&this.setTempMinInterval(),a||(a=this.target),this.current_plugin=this.plugin_count,this.target=a,this.dragging=this.is_active=!0,this.coords.x_gap=this.$cache.rs.offset().left,this.coords.x_pointer=d-this.coords.x_gap,this.calcPointerPercent(),this.changeLevel(a),p&&f("*").prop("unselectable",!0),this.$cache.line.trigger("focus"),
|
27 |
+
this.updateScene())},pointerClick:function(a,b){b.preventDefault();var d=b.pageX||b.originalEvent.touches&&b.originalEvent.touches[0].pageX;2!==b.button&&(this.current_plugin=this.plugin_count,this.target=a,this.is_click=!0,this.coords.x_gap=this.$cache.rs.offset().left,this.coords.x_pointer=+(d-this.coords.x_gap).toFixed(),this.force_redraw=!0,this.calc(),this.$cache.line.trigger("focus"))},key:function(a,b){if(!(this.current_plugin!==this.plugin_count||b.altKey||b.ctrlKey||b.shiftKey||b.metaKey)){switch(b.which){case 83:case 65:case 40:case 37:b.preventDefault();
|
28 |
+
this.moveByKey(!1);break;case 87:case 68:case 38:case 39:b.preventDefault(),this.moveByKey(!0)}return!0}},moveByKey:function(a){var b=this.coords.p_pointer,b=a?b+this.options.keyboard_step:b-this.options.keyboard_step;this.coords.x_pointer=this.toFixed(this.coords.w_rs/100*b);this.is_key=!0;this.calc()},setMinMax:function(){this.options&&(this.options.hide_min_max?(this.$cache.min[0].style.display="none",this.$cache.max[0].style.display="none"):(this.options.values.length?(this.$cache.min.html(this.decorate(this.options.p_values[this.options.min])),
|
29 |
+
this.$cache.max.html(this.decorate(this.options.p_values[this.options.max]))):(this.$cache.min.html(this.decorate(this._prettify(this.options.min),this.options.min)),this.$cache.max.html(this.decorate(this._prettify(this.options.max),this.options.max))),this.labels.w_min=this.$cache.min.outerWidth(!1),this.labels.w_max=this.$cache.max.outerWidth(!1)))},setTempMinInterval:function(){var a=this.result.to-this.result.from;null===this.old_min_interval&&(this.old_min_interval=this.options.min_interval);
|
30 |
+
this.options.min_interval=a},restoreOriginalMinInterval:function(){null!==this.old_min_interval&&(this.options.min_interval=this.old_min_interval,this.old_min_interval=null)},calc:function(a){if(this.options){this.calc_count++;if(10===this.calc_count||a)this.calc_count=0,this.coords.w_rs=this.$cache.rs.outerWidth(!1),this.calcHandlePercent();if(this.coords.w_rs){this.calcPointerPercent();a=this.getHandleX();"click"===this.target&&(this.coords.p_gap=this.coords.p_handle/2,a=this.getHandleX(),this.target=
|
31 |
+
this.options.drag_interval?"both_one":this.chooseHandle(a));switch(this.target){case "base":var b=(this.options.max-this.options.min)/100;a=(this.result.from-this.options.min)/b;b=(this.result.to-this.options.min)/b;this.coords.p_single_real=this.toFixed(a);this.coords.p_from_real=this.toFixed(a);this.coords.p_to_real=this.toFixed(b);this.coords.p_single_real=this.checkDiapason(this.coords.p_single_real,this.options.from_min,this.options.from_max);this.coords.p_from_real=this.checkDiapason(this.coords.p_from_real,
|
32 |
+
this.options.from_min,this.options.from_max);this.coords.p_to_real=this.checkDiapason(this.coords.p_to_real,this.options.to_min,this.options.to_max);this.coords.p_single_fake=this.convertToFakePercent(this.coords.p_single_real);this.coords.p_from_fake=this.convertToFakePercent(this.coords.p_from_real);this.coords.p_to_fake=this.convertToFakePercent(this.coords.p_to_real);this.target=null;break;case "single":if(this.options.from_fixed)break;this.coords.p_single_real=this.convertToRealPercent(a);this.coords.p_single_real=
|
33 |
+
this.calcWithStep(this.coords.p_single_real);this.coords.p_single_real=this.checkDiapason(this.coords.p_single_real,this.options.from_min,this.options.from_max);this.coords.p_single_fake=this.convertToFakePercent(this.coords.p_single_real);break;case "from":if(this.options.from_fixed)break;this.coords.p_from_real=this.convertToRealPercent(a);this.coords.p_from_real=this.calcWithStep(this.coords.p_from_real);this.coords.p_from_real>this.coords.p_to_real&&(this.coords.p_from_real=this.coords.p_to_real);
|
34 |
+
this.coords.p_from_real=this.checkDiapason(this.coords.p_from_real,this.options.from_min,this.options.from_max);this.coords.p_from_real=this.checkMinInterval(this.coords.p_from_real,this.coords.p_to_real,"from");this.coords.p_from_real=this.checkMaxInterval(this.coords.p_from_real,this.coords.p_to_real,"from");this.coords.p_from_fake=this.convertToFakePercent(this.coords.p_from_real);break;case "to":if(this.options.to_fixed)break;this.coords.p_to_real=this.convertToRealPercent(a);this.coords.p_to_real=
|
35 |
+
this.calcWithStep(this.coords.p_to_real);this.coords.p_to_real<this.coords.p_from_real&&(this.coords.p_to_real=this.coords.p_from_real);this.coords.p_to_real=this.checkDiapason(this.coords.p_to_real,this.options.to_min,this.options.to_max);this.coords.p_to_real=this.checkMinInterval(this.coords.p_to_real,this.coords.p_from_real,"to");this.coords.p_to_real=this.checkMaxInterval(this.coords.p_to_real,this.coords.p_from_real,"to");this.coords.p_to_fake=this.convertToFakePercent(this.coords.p_to_real);
|
36 |
+
break;case "both":if(this.options.from_fixed||this.options.to_fixed)break;a=this.toFixed(a+.1*this.coords.p_handle);this.coords.p_from_real=this.convertToRealPercent(a)-this.coords.p_gap_left;this.coords.p_from_real=this.calcWithStep(this.coords.p_from_real);this.coords.p_from_real=this.checkDiapason(this.coords.p_from_real,this.options.from_min,this.options.from_max);this.coords.p_from_real=this.checkMinInterval(this.coords.p_from_real,this.coords.p_to_real,"from");this.coords.p_from_fake=this.convertToFakePercent(this.coords.p_from_real);
|
37 |
+
this.coords.p_to_real=this.convertToRealPercent(a)+this.coords.p_gap_right;this.coords.p_to_real=this.calcWithStep(this.coords.p_to_real);this.coords.p_to_real=this.checkDiapason(this.coords.p_to_real,this.options.to_min,this.options.to_max);this.coords.p_to_real=this.checkMinInterval(this.coords.p_to_real,this.coords.p_from_real,"to");this.coords.p_to_fake=this.convertToFakePercent(this.coords.p_to_real);break;case "both_one":if(this.options.from_fixed||this.options.to_fixed)break;var d=this.convertToRealPercent(a);
|
38 |
+
a=this.result.to_percent-this.result.from_percent;var c=a/2,b=d-c,d=d+c;0>b&&(b=0,d=b+a);100<d&&(d=100,b=d-a);this.coords.p_from_real=this.calcWithStep(b);this.coords.p_from_real=this.checkDiapason(this.coords.p_from_real,this.options.from_min,this.options.from_max);this.coords.p_from_fake=this.convertToFakePercent(this.coords.p_from_real);this.coords.p_to_real=this.calcWithStep(d);this.coords.p_to_real=this.checkDiapason(this.coords.p_to_real,this.options.to_min,this.options.to_max);this.coords.p_to_fake=
|
39 |
+
this.convertToFakePercent(this.coords.p_to_real)}"single"===this.options.type?(this.coords.p_bar_x=this.coords.p_handle/2,this.coords.p_bar_w=this.coords.p_single_fake,this.result.from_percent=this.coords.p_single_real,this.result.from=this.convertToValue(this.coords.p_single_real),this.options.values.length&&(this.result.from_value=this.options.values[this.result.from])):(this.coords.p_bar_x=this.toFixed(this.coords.p_from_fake+this.coords.p_handle/2),this.coords.p_bar_w=this.toFixed(this.coords.p_to_fake-
|
40 |
+
this.coords.p_from_fake),this.result.from_percent=this.coords.p_from_real,this.result.from=this.convertToValue(this.coords.p_from_real),this.result.to_percent=this.coords.p_to_real,this.result.to=this.convertToValue(this.coords.p_to_real),this.options.values.length&&(this.result.from_value=this.options.values[this.result.from],this.result.to_value=this.options.values[this.result.to]));this.calcMinMax();this.calcLabels()}}},calcPointerPercent:function(){this.coords.w_rs?(0>this.coords.x_pointer||isNaN(this.coords.x_pointer)?
|
41 |
+
this.coords.x_pointer=0:this.coords.x_pointer>this.coords.w_rs&&(this.coords.x_pointer=this.coords.w_rs),this.coords.p_pointer=this.toFixed(this.coords.x_pointer/this.coords.w_rs*100)):this.coords.p_pointer=0},convertToRealPercent:function(a){return a/(100-this.coords.p_handle)*100},convertToFakePercent:function(a){return a/100*(100-this.coords.p_handle)},getHandleX:function(){var a=100-this.coords.p_handle,b=this.toFixed(this.coords.p_pointer-this.coords.p_gap);0>b?b=0:b>a&&(b=a);return b},calcHandlePercent:function(){this.coords.w_handle=
|
42 |
+
"single"===this.options.type?this.$cache.s_single.outerWidth(!1):this.$cache.s_from.outerWidth(!1);this.coords.p_handle=this.toFixed(this.coords.w_handle/this.coords.w_rs*100)},chooseHandle:function(a){return"single"===this.options.type?"single":a>=this.coords.p_from_real+(this.coords.p_to_real-this.coords.p_from_real)/2?this.options.to_fixed?"from":"to":this.options.from_fixed?"to":"from"},calcMinMax:function(){this.coords.w_rs&&(this.labels.p_min=this.labels.w_min/this.coords.w_rs*100,this.labels.p_max=
|
43 |
+
this.labels.w_max/this.coords.w_rs*100)},calcLabels:function(){this.coords.w_rs&&!this.options.hide_from_to&&("single"===this.options.type?(this.labels.w_single=this.$cache.single.outerWidth(!1),this.labels.p_single_fake=this.labels.w_single/this.coords.w_rs*100,this.labels.p_single_left=this.coords.p_single_fake+this.coords.p_handle/2-this.labels.p_single_fake/2):(this.labels.w_from=this.$cache.from.outerWidth(!1),this.labels.p_from_fake=this.labels.w_from/this.coords.w_rs*100,this.labels.p_from_left=
|
44 |
+
this.coords.p_from_fake+this.coords.p_handle/2-this.labels.p_from_fake/2,this.labels.p_from_left=this.toFixed(this.labels.p_from_left),this.labels.p_from_left=this.checkEdges(this.labels.p_from_left,this.labels.p_from_fake),this.labels.w_to=this.$cache.to.outerWidth(!1),this.labels.p_to_fake=this.labels.w_to/this.coords.w_rs*100,this.labels.p_to_left=this.coords.p_to_fake+this.coords.p_handle/2-this.labels.p_to_fake/2,this.labels.p_to_left=this.toFixed(this.labels.p_to_left),this.labels.p_to_left=
|
45 |
+
this.checkEdges(this.labels.p_to_left,this.labels.p_to_fake),this.labels.w_single=this.$cache.single.outerWidth(!1),this.labels.p_single_fake=this.labels.w_single/this.coords.w_rs*100,this.labels.p_single_left=(this.labels.p_from_left+this.labels.p_to_left+this.labels.p_to_fake)/2-this.labels.p_single_fake/2,this.labels.p_single_left=this.toFixed(this.labels.p_single_left)),this.labels.p_single_left=this.checkEdges(this.labels.p_single_left,this.labels.p_single_fake))},updateScene:function(){this.raf_id&&
|
46 |
+
(cancelAnimationFrame(this.raf_id),this.raf_id=null);clearTimeout(this.update_tm);this.update_tm=null;this.options&&(this.drawHandles(),this.is_active?this.raf_id=requestAnimationFrame(this.updateScene.bind(this)):this.update_tm=setTimeout(this.updateScene.bind(this),300))},drawHandles:function(){this.coords.w_rs=this.$cache.rs.outerWidth(!1);if(this.coords.w_rs){this.coords.w_rs!==this.coords.w_rs_old&&(this.target="base",this.is_resize=!0);if(this.coords.w_rs!==this.coords.w_rs_old||this.force_redraw)this.setMinMax(),
|
47 |
+
this.calc(!0),this.drawLabels(),this.options.grid&&(this.calcGridMargin(),this.calcGridLabels()),this.force_redraw=!0,this.coords.w_rs_old=this.coords.w_rs,this.drawShadow();if(this.coords.w_rs&&(this.dragging||this.force_redraw||this.is_key)){if(this.old_from!==this.result.from||this.old_to!==this.result.to||this.force_redraw||this.is_key){this.drawLabels();this.$cache.bar[0].style.left=this.coords.p_bar_x+"%";this.$cache.bar[0].style.width=this.coords.p_bar_w+"%";if("single"===this.options.type)this.$cache.s_single[0].style.left=
|
48 |
+
this.coords.p_single_fake+"%",this.$cache.single[0].style.left=this.labels.p_single_left+"%",this.options.values.length?this.$cache.input.prop("value",this.result.from_value):this.$cache.input.prop("value",this.result.from),this.$cache.input.data("from",this.result.from);else{this.$cache.s_from[0].style.left=this.coords.p_from_fake+"%";this.$cache.s_to[0].style.left=this.coords.p_to_fake+"%";if(this.old_from!==this.result.from||this.force_redraw)this.$cache.from[0].style.left=this.labels.p_from_left+
|
49 |
+
"%";if(this.old_to!==this.result.to||this.force_redraw)this.$cache.to[0].style.left=this.labels.p_to_left+"%";this.$cache.single[0].style.left=this.labels.p_single_left+"%";this.options.values.length?this.$cache.input.prop("value",this.result.from_value+this.options.input_values_separator+this.result.to_value):this.$cache.input.prop("value",this.result.from+this.options.input_values_separator+this.result.to);this.$cache.input.data("from",this.result.from);this.$cache.input.data("to",this.result.to)}this.old_from===
|
50 |
+
this.result.from&&this.old_to===this.result.to||this.is_start||this.$cache.input.trigger("change");this.old_from=this.result.from;this.old_to=this.result.to;this.is_resize||this.is_update||this.is_start||this.is_finish||this.callOnChange();if(this.is_key||this.is_click)this.is_click=this.is_key=!1,this.callOnFinish();this.is_finish=this.is_resize=this.is_update=!1}this.force_redraw=this.is_click=this.is_key=this.is_start=!1}}},drawLabels:function(){if(this.options){var a=this.options.values.length,
|
51 |
+
b=this.options.p_values,d;if(!this.options.hide_from_to)if("single"===this.options.type)a=a?this.decorate(b[this.result.from]):this.decorate(this._prettify(this.result.from),this.result.from),this.$cache.single.html(a),this.calcLabels(),this.$cache.min[0].style.visibility=this.labels.p_single_left<this.labels.p_min+1?"hidden":"visible",this.$cache.max[0].style.visibility=this.labels.p_single_left+this.labels.p_single_fake>100-this.labels.p_max-1?"hidden":"visible";else{a?(this.options.decorate_both?
|
52 |
+
(a=this.decorate(b[this.result.from]),a+=this.options.values_separator,a+=this.decorate(b[this.result.to])):a=this.decorate(b[this.result.from]+this.options.values_separator+b[this.result.to]),d=this.decorate(b[this.result.from]),b=this.decorate(b[this.result.to])):(this.options.decorate_both?(a=this.decorate(this._prettify(this.result.from),this.result.from),a+=this.options.values_separator,a+=this.decorate(this._prettify(this.result.to),this.result.to)):a=this.decorate(this._prettify(this.result.from)+
|
53 |
+
this.options.values_separator+this._prettify(this.result.to),this.result.to),d=this.decorate(this._prettify(this.result.from),this.result.from),b=this.decorate(this._prettify(this.result.to),this.result.to));this.$cache.single.html(a);this.$cache.from.html(d);this.$cache.to.html(b);this.calcLabels();b=Math.min(this.labels.p_single_left,this.labels.p_from_left);a=this.labels.p_single_left+this.labels.p_single_fake;d=this.labels.p_to_left+this.labels.p_to_fake;var c=Math.max(a,d);this.labels.p_from_left+
|
54 |
+
this.labels.p_from_fake>=this.labels.p_to_left?(this.$cache.from[0].style.visibility="hidden",this.$cache.to[0].style.visibility="hidden",this.$cache.single[0].style.visibility="visible",this.result.from===this.result.to?("from"===this.target?this.$cache.from[0].style.visibility="visible":"to"===this.target&&(this.$cache.to[0].style.visibility="visible"),this.$cache.single[0].style.visibility="hidden",c=d):(this.$cache.from[0].style.visibility="hidden",this.$cache.to[0].style.visibility="hidden",
|
55 |
+
this.$cache.single[0].style.visibility="visible",c=Math.max(a,d))):(this.$cache.from[0].style.visibility="visible",this.$cache.to[0].style.visibility="visible",this.$cache.single[0].style.visibility="hidden");this.$cache.min[0].style.visibility=b<this.labels.p_min+1?"hidden":"visible";this.$cache.max[0].style.visibility=c>100-this.labels.p_max-1?"hidden":"visible"}}},drawShadow:function(){var a=this.options,b=this.$cache,d="number"===typeof a.from_min&&!isNaN(a.from_min),c="number"===typeof a.from_max&&
|
56 |
+
!isNaN(a.from_max),e="number"===typeof a.to_min&&!isNaN(a.to_min),g="number"===typeof a.to_max&&!isNaN(a.to_max);"single"===a.type?a.from_shadow&&(d||c)?(d=this.convertToPercent(d?a.from_min:a.min),c=this.convertToPercent(c?a.from_max:a.max)-d,d=this.toFixed(d-this.coords.p_handle/100*d),c=this.toFixed(c-this.coords.p_handle/100*c),d+=this.coords.p_handle/2,b.shad_single[0].style.display="block",b.shad_single[0].style.left=d+"%",b.shad_single[0].style.width=c+"%"):b.shad_single[0].style.display="none":
|
57 |
+
(a.from_shadow&&(d||c)?(d=this.convertToPercent(d?a.from_min:a.min),c=this.convertToPercent(c?a.from_max:a.max)-d,d=this.toFixed(d-this.coords.p_handle/100*d),c=this.toFixed(c-this.coords.p_handle/100*c),d+=this.coords.p_handle/2,b.shad_from[0].style.display="block",b.shad_from[0].style.left=d+"%",b.shad_from[0].style.width=c+"%"):b.shad_from[0].style.display="none",a.to_shadow&&(e||g)?(e=this.convertToPercent(e?a.to_min:a.min),a=this.convertToPercent(g?a.to_max:a.max)-e,e=this.toFixed(e-this.coords.p_handle/
|
58 |
+
100*e),a=this.toFixed(a-this.coords.p_handle/100*a),e+=this.coords.p_handle/2,b.shad_to[0].style.display="block",b.shad_to[0].style.left=e+"%",b.shad_to[0].style.width=a+"%"):b.shad_to[0].style.display="none")},callOnStart:function(){if(this.options.onStart&&"function"===typeof this.options.onStart)this.options.onStart(this.result)},callOnChange:function(){if(this.options.onChange&&"function"===typeof this.options.onChange)this.options.onChange(this.result)},callOnFinish:function(){if(this.options.onFinish&&
|
59 |
+
"function"===typeof this.options.onFinish)this.options.onFinish(this.result)},callOnUpdate:function(){if(this.options.onUpdate&&"function"===typeof this.options.onUpdate)this.options.onUpdate(this.result)},toggleInput:function(){this.$cache.input.toggleClass("irs-hidden-input")},convertToPercent:function(a,b){var d=this.options.max-this.options.min;return d?this.toFixed((b?a:a-this.options.min)/(d/100)):(this.no_diapason=!0,0)},convertToValue:function(a){var b=this.options.min,d=this.options.max,
|
60 |
+
c=b.toString().split(".")[1],e=d.toString().split(".")[1],g,l,k=0,f=0;if(0===a)return this.options.min;if(100===a)return this.options.max;c&&(k=g=c.length);e&&(k=l=e.length);g&&l&&(k=g>=l?g:l);0>b&&(f=Math.abs(b),b=+(b+f).toFixed(k),d=+(d+f).toFixed(k));a=(d-b)/100*a+b;(b=this.options.step.toString().split(".")[1])?a=+a.toFixed(b.length):(a/=this.options.step,a*=this.options.step,a=+a.toFixed(0));f&&(a-=f);f=b?+a.toFixed(b.length):this.toFixed(a);f<this.options.min?f=this.options.min:f>this.options.max&&
|
61 |
+
(f=this.options.max);return f},calcWithStep:function(a){var b=Math.round(a/this.coords.p_step)*this.coords.p_step;100<b&&(b=100);100===a&&(b=100);return this.toFixed(b)},checkMinInterval:function(a,b,d){var c=this.options;if(!c.min_interval)return a;a=this.convertToValue(a);b=this.convertToValue(b);"from"===d?b-a<c.min_interval&&(a=b-c.min_interval):a-b<c.min_interval&&(a=b+c.min_interval);return this.convertToPercent(a)},checkMaxInterval:function(a,b,d){var c=this.options;if(!c.max_interval)return a;
|
62 |
+
a=this.convertToValue(a);b=this.convertToValue(b);"from"===d?b-a>c.max_interval&&(a=b-c.max_interval):a-b>c.max_interval&&(a=b+c.max_interval);return this.convertToPercent(a)},checkDiapason:function(a,b,d){a=this.convertToValue(a);var c=this.options;"number"!==typeof b&&(b=c.min);"number"!==typeof d&&(d=c.max);a<b&&(a=b);a>d&&(a=d);return this.convertToPercent(a)},toFixed:function(a){a=a.toFixed(9);return+a},_prettify:function(a){return this.options.prettify_enabled?this.options.prettify&&"function"===
|
63 |
+
typeof this.options.prettify?this.options.prettify(a):this.prettify(a):a},prettify:function(a){return a.toString().replace(/(\d{1,3}(?=(?:\d\d\d)+(?!\d)))/g,"$1"+this.options.prettify_separator)},checkEdges:function(a,b){if(!this.options.force_edges)return this.toFixed(a);0>a?a=0:a>100-b&&(a=100-b);return this.toFixed(a)},validate:function(){var a=this.options,b=this.result,d=a.values,c=d.length,e,g;"string"===typeof a.min&&(a.min=+a.min);"string"===typeof a.max&&(a.max=+a.max);"string"===typeof a.from&&
|
64 |
+
(a.from=+a.from);"string"===typeof a.to&&(a.to=+a.to);"string"===typeof a.step&&(a.step=+a.step);"string"===typeof a.from_min&&(a.from_min=+a.from_min);"string"===typeof a.from_max&&(a.from_max=+a.from_max);"string"===typeof a.to_min&&(a.to_min=+a.to_min);"string"===typeof a.to_max&&(a.to_max=+a.to_max);"string"===typeof a.keyboard_step&&(a.keyboard_step=+a.keyboard_step);"string"===typeof a.grid_num&&(a.grid_num=+a.grid_num);a.max<a.min&&(a.max=a.min);if(c)for(a.p_values=[],a.min=0,a.max=c-1,a.step=
|
65 |
+
1,a.grid_num=a.max,a.grid_snap=!0,g=0;g<c;g++)e=+d[g],isNaN(e)?e=d[g]:(d[g]=e,e=this._prettify(e)),a.p_values.push(e);if("number"!==typeof a.from||isNaN(a.from))a.from=a.min;if("number"!==typeof a.to||isNaN(a.from))a.to=a.max;if("single"===a.type)a.from<a.min&&(a.from=a.min),a.from>a.max&&(a.from=a.max);else{if(a.from<a.min||a.from>a.max)a.from=a.min;if(a.to>a.max||a.to<a.min)a.to=a.max;a.from>a.to&&(a.from=a.to)}if("number"!==typeof a.step||isNaN(a.step)||!a.step||0>a.step)a.step=1;if("number"!==
|
66 |
+
typeof a.keyboard_step||isNaN(a.keyboard_step)||!a.keyboard_step||0>a.keyboard_step)a.keyboard_step=5;"number"===typeof a.from_min&&a.from<a.from_min&&(a.from=a.from_min);"number"===typeof a.from_max&&a.from>a.from_max&&(a.from=a.from_max);"number"===typeof a.to_min&&a.to<a.to_min&&(a.to=a.to_min);"number"===typeof a.to_max&&a.from>a.to_max&&(a.to=a.to_max);if(b){b.min!==a.min&&(b.min=a.min);b.max!==a.max&&(b.max=a.max);if(b.from<b.min||b.from>b.max)b.from=a.from;if(b.to<b.min||b.to>b.max)b.to=a.to}if("number"!==
|
67 |
+
typeof a.min_interval||isNaN(a.min_interval)||!a.min_interval||0>a.min_interval)a.min_interval=0;if("number"!==typeof a.max_interval||isNaN(a.max_interval)||!a.max_interval||0>a.max_interval)a.max_interval=0;a.min_interval&&a.min_interval>a.max-a.min&&(a.min_interval=a.max-a.min);a.max_interval&&a.max_interval>a.max-a.min&&(a.max_interval=a.max-a.min)},decorate:function(a,b){var d="",c=this.options;c.prefix&&(d+=c.prefix);d+=a;c.max_postfix&&(c.values.length&&a===c.p_values[c.max]?(d+=c.max_postfix,
|
68 |
+
c.postfix&&(d+=" ")):b===c.max&&(d+=c.max_postfix,c.postfix&&(d+=" ")));c.postfix&&(d+=c.postfix);return d},updateFrom:function(){this.result.from=this.options.from;this.result.from_percent=this.convertToPercent(this.result.from);this.options.values&&(this.result.from_value=this.options.values[this.result.from])},updateTo:function(){this.result.to=this.options.to;this.result.to_percent=this.convertToPercent(this.result.to);this.options.values&&(this.result.to_value=this.options.values[this.result.to])},
|
69 |
+
updateResult:function(){this.result.min=this.options.min;this.result.max=this.options.max;this.updateFrom();this.updateTo()},appendGrid:function(){if(this.options.grid){var a=this.options,b,d;b=a.max-a.min;var c=a.grid_num,e=0,g=0,f=4,k,h,m=0,n="";this.calcGridMargin();a.grid_snap?(c=b/a.step,e=this.toFixed(a.step/(b/100))):e=this.toFixed(100/c);4<c&&(f=3);7<c&&(f=2);14<c&&(f=1);28<c&&(f=0);for(b=0;b<c+1;b++){k=f;g=this.toFixed(e*b);100<g&&(g=100,k-=2,0>k&&(k=0));this.coords.big[b]=g;h=(g-e*(b-1))/
|
70 |
+
(k+1);for(d=1;d<=k&&0!==g;d++)m=this.toFixed(g-h*d),n+='<span class="irs-grid-pol small" style="left: '+m+'%"></span>';n+='<span class="irs-grid-pol" style="left: '+g+'%"></span>';m=this.convertToValue(g);m=a.values.length?a.p_values[m]:this._prettify(m);n+='<span class="irs-grid-text js-grid-text-'+b+'" style="left: '+g+'%">'+m+"</span>"}this.coords.big_num=Math.ceil(c+1);this.$cache.cont.addClass("irs-with-grid");this.$cache.grid.html(n);this.cacheGridLabels()}},cacheGridLabels:function(){var a,
|
71 |
+
b,d=this.coords.big_num;for(b=0;b<d;b++)a=this.$cache.grid.find(".js-grid-text-"+b),this.$cache.grid_labels.push(a);this.calcGridLabels()},calcGridLabels:function(){var a,b;b=[];var d=[],c=this.coords.big_num;for(a=0;a<c;a++)this.coords.big_w[a]=this.$cache.grid_labels[a].outerWidth(!1),this.coords.big_p[a]=this.toFixed(this.coords.big_w[a]/this.coords.w_rs*100),this.coords.big_x[a]=this.toFixed(this.coords.big_p[a]/2),b[a]=this.toFixed(this.coords.big[a]-this.coords.big_x[a]),d[a]=this.toFixed(b[a]+
|
72 |
+
this.coords.big_p[a]);this.options.force_edges&&(b[0]<-this.coords.grid_gap&&(b[0]=-this.coords.grid_gap,d[0]=this.toFixed(b[0]+this.coords.big_p[0]),this.coords.big_x[0]=this.coords.grid_gap),d[c-1]>100+this.coords.grid_gap&&(d[c-1]=100+this.coords.grid_gap,b[c-1]=this.toFixed(d[c-1]-this.coords.big_p[c-1]),this.coords.big_x[c-1]=this.toFixed(this.coords.big_p[c-1]-this.coords.grid_gap)));this.calcGridCollision(2,b,d);this.calcGridCollision(4,b,d);for(a=0;a<c;a++)b=this.$cache.grid_labels[a][0],
|
73 |
+
b.style.marginLeft=-this.coords.big_x[a]+"%"},calcGridCollision:function(a,b,d){var c,e,g,f=this.coords.big_num;for(c=0;c<f;c+=a){e=c+a/2;if(e>=f)break;g=this.$cache.grid_labels[e][0];g.style.visibility=d[c]<=b[e]?"visible":"hidden"}},calcGridMargin:function(){this.options.grid_margin&&(this.coords.w_rs=this.$cache.rs.outerWidth(!1),this.coords.w_rs&&(this.coords.w_handle="single"===this.options.type?this.$cache.s_single.outerWidth(!1):this.$cache.s_from.outerWidth(!1),this.coords.p_handle=this.toFixed(this.coords.w_handle/
|
74 |
+
this.coords.w_rs*100),this.coords.grid_gap=this.toFixed(this.coords.p_handle/2-.1),this.$cache.grid[0].style.width=this.toFixed(100-this.coords.p_handle)+"%",this.$cache.grid[0].style.left=this.coords.grid_gap+"%"))},update:function(a){this.input&&(this.is_update=!0,this.options.from=this.result.from,this.options.to=this.result.to,this.options=f.extend(this.options,a),this.validate(),this.updateResult(a),this.toggleInput(),this.remove(),this.init(!0))},reset:function(){this.input&&(this.updateResult(),
|
75 |
+
this.update())},destroy:function(){this.input&&(this.toggleInput(),this.$cache.input.prop("readonly",!1),f.data(this.input,"ionRangeSlider",null),this.remove(),this.options=this.input=null)}};f.fn.ionRangeSlider=function(a){return this.each(function(){f.data(this,"ionRangeSlider")||f.data(this,"ionRangeSlider",new q(this,a,u++))})};(function(){for(var a=0,b=["ms","moz","webkit","o"],d=0;d<b.length&&!h.requestAnimationFrame;++d)h.requestAnimationFrame=h[b[d]+"RequestAnimationFrame"],h.cancelAnimationFrame=
|
76 |
+
h[b[d]+"CancelAnimationFrame"]||h[b[d]+"CancelRequestAnimationFrame"];h.requestAnimationFrame||(h.requestAnimationFrame=function(b,d){var g=(new Date).getTime(),f=Math.max(0,16-(g-a)),k=h.setTimeout(function(){b(g+f)},f);a=g+f;return k});h.cancelAnimationFrame||(h.cancelAnimationFrame=function(a){clearTimeout(a)})})()})(jQuery,document,window,navigator);
|
framework/includes/option-types/rgba-color-picker/static/js/scripts.js
CHANGED
@@ -272,8 +272,8 @@ jQuery(function($){
|
|
272 |
|
273 |
helpers.updatePreview($input, $input.val());
|
274 |
|
275 |
-
$input.addClass('
|
276 |
});
|
277 |
});
|
278 |
|
279 |
-
});
|
272 |
|
273 |
helpers.updatePreview($input, $input.val());
|
274 |
|
275 |
+
$input.addClass('initialized');
|
276 |
});
|
277 |
});
|
278 |
|
279 |
+
});
|
framework/includes/option-types/slider/class-fw-option-type-short-slider.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php if ( ! defined( 'FW' ) ) {
|
2 |
+
die( 'Forbidden' );
|
3 |
+
}
|
4 |
+
|
5 |
+
class FW_Option_Type_Slider_Short extends FW_Option_Type_Slider {
|
6 |
+
public function get_type() {
|
7 |
+
return 'short-slider';
|
8 |
+
}
|
9 |
+
|
10 |
+
protected function _render( $id, $option, $data ) {
|
11 |
+
$option['attr']['class'] .= ' short-slider fw-option-type-slider';
|
12 |
+
|
13 |
+
return parent::_render( $id, $option, $data );
|
14 |
+
}
|
15 |
+
}
|
16 |
+
|
17 |
+
FW_Option_Type::register( 'FW_Option_Type_Slider_Short' );
|
framework/includes/option-types/slider/class-fw-option-type-slider.php
CHANGED
@@ -8,6 +8,15 @@
|
|
8 |
*/
|
9 |
class FW_Option_Type_Slider extends FW_Option_Type {
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
/**
|
12 |
* @internal
|
13 |
* {@inheritdoc}
|
@@ -15,35 +24,35 @@ class FW_Option_Type_Slider extends FW_Option_Type {
|
|
15 |
protected function _enqueue_static( $id, $option, $data ) {
|
16 |
{
|
17 |
wp_enqueue_style(
|
18 |
-
'fw-option-' . $this->
|
19 |
-
fw_get_framework_directory_uri( '/includes/option-types/' . $this->
|
20 |
-
|
21 |
);
|
22 |
|
23 |
wp_enqueue_script(
|
24 |
-
'fw-option-' . $this->
|
25 |
-
fw_get_framework_directory_uri( '/includes/option-types/' . $this->
|
26 |
array( 'jquery', 'fw-moment' ),
|
27 |
-
|
28 |
);
|
29 |
}
|
30 |
|
31 |
wp_enqueue_style(
|
32 |
-
'fw-option-' . $this->
|
33 |
-
fw_get_framework_directory_uri( '/includes/option-types/' . $this->
|
34 |
fw()->manifest->get_version()
|
35 |
);
|
36 |
|
37 |
wp_enqueue_script(
|
38 |
-
'fw-option-' . $this->
|
39 |
-
fw_get_framework_directory_uri( '/includes/option-types/' . $this->
|
40 |
-
array( 'jquery', 'fw-events', 'underscore', 'fw-option-' . $this->
|
41 |
fw()->manifest->get_version()
|
42 |
);
|
43 |
}
|
44 |
|
45 |
public function get_type() {
|
46 |
-
return
|
47 |
}
|
48 |
|
49 |
/**
|
@@ -61,7 +70,7 @@ class FW_Option_Type_Slider extends FW_Option_Type {
|
|
61 |
$this->default_properties($option['properties'])
|
62 |
);
|
63 |
|
64 |
-
return fw_render_view( fw_get_framework_directory( '/includes/option-types/' . $this->
|
65 |
'id' => $id,
|
66 |
'option' => $option,
|
67 |
'data' => $data,
|
@@ -74,6 +83,10 @@ class FW_Option_Type_Slider extends FW_Option_Type {
|
|
74 |
'min' => 0,
|
75 |
'max' => 100,
|
76 |
'step' => 1,
|
|
|
|
|
|
|
|
|
77 |
), $properties);
|
78 |
}
|
79 |
|
8 |
*/
|
9 |
class FW_Option_Type_Slider extends FW_Option_Type {
|
10 |
|
11 |
+
/**
|
12 |
+
* This class is extended by 'short-slider' option type
|
13 |
+
* but the type here should be this
|
14 |
+
* @return string
|
15 |
+
*/
|
16 |
+
private function _get_type() {
|
17 |
+
return 'slider';
|
18 |
+
}
|
19 |
+
|
20 |
/**
|
21 |
* @internal
|
22 |
* {@inheritdoc}
|
24 |
protected function _enqueue_static( $id, $option, $data ) {
|
25 |
{
|
26 |
wp_enqueue_style(
|
27 |
+
'fw-option-' . $this->_get_type() . 'ion-range-slider',
|
28 |
+
fw_get_framework_directory_uri( '/includes/option-types/' . $this->_get_type() . '/static/libs/ion-range-slider/ion.rangeSlider.css' ),
|
29 |
+
fw()->manifest->get_version()
|
30 |
);
|
31 |
|
32 |
wp_enqueue_script(
|
33 |
+
'fw-option-' . $this->_get_type() . 'ion-range-slider',
|
34 |
+
fw_get_framework_directory_uri( '/includes/option-types/' . $this->_get_type() . '/static/libs/ion-range-slider/ion.rangeSlider.min.js' ),
|
35 |
array( 'jquery', 'fw-moment' ),
|
36 |
+
fw()->manifest->get_version()
|
37 |
);
|
38 |
}
|
39 |
|
40 |
wp_enqueue_style(
|
41 |
+
'fw-option-' . $this->_get_type(),
|
42 |
+
fw_get_framework_directory_uri( '/includes/option-types/' . $this->_get_type() . '/static/css/styles.css' ),
|
43 |
fw()->manifest->get_version()
|
44 |
);
|
45 |
|
46 |
wp_enqueue_script(
|
47 |
+
'fw-option-' . $this->_get_type(),
|
48 |
+
fw_get_framework_directory_uri( '/includes/option-types/' . $this->_get_type() . '/static/js/scripts.js' ),
|
49 |
+
array( 'jquery', 'fw-events', 'underscore', 'fw-option-' . $this->_get_type() . 'ion-range-slider' ),
|
50 |
fw()->manifest->get_version()
|
51 |
);
|
52 |
}
|
53 |
|
54 |
public function get_type() {
|
55 |
+
return $this->_get_type();
|
56 |
}
|
57 |
|
58 |
/**
|
70 |
$this->default_properties($option['properties'])
|
71 |
);
|
72 |
|
73 |
+
return fw_render_view( fw_get_framework_directory( '/includes/option-types/' . $this->_get_type() . '/view.php' ), array(
|
74 |
'id' => $id,
|
75 |
'option' => $option,
|
76 |
'data' => $data,
|
83 |
'min' => 0,
|
84 |
'max' => 100,
|
85 |
'step' => 1,
|
86 |
+
/**
|
87 |
+
* For large ranges, this will create https://static.md/6340ebf52a36255649f10b3d0dff3b1c.png
|
88 |
+
*/
|
89 |
+
'grid_snap' => false,
|
90 |
), $properties);
|
91 |
}
|
92 |
|
framework/includes/option-types/slider/static/css/styles.css
CHANGED
@@ -1,3 +1,7 @@
|
|
|
|
|
|
|
|
|
|
1 |
.fw-option-type-slider .irs {
|
2 |
height: 30px;
|
3 |
}
|
1 |
+
.fw-option-type-slider.short-slider {
|
2 |
+
max-width: 280px;
|
3 |
+
}
|
4 |
+
|
5 |
.fw-option-type-slider .irs {
|
6 |
height: 30px;
|
7 |
}
|
framework/includes/option-types/slider/static/js/scripts.js
CHANGED
@@ -14,10 +14,10 @@
|
|
14 |
};
|
15 |
|
16 |
fwEvents.on('fw:options:init', function (data) {
|
17 |
-
data.$elements.find('.fw-option-type-slider').each(function () {
|
18 |
var options = JSON.parse($(this).attr('data-fw-irs-options'));
|
19 |
var slider = $(this).find('.fw-irs-range-slider').ionRangeSlider(_.defaults(options, defaults));
|
20 |
-
});
|
21 |
});
|
22 |
|
23 |
})(jQuery, fwEvents);
|
14 |
};
|
15 |
|
16 |
fwEvents.on('fw:options:init', function (data) {
|
17 |
+
data.$elements.find('.fw-option-type-slider:not(.initialized)').each(function () {
|
18 |
var options = JSON.parse($(this).attr('data-fw-irs-options'));
|
19 |
var slider = $(this).find('.fw-irs-range-slider').ionRangeSlider(_.defaults(options, defaults));
|
20 |
+
}).addClass('initialized');
|
21 |
});
|
22 |
|
23 |
})(jQuery, fwEvents);
|
framework/includes/option-types/slider/static/libs/ion-range-slider/ion.rangeSlider.min.js
CHANGED
@@ -1,66 +1,76 @@
|
|
1 |
-
// Ion.RangeSlider | version 2.
|
2 |
-
(function(
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
this
|
12 |
-
this.$cache.
|
13 |
-
this.$cache.cont.find(".
|
14 |
-
this.$cache.cont.
|
15 |
-
this
|
16 |
-
this.
|
17 |
-
this.
|
18 |
-
this.plugin_count
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
this.
|
23 |
-
this.
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
this.
|
29 |
-
|
30 |
-
this.
|
31 |
-
this.
|
32 |
-
|
33 |
-
this.coords.
|
34 |
-
this.
|
35 |
-
this.coords.
|
36 |
-
|
37 |
-
|
38 |
-
this
|
39 |
-
this
|
40 |
-
this.
|
41 |
-
this
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
(
|
50 |
-
this.
|
51 |
-
b
|
52 |
-
a=this.
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
a.
|
58 |
-
|
59 |
-
this.
|
60 |
-
(
|
61 |
-
this
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Ion.RangeSlider | version 2.1.2 | https://github.com/IonDen/ion.rangeSlider
|
2 |
+
;(function(f,r,h,t,v){var u=0,p=function(){var a=t.userAgent,b=/msie\s\d+/i;return 0<a.search(b)&&(a=b.exec(a).toString(),a=a.split(" ")[1],9>a)?(f("html").addClass("lt-ie9"),!0):!1}();Function.prototype.bind||(Function.prototype.bind=function(a){var b=this,d=[].slice;if("function"!=typeof b)throw new TypeError;var c=d.call(arguments,1),e=function(){if(this instanceof e){var g=function(){};g.prototype=b.prototype;var g=new g,l=b.apply(g,c.concat(d.call(arguments)));return Object(l)===l?l:g}return b.apply(a,
|
3 |
+
c.concat(d.call(arguments)))};return e});Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){var d;if(null==this)throw new TypeError('"this" is null or not defined');var c=Object(this),e=c.length>>>0;if(0===e)return-1;d=+b||0;Infinity===Math.abs(d)&&(d=0);if(d>=e)return-1;for(d=Math.max(0<=d?d:e-Math.abs(d),0);d<e;){if(d in c&&c[d]===a)return d;d++}return-1});var q=function(a,b,d){this.VERSION="2.1.2";this.input=a;this.plugin_count=d;this.old_to=this.old_from=this.update_tm=this.calc_count=
|
4 |
+
this.current_plugin=0;this.raf_id=this.old_min_interval=null;this.is_update=this.is_key=this.no_diapason=this.force_redraw=this.dragging=!1;this.is_start=!0;this.is_click=this.is_resize=this.is_active=this.is_finish=!1;this.$cache={win:f(h),body:f(r.body),input:f(a),cont:null,rs:null,min:null,max:null,from:null,to:null,single:null,bar:null,line:null,s_single:null,s_from:null,s_to:null,shad_single:null,shad_from:null,shad_to:null,edge:null,grid:null,grid_labels:[]};this.coords={x_gap:0,x_pointer:0,
|
5 |
+
w_rs:0,w_rs_old:0,w_handle:0,p_gap:0,p_gap_left:0,p_gap_right:0,p_step:0,p_pointer:0,p_handle:0,p_single_fake:0,p_single_real:0,p_from_fake:0,p_from_real:0,p_to_fake:0,p_to_real:0,p_bar_x:0,p_bar_w:0,grid_gap:0,big_num:0,big:[],big_w:[],big_p:[],big_x:[]};this.labels={w_min:0,w_max:0,w_from:0,w_to:0,w_single:0,p_min:0,p_max:0,p_from_fake:0,p_from_left:0,p_to_fake:0,p_to_left:0,p_single_fake:0,p_single_left:0};var c=this.$cache.input;a=c.prop("value");var e;d={type:"single",min:10,max:100,from:null,
|
6 |
+
to:null,step:1,min_interval:0,max_interval:0,drag_interval:!1,values:[],p_values:[],from_fixed:!1,from_min:null,from_max:null,from_shadow:!1,to_fixed:!1,to_min:null,to_max:null,to_shadow:!1,prettify_enabled:!0,prettify_separator:" ",prettify:null,force_edges:!1,keyboard:!1,keyboard_step:5,grid:!1,grid_margin:!0,grid_num:4,grid_snap:!1,hide_min_max:!1,hide_from_to:!1,prefix:"",postfix:"",max_postfix:"",decorate_both:!0,values_separator:" \u2014 ",input_values_separator:";",disable:!1,onStart:null,
|
7 |
+
onChange:null,onFinish:null,onUpdate:null};c={type:c.data("type"),min:c.data("min"),max:c.data("max"),from:c.data("from"),to:c.data("to"),step:c.data("step"),min_interval:c.data("minInterval"),max_interval:c.data("maxInterval"),drag_interval:c.data("dragInterval"),values:c.data("values"),from_fixed:c.data("fromFixed"),from_min:c.data("fromMin"),from_max:c.data("fromMax"),from_shadow:c.data("fromShadow"),to_fixed:c.data("toFixed"),to_min:c.data("toMin"),to_max:c.data("toMax"),to_shadow:c.data("toShadow"),
|
8 |
+
prettify_enabled:c.data("prettifyEnabled"),prettify_separator:c.data("prettifySeparator"),force_edges:c.data("forceEdges"),keyboard:c.data("keyboard"),keyboard_step:c.data("keyboardStep"),grid:c.data("grid"),grid_margin:c.data("gridMargin"),grid_num:c.data("gridNum"),grid_snap:c.data("gridSnap"),hide_min_max:c.data("hideMinMax"),hide_from_to:c.data("hideFromTo"),prefix:c.data("prefix"),postfix:c.data("postfix"),max_postfix:c.data("maxPostfix"),decorate_both:c.data("decorateBoth"),values_separator:c.data("valuesSeparator"),
|
9 |
+
input_values_separator:c.data("inputValuesSeparator"),disable:c.data("disable")};c.values=c.values&&c.values.split(",");for(e in c)c.hasOwnProperty(e)&&(c[e]||0===c[e]||delete c[e]);a&&(a=a.split(c.input_values_separator||b.input_values_separator||";"),a[0]&&a[0]==+a[0]&&(a[0]=+a[0]),a[1]&&a[1]==+a[1]&&(a[1]=+a[1]),b&&b.values&&b.values.length?(d.from=a[0]&&b.values.indexOf(a[0]),d.to=a[1]&&b.values.indexOf(a[1])):(d.from=a[0]&&+a[0],d.to=a[1]&&+a[1]));f.extend(d,b);f.extend(d,c);this.options=d;this.validate();
|
10 |
+
this.result={input:this.$cache.input,slider:null,min:this.options.min,max:this.options.max,from:this.options.from,from_percent:0,from_value:null,to:this.options.to,to_percent:0,to_value:null};this.init()};q.prototype={init:function(a){this.no_diapason=!1;this.coords.p_step=this.convertToPercent(this.options.step,!0);this.target="base";this.toggleInput();this.append();this.setMinMax();a?(this.force_redraw=!0,this.calc(!0),this.callOnUpdate()):(this.force_redraw=!0,this.calc(!0),this.callOnStart());
|
11 |
+
this.updateScene()},append:function(){this.$cache.input.before('<span class="irs js-irs-'+this.plugin_count+'"></span>');this.$cache.input.prop("readonly",!0);this.$cache.cont=this.$cache.input.prev();this.result.slider=this.$cache.cont;this.$cache.cont.html('<span class="irs"><span class="irs-line" tabindex="-1"><span class="irs-line-left"></span><span class="irs-line-mid"></span><span class="irs-line-right"></span></span><span class="irs-min">0</span><span class="irs-max">1</span><span class="irs-from">0</span><span class="irs-to">0</span><span class="irs-single">0</span></span><span class="irs-grid"></span><span class="irs-bar"></span>');
|
12 |
+
this.$cache.rs=this.$cache.cont.find(".irs");this.$cache.min=this.$cache.cont.find(".irs-min");this.$cache.max=this.$cache.cont.find(".irs-max");this.$cache.from=this.$cache.cont.find(".irs-from");this.$cache.to=this.$cache.cont.find(".irs-to");this.$cache.single=this.$cache.cont.find(".irs-single");this.$cache.bar=this.$cache.cont.find(".irs-bar");this.$cache.line=this.$cache.cont.find(".irs-line");this.$cache.grid=this.$cache.cont.find(".irs-grid");"single"===this.options.type?(this.$cache.cont.append('<span class="irs-bar-edge"></span><span class="irs-shadow shadow-single"></span><span class="irs-slider single"></span>'),
|
13 |
+
this.$cache.edge=this.$cache.cont.find(".irs-bar-edge"),this.$cache.s_single=this.$cache.cont.find(".single"),this.$cache.from[0].style.visibility="hidden",this.$cache.to[0].style.visibility="hidden",this.$cache.shad_single=this.$cache.cont.find(".shadow-single")):(this.$cache.cont.append('<span class="irs-shadow shadow-from"></span><span class="irs-shadow shadow-to"></span><span class="irs-slider from"></span><span class="irs-slider to"></span>'),this.$cache.s_from=this.$cache.cont.find(".from"),
|
14 |
+
this.$cache.s_to=this.$cache.cont.find(".to"),this.$cache.shad_from=this.$cache.cont.find(".shadow-from"),this.$cache.shad_to=this.$cache.cont.find(".shadow-to"),this.setTopHandler());this.options.hide_from_to&&(this.$cache.from[0].style.display="none",this.$cache.to[0].style.display="none",this.$cache.single[0].style.display="none");this.appendGrid();this.options.disable?(this.appendDisableMask(),this.$cache.input[0].disabled=!0):(this.$cache.cont.removeClass("irs-disabled"),this.$cache.input[0].disabled=
|
15 |
+
!1,this.bindEvents());this.options.drag_interval&&(this.$cache.bar[0].style.cursor="ew-resize")},setTopHandler:function(){var a=this.options.max,b=this.options.to;this.options.from>this.options.min&&b===a?this.$cache.s_from.addClass("type_last"):b<a&&this.$cache.s_to.addClass("type_last")},changeLevel:function(a){switch(a){case "single":this.coords.p_gap=this.toFixed(this.coords.p_pointer-this.coords.p_single_fake);break;case "from":this.coords.p_gap=this.toFixed(this.coords.p_pointer-this.coords.p_from_fake);
|
16 |
+
this.$cache.s_from.addClass("state_hover");this.$cache.s_from.addClass("type_last");this.$cache.s_to.removeClass("type_last");break;case "to":this.coords.p_gap=this.toFixed(this.coords.p_pointer-this.coords.p_to_fake);this.$cache.s_to.addClass("state_hover");this.$cache.s_to.addClass("type_last");this.$cache.s_from.removeClass("type_last");break;case "both":this.coords.p_gap_left=this.toFixed(this.coords.p_pointer-this.coords.p_from_fake),this.coords.p_gap_right=this.toFixed(this.coords.p_to_fake-
|
17 |
+
this.coords.p_pointer),this.$cache.s_to.removeClass("type_last"),this.$cache.s_from.removeClass("type_last")}},appendDisableMask:function(){this.$cache.cont.append('<span class="irs-disable-mask"></span>');this.$cache.cont.addClass("irs-disabled")},remove:function(){this.$cache.cont.remove();this.$cache.cont=null;this.$cache.line.off("keydown.irs_"+this.plugin_count);this.$cache.body.off("touchmove.irs_"+this.plugin_count);this.$cache.body.off("mousemove.irs_"+this.plugin_count);this.$cache.win.off("touchend.irs_"+
|
18 |
+
this.plugin_count);this.$cache.win.off("mouseup.irs_"+this.plugin_count);p&&(this.$cache.body.off("mouseup.irs_"+this.plugin_count),this.$cache.body.off("mouseleave.irs_"+this.plugin_count));this.$cache.grid_labels=[];this.coords.big=[];this.coords.big_w=[];this.coords.big_p=[];this.coords.big_x=[];cancelAnimationFrame(this.raf_id)},bindEvents:function(){if(!this.no_diapason){this.$cache.body.on("touchmove.irs_"+this.plugin_count,this.pointerMove.bind(this));this.$cache.body.on("mousemove.irs_"+this.plugin_count,
|
19 |
+
this.pointerMove.bind(this));this.$cache.win.on("touchend.irs_"+this.plugin_count,this.pointerUp.bind(this));this.$cache.win.on("mouseup.irs_"+this.plugin_count,this.pointerUp.bind(this));this.$cache.line.on("touchstart.irs_"+this.plugin_count,this.pointerClick.bind(this,"click"));this.$cache.line.on("mousedown.irs_"+this.plugin_count,this.pointerClick.bind(this,"click"));this.options.drag_interval&&"double"===this.options.type?(this.$cache.bar.on("touchstart.irs_"+this.plugin_count,this.pointerDown.bind(this,
|
20 |
+
"both")),this.$cache.bar.on("mousedown.irs_"+this.plugin_count,this.pointerDown.bind(this,"both"))):(this.$cache.bar.on("touchstart.irs_"+this.plugin_count,this.pointerClick.bind(this,"click")),this.$cache.bar.on("mousedown.irs_"+this.plugin_count,this.pointerClick.bind(this,"click")));"single"===this.options.type?(this.$cache.single.on("touchstart.irs_"+this.plugin_count,this.pointerDown.bind(this,"single")),this.$cache.s_single.on("touchstart.irs_"+this.plugin_count,this.pointerDown.bind(this,"single")),
|
21 |
+
this.$cache.shad_single.on("touchstart.irs_"+this.plugin_count,this.pointerClick.bind(this,"click")),this.$cache.single.on("mousedown.irs_"+this.plugin_count,this.pointerDown.bind(this,"single")),this.$cache.s_single.on("mousedown.irs_"+this.plugin_count,this.pointerDown.bind(this,"single")),this.$cache.edge.on("mousedown.irs_"+this.plugin_count,this.pointerClick.bind(this,"click")),this.$cache.shad_single.on("mousedown.irs_"+this.plugin_count,this.pointerClick.bind(this,"click"))):(this.$cache.single.on("touchstart.irs_"+
|
22 |
+
this.plugin_count,this.pointerDown.bind(this,null)),this.$cache.single.on("mousedown.irs_"+this.plugin_count,this.pointerDown.bind(this,null)),this.$cache.from.on("touchstart.irs_"+this.plugin_count,this.pointerDown.bind(this,"from")),this.$cache.s_from.on("touchstart.irs_"+this.plugin_count,this.pointerDown.bind(this,"from")),this.$cache.to.on("touchstart.irs_"+this.plugin_count,this.pointerDown.bind(this,"to")),this.$cache.s_to.on("touchstart.irs_"+this.plugin_count,this.pointerDown.bind(this,"to")),
|
23 |
+
this.$cache.shad_from.on("touchstart.irs_"+this.plugin_count,this.pointerClick.bind(this,"click")),this.$cache.shad_to.on("touchstart.irs_"+this.plugin_count,this.pointerClick.bind(this,"click")),this.$cache.from.on("mousedown.irs_"+this.plugin_count,this.pointerDown.bind(this,"from")),this.$cache.s_from.on("mousedown.irs_"+this.plugin_count,this.pointerDown.bind(this,"from")),this.$cache.to.on("mousedown.irs_"+this.plugin_count,this.pointerDown.bind(this,"to")),this.$cache.s_to.on("mousedown.irs_"+
|
24 |
+
this.plugin_count,this.pointerDown.bind(this,"to")),this.$cache.shad_from.on("mousedown.irs_"+this.plugin_count,this.pointerClick.bind(this,"click")),this.$cache.shad_to.on("mousedown.irs_"+this.plugin_count,this.pointerClick.bind(this,"click")));if(this.options.keyboard)this.$cache.line.on("keydown.irs_"+this.plugin_count,this.key.bind(this,"keyboard"));p&&(this.$cache.body.on("mouseup.irs_"+this.plugin_count,this.pointerUp.bind(this)),this.$cache.body.on("mouseleave.irs_"+this.plugin_count,this.pointerUp.bind(this)))}},
|
25 |
+
pointerMove:function(a){this.dragging&&(this.coords.x_pointer=(a.pageX||a.originalEvent.touches&&a.originalEvent.touches[0].pageX)-this.coords.x_gap,this.calc())},pointerUp:function(a){if(this.current_plugin===this.plugin_count&&this.is_active){this.is_active=!1;this.$cache.cont.find(".state_hover").removeClass("state_hover");this.force_redraw=!0;p&&f("*").prop("unselectable",!1);this.updateScene();this.restoreOriginalMinInterval();if(f.contains(this.$cache.cont[0],a.target)||this.dragging)this.is_finish=
|
26 |
+
!0,this.callOnFinish();this.dragging=!1}},pointerDown:function(a,b){b.preventDefault();var d=b.pageX||b.originalEvent.touches&&b.originalEvent.touches[0].pageX;2!==b.button&&("both"===a&&this.setTempMinInterval(),a||(a=this.target),this.current_plugin=this.plugin_count,this.target=a,this.dragging=this.is_active=!0,this.coords.x_gap=this.$cache.rs.offset().left,this.coords.x_pointer=d-this.coords.x_gap,this.calcPointerPercent(),this.changeLevel(a),p&&f("*").prop("unselectable",!0),this.$cache.line.trigger("focus"),
|
27 |
+
this.updateScene())},pointerClick:function(a,b){b.preventDefault();var d=b.pageX||b.originalEvent.touches&&b.originalEvent.touches[0].pageX;2!==b.button&&(this.current_plugin=this.plugin_count,this.target=a,this.is_click=!0,this.coords.x_gap=this.$cache.rs.offset().left,this.coords.x_pointer=+(d-this.coords.x_gap).toFixed(),this.force_redraw=!0,this.calc(),this.$cache.line.trigger("focus"))},key:function(a,b){if(!(this.current_plugin!==this.plugin_count||b.altKey||b.ctrlKey||b.shiftKey||b.metaKey)){switch(b.which){case 83:case 65:case 40:case 37:b.preventDefault();
|
28 |
+
this.moveByKey(!1);break;case 87:case 68:case 38:case 39:b.preventDefault(),this.moveByKey(!0)}return!0}},moveByKey:function(a){var b=this.coords.p_pointer,b=a?b+this.options.keyboard_step:b-this.options.keyboard_step;this.coords.x_pointer=this.toFixed(this.coords.w_rs/100*b);this.is_key=!0;this.calc()},setMinMax:function(){this.options&&(this.options.hide_min_max?(this.$cache.min[0].style.display="none",this.$cache.max[0].style.display="none"):(this.options.values.length?(this.$cache.min.html(this.decorate(this.options.p_values[this.options.min])),
|
29 |
+
this.$cache.max.html(this.decorate(this.options.p_values[this.options.max]))):(this.$cache.min.html(this.decorate(this._prettify(this.options.min),this.options.min)),this.$cache.max.html(this.decorate(this._prettify(this.options.max),this.options.max))),this.labels.w_min=this.$cache.min.outerWidth(!1),this.labels.w_max=this.$cache.max.outerWidth(!1)))},setTempMinInterval:function(){var a=this.result.to-this.result.from;null===this.old_min_interval&&(this.old_min_interval=this.options.min_interval);
|
30 |
+
this.options.min_interval=a},restoreOriginalMinInterval:function(){null!==this.old_min_interval&&(this.options.min_interval=this.old_min_interval,this.old_min_interval=null)},calc:function(a){if(this.options){this.calc_count++;if(10===this.calc_count||a)this.calc_count=0,this.coords.w_rs=this.$cache.rs.outerWidth(!1),this.calcHandlePercent();if(this.coords.w_rs){this.calcPointerPercent();a=this.getHandleX();"click"===this.target&&(this.coords.p_gap=this.coords.p_handle/2,a=this.getHandleX(),this.target=
|
31 |
+
this.options.drag_interval?"both_one":this.chooseHandle(a));switch(this.target){case "base":var b=(this.options.max-this.options.min)/100;a=(this.result.from-this.options.min)/b;b=(this.result.to-this.options.min)/b;this.coords.p_single_real=this.toFixed(a);this.coords.p_from_real=this.toFixed(a);this.coords.p_to_real=this.toFixed(b);this.coords.p_single_real=this.checkDiapason(this.coords.p_single_real,this.options.from_min,this.options.from_max);this.coords.p_from_real=this.checkDiapason(this.coords.p_from_real,
|
32 |
+
this.options.from_min,this.options.from_max);this.coords.p_to_real=this.checkDiapason(this.coords.p_to_real,this.options.to_min,this.options.to_max);this.coords.p_single_fake=this.convertToFakePercent(this.coords.p_single_real);this.coords.p_from_fake=this.convertToFakePercent(this.coords.p_from_real);this.coords.p_to_fake=this.convertToFakePercent(this.coords.p_to_real);this.target=null;break;case "single":if(this.options.from_fixed)break;this.coords.p_single_real=this.convertToRealPercent(a);this.coords.p_single_real=
|
33 |
+
this.calcWithStep(this.coords.p_single_real);this.coords.p_single_real=this.checkDiapason(this.coords.p_single_real,this.options.from_min,this.options.from_max);this.coords.p_single_fake=this.convertToFakePercent(this.coords.p_single_real);break;case "from":if(this.options.from_fixed)break;this.coords.p_from_real=this.convertToRealPercent(a);this.coords.p_from_real=this.calcWithStep(this.coords.p_from_real);this.coords.p_from_real>this.coords.p_to_real&&(this.coords.p_from_real=this.coords.p_to_real);
|
34 |
+
this.coords.p_from_real=this.checkDiapason(this.coords.p_from_real,this.options.from_min,this.options.from_max);this.coords.p_from_real=this.checkMinInterval(this.coords.p_from_real,this.coords.p_to_real,"from");this.coords.p_from_real=this.checkMaxInterval(this.coords.p_from_real,this.coords.p_to_real,"from");this.coords.p_from_fake=this.convertToFakePercent(this.coords.p_from_real);break;case "to":if(this.options.to_fixed)break;this.coords.p_to_real=this.convertToRealPercent(a);this.coords.p_to_real=
|
35 |
+
this.calcWithStep(this.coords.p_to_real);this.coords.p_to_real<this.coords.p_from_real&&(this.coords.p_to_real=this.coords.p_from_real);this.coords.p_to_real=this.checkDiapason(this.coords.p_to_real,this.options.to_min,this.options.to_max);this.coords.p_to_real=this.checkMinInterval(this.coords.p_to_real,this.coords.p_from_real,"to");this.coords.p_to_real=this.checkMaxInterval(this.coords.p_to_real,this.coords.p_from_real,"to");this.coords.p_to_fake=this.convertToFakePercent(this.coords.p_to_real);
|
36 |
+
break;case "both":if(this.options.from_fixed||this.options.to_fixed)break;a=this.toFixed(a+.1*this.coords.p_handle);this.coords.p_from_real=this.convertToRealPercent(a)-this.coords.p_gap_left;this.coords.p_from_real=this.calcWithStep(this.coords.p_from_real);this.coords.p_from_real=this.checkDiapason(this.coords.p_from_real,this.options.from_min,this.options.from_max);this.coords.p_from_real=this.checkMinInterval(this.coords.p_from_real,this.coords.p_to_real,"from");this.coords.p_from_fake=this.convertToFakePercent(this.coords.p_from_real);
|
37 |
+
this.coords.p_to_real=this.convertToRealPercent(a)+this.coords.p_gap_right;this.coords.p_to_real=this.calcWithStep(this.coords.p_to_real);this.coords.p_to_real=this.checkDiapason(this.coords.p_to_real,this.options.to_min,this.options.to_max);this.coords.p_to_real=this.checkMinInterval(this.coords.p_to_real,this.coords.p_from_real,"to");this.coords.p_to_fake=this.convertToFakePercent(this.coords.p_to_real);break;case "both_one":if(this.options.from_fixed||this.options.to_fixed)break;var d=this.convertToRealPercent(a);
|
38 |
+
a=this.result.to_percent-this.result.from_percent;var c=a/2,b=d-c,d=d+c;0>b&&(b=0,d=b+a);100<d&&(d=100,b=d-a);this.coords.p_from_real=this.calcWithStep(b);this.coords.p_from_real=this.checkDiapason(this.coords.p_from_real,this.options.from_min,this.options.from_max);this.coords.p_from_fake=this.convertToFakePercent(this.coords.p_from_real);this.coords.p_to_real=this.calcWithStep(d);this.coords.p_to_real=this.checkDiapason(this.coords.p_to_real,this.options.to_min,this.options.to_max);this.coords.p_to_fake=
|
39 |
+
this.convertToFakePercent(this.coords.p_to_real)}"single"===this.options.type?(this.coords.p_bar_x=this.coords.p_handle/2,this.coords.p_bar_w=this.coords.p_single_fake,this.result.from_percent=this.coords.p_single_real,this.result.from=this.convertToValue(this.coords.p_single_real),this.options.values.length&&(this.result.from_value=this.options.values[this.result.from])):(this.coords.p_bar_x=this.toFixed(this.coords.p_from_fake+this.coords.p_handle/2),this.coords.p_bar_w=this.toFixed(this.coords.p_to_fake-
|
40 |
+
this.coords.p_from_fake),this.result.from_percent=this.coords.p_from_real,this.result.from=this.convertToValue(this.coords.p_from_real),this.result.to_percent=this.coords.p_to_real,this.result.to=this.convertToValue(this.coords.p_to_real),this.options.values.length&&(this.result.from_value=this.options.values[this.result.from],this.result.to_value=this.options.values[this.result.to]));this.calcMinMax();this.calcLabels()}}},calcPointerPercent:function(){this.coords.w_rs?(0>this.coords.x_pointer||isNaN(this.coords.x_pointer)?
|
41 |
+
this.coords.x_pointer=0:this.coords.x_pointer>this.coords.w_rs&&(this.coords.x_pointer=this.coords.w_rs),this.coords.p_pointer=this.toFixed(this.coords.x_pointer/this.coords.w_rs*100)):this.coords.p_pointer=0},convertToRealPercent:function(a){return a/(100-this.coords.p_handle)*100},convertToFakePercent:function(a){return a/100*(100-this.coords.p_handle)},getHandleX:function(){var a=100-this.coords.p_handle,b=this.toFixed(this.coords.p_pointer-this.coords.p_gap);0>b?b=0:b>a&&(b=a);return b},calcHandlePercent:function(){this.coords.w_handle=
|
42 |
+
"single"===this.options.type?this.$cache.s_single.outerWidth(!1):this.$cache.s_from.outerWidth(!1);this.coords.p_handle=this.toFixed(this.coords.w_handle/this.coords.w_rs*100)},chooseHandle:function(a){return"single"===this.options.type?"single":a>=this.coords.p_from_real+(this.coords.p_to_real-this.coords.p_from_real)/2?this.options.to_fixed?"from":"to":this.options.from_fixed?"to":"from"},calcMinMax:function(){this.coords.w_rs&&(this.labels.p_min=this.labels.w_min/this.coords.w_rs*100,this.labels.p_max=
|
43 |
+
this.labels.w_max/this.coords.w_rs*100)},calcLabels:function(){this.coords.w_rs&&!this.options.hide_from_to&&("single"===this.options.type?(this.labels.w_single=this.$cache.single.outerWidth(!1),this.labels.p_single_fake=this.labels.w_single/this.coords.w_rs*100,this.labels.p_single_left=this.coords.p_single_fake+this.coords.p_handle/2-this.labels.p_single_fake/2):(this.labels.w_from=this.$cache.from.outerWidth(!1),this.labels.p_from_fake=this.labels.w_from/this.coords.w_rs*100,this.labels.p_from_left=
|
44 |
+
this.coords.p_from_fake+this.coords.p_handle/2-this.labels.p_from_fake/2,this.labels.p_from_left=this.toFixed(this.labels.p_from_left),this.labels.p_from_left=this.checkEdges(this.labels.p_from_left,this.labels.p_from_fake),this.labels.w_to=this.$cache.to.outerWidth(!1),this.labels.p_to_fake=this.labels.w_to/this.coords.w_rs*100,this.labels.p_to_left=this.coords.p_to_fake+this.coords.p_handle/2-this.labels.p_to_fake/2,this.labels.p_to_left=this.toFixed(this.labels.p_to_left),this.labels.p_to_left=
|
45 |
+
this.checkEdges(this.labels.p_to_left,this.labels.p_to_fake),this.labels.w_single=this.$cache.single.outerWidth(!1),this.labels.p_single_fake=this.labels.w_single/this.coords.w_rs*100,this.labels.p_single_left=(this.labels.p_from_left+this.labels.p_to_left+this.labels.p_to_fake)/2-this.labels.p_single_fake/2,this.labels.p_single_left=this.toFixed(this.labels.p_single_left)),this.labels.p_single_left=this.checkEdges(this.labels.p_single_left,this.labels.p_single_fake))},updateScene:function(){this.raf_id&&
|
46 |
+
(cancelAnimationFrame(this.raf_id),this.raf_id=null);clearTimeout(this.update_tm);this.update_tm=null;this.options&&(this.drawHandles(),this.is_active?this.raf_id=requestAnimationFrame(this.updateScene.bind(this)):this.update_tm=setTimeout(this.updateScene.bind(this),300))},drawHandles:function(){this.coords.w_rs=this.$cache.rs.outerWidth(!1);if(this.coords.w_rs){this.coords.w_rs!==this.coords.w_rs_old&&(this.target="base",this.is_resize=!0);if(this.coords.w_rs!==this.coords.w_rs_old||this.force_redraw)this.setMinMax(),
|
47 |
+
this.calc(!0),this.drawLabels(),this.options.grid&&(this.calcGridMargin(),this.calcGridLabels()),this.force_redraw=!0,this.coords.w_rs_old=this.coords.w_rs,this.drawShadow();if(this.coords.w_rs&&(this.dragging||this.force_redraw||this.is_key)){if(this.old_from!==this.result.from||this.old_to!==this.result.to||this.force_redraw||this.is_key){this.drawLabels();this.$cache.bar[0].style.left=this.coords.p_bar_x+"%";this.$cache.bar[0].style.width=this.coords.p_bar_w+"%";if("single"===this.options.type)this.$cache.s_single[0].style.left=
|
48 |
+
this.coords.p_single_fake+"%",this.$cache.single[0].style.left=this.labels.p_single_left+"%",this.options.values.length?this.$cache.input.prop("value",this.result.from_value):this.$cache.input.prop("value",this.result.from),this.$cache.input.data("from",this.result.from);else{this.$cache.s_from[0].style.left=this.coords.p_from_fake+"%";this.$cache.s_to[0].style.left=this.coords.p_to_fake+"%";if(this.old_from!==this.result.from||this.force_redraw)this.$cache.from[0].style.left=this.labels.p_from_left+
|
49 |
+
"%";if(this.old_to!==this.result.to||this.force_redraw)this.$cache.to[0].style.left=this.labels.p_to_left+"%";this.$cache.single[0].style.left=this.labels.p_single_left+"%";this.options.values.length?this.$cache.input.prop("value",this.result.from_value+this.options.input_values_separator+this.result.to_value):this.$cache.input.prop("value",this.result.from+this.options.input_values_separator+this.result.to);this.$cache.input.data("from",this.result.from);this.$cache.input.data("to",this.result.to)}this.old_from===
|
50 |
+
this.result.from&&this.old_to===this.result.to||this.is_start||this.$cache.input.trigger("change");this.old_from=this.result.from;this.old_to=this.result.to;this.is_resize||this.is_update||this.is_start||this.is_finish||this.callOnChange();if(this.is_key||this.is_click)this.is_click=this.is_key=!1,this.callOnFinish();this.is_finish=this.is_resize=this.is_update=!1}this.force_redraw=this.is_click=this.is_key=this.is_start=!1}}},drawLabels:function(){if(this.options){var a=this.options.values.length,
|
51 |
+
b=this.options.p_values,d;if(!this.options.hide_from_to)if("single"===this.options.type)a=a?this.decorate(b[this.result.from]):this.decorate(this._prettify(this.result.from),this.result.from),this.$cache.single.html(a),this.calcLabels(),this.$cache.min[0].style.visibility=this.labels.p_single_left<this.labels.p_min+1?"hidden":"visible",this.$cache.max[0].style.visibility=this.labels.p_single_left+this.labels.p_single_fake>100-this.labels.p_max-1?"hidden":"visible";else{a?(this.options.decorate_both?
|
52 |
+
(a=this.decorate(b[this.result.from]),a+=this.options.values_separator,a+=this.decorate(b[this.result.to])):a=this.decorate(b[this.result.from]+this.options.values_separator+b[this.result.to]),d=this.decorate(b[this.result.from]),b=this.decorate(b[this.result.to])):(this.options.decorate_both?(a=this.decorate(this._prettify(this.result.from),this.result.from),a+=this.options.values_separator,a+=this.decorate(this._prettify(this.result.to),this.result.to)):a=this.decorate(this._prettify(this.result.from)+
|
53 |
+
this.options.values_separator+this._prettify(this.result.to),this.result.to),d=this.decorate(this._prettify(this.result.from),this.result.from),b=this.decorate(this._prettify(this.result.to),this.result.to));this.$cache.single.html(a);this.$cache.from.html(d);this.$cache.to.html(b);this.calcLabels();b=Math.min(this.labels.p_single_left,this.labels.p_from_left);a=this.labels.p_single_left+this.labels.p_single_fake;d=this.labels.p_to_left+this.labels.p_to_fake;var c=Math.max(a,d);this.labels.p_from_left+
|
54 |
+
this.labels.p_from_fake>=this.labels.p_to_left?(this.$cache.from[0].style.visibility="hidden",this.$cache.to[0].style.visibility="hidden",this.$cache.single[0].style.visibility="visible",this.result.from===this.result.to?("from"===this.target?this.$cache.from[0].style.visibility="visible":"to"===this.target&&(this.$cache.to[0].style.visibility="visible"),this.$cache.single[0].style.visibility="hidden",c=d):(this.$cache.from[0].style.visibility="hidden",this.$cache.to[0].style.visibility="hidden",
|
55 |
+
this.$cache.single[0].style.visibility="visible",c=Math.max(a,d))):(this.$cache.from[0].style.visibility="visible",this.$cache.to[0].style.visibility="visible",this.$cache.single[0].style.visibility="hidden");this.$cache.min[0].style.visibility=b<this.labels.p_min+1?"hidden":"visible";this.$cache.max[0].style.visibility=c>100-this.labels.p_max-1?"hidden":"visible"}}},drawShadow:function(){var a=this.options,b=this.$cache,d="number"===typeof a.from_min&&!isNaN(a.from_min),c="number"===typeof a.from_max&&
|
56 |
+
!isNaN(a.from_max),e="number"===typeof a.to_min&&!isNaN(a.to_min),g="number"===typeof a.to_max&&!isNaN(a.to_max);"single"===a.type?a.from_shadow&&(d||c)?(d=this.convertToPercent(d?a.from_min:a.min),c=this.convertToPercent(c?a.from_max:a.max)-d,d=this.toFixed(d-this.coords.p_handle/100*d),c=this.toFixed(c-this.coords.p_handle/100*c),d+=this.coords.p_handle/2,b.shad_single[0].style.display="block",b.shad_single[0].style.left=d+"%",b.shad_single[0].style.width=c+"%"):b.shad_single[0].style.display="none":
|
57 |
+
(a.from_shadow&&(d||c)?(d=this.convertToPercent(d?a.from_min:a.min),c=this.convertToPercent(c?a.from_max:a.max)-d,d=this.toFixed(d-this.coords.p_handle/100*d),c=this.toFixed(c-this.coords.p_handle/100*c),d+=this.coords.p_handle/2,b.shad_from[0].style.display="block",b.shad_from[0].style.left=d+"%",b.shad_from[0].style.width=c+"%"):b.shad_from[0].style.display="none",a.to_shadow&&(e||g)?(e=this.convertToPercent(e?a.to_min:a.min),a=this.convertToPercent(g?a.to_max:a.max)-e,e=this.toFixed(e-this.coords.p_handle/
|
58 |
+
100*e),a=this.toFixed(a-this.coords.p_handle/100*a),e+=this.coords.p_handle/2,b.shad_to[0].style.display="block",b.shad_to[0].style.left=e+"%",b.shad_to[0].style.width=a+"%"):b.shad_to[0].style.display="none")},callOnStart:function(){if(this.options.onStart&&"function"===typeof this.options.onStart)this.options.onStart(this.result)},callOnChange:function(){if(this.options.onChange&&"function"===typeof this.options.onChange)this.options.onChange(this.result)},callOnFinish:function(){if(this.options.onFinish&&
|
59 |
+
"function"===typeof this.options.onFinish)this.options.onFinish(this.result)},callOnUpdate:function(){if(this.options.onUpdate&&"function"===typeof this.options.onUpdate)this.options.onUpdate(this.result)},toggleInput:function(){this.$cache.input.toggleClass("irs-hidden-input")},convertToPercent:function(a,b){var d=this.options.max-this.options.min;return d?this.toFixed((b?a:a-this.options.min)/(d/100)):(this.no_diapason=!0,0)},convertToValue:function(a){var b=this.options.min,d=this.options.max,
|
60 |
+
c=b.toString().split(".")[1],e=d.toString().split(".")[1],g,l,k=0,f=0;if(0===a)return this.options.min;if(100===a)return this.options.max;c&&(k=g=c.length);e&&(k=l=e.length);g&&l&&(k=g>=l?g:l);0>b&&(f=Math.abs(b),b=+(b+f).toFixed(k),d=+(d+f).toFixed(k));a=(d-b)/100*a+b;(b=this.options.step.toString().split(".")[1])?a=+a.toFixed(b.length):(a/=this.options.step,a*=this.options.step,a=+a.toFixed(0));f&&(a-=f);f=b?+a.toFixed(b.length):this.toFixed(a);f<this.options.min?f=this.options.min:f>this.options.max&&
|
61 |
+
(f=this.options.max);return f},calcWithStep:function(a){var b=Math.round(a/this.coords.p_step)*this.coords.p_step;100<b&&(b=100);100===a&&(b=100);return this.toFixed(b)},checkMinInterval:function(a,b,d){var c=this.options;if(!c.min_interval)return a;a=this.convertToValue(a);b=this.convertToValue(b);"from"===d?b-a<c.min_interval&&(a=b-c.min_interval):a-b<c.min_interval&&(a=b+c.min_interval);return this.convertToPercent(a)},checkMaxInterval:function(a,b,d){var c=this.options;if(!c.max_interval)return a;
|
62 |
+
a=this.convertToValue(a);b=this.convertToValue(b);"from"===d?b-a>c.max_interval&&(a=b-c.max_interval):a-b>c.max_interval&&(a=b+c.max_interval);return this.convertToPercent(a)},checkDiapason:function(a,b,d){a=this.convertToValue(a);var c=this.options;"number"!==typeof b&&(b=c.min);"number"!==typeof d&&(d=c.max);a<b&&(a=b);a>d&&(a=d);return this.convertToPercent(a)},toFixed:function(a){a=a.toFixed(9);return+a},_prettify:function(a){return this.options.prettify_enabled?this.options.prettify&&"function"===
|
63 |
+
typeof this.options.prettify?this.options.prettify(a):this.prettify(a):a},prettify:function(a){return a.toString().replace(/(\d{1,3}(?=(?:\d\d\d)+(?!\d)))/g,"$1"+this.options.prettify_separator)},checkEdges:function(a,b){if(!this.options.force_edges)return this.toFixed(a);0>a?a=0:a>100-b&&(a=100-b);return this.toFixed(a)},validate:function(){var a=this.options,b=this.result,d=a.values,c=d.length,e,g;"string"===typeof a.min&&(a.min=+a.min);"string"===typeof a.max&&(a.max=+a.max);"string"===typeof a.from&&
|
64 |
+
(a.from=+a.from);"string"===typeof a.to&&(a.to=+a.to);"string"===typeof a.step&&(a.step=+a.step);"string"===typeof a.from_min&&(a.from_min=+a.from_min);"string"===typeof a.from_max&&(a.from_max=+a.from_max);"string"===typeof a.to_min&&(a.to_min=+a.to_min);"string"===typeof a.to_max&&(a.to_max=+a.to_max);"string"===typeof a.keyboard_step&&(a.keyboard_step=+a.keyboard_step);"string"===typeof a.grid_num&&(a.grid_num=+a.grid_num);a.max<a.min&&(a.max=a.min);if(c)for(a.p_values=[],a.min=0,a.max=c-1,a.step=
|
65 |
+
1,a.grid_num=a.max,a.grid_snap=!0,g=0;g<c;g++)e=+d[g],isNaN(e)?e=d[g]:(d[g]=e,e=this._prettify(e)),a.p_values.push(e);if("number"!==typeof a.from||isNaN(a.from))a.from=a.min;if("number"!==typeof a.to||isNaN(a.from))a.to=a.max;if("single"===a.type)a.from<a.min&&(a.from=a.min),a.from>a.max&&(a.from=a.max);else{if(a.from<a.min||a.from>a.max)a.from=a.min;if(a.to>a.max||a.to<a.min)a.to=a.max;a.from>a.to&&(a.from=a.to)}if("number"!==typeof a.step||isNaN(a.step)||!a.step||0>a.step)a.step=1;if("number"!==
|
66 |
+
typeof a.keyboard_step||isNaN(a.keyboard_step)||!a.keyboard_step||0>a.keyboard_step)a.keyboard_step=5;"number"===typeof a.from_min&&a.from<a.from_min&&(a.from=a.from_min);"number"===typeof a.from_max&&a.from>a.from_max&&(a.from=a.from_max);"number"===typeof a.to_min&&a.to<a.to_min&&(a.to=a.to_min);"number"===typeof a.to_max&&a.from>a.to_max&&(a.to=a.to_max);if(b){b.min!==a.min&&(b.min=a.min);b.max!==a.max&&(b.max=a.max);if(b.from<b.min||b.from>b.max)b.from=a.from;if(b.to<b.min||b.to>b.max)b.to=a.to}if("number"!==
|
67 |
+
typeof a.min_interval||isNaN(a.min_interval)||!a.min_interval||0>a.min_interval)a.min_interval=0;if("number"!==typeof a.max_interval||isNaN(a.max_interval)||!a.max_interval||0>a.max_interval)a.max_interval=0;a.min_interval&&a.min_interval>a.max-a.min&&(a.min_interval=a.max-a.min);a.max_interval&&a.max_interval>a.max-a.min&&(a.max_interval=a.max-a.min)},decorate:function(a,b){var d="",c=this.options;c.prefix&&(d+=c.prefix);d+=a;c.max_postfix&&(c.values.length&&a===c.p_values[c.max]?(d+=c.max_postfix,
|
68 |
+
c.postfix&&(d+=" ")):b===c.max&&(d+=c.max_postfix,c.postfix&&(d+=" ")));c.postfix&&(d+=c.postfix);return d},updateFrom:function(){this.result.from=this.options.from;this.result.from_percent=this.convertToPercent(this.result.from);this.options.values&&(this.result.from_value=this.options.values[this.result.from])},updateTo:function(){this.result.to=this.options.to;this.result.to_percent=this.convertToPercent(this.result.to);this.options.values&&(this.result.to_value=this.options.values[this.result.to])},
|
69 |
+
updateResult:function(){this.result.min=this.options.min;this.result.max=this.options.max;this.updateFrom();this.updateTo()},appendGrid:function(){if(this.options.grid){var a=this.options,b,d;b=a.max-a.min;var c=a.grid_num,e=0,g=0,f=4,k,h,m=0,n="";this.calcGridMargin();a.grid_snap?(c=b/a.step,e=this.toFixed(a.step/(b/100))):e=this.toFixed(100/c);4<c&&(f=3);7<c&&(f=2);14<c&&(f=1);28<c&&(f=0);for(b=0;b<c+1;b++){k=f;g=this.toFixed(e*b);100<g&&(g=100,k-=2,0>k&&(k=0));this.coords.big[b]=g;h=(g-e*(b-1))/
|
70 |
+
(k+1);for(d=1;d<=k&&0!==g;d++)m=this.toFixed(g-h*d),n+='<span class="irs-grid-pol small" style="left: '+m+'%"></span>';n+='<span class="irs-grid-pol" style="left: '+g+'%"></span>';m=this.convertToValue(g);m=a.values.length?a.p_values[m]:this._prettify(m);n+='<span class="irs-grid-text js-grid-text-'+b+'" style="left: '+g+'%">'+m+"</span>"}this.coords.big_num=Math.ceil(c+1);this.$cache.cont.addClass("irs-with-grid");this.$cache.grid.html(n);this.cacheGridLabels()}},cacheGridLabels:function(){var a,
|
71 |
+
b,d=this.coords.big_num;for(b=0;b<d;b++)a=this.$cache.grid.find(".js-grid-text-"+b),this.$cache.grid_labels.push(a);this.calcGridLabels()},calcGridLabels:function(){var a,b;b=[];var d=[],c=this.coords.big_num;for(a=0;a<c;a++)this.coords.big_w[a]=this.$cache.grid_labels[a].outerWidth(!1),this.coords.big_p[a]=this.toFixed(this.coords.big_w[a]/this.coords.w_rs*100),this.coords.big_x[a]=this.toFixed(this.coords.big_p[a]/2),b[a]=this.toFixed(this.coords.big[a]-this.coords.big_x[a]),d[a]=this.toFixed(b[a]+
|
72 |
+
this.coords.big_p[a]);this.options.force_edges&&(b[0]<-this.coords.grid_gap&&(b[0]=-this.coords.grid_gap,d[0]=this.toFixed(b[0]+this.coords.big_p[0]),this.coords.big_x[0]=this.coords.grid_gap),d[c-1]>100+this.coords.grid_gap&&(d[c-1]=100+this.coords.grid_gap,b[c-1]=this.toFixed(d[c-1]-this.coords.big_p[c-1]),this.coords.big_x[c-1]=this.toFixed(this.coords.big_p[c-1]-this.coords.grid_gap)));this.calcGridCollision(2,b,d);this.calcGridCollision(4,b,d);for(a=0;a<c;a++)b=this.$cache.grid_labels[a][0],
|
73 |
+
b.style.marginLeft=-this.coords.big_x[a]+"%"},calcGridCollision:function(a,b,d){var c,e,g,f=this.coords.big_num;for(c=0;c<f;c+=a){e=c+a/2;if(e>=f)break;g=this.$cache.grid_labels[e][0];g.style.visibility=d[c]<=b[e]?"visible":"hidden"}},calcGridMargin:function(){this.options.grid_margin&&(this.coords.w_rs=this.$cache.rs.outerWidth(!1),this.coords.w_rs&&(this.coords.w_handle="single"===this.options.type?this.$cache.s_single.outerWidth(!1):this.$cache.s_from.outerWidth(!1),this.coords.p_handle=this.toFixed(this.coords.w_handle/
|
74 |
+
this.coords.w_rs*100),this.coords.grid_gap=this.toFixed(this.coords.p_handle/2-.1),this.$cache.grid[0].style.width=this.toFixed(100-this.coords.p_handle)+"%",this.$cache.grid[0].style.left=this.coords.grid_gap+"%"))},update:function(a){this.input&&(this.is_update=!0,this.options.from=this.result.from,this.options.to=this.result.to,this.options=f.extend(this.options,a),this.validate(),this.updateResult(a),this.toggleInput(),this.remove(),this.init(!0))},reset:function(){this.input&&(this.updateResult(),
|
75 |
+
this.update())},destroy:function(){this.input&&(this.toggleInput(),this.$cache.input.prop("readonly",!1),f.data(this.input,"ionRangeSlider",null),this.remove(),this.options=this.input=null)}};f.fn.ionRangeSlider=function(a){return this.each(function(){f.data(this,"ionRangeSlider")||f.data(this,"ionRangeSlider",new q(this,a,u++))})};(function(){for(var a=0,b=["ms","moz","webkit","o"],d=0;d<b.length&&!h.requestAnimationFrame;++d)h.requestAnimationFrame=h[b[d]+"RequestAnimationFrame"],h.cancelAnimationFrame=
|
76 |
+
h[b[d]+"CancelAnimationFrame"]||h[b[d]+"CancelRequestAnimationFrame"];h.requestAnimationFrame||(h.requestAnimationFrame=function(b,d){var g=(new Date).getTime(),f=Math.max(0,16-(g-a)),k=h.setTimeout(function(){b(g+f)},f);a=g+f;return k});h.cancelAnimationFrame||(h.cancelAnimationFrame=function(a){clearTimeout(a)})})()})(jQuery,document,window,navigator);
|
framework/includes/option-types/upload/class-fw-option-type-upload.php
CHANGED
@@ -17,9 +17,11 @@ class FW_Option_Type_Upload extends FW_Option_Type
|
|
17 |
protected function _get_defaults()
|
18 |
{
|
19 |
return array(
|
20 |
-
'images_only'
|
21 |
-
'texts'
|
22 |
-
'value'
|
|
|
|
|
23 |
);
|
24 |
}
|
25 |
|
@@ -118,6 +120,22 @@ class FW_Option_Type_Upload extends FW_Option_Type
|
|
118 |
|
119 |
$l10n = $option['texts'];
|
120 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
if ($option['images_only']) {
|
122 |
return $this->render_images_only($input_attr, $wrapper_attr, $l10n);
|
123 |
} else {
|
17 |
protected function _get_defaults()
|
18 |
{
|
19 |
return array(
|
20 |
+
'images_only' => true,
|
21 |
+
'texts' => array(),
|
22 |
+
'value' => '',
|
23 |
+
'files_ext' => array(),
|
24 |
+
'extra_mime_types' => array()
|
25 |
);
|
26 |
}
|
27 |
|
120 |
|
121 |
$l10n = $option['texts'];
|
122 |
|
123 |
+
if ( ! empty( $option['files_ext'] ) ) {
|
124 |
+
$ext_files = is_array( $option['files_ext'] ) ? $option['files_ext'] : explode( ',', $option['files_ext'] );
|
125 |
+
$ext_files = array_unique( $ext_files );
|
126 |
+
$mime_types = fw_get_mime_type_by_ext( $ext_files );
|
127 |
+
$collector = array(
|
128 |
+
'ext_files' => $ext_files,
|
129 |
+
'mime_types' => $mime_types,
|
130 |
+
'extra_mime_types' => $option['extra_mime_types']
|
131 |
+
);
|
132 |
+
|
133 |
+
$wrapper_attr['data-files-details'] = json_encode( $collector );
|
134 |
+
|
135 |
+
$check_file_types = fw_multi_ext2type( $ext_files );
|
136 |
+
$option['images_only'] = ( ! empty( $check_file_types ) && count( $check_file_types ) === 1 && $check_file_types[0] === 'image' );
|
137 |
+
}
|
138 |
+
|
139 |
if ($option['images_only']) {
|
140 |
return $this->render_images_only($input_attr, $wrapper_attr, $l10n);
|
141 |
} else {
|
framework/includes/option-types/upload/static/js/any-files.js
CHANGED
@@ -13,9 +13,46 @@
|
|
13 |
buttonAdd: elements.$container.attr('data-l10n-button-add'),
|
14 |
buttonEdit: elements.$container.attr('data-l10n-button-edit')
|
15 |
},
|
16 |
-
frame
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
frame.on('ready', function() {
|
21 |
frame.modal.$el.addClass('fw-option-type-upload');
|
13 |
buttonAdd: elements.$container.attr('data-l10n-button-add'),
|
14 |
buttonEdit: elements.$container.attr('data-l10n-button-edit')
|
15 |
},
|
16 |
+
frame;
|
17 |
+
|
18 |
+
var haveFilesDetails = elements.$container.attr('data-files-details') !== undefined;
|
19 |
+
|
20 |
+
if (haveFilesDetails) {
|
21 |
+
var parsedFilesDetails = JSON.parse(elements.$container.attr('data-files-details'));
|
22 |
+
}
|
23 |
+
|
24 |
+
var createFrame = function() {
|
25 |
+
var frameOpts = haveFilesDetails ?
|
26 |
+
{
|
27 |
+
library: {
|
28 |
+
type: parsedFilesDetails.mime_types
|
29 |
+
}
|
30 |
+
} : {};
|
31 |
+
|
32 |
+
frame = wp.media(frameOpts);
|
33 |
+
|
34 |
+
if(haveFilesDetails) {
|
35 |
+
frame.on('content:render', function () {
|
36 |
+
var $view = this.first().frame.views.get('.media-frame-uploader')[0];
|
37 |
+
|
38 |
+
if(parsedFilesDetails.extra_mime_types.length > 0 && _.isArray(parsedFilesDetails.extra_mime_types)){
|
39 |
+
_.each(parsedFilesDetails.extra_mime_types, function(mime_type){
|
40 |
+
mOxie.Mime.addMimeType(mime_type);
|
41 |
+
});
|
42 |
+
}
|
43 |
+
|
44 |
+
$view.options.uploader.plupload = {
|
45 |
+
filters: {
|
46 |
+
mime_types: [
|
47 |
+
{
|
48 |
+
title: 'Files : '+parsedFilesDetails.ext_files.join(','),
|
49 |
+
extensions: parsedFilesDetails.ext_files.join(',')
|
50 |
+
}
|
51 |
+
]
|
52 |
+
}
|
53 |
+
};
|
54 |
+
});
|
55 |
+
}
|
56 |
|
57 |
frame.on('ready', function() {
|
58 |
frame.modal.$el.addClass('fw-option-type-upload');
|
framework/includes/option-types/upload/static/js/images-only.js
CHANGED
@@ -18,14 +18,44 @@
|
|
18 |
buttonAdd: elements.$container.attr('data-l10n-button-add'),
|
19 |
buttonEdit: elements.$container.attr('data-l10n-button-edit')
|
20 |
},
|
21 |
-
frame
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
frame = wp.media({
|
24 |
library: {
|
25 |
-
type: 'image'
|
26 |
}
|
27 |
});
|
28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
frame.on('ready', function() {
|
30 |
frame.modal.$el.addClass('fw-option-type-upload');
|
31 |
});
|
18 |
buttonAdd: elements.$container.attr('data-l10n-button-add'),
|
19 |
buttonEdit: elements.$container.attr('data-l10n-button-edit')
|
20 |
},
|
21 |
+
frame;
|
22 |
+
|
23 |
+
var haveFilesDetails = elements.$container.attr('data-files-details') !== undefined;
|
24 |
+
|
25 |
+
if (haveFilesDetails) {
|
26 |
+
var parsedFilesDetails = JSON.parse(elements.$container.attr('data-files-details'));
|
27 |
+
}
|
28 |
+
|
29 |
+
var createFrame = function() {
|
30 |
frame = wp.media({
|
31 |
library: {
|
32 |
+
type: haveFilesDetails ? parsedFilesDetails.mime_types : 'image'
|
33 |
}
|
34 |
});
|
35 |
|
36 |
+
if(haveFilesDetails) {
|
37 |
+
frame.on('content:render', function () {
|
38 |
+
var $view = this.first().frame.views.get('.media-frame-uploader')[0];
|
39 |
+
|
40 |
+
if(parsedFilesDetails.extra_mime_types.length > 0 && _.isArray(parsedFilesDetails.extra_mime_types)){
|
41 |
+
_.each(parsedFilesDetails.extra_mime_types, function(mime_type){
|
42 |
+
mOxie.Mime.addMimeType(mime_type);
|
43 |
+
});
|
44 |
+
}
|
45 |
+
|
46 |
+
$view.options.uploader.plupload = {
|
47 |
+
filters: {
|
48 |
+
mime_types: [
|
49 |
+
{
|
50 |
+
title: 'Images',
|
51 |
+
extensions: parsedFilesDetails.ext_files.join(',')
|
52 |
+
}
|
53 |
+
]
|
54 |
+
}
|
55 |
+
};
|
56 |
+
});
|
57 |
+
}
|
58 |
+
|
59 |
frame.on('ready', function() {
|
60 |
frame.modal.$el.addClass('fw-option-type-upload');
|
61 |
});
|
framework/manifest.php
CHANGED
@@ -4,4 +4,4 @@ $manifest = array();
|
|
4 |
|
5 |
$manifest['name'] = __('Unyson', 'fw');
|
6 |
|
7 |
-
$manifest['version'] = '2.4.
|
4 |
|
5 |
$manifest['name'] = __('Unyson', 'fw');
|
6 |
|
7 |
+
$manifest['version'] = '2.4.10';
|
framework/static/css/backend-options.css
CHANGED
@@ -2,6 +2,7 @@
|
|
2 |
Included on pages where backend options are rendered
|
3 |
*/
|
4 |
|
|
|
5 |
/* General */
|
6 |
|
7 |
.postbox-with-fw-options > .inside,
|
@@ -256,6 +257,10 @@ form.fw-settings-form.fw-backend-side-tabs {
|
|
256 |
border-bottom: none;
|
257 |
}
|
258 |
|
|
|
|
|
|
|
|
|
259 |
.fw-backend-side-tabs .fw-options-tabs-first-level > .fw-options-tabs-contents {
|
260 |
margin-left: 198px !important;
|
261 |
background: #fff;
|
@@ -276,6 +281,24 @@ form.fw-settings-form.fw-backend-side-tabs {
|
|
276 |
border-width: 0 0 1px;
|
277 |
}
|
278 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
279 |
.fw-backend-side-tabs .fw-options-tabs-first-level > .fw-options-tabs-list ul li a.nav-tab {
|
280 |
position: relative;
|
281 |
outline: none;
|
@@ -319,6 +342,11 @@ form.fw-settings-form.fw-backend-side-tabs {
|
|
319 |
color: #fff;
|
320 |
}
|
321 |
|
|
|
|
|
|
|
|
|
|
|
322 |
.fw-backend-side-tabs .fw-options-tabs-first-level > .fw-options-tabs-contents .fw-options-tabs-wrapper > .fw-options-tabs-list ul li.ui-state-active a.nav-tab {
|
323 |
border-bottom-color: #fff;
|
324 |
}
|
@@ -478,6 +506,10 @@ form.fw-settings-form.fw-backend-side-tabs {
|
|
478 |
margin-left: 0 !important;
|
479 |
}
|
480 |
|
|
|
|
|
|
|
|
|
481 |
.fw-backend-side-tabs .fw-options-tabs-first-level > .fw-options-tabs-contents > .fw-inner {
|
482 |
padding-bottom: 0;
|
483 |
}
|
@@ -517,19 +549,33 @@ form.fw-settings-form.fw-backend-side-tabs {
|
|
517 |
}
|
518 |
}
|
519 |
|
|
|
|
|
|
|
|
|
|
|
|
|
520 |
|
521 |
/* form header */
|
522 |
|
523 |
.fw-backend-side-tabs .fw-settings-form-header {
|
524 |
-
background: #0074a2;
|
525 |
margin-top: 20px;
|
526 |
-
|
527 |
opacity: 0;
|
528 |
-
|
529 |
transition: opacity ease 0.3s;
|
530 |
-webkit-transition: opacity ease 0.3s;
|
531 |
}
|
532 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
533 |
.fw-backend-side-tabs .fw-settings-form-header.initialized {
|
534 |
opacity: 1;
|
535 |
}
|
@@ -575,6 +621,10 @@ form.fw-settings-form.fw-backend-side-tabs {
|
|
575 |
text-align: right;
|
576 |
}
|
577 |
|
|
|
|
|
|
|
|
|
578 |
.fw-backend-side-tabs .fw-settings-form-header .form-header-buttons input {
|
579 |
-webkit-box-shadow: none;
|
580 |
box-shadow: none;
|
@@ -586,13 +636,14 @@ form.fw-settings-form.fw-backend-side-tabs {
|
|
586 |
}
|
587 |
|
588 |
.fw-backend-side-tabs .fw-settings-form-header .form-header-buttons .submit-button-separator {
|
|
|
|
|
589 |
margin: 0 12px;
|
590 |
color: #358eb6;
|
591 |
-
|
592 |
-
|
593 |
-
display: inline-block;
|
594 |
height: 14px;
|
595 |
-
|
596 |
}
|
597 |
|
598 |
.fw-backend-side-tabs .fw-settings-form-header .form-header-buttons .submit-button-reset {
|
@@ -613,6 +664,7 @@ form.fw-settings-form.fw-backend-side-tabs {
|
|
613 |
height: 26px;
|
614 |
line-height: 24px;
|
615 |
background: #fff;
|
|
|
616 |
color: #0074a2;
|
617 |
-webkit-border-radius: 2px;
|
618 |
border-radius: 2px;
|
@@ -627,7 +679,8 @@ form.fw-settings-form.fw-backend-side-tabs {
|
|
627 |
text-align: center;
|
628 |
}
|
629 |
|
630 |
-
.fw-backend-side-tabs .fw-settings-form-header .form-header-buttons
|
|
|
631 |
text-align: inherit;
|
632 |
}
|
633 |
|
@@ -665,6 +718,12 @@ form.fw-settings-form.fw-backend-side-tabs {
|
|
665 |
border-radius: 2px;
|
666 |
}
|
667 |
|
|
|
|
|
|
|
|
|
|
|
|
|
668 |
.fw-backend-side-tabs .form-footer-buttons input[type="submit"].button-primary {
|
669 |
margin-left: 26px;
|
670 |
}
|
@@ -673,10 +732,19 @@ form.fw-settings-form.fw-backend-side-tabs {
|
|
673 |
margin-left: 13px;
|
674 |
}
|
675 |
|
|
|
|
|
|
|
|
|
|
|
676 |
@media (max-width: 782px) {
|
677 |
.fw-backend-side-tabs .fw-options-tabs-wrapper + .form-footer-buttons {
|
678 |
margin: -1px 0 0; /* hide last option border */
|
679 |
}
|
|
|
|
|
|
|
|
|
680 |
}
|
681 |
|
682 |
/* end: footer buttons */
|
2 |
Included on pages where backend options are rendered
|
3 |
*/
|
4 |
|
5 |
+
|
6 |
/* General */
|
7 |
|
8 |
.postbox-with-fw-options > .inside,
|
257 |
border-bottom: none;
|
258 |
}
|
259 |
|
260 |
+
body.rtl .fw-backend-side-tabs .fw-options-tabs-first-level > .fw-options-tabs-list {
|
261 |
+
float: right;
|
262 |
+
}
|
263 |
+
|
264 |
.fw-backend-side-tabs .fw-options-tabs-first-level > .fw-options-tabs-contents {
|
265 |
margin-left: 198px !important;
|
266 |
background: #fff;
|
281 |
border-width: 0 0 1px;
|
282 |
}
|
283 |
|
284 |
+
body.rtl .fw-backend-side-tabs .fw-options-tabs-wrapper > .fw-options-tabs-contents > .fw-inner > .fw-options-tab > .fw-options-tabs-wrapper > .fw-options-tabs-list {
|
285 |
+
padding: 0;
|
286 |
+
}
|
287 |
+
|
288 |
+
body.rtl .fw-backend-side-tabs .fw-options-tabs-wrapper > .fw-options-tabs-contents > .fw-inner > .fw-options-tab > .fw-options-tabs-wrapper > .fw-options-tabs-list ul li:first-child a.nav-tab {
|
289 |
+
margin: 0;
|
290 |
+
}
|
291 |
+
|
292 |
+
body.rtl .fw-backend-side-tabs .fw-options-tabs-first-level > .fw-options-tabs-contents > .fw-inner > .fw-options-tab > .fw-options-tabs-wrapper > .fw-options-tabs-list ul li {
|
293 |
+
border-left: 1px solid #e5e5e5;
|
294 |
+
border-right: none;
|
295 |
+
}
|
296 |
+
|
297 |
+
body.rtl .fw-backend-side-tabs .fw-options-tabs-wrapper > .fw-options-tabs-list ul li {
|
298 |
+
float: none;
|
299 |
+
margin-left: 0;
|
300 |
+
}
|
301 |
+
|
302 |
.fw-backend-side-tabs .fw-options-tabs-first-level > .fw-options-tabs-list ul li a.nav-tab {
|
303 |
position: relative;
|
304 |
outline: none;
|
342 |
color: #fff;
|
343 |
}
|
344 |
|
345 |
+
body.rtl .fw-backend-side-tabs .fw-options-tabs-first-level > .fw-options-tabs-contents {
|
346 |
+
margin-left: 0 !important;
|
347 |
+
margin-right: 198px !important;
|
348 |
+
}
|
349 |
+
|
350 |
.fw-backend-side-tabs .fw-options-tabs-first-level > .fw-options-tabs-contents .fw-options-tabs-wrapper > .fw-options-tabs-list ul li.ui-state-active a.nav-tab {
|
351 |
border-bottom-color: #fff;
|
352 |
}
|
506 |
margin-left: 0 !important;
|
507 |
}
|
508 |
|
509 |
+
body.rtl .fw-backend-side-tabs .fw-options-tabs-first-level > .fw-options-tabs-contents {
|
510 |
+
margin-right: 0 !important;
|
511 |
+
}
|
512 |
+
|
513 |
.fw-backend-side-tabs .fw-options-tabs-first-level > .fw-options-tabs-contents > .fw-inner {
|
514 |
padding-bottom: 0;
|
515 |
}
|
549 |
}
|
550 |
}
|
551 |
|
552 |
+
@media (max-width: 782px){
|
553 |
+
body.rtl .fw-options-tabs-wrapper > .fw-options-tabs-list ul li {
|
554 |
+
float: none;
|
555 |
+
}
|
556 |
+
}
|
557 |
+
|
558 |
|
559 |
/* form header */
|
560 |
|
561 |
.fw-backend-side-tabs .fw-settings-form-header {
|
562 |
+
background-color: #0074a2;
|
563 |
margin-top: 20px;
|
|
|
564 |
opacity: 0;
|
|
|
565 |
transition: opacity ease 0.3s;
|
566 |
-webkit-transition: opacity ease 0.3s;
|
567 |
}
|
568 |
|
569 |
+
/* make it match with admin color themes */
|
570 |
+
body.admin-color-light .fw-backend-side-tabs .fw-settings-form-header { background-color: #777 }
|
571 |
+
body.admin-color-light .fw-backend-side-tabs .fw-options-tabs-first-level { background: #ddd }
|
572 |
+
body.admin-color-blue .fw-backend-side-tabs .fw-settings-form-header { background-color: #4796b3 }
|
573 |
+
body.admin-color-coffee .fw-backend-side-tabs .fw-settings-form-header { background-color: #46403c }
|
574 |
+
body.admin-color-ectoplasm .fw-backend-side-tabs .fw-settings-form-header { background-color: #413256 }
|
575 |
+
body.admin-color-midnight .fw-backend-side-tabs .fw-settings-form-header { background-color: #26292c }
|
576 |
+
body.admin-color-ocean .fw-backend-side-tabs .fw-settings-form-header { background-color: #627c83 }
|
577 |
+
body.admin-color-sunrise .fw-backend-side-tabs .fw-settings-form-header { background-color: #be3631 }
|
578 |
+
|
579 |
.fw-backend-side-tabs .fw-settings-form-header.initialized {
|
580 |
opacity: 1;
|
581 |
}
|
621 |
text-align: right;
|
622 |
}
|
623 |
|
624 |
+
body.rtl .fw-backend-side-tabs .fw-settings-form-header .form-header-buttons {
|
625 |
+
text-align: left;
|
626 |
+
}
|
627 |
+
|
628 |
.fw-backend-side-tabs .fw-settings-form-header .form-header-buttons input {
|
629 |
-webkit-box-shadow: none;
|
630 |
box-shadow: none;
|
636 |
}
|
637 |
|
638 |
.fw-backend-side-tabs .fw-settings-form-header .form-header-buttons .submit-button-separator {
|
639 |
+
display: inline-block;
|
640 |
+
vertical-align: middle;
|
641 |
margin: 0 12px;
|
642 |
color: #358eb6;
|
643 |
+
background-color: rgb(255,255,255);
|
644 |
+
background-color: rgba(255,255,255,0.5);
|
|
|
645 |
height: 14px;
|
646 |
+
width: 1px;
|
647 |
}
|
648 |
|
649 |
.fw-backend-side-tabs .fw-settings-form-header .form-header-buttons .submit-button-reset {
|
664 |
height: 26px;
|
665 |
line-height: 24px;
|
666 |
background: #fff;
|
667 |
+
border-color: transparent;
|
668 |
color: #0074a2;
|
669 |
-webkit-border-radius: 2px;
|
670 |
border-radius: 2px;
|
679 |
text-align: center;
|
680 |
}
|
681 |
|
682 |
+
.fw-backend-side-tabs .fw-settings-form-header .form-header-buttons,
|
683 |
+
body.rtl .fw-backend-side-tabs .fw-settings-form-header .form-header-buttons {
|
684 |
text-align: inherit;
|
685 |
}
|
686 |
|
718 |
border-radius: 2px;
|
719 |
}
|
720 |
|
721 |
+
body.rtl .fw-backend-side-tabs .form-footer-buttons input[type="submit"] {
|
722 |
+
float: right;
|
723 |
+
margin-left: 0;
|
724 |
+
margin-right: 26px;
|
725 |
+
}
|
726 |
+
|
727 |
.fw-backend-side-tabs .form-footer-buttons input[type="submit"].button-primary {
|
728 |
margin-left: 26px;
|
729 |
}
|
732 |
margin-left: 13px;
|
733 |
}
|
734 |
|
735 |
+
|
736 |
+
body.rtl .fw-backend-side-tabs .fw-options-tabs-wrapper + .form-footer-buttons {
|
737 |
+
margin: -71px 198px 0 0;
|
738 |
+
}
|
739 |
+
|
740 |
@media (max-width: 782px) {
|
741 |
.fw-backend-side-tabs .fw-options-tabs-wrapper + .form-footer-buttons {
|
742 |
margin: -1px 0 0; /* hide last option border */
|
743 |
}
|
744 |
+
|
745 |
+
body.rtl .fw-backend-side-tabs .fw-options-tabs-wrapper + .form-footer-buttons {
|
746 |
+
margin: -1px 0 0;
|
747 |
+
}
|
748 |
}
|
749 |
|
750 |
/* end: footer buttons */
|
framework/static/css/fw.css
CHANGED
@@ -2886,6 +2886,14 @@ body.wp-customizer > div:not(.fw-modal) > .media-modal-backdrop {
|
|
2886 |
transition: opacity .3s ease-in-out;
|
2887 |
}
|
2888 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2889 |
.fw-modal.fw-modal-open > .media-modal-backdrop {
|
2890 |
opacity: .7; /* must be the same as in .media-modal-backdrop {} wp style */
|
2891 |
|
@@ -3055,7 +3063,7 @@ body.rtl .fw-modal .media-frame-content > form .fw-options-tabs-contents .fw-opt
|
|
3055 |
}
|
3056 |
|
3057 |
.fw-sole-modal > .media-modal-backdrop {
|
3058 |
-
z-index:
|
3059 |
background-color: transparent;
|
3060 |
}
|
3061 |
|
@@ -3069,6 +3077,16 @@ body.rtl .fw-modal .media-frame-content > form .fw-options-tabs-contents .fw-opt
|
|
3069 |
line-height: initial;
|
3070 |
}
|
3071 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3072 |
.fw-sole-modal .fw-sole-modal-content p {
|
3073 |
font-size: 13px;
|
3074 |
line-height: 19px;
|
2886 |
transition: opacity .3s ease-in-out;
|
2887 |
}
|
2888 |
|
2889 |
+
.fw-modal.fw-modal-backdrop-light > .media-modal-backdrop {
|
2890 |
+
background-color: #fff;
|
2891 |
+
}
|
2892 |
+
|
2893 |
+
.fw-modal.fw-modal-backdrop-dark > .media-modal-backdrop {
|
2894 |
+
background-color: #000;
|
2895 |
+
}
|
2896 |
+
|
2897 |
.fw-modal.fw-modal-open > .media-modal-backdrop {
|
2898 |
opacity: .7; /* must be the same as in .media-modal-backdrop {} wp style */
|
2899 |
|
3063 |
}
|
3064 |
|
3065 |
.fw-sole-modal > .media-modal-backdrop {
|
3066 |
+
z-index: 499999;
|
3067 |
background-color: transparent;
|
3068 |
}
|
3069 |
|
3077 |
line-height: initial;
|
3078 |
}
|
3079 |
|
3080 |
+
.fw-sole-modal .fw-sole-modal-content h2:first-child {
|
3081 |
+
margin-top: 0;
|
3082 |
+
}
|
3083 |
+
|
3084 |
+
.fw-sole-modal .fw-sole-modal-content h2 img.wp-spinner {
|
3085 |
+
vertical-align: baseline;
|
3086 |
+
position: relative;
|
3087 |
+
top: 2px;
|
3088 |
+
}
|
3089 |
+
|
3090 |
.fw-sole-modal .fw-sole-modal-content p {
|
3091 |
font-size: 13px;
|
3092 |
line-height: 19px;
|
framework/static/css/option-types.css
CHANGED
@@ -79,7 +79,7 @@ textarea.fw-option-type-textarea {
|
|
79 |
width: 100px !important;
|
80 |
}
|
81 |
|
82 |
-
/* Radio
|
83 |
|
84 |
.fw-option-type-checkboxes.fw-option-type-checkboxes-inline > div,
|
85 |
.fw-option-type-radio.fw-option-type-radio-inline > div {
|
@@ -92,6 +92,13 @@ textarea.fw-option-type-textarea {
|
|
92 |
margin-right: 0;
|
93 |
}
|
94 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
/* end: Radio amd Checkboxes inline */
|
96 |
|
97 |
/* modal fixes */
|
@@ -119,6 +126,7 @@ textarea.fw-option-type-textarea {
|
|
119 |
}
|
120 |
|
121 |
.fw-modal .media-frame input[type=text],
|
|
|
122 |
.fw-modal .media-frame textarea {
|
123 |
padding: 3px 5px;
|
124 |
}
|
79 |
width: 100px !important;
|
80 |
}
|
81 |
|
82 |
+
/* Radio and Checkboxes inline */
|
83 |
|
84 |
.fw-option-type-checkboxes.fw-option-type-checkboxes-inline > div,
|
85 |
.fw-option-type-radio.fw-option-type-radio-inline > div {
|
92 |
margin-right: 0;
|
93 |
}
|
94 |
|
95 |
+
/* RTL Radio and Checkboxes inline */
|
96 |
+
body.rtl .fw-option-type-checkboxes.fw-option-type-checkboxes-inline > div:not(:last-child),
|
97 |
+
body.rtl .fw-option-type-radio.fw-option-type-radio-inline > div:not(:last-child) {
|
98 |
+
float: right;
|
99 |
+
margin: 0 0 0 10px;
|
100 |
+
}
|
101 |
+
|
102 |
/* end: Radio amd Checkboxes inline */
|
103 |
|
104 |
/* modal fixes */
|
126 |
}
|
127 |
|
128 |
.fw-modal .media-frame input[type=text],
|
129 |
+
.fw-modal .media-frame input[type=password],
|
130 |
.fw-modal .media-frame textarea {
|
131 |
padding: 3px 5px;
|
132 |
}
|
framework/static/js/fw.js
CHANGED
@@ -587,12 +587,13 @@ fw.getQueryString = function(name) {
|
|
587 |
* Usage:
|
588 |
* var modal = new fw.Modal();
|
589 |
*
|
590 |
-
* modal.on('open|close', function(){});
|
591 |
*/
|
592 |
fw.Modal = Backbone.Model.extend({
|
593 |
defaults: {
|
594 |
/* Modal title */
|
595 |
title: 'Edit Options',
|
|
|
596 |
/**
|
597 |
* Content html
|
598 |
* @private
|
@@ -656,12 +657,29 @@ fw.getQueryString = function(name) {
|
|
656 |
defaults: {
|
657 |
content: 'main',
|
658 |
menu: 'default',
|
659 |
-
title: this.get('title')
|
|
|
660 |
},
|
661 |
initialize: function() {
|
662 |
this.listenTo(modal, 'change:title', function(){
|
663 |
this.set('title', modal.get('title'));
|
664 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
665 |
}
|
666 |
});
|
667 |
|
@@ -766,6 +784,8 @@ fw.getQueryString = function(name) {
|
|
766 |
}
|
767 |
|
768 |
closeEffect();
|
|
|
|
|
769 |
}
|
770 |
|
771 |
// add events that prevent original close
|
@@ -793,6 +813,8 @@ fw.getQueryString = function(name) {
|
|
793 |
modal.resizeTabsContent();
|
794 |
});
|
795 |
}
|
|
|
|
|
796 |
});
|
797 |
|
798 |
this.frame.on('close', function(){
|
@@ -812,6 +834,8 @@ fw.getQueryString = function(name) {
|
|
812 |
modal.frame.modal.$el.removeClass('fw-modal-open');
|
813 |
|
814 |
modalsStack.pop();
|
|
|
|
|
815 |
});
|
816 |
|
817 |
this.frame.on('content:create:main', function () {
|
@@ -838,14 +862,16 @@ fw.getQueryString = function(name) {
|
|
838 |
this.initializeFrame();
|
839 |
this.initializeContent();
|
840 |
},
|
841 |
-
/**
|
842 |
-
* @param {Object} options used for fw()->backend->render_options(json_decode(options, true))
|
843 |
-
*/
|
844 |
open: function() {
|
845 |
this.frame.open();
|
846 |
|
847 |
return this;
|
848 |
},
|
|
|
|
|
|
|
|
|
|
|
849 |
/**
|
850 |
* Resize .fw-options-tabs-contents to fit entire window
|
851 |
*/
|
@@ -1494,6 +1520,8 @@ fw.soleModal = (function(){
|
|
1494 |
width: 350
|
1495 |
height: 200
|
1496 |
hidePrevious: false // just replace the modal content or hide the previous modal and open it again with new content
|
|
|
|
|
1497 |
afterOpen: function(){}
|
1498 |
afterClose: function(){}
|
1499 |
}
|
@@ -1587,6 +1615,22 @@ fw.soleModal = (function(){
|
|
1587 |
return false;
|
1588 |
}
|
1589 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1590 |
/**
|
1591 |
* Show modal
|
1592 |
* Call without arguments to display next from queue
|
@@ -1608,6 +1652,8 @@ fw.soleModal = (function(){
|
|
1608 |
width: 350,
|
1609 |
height: 200,
|
1610 |
hidePrevious: false,
|
|
|
|
|
1611 |
afterOpen: function(){},
|
1612 |
afterClose: function(){}
|
1613 |
}, opts || {});
|
@@ -1629,7 +1675,21 @@ fw.soleModal = (function(){
|
|
1629 |
}
|
1630 |
|
1631 |
if (this.current) {
|
1632 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1633 |
}
|
1634 |
|
1635 |
this.currentMethod = '';
|
@@ -1647,28 +1707,20 @@ fw.soleModal = (function(){
|
|
1647 |
|
1648 |
this.$getCloseButton().css('display', this.current.showCloseButton ? '' : 'none');
|
1649 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1650 |
this.$modal.removeClass('fw-modal-closing');
|
1651 |
this.$modal.addClass('fw-modal-open');
|
1652 |
|
1653 |
this.$modal.css('display', '');
|
1654 |
|
1655 |
-
|
1656 |
-
{
|
1657 |
-
var $size = this.$modal.find('> .media-modal');
|
1658 |
-
|
1659 |
-
if (
|
1660 |
-
$size.height() != this.current.height
|
1661 |
-
||
|
1662 |
-
$size.width() != this.current.width
|
1663 |
-
) {
|
1664 |
-
$size.animate({
|
1665 |
-
'height': this.current.height +'px',
|
1666 |
-
'width': this.current.width +'px'
|
1667 |
-
}, this.animationTime);
|
1668 |
-
}
|
1669 |
-
|
1670 |
-
$size = undefined;
|
1671 |
-
}
|
1672 |
|
1673 |
this.currentMethodTimeoutId = setTimeout(_.bind(function() {
|
1674 |
this.current.afterOpen();
|
@@ -1687,6 +1739,8 @@ fw.soleModal = (function(){
|
|
1687 |
}, this), this.current.autoHide);
|
1688 |
}
|
1689 |
}, this), this.animationTime * 2);
|
|
|
|
|
1690 |
},
|
1691 |
/**
|
1692 |
* @param {String} [id]
|
587 |
* Usage:
|
588 |
* var modal = new fw.Modal();
|
589 |
*
|
590 |
+
* modal.on('open|closing|close', function(){});
|
591 |
*/
|
592 |
fw.Modal = Backbone.Model.extend({
|
593 |
defaults: {
|
594 |
/* Modal title */
|
595 |
title: 'Edit Options',
|
596 |
+
headerElements: '',
|
597 |
/**
|
598 |
* Content html
|
599 |
* @private
|
657 |
defaults: {
|
658 |
content: 'main',
|
659 |
menu: 'default',
|
660 |
+
title: this.get('title'),
|
661 |
+
headerElements: this.get('headerElements')
|
662 |
},
|
663 |
initialize: function() {
|
664 |
this.listenTo(modal, 'change:title', function(){
|
665 |
this.set('title', modal.get('title'));
|
666 |
});
|
667 |
+
},
|
668 |
+
activate: function () {
|
669 |
+
this.listenTo(this.frame, 'title:create:default', function () {
|
670 |
+
this.frame.title.mode(this.id);
|
671 |
+
});
|
672 |
+
|
673 |
+
this.listenTo(this.frame, 'title:create:' + this.id, function (title) {
|
674 |
+
title.view = new wp.media.View({
|
675 |
+
controller: this,
|
676 |
+
tagName: 'h1'
|
677 |
+
});
|
678 |
+
});
|
679 |
+
|
680 |
+
this.listenTo(this.frame, 'title:render:' + this.id, function (view) {
|
681 |
+
view.$el.html(this.get('title') + this.get('headerElements') || '');
|
682 |
+
});
|
683 |
}
|
684 |
});
|
685 |
|
784 |
}
|
785 |
|
786 |
closeEffect();
|
787 |
+
|
788 |
+
modal.trigger('closing');
|
789 |
}
|
790 |
|
791 |
// add events that prevent original close
|
813 |
modal.resizeTabsContent();
|
814 |
});
|
815 |
}
|
816 |
+
|
817 |
+
modal.trigger('open');
|
818 |
});
|
819 |
|
820 |
this.frame.on('close', function(){
|
834 |
modal.frame.modal.$el.removeClass('fw-modal-open');
|
835 |
|
836 |
modalsStack.pop();
|
837 |
+
|
838 |
+
modal.trigger('close');
|
839 |
});
|
840 |
|
841 |
this.frame.on('content:create:main', function () {
|
862 |
this.initializeFrame();
|
863 |
this.initializeContent();
|
864 |
},
|
|
|
|
|
|
|
865 |
open: function() {
|
866 |
this.frame.open();
|
867 |
|
868 |
return this;
|
869 |
},
|
870 |
+
close: function() {
|
871 |
+
this.frame.$el.closest('.media-modal').find('.media-modal-close:first').trigger('click');
|
872 |
+
|
873 |
+
return this;
|
874 |
+
},
|
875 |
/**
|
876 |
* Resize .fw-options-tabs-contents to fit entire window
|
877 |
*/
|
1520 |
width: 350
|
1521 |
height: 200
|
1522 |
hidePrevious: false // just replace the modal content or hide the previous modal and open it again with new content
|
1523 |
+
updateIfCurrent: false // if current open modal has the same id as modal requested to show, update it without reopening
|
1524 |
+
backdrop: null // true - light, false - dark
|
1525 |
afterOpen: function(){}
|
1526 |
afterClose: function(){}
|
1527 |
}
|
1615 |
return false;
|
1616 |
}
|
1617 |
},
|
1618 |
+
setSize: function(width, height) {
|
1619 |
+
var $size = this.$modal.find('> .media-modal');
|
1620 |
+
|
1621 |
+
if (
|
1622 |
+
$size.height() != height
|
1623 |
+
||
|
1624 |
+
$size.width() != width
|
1625 |
+
) {
|
1626 |
+
$size.animate({
|
1627 |
+
'height': height +'px',
|
1628 |
+
'width': width +'px'
|
1629 |
+
}, this.animationTime);
|
1630 |
+
}
|
1631 |
+
|
1632 |
+
$size = undefined;
|
1633 |
+
},
|
1634 |
/**
|
1635 |
* Show modal
|
1636 |
* Call without arguments to display next from queue
|
1652 |
width: 350,
|
1653 |
height: 200,
|
1654 |
hidePrevious: false,
|
1655 |
+
updateIfCurrent: false,
|
1656 |
+
backdrop: null,
|
1657 |
afterOpen: function(){},
|
1658 |
afterClose: function(){}
|
1659 |
}, opts || {});
|
1675 |
}
|
1676 |
|
1677 |
if (this.current) {
|
1678 |
+
if (
|
1679 |
+
this.queue.length
|
1680 |
+
&&
|
1681 |
+
this.queue[0].id === this.current.id
|
1682 |
+
&&
|
1683 |
+
this.queue[0].updateIfCurrent
|
1684 |
+
) {
|
1685 |
+
this.current = this.queue.shift();
|
1686 |
+
|
1687 |
+
this.setContent(this.current.html);
|
1688 |
+
|
1689 |
+
return true;
|
1690 |
+
} else {
|
1691 |
+
return false;
|
1692 |
+
}
|
1693 |
}
|
1694 |
|
1695 |
this.currentMethod = '';
|
1707 |
|
1708 |
this.$getCloseButton().css('display', this.current.showCloseButton ? '' : 'none');
|
1709 |
|
1710 |
+
{
|
1711 |
+
this.$modal.removeClass('fw-modal-backdrop-light fw-modal-backdrop-dark');
|
1712 |
+
|
1713 |
+
if (this.current.backdrop !== null) {
|
1714 |
+
this.$modal.addClass('fw-modal-backdrop-'+ (this.current.backdrop ? 'light' : 'dark'));
|
1715 |
+
}
|
1716 |
+
}
|
1717 |
+
|
1718 |
this.$modal.removeClass('fw-modal-closing');
|
1719 |
this.$modal.addClass('fw-modal-open');
|
1720 |
|
1721 |
this.$modal.css('display', '');
|
1722 |
|
1723 |
+
this.setSize(this.current.width, this.current.height);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1724 |
|
1725 |
this.currentMethodTimeoutId = setTimeout(_.bind(function() {
|
1726 |
this.current.afterOpen();
|
1739 |
}, this), this.current.autoHide);
|
1740 |
}
|
1741 |
}, this), this.animationTime * 2);
|
1742 |
+
|
1743 |
+
return true;
|
1744 |
},
|
1745 |
/**
|
1746 |
* @param {String} [id]
|
framework/views/backend-settings-form.php
CHANGED
@@ -85,21 +85,23 @@ $texts = apply_filters('fw_settings_form_texts', array(
|
|
85 |
));
|
86 |
?>
|
87 |
<?php
|
88 |
-
echo
|
89 |
-
'
|
90 |
-
'
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
|
|
|
|
103 |
?>
|
104 |
</div>
|
105 |
</div>
|
@@ -117,21 +119,23 @@ $texts = apply_filters('fw_settings_form_texts', array(
|
|
117 |
|
118 |
<div class="form-footer-buttons">
|
119 |
<!-- This div is required to follow after options in order to have special styles in case options will contain tabs (css adjacent selector + ) -->
|
120 |
-
<?php
|
121 |
-
|
122 |
-
|
123 |
-
'
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
'
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
|
|
|
|
135 |
</div>
|
136 |
|
137 |
<!-- focus tab -->
|
@@ -207,13 +211,16 @@ jQuery(function($){
|
|
207 |
|
208 |
<?php if ($ajax_submit): ?>
|
209 |
<!-- ajax submit -->
|
|
|
|
|
210 |
<script type="text/javascript">
|
211 |
jQuery(function ($) {
|
212 |
function isReset($submitButton) {
|
213 |
return $submitButton.length && $submitButton.attr('name') == '<?php echo esc_js($reset_input_name) ?>';
|
214 |
}
|
215 |
|
216 |
-
var formSelector = 'form[data-fw-form-id="fw_settings"]'
|
|
|
217 |
|
218 |
fwForm.initAjaxSubmit({
|
219 |
selector: formSelector,
|
@@ -232,16 +239,16 @@ jQuery(function($){
|
|
232 |
description =
|
233 |
'<?php echo esc_js(__('We are currently saving your settings.', 'fw')) ?>'+
|
234 |
'<br/>'+
|
235 |
-
'<?php echo esc_js(__('This may take a few moments.', 'fw')) ?>';
|
236 |
}
|
237 |
|
238 |
fw.soleModal.show(
|
239 |
'fw-options-ajax-save-loading',
|
240 |
'<h2 class="fw-text-muted">'+
|
241 |
-
'<img src="'+ fw.img.loadingSpinner +'"
|
242 |
title +
|
243 |
'</h2>'+
|
244 |
-
'<p class="fw-text-muted"><em>'+ description +'</em></p>',
|
245 |
{
|
246 |
autoHide: 60000,
|
247 |
allowClose: false
|
@@ -254,8 +261,12 @@ jQuery(function($){
|
|
254 |
onErrors: function() {
|
255 |
fw.soleModal.hide('fw-options-ajax-save-loading');
|
256 |
},
|
257 |
-
onAjaxError: function() {
|
258 |
fw.soleModal.hide('fw-options-ajax-save-loading');
|
|
|
|
|
|
|
|
|
259 |
},
|
260 |
onSuccess: function(elements, ajaxData) {
|
261 |
/**
|
85 |
));
|
86 |
?>
|
87 |
<?php
|
88 |
+
echo implode(
|
89 |
+
'<i class="submit-button-separator"></i>',
|
90 |
+
apply_filters('fw_settings_form_header_buttons', array(
|
91 |
+
fw_html_tag('input', array(
|
92 |
+
'type' => 'submit',
|
93 |
+
'name' => '_fw_reset_options',
|
94 |
+
'value' => $texts['reset_button'],
|
95 |
+
'class' => 'button-secondary button-large submit-button-reset',
|
96 |
+
)),
|
97 |
+
fw_html_tag('input', array(
|
98 |
+
'type' => 'submit',
|
99 |
+
'name' => '_fw_save_options',
|
100 |
+
'value' => $texts['save_button'],
|
101 |
+
'class' => 'button-primary button-large submit-button-save',
|
102 |
+
))
|
103 |
+
))
|
104 |
+
);
|
105 |
?>
|
106 |
</div>
|
107 |
</div>
|
119 |
|
120 |
<div class="form-footer-buttons">
|
121 |
<!-- This div is required to follow after options in order to have special styles in case options will contain tabs (css adjacent selector + ) -->
|
122 |
+
<?php echo implode(
|
123 |
+
$side_tabs ? ' ' : ' ',
|
124 |
+
apply_filters('fw_settings_form_footer_buttons', array(
|
125 |
+
fw_html_tag('input', array(
|
126 |
+
'type' => 'submit',
|
127 |
+
'name' => '_fw_save_options',
|
128 |
+
'value' => $texts['save_button'],
|
129 |
+
'class' => 'button-primary button-large',
|
130 |
+
)),
|
131 |
+
fw_html_tag('input', array(
|
132 |
+
'type' => 'submit',
|
133 |
+
'name' => '_fw_reset_options',
|
134 |
+
'value' => $texts['reset_button'],
|
135 |
+
'class' => 'button-secondary button-large',
|
136 |
+
))
|
137 |
+
))
|
138 |
+
); ?>
|
139 |
</div>
|
140 |
|
141 |
<!-- focus tab -->
|
211 |
|
212 |
<?php if ($ajax_submit): ?>
|
213 |
<!-- ajax submit -->
|
214 |
+
<div id="fw-settings-form-ajax-save-extra-message"
|
215 |
+
data-html="<?php echo fw_htmlspecialchars(apply_filters('fw_settings_form_ajax_save_loading_extra_message', '')) ?>"></div>
|
216 |
<script type="text/javascript">
|
217 |
jQuery(function ($) {
|
218 |
function isReset($submitButton) {
|
219 |
return $submitButton.length && $submitButton.attr('name') == '<?php echo esc_js($reset_input_name) ?>';
|
220 |
}
|
221 |
|
222 |
+
var formSelector = 'form[data-fw-form-id="fw_settings"]',
|
223 |
+
loadingExtraMessage = $('#fw-settings-form-ajax-save-extra-message').attr('data-html');
|
224 |
|
225 |
fwForm.initAjaxSubmit({
|
226 |
selector: formSelector,
|
239 |
description =
|
240 |
'<?php echo esc_js(__('We are currently saving your settings.', 'fw')) ?>'+
|
241 |
'<br/>'+
|
242 |
+
'<?php echo esc_js(__('This may take a few moments.', 'fw')); ?>';
|
243 |
}
|
244 |
|
245 |
fw.soleModal.show(
|
246 |
'fw-options-ajax-save-loading',
|
247 |
'<h2 class="fw-text-muted">'+
|
248 |
+
'<img src="'+ fw.img.loadingSpinner +'" alt="Loading" class="wp-spinner" /> '+
|
249 |
title +
|
250 |
'</h2>'+
|
251 |
+
'<p class="fw-text-muted"><em>'+ description +'</em></p>'+ loadingExtraMessage,
|
252 |
{
|
253 |
autoHide: 60000,
|
254 |
allowClose: false
|
261 |
onErrors: function() {
|
262 |
fw.soleModal.hide('fw-options-ajax-save-loading');
|
263 |
},
|
264 |
+
onAjaxError: function(elements, data) {
|
265 |
fw.soleModal.hide('fw-options-ajax-save-loading');
|
266 |
+
fw.soleModal.show(
|
267 |
+
'fw-options-ajax-save-error',
|
268 |
+
'<p class="fw-text-danger">'+ String(data.errorThrown) +'</p>'
|
269 |
+
);
|
270 |
},
|
271 |
onSuccess: function(elements, ajaxData) {
|
272 |
/**
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: unyson, themefusecom
|
|
3 |
Tags: page builder, cms, grid, layout, responsive, back up, backup, db backup, dump, migrate, schedule, search engine optimization, seo, media, slideshow, shortcode, slide, slideshare, slideshow, google sitemaps, sitemaps, analytics, google analytics, calendar, event, events, google maps, learning, lessons, sidebars, breadcrumbs, review, portfolio, framework
|
4 |
Requires at least: 4.0.0
|
5 |
Tested up to: 4.3
|
6 |
-
Stable tag: 2.4.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -82,6 +82,19 @@ Yes; Unyson will work with any theme.
|
|
82 |
|
83 |
== Changelog ==
|
84 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
= 2.4.9 =
|
86 |
* Fixed [#889](https://github.com/ThemeFuse/Unyson/issues/889) Some scripts/styles were enqueued too early
|
87 |
* Minor fixes and improvements ([diff](https://github.com/ThemeFuse/Unyson/compare/v2.4.8...v2.4.9))
|
3 |
Tags: page builder, cms, grid, layout, responsive, back up, backup, db backup, dump, migrate, schedule, search engine optimization, seo, media, slideshow, shortcode, slide, slideshare, slideshow, google sitemaps, sitemaps, analytics, google analytics, calendar, event, events, google maps, learning, lessons, sidebars, breadcrumbs, review, portfolio, framework
|
4 |
Requires at least: 4.0.0
|
5 |
Tested up to: 4.3
|
6 |
+
Stable tag: 2.4.10
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
82 |
|
83 |
== Changelog ==
|
84 |
|
85 |
+
= 2.4.10 =
|
86 |
+
* New extension: [Backup & Demo Content](http://manual.unyson.io/en/latest/extension/backups/#content) *(Note: It will not be visible in extensions list if old Backup extension is set as supported in [theme manifest](http://manual.unyson.io/en/latest/manifest/theme.html#content))*
|
87 |
+
* Soft removed 3 extensions: Styling, Translation, Learning [#874](https://github.com/ThemeFuse/Unyson/issues/874)
|
88 |
+
* Added option type `short-slider` (same as `slider`, but it's smaller)
|
89 |
+
* Fixed html validation error. Added current url in `FW_Form` `<form action="...">`
|
90 |
+
* Option type `upload`: Added `files_ext` and `extra_mime_types` parameters ([docs](http://manual.unyson.io/en/latest/options/built-in-option-types.html#upload))
|
91 |
+
* `fw.Modal`: added `headerElements` attribute to set html elements in modal header
|
92 |
+
* `fw.soleModal`: added `backdrop: null|bool` parameter to set backdrop transparent, white or dark
|
93 |
+
* Added classes: `FW_Type` and `FW_Type_Register` *(used in the new Backup extension)*
|
94 |
+
* Fixed [#993](https://github.com/ThemeFuse/Unyson/issues/993)
|
95 |
+
* RTL fixes
|
96 |
+
* Other minor fixes ([the diff](https://github.com/ThemeFuse/Unyson/compare/v2.4.9...v2.4.10))
|
97 |
+
|
98 |
= 2.4.9 =
|
99 |
* Fixed [#889](https://github.com/ThemeFuse/Unyson/issues/889) Some scripts/styles were enqueued too early
|
100 |
* Minor fixes and improvements ([diff](https://github.com/ThemeFuse/Unyson/compare/v2.4.8...v2.4.9))
|
unyson.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Unyson
|
4 |
* Plugin URI: http://unyson.io/
|
5 |
* Description: A free drag & drop framework that comes with a bunch of built in extensions that will help you develop premium themes fast & easy.
|
6 |
-
* Version: 2.4.
|
7 |
* Author: ThemeFuse
|
8 |
* Author URI: http://themefuse.com
|
9 |
* License: GPL2+
|
3 |
* Plugin Name: Unyson
|
4 |
* Plugin URI: http://unyson.io/
|
5 |
* Description: A free drag & drop framework that comes with a bunch of built in extensions that will help you develop premium themes fast & easy.
|
6 |
+
* Version: 2.4.10
|
7 |
* Author: ThemeFuse
|
8 |
* Author URI: http://themefuse.com
|
9 |
* License: GPL2+
|