[geeklog-hg] geeklog: Added a JavaScript file that should have been added alo...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Tue Feb 19 07:57:46 EST 2013


changeset 8948:d3c7ad24b74d
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/d3c7ad24b74d
user: dengen
date: Tue Feb 19 21:57:21 2013 +0900
description:
Added a JavaScript file that should have been added along with the changeset f10113a27de8

diffstat:

 public_html/javascript/admin.topic.js |  36 +++++++++++++++++++++++++++++++++++
 1 files changed, 36 insertions(+), 0 deletions(-)

diffs (40 lines):

diff -r 8ff95802b979 -r d3c7ad24b74d public_html/javascript/admin.topic.js
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/public_html/javascript/admin.topic.js	Tue Feb 19 21:57:21 2013 +0900
@@ -0,0 +1,36 @@
+$(function() {
+    var topicimg = $('.admin-topic-image');
+    topicimg.mouseover(function() {
+        var
+        id = $(this).attr('id'),
+        obj = $('#' + id),
+        src = obj.attr('src'),
+        getNaturalSize = function(image) { // get natural image size
+            if ('naturalWidth' in image) { // for modern browsers (including IE9)
+                return {
+                    width:  image.naturalWidth,
+                    height: image.naturalHeight
+                };
+            }
+            var img = new Image();
+            img.src = image.src;
+            return {
+                width:  img.width,
+                height: img.height
+            }; 
+        },
+        natural = getNaturalSize(obj[0]),
+        top  = -natural.height + 24,
+        left = -natural.width  - 2,
+        img = '<img src="' + src + '" width="' + natural.width + '"'
+            + ' height="' + natural.height + '" alt="">';
+
+        obj.parent().css('position', 'relative');
+        obj.after('<div id="' + id + '-popup" class="admin-topic-image-popup" style="position:absolute;'
+                  + 'top:' + top + 'px;left:' + left + 'px;">' + img + '</div>');
+    });
+    topicimg.mouseout(function() {
+        var id = $(this).attr('id');
+        $('#' + id + '-popup').remove();
+    });
+});



More information about the geeklog-cvs mailing list