Commit Graph

719 Commits

Author SHA1 Message Date
nonamethanks
08234c496d Fix url fields in forms not having the same length as other text inputs 2021-08-26 13:32:16 +02:00
evazion
c8d7f94d7e Update Ruffle version. 2021-08-21 04:01:24 -05:00
nonamethanks
89c14717ec Upload page: disallow swf uploads in javascript too 2021-06-21 03:32:16 +02:00
evazion
c7fda2772f posts: fix rare bug with first post.
Fix a rare bug that occurs once per year that causes post 1 to appear
insufficiently festive.
2021-05-23 06:33:29 -05:00
evazion
a2f3ba695c Revert "fix vote buttons."
This reverts commit a0b6047d00.
2021-04-02 03:58:14 -05:00
evazion
a0b6047d00 fix vote buttons. 2021-03-31 23:20:49 -05:00
evazion
fff68e1d16 ruffle: fix issue with ruffle falsely triggering keyboard shortcuts.
Fix issue mentioned in 55980c6fb with Javascript spazzing out on Flash
posts and randomly triggering keyboard shortcuts.

The bug was calling `javascript_pack_tag` twice. This caused the
runtime Javascript chunk to be loaded twice, caused a lot of Javascript
errors that somehow resulted in keyboard shortcuts being triggered.

The fix is to combine both calls into `javascript_pack_tag "application", "flash"`.

hxxps://github.com.rails.webpacker.issues.2932
2021-03-31 22:10:04 -05:00
evazion
55980c6fbf Add Ruffle support for Flash files.
Allow viewing Flash posts with the Ruffle emulator.

Known issues:

* Many flash files aren't fully supported.
* In development it sometimes spazzes out and starts triggering random
  keyboard shortcuts when you press any key. This doesn't happen with
  the browser extension.
* We have to put the .wasm file in the public/packs/js directory because
  Ruffle is hardcoded to search for it there.
* If you're running Nginx, you need to make sure you're serving the
  right MIME type for .wasm files or it won't work.
* We're using Some Random Guy's unofficial NPM package for Ruffle, since the
  Ruffle project doesn't publish an official package themselves. We
  should build our own package.

References:

* https://github.com/ruffle-rs/ruffle
* https://github.com/ruffle-rs/ruffle/wiki/Using-Ruffle#configure-webassembly-mime-type
* https://www.npmjs.com/package/ruffle-mirror
2021-03-31 20:20:22 -05:00
evazion
9baac1fec0 autocomplete: increase contrast of selected tag in light mode. 2021-03-24 13:29:27 -05:00
BrokenEagle
79a70083ef Add support for determining stack order of embedded notes 2021-03-16 04:02:47 +00:00
evazion
bb0540e1a1 Fix #4747: BUR layout partly broken on iOS.
Move the BUR help text from the <textarea> placeholder attribute to a
<details> tag that embeds the [[help:bur_notice]] wiki page.

Also update some CSS for the <details> tag that was meant to only apply
to the user upgrades page and didn't look good here.
2021-03-05 19:53:42 -06:00
evazion
be162a8ae9 Fix #4746: Related tags checkboxes don't work properly on some phones (iOS).
Only use hover to hide the checkboxes on devices that support hovering
(i.e. computers with a mouse). On some mobile devices, a tap is used to
emulate hovering, which meant the tag had to be tapped twice.
2021-03-05 18:22:47 -06:00
evazion
a10dc33170 Fix #4742: Ctrl+Enter doesn't work on search bar.
The search form uses a <button type="submit"> tag instead of a
<input type="submit"> tag. It uses a <button> because it contains an
icon and <input> tags can't contain nested tags.
2021-03-01 01:19:59 -06:00
evazion
2bfb78684f css: use root-relative URLs in font face definitions.
Required for eventually upgrading to PnP in Yarn 2. PnP doesn't have a
node_modules folder.

https://yarnpkg.com/features/pnp
2021-03-01 00:39:49 -06:00
evazion
3b3b6b5a2c css: tweak color scheme.
Light mode:

* Change child post border from orange back to dark yellow (still darker
  than previous yellow).
