Files
danbooru/app/javascript/src/javascripts/common.js
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

34 lines
965 B
JavaScript

import Cookie from './cookie'
import CurrentUser from './current_user'
$(function() {
$("#hide-upgrade-account-notice").on("click.danbooru", function(e) {
$("#upgrade-account-notice").hide();
Cookie.put('hide_upgrade_account_notice', '1', 7);
e.preventDefault();
});
$("#hide-dmail-notice").on("click.danbooru", function(e) {
var $dmail_notice = $("#dmail-notice");
$dmail_notice.hide();
var dmail_id = $dmail_notice.data("id");
Cookie.put("hide_dmail_notice", dmail_id);
e.preventDefault();
});
$("#close-notice-link").on("click.danbooru", function(e) {
$('#notice').fadeOut("fast");
e.preventDefault();
});
$("#desktop-version-link a").on("click.danbooru", async function(e) {
e.preventDefault();
await CurrentUser.update({ disable_responsive_mode: true });
location.reload();
});
});
window.submitInvisibleRecaptchaForm = function () {
document.getElementById("signup-form").submit();
}