Upgrade to jQuery 1.6.1 loaded from the Google CDN.

This commit is contained in:
Max Goodman
2011-05-17 15:12:39 -07:00
parent 69fb28cc32
commit 618b9e8d1d
22 changed files with 123 additions and 4380 deletions

View File

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

View File

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

View File

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

View File

@@ -5,13 +5,9 @@
<meta name="keywords" content=" reddit, reddit.com, vote, comment, submit " />
<meta name="title" content=" reddit buttons " />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script src="/static/js/jquery.js?v=930854757635" type="text/javascript">
</script>
<script src="/static/js/jquery.reddit.js?v=525082010278"
type="text/javascript">
</script>
<script src="/static/js/blogbutton.js" type="text/javascript">
</script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js" type="text/javascript"></script>
<script src="/static/js/jquery.reddit.js" type="text/javascript"></script>
<script src="/static/js/blogbutton.js" type="text/javascript"></script>
<script type="text/javascript">
var reddit = {};
point_label = function(x) {

View File

@@ -8,12 +8,9 @@
<script type="text/javascript">
var reddit = { };
</script>
<script src="/static/js/jquery.js"
type="text/javascript"></script>
<script src="/static/js/jquery.reddit.js"
type="text/javascript"></script>
<script src="/static/js/blogbutton.js" type="text/javascript">
</script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js" type="text/javascript"></script>
<script src="/static/js/jquery.reddit.js" type="text/javascript"></script>
<script src="/static/js/blogbutton.js" type="text/javascript"></script>
<link rel="stylesheet" href="/static/css/reddit.css"
type="text/css" />
<link rel='shortcut icon' href="/static/favicon.ico"

View File

@@ -6,12 +6,9 @@
<meta name="title" content=" reddit buttons " />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script type="text/javascript">var reddit = {};</script>
<script src="/static/js/jquery.js" type="text/javascript">
</script>
<script src="/static/js/jquery.reddit.js" type="text/javascript">
</script>
<script src="/static/js/blogbutton.js" type="text/javascript">
</script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js" type="text/javascript"></script>
<script src="/static/js/jquery.reddit.js" type="text/javascript"></script>
<script src="/static/js/blogbutton.js" type="text/javascript"></script>
<link rel="stylesheet" href="/static/css/reddit.css" type="text/css" />
<link rel='shortcut icon' href="/static/favicon.ico" type="image/x-icon" />
<!--[if lt IE 7]>

View File

@@ -6,11 +6,8 @@
<meta name="title" content=" reddit buttons " />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script type="text/javascript">var reddit = { };</script>
<script src="/static/js/jquery.js" type="text/javascript">
</script>
<script src="/static/js/jquery.reddit.js"
type="text/javascript">
</script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js" type="text/javascript"></script>
<script src="/static/js/jquery.reddit.js" type="text/javascript"></script>
<script src="/static/js/blogbutton.js" type="text/javascript">
</script>
<link rel="stylesheet" href="/static/css/reddit.css"

View File

@@ -6,12 +6,9 @@
<meta name="title" content=" reddit buttons " />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script type="text/javascript">var reddit = { };</script>
<script src="/static/js/jquery.js" type="text/javascript">
</script>
<script src="/static/js/jquery.reddit.js" type="text/javascript">
</script>
<script src="/static/js/blogbutton.js" type="text/javascript">
</script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js" type="text/javascript"></script>
<script src="/static/js/jquery.reddit.js" type="text/javascript"></script>
<script src="/static/js/blogbutton.js" type="text/javascript"></script>
<script type="text/javascript">
function finalize_thing(data) {
var ups = data.ups - (data.likes?1:0);

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
jquery-1.3.1.min.js
jquery-1.6.1.min.js

View File

@@ -429,7 +429,7 @@ $.fn.new_thing_child = function(what, use_listing) {
new_form = what.hide()
.prependTo(where)
.show()
.find('input[name=parent]').attr('value', id).end();
.find('input[name="parent"]').val(id).end();
return (new_form).randomize_ids();
};
@@ -591,7 +591,7 @@ $.fn.captcha = function(iden) {
if(iden) {
c.attr("src", "http://" + reddit.ajax_domain
+ "/captcha/" + iden + ".png")
.parents("form").find("input[name=iden]").attr("value", iden);
.parents("form").find('input[name="iden"]').val(iden);
}
return c;
};
@@ -642,7 +642,7 @@ $.fn.select_line = function(lineNo) {
caret_pos = 1;
}
var lines = $(this).attr("value").split(newline);
var lines = $(this).val().split(newline);
for(var x=0; x<lineNo-1; x++)
caret_pos += lines[x].length + newline_length;
@@ -687,7 +687,7 @@ $.apply_stylesheet = function(cssText) {
/* for everyone else, we walk <head> for the <link> or <style>
* that has the old stylesheet, and delete it. Then we add a
* <style> with the new one */
$("head").children("*[title=" + sheet_title + "]").remove();
$("head").children('*[title="' + sheet_title + '"]').remove();
$("head").append("<style type='text/css' media='screen' title='" +
sheet_title + "'>" + cssText + "</style>");
}

View File

@@ -32,7 +32,7 @@ function hover_open_menu(menu) { };
function update_user(form) {
try {
var user = $(form).find("input[name=user]").val();
var user = $(form).find('input[name="user"]').val();
form.action += "/" + user;
} catch (e) {
// ignore
@@ -42,7 +42,7 @@ function update_user(form) {
}
function post_user(form, where) {
var user = $(form).find("input[name=user]").val();
var user = $(form).find('input[name="user"]').val();
if (user == null) {
return post_form (form, where);
@@ -75,8 +75,8 @@ function get_form_fields(form, fields, filter_func) {
var type = $(this).attr("type");
if (filter_func(this) &&
( (type != "radio" && type != "checkbox") ||
$(this).attr("checked")) )
fields[$(this).attr("name")] = $(this).attr("value");
$(this).is(":checked")) )
fields[$(this).attr("name")] = $(this).val();
});
if (fields.id == null) {
fields.id = $(form).attr("id") ? ("#" + $(form).attr("id")) : "";
@@ -111,8 +111,8 @@ function post_pseudo_form(form, where, block) {
}
function emptyInput(elem, msg) {
if (! $(elem).attr("value") || $(elem).attr("value") == msg )
$(elem).addClass("gray").attr("value", msg).attr("rows", 3);
if (! $(elem).val() || $(elem).val() == msg )
$(elem).addClass("gray").val(msg).attr("rows", 3);
else
$(elem).focus(function(){});
};
@@ -130,7 +130,7 @@ function showcover(warning, reason) {
else
$("#cover_disclaim, #cover_msg").hide();
$(".login-popup:first").show()
.find("form input[name=reason]").attr("value", (reason || ""));
.find('form input[name="reason"]').val(reason || "");
return false;
};
@@ -152,9 +152,9 @@ function deleteRow(elem) {
function change_state(elem, op, callback, keep) {
var form = $(elem).parents("form");
/* look to see if the form has an id specified */
var id = form.find("input[name=id]");
var id = form.find('input[name="id"]');
if (id.length)
id = id.attr("value");
id = id.val();
else /* fallback on the parent thing */
id = $(elem).thing_id();
@@ -164,7 +164,7 @@ function change_state(elem, op, callback, keep) {
callback(form.length ? form : elem, op);
}
if(!$.defined(keep)) {
form.html(form.attr("executed").value);
form.html(form.find('[name="executed"]').val());
}
return false;
};
@@ -1031,7 +1031,7 @@ function comment_reply_for_elem(elem) {
if (!form.length || form.parent().thing_id() != thing.thing_id()) {
form = $(".usertext.cloneable:first").clone(true);
elem.new_thing_child(form);
form.attr("thing_id").value = thing_id;
form.prop("thing_id").value = thing_id;
form.attr("id", "commentreply_" + thing_id);
form.find(".error").hide();
}
@@ -1188,7 +1188,7 @@ var toolbar_p = function(expanded_size, collapsed_size) {
};
this.gourl = function(form, base_url) {
var url = $(form).find('input[type=text]').attr('value');
var url = $(form).find('input[type="text"]').val();
var newurl = base_url + escape(url);
this.top_window().location.href = newurl;
@@ -1205,11 +1205,11 @@ var toolbar_p = function(expanded_size, collapsed_size) {
};
function clear_all_langs(elem) {
$(elem).parents("td").find("input[type=checkbox]").attr("checked", false);
$(elem).parents("td").find('input[type="checkbox"]').prop("checked", false);
}
function check_some_langs(elem) {
$(elem).parents("td").find("#some-langs").attr("checked", true);
$(elem).parents("td").find("#some-langs").prop("checked", true);
}
function fetch_parent(elem, parent_permalink, parent_id) {
@@ -1311,7 +1311,7 @@ $(function() {
$("textarea.gray, input.gray")
.focus( function() {
$(this).attr("rows", 7)
.filter(".gray").removeClass("gray").attr("value", "")
.filter(".gray").removeClass("gray").val("")
});
/* set cookies to be from this user if there is one */
if (reddit.logged) {
@@ -1332,7 +1332,7 @@ $(function() {
/* search form help expando */
/* TODO: use focusin and focusout in jQuery 1.4 */
$("#search input[name=q]").focus(function () {
$('#search input[name="q"]').focus(function () {
$("#searchexpando").slideDown();
});
@@ -1377,9 +1377,9 @@ function show_unfriend(account_fullname) {
function search_feedback(elem, approval) {
f = $("form#search");
var q = f.find("input[name=q]").val();
var sort = f.find("input[name=sort]").val();
var t = f.find("input[name=t]").val();
var q = f.find('input[name="q"]').val();
var sort = f.find('input[name="sort"]').val();
var t = f.find('input[name="t"]').val();
var d = {
q: q,
sort: sort,

View File

@@ -1,13 +1,13 @@
function update_box(elem) {
$(elem).prevAll("*[type=checkbox]:first").attr('checked', true);
$(elem).prevAll('*[type="checkbox"]:first').prop('checked', true);
};
function update_bid(elem) {
var form = $(elem).parents(".campaign");
var is_targeted = $("#targeting").attr("checked");
var bid = parseFloat(form.find("*[name=bid]").val());
var ndays = ((Date.parse(form.find("*[name=enddate]").val()) -
Date.parse(form.find("*[name=startdate]").val())) / (86400*1000));
var is_targeted = $("#targeting").prop("checked");
var bid = parseFloat(form.find('*[name="bid"]').val());
var ndays = ((Date.parse(form.find('*[name="enddate"]').val()) -
Date.parse(form.find('*[name="startdate"]').val())) / (86400*1000));
ndays = Math.round(ndays);
var minimum_daily_bid = (is_targeted ? 30 : 20);
@@ -20,13 +20,13 @@ function update_bid(elem) {
$("#no_targeting_minimum").addClass("error");
}
form.find("button[name=create], button[name=edit]")
.attr("disabled", "disabled")
form.find('button[name="create"], button[name="edit"]')
.prop("disabled", "disabled")
.addClass("disabled");
} else {
$(".bid-info").removeClass("error");
form.find("button[name=create], button[name=edit]")
.removeAttr("disabled")
form.find('button[name="create"], button[name="edit"]')
.removeProp("disabled")
.removeClass("disabled");
}
@@ -86,14 +86,14 @@ function attach_calendar(where, min_date_src, max_date_src, callback, min_date_o
function targeting_on(elem) {
$(elem).parents(".campaign").find(".targeting")
.find("*[name=sr]").attr("disabled", "").end().slideDown();
.find('*[name="sr"]').prop("disabled", "").end().slideDown();
update_bid(elem);
}
function targeting_off(elem) {
$(elem).parents(".campaign").find(".targeting")
.find("*[name=sr]").attr("disabled", "disabled").end().slideUp();
.find('*[name="sr"]').prop("disabled", "disabled").end().slideUp();
update_bid(elem);
}
@@ -148,8 +148,8 @@ $.new_campaign = function(indx, start_date, end_date, duration,
$.update_campaign = function(indx, start_date, end_date,
duration, bid, targeting, flags) {
cancel_edit(function() {
$(".existing-campaigns input[name=indx]")
.filter("*[value=" + (indx || '0') + "]")
$('.existing-campaigns input[name="indx"]')
.filter('*[value="' + (indx || '0') + '"]')
.parents("tr").removeClass()
.addClass(get_flag_class(flags))
.children(":first").html(start_date)
@@ -158,10 +158,10 @@ $.update_campaign = function(indx, start_date, end_date,
.next().html("$" + bid).removeClass()
.next().html(targeting)
.next()
.find("*[name=startdate]").val(start_date).end()
.find("*[name=enddate]").val(end_date).end()
.find("*[name=targeting]").val(targeting).end()
.find("*[name=bid]").val(bid).end()
.find('*[name="startdate"]').val(start_date).end()
.find('*[name="enddate"]').val(end_date).end()
.find('*[name="targeting"]').val(targeting).end()
.find('*[name="bid"]').val(bid).end()
.find("button, span").remove();
$.set_up_campaigns();
});
@@ -258,8 +258,8 @@ function cancel_edit(callback) {
}
function del_campaign(elem) {
var indx = $(elem).find("*[name=indx]").val();
var link_id = $("#campaign").find("*[name=link_id]").val();
var indx = $(elem).find('*[name="indx"]').val();
var link_id = $("#campaign").find('*[name="link_id"]').val();
$.request("delete_campaign", {"indx": indx, "link_id": link_id},
null, true, "json", false);
$(elem).children(":first").delete_table_row();
@@ -288,31 +288,31 @@ function edit_campaign(elem) {
var c = $("#campaign");
$.map(['startdate', 'enddate', 'bid', 'indx'],
function(i) {
i = "*[name=" + i + "]";
i = '*[name="' + i + '"]';
c.find(i).val(data_tr.find(i).val());
});
/* check if targeting is turned on */
var targeting = data_tr
.find("*[name=targeting]").val();
var radios=c.find("*[name=targeting]");
.find('*[name="targeting"]').val();
var radios=c.find('*[name="targeting"]');
if (targeting) {
radios.filter("*[value=one]")
.attr("checked", "checked");
c.find("*[name=sr]").val(targeting).attr("disabled", "").end()
radios.filter('*[value="one"]')
.prop("checked", "checked");
c.find('*[name="sr"]').val(targeting).prop("disabled", "").end()
.find(".targeting").show();
}
else {
radios.filter("*[value=none]")
.attr("checked", "checked");
c.find("*[name=sr]").val("").attr("disabled", "disabled").end()
radios.filter('*[value="none"]')
.prop("checked", "checked");
c.find('*[name="sr"]').val("").prop("disabled", "disabled").end()
.find(".targeting").hide();
}
/* attach the dates to the date widgets */
init_startdate();
init_enddate();
c.find("button[name=edit]").show().end()
.find("button[name=create]").hide().end();
update_bid("*[name=bid]");
c.find('button[name="edit"]').show().end()
.find('button[name="create"]').hide().end();
update_bid('*[name="bid"]');
c.fadeIn();
} );
}
@@ -325,22 +325,22 @@ function create_campaign(elem) {
init_startdate();
init_enddate();
$("#campaign")
.find("button[name=edit]").hide().end()
.find("button[name=create]").show().end()
.find("input[name=indx]").val('').end()
.find("input[name=sr]").val('').end()
.find("input[name=targeting][value=none]")
.attr("checked", "checked").end()
.find('button[name="edit"]').hide().end()
.find('button[name="create"]').show().end()
.find('input[name="indx"]').val('').end()
.find('input[name="sr"]').val('').end()
.find('input[name="targeting"][value="none"]')
.prop("checked", "checked").end()
.find(".targeting").hide().end()
.find("*[name=sr]").val("").attr("disabled", "disabled").end()
.find('*[name="sr"]').val("").prop("disabled", "disabled").end()
.fadeIn();
update_bid("*[name=bid]");
update_bid('*[name="bid"]');
});
}
function free_campaign(elem) {
var indx = $(elem).find("*[name=indx]").val();
var link_id = $("#campaign").find("*[name=link_id]").val();
var indx = $(elem).find('*[name="indx"]').val();
var link_id = $("#campaign").find('*[name="link_id"]').val();
$.request("freebie", {"indx": indx, "link_id": link_id},
null, true, "json", false);
$(elem).find(".free").fadeOut();
@@ -348,5 +348,5 @@ function free_campaign(elem) {
}
function pay_campaign(elem) {
$.redirect($(elem).find("input[name=pay_url]").val());
$.redirect($(elem).find('input[name="pay_url"]').val());
}

View File

@@ -37,7 +37,7 @@
%>
$(function() {
var ad = $("#ad-frame");
if(ad.height() == 0 || ad.width() == 0) {
if(ad.height() == 0 || ad.width() == 0 || ad.offset().left == 0) {
$(".footer").append("<img alt='' src='${unsafe(tracker_url)}&random=" +
Math.random()*10000000000000000 + "'/>");
}

View File

@@ -20,7 +20,7 @@
## CondeNet, Inc. All Rights Reserved.
################################################################################
<%!
from r2.lib.template_helpers import get_domain, static
from r2.lib.template_helpers import get_domain, static, external
from r2.lib.utils import query_string
%>
<%inherit file="reddit.html"/>
@@ -31,7 +31,7 @@
<%def name="javascript()">
<script src="${static('jquery.js')}" type="text/javascript"></script>
<script src="${external('jquery.js')}" type="text/javascript"></script>
<script src="${static('jquery.reddit.js')}" type="text/javascript"></script>
<script type="text/javascript">
function showcover() { $("#cover").show(); }

View File

@@ -4,8 +4,8 @@
<html>
<head>
<title>escappit</title>
<% from r2.lib.template_helpers import static %>
<script src="${static('jquery.js')}" type="text/javascript"></script>
<% from r2.lib.template_helpers import static, external %>
<script src="${external('jquery.js')}" type="text/javascript"></script>
<script src="${static('jquery.json.js')}" type="text/javascript"></script>
<script src="${static('jquery.reddit.js')}" type="text/javascript"></script>
</head>

View File

@@ -107,8 +107,8 @@
</%def>
<%def name="javascript()">
<% from r2.lib.template_helpers import static %>
<script src="${static('jquery.js')}" type="text/javascript"></script>
<% from r2.lib.template_helpers import static, external %>
<script src="${external('jquery.js')}" type="text/javascript"></script>
<script src="${static('jquery.json.js')}" type="text/javascript"></script>
<script src="${static('jquery.reddit.js')}" type="text/javascript"></script>
<script src="${static('reddit.js')}" type="text/javascript"></script>

View File

@@ -121,7 +121,7 @@
.clone(true).attr("id", "")
.find(".img-name").html(name).end()
.find(".img-url").html("url(%%" + name + "%%)").end()
.find("form input[name=img_name]").attr("value", name).end()
.find("form input[name=img_name]").val(name).end()
.find("img").attr("id", "img-preview-" + name).end();
list.append(new_li);
@@ -173,11 +173,11 @@
$("#submit-header-img").show();
$(".img-status").html("");
if(file_input.value) {
if(! $('#img-name').attr("value")) {
if(! $('#img-name').val()) {
var f = file_input.value
.replace(/.*[\/\\]/, "").split('.')[0]
.replace(/[ _]/g, "-");
$('#img-name').attr("value", f);
$('#img-name').val(f);
}
}
}

View File

@@ -32,7 +32,7 @@ $(function() {
var id = $(this).attr("id");
if (s.length < 20) {
p.replaceWith("<input type='text' width='40'/>");
$(this).prev().attr("value", s);
$(this).prev().val(s);
}
else
p.replaceWith("<textarea rows='4' cols='40'>" + s + "</textarea>");