From e1b4553d8cf3d84b8ded493d684d1597eca85555 Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Fri, 6 Dec 2013 17:09:32 +0800 Subject: [PATCH 1/5] MDL-43243 JavaScript: Deprecate hide_item --- lib/javascript-static.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/javascript-static.js b/lib/javascript-static.js index 1c1e19ccec7..cb5a6f91aab 100644 --- a/lib/javascript-static.js +++ b/lib/javascript-static.js @@ -1482,12 +1482,14 @@ function update_progress_bar (id, width, pt, msg, es){ /** * Used in a couple of modules to hide navigation areas when using AJAX + * @deprecated since Moodle 2.7. This function will be removed in Moodle 2.9. */ function hide_item(itemid) { - // use class='hiddenifjs' instead - var item = document.getElementById(itemid); + Y.log('hide_item has been deprecated since Moodle 2.7 and will be removed in Moodle 2.9', + 'warn', 'javascript-static.js'); + var item = Y.one('#' + itemid); if (item) { - item.style.display = "none"; + item.hide(); } } From bc549847d963e699e7e8d7a194eb22cff6157f3f Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Fri, 6 Dec 2013 17:27:32 +0800 Subject: [PATCH 2/5] MDL-43243 JavaScript: Deprecate getElementsByClassName --- lib/javascript-static.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/javascript-static.js b/lib/javascript-static.js index cb5a6f91aab..3d08f5524e0 100644 --- a/lib/javascript-static.js +++ b/lib/javascript-static.js @@ -1204,8 +1204,11 @@ function addonload(fn) { * document, use `document`. * @param {String} strTagName filter by tag names * @param {String} name same as HTML5 spec + * @deprecated Since Moodle 2.7. This will be removed in Moodle 2.9. */ function getElementsByClassName(oElm, strTagName, name) { + Y.log('getElementsByClassName has been deprecated since Moodle 2.7 and will be removed in Moodle 2.9', + 'warn', 'javascript-static.js'); // for backwards compatibility if(typeof name == "object") { var names = new Array(); From f260850efc88c33f83f01cf17de6ebb94da181fc Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Fri, 6 Dec 2013 17:27:41 +0800 Subject: [PATCH 3/5] MDL-43243 JavaScript: Deprecate addonload --- lib/javascript-static.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/javascript-static.js b/lib/javascript-static.js index 3d08f5524e0..4475f5ab020 100644 --- a/lib/javascript-static.js +++ b/lib/javascript-static.js @@ -1182,8 +1182,11 @@ function insertAtCursor(myField, myValue) { Call instead of setting window.onload directly or setting body onload=. Adds your function to a chain of functions rather than overwriting anything that exists. + @deprecated Since Moodle 2.7. This will be removed in Moodle 2.9. */ function addonload(fn) { + Y.log('addonload has been deprecated since Moodle 2.7 and will be removed in Moodle 2.9', + 'warn', 'javascript-static.js'); var oldhandler=window.onload; window.onload=function() { if(oldhandler) oldhandler(); From 0d8907e3d89824eeb226afe2e0e10000fb8d7d8d Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Fri, 6 Dec 2013 17:47:34 +0800 Subject: [PATCH 4/5] MDL-43243 JavaScript: Deprecate show_item --- lib/form/url.php | 3 +-- lib/javascript-static.js | 8 +++++--- mod/data/field/url/field.class.php | 3 +-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/form/url.php b/lib/form/url.php index 1193086c332..2e624633281 100644 --- a/lib/form/url.php +++ b/lib/form/url.php @@ -109,7 +109,7 @@ class MoodleQuickForm_url extends HTML_QuickForm_text{ if (count($options->repositories) > 0) { $straddlink = get_string('choosealink', 'repository'); $str .= <<