Commit Graph

707 Commits

Author SHA1 Message Date
siikamiika
61a96e327a prevent injecting frontend multiple times 2020-04-11 21:01:27 +03:00
siikamiika
9adbc80a70 listen to optionsUpdated in popup-nested.js 2020-04-11 21:01:27 +03: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
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
a2b66dc6cc Rename apiForward to apiBroadcast 2020-04-07 19:51:39 -04:00
toasted-nutbread
696897f6fa Add support for getting the document title 2020-04-06 18:55:36 -04:00
siikamiika
aea7c590d1 refactor _updateFrameOffset 2020-04-05 20:03:45 +03:00
siikamiika
abd056e563 reduce code duplication 2020-04-05 20:03:45 +03:00
siikamiika
31a326fe63 add option for iframe popups 2020-04-05 20:03:42 +03:00
siikamiika
0d76cef434 give a name to a timeout 2020-04-05 19:57:37 +03:00
siikamiika
e4fc53480f move broadcastRootPopupInformation to Frontend 2020-04-05 19:57:37 +03:00
siikamiika
559033f0a6 default to [0, 0] when sourceFrame is not found 2020-04-05 19:57:37 +03:00
siikamiika
c171503d77 use getTemporaryListenerResult in other places 2020-04-05 19:57:37 +03:00
siikamiika
7928c5d713 error handling 2020-04-05 19:57:37 +03:00
siikamiika
9f9ea1d5fb throttle frame offset getting 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
siikamiika
9fe1e38afb refactor 2020-04-05 19:57:37 +03:00
siikamiika
d20ece9f07 move frame offset forwarding code to a class 2020-04-05 19:57:37 +03:00
siikamiika
09151a1a86 simplify popup proxy prepare 2020-04-05 19:57:37 +03:00
siikamiika
b996d0b1e0 fix and simplify 2020-04-05 19:57:37 +03:00
siikamiika
4814db8df1 adjust iframe popup position to root page 2020-04-05 19:57:37 +03:00
siikamiika
b6c4914b79 simplify popup prepare 2020-04-05 19:57:37 +03:00
siikamiika
6806e7055f show iframe popups in root frame 2020-04-05 19:57:37 +03:00
siikamiika
b616bac66e remove targetPopupId 'all'
Make unset targetPopupId mean the same thing instead
2020-03-21 22:13:07 +02:00
siikamiika
17934cce4b use random ID as popup ID 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
64fc0349a1 Update global declarations 2020-03-10 22:40:35 -04:00
siikamiika
2ca88b9b9f strict check if popup depth has been set 2020-03-09 11:56:06 +02:00
siikamiika
e2bf22831a start popup depth from 1 on search page 2020-03-09 02:10:28 +02:00
siikamiika
4b0dfa92aa
Merge pull request #393 from siikamiika/reconnect-frontend-api-sender
reconnect FrontendApiSender after disconnecting
2020-03-08 00:50:24 +02:00
siikamiika
9fef0751f3 replace spread with destructuring 2020-03-07 04:11:18 +02:00
siikamiika
86be737508 fix popup containsPoint offset 2020-03-07 03:52:36 +02:00
siikamiika
8b76761744 reconnect FrontendApiSender after disconnecting 2020-03-07 00:32:45 +02:00
siikamiika
a05a05c4f4 fix content script entry point Yomichan prepare
Covers Popup stuff in addition to Frontend
2020-03-02 12:01:53 +02:00
siikamiika
967e99b7f6 ensure Backend prepare in other places 2020-03-02 04:51:45 +02:00
siikamiika
314c567a47 fix hotkeys in popup 2020-03-01 19:02:43 +02:00
toasted-nutbread
8bc1a40914 Use .bind instead of () => {} 2020-02-26 21:01:40 -05:00
toasted-nutbread
fc08cd74fe Use .bind instead of () => {} 2020-02-26 20:35:37 -05:00
toasted-nutbread
03ba1b633e Move event handler definitions 2020-02-26 20:03:21 -05:00
toasted-nutbread
d08ac02c6a Move event handler definitions 2020-02-26 19:52:12 -05:00
toasted-nutbread
0c4aa2eeb9 Fix trailing newlines not actually generating a new line in the imposter
This was causing vertical scroll offset issues
2020-02-23 13:04:55 -05:00
toasted-nutbread
5a5c18371c Use textContent instead of innerText 2020-02-23 11:58:17 -05:00
toasted-nutbread
53220af68e Don't use innerHTML 2020-02-23 11:49:52 -05:00
toasted-nutbread
6d75637ace Fix brace style issues 2020-02-22 14:52:08 -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
aee16c4431 Check origin on window messages 2020-02-16 23:41:17 -05:00
toasted-nutbread
ae4ee9ddee Fix error handling on style injection 2020-02-16 21:49:28 -05:00
toasted-nutbread
3d27e80ae6 Delay CSS injection until a popup is created 2020-02-16 21:46:13 -05:00
toasted-nutbread
9fd6ee382d Create more generic function for injecting stylesheets 2020-02-16 21:46:13 -05:00
toasted-nutbread
b6a50e234c Change parameter name 2020-02-16 21:44:45 -05:00
toasted-nutbread
2c3f510010 Allow apiInjectStylesheet to inject a URL 2020-02-16 21:43:35 -05:00
toasted-nutbread
1c6ed1d286 Set URL before adding to the document 2020-02-16 21:41:31 -05:00
toasted-nutbread
c6efa65626 Fix missing argument 2020-02-16 19:09:33 -05:00
toasted-nutbread
dcd243c9e9 Update how popups are created 2020-02-16 18:59:08 -05:00
toasted-nutbread
5d3c13ee98 Tweak how fullscreen changes are observed 2020-02-16 18:52:04 -05:00
toasted-nutbread
36605f74c3 Undo "Obscure the iframe's URL from the host page"
There are some additional issues which cause the frame to be reset to
about:blank on certain occasions which must be fixed before this can be
used.
2020-02-16 18:47:46 -05:00
toasted-nutbread
6df5220e02 Prevent multiple prepare calls 2020-02-16 12:23:40 -05:00
toasted-nutbread
b5d32c73e6 Simplify process to wait for iframe prepare completion 2020-02-16 12:23:20 -05:00
toasted-nutbread
42f1c2463c Move generateId function 2020-02-16 12:00:56 -05:00
toasted-nutbread
912d59d3df Obscure the iframe's URL from the host page 2020-02-15 22:39:09 -05:00
toasted-nutbread
10ec165f14 Check type of other for equals functions
Fixes #361
2020-02-15 20:52:21 -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
89cb98e4d1 Add global apiForward 2020-02-14 21:50:17 -05:00
siikamiika
c09a3ded1d
Merge pull request #357 from siikamiika/simplify-display-prepare
Simplify display prepare
2020-02-14 11:00:36 +02:00
siikamiika
810a7e7d92 use sendMessage to notify about initialization 2020-02-14 02:33:54 +02:00
siikamiika
38a6433a46 remove isInjected checks from Popup 2020-02-13 15:04:10 +02:00
siikamiika
c0225f1f84 notify popup about initialization 2020-02-13 13:18:54 +02:00
siikamiika
df37acd17f rename display initialize methods to prepare 2020-02-13 01:59:26 +02:00
toasted-nutbread
e2ac478cb7 Define more globals 2020-02-11 22:22:16 -05:00
toasted-nutbread
65dfb855fb Fix undefined id 2020-02-11 22:21:55 -05:00
toasted-nutbread
1f3ff6fad0 Fix equals function on TextSourceRange when imposter elements are used 2020-01-26 10:31:17 -05:00
toasted-nutbread
04727a8cd7 Fix viewport issues when popupScaleRelativeToVisualViewport is disabled 2020-01-22 20:38:21 -05:00
toasted-nutbread
8e15c20311 Remove window.onscroll handler since it causes a warning 2020-01-22 20:38:21 -05:00
toasted-nutbread
74d9b0e857 Update full-width popup to stay on screen 2020-01-22 20:38:21 -05:00
toasted-nutbread
d59f2022b9 Allow viewport to be used for constraining popup position 2020-01-22 20:38:21 -05:00
toasted-nutbread
21dbb19565 Update popup position on scroll 2020-01-22 20:38:21 -05:00
toasted-nutbread
e73e4c032c Implement scale relative to visual viewport 2020-01-22 20:38:21 -05:00
toasted-nutbread
4d85a36091 Fix popup size changing when zooming 2020-01-22 20:38:21 -05:00
toasted-nutbread
351598a182 Add settings to control popup content scale 2020-01-22 20:38:21 -05:00
toasted-nutbread
e740965d4f Scale popup based on current page zoom factor 2020-01-22 20:38:21 -05:00
toasted-nutbread
22afab2f47 Remove _isInitialized 2020-01-22 20:38:21 -05:00
toasted-nutbread
e51fd8ea71 Add _isInjectedAndLoaded property 2020-01-22 20:38:21 -05:00
toasted-nutbread
f725549330 Remove redundant window resize handler 2020-01-22 20:38:21 -05:00
toasted-nutbread
14e48cf854 Create single function for how the frontend shows popup content 2020-01-22 20:38:21 -05:00
toasted-nutbread
d8b0d5267b Catch exception on range.setStart
Fixes #328
2020-01-17 20:47:51 -05:00
toasted-nutbread
f969b5b8a9 Update popup scan ignore selectors 2020-01-16 22:39:26 -05:00
toasted-nutbread
62da7ec5cc Update expression-scan-toggle to term-expression-text 2020-01-16 22:39:26 -05:00
toasted-nutbread
dbbcfa5739 Only use Display.setContent 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
362e317a5d Change FrontendApiSender.callbacks to be a map 2019-12-21 14:30:13 -05:00
toasted-nutbread
a2175f2c29 Move PopupProxyHost initialization 2019-12-21 13:27:32 -05:00
toasted-nutbread
7ae0584077 Update initialization 2019-12-21 13:19:31 -05:00
toasted-nutbread
b2cc694d95 Replace window.yomichan_display with DisplayFloat.instance 2019-12-20 23:20:42 -05:00
toasted-nutbread
8c236cca44 Remove unused yomichan_frontend 2019-12-20 23:20:22 -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
cab2a39981 Simplify options passed to docRangeFromPoint 2019-12-17 20:56:32 -05:00
toasted-nutbread
4b5138b96e Override pointer-events with important 2019-12-17 20:54:57 -05:00
toasted-nutbread
ff1f256ffa Only return unique elements from docElementsFromPoint
This fixes #294
2019-12-17 20:53:12 -05:00
toasted-nutbread
9557d8048b Fix undefined reference 2019-12-16 19:54:41 -05:00
toasted-nutbread
68a0293867 Make PopupProxy functions async enabled status match Popup 2019-12-16 19:54:41 -05:00
toasted-nutbread
d6c64643b1 Don't return promises for frontend message handlers 2019-12-16 19:54:41 -05:00
toasted-nutbread
0fb2357ec7 isVisibleAsync => isVisible 2019-12-16 19:54:41 -05:00
toasted-nutbread
29734ea6e9 isVisible => isVisibleSync 2019-12-16 19:54:41 -05:00
toasted-nutbread
72ab6f1f45 Remove unused child getter 2019-12-16 19:54:41 -05:00
toasted-nutbread
801df8000f Mark private members 2019-12-16 19:54:41 -05:00
toasted-nutbread
7c68490d2e Add setParent to popup 2019-12-16 19:54:41 -05:00
toasted-nutbread
30e13354b3 Add Popup.isProxy 2019-12-16 19:54:41 -05:00
toasted-nutbread
289a1849c4 Add _createPopupInternal to return both popup and new ID 2019-12-16 19:54:41 -05:00
toasted-nutbread
41fadfd0a9 Add setChildrenSupported to popup 2019-12-16 19:54:41 -05:00
toasted-nutbread
c4719cb7f4 Add getContainer to popup 2019-12-16 19:54:41 -05:00
toasted-nutbread
4ba93b0770 Add getContainerRect to popup 2019-12-16 19:54:41 -05:00
toasted-nutbread
37da5fef59 Move container definition 2019-12-16 19:54:41 -05:00
toasted-nutbread
c3ea952844 Mark private functions 2019-12-16 19:54:41 -05:00
toasted-nutbread
44bde5c676 Reorganize popup-only public functions 2019-12-16 19:54:41 -05:00
toasted-nutbread
4014bbab42 Reorganize popup public functions to match popup proxy 2019-12-16 19:54:41 -05:00
toasted-nutbread
8164ccfbfc Group poup static functions together 2019-12-16 19:54:41 -05:00
toasted-nutbread
fab0d70358 Move popup public properties 2019-12-16 19:54:41 -05:00
toasted-nutbread
2c3a145866 Mark private members 2019-12-16 19:54:41 -05:00
toasted-nutbread
8a127e07f3 Mark private message handlers 2019-12-16 19:54:41 -05:00
toasted-nutbread
525a3a50d1 Mark private functions 2019-12-16 19:54:41 -05:00
toasted-nutbread
2c8c6866ef jsonRectToDOMRect => convertJsonRectToDOMRect
Also make static
2019-12-16 19:54:41 -05:00
toasted-nutbread
3f8cc83c25 Group nested message handlers together 2019-12-16 19:54:41 -05:00
toasted-nutbread
88ac8f4ead Update PopupProxyHost.popups to use a Map 2019-12-16 19:54:41 -05:00
toasted-nutbread
8efbf9bd0d Flag members as private 2019-12-16 19:54:41 -05:00
toasted-nutbread
bf02eb2ea1 Mark PopupProxy internal functions as private 2019-12-16 19:54:41 -05:00
toasted-nutbread
ce51fe7eca Use a single api.js 2019-12-13 23:11:56 -05:00
toasted-nutbread
7addf5a2dd Add API calls for optionsGetFull and optionsSave 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
573f83b65a Update frontend API receiver handlers 2019-12-13 23:11:56 -05:00
toasted-nutbread
b7144ed879 Update display float key handlers 2019-12-13 23:11:56 -05:00
toasted-nutbread
5588643988 Update float message handlers 2019-12-13 23:11:56 -05:00
toasted-nutbread
863e36e829 Update frontend message handlers 2019-12-13 23:11:56 -05:00
toasted-nutbread
f287d68624 Add showContentCompleted for improved semantic clarity 2019-12-11 21:31:21 -05: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
a40f3b1c9f add missing disableHistory 2019-12-01 06:32:17 +02:00
siikamiika
be23ad7213 remove dead code 2019-11-30 04:59:36 +02:00
siikamiika
1dd88763de clear Display history on new lookup 2019-11-28 18:24:24 +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
ef833d2bea Use const rather than let where possible 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
toasted-nutbread
a14b820a19 Move utilInvoke into api.js, rename to _apiInvoke 2019-11-26 17:23:55 -05:00
toasted-nutbread
7f9a73135d Remove utilAsync 2019-11-26 17:18: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
820beb7c93 Fix incorrect opacity check 2019-11-25 21:04:34 -05: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
41020289ab add mecab support 2019-11-23 17:45:44 +02:00
siikamiika
c35a05cd62 add kana to text 2019-11-23 17:40:52 +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
siikamiika
40c8268fd6 always disable scanning IME checkbox label 2019-11-09 13:01:21 +02:00
siikamiika
25af532ab7 enable expression scan toggling on search page 2019-11-09 12:27:09 +02:00
toasted-nutbread
fa963722a7 Fix seekForward and seekBackward not handling length=0 case correctly 2019-11-08 19:24:33 -05:00
toasted-nutbread
a85ec440d6 Fix overlapping popup timers 2019-11-05 19:48:08 -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
75ff05148d Fix autoHideResults not working 2019-11-03 11:06:31 -05:00
toasted-nutbread
bcffe80a1e Group similar functions together 2019-10-28 17:03:42 -04:00
toasted-nutbread
6d85dae68d Fix some issues with the context menu 2019-10-28 17:03:42 -04:00
toasted-nutbread
d2644c0776 Style update 2019-10-28 17:03:42 -04:00
toasted-nutbread
c365101ec2 Reset preventions earlier 2019-10-28 17:03:42 -04:00
toasted-nutbread
e542f38110 Check pendingLookup earlier 2019-10-28 17:03:42 -04:00
toasted-nutbread
9703e123bf Remove setPrimaryTouch 2019-10-28 17:03:42 -04:00
toasted-nutbread
80eb357527 Simplify touch event implementation 2019-10-28 17:03:42 -04:00
toasted-nutbread
131dc8397d Make selectionContainsPoint static 2019-10-28 17:03:42 -04:00
toasted-nutbread
a648e05091 Improve naming 2019-10-28 17:03:42 -04:00
toasted-nutbread
9178636613 Remove setters 2019-10-28 17:03:42 -04:00
toasted-nutbread
c74c466c36 Remove unused variable 2019-10-28 17:03:42 -04:00
toasted-nutbread
f2dec4ca20 Remove searchFromTouch 2019-10-28 17:03:42 -04:00
toasted-nutbread
8c5240d7a6 Simplify how touch events use onAfterSearch 2019-10-28 17:03:42 -04:00
toasted-nutbread
e91bcf5f55 Rename textSourceLast to textSourceCurrent 2019-10-28 17:03:42 -04:00
toasted-nutbread
be27781c15 Update how definitions are searched for 2019-10-28 17:03:42 -04:00
toasted-nutbread
f927f806ba Move check 2019-10-28 17:03:42 -04:00
toasted-nutbread
1f0a434e96 Remove unused vars 2019-10-28 17:03:42 -04:00
toasted-nutbread
dcb6f68826 Don't pass null textSource into searchSource 2019-10-28 17:03:42 -04:00
toasted-nutbread
185963899b Use promiseTimeout 2019-10-28 17:03:42 -04:00
toasted-nutbread
d608657495 Move onError catch into searchAt 2019-10-28 17:03:42 -04:00
siikamiika
70418202cf make search page checkbox options persist 2019-10-27 20:11:23 +02:00
siikamiika
48776145d6 add workaround to Chrome clipboard.readText
For some reason this doesn't work on Firefox, so keep using the new API
for Firefox
2019-10-27 15:46:27 +02:00
toasted-nutbread
7a3315d75d Use chrome.runtime.getURL instead of chrome.extension.getURL 2019-10-22 20:23:03 -04:00
toasted-nutbread
d9ae34821c Add support for middle clicks opening new tabs on the context buttons 2019-10-19 22:30:16 -04:00
toasted-nutbread
dbec4bffda Make the search button reuse an open search tab if it exists 2019-10-19 22:28:23 -04:00
toasted-nutbread
a5d7de8e97 Add correction to offset of imposter rect
Necessary when dealing with CSS transforms
2019-10-17 19:30:54 -04:00
toasted-nutbread
8f918c63dc Reposition popup on window resize rather than clear the search
Fixes #107
2019-10-17 18:40:43 -04:00
toasted-nutbread
598cd32946 Update *show* APIs to unified showContent and setContent 2019-10-17 18:40:43 -04:00
siikamiika
5b98f3ea6e add missing return to fix vertical text mode 2019-10-16 23:49:40 +03:00
toasted-nutbread
16521fec93 Assign first popup on the search page as a depth of 1 2019-10-15 20:23:25 -04:00
toasted-nutbread
cb236a7430 Add apiGetEnvironmentInfo function 2019-10-13 17:20:55 -04:00