Dynamic "To Top" Plugin - Version 3.1.8

Version Description

  • Options moved to the "Appearance" menu.
  • Added new Hook: 'mv_dynamic_to_top_check_mobile' allows extending the mobile check.
  • Added new Hook: 'mv_dynamic_to_top_new_hex' allows returning a custom HEX color for the button CSS :hover state.
  • WP 3.3 compatibility enhancements.
  • Code improvements.
Download this release

Release Info

Developer sksmatt
Plugin Icon wp plugin Dynamic "To Top" Plugin
Version 3.1.8
Comparing to
See all releases

Code changes from version 3.1.7 to 3.1.8

css/dynamic-to-top-css.php CHANGED
@@ -17,8 +17,8 @@ die();
17
 
18
  global $OBJ_dynamic_to_top;
19
 
20
- if ( !isset( $OBJ_dynamic_to_top ) OR ! is_object( $OBJ_dynamic_to_top ) ) {
21
- if (!class_exists('Dynamic_To_Top'))
22
  die();
23
 
24
  $OBJ_dynamic_to_top = new Dynamic_To_Top();
17
 
18
  global $OBJ_dynamic_to_top;
19
 
20
+ if ( ! isset( $OBJ_dynamic_to_top ) OR ! is_object( $OBJ_dynamic_to_top ) ) {
21
+ if ( ! class_exists( 'Dynamic_To_Top' ) )
22
  die();
23
 
24
  $OBJ_dynamic_to_top = new Dynamic_To_Top();
dynamic-to-top.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  Plugin Name: Dynamic To Top
4
- Version: 3.1.7
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
@@ -42,7 +42,6 @@ define( 'MV_DYNAMIC_TO_TOP_URL', plugins_url( '', __FILE__ ) );
42
  define( 'MV_DYNAMIC_TO_TOP_PATH', plugin_dir_path( __FILE__ ) );
43
  define( 'MV_DYNAMIC_TO_TOP_VERSION', '3.1.7' );
44
  define( 'MV_DYNAMIC_TO_TOP_FOLDER', basename( dirname( __FILE__ ) ) );
45
- define( 'MV_DYNAMIC_TO_TOP_DOMAIN', 'dynamic-to-top' );
46
 
47
  /*
48
  |--------------------------------------------------------------------------
@@ -50,7 +49,7 @@ define( 'MV_DYNAMIC_TO_TOP_DOMAIN', 'dynamic-to-top' );
50
  |--------------------------------------------------------------------------
51
  */
52
 
53
- load_plugin_textdomain( MV_DYNAMIC_TO_TOP_DOMAIN, false, '/' . MV_DYNAMIC_TO_TOP_FOLDER.'/lan' );
54
 
55
  /*
56
  |--------------------------------------------------------------------------
@@ -75,7 +74,7 @@ else
75
  * @package Dynamic To Top
76
  * @since 3.1.5
77
  */
78
- if ( !function_exists( 'mv_dynamic_to_top_activation' ) )
79
  {
80
  function mv_dynamic_to_top_activation()
81
  {
1
  <?php
2
  /*
3
  Plugin Name: Dynamic To Top
4
+ Version: 3.1.8
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
42
  define( 'MV_DYNAMIC_TO_TOP_PATH', plugin_dir_path( __FILE__ ) );
43
  define( 'MV_DYNAMIC_TO_TOP_VERSION', '3.1.7' );
44
  define( 'MV_DYNAMIC_TO_TOP_FOLDER', basename( dirname( __FILE__ ) ) );
 
45
 
46
  /*
47
  |--------------------------------------------------------------------------
49
  |--------------------------------------------------------------------------
50
  */
51
 
52
+ load_plugin_textdomain( 'dynamic-to-top', false, '/' . MV_DYNAMIC_TO_TOP_FOLDER . '/lan' );
53
 
54
  /*
55
  |--------------------------------------------------------------------------
74
  * @package Dynamic To Top
75
  * @since 3.1.5
76
  */
77
+ if ( ! function_exists( 'mv_dynamic_to_top_activation' ) )
78
  {
79
  function mv_dynamic_to_top_activation()
80
  {
inc/dynamic-to-top-class.php CHANGED
@@ -13,26 +13,26 @@ if ( ! class_exists( 'MV_Dynamic_To_Top' ) )
13
  {
14
  public $options;
15
  private $defaults = array(
16
- 'speed'=>1000,
17
- 'distance'=>200,
18
- 'easing'=>'In Out',
19
- 'position'=>'Bottom Right',
20
- 'padding_top_bottom'=>'21',
21
- 'padding_left_right'=>'20',
22
- 'font_size'=>'1',
23
- 'text_color'=>'#fff',
24
- 'bold'=>'',
25
- 'text_shadow'=>'',
26
- 'shadow_color'=>'#111',
27
- 'background_color'=>'#272727',
28
- 'border_color'=>'#000',
29
- 'border_width'=>'1',
30
- 'radius'=>'9',
31
- 'shadow'=>'',
32
- 'inset'=>'',
33
- 'text'=>'',
34
- 'margin'=>20,
35
- 'text_version'=>'',
36
  );
37
 
38
  /**
@@ -85,8 +85,8 @@ if ( ! class_exists( 'MV_Dynamic_To_Top' ) )
85
  return;
86
  }
87
 
88
- add_action( 'wp_print_styles', array( &$this,'enqueue_style' ) );
89
- add_action( 'wp_print_scripts', array( &$this,'enqueue_script' ) );
90
  }
91
 
92
  /**
@@ -169,7 +169,7 @@ if ( ! class_exists( 'MV_Dynamic_To_Top' ) )
169
 
170
  $css .= "/* Dynamic To Top Plugin ver. ".MV_DYNAMIC_TO_TOP_VERSION." - http://www.mattvarone.com */\n\n";
171
 
172
- $css .= "body {position:relative}
173
 
174
  #dynamic-to-top {
175
  display:none;
@@ -184,11 +184,11 @@ if ( ! class_exists( 'MV_Dynamic_To_Top' ) )
184
  color:".$this->options['text_color'].";
185
  text-decoration:none;\n";
186
 
187
- if ( $this->is_checked( 'text_shadow' ) )
188
- $css .= "text-shadow:0 1px 0 ".$this->options['shadow_color'].";\n";
189
 
190
- if ( $this->is_checked( 'bold' ) )
191
- $css .="font-weight:bold;\n";
192
 
193
  $css.= "padding:".$this->options['padding_top_bottom']."px ".$this->options['padding_left_right']."px;
194
  border:".$this->options['border_width']."px solid ".$this->options['border_color'].";
@@ -269,7 +269,7 @@ if ( ! class_exists( 'MV_Dynamic_To_Top' ) )
269
  overflow:hidden;
270
  width:14px;
271
  height:12px;
272
- background:url( ".MV_DYNAMIC_TO_TOP_URL."/css/images/up.png ) no-repeat center center;
273
  }";
274
 
275
  return $css;
@@ -279,7 +279,7 @@ if ( ! class_exists( 'MV_Dynamic_To_Top' ) )
279
  * Get Easing Type
280
  *
281
  * Returns the easing type function name.
282
- * Used on the JS script.
283
  *
284
  * @package Dynamic To Top
285
  * @subpackage Main Class
@@ -287,26 +287,26 @@ if ( ! class_exists( 'MV_Dynamic_To_Top' ) )
287
  * @return string $easing Name of easing function.
288
  */
289
 
290
- function get_easing_type( $easing="linear" ) {
291
  switch ( $this->options['easing'] )
292
  {
293
- case 'Bounce':
294
  $easing = "easeOutBounce";
295
  break;
296
 
297
- case 'Elastic':
298
  $easing = "easeInElastic";
299
  break;
300
 
301
- case 'In Out':
302
- $easing = "easeInOutExpo";
303
  break;
304
 
305
- case 'In':
306
- $easing = "easeInExpo";
307
  break;
308
 
309
- case 'Out':
310
  $easing = "easeOutExpo";
311
  break;
312
  }
@@ -317,7 +317,7 @@ if ( ! class_exists( 'MV_Dynamic_To_Top' ) )
317
  * Get Position
318
  *
319
  * Returns CSS properties for the selected position.
320
- * Used on the CSS style.
321
  *
322
  * @package Dynamic To Top
323
  * @subpackage Main Class
@@ -325,22 +325,22 @@ if ( ! class_exists( 'MV_Dynamic_To_Top' ) )
325
  * @return string $position Properties of the position selected.
326
  */
327
 
328
- function get_position( $position="" ) {
329
  switch ( $this->options['position'] )
330
  {
331
- case 'Bottom Right':
332
  $position = "bottom:".$this->options['margin']."px;right:".$this->options['margin']."px;top:auto;left:auto;";
333
  break;
334
 
335
- case 'Bottom Left':
336
  $position = "bottom:".$this->options['margin']."px;left:".$this->options['margin']."px;top:auto;right:auto;";
337
  break;
338
 
339
- case 'Top Right':
340
  $position = "top:".$this->options['margin']."px;right:".$this->options['margin']."px;bottom:auto;left:auto;";
341
  break;
342
 
343
- case 'Top Left':
344
  $position = "top:".$this->options['margin']."px;left:".$this->options['margin']."px;bottom:auto;right:auto;";
345
  break;
346
  }
@@ -357,25 +357,21 @@ if ( ! class_exists( 'MV_Dynamic_To_Top' ) )
357
  * @subpackage Main Class
358
  * @since 3.0
359
  * @param string $option Option name.
360
- * @param string $against String to match option.
361
  * @return boolean
362
  */
363
 
364
- function is_checked( $option = "", $against = "yes" ) {
365
  if ( $option == "" )
366
  return false;
367
 
368
  if ( ! isset( $this->options[$option] ) )
369
  return false;
370
 
371
- if ( $against == "" )
 
372
  return true;
373
- else {
374
- if ( $this->options[$option] == $against )
375
- return true;
376
- else
377
- return false;
378
- }
379
  }
380
 
381
  /**
@@ -415,6 +411,8 @@ if ( ! class_exists( 'MV_Dynamic_To_Top' ) )
415
  return true;
416
  }
417
  }
 
 
418
 
419
  return false;
420
  }
@@ -459,6 +457,8 @@ if ( ! class_exists( 'MV_Dynamic_To_Top' ) )
459
  $new_hex .= $new_hex_component;
460
  }
461
 
 
 
462
  return $new_hex;
463
  }
464
 
13
  {
14
  public $options;
15
  private $defaults = array(
16
+ 'speed' => 1000,
17
+ 'distance' => 200,
18
+ 'easing' => 'in-out',
19
+ 'position' => 'bottom-right',
20
+ 'padding_top_bottom' => '21',
21
+ 'padding_left_right' => '20',
22
+ 'font_size' => '1',
23
+ 'text_color' => '#fff',
24
+ 'bold' => '0',
25
+ 'text_shadow' => '0',
26
+ 'shadow_color' => '#111',
27
+ 'background_color' => '#272727',
28
+ 'border_color' => '#000',
29
+ 'border_width' => '1',
30
+ 'radius' => '9',
31
+ 'shadow' => '1',
32
+ 'inset' => '1',
33
+ 'text' => '0',
34
+ 'margin'=> 20,
35
+ 'text_version' => '0',
36
  );
37
 
38
  /**
85
  return;
86
  }
87
 
88
+ add_action( 'wp_enqueue_scripts', array( &$this,'enqueue_style' ) );
89
+ add_action( 'wp_enqueue_scripts', array( &$this,'enqueue_script' ) );
90
  }
91
 
92
  /**
169
 
170
  $css .= "/* Dynamic To Top Plugin ver. ".MV_DYNAMIC_TO_TOP_VERSION." - http://www.mattvarone.com */\n\n";
171
 
172
+ $css .= "body { position:relative; }
173
 
174
  #dynamic-to-top {
175
  display:none;
184
  color:".$this->options['text_color'].";
185
  text-decoration:none;\n";
186
 
187
+ if ( $this->is_checked( 'text_shadow' ) )
188
+ $css .= "text-shadow:0 1px 0 ".$this->options['shadow_color'].";\n";
189
 
190
+ if ( $this->is_checked( 'bold' ) )
191
+ $css .="font-weight:bold;\n";
192
 
193
  $css.= "padding:".$this->options['padding_top_bottom']."px ".$this->options['padding_left_right']."px;
194
  border:".$this->options['border_width']."px solid ".$this->options['border_color'].";
269
  overflow:hidden;
270
  width:14px;
271
  height:12px;
272
+ background:url( " . MV_DYNAMIC_TO_TOP_URL . "/css/images/up.png ) no-repeat center center;
273
  }";
274
 
275
  return $css;
279
  * Get Easing Type
280
  *
281
  * Returns the easing type function name.
282
+ * Used on the JS script. Old values support for backwards compatibility.
283
  *
284
  * @package Dynamic To Top
285
  * @subpackage Main Class
287
  * @return string $easing Name of easing function.
288
  */
289
 
290
+ function get_easing_type( $easing = "linear" ) {
291
  switch ( $this->options['easing'] )
292
  {
293
+ case ( $this->options['easing'] == 'Bounce' || $this->options['easing'] == 'bounce' ):
294
  $easing = "easeOutBounce";
295
  break;
296
 
297
+ case ( $this->options['easing'] == 'Elastic' || $this->options['easing'] == 'elastic' ):
298
  $easing = "easeInElastic";
299
  break;
300
 
301
+ case ( $this->options['easing'] == 'In' || $this->options['easing'] == 'in' ):
302
+ $easing = "easeInExpo";
303
  break;
304
 
305
+ case ( $this->options['easing'] == 'In Out' || $this->options['easing'] == 'in-out' ):
306
+ $easing = "easeInOutExpo";
307
  break;
308
 
309
+ case ( $this->options['easing'] == 'Out' || $this->options['easing'] == 'out' ):
310
  $easing = "easeOutExpo";
311
  break;
312
  }
317
  * Get Position
318
  *
319
  * Returns CSS properties for the selected position.
320
+ * Used on the CSS style. Old values support for backwards compatibility.
321
  *
322
  * @package Dynamic To Top
323
  * @subpackage Main Class
325
  * @return string $position Properties of the position selected.
326
  */
327
 
328
+ function get_position( $position = "" ) {
329
  switch ( $this->options['position'] )
330
  {
331
+ case ( $this->options['position'] == 'Bottom Right' || $this->options['position'] == 'bottom-right' ):
332
  $position = "bottom:".$this->options['margin']."px;right:".$this->options['margin']."px;top:auto;left:auto;";
333
  break;
334
 
335
+ case ( $this->options['position'] == 'Bottom Left' || $this->options['position'] == 'bottom-left' ):
336
  $position = "bottom:".$this->options['margin']."px;left:".$this->options['margin']."px;top:auto;right:auto;";
337
  break;
338
 
339
+ case ( $this->options['position'] == 'Top Right' || $this->options['position'] == 'top-right' ):
340
  $position = "top:".$this->options['margin']."px;right:".$this->options['margin']."px;bottom:auto;left:auto;";
341
  break;
342
 
343
+ case ( $this->options['position'] == 'Top Left' || $this->options['position'] == 'top-left' ):
344
  $position = "top:".$this->options['margin']."px;left:".$this->options['margin']."px;bottom:auto;right:auto;";
345
  break;
346
  }
357
  * @subpackage Main Class
358
  * @since 3.0
359
  * @param string $option Option name.
 
360
  * @return boolean
361
  */
362
 
363
+ function is_checked( $option = "" ) {
364
  if ( $option == "" )
365
  return false;
366
 
367
  if ( ! isset( $this->options[$option] ) )
368
  return false;
369
 
370
+ // Old values support for backwards compatibility.
371
+ if ( $this->options[$option] == '1' || $this->options[$option] == 'yes' || $this->options[$option] == 'Yes' )
372
  return true;
373
+ else
374
+ return false;
 
 
 
 
375
  }
376
 
377
  /**
411
  return true;
412
  }
413
  }
414
+
415
+ do_action( 'mv_dynamic_to_top_check_mobile' );
416
 
417
  return false;
418
  }
457
  $new_hex .= $new_hex_component;
458
  }
459
 
460
+ $new_hex = apply_filters( 'mv_dynamic_to_top_new_hex', $new_hex );
461
+
462
  return $new_hex;
463
  }
464
 
inc/dynamic-to-top-options.php CHANGED
@@ -24,7 +24,7 @@ if ( ! function_exists( 'mv_dynamic_to_top_create_options_page' ) )
24
 
25
  function mv_dynamic_to_top_create_options_page() {
26
  // Create Options Page
27
- add_options_page( 'Dynamic To Top Options', 'Dynamic To Top', 'manage_options', __FILE__, 'mv_dynamic_to_top_options_page' );
28
  }
29
  }
30
 
@@ -45,30 +45,30 @@ if ( ! function_exists( 'mv_dynamic_to_top_register_and_build_fields' ) )
45
  function mv_dynamic_to_top_register_and_build_fields() {
46
  register_setting( 'dynamic_to_top', 'dynamic_to_top', 'mv_dynamic_to_top_save_settings' );
47
 
48
- add_settings_section( 'settings_section', __( 'Behavior', MV_DYNAMIC_TO_TOP_DOMAIN ), '__return_true', __FILE__ );
49
- add_settings_section( 'appearance_section', __( 'Appearance', MV_DYNAMIC_TO_TOP_DOMAIN ), 'mv_dynamic_to_top_appearance_section', __FILE__ );
50
 
51
- add_settings_field( 'speed', __( 'Scroll time', MV_DYNAMIC_TO_TOP_DOMAIN ), 'mv_dynamic_to_top_field_scroll_time', __FILE__, 'settings_section' );
52
- add_settings_field( 'distance', __( 'Fade-in distance', MV_DYNAMIC_TO_TOP_DOMAIN ), 'mv_dynamic_to_top_field_distance', __FILE__, 'settings_section' );
53
- add_settings_field( 'easing', __( 'Easing', MV_DYNAMIC_TO_TOP_DOMAIN ), 'mv_dynamic_to_top_field_easing', __FILE__, 'settings_section' );
54
- add_settings_field( 'position', __( 'Position', MV_DYNAMIC_TO_TOP_DOMAIN ), 'mv_dynamic_to_top_field_position', __FILE__, 'settings_section' );
55
- add_settings_field( 'prevent_on_mobile', __( 'Prevent on mobile', MV_DYNAMIC_TO_TOP_DOMAIN ), 'mv_dynamic_to_top_field_prevent_on_mobile', __FILE__, 'settings_section' );
56
 
57
- add_settings_field( 'text_version', __( 'Text version', MV_DYNAMIC_TO_TOP_DOMAIN ), 'mv_dynamic_to_top_field_text_version', __FILE__, 'appearance_section' );
58
- add_settings_field( 'text', __( 'Button text', MV_DYNAMIC_TO_TOP_DOMAIN ), 'mv_dynamic_to_top_field_text', __FILE__, 'appearance_section' );
59
- add_settings_field( 'padding_top_bottom', __( 'Top/bottom padding', MV_DYNAMIC_TO_TOP_DOMAIN ), 'mv_dynamic_to_top_field_padding_top_bottom', __FILE__, 'appearance_section' );
60
- add_settings_field( 'padding_left_right', __( 'Sides padding', MV_DYNAMIC_TO_TOP_DOMAIN ), 'mv_dynamic_to_top_field_padding_left_right', __FILE__, 'appearance_section' );
61
- add_settings_field( 'font_size', __( 'Font size', MV_DYNAMIC_TO_TOP_DOMAIN ), 'mv_dynamic_to_top_field_font_size', __FILE__, 'appearance_section' );
62
- add_settings_field( 'text_color', __( 'Text color', MV_DYNAMIC_TO_TOP_DOMAIN ), 'mv_dynamic_to_top_field_text_color', __FILE__, 'appearance_section' );
63
- add_settings_field( 'bold', __( 'Bold Text', MV_DYNAMIC_TO_TOP_DOMAIN ), 'mv_dynamic_to_top_field_bold', __FILE__, 'appearance_section' );
64
- add_settings_field( 'text_shadow', __( 'Text shadow', MV_DYNAMIC_TO_TOP_DOMAIN ), 'mv_dynamic_to_top_field_text_shadow', __FILE__, 'appearance_section' );
65
- add_settings_field( 'shadow_color', __( 'Text shadow color', MV_DYNAMIC_TO_TOP_DOMAIN ), 'mv_dynamic_to_top_field_text_shadow_color', __FILE__, 'appearance_section' );
66
- add_settings_field( 'background_color', __( 'Background color', MV_DYNAMIC_TO_TOP_DOMAIN ), 'mv_dynamic_to_top_field_background_color', __FILE__, 'appearance_section' );
67
- add_settings_field( 'border_color', __( 'Border color', MV_DYNAMIC_TO_TOP_DOMAIN ), 'mv_dynamic_to_top_field_border_color', __FILE__, 'appearance_section' );
68
- add_settings_field( 'border_width', __( 'Border width', MV_DYNAMIC_TO_TOP_DOMAIN ), 'mv_dynamic_to_top_field_border_width', __FILE__, 'appearance_section' );
69
- add_settings_field( 'radius', __( 'Border radius', MV_DYNAMIC_TO_TOP_DOMAIN ), 'mv_dynamic_to_top_field_border_radius', __FILE__, 'appearance_section' );
70
- add_settings_field( 'inset', __( 'Inset highlighting', MV_DYNAMIC_TO_TOP_DOMAIN ), 'mv_dynamic_to_top_field_inset', __FILE__, 'appearance_section' );
71
- add_settings_field( 'shadow', __( 'Shadow', MV_DYNAMIC_TO_TOP_DOMAIN ), 'mv_dynamic_to_top_field_shadow', __FILE__, 'appearance_section' );
72
 
73
  }
74
  }
@@ -96,9 +96,9 @@ if ( ! function_exists( 'mv_dynamic_to_top_options_page' ) )
96
  ?>
97
  <div class="wrap">
98
  <?php screen_icon(); ?>
99
- <h2><?php _e( 'Dynamic To Top Options', MV_DYNAMIC_TO_TOP_DOMAIN ); ?></h2>
100
 
101
- <p><?php _e( 'Welcome to the <strong>Dynamic To Top</strong> plugin settings. Click <a href="http://www.mattvarone.com/featured-content/dynamic-to-top/" target="_blank">here</a> to learn more about this plugin.', MV_DYNAMIC_TO_TOP_DOMAIN ); ?></p>
102
 
103
 
104
  <form method="post" action="options.php" enctype="multipart/form-data">
@@ -106,10 +106,10 @@ if ( ! function_exists( 'mv_dynamic_to_top_options_page' ) )
106
  <?php do_settings_sections( __FILE__ ); ?>
107
 
108
  <p class="submit">
109
- <input name="Submit" type="submit" class="button-primary" value="<?php _e( 'Save Changes', MV_DYNAMIC_TO_TOP_DOMAIN ); ?>" />
110
  </p>
111
 
112
- <p><small><?php _e( '<strong>Dynamic To Top</strong> plugin brought to you by', MV_DYNAMIC_TO_TOP_DOMAIN ); ?> <a href="http://www.mattvarone.com" title="Matt Varone" target="_blank"><strong>Matt Varone</strong></a>.</small></p>
113
 
114
  </form>
115
  </div>
@@ -120,7 +120,7 @@ if ( ! function_exists( 'mv_dynamic_to_top_options_page' ) )
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', MV_DYNAMIC_TO_TOP_DOMAIN ).' <a href="#" title="black">'.__( 'black', MV_DYNAMIC_TO_TOP_DOMAIN ).'</a>, <a href="#" title="lightgrey">'.__( 'grey', MV_DYNAMIC_TO_TOP_DOMAIN ).'</a> or <a href="#" title="white">'.__( 'white', MV_DYNAMIC_TO_TOP_DOMAIN ).'</a>.</small></p>';
124
  }
125
  }
126
 
@@ -129,6 +129,24 @@ if ( ! function_exists( 'mv_dynamic_to_top_save_settings' ) ) {
129
  delete_transient( 'dynamic_to_top_transient_css' );
130
  delete_transient( 'dynamic_to_top_transient_js' );
131
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
132
  return $options;
133
  }
134
  }
@@ -157,7 +175,7 @@ if ( ! function_exists( 'mv_dynamic_to_top_styles' ) ) {
157
  }
158
  }
159
 
160
- add_action( 'admin_print_styles', 'mv_dynamic_to_top_styles' );
161
  }
162
 
163
  if ( ! function_exists( 'mv_dynamic_to_top_scripts' ) ) {
@@ -173,14 +191,16 @@ if ( ! function_exists( 'mv_dynamic_to_top_scripts' ) ) {
173
 
174
  function mv_dynamic_to_top_scripts() {
175
  if ( mv_dynamic_to_top_is_page_options() ) {
176
- wp_enqueue_script( 'jquery-ui-widget', MV_DYNAMIC_TO_TOP_URL.'/js/libs/jquery.ui.widget.js', array( 'jquery-ui-core' ), '1.8.14' );
177
- wp_enqueue_script( 'jquery-ui-mouse', MV_DYNAMIC_TO_TOP_URL.'/js/libs/jquery.ui.mouse.js', array( 'jquery-ui-widget' ), '1.8.14' );
178
- wp_enqueue_script( 'jquery-ui-slider', MV_DYNAMIC_TO_TOP_URL.'/js/libs/jquery.ui.slider.js', array( 'jquery-ui-mouse' ), '1.8.14' );
 
 
179
  wp_enqueue_script( 'dynamic-to-top-settings', MV_DYNAMIC_TO_TOP_URL.'/js/dynamic.to.top.settings.js', array( 'jquery-ui-slider', 'farbtastic' ), '1.0', true );
180
  }
181
  }
182
 
183
- add_action( 'admin_print_scripts', 'mv_dynamic_to_top_scripts' );
184
  }
185
 
186
  if ( ! function_exists( 'mv_dynamic_to_top_is_page_options' ) ) {
@@ -202,15 +222,15 @@ if ( ! function_exists( 'mv_dynamic_to_top_is_page_options' ) ) {
202
  if ( function_exists( 'get_current_screen' ) ) {
203
  $screen = get_current_screen();
204
 
205
- if ( isset( $screen->base ) && $screen->base == 'settings_page_'.MV_DYNAMIC_TO_TOP_FOLDER.'/inc/dynamic-to-top-options' )
206
  return true;
207
  else
208
  return false;
209
  }
210
  else {
211
- $pages = array( 'options-general.php' );
212
 
213
- if ( in_array( $pagenow, $pages ) && isset( $_GET['page'] ) && $_GET['page'] == MV_DYNAMIC_TO_TOP_FOLDER.'/inc/dynamic-to-top-options.php' )
214
  return true;
215
  }
216
 
@@ -236,7 +256,7 @@ if ( ! function_exists( 'mv_dynamic_to_top_field_border_color' ) ) {
236
  */
237
 
238
  function mv_dynamic_to_top_field_border_color() {
239
- echo mv_dynamic_to_top_do_textfield_color( 'border_color', '#000', __( 'Color for the button border.', MV_DYNAMIC_TO_TOP_DOMAIN ) );
240
  }
241
  }
242
 
@@ -250,7 +270,7 @@ if ( ! function_exists( 'mv_dynamic_to_top_field_background_color' ) ) {
250
  */
251
 
252
  function mv_dynamic_to_top_field_background_color() {
253
- echo mv_dynamic_to_top_do_textfield_color( 'background_color', '#111', __( 'Background color for the button.', MV_DYNAMIC_TO_TOP_DOMAIN ) );
254
  }
255
  }
256
 
@@ -264,7 +284,7 @@ if ( ! function_exists( 'mv_dynamic_to_top_field_text_color' ) ) {
264
  */
265
 
266
  function mv_dynamic_to_top_field_text_color() {
267
- echo mv_dynamic_to_top_do_textfield_color( 'text_color', '#fff', __( 'Button text color.', MV_DYNAMIC_TO_TOP_DOMAIN ) );
268
  }
269
  }
270
 
@@ -278,7 +298,7 @@ if ( ! function_exists( 'mv_dynamic_to_top_field_text_shadow_color' ) ) {
278
  */
279
 
280
  function mv_dynamic_to_top_field_text_shadow_color() {
281
- echo mv_dynamic_to_top_do_textfield_color( 'shadow_color', '#333', __( 'Text shadow color.', MV_DYNAMIC_TO_TOP_DOMAIN ) );
282
  }
283
  }
284
 
@@ -292,7 +312,7 @@ if ( ! function_exists( 'mv_dynamic_to_top_field_box_shadow_color' ) ) {
292
  */
293
 
294
  function mv_dynamic_to_top_field_box_shadow_color() {
295
- echo mv_dynamic_to_top_do_textfield_color( 'box_shadow_color', '#333', __( 'Text shadow color.', MV_DYNAMIC_TO_TOP_DOMAIN ) );
296
  }
297
  }
298
 
@@ -308,9 +328,16 @@ if ( ! function_exists( 'mv_dynamic_to_top_field_easing' ) ) {
308
  */
309
 
310
  function mv_dynamic_to_top_field_easing() {
311
- $options = array( 'Linear', 'In', 'Out', 'In Out', 'Bounce', 'Elastic' );
 
 
 
 
 
 
 
312
 
313
- echo mv_dynamic_to_top_do_select( 'easing', $options, 'In', __( '<a href="http://gsgd.co.uk/sandbox/jquery/easing" title="Easing type">Easing type</a> used to scroll the page up.', MV_DYNAMIC_TO_TOP_DOMAIN ) );
314
  }
315
  }
316
 
@@ -324,9 +351,14 @@ if ( ! function_exists( 'mv_dynamic_to_top_field_position' ) ) {
324
  */
325
 
326
  function mv_dynamic_to_top_field_position() {
327
- $options = array( 'Top Left', 'Top Right', 'Bottom Left', 'Bottom Right' );
 
 
 
 
 
328
 
329
- echo mv_dynamic_to_top_do_select( 'position', $options, 'Bottom Right', __( 'Button position.', MV_DYNAMIC_TO_TOP_DOMAIN ) );
330
  }
331
  }
332
 
@@ -342,7 +374,7 @@ if ( ! function_exists( 'mv_dynamic_to_top_field_scroll_time' ) ) {
342
  */
343
 
344
  function mv_dynamic_to_top_field_scroll_time() {
345
- echo mv_dynamic_to_top_do_slider( 'speed', 1100, __( 'Time it takes for the page to scroll up. Less for faster. ( <span id="speed-val"></span> Milliseconds )', MV_DYNAMIC_TO_TOP_DOMAIN ) );
346
  }
347
  }
348
 
@@ -356,7 +388,7 @@ if ( ! function_exists( 'mv_dynamic_to_top_field_font_size' ) ) {
356
  */
357
 
358
  function mv_dynamic_to_top_field_font_size() {
359
- echo mv_dynamic_to_top_do_slider( 'font_size', 1, __( 'Button text size. ( <span id="font-size-val"></span> Em/s )', MV_DYNAMIC_TO_TOP_DOMAIN ) );
360
  }
361
  }
362
 
@@ -370,7 +402,7 @@ if ( ! function_exists( 'mv_dynamic_to_top_field_padding_top_bottom' ) ) {
370
  */
371
 
372
  function mv_dynamic_to_top_field_padding_top_bottom() {
373
- echo mv_dynamic_to_top_do_slider( 'padding_top_bottom', 21, __( 'Spacing on Top and Bottom. ( <span id="padding-top-bottom-val"></span>px )', MV_DYNAMIC_TO_TOP_DOMAIN ) );
374
  }
375
  }
376
 
@@ -384,7 +416,7 @@ if ( ! function_exists( 'mv_dynamic_to_top_field_padding_left_right' ) ) {
384
  */
385
 
386
  function mv_dynamic_to_top_field_padding_left_right() {
387
- echo mv_dynamic_to_top_do_slider( 'padding_left_right', 19, __( 'Spacing on Left and Right. ( <span id="padding-left-right-val"></span>px )', MV_DYNAMIC_TO_TOP_DOMAIN ) );
388
  }
389
  }
390
 
@@ -398,7 +430,7 @@ if ( ! function_exists( 'mv_dynamic_to_top_field_border_width' ) ) {
398
  */
399
 
400
  function mv_dynamic_to_top_field_border_width() {
401
- echo mv_dynamic_to_top_do_slider( 'border_width', '1', __( 'Button border width', MV_DYNAMIC_TO_TOP_DOMAIN ).' <span id="border-val"></span>px.' );
402
  }
403
  }
404
 
@@ -412,7 +444,7 @@ if ( ! function_exists( 'mv_dynamic_to_top_field_border_radius' ) ) {
412
  */
413
 
414
  function mv_dynamic_to_top_field_border_radius() {
415
- echo mv_dynamic_to_top_do_slider( 'radius', '9', __( 'Button border radius', MV_DYNAMIC_TO_TOP_DOMAIN ).' <span id="radius-val"></span>px.' );
416
  }
417
  }
418
 
@@ -428,7 +460,7 @@ if ( ! function_exists( 'mv_dynamic_to_top_field_distance' ) ) {
428
  */
429
 
430
  function mv_dynamic_to_top_field_distance() {
431
- echo mv_dynamic_to_top_do_textfield( 'distance', 300, __( 'Distance from top to show the button. ( Pixels )', MV_DYNAMIC_TO_TOP_DOMAIN ) );
432
  }
433
  }
434
 
@@ -442,7 +474,7 @@ if ( ! function_exists( 'mv_dynamic_to_top_field_text' ) ) {
442
  */
443
 
444
  function mv_dynamic_to_top_field_text() {
445
- echo mv_dynamic_to_top_do_textfield( 'text', __( 'To Top', MV_DYNAMIC_TO_TOP_DOMAIN ), __( 'Text displayed on the button.', MV_DYNAMIC_TO_TOP_DOMAIN ), 'regular-text' );
446
  }
447
  }
448
 
@@ -458,7 +490,7 @@ if ( ! function_exists( 'mv_dynamic_to_top_field_prevent_on_mobile' ) ) {
458
  */
459
 
460
  function mv_dynamic_to_top_field_prevent_on_mobile() {
461
- echo mv_dynamic_to_top_do_checkbox( 'prevent_on_mobile', __( 'Yes', MV_DYNAMIC_TO_TOP_DOMAIN ), 'yes', false, __( 'Disable the button on mobile browsers.', MV_DYNAMIC_TO_TOP_DOMAIN ) );
462
  }
463
  }
464
 
@@ -472,7 +504,7 @@ if ( ! function_exists( 'mv_dynamic_to_top_field_text_version' ) ) {
472
  */
473
 
474
  function mv_dynamic_to_top_field_text_version() {
475
- echo mv_dynamic_to_top_do_checkbox( 'text_version', __( 'Yes', MV_DYNAMIC_TO_TOP_DOMAIN ), 'yes', false, __( 'Show a text version instead of the arrow up icon.', MV_DYNAMIC_TO_TOP_DOMAIN ) );
476
  }
477
  }
478
 
@@ -486,7 +518,7 @@ if ( ! function_exists( 'mv_dynamic_to_top_field_inset' ) ) {
486
  */
487
 
488
  function mv_dynamic_to_top_field_inset() {
489
- echo mv_dynamic_to_top_do_checkbox( 'inset', __( 'Yes', MV_DYNAMIC_TO_TOP_DOMAIN ), 'yes', true, __( 'Add CSS3 inset-highlight.', MV_DYNAMIC_TO_TOP_DOMAIN ) );
490
  }
491
  }
492
 
@@ -500,7 +532,7 @@ if ( ! function_exists( 'mv_dynamic_to_top_field_shadow' ) ) {
500
  */
501
 
502
  function mv_dynamic_to_top_field_shadow() {
503
- echo mv_dynamic_to_top_do_checkbox( 'shadow', __( 'Yes', MV_DYNAMIC_TO_TOP_DOMAIN ), 'yes', true, __( 'Add CSS3 shadow.', MV_DYNAMIC_TO_TOP_DOMAIN ) );
504
  }
505
  }
506
 
@@ -514,7 +546,7 @@ if ( ! function_exists( 'mv_dynamic_to_top_field_weight' ) ) {
514
  */
515
 
516
  function mv_dynamic_to_top_field_bold() {
517
- echo mv_dynamic_to_top_do_checkbox( 'bold', __( 'Yes', MV_DYNAMIC_TO_TOP_DOMAIN ), 'yes', true, __( 'Make the text bold.', MV_DYNAMIC_TO_TOP_DOMAIN ) );
518
  }
519
  }
520
 
@@ -528,7 +560,7 @@ if ( ! function_exists( 'mv_dynamic_to_top_field_text_shadow' ) ) {
528
  */
529
 
530
  function mv_dynamic_to_top_field_text_shadow() {
531
- echo mv_dynamic_to_top_do_checkbox( 'text_shadow', __( 'Yes', MV_DYNAMIC_TO_TOP_DOMAIN ), 'yes', true, __( 'Add a subtle text shadow.', MV_DYNAMIC_TO_TOP_DOMAIN ) );
532
  }
533
  }
534
  /*
@@ -550,23 +582,30 @@ if ( ! function_exists( 'mv_dynamic_to_top_do_checkbox' ) ) {
550
  *
551
  */
552
 
553
- function mv_dynamic_to_top_do_checkbox( $meta, $label="Yes", $value='yes', $checked=false, $desc="" )
554
  {
555
 
556
  $options_db = get_option( 'dynamic_to_top' );
557
-
558
- if ( isset( $options_db[$meta] ) && $options_db[$meta] == $value )
559
- $c = 'checked="checked"';
560
- else
561
- $c="";
562
-
 
 
 
 
 
 
 
563
 
564
  if ( $desc != "" )
565
  $desc = '<div class="desc">'.$desc.'</div>';
566
 
567
  $sanitized_meta_title = str_replace( '_', '-', sanitize_title( $meta ) );
568
 
569
- return '<input type="checkbox" name="dynamic_to_top['.$meta.']" value="'.$value.'" '.$c.' id="checkbox-'.$sanitized_meta_title.'" /> '.$label.$desc;
570
  }
571
  }
572
 
@@ -628,7 +667,7 @@ if ( ! function_exists( 'mv_dynamic_to_top_do_select' ) ) {
628
 
629
  $value = sanitize_title( $value );
630
 
631
- foreach ( $options as $option )
632
  {
633
  $selected = "";
634
 
@@ -637,7 +676,7 @@ if ( ! function_exists( 'mv_dynamic_to_top_do_select' ) ) {
637
  if ( $value == $option_slug )
638
  $selected = 'selected="selected"';
639
 
640
- $options_out .= '<option name="'.sanitize_title( $option ).'" '.$selected.' >'.$option.'</option>';
641
  }
642
 
643
  if ( $desc != "" )
@@ -681,7 +720,7 @@ if ( ! function_exists( 'mv_dynamic_to_top_do_textfield_color' ) ) {
681
  $sanitized_meta_title = str_replace( '_', '-', sanitize_title( $meta ) );
682
 
683
  $out = '<input type="text" name="dynamic_to_top['.$meta.']" id="farbtastic-'.$sanitized_meta_title.'" '.$class.' value="'.$value.'" />';
684
- $out .= '<a class="picker hide-if-no-js" href="#" data-closed="'.__( 'close', MV_DYNAMIC_TO_TOP_DOMAIN ).'" data-open="'.__( 'select a color', MV_DYNAMIC_TO_TOP_DOMAIN ).'">'.__( 'select a color', MV_DYNAMIC_TO_TOP_DOMAIN ).'</a>';
685
  $out .= '<div id="farbtastic-picker-'.$sanitized_meta_title.'" class="dtt-farbtastic"></div>';
686
  $out .= $desc;
687
 
24
 
25
  function mv_dynamic_to_top_create_options_page() {
26
  // Create Options Page
27
+ add_theme_page( __( 'Dynamic To Top Options', 'dynamic-to-top' ), __( 'To Top', 'dynamic-to-top' ), 'manage_options', __FILE__, 'mv_dynamic_to_top_options_page' );
28
  }
29
  }
30
 
45
  function mv_dynamic_to_top_register_and_build_fields() {
46
  register_setting( 'dynamic_to_top', 'dynamic_to_top', 'mv_dynamic_to_top_save_settings' );
47
 
48
+ add_settings_section( 'settings_section', __( 'Behavior', 'dynamic-to-top' ), '__return_true', __FILE__ );
49
+ add_settings_section( 'appearance_section', __( 'Appearance', 'dynamic-to-top' ), 'mv_dynamic_to_top_appearance_section', __FILE__ );
50
 
51
+ add_settings_field( 'speed', __( 'Scroll time', 'dynamic-to-top' ), 'mv_dynamic_to_top_field_scroll_time', __FILE__, 'settings_section' );
52
+ add_settings_field( 'distance', __( 'Fade-in distance', 'dynamic-to-top' ), 'mv_dynamic_to_top_field_distance', __FILE__, 'settings_section' );
53
+ add_settings_field( 'easing', __( 'Easing', 'dynamic-to-top' ), 'mv_dynamic_to_top_field_easing', __FILE__, 'settings_section' );
54
+ add_settings_field( 'position', __( 'Position', 'dynamic-to-top' ), 'mv_dynamic_to_top_field_position', __FILE__, 'settings_section' );
55
+ add_settings_field( 'prevent_on_mobile', __( 'Prevent on mobile', 'dynamic-to-top' ), 'mv_dynamic_to_top_field_prevent_on_mobile', __FILE__, 'settings_section' );
56
 
57
+ add_settings_field( 'text_version', __( 'Text version', 'dynamic-to-top' ), 'mv_dynamic_to_top_field_text_version', __FILE__, 'appearance_section' );
58
+ add_settings_field( 'text', __( 'Button text', 'dynamic-to-top' ), 'mv_dynamic_to_top_field_text', __FILE__, 'appearance_section' );
59
+ add_settings_field( 'padding_top_bottom', __( 'Top/bottom padding', 'dynamic-to-top' ), 'mv_dynamic_to_top_field_padding_top_bottom', __FILE__, 'appearance_section' );
60
+ add_settings_field( 'padding_left_right', __( 'Sides padding', 'dynamic-to-top' ), 'mv_dynamic_to_top_field_padding_left_right', __FILE__, 'appearance_section' );
61
+ add_settings_field( 'font_size', __( 'Font size', 'dynamic-to-top' ), 'mv_dynamic_to_top_field_font_size', __FILE__, 'appearance_section' );
62
+ add_settings_field( 'text_color', __( 'Text color', 'dynamic-to-top' ), 'mv_dynamic_to_top_field_text_color', __FILE__, 'appearance_section' );
63
+ add_settings_field( 'bold', __( 'Bold Text', 'dynamic-to-top' ), 'mv_dynamic_to_top_field_bold', __FILE__, 'appearance_section' );
64
+ add_settings_field( 'text_shadow', __( 'Text shadow', 'dynamic-to-top' ), 'mv_dynamic_to_top_field_text_shadow', __FILE__, 'appearance_section' );
65
+ add_settings_field( 'shadow_color', __( 'Text shadow color', 'dynamic-to-top' ), 'mv_dynamic_to_top_field_text_shadow_color', __FILE__, 'appearance_section' );
66
+ add_settings_field( 'background_color', __( 'Background color', 'dynamic-to-top' ), 'mv_dynamic_to_top_field_background_color', __FILE__, 'appearance_section' );
67
+ add_settings_field( 'border_color', __( 'Border color', 'dynamic-to-top' ), 'mv_dynamic_to_top_field_border_color', __FILE__, 'appearance_section' );
68
+ add_settings_field( 'border_width', __( 'Border width', 'dynamic-to-top' ), 'mv_dynamic_to_top_field_border_width', __FILE__, 'appearance_section' );
69
+ add_settings_field( 'radius', __( 'Border radius', 'dynamic-to-top' ), 'mv_dynamic_to_top_field_border_radius', __FILE__, 'appearance_section' );
70
+ add_settings_field( 'inset', __( 'Inset highlighting', 'dynamic-to-top' ), 'mv_dynamic_to_top_field_inset', __FILE__, 'appearance_section' );
71
+ add_settings_field( 'shadow', __( 'Shadow', 'dynamic-to-top' ), 'mv_dynamic_to_top_field_shadow', __FILE__, 'appearance_section' );
72
 
73
  }
74
  }
96
  ?>
97
  <div class="wrap">
98
  <?php screen_icon(); ?>
99
+ <h2><?php _e( 'Dynamic To Top Options', 'dynamic-to-top' ); ?></h2>
100
 
101
+ <p><?php _e( 'Welcome to the <strong>Dynamic To Top</strong> plugin settings. Click <a href="http://www.mattvarone.com/featured-content/dynamic-to-top/" target="_blank">here</a> to learn more about this plugin.', 'dynamic-to-top' ); ?></p>
102
 
103
 
104
  <form method="post" action="options.php" enctype="multipart/form-data">
106
  <?php do_settings_sections( __FILE__ ); ?>
107
 
108
  <p class="submit">
109
+ <input name="Submit" type="submit" class="button-primary" value="<?php _e( 'Save Changes', 'dynamic-to-top' ); ?>" />
110
  </p>
111
 
112
+ <p><small><?php _e( '<strong>Dynamic To Top</strong> plugin brought to you by', 'dynamic-to-top' ); ?> <a href="http://www.mattvarone.com" title="Matt Varone" target="_blank"><strong>Matt Varone</strong></a> | <a href="http://www.mattvarone.com/donate" title="Tea for Matt!" target="_blank"><strong><?php _e( 'Donate', 'dynamic-to-top' ); ?></strong></a> &hearts;.</small></p>
113
 
114
  </form>
115
  </div>
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>';
124
  }
125
  }
126
 
129
  delete_transient( 'dynamic_to_top_transient_css' );
130
  delete_transient( 'dynamic_to_top_transient_js' );
131
 
132
+ if ( ! isset($options['prevent_on_mobile']))
133
+ $options['prevent_on_mobile'] = "0";
134
+
135
+ if ( ! isset($options['text_version']))
136
+ $options['text_version'] = "0";
137
+
138
+ if ( ! isset($options['inset']))
139
+ $options['inset'] = "0";
140
+
141
+ if ( ! isset($options['shadow']))
142
+ $options['shadow'] = "0";
143
+
144
+ if ( ! isset($options['bold']))
145
+ $options['bold'] = "0";
146
+
147
+ if ( ! isset($options['text_shadow']))
148
+ $options['text_shadow'] = "0";
149
+
150
  return $options;
151
  }
152
  }
175
  }
176
  }
177
 
178
+ add_action( 'admin_enqueue_scripts', 'mv_dynamic_to_top_styles' );
179
  }
180
 
181
  if ( ! function_exists( 'mv_dynamic_to_top_scripts' ) ) {
191
 
192
  function mv_dynamic_to_top_scripts() {
193
  if ( mv_dynamic_to_top_is_page_options() ) {
194
+ if ( version_compare( get_bloginfo( 'version' ),'3.2.9.9','<' ) ) {
195
+ wp_enqueue_script( 'jquery-ui-widget', MV_DYNAMIC_TO_TOP_URL.'/js/libs/jquery.ui.widget.js', array( 'jquery-ui-core' ), '1.8.14' );
196
+ wp_enqueue_script( 'jquery-ui-mouse', MV_DYNAMIC_TO_TOP_URL.'/js/libs/jquery.ui.mouse.js', array( 'jquery-ui-widget' ), '1.8.14' );
197
+ wp_enqueue_script( 'jquery-ui-slider', MV_DYNAMIC_TO_TOP_URL.'/js/libs/jquery.ui.slider.js', array( 'jquery-ui-mouse' ), '1.8.14' );
198
+ }
199
  wp_enqueue_script( 'dynamic-to-top-settings', MV_DYNAMIC_TO_TOP_URL.'/js/dynamic.to.top.settings.js', array( 'jquery-ui-slider', 'farbtastic' ), '1.0', true );
200
  }
201
  }
202
 
203
+ add_action( 'admin_enqueue_scripts', 'mv_dynamic_to_top_scripts' );
204
  }
205
 
206
  if ( ! function_exists( 'mv_dynamic_to_top_is_page_options' ) ) {
222
  if ( function_exists( 'get_current_screen' ) ) {
223
  $screen = get_current_screen();
224
 
225
+ if ( isset( $screen->base ) && $screen->base == 'appearance_page_' . MV_DYNAMIC_TO_TOP_FOLDER . '/inc/dynamic-to-top-options' )
226
  return true;
227
  else
228
  return false;
229
  }
230
  else {
231
+ $pages = array( 'themes.php' );
232
 
233
+ if ( in_array( $pagenow, $pages ) && isset( $_GET['page'] ) && $_GET['page'] == MV_DYNAMIC_TO_TOP_FOLDER . '/inc/dynamic-to-top-options.php' )
234
  return true;
235
  }
236
 
256
  */
257
 
258
  function mv_dynamic_to_top_field_border_color() {
259
+ echo mv_dynamic_to_top_do_textfield_color( 'border_color', '#000', __( 'Color for the button border.', 'dynamic-to-top' ) );
260
  }
261
  }
262
 
270
  */
271
 
272
  function mv_dynamic_to_top_field_background_color() {
273
+ echo mv_dynamic_to_top_do_textfield_color( 'background_color', '#111', __( 'Background color for the button.', 'dynamic-to-top' ) );
274
  }
275
  }
