mirror of https://gitlab.com/tildes/tildes.git
Browse Source
Run prettier on JS files
Run prettier on JS files
$ node node_modules/.bin/prettier static/js/ --writemerge-requests/173/head
38 changed files with 159 additions and 205 deletions
-
7tildes/static/js/behaviors/auto-focus.js
-
10tildes/static/js/behaviors/autocomplete-chip-clear.js
-
33tildes/static/js/behaviors/autocomplete-input.js
-
20tildes/static/js/behaviors/autocomplete-menu-item.js
-
4tildes/static/js/behaviors/autocomplete-menu.js
-
4tildes/static/js/behaviors/autoselect-input.js
-
8tildes/static/js/behaviors/autosubmit-on-change.js
-
16tildes/static/js/behaviors/cancel-button.js
-
25tildes/static/js/behaviors/comment-collapse-all-button.js
-
4tildes/static/js/behaviors/comment-collapse-button.js
-
20tildes/static/js/behaviors/comment-collapse-read-button.js
-
19tildes/static/js/behaviors/comment-expand-all-button.js
-
27tildes/static/js/behaviors/comment-label-button.js
-
10tildes/static/js/behaviors/comment-parent-button.js
-
4tildes/static/js/behaviors/comment-reply-form.js
-
4tildes/static/js/behaviors/confirm-leave-page-unsaved.js
-
8tildes/static/js/behaviors/copy-button.js
-
8tildes/static/js/behaviors/ctrl-enter-submit-form.js
-
10tildes/static/js/behaviors/dropdown-toggle.js
-
4tildes/static/js/behaviors/external-links-new-tabs.js
-
8tildes/static/js/behaviors/fadeout-parent-on-success.js
-
4tildes/static/js/behaviors/group-links-new-tabs.js
-
4tildes/static/js/behaviors/hide-sidebar-if-open.js
-
4tildes/static/js/behaviors/hide-sidebar-no-preventdefault.js
-
12tildes/static/js/behaviors/markdown-edit-tab.js
-
14tildes/static/js/behaviors/markdown-preview-tab.js
-
6tildes/static/js/behaviors/prevent-double-submit.js
-
4tildes/static/js/behaviors/remove-on-click.js
-
4tildes/static/js/behaviors/remove-on-success.js
-
4tildes/static/js/behaviors/sidebar-toggle.js
-
4tildes/static/js/behaviors/stripe-checkout.js
-
4tildes/static/js/behaviors/stripe-donate-form.js
-
8tildes/static/js/behaviors/tab.js
-
4tildes/static/js/behaviors/theme-preview.js
-
15tildes/static/js/behaviors/theme-selector.js
-
6tildes/static/js/behaviors/time-period-select.js
-
4tildes/static/js/behaviors/user-links-new-tabs.js
-
10tildes/static/js/scripts.js
@ -1,14 +1,11 @@ |
|||
// Copyright (c) 2018 Tildes contributors <code@tildes.net>
|
|||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|||
|
|||
$.onmount("[data-js-auto-focus]", function() { |
|||
$.onmount("[data-js-auto-focus]", function () { |
|||
var $input = $(this); |
|||
|
|||
// just calling .focus() will place the cursor at the start of the field,
|
|||
// so un-setting and re-setting the value moves the cursor to the end
|
|||
var original_val = $input.val(); |
|||
$input |
|||
.focus() |
|||
.val("") |
|||
.val(original_val); |
|||
$input.focus().val("").val(original_val); |
|||
}); |
@ -1,8 +1,8 @@ |
|||
// Copyright (c) 2018 Tildes contributors <code@tildes.net>
|
|||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|||
|
|||
$.onmount("[data-js-autoselect-input]", function() { |
|||
$(this).click(function() { |
|||
$.onmount("[data-js-autoselect-input]", function () { |
|||
$(this).click(function () { |
|||
$(this).select(); |
|||
}); |
|||
}); |
@ -1,10 +1,8 @@ |
|||
// Copyright (c) 2018 Tildes contributors <code@tildes.net>
|
|||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|||
|
|||
$.onmount("[data-js-autosubmit-on-change]", function() { |
|||
$(this).change(function() { |
|||
$(this) |
|||
.closest("form") |
|||
.submit(); |
|||
$.onmount("[data-js-autosubmit-on-change]", function () { |
|||
$(this).change(function () { |
|||
$(this).closest("form").submit(); |
|||
}); |
|||
}); |
@ -1,24 +1,21 @@ |
|||
// Copyright (c) 2018 Tildes contributors <code@tildes.net>
|
|||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|||
|
|||
$.onmount("[data-js-comment-collapse-all-button]", function() { |
|||
$(this).click(function() { |
|||
$.onmount("[data-js-comment-collapse-all-button]", function () { |
|||
$(this).click(function () { |
|||
// first uncollapse any individually collapsed comments
|
|||
$(".is-comment-collapsed-individual").each(function(idx, child) { |
|||
$(child) |
|||
.find("[data-js-comment-collapse-button]:first") |
|||
.trigger("click"); |
|||
$(".is-comment-collapsed-individual").each(function (idx, child) { |
|||
$(child).find("[data-js-comment-collapse-button]:first").trigger("click"); |
|||
}); |
|||
|
|||
// then collapse all first-level replies
|
|||
$('.comment[data-comment-depth="1"]:not(.is-comment-collapsed)').each(function( |
|||
idx, |
|||
child |
|||
) { |
|||
$(child) |
|||
.find("[data-js-comment-collapse-button]:first") |
|||
.trigger("click"); |
|||
}); |
|||
$('.comment[data-comment-depth="1"]:not(.is-comment-collapsed)').each( |
|||
function (idx, child) { |
|||
$(child) |
|||
.find("[data-js-comment-collapse-button]:first") |
|||
.trigger("click"); |
|||
}, |
|||
); |
|||
|
|||
$(this).blur(); |
|||
}); |
|||
|
@ -1,16 +1,15 @@ |
|||
// Copyright (c) 2018 Tildes contributors <code@tildes.net>
|
|||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|||
|
|||
$.onmount("[data-js-comment-expand-all-button]", function() { |
|||
$(this).click(function() { |
|||
$(".is-comment-collapsed, .is-comment-collapsed-individual").each(function( |
|||
idx, |
|||
child |
|||
) { |
|||
$(child) |
|||
.find("[data-js-comment-collapse-button]:first") |
|||
.trigger("click"); |
|||
}); |
|||
$.onmount("[data-js-comment-expand-all-button]", function () { |
|||
$(this).click(function () { |
|||
$(".is-comment-collapsed, .is-comment-collapsed-individual").each( |
|||
function (idx, child) { |
|||
$(child) |
|||
.find("[data-js-comment-collapse-button]:first") |
|||
.trigger("click"); |
|||
}, |
|||
); |
|||
|
|||
$(this).blur(); |
|||
}); |
|||
|
@ -1,14 +1,14 @@ |
|||
// Copyright (c) 2018 Tildes contributors <code@tildes.net>
|
|||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|||
|
|||
$.onmount("[data-js-confirm-leave-page-unsaved]", function() { |
|||
$.onmount("[data-js-confirm-leave-page-unsaved]", function () { |
|||
var $form = $(this); |
|||
$form.areYouSure(); |
|||
|
|||
// Fixes a strange interaction between Intercooler and AreYouSure, where
|
|||
// submitting a form by using the keyboard to push the submit button would
|
|||
// trigger a confirmation prompt before leaving the page.
|
|||
$form.on("success.ic", function() { |
|||
$form.on("success.ic", function () { |
|||
$form.removeClass("dirty"); |
|||
}); |
|||
}); |
@ -1,15 +1,13 @@ |
|||
// Copyright (c) 2018 Tildes contributors <code@tildes.net>
|
|||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|||
|
|||
$.onmount("[data-js-ctrl-enter-submit-form]", function() { |
|||
$(this).keydown(function(event) { |
|||
$.onmount("[data-js-ctrl-enter-submit-form]", function () { |
|||
$(this).keydown(function (event) { |
|||
if ( |
|||
(event.ctrlKey || event.metaKey) && |
|||
(event.keyCode == 13 || event.keyCode == 10) |
|||
) { |
|||
$(this) |
|||
.closest("form") |
|||
.submit(); |
|||
$(this).closest("form").submit(); |
|||
} |
|||
}); |
|||
}); |
@ -1,10 +1,8 @@ |
|||
// Copyright (c) 2018 Tildes contributors <code@tildes.net>
|
|||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|||
|
|||
$.onmount("[data-js-fadeout-parent-on-success]", function() { |
|||
$(this).on("after.success.ic", function() { |
|||
$(this) |
|||
.parent() |
|||
.fadeOut("fast"); |
|||
$.onmount("[data-js-fadeout-parent-on-success]", function () { |
|||
$(this).on("after.success.ic", function () { |
|||
$(this).parent().fadeOut("fast"); |
|||
}); |
|||
}); |
@ -1,11 +1,11 @@ |
|||
// Copyright (c) 2020 Tildes contributors <code@tildes.net>
|
|||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|||
|
|||
$.onmount("[data-js-group-links-new-tabs]", function() { |
|||
$.onmount("[data-js-group-links-new-tabs]", function () { |
|||
// Open links to groups on Tildes in new tabs
|
|||
$(this) |
|||
.find(".link-group") |
|||
.each(function() { |
|||
.each(function () { |
|||
$(this).attr("target", "_blank"); |
|||
}); |
|||
}); |
@ -1,8 +1,8 @@ |
|||
// Copyright (c) 2018 Tildes contributors <code@tildes.net>
|
|||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|||
|
|||
$.onmount("[data-js-hide-sidebar-no-preventdefault]", function() { |
|||
$(this).on("click", function() { |
|||
$.onmount("[data-js-hide-sidebar-no-preventdefault]", function () { |
|||
$(this).on("click", function () { |
|||
$("#sidebar").removeClass("is-sidebar-displayed"); |
|||
}); |
|||
}); |
@ -1,8 +1,8 @@ |
|||
// Copyright (c) 2018 Tildes contributors <code@tildes.net>
|
|||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|||
|
|||
$.onmount("[data-js-remove-on-click]", function() { |
|||
$(this).on("click", function() { |
|||
$.onmount("[data-js-remove-on-click]", function () { |
|||
$(this).on("click", function () { |
|||
$(this).remove(); |
|||
}); |
|||
}); |
@ -1,8 +1,8 @@ |
|||
// Copyright (c) 2018 Tildes contributors <code@tildes.net>
|
|||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|||
|
|||
$.onmount("[data-js-remove-on-success]", function() { |
|||
$(this).on("after.success.ic", function() { |
|||
$.onmount("[data-js-remove-on-success]", function () { |
|||
$(this).on("after.success.ic", function () { |
|||
$(this).remove(); |
|||
}); |
|||
}); |
@ -1,10 +1,10 @@ |
|||
// Copyright (c) 2019 Tildes contributors <code@tildes.net>
|
|||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|||
|
|||
$.onmount("[data-js-stripe-checkout]", function() { |
|||
$.onmount("[data-js-stripe-checkout]", function () { |
|||
/* eslint-disable-next-line no-undef */ |
|||
var stripe = Stripe($(this).attr("data-js-stripe-checkout")); |
|||
stripe.redirectToCheckout({ |
|||
sessionId: $(this).attr("data-js-stripe-checkout-session") |
|||
sessionId: $(this).attr("data-js-stripe-checkout-session"), |
|||
}); |
|||
}); |
@ -1,11 +1,9 @@ |
|||
// Copyright (c) 2018 Tildes contributors <code@tildes.net>
|
|||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|||
|
|||
$.onmount("[data-js-tab]", function() { |
|||
$(this).click(function() { |
|||
$(this) |
|||
.siblings() |
|||
.removeClass("active"); |
|||
$.onmount("[data-js-tab]", function () { |
|||
$(this).click(function () { |
|||
$(this).siblings().removeClass("active"); |
|||
$(this).addClass("active"); |
|||
}); |
|||
}); |
@ -1,11 +1,11 @@ |
|||
// Copyright (c) 2020 Tildes contributors <code@tildes.net>
|
|||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|||
|
|||
$.onmount("[data-js-user-links-new-tabs]", function() { |
|||
$.onmount("[data-js-user-links-new-tabs]", function () { |
|||
// Open links to users on Tildes in new tabs
|
|||
$(this) |
|||
.find(".link-user") |
|||
.each(function() { |
|||
.each(function () { |
|||
$(this).attr("target", "_blank"); |
|||
}); |
|||
}); |
Write
Preview
Loading…
Cancel
Save
Reference in new issue