Version Description
- Javascript updates to scroll functionality
- Admin tick drag order updates
Download this release
Release Info
Developer | metaphorcreations |
Plugin | Ditty News Ticker |
Version | 2.3.4 |
Comparing to | |
See all releases |
Code changes from version 2.3.2 to 2.3.4
- ditty-news-ticker.php +2 -2
- eddsl/EDD_SL_Plugin_Updater.php +177 -52
- eddsl/eddsl.php +14 -18
- inc/static.php +1 -1
- inc/static/css/style-admin.css +17 -21
- inc/static/js/ditty-news-ticker.js +72 -47
- inc/static/js/ditty-news-ticker.min.js +1 -1
- inc/static/js/partials/admin-general.js +1 -1
- inc/static/js/script-admin.min.js +1 -1
- inc/static/sass/style-admin.scss +11 -11
- readme.txt +9 -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.4
|
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.4' );
|
66 |
}
|
67 |
|
68 |
// Plugin Folder Path
|
eddsl/EDD_SL_Plugin_Updater.php
CHANGED
@@ -7,7 +7,7 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
|
7 |
* Allows plugins to use their own update API.
|
8 |
*
|
9 |
* @author Easy Digital Downloads
|
10 |
-
* @version 1.
|
11 |
*/
|
12 |
class EDD_SL_Plugin_Updater {
|
13 |
|
@@ -19,6 +19,8 @@ class EDD_SL_Plugin_Updater {
|
|
19 |
private $wp_override = false;
|
20 |
private $cache_key = '';
|
21 |
|
|
|
|
|
22 |
/**
|
23 |
* Class constructor.
|
24 |
*
|
@@ -40,10 +42,19 @@ class EDD_SL_Plugin_Updater {
|
|
40 |
$this->version = $_api_data['version'];
|
41 |
$this->wp_override = isset( $_api_data['wp_override'] ) ? (bool) $_api_data['wp_override'] : false;
|
42 |
$this->beta = ! empty( $this->api_data['beta'] ) ? true : false;
|
43 |
-
$this->cache_key = md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) );
|
44 |
|
45 |
$edd_plugin_data[ $this->slug ] = $this->api_data;
|
46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
// Set up hooks.
|
48 |
$this->init();
|
49 |
|
@@ -95,29 +106,50 @@ class EDD_SL_Plugin_Updater {
|
|
95 |
return $_transient_data;
|
96 |
}
|
97 |
|
98 |
-
$
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
|
|
105 |
}
|
|
|
|
|
106 |
|
107 |
-
|
108 |
-
|
109 |
-
if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
|
110 |
|
111 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
}
|
114 |
|
115 |
-
|
116 |
-
$
|
|
|
117 |
|
|
|
118 |
}
|
119 |
|
120 |
-
return $
|
121 |
}
|
122 |
|
123 |
/**
|
@@ -153,11 +185,28 @@ class EDD_SL_Plugin_Updater {
|
|
153 |
|
154 |
if ( empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) {
|
155 |
|
156 |
-
$version_info = $this->
|
157 |
|
158 |
if ( false === $version_info ) {
|
159 |
$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug, 'beta' => $this->beta ) );
|
160 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
$this->set_version_info_cache( $version_info );
|
162 |
}
|
163 |
|
@@ -166,12 +215,12 @@ class EDD_SL_Plugin_Updater {
|
|
166 |
}
|
167 |
|
168 |
if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
|
169 |
-
|
170 |
$update_cache->response[ $this->name ] = $version_info;
|
171 |
-
|
|
|
172 |
}
|
173 |
|
174 |
-
$update_cache->last_checked
|
175 |
$update_cache->checked[ $this->name ] = $this->version;
|
176 |
|
177 |
set_site_transient( 'update_plugins', $update_cache );
|
@@ -251,14 +300,13 @@ class EDD_SL_Plugin_Updater {
|
|
251 |
'is_ssl' => is_ssl(),
|
252 |
'fields' => array(
|
253 |
'banners' => array(),
|
254 |
-
'reviews' => false
|
|
|
255 |
)
|
256 |
);
|
257 |
|
258 |
-
$cache_key = 'edd_api_request_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) );
|
259 |
-
|
260 |
// Get the transient where we store the api request for this plugin for 24 hours
|
261 |
-
$edd_api_request_transient = $this->get_cached_version_info(
|
262 |
|
263 |
//If we have no transient-saved value, run the API, set a fresh transient with the API value, and return that value too right now.
|
264 |
if ( empty( $edd_api_request_transient ) ) {
|
@@ -266,7 +314,7 @@ class EDD_SL_Plugin_Updater {
|
|
266 |
$api_response = $this->api_request( 'plugin_information', $to_send );
|
267 |
|
268 |
// Expires in 3 hours
|
269 |
-
$this->set_version_info_cache( $api_response
|
270 |
|
271 |
if ( false !== $api_response ) {
|
272 |
$_data = $api_response;
|
@@ -278,27 +326,52 @@ class EDD_SL_Plugin_Updater {
|
|
278 |
|
279 |
// Convert sections into an associative array, since we're getting an object, but Core expects an array.
|
280 |
if ( isset( $_data->sections ) && ! is_array( $_data->sections ) ) {
|
281 |
-
$
|
282 |
-
foreach ( $_data->sections as $key => $value ) {
|
283 |
-
$new_sections[ $key ] = $value;
|
284 |
-
}
|
285 |
-
|
286 |
-
$_data->sections = $new_sections;
|
287 |
}
|
288 |
|
289 |
// Convert banners into an associative array, since we're getting an object, but Core expects an array.
|
290 |
if ( isset( $_data->banners ) && ! is_array( $_data->banners ) ) {
|
291 |
-
$
|
292 |
-
|
293 |
-
|
294 |
-
|
|
|
|
|
|
|
295 |
|
296 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
297 |
}
|
298 |
|
299 |
return $_data;
|
300 |
}
|
301 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
302 |
/**
|
303 |
* Disable SSL verification in order to prevent download update failures
|
304 |
*
|
@@ -329,15 +402,39 @@ class EDD_SL_Plugin_Updater {
|
|
329 |
*/
|
330 |
private function api_request( $_action, $_data ) {
|
331 |
|
332 |
-
global $wp_version;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
333 |
|
334 |
$data = array_merge( $this->api_data, $_data );
|
335 |
|
336 |
if ( $data['slug'] != $this->slug ) {
|
337 |
-
return;
|
338 |
}
|
339 |
|
340 |
-
if( $this->api_url == trailingslashit (home_url() ) ) {
|
341 |
return false; // Don't allow a plugin to ping itself
|
342 |
}
|
343 |
|
@@ -353,7 +450,6 @@ class EDD_SL_Plugin_Updater {
|
|
353 |
'beta' => ! empty( $data['beta'] ),
|
354 |
);
|
355 |
|
356 |
-
$verify_ssl = $this->verify_ssl();
|
357 |
$request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => $verify_ssl, 'body' => $api_params ) );
|
358 |
|
359 |
if ( ! is_wp_error( $request ) ) {
|
@@ -370,7 +466,11 @@ class EDD_SL_Plugin_Updater {
|
|
370 |
$request->banners = maybe_unserialize( $request->banners );
|
371 |
}
|
372 |
|
373 |
-
if(
|
|
|
|
|
|
|
|
|
374 |
foreach( $request->sections as $key => $section ) {
|
375 |
$request->$key = (array) $section;
|
376 |
}
|
@@ -379,6 +479,9 @@ class EDD_SL_Plugin_Updater {
|
|
379 |
return $request;
|
380 |
}
|
381 |
|
|
|
|
|
|
|
382 |
public function show_changelog() {
|
383 |
|
384 |
global $edd_plugin_data;
|
@@ -400,9 +503,7 @@ class EDD_SL_Plugin_Updater {
|
|
400 |
}
|
401 |
|
402 |
$data = $edd_plugin_data[ $_REQUEST['slug'] ];
|
403 |
-
$
|
404 |
-
$cache_key = md5( 'edd_plugin_' . sanitize_key( $_REQUEST['plugin'] ) . '_' . $beta . '_version_info' );
|
405 |
-
$version_info = $this->get_cached_version_info( $cache_key );
|
406 |
|
407 |
if( false === $version_info ) {
|
408 |
|
@@ -423,7 +524,6 @@ class EDD_SL_Plugin_Updater {
|
|
423 |
$version_info = json_decode( wp_remote_retrieve_body( $request ) );
|
424 |
}
|
425 |
|
426 |
-
|
427 |
if ( ! empty( $version_info ) && isset( $version_info->sections ) ) {
|
428 |
$version_info->sections = maybe_unserialize( $version_info->sections );
|
429 |
} else {
|
@@ -436,17 +536,28 @@ class EDD_SL_Plugin_Updater {
|
|
436 |
}
|
437 |
}
|
438 |
|
439 |
-
$this->set_version_info_cache( $version_info
|
440 |
|
|
|
|
|
441 |
}
|
442 |
|
443 |
-
if
|
444 |
-
|
|
|
|
|
|
|
445 |
}
|
446 |
|
447 |
exit;
|
448 |
}
|
449 |
|
|
|
|
|
|
|
|
|
|
|
|
|
450 |
public function get_cached_version_info( $cache_key = '' ) {
|
451 |
|
452 |
if( empty( $cache_key ) ) {
|
@@ -455,14 +566,26 @@ class EDD_SL_Plugin_Updater {
|
|
455 |
|
456 |
$cache = get_option( $cache_key );
|
457 |
|
458 |
-
if( empty( $cache['timeout'] ) ||
|
459 |
return false; // Cache is expired
|
460 |
}
|
461 |
|
462 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
463 |
|
464 |
}
|
465 |
|
|
|
|
|
|
|
|
|
|
|
|
|
466 |
public function set_version_info_cache( $value = '', $cache_key = '' ) {
|
467 |
|
468 |
if( empty( $cache_key ) ) {
|
@@ -470,12 +593,14 @@ class EDD_SL_Plugin_Updater {
|
|
470 |
}
|
471 |
|
472 |
$data = array(
|
473 |
-
'timeout' => strtotime( '+3 hours',
|
474 |
'value' => json_encode( $value )
|
475 |
);
|
476 |
|
477 |
update_option( $cache_key, $data, 'no' );
|
478 |
|
|
|
|
|
479 |
}
|
480 |
|
481 |
/**
|
@@ -488,4 +613,4 @@ class EDD_SL_Plugin_Updater {
|
|
488 |
return (bool) apply_filters( 'edd_sl_api_request_verify_ssl', true, $this );
|
489 |
}
|
490 |
|
491 |
-
}
|
7 |
* Allows plugins to use their own update API.
|
8 |
*
|
9 |
* @author Easy Digital Downloads
|
10 |
+
* @version 1.8.0
|
11 |
*/
|
12 |
class EDD_SL_Plugin_Updater {
|
13 |
|
19 |
private $wp_override = false;
|
20 |
private $cache_key = '';
|
21 |
|
22 |
+
private $health_check_timeout = 5;
|
23 |
+
|
24 |
/**
|
25 |
* Class constructor.
|
26 |
*
|
42 |
$this->version = $_api_data['version'];
|
43 |
$this->wp_override = isset( $_api_data['wp_override'] ) ? (bool) $_api_data['wp_override'] : false;
|
44 |
$this->beta = ! empty( $this->api_data['beta'] ) ? true : false;
|
45 |
+
$this->cache_key = 'edd_sl_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) );
|
46 |
|
47 |
$edd_plugin_data[ $this->slug ] = $this->api_data;
|
48 |
|
49 |
+
/**
|
50 |
+
* Fires after the $edd_plugin_data is setup.
|
51 |
+
*
|
52 |
+
* @since x.x.x
|
53 |
+
*
|
54 |
+
* @param array $edd_plugin_data Array of EDD SL plugin data.
|
55 |
+
*/
|
56 |
+
do_action( 'post_edd_sl_plugin_updater_setup', $edd_plugin_data );
|
57 |
+
|
58 |
// Set up hooks.
|
59 |
$this->init();
|
60 |
|
106 |
return $_transient_data;
|
107 |
}
|
108 |
|
109 |
+
$current = $this->get_repo_api_data();
|
110 |
+
if ( false !== $current && is_object( $current ) && isset( $current->new_version ) ) {
|
111 |
+
if ( version_compare( $this->version, $current->new_version, '<' ) ) {
|
112 |
+
$_transient_data->response[ $this->name ] = $current;
|
113 |
+
} else {
|
114 |
+
// Populating the no_update information is required to support auto-updates in WordPress 5.5.
|
115 |
+
$_transient_data->no_update[ $this->name ] = $current;
|
116 |
+
}
|
117 |
}
|
118 |
+
$_transient_data->last_checked = time();
|
119 |
+
$_transient_data->checked[ $this->name ] = $this->version;
|
120 |
|
121 |
+
return $_transient_data;
|
122 |
+
}
|
|
|
123 |
|
124 |
+
/**
|
125 |
+
* Get repo API data from store.
|
126 |
+
* Save to cache.
|
127 |
+
*
|
128 |
+
* @return \stdClass
|
129 |
+
*/
|
130 |
+
public function get_repo_api_data() {
|
131 |
+
$version_info = $this->get_cached_version_info();
|
132 |
|
133 |
+
if ( false === $version_info ) {
|
134 |
+
$version_info = $this->api_request(
|
135 |
+
'plugin_latest_version',
|
136 |
+
array(
|
137 |
+
'slug' => $this->slug,
|
138 |
+
'beta' => $this->beta,
|
139 |
+
)
|
140 |
+
);
|
141 |
+
if ( ! $version_info ) {
|
142 |
+
return false;
|
143 |
}
|
144 |
|
145 |
+
// This is required for your plugin to support auto-updates in WordPress 5.5.
|
146 |
+
$version_info->plugin = $this->name;
|
147 |
+
$version_info->id = $this->name;
|
148 |
|
149 |
+
$this->set_version_info_cache( $version_info );
|
150 |
}
|
151 |
|
152 |
+
return $version_info;
|
153 |
}
|
154 |
|
155 |
/**
|
185 |
|
186 |
if ( empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) {
|
187 |
|
188 |
+
$version_info = $this->get_repo_api_data();
|
189 |
|
190 |
if ( false === $version_info ) {
|
191 |
$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug, 'beta' => $this->beta ) );
|
192 |
|
193 |
+
// Since we disabled our filter for the transient, we aren't running our object conversion on banners, sections, or icons. Do this now:
|
194 |
+
if ( isset( $version_info->banners ) && ! is_array( $version_info->banners ) ) {
|
195 |
+
$version_info->banners = $this->convert_object_to_array( $version_info->banners );
|
196 |
+
}
|
197 |
+
|
198 |
+
if ( isset( $version_info->sections ) && ! is_array( $version_info->sections ) ) {
|
199 |
+
$version_info->sections = $this->convert_object_to_array( $version_info->sections );
|
200 |
+
}
|
201 |
+
|
202 |
+
if ( isset( $version_info->icons ) && ! is_array( $version_info->icons ) ) {
|
203 |
+
$version_info->icons = $this->convert_object_to_array( $version_info->icons );
|
204 |
+
}
|
205 |
+
|
206 |
+
if ( isset( $version_info->contributors ) && ! is_array( $version_info->contributors ) ) {
|
207 |
+
$version_info->contributors = $this->convert_object_to_array( $version_info->contributors );
|
208 |
+
}
|
209 |
+
|
210 |
$this->set_version_info_cache( $version_info );
|
211 |
}
|
212 |
|
215 |
}
|
216 |
|
217 |
if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
|
|
|
218 |
$update_cache->response[ $this->name ] = $version_info;
|
219 |
+
} else {
|
220 |
+
$update_cache->no_update[ $this->name ] = $version_info;
|
221 |
}
|
222 |
|
223 |
+
$update_cache->last_checked = time();
|
224 |
$update_cache->checked[ $this->name ] = $this->version;
|
225 |
|
226 |
set_site_transient( 'update_plugins', $update_cache );
|
300 |
'is_ssl' => is_ssl(),
|
301 |
'fields' => array(
|
302 |
'banners' => array(),
|
303 |
+
'reviews' => false,
|
304 |
+
'icons' => array(),
|
305 |
)
|
306 |
);
|
307 |
|
|
|
|
|
308 |
// Get the transient where we store the api request for this plugin for 24 hours
|
309 |
+
$edd_api_request_transient = $this->get_cached_version_info();
|
310 |
|
311 |
//If we have no transient-saved value, run the API, set a fresh transient with the API value, and return that value too right now.
|
312 |
if ( empty( $edd_api_request_transient ) ) {
|
314 |
$api_response = $this->api_request( 'plugin_information', $to_send );
|
315 |
|
316 |
// Expires in 3 hours
|
317 |
+
$this->set_version_info_cache( $api_response );
|
318 |
|
319 |
if ( false !== $api_response ) {
|
320 |
$_data = $api_response;
|
326 |
|
327 |
// Convert sections into an associative array, since we're getting an object, but Core expects an array.
|
328 |
if ( isset( $_data->sections ) && ! is_array( $_data->sections ) ) {
|
329 |
+
$_data->sections = $this->convert_object_to_array( $_data->sections );
|
|
|
|
|
|
|
|
|
|
|
330 |
}
|
331 |
|
332 |
// Convert banners into an associative array, since we're getting an object, but Core expects an array.
|
333 |
if ( isset( $_data->banners ) && ! is_array( $_data->banners ) ) {
|
334 |
+
$_data->banners = $this->convert_object_to_array( $_data->banners );
|
335 |
+
}
|
336 |
+
|
337 |
+
// Convert icons into an associative array, since we're getting an object, but Core expects an array.
|
338 |
+
if ( isset( $_data->icons ) && ! is_array( $_data->icons ) ) {
|
339 |
+
$_data->icons = $this->convert_object_to_array( $_data->icons );
|
340 |
+
}
|
341 |
|
342 |
+
// Convert contributors into an associative array, since we're getting an object, but Core expects an array.
|
343 |
+
if ( isset( $_data->contributors ) && ! is_array( $_data->contributors ) ) {
|
344 |
+
$_data->contributors = $this->convert_object_to_array( $_data->contributors );
|
345 |
+
}
|
346 |
+
|
347 |
+
if( ! isset( $_data->plugin ) ) {
|
348 |
+
$_data->plugin = $this->name;
|
349 |
}
|
350 |
|
351 |
return $_data;
|
352 |
}
|
353 |
|
354 |
+
/**
|
355 |
+
* Convert some objects to arrays when injecting data into the update API
|
356 |
+
*
|
357 |
+
* Some data like sections, banners, and icons are expected to be an associative array, however due to the JSON
|
358 |
+
* decoding, they are objects. This method allows us to pass in the object and return an associative array.
|
359 |
+
*
|
360 |
+
* @since 3.6.5
|
361 |
+
*
|
362 |
+
* @param stdClass $data
|
363 |
+
*
|
364 |
+
* @return array
|
365 |
+
*/
|
366 |
+
private function convert_object_to_array( $data ) {
|
367 |
+
$new_data = array();
|
368 |
+
foreach ( $data as $key => $value ) {
|
369 |
+
$new_data[ $key ] = is_object( $value ) ? $this->convert_object_to_array( $value ) : $value;
|
370 |
+
}
|
371 |
+
|
372 |
+
return $new_data;
|
373 |
+
}
|
374 |
+
|
375 |
/**
|
376 |
* Disable SSL verification in order to prevent download update failures
|
377 |
*
|
402 |
*/
|
403 |
private function api_request( $_action, $_data ) {
|
404 |
|
405 |
+
global $wp_version, $edd_plugin_url_available;
|
406 |
+
|
407 |
+
$verify_ssl = $this->verify_ssl();
|
408 |
+
|
409 |
+
// Do a quick status check on this domain if we haven't already checked it.
|
410 |
+
$store_hash = md5( $this->api_url );
|
411 |
+
if ( ! is_array( $edd_plugin_url_available ) || ! isset( $edd_plugin_url_available[ $store_hash ] ) ) {
|
412 |
+
$test_url_parts = parse_url( $this->api_url );
|
413 |
+
|
414 |
+
$scheme = ! empty( $test_url_parts['scheme'] ) ? $test_url_parts['scheme'] : 'http';
|
415 |
+
$host = ! empty( $test_url_parts['host'] ) ? $test_url_parts['host'] : '';
|
416 |
+
$port = ! empty( $test_url_parts['port'] ) ? ':' . $test_url_parts['port'] : '';
|
417 |
+
|
418 |
+
if ( empty( $host ) ) {
|
419 |
+
$edd_plugin_url_available[ $store_hash ] = false;
|
420 |
+
} else {
|
421 |
+
$test_url = $scheme . '://' . $host . $port;
|
422 |
+
$response = wp_remote_get( $test_url, array( 'timeout' => $this->health_check_timeout, 'sslverify' => $verify_ssl ) );
|
423 |
+
$edd_plugin_url_available[ $store_hash ] = is_wp_error( $response ) ? false : true;
|
424 |
+
}
|
425 |
+
}
|
426 |
+
|
427 |
+
if ( false === $edd_plugin_url_available[ $store_hash ] ) {
|
428 |
+
return false;
|
429 |
+
}
|
430 |
|
431 |
$data = array_merge( $this->api_data, $_data );
|
432 |
|
433 |
if ( $data['slug'] != $this->slug ) {
|
434 |
+
return false;
|
435 |
}
|
436 |
|
437 |
+
if ( $this->api_url == trailingslashit ( home_url() ) ) {
|
438 |
return false; // Don't allow a plugin to ping itself
|
439 |
}
|
440 |
|
450 |
'beta' => ! empty( $data['beta'] ),
|
451 |
);
|
452 |
|
|
|
453 |
$request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => $verify_ssl, 'body' => $api_params ) );
|
454 |
|
455 |
if ( ! is_wp_error( $request ) ) {
|
466 |
$request->banners = maybe_unserialize( $request->banners );
|
467 |
}
|
468 |
|
469 |
+
if ( $request && isset( $request->icons ) ) {
|
470 |
+
$request->icons = maybe_unserialize( $request->icons );
|
471 |
+
}
|
472 |
+
|
473 |
+
if ( ! empty( $request->sections ) ) {
|
474 |
foreach( $request->sections as $key => $section ) {
|
475 |
$request->$key = (array) $section;
|
476 |
}
|
479 |
return $request;
|
480 |
}
|
481 |
|
482 |
+
/**
|
483 |
+
* If available, show the changelog for sites in a multisite install.
|
484 |
+
*/
|
485 |
public function show_changelog() {
|
486 |
|
487 |
global $edd_plugin_data;
|
503 |
}
|
504 |
|
505 |
$data = $edd_plugin_data[ $_REQUEST['slug'] ];
|
506 |
+
$version_info = $this->get_cached_version_info();
|
|
|
|
|
507 |
|
508 |
if( false === $version_info ) {
|
509 |
|
524 |
$version_info = json_decode( wp_remote_retrieve_body( $request ) );
|
525 |
}
|
526 |
|
|
|
527 |
if ( ! empty( $version_info ) && isset( $version_info->sections ) ) {
|
528 |
$version_info->sections = maybe_unserialize( $version_info->sections );
|
529 |
} else {
|
536 |
}
|
537 |
}
|
538 |
|
539 |
+
$this->set_version_info_cache( $version_info );
|
540 |
|
541 |
+
// Delete the unneeded option
|
542 |
+
delete_option( md5( 'edd_plugin_' . sanitize_key( $_REQUEST['plugin'] ) . '_' . $this->beta . '_version_info' ) );
|
543 |
}
|
544 |
|
545 |
+
if ( isset( $version_info->sections ) ) {
|
546 |
+
$sections = $this->convert_object_to_array( $version_info->sections );
|
547 |
+
if ( ! empty( $sections['changelog'] ) ) {
|
548 |
+
echo '<div style="background:#fff;padding:10px;">' . wp_kses_post( $sections['changelog'] ) . '</div>';
|
549 |
+
}
|
550 |
}
|
551 |
|
552 |
exit;
|
553 |
}
|
554 |
|
555 |
+
/**
|
556 |
+
* Gets the plugin's cached version information from the database.
|
557 |
+
*
|
558 |
+
* @param string $cache_key
|
559 |
+
* @return boolean|string
|
560 |
+
*/
|
561 |
public function get_cached_version_info( $cache_key = '' ) {
|
562 |
|
563 |
if( empty( $cache_key ) ) {
|
566 |
|
567 |
$cache = get_option( $cache_key );
|
568 |
|
569 |
+
if( empty( $cache['timeout'] ) || time() > $cache['timeout'] ) {
|
570 |
return false; // Cache is expired
|
571 |
}
|
572 |
|
573 |
+
// We need to turn the icons into an array, thanks to WP Core forcing these into an object at some point.
|
574 |
+
$cache['value'] = json_decode( $cache['value'] );
|
575 |
+
if ( ! empty( $cache['value']->icons ) ) {
|
576 |
+
$cache['value']->icons = (array) $cache['value']->icons;
|
577 |
+
}
|
578 |
+
|
579 |
+
return $cache['value'];
|
580 |
|
581 |
}
|
582 |
|
583 |
+
/**
|
584 |
+
* Adds the plugin version information to the database.
|
585 |
+
*
|
586 |
+
* @param string $value
|
587 |
+
* @param string $cache_key
|
588 |
+
*/
|
589 |
public function set_version_info_cache( $value = '', $cache_key = '' ) {
|
590 |
|
591 |
if( empty( $cache_key ) ) {
|
593 |
}
|
594 |
|
595 |
$data = array(
|
596 |
+
'timeout' => strtotime( '+3 hours', time() ),
|
597 |
'value' => json_encode( $value )
|
598 |
);
|
599 |
|
600 |
update_option( $cache_key, $data, 'no' );
|
601 |
|
602 |
+
// Delete the duplicate option
|
603 |
+
delete_option( 'edd_api_request_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) ) );
|
604 |
}
|
605 |
|
606 |
/**
|
613 |
return (bool) apply_filters( 'edd_sl_api_request_verify_ssl', true, $this );
|
614 |
}
|
615 |
|
616 |
+
}
|
eddsl/eddsl.php
CHANGED
@@ -110,10 +110,11 @@ function mtphr_dnt_plugin_updater() {
|
|
110 |
|
111 |
// setup the updater
|
112 |
$edd_updater = new EDD_SL_Plugin_Updater( MTPHR_DNT_STORE_URL, $data['path'], array(
|
113 |
-
'version' => $data['version'],
|
114 |
-
'license' => $license_key,
|
115 |
-
'
|
116 |
-
'
|
|
|
117 |
)
|
118 |
);
|
119 |
|
@@ -699,21 +700,16 @@ function mtphr_dnt_license_bug_ajax() {
|
|
699 |
<script>
|
700 |
jQuery(document).ready(function($){
|
701 |
|
702 |
-
$('#ditty-news-ticker-license-notice').
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
};
|
710 |
-
|
711 |
-
jQuery.post(ajaxurl,data,function(response){});
|
712 |
-
|
713 |
-
}
|
714 |
});
|
715 |
|
716 |
-
$('.ditty-news-ticker-license-deactivate'
|
717 |
|
718 |
e.preventDefault();
|
719 |
var $container = $(this).parent(),
|
@@ -742,7 +738,7 @@ function mtphr_dnt_license_bug_ajax() {
|
|
742 |
}, 'json');
|
743 |
});
|
744 |
|
745 |
-
$('.ditty-news-ticker-license-activate'
|
746 |
|
747 |
e.preventDefault();
|
748 |
|
110 |
|
111 |
// setup the updater
|
112 |
$edd_updater = new EDD_SL_Plugin_Updater( MTPHR_DNT_STORE_URL, $data['path'], array(
|
113 |
+
'version' => $data['version'], // current version number
|
114 |
+
'license' => $license_key, // license key (used get_option above to retrieve from DB)
|
115 |
+
'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : null, // name of this plugin
|
116 |
+
'item_name' => $data['item_name'], // name of this plugin
|
117 |
+
'author' => isset($data['author']) ? $data['author'] : 'Metaphor Creations' // author of this plugin
|
118 |
)
|
119 |
);
|
120 |
|
700 |
<script>
|
701 |
jQuery(document).ready(function($){
|
702 |
|
703 |
+
$( '#ditty-news-ticker-license-notice' ).on( 'click', '.notice-dismiss', function(e){
|
704 |
+
var data = {
|
705 |
+
action:'mtphr_dnt_license_bug_dismiss',
|
706 |
+
slugs:$(this).data('slugs'),
|
707 |
+
security:'<?php echo wp_create_nonce( 'ditty-news-ticker' ); ?>'
|
708 |
+
};
|
709 |
+
jQuery.post(ajaxurl,data,function(response){});
|
|
|
|
|
|
|
|
|
|
|
710 |
});
|
711 |
|
712 |
+
$('#wpbody-content').on( 'click', '.ditty-news-ticker-license-deactivate', function(e){
|
713 |
|
714 |
e.preventDefault();
|
715 |
var $container = $(this).parent(),
|
738 |
}, 'json');
|
739 |
});
|
740 |
|
741 |
+
$('#wpbody-content').on( 'click', '.ditty-news-ticker-license-activate', function(e){
|
742 |
|
743 |
e.preventDefault();
|
744 |
|
inc/static.php
CHANGED
@@ -40,7 +40,7 @@ function mtphr_dnt_scripts( $hook ) {
|
|
40 |
wp_enqueue_style( 'ditty-news-ticker-font', plugins_url('ditty-news-ticker/inc/static/libs/fontastic/styles.css'), false, MTPHR_DNT_VERSION );
|
41 |
|
42 |
// Load the plugin css
|
43 |
-
wp_enqueue_style( 'ditty-news-ticker', plugins_url('ditty-news-ticker/inc/static/css/style-admin.css'), array('dashicons'),
|
44 |
|
45 |
} else {
|
46 |
|
40 |
wp_enqueue_style( 'ditty-news-ticker-font', plugins_url('ditty-news-ticker/inc/static/libs/fontastic/styles.css'), false, MTPHR_DNT_VERSION );
|
41 |
|
42 |
// Load the plugin css
|
43 |
+
wp_enqueue_style( 'ditty-news-ticker', plugins_url('ditty-news-ticker/inc/static/css/style-admin.css'), array('dashicons'), filemtime( MTPHR_DNT_DIR.'inc/static/css/style-admin.css' ) );
|
44 |
|
45 |
} else {
|
46 |
|
inc/static/css/style-admin.css
CHANGED
@@ -125,8 +125,7 @@
|
|
125 |
background: gray;
|
126 |
margin: 2px 0;
|
127 |
box-shadow: none;
|
128 |
-
|
129 |
-
transition: background-color 0.25s ease, border-color 0.25s ease; }
|
130 |
#mtphr-dnt-code-copy .button:hover {
|
131 |
background-color: #999999; }
|
132 |
#mtphr-dnt-code-copy .button:hover i {
|
@@ -206,8 +205,6 @@
|
|
206 |
background: #FFF;
|
207 |
border: 1px solid #dfdfdf;
|
208 |
padding: 3px 24px 3px 3px;
|
209 |
-
-webkit-border-radius: 3px;
|
210 |
-
-moz-border-radius: 3px;
|
211 |
border-radius: 3px; }
|
212 |
|
213 |
.mtphr-dnt-single-image img {
|
@@ -267,8 +264,7 @@
|
|
267 |
padding: 5px 10px;
|
268 |
margin: -10px -10px 10px;
|
269 |
cursor: pointer;
|
270 |
-
|
271 |
-
transition: background-color 0.25s ease, border-radius 0.25s ease; }
|
272 |
.mtphr-dnt-list-heading:active, .mtphr-dnt-list-heading:focus {
|
273 |
box-shadow: none;
|
274 |
outline: none; }
|
@@ -278,11 +274,16 @@
|
|
278 |
order: 10; }
|
279 |
|
280 |
.mtphr-dnt-list-buttons {
|
|
|
|
|
|
|
|
|
|
|
|
|
281 |
margin: -5px -10px;
|
282 |
margin-left: auto;
|
283 |
order: 20; }
|
284 |
.mtphr-dnt-list-buttons a {
|
285 |
-
float: left;
|
286 |
display: block;
|
287 |
width: 30px;
|
288 |
height: 30px;
|
@@ -363,8 +364,7 @@
|
|
363 |
padding: 10px;
|
364 |
border-radius: 5px;
|
365 |
cursor: pointer;
|
366 |
-
|
367 |
-
transition: background-color 0.25s ease, border-radius 0.25s ease; }
|
368 |
.mtphr-dnt-sort-heading:active, .mtphr-dnt-sort-heading:focus {
|
369 |
box-shadow: none;
|
370 |
outline: none; }
|
@@ -388,8 +388,7 @@
|
|
388 |
background: #FFF;
|
389 |
border-radius: 12px;
|
390 |
margin: -2px 8px -3px 0;
|
391 |
-
|
392 |
-
transition: color 0.25s ease; }
|
393 |
.mtphr-dnt-sort-heading .dashicons-menu {
|
394 |
color: #333333;
|
395 |
margin-right: 8px; }
|
@@ -498,13 +497,15 @@
|
|
498 |
display: block; }
|
499 |
|
500 |
.wp-core-ui #mtphr-dnt-settings-select .mtphr-dnt-button {
|
|
|
|
|
|
|
501 |
color: #FFF;
|
502 |
border-color: #333333;
|
503 |
background: gray;
|
504 |
margin: 2px 0;
|
505 |
box-shadow: none;
|
506 |
-
|
507 |
-
transition: background-color 0.25s ease, border-color 0.25s ease; }
|
508 |
.wp-core-ui #mtphr-dnt-settings-select .mtphr-dnt-button:hover {
|
509 |
background-color: #999999; }
|
510 |
.wp-core-ui #mtphr-dnt-settings-select .mtphr-dnt-button:hover i {
|
@@ -528,10 +529,9 @@
|
|
528 |
.wp-core-ui #mtphr-dnt-settings-select .mtphr-dnt-button i {
|
529 |
font-size: 16px;
|
530 |
line-height: 16px;
|
531 |
-
margin:
|
532 |
opacity: .5;
|
533 |
-
|
534 |
-
transition: opacity 0.25s ease; }
|
535 |
.wp-core-ui #mtphr-dnt-settings-select .mtphr-dnt-button i:before {
|
536 |
vertical-align: middle; }
|
537 |
.wp-core-ui #mtphr-dnt-settings-select .mtphr-dnt-button i.fontastic {
|
@@ -539,7 +539,7 @@
|
|
539 |
vertical-align: top;
|
540 |
font-size: 14px;
|
541 |
line-height: 14px;
|
542 |
-
margin-top:
|
543 |
|
544 |
.mtphr-dnt-metabox-toggle {
|
545 |
padding-bottom: 20px; }
|
@@ -622,10 +622,6 @@
|
|
622 |
padding-left: 58px; } }
|
623 |
|
624 |
@media (max-width: 782px) {
|
625 |
-
.wp-core-ui #mtphr-dnt-settings-select .button i {
|
626 |
-
margin-top: -1px; }
|
627 |
-
.wp-core-ui #mtphr-dnt-settings-select .button i.fontastic {
|
628 |
-
margin-top: 2px; }
|
629 |
.mtphr-dnt-metabox input, .mtphr-dnt-metabox textarea {
|
630 |
font-size: 14px; }
|
631 |
.mtphr-dnt-metabox input[type="text"],
|
125 |
background: gray;
|
126 |
margin: 2px 0;
|
127 |
box-shadow: none;
|
128 |
+
transition: background-color .25s ease, border-color .25s ease; }
|
|
|
129 |
#mtphr-dnt-code-copy .button:hover {
|
130 |
background-color: #999999; }
|
131 |
#mtphr-dnt-code-copy .button:hover i {
|
205 |
background: #FFF;
|
206 |
border: 1px solid #dfdfdf;
|
207 |
padding: 3px 24px 3px 3px;
|
|
|
|
|
208 |
border-radius: 3px; }
|
209 |
|
210 |
.mtphr-dnt-single-image img {
|
264 |
padding: 5px 10px;
|
265 |
margin: -10px -10px 10px;
|
266 |
cursor: pointer;
|
267 |
+
transition: background-color .25s ease, border-radius .25s ease; }
|
|
|
268 |
.mtphr-dnt-list-heading:active, .mtphr-dnt-list-heading:focus {
|
269 |
box-shadow: none;
|
270 |
outline: none; }
|
274 |
order: 10; }
|
275 |
|
276 |
.mtphr-dnt-list-buttons {
|
277 |
+
position: relative;
|
278 |
+
z-index: 999;
|
279 |
+
display: flex;
|
280 |
+
flex-direction: row;
|
281 |
+
align-items: stretch;
|
282 |
+
justify-content: flex-start;
|
283 |
margin: -5px -10px;
|
284 |
margin-left: auto;
|
285 |
order: 20; }
|
286 |
.mtphr-dnt-list-buttons a {
|
|
|
287 |
display: block;
|
288 |
width: 30px;
|
289 |
height: 30px;
|
364 |
padding: 10px;
|
365 |
border-radius: 5px;
|
366 |
cursor: pointer;
|
367 |
+
transition: background-color .25s ease, border-radius .25s ease; }
|
|
|
368 |
.mtphr-dnt-sort-heading:active, .mtphr-dnt-sort-heading:focus {
|
369 |
box-shadow: none;
|
370 |
outline: none; }
|
388 |
background: #FFF;
|
389 |
border-radius: 12px;
|
390 |
margin: -2px 8px -3px 0;
|
391 |
+
transition: color .25s ease; }
|
|
|
392 |
.mtphr-dnt-sort-heading .dashicons-menu {
|
393 |
color: #333333;
|
394 |
margin-right: 8px; }
|
497 |
display: block; }
|
498 |
|
499 |
.wp-core-ui #mtphr-dnt-settings-select .mtphr-dnt-button {
|
500 |
+
min-height: 0 !important;
|
501 |
+
font-size: 13px !important;
|
502 |
+
line-height: 2.15384615 !important;
|
503 |
color: #FFF;
|
504 |
border-color: #333333;
|
505 |
background: gray;
|
506 |
margin: 2px 0;
|
507 |
box-shadow: none;
|
508 |
+
transition: background-color .25s ease, border-color .25s ease; }
|
|
|
509 |
.wp-core-ui #mtphr-dnt-settings-select .mtphr-dnt-button:hover {
|
510 |
background-color: #999999; }
|
511 |
.wp-core-ui #mtphr-dnt-settings-select .mtphr-dnt-button:hover i {
|
529 |
.wp-core-ui #mtphr-dnt-settings-select .mtphr-dnt-button i {
|
530 |
font-size: 16px;
|
531 |
line-height: 16px;
|
532 |
+
margin: 4px 0 0 -5px;
|
533 |
opacity: .5;
|
534 |
+
transition: opacity .25s ease; }
|
|
|
535 |
.wp-core-ui #mtphr-dnt-settings-select .mtphr-dnt-button i:before {
|
536 |
vertical-align: middle; }
|
537 |
.wp-core-ui #mtphr-dnt-settings-select .mtphr-dnt-button i.fontastic {
|
539 |
vertical-align: top;
|
540 |
font-size: 14px;
|
541 |
line-height: 14px;
|
542 |
+
margin-top: 7px; }
|
543 |
|
544 |
.mtphr-dnt-metabox-toggle {
|
545 |
padding-bottom: 20px; }
|
622 |
padding-left: 58px; } }
|
623 |
|
624 |
@media (max-width: 782px) {
|
|
|
|
|
|
|
|
|
625 |
.mtphr-dnt-metabox input, .mtphr-dnt-metabox textarea {
|
626 |
font-size: 14px; }
|
627 |
.mtphr-dnt-metabox input[type="text"],
|
inc/static/js/ditty-news-ticker.js
CHANGED
@@ -69,10 +69,14 @@
|
|
69 |
ticker_height = 0,
|
70 |
ticks = [],
|
71 |
ticker_scroll,
|
|
|
72 |
ticker_scroll_resize = true,
|
73 |
-
|
74 |
rotate_adjustment = settings.rotate_type,
|
75 |
-
after_change_timeout
|
|
|
|
|
|
|
76 |
|
77 |
// Add the vars
|
78 |
$ticker.data('ditty:vars', vars);
|
@@ -212,11 +216,13 @@
|
|
212 |
}
|
213 |
|
214 |
function mtphr_dnt_scroll_pause() {
|
215 |
-
|
|
|
216 |
}
|
217 |
|
218 |
function mtphr_dnt_scroll_play() {
|
219 |
-
|
|
|
220 |
}
|
221 |
|
222 |
/**
|
@@ -227,45 +233,48 @@
|
|
227 |
function mtphr_dnt_scroll_loop() {
|
228 |
|
229 |
// Start the ticker timer
|
230 |
-
clearInterval( ticker_scroll );
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
pos
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
pos = (settings.scroll_direction === 'up') ? mtphr_dnt_scroll_up(i) : mtphr_dnt_scroll_down(i);
|
254 |
-
if( pos === 'reset' ) {
|
255 |
-
pos = ticks[i][0].reset;
|
256 |
-
ticks[i][0].headline.css('opacity', 0);
|
257 |
} else {
|
258 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
259 |
}
|
260 |
-
|
261 |
-
|
262 |
-
} );
|
263 |
}
|
264 |
-
|
265 |
-
ticks[i][0].position = pos;
|
266 |
}
|
267 |
}
|
268 |
-
|
|
|
269 |
}
|
270 |
|
271 |
/**
|
@@ -276,7 +285,7 @@
|
|
276 |
function mtphr_dnt_scroll_left( i ) {
|
277 |
|
278 |
// Find the new position
|
279 |
-
var pos = parseFloat( ticks[i][0].position - ( settings.scroll_speed *
|
280 |
|
281 |
// Reset the tick if off the screen
|
282 |
if( pos < -(ticks[i][0].headline.width()+settings.offset) ) {
|
@@ -296,7 +305,7 @@
|
|
296 |
function mtphr_dnt_scroll_right( i ) {
|
297 |
|
298 |
// Find the new position
|
299 |
-
var pos = parseFloat( ticks[i][0].position + ( settings.scroll_speed *
|
300 |
|
301 |
// Reset the tick if off the screen
|
302 |
if( pos > ticker_width+settings.offset ) {
|
@@ -316,7 +325,7 @@
|
|
316 |
function mtphr_dnt_scroll_up( i ) {
|
317 |
|
318 |
// Find the new position
|
319 |
-
var pos = parseFloat( ticks[i][0].position - ( settings.scroll_speed *
|
320 |
|
321 |
// Reset the tick if off the screen
|
322 |
if( pos < -(ticks[i][0].headline.height()+settings.offset) ) {
|
@@ -336,7 +345,7 @@
|
|
336 |
function mtphr_dnt_scroll_down( i ) {
|
337 |
|
338 |
// Find the new position
|
339 |
-
var pos = parseFloat( ticks[i][0].position + ( settings.scroll_speed *
|
340 |
|
341 |
// Reset the tick if off the screen
|
342 |
if( pos > ticker_height+settings.offset ) {
|
@@ -477,7 +486,12 @@
|
|
477 |
if( ticks[i] ) {
|
478 |
|
479 |
$tick = ticks[i][0].headline;
|
480 |
-
|
|
|
|
|
|
|
|
|
|
|
481 |
switch( settings.scroll_direction ) {
|
482 |
case 'left':
|
483 |
position = ticker_width+settings.offset;
|
@@ -511,6 +525,13 @@
|
|
511 |
ticks[i][0].position = position;
|
512 |
ticks[i][0].reset = position;
|
513 |
ticks[i][0].visible = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
514 |
}
|
515 |
}
|
516 |
|
@@ -586,7 +607,7 @@
|
|
586 |
}
|
587 |
|
588 |
function mtphr_dnt_rotator_pause() {
|
589 |
-
clearInterval(
|
590 |
}
|
591 |
|
592 |
|
@@ -662,7 +683,7 @@
|
|
662 |
|
663 |
// Start the ticker timer
|
664 |
mtphr_dnt_rotator_pause();
|
665 |
-
|
666 |
|
667 |
// Find the new tick
|
668 |
var new_tick = parseInt(vars.current_tick + 1);
|
@@ -1444,14 +1465,18 @@
|
|
1444 |
|
1445 |
if( $container.width() === 0 ) {
|
1446 |
|
1447 |
-
var
|
|
|
1448 |
|
1449 |
if( $container.width() > 10 ) {
|
1450 |
-
|
1451 |
ticker_width = $ticker.outerWidth(true);
|
1452 |
mtphr_dnt_init();
|
1453 |
}
|
1454 |
|
|
|
|
|
|
|
1455 |
}, 100 );
|
1456 |
|
1457 |
} else {
|
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 |
+
scroll_interval = 10,
|
78 |
+
scroll_percent = 0.1;
|
79 |
+
|
80 |
|
81 |
// Add the vars
|
82 |
$ticker.data('ditty:vars', vars);
|
216 |
}
|
217 |
|
218 |
function mtphr_dnt_scroll_pause() {
|
219 |
+
ticker_paused = true;
|
220 |
+
//clearInterval( ticker_scroll );
|
221 |
}
|
222 |
|
223 |
function mtphr_dnt_scroll_play() {
|
224 |
+
ticker_paused = false;
|
225 |
+
//mtphr_dnt_scroll_loop();
|
226 |
}
|
227 |
|
228 |
/**
|
233 |
function mtphr_dnt_scroll_loop() {
|
234 |
|
235 |
// Start the ticker timer
|
236 |
+
//clearInterval( ticker_scroll );
|
237 |
+
setTimeout( function dnt_scroll_run() {
|
238 |
+
|
239 |
+
if ( ! ticker_paused ) {
|
240 |
+
for( var i=0; i < vars.tick_count; i++ ) {
|
241 |
+
|
242 |
+
if( ticks[i][0].visible === true ) {
|
243 |
+
|
244 |
+
var pos = 'reset';
|
245 |
+
|
246 |
+
if( settings.scroll_direction === 'left' || settings.scroll_direction === 'right' ) {
|
247 |
+
|
248 |
+
pos = (settings.scroll_direction === 'left') ? mtphr_dnt_scroll_left(i) : mtphr_dnt_scroll_right(i);
|
249 |
+
if( pos === 'reset' ) {
|
250 |
+
pos = ticks[i][0].reset;
|
251 |
+
ticks[i][0].headline.css('opacity', 0);
|
252 |
+
} else {
|
253 |
+
ticks[i][0].headline.css('opacity', 1);
|
254 |
+
}
|
255 |
+
ticks[i][0].headline.css( {
|
256 |
+
transform: 'translateX( ' + pos + 'px )',
|
257 |
+
} );
|
|
|
|
|
|
|
|
|
|
|
258 |
} else {
|
259 |
+
|
260 |
+
pos = (settings.scroll_direction === 'up') ? mtphr_dnt_scroll_up(i) : mtphr_dnt_scroll_down(i);
|
261 |
+
if( pos === 'reset' ) {
|
262 |
+
pos = ticks[i][0].reset;
|
263 |
+
ticks[i][0].headline.css('opacity', 0);
|
264 |
+
} else {
|
265 |
+
ticks[i][0].headline.css('opacity', 1);
|
266 |
+
}
|
267 |
+
ticks[i][0].headline.css( {
|
268 |
+
transform: 'translateY( ' + pos + 'px )',
|
269 |
+
} );
|
270 |
}
|
271 |
+
|
272 |
+
ticks[i][0].position = pos;
|
|
|
273 |
}
|
|
|
|
|
274 |
}
|
275 |
}
|
276 |
+
setTimeout( dnt_scroll_run, scroll_interval );
|
277 |
+
}, scroll_interval );
|
278 |
}
|
279 |
|
280 |
/**
|
285 |
function mtphr_dnt_scroll_left( i ) {
|
286 |
|
287 |
// Find the new position
|
288 |
+
var pos = parseFloat( ticks[i][0].position - ( settings.scroll_speed * scroll_percent ) );
|
289 |
|
290 |
// Reset the tick if off the screen
|
291 |
if( pos < -(ticks[i][0].headline.width()+settings.offset) ) {
|
305 |
function mtphr_dnt_scroll_right( i ) {
|
306 |
|
307 |
// Find the new position
|
308 |
+
var pos = parseFloat( ticks[i][0].position + ( settings.scroll_speed * scroll_percent ) );
|
309 |
|
310 |
// Reset the tick if off the screen
|
311 |
if( pos > ticker_width+settings.offset ) {
|
325 |
function mtphr_dnt_scroll_up( i ) {
|
326 |
|
327 |
// Find the new position
|
328 |
+
var pos = parseFloat( ticks[i][0].position - ( settings.scroll_speed * scroll_percent ) );
|
329 |
|
330 |
// Reset the tick if off the screen
|
331 |
if( pos < -(ticks[i][0].headline.height()+settings.offset) ) {
|
345 |
function mtphr_dnt_scroll_down( i ) {
|
346 |
|
347 |
// Find the new position
|
348 |
+
var pos = parseFloat( ticks[i][0].position + ( settings.scroll_speed * scroll_percent ) );
|
349 |
|
350 |
// Reset the tick if off the screen
|
351 |
if( pos > ticker_height+settings.offset ) {
|
486 |
if( ticks[i] ) {
|
487 |
|
488 |
$tick = ticks[i][0].headline;
|
489 |
+
/*
|
490 |
+
$tick.css( {
|
491 |
+
transition : 'none',
|
492 |
+
} );
|
493 |
+
*/
|
494 |
+
|
495 |
switch( settings.scroll_direction ) {
|
496 |
case 'left':
|
497 |
position = ticker_width+settings.offset;
|
525 |
ticks[i][0].position = position;
|
526 |
ticks[i][0].reset = position;
|
527 |
ticks[i][0].visible = false;
|
528 |
+
|
529 |
+
$tick = ticks[i][0].headline;
|
530 |
+
/*
|
531 |
+
$tick.css( {
|
532 |
+
transition : 'transform ' + scroll_percent + 's linear',
|
533 |
+
} );
|
534 |
+
*/
|
535 |
}
|
536 |
}
|
537 |
|
607 |
}
|
608 |
|
609 |
function mtphr_dnt_rotator_pause() {
|
610 |
+
clearInterval( rotator_delay );
|
611 |
}
|
612 |
|
613 |
|
683 |
|
684 |
// Start the ticker timer
|
685 |
mtphr_dnt_rotator_pause();
|
686 |
+
rotator_delay = setInterval( function() {
|
687 |
|
688 |
// Find the new tick
|
689 |
var new_tick = parseInt(vars.current_tick + 1);
|
1465 |
|
1466 |
if( $container.width() === 0 ) {
|
1467 |
|
1468 |
+
var loop_mtphr_dnt_init_timer = true;
|
1469 |
+
setTimeout( function dnt_init_check() {
|
1470 |
|
1471 |
if( $container.width() > 10 ) {
|
1472 |
+
loop_mtphr_dnt_init_timer = false;
|
1473 |
ticker_width = $ticker.outerWidth(true);
|
1474 |
mtphr_dnt_init();
|
1475 |
}
|
1476 |
|
1477 |
+
if ( loop_mtphr_dnt_init_timer ) {
|
1478 |
+
setTimeout( dnt_init_check, 100 );
|
1479 |
+
}
|
1480 |
}, 100 );
|
1481 |
|
1482 |
} else {
|
inc/static/js/ditty-news-ticker.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(t){var e={init:function(e){return this.each((function(){function r(){P.tick_count=S.find(".mtphr-dnt-tick").length,P.tick_count>0&&("scroll"===N.type?i():"rotate"===N.type&&m()),N.after_load.call(R,S),R.trigger("mtphr_dnt_after_load_single",[P,rt]),t("body").trigger("mtphr_dnt_after_load",[R,P,rt])}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 i(){var e=S.find(".mtphr-dnt-tick:first");if(e.attr("style")){var r,i=e.attr("style").split("width:");it=!(i.length>1)}rt=[],S.find("img").length?S.imagesLoaded((function(){n(),S.find(".mtphr-dnt-tick").each((function(){t(this).show();var e=[{headline:t(this)}];rt.push(e)})),g(),o()})):(n(),S.find(".mtphr-dnt-tick").each((function(){t(this).show();var e=[{headline:t(this)}];rt.push(e)})),g(),o()),S.on({mouseenter:function(){N.scroll_pause&&s()},mouseleave:function(){N.scroll_pause&&!P.paused&&a()}})}function s(){clearInterval(nt)}function a(){o()}function o(){clearInterval(nt),nt=setInterval((function(){for(var t=0;t<P.tick_count;t++)if(!0===rt[t][0].visible){var e="reset";"left"===N.scroll_direction||"right"===N.scroll_direction?("reset"===(e="left"===N.scroll_direction?c(t):p(t))?(e=rt[t][0].reset,rt[t][0].headline.css("opacity",0)):rt[t][0].headline.css("opacity",1),rt[t][0].headline.css({transform:"translateX( "+e+"px )"})):("reset"===(e="up"===N.scroll_direction?l(t):_(t))?(e=rt[t][0].reset,rt[t][0].headline.css("opacity",0)):rt[t][0].headline.css("opacity",1),rt[t][0].headline.css({transform:"translateY( "+e+"px )"})),rt[t][0].position=e}}),1)}function c(t){var e=parseFloat(rt[t][0].position-.05*N.scroll_speed);return e<-(rt[t][0].headline.width()+N.offset)?e=f(t):e<parseFloat(tt-rt[t][0].headline.width()-N.scroll_spacing)&&u(t),e}function p(t){var e=parseFloat(rt[t][0].position+.05*N.scroll_speed);return e>tt+N.offset?e=f(t):e>N.scroll_spacing&&u(t),e}function l(t){var e=parseFloat(rt[t][0].position-.05*N.scroll_speed);return e<-(rt[t][0].headline.height()+N.offset)?e=f(t):e<et-rt[t][0].headline.height()-N.scroll_spacing&&u(t),e}function _(t){var e=parseFloat(rt[t][0].position+.05*N.scroll_speed);return e>et+N.offset?e=f(t):e>N.scroll_spacing&&u(t),e}function f(e){return P.tick_count>1&&(rt[e][0].visible=!1),P.tick_count===e+1&&(R.trigger("mtphr_dnt_scroll_complete",[P,rt]),t("body").trigger("mtphr_dnt_scroll_complete",[R,P,rt])),"reset"}function d(t){!1===rt[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 u(t){t===P.tick_count-1?N.scroll_loop&&(d(0),rt[0][0].visible=!0):(d(parseInt(t+1)),rt[t+1][0].visible=!0)}function h(){for(var t=0;t<P.tick_count;t++){var e,r=rt[t][0].headline;switch(N.scroll_direction){case"left":e=tt+N.offset,!1===rt[t][0].visible&&r.css("transform","translateX( "+e+"px )");break;case"right":e=parseInt("-"+(r.width()+N.offset)),!1===rt[t][0].visible&&r.css("transform","translateX( "+e+"px )");break;case"up":it&&r.css("width",tt),e=parseInt(et+N.offset),!1===rt[t][0].visible&&r.css("transform","translateY( "+e+"px )");break;case"down":it&&r.css("width",tt),e=parseInt("-"+(r.height()+N.offset)),!1===rt[t][0].visible&&r.css("transform","translateY( "+e+"px )");break}rt[t][0].width=r.width(),rt[t][0].height=r.height(),!1===rt[t][0].visible&&(rt[t][0].position=e),rt[t][0].reset=e}}function g(){for(var t,e,r=0;r<P.tick_count;r++)if(rt[r]){switch(e=rt[r][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":it&&e.css("width",tt),t=parseInt(et+N.offset),e.css("transform","translateY( "+t+"px )");break;case"down":it&&e.css("width",tt),t=parseInt("-"+(e.height()+N.offset)),e.css("transform","translateY( "+t+"px )");break}rt[r][0].width=e.width(),rt[r][0].height=e.height(),rt[r][0].position=t,rt[r][0].reset=t,rt[r][0].visible=!1}if(P.current_tick=0,rt[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),r=0;r<P.tick_count;r++)switch(e=rt[r][0].headline,N.scroll_direction){case"left":t<tt&&(e.css("transform","translateX( "+t+"px )"),rt[r][0].position=t,rt[r][0].visible=!0,t=t+rt[r][0].width+N.scroll_spacing);break;case"right":t>0&&(t-=rt[r][0].width,e.css("transform","translateX( "+t+"px )"),rt[r][0].position=t,rt[r][0].visible=!0,t-=N.scroll_spacing);break;case"up":t<et&&(e.css("transform","translateY( "+t+"px )"),rt[r][0].position=t,rt[r][0].visible=!0,t=t+rt[r][0].height+N.scroll_spacing);break;case"down":t>0&&(e.css("transform","translateY( "+t+"px )"),e.stop(!0,!0).css("top",t+"px"),rt[r][0].position=t,rt[r][0].visible=!0,t-=N.scroll_spacing);break}}function v(){y()}function k(){clearInterval(st)}function m(){switch(S.find(".mtphr-dnt-tick").each((function(){rt.push(t(this)),t(this).imagesLoaded((function(){F()}))})),F(),S.find(".mtphr-dnt-tick").show(),N.rotate_type){case"fade":X(S,rt,parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_left":D(S,rt,parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_right":W(S,rt,parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_down":O(S,rt,parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_up":M(S,rt,parseInt(100*N.rotate_speed),N.rotate_ease);break}w(0),N.auto_rotate&&v(),S.on({mouseenter:function(){N.auto_rotate&&N.rotate_pause&&!P.running&&k()},mouseleave:function(){N.auto_rotate&&N.rotate_pause&&!P.running&&!P.paused&&v()}})}function y(){k(),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&&k(),P.next_tick=e,N.before_change.call(R,S),R.trigger("mtphr_dnt_before_change_single",[P,rt]),t("body").trigger("mtphr_dnt_before_change",[R,P,rt]),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,rt]),t("body").trigger("mtphr_dnt_after_change",[R,P,rt]),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":Y(S,t(rt[e]),t(rt[P.current_tick]),parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_left":E(S,t(rt[e]),t(rt[P.current_tick]),parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_right":z(S,t(rt[e]),t(rt[P.current_tick]),parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_down":T(S,t(rt[e]),t(rt[P.current_tick]),parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_up":Q(S,t(rt[e]),t(rt[P.current_tick]),parseInt(100*N.rotate_speed),N.rotate_ease);break}}function I(e){switch(at){case"fade":C(S,t(rt[P.current_tick]),t(rt[e]),parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_left":L(S,t(rt[P.current_tick]),t(rt[e]),parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_right":j(S,t(rt[P.current_tick]),t(rt[e]),parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_down":A(S,t(rt[P.current_tick]),t(rt[e]),parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_up":q(S,t(rt[P.current_tick]),t(rt[e]),parseInt(100*N.rotate_speed),N.rotate_ease);break}}function F(){for(var e=0;e<P.tick_count;e++)t(rt[e]).width(tt+"px"),P.current_tick!==e&&t(rt[e]).css({left:parseFloat(tt+N.offset)+"px"});var r=t(rt[P.current_tick]).height();S.stop().css("height",r+"px")}function X(t,e){var r=e[0],n=r.height();t.css("height",n+"px"),r.css({opacity:1,left:"auto"})}function Y(t,e,r,n,i){e.css({opacity:0,left:"auto"}),e.stop().animate({opacity:1},n,i);var s=e.height();t.stop().animate({height:s+"px"},n,i)}function C(e,r,n,i,s){r.stop().animate({opacity:0},i,s,(function(){t(this).css({left:parseFloat(tt+N.offset)+"px"}),r.remove(),e.append(r)}))}function D(t,e){var r=e[0],n=r.height();t.css("height",n+"px"),r.css({opacity:1,left:0})}function E(t,e,r,n,i){var s=e.height();e.css({opacity:1,left:parseFloat(tt+N.offset)+"px"}),t.stop().animate({height:s+"px"},n,i,(function(){})),e.stop().animate({left:"0"},n,i,(function(){}))}function L(t,e,r,n,i){e.stop().animate({left:"-"+parseFloat(tt+N.offset)+"px"},n,i,(function(){e.css({opacity:0}),e.remove(),t.append(e)}))}function W(t,e){var r=e[0],n=r.height();t.css("height",n+"px"),r.css({opacity:1,left:0})}function z(t,e,r,n,i){var s=e.height();e.css({opacity:1,left:"-"+parseFloat(tt+N.offset)+"px"}),t.stop().animate({height:s+"px"},n,i,(function(){})),e.stop().animate({left:"0"},n,i)}function j(t,e,r,n,i){e.stop().animate({left:parseFloat(tt+N.offset)+"px"},n,i,(function(){e.css({opacity:0}),e.remove(),t.append(e)}))}function O(t,e){var r=e[0],n=r.height();t.css("height",n+"px"),r.css({opacity:1,top:0,left:"auto"})}function T(t,e,r,n,i){var s=e.height();e.css({opacity:1,top:"-"+parseFloat(s+N.offset)+"px",left:"auto"}),t.stop().animate({height:s+"px"},n,i),e.stop().animate({top:"0"},n,i)}function A(t,e,r,n,i){var s=r.height();e.stop().animate({top:parseFloat(s+N.offset)+"px"},n,i,(function(){e.css({opacity:0}),e.remove(),t.append(e)}))}function M(t,e){var r=e[0],n=r.height();t.css({height:n+"px",left:"auto"}),r.css({opacity:1,top:0})}function Q(t,e,r,n,i){var s=e.height();e.css({opacity:1,top:parseFloat(r.height()+N.offset)+"px",left:"auto"}),t.stop().animate({height:s+"px"},n,i),e.stop().animate({top:"0"},n,i)}function q(t,e,r,n,i){var s=e.height();e.stop().animate({top:"-"+parseFloat(s+N.offset)+"px"},n,i,(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():v()):(P.paused=!0,$.addClass("paused"),"scroll"===N.type?s():k()),R.trigger("mtphr_dnt_play_pause",[P,rt])}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_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,rt=[],nt,it=!0,st,at=N.rotate_type,ot;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 r=parseInt(t(this).attr("href"));if(P.running)return!1;if(r===P.current_tick)return!1;var n=r<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(r)})),$.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)&&it?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,i){clearInterval(nt),R.find(".mtphr-dnt-tick").remove(),n.each((function(){S.append(t(this))})),setTimeout((function(){r()}),i)})),0===R.width())var ct=setInterval((function(){R.width()>10&&(clearInterval(ct),tt=S.outerWidth(!0),r())}),100);else r()}))}};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?n():"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 r(){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 n(){var e=S.find(".mtphr-dnt-tick:first");if(e.attr("style")){var i,n=e.attr("style").split("width:");st=!(n.length>1)}it=[],S.find("img").length?S.imagesLoaded((function(){r(),S.find(".mtphr-dnt-tick").each((function(){t(this).show();var e=[{headline:t(this)}];it.push(e)})),g(),o()})):(r(),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(){nt=!0}function a(){nt=!1}function o(){setTimeout((function t(){if(!nt)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}setTimeout(t,pt)}),pt)}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":j(S,it,parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_up":M(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":W(S,t(it[e]),t(it[P.current_tick]),parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_down":O(S,t(it[e]),t(it[P.current_tick]),parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_up":Q(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":T(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":z(S,t(it[P.current_tick]),t(it[e]),parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_down":A(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],r=i.height();t.css("height",r+"px"),i.css({opacity:1,left:"auto"})}function Y(t,e,i,r,n){e.css({opacity:0,left:"auto"}),e.stop().animate({opacity:1},r,n);var s=e.height();t.stop().animate({height:s+"px"},r,n)}function T(e,i,r,n,s){i.stop().animate({opacity:0},n,s,(function(){t(this).css({left:parseFloat(tt+N.offset)+"px"}),i.remove(),e.append(i)}))}function C(t,e){var i=e[0],r=i.height();t.css("height",r+"px"),i.css({opacity:1,left:0})}function D(t,e,i,r,n){var s=e.height();e.css({opacity:1,left:parseFloat(tt+N.offset)+"px"}),t.stop().animate({height:s+"px"},r,n,(function(){})),e.stop().animate({left:"0"},r,n,(function(){}))}function E(t,e,i,r,n){e.stop().animate({left:"-"+parseFloat(tt+N.offset)+"px"},r,n,(function(){e.css({opacity:0}),e.remove(),t.append(e)}))}function L(t,e){var i=e[0],r=i.height();t.css("height",r+"px"),i.css({opacity:1,left:0})}function W(t,e,i,r,n){var s=e.height();e.css({opacity:1,left:"-"+parseFloat(tt+N.offset)+"px"}),t.stop().animate({height:s+"px"},r,n,(function(){})),e.stop().animate({left:"0"},r,n)}function z(t,e,i,r,n){e.stop().animate({left:parseFloat(tt+N.offset)+"px"},r,n,(function(){e.css({opacity:0}),e.remove(),t.append(e)}))}function j(t,e){var i=e[0],r=i.height();t.css("height",r+"px"),i.css({opacity:1,top:0,left:"auto"})}function O(t,e,i,r,n){var s=e.height();e.css({opacity:1,top:"-"+parseFloat(s+N.offset)+"px",left:"auto"}),t.stop().animate({height:s+"px"},r,n),e.stop().animate({top:"0"},r,n)}function A(t,e,i,r,n){var s=i.height();e.stop().animate({top:parseFloat(s+N.offset)+"px"},r,n,(function(){e.css({opacity:0}),e.remove(),t.append(e)}))}function M(t,e){var i=e[0],r=i.height();t.css({height:r+"px",left:"auto"}),i.css({opacity:1,top:0})}function Q(t,e,i,r,n){var s=e.height();e.css({opacity:1,top:parseFloat(i.height()+N.offset)+"px",left:"auto"}),t.stop().animate({height:s+"px"},r,n),e.stop().animate({top:"0"},r,n)}function q(t,e,i,r,n){var s=e.height();e.stop().animate({top:"-"+parseFloat(s+N.offset)+"px"},r,n,(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=[],rt,nt=!1,st=!0,at,ot=N.rotate_type,ct,pt=10,lt=.1;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 r=i<P.current_tick?1:0;N.nav_reverse&&r&&("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,r,n){clearInterval(rt),R.find(".mtphr-dnt-tick").remove(),r.each((function(){S.append(t(this))})),setTimeout((function(){i()}),n)})),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
@@ -333,7 +333,7 @@ jQuery( document ).ready( function($) {
|
|
333 |
} );
|
334 |
|
335 |
$table.sortable( {
|
336 |
-
handle: '.mtphr-dnt-list-heading',
|
337 |
items: '.mtphr-dnt-list-item',
|
338 |
axis: 'y',
|
339 |
opacity: 0.7,
|
333 |
} );
|
334 |
|
335 |
$table.sortable( {
|
336 |
+
handle: '.mtphr-dnt-list-heading > .dashicons-menu',
|
337 |
items: '.mtphr-dnt-list-item',
|
338 |
axis: 'y',
|
339 |
opacity: 0.7,
|
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",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()}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);
|
inc/static/sass/style-admin.scss
CHANGED
@@ -366,11 +366,16 @@ $red: hsl(0, 100%, 50%);
|
|
366 |
}
|
367 |
}
|
368 |
.mtphr-dnt-list-buttons {
|
|
|
|
|
|
|
|
|
|
|
|
|
369 |
margin: -5px -10px;
|
370 |
margin-left: auto;
|
371 |
order: 20;
|
372 |
a {
|
373 |
-
float: left;
|
374 |
display: block;
|
375 |
width: 30px;
|
376 |
height: 30px;
|
@@ -641,6 +646,9 @@ $red: hsl(0, 100%, 50%);
|
|
641 |
display: block;
|
642 |
}
|
643 |
.wp-core-ui #mtphr-dnt-settings-select .mtphr-dnt-button {
|
|
|
|
|
|
|
644 |
color: #FFF;
|
645 |
border-color: $dark-gray;
|
646 |
background: hsl(0, 0%, 50%);
|
@@ -679,7 +687,7 @@ $red: hsl(0, 100%, 50%);
|
|
679 |
i {
|
680 |
font-size: 16px;
|
681 |
line-height: 16px;
|
682 |
-
margin:
|
683 |
opacity: .5;
|
684 |
-webkit-transition: opacity .25s ease;
|
685 |
transition: opacity .25s ease;
|
@@ -691,7 +699,7 @@ $red: hsl(0, 100%, 50%);
|
|
691 |
vertical-align: top;
|
692 |
font-size: 14px;
|
693 |
line-height: 14px;
|
694 |
-
margin-top:
|
695 |
}
|
696 |
}
|
697 |
}
|
@@ -797,14 +805,6 @@ $red: hsl(0, 100%, 50%);
|
|
797 |
}
|
798 |
|
799 |
@media (max-width: 782px) {
|
800 |
-
.wp-core-ui #mtphr-dnt-settings-select .button {
|
801 |
-
i {
|
802 |
-
margin-top: -1px;
|
803 |
-
&.fontastic {
|
804 |
-
margin-top: 2px;
|
805 |
-
}
|
806 |
-
}
|
807 |
-
}
|
808 |
.mtphr-dnt-metabox {
|
809 |
input, textarea {
|
810 |
font-size: 14px;
|
366 |
}
|
367 |
}
|
368 |
.mtphr-dnt-list-buttons {
|
369 |
+
position: relative;
|
370 |
+
z-index: 999;
|
371 |
+
display: flex;
|
372 |
+
flex-direction: row;
|
373 |
+
align-items: stretch;
|
374 |
+
justify-content: flex-start;
|
375 |
margin: -5px -10px;
|
376 |
margin-left: auto;
|
377 |
order: 20;
|
378 |
a {
|
|
|
379 |
display: block;
|
380 |
width: 30px;
|
381 |
height: 30px;
|
646 |
display: block;
|
647 |
}
|
648 |
.wp-core-ui #mtphr-dnt-settings-select .mtphr-dnt-button {
|
649 |
+
min-height: 0 !important;
|
650 |
+
font-size: 13px !important;
|
651 |
+
line-height: 2.15384615 !important;
|
652 |
color: #FFF;
|
653 |
border-color: $dark-gray;
|
654 |
background: hsl(0, 0%, 50%);
|
687 |
i {
|
688 |
font-size: 16px;
|
689 |
line-height: 16px;
|
690 |
+
margin: 4px 0 0 -5px;
|
691 |
opacity: .5;
|
692 |
-webkit-transition: opacity .25s ease;
|
693 |
transition: opacity .25s ease;
|
699 |
vertical-align: top;
|
700 |
font-size: 14px;
|
701 |
line-height: 14px;
|
702 |
+
margin-top: 7px;
|
703 |
}
|
704 |
}
|
705 |
}
|
805 |
}
|
806 |
|
807 |
@media (max-width: 782px) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
808 |
.mtphr-dnt-metabox {
|
809 |
input, textarea {
|
810 |
font-size: 14px;
|
readme.txt
CHANGED
@@ -72,6 +72,14 @@ The most common cause for an unresponsive ticker (when using scroll or rotate mo
|
|
72 |
|
73 |
== Changelog ==
|
74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
= 2.3.2 =
|
76 |
* Deprecated javascript updates
|
77 |
|
@@ -552,4 +560,4 @@ The most common cause for an unresponsive ticker (when using scroll or rotate mo
|
|
552 |
|
553 |
== Upgrade Notice ==
|
554 |
|
555 |
-
|
72 |
|
73 |
== Changelog ==
|
74 |
|
75 |
+
= 2.3.4 =
|
76 |
+
* Javascript updates to scroll functionality
|
77 |
+
* Admin tick drag order updates
|
78 |
+
|
79 |
+
= 2.3.3 =
|
80 |
+
* Javascript updates to scroll functionality
|
81 |
+
* EDD Software Licensing updates
|
82 |
+
|
83 |
= 2.3.2 =
|
84 |
* Deprecated javascript updates
|
85 |
|
560 |
|
561 |
== Upgrade Notice ==
|
562 |
|
563 |
+
Javascript updates to scroll functionality
|