Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feedback and Accessibility statement redirection #7

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dist/accessibility.min.js

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions site/script/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ var options = {
icon: {
circular: true,
img: 'accessibility'
},
statement : {
url: ''
},
feedback : {
url: ''
}
}

Expand Down
79 changes: 74 additions & 5 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ let _options = {
]
}
},
statement: {
url: ''
},
feedback: {
url: ''
},
buttons: {
font: { size: 18, units: 'px' }
},
Expand Down Expand Up @@ -102,7 +108,10 @@ let _options = {
readingGuide: 'reading guide',
underlineLinks: 'underline links',
textToSpeech: 'text to speech',
speechToText: 'speech to text'
speechToText: 'speech to text',
accessibilityStatement: 'Accessibility Statement',
feedback: 'Send Feedback',

},
textToSpeechLang: 'en-US',
speechToTextLang: 'en-US',
Expand All @@ -122,7 +131,7 @@ let _options = {
readingGuide: true,
underlineLinks: true,
textToSpeech: true,
speechToText: true
speechToText: true,
},
session: {
persistent: true
Expand Down Expand Up @@ -423,9 +432,22 @@ export class Accessibility {
color: rgba(0,0,0,.8);
background-color: #eaeaea;
}
._access-menu ul li.not-supported {
._access-menu ul li .not-supported {
display: none;
}
._access-footer {
padding: 13px;
display: flex;
justify-content: space-between;
font-size: 15px !important;
line-height: initial !important;
word-spacing: initial !important;
letter-spacing: initial !important;
text-align: center;
}
._access-footer a {
margin: auto;
}
._access-menu ul li:before {
content: ' ';
${!this.options.icon.useEmojis ? 'font-family: ' + common.getFixedPseudoFont(this.options.icon.fontFamily) + ';' : ''}
Expand Down Expand Up @@ -735,10 +757,58 @@ export class Accessibility {
]
}
]
}
},
]
});

//only append statement link and feedback link if they are passed from the backend
if(this.options.feedback.url != '' || this.options.statement.url != '') {

let linksDiv = common.jsonToHtml(
{
type: 'div',
attrs: {
class: '_access-footer'
}
}
)
if(this.options.feedback.url != '') {
let feedbackLink = common.jsonToHtml({
type: 'a',
attrs: {
'href': this.options.feedback.url,
'target': '_blank',
'id': 'feedback-link'
},
children: [
{
type: '#text',
text: this.options.labels.feedback
}
]
})
linksDiv.appendChild(feedbackLink);
}
if(this.options.statement.url != '') {
let statementLink = common.jsonToHtml({
type: 'a',
attrs: {
'href': this.options.statement.url,
'target': '_blank',
'id': 'statement-link'
},
children: [
{
type: '#text',
text: this.options.labels.accessibilityStatement
}
]
})
linksDiv.appendChild(statementLink);
}
menuElem.appendChild(linksDiv);
}

for (let i in this.options.icon.position) {
menuElem.classList.add(i);
}
Expand Down Expand Up @@ -843,7 +913,6 @@ export class Accessibility {
factor *= -1;
if (this.options.textPixelMode) {
let all = document.querySelectorAll('*:not(._access)');

for (let i = 0; i < all.length; i++) {
let fSize = getComputedStyle(all[i]).fontSize;
if (fSize && (fSize.indexOf('px') > -1)) {
Expand Down