* Make flagged borders brighter red.
* Make admins brighter red.
* Make parent, child, and pending post notice bars brighter.
* Change copyright tags from purple to magenta (very close to copyright
  tag color from before).
* Darken forum topic new/approved/rejected labels.

Dark mode:

* Make platinum users brighter grey.
2021-02-26 02:14:22 -06:00
evazion
e1ef94faf7 sources: factor out 'Fetch source data' box into view component. 2021-02-26 01:24:30 -06:00
evazion
0eea654a48 autocomplete: fix empty autocomplete calls when toggling related tags.
This happens because toggling a related tag updates the tag box, which
triggers autocomplete, which can't find a tag because the cursor isn't
in the tag box, so it ends up making an autocomplete call for the empty
string.
2021-02-25 15:54:49 -06:00
evazion
cf62e13394 uploads: fix source field being too short. 2021-02-25 06:16:36 -06:00
evazion
a6435f65e3 js: workaround webpack bug with exporting Danbooru global.
Workaround issue described in bcca0ca53a (commitcomment-47338194)
2021-02-24 00:01:12 -06:00
evazion
b2a423af64 Fix #4731: Tag counter in edit boxes should only count unique tags, not repeated.
Just use the `uniq` function from lodash. Adds ~1kb to the build.

Also rename `Utility.regexp_split` to `Utility.splitWords`.
2021-02-23 19:00:58 -06:00
evazion
868f1a1809 related tags: fix layout on mobile.
Make related tags use a single-column layout on mobile.

Related tags layout is still broken inside the tag edit dialog box, when
the dialog box is too small for multiple columns.
2021-02-23 17:57:21 -06:00
evazion
4dd1a05208 related tags: fix tag toggling UX.
* Use -webkit-text-stroke instead of bold to indicate selected tags.
  Bold causes the tag to change width, which is jarring and can cause
  the tag to wrap around to a new line. -webkit-text-stroke doesn't
  change the tag's width. Despite the name, this property is widely
  supported.

* Don't wrap the checkbox in a label. In combination with flexbox, this
  made the hitbox for the tag too big. You could click on empty space
  outside the tag and it would still toggle the tag.
2021-02-23 17:45:43 -06:00
evazion
6de0c88f86 css: add box shadow to notice boxes.
Add a box shadow to the floating notice boxes that appear at the top of
the screen to show info or error messages.
2021-02-23 07:16:52 -06:00
evazion
ac05da8de6 posts: change how the mode menu indicates the active mode.
Instead of changing the background color of the entire page when you
change modes in the post mode menu (which was ugly, and not obvious what
the colors meant), show a notice and make it so that hovering a post
gives it a blue outline. This indicates that clicking the post will do
something different.
2021-02-23 07:14:49 -06:00
evazion
de44f6c8e4 notes: fix note sizing issues.
Fix issues with note sizing caused by the switch to `box-sizing: border-box`
in 19aea560. Note boxes have a 1px black border, which is counted as
part of the note box width when using border-box. This threw off sizing
and position calculations.

Also go back to 1px borders instead of 2px borders for unsaved and
selected notes. This also messed up note sizing.
2021-02-23 05:39:15 -06:00
evazion
7966dcb3c9 css: standardize box shadows.
* Standardize dialog box and tooltip box shadows.

* Add shadows behind all other floating elements, namely the
  autocomplete menu and translation notes (except for embedded notes,
  which are usually meant to be seamless).
2021-02-23 05:39:15 -06:00
evazion
8894a31d74 css: remove dead autocomplete css.
Remove some rules intended to highlight the currently selected tag in
the autocomplete menu. The selected tag was supposed to be shown with
the tag hover color, but this didn't actually work because of CSS
specificity issues, and it possibly never worked to begin with, so it's
not worth fixing.
2021-02-23 05:39:15 -06:00
evazion
8c86662a5a css: revert styling of selected post in parent/child box.
Partial revert of b9ea9d2f5. Go back to using a semi-transparent
background to indicate the selected parent/child post, but add more
padding and adjust the transparency to make it more legible.
2021-02-23 05:39:15 -06:00
evazion
177de7c234 related tags: use checkboxes to indicate selected tags.
In the related tags list, use checkboxes and bold to indicate selected
tags, instead of highlighting selected tags with a blue background.