276
 
284
  */
285
 
286
  function mv_dynamic_to_top_field_text_color() {
287
+ echo mv_dynamic_to_top_do_textfield_color( 'text_color', '#fff', __( 'Button text color.', 'dynamic-to-top' ) );
288
  }
289
  }
290
 
298
  */
299
 
300
  function mv_dynamic_to_top_field_text_shadow_color() {
301
+ echo mv_dynamic_to_top_do_textfield_color( 'shadow_color', '#333', __( 'Text shadow color.', 'dynamic-to-top' ) );
302
  }
303
  }
304
 
312
  */
313
 
314
  function mv_dynamic_to_top_field_box_shadow_color() {
315
+ echo mv_dynamic_to_top_do_textfield_color( 'box_shadow_color', '#333', __( 'Text shadow color.', 'dynamic-to-top' ) );
316
  }
317
  }
318
 
328
  */
329
 
330
  function mv_dynamic_to_top_field_easing() {
331
+ $options = array(
332
+ 'linear' => __( 'Linear', 'dynamic-to-top' ),
333
+ 'in' => __( 'In', 'dynamic-to-top' ),
334
+ 'out' => __( 'Out', 'dynamic-to-top' ),
335
+ 'in-out' => __( 'In Out', 'dynamic-to-top' ),
336
+ 'bounce' => __( 'Bounce', 'dynamic-to-top' ),
337
+ 'elastic' => __( 'Elastic', 'dynamic-to-top' )
338
+ );
339
 
340
+ echo mv_dynamic_to_top_do_select( 'easing', $options, 'in', __( '<a href="http://gsgd.co.uk/sandbox/jquery/easing" title="Easing type">Easing type</a> used to scroll the page up.', 'dynamic-to-top' ) );
341
  }
