Commit befc36dc authored by jonnybradley's avatar jonnybradley

[FIX] jquery3: Replace deprecated bind and unbind calls with on and off

parent 5c0e2db4
......@@ -800,8 +800,8 @@ $(function() {
//for plugin code
$(document)
.unbind('plugin_code_ready')
.bind('plugin_code_ready', function(args) {
.off('plugin_code_ready')
.on('plugin_code_ready', function(args) {
var colors = args.container.find('#param_colors input:first').hide();
var colorsSelector = $('<select />')
.insertAfter(colors)
......@@ -840,8 +840,8 @@ $(function() {
//for plugin html
$(document)
.unbind('plugin_html_ready')
.bind('plugin_html_ready', function(args) {
.off('plugin_html_ready')
.on('plugin_html_ready', function(args) {
var code = args.container.find('textarea:first');
code.flexibleSyntaxHighlighter({
......@@ -853,8 +853,8 @@ $(function() {
//for plugin r
$(document)
.unbind('plugin_r_ready')
.bind('plugin_r_ready', function(args) {
.off('plugin_r_ready')
.on('plugin_r_ready', function(args) {
var r = args.container.find('textarea:first');
r.flexibleSyntaxHighlighter({
......@@ -866,8 +866,8 @@ $(function() {
//for plugin r
$(document)
.unbind('plugin_rr_ready')
.bind('plugin_rr_ready', function(args) {
.off('plugin_rr_ready')
.on('plugin_rr_ready', function(args) {
var r = args.container.find('textarea:first');
r.flexibleSyntaxHighlighter({
......
......@@ -22,7 +22,7 @@
// FIXME currently only works with the default id, but avoid js error here when it's customsearch_42 or something
customsearch_0 = typeof customsearch_0 === "object" ? customsearch_0 : {};
$csForm.unbind("submit").submit(function () {
$csForm.off("submit").submit(function () {
var maxRecords = $(".max-records", $csForm).val();
if (maxRecords) {
......@@ -47,7 +47,7 @@
});
$(document).bind("pageSearchReady", function () {
$(document).on("pageSearchReady", function () {
var $csResults = $("#customsearch_0_results");
......
......@@ -60,7 +60,7 @@ openElFinderDialog = function(element, options) {
$(this).append($elf);
$elf.elfinder(elfoptions).elfinder('instance');
if (options.uploadCallback) {
$elf.elfinder('instance').bind("upload", options.uploadCallback);
$elf.elfinder('instance').on("upload", options.uploadCallback);
}
},
close: function () {
......
......@@ -208,7 +208,7 @@
$(function () {
if (jqueryTiki.ui) {
$('.inline-sort-handle')
.next().children().bind('changed.inline.tiki', function () {
.next().children().on('changed.inline.tiki', function () {
$(this).parent().prev()
.toggleClass('text-warning', $(this).hasClass('modified'))
.toggleClass('text-danger', $(this).hasClass('unsaved'));
......
......@@ -510,7 +510,7 @@ $(function() { // JQuery's DOM is ready event - before onload
// ColorBox setup (Shadowbox, actually "<any>box" replacement)
if (jqueryTiki.colorbox && !jqueryTiki.mobile) {
$().bind('cbox_complete', function(){
$().on('cbox_complete', function(){
$("#cboxTitle").wrapInner("<div></div>");
});
......@@ -688,7 +688,7 @@ $(function() { // JQuery's DOM is ready event - before onload
}); // end $document.ready
//For ajax/custom search
$document.bind('pageSearchReady', function() {
$document.on('pageSearchReady', function() {
$.paginationHelper();
});
......@@ -2028,7 +2028,7 @@ $.fn.tiki = function(func, type, options) {
$dialog.find('form .submit').hide();
$dialog.find('form:not(.no-ajax)').unbind("submit").submit(ajaxSubmitEventHandler(function (data) {
$dialog.find('form:not(.no-ajax)').off("submit").submit(ajaxSubmitEventHandler(function (data) {
data = (data ? data : {});
if (data.FORWARD) {
......@@ -2551,7 +2551,7 @@ $.fn.tiki = function(func, type, options) {
var payload, fullKey = this._build(key);
if (window.localStorage && window.localStorage[fullKey]) {
payload = $.parseJSON(window.localStorage[fullKey]);
payload = JSON.parse(window.localStorage[fullKey]);
if (duration) {
// Expired, refetch
......@@ -2906,7 +2906,7 @@ $.fn.visible = function(fn, isOne) {
if (isOne) {
me.one('visible', fn);
} else {
me.bind('visible', fn);
me.on('visible', fn);
}
function visibilityHelper() {
......@@ -3060,7 +3060,7 @@ $.fn.ajaxEditDraw = function(options) {
imgParams: me.data('imgparams'),
data: $('#fileData').val()
})
.bind('savedDraw', function(e, o) {
.on('savedDraw', function(e, o) {
me.data('drawLoaded', false);
me.drawing.parent().dialog('destroy');
me.drawing.remove();
......@@ -3117,7 +3117,7 @@ $.fn.ajaxEditDraw = function(options) {
me.drawing.saveDraw();
return false;
})
.bind('loadedDraw', function() {
.on('loadedDraw', function() {
//kill the padding around the dialog so it looks like svg-edit is one single box
me.drawing
.parent()
......@@ -3127,7 +3127,7 @@ $.fn.ajaxEditDraw = function(options) {
if (serviceDialog) {
var drawFrame = $('#svgedit');
serviceDialog
.bind('dialogresize', function() {
.on('dialogresize', function() {
drawFrame.height(serviceDialog.height() - 4);
})
.trigger('dialogresize');
......
......@@ -1062,7 +1062,7 @@
searchboxes = searchboxes.add($('form.search-box', container));
searchboxes
.unbind('submit')
.off('submit')
.submit(function () {
$(container).trigger("start.map.search");
var form = this;
......@@ -1269,17 +1269,17 @@
}
}, refresh);
$(container).bind('unregister', function () {
$(container).on('unregister', function () {
clearInterval(interval);
});
}
$(container).bind('changed', function () {
$(container).on('changed', function () {
$(form).submit();
skip = true;
});
});
$(container).bind('search', function (e, data) {
$(container).on('search', function (e, data) {
function markLocation (lat, lon, bounds) {
var lonlat = new ol.LonLat(lon, lat).transform(
new ol.proj.Projection("EPSG:4326"),
......@@ -1520,7 +1520,7 @@
var container = this, field = options.field, map = this.map;
if (! field.attr('disabled')) {
$(container).bind('selectionChange', function (e, lonlat) {
$(container).on('selectionChange', function (e, lonlat) {
if (lonlat) {
field.val(writeCoordinates(lonlat, map)).change();
} else {
......@@ -1787,7 +1787,7 @@
var container = this;
$(container).trigger('unregister');
$(container).bind('add', function (e, data, feature) {
$(container).on('add', function (e, data, feature) {
collector(data, $.extend({}, feature));
});
$(container).trigger('changed');
......
......@@ -1026,7 +1026,7 @@
searchboxes = searchboxes.add($('form.search-box', container));
searchboxes
.unbind('submit')
.off('submit')
.submit(function () {
$(container).trigger("start.map.search");
var form = this;
......@@ -1233,17 +1233,17 @@
}
}, refresh);
$(container).bind('unregister', function () {
$(container).on('unregister', function () {
clearInterval(interval);
});
}
$(container).bind('changed', function () {
$(container).on('changed', function () {
$(form).submit();
skip = true;
});
});
$(container).bind('search', function (e, data) {
$(container).on('search', function (e, data) {
function markLocation (lat, lon, bounds) {
var lonlat = new OpenLayers.LonLat(lon, lat).transform(
new OpenLayers.Projection("EPSG:4326"),
......@@ -1487,7 +1487,7 @@
var container = this, field = options.field, map = this.map;
if (! field.attr('disabled')) {
$(container).bind('selectionChange', function (e, lonlat) {
$(container).on('selectionChange', function (e, lonlat) {
if (lonlat) {
field.val(writeCoordinates(lonlat, map)).change();
} else {
......@@ -1752,7 +1752,7 @@
var container = this;
$(container).trigger('unregister');
$(container).bind('add', function (e, data, feature) {
$(container).on('add', function (e, data, feature) {
collector(data, $.extend({}, feature));
});
$(container).trigger('changed');
......
......@@ -28,7 +28,7 @@ $(".module:not(.box-zone)", dragZonesSelector).each(function() {
var modAdminDirty = false;
$(document).ready(function() {
$(window).bind("beforeunload", function() {
$(window).on("beforeunload", function() {
if (modAdminDirty) {
return tr("You have unsaved changes to your modules, are you sure you want to leave the page without saving?");
}
......
......@@ -251,8 +251,8 @@ $.sheet = $.extend({
link: {
setupUI: function() {
jST
.unbind("sheetSwitchSpreadsheet")
.bind("sheetSwitchSpreadsheet", function(e, jS, i) {
.off("sheetSwitchSpreadsheet")
.on("sheetSwitchSpreadsheet", function(e, jS, i) {
if (i < 0) {
$.sheet.makeSmall();
......
......@@ -88,7 +88,7 @@ $(document).ready(function() {
});
};
$(window).bind("beforeunload", function() {
$(window).on("beforeunload", function() {
if (tocDirty) {
return tr("You have unsaved changes to your structure, are you sure you want to leave the page without saving?");
}
......
......@@ -23,7 +23,7 @@ $(document).ready(function() {
}).disableSelection();
};
$(window).bind("beforeunload", function() {
$(window).on("beforeunload", function() {
if (listDirty) {
return tr("You have unsaved changes to your survey, are you sure you want to leave the page without saving?");
}
......
......@@ -31,7 +31,7 @@ $.fn.drawFullscreen = function() {
} else {
me.data('origParent').append(me);
win.unbind('resize');
win.off('resize');
fullscreen.remove();
$('body').removeClass('full_screen_body');
}
......
......@@ -127,8 +127,8 @@ function wikiplugin_htmlfeedlink($data, $params)
}
$(document)
.unbind('plugin_htmlfeedlink_ready')
.bind('plugin_htmlfeedlink_ready', function(e) {
.off('plugin_htmlfeedlink_ready')
.on('plugin_htmlfeedlink_ready', function(e) {
var name = $(e.container).find('#param_name input:first');
name.hide();
var nameSelect = $('<select>')
......
......@@ -117,7 +117,7 @@ function wikiplugin_pagetabs($data, $params)
.each(function() {
$(this).attr("href", ($(this).attr("href") + "").replace("_raw", ""));
})
.unbind("click")
.off("click")
.click(function() {
var pageAttr = $(this).attr("href").split("=");
if (pageAttr.length < 2) return true;
......
......@@ -140,7 +140,7 @@ $smarty->assign("invoiceItems", $invoiceItems);
$headerlib->add_jq_onready(
"function setupTotal() {
$('#InvoiceForm :input')
.unbind('change')
.off('change')
.change(function() {
findTotal();
})
......
......@@ -87,7 +87,7 @@ $headerlib = TikiLib::lib("header")
var jS = $('#timesheetSpreadsheet').getSheet();
if (jS) {
$('#timesheetSpreadsheet')
.unbind('visible')
.off('visible')
.visible(function() {
jS.openSheet(table);
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment