PageSourceSearch

https://sklep.tygodnikprzeglad.pl/wp-content/plugins/wp-desk-omnibus/assets/index.js

js tygodnikprzeglad.pl collected 2026-10-02 07:37:56 UTC 1,701 bytes, 60 lines download raw bytes

1/**
2 * @typedef {Object} PriceEntity
3 * @property {(string|undefined)} price
4 * @property {(string|undefined)} date
5 */
6
7(function($) {
8  const currentVariationElement = $('.variations_form input[name=variation_id]')
9  if (currentVariationElement.length === 0) return
10  const priceDataElement = $('#omnibus-price-data')
11  if (priceDataElement.data('variations_data') === false) return
12
13  /**
14   * @param {string|number} variationId
15   * @returns {PriceEntity|false}
16   */
17  function getVariationData(variationId) {
18    const variationsDataJson = priceDataElement.data("variations_data")
19    if (variationsDataJson[variationId] === undefined)
20      throw new Error(`Cannot get variation data for offset "${variationId}"`)
21
22    return variationsDataJson[variationId]
23  }
24
25  /** @param {PriceEntity} variationData */
26  function updateVariation(variationData) {
27    priceDataElement
28        .find('.js-omnibus-price')
29        .html(variationData.price)
30
31    priceDataElement
32        .find('.js-omnibus-date')
33        .text(variationData.date)
34  }
35
36  function displayVariationPrice() {
37    const currentVariationId = currentVariationElement.val()
38    if (typeof currentVariationId !== 'string' || currentVariationId === '') {
39      priceDataElement.hide()
40      return
41    }
42
43    try {
44      const variationData = getVariationData( currentVariationId );
45      if (variationData === false) {
46        priceDataElement.hide()
47        return
48      }
49
50      updateVariation( variationData )
51      priceDataElement.show()
52    } catch ( e ) {
53      priceDataElement.hide()
54      console.warn(e.message)
55    }
56  }
57
58  currentVariationElement.on('change', displayVariationPrice)
59  displayVariationPrice()
60})(jQuery)

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.