PageSourceSearch

https://www.bvalue.it/assets/new.vendor/dropzone/hs.dropzone.js

js bvalue.it collected 2026-10-06 19:37:05 UTC 3,743 bytes, 138 lines download raw bytes

1/*
2* Dropzone wrapper
3* @version: 3.0.1 (Wed, 28 Jul 2021)
4* @requires: dropzone v5.5.0
5* @author: HtmlStream
6* @event-namespace: .HSCore.components.HSDropzone
7* @license: Htmlstream Libraries (https://htmlstream.com/licenses)
8* Copyright 2021 Htmlstream
9*/
10
11HSCore.components.HSDropzone = {
12  collection: [],
13
14  dataAttributeName: 'data-hs-dropzone-options',
15
16  defaults: {
17    // Default variables
18    url: "https://httpbin.org/anything",
19    thumbnailWidth: 300,
20    thumbnailHeight: 300,
21    previewTemplate: '<div class="col h-100 mb-4">' +
22      '    <div class="dz-preview dz-file-preview">' +
23      '      <div class="d-flex justify-content-end dz-close-icon">' +
24      '        <small class="bi-x" data-dz-remove></small>' +
25      '      </div>' +
26      '      <div class="dz-details d-flex">' +
27      '        <div class="dz-img flex-shrink-0">' +
28      '         <img class="img-fluid dz-img-inner" data-dz-thumbnail>' +
29      '        </div>' +
30      '        <div class="dz-file-wrapper flex-grow-1">' +
31      '         <h6 class="dz-filename">' +
32      '          <span class="dz-title" data-dz-name></span>' +
33      '         </h6>' +
34      '         <div class="dz-size" data-dz-size></div>' +
35      '        </div>' +
36      '      </div>' +
37      '      <div class="dz-progress progress">' +
38      '        <div class="dz-upload progress-bar bg-success" role="progressbar" style="width: 0" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" data-dz-uploadprogress></div>' +
39      '      </div>' +
40      '      <div class="d-flex align-items-center">' +
41      '        <div class="dz-success-mark">' +
42      '          <span class="bi-check-lg"></span>' +
43      '        </div>' +
44      '        <div class="dz-error-mark">' +
45      '          <span class="bi-x-lg"></span>' +
46      '        </div>' +
47      '        <div class="dz-error-message">' +
48      '          <small data-dz-errormessage></small>' +
49      '        </div>' +
50      '      </div>' +
51      '    </div>' +
52      '</div>'
53  },
54
55  init(el, options, id) {
56    const that = this
57    let elems
58
59    if (el instanceof HTMLElement) {
60      elems = [el]
61    } else if (el instanceof Object) {
62      elems = el
63    } else {
64      elems = document.querySelectorAll(el)
65    }
66
67    for (let i = 0; i < elems.length; i += 1) {
68      that.addToCollection(elems[i], options, id || elems[i].id)
69    }
70
71    if (!that.collection.length) {
72      return false;
73    }
74
75    // initialization calls
76    that._init()
77  },
78
79  addToCollection(item, options, id) {
80    const that = this
81
82    this.collection.push({
83      $el: item,
84      id: id || null,
85      options: Object.assign(
86        {},
87        that.defaults,
88        item.hasAttribute(that.dataAttributeName)
89          ? JSON.parse(item.getAttribute(that.dataAttributeName))
90          : {},
91        options,
92      ),
93    });
94  },
95
96  getItems() {
97    const that = this;
98    let newCollection = [];
99
100    for (let i = 0; i < that.collection.length; i += 1) {
101      newCollection.push(that.collection[i].$initializedEl);
102    }
103
104    return newCollection;
105  },
106
107  getItem(item) {
108    if (typeof item === 'number') {
109      return this.collection[item].$initializedEl;
110    } else {
111      return this.collection.find(el => {
112        return el.id === item;
113      }).$initializedEl;
114    }
115  },
116
117  _init() {
118    const that = this
119
120    for (let i = 0; i < that.collection.length; i += 1) {
121      let _options
122      let _$el
123
124      if (that.collection[i].hasOwnProperty('$initializedEl')) {
125        continue;
126      }
127
128      _options = that.collection[i].options
129      _$el = that.collection[i].$el
130
131      /* Start : Init */
132
133      that.collection[i].$initializedEl = new Dropzone(_$el, _options)
134
135      /* End : Init */
136    }
137  }
138}

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.