quote attributes in jquery attribute selectors
This commit is contained in:
Родитель
22e88e249d
Коммит
10e06834cd
|
@ -60,7 +60,7 @@ function initLicense() {
|
|||
var is_copyr = (v == 'copyr');
|
||||
if (k == 'cc-attrib') {
|
||||
// Hide the other radio buttons when copyright is selected.
|
||||
$('input[name=cc-noncom], input[name=cc-noderiv]').attr('disabled', is_copyr);
|
||||
$('input[name="cc-noncom"], input[name="cc-noderiv"]').attr('disabled', is_copyr);
|
||||
}
|
||||
if (license != ' copyr') {
|
||||
license += ' ' + v;
|
||||
|
@ -82,11 +82,11 @@ function initLicense() {
|
|||
$p.find('#cc-license').html(license_txt).attr('class', 'license icon ' + license);
|
||||
$('#id_license').val(l['id']);
|
||||
}
|
||||
$('input[name^=cc-]').change(licenseUpdate);
|
||||
$('input[name^="cc-"]').change(licenseUpdate);
|
||||
licenseUpdate();
|
||||
|
||||
function saveLicense() {
|
||||
$('#persona-license-list input[value=' + $('#id_license').val() + ']').attr('checked', true);
|
||||
$('#persona-license-list input[value="' + $('#id_license').val() + '"]').attr('checked', true);
|
||||
}
|
||||
$('#persona-license .select-license').click(_pd(function() {
|
||||
$('#persona-license-list').show();
|
||||
|
@ -98,7 +98,7 @@ function initLicense() {
|
|||
|
||||
|
||||
function initPreview() {
|
||||
$('#submit-persona input[type=color]').miniColors({change: updatePersona});
|
||||
$('#submit-persona input[type="color"]').miniColors({change: updatePersona});
|
||||
|
||||
$('#submit-persona').delegate('#id_name', 'change keyup paste blur', function() {
|
||||
$('#persona-preview-name').text($(this).val() || gettext("Your Persona's Name"));
|
||||
|
@ -122,7 +122,7 @@ function initPreview() {
|
|||
},
|
||||
upload_success = function(e, file, upload_hash) {
|
||||
var $p = $(this).closest('.row');
|
||||
$p.find('input[type=hidden]').val(upload_hash);
|
||||
$p.find('input[type="hidden"]').val(upload_hash);
|
||||
$p.find('input[type=file], .note').hide();
|
||||
$p.find('.preview').attr('src', file.dataURL).addClass('loaded');
|
||||
updatePersona();
|
||||
|
@ -139,18 +139,18 @@ function initPreview() {
|
|||
|
||||
$d.delegate('.reset', 'click', _pd(function() {
|
||||
var $p = $(this).closest('.row');
|
||||
$p.find('input[type=hidden]').val('');
|
||||
$p.find('input[type="hidden"]').val('');
|
||||
$p.find('input[type=file], .note').show();
|
||||
$p.find('.preview').removeAttr('src').removeClass('loaded');
|
||||
updatePersona();
|
||||
$(this).hide();
|
||||
}));
|
||||
|
||||
$d.delegate('input[type=file]', 'upload_finished', upload_finished)
|
||||
.delegate('input[type=file]', 'upload_start', upload_start)
|
||||
.delegate('input[type=file]', 'upload_success', upload_success)
|
||||
.delegate('input[type=file]', 'upload_errors', upload_errors)
|
||||
.delegate('input[type=file]', 'change', function(e) {
|
||||
$d.delegate('input[type="file"]', 'upload_finished', upload_finished)
|
||||
.delegate('input[type="file"]', 'upload_start', upload_start)
|
||||
.delegate('input[type="file"]', 'upload_success', upload_success)
|
||||
.delegate('input[type="file"]', 'upload_errors', upload_errors)
|
||||
.delegate('input[type="file"]', 'change', function(e) {
|
||||
$(this).imageUploader();
|
||||
});
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ $(document).ready(function() {
|
|||
if ($('#addon.primary').length == 0) return;
|
||||
|
||||
var lb_baseurl = z.media_url+'img/jquery-lightbox/';
|
||||
$("a[rel=jquery-lightbox]").lightBox({
|
||||
$("a[rel='jquery-lightbox']").lightBox({
|
||||
overlayOpacity: 0.6,
|
||||
imageBlank: lb_baseurl+"lightbox-blank.gif",
|
||||
imageLoading: lb_baseurl+"lightbox-ico-loading.gif",
|
||||
|
|
|
@ -212,7 +212,7 @@ $(document).ready(function() {
|
|||
|
||||
// Jetpack
|
||||
if($('#jetpack').exists()) {
|
||||
$('a[rel=video-lightbox]').click(_pd(function() {
|
||||
$('a[rel="video-lightbox"]').click(_pd(function() {
|
||||
var $this = $(this),
|
||||
text = gettext('Your browser does not support the video tag'),
|
||||
$overlay = $('<div>', {id: 'jetpack-overlay'}),
|
||||
|
@ -584,7 +584,7 @@ function initUploadPreview() {
|
|||
|
||||
function upload_success(e, file, upload_hash) {
|
||||
form = forms['form_' + file.instance];
|
||||
form.find('[name$=upload_hash]').val(upload_hash);
|
||||
form.find('[name$="upload_hash"]').val(upload_hash);
|
||||
}
|
||||
|
||||
function upload_errors(e, file, errors) {
|
||||
|
@ -663,7 +663,7 @@ function initUploadIcon() {
|
|||
$('#icon_preview img').attr('src', file.dataURL);
|
||||
|
||||
$('#icons_default input:checked').attr('checked', false);
|
||||
$('input[name=icon_type][value='+file.type+']', $('#icons_default'))
|
||||
$('input[name="icon_type"][value="'+file.type+'"]', $('#icons_default'))
|
||||
.attr('checked', true);
|
||||
},
|
||||
|
||||
|
@ -693,7 +693,7 @@ function initUploadIcon() {
|
|||
function fixPasswordField($context) {
|
||||
// This is a hack to prevent password managers from automatically
|
||||
// deleting add-ons. See bug 630126.
|
||||
$context.find('input[type=password]').each(function(){
|
||||
$context.find('input[type="password"]').each(function(){
|
||||
var $this = $(this);
|
||||
if($this.attr('data-name')) {
|
||||
$this.attr('name', $this.attr('data-name'));
|
||||
|
@ -750,7 +750,7 @@ function initVersions() {
|
|||
|
||||
function initSubmit() {
|
||||
var dl = $('body').attr('data-default-locale');
|
||||
var el = format('#trans-name [lang={0}]', dl);
|
||||
var el = format('#trans-name [lang="{0}"]', dl);
|
||||
$(el).attr('id', "id_name");
|
||||
$('#submit-describe').delegate(el, 'keyup', slugify)
|
||||
.delegate(el, 'blur', slugify)
|
||||
|
@ -858,7 +858,7 @@ function initPayments(delegate) {
|
|||
media_url = $("body").attr("data-media-url"),
|
||||
to = false,
|
||||
img = $("<img id='contribution-preview'/>");
|
||||
moz = $("input[value=moz]");
|
||||
moz = $("input[value='moz']");
|
||||
img.hide().appendTo($("body"));
|
||||
moz.parent().after(
|
||||
$("<a class='extra' target='_blank' href='http://www.mozilla.org/foundation/'>"+gettext('Learn more')+"</a>"));
|
||||
|
@ -1248,7 +1248,7 @@ function multipartUpload(form, onreadystatechange) {
|
|||
xhr.setRequestHeader("Content-Type", "multipart/form-data;" +
|
||||
"boundary=" + boundary);
|
||||
|
||||
$('input[type=file]', form).each(function(){
|
||||
$('input[type="file"]', form).each(function(){
|
||||
var files = $(this)[0].files,
|
||||
file_field = $(this);
|
||||
|
||||
|
@ -1370,7 +1370,7 @@ function initAddonCompatCheck($doc) {
|
|||
}
|
||||
$.post($sel.attr('data-url'),
|
||||
{application_id: appId,
|
||||
csrfmiddlewaretoken: $("input[name=csrfmiddlewaretoken]", $form).val()},
|
||||
csrfmiddlewaretoken: $("input[name='csrfmiddlewaretoken']", $form).val()},
|
||||
function(d) {
|
||||
$('option', $appVer).remove();
|
||||
$.each(d.choices, function(i, ch) {
|
||||
|
|
|
@ -122,7 +122,7 @@ function initReviewActions() {
|
|||
|
||||
$('.files .install').click(_pd(function(){
|
||||
var $this = $(this),
|
||||
installer = $this.is('[data-type=search-tools]') ? z.installSearch : z.installAddon;
|
||||
installer = $this.is('[data-type="search-tools"]') ? z.installSearch : z.installAddon;
|
||||
installer($this.text(), $this.attr('href'), "")
|
||||
}));
|
||||
|
||||
|
@ -178,7 +178,7 @@ function initReviewActions() {
|
|||
|
||||
function highlightHistory() {
|
||||
$('#history a').removeClass('on');
|
||||
$(format('#history a[data-num={0}]', eh_setting)).addClass('on');
|
||||
$(format('#history a[data-num="{0}"]', eh_setting)).addClass('on');
|
||||
}
|
||||
highlightHistory();
|
||||
}
|
||||
|
|
|
@ -493,7 +493,7 @@ function initCharCount() {
|
|||
$form = $(this).closest('form'),
|
||||
$el;
|
||||
if ($cc.attr('data-for-startswith') !== undefined) {
|
||||
$el = $('textarea[id^=' + $cc.attr('data-for-startswith') + ']:visible', $form);
|
||||
$el = $('textarea[id^="' + $cc.attr('data-for-startswith') + '"]:visible', $form);
|
||||
} else {
|
||||
$el = $('textarea#' + $cc.attr('data-for'), $form);
|
||||
}
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
(function() {
|
||||
var dl = $('body').attr("data-default-locale");
|
||||
if (dl) {
|
||||
$(format(".trans>:not([lang={0}])", dl)).hide();
|
||||
$(format(".trans [lang={0}]", dl)).show();
|
||||
$(format(".trans>:not([lang='{0}'])", dl)).hide();
|
||||
$(format(".trans [lang='{0}']", dl)).show();
|
||||
}
|
||||
})();
|
||||
|
||||
|
@ -39,7 +39,7 @@ $(document).ready(function () {
|
|||
$el = $("#existing_locales").empty();
|
||||
$("#all_locales li").show();
|
||||
$.each(_.without(locales, dl), function() {
|
||||
var locale_row = $(format("#all_locales a[href$={0}]",[this])).parent();
|
||||
var locale_row = $(format("#all_locales a[href$='{0}']",[this])).parent();
|
||||
if (locale_row.length) {
|
||||
$el.append(format("<li><a title='{msg}'class='remove' href='#'>x</a>{row}</li>",
|
||||
{ msg: gettext('Remove this localization'),
|
||||
|
@ -51,10 +51,10 @@ $(document).ready(function () {
|
|||
}
|
||||
|
||||
function checkTranslation(e, t) {
|
||||
var $input = e.originalEvent ? $(this) : $(format("[lang={0}]", [e]), t),
|
||||
var $input = e.originalEvent ? $(this) : $(format("[lang='{0}']", [e]), t),
|
||||
$trans = $input.closest(".trans"),
|
||||
lang = e.originalEvent ? $input.attr("lang") : e,
|
||||
$dl = $(format("[lang={0}]", [dl]), $trans),
|
||||
$dl = $(format("[lang='{0}']", [dl]), $trans),
|
||||
transKey = $trans.attr("data-name")+'_'+lang;
|
||||
if ($input.length == 0 || $input.is('span')) {
|
||||
// No translation of this element exists for the
|
||||
|
@ -88,7 +88,7 @@ $(document).ready(function () {
|
|||
|
||||
$("#all_locales").delegate("a", "switch", switchLocale);
|
||||
|
||||
$(format("#all_locales a[href$={0}]",[$.cookie('current_locale')])).trigger("switch");
|
||||
$(format("#all_locales a[href$='{0}']",[$.cookie('current_locale')])).trigger("switch");
|
||||
|
||||
function switchLocale(e) {
|
||||
e.preventDefault();
|
||||
|
@ -126,7 +126,7 @@ $(document).ready(function () {
|
|||
if ($resp.find(".errorlist").length) { //display errors if they occur
|
||||
$form.html($resp.html());
|
||||
updateLocale();
|
||||
if ($resp.find(format(".errorlist li[data-lang={0}]", currentLocale)).length) {
|
||||
if ($resp.find(format(".errorlist li[data-lang='{0}']", currentLocale)).length) {
|
||||
erroredForms++;
|
||||
}
|
||||
} else { //clean up the errors we inserted
|
||||
|
@ -215,14 +215,14 @@ $(document).ready(function () {
|
|||
if (!_.include(locales,lang)) {
|
||||
locales.push(lang);
|
||||
}
|
||||
var current = $(format("#locale-popup [href$={0}]", [lang])).first().clone();
|
||||
var current = $(format("#locale-popup [href$='{0}']", [lang])).first().clone();
|
||||
current.find('em').remove();
|
||||
$("#change-locale").text(current.text());
|
||||
$(".trans").each(function () {
|
||||
var $el = $(this),
|
||||
field = $el.attr('data-name'),
|
||||
label = $(format("label[data-for={0}]",[field]));
|
||||
if (!$el.find(format("[lang={0}]",[lang])).length) {
|
||||
label = $(format("label[data-for='{0}']",[field]));
|
||||
if (!$el.find(format("[lang='{0}']",[lang])).length) {
|
||||
if ($el.children(".trans-init").length) {
|
||||
var $ni = $el.children(".trans-init").clone();
|
||||
$ni.attr({
|
||||
|
@ -230,11 +230,11 @@ $(document).ready(function () {
|
|||
lang: lang,
|
||||
id: format('id_{0}_{1}', field, lang),
|
||||
name: [field,lang].join('_'),
|
||||
value: $el.find(format("[lang={0}]",[dl])).val()
|
||||
value: $el.find(format("[lang='{0}']",[dl])).val()
|
||||
});
|
||||
if (lang != dl) $ni.addClass("cloned");
|
||||
} else {
|
||||
var $ni = $el.find(format("[lang={0}]",dl)).clone();
|
||||
var $ni = $el.find(format("[lang='{0}']",dl)).clone();
|
||||
$ni.attr({
|
||||
"class": "cloned",
|
||||
lang: lang
|
||||
|
@ -246,13 +246,13 @@ $(document).ready(function () {
|
|||
if (label.length) {
|
||||
label.children(".locale").remove();
|
||||
label.append(format("<span class='locale'>{0}</span>",[$("#change-locale").text()]));
|
||||
label_for = $el.children(format("[lang={0}]",[lang])).attr('id');
|
||||
label_for = $el.children(format("[lang='{0}']",[lang])).attr('id');
|
||||
label.attr('for', label_for);
|
||||
}
|
||||
|
||||
});
|
||||
$(format(".trans>:not([lang={0}])", currentLocale)).hide();
|
||||
$(format(".trans [lang={0}]", currentLocale)).show();
|
||||
$(format(".trans>:not([lang='{0}'])", currentLocale)).hide();
|
||||
$(format(".trans [lang='{0}']", currentLocale)).show();
|
||||
initCharCount();
|
||||
$.cookie('current_locale', currentLocale, {expires: 0});
|
||||
}
|
||||
|
@ -275,7 +275,7 @@ function annotateLocalizedErrors($el) {
|
|||
$el.find(".errorlist li[data-lang]:not(.l10n)").each(function() {
|
||||
var err = $(this),
|
||||
t = err.text(),
|
||||
l = $(format("#locale-popup [href$={0}]", [err.attr('data-lang')])).first().text();
|
||||
l = $(format("#locale-popup [href$='{0}']", [err.attr('data-lang')])).first().text();
|
||||
err.text(format("{0}: ",[l])+t).addClass("l10n");
|
||||
});
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче