From 618b9e8d1d5431bfa3598f9ccfe62ba9126363f2 Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Tue, 17 May 2011 15:12:39 -0700 Subject: [PATCH] Upgrade to jQuery 1.6.1 loaded from the Google CDN. --- r2/Makefile | 2 +- r2/r2/controllers/api.py | 2 +- r2/r2/lib/template_helpers.py | 12 + r2/r2/public/static/button/button1.html | 10 +- r2/r2/public/static/button/button2.html | 9 +- r2/r2/public/static/button/button3.html | 9 +- r2/r2/public/static/button/button4.html | 7 +- r2/r2/public/static/button/button5.html | 9 +- r2/r2/public/static/js/jquery-1.2.6.js | 11 - r2/r2/public/static/js/jquery-1.3.1.js | 4241 -------------------- r2/r2/public/static/js/jquery-1.3.1.min.js | 19 - r2/r2/public/static/js/jquery-1.6.1.min.js | 18 + r2/r2/public/static/js/jquery.js | 2 +- r2/r2/public/static/js/jquery.reddit.js | 8 +- r2/r2/public/static/js/reddit.js | 38 +- r2/r2/public/static/js/sponsored.js | 84 +- r2/r2/templates/ads.html | 2 +- r2/r2/templates/button.html | 4 +- r2/r2/templates/framebuster.html | 4 +- r2/r2/templates/reddit.html | 4 +- r2/r2/templates/subredditstylesheet.html | 6 +- r2/r2/templates/translation.html | 2 +- 22 files changed, 123 insertions(+), 4380 deletions(-) delete mode 100644 r2/r2/public/static/js/jquery-1.2.6.js delete mode 100644 r2/r2/public/static/js/jquery-1.3.1.js delete mode 100644 r2/r2/public/static/js/jquery-1.3.1.min.js create mode 100644 r2/r2/public/static/js/jquery-1.6.1.min.js diff --git a/r2/Makefile b/r2/Makefile index cc2278a25..2d93d17ae 100644 --- a/r2/Makefile +++ b/r2/Makefile @@ -20,7 +20,7 @@ # CondeNet, Inc. All Rights Reserved. ################################################################################ -# Jacascript files to be compressified +# Javascript files to be compressified js_targets = jquery.js jquery.json.js jquery.reddit.js reddit.js ui.core.js ui.datepicker.js sponsored.js jquery.flot.js compact.js # CSS targets main_css = reddit.css diff --git a/r2/r2/controllers/api.py b/r2/r2/controllers/api.py index 605065aa6..ad20e1a15 100644 --- a/r2/r2/controllers/api.py +++ b/r2/r2/controllers/api.py @@ -862,7 +862,7 @@ class ApiController(RedditController): # clean up the submission form and remove it from the DOM (if reply) t = commentform.find("textarea") - t.attr('rows', 3).html("").attr("value", "") + t.attr('rows', 3).html("").val("") if isinstance(parent, (Comment, Message)): commentform.remove() jquery.things(parent._fullname).set_html(".reply-button:first", diff --git a/r2/r2/lib/template_helpers.py b/r2/r2/lib/template_helpers.py index c395525e3..6264051f2 100644 --- a/r2/r2/lib/template_helpers.py +++ b/r2/r2/lib/template_helpers.py @@ -60,6 +60,18 @@ def static(file): return os.path.join(c.site.static_path, file) + v +def external(name): + """ + Look up a named external URL from a static mapping. Helper for making + frequently used URLs consistent across templates. + """ + + resources = { + "jquery.js": "http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js", + } + + return resources[name] + def generateurl(context, path, **kw): if kw: return path + '?' + '&'.join(["%s=%s"%(k, url_escape(v)) \ diff --git a/r2/r2/public/static/button/button1.html b/r2/r2/public/static/button/button1.html index 9c7cd5c30..1e32c0706 100644 --- a/r2/r2/public/static/button/button1.html +++ b/r2/r2/public/static/button/button1.html @@ -5,13 +5,9 @@ - - - + + + - - - + + + - - - + + +