aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Ugnich Anton2013-01-01 18:18:05 +0700
committerGravatar Ugnich Anton2013-01-01 18:18:05 +0700
commit84e5ac3a172e15f11b04203cf9e93c9d5c8174ed (patch)
tree31e0a38f4d494bfc0d9772714d3f17ab599305e7
parentd95df2184dbb9931db3a5eea0f4ea41a59ca4214 (diff)
Yandex advertising
-rw-r--r--src/java/com/juick/http/www/Blogs.java4
-rw-r--r--src/java/com/juick/http/www/PageTemplates.java36
-rw-r--r--web/scripts3.js5
-rw-r--r--web/style3.css6
4 files changed, 46 insertions, 5 deletions
diff --git a/src/java/com/juick/http/www/Blogs.java b/src/java/com/juick/http/www/Blogs.java
index 548231ae..44c734d2 100644
--- a/src/java/com/juick/http/www/Blogs.java
+++ b/src/java/com/juick/http/www/Blogs.java
@@ -215,7 +215,9 @@ public class Blogs {
out.println(" <p>" + getTags(sql, 36) + "</p>");
out.println("</div>");
- out.println("<div id=\"rcol\"></div>");
+ out.println("<div id=\"rcol\" class=\"abs\">");
+ PageTemplates.pageYandexAd(out, visitor == null ? 2 : 3); // разный ID для залогиненых и нет
+ out.println("</div>");
out.println("</div>"); // topwrapper
diff --git a/src/java/com/juick/http/www/PageTemplates.java b/src/java/com/juick/http/www/PageTemplates.java
index 628c9be9..67f036fc 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.2012123100.css\"/>");
+ out.println(" <link rel=\"stylesheet\" href=\"//static.juick.com/style3.2013010101.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.2012122701.js\" defer=\"defer\"></script>");
+ out.println(" <script type=\"text/javascript\" src=\"//static.juick.com/scripts3.2013010100.js\" defer=\"defer\"></script>");
if (headers != null) {
out.println(headers);
}
@@ -148,6 +148,37 @@ public class PageTemplates {
out.println();
}
+ public static void pageYandexAd(PrintWriter out, int stat_id) {
+ out.println("<div id=\"yandex_ad\"></div>");
+ out.println("<script type=\"text/javascript\">");
+ 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("stat_id: " + stat_id + ",");
+ out.println("site_charset: \"utf-8\",");
+ out.println("ad_format: \"direct\",");
+ out.println("font_size: 1,");
+ out.println("type: \"vertical\",");
+ out.println("limit: 1,");
+ out.println("title_font_size: 2,");
+ 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("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("})(window, document, \"yandex_context_callbacks\");");
+ out.println("</script>");
+ }
+
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>");
@@ -178,6 +209,7 @@ public class PageTemplates {
}
out.println("</div>");
out.println("</div></div>");
+ out.println("</body></html>");
}
public static String formatTags(ArrayList<String> tags, com.juick.User user) {
diff --git a/web/scripts3.js b/web/scripts3.js
index 8a33351e..ca1fafa1 100644
--- a/web/scripts3.js
+++ b/web/scripts3.js
@@ -391,14 +391,19 @@ $(document).ready(function() {
$(window).scroll(function() {
var windowTop = $(window).scrollTop();
var column=$('#column');
+ var rcol=$('#rcol');
if (stickyTop < windowTop) {
if(column.hasClass('fix')==false) {
column.removeClass('abs');
column.addClass('fix');
+ rcol.removeClass('abs');
+ rcol.addClass('fix');
}
} else if(column.hasClass('fix')==true) {
column.removeClass('fix');
column.addClass('abs');
+ rcol.removeClass('fix');
+ rcol.addClass('abs');
}
});
}
diff --git a/web/style3.css b/web/style3.css
index 8e8e82e8..6f0b42bf 100644
--- a/web/style3.css
+++ b/web/style3.css
@@ -92,7 +92,7 @@ hr { height: 1px; background: #CCC; }
/********/
-#rcol { float: left; margin-left: -200px; }
+#rcol { width: 190px; top: 0; margin: 10px 0 0 810px; padding-top: 10px; overflow: hidden; font-size: smaller; }
/********/
@@ -134,8 +134,10 @@ hr { height: 1px; background: #CCC; }
.msg-header { margin-bottom: 6px; }
.msg-ts { clear: both; float: none; margin: 0 0 4px 58px; }
.msg-txt { clear: both; margin: 8px 0 0 0; }
+ .msg-media { overflow: scroll; }
.msg-media,.msg-links,.msg-comment,.msg-comments,.msg-recomms { margin-left: 0px; }
.fix,.abs { position: static; }
- #column { clear: both; margin: 0 auto; width: 50%; }
+ #column { clear: both; margin: 0 3%; width: 44%; float: left; }
+ #rcol { float: left; width: 44%; margin: 20px 3% 0 3%; }
} \ No newline at end of file