");
const blacklisted = DAB ? false : blacklist_hit_count > 0;
for (const key in postData) {
- newTag.attr("data-" + key.replace(/_/g, '-'), postData[key]);
+ newTag.attr("data-" + key.replace(/_/g, "-"), postData[key]);
}
- newTag.attr('class', blacklisted ? "post-thumbnail blacklisted" : "post-thumbnail");
- if (p.hasClass('thumb-placeholder-link'))
- newTag.addClass('dtext');
- const img = $('
![]()
');
- img.attr('src', postData.preview_url || '/images/deleted-preview.png');
+ newTag.attr("class", blacklisted ? "post-thumbnail blacklisted" : "post-thumbnail");
+ if (p.hasClass("thumb-placeholder-link"))
+ newTag.addClass("dtext");
+ const img = $("
![]()
");
+ img.attr("src", postData.preview_url || "/images/deleted-preview.png");
img.attr({
height: postData.preview_url ? postData.preview_height : 150,
width: postData.preview_url ? postData.preview_width : 150,
title: `Rating: ${postData.rating}\r\nID: ${postData.id}\r\nStatus: ${postData.status}\r\nDate: ${postData.created_at}\r\n\r\n${postData.tags}`,
alt: postData.tags,
- class: 'post-thumbnail-img'
+ class: "post-thumbnail-img",
});
- const link = $('
');
- link.attr('href', `/posts/${postData.id}`);
+ const link = $("");
+ link.attr("href", `/posts/${postData.id}`);
link.append(img);
newTag.append(link);
p.replaceWith(newTag);
@@ -60,12 +60,12 @@ Thumbnails.initialize = function () {
$(document).ready(function () {
Thumbnails.initialize();
- $(window).on('e621:add_deferred_posts', (_, posts) => {
- window.___deferred_posts = window.___deferred_posts || {}
+ $(window).on("e621:add_deferred_posts", (_, posts) => {
+ window.___deferred_posts = window.___deferred_posts || {};
window.___deferred_posts = $.extend(window.___deferred_posts, posts);
Thumbnails.initialize();
});
- $(document).on('thumbnails:apply', Thumbnails.initialize);
+ $(document).on("thumbnails:apply", Thumbnails.initialize);
});
export default Thumbnails;
diff --git a/app/javascript/src/javascripts/uploader.js b/app/javascript/src/javascripts/uploader.js
index 07c627877..5f8f6b4ee 100644
--- a/app/javascript/src/javascripts/uploader.js
+++ b/app/javascript/src/javascripts/uploader.js
@@ -1,9 +1,9 @@
-import Uploader from './uploader/uploader.vue.erb';
-import { createApp } from 'vue';
+import Uploader from "./uploader/uploader.vue.erb";
+import { createApp } from "vue";
export default {
- init() {
+ init () {
const app = createApp(Uploader);
- app.mount('#uploader');
- }
-}
+ app.mount("#uploader");
+ },
+};
diff --git a/app/javascript/src/javascripts/user_warning.js b/app/javascript/src/javascripts/user_warning.js
index c94251ddf..33f6f2531 100644
--- a/app/javascript/src/javascripts/user_warning.js
+++ b/app/javascript/src/javascripts/user_warning.js
@@ -1,23 +1,23 @@
-import Blip from './blips.js';
-import Comment from './comments.js';
-import DText from './dtext.js';
-import ForumPost from './forum_posts.js';
-import Utility from './utility.js';
+import Blip from "./blips.js";
+import Comment from "./comments.js";
+import DText from "./dtext.js";
+import ForumPost from "./forum_posts.js";
+import Utility from "./utility.js";
class UserWarnable {
- static initialize_click_handlers() {
- $('.item-mark-user-warned').on('click', evt => {
+ static initialize_click_handlers () {
+ $(".item-mark-user-warned").on("click", evt => {
evt.preventDefault();
const target = $(evt.target);
- const type = target.data('item-route');
- const id = target.data('item-id');
- const item_type = target.data('item-type');
- const record_type = target.data('record-type');
+ const type = target.data("item-route");
+ const id = target.data("item-id");
+ const item_type = target.data("item-type");
+ const record_type = target.data("record-type");
const message = record_type === "unmark"
? `Are you sure you want to unmark this ${item_type}?`
- : `Are you sure you want to mark this ${item_type} for having received ${record_type}?`
- if(!confirm(message)) {
+ : `Are you sure you want to mark this ${item_type} for having received ${record_type}?`;
+ if (!confirm(message)) {
return;
}
@@ -25,7 +25,7 @@ class UserWarnable {
type: "POST",
url: `/${type}/${id}/warning.json`,
data: {
- 'record_type': record_type
+ "record_type": record_type,
},
}).done(data => {
target.closest("article.blip, article.comment, article.forum-post").replaceWith(data.html);
@@ -42,7 +42,7 @@ class UserWarnable {
});
}
- static reinitialize_click_handlers() {
+ static reinitialize_click_handlers () {
$(".item-mark-user-warned").off("click");
this.initialize_click_handlers();
}
diff --git a/app/javascript/src/javascripts/utility.js b/app/javascript/src/javascripts/utility.js
index 09bdee93f..5f0bfe7d0 100644
--- a/app/javascript/src/javascripts/utility.js
+++ b/app/javascript/src/javascripts/utility.js
@@ -2,101 +2,101 @@ import Shortcuts from "./shortcuts";
let Utility = {};
-Utility.delay = function(milliseconds) {
+Utility.delay = function (milliseconds) {
return new Promise(resolve => setTimeout(resolve, milliseconds));
-}
+};
-Utility.meta = function(key) {
+Utility.meta = function (key) {
return $("meta[name=" + key + "]").attr("content");
-}
+};
-Utility.test_max_width = function(width) {
+Utility.test_max_width = function (width) {
if (!window.matchMedia) {
return false;
}
- var mq = window.matchMedia('(max-width: ' + width + 'px)');
+ var mq = window.matchMedia("(max-width: " + width + "px)");
return mq.matches;
-}
+};
Utility.notice_timeout_id = undefined;
-Utility.notice = function(msg, permanent) {
- $('#notice').addClass("ui-state-highlight").removeClass("ui-state-error").fadeIn("fast").children("span").html(msg);
+Utility.notice = function (msg, permanent) {
+ $("#notice").addClass("ui-state-highlight").removeClass("ui-state-error").fadeIn("fast").children("span").html(msg);
if (Utility.notice_timeout_id !== undefined) {
- clearTimeout(Utility.notice_timeout_id)
+ clearTimeout(Utility.notice_timeout_id);
}
if (!permanent) {
- Utility.notice_timeout_id = setTimeout(function() {
+ Utility.notice_timeout_id = setTimeout(function () {
$("#close-notice-link").click();
Utility.notice_timeout_id = undefined;
}, 6000);
}
-}
+};
-Utility.error = function(msg) {
- $('#notice').removeClass("ui-state-highlight").addClass("ui-state-error").fadeIn("fast").children("span").html(msg);
+Utility.error = function (msg) {
+ $("#notice").removeClass("ui-state-highlight").addClass("ui-state-error").fadeIn("fast").children("span").html(msg);
if (Utility.notice_timeout_id !== undefined) {
- clearTimeout(Utility.notice_timeout_id)
+ clearTimeout(Utility.notice_timeout_id);
}
-}
+};
-Utility.dialog = function(title, html) {
+Utility.dialog = function (title, html) {
const $dialog = $(html).dialog({
title: title,
width: 700,
modal: true,
- close: function() {
+ close: function () {
// Defer removing the dialog to avoid detaching the