342
  }
343
 
351
  */
352
 
353
  function mv_dynamic_to_top_field_position() {
354
+ $options = array(
355
+ 'top-left' => __( 'Top Left', 'dynamic-to-top' ),
356
+ 'top-right' => __( 'Top Right', 'dynamic-to-top' ),
357
+ 'bottom-left' => __( 'Bottom Left', 'dynamic-to-top' ),
358
+ 'bottom-right' => __( 'Bottom Right', 'dynamic-to-top' ),
359
+ );
360
 
361
+ echo mv_dynamic_to_top_do_select( 'position', $options, 'bottom-right', __( 'Button position.', 'dynamic-to-top' ) );
362
  }
363
  }
364
 
374
  */
375
 
376
  function mv_dynamic_to_top_field_scroll_time() {
377
+ echo mv_dynamic_to_top_do_slider( 'speed', 1100, __( 'Time it takes for the page to scroll up. Less for faster. ( <span id="speed-val"></span> Milliseconds )', 'dynamic-to-top' ) );
378
  }
379
  }
380
 
388
  */
389
 
390
  function mv_dynamic_to_top_field_font_size() {
391
+ echo mv_dynamic_to_top_do_slider( 'font_size', 1, __( 'Button text size. ( <span id="font-size-val"></span> Em/s )', 'dynamic-to-top' ) );
392
  }
