Commit Graph

580 Commits

Author SHA1 Message Date
toasted-nutbread
acfdaa4f48
Fix incorrect static call (#498) 2020-05-02 17:24:05 -04:00
toasted-nutbread
c4ea9321dc
Validate document nodes before use (#493)
* Validate document.body before use in loadScripts

This also fixes an issue where reject wasn't being passed to loadScriptSentinel.

* Validate document nodes before use in _getSiteColor

* Validate document.body before use in _getViewport

* Validate document.body before use in setContentScale

* Validate document.body before use in docImposterCreate
2020-05-02 13:00:46 -04:00
toasted-nutbread
401fe9f8d0
Object property accessor API update (#485)
* Simplify function names

* Add delete and swap functions

* Remove custom setter

Not currently part of the expected use cases.

* Add documentation

* Update tests

* Add delete test functions

* Update tests to use fresh objects

* Add swap test functions

* Add empty tests

* Disable delete on arrays
2020-05-02 12:57:42 -04:00
toasted-nutbread
5a61c311ad
Api invoke with progress (#483)
* Create an internal API function to open a port

* Create system for running actions over a special port

* Don't assign in expression
2020-05-02 12:57:13 -04:00
toasted-nutbread
cae6b657ab
Anki audio download (#477)
* Update how audio is added to Anki cards

* Upgrade Anki templates

* Update comments
2020-05-02 12:50:16 -04:00
toasted-nutbread
08ada6844a
Remove Frontend inheritance (#486)
* Make Frontend use composition instead of inheritance for TextScanner

* Use push instead of concat

* Update setOptions and setEnabled APIs

* Update how onWindowMessage event listener is added/removed

* Rename options to _options

* Use bind instead of arrow function

* Fix selection being cleared due to settings changes
2020-05-02 12:47:15 -04:00
toasted-nutbread
48c7010f4e
Frontend refactor (part 1) (#484)
* Remove _getVisualViewportScale

* Use super's mouse event listener definitions

* Remove redundant override

* Remove getTouchEventListeners override

* Rename Display.onSearchClear to onEscape

* Change onSearchClear to clearSelection and use an event

* Update how text is marked for selection and deselection

* Replace onError with yomichan.logError

* Update setEnabled to refresh all event listeners
2020-04-27 18:10:37 -04:00
toasted-nutbread
5b96559df8
Error logging refactoring (#454)
* Create new logging methods on yomichan object

* Use new yomichan.logError instead of global logError

* Remove old logError

* Handle unhandledrejection events

* Add addEventListener stub

* Update log function

* Update error conversion to support more types

* Add log event

* Add API log function

* Log errors to the backend

* Make error/warning logs update the badge

* Clear log error indicator on extension button click

* Log correct URL on the background page

* Fix incorrect error conversion

* Remove unhandledrejection handling

Firefox doesn't support it properly.

* Remove unused argument type from log function

* Improve function name

* Change console.warn to yomichan.logWarning

* Move log forwarding initialization into main scripts
2020-04-26 16:55:25 -04:00
siikamiika
ca033a87a0
Update Popup and DisplayFloat optionsContext from Frontend (#464)
* set optionsContext from Frontend

* update Popup+Display options on Frontend change

* remove popup setOptions

* only update DisplayFloat options from Frontend

* fix optionsContext usage

* fix preview frame arguments

* keep Frontend URL up to date

* cache url

* fix preview frame

* trigger modifyingProfileChange in correct places

* remove async from function not using await

* refactor optionsContext in Frontend
2020-04-26 22:33:50 +03:00
toasted-nutbread
a49e4ccc4e
Merge pull request #472 from toasted-nutbread/fix-pitch-accent-high-calculation
Fix high pitch calculation
2020-04-23 18:27:11 -04:00
toasted-nutbread
2f931e5585 Fix high pitch calculation 2020-04-22 21:04:18 -04:00
toasted-nutbread
749b747728 Remove sentinel script node after load 2020-04-22 17:48:42 -04:00
toasted-nutbread
d05a5f3c46 Create dynamic script/CSS loader utility 2020-04-21 21:16:26 -04:00
toasted-nutbread
ba68616d80 Change some more variables using 'source' instead of 'content' 2020-04-19 10:57:23 -04:00
toasted-nutbread
7faaf4e457 Use 'content' instead of 'source' to contain media file data 2020-04-19 10:16:59 -04:00
toasted-nutbread
ac603d54a3 Add support for displaying images 2020-04-18 21:32:35 -04:00
toasted-nutbread
fd6ea0e404 Add API for getting media data 2020-04-18 21:32:35 -04:00
toasted-nutbread
03d77cc3a6
Merge pull request #442 from toasted-nutbread/audio-system-refactoring
Audio system refactoring
2020-04-18 21:10:48 -04:00
siikamiika
350a113996 use getFullscreenElement to check fullscreen 2020-04-18 23:28:00 +03:00
toasted-nutbread
320852f2d0 Fix overlapping audio.play calls due to await 2020-04-18 14:23:34 -04:00
toasted-nutbread
fcbfde506a Await and handle errors from audio.play() 2020-04-18 14:23:34 -04:00
toasted-nutbread
92790763d1 Update style 2020-04-18 14:23:34 -04:00
toasted-nutbread
5c2dff345e Fix button title text not updating correctly in merge mode 2020-04-18 14:23:34 -04:00
toasted-nutbread
7eb7c88394 Return index of the source instead of the source value 2020-04-18 14:23:34 -04:00
toasted-nutbread
f50aee1021 Only return the cached value if it uses a valid source 2020-04-18 14:23:34 -04:00
toasted-nutbread
e1ebfb02f7 Disable cache on the backend and fix a bug with the cache key 2020-04-18 14:23:34 -04:00
toasted-nutbread
823c026533 Remove de/structuring from public API 2020-04-18 14:23:34 -04:00
toasted-nutbread
7fc3882607 Update the parameters passed to various audio-related functions 2020-04-18 14:23:34 -04:00
toasted-nutbread
106172e2c1
Merge pull request #447 from toasted-nutbread/util-conversions
Util conversions
2020-04-18 14:12:41 -04:00
siikamiika
8c16a6e580
Merge pull request #456 from siikamiika/parse-text-refactor
Parse text refactor
2020-04-17 01:32:01 +03:00
siikamiika
e6053eefa5
Merge pull request #439 from siikamiika/popup-live-toggle
Popup live toggle
2020-04-17 01:31:25 +03:00
siikamiika
c613321a73 move QueryParser.parseText to Backend 2020-04-13 14:53:24 +03:00
toasted-nutbread
778d49f86b
Merge pull request #443 from toasted-nutbread/fix-get-selection
Fix getSelection not working in QueryParser
2020-04-12 11:42:56 -04:00
toasted-nutbread
51e17b35e3 Convert some util* functions into api* functions 2020-04-11 15:25:19 -04:00
toasted-nutbread
3c48290cd8 Add isExtensionUrl utility function to yomichan object 2020-04-11 15:17:25 -04:00
siikamiika
5c3641eadb simplify frontend disable override 2020-04-11 21:04:30 +03:00
siikamiika
565e3a8c6a change iframe popup live 2020-04-11 21:04:30 +03:00
siikamiika
1df59d57b5 limit popup depth live 2020-04-11 21:01:27 +03:00
toasted-nutbread
82f8397000
Merge pull request #438 from toasted-nutbread/display-generator-refactoring
Display generator refactoring
2020-04-11 11:37:03 -04:00
toasted-nutbread
a864cf094f
Merge pull request #437 from toasted-nutbread/backend-api-handler-changes
Backend api handler changes
2020-04-11 11:32:52 -04:00
toasted-nutbread
a296c758b9 apiBroadcast => apiBroadcastTab 2020-04-10 20:00:18 -04:00
toasted-nutbread
2c5bf0ed6b Fix getSelection not working in QueryParser 2020-04-10 17:11:41 -04:00
4e5029f7ec Update license author field to broader to explicitly reflect that
Yomichan is an ongoing community project. It really does take a village,
and everyone who contributes code owns a part of it :)
2020-04-10 11:10:21 -07:00
toasted-nutbread
025b1f398b Simplify access to details fields in createTermEntry 2020-04-09 22:40:25 -04:00
toasted-nutbread
06183ec124 Update how termTags is passed to _createTermExpression 2020-04-09 22:40:25 -04:00
toasted-nutbread
bb37b74288 Rename "only" to "disambiguation" to match naming convention used for pitch accents 2020-04-09 22:40:25 -04:00
toasted-nutbread
6788bb31d2 Update _appendMultiple to not use a fallback 2020-04-09 22:40:25 -04:00
toasted-nutbread
f9bdf2c66f Organize 2020-04-09 22:40:25 -04:00
toasted-nutbread
9bbe35da68 Mark functions as private 2020-04-09 22:40:25 -04:00
toasted-nutbread
d7e4ff067e Remove statics 2020-04-09 22:40:25 -04:00
toasted-nutbread
75c5c7aabc Remove data-multi assignments 2020-04-09 22:40:25 -04:00
toasted-nutbread
a2b66dc6cc Rename apiForward to apiBroadcast 2020-04-07 19:51:39 -04:00
toasted-nutbread
29cf8d2f79 Fix not awaiting this._getNoteContext 2020-04-06 18:55:45 -04:00
toasted-nutbread
199b926f23 Add overridable getDocumentTitle 2020-04-06 18:20:04 -04:00
toasted-nutbread
4011a091b6 Add support for {document-title} 2020-04-06 18:20:04 -04:00
toasted-nutbread
059db280bb Add custom context object for note creation 2020-04-06 18:20:04 -04:00
toasted-nutbread
8b07a23de9 Rename context to details 2020-04-06 18:20:04 -04:00
siikamiika
22a97d916f fix NOT (a OR B) to NOT (a AND b) 2020-04-05 20:42:23 +03:00
siikamiika
5596a8f6f7 strict object property type check 2020-04-05 20:03:45 +03:00
siikamiika
867902523f simplify promise 2020-04-05 19:57:37 +03:00
siikamiika
123e725049 use duck typing for event listener 2020-04-05 19:57:37 +03:00
siikamiika
067c26982e setTimeout refactoring 2020-04-05 19:57:37 +03:00
siikamiika
c171503d77 use getTemporaryListenerResult in other places 2020-04-05 19:57:37 +03:00
siikamiika
fa65ab3512 refactor getTemporaryListenerResult timeout 2020-04-05 19:57:37 +03:00
siikamiika
d88635cbb2 temporary listener abstraction 2020-04-05 19:57:37 +03:00
toasted-nutbread
1f84280ea0 Include readings in disambiguations 2020-03-29 11:27:13 -04:00
toasted-nutbread
a7da4416d7 Change names 2020-03-29 11:19:43 -04:00
toasted-nutbread
aa2a0c09f4 Update how pitch accent expressions are disambiguated 2020-03-28 14:52:44 -04:00
toasted-nutbread
a339bf69d3 Move set functions into core.js 2020-03-28 14:50:10 -04:00
toasted-nutbread
2c4983da46 Update styles 2020-03-28 12:31:41 -04:00
toasted-nutbread
0d80fcdf86 Move Japanese utility functions out of display-generator.js 2020-03-28 10:47:02 -04:00
toasted-nutbread
cbc7e2646d Add options 2020-03-28 10:25:57 -04:00
toasted-nutbread
803a464fb9 Add support for accent graph 2020-03-28 10:25:57 -04:00
toasted-nutbread
97a520cc15 Add support for displaying pitch accents 2020-03-28 10:25:57 -04:00
toasted-nutbread
2d7214ce60 Add metadata for unique expression count 2020-03-28 10:25:57 -04:00
toasted-nutbread
9e8a22b08a Add support for different sections for term content 2020-03-28 10:25:57 -04:00
toasted-nutbread
168bd72d0a Update _appendMultiple to support general iterables 2020-03-28 10:25:57 -04:00
toasted-nutbread
a0c4ce779d
Merge pull request #413 from toasted-nutbread/japanese-utility
Convert Japanese utilities to a module-like style
2020-03-27 22:53:45 -04:00
siikamiika
b616bac66e remove targetPopupId 'all'
Make unset targetPopupId mean the same thing instead
2020-03-21 22:13:07 +02:00
siikamiika
962c2a381f apply all options on profile change 2020-03-21 22:13:07 +02:00
toasted-nutbread
70284c62ee Replace DisplayGenerator._isCharacterKanji with jp.isCodePointKanji 2020-03-21 13:22:14 -04:00
toasted-nutbread
77a2cc60e9 Move basic string/character testing functions into a mixed/js/japanese.js 2020-03-21 13:18:34 -04:00
toasted-nutbread
4b699a6b46 Change integer state IDs to strings 2020-03-15 12:26:38 -04:00
toasted-nutbread
174a942e07 Fix misuse of getPathString 2020-03-14 13:51:06 -04:00
toasted-nutbread
6865fc0b52 Add ObjectPropertyAccessor 2020-03-14 13:50:36 -04:00
toasted-nutbread
64fc0349a1 Update global declarations 2020-03-10 22:40:35 -04:00
toasted-nutbread
f7bbcb6df4
Merge pull request #408 from toasted-nutbread/use-code-point
Replace charCodeAt and fromCharCode with codePointAt and fromCodePoint
2020-03-10 19:24:24 -04:00
toasted-nutbread
72219ba353 Replace charCodeAt and fromCharCode with codePointAt and fromCodePoint 2020-03-09 21:58:06 -04:00
toasted-nutbread
aad4ab5ecc Rename audio functions using "url" to use "uri" 2020-03-07 21:57:26 -05:00
toasted-nutbread
8f9b6534c6 Move stringReplaceAsync
It is only used in AnkiNoteBuilder and it was originally created
for this purpose.
2020-03-07 21:47:48 -05:00
toasted-nutbread
dceaa85309 Rename audio.js to audio-system.js 2020-03-07 21:43:51 -05:00
toasted-nutbread
6adf2cf63f Rename function 2020-03-07 21:43:51 -05:00
toasted-nutbread
a8eb50d96f Use dependency injection for getAudioUri implementation 2020-03-07 21:43:51 -05:00
toasted-nutbread
75eac153d6 Remove old APIs 2020-03-07 21:42:19 -05:00
toasted-nutbread
e048a1efce Use AudioSystem in Display 2020-03-07 21:42:18 -05:00
toasted-nutbread
110e561eae Create new AudioSystem class 2020-03-07 21:42:18 -05:00
siikamiika
56b2f2c853 trigger yomichanCoreReady only when preparing 2020-03-02 11:31:09 +02:00
siikamiika
bd48d2f919 fix Yomichan core message issues 2020-03-02 10:35:46 +02:00
siikamiika
967e99b7f6 ensure Backend prepare in other places 2020-03-02 04:51:45 +02:00
siikamiika
e6e5f23cf8 fix API calls when Backend isn't ready yet 2020-03-02 00:39:15 +02:00
toasted-nutbread
46fee07d36 Fix audio buttons not being hidden properly 2020-03-01 14:51:39 -05:00
toasted-nutbread
8e29da0c6b Load default Anki field templates from a file 2020-02-27 20:33:13 -05:00
toasted-nutbread
8bc1a40914 Use .bind instead of () => {} 2020-02-26 21:01:40 -05:00
toasted-nutbread
359eabb26e Move event handler definitions 2020-02-26 19:48:30 -05:00
toasted-nutbread
fa385aafa4 Fix noteUsesScreenshot not checking mode 2020-02-25 22:24:22 -05:00
toasted-nutbread
b391704f3d Use for of 2020-02-25 22:13:06 -05:00
toasted-nutbread
798517cdf1 Use for of 2020-02-25 22:11:58 -05:00
siikamiika
ffad78f7d4 temporarily disable navigation header mouse wheel
Unblock release #355, #376
2020-02-24 08:57:48 +02:00
toasted-nutbread
d6454bc999 Remove unused 2020-02-23 16:21:52 -05:00
toasted-nutbread
a0b2e11c10 Use TemplateHandler for DisplayGenerator 2020-02-23 16:18:13 -05:00
toasted-nutbread
c0d91bffc4 Add no-shadow 2020-02-22 14:53:02 -05:00
toasted-nutbread
0c8f567e6d Fix indentation 2020-02-22 14:52:09 -05:00
toasted-nutbread
aa76113e75 Fix block padding 2020-02-22 14:52:09 -05:00
toasted-nutbread
b0c566417f Replace getIndexOfTouch with getTouch 2020-02-22 14:37:10 -05:00
toasted-nutbread
7afc23427e Use URLSearchParams 2020-02-22 14:37:10 -05:00
toasted-nutbread
0f46e3a093 Use a token to ensure that messages are coming from Yomichan 2020-02-17 11:02:21 -05:00
toasted-nutbread
2c3f510010 Allow apiInjectStylesheet to inject a URL 2020-02-16 21:43:35 -05:00
toasted-nutbread
070ae70f7c Create EventListenerCollection class 2020-02-16 18:47:57 -05:00
toasted-nutbread
42f1c2463c Move generateId function 2020-02-16 12:00:56 -05:00
toasted-nutbread
217bd36abc Use consistent timeout for both setContentTerms and setContentKanji 2020-02-15 20:36:46 -05:00
toasted-nutbread
c5cbf99e89 Use promiseTimeout instead of delay 2020-02-15 20:35:51 -05:00
toasted-nutbread
496d2599ea Move error handling for apiDefinitionsAddable 2020-02-15 20:33:20 -05:00
toasted-nutbread
faf15c08aa Rename optionsUpdate event to optionsUpdated
Past tense better indicates that the options were changed, but no data
is being included as part of the event. It is also more consistent with
the other event names the yomichan object currently provides.
2020-02-14 22:34:44 -05:00
toasted-nutbread
853faaf48c
Merge pull request #358 from toasted-nutbread/general-refactoring
General refactoring
2020-02-14 21:25:25 -05:00
toasted-nutbread
61c6a753ce Add apiTemplateRender back to mixed api.js 2020-02-14 20:11:40 -05:00
siikamiika
548c67ef1c remove extra setContentToken check from Display 2020-02-14 23:17:21 +02:00
siikamiika
c09a3ded1d
Merge pull request #357 from siikamiika/simplify-display-prepare
Simplify display prepare
2020-02-14 11:00:36 +02:00
toasted-nutbread
483f7401b7 Validate bounds of Display.definitions before using 2020-02-13 20:50:31 -05:00
toasted-nutbread
db1da33321 Use Array.from in toIterable 2020-02-13 20:50:31 -05:00
toasted-nutbread
75fbb1565c Use Map for audioGetFromSources's cache parameter 2020-02-13 20:50:30 -05:00
toasted-nutbread
e3c871bc00 Remove unused handlebarsRenderStatic 2020-02-13 20:50:30 -05:00
siikamiika
d7e1ef01d8 use Promise.all to await dependencies 2020-02-13 16:26:45 +02:00
siikamiika
8abab28c4d remove isPrepared check 2020-02-13 14:36:32 +02:00
siikamiika
df37acd17f rename display initialize methods to prepare 2020-02-13 01:59:26 +02:00
siikamiika
93eaee9765 simplify DisplayGenerator initialization 2020-02-13 01:43:01 +02:00
toasted-nutbread
4629fb3639 Change no-undef from off to error 2020-02-11 22:22:16 -05:00
siikamiika
9ffd0cb441
Merge pull request #350 from siikamiika/query-parser-html-templates
query parser html templates
2020-02-11 11:07:05 +02:00
toasted-nutbread
bbb74d0a48 Assign _isInitialized 2020-02-10 20:38:20 -05:00
siikamiika
4f1ed14f07 simplify TemplateHandler 2020-02-10 21:56:48 +02:00
siikamiika
6c63a17d66 query parser html templates 2020-02-10 21:19:18 +02:00
siikamiika
56f1f8384d use parseUrl in Backend 2020-02-10 00:09:29 +02:00
toasted-nutbread
165959ef06 Move japanese.js into bg 2020-02-08 20:45:30 -05:00
siikamiika
8eac191c97 prevent unwanted wheel events on history bar 2020-02-05 14:19:48 +02:00
siikamiika
b8326138a3 add scannable tags for expression and reading 2020-02-02 13:57:30 +02:00
siikamiika
24690ceb7c fix glossary item selector 2020-02-02 13:44:08 +02:00
toasted-nutbread
6b9116ee49 Fix term tags not always being displayed 2020-02-01 21:00:27 -05:00
toasted-nutbread
db247a2837 Fix double clicking reason and glossary text 2020-02-01 21:00:07 -05:00
toasted-nutbread
dd700af0be Fix tag double click 2020-02-01 21:00:07 -05:00
siikamiika
dd019ecf68 fix audio index in resultOutputMode = 'merge' 2020-01-27 23:24:34 +02:00
toasted-nutbread
54a48a7a9b Ensure textSource is cleaned up if it isn't used 2020-01-26 10:31:17 -05:00
siikamiika
7357eaf07a
Merge pull request #330 from siikamiika/query-parser-helper-disabling
Query parser helper disabling
2020-01-25 03:29:55 +02:00
toasted-nutbread
be645c2c98 Add support for dashes 2020-01-24 20:15:25 -05:00
toasted-nutbread
46e3d72641 Move where 'a' character offset is applied 2020-01-24 20:15:25 -05:00
toasted-nutbread
317bf35bc0 Replace and remove old character/string testing functions 2020-01-24 20:15:25 -05:00
toasted-nutbread
1fa8a59626 Create new character/string testing functions 2020-01-24 20:15:25 -05:00
toasted-nutbread
9b509d50a9 Add character range definitions 2020-01-24 20:15:25 -05:00
toasted-nutbread
3c17388ff8 Update constant naming convention 2020-01-24 20:15:25 -05:00
toasted-nutbread
b5015264f2 Include half width and full width characters as Japanese characters 2020-01-24 20:15:25 -05:00
toasted-nutbread
86d96a9036 Update detection of Japanese characters 2020-01-24 20:15:25 -05:00
toasted-nutbread
be2e6e0d93 Optimize jpIsKanji and jpIsKana 2020-01-24 20:15:25 -05:00
toasted-nutbread
73cc64fb5c Implement new translation options 2020-01-24 20:15:25 -05:00
siikamiika
aa5a044dad query parser: add reading mode 'none' 2020-01-25 02:56:14 +02:00
toasted-nutbread
8ef57936d7 Add functionality for getting and observing zoom factor 2020-01-22 20:38:21 -05:00
toasted-nutbread
26ea278c29 Improve debug logging 2020-01-21 19:08:56 -05:00
siikamiika
1fd568ab8e fix term reason selector 2020-01-19 03:04:45 +02:00
toasted-nutbread
9abfd7acde Always show actions when there is only a single term result 2020-01-16 22:39:26 -05:00
toasted-nutbread
6c344b2740 Fix incorrect selector 2020-01-16 22:39:26 -05:00
toasted-nutbread
d4296a34cc Fix scroll position when header is visible 2020-01-16 22:39:26 -05:00
toasted-nutbread
7686e56c00 Move display templates into a single file 2020-01-16 22:39:26 -05:00
toasted-nutbread
d512c111f6 Update how content display is changed 2020-01-16 22:39:26 -05:00
toasted-nutbread
97f7df3302 Don't use document fragment 2020-01-16 22:39:26 -05:00
toasted-nutbread
7a6f85879e Update content assignment to use unique token 2020-01-16 22:39:26 -05:00
toasted-nutbread
dbbcfa5739 Only use Display.setContent 2020-01-16 22:39:26 -05:00
toasted-nutbread
c53947a94a Only instantiate the first child 2020-01-16 22:39:26 -05:00
toasted-nutbread
24832be636 Update how spinner visibility is controlled 2020-01-16 22:39:26 -05:00
toasted-nutbread
a50e2fb0f1 Fix furigana segmentation 2020-01-16 22:39:26 -05:00
toasted-nutbread
56ee7f8df4 Update display content generation to use HTML templates 2020-01-16 22:39:26 -05:00
siikamiika
8292be92d8 use TextScanner in QueryParser 2020-01-16 23:22:38 +02:00
toasted-nutbread
0d7ccf25b8 Update license info URL 2020-01-01 12:00:31 -05:00
toasted-nutbread
899ef167d1 Update copyright 2020-01-01 12:00:00 -05:00
toasted-nutbread
d2da4f7e62 Add apiOptionsSchemaGet 2019-12-29 12:33:15 -05:00
toasted-nutbread
2519f99f54 Update how orphan state is observed 2019-12-20 13:44:33 -05:00
toasted-nutbread
2a95f1420f Move optionsUpdate message handler into Yomichan class 2019-12-20 13:36:54 -05:00
toasted-nutbread
e14bd75a4f Change how getUrl message is handled 2019-12-20 13:15:26 -05:00
toasted-nutbread
cab2a39981 Simplify options passed to docRangeFromPoint 2019-12-17 20:56:32 -05:00
toasted-nutbread
ce51fe7eca Use a single api.js 2019-12-13 23:11:56 -05:00
toasted-nutbread
4177b63726 Remove redundant getUrl handlers 2019-12-13 23:11:56 -05:00
toasted-nutbread
a9c4ce724c Update display key handlers 2019-12-13 23:11:56 -05:00
toasted-nutbread
a2263e5729 Update display message handlers 2019-12-13 23:11:56 -05:00
toasted-nutbread
47feb95842 Add timer class for debugging 2019-12-10 19:40:40 -05:00
toasted-nutbread
bb334acab6 Use substring instead of slice 2019-12-08 16:01:29 -05:00
toasted-nutbread
1659340898 Add support for prefix wildcards 2019-12-07 14:34:35 -05:00
toasted-nutbread
20679255b0 Add class for dispatching custom events 2019-12-07 13:59:47 -05:00
siikamiika
e99c8c40a1 navigate history with wheel only over buttons 2019-12-07 17:41:14 +02:00
siikamiika
f6d0503604 simplify with inheritance 2019-12-06 21:39:29 +02:00
siikamiika
595636c40b move text selection to TextScanner 2019-12-05 22:48:05 +02:00
siikamiika
e5be42d3de scan decoupling 2019-12-05 22:12:43 +02:00
siikamiika
02a34bb4bc initial text scanner extract 2019-12-05 03:58:35 +02:00
siikamiika
d8935b6aa9 fix serialization errors on Chrome 2019-12-04 21:49:51 +02:00
Alex Yatskov
a24146538c
Merge pull request #291 from toasted-nutbread/cloze-fixes
Cloze fixes
2019-12-03 14:19:33 -08:00
siikamiika
403b86675d fix entry scroll index 0 bug
Introduced in 4e7d08ff2c because the
range-limited index value isn't kept in the same scope.
2019-12-01 15:03:37 +02:00
siikamiika
abe70e3b8c always update current position on term lookup 2019-12-01 06:08:05 +02:00
siikamiika
5929018fac move Display context to a new class 2019-12-01 05:38:23 +02:00
siikamiika
be23ad7213 remove dead code 2019-11-30 04:59:36 +02:00
siikamiika
ff9510356e rewrite history as a doubly linked list 2019-11-30 04:49:37 +02:00
siikamiika
8a94d186c3 fix context type inconsistencies 2019-11-29 01:36:14 +02:00
siikamiika
1dd88763de clear Display history on new lookup 2019-11-28 18:24:24 +02:00
siikamiika
f1ecb4cd39 correct X scroll direction for history navigation 2019-11-28 15:54:55 +02:00
siikamiika
86ff831600 preventDefault correctly 2019-11-28 15:24:00 +02:00
siikamiika
beea89a421 store popped context history in Display 2019-11-28 15:20:18 +02:00
siikamiika
4e7d08ff2c set current entry even when disableScroll is true 2019-11-28 13:22:47 +02:00
siikamiika
e37ffb6cf5 fix scroll issues in Display.entryScrollIntoView
- Save scroll context before scrolling to top
- Explicit null check for scroll param to handle scrolling to y=0
correctly
2019-11-28 12:38:25 +02:00
toasted-nutbread
5a1046bc90 Update arrow-parens to always 2019-11-26 22:06:27 -05:00
toasted-nutbread
acb70f126c Update unused arguments 2019-11-26 22:06:27 -05:00
toasted-nutbread
527595f79b Remove unnecessary escapes from regex literals 2019-11-26 22:06:27 -05:00
toasted-nutbread
943350a1f6 Use single quotes 2019-11-26 22:06:27 -05:00
toasted-nutbread
0aed27b66d Replace hasOwnProperty with simplified hasOwn function 2019-11-26 22:06:27 -05:00
toasted-nutbread
4110a848f5 Move additional utility functions to DOM 2019-11-26 18:59:52 -05:00
toasted-nutbread
96aad50340 Create DOM utility file 2019-11-26 18:59:52 -05:00
siikamiika
c2ff25b0ec use fallback for ambiguous furigana
fixes #281, fixes #94
2019-11-27 01:20:04 +02:00
toasted-nutbread
50604b25e6 Organize core.js 2019-11-26 17:38:05 -05:00
toasted-nutbread
099847729c utilIsObject => isObject, move to core.js 2019-11-26 17:33:09 -05:00
toasted-nutbread
7e94fca7c7 Rename extension.js to core.js to better reflect its use 2019-11-26 17:29:52 -05:00
toasted-nutbread
3a7ef6c560 Simplify clozeBuild 2019-11-26 12:35:17 -05:00
toasted-nutbread
afddec66eb Update cloze.body to use original sentence text 2019-11-26 12:35:17 -05:00
toasted-nutbread
befee9ceca Pass kanji character to clozeBuild 2019-11-26 12:35:17 -05:00
toasted-nutbread
cb9f9b585a Update how source terms are navigated 2019-11-26 12:31:20 -05:00
toasted-nutbread
c7cb1b3d9e Require context for setContentTerms and setContentKanji 2019-11-26 12:31:17 -05:00
siikamiika
3423ed7d67
Merge pull request #279 from siikamiika/query-parser-1
Search page query parser
2019-11-26 18:31:35 +02:00
toasted-nutbread
cf18e3b42e Replace string.substr and string.slice with string.substring
Improves semantic clarity, and it's recommended to not use substr.
2019-11-24 11:02:52 -05:00
siikamiika
cc8221c6ea add reading modes 2019-11-23 17:50:46 +02:00
siikamiika
84f30113e4 give names to complex slices 2019-11-23 17:50:46 +02:00
siikamiika
1700318988 remove unneeded feature
Unidic actually has a field for the base form of the input
2019-11-23 17:45:44 +02:00
siikamiika
41020289ab add mecab support 2019-11-23 17:45:44 +02:00
siikamiika
408aa73cce fix default params for term clicking 2019-11-23 17:43:30 +02:00
siikamiika
c35a05cd62 add kana to text 2019-11-23 17:40:52 +02:00
siikamiika
f63e8e4be0 add simple query parser 2019-11-23 16:56:10 +02:00
Alex Yatskov
b1659522b3
Merge pull request #274 from toasted-nutbread/lookup-wildcards
Lookup wildcards
2019-11-13 18:51:50 -08:00
siikamiika
29c38b06b2 only paste Japanese text from clipboard 2019-11-13 13:51:47 +02:00
toasted-nutbread
3a225c3f91 Add details field to apiTermsFind 2019-11-10 14:02:43 -05:00
toasted-nutbread
d9b4404075 Create functions for the cases of isMouseButton
jshint was showing a warning that there was no break statement
after the first case, which there doesn't need to be.

The most straightforward way to fix this without using the unclear
// jshint ignore:line
is to just have two functions.

This change also updates invocations of isMouseButton to use
the exact case function, as this will remove the need to check
the case of mosueEvent.type. This was done because onMouseMove
is invoked at a high frequency.
2019-11-10 14:00:44 -05:00
toasted-nutbread
dad685dba4 Fix overwriting const value 2019-11-10 13:56:06 -05:00
toasted-nutbread
d6cdd693c8 Fix several warnings about name conflicts 2019-11-10 13:55:37 -05:00
toasted-nutbread
6f53030469 Use for of loop instead of forEach 2019-11-10 12:25:28 -05:00
sabs
fd17a0fccd Remove Download check when resolving Audio data
There is a bug (seemingly unreported) in Yomichan where an Anki card
will not contain any audio if the JapanesePod101 audio source trumps
a secondary audio source (e.g. JapanesePod101-alternate) where
the jpod101 source can't find the word requested.

For example, そして has an audio entry in the alternate source but not
the standard source.

(Alternatively, there may be a bug in the jpod101 audioUrlBuilder,
because I've only noticed this problem with hiragana-only expressions.
JPod101 may not host those on the same url scheme any more.  I'm not
sure how to fix that, though, and the bug I'm addressing here does
still persist).

The reason this happens is that audioGetFromUrl uses downloaded audio
to effectively check for a 404 (by examining the audio duration), but
that check doesn't happen when an Anki card is being created (i.e.
"download" is set, which I've changed to "willDownload" here).

This change removes that check, but retains the will-download intent
information to prevent attempts to download tts data, which AnkiConnect
cannot do. I've also added a short explanation as to why the download
check happens where it does.

I think the unused audio object will get garbage collected since it's
not referenced again, but I've explicitly unset it as well.
2019-11-09 20:58:09 -05:00
toasted-nutbread
4d7940e8e4 Optimize dictFieldFormat 2019-11-08 22:25:03 -05:00
siikamiika
83460bcdad refactoring and optimization 2019-11-04 02:15:33 +02:00
siikamiika
f4a987912a prevent accidental lookup on glossary text select 2019-11-03 18:56:22 +02:00
toasted-nutbread
1039536cfb Create promise version of setTimeout 2019-10-28 17:03:42 -04:00
siikamiika
a716a52cab make non-hotkey keys focus input on search page
The issue was that scanning on search page introduced a way to lose
focus of the query input, and the new feature that the search page
hotkey focuses an existing search page instead of opening a new one made
it more obvious.

Now every key that isn't a hotkey focuses the query input, and typing
text into the box scrolls it into view in case it wasn't there when
searching.

There is an accessibility issue that this can cause, because now tab
also focuses the query input before it focuses the next element. I
didn't implement a workaround for that because it would have been more
complicated than this simple fix.

Fixes #263
2019-10-26 01:26:56 +03:00