Commit Graph

3269 Commits

Author SHA1 Message Date
toasted-nutbread
d6332d2bc7
Test html script ordering (#1396)
* Simplify getAllFiles

* Add test to validate script order

* Update script include order

* Update content script order

* Update sw.js and corresponding lint

* Update manifest
2021-02-14 20:25:41 -05:00
toasted-nutbread
d97c84f8ac
Update lint definitions for sandboxed files (#1395) 2021-02-14 18:20:35 -05:00
toasted-nutbread
48b59375eb
Cleanup yomichan api (#1394)
* Move invokeMessageHandler to core.js

* Move getMessageResponseResult to backghend.js

* Replace getTemporaryListenerResult
2021-02-14 18:18:02 -05:00
toasted-nutbread
9279ced686
Log refactoring (#1393)
* Create Logger class and log instance

* Replace yomichan.logWarning with log.warn

* Replace yomichan.logError with log.error

* Replace yomichan.log with log.log

* Update the Yomichan class to use the global log object

* Update lint rules
2021-02-14 17:52:01 -05:00
toasted-nutbread
286534e648
Move api to yomichan object (#1392)
* Move cross frame API from API to Yomichan

* Add API instance to Yomichan

* Move api global to yomichan.api

* Pass yomichan to API

* Remove IIFE
2021-02-14 15:53:35 -05:00
toasted-nutbread
efe8140f10
Api prepare refactor (#1391)
* Refactor API preparation

* Run yomichan.prepare manually in the entry point function
2021-02-14 15:19:31 -05:00
toasted-nutbread
94201ed44a
Rename window scroll (#1390)
* Rename WindowScroll to ScrollElement

* Rename window-scroll.js to scroll-element.js

* Update global order
2021-02-14 11:36:44 -05:00
toasted-nutbread
5268c5d1bc
Util rename (#1389)
* Rename MediaUtility to MediaUtil for consistency

* Update variable names

* Rename media-utility.js to media-util.js

* Rename ProfileConditions to ProfileConditionsUtil

* Rename variables

* Move profile-conditions.js to profile-conditions-util.js

* Rename test-profile-conditions.js to test-profile-conditions-util.js
2021-02-14 11:32:30 -05:00
toasted-nutbread
0117df6bd8
Update lint and tests (#1388)
* Update paths to no longer use bg/, fg/, or mixed/

* Only allow modal-jquery.js to use jQuery
2021-02-14 11:24:43 -05:00
toasted-nutbread
e419a418f6
Move bg/js (#1387)
* Move bg/js/anki.js to js/comm/anki.js

* Move bg/js/mecab.js to js/comm/mecab.js

* Move bg/js/search-main.js to js/display/search-main.js

* Move bg/js/template-patcher.js to js/templates/template-patcher.js

* Move bg/js/template-renderer-frame-api.js to js/templates/template-renderer-frame-api.js

* Move bg/js/template-renderer-frame-main.js to js/templates/template-renderer-frame-main.js

* Move bg/js/template-renderer-proxy.js to js/templates/template-renderer-proxy.js

* Move bg/js/template-renderer.js to js/templates/template-renderer.js

* Move bg/js/media-utility.js to js/media/media-utility.js

* Move bg/js/native-simple-dom-parser.js to js/dom/native-simple-dom-parser.js

* Move bg/js/simple-dom-parser.js to js/dom/simple-dom-parser.js

* Move bg/js/audio-downloader.js to js/media/audio-downloader.js

* Move bg/js/deinflector.js to js/language/deinflector.js

* Move bg/js/backend.js to js/background/backend.js

* Move bg/js/translator.js to js/language/translator.js

* Move bg/js/search-display-controller.js to js/display/search-display-controller.js

* Move bg/js/request-builder.js to js/background/request-builder.js

* Move bg/js/text-source-map.js to js/general/text-source-map.js

* Move bg/js/clipboard-reader.js to js/comm/clipboard-reader.js

* Move bg/js/clipboard-monitor.js to js/comm/clipboard-monitor.js

* Move bg/js/query-parser.js to js/display/query-parser.js

* Move bg/js/profile-conditions.js to js/background/profile-conditions.js

* Move bg/js/dictionary-database.js to js/language/dictionary-database.js

* Move bg/js/dictionary-importer.js to js/language/dictionary-importer.js

* Move bg/js/anki-note-builder.js to js/data/anki-note-builder.js

* Move bg/js/anki-note-data.js to js/data/anki-note-data.js

* Move bg/js/database.js to js/data/database.js

* Move bg/js/json-schema.js to js/data/json-schema.js

* Move bg/js/options.js to js/data/options-util.js

* Move bg/js/background-main.js to js/background/background-main.js

* Move bg/js/permissions-util.js to js/data/permissions-util.js

* Move bg/js/context-main.js to js/pages/action-popup-main.js

* Move bg/js/generic-page-main.js to js/pages/generic-page-main.js

* Move bg/js/info-main.js to js/pages/info-main.js

* Move bg/js/permissions-main.js to js/pages/permissions-main.js

* Move bg/js/welcome-main.js to js/pages/welcome-main.js
2021-02-14 11:19:54 -05:00
toasted-nutbread
43d1457ebf
Move bg/js/settings(2) (#1385)
* Move bg/js/settings/ to js/settings/

* Move bg/js/settings2/ to js/settings/
2021-02-13 23:20:22 -05:00
toasted-nutbread
7a74c3c31e
Move fg/js (#1384)
* Move fg/js/frame-ancestry-handler.js to js/comm/frame-ancestry-handler.js

* Move fg/js/frame-offset-forwarder.js to js/comm/frame-offset-forwarder.js

* Move fg/js/dom-text-scanner.js to js/dom/dom-text-scanner.js

* Move fg/js/text-source-element.js to js/dom/text-source-element.js

* Move fg/js/text-source-range.js to js/dom/text-source-range.js

* Move fg/js/float-main.js to js/display/popup-main.js

* Move fg/js/content-script-main.js to js/app/content-script-main.js

* Move fg/js/frontend.js to js/app/frontend.js

* Move fg/js/popup-factory.js to js/app/popup-factory.js

* Move fg/js/popup-proxy.js to js/app/popup-proxy.js

* Move fg/js/popup-window.js to js/app/popup-window.js

* Move fg/js/popup.js to js/app/popup.js
2021-02-13 23:13:53 -05:00
toasted-nutbread
6a271e067f
Move mixed/js (#1383)
* Move mixed/js/core.js to js/core.js

* Move mixed/js/yomichan.js to js/yomichan.js

* Move mixed/js/timer.js to js/debug/timer.js

* Move mixed/js/hotkey-handler.js to js/input/hotkey-handler.js

* Move mixed/js/hotkey-help-controller.js to js/input/hotkey-help-controller.js

* Move mixed/js/hotkey-util.js to js/input/hotkey-util.js

* Move mixed/js/audio-system.js to js/input/audio-system.js

* Move mixed/js/media-loader.js to js/input/media-loader.js

* Move mixed/js/text-to-speech-audio.js to js/input/text-to-speech-audio.js

* Move mixed/js/comm.js to js/comm/cross-frame-api.js

* Move mixed/js/api.js to js/comm/api.js

* Move mixed/js/frame-client.js to js/comm/frame-client.js

* Move mixed/js/frame-endpoint.js to js/comm/frame-endpoint.js

* Move mixed/js/display.js to js/display/display.js

* Move mixed/js/display-audio.js to js/display/display-audio.js

* Move mixed/js/display-generator.js to js/display/display-generator.js

* Move mixed/js/display-history.js to js/display/display-history.js

* Move mixed/js/display-notification.js to js/display/display-notification.js

* Move mixed/js/display-profile-selection.js to js/display/display-profile-selection.js

* Move mixed/js/japanese.js to js/language/japanese-util.js

* Move mixed/js/dictionary-data-util.js to js/language/dictionary-data-util.js

* Move mixed/js/document-focus-controller.js to js/dom/document-focus-controller.js

* Move mixed/js/document-util.js to js/dom/document-util.js

* Move mixed/js/dom-data-binder.js to js/dom/dom-data-binder.js

* Move mixed/js/html-template-collection.js to js/dom/html-template-collection.js

* Move mixed/js/panel-element.js to js/dom/panel-element.js

* Move mixed/js/popup-menu.js to js/dom/popup-menu.js

* Move mixed/js/selector-observer.js to js/dom/selector-observer.js

* Move mixed/js/scroll.js to js/dom/window-scroll.js

* Move mixed/js/text-scanner.js to js/language/text-scanner.js

* Move mixed/js/cache-map.js to js/general/cache-map.js

* Move mixed/js/object-property-accessor.js to js/general/object-property-accessor.js

* Move mixed/js/task-accumulator.js to js/general/task-accumulator.js

* Move mixed/js/environment.js to js/background/environment.js

* Move mixed/js/dynamic-loader.js to js/scripting/dynamic-loader.js

* Move mixed/js/dynamic-loader-sentinel.js to js/scripting/dynamic-loader-sentinel.js
2021-02-13 22:52:28 -05:00
toasted-nutbread
deed5027cd
Move mixed/lib/ to lib/ (#1382) 2021-02-13 21:28:47 -05:00
toasted-nutbread
e9358997c0
Move search mode (#1381)
* Move mode handling to SearchDisplayController

* Remove mode state info and handlers from Display
2021-02-13 18:52:54 -05:00
toasted-nutbread
acda45c598
Add information about communication port bugs (#1380) 2021-02-13 17:21:05 -05:00
toasted-nutbread
00066e4eb5
Fix cross frame communication not exposing sourceTabId properly (#1379) 2021-02-13 12:13:05 -05:00
toasted-nutbread
edc22b98e3
Improve search page popup detection (#1378)
* Add _getAllTabs function

* Add _findTabs

* Use _findTabs instead of _findTab

* Remove _findTab

* Refactor tab check

* Add ability to search for a popup native window

* Fix dangling comma
2021-02-13 12:13:01 -05:00
toasted-nutbread
d5964ee4d4
Rename html files (#1377)
* Rename context.html to action-popup.html

* Rename float.html to popup.html
2021-02-12 23:23:26 -05:00
toasted-nutbread
daea80942c
Fix old settings page not being used properly (#1376) 2021-02-12 23:07:19 -05:00
toasted-nutbread
4053d9b2fa
Move html files (#1375)
* Move background.html to /

* Move context.html to /

* Move info.html to /

* Move legal.html to /

* Move permissions.html to /

* Move pitch-accents-preview.html to /

* Move popup-preview.html to /

* Move search.html to /

* Move settings.html to /

* Move settings2.html to /

* Move template-renderer.html to /

* Move welcome.html to /

* Move float.html to /

* Move display-templates.html to /
2021-02-12 23:03:15 -05:00
toasted-nutbread
4f13de2835
Move css files (#1374)
* Move bg/css/ to css/

* Move mixed/css/ to css/
2021-02-12 21:03:30 -05:00
toasted-nutbread
8454f52378
Move more data files (#1373)
* Move deinflect.json

* Move button.mp3

* Move fonts
2021-02-12 20:37:43 -05:00
toasted-nutbread
f70464e5f3
Add additional vz deinflection rule (#1367) 2021-02-12 20:29:23 -05:00
toasted-nutbread
98975d5923
Move images (#1372)
* Move mixed/img/ to images/

* Move bg/img/ to images/
2021-02-12 20:27:43 -05:00
toasted-nutbread
2b4af57bd7
Move data folder (#1371)
* Move handlebars template files

* Move schema files
2021-02-12 19:56:24 -05:00
toasted-nutbread
37f9161718
Update the warning on the old settings page (#1370) 2021-02-12 19:54:44 -05:00
toasted-nutbread
1c5e3e6d39
Search decouple (#1369)
* Update how query post-processing is implemented

* Update DisplaySearch to not subclass Display

* Update display construction

* Make display initialization consistent

* Remove unused

* Fix wanakana binding

* Use own frame/tab ID

* DisplaySearch => SearchDisplayController

* Fix globals
2021-02-11 22:57:38 -05:00
toasted-nutbread
94db6c69fa
Permissions button in browser action popup (#1368)
* Add key icon

* Update context icon styles

* Add permissions links

* Show warning badge if permissions are insufficient for certain settings

* Create PermissionsUtil

* Use PermissionsUtil in Backend

* Update SettingsController to use PermissionsUtil

* Update AnkiController to use getRequiredPermissionsForAnkiFieldValue

* Show the permissions buttons/links on the context page when necessary

* Update MV3 compatibility
2021-02-11 18:55:09 -05:00
toasted-nutbread
07cd006127
Add support for multiple types of audio (#1366) 2021-02-10 19:18:28 -05:00
toasted-nutbread
673952e825
Fix window popup screenshot (#1365)
* Pass tabId to the screenshot functionality

* Make setVisibleOverride async

* Fix argument order

* Fix incorrect windowId

* Remove unused argument
2021-02-09 23:14:29 -05:00
toasted-nutbread
166451b8f7
Improve popup window ownership (#1364)
* Update frameInformationGet to also return the tab ID

* Add tabId to Frontend

* Pass tabId/frameId to Display

* Pass ownership information using setContent

* Remove ownerFrameId for Popup classes

* Use frameId instead of ownerFrameId for screenshotting

* Use contentOrigin instead of owner

* Update _invokeContentOrigin implementation
2021-02-09 22:56:04 -05:00
toasted-nutbread
0f5fb804d0
Mecab test (#1361)
* Update Mecab API

* Add testMecab API function

* Add a test button for the Mecab component
2021-02-08 19:40:49 -05:00
toasted-nutbread
0ed24347ee
Fix settings permissions issues (#1360)
* Add missing warning indicator for the MeCab option

* Fix error handling of permissions requests
2021-02-08 19:37:36 -05:00
toasted-nutbread
0d031ab785
Improve context page display on mobile (#1359) 2021-02-08 17:53:22 -05:00
toasted-nutbread
e386599872
Fix changing the parser not immediately updating (#1358) 2021-02-08 17:53:17 -05:00
toasted-nutbread
69e8addb47
Mecab refactor (#1357)
* Use private variables

* Use local variables

* Remove onError

* Use private functions

* Move results parsing

* Set up disconnect observation

* Add _clearPort

* Update API

* Rename

* Fix iterator

* Update parseText invocation

* Update parseText format

* Reorganize

* Update implementation and docs

* Fix some port setup issues
2021-02-08 17:53:12 -05:00
toasted-nutbread
7b28c2c532
Auto-fill Anki card fields when possible (#1355) 2021-02-08 17:53:07 -05:00
toasted-nutbread
bb8a521dff
Remove unused api functions (#1354)
* Remove screenshotGet

* Remove downloadDefinitionAudio

* Remove clipboardGetImage
2021-02-08 17:53:02 -05:00
toasted-nutbread
73e91b3b62
Refactor FrameOffsetForwarder (#1353)
* Add getChildFrameElement to FrameAncestryHandler

* Add isRootFrame

* Initialize _frameOffset to [0, 0]

* Update FrameOffsetForwarder implementation

* Update documentation
2021-02-08 17:52:56 -05:00
toasted-nutbread
3e5b30ff76
Fix overflow scrollbar appearing sometimes (#1350) 2021-02-08 17:52:51 -05:00
toasted-nutbread
4b6703114c
Improve dictionaries not enabled badges (#1349)
* Improve badges on the settings page

* Add badges on the context page
2021-02-08 17:52:46 -05:00
toasted-nutbread
849e4fabe1
Native messaging optional permission (#1348)
* Refactor PermissionsToggleController to not require a setting

* Update nativeMessaging to be optional on Chrome

* Update parsing.enableMecabParser setting to request permissions

* Update permissions page to use PermissionsToggleController

* Update permissions documentation

* Disable toggle for permissions which are not optional
2021-02-08 17:52:41 -05:00
toasted-nutbread
008809e0e7
Enforce language (#1344)
* Assign text content and a language

* Remove _appendMultilineText

* Assign lang for createTextNode content

* Add language attributes to HTML pages
2021-02-08 17:52:35 -05:00
toasted-nutbread
c6315cdb8c
え deinflection (#1343)
* Add -e deinflections

* Add tests

* Add more rules for double え
2021-02-08 17:52:30 -05:00
toasted-nutbread
ace6e92d55
Update chrome://extensions/shortcuts URLs to be clickable (#1342) 2021-02-08 17:52:25 -05:00
toasted-nutbread
9f5cbaac5a
Frame ancestry handler refactor (#1352)
* Validate source window before handling messages

* Add unregisterHandler to CrossFrameAPI

* Refactor the process FrameAncestryHandler uses to get ancestor frame IDs

* Store a mapping of child frame information

* Update getFrameAncestryInfo to only run once
2021-02-06 16:19:55 -05:00
toasted-nutbread
356e7f5274
Add FrameAncestryHandler (#1351) 2021-02-06 14:32:21 -05:00
toasted-nutbread
8f97ca0aac
Permissions toggle controller (#1347)
* Move file, rename class

* Expose required permissions in an attribute

* Update selector

* Update attribute

* Fix global declaration order
2021-02-04 22:17:42 -05:00
toasted-nutbread
47f16862d0
Fix incorrect clipboard setting target (#1346) 2021-02-04 21:12:32 -05:00