aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Ugnich Anton2012-12-16 12:01:39 +0700
committerGravatar Ugnich Anton2012-12-16 12:01:39 +0700
commit52f88dbb3c2e81e1b658b95ff91236db1a1fe03a (patch)
treef3cde3e04f175fd079416bdfc5d93bd43595c0f4
parent52c8d049af6c0963b63dd1e70f66128527a7cba5 (diff)
message number dialog
-rw-r--r--src/java/Global.properties3
-rw-r--r--src/java/Global_ru.properties3
-rw-r--r--src/java/com/juick/http/www/Blogs.java1
-rw-r--r--src/java/com/juick/http/www/PageTemplates.java28
-rw-r--r--src/java/com/juick/http/www/User.java4
-rw-r--r--src/java/com/juick/http/www/UserThread.java10
-rw-r--r--web/scripts3.js33
-rw-r--r--web/style3.css13
8 files changed, 88 insertions, 7 deletions
diff --git a/src/java/Global.properties b/src/java/Global.properties
index 164b57a2..706e258f 100644
--- a/src/java/Global.properties
+++ b/src/java/Global.properties
@@ -24,3 +24,6 @@ Block\ user=Block user
Send\ private\ message=Send private message
Recommend\ message=Recommend message
in\ reply\ to=in reply to
+(Dialog)\ Link\ to\ message=Permanent link to this message
+(Dialog)\ Message\ number=Message number
+(Dialog)\ Share=Share in social networks
diff --git a/src/java/Global_ru.properties b/src/java/Global_ru.properties
index b98693da..a7c7e9d5 100644
--- a/src/java/Global_ru.properties
+++ b/src/java/Global_ru.properties
@@ -24,3 +24,6 @@ Block\ user=\u0417\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u
Send\ private\ message=\u041e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435
Recommend\ message=\u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435
in\ reply\ to=\u0432 \u043e\u0442\u0432\u0435\u0442 \u043d\u0430
+(Dialog)\ Link\ to\ message=\u041f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u0430\u044f \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u044d\u0442\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435
+(Dialog)\ Message\ number=\u041d\u043e\u043c\u0435\u0440 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f
+(Dialog)\ Share=\u041f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0432 \u0441\u043e\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u0435\u0442\u044f\u0445
diff --git a/src/java/com/juick/http/www/Blogs.java b/src/java/com/juick/http/www/Blogs.java
index 1bb308c5..3260a2cb 100644
--- a/src/java/com/juick/http/www/Blogs.java
+++ b/src/java/com/juick/http/www/Blogs.java
@@ -189,6 +189,7 @@ public class Blogs {
out.println("</div>"); // topwrapper
+ PageTemplates.pageDialogTemplate(out, locale);
PageTemplates.pageFooter(request, out, locale, visitor);
} finally {
out.close();
diff --git a/src/java/com/juick/http/www/PageTemplates.java b/src/java/com/juick/http/www/PageTemplates.java
index 2ec42e42..10b372a0 100644
--- a/src/java/com/juick/http/www/PageTemplates.java
+++ b/src/java/com/juick/http/www/PageTemplates.java
@@ -55,11 +55,11 @@ public class PageTemplates {
out.println("<html>");
out.println("<head>");
out.println(" <title>" + title + "</title>");
- out.println(" <link rel=\"stylesheet\" href=\"//static.juick.com/style3.2012110404.css\"/>");
+ out.println(" <link rel=\"stylesheet\" href=\"//static.juick.com/style3.2012111100.css\"/>");
out.println(" <link rel=\"icon\" type=\"image/png\" href=\"//static.juick.com/favicon.png\"/>");
out.println(" <script type=\"text/javascript\" src=\"//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js\" defer=\"defer\"></script>");
out.println(" <script type=\"text/javascript\" src=\"//ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js\" defer=\"defer\" async=\"async\"></script>");
- out.println(" <script type=\"text/javascript\" src=\"//static.juick.com/scripts3.2012110400.js\" defer=\"defer\"></script>");
+ out.println(" <script type=\"text/javascript\" src=\"//static.juick.com/scripts3.2012111101.js\" defer=\"defer\"></script>");
if (headers != null) {
out.println(headers);
}
@@ -146,6 +146,23 @@ public class PageTemplates {
out.println();
}
+ public static void pageDialogTemplate(PrintWriter out, Locale locale) {
+ ResourceBundle rb = ResourceBundle.getBundle("Global", locale);
+ out.println("<div id=\"dialogb\" onclick=\"$('#dialogb').hide();$('#dialogw').hide()\"></div>");
+ out.println("<div id=\"dialogw\">" + rb.getString("(Dialog) Link to message") + ":");
+ out.println("<div id=\"dialogl\"></div>");
+ out.println(rb.getString("(Dialog) Message number") + ":");
+ out.println("<div id=\"dialogn\"></div>");
+ out.println(rb.getString("(Dialog) Share") + ":");
+ out.println("<ul>");
+ out.println(" <li><a id=\"sharefb\"></a></li>");
+ out.println(" <li><a id=\"sharetw\"></a></li>");
+ out.println(" <li><a id=\"sharevk\"></a></li>");
+ out.println(" <li><a id=\"sharegp\"></a></li>");
+ out.println("</ul>");
+ out.println("</div>");
+ }
+
public static void pageFooter(HttpServletRequest request, PrintWriter out, Locale loc, com.juick.User visitor) {
ResourceBundle rb = ResourceBundle.getBundle("Global", loc);
out.println("<div id=\"fwrapper\"><div id=\"footer\">");
@@ -293,7 +310,7 @@ public class PageTemplates {
ArrayList<Integer> blUIDs = new ArrayList<Integer>(20);
if (visitor != null) {
- for (int i = 0; i < mids.size(); i++) {
+ for (int i = 0; i < msgs.size(); i++) {
blUIDs.add(msgs.get(i).User.UID);
}
blUIDs = UserQueries.checkBL(sql, visitor.UID, blUIDs);
@@ -314,13 +331,16 @@ public class PageTemplates {
tags += " *friends";
break;
case -2:
+ tags += " *friends";
+ break;
+ case -3:
tags += " *private";
break;
}
out.println(" <li id=\"msg-" + msg.MID + "\" class=\"msg\">");
out.println(" <div class=\"msg-avatar\"><a href=\"/" + msg.User.UName + "/\"><img src=\"//i.juick.com/a/" + msg.User.UID + ".png\" alt=\"" + msg.User.UName + "\"/></a></div>");
- out.println(" <div class=\"msg-ts\"><a href=\"/" + msg.User.UName + "/" + msg.MID + "\" title=\"" + msg.TimestampString + " GMT\">" + formatDate(msg.TimeAgo, msg.TimestampString, locale) + "</a></div>");
+ out.println(" <div class=\"msg-ts\"><a href=\"/" + msg.User.UName + "/" + msg.MID + "\" title=\"" + msg.TimestampString + " GMT\">" + formatDate(msg.TimeAgo, msg.TimestampString, locale) + "</a><a href=\"#\" onclick=\"showMessageLinksDialog(" + msg.MID + "); return false\" class=\"msg-menu\"><img src=\"http://static.juick.com/message-menu-icon.png\"></a></div>");
out.println(" <div class=\"msg-header\"><a href=\"/" + msg.User.UName + "/\">@" + msg.User.UName + "</a>:" + tags + "</div>");
if (msg.Place != null) {
out.println(" <div class=\"msg-place\">" + msg.Place.name + "</div>");
diff --git a/src/java/com/juick/http/www/User.java b/src/java/com/juick/http/www/User.java
index de0375f3..d8c179b5 100644
--- a/src/java/com/juick/http/www/User.java
+++ b/src/java/com/juick/http/www/User.java
@@ -126,6 +126,7 @@ public class User {
out.println("</div>");
out.println("</div>"); // topwrapper
+ PageTemplates.pageDialogTemplate(out, locale);
PageTemplates.pageFooter(request, out, locale, visitor);
} finally {
out.close();
@@ -156,6 +157,7 @@ public class User {
out.println("</div>");
out.println("</div>");
+ PageTemplates.pageDialogTemplate(out, locale);
PageTemplates.pageFooter(request, out, locale, visitor);
} finally {
out.close();
@@ -206,6 +208,7 @@ public class User {
out.println("</div>");
out.println("</div>");
+ PageTemplates.pageDialogTemplate(out, locale);
PageTemplates.pageFooter(request, out, locale, visitor);
} finally {
out.close();
@@ -256,6 +259,7 @@ public class User {
out.println("</div>");
out.println("</div>");
+ PageTemplates.pageDialogTemplate(out, locale);
PageTemplates.pageFooter(request, out, locale, visitor);
} finally {
out.close();
diff --git a/src/java/com/juick/http/www/UserThread.java b/src/java/com/juick/http/www/UserThread.java
index a0bb3a86..5beb6b61 100644
--- a/src/java/com/juick/http/www/UserThread.java
+++ b/src/java/com/juick/http/www/UserThread.java
@@ -79,6 +79,7 @@ public class UserThread {
out.println("</div>");
out.println("</div>"); // topwrapper
+ PageTemplates.pageDialogTemplate(out, locale);
PageTemplates.pageFooter(request, out, locale, visitor);
} finally {
out.close();
@@ -106,6 +107,9 @@ public class UserThread {
tags += " *friends";
break;
case -2:
+ tags += " *friends";
+ break;
+ case -3:
tags += " *private";
break;
}
@@ -113,7 +117,7 @@ public class UserThread {
out.println("<ul>");
out.println(" <li id=\"msg-" + mid + "\" class=\"msg msgthread\">");
out.println(" <div class=\"msg-avatar\"><a href=\"/" + msg.User.UName + "/\"><img src=\"//i.juick.com/a/" + msg.User.UID + ".png\" alt=\"" + msg.User.UName + "\"/></a></div>");
- out.println(" <div class=\"msg-ts\">" + PageTemplates.formatJSLocalTime(msg.TimestampString) + "</div>");
+ out.println(" <div class=\"msg-ts\">" + PageTemplates.formatJSLocalTime(msg.TimestampString) + "<a href=\"#\" onclick=\"showMessageLinksDialog(" + msg.MID + "); return false\" class=\"msg-menu\"><img src=\"http://static.juick.com/message-menu-icon.png\"></a></div>");
out.println(" <div class=\"msg-header\"><a href=\"/" + msg.User.UName + "/\">@" + msg.User.UName + "</a>:" + tags + "</div>");
if (msg.Place != null && msg.Place.pid > 0) {
out.println(" <div class=\"msg-place\">" + msg.Place.name + "</div>");
@@ -292,7 +296,7 @@ public class UserThread {
}
}
out.println(" <div class=\"msg-avatar\"><a href=\"/" + msg.User.UName + "/\"><img src=\"//i.juick.com/a/" + msg.User.UID + ".png\" alt=\"" + msg.User.UName + "\"/></a></div>");
- out.println(" <div class=\"msg-ts\"><a href=\"/" + msg.MID + "#" + msg.RID + "\" title=\"" + msg.TimestampString + " GMT\">" + PageTemplates.formatDate(msg.TimeAgo, msg.TimestampString, locale) + "</a></div>");
+ out.println(" <div class=\"msg-ts\"><a href=\"/" + msg.MID + "#" + msg.RID + "\" title=\"" + msg.TimestampString + " GMT\">" + PageTemplates.formatDate(msg.TimeAgo, msg.TimestampString, locale) + "</a><a href=\"#\" onclick=\"showMessageLinksDialog(" + msg.MID + "," + msg.RID + "); return false\" class=\"msg-menu\"><img src=\"http://static.juick.com/message-menu-icon.png\"></a></div>");
out.println(" <div class=\"msg-header\"><a href=\"/" + msg.User.UName + "/\">@" + msg.User.UName + "</a>:</div>");
out.println(" <div class=\"msg-txt\">" + PageTemplates.formatMessage(msg.Text) + "</div>");
if (msg.VisitorCanComment) {
@@ -331,7 +335,7 @@ public class UserThread {
}
}
out.println(" <div class=\"msg-avatar\"><a href=\"/" + msg.User.UName + "/\"><img src=\"//i.juick.com/a/" + msg.User.UID + ".png\"></a></div>");
- out.println(" <div class=\"msg-ts\"><a href=\"/" + msg.MID + "#" + msg.RID + "\" title=\"" + msg.TimestampString + " GMT\">" + PageTemplates.formatDate(msg.TimeAgo, msg.TimestampString, locale) + "</a></div>");
+ out.println(" <div class=\"msg-ts\"><a href=\"/" + msg.MID + "#" + msg.RID + "\" title=\"" + msg.TimestampString + " GMT\">" + PageTemplates.formatDate(msg.TimeAgo, msg.TimestampString, locale) + "</a><a href=\"#\" onclick=\"showMessageLinksDialog(" + msg.MID + "," + msg.RID + "); return false\" class=\"msg-menu\"><img src=\"http://static.juick.com/message-menu-icon.png\"></a></div>");
out.println(" <div class=\"msg-header\"><a href=\"/" + msg.User.UName + "/\">@" + msg.User.UName + "</a>:</div>");
out.println(" <div class=\"msg-txt\">" + PageTemplates.formatMessage(msg.Text) + "</div>");
out.print(" <div class=\"msg-links\">/" + msg.RID);
diff --git a/web/scripts3.js b/web/scripts3.js
index 1a5ffd66..a1afb433 100644
--- a/web/scripts3.js
+++ b/web/scripts3.js
@@ -63,6 +63,39 @@ function unfoldReply() {
}
}
+function showMessageLinksDialog(mid,rid) {
+ var hlink="http://juick.com/"+mid;
+ var mlink="#"+mid;
+ if(rid>0) {
+ 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();
+}
+
+function openSocialWindow(url) {
+ var w=window.open(url,'juickshare','width=640,height=400');
+ if(window.focus) w.focus();
+}
+
/*
* jQuery.fn.autoResize 1.14
*/
diff --git a/web/style3.css b/web/style3.css
index 2649de77..d04c5487 100644
--- a/web/style3.css
+++ b/web/style3.css
@@ -45,6 +45,8 @@ img { border: none; }
#content .msg-avatar { float: left; }
#content .msg-avatar img { width: 48px; height: 48px; vertical-align: top; }
#content .msg-ts { float: right; font-size: small; vertical-align: top; }
+#content .msg-menu { margin: 0 0 0 6px; padding: 2px 0; }
+#content .msg-menu img { vertical-align: top; }
#content .msg-header { margin-left: 58px; overflow: hidden; }
#content .msg-place { font-size: small; margin: 8px 0 8px 58px; }
#content .msg-txt { margin: 8px 0 8px 58px; overflow: hidden; }
@@ -97,6 +99,17 @@ table.users img { width: 32px; height: 32px; vertical-align: middle; margin-righ
/********/
+#dialogb { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; opacity: 0.5; background: #000; }
+#dialogw { display: none; position: fixed; top: 40%; left: 30%; width: 350px; padding: 20px; background: #EEEEE5; border: 1px solid #999; }
+#dialogl,#dialogn { padding: 5px; margin: 3px 0 20px; border: 1px solid #DDD; background: #F5F5E9; }
+#dialogw li { float: left; margin: 5px 10px 0 0; }
+#dialogw li>a { display: block; width: 32px; height: 32px; background-image: url(//static.juick.com/sharesocial.png); }
+#sharetw { background-position: -32px 0; }
+#sharevk { background-position: -64px 0; }
+#sharegp { background-position: -96px 0; }
+
+/********/
+
#footer { clear: both; width: 600px; margin: 0 auto; font-size: small; padding: 15px 0 10px 0; }
#footer-right { float: right; }