Sticky Menu (or Anything!) on Scroll - Version 2.0.1

Version Description

  • fixed padding calculation bug (percentages are off when sticky)
  • fixed bug where assigned styles loop caused JS error
Download this release

Release Info

Developer senff
Plugin Icon 128x128 Sticky Menu (or Anything!) on Scroll
Version 2.0.1
Comparing to
See all releases

Code changes from version 2.0 to 2.0.1

README.md CHANGED
@@ -1,197 +1,207 @@
1
- # Sticky Menu (or Anything!) on Scroll
2
- * Contributors: senff
3
- * Donate link: http://www.senff.com/donate
4
- * Tags: sticky header, sticky menu, sticky, header, menu
5
- * Plugin URI: http://www.senff.com/plugins/sticky-anything-wp
6
- * Requires at least: 3.6
7
- * Tested up to: 4.5
8
- * Stable tag: 2.0
9
- * License: GPLv2 or later
10
- * License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
-
12
- Sticky Menu (Or Anything) On Scroll will let you choose any element on your page that will be "sticky" at the top once you scroll down.
13
-
14
- ## Description
15
-
16
- ### Summary
17
-
18
- The Sticky Menu (Or Anything) On Scroll plugin for WordPress allows you to make any element on your pages "sticky" as soon as it hits the top of the page when you scroll down. Although this is commonly used to keep menus at the top of your page, the plugin allows you to make ANY element sticky (such as a Call To Action box, a logo, etc.)
19
-
20
- A little bit of basic HTML/CSS knowledge is required. You just need to know how to pick the right selector for the element you want to make sticky, and you need to be sure it's a unique selector. Sometimes a simple selector like "nav", "#main-menu", ".menu-main-menu-1" is enough. Other times you will have to be more detailed and use a more specific selector such as "header > ul:first-child" or "nav.top .menu-header ul.main".
21
-
22
- ### Features
23
-
24
- * **Any element can stick**: although common use is for navigation menus, the plugin will let you pick any unique element with a name, class or ID to stick at the top of the page once you scroll past it. Use it for a sidebar, Call-to-action box, banner ad, etc.
25
- * **Positioning from top**: optionally, you can add any amount of space between the sticky element and the top of the page, so that the element is not always stuck at the "ceiling" of the page.
26
- * **Enable for certain screen sizes only**: optionally, you can set a minimum and/or maximum screen size where the stickiness should work. This can be handy if you have a responsive site and you don't want your element to be sticky on smaller screens, for example.
27
- * **Push-up element**: optionally, you can pick any other element lower on the page that will push the sticky element up again (for example a sidebar widget).
28
- * **Admin Bar aware**: checks if the current user has an Admin Toolbar at the top of the page. If it has, the sticky element will not obscure it (or be obscured by it).
29
- * **Z-index**: in case there are other elements on the page that obscure or peek through your sticky element, you can add a Z-index easily.
30
- * **Legacy Mode**: in 2.0, a new method of making things sticky was introduced. In Legacy Mode, the old method will be used. See FAQ for details.
31
- * **Dynamic Mode**: some issues that frequently appear in responsive themes have been address by adding a Dynamic Mode (Legacy Mode only). See FAQ for details.
32
- * **Debug Mode:** find out possible reasons why your element doesn't stick by switching on Debug Mode, and error messages will appear in your browser's console.
33
-
34
-
35
- ## Installation
36
-
37
- 1. Upload the "sticky-menu-or-anything" directory to your "wp-content/plugins" directory.
38
- 2. In your WordPress admin, go to PLUGINS and activate "Sticky Menu (or Anything!)"
39
- 3. Go to SETTINGS - STICKY MENU (OR ANYTHING!)
40
- 4. Pick the element you want to make sticky
41
- 5. Party!
42
-
43
- ## Frequently Asked Questions
44
-
45
- ### I selected a class/ID in the settings screen, but the element doesn't stick when I scroll down. Why not?
46
- First, make sure that if you select the element by its classname, it is preceded by a dot (e.g. ".main-menu"), and if you select it by its ID, that it's preceded by a pound/hash/number sign (e.g. "#main-menu"). Also, make sure there is only ONE element on the page with the selector you're using. If there is none, or more than one element that matches your selector, nothing will happen.
47
-
48
- ### Once the element becomes sticky, it's not positioned/sized properly at all.
49
- There are situations when this happens, especially when the original element has specific properties that are specifically used to manipulate its location and/or size. Things like negative margins, absolute positioning or left/top values on the original element can have undesired effects when the element becomes sticky. Another possible reason is if the original element has "!important" applied to some of its CSS properties. If possible, try to avoid that. Also, inline elements might not get the desired results. If that happens, try using the plugin in Legacy Mode (see below).
50
-
51
- ### Once the element becomes sticky, there's a brief moment where you see it twice.
52
- If you're using the plugin in Legacy Mode (see below), this happens when the sticky element (or any of its contents) has a CSS transition applied to it. Because the original element becomes invisible (and a cloned copy of it becomes visible), the visible-to-invisible status change will take place with a transition (ie. not instantly). Either remove any of the transitions the element has, or try disabling the Legacy Mode.
53
-
54
- ### My menu sticks, but it doesn't open on the Responsive theme when it's sticky.
55
- This was a bug in pre-2.0 versions, and an incompatibility with the theme. It has been fixed in 2.0, but in Legacy Mode, this bug is still present. If you need to enable Legacy Mode for some reason, it would be better to turn off stickiness for the mobile menu (set "Do not stick element when screen smaller than:" to 651 pixels).
56
-
57
- ### I have another plugin called Easy Smooth Scroll Links, but once my menu becomes sticky, that one doesn't work anymore.
58
- This was a bug in pre-2.0 versions, and an incompatibility with the plugin. It has been fixed in 2.0, but in Legacy Mode, this bug is still present. If you need Legacy Mode enabled for some reason, there is no fix for this bug, however there is an alternative workaround. According to reports from users who had this issue, a plugin called Page Scroll To ID is a worthy alternative to Easy Smooth Scroll Links and works with the Sticky Anything plugin in Legacy Mode.
59
-
60
- ### Still doesn't work. What could be wrong?
61
- Check the "Debug Mode" checkbox in the plugin's settings. Reload the page and you may see errors in your browser's console window. If you've used a selector that doesn't exist, OR there are more of them on the page, you will be notified of that in the console.
62
-
63
- ### Is it possible to have multiple sticky elements?
64
- The current version only allows one sticky element, but this functionality will be implemented in the next major version. No expected release date, though.
65
-
66
- ### What is Legacy Mode? Should I use it?
67
- In version 2.0 of the plugin, a new/better method for making elements sticky was introduced. Before this, a sticky element would essentially be a cloned copy of the original element. Now, the element itself becomes sticky and doesn't use copying and cloning anymore, which solves a lot of issues.
68
-
69
- So, should you use it or not? Well, if you upgraded this plugin from an earlier version, Legacy Mode will be turned ON by default, because chances are that the old method worked perfectly fine for your site. If that's the case, there is not really a need to use the new method and you can just continue using the old, classic method. If it ain't broke, don't fix it, right?
70
-
71
- Having said that, it's worth checking if your element works just as well with Legacy Mode turned OFF, since this is the "better" method. Just give it a quick try. If it doesn't work, you can always just go back and enable it again.
72
-
73
- NOTE: new installs of the plugin will have the Legacy Mode turned off by default. Only UPGRADES from 1.4 (or before) should have it turned on by default.
74
-
75
- ### What is this Dynamic Mode thing exactly?
76
- This mode is only available in Legacy Mode, and to properly explain this, we'll need to go a little deeper in the plugin's functionality. So bear with me...
77
-
78
- In Legacy Mode, when an element becomes sticky at the top of the page (and keeps its place regardless of the scrolling), it's actually not the element itself you see, but a cloned copy of it, while the actuak original element is out of view and invisible.
79
-
80
- The original element always stays where it originally is on the page, while the cloned element is always at the top of the browser viewport screen. However, you will never see them both at the same time; depending on your scroll position, it always just shows either one or the other.
81
-
82
- In the original plugin version, the clone would be created right the moment when you load the page (but not visible right away). Then when you would scroll down, it would become visible (and stick at the top), while the original element would disappear from view.
83
-
84
- However, some themes use JavaScript to dynamically create elements (menus, mostly) for mobile sites. With this method, a menu doesn't exist in the HTML source code when you load the page, but is created some time after the page is fully loaded -- in many cases, these menus would just be generated ONLY when the screen is more (or less) than a certain specific width. With the original version of the plugin, the problem would be that the original element (that you want to make sticky) may not have been fully created upon page load, so the clone would also not be fully functional.
85
-
86
- Enter Dynamic Mode. Now, a clone of the element is not created on page load -- instead, it's only created when the user scrolls and hits the "sticky" point. This ensures that the cloned element is an actual 1-on-1 copy of what the original element consists of at that specific point in time (and not at the "page is loaded" point, which may be different if the element was altered since).
87
-
88
- Why don't we use Dynamic Mode all the time then? This has to do with the fact that other plugins initialize themselves on page load and may need the full markup (including the cloned element) at that point. In Dynamic Mode, there is no clone available yet on page load, so that could cause an issue if that other plugin is looking for an element that doesn't exist yet.
89
-
90
- (This may all sound terribly confusing. And it is! So, much work was done to fix this nonsense: since v2.0 of the plugin, a whole different method is being used to make elements sticky, and Dynamic Mode is not even an issue anymore.)
91
-
92
- Phew!
93
-
94
- ### I'll need more help please!
95
- Please go to the plugin's [support forum on WordPress.org](https://wordpress.org/support/plugin/sticky-menu-or-anything-on-scroll) and post a message (include a link to your site if possible). Repsonse time is usually within a few hours maximum.
96
-
97
-
98
- ## Screenshots
99
-
100
- 1. Basic settings screen
101
- 2. Advanced settings screen
102
-
103
-
104
- ## Changelog
105
-
106
- ### 2.0
107
- * Introduced a new/better method for making elements sticky
108
- * Added Legacy Mode (for those who want to continue the old method)
109
- * Split up settings screen in Basic and Advanced
110
- * Debug mode uses uncompressed JS file for easier remote debugging
111
-
112
- ### 1.4
113
- * Removed error notification if no pushup-element is selected
114
- * Renaming class "cloned" to "sticky-element-cloned" and "original" to "sticky-element-original" to avoid conflicts with Owl Carousel
115
- * Fixed bug where cloned element width would be rounded down if it contained sub-pixels
116
-
117
- ### 1.3.1
118
- * Minor bug fix for push-up element
119
-
120
- ### 1.3
121
- * Added functionality to move sticky element down in case there is an Administrator Toolbar at the top of the page
122
- * Added functionality to push sticky element up by another element lower down the page
123
-
124
- ### 1.2.4
125
- * Fixed small bug related to version number
126
-
127
- ### 1.2.3
128
- * Bug with Dynamic Mode select box/label fixed
129
- * Bug with Z-index fixed (thanks @aguseo for reporting)
130
- * All text in plugin fully translatable
131
- * Added FAQ tab to settings screen
132
- * Added infobox to settings screen
133
- * Added a few comments to source code
134
-
135
- ### 1.2
136
- * Dynamic Mode added (addressing problems with dynamically created menus -- see Frequently Asked Questions above for details)
137
-
138
- ### 1.1.4
139
- * Ready for WordPress 4.1 (and TwentyFifteen)
140
- * Fixes issue when element has padding in percentages
141
-
142
- ### 1.1.3
143
- * Fixes width calculation bug introduced in previous version (sorry about that), box sizing now supported
144
-
145
- ### 1.1.2
146
- * Fixes element width calculation bug
147
-
148
- ### 1.1.1
149
- * Fixes viewport calculation bug
150
-
151
- ### 1.1
152
- * Added functionality for optional minimum/maximum screen size
153
-
154
- ### 1.0
155
- * Initial release (using v1.1 of the standalone jQuery plugin)
156
-
157
-
158
- ## Upgrade Notice
159
-
160
- ## 2.0
161
- * Bug fixes and new/better method of making elements sticky
162
-
163
- ## 1.4
164
- * Couple of bug fixes
165
-
166
- ### 1.3.1
167
- * Minor bug fix for push-up element
168
-
169
- ### 1.3
170
- * BY POPULAR DEMAND: functionalities added related to Administrator Toolbar and element that can push sticky element up
171
-
172
- ### 1.2.4
173
- * Minor bugfix
174
-
175
- ### 1.2.3
176
- * Bugfixes, improvements and translation-ready
177
-
178
- ### 1.2
179
- * Dynamic Mode added
180
-
181
- ### 1.1.4
182
- * Bugfixes, ready for WordPress 4.1 (and TwentyFifteen)
183
-
184
- ### 1.1.3
185
- * Bugfix for new bug introduced in 1.1.2
186
-
187
- ### 1.1.2
188
- * Bugfixes
189
-
190
- ### 1.1.1
191
- * Bugfixes
192
-
193
- ### 1.1
194
- * Added functionality (minimum and/or maximum screen size)
195
-
196
- ### 1.0
197
- * Initial release of the plugin
 
 
 
 
 
 
 
 
 
 
1
+ # Sticky Menu (or Anything!) on Scroll
2
+ * Contributors: senff
3
+ * Donate link: http://www.senff.com/donate
4
+ * Tags: sticky header, sticky menu, sticky, header, menu
5
+ * Plugin URI: http://www.senff.com/plugins/sticky-anything-wp
6
+ * Requires at least: 3.6
7
+ * Tested up to: 4.6
8
+ * Stable tag: 2.0.1
9
+ * License: GPLv2 or later
10
+ * License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
+
12
+ Sticky Menu (Or Anything) On Scroll will let you choose any element on your page that will be "sticky" at the top once you scroll down.
13
+
14
+ ## Description
15
+
16
+ ### Summary
17
+
18
+ The Sticky Menu (Or Anything) On Scroll plugin for WordPress allows you to make any element on your pages "sticky" as soon as it hits the top of the page when you scroll down. Although this is commonly used to keep menus at the top of your page, the plugin allows you to make ANY element sticky (such as a Call To Action box, a logo, etc.)
19
+
20
+ A little bit of basic HTML/CSS knowledge is required. You just need to know how to pick the right selector for the element you want to make sticky, and you need to be sure it's a unique selector. Sometimes a simple selector like "nav", "#main-menu", ".menu-main-menu-1" is enough. Other times you will have to be more detailed and use a more specific selector such as "header > ul:first-child" or "nav.top .menu-header ul.main".
21
+
22
+ ### Features
23
+
24
+ * **Any element can stick**: although common use is for navigation menus, the plugin will let you pick any unique element with a name, class or ID to stick at the top of the page once you scroll past it. Use it for a sidebar, Call-to-action box, banner ad, etc.
25
+ * **Positioning from top**: optionally, you can add any amount of space between the sticky element and the top of the page, so that the element is not always stuck at the "ceiling" of the page.
26
+ * **Enable for certain screen sizes only**: optionally, you can set a minimum and/or maximum screen size where the stickiness should work. This can be handy if you have a responsive site and you don't want your element to be sticky on smaller screens, for example.
27
+ * **Push-up element**: optionally, you can pick any other element lower on the page that will push the sticky element up again (for example a sidebar widget).
28
+ * **Admin Bar aware**: checks if the current user has an Admin Toolbar at the top of the page. If it has, the sticky element will not obscure it (or be obscured by it).
29
+ * **Z-index**: in case there are other elements on the page that obscure or peek through your sticky element, you can add a Z-index easily.
30
+ * **Legacy Mode**: in 2.0, a new method of making things sticky was introduced. In Legacy Mode, the old method will be used. See FAQ for details.
31
+ * **Dynamic Mode**: some issues that frequently appear in responsive themes have been address by adding a Dynamic Mode (Legacy Mode only). See FAQ for details.
32
+ * **Debug Mode:** find out possible reasons why your element doesn't stick by switching on Debug Mode, and error messages will appear in your browser's console.
33
+
34
+
35
+ ## Installation
36
+
37
+ 1. Upload the "sticky-menu-or-anything" directory to your "wp-content/plugins" directory.
38
+ 2. In your WordPress admin, go to PLUGINS and activate "Sticky Menu (or Anything!)"
39
+ 3. Go to SETTINGS - STICKY MENU (OR ANYTHING!)
40
+ 4. Pick the element you want to make sticky
41
+ 5. Party!
42
+
43
+ ## Frequently Asked Questions
44
+
45
+ ### I selected a class/ID in the settings screen, but the element doesn't stick when I scroll down. Why not?
46
+ First, make sure that if you select the element by its classname, it is preceded by a dot (e.g. ".main-menu"), and if you select it by its ID, that it's preceded by a pound/hash/number sign (e.g. "#main-menu"). Also, make sure there is only ONE element on the page with the selector you're using. If there is none, or more than one element that matches your selector, nothing will happen.
47
+
48
+ ### Once the element becomes sticky, it's not positioned/sized properly at all.
49
+ There are situations when this happens, especially when the original element has specific properties that are specifically used to manipulate its location and/or size. Things like negative margins, absolute positioning or left/top values on the original element can have undesired effects when the element becomes sticky. Another possible reason is if the original element has "!important" applied to some of its CSS properties. If possible, try to avoid that. Also, inline elements might not get the desired results. If that happens, try using the plugin in Legacy Mode (see below).
50
+
51
+ ### Once the element becomes sticky, there's a brief moment where you see it twice.
52
+ If you're using the plugin in Legacy Mode (see below), this happens when the sticky element (or any of its contents) has a CSS transition applied to it. Because the original element becomes invisible (and a cloned copy of it becomes visible), the visible-to-invisible status change will take place with a transition (ie. not instantly). Either remove any of the transitions the element has, or try disabling the Legacy Mode.
53
+
54
+ ### My menu sticks, but it doesn't open on the Responsive theme when it's sticky.
55
+ This was a bug in pre-2.0 versions, and an incompatibility with the theme. It has been fixed in 2.0, but in Legacy Mode, this bug is still present. If you need to enable Legacy Mode for some reason, it would be better to turn off stickiness for the mobile menu (set "Do not stick element when screen smaller than:" to 651 pixels).
56
+
57
+ ### I have another plugin called Easy Smooth Scroll Links, but once my menu becomes sticky, that one doesn't work anymore.
58
+ This was a bug in pre-2.0 versions, and an incompatibility with the plugin. It has been fixed in 2.0, but in Legacy Mode, this bug is still present. If you need Legacy Mode enabled for some reason, there is no fix for this bug, however there is an alternative workaround. According to reports from users who had this issue, a plugin called Page Scroll To ID is a worthy alternative to Easy Smooth Scroll Links and works with the Sticky Anything plugin in Legacy Mode.
59
+
60
+ ### Still doesn't work. What could be wrong?
61
+ Check the "Debug Mode" checkbox in the plugin's settings. Reload the page and you may see errors in your browser's console window. If you've used a selector that doesn't exist, OR there are more of them on the page, you will be notified of that in the console.
62
+
63
+ ### Is it possible to have multiple sticky elements?
64
+ The current version only allows one sticky element, but this functionality will be implemented in the next major version. No expected release date, though.
65
+
66
+ ### What is Legacy Mode? Should I use it?
67
+ In version 2.0 of the plugin, a new/better method for making elements sticky was introduced. Before this, a sticky element would essentially be a cloned copy of the original element. Now, the element itself becomes sticky and doesn't use copying and cloning anymore, which solves a lot of issues.
68
+
69
+ So, should you use it or not? Well, if you upgraded this plugin from an earlier version, Legacy Mode will be turned ON by default, because chances are that the old method worked perfectly fine for your site. If that's the case, there is not really a need to use the new method and you can just continue using the old, classic method. If it ain't broke, don't fix it, right?
70
+
71
+ Having said that, it's worth checking if your element works just as well with Legacy Mode turned OFF, since this is the "better" method. Just give it a quick try. If it doesn't work, you can always just go back and enable it again.
72
+
73
+ NOTE: new installs of the plugin will have the Legacy Mode turned off by default. Only UPGRADES from 1.4 (or before) should have it turned on by default.
74
+
75
+ ### What is this Dynamic Mode thing exactly?
76
+ This mode is only available in Legacy Mode, and to properly explain this, we'll need to go a little deeper in the plugin's functionality. So bear with me...
77
+
78
+ In Legacy Mode, when an element becomes sticky at the top of the page (and keeps its place regardless of the scrolling), it's actually not the element itself you see, but a cloned copy of it, while the actuak original element is out of view and invisible.
79
+
80
+ The original element always stays where it originally is on the page, while the cloned element is always at the top of the browser viewport screen. However, you will never see them both at the same time; depending on your scroll position, it always just shows either one or the other.
81
+
82
+ In the original plugin version, the clone would be created right the moment when you load the page (but not visible right away). Then when you would scroll down, it would become visible (and stick at the top), while the original element would disappear from view.
83
+
84
+ However, some themes use JavaScript to dynamically create elements (menus, mostly) for mobile sites. With this method, a menu doesn't exist in the HTML source code when you load the page, but is created some time after the page is fully loaded -- in many cases, these menus would just be generated ONLY when the screen is more (or less) than a certain specific width. With the original version of the plugin, the problem would be that the original element (that you want to make sticky) may not have been fully created upon page load, so the clone would also not be fully functional.
85
+
86
+ Enter Dynamic Mode. Now, a clone of the element is not created on page load -- instead, it's only created when the user scrolls and hits the "sticky" point. This ensures that the cloned element is an actual 1-on-1 copy of what the original element consists of at that specific point in time (and not at the "page is loaded" point, which may be different if the element was altered since).
87
+
88
+ Why don't we use Dynamic Mode all the time then? This has to do with the fact that other plugins initialize themselves on page load and may need the full markup (including the cloned element) at that point. In Dynamic Mode, there is no clone available yet on page load, so that could cause an issue if that other plugin is looking for an element that doesn't exist yet.
89
+
90
+ (This may all sound terribly confusing. And it is! So, much work was done to fix this nonsense: since v2.0 of the plugin, a whole different method is being used to make elements sticky, and Dynamic Mode is not even an issue anymore.)
91
+
92
+ Phew!
93
+
94
+ ### I'll need more help please!
95
+ Please go to the plugin's [support forum on WordPress.org](https://wordpress.org/support/plugin/sticky-menu-or-anything-on-scroll) and post a message (include a link to your site if possible). Response time is usually within a few hours maximum.
96
+
97
+ ### I need some functionality that the plugin currently doesn't support. Can you help make a custom version?
98
+ If the customization is fairly minor, I can probably help out right away. However, if the requested customization is of a more complex nature, I won't be able to do it quickly/free and it may take a number of hours. If you're interested in that, please go to the plugin's [support forum on WordPress.org](https://wordpress.org/support/plugin/sticky-menu-or-anything-on-scroll) and let me know that you'll need some custom work (include a link to your site if possible).
99
+
100
+
101
+ ## Screenshots
102
+
103
+ 1. Basic settings screen
104
+ 2. Advanced settings screen
105
+
106
+
107
+ ## Changelog
108
+
109
+ ### 2.0.1
110
+ * fixed padding calculation bug (percentages are off when sticky)
111
+ * fixed bug where assigned styles loop caused JS error
112
+
113
+ ### 2.0
114
+ * Introduced a new/better method for making elements sticky
115
+ * Added Legacy Mode (for those who want to continue the old method)
116
+ * Split up settings screen in Basic and Advanced
117
+ * Debug mode uses uncompressed JS file for easier remote debugging
118
+
119
+ ### 1.4
120
+ * Removed error notification if no pushup-element is selected
121
+ * Renaming class "cloned" to "sticky-element-cloned" and "original" to "sticky-element-original" to avoid conflicts with Owl Carousel
122
+ * Fixed bug where cloned element width would be rounded down if it contained sub-pixels
123
+
124
+ ### 1.3.1
125
+ * Minor bug fix for push-up element
126
+
127
+ ### 1.3
128
+ * Added functionality to move sticky element down in case there is an Administrator Toolbar at the top of the page
129
+ * Added functionality to push sticky element up by another element lower down the page
130
+
131
+ ### 1.2.4
132
+ * Fixed small bug related to version number
133
+
134
+ ### 1.2.3
135
+ * Bug with Dynamic Mode select box/label fixed
136
+ * Bug with Z-index fixed (thanks @aguseo for reporting)
137
+ * All text in plugin fully translatable
138
+ * Added FAQ tab to settings screen
139
+ * Added infobox to settings screen
140
+ * Added a few comments to source code
141
+
142
+ ### 1.2
143
+ * Dynamic Mode added (addressing problems with dynamically created menus -- see Frequently Asked Questions above for details)
144
+
145
+ ### 1.1.4
146
+ * Ready for WordPress 4.1 (and TwentyFifteen)
147
+ * Fixes issue when element has padding in percentages
148
+
149
+ ### 1.1.3
150
+ * Fixes width calculation bug introduced in previous version (sorry about that), box sizing now supported
151
+
152
+ ### 1.1.2
153
+ * Fixes element width calculation bug
154
+
155
+ ### 1.1.1
156
+ * Fixes viewport calculation bug
157
+
158
+ ### 1.1
159
+ * Added functionality for optional minimum/maximum screen size
160
+
161
+ ### 1.0
162
+ * Initial release (using v1.1 of the standalone jQuery plugin)
163
+
164
+
165
+ ## Upgrade Notice
166
+
167
+ ## 2.0.1
168
+ * A few small bug fixes
169
+
170
+ ## 2.0
171
+ * Bug fixes and new/better method of making elements sticky
172
+
173
+ ## 1.4
174
+ * Couple of bug fixes
175
+
176
+ ### 1.3.1
177
+ * Minor bug fix for push-up element
178
+
179
+ ### 1.3
180
+ * BY POPULAR DEMAND: functionalities added related to Administrator Toolbar and element that can push sticky element up
181
+
182
+ ### 1.2.4
183
+ * Minor bugfix
184
+
185
+ ### 1.2.3
186
+ * Bugfixes, improvements and translation-ready
187
+
188
+ ### 1.2
189
+ * Dynamic Mode added
190
+
191
+ ### 1.1.4
192
+ * Bugfixes, ready for WordPress 4.1 (and TwentyFifteen)
193
+
194
+ ### 1.1.3
195
+ * Bugfix for new bug introduced in 1.1.2
196
+
197
+ ### 1.1.2
198
+ * Bugfixes
199
+
200
+ ### 1.1.1
201
+ * Bugfixes
202
+
203
+ ### 1.1
204
+ * Added functionality (minimum and/or maximum screen size)
205
+
206
+ ### 1.0
207
+ * Initial release of the plugin
assets/css/sticky-anything-admin.css CHANGED
@@ -1,113 +1,113 @@
1
- .hide {
2
- display:none;
3
- }
4
-
5
- .main-content {
6
- float:left;
7
- width:70%;
8
- }
9
-
10
- .main-content .new-feature {
11
- border:solid 1px #c0c0c0;
12
- background:#e7e7e7;
13
- border-right:solid 1px #fff;
14
- border-bottom:solid 1px #fff;
15
- }
16
-
17
- .main-content .form-table .disabled-feature {
18
- opacity:0.65;
19
- }
20
-
21
- .main-content .form-table .disabled-feature input,
22
- .main-content .form-table .disabled-feature label {
23
- cursor:default;
24
- }
25
-
26
-
27
- .main-content .new-feature th,
28
- .main-content .new-feature td {
29
- padding-left:10px;
30
- }
31
-
32
- .main-content .new,
33
- .main-content .solved {
34
- font-weight:bold;
35
- color:#e00;
36
- }
37
-
38
- .main-content input[type="text"] {
39
- width:200px;
40
- }
41
-
42
- .main-content .tab-sticky-advanced textarea {
43
- font-family:courier new;
44
- font-size:12px;
45
- height:140px;
46
- overflow-y:scroll;
47
- }
48
-
49
- .tab-sticky-faq p {
50
- font-size:14px;
51
- margin-bottom:20px;
52
- }
53
-
54
- .tab-sticky-faq strong {
55
- color:#222;
56
- padding-top:20px;
57
- margin-bottom:3px;
58
- border-top:solid 1px #ccc;
59
- display:block;
60
- }
61
-
62
- .tab-sticky-faq p:nth-of-type(1) strong {
63
- border-top:none;
64
- }
65
-
66
- .main-sidebar {
67
- float:right;
68
- width:25%;
69
- background:#ffffff;
70
- border: 1px solid #e5e5e5;
71
- box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
72
- }
73
-
74
- .main-sidebar h3 {
75
- margin: 0;
76
- padding: 8px 12px;
77
- border-bottom: 1px solid #ececec;
78
- }
79
-
80
- .main-sidebar .inner {
81
- padding:10px;
82
- }
83
-
84
- .main-sidebar p {
85
- padding:8px;
86
- margin:0;
87
- border-top:solid 1px #e5e5e5;
88
- }
89
-
90
-
91
- @media screen and (max-width: 782px) {
92
- .main-content,
93
- .main-sidebar {
94
- width:100%;
95
- float:none;
96
- clear:both;
97
- }
98
-
99
- .main-content .new-feature {
100
- border:none;
101
- background:transparent;
102
- }
103
-
104
- .main-content .new-feature th,
105
- .main-content .new-feature td {
106
- padding-left:0;
107
- }
108
-
109
- .main-content td {
110
- padding-bottom:20px;
111
- border-bottom:dashed 1px #c0c0c0;
112
- }
113
  }
1
+ .hide {
2
+ display:none;
3
+ }
4
+
5
+ .main-content {
6
+ float:left;
7
+ width:70%;
8
+ }
9
+
10
+ .main-content .new-feature {
11
+ border:solid 1px #c0c0c0;
12
+ background:#e7e7e7;
13
+ border-right:solid 1px #fff;
14
+ border-bottom:solid 1px #fff;
15
+ }
16
+
17
+ .main-content .form-table .disabled-feature {
18
+ opacity:0.65;
19
+ }
20
+
21
+ .main-content .form-table .disabled-feature input,
22
+ .main-content .form-table .disabled-feature label {
23
+ cursor:default;
24
+ }
25
+
26
+
27
+ .main-content .new-feature th,
28
+ .main-content .new-feature td {
29
+ padding-left:10px;
30
+ }
31
+
32
+ .main-content .new,
33
+ .main-content .solved {
34
+ font-weight:bold;
35
+ color:#e00;
36
+ }
37
+
38
+ .main-content input[type="text"] {
39
+ width:200px;
40
+ }
41
+
42
+ .main-content .tab-sticky-advanced textarea {
43
+ font-family:courier new;
44
+ font-size:12px;
45
+ height:140px;
46
+ overflow-y:scroll;
47
+ }
48
+
49
+ .tab-sticky-faq p {
50
+ font-size:14px;
51
+ margin-bottom:20px;
52
+ }
53
+
54
+ .tab-sticky-faq strong {
55
+ color:#222;
56
+ padding-top:20px;
57
+ margin-bottom:3px;
58
+ border-top:solid 1px #ccc;
59
+ display:block;
60
+ }
61
+
62
+ .tab-sticky-faq p:nth-of-type(1) strong {
63
+ border-top:none;
64
+ }
65
+
66
+ .main-sidebar {
67
+ float:right;
68
+ width:25%;
69
+ background:#ffffff;
70
+ border: 1px solid #e5e5e5;
71
+ box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
72
+ }
73
+
74
+ .main-sidebar h3 {
75
+ margin: 0;
76
+ padding: 8px 12px;
77
+ border-bottom: 1px solid #ececec;
78
+ }
79
+
80
+ .main-sidebar .inner {
81
+ padding:10px;
82
+ }
83
+
84
+ .main-sidebar p {
85
+ padding:8px;
86
+ margin:0;
87
+ border-top:solid 1px #e5e5e5;
88
+ }
89
+
90
+
91
+ @media screen and (max-width: 782px) {
92
+ .main-content,
93
+ .main-sidebar {
94
+ width:100%;
95
+ float:none;
96
+ clear:both;
97
+ }
98
+
99
+ .main-content .new-feature {
100
+ border:none;
101
+ background:transparent;
102
+ }
103
+
104
+ .main-content .new-feature th,
105
+ .main-content .new-feature td {
106
+ padding-left:0;
107
+ }
108
+
109
+ .main-content td {
110
+ padding-bottom:20px;
111
+ border-bottom:dashed 1px #c0c0c0;
112
+ }
113
  }
