Commit Graph

11 Commits

Author SHA1 Message Date
Stephen Kraus
c331ceae99
Add new structured content styling options (#2203)
Allow for arbitrary string assignment to the font-size property.
https://developer.mozilla.org/en-US/docs/Web/CSS/font-size

Add support for the text-align property.
https://developer.mozilla.org/en-US/docs/Web/CSS/text-align

Co-authored-by: stephenmk <stephenmk@users.noreply.github.com>
2022-08-14 13:30:25 -04:00
toasted-nutbread
fd75e91e75
Ignore DOMExceptions thrown by assigning an invalid dataset property (#2133) 2022-05-14 18:16:13 -04:00
toasted-nutbread
5dcc2315d2
Structured content auto language (#2131)
* Pass JapaneseUtil instance to StructuredContentGenerator

* Move body of createStructuredContent to an internal function

* Create _createStructuredContentGenericElement

* Wrap structured content in a <span>

* Change _createStructuredContent to _appendStructuredContent

* Add public appendStructuredContent function

* Add missing return

* Remove unused _createDocumentFragment

* Automatically assign lang=ja for content with Japanese characters
without an explicit language

* Add test
2022-05-14 18:12:57 -04:00
Stephen Kraus
6a74746113
Add new structured content features: lists and the HTML lang attribute (#2129)
* Add support for structured content lists and `list-style-type` style

A full list of supported style types is documented here:
https://developer.mozilla.org/en-US/docs/Web/CSS/list-style-type

There's nothing in this code preventing a term bank from assigning,
for example, a `list-style-type` style to a `div` element, but it
doesn't seem like browsers will complain about things like that.

* Add support for `lang` attribute in structured content

Support added for the following node types:

"ruby", "rt", "rp", "table", "thead", "tbody", "tfoot", "tr", "td",
"th", "span", "div", "ol", "ul", "li", "a"

I couldn't get it to work for the alt-hover text on "img" tags.

Tests are included in the file
"test/data/dictionaries/valid-dictionary/term_bank_1.json"

* Add styles for structured content lists

* Add override rules for new structured-content list styles

see: https://github.com/FooSoft/yomichan/pull/2129

Co-authored-by: stephenmk <stephenmk@users.noreply.github.com>
2022-05-14 09:59:38 -04:00
toasted-nutbread
7a2ab86609
Structured content links (#2089)
* Update CSS to JSON converter to generalize the remove-property comment

* Fix navigation not being updated when _clearContent is run

* Add structured content schema for link tags

* Add test links

* Add external-link icon

* Pass Display instance to DisplayContentManager

* Update structured content generation

* Update link styles
2022-03-17 19:01:59 -04:00
toasted-nutbread
4e15f92329
Rename MediaLoader to DisplayContentManager (#2087) 2022-03-14 21:42:33 -04:00
toasted-nutbread
89ac85afd0
Update copyright date (#2062)
* Update eslint settings

* Update 2021 files

* Update other files
2022-02-02 20:43:10 -05:00
toasted-nutbread
f68ad1f843
Structured content data (#1930)
* Add support for structured-content data attributes

* Assign dataset properties

* Don't remove data-sc attributes

* Use helper functions

* Update test data
2021-09-04 12:43:56 -04:00
toasted-nutbread
02194fcb9f
Add support for structured content margins (#1920) 2021-08-31 21:08:30 -04:00
toasted-nutbread
73f06a3fa0
Fix definition image aspect ratio issue (#1847)
* Fix incorrect aspect ratio

* Update test data
2021-07-22 18:11:46 -04:00
toasted-nutbread
fafa746a63
Sandbox script folders (#1837)
* Move scripts

* Update paths

* Fix ordering

* Simplify eslint rules
2021-07-17 17:10:25 -04:00