You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Description: For child themes of the <a href="http://genesis-theme-framework.com/">Genesis Theme</a>. Adds a <code>no-js</code> body class to the front-end, and a script on <code>genesis_before</code> which immediately changes the class to <code>js</code> if JavaScript is enabled. This is how WP does things on the back-end, to allow differing styles for elements if JavaScript is active or not.
18
+
* Version: 1.0.1
19
+
* Author: Gary Jones
20
+
* Author URI: http://garyjones.co.uk/
21
+
* License: GPL3
22
+
*/
23
+
24
+
25
+
/**
26
+
* Plugin class for Genesis js / no-js
27
+
*
28
+
* @package GenesisJsNoJs
29
+
*/
30
+
class Genesis_Js_No_Js {
31
+
32
+
/**
33
+
* Holds copy of instance, so other plugins can remove our hooks.
Make front-end styling easier for child themes on the Genesis Framework based on whether JavaScript is enabled or not.
10
+
11
+
== Description ==
12
+
13
+
Make front-end styling easier for child themes on the <a href="http://genesis-theme-framework.com/">Genesis Framework</a> based on whether JavaScript is enabled or not.
14
+
15
+
Adds a `no-js` body class to the front-end, and a script on `genesis_before` which immediately changes the class to `js` if JavaScript is enabled.
16
+
This is how WP does things on the back-end, to allow different styles for the same elements depending if JavaScript is active or not.
17
+
18
+
This plugin is only useful if you're using a child theme of the <a href="http://genesis-theme-framework.com/">Genesis Framework</a> since it needs to use the `genesis_before` hook.
19
+
20
+
== Installation ==
21
+
22
+
1. Unzip and upload `genesis-js-no-js` folder to the `/wp-content/plugins/` directory
23
+
1. Activate the plugin through the 'Plugins' menu in WordPress
24
+
25
+
== Frequently Asked Questions ==
26
+
27
+
= What does this plugin actually do? =
28
+
29
+
If you look at the source of a WordPress back-end page, you'll see it has a body class of `no-js`. Immediately after the opening `body` tag is a small script which replaces `no-js` with `js` (you can see the amended class with Firebug / Inspector).
30
+
31
+
WordPress uses this to apply different styles to the same elements, depending on whether JavaScript is present or not.
32
+
33
+
This plugin recreates the same effect, but for the front-end of <a href="http://genesis-theme-framework.com/">Genesis Framework</a> child themes.
34
+
35
+
= Shouldn't the script be at the end of the page? =
36
+
37
+
Usually, yes, but it's a fairly small script, so does not block rendering of other content for any noticeable length of time.
38
+
39
+
Doing it immediately also reduces a flash of incorrectly styled content, as the page does not load with `no-js` styles, then switch to `js` once everything has finished loading.
40
+
41
+
== Changelog ==
42
+
43
+
= 1.0.1 =
44
+
* Improved plugin so script is hooked in with priority 1 - avoids a theme placing anything before the script (props [Josh Stauffer](http://twitter.com/joshstauffer))
45
+
46
+
= 1.0 =
47
+
* First public version.
48
+
49
+
== Upgrade Notice ==
50
+
51
+
= 1.0.1 =
52
+
Minor change to avoid potential problems with themes hooking in elements before the script.
53
+
54
+
= 1.0 =
55
+
Update from nothingness. You will feel better for it.
0 commit comments