This is so that you can see the colors of selected tags in the related
tags list, and in particular so you can see the artist tag.
2021-02-23 05:38:12 -06:00
evazion
7b1815ad8e forum: change style of new/approved/pending/rejected labels.
Change the new, approved, pending, and rejected labels in the forum to
use an outlined pill style (like user levels in user tooltips) instead
of a filled background style. This is less obtrusive and more readable
in dark mode.
2021-02-22 03:43:47 -06:00
evazion
cde76e66f6 forms: fix form validation error messages.
* Fix it so that all edit forms show an error banner if the form
  has validation errors. Previously forms had to manually call
  `error_messages_for`, which not all forms did.

* Fix it so that the full validation error message is shown next to each
  input attribute that had errors. Also update the styling of these
  error messages to look better.
2021-02-22 02:38:26 -06:00
evazion
b9ea9d2f5a css: fix styling of selected post in parent/child box.
* On the post show page, in the parent/child box, change it so that
  currently selected post is more visible. Use a light blue outline
  around the current post instead of a dark semi-transparent border.

* Fix it so that there's less empty space around thumbnails in the
  parent/child box.
2021-02-22 02:38:26 -06:00
evazion
40712fb726 css: add red border around input fields with validation errors.
The .field_with_errors class is added by Simple Form to <input> fields
with validation errors.
2021-02-22 02:38:26 -06:00
evazion
1c1d784547 css: rework color scheme to use new color palette.
Add a new color palette and rework all site colors (both light mode and dark mode) to
use the new palette.

This ensures that colors are used consistently, from a carefully designed color palette,
instead of being chosen at random.

Before, colors in light mode were chosen on an ad-hoc basis, which resulted in a lot of
random colors and inconsistent design.

The new palette has 7 hues: red, orange, yellow, green, blue, azure (a lighter blue), and
purple. There's also a greyscale. Each hue has 10 shades of brightness, which (including
grey) gives us 80 total colors.

Colors are named like this:

    var(--red-0);    /* very light red */
    var(--red-2);    /* light red */
    var(--red-5);    /* medium red */
    var(--red-7);    /* dark red */
    var(--red-9);    /* very dark red */
    var(--green-7);  /* dark green */
    var(--blue-5);   /* medium blue */
    var(--purple-3); /* light purple */
                     /* etc */

The color palette is designed to meet the following criteria:

* To have close equivalents to the main colors used in the old color scheme,
  especially tag colors, so that changes to major colors are minimized.
* To produce a set of colors that can be used as as main text colors, as background
  colors, and as accent colors, both in light mode and dark mode.
* To ensure that colors at the same brightness level have the same perceived brightness.
  Green-4, blue-4, red-4, purple-4, etc should all have the same brightness and contrast
  ratios. This way colors look balanced. This is actually a difficult problem, because human
  color perception is non-linear, so you can't just scale brightness values linearly.

There's a color palette test page at https://danbooru.donmai/static/colors

Notable changes to colors in light mode:

