Version Description
- Added additional default selectors:
.ps2id > a[href*='#'],a.ps2id[href*='#']
. - Added "Page scroll to id target" widget.
- Added custom buttons in WordPress visual editor for plugin's shortcodes insertion.
- Added new option 'Enable on WordPress Menu links' in plugin settings.
- Fixed browser's history back button when 'Scroll to location hash' option is enabled.
- Updated readme.txt.
- Extended help and documentation.
Download this release
Release Info
Developer | malihu |
Plugin | Page scroll to id |
Version | 1.6.1 |
Comparing to | |
See all releases |
Code changes from version 1.6.0 to 1.6.1
- css/admin-gen.css +10 -0
- css/tinymce-custom-btn-ps2id-link.png +0 -0
- css/tinymce-custom-btn-ps2id-target.png +0 -0
- includes/admin.php +2 -2
- includes/class-malihu-pagescroll2id-tinymce.php +32 -0
- includes/class-malihu-pagescroll2id-widget.php +60 -0
- includes/help/get-started.inc +6 -3
- includes/help/plugin-settings.inc +14 -0
- includes/help/shortcodes.inc +5 -1
- includes/malihu-pagescroll2id-tinymce.js +35 -0
- js/jquery.malihu.PageScroll2id-init.js +8 -7
- malihu-pagescroll2id.php +97 -4
- readme.txt +29 -8
css/admin-gen.css
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* admin general styling */
|
2 |
+
|
3 |
+
/* tinyMCE */
|
4 |
+
i.mce-i-icon{ font: 400 20px/1 dashicons; padding: 0; vertical-align: top; speak: none; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; margin-left: -2px; padding-right: 2px }
|
5 |
+
i.ps2id-custom-icon-link{ background-image: url('tinymce-custom-btn-ps2id-link.png'); }
|
6 |
+
i.ps2id-custom-icon-target{ background-image: url('tinymce-custom-btn-ps2id-target.png'); }
|
7 |
+
/* widgets */
|
8 |
+
.ps2id-admin-widgets-row-help{ text-align: right; }
|
9 |
+
.ps2id-admin-widgets-row-field-desc{ display: block; }
|
10 |
+
.widgets-holder-wrap .description.ps2id-admin-widgets-row-field-desc{ padding-bottom: 0; }
|
css/tinymce-custom-btn-ps2id-link.png
ADDED
Binary file
|
css/tinymce-custom-btn-ps2id-target.png
ADDED
Binary file
|
includes/admin.php
CHANGED
@@ -12,7 +12,7 @@ $toggle_instance_title=__('Click to toggle', $this->plugin_slug);
|
|
12 |
<div class="wrap">
|
13 |
|
14 |
<?php screen_icon(); ?>
|
15 |
-
<
|
16 |
|
17 |
<div class="plugin-header">
|
18 |
<p class="plugin-info"><?php echo $plugin_info; ?></p>
|
@@ -25,7 +25,7 @@ $toggle_instance_title=__('Click to toggle', $this->plugin_slug);
|
|
25 |
<?php include_once(plugin_dir_path( __FILE__ ).'help/overview.inc'); ?>
|
26 |
<p>
|
27 |
<strong>For more information</strong> <br />
|
28 |
-
<a href="http://manos.malihu.gr/page-scroll-to-id" target="_blank">Plugin homepage</a> <a href="http://manos.malihu.gr/page-scroll-to-id/2/" target="_blank">Code examples & short tutorials</a>
|
29 |
</p>
|
30 |
</div>
|
31 |
<div class="oldwp-plugin-help-section oldwp-plugin-help-section-get-started">
|
12 |
<div class="wrap">
|
13 |
|
14 |
<?php screen_icon(); ?>
|
15 |
+
<h1><?php echo esc_html(get_admin_page_title()); ?></h1>
|
16 |
|
17 |
<div class="plugin-header">
|
18 |
<p class="plugin-info"><?php echo $plugin_info; ?></p>
|
25 |
<?php include_once(plugin_dir_path( __FILE__ ).'help/overview.inc'); ?>
|
26 |
<p>
|
27 |
<strong>For more information</strong> <br />
|
28 |
+
<a href="http://manos.malihu.gr/page-scroll-to-id" target="_blank">Plugin homepage</a> <a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress-tutorial/" target="_blank">Page scroll to id for WordPress tutorial</a> <a href="http://manos.malihu.gr/page-scroll-to-id/2/" target="_blank">Code examples & short tutorials</a>
|
29 |
</p>
|
30 |
</div>
|
31 |
<div class="oldwp-plugin-help-section oldwp-plugin-help-section-get-started">
|
includes/class-malihu-pagescroll2id-tinymce.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Page scroll to id tinyMCE buttons
|
4 |
+
*/
|
5 |
+
|
6 |
+
class malihuPageScroll2idtinymce {
|
7 |
+
|
8 |
+
public function add_custom_button(){
|
9 |
+
global $typenow;
|
10 |
+
// check user permissions
|
11 |
+
if ( !current_user_can('edit_posts') && !current_user_can('edit_pages') ) { return; }
|
12 |
+
// verify the post type
|
13 |
+
//if( ! in_array( $typenow, array( 'post', 'page' ) ) ) return;
|
14 |
+
// check if WYSIWYG is enabled
|
15 |
+
if ( get_user_option('rich_editing') == 'true') {
|
16 |
+
add_filter('mce_external_plugins', array($this, 'add_tinymce_plugin'));
|
17 |
+
add_filter('mce_buttons', array($this, 'register_custom_button'));
|
18 |
+
}
|
19 |
+
}
|
20 |
+
|
21 |
+
public function add_tinymce_plugin($plugin_array){
|
22 |
+
$plugin_array['ps2id_tinymce_custom_button'] = plugins_url( '/malihu-pagescroll2id-tinymce.js', __FILE__ );
|
23 |
+
return $plugin_array;
|
24 |
+
}
|
25 |
+
|
26 |
+
public function register_custom_button($buttons){
|
27 |
+
array_push($buttons, 'ps2id_tinymce_custom_button_link', 'ps2id_tinymce_custom_button_target');
|
28 |
+
return $buttons;
|
29 |
+
}
|
30 |
+
|
31 |
+
}
|
32 |
+
?>
|
includes/class-malihu-pagescroll2id-widget.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Page scroll to id widgets
|
4 |
+
*/
|
5 |
+
|
6 |
+
/*
|
7 |
+
Simple widget which creates an (invinsible) target element with an id attribute
|
8 |
+
*/
|
9 |
+
|
10 |
+
class malihuPageScroll2idWidget extends WP_Widget {
|
11 |
+
|
12 |
+
// Register widget with WordPress
|
13 |
+
function __construct(){
|
14 |
+
parent::__construct(
|
15 |
+
'malihuPageScroll2idWidget', // Base ID
|
16 |
+
__( 'Page scroll to id target', 'page-scroll-to-id' ), // Name
|
17 |
+
array( 'description' => __( 'Single target element (anchor point)', 'page-scroll-to-id' ), ) // Args
|
18 |
+
);
|
19 |
+
}
|
20 |
+
|
21 |
+
// Front-end display of widget
|
22 |
+
public function widget($args, $instance){
|
23 |
+
if(!empty($instance['id_value'])){
|
24 |
+
$target_value=!empty($instance['target_value']) ? $instance['target_value'] : '';
|
25 |
+
echo '<a id="'.$instance['id_value'].'" data-ps2id-target="'.$target_value.'"></a>';
|
26 |
+
}
|
27 |
+
}
|
28 |
+
|
29 |
+
// Back-end widget form
|
30 |
+
public function form($instance){
|
31 |
+
$id_value=!empty($instance['id_value']) ? $instance['id_value'] : '';
|
32 |
+
$target_value=!empty($instance['target_value']) ? $instance['target_value'] : '';
|
33 |
+
?>
|
34 |
+
<p>
|
35 |
+
<label for="<?php echo $this->get_field_id('id_value'); ?>"><?php _e( 'id:' ); ?></label>
|
36 |
+
<input class="widefat" id="<?php echo $this->get_field_id('id_value'); ?>" name="<?php echo $this->get_field_name('id_value'); ?>" type="text" value="<?php echo esc_attr($id_value); ?>">
|
37 |
+
<small class="description ps2id-admin-widgets-row-field-desc"><em><?php _e( 'Unique identifier without spaces (e.g. my-id)' ); ?></em></small>
|
38 |
+
</p>
|
39 |
+
<p>
|
40 |
+
<label for="<?php echo $this->get_field_id('target_value'); ?>"><?php _e( 'Highlight target selector:' ); ?></label>
|
41 |
+
<input class="widefat" id="<?php echo $this->get_field_id('target_value'); ?>" name="<?php echo $this->get_field_name('target_value'); ?>" type="text" value="<?php echo esc_attr($target_value); ?>">
|
42 |
+
<small class="description ps2id-admin-widgets-row-field-desc"><em><?php _e( 'Optional element selector to use for highlighting (e.g. #another-id)' ); ?></em></small>
|
43 |
+
</p>
|
44 |
+
<?php
|
45 |
+
}
|
46 |
+
|
47 |
+
// Sanitize widget form values as they are saved
|
48 |
+
public function update($new_instance, $old_instance){
|
49 |
+
$instance = array();
|
50 |
+
$instance['id_value']=(!empty($new_instance['id_value'])) ? sanitize_text_field($new_instance['id_value']) : '';
|
51 |
+
$instance['target_value']=(!empty($new_instance['target_value'])) ? sanitize_text_field($new_instance['target_value']) : '';
|
52 |
+
return $instance;
|
53 |
+
}
|
54 |
+
|
55 |
+
}
|
56 |
+
|
57 |
+
add_action('widgets_init',
|
58 |
+
create_function('', 'return register_widget("malihuPageScroll2idWidget");')
|
59 |
+
);
|
60 |
+
?>
|
includes/help/get-started.inc
CHANGED
@@ -3,20 +3,23 @@ $help_get_started_text=<<<EOD
|
|
3 |
|
4 |
<p>
|
5 |
The plugin works simply by connecting links in the form of <code><a href="#id">link</a></code>, to sections within the document, in the form of <code><div id="id">target</div></code>. Clicking the links will smoothly animate the page to the connected sections, provided the links are included in the Selector(s) field. <br />
|
6 |
-
The default value of Selector(s) is <code>a[rel='m_PageScroll2id']</code>, meaning the plugin will apply on links with <code>m_PageScroll2id</code> rel attribute value (e.g. <code><a href="#id" rel="m_PageScroll2id">link</a></code>).
|
|
|
7 |
</p>
|
8 |
|
9 |
<p>
|
10 |
-
<strong>Get started</strong> by adding <code>rel="m_PageScroll2id"</code> to your links that point to existing sections within your page, making sure each link's href value contains a hash (<code>#</code>) with the id of the section you want to scroll-to.
|
11 |
</p>
|
12 |
|
13 |
<p>
|
|
|
|
|
14 |
To add <code>rel="m_PageScroll2id"</code> to links in custom menus (menus created in Appearance › Menus), do the following: <br />
|
15 |
While on the Menus admin page, click "Screen Options" and check "Link Relationship (XFN)". To enable the plugin on a menu item, click the arrow on the right of the item and insert <code>m_PageScroll2id</code> in the "Link Relationship (XFN)" field (assuming your menu contains links with "URL" value in the form of <code>#id</code>).
|
16 |
</p>
|
17 |
|
18 |
<p>
|
19 |
-
If you cannot edit your html markup or don't want to alter your links rel attributes, you can change the Selector(s) field value to existing matching sets of elements in your theme, e.g. <code>a.class-name</code>, <code>#id a</code>, <code>a[href*='#']</code> etc. For multiple selectors, use comma separated values: e.g. <code>a[rel='m_PageScroll2id'], a.class-name</code>.
|
20 |
</p>
|
21 |
|
22 |
<p>
|
3 |
|
4 |
<p>
|
5 |
The plugin works simply by connecting links in the form of <code><a href="#id">link</a></code>, to sections within the document, in the form of <code><div id="id">target</div></code>. Clicking the links will smoothly animate the page to the connected sections, provided the links are included in the Selector(s) field. <br />
|
6 |
+
The default value of Selector(s) is <code>a[rel='m_PageScroll2id']</code>, meaning the plugin will apply on links with <code>m_PageScroll2id</code> rel attribute value (e.g. <code><a href="#id" rel="m_PageScroll2id">link</a></code>). <br />
|
7 |
+
The plugin will also apply automatically on links with class <code>ps2id</code> or links that are direct children of an element with that same class.
|
8 |
</p>
|
9 |
|
10 |
<p>
|
11 |
+
<strong>Get started</strong> by adding <code>rel="m_PageScroll2id"</code> or <code>class="ps2id"</code> to your links that point to existing sections within your page, making sure each link's href value contains a hash (<code>#</code>) with the id of the section you want to scroll-to.
|
12 |
</p>
|
13 |
|
14 |
<p>
|
15 |
+
To enable the plugin on custom links in your WordPress menu(s), simply enable "Enable on WordPress Menu links" option in plugin's settings.
|
16 |
+
If you prefer to use the non-automatic method of enabling it in your WordPress menu, you can insert the value <code>ps2id</code> in "CSS Classes" field or the <code>m_PageScroll2id</code> value in "Link Relationship (XFN)" field in each of your links. <br />
|
17 |
To add <code>rel="m_PageScroll2id"</code> to links in custom menus (menus created in Appearance › Menus), do the following: <br />
|
18 |
While on the Menus admin page, click "Screen Options" and check "Link Relationship (XFN)". To enable the plugin on a menu item, click the arrow on the right of the item and insert <code>m_PageScroll2id</code> in the "Link Relationship (XFN)" field (assuming your menu contains links with "URL" value in the form of <code>#id</code>).
|
19 |
</p>
|
20 |
|
21 |
<p>
|
22 |
+
If you cannot edit your html markup or don't want to alter your links rel or class attributes, you can change the Selector(s) field value to existing matching sets of elements in your theme, e.g. <code>a.class-name</code>, <code>#id a</code>, <code>a[href*='#']</code> etc. For multiple selectors, use comma separated values: e.g. <code>a[rel='m_PageScroll2id'], a.class-name</code>.
|
23 |
</p>
|
24 |
|
25 |
<p>
|
includes/help/plugin-settings.inc
CHANGED
@@ -9,6 +9,14 @@ $help_plugin_settings_text=<<<EOD
|
|
9 |
Other examples: <code>a[href*='#']</code> (anchors that contain <code>#</code> in their href attribute), <code>a[href='#top']</code> (anchors with href attribute value: <code>#top</code>), <code>a.className</code> (anchors with class: <code>className</code>).
|
10 |
</p>
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
<p>
|
13 |
<strong>Scroll animation speed</strong> -
|
14 |
Sets the duration of scrolling animation in milliseconds. By checking "Auto-adjust animation speed", the duration is adjusted automatically according to target element position and window scroll. This normalizes animation speed in order to avoid short-distance animations that take too long (e.g. a page scrolling of just 100 pixels will last shorter than the value specified above).
|
@@ -97,6 +105,12 @@ $help_plugin_settings_text=<<<EOD
|
|
97 |
Set a minimum width and/or height screen-size (in pixels) that's required for the plugin to be enabled. For example, insert <code>1024</code> to disable plugin functionality when window width is below 1024 pixels or <code>1024,600</code> to disable plugin when window width/height is below 1024 and 600 pixels respectively. Leave field value empty or set to 0 to disable.<br />
|
98 |
</p>
|
99 |
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
EOD;
|
101 |
?>
|
102 |
|
9 |
Other examples: <code>a[href*='#']</code> (anchors that contain <code>#</code> in their href attribute), <code>a[href='#top']</code> (anchors with href attribute value: <code>#top</code>), <code>a.className</code> (anchors with class: <code>className</code>).
|
10 |
</p>
|
11 |
|
12 |
+
<p>
|
13 |
+
Other default selectors which the plugin is applied automatically include the class <code>ps2id</code> (actual selectors: <code>.ps2id > a[href*='#']</code> and <code>a.ps2id[href*='#']</code>). This means that any link with a hash in its URL/href (e.g. <code>#id</code>) which has the class or is contained (direct children) within an element with the class `ps2id` will be handled by the plugin automatically.
|
14 |
+
</p>
|
15 |
+
|
16 |
+
<p>
|
17 |
+
Checking "Enable on WordPress Menu links" enables the plugin on custom links (that contain a hash in their URL) created in WordPress Menus automatically (no need to use XFN and/or class values).
|
18 |
+
</p>
|
19 |
+
|
20 |
<p>
|
21 |
<strong>Scroll animation speed</strong> -
|
22 |
Sets the duration of scrolling animation in milliseconds. By checking "Auto-adjust animation speed", the duration is adjusted automatically according to target element position and window scroll. This normalizes animation speed in order to avoid short-distance animations that take too long (e.g. a page scrolling of just 100 pixels will last shorter than the value specified above).
|
105 |
Set a minimum width and/or height screen-size (in pixels) that's required for the plugin to be enabled. For example, insert <code>1024</code> to disable plugin functionality when window width is below 1024 pixels or <code>1024,600</code> to disable plugin when window width/height is below 1024 and 600 pixels respectively. Leave field value empty or set to 0 to disable.<br />
|
106 |
</p>
|
107 |
|
108 |
+
<p>
|
109 |
+
<strong>Administration</strong> -
|
110 |
+
Check "Display widgets id attribute" in order to Show the id attribute of each widget in Appearance → Widgets. This is a convenient way of finding existing id attributes to use as targets on your links.
|
111 |
+
"Enable insert link/target buttons in post visual editor" allows the insertion of plugin's shortcodes via buttons in WordPress post/page editor. <br />
|
112 |
+
</p>
|
113 |
+
|
114 |
EOD;
|
115 |
?>
|
116 |
|
includes/help/shortcodes.inc
CHANGED
@@ -1,6 +1,10 @@
|
|
1 |
<?php
|
2 |
$help_shortcodes_text=<<<EOD
|
3 |
|
|
|
|
|
|
|
|
|
4 |
<p>
|
5 |
<strong>Create link</strong> - <code>[ps2id url='#id' offset='0']link[/ps2id]</code>
|
6 |
</p>
|
@@ -40,7 +44,7 @@ $help_shortcodes_text=<<<EOD
|
|
40 |
<code>[ps2id id='some-id'/]</code>
|
41 |
</li>
|
42 |
<li>
|
43 |
-
<code>target</code> - the element that will be considered as the actual target (useful when you need proper highlighting with targets that have zero dimensions) <br />
|
44 |
Examples: <br />
|
45 |
<code>[ps2id id='some-id' target='#id + div'/]</code> - set the target as the next div from the #some-id element <br />
|
46 |
<code>[ps2id id='some-id' target='#another-id'/]</code> - set the target as the element with id: another-id
|
1 |
<?php
|
2 |
$help_shortcodes_text=<<<EOD
|
3 |
|
4 |
+
<p>
|
5 |
+
Plugin's shortcodes can be inserted directly in WordPress post editor (as with any WordPress shortcode) or via the buttons "Insert Page scroll to id link" and "Insert Page scroll to id target" in visual editor toolbar.
|
6 |
+
</p>
|
7 |
+
|
8 |
<p>
|
9 |
<strong>Create link</strong> - <code>[ps2id url='#id' offset='0']link[/ps2id]</code>
|
10 |
</p>
|
44 |
<code>[ps2id id='some-id'/]</code>
|
45 |
</li>
|
46 |
<li>
|
47 |
+
<code>target</code> (optional) - the element that will be considered as the actual target (useful when you need proper highlighting with targets that have zero dimensions) <br />
|
48 |
Examples: <br />
|
49 |
<code>[ps2id id='some-id' target='#id + div'/]</code> - set the target as the next div from the #some-id element <br />
|
50 |
<code>[ps2id id='some-id' target='#another-id'/]</code> - set the target as the element with id: another-id
|
includes/malihu-pagescroll2id-tinymce.js
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function(){
|
2 |
+
tinymce.PluginManager.add("ps2id_tinymce_custom_button",function(editor,url){
|
3 |
+
editor.addButton("ps2id_tinymce_custom_button_link",{
|
4 |
+
icon:"icon ps2id-custom-icon-link",
|
5 |
+
title:"Insert Page scroll to id link",
|
6 |
+
onclick:function(){
|
7 |
+
editor.windowManager.open({
|
8 |
+
title:"Insert Page scroll to id link",body:[
|
9 |
+
{type:"textbox",name:"ps2idurlid",label:"URL/id (e.g. #my-id)"},
|
10 |
+
{type:"textbox",name:"ps2idtext",label:"Link Text"},
|
11 |
+
{type:"textbox",name:"ps2idoffset",label:"Offset (optional)"}
|
12 |
+
],
|
13 |
+
onsubmit:function(e){
|
14 |
+
editor.insertContent("[ps2id url='"+e.data.ps2idurlid+"' offset='"+e.data.ps2idoffset+"']"+e.data.ps2idtext+"[/ps2id]");
|
15 |
+
}
|
16 |
+
});
|
17 |
+
}
|
18 |
+
});
|
19 |
+
editor.addButton("ps2id_tinymce_custom_button_target",{
|
20 |
+
icon:"icon ps2id-custom-icon-target",
|
21 |
+
title:"Insert Page scroll to id target",
|
22 |
+
onclick:function(){
|
23 |
+
editor.windowManager.open({
|
24 |
+
title:"Insert Page scroll to id target",body:[
|
25 |
+
{type:"textbox",name:"ps2idid",label:"id (e.g. my-id)"},
|
26 |
+
{type:"textbox",name:"ps2idtarget",label:"Highlight target selector (optional)"}
|
27 |
+
],
|
28 |
+
onsubmit:function(e){
|
29 |
+
editor.insertContent("[ps2id id='"+e.data.ps2idid+"' target='"+e.data.ps2idtarget+"'/]");
|
30 |
+
}
|
31 |
+
});
|
32 |
+
}
|
33 |
+
});
|
34 |
+
});
|
35 |
+
})();
|
js/jquery.malihu.PageScroll2id-init.js
CHANGED
@@ -22,12 +22,13 @@
|
|
22 |
}else{
|
23 |
return val;
|
24 |
}
|
25 |
-
}
|
|
|
26 |
$(document).ready(function(){
|
27 |
for(var k=0; k<_o.total_instances; k++){
|
28 |
//scroll to location hash on page load
|
29 |
if(_o.instances[_p+"_instance_"+k]["scrollToHash"]["value"]==="true" && _hash){
|
30 |
-
$(_o.instances[_p+"_instance_"+k]["selector"]["value"]+",."+shortcodeClass).each(function(){
|
31 |
$(this).data(_p+"Element",true);
|
32 |
});
|
33 |
if(_validateLocHash(_hash,_o.instances[_p+"_instance_"+k]["scrollToHashForAll"]["value"]==="true")){
|
@@ -39,8 +40,8 @@
|
|
39 |
if(layout!=="vertical"){
|
40 |
$(window).scrollLeft(0); //stop jump to hash straight away
|
41 |
}
|
42 |
-
if(window.history && window.history.
|
43 |
-
window.history.
|
44 |
}else{
|
45 |
window.location.href=href;
|
46 |
}
|
@@ -50,7 +51,7 @@
|
|
50 |
});
|
51 |
$(window).load(function(){
|
52 |
for(var i=0; i<_o.total_instances; i++){
|
53 |
-
$(_o.instances[_p+"_instance_"+i]["selector"]["value"]+",."+shortcodeClass).mPageScroll2id({
|
54 |
scrollSpeed:_o.instances[_p+"_instance_"+i]["scrollSpeed"]["value"],
|
55 |
autoScrollSpeed:(_o.instances[_p+"_instance_"+i]["autoScrollSpeed"]["value"]==="true") ? true : false,
|
56 |
scrollEasing:_o.instances[_p+"_instance_"+i]["scrollEasing"]["value"],
|
@@ -72,8 +73,8 @@
|
|
72 |
if(_validateLocHash(_hash,_o.instances[_p+"_instance_"+i]["scrollToHashForAll"]["value"]==="true")){
|
73 |
setTimeout(function(){
|
74 |
$.mPageScroll2id("scrollTo",_hash);
|
75 |
-
if(window.history && window.history.
|
76 |
-
window.history.
|
77 |
}else{
|
78 |
window.location.hash=_hash;
|
79 |
}
|
22 |
}else{
|
23 |
return val;
|
24 |
}
|
25 |
+
},
|
26 |
+
autoSelectors="a[data-ps2id-api='true'][href*='#'],.ps2id > a[href*='#'],a.ps2id[href*='#']";
|
27 |
$(document).ready(function(){
|
28 |
for(var k=0; k<_o.total_instances; k++){
|
29 |
//scroll to location hash on page load
|
30 |
if(_o.instances[_p+"_instance_"+k]["scrollToHash"]["value"]==="true" && _hash){
|
31 |
+
$(_o.instances[_p+"_instance_"+k]["selector"]["value"]+",."+shortcodeClass+","+autoSelectors).each(function(){
|
32 |
$(this).data(_p+"Element",true);
|
33 |
});
|
34 |
if(_validateLocHash(_hash,_o.instances[_p+"_instance_"+k]["scrollToHashForAll"]["value"]==="true")){
|
40 |
if(layout!=="vertical"){
|
41 |
$(window).scrollLeft(0); //stop jump to hash straight away
|
42 |
}
|
43 |
+
if(window.history && window.history.replaceState){
|
44 |
+
window.history.replaceState("","",href);
|
45 |
}else{
|
46 |
window.location.href=href;
|
47 |
}
|
51 |
});
|
52 |
$(window).load(function(){
|
53 |
for(var i=0; i<_o.total_instances; i++){
|
54 |
+
$(_o.instances[_p+"_instance_"+i]["selector"]["value"]+",."+shortcodeClass+","+autoSelectors).mPageScroll2id({
|
55 |
scrollSpeed:_o.instances[_p+"_instance_"+i]["scrollSpeed"]["value"],
|
56 |
autoScrollSpeed:(_o.instances[_p+"_instance_"+i]["autoScrollSpeed"]["value"]==="true") ? true : false,
|
57 |
scrollEasing:_o.instances[_p+"_instance_"+i]["scrollEasing"]["value"],
|
73 |
if(_validateLocHash(_hash,_o.instances[_p+"_instance_"+i]["scrollToHashForAll"]["value"]==="true")){
|
74 |
setTimeout(function(){
|
75 |
$.mPageScroll2id("scrollTo",_hash);
|
76 |
+
if(window.history && window.history.replaceState){
|
77 |
+
window.history.replaceState("","",_hash);
|
78 |
}else{
|
79 |
window.location.hash=_hash;
|
80 |
}
|
malihu-pagescroll2id.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Page scroll to id
|
4 |
Plugin URI: http://manos.malihu.gr/page-scroll-to-id
|
5 |
Description: Page scroll to id is an easy-to-use jQuery plugin that enables animated page scrolling to specific id within the document.
|
6 |
-
Version: 1.6.
|
7 |
Author: malihu
|
8 |
Author URI: http://manos.malihu.gr
|
9 |
License: MIT License (MIT)
|
@@ -47,7 +47,7 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
|
|
47 |
|
48 |
class malihuPageScroll2id{ // --edit--
|
49 |
|
50 |
-
protected $version='1.6.
|
51 |
protected $update_option=null;
|
52 |
|
53 |
protected $plugin_name='Page scroll to id'; // Plugin name --edit--
|
@@ -97,6 +97,8 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
|
|
97 |
add_filter('plugin_action_links_'.plugin_basename(__FILE__), array($this, 'add_plugin_action_links'));
|
98 |
// Add contextual help for the plugin
|
99 |
add_action('contextual_help', array($this, 'plugin_contextual_help'), 10, 3);
|
|
|
|
|
100 |
}
|
101 |
|
102 |
public static function get_instance(){
|
@@ -126,6 +128,7 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
|
|
126 |
|
127 |
// Admin styles
|
128 |
public function enqueue_admin_styles(){
|
|
|
129 |
if(!isset($this->plugin_screen_hook_suffix)){
|
130 |
return;
|
131 |
}
|
@@ -507,10 +510,47 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
|
|
507 |
return $contextual_help;
|
508 |
}
|
509 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
510 |
public function plugin_options_array($action, $i, $j, $old){
|
511 |
// --edit--
|
512 |
// Defaults
|
513 |
$d0='a[rel=\'m_PageScroll2id\']';
|
|
|
514 |
$d1=1300;
|
515 |
$d2='true';
|
516 |
$d3='easeInOutExpo';
|
@@ -529,10 +569,13 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
|
|
529 |
$d17='false';
|
530 |
$d18=0;
|
531 |
$d15=0;
|
|
|
|
|
532 |
// Values
|
533 |
switch($action){
|
534 |
case 'validate':
|
535 |
$v0=$this->sanitize_input('text', $_POST[$this->db_prefix.$i.'_selector'], $d0);
|
|
|
536 |
$v1=$this->sanitize_input('number', $_POST[$this->db_prefix.$i.'_scrollSpeed'], $d1);
|
537 |
$v2=(isset($_POST[$this->db_prefix.$i.'_autoScrollSpeed'])) ? 'true' : 'false';
|
538 |
$v3=$_POST[$this->db_prefix.$i.'_scrollEasing'];
|
@@ -551,6 +594,8 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
|
|
551 |
$v17=(isset($_POST[$this->db_prefix.$i.'_scrollToHashForAll'])) ? 'true' : 'false';
|
552 |
$v18=$this->sanitize_input('number', $_POST[$this->db_prefix.$i.'_scrollToHashDelay'], $d18);
|
553 |
$v15=$this->sanitize_input('text', $_POST[$this->db_prefix.$i.'_disablePluginBelow'], $d15);
|
|
|
|
|
554 |
break;
|
555 |
case 'upgrade':
|
556 |
if(isset($old)){
|
@@ -582,9 +627,13 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
|
|
582 |
$v17=(isset($j['scrollToHashForAll'])) ? $j['scrollToHashForAll']['value'] : $d17;
|
583 |
$v18=(isset($j['scrollToHashDelay'])) ? $j['scrollToHashDelay']['value'] : $d18;
|
584 |
$v15=(isset($j['disablePluginBelow'])) ? $j['disablePluginBelow']['value'] : $d15;
|
|
|
|
|
|
|
585 |
break;
|
586 |
default:
|
587 |
$v0=$d0;
|
|
|
588 |
$v1=$d1;
|
589 |
$v2=$d2;
|
590 |
$v3=$d3;
|
@@ -603,6 +652,8 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
|
|
603 |
$v17=$d17;
|
604 |
$v18=$d18;
|
605 |
$v15=$d15;
|
|
|
|
|
606 |
}
|
607 |
// Options array
|
608 |
/*
|
@@ -628,9 +679,21 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
|
|
628 |
'checkbox_label' => null,
|
629 |
'radio_labels' => null,
|
630 |
'field_info' => null,
|
631 |
-
'description' => 'The link(s) that will scroll the page when clicked. Defaults to all links with <code>m_PageScroll2id</code> rel attribute value',
|
632 |
'wrapper' => null
|
633 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
634 |
'scrollSpeed' => array(
|
635 |
'value' => $v1,
|
636 |
'values' => null,
|
@@ -846,6 +909,30 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
|
|
846 |
'field_info' => 'screen-size',
|
847 |
'description' => 'Set the width,height screen-size (in pixels), below which the plugin will be disabled (e.g. <code>1024</code>, <code>1024,600</code>)',
|
848 |
'wrapper' => null
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
849 |
)
|
850 |
);
|
851 |
}
|
@@ -855,8 +942,14 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
|
|
855 |
}
|
856 |
|
857 |
if(class_exists('malihuPageScroll2id')){ // --edit--
|
858 |
-
|
|
|
|
|
|
|
859 |
malihuPageScroll2id::get_instance(); // --edit--
|
|
|
|
|
|
|
860 |
|
861 |
}
|
862 |
?>
|
3 |
Plugin Name: Page scroll to id
|
4 |
Plugin URI: http://manos.malihu.gr/page-scroll-to-id
|
5 |
Description: Page scroll to id is an easy-to-use jQuery plugin that enables animated page scrolling to specific id within the document.
|
6 |
+
Version: 1.6.1
|
7 |
Author: malihu
|
8 |
Author URI: http://manos.malihu.gr
|
9 |
License: MIT License (MIT)
|
47 |
|
48 |
class malihuPageScroll2id{ // --edit--
|
49 |
|
50 |
+
protected $version='1.6.1'; // Plugin version --edit--
|
51 |
protected $update_option=null;
|
52 |
|
53 |
protected $plugin_name='Page scroll to id'; // Plugin name --edit--
|
97 |
add_filter('plugin_action_links_'.plugin_basename(__FILE__), array($this, 'add_plugin_action_links'));
|
98 |
// Add contextual help for the plugin
|
99 |
add_action('contextual_help', array($this, 'plugin_contextual_help'), 10, 3);
|
100 |
+
// Plugin API (actions, hooks, filters etc.)
|
101 |
+
$this->pluginAPI_functions();
|
102 |
}
|
103 |
|
104 |
public static function get_instance(){
|
128 |
|
129 |
// Admin styles
|
130 |
public function enqueue_admin_styles(){
|
131 |
+
wp_enqueue_style($this->plugin_slug.'-admin-styles-gen', plugins_url('css/admin-gen.css', __FILE__), $this->version);
|
132 |
if(!isset($this->plugin_screen_hook_suffix)){
|
133 |
return;
|
134 |
}
|
510 |
return $contextual_help;
|
511 |
}
|
512 |
|
513 |
+
// Plugin API (actions, hooks, filters etc.) fn
|
514 |
+
public function pluginAPI_functions(){
|
515 |
+
$pl_instances=get_option($this->db_prefix.'instances', $this->default);
|
516 |
+
$pl_i=$pl_instances[$this->pl_pfx.'instance_0'];
|
517 |
+
// WP Menu API menus HTML attributes (requires WP version 3.6 or higher)
|
518 |
+
if($pl_i['autoSelectorMenuLinks']['value']=='true'){
|
519 |
+
add_filter('nav_menu_link_attributes', array($this, 'wp_menu_links_custom_atts'), 10, 3);
|
520 |
+
}
|
521 |
+
// tinyMCE buttons (requires WP version 3.9 or higher)
|
522 |
+
if(version_compare(get_bloginfo('version'), '3.9', '>=') && $pl_i['adminTinyMCEbuttons']['value']=='true'){
|
523 |
+
$plugin_tinymce = new malihuPageScroll2idtinymce();
|
524 |
+
add_action('admin_head', array($plugin_tinymce, 'add_custom_button'));
|
525 |
+
}
|
526 |
+
// Display widgets id attribute
|
527 |
+
if($pl_i['adminDisplayWidgetsId']['value']=='true'){
|
528 |
+
add_action('widget_form_callback', array($this, 'display_widget_id'), 10, 2);
|
529 |
+
}
|
530 |
+
}
|
531 |
+
|
532 |
+
// WP Menu API menus HTML attributes fn
|
533 |
+
public function wp_menu_links_custom_atts($atts, $item, $args){
|
534 |
+
$atts['data-ps2id-api'] = 'true';
|
535 |
+
return $atts;
|
536 |
+
}
|
537 |
+
|
538 |
+
// Display widgets id attribute fn
|
539 |
+
public function display_widget_id($instance, $widget){
|
540 |
+
if($widget->id_base!=='malihupagescroll2idwidget'){ // don't show it on plugin widget (duh!)
|
541 |
+
$row = '<p class="ps2id-admin-widgets-row-help">';
|
542 |
+
$row .= '<span class="description"><em>Page scroll to id target: <b>'.$widget->id.'</b></em></span>';
|
543 |
+
$row .= '</p>';
|
544 |
+
echo $row;
|
545 |
+
}
|
546 |
+
return $instance;
|
547 |
+
}
|
548 |
+
|
549 |
public function plugin_options_array($action, $i, $j, $old){
|
550 |
// --edit--
|
551 |
// Defaults
|
552 |
$d0='a[rel=\'m_PageScroll2id\']';
|
553 |
+
$d19='false';
|
554 |
$d1=1300;
|
555 |
$d2='true';
|
556 |
$d3='easeInOutExpo';
|
569 |
$d17='false';
|
570 |
$d18=0;
|
571 |
$d15=0;
|
572 |
+
$d20='true';
|
573 |
+
$d21='true';
|
574 |
// Values
|
575 |
switch($action){
|
576 |
case 'validate':
|
577 |
$v0=$this->sanitize_input('text', $_POST[$this->db_prefix.$i.'_selector'], $d0);
|
578 |
+
$v19=(isset($_POST[$this->db_prefix.$i.'_autoSelectorMenuLinks'])) ? 'true' : 'false';
|
579 |
$v1=$this->sanitize_input('number', $_POST[$this->db_prefix.$i.'_scrollSpeed'], $d1);
|
580 |
$v2=(isset($_POST[$this->db_prefix.$i.'_autoScrollSpeed'])) ? 'true' : 'false';
|
581 |
$v3=$_POST[$this->db_prefix.$i.'_scrollEasing'];
|
594 |
$v17=(isset($_POST[$this->db_prefix.$i.'_scrollToHashForAll'])) ? 'true' : 'false';
|
595 |
$v18=$this->sanitize_input('number', $_POST[$this->db_prefix.$i.'_scrollToHashDelay'], $d18);
|
596 |
$v15=$this->sanitize_input('text', $_POST[$this->db_prefix.$i.'_disablePluginBelow'], $d15);
|
597 |
+
$v20=(isset($_POST[$this->db_prefix.$i.'_adminDisplayWidgetsId'])) ? 'true' : 'false';
|
598 |
+
$v21=(isset($_POST[$this->db_prefix.$i.'_adminTinyMCEbuttons'])) ? 'true' : 'false';
|
599 |
break;
|
600 |
case 'upgrade':
|
601 |
if(isset($old)){
|
627 |
$v17=(isset($j['scrollToHashForAll'])) ? $j['scrollToHashForAll']['value'] : $d17;
|
628 |
$v18=(isset($j['scrollToHashDelay'])) ? $j['scrollToHashDelay']['value'] : $d18;
|
629 |
$v15=(isset($j['disablePluginBelow'])) ? $j['disablePluginBelow']['value'] : $d15;
|
630 |
+
$v19=(isset($j['autoSelectorMenuLinks'])) ? $j['autoSelectorMenuLinks']['value'] : $d19;
|
631 |
+
$v20=(isset($j['adminDisplayWidgetsId'])) ? $j['adminDisplayWidgetsId']['value'] : $d20;
|
632 |
+
$v21=(isset($j['adminTinyMCEbuttons'])) ? $j['adminTinyMCEbuttons']['value'] : $d21;
|
633 |
break;
|
634 |
default:
|
635 |
$v0=$d0;
|
636 |
+
$v19=$d19;
|
637 |
$v1=$d1;
|
638 |
$v2=$d2;
|
639 |
$v3=$d3;
|
652 |
$v17=$d17;
|
653 |
$v18=$d18;
|
654 |
$v15=$d15;
|
655 |
+
$v20=$d20;
|
656 |
+
$v21=$d21;
|
657 |
}
|
658 |
// Options array
|
659 |
/*
|
679 |
'checkbox_label' => null,
|
680 |
'radio_labels' => null,
|
681 |
'field_info' => null,
|
682 |
+
'description' => 'The link(s) that will scroll the page when clicked. Defaults to all links with <code>m_PageScroll2id</code> rel attribute value <br /><small>In addition to selectors above, the plugin is enabled by default on links (or links contained within elements) with class <code>ps2id</code></small>',
|
683 |
'wrapper' => null
|
684 |
),
|
685 |
+
'autoSelectorMenuLinks' => array(
|
686 |
+
'value' => $v19,
|
687 |
+
'values' => null,
|
688 |
+
'id' => $this->db_prefix.$i.'_autoSelectorMenuLinks',
|
689 |
+
'field_type' => 'checkbox',
|
690 |
+
'label' => '',
|
691 |
+
'checkbox_label' => 'Enable on WordPress Menu links',
|
692 |
+
'radio_labels' => null,
|
693 |
+
'field_info' => null,
|
694 |
+
'description' => 'Automatically enable the plugin on custom links (containing a hash in their URL) created in WordPress Menus <br /><small>Requires WordPress version 3.6 or higher</small>',
|
695 |
+
'wrapper' => 'fieldset'
|
696 |
+
),
|
697 |
'scrollSpeed' => array(
|
698 |
'value' => $v1,
|
699 |
'values' => null,
|
909 |
'field_info' => 'screen-size',
|
910 |
'description' => 'Set the width,height screen-size (in pixels), below which the plugin will be disabled (e.g. <code>1024</code>, <code>1024,600</code>)',
|
911 |
'wrapper' => null
|
912 |
+
),
|
913 |
+
'adminDisplayWidgetsId' => array(
|
914 |
+
'value' => $v20,
|
915 |
+
'values' => null,
|
916 |
+
'id' => $this->db_prefix.$i.'_adminDisplayWidgetsId',
|
917 |
+
'field_type' => 'checkbox',
|
918 |
+
'label' => 'Administration',
|
919 |
+
'checkbox_label' => 'Display widgets id attribute',
|
920 |
+
'radio_labels' => null,
|
921 |
+
'field_info' => null,
|
922 |
+
'description' => 'Show the id attribute of each widget in Appearance → Widgets',
|
923 |
+
'wrapper' => 'fieldset'
|
924 |
+
),
|
925 |
+
'adminTinyMCEbuttons' => array(
|
926 |
+
'value' => $v21,
|
927 |
+
'values' => null,
|
928 |
+
'id' => $this->db_prefix.$i.'_adminTinyMCEbuttons',
|
929 |
+
'field_type' => 'checkbox',
|
930 |
+
'label' => '',
|
931 |
+
'checkbox_label' => 'Enable insert link/target buttons in post visual editor',
|
932 |
+
'radio_labels' => null,
|
933 |
+
'field_info' => null,
|
934 |
+
'description' => '<small>Requires WordPress version 3.9 or higher</small>',
|
935 |
+
'wrapper' => 'fieldset'
|
936 |
)
|
937 |
);
|
938 |
}
|
942 |
}
|
943 |
|
944 |
if(class_exists('malihuPageScroll2id')){ // --edit--
|
945 |
+
|
946 |
+
// tinyMCE class --edit--
|
947 |
+
require_once(plugin_dir_path( __FILE__ ).'includes/class-malihu-pagescroll2id-tinymce.php');
|
948 |
+
|
949 |
malihuPageScroll2id::get_instance(); // --edit--
|
950 |
+
|
951 |
+
// Widget class --edit--
|
952 |
+
require_once(plugin_dir_path( __FILE__ ).'includes/class-malihu-pagescroll2id-widget.php');
|
953 |
|
954 |
}
|
955 |
?>
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: malihu
|
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=UYJ5G65M6ZA28
|
4 |
Tags: page scrolling, page animation, navigation, single-page navigation
|
5 |
Requires at least: 3.3
|
6 |
-
Tested up to: 4.
|
7 |
-
Stable tag: 1.6.
|
8 |
License: The MIT License (MIT)
|
9 |
License URI: http://opensource.org/licenses/MIT
|
10 |
|
@@ -12,12 +12,12 @@ Page scroll to id is an easy-to-use jQuery plugin that enables animated page scr
|
|
12 |
|
13 |
== Description ==
|
14 |
|
15 |
-
The plugin replaces the default browser behaviour of "jumping" to page sections when links with href value containing `#` are clicked, by smoothly animating the page to those sections. You can use it for simple back-to-top links or complex
|
16 |
|
17 |
* Auto-adjustable animation speed
|
18 |
* Advanced animation easings
|
19 |
* Vertical and/or horizontal scrolling
|
20 |
-
* Links and targets highlighting via ready-to-use classes
|
21 |
* Auto-adjustable scroll-to position
|
22 |
* Advanced scroll-to position offset (by pixels, by element selector, link specific offsets etc.)
|
23 |
* Page scrolling from/to different pages (scrolling to location hash)
|
@@ -32,10 +32,14 @@ The plugin replaces the default browser behaviour of "jumping" to page sections
|
|
32 |
|
33 |
Page scroll to id requires WordPress version **3.3** or higher and jQuery version **1.6.0** or higher. For older installations implement it in your theme [manually](http://manos.malihu.gr/page-scroll-to-id/). Your theme **must** (and should) have `wp_head()` and `wp_footer()` functions. In some MS Windows based web servers the plugin might produce an error 500 (depends on server/PHP configuration). To pinpoint the issue [enable debugging](https://codex.wordpress.org/Debugging_in_WordPress) in `wp-config.php` and check `wp-content/debug.log` file for relevant errors.
|
34 |
|
35 |
-
= Quick usage =
|
36 |
|
37 |
1. [Install the plugin](http://wordpress.org/plugins/page-scroll-to-id/installation/).
|
38 |
-
2.
|
|
|
|
|
|
|
|
|
39 |
|
40 |
= Tutorials =
|
41 |
|
@@ -71,7 +75,7 @@ Configure plugin options by clicking 'Settings' or through the 'Settings > Page
|
|
71 |
|
72 |
= How to use the plugin with WP custom/native menus? =
|
73 |
|
74 |
-
|
75 |
|
76 |
= How to use the plugin without editing my theme's markup? =
|
77 |
|
@@ -143,8 +147,21 @@ Yes but you probably need to implement the plugin in your theme **manually**. Se
|
|
143 |
|
144 |
2. Page scoll to id settings help
|
145 |
|
|
|
|
|
|
|
|
|
146 |
== Changelog ==
|
147 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
= 1.6.0 =
|
149 |
* Fixed contextual help shortcut links in plugin settings page.
|
150 |
* Added new option 'Enable for all targets' for 'Scroll to location hash'.
|
@@ -226,9 +243,13 @@ Yes but you probably need to implement the plugin in your theme **manually**. Se
|
|
226 |
|
227 |
== Upgrade Notice ==
|
228 |
|
|
|
|
|
|
|
|
|
229 |
= 1.6.0 =
|
230 |
|
231 |
-
Fixed some (minor) issues in admin and front-end, added new options (Enable for all targets' and 'Delay') for 'Scroll to location hash', updated help and readme.txt.
|
232 |
|
233 |
= 1.5.9 =
|
234 |
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=UYJ5G65M6ZA28
|
4 |
Tags: page scrolling, page animation, navigation, single-page navigation
|
5 |
Requires at least: 3.3
|
6 |
+
Tested up to: 4.7
|
7 |
+
Stable tag: 1.6.1
|
8 |
License: The MIT License (MIT)
|
9 |
License URI: http://opensource.org/licenses/MIT
|
10 |
|
12 |
|
13 |
== Description ==
|
14 |
|
15 |
+
The plugin replaces the default browser behaviour of "jumping" to page sections when links with href value containing `#` are clicked, by smoothly animating the page to those sections. You can use it for simple back-to-top links or complex single-page website navigation. Features include:
|
16 |
|
17 |
* Auto-adjustable animation speed
|
18 |
* Advanced animation easings
|
19 |
* Vertical and/or horizontal scrolling
|
20 |
+
* Links and targets highlighting via ready-to-use CSS classes
|
21 |
* Auto-adjustable scroll-to position
|
22 |
* Advanced scroll-to position offset (by pixels, by element selector, link specific offsets etc.)
|
23 |
* Page scrolling from/to different pages (scrolling to location hash)
|
32 |
|
33 |
Page scroll to id requires WordPress version **3.3** or higher and jQuery version **1.6.0** or higher. For older installations implement it in your theme [manually](http://manos.malihu.gr/page-scroll-to-id/). Your theme **must** (and should) have `wp_head()` and `wp_footer()` functions. In some MS Windows based web servers the plugin might produce an error 500 (depends on server/PHP configuration). To pinpoint the issue [enable debugging](https://codex.wordpress.org/Debugging_in_WordPress) in `wp-config.php` and check `wp-content/debug.log` file for relevant errors.
|
34 |
|
35 |
+
= Quick usage and tips =
|
36 |
|
37 |
1. [Install the plugin](http://wordpress.org/plugins/page-scroll-to-id/installation/).
|
38 |
+
2. Check "Enable on WordPress Menu links" in plugin's settings to automatically enable the plugin on your WordPress menus custom links.
|
39 |
+
3. Create your links and targets using plugin's shortcodes (see "Help" in plugin settings page) directly in WordPress post editor or via plugin's buttons in visual editor toolbar.
|
40 |
+
4. Create targets in widgets areas using "Page scroll to id target" widget.
|
41 |
+
5. Add the class `ps2id` on any link you want to be handled by the plugin.
|
42 |
+
6. If you prefer not to automatically enable the plugin on WordPress menus, use either `m_PageScroll2id` or `ps2id` values in 'Link Relationship (XFN)' and 'CSS Classes' fields accordingly. To enable the rel attribute field in WordPress Menus, click 'Screen Options' and check 'Link Relationship (XFN)'. To enable the plugin on a menu item, click the arrow on the right of the item and insert `m_PageScroll2id` in the 'Link Relationship (XFN)' field.
|
43 |
|
44 |
= Tutorials =
|
45 |
|
75 |
|
76 |
= How to use the plugin with WP custom/native menus? =
|
77 |
|
78 |
+
Check "Enable on WordPress Menu links" in plugin's settings to automatically enable the plugin on your WordPress menus custom links. If you prefer to do it manually, while on the 'Menus' admin page, click 'Screen Options' and check 'Link Relationship (XFN)'. To enable the plugin on a menu item (added to menu via 'Custom Links' panel), click the arrow on the right of the item and insert `m_PageScroll2id` in the 'Link Relationship (XFN)' field (assuming your menu contains links with `URL` value in the form of `#id`). Alternately, you can simply add the value `ps2id` in 'CSS Classes' field.
|
79 |
|
80 |
= How to use the plugin without editing my theme's markup? =
|
81 |
|
147 |
|
148 |
2. Page scoll to id settings help
|
149 |
|
150 |
+
3. Multiple selectors
|
151 |
+
|
152 |
+
4. Page scoll to id target widget
|
153 |
+
|
154 |
== Changelog ==
|
155 |
|
156 |
+
= 1.6.1 =
|
157 |
+
* Added additional default selectors: `.ps2id > a[href*='#'],a.ps2id[href*='#']`.
|
158 |
+
* Added "Page scroll to id target" widget.
|
159 |
+
* Added custom buttons in WordPress visual editor for plugin's shortcodes insertion.
|
160 |
+
* Added new option 'Enable on WordPress Menu links' in plugin settings.
|
161 |
+
* Fixed browser's history back button when 'Scroll to location hash' option is enabled.
|
162 |
+
* Updated readme.txt.
|
163 |
+
* Extended help and documentation.
|
164 |
+
|
165 |
= 1.6.0 =
|
166 |
* Fixed contextual help shortcut links in plugin settings page.
|
167 |
* Added new option 'Enable for all targets' for 'Scroll to location hash'.
|
243 |
|
244 |
== Upgrade Notice ==
|
245 |
|
246 |
+
= 1.6.1 =
|
247 |
+
|
248 |
+
Fixed browser's history back button for 'Scroll to location hash' option, added new options ('Enable on WordPress Menu links'), added plugin's target widget, added plugin's buttons in visual editor, extended default selectors, updated help and readme.txt.
|
249 |
+
|
250 |
= 1.6.0 =
|
251 |
|
252 |
+
Fixed some (minor) issues in admin and front-end, added new options ('Enable for all targets' and 'Delay') for 'Scroll to location hash', updated help and readme.txt.
|
253 |
|
254 |
= 1.5.9 =
|
255 |
|