393
  }
394
 
402
  */
403
 
404
  function mv_dynamic_to_top_field_padding_top_bottom() {
405
+ echo mv_dynamic_to_top_do_slider( 'padding_top_bottom', 21, __( 'Spacing on Top and Bottom. ( <span id="padding-top-bottom-val"></span>px )', 'dynamic-to-top' ) );
406
  }
407
  }
408
 
416
  */
417
 
418
  function mv_dynamic_to_top_field_padding_left_right() {
419
+ echo mv_dynamic_to_top_do_slider( 'padding_left_right', 19, __( 'Spacing on Left and Right. ( <span id="padding-left-right-val"></span>px )', 'dynamic-to-top' ) );
420
  }
421
  }
422
 
430
  */
431
 
432
  function mv_dynamic_to_top_field_border_width() {
433
+ echo mv_dynamic_to_top_do_slider( 'border_width', '1', __( 'Button border width', 'dynamic-to-top' ).' <span id="border-val"></span>px.' );
434
  }
435
  }
436
 
444
  */
445
 
446
  function mv_dynamic_to_top_field_border_radius() {
447
+ echo mv_dynamic_to_top_do_slider( 'radius', '9', __( 'Button border radius', 'dynamic-to-top' ).' <span id="radius-val"></span>px.' );
448
  }
