|
@@ -129,18 +129,11 @@ CCS.JFrame = new Class({
|
|
|
});
|
|
});
|
|
|
if(this.options.size) this.behavior.resize(this.options.size.width, this.options.size.height);
|
|
if(this.options.size) this.behavior.resize(this.options.size.width, this.options.size.height);
|
|
|
['attachKeys', 'detachKeys', 'addShortcut', 'addShortcuts', 'removeShortcut', 'removeShortcuts',
|
|
['attachKeys', 'detachKeys', 'addShortcut', 'addShortcuts', 'removeShortcut', 'removeShortcuts',
|
|
|
- 'applyDelegates', 'getScroller', 'getContentElement', 'invokeLinker'].each(function(method){
|
|
|
|
|
|
|
+ 'applyDelegates', 'getScroller', 'getContentElement', 'invokeLinker', 'configureRequest'].each(function(method){
|
|
|
this.behavior.passMethod(method, this[method].bind(this));
|
|
this.behavior.passMethod(method, this[method].bind(this));
|
|
|
}, this);
|
|
}, this);
|
|
|
this.behavior.passMethods({
|
|
this.behavior.passMethods({
|
|
|
getContainerSize: this.getCurrentSize.bind(this),
|
|
getContainerSize: this.getCurrentSize.bind(this),
|
|
|
- configureRequest: function(request){
|
|
|
|
|
- this._setRequestOptions(request, {
|
|
|
|
|
- onSuccess: function(nodes, elements, text){
|
|
|
|
|
- this._requestSuccessHandler(request, text);
|
|
|
|
|
- }.bind(this)
|
|
|
|
|
- });
|
|
|
|
|
- }.bind(this),
|
|
|
|
|
registerKeyboard: function(keyboard){
|
|
registerKeyboard: function(keyboard){
|
|
|
this.keyboard.manage(keyboard);
|
|
this.keyboard.manage(keyboard);
|
|
|
}.bind(this),
|
|
}.bind(this),
|
|
@@ -160,6 +153,19 @@ CCS.JFrame = new Class({
|
|
|
if (this.options.size) this.resize(this.options.size.width, this.options.size.height);
|
|
if (this.options.size) this.resize(this.options.size.width, this.options.size.height);
|
|
|
this.load({requestPath: path});
|
|
this.load({requestPath: path});
|
|
|
},
|
|
},
|
|
|
|
|
+
|
|
|
|
|
+ /*
|
|
|
|
|
+ configureRequest - configures a passed in request to be have its response rendered within JFrame..
|
|
|
|
|
+ request - (* request object *) request object to be configured
|
|
|
|
|
+ */
|
|
|
|
|
+ configureRequest: function(request){
|
|
|
|
|
+ this._setRequestOptions(request, {
|
|
|
|
|
+ onSuccess: function(nodes, elements, text){
|
|
|
|
|
+ this._requestSuccessHandler(request, text);
|
|
|
|
|
+ }.bind(this)
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
|
|
|
toElement: function(){
|
|
toElement: function(){
|
|
|
return this.element;
|
|
return this.element;
|
|
@@ -358,15 +364,16 @@ CCS.JFrame = new Class({
|
|
|
title - (*string*) the title of the content
|
|
title - (*string*) the title of the content
|
|
|
view - (*string*; optional) if defined, the view of the content
|
|
view - (*string*; optional) if defined, the view of the content
|
|
|
viewElement - (*element*; optional) if defined, the element for the view
|
|
viewElement - (*element*; optional) if defined, the element for the view
|
|
|
|
|
+ behavior - (*behavior object*; optional) if defined, the behavior instance to use
|
|
|
|
|
|
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
- fill: function(target, content){
|
|
|
|
|
|
|
+ fill: function(target, content, behavior){
|
|
|
target.empty().adopt(content.elements);
|
|
target.empty().adopt(content.elements);
|
|
|
if (content.links && content.links.length && this.options.includeLinkTags) target.adopt(content.links);
|
|
if (content.links && content.links.length && this.options.includeLinkTags) target.adopt(content.links);
|
|
|
if (this.options.evaluateJs && content.js) $exec(content.js);
|
|
if (this.options.evaluateJs && content.js) $exec(content.js);
|
|
|
this.applyDelegates(target);
|
|
this.applyDelegates(target);
|
|
|
- this.applyFilters(target, content);
|
|
|
|
|
|
|
+ this.applyFilters(target, content, behavior || this.behavior);
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
resize: function(x, y){
|
|
resize: function(x, y){
|
|
@@ -449,9 +456,10 @@ CCS.JFrame = new Class({
|
|
|
|
|
|
|
|
//Applies all the behavior filters for an element.
|
|
//Applies all the behavior filters for an element.
|
|
|
//element - (element) an element to apply the filters registered with this Behavior instance to.
|
|
//element - (element) an element to apply the filters registered with this Behavior instance to.
|
|
|
|
|
+ //behavior - (behavior object) behavior instance to use
|
|
|
//force - (boolean; optional) passed through to applyBehavior (see it for docs)
|
|
//force - (boolean; optional) passed through to applyBehavior (see it for docs)
|
|
|
- applyBehaviors: function(element, force){
|
|
|
|
|
- this.behavior.apply(element, force);
|
|
|
|
|
|
|
+ applyBehaviors: function(element, behavior, force){
|
|
|
|
|
+ behavior.apply(element, force);
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
//garbage collects all applied filters for the specified element
|
|
//garbage collects all applied filters for the specified element
|
|
@@ -463,14 +471,15 @@ CCS.JFrame = new Class({
|
|
|
applyFilters:
|
|
applyFilters:
|
|
|
container - (*element*) applies all the filters on this instance of jFrame to the contents of the container.
|
|
container - (*element*) applies all the filters on this instance of jFrame to the contents of the container.
|
|
|
content - (*object*) optional object containing various metadata about the content; js tags, meta tags, title, view, etc. See the "notes" section of the renderContent method comments in this file.
|
|
content - (*object*) optional object containing various metadata about the content; js tags, meta tags, title, view, etc. See the "notes" section of the renderContent method comments in this file.
|
|
|
-
|
|
|
|
|
|
|
+ behavior - (*behavior object*) optional behavior instance to be used for application of behaviors
|
|
|
|
|
+
|
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
- applyFilters: function(container, content){
|
|
|
|
|
- for (var name in this.filters) {
|
|
|
|
|
|
|
+ applyFilters: function(container, content, behavior){
|
|
|
|
|
+ for (var name in this.filters) {
|
|
|
this.applyFilter(name, container, content);
|
|
this.applyFilter(name, container, content);
|
|
|
}
|
|
}
|
|
|
- this.applyBehaviors(container);
|
|
|
|
|
|
|
+ this.applyBehaviors(container, behavior || this.behavior);
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
|
|
|