-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathannotator-pro.min.js
965 lines (962 loc) · 62.1 KB
/
annotator-pro.min.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
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
!(function (a) {
"function" == typeof define && define.amd ? define(["jquery"], a) : "object" == typeof exports ? (module.exports = a) : a(jQuery);
})(function (a) {
function b(b) {
var g = b || window.event,
h = i.call(arguments, 1),
j = 0,
l = 0,
m = 0,
n = 0,
o = 0,
p = 0;
if (
((b = a.event.fix(g)),
(b.type = "mousewheel"),
"detail" in g && (m = -1 * g.detail),
"wheelDelta" in g && (m = g.wheelDelta),
"wheelDeltaY" in g && (m = g.wheelDeltaY),
"wheelDeltaX" in g && (l = -1 * g.wheelDeltaX),
"axis" in g && g.axis === g.HORIZONTAL_AXIS && ((l = -1 * m), (m = 0)),
(j = 0 === m ? l : m),
"deltaY" in g && ((m = -1 * g.deltaY), (j = m)),
"deltaX" in g && ((l = g.deltaX), 0 === m && (j = -1 * l)),
0 !== m || 0 !== l)
) {
if (1 === g.deltaMode) {
var q = a.data(this, "mousewheel-line-height");
(j *= q), (m *= q), (l *= q);
} else if (2 === g.deltaMode) {
var r = a.data(this, "mousewheel-page-height");
(j *= r), (m *= r), (l *= r);
}
if (
((n = Math.max(Math.abs(m), Math.abs(l))),
(!f || f > n) && ((f = n), d(g, n) && (f /= 40)),
d(g, n) && ((j /= 40), (l /= 40), (m /= 40)),
(j = Math[j >= 1 ? "floor" : "ceil"](j / f)),
(l = Math[l >= 1 ? "floor" : "ceil"](l / f)),
(m = Math[m >= 1 ? "floor" : "ceil"](m / f)),
k.settings.normalizeOffset && this.getBoundingClientRect)
) {
var s = this.getBoundingClientRect();
(o = b.clientX - s.left), (p = b.clientY - s.top);
}
return (
(b.deltaX = l),
(b.deltaY = m),
(b.deltaFactor = f),
(b.offsetX = o),
(b.offsetY = p),
(b.deltaMode = 0),
h.unshift(b, j, l, m),
e && clearTimeout(e),
(e = setTimeout(c, 200)),
(a.event.dispatch || a.event.handle).apply(this, h)
);
}
}
function c() {
f = null;
}
function d(a, b) {
return k.settings.adjustOldDeltas && "mousewheel" === a.type && b % 120 === 0;
}
var e,
f,
g = ["wheel", "mousewheel", "DOMMouseScroll", "MozMousePixelScroll"],
h = "onwheel" in document || document.documentMode >= 9 ? ["wheel"] : ["mousewheel", "DomMouseScroll", "MozMousePixelScroll"],
i = Array.prototype.slice;
if (a.event.fixHooks) for (var j = g.length; j;) a.event.fixHooks[g[--j]] = a.event.mouseHooks;
var k = (a.event.special.mousewheel = {
version: "3.1.12",
setup: function () {
if (this.addEventListener) for (var c = h.length; c;) this.addEventListener(h[--c], b, !1);
else this.onmousewheel = b;
a.data(this, "mousewheel-line-height", k.getLineHeight(this)), a.data(this, "mousewheel-page-height", k.getPageHeight(this));
},
teardown: function () {
if (this.removeEventListener) for (var c = h.length; c;) this.removeEventListener(h[--c], b, !1);
else this.onmousewheel = null;
a.removeData(this, "mousewheel-line-height"), a.removeData(this, "mousewheel-page-height");
},
getLineHeight: function (b) {
var c = a(b),
d = c["offsetParent" in a.fn ? "offsetParent" : "parent"]();
return d.length || (d = a("body")), parseInt(d.css("fontSize"), 10) || parseInt(c.css("fontSize"), 10) || 16;
},
getPageHeight: function (b) {
return a(b).height();
},
settings: { adjustOldDeltas: !0, normalizeOffset: !0 },
});
a.fn.extend({
mousewheel: function (a) {
return a ? this.bind("mousewheel", a) : this.trigger("mousewheel");
},
unmousewheel: function (a) {
return this.unbind("mousewheel", a);
},
});
}),
(function (a, b, c) {
function d(a) {
return (a = a || location.href), "#" + a.replace(/^[^#]*#?(.*)$/, "$1");
}
var e,
f = document,
g = a.event.special,
h = f.documentMode,
i = "onhashchange" in b && (h === c || h > 7);
(a.fn.hashchange = function (a) {
return a ? this.bind("hashchange", a) : this.trigger("hashchange");
}),
(a.fn.hashchange.delay = 50),
(g.hashchange = a.extend(g.hashchange, {
setup: function () {
return i ? !1 : void a(e.start);
},
teardown: function () {
return i ? !1 : void a(e.stop);
},
})),
(e = (function () {
function e() {
var c = d(),
f = m(j);
c !== j ? (l((j = c), f), a(b).trigger("hashchange")) : f !== j && (location.href = location.href.replace(/#.*/, "") + f), (g = setTimeout(e, a.fn.hashchange.delay));
}
var g,
h = {},
j = d(),
k = function (a) {
return a;
},
l = k,
m = k;
return (
(h.start = function () {
g || e();
}),
(h.stop = function () {
g && clearTimeout(g), (g = c);
}),
navigator.userAgent.match(/msie [6]/i) &&
!i &&
(function () {
var b, c;
(h.start = function () {
b ||
((c = (c = a.fn.hashchange.src) && c + d()),
(b = a('<iframe tabindex="-1" title="empty"/>')
.hide()
.one("load", function () {
c || l(d()), e();
})
.attr("src", c || "javascript:0")
.insertAfter("body")[0].contentWindow),
(f.onpropertychange = function () {
try {
"title" === event.propertyName && (b.document.title = f.title);
} catch (a) { }
}));
}),
(h.stop = k),
(m = function () {
return d(b.location.href);
}),
(l = function (c, d) {
var e = b.document,
g = a.fn.hashchange.domain;
c !== d && ((e.title = f.title), e.open(), g && e.write('<script>document.domain="' + g + '"</script>'), e.close(), (b.location.hash = c));
});
})(),
h
);
})());
})(jQuery, this),
(function (a, b, c, d) {
function e() {
a(c).on("mousemove", function (a) {
k != d && k.handle_event(a);
}),
a(c).on("mouseup", function (a) {
k != d && (k.handle_event(a), (k = d));
}),
a(b).on("touchmove", function (a) {
1 == a.originalEvent.touches.length && k != d && k.handle_event(a), 2 == a.originalEvent.touches.length && (a.preventDefault(), k != d && k.handle_event(a));
}),
a(b).on("touchend", function (a) {
k != d && (k.handle_event(a), (k = d));
}),
a(b).on("scroll", function () {
(o = a(b).scrollLeft()), (p = a(b).scrollTop()), l != d && l.position_popup();
}),
a(b).on("resize", function () {
(q = a(b).width()), (r = a(b).height());
}),
a(b).hashchange(function () {
if (0 == location.hash.search("#/ndd_ann/")) {
var b = location.hash.replace("#/ndd_ann/", "").replace("/", ""),
c = a("#spot-" + b)
.closest(".ndd-annotator-container")
.prop("id")
.replace("ndd-annotator-container-", "");
(c = parseInt(c)), (k = j[c]), k.focus_at_annotation(b);
}
});
}
function f(a) {
console.log(a);
}
function g(a, b, c) {
return (1 - c) * a + c * b;
}
function h(b, e) {
(this.element = b),
(this.options = a.extend({}, t, e)),
(this._defaults = t),
(this._name = s),
(this.obj = d),
(this.obj_image = d),
(this.obj_content = d),
(this.img = d),
(this.frameWidth = 0),
(this.frameHeight = 0),
(this.contentWidth = 0),
(this.contentHeight = 0),
(this.frameOffsetLeft = 0),
(this.frameOffsetTop = 0),
(this.document_width = a(c).width()),
(this.document_height = a(c).height()),
(this.minZoom = 1),
(this.maxZoom = 4),
(this.currentZoom = 1),
(this.targetZoom = 1),
(this.zoomStep = 0.25),
(this.zoomSpeed = 0.15),
(this.defaultPosX = 0),
(this.defaultPosY = 0),
(this.targetPosX = 0),
(this.targetPosY = 0),
(this.currentPosX = 0),
(this.currentPosY = 0),
(this.dragOutOfBoundsX = 0),
(this.dragOutOfBoundsY = 0),
(this.intertia = 0.9),
(this.dragEventOriginX = 0),
(this.dragEventOriginY = 0),
(this.dragInitialPositionX = 0),
(this.dragInitialPositionY = 0),
(this.dragLastEventX = 0),
(this.dragLastEventY = 0),
(this.dragMomentumX = 0),
(this.dragMomentumY = 0),
(this.dragMomentumCalculateTimer = 5),
(this.vx = 0),
(this.vy = 0),
(this.lastMomentumCalculateTime = 0),
(this.dragTimeout = d),
(this.zoomTimeout = d),
(this.focusTimeout = d),
(this.lastTouchTime = 0),
(this.didDoubleTap = !1),
(this.lastTouchX = 0),
(this.lastTouchY = 0),
(this.initialPinchDistance = 0),
(this.pinchDelta = 0),
(this.initialZoom = 0),
(this.lastZoom = 0),
(this.pinchZooming = !1),
(this.pinchZoomOffsetX = 0),
(this.pinchZoomOffsetY = 0),
(this.dragging = !1),
(this.obj_interface = d),
(this.ui_hide_timeout = d),
(this.ui_visible = !1),
(this.obj_navigator = d),
(this.obj_nav_window = d),
(this.navigatorWidth = 0),
(this.navigatorHeight = 0),
(this.navigator_dragging = !1),
(this.nav_window_width = 0),
(this.nav_window_height = 0),
(this.obj_fullscreen = d),
(this.is_fullscreen = !1),
(this.annotation_settings = this.options.annotations),
(this.annotations = new Array()),
this.init();
}
function i(b, c, e) {
(this.options = a.extend({}, u, b)),
(this.annotator = c),
(this.id = b.id),
(this.obj_global_container = e),
(this.obj_parent = c.obj_content),
(this.obj_spot = d),
(this.obj_popup_container = d),
(this.obj_popup_box = d),
(this.obj_popup_content = d),
(this.obj_popup_arrow = d),
(this.obj_popup_buffer = d),
(this.touch_start_time = 0),
(this.touch_x = 0),
(this.touch_y = 0),
(this.initialized_dimentions = !1),
(this.is_visible = !1),
this.init();
}
var j = new Array(),
k = d,
l = d,
m = !1,
n = !1,
o = a(b).scrollLeft(),
p = a(b).scrollTop(),
q = a(b).width(),
r = a(b).height();
e();
var s = "annotatorPro",
t = { frameWidth: 640, frameHeight: 480, maxZoom: "auto", navigator: !1, navigatorImagePreview: !1, fullscreen: !1, rubberband: !1 },
u = {
tint_color: "#000000",
style: 1,
popup_width: "auto",
popup_height: "auto",
popup_position: "top",
content_type: "text",
title: "Annotation",
text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
text_color: "#ffffff",
html: "",
id: "my-annotation-",
spot_left: 0,
spot_top: 0,
spot_width: 44,
spot_height: 44,
spot_circle: !0,
};
(h.prototype = {
init: function () {
var d = this;
window.annotator = this;
(d.id = j.length),
(j[d.id] = d),
(d.obj_image = a(d.element)),
d.obj_image.wrap('<div class="ndd-annotator-container"></div>'),
d.obj_image.addClass("ndd-annotator-main-image"),
(d.obj = a(d.element).parent()),
d.obj.attr("id", "ndd-annotator-container-" + d.id),
d.obj.css({ width: d.options.frameWidth, height: d.options.frameHeight }),
d.options.startInFullscreen && ((d.is_fullscreen = !0), d.obj.addClass("ndd-annotator-container-fullscreen")),
(d.frameWidth = d.obj.width()),
(d.frameHeight = d.obj.height()),
(d.img = new Image()),
(d.img.onload = function () {
var e = d.img.width / d.img.height,
f = d.frameWidth / d.frameHeight;
if (
(d.obj_image.css(e > f ? { width: "auto", height: "100%" } : { width: "100%", height: "auto" }),
(d.contentWidth = d.obj_image.width()),
(d.contentHeight = d.obj_image.height()),
d.obj_image.wrap('<div class="ndd-annotator-content"></div>'),
(d.obj_content = d.obj.find(".ndd-annotator-content")),
d.obj_content.css({
position: "absolute",
width: d.contentWidth + "px",
height: d.contentHeight + "px",
left: -d.contentWidth / 2 + d.frameWidth / 2 + "px",
top: -d.contentHeight / 2 + d.frameHeight / 2 + "px",
}),
d.obj_image.css({ opacity: "1", width: "100%", height: "100%" }),
(d.defaultPosX = d.obj_content.position().left),
(d.defaultPosY = d.obj_content.position().top),
(d.currentPosX = d.defaultPosX),
(d.currentPosY = d.defaultPosY),
(d.frameOffsetLeft = d.obj.offset().left),
(d.frameOffsetTop = d.obj.offset().top),
(d.document_width = a(c).width()),
(d.document_height = a(c).height()),
"auto" == d.options.maxZoom ? (e > f ? (d.maxZoom = d.img.height / d.frameHeight) : (d.maxZoom = d.img.width / d.frameWidth)) : (d.maxZoom = d.options.maxZoom),
d.obj.append('<div class="ndd-annotator-interface"></div>'),
(d.obj_interface = d.obj.find(".ndd-annotator-interface")),
d.options.navigator)
) {
d.obj_interface.append('<div class="ndd-annotator-navigator"><div class="ndd-annotator-navigator-window"></div></div>'),
(d.obj_navigator = d.obj.find(".ndd-annotator-navigator")),
(d.obj_nav_window = d.obj.find(".ndd-annotator-navigator-window")),
(d.options.navigatorMaxWidth = d.frameWidth / 4),
(d.options.navigatorMaxHeight = d.frameHeight / 4);
var g = d.options.navigatorMaxWidth / d.options.navigatorMaxHeight,
h = d.img.width / d.img.height,
i = 1;
(i = h > g ? d.contentWidth / d.options.navigatorMaxWidth : d.contentHeight / d.options.navigatorMaxHeight), (d.navigatorWidth = d.contentWidth / i), (d.navigatorHeight = d.contentHeight / i);
{
d.frameHeight - d.navigatorHeight - 10;
}
d.obj_navigator.css({ width: d.navigatorWidth, height: d.navigatorHeight, left: 10, top: "100%", margin: 0, "margin-top": -d.navigatorHeight - 10 }),
d.options.navigatorImagePreview && d.obj_navigator.append('<img class="ndd-annotator-navigator-image" src="' + d.img.src + '">'),
d.redraw_navigator();
}
d.options.fullscreen &&
(d.obj_interface.append('<div class="ndd-annotator-fullscreen"></div'),
(d.obj_fullscreen = d.obj_interface.find(".ndd-annotator-fullscreen")),
d.obj_fullscreen.css({ width: 44, height: 44, left: "100%", top: "100%", "margin-top": -54, "margin-left": -54, "margin-right": 0, "margin-bottom": 0 }),
d.obj_fullscreen.append(
d.is_fullscreen
? '<img alt="" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADgAAAA4CAYAAACohjseAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6RkFDRjUwRjI0QzczMTFFNEJEMURCQTlDMEQ1NjUwMjMiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6RkFDRjUwRjM0QzczMTFFNEJEMURCQTlDMEQ1NjUwMjMiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6a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= d), d.handle_event(a);
}),
a(d.obj).mousewheel(function (a, b) {
d.handle_event(a);
}),
a(b).on("resize", function (a) {
d.handle_event(a);
}),
a(d.obj).on("touchstart", function (a) {
if (1 == a.originalEvent.touches.length) {
k = d;
var b = new Date().getTime(),
c = a.originalEvent.touches[0].screenX,
e = a.originalEvent.touches[0].screenY;
b - d.lastTouchTime < 350 && b - d.lastTouchTime > 100 && Math.abs(d.lastTouchX - c) < 50 && Math.abs(d.lastTouchY - e) < 50 ? ((d.lastTouchTime = 0), (d.didDoubleTap = !0)) : (d.lastTouchTime = b),
(d.lastTouchX = c),
(d.lastTouchY = e),
d.handle_event(a);
}
2 == a.originalEvent.touches.length && ((k = d), d.handle_event(a)), a.preventDefault();
}),
d.init_annotations();
}),
(d.img.src = d.obj_image.attr("src"));
},
init_annotations: function () {
var b = this;
if (b.annotation_settings != d) {
0 == a("#ndd-annotations-global-container").length && a("body").prepend('<div id="ndd-annotations-global-container"></div>');
for (var c = a("#ndd-annotations-global-container"), e = 0; e < b.annotation_settings.length; e++) {
var f = new i(b.annotation_settings[e], b, c);
b.annotations.push(f);
}
}
},
show_ui: function () {
var a = this;
a.ui_visible || ((a.ui_visible = !0), a.obj_interface.css({ opacity: 1 }));
},
hide_ui: function () {
var a = this;
a.ui_visible && (a.obj_interface.css({ opacity: 0 }), (a.ui_visible = !1));
},
schedule_hide_ui: function () {
var a = this;
a.ui_visible &&
(clearTimeout(a.ui_hide_timeout),
(a.ui_hide_timeout = setTimeout(function () {
a.hide_ui();
}, 1e3)));
},
toggle_fullscreen: function () {
var b = this;
if (b.is_fullscreen)
for (b.obj.remove(); b.annotations.length > 0;) {
var c = b.annotations.pop();
c["delete"]();
}
else {
a("body").prepend('<img src="' + b.img.src + '" id="ndd-annotator-fullscreen-temp-image">');
var d = b.options;
(d.startInFullscreen = !0), (d.frameWidth = "100%"), (d.frameHeight = "100%"), a("#ndd-annotator-fullscreen-temp-image").annotatorPro(d);
}
},
handle_event: function (b) {
var c = this;
if (
(b.stopPropagation(),
b.preventDefault(),
"mousewheel" != b.type &&
!m &&
(a(b.target).hasClass("ndd-annotator-fullscreen") ||
a(b.target).parent().hasClass("ndd-annotator-fullscreen") ||
a(b.target).hasClass("ndd-annotator-navigator") ||
a(b.target).hasClass("ndd-annotator-navigator-image") ||
a(b.target).hasClass("ndd-annotator-navigator-window")))
)
return (
"mousedown" == b.type &&
((n = !0),
(a(b.target).hasClass("ndd-annotator-navigator") || a(b.target).hasClass("ndd-annotator-navigator-image") || a(b.target).hasClass("ndd-annotator-navigator-window")) &&
(c.navigator_window_start_dragging(b.pageX, b.pageY), (c.navigator_dragging = !0))),
"mouseup" == b.type && ((n = !1), (a(b.target).hasClass("ndd-annotator-fullscreen") || a(b.target).parent().hasClass("ndd-annotator-fullscreen")) && c.toggle_fullscreen()),
"mousemove" == b.type && ((n = !0), c.navigator_dragging && c.navigator_window_drag(b.pageX, b.pageY)),
"touchstart" == b.type &&
1 == b.originalEvent.touches.length &&
(c.show_ui(),
(n = !0),
(a(b.target).hasClass("ndd-annotator-navigator") || a(b.target).hasClass("ndd-annotator-navigator-image") || a(b.target).hasClass("ndd-annotator-navigator-window")) &&
(c.navigator_window_start_dragging(b.originalEvent.touches[0].pageX, b.originalEvent.touches[0].pageY), (c.navigator_dragging = !0))),
"touchmove" == b.type && 1 == b.originalEvent.touches.length && (c.show_ui(), (n = !0), c.navigator_dragging && c.navigator_window_drag(b.originalEvent.touches[0].pageX, b.originalEvent.touches[0].pageY)),
void (
"touchend" == b.type &&
0 == b.originalEvent.touches.length &&
(c.schedule_hide_ui(), (n = !1), (a(b.target).hasClass("ndd-annotator-fullscreen") || a(b.target).parent().hasClass("ndd-annotator-fullscreen")) && c.toggle_fullscreen())
)
);
if (
(!n || ("touchend" != b.type && "mouseup" != b.type) || (c.schedule_hide_ui(), (n = !1)),
n && "mousemove" == b.type && c.navigator_dragging && c.navigator_window_drag(b.pageX, b.pageY),
n && "touchmove" == b.type && (c.show_ui(), c.navigator_dragging && c.navigator_window_drag(b.originalEvent.touches[0].pageX, b.originalEvent.touches[0].pageY)),
!n)
) {
if (
("mousedown" == b.type && ((m = !0), (c.dragging = !0), c.start_moving(b.screenX, b.screenY)),
"mousemove" == b.type && ((m = !0), c.dragging && c.move(b.screenX, b.screenY)),
"mouseup" == b.type && ((m = !1), c.stop_moving(), (c.dragging = !1)),
"mousewheel" == b.type && (b.deltaY > 0 ? c.zoom_in(b.offsetX, b.offsetY) : b.deltaY < 0 && c.zoom_out(b.offsetX, b.offsetY)),
"resize" == b.type && c.update_size(),
"touchstart" == b.type && 2 == b.originalEvent.touches.length)
) {
c.show_ui(), (m = !0), (this.pinchZooming = !0);
var e = b.originalEvent.touches[0].screenX,
f = b.originalEvent.touches[0].screenY,
g = b.originalEvent.touches[1].screenX,
h = b.originalEvent.touches[1].screenY;
(c.initialPinchDistance = Math.sqrt(Math.pow(f - h, 2) + Math.pow(e - g, 2))), (c.initialZoom = c.currentZoom);
}
if ("touchmove" == b.type && 2 == b.originalEvent.touches.length) {
c.show_ui(), (m = !0);
var e = b.originalEvent.touches[0].screenX,
f = b.originalEvent.touches[0].screenY,
g = b.originalEvent.touches[1].screenX,
h = b.originalEvent.touches[1].screenY;
(c.pinchDelta = Math.sqrt(Math.pow(f - h, 2) + Math.pow(e - g, 2)) - c.initialPinchDistance), (c.pinchDelta = (7 * c.pinchDelta) / Math.sqrt(Math.pow(c.contentWidth, 2) + Math.pow(c.contentHeight, 2)));
var i = b.originalEvent.touches[0].pageX - c.obj.offset().left,
j = b.originalEvent.touches[0].pageY - c.obj.offset().top,
k = b.originalEvent.touches[1].pageX - c.obj.offset().left,
o = b.originalEvent.touches[1].pageY - c.obj.offset().top;
(c.pinchZoomOffsetX = (i + k) / 2), (c.pinchZoomOffsetY = (j + o) / 2), c.pinch_zoom(c.pinchZoomOffsetX, c.pinchZoomOffsetY);
}
if ("touchstart" == b.type)
if ((c.show_ui(), (m = !0), (this.dragging = !0), c.didDoubleTap)) {
var p = b.originalEvent.touches[0].pageX - c.obj.offset().left,
q = b.originalEvent.touches[0].pageY - c.obj.offset().top;
c.currentZoom < c.maxZoom / 2 ? c.zoom_in(p, q, !0) : c.zoom_out(p, q, !0), (c.didDoubleTap = !1);
} else c.start_moving(b.originalEvent.touches[0].screenX, b.originalEvent.touches[0].screenY);
"touchend" == b.type &&
(c.schedule_hide_ui(),
(m = !1),
c.stop_moving(),
l != d && a(b.target).hasClass("ndd-annotator-main-image") && l.hide(),
this.pinchZooming &&
((this.pinchZooming = !1), c.currentZoom > c.maxZoom ? c.zoom_in(c.pinchZoomOffsetX, c.pinchZoomOffsetY, !0) : c.currentZoom < c.minZoom && c.zoom_out(c.pinchZoomOffsetX, c.pinchZoomOffsetY, !0))),
"touchmove" == b.type && (c.show_ui(), (m = !0), c.dragging && c.move(b.originalEvent.touches[0].screenX, b.originalEvent.touches[0].screenY));
}
},
navigator_window_start_dragging: function (a, b) {
var c = this;
if (a > this.obj_nav_window.offset().left && a < this.obj_nav_window.offset().left + this.nav_window_width && b > this.obj_nav_window.offset().top && b < this.obj_nav_window.offset().top + this.nav_window_height)
(c.dragEventOriginX = a), (c.dragEventOriginY = b), (c.dragInitialPositionX = c.currentPosX), (c.dragInitialPositionY = c.currentPosY);
else {
(c.dragInitialPositionX = c.currentPosX), (c.dragInitialPositionY = c.currentPosY);
var d = (c.contentWidth * c.currentZoom) / c.navigatorWidth,
e = c.obj_nav_window.offset().left + c.nav_window_width / 2,
f = c.obj_nav_window.offset().top + c.nav_window_height / 2,
g = (e - a) * d,
h = (f - b) * d;
(c.targetPosX = c.dragInitialPositionX + g),
(c.targetPosY = c.dragInitialPositionY + h),
c.constrain_target_position(),
(c.currentPosX = c.targetPosX),
(c.currentPosY = c.targetPosY),
c.redraw(),
c.redraw_navigator(),
(c.dragEventOriginX = a),
(c.dragEventOriginY = b),
(c.dragInitialPositionX = c.currentPosX),
(c.dragInitialPositionY = c.currentPosY);
}
},
navigator_window_drag: function (a, b) {
var c = this,
d = (c.contentWidth * c.currentZoom) / c.navigatorWidth,
e = (c.dragEventOriginX - a) * d,
f = (c.dragEventOriginY - b) * d;
(c.targetPosX = c.dragInitialPositionX + e), (c.targetPosY = c.dragInitialPositionY + f), c.constrain_target_position(), (c.currentPosX = c.targetPosX), (c.currentPosY = c.targetPosY), c.redraw(), c.redraw_navigator();
},
pinch_zoom: function (a, b) {
var c = this,
d = c.initialZoom * (1 + c.pinchDelta);
if (d > c.maxZoom) {
var e = 1 - (d - c.maxZoom);
(e = 0 > e ? 0 : e), (d = c.lastZoom + (d - c.lastZoom) * e);
}
if (d < c.minZoom) {
var e = 1 - 4 * (c.minZoom - d);
(e = 0 > e ? 0 : e), (d = c.lastZoom + (d - c.lastZoom) * e);
}
(c.targetZoom = d), (c.lastZoom = c.targetZoom);
var f = (a - c.currentPosX) / (c.contentWidth * c.currentZoom),
g = (b - c.currentPosY) / (c.contentHeight * c.currentZoom);
(c.targetPosX = c.currentPosX - (c.targetZoom - c.currentZoom) * c.contentWidth * f),
(c.targetPosY = c.currentPosY - (c.targetZoom - c.currentZoom) * c.contentHeight * g),
(c.currentZoom = c.targetZoom),
(c.currentPosX = c.targetPosX),
(c.currentPosY = c.targetPosY),
c.redraw();
},
zoom_in: function (a, b, c) {
var d = this;
(d.targetZoom += d.zoomStep), (d.targetZoom = d.targetZoom < d.maxZoom ? d.targetZoom : d.maxZoom), (d.targetZoom = d.targetZoom > d.minZoom ? d.targetZoom : d.minZoom), 1 == c && (d.targetZoom = d.maxZoom);
var e = (a - d.currentPosX) / (d.contentWidth * d.currentZoom),
f = (b - d.currentPosY) / (d.contentHeight * d.currentZoom);
(d.targetPosX = d.currentPosX - (d.targetZoom - d.currentZoom) * d.contentWidth * e), (d.targetPosY = d.currentPosY - (d.targetZoom - d.currentZoom) * d.contentHeight * f), d.constrain_target_position(), d.apply_zoom();
},
zoom_out: function (a, b, c) {
var d = this;
(d.targetZoom -= d.zoomStep), (d.targetZoom = d.targetZoom < d.maxZoom ? d.targetZoom : d.maxZoom), (d.targetZoom = d.targetZoom > d.minZoom ? d.targetZoom : d.minZoom), 1 == c && (d.targetZoom = d.minZoom);
var e = (a - d.currentPosX) / (d.contentWidth * d.currentZoom),
f = (b - d.currentPosY) / (d.contentHeight * d.currentZoom);
(d.targetPosX = d.currentPosX - (d.targetZoom - d.currentZoom) * d.contentWidth * e), (d.targetPosY = d.currentPosY - (d.targetZoom - d.currentZoom) * d.contentHeight * f), d.constrain_target_position(), d.apply_zoom();
},
apply_zoom: function () {
var a = this;
clearTimeout(a.dragTimeout),
clearTimeout(a.zoomTimeout),
(a.currentZoom = g(a.currentZoom, a.targetZoom, a.zoomSpeed)),
(a.currentPosX = g(a.currentPosX, a.targetPosX, a.zoomSpeed)),
(a.currentPosY = g(a.currentPosY, a.targetPosY, a.zoomSpeed)),
a.redraw(),
Math.abs(a.currentZoom - a.targetZoom) > 0.025 || Math.abs(a.currentPosX - a.targetPosX) > 0.5 || Math.abs(a.currentPosY - a.targetPosY) > 0.5
? (a.zoomTimeout = setTimeout(function () {
a.apply_zoom();
}, 16))
: ((a.currentZoom = a.targetZoom), (a.currentPosX = a.targetPosX), (a.currentPosY = a.targetPosY), a.redraw());
},
start_moving: function (a, b) {
var c = this;
(c.dragOutOfBoundsX = 0),
(c.dragOutOfBoundsY = 0),
(c.dragEventOriginX = a),
(c.dragEventOriginY = b),
(c.dragInitialPositionX = c.currentPosX),
(c.dragInitialPositionY = c.currentPosY),
(c.dragLastEventX = c.dragEventOriginX),
(c.dragLastEventY = c.dragEventOriginY),
(c.dragLastEventMomentumX = c.dragEventOriginX),
(c.dragLastEventMomentumY = c.dragEventOriginY),
(k = c),
(c.dragMomentumX = 0),
(c.dragMomentumY = 0),
(c.vx = 0),
(c.vy = 0),
clearTimeout(c.dragTimeout),
clearTimeout(c.zoomTimeout);
},
move: function (a, b) {
var c = this;
c.calculate_out_of_bounds();
var d = 1 - Math.abs(c.dragOutOfBoundsX) / 100 < 0 ? 0 : 1 - Math.abs(c.dragOutOfBoundsX) / 100,
e = 1 - Math.abs(c.dragOutOfBoundsY) / 100 < 0 ? 0 : 1 - Math.abs(c.dragOutOfBoundsY) / 100;
(c.vx = (a - c.dragLastEventX) * d), (c.vy = (b - c.dragLastEventY) * e);
var f = new Date().getTime();
f - c.lastMomentumCalculateTime > 16 &&
((c.dragMomentumX = a - c.dragLastEventMomentumX),
(c.dragMomentumY = b - c.dragLastEventMomentumY),
(c.dragMomentumX = c.dragMomentumX > 50 ? 50 : c.dragMomentumX),
(c.dragMomentumY = c.dragMomentumY > 50 ? 50 : c.dragMomentumY),
(c.lastMomentumCalculateTime = f),
(c.dragLastEventMomentumX = c.dragLastEventX),
(c.dragLastEventMomentumY = c.dragLastEventY)),
(c.currentPosX += c.vx),
(c.currentPosY += c.vy),
c.redraw(),
(c.dragLastEventX = a),
(c.dragLastEventY = b);
},
stop_moving: function () {
var a = this;
a.calculate_out_of_bounds(),
(a.vx = a.dragMomentumX - a.dragOutOfBoundsX / 2),
(a.vy = a.dragMomentumY - a.dragOutOfBoundsY / 2),
(a.vx = a.vx > 20 ? 20 : a.vx),
(a.vx = a.vx < -20 ? -20 : a.vx),
(a.vy = a.vy > 20 ? 20 : a.vy),
(a.vy = a.vy < -20 ? -20 : a.vy),
(a.currentPosX += a.vx),
(a.currentPosY += a.vy),
(a.dragMomentumX = a.dragMomentumX * a.intertia),
(a.dragMomentumY = a.dragMomentumY * a.intertia),
a.redraw(),
(Math.abs(a.vx) > 0.15 || Math.abs(a.vy) > 0.15) &&
(a.dragTimeout = setTimeout(function () {
a.stop_moving();
}, 16));
},
focus_at_annotation: function (a) {
for (var b = this, c = d, e = 0; e < b.annotations.length; e++) b.annotations[e].id == a && (c = b.annotations[e]);
c.show();
var f = (parseInt(c.options.spot_left) / 100) * b.contentWidth * b.currentZoom,
g = (parseInt(c.options.spot_top) / 100) * b.contentHeight * b.currentZoom;
(b.targetPosX = b.currentPosX - (b.currentPosX - b.frameWidth / 2) - f), (b.targetPosY = b.currentPosY - (b.currentPosY - b.frameHeight / 2) - g), b.constrain_target_position(), b.apply_focus();
},
apply_focus: function () {
var a = this;
clearTimeout(a.focusTimeout),
(a.currentPosX = g(a.currentPosX, a.targetPosX, 0.15)),
(a.currentPosY = g(a.currentPosY, a.targetPosY, 0.15)),
a.redraw(),
Math.abs(a.currentPosX - a.targetPosX) > 1 || Math.abs(a.currentPosY - a.targetPosY) > 1
? (a.focusTimeout = setTimeout(function () {
a.apply_focus();
}, 16))
: ((a.currentPosX = a.targetPosX), (a.currentPosY = a.targetPosY), a.redraw());
},
calculate_out_of_bounds: function () {
var a = this,
b = -a.contentWidth * a.currentZoom + a.frameWidth,
c = -a.contentHeight * a.currentZoom + a.frameHeight;
(a.dragOutOfBoundsX = 0),
(a.dragOutOfBoundsY = 0),
a.currentPosX > 0 && (a.dragOutOfBoundsX = a.currentPosX),
a.currentPosY > 0 && (a.dragOutOfBoundsY = a.currentPosY),
a.currentPosX < b && (a.dragOutOfBoundsX = a.currentPosX - b),
a.currentPosY < c && (a.dragOutOfBoundsY = a.currentPosY - c);
},
constrain_target_position: function () {
var a = this,
b = -a.contentWidth * a.targetZoom + a.frameWidth,
c = -a.contentHeight * a.targetZoom + a.frameHeight;
a.targetPosX > 0 && (a.targetPosX = 0), a.targetPosY > 0 && (a.targetPosY = 0), a.targetPosX < b && (a.targetPosX = b), a.targetPosY < c && (a.targetPosY = c);
},
redraw: function () {
var a = this;
a.options.rubberband || a.constrain_current_position(),
a.obj_content.css({ width: a.contentWidth * a.currentZoom, height: a.contentHeight * a.currentZoom, left: a.currentPosX, top: a.currentPosY }),
a.options.navigator && a.redraw_navigator(),
l != d && l.position_popup();
},
constrain_current_position: function () {
var a = this,
b = -a.contentWidth * a.currentZoom + a.frameWidth,
c = -a.contentHeight * a.currentZoom + a.frameHeight;
(a.dragOutOfBoundsX = 0), (a.dragOutOfBoundsY = 0), a.currentPosX > 0 && (a.currentPosX = 0), a.currentPosY > 0 && (a.currentPosY = 0), a.currentPosX < b && (a.currentPosX = b), a.currentPosY < c && (a.currentPosY = c);
},
redraw_navigator: function () {
var a = this;
if (a.options.navigator) {
var b = (a.contentWidth * a.currentZoom) / a.navigatorWidth,
c = -a.currentPosX / b,
d = -a.currentPosY / b,
e = (a.contentWidth * a.currentZoom - a.frameWidth - a.currentPosX) / b,
f = (a.contentHeight * a.currentZoom - a.frameHeight - a.currentPosY) / b;
(a.nav_window_width = a.navigatorWidth + c - e), (a.nav_window_height = a.navigatorHeight + d - f), a.obj_nav_window.css({ width: a.nav_window_width, height: a.nav_window_height, left: c, top: d });
}
},
update_size: function () {
var b = this;
if (b.frameWidth != b.obj.width() || b.frameHeight != b.obj.height()) {
(b.frameWidth = b.obj.width()), (b.frameHeight = b.obj.height());
var d = b.img.width / b.img.height,
e = b.frameWidth / b.frameHeight;
for (
b.obj_image.unwrap(),
b.obj_image.css(d > e ? { width: "auto", height: "100%" } : { width: "100%", height: "auto" }),
b.contentWidth = b.obj_image.width(),
b.contentHeight = b.obj_image.height(),
b.obj_image.wrap('<div class="ndd-annotator-content"></div>'),
b.obj_content = b.obj.find(".ndd-annotator-content"),
b.obj_content.css({
position: "absolute",
width: b.contentWidth + "px",
height: b.contentHeight + "px",
left: -b.contentWidth / 2 + b.frameWidth / 2 + "px",
top: -b.contentHeight / 2 + b.frameHeight / 2 + "px",
}),
b.obj_image.css({ opacity: "1", width: "100%", height: "100%" }),
b.defaultPosX = b.obj_content.position().left,
b.defaultPosY = b.obj_content.position().top,
b.currentPosX = b.defaultPosX,
b.currentPosY = b.defaultPosY,
b.currentZoom = 1,
b.targetZoom = 1,
b.redraw_navigator();
b.annotations.length > 0;
) {
var f = b.annotations.pop();
f["delete"]();
}
(b.document_width = a(c).width()), (b.document_height = a(c).height()), b.init_annotations();
}
},
}),
(i.prototype = {
init: function () {
var b = this;
if (b.options.spot_circle)
if ((b.obj_parent.append('<div id="spot-' + b.id + '" class="ndd-spot"></div>'), (b.obj_spot = b.obj_parent.find("#spot-" + b.id)), b.options.style > 4)) {
var c = b.options.style - 4;
b.obj_spot.append('<div class="ndd-marker-container ndd-marker-style-' + b.options.style + '"><img src="assets/vendor/annotator-pro/editor/img/annotator-pro/icon_loc_0' + c + '.png"></div>');
} else b.obj_spot.append('<div class="ndd-marker-container ndd-marker-style-' + b.options.style + '"><div class="ndd-marker-main"></div><div class="ndd-marker-border"></div></div>');
else
b.obj_parent.append('<div id="spot-' + b.id + '" class="ndd-spot-rect"></div>'),
(b.obj_spot = b.obj_parent.find("#spot-" + b.id)),
b.obj_spot.append(
'<div class="ndd-rect-marker-container ndd-rect-marker-style-' + b.options.style + '"><div class="ndd-marker-main-wrap"><div class="ndd-marker-main"></div></div><div class="ndd-marker-border"></div></div>'
);
if (
(b.options.spot_circle && ((b.options.spot_width = 44), (b.options.spot_height = 44)),
b.obj_spot.css({ left: b.options.spot_left, top: b.options.spot_top, width: b.options.spot_width, height: b.options.spot_height }),
b.obj_global_container.prepend('<div class="ndd-popup-container" id="' + b.id + '"></div>'),
(b.obj_popup_container = b.obj_global_container.find("#" + b.id)),
b.obj_popup_container.append('<div class="ndd-popup-box"></div>'),
b.obj_popup_container.append('<div class="ndd-popup-buffer"></div>'),
(b.obj_popup_box = b.obj_popup_container.find(".ndd-popup-box")),
(b.obj_popup_buffer = b.obj_popup_container.find(".ndd-popup-buffer")),
b.obj_popup_box.append('<div class="ndd-popup-content"></div>'),
b.obj_popup_container.append('<div class="ndd-popup-arrow-down"></div>'),
(b.obj_popup_content = b.obj_popup_box.find(".ndd-popup-content")),
(b.obj_popup_arrow = b.obj_popup_container.find(".ndd-popup-arrow-down")),
"text" == b.options.content_type ? b.obj_popup_content.append("<h1>" + b.options.title + "</h1><p>" + b.options.text + "</p>") : b.obj_popup_content.html(b.options.html),
a(b.obj_spot).on("mousemove", function () {
b.show();
}),
a(b.obj_spot).on("mouseout", function (c) {
var e = c.toElement;
e == d && (e = c.relatedTarget), a(e).closest(".ndd-popup-container").hasClass("ndd-popup-container") || a(e).closest(".ndd-spot").hasClass("ndd-spot") || b.hide();
}),
a(b.obj_popup_container).on("mouseout", function (c) {
var e = c.toElement;
e == d && (e = c.relatedTarget), a(e).closest(".ndd-popup-container").hasClass("ndd-popup-container") || a(e).closest(".ndd-spot").hasClass("ndd-spot") || b.hide();
}),
a(b.obj_spot).on("touchstart", function (a) {
if (1 == a.originalEvent.touches.length) {
var c = new Date().getTime();
(b.touch_start_time = c), (b.touch_x = a.originalEvent.touches[0].pageX), (b.touch_y = a.originalEvent.touches[0].pageY), f(a);
}
}),
a(b.obj_spot).on("touchend", function (a) {
var c = new Date().getTime();
c - b.touch_start_time < 200 && Math.abs(b.touch_x - a.originalEvent.changedTouches[0].pageX) < 20 && Math.abs(b.touch_y - a.originalEvent.changedTouches[0].pageY) < 20 && (b.is_visible ? b.hide() : b.show());
}),
b.obj_popup_box.css({ background: b.options.tint_color, color: b.options.text_color }),
b.obj_spot.find(".ndd-marker-main").css({ background: b.options.tint_color }),
b.obj_spot.find(".ndd-marker-border").css({ "border-color": b.options.tint_color }),
"top" == b.options.popup_position && b.obj_popup_arrow.css({ "border-color": "transparent", "border-top-color": b.options.tint_color }),
"bottom" == b.options.popup_position && b.obj_popup_arrow.css({ "border-color": "transparent", "border-bottom-color": b.options.tint_color }),
"left" == b.options.popup_position && b.obj_popup_arrow.css({ "border-color": "transparent", "border-left-color": b.options.tint_color }),
"right" == b.options.popup_position && b.obj_popup_arrow.css({ "border-color": "transparent", "border-right-color": b.options.tint_color }),
!b.options.spot_circle)
) {
{
a(b.obj_spot).width(), a(b.obj_spot).height();
}
(2 == b.options.style || 4 == b.options.style) && b.obj_spot.find(".ndd-marker-main-wrap").css({ padding: 5 }), 3 == b.options.style && b.obj_spot.find(".ndd-marker-main-wrap").css({ padding: 3 });
}
},
show: function () {
var a = this;
a.is_visible ||
(a.initialized_dimentions || ((a.initialized_dimentions = !0), a.obj_popup_container.addClass("ndd-popup-visible"), a.initialize_popup()),
a.position_popup(),
a.obj_popup_container.addClass("ndd-popup-visible"),
(a.is_visible = !0),
l != d && l.hide(),
(l = a));
},
hide: function () {
var a = this;
(a.is_visible = !1), a.obj_popup_container.removeClass("ndd-popup-visible"), (l = d);
},
position_popup: function () {
var a = this,
b = a.obj_spot.offset().left - o,
c = a.obj_spot.offset().top - p,
d = 0,
e = 0;
"top" == a.options.popup_position &&
((d = b + a.obj_spot.width() / 2 - a.options.popup_width / 2), (e = c - a.options.popup_height - 20), 1 != a.options.style && 2 != a.options.style && 3 != a.options.style && 4 != a.options.style && (e -= 20)),
"bottom" == a.options.popup_position &&
((d = b + a.obj_spot.width() / 2 - a.options.popup_width / 2), (e = c + a.obj_spot.height() + 20), 1 != a.options.style && 2 != a.options.style && 3 != a.options.style && 4 != a.options.style && (e -= 20)),
"left" == a.options.popup_position &&
((d = b - a.options.popup_width - 20), (e = c + a.obj_spot.height() / 2 - a.options.popup_height / 2), 1 != a.options.style && 2 != a.options.style && 3 != a.options.style && 4 != a.options.style && (e -= 20)),
"right" == a.options.popup_position &&
((d = b + a.obj_spot.width() + 20), (e = c + a.obj_spot.height() / 2 - a.options.popup_height / 2), 1 != a.options.style && 2 != a.options.style && 3 != a.options.style && 4 != a.options.style && (e -= 20));
var f = d,
g = e;
a.annotator.is_fullscreen ||
(d > a.annotator.frameOffsetLeft + a.annotator.frameWidth + 20 - o && (d = a.annotator.frameOffsetLeft + a.annotator.frameWidth + 20 - o),
e > a.annotator.frameOffsetTop + a.annotator.frameHeight + 20 - p && (e = a.annotator.frameOffsetTop + a.annotator.frameHeight + 20 - p),
d < a.annotator.frameOffsetLeft - a.options.popup_width - 20 - o && (d = a.annotator.frameOffsetLeft - a.options.popup_width - 20 - o),
e < a.annotator.frameOffsetTop - a.options.popup_height - 20 - p && (e = a.annotator.frameOffsetTop - a.options.popup_height - 20 - p)),
d > q - a.options.popup_width && (d = q - a.options.popup_width),
0 > d && (d = 0),
e > r - a.options.popup_height && (e = r - a.options.popup_height),
0 > e && (e = 0),
a.obj_popup_container.css({ left: d, top: e }),
(Math.abs(f - d) > 400 || Math.abs(g - e) > 400) && a.hide();
},
initialize_popup: function () {
var a = this,
b = 0,
c = 0,
d = 0,
e = 0;
"auto" == a.options.popup_width ? (a.obj_popup_box.css({ width: "auto" }), (a.options.popup_width = a.obj_popup_box.width())) : a.obj_popup_box.css({ width: a.options.popup_width }),
"auto" == a.options.popup_height ? (a.obj_popup_box.css({ height: "auto" }), (a.options.popup_height = a.obj_popup_box.height())) : a.obj_popup_box.css({ height: a.options.popup_height }),
"top" == a.options.popup_position &&
((b = -a.options.popup_width / 2),
(a.options.popup_left = "50%"),
(a.options.popup_top = -a.options.popup_height - 20),
a.obj_popup_arrow.removeClass("ndd-popup-arrow-up"),
a.obj_popup_arrow.removeClass("ndd-popup-arrow-left"),
a.obj_popup_arrow.removeClass("ndd-popup-arrow-right"),
a.obj_popup_arrow.addClass("ndd-popup-arrow-down"),
a.obj_popup_arrow.css({ left: a.options.popup_width / 2 - 10, top: "100%" }),
a.obj_popup_buffer.css({ width: "100%", height: a.options.popup_height + 30 })),
"bottom" == a.options.popup_position &&
((b = -a.options.popup_width / 2),
(a.options.popup_left = "50%"),
(a.options.popup_top = "100%"),
(e = 20),
a.obj_popup_arrow.removeClass("ndd-popup-arrow-down"),
a.obj_popup_arrow.removeClass("ndd-popup-arrow-left"),
a.obj_popup_arrow.removeClass("ndd-popup-arrow-right"),
a.obj_popup_arrow.addClass("ndd-popup-arrow-up"),
a.obj_popup_arrow.css({ left: a.options.popup_width / 2 - 10, top: -10 }),
a.obj_popup_buffer.css({ top: -30, width: "100%", height: a.options.popup_height + 30 })),
"left" == a.options.popup_position &&
((c = -a.options.popup_height / 2),
(a.options.popup_top = "50%"),
(a.options.popup_left = -a.options.popup_width - 20),
a.obj_popup_arrow.removeClass("ndd-popup-arrow-down"),
a.obj_popup_arrow.removeClass("ndd-popup-arrow-left"),
a.obj_popup_arrow.removeClass("ndd-popup-arrow-up"),
a.obj_popup_arrow.addClass("ndd-popup-arrow-right"),
a.obj_popup_arrow.css({ left: "100%", top: a.options.popup_height / 2 - 10 }),
a.obj_popup_buffer.css({ width: a.options.popup_width + 30, height: "100%" })),
"right" == a.options.popup_position &&
((c = -a.options.popup_height / 2),
(a.options.popup_left = "100%"),
(a.options.popup_top = "50%"),
(d = 20),
a.obj_popup_arrow.removeClass("ndd-popup-arrow-down"),
a.obj_popup_arrow.removeClass("ndd-popup-arrow-right"),
a.obj_popup_arrow.removeClass("ndd-popup-arrow-up"),
a.obj_popup_arrow.addClass("ndd-popup-arrow-left"),
a.obj_popup_arrow.css({ left: -10, top: a.options.popup_height / 2 - 10 }),
a.obj_popup_buffer.css({ left: -30, width: a.options.popup_width + 30, height: "100%" }));
},
delete: function () {
var a = this;
a.obj_popup_container.remove(), a.obj_spot.remove();
},
}),
(a.fn[s] = function (b) {
return this.each(function () {
a.data(this, "plugin_" + s) || a.data(this, "plugin_" + s, new h(this, b));
});
});
})(jQuery, window, document);