403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/wbs24.ozonexport/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/wbs24.ozonexport/formula.js
class Wbs24OzonexportFormula {
  constructor() {
    this.init()
  }

  init() {
    document.addEventListener("DOMContentLoaded", () => {
      this.addAllMarkHandlers()
      this.hideNotUsedExtendedPriceOptions()
      this.addHandersForExtendedPriceCheckboxes()
    })
  }

  addAllMarkHandlers() {
    const inputs = document.querySelectorAll('.ozonexport-formula')

    for (let input of inputs) {
      const type = input.dataset.type;
      const markLinks = document.querySelectorAll('.js-add-mark-'+type)

      for (let link of markLinks) {
        this.addMarkHandler(link, input)
      }
    }
  }

  addMarkHandler(link, input) {
    link.addEventListener('click', (event) => {
      event.preventDefault()

      let mark = link.dataset.mark
      this.addMarkToCursorPosition(input, mark)
    })
  }

  addMarkToCursorPosition(input, mark) {
    let start = input.selectionStart
    let end = input.selectionEnd
    input.value = input.value.substring(0, start) + mark + input.value.substring(end)
    input.focus()
    input.selectionEnd = (start == end) ? (end + mark.length) : end
  }

  addHandersForExtendedPriceCheckboxes() {
    const checkboxes = document.querySelectorAll('.ep-formula-flag, .ep-flag')
    for (let el of checkboxes) {
      el.addEventListener('click', () => {
        this.hideNotUsedExtendedPriceOptions()
      })
    }
  }

  hideNotUsedExtendedPriceOptions() {
    const epFormulaFlag = document.querySelector('.ep-formula-flag')
    const epFlag = document.querySelector('.ep-flag')

    if (epFormulaFlag && epFlag) {
      this.setActivityForIncludedFormElements('.tr-ep', !epFormulaFlag.checked)
      this.setActivityForIncludedFormElements('.tr-ep-formula', !epFlag.checked)
    }
  }

  setActivityForIncludedFormElements(css, isActive) {
    const parents = document.querySelectorAll(css)
    for (let parentElem of parents) {
      let elems = parentElem.querySelectorAll('input, select')
      for (let el of elems) el.disabled = !isActive
      let links = parentElem.querySelectorAll('a')
      for (let el of links) el.style.display = !isActive ? 'none' : 'inline'
    }
  }
}

Youez - 2016 - github.com/yon3zu
LinuXploit