From 70c7cc165288488cc3160512cac32e25c450f720 Mon Sep 17 00:00:00 2001 From: KeyserSosa Date: Tue, 3 Feb 2009 11:15:13 -0800 Subject: [PATCH] space compression in buttons to fix safari bug. Improved console debugging in JS. --- r2/r2/controllers/buttons.py | 12 +++++++----- r2/r2/public/static/js/jquery.reddit.js | 10 +++++++--- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/r2/r2/controllers/buttons.py b/r2/r2/controllers/buttons.py index b78b48fb8..39c3e759d 100644 --- a/r2/r2/controllers/buttons.py +++ b/r2/r2/controllers/buttons.py @@ -28,6 +28,7 @@ from r2.lib.utils import tup from pylons import c, request from validator import * from pylons.i18n import _ +from r2.lib.filters import spaceCompress class ButtonsController(RedditController): def buttontype(self): @@ -102,11 +103,12 @@ class ButtonsController(RedditController): else: target = "_parent" - c.response.content = page_handler(button=bt, css=css, - score_fmt = score_fmt, link = l, - url=url, title=title, - vote = vote, target = target, - bgcolor=c.bgcolor, width=width).render() + res = page_handler(button=bt, css=css, + score_fmt = score_fmt, link = l, + url=url, title=title, + vote = vote, target = target, + bgcolor=c.bgcolor, width=width).render() + c.response.content = spaceCompress(res) return c.response diff --git a/r2/r2/public/static/js/jquery.reddit.js b/r2/r2/public/static/js/jquery.reddit.js index 2f8875307..897ef6c32 100644 --- a/r2/r2/public/static/js/jquery.reddit.js +++ b/r2/r2/public/static/js/jquery.reddit.js @@ -10,8 +10,12 @@ /* utility functions */ $.log = function(message) { - if (window.console) - console.debug(message); + if (window.console) { + if (window.console.debug) + window.console.debug(message); + else if (window.console.log) + window.console.log(message); + } else alert(message); }; @@ -169,7 +173,7 @@ $.fn.vote = function(vh, callback) { var things = $(this).all_things_by_id(); /* find all arrows of things on the page */ var arrows = things.children().not(".child").find('.arrow'); - + /* set the new arrow states */ var u_before = (dir == 1) ? up_cls : upmod_cls; var u_after = (dir == 1) ? upmod_cls : up_cls;