This commit is contained in:
Andrew Williamson 2017-07-05 13:11:51 +01:00 коммит произвёл GitHub
Родитель 5d774b9574
Коммит 53bdbc2e4f
46 изменённых файлов: 238 добавлений и 245 удалений

Просмотреть файл

@ -14,7 +14,7 @@
"clean-css": "4.1.5",
"clean-css-cli": "4.1.6",
"jqmodal": "1.4.2",
"jquery": "1.12.0",
"jquery": "3.2.1",
"jquery.browser": "0.1.0",
"jquery.cookie": "1.4.1",
"@claviska/jquery-minicolors": "2.2.6",

Просмотреть файл

@ -53,7 +53,7 @@
clearInterval(self.interval);
});
$(self.container).bind('newPopup', function() {
$(self.container).on('newPopup', function() {
clearInterval(self.interval);
});
@ -177,7 +177,7 @@
}
);
// if box now showing bind bodyclick
$('body').bind("click", function(e) {
$('body').on("click", function(e) {
self.bodyclick(e);
});
}
@ -286,12 +286,6 @@ jQuery(function($) {
contributions.init();
});
jQuery(window).load(function() {
// Crazyweird fix lets us style abbr using CSS in IE
// - do NOT run onDomReady, must be onload
document.createElement('abbr');
});
/* Initialization things that get run on every page. */
$(".hidden").hide(); // hide anything that should be hidden

Просмотреть файл

@ -47,7 +47,7 @@ $.fn.ratingwidget = function(classes) {
}
}).mouseout(function() {
showStars(rating || 0);
}).bind('touchmove touchend', function(e) {
}).on('touchmove touchend', function(e) {
var wid = $widget.width();
var left = $widget.offset().left;
var r = (e.originalEvent.changedTouches[0].clientX - left) / wid * 5 + 1;

Просмотреть файл

@ -111,7 +111,7 @@
/* Bind the events */
$upload_field.bind("upload_start", function(e, _file){
$upload_field.on("upload_start", function(e, _file){
file = _file;
/* Remove old upload box */
@ -169,12 +169,12 @@
}));
});
$upload_field.bind("upload_progress", function(e, file, pct) {
$upload_field.on("upload_progress", function(e, file, pct) {
upload_progress_inside.animate({'width': pct + '%'},
{duration: 300, step:function(i){ updateStatus(i, file.size); } });
});
$upload_field.bind("upload_errors", function(e, file, errors, results){
$upload_field.on("upload_errors", function(e, file, errors, results){
var all_errors = $.extend([], errors); // be nice to other handlers
upload_progress_inside.stop().css({'width': '100%'});
@ -233,12 +233,12 @@
}
});
$upload_field.bind("upload_finished", function() {
$upload_field.on("upload_finished", function() {
upload_box.removeClass("ajax-loading");
upload_status_cancel.remove();
});
$upload_field.bind("upload_success", function(e, file, results) {
$upload_field.on("upload_success", function(e, file, results) {
upload_title.html(format(gettext('Validating {0}'), [escape_(file.name)]));
var animateArgs = {duration: 300, step:function(i){ updateStatus(i, file.size); }, complete: function() {
@ -249,7 +249,7 @@
$('.binary-source').show();
});
$upload_field.bind("upload_onreadystatechange", function(e, file, xhr, aborted) {
$upload_field.on("upload_onreadystatechange", function(e, file, xhr, aborted) {
var errors = [],
$form = $upload_field.closest('form'),
json = {},
@ -338,14 +338,14 @@
'checked': false});
$('.upload-status').remove();
}
$isUnlistedCheckbox.bind('change', updateListedStatus);
$isUnlistedCheckbox.on('change', updateListedStatus);
if ($isUnlistedCheckbox.length) updateListedStatus();
$('#id_is_manual_review').bind('change', function() {
$('#id_is_manual_review').on('change', function() {
$('.addon-upload-dependant').prop('disabled', !($(this).is(':checked')));
});
$upload_field.bind("upload_success_results", function(e, file, results) {
$upload_field.on("upload_success_results", function(e, file, results) {
// If the addon is detected as beta, automatically check
// the "beta" input, but only if the addon is listed.
var $beta = $('#id_beta');

Просмотреть файл

@ -20,7 +20,7 @@
$.extend( settings, options );
}
$upload_field.bind({"change": uploaderStart});
$upload_field.on("change", uploaderStart);
$(settings.cancel).click(_pd(function(){
$upload_field.trigger('upload_action_abort');
@ -46,7 +46,7 @@
/* Disable uploading while something is uploading */
$upload_field.prop('disabled', true);
$upload_field.parent().find('a').addClass("disabled");
$upload_field.bind("reenable_uploader", function() {
$upload_field.on("reenable_uploader", function() {
$upload_field.prop('disabled', false);
$upload_field.parent().find('a').removeClass("disabled");
});
@ -73,7 +73,7 @@
formData.append("upload", domfile);
}
$upload_field.unbind("upload_action_abort").bind("upload_action_abort", function() {
$upload_field.off("upload_action_abort").on("upload_action_abort", function() {
aborted = true;
formData.xhr.abort();
errors = [gettext("You cancelled the upload.")];

Просмотреть файл

@ -26,7 +26,7 @@ $(function () {
function showLightbox() {
$lightbox.show();
showImage(this);
$(window).bind('keydown.lightboxDismiss', function(e) {
$(window).on('keydown.lightboxDismiss', function(e) {
switch(e.which) {
case z.keys.ESCAPE:
e.preventDefault();
@ -53,7 +53,7 @@ $(function () {
setTimeout(function() {
$lightbox.hide();
}, 500);
$(window).unbind('keydown.lightboxDismiss');
$(window).off('keydown.lightboxDismiss');
}
function showImage(a) {
var $a = $(a),
@ -71,7 +71,7 @@ $(function () {
} else {
$img = $(lbImage([current, $a.attr("href")]));
$content.append($img);
$img.load(function(e) {
$img.on("load", function(e) {
$oldimg.css({"opacity": "0", "z-index": "0"});
$img.css({
"opacity": "1", "z-index": "1"

Просмотреть файл

@ -67,7 +67,7 @@ $.fn.zCarousel = function(o) {
$strip.prepend($lis.slice(-o.itemsPerPage).clone().addClass("cloned"))
.append($lis.slice(0,o.itemsPerPage).clone().addClass("cloned"));
$strip.addClass('noslide');
$strip.bind("transitionend webkitTransitionEnd", function() {
$strip.on("transitionend webkitTransitionEnd", function() {
if (currentPos > maxPos || currentPos < 1) {
$strip.addClass("noslide");
setTimeout(function() {

Просмотреть файл

@ -114,7 +114,7 @@ $.zAutoFormset = function(o) {
$input.prop('disabled', true).slideUp();
$('.ui-autocomplete').hide();
} else if ($visible < maxItems) {
$input.filter(':disabled').removeAttr('disabled').slideDown();
$input.filter(':disabled').prop('disabled', false).slideDown();
}
}
@ -127,7 +127,7 @@ $.zAutoFormset = function(o) {
if (!dupe.visible) {
// Undelete the item.
var $item = dupe.item;
$item.find('input[name$=-DELETE]').removeAttr('checked');
$item.find('input[name$=-DELETE]').prop('checked', false);
$item.slideDown(toggleInput);
}
clearInput();
@ -223,7 +223,7 @@ $.zAutoFormset = function(o) {
toggleInput();
$delegate.delegate('.' + removeClass, 'click', _pd(function() {
$delegate.on('click', '.' + removeClass, _pd(function() {
removed($(this).closest(formSelector));
}));

Просмотреть файл

@ -1,5 +1,5 @@
//bind pager controls to our addon grids
$('.island .listing-grid').bind('grid.init', function(e, data) {
$('.island .listing-grid').on('grid.init', function(e, data) {
var $grid = data.self,
numPages = data.maxPage;
@ -11,7 +11,7 @@ $('.island .listing-grid').bind('grid.init', function(e, data) {
}
$nav.append('<a href="#" class="next">&raquo;</a>');
$grid.parent().prepend($nav);
$nav.delegate('a', 'click', function(e) {
$nav.on('click', 'a', function(e) {
e.preventDefault();
var $tgt = $(this);
if ($tgt.hasClass('dot')) {
@ -22,7 +22,7 @@ $('.island .listing-grid').bind('grid.init', function(e, data) {
$grid.nextPage();
}
});
$grid.bind('grid.update', function(e, data) {
$grid.on('grid.update', function(e, data) {
$nav.find('.dot').removeClass('selected')
.eq(data.current).addClass('selected');
});
@ -44,12 +44,12 @@ function hoverTruncate(grid) {
$grid = $grid.parent();
}
$grid.find('.hovercard h3').truncate();
$grid.delegate('.hovercard', 'mouseover', function() {
$grid.on('mouseover', '.hovercard', function() {
var $el = $(this);
setTimeout(function() {
$el.find('h3').untruncate();
}, 100);
}).delegate('.hovercard', 'mouseout', function() {
}).on('mouseout', '.hovercard', function() {
var $el = $(this);
setTimeout(function() {
$el.find('h3').truncate();
@ -115,7 +115,7 @@ $(function() {
$this.text(em).css('direction', 'ltr');
});
$('#page').delegate('.expando .toggle', 'click', _pd(function() {
$('#page').on('click', '.expando .toggle', _pd(function() {
$(this).closest('.expando').toggleClass('expanded');
}));
@ -128,7 +128,7 @@ $(function() {
$target.addClass('expanded');
}
$('#page').delegate('.scrollto', 'click', function(e) {
$('#page').on('click', '.scrollto', function(e) {
e.preventDefault();
var href = $(this).attr('href'),
$target = $(href.match(/#.*$/)[0]);
@ -160,7 +160,7 @@ function initBanners(delegate) {
}
// Allow dismissal of site-balloons.
$delegate.delegate('.site-balloon .close, .site-tip .close', 'click', _pd(function() {
$delegate.on('click', '.site-balloon .close, .site-tip .close', _pd(function() {
var $parent = $(this).closest('.site-balloon, .site-tip');
$parent.fadeOut();
if ($parent.is('#site-nonfx')) {

Просмотреть файл

@ -2,7 +2,7 @@
$('.toplist .name').truncate({showTitle: true});
initPromos();
$(document).bind('promos_shown', function(e, $promos) {
$(document).on('promos_shown', function(e, $promos) {
hideHomePromo();
$promos.slideDown('slow')
.append('<a href="#" class="control prev">&laquo;</a>\

Просмотреть файл

@ -17,9 +17,9 @@ $(function() {
// Make this row appear 'static' so the installation buttons and pop-ups
// stay open when hovering outside the item row.
$(document.body).bind('newStatic', function() {
$(document.body).on('newStatic', function() {
$('.install-note:visible').closest('.item').addClass('static');
}).bind('closeStatic', function() {
}).on('closeStatic', function() {
$('.item.static').removeClass('static');
});
});

Просмотреть файл

@ -7,7 +7,7 @@
// Validate the form.
var $form = $('#submit-persona form');
$form.delegate('input, select, textarea', 'change keyup paste', function(e) {
$form.on('change keyup paste', 'input, select, textarea', function(e) {
checkValid(e.target.form);
});
checkValid($form[0]);
@ -129,10 +129,10 @@
}
}
$form.delegate('input[name="cc-attrib"]', 'change', function() {
$form.on('change', 'input[name="cc-attrib"]', function() {
// Toggle the other license options based on whether the copyright license is selected.
toggleCopyr(+$licenseField.val() == licensesByClass.copyr.id);
}).delegate('#persona-license-list input[type=radio][name=license]', 'change', function() {
}).on('change', '#persona-license-list input[type=radio][name=license]', function() {
// Upon selecting license from advanced menu, change it in the Q/A format.
$('.noncc.disabled').removeClass('disabled');
$('input[name^="cc-"]').prop('checked', false);
@ -217,7 +217,7 @@
});
};
$d.delegate('.reset', 'click', _pd(function() {
$d.on('click', '.reset', _pd(function() {
var $this = $(this),
$p = $this.closest('.row');
$p.find('input[type="hidden"]').val('');
@ -227,11 +227,11 @@
$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.on('upload_finished', 'input[type="file"]', upload_finished)
.on('upload_start', 'input[type="file"]', upload_start)
.on('upload_success', 'input[type="file"]', upload_success)
.on('upload_errors', 'input[type="file"]', upload_errors)
.on('change', 'input[type="file"]', function(e) {
$(this).imageUploader();
});
@ -277,7 +277,7 @@
}
});
$('#id_name').bind('change keyup paste blur', _.throttle(function() {
$('#id_name').on('change keyup paste blur', _.throttle(function() {
$('#persona-preview-name').text($(this).val() || gettext("Your Theme's Name"));
slugify();
}, 250)).trigger('change');

Просмотреть файл

@ -13,21 +13,21 @@
(function() {
var $window = $(window);
$window.delegate('.install-button a.button', 'click', function(e) {
$window.on('click', '.install-button a.button', function(e) {
e.preventDefault();
var $el = $(this);
// When everything is loaded, trigger a click on the button
$window.bind('buttons_loaded_click', function() {
$window.on('buttons_loaded_click', function() {
$el.trigger('click');
});
});
$window.bind('buttons_loaded', function() {
$window.on('buttons_loaded', function() {
// Trigger all the clicks
$window.trigger('buttons_loaded_click');
// Clean up after ourselves
$window.unbind('buttons_loaded buttons_loaded_click');
$window.undelegate('.install-button a.button', 'click');
$window.off('buttons_loaded buttons_loaded_click');
$window.off('click', '.install-button a.button');
});
})();

Просмотреть файл

@ -64,7 +64,7 @@ $.fn.promoPager = function() {
};
(function() {
$(document).delegate('#holiday .addons a', 'click', function() {
$(document).on('click', '#holiday .addons a', function() {
dcsMultiTrack('DCS.dcssip', 'addons.mozilla.org',
'DCS.dcsuri', location.pathname,
'WT.ti', 'Link: ' + $('h3', this).text(),

Просмотреть файл

@ -28,12 +28,12 @@ $(document).ready(function() {
});
};
$popup.delegate('li a', 'click', function(e) {
$popup.on('click', 'li a', function(e) {
e.preventDefault();
var el = $(e.target);
if (el.attr('href') == '#review_flag_reason_other') {
$popup.addClass('other')
.delegate('form', 'submit', function(e) {
.on('submit', 'form', function(e) {
e.preventDefault();
var note = $popup.find('#id_note').val();
if (!note) {
@ -67,7 +67,7 @@ $(document).ready(function() {
title_selector;
clearErrors($form);
$form.unbind().hide();
$form.off().hide();
$('.review').not($review).show();
$form.detach().insertAfter($review);
@ -88,9 +88,9 @@ $(document).ready(function() {
function done_edit() {
clearErrors($form);
$form.unbind().hide();
$form.off().hide();
$review.show();
$cancel.unbind();
$cancel.off();
$window.resize();
}
@ -117,7 +117,7 @@ $(document).ready(function() {
done_edit();
},
error: function(xhr) {
var errors = $.parseJSON(xhr.responseText);
var errors = JSON.parse(xhr.responseText);
populateErrors($form, errors);
},
dataType: 'json'
@ -127,7 +127,7 @@ $(document).ready(function() {
}
}
$('.primary').delegate('.review-reply-edit', 'click',
$('.primary').on('click', '.review-reply-edit',
review_comment_edit_click(
'review-reply-edit-form',
'id_review_reply_title',
@ -136,7 +136,7 @@ $(document).ready(function() {
)
);
$('.primary').delegate('.review-edit', 'click',
$('.primary').on('click', '.review-edit',
review_comment_edit_click(
'review-edit-form',
'id_review_title',

Просмотреть файл

@ -5,7 +5,7 @@
function autofillPlatform(context) {
var $context = $(context || document.body);
$('#search', $context).bind('autofill', function(e) {
$('#search', $context).on('autofill', function(e) {
var $this = $(this);
// Bail if we're searching within apps.
@ -37,7 +37,7 @@
$(function() {
$('#search-facets').delegate('li.facet', 'click', function(e) {
$('#search-facets').on('click', 'li.facet', function(e) {
var $this = $(this);
if ($this.hasClass('active')) {
if ($(e.target).is('a')) {
@ -48,18 +48,18 @@
$this.closest('ul').find('.active').removeClass('active');
$this.addClass('active');
}
}).delegate('a', 'highlight', function(e) {
}).on('highlight', 'a', function(e) {
// Highlight selection on sidebar.
var $this = $(this);
$this.closest('.facet-group').find('.selected').removeClass('selected');
$this.closest('li').addClass('selected');
}).delegate('.cnt', 'recount', function(e, newCount) {
}).on('recount', '.cnt', function(e, newCount) {
// Update # of results on sidebar.
var $this = $(this);
if (newCount.length && $this.html() != newCount.html()) {
$this.replaceWith(newCount);
}
}).delegate('a[data-params]', 'rebuild', function(e) {
}).on('rebuild', 'a[data-params]', function(e) {
var $this = $(this),
url = rebuildLink($this.attr('href'), $this.attr('data-params'));
$this.attr('href', url);

Просмотреть файл

@ -111,13 +111,13 @@
if (chart && chart.destroy) chart.destroy();
}
$win.bind("changeview", function() {
$win.on("changeview", function() {
$chart.parent().removeClass('nodata');
$chart.addClass('loading');
$btnZoom.addClass('inactive').click(_pd);
});
$win.bind("dataready", function(e, obj) {
$win.on("dataready", function(e, obj) {
var view = obj.view,
metric = view.metric,
group = view.group,
@ -138,20 +138,20 @@
}
// Disable links if they don't fit into the date range.
$('.group a, .range a').removeClass('inactive').unbind('click', false);
$('.group a, .range a').removeClass('inactive').off('click', false);
if (group == 'week') {
$('a.days-7').addClass('inactive').bind('click', false);
$('a.days-7').addClass('inactive').on('click', false);
} else if (group == 'month') {
$('a.days-7, a.days-30').addClass('inactive').bind('click', false);
$('a.days-7, a.days-30').addClass('inactive').on('click', false);
}
if (group == 'day') {
$('a.group-day').parent().addClass('selected');
}
if (date_range_days <= 8) {
$('a.group-week, a.group-month').addClass('inactive').bind('click', false);
$('a.group-week, a.group-month').addClass('inactive').on('click', false);
}
if (date_range_days <= 31) {
$('a.group-month').addClass('inactive').bind('click', false);
$('a.group-month').addClass('inactive').on('click', false);
}
if (obj.data.empty || !data.firstIndex) {
@ -494,7 +494,7 @@
chartRange = chart.xAxis[0].getExtremes();
$win.bind('zoomout', function() {
$win.on('zoomout', function() {
chart.xAxis[0].setExtremes(chartRange.min, chartRange.max);
$btnZoom.addClass('inactive').click(_pd);
});

4
static/js/impala/stats/controls.js поставляемый
Просмотреть файл

@ -37,7 +37,7 @@
e.preventDefault();
});
$groupSelector.delegate('a', 'click', function(e) {
$groupSelector.on('click', 'a', function(e) {
var $target = $(this).parent(),
newGroup = $target.attr("data-group");
@ -46,7 +46,7 @@
});
// set controls when `changeview` is detected.
$(window).bind('changeview', function(e, newState) {
$(window).on('changeview', function(e, newState) {
if (!newState) return;
function populateCustomRange() {
var nRange = normalizeRange(newState.range),

Просмотреть файл

@ -115,7 +115,7 @@ z.StatsManager = (function() {
}, 0);
});
}
$(window).bind('changeview', processView);
$(window).on('changeview', processView);
// Retrieves a list of site-wide events that may impact statistics data.

Просмотреть файл

@ -4,11 +4,11 @@ $(function() {
// set up topcharts (defined in topchart.js)
$('.toplist').topChart();
$(window).bind("changeview", function(e, view) {
$(window).on("changeview", function(e, view) {
$('.two-up').addClass('loading');
});
// Save some requests by waiting until the graph data is ready.
$(window).bind("dataready", function(e, data) {
$(window).on("dataready", function(e, data) {
// return;
var view = _.extend({}, data.view, {group: 'all'}),
range = normalizeRange(view.range);

Просмотреть файл

@ -5,7 +5,7 @@
// Modify the URL when the page state changes, if the browser supports pushState.
if (z.capabilities.replaceState) {
$(window).bind('changeview', function(e, view) {
$(window).on('changeview', function(e, view) {
var queryParams = {},
range = view.range;
if (range) {
@ -63,7 +63,7 @@
(function() {
if (!z.capabilities.localStorage) return;
var ssView = _.clone(initView);
$(window).bind('changeview', function(e, newView) {
$(window).on('changeview', function(e, newView) {
_.extend(ssView, newView);
sessionStorage.setItem('stats_view', JSON.stringify({
'range': ssView.range,
@ -76,7 +76,7 @@
(function() {
var view = {},
baseURL = $('.primary').attr('data-base_url');
$(window).bind('changeview', function(e, newView) {
$(window).on('changeview', function(e, newView) {
_.extend(view, newView);
var metric = view.metric,
range = normalizeRange(view.range),
@ -91,7 +91,7 @@
// set up stats exception modal.
var $exceptionModal = $('#exception-note').modal('', { width: 250 });
$(window).bind('explain-exception', function() {
$(window).on('explain-exception', function() {
$exceptionModal.render();
});

Просмотреть файл

@ -15,11 +15,11 @@
$(document).ready(init);
function init() {
gotoPage(0);
$paginator.delegate('.next', 'click', _pd(function() {
$paginator.on('click', '.next', _pd(function() {
if ($(this).hasClass('disabled')) return;
gotoPage(currentPage+1);
}));
$paginator.delegate('.prev', 'click', _pd(function() {
$paginator.on('click', '.prev', _pd(function() {
if ($(this).hasClass('disabled')) return;
gotoPage(currentPage-1);
}));

Просмотреть файл

@ -48,7 +48,7 @@
};
// reload the data when the view's range is modified.
$win.bind('changeview', function(e, newView) {
$win.on('changeview', function(e, newView) {
// we only want to respond to changes in range.
if (!newView.range) return;
$self.addClass('loading');

Просмотреть файл

@ -169,8 +169,8 @@ $.fn.searchSuggestions = function($results, processCallback, searchType) {
}, 150);
});
} else {
$self.bind('keydown', gestureHandler)
.bind('keyup paste', _.throttle(inputHandler, 250));
$self.on('keydown', gestureHandler)
.on('keyup paste', _.throttle(inputHandler, 250));
}
function clearCurrentSuggestions(e) {
@ -193,16 +193,16 @@ $.fn.searchSuggestions = function($results, processCallback, searchType) {
$form.submit();
});
$results.delegate('li, p', 'mouseenter mouseleave', function() {
$results.on('mouseenter mouseleave', 'li, p', function() {
$results.find('.sel').removeClass('sel');
$results.addClass('sel');
$(this).find('a').addClass('sel');
}).delegate('a', 'click', function() {
}).on('click', 'a', function() {
clearCurrentSuggestions();
$self.val('');
});
$results.bind('highlight', function(e, val) {
$results.on('highlight', function(e, val) {
// If an item starts with `val`, wrap the matched text with boldness.
$results.find('ul a span').highlightTerm(val);
$results.addClass('visible');
@ -211,7 +211,7 @@ $.fn.searchSuggestions = function($results, processCallback, searchType) {
}
});
$results.bind('dismiss', clearCurrentSuggestions);
$results.on('dismiss', clearCurrentSuggestions);
$(document).keyup(function(e) {
if (fieldFocused(e)) {

Просмотреть файл

@ -1171,7 +1171,7 @@ pathAnim = {
* @param {Function} fn The event handler
*/
addEvent: function (el, event, fn) {
$(el).bind(event, fn);
$(el).on(event, fn);
},
/**
@ -1188,7 +1188,7 @@ pathAnim = {
el[func] = function () {};
}
$(el).unbind(eventType, handler);
$(el).off(eventType, handler);
},
/**

Просмотреть файл

@ -54,7 +54,7 @@
ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
// compare mouse positions to see if they've crossed the threshold
if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) < cfg.sensitivity ) {
$(ob).unbind("mousemove",track);
$(ob).off("mousemove",track);
// set hoverIntent state to true (so mouseOut can be called)
ob.hoverIntent_s = 1;
return cfg.over.apply(ob,[ev]);
@ -87,20 +87,20 @@
// set "previous" X and Y position based on initial entry point
pX = ev.pageX; pY = ev.pageY;
// update "current" X and Y position based on mousemove
$(ob).bind("mousemove",track);
$(ob).on("mousemove",track);
// start polling interval (self-calling timeout) to compare mouse coordinates over time
if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );}
// else e.type == "mouseleave"
} else {
// unbind expensive mousemove event
$(ob).unbind("mousemove",track);
$(ob).off("mousemove",track);
// if hoverIntent state is true, then call the mouseOut function after the specified delay
if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );}
}
};
// bind the function to the two event listeners
return this.bind('mouseenter',handleHover).bind('mouseleave',handleHover);
return this.on('mouseenter', handleHover).on('mouseleave', handleHover);
};
})(jQuery);

Просмотреть файл

@ -53,7 +53,7 @@
$(img).stop(false, true);
$(img).animate(imageZoom(e.pageX, e.pageY), opts.zoomSpeed, 'linear', function() {
$(box).bind('mousemove', onMouseMove);
$(box).on('mousemove', onMouseMove);
});
}
@ -65,7 +65,7 @@
function onMouseLeave(e)
{
$(img).stop(false, true);
$(box).unbind('mousemove', onMouseMove);
$(box).off('mousemove', onMouseMove);
$(img).animate(imageCenter(), opts.zoomSpeed, 'linear');
box = img = null;
}

Просмотреть файл

@ -255,11 +255,11 @@
// Show the prev button, if not the first image in set
if ( settings.activeImage != 0 ) {
// Show the images button for Next buttons
$('#lightbox-nav-btnPrev').unbind().hover(function() {
$('#lightbox-nav-btnPrev').off().hover(function() {
$(this).css({ 'background' : 'url(' + settings.imageBtnPrev + ') left 45% no-repeat' });
},function() {
$(this).css({ 'background' : 'transparent url(' + settings.imageBlank + ') no-repeat' });
}).show().bind('click',function() {
}).show().on('click', function() {
settings.activeImage = settings.activeImage - 1;
_set_image_to_view();
return false;
@ -269,11 +269,11 @@
// Show the next button, if not the last image in set
if ( settings.activeImage != ( settings.imageArray.length -1 ) ) {
// Show the images button for Next buttons
$('#lightbox-nav-btnNext').unbind().hover(function() {
$('#lightbox-nav-btnNext').off().hover(function() {
$(this).css({ 'background' : 'url(' + settings.imageBtnNext + ') right 45% no-repeat' });
},function() {
$(this).css({ 'background' : 'transparent url(' + settings.imageBlank + ') no-repeat' });
}).show().bind('click',function() {
}).show().on('click', function() {
settings.activeImage = settings.activeImage + 1;
_set_image_to_view();
return false;
@ -296,7 +296,7 @@
*
*/
function _disable_keyboard_navigation() {
$(document).unbind();
$(document).off();
}
/**
* Perform the keyboard actions
@ -441,6 +441,6 @@
while ( curDate - date < ms);
};
// Return the jQuery object for chaining. The unbind method is used to avoid click conflict when the plugin is called more than once
return this.unbind('click').click(_initialize);
return this.off('click').click(_initialize);
};
})(jQuery); // Call and execute the function immediately passing the jQuery object

Просмотреть файл

@ -29,7 +29,7 @@
event.preventDefault();
}
});
$form.bind('submit', _pd(function() {
$form.on('submit', _pd(function() {
// Prevent just submitting the form because that takes you
// to your page. TODO: do something clever with this.
}));

Просмотреть файл

@ -24,7 +24,7 @@ $(document).ready(function(){
});
});
$('#features').delegate('.app select', 'change', function() {
$('#features').on('change', '.app select', function() {
// Update application id and toggle disabled attr on autocomplete field.
var $this = $(this),
$tr = $this.closest('tr'),
@ -32,16 +32,16 @@ $(document).ready(function(){
$tr.attr('data-app', val);
$tr.find('.collection-ac').prop('disabled', !val);
});
$('#features').delegate('.remove', 'click', _pd(function() {
$('#features').on('click', '.remove', _pd(function() {
$(this).closest('tr').hide();
$(this).closest('td').find('input').prop('checked', true);
}));
$('#features').delegate('.replace', 'click', _pd(function() {
$('#features').on('click', '.replace', _pd(function() {
var $td = $(this).closest('td');
$td.find('.collection-ac').show();
$td.find('input[type=hidden]').val('');
$(this).parent().html('');
})).delegate('.collection-ac', 'collectionAdd', function() {
})).on('collectionAdd', '.collection-ac', function() {
// Autocomplete for collection add form.
var $input = $(this),
$tr = $input.closest('tr'),

Просмотреть файл

@ -107,7 +107,7 @@ function initAdminValidation(doc) {
startStats();
$('td').bind('receivestats', function(ev, stats) {
$('td').on('receivestats', function(ev, stats) {
var $el = $(this),
$tr = $el.parent(),
complete = stats.percent_complete;
@ -125,7 +125,7 @@ function initAdminValidation(doc) {
}
});
$('#admin-validation').bind('checkstats', function(ev, job_ids) {
$('#admin-validation').on('checkstats', function(ev, job_ids) {
$.ajax({type: 'POST',
url: $(this).attr('data-status-url'),
data: {job_ids: JSON.stringify(job_ids)},

Просмотреть файл

@ -176,9 +176,9 @@ var installButton = function() {
$this.addClass('clickHijack'); // So we can disable pointer events
$this.bind('mousedown focus', function(e) {
$this.on('mousedown focus', function(e) {
$this.addClass('active');
}).bind('mouseup blur', function(e) {
}).on('mouseup blur', function(e) {
$this.removeClass('active');
}).click(function(e) {
// If the click was on a.installer or a child, call the special
@ -445,10 +445,10 @@ jQuery.fn.addPopup = function(html, allowClick) {
if (this.hasPopup) {
// We've been here before, queue a follow-up button.
$this.bind('newPopup', function(e, popup) {
$this.unbind('newPopup');
$this.on('newPopup', function(e, popup) {
$this.off('newPopup');
$(popup).find('.installer').click(function(e) {
$this.unbind('click'); // Drop the current popup.
$this.off('click'); // Drop the current popup.
self.hasPopup = false;
var next = self.popupQueue.pop();
if (!next[1]) { // allowClick
@ -487,11 +487,11 @@ jQuery.fn.addPopup = function(html, allowClick) {
return;
}
_html.remove();
$body.unbind('click newPopup', cb);
$body.off('click newPopup', cb);
$body.trigger('closeStatic');
};
// Trampoline the binding so it isn't triggered by the current click.
setTimeout(function(){ $body.bind('click newPopup', cb); }, 0);
setTimeout(function(){ $body.on('click newPopup', cb); }, 0);
});
}
});

Просмотреть файл

@ -209,10 +209,10 @@ $(document).ready(function() {
return;
}
dropdown.hide();
$(document.body).unbind('click newPopup', cb);
$(document.body).off('click newPopup', cb);
}
$(document.body).bind('click newPopup', cb);
$(document.body).on('click newPopup', cb);
}, 0);
});
@ -312,10 +312,10 @@ $('#addon-select').click(function(e) {
});
var table = $('#addon-ac').closest('table');
table.delegate(".remove", "click", function() {
table.on("click", ".remove", function() {
$(this).closest('tr').remove();
})
.delegate(".comment", "click", function() {
.on("click", ".comment", function() {
var row = $(this).closest('tr');
row.find('.comments').show();
$('.comments textarea', row).focus();
@ -374,14 +374,14 @@ if ($('body.collections-contributors')) {
});
var table = $('#contributors-list');
table.delegate(".remove", "click", function() {
table.on("click", ".remove", function() {
$(this).closest('tr').remove();
})
$("#change-owner").popup(".make-owner", {
callback: function (obj) {
var $popup = this,
ct = $(obj.click_target);
$popup.delegate("#change-owner-cancel", "click", function(e) {
$popup.on("click", "#change-owner-cancel", function(e) {
e.preventDefault();
$popup.hideMe();
});
@ -417,17 +417,17 @@ $(document).ready(function () {
var name_val = $('#id_name').val();
$(document).bind('unicode_loaded', function() {
$(document).on('unicode_loaded', function() {
$('#id_slug').attr('data-customized', (!!$('#id_slug').val() &&
($('#id_slug').val() != makeslug(name_val))) ? 1 : 0);
slugify();
});
$('#details-edit form, .collection-create form')
.delegate('#id_name', 'keyup', slugify)
.delegate('#id_name', 'blur', slugify)
.delegate('#edit_slug', 'click', show_slug_edit)
.delegate('#id_slug', 'change', function() {
.on('keyup', '#id_name', slugify)
.on('blur', '#id_name', slugify)
.on('click', '#edit_slug', show_slug_edit)
.on('change', '#id_slug', function() {
$('#id_slug').attr('data-customized', 1);
if (!$('#id_slug').val()) {
$('#id_slug').attr('data-customized', 0);
@ -477,12 +477,12 @@ $(document).ready(function () {
$widget.setWidth(200);
$widget.setPos(ct);
$widget.render();
$widget.delegate('#ajax_collections_list li', 'click', handleToggle)
.delegate('#ajax_new_collection', 'click', handleNew)
.delegate('#id_name', 'keyup', slugify)
.delegate('#id_name', 'blur', slugify)
.delegate('#edit_slug', 'click', show_slug_edit)
.delegate('#id_slug', 'change', function() {
$widget.on('click', '#ajax_collections_list li', handleToggle)
.on('click', '#ajax_new_collection', handleNew)
.on('keyup', '#id_name', slugify)
.on('blur', '#id_name', slugify)
.on('click', '#edit_slug', show_slug_edit)
.on('change', '#id_slug', function() {
if (!$('#id_slug').val()) {
$('#id_slug').attr('data-customized', 0);
slugify();
@ -532,8 +532,8 @@ $(document).ready(function () {
};
$widget.hideMe();
$widget.unbind('click.popup', stopPropagation);
$widget.bind('click.popup', stopPropagation);
$widget.off('click.popup', stopPropagation);
$widget.on('click.popup', stopPropagation);
loadList();

Просмотреть файл

@ -90,7 +90,7 @@ $(document).ready(function() {
}
},
error: function(xhr) {
var errors = $.parseJSON(xhr.responseText);
var errors = JSON.parse(xhr.responseText);
$("#upload-file").find(".errorlist").remove();
$("#upload-file").find(".upload-status").before(generateErrorList(errors));
$('#upload-file-finish').prop('disabled', false);
@ -118,10 +118,10 @@ $(document).ready(function() {
$src_ogv = $('<source>', {'type': 'video/ogv; codecs="theora, vorbis"',
'src': $this.attr('data-ogv') });
$(window).bind('keydown.lightboxDismiss', function(e) {
$(window).on('keydown.lightboxDismiss', function(e) {
if (e.which == 27) {
$overlay.remove();
$(window).unbind('keydown.lightboxDismiss');
$(window).off('keydown.lightboxDismiss');
}
});
$overlay.append($video);
@ -133,7 +133,7 @@ $(document).ready(function() {
$video.click(function(e){ e.stopPropagation(); });
$overlay.click(function() {
$(this).remove();
$(window).unbind('keydown.lightboxDismiss');
$(window).off('keydown.lightboxDismiss');
});
}));
}
@ -150,7 +150,7 @@ $(document).ready(function() {
$('#edit-addon-media').attr('data-checkurl') !== undefined) {
imageStatus.start();
}
$('#edit-addon-media').bind('click', function() {
$('#edit-addon-media').on('click', function() {
imageStatus.cancel();
});
@ -190,7 +190,7 @@ $(document).ready(function() {
// Show a confirmation modal for forms that have [data-confirm="selector"].
// This is specifically used for the request full review form for unlisted
// add-ons.
$(document.body).delegate('[data-confirm]', 'submit', function(e) {
$(document.body).on('submit', '[data-confirm]', function(e) {
e.preventDefault();
var $form = $(e.target);
var $modal = $form.data('modal');
@ -199,19 +199,19 @@ $(document).ready(function() {
$form.data('modal', $modal);
}
$modal.render();
$modal.delegate('.cancel', 'click', function(e) {
$modal.on('click', '.cancel', function(e) {
e.preventDefault();
e.stopPropagation();
$modal.trigger('close');
});
$modal.delegate('form', 'submit', function(e) {
$modal.on('submit', 'form', function(e) {
e.preventDefault();
$form.removeAttr('data-confirm');
$form.submit();
});
});
$('.enable-addon').bind('click', function() {
$('.enable-addon').on('click', function() {
$.ajax({
'type': 'POST',
'url': $(this).data('url'),
@ -303,7 +303,7 @@ $(document).ready(function() {
$primary.find("span.handle, a.remove").hide();
$(".primary h3 a.button").remove();
$(document).ready(function() {
$els.unbind().undelegate();
$els.off().off();
});
}
})();
@ -319,7 +319,7 @@ function truncateFields() {
// $(els.join(', ')).each(function(i,el) {
// var $el = $(el),
// originalHTML = $el.html();
// $el.delegate("a.truncate_expand", "click", function(e) {
// $el.on("click", "a.truncate_expand", function(e) {
// e.preventDefault();
// $el.html(originalHTML).css('max-height','none');
// })
@ -392,7 +392,7 @@ function initEditAddon() {
if (z.noEdit) return;
// Load the edit form.
$('#edit-addon').delegate('h3 a', 'click', function(e){
$('#edit-addon').on('click', 'h3 a', function(e){
e.preventDefault();
var a = e.target;
@ -556,18 +556,18 @@ function initUploadPreview() {
}
if (z.capabilities.fileAPI) {
$f.delegate('#screenshot_upload', "upload_finished", upload_finished)
.delegate('#screenshot_upload', "upload_success", upload_success)
.delegate('#screenshot_upload', "upload_start", upload_start)
.delegate('#screenshot_upload', "upload_errors", upload_errors)
.delegate('#screenshot_upload', "upload_start_all", upload_start_all)
.delegate('#screenshot_upload', "upload_finished_all", upload_finished_all)
.delegate('#screenshot_upload', 'change', function(e){
$f.on("upload_finished", '#screenshot_upload', upload_finished)
.on("upload_success", '#screenshot_upload', upload_success)
.on("upload_start", '#screenshot_upload', upload_start)
.on("upload_errors", '#screenshot_upload', upload_errors)
.on("upload_start_all", '#screenshot_upload', upload_start_all)
.on("upload_finished_all", '#screenshot_upload', upload_finished_all)
.on('change', '#screenshot_upload', function(e){
$(this).imageUploader();
});
}
$("#edit-addon-media, #submit-media").delegate("#file-list .remove", "click", function(e){
$("#edit-addon-media, #submit-media").on("click", "#file-list .remove", function(e){
e.preventDefault();
var row = $(this).closest(".preview");
row.find(".delete input").prop("checked", true);
@ -584,7 +584,7 @@ function initInvisibleUploads() {
function initUploadIcon() {
initInvisibleUploads();
$('#edit-addon-media, #submit-media').delegate('#icons_default a', 'click', function(e){
$('#edit-addon-media, #submit-media').on('click', '#icons_default a', function(e){
e.preventDefault();
var $error_list = $('#icon_preview').parent().find(".errorlist"),
@ -639,11 +639,11 @@ function initUploadIcon() {
$('.edit-media-button button').prop('disabled', false);
};
$f.delegate('#id_icon_upload', "upload_success", upload_success)
.delegate('#id_icon_upload', "upload_start", upload_start)
.delegate('#id_icon_upload', "upload_finished", upload_finished)
.delegate('#id_icon_upload', "upload_errors", upload_errors)
.delegate('#id_icon_upload', 'change', function(e) {
$f.on("upload_success", '#id_icon_upload', upload_success)
.on("upload_start", '#id_icon_upload', upload_start)
.on("upload_finished", '#id_icon_upload', upload_finished)
.on("upload_errors", '#id_icon_upload', upload_errors)
.on('change', '#id_icon_upload', function(e) {
if (z.capabilities.fileAPI) {
$(this).imageUploader();
} else {
@ -721,7 +721,7 @@ function initVersions() {
function loadReviewHistory(div, nextLoad) {
div.removeClass("hidden");
replybox = div.children('.dev-review-reply')
if (replybox.size() == 1) {
if (replybox.length == 1) {
replybox[0].scrollIntoView(false);
}
var token = div.data('token');
@ -826,10 +826,10 @@ function initSubmit() {
var dl = $('body').attr('data-default-locale');
var el = format('#trans-name [lang="{0}"]', dl);
$(el).attr('id', "id_name");
$('#submit-describe').delegate(el, 'keyup', slugify)
.delegate(el, 'blur', slugify)
.delegate('#edit_slug', 'click', show_slug_edit)
.delegate('#id_slug', 'change', function() {
$('#submit-describe').on('keyup', el, slugify)
.on('blur', el, slugify)
.on('click', '#edit_slug', show_slug_edit)
.on('change', '#id_slug', function() {
$('#id_slug').attr('data-customized', 1);
var v = $('#id_slug').val();
if (!v) {
@ -884,7 +884,7 @@ function initEditVersions() {
$modal.hideMe();
},
error: function(xhr) {
var errors = $.parseJSON(xhr.responseText);
var errors = JSON.parse(xhr.responseText);
$("#upload-file").find(".errorlist").remove();
$("#upload-file").find(".upload-status").before(generateErrorList(errors));
$modal.setPos();
@ -893,14 +893,14 @@ function initEditVersions() {
});
}
$("#file-list").delegate("a.remove", "click", function() {
$("#file-list").on("click", "a.remove", function() {
var row = $(this).closest("tr");
$("input:first", row).prop("checked", true);
row.hide();
row.next().show();
});
$("#file-list").delegate("a.undo", "click", function() {
$("#file-list").on("click", "a.undo", function() {
var row = $(this).closest("tr").prev();
$("input:first", row).prop("checked", false);
row.show();
@ -923,7 +923,7 @@ function initPayments(delegate) {
img.hide().appendTo($("body"));
moz.parent().after(
$("<a class='extra' href='http://www.mozilla.org/foundation/'>"+gettext('Learn more')+"</a>"));
$(".nag").delegate("a.extra", "mouseover", function(e) {
$(".nag").on("mouseover", "a.extra", function(e) {
var tgt = $(this);
img.attr("src", tgt.attr("href")).css({
position: 'absolute',
@ -935,11 +935,11 @@ function initPayments(delegate) {
to = setTimeout(function() {
img.fadeIn(100);
}, 300);
}).delegate("a.extra", "mouseout", function(e) {
}).on("mouseout", "a.extra", function(e) {
clearTimeout(to);
img.fadeOut(100);
})
.delegate("a.extra", "click", function(e) {
.on("click", "a.extra", function(e) {
e.preventDefault();
});
$("#do-setup").click(_pd(function (e) {
@ -975,9 +975,11 @@ function initPayments(delegate) {
function initCatFields(delegate) {
var $delegate = $(delegate || '#addon-categories-edit');
$delegate.find('div.addon-app-cats').each(function() {
var main_selector = ".addon-categories",
misc_selector = ".addon-misc-category"
var $parent = $(this).closest("[data-max-categories]"),
$main = $(this).find(".addon-categories"),
$misc = $(this).find(".addon-misc-category"),
$main = $(this).find(main_selector),
$misc = $(this).find(misc_selector),
maxCats = parseInt($parent.attr("data-max-categories"), 10);
var checkMainDefault = function() {
var checkedLength = $("input:checked", $main).length,
@ -993,8 +995,8 @@ function initCatFields(delegate) {
$("input", $main).prop("checked", false).prop("disabled", false);
};
checkMainDefault();
$(document).on('change', $main.selector + ' input', checkMain);
$(document).on('change', $misc.selector + ' input', checkOther);
$(document).on('change', main_selector + ' input', checkMain);
$(document).on('change', misc_selector + ' input', checkOther);
});
}
@ -1053,9 +1055,9 @@ function initAuthorFields() {
});
$("#author_list")
.delegate(".email-autocomplete", "keypress", validateUser)
.delegate(".email-autocomplete", "keyup", validateUser)
.delegate(".remove", "click", function (e) {
.on("keypress", ".email-autocomplete", validateUser)
.on("keyup", ".email-autocomplete", validateUser)
.on("click", ".remove", function (e) {
e.preventDefault();
var tgt = $(this),
row = tgt.parents("li");
@ -1120,7 +1122,7 @@ function initCompatibility() {
$('.new-apps', outer).toggle();
$('.new-apps ul').delegate('a', 'click', _pd(function(e) {
$('.new-apps ul').on('click', 'a', _pd(function(e) {
var $this = $(this),
sel = format('tr.app-extra td[class="{0}"]', [$this.attr('class')]),
$row = $(sel, outer);
@ -1380,12 +1382,12 @@ function initMerchantAccount() {
current = $paypal_field.val(),
keyup = true;
$paypal_field.bind('keyup', function(e) {
$paypal_field.on('keyup', function(e) {
if($paypal_field.val() != current) {
if(ajax) {
ajax.abort();
}
$paypal_verify.removeAttr('class');
$paypal_verify.removeClass();
keyup = true;
}
current = $paypal_field.val();

Просмотреть файл

@ -26,7 +26,7 @@ $(document).ready(function(){
hideInstalled();
initPromos(null, 'discovery');
$(this).bind('promos_shown', function(e, $promos) {
$(this).on('promos_shown', function(e, $promos) {
if($('#learn-more').hasClass('video')) { // Is the video available?
var starter = $('#starter').closest('.panel'),
s_panel = $('<li>', {'class': 'panel'}),

Просмотреть файл

@ -68,7 +68,7 @@ function PopcornObj() {
// Preload persona images
var preload = $('<div>', {'id': 'preload-personas', 'css': {'display': 'none'}}).appendTo('body');
$promo_addons.find('a[data-browsertheme]').each(function() {
var theme = $.parseJSON($(this).attr('data-browsertheme'));
var theme = parse.JSON($(this).attr('data-browsertheme'));
preload.append($('<img>', {'src': theme['headerURL'].replace(/http:\/\//, 'https://'), 'alt': ''}));
preload.append($('<img>', {'src': theme['footerURL'].replace(/http:\/\//, 'https://'), 'alt': ''}));
});
@ -141,7 +141,7 @@ function PopcornObj() {
this.code = function(options){
if(options['onEnd']) {
$('#promo-video').bind('close', options['onEnd']);
$('#promo-video').on('close', options['onEnd']);
}
pop.code(options);
}
@ -259,7 +259,7 @@ $(function() {
popcorn.start();
}));
$('#promos').delegate('.vid-button a', 'click', _pd(function() {
$('#promos').on('click', '.vid-button a', _pd(function() {
popcorn.start();
}));
});

Просмотреть файл

@ -247,7 +247,7 @@ function initQueue() {
(function checkCurrentlyViewing() {
$.post(url, {'addon_ids': addon_ids.join(',')}, function(data) {
$('#addon-queue .locked').removeClass('locked')
.removeAttr('title');
.prop('title', '');
$.each(data, function(k, v) {
$('#addon-' + k).addClass('locked')
.attr('title',

Просмотреть файл

@ -306,7 +306,7 @@ jQuery.fn.numberInput = function(increment) {
}));
$.each(['change', 'keypress', 'input'], function(i, event) {
$self.bind(event, function() {
$self.on(event, function() {
$self.val($self.val().replace(/\D+/, ''));
});
});
@ -921,7 +921,7 @@ function bind_viewer(nodes) {
viewer.toggle_wrap('wrap', true);
}));
$(window).bind('popstate', function() {
$(window).on('popstate', function() {
if (viewer.last != location.pathname) {
viewer.nodes.$files.find('.file').each(function() {
if ($(this).attr('href') == location.pathname) {
@ -947,7 +947,7 @@ function bind_viewer(nodes) {
});
var buffer = '';
$(document).bind('keypress', function(e) {
$(document).on('keypress', function(e) {
if (e.charCode && !(e.altKey || e.ctrlKey || e.metaKey) &&
![HTMLInputElement, HTMLSelectElement, HTMLTextAreaElement]
.some(function (iface) { return e.target instanceof iface })) {

Просмотреть файл

@ -56,7 +56,7 @@ jQuery.fn.tooltip = function(tip_el) {
}, delay);
}
$(document.body).bind("tooltip_change", setTip);
$(document.body).on("tooltip_change", setTip);
function mouseover(e) {
$tgt = $(this);
@ -184,9 +184,8 @@ $.fn.popup = function(click_target, o) {
$popup.hideMe = function() {
$popup.hide();
$popup.unbind();
$popup.undelegate();
$(document.body).unbind('click.'+uid, $popup.hider);
$popup.off();
$(document.body).off('click.'+uid, $popup.hider);
return $popup;
};
@ -213,10 +212,10 @@ $.fn.popup = function(click_target, o) {
};
if (p.hideme) {
setTimeout(function(){
$(document.body).bind('click.'+uid, $popup.hider);
$(document.body).on('click.'+uid, $popup.hider);
}, 0);
}
$popup.delegate('.close', 'click', function(e) {
$popup.on('click', '.close', function(e) {
e.preventDefault();
$popup.hideMe();
});
@ -233,7 +232,7 @@ $.fn.popup = function(click_target, o) {
};
if ($popup.o.delegate) {
$($popup.o.delegate).delegate(click_target, "click", handler);
$($popup.o.delegate).on("click", click_target, handler);
} else {
$ct.click(handler);
}
@ -310,11 +309,10 @@ $.fn.modal = function(click_target, o) {
$modal.hideMe = function() {
var p = $modal.o;
$modal.hide();
$modal.unbind();
$modal.undelegate();
$(document.body).unbind('click newmodal', $modal.hider);
$(window).unbind('keydown.lightboxDismiss');
$(window).bind('resize', p.onresize);
$modal.off();
$(document.body).off('click newmodal', $modal.hider);
$(window).off('keydown.lightboxDismiss');
$(window).on('resize', p.onresize);
$('.modal-overlay').remove();
return $modal;
};
@ -338,8 +336,7 @@ $.fn.modal = function(click_target, o) {
if (p.hideme) {
try {
setTimeout(function(){
$('.modal-overlay, .close').bind('click modal',
$modal.hider);
$('.modal-overlay, .close').on('click modal', $modal.hider);
}, 0);
} catch (err) {
// TODO(Kumar) handle this more gracefully. See bug 701221.
@ -353,11 +350,11 @@ $.fn.modal = function(click_target, o) {
$modal.append(close);
}
$('.popup').hide();
$modal.delegate('.close', 'click', function(e) {
$modal.on('click', '.close', function(e) {
e.preventDefault();
$modal.trigger('close');
});
$modal.bind('close', function(e) {
$modal.on('close', function(e) {
if (p.emptyme) {
$modal.empty();
}
@ -376,8 +373,8 @@ $.fn.modal = function(click_target, o) {
$modal.show();
}, 0);
$(window).bind('resize', p.onresize)
.bind('keydown.lightboxDismiss', function(e) {
$(window).on('resize', p.onresize)
.on('keydown.lightboxDismiss', function(e) {
if (e.which == 27) {
$modal.hideMe();
}
@ -386,7 +383,7 @@ $.fn.modal = function(click_target, o) {
};
if ($modal.o.delegate) {
$($modal.o.delegate).delegate(click_target, "click", handler);
$($modal.o.delegate).on("click", click_target, handler);
} else {
$ct.click(handler);
}
@ -484,7 +481,7 @@ function initCharCount() {
} else {
$el = $('textarea#' + $cc.attr('data-for'), $form);
}
$el.bind('keyup blur', function() { countChars(this, $cc); }).trigger('blur');
$el.on('keyup blur', function() { countChars(this, $cc); }).trigger('blur');
});
}
@ -577,7 +574,7 @@ $.fn.exists = function(callback, args){
};
// Bind to the mobile site if a mobile link is clicked.
$(document).delegate('.mobile-link', 'click', function() {
$(document).on('click', '.mobile-link', function() {
$.cookie('mamo', 'on', {expires:30, path: '/'});
window.location.reload();
});

Просмотреть файл

@ -38,7 +38,7 @@ $(document).ready(function(){
}
// Set up our history callback.
$(window).bind('popstate', function(ev) {
$(window).on('popstate', function(ev) {
// We don't pushState here because we'd be stuck in this position.
var e = ev.originalEvent;
if (e.state && e.state.target) {

Просмотреть файл

@ -20,7 +20,7 @@ $(document).ready(function () {
modalActions = $(".modal-actions", unsavedModal),
translations = {}; //hold the initial values of the fields to check for changes
$(".primary").delegate(".trans input, .trans textarea", "change keyup paste blur", checkTranslation);
$(".primary").on("change keyup paste blur", ".trans input, .trans textarea", checkTranslation);
$("form").submit(function () {
$(this).find(".trans .cloned").remove();
});
@ -84,9 +84,9 @@ $(document).ready(function () {
}
}
$(".primary").delegate(".errorlist .l10n", "click", switchLocale);
$(".primary").on("click", ".errorlist .l10n", switchLocale);
$("#all_locales").delegate("a", "switch", switchLocale);
$("#all_locales").on("switch", "a", switchLocale);
// If the locale switcher is visible, use the cookie.
var initLocale = dl;
@ -105,7 +105,7 @@ $(document).ready(function () {
unsavedModal.children(".msg")
.html(format(unsavedModalMsg,[$("#change-locale").text()]));
unsavedModal.render();
$("#l10n-save-changes").unbind().click(function () {
$("#l10n-save-changes").off().click(function () {
var unsavedForms = $('form:has(.trans .unsaved)');
var numFormsLeft = unsavedForms.length;
var erroredForms = 0;
@ -177,19 +177,19 @@ $(document).ready(function () {
width: 200,
callback: function() {
showExistingLocales();
$("#locale-popup").delegate('a:not(.remove)', 'click', switchLocale);
$("#locale-popup").delegate('a.remove', 'click', function (e) {
$("#locale-popup").on('click', 'a:not(.remove)', switchLocale);
$("#locale-popup").on('click', 'a.remove', function (e) {
e.preventDefault();
e.stopPropagation();
var toRemove = $(this).closest("li").find("a:not(.remove)").attr("href").substring(1);
rmLocaleModal.children(".msg").html(format(rmLocaleModalMsg,toRemove));
rmLocaleModal.render();
$('#l10n-cancel-rm').unbind().click(rmLocaleModal.hideMe);
$('#l10n-cancel-rm').off().click(rmLocaleModal.hideMe);
function cleanUp() {
$(".modal-actions", rmLocaleModal).removeClass('ajax-loading');
rmLocaleModal.hideMe();
}
$('#l10n-confirm-rm').unbind().click(function(e) {
$('#l10n-confirm-rm').off().click(function(e) {
$(".modal-actions", rmLocaleModal).addClass('ajax-loading');
$.ajax({
url: $('#l10n-menu').attr('data-rm-locale'),

Просмотреть файл

@ -46,7 +46,7 @@ function initPreviewTheme(mktTheme) {
function bindPreviewListeners($themes) {
$themes.each(function() {
var $theme = $(this).find('div[data-browsertheme]');
$theme.unbind('click').click(_pd(function(e) {
$theme.off('click').click(_pd(function(e) {
var $this = $(this),
elm = e.target.nodeName == 'EM' ? e.target.parentNode : e.target;
$('.theme-preview').find('em').addClass('hidden');

Просмотреть файл

@ -22,12 +22,12 @@ $(document).ready(function() {
});
};
$popup.delegate("li a", "click", function(e) {
$popup.on("click", "li a", function(e) {
e.preventDefault();
var el = $(e.target);
if (el.attr("href") == "#review_flag_reason_other") {
$popup.addClass('other')
.delegate("form", "submit", function(e) {
.on("submit", "form", function(e) {
e.preventDefault();
var note = $popup.find('#id_note').val();
if (!note) {
@ -49,7 +49,7 @@ $(document).ready(function() {
}
});
$('.primary').delegate('.review-edit', 'click', function(e) {
$('.primary').on('click', '.review-edit', function(e) {
e.preventDefault();
var $form = $("#review-edit-form"),
$review = $(this).parents(".review"),
@ -66,9 +66,9 @@ $(document).ready(function() {
$form.show();
function done_edit() {
$form.unbind().hide();
$form.off().hide();
$review.show();
$cancel.unbind();
$cancel.off();
}
$cancel.click(function(e) {

Просмотреть файл

@ -23,7 +23,7 @@ Tabs.prototype = {
/* Bind hashchange, trigger event to check for existing hash. */
var self = this;
$(document).bind('hashchange', function(e) {
$(document).on('hashchange', function(e) {
self.hashChange(e);
}).trigger('hashchange');
},
@ -50,7 +50,7 @@ Tabs.prototype = {
self.select($(e.target).attr('href'), true);
$("a", this).blur();
};
this.tabs.unbind('click', cb).click(cb);
this.tabs.off('click', cb).click(cb);
},
/* Get the fragment this tab points to. */

Просмотреть файл

@ -195,7 +195,7 @@
}
var isRejecting = false;
$(document).delegate('li.reject_reason', 'click', _pd(function(e) {
$(document).on('click', 'li.reject_reason', _pd(function(e) {
if (isRejecting) {
var i = getThemeParent(e.currentTarget);
var rejectId = $(this).data('id');
@ -328,7 +328,7 @@
clearReview: function(i) {
$('input.action, input.comment, input.reject-reason',
nthTheme(i)).removeAttr('value');
nthTheme(i)).prop('value', '');
$(nthTheme(i)).removeClass('reviewed');
$('.status', nthTheme(i)).removeClass('reviewed');
@ -336,22 +336,22 @@
}
};
$(document).delegate('button.approve', 'click', _pd(function(e) {
$(document).on('click', 'button.approve', _pd(function(e) {
themeActions.approve(getThemeParent(e.currentTarget));
}))
.delegate('button.reject', 'click', _pd(function(e) {
.on('click', 'button.reject', _pd(function(e) {
themeActions.reject_reason(getThemeParent(e.currentTarget));
}))
.delegate('button.duplicate', 'click', _pd(function(e) {
.on('click', 'button.duplicate', _pd(function(e) {
themeActions.duplicate(getThemeParent(e.currentTarget));
}))
.delegate('button.flag', 'click', _pd(function(e) {
.on('click', 'button.flag', _pd(function(e) {
themeActions.flag(getThemeParent(e.currentTarget));
}))
.delegate('button.moreinfo', 'click', _pd(function(e) {
.on('click', 'button.moreinfo', _pd(function(e) {
themeActions.moreinfo(getThemeParent(e.currentTarget));
}))
.delegate('.clear-review', 'click', _pd(function(e) {
.on('click', '.clear-review', _pd(function(e) {
themeActions.clearReview(getThemeParent(e.currentTarget));
}));
});

Просмотреть файл

@ -477,12 +477,12 @@ function initValidator($doc) {
});
}
$('.addon-validator-suite', $doc).bind('validate', function(e) {
$('.addon-validator-suite', $doc).on('validate', function(e) {
var el = $(this),
data = el.data();
if (data.annotateUrl) {
el.delegate('.ignore-duplicates-checkbox', 'change',
el.on('change', '.ignore-duplicates-checkbox',
function(event) {
var $target = $(event.target);
$.ajax({type: 'POST',