449
  }
450
 
460
  */
461
 
462
  function mv_dynamic_to_top_field_distance() {
463
+ echo mv_dynamic_to_top_do_textfield( 'distance', 300, __( 'Distance from top to show the button. ( Pixels )', 'dynamic-to-top' ) );
464
  }
465
  }
466
 
474
  */
475
 
476
  function mv_dynamic_to_top_field_text() {
477
+ echo mv_dynamic_to_top_do_textfield( 'text', __( 'To Top', 'dynamic-to-top' ), __( 'Text displayed on the button.', 'dynamic-to-top' ), 'regular-text' );
478
  }
479
  }
480
 
490
  */
491
 
492
  function mv_dynamic_to_top_field_prevent_on_mobile() {
493
+ echo mv_dynamic_to_top_do_checkbox( 'prevent_on_mobile', __( 'Yes', 'dynamic-to-top' ), false, __( 'Disable the button on mobile browsers.', 'dynamic-to-top' ) );
494
  }
495
  }
496
 
504
  */
505
 
506
  function mv_dynamic_to_top_field_text_version() {
507
+ echo mv_dynamic_to_top_do_checkbox( 'text_version', __( 'Yes', 'dynamic-to-top' ), false, __( 'Show a text version instead of the arrow up icon.', 'dynamic-to-top' ) );
508
  }
