From b43c09611638cfd2e21cdda6b0883c4f4a329949 Mon Sep 17 00:00:00 2001 From: albert Date: Sat, 5 Jan 2013 22:51:00 -0500 Subject: [PATCH] added jlist rss ads --- app/assets/javascripts/posts.js | 24 ++++++ app/helpers/advertisements_helper.rb | 10 ++- .../_jist_rss_ads_safe_short.html.erb | 63 ++++++++++++++++ .../_jlist_rss_ads_explicit_long.html.erb | 70 ++++++++++++++++++ .../_jlist_rss_ads_explicit_short.html.erb | 70 ++++++++++++++++++ .../_jlist_rss_ads_safe_long.html.erb | 63 ++++++++++++++++ app/views/posts/index.html.erb | 6 +- .../posts/partials/index/_posts.html.erb | 2 + app/views/posts/show.html.erb | 10 ++- .../advertisements/ads-20010101/test1.jpg | Bin 0 -> 28468 bytes .../advertisements/ads-20110324/test1.jpg | Bin 0 -> 28468 bytes .../advertisements/ads-20110424/test1.jpg | Bin 0 -> 28468 bytes .../advertisements/ads-20110715/test1.jpg | Bin 0 -> 28468 bytes .../ads-20111027/120x600-bento.jpg | Bin 0 -> 29852 bytes .../ads-20111027/120x600-bento_2.jpg | Bin 0 -> 27391 bytes .../ads-20111027/120x600_h-tower__1.jpg | Bin 0 -> 36479 bytes .../ads-20111027/120x600_h-tower__2.jpg | Bin 0 -> 36338 bytes .../ads-20111027/120x600_h-tower__3.jpg | Bin 0 -> 36569 bytes .../ads-20111027/120x600_h-tower_tenga.jpg | Bin 0 -> 34545 bytes .../ads-20111027/120x600_helllokitty.jpg | Bin 0 -> 30526 bytes .../ads-20111027/120x600_helllokitty_2.jpg | Bin 0 -> 35711 bytes .../ads-20111027/120x600_shirow.jpg | Bin 0 -> 32300 bytes .../ads-20111027/120x600_shirt_1.jpg | Bin 0 -> 29812 bytes .../ads-20111027/120x600_shirt_2.jpg | Bin 0 -> 29927 bytes .../ads-20111027/120x600_snack_1.jpg | Bin 0 -> 37222 bytes .../ads-20111027/120x600_snack_2.jpg | Bin 0 -> 37515 bytes .../ads-20111027/120x600_std_1.jpg | Bin 0 -> 35828 bytes .../ads-20111027/120x600_std_2.jpg | Bin 0 -> 34790 bytes .../ads-20111027/120x600_std_3.jpg | Bin 0 -> 36134 bytes .../advertisements/ads-20120311/test1.jpg | Bin 0 -> 28468 bytes .../advertisements/ads-20120313/test1.jpg | Bin 0 -> 28468 bytes .../advertisements/ads-20120314/test1.jpg | Bin 0 -> 28468 bytes .../advertisements/ads-20120821/test1.jpg | Bin 0 -> 28468 bytes 33 files changed, 312 insertions(+), 6 deletions(-) create mode 100644 app/views/advertisements/_jist_rss_ads_safe_short.html.erb create mode 100644 app/views/advertisements/_jlist_rss_ads_explicit_long.html.erb create mode 100644 app/views/advertisements/_jlist_rss_ads_explicit_short.html.erb create mode 100644 app/views/advertisements/_jlist_rss_ads_safe_long.html.erb create mode 100644 public/images/advertisements/ads-20010101/test1.jpg create mode 100644 public/images/advertisements/ads-20110324/test1.jpg create mode 100644 public/images/advertisements/ads-20110424/test1.jpg create mode 100644 public/images/advertisements/ads-20110715/test1.jpg create mode 100644 public/images/advertisements/ads-20111027/120x600-bento.jpg create mode 100644 public/images/advertisements/ads-20111027/120x600-bento_2.jpg create mode 100644 public/images/advertisements/ads-20111027/120x600_h-tower__1.jpg create mode 100644 public/images/advertisements/ads-20111027/120x600_h-tower__2.jpg create mode 100644 public/images/advertisements/ads-20111027/120x600_h-tower__3.jpg create mode 100644 public/images/advertisements/ads-20111027/120x600_h-tower_tenga.jpg create mode 100644 public/images/advertisements/ads-20111027/120x600_helllokitty.jpg create mode 100644 public/images/advertisements/ads-20111027/120x600_helllokitty_2.jpg create mode 100644 public/images/advertisements/ads-20111027/120x600_shirow.jpg create mode 100644 public/images/advertisements/ads-20111027/120x600_shirt_1.jpg create mode 100644 public/images/advertisements/ads-20111027/120x600_shirt_2.jpg create mode 100644 public/images/advertisements/ads-20111027/120x600_snack_1.jpg create mode 100644 public/images/advertisements/ads-20111027/120x600_snack_2.jpg create mode 100644 public/images/advertisements/ads-20111027/120x600_std_1.jpg create mode 100644 public/images/advertisements/ads-20111027/120x600_std_2.jpg create mode 100644 public/images/advertisements/ads-20111027/120x600_std_3.jpg create mode 100644 public/images/advertisements/ads-20120311/test1.jpg create mode 100644 public/images/advertisements/ads-20120313/test1.jpg create mode 100644 public/images/advertisements/ads-20120314/test1.jpg create mode 100644 public/images/advertisements/ads-20120821/test1.jpg diff --git a/app/assets/javascripts/posts.js b/app/assets/javascripts/posts.js index be864dd50..9fd359443 100644 --- a/app/assets/javascripts/posts.js +++ b/app/assets/javascripts/posts.js @@ -18,6 +18,7 @@ this.initialize_links(); this.initialize_post_sections(); this.initialize_post_image_resize_links(); + this.place_jlist_ads(); } } @@ -197,6 +198,29 @@ } }); } + + Danbooru.Post.place_jlist_ads = function() { + var jlist = $("#jlist-rss-ads-for-show"); + if (jlist.length) { + var image = $("#image"); + + if (image.length) { + var x = image.offset().left + image.width() + 50; + var y = image.offset().top; + if (x < 950) { + x = 950 + } + jlist.css({ + position: "absolute", + width: "108px", + left: x + "px", + top: y + "px" + }); + } else { + jlist.hide(); + } + } + } })(); $(document).ready(function() { diff --git a/app/helpers/advertisements_helper.rb b/app/helpers/advertisements_helper.rb index 211044b03..08218304e 100644 --- a/app/helpers/advertisements_helper.rb +++ b/app/helpers/advertisements_helper.rb @@ -1,5 +1,5 @@ module AdvertisementsHelper - def render_advertisement(ad_type) + def render_advertisement(ad_type, post_set) if Danbooru.config.can_user_see_ads?(CurrentUser.user) @advertisement = Advertisement.find(:first, :conditions => ["ad_type = ? AND status = 'active'", ad_type], :order => "random()") content_tag( @@ -20,9 +20,13 @@ module AdvertisementsHelper end end - def render_rss_advertisement + def render_rss_advertisement(short_or_long, safe) if Danbooru.config.can_user_see_ads?(CurrentUser.user) - render "static/jlist_rss_ads" + if safe + render "advertisements/jlist_rss_ads_explicit_#{short_or_long}" + else + render "advertisements/jlist_rss_ads_safe_#{short_or_long}" + end end end end diff --git a/app/views/advertisements/_jist_rss_ads_safe_short.html.erb b/app/views/advertisements/_jist_rss_ads_safe_short.html.erb new file mode 100644 index 000000000..986196889 --- /dev/null +++ b/app/views/advertisements/_jist_rss_ads_safe_short.html.erb @@ -0,0 +1,63 @@ +
+ + + + + + +
\ No newline at end of file diff --git a/app/views/advertisements/_jlist_rss_ads_explicit_long.html.erb b/app/views/advertisements/_jlist_rss_ads_explicit_long.html.erb new file mode 100644 index 000000000..57f74ec85 --- /dev/null +++ b/app/views/advertisements/_jlist_rss_ads_explicit_long.html.erb @@ -0,0 +1,70 @@ +
+ + + + + + +
\ No newline at end of file diff --git a/app/views/advertisements/_jlist_rss_ads_explicit_short.html.erb b/app/views/advertisements/_jlist_rss_ads_explicit_short.html.erb new file mode 100644 index 000000000..2d7837cdf --- /dev/null +++ b/app/views/advertisements/_jlist_rss_ads_explicit_short.html.erb @@ -0,0 +1,70 @@ +
+ + + + + + +
\ No newline at end of file diff --git a/app/views/advertisements/_jlist_rss_ads_safe_long.html.erb b/app/views/advertisements/_jlist_rss_ads_safe_long.html.erb new file mode 100644 index 000000000..b564d7f10 --- /dev/null +++ b/app/views/advertisements/_jlist_rss_ads_safe_long.html.erb @@ -0,0 +1,63 @@ +
+ + + + + + +
\ No newline at end of file diff --git a/app/views/posts/index.html.erb b/app/views/posts/index.html.erb index 59155319b..5df676a98 100644 --- a/app/views/posts/index.html.erb +++ b/app/views/posts/index.html.erb @@ -3,6 +3,8 @@