Browse Source

Revert increase font-size feature (#206)

pull/207/head
Carlos Gutiérrez 5 years ago committed by GitHub
parent
commit
646bb05f54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 43
      assets/scripts/routes/common.js
  2. 4
      dist/mix-manifest.json
  3. 3
      dist/scripts/aldine.js
  4. 1
      dist/scripts/catalog-admin.js
  5. 2
      footer.php
  6. 8
      inc/actions/namespace.php
  7. 3
      package.json
  8. 7
      partials/content-accessibility-toolbar.php

43
assets/scripts/routes/common.js

@ -1,5 +1,3 @@
import * as Cookies from 'js-cookie';
export default {
init() {
// JavaScript to be fired on all pages
@ -7,47 +5,6 @@ export default {
document.body.classList.remove( 'no-js' );
document.body.classList.add( 'js' );
// Font Size handler
( function () {
const fontSizeButton = document.querySelector( '.a11y-fontsize' );
if ( Cookies.get( 'a11y-root-larger-fontsize' ) === '1' ) {
document.documentElement.classList.add( 'fontsize' );
fontSizeButton.setAttribute( 'aria-pressed', true );
fontSizeButton.textContent = pressbooksBook.decrease_label;
}
fontSizeButton.onclick = () => {
// Cast the state as a boolean
let pressed = fontSizeButton.getAttribute( 'aria-pressed' ) === 'true' || false;
// Switch the state
fontSizeButton.setAttribute( 'aria-pressed', ! pressed );
if ( ! pressed ) {
document.documentElement.classList.add( 'fontsize' );
fontSizeButton.setAttribute( 'title', pressbooksBook.decrease_label );
fontSizeButton.textContent = pressbooksBook.decrease_label;
document.querySelector( '.nav-reading' ).setAttribute( 'style', '' );
Cookies.set( 'a11y-root-larger-fontsize', '1', {
expires: 365,
path: '/',
} );
return false;
} else {
document.documentElement.classList.remove( 'fontsize' );
fontSizeButton.setAttribute( 'title', pressbooksBook.increase_label );
fontSizeButton.textContent = pressbooksBook.increase_label;
document.querySelector( '.nav-reading' ).setAttribute( 'style', '' );
Cookies.set( 'a11y-root-larger-fontsize', '0', {
expires: 365,
path: '/',
} );
return false;
}
};
} )();
jQuery( $ => {
$( document ).ready( function () {
// Sets a -1 tabindex to ALL sections for .focus()-ing

4
dist/mix-manifest.json vendored

@ -1,9 +1,9 @@
{
"/scripts/aldine.js": "/scripts/aldine.js?id=0daec181529edc419139",
"/scripts/aldine.js": "/scripts/aldine.js?id=406c85ac4a3597cff962",
"/styles/aldine.css": "/styles/aldine.css?id=834982deb17473a14117",
"/styles/editor.css": "/styles/editor.css?id=c45cb52a8c16b5642bf6",
"/scripts/call-to-action.js": "/scripts/call-to-action.js?id=14b2ac09b5fc52660522",
"/scripts/catalog-admin.js": "/scripts/catalog-admin.js?id=0443144fad1bb1b3a12d",
"/scripts/catalog-admin.js": "/scripts/catalog-admin.js?id=cd9e3b3256101628f1d9",
"/scripts/customizer.js": "/scripts/customizer.js?id=379b2c9a57b903659698",
"/scripts/customizer-toggle.js": "/scripts/customizer-toggle.js?id=21056ebdee6d334bd081",
"/scripts/page-section.js": "/scripts/page-section.js?id=b62a3319a10d83a36aea"

3
dist/scripts/aldine.js vendored

File diff suppressed because one or more lines are too long

1
dist/scripts/catalog-admin.js vendored

File diff suppressed because one or more lines are too long

2
footer.php

@ -113,8 +113,6 @@ if ( $pb_network_contact_form ) {
</div><!-- .container -->
</footer><!-- .footer -->
<?php get_template_part( 'partials/content', 'accessibility-toolbar' ); ?>
</div> <!-- .site -->
<?php wp_footer(); ?>

8
inc/actions/namespace.php

@ -145,14 +145,6 @@ function enqueue_assets() {
wp_enqueue_style( 'aldine/style', $assets->getPath( 'styles/aldine.css' ), false, null );
wp_enqueue_style( 'aldine/webfonts', 'https://fonts.googleapis.com/css?family=Karla:400,400i,700|Spectral:400,400i,600', false, null );
wp_enqueue_script( 'aldine/script', $assets->getPath( 'scripts/aldine.js' ), [ 'jquery' ], null, true );
wp_localize_script(
'aldine/script',
'PB_A11y',
[
'increase_label' => __( 'Increase Font Size', 'pressbooks-aldine' ),
'decrease_label' => __( 'Decrease Font Size', 'pressbooks-aldine' ),
]
);
}
/**

3
package.json

@ -63,7 +63,6 @@
"dependencies": {
"aetna": "^1.0.0-alpha.26",
"isotope-layout": "^3.0.6",
"jquery-bridget": "^2.0.1",
"js-cookie": "^2.2.1"
"jquery-bridget": "^2.0.1"
}
}

7
partials/content-accessibility-toolbar.php

@ -1,7 +0,0 @@
<!-- a11y toolbar -->
<div class="a11y-toolbar">
<button class="a11y-fontsize" aria-pressed="false">
<?php _e( 'Increase Font Size', 'pressbooks-aldine' ); ?>
</button>
</div>
<!-- // a11y toolbar -->
Loading…
Cancel
Save