509
  }
510
 
518
  */
519
 
520
  function mv_dynamic_to_top_field_inset() {
521
+ echo mv_dynamic_to_top_do_checkbox( 'inset', __( 'Yes', 'dynamic-to-top' ), true, __( 'Add CSS3 inset-highlight.', 'dynamic-to-top' ) );
522
  }
523
  }
524
 
532
  */
533
 
534
  function mv_dynamic_to_top_field_shadow() {
535
+ echo mv_dynamic_to_top_do_checkbox( 'shadow', __( 'Yes', 'dynamic-to-top' ), true, __( 'Add a CSS3 shadow.', 'dynamic-to-top' ) );
536
  }
537
  }
538
 
546
  */
547
 
548
  function mv_dynamic_to_top_field_bold() {
549
+ echo mv_dynamic_to_top_do_checkbox( 'bold', __( 'Yes', 'dynamic-to-top' ), true, __( 'Make the text bold.', 'dynamic-to-top' ) );
550
  }
551
  }
552
 
560
  */
561
 
562
  function mv_dynamic_to_top_field_text_shadow() {
563
+ echo mv_dynamic_to_top_do_checkbox( 'text_shadow', __( 'Yes', 'dynamic-to-top' ), true, __( 'Add a subtle text shadow.', 'dynamic-to-top' ) );
564
  }
565
  }
566
  /*
582
  *
583
  */
584
 
585
+ function mv_dynamic_to_top_do_checkbox( $meta, $label="Yes", $checked=false, $desc="" )
586
  {
587
 
588
  $options_db = get_option( 'dynamic_to_top' );
589
+
590
+ if ( isset( $options_db[$meta] ) ) {
591
+ // Old values support for backwards compatibility.
592
+ if ( $options_db[$meta] == "1" || $options_db[$meta] == 'yes' || $options_db[$meta] == 'Yes' )
593
+ $c = 'checked="checked"';
594
+ else
595
+ $c = '';
596
+ } else {
597
+ if ( $checked == true )
598
+ $c = 'checked="checked"';
599
+ else
600
+ $c = '';
601
+ }
602
 
603
  if ( $desc != "" )
604
  $desc = '<div class="desc">'.$desc.'</div>';
605
 
606
  $sanitized_meta_title = str_replace( '_', '-', sanitize_title( $meta ) );
607
 
608
+ return '<input type="checkbox" name="dynamic_to_top['.$meta.']" value="1" '.$c.' id="checkbox-'.$sanitized_meta_title.'" /> '.$label.$desc;
609
  }
610
  }
611
 
667
 
668
  $value = sanitize_title( $value );
669
 
670
+ foreach ( $options as $option => $label )
671
  {
672
  $selected = "";
673
 
676
  if ( $value == $option_slug )
677
  $selected = 'selected="selected"';
678
 
679
+ $options_out .= '<option name="'.sanitize_title( $option ).'" '.$selected.' >'.$label.'</option>';
680
  }
681
 
682
  if ( $desc != "" )
720
  $sanitized_meta_title = str_replace( '_', '-', sanitize_title( $meta ) );
721
 
722
  $out = '<input type="text" name="dynamic_to_top['.$meta.']" id="farbtastic-'.$sanitized_meta_title.'" '.$class.' value="'.$value.'" />';
723
+ $out .= '<a class="picker hide-if-no-js" href="#" data-closed="'.__( 'close', 'dynamic-to-top' ).'" data-open="'.__( 'select a color', 'dynamic-to-top' ).'">'.__( 'select a color', 'dynamic-to-top' ).'</a>';
724
  $out .= '<div id="farbtastic-picker-'.$sanitized_meta_title.'" class="dtt-farbtastic"></div>';
725
  $out .= $desc;
726
 
js/dynamic.to.top.dev.js CHANGED
@@ -1,45 +1,50 @@
1
- ;/*
2
  * Dynamic To Top Plugin
3
  * http://www.mattvarone.com
4
  *
5
  * By Matt Varone
6
  * @sksmatt
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,
14
- min: mv_dynamic_to_top.min,
15
- fade_in:600,
16
- fade_out:400,
17
- speed: mv_dynamic_to_top.speed,
18
- easing: mv_dynamic_to_top.easing,
19
- version: mv_dynamic_to_top.version,
20
- id:'dynamic-to-top'
21
- };
22
- var settings = $.extend(defaults, options);
23
- if (settings.version == ""){settings.text = '<span>&nbsp;</span>';}
24
- var $toTop = $('<a href=\"#\" id=\"'+settings.id+'\"></a>').html(settings.text);
25
- $('body').append($toTop);
26
- $toTop.hide().click(function(){
27
- $('html, body').stop().animate({scrollTop:0},settings.speed,settings.easing);
28
- return false;
29
- });
30
- $(window).scroll(function() {
31
- var sd = jQuery(window).scrollTop();
32
- if(typeof document.body.style.maxHeight === "undefined") {
33
- $toTop.css({
34
- 'position': 'absolute',
35
- 'top': jQuery(window).scrollTop()+$(window).height()-mv_dynamic_to_top.margin
36
- });
37
- }
38
- if ( sd > settings.min ){
39
- $toTop.fadeIn(settings.fade_in);
40
- }else{
41
- $toTop.fadeOut(settings.fade_out);}
42
- });
43
- };
44
- $('body').DynamicToTop();
 
 
 
 
 
45
  })(jQuery);
1
+ /*
2
  * Dynamic To Top Plugin
3
  * http://www.mattvarone.com
4
  *
5
  * By Matt Varone
6
  * @sksmatt
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,
14
+ min: mv_dynamic_to_top.min,
15
+ fade_in: 600,
16
+ fade_out: 400,
17
+ speed: mv_dynamic_to_top.speed,
18
+ easing: mv_dynamic_to_top.easing,
19
+ version: mv_dynamic_to_top.version,
20
+ id: 'dynamic-to-top'
21
+ },
22
+ settings = $.extend(defaults, options);
23
+ if (settings.version === "" || settings.version === '0') {
24
+ settings.text = '<span>&nbsp;</span>';
25
+ }
26
+ var $toTop = $('<a href=\"#\" id=\"' + settings.id + '\"></a>').html(settings.text);
27
+ $('body').append($toTop);
28
+ $toTop.hide().click(function () {
29
+ $('html, body').stop().animate({
30
+ scrollTop: 0
31
+ }, settings.speed, settings.easing);
32
+ return false;
33
+ });
34
+ $(window).scroll(function () {
35
+ var sd = jQuery(window).scrollTop();
36
+ if (typeof document.body.style.maxHeight === "undefined") {
37
+ $toTop.css({
38
+ 'position': 'absolute',
39
+ 'top': jQuery(window).scrollTop() + $(window).height() - mv_dynamic_to_top.margin
40
+ });
41
+ }
42
+ if (sd > settings.min) {
43
+ $toTop.fadeIn(settings.fade_in);
44
+ } else {
45
+ $toTop.fadeOut(settings.fade_out);
46
+ }
47
+ });
48
+ };
49
+ $('body').DynamicToTop();
50
  })(jQuery);
js/dynamic.to.top.min.js CHANGED
@@ -1,4 +1,11 @@
1
- /* Dynamic To Top Plugin | http://www.mattvarone.com | @sksmatt */
2
- ;var mv_dynamic_to_top;(function($){jQuery.fn.DynamicToTop=function(options){var defaults={text:mv_dynamic_to_top.text,min:mv_dynamic_to_top.min,fade_in:600,fade_out:400,speed:mv_dynamic_to_top.speed,easing:mv_dynamic_to_top.easing,version:mv_dynamic_to_top.version,id:'dynamic-to-top'};var settings=$.extend(defaults,options);if(settings.version==""){settings.text='<span>&nbsp;</span>';}
 
 
 
 
 
 
 
3
  var $toTop=$('<a href=\"#\" id=\"'+settings.id+'\"></a>').html(settings.text);$('body').append($toTop);$toTop.hide().click(function(){$('html, body').stop().animate({scrollTop:0},settings.speed,settings.easing);return false;});$(window).scroll(function(){var sd=jQuery(window).scrollTop();if(typeof document.body.style.maxHeight==="undefined"){$toTop.css({'position':'absolute','top':jQuery(window).scrollTop()+$(window).height()-mv_dynamic_to_top.margin});}
4
  if(sd>settings.min){$toTop.fadeIn(settings.fade_in);}else{$toTop.fadeOut(settings.fade_out);}});};$('body').DynamicToTop();})(jQuery);
1
+ /*
2
+ * Dynamic To Top Plugin
3
+ * http://www.mattvarone.com
4
+ *
5
+ * By Matt Varone
6
+ * @sksmatt
7
+ *
8
+ */
9
+ var mv_dynamic_to_top;(function($){jQuery.fn.DynamicToTop=function(options){var defaults={text:mv_dynamic_to_top.text,min:mv_dynamic_to_top.min,fade_in:600,fade_out:400,speed:mv_dynamic_to_top.speed,easing:mv_dynamic_to_top.easing,version:mv_dynamic_to_top.version,id:'dynamic-to-top'},settings=$.extend(defaults,options);if(settings.version===""||settings.version==="0"){settings.text='<span>&nbsp;</span>';}
10
  var $toTop=$('<a href=\"#\" id=\"'+settings.id+'\"></a>').html(settings.text);$('body').append($toTop);$toTop.hide().click(function(){$('html, body').stop().animate({scrollTop:0},settings.speed,settings.easing);return false;});$(window).scroll(function(){var sd=jQuery(window).scrollTop();if(typeof document.body.style.maxHeight==="undefined"){$toTop.css({'position':'absolute','top':jQuery(window).scrollTop()+$(window).height()-mv_dynamic_to_top.margin});}
11
  if(sd>settings.min){$toTop.fadeIn(settings.fade_in);}else{$toTop.fadeOut(settings.fade_out);}});};$('body').DynamicToTop();})(jQuery);
js/dynamic.to.top.settings.js CHANGED
@@ -1,4 +1,4 @@
1
- ;/*
2
  * Dynamic To Top Plugin Settings
3
  * http://www.mattvarone.com
4
  *
@@ -6,260 +6,298 @@
6
  * @sksmatt
7
  *
8
  */
