-
Notifications
You must be signed in to change notification settings - Fork 65
/
Copy pathng-walkthrough.js
610 lines (568 loc) · 39.9 KB
/
ng-walkthrough.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
angular.module('ng-walkthrough', [])
.directive("walkthrough", ['$log', '$timeout', '$window', '$injector', '$compile',
function($log, $timeout, $window, $injector, $compile) {
var DOM_WALKTHROUGH_CLASS = "walkthrough-background";
var DOM_WALKTHROUGH_TRANSPARENCY_TEXT_CLASS = ".walkthrough-text";
var DOM_WALKTHROUGH_TIP_TEXT_CLASS = ".walkthrough-tip-text-box";
var DOM_WALKTHROUGH_HOLE_CLASS = ".walkthrough-hole";
var DOM_WALKTHROUGH_TRANSPARENCY_ICON_CLASS = ".walkthrough-icon";
var DOM_WALKTHROUGH_TIP_ICON_CLASS = ".walkthrough-tip-icon-text-box";
var DOM_WALKTHROUGH_ARROW_CLASS = ".walkthrough-arrow";
var DOM_WALKTHROUGH_DONE_BUTTON_CLASS = "walkthrough-done-button";
var DOM_TRANSCLUDE = "walkthrough-transclude";
var BUTTON_CAPTION_DONE = "Got it!";
var PADDING_HOLE = 5;
var PADDING_ARROW_START = 5;
var hasIonic = false;
var canTouch = true; //Used to prevent issue where onWalkthroughHide fired twice when have angular and ionic
//due to ontouch being called and then on-click called.
//issue can be seen at:
//https://github.com/angular/angular.js/issues/6251
var ngWalkthroughTapIcons = null;
var template = [
'<div class= "' + DOM_WALKTHROUGH_CLASS + '" ng-class="{\'walkthrough-active\': isVisible}" ng-click="onCloseClicked($event)" on-touch="onCloseTouched($event)">',
'<div class="walkthrough-container walkthrough-container-transparency" ng-show="walkthroughType==\'transparency\'">',
'<div class="walkthrough-inner" >',
'<div class="'+ DOM_TRANSCLUDE + '"></div>',
'<div class="walkthrough-non-transclude-template" ng-show="!hasTransclude">',
'<div class="walkthrough-text-container" ng-class="{\'walkthrough-top\': (!forceCaptionLocation || forceCaptionLocation==\'TOP\'), \'walkthrough-bottom\': forceCaptionLocation==\'BOTTOM\'}">',
'<pre class="walkthrough-element walkthrough-text" ng-bind="mainCaption">',
'</pre>',
'<img ng-if="walkthroughHeroImage" class="walkthrough-element walkthrough-hero-image" ng-src="{{walkthroughHeroImage}}" ng-click="onWalkthroughContentClicked()">',
'</div>',
'<img class="walkthrough-element walkthrough-icon" ng-show="icon && icon!=\'arrow\'" ng-src="{{walkthroughIcon}}">',
'<div class="walkthrough-element walkthrough-arrow" ng-show="icon==\'arrow\'"></div>',
'<button class="walkthrough-element walkthrough-button-positive walkthrough-done-button" type="button" ng-if="useButton" ng-click="onCloseClicked($event)" on-touch="onCloseTouched($event)">',
'{{buttonCaption}}',
'</button>',
'</div>',
'</div>',
'</div>',
'<div class="walkthrough-container walkthrough-container-tip" ng-show="walkthroughType==\'tip\'">',
'<div class="walkthrough-inner" ng-class="{\'walkthrough-top\': ((!forceCaptionLocation && !tipLocation) || forceCaptionLocation==\'TOP\' || tipLocation ==\'TOP\'), \'walkthrough-bottom\': (forceCaptionLocation==\'BOTTOM\' || tipLocation ==\'BOTTOM\')}">',
'<img class="walkthrough-element walkthrough-tip-icon-text-box" ng-class="{\'walkthrough-tip-icon-image-front\': tipIconLocation==\'FRONT\', \'walkthrough-tip-icon-image-back\': tipIconLocation==\'BACK\'}" ng-show="icon && icon!=\'arrow\'" ng-src="{{walkthroughIcon}}" alt="icon">',
'<button class="walkthrough-done-button walkthrough-tip-done-button-text-box" ng-class="{\'walkthrough-tip-done-button-no-icon\': !icon}" type="button" ng-if="useButton" ng-click="onCloseClicked($event)" on-touch="onCloseTouched($event)">',
'<img class="walkthrough-tip-button-image-text-box" ng-src="{{closeIcon}}" alt="x">',
'</button>',
'<div class="walkthrough-element walkthrough-tip-text-box" ng-click="onWalkthroughContentClicked()" ng-class="{\'walkthrough-tip-text-box-color-black\': tipColor==\'BLACK\', \'walkthrough-tip-text-box-color-white\': tipColor==\'WHITE\'}">',
'<pre ng-bind="mainCaption">',
'</pre>',
'<img ng-if="walkthroughHeroImage" class="walkthrough-element walkthrough-hero-image" ng-src="{{walkthroughHeroImage}}">',
'<div class="'+ DOM_TRANSCLUDE + '"></div>',
'</div>',
'</div>',
'</div>',
'<!-- Always show as this gives us the gray background -->',
'<div ng-show="hasBackdrop" class="walkthrough-hole" ng-class="{\'walkthrough-hole-round\': isRound}">',
'</div>',
'<div ng-show="hasGlow && (focusElementSelector)" class="walkthrough-hole walkthrough-hole-glow" ng-class="{\'walkthrough-hole-round\': isRound}">',
'</div>',
'</div>'
].join('');
return {
restrict: 'E',
transclude: true,
scope: {
walkthroughType: '@',
isActive: '=',
icon: '@',
wid: '@?',
focusElementSelector: '@?',
mainCaption: '@?',
forceCaptionLocation: '@?',
isRound: '=?',
hasBackdrop: '=?',
hasGlow: '=?',
useButton: '=?',
buttonCaption: '@?',
walkthroughHeroImage: '@?',
iconPaddingLeft: '@?',
iconPaddingTop: '@?',
tipIconLocation: '@?',
tipColor: '@?',
onWalkthroughShow: '&',
onWalkthroughHide: '&',
onWalkthroughContentClicked: '&'
},
link: function (scope, element, attrs, ctrl, $transclude) {
var getIcon = function(icon){
var retval = null;
if (ngWalkthroughTapIcons) {
switch (icon) {
case ("single_tap"):
retval = ngWalkthroughTapIcons.single_tap;
break;
case ("double_tap"):
retval = ngWalkthroughTapIcons.double_tap;
break;
case ("swipe_down"):
retval = ngWalkthroughTapIcons.swipe_down;
break;
case ("swipe_left"):
retval = ngWalkthroughTapIcons.swipe_left;
break;
case ("swipe_right"):
retval = ngWalkthroughTapIcons.swipe_right;
break;
case ("swipe_up"):
retval = ngWalkthroughTapIcons.swipe_up;
break;
case ("arrow"):
retval = ""; //Return nothing, using other dom element for arrow
break;
}
}
if (retval === null && icon && icon.length > 0){
retval = icon;
}
return retval;
};
var attemptTouchEvent = function(e){
if (scope.clickEvent === 'touch' && canTouch) { //We need this in case both angular and ionic are for some reason loaded
if ((!scope.useButton) ||
(e.currentTarget.className.indexOf(DOM_WALKTHROUGH_DONE_BUTTON_CLASS) > -1)) {
canTouch = false;
$timeout(function() {//This timeout added to avoid event propagation happening outside of directive bug
scope.closeWalkthrough();
$timeout(function () {
canTouch = true;
}, 500);
}, 200);
}
}
};
var resizeHandler = function(){
if (attrs.focusElementSelector) {
scope.setFocusOnElement(attrs.focusElementSelector);
}
};
var bindScreenResize = function(){
angular.element($window).on('resize', resizeHandler);
};
var unbindScreenResize = function(){
angular.element($window).off('resize', resizeHandler);
};
var init = function(scope){
try {
var ionic = $injector.get("$ionicPosition");
hasIonic = true;
} catch(err) {
hasIonic = false;
}
try {
ngWalkthroughTapIcons = $injector.get("ngWalkthroughTapIcons");
} catch(err) {
ngWalkthroughTapIcons = null;
}
scope.clickEvent = 'click';
//noinspection JSUnresolvedVariable
if (hasIonic) { //Might need to comment this out if fails build on angular only machine
scope.clickEvent = 'touch';
}
//Event to close the walkthrough
scope.closeWalkthrough = function(){
scope.isActive = false;
scope.onWalkthroughHide();
};
//Event used when background clicked, if we use button then do nothing
scope.onCloseClicked = function($event) {
$event.stopPropagation();
//if Angular only
if (scope.clickEvent === 'click') {
if ((!scope.useButton) ||
($event.currentTarget.className.indexOf(DOM_WALKTHROUGH_DONE_BUTTON_CLASS) > -1)) {
scope.closeWalkthrough();
}
} else { //We need this in case both angular an ionic are for some reason loaded
attemptTouchEvent($event);
}
};
scope.onCloseTouched = function($event) {
$event.stopPropagation();
attemptTouchEvent($event);
};
$timeout(function(){
scope.closeIcon = close_icon;
},100);
scope.walkthroughIcon = getIcon(scope.icon);
scope.buttonCaption = scope.buttonCaption || BUTTON_CAPTION_DONE;
if (scope.hasBackdrop === undefined){
scope.hasBackdrop = (scope.walkthroughType !== "tip");
}
};
//Sets the walkthrough focus hole on given params with padding
var setFocus = function(left, top, width, height){
var holeDimensions =
"left:" + (left - PADDING_HOLE) + "px;" +
"top:" + (top - PADDING_HOLE) + "px;" +
"width:" + (width + (2 * PADDING_HOLE)) + "px;" +
"height:" + (height + (2 * PADDING_HOLE)) + "px;";
if(scope.walkthroughHoleElements) {
scope.walkthroughHoleElements.attr('style', holeDimensions);
}
};
//Check if given icon covers text
var isItemOnText = function(iconLeft, iconTop, iconRight, iconBottom) {
var offsetCoordinates = getOffsetCoordinates(scope.walkthroughTextElement);
var textLeft = document.body.clientWidth/4;//needs to be calculated differently due to being a 'pre'. //offsetCoordinates.left;
var textRight = document.body.clientWidth/4*3;//offsetCoordinates.left + offsetCoordinates.width;
var textTop = offsetCoordinates.top;
var textBottom = offsetCoordinates.top + offsetCoordinates.height;
return !(iconRight < textLeft ||
iconLeft > textRight ||
iconBottom < textTop ||
iconTop > textBottom);
};
//Sets the icon displayed according to directive argument
var setIconAndText = function(iconLeft, iconTop, paddingLeft, paddingTop){
var offsetCoordinates = getOffsetCoordinates(scope.walkthroughIconElement);
var iconHeight = offsetCoordinates.height;
var iconWidth = offsetCoordinates.width;
var iconLeftWithPadding = iconLeft + paddingLeft - (iconWidth/4);
var iconTopWithPadding = iconTop + paddingTop - (iconHeight/6);
var iconRight = iconLeftWithPadding + iconWidth;
var iconBottom = iconTopWithPadding + iconHeight;
//Check if text overlaps icon or user explicitly wants text at bottom, if does, move it to bottom
if (scope.forceCaptionLocation === undefined && isItemOnText(iconLeftWithPadding, iconTopWithPadding, iconRight, iconBottom)){
scope.forceCaptionLocation = "BOTTOM";
}
var iconLocation =
"position: absolute;" +
"left:" + iconLeftWithPadding + "px;" +
"top:" + iconTopWithPadding + "px;";
scope.walkthroughIconElement.attr('style', iconLocation);
};
var setArrowAndText = function(pointSubjectLeft, pointSubjectTop, pointSubjectWidth, pointSubjectHeight, paddingLeft){
var offsetCoordinates = getOffsetCoordinates(scope.walkthroughTextElement);
var startLeft = offsetCoordinates.left + offsetCoordinates.width /2;
var startTop = offsetCoordinates.top + offsetCoordinates.height + PADDING_ARROW_START;
var endLeft = 0;
if (startLeft > pointSubjectLeft){//If hole left to text set arrow to point to middle right
endLeft = pointSubjectLeft + paddingLeft + pointSubjectWidth;
} else if (startLeft < pointSubjectLeft){//If hole right to text set arrow to point to middle left
endLeft = pointSubjectLeft - paddingLeft;
}
var endTop = pointSubjectTop + (pointSubjectHeight/2);
var arrowLeft,arrowRight,arrowTop,arrowBottom;
//Check if text overlaps icon or user explicitly wants text at bottom, if does, move it to bottom
arrowLeft = (startLeft<endLeft)?startLeft:endLeft;
arrowRight = (startLeft<endLeft)?endLeft:startLeft;
arrowTop = (startTop<endTop)?startTop:endTop;
arrowBottom = (startTop<endTop)?endTop:startTop;
if (scope.forceCaptionLocation === undefined && isItemOnText(arrowLeft, arrowTop, arrowRight, arrowBottom)){
scope.forceCaptionLocation = "BOTTOM";
}
if (scope.forceCaptionLocation === "BOTTOM"){
startTop -= offsetCoordinates.height;
}
var arrowSvgDom =
'<svg width="100%" height="100%">' +
'<defs>' +
'<marker id="arrow" markerWidth="13" markerHeight="13" refx="2" refy="6" orient="auto">' +
'<path d="M2,1 L2,10 L10,6 L2,2" style="fill:#fff;" />' +
'</marker>' +
'</defs>' +
'<path d="M' + startLeft + ',' + startTop + ' Q' + startLeft + ',' + endTop + ' ' + endLeft + ',' + endTop + '"' +
'style="stroke:#fff; stroke-width: 2px; fill: none;' +
'marker-end: url(#arrow);"/>' +
'/>' +
'</svg>';
scope.walkthroughArrowElement.append(arrowSvgDom);
};
var setTipIconPadding = function(iconPaddingLeft, iconPaddingTop){
var iconLocation = "";
if (iconPaddingTop){
iconLocation += "margin-top:" + iconPaddingTop + "px;";
}
if (iconPaddingLeft){
iconLocation += "right:" + iconPaddingLeft + "%;";
}
scope.walkthroughIconElement.attr('style', iconLocation);
};
//Check once
var getSameAncestor = function(walkthroughElement, focusElement){
var retval = null;
var walkthroughElementParent = element[0].offsetParent;
var focusElementParent = focusElement[0].offsetParent;
var walkthroughAncestorIter = walkthroughElementParent;
var focusElementAncestorIter = focusElementParent;
while (walkthroughAncestorIter && !retval){
focusElementAncestorIter = focusElementParent; //reset
while (focusElementAncestorIter && !retval) {
if (focusElementAncestorIter === walkthroughAncestorIter){
retval = walkthroughAncestorIter;
} else{
focusElementAncestorIter = focusElementAncestorIter.offsetParent;
}
}
walkthroughAncestorIter = walkthroughAncestorIter.offsetParent;
}
return retval;
};
var getOffsetCoordinates = function(focusElement){
var width;
var height;
var left;
var top;
if (hasIonic) { //Might need to comment this out if fails build on angular only machine
var $ionicPosition = $injector.get('$ionicPosition');
var ionicElement = $ionicPosition.offset(focusElement);
width = ionicElement.width;
height = ionicElement.height;
left = ionicElement.left;
top = ionicElement.top;
} else {
width = focusElement[0].offsetWidth;
height = focusElement[0].offsetHeight;
left = focusElement[0].getBoundingClientRect().left;
top = focusElement[0].getBoundingClientRect().top;
//var parent = focusElement[0].offsetParent;
//while (parent) {
// left = left + parent.offsetLeft;
// top = top + parent.offsetTop;
// parent = parent.offsetParent;
//}
}
var sameAncestorForFocusElementAndWalkthrough = getSameAncestor(element, focusElement);
while (sameAncestorForFocusElementAndWalkthrough) {
left = left - sameAncestorForFocusElementAndWalkthrough.offsetLeft;
top = top - sameAncestorForFocusElementAndWalkthrough.offsetTop;
sameAncestorForFocusElementAndWalkthrough = sameAncestorForFocusElementAndWalkthrough.offsetParent;
}
return { top:top, left: left, height: height, width: width};
};
var setWalkthroughElements = function(){
var holeElements = document.querySelectorAll(DOM_WALKTHROUGH_HOLE_CLASS);
scope.walkthroughHoleElements = angular.element(holeElements);
var textClass = (scope.walkthroughType === "tip")? DOM_WALKTHROUGH_TIP_TEXT_CLASS: DOM_WALKTHROUGH_TRANSPARENCY_TEXT_CLASS;
scope.walkthroughTextElement = angular.element(document.querySelector(textClass));
var iconClass = (scope.walkthroughType === "tip")? DOM_WALKTHROUGH_TIP_ICON_CLASS: DOM_WALKTHROUGH_TRANSPARENCY_ICON_CLASS;
scope.walkthroughIconElement = angular.element(document.querySelector(iconClass));
scope.walkthroughArrowElement = angular.element(document.querySelector(DOM_WALKTHROUGH_ARROW_CLASS));
$transclude(function(clone){
init(scope);
var transcludeContent = clone.text().trim();
if (!(transcludeContent.length === 0 && clone.length <= 1)) { //Transcluding
var transclude = document.querySelectorAll('.' + DOM_TRANSCLUDE);
var transcludeIndex = (scope.walkthroughType && scope.walkthroughType.toUpperCase()==="TIP")?1:0;
angular.element(transclude[transcludeIndex]).append(clone);
scope.hasTransclude = true;
}
});
};
//Attempts to highlight the given element ID and set Icon to it if exists, if not use default - right under text
var setElementLocations = function(walkthroughIconWanted, focusElementSelector, iconPaddingLeft, iconPaddingTop){
var focusElement = (focusElementSelector)?document.querySelectorAll(focusElementSelector): null;
if (focusElement && focusElement.length>0) {
if (focusElement.length > 1) {
$log.warn('Multiple items fit selector, displaying first visible as focus item');
for (var i=0;i<focusElement.length;i++) {
if (focusElement[i].offsetHeight) {//offsetHeight not of 0 means visible
focusElement = focusElement[i];
i = focusElement.length;
}
}
} else{
focusElement = focusElement[0];
}
} else{
$log.error('No element found with selector: ' + focusElementSelector);
focusElement = null;
}
var angularElement = (focusElement)?angular.element(focusElement):null;
if (angularElement && angularElement.length > 0) {
var offsetCoordinates = getOffsetCoordinates(angularElement);
var width = offsetCoordinates.width;
var height = offsetCoordinates.height;
var left = offsetCoordinates.left;
var top = offsetCoordinates.top;
setFocus(left, top, width, height);
var paddingLeft = parseFloat(iconPaddingLeft);
var paddingTop = parseFloat(iconPaddingTop);
if (!paddingLeft) { paddingLeft = 0;}
if (!paddingTop) { paddingTop = 0;}
//If Gesture icon given bind it to hole as well
if (walkthroughIconWanted && walkthroughIconWanted !== "arrow" && scope.walkthroughType === "transparency"){
$timeout(function(){
setIconAndText(left + width/2, top + height/2, paddingLeft, paddingTop);
}, 10);
}
if (walkthroughIconWanted === "arrow"){
//Need to update text location according to conditional class added 'walkthrough-transparency-bottom'
$timeout(function(){
setArrowAndText(left, top + paddingTop, width, height, paddingLeft);
}, 10);
}
//if tip mode with icon that we want to set padding to, set it
if (scope.walkthroughType === "tip" &&
walkthroughIconWanted && walkthroughIconWanted.length > 0 &&
(iconPaddingLeft || iconPaddingTop)){
setTipIconPadding(iconPaddingLeft, iconPaddingTop);
}
} else {
if (focusElementSelector) {
$log.info('Unable to find element requested to be focused: ' + focusElementSelector);
} else{
//if tip mode with icon that we want to set padding to, set it
if (scope.walkthroughType === "tip" &&
walkthroughIconWanted && walkthroughIconWanted.length > 0 &&
(iconPaddingLeft || iconPaddingTop)){
setTipIconPadding(iconPaddingLeft, iconPaddingTop);
}
}
}
};
scope.setFocusOnElement = function(focusElementSelector){
setElementLocations(scope.icon, focusElementSelector, scope.iconPaddingLeft, scope.iconPaddingTop);
};
var createDomElement = function(){
angular.element(document.body).append(template);
setWalkthroughElements();
var walkthroughElement = angular.element(document.querySelectorAll('.' + DOM_WALKTHROUGH_CLASS));
if (scope.wid !== undefined && scope.wid !== null && scope.wid.length>0) {
walkthroughElement.attr('id', scope.wid);
}
$compile(walkthroughElement)(scope);
};
var removeDomElement = function(){
var walkthroughElement = angular.element(document.querySelectorAll('.' + DOM_WALKTHROUGH_CLASS));
if (walkthroughElement && walkthroughElement.length > 0) {
walkthroughElement.remove();
}
};
scope.$watch('focusElementSelector', function(newValue, oldValue) {
if((!oldValue || newValue && oldValue) && attrs.focusElementSelector) {
scope.setFocusOnElement(attrs.focusElementSelector);
}
});
scope.$watch('isActive', function(newValue){
if(newValue){
bindScreenResize();
createDomElement();
$timeout(function(){
scope.isVisible = true;
}, 300);
//if (!scope.hasTransclude){//remarked, caused focusing issues
try {
if (attrs.focusElementSelector) {
scope.setFocusOnElement(attrs.focusElementSelector);
}
} catch(e){
$log.warn('failed to focus on element prior to timeout: ' + attrs.focusElementSelector);
}
//Must timeout to make sure we have final correct coordinates after screen totally load
if (attrs.focusElementSelector) {
$timeout(function () {
scope.setFocusOnElement(attrs.focusElementSelector);
}, 100);
}
//}
scope.onWalkthroughShow();
} else{
scope.isVisible = false;
unbindScreenResize();
removeDomElement();
}
});
var close_icon = "data:image/png;base64,"+
"iVBORw0KGgoAAAANSUhEUgAAAG4AAABuCAYAAADGWyb7AAAAAXNSR0IArs4c6QAAAAlwSFlzAAAL"+
"EwAACxMBAJqcGAAABCZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6"+
"eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYg"+
"eG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4K"+
"ICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6dGlm"+
"Zj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iCiAgICAgICAgICAgIHhtbG5zOmV4aWY9"+
"Imh0dHA6Ly9ucy5hZG9iZS5jb20vZXhpZi8xLjAvIgogICAgICAgICAgICB4bWxuczpkYz0iaHR0"+
"cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iCiAgICAgICAgICAgIHhtbG5zOnhtcD0iaHR0"+
"cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyI+CiAgICAgICAgIDx0aWZmOlJlc29sdXRpb25Vbml0"+
"PjE8L3RpZmY6UmVzb2x1dGlvblVuaXQ+CiAgICAgICAgIDx0aWZmOkNvbXByZXNzaW9uPjU8L3Rp"+
"ZmY6Q29tcHJlc3Npb24+CiAgICAgICAgIDx0aWZmOlhSZXNvbHV0aW9uPjcyPC90aWZmOlhSZXNv"+
"bHV0aW9uPgogICAgICAgICA8dGlmZjpPcmllbnRhdGlvbj4xPC90aWZmOk9yaWVudGF0aW9uPgog"+
"ICAgICAgICA8dGlmZjpZUmVzb2x1dGlvbj43MjwvdGlmZjpZUmVzb2x1dGlvbj4KICAgICAg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