Refactor method names
Browse files- src/core/overlay.js +2 -2
- src/core/popover.js +4 -4
- src/core/stage.js +2 -2
- types/index.d.ts +4 -4
src/core/overlay.js
CHANGED
@@ -28,7 +28,7 @@ export default class Overlay {
|
|
28 |
* Prepares the overlay
|
29 |
* @private
|
30 |
*/
|
31 |
-
|
32 |
let pageOverlay = this.document.getElementById(ID_OVERLAY);
|
33 |
if (!pageOverlay) {
|
34 |
pageOverlay = createNodeFromString(OVERLAY_HTML);
|
@@ -103,7 +103,7 @@ export default class Overlay {
|
|
103 |
return;
|
104 |
}
|
105 |
|
106 |
-
this.
|
107 |
|
108 |
window.setTimeout(() => {
|
109 |
this.node.style.opacity = `${this.options.opacity}`;
|
|
|
28 |
* Prepares the overlay
|
29 |
* @private
|
30 |
*/
|
31 |
+
attachNode() {
|
32 |
let pageOverlay = this.document.getElementById(ID_OVERLAY);
|
33 |
if (!pageOverlay) {
|
34 |
pageOverlay = createNodeFromString(OVERLAY_HTML);
|
|
|
103 |
return;
|
104 |
}
|
105 |
|
106 |
+
this.attachNode();
|
107 |
|
108 |
window.setTimeout(() => {
|
109 |
this.node.style.opacity = `${this.options.opacity}`;
|
src/core/popover.js
CHANGED
@@ -42,7 +42,7 @@ export default class Popover extends Element {
|
|
42 |
this.window = window;
|
43 |
this.document = document;
|
44 |
|
45 |
-
this.
|
46 |
this.hide();
|
47 |
}
|
48 |
|
@@ -50,7 +50,7 @@ export default class Popover extends Element {
|
|
50 |
* Prepares the dom element for popover
|
51 |
* @private
|
52 |
*/
|
53 |
-
|
54 |
let popover = this.document.getElementById(ID_POPOVER);
|
55 |
if (!popover) {
|
56 |
popover = createNodeFromString(POPOVER_HTML);
|
@@ -122,7 +122,7 @@ export default class Popover extends Element {
|
|
122 |
this.titleNode.innerHTML = this.options.title;
|
123 |
this.descriptionNode.innerHTML = this.options.description || '';
|
124 |
|
125 |
-
this.
|
126 |
|
127 |
// Position the popover around the given position
|
128 |
switch (this.options.position) {
|
@@ -150,7 +150,7 @@ export default class Popover extends Element {
|
|
150 |
* decides if to show them or not
|
151 |
* @private
|
152 |
*/
|
153 |
-
|
154 |
this.nextBtnNode.innerHTML = this.options.nextBtnText;
|
155 |
this.prevBtnNode.innerHTML = this.options.prevBtnText;
|
156 |
this.closeBtnNode.innerHTML = this.options.closeBtnText;
|
|
|
42 |
this.window = window;
|
43 |
this.document = document;
|
44 |
|
45 |
+
this.attachNode();
|
46 |
this.hide();
|
47 |
}
|
48 |
|
|
|
50 |
* Prepares the dom element for popover
|
51 |
* @private
|
52 |
*/
|
53 |
+
attachNode() {
|
54 |
let popover = this.document.getElementById(ID_POPOVER);
|
55 |
if (!popover) {
|
56 |
popover = createNodeFromString(POPOVER_HTML);
|
|
|
122 |
this.titleNode.innerHTML = this.options.title;
|
123 |
this.descriptionNode.innerHTML = this.options.description || '';
|
124 |
|
125 |
+
this.renderFooter();
|
126 |
|
127 |
// Position the popover around the given position
|
128 |
switch (this.options.position) {
|
|
|
150 |
* decides if to show them or not
|
151 |
* @private
|
152 |
*/
|
153 |
+
renderFooter() {
|
154 |
this.nextBtnNode.innerHTML = this.options.nextBtnText;
|
155 |
this.prevBtnNode.innerHTML = this.options.prevBtnText;
|
156 |
this.closeBtnNode.innerHTML = this.options.closeBtnText;
|
src/core/stage.js
CHANGED
@@ -24,7 +24,7 @@ export default class Stage extends Element {
|
|
24 |
* Prepares the DOM element if not already there
|
25 |
* @private
|
26 |
*/
|
27 |
-
|
28 |
let stage = this.document.getElementById(ID_STAGE);
|
29 |
if (!stage) {
|
30 |
stage = createNodeFromString(STAGE_HTML);
|
@@ -70,7 +70,7 @@ export default class Stage extends Element {
|
|
70 |
* @public
|
71 |
*/
|
72 |
show(position) {
|
73 |
-
this.
|
74 |
|
75 |
this.setInitialStyle();
|
76 |
|
|
|
24 |
* Prepares the DOM element if not already there
|
25 |
* @private
|
26 |
*/
|
27 |
+
attachNode() {
|
28 |
let stage = this.document.getElementById(ID_STAGE);
|
29 |
if (!stage) {
|
30 |
stage = createNodeFromString(STAGE_HTML);
|
|
|
70 |
* @public
|
71 |
*/
|
72 |
show(position) {
|
73 |
+
this.attachNode();
|
74 |
|
75 |
this.setInitialStyle();
|
76 |
|
types/index.d.ts
CHANGED
@@ -344,7 +344,7 @@ declare module 'driver.js' {
|
|
344 |
/**
|
345 |
* Prepares the DOM element for overlay and appends to body
|
346 |
*/
|
347 |
-
private
|
348 |
|
349 |
/**
|
350 |
* Highlights the given Element while resetting the existing one
|
@@ -412,7 +412,7 @@ declare module 'driver.js' {
|
|
412 |
/**
|
413 |
* Prepares the DOM element for popover and appends to the body
|
414 |
*/
|
415 |
-
private
|
416 |
|
417 |
/**
|
418 |
* Hides the popover if visible
|
@@ -433,7 +433,7 @@ declare module 'driver.js' {
|
|
433 |
/**
|
434 |
* Renders the buttons in the footer of the popover
|
435 |
*/
|
436 |
-
private
|
437 |
|
438 |
/**
|
439 |
* Positions the popover to the left of the given element position
|
@@ -491,7 +491,7 @@ declare module 'driver.js' {
|
|
491 |
/**
|
492 |
* Prepares the node and appends to body if not there already
|
493 |
*/
|
494 |
-
private
|
495 |
|
496 |
/**
|
497 |
* Hides the stage by removing the node
|
|
|
344 |
/**
|
345 |
* Prepares the DOM element for overlay and appends to body
|
346 |
*/
|
347 |
+
private attachNode(): void;
|
348 |
|
349 |
/**
|
350 |
* Highlights the given Element while resetting the existing one
|
|
|
412 |
/**
|
413 |
* Prepares the DOM element for popover and appends to the body
|
414 |
*/
|
415 |
+
private attachNode(): void;
|
416 |
|
417 |
/**
|
418 |
* Hides the popover if visible
|
|
|
433 |
/**
|
434 |
* Renders the buttons in the footer of the popover
|
435 |
*/
|
436 |
+
private renderFooter(): void;
|
437 |
|
438 |
/**
|
439 |
* Positions the popover to the left of the given element position
|
|
|
491 |
/**
|
492 |
* Prepares the node and appends to body if not there already
|
493 |
*/
|
494 |
+
private attachNode(): void;
|
495 |
|
496 |
/**
|
497 |
* Hides the stage by removing the node
|