define("trapped/Trapped-Processors", ["amber/boot" //>>excludeStart("imports", pragmas.excludeImports); , "amber/jquery/Wrappers-JQuery", "jquery.xontent" //>>excludeEnd("imports"); , "trapped/Trapped-Frontend"], function($boot //>>excludeStart("imports", pragmas.excludeImports); //>>excludeEnd("imports"); ){"use strict"; var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals; $core.addPackage('Trapped-Processors'); $core.packages["Trapped-Processors"].innerEval = function (expr) { return eval(expr); }; $core.packages["Trapped-Processors"].imports = ["amber/jquery/Wrappers-JQuery", "jquery.xontent"]; $core.packages["Trapped-Processors"].transport = {"type":"amd","amdNamespace":"trapped"}; $core.addClass('TrappedProcessorAttribute', $globals.TrappedDataExpectingProcessor, ['attrName'], 'Trapped-Processors'); //>>excludeStart("ide", pragmas.excludeIdeData); $globals.TrappedProcessorAttribute.comment="I set the data into an attribute speciried when creating me.\x0aNo observing and sending back, atm."; //>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "attrName:", protocol: 'accessing', fn: function (aString){ var self=this; self["@attrName"]=aString; return self; }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "attrName: aString\x0a\x09attrName := aString", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.TrappedProcessorAttribute); $core.addMethod( $core.method({ selector: "toView:", protocol: 'data transformation', fn: function (aDataCarrier){ var self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); $recv(aDataCarrier)._toTargetAttr_(self["@attrName"]); return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"toView:",{aDataCarrier:aDataCarrier},$globals.TrappedProcessorAttribute)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aDataCarrier"], source: "toView: aDataCarrier\x0a\x09aDataCarrier toTargetAttr: attrName", referencedClasses: [], //>>excludeEnd("ide"); messageSends: ["toTargetAttr:"] }), $globals.TrappedProcessorAttribute); $core.addMethod( $core.method({ selector: "new:", protocol: 'instance creation', fn: function (aString){ var self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var $2,$3,$1; $2=self._new(); $recv($2)._attrName_(aString); $3=$recv($2)._yourself(); $1=$3; return $1; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"new:",{aString:aString},$globals.TrappedProcessorAttribute.klass)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "new: aString\x0a\x09^self new\x0a\x09\x09attrName: aString;\x0a\x09\x09yourself", referencedClasses: [], //>>excludeEnd("ide"); messageSends: ["attrName:", "new", "yourself"] }), $globals.TrappedProcessorAttribute.klass); $core.addClass('TrappedProcessorDataAdhoc', $globals.TrappedDataExpectingProcessor, ['toViewBlock'], 'Trapped-Processors'); //>>excludeStart("ide", pragmas.excludeIdeData); $globals.TrappedProcessorDataAdhoc.comment="I put data into target via contents: in toView:"; //>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "toView:", protocol: 'data transformation', fn: function (aDataCarrier){ var self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); $recv(self["@toViewBlock"])._value_(aDataCarrier); return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"toView:",{aDataCarrier:aDataCarrier},$globals.TrappedProcessorDataAdhoc)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aDataCarrier"], source: "toView: aDataCarrier\x0a\x09toViewBlock value: aDataCarrier", referencedClasses: [], //>>excludeEnd("ide"); messageSends: ["value:"] }), $globals.TrappedProcessorDataAdhoc); $core.addMethod( $core.method({ selector: "toViewBlock:", protocol: 'accessing', fn: function (aBlock){ var self=this; self["@toViewBlock"]=aBlock; return self; }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "toViewBlock: aBlock\x0a\x09toViewBlock := aBlock", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.TrappedProcessorDataAdhoc); $core.addMethod( $core.method({ selector: "newToView:", protocol: 'instance creation', fn: function (aBlock){ var self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var $2,$3,$1; $2=self._new(); $recv($2)._toViewBlock_(aBlock); $3=$recv($2)._yourself(); $1=$3; return $1; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"newToView:",{aBlock:aBlock},$globals.TrappedProcessorDataAdhoc.klass)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBlock"], source: "newToView: aBlock\x0a\x09^self new\x0a\x09\x09toViewBlock: aBlock;\x0a\x09\x09yourself", referencedClasses: [], //>>excludeEnd("ide"); messageSends: ["toViewBlock:", "new", "yourself"] }), $globals.TrappedProcessorDataAdhoc.klass); $core.addClass('TrappedProcessorDescend', $globals.TrappedProcessor, [], 'Trapped-Processors'); //>>excludeStart("ide", pragmas.excludeIdeData); $globals.TrappedProcessorDescend.comment="I intepret data-trap in descendants of my brush."; //>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "toView:", protocol: 'data transformation', fn: function (aDataCarrier){ var self=this; function $Trapped(){return $globals.Trapped||(typeof Trapped=="undefined"?nil:Trapped)} //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); $recv($recv($Trapped())._current())._injectToChildren_($recv($recv(aDataCarrier)._target())._element()); return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"toView:",{aDataCarrier:aDataCarrier},$globals.TrappedProcessorDescend)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aDataCarrier"], source: "toView: aDataCarrier\x0a\x09Trapped current injectToChildren: aDataCarrier target element", referencedClasses: ["Trapped"], //>>excludeEnd("ide"); messageSends: ["injectToChildren:", "current", "element", "target"] }), $globals.TrappedProcessorDescend); $core.addClass('TrappedProcessorGuardBase', $globals.TrappedProcessor, ['guardPath'], 'Trapped-Processors'); //>>excludeStart("ide", pragmas.excludeIdeData); $globals.TrappedProcessorGuardBase.comment="I serve as base class for brush-guarding processors.\x0a\x0aI cover instantiation and subclasses have to provide\x0aimplementation of toVIew: that react appropriately to guard releasing."; //>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "guardPath:", protocol: 'accessing', fn: function (anArray){ var self=this; self["@guardPath"]=anArray; return self; }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["anArray"], source: "guardPath: anArray\x0a\x09guardPath := anArray", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.TrappedProcessorGuardBase); $core.addMethod( $core.method({ selector: "toModel:", protocol: 'data transformation', fn: function (aDataCarrier){ var self=this; return self; }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aDataCarrier"], source: "toModel: aDataCarrier\x0a\x09\x22stop\x22", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.TrappedProcessorGuardBase); $core.addMethod( $core.method({ selector: "toView:", protocol: 'data transformation', fn: function (aDataCarrier){ var self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); self._subclassResponsibility(); return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"toView:",{aDataCarrier:aDataCarrier},$globals.TrappedProcessorGuardBase)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aDataCarrier"], source: "toView: aDataCarrier\x0a\x09self subclassResponsibility", referencedClasses: [], //>>excludeEnd("ide"); messageSends: ["subclassResponsibility"] }), $globals.TrappedProcessorGuardBase); $core.addMethod( $core.method({ selector: "new:", protocol: 'instance creation', fn: function (anArray){ var self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var $2,$3,$1; $2=self._new(); $recv($2)._guardPath_(anArray); $3=$recv($2)._yourself(); $1=$3; return $1; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"new:",{anArray:anArray},$globals.TrappedProcessorGuardBase.klass)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["anArray"], source: "new: anArray\x0a\x09^ self new\x0a\x09\x09guardPath: anArray;\x0a\x09\x09yourself", referencedClasses: [], //>>excludeEnd("ide"); messageSends: ["guardPath:", "new", "yourself"] }), $globals.TrappedProcessorGuardBase.klass); $core.addClass('TrappedProcessorGuard', $globals.TrappedProcessorGuardBase, [], 'Trapped-Processors'); //>>excludeStart("ide", pragmas.excludeIdeData); $globals.TrappedProcessorGuard.comment="I am used to guard contents filling process of the brush I am installed on.\x0a\x0aI observe guard expression in the model,\x0aand when it changes to nil or false, I delete the brush contents;\x0aon the other hand, when it changes to non-nil and non-false,\x0aI run the rest on the chain, which should be one-time\x0athat sets up the contents,"; //>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "toView:", protocol: 'data transformation', fn: function (aDataCarrier){ var self=this; var frozen,xon; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var $1,$2; frozen=$recv(aDataCarrier)._copy(); //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["copy"]=1; //>>excludeEnd("ctx"); xon=$recv(frozen)._xontent(); $recv($recv(frozen)._target())._trapGuard_contents_(self["@guardPath"],(function(html){ //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { //>>excludeEnd("ctx"); $1=$recv(frozen)._copy(); $recv($1)._target_($recv(html)._root()); $recv($1)._xontent_(xon); $2=$recv($1)._proceed(); return $2; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1,1)}); //>>excludeEnd("ctx"); })); return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"toView:",{aDataCarrier:aDataCarrier,frozen:frozen,xon:xon},$globals.TrappedProcessorGuard)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aDataCarrier"], source: "toView: aDataCarrier\x0a\x09| frozen xon |\x0a\x09frozen := aDataCarrier copy.\x0a\x09xon := frozen xontent.\x0a\x09frozen target trapGuard: guardPath contents: [ :html | frozen copy target: html root; xontent: xon; proceed ]", referencedClasses: [], //>>excludeEnd("ide"); messageSends: ["copy", "xontent", "trapGuard:contents:", "target", "target:", "root", "xontent:", "proceed"] }), $globals.TrappedProcessorGuard); $core.addClass('TrappedProcessorInputChecked', $globals.TrappedDataExpectingProcessor, [], 'Trapped-Processors'); //>>excludeStart("ide", pragmas.excludeIdeData); $globals.TrappedProcessorInputChecked.comment="I bind to checkbox checked state."; //>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "installToView:toModel:", protocol: 'installation', fn: function (aDataCarrier,anotherDataCarrier){ var self=this; var brush; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var $1,$2; brush=$recv(aDataCarrier)._target(); $recv(brush)._onChange_((function(){ //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { //>>excludeEnd("ctx"); $1=$recv(anotherDataCarrier)._copy(); $recv($1)._value_($recv($recv(brush)._asJQuery())._prop_("checked")); $2=$recv($1)._proceed(); return $2; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); //>>excludeEnd("ctx"); })); return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"installToView:toModel:",{aDataCarrier:aDataCarrier,anotherDataCarrier:anotherDataCarrier,brush:brush},$globals.TrappedProcessorInputChecked)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aDataCarrier", "anotherDataCarrier"], source: "installToView: aDataCarrier toModel: anotherDataCarrier\x0a\x09| brush |\x0a\x09brush := aDataCarrier target.\x0a\x09brush onChange: [ anotherDataCarrier copy value: (brush asJQuery prop: 'checked'); proceed ]", referencedClasses: [], //>>excludeEnd("ide"); messageSends: ["target", "onChange:", "value:", "copy", "prop:", "asJQuery", "proceed"] }), $globals.TrappedProcessorInputChecked); $core.addMethod( $core.method({ selector: "toView:", protocol: 'data transformation', fn: function (aDataCarrier){ var self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); $recv(aDataCarrier)._toTargetProp_("checked"); return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"toView:",{aDataCarrier:aDataCarrier},$globals.TrappedProcessorInputChecked)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aDataCarrier"], source: "toView: aDataCarrier\x0a\x09aDataCarrier toTargetProp: 'checked'", referencedClasses: [], //>>excludeEnd("ide"); messageSends: ["toTargetProp:"] }), $globals.TrappedProcessorInputChecked); $core.addClass('TrappedProcessorInputValue', $globals.TrappedDataExpectingProcessor, [], 'Trapped-Processors'); //>>excludeStart("ide", pragmas.excludeIdeData); $globals.TrappedProcessorInputValue.comment="I bind to input value."; //>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "installToView:toModel:", protocol: 'installation', fn: function (aDataCarrier,anotherDataCarrier){ var self=this; var brush; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var $1,$2; brush=$recv(aDataCarrier)._target(); $recv(brush)._onChange_((function(){ //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { //>>excludeEnd("ctx"); $1=$recv(anotherDataCarrier)._copy(); $recv($1)._value_($recv($recv(brush)._asJQuery())._val()); $2=$recv($1)._proceed(); return $2; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); //>>excludeEnd("ctx"); })); return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"installToView:toModel:",{aDataCarrier:aDataCarrier,anotherDataCarrier:anotherDataCarrier,brush:brush},$globals.TrappedProcessorInputValue)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aDataCarrier", "anotherDataCarrier"], source: "installToView: aDataCarrier toModel: anotherDataCarrier\x0a\x09| brush |\x0a\x09brush := aDataCarrier target.\x0a\x09brush onChange: [ anotherDataCarrier copy value: brush asJQuery val; proceed ]", referencedClasses: [], //>>excludeEnd("ide"); messageSends: ["target", "onChange:", "value:", "copy", "val", "asJQuery", "proceed"] }), $globals.TrappedProcessorInputValue); $core.addMethod( $core.method({ selector: "toView:", protocol: 'data transformation', fn: function (aDataCarrier){ var self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); $recv(aDataCarrier)._toTargetValue(); return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"toView:",{aDataCarrier:aDataCarrier},$globals.TrappedProcessorInputValue)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aDataCarrier"], source: "toView: aDataCarrier\x0a\x09aDataCarrier toTargetValue", referencedClasses: [], //>>excludeEnd("ide"); messageSends: ["toTargetValue"] }), $globals.TrappedProcessorInputValue); $core.addClass('TrappedProcessorLoopBase', $globals.TrappedProcessor, [], 'Trapped-Processors'); //>>excludeStart("ide", pragmas.excludeIdeData); $globals.TrappedProcessorLoopBase.comment="I serve as base class for looping processors.\x0a\x0aI cover instantiation and subclasses have to provide\x0aimplementation of toVIew: that loops appropriately."; //>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "toModel:", protocol: 'data transformation', fn: function (aDataCarrier){ var self=this; return self; }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aDataCarrier"], source: "toModel: aDataCarrier\x0a\x09\x22stop\x22", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.TrappedProcessorLoopBase); $core.addMethod( $core.method({ selector: "toView:", protocol: 'data transformation', fn: function (aDataCarrier){ var self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); self._subclassResponsibility(); return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"toView:",{aDataCarrier:aDataCarrier},$globals.TrappedProcessorLoopBase)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aDataCarrier"], source: "toView: aDataCarrier\x0a\x09self subclassResponsibility", referencedClasses: [], //>>excludeEnd("ide"); messageSends: ["subclassResponsibility"] }), $globals.TrappedProcessorLoopBase); $core.addClass('TrappedProcessorLoopZ', $globals.TrappedProcessorLoopBase, [], 'Trapped-Processors'); //>>excludeStart("ide", pragmas.excludeIdeData); $globals.TrappedProcessorLoopZ.comment="I am used to loop over data and repeat the contents filling process\x0aof the brush I am installed on.\x0a\x0aI observe the data in the model,\x0aand when it changes, I loop over it\x0aand run the rest of the processing chain\x0afor each element, putting the result _after_ my brush.\x0a\x0aMy brush itself should be as least visible as possible,\x0aas it only serve as a position flag (use for example\x0ascript type=application/x-beacon, noscript, ins or del)."; //>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "toView:", protocol: 'data transformation', fn: function (aDataCarrier){ var self=this; var frozen,xon; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var $1,$2; frozen=$recv(aDataCarrier)._copy(); //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["copy"]=1; //>>excludeEnd("ctx"); xon=$recv(frozen)._xontent(); $recv($recv(frozen)._target())._trapIter_after_([],(function(html){ //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { //>>excludeEnd("ctx"); $1=$recv(frozen)._copy(); $recv($1)._target_($recv(html)._root()); $recv($1)._xontent_(xon); $2=$recv($1)._proceed(); return $2; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1,1)}); //>>excludeEnd("ctx"); })); return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"toView:",{aDataCarrier:aDataCarrier,frozen:frozen,xon:xon},$globals.TrappedProcessorLoopZ)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aDataCarrier"], source: "toView: aDataCarrier\x0a\x09| frozen xon |\x0a\x09frozen := aDataCarrier copy.\x0a\x09xon := frozen xontent.\x0a\x09frozen target trapIter: #() after: [ :html | frozen copy target: html root; xontent: xon; proceed ]", referencedClasses: [], //>>excludeEnd("ide"); messageSends: ["copy", "xontent", "trapIter:after:", "target", "target:", "root", "xontent:", "proceed"] }), $globals.TrappedProcessorLoopZ); $core.addClass('TrappedProcessorOptionValue', $globals.TrappedDataExpectingProcessor, [], 'Trapped-Processors'); //>>excludeStart("ide", pragmas.excludeIdeData); $globals.TrappedProcessorOptionValue.comment="I set the option value.\x0a\x0aAdditionally, when changed (by toView:),\x0aI ping closest