From e44a7e37b6c7b5961adaffc62b9042b8d442938e Mon Sep 17 00:00:00 2001 From: mensonge Date: Thu, 13 Nov 2008 09:49:11 +0000 Subject: New feature: basic Ajax suggestion for tags and implementation of Dojo toolkit git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@151 b3834d28-1941-0410-a4f8-b48e95affb8f --- includes/js/dojo/io/script.js | 211 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 211 insertions(+) create mode 100644 includes/js/dojo/io/script.js (limited to 'includes/js/dojo/io/script.js') diff --git a/includes/js/dojo/io/script.js b/includes/js/dojo/io/script.js new file mode 100644 index 0000000..c38d070 --- /dev/null +++ b/includes/js/dojo/io/script.js @@ -0,0 +1,211 @@ +if(!dojo._hasResource["dojo.io.script"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. +dojo._hasResource["dojo.io.script"] = true; +dojo.provide("dojo.io.script"); + +/*===== +dojo.io.script.__ioArgs = function(kwArgs){ + // summary: + // All the properties described in the dojo.__ioArgs type, apply to this + // type as well, EXCEPT "handleAs". It is not applicable to + // dojo.io.script.get() calls, since it is implied by the usage of + // "callbackParamName" (response will be a JSONP call returning JSON) + // or "checkString" (response is pure JavaScript defined in + // the body of the script that was attached). The following additional + // properties are allowed for dojo.io.script.get(): + // callbackParamName: String + // The URL parameter name that indicates the JSONP callback string. + // For instance, when using Yahoo JSONP calls it is normally, + // callbackParamName: "callback". For AOL JSONP calls it is normally + // callbackParamName: "c". + // checkString: String + // A string of JavaScript that when evaluated like so: + // "typeof(" + checkString + ") != 'undefined'" + // being true means that the script fetched has been loaded. + // Do not use this if doing a JSONP type of call (use callbackParamName instead). + // frameDoc: Document. + // The Document object for a child iframe. If this is passed in, the script + // will be attached to that document. This can be helpful in some comet long-polling + // scenarios with Firefox and Opera. +} +=====*/ + +dojo.io.script = { + get: function(/*dojo.io.script.__ioArgs*/args){ + // summary: + // sends a get request using a dynamically created script tag. + var dfd = this._makeScriptDeferred(args); + var ioArgs = dfd.ioArgs; + dojo._ioAddQueryToUrl(ioArgs); + + this.attach(ioArgs.id, ioArgs.url, args.frameDoc); + dojo._ioWatch(dfd, this._validCheck, this._ioCheck, this._resHandle); + return dfd; + }, + + attach: function(/*String*/id, /*String*/url, /*Document?*/frameDocument){ + // summary: + // creates a new