Version Description
- Javascript bug fix
- Added scroll pause option for showing first tick on it
Download this release
Release Info
Developer | metaphorcreations |
Plugin | Ditty News Ticker |
Version | 2.3.6 |
Comparing to | |
See all releases |
Code changes from version 2.3.5 to 2.3.6
- ditty-news-ticker.php +2 -2
- inc/admin/meta-boxes.php +11 -0
- inc/filters.php +2 -0
- inc/static.php +1 -0
- inc/static/js/ditty-news-ticker.js +27 -12
- inc/static/js/ditty-news-ticker.min.js +1 -1
- inc/static/js/partials/admin-general.js +21 -0
- inc/static/js/script-admin.min.js +1 -1
- readme.txt +5 -1
ditty-news-ticker.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://dittynewsticker.com/
|
|
5 |
Description: Ditty News Ticker is a multi-functional data display plugin
|
6 |
Text Domain: ditty-news-ticker
|
7 |
Domain Path: languages
|
8 |
-
Version: 2.3.
|
9 |
Author: Metaphor Creations
|
10 |
Author URI: http://www.metaphorcreations.com
|
11 |
Contributors: metaphorcreations
|
@@ -62,7 +62,7 @@ final class Ditty_News_Ticker {
|
|
62 |
|
63 |
// Plugin version
|
64 |
if ( ! defined( 'MTPHR_DNT_VERSION' ) ) {
|
65 |
-
define( 'MTPHR_DNT_VERSION', '2.3.
|
66 |
}
|
67 |
|
68 |
// Plugin Folder Path
|
5 |
Description: Ditty News Ticker is a multi-functional data display plugin
|
6 |
Text Domain: ditty-news-ticker
|
7 |
Domain Path: languages
|
8 |
+
Version: 2.3.6
|
9 |
Author: Metaphor Creations
|
10 |
Author URI: http://www.metaphorcreations.com
|
11 |
Contributors: metaphorcreations
|
62 |
|
63 |
// Plugin version
|
64 |
if ( ! defined( 'MTPHR_DNT_VERSION' ) ) {
|
65 |
+
define( 'MTPHR_DNT_VERSION', '2.3.6' );
|
66 |
}
|
67 |
|
68 |
// Plugin Folder Path
|
inc/admin/meta-boxes.php
CHANGED
@@ -424,6 +424,7 @@ function mtphr_dnt_scroll_values() {
|
|
424 |
$defaults = array(
|
425 |
'direction' => 'left',
|
426 |
'init' => '',
|
|
|
427 |
'width' => 0,
|
428 |
'height' => 0,
|
429 |
'padding' => 0,
|
@@ -438,6 +439,7 @@ function mtphr_dnt_scroll_values() {
|
|
438 |
$values = array(
|
439 |
'direction' => get_post_meta( $post->ID, '_mtphr_dnt_scroll_direction', true ),
|
440 |
'init' => get_post_meta( $post->ID, '_mtphr_dnt_scroll_init', true ),
|
|
|
441 |
'width' => get_post_meta( $post->ID, '_mtphr_dnt_scroll_width', true ),
|
442 |
'height' => get_post_meta( $post->ID, '_mtphr_dnt_scroll_height', true ),
|
443 |
'padding' => get_post_meta( $post->ID, '_mtphr_dnt_scroll_padding', true ),
|
@@ -489,6 +491,13 @@ function mtphr_dnt_scroll_fields() {
|
|
489 |
'name' => '_mtphr_dnt_scroll_init',
|
490 |
'label' => __('Show first tick on init', 'ditty-news-ticker'),
|
491 |
'value' => $values['init'],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
492 |
)
|
493 |
)
|
494 |
),
|
@@ -1303,6 +1312,7 @@ function mtphr_dnt_metabox_save( $post_id ) {
|
|
1303 |
|
1304 |
$direction = isset($_POST['_mtphr_dnt_scroll_direction']) ? $_POST['_mtphr_dnt_scroll_direction'] : 'left';
|
1305 |
$init = isset($_POST['_mtphr_dnt_scroll_init']) ? $_POST['_mtphr_dnt_scroll_init'] : '';
|
|
|
1306 |
$width = isset($_POST['_mtphr_dnt_scroll_width']) ? intval($_POST['_mtphr_dnt_scroll_width']) : 0;
|
1307 |
$height = isset($_POST['_mtphr_dnt_scroll_height']) ? intval($_POST['_mtphr_dnt_scroll_height']) : 0;
|
1308 |
$padding = isset($_POST['_mtphr_dnt_scroll_padding']) ? intval($_POST['_mtphr_dnt_scroll_padding']) : 0;
|
@@ -1313,6 +1323,7 @@ function mtphr_dnt_metabox_save( $post_id ) {
|
|
1313 |
|
1314 |
update_post_meta( $post_id, '_mtphr_dnt_scroll_direction', $direction );
|
1315 |
update_post_meta( $post_id, '_mtphr_dnt_scroll_init', $init );
|
|
|
1316 |
update_post_meta( $post_id, '_mtphr_dnt_scroll_width', $width );
|
1317 |
update_post_meta( $post_id, '_mtphr_dnt_scroll_height', $height );
|
1318 |
update_post_meta( $post_id, '_mtphr_dnt_scroll_padding', $padding );
|
424 |
$defaults = array(
|
425 |
'direction' => 'left',
|
426 |
'init' => '',
|
427 |
+
'init_delay' => '2',
|
428 |
'width' => 0,
|
429 |
'height' => 0,
|
430 |
'padding' => 0,
|
439 |
$values = array(
|
440 |
'direction' => get_post_meta( $post->ID, '_mtphr_dnt_scroll_direction', true ),
|
441 |
'init' => get_post_meta( $post->ID, '_mtphr_dnt_scroll_init', true ),
|
442 |
+
'init_delay' => get_post_meta( $post->ID, '_mtphr_dnt_scroll_init_delay', true ),
|
443 |
'width' => get_post_meta( $post->ID, '_mtphr_dnt_scroll_width', true ),
|
444 |
'height' => get_post_meta( $post->ID, '_mtphr_dnt_scroll_height', true ),
|
445 |
'padding' => get_post_meta( $post->ID, '_mtphr_dnt_scroll_padding', true ),
|
491 |
'name' => '_mtphr_dnt_scroll_init',
|
492 |
'label' => __('Show first tick on init', 'ditty-news-ticker'),
|
493 |
'value' => $values['init'],
|
494 |
+
),
|
495 |
+
/* !Scroll init - 2.0.0 */
|
496 |
+
'init_delay' => array(
|
497 |
+
'type' => 'number',
|
498 |
+
'name' => '_mtphr_dnt_scroll_init_delay',
|
499 |
+
'after' => __('Delay scroll start (in seconds)', 'ditty-news-ticker'),
|
500 |
+
'value' => $values['init_delay'],
|
501 |
)
|
502 |
)
|
503 |
),
|
1312 |
|
1313 |
$direction = isset($_POST['_mtphr_dnt_scroll_direction']) ? $_POST['_mtphr_dnt_scroll_direction'] : 'left';
|
1314 |
$init = isset($_POST['_mtphr_dnt_scroll_init']) ? $_POST['_mtphr_dnt_scroll_init'] : '';
|
1315 |
+
$init_delay = isset($_POST['_mtphr_dnt_scroll_init_delay']) ? $_POST['_mtphr_dnt_scroll_init_delay'] : 2;
|
1316 |
$width = isset($_POST['_mtphr_dnt_scroll_width']) ? intval($_POST['_mtphr_dnt_scroll_width']) : 0;
|
1317 |
$height = isset($_POST['_mtphr_dnt_scroll_height']) ? intval($_POST['_mtphr_dnt_scroll_height']) : 0;
|
1318 |
$padding = isset($_POST['_mtphr_dnt_scroll_padding']) ? intval($_POST['_mtphr_dnt_scroll_padding']) : 0;
|
1323 |
|
1324 |
update_post_meta( $post_id, '_mtphr_dnt_scroll_direction', $direction );
|
1325 |
update_post_meta( $post_id, '_mtphr_dnt_scroll_init', $init );
|
1326 |
+
update_post_meta( $post_id, '_mtphr_dnt_scroll_init_delay', $init_delay );
|
1327 |
update_post_meta( $post_id, '_mtphr_dnt_scroll_width', $width );
|
1328 |
update_post_meta( $post_id, '_mtphr_dnt_scroll_height', $height );
|
1329 |
update_post_meta( $post_id, '_mtphr_dnt_scroll_padding', $padding );
|
inc/filters.php
CHANGED
@@ -172,6 +172,7 @@ function mtphr_dnt_add_to_global( $id, $meta_data ) {
|
|
172 |
if( isset($_mtphr_dnt_scroll_init) ) {
|
173 |
$scroll_init = $_mtphr_dnt_scroll_init ? 1 : 0;
|
174 |
}
|
|
|
175 |
$rotate = 0; $rotate_pause = 0; $nav_autohide = 0; $nav_reverse = 0;
|
176 |
if( isset($_mtphr_dnt_auto_rotate) ) {
|
177 |
$rotate = $_mtphr_dnt_auto_rotate ? 1 : 0;
|
@@ -195,6 +196,7 @@ function mtphr_dnt_add_to_global( $id, $meta_data ) {
|
|
195 |
'scroll_pause' => $scroll_pause,
|
196 |
'scroll_spacing' => intval($_mtphr_dnt_scroll_tick_spacing),
|
197 |
'scroll_init' => $scroll_init,
|
|
|
198 |
'rotate_type' => $_mtphr_dnt_rotate_type,
|
199 |
'auto_rotate' => $rotate,
|
200 |
'rotate_delay' => intval($_mtphr_dnt_rotate_delay),
|
172 |
if( isset($_mtphr_dnt_scroll_init) ) {
|
173 |
$scroll_init = $_mtphr_dnt_scroll_init ? 1 : 0;
|
174 |
}
|
175 |
+
$scroll_init_delay = isset( $_mtphr_dnt_scroll_init_delay ) ? intval( $_mtphr_dnt_scroll_init_delay ) : 2;
|
176 |
$rotate = 0; $rotate_pause = 0; $nav_autohide = 0; $nav_reverse = 0;
|
177 |
if( isset($_mtphr_dnt_auto_rotate) ) {
|
178 |
$rotate = $_mtphr_dnt_auto_rotate ? 1 : 0;
|
196 |
'scroll_pause' => $scroll_pause,
|
197 |
'scroll_spacing' => intval($_mtphr_dnt_scroll_tick_spacing),
|
198 |
'scroll_init' => $scroll_init,
|
199 |
+
'scroll_init_delay' => $scroll_init_delay,
|
200 |
'rotate_type' => $_mtphr_dnt_rotate_type,
|
201 |
'auto_rotate' => $rotate,
|
202 |
'rotate_delay' => intval($_mtphr_dnt_rotate_delay),
|
inc/static.php
CHANGED
@@ -111,6 +111,7 @@ function mtphr_dnt_tickers_init_scripts() {
|
|
111 |
scroll_pause : <?php echo $ticker['scroll_pause']; ?>,
|
112 |
scroll_spacing : <?php echo $ticker['scroll_spacing']; ?>,
|
113 |
scroll_init : <?php echo $ticker['scroll_init']; ?>,
|
|
|
114 |
rotate_type : '<?php echo $ticker['rotate_type']; ?>',
|
115 |
auto_rotate : <?php echo $ticker['auto_rotate']; ?>,
|
116 |
rotate_delay : <?php echo $ticker['rotate_delay']; ?>,
|
111 |
scroll_pause : <?php echo $ticker['scroll_pause']; ?>,
|
112 |
scroll_spacing : <?php echo $ticker['scroll_spacing']; ?>,
|
113 |
scroll_init : <?php echo $ticker['scroll_init']; ?>,
|
114 |
+
scroll_init_delay : <?php echo isset( $ticker['scroll_init_delay'] ) ? intval( $ticker['scroll_init_delay'] ) : 2; ?>,
|
115 |
rotate_type : '<?php echo $ticker['rotate_type']; ?>',
|
116 |
auto_rotate : <?php echo $ticker['auto_rotate']; ?>,
|
117 |
rotate_delay : <?php echo $ticker['rotate_delay']; ?>,
|
inc/static/js/ditty-news-ticker.js
CHANGED
@@ -25,6 +25,7 @@
|
|
25 |
scroll_spacing : 40,
|
26 |
scroll_units : 10,
|
27 |
scroll_init : 0,
|
|
|
28 |
scroll_loop : 1,
|
29 |
rotate_type : 'fade',
|
30 |
auto_rotate : 0,
|
@@ -69,12 +70,12 @@
|
|
69 |
ticker_height = 0,
|
70 |
ticks = [],
|
71 |
ticker_scroll,
|
72 |
-
ticker_paused = false,
|
73 |
ticker_scroll_resize = true,
|
74 |
rotator_delay,
|
75 |
rotate_adjustment = settings.rotate_type,
|
76 |
after_change_timeout,
|
77 |
-
|
|
|
78 |
scroll_percent = 0.13;
|
79 |
|
80 |
|
@@ -197,6 +198,7 @@
|
|
197 |
|
198 |
// Start the scroll loop
|
199 |
mtphr_dnt_scroll_loop();
|
|
|
200 |
}
|
201 |
|
202 |
|
@@ -216,6 +218,7 @@
|
|
216 |
}
|
217 |
|
218 |
function mtphr_dnt_scroll_pause() {
|
|
|
219 |
cancelAnimationFrame( ticker_scroll );
|
220 |
}
|
221 |
|
@@ -230,9 +233,9 @@
|
|
230 |
*/
|
231 |
function mtphr_dnt_scroll_loop() {
|
232 |
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
|
237 |
for( var i=0; i < vars.tick_count; i++ ) {
|
238 |
|
@@ -269,8 +272,19 @@
|
|
269 |
ticks[i][0].position = pos;
|
270 |
}
|
271 |
}
|
272 |
-
|
273 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
274 |
}
|
275 |
|
276 |
/**
|
@@ -541,13 +555,13 @@
|
|
541 |
if( settings.scroll_init ) {
|
542 |
|
543 |
if( settings.scroll_direction === 'left' ) {
|
544 |
-
position =
|
545 |
} else if( settings.scroll_direction === 'right' ) {
|
546 |
-
position = ticker_width
|
547 |
} else if( settings.scroll_direction === 'up' ) {
|
548 |
-
position =
|
549 |
} else if( settings.scroll_direction === 'down' ) {
|
550 |
-
position = ticker_height
|
551 |
}
|
552 |
|
553 |
for( i=0; i < vars.tick_count; i++ ) {
|
@@ -1446,7 +1460,8 @@
|
|
1446 |
|
1447 |
$container.on('mtphr_dnt_replace_ticks', function( e, ticks, delay ) {
|
1448 |
|
1449 |
-
|
|
|
1450 |
$container.find('.mtphr-dnt-tick').remove();
|
1451 |
|
1452 |
ticks.each( function() {
|
25 |
scroll_spacing : 40,
|
26 |
scroll_units : 10,
|
27 |
scroll_init : 0,
|
28 |
+
scroll_init_delay : 2,
|
29 |
scroll_loop : 1,
|
30 |
rotate_type : 'fade',
|
31 |
auto_rotate : 0,
|
70 |
ticker_height = 0,
|
71 |
ticks = [],
|
72 |
ticker_scroll,
|
|
|
73 |
ticker_scroll_resize = true,
|
74 |
rotator_delay,
|
75 |
rotate_adjustment = settings.rotate_type,
|
76 |
after_change_timeout,
|
77 |
+
init_timeout,
|
78 |
+
init_loop = true,
|
79 |
scroll_percent = 0.13;
|
80 |
|
81 |
|
198 |
|
199 |
// Start the scroll loop
|
200 |
mtphr_dnt_scroll_loop();
|
201 |
+
|
202 |
}
|
203 |
|
204 |
|
218 |
}
|
219 |
|
220 |
function mtphr_dnt_scroll_pause() {
|
221 |
+
clearTimeout( init_timeout );
|
222 |
cancelAnimationFrame( ticker_scroll );
|
223 |
}
|
224 |
|
233 |
*/
|
234 |
function mtphr_dnt_scroll_loop() {
|
235 |
|
236 |
+
clearTimeout( init_timeout );
|
237 |
+
cancelAnimationFrame( ticker_scroll );
|
238 |
+
function dnt_scroll_run() {
|
239 |
|
240 |
for( var i=0; i < vars.tick_count; i++ ) {
|
241 |
|
272 |
ticks[i][0].position = pos;
|
273 |
}
|
274 |
}
|
275 |
+
|
276 |
+
if( settings.scroll_init && init_loop ) {
|
277 |
+
init_loop = false;
|
278 |
+
console.log( settings.scroll_init_delay );
|
279 |
+
init_timeout = setTimeout( function() {
|
280 |
+
ticker_scroll = requestAnimationFrame( dnt_scroll_run );
|
281 |
+
}, settings.scroll_init_delay * 1000 );
|
282 |
+
} else {
|
283 |
+
init_loop = false;
|
284 |
+
ticker_scroll = requestAnimationFrame( dnt_scroll_run );
|
285 |
+
}
|
286 |
+
}
|
287 |
+
ticker_scroll = requestAnimationFrame( dnt_scroll_run );
|
288 |
}
|
289 |
|
290 |
/**
|
555 |
if( settings.scroll_init ) {
|
556 |
|
557 |
if( settings.scroll_direction === 'left' ) {
|
558 |
+
position = 0;
|
559 |
} else if( settings.scroll_direction === 'right' ) {
|
560 |
+
position = ticker_width;
|
561 |
} else if( settings.scroll_direction === 'up' ) {
|
562 |
+
position = 0;
|
563 |
} else if( settings.scroll_direction === 'down' ) {
|
564 |
+
position = ticker_height;
|
565 |
}
|
566 |
|
567 |
for( i=0; i < vars.tick_count; i++ ) {
|
1460 |
|
1461 |
$container.on('mtphr_dnt_replace_ticks', function( e, ticks, delay ) {
|
1462 |
|
1463 |
+
clearTimeout( init_timeout );
|
1464 |
+
cancelAnimationFrame( ticker_scroll );
|
1465 |
$container.find('.mtphr-dnt-tick').remove();
|
1466 |
|
1467 |
ticks.each( function() {
|
inc/static/js/ditty-news-ticker.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(t){var e={init:function(e){return this.each((function(){function i(){P.tick_count=S.find(".mtphr-dnt-tick").length,P.tick_count>0&&("scroll"===N.type?r():"rotate"===N.type&&m()),N.after_load.call(R,S),R.trigger("mtphr_dnt_after_load_single",[P,it]),t("body").trigger("mtphr_dnt_after_load",[R,P,it])}function n(){S.find(".mtphr-dnt-tick").each((function(){t(this).height()>et&&(et=t(this).height()),"up"!==N.scroll_direction&&"down"!==N.scroll_direction||t(this).css("height","auto")})),S.css("height",et+"px")}function r(){var e=S.find(".mtphr-dnt-tick:first");if(e.attr("style")){var i,r=e.attr("style").split("width:");st=!(r.length>1)}it=[],S.find("img").length?S.imagesLoaded((function(){n(),S.find(".mtphr-dnt-tick").each((function(){t(this).show();var e=[{headline:t(this)}];it.push(e)})),g(),o()})):(n(),S.find(".mtphr-dnt-tick").each((function(){t(this).show();var e=[{headline:t(this)}];it.push(e)})),g(),o()),S.on({mouseenter:function(){N.scroll_pause&&s()},mouseleave:function(){N.scroll_pause&&!P.paused&&a()}})}function s(){cancelAnimationFrame(nt)}function a(){o()}function o(){cancelAnimationFrame(nt),requestAnimationFrame((function t(){for(var e=0;e<P.tick_count;e++)if(!0===it[e][0].visible){var i="reset";"left"===N.scroll_direction||"right"===N.scroll_direction?("reset"===(i="left"===N.scroll_direction?c(e):p(e))?(i=it[e][0].reset,it[e][0].headline.css("opacity",0)):it[e][0].headline.css("opacity",1),it[e][0].headline.css({transform:"translateX( "+i+"px )"})):("reset"===(i="up"===N.scroll_direction?l(e):_(e))?(i=it[e][0].reset,it[e][0].headline.css("opacity",0)):it[e][0].headline.css("opacity",1),it[e][0].headline.css({transform:"translateY( "+i+"px )"})),it[e][0].position=i}nt=requestAnimationFrame(t)}))}function c(t){var e=parseFloat(it[t][0].position-N.scroll_speed*lt);return e<-(it[t][0].headline.width()+N.offset)?e=f(t):e<parseFloat(tt-it[t][0].headline.width()-N.scroll_spacing)&&d(t),e}function p(t){var e=parseFloat(it[t][0].position+N.scroll_speed*lt);return e>tt+N.offset?e=f(t):e>N.scroll_spacing&&d(t),e}function l(t){var e=parseFloat(it[t][0].position-N.scroll_speed*lt);return e<-(it[t][0].headline.height()+N.offset)?e=f(t):e<et-it[t][0].headline.height()-N.scroll_spacing&&d(t),e}function _(t){var e=parseFloat(it[t][0].position+N.scroll_speed*lt);return e>et+N.offset?e=f(t):e>N.scroll_spacing&&d(t),e}function f(e){return P.tick_count>1&&(it[e][0].visible=!1),P.tick_count===e+1&&(R.trigger("mtphr_dnt_scroll_complete",[P,it]),t("body").trigger("mtphr_dnt_scroll_complete",[R,P,it])),"reset"}function u(t){!1===it[t][0].visible&&(P.previous_tick=parseInt(t-1),P.previous_tick<0&&(P.previous_tick=parseInt(P.tick_count-1)),P.current_tick=t,P.next_tick=parseInt(t+1),P.next_tick>=P.tick_count&&(P.next_tick=0))}function d(t){t===P.tick_count-1?N.scroll_loop&&(u(0),it[0][0].visible=!0):(u(parseInt(t+1)),it[t+1][0].visible=!0)}function h(){for(var t=0;t<P.tick_count;t++){var e,i=it[t][0].headline;switch(N.scroll_direction){case"left":e=tt+N.offset,!1===it[t][0].visible&&i.css("transform","translateX( "+e+"px )");break;case"right":e=parseInt("-"+(i.width()+N.offset)),!1===it[t][0].visible&&i.css("transform","translateX( "+e+"px )");break;case"up":st&&i.css("width",tt),e=parseInt(et+N.offset),!1===it[t][0].visible&&i.css("transform","translateY( "+e+"px )");break;case"down":st&&i.css("width",tt),e=parseInt("-"+(i.height()+N.offset)),!1===it[t][0].visible&&i.css("transform","translateY( "+e+"px )");break}it[t][0].width=i.width(),it[t][0].height=i.height(),!1===it[t][0].visible&&(it[t][0].position=e),it[t][0].reset=e}}function g(){for(var t,e,i=0;i<P.tick_count;i++)if(it[i]){switch(e=it[i][0].headline,N.scroll_direction){case"left":t=tt+N.offset,e.css("transform","translateX( "+t+"px )");break;case"right":t=parseInt("-"+(e.width()+N.offset)),e.css("transform","translateX( "+t+"px )");break;case"up":st&&e.css("width",tt),t=parseInt(et+N.offset),e.css("transform","translateY( "+t+"px )");break;case"down":st&&e.css("width",tt),t=parseInt("-"+(e.height()+N.offset)),e.css("transform","translateY( "+t+"px )");break}it[i][0].width=e.width(),it[i][0].height=e.height(),it[i][0].position=t,it[i][0].reset=t,it[i][0].visible=!1,e=it[i][0].headline}if(P.current_tick=0,it[P.current_tick][0].visible=!0,N.scroll_init)for("left"===N.scroll_direction?t=.1*tt:"right"===N.scroll_direction?t=.9*tt:"up"===N.scroll_direction?t=.1*et:"down"===N.scroll_direction&&(t=.9*et),i=0;i<P.tick_count;i++)switch(e=it[i][0].headline,N.scroll_direction){case"left":t<tt&&(e.css("transform","translateX( "+t+"px )"),it[i][0].position=t,it[i][0].visible=!0,t=t+it[i][0].width+N.scroll_spacing);break;case"right":t>0&&(t-=it[i][0].width,e.css("transform","translateX( "+t+"px )"),it[i][0].position=t,it[i][0].visible=!0,t-=N.scroll_spacing);break;case"up":t<et&&(e.css("transform","translateY( "+t+"px )"),it[i][0].position=t,it[i][0].visible=!0,t=t+it[i][0].height+N.scroll_spacing);break;case"down":t>0&&(e.css("transform","translateY( "+t+"px )"),e.stop(!0,!0).css("top",t+"px"),it[i][0].position=t,it[i][0].visible=!0,t-=N.scroll_spacing);break}}function k(){y()}function v(){clearInterval(at)}function m(){switch(S.find(".mtphr-dnt-tick").each((function(){it.push(t(this)),t(this).imagesLoaded((function(){F()}))})),F(),S.find(".mtphr-dnt-tick").show(),N.rotate_type){case"fade":X(S,it,parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_left":C(S,it,parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_right":L(S,it,parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_down":z(S,it,parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_up":O(S,it,parseInt(100*N.rotate_speed),N.rotate_ease);break}w(0),N.auto_rotate&&k(),S.on({mouseenter:function(){N.auto_rotate&&N.rotate_pause&&!P.running&&v()},mouseleave:function(){N.auto_rotate&&N.rotate_pause&&!P.running&&!P.paused&&k()}})}function y(){v(),at=setInterval((function(){var t=parseInt(P.current_tick+1);t===P.tick_count&&(t=0),b(t)}),parseInt(1e3*N.rotate_delay))}function b(e){P.current_tick!==e&&(N.auto_rotate&&v(),P.next_tick=e,N.before_change.call(R,S),R.trigger("mtphr_dnt_before_change_single",[P,it]),t("body").trigger("mtphr_dnt_before_change",[R,P,it]),P.running=1,I(e),x(e),P.previous_tick=P.current_tick,P.current_tick=e,ct=setTimeout((function(){N.after_change.call(R,S),R.trigger("mtphr_dnt_after_change_single",[P,it]),t("body").trigger("mtphr_dnt_after_change",[R,P,it]),ot=N.rotate_type,P.reverse=0,P.running=0,N.auto_rotate&&!P.paused&&y()}),parseInt(100*N.rotate_speed)))}function w(t){Z&&(Z.children("a").removeClass("active"),Z.children('a[href="'+t+'"]').addClass("active"))}function x(e){switch(w(e),ot){case"fade":Y(S,t(it[e]),t(it[P.current_tick]),parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_left":D(S,t(it[e]),t(it[P.current_tick]),parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_right":T(S,t(it[e]),t(it[P.current_tick]),parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_down":j(S,t(it[e]),t(it[P.current_tick]),parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_up":M(S,t(it[e]),t(it[P.current_tick]),parseInt(100*N.rotate_speed),N.rotate_ease);break}}function I(e){switch(ot){case"fade":A(S,t(it[P.current_tick]),t(it[e]),parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_left":E(S,t(it[P.current_tick]),t(it[e]),parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_right":W(S,t(it[P.current_tick]),t(it[e]),parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_down":q(S,t(it[P.current_tick]),t(it[e]),parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_up":Q(S,t(it[P.current_tick]),t(it[e]),parseInt(100*N.rotate_speed),N.rotate_ease);break}}function F(){for(var e=0;e<P.tick_count;e++)t(it[e]).width(tt+"px"),P.current_tick!==e&&t(it[e]).css({left:parseFloat(tt+N.offset)+"px"});var i=t(it[P.current_tick]).height();S.stop().css("height",i+"px")}function X(t,e){var i=e[0],n=i.height();t.css("height",n+"px"),i.css({opacity:1,left:"auto"})}function Y(t,e,i,n,r){e.css({opacity:0,left:"auto"}),e.stop().animate({opacity:1},n,r);var s=e.height();t.stop().animate({height:s+"px"},n,r)}function A(e,i,n,r,s){i.stop().animate({opacity:0},r,s,(function(){t(this).css({left:parseFloat(tt+N.offset)+"px"}),i.remove(),e.append(i)}))}function C(t,e){var i=e[0],n=i.height();t.css("height",n+"px"),i.css({opacity:1,left:0})}function D(t,e,i,n,r){var s=e.height();e.css({opacity:1,left:parseFloat(tt+N.offset)+"px"}),t.stop().animate({height:s+"px"},n,r,(function(){})),e.stop().animate({left:"0"},n,r,(function(){}))}function E(t,e,i,n,r){e.stop().animate({left:"-"+parseFloat(tt+N.offset)+"px"},n,r,(function(){e.css({opacity:0}),e.remove(),t.append(e)}))}function L(t,e){var i=e[0],n=i.height();t.css("height",n+"px"),i.css({opacity:1,left:0})}function T(t,e,i,n,r){var s=e.height();e.css({opacity:1,left:"-"+parseFloat(tt+N.offset)+"px"}),t.stop().animate({height:s+"px"},n,r,(function(){})),e.stop().animate({left:"0"},n,r)}function W(t,e,i,n,r){e.stop().animate({left:parseFloat(tt+N.offset)+"px"},n,r,(function(){e.css({opacity:0}),e.remove(),t.append(e)}))}function z(t,e){var i=e[0],n=i.height();t.css("height",n+"px"),i.css({opacity:1,top:0,left:"auto"})}function j(t,e,i,n,r){var s=e.height();e.css({opacity:1,top:"-"+parseFloat(s+N.offset)+"px",left:"auto"}),t.stop().animate({height:s+"px"},n,r),e.stop().animate({top:"0"},n,r)}function q(t,e,i,n,r){var s=i.height();e.stop().animate({top:parseFloat(s+N.offset)+"px"},n,r,(function(){e.css({opacity:0}),e.remove(),t.append(e)}))}function O(t,e){var i=e[0],n=i.height();t.css({height:n+"px",left:"auto"}),i.css({opacity:1,top:0})}function M(t,e,i,n,r){var s=e.height();e.css({opacity:1,top:parseFloat(i.height()+N.offset)+"px",left:"auto"}),t.stop().animate({height:s+"px"},n,r),e.stop().animate({top:"0"},n,r)}function Q(t,e,i,n,r){var s=e.height();e.stop().animate({top:"-"+parseFloat(s+N.offset)+"px"},n,r,(function(){e.css({opacity:0}),e.remove(),t.append(e)}))}function B(){if(P.running)return!1;var t=parseInt(P.current_tick+1);t===P.tick_count&&(t=0),b(t)}function G(){if(P.running)return!1;var t=parseInt(P.current_tick-1);t<0&&(t=P.tick_count-1),N.nav_reverse&&("slide_left"===N.rotate_type?ot="slide_right":"slide_right"===N.rotate_type?ot="slide_left":"slide_down"===N.rotate_type?ot="slide_up":"slide_up"===N.rotate_type&&(ot="slide_down"),P.reverse=1),b(t)}function H(t){t?(P.paused=!1,$.removeClass("paused"),"scroll"===N.type?a():k()):(P.paused=!0,$.addClass("paused"),"scroll"===N.type?s():v()),R.trigger("mtphr_dnt_play_pause",[P,it])}function J(){if(P.running)return!1;var t=parseInt(P.current_tick+1);t===P.tick_count&&(t=0),"slide_left"!==N.rotate_type&&"slide_right"!==N.rotate_type||(ot="slide_left"),b(t)}function K(){if(P.running)return!1;var t=parseInt(P.current_tick-1);t<0&&(t=P.tick_count-1),"slide_left"!==N.rotate_type&&"slide_right"!==N.rotate_type||(ot="slide_right"),N.nav_reverse&&("slide_down"===N.rotate_type?ot="slide_up":"slide_up"===N.rotate_type&&(ot="slide_down"),P.reverse=1),b(t)}var N={id:"",type:"scroll",scroll_direction:"left",scroll_speed:10,scroll_pause:0,scroll_spacing:40,scroll_units:10,scroll_init:0,scroll_loop:1,rotate_type:"fade",auto_rotate:0,rotate_delay:10,rotate_pause:0,rotate_speed:10,rotate_ease:"easeOutExpo",nav_reverse:0,disable_touchswipe:0,offset:20,before_change:function(){},after_change:function(){},after_load:function(){}},P={id:N.id,tick_count:0,previous_tick:0,current_tick:0,next_tick:0,reverse:0,running:0,paused:0};e&&t.extend(N,e);var R=t(this),S=R.find(".mtphr-dnt-tick-contents"),U=R.find(".mtphr-dnt-nav-prev"),V=R.find(".mtphr-dnt-nav-next"),Z=R.find(".mtphr-dnt-control-links"),$=R.find(".mtphr-dnt-play-pause"),tt=S.outerWidth(!0),et=0,it=[],nt,rt=!1,st=!0,at,ot=N.rotate_type,ct,pt=10,lt=.13;if(S.data("ditty:vars",P),U&&"rotate"===N.type&&(U.on("click",(function(t){t.preventDefault(),G()})),V.on("click",(function(t){t.preventDefault(),B()}))),Z&&"rotate"===N.type&&Z.children("a").on("click",(function(e){e.preventDefault();var i=parseInt(t(this).attr("href"));if(P.running)return!1;if(i===P.current_tick)return!1;var n=i<P.current_tick?1:0;N.nav_reverse&&n&&("slide_left"===N.rotate_type?ot="slide_right":"slide_right"===N.rotate_type?ot="slide_left":"slide_down"===N.rotate_type?ot="slide_up":"slide_up"===N.rotate_type&&(ot="slide_down"),P.reverse=1),b(i)})),$.on("click",(function(t){t.preventDefault(),H(P.paused)})),"rotate"!==N.type||N.disable_touchswipe||(S[0].addEventListener("swiped-left",(function(){J()})),S[0].addEventListener("swiped-right",(function(){K()}))),R.on("mtphr_dnt_next",(function(){B()})),R.on("mtphr_dnt_prev",(function(){G()})),R.on("mtphr_dnt_goto",(function(t,e){b(parseInt(e))})),R.on("mtphr_dnt_pause",(function(){H()})),R.on("mtphr_dnt_play",(function(){H(!0)})),t(window).on("resize",(function(){S.outerWidth()!==tt&&(tt=S.outerWidth(!0),"scroll"===N.type?("up"===N.scroll_direction||"down"===N.scroll_direction)&&st?g():h():"rotate"===N.type&&F())})),R.on("mtphr_dnt_resize_single",(function(){"scroll"===N.type?h():"rotate"===N.type&&F()})),t("body").on("mtphr_dnt_resize",(function(t,e){e&&e.indexOf(N.id)>=0&&("scroll"===N.type?h():"rotate"===N.type&&F())})),R.on("mtphr_dnt_replace_ticks",(function(e,n,r){clearInterval(nt),R.find(".mtphr-dnt-tick").remove(),n.each((function(){S.append(t(this))})),setTimeout((function(){i()}),r)})),0===R.width()){var _t=!0;setTimeout((function t(){R.width()>10&&(_t=!1,tt=S.outerWidth(!0),i()),_t&&setTimeout(t,100)}),100)}else i()}))}};t.fn.ditty_news_ticker=function(t){if(e[t])return e[t].apply(this,Array.prototype.slice.call(arguments,1));if("object"!=typeof t&&t)throw new Error("Method "+t+" does not exist in ditty_news_ticker");return e.init.apply(this,arguments)}}(jQuery);
|
1 |
+
!function(t){var e={init:function(e){return this.each((function(){function i(){P.tick_count=S.find(".mtphr-dnt-tick").length,P.tick_count>0&&("scroll"===N.type?r():"rotate"===N.type&&m()),N.after_load.call(R,S),R.trigger("mtphr_dnt_after_load_single",[P,it]),t("body").trigger("mtphr_dnt_after_load",[R,P,it])}function n(){S.find(".mtphr-dnt-tick").each((function(){t(this).height()>et&&(et=t(this).height()),"up"!==N.scroll_direction&&"down"!==N.scroll_direction||t(this).css("height","auto")})),S.css("height",et+"px")}function r(){var e=S.find(".mtphr-dnt-tick:first");if(e.attr("style")){var i,r=e.attr("style").split("width:");rt=!(r.length>1)}it=[],S.find("img").length?S.imagesLoaded((function(){n(),S.find(".mtphr-dnt-tick").each((function(){t(this).show();var e=[{headline:t(this)}];it.push(e)})),g(),o()})):(n(),S.find(".mtphr-dnt-tick").each((function(){t(this).show();var e=[{headline:t(this)}];it.push(e)})),g(),o()),S.on({mouseenter:function(){N.scroll_pause&&s()},mouseleave:function(){N.scroll_pause&&!P.paused&&a()}})}function s(){clearTimeout(ct),cancelAnimationFrame(nt)}function a(){o()}function o(){function t(){for(var e=0;e<P.tick_count;e++)if(!0===it[e][0].visible){var i="reset";"left"===N.scroll_direction||"right"===N.scroll_direction?("reset"===(i="left"===N.scroll_direction?c(e):p(e))?(i=it[e][0].reset,it[e][0].headline.css("opacity",0)):it[e][0].headline.css("opacity",1),it[e][0].headline.css({transform:"translateX( "+i+"px )"})):("reset"===(i="up"===N.scroll_direction?l(e):_(e))?(i=it[e][0].reset,it[e][0].headline.css("opacity",0)):it[e][0].headline.css("opacity",1),it[e][0].headline.css({transform:"translateY( "+i+"px )"})),it[e][0].position=i}N.scroll_init&&pt?(pt=!1,console.log(N.scroll_init_delay),ct=setTimeout((function(){nt=requestAnimationFrame(t)}),1e3*N.scroll_init_delay)):(pt=!1,nt=requestAnimationFrame(t))}clearTimeout(ct),cancelAnimationFrame(nt),nt=requestAnimationFrame(t)}function c(t){var e=parseFloat(it[t][0].position-N.scroll_speed*lt);return e<-(it[t][0].headline.width()+N.offset)?e=f(t):e<parseFloat(tt-it[t][0].headline.width()-N.scroll_spacing)&&d(t),e}function p(t){var e=parseFloat(it[t][0].position+N.scroll_speed*lt);return e>tt+N.offset?e=f(t):e>N.scroll_spacing&&d(t),e}function l(t){var e=parseFloat(it[t][0].position-N.scroll_speed*lt);return e<-(it[t][0].headline.height()+N.offset)?e=f(t):e<et-it[t][0].headline.height()-N.scroll_spacing&&d(t),e}function _(t){var e=parseFloat(it[t][0].position+N.scroll_speed*lt);return e>et+N.offset?e=f(t):e>N.scroll_spacing&&d(t),e}function f(e){return P.tick_count>1&&(it[e][0].visible=!1),P.tick_count===e+1&&(R.trigger("mtphr_dnt_scroll_complete",[P,it]),t("body").trigger("mtphr_dnt_scroll_complete",[R,P,it])),"reset"}function u(t){!1===it[t][0].visible&&(P.previous_tick=parseInt(t-1),P.previous_tick<0&&(P.previous_tick=parseInt(P.tick_count-1)),P.current_tick=t,P.next_tick=parseInt(t+1),P.next_tick>=P.tick_count&&(P.next_tick=0))}function d(t){t===P.tick_count-1?N.scroll_loop&&(u(0),it[0][0].visible=!0):(u(parseInt(t+1)),it[t+1][0].visible=!0)}function h(){for(var t=0;t<P.tick_count;t++){var e,i=it[t][0].headline;switch(N.scroll_direction){case"left":e=tt+N.offset,!1===it[t][0].visible&&i.css("transform","translateX( "+e+"px )");break;case"right":e=parseInt("-"+(i.width()+N.offset)),!1===it[t][0].visible&&i.css("transform","translateX( "+e+"px )");break;case"up":rt&&i.css("width",tt),e=parseInt(et+N.offset),!1===it[t][0].visible&&i.css("transform","translateY( "+e+"px )");break;case"down":rt&&i.css("width",tt),e=parseInt("-"+(i.height()+N.offset)),!1===it[t][0].visible&&i.css("transform","translateY( "+e+"px )");break}it[t][0].width=i.width(),it[t][0].height=i.height(),!1===it[t][0].visible&&(it[t][0].position=e),it[t][0].reset=e}}function g(){for(var t,e,i=0;i<P.tick_count;i++)if(it[i]){switch(e=it[i][0].headline,N.scroll_direction){case"left":t=tt+N.offset,e.css("transform","translateX( "+t+"px )");break;case"right":t=parseInt("-"+(e.width()+N.offset)),e.css("transform","translateX( "+t+"px )");break;case"up":rt&&e.css("width",tt),t=parseInt(et+N.offset),e.css("transform","translateY( "+t+"px )");break;case"down":rt&&e.css("width",tt),t=parseInt("-"+(e.height()+N.offset)),e.css("transform","translateY( "+t+"px )");break}it[i][0].width=e.width(),it[i][0].height=e.height(),it[i][0].position=t,it[i][0].reset=t,it[i][0].visible=!1,e=it[i][0].headline}if(P.current_tick=0,it[P.current_tick][0].visible=!0,N.scroll_init)for("left"===N.scroll_direction?t=0:"right"===N.scroll_direction?t=tt:"up"===N.scroll_direction?t=0:"down"===N.scroll_direction&&(t=et),i=0;i<P.tick_count;i++)switch(e=it[i][0].headline,N.scroll_direction){case"left":t<tt&&(e.css("transform","translateX( "+t+"px )"),it[i][0].position=t,it[i][0].visible=!0,t=t+it[i][0].width+N.scroll_spacing);break;case"right":t>0&&(t-=it[i][0].width,e.css("transform","translateX( "+t+"px )"),it[i][0].position=t,it[i][0].visible=!0,t-=N.scroll_spacing);break;case"up":t<et&&(e.css("transform","translateY( "+t+"px )"),it[i][0].position=t,it[i][0].visible=!0,t=t+it[i][0].height+N.scroll_spacing);break;case"down":t>0&&(e.css("transform","translateY( "+t+"px )"),e.stop(!0,!0).css("top",t+"px"),it[i][0].position=t,it[i][0].visible=!0,t-=N.scroll_spacing);break}}function k(){y()}function v(){clearInterval(st)}function m(){switch(S.find(".mtphr-dnt-tick").each((function(){it.push(t(this)),t(this).imagesLoaded((function(){F()}))})),F(),S.find(".mtphr-dnt-tick").show(),N.rotate_type){case"fade":T(S,it,parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_left":Y(S,it,parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_right":E(S,it,parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_down":q(S,it,parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_up":O(S,it,parseInt(100*N.rotate_speed),N.rotate_ease);break}w(0),N.auto_rotate&&k(),S.on({mouseenter:function(){N.auto_rotate&&N.rotate_pause&&!P.running&&v()},mouseleave:function(){N.auto_rotate&&N.rotate_pause&&!P.running&&!P.paused&&k()}})}function y(){v(),st=setInterval((function(){var t=parseInt(P.current_tick+1);t===P.tick_count&&(t=0),b(t)}),parseInt(1e3*N.rotate_delay))}function b(e){P.current_tick!==e&&(N.auto_rotate&&v(),P.next_tick=e,N.before_change.call(R,S),R.trigger("mtphr_dnt_before_change_single",[P,it]),t("body").trigger("mtphr_dnt_before_change",[R,P,it]),P.running=1,I(e),x(e),P.previous_tick=P.current_tick,P.current_tick=e,ot=setTimeout((function(){N.after_change.call(R,S),R.trigger("mtphr_dnt_after_change_single",[P,it]),t("body").trigger("mtphr_dnt_after_change",[R,P,it]),at=N.rotate_type,P.reverse=0,P.running=0,N.auto_rotate&&!P.paused&&y()}),parseInt(100*N.rotate_speed)))}function w(t){Z&&(Z.children("a").removeClass("active"),Z.children('a[href="'+t+'"]').addClass("active"))}function x(e){switch(w(e),at){case"fade":A(S,t(it[e]),t(it[P.current_tick]),parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_left":C(S,t(it[e]),t(it[P.current_tick]),parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_right":L(S,t(it[e]),t(it[P.current_tick]),parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_down":z(S,t(it[e]),t(it[P.current_tick]),parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_up":M(S,t(it[e]),t(it[P.current_tick]),parseInt(100*N.rotate_speed),N.rotate_ease);break}}function I(e){switch(at){case"fade":X(S,t(it[P.current_tick]),t(it[e]),parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_left":D(S,t(it[P.current_tick]),t(it[e]),parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_right":W(S,t(it[P.current_tick]),t(it[e]),parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_down":j(S,t(it[P.current_tick]),t(it[e]),parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_up":Q(S,t(it[P.current_tick]),t(it[e]),parseInt(100*N.rotate_speed),N.rotate_ease);break}}function F(){for(var e=0;e<P.tick_count;e++)t(it[e]).width(tt+"px"),P.current_tick!==e&&t(it[e]).css({left:parseFloat(tt+N.offset)+"px"});var i=t(it[P.current_tick]).height();S.stop().css("height",i+"px")}function T(t,e){var i=e[0],n=i.height();t.css("height",n+"px"),i.css({opacity:1,left:"auto"})}function A(t,e,i,n,r){e.css({opacity:0,left:"auto"}),e.stop().animate({opacity:1},n,r);var s=e.height();t.stop().animate({height:s+"px"},n,r)}function X(e,i,n,r,s){i.stop().animate({opacity:0},r,s,(function(){t(this).css({left:parseFloat(tt+N.offset)+"px"}),i.remove(),e.append(i)}))}function Y(t,e){var i=e[0],n=i.height();t.css("height",n+"px"),i.css({opacity:1,left:0})}function C(t,e,i,n,r){var s=e.height();e.css({opacity:1,left:parseFloat(tt+N.offset)+"px"}),t.stop().animate({height:s+"px"},n,r,(function(){})),e.stop().animate({left:"0"},n,r,(function(){}))}function D(t,e,i,n,r){e.stop().animate({left:"-"+parseFloat(tt+N.offset)+"px"},n,r,(function(){e.css({opacity:0}),e.remove(),t.append(e)}))}function E(t,e){var i=e[0],n=i.height();t.css("height",n+"px"),i.css({opacity:1,left:0})}function L(t,e,i,n,r){var s=e.height();e.css({opacity:1,left:"-"+parseFloat(tt+N.offset)+"px"}),t.stop().animate({height:s+"px"},n,r,(function(){})),e.stop().animate({left:"0"},n,r)}function W(t,e,i,n,r){e.stop().animate({left:parseFloat(tt+N.offset)+"px"},n,r,(function(){e.css({opacity:0}),e.remove(),t.append(e)}))}function q(t,e){var i=e[0],n=i.height();t.css("height",n+"px"),i.css({opacity:1,top:0,left:"auto"})}function z(t,e,i,n,r){var s=e.height();e.css({opacity:1,top:"-"+parseFloat(s+N.offset)+"px",left:"auto"}),t.stop().animate({height:s+"px"},n,r),e.stop().animate({top:"0"},n,r)}function j(t,e,i,n,r){var s=i.height();e.stop().animate({top:parseFloat(s+N.offset)+"px"},n,r,(function(){e.css({opacity:0}),e.remove(),t.append(e)}))}function O(t,e){var i=e[0],n=i.height();t.css({height:n+"px",left:"auto"}),i.css({opacity:1,top:0})}function M(t,e,i,n,r){var s=e.height();e.css({opacity:1,top:parseFloat(i.height()+N.offset)+"px",left:"auto"}),t.stop().animate({height:s+"px"},n,r),e.stop().animate({top:"0"},n,r)}function Q(t,e,i,n,r){var s=e.height();e.stop().animate({top:"-"+parseFloat(s+N.offset)+"px"},n,r,(function(){e.css({opacity:0}),e.remove(),t.append(e)}))}function B(){if(P.running)return!1;var t=parseInt(P.current_tick+1);t===P.tick_count&&(t=0),b(t)}function G(){if(P.running)return!1;var t=parseInt(P.current_tick-1);t<0&&(t=P.tick_count-1),N.nav_reverse&&("slide_left"===N.rotate_type?at="slide_right":"slide_right"===N.rotate_type?at="slide_left":"slide_down"===N.rotate_type?at="slide_up":"slide_up"===N.rotate_type&&(at="slide_down"),P.reverse=1),b(t)}function H(t){t?(P.paused=!1,$.removeClass("paused"),"scroll"===N.type?a():k()):(P.paused=!0,$.addClass("paused"),"scroll"===N.type?s():v()),R.trigger("mtphr_dnt_play_pause",[P,it])}function J(){if(P.running)return!1;var t=parseInt(P.current_tick+1);t===P.tick_count&&(t=0),"slide_left"!==N.rotate_type&&"slide_right"!==N.rotate_type||(at="slide_left"),b(t)}function K(){if(P.running)return!1;var t=parseInt(P.current_tick-1);t<0&&(t=P.tick_count-1),"slide_left"!==N.rotate_type&&"slide_right"!==N.rotate_type||(at="slide_right"),N.nav_reverse&&("slide_down"===N.rotate_type?at="slide_up":"slide_up"===N.rotate_type&&(at="slide_down"),P.reverse=1),b(t)}var N={id:"",type:"scroll",scroll_direction:"left",scroll_speed:10,scroll_pause:0,scroll_spacing:40,scroll_units:10,scroll_init:0,scroll_init_delay:2,scroll_loop:1,rotate_type:"fade",auto_rotate:0,rotate_delay:10,rotate_pause:0,rotate_speed:10,rotate_ease:"easeOutExpo",nav_reverse:0,disable_touchswipe:0,offset:20,before_change:function(){},after_change:function(){},after_load:function(){}},P={id:N.id,tick_count:0,previous_tick:0,current_tick:0,next_tick:0,reverse:0,running:0,paused:0};e&&t.extend(N,e);var R=t(this),S=R.find(".mtphr-dnt-tick-contents"),U=R.find(".mtphr-dnt-nav-prev"),V=R.find(".mtphr-dnt-nav-next"),Z=R.find(".mtphr-dnt-control-links"),$=R.find(".mtphr-dnt-play-pause"),tt=S.outerWidth(!0),et=0,it=[],nt,rt=!0,st,at=N.rotate_type,ot,ct,pt=!0,lt=.13;if(S.data("ditty:vars",P),U&&"rotate"===N.type&&(U.on("click",(function(t){t.preventDefault(),G()})),V.on("click",(function(t){t.preventDefault(),B()}))),Z&&"rotate"===N.type&&Z.children("a").on("click",(function(e){e.preventDefault();var i=parseInt(t(this).attr("href"));if(P.running)return!1;if(i===P.current_tick)return!1;var n=i<P.current_tick?1:0;N.nav_reverse&&n&&("slide_left"===N.rotate_type?at="slide_right":"slide_right"===N.rotate_type?at="slide_left":"slide_down"===N.rotate_type?at="slide_up":"slide_up"===N.rotate_type&&(at="slide_down"),P.reverse=1),b(i)})),$.on("click",(function(t){t.preventDefault(),H(P.paused)})),"rotate"!==N.type||N.disable_touchswipe||(S[0].addEventListener("swiped-left",(function(){J()})),S[0].addEventListener("swiped-right",(function(){K()}))),R.on("mtphr_dnt_next",(function(){B()})),R.on("mtphr_dnt_prev",(function(){G()})),R.on("mtphr_dnt_goto",(function(t,e){b(parseInt(e))})),R.on("mtphr_dnt_pause",(function(){H()})),R.on("mtphr_dnt_play",(function(){H(!0)})),t(window).on("resize",(function(){S.outerWidth()!==tt&&(tt=S.outerWidth(!0),"scroll"===N.type?("up"===N.scroll_direction||"down"===N.scroll_direction)&&rt?g():h():"rotate"===N.type&&F())})),R.on("mtphr_dnt_resize_single",(function(){"scroll"===N.type?h():"rotate"===N.type&&F()})),t("body").on("mtphr_dnt_resize",(function(t,e){e&&e.indexOf(N.id)>=0&&("scroll"===N.type?h():"rotate"===N.type&&F())})),R.on("mtphr_dnt_replace_ticks",(function(e,n,r){clearTimeout(ct),cancelAnimationFrame(nt),R.find(".mtphr-dnt-tick").remove(),n.each((function(){S.append(t(this))})),setTimeout((function(){i()}),r)})),0===R.width()){var _t=!0;setTimeout((function t(){R.width()>10&&(_t=!1,tt=S.outerWidth(!0),i()),_t&&setTimeout(t,100)}),100)}else i()}))}};t.fn.ditty_news_ticker=function(t){if(e[t])return e[t].apply(this,Array.prototype.slice.call(arguments,1));if("object"!=typeof t&&t)throw new Error("Method "+t+" does not exist in ditty_news_ticker");return e.init.apply(this,arguments)}}(jQuery);
|
inc/static/js/partials/admin-general.js
CHANGED
@@ -295,6 +295,27 @@ jQuery( document ).ready( function($) {
|
|
295 |
$('.mtphr-dnt-list-field-mtphr_dnt_mixed_ticks_all').each( function() {
|
296 |
mtphr_dnt_mixed_ticks_all( $(this) );
|
297 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
298 |
|
299 |
});
|
300 |
|
295 |
$('.mtphr-dnt-list-field-mtphr_dnt_mixed_ticks_all').each( function() {
|
296 |
mtphr_dnt_mixed_ticks_all( $(this) );
|
297 |
});
|
298 |
+
|
299 |
+
|
300 |
+
/* --------------------------------------------------------- */
|
301 |
+
/* !First tick on init */
|
302 |
+
/* --------------------------------------------------------- */
|
303 |
+
|
304 |
+
function mtphr_dnt_init_tick( $field ) {
|
305 |
+
if ( $field.is( ':checked' ) ) {
|
306 |
+
$( '.mtphr-dnt-field-mtphr_dnt_scroll_init_delay' ).show();
|
307 |
+
} else {
|
308 |
+
$( '.mtphr-dnt-field-mtphr_dnt_scroll_init_delay' ).hide();
|
309 |
+
}
|
310 |
+
}
|
311 |
+
|
312 |
+
$('body').on( 'click', 'input[name="_mtphr_dnt_scroll_init"]', function() {
|
313 |
+
mtphr_dnt_init_tick( $(this) );
|
314 |
+
});
|
315 |
+
|
316 |
+
if ( $( 'input[name="_mtphr_dnt_scroll_init"]').length ) {
|
317 |
+
mtphr_dnt_init_tick( $( 'input[name="_mtphr_dnt_scroll_init"]') );
|
318 |
+
}
|
319 |
|
320 |
});
|
321 |
|
inc/static/js/script-admin.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(t){"use strict";function e(e){return this.each((function(){var n=t(this),r=n.data("bs.mtphr_dnt_affix"),o="object"==typeof e&&e;r||n.data("bs.mtphr_dnt_affix",r=new i(this,o)),"string"==typeof e&&r[e]()}))}var i=function(e,n){this.options=t.extend({},i.DEFAULTS,n),this.$target=t(this.options.target).on("scroll.bs.mtphr_dnt_affix.data-api",t.proxy(this.checkPosition,this)).on("click.bs.mtphr_dnt_affix.data-api",t.proxy(this.checkPositionWithEventLoop,this)),this.$element=t(e),this.mtphr_dnt_affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};i.VERSION="3.3.5",i.RESET="mtphr_dnt_affix mtphr_dnt_affix-top mtphr_dnt_affix-bottom",i.DEFAULTS={offset:0,target:window},i.prototype.getState=function(t,e,i,n){var r=this.$target.scrollTop(),o=this.$element.offset(),a=this.$target.height();if(null!==i&&"top"===this.mtphr_dnt_affixed)return r<i&&"top";if("bottom"===this.mtphr_dnt_affixed)return null!==i?!(r+this.unpin<=o.top)&&"bottom":!(r+a<=t-n)&&"bottom";var s=null===this.mtphr_dnt_affixed,h=s?r:o.top,d;return null!==i&&r<=i?"top":null!==n&&h+(s?a:e)>=t-n&&"bottom"},i.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(i.RESET).addClass("mtphr_dnt_affix");var t=this.$target.scrollTop(),e=this.$element.offset();return this.pinnedOffset=e.top-t},i.prototype.checkPositionWithEventLoop=function(){setTimeout(t.proxy(this.checkPosition,this),1)},i.prototype.checkPosition=function(){if(this.$element.is(":visible")){var e=this.$element.height(),n=this.options.offset,r=n.top,o=n.bottom,a=Math.max(t(document).height(),t(document.body).height());"object"!=typeof n&&(o=r=n),"function"==typeof r&&(r=n.top(this.$element)),"function"==typeof o&&(o=n.bottom(this.$element));var s=this.getState(a,e,r,o);if(this.mtphr_dnt_affixed!==s){null!==this.unpin&&this.$element.css("top","");var h="mtphr_dnt_affix"+(s?"-"+s:""),d=t.Event(h+".bs.mtphr_dnt_affix");if(this.$element.trigger(d),d.isDefaultPrevented())return;this.mtphr_dnt_affixed=s,this.unpin="bottom"===s?this.getPinnedOffset():null,this.$element.removeClass(i.RESET).addClass(h).trigger(h.replace("mtphr_dnt_affix","mtphr_dnt_affixed")+".bs.mtphr_dnt_affix")}"bottom"===s&&this.$element.offset({top:a-e-o})}};var n=t.fn.mtphr_dnt_affix;t.fn.mtphr_dnt_affix=e,t.fn.mtphr_dnt_affix.Constructor=i,t.fn.mtphr_dnt_affix.noConflict=function(){return t.fn.mtphr_dnt_affix=n,this},t(window).on("load",(function(){t('[data-spy="mtphr_dnt_affix"]').each((function(){var i=t(this),n=i.data();n.offset=n.offset||{},null!==n.offsetBottom&&(n.offset.bottom=n.offsetBottom),null!==n.offsetTop&&(n.offset.top=n.offsetTop),e.call(i,n)}))}))}(jQuery),jQuery(document).ready((function(t){function e(e,i){t("#mtphr-dnt-"+i+"-metaboxes > div").stop(!0,!0).hide();for(var n=e.attr("metabox").split(" "),r=0;r<n.length;r++)t("#"+n[r]).show();e.siblings("a").removeClass("button-primary"),e.addClass("button-primary"),e.siblings("input").val(e.attr("href").substring(1))}function i(t){var e;t.find("input").is(":checked")?t.next().fadeOut():t.next().fadeIn()}var n=t("#mtphr-dnt-settings-select"),r=t("#wpadminbar");n.mtphr_dnt_affix({offset:{top:function(){return t(window).width()<601?this.top=n.offset().top+5:this.top=n.offset().top-r.height()+5}}}),t("#mtphr-dnt-metabox-group-toggles").on("click",".mtphr-dnt-metabox-group-toggle",(function(e){e.preventDefault();var i=t(this).attr("href");t(".mtphr-dnt-metabox-group-toggle").removeClass("active"),t(".mtphr-dnt-metabox-group").removeClass("active"),t(this).addClass("active"),t(i).addClass("active"),t('input[name="_mtphr_dnt_admin_tab"]').val(i)})),t(".mtphr-dnt-codemirror-css").each((function(){var e=t(this).children("textarea");CodeMirror.fromTextArea(e[0],{mode:"css",lineNumbers:!0,lineWrapping:!0,viewportMargin:1/0})})),t(".mtphr-dnt-codemirror-js").each((function(){var e=t(this).children("textarea"),i;CodeMirror.fromTextArea(e[0],{mode:"htmlmixed",lineNumbers:!0,lineWrapping:!0}).setSize(!1,140)})),t('input[name="_mtphr_dnt_admin_javascript"]').length&&t('input[name="_mtphr_dnt_admin_javascript"]').val("ok"),t(".mtphr-dnt-type-toggle.button-primary").length&&e(t(".mtphr-dnt-type-toggle.button-primary"),"type"),t(".mtphr-dnt-mode-toggle.button-primary").length&&e(t(".mtphr-dnt-mode-toggle.button-primary"),"mode"),t("#mtphr-dnt-type-select").on("click",".mtphr-dnt-type-toggle",(function(i){i.preventDefault(),t(this).hasClass("button-primary")||e(t(this),"type")})),t("#mtphr-dnt-mode-select").on("click",".mtphr-dnt-mode-toggle",(function(i){i.preventDefault(),t(this).hasClass("button-primary")||e(t(this),"mode")})),t(".mtphr-dnt-sort").length>0&&(t(".mtphr-dnt-sort").sortable({handle:".mtphr-dnt-sort-heading",items:".mtphr-dnt-sort-item",axis:"y",opacity:.7,placeholder:{element:function(e){var i=t(e).innerHeight();return t('<div class="mtphr-dnt-sort-placeholder" style="height:'+i+'px;"></div>')[0]},update:function(){}},helper:function(e,i){var n=i.children(),r=i.clone();return r.children().each((function(e){t(this).width(n.eq(e).width()),t(this).height(n.eq(e).height())})),r}}),t("body").on("click",".mtphr-dnt-sort-heading.optional",(function(e){e.preventDefault();var i=t(this).parents(".mtphr-dnt-sort-item"),n=t(this).next(".mtphr-dnt-sort-item-fields"),r=t(this).children("input");i.hasClass("active")?(i.removeClass("active"),r.val("off"),n.length&&n.stop(!0,!0).slideUp(1e3,"easeOutQuint")):(i.addClass("active"),r.val("on"),n.length&&n.stop(!0,!0).slideDown(1e3,"easeOutQuint"))}))),t(".mtphr-dnt-list").mtphr_dnt_list(),t("body").on("click",".mtphr-dnt-single-image .mtphr-dnt-delete",(function(e){e.preventDefault();var i=t(this).parent(),n=i.siblings(".mtphr-dnt-single-image-upload"),r;i.siblings("input").val(""),i.remove(),n.show()})),t("body").on("click",".mtphr-dnt-single-image-upload",(function(e){e.preventDefault();var i=t(this),n=i.parent(),r=n.children("input"),o;if(!o)return(o=wp.media({title:ditty_news_ticker_vars.img_title,button:{text:ditty_news_ticker_vars.img_button,size:"small"},multiple:!1,library:{type:"image"}})).on("select",(function(){var t=o.state().get("selection").toJSON();if(t.length>0){r.val(t[0].id);var e={action:"mtphr_dnt_single_image_ajax",attachment:t[0],security:ditty_news_ticker_vars.security};jQuery.post(ajaxurl,e,(function(t){i.hide(),n.append(t)}))}})),o.open(),!1;o.open()})),t.protip({defaults:{position:"top",size:"small",scheme:"black",classes:"ditty-protip"}}),t("body").on("click",".mtphr-dnt-list-field-mtphr_dnt_mixed_ticks_all input",(function(){i(t(this).parents(".mtphr-dnt-list-field-mtphr_dnt_mixed_ticks_all"))})),t(".mtphr-dnt-list-field-mtphr_dnt_mixed_ticks_all").each((function(){i(t(this))}))})),function(t){var e={init:function(e){return this.each((function(){function i(){a.find(".mtphr-dnt-list-item").length>1?(a.find(".mtphr-dnt-list-handle").show(),a.find(".mtphr-dnt-list-delete").show()):(a.find(".mtphr-dnt-list-handle").hide(),a.find(".mtphr-dnt-list-delete").hide())}function n(){a.find(".mtphr-dnt-list-item").each((function(e){t(this).find("textarea, input, select").each((function(){var i,n;if(t(this).hasClass("wp-editor-area")){var r=t(this).parents(".mtphr-dnt-field-type-wysiwyg");i=r.attr("data-name"),n=r.attr("data-key")}else i=t(this).attr("data-name"),n=t(this).attr("data-key");i&&n&&t(this).attr("name",i+"["+e+"]["+n+"]")}))})),i()}function r(e,i){var r=e.clone();r.find("textarea, input, select").each((function(){"checkbox"===t(this).attr("type")||"radio"===t(this).attr("type")?t(this).attr("checked",!1):t(this).val("")})),r.find("textarea").each((function(){if(t(this).hasClass("wp-editor-area")){var e=t(this).parents(".mtphr-dnt-field-type-wysiwyg"),i=e.attr("data-name");e.children(".wp-core-ui").remove();var r={action:"mtphr_dnt_wysiwyg_ajax",name:i,security:ditty_news_ticker_vars.security};jQuery.post(ajaxurl,r,(function(i){var r,o=t(i).find("textarea").attr("id");e.append(i),"object"==typeof tinyMCE&&"function"==typeof tinyMCE.execCommand&&tinyMCE.execCommand("mceAddEditor",!1,o),n()}))}})),r.hide(),e.after(r),r.fadeIn().addClass(i),t.protip({defaults:{position:"top",size:"small",scheme:"black",classes:"ditty-protip"}}),n(),a.trigger("mtphr_dnt_list_item_added",[r,i])}var o={};e&&t.extend(o,e);var a=t(this);t.protip({defaults:{position:"top",size:"small",scheme:"black",classes:"ditty-protip"}}),a.sortable({handle:".mtphr-dnt-list-heading > .dashicons-menu",items:".mtphr-dnt-list-item",axis:"y",opacity:.7,placeholder:{element:function(e){var i=t(e).innerHeight();return t('<div class="mtphr-dnt-sort-placeholder" style="height:'+i+'px;"></div>')[0]},update:function(){}},helper:function(e,i){var n=i.children(),r=i.clone();return r.children().each((function(e){t(this).width(n.eq(e).width()),t(this).height(n.eq(e).height())})),r},start:function(e,i){var n=t(i.item);if(n.find(".wp-editor-container").length){var r=n.find(".wp-editor-area").attr("id");tinyMCE.execCommand("mceRemoveEditor",!0,r)}},stop:function(e,i){var n=t(i.item);if(n.find(".wp-editor-container").length){var r=n.find(".wp-editor-area").attr("id");tinyMCE.execCommand("mceAddEditor",!0,r)}}}),a.on("click",".mtphr-dnt-list-delete",(function(e){e.preventDefault(),t(this).parents(".mtphr-dnt-list-item").fadeOut((function(){t(this).remove(),n()}))})),a.on("click",".mtphr-dnt-list-add",(function(e){e.preventDefault(),r(t(this).parents(".mtphr-dnt-list-item"))})),a.on("mtphr_dnt_list_add_item",(function(t,e,i){r(e,i)})),n()}))}};t.fn.mtphr_dnt_list=function(t){if(e[t])return e[t].apply(this,Array.prototype.slice.call(arguments,1));if("object"!=typeof t&&t)throw new Error("Method "+t+" does not exist in mtphr_dnt_list");return e.init.apply(this,arguments)}}(jQuery);
|
1 |
+
!function(t){"use strict";function e(e){return this.each((function(){var n=t(this),r=n.data("bs.mtphr_dnt_affix"),o="object"==typeof e&&e;r||n.data("bs.mtphr_dnt_affix",r=new i(this,o)),"string"==typeof e&&r[e]()}))}var i=function(e,n){this.options=t.extend({},i.DEFAULTS,n),this.$target=t(this.options.target).on("scroll.bs.mtphr_dnt_affix.data-api",t.proxy(this.checkPosition,this)).on("click.bs.mtphr_dnt_affix.data-api",t.proxy(this.checkPositionWithEventLoop,this)),this.$element=t(e),this.mtphr_dnt_affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};i.VERSION="3.3.5",i.RESET="mtphr_dnt_affix mtphr_dnt_affix-top mtphr_dnt_affix-bottom",i.DEFAULTS={offset:0,target:window},i.prototype.getState=function(t,e,i,n){var r=this.$target.scrollTop(),o=this.$element.offset(),a=this.$target.height();if(null!==i&&"top"===this.mtphr_dnt_affixed)return r<i&&"top";if("bottom"===this.mtphr_dnt_affixed)return null!==i?!(r+this.unpin<=o.top)&&"bottom":!(r+a<=t-n)&&"bottom";var s=null===this.mtphr_dnt_affixed,h=s?r:o.top,d;return null!==i&&r<=i?"top":null!==n&&h+(s?a:e)>=t-n&&"bottom"},i.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(i.RESET).addClass("mtphr_dnt_affix");var t=this.$target.scrollTop(),e=this.$element.offset();return this.pinnedOffset=e.top-t},i.prototype.checkPositionWithEventLoop=function(){setTimeout(t.proxy(this.checkPosition,this),1)},i.prototype.checkPosition=function(){if(this.$element.is(":visible")){var e=this.$element.height(),n=this.options.offset,r=n.top,o=n.bottom,a=Math.max(t(document).height(),t(document.body).height());"object"!=typeof n&&(o=r=n),"function"==typeof r&&(r=n.top(this.$element)),"function"==typeof o&&(o=n.bottom(this.$element));var s=this.getState(a,e,r,o);if(this.mtphr_dnt_affixed!==s){null!==this.unpin&&this.$element.css("top","");var h="mtphr_dnt_affix"+(s?"-"+s:""),d=t.Event(h+".bs.mtphr_dnt_affix");if(this.$element.trigger(d),d.isDefaultPrevented())return;this.mtphr_dnt_affixed=s,this.unpin="bottom"===s?this.getPinnedOffset():null,this.$element.removeClass(i.RESET).addClass(h).trigger(h.replace("mtphr_dnt_affix","mtphr_dnt_affixed")+".bs.mtphr_dnt_affix")}"bottom"===s&&this.$element.offset({top:a-e-o})}};var n=t.fn.mtphr_dnt_affix;t.fn.mtphr_dnt_affix=e,t.fn.mtphr_dnt_affix.Constructor=i,t.fn.mtphr_dnt_affix.noConflict=function(){return t.fn.mtphr_dnt_affix=n,this},t(window).on("load",(function(){t('[data-spy="mtphr_dnt_affix"]').each((function(){var i=t(this),n=i.data();n.offset=n.offset||{},null!==n.offsetBottom&&(n.offset.bottom=n.offsetBottom),null!==n.offsetTop&&(n.offset.top=n.offsetTop),e.call(i,n)}))}))}(jQuery),jQuery(document).ready((function(t){function e(e,i){t("#mtphr-dnt-"+i+"-metaboxes > div").stop(!0,!0).hide();for(var n=e.attr("metabox").split(" "),r=0;r<n.length;r++)t("#"+n[r]).show();e.siblings("a").removeClass("button-primary"),e.addClass("button-primary"),e.siblings("input").val(e.attr("href").substring(1))}function i(t){var e;t.find("input").is(":checked")?t.next().fadeOut():t.next().fadeIn()}function n(e){e.is(":checked")?t(".mtphr-dnt-field-mtphr_dnt_scroll_init_delay").show():t(".mtphr-dnt-field-mtphr_dnt_scroll_init_delay").hide()}var r=t("#mtphr-dnt-settings-select"),o=t("#wpadminbar");r.mtphr_dnt_affix({offset:{top:function(){return t(window).width()<601?this.top=r.offset().top+5:this.top=r.offset().top-o.height()+5}}}),t("#mtphr-dnt-metabox-group-toggles").on("click",".mtphr-dnt-metabox-group-toggle",(function(e){e.preventDefault();var i=t(this).attr("href");t(".mtphr-dnt-metabox-group-toggle").removeClass("active"),t(".mtphr-dnt-metabox-group").removeClass("active"),t(this).addClass("active"),t(i).addClass("active"),t('input[name="_mtphr_dnt_admin_tab"]').val(i)})),t(".mtphr-dnt-codemirror-css").each((function(){var e=t(this).children("textarea");CodeMirror.fromTextArea(e[0],{mode:"css",lineNumbers:!0,lineWrapping:!0,viewportMargin:1/0})})),t(".mtphr-dnt-codemirror-js").each((function(){var e=t(this).children("textarea"),i;CodeMirror.fromTextArea(e[0],{mode:"htmlmixed",lineNumbers:!0,lineWrapping:!0}).setSize(!1,140)})),t('input[name="_mtphr_dnt_admin_javascript"]').length&&t('input[name="_mtphr_dnt_admin_javascript"]').val("ok"),t(".mtphr-dnt-type-toggle.button-primary").length&&e(t(".mtphr-dnt-type-toggle.button-primary"),"type"),t(".mtphr-dnt-mode-toggle.button-primary").length&&e(t(".mtphr-dnt-mode-toggle.button-primary"),"mode"),t("#mtphr-dnt-type-select").on("click",".mtphr-dnt-type-toggle",(function(i){i.preventDefault(),t(this).hasClass("button-primary")||e(t(this),"type")})),t("#mtphr-dnt-mode-select").on("click",".mtphr-dnt-mode-toggle",(function(i){i.preventDefault(),t(this).hasClass("button-primary")||e(t(this),"mode")})),t(".mtphr-dnt-sort").length>0&&(t(".mtphr-dnt-sort").sortable({handle:".mtphr-dnt-sort-heading",items:".mtphr-dnt-sort-item",axis:"y",opacity:.7,placeholder:{element:function(e){var i=t(e).innerHeight();return t('<div class="mtphr-dnt-sort-placeholder" style="height:'+i+'px;"></div>')[0]},update:function(){}},helper:function(e,i){var n=i.children(),r=i.clone();return r.children().each((function(e){t(this).width(n.eq(e).width()),t(this).height(n.eq(e).height())})),r}}),t("body").on("click",".mtphr-dnt-sort-heading.optional",(function(e){e.preventDefault();var i=t(this).parents(".mtphr-dnt-sort-item"),n=t(this).next(".mtphr-dnt-sort-item-fields"),r=t(this).children("input");i.hasClass("active")?(i.removeClass("active"),r.val("off"),n.length&&n.stop(!0,!0).slideUp(1e3,"easeOutQuint")):(i.addClass("active"),r.val("on"),n.length&&n.stop(!0,!0).slideDown(1e3,"easeOutQuint"))}))),t(".mtphr-dnt-list").mtphr_dnt_list(),t("body").on("click",".mtphr-dnt-single-image .mtphr-dnt-delete",(function(e){e.preventDefault();var i=t(this).parent(),n=i.siblings(".mtphr-dnt-single-image-upload"),r;i.siblings("input").val(""),i.remove(),n.show()})),t("body").on("click",".mtphr-dnt-single-image-upload",(function(e){e.preventDefault();var i=t(this),n=i.parent(),r=n.children("input"),o;if(!o)return(o=wp.media({title:ditty_news_ticker_vars.img_title,button:{text:ditty_news_ticker_vars.img_button,size:"small"},multiple:!1,library:{type:"image"}})).on("select",(function(){var t=o.state().get("selection").toJSON();if(t.length>0){r.val(t[0].id);var e={action:"mtphr_dnt_single_image_ajax",attachment:t[0],security:ditty_news_ticker_vars.security};jQuery.post(ajaxurl,e,(function(t){i.hide(),n.append(t)}))}})),o.open(),!1;o.open()})),t.protip({defaults:{position:"top",size:"small",scheme:"black",classes:"ditty-protip"}}),t("body").on("click",".mtphr-dnt-list-field-mtphr_dnt_mixed_ticks_all input",(function(){i(t(this).parents(".mtphr-dnt-list-field-mtphr_dnt_mixed_ticks_all"))})),t(".mtphr-dnt-list-field-mtphr_dnt_mixed_ticks_all").each((function(){i(t(this))})),t("body").on("click",'input[name="_mtphr_dnt_scroll_init"]',(function(){n(t(this))})),t('input[name="_mtphr_dnt_scroll_init"]').length&&n(t('input[name="_mtphr_dnt_scroll_init"]'))})),function(t){var e={init:function(e){return this.each((function(){function i(){a.find(".mtphr-dnt-list-item").length>1?(a.find(".mtphr-dnt-list-handle").show(),a.find(".mtphr-dnt-list-delete").show()):(a.find(".mtphr-dnt-list-handle").hide(),a.find(".mtphr-dnt-list-delete").hide())}function n(){a.find(".mtphr-dnt-list-item").each((function(e){t(this).find("textarea, input, select").each((function(){var i,n;if(t(this).hasClass("wp-editor-area")){var r=t(this).parents(".mtphr-dnt-field-type-wysiwyg");i=r.attr("data-name"),n=r.attr("data-key")}else i=t(this).attr("data-name"),n=t(this).attr("data-key");i&&n&&t(this).attr("name",i+"["+e+"]["+n+"]")}))})),i()}function r(e,i){var r=e.clone();r.find("textarea, input, select").each((function(){"checkbox"===t(this).attr("type")||"radio"===t(this).attr("type")?t(this).attr("checked",!1):t(this).val("")})),r.find("textarea").each((function(){if(t(this).hasClass("wp-editor-area")){var e=t(this).parents(".mtphr-dnt-field-type-wysiwyg"),i=e.attr("data-name");e.children(".wp-core-ui").remove();var r={action:"mtphr_dnt_wysiwyg_ajax",name:i,security:ditty_news_ticker_vars.security};jQuery.post(ajaxurl,r,(function(i){var r,o=t(i).find("textarea").attr("id");e.append(i),"object"==typeof tinyMCE&&"function"==typeof tinyMCE.execCommand&&tinyMCE.execCommand("mceAddEditor",!1,o),n()}))}})),r.hide(),e.after(r),r.fadeIn().addClass(i),t.protip({defaults:{position:"top",size:"small",scheme:"black",classes:"ditty-protip"}}),n(),a.trigger("mtphr_dnt_list_item_added",[r,i])}var o={};e&&t.extend(o,e);var a=t(this);t.protip({defaults:{position:"top",size:"small",scheme:"black",classes:"ditty-protip"}}),a.sortable({handle:".mtphr-dnt-list-heading > .dashicons-menu",items:".mtphr-dnt-list-item",axis:"y",opacity:.7,placeholder:{element:function(e){var i=t(e).innerHeight();return t('<div class="mtphr-dnt-sort-placeholder" style="height:'+i+'px;"></div>')[0]},update:function(){}},helper:function(e,i){var n=i.children(),r=i.clone();return r.children().each((function(e){t(this).width(n.eq(e).width()),t(this).height(n.eq(e).height())})),r},start:function(e,i){var n=t(i.item);if(n.find(".wp-editor-container").length){var r=n.find(".wp-editor-area").attr("id");tinyMCE.execCommand("mceRemoveEditor",!0,r)}},stop:function(e,i){var n=t(i.item);if(n.find(".wp-editor-container").length){var r=n.find(".wp-editor-area").attr("id");tinyMCE.execCommand("mceAddEditor",!0,r)}}}),a.on("click",".mtphr-dnt-list-delete",(function(e){e.preventDefault(),t(this).parents(".mtphr-dnt-list-item").fadeOut((function(){t(this).remove(),n()}))})),a.on("click",".mtphr-dnt-list-add",(function(e){e.preventDefault(),r(t(this).parents(".mtphr-dnt-list-item"))})),a.on("mtphr_dnt_list_add_item",(function(t,e,i){r(e,i)})),n()}))}};t.fn.mtphr_dnt_list=function(t){if(e[t])return e[t].apply(this,Array.prototype.slice.call(arguments,1));if("object"!=typeof t&&t)throw new Error("Method "+t+" does not exist in mtphr_dnt_list");return e.init.apply(this,arguments)}}(jQuery);
|
readme.txt
CHANGED
@@ -72,6 +72,10 @@ The most common cause for an unresponsive ticker (when using scroll or rotate mo
|
|
72 |
|
73 |
== Changelog ==
|
74 |
|
|
|
|
|
|
|
|
|
75 |
= 2.3.5 =
|
76 |
* Javascript updates to scroll functionality
|
77 |
|
@@ -563,4 +567,4 @@ The most common cause for an unresponsive ticker (when using scroll or rotate mo
|
|
563 |
|
564 |
== Upgrade Notice ==
|
565 |
|
566 |
-
Javascript
|
72 |
|
73 |
== Changelog ==
|
74 |
|
75 |
+
= 2.3.6 =
|
76 |
+
* Javascript bug fix
|
77 |
+
* Added scroll pause option for showing first tick on it
|
78 |
+
|
79 |
= 2.3.5 =
|
80 |
* Javascript updates to scroll functionality
|
81 |
|
567 |
|
568 |
== Upgrade Notice ==
|
569 |
|
570 |
+
Javascript bug fix and added scroll pause option for showing first tick on it
|