ison-js

ison function JS

this package has been deprecated
Last updated 2 years ago by edbz .
ISC · Original npm · Tarball · package.json
$ cnpm install ison-js 
SYNC missed versions from official npm registry.

ISON-JS

// Just say I
import * as I from "ison-js"

I.createNewCreative

Init a new creative, should be call at the end of the JS file

I.createNewCreative({
  callback: build,
  name: 'creative',
  orga: 'ison.inc',
  favicon: 'assets/favicon.ico'
})

I.getInt

return the Int value of a size elem in pixel

I.getInt(elem.style.width)

//where elem.style.width = '200px' return 200

I.amIphone

return true on Apple Iphone, browser or app

I.amIphone()


I.amLandscape

return true if mobile is in landscape position

I.amLandscape()

I.amPortrait

return true if mobile is in portrait position

I.amPortrait()

I.getSize

return an object size of an element or body could return an error for some SDK overwriting the body

I.getSize(elem)

SELECTORS

I.select

short way for document.getElementById

I.select('elem')

I.select

short way for document.getElementsByClassName

I.selectClass('elem')

I.selectTag

short way for document.getElementsByTag

I.selectTag('elem')

I.S

superSelector

I.S('#id')
I.S('.class')
I.S('tag')

I.have

is false if an element is undefined

I.have(elem)

I.create

short way for document.createElement

I.create('div')

I.setElem

create an element with name and class setElem(tag: string, name: string, index?: number)

I.setElem('div', 'foo', 1)
I.setElem('span', 'bar')

return

<div id="foo1" class="1 foo"></div>
<span id="bar" class="bar"></span>

I.addClass

short way for elem.classList.add for one or many elements

<div id="foo1" class="1 foo"></div>
<span id="bar" class="bar"></span>
const div = I.select('foo1')
const span = I.select('bar')

I.addClass('baz', div, span)

return

<div id="foo1" class="1 foo baz"></div>
<span id="bar" class="bar baz"></span>

I.remClass

short way for elem.classList.remove for one or many elements

<div id="foo1" class="1 foo baz"></div>
<span id="bar" class="bar baz"></span>
const div = I.select('foo1')
const span = I.select('bar')

I.remClass('baz', div, span)

return

<div id="foo1" class="1 foo"></div>
<span id="bar" class="bar"></span>

I.toggleClass

short way for elem.classList.toggle for one or many elements

<div id="foo1" class="1 foo baz"></div>
<span id="bar" class="bar baz"></span>
const div = I.select('foo1')
const span = I.select('bar')

I.toggleClass('baz', div)
I.toggleClass('fuz', span)

return

<div id="foo1" class="1 foo"></div>
<span id="bar" class="bar baz fuz"></span>

I.appendToDom

short way for elem.appendChild(anotherElem) for one or many elements. Could be 'body' for document.body

I.appendToDom(wrapper, div, span)

should append div and span into wrapper


CSS manipulation

I.innerTxt

short way for elem.innerHTML for one or many elements.

I.innerTxt('some text', div, span)

I.opacity

short way for elem.style.opacity for one or many elements.

I.opacity(0.5, div, span)

could be shortened :

I.opacity0(div, span) // set opacity to 0
I.opacity1(div, span) // set opacity to 1

I.display

short way for elem.style.display for one or many elements.

I.display('none', div, span)

could be shortened :

I.displayBlock(div, span) // set display to 'block'
I.displayNone(div, span) // set display to 'none'
I.displayFlex(div, span) // set display to 'flex'

I.setPos

short way for elem.style.position for one or many elements.

I.setPos('absolute', div, span)

could be shortened :

I.setAbs(div, span) // set position to 'absolute'
I.setRel(div, span) // set position to 'relative'
I.setFix(div, span) // set position to 'fixed'

I.setZindex

short way for elem.style.zIndex for one or many elements.

I.setZindex(42, div, span)

I.bkgColor

