Version Description
*Fix: wp enqueue script error when turning WP_DEBUG mode on
Download this release
Release Info
Developer | Jeriff Cheng |
Plugin | Easy Smooth Scroll Links |
Version | 1.3.1 |
Comparing to | |
See all releases |
Code changes from version 1.0 to 1.3.1
- easy_smooth_scroll_links.js +0 -10
- easy_smooth_scroll_links.php +0 -46
- index.php +152 -0
- options.php +46 -0
- readme.txt +42 -10
- screenshot-1.png +0 -0
- screenshot-2.png +0 -0
easy_smooth_scroll_links.js
DELETED
@@ -1,10 +0,0 @@
|
|
1 |
-
/*Easy Smooth Scroll Links,Plugin URI: http://www.92app.com/wordpress-plugins/easy-smooth-scroll-links*/
|
2 |
-
var ss={fixAllLinks:function(){var allLinks=document.getElementsByTagName('a');for(var i=0;i<allLinks.length;i++){var lnk=allLinks[i];if((lnk.href&&lnk.href.indexOf('#')!=-1)&&((lnk.pathname==location.pathname)||('/'+lnk.pathname==location.pathname))&&(lnk.search==location.search)){ss.addEvent(lnk,'click',ss.smoothScroll);}}},smoothScroll:function(e){if(window.event){target=window.event.srcElement;}else if(e){target=e.target;}else return;if(target.nodeName.toLowerCase()!='a'){target=target.parentNode;}
|
3 |
-
if(target.nodeName.toLowerCase()!='a')return;anchor=target.hash.substr(1);var allLinks=document.getElementsByTagName('a');var destinationLink=null;for(var i=0;i<allLinks.length;i++){var lnk=allLinks[i];if(lnk.name&&(lnk.name==anchor)){destinationLink=lnk;break;}}
|
4 |
-
if(!destinationLink)destinationLink=document.getElementById(anchor);if(!destinationLink)return true;var destx=destinationLink.offsetLeft;var desty=destinationLink.offsetTop;var thisNode=destinationLink;while(thisNode.offsetParent&&(thisNode.offsetParent!=document.body)){thisNode=thisNode.offsetParent;destx+=thisNode.offsetLeft;desty+=thisNode.offsetTop;}
|
5 |
-
clearInterval(ss.INTERVAL);cypos=ss.getCurrentYPos();ss_stepsize=parseInt((desty-cypos)/ss.STEPS);ss.INTERVAL=setInterval('ss.scrollWindow('+ss_stepsize+','+desty+',"'+anchor+'")',10);if(window.event){window.event.cancelBubble=true;window.event.returnValue=false;}
|
6 |
-
if(e&&e.preventDefault&&e.stopPropagation){e.preventDefault();e.stopPropagation();}},scrollWindow:function(scramount,dest,anchor){wascypos=ss.getCurrentYPos();isAbove=(wascypos<dest);window.scrollTo(0,wascypos+scramount);iscypos=ss.getCurrentYPos();isAboveNow=(iscypos<dest);if((isAbove!=isAboveNow)||(wascypos==iscypos)){window.scrollTo(0,dest);clearInterval(ss.INTERVAL);location.hash=anchor;}},getCurrentYPos:function(){if(document.body&&document.body.scrollTop)
|
7 |
-
return document.body.scrollTop;if(document.documentElement&&document.documentElement.scrollTop)
|
8 |
-
return document.documentElement.scrollTop;if(window.pageYOffset)
|
9 |
-
return window.pageYOffset;return 0;},addEvent:function(elm,evType,fn,useCapture){if(elm.addEventListener){elm.addEventListener(evType,fn,useCapture);return true;}else if(elm.attachEvent){var r=elm.attachEvent("on"+evType,fn);return r;}else{alert("Handler could not be removed");}}}
|
10 |
-
ss.STEPS=25;ss.addEvent(window,"load",ss.fixAllLinks);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
easy_smooth_scroll_links.php
DELETED
@@ -1,46 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
Plugin Name: Easy Smooth Scroll Links
|
4 |
-
Plugin URI: http://www.92app.com/wordpress-plugins/easy-smooth-scroll-links
|
5 |
-
Description:Adds smoth scrolling effect to links that link to other parts of the page,which are called "Page Anchors".Extremely useful for setting up a menu which can send you to different section of a post.
|
6 |
-
Version: 1.0
|
7 |
-
Author: Jeriff Cheng
|
8 |
-
Author URI: http://www.92app.com/
|
9 |
-
*/
|
10 |
-
|
11 |
-
/*
|
12 |
-
Copyright 2011 Jeriff Cheng(Email:hschengyongtao@gmail.com)
|
13 |
-
|
14 |
-
This program is free software: you can redistribute it and/or modify
|
15 |
-
it under the terms of the GNU General Public License as published by
|
16 |
-
the Free Software Foundation, either version 3 of the License, or
|
17 |
-
(at your option) any later version.
|
18 |
-
|
19 |
-
This program is distributed in the hope that it will be useful,
|
20 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
21 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
22 |
-
GNU General Public License for more details.
|
23 |
-
|
24 |
-
You should have received a copy of the GNU General Public License
|
25 |
-
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
26 |
-
|
27 |
-
*/
|
28 |
-
|
29 |
-
//add anchor button to visual editor
|
30 |
-
if ( ! function_exists('enable_anchor_button') ) {
|
31 |
-
function enable_anchor_button($buttons) {
|
32 |
-
$buttons[] = 'anchor';
|
33 |
-
return $buttons;
|
34 |
-
}
|
35 |
-
add_filter("mce_buttons_2", "enable_anchor_button");
|
36 |
-
}
|
37 |
-
|
38 |
-
//add required js
|
39 |
-
if ( ! function_exists('add_smooth_scroll_links_js') ) {
|
40 |
-
function add_smooth_scroll_links_js() {
|
41 |
-
?>
|
42 |
-
<script type="text/javascript" src="<?php echo get_option('siteurl') . '/' . PLUGINDIR . '/' . dirname(plugin_basename (__FILE__))?>/easy_smooth_scroll_links.js"></script>
|
43 |
-
<?php
|
44 |
-
}
|
45 |
-
add_action(wp_footer,add_smooth_scroll_links_js,20);
|
46 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
index.php
ADDED
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Easy Smooth Scroll Links
|
4 |
+
Plugin URI: http://www.jeriffcheng.com/wordpress-plugins/easy-smooth-scroll-links
|
5 |
+
Description: Create Page Anchors and add smooth scrolling effect to links that link to Page Anchors. You can set scroll speed and offset value.
|
6 |
+
Version: 1.3.1
|
7 |
+
Author: Jeriff Cheng
|
8 |
+
Author URI: http://www.jeriffcheng.com/
|
9 |
+
*/
|
10 |
+
|
11 |
+
/*
|
12 |
+
Copyright 2014 Jeriff Cheng ( Email:hschengyongtao@gmail.com )
|
13 |
+
|
14 |
+
This program is free software: you can redistribute it and/or modify
|
15 |
+
it under the terms of the GNU General Public License as published by
|
16 |
+
the Free Software Foundation, either version 3 of the License, or
|
17 |
+
(at your option) any later version.
|
18 |
+
|
19 |
+
This program is distributed in the hope that it will be useful,
|
20 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
21 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
22 |
+
GNU General Public License for more details.
|
23 |
+
|
24 |
+
You should have received a copy of the GNU General Public License
|
25 |
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
26 |
+
|
27 |
+
*/
|
28 |
+
|
29 |
+
//Visual Editor Button
|
30 |
+
if ( ! function_exists('enable_anchor_button') ) {
|
31 |
+
function enable_anchor_button($buttons) {
|
32 |
+
$buttons[] = 'anchor';
|
33 |
+
return $buttons;
|
34 |
+
}
|
35 |
+
add_filter("mce_buttons_2", "enable_anchor_button");
|
36 |
+
}
|
37 |
+
|
38 |
+
|
39 |
+
//Shortcode
|
40 |
+
if ( ! function_exists('essl_shortcode') ) {
|
41 |
+
function essl_shortcode( $atts, $content = null ) {
|
42 |
+
return '<a name="' . $content . '">';
|
43 |
+
}
|
44 |
+
add_shortcode( 'anchor', 'essl_shortcode' );
|
45 |
+
}
|
46 |
+
|
47 |
+
|
48 |
+
/*
|
49 |
+
Registering Options Page
|
50 |
+
*/
|
51 |
+
if(!class_exists('ESSLPluginOptions')) :
|
52 |
+
|
53 |
+
// DEFINE PLUGIN ID
|
54 |
+
define('ESSLPluginOptions_ID', 'essl-plugin-options');
|
55 |
+
// DEFINE PLUGIN NICK
|
56 |
+
define('ESSLPluginOptions_NICK', 'ESSL Settings');
|
57 |
+
|
58 |
+
class ESSLPluginOptions
|
59 |
+
{
|
60 |
+
/** function/method
|
61 |
+
* Usage: return absolute file path
|
62 |
+
* Arg(1): string
|
63 |
+
* Return: string
|
64 |
+
*/
|
65 |
+
public static function file_path($file)
|
66 |
+
{
|
67 |
+
return ABSPATH.'wp-content/plugins/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__)).$file;
|
68 |
+
}
|
69 |
+
/** function/method
|
70 |
+
* Usage: hooking the plugin options/settings
|
71 |
+
* Arg(0): null
|
72 |
+
* Return: void
|
73 |
+
*/
|
74 |
+
public static function register()
|
75 |
+
{
|
76 |
+
register_setting(ESSLPluginOptions_ID.'_options', 'essl_speed');
|
77 |
+
register_setting(ESSLPluginOptions_ID.'_options', 'essl_offset');
|
78 |
+
}
|
79 |
+
/** function/method
|
80 |
+
* Usage: hooking (registering) the plugin menu
|
81 |
+
* Arg(0): null
|
82 |
+
* Return: void
|
83 |
+
*/
|
84 |
+
public static function menu()
|
85 |
+
{
|
86 |
+
// Create menu tab
|
87 |
+
add_options_page(ESSLPluginOptions_NICK.' Plugin Options', ESSLPluginOptions_NICK, 'manage_options', ESSLPluginOptions_ID.'_options', array('ESSLPluginOptions', 'options_page'));
|
88 |
+
}
|
89 |
+
/** function/method
|
90 |
+
* Usage: show options/settings form page
|
91 |
+
* Arg(0): null
|
92 |
+
* Return: void
|
93 |
+
*/
|
94 |
+
public static function options_page()
|
95 |
+
{
|
96 |
+
if (!current_user_can('manage_options'))
|
97 |
+
{
|
98 |
+
wp_die( __('You do not have sufficient permissions to access this page.') );
|
99 |
+
}
|
100 |
+
|
101 |
+
$plugin_id = ESSLPluginOptions_ID;
|
102 |
+
// display options page
|
103 |
+
include(self::file_path('options.php'));
|
104 |
+
}
|
105 |
+
|
106 |
+
}
|
107 |
+
|
108 |
+
if ( is_admin() )
|
109 |
+
{
|
110 |
+
add_action('admin_init', array('ESSLPluginOptions', 'register'));
|
111 |
+
add_action('admin_menu', array('ESSLPluginOptions', 'menu'));
|
112 |
+
|
113 |
+
}
|
114 |
+
|
115 |
+
if ( !is_admin() )
|
116 |
+
{
|
117 |
+
|
118 |
+
add_action( 'wp_enqueue_scripts', 'essl_enqueue_jquery', 999 );
|
119 |
+
add_action('wp_footer', 'essl_script',100);
|
120 |
+
|
121 |
+
function essl_enqueue_jquery() {
|
122 |
+
wp_enqueue_script( 'jquery' );
|
123 |
+
}
|
124 |
+
function essl_script() {
|
125 |
+
?> <script type="text/javascript">
|
126 |
+
jQuery.noConflict();
|
127 |
+
(function( $ ) {
|
128 |
+
$(function() {
|
129 |
+
// More code using $ as alias to jQuery
|
130 |
+
|
131 |
+
$(function() {
|
132 |
+
$('a[href*=#]:not([href=#])').click(function() {
|
133 |
+
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
|
134 |
+
var target = $(this.hash);
|
135 |
+
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
|
136 |
+
if (target.length) {
|
137 |
+
$('html,body').animate({
|
138 |
+
scrollTop: target.offset().top -<?php echo get_option('essl_offset',20);?>
|
139 |
+
}, <?php echo get_option('essl_speed',900);?>);
|
140 |
+
return false;
|
141 |
+
}
|
142 |
+
}
|
143 |
+
});
|
144 |
+
});
|
145 |
+
|
146 |
+
});
|
147 |
+
})(jQuery); </script>
|
148 |
+
<?php }
|
149 |
+
}
|
150 |
+
endif;
|
151 |
+
|
152 |
+
?>
|
options.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="wrap">
|
2 |
+
|
3 |
+
<?php screen_icon(); ?>
|
4 |
+
|
5 |
+
<form action="options.php" method="post" id="<?php echo $plugin_id; ?>_options_form" name="<?php echo $plugin_id; ?>_options_form">
|
6 |
+
|
7 |
+
<?php settings_fields($plugin_id.'_options'); ?>
|
8 |
+
|
9 |
+
<h2>Easy Smooth Scroll Links » Settings</h2>
|
10 |
+
<table class="widefat">
|
11 |
+
<thead>
|
12 |
+
<tr>
|
13 |
+
<th><a target="_blank" href="http://www.jeriffcheng.com/wordpress-plugins/easy-smooth-scroll-links">FAQs</a> - <a target="_blank" href="http://wordpress.org/support/view/plugin-reviews/easy-smooth-scroll-links?filter=5#postform">Rate it</a> - <a target="_blank" href="http://wordpress.org/support/plugin/easy-smooth-scroll-links">Support Forum</a> ---- Suggestions? <a target="_blank" href="http://www.jeriffcheng.com/contact">Contact Me</a></th>
|
14 |
+
</tr>
|
15 |
+
</thead>
|
16 |
+
|
17 |
+
<tbody>
|
18 |
+
<tr>
|
19 |
+
<td style="padding:25px;font-family:Verdana, Geneva, sans-serif;color:#666;">
|
20 |
+
<label for="essl_speed">
|
21 |
+
<p>Scroll Speed ( smaller number, faster, default is 900 )</p>
|
22 |
+
<p><input type="text" name="essl_speed" value="<?php echo get_option('essl_speed'); ?>" /></p>
|
23 |
+
</label>
|
24 |
+
</td>
|
25 |
+
</tr>
|
26 |
+
<tr>
|
27 |
+
<td style="padding:25px;font-family:Verdana, Geneva, sans-serif;color:#666;">
|
28 |
+
<label for="essl_offset">
|
29 |
+
<p>Offset ( default is 20 )</p>
|
30 |
+
<p><input type="text" name="essl_offset" value="<?php echo get_option('essl_offset'); ?>" /></p>
|
31 |
+
</label>
|
32 |
+
</td>
|
33 |
+
</tr>
|
34 |
+
</tbody>
|
35 |
+
|
36 |
+
|
37 |
+
<tfoot>
|
38 |
+
<tr>
|
39 |
+
<th><input type="submit" name="submit" value="Save Settings" class="button button-primary" /></th>
|
40 |
+
</tr>
|
41 |
+
</tfoot>
|
42 |
+
</table>
|
43 |
+
|
44 |
+
</form>
|
45 |
+
|
46 |
+
</div>
|
readme.txt
CHANGED
@@ -1,16 +1,22 @@
|
|
1 |
=== Easy Smooth Scroll Links ===
|
2 |
Contributors: Jeriff Cheng
|
3 |
-
|
4 |
-
Tags:anchor,anchor text,links,link,smooth scroll links,scroll,smooth scroll
|
5 |
Requires at least: 2.6.5
|
6 |
-
Tested up to: 3.
|
|
|
7 |
|
8 |
== Description ==
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
-
For more information,refer to <a
|
12 |
|
13 |
-
My personal blog:<a href="http://www.92app.com" target="_blank">www.92app.com</a>
|
14 |
|
15 |
== Installation ==
|
16 |
1. Upload the full directory into your wp-content/plugins directory
|
@@ -18,17 +24,43 @@ My personal blog:<a href="http://www.92app.com" target="_blank">www.92app.com</a
|
|
18 |
3. That's it!
|
19 |
|
20 |
== Frequently Asked Questions ==
|
21 |
-
For FAQs and bug report,refer to <a
|
22 |
|
23 |
== Screenshots ==
|
24 |
|
25 |
-
1.
|
26 |
-
2.
|
|
|
|
|
27 |
|
28 |
== Changelog ==
|
29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
= 1.0 =
|
|
|
31 |
*First Version
|
32 |
|
33 |
== Upgrade Notice ==
|
34 |
-
|
|
|
|
|
|
1 |
=== Easy Smooth Scroll Links ===
|
2 |
Contributors: Jeriff Cheng
|
3 |
+
Tags: anchor,anchor text,links,link,smooth scroll links,scroll,smooth scroll
|
|
|
4 |
Requires at least: 2.6.5
|
5 |
+
Tested up to: 3.8
|
6 |
+
Stable tag: trunk
|
7 |
|
8 |
== Description ==
|
9 |
+
Create Page Anchors and add smooth scrolling effect to links that link to Page Anchors. You can set scroll speed and offset value. Works on IE, Firefox, Chrome, Safari...
|
10 |
+
|
11 |
+
Features:
|
12 |
+
|
13 |
+
* You can set scroll speed and offset value.
|
14 |
+
* Works on all major browsers: IE, Firefox, Chrome, Safari...
|
15 |
+
* Visual Editor Anchor Button
|
16 |
+
* Shortcode Supported
|
17 |
|
18 |
+
For more information,refer to <a rel="follow" href="http://www.jeriffcheng.com/wordpress-plugins/easy-smooth-scroll-links" target="_blank">Easy Smooth Scroll Links WordPress Plugin</a>
|
19 |
|
|
|
20 |
|
21 |
== Installation ==
|
22 |
1. Upload the full directory into your wp-content/plugins directory
|
24 |
3. That's it!
|
25 |
|
26 |
== Frequently Asked Questions ==
|
27 |
+
For FAQs and bug report,refer to <a target="_blank" rel="follow" href="http://www.jeriffcheng.com/wordpress-plugins/easy-smooth-scroll-links#faqs">Easy Smooth Scroll Links WordPress Plugin</a>
|
28 |
|
29 |
== Screenshots ==
|
30 |
|
31 |
+
1. You can set scroll speed and offset value
|
32 |
+
2. Page Anchor Button in WordPress Visual Editor
|
33 |
+
|
34 |
+
|
35 |
|
36 |
== Changelog ==
|
37 |
|
38 |
+
= 1.3.1 =
|
39 |
+
|
40 |
+
*Fix: wp enqueue script error when turning WP_DEBUG mode on
|
41 |
+
|
42 |
+
= 1.3 =
|
43 |
+
|
44 |
+
*NEW: You can set scroll speed and offset value on WordPress backend now !
|
45 |
+
|
46 |
+
= 1.2 =
|
47 |
+
|
48 |
+
*FIX:Chrome Compatibility Problem
|
49 |
+
|
50 |
+
*FIX: wp_enqueue_script was called incorrectly
|
51 |
+
|
52 |
+
= 1.1 =
|
53 |
+
|
54 |
+
*NEW : Add Page Anchor Shortcode.
|
55 |
+
|
56 |
+
Changed : Use wp_enqueue_script function to load the script instead of the default <script> tag.
|
57 |
+
|
58 |
= 1.0 =
|
59 |
+
|
60 |
*First Version
|
61 |
|
62 |
== Upgrade Notice ==
|
63 |
+
|
64 |
+
= 1.3.1 =
|
65 |
+
|
66 |
+
*Fix: wp enqueue script error when turning WP_DEBUG mode on
|
screenshot-1.png
CHANGED
Binary file
|
screenshot-2.png
CHANGED
Binary file
|