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 @@