Version Description
- Resolved hammer warning
- Added Post Duplicator integration
- Added custom Display settings
- Ticker Display vertical scrolling updates
- dittyUpdateItems javascript bug fix
Download this release
Release Info
Developer | metaphorcreations |
Plugin | Ditty News Ticker |
Version | 3.0.10 |
Comparing to | |
See all releases |
Code changes from version 3.0.9 to 3.0.10
- ditty-news-ticker.php +2 -2
- includes/class-ditty-display-type-list.php +18 -16
- includes/class-ditty-display-type-ticker.php +5 -3
- includes/class-ditty-item-type-posts-lite.php +1 -1
- includes/class-ditty-singles.php +42 -15
- includes/class-ditty.php +2 -2
- includes/helpers.php +57 -28
- includes/js/class-ditty-display-ticker.js +4 -8
- includes/js/class-ditty-display-ticker.min.js +1 -1
- includes/js/ditty-editor.min.js +0 -1
- includes/js/ditty.js +2 -1
- includes/js/ditty.min.js +8 -3
- includes/js/editor/ditty-ticker-display-editor.js +0 -1
- includes/js/partials/helpers.js +6 -2
- includes/libs/hammer.min.js +1 -2
- readme.txt +10 -3
ditty-news-ticker.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin Name: Ditty (formerly Ditty News Ticker)
|
5 |
* Plugin URI: https://www.metaphorcreations.com/ditty
|
6 |
* Description: Formerly Ditty News Ticker. Ditty is a multi-functional data display plugin.
|
7 |
-
* Version: 3.0.
|
8 |
* Author: Metaphor Creations
|
9 |
* Author URI: https://www.metaphorcreations.com
|
10 |
* License: GPL-2.0+
|
@@ -20,7 +20,7 @@ if ( ! defined( 'WPINC' ) ) {
|
|
20 |
|
21 |
// Plugin version.
|
22 |
if ( ! defined( 'DITTY_VERSION' ) ) {
|
23 |
-
define( 'DITTY_VERSION', '3.0.
|
24 |
}
|
25 |
|
26 |
// Plugin Folder Path.
|
4 |
* Plugin Name: Ditty (formerly Ditty News Ticker)
|
5 |
* Plugin URI: https://www.metaphorcreations.com/ditty
|
6 |
* Description: Formerly Ditty News Ticker. Ditty is a multi-functional data display plugin.
|
7 |
+
* Version: 3.0.10
|
8 |
* Author: Metaphor Creations
|
9 |
* Author URI: https://www.metaphorcreations.com
|
10 |
* License: GPL-2.0+
|
20 |
|
21 |
// Plugin version.
|
22 |
if ( ! defined( 'DITTY_VERSION' ) ) {
|
23 |
+
define( 'DITTY_VERSION', '3.0.10' );
|
24 |
}
|
25 |
|
26 |
// Plugin Folder Path.
|
includes/class-ditty-display-type-list.php
CHANGED
@@ -228,23 +228,25 @@ class Ditty_Display_Type_List extends Ditty_Display_Type {
|
|
228 |
'contentStyles' => parent::content_style_settings( $values ),
|
229 |
'pageStyles' => parent::page_style_settings( $values ),
|
230 |
'itemStyles' => parent::item_style_settings( $values ),
|
231 |
-
// 'importExportSettings' => array(
|
232 |
-
// 'type' => 'group',
|
233 |
-
// 'id' => 'importExportSettings',
|
234 |
-
// 'collapsible' => true,
|
235 |
-
// 'default_state' => 'collapsed',
|
236 |
-
// 'multiple_fields' => true,
|
237 |
-
// 'name' => __( 'Import/Export', 'ditty-news-ticker' ),
|
238 |
-
// 'help' => __( 'Import or export the display settings.', 'ditty-news-ticker' ),
|
239 |
-
// 'fields' => array(
|
240 |
-
// 'importExport' => array(
|
241 |
-
// 'type' => 'html',
|
242 |
-
// 'id' => 'importExport',
|
243 |
-
// 'std' => parent::import_export_settings( $values ),
|
244 |
-
// ),
|
245 |
-
// ),
|
246 |
-
// ),
|
247 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
248 |
return $fields;
|
249 |
}
|
250 |
|
228 |
'contentStyles' => parent::content_style_settings( $values ),
|
229 |
'pageStyles' => parent::page_style_settings( $values ),
|
230 |
'itemStyles' => parent::item_style_settings( $values ),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
);
|
232 |
+
if ( WP_DEBUG ) {
|
233 |
+
$fields['importExportSettings'] = array(
|
234 |
+
'type' => 'group',
|
235 |
+
'id' => 'importExportSettings',
|
236 |
+
'collapsible' => true,
|
237 |
+
'default_state' => 'collapsed',
|
238 |
+
'multiple_fields' => true,
|
239 |
+
'name' => __( 'Import/Export', 'ditty-news-ticker' ),
|
240 |
+
'help' => __( 'Import or export the display settings.', 'ditty-news-ticker' ),
|
241 |
+
'fields' => array(
|
242 |
+
'importExport' => array(
|
243 |
+
'type' => 'html',
|
244 |
+
'id' => 'importExport',
|
245 |
+
'std' => parent::import_export_settings( $values ),
|
246 |
+
),
|
247 |
+
),
|
248 |
+
);
|
249 |
+
}
|
250 |
return $fields;
|
251 |
}
|
252 |
|
includes/class-ditty-display-type-ticker.php
CHANGED
@@ -176,7 +176,9 @@ class Ditty_Display_Type_Ticker extends Ditty_Display_Type {
|
|
176 |
'std' => isset( $values['itemElementsWrap'] ) ? $values['itemElementsWrap'] : false,
|
177 |
),
|
178 |
) ),
|
179 |
-
|
|
|
|
|
180 |
'type' => 'group',
|
181 |
'id' => 'importExportSettings',
|
182 |
'collapsible' => true,
|
@@ -191,8 +193,8 @@ class Ditty_Display_Type_Ticker extends Ditty_Display_Type {
|
|
191 |
'std' => parent::import_export_settings( $values ),
|
192 |
),
|
193 |
),
|
194 |
-
)
|
195 |
-
|
196 |
return $fields;
|
197 |
}
|
198 |
|
176 |
'std' => isset( $values['itemElementsWrap'] ) ? $values['itemElementsWrap'] : false,
|
177 |
),
|
178 |
) ),
|
179 |
+
);
|
180 |
+
if ( WP_DEBUG ) {
|
181 |
+
$fields['importExportSettings'] = array(
|
182 |
'type' => 'group',
|
183 |
'id' => 'importExportSettings',
|
184 |
'collapsible' => true,
|
193 |
'std' => parent::import_export_settings( $values ),
|
194 |
),
|
195 |
),
|
196 |
+
);
|
197 |
+
}
|
198 |
return $fields;
|
199 |
}
|
200 |
|
includes/class-ditty-item-type-posts-lite.php
CHANGED
@@ -27,7 +27,7 @@ class Ditty_Item_Type_Posts_Lite extends Ditty_Item_Type {
|
|
27 |
*/
|
28 |
public function prepare_items( $meta ) {
|
29 |
$item_value = maybe_unserialize( $meta['item_value'] );
|
30 |
-
|
31 |
// Set the query args
|
32 |
$query_args = array(
|
33 |
'posts_per_page' => $item_value['limit'],
|
27 |
*/
|
28 |
public function prepare_items( $meta ) {
|
29 |
$item_value = maybe_unserialize( $meta['item_value'] );
|
30 |
+
|
31 |
// Set the query args
|
32 |
$query_args = array(
|
33 |
'posts_per_page' => $item_value['limit'],
|
includes/class-ditty-singles.php
CHANGED
@@ -31,6 +31,7 @@ class Ditty_Singles {
|
|
31 |
|
32 |
// General hooks
|
33 |
add_filter( 'post_row_actions', array( $this, 'modify_list_row_actions' ), 10, 2 );
|
|
|
34 |
|
35 |
// Editor elements
|
36 |
add_action( 'ditty_editor_tabs', array( $this, 'editor_tab' ), 100, 2 );
|
@@ -41,8 +42,7 @@ class Ditty_Singles {
|
|
41 |
add_filter( 'get_user_option_screen_layout_ditty', array( $this, 'force_post_layout' ) );
|
42 |
add_filter( 'screen_options_show_screen', array( $this, 'remove_screen_options' ), 10, 2 );
|
43 |
|
44 |
-
|
45 |
-
|
46 |
add_shortcode( 'ditty', array( $this, 'do_shortcode' ) );
|
47 |
|
48 |
// Ajax
|
@@ -247,6 +247,27 @@ class Ditty_Singles {
|
|
247 |
<?php
|
248 |
}
|
249 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
250 |
/**
|
251 |
* Add the post ID to the list row actions
|
252 |
*
|
@@ -372,13 +393,15 @@ class Ditty_Singles {
|
|
372 |
* Return data for a Ditty to load via ajax
|
373 |
*
|
374 |
* @access public
|
375 |
-
* @since 3.0
|
376 |
*/
|
377 |
public function init_ajax() {
|
378 |
check_ajax_referer( 'ditty', 'security' );
|
379 |
$id_ajax = isset( $_POST['id'] ) ? intval( $_POST['id'] ) : false;
|
|
|
380 |
$display_ajax = isset( $_POST['display'] ) ? esc_attr( $_POST['display'] ) : false;
|
381 |
$display_settings_ajax = isset( $_POST['display_settings'] ) ? esc_attr( $_POST['display_settings'] ) : false;
|
|
|
382 |
$editor_ajax = isset( $_POST['editor'] ) ? intval( $_POST['editor'] ) : false;
|
383 |
$load_type = isset( $_POST['loud_type'] ) ? intval( $_POST['loud_type'] ) : '';
|
384 |
|
@@ -394,14 +417,15 @@ class Ditty_Singles {
|
|
394 |
|
395 |
// Setup the ditty values
|
396 |
$status = get_post_status( $id_ajax );
|
397 |
-
$args
|
398 |
-
$args['id']
|
399 |
-
$args['
|
400 |
-
$args['
|
401 |
-
$args['
|
|
|
402 |
$args['showEditor'] = $editor_ajax;
|
403 |
-
|
404 |
-
$items = ditty_display_items( $id_ajax, $load_type );
|
405 |
if ( ! is_array( $items ) ) {
|
406 |
$items = array();
|
407 |
}
|
@@ -421,7 +445,7 @@ class Ditty_Singles {
|
|
421 |
* Return data for a Ditty to load via ajax
|
422 |
*
|
423 |
* @access public
|
424 |
-
* @since 3.0
|
425 |
*/
|
426 |
public function init( $atts ) {
|
427 |
if ( ! $atts['data-id'] ) {
|
@@ -429,9 +453,10 @@ class Ditty_Singles {
|
|
429 |
}
|
430 |
|
431 |
$ditty_id = $atts['data-id'];
|
432 |
-
$uniqid = $atts['data-uniqid'];
|
433 |
$display_id = isset( $atts['data-display'] ) ? $atts['data-display'] : false;
|
434 |
$display_settings = isset( $atts['data-display_settings'] ) ? $atts['data-display_settings'] : false;
|
|
|
435 |
$show_editor = isset( $atts['data-show_editor'] ) ? $atts['data-show_editor'] : false;
|
436 |
$load_type = isset( $atts['load_type'] ) ? $atts['load_type'] : '';
|
437 |
|
@@ -443,18 +468,20 @@ class Ditty_Singles {
|
|
443 |
$display_id = ditty_default_display( $ditty_id );
|
444 |
}
|
445 |
$display = new Ditty_Display( $display_id );
|
|
|
446 |
|
447 |
// Setup the ditty values
|
448 |
$status = get_post_status( $ditty_id );
|
449 |
$args = $display->get_values();
|
450 |
|
451 |
$args['id'] = $ditty_id;
|
|
|
452 |
$args['title'] = ( 'auto-draft' == $status ) ? '' : get_the_title( $ditty_id );
|
453 |
$args['status'] = $status;
|
454 |
$args['display'] = $display->get_display_id();
|
455 |
$args['showEditor'] = $show_editor;
|
456 |
-
|
457 |
-
$items = ditty_display_items( $ditty_id, $load_type );
|
458 |
if ( ! is_array( $items ) ) {
|
459 |
$items = array();
|
460 |
}
|
@@ -464,7 +491,7 @@ class Ditty_Singles {
|
|
464 |
do_action( 'ditty_init', $ditty_id );
|
465 |
|
466 |
?>
|
467 |
-
$( 'div[data-uniqid="<?php echo $uniqid; ?>"]' ).ditty_<?php echo $
|
468 |
<?php
|
469 |
}
|
470 |
|
31 |
|
32 |
// General hooks
|
33 |
add_filter( 'post_row_actions', array( $this, 'modify_list_row_actions' ), 10, 2 );
|
34 |
+
add_action( 'mtphr_post_duplicator_created', array( $this, 'after_duplicate_post' ), 10, 3 );
|
35 |
|
36 |
// Editor elements
|
37 |
add_action( 'ditty_editor_tabs', array( $this, 'editor_tab' ), 100, 2 );
|
42 |
add_filter( 'get_user_option_screen_layout_ditty', array( $this, 'force_post_layout' ) );
|
43 |
add_filter( 'screen_options_show_screen', array( $this, 'remove_screen_options' ), 10, 2 );
|
44 |
|
45 |
+
// Shortcodes
|
|
|
46 |
add_shortcode( 'ditty', array( $this, 'do_shortcode' ) );
|
47 |
|
48 |
// Ajax
|
247 |
<?php
|
248 |
}
|
249 |
|
250 |
+
/**
|
251 |
+
* Duplicate Ditty items on Post Duplicator duplication
|
252 |
+
*
|
253 |
+
* @since 3.0.10
|
254 |
+
* @return void
|
255 |
+
*/
|
256 |
+
public function after_duplicate_post( $original_id, $duplicate_id, $settings ) {
|
257 |
+
if ( 'ditty' == get_post_type( $original_id ) && 'ditty' == get_post_type( $duplicate_id ) ) {
|
258 |
+
|
259 |
+
// Duplicate and add original Ditty items
|
260 |
+
$all_meta = Ditty()->db_items->get_items( $original_id );
|
261 |
+
if ( is_array( $all_meta ) && count( $all_meta ) > 0 ) {
|
262 |
+
foreach ( $all_meta as $i => $meta ) {
|
263 |
+
unset( $meta->item_id );
|
264 |
+
$meta->ditty_id = $duplicate_id;
|
265 |
+
Ditty()->db_items->insert( $meta, 'item' );
|
266 |
+
}
|
267 |
+
}
|
268 |
+
}
|
269 |
+
}
|
270 |
+
|
271 |
/**
|
272 |
* Add the post ID to the list row actions
|
273 |
*
|
393 |
* Return data for a Ditty to load via ajax
|
394 |
*
|
395 |
* @access public
|
396 |
+
* @since 3.0.10
|
397 |
*/
|
398 |
public function init_ajax() {
|
399 |
check_ajax_referer( 'ditty', 'security' );
|
400 |
$id_ajax = isset( $_POST['id'] ) ? intval( $_POST['id'] ) : false;
|
401 |
+
$uniqid_ajax = isset( $_POST['uniqid'] ) ? esc_attr( $_POST['uniqid'] ) : false;
|
402 |
$display_ajax = isset( $_POST['display'] ) ? esc_attr( $_POST['display'] ) : false;
|
403 |
$display_settings_ajax = isset( $_POST['display_settings'] ) ? esc_attr( $_POST['display_settings'] ) : false;
|
404 |
+
$layout_settings_ajax = isset( $_POST['layout_settings'] ) ? esc_attr( $_POST['layout_settings'] ) : false;
|
405 |
$editor_ajax = isset( $_POST['editor'] ) ? intval( $_POST['editor'] ) : false;
|
406 |
$load_type = isset( $_POST['loud_type'] ) ? intval( $_POST['loud_type'] ) : '';
|
407 |
|
417 |
|
418 |
// Setup the ditty values
|
419 |
$status = get_post_status( $id_ajax );
|
420 |
+
$args = $display->get_values();
|
421 |
+
$args['id'] = $id_ajax;
|
422 |
+
$args['uniqid'] = $uniqid_ajax;
|
423 |
+
$args['title'] = ( 'auto-draft' == $status ) ? '' : get_the_title( $id_ajax );
|
424 |
+
$args['status'] = $status;
|
425 |
+
$args['display'] = $display->get_display_id();
|
426 |
$args['showEditor'] = $editor_ajax;
|
427 |
+
|
428 |
+
$items = ditty_display_items( $id_ajax, $load_type, $layout_settings_ajax );
|
429 |
if ( ! is_array( $items ) ) {
|
430 |
$items = array();
|
431 |
}
|
445 |
* Return data for a Ditty to load via ajax
|
446 |
*
|
447 |
* @access public
|
448 |
+
* @since 3.0.10
|
449 |
*/
|
450 |
public function init( $atts ) {
|
451 |
if ( ! $atts['data-id'] ) {
|
453 |
}
|
454 |
|
455 |
$ditty_id = $atts['data-id'];
|
456 |
+
$uniqid = isset( $atts['data-uniqid'] ) ? $atts['data-uniqid'] : false;
|
457 |
$display_id = isset( $atts['data-display'] ) ? $atts['data-display'] : false;
|
458 |
$display_settings = isset( $atts['data-display_settings'] ) ? $atts['data-display_settings'] : false;
|
459 |
+
$layout_settings = isset( $atts['data-layout_settings'] ) ? $atts['data-layout_settings'] : false;
|
460 |
$show_editor = isset( $atts['data-show_editor'] ) ? $atts['data-show_editor'] : false;
|
461 |
$load_type = isset( $atts['load_type'] ) ? $atts['load_type'] : '';
|
462 |
|
468 |
$display_id = ditty_default_display( $ditty_id );
|
469 |
}
|
470 |
$display = new Ditty_Display( $display_id );
|
471 |
+
$display_type = $display->get_display_type();
|
472 |
|
473 |
// Setup the ditty values
|
474 |
$status = get_post_status( $ditty_id );
|
475 |
$args = $display->get_values();
|
476 |
|
477 |
$args['id'] = $ditty_id;
|
478 |
+
$args['uniqid'] = $uniqid;
|
479 |
$args['title'] = ( 'auto-draft' == $status ) ? '' : get_the_title( $ditty_id );
|
480 |
$args['status'] = $status;
|
481 |
$args['display'] = $display->get_display_id();
|
482 |
$args['showEditor'] = $show_editor;
|
483 |
+
|
484 |
+
$items = ditty_display_items( $ditty_id, $load_type, $layout_settings );
|
485 |
if ( ! is_array( $items ) ) {
|
486 |
$items = array();
|
487 |
}
|
491 |
do_action( 'ditty_init', $ditty_id );
|
492 |
|
493 |
?>
|
494 |
+
$( 'div[data-uniqid="<?php echo esc_attr( $uniqid ); ?>"]' ).ditty_<?php echo esc_attr( $display_type ); ?>(<?php echo json_encode( $args ); ?>);
|
495 |
<?php
|
496 |
}
|
497 |
|
includes/class-ditty.php
CHANGED
@@ -425,9 +425,9 @@ class Ditty {
|
|
425 |
*/
|
426 |
public function enqueue_styles() {
|
427 |
wp_enqueue_style( 'ditty', DITTY_URL . 'includes/css/ditty.css', array(), $this->version, 'all' );
|
|
|
428 |
|
429 |
if ( current_user_can( 'edit_dittys' ) || current_user_can( 'edit_ditty_layouts' ) ) {
|
430 |
-
wp_enqueue_style( 'fontawesome', 'https://use.fontawesome.com/releases/v5.15.3/css/all.css', false, '5.15.3', false );
|
431 |
wp_enqueue_style( 'wp-codemirror' );
|
432 |
wp_enqueue_style( 'protip', DITTY_URL . 'includes/libs/protip/protip.min.css', false, '1.4.21', false );
|
433 |
wp_enqueue_style( 'ion-rangeslider', DITTY_URL . 'includes/libs/ion.rangeSlider/css/ion.rangeSlider.min.css', false, '2.3.1', false );
|
@@ -458,7 +458,7 @@ class Ditty {
|
|
458 |
public function enqueue_scripts( $hook ) {
|
459 |
$min = WP_DEBUG ? '' : '.min';
|
460 |
|
461 |
-
wp_register_script( 'hammer', DITTY_URL . 'includes/libs/hammer.min.js', array( 'jquery' ), '2.0.8', true );
|
462 |
wp_register_script( 'protip', DITTY_URL . 'includes/libs/protip/protip.min.js', array( 'jquery' ), '1.4.21', true );
|
463 |
wp_register_script( 'ditty', DITTY_URL . 'includes/js/ditty.min.js', array( 'jquery', 'jquery-effects-core', ), $this->version, true );
|
464 |
wp_add_inline_script( 'ditty', 'const dittyVars = ' . json_encode( array(
|
425 |
*/
|
426 |
public function enqueue_styles() {
|
427 |
wp_enqueue_style( 'ditty', DITTY_URL . 'includes/css/ditty.css', array(), $this->version, 'all' );
|
428 |
+
wp_enqueue_style( 'fontawesome', 'https://use.fontawesome.com/releases/v5.15.3/css/all.css', false, '5.15.3', false );
|
429 |
|
430 |
if ( current_user_can( 'edit_dittys' ) || current_user_can( 'edit_ditty_layouts' ) ) {
|
|
|
431 |
wp_enqueue_style( 'wp-codemirror' );
|
432 |
wp_enqueue_style( 'protip', DITTY_URL . 'includes/libs/protip/protip.min.css', false, '1.4.21', false );
|
433 |
wp_enqueue_style( 'ion-rangeslider', DITTY_URL . 'includes/libs/ion.rangeSlider/css/ion.rangeSlider.min.css', false, '2.3.1', false );
|
458 |
public function enqueue_scripts( $hook ) {
|
459 |
$min = WP_DEBUG ? '' : '.min';
|
460 |
|
461 |
+
wp_register_script( 'hammer', DITTY_URL . 'includes/libs/hammer.min.js', array( 'jquery' ), '2.0.8.1', true );
|
462 |
wp_register_script( 'protip', DITTY_URL . 'includes/libs/protip/protip.min.js', array( 'jquery' ), '1.4.21', true );
|
463 |
wp_register_script( 'ditty', DITTY_URL . 'includes/js/ditty.min.js', array( 'jquery', 'jquery-effects-core', ), $this->version, true );
|
464 |
wp_add_inline_script( 'ditty', 'const dittyVars = ' . json_encode( array(
|
includes/helpers.php
CHANGED
@@ -873,34 +873,63 @@ function ditty_type_exists( $slug ) {
|
|
873 |
return array_key_exists( $slug, $item_types );
|
874 |
}
|
875 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
876 |
/**
|
877 |
* Return display items for a specific Ditty
|
878 |
*
|
879 |
-
* @since 3.0
|
880 |
* @access public
|
881 |
* @var array $display_items Array of item objects
|
882 |
*/
|
883 |
-
function ditty_display_items( $ditty_id, $load_type = false ) {
|
884 |
$transient_name = "ditty_display_items_{$ditty_id}";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
885 |
$display_items = get_transient( $transient_name );
|
886 |
if ( ! $display_items || 'force' == $load_type ) {
|
887 |
$display_items = array();
|
888 |
$items_meta = ditty_items_meta( $ditty_id );
|
889 |
-
|
890 |
-
// Add new draft meta
|
891 |
-
// if ( $draft_values = ditty_get_draft_values() ) {
|
892 |
-
// if ( isset( $draft_values['items'] ) && is_array( $draft_values['items'] ) && count( $draft_values['items'] ) > 0 ) {
|
893 |
-
// foreach ( $draft_values['items'] as $i => $draft_item_meta ) {
|
894 |
-
// if ( ! isset( $draft_item_meta['data'] ) || ! isset( $draft_item_meta['data']['item_id'] ) ) {
|
895 |
-
// continue;
|
896 |
-
// }
|
897 |
-
// if ( false !== strpos( $draft_item_meta['data']['item_id'], 'new-' ) ) {
|
898 |
-
// $items_meta[] = $draft_item_meta['data'];
|
899 |
-
// }
|
900 |
-
// }
|
901 |
-
// }
|
902 |
-
// }
|
903 |
-
|
904 |
if ( empty( $items_meta) && 'auto-draft' == get_post_status( $ditty_id ) ) {
|
905 |
$items_meta = array( ditty_get_new_item_meta( $ditty_id ) );
|
906 |
}
|
@@ -910,17 +939,15 @@ function ditty_display_items( $ditty_id, $load_type = false ) {
|
|
910 |
$meta = ( array ) $meta;
|
911 |
}
|
912 |
|
913 |
-
//
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
// }
|
923 |
-
|
924 |
$prepared_items = ditty_prepare_display_items( $meta );
|
925 |
if ( is_array( $prepared_items ) && count( $prepared_items ) > 0 ) {
|
926 |
foreach ( $prepared_items as $i => $prepared_meta ) {
|
@@ -1196,6 +1223,7 @@ function ditty_render( $atts ) {
|
|
1196 |
'id' => '',
|
1197 |
'display' => '',
|
1198 |
'display_settings' => '',
|
|
|
1199 |
'uniqid' => '',
|
1200 |
'class' => '',
|
1201 |
'show_editor' => 0,
|
@@ -1235,6 +1263,7 @@ function ditty_render( $atts ) {
|
|
1235 |
'data-uniqid' => $args['uniqid'],
|
1236 |
'data-display' => ( '' != $args['display'] ) ? $args['display'] : false,
|
1237 |
'data-display_settings' => ( '' != $args['display_settings'] ) ? $args['display_settings'] : false,
|
|
|
1238 |
'data-show_editor' => ( 0 != intval( $args['show_editor'] ) ) ? '1' : false,
|
1239 |
'data-load_type' => ( '' != $args['load_type'] ) ? $args['load_type'] : false,
|
1240 |
'data-ajax_load' => $ajax_load,
|
873 |
return array_key_exists( $slug, $item_types );
|
874 |
}
|
875 |
|
876 |
+
/**
|
877 |
+
* Parse custom layouts into an array
|
878 |
+
*
|
879 |
+
* @since 3.0.10
|
880 |
+
* @access public
|
881 |
+
* @var bool
|
882 |
+
*/
|
883 |
+
function ditty_parse_custom_layouts( $layout_settings ) {
|
884 |
+
$layouts = array();
|
885 |
+
if ( ctype_digit( $layout_settings ) ) {
|
886 |
+
$variation_array = array(
|
887 |
+
'default' => $layout_settings,
|
888 |
+
);
|
889 |
+
$layouts['all'] = maybe_serialize( $variation_array );
|
890 |
+
} else {
|
891 |
+
parse_str( html_entity_decode( $layout_settings ), $custom_layout_settings );
|
892 |
+
if ( is_array( $custom_layout_settings ) && count( $custom_layout_settings ) > 0 ) {
|
893 |
+
foreach ( $custom_layout_settings as $item_type => $variations ) {
|
894 |
+
$variation = explode( '|', $variations );
|
895 |
+
if ( is_array( $variation ) && count( $variation ) > 0 ) {
|
896 |
+
$variation_array = array();
|
897 |
+
foreach ( $variation as $variation_data ) {
|
898 |
+
$varation_values = explode( ':', $variation_data );
|
899 |
+
if ( count( $varation_values ) > 1 ) {
|
900 |
+
$variation_array[$varation_values[0]] = $varation_values[1];
|
901 |
+
}
|
902 |
+
}
|
903 |
+
$layouts[$item_type] = maybe_serialize( $variation_array );
|
904 |
+
}
|
905 |
+
}
|
906 |
+
}
|
907 |
+
}
|
908 |
+
return $layouts;
|
909 |
+
}
|
910 |
+
|
911 |
/**
|
912 |
* Return display items for a specific Ditty
|
913 |
*
|
914 |
+
* @since 3.0.10
|
915 |
* @access public
|
916 |
* @var array $display_items Array of item objects
|
917 |
*/
|
918 |
+
function ditty_display_items( $ditty_id, $load_type = false, $custom_layouts = false ) {
|
919 |
$transient_name = "ditty_display_items_{$ditty_id}";
|
920 |
+
|
921 |
+
// Check for custom layouts
|
922 |
+
$custom_layout_array = array();
|
923 |
+
if ( $custom_layouts ) {
|
924 |
+
$transient_name .= "_{$custom_layouts}";
|
925 |
+
$custom_layout_array = ditty_parse_custom_layouts( $custom_layouts );
|
926 |
+
}
|
927 |
+
|
928 |
+
// Check for cached display items
|
929 |
$display_items = get_transient( $transient_name );
|
930 |
if ( ! $display_items || 'force' == $load_type ) {
|
931 |
$display_items = array();
|
932 |
$items_meta = ditty_items_meta( $ditty_id );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
933 |
if ( empty( $items_meta) && 'auto-draft' == get_post_status( $ditty_id ) ) {
|
934 |
$items_meta = array( ditty_get_new_item_meta( $ditty_id ) );
|
935 |
}
|
939 |
$meta = ( array ) $meta;
|
940 |
}
|
941 |
|
942 |
+
// Add custom layouts
|
943 |
+
if ( ! empty( $custom_layout_array ) ) {
|
944 |
+
if ( isset( $custom_layout_array['all'] ) ) {
|
945 |
+
$meta['layout_value'] = $custom_layout_array['all'];
|
946 |
+
} elseif ( isset( $custom_layout_array[$meta['item_type']] ) ) {
|
947 |
+
$meta['layout_value'] = $custom_layout_array[$meta['item_type']];
|
948 |
+
}
|
949 |
+
}
|
950 |
+
|
|
|
|
|
951 |
$prepared_items = ditty_prepare_display_items( $meta );
|
952 |
if ( is_array( $prepared_items ) && count( $prepared_items ) > 0 ) {
|
953 |
foreach ( $prepared_items as $i => $prepared_meta ) {
|
1223 |
'id' => '',
|
1224 |
'display' => '',
|
1225 |
'display_settings' => '',
|
1226 |
+
'layout_settings' => '',
|
1227 |
'uniqid' => '',
|
1228 |
'class' => '',
|
1229 |
'show_editor' => 0,
|
1263 |
'data-uniqid' => $args['uniqid'],
|
1264 |
'data-display' => ( '' != $args['display'] ) ? $args['display'] : false,
|
1265 |
'data-display_settings' => ( '' != $args['display_settings'] ) ? $args['display_settings'] : false,
|
1266 |
+
'data-layout_settings' => ( '' != $args['layout_settings'] ) ? $args['layout_settings'] : false,
|
1267 |
'data-show_editor' => ( 0 != intval( $args['show_editor'] ) ) ? '1' : false,
|
1268 |
'data-load_type' => ( '' != $args['load_type'] ) ? $args['load_type'] : false,
|
1269 |
'data-ajax_load' => $ajax_load,
|
includes/js/class-ditty-display-ticker.js
CHANGED
@@ -849,22 +849,17 @@
|
|
849 |
this.$contents.css( this.settings.contentsBorderWidth );
|
850 |
|
851 |
if ( 'up' === this.settings.direction || 'down' === this.settings.direction ) {
|
852 |
-
var
|
853 |
-
minHeight = this.settings.minHeight ? this.settings.minHeight : 0,
|
854 |
maxHeight = this.settings.maxHeight ? this.settings.maxHeight : 'none';
|
855 |
this.$items.css( {
|
856 |
-
height: height,
|
857 |
minHeight: minHeight,
|
858 |
maxHeight: maxHeight
|
859 |
} );
|
860 |
-
//this.$contents.css( { height: height } );
|
861 |
} else {
|
862 |
this.$items.css( {
|
863 |
-
height: 'auto',
|
864 |
minHeight: '',
|
865 |
maxHeight: ''
|
866 |
} );
|
867 |
-
//this.$contents.css( { height: 'auto' } );
|
868 |
}
|
869 |
},
|
870 |
|
@@ -932,8 +927,9 @@
|
|
932 |
this.updateItems( value );
|
933 |
break;
|
934 |
case 'direction':
|
935 |
-
|
936 |
-
|
|
|
937 |
break;
|
938 |
case 'minHeight':
|
939 |
case 'maxHeight':
|
849 |
this.$contents.css( this.settings.contentsBorderWidth );
|
850 |
|
851 |
if ( 'up' === this.settings.direction || 'down' === this.settings.direction ) {
|
852 |
+
var minHeight = this.settings.minHeight ? this.settings.minHeight : 0,
|
|
|
853 |
maxHeight = this.settings.maxHeight ? this.settings.maxHeight : 'none';
|
854 |
this.$items.css( {
|
|
|
855 |
minHeight: minHeight,
|
856 |
maxHeight: maxHeight
|
857 |
} );
|
|
|
858 |
} else {
|
859 |
this.$items.css( {
|
|
|
860 |
minHeight: '',
|
861 |
maxHeight: ''
|
862 |
} );
|
|
|
863 |
}
|
864 |
},
|
865 |
|
927 |
this.updateItems( value );
|
928 |
break;
|
929 |
case 'direction':
|
930 |
+
this.settings[key] = value;
|
931 |
+
this._styleDisplay();
|
932 |
+
this._setDirection( value );
|
933 |
break;
|
934 |
case 'minHeight':
|
935 |
case 'maxHeight':
|
includes/js/class-ditty-display-ticker.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function($){"use strict";var t={id:0,title:"",display:0,status:"",direction:"left",spacing:20,speed:10,hoverPause:0,height:null,minHeight:null,maxHeight:null,heightEase:"easeInOutQuint",heightSpeed:1.5,scrollInit:"empty",scrollDelay:2,maxWidth:"",bgColor:"",padding:{},margin:{},borderColor:{},borderStyle:{},borderWidth:{},borderRadius:{},contentsBgColor:"",contentsPadding:{},contentsBorderColor:{},contentsBorderStyle:{},contentsBorderWidth:{},contentsBorderRadius:{},itemTextColor:"",itemBgColor:"",itemBorderColor:{},itemBorderStyle:{},itemBorderWidth:{},itemBorderRadius:{},itemPadding:{},itemMaxWidth:"",itemElementsWrap:"wrap",item:0,shuffle:0,showEditor:0,items:[]},i=function(i,e){this.displayType="ticker",this.elmt=i,this.settings=$.extend({},t,$.ditty_ticker.defaults,e),this.nextItem=null,this.total=this.settings.items.length,this.$elmt=$(i),this.$contents=null,this.$items=null,this.$currentItem=null,this.$lastItem=null,this.scrollPercent=.13,this.running=!1,this.interval=!1,this.currentHeight=this.settings.height,this.visibleItems=[],1===parseInt(this.settings.shuffle)&&this.shuffle(),this._init()};i.prototype={_init:function(){var t,i,e=this;this.$elmt.removeClass("ditty--pre"),this.$elmt.addClass("ditty ditty-ticker"),this.$elmt.attr("data-id",this.settings.id),this.$elmt.attr("data-type",this.displayType),this.$elmt.attr("data-display",this.settings.display),t=$('<div class="ditty-ticker__contents"></div>'),this.$contents=t,i=$('<div class="ditty-ticker__items"></div>'),this.$items=i,this.$items.height(this.currentHeight),t.append(i),this.$elmt.append(t),this._styleDisplay(),this.$contents.on("mouseenter",{self:this},this._mouseenter),this.$contents.on("mouseleave",{self:this},this._mouseleave),this.settings.showEditor?dittyEditorInit(this):this.trigger("start_live_updates"),setTimeout((function(){for(var t=0;t<this.total;t++)this._preloadItem(this.settings.items[t]);e._initializeItems(),e.trigger("init")}),1)},_initializeItems:function(){"filled"===this.settings.scrollInit?this._fillTicker():this.running||this._timerStart()},_preloadItem:function(t){$(t.html).find("img").each((function(){(new Image).src=$(this).attr("src")}))},_positionItems:function(t){var i=this;if(0===i.visibleItems.length){var e=i.settings.item;this._isItemEnabled(e)||(e=this._getNextItem(e)),i._initializeItem(e)}$.each(i.visibleItems,(function(e,s){if(s){var n=i.visibleItems[e].$item,r=i._calculateItemPosition(e,t);i.visibleItems[e].posX=r.posX,i.visibleItems[e].posY=r.posY,i._itemSetTransform(n,r),i._newItemShouldStart(n,r)&&i._initializeItem(parseInt(i.nextItem)),i._itemShouldTerminate(n,r)&&i._terminateItem(e)}}))},_timerStart:function(){var t=this;this.running=!0,this.trigger("start"),cancelAnimationFrame(this.interval),t.interval=requestAnimationFrame((function i(){t._positionItems(),t.interval=requestAnimationFrame(i)}))},_timerStop:function(){cancelAnimationFrame(this.interval),this.running=!1,this.trigger("stop")},_mouseenter:function(t){var i=t.data.self;i.settings.hoverPause&&i._timerStop()},_mouseleave:function(t){var i=t.data.self;i.settings.hoverPause&&i._timerStart()},_newItemShouldStart:function(t,i){if(this.$currentItem[0]!==t[0])return!1;var e=!1;switch(this.settings.direction){case"left":i.posX<=this.$items.outerWidth()-t.outerWidth()&&(e=!0);break;case"right":i.posX>=0&&(e=!0);break;case"down":i.posY>=0&&(e=!0);break;case"up":i.posY<=this.$items.outerHeight()-t.outerHeight()&&(e=!0)}return e},_initializeItem:function(t,i){if(void 0===this.settings.items[t])return!1;var e=$(this.settings.items[t].html);if(e.css({top:0,left:0}),this.$items.children(".ditty-item--"+this.settings.items[t].id).not(".ditty-item--clone").length>0&&e.addClass("ditty-item--clone"),this._styleItem(e),this.settings.items[t].css&&dittyLayoutCss(this.settings.items[t].css,this.settings.items[t].layout_id),this._itemSpacing(e),this._itemSetTransform(e,this._itemResetPosition(e)),this.$items.append(e),e.css({display:"block",top:0,left:0,opacity:1}),e.addClass("ditty-item--current"),null!==this.$currentItem&&this.$currentItem.removeClass("ditty-item--current"),this.$currentItem=e,null===this.$lastItem&&(e.addClass("ditty-item--last"),this.$lastItem=e),this.settings.item=t,this.nextItem=this._getNextItem(t),"custom"!==i){var s=this._itemResetPosition(e);this._itemSetTransform(e,s),this.visibleItems.push({$item:e,itemId:this.settings.items[t].id,posX:s.posX,posY:s.posY}),this._setCurrentHeight()}return this.trigger("active_items_update"),e},_getNextItem:function(t){var i,e=this,s=!1;if(null!==this.nextItem&&t!==this.nextItem){var n=parseInt(this.nextItem);n<this.total&&n>=0&&e._isItemEnabled(n)&&(s=parseInt(this.nextItem))}if(!s)for(i=t;i<this.total;i++)if(i!==t&&e._isItemEnabled(i)){s=parseInt(i);break}if(!s)for(i=0;i<this.total;i++)if(e._isItemEnabled(i)){s=parseInt(i);break}return s},_itemShouldTerminate:function(t,i){var e=!1;switch(this.settings.direction){case"left":i.posX<-t.outerWidth()&&(e=!0);break;case"right":i.posX>this.$items.outerWidth()&&(e=!0);break;case"up":i.posY<-t.outerHeight()&&(e=!0);break;case"down":i.posY>this.$items.outerHeight()&&(e=!0)}return e},_terminateItem:function(t){var i=this.visibleItems[t].$item,e=i.next();i.remove(),this.visibleItems.splice(t,1),e.length&&(e.addClass("ditty-item--last"),this.$lastItem=e),this._setCurrentHeight(),this.trigger("active_items_update")},_setCurrentHeight:function(){var t=this.currentHeight;"up"===this.settings.direction||"down"===this.settings.direction?(t=this.$items.outerHeight(),this.$items.css({height:"100%"})):(t=0,$.each(this.visibleItems,(function(i,e){var s=e.$item.outerHeight();s>t&&(t=s)})),t!==this.currentHeight&&this.$items.stop().animate({height:t+"px"},1e3*parseFloat(this.settings.heightSpeed),this.settings.heightEase,(function(){}))),t!==this.currentHeight&&(this.currentHeight=t,this.trigger("height_updated"))},_itemSpacing:function(t){switch(this.settings.direction){case"left":case"right":t.css({paddingLeft:this.settings.spacing/2+"px",paddingRight:this.settings.spacing/2+"px",paddingTop:0,paddingBottom:0});break;case"up":case"down":t.css({paddingLeft:0,paddingRight:0,paddingTop:this.settings.spacing/2+"px",paddingBottom:this.settings.spacing/2+"px"})}},_itemSetTransform:function(t,i){var e=i.posX,s=i.posY;0!==e&&(e+="px"),0!==s&&(s+="px"),t.css({transform:"translate( "+e+", "+s+" )"})},_calculateItemPosition:function(t,i){var e=0,s=0,n=parseFloat(this.settings.speed)*this.scrollPercent;switch(i&&(n=i),this.settings.direction){case"left":e=parseFloat(this.visibleItems[t].posX)-n;break;case"right":e=parseFloat(this.visibleItems[t].posX)+n;break;case"up":s=parseFloat(this.visibleItems[t].posY)-n;break;case"down":s=parseFloat(this.visibleItems[t].posY)+n}return{posX:e,posY:s}},_itemResetPosition:function(t){var i=0,e=0;switch(this.settings.direction){case"left":i=this.$items.outerWidth();break;case"right":i="-"+t.outerWidth();break;case"up":e=this.$items.outerHeight();break;case"down":e="-"+t.outerHeight()}return{posX:i,posY:e}},_reverseItems:function(){if(this.$currentItem===this.$lastItem)return!1;var t=this.$currentItem,i=this.$lastItem;this.$currentItem=i,this.$lastItem=t,this.$currentItem.removeClass("ditty-item--last").addClass("ditty-item--current"),this.$lastItem.removeClass("ditty-item--current").addClass("ditty-item--last");var e=this.$items.children(".ditty-item");this.$items.append(e.get().reverse())},_resetItems:function(){this.$items.empty(),this.visibleItems=[],this.trigger("active_items_update")},_fillTicker:function(){var t=this,i=parseFloat(this.$items.outerWidth()),e=parseFloat(this.$items.outerHeight()),s=0,n=0,r=!1,h=this.settings.item,a=null;this._isItemEnabled(h)||(h=this._getNextItem(h)),"right"===this.settings.direction?s=i:"down"===this.settings.direction&&(n=e),a=setInterval((function(){var o=t._initializeItem(h),m=t._filledItemInit(h,o,s,n,i,e);s=m.posX,n=m.posY,r=m.filled,h=t._getNextItem(h),r&&(clearInterval(a),t.trigger("active_items_update"),setTimeout((function(){t.running||t._timerStart()}),1e3*parseFloat(t.settings.scrollDelay)))}),100)},_filledItemInit:function(t,i,e,s,n,r){var h=i.data("id"),a=parseFloat(i.outerWidth()),o=parseFloat(i.outerHeight()),m=0,l=0,d=!1;switch(i.css({display:"block",opacity:0}),this.settings.direction){case"left":m=e,this._itemSetTransform(i,{posX:m,posY:s}),(e+=a)>n&&(d=!0);break;case"right":m=e-=a,this._itemSetTransform(i,{posX:m,posY:s}),e<0&&(d=!0);break;case"up":l=s,this._itemSetTransform(i,{posX:e,posY:l}),(s+=o)>r&&(d=!0);break;case"down":l=s-=o,this._itemSetTransform(i,{posX:e,posY:l}),s<0&&(d=!0)}return i.stop().animate({opacity:1},1e3,"linear",(function(){})),this.visibleItems.push({$item:i,itemId:h,posX:m,posY:l}),this._setCurrentHeight(),{posX:e,posY:s,filled:d}},_setDirection:function(t){return!!$.inArray(t,this.settings.directions)&&(t!==this.settings.directions&&(this.settings.direction=t,this._timerStop(),this._resetItems(),this._initializeItems(),void this.trigger("direction")))},_styleDisplay:function(){if(this.$elmt.css({maxWidth:this.settings.maxWidth,backgroundColor:this.settings.bgColor,borderColor:this.settings.borderColor,borderStyle:this.settings.borderStyle}),this.$elmt.css(this.settings.padding),this.$elmt.css(this.settings.margin),this.$elmt.css(this.settings.borderRadius),this.$contents.css({backgroundColor:this.settings.contentsBgColor,borderColor:this.settings.contentsBorderColor,borderStyle:this.settings.contentsBorderStyle}),this.$contents.css(this.settings.contentsPadding),this.$contents.css(this.settings.contentsBorderRadius),this.$contents.css(this.settings.contentsBorderWidth),"up"===this.settings.direction||"down"===this.settings.direction){var t=this.settings.height?this.settings.height:"100%",i=this.settings.minHeight?this.settings.minHeight:0,e=this.settings.maxHeight?this.settings.maxHeight:"none";this.$items.css({height:t,minHeight:i,maxHeight:e})}else this.$items.css({height:"auto",minHeight:"",maxHeight:""})},_styleItem:function(t){t.children(".ditty-item__elements").css({color:this.settings.itemTextColor,backgroundColor:this.settings.itemBgColor,borderColor:this.settings.itemBorderColor,borderStyle:this.settings.itemBorderStyle}),t.children(".ditty-item__elements").css(this.settings.itemPadding),t.children(".ditty-item__elements").css(this.settings.itemBorderRadius),t.children(".ditty-item__elements").css(this.settings.itemBorderWidth),""!==this.settings.itemElementsWrap&&t.children(".ditty-item__elements").css({whiteSpace:this.settings.itemElementsWrap}),""!==this.settings.itemMaxWidth&&t.children(".ditty-item__elements").css({maxWidth:this.settings.itemMaxWidth})},_getOption:function(t){switch(t){case"ditty":return this;case"type":return this.displayType;case"display":return this.settings.display;case"items":return this.settings.items;case"height":return this.currentHeight;default:return this.settings[t]}},_setOption:function(t,i){if(void 0===i)return!1;switch(t){case"items":this.updateItems(i);break;case"direction":this.settings[t]=i,this._styleDisplay();break;case"minHeight":case"maxHeight":case"bgColor":case"padding":case"borderColor":case"borderStyle":case"borderWidth":case"borderRadius":case"contentsBgColor":case"contentsPadding":case"contentsBorderRadius":this.settings[t]=i,this._styleDisplay(),this._setCurrentHeight();break;default:this.settings[t]=i}this.trigger("update")},shuffle:function(){for(var t,i,e=this.total-1;e>0;e--)i=Math.floor(Math.random()*(e+1)),t=this.settings.items[e],this.settings.items[e]=this.settings.items[i],this.settings.items[i]=t},play:function(){this.running||this._timerStart()},pause:function(){this.running&&this._timerStop()},direction:function(t){this._setDirection(t)},toggle:function(){this.running?this.pause():this.play()},running:function(){return this.running},current:function(){return this.$currentItem},_isItemEnabled:function(t){return void 0!==this.settings.items[parseInt(t)]&&(void 0===this.settings.items[parseInt(t)].is_disabled||!(this.settings.items[parseInt(t)].is_disabled.length>0))},_disabledItemsStatus:function(){var t=this,i={};return $.each(this.settings.items,(function(e,s){t._isItemEnabled(e)?i[s.id]="enabled":i[s.id]="disabled"})),i},addItemDisabled:function(t,i){var e=this;$.each(this.settings.items,(function(s,n){String(n.id)===String(t)&&($.isArray(e.settings.items[s].is_disabled)||(e.settings.items[s].is_disabled=[]),e.settings.items[s].is_disabled.push(i))})),this.trigger("disabled_items_update")},removeItemDisabled:function(t,i){var e=this;$.each(this.settings.items,(function(s,n){String(n.id)===String(t)&&$.isArray(e.settings.items[s].is_disabled)&&e.settings.items[s].is_disabled.length&&(e.settings.items[s].is_disabled=$.grep(e.settings.items[s].is_disabled,(function(t){return t!==i})))})),this.trigger("disabled_items_update")},showItem:function(t){var i=[];if($.each(this.settings.items,(function(e,s){String(s.id)===String(t)&&i.push(e)})),0!==i.length)return this.nextItem=i[0],this.nextItem},addItem:function(t,i,e){var s=this.settings.items.slice(),n=!0;(i>=this.total||i<0)&&(n=!1),"replace"===e&&n?s.splice(i,1,t):null===i||""===i?s.splice(this.nextItem,0,t):i>=this.total?s.push(t):i<0?s.splice(0,0,t):s.splice(i,0,t),this.updateItems(s)},deleteItem:function(t){var i=[];$.each(this.settings.items,(function(e,s){String(s.id)!==String(t)&&i.push(s)})),this.updateItems(i)},updateItems:function(t,i,e,s){if(void 0===t)return!1;var n=[];if(i){var r=this.settings.items.slice(),h=[],a=!1;$.each(r,(function(s,r){String(r.id)===String(i)?"after"===e?(h.push(r),$.each(t,(function(t,i){h.push(i)})),a=!0):"before"===e?($.each(t,(function(t,i){h.push(i)})),h.push(r),a=!0):a||($.each(t,(function(t,i){h.push(i),n.push(String(i.uniq_id))})),a=!0):h.push(r)})),a||($.each(this.settings.items,(function(t,i){h.push(i)})),a=!0),t=h}this.settings.items=t,this.total=t.length,this.nextItem>=this.total&&(this.nextItem=0),this.trigger("update")},getActiveItems:function(){var t=[];return $.each(this.visibleItems,(function(i,e){t.push({id:e.itemId})})),t},trigger:function(t){var i=[];switch(t){case"active_items_update":i=[this,this.getActiveItems()];break;case"disabled_items_update":i=[this._disabledItemsStatus()];break;case"height_updated":i=[this.currentHeight,this.$elmt];break;case"start_live_updates":i=[this.settings.id];break;default:i=[this.settings,this.$elmt]}this.$elmt.trigger("ditty_"+t,i),"function"==typeof this.settings[t]&&this.settings[t].apply(this.$elmt,i),$("body").trigger("ditty_"+t,i)},options:function(t,i){var e=this;if("object"==typeof t)$.each(t,(function(t,i){e._setOption(t,i)}));else{if("string"!=typeof t)return e.settings;if(void 0===i)return e._getOption(t);e._setOption(t,i)}},destroy:function(){this.$contents.off("mouseenter",{self:this},this._mouseenter),this.$contents.off("mouseleave",{self:this},this._mouseleave),cancelAnimationFrame(this.interval),this.$elmt.removeClass("ditty ditty-ticker"),this.$elmt.removeAttr("data-id"),this.$elmt.removeAttr("data-type"),this.$elmt.removeAttr("data-display"),this.$elmt.removeAttr("style"),this.$elmt.empty(),this.elmt._ditty_ticker=null}},$.fn.ditty_ticker=function(t){var e,s=arguments,n=!1;if(void 0===t||"object"==typeof t)return this.each((function(){this._ditty_ticker||(this._ditty_ticker=new i(this,t))}));if("string"==typeof t){if(this.each((function(){var i=this._ditty_ticker;if(!i)throw new Error("No Ditty_Ticker applied to this element.");"function"==typeof i[t]&&"_"!==t[0]?e=i[t].apply(i,[].slice.call(s,1)):n=!0})),n)throw new Error('No method "'+t+'" in Ditty_Ticker.');return void 0!==e?e:this}},$.ditty_ticker={},$.ditty_ticker.defaults=t}(jQuery);
|
1 |
+
!function($){"use strict";var t={id:0,title:"",display:0,status:"",direction:"left",spacing:20,speed:10,hoverPause:0,height:null,minHeight:null,maxHeight:null,heightEase:"easeInOutQuint",heightSpeed:1.5,scrollInit:"empty",scrollDelay:2,maxWidth:"",bgColor:"",padding:{},margin:{},borderColor:{},borderStyle:{},borderWidth:{},borderRadius:{},contentsBgColor:"",contentsPadding:{},contentsBorderColor:{},contentsBorderStyle:{},contentsBorderWidth:{},contentsBorderRadius:{},itemTextColor:"",itemBgColor:"",itemBorderColor:{},itemBorderStyle:{},itemBorderWidth:{},itemBorderRadius:{},itemPadding:{},itemMaxWidth:"",itemElementsWrap:"wrap",item:0,shuffle:0,showEditor:0,items:[]},i=function(i,e){this.displayType="ticker",this.elmt=i,this.settings=$.extend({},t,$.ditty_ticker.defaults,e),this.nextItem=null,this.total=this.settings.items.length,this.$elmt=$(i),this.$contents=null,this.$items=null,this.$currentItem=null,this.$lastItem=null,this.scrollPercent=.13,this.running=!1,this.interval=!1,this.currentHeight=this.settings.height,this.visibleItems=[],1===parseInt(this.settings.shuffle)&&this.shuffle(),this._init()};i.prototype={_init:function(){var t,i,e=this;this.$elmt.removeClass("ditty--pre"),this.$elmt.addClass("ditty ditty-ticker"),this.$elmt.attr("data-id",this.settings.id),this.$elmt.attr("data-type",this.displayType),this.$elmt.attr("data-display",this.settings.display),t=$('<div class="ditty-ticker__contents"></div>'),this.$contents=t,i=$('<div class="ditty-ticker__items"></div>'),this.$items=i,this.$items.height(this.currentHeight),t.append(i),this.$elmt.append(t),this._styleDisplay(),this.$contents.on("mouseenter",{self:this},this._mouseenter),this.$contents.on("mouseleave",{self:this},this._mouseleave),this.settings.showEditor?dittyEditorInit(this):this.trigger("start_live_updates"),setTimeout((function(){for(var t=0;t<this.total;t++)this._preloadItem(this.settings.items[t]);e._initializeItems(),e.trigger("init")}),1)},_initializeItems:function(){"filled"===this.settings.scrollInit?this._fillTicker():this.running||this._timerStart()},_preloadItem:function(t){$(t.html).find("img").each((function(){(new Image).src=$(this).attr("src")}))},_positionItems:function(t){var i=this;if(0===i.visibleItems.length){var e=i.settings.item;this._isItemEnabled(e)||(e=this._getNextItem(e)),i._initializeItem(e)}$.each(i.visibleItems,(function(e,s){if(s){var n=i.visibleItems[e].$item,r=i._calculateItemPosition(e,t);i.visibleItems[e].posX=r.posX,i.visibleItems[e].posY=r.posY,i._itemSetTransform(n,r),i._newItemShouldStart(n,r)&&i._initializeItem(parseInt(i.nextItem)),i._itemShouldTerminate(n,r)&&i._terminateItem(e)}}))},_timerStart:function(){var t=this;this.running=!0,this.trigger("start"),cancelAnimationFrame(this.interval),t.interval=requestAnimationFrame((function i(){t._positionItems(),t.interval=requestAnimationFrame(i)}))},_timerStop:function(){cancelAnimationFrame(this.interval),this.running=!1,this.trigger("stop")},_mouseenter:function(t){var i=t.data.self;i.settings.hoverPause&&i._timerStop()},_mouseleave:function(t){var i=t.data.self;i.settings.hoverPause&&i._timerStart()},_newItemShouldStart:function(t,i){if(this.$currentItem[0]!==t[0])return!1;var e=!1;switch(this.settings.direction){case"left":i.posX<=this.$items.outerWidth()-t.outerWidth()&&(e=!0);break;case"right":i.posX>=0&&(e=!0);break;case"down":i.posY>=0&&(e=!0);break;case"up":i.posY<=this.$items.outerHeight()-t.outerHeight()&&(e=!0)}return e},_initializeItem:function(t,i){if(void 0===this.settings.items[t])return!1;var e=$(this.settings.items[t].html);if(e.css({top:0,left:0}),this.$items.children(".ditty-item--"+this.settings.items[t].id).not(".ditty-item--clone").length>0&&e.addClass("ditty-item--clone"),this._styleItem(e),this.settings.items[t].css&&dittyLayoutCss(this.settings.items[t].css,this.settings.items[t].layout_id),this._itemSpacing(e),this._itemSetTransform(e,this._itemResetPosition(e)),this.$items.append(e),e.css({display:"block",top:0,left:0,opacity:1}),e.addClass("ditty-item--current"),null!==this.$currentItem&&this.$currentItem.removeClass("ditty-item--current"),this.$currentItem=e,null===this.$lastItem&&(e.addClass("ditty-item--last"),this.$lastItem=e),this.settings.item=t,this.nextItem=this._getNextItem(t),"custom"!==i){var s=this._itemResetPosition(e);this._itemSetTransform(e,s),this.visibleItems.push({$item:e,itemId:this.settings.items[t].id,posX:s.posX,posY:s.posY}),this._setCurrentHeight()}return this.trigger("active_items_update"),e},_getNextItem:function(t){var i,e=this,s=!1;if(null!==this.nextItem&&t!==this.nextItem){var n=parseInt(this.nextItem);n<this.total&&n>=0&&e._isItemEnabled(n)&&(s=parseInt(this.nextItem))}if(!s)for(i=t;i<this.total;i++)if(i!==t&&e._isItemEnabled(i)){s=parseInt(i);break}if(!s)for(i=0;i<this.total;i++)if(e._isItemEnabled(i)){s=parseInt(i);break}return s},_itemShouldTerminate:function(t,i){var e=!1;switch(this.settings.direction){case"left":i.posX<-t.outerWidth()&&(e=!0);break;case"right":i.posX>this.$items.outerWidth()&&(e=!0);break;case"up":i.posY<-t.outerHeight()&&(e=!0);break;case"down":i.posY>this.$items.outerHeight()&&(e=!0)}return e},_terminateItem:function(t){var i=this.visibleItems[t].$item,e=i.next();i.remove(),this.visibleItems.splice(t,1),e.length&&(e.addClass("ditty-item--last"),this.$lastItem=e),this._setCurrentHeight(),this.trigger("active_items_update")},_setCurrentHeight:function(){var t=this.currentHeight;"up"===this.settings.direction||"down"===this.settings.direction?(t=this.$items.outerHeight(),this.$items.css({height:"100%"})):(t=0,$.each(this.visibleItems,(function(i,e){var s=e.$item.outerHeight();s>t&&(t=s)})),t!==this.currentHeight&&this.$items.stop().animate({height:t+"px"},1e3*parseFloat(this.settings.heightSpeed),this.settings.heightEase,(function(){}))),t!==this.currentHeight&&(this.currentHeight=t,this.trigger("height_updated"))},_itemSpacing:function(t){switch(this.settings.direction){case"left":case"right":t.css({paddingLeft:this.settings.spacing/2+"px",paddingRight:this.settings.spacing/2+"px",paddingTop:0,paddingBottom:0});break;case"up":case"down":t.css({paddingLeft:0,paddingRight:0,paddingTop:this.settings.spacing/2+"px",paddingBottom:this.settings.spacing/2+"px"})}},_itemSetTransform:function(t,i){var e=i.posX,s=i.posY;0!==e&&(e+="px"),0!==s&&(s+="px"),t.css({transform:"translate( "+e+", "+s+" )"})},_calculateItemPosition:function(t,i){var e=0,s=0,n=parseFloat(this.settings.speed)*this.scrollPercent;switch(i&&(n=i),this.settings.direction){case"left":e=parseFloat(this.visibleItems[t].posX)-n;break;case"right":e=parseFloat(this.visibleItems[t].posX)+n;break;case"up":s=parseFloat(this.visibleItems[t].posY)-n;break;case"down":s=parseFloat(this.visibleItems[t].posY)+n}return{posX:e,posY:s}},_itemResetPosition:function(t){var i=0,e=0;switch(this.settings.direction){case"left":i=this.$items.outerWidth();break;case"right":i="-"+t.outerWidth();break;case"up":e=this.$items.outerHeight();break;case"down":e="-"+t.outerHeight()}return{posX:i,posY:e}},_reverseItems:function(){if(this.$currentItem===this.$lastItem)return!1;var t=this.$currentItem,i=this.$lastItem;this.$currentItem=i,this.$lastItem=t,this.$currentItem.removeClass("ditty-item--last").addClass("ditty-item--current"),this.$lastItem.removeClass("ditty-item--current").addClass("ditty-item--last");var e=this.$items.children(".ditty-item");this.$items.append(e.get().reverse())},_resetItems:function(){this.$items.empty(),this.visibleItems=[],this.trigger("active_items_update")},_fillTicker:function(){var t=this,i=parseFloat(this.$items.outerWidth()),e=parseFloat(this.$items.outerHeight()),s=0,n=0,r=!1,h=this.settings.item,a=null;this._isItemEnabled(h)||(h=this._getNextItem(h)),"right"===this.settings.direction?s=i:"down"===this.settings.direction&&(n=e),a=setInterval((function(){var o=t._initializeItem(h),m=t._filledItemInit(h,o,s,n,i,e);s=m.posX,n=m.posY,r=m.filled,h=t._getNextItem(h),r&&(clearInterval(a),t.trigger("active_items_update"),setTimeout((function(){t.running||t._timerStart()}),1e3*parseFloat(t.settings.scrollDelay)))}),100)},_filledItemInit:function(t,i,e,s,n,r){var h=i.data("id"),a=parseFloat(i.outerWidth()),o=parseFloat(i.outerHeight()),m=0,l=0,d=!1;switch(i.css({display:"block",opacity:0}),this.settings.direction){case"left":m=e,this._itemSetTransform(i,{posX:m,posY:s}),(e+=a)>n&&(d=!0);break;case"right":m=e-=a,this._itemSetTransform(i,{posX:m,posY:s}),e<0&&(d=!0);break;case"up":l=s,this._itemSetTransform(i,{posX:e,posY:l}),(s+=o)>r&&(d=!0);break;case"down":l=s-=o,this._itemSetTransform(i,{posX:e,posY:l}),s<0&&(d=!0)}return i.stop().animate({opacity:1},1e3,"linear",(function(){})),this.visibleItems.push({$item:i,itemId:h,posX:m,posY:l}),this._setCurrentHeight(),{posX:e,posY:s,filled:d}},_setDirection:function(t){return!!$.inArray(t,this.settings.directions)&&(t!==this.settings.directions&&(this.settings.direction=t,this._timerStop(),this._resetItems(),this._initializeItems(),void this.trigger("direction")))},_styleDisplay:function(){if(this.$elmt.css({maxWidth:this.settings.maxWidth,backgroundColor:this.settings.bgColor,borderColor:this.settings.borderColor,borderStyle:this.settings.borderStyle}),this.$elmt.css(this.settings.padding),this.$elmt.css(this.settings.margin),this.$elmt.css(this.settings.borderRadius),this.$contents.css({backgroundColor:this.settings.contentsBgColor,borderColor:this.settings.contentsBorderColor,borderStyle:this.settings.contentsBorderStyle}),this.$contents.css(this.settings.contentsPadding),this.$contents.css(this.settings.contentsBorderRadius),this.$contents.css(this.settings.contentsBorderWidth),"up"===this.settings.direction||"down"===this.settings.direction){var t=this.settings.minHeight?this.settings.minHeight:0,i=this.settings.maxHeight?this.settings.maxHeight:"none";this.$items.css({minHeight:t,maxHeight:i})}else this.$items.css({minHeight:"",maxHeight:""})},_styleItem:function(t){t.children(".ditty-item__elements").css({color:this.settings.itemTextColor,backgroundColor:this.settings.itemBgColor,borderColor:this.settings.itemBorderColor,borderStyle:this.settings.itemBorderStyle}),t.children(".ditty-item__elements").css(this.settings.itemPadding),t.children(".ditty-item__elements").css(this.settings.itemBorderRadius),t.children(".ditty-item__elements").css(this.settings.itemBorderWidth),""!==this.settings.itemElementsWrap&&t.children(".ditty-item__elements").css({whiteSpace:this.settings.itemElementsWrap}),""!==this.settings.itemMaxWidth&&t.children(".ditty-item__elements").css({maxWidth:this.settings.itemMaxWidth})},_getOption:function(t){switch(t){case"ditty":return this;case"type":return this.displayType;case"display":return this.settings.display;case"items":return this.settings.items;case"height":return this.currentHeight;default:return this.settings[t]}},_setOption:function(t,i){if(void 0===i)return!1;switch(t){case"items":this.updateItems(i);break;case"direction":this.settings[t]=i,this._styleDisplay(),this._setDirection(i);break;case"minHeight":case"maxHeight":case"bgColor":case"padding":case"borderColor":case"borderStyle":case"borderWidth":case"borderRadius":case"contentsBgColor":case"contentsPadding":case"contentsBorderRadius":this.settings[t]=i,this._styleDisplay(),this._setCurrentHeight();break;default:this.settings[t]=i}this.trigger("update")},shuffle:function(){for(var t,i,e=this.total-1;e>0;e--)i=Math.floor(Math.random()*(e+1)),t=this.settings.items[e],this.settings.items[e]=this.settings.items[i],this.settings.items[i]=t},play:function(){this.running||this._timerStart()},pause:function(){this.running&&this._timerStop()},direction:function(t){this._setDirection(t)},toggle:function(){this.running?this.pause():this.play()},running:function(){return this.running},current:function(){return this.$currentItem},_isItemEnabled:function(t){return void 0!==this.settings.items[parseInt(t)]&&(void 0===this.settings.items[parseInt(t)].is_disabled||!(this.settings.items[parseInt(t)].is_disabled.length>0))},_disabledItemsStatus:function(){var t=this,i={};return $.each(this.settings.items,(function(e,s){t._isItemEnabled(e)?i[s.id]="enabled":i[s.id]="disabled"})),i},addItemDisabled:function(t,i){var e=this;$.each(this.settings.items,(function(s,n){String(n.id)===String(t)&&($.isArray(e.settings.items[s].is_disabled)||(e.settings.items[s].is_disabled=[]),e.settings.items[s].is_disabled.push(i))})),this.trigger("disabled_items_update")},removeItemDisabled:function(t,i){var e=this;$.each(this.settings.items,(function(s,n){String(n.id)===String(t)&&$.isArray(e.settings.items[s].is_disabled)&&e.settings.items[s].is_disabled.length&&(e.settings.items[s].is_disabled=$.grep(e.settings.items[s].is_disabled,(function(t){return t!==i})))})),this.trigger("disabled_items_update")},showItem:function(t){var i=[];if($.each(this.settings.items,(function(e,s){String(s.id)===String(t)&&i.push(e)})),0!==i.length)return this.nextItem=i[0],this.nextItem},addItem:function(t,i,e){var s=this.settings.items.slice(),n=!0;(i>=this.total||i<0)&&(n=!1),"replace"===e&&n?s.splice(i,1,t):null===i||""===i?s.splice(this.nextItem,0,t):i>=this.total?s.push(t):i<0?s.splice(0,0,t):s.splice(i,0,t),this.updateItems(s)},deleteItem:function(t){var i=[];$.each(this.settings.items,(function(e,s){String(s.id)!==String(t)&&i.push(s)})),this.updateItems(i)},updateItems:function(t,i,e,s){if(void 0===t)return!1;var n=[];if(i){var r=this.settings.items.slice(),h=[],a=!1;$.each(r,(function(s,r){String(r.id)===String(i)?"after"===e?(h.push(r),$.each(t,(function(t,i){h.push(i)})),a=!0):"before"===e?($.each(t,(function(t,i){h.push(i)})),h.push(r),a=!0):a||($.each(t,(function(t,i){h.push(i),n.push(String(i.uniq_id))})),a=!0):h.push(r)})),a||($.each(this.settings.items,(function(t,i){h.push(i)})),a=!0),t=h}this.settings.items=t,this.total=t.length,this.nextItem>=this.total&&(this.nextItem=0),this.trigger("update")},getActiveItems:function(){var t=[];return $.each(this.visibleItems,(function(i,e){t.push({id:e.itemId})})),t},trigger:function(t){var i=[];switch(t){case"active_items_update":i=[this,this.getActiveItems()];break;case"disabled_items_update":i=[this._disabledItemsStatus()];break;case"height_updated":i=[this.currentHeight,this.$elmt];break;case"start_live_updates":i=[this.settings.id];break;default:i=[this.settings,this.$elmt]}this.$elmt.trigger("ditty_"+t,i),"function"==typeof this.settings[t]&&this.settings[t].apply(this.$elmt,i),$("body").trigger("ditty_"+t,i)},options:function(t,i){var e=this;if("object"==typeof t)$.each(t,(function(t,i){e._setOption(t,i)}));else{if("string"!=typeof t)return e.settings;if(void 0===i)return e._getOption(t);e._setOption(t,i)}},destroy:function(){this.$contents.off("mouseenter",{self:this},this._mouseenter),this.$contents.off("mouseleave",{self:this},this._mouseleave),cancelAnimationFrame(this.interval),this.$elmt.removeClass("ditty ditty-ticker"),this.$elmt.removeAttr("data-id"),this.$elmt.removeAttr("data-type"),this.$elmt.removeAttr("data-display"),this.$elmt.removeAttr("style"),this.$elmt.empty(),this.elmt._ditty_ticker=null}},$.fn.ditty_ticker=function(t){var e,s=arguments,n=!1;if(void 0===t||"object"==typeof t)return this.each((function(){this._ditty_ticker||(this._ditty_ticker=new i(this,t))}));if("string"==typeof t){if(this.each((function(){var i=this._ditty_ticker;if(!i)throw new Error("No Ditty_Ticker applied to this element.");"function"==typeof i[t]&&"_"!==t[0]?e=i[t].apply(i,[].slice.call(s,1)):n=!0})),n)throw new Error('No method "'+t+'" in Ditty_Ticker.');return void 0!==e?e:this}},$.ditty_ticker={},$.ditty_ticker.defaults=t}(jQuery);
|
includes/js/ditty-editor.min.js
CHANGED
@@ -5794,7 +5794,6 @@ jQuery( document ).ready( function( $ ) {
|
|
5794 |
"use strict";
|
5795 |
|
5796 |
function modifyHeights( $minHeight, $maxHeight, directionValue ) {
|
5797 |
-
console.log( directionValue );
|
5798 |
if ( 'down' === directionValue || 'up' === directionValue ) {
|
5799 |
$minHeight.show();
|
5800 |
$maxHeight.show();
|
5794 |
"use strict";
|
5795 |
|
5796 |
function modifyHeights( $minHeight, $maxHeight, directionValue ) {
|
|
|
5797 |
if ( 'down' === directionValue || 'up' === directionValue ) {
|
5798 |
$minHeight.show();
|
5799 |
$maxHeight.show();
|
includes/js/ditty.js
CHANGED
@@ -218,12 +218,13 @@ jQuery( document ).ready( function( $ ) {
|
|
218 |
live_updates = $ditty.data( 'live_updates' ) ? $ditty.data( 'live_updates' ) : false,
|
219 |
editor = $ditty.data( 'show_editor' ) ? $ditty.data( 'show_editor' ) : false,
|
220 |
load_type = $ditty.data( 'load_type' ) ? $ditty.data( 'load_type' ) : false;
|
221 |
-
|
222 |
// Load the Dittys via ajax
|
223 |
if ( ajax_load ) {
|
224 |
var data = {
|
225 |
action : 'ditty_init',
|
226 |
id : $ditty.data( 'id' ) ? $ditty.data( 'id' ) : false,
|
|
|
227 |
display : $ditty.data( 'display' ) ? $ditty.data( 'display' ) : '',
|
228 |
display_settings : $ditty.data( 'display_settings' ) ? $ditty.data( 'display_settings' ) : false,
|
229 |
editor : editor,
|
218 |
live_updates = $ditty.data( 'live_updates' ) ? $ditty.data( 'live_updates' ) : false,
|
219 |
editor = $ditty.data( 'show_editor' ) ? $ditty.data( 'show_editor' ) : false,
|
220 |
load_type = $ditty.data( 'load_type' ) ? $ditty.data( 'load_type' ) : false;
|
221 |
+
|
222 |
// Load the Dittys via ajax
|
223 |
if ( ajax_load ) {
|
224 |
var data = {
|
225 |
action : 'ditty_init',
|
226 |
id : $ditty.data( 'id' ) ? $ditty.data( 'id' ) : false,
|
227 |
+
uniqid : $ditty.data( 'uniqid' ) ? $ditty.data( 'uniqid' ) : false,
|
228 |
display : $ditty.data( 'display' ) ? $ditty.data( 'display' ) : '',
|
229 |
display_settings : $ditty.data( 'display_settings' ) ? $ditty.data( 'display_settings' ) : false,
|
230 |
editor : editor,
|
includes/js/ditty.min.js
CHANGED
@@ -218,12 +218,13 @@ jQuery( document ).ready( function( $ ) {
|
|
218 |
live_updates = $ditty.data( 'live_updates' ) ? $ditty.data( 'live_updates' ) : false,
|
219 |
editor = $ditty.data( 'show_editor' ) ? $ditty.data( 'show_editor' ) : false,
|
220 |
load_type = $ditty.data( 'load_type' ) ? $ditty.data( 'load_type' ) : false;
|
221 |
-
|
222 |
// Load the Dittys via ajax
|
223 |
if ( ajax_load ) {
|
224 |
var data = {
|
225 |
action : 'ditty_init',
|
226 |
id : $ditty.data( 'id' ) ? $ditty.data( 'id' ) : false,
|
|
|
227 |
display : $ditty.data( 'display' ) ? $ditty.data( 'display' ) : '',
|
228 |
display_settings : $ditty.data( 'display_settings' ) ? $ditty.data( 'display_settings' ) : false,
|
229 |
editor : editor,
|
@@ -304,7 +305,7 @@ function dittyDisplayCss( displayCss, displayId ) {
|
|
304 |
/**
|
305 |
* Update items
|
306 |
*
|
307 |
-
* @since 3.0
|
308 |
* @return null
|
309 |
*/
|
310 |
function dittyUpdateItems( itemSwaps ) {
|
@@ -350,7 +351,11 @@ function dittyUpdateItems( itemSwaps ) {
|
|
350 |
$updateWrapper.removeAttr( 'style' );
|
351 |
$current.unwrap();
|
352 |
$current.remove();
|
353 |
-
|
|
|
|
|
|
|
|
|
354 |
if ( $new.hasClass( 'ditty-temp-item' ) ) {
|
355 |
$new.remove();
|
356 |
}
|
218 |
live_updates = $ditty.data( 'live_updates' ) ? $ditty.data( 'live_updates' ) : false,
|
219 |
editor = $ditty.data( 'show_editor' ) ? $ditty.data( 'show_editor' ) : false,
|
220 |
load_type = $ditty.data( 'load_type' ) ? $ditty.data( 'load_type' ) : false;
|
221 |
+
|
222 |
// Load the Dittys via ajax
|
223 |
if ( ajax_load ) {
|
224 |
var data = {
|
225 |
action : 'ditty_init',
|
226 |
id : $ditty.data( 'id' ) ? $ditty.data( 'id' ) : false,
|
227 |
+
uniqid : $ditty.data( 'uniqid' ) ? $ditty.data( 'uniqid' ) : false,
|
228 |
display : $ditty.data( 'display' ) ? $ditty.data( 'display' ) : '',
|
229 |
display_settings : $ditty.data( 'display_settings' ) ? $ditty.data( 'display_settings' ) : false,
|
230 |
editor : editor,
|
305 |
/**
|
306 |
* Update items
|
307 |
*
|
308 |
+
* @since 3.0.10
|
309 |
* @return null
|
310 |
*/
|
311 |
function dittyUpdateItems( itemSwaps ) {
|
351 |
$updateWrapper.removeAttr( 'style' );
|
352 |
$current.unwrap();
|
353 |
$current.remove();
|
354 |
+
if ( newStyle ) {
|
355 |
+
$new.attr( 'style', newStyle );
|
356 |
+
} else {
|
357 |
+
$new.removeAttr( 'style' );
|
358 |
+
}
|
359 |
if ( $new.hasClass( 'ditty-temp-item' ) ) {
|
360 |
$new.remove();
|
361 |
}
|
includes/js/editor/ditty-ticker-display-editor.js
CHANGED
@@ -8,7 +8,6 @@ jQuery( document ).ready( function( $ ) {
|
|
8 |
"use strict";
|
9 |
|
10 |
function modifyHeights( $minHeight, $maxHeight, directionValue ) {
|
11 |
-
console.log( directionValue );
|
12 |
if ( 'down' === directionValue || 'up' === directionValue ) {
|
13 |
$minHeight.show();
|
14 |
$maxHeight.show();
|
8 |
"use strict";
|
9 |
|
10 |
function modifyHeights( $minHeight, $maxHeight, directionValue ) {
|
|
|
11 |
if ( 'down' === directionValue || 'up' === directionValue ) {
|
12 |
$minHeight.show();
|
13 |
$maxHeight.show();
|
includes/js/partials/helpers.js
CHANGED
@@ -36,7 +36,7 @@ function dittyDisplayCss( displayCss, displayId ) {
|
|
36 |
/**
|
37 |
* Update items
|
38 |
*
|
39 |
-
* @since 3.0
|
40 |
* @return null
|
41 |
*/
|
42 |
function dittyUpdateItems( itemSwaps ) {
|
@@ -82,7 +82,11 @@ function dittyUpdateItems( itemSwaps ) {
|
|
82 |
$updateWrapper.removeAttr( 'style' );
|
83 |
$current.unwrap();
|
84 |
$current.remove();
|
85 |
-
|
|
|
|
|
|
|
|
|
86 |
if ( $new.hasClass( 'ditty-temp-item' ) ) {
|
87 |
$new.remove();
|
88 |
}
|
36 |
/**
|
37 |
* Update items
|
38 |
*
|
39 |
+
* @since 3.0.10
|
40 |
* @return null
|
41 |
*/
|
42 |
function dittyUpdateItems( itemSwaps ) {
|
82 |
$updateWrapper.removeAttr( 'style' );
|
83 |
$current.unwrap();
|
84 |
$current.remove();
|
85 |
+
if ( newStyle ) {
|
86 |
+
$new.attr( 'style', newStyle );
|
87 |
+
} else {
|
88 |
+
$new.removeAttr( 'style' );
|
89 |
+
}
|
90 |
if ( $new.hasClass( 'ditty-temp-item' ) ) {
|
91 |
$new.remove();
|
92 |
}
|
includes/libs/hammer.min.js
CHANGED
@@ -3,5 +3,4 @@
|
|
3 |
*
|
4 |
* Copyright (c) 2016 Jorik Tangelder;
|
5 |
* Licensed under the MIT license */
|
6 |
-
!function(a,b,c,d){"use strict";function e(a,b,c){return setTimeout(j(a,c),b)}function f(a,b,c){return Array.isArray(a)?(g(a,c[b],c),!0):!1}function g(a,b,c){var e;if(a)if(a.forEach)a.forEach(b,c);else if(a.length!==d)for(e=0;e<a.length;)b.call(c,a[e],e,a),e++;else for(e in a)a.hasOwnProperty(e)&&b.call(c,a[e],e,a)}function h(b,c,d){var e="DEPRECATED METHOD: "+c+"\n"+d+" AT \n";return function(){var c=new Error("get-stack-trace"),d=c&&c.stack?c.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",f=a.console&&(a.console.warn||a.console.log);return f&&f.call(a.console,e,d),b.apply(this,arguments)}}function i(a,b,c){var d,e=b.prototype;d=a.prototype=Object.create(e),d.constructor=a,d._super=e,c&&la(d,c)}function j(a,b){return function(){return a.apply(b,arguments)}}function k(a,b){return typeof a==oa?a.apply(b?b[0]||d:d,b):a}function l(a,b){return a===d?b:a}function m(a,b,c){g(q(b),function(b){a.addEventListener(b,c,!1)})}function n(a,b,c){g(q(b),function(b){a.removeEventListener(b,c,!1)})}function o(a,b){for(;a;){if(a==b)return!0;a=a.parentNode}return!1}function p(a,b){return a.indexOf(b)>-1}function q(a){return a.trim().split(/\s+/g)}function r(a,b,c){if(a.indexOf&&!c)return a.indexOf(b);for(var d=0;d<a.length;){if(c&&a[d][c]==b||!c&&a[d]===b)return d;d++}return-1}function s(a){return Array.prototype.slice.call(a,0)}function t(a,b,c){for(var d=[],e=[],f=0;f<a.length;){var g=b?a[f][b]:a[f];r(e,g)<0&&d.push(a[f]),e[f]=g,f++}return c&&(d=b?d.sort(function(a,c){return a[b]>c[b]}):d.sort()),d}function u(a,b){for(var c,e,f=b[0].toUpperCase()+b.slice(1),g=0;g<ma.length;){if(c=ma[g],e=c?c+f:b,e in a)return e;g++}return d}function v(){return ua++}function w(b){var c=b.ownerDocument||b;return c.defaultView||c.parentWindow||a}function x(a,b){var c=this;this.manager=a,this.callback=b,this.element=a.element,this.target=a.options.inputTarget,this.domHandler=function(b){k(a.options.enable,[a])&&c.handler(b)},this.init()}function y(a){var b,c=a.options.inputClass;return new(b=c?c:xa?M:ya?P:wa?R:L)(a,z)}function z(a,b,c){var d=c.pointers.length,e=c.changedPointers.length,f=b&Ea&&d-e===0,g=b&(Ga|Ha)&&d-e===0;c.isFirst=!!f,c.isFinal=!!g,f&&(a.session={}),c.eventType=b,A(a,c),a.emit("hammer.input",c),a.recognize(c),a.session.prevInput=c}function A(a,b){var c=a.session,d=b.pointers,e=d.length;c.firstInput||(c.firstInput=D(b)),e>1&&!c.firstMultiple?c.firstMultiple=D(b):1===e&&(c.firstMultiple=!1);var f=c.firstInput,g=c.firstMultiple,h=g?g.center:f.center,i=b.center=E(d);b.timeStamp=ra(),b.deltaTime=b.timeStamp-f.timeStamp,b.angle=I(h,i),b.distance=H(h,i),B(c,b),b.offsetDirection=G(b.deltaX,b.deltaY);var j=F(b.deltaTime,b.deltaX,b.deltaY);b.overallVelocityX=j.x,b.overallVelocityY=j.y,b.overallVelocity=qa(j.x)>qa(j.y)?j.x:j.y,b.scale=g?K(g.pointers,d):1,b.rotation=g?J(g.pointers,d):0,b.maxPointers=c.prevInput?b.pointers.length>c.prevInput.maxPointers?b.pointers.length:c.prevInput.maxPointers:b.pointers.length,C(c,b);var k=a.element;o(b.srcEvent.target,k)&&(k=b.srcEvent.target),b.target=k}function B(a,b){var c=b.center,d=a.offsetDelta||{},e=a.prevDelta||{},f=a.prevInput||{};b.eventType!==Ea&&f.eventType!==Ga||(e=a.prevDelta={x:f.deltaX||0,y:f.deltaY||0},d=a.offsetDelta={x:c.x,y:c.y}),b.deltaX=e.x+(c.x-d.x),b.deltaY=e.y+(c.y-d.y)}function C(a,b){var c,e,f,g,h=a.lastInterval||b,i=b.timeStamp-h.timeStamp;if(b.eventType!=Ha&&(i>Da||h.velocity===d)){var j=b.deltaX-h.deltaX,k=b.deltaY-h.deltaY,l=F(i,j,k);e=l.x,f=l.y,c=qa(l.x)>qa(l.y)?l.x:l.y,g=G(j,k),a.lastInterval=b}else c=h.velocity,e=h.velocityX,f=h.velocityY,g=h.direction;b.velocity=c,b.velocityX=e,b.velocityY=f,b.direction=g}function D(a){for(var b=[],c=0;c<a.pointers.length;)b[c]={clientX:pa(a.pointers[c].clientX),clientY:pa(a.pointers[c].clientY)},c++;return{timeStamp:ra(),pointers:b,center:E(b),deltaX:a.deltaX,deltaY:a.deltaY}}function E(a){var b=a.length;if(1===b)return{x:pa(a[0].clientX),y:pa(a[0].clientY)};for(var c=0,d=0,e=0;b>e;)c+=a[e].clientX,d+=a[e].clientY,e++;return{x:pa(c/b),y:pa(d/b)}}function F(a,b,c){return{x:b/a||0,y:c/a||0}}function G(a,b){return a===b?Ia:qa(a)>=qa(b)?0>a?Ja:Ka:0>b?La:Ma}function H(a,b,c){c||(c=Qa);var d=b[c[0]]-a[c[0]],e=b[c[1]]-a[c[1]];return Math.sqrt(d*d+e*e)}function I(a,b,c){c||(c=Qa);var d=b[c[0]]-a[c[0]],e=b[c[1]]-a[c[1]];return 180*Math.atan2(e,d)/Math.PI}function J(a,b){return I(b[1],b[0],Ra)+I(a[1],a[0],Ra)}function K(a,b){return H(b[0],b[1],Ra)/H(a[0],a[1],Ra)}function L(){this.evEl=Ta,this.evWin=Ua,this.pressed=!1,x.apply(this,arguments)}function M(){this.evEl=Xa,this.evWin=Ya,x.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}function N(){this.evTarget=$a,this.evWin=_a,this.started=!1,x.apply(this,arguments)}function O(a,b){var c=s(a.touches),d=s(a.changedTouches);return b&(Ga|Ha)&&(c=t(c.concat(d),"identifier",!0)),[c,d]}function P(){this.evTarget=bb,this.targetIds={},x.apply(this,arguments)}function Q(a,b){var c=s(a.touches),d=this.targetIds;if(b&(Ea|Fa)&&1===c.length)return d[c[0].identifier]=!0,[c,c];var e,f,g=s(a.changedTouches),h=[],i=this.target;if(f=c.filter(function(a){return o(a.target,i)}),b===Ea)for(e=0;e<f.length;)d[f[e].identifier]=!0,e++;for(e=0;e<g.length;)d[g[e].identifier]&&h.push(g[e]),b&(Ga|Ha)&&delete d[g[e].identifier],e++;return h.length?[t(f.concat(h),"identifier",!0),h]:void 0}function R(){x.apply(this,arguments);var a=j(this.handler,this);this.touch=new P(this.manager,a),this.mouse=new L(this.manager,a),this.primaryTouch=null,this.lastTouches=[]}function S(a,b){a&Ea?(this.primaryTouch=b.changedPointers[0].identifier,T.call(this,b)):a&(Ga|Ha)&&T.call(this,b)}function T(a){var b=a.changedPointers[0];if(b.identifier===this.primaryTouch){var c={x:b.clientX,y:b.clientY};this.lastTouches.push(c);var d=this.lastTouches,e=function(){var a=d.indexOf(c);a>-1&&d.splice(a,1)};setTimeout(e,cb)}}function U(a){for(var b=a.srcEvent.clientX,c=a.srcEvent.clientY,d=0;d<this.lastTouches.length;d++){var e=this.lastTouches[d],f=Math.abs(b-e.x),g=Math.abs(c-e.y);if(db>=f&&db>=g)return!0}return!1}function V(a,b){this.manager=a,this.set(b)}function W(a){if(p(a,jb))return jb;var b=p(a,kb),c=p(a,lb);return b&&c?jb:b||c?b?kb:lb:p(a,ib)?ib:hb}function X(){if(!fb)return!1;var b={},c=a.CSS&&a.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(d){b[d]=c?a.CSS.supports("touch-action",d):!0}),b}function Y(a){this.options=la({},this.defaults,a||{}),this.id=v(),this.manager=null,this.options.enable=l(this.options.enable,!0),this.state=nb,this.simultaneous={},this.requireFail=[]}function Z(a){return a&sb?"cancel":a&qb?"end":a&pb?"move":a&ob?"start":""}function $(a){return a==Ma?"down":a==La?"up":a==Ja?"left":a==Ka?"right":""}function _(a,b){var c=b.manager;return c?c.get(a):a}function aa(){Y.apply(this,arguments)}function ba(){aa.apply(this,arguments),this.pX=null,this.pY=null}function ca(){aa.apply(this,arguments)}function da(){Y.apply(this,arguments),this._timer=null,this._input=null}function ea(){aa.apply(this,arguments)}function fa(){aa.apply(this,arguments)}function ga(){Y.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function ha(a,b){return b=b||{},b.recognizers=l(b.recognizers,ha.defaults.preset),new ia(a,b)}function ia(a,b){this.options=la({},ha.defaults,b||{}),this.options.inputTarget=this.options.inputTarget||a,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=a,this.input=y(this),this.touchAction=new V(this,this.options.touchAction),ja(this,!0),g(this.options.recognizers,function(a){var b=this.add(new a[0](a[1]));a[2]&&b.recognizeWith(a[2]),a[3]&&b.requireFailure(a[3])},this)}function ja(a,b){var c=a.element;if(c.style){var d;g(a.options.cssProps,function(e,f){d=u(c.style,f),b?(a.oldCssProps[d]=c.style[d],c.style[d]=e):c.style[d]=a.oldCssProps[d]||""}),b||(a.oldCssProps={})}}function ka(a,c){var d=b.createEvent("Event");d.initEvent(a,!0,!0),d.gesture=c,c.target.dispatchEvent(d)}var la,ma=["","webkit","Moz","MS","ms","o"],na=b.createElement("div"),oa="function",pa=Math.round,qa=Math.abs,ra=Date.now;la="function"!=typeof Object.assign?function(a){if(a===d||null===a)throw new TypeError("Cannot convert undefined or null to object");for(var b=Object(a),c=1;c<arguments.length;c++){var e=arguments[c];if(e!==d&&null!==e)for(var f in e)e.hasOwnProperty(f)&&(b[f]=e[f])}return b}:Object.assign;var sa=h(function(a,b,c){for(var e=Object.keys(b),f=0;f<e.length;)(!c||c&&a[e[f]]===d)&&(a[e[f]]=b[e[f]]),f++;return a},"extend","Use `assign`."),ta=h(function(a,b){return sa(a,b,!0)},"merge","Use `assign`."),ua=1,va=/mobile|tablet|ip(ad|hone|od)|android/i,wa="ontouchstart"in a,xa=u(a,"PointerEvent")!==d,ya=wa&&va.test(navigator.userAgent),za="touch",Aa="pen",Ba="mouse",Ca="kinect",Da=25,Ea=1,Fa=2,Ga=4,Ha=8,Ia=1,Ja=2,Ka=4,La=8,Ma=16,Na=Ja|Ka,Oa=La|Ma,Pa=Na|Oa,Qa=["x","y"],Ra=["clientX","clientY"];x.prototype={handler:function(){},init:function(){this.evEl&&m(this.element,this.evEl,this.domHandler),this.evTarget&&m(this.target,this.evTarget,this.domHandler),this.evWin&&m(w(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&n(this.element,this.evEl,this.domHandler),this.evTarget&&n(this.target,this.evTarget,this.domHandler),this.evWin&&n(w(this.element),this.evWin,this.domHandler)}};var Sa={mousedown:Ea,mousemove:Fa,mouseup:Ga},Ta="mousedown",Ua="mousemove mouseup";i(L,x,{handler:function(a){var b=Sa[a.type];b&Ea&&0===a.button&&(this.pressed=!0),b&Fa&&1!==a.which&&(b=Ga),this.pressed&&(b&Ga&&(this.pressed=!1),this.callback(this.manager,b,{pointers:[a],changedPointers:[a],pointerType:Ba,srcEvent:a}))}});var Va={pointerdown:Ea,pointermove:Fa,pointerup:Ga,pointercancel:Ha,pointerout:Ha},Wa={2:za,3:Aa,4:Ba,5:Ca},Xa="pointerdown",Ya="pointermove pointerup pointercancel";a.MSPointerEvent&&!a.PointerEvent&&(Xa="MSPointerDown",Ya="MSPointerMove MSPointerUp MSPointerCancel"),i(M,x,{handler:function(a){var b=this.store,c=!1,d=a.type.toLowerCase().replace("ms",""),e=Va[d],f=Wa[a.pointerType]||a.pointerType,g=f==za,h=r(b,a.pointerId,"pointerId");e&Ea&&(0===a.button||g)?0>h&&(b.push(a),h=b.length-1):e&(Ga|Ha)&&(c=!0),0>h||(b[h]=a,this.callback(this.manager,e,{pointers:b,changedPointers:[a],pointerType:f,srcEvent:a}),c&&b.splice(h,1))}});var Za={touchstart:Ea,touchmove:Fa,touchend:Ga,touchcancel:Ha},$a="touchstart",_a="touchstart touchmove touchend touchcancel";i(N,x,{handler:function(a){var b=Za[a.type];if(b===Ea&&(this.started=!0),this.started){var c=O.call(this,a,b);b&(Ga|Ha)&&c[0].length-c[1].length===0&&(this.started=!1),this.callback(this.manager,b,{pointers:c[0],changedPointers:c[1],pointerType:za,srcEvent:a})}}});var ab={touchstart:Ea,touchmove:Fa,touchend:Ga,touchcancel:Ha},bb="touchstart touchmove touchend touchcancel";i(P,x,{handler:function(a){var b=ab[a.type],c=Q.call(this,a,b);c&&this.callback(this.manager,b,{pointers:c[0],changedPointers:c[1],pointerType:za,srcEvent:a})}});var cb=2500,db=25;i(R,x,{handler:function(a,b,c){var d=c.pointerType==za,e=c.pointerType==Ba;if(!(e&&c.sourceCapabilities&&c.sourceCapabilities.firesTouchEvents)){if(d)S.call(this,b,c);else if(e&&U.call(this,c))return;this.callback(a,b,c)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var eb=u(na.style,"touchAction"),fb=eb!==d,gb="compute",hb="auto",ib="manipulation",jb="none",kb="pan-x",lb="pan-y",mb=X();V.prototype={set:function(a){a==gb&&(a=this.compute()),fb&&this.manager.element.style&&mb[a]&&(this.manager.element.style[eb]=a),this.actions=a.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var a=[];return g(this.manager.recognizers,function(b){k(b.options.enable,[b])&&(a=a.concat(b.getTouchAction()))}),W(a.join(" "))},preventDefaults:function(a){var b=a.srcEvent,c=a.offsetDirection;if(this.manager.session.prevented)return void b.preventDefault();var d=this.actions,e=p(d,jb)&&!mb[jb],f=p(d,lb)&&!mb[lb],g=p(d,kb)&&!mb[kb];if(e){var h=1===a.pointers.length,i=a.distance<2,j=a.deltaTime<250;if(h&&i&&j)return}return g&&f?void 0:e||f&&c&Na||g&&c&Oa?this.preventSrc(b):void 0},preventSrc:function(a){this.manager.session.prevented=!0,a.preventDefault()}};var nb=1,ob=2,pb=4,qb=8,rb=qb,sb=16,tb=32;Y.prototype={defaults:{},set:function(a){return la(this.options,a),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(a){if(f(a,"recognizeWith",this))return this;var b=this.simultaneous;return a=_(a,this),b[a.id]||(b[a.id]=a,a.recognizeWith(this)),this},dropRecognizeWith:function(a){return f(a,"dropRecognizeWith",this)?this:(a=_(a,this),delete this.simultaneous[a.id],this)},requireFailure:function(a){if(f(a,"requireFailure",this))return this;var b=this.requireFail;return a=_(a,this),-1===r(b,a)&&(b.push(a),a.requireFailure(this)),this},dropRequireFailure:function(a){if(f(a,"dropRequireFailure",this))return this;a=_(a,this);var b=r(this.requireFail,a);return b>-1&&this.requireFail.splice(b,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(a){return!!this.simultaneous[a.id]},emit:function(a){function b(b){c.manager.emit(b,a)}var c=this,d=this.state;qb>d&&b(c.options.event+Z(d)),b(c.options.event),a.additionalEvent&&b(a.additionalEvent),d>=qb&&b(c.options.event+Z(d))},tryEmit:function(a){return this.canEmit()?this.emit(a):void(this.state=tb)},canEmit:function(){for(var a=0;a<this.requireFail.length;){if(!(this.requireFail[a].state&(tb|nb)))return!1;a++}return!0},recognize:function(a){var b=la({},a);return k(this.options.enable,[this,b])?(this.state&(rb|sb|tb)&&(this.state=nb),this.state=this.process(b),void(this.state&(ob|pb|qb|sb)&&this.tryEmit(b))):(this.reset(),void(this.state=tb))},process:function(a){},getTouchAction:function(){},reset:function(){}},i(aa,Y,{defaults:{pointers:1},attrTest:function(a){var b=this.options.pointers;return 0===b||a.pointers.length===b},process:function(a){var b=this.state,c=a.eventType,d=b&(ob|pb),e=this.attrTest(a);return d&&(c&Ha||!e)?b|sb:d||e?c&Ga?b|qb:b&ob?b|pb:ob:tb}}),i(ba,aa,{defaults:{event:"pan",threshold:10,pointers:1,direction:Pa},getTouchAction:function(){var a=this.options.direction,b=[];return a&Na&&b.push(lb),a&Oa&&b.push(kb),b},directionTest:function(a){var b=this.options,c=!0,d=a.distance,e=a.direction,f=a.deltaX,g=a.deltaY;return e&b.direction||(b.direction&Na?(e=0===f?Ia:0>f?Ja:Ka,c=f!=this.pX,d=Math.abs(a.deltaX)):(e=0===g?Ia:0>g?La:Ma,c=g!=this.pY,d=Math.abs(a.deltaY))),a.direction=e,c&&d>b.threshold&&e&b.direction},attrTest:function(a){return aa.prototype.attrTest.call(this,a)&&(this.state&ob||!(this.state&ob)&&this.directionTest(a))},emit:function(a){this.pX=a.deltaX,this.pY=a.deltaY;var b=$(a.direction);b&&(a.additionalEvent=this.options.event+b),this._super.emit.call(this,a)}}),i(ca,aa,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[jb]},attrTest:function(a){return this._super.attrTest.call(this,a)&&(Math.abs(a.scale-1)>this.options.threshold||this.state&ob)},emit:function(a){if(1!==a.scale){var b=a.scale<1?"in":"out";a.additionalEvent=this.options.event+b}this._super.emit.call(this,a)}}),i(da,Y,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[hb]},process:function(a){var b=this.options,c=a.pointers.length===b.pointers,d=a.distance<b.threshold,f=a.deltaTime>b.time;if(this._input=a,!d||!c||a.eventType&(Ga|Ha)&&!f)this.reset();else if(a.eventType&Ea)this.reset(),this._timer=e(function(){this.state=rb,this.tryEmit()},b.time,this);else if(a.eventType&Ga)return rb;return tb},reset:function(){clearTimeout(this._timer)},emit:function(a){this.state===rb&&(a&&a.eventType&Ga?this.manager.emit(this.options.event+"up",a):(this._input.timeStamp=ra(),this.manager.emit(this.options.event,this._input)))}}),i(ea,aa,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[jb]},attrTest:function(a){return this._super.attrTest.call(this,a)&&(Math.abs(a.rotation)>this.options.threshold||this.state&ob)}}),i(fa,aa,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:Na|Oa,pointers:1},getTouchAction:function(){return ba.prototype.getTouchAction.call(this)},attrTest:function(a){var b,c=this.options.direction;return c&(Na|Oa)?b=a.overallVelocity:c&Na?b=a.overallVelocityX:c&Oa&&(b=a.overallVelocityY),this._super.attrTest.call(this,a)&&c&a.offsetDirection&&a.distance>this.options.threshold&&a.maxPointers==this.options.pointers&&qa(b)>this.options.velocity&&a.eventType&Ga},emit:function(a){var b=$(a.offsetDirection);b&&this.manager.emit(this.options.event+b,a),this.manager.emit(this.options.event,a)}}),i(ga,Y,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[ib]},process:function(a){var b=this.options,c=a.pointers.length===b.pointers,d=a.distance<b.threshold,f=a.deltaTime<b.time;if(this.reset(),a.eventType&Ea&&0===this.count)return this.failTimeout();if(d&&f&&c){if(a.eventType!=Ga)return this.failTimeout();var g=this.pTime?a.timeStamp-this.pTime<b.interval:!0,h=!this.pCenter||H(this.pCenter,a.center)<b.posThreshold;this.pTime=a.timeStamp,this.pCenter=a.center,h&&g?this.count+=1:this.count=1,this._input=a;var i=this.count%b.taps;if(0===i)return this.hasRequireFailures()?(this._timer=e(function(){this.state=rb,this.tryEmit()},b.interval,this),ob):rb}return tb},failTimeout:function(){return this._timer=e(function(){this.state=tb},this.options.interval,this),tb},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==rb&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),ha.VERSION="2.0.8",ha.defaults={domEvents:!1,touchAction:gb,enable:!0,inputTarget:null,inputClass:null,preset:[[ea,{enable:!1}],[ca,{enable:!1},["rotate"]],[fa,{direction:Na}],[ba,{direction:Na},["swipe"]],[ga],[ga,{event:"doubletap",taps:2},["tap"]],[da]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var ub=1,vb=2;ia.prototype={set:function(a){return la(this.options,a),a.touchAction&&this.touchAction.update(),a.inputTarget&&(this.input.destroy(),this.input.target=a.inputTarget,this.input.init()),this},stop:function(a){this.session.stopped=a?vb:ub},recognize:function(a){var b=this.session;if(!b.stopped){this.touchAction.preventDefaults(a);var c,d=this.recognizers,e=b.curRecognizer;(!e||e&&e.state&rb)&&(e=b.curRecognizer=null);for(var f=0;f<d.length;)c=d[f],b.stopped===vb||e&&c!=e&&!c.canRecognizeWith(e)?c.reset():c.recognize(a),!e&&c.state&(ob|pb|qb)&&(e=b.curRecognizer=c),f++}},get:function(a){if(a instanceof Y)return a;for(var b=this.recognizers,c=0;c<b.length;c++)if(b[c].options.event==a)return b[c];return null},add:function(a){if(f(a,"add",this))return this;var b=this.get(a.options.event);return b&&this.remove(b),this.recognizers.push(a),a.manager=this,this.touchAction.update(),a},remove:function(a){if(f(a,"remove",this))return this;if(a=this.get(a)){var b=this.recognizers,c=r(b,a);-1!==c&&(b.splice(c,1),this.touchAction.update())}return this},on:function(a,b){if(a!==d&&b!==d){var c=this.handlers;return g(q(a),function(a){c[a]=c[a]||[],c[a].push(b)}),this}},off:function(a,b){if(a!==d){var c=this.handlers;return g(q(a),function(a){b?c[a]&&c[a].splice(r(c[a],b),1):delete c[a]}),this}},emit:function(a,b){this.options.domEvents&&ka(a,b);var c=this.handlers[a]&&this.handlers[a].slice();if(c&&c.length){b.type=a,b.preventDefault=function(){b.srcEvent.preventDefault()};for(var d=0;d<c.length;)c[d](b),d++}},destroy:function(){this.element&&ja(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},la(ha,{INPUT_START:Ea,INPUT_MOVE:Fa,INPUT_END:Ga,INPUT_CANCEL:Ha,STATE_POSSIBLE:nb,STATE_BEGAN:ob,STATE_CHANGED:pb,STATE_ENDED:qb,STATE_RECOGNIZED:rb,STATE_CANCELLED:sb,STATE_FAILED:tb,DIRECTION_NONE:Ia,DIRECTION_LEFT:Ja,DIRECTION_RIGHT:Ka,DIRECTION_UP:La,DIRECTION_DOWN:Ma,DIRECTION_HORIZONTAL:Na,DIRECTION_VERTICAL:Oa,DIRECTION_ALL:Pa,Manager:ia,Input:x,TouchAction:V,TouchInput:P,MouseInput:L,PointerEventInput:M,TouchMouseInput:R,SingleTouchInput:N,Recognizer:Y,AttrRecognizer:aa,Tap:ga,Pan:ba,Swipe:fa,Pinch:ca,Rotate:ea,Press:da,on:m,off:n,each:g,merge:ta,extend:sa,assign:la,inherit:i,bindFn:j,prefixed:u});var wb="undefined"!=typeof a?a:"undefined"!=typeof self?self:{};wb.Hammer=ha,"function"==typeof define&&define.amd?define(function(){return ha}):"undefined"!=typeof module&&module.exports?module.exports=ha:a[c]=ha}(window,document,"Hammer");
|
7 |
-
//# sourceMappingURL=hammer.min.js.map
|
3 |
*
|
4 |
* Copyright (c) 2016 Jorik Tangelder;
|
5 |
* Licensed under the MIT license */
|
6 |
+
!function(a,b,c,d){"use strict";function e(a,b,c){return setTimeout(j(a,c),b)}function f(a,b,c){return Array.isArray(a)?(g(a,c[b],c),!0):!1}function g(a,b,c){var e;if(a)if(a.forEach)a.forEach(b,c);else if(a.length!==d)for(e=0;e<a.length;)b.call(c,a[e],e,a),e++;else for(e in a)a.hasOwnProperty(e)&&b.call(c,a[e],e,a)}function h(b,c,d){var e="DEPRECATED METHOD: "+c+"\n"+d+" AT \n";return function(){var c=new Error("get-stack-trace"),d=c&&c.stack?c.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",f=a.console&&(a.console.warn||a.console.log);return f&&f.call(a.console,e,d),b.apply(this,arguments)}}function i(a,b,c){var d,e=b.prototype;d=a.prototype=Object.create(e),d.constructor=a,d._super=e,c&&la(d,c)}function j(a,b){return function(){return a.apply(b,arguments)}}function k(a,b){return typeof a==oa?a.apply(b?b[0]||d:d,b):a}function l(a,b){return a===d?b:a}function m(a,b,c){g(q(b),function(b){a.addEventListener(b,c,!1)})}function n(a,b,c){g(q(b),function(b){a.removeEventListener(b,c,!1)})}function o(a,b){for(;a;){if(a==b)return!0;a=a.parentNode}return!1}function p(a,b){return a.indexOf(b)>-1}function q(a){return a.trim().split(/\s+/g)}function r(a,b,c){if(a.indexOf&&!c)return a.indexOf(b);for(var d=0;d<a.length;){if(c&&a[d][c]==b||!c&&a[d]===b)return d;d++}return-1}function s(a){return Array.prototype.slice.call(a,0)}function t(a,b,c){for(var d=[],e=[],f=0;f<a.length;){var g=b?a[f][b]:a[f];r(e,g)<0&&d.push(a[f]),e[f]=g,f++}return c&&(d=b?d.sort(function(a,c){return a[b]>c[b]}):d.sort()),d}function u(a,b){for(var c,e,f=b[0].toUpperCase()+b.slice(1),g=0;g<ma.length;){if(c=ma[g],e=c?c+f:b,e in a)return e;g++}return d}function v(){return ua++}function w(b){var c=b.ownerDocument||b;return c.defaultView||c.parentWindow||a}function x(a,b){var c=this;this.manager=a,this.callback=b,this.element=a.element,this.target=a.options.inputTarget,this.domHandler=function(b){k(a.options.enable,[a])&&c.handler(b)},this.init()}function y(a){var b,c=a.options.inputClass;return new(b=c?c:xa?M:ya?P:wa?R:L)(a,z)}function z(a,b,c){var d=c.pointers.length,e=c.changedPointers.length,f=b&Ea&&d-e===0,g=b&(Ga|Ha)&&d-e===0;c.isFirst=!!f,c.isFinal=!!g,f&&(a.session={}),c.eventType=b,A(a,c),a.emit("hammer.input",c),a.recognize(c),a.session.prevInput=c}function A(a,b){var c=a.session,d=b.pointers,e=d.length;c.firstInput||(c.firstInput=D(b)),e>1&&!c.firstMultiple?c.firstMultiple=D(b):1===e&&(c.firstMultiple=!1);var f=c.firstInput,g=c.firstMultiple,h=g?g.center:f.center,i=b.center=E(d);b.timeStamp=ra(),b.deltaTime=b.timeStamp-f.timeStamp,b.angle=I(h,i),b.distance=H(h,i),B(c,b),b.offsetDirection=G(b.deltaX,b.deltaY);var j=F(b.deltaTime,b.deltaX,b.deltaY);b.overallVelocityX=j.x,b.overallVelocityY=j.y,b.overallVelocity=qa(j.x)>qa(j.y)?j.x:j.y,b.scale=g?K(g.pointers,d):1,b.rotation=g?J(g.pointers,d):0,b.maxPointers=c.prevInput?b.pointers.length>c.prevInput.maxPointers?b.pointers.length:c.prevInput.maxPointers:b.pointers.length,C(c,b);var k=a.element;o(b.srcEvent.target,k)&&(k=b.srcEvent.target),b.target=k}function B(a,b){var c=b.center,d=a.offsetDelta||{},e=a.prevDelta||{},f=a.prevInput||{};b.eventType!==Ea&&f.eventType!==Ga||(e=a.prevDelta={x:f.deltaX||0,y:f.deltaY||0},d=a.offsetDelta={x:c.x,y:c.y}),b.deltaX=e.x+(c.x-d.x),b.deltaY=e.y+(c.y-d.y)}function C(a,b){var c,e,f,g,h=a.lastInterval||b,i=b.timeStamp-h.timeStamp;if(b.eventType!=Ha&&(i>Da||h.velocity===d)){var j=b.deltaX-h.deltaX,k=b.deltaY-h.deltaY,l=F(i,j,k);e=l.x,f=l.y,c=qa(l.x)>qa(l.y)?l.x:l.y,g=G(j,k),a.lastInterval=b}else c=h.velocity,e=h.velocityX,f=h.velocityY,g=h.direction;b.velocity=c,b.velocityX=e,b.velocityY=f,b.direction=g}function D(a){for(var b=[],c=0;c<a.pointers.length;)b[c]={clientX:pa(a.pointers[c].clientX),clientY:pa(a.pointers[c].clientY)},c++;return{timeStamp:ra(),pointers:b,center:E(b),deltaX:a.deltaX,deltaY:a.deltaY}}function E(a){var b=a.length;if(1===b)return{x:pa(a[0].clientX),y:pa(a[0].clientY)};for(var c=0,d=0,e=0;b>e;)c+=a[e].clientX,d+=a[e].clientY,e++;return{x:pa(c/b),y:pa(d/b)}}function F(a,b,c){return{x:b/a||0,y:c/a||0}}function G(a,b){return a===b?Ia:qa(a)>=qa(b)?0>a?Ja:Ka:0>b?La:Ma}function H(a,b,c){c||(c=Qa);var d=b[c[0]]-a[c[0]],e=b[c[1]]-a[c[1]];return Math.sqrt(d*d+e*e)}function I(a,b,c){c||(c=Qa);var d=b[c[0]]-a[c[0]],e=b[c[1]]-a[c[1]];return 180*Math.atan2(e,d)/Math.PI}function J(a,b){return I(b[1],b[0],Ra)+I(a[1],a[0],Ra)}function K(a,b){return H(b[0],b[1],Ra)/H(a[0],a[1],Ra)}function L(){this.evEl=Ta,this.evWin=Ua,this.pressed=!1,x.apply(this,arguments)}function M(){this.evEl=Xa,this.evWin=Ya,x.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}function N(){this.evTarget=$a,this.evWin=_a,this.started=!1,x.apply(this,arguments)}function O(a,b){var c=s(a.touches),d=s(a.changedTouches);return b&(Ga|Ha)&&(c=t(c.concat(d),"identifier",!0)),[c,d]}function P(){this.evTarget=bb,this.targetIds={},x.apply(this,arguments)}function Q(a,b){var c=s(a.touches),d=this.targetIds;if(b&(Ea|Fa)&&1===c.length)return d[c[0].identifier]=!0,[c,c];var e,f,g=s(a.changedTouches),h=[],i=this.target;if(f=c.filter(function(a){return o(a.target,i)}),b===Ea)for(e=0;e<f.length;)d[f[e].identifier]=!0,e++;for(e=0;e<g.length;)d[g[e].identifier]&&h.push(g[e]),b&(Ga|Ha)&&delete d[g[e].identifier],e++;return h.length?[t(f.concat(h),"identifier",!0),h]:void 0}function R(){x.apply(this,arguments);var a=j(this.handler,this);this.touch=new P(this.manager,a),this.mouse=new L(this.manager,a),this.primaryTouch=null,this.lastTouches=[]}function S(a,b){a&Ea?(this.primaryTouch=b.changedPointers[0].identifier,T.call(this,b)):a&(Ga|Ha)&&T.call(this,b)}function T(a){var b=a.changedPointers[0];if(b.identifier===this.primaryTouch){var c={x:b.clientX,y:b.clientY};this.lastTouches.push(c);var d=this.lastTouches,e=function(){var a=d.indexOf(c);a>-1&&d.splice(a,1)};setTimeout(e,cb)}}function U(a){for(var b=a.srcEvent.clientX,c=a.srcEvent.clientY,d=0;d<this.lastTouches.length;d++){var e=this.lastTouches[d],f=Math.abs(b-e.x),g=Math.abs(c-e.y);if(db>=f&&db>=g)return!0}return!1}function V(a,b){this.manager=a,this.set(b)}function W(a){if(p(a,jb))return jb;var b=p(a,kb),c=p(a,lb);return b&&c?jb:b||c?b?kb:lb:p(a,ib)?ib:hb}function X(){if(!fb)return!1;var b={},c=a.CSS&&a.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(d){b[d]=c?a.CSS.supports("touch-action",d):!0}),b}function Y(a){this.options=la({},this.defaults,a||{}),this.id=v(),this.manager=null,this.options.enable=l(this.options.enable,!0),this.state=nb,this.simultaneous={},this.requireFail=[]}function Z(a){return a&sb?"cancel":a&qb?"end":a&pb?"move":a&ob?"start":""}function $(a){return a==Ma?"down":a==La?"up":a==Ja?"left":a==Ka?"right":""}function _(a,b){var c=b.manager;return c?c.get(a):a}function aa(){Y.apply(this,arguments)}function ba(){aa.apply(this,arguments),this.pX=null,this.pY=null}function ca(){aa.apply(this,arguments)}function da(){Y.apply(this,arguments),this._timer=null,this._input=null}function ea(){aa.apply(this,arguments)}function fa(){aa.apply(this,arguments)}function ga(){Y.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function ha(a,b){return b=b||{},b.recognizers=l(b.recognizers,ha.defaults.preset),new ia(a,b)}function ia(a,b){this.options=la({},ha.defaults,b||{}),this.options.inputTarget=this.options.inputTarget||a,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=a,this.input=y(this),this.touchAction=new V(this,this.options.touchAction),ja(this,!0),g(this.options.recognizers,function(a){var b=this.add(new a[0](a[1]));a[2]&&b.recognizeWith(a[2]),a[3]&&b.requireFailure(a[3])},this)}function ja(a,b){var c=a.element;if(c.style){var d;g(a.options.cssProps,function(e,f){d=u(c.style,f),b?(a.oldCssProps[d]=c.style[d],c.style[d]=e):c.style[d]=a.oldCssProps[d]||""}),b||(a.oldCssProps={})}}function ka(a,c){var d=b.createEvent("Event");d.initEvent(a,!0,!0),d.gesture=c,c.target.dispatchEvent(d)}var la,ma=["","webkit","Moz","MS","ms","o"],na=b.createElement("div"),oa="function",pa=Math.round,qa=Math.abs,ra=Date.now;la="function"!=typeof Object.assign?function(a){if(a===d||null===a)throw new TypeError("Cannot convert undefined or null to object");for(var b=Object(a),c=1;c<arguments.length;c++){var e=arguments[c];if(e!==d&&null!==e)for(var f in e)e.hasOwnProperty(f)&&(b[f]=e[f])}return b}:Object.assign;var sa=h(function(a,b,c){for(var e=Object.keys(b),f=0;f<e.length;)(!c||c&&a[e[f]]===d)&&(a[e[f]]=b[e[f]]),f++;return a},"extend","Use `assign`."),ta=h(function(a,b){return sa(a,b,!0)},"merge","Use `assign`."),ua=1,va=/mobile|tablet|ip(ad|hone|od)|android/i,wa="ontouchstart"in a,xa=u(a,"PointerEvent")!==d,ya=wa&&va.test(navigator.userAgent),za="touch",Aa="pen",Ba="mouse",Ca="kinect",Da=25,Ea=1,Fa=2,Ga=4,Ha=8,Ia=1,Ja=2,Ka=4,La=8,Ma=16,Na=Ja|Ka,Oa=La|Ma,Pa=Na|Oa,Qa=["x","y"],Ra=["clientX","clientY"];x.prototype={handler:function(){},init:function(){this.evEl&&m(this.element,this.evEl,this.domHandler),this.evTarget&&m(this.target,this.evTarget,this.domHandler),this.evWin&&m(w(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&n(this.element,this.evEl,this.domHandler),this.evTarget&&n(this.target,this.evTarget,this.domHandler),this.evWin&&n(w(this.element),this.evWin,this.domHandler)}};var Sa={mousedown:Ea,mousemove:Fa,mouseup:Ga},Ta="mousedown",Ua="mousemove mouseup";i(L,x,{handler:function(a){var b=Sa[a.type];b&Ea&&0===a.button&&(this.pressed=!0),b&Fa&&1!==a.which&&(b=Ga),this.pressed&&(b&Ga&&(this.pressed=!1),this.callback(this.manager,b,{pointers:[a],changedPointers:[a],pointerType:Ba,srcEvent:a}))}});var Va={pointerdown:Ea,pointermove:Fa,pointerup:Ga,pointercancel:Ha,pointerout:Ha},Wa={2:za,3:Aa,4:Ba,5:Ca},Xa="pointerdown",Ya="pointermove pointerup pointercancel";a.MSPointerEvent&&!a.PointerEvent&&(Xa="MSPointerDown",Ya="MSPointerMove MSPointerUp MSPointerCancel"),i(M,x,{handler:function(a){var b=this.store,c=!1,d=a.type.toLowerCase().replace("ms",""),e=Va[d],f=Wa[a.pointerType]||a.pointerType,g=f==za,h=r(b,a.pointerId,"pointerId");e&Ea&&(0===a.button||g)?0>h&&(b.push(a),h=b.length-1):e&(Ga|Ha)&&(c=!0),0>h||(b[h]=a,this.callback(this.manager,e,{pointers:b,changedPointers:[a],pointerType:f,srcEvent:a}),c&&b.splice(h,1))}});var Za={touchstart:Ea,touchmove:Fa,touchend:Ga,touchcancel:Ha},$a="touchstart",_a="touchstart touchmove touchend touchcancel";i(N,x,{handler:function(a){var b=Za[a.type];if(b===Ea&&(this.started=!0),this.started){var c=O.call(this,a,b);b&(Ga|Ha)&&c[0].length-c[1].length===0&&(this.started=!1),this.callback(this.manager,b,{pointers:c[0],changedPointers:c[1],pointerType:za,srcEvent:a})}}});var ab={touchstart:Ea,touchmove:Fa,touchend:Ga,touchcancel:Ha},bb="touchstart touchmove touchend touchcancel";i(P,x,{handler:function(a){var b=ab[a.type],c=Q.call(this,a,b);c&&this.callback(this.manager,b,{pointers:c[0],changedPointers:c[1],pointerType:za,srcEvent:a})}});var cb=2500,db=25;i(R,x,{handler:function(a,b,c){var d=c.pointerType==za,e=c.pointerType==Ba;if(!(e&&c.sourceCapabilities&&c.sourceCapabilities.firesTouchEvents)){if(d)S.call(this,b,c);else if(e&&U.call(this,c))return;this.callback(a,b,c)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var eb=u(na.style,"touchAction"),fb=eb!==d,gb="compute",hb="auto",ib="manipulation",jb="none",kb="pan-x",lb="pan-y",mb=X();V.prototype={set:function(a){a==gb&&(a=this.compute()),fb&&this.manager.element.style&&mb[a]&&(this.manager.element.style[eb]=a),this.actions=a.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var a=[];return g(this.manager.recognizers,function(b){k(b.options.enable,[b])&&(a=a.concat(b.getTouchAction()))}),W(a.join(" "))},preventDefaults:function(a){var b=a.srcEvent,c=a.offsetDirection;if(this.manager.session.prevented)return void b.preventDefault();var d=this.actions,e=p(d,jb)&&!mb[jb],f=p(d,lb)&&!mb[lb],g=p(d,kb)&&!mb[kb];if(e){var h=1===a.pointers.length,i=a.distance<2,j=a.deltaTime<250;if(h&&i&&j)return}return g&&f?void 0:e||f&&c&Na||g&&c&Oa?this.preventSrc(b):void 0},preventSrc:function(a){this.manager.session.prevented=!0,a.preventDefault()}};var nb=1,ob=2,pb=4,qb=8,rb=qb,sb=16,tb=32;Y.prototype={defaults:{},set:function(a){return la(this.options,a),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(a){if(f(a,"recognizeWith",this))return this;var b=this.simultaneous;return a=_(a,this),b[a.id]||(b[a.id]=a,a.recognizeWith(this)),this},dropRecognizeWith:function(a){return f(a,"dropRecognizeWith",this)?this:(a=_(a,this),delete this.simultaneous[a.id],this)},requireFailure:function(a){if(f(a,"requireFailure",this))return this;var b=this.requireFail;return a=_(a,this),-1===r(b,a)&&(b.push(a),a.requireFailure(this)),this},dropRequireFailure:function(a){if(f(a,"dropRequireFailure",this))return this;a=_(a,this);var b=r(this.requireFail,a);return b>-1&&this.requireFail.splice(b,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(a){return!!this.simultaneous[a.id]},emit:function(a){function b(b){c.manager.emit(b,a)}var c=this,d=this.state;qb>d&&b(c.options.event+Z(d)),b(c.options.event),a.additionalEvent&&b(a.additionalEvent),d>=qb&&b(c.options.event+Z(d))},tryEmit:function(a){return this.canEmit()?this.emit(a):void(this.state=tb)},canEmit:function(){for(var a=0;a<this.requireFail.length;){if(!(this.requireFail[a].state&(tb|nb)))return!1;a++}return!0},recognize:function(a){var b=la({},a);return k(this.options.enable,[this,b])?(this.state&(rb|sb|tb)&&(this.state=nb),this.state=this.process(b),void(this.state&(ob|pb|qb|sb)&&this.tryEmit(b))):(this.reset(),void(this.state=tb))},process:function(a){},getTouchAction:function(){},reset:function(){}},i(aa,Y,{defaults:{pointers:1},attrTest:function(a){var b=this.options.pointers;return 0===b||a.pointers.length===b},process:function(a){var b=this.state,c=a.eventType,d=b&(ob|pb),e=this.attrTest(a);return d&&(c&Ha||!e)?b|sb:d||e?c&Ga?b|qb:b&ob?b|pb:ob:tb}}),i(ba,aa,{defaults:{event:"pan",threshold:10,pointers:1,direction:Pa},getTouchAction:function(){var a=this.options.direction,b=[];return a&Na&&b.push(lb),a&Oa&&b.push(kb),b},directionTest:function(a){var b=this.options,c=!0,d=a.distance,e=a.direction,f=a.deltaX,g=a.deltaY;return e&b.direction||(b.direction&Na?(e=0===f?Ia:0>f?Ja:Ka,c=f!=this.pX,d=Math.abs(a.deltaX)):(e=0===g?Ia:0>g?La:Ma,c=g!=this.pY,d=Math.abs(a.deltaY))),a.direction=e,c&&d>b.threshold&&e&b.direction},attrTest:function(a){return aa.prototype.attrTest.call(this,a)&&(this.state&ob||!(this.state&ob)&&this.directionTest(a))},emit:function(a){this.pX=a.deltaX,this.pY=a.deltaY;var b=$(a.direction);b&&(a.additionalEvent=this.options.event+b),this._super.emit.call(this,a)}}),i(ca,aa,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[jb]},attrTest:function(a){return this._super.attrTest.call(this,a)&&(Math.abs(a.scale-1)>this.options.threshold||this.state&ob)},emit:function(a){if(1!==a.scale){var b=a.scale<1?"in":"out";a.additionalEvent=this.options.event+b}this._super.emit.call(this,a)}}),i(da,Y,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[hb]},process:function(a){var b=this.options,c=a.pointers.length===b.pointers,d=a.distance<b.threshold,f=a.deltaTime>b.time;if(this._input=a,!d||!c||a.eventType&(Ga|Ha)&&!f)this.reset();else if(a.eventType&Ea)this.reset(),this._timer=e(function(){this.state=rb,this.tryEmit()},b.time,this);else if(a.eventType&Ga)return rb;return tb},reset:function(){clearTimeout(this._timer)},emit:function(a){this.state===rb&&(a&&a.eventType&Ga?this.manager.emit(this.options.event+"up",a):(this._input.timeStamp=ra(),this.manager.emit(this.options.event,this._input)))}}),i(ea,aa,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[jb]},attrTest:function(a){return this._super.attrTest.call(this,a)&&(Math.abs(a.rotation)>this.options.threshold||this.state&ob)}}),i(fa,aa,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:Na|Oa,pointers:1},getTouchAction:function(){return ba.prototype.getTouchAction.call(this)},attrTest:function(a){var b,c=this.options.direction;return c&(Na|Oa)?b=a.overallVelocity:c&Na?b=a.overallVelocityX:c&Oa&&(b=a.overallVelocityY),this._super.attrTest.call(this,a)&&c&a.offsetDirection&&a.distance>this.options.threshold&&a.maxPointers==this.options.pointers&&qa(b)>this.options.velocity&&a.eventType&Ga},emit:function(a){var b=$(a.offsetDirection);b&&this.manager.emit(this.options.event+b,a),this.manager.emit(this.options.event,a)}}),i(ga,Y,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[ib]},process:function(a){var b=this.options,c=a.pointers.length===b.pointers,d=a.distance<b.threshold,f=a.deltaTime<b.time;if(this.reset(),a.eventType&Ea&&0===this.count)return this.failTimeout();if(d&&f&&c){if(a.eventType!=Ga)return this.failTimeout();var g=this.pTime?a.timeStamp-this.pTime<b.interval:!0,h=!this.pCenter||H(this.pCenter,a.center)<b.posThreshold;this.pTime=a.timeStamp,this.pCenter=a.center,h&&g?this.count+=1:this.count=1,this._input=a;var i=this.count%b.taps;if(0===i)return this.hasRequireFailures()?(this._timer=e(function(){this.state=rb,this.tryEmit()},b.interval,this),ob):rb}return tb},failTimeout:function(){return this._timer=e(function(){this.state=tb},this.options.interval,this),tb},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==rb&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),ha.VERSION="2.0.8",ha.defaults={domEvents:!1,touchAction:gb,enable:!0,inputTarget:null,inputClass:null,preset:[[ea,{enable:!1}],[ca,{enable:!1},["rotate"]],[fa,{direction:Na}],[ba,{direction:Na},["swipe"]],[ga],[ga,{event:"doubletap",taps:2},["tap"]],[da]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var ub=1,vb=2;ia.prototype={set:function(a){return la(this.options,a),a.touchAction&&this.touchAction.update(),a.inputTarget&&(this.input.destroy(),this.input.target=a.inputTarget,this.input.init()),this},stop:function(a){this.session.stopped=a?vb:ub},recognize:function(a){var b=this.session;if(!b.stopped){this.touchAction.preventDefaults(a);var c,d=this.recognizers,e=b.curRecognizer;(!e||e&&e.state&rb)&&(e=b.curRecognizer=null);for(var f=0;f<d.length;)c=d[f],b.stopped===vb||e&&c!=e&&!c.canRecognizeWith(e)?c.reset():c.recognize(a),!e&&c.state&(ob|pb|qb)&&(e=b.curRecognizer=c),f++}},get:function(a){if(a instanceof Y)return a;for(var b=this.recognizers,c=0;c<b.length;c++)if(b[c].options.event==a)return b[c];return null},add:function(a){if(f(a,"add",this))return this;var b=this.get(a.options.event);return b&&this.remove(b),this.recognizers.push(a),a.manager=this,this.touchAction.update(),a},remove:function(a){if(f(a,"remove",this))return this;if(a=this.get(a)){var b=this.recognizers,c=r(b,a);-1!==c&&(b.splice(c,1),this.touchAction.update())}return this},on:function(a,b){if(a!==d&&b!==d){var c=this.handlers;return g(q(a),function(a){c[a]=c[a]||[],c[a].push(b)}),this}},off:function(a,b){if(a!==d){var c=this.handlers;return g(q(a),function(a){b?c[a]&&c[a].splice(r(c[a],b),1):delete c[a]}),this}},emit:function(a,b){this.options.domEvents&&ka(a,b);var c=this.handlers[a]&&this.handlers[a].slice();if(c&&c.length){b.type=a,b.preventDefault=function(){b.srcEvent.preventDefault()};for(var d=0;d<c.length;)c[d](b),d++}},destroy:function(){this.element&&ja(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},la(ha,{INPUT_START:Ea,INPUT_MOVE:Fa,INPUT_END:Ga,INPUT_CANCEL:Ha,STATE_POSSIBLE:nb,STATE_BEGAN:ob,STATE_CHANGED:pb,STATE_ENDED:qb,STATE_RECOGNIZED:rb,STATE_CANCELLED:sb,STATE_FAILED:tb,DIRECTION_NONE:Ia,DIRECTION_LEFT:Ja,DIRECTION_RIGHT:Ka,DIRECTION_UP:La,DIRECTION_DOWN:Ma,DIRECTION_HORIZONTAL:Na,DIRECTION_VERTICAL:Oa,DIRECTION_ALL:Pa,Manager:ia,Input:x,TouchAction:V,TouchInput:P,MouseInput:L,PointerEventInput:M,TouchMouseInput:R,SingleTouchInput:N,Recognizer:Y,AttrRecognizer:aa,Tap:ga,Pan:ba,Swipe:fa,Pinch:ca,Rotate:ea,Press:da,on:m,off:n,each:g,merge:ta,extend:sa,assign:la,inherit:i,bindFn:j,prefixed:u});var wb="undefined"!=typeof a?a:"undefined"!=typeof self?self:{};wb.Hammer=ha,"function"==typeof define&&define.amd?define(function(){return ha}):"undefined"!=typeof module&&module.exports?module.exports=ha:a[c]=ha}(window,document,"Hammer");
|
|
readme.txt
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
=== Ditty (formerly Ditty News Ticker) ===
|
2 |
Contributors: metaphorcreations
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FUZKZGAJSBAE6
|
4 |
-
Tags: ticker,
|
5 |
Requires at least: 4.5
|
6 |
Tested up to: 5.8.3
|
7 |
-
Stable tag: 3.0.
|
8 |
License: GPL2
|
9 |
|
10 |
Formerly Ditty News Ticker. Ditty is a multi-functional data display plugin.
|
@@ -66,6 +66,13 @@ The most common cause for an unresponsive Ditty (when using scroll or rotate mod
|
|
66 |
|
67 |
== Changelog ==
|
68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
= 3.0.9 =
|
70 |
* Ditty editor Layout css update bug fix
|
71 |
* Added WPML functionality to Ditty post type
|
@@ -626,4 +633,4 @@ The most common cause for an unresponsive Ditty (when using scroll or rotate mod
|
|
626 |
|
627 |
== Upgrade Notice ==
|
628 |
|
629 |
-
|
1 |
=== Ditty (formerly Ditty News Ticker) ===
|
2 |
Contributors: metaphorcreations
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FUZKZGAJSBAE6
|
4 |
+
Tags: ticker, post ticker, news ticker, content aggregator, latest posts, live refresh, rotator, data rotator, lists, data, aggregator
|
5 |
Requires at least: 4.5
|
6 |
Tested up to: 5.8.3
|
7 |
+
Stable tag: 3.0.10
|
8 |
License: GPL2
|
9 |
|
10 |
Formerly Ditty News Ticker. Ditty is a multi-functional data display plugin.
|
66 |
|
67 |
== Changelog ==
|
68 |
|
69 |
+
= 3.0.10 =
|
70 |
+
* Resolved hammer warning
|
71 |
+
* Added Post Duplicator integration
|
72 |
+
* Added custom Display settings
|
73 |
+
* Ticker Display vertical scrolling updates
|
74 |
+
* dittyUpdateItems javascript bug fix
|
75 |
+
|
76 |
= 3.0.9 =
|
77 |
* Ditty editor Layout css update bug fix
|
78 |
* Added WPML functionality to Ditty post type
|
633 |
|
634 |
== Upgrade Notice ==
|
635 |
|
636 |
+
Multiple updates
|