9
- jQuery(document).ready(function() {
10
-
11
- var preview = jQuery('#dynamic-to-top-button');
12
- var preview_button_version = jQuery('#dynamic-to-top-button #dtt-image');
13
- var preview_text_version = jQuery('#dynamic-to-top-button #dtt-text');
14
- var hide_on_button = jQuery('#text-text, #slider-font-size, #checkbox-bold, #checkbox-text-shadow, #farbtastic-text-color, #farbtastic-shadow-color').parent().parent();
15
-
16
- jQuery('#checkbox-text-version').click(function(){toggle_text_version();});
17
-
18
- toggle_text_version();
19
- update_preview();
20
- update_position();
21
-
22
- var update_fields = '#checkbox-bold, #checkbox-inset, #checkbox-shadow, #checkbox-text-shadow, .colorvalue';
23
-
24
- jQuery(update_fields).change(function(){update_preview()});
25
- jQuery('#select-position').change(function(){update_position();});
26
-
27
- jQuery('#text-text').keyup(function(){update_preview()});
28
-
29
- jQuery('.ddt-bg-colors a').click(function(e){
30
- e.preventDefault();
31
- var color = jQuery(this).attr('title');
32
- jQuery('#dynamic-to-top-preview').css('background-color',color);
33
- });
34
-
35
- // Slider Radius
36
- var slider = jQuery( "#slider-radius" ).hide();
37
- var slider_val = jQuery('span#radius-val').html(slider.val());
38
-
39
- jQuery('#slider-picker-radius').slider({
40
- range: "min",
41
- value: slider.val(),
42
- min: 0,
43
- max: 30,
44
- slide: function( event, ui ){
45
- slider.val( ui.value );
46
- slider_val.html( ui.value);
47
- preview.css('border-radius',ui.value+'px');
48
- }});
49
-
50
- // Slider Border Width
51
- var slider_2 = jQuery( "#slider-border-width" ).hide();
52
- var slider_val_2 = jQuery('span#border-val').html(slider_2.val());
53
-
54
- jQuery('#slider-picker-border-width').slider({
55
- range: "min",
56
- value: slider_2.val(),
57
- min: 0,
58
- max: 10,
59
- slide: function( event, ui ) {
60
- slider_2.val( ui.value );
61
- slider_val_2.html( ui.value);
62
- preview.css('border-width',ui.value+'px');
63
- }});
64
-
65
- // Slider Speed
66
- var slider_3 = jQuery('#slider-speed').hide();
67
- var slider_val_3 = jQuery('span#speed-val').html(slider_3.val());
68
-
69
- jQuery('#slider-picker-speed').slider({
70
- range: "max",
71
- value: slider_3.val(),
72
- min: 600,
73
- step:100,
74
- max: 3000,
75
- slide: function( event, ui ) {
76
- slider_3.val( ui.value );
77
- slider_val_3.html( ui.value);
78
- }});
79
-
80
- // Slider Padding Top/Bottom
81
- var slider_4 = jQuery( "#slider-padding-top-bottom" ).hide();
82
- var slider_val_4 = jQuery('span#padding-top-bottom-val').html(slider_4.val());
83
-
84
- jQuery('#slider-picker-padding-top-bottom').slider({
85
- range: "min",
86
- value: slider_4.val(),
87
- min: 2,
88
- max: 21,
89
- slide: function( event, ui ) {
90
- slider_4.val( ui.value );
91
- slider_val_4.html( ui.value);
92
- preview.css({paddingTop:ui.value+'px',paddingBottom:ui.value+'px'});
93
- }});
94
-
95
- // Slider Padding Left/Right
96
- var slider_5 = jQuery( "#slider-padding-left-right" ).hide();
97
- var slider_val_5 = jQuery('span#padding-left-right-val').html(slider_5.val());
98
-
99
- jQuery('#slider-picker-padding-left-right').slider({
100
- range: "min",
101
- value: slider_5.val(),
102
- min: 2,
103
- max: 40,
104
- slide: function( event, ui ) {
105
- slider_5.val( ui.value );
106
- slider_val_5.html( ui.value);
107
- preview.css({paddingLeft:ui.value+'px',paddingRight:ui.value+'px'});
108
- }});
109
-
110
- // Slider Font Size
111
- var slider_6 = jQuery( "#slider-font-size" ).hide();
112
- var slider_val_6 = jQuery('span#font-size-val').html(slider_6.val());
113
-
114
- jQuery('#slider-picker-font-size').slider({
115
- range: "min",
116
- value: slider_6.val(),
117
- min: 0.8,
118
- max: 2,
119
- step:0.05,
120
- slide: function( event, ui ) {
121
- slider_6.val( ui.value );
122
- slider_val_6.html( ui.value);
123
- preview.css({fontSize:ui.value+'em'});
124
- }});
125
-
126
- jQuery('.dtt-slider').css('width','25em');
127
-
128
- // Color Pickers
129
- jQuery('#farbtastic-picker-text-color').farbtastic('#farbtastic-text-color');
130
- jQuery('#farbtastic-picker-background-color').farbtastic('#farbtastic-background-color');
131
- jQuery('#farbtastic-picker-border-color').farbtastic('#farbtastic-border-color');
132
- jQuery('#farbtastic-picker-shadow-color').farbtastic('#farbtastic-shadow-color');
133
-
134
- jQuery('.dtt-farbtastic').hide().css('margin-bottom','15px').mouseup(function(){update_preview()});
135
-
136
- jQuery('.picker').click(function(e){
137
- e.preventDefault();
138
- toogle_picker(jQuery(this));
139
-
140
- });
141
-
142
- jQuery('.colorvalue').click(function(){
143
- var picker = jQuery(this).parent().find('.picker');
144
- if (picker.html() == picker.attr('data-closed')) {
145
- toogle_picker(picker);
146
- }
147
- });
148
-
149
- function toogle_picker(picker)
150
- {
151
- picker.parent().find('.dtt-farbtastic').toggle();
152
-
153
- var open = picker.attr('data-open');
154
- if (picker.html() == open) {
155
- picker.html(picker.attr('data-closed'));
156
- picker.parent().find('.picker').addClass('picker-opened');
157
- } else {
158
- picker.parent().find('.picker').removeClass('picker-opened');
159
- picker.html(open);
160
- }
161
- }
162
-
163
- /* FUNCTIONS
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
164
  /////////////////////////////*/
165
-
166
- function toggle_text_version()
167
- {
168
- if ( jQuery('#checkbox-text-version').attr('checked') )
169
- {
170
- preview_button_version.hide();
171
- preview_text_version.show();
172
- preview.removeClass('button-version');
173
- hide_on_button.show();
174
- } else {
175
- preview_button_version.show().css('display','block');
176
- preview_text_version.hide();
177
- preview.addClass('button-version');
178
- hide_on_button.hide();
179
- }
180
- }
181
-
182
- function update_position()
183
- {
184
- var preview_position = jQuery('#select-position').val();
185
-
186
- switch(preview_position)
187
- {
188
- case 'Top Left':
189
- preview.css({top:'10px',left:'10px',bottom:'',right:''});
190
- break;
191
-
192
- case 'Top Right':
193
- preview.css({top:'10px',right:'10px',bottom:'',left:''});
194
- break;
195
-
196
- case 'Bottom Left':
197
- preview.css({bottom:'10px',left:'10px',top:'',right:''});
198
- break;
199
-
200
- case 'Bottom Right':
201
- preview.css({bottom:'10px',right:'10px',top:'',left:''});
202
- break;
203
- }
204
- }
205
-
206
- function update_preview()
207
- {
208
- prevew = new Object;
209
- preview.text = jQuery('#text-text').val();
210
- preview.border_width = jQuery('#slider-border-width').val();
211
- preview.border_radius = jQuery('#slider-radius').val();
212
- preview.text_color = jQuery('#farbtastic-text-color').val();
213
- preview.bg_color = jQuery('#farbtastic-background-color').val();
214
- preview.border_color = jQuery('#farbtastic-border-color').val();
215
- preview.padding_top_bottom = jQuery('#slider-padding-top-bottom').val();
216
- preview.padding_left_right = jQuery('#slider-padding-left-right').val();
217
- preview.find('#dtt-text').font_size = jQuery('#slider-font-size').val();
218
- preview.shadow = jQuery('#checkbox-shadow').attr("checked");
219
- preview.inset = jQuery('#checkbox-inset').attr("checked");
220
- preview.bold = jQuery('#checkbox-bold').attr("checked");
221
- preview.position = jQuery('#select-position').val();
222
- preview.text_shadow = jQuery('#checkbox-text-shadow').attr("checked");
223
- preview.text_shadow_color = jQuery('#farbtastic-shadow-color').val();
224
-
225
- preview.css({
226
- borderStyle:'solid',
227
- borderWidth: preview.border_width+'px',
228
- borderRadius: preview.border_radius+'px',
229
- borderColor: preview.border_color,
230
- backgroundColor: preview.bg_color,
231
- color: preview.text_color,
232
- paddingTop: preview.padding_top_bottom+'px',
233
- paddingBottom:preview.padding_top_bottom+'px',
234
- paddingLeft:preview.padding_left_right+'px',
235
- paddingRight:preview.padding_left_right+'px',
236
- fontSize:preview.font_size+'em',
237
- }).find('#dtt-text').html(preview.text);
238
-
239
- if (preview.bold) {
240
- preview.css('font-weight','bold');
241
- } else {
242
- preview.css('font-weight','normal');
243
- }
244
-
245
- if (preview.shadow) {
246
- preview.addClass('dynamic-to-top-shadow');
247
- } else {
248
- preview.removeClass('dynamic-to-top-shadow');
249
- }
250
-
251
- if (preview.inset) {
252
- preview.addClass('dynamic-to-top-inset');
253
- } else {
254
- preview.removeClass('dynamic-to-top-inset');
255
- }
256
-
257
- if (preview.text_shadow) {
258
- preview.css('text-shadow','0 1px 0 '+preview.text_shadow_color);
259
- } else {
260
- preview.css('text-shadow','');
261
- }
262
-
263
- }
264
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
265
  });
1
+ /*
2
  * Dynamic To Top Plugin Settings
3
  * http://www.mattvarone.com
4
  *
6
  * @sksmatt
7
  *
8
  */
