diff --git a/comment/comment.js b/comment/comment.js index e15b10bd79e..3441b9d2ec1 100644 --- a/comment/comment.js +++ b/comment/comment.js @@ -121,7 +121,7 @@ M.core_comment = { alert('IO FATAL'); return; } - var data = json_decode(o.responseText); + var data = Y.JSON.parse(o.responseText); if (data.error) { alert(data.error); return false; diff --git a/lib/editor/tinymce/extra/strings.php b/lib/editor/tinymce/extra/strings.php index 17a4d5fa1a1..aa523224b52 100644 --- a/lib/editor/tinymce/extra/strings.php +++ b/lib/editor/tinymce/extra/strings.php @@ -86,7 +86,7 @@ foreach ($string as $key=>$value) { $lang = str_replace('_utf8', '', $lang); // use more standard language codes -$output = 'tinyMCE.addI18n({'.$lang.':'.json_encode($result).'});'; +$output = 'tinyMCE.addI18n({'.$lang.':'.Y.JSON.stringify($result).'});'; $lifetime = '10'; // TODO: increase later @header('Content-type: text/javascript; charset=utf-8'); diff --git a/lib/form/filemanager.js b/lib/form/filemanager.js index fda643b3dd3..d1b4e69c508 100644 --- a/lib/form/filemanager.js +++ b/lib/form/filemanager.js @@ -89,7 +89,7 @@ YUI.add('core_filemanager', function(Y) { alert('IO FATAL'); return; } - var data = json_decode(o.responseText); + var data = Y.JSON.parse(o.responseText); args.callback(id,data,p); } }, diff --git a/lib/javascript-static.js b/lib/javascript-static.js index f75112a5571..bd12b63eef4 100644 --- a/lib/javascript-static.js +++ b/lib/javascript-static.js @@ -158,7 +158,8 @@ M.util.CollapsibleRegion.prototype.icon = null; //=== old legacy JS code, hopefully to be replaced soon by M.xx.yy and YUI3 code === function launch_filemanager(options) { - Y.use('core_filemanager', function() { + // TODO: move to M.form_filemanager.init() + YUI(M.yui.loader).use('core_filemanager', function(Y) { var client_id = options.client_id; // filemangers defined in lib/form/filemanager.js if (!filemanagers[client_id]) { @@ -1213,14 +1214,6 @@ function stripHTML(str) { return ret; } -function json_decode(json) { - return Y.JSON.parse(json); -} - -function json_encode(data) { - return Y.JSON.stringify(data); -} - /** * Finds all help icons on the page and initiates YUI tooltips for * each of them, which load a truncated version of the help's content diff --git a/mod/chat/gui_ajax/script.js b/mod/chat/gui_ajax/script.js index 18ac9e401e3..d4b73f8c206 100644 --- a/mod/chat/gui_ajax/script.js +++ b/mod/chat/gui_ajax/script.js @@ -223,7 +223,7 @@ YAHOO.moodle.chat.append_msg = function(key, msg, row) { YAHOO.moodle.chat.update_cb = { success: function(o){ - var data = json_decode(o.responseText); + var data = Y.JSON.parse(o.responseText); if (!data) { return; }