MDL-21503 eliminating global Y
This commit is contained in:
+1
-1
@@ -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;
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user