Commit Graph

1252 Commits

Author SHA1 Message Date
Alex Yatskov
ba2858309e
Merge pull request #218 from toasted-nutbread/settings-profile-conditions
Settings profile conditions
2019-09-23 17:03:00 -07:00
Alex Yatskov
db405ffd24
Merge pull request #219 from toasted-nutbread/fix-null-caret-position
Handle null return value of document.caretPositionFromPoint
2019-09-22 10:06:52 -07:00
toasted-nutbread
f022ee4eca Use a Promise to trigger callback when delay is 0 or less 2019-09-19 19:00:26 -04:00
toasted-nutbread
02927f9004 Handle null return value of document.caretPositionFromPoint 2019-09-18 22:11:18 -04:00
toasted-nutbread
352d214203 Isolate objects to background window 2019-09-18 19:14:04 -04:00
toasted-nutbread
dcfe722ba6 Add support for using optionsContext to select which profile to use 2019-09-18 19:14:04 -04:00
toasted-nutbread
8c4fb28a30 Add support creating profile usage conditions 2019-09-18 19:14:01 -04:00
Alex Yatskov
e3fb9603e2
Merge pull request #209 from toasted-nutbread/settings-profiles
Settings profiles
2019-09-16 18:32:01 -07:00
toasted-nutbread
073420a121 Normalize XHTML document node.nodeNode to upper case 2019-09-15 16:09:46 -04:00
toasted-nutbread
9fb89d8f7d Isolate to background window 2019-09-15 16:04:26 -04:00
toasted-nutbread
8b7e293eae Remove profile without popup when shift key is pressed
Also removes duplicate click listener.
2019-09-15 15:58:19 -04:00
toasted-nutbread
34ddbf25fe Implement profile order changing 2019-09-15 15:58:19 -04:00
toasted-nutbread
1f77506f43 Implement profile copy 2019-09-15 15:58:19 -04:00
toasted-nutbread
c002e1bbd2 Update dictionaries for all profile options 2019-09-15 15:58:19 -04:00
toasted-nutbread
6c571bf828 Add UI for profiles 2019-09-15 15:56:53 -04:00
toasted-nutbread
c8171f5ec7 Add preliminary support for profiles 2019-09-15 15:56:53 -04:00
Alex Yatskov
5877861277
Merge pull request #213 from toasted-nutbread/options-isolation
Isolate options objects created via settings.js
2019-09-15 11:34:34 -07:00
Alex Yatskov
e4fa658295
Merge pull request #212 from toasted-nutbread/frontend-cleanup
Frontend cleanup
2019-09-15 11:33:48 -07:00
Alex Yatskov
4af9fc2b3b
Merge pull request #214 from toasted-nutbread/add-anchor-noopener
URL improvements
2019-09-15 11:32:48 -07:00
Alex Yatskov
88a6128e39
Merge pull request #211 from toasted-nutbread/validate-content-window
Validate contentWindow before focus
2019-09-14 17:31:23 -07:00
Alex Yatskov
2add068ff2
Merge pull request #210 from toasted-nutbread/defer-port-creation
Defer creation of communication port until required
2019-09-14 17:30:52 -07:00
toasted-nutbread
f8aa926f8a Upgrade website URLs to https 2019-09-14 20:18:03 -04:00
toasted-nutbread
ba1875c56a Add rel="noopener" to all anchors with target="_blank" 2019-09-14 19:59:45 -04:00
toasted-nutbread
6358b655ae Isolate options objects created via settings.js
Prevents dead objects created by different windows.
2019-09-14 16:21:41 -04:00
toasted-nutbread
0067dfeacc Remove redundant call of popupTimerClear
Also use explicit null checks rather than truthy checks.
2019-09-14 15:29:43 -04:00
toasted-nutbread
8b1e4d1c6f Return only single element when deepDomScan is not enabled 2019-09-14 14:52:03 -04:00
toasted-nutbread
7dddcb8dca Rename type to cause 2019-09-14 14:31:21 -04:00
toasted-nutbread
6d3037f3d6 Remove destructuring from searchAt, containsPoint, docRangeFromPoint 2019-09-14 14:27:25 -04:00
toasted-nutbread
89941d404c Remove unused variable 2019-09-14 14:11:25 -04:00
toasted-nutbread
721248c821 Remove mouseDownLeft and mouseDownMiddle
MouseEvent.buttons can be used instead.
2019-09-14 14:11:06 -04:00
toasted-nutbread
964de775df Validate contentWindow before focus 2019-09-14 12:02:31 -04:00
toasted-nutbread
304064dae0 Defer creation of communication port until required 2019-09-14 11:58:22 -04:00
toasted-nutbread
bab6a13bfb Fix nested popups being shown if parent is hidden 2019-09-13 18:12:51 -04:00
Alex Yatskov
ec816e6767
Merge pull request #207 from toasted-nutbread/popup-proxy-writing-mode
Add writingMode to PopupProxy* termsShow and kanjiShow
2019-09-12 19:48:22 -07:00
Alex Yatskov
60b32a4a1a
Merge pull request #206 from toasted-nutbread/fix-incorrect-function-name
Replace profileCreateDefaultFieldTemplates with optionsFieldTemplates
2019-09-12 19:47:52 -07:00
toasted-nutbread
76aa30ceba Add writingMode to PopupProxy* termsShow and kanjiShow 2019-09-11 21:29:08 -04:00
toasted-nutbread
c38c7fbda1 Replace profileCreateDefaultFieldTemplates with optionsFieldTemplates 2019-09-11 19:56:13 -04:00
toasted-nutbread
84bd9ff93b Update settings if a different source triggers optionsUpdate 2019-09-10 21:58:53 -04:00
toasted-nutbread
71b700cd22 Add checkbox for options.general.enable 2019-09-10 21:45:43 -04:00
toasted-nutbread
87e513dd77 Fix options reference being changed 2019-09-10 21:44:32 -04:00
toasted-nutbread
1f8c7358cb Create function for setting up form event listeners 2019-09-10 21:43:52 -04:00
toasted-nutbread
36b39e2f65 Create formWrite function 2019-09-10 21:43:51 -04:00
toasted-nutbread
cab39e89c9 Create section for Popup Content Scanning Options 2019-09-10 21:43:51 -04:00
toasted-nutbread
c4e6d7e3d1 Add utility method for checking if a value is a standard object 2019-09-10 20:09:33 -04:00
toasted-nutbread
05ce350792 Use apiOptionsSave instead of optionsSave 2019-09-10 20:09:33 -04:00
toasted-nutbread
4686a31a0a Use apiOptionsGet instead of optionsLoad 2019-09-10 20:09:33 -04:00
toasted-nutbread
99cec1d23f Change how formRead works
The function now modifies values in-place.
2019-09-10 20:09:33 -04:00
toasted-nutbread
8175f80183 Remove calls to apiOptionsGetSync
Use apiOptionsGet everywhere to ensure options is initialized.
2019-09-10 20:09:33 -04:00
toasted-nutbread
1b2a1e50eb Add getOptions function to backend 2019-09-10 20:09:33 -04:00
toasted-nutbread
bc8793eb56 Add a context object for all calls to fetch options 2019-09-10 20:09:33 -04:00
toasted-nutbread
99ca60d4c1 Ensure both Popup and PopupProxy have valid depth 2019-09-10 20:09:33 -04:00
toasted-nutbread
aae971a09e Pass options directly to translator.findTerms* 2019-09-10 20:09:33 -04:00
toasted-nutbread
91bc31d758 Change how options updates are handled on the frontend
Only an 'optionsUpdate' signal is now sent to the frontend with empty data. The frontend then responds by performing apiOptionsGet to update the options. This makes it so that there is only a single function which is responsible for requesting options from the backend.
2019-09-10 20:09:33 -04:00
Alex Yatskov
cc53510883
Merge pull request #204 from toasted-nutbread/settings-improvements
Settings improvements
2019-09-08 19:34:39 -07:00
toasted-nutbread
eb98dfb1a8 Simplify logic for how option updates are propagated 2019-09-06 21:23:35 -04:00
toasted-nutbread
7db2c66105 Use consistent structure for params 2019-09-06 21:23:35 -04:00
toasted-nutbread
13b184707b Remove unnecessary functions
apiOptionsSet not required in bg/js/api.js after optionsSave; optionsSave already invokes apiOptionsSet.
apiOptionsSet not required in fg/js/api.js since it's never invoked by the foreground.
optionsSet handler not required in bg/js/backend.js since the message is never sent by the foreground.
2019-09-06 21:23:35 -04:00
toasted-nutbread
35ca0f35dd Create common function for utilBackend().options 2019-09-06 21:23:35 -04:00
toasted-nutbread
a74cdbff1d Change update process 2019-09-06 19:55:58 -04:00
c53263158b version bump 2019-09-05 20:20:23 -07:00
Alex Yatskov
155986db46
Merge pull request #201 from toasted-nutbread/omit-contains-point-check
Omit containsPoint check on searchAt
2019-09-05 19:46:43 -07:00
Alex Yatskov
6dc44e3f33
Merge pull request #202 from toasted-nutbread/temporary-object-optimization
Temporary object optimization
2019-09-05 19:46:14 -07:00
toasted-nutbread
5ddbb0373f Add function to create default options 2019-09-05 20:57:52 -04:00
toasted-nutbread
ec110fa1b7 Add some validation to options loading 2019-09-05 20:57:52 -04:00
toasted-nutbread
1c767711bb Prevent infinite loops for corrupt options 2019-09-05 20:57:52 -04:00
toasted-nutbread
bc7759d94c Add some parameters to field-templates textarea 2019-09-05 20:57:52 -04:00
toasted-nutbread
dbfbf9d12d Use non-bold text for label information
Units, etc.
2019-09-05 18:53:12 -04:00
toasted-nutbread
fb8cb3db43 Collapse two-column options on smaller screens 2019-09-05 18:45:42 -04:00
toasted-nutbread
2e87cd72bc Use consistent styling for all two-column settings 2019-09-05 18:39:28 -04:00
toasted-nutbread
aa77a7896d Group all two-column settings together 2019-09-05 18:30:39 -04:00
toasted-nutbread
5c793180d0 Omit containsPoint check on searchAt
The range returned by docRangeFromPoint is now guaranteed to contain the point due to the addition of isPointInRange checks.
2019-09-03 19:17:50 -04:00
toasted-nutbread
9028b55774 Fix nested popups closing when the mouse leaves the parent's rect 2019-09-03 18:55:55 -04:00
toasted-nutbread
b90dea0e6d Use string.substr instead of string.split 2019-09-02 20:25:30 -04:00
toasted-nutbread
fc4a961412 Replace some instances of Array.concat
.push or .unshift can accomplish the same operation without constructing new arrays.
2019-09-02 20:25:30 -04:00
toasted-nutbread
fad5332488 Move static DOM scanning functions into TextSourceRange 2019-09-02 19:33:52 -04:00
siikamiika
f4b81eff30 fix parent focus issues for Firefox and Chrome 2019-09-02 19:33:52 -04:00
siikamiika
2df9a7f977 change Popup.children to Popup.child 2019-09-02 19:33:52 -04:00
siikamiika
97be029dee focus the site when closing multi-level popups 2019-09-02 19:33:52 -04:00
siikamiika
834f14e808 simplified if statement back to single line 2019-09-02 19:33:52 -04:00
siikamiika
3d28a3a405 prevent closing new child popup on parent mouseout 2019-09-02 19:33:52 -04:00
siikamiika
e4d302e786 focus parent popup on hide instead of blurring 2019-09-02 19:33:52 -04:00
siikamiika
87ff5cb19b make containsPoint async everywhere 2019-09-02 19:33:52 -04:00
toasted-nutbread
71471d08e5 Add option to enable/disable scanning of source expressions in popups 2019-09-02 19:33:52 -04:00
toasted-nutbread
3491affcf1 Update nested initialization parameters passed via message rather than using the URL query string 2019-09-02 19:33:28 -04:00
toasted-nutbread
53aad0bef6 Fix messaging issues when iframes are present in the document 2019-09-02 19:33:28 -04:00
toasted-nutbread
42ec3e2a43 Add support for popup on the search page 2019-09-02 19:33:28 -04:00
toasted-nutbread
1a9348ec27 Add option for maximum nested popup depth 2019-09-02 19:32:08 -04:00
toasted-nutbread
5c4614f585 Add support for showing recursive popups 2019-09-02 19:31:42 -04:00
4ac55da7dd version bump 2019-09-02 11:46:00 -07:00
toasted-nutbread
33076e9db9 Fix typo 2019-09-02 11:43:49 -04:00
toasted-nutbread
c0bf6ff033 Fix issues caused by scanning ranges which don't start with a text node
The rects returned by range.getClientRects() could include the entire start element's bounding box.
2019-09-02 11:43:49 -04:00
toasted-nutbread
a2139213c8 Fix issue with whitespace ranges
The size of the rects for these ranges will sometimes be excessively large on Firefox, leading to false positives.
2019-09-02 11:43:49 -04:00
toasted-nutbread
ee59b3ab8b Reduce amount of isPointInRange calls for repeated ranges 2019-09-02 11:43:49 -04:00
toasted-nutbread
171e3f1097 Add option for enabling deep scanning 2019-09-02 11:43:48 -04:00
toasted-nutbread
737a5ee8a8 Allow elements behind other transparent elements to be scanned 2019-09-02 11:43:33 -04:00
toasted-nutbread
d296ebd593 Improve definition of caretRangeFromPoint 2019-09-02 11:41:00 -04:00
toasted-nutbread
548607ea7f Destructure point to {x, y} only once 2019-09-02 11:40:21 -04:00
Alex Yatskov
3c9f7ba152
Merge pull request #196 from toasted-nutbread/vertical-text-popup-position
Vertical text popup position
2019-09-02 08:33:10 -07:00
Alex Yatskov
037363e3a7
Merge pull request #197 from toasted-nutbread/imposter-improvements
Imposter element improvements
2019-09-02 08:30:19 -07:00
toasted-nutbread
e812e76e93 Update deinflect.json 2019-09-01 22:14:32 -04:00
toasted-nutbread
e3d7ec8db7 Create container for imposter element
The container will prevent the imposter element's size from affecting the document's primary scrollbars.
2019-09-01 16:06:22 -04:00
toasted-nutbread
e3e7dad2cc Use important CSS priority for imposter element styles 2019-08-31 15:30:32 -04:00
toasted-nutbread
9b46fe70de Fix imposter issues with <input type="text"> 2019-08-31 15:10:46 -04:00
toasted-nutbread
ad0dca7bb1 Make the imposter element tracked using TextSourceRange 2019-08-31 14:57:50 -04:00
toasted-nutbread
e47e041217 Disable pointer events on hidden imposter 2019-08-31 14:57:50 -04:00
toasted-nutbread
62d66d93f7 Remove rounding 2019-08-31 14:57:50 -04:00
toasted-nutbread
9e9040178d Fix some size and positioning issues related to imposter element 2019-08-31 14:57:49 -04:00
toasted-nutbread
707d2569cc Group options onto the same line 2019-08-31 12:04:32 -04:00
toasted-nutbread
85472d9407 Add option for position of popup for horizontal text 2019-08-31 11:57:09 -04:00
toasted-nutbread
68af0d86c3 Improve popup position for vertical text 2019-08-31 11:57:07 -04:00
Alex Yatskov
3bf8a9ab00
Merge pull request #193 from toasted-nutbread/fix-is-point-in-range
Update isPointInRange to be more accurate
2019-08-29 18:00:36 -07:00
toasted-nutbread
7ba71de5e7 Replace double quotes with single quotes 2019-08-29 20:45:07 -04:00
toasted-nutbread
ea9c5ad867 Update isPointInRange to be more accurate 2019-08-29 20:35:23 -04:00
Alex Yatskov
cd75f5b97d
Merge pull request #188 from toasted-nutbread/edge-support
Add support for Edge browser
2019-08-28 19:41:30 -07:00
toasted-nutbread
a39a1fa9e4 Add support for Edge browser 2019-08-26 21:58:03 -04:00
toasted-nutbread
c49f3c7838 Suppress messages about unchecked runtime.lastError on Firefox Mobile 2019-08-25 11:09:10 -04:00
toasted-nutbread
a50ce724eb Suppress messages about unchecked runtime.lastError 2019-08-23 15:41:41 -04:00
6c3671b3d9 version bump 2019-08-19 19:40:33 -07:00
b1ed90920d Merge branch 'stable' 2019-08-19 19:39:54 -07:00
b7e3ded74e version bump 2019-08-19 19:33:30 -07:00
siikamiika
39b2456ce9 fix off by one error 2019-08-19 19:47:45 +03:00
1d6eb1c3d9 version bump 2019-08-18 12:29:14 -07:00
521aeee2bc fix manifest to contain proper values for stable version of yomichan 2019-08-17 16:01:54 -07:00
317a7a1538 pr fixes 2019-08-17 15:42:36 -07:00
Alex Yatskov
9ec711b780
Merge pull request #176 from toasted-nutbread/selection-touch-scan-disable
Don't scan when touching the current selection
2019-08-17 14:12:11 -07:00
Alex Yatskov
8ebac935e8
Merge pull request #182 from toasted-nutbread/anki-screenshot
Anki screenshot
2019-08-17 09:05:33 -07:00
Alex Yatskov
1d25c8a744
Merge pull request #175 from toasted-nutbread/touch-move-warning-fix
Don't process touchmove events if they can't be canceled
2019-08-17 09:04:23 -07:00
Alex Yatskov
778d1d6e79
Merge pull request #177 from toasted-nutbread/doc-range-from-point-improvements
Doc range from point improvements
2019-08-17 09:04:05 -07:00
toasted-nutbread
c22f8252b9 Handle case where docRangeFromPoint returns null 2019-08-16 17:44:35 -04:00
toasted-nutbread
2edd4183a0 Clean up docRangeFromPoint
Use a cached value for checking if the browser is Firefox.
Only validate and set up document.caretRangeFromPoint once.
Use switch for multiple comparisons on the same value.
2019-08-16 17:44:16 -04:00
toasted-nutbread
cd1f367798 Focus if context is falsy or focus field isn't false 2019-08-16 17:36:55 -04:00
toasted-nutbread
3a5b06bd10 Add screenshot settings 2019-08-15 19:56:14 -04:00
toasted-nutbread
0f0adf750c Add ability to save screenshot to anki cards 2019-08-15 19:39:58 -04:00
siikamiika
609dbf6a81 ensure that content is iterable 2019-08-15 15:35:23 +03:00
siikamiika
0a9b673e27 reimplement ignored chars inside source.js only 2019-08-15 15:28:30 +03:00
siikamiika
658e5ddff1 ignore zero-width non-joiner
fixes #179
2019-08-14 22:54:42 +03:00
toasted-nutbread
345b9c6f9d Disable focus of popup when using touch
Context menu on Firefox will not target the text properly if the focus is on the popup window.
2019-08-09 22:29:14 -04:00
toasted-nutbread
710ffb88fc Don't scan when touching the current selection 2019-08-09 21:45:29 -04:00
toasted-nutbread
70e9f4922b Don't process touchmove events if they can't be canceled
If the event cannot be canceled, the browser will continue to scroll while looking up results, which makes it very difficult to control where the lookup cursor is. Chrome also logs error messages that this is invalid.
2019-08-09 21:38:52 -04:00
e23d4b9a82 version bump 2019-08-04 09:58:38 -07:00
Alex Yatskov
4fd7eeff3e
Merge pull request #174 from siikamiika/fix-firefox-scanning-start-of-line
fix scanning start of line on Firefox
2019-08-03 19:55:26 -07:00
siikamiika
cfb5f0b9e1 fix scanning start of line on Firefox
On many sites, for example Twitter (posts), Yomichan doesn't match any
text from the beginning of the line unless you move the mouse cursor to
the top left corner of the word that starts from the beginning of the
line.

Apparently there were some problems related to the imposter and there
was commit 0cc5566 adding a fix for it, but this seemed to cause
problems and 542cdb2 was added to fix that. It didn't handle all of the
cases, though, so this commit is letting everything through on Firefox.
2019-08-04 01:52:27 +03:00
siikamiika
bf92430ea7 Merge branch 'master' into search-terms-from-terms 2019-08-03 22:18:53 +03:00
siikamiika
3b07a9000c add source term button to terms 2019-08-03 19:54:01 +03:00
siikamiika
683bb5b620 scroll back to exact position in source term view 2019-08-03 19:46:54 +03:00
siikamiika
ec1441434f allow multi level context 2019-08-03 15:50:49 +03:00
siikamiika
1a37342aa0 add doc scripts to search too 2019-08-03 15:09:51 +03:00
siikamiika
afc771de9f inject doc functions as dependencies 2019-08-03 15:06:28 +03:00
siikamiika
0ee6d05cb1 Revert "use ES6 import and export"
This reverts commit 04f4607922.
2019-08-03 14:57:17 +03:00
siikamiika
a343fa589e Revert "update supported browser versions for ES6 modules"
This reverts commit 52f9a8f736.
2019-08-03 14:56:45 +03:00