title-switcher 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 Joshua Heagle
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,169 @@
1
+ title-switcher-v2
2
+ ==============
3
+
4
+ This is the updated title-switcher which takes a simpler approach and improves many deficiencies of the original title-switcher.
5
+
6
+ Add typing effect to titles and also switch through several titles.
7
+
8
+ This project can be used as a plugin with limited set-up requirements.
9
+ No need to change the code in the title-switcher.js file except for
10
+ customization.
11
+
12
+ Add the titles to the DOM beside each other as child elements of a wrapper element (ex. div). Pass in an identifying attribute for the wrapper such as a class name. The other sample
13
+ code such as style can be used to improve how it displays.
14
+
15
+ NO need for any additional library, this runs as is. Compatible in modern browsers from IE9+.
16
+
17
+ If there are any problems contact me, but set-up should be done based on
18
+ the sample code for best results.
19
+
20
+ Live example at https://joshuaheagle.com/projects/title-switcher. Enjoy!
21
+
22
+ <a name="TitleSwitcher"></a>
23
+
24
+ ## TitleSwitcher
25
+ **Kind**: global class
26
+
27
+ * [TitleSwitcher](#TitleSwitcher)
28
+ * [new TitleSwitcher([titlesContainer], [switchStyle])](#new_TitleSwitcher_new)
29
+ * [.active](#TitleSwitcher+active) ⇒ <code>boolean</code>
30
+ * [.currentClass](#TitleSwitcher+currentClass) ⇒ <code>string</code>
31
+ * [.currentIndex](#TitleSwitcher+currentIndex) ⇒ <code>number</code>
32
+ * [.delayEffect](#TitleSwitcher+delayEffect) ⇒ <code>number</code>
33
+ * [.delaySwitch](#TitleSwitcher+delaySwitch) ⇒ <code>number</code>
34
+ * [.switchStyle](#TitleSwitcher+switchStyle) ⇒ <code>string</code>
35
+ * [.titles](#TitleSwitcher+titles) ⇒ <code>Array</code> \| <code>NodeList</code>
36
+ * [.typeSurface](#TitleSwitcher+typeSurface) ⇒ <code>HTMLElement</code> \| <code>null</code>
37
+ * [.startTitles([settings])](#TitleSwitcher+startTitles) ⇒ [<code>TitleSwitcher</code>](#TitleSwitcher)
38
+ * [.pause()](#TitleSwitcher+pause)
39
+ * [.resume()](#TitleSwitcher+resume)
40
+ * [.switchTitle(currentTitle, callBackFunction, self, [runOnce])](#TitleSwitcher+switchTitle) ⇒ [<code>TitleSwitcher</code>](#TitleSwitcher)
41
+ * [.cursorBlink(blinkOn, self)](#TitleSwitcher+cursorBlink) ⇒ [<code>TitleSwitcher</code>](#TitleSwitcher)
42
+ * [.typingEffect(domObject, callBackFunction, self, [runOnce])](#TitleSwitcher+typingEffect) ⇒ [<code>TitleSwitcher</code>](#TitleSwitcher)
43
+
44
+ <a name="new_TitleSwitcher_new"></a>
45
+
46
+ ### new TitleSwitcher([titlesContainer], [switchStyle])
47
+ Instantiate this as a class to get an instance of TitleSwitcher
48
+
49
+
50
+ | Param | Type | Default | Description |
51
+ | --- | --- | --- | --- |
52
+ | [titlesContainer] | <code>string</code> | <code>&quot;&#x27;&#x27;&quot;</code> | The selector where titles are stored |
53
+ | [switchStyle] | <code>function</code> \| <code>string</code> | <code>&#x27;typingEffect&#x27;</code> | The function or function name for the effect to apply |
54
+
55
+ <a name="TitleSwitcher+active"></a>
56
+
57
+ ### titleSwitcher.active ⇒ <code>boolean</code>
58
+ Retrieve active
59
+
60
+ **Kind**: instance property of [<code>TitleSwitcher</code>](#TitleSwitcher)
61
+ <a name="TitleSwitcher+currentClass"></a>
62
+
63
+ ### titleSwitcher.currentClass ⇒ <code>string</code>
64
+ Retrieve currentClass
65
+
66
+ **Kind**: instance property of [<code>TitleSwitcher</code>](#TitleSwitcher)
67
+ <a name="TitleSwitcher+currentIndex"></a>
68
+
69
+ ### titleSwitcher.currentIndex ⇒ <code>number</code>
70
+ Retrieve currentIndex
71
+
72
+ **Kind**: instance property of [<code>TitleSwitcher</code>](#TitleSwitcher)
73
+ <a name="TitleSwitcher+delayEffect"></a>
74
+
75
+ ### titleSwitcher.delayEffect ⇒ <code>number</code>
76
+ Retrieve delayEffect
77
+
78
+ **Kind**: instance property of [<code>TitleSwitcher</code>](#TitleSwitcher)
79
+ <a name="TitleSwitcher+delaySwitch"></a>
80
+
81
+ ### titleSwitcher.delaySwitch ⇒ <code>number</code>
82
+ Retrieve delaySwitch
83
+
84
+ **Kind**: instance property of [<code>TitleSwitcher</code>](#TitleSwitcher)
85
+ <a name="TitleSwitcher+switchStyle"></a>
86
+
87
+ ### titleSwitcher.switchStyle ⇒ <code>string</code>
88
+ Retrieve switchStyle
89
+
90
+ **Kind**: instance property of [<code>TitleSwitcher</code>](#TitleSwitcher)
91
+ <a name="TitleSwitcher+titles"></a>
92
+
93
+ ### titleSwitcher.titles ⇒ <code>Array</code> \| <code>NodeList</code>
94
+ Retrieve list of titles DOM elements
95
+
96
+ **Kind**: instance property of [<code>TitleSwitcher</code>](#TitleSwitcher)
97
+ <a name="TitleSwitcher+typeSurface"></a>
98
+
99
+ ### titleSwitcher.typeSurface ⇒ <code>HTMLElement</code> \| <code>null</code>
100
+ Retrieve typeSurface used
101
+
102
+ **Kind**: instance property of [<code>TitleSwitcher</code>](#TitleSwitcher)
103
+ <a name="TitleSwitcher+startTitles"></a>
104
+
105
+ ### titleSwitcher.startTitles([settings]) ⇒ [<code>TitleSwitcher</code>](#TitleSwitcher)
106
+ This is the function to begin the switching titles
107
+
108
+ **Kind**: instance method of [<code>TitleSwitcher</code>](#TitleSwitcher)
109
+
110
+ | Param | Type | Default |
111
+ | --- | --- | --- |
112
+ | [settings] | <code>Object</code> | <code>{}</code> |
113
+ | [settings.delaySwitch] | <code>number</code> | <code>400</code> |
114
+ | [settings.delayEffect] | <code>number</code> | <code>200</code> |
115
+ | [settings.isRandom] | <code>boolean</code> | <code>false</code> |
116
+ | [settings.immediatePause] | <code>boolean</code> | <code>false</code> |
117
+
118
+ <a name="TitleSwitcher+pause"></a>
119
+
120
+ ### titleSwitcher.pause()
121
+ This is the function to pause between switching
122
+
123
+ **Kind**: instance method of [<code>TitleSwitcher</code>](#TitleSwitcher)
124
+ <a name="TitleSwitcher+resume"></a>
125
+
126
+ ### titleSwitcher.resume()
127
+ This is the function to resume after a pause.
128
+
129
+ **Kind**: instance method of [<code>TitleSwitcher</code>](#TitleSwitcher)
130
+ <a name="TitleSwitcher+switchTitle"></a>
131
+
132
+ ### titleSwitcher.switchTitle(currentTitle, callBackFunction, self, [runOnce]) ⇒ [<code>TitleSwitcher</code>](#TitleSwitcher)
133
+ This is the core function for switching titles
134
+
135
+ **Kind**: instance method of [<code>TitleSwitcher</code>](#TitleSwitcher)
136
+
137
+ | Param | Type | Default |
138
+ | --- | --- | --- |
139
+ | currentTitle | <code>HTMLElement</code> | |
140
+ | callBackFunction | <code>function</code> | |
141
+ | self | [<code>TitleSwitcher</code>](#TitleSwitcher) | |
142
+ | [runOnce] | <code>boolean</code> | <code>false</code> |
143
+
144
+ <a name="TitleSwitcher+cursorBlink"></a>
145
+
146
+ ### titleSwitcher.cursorBlink(blinkOn, self) ⇒ [<code>TitleSwitcher</code>](#TitleSwitcher)
147
+ This is a helper function to improve the default 'typingEffect'
148
+
149
+ **Kind**: instance method of [<code>TitleSwitcher</code>](#TitleSwitcher)
150
+
151
+ | Param | Type |
152
+ | --- | --- |
153
+ | blinkOn | <code>boolean</code> |
154
+ | self | [<code>TitleSwitcher</code>](#TitleSwitcher) |
155
+
156
+ <a name="TitleSwitcher+typingEffect"></a>
157
+
158
+ ### titleSwitcher.typingEffect(domObject, callBackFunction, self, [runOnce]) ⇒ [<code>TitleSwitcher</code>](#TitleSwitcher)
159
+ This is the default and example of an effect being implemented when Titles are switched
160
+
161
+ **Kind**: instance method of [<code>TitleSwitcher</code>](#TitleSwitcher)
162
+
163
+ | Param | Type | Default |
164
+ | --- | --- | --- |
165
+ | domObject | <code>HTMLElement</code> | |
166
+ | callBackFunction | <code>function</code> | |
167
+ | self | [<code>TitleSwitcher</code>](#TitleSwitcher) | |
168
+ | [runOnce] | <code>boolean</code> | <code>false</code> |
169
+