Skip to content

Commit

Permalink
CS
Browse files Browse the repository at this point in the history
  • Loading branch information
bytehead committed Sep 4, 2023
1 parent 781ab28 commit 59be82e
Show file tree
Hide file tree
Showing 4 changed files with 546 additions and 11 deletions.
10 changes: 8 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ module.exports = {
browser: true,
es2021: true,
},
extends: 'standard-with-typescript',
extends: [
'standard-with-typescript',
'plugin:prettier/recommended'
],
overrides: [
{
env: {
Expand All @@ -19,5 +22,8 @@ module.exports = {
ecmaVersion: 'latest',
sourceType: 'module',
},
rules: {},
rules: {
"indent": ["error", 4],
"@typescript-eslint/no-floating-promises": "off"
},
}
9 changes: 4 additions & 5 deletions assets/SortableListView.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @ts-ignore
import Sortable from 'sortablejs'

declare global {
Expand Down Expand Up @@ -33,18 +32,18 @@ export class SortableListView {

Sortable.create(this.container, {
handle: 'td.tl_file_list:last-child a.drag.drag-handle',
onEnd: function (/**Event*/ event) {
onEnd: function (/** Event */ event) {
const item: HTMLElement = event.item
const href: string | undefined = item.querySelectorAll('a')?.[0].href
const id: string | undefined = href?.match(/id=(\d+)/)?.[1]
const action: string = window.location.href.match(/do=([^&]+)/)?.[1]
const action: string | undefined = window.location.href.match(/do=([^&]+)/)?.[1]
const requestUri: URL = new URL(window.location.href)
const url: URL = new URL(requestUri.origin + window.sortableListViews.path)
const formData: FormData = new FormData()

formData.append('REQUEST_TOKEN', window.sortableListViews.token)
formData.append('action', action)
formData.append('id', id)
formData.append('action', action ?? '')
formData.append('id', id ?? '')
formData.append('oldIndex', event.oldIndex)
formData.append('newIndex', event.newIndex)

Expand Down
Loading

0 comments on commit 59be82e

Please sign in to comment.