Page scroll to id - Version 1.6.2

Version Description

  • 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).
  • Extended plugin's settings page and renamed few options to less technical terms.
  • Added special class/option for creating links with alternative scroll duration/speed.
  • Extended plugin buttons on WordPress visual editor (non-shortcode links, custom classes etc.).
  • Added new option 'Append the clicked links hash value to browsers URL/address bar'.
  • Added new option 'Stop page scrolling on mouse-wheel or touch-swipe'.
  • Added new option 'Prevent other scripts from handling plugins links'.
  • Added new option 'Normalize anchor-point targets'.
  • Relative-root links are now properly highlighted.
  • Added wp-config.php option for selecting which script files the plugin loads (minified or uncompressed).
  • Only necessary CDATA values are passed on the front-end script.
  • Added compatibility for latest non-WordPress jQuery versions (2.x and 3.x).
  • Fixed a bug regarding shortcode's offset attribute when used with "auto" layout.
  • Fixed a php notice when updating plugin from version 1.6.0.
  • Added workaround for IE/Edge not starting from the top when scrolling to hash on page load.
  • Updated readme.txt, contextual help and documentation.
Download this release

Release Info

Developer malihu
Plugin Icon 128x128 Page scroll to id
Version 1.6.2
Comparing to
See all releases

Code changes from version 1.6.1 to 1.6.2

css/admin.css CHANGED
@@ -17,6 +17,15 @@
17
  font-style: italic;
18
  }
19
 
 
 
 
 
 
 
 
 
 
20
  .plugin-version{
21
  float: right;
22
  text-align: right;
17
  font-style: italic;
18
  }
19
 
