From 7401a017aa06f377f00f6b5ad26cefa359482986 Mon Sep 17 00:00:00 2001 From: KeyserSosa Date: Wed, 3 Jun 2009 11:05:42 -0700 Subject: [PATCH] IE6 fix for disappearing content on voting. Also JS patch to remove unvoted class on vote. --- r2/r2/public/static/css/reddit-ie6-hax.css | 19 +++++++++++++++++++ r2/r2/public/static/js/jquery.reddit.js | 9 ++++++--- r2/r2/templates/link.htmllite | 2 +- r2/r2/templates/printable.htmllite | 10 +++++++++- 4 files changed, 35 insertions(+), 5 deletions(-) diff --git a/r2/r2/public/static/css/reddit-ie6-hax.css b/r2/r2/public/static/css/reddit-ie6-hax.css index 4579af29e..2a47d8be5 100644 --- a/r2/r2/public/static/css/reddit-ie6-hax.css +++ b/r2/r2/public/static/css/reddit-ie6-hax.css @@ -1,5 +1,24 @@ .link { line-height: 1.1; } +/* I don't even pretend to understand why we need this when we set + * .score.likes, .score.dislikes { display: none } + * in the main css. Those act to hide the *entire* thing in IE6, but is fixed + * by only changing the midcol css. */ +.thing .midcol.likes, .thing .midcol.dislikes { display: block; } + +.thing .midcol .score { display: none; } + +.thing .midcol.unvoted .score.unvoted { display: block; } +.thing .midcol.likes .score.likes { display: block; } +.thing .midcol.dislikes .score.dislikes { display: block; } + +.thing .entry .score { display: none; } + +.thing .entry.unvoted .score.unvoted { display: inline; } +.thing .entry.likes .score.likes { display: inline; } +.thing .entry.dislikes .score.dislikes { display: inline; } + + div.dropdown.tabdrop { display: inline; } div.drop-choices { diff --git a/r2/r2/public/static/js/jquery.reddit.js b/r2/r2/public/static/js/jquery.reddit.js index 835213927..029d0dbed 100644 --- a/r2/r2/public/static/js/jquery.reddit.js +++ b/r2/r2/public/static/js/jquery.reddit.js @@ -218,11 +218,14 @@ $.fn.vote = function(vh, callback) { things.each(function() { var entry = $(this).find(".entry:first, .midcol:first"); if(dir > 0) - entry.addClass('likes').removeClass('dislikes'); + entry.addClass('likes') + .removeClass('dislikes unvoted'); else if(dir < 0) - entry.removeClass('likes').addClass('dislikes'); + entry.addClass('dislikes') + .removeClass('likes unvoted'); else - entry.removeClass('likes').removeClass('dislikes'); + entry.addClass('unvoted') + .removeClass('likes dislikes'); }); $.request("vote", {id: things.filter(":first").thing_id(), diff --git a/r2/r2/templates/link.htmllite b/r2/r2/templates/link.htmllite index 70fa1e233..ed0d636d8 100644 --- a/r2/r2/templates/link.htmllite +++ b/r2/r2/templates/link.htmllite @@ -48,7 +48,7 @@ thing.score_fmt = Score.safepoints %> ${self.arrows(thing)} -
<%namespace file="printable.html" import="arrow"/> +<% + like_cls = "unvoted" + if getattr(thing, "likes", None): + like_cls = "likes" + elif getattr(thing, "likes", None) is False: + like_cls = "dislikes" + thing.like_cls = like_cls + %> ${self.parent()} ${self.entry()} ${self.Child()} @@ -82,7 +90,7 @@ ${self.Child()} <%def name="real_arrows(thing)"> -
+
${arrow(thing, 1, thing.likes)} ${arrow(thing, 0, thing.likes == False)}