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.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import Utility from './utility'
|
||||
import CurrentUser from './current_user'
|
||||
import SavedSearch from './saved_searches'
|
||||
|
||||
let Autocomplete = {};
|
||||
@@ -14,7 +14,7 @@ Autocomplete.METATAGS_REGEX = Autocomplete.METATAGS.concat(Object.keys(Autocompl
|
||||
Autocomplete.TERM_REGEX = new RegExp(`([-~]*)(?:(${Autocomplete.METATAGS_REGEX}):)?(\\S*)$`, "i");
|
||||
|
||||
Autocomplete.initialize_all = function() {
|
||||
if (Utility.meta("enable-auto-complete") === "true") {
|
||||
if (CurrentUser.data("enable-auto-complete")) {
|
||||
$.widget("ui.autocomplete", $.ui.autocomplete, {
|
||||
options: {
|
||||
delay: 0,
|
||||
@@ -355,7 +355,7 @@ Autocomplete.render_item = function(list, item) {
|
||||
} else if (item.type === "user") {
|
||||
var level_class = "user-" + item.level.toLowerCase();
|
||||
$link.addClass(level_class);
|
||||
if (Utility.meta("style-usernames") === "true") {
|
||||
if (CurrentUser.data("style-usernames")) {
|
||||
$link.addClass("with-style");
|
||||
}
|
||||
} else if (item.type === "pool") {
|
||||
|
||||
Reference in New Issue
Block a user