20
+ .plugin-info > *{
21
+ margin-right: 10px;
22
+ }
23
+
24
+ .mPS2id-external-link .dashicons-external{
25
+ font-size: 100%;
26
+ text-decoration: none;
27
+ }
28
+
29
  .plugin-version{
30
  float: right;
31
  text-align: right;
css/tinymce-custom-btn-ps2id-link.png CHANGED
Binary file
css/tinymce-custom-btn-ps2id-target.png CHANGED
Binary file
includes/admin.php CHANGED
@@ -2,7 +2,7 @@
2
  // --edit--
3
  $repeatables=false;
4
  $shortcodes=false;
5
- $plugin_info=__('<a href="#" class="mPS2id-open-help mPS2id-open-help-overview">Overview</a>&nbsp;&nbsp;&nbsp;<a href="#" class="mPS2id-open-help mPS2id-open-help-get-started">Get started</a>&nbsp;&nbsp;&nbsp;<a href="#" class="mPS2id-open-help mPS2id-open-help-plugin-settings">Plugin settings</a>&nbsp;&nbsp;&nbsp;<a href="#" class="mPS2id-open-help mPS2id-open-help-shortcodes">Shortcodes</a>', $this->plugin_slug);
6
  $btn_add=__('Add instance', $this->plugin_slug);
7
  $btn_more_actions=__('More actions', $this->plugin_slug);
8
  $btn_reset=($repeatables) ? __('Delete all and reset to default', $this->plugin_slug) : __('Reset to default', $this->plugin_slug);
@@ -23,10 +23,6 @@ $toggle_instance_title=__('Click to toggle', $this->plugin_slug);
23
  <!-- --edit-- -->
24
  <div class="oldwp-plugin-help-section oldwp-plugin-help-section-overview">
25
  <?php include_once(plugin_dir_path( __FILE__ ).'help/overview.inc'); ?>
26
- <p>
27
- <strong>For more information</strong> <br />
28
- <a href="http://manos.malihu.gr/page-scroll-to-id" target="_blank">Plugin homepage</a>&nbsp;&nbsp;&nbsp;<a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress-tutorial/" target="_blank">Page scroll to id for WordPress tutorial</a>&nbsp;&nbsp;&nbsp;<a href="http://manos.malihu.gr/page-scroll-to-id/2/" target="_blank">Code examples &amp; short tutorials</a>
29
- </p>
30
  </div>
31
  <div class="oldwp-plugin-help-section oldwp-plugin-help-section-get-started">
32
  <?php include_once(plugin_dir_path( __FILE__ ).'help/get-started.inc'); ?>
2
  // --edit--
3
  $repeatables=false;
4
  $shortcodes=false;
5
+ $plugin_info=__('<span><span class="dashicons dashicons-editor-help"></span> Plugin help &amp; resources:</span> <a href="#" class="mPS2id-open-help mPS2id-open-help-overview">Overview</a> <a href="#" class="mPS2id-open-help mPS2id-open-help-get-started">Get started</a> <a href="#" class="mPS2id-open-help mPS2id-open-help-plugin-settings">Plugin settings</a> <a href="#" class="mPS2id-open-help mPS2id-open-help-shortcodes">Shortcodes</a> <a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/" class="mPS2id-external-link" target="_blank">Plugin homepage &amp; documentation</a> <a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/2/" class="mPS2id-external-link" target="_blank">Knowledge Base – FAQ</a> <a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress-tutorial/" class="mPS2id-external-link" target="_blank">Basic tutorial</a>', $this->plugin_slug);
6
  $btn_add=__('Add instance', $this->plugin_slug);
7
  $btn_more_actions=__('More actions', $this->plugin_slug);
8
  $btn_reset=($repeatables) ? __('Delete all and reset to default', $this->plugin_slug) : __('Reset to default', $this->plugin_slug);
23
  <!-- --edit-- -->
24
  <div class="oldwp-plugin-help-section oldwp-plugin-help-section-overview">
25
  <?php include_once(plugin_dir_path( __FILE__ ).'help/overview.inc'); ?>
 
 
 
 
26
  </div>
27
  <div class="oldwp-plugin-help-section oldwp-plugin-help-section-get-started">
28
  <?php include_once(plugin_dir_path( __FILE__ ).'help/get-started.inc'); ?>
includes/help/get-started.inc CHANGED
@@ -2,34 +2,26 @@
2
  $help_get_started_text=<<<EOD
3
 
4
  <p>
5
- The plugin works simply by connecting links in the form of <code>&lt;a href="#id"&gt;link&lt;/a&gt;</code>, to sections within the document, in the form of <code>&lt;div id="id"&gt;target&lt;/div&gt;</code>. Clicking the links will smoothly animate the page to the connected sections, provided the links are included in the Selector(s) field. <br />
6
- The default value of Selector(s) is <code>a[rel='m_PageScroll2id']</code>, meaning the plugin will apply on links with <code>m_PageScroll2id</code> rel attribute value (e.g. <code>&lt;a href="#id" rel="m_PageScroll2id"&gt;link&lt;/a&gt;</code>). <br />
7
- The plugin will also apply automatically on links with class <code>ps2id</code> or links that are direct children of an element with that same class.
8
  </p>
9
 
10
  <p>
11
- <strong>Get started</strong> by adding <code>rel="m_PageScroll2id"</code> or <code>class="ps2id"</code> to your links that point to existing sections within your page, making sure each link's href value contains a hash (<code>#</code>) with the id of the section you want to scroll-to.
 
12
  </p>
13
 
14
  <p>
15
- To enable the plugin on custom links in your WordPress menu(s), simply enable "Enable on WordPress Menu links" option in plugin's settings.
16
- If you prefer to use the non-automatic method of enabling it in your WordPress menu, you can insert the value <code>ps2id</code> in "CSS Classes" field or the <code>m_PageScroll2id</code> value in "Link Relationship (XFN)" field in each of your links. <br />
17
- To add <code>rel="m_PageScroll2id"</code> to links in custom menus (menus created in Appearance &rsaquo; Menus), do the following: <br />
18
- While on the Menus admin page, click "Screen Options" and check "Link Relationship (XFN)". To enable the plugin on a menu item, click the arrow on the right of the item and insert <code>m_PageScroll2id</code> in the "Link Relationship (XFN)" field (assuming your menu contains links with "URL" value in the form of <code>#id</code>).
19
  </p>
20
 
21
  <p>
22
- If you cannot edit your html markup or don't want to alter your links rel or class attributes, you can change the Selector(s) field value to existing matching sets of elements in your theme, e.g. <code>a.class-name</code>, <code>#id a</code>, <code>a[href*='#']</code> etc. For multiple selectors, use comma separated values: e.g. <code>a[rel='m_PageScroll2id'], a.class-name</code>.
23
- </p>
24
-
25
- <p>
26
- To highlight your links and/or targets, use the class(es) provided by the plugin in your theme's stylesheet. The default highlight class is <code>mPS2id-highlight</code> but you can set your own in the Classes fields below. <br />
27
- For example, to style the highlighted link (the link whose target element is considered to be within the viewport), you could add in your CSS: <br />
28
  <code>a.mPS2id-highlight{ background: #ff0; }</code> or <code>.menu-item a.mPS2id-highlight{ background: #ff0; }</code> for highlighting custom menus links only.
29
  </p>
30
 
31
  <p>
32
- If you have a fixed-positioned menu which overlaps your target's content when page scrolling is completed, insert your menu selector in the Offset field. For example, inserting <code>#navigation-menu</code> will offset the scroll-to position according to the height/width/position of the element with id <code>navigation-menu</code>.
33
  </p>
34
 
35
  EOD;
2
  $help_get_started_text=<<<EOD
3
 
4
  <p>
5
+ The plugin works by "connecting" links with href/URL in the form of <code>#my-id</code> or <code>http://my-site.com/page/#my-id</code> to sections/elements within the document with an equivalent id attribute value (e.g. <code>&lt;div id="my-id"&gt;...&lt;/div&gt;</code>). Clicking such links will scroll the page smoothly to their target id position.
 
 
6
  </p>
7
 
8
  <p>
9
+ <strong>Get started</strong> by creating or setting-up your links. The plugin is enabled by default on WordPress Menu links (created in Appearance &rarr; Menus), so you can start adding custom links and set their URL to the id/target you want to scroll to (e.g. <code>#my-id</code>, <code>/page/#my-id</code>, <code>http://my-site.com/page/#my-id</code> etc.). <br />
10
+ You can use id values that already exist in your theme or you can create your own id targets using plugin's "Insert Page scroll to id target" button in wp post visual editor or the <code>[ps2id]</code> shortcode (e.g. <code>[ps2id id='my-id'/]</code>).
11
  </p>
12
 
13
  <p>
14
+ To create links within your content, use plugin's "Insert/edit Page scroll to id link" button and/or shortcode (e.g. <code>[ps2id url='#my-id']link text[/ps2id]</code>) in wp post visual/text editor. <br />
15
+ To enable the plugin on existing links, add the <code>ps2id</code> class or the <code>m_PageScroll2id</code> rel attribute to them, making sure the link's href/URL value contains a hash (<code>#</code>) with the id of the section you want to scroll-to. In addition, you can simply add your links CSS selector (e.g. <code>.menu-item a</code>, <code>a[href*=#]:not([href=#])</code> etc.) in "Selector(s)" field in plugin settings.
 
 
16
  </p>
17
 
18
  <p>
19
+ To highlight your links (or targets), use the classes provided by the plugin in your theme's stylesheet or custom CSS. The default highlight class is <code>mPS2id-highlight</code> but you can set your own in the "Classes &amp; highlight options". For example, to style the highlighted link (the link whose target element is considered to be within the viewport), you could add in your CSS: <br />
 
 
 
 
 
20
  <code>a.mPS2id-highlight{ background: #ff0; }</code> or <code>.menu-item a.mPS2id-highlight{ background: #ff0; }</code> for highlighting custom menus links only.
21
  </p>
22
 
23
  <p>
24
+ If you have a fixed-positioned/sticky menu which overlaps your target's content when page scrolling is completed, insert your menu CSS selector or a fixed pixel value in the "Offset" field. For example, inserting <code>#navigation-menu</code> will offset the scroll-to position according to the height/width/position of the element with id <code>navigation-menu</code>. In the same manner, setting the "Offset" value to <code>100</code> will offset page scrolling by 100 pixels.
25
  </p>
26
 
27
  EOD;
includes/help/overview.inc CHANGED
@@ -2,12 +2,12 @@
2
  $help_overview_text=<<<EOD
3
 
4
  <p>
5
- <strong>Page scroll to id</strong> is an easy-to-use jQuery plugin that enables animated page scrolling to specific id within the document.
6
  </p>
7
 
8
  <p>
9
- The plugin replaces the default browser behaviour of "jumping" to page sections when links with href value containing <code>#</code> are clicked, by smoothly animating the page to those sections. <br />
10
- You can use it for simple back-to-top links or complex, single-page website navigation and features include: adjustable animation speed, advanced animation easings, vertical and/or horizontal scrolling, links highlighting etc.
11
  </p>
12
 
13
  <p>If you like this plugin and find it useful, consider making a <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=UYJ5G65M6ZA28" target="_blank">donation</a> :)</p>
2
  $help_overview_text=<<<EOD
3
 
4
  <p>
5
+ <strong>Page scroll to id</strong> is a fully featured plugin for creating links that scroll the page smoothly to any id within the document.
6
  </p>
7
 
8
  <p>
9
+ The plugin replaces browser's "jumping" behavior with a smooth scrolling animation, when links with href value containing <code>#</code> are clicked. <br />
10
+ It provides all the basic tools and advanced functionality for single-page websites, in-page navigation, back-to-top links etc. with features like: adjustable scrolling animation duration and easing, link and target highlighting via ready-to-use CSS classes, vertical and/or horizontal scrolling, scrolling from/to different pages etc.
11
  </p>
12
 
13
  <p>If you like this plugin and find it useful, consider making a <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=UYJ5G65M6ZA28" target="_blank">donation</a> :)</p>
includes/help/plugin-settings.inc CHANGED
@@ -1,114 +1,75 @@
1
  <?php
2
  $help_plugin_settings_text=<<<EOD
3
 
4
- <p>
5
- <strong>Selector(s)</strong> -
6
- The matching set of elements handled by the plugin (<a href="http://www.w3.org/TR/css3-selectors/" target="_blank">strings that represent ways of choosing elements in the DOM</a>). These should be anchor tags (links) with an href value in the form of <code>#id</code>. <br />
7
- Each selector is separated by comma, so multiple matching sets of elements can be defined as: <code>selector1, selector2, selector3</code> etc. <br />
8
- The default selector value is <code>a[rel='m_PageScroll2id']</code>, meaning the plugin is applied to all anchor elements with <code>m_PageScroll2id</code> rel attribute value. <br />
9
- Other examples: <code>a[href*='#']</code> (anchors that contain <code>#</code> in their href attribute), <code>a[href='#top']</code> (anchors with href attribute value: <code>#top</code>), <code>a.className</code> (anchors with class: <code>className</code>).
10
- </p>
11
-
12
- <p>
13
- Other default selectors which the plugin is applied automatically include the class <code>ps2id</code> (actual selectors: <code>.ps2id > a[href*='#']</code> and <code>a.ps2id[href*='#']</code>). This means that any link with a hash in its URL/href (e.g. <code>#id</code>) which has the class or is contained (direct children) within an element with the class `ps2id` will be handled by the plugin automatically.
14
- </p>
15
 
16
  <p>
17
- Checking "Enable on WordPress Menu links" enables the plugin on custom links (that contain a hash in their URL) created in WordPress Menus automatically (no need to use XFN and/or class values).
 
 
18
  </p>
19
 
20
  <p>
21
- <strong>Scroll animation speed</strong> -
22
- Sets the duration of scrolling animation in milliseconds. By checking "Auto-adjust animation speed", the duration is adjusted automatically according to target element position and window scroll. This normalizes animation speed in order to avoid short-distance animations that take too long (e.g. a page scrolling of just 100 pixels will last shorter than the value specified above).
 
23
  </p>
24
 
25
  <p>
26
- <strong>Scroll animation easing</strong> -
27
- Sets the easing type of scrolling animation (the speed at which an animation progresses at different points within the animation). <br />
28
- You can set different easing types: one for when page is idle (no animation currently running) and another that applies while page is animating. <br />
29
- <a href="http://api.jqueryui.com/easings/" target="_blank">Visual representation of all easings</a>
30
  </p>
31
 
32
  <p>
33
- <strong>Scroll-to position</strong> -
34
- Adjusts automatically the scroll-to position so it does not exceed document length. For example, when scrolling to a target element that sits at the bottom of the document, the animation stops smoothly at bottom of the page, instead of breaking at an earlier point.
 
35
  </p>
36
 
37
  <p>
38
- <strong>Page layout</strong> -
39
- Defines the page scrolling axis. Selecting <code>vertical</code> will scroll the page in the y axis (top-bottom only), while <code>horizontal</code> will scroll the page in the x axis (left-right only). To scroll both axis simultaneously select <code>auto</code>.
40
  </p>
41
 
42
  <p>
43
- <strong>Offset</strong> -
44
- Defines the amount of pixels to offset the scroll-to position. The value can a be a positive or negative number, or a matching element in your html. For example, setting Offset to 50 will stop page scrolling 50 pixels before reaching the target. <br />
45
- If you need to offset scroll-to position accoring to the height or width of some element (e.g. accoring to a responsive, fixed-positioned navigation menu), insert its selector in the Offset field. For example, if you have a fixed menu with id <code>navigation-menu</code>, set Offset to <code>#navigation-menu</code> in order to stop page scrolling below it and avoid overlapping your content. <br />
46
- To set different vertical and horizontal offsets (e.g. when Layout is set to auto), add comma seperated values in Offset field, e.g. <code>100,50</code> (vertical offset 100, horizontal offset 50). <br />
47
- You may also define link specific offsets by using the <code>ps2id</code> shortcode in your content, e.g. <code>[ps2id url='#id' offset='100']link[/ps2id]</code>.
48
- </p>
49
-
50
- <p>
51
- The plugin offers few extra selector expressions in order to define more advanced offsets. Examples:
52
- </p>
53
-
54
- <ul>
55
- <li>Offset by element with id "some-id" and CSS position fixed: <code>#some-id:fixed</code> </li>
56
- <li>Offset by element with class "class-name" and height equal to 100 pixels: <code>.class-name:height(100)</code> </li>
57
- <li>Offset by element with id "some-id" and width greater than 800 pixels: <code>#some-id:width(>800)</code> </li>
58
- <li>Offset by element with id "some-id", CSS position fixed and height between 50 and 100 pixels: <code>#some-id:fixed:height(>50):height(<100)</code> </li>
59
- </ul>
60
-
61
- <p>
62
- <strong>Highlight selector(s)</strong> -
63
- The matching set of elements already handled by the plugin (defined in Selector(s) field) that will be highlighted. <br />
64
- The plugin adds a class (specified in Classes fields) on the links whose target elements are considered to be within the viewport. Highlight selector(s) specifies those links. <br />
65
- Leaving the field empty (also the default setting), all selectors specified in Selector(s) field are eligible for highlighting. In case you need to highlight only a specific selector (e.g. your navigation menu links but not back-to-top links etc.), you should enter those selector(s) (e.g. <code>.menu-item a[rel='m_PageScroll2id']</code>).
66
- </p>
67
-
68
- <p>
69
- <strong>Classes</strong> -
70
- Set the classes added to links and targets by the plugin:
71
- </p>
72
-
73
- <ol>
74
- <li>The class name for the link that's been clicked </li>
75
- <li>The class name for the (current) target element </li>
76
- <li>The class name for the (current) highlighted link </li>
77
- </ol>
78
-
79
- <p>
80
- In addition, the plugin will add the above classes with the <code>-first</code> and <code>-last</code> suffix (e.g. <code>mPS2id-highlight-first</code>, <code>mPS2id-highlight-last</code>) in order to differentiate multiple highlighted elements. This is useful when you need to style only the first or last of the highlighted links or targets in your CSS.
81
  </p>
82
 
83
  <p>
84
- By checking "Force single highlight", only one highlighted element (the first one) is allowed at a time.
 
85
  </p>
86
 
87
  <p>
88
- Check "Keep highlight until next" when you need to keep the current element highlighted until the next one comes into view. This way at least one element always stays highlighted.
 
 
 
 
89
  </p>
90
 
91
  <p>
92
- Check "Highlight by next target" when your target elements have zero height and/or width to enable better highlighting. This option is similar to "Keep highlight until next" but it's especially useful when your target elements are in the form of <code>&lt;a id='id'&gt;&lt;/a&gt;</code>.
 
 
93
  </p>
94
 
95
  <p>
96
- <strong>Scroll to location hash</strong> -
97
- Scrolls to target id (e.g. <code>&lt;div id="id" /&gt;</code>) based on location hash (e.g. <code>mysite.com/mypage#id</code>) on page load. <br />
98
- Enable when you need to scroll to an id in another page. <br />
99
- By default, this option will only work for target elements that are handled by the plugin (e.g. are connected to a link which scrolls the page via "Page scroll to id"). To enable the option for all targets (even for elements that are not handled by the plugin) check "Enable for all targets". <br />
100
- To set an animation delay for "Scroll to location hash", use the "Delay" field and set a value which represents milliseconds (default value is 0 meaning no delay). For example, a value of <code>500</code> will delay page scrolling by half a second after the page has loaded.
101
  </p>
102
 
103
  <p>
104
- <strong>Disable plugin below screen-size</strong> -
105
- Set a minimum width and/or height screen-size (in pixels) that's required for the plugin to be enabled. For example, insert <code>1024</code> to disable plugin functionality when window width is below 1024 pixels or <code>1024,600</code> to disable plugin when window width/height is below 1024 and 600 pixels respectively. Leave field value empty or set to 0 to disable.<br />
 
106
  </p>
107
 
108
  <p>
109
- <strong>Administration</strong> -
110
- Check "Display widgets id attribute" in order to Show the id attribute of each widget in Appearance &rarr; Widgets. This is a convenient way of finding existing id attributes to use as targets on your links.
111
- "Enable insert link/target buttons in post visual editor" allows the insertion of plugin's shortcodes via buttons in WordPress post/page editor. <br />
112
  </p>
113
 
114
  EOD;
1
  <?php
2
  $help_plugin_settings_text=<<<EOD
3
 
4
+ <p><em>Click an option to visit plugin's documentation for additional info and guides</em>.</p>
 
 
 
 
 
 
 
 
 
 
5
 
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 &rarr; Menus).
10
  </p>
11
 
12
  <p>
13
+ <a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#plugin-settings-scroll-duration" target="_blank"><strong>Scroll duration</strong></a> -
14
+ Scroll animation duration (i.e. scrolling speed) in milliseconds (1000 milliseconds equal 1 second). Lower values equal faster scrolling. <br />
15
+ <a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#plugin-settings-auto-adjust-scrolling-duration" target="_blank">Auto-adjust scrolling duration</a> instructs the plugin to fine-tune scrolling duration/speed according to target and page scroll position.
16
  </p>
17
 
18
  <p>
19
+ <a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#plugin-settings-scroll-type-easing" target="_blank"><strong>Scroll type/easing</strong></a> -
20
+ Scroll animation easing type (i.e. the way the animation progresses at different points within its duration). <a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#ps2id-duration-easings-demo" target="_blank">Click here to see a visual representation &amp; demo of all easing types</a>. <br />
 
 
21
  </p>
22
 
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>
30
+ <a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#plugin-settings-page-layout" target="_blank"><strong>Page layout</strong></a> -
31
+ Set page scrolling direction (i.e. restrict scrolling) to top-bottom (vertical) or left-right (horizontal) accordingly.
32
  </p>
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>
40
+ <a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#plugin-settings-highlight-selectors" target="_blank"><strong>Highlight selector(s)</strong></a> -
41
+ The matching set of elements (i.e. selectors) handled by the plugin, that will be eligible for highlighting. The value(s) should be anchor tags (<code>a</code>, i.e. links).
42
  </p>
43
 
44
  <p>
45
+ <a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#plugin-settings-classes-highlight" target="_blank"><strong>Classes &amp; highlight options</strong></a> -
46
+ The plugin adds special classes to the links and the target elements it handles according to user action and page scrolling position. You can change the clicked link class, as well as the highlight classes for links and targets. <br />
47
+ Enable <a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#plugin-settings-force-single-highlight" target="_blank">Allow only one highlighted element at a time</a> to prevent multiple elements from being highlighted at the same time. <br />
48
+ Enable <a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#plugin-settings-keep-highlight-until-next" target="_blank">Keep the current element highlighted until the next one comes into view</a> when you need to keep at least one element (e.g. a menu link) always highlighted. <br />
49
+ Enable <a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#plugin-settings-highlight-by-next-target" target="_blank">Highlight by next target</a> to highlight elements according to the next adjucent element from the actual target (useful when target elements have zero dimensions).
50
  </p>
51
 
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>
59
+ <a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#plugin-settings-disable-plugin-below" target="_blank"><strong>Disable plugin below</strong></a> -
60
+ Set the viewport/screen-size in pixels, below which the plugin will be disabled. The value can be <code>width</code> (e.g. <code>1024</code>) or <code>width,height</code> (e.g. <code>1024,600</code>).
 
 
 
61
  </p>
62
 
63
  <p>
64
+ <a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#plugin-settings-administration" target="_blank"><strong>Administration</strong></a> -
65
+ Check <a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#plugin-settings-display-widgets-id" target="_blank">Display widgets id attribute</a> to have the id attribute value of each widget (in Appearance &rarr; Widgets) displayed within its panel. <br />
66
+ <a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#plugin-settings-post-editor-buttons" target="_blank">Enable insert link/target buttons in post visual editor</a> activates plugin’s buttons in WordPress visual editor toolbar.
67
  </p>
68
 
69
  <p>
70
+ <a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#plugin-settings-advanced" target="_blank"><strong>Advanced options</strong></a> -
71
+ If another plugin or a theme script handles page scrolling and conflicts with "Page scroll to id", try enabling <a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#plugin-settings-remove-other-click-events" target="_blank">Prevent other scripts from handling plugin’s links</a> option. <br />
72
+ Enable <a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#plugin-settings-advanced-normalize-targets" target="_blank">Normalize anchor-point targets</a> to normalize/reset the CSS properties (height, line-height, border etc.) of anchor-point targets.
73
  </p>
74
 
75
  EOD;
includes/help/shortcodes.inc CHANGED
@@ -1,66 +1,49 @@
1
  <?php
2
  $help_shortcodes_text=<<<EOD
3
 
4
- <p>
5
- Plugin's shortcodes can be inserted directly in WordPress post editor (as with any WordPress shortcode) or via the buttons "Insert Page scroll to id link" and "Insert Page scroll to id target" in visual editor toolbar.
6
- </p>
7
 
8
  <p>
9
- <strong>Create link</strong> - <code>[ps2id url='#id' offset='0']link[/ps2id]</code>
10
  </p>
11
 
12
  <p>
13
- <strong>Create link shrotcode attributes</strong>
14
  </p>
15
 
16
  <ul>
17
  <li>
18
- <code>url</code> - link URL (the target element id the link points to) <br />
19
- Examples: <br />
20
- <code>[ps2id url='#some-id']link[/ps2id]</code> <br />
21
- <code>[ps2id url='http://somesite.com/somepage/#some-id']link[/ps2id]</code>
22
  </li>
23
  <li>
24
- <code>offset</code> - link specific offset <br />
25
- Examples: <br />
26
- <code>[ps2id url='#id' offset='100']link[/ps2id]</code> - offset by 100 pixels <br />
27
- <code>[ps2id url='#id' offset='#navigation-menu']link[/ps2id]</code> - offset by element's height/width/position <br />
28
- <code>[ps2id url='#id' offset='{"y":"100","x":"50"}']link[/ps2id]</code> - offset vertically by 100 pixels and horizontally by 50
 
 
29
  </li>
30
  </ul>
31
 
32
  <p>
33
- <strong>Create target</strong> - <code>[ps2id id='id' target=''/]</code>
34
  </p>
35
 
36
  <p>
37
- <strong>Create target shrotcode attributes</strong>
38
  </p>
39
 
40
  <ul>
41
  <li>
42
- <code>id</code> - target element id <br />
43
- Examples: <br />
44
- <code>[ps2id id='some-id'/]</code>
45
  </li>
46
  <li>
47
- <code>target</code> (optional) - the element that will be considered as the actual target (useful when you need proper highlighting with targets that have zero dimensions) <br />
48
- Examples: <br />
49
- <code>[ps2id id='some-id' target='#id + div'/]</code> - set the target as the next div from the #some-id element <br />
50
- <code>[ps2id id='some-id' target='#another-id'/]</code> - set the target as the element with id: another-id
51
  </li>
52
  </ul>
53
 
54
- <p>
55
- <strong>Create target wrapper</strong> - <code>[ps2id_wrap id='id'] content... [/ps2id_wrap]</code>
56
- </p>
57
-
58
- <p>
59
- Examples: <br />
60
- <code>[ps2id_wrap id='some-id'] content... [/ps2id_wrap]</code> <br />
61
- <code>[ps2id_wrap id='another-id'] content... [ps2id url='#id']link[/ps2id] [/ps2id_wrap]</code>
62
- </p>
63
-
64
  EOD;
65
  ?>
66
 
1
  <?php
2
  $help_shortcodes_text=<<<EOD
3
 
4
+ <p>Plugin's <code>[ps2id]</code> shortcode can be inserted directly in WordPress post editor (as with any WordPress shortcode) in order to create links and id targets in your content.</p>
 
 
5
 
6
  <p>
7
+ <a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#plugin-shortcodes-link" target="_blank"><strong>Link shortcode</strong></a> - <code>[ps2id url='#some-id']link text[/ps2id]</code>
8
  </p>
9
 
10
  <p>
11
+ <strong>Attributes</strong>
12
  </p>
13
 
14
  <ul>
15
  <li>
16
+ <a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#plugin-shortcodes-link-url" target="_blank">url</a> (required) - Link URL
 
 
 
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 />
24
+ You can give the link one or more custom classes, e.g. <code>[ps2id url='#some-id' class='class-a class-b']link text[/ps2id]</code> <br />
25
+ Adding a special class in the form of <code>ps2id-speed-VALUE</code>, will change the scroll duration/speed of that link. For example, <code>[ps2id url='#some-id' class='ps2id-speed-400']link text[/ps2id]</code> will set link's scroll duration to 400 milliseconds.</code>
26
  </li>
27
  </ul>
28
 
29
  <p>
30
+ <a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#plugin-shortcodes-target" target="_blank"><strong>Target id shortcode</strong></a> - <code>[ps2id id='some-id'/]</code> (anchor-point target) or <code>[ps2id_wrap id='some-id'] your content... [/ps2id_wrap]</code> (wrapper target)
31
  </p>
32
 
33
  <p>
34
+ <strong>Attributes</strong>
35
  </p>
36
 
37
  <ul>
38
  <li>
39
+ <a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#plugin-shortcodes-target-id" target="_blank">id</a> (required) - Target id
 
 
40
  </li>
41
  <li>
42
+ <a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#plugin-shortcodes-target-target" target="_blank">target</a> (optional) - The element that’ll be considered as the actual target for highlighting <br />
43
+ Examples: <code>[ps2id id='some-id' target='#some-id + div'/]</code> (the associated link will scroll to <code>#some-id</code> element but will be highlighted as if its target is the next adjacent div, i.e. the div immediately following <code>#some-id</code> element)
 
 
44
  </li>
45
  </ul>
46
 
 
 
 
 
 
 
 
 
 
 
47
  EOD;
48
  ?>
49
 
includes/help/sidebar.inc CHANGED
@@ -4,9 +4,9 @@ $help_sidebar_text=<<<EOD
4
  <p><strong>For more information</strong></p>
5
 
6
  <ul>
7
- <li><a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress-tutorial/" target="_blank">Page scroll to id for WordPress tutorial</a></li>
8
- <li><a href="http://manos.malihu.gr/page-scroll-to-id" target="_blank">Plugin homepage</a></li>
9
- <li><a href="http://manos.malihu.gr/page-scroll-to-id/2/" target="_blank">Code examples &amp; short tutorials</a></li>
10
  </ul>
11
 
12
  EOD;
4
  <p><strong>For more information</strong></p>
5
 
6
  <ul>
7
+ <li><a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/" target="_blank">Plugin homepage &amp; documentation</a></li>
8
+ <li><a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/2/" target="_blank">Knowledge Base – FAQ</a></li>
9
+ <li><a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress-tutorial/" target="_blank">Basic tutorial</a></li>
10
  </ul>
11
 
12
  EOD;
includes/malihu-pagescroll2id-tinymce.js CHANGED
@@ -1,31 +1,84 @@
1
  (function(){
2
  tinymce.PluginManager.add("ps2id_tinymce_custom_button",function(editor,url){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  editor.addButton("ps2id_tinymce_custom_button_link",{
4
  icon:"icon ps2id-custom-icon-link",
5
- title:"Insert Page scroll to id link",
6
  onclick:function(){
7
- editor.windowManager.open({
8
- title:"Insert Page scroll to id link",body:[
9
- {type:"textbox",name:"ps2idurlid",label:"URL/id (e.g. #my-id)"},
10
- {type:"textbox",name:"ps2idtext",label:"Link Text"},
11
- {type:"textbox",name:"ps2idoffset",label:"Offset (optional)"}
12
- ],
13
- onsubmit:function(e){
14
- editor.insertContent("[ps2id url='"+e.data.ps2idurlid+"' offset='"+e.data.ps2idoffset+"']"+e.data.ps2idtext+"[/ps2id]");
15
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  });
17
- }
 
 
 
 
 
 
18
  });
19
  editor.addButton("ps2id_tinymce_custom_button_target",{
20
  icon:"icon ps2id-custom-icon-target",
21
  title:"Insert Page scroll to id target",
22
  onclick:function(){
23
  editor.windowManager.open({
24
- title:"Insert Page scroll to id target",body:[
25
  {type:"textbox",name:"ps2idid",label:"id (e.g. my-id)"},
26
- {type:"textbox",name:"ps2idtarget",label:"Highlight target selector (optional)"}
27
  ],
28
  onsubmit:function(e){
 
 
 
 
29
  editor.insertContent("[ps2id id='"+e.data.ps2idid+"' target='"+e.data.ps2idtarget+"'/]");
30
  }
31
  });
1
  (function(){
2
  tinymce.PluginManager.add("ps2id_tinymce_custom_button",function(editor,url){
3
+ editor.addCommand("ps2id_tinymce_custom_button_link_popup",function(ui,v){
4
+ editor.windowManager.open({
5
+ title:"Page scroll to id link",body:[
6
+ {type:"container",name:"ps2idlinkcontainer",html:"<p class='howto'>Enter the link URL/id and text</p>"},
7
+ {type:"textbox",name:"ps2idurlid",label:"URL/id (e.g. #my-id)",value:v.f_url || "",tooltip:"e.g. http://mysite.com/#my-id or #my-id"},
8
+ {type:"textbox",name:"ps2idtext",label:"Link Text",value:v.f_txt || ""},
9
+ {type:"container",name:"ps2idlinkcontainer2",html:"<p class='howto'>Optional: enter a link-specific offset and/or your own custom class(es)</p>"},
10
+ {type:"textbox",name:"ps2idoffset",label:"Offset",value:v.f_offset ? unescape(v.f_offset).replace(/&gt;/g, '>') : "",tooltip:"Set an offset to bypass plugin's general offset value"},
11
+ {type:"container",name:"ps2idlinkcontainer3",html:"<p class='howto'>You can change the scroll duration/speed of the link by adding a <br />special class in the form of ps2id-speed-VALUE (i.e. ps2id-speed-600) <br />with value indicating the duration in milliseconds</p>"},
12
+ {type:"textbox",name:"ps2idclass",label:"Custom class(es)",value:v.f_class ? unescape(v.f_class) : "",tooltip:"Separate multiple classes with space (e.g. class-a class-b)"},
13
+ {type:"container",name:"ps2idlinkcontainer4",html:v.f_sccheck ? "<p class='howto'>Check the box below to transform the link to plain/text shortcode <br />(removes the ability to edit the link via this form)</p>" : "<p class='howto'>Check the box below to insert the link as plain/text shortcode in the editor</p>"},
14
+ {type:"checkbox",name:"ps2idshortcode",label:v.f_sccheck ? "Change to shortcode" : "Insert as shortcode"}
15
+ ],
16
+ onsubmit:function(e){
17
+ if(e.data.ps2idurlid=="" || e.data.ps2idtext==""){
18
+ editor.windowManager.alert("URL/id and Link Text cannot be empty!", function(){});
19
+ return false;
20
+ }
21
+ if(v.edit_node){
22
+ v.edit_node.parentNode.removeChild(v.edit_node);
23
+ }
24
+ if(e.data.ps2idshortcode){
25
+ editor.insertContent("[ps2id url='"+e.data.ps2idurlid+"' offset='"+e.data.ps2idoffset+"' class='"+e.data.ps2idclass+"']"+e.data.ps2idtext+"[/ps2id]");
26
+ }else{
27
+ editor.insertContent("<a href='"+e.data.ps2idurlid+"' data-ps2id-offset='"+e.data.ps2idoffset+"' class='"+(e.data.ps2idclass ? e.data.ps2idclass+" _ps2id" : "_ps2id")+"'>"+e.data.ps2idtext+"</a>");
28
+ }
29
+ }
30
+ });
31
+ });
32
  editor.addButton("ps2id_tinymce_custom_button_link",{
33
  icon:"icon ps2id-custom-icon-link",
34
+ title:"Insert/edit Page scroll to id link",
35
  onclick:function(){
36
+ var t=tinyMCE.activeEditor.selection.getNode(),s=tinyMCE.activeEditor.selection.getContent({format:"html"}),
37
+ edit_node_v=null,f_url_v=null,f_txt_v=null,f_offset_v=null,f_class_v=null,f_sccheck_v=null;
38
+ if(t.nodeName.toLowerCase()==="a"){
39
+ edit_node_v=t;
40
+ if(t.className.indexOf("_ps2id")>-1){
41
+ f_offset_v=t.attributes["data-ps2id-offset"] ? t.attributes["data-ps2id-offset"].value : "";
42
+ f_class_v=t.attributes["class"] ? t.attributes["class"].value.replace("_ps2id","") : "";
43
+ f_sccheck_v=true;
44
  }
45
+ f_url_v=t.attributes["href"].value;
46
+ f_txt_v=t.innerHTML;
47
+ }else{
48
+ if(s && s.length>0){
49
+ f_txt_v=s;
50
+ }
51
+ }
52
+ editor.execCommand("ps2id_tinymce_custom_button_link_popup","",{
53
+ edit_node: edit_node_v,
54
+ f_url: f_url_v,
55
+ f_txt: f_txt_v,
56
+ f_offset: f_offset_v,
57
+ f_class: f_class_v,
58
+ f_sccheck: f_sccheck_v
59
  });
60
+ },
61
+ onPostRender:function(){
62
+ ctrl=this,
63
+ editor.on("NodeChange",function(e){
64
+ ctrl.active(e.element.className.indexOf("_ps2id")>-1);
65
+ });
66
+ }
67
  });
68
  editor.addButton("ps2id_tinymce_custom_button_target",{
69
  icon:"icon ps2id-custom-icon-target",
70
  title:"Insert Page scroll to id target",
71
  onclick:function(){
72
  editor.windowManager.open({
73
+ title:"Page scroll to id target",body:[
74
  {type:"textbox",name:"ps2idid",label:"id (e.g. my-id)"},
75
+ {type:"textbox",name:"ps2idtarget",label:"Highlight target selector (optional)",tooltip:"Enter the element that will be considered as the actual target for highlighting"}
76
  ],
77
  onsubmit:function(e){
78
+ if(e.data.ps2idid=="" || e.data.ps2idid.indexOf("#")>-1){
79
+ editor.windowManager.alert("id cannot be empty and should not contain a hash (#)!", function(){});
80
+ return false;
81
+ }
82
  editor.insertContent("[ps2id id='"+e.data.ps2idid+"' target='"+e.data.ps2idtarget+"'/]");
83
  }
84
  });
js/jquery.malihu.PageScroll2id-init.js CHANGED
@@ -23,23 +23,25 @@
23
  return val;
24
  }
25
  },
 
 
 
 
 
 
 
 
26
  autoSelectors="a[data-ps2id-api='true'][href*='#'],.ps2id > a[href*='#'],a.ps2id[href*='#']";
27
  $(document).ready(function(){
28
  for(var k=0; k<_o.total_instances; k++){
29
  //scroll to location hash on page load
30
- if(_o.instances[_p+"_instance_"+k]["scrollToHash"]["value"]==="true" && _hash){
31
- $(_o.instances[_p+"_instance_"+k]["selector"]["value"]+",."+shortcodeClass+","+autoSelectors).each(function(){
32
  $(this).data(_p+"Element",true);
33
  });
34
- if(_validateLocHash(_hash,_o.instances[_p+"_instance_"+k]["scrollToHashForAll"]["value"]==="true")){
35
- var href=window.location.href.replace(/#.*$/,"#"),
36
- layout=_o.instances[_p+"_instance_"+k]["layout"]["value"];
37
- if(layout!=="horizontal"){
38
- $(window).scrollTop(0); //stop jump to hash straight away
39
- }
40
- if(layout!=="vertical"){
41
- $(window).scrollLeft(0); //stop jump to hash straight away
42
- }
43
  if(window.history && window.history.replaceState){
44
  window.history.replaceState("","",href);
45
  }else{
@@ -49,28 +51,31 @@
49
  }
50
  }
51
  });
52
- $(window).load(function(){
53
  for(var i=0; i<_o.total_instances; i++){
54
- $(_o.instances[_p+"_instance_"+i]["selector"]["value"]+",."+shortcodeClass+","+autoSelectors).mPageScroll2id({
55
- scrollSpeed:_o.instances[_p+"_instance_"+i]["scrollSpeed"]["value"],
56
- autoScrollSpeed:(_o.instances[_p+"_instance_"+i]["autoScrollSpeed"]["value"]==="true") ? true : false,
57
- scrollEasing:_o.instances[_p+"_instance_"+i]["scrollEasing"]["value"],
58
- scrollingEasing:_o.instances[_p+"_instance_"+i]["scrollingEasing"]["value"],
59
- pageEndSmoothScroll:(_o.instances[_p+"_instance_"+i]["pageEndSmoothScroll"]["value"]==="true") ? true : false,
60
- layout:_o.instances[_p+"_instance_"+i]["layout"]["value"],
61
- offset:_offset(_o.instances[_p+"_instance_"+i]["offset"]["value"].toString()),
62
- highlightSelector:_o.instances[_p+"_instance_"+i]["highlightSelector"]["value"],
63
- clickedClass:_o.instances[_p+"_instance_"+i]["clickedClass"]["value"],
64
- targetClass:_o.instances[_p+"_instance_"+i]["targetClass"]["value"],
65
- highlightClass:_o.instances[_p+"_instance_"+i]["highlightClass"]["value"],
66
- forceSingleHighlight:(_o.instances[_p+"_instance_"+i]["forceSingleHighlight"]["value"]==="true") ? true : false,
67
- keepHighlightUntilNext:(_o.instances[_p+"_instance_"+i]["keepHighlightUntilNext"]["value"]==="true") ? true : false,
68
- highlightByNextTarget:(_o.instances[_p+"_instance_"+i]["highlightByNextTarget"]["value"]==="true") ? true : false,
69
- disablePluginBelow:_screen(_o.instances[_p+"_instance_"+i]["disablePluginBelow"]["value"].toString())
 
 
70
  });
71
  //scroll to location hash on page load
72
- if(_o.instances[_p+"_instance_"+i]["scrollToHash"]["value"]==="true" && _hash){
73
- if(_validateLocHash(_hash,_o.instances[_p+"_instance_"+i]["scrollToHashForAll"]["value"]==="true")){
 
74
  setTimeout(function(){
75
  $.mPageScroll2id("scrollTo",_hash);
76
  if(window.history && window.history.replaceState){
@@ -78,9 +83,38 @@
78
  }else{
79
  window.location.hash=_hash;
80
  }
81
- },_o.instances[_p+"_instance_"+i]["scrollToHashDelay"]["value"]);
82
  }
83
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  }
85
  });
86
  //extend jQuery's selectors
23
  return val;
24
  }
25
  },
26
+ _toTop=function(layout){
27
+ if(layout!=="horizontal"){
28
+ $(window).scrollTop(0); //stop jump to hash straight away
29
+ }
30
+ if(layout!=="vertical"){
31
+ $(window).scrollLeft(0); //stop jump to hash straight away
32
+ }
33
+ },
34
  autoSelectors="a[data-ps2id-api='true'][href*='#'],.ps2id > a[href*='#'],a.ps2id[href*='#']";
35
  $(document).ready(function(){
36
  for(var k=0; k<_o.total_instances; k++){
37
  //scroll to location hash on page load
38
+ if(_o.instances[_p+"_instance_"+k]["scrollToHash"]==="true" && _hash){
39
+ $(_o.instances[_p+"_instance_"+k]["selector"]+",."+shortcodeClass+","+autoSelectors).each(function(){
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);
47
  }else{
51
  }
52
  }
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,
60
+ scrollEasing:_o.instances[_p+"_instance_"+i]["scrollEasing"],
61
+ scrollingEasing:_o.instances[_p+"_instance_"+i]["scrollingEasing"],
62
+ pageEndSmoothScroll:(_o.instances[_p+"_instance_"+i]["pageEndSmoothScroll"]==="true") ? true : false,
63
+ layout:_o.instances[_p+"_instance_"+i]["layout"],
64
+ offset:_offset(_o.instances[_p+"_instance_"+i]["offset"].toString()),
65
+ highlightSelector:_o.instances[_p+"_instance_"+i]["highlightSelector"],
66
+ clickedClass:_o.instances[_p+"_instance_"+i]["clickedClass"],
67
+ targetClass:_o.instances[_p+"_instance_"+i]["targetClass"],
68
+ highlightClass:_o.instances[_p+"_instance_"+i]["highlightClass"],
69
+ forceSingleHighlight:(_o.instances[_p+"_instance_"+i]["forceSingleHighlight"]==="true") ? true : false,
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
  $.mPageScroll2id("scrollTo",_hash);
81
  if(window.history && window.history.replaceState){
83
  }else{
84
  window.location.hash=_hash;
85
  }
86
+ },_o.instances[_p+"_instance_"+i]["scrollToHashDelay"]);
87
  }
88
  }
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") sel.off("click",handler.handler);
97
+ }
98
+ }
99
+ },300);
100
+ }
101
+ //force zero dimensions on anchor-point targets (firefox fix)
102
+ if(_o.instances[_p+"_instance_"+i]["normalizeAnchorPointTargets"]==="true"){
103
+ $("a._mPS2id-t[id]:empty").css({
104
+ "display":"inline-block",
105
+ "line-height":0,
106
+ "width": 0,
107
+ "height": 0,
108
+ "border": "none"
109
+ });
110
+ }
111
+ //stop scroll on mouse-wheel, touch-swipe etc.
112
+ if(_o.instances[_p+"_instance_"+i]["stopScrollOnUserAction"]==="true"){
113
+ $(document).on("mousewheel DOMMouseScroll touchmove",function(){
114
+ var el=$("html,body");
115
+ if(el.is(":animated")) el.stop();
116
+ });
117
+ }
118
  }
119
  });
120
  //extend jQuery's selectors
js/jquery.malihu.PageScroll2id.js CHANGED
@@ -1,2 +1,774 @@
1
- /* == Page scroll to id == Version: 1.5.4, License: MIT License (MIT) */
2
- !function(e,t,a,n){var l,s,i,r,o,c,u,g,h,f,d,p="mPageScroll2id",_="mPS2id",C=".m_PageScroll2id,a[rel~='m_PageScroll2id'],.page-scroll-to-id,a[rel~='page-scroll-to-id'],._ps2id",v={scrollSpeed:1300,autoScrollSpeed:!0,scrollEasing:"easeInOutExpo",scrollingEasing:"easeInOutCirc",pageEndSmoothScroll:!0,layout:"vertical",offset:0,highlightSelector:!1,clickedClass:_+"-clicked",targetClass:_+"-target",highlightClass:_+"-highlight",forceSingleHighlight:!1,keepHighlightUntilNext:!1,highlightByNextTarget:!1,disablePluginBelow:!1,clickEvents:!0,onStart:function(){},onComplete:function(){},defaultSelector:!1,live:!0},m=0,I={init:function(n){var n=e.extend(!0,{},v,n);if(e(a).data(_,n),s=e(a).data(_),!this.selector){var c="__"+_;this.each(function(){var t=e(this);t.hasClass(c)||t.addClass(c)}),this.selector="."+c}l=l?l+","+this.selector:this.selector,s.defaultSelector&&("object"!=typeof e(l)||0===e(l).length)&&(l=C),s.clickEvents&&e(a).undelegate("."+_).delegate(l,"click."+_,function(t){if(O._isDisabled.call(null))return void O._removeClasses.call(null);var a=e(this),n=a.attr("href"),l=a.prop("href");n&&-1!==n.indexOf("#/")||(O._reset.call(null),f=a.data("ps2id-offset")||0,O._isValid.call(null,n,l)&&O._findTarget.call(null,n)&&(t.preventDefault(),r="selector",o=a,O._setClasses.call(null,!0),O._scrollTo.call(null)))}),e(t).unbind("."+_).bind("scroll."+_+" resize."+_,function(){if(O._isDisabled.call(null))return void O._removeClasses.call(null);var t=e("._"+_+"-t");t.each(function(a){var n=e(this),l=n.attr("id"),s=O._findHighlight.call(null,l);O._setClasses.call(null,!1,n,s),a==t.length-1&&O._extendClasses.call(null)})}),i=!0,O._setup.call(null),O._live.call(null)},scrollTo:function(t,a){if(O._isDisabled.call(null))return void O._removeClasses.call(null);if(t&&"undefined"!=typeof t){O._isInit.call(null);var n={layout:s.layout,offset:s.offset,clicked:!1},a=e.extend(!0,{},n,a);O._reset.call(null),g=a.layout,h=a.offset,t=-1!==t.indexOf("#")?t:"#"+t,O._isValid.call(null,t)&&O._findTarget.call(null,t)&&(r="scrollTo",o=a.clicked,o&&O._setClasses.call(null,!0),O._scrollTo.call(null))}},destroy:function(){e(t).unbind("."+_),e(a).undelegate("."+_).removeData(_),e("._"+_+"-t").removeData(_),O._removeClasses.call(null,!0)}},O={_isDisabled:function(){var e=t,n="inner",l=s.disablePluginBelow instanceof Array?[s.disablePluginBelow[0]||0,s.disablePluginBelow[1]||0]:[s.disablePluginBelow||0,0];return"innerWidth"in t||(n="client",e=a.documentElement||a.body),e[n+"Width"]<=l[0]||e[n+"Height"]<=l[1]},_isValid:function(e,a){if(e){a=a?a:e;var n=-1!==a.indexOf("#/")?a.split("#/")[0]:a.split("#")[0],l=t.location.toString().split("#")[0];return"#"!==e&&-1!==e.indexOf("#")&&(""===n||n===l)}},_setup:function(){var t=O._highlightSelector(),a=1,n=0;return e(t).each(function(){var l=e(this),i=l.attr("href"),r=l.prop("href");if(O._isValid.call(null,i,r)){var o=-1!==i.indexOf("#/")?i.split("#/")[1]:i.split("#")[1],c=e("#"+o);if(c.length>0){s.highlightByNextTarget&&c!==n&&(n?n.data(_,{tn:c}):c.data(_,{tn:"0"}),n=c),c.hasClass("_"+_+"-t")||c.addClass("_"+_+"-t"),c.data(_,{i:a}),l.hasClass("_"+_+"-h")||l.addClass("_"+_+"-h");var u=O._findHighlight.call(null,o);O._setClasses.call(null,!1,c,u),m=a,a++,a==e(t).length&&O._extendClasses.call(null)}}})},_highlightSelector:function(){return s.highlightSelector&&""!==s.highlightSelector?s.highlightSelector:l},_findTarget:function(t){var a=-1!==t.indexOf("#/")?t.split("#/")[1]:t.split("#")[1],n=e("#"+a);if(n.length<1||"fixed"===n.css("position")){if("top"!==a)return;n=e("body")}return c=n,g||(g=s.layout),h=O._setOffset.call(null),u=[(n.offset().top-h[0]).toString(),(n.offset().left-h[1]).toString()],u[0]=u[0]<0?0:u[0],u[1]=u[1]<0?0:u[1],u},_setOffset:function(){h||(h=s.offset?s.offset:0),f&&(h=f);var t,a,n,l;switch(typeof h){case"object":case"string":t=[h.y?h.y:h,h.x?h.x:h],a=[t[0]instanceof jQuery?t[0]:e(t[0]),t[1]instanceof jQuery?t[1]:e(t[1])],a[0].length>0?(n=a[0].height(),"fixed"===a[0].css("position")&&(n+=a[0][0].offsetTop)):n=!isNaN(parseFloat(t[0]))&&isFinite(t[0])?parseInt(t[0]):0,a[1].length>0?(l=a[1].width(),"fixed"===a[1].css("position")&&(l+=a[1][0].offsetLeft)):l=!isNaN(parseFloat(t[1]))&&isFinite(t[1])?parseInt(t[1]):0;break;case"function":t=h.call(null),t instanceof Array?(n=t[0],l=t[1]):n=l=t;break;default:n=l=parseInt(h)}return[n,l]},_findHighlight:function(a){var n=t.location.toString().split("#")[0],l=e("._"+_+"-h[href='#"+a+"']"),s=e("._"+_+"-h[href='"+n+"#"+a+"']"),i=e("._"+_+"-h[href='#/"+a+"']"),r=e("._"+_+"-h[href='"+n+"#/"+a+"']");return l=l.length>0?l:s,i=i.length>0?i:r,i.length>0?i:l},_setClasses:function(t,a,n){var l=s.clickedClass,i=s.targetClass,r=s.highlightClass;t&&l&&""!==l?(e("."+l).removeClass(l),o.addClass(l)):a&&i&&""!==i&&n&&r&&""!==r&&(O._currentTarget.call(null,a)?(a.addClass(i),n.addClass(r)):(!s.keepHighlightUntilNext||e("."+r).length>1)&&(a.removeClass(i),n.removeClass(r)))},_extendClasses:function(){var t=s.targetClass,a=s.highlightClass,n=e("."+t),l=e("."+a),i=t+"-first",r=t+"-last",o=a+"-first",c=a+"-last";e("._"+_+"-t").removeClass(i+" "+r),e("._"+_+"-h").removeClass(o+" "+c),s.forceSingleHighlight?s.keepHighlightUntilNext&&n.length>1?(n.slice(0,1).removeClass(t),l.slice(0,1).removeClass(a)):(n.slice(1).removeClass(t),l.slice(1).removeClass(a)):(n.slice(0,1).addClass(i).end().slice(-1).addClass(r),l.slice(0,1).addClass(o).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(a){var n=s["target_"+a.data(_).i],l=a.data("ps2id-target"),i=l?e(l)[0].getBoundingClientRect():a[0].getBoundingClientRect();if("undefined"!=typeof n){var r=a.offset().top,o=a.offset().left,c=n.from?n.from+r:r,u=n.to?n.to+r:r,g=n.fromX?n.fromX+o:o,h=n.toX?n.toX+o:o;return i.top>=u&&i.top<=c&&i.left>=h&&i.left<=g}var f=e(t).height(),d=e(t).width(),p=l?e(l).height():a.height(),C=l?e(l).width():a.width(),v=1+p/f,m=v,I=f>p?v*(f/p):v,O=1+C/d,S=O,b=d>C?O*(d/C):O,M=[i.top<=f/m,i.bottom>=f/I,i.left<=d/S,i.right>=d/b];if(s.highlightByNextTarget){var y=a.data(_).tn;if(y){var k=y[0].getBoundingClientRect();"vertical"===s.layout?M=[i.top<=f/2,k.top>f/2,1,1]:"horizontal"===s.layout&&(M=[1,1,i.left<=d/2,k.left>d/2])}}return M[0]&&M[1]&&M[2]&&M[3]},_scrollTo:function(){s.scrollSpeed=parseInt(s.scrollSpeed),u=s.pageEndSmoothScroll?O._pageEndSmoothScroll.call(null):u;var a=e("html,body"),n=s.autoScrollSpeed?O._autoScrollSpeed.call(null):s.scrollSpeed,l=a.is(":animated")?s.scrollingEasing:s.scrollEasing,i=e(t).scrollTop(),r=e(t).scrollLeft();switch(g){case"horizontal":r!=u[1]&&(O._callbacks.call(null,"onStart"),a.stop().animate({scrollLeft:u[1]},n,l).promise().then(function(){O._callbacks.call(null,"onComplete")}));break;case"auto":if(i!=u[0]||r!=u[1])if(O._callbacks.call(null,"onStart"),navigator.userAgent.match(/(iPod|iPhone|iPad|Android)/)){var o;a.stop().animate({pageYOffset:u[0],pageXOffset:u[1]},{duration:n,easing:l,step:function(e,a){"pageXOffset"==a.prop?o=e:"pageYOffset"==a.prop&&t.scrollTo(o,e)}}).promise().then(function(){O._callbacks.call(null,"onComplete")})}else a.stop().animate({scrollTop:u[0],scrollLeft:u[1]},n,l).promise().then(function(){O._callbacks.call(null,"onComplete")});break;default:i!=u[0]&&(O._callbacks.call(null,"onStart"),a.stop().animate({scrollTop:u[0]},n,l).promise().then(function(){O._callbacks.call(null,"onComplete")}))}},_pageEndSmoothScroll:function(){var n=e(a).height(),l=e(a).width(),s=e(t).height(),i=e(t).width();return[n-u[0]<s?n-s:u[0],l-u[1]<i?l-i:u[1]]},_autoScrollSpeed:function(){var n=e(t).scrollTop(),l=e(t).scrollLeft(),i=e(a).height(),r=e(a).width(),o=[s.scrollSpeed+s.scrollSpeed*Math.floor(Math.abs(u[0]-n)/i*100)/100,s.scrollSpeed+s.scrollSpeed*Math.floor(Math.abs(u[1]-l)/r*100)/100];return Math.max.apply(Math,o)},_callbacks:function(e){if(s)switch(this[_]={trigger:r,clicked:o,target:c,scrollTo:{y:u[0],x:u[1]}},e){case"onStart":s.onStart.call(null,this[_]);break;case"onComplete":s.onComplete.call(null,this[_])}},_reset:function(){g=h=f=!1},_isInit:function(){i||I.init.apply(this)},_live:function(){d=setTimeout(function(){s.live?e(O._highlightSelector()).length!==m&&O._setup.call(null):d&&clearTimeout(d),O._live.call(null)},1e3)},_easing:function(){e.easing.easeInQuad=e.easing.easeInQuad||function(e,t,a,n,l){return n*(t/=l)*t+a},e.easing.easeOutQuad=e.easing.easeOutQuad||function(e,t,a,n,l){return-n*(t/=l)*(t-2)+a},e.easing.easeInOutQuad=e.easing.easeInOutQuad||function(e,t,a,n,l){return(t/=l/2)<1?n/2*t*t+a:-n/2*(--t*(t-2)-1)+a},e.easing.easeInCubic=e.easing.easeInCubic||function(e,t,a,n,l){return n*(t/=l)*t*t+a},e.easing.easeOutCubic=e.easing.easeOutCubic||function(e,t,a,n,l){return n*((t=t/l-1)*t*t+1)+a},e.easing.easeInOutCubic=e.easing.easeInOutCubic||function(e,t,a,n,l){return(t/=l/2)<1?n/2*t*t*t+a:n/2*((t-=2)*t*t+2)+a},e.easing.easeInQuart=e.easing.easeInQuart||function(e,t,a,n,l){return n*(t/=l)*t*t*t+a},e.easing.easeOutQuart=e.easing.easeOutQuart||function(e,t,a,n,l){return-n*((t=t/l-1)*t*t*t-1)+a},e.easing.easeInOutQuart=e.easing.easeInOutQuart||function(e,t,a,n,l){return(t/=l/2)<1?n/2*t*t*t*t+a:-n/2*((t-=2)*t*t*t-2)+a},e.easing.easeInQuint=e.easing.easeInQuint||function(e,t,a,n,l){return n*(t/=l)*t*t*t*t+a},e.easing.easeOutQuint=e.easing.easeOutQuint||function(e,t,a,n,l){return n*((t=t/l-1)*t*t*t*t+1)+a},e.easing.easeInOutQuint=e.easing.easeInOutQuint||function(e,t,a,n,l){return(t/=l/2)<1?n/2*t*t*t*t*t+a:n/2*((t-=2)*t*t*t*t+2)+a},e.easing.easeInExpo=e.easing.easeInExpo||function(e,t,a,n,l){return 0==t?a:n*Math.pow(2,10*(t/l-1))+a},e.easing.easeOutExpo=e.easing.easeOutExpo||function(e,t,a,n,l){return t==l?a+n:n*(-Math.pow(2,-10*t/l)+1)+a},e.easing.easeInOutExpo=e.easing.easeInOutExpo||function(e,t,a,n,l){return 0==t?a:t==l?a+n:(t/=l/2)<1?n/2*Math.pow(2,10*(t-1))+a:n/2*(-Math.pow(2,-10*--t)+2)+a},e.easing.easeInSine=e.easing.easeInSine||function(e,t,a,n,l){return-n*Math.cos(t/l*(Math.PI/2))+n+a},e.easing.easeOutSine=e.easing.easeOutSine||function(e,t,a,n,l){return n*Math.sin(t/l*(Math.PI/2))+a},e.easing.easeInOutSine=e.easing.easeInOutSine||function(e,t,a,n,l){return-n/2*(Math.cos(Math.PI*t/l)-1)+a},e.easing.easeInCirc=e.easing.easeInCirc||function(e,t,a,n,l){return-n*(Math.sqrt(1-(t/=l)*t)-1)+a},e.easing.easeOutCirc=e.easing.easeOutCirc||function(e,t,a,n,l){return n*Math.sqrt(1-(t=t/l-1)*t)+a},e.easing.easeInOutCirc=e.easing.easeInOutCirc||function(e,t,a,n,l){return(t/=l/2)<1?-n/2*(Math.sqrt(1-t*t)-1)+a:n/2*(Math.sqrt(1-(t-=2)*t)+1)+a},e.easing.easeInElastic=e.easing.easeInElastic||function(e,t,a,n,l){var s=1.70158,i=0,r=n;if(0==t)return a;if(1==(t/=l))return a+n;if(i||(i=.3*l),r<Math.abs(n)){r=n;var s=i/4}else var s=i/(2*Math.PI)*Math.asin(n/r);return-(r*Math.pow(2,10*(t-=1))*Math.sin(2*(t*l-s)*Math.PI/i))+a},e.easing.easeOutElastic=e.easing.easeOutElastic||function(e,t,a,n,l){var s=1.70158,i=0,r=n;if(0==t)return a;if(1==(t/=l))return a+n;if(i||(i=.3*l),r<Math.abs(n)){r=n;var s=i/4}else var s=i/(2*Math.PI)*Math.asin(n/r);return r*Math.pow(2,-10*t)*Math.sin(2*(t*l-s)*Math.PI/i)+n+a},e.easing.easeInOutElastic=e.easing.easeInOutElastic||function(e,t,a,n,l){var s=1.70158,i=0,r=n;if(0==t)return a;if(2==(t/=l/2))return a+n;if(i||(i=.3*l*1.5),r<Math.abs(n)){r=n;var s=i/4}else var s=i/(2*Math.PI)*Math.asin(n/r);return 1>t?-.5*r*Math.pow(2,10*(t-=1))*Math.sin(2*(t*l-s)*Math.PI/i)+a:r*Math.pow(2,-10*(t-=1))*Math.sin(2*(t*l-s)*Math.PI/i)*.5+n+a},e.easing.easeInBack=e.easing.easeInBack||function(e,t,a,l,s,i){return i==n&&(i=1.70158),l*(t/=s)*t*((i+1)*t-i)+a},e.easing.easeOutBack=e.easing.easeOutBack||function(e,t,a,l,s,i){return i==n&&(i=1.70158),l*((t=t/s-1)*t*((i+1)*t+i)+1)+a},e.easing.easeInOutBack=e.easing.easeInOutBack||function(e,t,a,l,s,i){return i==n&&(i=1.70158),(t/=s/2)<1?l/2*t*t*(((i*=1.525)+1)*t-i)+a:l/2*((t-=2)*t*(((i*=1.525)+1)*t+i)+2)+a},e.easing.easeInBounce=e.easing.easeInBounce||function(t,a,n,l,s){return l-e.easing.easeOutBounce(t,s-a,0,l,s)+n},e.easing.easeOutBounce=e.easing.easeOutBounce||function(e,t,a,n,l){return(t/=l)<1/2.75?7.5625*n*t*t+a:2/2.75>t?n*(7.5625*(t-=1.5/2.75)*t+.75)+a:2.5/2.75>t?n*(7.5625*(t-=2.25/2.75)*t+.9375)+a:n*(7.5625*(t-=2.625/2.75)*t+.984375)+a},e.easing.easeInOutBounce=e.easing.easeInOutBounce||function(t,a,n,l,s){return s/2>a?.5*e.easing.easeInBounce(t,2*a,0,l,s)+n:.5*e.easing.easeOutBounce(t,2*a-s,0,l,s)+.5*l+n}}};O._easing.call(),e.fn[p]=function(t){return I[t]?I[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof t&&t?void e.error("Method "+t+" does not exist"):I.init.apply(this,arguments)},e[p]=function(t){return I[t]?I[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof t&&t?void e.error("Method "+t+" does not exist"):I.init.apply(this,arguments)},e[p].defaults=v}(jQuery,window,document);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ == Page scroll to id ==
3
+ Version: 1.5.6
4
+ Plugin URI: http://manos.malihu.gr/page-scroll-to-id/
5
+ Author: malihu
6
+ Author URI: http://manos.malihu.gr
7
+ License: MIT License (MIT)
8
+ */
9
+
10
+ /*
11
+ Copyright 2013 malihu (email: manos@malihu.gr)
12
+
13
+ Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ of this software and associated documentation files (the "Software"), to deal
15
+ in the Software without restriction, including without limitation the rights
16
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
+ copies of the Software, and to permit persons to whom the Software is
18
+ furnished to do so, subject to the following conditions:
19
+
20
+ The above copyright notice and this permission notice shall be included in
21
+ all copies or substantial portions of the Software.
22
+
23
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
29
+ THE SOFTWARE.
30
+ */
31
+
32
+ ;(function($,window,document,undefined){
33
+
34
+ /* plugin namespace, prefix, default selector(s) */
35
+
36
+ var pluginNS="mPageScroll2id",
37
+ pluginPfx="mPS2id",
38
+ defaultSelector=".m_PageScroll2id,a[rel~='m_PageScroll2id'],.page-scroll-to-id,a[rel~='page-scroll-to-id'],._ps2id",
39
+
40
+ /* default options */
41
+
42
+ defaults={
43
+ /* scroll animation speed in milliseconds: Integer */
44
+ scrollSpeed:1000,
45
+ /* auto-adjust animation speed (according to target element position and window scroll): Boolean */
46
+ autoScrollSpeed:true,
47
+ /* scroll animation easing when page is idle: String */
48
+ scrollEasing:"easeInOutQuint",
49
+ /* scroll animation easing while page is scrolling: String */
50
+ scrollingEasing:"easeOutQuint",
51
+ /* end of page "smooth scrolling" (auto-adjust the scroll-to position when bottom elements are too short): Boolean */
52
+ pageEndSmoothScroll:true,
53
+ /*
54
+ page layout defines scrolling direction: String
55
+ values: "vertical", "horizontal", "auto"
56
+ */
57
+ layout:"vertical",
58
+ /* extra space in pixels for the target element position: Integer */
59
+ offset:0,
60
+ /* highlight the main/default selectors or insert a different set: Boolean, String */
61
+ highlightSelector:false,
62
+ /* class of the clicked element: String */
63
+ clickedClass:pluginPfx+"-clicked",
64
+ /* class of the current target element: String */
65
+ targetClass:pluginPfx+"-target",
66
+ /* class of the highlighted element: String */
67
+ highlightClass:pluginPfx+"-highlight",
68
+ /* force a single highlighted element each time: Boolean */
69
+ forceSingleHighlight:false,
70
+ /* keep element highlighted until next (one element always stays highlighted): boolean */
71
+ keepHighlightUntilNext:false,
72
+ /* highlight elements according to their target and next target position (useful when targets have zero dimensions). Non "auto" layouts only: boolean */
73
+ highlightByNextTarget:false,
74
+ /* disable plugin below [x,y] screen size: boolean, integer, array ([x,y]) */
75
+ disablePluginBelow:false,
76
+ /* enable/disable click events for all selectors */
77
+ clickEvents:true,
78
+ /* append hash to URL/address bar */
79
+ appendHash:false,
80
+ /* user callback functions: fn */
81
+ onStart:function(){},
82
+ onComplete:function(){},
83
+ /* enable/disable the default selector: Boolean */
84
+ defaultSelector:false,
85
+ /* highlight elements now and in the future */
86
+ live:true,
87
+ /* set specific live selector(s): String */
88
+ liveSelector:false
89
+ },
90
+
91
+ /* vars, constants */
92
+
93
+ selector,opt,_init,_trigger,_clicked,_target,_to,_axis,_offset,_dataOffset,_totalInstances=0,_liveTimer,_speed,
94
+
95
+ /*
96
+ ---------------
97
+ methods
98
+ ---------------
99
+ */
100
+
101
+ methods={
102
+
103
+ /* plugin initialization method */
104
+
105
+ init:function(options){
106
+
107
+ /* extend options, store each option in jquery data */
108
+
109
+ var options=$.extend(true,{},defaults,options);
110
+
111
+ $(document).data(pluginPfx,options);
112
+ opt=$(document).data(pluginPfx);
113
+
114
+ /* check/set jquery (deprecated) selector property if not defined */
115
+ if(!this.selector){
116
+ var selectorClass="__"+pluginPfx;
117
+ this.each(function(){
118
+ var el=$(this);
119
+ if(!el.hasClass(selectorClass)){
120
+ el.addClass(selectorClass);
121
+ }
122
+ });
123
+ this.selector="."+selectorClass;
124
+ }
125
+
126
+ /* live selector */
127
+
128
+ if(opt.liveSelector) this.selector+=","+opt.liveSelector;
129
+
130
+ /* set selector */
131
+
132
+ selector=(!selector) ? this.selector : selector+","+this.selector;
133
+
134
+ if(opt.defaultSelector){
135
+ if(typeof $(selector)!=="object" || $(selector).length===0){
136
+ selector=defaultSelector;
137
+ }
138
+ }
139
+
140
+ /* plugin events */
141
+
142
+ if(opt.clickEvents){
143
+ $(document)
144
+
145
+ .undelegate("."+pluginPfx)
146
+
147
+ .delegate(selector,"click."+pluginPfx,function(e){
148
+ if(functions._isDisabled.call(null)){
149
+ functions._removeClasses.call(null);
150
+ return;
151
+ }
152
+ var $this=$(this),
153
+ href=$this.attr("href"),
154
+ hrefProp=$this.prop("href");
155
+ if(href && href.indexOf("#/")!==-1){
156
+ return;
157
+ }
158
+ functions._reset.call(null);
159
+ _dataOffset=$this.data("ps2id-offset") || 0;
160
+ if(functions._isValid.call(null,href,hrefProp) && functions._findTarget.call(null,href)){
161
+ e.preventDefault();
162
+ _trigger="selector";
163
+ _clicked=$this;
164
+ functions._setClasses.call(null,true);
165
+ functions._scrollTo.call(null);
166
+ }
167
+ });
168
+ }
169
+
170
+ $(window)
171
+
172
+ .unbind("."+pluginPfx)
173
+
174
+ .bind("scroll."+pluginPfx+" resize."+pluginPfx,function(){
175
+ if(functions._isDisabled.call(null)){
176
+ functions._removeClasses.call(null);
177
+ return;
178
+ }
179
+ var targets=$("._"+pluginPfx+"-t");
180
+ targets.each(function(i){
181
+ var t=$(this),id=t.attr("id"),
182
+ h=functions._findHighlight.call(null,id);
183
+ functions._setClasses.call(null,false,t,h);
184
+ if(i==targets.length-1){functions._extendClasses.call(null);}
185
+ });
186
+ });
187
+
188
+ /* plugin has initialized */
189
+
190
+ _init=true;
191
+
192
+ /* setup selectors, target elements, basic plugin classes etc. */
193
+
194
+ functions._setup.call(null);
195
+
196
+ /*
197
+ monitor for elements matching the current highlight selector and call plugin setup when found (now and in the future)
198
+ to manually enable/disable: $(document).data("mPS2id").live=boolean
199
+ */
200
+
201
+ functions._live.call(null);
202
+ },
203
+
204
+ /* scrollTo method */
205
+
206
+ scrollTo:function(id,options){
207
+ if(functions._isDisabled.call(null)){
208
+ functions._removeClasses.call(null);
209
+ return;
210
+ }
211
+ if(id && typeof id!=="undefined"){
212
+ functions._isInit.call(null);
213
+ var defaults={
214
+ layout:opt.layout,
215
+ offset:opt.offset,
216
+ clicked:false
217
+ },
218
+ options=$.extend(true,{},defaults,options);
219
+ functions._reset.call(null);
220
+ _axis=options.layout;
221
+ _offset=options.offset;
222
+ id=(id.indexOf("#")!==-1) ? id : "#"+id;
223
+ if(functions._isValid.call(null,id) && functions._findTarget.call(null,id)){
224
+ _trigger="scrollTo";
225
+ _clicked=options.clicked;
226
+ if(_clicked){
227
+ functions._setClasses.call(null,true);
228
+ }
229
+ functions._scrollTo.call(null);
230
+ }
231
+ }
232
+ },
233
+
234
+ /* destroy method */
235
+
236
+ destroy:function(){
237
+ $(window).unbind("."+pluginPfx);
238
+ $(document).undelegate("."+pluginPfx).removeData(pluginPfx);
239
+ $("._"+pluginPfx+"-t").removeData(pluginPfx);
240
+ functions._removeClasses.call(null,true);
241
+ }
242
+ },
243
+
244
+ /*
245
+ ---------------
246
+ functions
247
+ ---------------
248
+ */
249
+
250
+ functions={
251
+
252
+ /* checks if screen size ([x,y]) is below the value(s) set in disablePluginBelow option */
253
+
254
+ _isDisabled:function(){
255
+ var e=window,a="inner",
256
+ val=opt.disablePluginBelow instanceof Array ? [opt.disablePluginBelow[0] || 0,opt.disablePluginBelow[1] || 0] : [opt.disablePluginBelow || 0,0];
257
+ if(!("innerWidth" in window )){
258
+ a="client";
259
+ e=document.documentElement || document.body;
260
+ }
261
+ return e[a+"Width"]<=val[0] || e[a+"Height"]<=val[1];
262
+ },
263
+
264
+ /* checks if href attribute is valid */
265
+
266
+ _isValid:function(href,hrefProp){
267
+ if(!href){
268
+ return;
269
+ }
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. */
277
+
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){
285
+ if(opt.highlightByNextTarget){
286
+ if(t!==tp){
287
+ if(!tp){t.data(pluginPfx,{tn:"0"});}else{tp.data(pluginPfx,{tn:t});}
288
+ tp=t;
289
+ }
290
+ }
291
+ if(!t.hasClass("_"+pluginPfx+"-t")){
292
+ t.addClass("_"+pluginPfx+"-t");
293
+ }
294
+ t.data(pluginPfx,{i:i});
295
+ if(!$this.hasClass("_"+pluginPfx+"-h")){
296
+ $this.addClass("_"+pluginPfx+"-h");
297
+ }
298
+ var h=functions._findHighlight.call(null,id);
299
+ functions._setClasses.call(null,false,t,h);
300
+ _totalInstances=i;
301
+ i++
302
+ if(i==$(el).length){functions._extendClasses.call(null);}
303
+ }
304
+ }
305
+ });
306
+ },
307
+
308
+ /* returns the highlight selector */
309
+
310
+ _highlightSelector:function(){
311
+ return (opt.highlightSelector && opt.highlightSelector!=="") ? opt.highlightSelector : selector;
312
+ },
313
+
314
+ /* finds the target element */
315
+
316
+ _findTarget:function(str){
317
+ var val=(str.indexOf("#/")!==-1) ? str.split("#/")[1] : str.split("#")[1],
318
+ el=$("#"+val);
319
+ if(el.length<1 || el.css("position")==="fixed"){
320
+ if(val==="top"){
321
+ el=$("body");
322
+ }else{
323
+ return;
324
+ }
325
+ }
326
+ _target=el;
327
+ if(!_axis){
328
+ _axis=opt.layout;
329
+ }
330
+ _offset=functions._setOffset.call(null);
331
+ _to=[(el.offset().top-_offset[0]).toString(),(el.offset().left-_offset[1]).toString()];
332
+ _to[0]=(_to[0]<0) ? 0 : _to[0];
333
+ _to[1]=(_to[1]<0) ? 0 : _to[1];
334
+ return _to;
335
+ },
336
+
337
+ /* sets the offset value (pixels, objects etc.) */
338
+
339
+ _setOffset:function(){
340
+ if(!_offset){
341
+ _offset=(opt.offset) ? opt.offset : 0;
342
+ }
343
+ if(_dataOffset){
344
+ _offset=_dataOffset;
345
+ }
346
+ var val,obj,y,x;
347
+ switch(typeof _offset){
348
+ case "object":
349
+ case "string":
350
+ val=[(_offset["y"]) ? _offset["y"] : _offset,(_offset["x"]) ? _offset["x"] : _offset];
351
+ obj=[(val[0] instanceof jQuery) ? val[0] : $(val[0]),(val[1] instanceof jQuery) ? val[1] : $(val[1])];
352
+ if(obj[0].length>0){ // js/jquery object
353
+ y=obj[0].height();
354
+ if(obj[0].css("position")==="fixed"){ // include position for fixed elements
355
+ y+=obj[0][0].offsetTop;
356
+ }
357
+ }else if(!isNaN(parseFloat(val[0])) && isFinite(val[0])){ // numeric string
358
+ y=parseInt(val[0]);
359
+ }else{
360
+ y=0; // non-existing value
361
+ }
362
+ if(obj[1].length>0){ // js/jquery object
363
+ x=obj[1].width();
364
+ if(obj[1].css("position")==="fixed"){ // include position for fixed elements
365
+ x+=obj[1][0].offsetLeft;
366
+ }
367
+ }else if(!isNaN(parseFloat(val[1])) && isFinite(val[1])){ // numeric string
368
+ x=parseInt(val[1]);
369
+ }else{
370
+ x=0; // non-existing value
371
+ }
372
+ break;
373
+ case "function":
374
+ val=_offset.call(null); // function (single value or array)
375
+ if(val instanceof Array){
376
+ y=val[0];
377
+ x=val[1];
378
+ }else{
379
+ y=x=val;
380
+ }
381
+ break;
382
+ default:
383
+ y=x=parseInt(_offset); // number
384
+ }
385
+ return [y,x];
386
+ },
387
+
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
+
395
+ /* sets plugin classes */
396
+
397
+ _setClasses:function(c,t,h){
398
+ var cc=opt.clickedClass,tc=opt.targetClass,hc=opt.highlightClass;
399
+ if(c && cc && cc!==""){
400
+ $("."+cc).removeClass(cc);
401
+ _clicked.addClass(cc);
402
+ }else if(t && tc && tc!=="" && h && hc && hc!==""){
403
+ if(functions._currentTarget.call(null,t)){
404
+ t.addClass(tc);
405
+ h.addClass(hc);
406
+ }else{
407
+ if(!opt.keepHighlightUntilNext || $("."+hc).length>1){
408
+ t.removeClass(tc);
409
+ h.removeClass(hc);
410
+ }
411
+ }
412
+ }
413
+ },
414
+
415
+ /* extends plugin classes */
416
+
417
+ _extendClasses:function(){
418
+ var tc=opt.targetClass,hc=opt.highlightClass,
419
+ $tc=$("."+tc),$hc=$("."+hc),ftc=tc+"-first",ltc=tc+"-last",fhc=hc+"-first",lhc=hc+"-last";
420
+ $("._"+pluginPfx+"-t").removeClass(ftc+" "+ltc);
421
+ $("._"+pluginPfx+"-h").removeClass(fhc+" "+lhc);
422
+ if(!opt.forceSingleHighlight){
423
+ $tc.slice(0,1).addClass(ftc).end().slice(-1).addClass(ltc);
424
+ $hc.slice(0,1).addClass(fhc).end().slice(-1).addClass(lhc);
425
+ }else{
426
+ if(opt.keepHighlightUntilNext && $tc.length>1){
427
+ $tc.slice(0,1).removeClass(tc); $hc.slice(0,1).removeClass(hc);
428
+ }else{
429
+ $tc.slice(1).removeClass(tc); $hc.slice(1).removeClass(hc);
430
+ }
431
+ }
432
+ },
433
+
434
+ /* removes plugin classes */
435
+
436
+ _removeClasses:function(destroy){
437
+ $("."+opt.clickedClass).removeClass(opt.clickedClass);
438
+ $("."+opt.targetClass).removeClass(opt.targetClass+" "+opt.targetClass+"-first "+opt.targetClass+"-last");
439
+ $("."+opt.highlightClass).removeClass(opt.highlightClass+" "+opt.highlightClass+"-first "+opt.highlightClass+"-last");
440
+ if(destroy){
441
+ $("._"+pluginPfx+"-t").removeClass("_"+pluginPfx+"-t");
442
+ $("._"+pluginPfx+"-h").removeClass("_"+pluginPfx+"-h");
443
+ }
444
+ },
445
+
446
+ /* checks if target element is in viewport */
447
+
448
+ _currentTarget:function(t){
449
+ var o=opt["target_"+t.data(pluginPfx).i],
450
+ dataTarget=t.data("ps2id-target"),
451
+ rect=dataTarget && $(dataTarget)[0] ? $(dataTarget)[0].getBoundingClientRect() : t[0].getBoundingClientRect();
452
+ if(typeof o!=="undefined"){
453
+ var y=t.offset().top,x=t.offset().left,
454
+ from=(o.from) ? o.from+y : y,to=(o.to) ? o.to+y : y,
455
+ fromX=(o.fromX) ? o.fromX+x : x,toX=(o.toX) ? o.toX+x : x;
456
+ return(
457
+ rect.top >= to && rect.top <= from &&
458
+ rect.left >= toX && rect.left <= fromX
459
+ );
460
+ }else{
461
+ var wh=$(window).height(),ww=$(window).width(),
462
+ th=dataTarget ? $(dataTarget).height() : t.height(),tw=dataTarget ? $(dataTarget).width() : t.width(),
463
+ base=1+(th/wh),
464
+ top=base,bottom=(th<wh) ? base*(wh/th) : base,
465
+ baseX=1+(tw/ww),
466
+ left=baseX,right=(tw<ww) ? baseX*(ww/tw) : baseX,
467
+ val=[rect.top <= wh/top,rect.bottom >= wh/bottom,rect.left <= ww/left,rect.right >= ww/right];
468
+ if(opt.highlightByNextTarget){
469
+ var tn=t.data(pluginPfx).tn;
470
+ if(tn){
471
+ var rectn=tn[0].getBoundingClientRect();
472
+ if(opt.layout==="vertical"){
473
+ val=[rect.top <= wh/2,rectn.top > wh/2,1,1];
474
+ }else if(opt.layout==="horizontal"){
475
+ val=[1,1,rect.left <= ww/2,rectn.left > ww/2];
476
+ }
477
+ }
478
+ }
479
+ return(val[0] && val[1] && val[2] && val[3]);
480
+ }
481
+ },
482
+
483
+ /* scrolls the page */
484
+
485
+ _scrollTo:function(){
486
+ _speed=functions._scrollSpeed.call(null);
487
+ _to=(opt.pageEndSmoothScroll) ? functions._pageEndSmoothScroll.call(null) : _to;
488
+ var _scrollable=$("html,body"),
489
+ speed=(opt.autoScrollSpeed) ? functions._autoScrollSpeed.call(null) : _speed,
490
+ easing=(_scrollable.is(":animated")) ? opt.scrollingEasing : opt.scrollEasing,
491
+ _t=$(window).scrollTop(),_l=$(window).scrollLeft();
492
+ switch(_axis){
493
+ case "horizontal":
494
+ if(_l!=_to[1]){
495
+ functions._callbacks.call(null,"onStart");
496
+ _scrollable.stop().animate({scrollLeft:_to[1]},speed,easing).promise().then(function(){
497
+ functions._callbacks.call(null,"onComplete");
498
+ });
499
+ }
500
+ break;
501
+ case "auto":
502
+ if(_t!=_to[0] || _l!=_to[1]){
503
+ functions._callbacks.call(null,"onStart");
504
+ if(navigator.userAgent.match(/(iPod|iPhone|iPad|Android)/)){ // mobile fix
505
+ var left;
506
+ _scrollable.stop().animate({pageYOffset:_to[0],pageXOffset:_to[1]},{
507
+ duration:speed,
508
+ easing:easing,
509
+ step:function(now,fx){
510
+ if(fx.prop=='pageXOffset'){
511
+ left=now;
512
+ }else if(fx.prop=='pageYOffset'){
513
+ window.scrollTo(left,now);
514
+ }
515
+ }
516
+ }).promise().then(function(){
517
+ functions._callbacks.call(null,"onComplete");
518
+ });
519
+ }else{
520
+ _scrollable.stop().animate({scrollTop:_to[0],scrollLeft:_to[1]},speed,easing).promise().then(function(){
521
+ functions._callbacks.call(null,"onComplete");
522
+ });
523
+ }
524
+ }
525
+ break;
526
+ default:
527
+ if(_t!=_to[0]){
528
+ functions._callbacks.call(null,"onStart");
529
+ _scrollable.stop().animate({scrollTop:_to[0]},speed,easing).promise().then(function(){
530
+ functions._callbacks.call(null,"onComplete");
531
+ });
532
+ }
533
+ }
534
+ },
535
+
536
+ /* sets end of page "smooth scrolling" position */
537
+
538
+ _pageEndSmoothScroll:function(){
539
+ var _dh=$(document).height(),_dw=$(document).width(),
540
+ _wh=$(window).height(),_ww=$(window).width();
541
+ return [((_dh-_to[0])<_wh) ? _dh-_wh : _to[0],((_dw-_to[1])<_ww) ? _dw-_ww : _to[1]];
542
+ },
543
+
544
+ /* sets animation speed (link-specific speed via ps2id-speed-VALUE class on link or link's parent) */
545
+
546
+ _scrollSpeed:function(){
547
+ var speed=opt.scrollSpeed;
548
+ if(_clicked && _clicked.length){
549
+ _clicked.add(_clicked.parent()).each(function(){
550
+ var $this=$(this);
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
+ }
558
+ }
559
+ }
560
+ });
561
+ }
562
+ return parseInt(speed);
563
+ },
564
+
565
+ /* sets the auto-adjusted animation speed */
566
+
567
+ _autoScrollSpeed:function(){
568
+ var _t=$(window).scrollTop(),_l=$(window).scrollLeft(),
569
+ _h=$(document).height(),_w=$(document).width(),
570
+ val=[
571
+ _speed+((_speed*(Math.floor((Math.abs(_to[0]-_t)/_h)*100)))/100),
572
+ _speed+((_speed*(Math.floor((Math.abs(_to[1]-_l)/_w)*100)))/100)
573
+ ];
574
+ return Math.max.apply(Math,val);
575
+ },
576
+
577
+ /* user callback functions */
578
+
579
+ _callbacks:function(c){
580
+ if(!opt){
581
+ return;
582
+ }
583
+ this[pluginPfx]={
584
+ trigger:_trigger,clicked:_clicked,target:_target,scrollTo:{y:_to[0],x:_to[1]}
585
+ };
586
+ switch(c){
587
+ case "onStart":
588
+ //append hash to URL/address bar
589
+ if(opt.appendHash && window.history && window.history.pushState && _clicked && _clicked.length){
590
+ var h="#"+_clicked.attr("href").split("#")[1];
591
+ if(h!==window.location.hash) history.pushState("","",h);
592
+ }
593
+ opt.onStart.call(null,this[pluginPfx]);
594
+ break;
595
+ case "onComplete":
596
+ opt.onComplete.call(null,this[pluginPfx]);
597
+ break;
598
+ }
599
+ },
600
+
601
+ /* resets/clears vars and constants */
602
+
603
+ _reset:function(){
604
+ _axis=_offset=_dataOffset=false;
605
+ },
606
+
607
+ /* checks if plugin has initialized */
608
+
609
+ _isInit:function(){
610
+ if(!_init){
611
+ methods.init.apply(this);
612
+ }
613
+ },
614
+
615
+ /* live fn */
616
+
617
+ _live:function(){
618
+ _liveTimer=setTimeout(function(){
619
+ if(opt.live){
620
+ if($(functions._highlightSelector()).length!==_totalInstances){
621
+ functions._setup.call(null);
622
+ }
623
+ }else{
624
+ if(_liveTimer){clearTimeout(_liveTimer);}
625
+ }
626
+ functions._live.call(null);
627
+ },1000);
628
+ },
629
+
630
+ /* extends jquery with custom easings (as jquery ui) */
631
+
632
+ _easing:function(){
633
+ $.easing.easeInQuad=$.easing.easeInQuad || function(x){
634
+ return x*x;
635
+ };
636
+ $.easing.easeOutQuad=$.easing.easeOutQuad || function(x){
637
+ return 1-(1-x)*(1-x);
638
+ };
639
+ $.easing.easeInOutQuad=$.easing.easeInOutQuad || function(x){
640
+ return x<0.5 ? 2*x*x : 1-Math.pow(-2*x+2,2)/2;
641
+ };
642
+ $.easing.easeInCubic=$.easing.easeInCubic || function(x){
643
+ return x*x*x;
644
+ };
645
+ $.easing.easeOutCubic=$.easing.easeOutCubic || function(x){
646
+ return 1-Math.pow(1-x,3);
647
+ };
648
+ $.easing.easeInOutCubic=$.easing.easeInOutCubic || function(x){
649
+ return x<0.5 ? 4*x*x*x : 1-Math.pow(-2*x+2,3)/2;
650
+ };
651
+ $.easing.easeInQuart=$.easing.easeInQuart || function(x){
652
+ return x*x*x*x;
653
+ };
654
+ $.easing.easeOutQuart=$.easing.easeOutQuart || function(x){
655
+ return 1-Math.pow(1-x,4);
656
+ };
657
+ $.easing.easeInOutQuart=$.easing.easeInOutQuart || function(x){
658
+ return x<0.5 ? 8*x*x*x*x : 1-Math.pow(-2*x+2,4)/2;
659
+ };
660
+ $.easing.easeInQuint=$.easing.easeInQuint || function(x){
661
+ return x*x*x*x*x;
662
+ };
663
+ $.easing.easeOutQuint=$.easing.easeOutQuint || function(x){
664
+ return 1-Math.pow(1-x,5);
665
+ };
666
+ $.easing.easeInOutQuint=$.easing.easeInOutQuint || function(x){
667
+ return x<0.5 ? 16*x*x*x*x*x : 1-Math.pow(-2*x+2,5)/2;
668
+ };
669
+ $.easing.easeInExpo=$.easing.easeInExpo || function(x){
670
+ return x===0 ? 0 : Math.pow(2,10*x-10);
671
+ };
672
+ $.easing.easeOutExpo=$.easing.easeOutExpo || function(x){
673
+ return x===1 ? 1 : 1-Math.pow(2,-10*x);
674
+ };
675
+ $.easing.easeInOutExpo=$.easing.easeInOutExpo || function(x){
676
+ return x===0 ? 0 : x===1 ? 1 : x<0.5 ? Math.pow(2,20*x-10)/2 : (2-Math.pow(2,-20*x+10))/2;
677
+ };
678
+ $.easing.easeInSine=$.easing.easeInSine || function(x){
679
+ return 1-Math.cos(x*Math.PI/2);
680
+ };
681
+ $.easing.easeOutSine=$.easing.easeOutSine || function(x){
682
+ return Math.sin(x*Math.PI/2);
683
+ };
684
+ $.easing.easeInOutSine=$.easing.easeInOutSine || function(x){
685
+ return -(Math.cos(Math.PI*x)-1)/2;
686
+ };
687
+ $.easing.easeInCirc=$.easing.easeInCirc || function(x){
688
+ return 1-Math.sqrt(1-Math.pow(x,2));
689
+ };
690
+ $.easing.easeOutCirc=$.easing.easeOutCirc || function(x){
691
+ return Math.sqrt(1-Math.pow(x-1,2));
692
+ };
693
+ $.easing.easeInOutCirc=$.easing.easeInOutCirc || function(x){
694
+ return x<0.5 ? (1-Math.sqrt(1-Math.pow(2*x,2)))/2 : (Math.sqrt(1-Math.pow(-2*x+2,2))+1)/2;
695
+ };
696
+ $.easing.easeInElastic=$.easing.easeInElastic || function(x){
697
+ return x===0 ? 0 : x===1 ? 1 : -Math.pow(2,10*x-10)*Math.sin((x*10-10.75)*((2*Math.PI)/3));
698
+ };
699
+ $.easing.easeOutElastic=$.easing.easeOutElastic || function(x){
700
+ return x===0 ? 0 : x===1 ? 1 : Math.pow(2,-10*x)*Math.sin((x*10-0.75)*((2*Math.PI)/3))+1;
701
+ };
702
+ $.easing.easeInOutElastic=$.easing.easeInOutElastic || function(x){
703
+ return x===0 ? 0 : x===1 ? 1 : x<0.5 ? -(Math.pow(2,20*x-10)*Math.sin((20*x-11.125)*((2*Math.PI)/4.5)))/2 : Math.pow(2,-20*x+10)*Math.sin((20*x-11.125)*((2*Math.PI)/4.5))/2+1;
704
+ };
705
+ $.easing.easeInBack=$.easing.easeInBack || function(x){
706
+ return (1.70158+1)*x*x*x-1.70158*x*x;
707
+ };
708
+ $.easing.easeOutBack=$.easing.easeOutBack || function(x){
709
+ return 1+(1.70158+1)*Math.pow(x-1,3)+1.70158*Math.pow(x-1,2);
710
+ };
711
+ $.easing.easeInOutBack=$.easing.easeInOutBack || function(x){
712
+ return x<0.5 ? (Math.pow(2*x,2)*(((1.70158*1.525)+1)*2*x-(1.70158*1.525)))/2 : (Math.pow(2*x-2,2)*(((1.70158*1.525)+1)*(x*2-2)+(1.70158*1.525))+2)/2;
713
+ };
714
+ $.easing.easeInBounce=$.easing.easeInBounce || function(x){
715
+ return 1-__bounceOut(1-x);
716
+ };
717
+ $.easing.easeOutBounce=$.easing.easeOutBounce || __bounceOut;
718
+ $.easing.easeInOutBounce=$.easing.easeInOutBounce || function(x){
719
+ return x<0.5 ? (1-__bounceOut(1-2*x))/2 : (1+__bounceOut(2*x-1))/2;
720
+ };
721
+ function __bounceOut(x){
722
+ var n1=7.5625,d1=2.75;
723
+ if(x<1/d1){
724
+ return n1*x*x;
725
+ }else if(x<2/d1){
726
+ return n1*(x-=(1.5/d1))*x+.75;
727
+ }else if(x<2.5/d1){
728
+ return n1*(x-=(2.25/d1))*x+.9375;
729
+ }else{
730
+ return n1*(x-=(2.625/d1))*x+.984375;
731
+ }
732
+ }
733
+ }
734
+ }
735
+
736
+ /*
737
+ ---------------
738
+ plugin setup
739
+ ---------------
740
+ */
741
+
742
+ /* extend jquery with custom easings */
743
+
744
+ functions._easing.call();
745
+
746
+ /* plugin constructor functions */
747
+
748
+ $.fn[pluginNS]=function(method){
749
+ if(methods[method]){
750
+ return methods[method].apply(this,Array.prototype.slice.call(arguments,1));
751
+ }else if(typeof method==="object" || !method){
752
+ return methods.init.apply(this,arguments);
753
+ }else{
754
+ $.error("Method "+method+" does not exist");
755
+ }
756
+ };
757
+ $[pluginNS]=function(method){
758
+ if(methods[method]){
759
+ return methods[method].apply(this,Array.prototype.slice.call(arguments,1));
760
+ }else if(typeof method==="object" || !method){
761
+ return methods.init.apply(this,arguments);
762
+ }else{
763
+ $.error("Method "+method+" does not exist");
764
+ }
765
+ };
766
+
767
+ /*
768
+ allow setting plugin default options.
769
+ example: $.plugin_name.defaults.option_name="option_value";
770
+ */
771
+
772
+ $[pluginNS].defaults=defaults;
773
+
774
+ })(jQuery,window,document);
js/page-scroll-to-id.min.js ADDED
@@ -0,0 +1,2 @@
 
 
1
+ /* Page scroll to id - version 1.6.2 */
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("&lt;","<").replace("&gt;",">");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("&lt;","<").replace("&gt;",">");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);
malihu-pagescroll2id.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Page scroll to id
4
  Plugin URI: http://manos.malihu.gr/page-scroll-to-id
5
  Description: Page scroll to id is an easy-to-use jQuery plugin that enables animated page scrolling to specific id within the document.
6
- Version: 1.6.1
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.1'; // Plugin version --edit--
51
  protected $update_option=null;
52
 
53
  protected $plugin_name='Page scroll to id'; // Plugin name --edit--
@@ -64,6 +64,7 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
64
 
65
  protected $plugin_script='jquery.malihu.PageScroll2id.js'; // Plugin public script (main js plugin file) --edit--
66
  protected $plugin_init_script='jquery.malihu.PageScroll2id-init.js'; // Plugin public initialization script --edit--
 
67
 
68
  private function __construct(){
69
  // Plugin requires PHP version 5.2 or higher
@@ -92,6 +93,9 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
92
  add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_styles'));
93
  add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'));
94
  // load public stylesheet and javaScript.
 
 
 
95
  add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'));
96
  // Add plugin settings link
97
  add_filter('plugin_action_links_'.plugin_basename(__FILE__), array($this, 'add_plugin_action_links'));
@@ -161,12 +165,27 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
161
  // front-end plugin scripts
162
  public function enqueue_scripts(){
163
  wp_enqueue_script('jquery');
164
- wp_register_script($this->plugin_slug.'-plugin-script', plugins_url('js/'.$this->plugin_script, __FILE__), array('jquery'), $this->version, 1);
165
- wp_enqueue_script($this->plugin_slug.'-plugin-script');
166
- wp_register_script($this->plugin_slug.'-plugin-init-script', plugins_url('js/'.$this->plugin_init_script, __FILE__), array('jquery', $this->plugin_slug.'-plugin-script'), $this->version, 1);
167
- wp_enqueue_script($this->plugin_slug.'-plugin-init-script');
 
 
 
 
 
 
 
 
 
 
 
168
  $this->plugin_fn_call();
169
  $this->add_plugin_shortcode(); // Remove/comment for plugin without any shortcodes --edit--
 
 
 
 
170
  }
171
 
172
  public function add_plugin_admin_menu(){
@@ -302,12 +321,21 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
302
 
303
  public function plugin_fn_call(){
304
  $instances=get_option($this->db_prefix.'instances');
 
 
 
 
 
 
 
 
305
  $params=array(
306
- 'instances' => $instances,
307
  'total_instances' => count($instances),
308
  'shortcode_class' => '_'.$this->sc_pfx
309
  );
310
- wp_localize_script($this->plugin_slug.'-plugin-init-script', $this->pl_pfx.'params', $params);
 
311
  }
312
 
313
  public function add_plugin_shortcode(){
@@ -329,6 +357,7 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
329
  "offset" => "",
330
  "id" => "",
331
  "target" => "",
 
332
  ), $atts));
333
  if($id!==""){
334
  if($content){
@@ -337,7 +366,8 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
337
  return "<a id=\"".$id."\" data-ps2id-target=\"".sanitize_text_field($target)."\">".do_shortcode($content)."</a>";
338
  }
339
  }else{
340
- return "<a href=\"".$url."\" class=\"".$shortcode_class."\" data-ps2id-offset=\"".esc_attr($offset)."\">".do_shortcode($content)."</a>";
 
341
  }
342
  ');
343
  add_shortcode($tag, $pl_shortcodes[$i]);
@@ -428,10 +458,10 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
428
  $old_db_opt7=get_option('malihu_pagescroll2id_layout');
429
  return array(
430
  ($old_db_opt1) ? $old_db_opt1 : 'a[rel=\'m_PageScroll2id\']',
431
- ($old_db_opt2) ? $old_db_opt2 : 1300,
432
  ($old_db_opt3) ? $old_db_opt3 : 'true',
433
- ($old_db_opt4) ? $old_db_opt4 : 'easeInOutExpo',
434
- ($old_db_opt5) ? $old_db_opt5 : 'easeInOutCirc',
435
  ($old_db_opt6) ? $old_db_opt6 : 'true',
436
  ($old_db_opt7) ? $old_db_opt7 : 'vertical'
437
  );
@@ -515,16 +545,16 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
515
  $pl_instances=get_option($this->db_prefix.'instances', $this->default);
516
  $pl_i=$pl_instances[$this->pl_pfx.'instance_0'];
517
  // WP Menu API menus HTML attributes (requires WP version 3.6 or higher)
518
- if($pl_i['autoSelectorMenuLinks']['value']=='true'){
519
  add_filter('nav_menu_link_attributes', array($this, 'wp_menu_links_custom_atts'), 10, 3);
520
  }
521
  // tinyMCE buttons (requires WP version 3.9 or higher)
522
- if(version_compare(get_bloginfo('version'), '3.9', '>=') && $pl_i['adminTinyMCEbuttons']['value']=='true'){
523
  $plugin_tinymce = new malihuPageScroll2idtinymce();
524
  add_action('admin_head', array($plugin_tinymce, 'add_custom_button'));
525
  }
526
  // Display widgets id attribute
527
- if($pl_i['adminDisplayWidgetsId']['value']=='true'){
528
  add_action('widget_form_callback', array($this, 'display_widget_id'), 10, 2);
529
  }
530
  }
@@ -550,12 +580,13 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
550
  // --edit--
551
  // Defaults
552
  $d0='a[rel=\'m_PageScroll2id\']';
553
- $d19='false';
554
- $d1=1300;
555
  $d2='true';
556
- $d3='easeInOutExpo';
557
- $d4='easeInOutCirc';
558
  $d5='true';
 
559
  $d6='vertical';
560
  $d7=0;
561
  $d8='';
@@ -565,12 +596,15 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
565
  $d12='false';
566
  $d14='false';
567
  $d16='false';
568
- $d13='false';
569
- $d17='false';
 
570
  $d18=0;
571
  $d15=0;
572
  $d20='true';
573
  $d21='true';
 
 
574
  // Values
575
  switch($action){
576
  case 'validate':
@@ -581,6 +615,7 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
581
  $v3=$_POST[$this->db_prefix.$i.'_scrollEasing'];
582
  $v4=$_POST[$this->db_prefix.$i.'_scrollingEasing'];
583
  $v5=(isset($_POST[$this->db_prefix.$i.'_pageEndSmoothScroll'])) ? 'true' : 'false';
 
584
  $v6=$_POST[$this->db_prefix.$i.'_layout'];
585
  $v7=$this->sanitize_input('text', $_POST[$this->db_prefix.$i.'_offset'], $d7);
586
  $v8=(empty($_POST[$this->db_prefix.$i.'_highlightSelector'])) ? $d8 : $this->sanitize_input('text', $_POST[$this->db_prefix.$i.'_highlightSelector'], $d8);
@@ -590,12 +625,15 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
590
  $v12=(isset($_POST[$this->db_prefix.$i.'_forceSingleHighlight'])) ? 'true' : 'false';
591
  $v14=(isset($_POST[$this->db_prefix.$i.'_keepHighlightUntilNext'])) ? 'true' : 'false';
592
  $v16=(isset($_POST[$this->db_prefix.$i.'_highlightByNextTarget'])) ? 'true' : 'false';
 
593
  $v13=(isset($_POST[$this->db_prefix.$i.'_scrollToHash'])) ? 'true' : 'false';
594
  $v17=(isset($_POST[$this->db_prefix.$i.'_scrollToHashForAll'])) ? 'true' : 'false';
595
  $v18=$this->sanitize_input('number', $_POST[$this->db_prefix.$i.'_scrollToHashDelay'], $d18);
596
  $v15=$this->sanitize_input('text', $_POST[$this->db_prefix.$i.'_disablePluginBelow'], $d15);
597
  $v20=(isset($_POST[$this->db_prefix.$i.'_adminDisplayWidgetsId'])) ? 'true' : 'false';
598
  $v21=(isset($_POST[$this->db_prefix.$i.'_adminTinyMCEbuttons'])) ? 'true' : 'false';
 
 
599
  break;
600
  case 'upgrade':
601
  if(isset($old)){
@@ -623,6 +661,7 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
623
  $v12=(isset($j['forceSingleHighlight'])) ? $j['forceSingleHighlight']['value'] : $d12;
624
  $v14=(isset($j['keepHighlightUntilNext'])) ? $j['keepHighlightUntilNext']['value'] : $d14;
625
  $v16=(isset($j['highlightByNextTarget'])) ? $j['highlightByNextTarget']['value'] : $d16;
 
626
  $v13=(isset($j['scrollToHash'])) ? $j['scrollToHash']['value'] : $d13;
627
  $v17=(isset($j['scrollToHashForAll'])) ? $j['scrollToHashForAll']['value'] : $d17;
628
  $v18=(isset($j['scrollToHashDelay'])) ? $j['scrollToHashDelay']['value'] : $d18;
@@ -630,6 +669,9 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
630
  $v19=(isset($j['autoSelectorMenuLinks'])) ? $j['autoSelectorMenuLinks']['value'] : $d19;
631
  $v20=(isset($j['adminDisplayWidgetsId'])) ? $j['adminDisplayWidgetsId']['value'] : $d20;
632
  $v21=(isset($j['adminTinyMCEbuttons'])) ? $j['adminTinyMCEbuttons']['value'] : $d21;
 
 
 
633
  break;
634
  default:
635
  $v0=$d0;
@@ -639,6 +681,7 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
639
  $v3=$d3;
640
  $v4=$d4;
641
  $v5=$d5;
 
642
  $v6=$d6;
643
  $v7=$d7;
644
  $v8=$d8;
@@ -648,12 +691,15 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
648
  $v12=$d12;
649
  $v14=$d14;
650
  $v16=$d16;
 
651
  $v13=$d13;
652
  $v17=$d17;
653
  $v18=$d18;
654
  $v15=$d15;
655
  $v20=$d20;
656
  $v21=$d21;
 
 
657
  }
658
  // Options array
659
  /*
@@ -679,7 +725,7 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
679
  'checkbox_label' => null,
680
  'radio_labels' => null,
681
  'field_info' => null,
682
- 'description' => 'The link(s) that will scroll the page when clicked. Defaults to all links with <code>m_PageScroll2id</code> rel attribute value <br /><small>In addition to selectors above, the plugin is enabled by default on links (or links contained within elements) with class <code>ps2id</code></small>',
683
  'wrapper' => null
684
  ),
685
  'autoSelectorMenuLinks' => array(
@@ -691,7 +737,7 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
691
  'checkbox_label' => 'Enable on WordPress Menu links',
692
  'radio_labels' => null,
693
  'field_info' => null,
694
- 'description' => 'Automatically enable the plugin on custom links (containing a hash in their URL) created in WordPress Menus <br /><small>Requires WordPress version 3.6 or higher</small>',
695
  'wrapper' => 'fieldset'
696
  ),
697
  'scrollSpeed' => array(
@@ -699,11 +745,11 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
699
  'values' => null,
700
  'id' => $this->db_prefix.$i.'_scrollSpeed',
701
  'field_type' => 'text-integer',
702
- 'label' => 'Scroll animation speed',
703
  'checkbox_label' => null,
704
  'radio_labels' => null,
705
  'field_info' => 'milliseconds',
706
- 'description' => 'Scroll animation speed in milliseconds (1000 milliseconds equals 1 second)',
707
  'wrapper' => null
708
  ),
709
  'autoScrollSpeed' => array(
@@ -712,10 +758,10 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
712
  'id' => $this->db_prefix.$i.'_autoScrollSpeed',
713
  'field_type' => 'checkbox',
714
  'label' => '',
715
- 'checkbox_label' => 'Auto-adjust animation speed',
716
  'radio_labels' => null,
717
  'field_info' => null,
718
- 'description' => 'Auto-adjust animation speed according to target element position and window scroll',
719
  'wrapper' => 'fieldset'
720
  ),
721
  'scrollEasing' => array(
@@ -723,11 +769,11 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
723
  'values' => 'linear,swing,easeInQuad,easeOutQuad,easeInOutQuad,easeInCubic,easeOutCubic,easeInOutCubic,easeInQuart,easeOutQuart,easeInOutQuart,easeInQuint,easeOutQuint,easeInOutQuint,easeInExpo,easeOutExpo,easeInOutExpo,easeInSine,easeOutSine,easeInOutSine,easeInCirc,easeOutCirc,easeInOutCirc,easeInElastic,easeOutElastic,easeInOutElastic,easeInBack,easeOutBack,easeInOutBack,easeInBounce,easeOutBounce,easeInOutBounce',
724
  'id' => $this->db_prefix.$i.'_scrollEasing',
725
  'field_type' => 'select',
726
- 'label' => 'Scroll animation easing',
727
  'checkbox_label' => null,
728
  'radio_labels' => null,
729
  'field_info' => null,
730
- 'description' => 'Animation easing when page is idle',
731
  'wrapper' => null
732
  ),
733
  'scrollingEasing' => array(
@@ -739,7 +785,7 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
739
  'checkbox_label' => null,
740
  'radio_labels' => null,
741
  'field_info' => null,
742
- 'description' => 'Animation easing while page is animating',
743
  'wrapper' => null
744
  ),
745
  'pageEndSmoothScroll' => array(
@@ -747,11 +793,23 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
747
  'values' => null,
748
  'id' => $this->db_prefix.$i.'_pageEndSmoothScroll',
749
  'field_type' => 'checkbox',
750
- 'label' => 'Scroll-to position',
751
- 'checkbox_label' => 'Auto-adjust',
 
 
 
 
 
 
 
 
 
 
 
 
752
  'radio_labels' => null,
753
  'field_info' => null,
754
- 'description' => 'Auto-adjust the scroll-to position so it does not exceed document length',
755
  'wrapper' => 'fieldset'
756
  ),
757
  'layout' => array(
@@ -763,7 +821,7 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
763
  'checkbox_label' => null,
764
  'radio_labels' => 'vertical|horizontal|auto',
765
  'field_info' => null,
766
- 'description' => 'Restrict page scrolling to top-bottom (vertical) or left-right (horizontal) accordingly. For both vertical and horizontal scrolling select <code>auto</code>',
767
  'wrapper' => 'fieldset'
768
  ),
769
  'offset' => array(
@@ -775,7 +833,7 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
775
  'checkbox_label' => null,
776
  'radio_labels' => null,
777
  'field_info' => 'pixels',
778
- 'description' => 'Offset scroll-to position by x amount of pixels (positive or negative) or by selector (e.g. <code>#navigation-menu</code>)',
779
  'wrapper' => null
780
  ),
781
  'highlightSelector' => array(
@@ -787,7 +845,7 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
787
  'checkbox_label' => null,
788
  'radio_labels' => null,
789
  'field_info' => null,
790
- 'description' => 'The link(s) that are highlighted. Leave empty to highlight all or enter your specific selector(s)',
791
  'wrapper' => null
792
  ),
793
  'clickedClass' => array(
@@ -795,11 +853,11 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
795
  'values' => null,
796
  'id' => $this->db_prefix.$i.'_clickedClass',
797
  'field_type' => 'text',
798
- 'label' => 'Classes',
799
  'checkbox_label' => null,
800
  'radio_labels' => null,
801
  'field_info' => 'class name',
802
- 'description' => 'Class of the clicked link',
803
  'wrapper' => null
804
  ),
805
  'targetClass' => array(
@@ -811,7 +869,7 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
811
  'checkbox_label' => null,
812
  'radio_labels' => null,
813
  'field_info' => 'class name',
814
- 'description' => 'Class of the (current) target element. First (current) target element class suffix: <code>-first</code> (e.g. <code>.mPS2id-target-first</code>). Last (current) target element class suffix: <code>-last</code> (e.g. <code>.mPS2id-target-last</code>)',
815
  'wrapper' => null
816
  ),
817
  'highlightClass' => array(
@@ -823,7 +881,7 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
823
  'checkbox_label' => null,
824
  'radio_labels' => null,
825
  'field_info' => 'class name',
826
- 'description' => 'Class of the (current) highlighted element. First (current) highlighted element class suffix: <code>-first</code> (e.g. <code>.mPS2id-highlight-first</code>). Last (current) highlighted element class suffix: <code>-last</code> (e.g. <code>.mPS2id-highlight-last</code>)',
827
  'wrapper' => null
828
  ),
829
  'forceSingleHighlight' => array(
@@ -832,10 +890,10 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
832
  'id' => $this->db_prefix.$i.'_forceSingleHighlight',
833
  'field_type' => 'checkbox',
834
  'label' => '',
835
- 'checkbox_label' => 'Force single highlight',
836
  'radio_labels' => null,
837
  'field_info' => null,
838
- 'description' => 'Allow only one highlighted element at a time',
839
  'wrapper' => 'fieldset'
840
  ),
841
  'keepHighlightUntilNext' => array(
@@ -844,10 +902,10 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
844
  'id' => $this->db_prefix.$i.'_keepHighlightUntilNext',
845
  'field_type' => 'checkbox',
846
  'label' => '',
847
- 'checkbox_label' => 'Keep highlight until next',
848
  'radio_labels' => null,
849
  'field_info' => null,
850
- 'description' => 'Keep the current element highlighted until the next one comes into view',
851
  'wrapper' => 'fieldset'
852
  ),
853
  'highlightByNextTarget' => array(
@@ -862,16 +920,28 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
862
  'description' => 'Set targets length according to their next adjacent target position (useful when target elements have zero dimensions)',
863
  'wrapper' => 'fieldset'
864
  ),
 
 
 
 
 
 
 
 
 
 
 
 
865
  'scrollToHash' => array(
866
  'value' => $v13,
867
  'values' => null,
868
  'id' => $this->db_prefix.$i.'_scrollToHash',
869
  'field_type' => 'checkbox',
870
- 'label' => 'Scroll to location hash',
871
- 'checkbox_label' => 'Enable',
872
  'radio_labels' => null,
873
  'field_info' => null,
874
- 'description' => 'Scroll to target id (e.g. <code>&lt;div id="id" /&gt;</code>) based on location hash (e.g. <code>mysite.com/mypage#id</code>) on page load',
875
  'wrapper' => 'fieldset'
876
  ),
877
  'scrollToHashForAll' => array(
@@ -880,7 +950,7 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
880
  'id' => $this->db_prefix.$i.'_scrollToHashForAll',
881
  'field_type' => 'checkbox',
882
  'label' => '',
883
- 'checkbox_label' => 'Enable for all targets (even for elements that are not handled by the plugin)',
884
  'radio_labels' => null,
885
  'field_info' => null,
886
  'description' => null,
@@ -894,8 +964,8 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
894
  'label' => '',
895
  'checkbox_label' => null,
896
  'radio_labels' => null,
897
- 'field_info' => 'Delay (milliseconds)',
898
- 'description' => 'Scroll to location hash animation delay in milliseconds (1000 milliseconds equals 1 second)',
899
  'wrapper' => null
900
  ),
901
  'disablePluginBelow' => array(
@@ -907,7 +977,7 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
907
  'checkbox_label' => null,
908
  'radio_labels' => null,
909
  'field_info' => 'screen-size',
910
- 'description' => 'Set the width,height screen-size (in pixels), below which the plugin will be disabled (e.g. <code>1024</code>, <code>1024,600</code>)',
911
  'wrapper' => null
912
  ),
913
  'adminDisplayWidgetsId' => array(
@@ -933,6 +1003,30 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
933
  'field_info' => null,
934
  'description' => '<small>Requires WordPress version 3.9 or higher</small>',
935
  'wrapper' => 'fieldset'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
936
  )
937
  );
938
  }
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.2
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.2'; // Plugin version --edit--
51
  protected $update_option=null;
52
 
53
  protected $plugin_name='Page scroll to id'; // Plugin name --edit--
64
 
65
  protected $plugin_script='jquery.malihu.PageScroll2id.js'; // Plugin public script (main js plugin file) --edit--
66
  protected $plugin_init_script='jquery.malihu.PageScroll2id-init.js'; // Plugin public initialization script --edit--
67
+ protected $plugin_production_script='page-scroll-to-id.min.js'; // Plugin public production script (main + init) --edit--
68
 
69
  private function __construct(){
70
  // Plugin requires PHP version 5.2 or higher
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
98
+ }
99
  add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'));
100
  // Add plugin settings link
101
  add_filter('plugin_action_links_'.plugin_basename(__FILE__), array($this, 'add_plugin_action_links'));
165
  // front-end plugin scripts
166
  public function enqueue_scripts(){
167
  wp_enqueue_script('jquery');
168
+ /*
169
+ to load the unminified script files, in config.php use:
170
+ define('PS2ID_MINIFIED_JS', false);
171
+ */
172
+ if(PS2ID_MINIFIED_JS){
173
+ //production minified single file
174
+ wp_register_script($this->plugin_slug.'-plugin-script', plugins_url('js/'.$this->plugin_production_script, __FILE__), array('jquery'), $this->version, 1);
175
+ wp_enqueue_script($this->plugin_slug.'-plugin-script');
176
+ }else{
177
+ //development unminified files
178
+ wp_register_script($this->plugin_slug.'-plugin-script', plugins_url('js/'.$this->plugin_script, __FILE__), array('jquery'), $this->version, 1);
179
+ wp_enqueue_script($this->plugin_slug.'-plugin-script');
180
+ wp_register_script($this->plugin_slug.'-plugin-init-script', plugins_url('js/'.$this->plugin_init_script, __FILE__), array('jquery', $this->plugin_slug.'-plugin-script'), $this->version, 1);
181
+ wp_enqueue_script($this->plugin_slug.'-plugin-init-script');
182
+ }
183
  $this->plugin_fn_call();
184
  $this->add_plugin_shortcode(); // Remove/comment for plugin without any shortcodes --edit--
185
+ //test
186
+ /*if(PS2ID_MINIFIED_JS){
187
+ $this->debug_to_console('load js '.PS2ID_MINIFIED_JS);
188
+ }*/
189
  }
190
 
191
  public function add_plugin_admin_menu(){
321
 
322
  public function plugin_fn_call(){
323
  $instances=get_option($this->db_prefix.'instances');
324
+ //filter only necessary values
325
+ $instancesOptions=new stdClass();
326
+ foreach ($instances as $i_key => $instanceOptions){
327
+ $instancesOptions->$i_key = new stdClass();
328
+ foreach ($instanceOptions as $o_key => $instanceOption){
329
+ $instancesOptions->$i_key->$o_key = $instanceOption['value'];
330
+ }
331
+ }
332
  $params=array(
333
+ 'instances' => $instancesOptions, //pass filtered values
334
  'total_instances' => count($instances),
335
  'shortcode_class' => '_'.$this->sc_pfx
336
  );
337
+ $loc_script=PS2ID_MINIFIED_JS ? $this->plugin_slug.'-plugin-script' : $this->plugin_slug.'-plugin-init-script';
338
+ wp_localize_script($loc_script, $this->pl_pfx.'params', $params);
339
  }
340
 
341
  public function add_plugin_shortcode(){
357
  "offset" => "",
358
  "id" => "",
359
  "target" => "",
360
+ "class" => "",
361
  ), $atts));
362
  if($id!==""){
363
  if($content){
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]);
458
  $old_db_opt7=get_option('malihu_pagescroll2id_layout');
459
  return array(
460
  ($old_db_opt1) ? $old_db_opt1 : 'a[rel=\'m_PageScroll2id\']',
461
+ ($old_db_opt2) ? $old_db_opt2 : 1000,
462
  ($old_db_opt3) ? $old_db_opt3 : 'true',
463
+ ($old_db_opt4) ? $old_db_opt4 : 'easeInOutQuint',
464
+ ($old_db_opt5) ? $old_db_opt5 : 'easeOutQuint',
465
  ($old_db_opt6) ? $old_db_opt6 : 'true',
466
  ($old_db_opt7) ? $old_db_opt7 : 'vertical'
467
  );
545
  $pl_instances=get_option($this->db_prefix.'instances', $this->default);
546
  $pl_i=$pl_instances[$this->pl_pfx.'instance_0'];
547
  // WP Menu API menus HTML attributes (requires WP version 3.6 or higher)
548
+ if(isset($pl_i['autoSelectorMenuLinks']) && $pl_i['autoSelectorMenuLinks']['value']=='true'){
549
  add_filter('nav_menu_link_attributes', array($this, 'wp_menu_links_custom_atts'), 10, 3);
550
  }
551
  // tinyMCE buttons (requires WP version 3.9 or higher)
552
+ if(version_compare(get_bloginfo('version'), '3.9', '>=') && isset($pl_i['adminTinyMCEbuttons']) && $pl_i['adminTinyMCEbuttons']['value']=='true'){
553
  $plugin_tinymce = new malihuPageScroll2idtinymce();
554
  add_action('admin_head', array($plugin_tinymce, 'add_custom_button'));
555
  }
556
  // Display widgets id attribute
557
+ if(isset($pl_i['adminDisplayWidgetsId']) && $pl_i['adminDisplayWidgetsId']['value']=='true'){
558
  add_action('widget_form_callback', array($this, 'display_widget_id'), 10, 2);
559
  }
560
  }
580
  // --edit--
581
  // Defaults
582
  $d0='a[rel=\'m_PageScroll2id\']';
583
+ $d19='true';
584
+ $d1=1000;
585
  $d2='true';
586
+ $d3='easeInOutQuint';
587
+ $d4='easeOutQuint';
588
  $d5='true';
589
+ $d24='false';
590
  $d6='vertical';
591
  $d7=0;
592
  $d8='';
596
  $d12='false';
597
  $d14='false';
598
  $d16='false';
599
+ $d22='false';
600
+ $d13='true';
601
+ $d17='true';
602
  $d18=0;
603
  $d15=0;
604
  $d20='true';
605
  $d21='true';
606
+ $d23='false';
607
+ $d25='false';
608
  // Values
609
  switch($action){
610
  case 'validate':
615
  $v3=$_POST[$this->db_prefix.$i.'_scrollEasing'];
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);
625
  $v12=(isset($_POST[$this->db_prefix.$i.'_forceSingleHighlight'])) ? 'true' : 'false';
626
  $v14=(isset($_POST[$this->db_prefix.$i.'_keepHighlightUntilNext'])) ? 'true' : 'false';
627
  $v16=(isset($_POST[$this->db_prefix.$i.'_highlightByNextTarget'])) ? 'true' : 'false';
628
+ $v22=(isset($_POST[$this->db_prefix.$i.'_appendHash'])) ? 'true' : 'false';
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';
635
+ $v23=(isset($_POST[$this->db_prefix.$i.'_unbindUnrelatedClickEvents'])) ? 'true' : 'false';
636
+ $v25=(isset($_POST[$this->db_prefix.$i.'_normalizeAnchorPointTargets'])) ? 'true' : 'false';
637
  break;
638
  case 'upgrade':
639
  if(isset($old)){
661
  $v12=(isset($j['forceSingleHighlight'])) ? $j['forceSingleHighlight']['value'] : $d12;
662
  $v14=(isset($j['keepHighlightUntilNext'])) ? $j['keepHighlightUntilNext']['value'] : $d14;
663
  $v16=(isset($j['highlightByNextTarget'])) ? $j['highlightByNextTarget']['value'] : $d16;
664
+ $v22=(isset($j['appendHash'])) ? $j['appendHash']['value'] : $d22;
665
  $v13=(isset($j['scrollToHash'])) ? $j['scrollToHash']['value'] : $d13;
666
  $v17=(isset($j['scrollToHashForAll'])) ? $j['scrollToHashForAll']['value'] : $d17;
667
  $v18=(isset($j['scrollToHashDelay'])) ? $j['scrollToHashDelay']['value'] : $d18;
669
  $v19=(isset($j['autoSelectorMenuLinks'])) ? $j['autoSelectorMenuLinks']['value'] : $d19;
670
  $v20=(isset($j['adminDisplayWidgetsId'])) ? $j['adminDisplayWidgetsId']['value'] : $d20;
671
  $v21=(isset($j['adminTinyMCEbuttons'])) ? $j['adminTinyMCEbuttons']['value'] : $d21;
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;
681
  $v3=$d3;
682
  $v4=$d4;
683
  $v5=$d5;
684
+ $v24=$d24;
685
  $v6=$d6;
686
  $v7=$d7;
687
  $v8=$d8;
691
  $v12=$d12;
692
  $v14=$d14;
693
  $v16=$d16;
694
+ $v22=$d22;
695
  $v13=$d13;
696
  $v17=$d17;
697
  $v18=$d18;
698
  $v15=$d15;
699
  $v20=$d20;
700
  $v21=$d21;
701
+ $v23=$d23;
702
+ $v25=$d25;
703
  }
704
  // Options array
705
  /*
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>rel</code> attribute equal to <code>m_PageScroll2id</code>) <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>',
729
  'wrapper' => null
730
  ),
731
  'autoSelectorMenuLinks' => array(
737
  'checkbox_label' => 'Enable on WordPress Menu links',
738
  'radio_labels' => null,
739
  'field_info' => null,
740
+ 'description' => 'Automatically enable the plugin on custom links (containing <code>#</code> in their URL) created in Appearance &rarr; Menus <br /><small>Requires WordPress version 3.6 or higher</small>',
741
  'wrapper' => 'fieldset'
742
  ),
743
  'scrollSpeed' => array(
745
  'values' => null,
746
  'id' => $this->db_prefix.$i.'_scrollSpeed',
747
  'field_type' => 'text-integer',
748
+ 'label' => 'Scroll duration',
749
  'checkbox_label' => null,
750
  'radio_labels' => null,
751
  'field_info' => 'milliseconds',
752
+ 'description' => 'Scroll animation duration (i.e. scrolling speed) in milliseconds (1000 milliseconds equal 1 second)',
753
  'wrapper' => null
754
  ),
755
  'autoScrollSpeed' => array(
758
  'id' => $this->db_prefix.$i.'_autoScrollSpeed',
759
  'field_type' => 'checkbox',
760
  'label' => '',
761
+ 'checkbox_label' => 'Auto-adjust scrolling duration',
762
  'radio_labels' => null,
763
  'field_info' => null,
764
+ 'description' => 'Enable to let the plugin fine-tune scrolling duration/speed according to target and page scroll position',
765
  'wrapper' => 'fieldset'
766
  ),
767
  'scrollEasing' => array(
769
  'values' => 'linear,swing,easeInQuad,easeOutQuad,easeInOutQuad,easeInCubic,easeOutCubic,easeInOutCubic,easeInQuart,easeOutQuart,easeInOutQuart,easeInQuint,easeOutQuint,easeInOutQuint,easeInExpo,easeOutExpo,easeInOutExpo,easeInSine,easeOutSine,easeInOutSine,easeInCirc,easeOutCirc,easeInOutCirc,easeInElastic,easeOutElastic,easeInOutElastic,easeInBack,easeOutBack,easeInOutBack,easeInBounce,easeOutBounce,easeInOutBounce',
770
  'id' => $this->db_prefix.$i.'_scrollEasing',
771
  'field_type' => 'select',
772
+ 'label' => 'Scroll type/easing',
773
  'checkbox_label' => null,
774
  'radio_labels' => null,
775
  'field_info' => null,
776
+ 'description' => 'Scroll animation easing (<a href="http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#ps2id-duration-easings-demo" target="_blank">visual representation &amp; demo of all easing types</a>)',
777
  'wrapper' => null
778
  ),
779
  'scrollingEasing' => array(
785
  'checkbox_label' => null,
786
  'radio_labels' => null,
787
  'field_info' => null,
788
+ 'description' => 'Alternative animation easing (applied when a link is clicked while the page is animated/scrolling)',
789
  'wrapper' => null
790
  ),
791
  'pageEndSmoothScroll' => array(
793
  'values' => null,
794
  'id' => $this->db_prefix.$i.'_pageEndSmoothScroll',
795
  'field_type' => 'checkbox',
796
+ 'label' => 'Scroll behavior',
797
+ 'checkbox_label' => 'Always scroll smoothly when reaching the end of the page/document',
798
+ 'radio_labels' => null,
799
+ 'field_info' => null,
800
+ 'description' => null,
801
+ 'wrapper' => 'fieldset'
802
+ ),
803
+ 'stopScrollOnUserAction' => array(
804
+ 'value' => $v24,
805
+ 'values' => null,
806
+ 'id' => $this->db_prefix.$i.'_stopScrollOnUserAction',
807
+ 'field_type' => 'checkbox',
808
+ 'label' => '',
809
+ 'checkbox_label' => 'Stop page scrolling on mouse-wheel or touch-swipe',
810
  'radio_labels' => null,
811
  'field_info' => null,
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(
821
  'checkbox_label' => null,
822
  'radio_labels' => 'vertical|horizontal|auto',
823
  'field_info' => null,
824
+ 'description' => 'Restrict page scrolling to top-bottom (vertical) or left-right (horizontal) accordingly. For both vertical and horizontal scrolling select <code>auto</code> <br /><small>Please note that "Layout" option does not transform your theme&#8217;s templates layout (i.e. it won&#8217;t change your theme/page design from vertical to horizontal).</small>',
825
  'wrapper' => 'fieldset'
826
  ),
827
  'offset' => array(
833
  'checkbox_label' => null,
834
  'radio_labels' => null,
835
  'field_info' => 'pixels',
836
+ '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>)',
837
  'wrapper' => null
838
  ),
839
  'highlightSelector' => array(
845
  'checkbox_label' => null,
846
  'radio_labels' => null,
847
  'field_info' => null,
848
+ '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 eligible for highlighting (leave empty to highlight all)',
849
  'wrapper' => null
850
  ),
851
  'clickedClass' => array(
853
  'values' => null,
854
  'id' => $this->db_prefix.$i.'_clickedClass',
855
  'field_type' => 'text',
856
+ 'label' => 'Classes &amp; highlight options',
857
  'checkbox_label' => null,
858
  'radio_labels' => null,
859
  'field_info' => 'class name',
860
+ 'description' => 'Class of the clicked link. You can use this class (e.g. <code>.mPS2id-clicked</code>) in your CSS to style the clicked link.',
861
  'wrapper' => null
862
  ),
863
  'targetClass' => array(
869
  'checkbox_label' => null,
870
  'radio_labels' => null,
871
  'field_info' => 'class name',
872
+ 'description' => 'Class of the (current) target element. You can use this class (e.g. <code>.mPS2id-target</code>) in your CSS to style the highlighted target element(s). <br />If multiple elements are highlighted, you can use the <code>-first</code> or <code>-last</code> suffix in the class name (e.g. <code>.mPS2id-target-first</code>, <code>.mPS2id-target-last</code>) to style the first or last highlighted element accordingly',
873
  'wrapper' => null
874
  ),
875
  'highlightClass' => array(
881
  'checkbox_label' => null,
882
  'radio_labels' => null,
883
  'field_info' => 'class name',
884
+ 'description' => 'Class of the (current) highlighted link. You can use this class (e.g. <code>.mPS2id-highlight</code>) in your CSS to style the highlighted link(s). <br />If multiple links are highlighted, you can use the <code>-first</code> or <code>-last</code> suffix in the class name (e.g. <code>.mPS2id-highlight-first</code>, <code>.mPS2id-highlight-last</code>) to style the first or last highlighted links accordingly',
885
  'wrapper' => null
886
  ),
887
  'forceSingleHighlight' => array(
890
  'id' => $this->db_prefix.$i.'_forceSingleHighlight',
891
  'field_type' => 'checkbox',
892
  'label' => '',
893
+ 'checkbox_label' => 'Allow only one highlighted element at a time',
894
  'radio_labels' => null,
895
  'field_info' => null,
896
+ 'description' => null,
897
  'wrapper' => 'fieldset'
898
  ),
899
  'keepHighlightUntilNext' => array(
902
  'id' => $this->db_prefix.$i.'_keepHighlightUntilNext',
903
  'field_type' => 'checkbox',
904
  'label' => '',
905
+ 'checkbox_label' => 'Keep the current element highlighted until the next one comes into view (i.e. always keep at least one element highlighted)',
906
  'radio_labels' => null,
907
  'field_info' => null,
908
+ 'description' => null,
909
  'wrapper' => 'fieldset'
910
  ),
911
  'highlightByNextTarget' => array(
920
  'description' => 'Set targets length according to their next adjacent target position (useful when target elements have zero dimensions)',
921
  'wrapper' => 'fieldset'
922
  ),
923
+ 'appendHash' => array(
924
+ 'value' => $v22,
925
+ 'values' => null,
926
+ 'id' => $this->db_prefix.$i.'_appendHash',
927
+ 'field_type' => 'checkbox',
928
+ 'label' => 'Links behavior',
929
+ 'checkbox_label' => 'Append the clicked link&#8217;s hash value (e.g. <code>#id</code>) to browser&#8217;s URL/address bar',
930
+ 'radio_labels' => null,
931
+ 'field_info' => null,
932
+ 'description' => null,
933
+ 'wrapper' => 'fieldset'
934
+ ),
935
  'scrollToHash' => array(
936
  'value' => $v13,
937
  'values' => null,
938
  'id' => $this->db_prefix.$i.'_scrollToHash',
939
  'field_type' => 'checkbox',
940
+ 'label' => '',
941
+ 'checkbox_label' => 'Scroll from/to different pages (i.e. scroll to target when page loads)',
942
  'radio_labels' => null,
943
  'field_info' => null,
944
+ 'description' => null,
945
  'wrapper' => 'fieldset'
946
  ),
947
  'scrollToHashForAll' => array(
950
  'id' => $this->db_prefix.$i.'_scrollToHashForAll',
951
  'field_type' => 'checkbox',
952
  'label' => '',
953
+ 'checkbox_label' => 'Enable different pages scrolling on all links (even the ones that are not handled by the plugin)',
954
  'radio_labels' => null,
955
  'field_info' => null,
956
  'description' => null,
964
  'label' => '',
965
  'checkbox_label' => null,
966
  'radio_labels' => null,
967
+ 'field_info' => 'milliseconds delay for scrolling to target on page load',
968
+ 'description' => null,
969
  'wrapper' => null
970
  ),
971
  'disablePluginBelow' => array(
977
  'checkbox_label' => null,
978
  'radio_labels' => null,
979
  'field_info' => 'screen-size',
980
+ 'description' => 'Set the width,height screen-size (in pixels), below which the plugin will be disabled (e.g. <code>1024</code> or <code>1024,600</code>)',
981
  'wrapper' => null
982
  ),
983
  'adminDisplayWidgetsId' => array(
1003
  'field_info' => null,
1004
  'description' => '<small>Requires WordPress version 3.9 or higher</small>',
1005
  'wrapper' => 'fieldset'
1006
+ ),
1007
+ 'unbindUnrelatedClickEvents' => array(
1008
+ 'value' => $v23,
1009
+ 'values' => null,
1010
+ 'id' => $this->db_prefix.$i.'_unbindUnrelatedClickEvents',
1011
+ 'field_type' => 'checkbox',
1012
+ 'label' => 'Advanced options',
1013
+ 'checkbox_label' => 'Prevent other scripts from handling plugin&#8217;s links (if possible)',
1014
+ 'radio_labels' => null,
1015
+ 'field_info' => null,
1016
+ 'description' => 'Enable if another plugin or a theme script handles page scrolling and conflicts with "Page scroll to id" (removes other scripts js click events from the links)',
1017
+ 'wrapper' => 'fieldset'
1018
+ ),
1019
+ 'normalizeAnchorPointTargets' => array(
1020
+ 'value' => $v25,
1021
+ 'values' => null,
1022
+ 'id' => $this->db_prefix.$i.'_normalizeAnchorPointTargets',
1023
+ 'field_type' => 'checkbox',
1024
+ 'label' => '',
1025
+ 'checkbox_label' => 'Normalize anchor-point targets',
1026
+ 'radio_labels' => null,
1027
+ 'field_info' => null,
1028
+ 'description' => 'Force zero dimensions (via CSS) on targets created with <code>[ps2id]</code> shortcode',
1029
+ 'wrapper' => 'fieldset'
1030
  )
1031
  );
1032
  }
readme.txt CHANGED
@@ -1,57 +1,49 @@
1
- === Page scroll to id ===
2
  Contributors: malihu
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=UYJ5G65M6ZA28
4
- Tags: page scrolling, page animation, navigation, single-page navigation
5
  Requires at least: 3.3
6
- Tested up to: 4.7
7
- Stable tag: 1.6.1
8
  License: The MIT License (MIT)
9
  License URI: http://opensource.org/licenses/MIT
10
 
11
- Page scroll to id is an easy-to-use jQuery plugin that enables animated page scrolling to specific id within the document.
12
 
13
  == Description ==
14
 
15
- The plugin replaces the default browser behaviour of "jumping" to page sections when links with href value containing `#` are clicked, by smoothly animating the page to those sections. You can use it for simple back-to-top links or complex single-page website navigation. Features include:
16
 
17
- * Auto-adjustable animation speed
18
- * Advanced animation easings
19
- * Vertical and/or horizontal scrolling
20
- * Links and targets highlighting via ready-to-use CSS classes
21
- * Auto-adjustable scroll-to position
22
- * Advanced scroll-to position offset (by pixels, by element selector, link specific offsets etc.)
23
- * Page scrolling from/to different pages (scrolling to location hash)
24
 
25
- = Demo =
26
 
27
- * [Plugin demo: vertical layout](http://manos.malihu.gr/repository/page-scroll-to-id/demo/demo.html)
28
- * [Plugin demo: horizontal layout](http://manos.malihu.gr/repository/page-scroll-to-id/demo/demo-horizontal-layout.html)
29
- * [Plugin demo: auto layout](http://manos.malihu.gr/repository/page-scroll-to-id/demo/demo-auto-layout.html)
 
 
 
 
30
 
31
  = Requirements =
32
 
33
- Page scroll to id requires WordPress version **3.3** or higher and jQuery version **1.6.0** or higher. For older installations implement it in your theme [manually](http://manos.malihu.gr/page-scroll-to-id/). Your theme **must** (and should) have `wp_head()` and `wp_footer()` functions. In some MS Windows based web servers the plugin might produce an error 500 (depends on server/PHP configuration). To pinpoint the issue [enable debugging](https://codex.wordpress.org/Debugging_in_WordPress) in `wp-config.php` and check `wp-content/debug.log` file for relevant errors.
34
 
35
  = Quick usage and tips =
36
 
37
  1. [Install the plugin](http://wordpress.org/plugins/page-scroll-to-id/installation/).
38
- 2. Check "Enable on WordPress Menu links" in plugin's settings to automatically enable the plugin on your WordPress menus custom links.
39
- 3. Create your links and targets using plugin's shortcodes (see "Help" in plugin settings page) directly in WordPress post editor or via plugin's buttons in visual editor toolbar.
40
- 4. Create targets in widgets areas using "Page scroll to id target" widget.
41
- 5. Add the class `ps2id` on any link you want to be handled by the plugin.
42
- 6. If you prefer not to automatically enable the plugin on WordPress menus, use either `m_PageScroll2id` or `ps2id` values in 'Link Relationship (XFN)' and 'CSS Classes' fields accordingly. To enable the rel attribute field in WordPress Menus, click 'Screen Options' and check 'Link Relationship (XFN)'. To enable the plugin on a menu item, click the arrow on the right of the item and insert `m_PageScroll2id` in the 'Link Relationship (XFN)' field.
43
-
44
- = Tutorials =
45
-
46
- * [Page scroll to id for WordPress tutorial](http://manos.malihu.gr/page-scroll-to-id-for-wordpress-tutorial/)
47
-
48
- For more information see Help in plugin settings and resources below.
49
-
50
- = Plugin Resources =
51
 
52
- * [Plugin homepage](http://manos.malihu.gr/page-scroll-to-id/)
53
- * [FAQ](http://wordpress.org/plugins/page-scroll-to-id/faq/)
54
- * [Support](http://wordpress.org/support/plugin/page-scroll-to-id)
55
 
56
  == Installation ==
57
 
@@ -69,90 +61,46 @@ For more information see Help in plugin settings and resources below.
69
 
70
  = Configuration =
71
 
72
- Configure plugin options by clicking 'Settings' or through the 'Settings > Page Scroll to id' menu in WordPress.
73
 
74
  == Frequently Asked Questions ==
75
 
76
- = How to use the plugin with WP custom/native menus? =
77
-
78
- Check "Enable on WordPress Menu links" in plugin's settings to automatically enable the plugin on your WordPress menus custom links. If you prefer to do it manually, while on the 'Menus' admin page, click 'Screen Options' and check 'Link Relationship (XFN)'. To enable the plugin on a menu item (added to menu via 'Custom Links' panel), click the arrow on the right of the item and insert `m_PageScroll2id` in the 'Link Relationship (XFN)' field (assuming your menu contains links with `URL` value in the form of `#id`). Alternately, you can simply add the value `ps2id` in 'CSS Classes' field.
79
-
80
- = How to use the plugin without editing my theme's markup? =
81
-
82
- In plugin's configuration page ('Settings > Page Scroll to id' menu in WordPress), you can change the `Selector(s)` field value to existing matching sets of elements in your theme. For example: `a.class-name`, `#id a`, `a[href*='#']` etc. For multiple selectors, use comma separated values: e.g. `a[rel='m_PageScroll2id'], a.class-name`.
83
-
84
- = What if my links have rel values already set by the theme or other plugins? =
85
-
86
- You can add the `m_PageScroll2id` in your link's rel attribute (along with the other values) and change the `Selector(s)` field value to `a[rel~='m_PageScroll2id']` in plugin settings.
87
-
88
- = How do I highlight current menu items? =
89
-
90
- The plugin provides a ready-to-use class for styling highlighted links (the links whose target element is considered to be within the viewport). The default highlight class is `mPS2id-highlight`, so you can use it in your theme's CSS to style current menu items, e.g. `.menu-item a.mPS2id-highlight{ background: #ff0; }`.
91
-
92
- = More than one links are highlighted! How to highlight only the first one? =
93
-
94
- Use the `mPS2id-highlight-first` class in your stylesheet (instead of just `mPS2id-highlight`). This class is added by the script on the first link whose target element is considered to be within the viewport, e.g. `.menu-item a.mPS2id-highlight-first{ background: #ff0; }`. Alternatively, enable 'Force single highlight' option in plugin settings.
95
-
96
- = How to keep my links highlighted when my target elements have 0 height? =
97
-
98
- Enable 'Keep highlight until next' option in plugin settings, which keeps the current highlighted element on until the next one comes into view.
99
-
100
- = When I click the link, nothing happens... =
101
-
102
- Make sure your link has href value `#` with the id of the section you want to scroll-to (e.g. `<a href="#id" rel="m_PageScroll2id">link</a>`) and a section with such an id exists in your page (e.g. `<div id="id">target</div>`).
103
-
104
- = How do I make my links work from other/different pages =
105
-
106
- To make your links work from any page, you need to add the full address in your links href (instead of just the hash with the id). For example, you'll need to change `<a href="#id" rel="m_PageScroll2id">link</a>` to something like `<a href="http://mysite.com/some-page/#id" rel="m_PageScroll2id">link</a>`. The same applies for your WP custom menus. You'll need to insert the full address in the `URL` field. To enable page scrolling to URL location hash on page load, check `Scroll to location hash` in plugin settings.
107
-
108
- = The page doesn't scroll exactly where I want =
109
 
110
- The scroll-to position is the top position of your target element. Your target's top position does not include its margins, so make sure to check your element's actual position via your browser's developer tools and change your CSS if needed. You can also offset the scroll-to position by setting an `offset` value (in pixels) in plugin's settings.
111
-
112
- = The page doesn't scroll to the very top =
113
-
114
- Your target element is probably not at the very top (check its position via your browser's developer tools). If your link has href value `#top` and no target with id `top` exists in your page, the plugin will automatically scroll the page to the very top (the position of the `body` tag).
115
-
116
- = How to prevent my fixed navigation menu overlapping the content? =
117
-
118
- Insert your menu selector in the Offset field in plugin settings. For example, if you have a fixed menu with id `navigation-menu`, set Offset to `#navigation-menu` in order to stop page scrolling below it and avoid overlapping your content.
119
-
120
- = Can I set different vertical and horizontal offsets? =
121
-
122
- Yes, by inserting comma separated values in `Offset` field For example `100,50` will set vertical offset to 100 and horizontal offset to 50 pixels.
123
-
124
- = Can I specify link specific offset values? =
125
-
126
- Yes, by adding the html attribute `data-ps2id-offset` to a link. For example, `<a href="#id" rel="m_PageScroll2id" data-ps2id-offset="100">link</a>` will offset scroll-to position by 100 pixels. You may also use the `ps2id` shortcode to create links with specific offsets, e.g. `[ps2id url='#id' offset='100']link[/ps2id]`.
127
-
128
- = How do I disable the plugin on small screens? =
129
-
130
- Use the 'Disable plugin below screen-size' option in plugin settings. You can set a minimum width,height value required in order to enable plugin functionality.
131
-
132
- = Can I use the plugin to scroll an overflowed div? =
133
-
134
- No. The plugin scrolls the entire page (the document's root element) so it works correctly highlighting links, alongside deep linking plugins etc. with mouse and touch events.
135
-
136
- = Do you support Internet Explorer 7? =
137
-
138
- No. IE7 usage is non-existent.
139
-
140
- = Does the plugin offer user defined callbacks, scroll-to method or some other advanced feature? =
141
 
142
- Yes but you probably need to implement the plugin in your theme **manually**. See [Plugin homepage](http://manos.malihu.gr/page-scroll-to-id/) for more info.
143
 
144
- == Screenshots ==
145
 
146
- 1. Page scoll to id settings
147
 
148
- 2. Page scoll to id settings help
149
 
150
- 3. Multiple selectors
151
 
152
- 4. Page scoll to id target widget
153
 
154
  == Changelog ==
155
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
156
  = 1.6.1 =
157
  * Added additional default selectors: `.ps2id > a[href*='#'],a.ps2id[href*='#']`.
158
  * Added "Page scroll to id target" widget.
@@ -243,6 +191,10 @@ Yes but you probably need to implement the plugin in your theme **manually**. Se
243
 
244
  == Upgrade Notice ==
245
 
 
 
 
 
246
  = 1.6.1 =
247
 
248
  Fixed browser's history back button for 'Scroll to location hash' option, added new options ('Enable on WordPress Menu links'), added plugin's target widget, added plugin's buttons in visual editor, extended default selectors, updated help and readme.txt.
@@ -294,7 +246,15 @@ If not, see <http://opensource.org/licenses/MIT>.
294
 
295
  If you like this plugin and find it useful, consider making a [donation](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=UYJ5G65M6ZA28) :).
296
 
297
- == External resources ==
 
 
 
 
298
 
 
 
299
  * [Smooth scrolling between page sections using Page scroll to id](http://sridharkatakam.com/smooth-scrolling-page-sections-using-page-scroll-id/)
300
- * [Video tutorial: How to create a single page WordPress website](http://www.pootlepress.com/2013/02/video-tutorial-a-beginners-guide-on-how-to-create-a-single-page-wordpress-website/)
 
 
1
+ === Page scroll to id ===
2
  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: 4.9
7
+ Stable tag: 1.6.2
8
  License: The MIT License (MIT)
9
  License URI: http://opensource.org/licenses/MIT
10
 
11
+ Create links that scroll the page smoothly to any id within the document.
12
 
13
  == Description ==
14
 
15
+ **Page scroll to id** is a fully featured plugin which replaces browser's "jumping" behavior with a [smooth scrolling animation](http://manos.malihu.gr/repository/page-scroll-to-id/demo/demo.html), when links with href value containing # are clicked. It provides all the basic tools and advanced functionality for single-page websites, in-page navigation, back-to-top links etc. with features like:
16
 
17
+ * Adjustable scrolling animation [duration and easing (over 30 easing types)](http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#plugin-settings-scroll-type-easing)
18
+ * Link and target highlighting via ready-to-use CSS classes
19
+ * [Vertical](http://manos.malihu.gr/repository/page-scroll-to-id/demo/demo.html) and/or [horizontal](http://manos.malihu.gr/repository/page-scroll-to-id/demo/demo-horizontal-layout.html) scrolling
20
+ * Scrolling from/to different pages (scrolling to target id on page load)
21
+ * Offset scrolling by pixels or element selector with custom expressions
22
+ * Insert link and target id buttons in post visual editor
23
+ * Link-specific offset, scrolling duration, highlight target etc.
24
 
25
+ [Demo (default animation duration/easing, link highlighting etc.)](http://manos.malihu.gr/repository/page-scroll-to-id/demo/demo.html)
26
 
27
+ = Plugin resources, links and tutorials =
28
+
29
+ * [Plugin homepage](http://manos.malihu.gr/page-scroll-to-id-for-wordpress/)
30
+ * [Knowledge Base - FAQ](http://manos.malihu.gr/page-scroll-to-id-for-wordpress/2/)
31
+ * [Basic tutorial](http://manos.malihu.gr/page-scroll-to-id-for-wordpress-tutorial/) - [Video tutorial](http://manos.malihu.gr/page-scroll-to-id-for-wordpress-tutorial/#video-tutorial)
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
+ * [Support](http://wordpress.org/support/plugin/page-scroll-to-id)
34
 
35
  = Requirements =
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/).
42
+ 2. The plugin is enabled by default on your WordPress Menu links, so you can start adding custom links and set their URL to the id/target you want to scroll to.
43
+ 3. Create id targets within your content using plugin's "Insert Page scroll to id target" button and/or shortcode (see contextual "Help" menu in plugin settings page) in post visual/text editor. Create targets in widgets areas using "Page scroll to id target" widget.
44
+ 5. Create links within your content using plugin's "Insert/edit Page scroll to id link" button and/or shortcode in post visual/text editor. You can also add the class `ps2id` on any existing link you want to be handled by the plugin.
 
 
 
 
 
 
 
 
 
 
45
 
46
+ For more info [see plugin's basic tutorial](http://manos.malihu.gr/page-scroll-to-id-for-wordpress-tutorial/)
 
 
47
 
48
  == Installation ==
49
 
61
 
62
  = Configuration =
63
 
64
+ Configure plugin options by clicking 'Settings' under plugin name or through the 'Settings' menu in WordPress administration.
65
 
66
  == Frequently Asked Questions ==
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
73
 
74
+ 2. "Page scoll to id" settings help
75
 
76
+ 3. Multiple selectors in plugin settings
77
 
78
+ 4. "Page scoll to id" target widget and widget id values
79
 
80
+ 5. Visual editor "Insert/edit Page scoll to id link" modal
81
 
82
+ 6. Visual editor "Insert Page scoll to id target" modal
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.
89
+ * Added special class/option for creating links with alternative scroll duration/speed.
90
+ * Extended plugin buttons on WordPress visual editor (non-shortcode links, custom classes etc.).
91
+ * Added new option 'Append the clicked link’s hash value to browser’s URL/address bar'.
92
+ * Added new option 'Stop page scrolling on mouse-wheel or touch-swipe'.
93
+ * Added new option 'Prevent other scripts from handling plugin’s links'.
94
+ * Added new option 'Normalize anchor-point targets'.
95
+ * Relative-root links are now properly highlighted.
96
+ * Added `wp-config.php` option for selecting which script files the plugin loads (minified or uncompressed).
97
+ * Only necessary CDATA values are passed on the front-end script.
98
+ * Added compatibility for latest non-WordPress jQuery versions (2.x and 3.x).
99
+ * Fixed a bug regarding shortcode's offset attribute when used with "auto" layout.
100
+ * Fixed a php notice when updating plugin from version 1.6.0.
101
+ * Added workaround for IE/Edge not starting from the top when scrolling to hash on page load.
102
+ * Updated readme.txt, contextual help and documentation.
103
+
104
  = 1.6.1 =
105
  * Added additional default selectors: `.ps2id > a[href*='#'],a.ps2id[href*='#']`.
106
  * Added "Page scroll to id target" widget.
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.
197
+
198
  = 1.6.1 =
199
 
200
  Fixed browser's history back button for 'Scroll to location hash' option, added new options ('Enable on WordPress Menu links'), added plugin's target widget, added plugin's buttons in visual editor, extended default selectors, updated help and readme.txt.
246
 
247
  If you like this plugin and find it useful, consider making a [donation](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=UYJ5G65M6ZA28) :).
248
 
249
+ == Plugin previous/other versions ==
250
+
251
+ [All plugin versions](http://manos.malihu.gr/page-scroll-to-id-for-wordpress/#plugin-versions)
252
+
253
+ == Other/external resources ==
254
 
255
+ * [Using Page scroll to id with the Divi Builder plugin](http://manos.malihu.gr/using-page-scroll-to-id-with-the-divi-builder-plugin/)
256
+ * [One Page WordPress Smooth Scrolling Menu - How to Use Page Scroll to ID Plugin 2017](https://www.youtube.com/watch?v=ZJt7-0W-DeE)
257
  * [Smooth scrolling between page sections using Page scroll to id](http://sridharkatakam.com/smooth-scrolling-page-sections-using-page-scroll-id/)
258
+ * [Video tutorial: How to create a single page WordPress website](http://www.pootlepress.com/2013/02/video-tutorial-a-beginners-guide-on-how-to-create-a-single-page-wordpress-website/)
259
+ * [GeneratePress - Elementor - Page Scroll to ID - One Page Website](http://snifflevalve.com/tutorials/generatepress-elementor-page-scroll-id-one-page-website/)
260
+ * [Onepage Wordpress - Page scroll to iD plugin](https://www.youtube.com/watch?v=XZ4SbV3aZb8)
screenshot-1.png CHANGED
Binary file
screenshot-2.png CHANGED
Binary file
screenshot-3.png ADDED
Binary file
screenshot-4.png ADDED
Binary file
screenshot-5.png ADDED
Binary file
screenshot-6.png ADDED
Binary file