PageSourceSearch

https://daveconservatoire.org/assets/controllers/homesort_controll…bf34c5440b8847fbecec92d3e8d5918728ad5c7a.js

js daveconservatoire.org collected 2026-09-29 12:30:32 UTC 1,432 bytes, 68 lines download raw bytes

1import { Controller } from "@hotwired/stimulus";
2import Sortable from "sortablejs";
3
4
5
6export default class extends Controller {
7
8  static targets = [ "row", "parent"];
9  connect() {
10
11
12  let parentDiv = document.getElementById("homepage-parent");
13    
14    
15      this.rowTargets.forEach(el => {
16        el.sortable=Sortable.create(el, {
17          group: 'shared',
18          animation: 150,
19          onSort: this.sort.bind(this),
20        });
21
22      });
23
24      this.rowTargets.forEach(el => {
25        var newDiv=document.createElement('div');
26        newDiv.classList="row justify-content-center homepage-row";
27        newDiv.setAttribute("data-homesort-target", "row");
28      
29        newDiv.sortable=Sortable.create(parentDiv.insertBefore(newDiv, el), {
30          group: 'shared',
31          animation: 150,
32          onSort: this.sort.bind(this),
33        });
34       ; 
35      });
36
37      
38
39
40  }
41
42  sort(event) {
43    const homerows = [];
44    
45    this.rowTargets.forEach(el => {
46      if(el.children.length > 0) {
47        homerows.push(el.children.length);
48      } 
49    });
50console.log(homerows);
51
52
53fetch("/admin/sort/homepage", {
54  method: "POST",
55  headers: {
56    Accept: "application/json",
57    "Content-Type": "application/json",
58    "X-CSRF-Token": document.querySelector('meta[name="csrf-token"]')
59      .content,
60  },
61  body: JSON.stringify({
62      position: homerows
63  }),
64}).then((response) => location.reload())
65
66   
67  }
68};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.