PageSourceSearch

https://madeinsouthitalytoday.com/resources/engines/dataset/js.js?modified=1733856717

js madeinsouthitalytoday.com collected 2026-10-02 08:23:21 UTC 27,387 bytes, 945 lines download raw bytes

1$(document).ready(() => {
2  loadDatasetModules(document);
3});
4
5document.addEventListener('dsAjaxFormLoaded', (e) => {
6  loadDatasetModules(e.detail.element);
7});
8
9function loadDatasetModules(dom) {
10  dom.querySelectorAll('[data-ds-calculate]')
11    .forEach((tgt, k) => new DatasetCalculate(tgt));
12}
13
14class DatasetCalculate {
15  constructor(tgt) {
16    this.tgt = tgt;
17    this.left = this.getDom('left');
18    this.right = this.getDom('right');
19    // input for result value
20    this.target = this.getDom('target');
21
22    this.operator = this.tgt.getAttribute('data-ds-calculate-operator');
23    this.decimal = Number(this.tgt.getAttribute('data-ds-calculate-decimal'));
24
25    // listeners
26    this.left.addEventListener('keyup', () => this.update());
27    this.right.addEventListener('keyup', () => this.update());
28
29    this.update();
30  }
31
32  getDom(attr) {
33    var attr = `data-ds-calculate-${attr}`;
34    var domName = `F${this.tgt.getAttribute(attr)}`;
35    var dom = document.querySelector(`[name=${domName}]`);
36
37    if (!dom) {
38      console.error(`DOM with attr ${attr} not found!`);
39      return false;
40    }
41
42    return dom;
43  }
44
45
46  update() {
47    var left = Number(this.left.value);
48    var right = Number(this.right.value);
49
50    if (isNaN(left) || isNaN(right)) {
51      this.target.value = 'NaN!';
52      return;
53    }
54
55    var val = 0;
56    switch (this.operator) {
57      case '*':
58        val = left * right;
59        break;
60      case '/':
61        if (right == 0) {
62          this.target.value = 'Div by Zero!';
63          return;
64        }
65        val = left / right;
66        break;
67      case '+':
68        val = left + right;
69        break;
70      case '-':
71        val = left - right;
72        break;
73    }
74
75    this.target.value = NUMBERFORMAT(val, this.decimal, this.decimal);
76  }
77
78
79}
80
81function get_lookup_value(lookup) {
82  request = {};
83  request.handler = '/resources/engines/dataset/ajax/ds_lookup.php?';
84  switch (lookup.mode) {
85    case "single":
86      search = $('[name=F' + lookup.dependancy.id + ']').val();
87      request.search_value = escape(search);
88      request.mode = 'single';
89      request.source_field = lookup.fieldid;
90      break;
91
92    case "all":
93      field_values = "";
94      for (i = 0; i < lookup.fields.length; i++) {
95        id = lookup.fields[i];
96        element = $('[name=F' + id + ']');
97
98        switch (true) {
99          case !$(element).length:
100            value = $('[name="F' + id + '\\[\\]"]:checked').val();
101            break;
102
103          case $(element).attr('type') == 'radio':
104            value = '';
105            $(element).each
106              (
107                function () {
108                  if ($(this).attr('checked')) {
109                    value = $(this).val();
110                    return true;
111                  }
112                }
113              );
114            break;
115
116          default:
117            value = $(element).val();
118            break;
119        }
120
121        if (typeof (value) == 'undefined') {
122          value = '';
123        }
124
125        field_values += 'i:' + lookup.fields[i] + ';s:' + value.length + ':"' + value + '";';
126      }
127
128      field_values = 'a:' + lookup.fields.length + ':{' + field_values + '}';
129      request.mode = 'all';
130      request.dataset = lookup.dataset;
131      request.field_values = escape(field_values);
132      break;
133  }
134  ajax(request, fill_lookup_value);
135}
136
137function fill_lookup_value(result) {
138  errors = new Array();
139  result = eval('(' + result + ')');
140  for (i = 0; i < result.length; i++) {
141    object = result[i];
142    //document.forms[0].elements['F' + object.id].value = unescape(object.value);
143    $('[name=F' + object.id + ']').val(unescape(object.value))
144    if (object.error) {
145      errors.push(object.name + " Returned " + object.error);
146    }
147  }
148
149  if (errors.length > 0) {
150    alert(errors.join("\n"));
151  }
152}
153
154function gallery_image_upload(name, el, stored, limit) {
155  vext = 'zip,jpg,jpeg';
156  error = $('#' + name + '_error').get(0)//GID(name + '_error');
157  files = 0;
158  stored = new Number(stored);
159
160  file = document.createElement('input');
161  file.type = 'file';
162  file.name = name + '[]';
163  file.onchange = function () { gallery_image_upload(name, this, stored, limit); }
164
165  add_object = false;
166  form_objects = document.forms[0].elements;
167  for (o = 0; o < form_objects.length; o++) {
168    if (form_objects[o].name == name + '[]') {
169      files++;
170      object = form_objects[o];
171      object_error = name + '_gallery_error[' + o + ']';
172      object_parent = object.parentNode;
173      if (!GID(object_error)) {
174        span = document.createElement('span');
175        span.className = 'errorcellhints';
176        span.id = object_error;
177        span.innerHTML = vext;
178        object_parent.insertBefore(span, error);
179        object_parent.insertBefore(document.createElement('br'), error);
180      }
181
182      object_error = GID(object_error);
183
184      if (VEXT(object.value, vext)) {
185        add_object = true;
186        file_path = object.value;
187        path_split = false;
188        if (file_path.indexOf('\\') > 0) {
189          path_split = '\\';
190        }
191
192        if (file_path.indexOf('/') > 0) {
193          path_split = '/';
194        }
195
196        if (path_split) {
197          file_path = file_path.split(path_split);
198          file_path = file_path[file_path.length - 1];
199        }
200
201        object_error.innerHTML = file_path;
202        object_error.className = 'errorcellvalid';
203      }
204      else {
205        object_parent.replaceChild(file, object);
206        object_error.innerHTML = 'must be ' + vext;
207        object_error.className = 'errorcellerror';
208        add_object = false;
209      }
210    }
211  }
212
213  if (limit > 0 && (files + stored) >= limit) {
214    add_object = false;
215    error.innerHTML = ' limit reached';
216  }
217
218  if (add_object && el == object) {
219    object_parent.insertBefore(file, error);
220  }
221}
222
223/* DELETE AUG 09 2015
224function ds_gallery_manage()
225{
226  Sortable.create('ds_gallery_container', {
227          tag: 'img',
228          constraint: false,
229          overlap: 'horizontal',
230          containment: ['ds_gallery_container', 'ds_gallery_trash'],
231          only: 'ds_gallery_image'
232          });
233
234  Droppables.add('ds_gallery_trash', {accept: 'ds_gallery_image', onDrop: ds_gallery_delete_image});
235}
236
237function ds_gallery_delete_image(dragged)
238{
239  if (confirm('Delete this image?'))
240  {
241    dragged.toggle('appear');
242    ds_gallery.trash.push(dragged.alt);
243  }
244}
245
246function ds_gallery_save()
247{
248  save = ds_gallery.save +
249      '&images=' + Sortable.sequence('ds_gallery_container') +
250      '&trash=' + ds_gallery.trash.join(',');
251
252  location = save;
253}
254*/
255
256function ds_gallery_manual(dir, config) {
257  holder = GID('ds_gallery_image_' + config.key);
258  index = GID('ds_gallery_index_' + config.key);
259
260  active = new Number(holder.alt) + new Number(dir);
261  images = config.images;
262
263  if (active < 0) {
264    active = images.length - 1;
265  }
266
267  if (active > images.length - 1) {
268    active = 0;
269  }
270
271  holder.src = images[active];
272  holder.alt = active;
273  index.innerHTML = active + 1;
274}
275
276/*
277// Replaced with class DatasetCalculate()
278function ds_calculate(left, operator, right, decimal, target) {
279  var form = $('[name=F' + target + ']').closest('form');
280  value = 'n/a';
281  left = new Number($(form).find('[name=F' + left + ']').val());
282  right = new Number($(form).find('[name=F' + right + ']').val());
283  decimal = new Number(decimal);
284
285  if (left != '' && right != '') {
286    value = eval(left + ' ' + operator + ' ' + right);
287    value = NUMBERFORMAT(value, decimal, decimal);
288  }
289  $(form).find('[name=F' + target + ']').val(value);
290}
291*/
292
293function ds_check_unique(field, record) {
294  var tgt = $("[name=F" + field + "]");
295  var frm = $(tgt).closest("form");
296
297  if (typeof current_ds == "undefined") {
298    current_ds = Number($(frm).find("[name=dataset]").val());
299  }
300
301  request = new Object();
302  request.handler = '/resources/engines/dataset/ajax/ds_unique.php?';
303  request.dataset = current_ds;
304  request.value = document.forms[0].elements['F' + field].value;
305  request.record = record;
306  request.field = field;
307
308  field = 'F' + field + '_unique';
309  document.forms[0].elements[field].value = 0;
310  ajax(request, ds_update_unique);
311}
312
313function ds_update_unique(result) {
314  result = eval('(' + result + ')');
315  field = 'F' + result.field + '_unique';
316  document.forms[0].elements[field].value = result.unique;
317}
318
319function ds_load_form_finished(result) {
320  $('#ds-form-cell').html(result); //__GID__('ds-form-cell').innerHTML = result;
321}
322
323function ds_loaded_form_submit(form) {
324  var valid = validate.submit(form);
325  if (valid) {
326    var request = {};
327    request.config =
328    {
329      url: '/resources/engines/dataset/ajax/ds_form.php',
330      post: true
331    };
332    request.data = {};
333
334    for (var i = 0; i < form.elements.length; i++) {
335      request.data[form.elements[i].name] = form.elements[i].value;
336    }
337
338    ajax(request, ds_load_form_finished);
339  }
340
341  return false;
342}
343
344function ds_load_form_html(result) {
345  $('#ds-form-cell').html(result); //__GID__('ds-form-cell').innerHTML = result;
346
347  if ($('#ds-form-cell').hasClass('overlay-darken')) {
348    darkenScreen(80);
349    $('#ds-form-cell').css('z-index', $('#darkenScreen').css('z-index') + 1);
350    $('#ds-form-cell').center();
351    $('#ds-form-cell').fadeIn();
352  }
353  else {
354    $.scrollTo($('#ds-form-cell'));
355  }
356
357  //form = $('#ds-form-cell').find('form').get(0); 
358  $('#ds-form-cell').find('form').validate('form');
359
360  var lookup_auto = $('#ds-form-cell').find('form').find('[name=lookup-auto]');
361  if ($(lookup_auto).length) {
362    var lookup = $(lookup_auto).val();
363    eval('lookup = ' + lookup);
364    get_lookup_value(lookup);
365  }
366
367  // load country/region triggers
368  earth_init();
369
370  // set ajax form to submit via api, not default form
371  if ($("#ds-form-cell[data-api-submit]").length) {
372    $("#ds-form-cell").find("form").submit(dataset.form.api);
373  }
374}
375
376function ds_cancel_form() {
377  if (!$('#ds-form-cell').length) return true;
378
379  if ($('#ds-form-cell').hasClass('overlay-darken')) {
380    $('#ds-form-cell').remove();
381    darkenScreen(0);
382  }
383  else {
384    var row = $('#ds-form-cell').closest('tr').get(0); // __GID__('ds-form-cell').parentNode;
385    row.parentNode.parentNode.deleteRow(row.rowIndex);
386  }
387}
388
389function ds_load_form(config) {
390  ds_cancel_form();
391
392  var overlay = false;
393  if (typeof (config.overlay) != 'undefined') {
394    var overlay = config.overlay;
395  }
396
397  var link_id = config.link_id;
398
399  request = new Object();
400  request.handler = '/resources/engines/dataset/ajax/ds_form.php?';
401  request.dataset = config.dataset;
402  request.field = config.field;
403  request.value = config.value;
404
405  if (!overlay) {
406    var row = false;
407    var p = $('#' + link_id).get(0); // __GID__(link_id).parentNode;
408    while (!row) {
409      if (p.nodeName == 'TR') {
410        row = p;
411      }
412      else {
413        p = p.parentNode;
414      }
415    }
416
417    var table = row.parentNode.parentNode;
418    row_index = row.rowIndex;
419
420    var colspan = 0;
421    for (var i = 0; i < row.cells.length; i++) {
422      colspan += row.cells[i].colSpan;
423    }
424
425    var tr = table.insertRow(row.rowIndex);
426    var td = tr.insertCell(0);
427    td.colSpan = colspan;
428    td.className = row.cells[0].className;
429    td.id = 'ds-form-cell';
430    request.table_id = table.id;
431    request.row_index = row_index - 1;
432  }
433  else {
434    div = document.createElement('div');
435    d_class = [];
436    d_class.push('overlay-darken');
437    //console.log(overlay)
438    if (overlay != 'true') {
439      d_class.push(overlay);
440    }
441    div.className = d_class.join(' ');
442    div.id = 'ds-form-cell';
443    $(div).attr("data-api-submit", true);
444    document.body.appendChild(div);
445  }
446
447  if (config.notify) {
448    request.notify = config.notify; // field to use
449  }
450
451  url = request.handler;
452  data = request;
453  $.ajax({ url: url, data: data, success: ds_load_form_html });
454}
455
456function ds_load_form_message(config) {
457  var table = $('#' + config.table).get(0); //__GID__(config.table);
458  if (table.className == 'datasettabletable') {
459    config.row++;
460  }
461  var row = table.rows[config.row];
462
463  var colspan = 0;
464  for (var i = 0; i < row.cells.length; i++) {
465    colspan += row.cells[i].colSpan;
466  }
467
468  var tr = table.insertRow(config.row);
469  var td = tr.insertCell(0);
470  td.colSpan = colspan;
471  td.className = row.cells[0].className;
472  td.innerHTML = '<br>' + config.message;
473  location = location;
474}
475
476function ds_module_magnify(id, config) {
477  if (config.mode == 'standard') {
478    var options =
479    {
480      zoomrange: [3, 10],
481      magnifiersize: [config.standard.width - 5, config.standard.height - 5],
482      magnifierpos: config.standard.position,
483      cursorshadecolor: 'white',
484      cursorshadeopacity: 0.3,
485      cursorshadeborder: '1px solid black',
486      cursorshade: false
487    }
488
489    $('.image-magnify-' + id).each
490      (
491        function () {
492          options.largeimage = $(this).prop('href');
493          $(this).children().addimagezoom(options);
494        }
495      );
496  }
497
498  /*
499  if (config.mode == 'innerzoom')
500  {
501    $('.image-magnify-' + id).jqzoom
502    (
503      {
504        zoomType: 'innerzoom',
505        preloadImages: false
506      }
507    );
508  }
509  */
510
511}
512
513function dataset_search(form, dynamic) {
514  var range = false;
515  query = 'q:' + escape(form.q.value);
516
517  for (var i = 0; i < form.elements.length; i++) {
518    var test_name = form.elements[i].name.split('');
519    if (test_name[0] != 'f' || form.elements[i].value.length == 0) {
520      continue;
521    }
522
523    var value = escape(form.elements[i].value);
524    query += ',' + form.elements[i].name + ':' + value;
525    range = true;
526  }
527
528  if (range) {
529    for (var i = 0; i < form.range.length; i++) {
530      if (form.range[i].checked) {
531        query += ',range:' + form.range[i].value;
532      }
533    }
534  }
535
536  if (form.elements['sort']) {
537    sort = form.elements['sort'].value;
538    if (sort != '') {
539      query += ',sort:' + sort;
540    }
541  }
542
543  if (dynamic) {
544    return query;
545  }
546  else {
547    pre_query = form.query.value;
548    pre_query += 'module[' + form.module.value + ']=';
549    location = pre_query + query;
550    return false;
551  }
552}
553
554$(document).ready
555  (
556    function () {
557      // select dependants
558      $('select').each
559        (
560          function () {
561            var config = $(this).attr('data-lookup');
562            var target = $(this);
563            if (config) {
564              eval('var config = ' + config);
565              $('#dataset-field-' + config.dependancy).change
566                (
567                  function () {
568                    var options = $(target).get(0).options;
569                    options.length = 0;
570                    label = config.default_label ? config.default_label : 'Select';
571                    options[options.length] = new Option(label, '');
572
573                    var load_list = function (result) {
574                      for (var i = 0; i < result.length; i++) {
575                        options[options.length] = new Option(result[i], result[i]);
576                      }
577                      $(target).val($(target).attr('data-value'));
578                      $(target).trigger('change');
579                    }
580
581                    data = config;
582                    data['mode'] = 'list';
583                    data['value'] = $(this).val();
584                    $.ajax
585                      (
586                        {
587                          url: '/resources/engines/dataset/ajax/ds_lookup.php',
588                          data: data,
589                          dataType: 'json',
590                          cache: false,
591                          success: load_list
592                        }
593                      );
594                  }
595                );
596            }
597          }
598        );
599
600      $('select').each
601        (
602          function () {
603            var config = $(this).attr('data-lookup');
604            var target = $(this);
605            if (config) {
606              eval('var config = ' + config);
607              $('#dataset-field-' + config.dependancy).trigger('change');
608            }
609          }
610        );
611
612      // ajax_form
613      $('[data-ajax-form]').each
614        (
615          function () {
616            $(this).css('cursor', 'pointer');
617            $(this).click
618              (
619                function () {
620
621                  eval('data = ' + $(this).attr('data-ajax-form'));
622                  $.ajax
623                    (
624                      {
625                        url: '/resources/engines/dataset/ajax/form.php',
626                        data: data,
627                        success: function (result) {
628                          var div = document.createElement('div');
629                          $(div).addClass('ds-ajax-form');
630                          $(div).html(result);
631                          $('body').append(div);
632                          var close = document.createElement('button');
633                          $(close).html('Cancel');
634                          $(close).click(function () { $(div).remove() });
635                          $(div).find('form').append(close);
636                          $(div).center();
637                          $(div).draggable();
638
639                          $(div).find('form').validate();
640                          document.dispatchEvent(new CustomEvent("dsAjaxFormLoaded", {
641                            detail: { element: div }
642                          }));
643
644                          // lookup-auto
645                          var lookup_auto = $(div).find('form').find('input[name=lookup-auto]');
646                          if ($(lookup_auto).length) {
647                            var lookup = $(lookup_auto).val();
648                            eval('lookup = ' + lookup);
649                            get_lookup_value(lookup);
650                          }
651
652                          $(div).find('form').submit
653                            (
654                              function () {
655                                if ($(this).validate('send')) {
656                                  $(this).find(':input').each
657                                    (
658                                      function () {
659                                        data[$(this).attr('name')] = $(this).val();
660                                      }
661                                    );
662                                  $.ajax
663                                    (
664                                      {
665                                        url: '/resources/engines/dataset/ajax/form.php?id=' + data.id,
666                                        data: data,
667                                        type: 'POST',
668                                        success: function (result) {
669                                          location.reload();
670                                        }
671                                      }
672                                    );
673                                }
674
675                                return false;
676                              }
677                            );
678                        }
679                      }
680                    );
681                }
682              );
683          }
684        );
685
686      // ajax delete
687      $('[data-ajax-delete]').each
688        (
689          function () {
690            $(this).css('cursor', 'pointer');
691            $(this).click
692              (
693                function () {
694                  eval('data = ' + $(this).attr('data-ajax-delete'));
695                  var div = document.createElement('div');
696                  $(div).addClass('ds-ajax-form');
697                  $(div).html('<div style="padding: 0 0 5px 0">Confirm Delete?</div>');
698                  var btn_delete = document.createElement('button');
699                  $(btn_delete).html('Delete');
700                  $(btn_delete).click
701                    (
702                      function () {
703                        $.ajax
704                          (
705                            {
706                              url: '/resources/engines/dataset/ajax/delete.php',
707                              data: data,
708                              success: function (result) {
709                                if (!result.length) {
710                                  $(div).html('Record deleted');
711                                  $(div).delay(1500).fadeOut('fast', function () { location.reload(); });
712                                }
713                                else {
714                                  $(div).html(result);
715                                  $(div).delay(2500).fadeOut();
716                                }
717                              }
718                            }
719                          );
720                      }
721                    );
722                  $(div).append(btn_delete);
723
724                  var btn_cancel = document.createElement('button');
725                  $(btn_cancel).html('Cancel');
726                  $(btn_cancel).click(function () { $(div).remove() });
727                  $(div).append(btn_cancel);
728
729                  $(div).center();
730                  $(div).draggable();
731                  $('body').append(div);
732
733                }
734              );
735          }
736        );
737
738      $('[data-ajax-checkbox]').click
739        (
740          function () {
741            eval('var config = ' + $(this).attr('data-ajax-checkbox'));
742            var name = $(this).attr('name');
743            name = name.replace('[', '\\[');
744            name = name.replace(']', '\\]');
745            var value = [];
746            var group = $('[name=' + name + ']');
747            $(group).each
748              (
749                function () {
750                  if ($(this).attr('checked')) {
751                    value.push($(this).val());
752                  }
753                }
754              );
755
756            valid = true;
757            if (config.required && !value.length) {
758              message('Required');
759              valid = false;
760            }
761
762            if (valid) {
763              config.value = JSON.stringify(value);
764              $.ajax
765                (
766                  {
767                    url: '/resources/engines/dataset/ajax/checkbox.php',
768                    data: config,
769                    cache: false,
770                    success: function (result) {
771                      if (result.length) {
772                        message(result);
773                      }
774                    }
775                  }
776                );
777            }
778          }
779        );
780
781      $('[data-ds-reveal]').click
782        (
783          function () {
784            $(this).next('.ds-reveal').toggle();
785          }
786        );
787
788      // page look up all
789      var lookup_auto = $('form[name^=dataset]').find('input[name=lookup-auto]');
790      if ($(lookup_auto).length) {
791        var lookup = $(lookup_auto).val();
792        eval('lookup = ' + lookup);
793        get_lookup_value(lookup);
794      }
795
796      // set calendar cell w/h
797      if ($('.ds-calendar-container').length) {
798        var available_width = $('.ds-calendar-container').width();
799        var cell_size = Math.round(((available_width - 16) / 7) - 5);
800        $('.ds_calendar_dow').css('width', cell_size);
801        $('.ds_calendar_block').css('width', cell_size);
802        $('.ds_calendar_block').css('height', cell_size);
803      }
804
805      var message = function (message) {
806        var div = document.createElement('div');
807        $(div).addClass('ds-ajax-form');
808        $(div).html(message);
809        $(div).center();
810        $(div).draggable();
811        //$(div).click(function (){$(this).fadeOut()});
812        $(div).delay(2500).fadeOut();
813        $('body').append(div);
814      }
815
816      // streamline; form settings/Required Fields: only
817      $('[name=streamline-expand]').each
818        (
819          function () {
820            var form = $(this).closest('form');
821            $(form).find('[data-validation]').each
822              (
823                function () {
824                  eval('var config = ' + $(this).attr('data-validation'));
825                  var tr = $(this).closest('tr');
826                  if ("required" in config) {
827                    return;
828                  }
829
830                  if (!$(tr).is("[data-id]")) {
831                    return;
832                  }
833
834                  $(tr).attr('data-streamline', 'true');
835
836                  // check for label break issue
837                  if (typeof $(tr).attr('data-id') == 'undefined') {
838                    $(tr).prev().attr('data-streamline', 'true');
839                  }
840                }
841              );
842
843            var div = document.createElement('div');
844            var a = document.createElement('a');
845            $(a).attr('data-streamline-state', 1);
846            $(a).css('cursor', 'pointer');
847            $(a).click
848              (
849                function () {
850                  if ($(this).attr('data-streamline-state') == 1) {
851                    $(this).attr('data-streamline-state', 0);
852                    $(this).html($(form).find('[name=streamline-expand]').val());
853                    $('[data-streamline]').hide();
854                  }
855                  else {
856                    $(this).attr('data-streamline-state', 1);
857                    $(this).html($(form).find('[name=streamline-collapse]').val());
858                    $('[data-streamline]').show();
859                  }
860
861                }
862              );
863            $(div).append('<br>');
864            $(div).append(a);
865            $(form).append(div);
866            $(a).trigger('click');
867
868            //$('[data-streamline]').hide();
869          }
870        );
871
872      $('[data-manage-gallery]').each
873        (
874          function () {
875            container = this;
876            gallery_trash = [];
877            restore = $(this).find('[data-restore]');
878            $(restore).hide();
879            $(restore).click
880              (
881                function () {
882                  $(gallery_trash).each
883                    (
884                      function () {
885                        $(this).css('display', '');
886                      }
887                    );
888                  gallery_trash = [];
889                  $(this).hide();
890                }
891              );
892
893            $(this).sortable
894              (
895                {
896                  items: '[data-image-id]'
897                }
898              );
899
900            $(this).find('[data-trash]').droppable
901              (
902                {
903                  drop: function (e, ui) {
904                    i = ui.draggable.context;
905                    $(i).hide();
906                    gallery_trash.push(i);
907
908                    $(restore).show();
909                  }
910                }
911              );
912
913            $(this).find('[data-save-gallery]').click
914              (
915                function () {
916                  images = [];
917                  trash = [];
918
919                  $(container).find('[data-image-id]:visible').each
920                    (
921                      function () {
922                        images.push($(this).attr('data-image-id'))
923                      }
924                    );
925
926                  $(gallery_trash).each
927                    (
928                      function () {
929                        trash.push($(this).attr('data-image-id'));
930                      }
931                    )
932
933
934                  href = $(this).attr('data-save-gallery');
935                  //href += '&save-ds-gallery=' + $(container).attr('data-manage-gallery');
936                  href += '&images=' + images.join(',');
937                  href += '&trash=' + trash.join(',');
938
939                  location = href;
940                }
941              )
942          }
943        );
944    }
945  );

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.