assets/faq.php CHANGED
@@ -1,42 +1,42 @@
1
- <h2><?php _e('FAQ','Sticky Anything plugin'); ?>/<?php _e('Troubleshooting','Sticky Anything plugin'); ?></h2>
2
-
3
- <p><strong><?php _e('Q: I selected a class/ID in the settings screen, but the element doesn\'t stick when I scroll down. Why not?','Sticky Anything plugin'); ?></strong><br />
4
- <?php _e('First, make sure that if you select the element by its classname, it is preceded by a dot (e.g. ".main-menu"), and if you select it by its ID, that it\'s preceded by a pound/hash/number sign (e.g. "#main-menu"). Also, make sure there is only ONE element on the page with the selector you\'re using. If there is none, or more than one element that matches your selector, nothing will happen.','Sticky Anything plugin'); ?></p>
5
-
6
- <p><strong><?php _e('Q: Once the element becomes sticky, it\'s not positioned/sized properly at all.','Sticky Anything plugin'); ?></strong><br />
7
- <?php _e('There are situations when this happens, especially when the original element has specific properties that are specifically used to manipulate its location and/or size. Things like negative margins, absolute positioning or left/top values on the original element can have undesired effects when the element becomes sticky. Another possible reason is if the original element has "!important" applied to some of its CSS properties. If possible, try to avoid all that. Also, inline elements might not get the desired results. If that happens, try using the plugin in Legacy Mode (see below).','Sticky Anything plugin'); ?></p>
8
-
9
- <p><strong><?php _e('Q: Once the element becomes sticky, there\'s a brief moment where you see it twice.','Sticky Anything plugin'); ?></strong><br />
10
- <?php _e('If you\'re using the plugin in Legacy Mode (see below), this happens when the sticky element (or any of its contents) has a CSS transition applied to it. Because the original element becomes invisible (and a cloned copy of it becomes visible), the visible-to-invisible status change will take place with a transition (ie. not instantly). Either remove any of the transitions the element has, or try disabling the Legacy Mode.','Sticky Anything plugin'); ?></p>
11
-
12
- <p><strong><?php _e('Q: My menu sticks, but it doesn\'t open on the <a href="https://wordpress.org/themes/responsive" target="_blank">Responsive</a> theme when it\'s sticky.','Sticky Anything plugin'); ?></strong><br />
13
- <?php _e('This was a bug in pre-2.0 versions, and an incompatibility with the theme. It has been fixed in 2.0, but in Legacy Mode, this bug is still present. If you need to enable Legacy Mode for some reason, it would be better to turn off stickiness for the mobile menu (set "Do not stick element when screen smaller than:" to 651 pixels).','Sticky Anything plugin'); ?></p>
14
-
15
- <p><strong><?php _e('Q: I have another plugin called <a href="https://wordpress.org/plugins/easy-smooth-scroll-links/" target="_blank">Easy Smooth Scroll Links</a>, but once my menu becomes sticky, that one doesn\'t work anymore.','Sticky Anything plugin'); ?></strong><br />
16
- <?php _e('This was a bug in pre-2.0 versions, and an incompatibility with the plugin. It has been fixed in 2.0, but in Legacy Mode, this bug is still present. If you need Legacy Mode enabled for some reason, there is no fix for this bug, however there is an alternative workaround. According to reports from users who had this issue, a plugin called <a href="https://wordpress.org/plugins/page-scroll-to-id/" target="_blank">Page Scroll To ID</a> is a worthy alternative to Easy Smooth Scroll Links and works with the Sticky Anything plugin in Legacy Mode.','Sticky Anything plugin'); ?></p>
17
-
18
- <p><strong><?php _e('Q: Still doesn\'t work. What could be wrong?','Sticky Anything plugin'); ?></strong><br />
19
- <?php _e('Check the "Debug Mode" checkbox in the plugin\'s settings. Reload the page and you may see errors in your browser\'s console window. If you\'ve used a selector that doesn\'t exist, OR there are more of them on the page, you will be notified of that in the console.','Sticky Anything plugin'); ?></p>
20
-
21
- <p><strong><?php _e('Q: Is it possible to have multiple sticky elements?','Sticky Anything plugin'); ?></strong><br />
22
- <?php _e('The current version only allows one sticky element, but this functionality will be implemented in the next major version. No expected release date, though.','Sticky Anything plugin'); ?></p>
23
-
24
- <p><strong><?php _e('Q: What is Legacy Mode? Should I use it?','Sticky Anything plugin'); ?></strong><br />
25
- <?php _e('In version 2.0 of the plugin, a new/better method for making elements sticky was introduced. Before this, a sticky element would essentially be a cloned copy of the original element. Now, the element itself becomes sticky and doesn\'t use copying and cloning anymore, which solves a lot of issues.'); ?></p>
26
- <p><?php _e('So, should you use it or not? Well, if you <em>upgraded</em> this plugin from an earlier version, Legacy Mode will be turned ON by default, because chances are that the old method worked perfectly fine for your site. If that\'s the case, there is not really a need to use the new method and you can just continue using the old, classic method. If it ain\'t broke, don\'t fix it, right?'); ?></p>
27
- <p><?php _e('Having said that, it\'s worth checking if your element works just as well with Legacy Mode turned OFF, since this is the "better" method. Just give it a quick try. If it doesn\'t work, you can always just go back and enable it again.'); ?></p>
28
- <p><?php _e('<span style="font-weight:bold;">NOTE: new installs of the plugin will have the Legacy Mode turned off by default. Only UPGRADES from 1.4 (or before) should have it turned on by default.</span>'); ?>
29
-
30
- <p><strong><?php _e('Q: What is this Dynamic Mode thing exactly?','Sticky Anything plugin'); ?></strong><br />
31
- <?php _e('This mode is only available in Legacy Mode, and to properly explain this, we\'ll need to go a little deeper in the plugin\'s functionality. So bear with me...','Sticky Anything plugin'); ?></p>
32
- <p><?php _e('In Legacy Mode, when an element becomes sticky at the top of the page (and keeps its place regardless of the scrolling), it\'s actually not the element itself you see, but a cloned copy of it, while the actuak original element is out of view and invisible.','Sticky Anything plugin'); ?></p>
33
- <p><?php _e('The original element always stays where it originally is on the page, while the cloned element is always at the top of the browser viewport screen. However, you will never see them both at the same time; depending on your scroll position, it always just shows either one or the other.','Sticky Anything plugin'); ?></p>
34
- <p><?php _e('In the original plugin version, the clone would be created right the moment when you load the page (but not visible right away). Then when you would scroll down, it would become visible (and stick at the top), while the original element would disappear from view.','Sticky Anything plugin'); ?></p>
35
- <p><?php _e('However, some themes use JavaScript to dynamically create elements (menus, mostly) for mobile sites. With this method, a menu doesn\'t exist in the HTML source code when you load the page, but is created some time after the page is fully loaded -- in many cases, these menus would just be generated ONLY when the screen is more (or less) than a certain specific width. With the original version of the plugin, the problem would be that the original element (that you want to make sticky) may not have been fully created upon page load, so the clone would also not be fully functional.','Sticky Anything plugin'); ?></p>
36
- <p><?php _e('Enter Dynamic Mode. Now, a clone of the element is not created on page load -- instead, it\'s only created when the user scrolls and hits the "sticky" point. This ensures that the cloned element is an actual 1-on-1 copy of what the original element consists of at that specific point in time (and not at the "page is loaded" point, which may be different if the element was altered since).','Sticky Anything plugin'); ?></p>
37
- <p><?php _e('Why don\'t we use Dynamic Mode all the time then? This has to do with the fact that other plugins initialize themselves on page load and may need the full markup (including the cloned element) at that point. In Dynamic Mode, there is no clone available yet on page load, so that could cause an issue if that other plugin is looking for an element that doesn\'t exist yet.','Sticky Anything plugin'); ?></p>
38
- <p><?php _e('(This may all sound terribly confusing. And it is! So, much work was done to fix this nonsense: since v2.0 of the plugin, a whole different method is being used to make elements sticky, and Dynamic Mode is not even an issue anymore.)','Sticky Anything plugin'); ?></p>
39
- <p><?php _e('Phew!','Sticky Anything plugin'); ?></p>
40
-
41
- <p><strong><?php _e('Q: I\'ll need more help please!','Sticky Anything plugin'); ?></strong><br />
42
- <?php _e('<!-- The plugin\'s own page can be found at <a href="http://www.senff.com/plugins/sticky-anything-wp" target="_blank">http://www.senff.com/plugins/sticky-anything-wp</a>. If that still doesn\'t help you solve your issue, please do NOT file a bug through the form on my website, but instead --> Please go to the plugin\'s <a href="https://wordpress.org/support/plugin/sticky-menu-or-anything-on-scroll" target="_blank">support forum on WordPress.org</a> and post a message (include a link to your site if possible). Repsonse time is usually within a few hours maximum.','Sticky Anything plugin'); ?></p>
1
+ <h2><?php _e('FAQ','Sticky Anything plugin'); ?>/<?php _e('Troubleshooting','Sticky Anything plugin'); ?></h2>
2
+
3
+ <p><strong><?php _e('Q: I selected a class/ID in the settings screen, but the element doesn\'t stick when I scroll down. Why not?','Sticky Anything plugin'); ?></strong><br />
4
+ <?php _e('First, make sure that if you select the element by its classname, it is preceded by a dot (e.g. ".main-menu"), and if you select it by its ID, that it\'s preceded by a pound/hash/number sign (e.g. "#main-menu"). Also, make sure there is only ONE element on the page with the selector you\'re using. If there is none, or more than one element that matches your selector, nothing will happen.','Sticky Anything plugin'); ?></p>
5
+
6
+ <p><strong><?php _e('Q: Once the element becomes sticky, it\'s not positioned/sized properly at all.','Sticky Anything plugin'); ?></strong><br />
7
+ <?php _e('There are situations when this happens, especially when the original element has specific properties that are specifically used to manipulate its location and/or size. Things like negative margins, absolute positioning or left/top values on the original element can have undesired effects when the element becomes sticky. Another possible reason is if the original element has "!important" applied to some of its CSS properties. If possible, try to avoid all that. Also, inline elements might not get the desired results. If that happens, try using the plugin in Legacy Mode (see below).','Sticky Anything plugin'); ?></p>
8
+
9
+ <p><strong><?php _e('Q: Once the element becomes sticky, there\'s a brief moment where you see it twice.','Sticky Anything plugin'); ?></strong><br />
10
+ <?php _e('If you\'re using the plugin in Legacy Mode (see below), this happens when the sticky element (or any of its contents) has a CSS transition applied to it. Because the original element becomes invisible (and a cloned copy of it becomes visible), the visible-to-invisible status change will take place with a transition (ie. not instantly). Either remove any of the transitions the element has, or try disabling the Legacy Mode.','Sticky Anything plugin'); ?></p>
11
+
12
+ <p><strong><?php _e('Q: My menu sticks, but it doesn\'t open on the <a href="https://wordpress.org/themes/responsive" target="_blank">Responsive</a> theme when it\'s sticky.','Sticky Anything plugin'); ?></strong><br />
13
+ <?php _e('This was a bug in pre-2.0 versions, and an incompatibility with the theme. It has been fixed in 2.0, but in Legacy Mode, this bug is still present. If you need to enable Legacy Mode for some reason, it would be better to turn off stickiness for the mobile menu (set "Do not stick element when screen smaller than:" to 651 pixels).','Sticky Anything plugin'); ?></p>
14
+
15
+ <p><strong><?php _e('Q: I have another plugin called <a href="https://wordpress.org/plugins/easy-smooth-scroll-links/" target="_blank">Easy Smooth Scroll Links</a>, but once my menu becomes sticky, that one doesn\'t work anymore.','Sticky Anything plugin'); ?></strong><br />
16
+ <?php _e('This was a bug in pre-2.0 versions, and an incompatibility with the plugin. It has been fixed in 2.0, but in Legacy Mode, this bug is still present. If you need Legacy Mode enabled for some reason, there is no fix for this bug, however there is an alternative workaround. According to reports from users who had this issue, a plugin called <a href="https://wordpress.org/plugins/page-scroll-to-id/" target="_blank">Page Scroll To ID</a> is a worthy alternative to Easy Smooth Scroll Links and works with the Sticky Anything plugin in Legacy Mode.','Sticky Anything plugin'); ?></p>
17
+
18
+ <p><strong><?php _e('Q: Still doesn\'t work. What could be wrong?','Sticky Anything plugin'); ?></strong><br />
19
+ <?php _e('Check the "Debug Mode" checkbox in the plugin\'s settings. Reload the page and you may see errors in your browser\'s console window. If you\'ve used a selector that doesn\'t exist, OR there are more of them on the page, you will be notified of that in the console.','Sticky Anything plugin'); ?></p>
20
+
21
+ <p><strong><?php _e('Q: Is it possible to have multiple sticky elements?','Sticky Anything plugin'); ?></strong><br />
22
+ <?php _e('The current version only allows one sticky element, but this functionality will be implemented in the next major version. No expected release date, though.','Sticky Anything plugin'); ?></p>
23
+
24
+ <p><strong><?php _e('Q: What is Legacy Mode? Should I use it?','Sticky Anything plugin'); ?></strong><br />
25
+ <?php _e('In version 2.0 of the plugin, a new/better method for making elements sticky was introduced. Before this, a sticky element would essentially be a cloned copy of the original element. Now, the element itself becomes sticky and doesn\'t use copying and cloning anymore, which solves a lot of issues.'); ?></p>
26
+ <p><?php _e('So, should you use it or not? Well, if you <em>upgraded</em> this plugin from an earlier version, Legacy Mode will be turned ON by default, because chances are that the old method worked perfectly fine for your site. If that\'s the case, there is not really a need to use the new method and you can just continue using the old, classic method. If it ain\'t broke, don\'t fix it, right?'); ?></p>
27
+ <p><?php _e('Having said that, it\'s worth checking if your element works just as well with Legacy Mode turned OFF, since this is the "better" method. Just give it a quick try. If it doesn\'t work, you can always just go back and enable it again.'); ?></p>
28
+ <p><?php _e('<span style="font-weight:bold;">NOTE: new installs of the plugin will have the Legacy Mode turned off by default. Only UPGRADES from 1.4 (or before) should have it turned on by default.</span>'); ?>
29
+
30
+ <p><strong><?php _e('Q: What is this Dynamic Mode thing exactly?','Sticky Anything plugin'); ?></strong><br />
31
+ <?php _e('This mode is only available in Legacy Mode, and to properly explain this, we\'ll need to go a little deeper in the plugin\'s functionality. So bear with me...','Sticky Anything plugin'); ?></p>
32
+ <p><?php _e('In Legacy Mode, when an element becomes sticky at the top of the page (and keeps its place regardless of the scrolling), it\'s actually not the element itself you see, but a cloned copy of it, while the actuak original element is out of view and invisible.','Sticky Anything plugin'); ?></p>
33
+ <p><?php _e('The original element always stays where it originally is on the page, while the cloned element is always at the top of the browser viewport screen. However, you will never see them both at the same time; depending on your scroll position, it always just shows either one or the other.','Sticky Anything plugin'); ?></p>
34
+ <p><?php _e('In the original plugin version, the clone would be created right the moment when you load the page (but not visible right away). Then when you would scroll down, it would become visible (and stick at the top), while the original element would disappear from view.','Sticky Anything plugin'); ?></p>
35
+ <p><?php _e('However, some themes use JavaScript to dynamically create elements (menus, mostly) for mobile sites. With this method, a menu doesn\'t exist in the HTML source code when you load the page, but is created some time after the page is fully loaded -- in many cases, these menus would just be generated ONLY when the screen is more (or less) than a certain specific width. With the original version of the plugin, the problem would be that the original element (that you want to make sticky) may not have been fully created upon page load, so the clone would also not be fully functional.','Sticky Anything plugin'); ?></p>
36
+ <p><?php _e('Enter Dynamic Mode. Now, a clone of the element is not created on page load -- instead, it\'s only created when the user scrolls and hits the "sticky" point. This ensures that the cloned element is an actual 1-on-1 copy of what the original element consists of at that specific point in time (and not at the "page is loaded" point, which may be different if the element was altered since).','Sticky Anything plugin'); ?></p>
37
+ <p><?php _e('Why don\'t we use Dynamic Mode all the time then? This has to do with the fact that other plugins initialize themselves on page load and may need the full markup (including the cloned element) at that point. In Dynamic Mode, there is no clone available yet on page load, so that could cause an issue if that other plugin is looking for an element that doesn\'t exist yet.','Sticky Anything plugin'); ?></p>
38
+ <p><?php _e('(This may all sound terribly confusing. And it is! So, much work was done to fix this nonsense: since v2.0 of the plugin, a whole different method is being used to make elements sticky, and Dynamic Mode is not even an issue anymore.)','Sticky Anything plugin'); ?></p>
39
+ <p><?php _e('Phew!','Sticky Anything plugin'); ?></p>
40
+
41
+ <p><strong><?php _e('Q: I\'ll need more help please!','Sticky Anything plugin'); ?></strong><br />
42
+ <?php _e('<!-- The plugin\'s own page can be found at <a href="http://www.senff.com/plugins/sticky-anything-wp" target="_blank">http://www.senff.com/plugins/sticky-anything-wp</a>. If that still doesn\'t help you solve your issue, please do NOT file a bug through the form on my website, but instead --> Please go to the plugin\'s <a href="https://wordpress.org/support/plugin/sticky-menu-or-anything-on-scroll" target="_blank">support forum on WordPress.org</a> and post a message (include a link to your site if possible). Repsonse time is usually within a few hours maximum.','Sticky Anything plugin'); ?></p>
assets/js/jq-sticky-anything.js CHANGED
@@ -1,308 +1,319 @@
1
- /**
2
- * @preserve Sticky Anything 2.0 | @senff | GPL2 Licensed
3
- */
4
-
5
- console.error('PLEASE NOTE: this is just a notification that the Sticky Menu (or Anything!) plugin is now working in Debug Mode.');
6
- console.error('Even though this mode will not impact any functionality, do NOT use this mode in production environments!');
7
-
8
- (function ($) {
9
-
10
- $.fn.stickThis = function(options) {
11
-
12
- var settings = $.extend({
13
- // Default
14
- top: 0,
15
- minscreenwidth: 0,
16
- maxscreenwidth: 99999,
17
- zindex: 1,
18
- legacymode: false,
19
- dynamicmode: false,
20
- debugmode: false,
21
- pushup: '',
22
- adminbar: false
23
- }, options );
24
-
25
- var numElements = $(this).length;
26
- var numPushElements = $(settings.pushup).length;
27
-
28
- if (numPushElements < 1) {
29
- // There are no elements on the page with the called selector for the Push-up Element.
30
- if((settings.debugmode == true) && (settings.pushup)) {
31
- console.error('STICKY ANYTHING DEBUG: There are no elements with the selector/class/ID you selected for the Push-up element ("'+settings.pushup+'").');
32
- }
33
- // Resetting it to NOTHING.
34
- settings.pushup = '';
35
- } else if (numPushElements > 1) {
36
- // You can't use more than one element to push up the sticky element.
37
- // Make sure that you use a selector that applies to only ONE SINGLE element on the page.
38
- // Want to find out quickly where all the elements are that you targeted? Uncomment the next line to debug.
39
- // $(settings.pushup).css('border','solid 3px #ff0000');
40
- if(settings.debugmode == true) {
41
- console.error('STICKY ANYTHING DEBUG: There are '+numPushElements+' elements on the page with the selector/class/ID you selected for the push-up element ("'+settings.pushup+'"). You can select only ONE element to push the sticky element up.');
42
- }
43
- // Resetting it to NOTHING.
44
- settings.pushup = '';
45
- }
46
-
47
- if (numElements < 1) {
48
- // There are no elements on the page with the called selector.
49
- if(settings.debugmode == true) {
50
- console.error('STICKY ANYTHING DEBUG: There are no elements with the selector/class/ID you selected for the sticky element ("'+this.selector+'").');
51
- }
52
- } else if (numElements > 1) {
53
- // This is not going to work either. You can't make more than one element sticky. They will only get in eachother's way.
54
- // Make sure that you use a selector that applies to only ONE SINGLE element on the page.
55
- // Want to find out quickly where all the elements are that you targeted? Uncomment the next line to debug.
56
- // $(this).css('border','solid 3px #00ff00');
57
- if(settings.debugmode == true) {
58
- console.error('STICKY ANYTHING DEBUG: There There are '+numPushElements+' elements with the selector/class/ID you selected for the sticky element ("'+this.selector+'"). You can only make ONE element sticky.');
59
- }
60
- } else {
61
-
62
- if(settings.legacymode == true) {
63
-
64
- // LEGACY MODE
65
- $(this).addClass('sticky-element-original');
66
- if(settings.dynamicmode != true) {
67
- // Create a clone of the menu, right next to original (in the DOM) on initial page load
68
- createClone(settings.top,settings.zindex,settings.adminbar);
69
- }
70
- checkElement = setInterval(function(){stickItLegacy(settings.top,settings.minscreenwidth,settings.maxscreenwidth,settings.zindex,settings.pushup,settings.dynamicmode,settings.adminbar)},10);
71
-
72
- } else {
73
-
74
- // MODERN MODE
75
- $(this).addClass('sticky-element-original');
76
- orgAssignedStyles = cssStyles($(this)); // All original element styles, assigned by CSS.
77
- orgInlineStyles = $('.sticky-element-original').attr('style');
78
- if (orgInlineStyles == null) {
79
- orgInlineStyles = '';
80
- }
81
- createPlaceholder();
82
-
83
- checkElement = setInterval(function(){stickIt(settings.top,settings.minscreenwidth,settings.maxscreenwidth,settings.zindex,settings.pushup,settings.adminbar,orgAssignedStyles,orgInlineStyles)},10);
84
- }
85
- }
86
-
87
- return this;
88
- };
89
-
90
-
91
- // The new StickIt function
92
- function stickIt(stickyTop,minwidth,maxwidth,stickyZindex,pushup,adminbar,originalAssignedStyles,originalInlineStyles) {
93
-
94
- // We need to check the position of the ACTIVE element.
95
- // This is the original one when it's not sticky, but when it's sticky, it's the placeholder.
96
- $listenerElement = $('.sticky-element-active');
97
-
98
- var orgElementPos = $listenerElement.offset();
99
- orgElementTop = orgElementPos.top;
100
-
101
- if(pushup) {
102
- var pushElementPos = $(pushup).offset();
103
- pushElementTop = pushElementPos.top;
104
- }
105
-
106
- // Calculating actual viewport width
107
- var e = window, a = 'inner';
108
- if (!('innerWidth' in window )) {
109
- a = 'client';
110
- e = document.documentElement || document.body;
111
- }
112
- viewport = e[ a+'Width' ];
113
-
114
- if ((adminbar) && $('body').hasClass('admin-bar') && (viewport > 600)) {
115
- // below 600, the adminbar is not fixed
116
- adminBarHeight = $('#wpadminbar').height();
117
- } else {
118
- adminBarHeight = 0;
119
- }
120
-
121
- if (($(window).scrollTop() >= (orgElementTop - stickyTop - adminBarHeight)) && (viewport >= minwidth) && (viewport <= maxwidth)) {
122
-
123
- // We've scrolled PAST the original position; this is where we need to make the element sticky.
124
-
125
- // Placeholder element should always have same left position as original element (see comment below).
126
- // The sticky element will NOT have a TOP or the LEFT margin. This is because the left/top reference point of the original
127
- // element does not consider the margin. So, we're checking the left/top point of the actual original element and then
128
- // use that position for the sticky element.
129
-
130
- // LEFT POSITION
131
- coordsOrgElement = $listenerElement.offset();
132
- leftOrgElement = coordsOrgElement.left; // This is the position REGARDLESS of the margin.
133
-
134
- // WIDTH/HEIGHT
135
- // The placeholder needs to have the width and height of the original element, WITHOUT the margins but WITH the padding and borders
136
- // Whatever margins the original has, the placeholder needs to have that too.
137
-
138
- widthPlaceholder = $listenerElement[0].getBoundingClientRect().width;
139
- if (!widthPlaceholder) {
140
- widthPlaceholder = $listenerElement.css('width'); // FALLBACK for subpixels
141
- }
142
- heightPlaceholder = $listenerElement[0].getBoundingClientRect().height;
143
- if (!heightPlaceholder) {
144
- heightPlaceholder = $listenerElement.css('height'); // FALLBACK for subpixels
145
- }
146
-
147
- // WIDTH/HEIGHT OF STICKY ELEMENT
148
- // The original element though, needs to have the inner width and height of the original (non-sticky) element
149
- // No padding, no borders, because that will be applied later anyway, regardless of box-sizing
150
- widthSticky = $('.sticky-element-original').css('width');
151
- if(widthSticky == '0px') {
152
- widthSticky = ($('.sticky-element-original')[0].getBoundingClientRect().width);
153
- }
154
- heightSticky = $('.sticky-element-original').height();
155
-
156
- // PADDING
157
- // If padding is percentages, convert to pixels
158
- // Just a leftover from the old method. We will not use padding for the placeholder
159
- paddingOrgElement = [$listenerElement.css('padding-top'), $listenerElement.css('padding-right'), $listenerElement.css('padding-bottom'),$listenerElement.css('padding-left')];
160
- paddingPlaceholder = paddingOrgElement[0] + ' ' + paddingOrgElement[1] + ' ' + paddingOrgElement[2] + ' ' + paddingOrgElement[3];
161
-
162
- // MARGIN
163
- marginOrgElement = [$listenerElement.css('margin-top'), $listenerElement.css('margin-right'), $listenerElement.css('margin-bottom'),$listenerElement.css('margin-left')];
164
- marginPlaceholder = marginOrgElement[0] + ' ' + marginOrgElement[1] + ' ' + marginOrgElement[2] + ' ' + marginOrgElement[3];
165
-
166
- // OTHER ELEMENTS
167
- // if original has float, display, etc., we need to assign that to the placeholder
168
- // Though not as important as the width/height/margin/padding
169
-
170
- assignedStyles = '';
171
- for (var importantStyle in originalAssignedStyles) {
172
- if (originalAssignedStyles[importantStyle] == 'inline') {
173
- assignedStyles += importantStyle+':inline-block; ';
174
- } else {
175
- assignedStyles += importantStyle+':'+originalAssignedStyles[importantStyle]+'; ';
176
- }
177
- }
178
-
179
- // Fixes bug where height of original element returns zero
180
- // Is this still needed for the post-2.0 mode??
181
- elementHeight = 0;
182
- if (heightPlaceholder < 1) {
183
- elementHeight = $('.sticky-element-cloned').outerHeight();
184
- } else {
185
- elementHeight = $('.sticky-element-original').outerHeight();
186
- }
187
-
188
- // If scrolled position = pushup-element (top coordinate) - space between top and element - element height - admin bar
189
- // In other words, if the pushup element hits the bottom of the sticky element
190
- if (pushup && ($(window).scrollTop() > (pushElementTop-stickyTop-elementHeight-adminBarHeight))) {
191
- stickyTopMargin = (pushElementTop-stickyTop-elementHeight-$(window).scrollTop());
192
- } else {
193
- stickyTopMargin = adminBarHeight;
194
- }
195
-
196
- assignedStyles += 'width:'+widthPlaceholder+'px; height:'+heightPlaceholder+'px; margin:'+marginPlaceholder+';';
197
-
198
- $('.sticky-element-original').removeClass('sticky-element-active').css('position','fixed').css('left',leftOrgElement+'px').css('top',stickyTop+'px').css('width',widthSticky).css('margin-left',0).css('margin-top',stickyTopMargin).css('z-index',stickyZindex);
199
- if(!$('.sticky-element-placeholder').hasClass('sticky-element-active')) {
200
- $('.sticky-element-placeholder').addClass('sticky-element-active').attr('style',assignedStyles);
201
- }
202
-
203
- } else {
204
- // not scrolled past the menu; only show the original element.
205
- $('.sticky-element-original').addClass('sticky-element-active').attr('style',originalInlineStyles);
206
- if($('.sticky-element-placeholder').hasClass('sticky-element-active')) {
207
- $('.sticky-element-placeholder').removeClass('sticky-element-active').removeAttr('style').css('width','0').css('height','0').css('margin','0').css('padding','0');
208
- }
209
- }
210
-
211
- }
212
-
213
- function createPlaceholder() {
214
- $('.sticky-element-original').addClass('sticky-element-active').before('<div class="sticky-element-placeholder" style="width:0; height:0; margin:0; padding:0; visibility:hidden;"></div>');
215
- }
216
-
217
- // Helper function: get the important CSS rules from an element
218
- function cssStyles(el) {
219
- o = {};
220
- importantStyles = ['display','float','flex','box-sizing','clear','overflow','transform'];
221
- for(var styleProp in importantStyles) {
222
- o[importantStyles[styleProp]] = el.css(importantStyles[styleProp]);
223
- }
224
- return o;
225
- }
226
-
227
- // The old StickIt function
228
- function stickItLegacy(stickyTop,minwidth,maxwidth,stickyZindex,pushup,dynamic,adminbar) {
229
-
230
- var orgElementPos = $('.sticky-element-original').offset();
231
- orgElementTop = orgElementPos.top;
232
-
233
- if(pushup) {
234
- var pushElementPos = $(pushup).offset();
235
- pushElementTop = pushElementPos.top;
236
- }
237
-
238
- // Calculating actual viewport width
239
- var e = window, a = 'inner';
240
- if (!('innerWidth' in window )) {
241
- a = 'client';
242
- e = document.documentElement || document.body;
243
- }
244
- viewport = e[ a+'Width' ];
245
-
246
- if ((adminbar) && $('body').hasClass('admin-bar') && (viewport > 600)) {
247
- adminBarHeight = $('#wpadminbar').height();
248
- } else {
249
- adminBarHeight = 0;
250
- }
251
-
252
- if (($(window).scrollTop() >= (orgElementTop - stickyTop - adminBarHeight)) && (viewport >= minwidth) && (viewport <= maxwidth)) {
253
-
254
- // scrolled past the original position; now only show the cloned, sticky element.
255
-
256
- // Cloned element should always have same left position and width as original element.
257
- orgElement = $('.sticky-element-original');
258
- coordsOrgElement = orgElement.offset();
259
- leftOrgElement = coordsOrgElement.left;
260
- widthOrgElement = orgElement[0].getBoundingClientRect().width;
261
- if (!widthOrgElement) {
262
- widthOrgElement = orgElement.css('width'); // FALLBACK for subpixels
263
- }
264
- heightOrgElement = orgElement.outerHeight();
265
-
266
- // If padding is percentages, convert to pixels
267
- paddingOrgElement = [orgElement.css('padding-top'), orgElement.css('padding-right'), orgElement.css('padding-bottom'), orgElement.css('padding-left')];
268
- paddingCloned = paddingOrgElement[0] + ' ' + paddingOrgElement[1] + ' ' + paddingOrgElement[2] + ' ' + paddingOrgElement[3];
269
-
270
- if( (dynamic == true) && ($('.sticky-element-cloned').length < 1) ) {
271
- // DYNAMIC MODE: if there is no clone present, create it right now
272
- createClone(stickyTop,stickyZindex);
273
- }
274
-
275
- // Fixes bug where height of original element returns zero
276
- elementHeight = 0;
277
- if (heightOrgElement < 1) {
278
- elementHeight = $('.sticky-element-cloned').outerHeight();
279
- } else {
280
- elementHeight = $('.sticky-element-original').outerHeight();
281
- }
282
-
283
- // If scrolled position = pushup-element (top coordinate) - space between top and element - element height - admin bar
284
- // In other words, if the pushup element hits the bottom of the sticky element
285
- if (pushup && ($(window).scrollTop() > (pushElementTop-stickyTop-elementHeight-adminBarHeight))) {
286
- stickyTopMargin = (pushElementTop-stickyTop-elementHeight-$(window).scrollTop());
287
- } else {
288
- stickyTopMargin = adminBarHeight;
289
- }
290
-
291
- $('.sticky-element-cloned').css('left',leftOrgElement+'px').css('top',stickyTop+'px').css('width',widthOrgElement).css('margin-top',stickyTopMargin).css('padding',paddingCloned).show();
292
- $('.sticky-element-original').css('visibility','hidden');
293
- } else {
294
- // not scrolled past the menu; only show the original menu.
295
- if(dynamic == true) {
296
- $('.sticky-element-cloned').remove();
297
- } else {
298
- $('.sticky-element-cloned').hide();
299
- }
300
- $('.sticky-element-original').css('visibility','visible');
301
- }
302
- }
303
-
304
- function createClone(cloneTop,cloneZindex) {
305
- $('.sticky-element-original').clone().insertAfter($('.sticky-element-original')).addClass('sticky-element-cloned').css('position','fixed').css('top',cloneTop+'px').css('margin-left','0').css('z-index',cloneZindex).removeClass('sticky-element-original').hide();
306
- }
307
-
308
- }(jQuery));
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * @preserve Sticky Anything 2.0.1 | @senff | GPL2 Licensed
3
+ */
4
+
5
+ console.error('PLEASE NOTE: this is just a notification that the Sticky Menu (or Anything!) plugin is now working in Debug Mode.');
6
+ console.error('Even though this mode will not impact any functionality, do NOT use this mode in production environments!');
7
+
8
+ (function ($) {
9
+
10
+ $.fn.stickThis = function(options) {
11
+
12
+ var settings = $.extend({
13
+ // Default
14
+ top: 0,
15
+ minscreenwidth: 0,
16
+ maxscreenwidth: 99999,
17
+ zindex: 1,
18
+ legacymode: false,
19
+ dynamicmode: false,
20
+ debugmode: false,
21
+ pushup: '',
22
+ adminbar: false
23
+ }, options );
24
+
25
+ var numElements = $(this).length;
26
+ var numPushElements = $(settings.pushup).length;
27
+
28
+ if (numPushElements < 1) {
29
+ // There are no elements on the page with the called selector for the Push-up Element.
30
+ if((settings.debugmode == true) && (settings.pushup)) {
31
+ console.error('STICKY ANYTHING DEBUG: There are no elements with the selector/class/ID you selected for the Push-up element ("'+settings.pushup+'").');
32
+ }
33
+ // Resetting it to NOTHING.
34
+ settings.pushup = '';
35
+ } else if (numPushElements > 1) {
36
+ // You can't use more than one element to push up the sticky element.
37
+ // Make sure that you use a selector that applies to only ONE SINGLE element on the page.
38
+ // Want to find out quickly where all the elements are that you targeted? Uncomment the next line to debug.
39
+ // $(settings.pushup).css('border','solid 3px #ff0000');
40
+ if(settings.debugmode == true) {
41
+ console.error('STICKY ANYTHING DEBUG: There are '+numPushElements+' elements on the page with the selector/class/ID you selected for the push-up element ("'+settings.pushup+'"). You can select only ONE element to push the sticky element up.');
42
+ }
43
+ // Resetting it to NOTHING.
44
+ settings.pushup = '';
45
+ }
46
+
47
+ if (numElements < 1) {
48
+ // There are no elements on the page with the called selector.
49
+ if(settings.debugmode == true) {
50
+ console.error('STICKY ANYTHING DEBUG: There are no elements with the selector/class/ID you selected for the sticky element ("'+this.selector+'").');
51
+ }
52
+ } else if (numElements > 1) {
53
+ // This is not going to work either. You can't make more than one element sticky. They will only get in eachother's way.
54
+ // Make sure that you use a selector that applies to only ONE SINGLE element on the page.
55
+ // Want to find out quickly where all the elements are that you targeted? Uncomment the next line to debug.
56
+ // $(this).css('border','solid 3px #00ff00');
57
+ if(settings.debugmode == true) {
58
+ console.error('STICKY ANYTHING DEBUG: There There are '+numPushElements+' elements with the selector/class/ID you selected for the sticky element ("'+this.selector+'"). You can only make ONE element sticky.');
59
+ }
60
+ } else {
61
+
62
+ if(settings.legacymode == true) {
63
+
64
+ // LEGACY MODE
65
+ $(this).addClass('sticky-element-original');
66
+ if(settings.dynamicmode != true) {
67
+ // Create a clone of the menu, right next to original (in the DOM) on initial page load
68
+ createClone(settings.top,settings.zindex,settings.adminbar);
69
+ }
70
+ checkElement = setInterval(function(){stickItLegacy(settings.top,settings.minscreenwidth,settings.maxscreenwidth,settings.zindex,settings.pushup,settings.dynamicmode,settings.adminbar)},10);
71
+
72
+ } else {
73
+
74
+ // MODERN MODE
75
+ $(this).addClass('sticky-element-original');
76
+ orgAssignedStyles = cssStyles($(this)); // All original element styles, assigned by CSS.
77
+ orgInlineStyles = $('.sticky-element-original').attr('style');
78
+ if (orgInlineStyles == null) {
79
+ orgInlineStyles = '';
80
+ }
81
+ createPlaceholder();
82
+
83
+ checkElement = setInterval(function(){stickIt(settings.top,settings.minscreenwidth,settings.maxscreenwidth,settings.zindex,settings.pushup,settings.adminbar,orgAssignedStyles,orgInlineStyles)},10);
84
+ }
85
+ }
86
+
87
+ return this;
88
+ };
89
+
90
+
91
+ // The new StickIt function
92
+ function stickIt(stickyTop,minwidth,maxwidth,stickyZindex,pushup,adminbar,originalAssignedStyles,originalInlineStyles) {
93
+
94
+ // We need to check the position of the ACTIVE element.
95
+ // This is the original one when it's not sticky, but when it's sticky, it's the placeholder.
96
+ $listenerElement = $('.sticky-element-active');
97
+
98
+ var orgElementPos = $listenerElement.offset();
99
+ orgElementTop = orgElementPos.top;
100
+
101
+ if(pushup) {
102
+ var pushElementPos = $(pushup).offset();
103
+ pushElementTop = pushElementPos.top;
104
+ }
105
+
106
+ // Calculating actual viewport width
107
+ var e = window, a = 'inner';
108
+ if (!('innerWidth' in window )) {
109
+ a = 'client';
110
+ e = document.documentElement || document.body;
111
+ }
112
+ viewport = e[ a+'Width' ];
113
+
114
+ if ((adminbar) && $('body').hasClass('admin-bar') && (viewport > 600)) {
115
+ // below 600, the adminbar is not fixed
116
+ adminBarHeight = $('#wpadminbar').height();
117
+ } else {
118
+ adminBarHeight = 0;
119
+ }
120
+
121
+ if (($(window).scrollTop() >= (orgElementTop - stickyTop - adminBarHeight)) && (viewport >= minwidth) && (viewport <= maxwidth)) {
122
+
123
+ // We've scrolled PAST the original position; this is where we need to make the element sticky.
124
+
125
+ // Placeholder element should always have same left position as original element (see comment below).
126
+ // The sticky element will NOT have a TOP or the LEFT margin. This is because the left/top reference point of the original
127
+ // element does not consider the margin. So, we're checking the left/top point of the actual original element and then
128
+ // use that position for the sticky element.
129
+
130
+ // LEFT POSITION
131
+ coordsOrgElement = $listenerElement.offset();
132
+ leftOrgElement = coordsOrgElement.left; // This is the position REGARDLESS of the margin.
133
+
134
+ // WIDTH/HEIGHT
135
+ // The placeholder needs to have the width and height of the original element, WITHOUT the margins but WITH the padding and borders
136
+ // Whatever margins the original has, the placeholder needs to have that too.
137
+
138
+ widthPlaceholder = $listenerElement[0].getBoundingClientRect().width;
139
+ if (!widthPlaceholder) {
140
+ widthPlaceholder = $listenerElement.css('width'); // FALLBACK for subpixels
141
+ }
142
+ heightPlaceholder = $listenerElement[0].getBoundingClientRect().height;
143
+ if (!heightPlaceholder) {
144
+ heightPlaceholder = $listenerElement.css('height'); // FALLBACK for subpixels
145
+ }
146
+
147
+ // WIDTH/HEIGHT OF STICKY ELEMENT
148
+ // The original element though, needs to have the inner width and height of the original (non-sticky) element
149
+ // No padding, no borders, because that will be applied later anyway, regardless of box-sizing
150
+ widthSticky = $('.sticky-element-original').css('width');
151
+ if(widthSticky == '0px') {
152
+ widthSticky = ($('.sticky-element-original')[0].getBoundingClientRect().width);
153
+ }
154
+ heightSticky = $('.sticky-element-original').height();
155
+
156
+ // PADDING
157
+ // If padding is percentages, convert to pixels when it becomes sticky
158
+ // Just a leftover from the old method. We will not use padding for the placeholder
159
+ paddingOrgElement = [$('.sticky-element-original').css('padding-top'), $('.sticky-element-original').css('padding-right'), $('.sticky-element-original').css('padding-bottom'),$('.sticky-element-original').css('padding-left')];
160
+ paddingSticky = paddingOrgElement[0] + ' ' + paddingOrgElement[1] + ' ' + paddingOrgElement[2] + ' ' + paddingOrgElement[3];
161
+
162
+ // MARGIN
163
+ marginOrgElement = [$listenerElement.css('margin-top'), $listenerElement.css('margin-right'), $listenerElement.css('margin-bottom'),$listenerElement.css('margin-left')];
164
+ marginPlaceholder = marginOrgElement[0] + ' ' + marginOrgElement[1] + ' ' + marginOrgElement[2] + ' ' + marginOrgElement[3];
165
+
166
+ // OTHER ELEMENTS
167
+ // if original has float, display, etc., we need to assign that to the placeholder
168
+ // Though not as important as the width/height/margin/padding
169
+
170
+ assignedStyles = '';
171
+ for (var importantStyle in originalAssignedStyles) {
172
+ if (originalAssignedStyles[importantStyle] == 'inline') {
173
+ assignedStyles += importantStyle+':inline-block; ';
174
+ } else {
175
+ assignedStyles += importantStyle+':'+originalAssignedStyles[importantStyle]+'; ';
176
+ }
177
+ }
178
+
179
+ // Fixes bug where height of original element returns zero
180
+ // Is this still needed for the post-2.0 mode??
181
+ elementHeight = 0;
182
+ if (heightPlaceholder < 1) {
183
+ elementHeight = $('.sticky-element-cloned').outerHeight();
184
+ } else {
185
+ elementHeight = $('.sticky-element-original').outerHeight();
186
+ }
187
+
188
+ // If scrolled position = pushup-element (top coordinate) - space between top and element - element height - admin bar
189
+ // In other words, if the pushup element hits the bottom of the sticky element
190
+ if (pushup && ($(window).scrollTop() > (pushElementTop-stickyTop-elementHeight-adminBarHeight))) {
191
+ stickyTopMargin = (pushElementTop-stickyTop-elementHeight-$(window).scrollTop());
192
+ } else {
193
+ stickyTopMargin = adminBarHeight;
194
+ }
195
+
196
+ assignedStyles += 'width:'+widthPlaceholder+'px; height:'+heightPlaceholder+'px; margin:'+marginPlaceholder+';';
197
+
198
+ $('.sticky-element-original').removeClass('sticky-element-active').css('position','fixed').css('left',leftOrgElement+'px').css('top',stickyTop+'px').css('width',widthSticky).css('margin-left',0).css('padding',paddingSticky).css('margin-top',stickyTopMargin).css('z-index',stickyZindex);
199
+ if(!$('.sticky-element-placeholder').hasClass('sticky-element-active')) {
200
+ $('.sticky-element-placeholder').addClass('sticky-element-active').attr('style',assignedStyles);
201
+ }
202
+
203
+ } else {
204
+ // not scrolled past the menu; only show the original element.
205
+ $('.sticky-element-original').addClass('sticky-element-active').attr('style',originalInlineStyles);
206
+ if($('.sticky-element-placeholder').hasClass('sticky-element-active')) {
207
+ $('.sticky-element-placeholder').removeClass('sticky-element-active').removeAttr('style').css('width','0').css('height','0').css('margin','0').css('padding','0');
208
+ }
209
+ }
210
+
211
+ }
212
+
213
+ function createPlaceholder() {
214
+ $('.sticky-element-original').addClass('sticky-element-active').before('<div class="sticky-element-placeholder" style="width:0; height:0; margin:0; padding:0; visibility:hidden;"></div>');
215
+ }
216
+
217
+ // Helper function: get the important CSS rules from an element
218
+ function cssStyles(el) {
219
+ o = {};
220
+
221
+ o['display'] = el.css('display');
222
+ o['float'] = el.css('float');
223
+ o['flex'] = el.css('flex');
224
+ o['box-sizing'] = el.css('box-sizing');
225
+ o['clear'] = el.css('clear');
226
+ o['overflow'] = el.css('overflow');
227
+ o['transform'] = el.css('transform');
228
+
229
+ // For some reason, this original loop doesn't work with some themes/plugins.
230
+ // importantStyles = ['display','float','flex','box-sizing','clear','overflow','transform'];
231
+ // for(var styleProp in importantStyles) {
232
+ // o[importantStyles[styleProp]] = el.css(importantStyles[styleProp]);
233
+ // }
234
+
235
+ return o;
236
+ }
237
+
238
+ // The old StickIt function
239
+ function stickItLegacy(stickyTop,minwidth,maxwidth,stickyZindex,pushup,dynamic,adminbar) {
240
+
241
+ var orgElementPos = $('.sticky-element-original').offset();
242
+ orgElementTop = orgElementPos.top;
243
+
244
+ if(pushup) {
245
+ var pushElementPos = $(pushup).offset();
246
+ pushElementTop = pushElementPos.top;
247
+ }
248
+
249
+ // Calculating actual viewport width
250
+ var e = window, a = 'inner';
251
+ if (!('innerWidth' in window )) {
252
+ a = 'client';
253
+ e = document.documentElement || document.body;
254
+ }
255
+ viewport = e[ a+'Width' ];
256
+
257
+ if ((adminbar) && $('body').hasClass('admin-bar') && (viewport > 600)) {
258
+ adminBarHeight = $('#wpadminbar').height();
259
+ } else {
260
+ adminBarHeight = 0;
261
+ }
262
+
263
+ if (($(window).scrollTop() >= (orgElementTop - stickyTop - adminBarHeight)) && (viewport >= minwidth) && (viewport <= maxwidth)) {
264
+
265
+ // scrolled past the original position; now only show the cloned, sticky element.
266
+
267
+ // Cloned element should always have same left position and width as original element.
268
+ orgElement = $('.sticky-element-original');
269
+ coordsOrgElement = orgElement.offset();
270
+ leftOrgElement = coordsOrgElement.left;
271
+ widthOrgElement = orgElement[0].getBoundingClientRect().width;
272
+ if (!widthOrgElement) {
273
+ widthOrgElement = orgElement.css('width'); // FALLBACK for subpixels
274
+ }
275
+ heightOrgElement = orgElement.outerHeight();
276
+
277
+ // If padding is percentages, convert to pixels
278
+ paddingOrgElement = [orgElement.css('padding-top'), orgElement.css('padding-right'), orgElement.css('padding-bottom'), orgElement.css('padding-left')];
279
+ paddingCloned = paddingOrgElement[0] + ' ' + paddingOrgElement[1] + ' ' + paddingOrgElement[2] + ' ' + paddingOrgElement[3];
280
+
281
+ if( (dynamic == true) && ($('.sticky-element-cloned').length < 1) ) {
282
+ // DYNAMIC MODE: if there is no clone present, create it right now
283
+ createClone(stickyTop,stickyZindex);
284
+ }
285
+
286
+ // Fixes bug where height of original element returns zero
287
+ elementHeight = 0;
288
+ if (heightOrgElement < 1) {
289
+ elementHeight = $('.sticky-element-cloned').outerHeight();
290
+ } else {
291
+ elementHeight = $('.sticky-element-original').outerHeight();
292
+ }
293
+
294
+ // If scrolled position = pushup-element (top coordinate) - space between top and element - element height - admin bar
295
+ // In other words, if the pushup element hits the bottom of the sticky element
296
+ if (pushup && ($(window).scrollTop() > (pushElementTop-stickyTop-elementHeight-adminBarHeight))) {
297
+ stickyTopMargin = (pushElementTop-stickyTop-elementHeight-$(window).scrollTop());
298
+ } else {
299
+ stickyTopMargin = adminBarHeight;
300
+ }
301
+
302
+ $('.sticky-element-cloned').css('left',leftOrgElement+'px').css('top',stickyTop+'px').css('width',widthOrgElement).css('margin-top',stickyTopMargin).css('padding',paddingCloned).show();
303
+ $('.sticky-element-original').css('visibility','hidden');
304
+ } else {
305
+ // not scrolled past the menu; only show the original menu.
306
+ if(dynamic == true) {
307
+ $('.sticky-element-cloned').remove();
308
+ } else {
309
+ $('.sticky-element-cloned').hide();
310
+ }
311
+ $('.sticky-element-original').css('visibility','visible');
312
+ }
313
+ }
314
+
315
+ function createClone(cloneTop,cloneZindex) {
316
+ $('.sticky-element-original').clone().insertAfter($('.sticky-element-original')).addClass('sticky-element-cloned').css('position','fixed').css('top',cloneTop+'px').css('margin-left','0').css('z-index',cloneZindex).removeClass('sticky-element-original').hide();
317
+ }
318
+
319
+ }(jQuery));
assets/js/jq-sticky-anything.min.js CHANGED
@@ -1,7 +1,7 @@
1
- /**
2
- * @preserve Sticky Anything 2.0 | @senff | GPL2 Licensed
3
- */
4
-
5
- var stickyAnythingBreakpoint = '' // solely to use as a debugging breakpoint, if needed.
6
-
7
- !function(e){function t(t,i,n,l,s,r,o,d){$listenerElement=e(".sticky-element-active");var m=$listenerElement.offset();if(orgElementTop=m.top,s){var a=e(s).offset();pushElementTop=a.top}var c=window,g="inner";if("innerWidth"in window||(g="client",c=document.documentElement||document.body),viewport=c[g+"Width"],r&&e("body").hasClass("admin-bar")&&viewport>600?adminBarHeight=e("#wpadminbar").height():adminBarHeight=0,e(window).scrollTop()>=orgElementTop-t-adminBarHeight&&viewport>=i&&viewport<=n){coordsOrgElement=$listenerElement.offset(),leftOrgElement=coordsOrgElement.left,widthPlaceholder=$listenerElement[0].getBoundingClientRect().width,widthPlaceholder||(widthPlaceholder=$listenerElement.css("width")),heightPlaceholder=$listenerElement[0].getBoundingClientRect().height,heightPlaceholder||(heightPlaceholder=$listenerElement.css("height")),widthSticky=e(".sticky-element-original").css("width"),heightSticky=e(".sticky-element-original").height(),paddingOrgElement=[$listenerElement.css("padding-top"),$listenerElement.css("padding-right"),$listenerElement.css("padding-bottom"),$listenerElement.css("padding-left")],paddingPlaceholder=paddingOrgElement[0]+" "+paddingOrgElement[1]+" "+paddingOrgElement[2]+" "+paddingOrgElement[3],marginOrgElement=[$listenerElement.css("margin-top"),$listenerElement.css("margin-right"),$listenerElement.css("margin-bottom"),$listenerElement.css("margin-left")],marginPlaceholder=marginOrgElement[0]+" "+marginOrgElement[1]+" "+marginOrgElement[2]+" "+marginOrgElement[3],assignedStyles="";for(var h in o)assignedStyles+=h+":"+o[h]+"; ";elementHeight=0,heightPlaceholder<1?elementHeight=e(".sticky-element-cloned").outerHeight():elementHeight=e(".sticky-element-original").outerHeight(),s&&e(window).scrollTop()>pushElementTop-t-elementHeight-adminBarHeight?stickyTopMargin=pushElementTop-t-elementHeight-e(window).scrollTop():stickyTopMargin=adminBarHeight,assignedStyles+="width:"+widthPlaceholder+"px; height:"+heightPlaceholder+"px; margin:"+marginPlaceholder+";",e(".sticky-element-original").removeClass("sticky-element-active").css("position","fixed").css("left",leftOrgElement+"px").css("top",t+"px").css("width",widthSticky).css("margin-left",0).css("margin-top",stickyTopMargin).css("z-index",l),e(".sticky-element-placeholder").hasClass("sticky-element-active")||e(".sticky-element-placeholder").addClass("sticky-element-active").attr("style",assignedStyles)}else e(".sticky-element-original").addClass("sticky-element-active").attr("style",d),e(".sticky-element-placeholder").hasClass("sticky-element-active")&&e(".sticky-element-placeholder").removeClass("sticky-element-active").removeAttr("style").css("width","0").css("height","0").css("margin","0").css("padding","0")}function i(){e(".sticky-element-original").addClass("sticky-element-active").before('<div class="sticky-element-placeholder" style="width:0; height:0; margin:0; padding:0; visibility:hidden;"></div>')}function n(e){o={},importantStyles=["display","float","flex","box-sizing","clear","overflow"];for(var t in importantStyles)o[importantStyles[t]]=e.css(importantStyles[t]);return o}function l(t,i,n,l,r,o,d){var m=e(".sticky-element-original").offset();if(orgElementTop=m.top,r){var a=e(r).offset();pushElementTop=a.top}var c=window,g="inner";"innerWidth"in window||(g="client",c=document.documentElement||document.body),viewport=c[g+"Width"],d&&e("body").hasClass("admin-bar")&&viewport>600?adminBarHeight=e("#wpadminbar").height():adminBarHeight=0,e(window).scrollTop()>=orgElementTop-t-adminBarHeight&&viewport>=i&&viewport<=n?(orgElement=e(".sticky-element-original"),coordsOrgElement=orgElement.offset(),leftOrgElement=coordsOrgElement.left,widthOrgElement=orgElement[0].getBoundingClientRect().width,widthOrgElement||(widthOrgElement=orgElement.css("width")),heightOrgElement=orgElement.outerHeight(),paddingOrgElement=[orgElement.css("padding-top"),orgElement.css("padding-right"),orgElement.css("padding-bottom"),orgElement.css("padding-left")],paddingCloned=paddingOrgElement[0]+" "+paddingOrgElement[1]+" "+paddingOrgElement[2]+" "+paddingOrgElement[3],1==o&&e(".sticky-element-cloned").length<1&&s(t,l),elementHeight=0,heightOrgElement<1?elementHeight=e(".sticky-element-cloned").outerHeight():elementHeight=e(".sticky-element-original").outerHeight(),r&&e(window).scrollTop()>pushElementTop-t-elementHeight-adminBarHeight?stickyTopMargin=pushElementTop-t-elementHeight-e(window).scrollTop():stickyTopMargin=adminBarHeight,e(".sticky-element-cloned").css("left",leftOrgElement+"px").css("top",t+"px").css("width",widthOrgElement).css("margin-top",stickyTopMargin).css("padding",paddingCloned).show(),e(".sticky-element-original").css("visibility","hidden")):(1==o?e(".sticky-element-cloned").remove():e(".sticky-element-cloned").hide(),e(".sticky-element-original").css("visibility","visible"))}function s(t,i){e(".sticky-element-original").clone().insertAfter(e(".sticky-element-original")).addClass("sticky-element-cloned").css("position","fixed").css("top",t+"px").css("margin-left","0").css("z-index",i).removeClass("sticky-element-original").hide()}e.fn.stickThis=function(r){var o=e.extend({top:0,minscreenwidth:0,maxscreenwidth:99999,zindex:1,legacymode:!1,dynamicmode:!1,debugmode:!1,pushup:"",adminbar:!1},r),d=e(this).length,m=e(o.pushup).length;return 1>m?(1==o.debugmode&&o.pushup&&console.error('STICKY ANYTHING DEBUG: There are no elements with the selector/class/ID you selected for the Push-up element ("'+o.pushup+'").'),o.pushup=""):m>1&&(1==o.debugmode&&console.error("STICKY ANYTHING DEBUG: There are "+m+' elements on the page with the selector/class/ID you selected for the push-up element ("'+o.pushup+'"). You can select only ONE element to push the sticky element up.'),o.pushup=""),1>d?1==o.debugmode&&console.error('STICKY ANYTHING DEBUG: There are no elements with the selector/class/ID you selected for the sticky element ("'+this.selector+'").'):d>1?1==o.debugmode&&console.error("STICKY ANYTHING DEBUG: There There are "+m+' elements with the selector/class/ID you selected for the sticky element ("'+this.selector+'"). You can only make ONE element sticky.'):1==o.legacymode?(e(this).addClass("sticky-element-original"),1!=o.dynamicmode&&s(o.top,o.zindex,o.adminbar),checkElement=setInterval(function(){l(o.top,o.minscreenwidth,o.maxscreenwidth,o.zindex,o.pushup,o.dynamicmode,o.adminbar)},10)):(e(this).addClass("sticky-element-original"),orgAssignedStyles=n(e(this)),orgInlineStyles=e(".sticky-element-original").attr("style"),null==orgInlineStyles&&(orgInlineStyles=""),i(),checkElement=setInterval(function(){t(o.top,o.minscreenwidth,o.maxscreenwidth,o.zindex,o.pushup,o.adminbar,orgAssignedStyles,orgInlineStyles)},10)),this}}(jQuery);
1
+ /**
2
+ * @preserve Sticky Anything 2.0.1 | @senff | GPL2 Licensed
3
+ */
4
+
5
+ var stickyAnythingBreakpoint = '' // solely to use as a debugging breakpoint, if needed.
6
+
7
+ !function(e){function t(t,i,n,l,s,o,r,d){$listenerElement=e(".sticky-element-active");var c=$listenerElement.offset();if(orgElementTop=c.top,s){var a=e(s).offset();pushElementTop=a.top}var m=window,g="inner";if("innerWidth"in window||(g="client",m=document.documentElement||document.body),viewport=m[g+"Width"],o&&e("body").hasClass("admin-bar")&&viewport>600?adminBarHeight=e("#wpadminbar").height():adminBarHeight=0,e(window).scrollTop()>=orgElementTop-t-adminBarHeight&&viewport>=i&&viewport<=n){coordsOrgElement=$listenerElement.offset(),leftOrgElement=coordsOrgElement.left,widthPlaceholder=$listenerElement[0].getBoundingClientRect().width,widthPlaceholder||(widthPlaceholder=$listenerElement.css("width")),heightPlaceholder=$listenerElement[0].getBoundingClientRect().height,heightPlaceholder||(heightPlaceholder=$listenerElement.css("height")),widthSticky=e(".sticky-element-original").css("width"),"0px"==widthSticky&&(widthSticky=e(".sticky-element-original")[0].getBoundingClientRect().width),heightSticky=e(".sticky-element-original").height(),paddingOrgElement=[e(".sticky-element-original").css("padding-top"),e(".sticky-element-original").css("padding-right"),e(".sticky-element-original").css("padding-bottom"),e(".sticky-element-original").css("padding-left")],paddingSticky=paddingOrgElement[0]+" "+paddingOrgElement[1]+" "+paddingOrgElement[2]+" "+paddingOrgElement[3],marginOrgElement=[$listenerElement.css("margin-top"),$listenerElement.css("margin-right"),$listenerElement.css("margin-bottom"),$listenerElement.css("margin-left")],marginPlaceholder=marginOrgElement[0]+" "+marginOrgElement[1]+" "+marginOrgElement[2]+" "+marginOrgElement[3],assignedStyles="";for(var h in r)"inline"==r[h]?assignedStyles+=h+":inline-block; ":assignedStyles+=h+":"+r[h]+"; ";elementHeight=0,heightPlaceholder<1?elementHeight=e(".sticky-element-cloned").outerHeight():elementHeight=e(".sticky-element-original").outerHeight(),s&&e(window).scrollTop()>pushElementTop-t-elementHeight-adminBarHeight?stickyTopMargin=pushElementTop-t-elementHeight-e(window).scrollTop():stickyTopMargin=adminBarHeight,assignedStyles+="width:"+widthPlaceholder+"px; height:"+heightPlaceholder+"px; margin:"+marginPlaceholder+";",e(".sticky-element-original").removeClass("sticky-element-active").css("position","fixed").css("left",leftOrgElement+"px").css("top",t+"px").css("width",widthSticky).css("margin-left",0).css("padding",paddingSticky).css("margin-top",stickyTopMargin).css("z-index",l),e(".sticky-element-placeholder").hasClass("sticky-element-active")||e(".sticky-element-placeholder").addClass("sticky-element-active").attr("style",assignedStyles)}else e(".sticky-element-original").addClass("sticky-element-active").attr("style",d),e(".sticky-element-placeholder").hasClass("sticky-element-active")&&e(".sticky-element-placeholder").removeClass("sticky-element-active").removeAttr("style").css("width","0").css("height","0").css("margin","0").css("padding","0")}function i(){e(".sticky-element-original").addClass("sticky-element-active").before('<div class="sticky-element-placeholder" style="width:0; height:0; margin:0; padding:0; visibility:hidden;"></div>')}function n(e){return o={},o.display=e.css("display"),o["float"]=e.css("float"),o.flex=e.css("flex"),o["box-sizing"]=e.css("box-sizing"),o.clear=e.css("clear"),o.overflow=e.css("overflow"),o.transform=e.css("transform"),o}function l(t,i,n,l,o,r,d){var c=e(".sticky-element-original").offset();if(orgElementTop=c.top,o){var a=e(o).offset();pushElementTop=a.top}var m=window,g="inner";"innerWidth"in window||(g="client",m=document.documentElement||document.body),viewport=m[g+"Width"],d&&e("body").hasClass("admin-bar")&&viewport>600?adminBarHeight=e("#wpadminbar").height():adminBarHeight=0,e(window).scrollTop()>=orgElementTop-t-adminBarHeight&&viewport>=i&&viewport<=n?(orgElement=e(".sticky-element-original"),coordsOrgElement=orgElement.offset(),leftOrgElement=coordsOrgElement.left,widthOrgElement=orgElement[0].getBoundingClientRect().width,widthOrgElement||(widthOrgElement=orgElement.css("width")),heightOrgElement=orgElement.outerHeight(),paddingOrgElement=[orgElement.css("padding-top"),orgElement.css("padding-right"),orgElement.css("padding-bottom"),orgElement.css("padding-left")],paddingCloned=paddingOrgElement[0]+" "+paddingOrgElement[1]+" "+paddingOrgElement[2]+" "+paddingOrgElement[3],1==r&&e(".sticky-element-cloned").length<1&&s(t,l),elementHeight=0,heightOrgElement<1?elementHeight=e(".sticky-element-cloned").outerHeight():elementHeight=e(".sticky-element-original").outerHeight(),o&&e(window).scrollTop()>pushElementTop-t-elementHeight-adminBarHeight?stickyTopMargin=pushElementTop-t-elementHeight-e(window).scrollTop():stickyTopMargin=adminBarHeight,e(".sticky-element-cloned").css("left",leftOrgElement+"px").css("top",t+"px").css("width",widthOrgElement).css("margin-top",stickyTopMargin).css("padding",paddingCloned).show(),e(".sticky-element-original").css("visibility","hidden")):(1==r?e(".sticky-element-cloned").remove():e(".sticky-element-cloned").hide(),e(".sticky-element-original").css("visibility","visible"))}function s(t,i){e(".sticky-element-original").clone().insertAfter(e(".sticky-element-original")).addClass("sticky-element-cloned").css("position","fixed").css("top",t+"px").css("margin-left","0").css("z-index",i).removeClass("sticky-element-original").hide()}e.fn.stickThis=function(o){var r=e.extend({top:0,minscreenwidth:0,maxscreenwidth:99999,zindex:1,legacymode:!1,dynamicmode:!1,debugmode:!1,pushup:"",adminbar:!1},o),d=e(this).length,c=e(r.pushup).length;return 1>c?(1==r.debugmode&&r.pushup&&console.error('STICKY ANYTHING DEBUG: There are no elements with the selector/class/ID you selected for the Push-up element ("'+r.pushup+'").'),r.pushup=""):c>1&&(1==r.debugmode&&console.error("STICKY ANYTHING DEBUG: There are "+c+' elements on the page with the selector/class/ID you selected for the push-up element ("'+r.pushup+'"). You can select only ONE element to push the sticky element up.'),r.pushup=""),1>d?1==r.debugmode&&console.error('STICKY ANYTHING DEBUG: There are no elements with the selector/class/ID you selected for the sticky element ("'+this.selector+'").'):d>1?1==r.debugmode&&console.error("STICKY ANYTHING DEBUG: There There are "+c+' elements with the selector/class/ID you selected for the sticky element ("'+this.selector+'"). You can only make ONE element sticky.'):1==r.legacymode?(e(this).addClass("sticky-element-original"),1!=r.dynamicmode&&s(r.top,r.zindex,r.adminbar),checkElement=setInterval(function(){l(r.top,r.minscreenwidth,r.maxscreenwidth,r.zindex,r.pushup,r.dynamicmode,r.adminbar)},10)):(e(this).addClass("sticky-element-original"),orgAssignedStyles=n(e(this)),orgInlineStyles=e(".sticky-element-original").attr("style"),null==orgInlineStyles&&(orgInlineStyles=""),i(),checkElement=setInterval(function(){t(r.top,r.minscreenwidth,r.maxscreenwidth,r.zindex,r.pushup,r.adminbar,orgAssignedStyles,orgInlineStyles)},10)),this}}(jQuery);
assets/js/stickThis.js CHANGED
@@ -1,23 +1,23 @@
1
- /**
2
- * @preserve Sticky Anything 2.0 | @senff | GPL2 Licensed
3
- */
4
-
5
- (function($) {
6
- $(document).ready(function($) {
7
-
8
- var thisIsSomeBreakpoint = '' // solely to use as a debugging breakpoint, if needed.
9
-
10
- $(sticky_anything_engage.element).stickThis({
11
- top:sticky_anything_engage.topspace,
12
- minscreenwidth:sticky_anything_engage.minscreenwidth,
13
- maxscreenwidth:sticky_anything_engage.maxscreenwidth,
14
- zindex:sticky_anything_engage.zindex,
15
- legacymode:sticky_anything_engage.legacymode,
16
- dynamicmode:sticky_anything_engage.dynamicmode,
17
- debugmode:sticky_anything_engage.debugmode,
18
- pushup:sticky_anything_engage.pushup,
19
- adminbar:sticky_anything_engage.adminbar
20
- });
21
-
22
- });
23
- }(jQuery));
1
+ /**
2
+ * @preserve Sticky Anything 2.0.1 | @senff | GPL2 Licensed
3
+ */
4
+
5
+ (function($) {
6
+ $(document).ready(function($) {
7
+
8
+ var thisIsSomeBreakpoint = '' // solely to use as a debugging breakpoint, if needed.
9
+
10
+ $(sticky_anything_engage.element).stickThis({
11
+ top:sticky_anything_engage.topspace,
12
+ minscreenwidth:sticky_anything_engage.minscreenwidth,
13
+ maxscreenwidth:sticky_anything_engage.maxscreenwidth,
14
+ zindex:sticky_anything_engage.zindex,
15
+ legacymode:sticky_anything_engage.legacymode,
16
+ dynamicmode:sticky_anything_engage.dynamicmode,
17
+ debugmode:sticky_anything_engage.debugmode,
18
+ pushup:sticky_anything_engage.pushup,
19
+ adminbar:sticky_anything_engage.adminbar
20
+ });
21
+
22
+ });
23
+ }(jQuery));
assets/js/sticky-anything-admin.js CHANGED
@@ -1,64 +1,64 @@
1
- /**
2
- * @preserve Sticky Anything 2.0 | @senff | GPL2 Licensed
3
- */
4
-
5
- jQuery(function($) {
6
-
7
- // --- HANDLING THE TABS -----------------------------------
8
-
9
- $('.nav-tab-wrapper a, a.faq').on('click',function(t) {
10
- var tab_id = $(this).attr('href').replace('#', '.tab-sticky-');
11
- var tab_name = $(this).attr('href').replace('#', '');
12
-
13
- // Set the current tab active
14
- $(this).parent().children().removeClass('nav-tab-active');
15
- $(this).addClass('nav-tab-active');
16
-
17
- // Show the active content
18
- $('.tab-content').addClass('hide');
19
- $('.tabs-content div' + tab_id).removeClass('hide');
20
- $('input[name="sa_tab"]').val(tab_name);
21
-
22
- // Change the URL
23
- var currentURL = window.location.href;
24
- if(currentURL.indexOf('&tab')>0) {
25
- var newURL = currentURL.substring(0, currentURL.indexOf('&tab')) + '&tab=' + tab_name;
26
- } else {
27
- var newURL = currentURL + '&tab=' + tab_name;
28
- }
29
-
30
- switch(tab_name) {
31
- case 'advanced':
32
- var tab_title = 'Advanced Settings';
33
- break;
34
- case 'faq':
35
- var tab_title = 'FAQ';
36
- break;
37
- default:
38
- var tab_title = 'Basic Settings';
39
- }
40
-
41
- window.history.pushState(tab_title, tab_title, newURL);
42
- t.preventDefault();
43
- });
44
-
45
- $('a.faq').on('click',function(t) {
46
- $('.nav-tab-wrapper a').removeClass('nav-tab-active');
47
- $('.nav-tab-wrapper a[href="#faq"]').addClass('nav-tab-active');
48
- });
49
-
50
-
51
- $('#sa_legacymode').on('change',function() {
52
- if($("#sa_legacymode").is(':checked')) {
53
- $("#row-dynamic-mode").removeClass('disabled-feature');
54
- $("#row-dynamic-mode .showhide").slideDown();
55
- } else {
56
- $("#row-dynamic-mode").addClass('disabled-feature');
57
- $("#row-dynamic-mode .showhide").slideUp();
58
- }
59
- });
60
-
61
- $('.form-table').on('click','.disabled-feature', function(e) {
62
- e.preventDefault();
63
- });
64
- });
1
+ /**
2
+ * @preserve Sticky Anything 2.0.1 | @senff | GPL2 Licensed
3
+ */
4
+
5
+ jQuery(function($) {
6
+
7
+ // --- HANDLING THE TABS -----------------------------------
8
+
9
+ $('.nav-tab-wrapper a, a.faq').on('click',function(t) {
10
+ var tab_id = $(this).attr('href').replace('#', '.tab-sticky-');
11
+ var tab_name = $(this).attr('href').replace('#', '');
12
+
13
+ // Set the current tab active
14
+ $(this).parent().children().removeClass('nav-tab-active');
15
+ $(this).addClass('nav-tab-active');
16
+
17
+ // Show the active content
18
+ $('.tab-content').addClass('hide');
19
+ $('.tabs-content div' + tab_id).removeClass('hide');
20
+ $('input[name="sa_tab"]').val(tab_name);
21
+
22
+ // Change the URL
23
+ var currentURL = window.location.href;
24
+ if(currentURL.indexOf('&tab')>0) {
25
+ var newURL = currentURL.substring(0, currentURL.indexOf('&tab')) + '&tab=' + tab_name;
26
+ } else {
27
+ var newURL = currentURL + '&tab=' + tab_name;
28
+ }
29
+
30
+ switch(tab_name) {
31
+ case 'advanced':
32
+ var tab_title = 'Advanced Settings';
33
+ break;
34
+ case 'faq':
35
+ var tab_title = 'FAQ';
36
+ break;
37
+ default:
38
+ var tab_title = 'Basic Settings';
39
+ }
40
+
41
+ window.history.pushState(tab_title, tab_title, newURL);
42
+ t.preventDefault();
43
+ });
44
+
45
+ $('a.faq').on('click',function(t) {
46
+ $('.nav-tab-wrapper a').removeClass('nav-tab-active');
47
+ $('.nav-tab-wrapper a[href="#faq"]').addClass('nav-tab-active');
48
+ });
49
+
50
+
51
+ $('#sa_legacymode').on('change',function() {
52
+ if($("#sa_legacymode").is(':checked')) {
53
+ $("#row-dynamic-mode").removeClass('disabled-feature');
54
+ $("#row-dynamic-mode .showhide").slideDown();
55
+ } else {
56
+ $("#row-dynamic-mode").addClass('disabled-feature');
57
+ $("#row-dynamic-mode .showhide").slideUp();
58
+ }
59
+ });
60
+
61
+ $('.form-table').on('click','.disabled-feature', function(e) {
62
+ e.preventDefault();
63
+ });
64
+ });
assets/plugin-info.php CHANGED
@@ -1,23 +1,23 @@
1
- <h3>Plugin info</h3>
2
-
3
- <?php
4
- $options = get_option('sticky_anything_options');
5
- $version = $options['sa_version'];
6
- ?>
7
-
8
- <div class="inner">
9
-
10
- <ul>
11
- <li><strong><?php _e('Author:','Sticky Anything plugin'); ?></strong> <a href="http://www.senff.com" target="_blank">Mark Senff</a></li>
12
- <li><strong><?php _e('Version:','Sticky Anything plugin'); ?></strong> <?php echo $version; ?></li>
13
- <!-- <li><strong><?php _e('Detailed Documentation:','Sticky Anything plugin'); ?></strong> <a href="http://www.senff.com/plugins/sticky-anything-wp" target="_blank">Senff.com</a></li> -->
14
- <li><strong><?php _e('Support Forum','Sticky Anything plugin'); ?></strong>: <a href="https://wordpress.org/support/plugin/sticky-menu-or-anything-on-scroll" target="_blank">WordPress.org</a></li>
15
- <li><strong><?php _e('Development:','Sticky Anything plugin'); ?></strong> <a href="https://bitbucket.org/senff/sticky-menu-or-anything-wp" target="_blank">BitBucket</a></li>
16
- <li><strong><?php _e('Non-WP version:','Sticky Anything plugin'); ?></strong> <a href="https://github.com/senff/Sticky-Anything" target="_blank">GitHub</a></li>
17
- <li><strong><?php _e('Twitter:','Sticky Anything plugin'); ?></strong> <a href="http://www.twitter.com/senff" target="_blank">@Senff</a><br>&nbsp;</li>
18
- <li><strong><?php _e('Donate:','Sticky Anything plugin'); ?></strong> <a href="http://www.senff.com/donate" target="_blank">Paypal</a></li>
19
- </ul>
20
-
21
- </div>
22
-
23
- <p><a href="https://wordpress.org/support/plugin/sticky-menu-or-anything-on-scroll" target="_blank"><strong><?php _e('Please Report Bugs','Sticky Anything plugin'); ?></strong></a></p>
1
+ <h3>Plugin info</h3>
2
+
3
+ <?php
4
+ $options = get_option('sticky_anything_options');
5
+ $version = $options['sa_version'];
6
+ ?>
7
+
8
+ <div class="inner">
9
+
10
+ <ul>
11
+ <li><strong><?php _e('Author:','Sticky Anything plugin'); ?></strong> <a href="http://www.senff.com" target="_blank">Mark Senff</a></li>
12
+ <li><strong><?php _e('Version:','Sticky Anything plugin'); ?></strong> <?php echo $version; ?></li>
13
+ <!-- <li><strong><?php _e('Detailed Documentation:','Sticky Anything plugin'); ?></strong> <a href="http://www.senff.com/plugins/sticky-anything-wp" target="_blank">Senff.com</a></li> -->
14
+ <li><strong><?php _e('Support Forum','Sticky Anything plugin'); ?></strong>: <a href="https://wordpress.org/support/plugin/sticky-menu-or-anything-on-scroll" target="_blank">WordPress.org</a></li>
15
+ <li><strong><?php _e('Development:','Sticky Anything plugin'); ?></strong> <a href="https://bitbucket.org/senff/sticky-menu-or-anything-wp" target="_blank">BitBucket</a></li>
16
+ <li><strong><?php _e('Non-WP version:','Sticky Anything plugin'); ?></strong> <a href="https://github.com/senff/Sticky-Anything" target="_blank">GitHub</a></li>
17
+ <li><strong><?php _e('Twitter:','Sticky Anything plugin'); ?></strong> <a href="http://www.twitter.com/senff" target="_blank">@Senff</a><br>&nbsp;</li>
18
+ <li><strong><?php _e('Donate:','Sticky Anything plugin'); ?></strong> <a href="http://www.senff.com/donate" target="_blank">Paypal</a></li>
19
+ </ul>
20
+
21
+ </div>
22
+
23
+ <p><a href="https://wordpress.org/support/plugin/sticky-menu-or-anything-on-scroll" target="_blank"><strong><?php _e('Please Report Bugs','Sticky Anything plugin'); ?></strong></a></p>
assets/screenshots/screenshot-3.png ADDED
Binary file
license.txt CHANGED
@@ -1,674 +1,674 @@
1
- GNU GENERAL PUBLIC LICENSE
2
- Version 3, 29 June 2007
3
-
4
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
- Everyone is permitted to copy and distribute verbatim copies
6
- of this license document, but changing it is not allowed.
7
-
8
- Preamble
9
-
10
- The GNU General Public License is a free, copyleft license for
11
- software and other kinds of works.
12
-
13
- The licenses for most software and other practical works are designed
14
- to take away your freedom to share and change the works. By contrast,
15
- the GNU General Public License is intended to guarantee your freedom to
16
- share and change all versions of a program--to make sure it remains free
17
- software for all its users. We, the Free Software Foundation, use the
18
- GNU General Public License for most of our software; it applies also to
19
- any other work released this way by its authors. You can apply it to
20
- your programs, too.
21
-
22
- When we speak of free software, we are referring to freedom, not
23
- price. Our General Public Licenses are designed to make sure that you
24
- have the freedom to distribute copies of free software (and charge for
25
- them if you wish), that you receive source code or can get it if you
26
- want it, that you can change the software or use pieces of it in new
27
- free programs, and that you know you can do these things.
28
-
29
- To protect your rights, we need to prevent others from denying you
30
- these rights or asking you to surrender the rights. Therefore, you have
31
- certain responsibilities if you distribute copies of the software, or if
32
- you modify it: responsibilities to respect the freedom of others.
33
-
34
- For example, if you distribute copies of such a program, whether
35
- gratis or for a fee, you must pass on to the recipients the same
36
- freedoms that you received. You must make sure that they, too, receive
37
- or can get the source code. And you must show them these terms so they
38
- know their rights.
39
-
40
- Developers that use the GNU GPL protect your rights with two steps:
41
- (1) assert copyright on the software, and (2) offer you this License
42
- giving you legal permission to copy, distribute and/or modify it.
43
-
44
- For the developers' and authors' protection, the GPL clearly explains
45
- that there is no warranty for this free software. For both users' and
46
- authors' sake, the GPL requires that modified versions be marked as
47
- changed, so that their problems will not be attributed erroneously to
48
- authors of previous versions.
49
-
50
- Some devices are designed to deny users access to install or run
51
- modified versions of the software inside them, although the manufacturer
52
- can do so. This is fundamentally incompatible with the aim of
53
- protecting users' freedom to change the software. The systematic
54
- pattern of such abuse occurs in the area of products for individuals to
55
- use, which is precisely where it is most unacceptable. Therefore, we
56
- have designed this version of the GPL to prohibit the practice for those
57
- products. If such problems arise substantially in other domains, we
58
- stand ready to extend this provision to those domains in future versions
59
- of the GPL, as needed to protect the freedom of users.
60
-
61
- Finally, every program is threatened constantly by software patents.
62
- States should not allow patents to restrict development and use of
63
- software on general-purpose computers, but in those that do, we wish to
64
- avoid the special danger that patents applied to a free program could
65
- make it effectively proprietary. To prevent this, the GPL assures that
66
- patents cannot be used to render the program non-free.
67
-
68
- The precise terms and conditions for copying, distribution and
69
- modification follow.
70
-
71
- TERMS AND CONDITIONS
72
-
73
- 0. Definitions.
74
-
75
- "This License" refers to version 3 of the GNU General Public License.
76
-
77
- "Copyright" also means copyright-like laws that apply to other kinds of
78
- works, such as semiconductor masks.
79
-
80
- "The Program" refers to any copyrightable work licensed under this
81
- License. Each licensee is addressed as "you". "Licensees" and
82
- "recipients" may be individuals or organizations.
83
-
84
- To "modify" a work means to copy from or adapt all or part of the work
85
- in a fashion requiring copyright permission, other than the making of an
86
- exact copy. The resulting work is called a "modified version" of the
87
- earlier work or a work "based on" the earlier work.
88
-
89
- A "covered work" means either the unmodified Program or a work based
90
- on the Program.
91
-
92
- To "propagate" a work means to do anything with it that, without
93
- permission, would make you directly or secondarily liable for
94
- infringement under applicable copyright law, except executing it on a
95
- computer or modifying a private copy. Propagation includes copying,
96
- distribution (with or without modification), making available to the
97
- public, and in some countries other activities as well.
98
-
99
- To "convey" a work means any kind of propagation that enables other
100
- parties to make or receive copies. Mere interaction with a user through
101
- a computer network, with no transfer of a copy, is not conveying.
102
-
103
- An interactive user interface displays "Appropriate Legal Notices"
104
- to the extent that it includes a convenient and prominently visible
105
- feature that (1) displays an appropriate copyright notice, and (2)
106
- tells the user that there is no warranty for the work (except to the
107
- extent that warranties are provided), that licensees may convey the
108
- work under this License, and how to view a copy of this License. If
109
- the interface presents a list of user commands or options, such as a
110
- menu, a prominent item in the list meets this criterion.
111
-
112
- 1. Source Code.
113
-
114
- The "source code" for a work means the preferred form of the work
115
- for making modifications to it. "Object code" means any non-source
116
- form of a work.
117
-
118
- A "Standard Interface" means an interface that either is an official
119
- standard defined by a recognized standards body, or, in the case of
120
- interfaces specified for a particular programming language, one that
121
- is widely used among developers working in that language.
122
-
123
- The "System Libraries" of an executable work include anything, other
124
- than the work as a whole, that (a) is included in the normal form of
125
- packaging a Major Component, but which is not part of that Major
126
- Component, and (b) serves only to enable use of the work with that
127
- Major Component, or to implement a Standard Interface for which an
128
- implementation is available to the public in source code form. A
129
- "Major Component", in this context, means a major essential component
130
- (kernel, window system, and so on) of the specific operating system
131
- (if any) on which the executable work runs, or a compiler used to
132
- produce the work, or an object code interpreter used to run it.
133
-
134
- The "Corresponding Source" for a work in object code form means all
135
- the source code needed to generate, install, and (for an executable
136
- work) run the object code and to modify the work, including scripts to
137
- control those activities. However, it does not include the work's
138
- System Libraries, or general-purpose tools or generally available free
139
- programs which are used unmodified in performing those activities but
140
- which are not part of the work. For example, Corresponding Source
141
- includes interface definition files associated with source files for
142
- the work, and the source code for shared libraries and dynamically
143
- linked subprograms that the work is specifically designed to require,
144
- such as by intimate data communication or control flow between those
145
- subprograms and other parts of the work.
146
-
147
- The Corresponding Source need not include anything that users
148
- can regenerate automatically from other parts of the Corresponding
149
- Source.
150
-
151
- The Corresponding Source for a work in source code form is that
152
- same work.
153
-
154
- 2. Basic Permissions.
155
-
156
- All rights granted under this License are granted for the term of
157
- copyright on the Program, and are irrevocable provided the stated
158
- conditions are met. This License explicitly affirms your unlimited
159
- permission to run the unmodified Program. The output from running a
160
- covered work is covered by this License only if the output, given its
161
- content, constitutes a covered work. This License acknowledges your
162
- rights of fair use or other equivalent, as provided by copyright law.
163
-
164
- You may make, run and propagate covered works that you do not
165
- convey, without conditions so long as your license otherwise remains
166
- in force. You may convey covered works to others for the sole purpose
167
- of having them make modifications exclusively for you, or provide you
168
- with facilities for running those works, provided that you comply with
169
- the terms of this License in conveying all material for which you do
170
- not control copyright. Those thus making or running the covered works
171
- for you must do so exclusively on your behalf, under your direction
172
- and control, on terms that prohibit them from making any copies of
173
- your copyrighted material outside their relationship with you.
174
-
175
- Conveying under any other circumstances is permitted solely under
176
- the conditions stated below. Sublicensing is not allowed; section 10
177
- makes it unnecessary.
178
-
179
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180
-
181
- No covered work shall be deemed part of an effective technological
182
- measure under any applicable law fulfilling obligations under article
183
- 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184
- similar laws prohibiting or restricting circumvention of such
185
- measures.
186
-
187
- When you convey a covered work, you waive any legal power to forbid
188
- circumvention of technological measures to the extent such circumvention
189
- is effected by exercising rights under this License with respect to
190
- the covered work, and you disclaim any intention to limit operation or
191
- modification of the work as a means of enforcing, against the work's
192
- users, your or third parties' legal rights to forbid circumvention of
193
- technological measures.
194
-
195
- 4. Conveying Verbatim Copies.
196
-
197
- You may convey verbatim copies of the Program's source code as you
198
- receive it, in any medium, provided that you conspicuously and
199
- appropriately publish on each copy an appropriate copyright notice;
200
- keep intact all notices stating that this License and any
201
- non-permissive terms added in accord with section 7 apply to the code;
202
- keep intact all notices of the absence of any warranty; and give all
203
- recipients a copy of this License along with the Program.
204
-
205
- You may charge any price or no price for each copy that you convey,
206
- and you may offer support or warranty protection for a fee.
207
-
208
- 5. Conveying Modified Source Versions.
209
-
210
- You may convey a work based on the Program, or the modifications to
211
- produce it from the Program, in the form of source code under the
212
- terms of section 4, provided that you also meet all of these conditions:
213
-
214
- a) The work must carry prominent notices stating that you modified
215
- it, and giving a relevant date.
216
-
217
- b) The work must carry prominent notices stating that it is
218
- released under this License and any conditions added under section
219
- 7. This requirement modifies the requirement in section 4 to
220
- "keep intact all notices".
221
-
222
- c) You must license the entire work, as a whole, under this
223
- License to anyone who comes into possession of a copy. This
224
- License will therefore apply, along with any applicable section 7
225
- additional terms, to the whole of the work, and all its parts,
226
- regardless of how they are packaged. This License gives no
227
- permission to license the work in any other way, but it does not
228
- invalidate such permission if you have separately received it.
229
-
230
- d) If the work has interactive user interfaces, each must display
231
- Appropriate Legal Notices; however, if the Program has interactive
232
- interfaces that do not display Appropriate Legal Notices, your
233
- work need not make them do so.
234
-
235
- A compilation of a covered work with other separate and independent
236
- works, which are not by their nature extensions of the covered work,
237
- and which are not combined with it such as to form a larger program,
238
- in or on a volume of a storage or distribution medium, is called an
239
- "aggregate" if the compilation and its resulting copyright are not
240
- used to limit the access or legal rights of the compilation's users
241
- beyond what the individual works permit. Inclusion of a covered work
242
- in an aggregate does not cause this License to apply to the other
243
- parts of the aggregate.
244
-
245
- 6. Conveying Non-Source Forms.
246
-
247
- You may convey a covered work in object code form under the terms
248
- of sections 4 and 5, provided that you also convey the
249
- machine-readable Corresponding Source under the terms of this License,
250
- in one of these ways:
251
-
252
- a) Convey the object code in, or embodied in, a physical product
253
- (including a physical distribution medium), accompanied by the
254
- Corresponding Source fixed on a durable physical medium
255
- customarily used for software interchange.
256
-
257
- b) Convey the object code in, or embodied in, a physical product
258
- (including a physical distribution medium), accompanied by a
259
- written offer, valid for at least three years and valid for as
260
- long as you offer spare parts or customer support for that product
261
- model, to give anyone who possesses the object code either (1) a
262
- copy of the Corresponding Source for all the software in the
263
- product that is covered by this License, on a durable physical
264
- medium customarily used for software interchange, for a price no
265
- more than your reasonable cost of physically performing this
266
- conveying of source, or (2) access to copy the
267
- Corresponding Source from a network server at no charge.
268
-
269
- c) Convey individual copies of the object code with a copy of the
270
- written offer to provide the Corresponding Source. This
271
- alternative is allowed only occasionally and noncommercially, and
272
- only if you received the object code with such an offer, in accord
273
- with subsection 6b.
274
-
275
- d) Convey the object code by offering access from a designated
276
- place (gratis or for a charge), and offer equivalent access to the
277
- Corresponding Source in the same way through the same place at no
278
- further charge. You need not require recipients to copy the
279
- Corresponding Source along with the object code. If the place to
280
- copy the object code is a network server, the Corresponding Source
281
- may be on a different server (operated by you or a third party)
282
- that supports equivalent copying facilities, provided you maintain
283
- clear directions next to the object code saying where to find the
284
- Corresponding Source. Regardless of what server hosts the
285
- Corresponding Source, you remain obligated to ensure that it is
286
- available for as long as needed to satisfy these requirements.
287
-
288
- e) Convey the object code using peer-to-peer transmission, provided
289
- you inform other peers where the object code and Corresponding
290
- Source of the work are being offered to the general public at no
291
- charge under subsection 6d.
292
-
293
- A separable portion of the object code, whose source code is excluded
294
- from the Corresponding Source as a System Library, need not be
295
- included in conveying the object code work.
296
-
297
- A "User Product" is either (1) a "consumer product", which means any
298
- tangible personal property which is normally used for personal, family,
299
- or household purposes, or (2) anything designed or sold for incorporation
300
- into a dwelling. In determining whether a product is a consumer product,
301
- doubtful cases shall be resolved in favor of coverage. For a particular
302
- product received by a particular user, "normally used" refers to a
303
- typical or common use of that class of product, regardless of the status
304
- of the particular user or of the way in which the particular user
305
- actually uses, or expects or is expected to use, the product. A product
306
- is a consumer product regardless of whether the product has substantial
307
- commercial, industrial or non-consumer uses, unless such uses represent
308
- the only significant mode of use of the product.
309
-
310
- "Installation Information" for a User Product means any methods,
311
- procedures, authorization keys, or other information required to install
312
- and execute modified versions of a covered work in that User Product from
313
- a modified version of its Corresponding Source. The information must
314
- suffice to ensure that the continued functioning of the modified object
315
- code is in no case prevented or interfered with solely because
316
- modification has been made.
317
-
318
- If you convey an object code work under this section in, or with, or
319
- specifically for use in, a User Product, and the conveying occurs as
320
- part of a transaction in which the right of possession and use of the
321
- User Product is transferred to the recipient in perpetuity or for a
322
- fixed term (regardless of how the transaction is characterized), the
323
- Corresponding Source conveyed under this section must be accompanied
324
- by the Installation Information. But this requirement does not apply
325
- if neither you nor any third party retains the ability to install
326
- modified object code on the User Product (for example, the work has
327
- been installed in ROM).
328
-
329
- The requirement to provide Installation Information does not include a
330
- requirement to continue to provide support service, warranty, or updates
331
- for a work that has been modified or installed by the recipient, or for
332
- the User Product in which it has been modified or installed. Access to a
333
- network may be denied when the modification itself materially and
334
- adversely affects the operation of the network or violates the rules and
335
- protocols for communication across the network.
336
-
337
- Corresponding Source conveyed, and Installation Information provided,
338
- in accord with this section must be in a format that is publicly
339
- documented (and with an implementation available to the public in
340
- source code form), and must require no special password or key for
341
- unpacking, reading or copying.
342
-
343
- 7. Additional Terms.
344
-
345
- "Additional permissions" are terms that supplement the terms of this
346
- License by making exceptions from one or more of its conditions.
347
- Additional permissions that are applicable to the entire Program shall
348
- be treated as though they were included in this License, to the extent
349
- that they are valid under applicable law. If additional permissions
350
- apply only to part of the Program, that part may be used separately
351
- under those permissions, but the entire Program remains governed by
352
- this License without regard to the additional permissions.
353
-
354
- When you convey a copy of a covered work, you may at your option
355
- remove any additional permissions from that copy, or from any part of
356
- it. (Additional permissions may be written to require their own
357
- removal in certain cases when you modify the work.) You may place
358
- additional permissions on material, added by you to a covered work,
359
- for which you have or can give appropriate copyright permission.
360
-
361
- Notwithstanding any other provision of this License, for material you
362
- add to a covered work, you may (if authorized by the copyright holders of
363
- that material) supplement the terms of this License with terms:
364
-
365
- a) Disclaiming warranty or limiting liability differently from the
366
- terms of sections 15 and 16 of this License; or
367
-
368
- b) Requiring preservation of specified reasonable legal notices or
369
- author attributions in that material or in the Appropriate Legal
370
- Notices displayed by works containing it; or
371
-
372
- c) Prohibiting misrepresentation of the origin of that material, or
373
- requiring that modified versions of such material be marked in
374
- reasonable ways as different from the original version; or
375
-
376
- d) Limiting the use for publicity purposes of names of licensors or
377
- authors of the material; or
378
-
379
- e) Declining to grant rights under trademark law for use of some
380
- trade names, trademarks, or service marks; or
381
-
382
- f) Requiring indemnification of licensors and authors of that
383
- material by anyone who conveys the material (or modified versions of
384
- it) with contractual assumptions of liability to the recipient, for
385
- any liability that these contractual assumptions directly impose on
386
- those licensors and authors.
387
-
388
- All other non-permissive additional terms are considered "further
389
- restrictions" within the meaning of section 10. If the Program as you
390
- received it, or any part of it, contains a notice stating that it is
391
- governed by this License along with a term that is a further
392
- restriction, you may remove that term. If a license document contains
393
- a further restriction but permits relicensing or conveying under this
394
- License, you may add to a covered work material governed by the terms
395
- of that license document, provided that the further restriction does
396
- not survive such relicensing or conveying.
397
-
398
- If you add terms to a covered work in accord with this section, you
399
- must place, in the relevant source files, a statement of the
400
- additional terms that apply to those files, or a notice indicating
401
- where to find the applicable terms.
402
-
403
- Additional terms, permissive or non-permissive, may be stated in the
404
- form of a separately written license, or stated as exceptions;
405
- the above requirements apply either way.
406
-
407
- 8. Termination.
408
-
409
- You may not propagate or modify a covered work except as expressly
410
- provided under this License. Any attempt otherwise to propagate or
411
- modify it is void, and will automatically terminate your rights under
412
- this License (including any patent licenses granted under the third
413
- paragraph of section 11).
414
-
415
- However, if you cease all violation of this License, then your
416
- license from a particular copyright holder is reinstated (a)
417
- provisionally, unless and until the copyright holder explicitly and
418
- finally terminates your license, and (b) permanently, if the copyright
419
- holder fails to notify you of the violation by some reasonable means
420
- prior to 60 days after the cessation.
421
-
422
- Moreover, your license from a particular copyright holder is
423
- reinstated permanently if the copyright holder notifies you of the
424
- violation by some reasonable means, this is the first time you have
425
- received notice of violation of this License (for any work) from that
426
- copyright holder, and you cure the violation prior to 30 days after
427
- your receipt of the notice.
428
-
429
- Termination of your rights under this section does not terminate the
430
- licenses of parties who have received copies or rights from you under
431
- this License. If your rights have been terminated and not permanently
432
- reinstated, you do not qualify to receive new licenses for the same
433
- material under section 10.
434
-
435
- 9. Acceptance Not Required for Having Copies.
436
-
437
- You are not required to accept this License in order to receive or
438
- run a copy of the Program. Ancillary propagation of a covered work
439
- occurring solely as a consequence of using peer-to-peer transmission
440
- to receive a copy likewise does not require acceptance. However,
441
- nothing other than this License grants you permission to propagate or
442
- modify any covered work. These actions infringe copyright if you do
443
- not accept this License. Therefore, by modifying or propagating a
444
- covered work, you indicate your acceptance of this License to do so.
445
-
446
- 10. Automatic Licensing of Downstream Recipients.
447
-
448
- Each time you convey a covered work, the recipient automatically
449
- receives a license from the original licensors, to run, modify and
450
- propagate that work, subject to this License. You are not responsible
451
- for enforcing compliance by third parties with this License.
452
-
453
- An "entity transaction" is a transaction transferring control of an
454
- organization, or substantially all assets of one, or subdividing an
455
- organization, or merging organizations. If propagation of a covered
456
- work results from an entity transaction, each party to that
457
- transaction who receives a copy of the work also receives whatever
458
- licenses to the work the party's predecessor in interest had or could
459
- give under the previous paragraph, plus a right to possession of the
460
- Corresponding Source of the work from the predecessor in interest, if
461
- the predecessor has it or can get it with reasonable efforts.
462
-
463
- You may not impose any further restrictions on the exercise of the
464
- rights granted or affirmed under this License. For example, you may
465
- not impose a license fee, royalty, or other charge for exercise of
466
- rights granted under this License, and you may not initiate litigation
467
- (including a cross-claim or counterclaim in a lawsuit) alleging that
468
- any patent claim is infringed by making, using, selling, offering for
469
- sale, or importing the Program or any portion of it.
470
-
471
- 11. Patents.
472
-
473
- A "contributor" is a copyright holder who authorizes use under this
474
- License of the Program or a work on which the Program is based. The
475
- work thus licensed is called the contributor's "contributor version".
476
-
477
- A contributor's "essential patent claims" are all patent claims
478
- owned or controlled by the contributor, whether already acquired or
479
- hereafter acquired, that would be infringed by some manner, permitted
480
- by this License, of making, using, or selling its contributor version,
481
- but do not include claims that would be infringed only as a
482
- consequence of further modification of the contributor version. For
483
- purposes of this definition, "control" includes the right to grant
484
- patent sublicenses in a manner consistent with the requirements of
485
- this License.
486
-
487
- Each contributor grants you a non-exclusive, worldwide, royalty-free
488
- patent license under the contributor's essential patent claims, to
489
- make, use, sell, offer for sale, import and otherwise run, modify and
490
- propagate the contents of its contributor version.
491
-
492
- In the following three paragraphs, a "patent license" is any express
493
- agreement or commitment, however denominated, not to enforce a patent
494
- (such as an express permission to practice a patent or covenant not to
495
- sue for patent infringement). To "grant" such a patent license to a
496
- party means to make such an agreement or commitment not to enforce a
497
- patent against the party.
498
-
499
- If you convey a covered work, knowingly relying on a patent license,
500
- and the Corresponding Source of the work is not available for anyone
501
- to copy, free of charge and under the terms of this License, through a
502
- publicly available network server or other readily accessible means,
503
- then you must either (1) cause the Corresponding Source to be so
504
- available, or (2) arrange to deprive yourself of the benefit of the
505
- patent license for this particular work, or (3) arrange, in a manner
506
- consistent with the requirements of this License, to extend the patent
507
- license to downstream recipients. "Knowingly relying" means you have
508
- actual knowledge that, but for the patent license, your conveying the
509
- covered work in a country, or your recipient's use of the covered work
510
- in a country, would infringe one or more identifiable patents in that
511
- country that you have reason to believe are valid.
512
-
513
- If, pursuant to or in connection with a single transaction or
514
- arrangement, you convey, or propagate by procuring conveyance of, a
515
- covered work, and grant a patent license to some of the parties
516
- receiving the covered work authorizing them to use, propagate, modify
517
- or convey a specific copy of the covered work, then the patent license
518
- you grant is automatically extended to all recipients of the covered
519
- work and works based on it.
520
-
521
- A patent license is "discriminatory" if it does not include within
522
- the scope of its coverage, prohibits the exercise of, or is
523
- conditioned on the non-exercise of one or more of the rights that are
524
- specifically granted under this License. You may not convey a covered
525
- work if you are a party to an arrangement with a third party that is
526
- in the business of distributing software, under which you make payment
527
- to the third party based on the extent of your activity of conveying
528
- the work, and under which the third party grants, to any of the
529
- parties who would receive the covered work from you, a discriminatory
530
- patent license (a) in connection with copies of the covered work
531
- conveyed by you (or copies made from those copies), or (b) primarily
532
- for and in connection with specific products or compilations that
533
- contain the covered work, unless you entered into that arrangement,
534
- or that patent license was granted, prior to 28 March 2007.
535
-
536
- Nothing in this License shall be construed as excluding or limiting
537
- any implied license or other defenses to infringement that may
538
- otherwise be available to you under applicable patent law.
539
-
540
- 12. No Surrender of Others' Freedom.
541
-
542
- If conditions are imposed on you (whether by court order, agreement or
543
- otherwise) that contradict the conditions of this License, they do not
544
- excuse you from the conditions of this License. If you cannot convey a
545
- covered work so as to satisfy simultaneously your obligations under this
546
- License and any other pertinent obligations, then as a consequence you may
547
- not convey it at all. For example, if you agree to terms that obligate you
548
- to collect a royalty for further conveying from those to whom you convey
549
- the Program, the only way you could satisfy both those terms and this
550
- License would be to refrain entirely from conveying the Program.
551
-
552
- 13. Use with the GNU Affero General Public License.
553
-
554
- Notwithstanding any other provision of this License, you have
555
- permission to link or combine any covered work with a work licensed
556
- under version 3 of the GNU Affero General Public License into a single
557
- combined work, and to convey the resulting work. The terms of this
558
- License will continue to apply to the part which is the covered work,
559
- but the special requirements of the GNU Affero General Public License,
560
- section 13, concerning interaction through a network will apply to the
561
- combination as such.
562
-
563
- 14. Revised Versions of this License.
564
-
565
- The Free Software Foundation may publish revised and/or new versions of
566
- the GNU General Public License from time to time. Such new versions will
567
- be similar in spirit to the present version, but may differ in detail to
568
- address new problems or concerns.
569
-
570
- Each version is given a distinguishing version number. If the
571
- Program specifies that a certain numbered version of the GNU General
572
- Public License "or any later version" applies to it, you have the
573
- option of following the terms and conditions either of that numbered
574
- version or of any later version published by the Free Software
575
- Foundation. If the Program does not specify a version number of the
576
- GNU General Public License, you may choose any version ever published
577
- by the Free Software Foundation.
578
-
579
- If the Program specifies that a proxy can decide which future
580
- versions of the GNU General Public License can be used, that proxy's
581
- public statement of acceptance of a version permanently authorizes you
582
- to choose that version for the Program.
583
-
584
- Later license versions may give you additional or different
585
- permissions. However, no additional obligations are imposed on any
586
- author or copyright holder as a result of your choosing to follow a
587
- later version.
588
-
589
- 15. Disclaimer of Warranty.
590
-
591
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592
- APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593
- HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594
- OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595
- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596
- PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597
- IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598
- ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599
-
600
- 16. Limitation of Liability.
601
-
602
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603
- WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604
- THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605
- GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606
- USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607
- DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608
- PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609
- EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610
- SUCH DAMAGES.
611
-
612
- 17. Interpretation of Sections 15 and 16.
613
-
614
- If the disclaimer of warranty and limitation of liability provided
615
- above cannot be given local legal effect according to their terms,
616
- reviewing courts shall apply local law that most closely approximates
617
- an absolute waiver of all civil liability in connection with the
618
- Program, unless a warranty or assumption of liability accompanies a
619
- copy of the Program in return for a fee.
620
-
621
- END OF TERMS AND CONDITIONS
622
-
623
- How to Apply These Terms to Your New Programs
624
-
625
- If you develop a new program, and you want it to be of the greatest
626
- possible use to the public, the best way to achieve this is to make it
627
- free software which everyone can redistribute and change under these terms.
628
-
629
- To do so, attach the following notices to the program. It is safest
630
- to attach them to the start of each source file to most effectively
631
- state the exclusion of warranty; and each file should have at least
632
- the "copyright" line and a pointer to where the full notice is found.
633
-
634
- <one line to give the program's name and a brief idea of what it does.>
635
- Copyright (C) <year> <name of author>
636
-
637
- This program is free software: you can redistribute it and/or modify
638
- it under the terms of the GNU General Public License as published by
639
- the Free Software Foundation, either version 3 of the License, or
640
- (at your option) any later version.
641
-
642
- This program is distributed in the hope that it will be useful,
643
- but WITHOUT ANY WARRANTY; without even the implied warranty of
644
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645
- GNU General Public License for more details.
646
-
647
- You should have received a copy of the GNU General Public License
648
- along with this program. If not, see <http://www.gnu.org/licenses/>.
649
-
650
- Also add information on how to contact you by electronic and paper mail.
651
-
652
- If the program does terminal interaction, make it output a short
653
- notice like this when it starts in an interactive mode:
654
-
655
- <program> Copyright (C) <year> <name of author>
656
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657
- This is free software, and you are welcome to redistribute it
658
- under certain conditions; type `show c' for details.
659
-
660
- The hypothetical commands `show w' and `show c' should show the appropriate
661
- parts of the General Public License. Of course, your program's commands
662
- might be different; for a GUI interface, you would use an "about box".
663
-
664
- You should also get your employer (if you work as a programmer) or school,
665
- if any, to sign a "copyright disclaimer" for the program, if necessary.
666
- For more information on this, and how to apply and follow the GNU GPL, see
667
- <http://www.gnu.org/licenses/>.
668
-
669
- The GNU General Public License does not permit incorporating your program
670
- into proprietary programs. If your program is a subroutine library, you
671
- may consider it more useful to permit linking proprietary applications with
672
- the library. If this is what you want to do, use the GNU Lesser General
673
- Public License instead of this License. But first, please read
674
- <http://www.gnu.org/philosophy/why-not-lgpl.html>.
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+ Preamble
9
+
10
+ The GNU General Public License is a free, copyleft license for
11
+ software and other kinds of works.
12
+
13
+ The licenses for most software and other practical works are designed
14
+ to take away your freedom to share and change the works. By contrast,
15
+ the GNU General Public License is intended to guarantee your freedom to
16
+ share and change all versions of a program--to make sure it remains free
17
+ software for all its users. We, the Free Software Foundation, use the
18
+ GNU General Public License for most of our software; it applies also to
19
+ any other work released this way by its authors. You can apply it to
20
+ your programs, too.
21
+
22
+ When we speak of free software, we are referring to freedom, not
23
+ price. Our General Public Licenses are designed to make sure that you
24
+ have the freedom to distribute copies of free software (and charge for
25
+ them if you wish), that you receive source code or can get it if you
26
+ want it, that you can change the software or use pieces of it in new
27
+ free programs, and that you know you can do these things.
28
+
29
+ To protect your rights, we need to prevent others from denying you
30
+ these rights or asking you to surrender the rights. Therefore, you have
31
+ certain responsibilities if you distribute copies of the software, or if
32
+ you modify it: responsibilities to respect the freedom of others.
33
+
34
+ For example, if you distribute copies of such a program, whether
35
+ gratis or for a fee, you must pass on to the recipients the same
36
+ freedoms that you received. You must make sure that they, too, receive
37
+ or can get the source code. And you must show them these terms so they
38
+ know their rights.
39
+
40
+ Developers that use the GNU GPL protect your rights with two steps:
41
+ (1) assert copyright on the software, and (2) offer you this License
42
+ giving you legal permission to copy, distribute and/or modify it.
43
+
44
+ For the developers' and authors' protection, the GPL clearly explains
45
+ that there is no warranty for this free software. For both users' and
46
+ authors' sake, the GPL requires that modified versions be marked as
47
+ changed, so that their problems will not be attributed erroneously to
48
+ authors of previous versions.
49
+
50
+ Some devices are designed to deny users access to install or run
51
+ modified versions of the software inside them, although the manufacturer
52
+ can do so. This is fundamentally incompatible with the aim of
53
+ protecting users' freedom to change the software. The systematic
54
+ pattern of such abuse occurs in the area of products for individuals to
55
+ use, which is precisely where it is most unacceptable. Therefore, we
56
+ have designed this version of the GPL to prohibit the practice for those
57
+ products. If such problems arise substantially in other domains, we
58
+ stand ready to extend this provision to those domains in future versions
59
+ of the GPL, as needed to protect the freedom of users.
60
+
61
+ Finally, every program is threatened constantly by software patents.
62
+ States should not allow patents to restrict development and use of
63
+ software on general-purpose computers, but in those that do, we wish to
64
+ avoid the special danger that patents applied to a free program could
65
+ make it effectively proprietary. To prevent this, the GPL assures that
66
+ patents cannot be used to render the program non-free.
67
+
68
+ The precise terms and conditions for copying, distribution and
69
+ modification follow.
70
+
71
+ TERMS AND CONDITIONS
72
+
73
+ 0. Definitions.
74
+
75
+ "This License" refers to version 3 of the GNU General Public License.
76
+
77
+ "Copyright" also means copyright-like laws that apply to other kinds of
78
+ works, such as semiconductor masks.
79
+
80
+ "The Program" refers to any copyrightable work licensed under this
81
+ License. Each licensee is addressed as "you". "Licensees" and
82
+ "recipients" may be individuals or organizations.
83
+
84
+ To "modify" a work means to copy from or adapt all or part of the work
85
+ in a fashion requiring copyright permission, other than the making of an
86
+ exact copy. The resulting work is called a "modified version" of the
87
+ earlier work or a work "based on" the earlier work.
88
+
89
+ A "covered work" means either the unmodified Program or a work based
90
+ on the Program.
91
+
92
+ To "propagate" a work means to do anything with it that, without
93
+ permission, would make you directly or secondarily liable for
94
+ infringement under applicable copyright law, except executing it on a
95
+ computer or modifying a private copy. Propagation includes copying,
96
+ distribution (with or without modification), making available to the
97
+ public, and in some countries other activities as well.
98
+
99
+ To "convey" a work means any kind of propagation that enables other
100
+ parties to make or receive copies. Mere interaction with a user through
101
+ a computer network, with no transfer of a copy, is not conveying.
102
+
103
+ An interactive user interface displays "Appropriate Legal Notices"
104
+ to the extent that it includes a convenient and prominently visible
105
+ feature that (1) displays an appropriate copyright notice, and (2)
106
+ tells the user that there is no warranty for the work (except to the
107
+ extent that warranties are provided), that licensees may convey the
108
+ work under this License, and how to view a copy of this License. If
109
+ the interface presents a list of user commands or options, such as a
110
+ menu, a prominent item in the list meets this criterion.
111
+
112
+ 1. Source Code.
113
+
114
+ The "source code" for a work means the preferred form of the work
115
+ for making modifications to it. "Object code" means any non-source
116
+ form of a work.
117
+
118
+ A "Standard Interface" means an interface that either is an official
119
+ standard defined by a recognized standards body, or, in the case of
120
+ interfaces specified for a particular programming language, one that
121
+ is widely used among developers working in that language.
122
+
123
+ The "System Libraries" of an executable work include anything, other
124
+ than the work as a whole, that (a) is included in the normal form of
125
+ packaging a Major Component, but which is not part of that Major
126
+ Component, and (b) serves only to enable use of the work with that
127
+ Major Component, or to implement a Standard Interface for which an
128
+ implementation is available to the public in source code form. A
129
+ "Major Component", in this context, means a major essential component
130
+ (kernel, window system, and so on) of the specific operating system
131
+ (if any) on which the executable work runs, or a compiler used to
132
+ produce the work, or an object code interpreter used to run it.
133
+
134
+ The "Corresponding Source" for a work in object code form means all
135
+ the source code needed to generate, install, and (for an executable
136
+ work) run the object code and to modify the work, including scripts to
137
+ control those activities. However, it does not include the work's
138
+ System Libraries, or general-purpose tools or generally available free
139
+ programs which are used unmodified in performing those activities but
140
+ which are not part of the work. For example, Corresponding Source
141
+ includes interface definition files associated with source files for
142
+ the work, and the source code for shared libraries and dynamically
143
+ linked subprograms that the work is specifically designed to require,
144
+ such as by intimate data communication or control flow between those
145
+ subprograms and other parts of the work.
146
+
147
+ The Corresponding Source need not include anything that users
148
+ can regenerate automatically from other parts of the Corresponding
149
+ Source.
150
+
151
+ The Corresponding Source for a work in source code form is that
152
+ same work.
153
+
154
+ 2. Basic Permissions.
155
+
156
+ All rights granted under this License are granted for the term of
157
+ copyright on the Program, and are irrevocable provided the stated
158
+ conditions are met. This License explicitly affirms your unlimited
159
+ permission to run the unmodified Program. The output from running a
160
+ covered work is covered by this License only if the output, given its
161
+ content, constitutes a covered work. This License acknowledges your
162
+ rights of fair use or other equivalent, as provided by copyright law.
163
+
164
+ You may make, run and propagate covered works that you do not
165
+ convey, without conditions so long as your license otherwise remains
166
+ in force. You may convey covered works to others for the sole purpose
167
+ of having them make modifications exclusively for you, or provide you
168
+ with facilities for running those works, provided that you comply with
169
+ the terms of this License in conveying all material for which you do
170
+ not control copyright. Those thus making or running the covered works
171
+ for you must do so exclusively on your behalf, under your direction
172
+ and control, on terms that prohibit them from making any copies of
173
+ your copyrighted material outside their relationship with you.
174
+
175
+ Conveying under any other circumstances is permitted solely under
176
+ the conditions stated below. Sublicensing is not allowed; section 10
177
+ makes it unnecessary.
178
+
179
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180
+
181
+ No covered work shall be deemed part of an effective technological
182
+ measure under any applicable law fulfilling obligations under article
183
+ 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184
+ similar laws prohibiting or restricting circumvention of such
185
+ measures.
186
+
187
+ When you convey a covered work, you waive any legal power to forbid
188
+ circumvention of technological measures to the extent such circumvention
189
+ is effected by exercising rights under this License with respect to
190
+ the covered work, and you disclaim any intention to limit operation or
191
+ modification of the work as a means of enforcing, against the work's
192
+ users, your or third parties' legal rights to forbid circumvention of
193
+ technological measures.
194
+
195
+ 4. Conveying Verbatim Copies.
196
+
197
+ You may convey verbatim copies of the Program's source code as you
198
+ receive it, in any medium, provided that you conspicuously and
199
+ appropriately publish on each copy an appropriate copyright notice;
200
+ keep intact all notices stating that this License and any
201
+ non-permissive terms added in accord with section 7 apply to the code;
202
+ keep intact all notices of the absence of any warranty; and give all
203
+ recipients a copy of this License along with the Program.
204
+
205
+ You may charge any price or no price for each copy that you convey,
206
+ and you may offer support or warranty protection for a fee.
207
+
208
+ 5. Conveying Modified Source Versions.
209
+
210
+ You may convey a work based on the Program, or the modifications to
211
+ produce it from the Program, in the form of source code under the
212
+ terms of section 4, provided that you also meet all of these conditions:
213
+
214
+ a) The work must carry prominent notices stating that you modified
215
+ it, and giving a relevant date.
216
+
217
+ b) The work must carry prominent notices stating that it is
218
+ released under this License and any conditions added under section
219
+ 7. This requirement modifies the requirement in section 4 to
220
+ "keep intact all notices".
221
+
222
+ c) You must license the entire work, as a whole, under this
223
+ License to anyone who comes into possession of a copy. This
224
+ License will therefore apply, along with any applicable section 7
225
+ additional terms, to the whole of the work, and all its parts,
226
+ regardless of how they are packaged. This License gives no
227
+ permission to license the work in any other way, but it does not
228
+ invalidate such permission if you have separately received it.
229
+
230
+ d) If the work has interactive user interfaces, each must display
231
+ Appropriate Legal Notices; however, if the Program has interactive
232
+ interfaces that do not display Appropriate Legal Notices, your
233
+ work need not make them do so.
234
+
235
+ A compilation of a covered work with other separate and independent
236
+ works, which are not by their nature extensions of the covered work,
237
+ and which are not combined with it such as to form a larger program,
238
+ in or on a volume of a storage or distribution medium, is called an
239
+ "aggregate" if the compilation and its resulting copyright are not
240
+ used to limit the access or legal rights of the compilation's users
241
+ beyond what the individual works permit. Inclusion of a covered work
242
+ in an aggregate does not cause this License to apply to the other
243
+ parts of the aggregate.
244
+
245
+ 6. Conveying Non-Source Forms.
246
+
247
+ You may convey a covered work in object code form under the terms
248
+ of sections 4 and 5, provided that you also convey the
249
+ machine-readable Corresponding Source under the terms of this License,
250
+ in one of these ways:
251
+
252
+ a) Convey the object code in, or embodied in, a physical product
253
+ (including a physical distribution medium), accompanied by the
254
+ Corresponding Source fixed on a durable physical medium
255
+ customarily used for software interchange.
256
+
257
+ b) Convey the object code in, or embodied in, a physical product
258
+ (including a physical distribution medium), accompanied by a
259
+ written offer, valid for at least three years and valid for as
260
+ long as you offer spare parts or customer support for that product
261
+ model, to give anyone who possesses the object code either (1) a
262
+ copy of the Corresponding Source for all the software in the
263
+ product that is covered by this License, on a durable physical
264
+ medium customarily used for software interchange, for a price no
265
+ more than your reasonable cost of physically performing this
266
+ conveying of source, or (2) access to copy the
267
+ Corresponding Source from a network server at no charge.
268
+
269
+ c) Convey individual copies of the object code with a copy of the
270
+ written offer to provide the Corresponding Source. This
271
+ alternative is allowed only occasionally and noncommercially, and
272
+ only if you received the object code with such an offer, in accord
273
+ with subsection 6b.
274
+
275
+ d) Convey the object code by offering access from a designated
276
+ place (gratis or for a charge), and offer equivalent access to the
277
+ Corresponding Source in the same way through the same place at no
278
+ further charge. You need not require recipients to copy the
279
+ Corresponding Source along with the object code. If the place to
280
+ copy the object code is a network server, the Corresponding Source
281
+ may be on a different server (operated by you or a third party)
282
+ that supports equivalent copying facilities, provided you maintain
283
+ clear directions next to the object code saying where to find the
284
+ Corresponding Source. Regardless of what server hosts the
285
+ Corresponding Source, you remain obligated to ensure that it is
286
+ available for as long as needed to satisfy these requirements.
287
+
288
+ e) Convey the object code using peer-to-peer transmission, provided
289
+ you inform other peers where the object code and Corresponding
290
+ Source of the work are being offered to the general public at no
291
+ charge under subsection 6d.
292
+
293
+ A separable portion of the object code, whose source code is excluded
294
+ from the Corresponding Source as a System Library, need not be
295
+ included in conveying the object code work.
296
+
297
+ A "User Product" is either (1) a "consumer product", which means any
298
+ tangible personal property which is normally used for personal, family,
299
+ or household purposes, or (2) anything designed or sold for incorporation
300
+ into a dwelling. In determining whether a product is a consumer product,
301
+ doubtful cases shall be resolved in favor of coverage. For a particular
302
+ product received by a particular user, "normally used" refers to a
303
+ typical or common use of that class of product, regardless of the status
304
+ of the particular user or of the way in which the particular user
305
+ actually uses, or expects or is expected to use, the product. A product
306
+ is a consumer product regardless of whether the product has substantial
307
+ commercial, industrial or non-consumer uses, unless such uses represent
308
+ the only significant mode of use of the product.
309
+
310
+ "Installation Information" for a User Product means any methods,
311
+ procedures, authorization keys, or other information required to install
312
+ and execute modified versions of a covered work in that User Product from
313
+ a modified version of its Corresponding Source. The information must
314
+ suffice to ensure that the continued functioning of the modified object
315
+ code is in no case prevented or interfered with solely because
316
+ modification has been made.
317
+
318
+ If you convey an object code work under this section in, or with, or
319
+ specifically for use in, a User Product, and the conveying occurs as
320
+ part of a transaction in which the right of possession and use of the
321
+ User Product is transferred to the recipient in perpetuity or for a
322
+ fixed term (regardless of how the transaction is characterized), the
323
+ Corresponding Source conveyed under this section must be accompanied
324
+ by the Installation Information. But this requirement does not apply
325
+ if neither you nor any third party retains the ability to install
326
+ modified object code on the User Product (for example, the work has
327
+ been installed in ROM).
328
+
329
+ The requirement to provide Installation Information does not include a
330
+ requirement to continue to provide support service, warranty, or updates
331
+ for a work that has been modified or installed by the recipient, or for
332
+ the User Product in which it has been modified or installed. Access to a
333
+ network may be denied when the modification itself materially and
334
+ adversely affects the operation of the network or violates the rules and
335
+ protocols for communication across the network.
336
+
337
+ Corresponding Source conveyed, and Installation Information provided,
338
+ in accord with this section must be in a format that is publicly
339
+ documented (and with an implementation available to the public in
340
+ source code form), and must require no special password or key for
341
+ unpacking, reading or copying.
342
+
343
+ 7. Additional Terms.
344
+
345
+ "Additional permissions" are terms that supplement the terms of this
346
+ License by making exceptions from one or more of its conditions.
347
+ Additional permissions that are applicable to the entire Program shall
348
+ be treated as though they were included in this License, to the extent
349
+ that they are valid under applicable law. If additional permissions
350
+ apply only to part of the Program, that part may be used separately
351
+ under those permissions, but the entire Program remains governed by
352
+ this License without regard to the additional permissions.
353
+
354
+ When you convey a copy of a covered work, you may at your option
355
+ remove any additional permissions from that copy, or from any part of
356
+ it. (Additional permissions may be written to require their own
357
+ removal in certain cases when you modify the work.) You may place
358
+ additional permissions on material, added by you to a covered work,
359
+ for which you have or can give appropriate copyright permission.
360
+
361
+ Notwithstanding any other provision of this License, for material you
362
+ add to a covered work, you may (if authorized by the copyright holders of
363
+ that material) supplement the terms of this License with terms:
364
+
365
+ a) Disclaiming warranty or limiting liability differently from the
366
+ terms of sections 15 and 16 of this License; or
367
+
368
+ b) Requiring preservation of specified reasonable legal notices or
369
+ author attributions in that material or in the Appropriate Legal
370
+ Notices displayed by works containing it; or
371
+
372
+ c) Prohibiting misrepresentation of the origin of that material, or
373
+ requiring that modified versions of such material be marked in
374
+ reasonable ways as different from the original version; or
375
+
376
+ d) Limiting the use for publicity purposes of names of licensors or
377
+ authors of the material; or
378
+
379
+ e) Declining to grant rights under trademark law for use of some
380
+ trade names, trademarks, or service marks; or
381
+
382
+ f) Requiring indemnification of licensors and authors of that
383
+ material by anyone who conveys the material (or modified versions of
384
+ it) with contractual assumptions of liability to the recipient, for
385
+ any liability that these contractual assumptions directly impose on
386
+ those licensors and authors.
387
+
388
+ All other non-permissive additional terms are considered "further
389
+ restrictions" within the meaning of section 10. If the Program as you
390
+ received it, or any part of it, contains a notice stating that it is
391
+ governed by this License along with a term that is a further
392
+ restriction, you may remove that term. If a license document contains
393
+ a further restriction but permits relicensing or conveying under this
394
+ License, you may add to a covered work material governed by the terms
395
+ of that license document, provided that the further restriction does
396
+ not survive such relicensing or conveying.
397
+
398
+ If you add terms to a covered work in accord with this section, you
399
+ must place, in the relevant source files, a statement of the
400
+ additional terms that apply to those files, or a notice indicating
401
+ where to find the applicable terms.
402
+
403
+ Additional terms, permissive or non-permissive, may be stated in the
404
+ form of a separately written license, or stated as exceptions;
405
+ the above requirements apply either way.
406
+
407
+ 8. Termination.
408
+
409
+ You may not propagate or modify a covered work except as expressly
410
+ provided under this License. Any attempt otherwise to propagate or
411
+ modify it is void, and will automatically terminate your rights under
412
+ this License (including any patent licenses granted under the third
413
+ paragraph of section 11).
414
+
415
+ However, if you cease all violation of this License, then your
416
+ license from a particular copyright holder is reinstated (a)
417
+ provisionally, unless and until the copyright holder explicitly and
418
+ finally terminates your license, and (b) permanently, if the copyright
419
+ holder fails to notify you of the violation by some reasonable means
420
+ prior to 60 days after the cessation.
421
+
422
+ Moreover, your license from a particular copyright holder is
423
+ reinstated permanently if the copyright holder notifies you of the
424
+ violation by some reasonable means, this is the first time you have
425
+ received notice of violation of this License (for any work) from that
426
+ copyright holder, and you cure the violation prior to 30 days after
427
+ your receipt of the notice.
428
+
429
+ Termination of your rights under this section does not terminate the
430
+ licenses of parties who have received copies or rights from you under
431
+ this License. If your rights have been terminated and not permanently
432
+ reinstated, you do not qualify to receive new licenses for the same
433
+ material under section 10.
434
+
435
+ 9. Acceptance Not Required for Having Copies.
436
+
437
+ You are not required to accept this License in order to receive or
438
+ run a copy of the Program. Ancillary propagation of a covered work
439
+ occurring solely as a consequence of using peer-to-peer transmission
440
+ to receive a copy likewise does not require acceptance. However,
441
+ nothing other than this License grants you permission to propagate or
442
+ modify any covered work. These actions infringe copyright if you do
443
+ not accept this License. Therefore, by modifying or propagating a
444
+ covered work, you indicate your acceptance of this License to do so.
445
+
446
+ 10. Automatic Licensing of Downstream Recipients.
447
+
448
+ Each time you convey a covered work, the recipient automatically
449
+ receives a license from the original licensors, to run, modify and
450
+ propagate that work, subject to this License. You are not responsible
451
+ for enforcing compliance by third parties with this License.
452
+
453
+ An "entity transaction" is a transaction transferring control of an
454
+ organization, or substantially all assets of one, or subdividing an
455
+ organization, or merging organizations. If propagation of a covered
456
+ work results from an entity transaction, each party to that
457
+ transaction who receives a copy of the work also receives whatever
458
+ licenses to the work the party's predecessor in interest had or could
459
+ give under the previous paragraph, plus a right to possession of the
460
+ Corresponding Source of the work from the predecessor in interest, if
461
+ the predecessor has it or can get it with reasonable efforts.
462
+
463
+ You may not impose any further restrictions on the exercise of the
464
+ rights granted or affirmed under this License. For example, you may
465
+ not impose a license fee, royalty, or other charge for exercise of
466
+ rights granted under this License, and you may not initiate litigation
467
+ (including a cross-claim or counterclaim in a lawsuit) alleging that
468
+ any patent claim is infringed by making, using, selling, offering for
469
+ sale, or importing the Program or any portion of it.
470
+
471
+ 11. Patents.
472
+
473
+ A "contributor" is a copyright holder who authorizes use under this
474
+ License of the Program or a work on which the Program is based. The
475
+ work thus licensed is called the contributor's "contributor version".
476
+
477
+ A contributor's "essential patent claims" are all patent claims
478
+ owned or controlled by the contributor, whether already acquired or
479
+ hereafter acquired, that would be infringed by some manner, permitted
480
+ by this License, of making, using, or selling its contributor version,
481
+ but do not include claims that would be infringed only as a
482
+ consequence of further modification of the contributor version. For
483
+ purposes of this definition, "control" includes the right to grant
484
+ patent sublicenses in a manner consistent with the requirements of
485
+ this License.
486
+
487
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
488
+ patent license under the contributor's essential patent claims, to
489
+ make, use, sell, offer for sale, import and otherwise run, modify and
490
+ propagate the contents of its contributor version.
491
+
492
+ In the following three paragraphs, a "patent license" is any express
493
+ agreement or commitment, however denominated, not to enforce a patent
494
+ (such as an express permission to practice a patent or covenant not to
495
+ sue for patent infringement). To "grant" such a patent license to a
496
+ party means to make such an agreement or commitment not to enforce a
497
+ patent against the party.
498
+
499
+ If you convey a covered work, knowingly relying on a patent license,
500
+ and the Corresponding Source of the work is not available for anyone
501
+ to copy, free of charge and under the terms of this License, through a
502
+ publicly available network server or other readily accessible means,
503
+ then you must either (1) cause the Corresponding Source to be so
504
+ available, or (2) arrange to deprive yourself of the benefit of the
505
+ patent license for this particular work, or (3) arrange, in a manner
506
+ consistent with the requirements of this License, to extend the patent
507
+ license to downstream recipients. "Knowingly relying" means you have
508
+ actual knowledge that, but for the patent license, your conveying the
509
+ covered work in a country, or your recipient's use of the covered work
510
+ in a country, would infringe one or more identifiable patents in that
511
+ country that you have reason to believe are valid.
512
+
513
+ If, pursuant to or in connection with a single transaction or
514
+ arrangement, you convey, or propagate by procuring conveyance of, a
515
+ covered work, and grant a patent license to some of the parties
516
+ receiving the covered work authorizing them to use, propagate, modify
517
+ or convey a specific copy of the covered work, then the patent license
518
+ you grant is automatically extended to all recipients of the covered
519
+ work and works based on it.
520
+
521
+ A patent license is "discriminatory" if it does not include within
522
+ the scope of its coverage, prohibits the exercise of, or is
523
+ conditioned on the non-exercise of one or more of the rights that are
524
+ specifically granted under this License. You may not convey a covered
525
+ work if you are a party to an arrangement with a third party that is
526
+ in the business of distributing software, under which you make payment
527
+ to the third party based on the extent of your activity of conveying
528
+ the work, and under which the third party grants, to any of the
529
+ parties who would receive the covered work from you, a discriminatory
530
+ patent license (a) in connection with copies of the covered work
531
+ conveyed by you (or copies made from those copies), or (b) primarily
532
+ for and in connection with specific products or compilations that
533
+ contain the covered work, unless you entered into that arrangement,
534
+ or that patent license was granted, prior to 28 March 2007.
535
+
536
+ Nothing in this License shall be construed as excluding or limiting
537
+ any implied license or other defenses to infringement that may
538
+ otherwise be available to you under applicable patent law.
539
+
540
+ 12. No Surrender of Others' Freedom.
541
+
542
+ If conditions are imposed on you (whether by court order, agreement or
543
+ otherwise) that contradict the conditions of this License, they do not
544
+ excuse you from the conditions of this License. If you cannot convey a
545
+ covered work so as to satisfy simultaneously your obligations under this
546
+ License and any other pertinent obligations, then as a consequence you may
547
+ not convey it at all. For example, if you agree to terms that obligate you
548
+ to collect a royalty for further conveying from those to whom you convey
549
+ the Program, the only way you could satisfy both those terms and this
550
+ License would be to refrain entirely from conveying the Program.
551
+
552
+ 13. Use with the GNU Affero General Public License.
553
+
554
+ Notwithstanding any other provision of this License, you have
555
+ permission to link or combine any covered work with a work licensed
556
+ under version 3 of the GNU Affero General Public License into a single
557
+ combined work, and to convey the resulting work. The terms of this
558
+ License will continue to apply to the part which is the covered work,
559
+ but the special requirements of the GNU Affero General Public License,
560
+ section 13, concerning interaction through a network will apply to the
561
+ combination as such.
562
+
563
+ 14. Revised Versions of this License.
564
+
565
+ The Free Software Foundation may publish revised and/or new versions of
566
+ the GNU General Public License from time to time. Such new versions will
567
+ be similar in spirit to the present version, but may differ in detail to
568
+ address new problems or concerns.
569
+
570
+ Each version is given a distinguishing version number. If the
571
+ Program specifies that a certain numbered version of the GNU General
572
+ Public License "or any later version" applies to it, you have the
573
+ option of following the terms and conditions either of that numbered
574
+ version or of any later version published by the Free Software
575
+ Foundation. If the Program does not specify a version number of the
576
+ GNU General Public License, you may choose any version ever published
577
+ by the Free Software Foundation.
578
+
579
+ If the Program specifies that a proxy can decide which future
580
+ versions of the GNU General Public License can be used, that proxy's
581
+ public statement of acceptance of a version permanently authorizes you
582
+ to choose that version for the Program.
583
+
584
+ Later license versions may give you additional or different
585
+ permissions. However, no additional obligations are imposed on any
586
+ author or copyright holder as a result of your choosing to follow a
587
+ later version.
588
+
589
+ 15. Disclaimer of Warranty.
590
+
591
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592
+ APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593
+ HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594
+ OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596
+ PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597
+ IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598
+ ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599
+
600
+ 16. Limitation of Liability.
601
+
602
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604
+ THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605
+ GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606
+ USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607
+ DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608
+ PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609
+ EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610
+ SUCH DAMAGES.
611
+
612
+ 17. Interpretation of Sections 15 and 16.
613
+
614
+ If the disclaimer of warranty and limitation of liability provided
615
+ above cannot be given local legal effect according to their terms,
616
+ reviewing courts shall apply local law that most closely approximates
617
+ an absolute waiver of all civil liability in connection with the
618
+ Program, unless a warranty or assumption of liability accompanies a
619
+ copy of the Program in return for a fee.
620
+
621
+ END OF TERMS AND CONDITIONS
622
+
623
+ How to Apply These Terms to Your New Programs
624
+
625
+ If you develop a new program, and you want it to be of the greatest
626
+ possible use to the public, the best way to achieve this is to make it
627
+ free software which everyone can redistribute and change under these terms.
628
+
629
+ To do so, attach the following notices to the program. It is safest
630
+ to attach them to the start of each source file to most effectively
631
+ state the exclusion of warranty; and each file should have at least
632
+ the "copyright" line and a pointer to where the full notice is found.
633
+
634
+ <one line to give the program's name and a brief idea of what it does.>
635
+ Copyright (C) <year> <name of author>
636
+
637
+ This program is free software: you can redistribute it and/or modify
638
+ it under the terms of the GNU General Public License as published by
639
+ the Free Software Foundation, either version 3 of the License, or
640
+ (at your option) any later version.
641
+
642
+ This program is distributed in the hope that it will be useful,
643
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
644
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645
+ GNU General Public License for more details.
646
+
647
+ You should have received a copy of the GNU General Public License
648
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
649
+
650
+ Also add information on how to contact you by electronic and paper mail.
651
+
652
+ If the program does terminal interaction, make it output a short
653
+ notice like this when it starts in an interactive mode:
654
+
655
+ <program> Copyright (C) <year> <name of author>
656
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657
+ This is free software, and you are welcome to redistribute it
658
+ under certain conditions; type `show c' for details.
659
+
660
+ The hypothetical commands `show w' and `show c' should show the appropriate
661
+ parts of the General Public License. Of course, your program's commands
662
+ might be different; for a GUI interface, you would use an "about box".
663
+
664
+ You should also get your employer (if you work as a programmer) or school,
665
+ if any, to sign a "copyright disclaimer" for the program, if necessary.
666
+ For more information on this, and how to apply and follow the GNU GPL, see
667
+ <http://www.gnu.org/licenses/>.
668
+
669
+ The GNU General Public License does not permit incorporating your program
670
+ into proprietary programs. If your program is a subroutine library, you
671
+ may consider it more useful to permit linking proprietary applications with
672
+ the library. If this is what you want to do, use the GNU Lesser General
673
+ Public License instead of this License. But first, please read
674
+ <http://www.gnu.org/philosophy/why-not-lgpl.html>.
readme.txt CHANGED
@@ -1,199 +1,208 @@
1
- === Sticky Menu (or Anything!) on Scroll ===
2
- Contributors: senff
3
- Donate link: http://www.senff.com/donate
4
- Tags: sticky header, sticky menu, sticky, header, menu
5
- Plugin URI: http://www.senff.com/plugins/sticky-anything-wp
6
- Requires at least: 3.6
7
- Tested up to: 4.5
8
- Stable tag: 2.0
9
- License: GPLv2 or later
10
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
-
12
- Sticky Menu (Or Anything!) On Scroll will let you choose any element on your page that will be "sticky" at the top once you scroll down.
13
-
14
- == Description ==
15
-
16
- = Summary =
17
-
18
- The Sticky Menu (Or Anything) On Scroll plugin for WordPress allows you to make any element on your pages "sticky" as soon as it hits the top of the page when you scroll down. Although this is commonly used to keep menus at the top of your page, the plugin allows you to make ANY element sticky (such as a Call To Action box, a logo, etc.)
19
-
20
- A little bit of basic HTML/CSS knowledge is required. You just need to know how to pick the right selector for the element you want to make sticky, and you need to be sure it's a unique selector. Sometimes a simple selector like "nav", "#main-menu", ".menu-main-menu-1" is enough. Other times you will have to be more detailed and use a more specific selector such as "header > ul:first-child" or "nav.top .menu-header ul.main".
21
-
22
- = Features =
23
-
24
- * **Any element can stick**: although common use is for navigation menus, the plugin will let you pick any unique element with a name, class or ID to stick at the top of the page once you scroll past it. Use it for a sidebar, Call-to-action box, banner ad, etc.
25
- * **Positioning from top**: optionally, you can add any amount of space between the sticky element and the top of the page, so that the element is not always stuck at the "ceiling" of the page.
26
- * **Enable for certain screen sizes only**: optionally, you can set a minimum and/or maximum screen size where the stickiness should work. This can be handy if you have a responsive site and you don't want your element to be sticky on smaller screens, for example.
27
- * **Push-up element**: optionally, you can pick any other element lower on the page that will push the sticky element up again (for example a sidebar widget).
28
- * **Admin Bar aware**: checks if the current user has an Admin Toolbar at the top of the page. If it has, the sticky element will not obscure it (or be obscured by it).
29
- * **Z-index**: in case there are other elements on the page that obscure or peek through your sticky element, you can add a Z-index easily.
30
- * **Legacy Mode**: in 2.0, a new method of making things sticky was introduced. In Legacy Mode, the old method will be used. See FAQ for details.
31
- * **Dynamic Mode**: some issues that frequently appear in responsive themes have been address by adding a Dynamic Mode (Legacy Mode only). See FAQ for details.
32
- * **Debug Mode:** find out possible reasons why your element doesn't stick by switching on Debug Mode, and error messages will appear in your browser's console.
33
-
34
-
35
- == Installation ==
36
-
37
- 1. Upload the "sticky-menu-or-anything" directory to your "wp-content/plugins" directory.
38
- 1. In your WordPress admin, go to PLUGINS and activate "Sticky Menu (or Anything!)"
39
- 1. Go to SETTINGS - STICKY MENU (OR ANYTHING!)
40
- 1. Pick the element you want to make sticky
41
- 1. Party!
42
-
43
-
44
- == Frequently Asked Questions ==
45
-
46
- = I selected a class/ID in the settings screen, but the element doesn't stick when I scroll down. Why not? =
47
- First, make sure that if you select the element by its classname, it is preceded by a dot (e.g. ".main-menu"), and if you select it by its ID, that it's preceded by a pound/hash/number sign (e.g. "#main-menu"). Also, make sure there is only ONE element on the page with the selector you're using. If there is none, or more than one element that matches your selector, nothing will happen.
48
-
49
- = Once the element becomes sticky, it's not positioned/sized properly at all. =
50
- There are situations when this happens, especially when the original element has specific properties that are specifically used to manipulate its location and/or size. Things like negative margins, absolute positioning or left/top values on the original element can have undesired effects when the element becomes sticky. Another possible reason is if the original element has "!important" applied to some of its CSS properties. If possible, try to avoid that. Also, inline elements might not get the desired results. If that happens, try using the plugin in Legacy Mode (see below).
51
-
52
- = Once the element becomes sticky, there's a brief moment where you see it twice. =
53
- If you're using the plugin in Legacy Mode (see below), this happens when the sticky element (or any of its contents) has a CSS transition applied to it. Because the original element becomes invisible (and a cloned copy of it becomes visible), the visible-to-invisible status change will take place with a transition (ie. not instantly). Either remove any of the transitions the element has, or try disabling the Legacy Mode.
54
-
55
- = My menu sticks, but it doesn't open on the Responsive theme when it's sticky. =
56
- This was a bug in pre-2.0 versions, and an incompatibility with the theme. It has been fixed in 2.0, but in Legacy Mode, this bug is still present. If you need to enable Legacy Mode for some reason, it would be better to turn off stickiness for the mobile menu (set "Do not stick element when screen smaller than:" to 651 pixels).
57
-
58
- = I have another plugin called Easy Smooth Scroll Links, but once my menu becomes sticky, that one doesn't work anymore. =
59
- This was a bug in pre-2.0 versions, and an incompatibility with the plugin. It has been fixed in 2.0, but in Legacy Mode, this bug is still present. If you need Legacy Mode enabled for some reason, there is no fix for this bug, however there is an alternative workaround. According to reports from users who had this issue, a plugin called Page Scroll To ID is a worthy alternative to Easy Smooth Scroll Links and works with the Sticky Anything plugin in Legacy Mode.
60
-
61
- = Still doesn't work. What could be wrong? =
62
- Check the "Debug Mode" checkbox in the plugin's settings. Reload the page and you may see errors in your browser's console window. If you've used a selector that doesn't exist, OR there are more of them on the page, you will be notified of that in the console.
63
-
64
- = Is it possible to have multiple sticky elements? =
65
- The current version only allows one sticky element, but this functionality will be implemented in the next major version. No expected release date, though.
66
-
67
- = What is Legacy Mode? Should I use it? =
68
- In version 2.0 of the plugin, a new/better method for making elements sticky was introduced. Before this, a sticky element would essentially be a cloned copy of the original element. Now, the element itself becomes sticky and doesn't use copying and cloning anymore, which solves a lot of issues.
69
-
70
- So, should you use it or not? Well, if you upgraded this plugin from an earlier version, Legacy Mode will be turned ON by default, because chances are that the old method worked perfectly fine for your site. If that's the case, there is not really a need to use the new method and you can just continue using the old, classic method. If it ain't broke, don't fix it, right?
71
-
72
- Having said that, it's worth checking if your element works just as well with Legacy Mode turned OFF, since this is the "better" method. Just give it a quick try. If it doesn't work, you can always just go back and enable it again.
73
-
74
- NOTE: new installs of the plugin will have the Legacy Mode turned off by default. Only UPGRADES from 1.4 (or before) should have it turned on by default.
75
-
76
- = What is this Dynamic Mode thing exactly? =
77
- This mode is only available in Legacy Mode, and to properly explain this, we'll need to go a little deeper in the plugin's functionality. So bear with me...
78
-
79
- In Legacy Mode, when an element becomes sticky at the top of the page (and keeps its place regardless of the scrolling), it's actually not the element itself you see, but a cloned copy of it, while the actuak original element is out of view and invisible.
80
-
81
- The original element always stays where it originally is on the page, while the cloned element is always at the top of the browser viewport screen. However, you will never see them both at the same time; depending on your scroll position, it always just shows either one or the other.
82
-
83
- In the original plugin version, the clone would be created right the moment when you load the page (but not visible right away). Then when you would scroll down, it would become visible (and stick at the top), while the original element would disappear from view.
84
-
85
- However, some themes use JavaScript to dynamically create elements (menus, mostly) for mobile sites. With this method, a menu doesn't exist in the HTML source code when you load the page, but is created some time after the page is fully loaded -- in many cases, these menus would just be generated ONLY when the screen is more (or less) than a certain specific width. With the original version of the plugin, the problem would be that the original element (that you want to make sticky) may not have been fully created upon page load, so the clone would also not be fully functional.
86
-
87
- Enter Dynamic Mode. Now, a clone of the element is not created on page load -- instead, it's only created when the user scrolls and hits the "sticky" point. This ensures that the cloned element is an actual 1-on-1 copy of what the original element consists of at that specific point in time (and not at the "page is loaded" point, which may be different if the element was altered since).
88
-
89
- Why don't we use Dynamic Mode all the time then? This has to do with the fact that other plugins initialize themselves on page load and may need the full markup (including the cloned element) at that point. In Dynamic Mode, there is no clone available yet on page load, so that could cause an issue if that other plugin is looking for an element that doesn't exist yet.
90
-
91
- (This may all sound terribly confusing. And it is! So, much work was done to fix this nonsense: since v2.0 of the plugin, a whole different method is being used to make elements sticky, and Dynamic Mode is not even an issue anymore.)
92
-
93
- Phew!
94
-
95
- = I'll need more help please! =
96
- Please go to the plugin's [support forum on WordPress.org](https://wordpress.org/support/plugin/sticky-menu-or-anything-on-scroll) and post a message (include a link to your site if possible). Repsonse time is usually within a few hours maximum.
97
-
98
-
99
-
100
- == Screenshots ==
101
-
102
- 1. Basic Settings screen
103
- 1. Advanced Settings screen
104
-
105
-
106
- == Changelog ==
107
-
108
- = 2.0 =
109
- * Introduced a new/better method for making elements sticky
110
- * Added Legacy Mode (for those who want to continue the old method)
111
- * Split up settings screen in Basic and Advanced
112
- * Debug mode uses uncompressed JS file for easier remote debugging
113
-
114
- = 1.4 =
115
- * Removed error notification if no pushup-element is selected
116
- * Renaming class "cloned" to "sticky-element-cloned" and "original" to "sticky-element-original" to avoid conflicts with Owl Carousel
117
- * Fixed bug where cloned element width would be rounded down if it contained sub-pixels
118
-
119
- = 1.3.1 =
120
- * Minor bug fix for push-up element
121
-
122
- = 1.3 =
123
- * Added functionality to move sticky element down in case there is an Administrator Toolbar at the top of the page
124
- * Added functionality to push sticky element up by another element lower down the page
125
-
126
- = 1.2.4 =
127
- * Fixed small bug related to version number
128
-
129
- = 1.2.3 =
130
- * Bug with Dynamic Mode select box/label fixed
131
- * Bug with Z-index fixed (thanks @aguseo for reporting)
132
- * All text in plugin fully translatable
133
- * Added FAQ tab to settings screen
134
- * Added infobox to settings screen
135
- * Added a few comments to source code
136
-
137
- = 1.2 =
138
- * Dynamic Mode added (addressing problems with dynamically created menus -- see Frequently Asked Questions above for details)
139
-
140
- = 1.1.4 =
141
- * Ready for WordPress 4.1 (and TwentyFifteen)
142
- * Fixes issue when element has padding in percentages
143
-
144
- = 1.1.3 =
145
- * Fixes width calculation bug introduced in previous version (sorry about that), box sizing now supported
146
-
147
- = 1.1.2 =
148
- * Fixes element width calculation bug
149
-
150
- = 1.1.1 =
151
- * Fixes viewport calculation bug
152
-
153
- = 1.1 =
154
- * Added functionality for optional minimum/maximum screen size
155
-
156
- = 1.0 =
157
- * Initial release (using v1.1 of the standalone jQuery plugin)
158
-
159
-
160
- == Upgrade Notice ==
161
-
162
- = 2.0 =
163
- * Bug fixes and new/better method of making elements sticky
164
-
165
- = 1.4 =
166
- * Couple of bug fixes
167
-
168
- = 1.3.1 =
169
- * Minor bug fix for push-up element
170
-
171
- = 1.3 =
172
- * BY POPULAR DEMAND: functionalities added related to Administrator Toolbar and element that can push sticky element up
173
-
174
- = 1.2.4 =
175
- * Minor bugfix
176
-
177
- = 1.2.3 =
178
- * Bugfixes, improvements and translation-ready
179
-
180
- = 1.2 =
181
- * Dynamic Mode added
182
-
183
- = 1.1.4 =
184
- * Bugfixes, ready for WordPress 4.1 (and TwentyFifteen)
185
-
186
- = 1.1.3 =
187
- * Bugfix for new bug introduced in 1.1.2
188
-
189
- = 1.1.2 =
190
- * Bugfixes
191
-
192
- = 1.1.1 =
193
- * Bugfixes
194
-
195
- = 1.1 =
196
- * Added functionality (minimum and/or maximum screen size)
197
-
198
- = 1.0 =
199
- * Initial release of the plugin
 
 
 
 
 
 
 
 
 
