HTML-Dojo
view release on metacpan or search on metacpan
lib/HTML/Dojo/src.pm view on Meta::CPAN
win.debugVar = obj;
}
catch (e) {
}
};
dojo.debugDeep.debugVars = [];
}});
__CPAN_FILE__ src/docs.xd.js
dojo.hostenv.packageLoaded({
depends: [["provide", "dojo.docs"],
["require", "dojo.io.*"],
["require", "dojo.event.topic"],
["require", "dojo.rpc.JotService"],
["require", "dojo.dom"],
["require", "dojo.uri.Uri"],
["require", "dojo.Deferred"],
["require", "dojo.DeferredList"]],
definePackage: function(dojo){/*
Copyright (c) 2004-2006, The Dojo Foundation
All Rights Reserved.
Licensed under the Academic Free License version 2.1 or above OR the
modified BSD license. For more information on Dojo licensing, see:
http://dojotoolkit.org/community/licensing.shtml
*/
dojo.provide("dojo.docs");
dojo.require("dojo.io.*");
dojo.require("dojo.event.topic");
dojo.require("dojo.rpc.JotService");
dojo.require("dojo.dom");
dojo.require("dojo.uri.Uri");
dojo.require("dojo.Deferred");
dojo.require("dojo.DeferredList");
/*
* TODO:
*
* Package summary needs to compensate for "is"
* Handle host environments
* Deal with dojo.widget weirdness
* Parse parameters
* Limit function parameters to only the valid ones (Involves packing parameters onto meta during rewriting)
*
*/
dojo.docs = new function() {
this._url = dojo.uri.dojoUri("docscripts");
this._rpc = new dojo.rpc.JotService;
this._rpc.serviceUrl = dojo.uri.dojoUri("docscripts/jsonrpc.php");
};
dojo.lang.mixin(dojo.docs, {
_count: 0,
_callbacks: {function_names: []},
_cache: {}, // Saves the JSON objects in cache
require: function(/*String*/ require, /*bool*/ sync) {
dojo.debug("require(): " + require);
var parts = require.split("/");
var size = parts.length;
var deferred = new dojo.Deferred;
var args = {
mimetype: "text/json",
load: function(type, data){
dojo.debug("require(): loaded for " + require);
if(parts[0] != "function_names") {
for(var i = 0, part; part = parts[i]; i++){
data = data[part];
}
}
deferred.callback(data);
},
error: function(){
deferred.errback();
}
};
if(location.protocol == "file:"){
if(size){
if(parts[parts.length - 1] == "documentation"){
parts[parts.length - 1] = "meta";
}
if(parts[0] == "function_names"){
args.url = [this._url, "local_json", "function_names"].join("/");
}else{
var dirs = parts[0].split(".");
args.url = [this._url, "local_json", dirs[0]].join("/");
if(dirs.length > 1){
args.url = [args.url, dirs[1]].join(".");
}
}
}
}
dojo.io.bind(args);
return deferred;
},
getFunctionNames: function(){
return this.require("function_names"); // dojo.Deferred
},
unFormat: function(/*String*/ string){
var fString = string;
if(string.charAt(string.length - 1) == "_"){
fString = [string.substring(0, string.length - 1), "*"].join("");
}
return fString;
},
getMeta: function(/*String*/ pkg, /*String*/ name, /*Function*/ callback, /*String?*/ id){
// summary: Gets information about a function in regards to its meta data
if(typeof name == "function"){
// pId: a
// pkg: ignore
id = callback;
callback = name;
name = pkg;
pkg = null;
lib/HTML/Dojo/src.pm view on Meta::CPAN
//Head element may not exist, particularly in html
//html 4 or tag soup cases where the page does not
//have a head tag in it. Use html element, since that will exist.
//Seems to be an issue mostly with Opera 9 and to lesser extent Safari 2
if(!this.headElement){
this.headElement = document.getElementsByTagName("html")[0];
}
}
this.headElement.appendChild(element);
}else{
var contents = this.getText(uri, null, true);
if(contents == null){ return 0; /*boolean*/}
//If this is not xdomain, or if loading a i18n resource bundle, then send it down
//the normal eval/callback path.
if(this.isXDomain && uri.indexOf("/nls/") == -1){
var pkg = this.createXdPackage(contents, module, uri);
dj_eval(pkg);
}else{
if(cb){ contents = '('+contents+')'; }
var value = dj_eval(contents);
if(cb){
cb(value);
}
}
}
//These steps are done in the non-xd loader version of this function.
//Maintain these steps to fit in with the existing system.
this.loadedUris[uri] = true;
return 1; //boolean
}
dojo.hostenv.packageLoaded = function(/*Object*/pkg){
//summary: Internal xd loader function. Called by an xd module when
//it has been loaded via a script tag.
var deps = pkg.depends;
var requireList = null;
var requireAfterList = null;
var provideList = [];
if(deps && deps.length > 0){
var dep = null;
var insertHint = 0;
var attachedPackage = false;
for(var i = 0; i < deps.length; i++){
dep = deps[i];
//Look for specific dependency indicators.
if (dep[0] == "provide" || dep[0] == "hostenv.moduleLoaded"){
provideList.push(dep[1]);
}else{
if(!requireList){
requireList = [];
}
if(!requireAfterList){
requireAfterList = [];
}
var unpackedDeps = this.unpackXdDependency(dep);
if(unpackedDeps.requires){
requireList = requireList.concat(unpackedDeps.requires);
}
if(unpackedDeps.requiresAfter){
requireAfterList = requireAfterList.concat(unpackedDeps.requiresAfter);
}
}
//Call the dependency indicator to allow for the normal dojo setup.
//Only allow for one dot reference, for the hostenv.* type calls.
var depType = dep[0];
var objPath = depType.split(".");
if(objPath.length == 2){
dojo[objPath[0]][objPath[1]].apply(dojo[objPath[0]], dep.slice(1));
}else{
dojo[depType].apply(dojo, dep.slice(1));
}
}
//Save off the package contents for definition later.
var contentIndex = this.xdContents.push({
content: pkg.definePackage,
resourceName: pkg["resourceName"],
resourcePath: pkg["resourcePath"],
isDefined: false
}) - 1;
//Add provide/requires to dependency map.
for(var i = 0; i < provideList.length; i++){
this.xdDepMap[provideList[i]] = { requires: requireList, requiresAfter: requireAfterList, contentIndex: contentIndex };
}
//Now update the inflight status for any provided packages in this loaded package.
//Do this at the very end (in a *separate* for loop) to avoid shutting down the
//inflight timer check too soon.
for(var i = 0; i < provideList.length; i++){
this.xdInFlight[provideList[i]] = false;
}
}
}
dojo.hostenv.xdLoadFlattenedBundle = function(/*String*/moduleName, /*String*/bundleName, /*String?*/locale, /*Object*/bundleData){
//summary: Internal xd loader function. Used when loading
//a flattened localized bundle via a script tag.
locale = locale || "root";
var jsLoc = dojo.hostenv.normalizeLocale(locale).replace('-', '_');
var bundlePackage = [moduleName, "nls", bundleName].join(".");
var bundle = dojo.hostenv.startPackage(bundlePackage);
bundle[jsLoc] = bundleData;
//Assign the bundle for the original locale(s) we wanted.
var mapName = [moduleName, jsLoc, bundleName].join(".");
var bundleMap = dojo.hostenv.xdBundleMap[mapName];
if(bundleMap){
for(var param in bundleMap){
bundle[param] = bundleData;
}
}
};
dojo.hostenv.xdBundleMap = {};
dojo.xdRequireLocalization = function(/*String*/moduleName, /*String*/bundleName, /*String?*/locale, /*String*/availableFlatLocales){
//summary: Internal xd loader function. The xd version of dojo.requireLocalization.
lib/HTML/Dojo/src.pm view on Meta::CPAN
} else {
if (typeof (k) == "string") {
useKey = dojo.string.escapeString(k);
} else {
continue;
}
}
val = me(o[k]);
if (typeof (val) != "string") {
continue;
}
res.push(useKey + ":" + val);
}
return "{" + res.join(",") + "}";
}};
}});
__CPAN_FILE__ src/docs.js
/*
Copyright (c) 2004-2006, The Dojo Foundation
All Rights Reserved.
Licensed under the Academic Free License version 2.1 or above OR the
modified BSD license. For more information on Dojo licensing, see:
http://dojotoolkit.org/community/licensing.shtml
*/
dojo.provide("dojo.docs");
dojo.require("dojo.io.*");
dojo.require("dojo.event.topic");
dojo.require("dojo.rpc.JotService");
dojo.require("dojo.dom");
dojo.require("dojo.uri.Uri");
dojo.require("dojo.Deferred");
dojo.require("dojo.DeferredList");
/*
* TODO:
*
* Package summary needs to compensate for "is"
* Handle host environments
* Deal with dojo.widget weirdness
* Parse parameters
* Limit function parameters to only the valid ones (Involves packing parameters onto meta during rewriting)
*
*/
dojo.docs = new function() {
this._url = dojo.uri.dojoUri("docscripts");
this._rpc = new dojo.rpc.JotService;
this._rpc.serviceUrl = dojo.uri.dojoUri("docscripts/jsonrpc.php");
};
dojo.lang.mixin(dojo.docs, {
_count: 0,
_callbacks: {function_names: []},
_cache: {}, // Saves the JSON objects in cache
require: function(/*String*/ require, /*bool*/ sync) {
dojo.debug("require(): " + require);
var parts = require.split("/");
var size = parts.length;
var deferred = new dojo.Deferred;
var args = {
mimetype: "text/json",
load: function(type, data){
dojo.debug("require(): loaded for " + require);
if(parts[0] != "function_names") {
for(var i = 0, part; part = parts[i]; i++){
data = data[part];
}
}
deferred.callback(data);
},
error: function(){
deferred.errback();
}
};
if(location.protocol == "file:"){
if(size){
if(parts[parts.length - 1] == "documentation"){
parts[parts.length - 1] = "meta";
}
if(parts[0] == "function_names"){
args.url = [this._url, "local_json", "function_names"].join("/");
}else{
var dirs = parts[0].split(".");
args.url = [this._url, "local_json", dirs[0]].join("/");
if(dirs.length > 1){
args.url = [args.url, dirs[1]].join(".");
}
}
}
}
dojo.io.bind(args);
return deferred;
},
getFunctionNames: function(){
return this.require("function_names"); // dojo.Deferred
},
unFormat: function(/*String*/ string){
var fString = string;
if(string.charAt(string.length - 1) == "_"){
fString = [string.substring(0, string.length - 1), "*"].join("");
}
return fString;
},
getMeta: function(/*String*/ pkg, /*String*/ name, /*Function*/ callback, /*String?*/ id){
// summary: Gets information about a function in regards to its meta data
if(typeof name == "function"){
// pId: a
// pkg: ignore
id = callback;
callback = name;
name = pkg;
pkg = null;
lib/HTML/Dojo/src.pm view on Meta::CPAN
if (lastIndex <= 0) {
lastIndex = uri.length - 1;
}
var xdUri = uri.substring(0, lastIndex) + ".xd";
if (lastIndex != uri.length - 1) {
xdUri += uri.substring(lastIndex, uri.length);
}
var element = document.createElement("script");
element.type = "text/javascript";
element.src = xdUri;
if (!this.headElement) {
this.headElement = document.getElementsByTagName("head")[0];
if (!this.headElement) {
this.headElement = document.getElementsByTagName("html")[0];
}
}
this.headElement.appendChild(element);
} else {
var contents = this.getText(uri, null, true);
if (contents == null) {
return 0;
}
if (this.isXDomain && uri.indexOf("/nls/") == -1) {
var pkg = this.createXdPackage(contents, module, uri);
dj_eval(pkg);
} else {
if (cb) {
contents = "(" + contents + ")";
}
var value = dj_eval(contents);
if (cb) {
cb(value);
}
}
}
this.loadedUris[uri] = true;
return 1;
};
dojo.hostenv.packageLoaded = function (pkg) {
var deps = pkg.depends;
var requireList = null;
var requireAfterList = null;
var provideList = [];
if (deps && deps.length > 0) {
var dep = null;
var insertHint = 0;
var attachedPackage = false;
for (var i = 0; i < deps.length; i++) {
dep = deps[i];
if (dep[0] == "provide" || dep[0] == "hostenv.moduleLoaded") {
provideList.push(dep[1]);
} else {
if (!requireList) {
requireList = [];
}
if (!requireAfterList) {
requireAfterList = [];
}
var unpackedDeps = this.unpackXdDependency(dep);
if (unpackedDeps.requires) {
requireList = requireList.concat(unpackedDeps.requires);
}
if (unpackedDeps.requiresAfter) {
requireAfterList = requireAfterList.concat(unpackedDeps.requiresAfter);
}
}
var depType = dep[0];
var objPath = depType.split(".");
if (objPath.length == 2) {
dojo[objPath[0]][objPath[1]].apply(dojo[objPath[0]], dep.slice(1));
} else {
dojo[depType].apply(dojo, dep.slice(1));
}
}
var contentIndex = this.xdContents.push({content:pkg.definePackage, resourceName:pkg["resourceName"], resourcePath:pkg["resourcePath"], isDefined:false}) - 1;
for (var i = 0; i < provideList.length; i++) {
this.xdDepMap[provideList[i]] = {requires:requireList, requiresAfter:requireAfterList, contentIndex:contentIndex};
}
for (var i = 0; i < provideList.length; i++) {
this.xdInFlight[provideList[i]] = false;
}
}
};
dojo.hostenv.xdLoadFlattenedBundle = function (moduleName, bundleName, locale, bundleData) {
locale = locale || "root";
var jsLoc = dojo.hostenv.normalizeLocale(locale).replace("-", "_");
var bundlePackage = [moduleName, "nls", bundleName].join(".");
var bundle = dojo.hostenv.startPackage(bundlePackage);
bundle[jsLoc] = bundleData;
var mapName = [moduleName, jsLoc, bundleName].join(".");
var bundleMap = dojo.hostenv.xdBundleMap[mapName];
if (bundleMap) {
for (var param in bundleMap) {
bundle[param] = bundleData;
}
}
};
dojo.hostenv.xdBundleMap = {};
dojo.xdRequireLocalization = function (moduleName, bundleName, locale, availableFlatLocales) {
var locales = availableFlatLocales.split(",");
var jsLoc = dojo.hostenv.normalizeLocale(locale);
var bestLocale = "";
for (var i = 0; i < locales.length; i++) {
if (jsLoc.indexOf(locales[i]) == 0) {
if (locales[i].length > bestLocale.length) {
bestLocale = locales[i];
}
}
}
var fixedBestLocale = bestLocale.replace("-", "_");
var bundlePackage = dojo.evalObjPath([moduleName, "nls", bundleName].join("."));
if (bundlePackage && bundlePackage[fixedBestLocale]) {
bundle[jsLoc.replace("-", "_")] = bundlePackage[fixedBestLocale];
} else {
var mapName = [moduleName, (fixedBestLocale || "root"), bundleName].join(".");
var bundleMap = dojo.hostenv.xdBundleMap[mapName];
if (!bundleMap) {
bundleMap = dojo.hostenv.xdBundleMap[mapName] = {};
}
bundleMap[jsLoc.replace("-", "_")] = true;
dojo.require(moduleName + ".nls" + (bestLocale ? "." + bestLocale : "") + "." + bundleName);
}
};
(function () {
lib/HTML/Dojo/src.pm view on Meta::CPAN
this.pType.parentNode.style.display = "none";
if (parameters[param][0]) {
this.pType.parentNode.style.display = "inline";
this.pType.innerHTML = paramType;
}
this.pDesc.parentNode.style.display = "none";
if (paramSummary) {
this.pDesc.parentNode.style.display = "inline";
this.pDesc.innerHTML = paramSummary;
}
appends.push(this.pParent.appendChild(this.pSave.cloneNode(true)));
if (!first) {
this.sParams.appendChild(document.createTextNode(", "));
}
first = false;
if (paramType) {
dojo.debug(this.sPTypeSave);
this.sPTypeSave.innerHTML = paramType;
this.sParams.appendChild(this.sPTypeSave.cloneNode(true));
this.sParams.appendChild(document.createTextNode(" "));
}
dojo.debug(this.sPNameSave);
this.sPNameSave.innerHTML = paramName;
this.sParams.appendChild(this.sPNameSave.cloneNode(true));
}
if (message.returns) {
this.sType.innerHTML = message.returns;
} else {
this.sType.innerHTML = "void";
}
this.sName.innerHTML = message.name;
this.domNode.appendChild(this.navSave);
this.domNode.appendChild(this.detailSave.cloneNode(true));
for (var i = 0, append; append = appends[i]; i++) {
dojo.html.removeNode(append);
}
}, onPkgResult:function (results) {
if (this.pkgEditor) {
this.pkgEditor.close(true);
dojo.debug(this.pkgDescription);
}
var methods = results.methods;
var requires = results.requires;
var description = results.description;
this._pkgPath = results.path;
var requireLinks = [];
var appends = this._appends;
while (appends.length) {
dojo.html.removeNode(appends.shift());
}
dojo.html.removeChildren(this.domNode);
this.pkg.innerHTML = results.pkg;
var hasRequires = false;
for (var env in requires) {
hasRequires = true;
this.rH3.style.display = "none";
if (env != "common") {
this.rH3.style.display = "";
this.rH3.innerHTML = env;
}
for (var i = 0, require; require = requires[env][i]; i++) {
requireLinks.push({name:require});
this.rLink.innerHTML = require;
this.rLink.href = "#" + require;
var rRow2 = this.rRow2.parentNode.insertBefore(this.rRow2.cloneNode(true), this.rRow2);
rRow2.style.display = "";
appends.push(rRow2);
}
var rRow = this.rRow.parentNode.insertBefore(this.rRow.cloneNode(true), this.rRow);
rRow.style.display = "";
appends.push(rRow);
}
if (hasRequires) {
appends.push(this.packageSave.appendChild(this.requires.cloneNode(true)));
}
if (results.size) {
for (var i = 0, method; method = methods[i]; i++) {
this.mLink.innerHTML = method.name;
this.mLink.href = "#" + method.name;
this.mDesc.parentNode.style.display = "none";
if (method.summary) {
this.mDesc.parentNode.style.display = "inline";
this.mDesc.innerHTML = method.summary;
}
var mRow = this.mRow.parentNode.insertBefore(this.mRow.cloneNode(true), this.mRow);
mRow.style.display = "";
appends.push(mRow);
}
appends.push(this.packageSave.appendChild(this.methods.cloneNode(true)));
}
this.domNode.appendChild(this.packageSave);
this.pkgDescription.innerHTML = description;
function makeSelect(fOrP, x) {
return function (e) {
dojo.event.topic.publish("/docs/" + fOrP + "/select", x);
};
}
var as = this.domNode.getElementsByTagName("a");
for (var i = 0, a; a = as[i]; i++) {
if (a.className == "docMLink") {
dojo.event.connect(a, "onclick", makeSelect("function", methods[i]));
} else {
if (a.className == "docRLink") {
dojo.event.connect(a, "onclick", makeSelect("package", requireLinks[i]));
}
}
}
}, onDocResults:function (fns) {
dojo.debug("onDocResults(): called");
if (fns.length == 1) {
dojo.event.topic.publish("/docs/function/select", fns[0]);
return;
}
dojo.html.removeChildren(this.domNode);
this.count.innerHTML = fns.length;
var appends = [];
for (var i = 0, fn; fn = fns[i]; i++) {
this.fnLink.innerHTML = fn.name;
this.fnLink.href = "#" + fn.name;
if (fn.id) {
this.fnLink.href = this.fnLink.href + "," + fn.id;
}
this.summary.parentNode.style.display = "none";
lib/HTML/Dojo/src.pm view on Meta::CPAN
this.pType.parentNode.style.display = "none";
if (parameters[param][0]) {
this.pType.parentNode.style.display = "inline";
this.pType.innerHTML = paramType;
}
this.pDesc.parentNode.style.display = "none";
if (paramSummary) {
this.pDesc.parentNode.style.display = "inline";
this.pDesc.innerHTML = paramSummary;
}
appends.push(this.pParent.appendChild(this.pSave.cloneNode(true)));
if (!first) {
this.sParams.appendChild(document.createTextNode(", "));
}
first = false;
if (paramType) {
dojo.debug(this.sPTypeSave);
this.sPTypeSave.innerHTML = paramType;
this.sParams.appendChild(this.sPTypeSave.cloneNode(true));
this.sParams.appendChild(document.createTextNode(" "));
}
dojo.debug(this.sPNameSave);
this.sPNameSave.innerHTML = paramName;
this.sParams.appendChild(this.sPNameSave.cloneNode(true));
}
if (message.returns) {
this.sType.innerHTML = message.returns;
} else {
this.sType.innerHTML = "void";
}
this.sName.innerHTML = message.name;
this.domNode.appendChild(this.navSave);
this.domNode.appendChild(this.detailSave.cloneNode(true));
for (var i = 0, append; append = appends[i]; i++) {
dojo.html.removeNode(append);
}
}, onPkgResult:function (results) {
if (this.pkgEditor) {
this.pkgEditor.close(true);
dojo.debug(this.pkgDescription);
}
var methods = results.methods;
var requires = results.requires;
var description = results.description;
this._pkgPath = results.path;
var requireLinks = [];
var appends = this._appends;
while (appends.length) {
dojo.html.removeNode(appends.shift());
}
dojo.html.removeChildren(this.domNode);
this.pkg.innerHTML = results.pkg;
var hasRequires = false;
for (var env in requires) {
hasRequires = true;
this.rH3.style.display = "none";
if (env != "common") {
this.rH3.style.display = "";
this.rH3.innerHTML = env;
}
for (var i = 0, require; require = requires[env][i]; i++) {
requireLinks.push({name:require});
this.rLink.innerHTML = require;
this.rLink.href = "#" + require;
var rRow2 = this.rRow2.parentNode.insertBefore(this.rRow2.cloneNode(true), this.rRow2);
rRow2.style.display = "";
appends.push(rRow2);
}
var rRow = this.rRow.parentNode.insertBefore(this.rRow.cloneNode(true), this.rRow);
rRow.style.display = "";
appends.push(rRow);
}
if (hasRequires) {
appends.push(this.packageSave.appendChild(this.requires.cloneNode(true)));
}
if (results.size) {
for (var i = 0, method; method = methods[i]; i++) {
this.mLink.innerHTML = method.name;
this.mLink.href = "#" + method.name;
this.mDesc.parentNode.style.display = "none";
if (method.summary) {
this.mDesc.parentNode.style.display = "inline";
this.mDesc.innerHTML = method.summary;
}
var mRow = this.mRow.parentNode.insertBefore(this.mRow.cloneNode(true), this.mRow);
mRow.style.display = "";
appends.push(mRow);
}
appends.push(this.packageSave.appendChild(this.methods.cloneNode(true)));
}
this.domNode.appendChild(this.packageSave);
this.pkgDescription.innerHTML = description;
function makeSelect(fOrP, x) {
return function (e) {
dojo.event.topic.publish("/docs/" + fOrP + "/select", x);
};
}
var as = this.domNode.getElementsByTagName("a");
for (var i = 0, a; a = as[i]; i++) {
if (a.className == "docMLink") {
dojo.event.connect(a, "onclick", makeSelect("function", methods[i]));
} else {
if (a.className == "docRLink") {
dojo.event.connect(a, "onclick", makeSelect("package", requireLinks[i]));
}
}
}
}, onDocResults:function (fns) {
dojo.debug("onDocResults(): called");
if (fns.length == 1) {
dojo.event.topic.publish("/docs/function/select", fns[0]);
return;
}
dojo.html.removeChildren(this.domNode);
this.count.innerHTML = fns.length;
var appends = [];
for (var i = 0, fn; fn = fns[i]; i++) {
this.fnLink.innerHTML = fn.name;
this.fnLink.href = "#" + fn.name;
if (fn.id) {
this.fnLink.href = this.fnLink.href + "," + fn.id;
}
this.summary.parentNode.style.display = "none";
( run in 2.317 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )