aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Ugnich Anton2014-03-10 22:50:16 +0700
committerGravatar Ugnich Anton2014-03-10 22:50:16 +0700
commitfe4e0d7058a77ec8715f1a15f9374ec86b6fb9a5 (patch)
treed70128f0bf415934cdca8bde0c7ad374072eaf0a
parentf99f153619d99cd0ca44de17a22926436160d940 (diff)
admin setPopular
-rw-r--r--src/java/com/juick/http/www/PageTemplates.java11
-rw-r--r--web/scripts3.js13
2 files changed, 20 insertions, 4 deletions
diff --git a/src/java/com/juick/http/www/PageTemplates.java b/src/java/com/juick/http/www/PageTemplates.java
index 535ec26f..bb89ea4d 100644
--- a/src/java/com/juick/http/www/PageTemplates.java
+++ b/src/java/com/juick/http/www/PageTemplates.java
@@ -54,7 +54,7 @@ public class PageTemplates {
out.print("<head>");
out.print("<link rel=\"stylesheet\" href=\"/style.2014030803.css\"/>");
out.print("<script type=\"text/javascript\" src=\"//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js\" defer=\"defer\"></script>");
- out.print("<script type=\"text/javascript\" src=\"/scripts.2014030800.js\" defer=\"defer\"></script>");
+ out.print("<script type=\"text/javascript\" src=\"/scripts.2014030801.js\" defer=\"defer\"></script>");
if (headers != null) {
out.print(headers);
}
@@ -136,7 +136,9 @@ public class PageTemplates {
out.println("<aside id=\"column\">");
out.println(" <p class=\"tags\">" + tagsHTML + "</p>");
- printContestRating(out, sql);
+ if (visitor != null) {
+ printContestRating(out, sql);
+ }
out.println("</aside>");
}
@@ -514,6 +516,11 @@ public class PageTemplates {
out.print("<a href=\"#\" onclick=\"return showCommentFooter(this)\">Комментировать</a> ");
}
out.print("<a href=\"/post?body=%21+%23" + msg.MID + "\">Рекомендовать</a>");
+ if (visitor != null && visitor.UID == 1) {
+ out.print(" <a href=\"#\" onclick=\"return setPopular(this," + msg.MID + ",2)\">+</a>");
+ out.print(" <a href=\"#\" onclick=\"return setPopular(this," + msg.MID + ",-1)\">-</a>");
+ out.print(" <a href=\"#\" onclick=\"return setPopular(this," + msg.MID + ",-2)\">x</a>");
+ }
out.println("</nav>");
out.print(" <nav class=\"s\">");
diff --git a/web/scripts3.js b/web/scripts3.js
index 1513b375..3ad5a5cf 100644
--- a/web/scripts3.js
+++ b/web/scripts3.js
@@ -159,8 +159,7 @@ function showPhotoDialog(fname) {
}
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>";
+ var dhtml="<table id=\"dialogt\"><tr><td><div id=\"dialogb\" onclick=\"closeDialog()\"></div><div id=\"dialogw\"><div id=\"dialogc\" onclick=\"closeDialog()\"></div>";
dhtml+=html;
dhtml+="</div></td></tr></table>";
$('body').append(dhtml);
@@ -187,6 +186,16 @@ function checkUsername() {
/******************************************************************************/
+function setPopular(e,mid,popular) {
+ $.ajax('http://api.juick.com/messages/set_popular?mid='+mid+'&popular='+popular+'&hash='+hash).done(function() {
+ var a=$(e).closest("article");
+ a.append("<p>OK!</p>");
+ });
+ return false;
+}
+
+/******************************************************************************/
+
jQuery.fn.selectText = function(){
var d = document;
if (d.body.createTextRange) {