##// END OF EJS Templates
Do not close images from refpopups when the popup is removed
neko259 -
r1474:378f92ac default
parent child Browse files
Show More
@@ -149,7 +149,6 b' PopupImageViewer.prototype.view = functi'
149 'left': (win_w - img_w) / 2,
149 'left': (win_w - img_w) / 2,
150 'top': ((win_h - img_h) / 2)
150 'top': ((win_h - img_h) / 2)
151 })
151 })
152 .appendTo(postNode)
153 //scaling preview
152 //scaling preview
154 .mousewheel(function(event, delta) {
153 .mousewheel(function(event, delta) {
155 var cx = event.originalEvent.clientX;
154 var cx = event.originalEvent.clientX;
@@ -175,12 +174,12 b' PopupImageViewer.prototype.view = functi'
175 });
174 });
176
175
177 return false;
176 return false;
178 }
177 })
179 )
180 .draggable({
178 .draggable({
181 addClasses: false,
179 addClasses: false,
182 stack: '.img-full'
180 stack: '.img-full'
183 });
181 })
182 .appendTo($('body'));
184 } else {
183 } else {
185 existingPopups.remove();
184 existingPopups.remove();
186 }
185 }
@@ -1,3 +1,5 b''
1 var LOADING_MSG = "<div class=\"post\">" + gettext('Loading...') + "</div>";
2
1 function $X(path, root) {
3 function $X(path, root) {
2 return document.evaluate(path, root || document, null, 6, null);
4 return document.evaluate(path, root || document, null, 6, null);
3 }
5 }
@@ -56,6 +58,7 b' function showPostPreview(e) {'
56
58
57 var post = $('#' + pNum);
59 var post = $('#' + pNum);
58 if (post.length > 0 && isElementInViewport(post)) {
60 if (post.length > 0 && isElementInViewport(post)) {
61 // If post is on the same page and visible, just highlight it
59 post.addClass('highlight');
62 post.addClass('highlight');
60 } else {
63 } else {
61 var x = reflink.offset().left;
64 var x = reflink.offset().left;
@@ -65,19 +68,21 b' function showPostPreview(e) {'
65 cln.id = 'pstprev_' + pNum;
68 cln.id = 'pstprev_' + pNum;
66 cln.className = 'post_preview';
69 cln.className = 'post_preview';
67
70
68 // var newX = x < doc.body.clientWidth/2 ? 'left:' + x : 'right:' + parseInt(doc.body.clientWidth - x - reflink.width());
69 // var newY = y < doc.body.clientHeight/2 ? 'top:' + y : 'bottom:' + parseInt(doc.body.clientHeight - y - reflink.height());
70 cln.style.cssText = 'left:' + x + 'px; top:' + y + 'px';
71 cln.style.cssText = 'left:' + x + 'px; top:' + y + 'px';
71
72
72 cln.addEventListener('mouseout', delPostPreview, false);
73 cln.addEventListener('mouseout', delPostPreview, false);
73
74
74 cln.innerHTML = "<div class=\"post\">" + gettext('Loading...') + "</div>";
75 cln.innerHTML = LOADING_MSG;
75
76
76 if(post.length > 0) {
77 if (post.length > 0) {
77 var postdata = post.clone().wrap("<div/>").parent().html();
78 // If post is on the same page but not visible, generate preview from it
79 var postClone = post.clone();
80 postClone.removeAttr('style');
81 var postdata = postClone.wrap("<div/>").parent().html();
78
82
79 mkPreview(cln, postdata);
83 mkPreview(cln, postdata);
80 } else {
84 } else {
85 // If post is from other page, load it
81 $.ajax({
86 $.ajax({
82 url: '/api/post/' + pNum + '/?truncated'
87 url: '/api/post/' + pNum + '/?truncated'
83 })
88 })
@@ -86,7 +91,6 b' function showPostPreview(e) {'
86
91
87 //make preview
92 //make preview
88 mkPreview(cln, postdata);
93 mkPreview(cln, postdata);
89
90 })
94 })
91 .error(function() {
95 .error(function() {
92 cln.innerHTML = "<div class=\"post\">"
96 cln.innerHTML = "<div class=\"post\">"
@@ -109,7 +113,13 b' function delPostPreview(e) {'
109 $del(clone)
113 $del(clone)
110 });
114 });
111 } else {
115 } else {
112 while(el.nextSibling) $del(el.nextSibling);
116 while (el.nextSibling) {
117 if (el.nextSibling.className.startsWith('pstprev')) {
118 $del(el.nextSibling);
119 } else {
120 break;
121 }
122 }
113 }
123 }
114
124
115 $('.highlight').removeClass('highlight');
125 $('.highlight').removeClass('highlight');
General Comments 0
You need to be logged in to leave comments. Login now