diff options
author | Ugnich Anton | 2014-03-18 04:42:16 +0700 |
---|---|---|
committer | Ugnich Anton | 2014-03-18 04:42:16 +0700 |
commit | 9fae780d462eee90dc1c3891308f436699342e7d (patch) | |
tree | 1baf2754d3f495f6e3b692165282038893edf9dc | |
parent | afe7ff2701d4940a0413557ff03379779c47750c (diff) |
Yandex Advertising upgrade
-rw-r--r-- | src/java/com/juick/http/www/PageTemplates.java | 33 | ||||
-rw-r--r-- | src/java/com/juick/http/www/UserThread.java | 4 | ||||
-rw-r--r-- | web/style3.css | 2 |
3 files changed, 22 insertions, 17 deletions
diff --git a/src/java/com/juick/http/www/PageTemplates.java b/src/java/com/juick/http/www/PageTemplates.java index 88366ce0..f171eb07 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 80e19bb1..8496fbe4 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); diff --git a/web/style3.css b/web/style3.css index a4591a6f..f2a16f8a 100644 --- a/web/style3.css +++ b/web/style3.css @@ -68,6 +68,8 @@ article footer.comm { margin: 13px 0 0 0; } article textarea { width: 530px; padding: 2px; resize: vertical; vertical-align: top; min-height: 12pt; height: 12pt; border: 0; } article input { width: 50px; margin-left: 6px; vertical-align: top; border: 1px solid #CCC; background: #EEE; color: #999; } +#yandex_ad_728 { width: 728px; height: 90px; margin: 20px 0 30px 0; } + #geomap { width: 700px; height: 300px; margin-top: 1em; overflow: hidden; } .msg { margin: 10px 0 20px 0; } |