PageSourceSearch

https://www.goldenstatemint.com/skin/common_files/js/ajax.products.js?v=1790419157

js goldenstatemint.com collected 2026-09-26 10:41:01 UTC 2,672 bytes, 124 lines download raw bytes

1/* vim: set ts=2 sw=2 sts=2 et: */
2/**
3 * Ajax Products list widget
4 * 
5 * @category   X-Cart
6 * @package    X-Cart
7 * @subpackage JS Library
8 * @author     Ruslan R. Fazlyev <[email protected]> 
9 * @version    2a321c65d1ad1429f47434729de546ac23ecdfac, v4 (xcart_4_7_11), 2019-04-25 08:59:19, ajax.products.js, aim
10 * @link       https://www.x-cart.com/
11 * @see        ____file_see____
12 */
13
14ajax.widgets.products = function(elm) {
15  if (!elm) {
16    elm = $('.products');
17
18  } else {
19    elm = $(elm);
20  }
21
22  elm.each(
23    function() {
24      if (!this.productsWidget)
25        new ajax.widgets.products.obj(this);
26    }
27  );
28
29  return true;
30}
31
32ajax.widgets.products.obj = function(elm) {
33  this.elm = elm;
34  this.elm$ = $(elm);
35
36  elm.productsWidget = this;
37
38  this.type = false;
39
40  if (this.elm$.hasClass('products-list')) {
41    this.type = 'list';
42
43  } else if (this.elm$.hasClass('products-table')) {
44    this.type = 'matrix';
45
46  }
47
48  this._getProducts();
49}
50
51ajax.widgets.products.obj.prototype.elm = false;
52ajax.widgets.products.obj.prototype.products = [];
53ajax.widgets.products.obj.prototype.type = false;
54
55ajax.widgets.products.obj.prototype.isReady = function() {
56  return this.type && this.products.length > 0 && this.checkElement();
57}
58
59ajax.widgets.products.obj.prototype.checkElement = function(elm) {
60  if (!elm)
61    elm = this.elm;
62
63  return typeof(elm) != 'undefiend' && elm.tagName && $(elm).hasClass('products');
64}
65
66/* Private */
67
68// Widget :: get products
69ajax.widgets.products.obj.prototype._getProducts = function() {
70  if (!ajax.widgets.product)
71    return false;
72
73  this.products = [];
74
75  var arr = [];
76
77  if (this.type == 'list') {
78
79    // Plain list
80    arr = this.elm$.children('.item').get();
81
82  } else if (this.type == 'matrix') {
83
84    // Matrix
85    var vSize = -1;
86    for (var i = 1; i < this.elm.rows.length && vSize < 0; i++) {
87      if ($(this.elm.rows[i]).hasClass('product-name-row'))
88        vSize = i;
89    }
90
91    if (vSize < 0)
92      vSize = this.elm.rows.length;
93
94    var hSize = this.elm.rows[0].cells.length;
95    var size = vSize * hSize;
96
97    for (var r = 0; r < this.elm.rows.length; r++) {
98      for (var c = 0; c < this.elm.rows[r].cells.length; c++) {
99        var pn = Math.floor(r / vSize) * vSize + c;
100        if (!arr[pn])
101          arr[pn] = [];
102
103        arr[pn][arr[pn].length] = this.elm.rows[r].cells[c];
104      }
105    } 
106
107  }
108
109  for (var i = 0; i < arr.length; i++) {
110    var p = new ajax.widgets.product(arr[i]);
111    this.products[this.products.length] = p;
112  }
113
114  return this.products.length > 0;
115}
116
117
118// onload handler
119$(ajax).on( /*BiNd_deprecated_in_3_0*/
120  'load',
121  function() {
122    return ajax.widgets.products();
123  }
124);

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.