Skip to content

Commit

Permalink
Lint check for version 0.1.1.
Browse files Browse the repository at this point in the history
  • Loading branch information
mateuswetah committed Sep 26, 2022
1 parent f3c9d9f commit 7f64427
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 24 deletions.
3 changes: 1 addition & 2 deletions blocks/a11y-button/save.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ export default function Save( { attributes, className } ) {
}

return (
<li
{ ...blockProps }>
<li { ...blockProps }>
{ attributes.action === 'skip-to-content' ? (
<a
href={ attributes.link }
Expand Down
2 changes: 1 addition & 1 deletion build/frontend/frontend.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array(), 'version' => '8ed04bd2e9a8266e99de');
<?php return array('dependencies' => array(), 'version' => '65a0f97b27bca61a44a2');
2 changes: 1 addition & 1 deletion build/frontend/frontend.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 17 additions & 14 deletions frontend/frontend.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function updateFontSize( action = 'increase', setValue ) {
* elements based on our high contrast stylesheet.
*/
function toggleHighContrast() {
loadFile('frontend/high-contrast.css', 'css');
loadFile( 'frontend/high-contrast.css', 'css' );

const htmlElement = document.getElementsByTagName( 'html' )[ 0 ];
const isContrastModeEnabled = htmlElement.classList.toggle(
Expand Down Expand Up @@ -137,22 +137,25 @@ function addActionsToButtons() {
}
}

function loadFile(path, type) {
const pluginPath = a11yButtonSettings['pluginBuildPath'];
function loadFile( path, type ) {
const pluginPath = window.a11ButtonSettings
? window.a11yButtonSettings.pluginBuildPath
: '';
path = pluginPath + path;

if (type == "js") {
var fileref = document.createElement("script");
fileref.setAttribute("type", "text/javascript");
fileref.setAttribute("src", path);
} else if (type == "css") {
var fileref = document.createElement("link");
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", path);
if ( type === 'js' ) {
const fileref = document.createElement( 'script' );
fileref.setAttribute( 'type', 'text/javascript' );
fileref.setAttribute( 'src', path );
document.getElementsByTagName( 'head' )[ 0 ].appendChild( fileref );
} else if ( type === 'css' ) {
const fileref = document.createElement( 'link' );
fileref.setAttribute( 'rel', 'stylesheet' );
fileref.setAttribute( 'type', 'text/css' );
fileref.setAttribute( 'href', path );
document.getElementsByTagName( 'head' )[ 0 ].appendChild( fileref );
}
document.getElementsByTagName("head")[0].appendChild(fileref);
}
}

/*
* Waiting the page to be loaded to initialize things
Expand Down
2 changes: 1 addition & 1 deletion frontend/high-contrast.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/* This file holds the styling made by the plugin
* on the site css for some states.
*/
.a11y-buttons-high-contrast-mode {
.a11y-buttons-high-contrast-mode {

*,
*.has-background,
Expand Down
28 changes: 23 additions & 5 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,28 @@ const path = require( 'path' );
const config = require( '@wordpress/scripts/config/webpack.config.js' );

config.entry = {
'a11y-buttons/index': path.resolve( process.cwd(), 'blocks', 'a11y-buttons', 'index.js' ),
'a11y-button/index': path.resolve( process.cwd(), 'blocks', 'a11y-button', 'index.js' ),
'frontend/frontend': path.resolve( process.cwd(), 'frontend', 'frontend.js' ),
'frontend/high-contrast': path.resolve( process.cwd(), 'frontend', 'high-contrast.scss' )
'a11y-buttons/index': path.resolve(
process.cwd(),
'blocks',
'a11y-buttons',
'index.js'
),
'a11y-button/index': path.resolve(
process.cwd(),
'blocks',
'a11y-button',
'index.js'
),
'frontend/frontend': path.resolve(
process.cwd(),
'frontend',
'frontend.js'
),
'frontend/high-contrast': path.resolve(
process.cwd(),
'frontend',
'high-contrast.scss'
),
};

module.exports = config;
module.exports = config;

0 comments on commit 7f64427

Please sign in to comment.