Version Description
- Fixed a bug which was breaking page scrolling in some WordPress themes/installations in version 1.6.2.
- Fixed a bug regarding links with URL in non-latin characters (e.g. Greek, Cyrillic etc.).
- Better plugin version control for multisite installations.
- Fixed PHP 7 notices and warnings.
- Plugin is now enabled by default on all links with a non-empty hash value (e.g. #some-id) in their URL.
- Changed default scroll duration from 1000 to 800 milliseconds.
- Added support for anchors inside SVG elements.
- Added new option 'Verify target position and readjust scrolling if necessary'.
- Added new option 'Use element custom offset when scrolling from/to different pages'.
- Added new option 'Remove URL hash when scrolling from/to different pages'.
Download this release
Release Info
Developer | malihu |
Plugin | Page scroll to id |
Version | 1.6.3 |
Comparing to | |
See all releases |
Code changes from version 1.6.2 to 1.6.3
- includes/admin.php +13 -2
- includes/class-malihu-pagescroll2id-widget-init-php52.php +5 -0
- includes/class-malihu-pagescroll2id-widget-init.php +5 -0
- includes/class-malihu-pagescroll2id-widget.php +2 -2
- includes/help/shortcodes.inc +1 -1
- includes/malihu-pagescroll2id-shortcodes-php52.php +39 -0
- includes/malihu-pagescroll2id-shortcodes.php +39 -0
- includes/mo-admin-notice.php +173 -0
- js/jquery.malihu.PageScroll2id-init.js +35 -9
- js/jquery.malihu.PageScroll2id.js +5 -5
- js/page-scroll-to-id.min.js +2 -2
- malihu-pagescroll2id.php +76 -48
- readme.txt +30 -1
includes/admin.php
CHANGED
@@ -11,8 +11,19 @@ $toggle_instance_title=__('Click to toggle', $this->plugin_slug);
|
|
11 |
|
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>
|
11 |
|
12 |
<div class="wrap">
|
13 |
|
14 |
+
<?php if( version_compare(get_bloginfo('version'), '3.8', '<') && function_exists('screen_icon') ) screen_icon(); ?>
|
15 |
+
<?php
|
16 |
+
$plugin_admin_page_title=esc_html(get_admin_page_title());
|
17 |
+
if( version_compare(get_bloginfo('version'), '4.3', '<') ){
|
18 |
+
?>
|
19 |
+
<h2><?php echo $plugin_admin_page_title; ?></h2>
|
20 |
+
<?php
|
21 |
+
}else{
|
22 |
+
?>
|
23 |
+
<h1><?php echo $plugin_admin_page_title; ?></h1>
|
24 |
+
<?php
|
25 |
+
}
|
26 |
+
?>
|
27 |
|
28 |
<div class="plugin-header">
|
29 |
<p class="plugin-info"><?php echo $plugin_info; ?></p>
|
includes/class-malihu-pagescroll2id-widget-init-php52.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
add_action('widgets_init',
|
3 |
+
create_function('', 'return register_widget("malihuPageScroll2idWidget");')
|
4 |
+
);
|
5 |
+
?>
|
includes/class-malihu-pagescroll2id-widget-init.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
add_action('widgets_init', function(){
|
3 |
+
register_widget('malihuPageScroll2idWidget');
|
4 |
+
});
|
5 |
+
?>
|
includes/class-malihu-pagescroll2id-widget.php
CHANGED
@@ -54,7 +54,7 @@ class malihuPageScroll2idWidget extends WP_Widget {
|
|
54 |
|
55 |
}
|
56 |
|
57 |
-
|
58 |
-
|
59 |
);
|
60 |
?>
|
54 |
|
55 |
}
|
56 |
|
57 |
+
include_once(
|
58 |
+
plugin_dir_path( __FILE__ ).(version_compare(PHP_VERSION, '5.3', '<') ? 'class-malihu-pagescroll2id-widget-init-php52.php' : 'class-malihu-pagescroll2id-widget-init.php')
|
59 |
);
|
60 |
?>
|
includes/help/shortcodes.inc
CHANGED
@@ -17,7 +17,7 @@ $help_shortcodes_text=<<<EOD
|
|
17 |
</li>
|
18 |
<li>
|
19 |
<a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#plugin-shortcodes-link-offset" target="_blank">offset</a> (optional) - Link-specific offset (bypasses the general offset value in plugin settings) <br />
|
20 |
-
Examples: <code>ps2id url='#some-id' offset='100']link text[/ps2id]</code> (offset scrolling by 100 pixels), <code>[ps2id url='#some-id' offset='#navigation-menu']link text[/ps2id]</code> (Offset scrolling by the height/width of the element with id <code>navigation-menu</code>)
|
21 |
</li>
|
22 |
<li>
|
23 |
<a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#plugin-shortcodes-link-class" target="_blank">class</a> (optional) - Link custom class(es) <br />
|
17 |
</li>
|
18 |
<li>
|
19 |
<a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#plugin-shortcodes-link-offset" target="_blank">offset</a> (optional) - Link-specific offset (bypasses the general offset value in plugin settings) <br />
|
20 |
+
Examples: <code>[ps2id url='#some-id' offset='100']link text[/ps2id]</code> (offset scrolling by 100 pixels), <code>[ps2id url='#some-id' offset='#navigation-menu']link text[/ps2id]</code> (Offset scrolling by the height/width of the element with id <code>navigation-menu</code>)
|
21 |
</li>
|
22 |
<li>
|
23 |
<a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#plugin-shortcodes-link-class" target="_blank">class</a> (optional) - Link custom class(es) <br />
|
includes/malihu-pagescroll2id-shortcodes-php52.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin shortcodes for PHP 5.2
|
4 |
+
*/
|
5 |
+
|
6 |
+
$pl_shortcodes[$i]=create_function('$atts,$content=null','
|
7 |
+
extract(shortcode_atts(array(
|
8 |
+
"i" => "'.$i.'",
|
9 |
+
"shortcode_class" => "_'.$shortcode_class.'",
|
10 |
+
"url" => "",
|
11 |
+
"offset" => "",
|
12 |
+
"id" => "",
|
13 |
+
"target" => "",
|
14 |
+
"class" => "",
|
15 |
+
), $atts));
|
16 |
+
if($id!==""){
|
17 |
+
if($content){
|
18 |
+
return "<div id=\"".$id."\" data-ps2id-target=\"".sanitize_text_field($target)."\">".do_shortcode($content)."</div>";
|
19 |
+
}else{
|
20 |
+
return "<a id=\"".$id."\" data-ps2id-target=\"".sanitize_text_field($target)."\"></a>";
|
21 |
+
}
|
22 |
+
}else{
|
23 |
+
$element_classes=$class!=="" ? $shortcode_class." ".$class : $shortcode_class;
|
24 |
+
return "<a href=\"".esc_url_raw($url)."\" class=\"".$element_classes."\" data-ps2id-offset=\'".sanitize_text_field($offset)."\'>".do_shortcode($content)."</a>";
|
25 |
+
}
|
26 |
+
');
|
27 |
+
add_shortcode($tag, $pl_shortcodes[$i]);
|
28 |
+
$pl_shortcodes_b[$i]=create_function('$atts,$content=null','
|
29 |
+
extract(shortcode_atts(array(
|
30 |
+
"i" => "'.$i.'",
|
31 |
+
"id" => "",
|
32 |
+
"target" => "",
|
33 |
+
), $atts));
|
34 |
+
if($id!==""){
|
35 |
+
return "<div id=\"".$id."\" data-ps2id-target=\"".sanitize_text_field($target)."\">".do_shortcode($content)."</div>";
|
36 |
+
}
|
37 |
+
');
|
38 |
+
add_shortcode($tag_b, $pl_shortcodes_b[$i]);
|
39 |
+
?>
|
includes/malihu-pagescroll2id-shortcodes.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin shortcodes for PHP 5.3+
|
4 |
+
*/
|
5 |
+
|
6 |
+
$pl_shortcodes[$i]=function($atts,$content=null) use ($i, $shortcode_class){
|
7 |
+
extract(shortcode_atts(array(
|
8 |
+
'i' => $i,
|
9 |
+
'shortcode_class' => '_'.$shortcode_class,
|
10 |
+
'url' => '',
|
11 |
+
'offset' => '',
|
12 |
+
'id' => '',
|
13 |
+
'target' => '',
|
14 |
+
'class' => '',
|
15 |
+
), $atts));
|
16 |
+
if($id!==""){
|
17 |
+
if($content){
|
18 |
+
return '<div id="'.$id.'" data-ps2id-target="'.sanitize_text_field($target).'">'.do_shortcode($content).'</div>';
|
19 |
+
}else{
|
20 |
+
return '<a id="'.$id.'" data-ps2id-target="'.sanitize_text_field($target).'"></a>';
|
21 |
+
}
|
22 |
+
}else{
|
23 |
+
$element_classes=$class!=='' ? $shortcode_class.' '.$class : $shortcode_class;
|
24 |
+
return '<a href="'.esc_url_raw($url).'" class="'.$element_classes.'" data-ps2id-offset="'.sanitize_text_field($offset).'">'.do_shortcode($content).'</a>';
|
25 |
+
}
|
26 |
+
};
|
27 |
+
add_shortcode($tag, $pl_shortcodes[$i]);
|
28 |
+
$pl_shortcodes_b[$i]=function($atts,$content=null) use ($i){
|
29 |
+
extract(shortcode_atts(array(
|
30 |
+
'i' => $i,
|
31 |
+
'id' => '',
|
32 |
+
'target' => '',
|
33 |
+
), $atts));
|
34 |
+
if($id!==''){
|
35 |
+
return '<div id="'.$id.'" data-ps2id-target="'.sanitize_text_field($target).'">'.do_shortcode($content).'</div>';
|
36 |
+
}
|
37 |
+
};
|
38 |
+
add_shortcode($tag_b, $pl_shortcodes_b[$i]);
|
39 |
+
?>
|
includes/mo-admin-notice.php
ADDED
@@ -0,0 +1,173 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if (!class_exists('MO_Admin_Notice')) {
|
3 |
+
|
4 |
+
class MO_Admin_Notice
|
5 |
+
{
|
6 |
+
public function __construct()
|
7 |
+
{
|
8 |
+
add_action('admin_notices', array($this, 'admin_notice'));
|
9 |
+
add_action('network_admin_notices', array($this, 'admin_notice'));
|
10 |
+
add_action('admin_init', array($this, 'dismiss_admin_notice'));
|
11 |
+
}
|
12 |
+
|
13 |
+
public function dismiss_admin_notice()
|
14 |
+
{
|
15 |
+
if (!isset($_GET['mo-adaction']) || $_GET['mo-adaction'] != 'mo_dismiss_adnotice') {
|
16 |
+
return;
|
17 |
+
}
|
18 |
+
|
19 |
+
$url = admin_url();
|
20 |
+
update_option('mo_dismiss_adnotice', 'true');
|
21 |
+
|
22 |
+
wp_redirect($url);
|
23 |
+
exit;
|
24 |
+
}
|
25 |
+
|
26 |
+
public function admin_notice()
|
27 |
+
{
|
28 |
+
if (get_option('mo_dismiss_adnotice', 'false') == 'true') {
|
29 |
+
return;
|
30 |
+
}
|
31 |
+
|
32 |
+
if ($this->is_plugin_installed() && $this->is_plugin_active()) {
|
33 |
+
return;
|
34 |
+
}
|
35 |
+
|
36 |
+
$dismiss_url = esc_url_raw(
|
37 |
+
add_query_arg(
|
38 |
+
array(
|
39 |
+
'mo-adaction' => 'mo_dismiss_adnotice'
|
40 |
+
),
|
41 |
+
admin_url()
|
42 |
+
)
|
43 |
+
);
|
44 |
+
$this->notice_css();
|
45 |
+
$install_url = wp_nonce_url(
|
46 |
+
admin_url('update.php?action=install-plugin&plugin=mailoptin'),
|
47 |
+
'install-plugin_mailoptin'
|
48 |
+
);
|
49 |
+
|
50 |
+
$activate_url = wp_nonce_url(admin_url('plugins.php?action=activate&plugin=mailoptin%2Fmailoptin.php'), 'activate-plugin_mailoptin/mailoptin.php');
|
51 |
+
?>
|
52 |
+
<div class="mo-admin-notice notice notice-success updated fade below-h2 is-dismissible">
|
53 |
+
<div class="mo-notice-first-half">
|
54 |
+
<p>
|
55 |
+
<?php
|
56 |
+
printf(
|
57 |
+
__('Free optin form plugin that will %1$sincrease your email list subscribers%2$s and keep them engaged with %1$sautomated and schedule newsletters%2$s.'),
|
58 |
+
'<span class="mo-stylize"><strong>', '</strong></span>');
|
59 |
+
?>
|
60 |
+
</p>
|
61 |
+
<p style="text-decoration: underline;font-size: 12px;">Recommended by "Page scroll to id" plugin</p>
|
62 |
+
</div>
|
63 |
+
<div class="mo-notice-other-half">
|
64 |
+
<p>
|
65 |
+
<?php if ( ! $this->is_plugin_installed()) : ?>
|
66 |
+
<a class="button button-primary button-hero" id="mo-install-mailoptin-plugin" href="<?php echo $install_url; ?>">
|
67 |
+
<?php _e('Install MailOptin Now for Free!'); ?>
|
68 |
+
</a>
|
69 |
+
<?php endif; ?>
|
70 |
+
<?php if ($this->is_plugin_installed() && ! $this->is_plugin_active()) : ?>
|
71 |
+
<a class="button button-primary button-hero" id="mo-activate-mailoptin-plugin" href="<?php echo $activate_url; ?>">
|
72 |
+
<?php _e('Activate MailOptin Now!'); ?>
|
73 |
+
</a>
|
74 |
+
<?php endif; ?>
|
75 |
+
</p>
|
76 |
+
<div class="mo-notice-learn-more">
|
77 |
+
<a target="_blank" href="https://mailoptin.io">Learn more</a> | <a href="<?php echo $dismiss_url; ?>"><?php _e('Dismiss this notice'); ?></a>
|
78 |
+
</div>
|
79 |
+
</div>
|
80 |
+
<a href="<?php echo $dismiss_url; ?>">
|
81 |
+
<button type="button">
|
82 |
+
<span class="screen-reader-text"><?php _e('Dismiss this notice'); ?>.</span>
|
83 |
+
</button>
|
84 |
+
</a>
|
85 |
+
</div>
|
86 |
+
<?php
|
87 |
+
}
|
88 |
+
|
89 |
+
public function is_plugin_installed()
|
90 |
+
{
|
91 |
+
$installed_plugins = get_plugins();
|
92 |
+
|
93 |
+
return isset($installed_plugins['mailoptin/mailoptin.php']);
|
94 |
+
}
|
95 |
+
|
96 |
+
public function is_plugin_active()
|
97 |
+
{
|
98 |
+
return is_plugin_active('mailoptin/mailoptin.php');
|
99 |
+
}
|
100 |
+
|
101 |
+
public function notice_css()
|
102 |
+
{
|
103 |
+
?>
|
104 |
+
<style type="text/css">
|
105 |
+
.mo-admin-notice {
|
106 |
+
background: #fff;
|
107 |
+
color: #000;
|
108 |
+
border-left-color: #46b450;
|
109 |
+
position: relative;
|
110 |
+
}
|
111 |
+
div.updated.mo-admin-notice{
|
112 |
+
margin: 40px 15px 15px 0;
|
113 |
+
}
|
114 |
+
.mo-admin-notice.updated > a > button {
|
115 |
+
padding: 0;
|
116 |
+
border: 0;
|
117 |
+
}
|
118 |
+
.mo-admin-notice .notice-dismiss:before {
|
119 |
+
color: #72777c;
|
120 |
+
}
|
121 |
+
.mo-admin-notice .mo-stylize {
|
122 |
+
line-height: 2;
|
123 |
+
}
|
124 |
+
.mo-admin-notice .button-primary {
|
125 |
+
background: #006799;
|
126 |
+
text-shadow: none;
|
127 |
+
border: 0;
|
128 |
+
box-shadow: none;
|
129 |
+
}
|
130 |
+
.mo-notice-first-half {
|
131 |
+
width: 66%;
|
132 |
+
}
|
133 |
+
.mo-notice-first-half, .mo-notice-other-half {
|
134 |
+
margin: 10px 0;
|
135 |
+
display: inline-block;
|
136 |
+
}
|
137 |
+
.mo-notice-other-half {
|
138 |
+
width: 33%;
|
139 |
+
position: absolute;
|
140 |
+
text-align: center;
|
141 |
+
margin-top: 5px;
|
142 |
+
}
|
143 |
+
.mo-notice-first-half p {
|
144 |
+
font-size: 14px;
|
145 |
+
}
|
146 |
+
.mo-notice-learn-more a {
|
147 |
+
margin: 10px;
|
148 |
+
}
|
149 |
+
.mo-notice-learn-more {
|
150 |
+
margin-top: 10px;
|
151 |
+
}
|
152 |
+
p + .mo-notice-learn-more {
|
153 |
+
margin-top: 0;
|
154 |
+
}
|
155 |
+
</style>
|
156 |
+
<?php
|
157 |
+
}
|
158 |
+
|
159 |
+
public static function instance()
|
160 |
+
{
|
161 |
+
static $instance = null;
|
162 |
+
|
163 |
+
if (is_null($instance)) {
|
164 |
+
$instance = new self();
|
165 |
+
}
|
166 |
+
|
167 |
+
return $instance;
|
168 |
+
}
|
169 |
+
}
|
170 |
+
}
|
171 |
+
|
172 |
+
MO_Admin_Notice::instance();
|
173 |
+
?>
|
js/jquery.malihu.PageScroll2id-init.js
CHANGED
@@ -40,7 +40,7 @@
|
|
40 |
$(this).data(_p+"Element",true);
|
41 |
});
|
42 |
if(_validateLocHash(_hash,_o.instances[_p+"_instance_"+k]["scrollToHashForAll"]==="true")){
|
43 |
-
var href=window.location.href.replace(/#.*$/,"#");
|
44 |
_toTop(_o.instances[_p+"_instance_"+k]["layout"]); //stop jump to hash straight away
|
45 |
if(window.history && window.history.replaceState){
|
46 |
window.history.replaceState("","",href);
|
@@ -53,7 +53,8 @@
|
|
53 |
});
|
54 |
$(window).on("load",function(){
|
55 |
for(var i=0; i<_o.total_instances; i++){
|
56 |
-
var sel=$(_o.instances[_p+"_instance_"+i]["selector"]+",."+shortcodeClass+","+autoSelectors)
|
|
|
57 |
sel.mPageScroll2id({
|
58 |
scrollSpeed:_o.instances[_p+"_instance_"+i]["scrollSpeed"],
|
59 |
autoScrollSpeed:(_o.instances[_p+"_instance_"+i]["autoScrollSpeed"]==="true") ? true : false,
|
@@ -70,18 +71,35 @@
|
|
70 |
keepHighlightUntilNext:(_o.instances[_p+"_instance_"+i]["keepHighlightUntilNext"]==="true") ? true : false,
|
71 |
highlightByNextTarget:(_o.instances[_p+"_instance_"+i]["highlightByNextTarget"]==="true") ? true : false,
|
72 |
disablePluginBelow:_screen(_o.instances[_p+"_instance_"+i]["disablePluginBelow"].toString()),
|
73 |
-
appendHash:(_o.instances[_p+"_instance_"+i]["appendHash"]==="true") ? true : false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
});
|
75 |
//scroll to location hash on page load
|
76 |
if(_o.instances[_p+"_instance_"+i]["scrollToHash"]==="true" && _hash){
|
77 |
if(_validateLocHash(_hash,_o.instances[_p+"_instance_"+i]["scrollToHashForAll"]==="true")){
|
78 |
_toTop(_o.instances[_p+"_instance_"+i]["layout"]); //jump/start from the top
|
|
|
|
|
79 |
setTimeout(function(){
|
80 |
-
|
81 |
-
|
82 |
-
window.history.replaceState("","",_hash);
|
83 |
}else{
|
84 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
}
|
86 |
},_o.instances[_p+"_instance_"+i]["scrollToHashDelay"]);
|
87 |
}
|
@@ -89,11 +107,19 @@
|
|
89 |
//attempt to unbind click events from other scripts
|
90 |
if(_o.instances[_p+"_instance_"+i]["unbindUnrelatedClickEvents"]==="true"){
|
91 |
setTimeout(function(){
|
92 |
-
var $events=sel.length ? $._data(sel[0],"events") : null;
|
93 |
if($events){
|
94 |
for(var i=$events.click.length-1; i>=0; i--){
|
95 |
var handler=$events.click[i];
|
96 |
-
if(handler && handler.namespace != "mPS2id")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
}
|
98 |
}
|
99 |
},300);
|
40 |
$(this).data(_p+"Element",true);
|
41 |
});
|
42 |
if(_validateLocHash(_hash,_o.instances[_p+"_instance_"+k]["scrollToHashForAll"]==="true")){
|
43 |
+
var href=_o.instances[_p+"_instance_"+k]["scrollToHashRemoveUrlHash"]==="true" ? window.location.href.replace(/#.*$/,"") : window.location.href.replace(/#.*$/,"#");
|
44 |
_toTop(_o.instances[_p+"_instance_"+k]["layout"]); //stop jump to hash straight away
|
45 |
if(window.history && window.history.replaceState){
|
46 |
window.history.replaceState("","",href);
|
53 |
});
|
54 |
$(window).on("load",function(){
|
55 |
for(var i=0; i<_o.total_instances; i++){
|
56 |
+
var sel=$(_o.instances[_p+"_instance_"+i]["selector"]+",."+shortcodeClass+","+autoSelectors),
|
57 |
+
autoCorrectScrollOpt=_o.instances[_p+"_instance_"+i]["autoCorrectScroll"],autoCorrectScroll=0;
|
58 |
sel.mPageScroll2id({
|
59 |
scrollSpeed:_o.instances[_p+"_instance_"+i]["scrollSpeed"],
|
60 |
autoScrollSpeed:(_o.instances[_p+"_instance_"+i]["autoScrollSpeed"]==="true") ? true : false,
|
71 |
keepHighlightUntilNext:(_o.instances[_p+"_instance_"+i]["keepHighlightUntilNext"]==="true") ? true : false,
|
72 |
highlightByNextTarget:(_o.instances[_p+"_instance_"+i]["highlightByNextTarget"]==="true") ? true : false,
|
73 |
disablePluginBelow:_screen(_o.instances[_p+"_instance_"+i]["disablePluginBelow"].toString()),
|
74 |
+
appendHash:(_o.instances[_p+"_instance_"+i]["appendHash"]==="true") ? true : false,
|
75 |
+
onStart:function(){
|
76 |
+
if(autoCorrectScrollOpt==="true" && mPS2id.trigger==="selector") autoCorrectScroll++;
|
77 |
+
},
|
78 |
+
onComplete:function(){
|
79 |
+
if(autoCorrectScroll==1){
|
80 |
+
if(mPS2id.clicked.length) mPS2id.clicked.trigger("click.mPS2id");
|
81 |
+
autoCorrectScroll=0;
|
82 |
+
}
|
83 |
+
}
|
84 |
});
|
85 |
//scroll to location hash on page load
|
86 |
if(_o.instances[_p+"_instance_"+i]["scrollToHash"]==="true" && _hash){
|
87 |
if(_validateLocHash(_hash,_o.instances[_p+"_instance_"+i]["scrollToHashForAll"]==="true")){
|
88 |
_toTop(_o.instances[_p+"_instance_"+i]["layout"]); //jump/start from the top
|
89 |
+
var scrollToHashUseElementData=_o.instances[_p+"_instance_"+i]["scrollToHashUseElementData"],
|
90 |
+
linkMatchesHash=$("a._mPS2id-h[href$='"+_hash+"'][data-ps2id-offset]:not([data-ps2id-offset=''])").last();
|
91 |
setTimeout(function(){
|
92 |
+
if(scrollToHashUseElementData==="true" && linkMatchesHash.length){
|
93 |
+
linkMatchesHash.trigger("click.mPS2id");
|
|
|
94 |
}else{
|
95 |
+
$.mPageScroll2id("scrollTo",_hash);
|
96 |
+
}
|
97 |
+
if(window.location.href.indexOf("#")!==-1){
|
98 |
+
if(window.history && window.history.replaceState){
|
99 |
+
window.history.replaceState("","",_hash);
|
100 |
+
}else{
|
101 |
+
window.location.hash=_hash;
|
102 |
+
}
|
103 |
}
|
104 |
},_o.instances[_p+"_instance_"+i]["scrollToHashDelay"]);
|
105 |
}
|
107 |
//attempt to unbind click events from other scripts
|
108 |
if(_o.instances[_p+"_instance_"+i]["unbindUnrelatedClickEvents"]==="true"){
|
109 |
setTimeout(function(){
|
110 |
+
var $events=sel.length ? $._data(sel.add($(document))[0],"events") : null;
|
111 |
if($events){
|
112 |
for(var i=$events.click.length-1; i>=0; i--){
|
113 |
var handler=$events.click[i];
|
114 |
+
if(handler && handler.namespace != "mPS2id"){
|
115 |
+
if(handler.selector==='a[href*="#"]'){
|
116 |
+
handler.selector='a[href*="#"]:not(._mPS2id-h)';
|
117 |
+
}else if(handler.selector==='a[href*=#]:not([href=#])'){
|
118 |
+
handler.selector='a[href*=#]:not([href=#]):not(._mPS2id-h)';
|
119 |
+
}else{
|
120 |
+
sel.off("click",handler.handler);
|
121 |
+
}
|
122 |
+
}
|
123 |
}
|
124 |
}
|
125 |
},300);
|
js/jquery.malihu.PageScroll2id.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
/*
|
2 |
== Page scroll to id ==
|
3 |
-
Version: 1.5.
|
4 |
Plugin URI: http://manos.malihu.gr/page-scroll-to-id/
|
5 |
Author: malihu
|
6 |
Author URI: http://manos.malihu.gr
|
@@ -151,7 +151,7 @@ THE SOFTWARE.
|
|
151 |
}
|
152 |
var $this=$(this),
|
153 |
href=$this.attr("href"),
|
154 |
-
hrefProp=$this.prop("href");
|
155 |
if(href && href.indexOf("#/")!==-1){
|
156 |
return;
|
157 |
}
|
@@ -270,7 +270,7 @@ THE SOFTWARE.
|
|
270 |
hrefProp=(!hrefProp) ? href : hrefProp;
|
271 |
var str=(hrefProp.indexOf("#/")!==-1) ? hrefProp.split("#/")[0] : hrefProp.split("#")[0],
|
272 |
loc=window.location.toString().split("#")[0];
|
273 |
-
return href!=="#" && href.indexOf("#")!==-1 && (str==="" || str===loc);
|
274 |
},
|
275 |
|
276 |
/* setup selectors, target elements, basic plugin classes etc. */
|
@@ -278,7 +278,7 @@ THE SOFTWARE.
|
|
278 |
_setup:function(){
|
279 |
var el=functions._highlightSelector(),i=1,tp=0;
|
280 |
return $(el).each(function(){
|
281 |
-
var $this=$(this),href=$this.attr("href"),hrefProp=$this.prop("href");
|
282 |
if(functions._isValid.call(null,href,hrefProp)){
|
283 |
var id=(href.indexOf("#/")!==-1) ? href.split("#/")[1] : href.split("#")[1],t=$("#"+id);
|
284 |
if(t.length>0){
|
@@ -551,7 +551,7 @@ THE SOFTWARE.
|
|
551 |
if($this.attr("class")){
|
552 |
var clickedClasses=$this.attr("class").split(" ");
|
553 |
for(var index in clickedClasses){
|
554 |
-
if(clickedClasses[index].match(/^ps2id-speed-\d+$/)){
|
555 |
speed=clickedClasses[index].split("ps2id-speed-")[1];
|
556 |
break;
|
557 |
}
|
1 |
/*
|
2 |
== Page scroll to id ==
|
3 |
+
Version: 1.5.9
|
4 |
Plugin URI: http://manos.malihu.gr/page-scroll-to-id/
|
5 |
Author: malihu
|
6 |
Author URI: http://manos.malihu.gr
|
151 |
}
|
152 |
var $this=$(this),
|
153 |
href=$this.attr("href"),
|
154 |
+
hrefProp=$this.prop("href").baseVal || $this.prop("href");
|
155 |
if(href && href.indexOf("#/")!==-1){
|
156 |
return;
|
157 |
}
|
270 |
hrefProp=(!hrefProp) ? href : hrefProp;
|
271 |
var str=(hrefProp.indexOf("#/")!==-1) ? hrefProp.split("#/")[0] : hrefProp.split("#")[0],
|
272 |
loc=window.location.toString().split("#")[0];
|
273 |
+
return href!=="#" && href.indexOf("#")!==-1 && (str==="" || decodeURIComponent(str)===decodeURIComponent(loc));
|
274 |
},
|
275 |
|
276 |
/* setup selectors, target elements, basic plugin classes etc. */
|
278 |
_setup:function(){
|
279 |
var el=functions._highlightSelector(),i=1,tp=0;
|
280 |
return $(el).each(function(){
|
281 |
+
var $this=$(this),href=$this.attr("href"),hrefProp=$this.prop("href").baseVal || $this.prop("href");
|
282 |
if(functions._isValid.call(null,href,hrefProp)){
|
283 |
var id=(href.indexOf("#/")!==-1) ? href.split("#/")[1] : href.split("#")[1],t=$("#"+id);
|
284 |
if(t.length>0){
|
551 |
if($this.attr("class")){
|
552 |
var clickedClasses=$this.attr("class").split(" ");
|
553 |
for(var index in clickedClasses){
|
554 |
+
if(String(clickedClasses[index]).match(/^ps2id-speed-\d+$/)){
|
555 |
speed=clickedClasses[index].split("ps2id-speed-")[1];
|
556 |
break;
|
557 |
}
|
js/page-scroll-to-id.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
/* Page scroll to id - version 1.6.
|
2 |
-
!function(e,t,n){var a,s,i,l,o,r,c,u,h,g,f,d,p="mPageScroll2id",_="mPS2id",v=".m_PageScroll2id,a[rel~='m_PageScroll2id'],.page-scroll-to-id,a[rel~='page-scroll-to-id'],._ps2id",C={scrollSpeed:1e3,autoScrollSpeed:!0,scrollEasing:"easeInOutQuint",scrollingEasing:"easeOutQuint",pageEndSmoothScroll:!0,layout:"vertical",offset:0,highlightSelector:!1,clickedClass:_+"-clicked",targetClass:_+"-target",highlightClass:_+"-highlight",forceSingleHighlight:!1,keepHighlightUntilNext:!1,highlightByNextTarget:!1,disablePluginBelow:!1,clickEvents:!0,appendHash:!1,onStart:function(){},onComplete:function(){},defaultSelector:!1,live:!0,liveSelector:!1},S=0,m={init:function(r){var r=e.extend(!0,{},C,r);if(e(n).data(_,r),s=e(n).data(_),!this.selector){var c="__"+_;this.each(function(){var t=e(this);t.hasClass(c)||t.addClass(c)}),this.selector="."+c}s.liveSelector&&(this.selector+=","+s.liveSelector),a=a?a+","+this.selector:this.selector,s.defaultSelector&&("object"==typeof e(a)&&0!==e(a).length||(a=v)),s.clickEvents&&e(n).undelegate("."+_).delegate(a,"click."+_,function(t){if(w._isDisabled.call(null))return void w._removeClasses.call(null);var n=e(this),a=n.attr("href"),s=n.prop("href");a&&-1!==a.indexOf("#/")||(w._reset.call(null),g=n.data("ps2id-offset")||0,w._isValid.call(null,a,s)&&w._findTarget.call(null,a)&&(t.preventDefault(),l="selector",o=n,w._setClasses.call(null,!0),w._scrollTo.call(null)))}),e(t).unbind("."+_).bind("scroll."+_+" resize."+_,function(){if(w._isDisabled.call(null))return void w._removeClasses.call(null);var t=e("._"+_+"-t");t.each(function(n){var a=e(this),s=a.attr("id"),i=w._findHighlight.call(null,s);w._setClasses.call(null,!1,a,i),n==t.length-1&&w._extendClasses.call(null)})}),i=!0,w._setup.call(null),w._live.call(null)},scrollTo:function(t,n){if(w._isDisabled.call(null))return void w._removeClasses.call(null);if(t&&"undefined"!=typeof t){w._isInit.call(null);var a={layout:s.layout,offset:s.offset,clicked:!1},n=e.extend(!0,{},a,n);w._reset.call(null),u=n.layout,h=n.offset,t=-1!==t.indexOf("#")?t:"#"+t,w._isValid.call(null,t)&&w._findTarget.call(null,t)&&(l="scrollTo",o=n.clicked,o&&w._setClasses.call(null,!0),w._scrollTo.call(null))}},destroy:function(){e(t).unbind("."+_),e(n).undelegate("."+_).removeData(_),e("._"+_+"-t").removeData(_),w._removeClasses.call(null,!0)}},w={_isDisabled:function(){var e=t,a="inner",i=s.disablePluginBelow instanceof Array?[s.disablePluginBelow[0]||0,s.disablePluginBelow[1]||0]:[s.disablePluginBelow||0,0];return"innerWidth"in t||(a="client",e=n.documentElement||n.body),e[a+"Width"]<=i[0]||e[a+"Height"]<=i[1]},_isValid:function(e,n){if(e){n=n?n:e;var a=-1!==n.indexOf("#/")?n.split("#/")[0]:n.split("#")[0],s=t.location.toString().split("#")[0];return"#"!==e&&-1!==e.indexOf("#")&&(""===a||a===s)}},_setup:function(){var t=w._highlightSelector(),n=1,a=0;return e(t).each(function(){var i=e(this),l=i.attr("href"),o=i.prop("href");if(w._isValid.call(null,l,o)){var r=-1!==l.indexOf("#/")?l.split("#/")[1]:l.split("#")[1],c=e("#"+r);if(c.length>0){s.highlightByNextTarget&&c!==a&&(a?a.data(_,{tn:c}):c.data(_,{tn:"0"}),a=c),c.hasClass("_"+_+"-t")||c.addClass("_"+_+"-t"),c.data(_,{i:n}),i.hasClass("_"+_+"-h")||i.addClass("_"+_+"-h");var u=w._findHighlight.call(null,r);w._setClasses.call(null,!1,c,u),S=n,n++,n==e(t).length&&w._extendClasses.call(null)}}})},_highlightSelector:function(){return s.highlightSelector&&""!==s.highlightSelector?s.highlightSelector:a},_findTarget:function(t){var n=-1!==t.indexOf("#/")?t.split("#/")[1]:t.split("#")[1],a=e("#"+n);if(a.length<1||"fixed"===a.css("position")){if("top"!==n)return;a=e("body")}return r=a,u||(u=s.layout),h=w._setOffset.call(null),c=[(a.offset().top-h[0]).toString(),(a.offset().left-h[1]).toString()],c[0]=c[0]<0?0:c[0],c[1]=c[1]<0?0:c[1],c},_setOffset:function(){h||(h=s.offset?s.offset:0),g&&(h=g);var t,n,a,i;switch(typeof h){case"object":case"string":t=[h.y?h.y:h,h.x?h.x:h],n=[t[0]instanceof jQuery?t[0]:e(t[0]),t[1]instanceof jQuery?t[1]:e(t[1])],n[0].length>0?(a=n[0].height(),"fixed"===n[0].css("position")&&(a+=n[0][0].offsetTop)):a=!isNaN(parseFloat(t[0]))&&isFinite(t[0])?parseInt(t[0]):0,n[1].length>0?(i=n[1].width(),"fixed"===n[1].css("position")&&(i+=n[1][0].offsetLeft)):i=!isNaN(parseFloat(t[1]))&&isFinite(t[1])?parseInt(t[1]):0;break;case"function":t=h.call(null),t instanceof Array?(a=t[0],i=t[1]):a=i=t;break;default:a=i=parseInt(h)}return[a,i]},_findHighlight:function(n){var a=t.location,s=a.toString().split("#")[0],i=a.pathname;return e("._"+_+"-h[href='#"+n+"'],._"+_+"-h[href='"+s+"#"+n+"'],._"+_+"-h[href='"+i+"#"+n+"'],._"+_+"-h[href='#/"+n+"'],._"+_+"-h[href='"+s+"#/"+n+"'],._"+_+"-h[href='"+i+"#/"+n+"']")},_setClasses:function(t,n,a){var i=s.clickedClass,l=s.targetClass,r=s.highlightClass;t&&i&&""!==i?(e("."+i).removeClass(i),o.addClass(i)):n&&l&&""!==l&&a&&r&&""!==r&&(w._currentTarget.call(null,n)?(n.addClass(l),a.addClass(r)):(!s.keepHighlightUntilNext||e("."+r).length>1)&&(n.removeClass(l),a.removeClass(r)))},_extendClasses:function(){var t=s.targetClass,n=s.highlightClass,a=e("."+t),i=e("."+n),l=t+"-first",o=t+"-last",r=n+"-first",c=n+"-last";e("._"+_+"-t").removeClass(l+" "+o),e("._"+_+"-h").removeClass(r+" "+c),s.forceSingleHighlight?s.keepHighlightUntilNext&&a.length>1?(a.slice(0,1).removeClass(t),i.slice(0,1).removeClass(n)):(a.slice(1).removeClass(t),i.slice(1).removeClass(n)):(a.slice(0,1).addClass(l).end().slice(-1).addClass(o),i.slice(0,1).addClass(r).end().slice(-1).addClass(c))},_removeClasses:function(t){e("."+s.clickedClass).removeClass(s.clickedClass),e("."+s.targetClass).removeClass(s.targetClass+" "+s.targetClass+"-first "+s.targetClass+"-last"),e("."+s.highlightClass).removeClass(s.highlightClass+" "+s.highlightClass+"-first "+s.highlightClass+"-last"),t&&(e("._"+_+"-t").removeClass("_"+_+"-t"),e("._"+_+"-h").removeClass("_"+_+"-h"))},_currentTarget:function(n){var a=s["target_"+n.data(_).i],i=n.data("ps2id-target"),l=i&&e(i)[0]?e(i)[0].getBoundingClientRect():n[0].getBoundingClientRect();if("undefined"!=typeof a){var o=n.offset().top,r=n.offset().left,c=a.from?a.from+o:o,u=a.to?a.to+o:o,h=a.fromX?a.fromX+r:r,g=a.toX?a.toX+r:r;return l.top>=u&&l.top<=c&&l.left>=g&&l.left<=h}var f=e(t).height(),d=e(t).width(),p=i?e(i).height():n.height(),v=i?e(i).width():n.width(),C=1+p/f,S=C,m=f>p?C*(f/p):C,w=1+v/d,y=w,b=d>v?w*(d/v):w,O=[l.top<=f/S,l.bottom>=f/m,l.left<=d/y,l.right>=d/b];if(s.highlightByNextTarget){var I=n.data(_).tn;if(I){var M=I[0].getBoundingClientRect();"vertical"===s.layout?O=[l.top<=f/2,M.top>f/2,1,1]:"horizontal"===s.layout&&(O=[1,1,l.left<=d/2,M.left>d/2])}}return O[0]&&O[1]&&O[2]&&O[3]},_scrollTo:function(){d=w._scrollSpeed.call(null),c=s.pageEndSmoothScroll?w._pageEndSmoothScroll.call(null):c;var n=e("html,body"),a=s.autoScrollSpeed?w._autoScrollSpeed.call(null):d,i=n.is(":animated")?s.scrollingEasing:s.scrollEasing,l=e(t).scrollTop(),o=e(t).scrollLeft();switch(u){case"horizontal":o!=c[1]&&(w._callbacks.call(null,"onStart"),n.stop().animate({scrollLeft:c[1]},a,i).promise().then(function(){w._callbacks.call(null,"onComplete")}));break;case"auto":if(l!=c[0]||o!=c[1])if(w._callbacks.call(null,"onStart"),navigator.userAgent.match(/(iPod|iPhone|iPad|Android)/)){var r;n.stop().animate({pageYOffset:c[0],pageXOffset:c[1]},{duration:a,easing:i,step:function(e,n){"pageXOffset"==n.prop?r=e:"pageYOffset"==n.prop&&t.scrollTo(r,e)}}).promise().then(function(){w._callbacks.call(null,"onComplete")})}else n.stop().animate({scrollTop:c[0],scrollLeft:c[1]},a,i).promise().then(function(){w._callbacks.call(null,"onComplete")});break;default:l!=c[0]&&(w._callbacks.call(null,"onStart"),n.stop().animate({scrollTop:c[0]},a,i).promise().then(function(){w._callbacks.call(null,"onComplete")}))}},_pageEndSmoothScroll:function(){var a=e(n).height(),s=e(n).width(),i=e(t).height(),l=e(t).width();return[a-c[0]<i?a-i:c[0],s-c[1]<l?s-l:c[1]]},_scrollSpeed:function(){var t=s.scrollSpeed;return o&&o.length&&o.add(o.parent()).each(function(){var n=e(this);if(n.attr("class")){var a=n.attr("class").split(" ");for(var s in a)if(a[s].match(/^ps2id-speed-\d+$/)){t=a[s].split("ps2id-speed-")[1];break}}}),parseInt(t)},_autoScrollSpeed:function(){var a=e(t).scrollTop(),s=e(t).scrollLeft(),i=e(n).height(),l=e(n).width(),o=[d+d*Math.floor(Math.abs(c[0]-a)/i*100)/100,d+d*Math.floor(Math.abs(c[1]-s)/l*100)/100];return Math.max.apply(Math,o)},_callbacks:function(e){if(s)switch(this[_]={trigger:l,clicked:o,target:r,scrollTo:{y:c[0],x:c[1]}},e){case"onStart":if(s.appendHash&&t.history&&t.history.pushState&&o&&o.length){var n="#"+o.attr("href").split("#")[1];n!==t.location.hash&&history.pushState("","",n)}s.onStart.call(null,this[_]);break;case"onComplete":s.onComplete.call(null,this[_])}},_reset:function(){u=h=g=!1},_isInit:function(){i||m.init.apply(this)},_live:function(){f=setTimeout(function(){s.live?e(w._highlightSelector()).length!==S&&w._setup.call(null):f&&clearTimeout(f),w._live.call(null)},1e3)},_easing:function(){function t(e){var t=7.5625,n=2.75;return 1/n>e?t*e*e:2/n>e?t*(e-=1.5/n)*e+.75:2.5/n>e?t*(e-=2.25/n)*e+.9375:t*(e-=2.625/n)*e+.984375}e.easing.easeInQuad=e.easing.easeInQuad||function(e){return e*e},e.easing.easeOutQuad=e.easing.easeOutQuad||function(e){return 1-(1-e)*(1-e)},e.easing.easeInOutQuad=e.easing.easeInOutQuad||function(e){return.5>e?2*e*e:1-Math.pow(-2*e+2,2)/2},e.easing.easeInCubic=e.easing.easeInCubic||function(e){return e*e*e},e.easing.easeOutCubic=e.easing.easeOutCubic||function(e){return 1-Math.pow(1-e,3)},e.easing.easeInOutCubic=e.easing.easeInOutCubic||function(e){return.5>e?4*e*e*e:1-Math.pow(-2*e+2,3)/2},e.easing.easeInQuart=e.easing.easeInQuart||function(e){return e*e*e*e},e.easing.easeOutQuart=e.easing.easeOutQuart||function(e){return 1-Math.pow(1-e,4)},e.easing.easeInOutQuart=e.easing.easeInOutQuart||function(e){return.5>e?8*e*e*e*e:1-Math.pow(-2*e+2,4)/2},e.easing.easeInQuint=e.easing.easeInQuint||function(e){return e*e*e*e*e},e.easing.easeOutQuint=e.easing.easeOutQuint||function(e){return 1-Math.pow(1-e,5)},e.easing.easeInOutQuint=e.easing.easeInOutQuint||function(e){return.5>e?16*e*e*e*e*e:1-Math.pow(-2*e+2,5)/2},e.easing.easeInExpo=e.easing.easeInExpo||function(e){return 0===e?0:Math.pow(2,10*e-10)},e.easing.easeOutExpo=e.easing.easeOutExpo||function(e){return 1===e?1:1-Math.pow(2,-10*e)},e.easing.easeInOutExpo=e.easing.easeInOutExpo||function(e){return 0===e?0:1===e?1:.5>e?Math.pow(2,20*e-10)/2:(2-Math.pow(2,-20*e+10))/2},e.easing.easeInSine=e.easing.easeInSine||function(e){return 1-Math.cos(e*Math.PI/2)},e.easing.easeOutSine=e.easing.easeOutSine||function(e){return Math.sin(e*Math.PI/2)},e.easing.easeInOutSine=e.easing.easeInOutSine||function(e){return-(Math.cos(Math.PI*e)-1)/2},e.easing.easeInCirc=e.easing.easeInCirc||function(e){return 1-Math.sqrt(1-Math.pow(e,2))},e.easing.easeOutCirc=e.easing.easeOutCirc||function(e){return Math.sqrt(1-Math.pow(e-1,2))},e.easing.easeInOutCirc=e.easing.easeInOutCirc||function(e){return.5>e?(1-Math.sqrt(1-Math.pow(2*e,2)))/2:(Math.sqrt(1-Math.pow(-2*e+2,2))+1)/2},e.easing.easeInElastic=e.easing.easeInElastic||function(e){return 0===e?0:1===e?1:-Math.pow(2,10*e-10)*Math.sin((10*e-10.75)*(2*Math.PI/3))},e.easing.easeOutElastic=e.easing.easeOutElastic||function(e){return 0===e?0:1===e?1:Math.pow(2,-10*e)*Math.sin((10*e-.75)*(2*Math.PI/3))+1},e.easing.easeInOutElastic=e.easing.easeInOutElastic||function(e){return 0===e?0:1===e?1:.5>e?-(Math.pow(2,20*e-10)*Math.sin((20*e-11.125)*(2*Math.PI/4.5)))/2:Math.pow(2,-20*e+10)*Math.sin((20*e-11.125)*(2*Math.PI/4.5))/2+1},e.easing.easeInBack=e.easing.easeInBack||function(e){return 2.70158*e*e*e-1.70158*e*e},e.easing.easeOutBack=e.easing.easeOutBack||function(e){return 1+2.70158*Math.pow(e-1,3)+1.70158*Math.pow(e-1,2)},e.easing.easeInOutBack=e.easing.easeInOutBack||function(e){return.5>e?Math.pow(2*e,2)*(7.189819*e-2.5949095)/2:(Math.pow(2*e-2,2)*(3.5949095*(2*e-2)+2.5949095)+2)/2},e.easing.easeInBounce=e.easing.easeInBounce||function(e){return 1-t(1-e)},e.easing.easeOutBounce=e.easing.easeOutBounce||t,e.easing.easeInOutBounce=e.easing.easeInOutBounce||function(e){return.5>e?(1-t(1-2*e))/2:(1+t(2*e-1))/2}}};w._easing.call(),e.fn[p]=function(t){return m[t]?m[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof t&&t?void e.error("Method "+t+" does not exist"):m.init.apply(this,arguments)},e[p]=function(t){return m[t]?m[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof t&&t?void e.error("Method "+t+" does not exist"):m.init.apply(this,arguments)},e[p].defaults=C}(jQuery,window,document),function(e){var t="mPS2id",n=mPS2id_params,a=n.shortcode_class,s=location.hash||null,i=function(n,a){try{e(n)}catch(s){return!1}return e(n).length&&(a||e("a[href*='"+n+"']").filter(function(){return 1==e(this).data(t+"Element")}).length)},l=function(e){if(-1!==e.indexOf(",")){var t=e.split(","),n=t[0]||"0",a=t[1]||"0";return{y:n,x:a}}return e},o=function(e){if(-1!==e.indexOf(",")){var t=e.split(","),n=t[0]||"0",a=t[1]||"0";return[n,a]}return e},r=function(t){"horizontal"!==t&&e(window).scrollTop(0),"vertical"!==t&&e(window).scrollLeft(0)},c="a[data-ps2id-api='true'][href*='#'],.ps2id > a[href*='#'],a.ps2id[href*='#']";e(document).ready(function(){for(var l=0;l<n.total_instances;l++)if("true"===n.instances[t+"_instance_"+l].scrollToHash&&s&&(e(n.instances[t+"_instance_"+l].selector+",."+a+","+c).each(function(){e(this).data(t+"Element",!0)}),i(s,"true"===n.instances[t+"_instance_"+l].scrollToHashForAll))){var o=window.location.href.replace(/#.*$/,"#");r(n.instances[t+"_instance_"+l].layout),window.history&&window.history.replaceState?window.history.replaceState("","",o):window.location.href=o}}),e(window).on("load",function(){for(var u=0;u<n.total_instances;u++){var h=e(n.instances[t+"_instance_"+u].selector+",."+a+","+c);h.mPageScroll2id({scrollSpeed:n.instances[t+"_instance_"+u].scrollSpeed,autoScrollSpeed:"true"===n.instances[t+"_instance_"+u].autoScrollSpeed,scrollEasing:n.instances[t+"_instance_"+u].scrollEasing,scrollingEasing:n.instances[t+"_instance_"+u].scrollingEasing,pageEndSmoothScroll:"true"===n.instances[t+"_instance_"+u].pageEndSmoothScroll,layout:n.instances[t+"_instance_"+u].layout,offset:l(n.instances[t+"_instance_"+u].offset.toString()),highlightSelector:n.instances[t+"_instance_"+u].highlightSelector,clickedClass:n.instances[t+"_instance_"+u].clickedClass,targetClass:n.instances[t+"_instance_"+u].targetClass,highlightClass:n.instances[t+"_instance_"+u].highlightClass,forceSingleHighlight:"true"===n.instances[t+"_instance_"+u].forceSingleHighlight,keepHighlightUntilNext:"true"===n.instances[t+"_instance_"+u].keepHighlightUntilNext,highlightByNextTarget:"true"===n.instances[t+"_instance_"+u].highlightByNextTarget,disablePluginBelow:o(n.instances[t+"_instance_"+u].disablePluginBelow.toString()),appendHash:"true"===n.instances[t+"_instance_"+u].appendHash}),"true"===n.instances[t+"_instance_"+u].scrollToHash&&s&&i(s,"true"===n.instances[t+"_instance_"+u].scrollToHashForAll)&&(r(n.instances[t+"_instance_"+u].layout),setTimeout(function(){e.mPageScroll2id("scrollTo",s),window.history&&window.history.replaceState?window.history.replaceState("","",s):window.location.hash=s},n.instances[t+"_instance_"+u].scrollToHashDelay)),"true"===n.instances[t+"_instance_"+u].unbindUnrelatedClickEvents&&setTimeout(function(){var t=h.length?e._data(h[0],"events"):null;if(t)for(var n=t.click.length-1;n>=0;n--){var a=t.click[n];a&&"mPS2id"!=a.namespace&&h.off("click",a.handler)}},300),"true"===n.instances[t+"_instance_"+u].normalizeAnchorPointTargets&&e("a._mPS2id-t[id]:empty").css({display:"inline-block","line-height":0,width:0,height:0,border:"none"}),"true"===n.instances[t+"_instance_"+u].stopScrollOnUserAction&&e(document).on("mousewheel DOMMouseScroll touchmove",function(){var t=e("html,body");t.is(":animated")&&t.stop()})}}),e.extend(e.expr[":"],{absolute:e.expr[":"].absolute||function(t){return"absolute"===e(t).css("position")},relative:e.expr[":"].relative||function(t){return"relative"===e(t).css("position")},"static":e.expr[":"]["static"]||function(t){return"static"===e(t).css("position")},fixed:e.expr[":"].fixed||function(t){return"fixed"===e(t).css("position")},width:e.expr[":"].width||function(t,n,a){var s=a[3].replace("<","<").replace(">",">");return s?">"===s.substr(0,1)?e(t).width()>s.substr(1):"<"===s.substr(0,1)?e(t).width()<s.substr(1):e(t).width()===parseInt(s):!1},height:e.expr[":"].height||function(t,n,a){var s=a[3].replace("<","<").replace(">",">");return s?">"===s.substr(0,1)?e(t).height()>s.substr(1):"<"===s.substr(0,1)?e(t).height()<s.substr(1):e(t).height()===parseInt(s):!1}})}(jQuery);
|
1 |
+
/* Page scroll to id - version 1.6.3 */
|
2 |
+
!function(y,O,i,e){var n,I,a,s,l,o,r,c,u,h,t,g,f="mPageScroll2id",x="mPS2id",d={scrollSpeed:1e3,autoScrollSpeed:!0,scrollEasing:"easeInOutQuint",scrollingEasing:"easeOutQuint",pageEndSmoothScroll:!0,layout:"vertical",offset:0,highlightSelector:!1,clickedClass:x+"-clicked",targetClass:x+"-target",highlightClass:x+"-highlight",forceSingleHighlight:!1,keepHighlightUntilNext:!1,highlightByNextTarget:!1,disablePluginBelow:!1,clickEvents:!0,appendHash:!1,onStart:function(){},onComplete:function(){},defaultSelector:!1,live:!0,liveSelector:!1},p=0,_={init:function(e){e=y.extend(!0,{},d,e);if(y(i).data(x,e),I=y(i).data(x),!this.selector){var t="__"+x;this.each(function(){var e=y(this);e.hasClass(t)||e.addClass(t)}),this.selector="."+t}I.liveSelector&&(this.selector+=","+I.liveSelector),n=n?n+","+this.selector:this.selector,I.defaultSelector&&("object"==typeof y(n)&&0!==y(n).length||(n=".m_PageScroll2id,a[rel~='m_PageScroll2id'],.page-scroll-to-id,a[rel~='page-scroll-to-id'],._ps2id")),I.clickEvents&&y(i).undelegate("."+x).delegate(n,"click."+x,function(e){if(m._isDisabled.call(null))m._removeClasses.call(null);else{var t=y(this),n=t.attr("href"),a=t.prop("href").baseVal||t.prop("href");n&&-1!==n.indexOf("#/")||(m._reset.call(null),h=t.data("ps2id-offset")||0,m._isValid.call(null,n,a)&&m._findTarget.call(null,n)&&(e.preventDefault(),s="selector",l=t,m._setClasses.call(null,!0),m._scrollTo.call(null)))}}),y(O).unbind("."+x).bind("scroll."+x+" resize."+x,function(){if(m._isDisabled.call(null))m._removeClasses.call(null);else{var s=y("._"+x+"-t");s.each(function(e){var t=y(this),n=t.attr("id"),a=m._findHighlight.call(null,n);m._setClasses.call(null,!1,t,a),e==s.length-1&&m._extendClasses.call(null)})}}),a=!0,m._setup.call(null),m._live.call(null)},scrollTo:function(e,t){if(m._isDisabled.call(null))m._removeClasses.call(null);else if(e&&void 0!==e){m._isInit.call(null);var n={layout:I.layout,offset:I.offset,clicked:!1};t=y.extend(!0,{},n,t);m._reset.call(null),c=t.layout,u=t.offset,e=-1!==e.indexOf("#")?e:"#"+e,m._isValid.call(null,e)&&m._findTarget.call(null,e)&&(s="scrollTo",(l=t.clicked)&&m._setClasses.call(null,!0),m._scrollTo.call(null))}},destroy:function(){y(O).unbind("."+x),y(i).undelegate("."+x).removeData(x),y("._"+x+"-t").removeData(x),m._removeClasses.call(null,!0)}},m={_isDisabled:function(){var e=O,t="inner",n=I.disablePluginBelow instanceof Array?[I.disablePluginBelow[0]||0,I.disablePluginBelow[1]||0]:[I.disablePluginBelow||0,0];return"innerWidth"in O||(t="client",e=i.documentElement||i.body),e[t+"Width"]<=n[0]||e[t+"Height"]<=n[1]},_isValid:function(e,t){if(e){var n=-1!==(t=t||e).indexOf("#/")?t.split("#/")[0]:t.split("#")[0],a=O.location.toString().split("#")[0];return"#"!==e&&-1!==e.indexOf("#")&&(""===n||decodeURIComponent(n)===decodeURIComponent(a))}},_setup:function(){var l=m._highlightSelector(),o=1,r=0;return y(l).each(function(){var e=y(this),t=e.attr("href"),n=e.prop("href").baseVal||e.prop("href");if(m._isValid.call(null,t,n)){var a=-1!==t.indexOf("#/")?t.split("#/")[1]:t.split("#")[1],s=y("#"+a);if(0<s.length){I.highlightByNextTarget&&s!==r&&(r?r.data(x,{tn:s}):s.data(x,{tn:"0"}),r=s),s.hasClass("_"+x+"-t")||s.addClass("_"+x+"-t"),s.data(x,{i:o}),e.hasClass("_"+x+"-h")||e.addClass("_"+x+"-h");var i=m._findHighlight.call(null,a);m._setClasses.call(null,!1,s,i),p=o,++o==y(l).length&&m._extendClasses.call(null)}}})},_highlightSelector:function(){return I.highlightSelector&&""!==I.highlightSelector?I.highlightSelector:n},_findTarget:function(e){var t=-1!==e.indexOf("#/")?e.split("#/")[1]:e.split("#")[1],n=y("#"+t);if(n.length<1||"fixed"===n.css("position")){if("top"!==t)return;n=y("body")}return o=n,c||(c=I.layout),u=m._setOffset.call(null),(r=[(n.offset().top-u[0]).toString(),(n.offset().left-u[1]).toString()])[0]=r[0]<0?0:r[0],r[1]=r[1]<0?0:r[1],r},_setOffset:function(){var e,t,n,a;switch(u||(u=I.offset?I.offset:0),h&&(u=h),typeof u){case"object":case"string":0<(t=[(e=[u.y?u.y:u,u.x?u.x:u])[0]instanceof jQuery?e[0]:y(e[0]),e[1]instanceof jQuery?e[1]:y(e[1])])[0].length?(n=t[0].height(),"fixed"===t[0].css("position")&&(n+=t[0][0].offsetTop)):n=!isNaN(parseFloat(e[0]))&&isFinite(e[0])?parseInt(e[0]):0,0<t[1].length?(a=t[1].width(),"fixed"===t[1].css("position")&&(a+=t[1][0].offsetLeft)):a=!isNaN(parseFloat(e[1]))&&isFinite(e[1])?parseInt(e[1]):0;break;case"function":(e=u.call(null))instanceof Array?(n=e[0],a=e[1]):n=a=e;break;default:n=a=parseInt(u)}return[n,a]},_findHighlight:function(e){var t=O.location,n=t.toString().split("#")[0],a=t.pathname;return y("._"+x+"-h[href='#"+e+"'],._"+x+"-h[href='"+n+"#"+e+"'],._"+x+"-h[href='"+a+"#"+e+"'],._"+x+"-h[href='#/"+e+"'],._"+x+"-h[href='"+n+"#/"+e+"'],._"+x+"-h[href='"+a+"#/"+e+"']")},_setClasses:function(e,t,n){var a=I.clickedClass,s=I.targetClass,i=I.highlightClass;e&&a&&""!==a?(y("."+a).removeClass(a),l.addClass(a)):t&&s&&""!==s&&n&&i&&""!==i&&(m._currentTarget.call(null,t)?(t.addClass(s),n.addClass(i)):(!I.keepHighlightUntilNext||1<y("."+i).length)&&(t.removeClass(s),n.removeClass(i)))},_extendClasses:function(){var e=I.targetClass,t=I.highlightClass,n=y("."+e),a=y("."+t),s=e+"-first",i=e+"-last",l=t+"-first",o=t+"-last";y("._"+x+"-t").removeClass(s+" "+i),y("._"+x+"-h").removeClass(l+" "+o),I.forceSingleHighlight?I.keepHighlightUntilNext&&1<n.length?(n.slice(0,1).removeClass(e),a.slice(0,1).removeClass(t)):(n.slice(1).removeClass(e),a.slice(1).removeClass(t)):(n.slice(0,1).addClass(s).end().slice(-1).addClass(i),a.slice(0,1).addClass(l).end().slice(-1).addClass(o))},_removeClasses:function(e){y("."+I.clickedClass).removeClass(I.clickedClass),y("."+I.targetClass).removeClass(I.targetClass+" "+I.targetClass+"-first "+I.targetClass+"-last"),y("."+I.highlightClass).removeClass(I.highlightClass+" "+I.highlightClass+"-first "+I.highlightClass+"-last"),e&&(y("._"+x+"-t").removeClass("_"+x+"-t"),y("._"+x+"-h").removeClass("_"+x+"-h"))},_currentTarget:function(e){var t=I["target_"+e.data(x).i],n=e.data("ps2id-target"),a=n&&y(n)[0]?y(n)[0].getBoundingClientRect():e[0].getBoundingClientRect();if(void 0!==t){var s=e.offset().top,i=e.offset().left,l=t.from?t.from+s:s,o=t.to?t.to+s:s,r=t.fromX?t.fromX+i:i,c=t.toX?t.toX+i:i;return a.top>=o&&a.top<=l&&a.left>=c&&a.left<=r}var u=y(O).height(),h=y(O).width(),g=n?y(n).height():e.height(),f=n?y(n).width():e.width(),d=1+g/u,p=d,_=g<u?d*(u/g):d,m=1+f/h,S=m,v=f<h?m*(h/f):m,C=[a.top<=u/p,a.bottom>=u/_,a.left<=h/S,a.right>=h/v];if(I.highlightByNextTarget){var w=e.data(x).tn;if(w){var b=w[0].getBoundingClientRect();"vertical"===I.layout?C=[a.top<=u/2,b.top>u/2,1,1]:"horizontal"===I.layout&&(C=[1,1,a.left<=h/2,b.left>h/2])}}return C[0]&&C[1]&&C[2]&&C[3]},_scrollTo:function(){g=m._scrollSpeed.call(null),r=I.pageEndSmoothScroll?m._pageEndSmoothScroll.call(null):r;var e=y("html,body"),t=I.autoScrollSpeed?m._autoScrollSpeed.call(null):g,n=e.is(":animated")?I.scrollingEasing:I.scrollEasing,a=y(O).scrollTop(),s=y(O).scrollLeft();switch(c){case"horizontal":s!=r[1]&&(m._callbacks.call(null,"onStart"),e.stop().animate({scrollLeft:r[1]},t,n).promise().then(function(){m._callbacks.call(null,"onComplete")}));break;case"auto":var i;if(a!=r[0]||s!=r[1])if(m._callbacks.call(null,"onStart"),navigator.userAgent.match(/(iPod|iPhone|iPad|Android)/))e.stop().animate({pageYOffset:r[0],pageXOffset:r[1]},{duration:t,easing:n,step:function(e,t){"pageXOffset"==t.prop?i=e:"pageYOffset"==t.prop&&O.scrollTo(i,e)}}).promise().then(function(){m._callbacks.call(null,"onComplete")});else e.stop().animate({scrollTop:r[0],scrollLeft:r[1]},t,n).promise().then(function(){m._callbacks.call(null,"onComplete")});break;default:a!=r[0]&&(m._callbacks.call(null,"onStart"),e.stop().animate({scrollTop:r[0]},t,n).promise().then(function(){m._callbacks.call(null,"onComplete")}))}},_pageEndSmoothScroll:function(){var e=y(i).height(),t=y(i).width(),n=y(O).height(),a=y(O).width();return[e-r[0]<n?e-n:r[0],t-r[1]<a?t-a:r[1]]},_scrollSpeed:function(){var a=I.scrollSpeed;return l&&l.length&&l.add(l.parent()).each(function(){var e=y(this);if(e.attr("class")){var t=e.attr("class").split(" ");for(var n in t)if(String(t[n]).match(/^ps2id-speed-\d+$/)){a=t[n].split("ps2id-speed-")[1];break}}}),parseInt(a)},_autoScrollSpeed:function(){var e=y(O).scrollTop(),t=y(O).scrollLeft(),n=y(i).height(),a=y(i).width(),s=[g+g*Math.floor(Math.abs(r[0]-e)/n*100)/100,g+g*Math.floor(Math.abs(r[1]-t)/a*100)/100];return Math.max.apply(Math,s)},_callbacks:function(e){if(I)switch(this[x]={trigger:s,clicked:l,target:o,scrollTo:{y:r[0],x:r[1]}},e){case"onStart":if(I.appendHash&&O.history&&O.history.pushState&&l&&l.length){var t="#"+l.attr("href").split("#")[1];t!==O.location.hash&&history.pushState("","",t)}I.onStart.call(null,this[x]);break;case"onComplete":I.onComplete.call(null,this[x])}},_reset:function(){c=u=h=!1},_isInit:function(){a||_.init.apply(this)},_live:function(){t=setTimeout(function(){I.live?y(m._highlightSelector()).length!==p&&m._setup.call(null):t&&clearTimeout(t),m._live.call(null)},1e3)},_easing:function(){function t(e){var t=7.5625,n=2.75;return e<1/n?t*e*e:e<2/n?t*(e-=1.5/n)*e+.75:e<2.5/n?t*(e-=2.25/n)*e+.9375:t*(e-=2.625/n)*e+.984375}y.easing.easeInQuad=y.easing.easeInQuad||function(e){return e*e},y.easing.easeOutQuad=y.easing.easeOutQuad||function(e){return 1-(1-e)*(1-e)},y.easing.easeInOutQuad=y.easing.easeInOutQuad||function(e){return e<.5?2*e*e:1-Math.pow(-2*e+2,2)/2},y.easing.easeInCubic=y.easing.easeInCubic||function(e){return e*e*e},y.easing.easeOutCubic=y.easing.easeOutCubic||function(e){return 1-Math.pow(1-e,3)},y.easing.easeInOutCubic=y.easing.easeInOutCubic||function(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2},y.easing.easeInQuart=y.easing.easeInQuart||function(e){return e*e*e*e},y.easing.easeOutQuart=y.easing.easeOutQuart||function(e){return 1-Math.pow(1-e,4)},y.easing.easeInOutQuart=y.easing.easeInOutQuart||function(e){return e<.5?8*e*e*e*e:1-Math.pow(-2*e+2,4)/2},y.easing.easeInQuint=y.easing.easeInQuint||function(e){return e*e*e*e*e},y.easing.easeOutQuint=y.easing.easeOutQuint||function(e){return 1-Math.pow(1-e,5)},y.easing.easeInOutQuint=y.easing.easeInOutQuint||function(e){return e<.5?16*e*e*e*e*e:1-Math.pow(-2*e+2,5)/2},y.easing.easeInExpo=y.easing.easeInExpo||function(e){return 0===e?0:Math.pow(2,10*e-10)},y.easing.easeOutExpo=y.easing.easeOutExpo||function(e){return 1===e?1:1-Math.pow(2,-10*e)},y.easing.easeInOutExpo=y.easing.easeInOutExpo||function(e){return 0===e?0:1===e?1:e<.5?Math.pow(2,20*e-10)/2:(2-Math.pow(2,-20*e+10))/2},y.easing.easeInSine=y.easing.easeInSine||function(e){return 1-Math.cos(e*Math.PI/2)},y.easing.easeOutSine=y.easing.easeOutSine||function(e){return Math.sin(e*Math.PI/2)},y.easing.easeInOutSine=y.easing.easeInOutSine||function(e){return-(Math.cos(Math.PI*e)-1)/2},y.easing.easeInCirc=y.easing.easeInCirc||function(e){return 1-Math.sqrt(1-Math.pow(e,2))},y.easing.easeOutCirc=y.easing.easeOutCirc||function(e){return Math.sqrt(1-Math.pow(e-1,2))},y.easing.easeInOutCirc=y.easing.easeInOutCirc||function(e){return e<.5?(1-Math.sqrt(1-Math.pow(2*e,2)))/2:(Math.sqrt(1-Math.pow(-2*e+2,2))+1)/2},y.easing.easeInElastic=y.easing.easeInElastic||function(e){return 0===e?0:1===e?1:-Math.pow(2,10*e-10)*Math.sin((10*e-10.75)*(2*Math.PI/3))},y.easing.easeOutElastic=y.easing.easeOutElastic||function(e){return 0===e?0:1===e?1:Math.pow(2,-10*e)*Math.sin((10*e-.75)*(2*Math.PI/3))+1},y.easing.easeInOutElastic=y.easing.easeInOutElastic||function(e){return 0===e?0:1===e?1:e<.5?-Math.pow(2,20*e-10)*Math.sin((20*e-11.125)*(2*Math.PI/4.5))/2:Math.pow(2,-20*e+10)*Math.sin((20*e-11.125)*(2*Math.PI/4.5))/2+1},y.easing.easeInBack=y.easing.easeInBack||function(e){return 2.70158*e*e*e-1.70158*e*e},y.easing.easeOutBack=y.easing.easeOutBack||function(e){return 1+2.70158*Math.pow(e-1,3)+1.70158*Math.pow(e-1,2)},y.easing.easeInOutBack=y.easing.easeInOutBack||function(e){return e<.5?Math.pow(2*e,2)*(7.189819*e-2.5949095)/2:(Math.pow(2*e-2,2)*(3.5949095*(2*e-2)+2.5949095)+2)/2},y.easing.easeInBounce=y.easing.easeInBounce||function(e){return 1-t(1-e)},y.easing.easeOutBounce=y.easing.easeOutBounce||t,y.easing.easeInOutBounce=y.easing.easeInOutBounce||function(e){return e<.5?(1-t(1-2*e))/2:(1+t(2*e-1))/2}}};m._easing.call(),y.fn[f]=function(e){return _[e]?_[e].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof e&&e?void y.error("Method "+e+" does not exist"):_.init.apply(this,arguments)},y[f]=function(e){return _[e]?_[e].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof e&&e?void y.error("Method "+e+" does not exist"):_.init.apply(this,arguments)},y[f].defaults=d}(jQuery,window,document),function(l){var o="mPS2id",r=mPS2id_params,c=r.shortcode_class,u=location.hash||null,h=function(e,t){try{l(e)}catch(e){return!1}return l(e).length&&(t||l("a[href*='"+e+"']").filter(function(){return 1==l(this).data(o+"Element")}).length)},g=function(e){if(-1===e.indexOf(","))return e;var t=e.split(",");return{y:t[0]||"0",x:t[1]||"0"}},f=function(e){if(-1===e.indexOf(","))return e;var t=e.split(",");return[t[0]||"0",t[1]||"0"]},d=function(e){"horizontal"!==e&&l(window).scrollTop(0),"vertical"!==e&&l(window).scrollLeft(0)},p="a[data-ps2id-api='true'][href*='#'],.ps2id > a[href*='#'],a.ps2id[href*='#']";l(document).ready(function(){for(var e=0;e<r.total_instances;e++)if("true"===r.instances[o+"_instance_"+e].scrollToHash&&u&&(l(r.instances[o+"_instance_"+e].selector+",."+c+","+p).each(function(){l(this).data(o+"Element",!0)}),h(u,"true"===r.instances[o+"_instance_"+e].scrollToHashForAll))){var t="true"===r.instances[o+"_instance_"+e].scrollToHashRemoveUrlHash?window.location.href.replace(/#.*$/,""):window.location.href.replace(/#.*$/,"#");d(r.instances[o+"_instance_"+e].layout),window.history&&window.history.replaceState?window.history.replaceState("","",t):window.location.href=t}}),l(window).on("load",function(){for(var e=0;e<r.total_instances;e++){var a=l(r.instances[o+"_instance_"+e].selector+",."+c+","+p),t=r.instances[o+"_instance_"+e].autoCorrectScroll,n=0;if(a.mPageScroll2id({scrollSpeed:r.instances[o+"_instance_"+e].scrollSpeed,autoScrollSpeed:"true"===r.instances[o+"_instance_"+e].autoScrollSpeed,scrollEasing:r.instances[o+"_instance_"+e].scrollEasing,scrollingEasing:r.instances[o+"_instance_"+e].scrollingEasing,pageEndSmoothScroll:"true"===r.instances[o+"_instance_"+e].pageEndSmoothScroll,layout:r.instances[o+"_instance_"+e].layout,offset:g(r.instances[o+"_instance_"+e].offset.toString()),highlightSelector:r.instances[o+"_instance_"+e].highlightSelector,clickedClass:r.instances[o+"_instance_"+e].clickedClass,targetClass:r.instances[o+"_instance_"+e].targetClass,highlightClass:r.instances[o+"_instance_"+e].highlightClass,forceSingleHighlight:"true"===r.instances[o+"_instance_"+e].forceSingleHighlight,keepHighlightUntilNext:"true"===r.instances[o+"_instance_"+e].keepHighlightUntilNext,highlightByNextTarget:"true"===r.instances[o+"_instance_"+e].highlightByNextTarget,disablePluginBelow:f(r.instances[o+"_instance_"+e].disablePluginBelow.toString()),appendHash:"true"===r.instances[o+"_instance_"+e].appendHash,onStart:function(){"true"===t&&"selector"===mPS2id.trigger&&n++},onComplete:function(){1==n&&(mPS2id.clicked.length&&mPS2id.clicked.trigger("click.mPS2id"),n=0)}}),"true"===r.instances[o+"_instance_"+e].scrollToHash&&u&&h(u,"true"===r.instances[o+"_instance_"+e].scrollToHashForAll)){d(r.instances[o+"_instance_"+e].layout);var s=r.instances[o+"_instance_"+e].scrollToHashUseElementData,i=l("a._mPS2id-h[href$='"+u+"'][data-ps2id-offset]:not([data-ps2id-offset=''])").last();setTimeout(function(){"true"===s&&i.length?i.trigger("click.mPS2id"):l.mPageScroll2id("scrollTo",u),-1!==window.location.href.indexOf("#")&&(window.history&&window.history.replaceState?window.history.replaceState("","",u):window.location.hash=u)},r.instances[o+"_instance_"+e].scrollToHashDelay)}"true"===r.instances[o+"_instance_"+e].unbindUnrelatedClickEvents&&setTimeout(function(){var e=a.length?l._data(a.add(l(document))[0],"events"):null;if(e)for(var t=e.click.length-1;0<=t;t--){var n=e.click[t];n&&"mPS2id"!=n.namespace&&('a[href*="#"]'===n.selector?n.selector='a[href*="#"]:not(._mPS2id-h)':"a[href*=#]:not([href=#])"===n.selector?n.selector="a[href*=#]:not([href=#]):not(._mPS2id-h)":a.off("click",n.handler))}},300),"true"===r.instances[o+"_instance_"+e].normalizeAnchorPointTargets&&l("a._mPS2id-t[id]:empty").css({display:"inline-block","line-height":0,width:0,height:0,border:"none"}),"true"===r.instances[o+"_instance_"+e].stopScrollOnUserAction&&l(document).on("mousewheel DOMMouseScroll touchmove",function(){var e=l("html,body");e.is(":animated")&&e.stop()})}}),l.extend(l.expr[":"],{absolute:l.expr[":"].absolute||function(e){return"absolute"===l(e).css("position")},relative:l.expr[":"].relative||function(e){return"relative"===l(e).css("position")},static:l.expr[":"].static||function(e){return"static"===l(e).css("position")},fixed:l.expr[":"].fixed||function(e){return"fixed"===l(e).css("position")},width:l.expr[":"].width||function(e,t,n){var a=n[3].replace("<","<").replace(">",">");return!!a&&(">"===a.substr(0,1)?l(e).width()>a.substr(1):"<"===a.substr(0,1)?l(e).width()<a.substr(1):l(e).width()===parseInt(a))},height:l.expr[":"].height||function(e,t,n){var a=n[3].replace("<","<").replace(">",">");return!!a&&(">"===a.substr(0,1)?l(e).height()>a.substr(1):"<"===a.substr(0,1)?l(e).height()<a.substr(1):l(e).height()===parseInt(a))}})}(jQuery);
|
malihu-pagescroll2id.php
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
/*
|
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--
|
@@ -205,7 +205,8 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
|
|
205 |
$pl_instances=get_option($this->db_prefix.'instances', $this->default);
|
206 |
// Loop the array to generate instances, fields etc.
|
207 |
// Add settings section for each plugin instance
|
208 |
-
while(list($var, $val)=each($pl_instances)){
|
|
|
209 |
add_settings_section(
|
210 |
$this->db_prefix.'settings_section'.$this->index,
|
211 |
null,
|
@@ -213,8 +214,10 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
|
|
213 |
$this->plugin_slug
|
214 |
);
|
215 |
// Add settings fields for each section
|
216 |
-
while(list($var2, $val2)=each($val)){
|
217 |
-
|
|
|
|
|
218 |
switch($var3){
|
219 |
case 'value':
|
220 |
$i_val=$val3;
|
@@ -314,8 +317,11 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
|
|
314 |
}
|
315 |
|
316 |
public function add_plugin_action_links($links){
|
317 |
-
|
318 |
-
array_unshift($links, $settings_link);
|
|
|
|
|
|
|
319 |
return $links;
|
320 |
}
|
321 |
|
@@ -349,39 +355,9 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
|
|
349 |
$tag=$shortcode_class=$this->sc_pfx; // Shortcode without suffix
|
350 |
$tag_b=$this->sc_pfx.'_wrap'; // Shortcode without suffix
|
351 |
//$tag=$shortcode_class=$this->sc_pfx.'_'.$i; // Shortcode with suffix
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
"shortcode_class" => "_'.$shortcode_class.'",
|
356 |
-
"url" => "",
|
357 |
-
"offset" => "",
|
358 |
-
"id" => "",
|
359 |
-
"target" => "",
|
360 |
-
"class" => "",
|
361 |
-
), $atts));
|
362 |
-
if($id!==""){
|
363 |
-
if($content){
|
364 |
-
return "<div id=\"".$id."\" data-ps2id-target=\"".sanitize_text_field($target)."\">".do_shortcode($content)."</div>";
|
365 |
-
}else{
|
366 |
-
return "<a id=\"".$id."\" data-ps2id-target=\"".sanitize_text_field($target)."\">".do_shortcode($content)."</a>";
|
367 |
-
}
|
368 |
-
}else{
|
369 |
-
$element_classes=$class!=="" ? $shortcode_class." ".$class : $shortcode_class;
|
370 |
-
return "<a href=\"".esc_url_raw($url)."\" class=\"".$element_classes."\" data-ps2id-offset=\'".sanitize_text_field($offset)."\'>".do_shortcode($content)."</a>";
|
371 |
-
}
|
372 |
-
');
|
373 |
-
add_shortcode($tag, $pl_shortcodes[$i]);
|
374 |
-
$pl_shortcodes_b[$i]=create_function('$atts,$content=null','
|
375 |
-
extract(shortcode_atts(array(
|
376 |
-
"i" => "'.$i.'",
|
377 |
-
"id" => "",
|
378 |
-
"target" => "",
|
379 |
-
), $atts));
|
380 |
-
if($id!==""){
|
381 |
-
return "<div id=\"".$id."\" data-ps2id-target=\"".sanitize_text_field($target)."\">".do_shortcode($content)."</div>";
|
382 |
-
}
|
383 |
-
');
|
384 |
-
add_shortcode($tag_b, $pl_shortcodes_b[$i]);
|
385 |
}
|
386 |
}
|
387 |
|
@@ -426,7 +402,7 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
|
|
426 |
|
427 |
public function upgrade_plugin(){
|
428 |
// Get/set plugin version
|
429 |
-
$current_version=
|
430 |
if(!$current_version){
|
431 |
add_option($this->db_prefix.'version', $this->version);
|
432 |
$old_db_options=$this->get_plugin_old_db_options(); // Get old/deprecated plugin db options --edit--
|
@@ -437,7 +413,8 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
|
|
437 |
if($this->version!==$current_version){
|
438 |
// Update plugin options to new version ones
|
439 |
$pl_instances=get_option($this->db_prefix.'instances');
|
440 |
-
|
|
|
441 |
$j=$pl_instances[$this->pl_pfx.'instance_'.$i];
|
442 |
$instance=$this->plugin_options_array('upgrade',$i,$j,$old_db_options); // --edit--
|
443 |
$update[$this->pl_pfx.'instance_'.$i]=$instance;
|
@@ -457,8 +434,8 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
|
|
457 |
$old_db_opt6=get_option('malihu_pagescroll2id_pageEndSmoothScroll');
|
458 |
$old_db_opt7=get_option('malihu_pagescroll2id_layout');
|
459 |
return array(
|
460 |
-
($old_db_opt1) ? $old_db_opt1 : 'a[
|
461 |
-
($old_db_opt2) ? $old_db_opt2 :
|
462 |
($old_db_opt3) ? $old_db_opt3 : 'true',
|
463 |
($old_db_opt4) ? $old_db_opt4 : 'easeInOutQuint',
|
464 |
($old_db_opt5) ? $old_db_opt5 : 'easeOutQuint',
|
@@ -579,14 +556,15 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
|
|
579 |
public function plugin_options_array($action, $i, $j, $old){
|
580 |
// --edit--
|
581 |
// Defaults
|
582 |
-
$d0='a[
|
583 |
$d19='true';
|
584 |
-
$d1=
|
585 |
$d2='true';
|
586 |
$d3='easeInOutQuint';
|
587 |
$d4='easeOutQuint';
|
588 |
$d5='true';
|
589 |
$d24='false';
|
|
|
590 |
$d6='vertical';
|
591 |
$d7=0;
|
592 |
$d8='';
|
@@ -600,6 +578,8 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
|
|
600 |
$d13='true';
|
601 |
$d17='true';
|
602 |
$d18=0;
|
|
|
|
|
603 |
$d15=0;
|
604 |
$d20='true';
|
605 |
$d21='true';
|
@@ -616,6 +596,7 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
|
|
616 |
$v4=$_POST[$this->db_prefix.$i.'_scrollingEasing'];
|
617 |
$v5=(isset($_POST[$this->db_prefix.$i.'_pageEndSmoothScroll'])) ? 'true' : 'false';
|
618 |
$v24=(isset($_POST[$this->db_prefix.$i.'_stopScrollOnUserAction'])) ? 'true' : 'false';
|
|
|
619 |
$v6=$_POST[$this->db_prefix.$i.'_layout'];
|
620 |
$v7=$this->sanitize_input('text', $_POST[$this->db_prefix.$i.'_offset'], $d7);
|
621 |
$v8=(empty($_POST[$this->db_prefix.$i.'_highlightSelector'])) ? $d8 : $this->sanitize_input('text', $_POST[$this->db_prefix.$i.'_highlightSelector'], $d8);
|
@@ -629,6 +610,8 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
|
|
629 |
$v13=(isset($_POST[$this->db_prefix.$i.'_scrollToHash'])) ? 'true' : 'false';
|
630 |
$v17=(isset($_POST[$this->db_prefix.$i.'_scrollToHashForAll'])) ? 'true' : 'false';
|
631 |
$v18=$this->sanitize_input('number', $_POST[$this->db_prefix.$i.'_scrollToHashDelay'], $d18);
|
|
|
|
|
632 |
$v15=$this->sanitize_input('text', $_POST[$this->db_prefix.$i.'_disablePluginBelow'], $d15);
|
633 |
$v20=(isset($_POST[$this->db_prefix.$i.'_adminDisplayWidgetsId'])) ? 'true' : 'false';
|
634 |
$v21=(isset($_POST[$this->db_prefix.$i.'_adminTinyMCEbuttons'])) ? 'true' : 'false';
|
@@ -672,6 +655,9 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
|
|
672 |
$v23=(isset($j['unbindUnrelatedClickEvents'])) ? $j['unbindUnrelatedClickEvents']['value'] : $d23;
|
673 |
$v24=(isset($j['stopScrollOnUserAction'])) ? $j['stopScrollOnUserAction']['value'] : $d24;
|
674 |
$v25=(isset($j['normalizeAnchorPointTargets'])) ? $j['normalizeAnchorPointTargets']['value'] : $d25;
|
|
|
|
|
|
|
675 |
break;
|
676 |
default:
|
677 |
$v0=$d0;
|
@@ -682,6 +668,7 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
|
|
682 |
$v4=$d4;
|
683 |
$v5=$d5;
|
684 |
$v24=$d24;
|
|
|
685 |
$v6=$d6;
|
686 |
$v7=$d7;
|
687 |
$v8=$d8;
|
@@ -695,6 +682,8 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
|
|
695 |
$v13=$d13;
|
696 |
$v17=$d17;
|
697 |
$v18=$d18;
|
|
|
|
|
698 |
$v15=$d15;
|
699 |
$v20=$d20;
|
700 |
$v21=$d21;
|
@@ -725,7 +714,7 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
|
|
725 |
'checkbox_label' => null,
|
726 |
'radio_labels' => null,
|
727 |
'field_info' => null,
|
728 |
-
'description' => 'Set the links (in the form of <a href="http://www.w3.org/TR/css3-selectors/" target="_blank">CSS selectors</a>) that will scroll the page when clicked (default value: any link with <code
|
729 |
'wrapper' => null
|
730 |
),
|
731 |
'autoSelectorMenuLinks' => array(
|
@@ -812,6 +801,18 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
|
|
812 |
'description' => 'Enable if you want to stop page scrolling when the user tries to scroll the page manually (e.g. via mouse-wheel or touch-swipe)',
|
813 |
'wrapper' => 'fieldset'
|
814 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
815 |
'layout' => array(
|
816 |
'value' => $v6,
|
817 |
'values' => 'vertical,horizontal,auto',
|
@@ -968,6 +969,30 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
|
|
968 |
'description' => null,
|
969 |
'wrapper' => null
|
970 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
971 |
'disablePluginBelow' => array(
|
972 |
'value' => $v15,
|
973 |
'values' => null,
|
@@ -1045,5 +1070,8 @@ if(class_exists('malihuPageScroll2id')){ // --edit--
|
|
1045 |
// Widget class --edit--
|
1046 |
require_once(plugin_dir_path( __FILE__ ).'includes/class-malihu-pagescroll2id-widget.php');
|
1047 |
|
|
|
|
|
|
|
1048 |
}
|
1049 |
?>
|
2 |
/*
|
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 (smooth) page scrolling to specific id within the document.
|
6 |
+
Version: 1.6.3
|
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.3'; // Plugin version --edit--
|
51 |
protected $update_option=null;
|
52 |
|
53 |
protected $plugin_name='Page scroll to id'; // Plugin name --edit--
|
205 |
$pl_instances=get_option($this->db_prefix.'instances', $this->default);
|
206 |
// Loop the array to generate instances, fields etc.
|
207 |
// Add settings section for each plugin instance
|
208 |
+
//while(list($var, $val)=each($pl_instances)){
|
209 |
+
foreach($pl_instances as $var => $val){
|
210 |
add_settings_section(
|
211 |
$this->db_prefix.'settings_section'.$this->index,
|
212 |
null,
|
214 |
$this->plugin_slug
|
215 |
);
|
216 |
// Add settings fields for each section
|
217 |
+
//while(list($var2, $val2)=each($val)){
|
218 |
+
foreach($val as $var2 => $val2){
|
219 |
+
//while(list($var3, $val3)=each($val2)){
|
220 |
+
foreach($val2 as $var3 => $val3){
|
221 |
switch($var3){
|
222 |
case 'value':
|
223 |
$i_val=$val3;
|
317 |
}
|
318 |
|
319 |
public function add_plugin_action_links($links){
|
320 |
+
//$settings_link='<a href="options-general.php?page='.$this->plugin_slug.'">Settings</a>';
|
321 |
+
//array_unshift($links, $settings_link);
|
322 |
+
//$links[]='<a href="options-general.php?page='.$this->plugin_slug.'">Settings</a>';
|
323 |
+
$links[]='<a href="'. esc_url( get_admin_url(null, 'options-general.php?page='.$this->plugin_slug) ) .'">Settings</a>';
|
324 |
+
$links[]='<a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/" target="_blank">Documentation</a>';
|
325 |
return $links;
|
326 |
}
|
327 |
|
355 |
$tag=$shortcode_class=$this->sc_pfx; // Shortcode without suffix
|
356 |
$tag_b=$this->sc_pfx.'_wrap'; // Shortcode without suffix
|
357 |
//$tag=$shortcode_class=$this->sc_pfx.'_'.$i; // Shortcode with suffix
|
358 |
+
include_once(
|
359 |
+
plugin_dir_path( __FILE__ ).(version_compare(PHP_VERSION, '5.3', '<') ? 'includes/malihu-pagescroll2id-shortcodes-php52.php' : 'includes/malihu-pagescroll2id-shortcodes.php')
|
360 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
361 |
}
|
362 |
}
|
363 |
|
402 |
|
403 |
public function upgrade_plugin(){
|
404 |
// Get/set plugin version
|
405 |
+
$current_version=get_site_option($this->db_prefix.'version');
|
406 |
if(!$current_version){
|
407 |
add_option($this->db_prefix.'version', $this->version);
|
408 |
$old_db_options=$this->get_plugin_old_db_options(); // Get old/deprecated plugin db options --edit--
|
413 |
if($this->version!==$current_version){
|
414 |
// Update plugin options to new version ones
|
415 |
$pl_instances=get_option($this->db_prefix.'instances');
|
416 |
+
$pl_instances_count=(is_array($pl_instances) || $pl_instances instanceof Countable) ? count($pl_instances) : 1;
|
417 |
+
for($i=0; $i<$pl_instances_count; $i++){
|
418 |
$j=$pl_instances[$this->pl_pfx.'instance_'.$i];
|
419 |
$instance=$this->plugin_options_array('upgrade',$i,$j,$old_db_options); // --edit--
|
420 |
$update[$this->pl_pfx.'instance_'.$i]=$instance;
|
434 |
$old_db_opt6=get_option('malihu_pagescroll2id_pageEndSmoothScroll');
|
435 |
$old_db_opt7=get_option('malihu_pagescroll2id_layout');
|
436 |
return array(
|
437 |
+
($old_db_opt1) ? $old_db_opt1 : 'a[href*=#]:not([href=#])',
|
438 |
+
($old_db_opt2) ? $old_db_opt2 : 800,
|
439 |
($old_db_opt3) ? $old_db_opt3 : 'true',
|
440 |
($old_db_opt4) ? $old_db_opt4 : 'easeInOutQuint',
|
441 |
($old_db_opt5) ? $old_db_opt5 : 'easeOutQuint',
|
556 |
public function plugin_options_array($action, $i, $j, $old){
|
557 |
// --edit--
|
558 |
// Defaults
|
559 |
+
$d0='a[href*=#]:not([href=#])';
|
560 |
$d19='true';
|
561 |
+
$d1=800;
|
562 |
$d2='true';
|
563 |
$d3='easeInOutQuint';
|
564 |
$d4='easeOutQuint';
|
565 |
$d5='true';
|
566 |
$d24='false';
|
567 |
+
$d26='false';
|
568 |
$d6='vertical';
|
569 |
$d7=0;
|
570 |
$d8='';
|
578 |
$d13='true';
|
579 |
$d17='true';
|
580 |
$d18=0;
|
581 |
+
$d27='true';
|
582 |
+
$d28='false';
|
583 |
$d15=0;
|
584 |
$d20='true';
|
585 |
$d21='true';
|
596 |
$v4=$_POST[$this->db_prefix.$i.'_scrollingEasing'];
|
597 |
$v5=(isset($_POST[$this->db_prefix.$i.'_pageEndSmoothScroll'])) ? 'true' : 'false';
|
598 |
$v24=(isset($_POST[$this->db_prefix.$i.'_stopScrollOnUserAction'])) ? 'true' : 'false';
|
599 |
+
$v26=(isset($_POST[$this->db_prefix.$i.'_autoCorrectScroll'])) ? 'true' : 'false';
|
600 |
$v6=$_POST[$this->db_prefix.$i.'_layout'];
|
601 |
$v7=$this->sanitize_input('text', $_POST[$this->db_prefix.$i.'_offset'], $d7);
|
602 |
$v8=(empty($_POST[$this->db_prefix.$i.'_highlightSelector'])) ? $d8 : $this->sanitize_input('text', $_POST[$this->db_prefix.$i.'_highlightSelector'], $d8);
|
610 |
$v13=(isset($_POST[$this->db_prefix.$i.'_scrollToHash'])) ? 'true' : 'false';
|
611 |
$v17=(isset($_POST[$this->db_prefix.$i.'_scrollToHashForAll'])) ? 'true' : 'false';
|
612 |
$v18=$this->sanitize_input('number', $_POST[$this->db_prefix.$i.'_scrollToHashDelay'], $d18);
|
613 |
+
$v27=(isset($_POST[$this->db_prefix.$i.'_scrollToHashUseElementData'])) ? 'true' : 'false';
|
614 |
+
$v28=(isset($_POST[$this->db_prefix.$i.'_scrollToHashRemoveUrlHash'])) ? 'true' : 'false';
|
615 |
$v15=$this->sanitize_input('text', $_POST[$this->db_prefix.$i.'_disablePluginBelow'], $d15);
|
616 |
$v20=(isset($_POST[$this->db_prefix.$i.'_adminDisplayWidgetsId'])) ? 'true' : 'false';
|
617 |
$v21=(isset($_POST[$this->db_prefix.$i.'_adminTinyMCEbuttons'])) ? 'true' : 'false';
|
655 |
$v23=(isset($j['unbindUnrelatedClickEvents'])) ? $j['unbindUnrelatedClickEvents']['value'] : $d23;
|
656 |
$v24=(isset($j['stopScrollOnUserAction'])) ? $j['stopScrollOnUserAction']['value'] : $d24;
|
657 |
$v25=(isset($j['normalizeAnchorPointTargets'])) ? $j['normalizeAnchorPointTargets']['value'] : $d25;
|
658 |
+
$v26=(isset($j['autoCorrectScroll'])) ? $j['autoCorrectScroll']['value'] : $d26;
|
659 |
+
$v27=(isset($j['scrollToHashUseElementData'])) ? $j['scrollToHashUseElementData']['value'] : $d27;
|
660 |
+
$v28=(isset($j['scrollToHashRemoveUrlHash'])) ? $j['scrollToHashRemoveUrlHash']['value'] : $d28;
|
661 |
break;
|
662 |
default:
|
663 |
$v0=$d0;
|
668 |
$v4=$d4;
|
669 |
$v5=$d5;
|
670 |
$v24=$d24;
|
671 |
+
$v26=$d26;
|
672 |
$v6=$d6;
|
673 |
$v7=$d7;
|
674 |
$v8=$d8;
|
682 |
$v13=$d13;
|
683 |
$v17=$d17;
|
684 |
$v18=$d18;
|
685 |
+
$v27=$d27;
|
686 |
+
$v28=$d28;
|
687 |
$v15=$d15;
|
688 |
$v20=$d20;
|
689 |
$v21=$d21;
|
714 |
'checkbox_label' => null,
|
715 |
'radio_labels' => null,
|
716 |
'field_info' => null,
|
717 |
+
'description' => 'Set the links (in the form of <a href="http://www.w3.org/TR/css3-selectors/" target="_blank">CSS selectors</a>) that will scroll the page when clicked (default value: any link with a non-empty hash (<code>#</code>) value in its URL) <br /><small>In addition to selectors above, the plugin is enabled automatically on links (or links contained within elements) with class <code>ps2id</code></small>',
|
718 |
'wrapper' => null
|
719 |
),
|
720 |
'autoSelectorMenuLinks' => array(
|
801 |
'description' => 'Enable if you want to stop page scrolling when the user tries to scroll the page manually (e.g. via mouse-wheel or touch-swipe)',
|
802 |
'wrapper' => 'fieldset'
|
803 |
),
|
804 |
+
'autoCorrectScroll' => array(
|
805 |
+
'value' => $v26,
|
806 |
+
'values' => null,
|
807 |
+
'id' => $this->db_prefix.$i.'_autoCorrectScroll',
|
808 |
+
'field_type' => 'checkbox',
|
809 |
+
'label' => '',
|
810 |
+
'checkbox_label' => 'Verify target position and readjust scrolling (if necessary), after scrolling animation is complete',
|
811 |
+
'radio_labels' => null,
|
812 |
+
'field_info' => null,
|
813 |
+
'description' => null,
|
814 |
+
'wrapper' => 'fieldset'
|
815 |
+
),
|
816 |
'layout' => array(
|
817 |
'value' => $v6,
|
818 |
'values' => 'vertical,horizontal,auto',
|
969 |
'description' => null,
|
970 |
'wrapper' => null
|
971 |
),
|
972 |
+
'scrollToHashUseElementData' => array(
|
973 |
+
'value' => $v27,
|
974 |
+
'values' => null,
|
975 |
+
'id' => $this->db_prefix.$i.'_scrollToHashUseElementData',
|
976 |
+
'field_type' => 'checkbox',
|
977 |
+
'label' => '',
|
978 |
+
'checkbox_label' => 'Use element's custom offset (if it exists) when scrolling from/to different pages.',
|
979 |
+
'radio_labels' => null,
|
980 |
+
'field_info' => null,
|
981 |
+
'description' => null,
|
982 |
+
'wrapper' => 'fieldset'
|
983 |
+
),
|
984 |
+
'scrollToHashRemoveUrlHash' => array(
|
985 |
+
'value' => $v28,
|
986 |
+
'values' => null,
|
987 |
+
'id' => $this->db_prefix.$i.'_scrollToHashRemoveUrlHash',
|
988 |
+
'field_type' => 'checkbox',
|
989 |
+
'label' => '',
|
990 |
+
'checkbox_label' => 'Remove URL hash (i.e. the <code>#some-id</code> part in browser's address bar) when scrolling from/to different pages.',
|
991 |
+
'radio_labels' => null,
|
992 |
+
'field_info' => null,
|
993 |
+
'description' => null,
|
994 |
+
'wrapper' => 'fieldset'
|
995 |
+
),
|
996 |
'disablePluginBelow' => array(
|
997 |
'value' => $v15,
|
998 |
'values' => null,
|
1070 |
// Widget class --edit--
|
1071 |
require_once(plugin_dir_path( __FILE__ ).'includes/class-malihu-pagescroll2id-widget.php');
|
1072 |
|
1073 |
+
// MO notice class --edit--
|
1074 |
+
require_once(plugin_dir_path( __FILE__ ).'includes/mo-admin-notice.php');
|
1075 |
+
|
1076 |
}
|
1077 |
?>
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
|
|
4 |
Tags: page scrolling, page animation, smooth scroll, navigation, single-page navigation
|
5 |
Requires at least: 3.3
|
6 |
Tested up to: 4.9
|
7 |
-
Stable tag: 1.6.
|
8 |
License: The MIT License (MIT)
|
9 |
License URI: http://opensource.org/licenses/MIT
|
10 |
|
@@ -36,6 +36,10 @@ Create links that scroll the page smoothly to any id within the document.
|
|
36 |
|
37 |
Page scroll to id requires WordPress version **3.3** or higher (jQuery version **1.7.0** or higher) and your theme **must** (and should) have `wp_head()` and `wp_footer()` functions. In some Microsoft Windows based web servers some plugins 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.
|
38 |
|
|
|
|
|
|
|
|
|
39 |
= Quick usage and tips =
|
40 |
|
41 |
1. [Install the plugin](http://wordpress.org/plugins/page-scroll-to-id/installation/).
|
@@ -67,6 +71,14 @@ Configure plugin options by clicking 'Settings' under plugin name or through the
|
|
67 |
|
68 |
Please visit plugin's [Knowledge Base - FAQ](http://manos.malihu.gr/page-scroll-to-id-for-wordpress/2/) for up-to-date info and guides.
|
69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
== Screenshots ==
|
71 |
|
72 |
1. "Page scoll to id" settings
|
@@ -83,6 +95,19 @@ Please visit plugin's [Knowledge Base - FAQ](http://manos.malihu.gr/page-scroll-
|
|
83 |
|
84 |
== Changelog ==
|
85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
= 1.6.2 =
|
87 |
* Changed default options for scroll duration and easing type. Plugin is now enabled by default on WordPress menu items/links. These changes affect only first-time installations (upgrading won't change these options).
|
88 |
* Extended plugin's settings page and renamed few options to less technical terms.
|
@@ -191,6 +216,10 @@ Please visit plugin's [Knowledge Base - FAQ](http://manos.malihu.gr/page-scroll-
|
|
191 |
|
192 |
== Upgrade Notice ==
|
193 |
|
|
|
|
|
|
|
|
|
194 |
= 1.6.2 =
|
195 |
|
196 |
Extended plugin's settings and visual editor buttons, added various new features and options, fixed some minor bugs, added support for latest jQuery. Please see changelog for a complete list of changes and new features.
|
4 |
Tags: page scrolling, page animation, smooth scroll, navigation, single-page navigation
|
5 |
Requires at least: 3.3
|
6 |
Tested up to: 4.9
|
7 |
+
Stable tag: 1.6.3
|
8 |
License: The MIT License (MIT)
|
9 |
License URI: http://opensource.org/licenses/MIT
|
10 |
|
36 |
|
37 |
Page scroll to id requires WordPress version **3.3** or higher (jQuery version **1.7.0** or higher) and your theme **must** (and should) have `wp_head()` and `wp_footer()` functions. In some Microsoft Windows based web servers some plugins 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.
|
38 |
|
39 |
+
= GDPR (General Data Protection Regulation) =
|
40 |
+
|
41 |
+
The plugin is GDPR compliant. It does not use or store any kind of user information/data. In fact, it's functionality has nothing to do with user data (personal or otherwise). So there's that.
|
42 |
+
|
43 |
= Quick usage and tips =
|
44 |
|
45 |
1. [Install the plugin](http://wordpress.org/plugins/page-scroll-to-id/installation/).
|
71 |
|
72 |
Please visit plugin's [Knowledge Base - FAQ](http://manos.malihu.gr/page-scroll-to-id-for-wordpress/2/) for up-to-date info and guides.
|
73 |
|
74 |
+
= Is it GDPR compliant? =
|
75 |
+
|
76 |
+
Yes.
|
77 |
+
|
78 |
+
= Why it hasn't been updated for x weeks/months? =
|
79 |
+
|
80 |
+
Because it works and it already has a ton of features. The plugin has little dependency on WordPress functions so it doesn't need to be updated every time WordPress updates (that's why it works on ancient WordPress versions like 3.3).
|
81 |
+
|
82 |
== Screenshots ==
|
83 |
|
84 |
1. "Page scoll to id" settings
|
95 |
|
96 |
== Changelog ==
|
97 |
|
98 |
+
= 1.6.3 =
|
99 |
+
|
100 |
+
* Fixed a bug which was breaking page scrolling in some WordPress themes/installations in version 1.6.2.
|
101 |
+
* Fixed a bug regarding links with URL in non-latin characters (e.g. Greek, Cyrillic etc.).
|
102 |
+
* Better plugin version control for multisite installations.
|
103 |
+
* Fixed PHP 7 notices and warnings.
|
104 |
+
* Plugin is now enabled by default on all links with a non-empty hash value (e.g. #some-id) in their URL.
|
105 |
+
* Changed default scroll duration from 1000 to 800 milliseconds.
|
106 |
+
* Added support for anchors inside SVG elements.
|
107 |
+
* Added new option 'Verify target position and readjust scrolling if necessary'.
|
108 |
+
* Added new option 'Use element custom offset when scrolling from/to different pages'.
|
109 |
+
* Added new option 'Remove URL hash when scrolling from/to different pages'.
|
110 |
+
|
111 |
= 1.6.2 =
|
112 |
* Changed default options for scroll duration and easing type. Plugin is now enabled by default on WordPress menu items/links. These changes affect only first-time installations (upgrading won't change these options).
|
113 |
* Extended plugin's settings page and renamed few options to less technical terms.
|
216 |
|
217 |
== Upgrade Notice ==
|
218 |
|
219 |
+
= 1.6.3 =
|
220 |
+
|
221 |
+
Fixed a bug which was breaking page scrolling in some WordPress themes/installations in version 1.6.2, fixed a bug regarding links with URL in non-latin characters (e.g. Greek, Cyrillic etc.), better plugin version control for multisite installations, fixed PHP 7 notices/warnings.
|
222 |
+
|
223 |
= 1.6.2 =
|
224 |
|
225 |
Extended plugin's settings and visual editor buttons, added various new features and options, fixed some minor bugs, added support for latest jQuery. Please see changelog for a complete list of changes and new features.
|