Commit Graph

23 Commits

Author SHA1 Message Date
Álvaro Velad Galván 3b2f7dba04 Fix(UI): Stop using setAttribute for ARIA (#3489)
* Stop using setAttribute for ARIA
* Remove references to shaka.ui.Constants.ARIA_LABEL
2021-07-07 12:30:32 -07:00
Michelle Zhuo 95ba28b5af refactor: Remove IE 11 support
Issue #2339

Change-Id: I80ffa7b04f7afd943aa0f881d2a494dd35def732
2021-04-29 17:47:07 +00:00
Joey Parrish 562a2d567b chore: Strictly require jsdoc
This enables the eslint rule requiring jsdocs on all class
declarations, function declarations, and methods.

Unfortunately, there are two problems with this:

1. We don't use class _declarations_, we use class _expressions_,
which are not covered by this rule.  So it does not enforce jsdoc at
the class level.
2. We tend to document a class at the class-level, rather than at the
constructor.  But a constructor counts as a method for eslint, so it
requires docs on the constructor.  There is no way to configure it to
make an exception for trivial constructors.

So for all trivial (no-argument) constructors, we add empty jsdocs:
  /** */
  constructor() {

This was quicker and easier than setting up some alternative plugin in
eslint to make an exception for us.

The good news is that this rule caught several undocumented parameters
and places where the jsdoc comment was malformed.  So fixing those
also improves the compiler's ability to enforce types.

Change-Id: Icbc46ed690c94e53d354648a883119524f8fca45
2021-01-09 02:00:31 +00:00
michellezhuo 0a5489cf3e fix(ui): Generate docs for enums in ui
The docs for enums in ui.js were not generated because they were
not in any classes. Moving them to Overlay class.

Fixes #2698

Change-Id: Ib4f4745488aa6593bb377eb2b71b946c2b955ca7
2020-11-18 23:52:54 +00:00
Álvaro Velad Galván 01998f3b99 Parse forced subtitles from manifest (#2938)
Issue #2122
Issue #2916
2020-10-27 14:00:48 -07:00
Joey Parrish c7d0ce93d9 feat(ui): Allow showing track labels in UI
Instead of language, role, or both, it is sometimes useful for an
application to show the "label" field of the corresponding "Track"
object.

Closes #2927

Change-Id: Ifc2fa8137bc73ec704443c6071f102805f70dc3d
2020-10-20 03:36:03 +00:00
Theodore Abshire 67a49d45e3 cleanup: Add missing requires.
This is a port of the internal changes: cl/329816039

Change-Id: If162e80e107ef7dc40956d6f4160d24f6d50858d
2020-09-14 22:50:49 +00:00
Joey Parrish 2d4f36f509 fix: Add missing require statements
Caught by a newer compiler

Change-Id: I27a392b35302cce0817c2e95cd25584df4c2b58d
2020-08-25 16:30:53 -07:00
Joey Parrish f539147d48 fix: Correct license headers in compiled output
This fixes all the license headers in the main library, which corrects
the appearance of the main license in the compiled output.

It seems that the `!` in the header forces the compiler to keep it in
the output.  I believe older compiler releases did this purely based
on `@license`.

Issue #2638

Change-Id: I7f0e918caad10c9af689c9d07672b7fe9be7b2f3
2020-06-09 16:05:09 -07:00
Joey Parrish c1d849bc9b Fix UI button types
The compiler is very picky about the use of the "disabled" property on
HTMLElement, since it is only defined on certain subclasses of that.
This adds a method to create a button with the correct type to satisfy
the compiler.

Issue #2528

Change-Id: I31cacd62a35acc87b245ab362dbab55d791cf34d
2020-04-28 21:40:53 +00:00
michellezhuo ad9e5b9ecd Display check icon when selecting an audio language
The check icon with selected audio language was not showing because
there might be multiple tracks with the same language and role, and we
only add a button with the first track of this [language, role]
combination to the list, which may not be the selected track.

Closes #2353

Change-Id: Ic95c8f42bf185a6edbde6cb4dd83e7640d0bfa3c
2020-01-25 23:39:13 +00:00
Theodore Abshire 9aaedede95 Change UI to show text/audio roles.
Closes #2307

Change-Id: I13ce5d6185f27a4bfa7481eff4fef629520ff0ce
2019-12-20 22:35:03 +00:00
Joey Parrish 64896d70b0 Use shorter license header
This reflects changes in Google's policy on JavaScript license
headers, which should be smaller to avoid increasing the size of the
binary unnecessarily.

This also updates the company name from "Google, Inc" to "Google LLC".

Change-Id: I3f8b9ed3700b6351f43173d50c94d35c333e82b4
2019-11-22 18:18:36 +00:00
Jacob Trimble b4c1be72f3 Fix some missing ES6 conversions in UI.
Issue #1157

Change-Id: Ied0d37222680f4aa88638e7510b7a0e07844aa69
2019-05-21 21:02:00 +00:00
Sandra Lokshina dbb774fa9f Convert ui utils to ES6 and merge duplicate utils.
Both DOM and UI utils had a removeAllChildren method
that did the same thing. This change removes it from
the UI util and replaces all calls to it with calls
to the DOM util.

Issue #1157.

Change-Id: Iaf7998c460c03416d8651e2efd53c96bdcc9a258
2019-05-20 11:08:22 -07:00
Jacob Trimble f130dffcef Enable eslint indentation rule.
This is a fully automated change.  The linter will fail because the
extra indentation caused line-length errors.  These won't be fixed
automatically.  They are fixed in a follow-up to make this one fully
automated.

Change-Id: I4d8cf9c998985add2bcd24a81c8d65495668c4f3
2019-05-13 22:31:09 +00:00
Jacob Trimble 0dd64074b9 Only allow one statement per line.
With the new style rule, we cannot have two statements on the same line.
So we can no longer have an "if" on a single line and we cannot have
an arrow function with a body on the same line as when it is used.
This is mostly a manual change.

Change-Id: I2285202dd5ecbad764308bc725e6d317ff2ee7f0
2019-05-13 22:11:50 +00:00
Jacob Trimble 47daf49f31 Use arrow functions for callbacks.
This is an automated change to convert use of "function" functions
to arrow functions.  This doesn't change all uses of bind() that
could be converted.  This also doesn't remove all "function" functions.

Change-Id: I40ac7d086bcef947a1be083359c8fd1d4499a9c3
2019-05-09 16:40:46 +00:00
Jacob Trimble c81389741f Prefer const over let.
A coming update to the Google eslint config will require using "const"
over "let".  This makes that one change to isolate the big changes.

Change-Id: I7d0974c3ae15c53cc45a6b07bf9f6586e2d34aca
2019-05-08 09:22:10 -07:00
Theodore Abshire efc2ed3df1 Added new demo page.
This is a complete replacement for the old demo page, made to be more
modern-looking and easier to maintain. It contains new features such as
remembering the URIs you provide for custom assets, and searching through
the default assets by feature.
This demo page is not quite ready for release yet, but it's getting close.

Change-Id: Iad01d1fc02c3cd238d73b9b9e02dbb4301cb6f2a
2019-05-01 19:58:18 +00:00
Joey Parrish 00442a9a7c Split up localization data for lazy loading
This changes the format of the localization data to enable apps to
trivially lazy-load translations.  It also adds --locales to the build
scripts to allow app developers to choose the compiled-in locales.
The generated output now goes into dist/ and is not checked into
revision control.  Finally, it adds "description" and "meaning" fields
to the source messages to allow us to more easily integrate with a
context-aware human translation service.  The "description" field
provides application context for the translator, while the "meaning"
field provides linguistic disambiguation for words with multiple
meanings or parts of speech in the original English.

Because the translation service wants to collapse messages with
identical text, we had to merge several messages together.  To this
end, we have removed the prefixes "ARIA_LABEL_" and "LABEL_" from the
messages themselves and collapsed what remained.

Issue #1688

Change-Id: I24c17e71c73f6663cf123cfdba118c486fa80ecc
2019-04-09 16:06:14 -07:00
Sandra Lokshina 493d459c47 Add a DOM util.
Change-Id: Ia0941868f20dbb42fa0fe02a639015ac244a65ed
2019-04-05 12:01:59 -07:00
Sandra Lokshina 4d41b7b90c Refactor the overflow menu to use components design.
Closes #1673.

Change-Id: I030745def928796a6abc813a91fb163cb2d76175
2019-02-21 13:14:28 -08:00