1
+ === Sticky Menu (or Anything!) on Scroll ===
2
+ Contributors: senff
3
+ Donate link: http://www.senff.com/donate
4
+ Tags: sticky header, sticky menu, sticky, header, menu
5
+ Plugin URI: http://www.senff.com/plugins/sticky-anything-wp
6
+ Requires at least: 3.6
7
+ Tested up to: 4.6
8
+ Stable tag: 2.0.1
9
+ License: GPLv2 or later
10
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
+
12
+ Sticky Menu (Or Anything!) On Scroll will let you choose any element on your page that will be "sticky" at the top once you scroll down.
13
+
14
+ == Description ==
15
+
16
+ = Summary =
17
+
18
+ The Sticky Menu (Or Anything) On Scroll plugin for WordPress allows you to make any element on your pages "sticky" as soon as it hits the top of the page when you scroll down. Although this is commonly used to keep menus at the top of your page, the plugin allows you to make ANY element sticky (such as a Call To Action box, a logo, etc.)
19
+
20
+ A little bit of basic HTML/CSS knowledge is required. You just need to know how to pick the right selector for the element you want to make sticky, and you need to be sure it's a unique selector. Sometimes a simple selector like "nav", "#main-menu", ".menu-main-menu-1" is enough. Other times you will have to be more detailed and use a more specific selector such as "header > ul:first-child" or "nav.top .menu-header ul.main".
21
+
22
+ = Features =
23
+
24
+ * **Any element can stick**: although common use is for navigation menus, the plugin will let you pick any unique element with a name, class or ID to stick at the top of the page once you scroll past it. Use it for a sidebar, Call-to-action box, banner ad, etc.
25
+ * **Positioning from top**: optionally, you can add any amount of space between the sticky element and the top of the page, so that the element is not always stuck at the "ceiling" of the page.
26
+ * **Enable for certain screen sizes only**: optionally, you can set a minimum and/or maximum screen size where the stickiness should work. This can be handy if you have a responsive site and you don't want your element to be sticky on smaller screens, for example.
27
+ * **Push-up element**: optionally, you can pick any other element lower on the page that will push the sticky element up again (for example a sidebar widget).
28
+ * **Admin Bar aware**: checks if the current user has an Admin Toolbar at the top of the page. If it has, the sticky element will not obscure it (or be obscured by it).
29
+ * **Z-index**: in case there are other elements on the page that obscure or peek through your sticky element, you can add a Z-index easily.
30
+ * **Legacy Mode**: in 2.0, a new method of making things sticky was introduced. In Legacy Mode, the old method will be used. See FAQ for details.
31
+ * **Dynamic Mode**: some issues that frequently appear in responsive themes have been address by adding a Dynamic Mode (Legacy Mode only). See FAQ for details.
32
+ * **Debug Mode:** find out possible reasons why your element doesn't stick by switching on Debug Mode, and error messages will appear in your browser's console.
33
+
34
+
35
+ == Installation ==
36
+
37
+ 1. Upload the "sticky-menu-or-anything" directory to your "wp-content/plugins" directory.
38
+ 2. In your WordPress admin, go to PLUGINS and activate "Sticky Menu (or Anything!)"
39
+ 3. Go to SETTINGS - STICKY MENU (OR ANYTHING!)
40
+ 4. Pick the element you want to make sticky
41
+ 5. Party!
42
+
43
+
44
+ == Frequently Asked Questions ==
45
+
46
+ = I selected a class/ID in the settings screen, but the element doesn't stick when I scroll down. Why not? =
47
+ First, make sure that if you select the element by its classname, it is preceded by a dot (e.g. ".main-menu"), and if you select it by its ID, that it's preceded by a pound/hash/number sign (e.g. "#main-menu"). Also, make sure there is only ONE element on the page with the selector you're using. If there is none, or more than one element that matches your selector, nothing will happen.
48
+
49
+ = Once the element becomes sticky, it's not positioned/sized properly at all. =
50
+ There are situations when this happens, especially when the original element has specific properties that are specifically used to manipulate its location and/or size. Things like negative margins, absolute positioning or left/top values on the original element can have undesired effects when the element becomes sticky. Another possible reason is if the original element has "!important" applied to some of its CSS properties. If possible, try to avoid that. Also, inline elements might not get the desired results. If that happens, try using the plugin in Legacy Mode (see below).
51
+
52
+ = Once the element becomes sticky, there's a brief moment where you see it twice. =
53
+ If you're using the plugin in Legacy Mode (see below), this happens when the sticky element (or any of its contents) has a CSS transition applied to it. Because the original element becomes invisible (and a cloned copy of it becomes visible), the visible-to-invisible status change will take place with a transition (ie. not instantly). Either remove any of the transitions the element has, or try disabling the Legacy Mode.
54
+
55
+ = My menu sticks, but it doesn't open on the Responsive theme when it's sticky. =
56
+ This was a bug in pre-2.0 versions, and an incompatibility with the theme. It has been fixed in 2.0, but in Legacy Mode, this bug is still present. If you need to enable Legacy Mode for some reason, it would be better to turn off stickiness for the mobile menu (set "Do not stick element when screen smaller than:" to 651 pixels).
57
+
58
+ = I have another plugin called Easy Smooth Scroll Links, but once my menu becomes sticky, that one doesn't work anymore. =
59
+ This was a bug in pre-2.0 versions, and an incompatibility with the plugin. It has been fixed in 2.0, but in Legacy Mode, this bug is still present. If you need Legacy Mode enabled for some reason, there is no fix for this bug, however there is an alternative workaround. According to reports from users who had this issue, a plugin called Page Scroll To ID is a worthy alternative to Easy Smooth Scroll Links and works with the Sticky Anything plugin in Legacy Mode.
60
+
61
+ = Still doesn't work. What could be wrong? =
62
+ Check the "Debug Mode" checkbox in the plugin's settings. Reload the page and you may see errors in your browser's console window. If you've used a selector that doesn't exist, OR there are more of them on the page, you will be notified of that in the console.
63
+
64
+ = Is it possible to have multiple sticky elements? =
65
+ The current version only allows one sticky element, but this functionality will be implemented in the next major version. No expected release date, though.
66
+
67
+ = What is Legacy Mode? Should I use it? =
68
+ In version 2.0 of the plugin, a new/better method for making elements sticky was introduced. Before this, a sticky element would essentially be a cloned copy of the original element. Now, the element itself becomes sticky and doesn't use copying and cloning anymore, which solves a lot of issues.
69
+
70
+ So, should you use it or not? Well, if you upgraded this plugin from an earlier version, Legacy Mode will be turned ON by default, because chances are that the old method worked perfectly fine for your site. If that's the case, there is not really a need to use the new method and you can just continue using the old, classic method. If it ain't broke, don't fix it, right?
71
+
72
+ Having said that, it's worth checking if your element works just as well with Legacy Mode turned OFF, since this is the "better" method. Just give it a quick try. If it doesn't work, you can always just go back and enable it again.
73
+
74
+ NOTE: new installs of the plugin will have the Legacy Mode turned off by default. Only UPGRADES from 1.4 (or before) should have it turned on by default.
75
+
76
+ = What is this Dynamic Mode thing exactly? =
77
+ This mode is only available in Legacy Mode, and to properly explain this, we'll need to go a little deeper in the plugin's functionality. So bear with me...
78
+
79
+ In Legacy Mode, when an element becomes sticky at the top of the page (and keeps its place regardless of the scrolling), it's actually not the element itself you see, but a cloned copy of it, while the actuak original element is out of view and invisible.
80
+
81
+ The original element always stays where it originally is on the page, while the cloned element is always at the top of the browser viewport screen. However, you will never see them both at the same time; depending on your scroll position, it always just shows either one or the other.
82
+
83
+ In the original plugin version, the clone would be created right the moment when you load the page (but not visible right away). Then when you would scroll down, it would become visible (and stick at the top), while the original element would disappear from view.
84
+
85
+ However, some themes use JavaScript to dynamically create elements (menus, mostly) for mobile sites. With this method, a menu doesn't exist in the HTML source code when you load the page, but is created some time after the page is fully loaded -- in many cases, these menus would just be generated ONLY when the screen is more (or less) than a certain specific width. With the original version of the plugin, the problem would be that the original element (that you want to make sticky) may not have been fully created upon page load, so the clone would also not be fully functional.
86
+
87
+ Enter Dynamic Mode. Now, a clone of the element is not created on page load -- instead, it's only created when the user scrolls and hits the "sticky" point. This ensures that the cloned element is an actual 1-on-1 copy of what the original element consists of at that specific point in time (and not at the "page is loaded" point, which may be different if the element was altered since).
88
+
89
+ Why don't we use Dynamic Mode all the time then? This has to do with the fact that other plugins initialize themselves on page load and may need the full markup (including the cloned element) at that point. In Dynamic Mode, there is no clone available yet on page load, so that could cause an issue if that other plugin is looking for an element that doesn't exist yet.
90
+
91
+ (This may all sound terribly confusing. And it is! So, much work was done to fix this nonsense: since v2.0 of the plugin, a whole different method is being used to make elements sticky, and Dynamic Mode is not even an issue anymore.)
92
+
93
+ Phew!
94
+
95
+ = I'll need more help please! =
96
+ Please go to the plugin's [support forum on WordPress.org](https://wordpress.org/support/plugin/sticky-menu-or-anything-on-scroll) and post a message (include a link to your site if possible). Repsonse time is usually within a few hours maximum.
97
+
98
+ = I need some functionality that the plugin currently doesn't support. Can you help make a custom version? =
99
+ If the customization is fairly minor, I can probably help out right away. However, if the requested customization is of a more complex nature, I won't be able to do it quickly/free and it may take a number of hours. If you're interested in that, please go to the plugin's [support forum on WordPress.org](https://wordpress.org/support/plugin/sticky-menu-or-anything-on-scroll) and let me know that you'll need some custom work (include a link to your site if possible).
100
+
101
+
102
+ == Screenshots ==
103
+
104
+ 1. Basic Settings screen
105
+ 2. Advanced Settings screen
106
+
107
+
108
+ == Changelog ==
109
+
110
+ = 2.0.1 =
111
+ * fixed padding calculation bug (percentages are off when sticky)
112
+ * fixed bug where assigned styles loop caused JS error
113
+
114
+ = 2.0 =
115
+ * Introduced a new/better method for making elements sticky
116
+ * Added Legacy Mode (for those who want to continue the old method)
117
+ * Split up settings screen in Basic and Advanced
118
+ * Debug mode uses uncompressed JS file for easier remote debugging
119
+
120
+ = 1.4 =
121
+ * Removed error notification if no pushup-element is selected
122
+ * Renaming class "cloned" to "sticky-element-cloned" and "original" to "sticky-element-original" to avoid conflicts with Owl Carousel
123
+ * Fixed bug where cloned element width would be rounded down if it contained sub-pixels
124
+
125
+ = 1.3.1 =
126
+ * Minor bug fix for push-up element
127
+
128
+ = 1.3 =
129
+ * Added functionality to move sticky element down in case there is an Administrator Toolbar at the top of the page
130
+ * Added functionality to push sticky element up by another element lower down the page
131
+
132
+ = 1.2.4 =
133
+ * Fixed small bug related to version number
134
+
135
+ = 1.2.3 =
136
+ * Bug with Dynamic Mode select box/label fixed
137
+ * Bug with Z-index fixed (thanks @aguseo for reporting)
138
+ * All text in plugin fully translatable
139
+ * Added FAQ tab to settings screen
140
+ * Added infobox to settings screen
141
+ * Added a few comments to source code
142
+
143
+ = 1.2 =
144
+ * Dynamic Mode added (addressing problems with dynamically created menus -- see Frequently Asked Questions above for details)
145
+
146
+ = 1.1.4 =
147
+ * Ready for WordPress 4.1 (and TwentyFifteen)
148
+ * Fixes issue when element has padding in percentages
149
+
150
+ = 1.1.3 =
151
+ * Fixes width calculation bug introduced in previous version (sorry about that), box sizing now supported
152
+
153
+ = 1.1.2 =
154
+ * Fixes element width calculation bug
155
+
156
+ = 1.1.1 =
157
+ * Fixes viewport calculation bug
158
+
159
+ = 1.1 =
160
+ * Added functionality for optional minimum/maximum screen size
161
+
162
+ = 1.0 =
163
+ * Initial release (using v1.1 of the standalone jQuery plugin)
164
+
165
+
166
+ == Upgrade Notice ==
167
+
168
+ = 2.0.1 =
169
+ * A few small bug fixes
170
+
171
+ = 2.0 =
172
+ * Bug fixes and new/better method of making elements sticky
173
+
174
+ = 1.4 =
175
+ * Couple of bug fixes
176
+
177
+ = 1.3.1 =
178
+ * Minor bug fix for push-up element
179
+
180
+ = 1.3 =
181
+ * BY POPULAR DEMAND: functionalities added related to Administrator Toolbar and element that can push sticky element up
182
+
183
+ = 1.2.4 =
184
+ * Minor bugfix
185
+
186
+ = 1.2.3 =
187
+ * Bugfixes, improvements and translation-ready
188
+
189
+ = 1.2 =
190
+ * Dynamic Mode added
191
+
192
+ = 1.1.4 =
193
+ * Bugfixes, ready for WordPress 4.1 (and TwentyFifteen)
194
+
195
+ = 1.1.3 =
196
+ * Bugfix for new bug introduced in 1.1.2
197
+
198
+ = 1.1.2 =
199
+ * Bugfixes
200
+
201
+ = 1.1.1 =
202
+ * Bugfixes
203
+
204
+ = 1.1 =
205
+ * Added functionality (minimum and/or maximum screen size)
206
+
207
+ = 1.0 =
208
+ * Initial release of the plugin
sticky-menu-or-anything.php CHANGED
@@ -1,545 +1,545 @@
1
- <?php
2
- /*
3
- Plugin Name: Sticky Menu (or Anything!) on Scroll
4
- Plugin URI: http://www.senff.com/plugins/sticky-anything-wp
5
- Description: Pick any element on your page, and it will stick when it reaches the top of the page when you scroll down. Usually handy for navigation menus, but can be used for any (unique) element on your page.
6
- Author: Mark Senff
7
- Author URI: http://www.senff.com
8
- Version: 2.0
9
- */
10
-
11
- defined('ABSPATH') or die('INSERT COIN');
12
-
13
-
14
- /**
15
- * === FUNCTIONS ========================================================================================
16
- */
17
-
18
- /**
19
- * --- TRIGGERED ON ACTIVATION --------------------------------------------------------------------------
20
- * --- IF DATABASE VALUES ARE NOT SET AT ALL, ADD DEFAULT OPTIONS TO DATABASE ---------------------------
21
- */
22
- if (!function_exists('sticky_anthing_default_options')) {
23
- function sticky_anthing_default_options() {
24
- $versionNum = '2.0';
25
- if (get_option('sticky_anything_options') === false) {
26
- $new_options['sa_version'] = $versionNum;
27
- $new_options['sa_element'] = '';
28
- $new_options['sa_topspace'] = '';
29
- $new_options['sa_adminbar'] = true;
30
- $new_options['sa_minscreenwidth'] = '';
31
- $new_options['sa_maxscreenwidth'] = '';
32
- $new_options['sa_zindex'] = '';
33
- $new_options['sa_legacymode'] = false;
34
- $new_options['sa_dynamicmode'] = false;
35
- $new_options['sa_debugmode'] = false;
36
- $new_options['sa_pushup'] = '';
37
- add_option('sticky_anything_options',$new_options);
38
- }
39
- }
40
- }
41
-
42
- /**
43
- * --- IF DATABASE VALUES EXIST, THEN THIS IS AN UPGRADE, SO CHECK IF NEWER OPTIONS EXIST --------------
44
- * --- IF NOT, ADD THESE OPTIONS WITH DEFAULT VALUES ---------------------------------------------------
45
- * --- AND UPDATE VERSION NUMBER FOR SURE --------------------------------------------------------------
46
- */
47
- if (!function_exists('sticky_anything_update')) {
48
- function sticky_anything_update() {
49
- $versionNum = '2.0';
50
- $existing_options = get_option('sticky_anything_options');
51
-
52
- if(!isset($existing_options['sa_minscreenwidth'])) {
53
- // Introduced in version 1.1
54
- $existing_options['sa_minscreenwidth'] = '';
55
- $existing_options['sa_maxscreenwidth'] = '';
56
- }
57
-
58
- if(!isset($existing_options['sa_dynamicmode'])) {
59
- // Introduced in version 1.2
60
- $existing_options['sa_dynamicmode'] = false;
61
- }
62
-
63
- if(!isset($existing_options['sa_pushup'])) {
64
- // Introduced in version 1.3
65
- $existing_options['sa_pushup'] = '';
66
- $existing_options['sa_adminbar'] = true;
67
- }
68
-
69
- if(!isset($existing_options['sa_legacymode'])) {
70
- // Introduced in version 2.0
71
- // Keep the old/legacy mode, since that mode obviously worked before the upgrade.
72
- $existing_options['sa_legacymode'] = true;
73
- }
74
-
75
- $existing_options['sa_version'] = $versionNum;
76
- update_option('sticky_anything_options',$existing_options);
77
- }
78
- }
79
-
80
-
81
- /**
82
- * --- LOAD MAIN .JS FILE AND CALL IT WITH PARAMETERS (BASED ON DATABASE VALUES) -----------------------
83
- */
84
- if (!function_exists('load_sticky_anything')) {
85
- function load_sticky_anything() {
86
-
87
- $options = get_option('sticky_anything_options');
88
- $versionNum = $options['sa_version'];
89
-
90
- // Main jQuery plugin file
91
- if($options['sa_debugmode']==true){
92
- wp_register_script('stickyAnythingLib', plugins_url('/assets/js/jq-sticky-anything.js', __FILE__), array( 'jquery' ), $versionNum);
93
- } else {
94
- wp_register_script('stickyAnythingLib', plugins_url('/assets/js/jq-sticky-anything.min.js', __FILE__), array( 'jquery' ), $versionNum);
95
- }
96
- wp_enqueue_script('stickyAnythingLib');
97
-
98
- // Set defaults for by-default-empty elements (because '' does not work with the JQ plugin)
99
- if (!$options['sa_topspace']) {
100
- $options['sa_topspace'] = '0';
101
- }
102
-
103
- if (!$options['sa_minscreenwidth']) {
104
- $options['sa_minscreenwidth'] = '0';
105
- }
106
-
107
- if (!$options['sa_maxscreenwidth']) {
108
- $options['sa_maxscreenwidth'] = '999999';
109
- }
110
-
111
- // If empty, set to 1 - not to 0. Also, if set to "0", keep it at 0.
112
- if (strlen($options['sa_zindex']) == "0") { // LENGTH is 0 (not the actual value)
113
- $options['sa_zindex'] = '1';
114
- }
115
-
116
- $script_vars = array(
117
- 'element' => $options['sa_element'],
118
- 'topspace' => $options['sa_topspace'],
119
- 'minscreenwidth' => $options['sa_minscreenwidth'],
120
- 'maxscreenwidth' => $options['sa_maxscreenwidth'],
121
- 'zindex' => $options['sa_zindex'],
122
- 'legacymode' => $options['sa_legacymode'],
123
- 'dynamicmode' => $options['sa_dynamicmode'],
124
- 'debugmode' => $options['sa_debugmode'],
125
- 'pushup' => $options['sa_pushup'],
126
- 'adminbar' => $options['sa_adminbar']
127
- );
128
-
129
- wp_enqueue_script('stickThis', plugins_url('/assets/js/stickThis.js', __FILE__), array( 'jquery' ), $versionNum, true);
130
- wp_localize_script( 'stickThis', 'sticky_anything_engage', $script_vars );
131
-
132
- }
133
- }
134
-
135
-
136
- /**
137
- * --- ADD LINK TO SETTINGS PAGE TO SIDEBAR ------------------------------------------------------------
138
- */
139
- if (!function_exists('sticky_anything_menu')) {
140
- function sticky_anything_menu() {
141
- add_options_page( 'Sticky Menu (or Anything!) Configuration', 'Sticky Menu (or Anything!)', 'manage_options', 'stickyanythingmenu', 'sticky_anything_config_page' );
142
- }
143
- }
144
-
145
-
146
- /**
147
- * --- ADD LINK TO SETTINGS PAGE TO PLUGIN ------------------------------------------------------------
148
- */
149
- if (!function_exists('sticky_anything_settings_link')) {
150
- function sticky_anything_settings_link($links) {
151
- $settings_link = '<a href="options-general.php?page=stickyanythingmenu">Settings</a>';
152
- array_unshift($links, $settings_link);
153
- return $links;
154
- }
155
- }
156
-
157
-
158
- /**
159
- * --- THE WHOLE ADMIN SETTINGS PAGE -------------------------------------------------------------------
160
- */
161
- if (!function_exists('sticky_anything_config_page')) {
162
- function sticky_anything_config_page() {
163
- // Retrieve plugin configuration options from database
164
- $sticky_anything_options = get_option( 'sticky_anything_options' );
165
- ?>
166
-
167
- <div id="sticky-anything-settings-general" class="wrap">
168
- <h2><?php _e('Sticky Menu (or Anything!) Settings','Sticky Anything plugin'); ?></h2>
169
-
170
- <p><?php _e('Pick any element on your page, and it will stick when it reaches the top of the page when you scroll down. Usually handy for navigation menus, but can be used for any (unique) element on your page.','Sticky Anything plugin'); ?></p>
171
-
172
- <div class="main-content">
173
-
174
- <?php
175
- if ( isset( $_GET['tab'] )) {
176
- $activeTab = $_GET['tab'];
177
- } else {
178
- $activeTab = 'main';
179
- }
180
- ?>
181
-
182
- <h2 class="nav-tab-wrapper">
183
- <a class="nav-tab <?php if ($activeTab == 'main') { echo 'nav-tab-active'; } ?>" href="#main"><?php _e('Basic settings','Sticky Anything plugin'); ?></a>
184
- <a class="nav-tab <?php if ($activeTab == 'advanced') { echo 'nav-tab-active'; } ?>" href="#advanced"><?php _e('Advanced settings','Sticky Anything plugin'); ?></a>
185
- <a class="nav-tab <?php if ($activeTab == 'faq') { echo ' nav-tab-active'; } ?>" href="#faq"><?php _e('FAQ/Troubleshooting','Sticky Anything plugin'); ?></a>
186
- </h2>
187
-
188
- <br>
189
-
190
- <?php
191
-
192
- $warnings = false;
193
-
194
- if ( isset( $_GET['message'] )) {
195
- if ($_GET['message'] == '1') {
196
- echo '<div id="message" class="fade updated"><p><strong>'.__('Settings Updated.','Sticky Anything plugin').'</strong></p></div>';
197
- }
198
- }
199
-
200
- if ( isset( $_GET['message'] )) {
201
- if ($sticky_anything_options['sa_element'] == '') {
202
- $warnings = true;
203
- }
204
- }
205
-
206
- if ( (!is_numeric($sticky_anything_options['sa_topspace'])) && ($sticky_anything_options['sa_topspace'] != '')) {
207
- // Top space is not empty and has bad value
208
- $warnings = true;
209
- }
210
-
211
- if ( (!is_numeric($sticky_anything_options['sa_minscreenwidth'])) && ($sticky_anything_options['sa_minscreenwidth'] != '')) {
212
- // Minimum width is not empty and has bad value
213
- $warnings = true;
214
- }
215
-
216
- if ( (!is_numeric($sticky_anything_options['sa_maxscreenwidth'])) && ($sticky_anything_options['sa_maxscreenwidth'] != '')) {
217
- // Maximum width is not empty and has bad value
218
- $warnings = true;
219
- }
220
-
221
- if ( ($sticky_anything_options['sa_minscreenwidth'] != '') && ($sticky_anything_options['sa_maxscreenwidth'] != '') && ( ($sticky_anything_options['sa_minscreenwidth']) >= ($sticky_anything_options['sa_maxscreenwidth']) ) ) {
222
- // Minimum width is larger than the maximum width
223
- $warnings = true;
224
- }
225
-
226
- if ((!is_numeric($sticky_anything_options['sa_zindex'])) && ($sticky_anything_options['sa_zindex'] != '')) {
227
- // Z-index is not empty and has bad value
228
- $warnings = true;
229
- }
230
-
231
- // IF THERE ARE ERRORS, SHOW THEM
232
- if ( $warnings == true ) {
233
- echo '<div id="message" class="error"><p><strong>'.__('Please review the current settings:','Sticky Anything plugin').'</strong></p>';
234
- echo '<ul style="list-style-type:disc; margin:0 0 20px 24px;">';
235
-
236
- if ($sticky_anything_options['sa_element'] == '') {
237
- echo '<li>'.__('ELEMENT is a required field. If you do not want anything sticky, consider disabling the plugin.','Sticky Anything plugin').'</li>';
238
- }
239
-
240
- if ( (!is_numeric($sticky_anything_options['sa_topspace'])) && ($sticky_anything_options['sa_topspace'] != '')) {
241
- echo '<li>'.__('TOP POSITION has to be a number (do not include "px" or "pixels", or any other characters).','Sticky Anything plugin').'</li>';
242
- }
243
-
244
- if ( (!is_numeric($sticky_anything_options['sa_minscreenwidth'])) && ($sticky_anything_options['sa_minscreenwidth'] != '')) {
245
- echo '<li>'.__('MINIMUM SCREEN WIDTH has to be a number (do not include "px" or "pixels", or any other characters).','Sticky Anything plugin').'</li>';
246
- }
247
-
248
- if ( (!is_numeric($sticky_anything_options['sa_maxscreenwidth'])) && ($sticky_anything_options['sa_maxscreenwidth'] != '')) {
249
- echo '<li>'.__('MAXIMUM SCREEN WIDTH has to be a number (do not include "px" or "pixels", or any other characters).','Sticky Anything plugin').'</li>';
250
- }
251
-
252
- if ( ($sticky_anything_options['sa_minscreenwidth'] != '') && ($sticky_anything_options['sa_maxscreenwidth'] != '') && ( ($sticky_anything_options['sa_minscreenwidth']) >= ($sticky_anything_options['sa_maxscreenwidth']) ) ) {
253
- echo '<li>'.__('MAXIMUM screen width has to have a larger value than the MINIMUM screen width.','Sticky Anything plugin').'</li>';
254
- }
255
-
256
- if ((!is_numeric($sticky_anything_options['sa_zindex'])) && ($sticky_anything_options['sa_zindex'] != '')) {
257
- echo '<li>'.__('Z-INDEX has to be a number (do not include any other characters).','Sticky Anything plugin').'</li>';
258
- }
259
-
260
- echo '</ul></div>';
261
- }
262
-
263
- ?>
264
-
265
- <div class="tabs-content">
266
-
267
- <form method="post" action="admin-post.php">
268
-
269
- <div class="tab-content tab-sticky-main <?php if ($activeTab != 'main') {echo 'hide';} ?>">
270
-
271
- <input type="hidden" name="action" value="save_sticky_anything_options" />
272
- <!-- Adding security through hidden referrer field -->
273
- <?php wp_nonce_field( 'sticky_anything' ); ?>
274
-
275
- <table class="form-table">
276
-
277
- <tr>
278
- <th scope="row"><?php _e('Sticky Element:','Sticky Anything plugin'); ?> <span class="required">*</span> <a href="#" title="<?php _e('The element that needs to be sticky once you scroll. This can be your menu, or any other element like a sidebar, ad banner, etc. Make sure this is a unique identifier.','Sticky Anything plugin'); ?>" class="help">?</a></th>
279
- <td>
280
- <input type="text" id="sa_element" name="sa_element" value="<?php
281
- if ($sticky_anything_options['sa_element'] != '#NO-ELEMENT') {
282
- echo esc_html( $sticky_anything_options['sa_element'] );
283
- }
284
- ?>"/> <em><?php _e('(choose ONE element, e.g. <strong>#main-navigation</strong>, OR <strong>.main-menu-1</strong>, OR <strong>header nav</strong>, etc.)','Sticky Anything plugin'); ?></em>
285
- </td>
286
- </tr>
287
-
288
-
289
- <tr>
290
- <th scope="row"><?php _e('Space between top of page and sticky element: (optional)','Sticky Anything plugin'); ?> <a href="#" title="<?php _e('If you don\'t want the element to be sticky at the very top of the page, but a little lower, add the number of pixels that should be between your element and the \'ceiling\' of the page.','Sticky Anything plugin'); ?>" class="help">?</a></th>
291
- <td>
292
- <input type="number" id="sa_topspace" name="sa_topspace" value="<?php echo esc_html( $sticky_anything_options['sa_topspace'] ); ?>" style="width:80px;" /> pixels
293
- </td>
294
- </tr>
295
-
296
- <tr>
297
- <th scope="row"><?php _e('Check for Admin Toolbar:','Sticky Anything plugin'); ?> <a href="#" title="<?php _e('If the sticky element gets obscured by the Administrator Toolbar for logged in users (or vice versa), check this box.','Sticky Anything plugin'); ?>" class="help">?</a></th>
298
- <td>
299
- <input type="checkbox" id="sa_adminbar" name="sa_adminbar" <?php if ($sticky_anything_options['sa_adminbar'] ) echo ' checked="checked" ';?> />
300
- <label for="sa_adminbar"><strong><?php _e('Move the sticky element down a little if there is an Administrator Toolbar at the top (for logged in users).','Sticky Anything plugin'); ?></strong></label>
301
- </td>
302
- </tr>
303
-
304
- <tr>
305
- <th scope="row"><?php _e('Do not stick element when screen smaller than: (optional)','Sticky Anything plugin'); ?> <a href="#" title="<?php _e('Sometimes you do not want your element to be sticky when your screen is small (responsive menus, etc). If you enter a value here, your menu will not be sticky when your screen width is smaller than his value.','Sticky Anything plugin'); ?>" class="help">?</a></th>
306
- <td>
307
- <input type="number" id="sa_minscreenwidth" name="sa_minscreenwidth" value="<?php echo esc_html( $sticky_anything_options['sa_minscreenwidth'] ); ?>" style="width:80px;" /> pixels
308
- </td>
309
- </tr>
310
-
311
- <tr>
312
- <th scope="row"><?php _e('Do not stick element when screen larger than: (optional)','Sticky Anything plugin'); ?> <a href="#" title="<?php _e('Sometimes you do not want your element to be sticky when your screen is large (responsive menus, etc). If you enter a value here, your menu will not be sticky when your screen width is wider than this value.','Sticky Anything plugin'); ?>" class="help">?</a></th>
313
- <td>
314
- <input type="number" id="sa_maxscreenwidth" name="sa_maxscreenwidth" value="<?php echo esc_html( $sticky_anything_options['sa_maxscreenwidth'] ); ?>" style="width:80px;" /> pixels
315
- </td>
316
- </tr>
317
-
318
- </table>
319
-
320
- </div>
321
-
322
- <div class="tab-content tab-sticky-advanced <?php if ($activeTab != 'advanced') {echo 'hide';}?>">
323
-
324
- <input type="hidden" name="action" value="save_sticky_anything_options" />
325
- <!-- Adding security through hidden referrer field -->
326
- <?php wp_nonce_field( 'sticky_anything' ); ?>
327
-
328
- <table class="form-table">
329
-
330
- <tr>
331
- <th scope="row"><?php _e('Z-index: (optional)','Sticky Anything plugin'); ?> <a href="#" title="<?php _e('If there are other elements on the page that obscure/overlap the sticky element, adding a Z-index might help. If you have no idea what that means, try entering 99999.','Sticky Anything plugin'); ?>" class="help">?</a></th>
332
- <td>
333
- <input type="number" id="sa_zindex" name="sa_zindex" value="<?php echo esc_html( $sticky_anything_options['sa_zindex'] ); ?>" style="width:80px;" />
334
- </td>
335
- </tr>
336
-
337
- <tr>
338
- <th scope="row"><?php _e('Push-up element (optional):','Sticky Anything plugin'); ?> <a href="#" title="<?php _e('If you want your sticky element to be \'pushed up\' again by another element lower on the page, enter it here. Make sure this is a unique identifier.','Sticky Anything plugin'); ?>" class="help">?</a></th>
339
- <td>
340
- <input type="text" id="sa_pushup" name="sa_pushup" value="<?php
341
- if ($sticky_anything_options['sa_pushup'] != '#NO-ELEMENT') {
342
- echo esc_html( $sticky_anything_options['sa_pushup'] );
343
- }
344
- ?>"/> <em><?php _e('(choose ONE element, e.g. <strong>#footer</strong>, OR <strong>.widget-bottom</strong>, etc.)','Sticky Anything plugin'); ?></em>
345
- </td>
346
- </tr>
347
-
348
- <tr>
349
- <th scope="row"><span class="new"><?php _e('NEW!','Sticky Anything plugin'); ?></span> <?php _e('Legacy mode:','Sticky Anything plugin'); ?> <a href="#" title="<?php _e('If you upgraded from an earlier version and it always worked before, use legacy mode to keep using the old method.','Sticky Anything plugin'); ?>" class="help">?</a></th>
350
- <td>
351
- <input type="checkbox" id="sa_legacymode" name="sa_legacymode" <?php if ($sticky_anything_options['sa_legacymode'] == true ) echo ' checked="checked" ';?> />
352
- <label for="sa_legacymode"><strong><?php _e('Legacy Mode (only recommended if you upgraded from earlier version).','Sticky Anything plugin'); ?></strong></label>
353
- <p class="description"><?php _e('In version 2.0, a new/better method for making elements sticky was introduced. However, if you upgraded this plugin from an earlier version, and the old method always worked for you, there is no need to use the new method and you should keep this option checked.<br>More information about this setting can be found in the <a href="#faq" class="faq">FAQ</a>.','Sticky Anything plugin'); ?></p>
354
- </td>
355
- </tr>
356
-
357
- <tr id="row-dynamic-mode" <?php if ($sticky_anything_options['sa_legacymode'] == false ) echo 'class="disabled-feature"';?>>
358
- <th scope="row"><div class="showhide" <?php if ($sticky_anything_options['sa_legacymode'] == false ) echo 'style="display:none;"';?>><?php _e('Dynamic mode:','Sticky Anything plugin'); ?> <a href="#" title="<?php _e('When Dynamic Mode is OFF, a cloned element will be created upon page load. If this mode is ON, a cloned element will be created every time your scrolled position hits the \'sticky\' point (option available in Legacy Mode only).','Sticky Anything plugin'); ?>" class="help">?</a></div></th>
359
- <td><div class="showhide" <?php if ($sticky_anything_options['sa_legacymode'] == false ) echo 'style="display:none;"';?>>
360
- <input type="checkbox" id="sa_dynamicmode" name="sa_dynamicmode" <?php if ($sticky_anything_options['sa_dynamicmode'] ) echo ' checked="checked" ';?> />
361
- <label for="sa_dynamicmode"><strong><?php _e('If the plugin doesn\'t work in your theme (often the case with responsive themes), try it in Dynamic Mode.','Sticky Anything plugin'); ?></strong></label>
362
- <p class="description"><?php _e('NOTE: this is not a \'Magic Checkbox\' that fixes all problems. It simply solves some issues that frequently appear with some responsive themes, but doesn\'t necessarily work in ALL situations.','Sticky Anything plugin'); ?></p>
363
- </div>
364
- </td>
365
- </tr>
366
-
367
- <tr>
368
- <th scope="row"><?php _e('Debug mode:','Sticky Anything plugin'); ?> <a href="#" title="<?php _e('When Debug Mode is on, error messages will be shown in your browser\'s console when the element you selected either doesn\'t exist, or when there are more elements on the page with your chosen selector.','Sticky Anything plugin'); ?>" class="help">?</a></th>
369
- <td>
370
- <input type="checkbox" id="sa_debugmode" name="sa_debugmode" <?php if ($sticky_anything_options['sa_debugmode'] ) echo ' checked="checked" ';?> />
371
- <label for="sa_debugmode"><strong><?php _e('Log plugin errors in browser console','Sticky Anything plugin'); ?></strong></label>
372
- <p class="description"><?php _e('This will help debugging the plugin in case of problems. Do NOT check this option in production environments.','Sticky Anything plugin'); ?></p>
373
- </td>
374
- </tr>
375
-
376
- </table>
377
-
378
- </div>
379
-
380
- <div class="tab-content tab-sticky-main tab-sticky-advanced <?php if (($activeTab != 'main') && ($activeTab != 'advanced')) {echo 'hide';} ?>">
381
-
382
- <input type="hidden" name="sa_tab" value="<?php echo $activeTab ?>">
383
-
384
- &nbsp;<br><input type="submit" value="<?php _e('SAVE SETTINGS','Sticky Anything plugin'); ?>" class="button-primary"/>
385
-
386
- </div>
387
-
388
- </form>
389
-
390
- <div class="tab-content tab-sticky-faq <?php if ($activeTab != 'faq') {echo 'hide';} ?>">
391
- <?php include 'assets/faq.php'; ?>
392
- </div>
393
-
394
- </div>
395
-
396
- </div>
397
-
398
- <div class="main-sidebar">
399
- <?php include 'assets/plugin-info.php'; ?>
400
- </div>
401
-
402
- </div>
403
-
404
- <?php
405
- }
406
- }
407
-
408
-
409
- if (!function_exists('sticky_anything_admin_init')) {
410
- function sticky_anything_admin_init() {
411
- add_action( 'admin_post_save_sticky_anything_options', 'process_sticky_anything_options' );
412
- }
413
- }
414
-
415
- /**
416
- * --- PROCESS THE SETTINGS FORM AFTER SUBMITTING ------------------------------------------------------
417
- */
418
- if (!function_exists('process_sticky_anything_options')) {
419
- function process_sticky_anything_options() {
420
-
421
- if ( !current_user_can( 'manage_options' ))
422
- wp_die( 'Not allowed');
423
-
424
- check_admin_referer('sticky_anything');
425
- $options = get_option('sticky_anything_options');
426
-
427
- foreach ( array('sa_element') as $option_name ) {
428
- if ( isset( $_POST[$option_name] ) ) {
429
- $options[$option_name] = sanitize_text_field( $_POST[$option_name] );
430
- }
431
- }
432
-
433
- foreach ( array('sa_topspace') as $option_name ) {
434
- if ( isset( $_POST[$option_name] ) ) {
435
- $options[$option_name] = sanitize_text_field( $_POST[$option_name] );
436
- }
437
- }
438
-
439
- foreach ( array('sa_minscreenwidth') as $option_name ) {
440
- if ( isset( $_POST[$option_name] ) ) {
441
- $options[$option_name] = sanitize_text_field( $_POST[$option_name] );
442
- }
443
- }
444
-
445
- foreach ( array('sa_maxscreenwidth') as $option_name ) {
446
- if ( isset( $_POST[$option_name] ) ) {
447
- $options[$option_name] = sanitize_text_field( $_POST[$option_name] );
448
- }
449
- }
450
-
451
- foreach ( array('sa_zindex') as $option_name ) {
452
- if ( isset( $_POST[$option_name] ) ) {
453
- $options[$option_name] = sanitize_text_field( $_POST[$option_name] );
454
- }
455
- }
456
-
457
- foreach ( array('sa_pushup') as $option_name ) {
458
- if ( isset( $_POST[$option_name] ) ) {
459
- $options[$option_name] = sanitize_text_field( $_POST[$option_name] );
460
- }
461
- }
462
-
463
- foreach ( array('sa_adminbar') as $option_name ) {
464
- if ( isset( $_POST[$option_name] ) ) {
465
- $options[$option_name] = true;
466
- } else {
467
- $options[$option_name] = false;
468
- }
469
- }
470
-
471
- foreach ( array('sa_legacymode') as $option_name ) {
472
- if ( isset( $_POST[$option_name] ) ) {
473
- $options[$option_name] = true;
474
- } else {
475
- $options[$option_name] = false;
476
- }
477
- }
478
-
479
- foreach ( array('sa_dynamicmode') as $option_name ) {
480
- if ( isset( $_POST[$option_name] ) ) {
481
- $options[$option_name] = true;
482
- } else {
483
- $options[$option_name] = false;
484
- }
485
- }
486
-
487
- foreach ( array('sa_debugmode') as $option_name ) {
488
- if ( isset( $_POST[$option_name] ) ) {
489
- $options[$option_name] = true;
490
- } else {
491
- $options[$option_name] = false;
492
- }
493
- }
494
-
495
- foreach ( array('sa_tab') as $option_name ) {
496
- if ( isset( $_POST[$option_name] ) ) {
497
- $options[$option_name] = sanitize_text_field( $_POST[$option_name] );
498
- }
499
- }
500
-
501
- $tabValue = $_POST['sa_tab'];
502
-
503
- update_option( 'sticky_anything_options', $options );
504
- wp_redirect( add_query_arg(
505
- array('page' => 'stickyanythingmenu', 'message' => '1', 'tab' => $tabValue),
506
- admin_url( 'options-general.php' )
507
- )
508
- );
509
-
510
- exit;
511
- }
512
- }
513
-
514
-
515
- /**
516
- * --- ADD THE .CSS AND .JS TO ADMIN MENU --------------------------------------------------------------
517
- */
518
- if (!function_exists('sticky_anything_styles')) {
519
- function sticky_anything_styles($hook) {
520
- if ($hook != 'settings_page_stickyanythingmenu') {
521
- return;
522
- }
523
-
524
- wp_register_script('stickyAnythingAdminScript', plugins_url('/assets/js/sticky-anything-admin.js', __FILE__), array( 'jquery' ), '2.0');
525
- wp_enqueue_script('stickyAnythingAdminScript');
526
-
527
- wp_register_style('stickyAnythingAdminStyle', plugins_url('/assets/css/sticky-anything-admin.css', __FILE__) );
528
- wp_enqueue_style('stickyAnythingAdminStyle');
529
- }
530
- }
531
-
532
-
533
- /**
534
- * === HOOKS AND ACTIONS AND FILTERS AND SUCH ==========================================================
535
- */
536
-
537
- $plugin = plugin_basename(__FILE__);
538
-
539
- register_activation_hook( __FILE__, 'sticky_anthing_default_options' );
540
- add_action('init','sticky_anything_update',1);
541
- add_action('wp_enqueue_scripts', 'load_sticky_anything');
542
- add_action('admin_menu', 'sticky_anything_menu');
543
- add_action('admin_init', 'sticky_anything_admin_init' );
544
- add_action('admin_enqueue_scripts', 'sticky_anything_styles' );
545
- add_filter("plugin_action_links_$plugin", 'sticky_anything_settings_link' );
1
+ <?php
2
+ /*
3
+ Plugin Name: Sticky Menu (or Anything!) on Scroll
4
+ Plugin URI: http://www.senff.com/plugins/sticky-anything-wp
5
+ Description: Pick any element on your page, and it will stick when it reaches the top of the page when you scroll down. Usually handy for navigation menus, but can be used for any (unique) element on your page.
6
+ Author: Mark Senff
7
+ Author URI: http://www.senff.com
8
+ Version: 2.0.1
9
+ */
10
+
11
+ defined('ABSPATH') or die('INSERT COIN');
12
+
13
+
14
+ /**
15
+ * === FUNCTIONS ========================================================================================
16
+ */
17
+
18
+ /**
19
+ * --- TRIGGERED ON ACTIVATION --------------------------------------------------------------------------
20
+ * --- IF DATABASE VALUES ARE NOT SET AT ALL, ADD DEFAULT OPTIONS TO DATABASE ---------------------------
21
+ */
22
+ if (!function_exists('sticky_anthing_default_options')) {
23
+ function sticky_anthing_default_options() {
24
+ $versionNum = '2.0.1';
25
+ if (get_option('sticky_anything_options') === false) {
26
+ $new_options['sa_version'] = $versionNum;
27
+ $new_options['sa_element'] = '';
28
+ $new_options['sa_topspace'] = '';
29
+ $new_options['sa_adminbar'] = true;
30
+ $new_options['sa_minscreenwidth'] = '';
31
+ $new_options['sa_maxscreenwidth'] = '';
32
+ $new_options['sa_zindex'] = '';
33
+ $new_options['sa_legacymode'] = false;
34
+ $new_options['sa_dynamicmode'] = false;
35
+ $new_options['sa_debugmode'] = false;
36
+ $new_options['sa_pushup'] = '';
37
+ add_option('sticky_anything_options',$new_options);
38
+ }
39
+ }
40
+ }
41
+
42
+ /**
43
+ * --- IF DATABASE VALUES EXIST, THEN THIS IS AN UPGRADE, SO CHECK IF NEWER OPTIONS EXIST --------------
44
+ * --- IF NOT, ADD THESE OPTIONS WITH DEFAULT VALUES ---------------------------------------------------
45
+ * --- AND UPDATE VERSION NUMBER FOR SURE --------------------------------------------------------------
46
+ */
47
+ if (!function_exists('sticky_anything_update')) {
48
+ function sticky_anything_update() {
49
+ $versionNum = '2.0.1';
50
+ $existing_options = get_option('sticky_anything_options');
51
+
52
+ if(!isset($existing_options['sa_minscreenwidth'])) {
53
+ // Introduced in version 1.1
54
+ $existing_options['sa_minscreenwidth'] = '';
55
+ $existing_options['sa_maxscreenwidth'] = '';
56
+ }
57
+
58
+ if(!isset($existing_options['sa_dynamicmode'])) {
59
+ // Introduced in version 1.2
60
+ $existing_options['sa_dynamicmode'] = false;
61
+ }
62
+
63
+ if(!isset($existing_options['sa_pushup'])) {
64
+ // Introduced in version 1.3
65
+ $existing_options['sa_pushup'] = '';
66
+ $existing_options['sa_adminbar'] = true;
67
+ }
68
+
69
+ if(!isset($existing_options['sa_legacymode'])) {
70
+ // Introduced in version 2.0
71
+ // Keep the old/legacy mode, since that mode obviously worked before the upgrade.
72
+ $existing_options['sa_legacymode'] = true;
73
+ }
74
+
75
+ $existing_options['sa_version'] = $versionNum;
76
+ update_option('sticky_anything_options',$existing_options);
77
+ }
78
+ }
79
+
80
+
81
+ /**
82
+ * --- LOAD MAIN .JS FILE AND CALL IT WITH PARAMETERS (BASED ON DATABASE VALUES) -----------------------
83
+ */
84
+ if (!function_exists('load_sticky_anything')) {
85
+ function load_sticky_anything() {
86
+
87
+ $options = get_option('sticky_anything_options');
88
+ $versionNum = $options['sa_version'];
89
+
90
+ // Main jQuery plugin file
91
+ if($options['sa_debugmode']==true){
92
+ wp_register_script('stickyAnythingLib', plugins_url('/assets/js/jq-sticky-anything.js', __FILE__), array( 'jquery' ), $versionNum);
93
+ } else {
94
+ wp_register_script('stickyAnythingLib', plugins_url('/assets/js/jq-sticky-anything.min.js', __FILE__), array( 'jquery' ), $versionNum);
95
+ }
96
+ wp_enqueue_script('stickyAnythingLib');
97
+
98
+ // Set defaults for by-default-empty elements (because '' does not work with the JQ plugin)
99
+ if (!$options['sa_topspace']) {
100
+ $options['sa_topspace'] = '0';
101
+ }
102
+
103
+ if (!$options['sa_minscreenwidth']) {
104
+ $options['sa_minscreenwidth'] = '0';
105
+ }
106
+
107
+ if (!$options['sa_maxscreenwidth']) {
108
+ $options['sa_maxscreenwidth'] = '999999';
109
+ }
110
+
111
+ // If empty, set to 1 - not to 0. Also, if set to "0", keep it at 0.
112
+ if (strlen($options['sa_zindex']) == "0") { // LENGTH is 0 (not the actual value)
113
+ $options['sa_zindex'] = '1';
114
+ }
115
+
116
+ $script_vars = array(
117
+ 'element' => $options['sa_element'],
118
+ 'topspace' => $options['sa_topspace'],
119
+ 'minscreenwidth' => $options['sa_minscreenwidth'],
120
+ 'maxscreenwidth' => $options['sa_maxscreenwidth'],
121
+ 'zindex' => $options['sa_zindex'],
122
+ 'legacymode' => $options['sa_legacymode'],
123
+ 'dynamicmode' => $options['sa_dynamicmode'],
124
+ 'debugmode' => $options['sa_debugmode'],
125
+ 'pushup' => $options['sa_pushup'],
126
+ 'adminbar' => $options['sa_adminbar']
127
+ );
128
+
129
+ wp_enqueue_script('stickThis', plugins_url('/assets/js/stickThis.js', __FILE__), array( 'jquery' ), $versionNum, true);
130
+ wp_localize_script( 'stickThis', 'sticky_anything_engage', $script_vars );
131
+
132
+ }
133
+ }
134
+
135
+
136
+ /**
137
+ * --- ADD LINK TO SETTINGS PAGE TO SIDEBAR ------------------------------------------------------------
138
+ */
139
+ if (!function_exists('sticky_anything_menu')) {
140
+ function sticky_anything_menu() {
141
+ add_options_page( 'Sticky Menu (or Anything!) Configuration', 'Sticky Menu (or Anything!)', 'manage_options', 'stickyanythingmenu', 'sticky_anything_config_page' );
142
+ }
143
+ }
144
+
145
+
146
+ /**
147
+ * --- ADD LINK TO SETTINGS PAGE TO PLUGIN ------------------------------------------------------------
148
+ */
149
+ if (!function_exists('sticky_anything_settings_link')) {
150
+ function sticky_anything_settings_link($links) {
151
+ $settings_link = '<a href="options-general.php?page=stickyanythingmenu">Settings</a>';
152
+ array_unshift($links, $settings_link);
153
+ return $links;
154
+ }
155
+ }
156
+
157
+
158
+ /**
159
+ * --- THE WHOLE ADMIN SETTINGS PAGE -------------------------------------------------------------------
160
+ */
161
+ if (!function_exists('sticky_anything_config_page')) {
162
+ function sticky_anything_config_page() {
163
+ // Retrieve plugin configuration options from database
164
+ $sticky_anything_options = get_option( 'sticky_anything_options' );
165
+ ?>
166
+
167
+ <div id="sticky-anything-settings-general" class="wrap">
168
+ <h2><?php _e('Sticky Menu (or Anything!) Settings','Sticky Anything plugin'); ?></h2>
169
+
170
+ <p><?php _e('Pick any element on your page, and it will stick when it reaches the top of the page when you scroll down. Usually handy for navigation menus, but can be used for any (unique) element on your page.','Sticky Anything plugin'); ?></p>
171
+
172
+ <div class="main-content">
173
+
174
+ <?php
175
+ if ( isset( $_GET['tab'] )) {
176
+ $activeTab = $_GET['tab'];
177
+ } else {
178
+ $activeTab = 'main';
179
+ }
180
+ ?>
181
+
182
+ <h2 class="nav-tab-wrapper">
183
+ <a class="nav-tab <?php if ($activeTab == 'main') { echo 'nav-tab-active'; } ?>" href="#main"><?php _e('Basic settings','Sticky Anything plugin'); ?></a>
184
+ <a class="nav-tab <?php if ($activeTab == 'advanced') { echo 'nav-tab-active'; } ?>" href="#advanced"><?php _e('Advanced settings','Sticky Anything plugin'); ?></a>
185
+ <a class="nav-tab <?php if ($activeTab == 'faq') { echo ' nav-tab-active'; } ?>" href="#faq"><?php _e('FAQ/Troubleshooting','Sticky Anything plugin'); ?></a>
186
+ </h2>
187
+
188
+ <br>
189
+
190
+ <?php
191
+
192
+ $warnings = false;
193
+
194
+ if ( isset( $_GET['message'] )) {
195
+ if ($_GET['message'] == '1') {
196
+ echo '<div id="message" class="fade updated"><p><strong>'.__('Settings Updated.','Sticky Anything plugin').'</strong></p></div>';
197
+ }
198
+ }
199
+
200
+ if ( isset( $_GET['message'] )) {
201
+ if ($sticky_anything_options['sa_element'] == '') {
202
+ $warnings = true;
203
+ }
204
+ }
205
+
206
+ if ( (!is_numeric($sticky_anything_options['sa_topspace'])) && ($sticky_anything_options['sa_topspace'] != '')) {
207
+ // Top space is not empty and has bad value
208
+ $warnings = true;
209
+ }
210
+
211
+ if ( (!is_numeric($sticky_anything_options['sa_minscreenwidth'])) && ($sticky_anything_options['sa_minscreenwidth'] != '')) {
212
+ // Minimum width is not empty and has bad value
213
+ $warnings = true;
214
+ }
215
+
216
+ if ( (!is_numeric($sticky_anything_options['sa_maxscreenwidth'])) && ($sticky_anything_options['sa_maxscreenwidth'] != '')) {
217
+ // Maximum width is not empty and has bad value
218
+ $warnings = true;
219
+ }
220
+
221
+ if ( ($sticky_anything_options['sa_minscreenwidth'] != '') && ($sticky_anything_options['sa_maxscreenwidth'] != '') && ( ($sticky_anything_options['sa_minscreenwidth']) >= ($sticky_anything_options['sa_maxscreenwidth']) ) ) {
222
+ // Minimum width is larger than the maximum width
223
+ $warnings = true;
224
+ }
225
+
226
+ if ((!is_numeric($sticky_anything_options['sa_zindex'])) && ($sticky_anything_options['sa_zindex'] != '')) {
227
+ // Z-index is not empty and has bad value
228
+ $warnings = true;
229
+ }
230
+
231
+ // IF THERE ARE ERRORS, SHOW THEM
232
+ if ( $warnings == true ) {
233
+ echo '<div id="message" class="error"><p><strong>'.__('Please review the current settings:','Sticky Anything plugin').'</strong></p>';
234
+ echo '<ul style="list-style-type:disc; margin:0 0 20px 24px;">';
235
+
236
+ if ($sticky_anything_options['sa_element'] == '') {
237
+ echo '<li>'.__('ELEMENT is a required field. If you do not want anything sticky, consider disabling the plugin.','Sticky Anything plugin').'</li>';
238
+ }
239
+
240
+ if ( (!is_numeric($sticky_anything_options['sa_topspace'])) && ($sticky_anything_options['sa_topspace'] != '')) {
241
+ echo '<li>'.__('TOP POSITION has to be a number (do not include "px" or "pixels", or any other characters).','Sticky Anything plugin').'</li>';
242
+ }
243
+
244
+ if ( (!is_numeric($sticky_anything_options['sa_minscreenwidth'])) && ($sticky_anything_options['sa_minscreenwidth'] != '')) {
245
+ echo '<li>'.__('MINIMUM SCREEN WIDTH has to be a number (do not include "px" or "pixels", or any other characters).','Sticky Anything plugin').'</li>';
246
+ }
247
+
248
+ if ( (!is_numeric($sticky_anything_options['sa_maxscreenwidth'])) && ($sticky_anything_options['sa_maxscreenwidth'] != '')) {
249
+ echo '<li>'.__('MAXIMUM SCREEN WIDTH has to be a number (do not include "px" or "pixels", or any other characters).','Sticky Anything plugin').'</li>';
250
+ }
251
+
252
+ if ( ($sticky_anything_options['sa_minscreenwidth'] != '') && ($sticky_anything_options['sa_maxscreenwidth'] != '') && ( ($sticky_anything_options['sa_minscreenwidth']) >= ($sticky_anything_options['sa_maxscreenwidth']) ) ) {
253
+ echo '<li>'.__('MAXIMUM screen width has to have a larger value than the MINIMUM screen width.','Sticky Anything plugin').'</li>';
254
+ }
255
+
256
+ if ((!is_numeric($sticky_anything_options['sa_zindex'])) && ($sticky_anything_options['sa_zindex'] != '')) {
257
+ echo '<li>'.__('Z-INDEX has to be a number (do not include any other characters).','Sticky Anything plugin').'</li>';
258
+ }
259
+
260
+ echo '</ul></div>';
261
+ }
262
+
263
+ ?>
264
+
265
+ <div class="tabs-content">
266
+
267
+ <form method="post" action="admin-post.php">
268
+
269
+ <div class="tab-content tab-sticky-main <?php if ($activeTab != 'main') {echo 'hide';} ?>">
270
+
271
+ <input type="hidden" name="action" value="save_sticky_anything_options" />
272
+ <!-- Adding security through hidden referrer field -->
273
+ <?php wp_nonce_field( 'sticky_anything' ); ?>
274
+
275
+ <table class="form-table">
276
+
277
+ <tr>
278
+ <th scope="row"><?php _e('Sticky Element:','Sticky Anything plugin'); ?> <span class="required">*</span> <a href="#" title="<?php _e('The element that needs to be sticky once you scroll. This can be your menu, or any other element like a sidebar, ad banner, etc. Make sure this is a unique identifier.','Sticky Anything plugin'); ?>" class="help">?</a></th>
279
+ <td>
280
+ <input type="text" id="sa_element" name="sa_element" value="<?php
281
+ if ($sticky_anything_options['sa_element'] != '#NO-ELEMENT') {
282
+ echo esc_html( $sticky_anything_options['sa_element'] );
283
+ }
284
+ ?>"/> <em><?php _e('(choose ONE element, e.g. <strong>#main-navigation</strong>, OR <strong>.main-menu-1</strong>, OR <strong>header nav</strong>, etc.)','Sticky Anything plugin'); ?></em>
285
+ </td>
286
+ </tr>
287
+
288
+
289
+ <tr>
290
+ <th scope="row"><?php _e('Space between top of page and sticky element: (optional)','Sticky Anything plugin'); ?> <a href="#" title="<?php _e('If you don\'t want the element to be sticky at the very top of the page, but a little lower, add the number of pixels that should be between your element and the \'ceiling\' of the page.','Sticky Anything plugin'); ?>" class="help">?</a></th>
291
+ <td>
292
+ <input type="number" id="sa_topspace" name="sa_topspace" value="<?php echo esc_html( $sticky_anything_options['sa_topspace'] ); ?>" style="width:80px;" /> pixels
293
+ </td>
294
+ </tr>
295
+
296
+ <tr>
297
+ <th scope="row"><?php _e('Check for Admin Toolbar:','Sticky Anything plugin'); ?> <a href="#" title="<?php _e('If the sticky element gets obscured by the Administrator Toolbar for logged in users (or vice versa), check this box.','Sticky Anything plugin'); ?>" class="help">?</a></th>
298
+ <td>
299
+ <input type="checkbox" id="sa_adminbar" name="sa_adminbar" <?php if ($sticky_anything_options['sa_adminbar'] ) echo ' checked="checked" ';?> />
300
+ <label for="sa_adminbar"><strong><?php _e('Move the sticky element down a little if there is an Administrator Toolbar at the top (for logged in users).','Sticky Anything plugin'); ?></strong></label>
301
+ </td>
302
+ </tr>
303
+
304
+ <tr>
305
+ <th scope="row"><?php _e('Do not stick element when screen smaller than: (optional)','Sticky Anything plugin'); ?> <a href="#" title="<?php _e('Sometimes you do not want your element to be sticky when your screen is small (responsive menus, etc). If you enter a value here, your menu will not be sticky when your screen width is smaller than his value.','Sticky Anything plugin'); ?>" class="help">?</a></th>
306
+ <td>
307
+ <input type="number" id="sa_minscreenwidth" name="sa_minscreenwidth" value="<?php echo esc_html( $sticky_anything_options['sa_minscreenwidth'] ); ?>" style="width:80px;" /> pixels
308
+ </td>
309
+ </tr>
310
+
311
+ <tr>
312
+ <th scope="row"><?php _e('Do not stick element when screen larger than: (optional)','Sticky Anything plugin'); ?> <a href="#" title="<?php _e('Sometimes you do not want your element to be sticky when your screen is large (responsive menus, etc). If you enter a value here, your menu will not be sticky when your screen width is wider than this value.','Sticky Anything plugin'); ?>" class="help">?</a></th>
313
+ <td>
314
+ <input type="number" id="sa_maxscreenwidth" name="sa_maxscreenwidth" value="<?php echo esc_html( $sticky_anything_options['sa_maxscreenwidth'] ); ?>" style="width:80px;" /> pixels
315
+ </td>
316
+ </tr>
317
+
318
+ </table>
319
+
320
+ </div>
321
+
322
+ <div class="tab-content tab-sticky-advanced <?php if ($activeTab != 'advanced') {echo 'hide';}?>">
323
+
324
+ <input type="hidden" name="action" value="save_sticky_anything_options" />
325
+ <!-- Adding security through hidden referrer field -->
326
+ <?php wp_nonce_field( 'sticky_anything' ); ?>
327
+
328
+ <table class="form-table">
329
+
330
+ <tr>
331
+ <th scope="row"><?php _e('Z-index: (optional)','Sticky Anything plugin'); ?> <a href="#" title="<?php _e('If there are other elements on the page that obscure/overlap the sticky element, adding a Z-index might help. If you have no idea what that means, try entering 99999.','Sticky Anything plugin'); ?>" class="help">?</a></th>
332
+ <td>
333
+ <input type="number" id="sa_zindex" name="sa_zindex" value="<?php echo esc_html( $sticky_anything_options['sa_zindex'] ); ?>" style="width:80px;" />
334
+ </td>
335
+ </tr>
336
+
337
+ <tr>
338
+ <th scope="row"><?php _e('Push-up element (optional):','Sticky Anything plugin'); ?> <a href="#" title="<?php _e('If you want your sticky element to be \'pushed up\' again by another element lower on the page, enter it here. Make sure this is a unique identifier.','Sticky Anything plugin'); ?>" class="help">?</a></th>
339
+ <td>
340
+ <input type="text" id="sa_pushup" name="sa_pushup" value="<?php
341
+ if ($sticky_anything_options['sa_pushup'] != '#NO-ELEMENT') {
342
+ echo esc_html( $sticky_anything_options['sa_pushup'] );
343
+ }
344
+ ?>"/> <em><?php _e('(choose ONE element, e.g. <strong>#footer</strong>, OR <strong>.widget-bottom</strong>, etc.)','Sticky Anything plugin'); ?></em>
345
+ </td>
346
+ </tr>
347
+
348
+ <tr>
349
+ <th scope="row"><span class="new"><?php _e('NEW!','Sticky Anything plugin'); ?></span> <?php _e('Legacy mode:','Sticky Anything plugin'); ?> <a href="#" title="<?php _e('If you upgraded from an earlier version and it always worked before, use legacy mode to keep using the old method.','Sticky Anything plugin'); ?>" class="help">?</a></th>
350
+ <td>
351
+ <input type="checkbox" id="sa_legacymode" name="sa_legacymode" <?php if ($sticky_anything_options['sa_legacymode'] == true ) echo ' checked="checked" ';?> />
352
+ <label for="sa_legacymode"><strong><?php _e('Legacy Mode (only recommended if you upgraded from earlier version).','Sticky Anything plugin'); ?></strong></label>
353
+ <p class="description"><?php _e('In version 2.0, a new/better method for making elements sticky was introduced. However, if you upgraded this plugin from an earlier version, and the old method always worked for you, there is no need to use the new method and you should keep this option checked.<br>More information about this setting can be found in the <a href="#faq" class="faq">FAQ</a>.','Sticky Anything plugin'); ?></p>
354
+ </td>
355
+ </tr>
356
+
357
+ <tr id="row-dynamic-mode" <?php if ($sticky_anything_options['sa_legacymode'] == false ) echo 'class="disabled-feature"';?>>
358
+ <th scope="row"><div class="showhide" <?php if ($sticky_anything_options['sa_legacymode'] == false ) echo 'style="display:none;"';?>><?php _e('Dynamic mode:','Sticky Anything plugin'); ?> <a href="#" title="<?php _e('When Dynamic Mode is OFF, a cloned element will be created upon page load. If this mode is ON, a cloned element will be created every time your scrolled position hits the \'sticky\' point (option available in Legacy Mode only).','Sticky Anything plugin'); ?>" class="help">?</a></div></th>
359
+ <td><div class="showhide" <?php if ($sticky_anything_options['sa_legacymode'] == false ) echo 'style="display:none;"';?>>
360
+ <input type="checkbox" id="sa_dynamicmode" name="sa_dynamicmode" <?php if ($sticky_anything_options['sa_dynamicmode'] ) echo ' checked="checked" ';?> />
361
+ <label for="sa_dynamicmode"><strong><?php _e('If the plugin doesn\'t work in your theme (often the case with responsive themes), try it in Dynamic Mode.','Sticky Anything plugin'); ?></strong></label>
362
+ <p class="description"><?php _e('NOTE: this is not a \'Magic Checkbox\' that fixes all problems. It simply solves some issues that frequently appear with some responsive themes, but doesn\'t necessarily work in ALL situations.','Sticky Anything plugin'); ?></p>
363
+ </div>
364
+ </td>
365
+ </tr>
366
+
367
+ <tr>
368
+ <th scope="row"><?php _e('Debug mode:','Sticky Anything plugin'); ?> <a href="#" title="<?php _e('When Debug Mode is on, error messages will be shown in your browser\'s console when the element you selected either doesn\'t exist, or when there are more elements on the page with your chosen selector.','Sticky Anything plugin'); ?>" class="help">?</a></th>
369
+ <td>
370
+ <input type="checkbox" id="sa_debugmode" name="sa_debugmode" <?php if ($sticky_anything_options['sa_debugmode'] ) echo ' checked="checked" ';?> />
371
+ <label for="sa_debugmode"><strong><?php _e('Log plugin errors in browser console','Sticky Anything plugin'); ?></strong></label>
372
+ <p class="description"><?php _e('This will help debugging the plugin in case of problems. Do NOT check this option in production environments.','Sticky Anything plugin'); ?></p>
373
+ </td>
374
+ </tr>
375
+
376
+ </table>
377
+
378
+ </div>
379
+
380
+ <div class="tab-content tab-sticky-main tab-sticky-advanced <?php if (($activeTab != 'main') && ($activeTab != 'advanced')) {echo 'hide';} ?>">
381
+
382
+ <input type="hidden" name="sa_tab" value="<?php echo $activeTab ?>">
383
+
384
+ &nbsp;<br><input type="submit" value="<?php _e('SAVE SETTINGS','Sticky Anything plugin'); ?>" class="button-primary"/>
385
+
386
+ </div>
387
+
388
+ </form>
389
+
390
+ <div class="tab-content tab-sticky-faq <?php if ($activeTab != 'faq') {echo 'hide';} ?>">
391
+ <?php include 'assets/faq.php'; ?>
392
+ </div>
393
+
394
+ </div>
395
+
396
+ </div>
397
+
398
+ <div class="main-sidebar">
399
+ <?php include 'assets/plugin-info.php'; ?>
400
+ </div>
401
+
402
+ </div>
403
+
404
+ <?php
405
+ }
406
+ }
407
+
408
+
409
+ if (!function_exists('sticky_anything_admin_init')) {
410
+ function sticky_anything_admin_init() {
411
+ add_action( 'admin_post_save_sticky_anything_options', 'process_sticky_anything_options' );
412
+ }
413
+ }
414
+
415
+ /**
416
+ * --- PROCESS THE SETTINGS FORM AFTER SUBMITTING ------------------------------------------------------
417
+ */
418
+ if (!function_exists('process_sticky_anything_options')) {
419
+ function process_sticky_anything_options() {
420
+
421
+ if ( !current_user_can( 'manage_options' ))
422
+ wp_die( 'Not allowed');
423
+
424
+ check_admin_referer('sticky_anything');
425
+ $options = get_option('sticky_anything_options');
426
+
427
+ foreach ( array('sa_element') as $option_name ) {
428
+ if ( isset( $_POST[$option_name] ) ) {
429
+ $options[$option_name] = sanitize_text_field( $_POST[$option_name] );
430
+ }
431
+ }
432
+
433
+ foreach ( array('sa_topspace') as $option_name ) {
434
+ if ( isset( $_POST[$option_name] ) ) {
435
+ $options[$option_name] = sanitize_text_field( $_POST[$option_name] );
436
+ }
437
+ }
438
+
439
+ foreach ( array('sa_minscreenwidth') as $option_name ) {
440
+ if ( isset( $_POST[$option_name] ) ) {
441
+ $options[$option_name] = sanitize_text_field( $_POST[$option_name] );
442
+ }
443
+ }
444
+
445
+ foreach ( array('sa_maxscreenwidth') as $option_name ) {
446
+ if ( isset( $_POST[$option_name] ) ) {
447
+ $options[$option_name] = sanitize_text_field( $_POST[$option_name] );
448
+ }
449
+ }
450
+
451
+ foreach ( array('sa_zindex') as $option_name ) {
452
+ if ( isset( $_POST[$option_name] ) ) {
453
+ $options[$option_name] = sanitize_text_field( $_POST[$option_name] );
454
+ }
455
+ }
456
+
457
+ foreach ( array('sa_pushup') as $option_name ) {
458
+ if ( isset( $_POST[$option_name] ) ) {
459
+ $options[$option_name] = sanitize_text_field( $_POST[$option_name] );
460
+ }
461
+ }
462
+
463
+ foreach ( array('sa_adminbar') as $option_name ) {
464
+ if ( isset( $_POST[$option_name] ) ) {
465
+ $options[$option_name] = true;
466
+ } else {
467
+ $options[$option_name] = false;
468
+ }
469
+ }
470
+
471
+ foreach ( array('sa_legacymode') as $option_name ) {
472
+ if ( isset( $_POST[$option_name] ) ) {
473
+ $options[$option_name] = true;
474
+ } else {
475
+ $options[$option_name] = false;
476
+ }
477
+ }
478
+
479
+ foreach ( array('sa_dynamicmode') as $option_name ) {
480
+ if ( isset( $_POST[$option_name] ) ) {
481
+ $options[$option_name] = true;
482
+ } else {
483
+ $options[$option_name] = false;
484
+ }
485
+ }
486
+
487
+ foreach ( array('sa_debugmode') as $option_name ) {
488
+ if ( isset( $_POST[$option_name] ) ) {
489
+ $options[$option_name] = true;
490
+ } else {
491
+ $options[$option_name] = false;
492
+ }
493
+ }
494
+
495
+ foreach ( array('sa_tab') as $option_name ) {
496
+ if ( isset( $_POST[$option_name] ) ) {
497
+ $options[$option_name] = sanitize_text_field( $_POST[$option_name] );
498
+ }
499
+ }
500
+
501
+ $tabValue = $_POST['sa_tab'];
502
+
503
+ update_option( 'sticky_anything_options', $options );
504
+ wp_redirect( add_query_arg(
505
+ array('page' => 'stickyanythingmenu', 'message' => '1', 'tab' => $tabValue),
506
+ admin_url( 'options-general.php' )
507
+ )
508
+ );
509
+
510
+ exit;
511
+ }
512
+ }
513
+
514
+
515
+ /**
516
+ * --- ADD THE .CSS AND .JS TO ADMIN MENU --------------------------------------------------------------
517
+ */
518
+ if (!function_exists('sticky_anything_styles')) {
519
+ function sticky_anything_styles($hook) {
520
+ if ($hook != 'settings_page_stickyanythingmenu') {
521
+ return;
522
+ }
523
+
524
+ wp_register_script('stickyAnythingAdminScript', plugins_url('/assets/js/sticky-anything-admin.js', __FILE__), array( 'jquery' ), '2.0.1');
525
+ wp_enqueue_script('stickyAnythingAdminScript');
526
+
527
+ wp_register_style('stickyAnythingAdminStyle', plugins_url('/assets/css/sticky-anything-admin.css', __FILE__) );
528
+ wp_enqueue_style('stickyAnythingAdminStyle');
529
+ }
530
+ }
531
+
532
+
533
+ /**
534
+ * === HOOKS AND ACTIONS AND FILTERS AND SUCH ==========================================================
535
+ */
536
+
537
+ $plugin = plugin_basename(__FILE__);
538
+
539
+ register_activation_hook( __FILE__, 'sticky_anthing_default_options' );
540
+ add_action('init','sticky_anything_update',1);
541
+ add_action('wp_enqueue_scripts', 'load_sticky_anything');
542
+ add_action('admin_menu', 'sticky_anything_menu');
543
+ add_action('admin_init', 'sticky_anything_admin_init' );
544
+ add_action('admin_enqueue_scripts', 'sticky_anything_styles' );
545
+ add_filter("plugin_action_links_$plugin", 'sticky_anything_settings_link' );
uninstall.php CHANGED
@@ -1,7 +1,7 @@
1
- <?php
2
- if ( !defined( 'WP_UNINSTALL_PLUGIN' ) )
3
- exit;
4
- if ( get_option( 'sticky_anything_options' ) != false ) {
5
- delete_option( 'sticky_anything_options' );
6
- }
7
- ?>
1
+ <?php
2
+ if ( !defined( 'WP_UNINSTALL_PLUGIN' ) )
3
+ exit;
4
+ if ( get_option( 'sticky_anything_options' ) != false ) {
5
+ delete_option( 'sticky_anything_options' );
6
+ }
7
+ ?>