Version Description
- Fixes third-party incompatibiliy issues.
- Code improvements.
Download this release
Release Info
Developer | sksmatt |
Plugin | Dynamic "To Top" Plugin |
Version | 3.1.9 |
Comparing to | |
See all releases |
Code changes from version 3.1.8 to 3.1.9
- css/dynamic-to-top-admin.css +0 -1
- dynamic-to-top.php +5 -7
- inc/dynamic-to-top-class.php +23 -21
- inc/dynamic-to-top-options.php +28 -8
- js/dynamic.to.top.dev.js +7 -5
- js/dynamic.to.top.settings.js +88 -71
- readme.txt +6 -2
css/dynamic-to-top-admin.css
CHANGED
@@ -2,7 +2,6 @@
|
|
2 |
* Dynamic To Top Plugin Admin CSS
|
3 |
* http://www.mattvarone.com
|
4 |
*
|
5 |
-
* Dual licensed under the MIT or GPL Version 2 licenses.
|
6 |
* By Matt Varone
|
7 |
* @sksmatt
|
8 |
*
|
2 |
* Dynamic To Top Plugin Admin CSS
|
3 |
* http://www.mattvarone.com
|
4 |
*
|
|
|
5 |
* By Matt Varone
|
6 |
* @sksmatt
|
7 |
*
|
dynamic-to-top.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Dynamic To Top
|
4 |
-
Version: 3.1.
|
5 |
Plugin URI: http://www.mattvarone.com/featured-content/dynamic-to-top/
|
6 |
Description: Adds an automatic and dynamic "To Top" button to scroll long pages back to the top.
|
7 |
Author: Matt Varone
|
@@ -39,9 +39,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
39 |
|
40 |
define( 'MV_DYNAMIC_TO_TOP_BASENAME', plugin_basename( __FILE__ ) );
|
41 |
define( 'MV_DYNAMIC_TO_TOP_URL', plugins_url( '', __FILE__ ) );
|
42 |
-
define( '
|
43 |
-
define( 'MV_DYNAMIC_TO_TOP_VERSION', '3.1.7' );
|
44 |
-
define( 'MV_DYNAMIC_TO_TOP_FOLDER', basename( dirname( __FILE__ ) ) );
|
45 |
|
46 |
/*
|
47 |
|--------------------------------------------------------------------------
|
@@ -49,7 +47,7 @@ define( 'MV_DYNAMIC_TO_TOP_FOLDER', basename( dirname( __FILE__ ) ) );
|
|
49 |
|--------------------------------------------------------------------------
|
50 |
*/
|
51 |
|
52 |
-
load_plugin_textdomain( 'dynamic-to-top', false, '/' .
|
53 |
|
54 |
/*
|
55 |
|--------------------------------------------------------------------------
|
@@ -58,9 +56,9 @@ load_plugin_textdomain( 'dynamic-to-top', false, '/' . MV_DYNAMIC_TO_TOP_FOLDER
|
|
58 |
*/
|
59 |
|
60 |
if ( is_admin() )
|
61 |
-
require_once(
|
62 |
else
|
63 |
-
require_once(
|
64 |
|
65 |
/*
|
66 |
|--------------------------------------------------------------------------
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Dynamic To Top
|
4 |
+
Version: 3.1.9
|
5 |
Plugin URI: http://www.mattvarone.com/featured-content/dynamic-to-top/
|
6 |
Description: Adds an automatic and dynamic "To Top" button to scroll long pages back to the top.
|
7 |
Author: Matt Varone
|
39 |
|
40 |
define( 'MV_DYNAMIC_TO_TOP_BASENAME', plugin_basename( __FILE__ ) );
|
41 |
define( 'MV_DYNAMIC_TO_TOP_URL', plugins_url( '', __FILE__ ) );
|
42 |
+
define( 'MV_DYNAMIC_TO_TOP_VERSION', '3.1.9' );
|
|
|
|
|
43 |
|
44 |
/*
|
45 |
|--------------------------------------------------------------------------
|
47 |
|--------------------------------------------------------------------------
|
48 |
*/
|
49 |
|
50 |
+
load_plugin_textdomain( 'dynamic-to-top', false, '/' . basename( dirname( __FILE__ ) ) . '/lan' );
|
51 |
|
52 |
/*
|
53 |
|--------------------------------------------------------------------------
|
56 |
*/
|
57 |
|
58 |
if ( is_admin() )
|
59 |
+
require_once( plugin_dir_path( __FILE__ ) . 'inc/dynamic-to-top-options.php' );
|
60 |
else
|
61 |
+
require_once( plugin_dir_path( __FILE__ ) . 'inc/dynamic-to-top-class.php' );
|
62 |
|
63 |
/*
|
64 |
|--------------------------------------------------------------------------
|
inc/dynamic-to-top-class.php
CHANGED
@@ -6,6 +6,8 @@
|
|
6 |
* @author Matt Varone
|
7 |
*/
|
8 |
|
|
|
|
|
9 |
if ( ! class_exists( 'MV_Dynamic_To_Top' ) )
|
10 |
{
|
11 |
|
@@ -47,13 +49,27 @@ if ( ! class_exists( 'MV_Dynamic_To_Top' ) )
|
|
47 |
*/
|
48 |
|
49 |
function __construct() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
// Get options.
|
51 |
$this->get_options();
|
52 |
|
53 |
// Enqueue CSS and JS.
|
54 |
$this->enqueue_assets();
|
55 |
}
|
56 |
-
|
57 |
/**
|
58 |
* Get Options
|
59 |
*
|
@@ -98,7 +114,7 @@ if ( ! class_exists( 'MV_Dynamic_To_Top' ) )
|
|
98 |
*/
|
99 |
|
100 |
function enqueue_style() {
|
101 |
-
wp_enqueue_style( 'dynamic-to-top', MV_DYNAMIC_TO_TOP_URL . '/css/dynamic-to-top-css.php', false, MV_DYNAMIC_TO_TOP_VERSION,'all' );
|
102 |
}
|
103 |
|
104 |
/**
|
@@ -110,9 +126,11 @@ if ( ! class_exists( 'MV_Dynamic_To_Top' ) )
|
|
110 |
*/
|
111 |
|
112 |
function enqueue_script() {
|
113 |
-
|
|
|
|
|
114 |
$env = ( WP_DEBUG ) ? 'dev' : 'min';
|
115 |
-
wp_enqueue_script( 'dynamic-to-top', MV_DYNAMIC_TO_TOP_URL . '/js/dynamic.to.top.' . $env . '.js', array( 'jquery
|
116 |
|
117 |
$params = array(
|
118 |
'text' => $this->options['text'],
|
@@ -492,21 +510,5 @@ if ( ! class_exists( 'MV_Dynamic_To_Top' ) )
|
|
492 |
|--------------------------------------------------------------------------
|
493 |
*/
|
494 |
|
495 |
-
|
496 |
-
|
497 |
-
/**
|
498 |
-
* Initializes the main Dynamic to top class.
|
499 |
-
*
|
500 |
-
* @package Dynamic To Top
|
501 |
-
* @since 3.0
|
502 |
-
*
|
503 |
-
*/
|
504 |
-
|
505 |
-
function mv_dynamic_to_top_init() {
|
506 |
-
global $OBJ_dynamic_to_top;
|
507 |
-
$OBJ_dynamic_to_top = new MV_Dynamic_To_Top();
|
508 |
-
}
|
509 |
-
|
510 |
-
add_action( 'init', 'mv_dynamic_to_top_init' );
|
511 |
-
}
|
512 |
}
|
6 |
* @author Matt Varone
|
7 |
*/
|
8 |
|
9 |
+
global $OBJ_dynamic_to_top;
|
10 |
+
|
11 |
if ( ! class_exists( 'MV_Dynamic_To_Top' ) )
|
12 |
{
|
13 |
|
49 |
*/
|
50 |
|
51 |
function __construct() {
|
52 |
+
add_action( 'init', array( &$this, 'init' ) );
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Dynamic To Top
|
57 |
+
*
|
58 |
+
* Init function calls for options and assets.
|
59 |
+
*
|
60 |
+
* @package Dynamic To Top
|
61 |
+
* @subpackage Main Class
|
62 |
+
* @since 4.0
|
63 |
+
*
|
64 |
+
*/
|
65 |
+
|
66 |
+
function init() {
|
67 |
// Get options.
|
68 |
$this->get_options();
|
69 |
|
70 |
// Enqueue CSS and JS.
|
71 |
$this->enqueue_assets();
|
72 |
}
|
|
|
73 |
/**
|
74 |
* Get Options
|
75 |
*
|
114 |
*/
|
115 |
|
116 |
function enqueue_style() {
|
117 |
+
wp_enqueue_style( 'dynamic-to-top', MV_DYNAMIC_TO_TOP_URL . '/css/dynamic-to-top-css.php', false, MV_DYNAMIC_TO_TOP_VERSION, 'all' );
|
118 |
}
|
119 |
|
120 |
/**
|
126 |
*/
|
127 |
|
128 |
function enqueue_script() {
|
129 |
+
|
130 |
+
wp_enqueue_script( 'jquery-easing', MV_DYNAMIC_TO_TOP_URL . '/js/libs/jquery.easing.js', array( 'jquery' ), '1.3', true );
|
131 |
+
|
132 |
$env = ( WP_DEBUG ) ? 'dev' : 'min';
|
133 |
+
wp_enqueue_script( 'dynamic-to-top', MV_DYNAMIC_TO_TOP_URL . '/js/dynamic.to.top.' . $env . '.js', array( 'jquery' ), MV_DYNAMIC_TO_TOP_VERSION, true );
|
134 |
|
135 |
$params = array(
|
136 |
'text' => $this->options['text'],
|
510 |
|--------------------------------------------------------------------------
|
511 |
*/
|
512 |
|
513 |
+
$OBJ_dynamic_to_top = new MV_Dynamic_To_Top();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
514 |
}
|
inc/dynamic-to-top-options.php
CHANGED
@@ -118,6 +118,16 @@ if ( ! function_exists( 'mv_dynamic_to_top_options_page' ) )
|
|
118 |
}
|
119 |
|
120 |
if ( ! function_exists( 'mv_dynamic_to_top_appearance_section' ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
function mv_dynamic_to_top_appearance_section() {
|
122 |
echo '<div id="dynamic-to-top-preview"><div id="dynamic-to-top-button"><span id="dtt-text"></span><span id="dtt-image"></span></div></div>';
|
123 |
echo '<p class="ddt-bg-colors"><small>'.__( 'Preview over', 'dynamic-to-top' ).' <a href="#" title="black">'.__( 'black', 'dynamic-to-top' ).'</a>, <a href="#" title="lightgrey">'.__( 'grey', 'dynamic-to-top' ).'</a> or <a href="#" title="white">'.__( 'white', 'dynamic-to-top' ).'</a>.</small></p>';
|
@@ -125,6 +135,16 @@ if ( ! function_exists( 'mv_dynamic_to_top_appearance_section' ) ) {
|
|
125 |
}
|
126 |
|
127 |
if ( ! function_exists( 'mv_dynamic_to_top_save_settings' ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
function mv_dynamic_to_top_save_settings( $options ) {
|
129 |
delete_transient( 'dynamic_to_top_transient_css' );
|
130 |
delete_transient( 'dynamic_to_top_transient_js' );
|
@@ -218,11 +238,11 @@ if ( ! function_exists( 'mv_dynamic_to_top_is_page_options' ) ) {
|
|
218 |
function mv_dynamic_to_top_is_page_options()
|
219 |
{
|
220 |
global $pagenow;
|
221 |
-
|
222 |
if ( function_exists( 'get_current_screen' ) ) {
|
223 |
$screen = get_current_screen();
|
224 |
-
|
225 |
-
if ( isset( $screen->base ) && $screen->base == 'appearance_page_' .
|
226 |
return true;
|
227 |
else
|
228 |
return false;
|
@@ -230,10 +250,10 @@ if ( ! function_exists( 'mv_dynamic_to_top_is_page_options' ) ) {
|
|
230 |
else {
|
231 |
$pages = array( 'themes.php' );
|
232 |
|
233 |
-
if ( in_array( $pagenow, $pages ) && isset( $_GET['page'] ) && $_GET['page'] ==
|
234 |
return true;
|
235 |
}
|
236 |
-
|
237 |
return false;
|
238 |
}
|
239 |
}
|
@@ -316,7 +336,7 @@ if ( ! function_exists( 'mv_dynamic_to_top_field_box_shadow_color' ) ) {
|
|
316 |
}
|
317 |
}
|
318 |
|
319 |
-
// SELECT
|
320 |
|
321 |
if ( ! function_exists( 'mv_dynamic_to_top_field_easing' ) ) {
|
322 |
|
@@ -362,7 +382,7 @@ if ( ! function_exists( 'mv_dynamic_to_top_field_position' ) ) {
|
|
362 |
}
|
363 |
}
|
364 |
|
365 |
-
//
|
366 |
|
367 |
if ( ! function_exists( 'mv_dynamic_to_top_field_scroll_time' ) ) {
|
368 |
|
@@ -755,7 +775,7 @@ if ( ! function_exists( 'mv_dynamic_to_top_do_slider' ) ) {
|
|
755 |
if ( $class != "" )
|
756 |
$class .= " ";
|
757 |
|
758 |
-
$class = 'class="'.$class.'
|
759 |
|
760 |
$sanitized_meta_title = str_replace( '_', '-', sanitize_title( $meta ) );
|
761 |
|
118 |
}
|
119 |
|
120 |
if ( ! function_exists( 'mv_dynamic_to_top_appearance_section' ) ) {
|
121 |
+
|
122 |
+
/**
|
123 |
+
* Appearance Section
|
124 |
+
*
|
125 |
+
* @package Dynamic To Top
|
126 |
+
* @subpackage Options
|
127 |
+
* @since 3.0
|
128 |
+
*
|
129 |
+
*/
|
130 |
+
|
131 |
function mv_dynamic_to_top_appearance_section() {
|
132 |
echo '<div id="dynamic-to-top-preview"><div id="dynamic-to-top-button"><span id="dtt-text"></span><span id="dtt-image"></span></div></div>';
|
133 |
echo '<p class="ddt-bg-colors"><small>'.__( 'Preview over', 'dynamic-to-top' ).' <a href="#" title="black">'.__( 'black', 'dynamic-to-top' ).'</a>, <a href="#" title="lightgrey">'.__( 'grey', 'dynamic-to-top' ).'</a> or <a href="#" title="white">'.__( 'white', 'dynamic-to-top' ).'</a>.</small></p>';
|
135 |
}
|
136 |
|
137 |
if ( ! function_exists( 'mv_dynamic_to_top_save_settings' ) ) {
|
138 |
+
|
139 |
+
/**
|
140 |
+
* Save Settings Check
|
141 |
+
*
|
142 |
+
* @package Dynamic To Top
|
143 |
+
* @subpackage Options
|
144 |
+
* @since 3.0
|
145 |
+
*
|
146 |
+
*/
|
147 |
+
|
148 |
function mv_dynamic_to_top_save_settings( $options ) {
|
149 |
delete_transient( 'dynamic_to_top_transient_css' );
|
150 |
delete_transient( 'dynamic_to_top_transient_js' );
|
238 |
function mv_dynamic_to_top_is_page_options()
|
239 |
{
|
240 |
global $pagenow;
|
241 |
+
|
242 |
if ( function_exists( 'get_current_screen' ) ) {
|
243 |
$screen = get_current_screen();
|
244 |
+
|
245 |
+
if ( isset( $screen->base ) && $screen->base == 'appearance_page_' . basename( dirname( dirname( __FILE__ ) ) ) . '/inc/dynamic-to-top-options' )
|
246 |
return true;
|
247 |
else
|
248 |
return false;
|
250 |
else {
|
251 |
$pages = array( 'themes.php' );
|
252 |
|
253 |
+
if ( in_array( $pagenow, $pages ) && isset( $_GET['page'] ) && $_GET['page'] == basename( dirname( dirname( __FILE__ ) ) ) . '/inc/dynamic-to-top-options.php' )
|
254 |
return true;
|
255 |
}
|
256 |
+
|
257 |
return false;
|
258 |
}
|
259 |
}
|
336 |
}
|
337 |
}
|
338 |
|
339 |
+
// SELECT BOXES /////////////////////////
|
340 |
|
341 |
if ( ! function_exists( 'mv_dynamic_to_top_field_easing' ) ) {
|
342 |
|
382 |
}
|
383 |
}
|
384 |
|
385 |
+
// SLIDERS UI /////////////////////////
|
386 |
|
387 |
if ( ! function_exists( 'mv_dynamic_to_top_field_scroll_time' ) ) {
|
388 |
|
775 |
if ( $class != "" )
|
776 |
$class .= " ";
|
777 |
|
778 |
+
$class = 'class="'.$class.'to-top-slider"';
|
779 |
|
780 |
$sanitized_meta_title = str_replace( '_', '-', sanitize_title( $meta ) );
|
781 |
|
js/dynamic.to.top.dev.js
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
*
|
8 |
*/
|
9 |
var mv_dynamic_to_top;
|
10 |
-
(function (
|
11 |
jQuery.fn.DynamicToTop = function (options) {
|
12 |
var defaults = {
|
13 |
text: mv_dynamic_to_top.text,
|
@@ -23,9 +23,11 @@ var mv_dynamic_to_top;
|
|
23 |
if (settings.version === "" || settings.version === '0') {
|
24 |
settings.text = '<span> </span>';
|
25 |
}
|
|
|
|
|
|
|
26 |
var $toTop = $('<a href=\"#\" id=\"' + settings.id + '\"></a>').html(settings.text);
|
27 |
-
$('body').
|
28 |
-
$toTop.hide().click(function () {
|
29 |
$('html, body').stop().animate({
|
30 |
scrollTop: 0
|
31 |
}, settings.speed, settings.easing);
|
@@ -36,7 +38,7 @@ var mv_dynamic_to_top;
|
|
36 |
if (typeof document.body.style.maxHeight === "undefined") {
|
37 |
$toTop.css({
|
38 |
'position': 'absolute',
|
39 |
-
'top':
|
40 |
});
|
41 |
}
|
42 |
if (sd > settings.min) {
|
@@ -47,4 +49,4 @@ var mv_dynamic_to_top;
|
|
47 |
});
|
48 |
};
|
49 |
$('body').DynamicToTop();
|
50 |
-
})(jQuery);
|
7 |
*
|
8 |
*/
|
9 |
var mv_dynamic_to_top;
|
10 |
+
(function ($, mv_dynamic_to_top) {
|
11 |
jQuery.fn.DynamicToTop = function (options) {
|
12 |
var defaults = {
|
13 |
text: mv_dynamic_to_top.text,
|
23 |
if (settings.version === "" || settings.version === '0') {
|
24 |
settings.text = '<span> </span>';
|
25 |
}
|
26 |
+
if ( ! $.isFunction(settings.easing) ) {
|
27 |
+
settings.easing = 'linear';
|
28 |
+
}
|
29 |
var $toTop = $('<a href=\"#\" id=\"' + settings.id + '\"></a>').html(settings.text);
|
30 |
+
$toTop.hide().appendTo('body').click(function () {
|
|
|
31 |
$('html, body').stop().animate({
|
32 |
scrollTop: 0
|
33 |
}, settings.speed, settings.easing);
|
38 |
if (typeof document.body.style.maxHeight === "undefined") {
|
39 |
$toTop.css({
|
40 |
'position': 'absolute',
|
41 |
+
'top': sd + $(window).height() - mv_dynamic_to_top.margin
|
42 |
});
|
43 |
}
|
44 |
if (sd > settings.min) {
|
49 |
});
|
50 |
};
|
51 |
$('body').DynamicToTop();
|
52 |
+
})(jQuery, mv_dynamic_to_top);
|
js/dynamic.to.top.settings.js
CHANGED
@@ -6,40 +6,49 @@
|
|
6 |
* @sksmatt
|
7 |
*
|
8 |
*/
|
9 |
-
jQuery(document).ready(function () {
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
var
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
20 |
toggle_text_version();
|
21 |
update_preview();
|
22 |
update_position();
|
23 |
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
-
|
27 |
update_preview()
|
28 |
});
|
29 |
-
|
30 |
update_position();
|
31 |
});
|
32 |
-
|
33 |
-
jQuery('#text-text').keyup(function () {
|
34 |
update_preview()
|
35 |
});
|
36 |
-
|
37 |
-
jQuery('.ddt-bg-colors a').click(function (e) {
|
38 |
e.preventDefault();
|
39 |
-
var color =
|
40 |
-
|
41 |
});
|
42 |
|
|
|
|
|
|
|
43 |
// Slider Radius
|
44 |
var slider = jQuery("#slider-radius").hide();
|
45 |
var slider_val = jQuery('span#radius-val').html(slider.val());
|
@@ -147,44 +156,51 @@ jQuery(document).ready(function () {
|
|
147 |
|
148 |
jQuery('.dtt-slider').css('width', '25em');
|
149 |
|
150 |
-
//
|
151 |
-
|
152 |
-
jQuery('#farbtastic-picker-background-color').farbtastic('#farbtastic-background-color');
|
153 |
-
jQuery('#farbtastic-picker-border-color').farbtastic('#farbtastic-border-color');
|
154 |
-
jQuery('#farbtastic-picker-shadow-color').farbtastic('#farbtastic-shadow-color');
|
155 |
-
|
156 |
-
jQuery('.dtt-farbtastic').hide().css('margin-bottom', '15px').mouseup(function () {
|
157 |
-
update_preview()
|
158 |
-
});
|
159 |
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
var picker = jQuery(this).parent().find('.picker');
|
168 |
-
if (picker.html() === picker.attr('data-closed')) {
|
169 |
-
toogle_picker(picker);
|
170 |
-
}
|
171 |
-
});
|
172 |
-
|
173 |
-
function toogle_picker(picker) {
|
174 |
-
picker.parent().find('.dtt-farbtastic').toggle();
|
175 |
-
|
176 |
-
var open = picker.attr('data-open');
|
177 |
-
if (picker.html() === open) {
|
178 |
-
picker.html(picker.attr('data-closed'));
|
179 |
-
picker.parent().find('.picker').addClass('picker-opened');
|
180 |
-
} else {
|
181 |
-
picker.parent().find('.picker').removeClass('picker-opened');
|
182 |
-
picker.html(open);
|
183 |
-
}
|
184 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
185 |
|
186 |
-
/* FUNCTIONS
|
187 |
-
|
188 |
|
189 |
function toggle_text_version() {
|
190 |
if (jQuery('#checkbox-text-version').attr('checked')) {
|
@@ -200,8 +216,9 @@ jQuery(document).ready(function () {
|
|
200 |
}
|
201 |
}
|
202 |
|
|
|
203 |
function update_position() {
|
204 |
-
var preview_position =
|
205 |
|
206 |
switch (preview_position) {
|
207 |
case 'Top Left':
|
@@ -244,21 +261,21 @@ jQuery(document).ready(function () {
|
|
244 |
|
245 |
function update_preview() {
|
246 |
prevew = new Object;
|
247 |
-
preview.text =
|
248 |
-
preview.border_width =
|
249 |
-
preview.border_radius =
|
250 |
-
preview.text_color =
|
251 |
-
preview.bg_color =
|
252 |
-
preview.border_color =
|
253 |
-
preview.padding_top_bottom =
|
254 |
-
preview.padding_left_right =
|
255 |
-
preview.find('#dtt-text').font_size =
|
256 |
-
preview.shadow =
|
257 |
-
preview.inset =
|
258 |
-
preview.bold =
|
259 |
-
preview.position =
|
260 |
-
preview.text_shadow =
|
261 |
-
preview.text_shadow_color =
|
262 |
|
263 |
preview.css({
|
264 |
borderStyle: 'solid',
|
6 |
* @sksmatt
|
7 |
*
|
8 |
*/
|
9 |
+
jQuery(document).ready(function ($) {
|
10 |
+
|
11 |
+
// GRABA GRABA
|
12 |
+
/////////////////////////////////////////////////////////
|
13 |
+
|
14 |
+
var preview = $('#dynamic-to-top-button'),
|
15 |
+
preview_button_version = $('#dynamic-to-top-button #dtt-image'),
|
16 |
+
preview_text_version = $('#dynamic-to-top-button #dtt-text'),
|
17 |
+
hide_on_button = $('#text-text, #slider-font-size, #checkbox-bold, #checkbox-text-shadow, #farbtastic-text-color, #farbtastic-shadow-color').parent().parent(),
|
18 |
+
update_fields = '#checkbox-bold, #checkbox-inset, #checkbox-shadow, #checkbox-text-shadow, .colorvalue';
|
19 |
+
|
20 |
+
// INITIALIZE
|
21 |
+
/////////////////////////////////////////////////////////
|
22 |
+
|
23 |
toggle_text_version();
|
24 |
update_preview();
|
25 |
update_position();
|
26 |
|
27 |
+
// EVENTS
|
28 |
+
/////////////////////////////////////////////////////////
|
29 |
+
|
30 |
+
$('#checkbox-text-version').on('click', function () {
|
31 |
+
toggle_text_version();
|
32 |
+
});
|
33 |
|
34 |
+
$(update_fields).on('change', function () {
|
35 |
update_preview()
|
36 |
});
|
37 |
+
$('#select-position').on('change', function () {
|
38 |
update_position();
|
39 |
});
|
40 |
+
$('#text-text').on('keyup', function () {
|
|
|
41 |
update_preview()
|
42 |
});
|
43 |
+
$('.ddt-bg-colors a').on('click',function (e) {
|
|
|
44 |
e.preventDefault();
|
45 |
+
var color = $(this).attr('title');
|
46 |
+
$('#dynamic-to-top-preview').css('background-color', color);
|
47 |
});
|
48 |
|
49 |
+
// SLIDERS
|
50 |
+
/////////////////////////////////////////////////////////
|
51 |
+
|
52 |
// Slider Radius
|
53 |
var slider = jQuery("#slider-radius").hide();
|
54 |
var slider_val = jQuery('span#radius-val').html(slider.val());
|
156 |
|
157 |
jQuery('.dtt-slider').css('width', '25em');
|
158 |
|
159 |
+
// PICKERS
|
160 |
+
/////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
|
162 |
+
var Picker = function(picker) {
|
163 |
+
this.picker = picker;
|
164 |
+
this.input = this.picker.prev().prev();
|
165 |
+
this.anchor = this.picker.prev();
|
166 |
+
this.combined = this.input.add(this.anchor);
|
167 |
+
this.open = false;
|
168 |
+
this.init();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
169 |
}
|
170 |
+
|
171 |
+
Picker.prototype = function(){
|
172 |
+
var init = function(){
|
173 |
+
this.picker.farbtastic(this.input).hide().css('margin-bottom', '15px').on( 'mouseup', function () {
|
174 |
+
update_preview();
|
175 |
+
});
|
176 |
+
this.combined.on( 'click' , {p: this}, function (e) {
|
177 |
+
e.preventDefault();
|
178 |
+
tooglePicker.call(e.data.p);
|
179 |
+
});
|
180 |
+
},
|
181 |
+
tooglePicker = function() {
|
182 |
+
this.picker.toggle();
|
183 |
+
var open = this.anchor.attr('data-open');
|
184 |
+
if (this.anchor.html() === open) {
|
185 |
+
this.anchor.html(this.anchor.attr('data-closed'));
|
186 |
+
this.anchor.addClass('picker-opened');
|
187 |
+
} else {
|
188 |
+
this.anchor.removeClass('picker-opened');
|
189 |
+
this.anchor.html(open);
|
190 |
+
}
|
191 |
+
};
|
192 |
+
return {
|
193 |
+
init: init
|
194 |
+
};
|
195 |
+
}();
|
196 |
+
|
197 |
+
$('.dtt-farbtastic').each(function(index,item){
|
198 |
+
new Picker($(item));
|
199 |
+
});
|
200 |
+
|
201 |
|
202 |
+
/* FUNCTIONS
|
203 |
+
/////////////////////////////*/
|
204 |
|
205 |
function toggle_text_version() {
|
206 |
if (jQuery('#checkbox-text-version').attr('checked')) {
|
216 |
}
|
217 |
}
|
218 |
|
219 |
+
|
220 |
function update_position() {
|
221 |
+
var preview_position = $('#select-position').val();
|
222 |
|
223 |
switch (preview_position) {
|
224 |
case 'Top Left':
|
261 |
|
262 |
function update_preview() {
|
263 |
prevew = new Object;
|
264 |
+
preview.text = $('#text-text').val();
|
265 |
+
preview.border_width = $('#slider-border-width').val();
|
266 |
+
preview.border_radius = $('#slider-radius').val();
|
267 |
+
preview.text_color = $('#farbtastic-text-color').val();
|
268 |
+
preview.bg_color = $('#farbtastic-background-color').val();
|
269 |
+
preview.border_color = $('#farbtastic-border-color').val();
|
270 |
+
preview.padding_top_bottom = $('#slider-padding-top-bottom').val();
|
271 |
+
preview.padding_left_right = $('#slider-padding-left-right').val();
|
272 |
+
preview.find('#dtt-text').font_size = $('#slider-font-size').val();
|
273 |
+
preview.shadow = $('#checkbox-shadow').attr("checked");
|
274 |
+
preview.inset = $('#checkbox-inset').attr("checked");
|
275 |
+
preview.bold = $('#checkbox-bold').attr("checked");
|
276 |
+
preview.position = $('#select-position').val();
|
277 |
+
preview.text_shadow = $('#checkbox-text-shadow').attr("checked");
|
278 |
+
preview.text_shadow_color = $('#farbtastic-shadow-color').val();
|
279 |
|
280 |
preview.css({
|
281 |
borderStyle: 'solid',
|
readme.txt
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
Contributors: sksmatt
|
3 |
Donate link: http://www.mattvarone.com/donate/
|
4 |
Tags: Scroll, To top, Button, jQuery, Dynamic, UI, Automatic, Enhance, UX
|
5 |
-
Requires at least: 3.
|
6 |
Tested up to: 3.3
|
7 |
-
Stable tag: 3.1.
|
8 |
|
9 |
Adds an automatic and dynamic "To Top" button to easily scroll long pages back to the top.
|
10 |
|
@@ -41,6 +41,10 @@ It features an intuitive control panel to style and adjust to each website's nee
|
|
41 |
|
42 |
== Change log ==
|
43 |
|
|
|
|
|
|
|
|
|
44 |
= 3.1.8 =
|
45 |
* Options moved to the "Appearance" menu.
|
46 |
* Added new Hook: 'mv_dynamic_to_top_check_mobile' allows extending the mobile check.
|
2 |
Contributors: sksmatt
|
3 |
Donate link: http://www.mattvarone.com/donate/
|
4 |
Tags: Scroll, To top, Button, jQuery, Dynamic, UI, Automatic, Enhance, UX
|
5 |
+
Requires at least: 3.3
|
6 |
Tested up to: 3.3
|
7 |
+
Stable tag: 3.1.9
|
8 |
|
9 |
Adds an automatic and dynamic "To Top" button to easily scroll long pages back to the top.
|
10 |
|
41 |
|
42 |
== Change log ==
|
43 |
|
44 |
+
= 3.1.9 =
|
45 |
+
* Fixes third-party incompatibiliy issues.
|
46 |
+
* Code improvements.
|
47 |
+
|
48 |
= 3.1.8 =
|
49 |
* Options moved to the "Appearance" menu.
|
50 |
* Added new Hook: 'mv_dynamic_to_top_check_mobile' allows extending the mobile check.
|