* Username colors are the same as tag colors.
* Copyright tags are a deeper purple.
* Builders are a deeper purple (fixes #4626).
* Moderators are green.
* Gold users are orange.
* Parent borders are a darker green.
* Child borders are a darker orange.
* Unsaved notes have a thicker red border.
* Selected notes have a thicker blue (not green) border.
2021-02-22 02:32:49 -06:00
evazion
b598a11f02 css: add [hidden] rule. 2021-02-22 01:50:02 -06:00
evazion
150bcccb41 posts: make Enter key shortcut show deprecation message (#4661). 2021-02-18 19:25:45 -06:00
evazion
e165ad3213 notes: enable spellcheck in note edit box. 2021-02-18 04:04:06 -06:00
evazion
c1805cc4e0 views: factor out paginator component.
* Refactor the paginator into a ViewComponent.
* Fix inconsistent spacing between paginator items.
* Fix a bug where the sequential paginator generated the wrong next /
  previous page links in the <link rel="{next|prev}"> tags in the <head>.
* Always include the final page as a hidden html element, so that it can
  be unhidden with custom CSS.
* Make it easier to change the pagination window.
2021-02-18 02:47:21 -06:00
evazion
1fa049a18e related tags: remove artist urls; move artist tag to translated tags.
* Remove artist URLs from related tags.
* Move the artist tag to the top of the translated tags list.
2021-02-16 09:28:38 -06:00
evazion
19aea560db css: add box-sizing: border-box to base css.
This makes it so that an element's width includes borders and padding,
so that borders or padding don't cause an element to exceed its
specified width. This is a standard part of most CSS resets.

https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing
2021-02-16 09:28:38 -06:00
evazion
7b3322bfd1 css: increase IBM Plex Mono font weight.
Increase the font weight from 200 to 400 for the IBM Plex Mono font used
in notes. 400 is the standard weight we use for other fonts. 200 made
the font too thin and hard to read at normal font sizes.
2021-02-16 09:28:38 -06:00
evazion
b8d95ace64 css: adjust form input box sizes.
Adjust input boxes to fit the screen better on mobile, and to use
consistent sizes throughout the site (no ad-hoc overrides to make
certain input boxes a bit bigger in random places).

On desktop, this makes most input boxes a bit taller and narrower. On
mobile, it makes input boxes the full width of the screen.

This most notably affects the tag edit box, the comment and forum
post box, the wiki page edit box, and the commentary box.
2021-02-16 09:28:38 -06:00
evazion
e215fd1c47 css: factor out recent posts component. 2021-02-16 09:28:38 -06:00
evazion
1e80540a04 css: refactor CSS to use Tailwind-style utility classes.
Refactor CSS to use standard Tailwind-style utility classes instead of
ad-hoc rules. This eliminates a lot of single-purpose rules for specific
UI elements and standardizes margins to be more consistent throughout
the site.

Utility classes are defined manually on an as-needed basis instead of
importing Tailwind as a whole. Naming conventions mostly follow
Tailwind's conventions, otherwise they follow Bootstrap.

* https://tailwindcss.com/docs/
* https://getbootstrap.com/docs/5.0/utilities/spacing/
2021-02-16 09:28:38 -06:00
evazion
7b0fee6333 css: eliminate dead css. 2021-02-16 09:03:38 -06:00
evazion
5be2d420f6 tags: adjust post count style on /tags index.
Make the /tags index display post counts the same way as they're
displayed in regular tag lists (to the right of the tag, and greyed
out).
2021-02-16 04:42:53 -06:00
evazion
25fda1ecc2 api keys: add IP whitelist and API permission system.
Add the ability to restrict API keys so that they can only be used with
certain IP addresses or certain API endpoints.

Restricting your key is useful to limit damage in case it gets leaked or
stolen. For example, if your key is on a remote server and it gets
hacked, or if you accidentally check-in your key to Github.

Restricting your key's API permissions is useful if a third-party app or
script wants your key, but you don't want to give full access to your
account.

If you're an app or userscript developer, and your app needs an API key
from the user, you should only request a key with the minimum
permissions needed by your app.

If you have a privileged account, and you have scripts running under
your account, you are highly encouraged to restrict your key to limit
damage in case your key gets leaked or stolen.
2021-02-14 21:02:07 -06:00
evazion
37061f95a6 api keys: rework API key UI.
* Add an explanation of what an API key is and how to use it.
* Make it possible for the site owner to view all API keys.
* Remove the requirement to re-enter your password before you can view
  your API key (to be reworked).
* Move the API key controller from maintenance/user/api_keys_controller.rb
  to a top level controller.
2021-02-14 04:09:47 -06:00
evazion
ae204df4ca css: factor out button css.
Factor out the buttons from the user upgrades page into a general
UI component.
2021-02-14 02:56:19 -06:00
evazion
f42fe5f1f7 Upgrade font packages.
The `typefaces` project has been deprecated in favor of `fontsource`.

https://github.com/KyleAMathews/typefaces
https://github.com/fontsource/fontsource
2021-02-13 18:51:51 -06:00