From 5170fe9966e28e9377cd886689693f8195423208 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Sat, 26 Nov 2016 11:26:12 +0100 Subject: [PATCH] replace deprecated bind() calls The bind() call is deprecated in jQuery 3. This replaces it with the on() call. --- lib/scripts/edit.js | 4 ++-- lib/scripts/media.js | 6 +++--- lib/scripts/toolbar.js | 2 +- lib/tpl/dokuwiki/script.js | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/scripts/edit.js b/lib/scripts/edit.js index 579afd8f1e..b3e97b63c1 100644 --- a/lib/scripts/edit.js +++ b/lib/scripts/edit.js @@ -85,7 +85,7 @@ function createPicker(id,props,edid){ var $btn = jQuery(document.createElement('button')) .addClass('pickerbutton').attr('title', title) .attr('aria-controls', edid) - .bind('click', bind(pickerInsert, title, edid)) + .on('click', bind(pickerInsert, title, edid)) .appendTo($picker); return $btn; } @@ -141,7 +141,7 @@ function pickerInsert(text,edid){ */ function addBtnActionSignature($btn, props, edid) { if(typeof SIG != 'undefined' && SIG != ''){ - $btn.bind('click', function (e) { + $btn.on('click', function (e) { insertAtCarret(edid,SIG); e.preventDefault(); }); diff --git a/lib/scripts/media.js b/lib/scripts/media.js index db00dd0840..ce8b8a3983 100644 --- a/lib/scripts/media.js +++ b/lib/scripts/media.js @@ -628,7 +628,7 @@ var dw_mediamanager = { $slider.slider("option", "max", 0.999); $slider.slider("option", "step", 0.001); $slider.slider("option", "value", 0.5); - $slider.bind("slide", function (event, ui) { + $slider.on("slide", function (event, ui) { jQuery('#mediamanager__diff').find('div.imageDiff.opacity div.image2 img').css({opacity: $slider.slider("option", "value")}); }); }, @@ -668,7 +668,7 @@ var dw_mediamanager = { $slider.slider("option", "max", 97); $slider.slider("option", "step", 1); $slider.slider("option", "value", 50); - $slider.bind("slide", function (event, ui) { + $slider.on("slide", function (event, ui) { jQuery('#mediamanager__diff').find('div.imageDiff.portions div.image2').css({width: $slider.slider("option", "value") + '%'}); }); }, @@ -744,7 +744,7 @@ var dw_mediamanager = { // remove old callback from the insert button and set the new one. var $sendbtn = jQuery('#media__sendbtn'); - $sendbtn.unbind().click(bind(dw_mediamanager.insert, id)); + $sendbtn.off().click(bind(dw_mediamanager.insert, id)); dw_mediamanager.unforbid('ext'); if (ext === '.swf') { diff --git a/lib/scripts/toolbar.js b/lib/scripts/toolbar.js index a5f831ade4..b766f8b853 100644 --- a/lib/scripts/toolbar.js +++ b/lib/scripts/toolbar.js @@ -44,7 +44,7 @@ function initToolbar(tbid,edid,tb, allowblock){ // type is a tb function -> assign it as onclick actionFunc = 'tb_'+val.type; if( jQuery.isFunction(window[actionFunc]) ){ - $btn.bind('click', bind(window[actionFunc],$btn,val,edid) ); + $btn.on('click', bind(window[actionFunc],$btn,val,edid) ); $toolbar.append($btn); return; } diff --git a/lib/tpl/dokuwiki/script.js b/lib/tpl/dokuwiki/script.js index 4eb92a4172..b4e6ced6dd 100644 --- a/lib/tpl/dokuwiki/script.js +++ b/lib/tpl/dokuwiki/script.js @@ -63,7 +63,7 @@ jQuery(function(){ dw_page.makeToggle('#dokuwiki__aside h3.toggle','#dokuwiki__aside div.content'); tpl_dokuwiki_mobile(); - jQuery(window).bind('resize', + jQuery(window).on('resize', function(){ if (resizeTimer) clearTimeout(resizeTimer); resizeTimer = setTimeout(tpl_dokuwiki_mobile,200);