Browse Source

AltoFocus: Adds a theme name prefix to javascript variables names

Allan Cole 7 years ago
parent
commit
17e3f588bd
3 changed files with 8 additions and 8 deletions
  1. 3 3
      altofocus/assets/js/navigation.js
  2. 3 3
      altofocus/assets/js/scripts.js
  3. 2 2
      altofocus/functions.php

+ 3 - 3
altofocus/assets/js/navigation.js

@@ -5,7 +5,7 @@
  * navigation support for dropdown menus.
  * navigation support for dropdown menus.
  */
  */
 
 
-/* global screenReaderText */
+/* global altoFocusScreenReaderText */
 ( function( $ ) {
 ( function( $ ) {
 
 
 	var body,
 	var body,
@@ -30,7 +30,7 @@
 				'aria-expanded': false
 				'aria-expanded': false
 			} ).append( $( '<span />', {
 			} ).append( $( '<span />', {
 				'class': 'screen-reader-text',
 				'class': 'screen-reader-text',
-				text: screenReaderText.expand
+				text: altoFocusScreenReaderText.expand
 			})).append( '<span class="meta-nav" aria-hidden="true"><svg class="dropdown-icon dropdown-icon-open" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10"><polyline class="line" points="2.5,3.8 5,6.2 7.5,3.8 "/></svg><svg class="dropdown-icon dropdown-icon-close" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10"><line class="line" x1="2.5" y1="7.5" x2="7.5" y2="2.5"/><line class="line" x1="2.5" y1="2.5" x2="7.5" y2="7.5"/></svg></span>' );
 			})).append( '<span class="meta-nav" aria-hidden="true"><svg class="dropdown-icon dropdown-icon-open" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10"><polyline class="line" points="2.5,3.8 5,6.2 7.5,3.8 "/></svg><svg class="dropdown-icon dropdown-icon-close" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10"><line class="line" x1="2.5" y1="7.5" x2="7.5" y2="2.5"/><line class="line" x1="2.5" y1="2.5" x2="7.5" y2="7.5"/></svg></span>' );
 
 
 		container.find( '.menu-item-has-children > a' ).after( dropdownToggle );
 		container.find( '.menu-item-has-children > a' ).after( dropdownToggle );
@@ -65,7 +65,7 @@
 			// jscs:enable
 			// jscs:enable
 
 
 			// Update screen reader text
 			// Update screen reader text
-			screenReaderSpan.text( screenReaderSpan.text() === screenReaderText.expand ? screenReaderText.collapse : screenReaderText.expand );
+			screenReaderSpan.text( altoFocusScreenReaderText.text() === altoFocusScreenReaderText.expand ? altoFocusScreenReaderText.collapse : altoFocusScreenReaderText.expand );
 
 
 		} );
 		} );
 
 

+ 3 - 3
altofocus/assets/js/scripts.js

@@ -4,7 +4,7 @@
  * @package Altofocus
  * @package Altofocus
  */
  */
 
 
-/* global flexSliderText */
+/* global altoFocusFlexSliderText */
 ( function( $ ) {
 ( function( $ ) {
 
 
 	/**
 	/**
@@ -93,8 +93,8 @@
 			smoothHeight: true,
 			smoothHeight: true,
 			slideshow:    false,
 			slideshow:    false,
 			rtl:          $text_direction,
 			rtl:          $text_direction,
-			prevText:     '<span class="screen-reader-text">'+ flexSliderText.previous +'</span> <span class="meta-nav" aria-hidden="true"><svg class="arrow-icon left-arrow-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40"><rect class="rectangle" x="0" y="0" width="40" height="40" /><polyline class="arrow" points="27,6 13,20 27,34" /></svg></span>',
-			nextText:     '<span class="screen-reader-text">'+ flexSliderText.next +'</span> <span class="meta-nav" aria-hidden="true"><svg class="arrow-icon right-arrow-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40"><rect class="rectangle" x="0" y="0" width="40" height="40" /><polyline class="arrow" points="13 34 27 20 13 6" /></svg></span>',
+			prevText:     '<span class="screen-reader-text">'+ altoFocusFlexSliderText.previous +'</span> <span class="meta-nav" aria-hidden="true"><svg class="arrow-icon left-arrow-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40"><rect class="rectangle" x="0" y="0" width="40" height="40" /><polyline class="arrow" points="27,6 13,20 27,34" /></svg></span>',
+			nextText:     '<span class="screen-reader-text">'+ altoFocusFlexSliderText.next +'</span> <span class="meta-nav" aria-hidden="true"><svg class="arrow-icon right-arrow-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40"><rect class="rectangle" x="0" y="0" width="40" height="40" /><polyline class="arrow" points="13 34 27 20 13 6" /></svg></span>',
 		});
 		});
 	}
 	}
 
 

+ 2 - 2
altofocus/functions.php

@@ -257,13 +257,13 @@ function altofocus_scripts() {
 	}
 	}
 
 
 	// Screenreader text
 	// Screenreader text
-	wp_localize_script( 'altofocus-navigation', 'screenReaderText', array(
+	wp_localize_script( 'altofocus-navigation', 'altoFocusScreenReaderText', array(
 		'expand'   => esc_html__( 'expand child menu', 'altofocus' ),
 		'expand'   => esc_html__( 'expand child menu', 'altofocus' ),
 		'collapse' => esc_html__( 'collapse child menu', 'altofocus' ),
 		'collapse' => esc_html__( 'collapse child menu', 'altofocus' ),
 	) );
 	) );
 
 
 	// Flexslider text
 	// Flexslider text
-	wp_localize_script( 'altofocus-flexslider', 'flexSliderText', array(
+	wp_localize_script( 'altofocus-flexslider', 'altoFocusFlexSliderText', array(
 		'next'     => esc_html__( 'Next', 'altofocus' ),
 		'next'     => esc_html__( 'Next', 'altofocus' ),
 		'previous' => esc_html__( 'Previous', 'altofocus' ),
 		'previous' => esc_html__( 'Previous', 'altofocus' ),
 	) );
 	) );