aboutsummaryrefslogtreecommitdiff
path: root/web/scripts3.js
diff options
context:
space:
mode:
authorGravatar Ugnich Anton2014-03-09 00:03:32 +0700
committerGravatar Ugnich Anton2014-03-09 00:03:32 +0700
commitf99f153619d99cd0ca44de17a22926436160d940 (patch)
treeea62c63ae008e9122d977522e3a94af65829fb4e /web/scripts3.js
parentd39d1bf69b4de2d8f12d4a7547cd9f7938dc1a52 (diff)
Photos in a lightbox
Diffstat (limited to 'web/scripts3.js')
-rw-r--r--web/scripts3.js61
1 files changed, 41 insertions, 20 deletions
diff --git a/web/scripts3.js b/web/scripts3.js
index 2b12bfbd..1513b375 100644
--- a/web/scripts3.js
+++ b/web/scripts3.js
@@ -37,7 +37,7 @@ function wsSendKeepAlive() {
ws.send(' ');
}
}
-*/
+ */
/******************************************************************************/
/******************************************************************************/
@@ -129,25 +129,46 @@ function showMessageLinksDialog(mid,rid) {
hlink+="#"+rid;
mlink+="/"+rid;
}
- $('#dialogl').html(hlink);
- $('#dialogn').html(mlink);
-
- $('#dialogw li>a').click(function(event) {
- event.preventDefault();
- openSocialWindow($(this).attr('href'));
- });
var hlinkenc=encodeURIComponent(hlink);
- $('#sharefb').attr('href','https://www.facebook.com/sharer/sharer.php?u='+hlinkenc);
- $('#sharetw').attr('href','https://twitter.com/intent/tweet?url='+hlinkenc);
- $('#sharevk').attr('href','https://vk.com/share.php?url='+hlinkenc);
- $('#sharegp').attr('href','https://plus.google.com/share?url='+hlinkenc);
-
- var w=$('#dialogw');
- var b=$('#dialogb');
- w.css("top", Math.max(0, ((b.height() - w.outerHeight()) / 2) + b.scrollTop()) + "px");
- w.css("left", Math.max(0, ((b.width() - w.outerWidth()) / 2) + b.scrollLeft()) + "px");
- b.show();
- w.show();
+
+ var html="<div class=\"dialogshare\">Ссылка на сообщение:";
+ html+="<div onclick=\"$(this).selectText()\" class=\"dialogl\">"+hlink+"</div>";
+ html+="Номер сообщения:";
+ html+="<div onclick=\"$(this).selectText()\" class=\"dialogl\">"+mlink+"</div>";
+ html+="Поделиться:<ul>";
+ html+="<li><a href=\"#\" onclick=\"return openSocialWindow('https://www.facebook.com/sharer/sharer.php?u="+hlinkenc+"')\"></a></li>";
+ html+="<li><a href=\"#\" onclick=\"return openSocialWindow('https://twitter.com/intent/tweet?url="+hlinkenc+"')\" style=\"background-position: -32px 0;\"></a></li>";
+ html+="<li><a href=\"#\" onclick=\"return openSocialWindow('https://vk.com/share.php?url="+hlinkenc+"')\" style=\"background-position: -64px 0;\"></a></li>";
+ html+="<li><a href=\"#\" onclick=\"return openSocialWindow('https://plus.google.com/share?url="+hlinkenc+"')\" style=\"background-position: -96px 0;\"></a></li>";
+ html+="</ul></div>";
+
+ openDialog(html);
+}
+
+function showPhotoDialog(fname) {
+ var width=$(window).width();
+ if(width<640) {
+ return true;
+ } else if(width<1280) {
+ openDialog("<a href=\"//i.juick.com/photos-1024/"+fname+"\"><img src=\"//i.juick.com/photos-512/"+fname+"\"/></a>");
+ return false;
+ } else {
+ openDialog("<a href=\"//i.juick.com/p/"+fname+"\"><img src=\"//i.juick.com/photos-1024/"+fname+"\"/></a>");
+ return false;
+ }
+}
+
+function openDialog(html) {
+ var dhtml="<div id=\"dialogb\" onclick=\"closeDialog()\"></div>";
+ dhtml+="<table id=\"dialogt\"><tr><td><div id=\"dialogw\"><div id=\"dialogc\" onclick=\"closeDialog()\"></div>";
+ dhtml+=html;
+ dhtml+="</div></td></tr></table>";
+ $('body').append(dhtml);
+}
+
+function closeDialog() {
+ $('#dialogb').remove();
+ $('#dialogt').remove();
}
function openSocialWindow(url) {
@@ -183,7 +204,7 @@ jQuery.fn.selectText = function(){
/*
* jQuery.fn.autoResize 1.14
-*/
+ */
(function($){