From f99f153619d99cd0ca44de17a22926436160d940 Mon Sep 17 00:00:00 2001 From: Ugnich Anton Date: Sun, 9 Mar 2014 00:03:32 +0700 Subject: Photos in a lightbox --- web/scripts3.js | 61 ++++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 41 insertions(+), 20 deletions(-) (limited to 'web/scripts3.js') 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="
Ссылка на сообщение:"; + html+="
"+hlink+"
"; + html+="Номер сообщения:"; + html+="
"+mlink+"
"; + html+="Поделиться:
"; + + openDialog(html); +} + +function showPhotoDialog(fname) { + var width=$(window).width(); + if(width<640) { + return true; + } else if(width<1280) { + openDialog(""); + return false; + } else { + openDialog(""); + return false; + } +} + +function openDialog(html) { + var dhtml="
"; + dhtml+="
"; + dhtml+=html; + dhtml+="
"; + $('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($){ -- cgit v1.2.3