Files
danbooru/app/helpers
evazion 52013eac1f posts: use low quality thumbnails when Save-Data header is set.
When the Save-Data HTTP header is present, disable high quality (2x
pixel density) thumbnails. This is normally set when "Data Saver mode"
is enabled on Android, or "Lite mode" is enabled in Chrome.

This setting can also be set using the `save_data` URL param or HTTP
cookie. This is mainly for testing.

The <body> tag has a `current-user-save-data` data attribute that
indicates whether save data mode is on.

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Save-Data
https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/save-data/#the_save-data_request_header
https://source.android.com/devices/tech/connect/data-saver
2021-12-09 20:08:27 -06:00
..
2021-09-27 00:46:13 -05:00

Helpers

This directory contains helper functions used by views. Helpers are used for simple common functions, such as linking to users or formatting timestamps.

Helper functions are globals. If you see an unnamespaced function in a view, and it's not a Rails function, then it's probably a helper defined here.

All helper functions defined in this directory are globally available to all views. They're not limited to single views. For example, the functions in posts_helper.rb are available to all views, not just to app/views/posts.

The use of helper functions should be minimized. Partials or components are preferred for more complex widgets, or for things used in only one or two places. Helper functions should be limited to very simple things used in nearly all views.

See also

External links