9
+ jQuery(document).ready(function () {
10
+
11
+ var preview = jQuery('#dynamic-to-top-button');
12
+ var preview_button_version = jQuery('#dynamic-to-top-button #dtt-image');
13
+ var preview_text_version = jQuery('#dynamic-to-top-button #dtt-text');
14
+ var hide_on_button = jQuery('#text-text, #slider-font-size, #checkbox-bold, #checkbox-text-shadow, #farbtastic-text-color, #farbtastic-shadow-color').parent().parent();
15
+
16
+ jQuery('#checkbox-text-version').click(function () {
17
+ toggle_text_version();
18
+ });
19
+
20
+ toggle_text_version();
21
+ update_preview();
22
+ update_position();
23
+
24
+ var update_fields = '#checkbox-bold, #checkbox-inset, #checkbox-shadow, #checkbox-text-shadow, .colorvalue';
25
+
26
+ jQuery(update_fields).change(function () {
27
+ update_preview()
28
+ });
29
+ jQuery('#select-position').change(function () {
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 = jQuery(this).attr('title');
40
+ jQuery('#dynamic-to-top-preview').css('background-color', color);
41
+ });
42
+
43
+ // Slider Radius
44
+ var slider = jQuery("#slider-radius").hide();
45
+ var slider_val = jQuery('span#radius-val').html(slider.val());
46
+
47
+ jQuery('#slider-picker-radius').slider({
48
+ range: "min",
49
+ value: slider.val(),
50
+ min: 0,
51
+ max: 30,
52
+ slide: function (event, ui) {
53
+ slider.val(ui.value);
54
+ slider_val.html(ui.value);
55
+ preview.css('border-radius', ui.value + 'px');
56
+ }
57
+ });
58
+
59
+ // Slider Border Width
60
+ var slider_2 = jQuery("#slider-border-width").hide();
61
+ var slider_val_2 = jQuery('span#border-val').html(slider_2.val());
62
+
63
+ jQuery('#slider-picker-border-width').slider({
64
+ range: "min",
65
+ value: slider_2.val(),
66
+ min: 0,
67
+ max: 10,
68
+ slide: function (event, ui) {
69
+ slider_2.val(ui.value);
70
+ slider_val_2.html(ui.value);
71
+ preview.css('border-width', ui.value + 'px');
72
+ }
73
+ });
74
+
75
+ // Slider Speed
76
+ var slider_3 = jQuery('#slider-speed').hide();
77
+ var slider_val_3 = jQuery('span#speed-val').html(slider_3.val());
78
+
79
+ jQuery('#slider-picker-speed').slider({
80
+ range: "max",
81
+ value: slider_3.val(),
82
+ min: 600,
83
+ step: 100,
84
+ max: 3000,
85
+ slide: function (event, ui) {
86
+ slider_3.val(ui.value);
87
+ slider_val_3.html(ui.value);
88
+ }
89
+ });
90
+
91
+ // Slider Padding Top/Bottom
92
+ var slider_4 = jQuery("#slider-padding-top-bottom").hide();
93
+ var slider_val_4 = jQuery('span#padding-top-bottom-val').html(slider_4.val());
94
+
95
+ jQuery('#slider-picker-padding-top-bottom').slider({
96
+ range: "min",
97
+ value: slider_4.val(),
98
+ min: 2,
99
+ max: 21,
100
+ slide: function (event, ui) {
101
+ slider_4.val(ui.value);
102
+ slider_val_4.html(ui.value);
103
+ preview.css({
104
+ paddingTop: ui.value + 'px',
105
+ paddingBottom: ui.value + 'px'
106
+ });
107
+ }
108
+ });
109
+
110
+ // Slider Padding Left/Right
111
+ var slider_5 = jQuery("#slider-padding-left-right").hide();
112
+ var slider_val_5 = jQuery('span#padding-left-right-val').html(slider_5.val());
113
+
114
+ jQuery('#slider-picker-padding-left-right').slider({
115
+ range: "min",
116
+ value: slider_5.val(),
117
+ min: 2,
118
+ max: 40,
119
+ slide: function (event, ui) {
120
+ slider_5.val(ui.value);
121
+ slider_val_5.html(ui.value);
122
+ preview.css({
123
+ paddingLeft: ui.value + 'px',
124
+ paddingRight: ui.value + 'px'
125
+ });
126
+ }
127
+ });
128
+
129
+ // Slider Font Size
130
+ var slider_6 = jQuery("#slider-font-size").hide();
131
+ var slider_val_6 = jQuery('span#font-size-val').html(slider_6.val());
132
+
133
+ jQuery('#slider-picker-font-size').slider({
134
+ range: "min",
135
+ value: slider_6.val(),
136
+ min: 0.8,
137
+ max: 2,
138
+ step: 0.05,
139
+ slide: function (event, ui) {
140
+ slider_6.val(ui.value);
141
+ slider_val_6.html(ui.value);
142
+ preview.css({
143
+ fontSize: ui.value + 'em'
144
+ });
145
+ }
146
+ });
147
+
148
+ jQuery('.dtt-slider').css('width', '25em');
149
+
150
+ // Color Pickers
151
+ jQuery('#farbtastic-picker-text-color').farbtastic('#farbtastic-text-color');
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
+ jQuery('.picker').click(function (e) {
161
+ e.preventDefault();
162
+ toogle_picker(jQuery(this));
163
+
164
+ });
165
+
166
+ jQuery('.colorvalue').click(function () {
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')) {
191
+ preview_button_version.hide();
192
+ preview_text_version.show();
193
+ preview.removeClass('button-version');
194
+ hide_on_button.show();
195
+ } else {
196
+ preview_button_version.show().css('display', 'block');
197
+ preview_text_version.hide();
198
+ preview.addClass('button-version');
199
+ hide_on_button.hide();
200
+ }
201
+ }
202
+
203
+ function update_position() {
204
+ var preview_position = jQuery('#select-position').val();
205
+
206
+ switch (preview_position) {
207
+ case 'Top Left':
208
+ preview.css({
209
+ top: '10px',
210
+ left: '10px',
211
+ bottom: '',
212
+ right: ''
213
+ });
214
+ break;
215
+
216
+ case 'Top Right':
217
+ preview.css({
218
+ top: '10px',
219
+ right: '10px',
220
+ bottom: '',
221
+ left: ''
222
+ });
223
+ break;
224
+
225
+ case 'Bottom Left':
226
+ preview.css({
227
+ bottom: '10px',
228
+ left: '10px',
229
+ top: '',
230
+ right: ''
231
+ });
232
+ break;
233
+
234
+ case 'Bottom Right':
235
+ preview.css({
236
+ bottom: '10px',
237
+ right: '10px',
238
+ top: '',
239
+ left: ''
240
+ });
241
+ break;
242
+ }
243
+ }
244
+
245
+ function update_preview() {
246
+ prevew = new Object;
247
+ preview.text = jQuery('#text-text').val();
248
+ preview.border_width = jQuery('#slider-border-width').val();
249
+ preview.border_radius = jQuery('#slider-radius').val();
250
+ preview.text_color = jQuery('#farbtastic-text-color').val();
251
+ preview.bg_color = jQuery('#farbtastic-background-color').val();
252
+ preview.border_color = jQuery('#farbtastic-border-color').val();
253
+ preview.padding_top_bottom = jQuery('#slider-padding-top-bottom').val();
254
+ preview.padding_left_right = jQuery('#slider-padding-left-right').val();
255
+ preview.find('#dtt-text').font_size = jQuery('#slider-font-size').val();
256
+ preview.shadow = jQuery('#checkbox-shadow').attr("checked");
257
+ preview.inset = jQuery('#checkbox-inset').attr("checked");
258
+ preview.bold = jQuery('#checkbox-bold').attr("checked");
259
+ preview.position = jQuery('#select-position').val();
260
+ preview.text_shadow = jQuery('#checkbox-text-shadow').attr("checked");
261
+ preview.text_shadow_color = jQuery('#farbtastic-shadow-color').val();
262
+
263
+ preview.css({
264
+ borderStyle: 'solid',
265
+ borderWidth: preview.border_width + 'px',
266
+ borderRadius: preview.border_radius + 'px',
267
+ borderColor: preview.border_color,
268
+ backgroundColor: preview.bg_color,
269
+ color: preview.text_color,
270
+ paddingTop: preview.padding_top_bottom + 'px',
271
+ paddingBottom: preview.padding_top_bottom + 'px',
272
+ paddingLeft: preview.padding_left_right + 'px',
273
+ paddingRight: preview.padding_left_right + 'px',
274
+ fontSize: preview.font_size + 'em',
275
+ }).find('#dtt-text').html(preview.text);
276
+
277
+ if (preview.bold) {
278
+ preview.css('font-weight', 'bold');
279
+ } else {
280
+ preview.css('font-weight', 'normal');
281
+ }
282
+
283
+ if (preview.shadow) {
284
+ preview.addClass('dynamic-to-top-shadow');
285
+ } else {
286
+ preview.removeClass('dynamic-to-top-shadow');
287
+ }
288
+
289
+ if (preview.inset) {
290
+ preview.addClass('dynamic-to-top-inset');
291
+ } else {
292
+ preview.removeClass('dynamic-to-top-inset');
293
+ }
294
+
295
+ if (preview.text_shadow) {
296
+ preview.css('text-shadow', '0 1px 0 ' + preview.text_shadow_color);
297
+ } else {
298
+ preview.css('text-shadow', '');
299
+ }
300
+
301
+ }
302
+
303
  });
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Dynamic "To Top" Plugin ===
2
  Contributors: sksmatt
3
  Donate link: http://www.mattvarone.com/donate/
4
- Tags: Dynamic, UI, Scroll, To top, Automatic, Enhance, UX, Button, jQuery
5
  Requires at least: 3.0
6
- Tested up to: 3.2.1
7
- Stable tag: 3.1.7
8
 
9
  Adds an automatic and dynamic "To Top" button to easily scroll long pages back to the top.
10
 
@@ -28,8 +28,9 @@ It features an intuitive control panel to style and adjust to each website's nee
28
  1. Unzip files.
29
  2. Upload "dynamic-to-top" folder into your plugins directory.
30
  3. Activate the plugin.
31
- 4. Configure settings to your needs.
32
- 5. Have fun!
 
33
 
34
  == Screenshots ==
35
 
@@ -40,6 +41,13 @@ It features an intuitive control panel to style and adjust to each website's nee
40
 
41
  == Change log ==
42
 
 
 
 
 
 
 
 
43
  = 3.1.7 =
44
  * Introduced the filter 'mv_dynamic_to_top_css' to allow themes and plugins to add / alter the generated CSS.
45
  * Minified the JavaScript included.
1
  === Dynamic "To Top" Plugin ===
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.0
6
+ Tested up to: 3.3
7
+ Stable tag: 3.1.8
8
 
9
  Adds an automatic and dynamic "To Top" button to easily scroll long pages back to the top.
10
 
28
  1. Unzip files.
29
  2. Upload "dynamic-to-top" folder into your plugins directory.
30
  3. Activate the plugin.
31
+ 4. Go to Appearance > To Top.
32
+ 5. Configure settings to your needs.
33
+ 6. Have fun!
34
 
35
  == Screenshots ==
36
 
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.
47
+ * Added new Hook: 'mv_dynamic_to_top_new_hex' allows returning a custom HEX color for the button CSS :hover state.
48
+ * WP 3.3 compatibility enhancements.
49
+ * Code improvements.
50
+
51
  = 3.1.7 =
52
  * Introduced the filter 'mv_dynamic_to_top_css' to allow themes and plugins to add / alter the generated CSS.
53
  * Minified the JavaScript included.