Show More
@@ -149,7 +149,6 b' PopupImageViewer.prototype.view = functi' | |||
|
149 | 149 | 'left': (win_w - img_w) / 2, |
|
150 | 150 | 'top': ((win_h - img_h) / 2) |
|
151 | 151 | }) |
|
152 | .appendTo(postNode) | |
|
153 | 152 | //scaling preview |
|
154 | 153 | .mousewheel(function(event, delta) { |
|
155 | 154 | var cx = event.originalEvent.clientX; |
@@ -175,12 +174,12 b' PopupImageViewer.prototype.view = functi' | |||
|
175 | 174 | }); |
|
176 | 175 | |
|
177 | 176 | return false; |
|
178 | } | |
|
179 | ) | |
|
177 | }) | |
|
180 | 178 | .draggable({ |
|
181 | 179 | addClasses: false, |
|
182 | 180 | stack: '.img-full' |
|
183 |
}) |
|
|
181 | }) | |
|
182 | .appendTo($('body')); | |
|
184 | 183 | } else { |
|
185 | 184 | existingPopups.remove(); |
|
186 | 185 | } |
@@ -1,3 +1,5 b'' | |||
|
1 | var LOADING_MSG = "<div class=\"post\">" + gettext('Loading...') + "</div>"; | |
|
2 | ||
|
1 | 3 | function $X(path, root) { |
|
2 | 4 | return document.evaluate(path, root || document, null, 6, null); |
|
3 | 5 | } |
@@ -56,6 +58,7 b' function showPostPreview(e) {' | |||
|
56 | 58 | |
|
57 | 59 | var post = $('#' + pNum); |
|
58 | 60 | if (post.length > 0 && isElementInViewport(post)) { |
|
61 | // If post is on the same page and visible, just highlight it | |
|
59 | 62 | post.addClass('highlight'); |
|
60 | 63 | } else { |
|
61 | 64 | var x = reflink.offset().left; |
@@ -65,19 +68,21 b' function showPostPreview(e) {' | |||
|
65 | 68 | cln.id = 'pstprev_' + pNum; |
|
66 | 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 | 71 | cln.style.cssText = 'left:' + x + 'px; top:' + y + 'px'; |
|
71 | 72 | |
|
72 | 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 | 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 | 83 | mkPreview(cln, postdata); |
|
80 | 84 | } else { |
|
85 | // If post is from other page, load it | |
|
81 | 86 | $.ajax({ |
|
82 | 87 | url: '/api/post/' + pNum + '/?truncated' |
|
83 | 88 | }) |
@@ -86,7 +91,6 b' function showPostPreview(e) {' | |||
|
86 | 91 | |
|
87 | 92 |
|
|
88 | 93 |
|
|
89 | ||
|
90 | 94 |
|
|
91 | 95 |
|
|
92 | 96 |
|
@@ -109,7 +113,13 b' function delPostPreview(e) {' | |||
|
109 | 113 | $del(clone) |
|
110 | 114 | }); |
|
111 | 115 | } else { |
|
112 |
while(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 | 125 | $('.highlight').removeClass('highlight'); |
General Comments 0
You need to be logged in to leave comments.
Login now