-
Notifications
You must be signed in to change notification settings - Fork 161
Added if statement and replaced jQuery with Vanilla JS #76
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -11,32 +11,26 @@ | |||||
| // Site title and description. | ||||||
| wp.customize( 'blogname', function( value ) { | ||||||
| value.bind( function( to ) { | ||||||
| $( '.site-title a' ).text( to ); | ||||||
| } ); | ||||||
| } ); | ||||||
| document.querySelector( '.site-title a' ).textContent( to ); | ||||||
| }); | ||||||
| }); | ||||||
| wp.customize( 'blogdescription', function( value ) { | ||||||
| value.bind( function( to ) { | ||||||
| $( '.site-description' ).text( to ); | ||||||
| } ); | ||||||
| } ); | ||||||
| document.querySelector( '.site-description' ).textContent( to ); | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| }); | ||||||
| }); | ||||||
|
|
||||||
| // Header text color. | ||||||
| wp.customize( 'header_textcolor', function( value ) { | ||||||
| value.bind( function( to ) { | ||||||
| if ( 'blank' === to ) { | ||||||
| $( '.site-title, .site-description' ).css( { | ||||||
| 'clip': 'rect(1px, 1px, 1px, 1px)', | ||||||
| 'position': 'absolute' | ||||||
| } ); | ||||||
| document.querySelector( '.site-title, .site-description' ).style.clip = 'auto'; | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where we're changing multiple styles at the same time it may be preferrable to use the
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you mean there are multiple
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are multiple statements that start |
||||||
| document.querySelector( '.site-title, .site-description' ).style.position = 'absolute' | ||||||
| } else { | ||||||
| $( '.site-title, .site-description' ).css( { | ||||||
| 'clip': 'auto', | ||||||
| 'position': 'relative' | ||||||
| } ); | ||||||
| $( '.site-title a, .site-description' ).css( { | ||||||
| 'color': to | ||||||
| } ); | ||||||
| document.querySelector( '.site-title, .site-description' ).style.clip = 'auto'; | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There maybe went something wrong with the indent/whitespace there, although it seems weird since it doesn't happen al the time.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Its definitely spaces used instead of tabs |
||||||
| document.querySelector( '.site-title, .site-description' ).style.position = 'relative'; | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Spaces here too |
||||||
| document.querySelector( '.site-title a, .site-description' ).style.color = to ; | ||||||
| } | ||||||
| } ); | ||||||
| } ); | ||||||
| } )( jQuery ); | ||||||
| }); | ||||||
| }); | ||||||
| })( jQuery ); | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now that we've removed the dependency in jQuery we can remove it as a parameter. Alternatively, we can probably remove the closure altogether, which would simplify things further.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was marked resolved... looks like "jQuery" is still here? Also the |
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| <?php | ||
| <?php if( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's often a good idea to use this check in themes and plugin files that are running code that access globals like
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agree this is unnecessary here but doesn't hurt either. What does hurt is my OCD because it's before the file comment :p
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
💯 |
||
| /** | ||
| * The template for displaying all single posts | ||
| * | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is invalid since
textContentis not a function.