]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - include/javascript/tiny_mce/classes/util/JSONP.js
Release 6.5.0
[Github/sugarcrm.git] / include / javascript / tiny_mce / classes / util / JSONP.js
1 /**
2  * JSONP.js
3  *
4  * Copyright 2009, Moxiecode Systems AB
5  * Released under LGPL License.
6  *
7  * License: http://tinymce.moxiecode.com/license
8  * Contributing: http://tinymce.moxiecode.com/contributing
9  */
10
11 tinymce.create('static tinymce.util.JSONP', {
12         callbacks : {},
13         count : 0,
14
15         send : function(o) {
16                 var t = this, dom = tinymce.DOM, count = o.count !== undefined ? o.count : t.count, id = 'tinymce_jsonp_' + count;
17
18                 t.callbacks[count] = function(json) {
19                         dom.remove(id);
20                         delete t.callbacks[count];
21
22                         o.callback(json);
23                 };
24
25                 dom.add(dom.doc.body, 'script', {id : id , src : o.url, type : 'text/javascript'});
26                 t.count++;
27         }
28 });