| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Licensed to the Apache Software Foundation (ASF) under one | 2 * Licensed to the Apache Software Foundation (ASF) under one |
| 3 * or more contributor license agreements. See the NOTICE file | 3 * or more contributor license agreements. See the NOTICE file |
| 4 * distributed with this work for additional information | 4 * distributed with this work for additional information |
| 5 * regarding copyright ownership. The ASF licenses this file | 5 * regarding copyright ownership. The ASF licenses this file |
| 6 * to you under the Apache License, Version 2.0 (the | 6 * to you under the Apache License, Version 2.0 (the |
| 7 * "License"); you may not use this file except in compliance | 7 * "License"); you may not use this file except in compliance |
| 8 * with the License. You may obtain a copy of the License at | 8 * with the License. You may obtain a copy of the License at |
| 9 * | 9 * |
| 10 * http://www.apache.org/licenses/LICENSE-2.0 | 10 * http://www.apache.org/licenses/LICENSE-2.0 |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 } | 195 } |
| 196 } | 196 } |
| 197 }; | 197 }; |
| 198 | 198 |
| 199 /** | 199 /** |
| 200 * @return {JsEvalContext} the default rendering context to use - this will | 200 * @return {JsEvalContext} the default rendering context to use - this will |
| 201 * contain all available data. | 201 * contain all available data. |
| 202 */ | 202 */ |
| 203 os.Container.getDefaultContext = function() { | 203 os.Container.getDefaultContext = function() { |
| 204 if ((window['gadgets'] && gadgets.util.hasFeature('opensocial-data')) || | 204 if ((window['gadgets'] && gadgets.util.hasFeature('opensocial-data')) || |
| 205 (opensocial.data.getDataContext)) { | 205 (opensocial.data && opensocial.data.getDataContext)) { |
| 206 return os.createContext(opensocial.data.getDataContext().getData()); | 206 return os.createContext(opensocial.data.getDataContext().getData()); |
| 207 } | 207 } |
| 208 return os.createContext({}); | 208 return os.createContext({}); |
| 209 }; | 209 }; |
| 210 | 210 |
| 211 /** | 211 /** |
| 212 * Renders any registered inline templates. | 212 * Renders any registered inline templates. |
| 213 * @param {Object} opt_doc Optional document to use instead of window.document. | 213 * @param {Object} opt_doc Optional document to use instead of window.document. |
| 214 */ | 214 */ |
| 215 os.Container.renderInlineTemplates = function(opt_doc) { | 215 os.Container.renderInlineTemplates = function(opt_doc) { |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 return; | 369 return; |
| 370 } | 370 } |
| 371 if (params.disableAutoProcessing && | 371 if (params.disableAutoProcessing && |
| 372 params.disableAutoProcessing.toLowerCase != "false") { | 372 params.disableAutoProcessing.toLowerCase != "false") { |
| 373 os.Container.autoProcess_ = false; | 373 os.Container.autoProcess_ = false; |
| 374 } | 374 } |
| 375 | 375 |
| 376 // Honor the "requireLibrary" feature param. | 376 // Honor the "requireLibrary" feature param. |
| 377 // TODO: Support multiple params when Shindig does. | 377 // TODO: Support multiple params when Shindig does. |
| 378 if (params.requireLibrary) { | 378 if (params.requireLibrary) { |
| 379 os.Container.addRequiredLibrary(params.requireLibrary); | 379 if (typeof params.requireLibrary == "string") { |
| 380 os.Container.addRequiredLibrary(params.requireLibrary); |
| 381 } else { |
| 382 for (var i = 0; i < params.requireLibrary.length; i++) { |
| 383 os.Container.addRequiredLibrary(params.requireLibrary[i]); |
| 384 } |
| 385 } |
| 380 } | 386 } |
| 381 }; | 387 }; |
| 382 | 388 |
| 383 //Process the gadget when the page loads. | 389 //Process the gadget when the page loads. |
| 384 os.Container.executeOnDomLoad(os.Container.processGadget); | 390 os.Container.executeOnDomLoad(os.Container.processGadget); |
| 385 | 391 |
| 386 /** | 392 /** |
| 387 * A flag to determine if auto processing is waiting for libraries to load. | 393 * A flag to determine if auto processing is waiting for libraries to load. |
| 388 * @type {boolean} | 394 * @type {boolean} |
| 389 */ | 395 */ |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 if (tagParts.length == 2) { | 501 if (tagParts.length == 2) { |
| 496 var nsObj = os.getNamespace(tagParts[0]); | 502 var nsObj = os.getNamespace(tagParts[0]); |
| 497 if (!nsObj) { | 503 if (!nsObj) { |
| 498 // Auto Create a namespace for lazy registration. | 504 // Auto Create a namespace for lazy registration. |
| 499 nsObj = os.createNamespace(tagParts[0], null); | 505 nsObj = os.createNamespace(tagParts[0], null); |
| 500 } | 506 } |
| 501 nsObj[tagParts[1]] = os.createTemplateCustomTag(template); | 507 nsObj[tagParts[1]] = os.createTemplateCustomTag(template); |
| 502 } | 508 } |
| 503 } | 509 } |
| 504 }; | 510 }; |
| OLD | NEW |