Version Description
- Added new option to exclude specific selectors from being handled by the plugin.
- Added new option 'Auto-generate #ps2id-dummy-offset element'.
- Added 'Page scroll to id target' block for Gutenberg block editor.
- Added new feature for Gutenberg block editor:
- Fixed highlight not working in URLs with an apostrophe.
- Fixed this issue regarding plugin's default selector when using non-WordPress jQuery library.
- Fixed this minor issue.
- Fixed multisite issue where few plugin options would not save/update properly.
- Fixed issue #10
- Updated plugin's contextual help and documentation.
Download this release
Release Info
Developer | malihu |
Plugin | Page scroll to id |
Version | 1.6.5 |
Comparing to | |
See all releases |
Code changes from version 1.6.4 to 1.6.5
- css/admin.css +13 -0
- includes/blocks/blocks.css +53 -0
- includes/blocks/blocks.js +83 -0
- includes/help/plugin-settings.inc +9 -4
- js/admin.js +5 -0
- js/jquery.malihu.PageScroll2id-init.js +23 -2
- js/jquery.malihu.PageScroll2id.js +2 -2
- js/page-scroll-to-id.min.js +2 -2
- malihu-pagescroll2id.php +88 -7
- readme.txt +23 -2
- screenshot-1.png +0 -0
- screenshot-3.png +0 -0
- screenshot-7.png +0 -0
- uninstall.php +4 -2
css/admin.css
CHANGED
@@ -126,4 +126,17 @@
|
|
126 |
|
127 |
.oldwp-plugin-help-section.oldwp-plugin-help-section-active{
|
128 |
display: block;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
129 |
}
|
126 |
|
127 |
.oldwp-plugin-help-section.oldwp-plugin-help-section-active{
|
128 |
display: block;
|
129 |
+
}
|
130 |
+
|
131 |
+
.wp-core-ui .button.mPS2id-show-option-common-values{
|
132 |
+
margin: 4px 0 8px 0;
|
133 |
+
}
|
134 |
+
|
135 |
+
.mPS2id-show-option-common-values + span{
|
136 |
+
display: none;
|
137 |
+
position: relative;
|
138 |
+
}
|
139 |
+
|
140 |
+
.mPS2id-show-option-common-values + span.mPS2id-show{
|
141 |
+
display: block;
|
142 |
}
|
includes/blocks/blocks.css
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* ----------------------------------------------------------------------------
|
3 |
+
* Page scroll to id block editor CSS (backend)
|
4 |
+
* ----------------------------------------------------------------------------
|
5 |
+
*/
|
6 |
+
|
7 |
+
/*
|
8 |
+
The class name is generated using the block’s name prefixed with wp-block-, replacing the / namespace separator with a single -
|
9 |
+
*/
|
10 |
+
|
11 |
+
/*
|
12 |
+
plugin colors:
|
13 |
+
rgb(141, 150, 160)
|
14 |
+
rgb(33,36,40)
|
15 |
+
rgb(213, 78, 33)
|
16 |
+
*/
|
17 |
+
|
18 |
+
.wp-block-ps2id-block-target{
|
19 |
+
padding-left: 42px;
|
20 |
+
}
|
21 |
+
|
22 |
+
.editor-block-list__block .wp-block-ps2id-block-target input[type=text]{
|
23 |
+
border-color: transparent;
|
24 |
+
transition: all .2s ease;
|
25 |
+
}
|
26 |
+
|
27 |
+
.editor-block-list__block .wp-block-ps2id-block-target input[type=text][value='']{
|
28 |
+
border-color: rgb(213, 78, 33);
|
29 |
+
}
|
30 |
+
|
31 |
+
.editor-block-list__block .wp-block-ps2id-block-target:hover input[type=text],
|
32 |
+
.editor-block-list__block .wp-block-ps2id-block-target input[type=text]:focus{
|
33 |
+
border-color: rgba(141,150,160,1);
|
34 |
+
}
|
35 |
+
|
36 |
+
.wp-block-ps2id-block-target::before{
|
37 |
+
content: "";
|
38 |
+
display: block;
|
39 |
+
position: absolute;
|
40 |
+
top: 0;
|
41 |
+
bottom: 0;
|
42 |
+
left: 0;
|
43 |
+
right: auto;
|
44 |
+
margin: auto;
|
45 |
+
width: 32px;
|
46 |
+
height: 32px;
|
47 |
+
overflow: hidden;
|
48 |
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 15.641 15.931'%3E%3Cdefs%3E%3CclipPath id='a'%3E%3Cpath fill='%230ff' stroke='%23000' stroke-linecap='square' stroke-opacity='0' stroke-width='.265' d='M102.698 118.597v7.952H91.673v11.092h24.856v-11.092h-3.006v-7.952z' paint-order='markers stroke fill'/%3E%3C/clipPath%3E%3C/defs%3E%3Cg transform='translate(-87.653 -116.495)'%3E%3Cellipse cx='102.646' cy='127.029' fill='none' stroke='%23d54e21' stroke-width='1.494' clip-path='url(%23a)' rx='5.749' ry='5.82' transform='translate(-6.348 -1.67)'/%3E%3Ccircle cx='96.351' cy='125.352' r='2.539' fill='%23555d66'/%3E%3Cpath fill='none' stroke='%23d54e21' stroke-width='1.265' d='M88.934 117.796l3.34 3.274z'/%3E%3Cpath fill='%23d54e21' d='M88.466 122.246l5.145.067-.267-5.011z'/%3E%3C/g%3E%3C/svg%3E%0A");
|
49 |
+
background-repeat: no-repeat;
|
50 |
+
background-position: center;
|
51 |
+
background-size: contain;
|
52 |
+
transition: all .2s ease;
|
53 |
+
}
|
includes/blocks/blocks.js
ADDED
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* ----------------------------------------------------------------------------
|
3 |
+
* Page scroll to id block editor JS (backend)
|
4 |
+
* ----------------------------------------------------------------------------
|
5 |
+
*/
|
6 |
+
|
7 |
+
(function(blocks, editor, components, i18n, element){
|
8 |
+
|
9 |
+
var el = element.createElement,
|
10 |
+
registerBlockType = blocks.registerBlockType,
|
11 |
+
//RichText = editor.RichText,
|
12 |
+
TextControl = components.TextControl,
|
13 |
+
//BlockControls = editor.BlockControls,
|
14 |
+
iconEl = el('img', { width: 24, height: 24,
|
15 |
+
src: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 15.641 15.931'%3E%3Cdefs%3E%3CclipPath id='a'%3E%3Cpath fill='%230ff' stroke='%23000' stroke-linecap='square' stroke-opacity='0' stroke-width='.265' d='M102.698 118.597v7.952H91.673v11.092h24.856v-11.092h-3.006v-7.952z' paint-order='markers stroke fill'/%3E%3C/clipPath%3E%3C/defs%3E%3Cg transform='translate(-87.653 -116.495)'%3E%3Cellipse cx='102.646' cy='127.029' fill='none' stroke='%23d54e21' stroke-width='1.494' clip-path='url(%23a)' rx='5.749' ry='5.82' transform='translate(-6.348 -1.67)'/%3E%3Ccircle cx='96.351' cy='125.352' r='2.539' fill='%23555d66'/%3E%3Cpath fill='none' stroke='%23d54e21' stroke-width='1.265' d='M88.934 117.796l3.34 3.274z'/%3E%3Cpath fill='%23d54e21' d='M88.466 122.246l5.145.067-.267-5.011z'/%3E%3C/g%3E%3C/svg%3E%0A"
|
16 |
+
});
|
17 |
+
|
18 |
+
registerBlockType( 'ps2id-block/target', {
|
19 |
+
title: 'Page scroll to id target',
|
20 |
+
|
21 |
+
icon: iconEl,
|
22 |
+
|
23 |
+
keywords: [ i18n.__('HTML Anchor'), i18n.__('Target section') ],
|
24 |
+
|
25 |
+
category: 'layout',
|
26 |
+
|
27 |
+
attributes: {
|
28 |
+
content: {
|
29 |
+
type: 'string',
|
30 |
+
source: 'attribute',
|
31 |
+
selector: 'div',
|
32 |
+
attribute: 'id'
|
33 |
+
}
|
34 |
+
},
|
35 |
+
|
36 |
+
edit: function( props ) {
|
37 |
+
var content = props.attributes.content;
|
38 |
+
|
39 |
+
function onChangeContent( newContent ) {
|
40 |
+
props.setAttributes( { content: newContent, id: newContent } );
|
41 |
+
}
|
42 |
+
|
43 |
+
return el(
|
44 |
+
TextControl,
|
45 |
+
{
|
46 |
+
tagName: 'div',
|
47 |
+
className: props.className,
|
48 |
+
formattingControls: [],
|
49 |
+
onChange: onChangeContent,
|
50 |
+
//id: content,
|
51 |
+
placeholder: i18n.__('Enter a target id (e.g. my-id)'),
|
52 |
+
//help: 'Enter a target id (e.g. my-id)',
|
53 |
+
//label: 'ID',
|
54 |
+
//title: 'No spaces (spaces will be replaced by dashes)',
|
55 |
+
value: content
|
56 |
+
}
|
57 |
+
);
|
58 |
+
},
|
59 |
+
|
60 |
+
save: function( props ) {
|
61 |
+
var content = props.attributes.content,
|
62 |
+
idVal = '';
|
63 |
+
|
64 |
+
if(content){
|
65 |
+
idVal = content.trim();
|
66 |
+
idVal = idVal.replace(/\s/g, ''); //remove spaces (HTML5)
|
67 |
+
//idVal = idVal.replace(/^[^a-zA-Z]+|[^\w:.-]+/g, ''); //sanitize id value (HTML4)
|
68 |
+
}
|
69 |
+
|
70 |
+
return el( 'div', {
|
71 |
+
className: props.className,
|
72 |
+
id: idVal
|
73 |
+
}, '' );
|
74 |
+
}
|
75 |
+
} );
|
76 |
+
|
77 |
+
})(
|
78 |
+
wp.blocks,
|
79 |
+
wp.editor,
|
80 |
+
wp.components,
|
81 |
+
wp.i18n,
|
82 |
+
wp.element
|
83 |
+
);
|
includes/help/plugin-settings.inc
CHANGED
@@ -6,7 +6,8 @@ $help_plugin_settings_text=<<<EOD
|
|
6 |
<p>
|
7 |
<a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#plugin-settings-selectors" target="_blank"><strong>Selector(s)</strong></a> -
|
8 |
Use this field when you need to instruct the plugin to handle specific links. The value(s) should be anchor tags (<code>a</code>, i.e. links) in the form of <a href="http://www.w3.org/TR/css3-selectors/" target="_blank">strings that represent ways of choosing elements in the DOM</a> (i.e. CSS selectors). Each selector is separated by comma, so multiple selectors can be defined as: <code>selector1, selector2, selector3</code> etc. <br />
|
9 |
-
<a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#plugin-settings-enable-on-wp-menu-links" target="_blank">Enable on WordPress Menu links</a> enables the plugin automatically on custom links created in WordPress Menus (Appearance → Menus).
|
|
|
10 |
</p>
|
11 |
|
12 |
<p>
|
@@ -23,7 +24,8 @@ $help_plugin_settings_text=<<<EOD
|
|
23 |
<p>
|
24 |
<a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#plugin-settings-scroll-behavior" target="_blank"><strong>Scroll behavior</strong></a> -
|
25 |
<a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#plugin-settings-always-scroll-smoothly" target="_blank">Always scroll smoothly when reaching the end of the page/document</a> option adjusts scroll-to position so it does not exceed document length. <br />
|
26 |
-
Enable <a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#plugin-settings-stop-scroll-on-event" target="_blank">Stop page scrolling on mouse-wheel or touch-swipe</a> if you want to stop page scrolling when the user tries to scroll the page manually (e.g. via mouse-wheel or touch-swipe).
|
|
|
27 |
</p>
|
28 |
|
29 |
<p>
|
@@ -33,7 +35,8 @@ $help_plugin_settings_text=<<<EOD
|
|
33 |
|
34 |
<p>
|
35 |
<a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#plugin-settings-offset" target="_blank"><strong>Offset</strong></a> -
|
36 |
-
Offset scroll-to position by x amount of pixels or by selector. The offset value can a be a positive or negative number (indicating pixels), or a matching set of elements in your html (selector).
|
|
|
37 |
</p>
|
38 |
|
39 |
<p>
|
@@ -52,7 +55,9 @@ $help_plugin_settings_text=<<<EOD
|
|
52 |
<p>
|
53 |
<a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#plugin-settings-links-behavior" target="_blank"><strong>Links behavior</strong></a> -
|
54 |
If you want the link’s URL hash value (e.g. <code>#some-id</code>) to appear in browser's address bar when it's clicked, enable <a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#plugin-settings-append-hash" target="_blank">Append the clicked link's hash value to browser's URL/address bar</a> option. <br />
|
55 |
-
<a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#plugin-settings-scroll-to-different-pages" target="_blank">Scroll from/to different pages</a> option enables the plugin to smoothly scroll a newly loaded page to a target (i.e. the hash value in browser's address bar).
|
|
|
|
|
56 |
</p>
|
57 |
|
58 |
<p>
|
6 |
<p>
|
7 |
<a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#plugin-settings-selectors" target="_blank"><strong>Selector(s)</strong></a> -
|
8 |
Use this field when you need to instruct the plugin to handle specific links. The value(s) should be anchor tags (<code>a</code>, i.e. links) in the form of <a href="http://www.w3.org/TR/css3-selectors/" target="_blank">strings that represent ways of choosing elements in the DOM</a> (i.e. CSS selectors). Each selector is separated by comma, so multiple selectors can be defined as: <code>selector1, selector2, selector3</code> etc. <br />
|
9 |
+
<a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#plugin-settings-enable-on-wp-menu-links" target="_blank">Enable on WordPress Menu links</a> enables the plugin automatically on custom links created in WordPress Menus (Appearance → Menus). <br />
|
10 |
+
To exclude specific links from being handled by the plugin (e.g. special tabs, accordions, toggles etc.), use the <a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#plugin-settings-excluded-selectors" target="_blank">selectors are excluded</a> field by adding the element selector(s) you want (separated by comma).
|
11 |
</p>
|
12 |
|
13 |
<p>
|
24 |
<p>
|
25 |
<a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#plugin-settings-scroll-behavior" target="_blank"><strong>Scroll behavior</strong></a> -
|
26 |
<a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#plugin-settings-always-scroll-smoothly" target="_blank">Always scroll smoothly when reaching the end of the page/document</a> option adjusts scroll-to position so it does not exceed document length. <br />
|
27 |
+
Enable <a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#plugin-settings-stop-scroll-on-event" target="_blank">Stop page scrolling on mouse-wheel or touch-swipe</a> if you want to stop page scrolling when the user tries to scroll the page manually (e.g. via mouse-wheel or touch-swipe). <br />
|
28 |
+
Enabling <a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#plugin-settings-autocorrect-scroll" target="_blank">Verify target position and readjust scrolling (if necessary), after scrolling animation is complete</a> option, will auto-correct scrolling if the target’s position was changed while the page was scrolling.
|
29 |
</p>
|
30 |
|
31 |
<p>
|
35 |
|
36 |
<p>
|
37 |
<a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#plugin-settings-offset" target="_blank"><strong>Offset</strong></a> -
|
38 |
+
Offset scroll-to position by x amount of pixels or by selector. The offset value can a be a positive or negative number (indicating pixels), or a matching set of elements in your html (selector). <br />
|
39 |
+
Enable the <a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#plugin-settings-offset-dummy" target="_blank">Auto-generate <code>#ps2id-dummy-offset</code> element</a> option if you want the plugin to create a hidden element with id <code>ps2id-dummy-offset</code> and use it as the <strong>Offset</strong> option value and in your CSS by giving it a height equal to the amount of offset you want.
|
40 |
</p>
|
41 |
|
42 |
<p>
|
55 |
<p>
|
56 |
<a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#plugin-settings-links-behavior" target="_blank"><strong>Links behavior</strong></a> -
|
57 |
If you want the link’s URL hash value (e.g. <code>#some-id</code>) to appear in browser's address bar when it's clicked, enable <a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#plugin-settings-append-hash" target="_blank">Append the clicked link's hash value to browser's URL/address bar</a> option. <br />
|
58 |
+
<a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#plugin-settings-scroll-to-different-pages" target="_blank">Scroll from/to different pages</a> option enables the plugin to smoothly scroll a newly loaded page to a target (i.e. the hash value in browser's address bar). <br />
|
59 |
+
To use link-specific offsets (instead of the general offset) when scrolling from/to different pages, enable <a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#plugin-settings-scroll-to-hash-use-element-data" target="_blank">Use element’s custom offset (if it exists) when scrolling from/to different pages</a> option. <br />
|
60 |
+
If you want to remove the hash value from browser's address bar when scrolling from/to different pages, enable <a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#plugin-settings-scrolltohash-remove-url-hash" target="_blank">Remove URL hash when scrolling from/to different pages</a>.
|
61 |
</p>
|
62 |
|
63 |
<p>
|
js/admin.js
CHANGED
@@ -155,6 +155,11 @@
|
|
155 |
Plugin specific js --edit--
|
156 |
--------------------
|
157 |
*/
|
|
|
|
|
|
|
|
|
|
|
158 |
|
159 |
$(".mPS2id-open-help").click(function(e){
|
160 |
e.preventDefault();
|
155 |
Plugin specific js --edit--
|
156 |
--------------------
|
157 |
*/
|
158 |
+
|
159 |
+
$(".mPS2id-show-option-common-values").click(function(e){
|
160 |
+
e.preventDefault();
|
161 |
+
$(this).next("span").toggleClass("mPS2id-show");
|
162 |
+
});
|
163 |
|
164 |
$(".mPS2id-open-help").click(function(e){
|
165 |
e.preventDefault();
|
js/jquery.malihu.PageScroll2id-init.js
CHANGED
@@ -39,6 +39,9 @@
|
|
39 |
handler.selector='a[href*="#"]:not(._mPS2id-h)';
|
40 |
}else if(handler.selector==='a[href*=#]:not([href=#])'){
|
41 |
handler.selector='a[href*=#]:not([href=#]):not(._mPS2id-h)';
|
|
|
|
|
|
|
42 |
}else{
|
43 |
s.off("click",handler.handler);
|
44 |
}
|
@@ -48,9 +51,27 @@
|
|
48 |
autoSelectors="a[data-ps2id-api='true'][href*='#'],.ps2id > a[href*='#'],a.ps2id[href*='#']";
|
49 |
$(document).ready(function(){
|
50 |
for(var k=0; k<_o.total_instances; k++){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
//scroll to location hash on page load
|
52 |
if(_o.instances[_p+"_instance_"+k]["scrollToHash"]==="true" && _hash){
|
53 |
-
$(_o.instances[_p+"_instance_"+k]["selector"]+",."+shortcodeClass+","+autoSelectors).each(function(){
|
54 |
$(this).data(_p+"Element",true);
|
55 |
});
|
56 |
if(_validateLocHash(_hash,_o.instances[_p+"_instance_"+k]["scrollToHashForAll"]==="true")){
|
@@ -67,7 +88,7 @@
|
|
67 |
});
|
68 |
$(window).on("load",function(){
|
69 |
for(var i=0; i<_o.total_instances; i++){
|
70 |
-
var sel=$(_o.instances[_p+"_instance_"+i]["selector"]+",."+shortcodeClass+","+autoSelectors),
|
71 |
autoCorrectScrollOpt=_o.instances[_p+"_instance_"+i]["autoCorrectScroll"],autoCorrectScroll=0;
|
72 |
sel.mPageScroll2id({
|
73 |
scrollSpeed:_o.instances[_p+"_instance_"+i]["scrollSpeed"],
|
39 |
handler.selector='a[href*="#"]:not(._mPS2id-h)';
|
40 |
}else if(handler.selector==='a[href*=#]:not([href=#])'){
|
41 |
handler.selector='a[href*=#]:not([href=#]):not(._mPS2id-h)';
|
42 |
+
}else if(handler.selector && handler.selector.indexOf("mobmenu")!==-1){
|
43 |
+
//special cases
|
44 |
+
s.off("click");
|
45 |
}else{
|
46 |
s.off("click",handler.handler);
|
47 |
}
|
51 |
autoSelectors="a[data-ps2id-api='true'][href*='#'],.ps2id > a[href*='#'],a.ps2id[href*='#']";
|
52 |
$(document).ready(function(){
|
53 |
for(var k=0; k<_o.total_instances; k++){
|
54 |
+
//generate id from class name (e.g. class ps2id-id-myid gives element the id myid)
|
55 |
+
var c2iSel=$("[class*='ps2id-id-']");
|
56 |
+
if(c2iSel.length){
|
57 |
+
c2iSel.each(function(){
|
58 |
+
var c2i=$(this),
|
59 |
+
c2iClasses=c2i.attr("class").split(" "),
|
60 |
+
c2iVal;
|
61 |
+
if(!c2i.attr("id")){
|
62 |
+
for(var c2iClass in c2iClasses){
|
63 |
+
if(String(c2iClasses[c2iClass]).match(/^ps2id-id-\S+$/)){
|
64 |
+
c2iVal=c2iClasses[c2iClass].split("ps2id-id-")[1];
|
65 |
+
if(!$("#"+c2iVal).length) c2i.attr("id",c2iVal);
|
66 |
+
break;
|
67 |
+
}
|
68 |
+
}
|
69 |
+
}
|
70 |
+
});
|
71 |
+
}
|
72 |
//scroll to location hash on page load
|
73 |
if(_o.instances[_p+"_instance_"+k]["scrollToHash"]==="true" && _hash){
|
74 |
+
$(_o.instances[_p+"_instance_"+k]["selector"]+",."+shortcodeClass+","+autoSelectors).not(_o.instances[_p+"_instance_"+k]["excludeSelector"]).each(function(){
|
75 |
$(this).data(_p+"Element",true);
|
76 |
});
|
77 |
if(_validateLocHash(_hash,_o.instances[_p+"_instance_"+k]["scrollToHashForAll"]==="true")){
|
88 |
});
|
89 |
$(window).on("load",function(){
|
90 |
for(var i=0; i<_o.total_instances; i++){
|
91 |
+
var sel=$(_o.instances[_p+"_instance_"+i]["selector"]+",."+shortcodeClass+","+autoSelectors).not(_o.instances[_p+"_instance_"+i]["excludeSelector"]),
|
92 |
autoCorrectScrollOpt=_o.instances[_p+"_instance_"+i]["autoCorrectScroll"],autoCorrectScroll=0;
|
93 |
sel.mPageScroll2id({
|
94 |
scrollSpeed:_o.instances[_p+"_instance_"+i]["scrollSpeed"],
|
js/jquery.malihu.PageScroll2id.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
/*
|
2 |
== Page scroll to id ==
|
3 |
-
Version: 1.
|
4 |
Plugin URI: http://manos.malihu.gr/page-scroll-to-id/
|
5 |
Author: malihu
|
6 |
Author URI: http://manos.malihu.gr
|
@@ -388,7 +388,7 @@ THE SOFTWARE.
|
|
388 |
/* finds the element that should be highlighted */
|
389 |
|
390 |
_findHighlight:function(id){
|
391 |
-
var wLoc=window.location,loc=wLoc.toString().split("#")[0],locPath=wLoc.pathname;
|
392 |
return $("._"+pluginPfx+"-h[href='#"+id+"'],._"+pluginPfx+"-h[href='"+loc+"#"+id+"'],._"+pluginPfx+"-h[href='"+locPath+"#"+id+"'],._"+pluginPfx+"-h[href='#/"+id+"'],._"+pluginPfx+"-h[href='"+loc+"#/"+id+"'],._"+pluginPfx+"-h[href='"+locPath+"#/"+id+"']");
|
393 |
},
|
394 |
|
1 |
/*
|
2 |
== Page scroll to id ==
|
3 |
+
Version: 1.6.0
|
4 |
Plugin URI: http://manos.malihu.gr/page-scroll-to-id/
|
5 |
Author: malihu
|
6 |
Author URI: http://manos.malihu.gr
|
388 |
/* finds the element that should be highlighted */
|
389 |
|
390 |
_findHighlight:function(id){
|
391 |
+
var wLoc=window.location,loc=escape(wLoc.toString().split("#")[0]),locPath=escape(wLoc.pathname);
|
392 |
return $("._"+pluginPfx+"-h[href='#"+id+"'],._"+pluginPfx+"-h[href='"+loc+"#"+id+"'],._"+pluginPfx+"-h[href='"+locPath+"#"+id+"'],._"+pluginPfx+"-h[href='#/"+id+"'],._"+pluginPfx+"-h[href='"+loc+"#/"+id+"'],._"+pluginPfx+"-h[href='"+locPath+"#/"+id+"']");
|
393 |
},
|
394 |
|
js/page-scroll-to-id.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
/* Page scroll to id - version 1.6.
|
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,v=m,S=f<h?m*(h/f):m,C=[a.top<=u/p,a.bottom>=u/_,a.left<=h/v,a.right>=h/S];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=function(e,t){for(var n=e.click.length-1;0<=n;n--){var a=e.click[n];a&&"mPS2id"!=a.namespace&&('a[href*="#"]'===a.selector?a.selector='a[href*="#"]:not(._mPS2id-h)':"a[href*=#]:not([href=#])"===a.selector?a.selector="a[href*=#]:not([href=#]):not(._mPS2id-h)":t.off("click",a.handler))}},_="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+","+_).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 n=l(r.instances[o+"_instance_"+e].selector+",."+c+","+_),t=r.instances[o+"_instance_"+e].autoCorrectScroll,a=0;if(n.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&&a++},onComplete:function(){1==a&&(mPS2id.clicked.length&&mPS2id.clicked.trigger("click.mPS2id"),a=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=n.length?l._data(n[0],"events"):null,t=n.length?l._data(l(document)[0],"events"):null;e&&p(e,n),t&&p(t,n)},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);
|
1 |
+
/* Page scroll to id - version 1.6.5 */
|
2 |
+
!function(O,y,i,e){var n,I,a,s,l,o,r,c,u,h,t,f,g="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=O.extend(!0,{},d,e);if(O(i).data(x,e),I=O(i).data(x),!this.selector){var t="__"+x;this.each(function(){var e=O(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 O(n)&&0!==O(n).length||(n=".m_PageScroll2id,a[rel~='m_PageScroll2id'],.page-scroll-to-id,a[rel~='page-scroll-to-id'],._ps2id")),I.clickEvents&&O(i).undelegate("."+x).delegate(n,"click."+x,function(e){if(m._isDisabled.call(null))m._removeClasses.call(null);else{var t=O(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)))}}),O(y).unbind("."+x).bind("scroll."+x+" resize."+x,function(){if(m._isDisabled.call(null))m._removeClasses.call(null);else{var s=O("._"+x+"-t");s.each(function(e){var t=O(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=O.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(){O(y).unbind("."+x),O(i).undelegate("."+x).removeData(x),O("._"+x+"-t").removeData(x),m._removeClasses.call(null,!0)}},m={_isDisabled:function(){var e=y,t="inner",n=I.disablePluginBelow instanceof Array?[I.disablePluginBelow[0]||0,I.disablePluginBelow[1]||0]:[I.disablePluginBelow||0,0];return"innerWidth"in y||(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=y.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 O(l).each(function(){var e=O(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=O("#"+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==O(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=O("#"+t);if(n.length<1||"fixed"===n.css("position")){if("top"!==t)return;n=O("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]:O(e[0]),e[1]instanceof jQuery?e[1]:O(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=y.location,n=escape(t.toString().split("#")[0]),a=escape(t.pathname);return O("._"+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?(O("."+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<O("."+i).length)&&(t.removeClass(s),n.removeClass(i)))},_extendClasses:function(){var e=I.targetClass,t=I.highlightClass,n=O("."+e),a=O("."+t),s=e+"-first",i=e+"-last",l=t+"-first",o=t+"-last";O("._"+x+"-t").removeClass(s+" "+i),O("._"+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){O("."+I.clickedClass).removeClass(I.clickedClass),O("."+I.targetClass).removeClass(I.targetClass+" "+I.targetClass+"-first "+I.targetClass+"-last"),O("."+I.highlightClass).removeClass(I.highlightClass+" "+I.highlightClass+"-first "+I.highlightClass+"-last"),e&&(O("._"+x+"-t").removeClass("_"+x+"-t"),O("._"+x+"-h").removeClass("_"+x+"-h"))},_currentTarget:function(e){var t=I["target_"+e.data(x).i],n=e.data("ps2id-target"),a=n&&O(n)[0]?O(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=O(y).height(),h=O(y).width(),f=n?O(n).height():e.height(),g=n?O(n).width():e.width(),d=1+f/u,p=d,_=f<u?d*(u/f):d,m=1+g/h,S=m,v=g<h?m*(h/g):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(){f=m._scrollSpeed.call(null),r=I.pageEndSmoothScroll?m._pageEndSmoothScroll.call(null):r;var e=O("html,body"),t=I.autoScrollSpeed?m._autoScrollSpeed.call(null):f,n=e.is(":animated")?I.scrollingEasing:I.scrollEasing,a=O(y).scrollTop(),s=O(y).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&&y.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=O(i).height(),t=O(i).width(),n=O(y).height(),a=O(y).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=O(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=O(y).scrollTop(),t=O(y).scrollLeft(),n=O(i).height(),a=O(i).width(),s=[f+f*Math.floor(Math.abs(r[0]-e)/n*100)/100,f+f*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&&y.history&&y.history.pushState&&l&&l.length){var t="#"+l.attr("href").split("#")[1];t!==y.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?O(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}O.easing.easeInQuad=O.easing.easeInQuad||function(e){return e*e},O.easing.easeOutQuad=O.easing.easeOutQuad||function(e){return 1-(1-e)*(1-e)},O.easing.easeInOutQuad=O.easing.easeInOutQuad||function(e){return e<.5?2*e*e:1-Math.pow(-2*e+2,2)/2},O.easing.easeInCubic=O.easing.easeInCubic||function(e){return e*e*e},O.easing.easeOutCubic=O.easing.easeOutCubic||function(e){return 1-Math.pow(1-e,3)},O.easing.easeInOutCubic=O.easing.easeInOutCubic||function(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2},O.easing.easeInQuart=O.easing.easeInQuart||function(e){return e*e*e*e},O.easing.easeOutQuart=O.easing.easeOutQuart||function(e){return 1-Math.pow(1-e,4)},O.easing.easeInOutQuart=O.easing.easeInOutQuart||function(e){return e<.5?8*e*e*e*e:1-Math.pow(-2*e+2,4)/2},O.easing.easeInQuint=O.easing.easeInQuint||function(e){return e*e*e*e*e},O.easing.easeOutQuint=O.easing.easeOutQuint||function(e){return 1-Math.pow(1-e,5)},O.easing.easeInOutQuint=O.easing.easeInOutQuint||function(e){return e<.5?16*e*e*e*e*e:1-Math.pow(-2*e+2,5)/2},O.easing.easeInExpo=O.easing.easeInExpo||function(e){return 0===e?0:Math.pow(2,10*e-10)},O.easing.easeOutExpo=O.easing.easeOutExpo||function(e){return 1===e?1:1-Math.pow(2,-10*e)},O.easing.easeInOutExpo=O.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},O.easing.easeInSine=O.easing.easeInSine||function(e){return 1-Math.cos(e*Math.PI/2)},O.easing.easeOutSine=O.easing.easeOutSine||function(e){return Math.sin(e*Math.PI/2)},O.easing.easeInOutSine=O.easing.easeInOutSine||function(e){return-(Math.cos(Math.PI*e)-1)/2},O.easing.easeInCirc=O.easing.easeInCirc||function(e){return 1-Math.sqrt(1-Math.pow(e,2))},O.easing.easeOutCirc=O.easing.easeOutCirc||function(e){return Math.sqrt(1-Math.pow(e-1,2))},O.easing.easeInOutCirc=O.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},O.easing.easeInElastic=O.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))},O.easing.easeOutElastic=O.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},O.easing.easeInOutElastic=O.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},O.easing.easeInBack=O.easing.easeInBack||function(e){return 2.70158*e*e*e-1.70158*e*e},O.easing.easeOutBack=O.easing.easeOutBack||function(e){return 1+2.70158*Math.pow(e-1,3)+1.70158*Math.pow(e-1,2)},O.easing.easeInOutBack=O.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},O.easing.easeInBounce=O.easing.easeInBounce||function(e){return 1-t(1-e)},O.easing.easeOutBounce=O.easing.easeOutBounce||t,O.easing.easeInOutBounce=O.easing.easeInOutBounce||function(e){return e<.5?(1-t(1-2*e))/2:(1+t(2*e-1))/2}}};m._easing.call(),O.fn[g]=function(e){return _[e]?_[e].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof e&&e?void O.error("Method "+e+" does not exist"):_.init.apply(this,arguments)},O[g]=function(e){return _[e]?_[e].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof e&&e?void O.error("Method "+e+" does not exist"):_.init.apply(this,arguments)},O[g].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)},f=function(e){if(-1===e.indexOf(","))return e;var t=e.split(",");return{y:t[0]||"0",x:t[1]||"0"}},g=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=function(e,t){for(var n=e.click.length-1;0<=n;n--){var a=e.click[n];a&&"mPS2id"!=a.namespace&&('a[href*="#"]'===a.selector?a.selector='a[href*="#"]:not(._mPS2id-h)':"a[href*=#]:not([href=#])"===a.selector?a.selector="a[href*=#]:not([href=#]):not(._mPS2id-h)":a.selector&&-1!==a.selector.indexOf("mobmenu")?t.off("click"):t.off("click",a.handler))}},_="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++){var t=l("[class*='ps2id-id-']");if(t.length&&t.each(function(){var e,t=l(this),n=t.attr("class").split(" ");if(!t.attr("id"))for(var a in n)if(String(n[a]).match(/^ps2id-id-\S+$/)){e=n[a].split("ps2id-id-")[1],l("#"+e).length||t.attr("id",e);break}}),"true"===r.instances[o+"_instance_"+e].scrollToHash&&u&&(l(r.instances[o+"_instance_"+e].selector+",."+c+","+_).not(r.instances[o+"_instance_"+e].excludeSelector).each(function(){l(this).data(o+"Element",!0)}),h(u,"true"===r.instances[o+"_instance_"+e].scrollToHashForAll))){var n="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("","",n):window.location.href=n}}}),l(window).on("load",function(){for(var e=0;e<r.total_instances;e++){var n=l(r.instances[o+"_instance_"+e].selector+",."+c+","+_).not(r.instances[o+"_instance_"+e].excludeSelector),t=r.instances[o+"_instance_"+e].autoCorrectScroll,a=0;if(n.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:f(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:g(r.instances[o+"_instance_"+e].disablePluginBelow.toString()),appendHash:"true"===r.instances[o+"_instance_"+e].appendHash,onStart:function(){"true"===t&&"selector"===mPS2id.trigger&&a++},onComplete:function(){1==a&&(mPS2id.clicked.length&&mPS2id.clicked.trigger("click.mPS2id"),a=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=n.length?l._data(n[0],"events"):null,t=n.length?l._data(l(document)[0],"events"):null;e&&p(e,n),t&&p(t,n)},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
@@ -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 (smooth) 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--
|
@@ -92,6 +92,11 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
|
|
92 |
// Load admin stylesheet and javaScript.
|
93 |
add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_styles'));
|
94 |
add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'));
|
|
|
|
|
|
|
|
|
|
|
95 |
// load public stylesheet and javaScript.
|
96 |
if(!defined('PS2ID_MINIFIED_JS')){
|
97 |
define('PS2ID_MINIFIED_JS', true); //load production script by default
|
@@ -161,6 +166,37 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
|
|
161 |
wp_localize_script($this->plugin_slug.'-admin-script', '_adminParams', $params);
|
162 |
}
|
163 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
164 |
|
165 |
// front-end plugin scripts
|
166 |
public function enqueue_scripts(){
|
@@ -404,7 +440,7 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
|
|
404 |
// Get/set plugin version
|
405 |
$current_version=get_site_option($this->db_prefix.'version');
|
406 |
if(!$current_version){
|
407 |
-
|
408 |
$old_db_options=$this->get_plugin_old_db_options(); // Get old/deprecated plugin db options --edit--
|
409 |
$this->delete_plugin_old_db_options(); // Delete old/deprecated plugin db options --edit--
|
410 |
}else{
|
@@ -420,7 +456,7 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
|
|
420 |
$update[$this->pl_pfx.'instance_'.$i]=$instance;
|
421 |
}
|
422 |
$this->update_option=update_option($this->db_prefix.'instances', $update); // Update options
|
423 |
-
|
424 |
}
|
425 |
}
|
426 |
|
@@ -434,7 +470,7 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
|
|
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
|
438 |
($old_db_opt2) ? $old_db_opt2 : 800,
|
439 |
($old_db_opt3) ? $old_db_opt3 : 'true',
|
440 |
($old_db_opt4) ? $old_db_opt4 : 'easeInOutQuint',
|
@@ -534,6 +570,10 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
|
|
534 |
if(isset($pl_i['adminDisplayWidgetsId']) && $pl_i['adminDisplayWidgetsId']['value']=='true'){
|
535 |
add_action('widget_form_callback', array($this, 'display_widget_id'), 10, 2);
|
536 |
}
|
|
|
|
|
|
|
|
|
537 |
}
|
538 |
|
539 |
// WP Menu API menus HTML attributes fn
|
@@ -552,12 +592,22 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
|
|
552 |
}
|
553 |
return $instance;
|
554 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
555 |
|
556 |
public function plugin_options_array($action, $i, $j, $old){
|
557 |
// --edit--
|
558 |
// Defaults
|
559 |
-
$d0='a[href
|
560 |
$d19='true';
|
|
|
561 |
$d1=800;
|
562 |
$d2='true';
|
563 |
$d3='easeInOutQuint';
|
@@ -567,6 +617,7 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
|
|
567 |
$d26='false';
|
568 |
$d6='vertical';
|
569 |
$d7=0;
|
|
|
570 |
$d8='';
|
571 |
$d9='mPS2id-clicked';
|
572 |
$d10='mPS2id-target';
|
@@ -590,6 +641,7 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
|
|
590 |
case 'validate':
|
591 |
$v0=$this->sanitize_input('text', $_POST[$this->db_prefix.$i.'_selector'], $d0);
|
592 |
$v19=(isset($_POST[$this->db_prefix.$i.'_autoSelectorMenuLinks'])) ? 'true' : 'false';
|
|
|
593 |
$v1=$this->sanitize_input('number', $_POST[$this->db_prefix.$i.'_scrollSpeed'], $d1);
|
594 |
$v2=(isset($_POST[$this->db_prefix.$i.'_autoScrollSpeed'])) ? 'true' : 'false';
|
595 |
$v3=$_POST[$this->db_prefix.$i.'_scrollEasing'];
|
@@ -599,6 +651,7 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
|
|
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);
|
603 |
$v9=$this->sanitize_input('class', $_POST[$this->db_prefix.$i.'_clickedClass'], $d9);
|
604 |
$v10=$this->sanitize_input('class', $_POST[$this->db_prefix.$i.'_targetClass'], $d10);
|
@@ -637,6 +690,7 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
|
|
637 |
$v6=(isset($j['layout'])) ? $j['layout']['value'] : $d6;
|
638 |
}
|
639 |
$v7=(isset($j['offset'])) ? $j['offset']['value'] : $d7;
|
|
|
640 |
$v8=(isset($j['highlightSelector'])) ? $j['highlightSelector']['value'] : $d8;
|
641 |
$v9=(isset($j['clickedClass'])) ? $j['clickedClass']['value'] : $d9;
|
642 |
$v10=(isset($j['targetClass'])) ? $j['targetClass']['value'] : $d10;
|
@@ -650,6 +704,7 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
|
|
650 |
$v18=(isset($j['scrollToHashDelay'])) ? $j['scrollToHashDelay']['value'] : $d18;
|
651 |
$v15=(isset($j['disablePluginBelow'])) ? $j['disablePluginBelow']['value'] : $d15;
|
652 |
$v19=(isset($j['autoSelectorMenuLinks'])) ? $j['autoSelectorMenuLinks']['value'] : $d19;
|
|
|
653 |
$v20=(isset($j['adminDisplayWidgetsId'])) ? $j['adminDisplayWidgetsId']['value'] : $d20;
|
654 |
$v21=(isset($j['adminTinyMCEbuttons'])) ? $j['adminTinyMCEbuttons']['value'] : $d21;
|
655 |
$v23=(isset($j['unbindUnrelatedClickEvents'])) ? $j['unbindUnrelatedClickEvents']['value'] : $d23;
|
@@ -662,6 +717,7 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
|
|
662 |
default:
|
663 |
$v0=$d0;
|
664 |
$v19=$d19;
|
|
|
665 |
$v1=$d1;
|
666 |
$v2=$d2;
|
667 |
$v3=$d3;
|
@@ -671,6 +727,7 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
|
|
671 |
$v26=$d26;
|
672 |
$v6=$d6;
|
673 |
$v7=$d7;
|
|
|
674 |
$v8=$d8;
|
675 |
$v9=$d9;
|
676 |
$v10=$d10;
|
@@ -714,7 +771,7 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
|
|
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(
|
@@ -729,6 +786,18 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
|
|
729 |
'description' => 'Automatically enable the plugin on custom links (containing <code>#</code> in their URL) created in Appearance → Menus <br /><small>Requires WordPress version 3.6 or higher</small>',
|
730 |
'wrapper' => 'fieldset'
|
731 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
732 |
'scrollSpeed' => array(
|
733 |
'value' => $v1,
|
734 |
'values' => null,
|
@@ -837,6 +906,18 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
|
|
837 |
'description' => 'Offset scroll-to position by x amount of pixels (positive or negative) or by <a href="http://www.w3.org/TR/css3-selectors/" target="_blank">selector</a> (e.g. <code>#navigation-menu</code>)',
|
838 |
'wrapper' => null
|
839 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
840 |
'highlightSelector' => array(
|
841 |
'value' => $v8,
|
842 |
'values' => null,
|
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.5
|
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.5'; // Plugin version --edit--
|
51 |
protected $update_option=null;
|
52 |
|
53 |
protected $plugin_name='Page scroll to id'; // Plugin name --edit--
|
92 |
// Load admin stylesheet and javaScript.
|
93 |
add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_styles'));
|
94 |
add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'));
|
95 |
+
// Load admin block editor (i.e. Gutenberg) assets (stylesheet, javaScript etc.)
|
96 |
+
add_action('enqueue_block_editor_assets', array($this, 'enqueue_admin_block_styles'));
|
97 |
+
add_action('enqueue_block_editor_assets', array($this, 'enqueue_admin_block_scripts'));
|
98 |
+
// Register plugin's blocks (Gutenberg)
|
99 |
+
add_action('plugins_loaded', array($this, 'plugin_register_blocks_fn'));
|
100 |
// load public stylesheet and javaScript.
|
101 |
if(!defined('PS2ID_MINIFIED_JS')){
|
102 |
define('PS2ID_MINIFIED_JS', true); //load production script by default
|
166 |
wp_localize_script($this->plugin_slug.'-admin-script', '_adminParams', $params);
|
167 |
}
|
168 |
}
|
169 |
+
|
170 |
+
// Admin block editor styles (Gutenberg)
|
171 |
+
public function enqueue_admin_block_styles(){
|
172 |
+
wp_enqueue_style(
|
173 |
+
$this->plugin_slug.'-admin-blocks-style',
|
174 |
+
plugins_url( 'includes/blocks/blocks.css', __FILE__ ),
|
175 |
+
array( 'wp-edit-blocks' ),
|
176 |
+
filemtime( plugin_dir_path( __FILE__ ) . 'includes/blocks/blocks.css' )
|
177 |
+
);
|
178 |
+
}
|
179 |
+
|
180 |
+
// Admin block editor scripts (Gutenberg)
|
181 |
+
public function enqueue_admin_block_scripts(){
|
182 |
+
wp_enqueue_script(
|
183 |
+
$this->plugin_slug.'-admin-blocks-script',
|
184 |
+
plugins_url( 'includes/blocks/blocks.js', __FILE__ ),
|
185 |
+
array( 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-editor' ),
|
186 |
+
filemtime( plugin_dir_path( __FILE__ ) . 'includes/blocks/blocks.js' ),
|
187 |
+
true // Load script in footer.
|
188 |
+
);
|
189 |
+
}
|
190 |
+
|
191 |
+
// Register plugin's blocks (Gutenberg)
|
192 |
+
public function plugin_register_blocks_fn(){
|
193 |
+
if ( function_exists( 'register_block_type' ) ){
|
194 |
+
register_block_type( 'ps2id/blocks', array(
|
195 |
+
'editor_script' => $this->plugin_slug.'-admin-blocks-script',
|
196 |
+
'editor_style' => $this->plugin_slug.'-admin-blocks-style',
|
197 |
+
) );
|
198 |
+
}
|
199 |
+
}
|
200 |
|
201 |
// front-end plugin scripts
|
202 |
public function enqueue_scripts(){
|
440 |
// Get/set plugin version
|
441 |
$current_version=get_site_option($this->db_prefix.'version');
|
442 |
if(!$current_version){
|
443 |
+
add_site_option($this->db_prefix.'version', $this->version);
|
444 |
$old_db_options=$this->get_plugin_old_db_options(); // Get old/deprecated plugin db options --edit--
|
445 |
$this->delete_plugin_old_db_options(); // Delete old/deprecated plugin db options --edit--
|
446 |
}else{
|
456 |
$update[$this->pl_pfx.'instance_'.$i]=$instance;
|
457 |
}
|
458 |
$this->update_option=update_option($this->db_prefix.'instances', $update); // Update options
|
459 |
+
update_site_option($this->db_prefix.'version', $this->version); // Update version
|
460 |
}
|
461 |
}
|
462 |
|
470 |
$old_db_opt6=get_option('malihu_pagescroll2id_pageEndSmoothScroll');
|
471 |
$old_db_opt7=get_option('malihu_pagescroll2id_layout');
|
472 |
return array(
|
473 |
+
($old_db_opt1) ? $old_db_opt1 : 'a[href*=\'#\']:not([href=\'#\'])',
|
474 |
($old_db_opt2) ? $old_db_opt2 : 800,
|
475 |
($old_db_opt3) ? $old_db_opt3 : 'true',
|
476 |
($old_db_opt4) ? $old_db_opt4 : 'easeInOutQuint',
|
570 |
if(isset($pl_i['adminDisplayWidgetsId']) && $pl_i['adminDisplayWidgetsId']['value']=='true'){
|
571 |
add_action('widget_form_callback', array($this, 'display_widget_id'), 10, 2);
|
572 |
}
|
573 |
+
// Auto-generate dummy offset element
|
574 |
+
if(isset($pl_i['dummyOffset']) && $pl_i['dummyOffset']['value']=='true'){
|
575 |
+
add_action('wp_footer', array($this, 'dummy_offset_element'), 99);
|
576 |
+
}
|
577 |
}
|
578 |
|
579 |
// WP Menu API menus HTML attributes fn
|
592 |
}
|
593 |
return $instance;
|
594 |
}
|
595 |
+
|
596 |
+
// Auto-generate dummy offset element fn
|
597 |
+
public function dummy_offset_element(){
|
598 |
+
$dummy_offset_class = '';
|
599 |
+
if ( is_admin_bar_showing() ) {
|
600 |
+
$dummy_offset_class .= ' class="admin-bar-visible"';
|
601 |
+
}
|
602 |
+
echo '<div class="ps2id-dummy-offset-wrapper" style="overflow:hidden;height:0;visibility:hidden;z-index:-1;"><div id="ps2id-dummy-offset"'.$dummy_offset_class.' style="width:100%;visibility:hidden;"></div></div>';
|
603 |
+
}
|
604 |
|
605 |
public function plugin_options_array($action, $i, $j, $old){
|
606 |
// --edit--
|
607 |
// Defaults
|
608 |
+
$d0='a[href*=\'#\']:not([href=\'#\'])';
|
609 |
$d19='true';
|
610 |
+
$d29='a[href^=\'#tab-\'], a[href^=\'#tabs-\'], a[data-toggle]:not([data-toggle=\'tooltip\']), a[data-slide], a[data-vc-tabs], a[data-vc-accordion]';
|
611 |
$d1=800;
|
612 |
$d2='true';
|
613 |
$d3='easeInOutQuint';
|
617 |
$d26='false';
|
618 |
$d6='vertical';
|
619 |
$d7=0;
|
620 |
+
$d30='false';
|
621 |
$d8='';
|
622 |
$d9='mPS2id-clicked';
|
623 |
$d10='mPS2id-target';
|
641 |
case 'validate':
|
642 |
$v0=$this->sanitize_input('text', $_POST[$this->db_prefix.$i.'_selector'], $d0);
|
643 |
$v19=(isset($_POST[$this->db_prefix.$i.'_autoSelectorMenuLinks'])) ? 'true' : 'false';
|
644 |
+
$v29=$this->sanitize_input('text', $_POST[$this->db_prefix.$i.'_excludeSelector'], $d29);
|
645 |
$v1=$this->sanitize_input('number', $_POST[$this->db_prefix.$i.'_scrollSpeed'], $d1);
|
646 |
$v2=(isset($_POST[$this->db_prefix.$i.'_autoScrollSpeed'])) ? 'true' : 'false';
|
647 |
$v3=$_POST[$this->db_prefix.$i.'_scrollEasing'];
|
651 |
$v26=(isset($_POST[$this->db_prefix.$i.'_autoCorrectScroll'])) ? 'true' : 'false';
|
652 |
$v6=$_POST[$this->db_prefix.$i.'_layout'];
|
653 |
$v7=$this->sanitize_input('text', $_POST[$this->db_prefix.$i.'_offset'], $d7);
|
654 |
+
$v30=(isset($_POST[$this->db_prefix.$i.'_dummyOffset'])) ? 'true' : 'false';
|
655 |
$v8=(empty($_POST[$this->db_prefix.$i.'_highlightSelector'])) ? $d8 : $this->sanitize_input('text', $_POST[$this->db_prefix.$i.'_highlightSelector'], $d8);
|
656 |
$v9=$this->sanitize_input('class', $_POST[$this->db_prefix.$i.'_clickedClass'], $d9);
|
657 |
$v10=$this->sanitize_input('class', $_POST[$this->db_prefix.$i.'_targetClass'], $d10);
|
690 |
$v6=(isset($j['layout'])) ? $j['layout']['value'] : $d6;
|
691 |
}
|
692 |
$v7=(isset($j['offset'])) ? $j['offset']['value'] : $d7;
|
693 |
+
$v30=(isset($j['dummyOffset'])) ? $j['dummyOffset']['value'] : $d30;
|
694 |
$v8=(isset($j['highlightSelector'])) ? $j['highlightSelector']['value'] : $d8;
|
695 |
$v9=(isset($j['clickedClass'])) ? $j['clickedClass']['value'] : $d9;
|
696 |
$v10=(isset($j['targetClass'])) ? $j['targetClass']['value'] : $d10;
|
704 |
$v18=(isset($j['scrollToHashDelay'])) ? $j['scrollToHashDelay']['value'] : $d18;
|
705 |
$v15=(isset($j['disablePluginBelow'])) ? $j['disablePluginBelow']['value'] : $d15;
|
706 |
$v19=(isset($j['autoSelectorMenuLinks'])) ? $j['autoSelectorMenuLinks']['value'] : $d19;
|
707 |
+
$v29=(isset($j['excludeSelector'])) ? $j['excludeSelector']['value'] : $d29;
|
708 |
$v20=(isset($j['adminDisplayWidgetsId'])) ? $j['adminDisplayWidgetsId']['value'] : $d20;
|
709 |
$v21=(isset($j['adminTinyMCEbuttons'])) ? $j['adminTinyMCEbuttons']['value'] : $d21;
|
710 |
$v23=(isset($j['unbindUnrelatedClickEvents'])) ? $j['unbindUnrelatedClickEvents']['value'] : $d23;
|
717 |
default:
|
718 |
$v0=$d0;
|
719 |
$v19=$d19;
|
720 |
+
$v29=$d29;
|
721 |
$v1=$d1;
|
722 |
$v2=$d2;
|
723 |
$v3=$d3;
|
727 |
$v26=$d26;
|
728 |
$v6=$d6;
|
729 |
$v7=$d7;
|
730 |
+
$v30=$d30;
|
731 |
$v8=$d8;
|
732 |
$v9=$d9;
|
733 |
$v10=$d10;
|
771 |
'checkbox_label' => null,
|
772 |
'radio_labels' => null,
|
773 |
'field_info' => null,
|
774 |
+
'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> <br /><small><a class="button button-small mPS2id-show-option-common-values" href="#">Show common values</a><span>For all links: <code>'.$d0.'</code><br />For menu links only: <code>.menu-item a[href*=\'#\']:not([href=\'#\'])</code></span></small>',
|
775 |
'wrapper' => null
|
776 |
),
|
777 |
'autoSelectorMenuLinks' => array(
|
786 |
'description' => 'Automatically enable the plugin on custom links (containing <code>#</code> in their URL) created in Appearance → Menus <br /><small>Requires WordPress version 3.6 or higher</small>',
|
787 |
'wrapper' => 'fieldset'
|
788 |
),
|
789 |
+
'excludeSelector' => array(
|
790 |
+
'value' => $v29,
|
791 |
+
'values' => null,
|
792 |
+
'id' => $this->db_prefix.$i.'_excludeSelector',
|
793 |
+
'field_type' => 'text',
|
794 |
+
'label' => '',
|
795 |
+
'checkbox_label' => null,
|
796 |
+
'radio_labels' => null,
|
797 |
+
'field_info' => 'selectors are excluded',
|
798 |
+
'description' => 'Set the links (in the form of <a href="http://www.w3.org/TR/css3-selectors/" target="_blank">CSS selectors</a>) that will be excluded from plugin's selectors (the plugin will not hanlde these links) <br /><small><a class="button button-small mPS2id-show-option-common-values" href="#">Show common values</a><span><code>'.$d29.'</code></span></small>',
|
799 |
+
'wrapper' => null
|
800 |
+
),
|
801 |
'scrollSpeed' => array(
|
802 |
'value' => $v1,
|
803 |
'values' => null,
|
906 |
'description' => 'Offset scroll-to position by x amount of pixels (positive or negative) or by <a href="http://www.w3.org/TR/css3-selectors/" target="_blank">selector</a> (e.g. <code>#navigation-menu</code>)',
|
907 |
'wrapper' => null
|
908 |
),
|
909 |
+
'dummyOffset' => array(
|
910 |
+
'value' => $v30,
|
911 |
+
'values' => null,
|
912 |
+
'id' => $this->db_prefix.$i.'_dummyOffset',
|
913 |
+
'field_type' => 'checkbox',
|
914 |
+
'label' => '',
|
915 |
+
'checkbox_label' => 'Auto-generate <code>#ps2id-dummy-offset</code> element',
|
916 |
+
'radio_labels' => null,
|
917 |
+
'field_info' => null,
|
918 |
+
'description' => 'Enable if you want the plugin to create a hidden element and use its selector as offset. The element that will be created is: <code>#ps2id-dummy-offset</code> <br /><small>You should use the <code>#ps2id-dummy-offset</code> value in the <b>Offset</b> option above. You should then use the same selector/value and in your CSS and give it a height equal to the amount of offset you want.</small>',
|
919 |
+
'wrapper' => 'fieldset'
|
920 |
+
),
|
921 |
'highlightSelector' => array(
|
922 |
'value' => $v8,
|
923 |
'values' => null,
|
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, smooth scroll, navigation, single-page navigation
|
5 |
Requires at least: 3.3
|
6 |
-
Tested up to: 5.
|
7 |
-
Stable tag: 1.6.
|
8 |
License: The MIT License (MIT)
|
9 |
License URI: http://opensource.org/licenses/MIT
|
10 |
|
@@ -32,6 +32,7 @@ Create links that scroll the page smoothly to any id within the document.
|
|
32 |
* [Using Page scroll to id with the Divi Builder plugin](http://manos.malihu.gr/using-page-scroll-to-id-with-the-divi-builder-plugin/)
|
33 |
* [Using Page scroll to id with SiteOrigin Page Builder](http://manos.malihu.gr/using-page-scroll-to-id-with-siteorigin-page-builder/)
|
34 |
* [Using Page scroll to id with WPBakery Page Builder](http://manos.malihu.gr/using-page-scroll-to-id-with-wpbakery-page-builder/)
|
|
|
35 |
* [Support](http://wordpress.org/support/plugin/page-scroll-to-id)
|
36 |
|
37 |
= Requirements =
|
@@ -95,8 +96,23 @@ Because it works and it already has a ton of features. The plugin has little dep
|
|
95 |
|
96 |
6. Visual editor "Insert Page scoll to id target" modal
|
97 |
|
|
|
|
|
98 |
== Changelog ==
|
99 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
= 1.6.4 =
|
101 |
|
102 |
* Fixed a minor bug affecting the "Prevent other scripts from handling plugin's links" option.
|
@@ -222,6 +238,10 @@ Because it works and it already has a ton of features. The plugin has little dep
|
|
222 |
|
223 |
== Upgrade Notice ==
|
224 |
|
|
|
|
|
|
|
|
|
225 |
= 1.6.4 =
|
226 |
|
227 |
Fixed a minor bug affecting the "Prevent other scripts from handling plugin's links" option.
|
@@ -291,6 +311,7 @@ If you like this plugin and find it useful, consider making a [donation](https:/
|
|
291 |
|
292 |
== Other/external resources ==
|
293 |
|
|
|
294 |
* [Using Page scroll to id with the Divi Builder plugin](http://manos.malihu.gr/using-page-scroll-to-id-with-the-divi-builder-plugin/)
|
295 |
* [One Page WordPress Smooth Scrolling Menu - How to Use Page Scroll to ID Plugin 2017](https://www.youtube.com/watch?v=ZJt7-0W-DeE)
|
296 |
* [Smooth scrolling between page sections using Page scroll to id](http://sridharkatakam.com/smooth-scrolling-page-sections-using-page-scroll-id/)
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=UYJ5G65M6ZA28
|
4 |
Tags: page scrolling, page animation, smooth scroll, navigation, single-page navigation
|
5 |
Requires at least: 3.3
|
6 |
+
Tested up to: 5.2
|
7 |
+
Stable tag: 1.6.5
|
8 |
License: The MIT License (MIT)
|
9 |
License URI: http://opensource.org/licenses/MIT
|
10 |
|
32 |
* [Using Page scroll to id with the Divi Builder plugin](http://manos.malihu.gr/using-page-scroll-to-id-with-the-divi-builder-plugin/)
|
33 |
* [Using Page scroll to id with SiteOrigin Page Builder](http://manos.malihu.gr/using-page-scroll-to-id-with-siteorigin-page-builder/)
|
34 |
* [Using Page scroll to id with WPBakery Page Builder](http://manos.malihu.gr/using-page-scroll-to-id-with-wpbakery-page-builder/)
|
35 |
+
* [Using Page scroll to id with Elementor Page Builder](http://manos.malihu.gr/page-scroll-to-id-elementor-guide/)
|
36 |
* [Support](http://wordpress.org/support/plugin/page-scroll-to-id)
|
37 |
|
38 |
= Requirements =
|
96 |
|
97 |
6. Visual editor "Insert Page scoll to id target" modal
|
98 |
|
99 |
+
7. Gutenberg block editor "Page scoll to id target" custom block
|
100 |
+
|
101 |
== Changelog ==
|
102 |
|
103 |
+
= 1.6.5 =
|
104 |
+
|
105 |
+
* Added new option to exclude specific selectors from being handled by the plugin.
|
106 |
+
* Added new option 'Auto-generate #ps2id-dummy-offset element'.
|
107 |
+
* Added 'Page scroll to id target' block for Gutenberg block editor.
|
108 |
+
* Added new feature for Gutenberg block editor:
|
109 |
+
* Fixed highlight not working in URLs with an apostrophe.
|
110 |
+
* Fixed [this issue](https://wordpress.org/support/topic/only-works-on-initial-page-load/#post-11168522) regarding plugin's default selector when using non-WordPress jQuery library.
|
111 |
+
* Fixed [this minor issue](https://wordpress.org/support/topic/no-more-smooth-scrolling/).
|
112 |
+
* Fixed multisite issue where few plugin options would not save/update properly.
|
113 |
+
* Fixed [issue #10](https://github.com/malihu/page-scroll-to-id/issues/17)
|
114 |
+
* Updated plugin's contextual help and documentation.
|
115 |
+
|
116 |
= 1.6.4 =
|
117 |
|
118 |
* Fixed a minor bug affecting the "Prevent other scripts from handling plugin's links" option.
|
238 |
|
239 |
== Upgrade Notice ==
|
240 |
|
241 |
+
= 1.6.5 =
|
242 |
+
|
243 |
+
Added "Page scroll to id target" block and new features for Gutenberg block editor, added exclude selectors option, added new offset options, fixed various issues and bugs.
|
244 |
+
|
245 |
= 1.6.4 =
|
246 |
|
247 |
Fixed a minor bug affecting the "Prevent other scripts from handling plugin's links" option.
|
311 |
|
312 |
== Other/external resources ==
|
313 |
|
314 |
+
* [How to create anchor links on WordPress Gutenberg editor](https://www.virfice.com/how-to-create-anchor-links-on-wordpress-gutenberg-editor/)
|
315 |
* [Using Page scroll to id with the Divi Builder plugin](http://manos.malihu.gr/using-page-scroll-to-id-with-the-divi-builder-plugin/)
|
316 |
* [One Page WordPress Smooth Scrolling Menu - How to Use Page Scroll to ID Plugin 2017](https://www.youtube.com/watch?v=ZJt7-0W-DeE)
|
317 |
* [Smooth scrolling between page sections using Page scroll to id](http://sridharkatakam.com/smooth-scrolling-page-sections-using-page-scroll-id/)
|
screenshot-1.png
CHANGED
Binary file
|
screenshot-3.png
CHANGED
Binary file
|
screenshot-7.png
ADDED
Binary file
|
uninstall.php
CHANGED
@@ -5,6 +5,7 @@ if(!defined('WP_UNINSTALL_PLUGIN'))
|
|
5 |
// --edit--
|
6 |
$opt1='page_scroll_to_id_instances';
|
7 |
$opt2='page_scroll_to_id_version';
|
|
|
8 |
|
9 |
if(!is_multisite()){
|
10 |
// Single site --edit--
|
@@ -15,11 +16,12 @@ if(!is_multisite()){
|
|
15 |
global $wpdb;
|
16 |
$blog_ids=$wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
|
17 |
$original_blog_id=get_current_blog_id();
|
|
|
18 |
foreach($blog_ids as $blog_id){
|
19 |
switch_to_blog($blog_id);
|
20 |
// --edit--
|
21 |
-
|
22 |
-
|
23 |
}
|
24 |
switch_to_blog($original_blog_id);
|
25 |
}
|
5 |
// --edit--
|
6 |
$opt1='page_scroll_to_id_instances';
|
7 |
$opt2='page_scroll_to_id_version';
|
8 |
+
//the only thing not deleted is widget_malihupagescroll2idwidget in wp_options
|
9 |
|
10 |
if(!is_multisite()){
|
11 |
// Single site --edit--
|
16 |
global $wpdb;
|
17 |
$blog_ids=$wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
|
18 |
$original_blog_id=get_current_blog_id();
|
19 |
+
delete_site_option($opt2);
|
20 |
foreach($blog_ids as $blog_id){
|
21 |
switch_to_blog($blog_id);
|
22 |
// --edit--
|
23 |
+
delete_option($opt1);
|
24 |
+
delete_option($opt2);
|
25 |
}
|
26 |
switch_to_blog($original_blog_id);
|
27 |
}
|