short way for elem.style.backgroundColor for one or many elements.

I.bkgColor('#fff', div, span)

I.setPM

short way for elem.style.margin or elem.style.padding for one or many elements. Can be an int for px, a string for %, a vh or vw value or auto

I.setPM('margin',10, div, span) // 10px
I.setPM('padding','10', div, span) // 10%
I.setPM('margin','10vw', div, span) // 10vw
I.setPM('padding','auto', div, span) //auto

could be shortened :

I.setPadding(10,div, span) // set margin to 10px
I.setMargin('10',div, span) // set position to 'relative'

I.innerTxt

short way for elem.innerHTML for one or many elements.

I.innerTxt('some text', div, span)

I.innerTxt

short way for elem.innerHTML for one or many elements.

I.innerTxt('some text', div, span)

I.innerTxt

short way for elem.innerHTML for one or many elements.

I.innerTxt('some text', div, span)

I.innerTxt

short way for elem.innerHTML for one or many elements.

I.innerTxt('some text', div, span)

Current Tags

  • 1.0.45                                ...           latest (2 years ago)

45 Versions

  • 1.0.45 [deprecated]           ...           2 years ago
  • 1.0.44 [deprecated]           ...           2 years ago
  • 1.0.43 [deprecated]           ...           2 years ago
  • 1.0.42 [deprecated]           ...           2 years ago
  • 1.0.41 [deprecated]           ...           2 years ago
  • 1.0.40 [deprecated]           ...           2 years ago
  • 1.0.39 [deprecated]           ...           2 years ago
  • 1.0.38 [deprecated]           ...           2 years ago
  • 1.0.37 [deprecated]           ...           2 years ago
  • 1.0.36 [deprecated]           ...           2 years ago
  • 1.0.35 [deprecated]           ...           2 years ago
  • 1.0.34 [deprecated]           ...           2 years ago
  • 1.0.33 [deprecated]           ...           2 years ago
  • 1.0.32 [deprecated]           ...           2 years ago
  • 1.0.31 [deprecated]           ...           2 years ago
  • 1.0.30 [deprecated]           ...           2 years ago
  • 1.0.29 [deprecated]           ...           2 years ago
  • 1.0.28 [deprecated]           ...           2 years ago
  • 1.0.27 [deprecated]           ...           2 years ago
  • 1.0.26 [deprecated]           ...           2 years ago
  • 1.0.25 [deprecated]           ...           2 years ago
  • 1.0.24 [deprecated]           ...           2 years ago
  • 1.0.23 [deprecated]           ...           2 years ago
  • 1.0.22 [deprecated]           ...           2 years ago
  • 1.0.20 [deprecated]           ...           2 years ago
  • 1.0.19 [deprecated]           ...           2 years ago
  • 1.0.18 [deprecated]           ...           2 years ago
  • 1.0.17 [deprecated]           ...           2 years ago
  • 1.0.16 [deprecated]           ...           2 years ago
  • 1.0.15 [deprecated]           ...           2 years ago
  • 1.0.14 [deprecated]           ...           2 years ago
  • 1.0.13 [deprecated]           ...           2 years ago
  • 1.0.12 [deprecated]           ...           2 years ago
  • 1.0.11 [deprecated]           ...           2 years ago
  • 1.0.10 [deprecated]           ...           2 years ago
  • 1.0.9 [deprecated]           ...           2 years ago
  • 1.0.8 [deprecated]           ...           2 years ago
  • 1.0.7 [deprecated]           ...           2 years ago
  • 1.0.6 [deprecated]           ...           2 years ago
  • 1.0.5 [deprecated]           ...           2 years ago
  • 1.0.4 [deprecated]           ...           2 years ago
  • 1.0.3 [deprecated]           ...           2 years ago
  • 1.0.2 [deprecated]           ...           2 years ago
  • 1.0.1 [deprecated]           ...           2 years ago
  • 1.0.0 [deprecated]           ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (17)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |