Commit Graph

25 Commits

Author SHA1 Message Date
evazion
71e1d7c2a5 notes: fix note mispositioning when image is blacklisted.
If the image is blacklisted on initial page load then unblacklisted
after the image is loaded, then the notes will be mispositioned at the
bottom of the image. This is because we relied on $image.height() to
calculate the note position, but the image height is zero when the image
is hidden.

Potential fix for #4370.
2020-03-28 14:56:38 -05:00
evazion
578f99f3c2 notes: remove dead resize_inner_border method.
Followup to e844a06e6. Also remove a dead reference to
`#original-file-link` (removed years ago).
2020-03-26 22:04:36 -05:00
evazion
269c20d6ee notes: clean up note visibility toggling. 2020-03-26 22:04:36 -05:00
evazion
87a51129b8 posts: add back "resize to window" link.
* Add back "Resize to window" link.
* Add Z shortcut for resize to window link (mnemonic: Z for zoom image).
* Resize images to screen width by default on both desktop and mobile.
* Make it so that notes are nested directly inside the .image-container
  element with the image, instead of inside a separate .note-container
  element. This means .image-container and .note-container are now the
  same element. This is so that the size of the .note-container is
  driven by the size of the image, which ensures that notes are
  automatically resized as the image is resized.
2020-03-26 21:55:59 -05:00
evazion
1126147dee posts: change #image-container, #note-container to classes.
Change #image-container and #note-container from IDs to classes. This is
necessary so that we can use one container element for both the image
container and the note container. This may break custom CSS and
userscripts.
2020-03-26 18:17:13 -05:00
BrokenEagle
7a81fd03ef Make clicking the box hide the popup note box in responsive mode
- This is because the note body of one note box could hide another note box
- The only option to hide the note body previously was to double tap the image
2020-03-04 00:35:45 +00:00
BrokenEagle
e844a06e61 Convert notes to use percentages instead of exact coordinates
- This allows for the note boxes to be easily resized
-- Now resizing the note container resizes all of the note boxes
-- The z-index and position values had to be adjusted for this
--- So that the note/preview boxes were still visible
--- So that the image was selectable with right clicks
- All of the inner box styles have been moved to the outer box
-- Now the inner box is only a container for the note body
- The always resize image option has been removed from user settings
-- The value still exists on the model for future rename/reuse
- The max width is set at 100% for responsive mode to fit the screen
2020-03-04 00:35:42 +00:00
BrokenEagle
f671a5528d Adapt which note body corner is used for note box rotations
Beforehand it was always using the left corner, which was causing
the note body to be to the right of the note box whenever the bottom
angle of the note box was descending. Now it selects the left or
the right corner depending on the angle, which keeps the note body
in a better position right beneath the note box.
2020-02-25 17:16:32 +00:00
evazion
928c7f8a0a Merge pull request #4281 from BrokenEagle/embedded-notes-improvements
Add embedded notes improvements
2020-02-24 01:13:13 -06:00
BrokenEagle
2b0d52b5bb Restrict note container resizing to embedded notes 2020-02-21 20:07:19 +00:00
BrokenEagle
115355ab7b Fix dialogue text for new notes
It was showing "Editing note #xx" and so on for all new notes past the first initial new note.
2020-02-14 20:49:17 +00:00
BrokenEagle
44f32a1e5e Add ability to copy certain style attributes to the outer note boxes
- Attributes are pulled from the first element with class "note-box-attributes"
- Transform is note box only to prevent applying the same transform twice
-- Only rotations are allowed to prevent excessive scaling of note boxes
-- Note box positions are adjusted after drag/nudge/resize to prevent out-of-bounds
-- The note body is placed on the lowest box corner that is farthest left
- Background color is inner box only since the note box is already transparent
-- Backgrounds with any transparency aren't allowed as they would interfere with the text below
- Border radius is both since they both have borders
- Add full namespaces to all event removes to prevent bad removes
2020-02-11 04:56:27 +00:00
BrokenEagle
c082a258c7 Add note key resize function
- Same as using the key nudge, however it's used with the shift key
2020-02-11 04:56:26 +00:00
BrokenEagle
9fbeb5ec3a Add note key nudge function
- Notes must be clicked in order to engage the nudge function for that note
-- This status is indicated by a green border around the note
-- Clicking the note or another note will turn off nudging for that note
- Also prevent notes from being nudged outside of the image borders
2020-02-11 04:56:26 +00:00
BrokenEagle
e0e60a9546 Remove dead embedded code 2020-02-10 17:23:27 -06:00
BrokenEagle
778619301e Resize font and other size parameters when the image resizes
- Each element has the size style elements scaled to the font size with "em"
-- The font size of the element is scaled in percentage to the parent element
- All sizes are then scaled by changing the font size of the note container
- The scale resize calculation uses the large image size
-- Since this is the assumed default size for a user
- Preview sets the font size of the inner box to the base font size
-- This allows the calculations to be performed correctly
2020-02-10 17:22:27 -06:00
BrokenEagle
44bcef03e1 Add additional styles for embedded notes
- Use CSS classes instead of applying the styles to the elements.
-- Allows a user to override any of the default styles being applied.
- Remove the borders and handles when not hovering over the box.
- Increase the opacity for embedded notes to full to avoid conflicts with
  the text underneath.
- Decrease the opacity a little when editing embedded notes.
-- Allows for better seeing of the text underneath while still being able
   to see the translation text above.
-- Compensated for by showing full opacity when hovering over the note box.
2020-02-10 17:20:56 -06:00
BrokenEagle
4a873626c8 Moved note title to the body so that it can be copied
- Adjusted the title text for new notes
- Adjusted the starting dialog sizes to fit the new text
2020-01-09 22:14:01 +00:00
evazion
d64236813a js: replace <meta> tags with <body> data attributes.
Refactor things to store information about the current user as data
attributes on the <body> tag rather than as <meta> tags. These <meta>
tags are now deprecated and will be eventually removed.

* Store all of the current user's API attributes as data attributes on
  the <body> tag.

* Add `CurrentUser.data` for getting data from the <body> tag, and
  use it instead of `Utility.meta`.

* Add `CurrentUser.update` for updating the current user's settings.

* Fix a bug with the user named "Anonymous" not being able to edit notes.
2019-10-02 15:59:22 -05:00
evazion
d7d4a63e69 js: fixup bug in note hiding.
Fixup regression in e000bdb86.
2019-08-18 11:24:42 -05:00
evazion
3bed5f3cf9 Fix #3867: Add namespaces to all Javascript events. 2018-09-04 12:26:18 -05:00
evazion
dfffabd662 utility.js: replace Utility.scroll_to with Element.scrollIntoView.
https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView
https://caniuse.com/#feat=scrollintoview
2018-08-17 16:25:47 -05:00
evazion
bbaadda1e3 Convert keyboard shortcuts to use data-shortcut. 2018-08-12 12:09:58 -05:00
evazion
f72b32b27b Fix eslint warnings. 2018-08-05 18:30:25 -05:00
Albert Yi
6fa0ae2cf1 Migrate assets to use Webpacker 2018-07-27 15:24:05 -07:00