plasma-banner-scripts
Version:
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
746 lines (435 loc) • 10.5 kB
Markdown
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
### Table of Contents
- [Main][1]
- [Initiators][2]
- [Promotion][3]
- [Promotion#run][4]
- [it][5]
- [it][6]
- [it][7]
- [it][8]
- [it][9]
- [it][10]
- [it][11]
- [it][12]
- [it][13]
- [getAll][14]
- [get][15]
- [data][16]
- [addClass][17]
- [attr][18]
- [prepend][19]
- [removeClass][20]
- [hasClass][21]
- [removeAttribute][22]
- [dispatch][23]
- [Initiators/FlipClock/Faces][24]
- [numberize][25]
- [getPlasmaHourlyLabels][26]
- [getPlasmaHourlyCounter][27]
- [getPlasmaHourlyCounter][28]
- [getPlasmaDailyLabels][29]
- [DailyCounterFace][30]
- [HourlyCounterFace][31]
- [Initiators/FlipClock/Language][32]
- [Ukraine][33]
- [France][34]
- [Poland][35]
- [Initiators/FlipClock][36]
- [FlipClockInitiator][37]
- [FlipClockInitiator#addExtension][38]
- [FlipClockInitiator#run][39]
- [Initiators/UI][40]
- [UiBanner][41]
- [UiBanner#run][42]
- [UiBanner#showBanner][43]
- [UiBanner#hideBanner][44]
- [UiPopup][45]
- [UiPopup#run][46]
- [UiPopup#showBanner][47]
- [UiPopup#hideBanner][48]
- [UiPopup#outTarget][49]
- [Initiators/Analytics][50]
- [TagManager][51]
- [TagManager#onClickBanner][52]
- [TagManager#onShowBanner][53]
- [Utils][54]
- [Parameters][55]
- [Parameters#parse][56]
- [Parameters#update][57]
- [Parameters#prepareData][58]
- [Parameters#validate][59]
- [Parameters#other][60]
- [Parameters#lang][61]
- [Parameters#time][62]
- [Parameters#flipClock][63]
- [Parameters#banner][64]
## Main
start project npm i && npm start
## Initiators
### Promotion
**Parameters**
- `args` **[Object][65]** arg only for FlipClock
**Examples**
```javascript
const promotion = new Promotion();
```
### Promotion#run
Run promotion banner
**Examples**
```javascript
const promotion = new Promotion();
promotion.run();
```
## it
Get
## it
hasClass
## it
addClass
## it
removeClass
## it
removeAttribute
## it
attr
## it
data
## it
prepend
## it
getAll
## getAll
Get all elements by selector
**Parameters**
- `selector` **[string][66]**
Returns **any**
## get
Get element by selector
**Parameters**
- `selector`
Returns **any**
## data
Get data attributes
**Parameters**
- `element`
Returns **{}**
## addClass
Add class
**Parameters**
- `element`
- `classList`
Returns **any**
## attr
Attributes
**Parameters**
- `element`
- `key`
- `value`
Returns **any**
## prepend
Prepend
**Parameters**
- `parent`
- `element`
Returns **any**
## removeClass
**Parameters**
- `element`
- `classList`
Returns **any**
## hasClass
**Parameters**
- `element`
- `className`
Returns **[boolean][67]**
## removeAttribute
Remove Attribute
**Parameters**
- `element`
- `name`
Returns **any**
## dispatch
Dispatch Event
**Parameters**
- `options`
Returns **[boolean][67]**
## Initiators/FlipClock/Faces
FlipClock.js has a fully extendible API to create any clock face you need.
More clock faces will be added over time, so be sure to fork the code and make a pull request
if you want to see your clock face appear in the core library.
### numberize
Formats any array of numbers into a valid array of numbers
Returns **[Array][68]** current time for Daily face
### getPlasmaHourlyLabels
Generate array with translate labels for Hourly face
Returns **[Array][68]** translate labels for Hourly face
### getPlasmaHourlyCounter
Generate array with current time for Hourly face
Returns **[Array][68]** current time for Hourly face
### getPlasmaHourlyCounter
Generate array with current time for Daily face
Returns **[Array][68]** current time for Daily face
### getPlasmaDailyLabels
Generate array with translate labels for Daily face
Returns **[Array][68]** translate labels for Daily face
### DailyCounterFace
Transform default counter to Plasma standard counter with day counter
Type: [Object][65]
### HourlyCounterFace
Transform default counter to Plasma standard counter without day counter
Type: [Object][65]
## Initiators/FlipClock/Language
### Ukraine
Object with lang variable for Ukraine
Type: [Object][65]
### France
Object with lang variable for France
Type: [Object][65]
### Poland
Object with lang variable for Poland
Type: [Object][65]
## Initiators/FlipClock
### FlipClockInitiator
**Parameters**
- `args` **[Object][65]** all arguments
**Examples**
```javascript
const flipClock = new FlipClockInitiator({selector: '.Promotion__timer'});
```
### FlipClockInitiator#addExtension
Private method for init extension
### FlipClockInitiator#run
Run timer
**Examples**
```javascript
const flipClock = new FlipClockInitiator({selector: '.Promotion__timer'});
flipClock.run();
```
## Initiators/UI
### UiBanner
**Parameters**
- `args` **[Object][65]** all arguments
**Examples**
```javascript
const uiBanner = new UiBanner({});
```
### UiBanner#run
run banner function
**Parameters**
- `tagManager` **[Object][65]** manager for dataLayer variable
**Examples**
```javascript
const uiBanner = new UiBanner({});
uiBanner.run();
```
### UiBanner#showBanner
show banner function
**Examples**
```javascript
const uiBanner = new UiBanner({});
uiBanner.showBanner();
```
### UiBanner#hideBanner
hide banner function
**Examples**
```javascript
const uiBanner = new UiBanner({});
uiBanner.hideBanner();
```
### UiPopup
**Parameters**
- `args` **[Object][65]** all arguments
**Examples**
```javascript
const uiPopup = new UiPopup({});
```
### UiPopup#run
run popup function
**Parameters**
- `banner` **[Object][65]** object
- `tagManager` **[Object][65]** object
**Examples**
```javascript
const uiPopup = new UiPopup({});
uiPopup.run();
```
### UiPopup#showBanner
show popup function
**Examples**
```javascript
const uiPopup = new UiPopup({});
uiPopup.showPopup();
```
### UiPopup#hideBanner
hide popup function
**Parameters**
- `outTarget` **[boolean][67]** object
**Examples**
```javascript
const uiPopup = new UiPopup({});
uiPopup.hidePopup();
```
### UiPopup#outTarget
outTarget popup click function
**Parameters**
- `event` **[Object][65]** jQuery Event
**Examples**
```javascript
const uiPopup = new UiPopup({});
$(document).on('click', uiPopup.outTarget);
```
## Initiators/Analytics
### TagManager
**Parameters**
- `args` **[Object][65]** all arguments
**Examples**
```javascript
const tagManager = new TagManager({});
```
### TagManager#onClickBanner
Tag manager event click banner
**Examples**
```javascript
const tagManager = new TagManager({});
tagManager.onClickBanner();
```
### TagManager#onShowBanner
Tag manager event show banner
**Examples**
```javascript
const tagManager = new TagManager({});
tagManager.onShowBanner();
```
## Utils
Other instruments for normal working project
### Parameters
**Parameters**
- `selector` **[string][66]** selector to main wrapper for promotion block
**Examples**
```javascript
const params = parameters.parse('.Promotion');
```
### Parameters#parse
Parse and return all params
**Parameters**
- `selector` **[string][66]** jQuery selector
**Examples**
```javascript
const params = new Parameters();
params.parse('.Promotion');
```
Returns **[Object][65]**
### Parameters#update
Parse and return all params
**Parameters**
- `data` **[Object][65]** new data
**Examples**
```javascript
const params = new Parameters();
params.update({});
```
Returns **[Object][65]**
### Parameters#prepareData
prepare data for all initiators
**Parameters**
- `data` **[Object][65]** row parameters
Returns **[Object][65]** data
### Parameters#validate
prepare data for time
**Parameters**
- `data` **[Object][65]** row parameters
Returns **[Object][65]** validate data
### Parameters#other
prepare data for other
**Parameters**
- `data` **[Object][65]** row parameters
Returns **[Object][65]** data
### Parameters#lang
prepare data for lang
**Parameters**
- `data` **[Object][65]** row parameters
Returns **[Object][65]** data
### Parameters#time
prepare data for time
**Parameters**
- `data` **[Object][65]** row parameters
Returns **[Object][65]** data
### Parameters#flipClock
prepare data for flipClock
**Parameters**
- `data` **[Object][65]** row parameters
Returns **[Object][65]** final Data
### Parameters#banner
prepare data for banner and popup
**Parameters**
- `data` **[Object][65]** row parameters
Returns **[Object][65]** final Data
[1]: #main
[2]: #initiators
[3]: #promotion
[4]: #promotionrun
[5]: #it
[6]: #it-1
[7]: #it-2
[8]: #it-3
[9]: #it-4
[10]: #it-5
[11]: #it-6
[12]: #it-7
[13]: #it-8
[14]: #getall
[15]: #get
[16]: #data
[17]: #addclass
[18]: #attr
[19]: #prepend
[20]: #removeclass
[21]: #hasclass
[22]: #removeattribute
[23]: #dispatch
[24]: #initiatorsflipclockfaces
[25]: #numberize
[26]: #getplasmahourlylabels
[27]: #getplasmahourlycounter
[28]: #getplasmahourlycounter-1
[29]: #getplasmadailylabels
[30]: #dailycounterface
[31]: #hourlycounterface
[32]: #initiatorsflipclocklanguage
[33]: #ukraine
[34]: #france
[35]: #poland
[36]: #initiatorsflipclock
[37]: #flipclockinitiator
[38]: #flipclockinitiatoraddextension
[39]: #flipclockinitiatorrun
[40]: #initiatorsui
[41]: #uibanner
[42]: #uibannerrun
[43]: #uibannershowbanner
[44]: #uibannerhidebanner
[45]: #uipopup
[46]: #uipopuprun
[47]: #uipopupshowbanner
[48]: #uipopuphidebanner
[49]: #uipopupouttarget
[50]: #initiatorsanalytics
[51]: #tagmanager
[52]: #tagmanageronclickbanner
[53]: #tagmanageronshowbanner
[54]: #utils
[55]: #parameters
[56]: #parametersparse
[57]: #parametersupdate
[58]: #parameterspreparedata
[59]: #parametersvalidate
[60]: #parametersother
[61]: #parameterslang
[62]: #parameterstime
[63]: #parametersflipclock
[64]: #parametersbanner
[65]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
[66]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
[67]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
[68]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array