aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/java/com/juick/http/www/PageTemplates.java33
-rw-r--r--src/java/com/juick/http/www/UserThread.java4
2 files changed, 20 insertions, 17 deletions
diff --git a/src/java/com/juick/http/www/PageTemplates.java b/src/java/com/juick/http/www/PageTemplates.java
index 88366ce04..f171eb078 100644
--- a/src/java/com/juick/http/www/PageTemplates.java
+++ b/src/java/com/juick/http/www/PageTemplates.java
@@ -52,9 +52,9 @@ public class PageTemplates {
out.println("<!DOCTYPE html>");
out.print("<html>");
out.print("<head>");
- out.print("<link rel=\"stylesheet\" href=\"/style.2014031700.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.2014031201.js\" defer=\"defer\"></script>");
+ out.print("<link rel=\"stylesheet\" href=\"/style.2014031701.css\"/>");
+ out.print("<script type=\"text/javascript\" src=\"//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js\"></script>");
+ out.print("<script type=\"text/javascript\" src=\"/scripts.2014031201.js\"></script>");
if (headers != null) {
out.print(headers);
}
@@ -98,34 +98,33 @@ public class PageTemplates {
out.println("</header>");
}
- public static void pageYandexAd(PrintWriter out, int YandexID) {
- out.println("<article class=\"ads\"><div id=\"yandex_ad\"></div></article>");
+ public static void pageYandexAd728(PrintWriter out, int YandexID) {
+ out.println("<div id=\"yandex_ad_728\"></div>");
out.println("<script type=\"text/javascript\">");
+ out.println("if($(window).width()>1000) {");
out.println("(function(w, d, n, s, t) {");
out.println("w[n] = w[n] || [];");
out.println("w[n].push(function() {");
- out.println("Ya.Direct.insertInto(84715, \"yandex_ad\", {");
+ out.println("Ya.Direct.insertInto(84715, \"yandex_ad_728\", {");
out.println("stat_id: " + YandexID + ",");
out.println("site_charset: \"utf-8\",");
out.println("ad_format: \"direct\",");
- out.println("font_size: 1,");
- out.println("type: \"flat\",");
- out.println("limit: 1,");
- out.println("title_font_size: 2,");
- out.println("site_bg_color: \"FFFFFF\",");
+ out.println("type: \"728x90\",");
+ out.println("site_bg_color: \"EEEEE5\",");
out.println("title_color: \"006699\",");
out.println("url_color: \"000000\",");
out.println("text_color: \"000000\",");
out.println("hover_color: \"006699\"");
out.println("});");
out.println("});");
- out.println("t = d.documentElement.firstChild;");
+ out.println("t = d.getElementsByTagName(\"script\")[0]");
out.println("s = d.createElement(\"script\");");
out.println("s.type = \"text/javascript\";");
- out.println("s.src = \"http://an.yandex.ru/system/context.js\";");
- out.println("s.setAttribute(\"async\", \"true\");");
- out.println("t.insertBefore(s, t.firstChild);");
+ out.println("s.src = \"//an.yandex.ru/system/context.js\";");
+ out.println("s.async = true");
+ out.println("t.parentNode.insertBefore(s, t);");
out.println("})(window, document, \"yandex_context_callbacks\");");
+ out.println("} else { $('#yandex_ad_728').remove(); }");
out.println("</script>");
}
@@ -475,7 +474,7 @@ public class PageTemplates {
for (int i = 0; i < msgs.size(); i++) {
if (i == 1 && YandexID > 0 && ad_mid == 0) {
- pageYandexAd(out, YandexID);
+ pageYandexAd728(out, YandexID);
}
com.juick.Message msg = msgs.get(i);
@@ -501,7 +500,7 @@ public class PageTemplates {
out.println("<article data-mid=\"" + msg.MID + "\">");
out.println(" <aside><a href=\"/" + msg.User.UName + "/\"><img src=\"//i.juick.com/a/" + msg.User.UID + ".png\" alt=\"" + msg.User.UName + "\"/></a></aside>");
out.println(" <header class=\"u\">@<a href=\"/" + msg.User.UName + "/\">" + msg.User.UName + "</a>:" + tags + "</header>");
- out.println(" <header class=\"t\"><a href=\"/" + msg.User.UName + "/" + msg.MID + "\"><time datetime=\"" + msg.TimestampString + "Z\" title=\""+msg.TimestampString+" GMT\">" + formatDate(msg.TimeAgo, msg.TimestampString) + "</time></a></header>");
+ out.println(" <header class=\"t\"><a href=\"/" + msg.User.UName + "/" + msg.MID + "\"><time datetime=\"" + msg.TimestampString + "Z\" title=\"" + msg.TimestampString + " GMT\">" + formatDate(msg.TimeAgo, msg.TimestampString) + "</time></a></header>");
if (msg.AttachmentType != null) {
String fname = msg.MID + "." + msg.AttachmentType;
out.println(" <p class=\"ir\"><a href=\"//i.juick.com/photos-512/" + fname + "\" onclick=\"return showPhotoDialog('" + fname + "')\"><img src=\"//i.juick.com/photos-512/" + fname + "\" alt=\"\"/></a></p>");
diff --git a/src/java/com/juick/http/www/UserThread.java b/src/java/com/juick/http/www/UserThread.java
index 80e19bb1c..8496fbe43 100644
--- a/src/java/com/juick/http/www/UserThread.java
+++ b/src/java/com/juick/http/www/UserThread.java
@@ -254,6 +254,10 @@ public class UserThread {
out.println(" <h2>Ответы (" + replies.size() + ")</h2>");
out.println("</div>");
+ if (replies.size() > 2) {
+ PageTemplates.pageYandexAd728(out, 1);
+ }
+
out.println("<ul id=\"replies\">");
if (listview) {
printList(out, replies);