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

New Feature: Add 'Accessibility' button per type #163

Open
wants to merge 1 commit into
base: master
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
12 changes: 12 additions & 0 deletions scripts/h5peditor-library-selector.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ ns.LibrarySelector = function (libraries, defaultLibrary, defaultParams) {
'</span>' +
'</a>'
).hide();
this.$a11yUrl = ns.$(
'<a class="h5p-a11y-url" target="_blank">' +
'<span class="h5p-a11y-url-label">' +
'Accessibility' +
'</span>' +
'</a>'
);
//this.$a11yUrl = ns.$('<a class="h5p-a11y-url" target="_blank"><span class="h5p-a11y-url-label">' + ns.t('core', 'Accessibility') + '</span></a>').hide();

// Create confirm dialog
var changeLibraryDialog = new H5P.ConfirmationDialog({
Expand All @@ -67,8 +75,11 @@ ns.LibrarySelector = function (libraries, defaultLibrary, defaultParams) {
that.currentLibrary = library.uberName;
that.loadSemantics(library.uberName, that.selector.getParams(), that.selector.getMetadata());

let libraryTitle = library.title.replace(/\W+/g, '-').toLowerCase();

that.$tutorialUrl.attr('href', library.tutorialUrl ? library.tutorialUrl : '#').toggle(!!library.tutorialUrl);
that.$exampleUrl.attr('href', library.exampleUrl ? library.exampleUrl : '#').toggle(!!library.exampleUrl);
that.$a11yUrl.attr('href', library.a11yUrl ? library.a11yUrl : 'https://studio.libretexts.org/help/h5p-accessibility/' + libraryTitle);
};

/**
Expand Down Expand Up @@ -144,6 +155,7 @@ ns.LibrarySelector.prototype.appendTo = function ($element) {
this.$selector.appendTo($element);
this.$tutorialUrl.appendTo($element);
this.$exampleUrl.appendTo($element);
this.$a11yUrl.appendTo($element);

if (window.localStorage) {
var $buttons = ns.$(ns.createCopyPasteButtons()).appendTo($element);
Expand Down
1 change: 1 addition & 0 deletions scripts/h5peditor-selector-hub.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ ns.SelectorHub.prototype.getSelectedLibrary = function (next) {
if (contentType) {
selected.tutorialUrl = contentType.tutorial;
selected.exampleUrl = contentType.example;
selected.title = contentType.title;
}

return next(selected);
Expand Down
2 changes: 1 addition & 1 deletion styles/css/application.css

Large diffs are not rendered by default.

17 changes: 15 additions & 2 deletions styles/scss/_tutorial-and-example-links.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ $h5p-tutorial-icon-diameter: 2rem;
}

.h5p-tutorial-url,
.h5p-example-url {
.h5p-example-url,
.h5p-a11y-url {
font-size: 1em;
display: inline-flex;
align-items: center;
Expand Down Expand Up @@ -45,7 +46,8 @@ $h5p-tutorial-icon-diameter: 2rem;
}

.h5p-tutorial-url-label,
.h5p-example-url-label {
.h5p-example-url-label,
.h5p-a11y-url-label {
font-style: italic;
font-weight: bold;
text-decoration: underline;
Expand Down Expand Up @@ -90,3 +92,14 @@ $h5p-tutorial-icon-diameter: 2rem;
color: $h5p-example-url-label-color;
}
}

.h5p-a11y-url {
&:active,
&:hover {
background-color: $h5p-example-icon-color;
}

&::before {
content: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M9.99992 -5.11903e-05C12.3144 -0.000712761 14.5574 0.801194 16.3469 2.26902C18.1363 3.73684 19.3614 5.77976 19.8134 8.04963C20.2654 10.3195 19.9163 12.6759 18.8257 14.7172C17.735 16.7586 15.9702 18.3585 13.8321 19.2445C11.6939 20.1305 9.31469 20.2476 7.09985 19.576C4.88501 18.9043 2.97159 17.4855 1.68566 15.5611C0.399729 13.6368 -0.179144 11.3261 0.0476847 9.02283C0.274514 6.71953 1.29301 4.56615 2.92961 2.92964C3.85681 1.99934 4.95882 1.26158 6.17222 0.758786C7.38563 0.255994 8.68648 -0.0018976 9.99992 -5.11903e-05V-5.11903e-05ZM9.93645 12.0735L8.47974 16.0986C8.44393 16.1994 8.38834 16.2921 8.31623 16.3712C8.24412 16.4503 8.15695 16.5142 8.05982 16.5592C7.91392 16.6276 7.75099 16.6512 7.59169 16.6269C7.43239 16.6026 7.28389 16.5315 7.165 16.4228C7.04612 16.314 6.9622 16.1724 6.92389 16.0158C6.88557 15.8593 6.89459 15.695 6.94979 15.5436L7.96542 12.7311C8.04602 12.5194 8.10969 12.3017 8.15585 12.08C8.19689 11.8549 8.22623 11.6278 8.24374 11.3997C8.2828 10.9879 8.31047 10.5419 8.33163 10.1139C8.35279 9.68582 8.36744 9.27078 8.37883 8.92736C8.39348 8.4993 8.27792 8.47163 7.93449 8.39025L7.86288 8.37397L4.93319 7.82221C4.82782 7.80363 4.72716 7.76445 4.63695 7.70692C4.54674 7.64939 4.46876 7.57463 4.40748 7.48693C4.31643 7.35407 4.26686 7.19718 4.26503 7.03613C4.2632 6.87508 4.30921 6.7171 4.39722 6.58221C4.48523 6.44732 4.61128 6.34158 4.75943 6.27838C4.90757 6.21517 5.07114 6.19735 5.22942 6.22716L8.3772 6.81798C8.50253 6.82938 8.6246 6.84402 8.75318 6.85867C9.14054 6.91175 9.53084 6.94056 9.9218 6.94494C10.4085 6.93543 10.8942 6.89903 11.3769 6.83589C11.5234 6.81961 11.6617 6.80171 11.8001 6.78869L14.7704 6.23205C14.9812 6.18835 15.2006 6.2299 15.3808 6.34761C15.4701 6.40803 15.5465 6.48559 15.6055 6.57578C15.6646 6.66598 15.7052 6.76701 15.7248 6.87302C15.7445 6.97902 15.743 7.08788 15.7202 7.19327C15.6975 7.29866 15.654 7.39848 15.5924 7.48693C15.5319 7.57519 15.4547 7.65066 15.365 7.70903C15.2754 7.7674 15.1751 7.80752 15.0699 7.8271L12.2314 8.36095C12.137 8.38211 12.0523 8.39676 11.9775 8.40815C11.6812 8.45861 11.5348 8.48465 11.5527 8.9062C11.5657 9.21382 11.6031 9.58165 11.6519 9.96577C11.7089 10.4166 11.7838 10.8951 11.8619 11.333C11.9124 11.621 11.9596 11.8522 12.0247 12.0735C12.0898 12.2949 12.1532 12.5211 12.2509 12.7929L13.2454 15.5436C13.3006 15.695 13.3096 15.8593 13.2713 16.0158C13.233 16.1724 13.149 16.314 13.0302 16.4228C12.9113 16.5315 12.7628 16.6026 12.6035 16.6269C12.4442 16.6512 12.2812 16.6276 12.1353 16.5592C12.0382 16.5142 11.951 16.4503 11.8789 16.3712C11.8068 16.2921 11.7512 16.1994 11.7154 16.0986L10.2538 12.0817L10.0911 11.7838L9.92831 12.0735H9.93645ZM9.99992 3.36258C10.3324 3.3623 10.6548 3.47732 10.912 3.68806C11.1692 3.89879 11.3454 4.19219 11.4105 4.51826C11.4756 4.84434 11.4257 5.1829 11.2691 5.47627C11.1126 5.76964 10.8592 5.99966 10.5521 6.12713C10.245 6.2546 9.90317 6.27164 9.58491 6.17533C9.26665 6.07903 8.99163 5.87535 8.80671 5.599C8.62179 5.32265 8.53842 4.99072 8.5708 4.65979C8.60319 4.32886 8.74932 4.01939 8.9843 3.78413C9.11742 3.65035 9.27569 3.54423 9.44999 3.47188C9.6243 3.39953 9.8112 3.36238 9.99992 3.36258V3.36258ZM15.9163 4.08361C14.5492 2.71203 12.7489 1.85694 10.822 1.66408C8.89518 1.47122 6.96106 1.95253 5.34932 3.02597C3.73758 4.0994 2.54797 5.69855 1.98321 7.55085C1.41846 9.40315 1.51352 11.394 2.2522 13.184C2.99088 14.9741 4.32746 16.4526 6.03414 17.3676C7.74083 18.2826 9.712 18.5774 11.6117 18.2018C13.5114 17.8263 15.2221 16.8035 16.4522 15.3079C17.6823 13.8123 18.3557 11.9364 18.3577 9.99995C18.3601 8.90165 18.1457 7.81367 17.7267 6.79841C17.3078 5.78315 16.6925 4.86058 15.9163 4.08361V4.08361Z' fill='%232270B9'/%3E%3C/svg%3E%0A");
}
}