How to use the @pluginjs/dom.getData function in @pluginjs/dom

To help you get started, we’ve selected a few @pluginjs/dom examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pluginjs / pluginjs / modules / color-selector / src / components / gradient.js View on Github external
// create initial markers
    const $leftMarker = this.createMarker({
      color: 'white',
      percent: 0,
      index: 0
    })

    const $rightMarker = this.createMarker({
      color: 'black',
      percent: 100,
      index: 1
    })

    this.markers.push(
      getData('value', $leftMarker),
      getData('value', $rightMarker)
    )
    this.selectMarker($rightMarker)
    this.actionBarSize = getData('value', $leftMarker).maxLenght
    // initial wheel
    this.WHEEL = new Wheel(this.instance, this.$wheel)
  }
  bind() {
github pluginjs / pluginjs / modules / color-picker / src / main2.js View on Github external
children(this.$trigger).forEach(($this, i) => {
      const $content = children(this.$container)[i]

      removeClass(this.classes.SELECTED, $this)
      hideElement($content)
      this.leave(`${getData('type', $this)}Module`)
      if (getData('type', $this) === typeName) {
        addClass(this.classes.SELECTED, $this)
        $content.style.display = 'block'
        // showElement($content)
      }
    })
github pluginjs / pluginjs / modules / color-selector / src / components / gradient.js View on Github external
({ target: $this }) => {
        if (getData('type', $this) !== 'gradient') {
          this.markers.map((marker, i) => { /* eslint-disable-line */
            const $item = marker.$el
            if (hasClass(this.classes.MARKERACTIVE, $item)) {
              this.lastActiveMarkerIndex = i
            }
          })
        }
      },
      this.instance.$panel
github pluginjs / pluginjs / modules / tree / src / node.js View on Github external
children() {
    const children = []
    let node
    for (let i = 0; i < this.subelements.length; i++) {
      node = getData('node', this.subelements[i])
      if (node) {
        children.push(node)
      }
    }

    return children
  }
github pluginjs / pluginjs / modules / gradient-picker / src / main.js View on Github external
({ target: $this }) => {
        if (
          this.markers.length <= 2 ||
          !hasClass(this.classes.DELETEACTIVE, $this)
        ) {
          return false
        }

        const $marker = this.$marker
        const index = getData('value', $marker).index
        $marker.remove()
        removeClass(this.classes.DELETEACTIVE, this.$delete)
        this.markers.splice(index, 1)
        this.GRADIENT.removeById(index)
        this.sort()
        this.GRADIENT.reorder()

        this.update(false)
        this.leave('SelectedMarker')
        return null
      },
      this.$handle
github pluginjs / pluginjs / modules / rate / src / main.js View on Github external
verification() {
    if (this.element.tagName.toLowerCase() === 'input') {
      if (getData('min', this.element) || getData('min', this.element) === 0) {
        const m = getData('min', this.element)
        const n = Number(m)
        if (n >= this.options.max) {
          this.options.min = 0
        }
      }

      if (getData('max', this.element) || getData('max', this.element) === 0) {
        const m = getData('max', this.element)
        const n = Number(m)
        if (n <= 0) {
          this.options.max = 2
        }
      }
    }
  }
github pluginjs / pluginjs / modules / color-selector / src / components / saturation.js View on Github external
update() {
    if (this.instance.is('gradientModule')) {
      if (this.instance.is('SelectedMarker')) {
        this.instance.GRADIENT.setGradientColor(
          {
            s: this.positionX / this.maxLengthX,
            v: 1 - this.positionY / this.maxLengthY
          },
          getData('value', this.instance.$marker).index
        )
      }
    } else {
      this.instance.SOLID.setSolid({
        s: this.positionX / this.maxLengthX,
        v: 1 - this.positionY / this.maxLengthY
      })
    }
  }
}
github pluginjs / pluginjs / modules / shares / src / share.js View on Github external
detectService() {
    let service = getData('service', this.element)

    if (!service) {
      service = Object.keys(SERVICES).filter(service => {
        return this.element.className.indexOf(service) >= 0
      })[0]
    }

    if (service) {
      this.service = service

      setData('service', service, this.element)
    }
  }