@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Bring in JX.Workflow and the inline commenting behavior, plus sync Javelin.

+923 -235
+6 -6
conf/default.conf.php
··· 31 31 32 32 // The username to use when connecting to MySQL. 33 33 'mysql.user' => 'root', 34 - 34 + 35 35 // The password to use when connecting to MySQL. 36 36 'mysql.pass' => '', 37 - 37 + 38 38 // The MySQL server to connect to. 39 39 'mysql.host' => 'localhost', 40 40 ··· 56 56 57 57 // Is Recaptcha enabled? If disabled, captchas will not appear. 58 58 'recaptcha.enabled' => false, 59 - 59 + 60 60 // Your Recaptcha public key, obtained from Recaptcha. 61 61 'recaptcha.public-key' => null, 62 - 62 + 63 63 // Your Recaptcha private key, obtained from Recaptcha. 64 64 'recaptcha.private-key' => null, 65 65 66 66 67 67 'user.default-profile-image-phid' => 'PHID-FILE-f57aaefce707fc4060ef', 68 - 68 + 69 69 // When email is sent, try to hand it off to the MTA immediately. The only 70 70 // reason to disable this is if your MTA infrastructure is completely 71 71 // terrible. If you disable this option, you must run the 'metamta_mta.php' 72 72 // daemon or mail won't be handed off to the MTA. 73 73 'metamta.send-immediately' => true, 74 - 74 + 75 75 76 76 77 77 );
+17 -1
scripts/daemons/metamta/metamta_mta.php
··· 1 1 <?php 2 2 3 - // Placeholder so I don't forget about this, hopefully. 3 + /* 4 + * Copyright 2011 Facebook, Inc. 5 + * 6 + * Licensed under the Apache License, Version 2.0 (the "License"); 7 + * you may not use this file except in compliance with the License. 8 + * You may obtain a copy of the License at 9 + * 10 + * http://www.apache.org/licenses/LICENSE-2.0 11 + * 12 + * Unless required by applicable law or agreed to in writing, software 13 + * distributed under the License is distributed on an "AS IS" BASIS, 14 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 + * See the License for the specific language governing permissions and 16 + * limitations under the License. 17 + */ 18 + 19 + // Placeholder so I don't forget about this, hopefully.
+58 -21
src/__celerity_resource_map__.php
··· 9 9 celerity_register_resource_map(array( 10 10 'aphront-dialog-view-css' => 11 11 array( 12 - 'uri' => '/res/771b987d/rsrc/css/aphront/dialog-view.css', 12 + 'uri' => '/res/d98e6292/rsrc/css/aphront/dialog-view.css', 13 13 'type' => 'css', 14 14 'requires' => 15 15 array( ··· 188 188 ), 189 189 'disk' => '/rsrc/css/core/core.css', 190 190 ), 191 + 'phabricator-core-dialog-css' => 192 + array( 193 + 'uri' => '/res/d9580553/rsrc/css/core/dialog.css', 194 + 'type' => 'css', 195 + 'requires' => 196 + array( 197 + ), 198 + 'disk' => '/rsrc/css/core/dialog.css', 199 + ), 191 200 'phabricator-remarkup-css' => 192 201 array( 193 202 'uri' => '/res/786989c3/rsrc/css/core/remarkup.css', ··· 225 234 0 => 'javelin-lib-dev', 226 235 ), 227 236 'disk' => '/rsrc/js/application/differential/behavior-comment-preview.js', 237 + ), 238 + 'javelin-behavior-differential-edit-inline-comments' => 239 + array( 240 + 'uri' => '/res/51d7da98/rsrc/js/application/differential/behavior-edit-inline-comments.js', 241 + 'type' => 'js', 242 + 'requires' => 243 + array( 244 + 0 => 'javelin-lib-dev', 245 + ), 246 + 'disk' => '/rsrc/js/application/differential/behavior-edit-inline-comments.js', 228 247 ), 229 248 'javelin-behavior-differential-populate' => 230 249 array( ··· 246 265 ), 247 266 'disk' => '/rsrc/js/application/differential/behavior-show-more.js', 248 267 ), 249 - 'javelin-init-dev' => 268 + 'javelin-magical-init' => 250 269 array( 251 - 'uri' => '/res/c57a9e89/rsrc/js/javelin/init.dev.js', 270 + 'uri' => '/res/76614f84/rsrc/js/javelin/init.dev.js', 252 271 'type' => 'js', 253 272 'requires' => 254 273 array( ··· 257 276 ), 258 277 'javelin-init-prod' => 259 278 array( 260 - 'uri' => '/res/f0172c54/rsrc/js/javelin/init.min.js', 279 + 'uri' => '/res/ce6bff38/rsrc/js/javelin/init.min.js', 261 280 'type' => 'js', 262 281 'requires' => 263 282 array( ··· 266 285 ), 267 286 'javelin-lib-dev' => 268 287 array( 269 - 'uri' => '/res/3e747182/rsrc/js/javelin/javelin.dev.js', 288 + 'uri' => '/res/29c9b6b4/rsrc/js/javelin/javelin.dev.js', 270 289 'type' => 'js', 271 290 'requires' => 272 291 array( ··· 275 294 ), 276 295 'javelin-lib-prod' => 277 296 array( 278 - 'uri' => '/res/9438670e/rsrc/js/javelin/javelin.min.js', 297 + 'uri' => '/res/ef13c830/rsrc/js/javelin/javelin.min.js', 279 298 'type' => 'js', 280 299 'requires' => 281 300 array( ··· 284 303 ), 285 304 'javelin-typeahead-dev' => 286 305 array( 287 - 'uri' => '/res/c81c0f01/rsrc/js/javelin/typeahead.dev.js', 306 + 'uri' => '/res/6de6ae59/rsrc/js/javelin/typeahead.dev.js', 288 307 'type' => 'js', 289 308 'requires' => 290 309 array( ··· 293 312 ), 294 313 'javelin-typeahead-prod' => 295 314 array( 296 - 'uri' => '/res/1da2d984/rsrc/js/javelin/typeahead.min.js', 315 + 'uri' => '/res/593d9bb8/rsrc/js/javelin/typeahead.min.js', 297 316 'type' => 'js', 298 317 'requires' => 299 318 array( 300 319 ), 301 320 'disk' => '/rsrc/js/javelin/typeahead.min.js', 302 321 ), 322 + 'javelin-workflow-dev' => 323 + array( 324 + 'uri' => '/res/2d740661/rsrc/js/javelin/workflow.dev.js', 325 + 'type' => 'js', 326 + 'requires' => 327 + array( 328 + ), 329 + 'disk' => '/rsrc/js/javelin/workflow.dev.js', 330 + ), 331 + 'javelin-workflow-prod' => 332 + array( 333 + 'uri' => '/res/b758e0a0/rsrc/js/javelin/workflow.min.js', 334 + 'type' => 'js', 335 + 'requires' => 336 + array( 337 + ), 338 + 'disk' => '/rsrc/js/javelin/workflow.min.js', 339 + ), 303 340 ), array ( 304 341 'packages' => 305 342 array ( 306 - 'd348c79d' => 343 + 'dc2390af' => 307 344 array ( 308 345 'name' => 'core.pkg.css', 309 346 'symbols' => ··· 320 357 9 => 'aphront-typeahead-control-css', 321 358 10 => 'phabricator-directory-css', 322 359 ), 323 - 'uri' => '/res/pkg/d348c79d/core.pkg.css', 360 + 'uri' => '/res/pkg/dc2390af/core.pkg.css', 324 361 'type' => 'css', 325 362 ), 326 363 '69b11588' => ··· 340 377 ), 341 378 'reverse' => 342 379 array ( 343 - 'phabricator-core-css' => 'd348c79d', 344 - 'phabricator-core-buttons-css' => 'd348c79d', 345 - 'phabricator-standard-page-view' => 'd348c79d', 346 - 'aphront-dialog-view-css' => 'd348c79d', 347 - 'aphront-form-view-css' => 'd348c79d', 348 - 'aphront-panel-view-css' => 'd348c79d', 349 - 'aphront-side-nav-view-css' => 'd348c79d', 350 - 'aphront-table-view-css' => 'd348c79d', 351 - 'aphront-tokenizer-control-css' => 'd348c79d', 352 - 'aphront-typeahead-control-css' => 'd348c79d', 353 - 'phabricator-directory-css' => 'd348c79d', 380 + 'phabricator-core-css' => 'dc2390af', 381 + 'phabricator-core-buttons-css' => 'dc2390af', 382 + 'phabricator-standard-page-view' => 'dc2390af', 383 + 'aphront-dialog-view-css' => 'dc2390af', 384 + 'aphront-form-view-css' => 'dc2390af', 385 + 'aphront-panel-view-css' => 'dc2390af', 386 + 'aphront-side-nav-view-css' => 'dc2390af', 387 + 'aphront-table-view-css' => 'dc2390af', 388 + 'aphront-tokenizer-control-css' => 'dc2390af', 389 + 'aphront-typeahead-control-css' => 'dc2390af', 390 + 'phabricator-directory-css' => 'dc2390af', 354 391 'differential-core-view-css' => '69b11588', 355 392 'differential-changeset-view-css' => '69b11588', 356 393 'differential-revision-detail-css' => '69b11588',
+2
src/__phutil_library_map__.php
··· 90 90 'DifferentialDiffTableOfContentsView' => 'applications/differential/view/difftableofcontents', 91 91 'DifferentialDiffViewController' => 'applications/differential/controller/diffview', 92 92 'DifferentialHunk' => 'applications/differential/storage/hunk', 93 + 'DifferentialInlineComment' => 'applications/differential/storage/inlinecomment', 93 94 'DifferentialLintStatus' => 'applications/differential/constants/lintstatus', 94 95 'DifferentialMail' => 'applications/differential/mail/base', 95 96 'DifferentialMarkupEngineFactory' => 'applications/differential/parser/markup', ··· 264 265 'DifferentialDiffTableOfContentsView' => 'AphrontView', 265 266 'DifferentialDiffViewController' => 'DifferentialController', 266 267 'DifferentialHunk' => 'DifferentialDAO', 268 + 'DifferentialInlineComment' => 'DifferentialDAO', 267 269 'DifferentialNewDiffMail' => 'DifferentialReviewRequestMail', 268 270 'DifferentialReviewRequestMail' => 'DifferentialMail', 269 271 'DifferentialRevision' => 'DifferentialDAO',
+2
src/applications/differential/controller/revisionview/DifferentialRevisionViewController.php
··· 79 79 80 80 $changeset_view = new DifferentialChangesetListView(); 81 81 $changeset_view->setChangesets($changesets); 82 + $changeset_view->setEditable(true); 83 + $changeset_view->setRevision($revision); 82 84 83 85 $comment_form = new DifferentialAddCommentView(); 84 86 $comment_form->setRevision($revision);
+33
src/applications/differential/storage/inlinecomment/DifferentialInlineComment.php
··· 1 + <?php 2 + 3 + /* 4 + * Copyright 2011 Facebook, Inc. 5 + * 6 + * Licensed under the Apache License, Version 2.0 (the "License"); 7 + * you may not use this file except in compliance with the License. 8 + * You may obtain a copy of the License at 9 + * 10 + * http://www.apache.org/licenses/LICENSE-2.0 11 + * 12 + * Unless required by applicable law or agreed to in writing, software 13 + * distributed under the License is distributed on an "AS IS" BASIS, 14 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 + * See the License for the specific language governing permissions and 16 + * limitations under the License. 17 + */ 18 + 19 + class DifferentialInlineComment extends DifferentialDAO { 20 + 21 + protected $revisionID; 22 + protected $commentID; 23 + protected $authorPHID; 24 + 25 + protected $changesetID; 26 + protected $isNewFile; 27 + 28 + protected $lineNumber; 29 + protected $lineLength; 30 + 31 + protected $content; 32 + 33 + }
+12
src/applications/differential/storage/inlinecomment/__init__.php
··· 1 + <?php 2 + /** 3 + * This file is automatically generated. Lint this module to rebuild it. 4 + * @generated 5 + */ 6 + 7 + 8 + 9 + phutil_require_module('phabricator', 'applications/differential/storage/base'); 10 + 11 + 12 + phutil_require_source('DifferentialInlineComment.php');
+17 -11
src/applications/differential/view/changesetlistview/DifferentialChangesetListView.php
··· 19 19 class DifferentialChangesetListView extends AphrontView { 20 20 21 21 private $changesets = array(); 22 + private $editable; 23 + private $revision; 22 24 23 25 public function setChangesets($changesets) { 24 26 $this->changesets = $changesets; 27 + return $this; 28 + } 29 + 30 + public function setEditable($editable) { 31 + $this->editable = $editable; 32 + return $this; 33 + } 34 + 35 + public function setRevision(DifferentialRevision $revision) { 36 + $this->revision = $revision; 25 37 return $this; 26 38 } 27 39 ··· 105 117 Javelin::initBehavior('differential-show-more', array( 106 118 'uri' => '/differential/changeset/', 107 119 )); 108 - /* 109 120 110 - 111 - Javelin::initBehavior('differential-context', array( 112 - 'uri' => $render_uri, 113 - )); 114 - 115 - if ($edit) { 116 - require_static('remarkup-css'); 117 - Javelin::initBehavior('differential-inline', array( 118 - 'uri' => '/differential/feedback/'.$revision->getID().'/', 121 + if ($this->editable) { 122 + $revision = $this->revision; 123 + Javelin::initBehavior('differential-edit-inline-comments', array( 124 + 'uri' => '/differential/inline/edit/'.$revision->getID().'/', 119 125 )); 120 126 } 121 - */ 127 + 122 128 return 123 129 '<div class="differential-review-stage">'. 124 130 implode("\n", $output).
+8 -8
src/applications/metamta/storage/mail/PhabricatorMetaMTAMail.php
··· 114 114 $this->setParam('simulated-failures', $count); 115 115 return $this; 116 116 } 117 - 117 + 118 118 public function save() { 119 119 $try_send = (PhabricatorEnv::getEnvConfig('metamta.send-immediately')) && 120 120 (!$this->getID()); 121 - 121 + 122 122 $ret = parent::save(); 123 - 123 + 124 124 if ($try_send) { 125 125 $mailer = new PhabricatorMailImplementationPHPMailerLiteAdapter(); 126 126 $this->sendNow($force_send = false, $mailer); 127 127 } 128 - 128 + 129 129 return $ret; 130 130 } 131 - 131 + 132 132 133 133 public function sendNow( 134 134 $force_send = false, ··· 143 143 throw new Exception("Trying to send an email before next retry!"); 144 144 } 145 145 } 146 - 146 + 147 147 try { 148 148 $parameters = $this->parameters; 149 149 $phids = array(); ··· 161 161 break; 162 162 } 163 163 } 164 - 164 + 165 165 $handles = id(new PhabricatorObjectHandleData($phids)) 166 166 ->loadHandles(); 167 - 167 + 168 168 foreach ($this->parameters as $key => $value) { 169 169 switch ($key) { 170 170 case 'from':
+3
src/applications/metamta/storage/mail/__init__.php
··· 6 6 7 7 8 8 9 + phutil_require_module('phabricator', 'applications/metamta/adapter/phpmailerlite'); 9 10 phutil_require_module('phabricator', 'applications/metamta/storage/base'); 11 + phutil_require_module('phabricator', 'applications/phid/handle/data'); 12 + phutil_require_module('phabricator', 'infrastructure/env'); 10 13 11 14 phutil_require_module('phutil', 'utils'); 12 15
+3 -10
src/infrastructure/javelin/markup/markup.php
··· 24 24 if (isset($attributes['sigil']) || 25 25 isset($attributes['meta']) || 26 26 isset($attributes['mustcapture'])) { 27 - $classes = array(); 28 27 foreach ($attributes as $k => $v) { 29 28 switch ($k) { 30 29 case 'sigil': 31 - $classes[] = 'FN_'.$v; 30 + $attributes['data-sigil'] = $v; 32 31 unset($attributes[$k]); 33 32 break; 34 33 case 'meta': 35 34 $response = CelerityAPI::getStaticResourceResponse(); 36 35 $id = $response->addMetadata($v); 37 - $classes[] = 'FD_'.$id; 36 + $attributes['data-meta'] = $id; 38 37 unset($attributes[$k]); 39 38 break; 40 39 case 'mustcapture': 41 - $classes[] = 'FI_CAPTURE'; 40 + $attributes['data-mustcapture'] = '1'; 42 41 unset($attributes[$k]); 43 42 break; 44 43 } 45 44 } 46 - 47 - if (isset($attributes['class'])) { 48 - $classes[] = $attributes['class']; 49 - } 50 - 51 - $attributes['class'] = implode(' ', $classes); 52 45 } 53 46 54 47 return phutil_render_tag($tag, $attributes, $content);
+2 -1
src/view/dialog/AphrontDialogView.php
··· 68 68 'Cancel'); 69 69 } 70 70 71 - return phutil_render_tag( 71 + return javelin_render_tag( 72 72 'form', 73 73 array( 74 74 'class' => 'aphront-dialog-view', 75 75 'action' => $this->submitURI, 76 76 'method' => 'post', 77 + 'sigil' => 'jx-dialog', 77 78 ), 78 79 '<input type="hidden" name="__form__" value="1" />'. 79 80 '<div class="aphront-dialog-head">'.
+1
src/view/dialog/__init__.php
··· 7 7 8 8 9 9 phutil_require_module('phabricator', 'infrastructure/celerity/api'); 10 + phutil_require_module('phabricator', 'infrastructure/javelin/markup'); 10 11 phutil_require_module('phabricator', 'view/base'); 11 12 12 13 phutil_require_module('phutil', 'markup');
+1
src/view/page/standard/PhabricatorStandardPageView.php
··· 70 70 require_celerity_resource('phabricator-standard-page-view'); 71 71 72 72 require_celerity_resource('javelin-lib-dev'); 73 + require_celerity_resource('javelin-workflow-dev'); 73 74 74 75 $this->bodyContent = $this->renderChildren(); 75 76 }
+20 -2
webroot/rsrc/css/aphront/dialog-view.css
··· 2 2 * @provides aphront-dialog-view-css 3 3 */ 4 4 5 - 6 - 7 5 .aphront-dialog-view { 8 6 width: 480px; 9 7 padding: 8px; ··· 40 38 margin-left: .5em; 41 39 } 42 40 41 + .jx-client-dialog { 42 + position: absolute; 43 + z-index: 6; 44 + } 45 + 46 + .jx-mask { 47 + opacity: .5; 48 + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=75)"; 49 + filter: alpha(opacity=75); 50 + background: #999; 51 + position: absolute; 52 + z-index: 5; 53 + top: 0; 54 + left: 0; 55 + right: 0; 56 + bottom: 0; 57 + width: 100%; 58 + height: 100%; 59 + min-height: 100%; 60 + }
+11
webroot/rsrc/css/application/differential/changeset-view.css
··· 119 119 margin: 0.5em 0; 120 120 padding: 10px 0px 20px; 121 121 } 122 + 123 + .differential-reticle { 124 + background: #ffeeaa; 125 + border: 1px solid #ffcc00; 126 + position: absolute; 127 + z-index: 2; 128 + opacity: 0.5; 129 + top: 0px; 130 + left: 0px; 131 + } 132 +
+55
webroot/rsrc/css/core/dialog.css
··· 1 + /** 2 + * @provides phabricator-core-dialog-css 3 + */ 4 + 5 + .jx-dialog { 6 + display: block; 7 + width: 480px; 8 + padding: 8px; 9 + background: #666; 10 + margin: auto; 11 + } 12 + 13 + .jx-client-dialog { 14 + position: absolute; 15 + z-index: 6; 16 + } 17 + 18 + .jx-dialog .dialog-title { 19 + background: #6d84b4; 20 + border: none; 21 + font-size: 15px; 22 + font-weight: bold; 23 + padding: 5px 12px 6px; 24 + color: #ffffff; 25 + } 26 + .jx-dialog .dialog-body { 27 + background: #ffffff; 28 + padding: 16px 12px; 29 + border: none; 30 + overflow: hidden; 31 + } 32 + 33 + .jx-dialog .dialog-foot { 34 + border: none; 35 + background: #ededed; 36 + padding: .5em; 37 + text-align: right; 38 + } 39 + 40 + .jx-dialog button { 41 + margin-left: 6px; 42 + } 43 + 44 + .jx-dialog input { 45 + padding: 4px; 46 + } 47 + 48 + .jx-dialog .fields { 49 + margin-top: 10px; 50 + } 51 + 52 + .jx-dialog input.block { 53 + display: block; 54 + margin: 3px 0 0 0; 55 + }
+229
webroot/rsrc/js/application/differential/behavior-edit-inline-comments.js
··· 1 + /** 2 + * @provides javelin-behavior-differential-edit-inline-comments 3 + * @requires javelin-lib-dev 4 + */ 5 + 6 + JX.behavior('differential-edit-inline-comments', function(config) { 7 + 8 + var selecting = false; 9 + var reticle = JX.$N('div', {className: 'differential-reticle'}); 10 + JX.DOM.hide(reticle); 11 + document.body.appendChild(reticle); 12 + 13 + var origin = null; 14 + var target = null; 15 + var root = null; 16 + var changeset = null; 17 + var workflow = false; 18 + var is_new = false; 19 + 20 + function updateReticle() { 21 + var top = origin; 22 + var bot = target; 23 + if (JX.$V(top).y > JX.$V(bot).y) { 24 + var tmp = top; 25 + top = bot; 26 + bot = tmp; 27 + } 28 + 29 + var code = target.nextSibling; 30 + 31 + var pos = JX.$V(top).add(1 + JX.$V.getDim(target).x, 0); 32 + var dim = JX.$V.getDim(code).add(-4, 0); 33 + dim.y = (JX.$V(bot).y - pos.y) + JX.$V.getDim(bot).y; 34 + 35 + pos.setPos(reticle); 36 + dim.setDim(reticle); 37 + 38 + JX.DOM.show(reticle); 39 + } 40 + 41 + function hideReticle() { 42 + JX.DOM.hide(reticle); 43 + } 44 + 45 + function finishSelect() { 46 + selecting = false; 47 + workflow = false; 48 + hideReticle(); 49 + } 50 + 51 + function drawInlineComment(table, anchor, r) { 52 + copyRows(table, JX.$N('div', JX.HTML(r.markup)), anchor); 53 + finishSelect(); 54 + } 55 + 56 + function isNewFile(node) { 57 + return node.parentNode.firstChild != node; 58 + } 59 + 60 + function getRowNumber(th_node) { 61 + try { 62 + return parseInt(th_node.id.match(/^C\d+[ON]L(\d+)$/)[1], 10); 63 + } catch (x) { 64 + return undefined; 65 + } 66 + } 67 + 68 + JX.Stratcom.listen( 69 + 'mousedown', 70 + ['differential-changeset', 'tag:th'], 71 + function(e) { 72 + if (workflow || 73 + selecting || 74 + getRowNumber(e.getTarget()) === undefined) { 75 + return; 76 + } 77 + 78 + selecting = true; 79 + root = e.getNode('differential-changeset'); 80 + 81 + origin = target = e.getTarget(); 82 + 83 + var data = e.getNodeData('differential-changeset'); 84 + if (isNewFile(target)) { 85 + changeset = data.oid; 86 + } else { 87 + changeset = data.nid; 88 + } 89 + 90 + updateReticle(); 91 + 92 + e.kill(); 93 + }); 94 + 95 + JX.Stratcom.listen( 96 + 'mouseover', 97 + ['differential-changeset', 'tag:th'], 98 + function(e) { 99 + if (!selecting || 100 + workflow || 101 + (getRowNumber(e.getTarget()) === undefined) || 102 + (isNewFile(e.getTarget()) != isNewFile(origin)) || 103 + (e.getNode('differential-changeset') !== root)) { 104 + return; 105 + } 106 + 107 + target = e.getTarget(); 108 + 109 + updateReticle(); 110 + }); 111 + 112 + JX.Stratcom.listen( 113 + 'mouseup', 114 + null, 115 + function(e) { 116 + if (workflow || !selecting) { 117 + return; 118 + } 119 + 120 + var o = getRowNumber(origin); 121 + var t = getRowNumber(target); 122 + 123 + var insert; 124 + var len; 125 + if (t < o) { 126 + len = (o - t); 127 + o = t; 128 + insert = origin.parentNode; 129 + } else { 130 + len = (t - o); 131 + insert = target.parentNode; 132 + } 133 + 134 + var data = { 135 + op: 'new', 136 + changeset: changeset, 137 + number: o, 138 + length: len, 139 + is_new: isNewFile(target) ? 1 : 0 140 + }; 141 + 142 + workflow = true; 143 + 144 + var w = new JX.Workflow(config.uri, data) 145 + .setHandler(function(r) { 146 + // Skip over any rows which contain inline feedback. Don't mimic this! 147 + // We're shipping around raw HTML here for performance reasons, but 148 + // normally you should use sigils to encode this kind of data on 149 + // the document. 150 + var target = insert.nextSibling; 151 + while (target && 152 + (!JX.DOM.isType(target, 'tr') 153 + || target.className.indexOf('inline') !== -1)) { 154 + target = target.nextSibling; 155 + } 156 + drawInlineComment(insert.parentNode, target, r); 157 + finishSelect(); 158 + JX.Stratcom.invoke('inline-comment-update', 159 + null, 160 + {id : r.inlineCommentID}); 161 + }) 162 + .setCloseHandler(finishSelect); 163 + 164 + 165 + w.listen('error', function(e) { 166 + // TODO: uh, tell the user I guess 167 + finishSelect(); 168 + JX.Stratcom.context().stop(); 169 + }); 170 + 171 + w.start(); 172 + 173 + e.kill(); 174 + }); 175 + 176 + JX.Stratcom.listen( 177 + ['mouseover', 'mouseout'], 178 + 'inline-comment', 179 + function(e) { 180 + if (selecting || workflow) { 181 + return; 182 + } 183 + 184 + if (e.getType() == 'mouseout') { 185 + hideReticle(); 186 + } else { 187 + var data = e.getNodeData('inline-comment'); 188 + var change = e.getNodeData('differential-changeset'); 189 + 190 + root = e.getNode('differential-changeset'); 191 + 192 + var prefix = 'C' + change; 193 + 194 + if (data.is_new) { 195 + prefix += 'NL'; 196 + } else { 197 + prefix += 'OL'; 198 + } 199 + 200 + origin = JX.$(prefix + data.number); 201 + target = JX.$(prefix + (data.number + data.length)); 202 + 203 + updateReticle(); 204 + } 205 + }); 206 + 207 + JX.Stratcom.listen( 208 + 'click', 209 + [['inline-comment', 'delete'], 210 + ['inline-comment', 'edit']], 211 + function(e) { 212 + var data = { 213 + op: e.getNode('edit') ? 'edit' : 'delete', 214 + id: e.getNodeData('inline-comment').id 215 + }; 216 + new JX.Workflow(config.uri, data) 217 + .setHandler(function(r) { 218 + var base_row = e.getNode('inline-comment').parentNode.parentNode; 219 + if (data.op == 'edit' && r.markup) { 220 + drawInlineComment(base_row.parentNode, base_row, r); 221 + } 222 + JX.DOM.remove(base_row); 223 + JX.Stratcom.invoke('differential-inline-comment-update'); 224 + }) 225 + .start(); 226 + e.kill(); 227 + }); 228 + 229 + });
+2 -3
webroot/rsrc/js/javelin/init.dev.js
··· 1 - /** @provides javelin-init-dev */ 2 1 /** 3 2 * Javelin core; installs Javelin and Stratcom event delegation. 4 3 * ··· 30 29 31 30 JX.__rawEventQueue = function(what) { 32 31 master_event_queue.push(what); 33 - 34 32 35 33 // Evade static analysis - JX.Stratcom 36 34 var Stratcom = JX['Stratcom']; ··· 63 61 var target = what.srcElement || what.target; 64 62 if (target && 65 63 (what.type in {click: 1, submit: 1}) && 66 - (/ FI_CAPTURE /).test(' ' + target.className + ' ')) { 64 + target.getAttribute && 65 + target.getAttribute('data-mustcapture') === '1') { 67 66 what.returnValue = false; 68 67 what.preventDefault && what.preventDefault(); 69 68 document.body.id = 'event_capture';
+1 -1
webroot/rsrc/js/javelin/init.min.js
··· 1 1 /** @provides javelin-init-prod */ 2 - (function(){if(window.JX)return;window.JX={};window.__DEV__=window.__DEV__||0;var d=false;var f=[];var e=[];var h=document.documentElement;var b=!!h.addEventListener;JX.__rawEventQueue=function(o){e.push(o);var j=JX.Stratcom;if(j&&j.ready){var m=e;e=[];for(var l=0;l<m.length;++l){var k=m[l];try{var test=k.type;}catch(p){continue;}if(!d&&k.type=='domready'){document.body&&(document.body.id=null);d=true;for(var l=0;l<f.length;l++)f[l]();}j.dispatch(k);}}else{var n=o.srcElement||o.target;if(n&&(o.type in {click:1,submit:1})&&(/ FI_CAPTURE /).test(' '+n.className+' ')){o.returnValue=false;o.preventDefault&&o.preventDefault();document.body.id='event_capture';if(!add_event_listener&&document.createEventObject){e.pop();e.push(document.createEventObject(o));}return false;}}};JX.enableDispatch=function(j,k){if(j.addEventListener){j.addEventListener(k,JX.__rawEventQueue,true);}else if(j.attachEvent)j.attachEvent('on'+k,JX.__rawEventQueue);};var a=['click','change','keypress','mousedown','mouseover','mouseout','mouseup','keydown','drop','dragenter','dragleave','dragover'];if(!b)a.push('focusin','focusout');if(window.opera){a.push('focus','blur');}else a.push('submit');for(var c=0;c<a.length;++c)JX.enableDispatch(h,a[c]);var i=[('onpagehide' in window)?'pagehide':'unload','resize','focus','blur'];for(var c=0;c<i.length;++c)JX.enableDispatch(window,i[c]);JX.__simulate=function(k,event){if(!b){var j={target:k,type:event};JX.__rawEventQueue(j);if(j.returnValue===false)return false;}};if(b){document.addEventListener('DOMContentLoaded',function(){JX.__rawEventQueue({type:'domready'});},true);}else{var g="if (this.readyState == 'complete') {"+"JX.__rawEventQueue({type: 'domready'});"+"}";document.write('<script'+' defer="defer"'+' src="javascript:void(0)"'+' onreadystatechange="'+g+'"'+'><\/sc'+'ript\>');}JX.onload=function(j){if(d){j();}else f.push(j);};})(); 2 + (function(){if(window.JX)return;window.JX={};window.__DEV__=window.__DEV__||0;var d=false;var f=[];var e=[];var h=document.documentElement;var b=!!h.addEventListener;JX.__rawEventQueue=function(o){e.push(o);var j=JX.Stratcom;if(j&&j.ready){var m=e;e=[];for(var l=0;l<m.length;++l){var k=m[l];try{var test=k.type;}catch(p){continue;}if(!d&&k.type=='domready'){document.body&&(document.body.id=null);d=true;for(var l=0;l<f.length;l++)f[l]();}j.dispatch(k);}}else{var n=o.srcElement||o.target;if(n&&(o.type in {click:1,submit:1})&&n.getAttribute&&n.getAttribute('data-mustcapture')==='1'){o.returnValue=false;o.preventDefault&&o.preventDefault();document.body.id='event_capture';if(!add_event_listener&&document.createEventObject){e.pop();e.push(document.createEventObject(o));}return false;}}};JX.enableDispatch=function(j,k){if(j.addEventListener){j.addEventListener(k,JX.__rawEventQueue,true);}else if(j.attachEvent)j.attachEvent('on'+k,JX.__rawEventQueue);};var a=['click','change','keypress','mousedown','mouseover','mouseout','mouseup','keydown','drop','dragenter','dragleave','dragover'];if(!b)a.push('focusin','focusout');if(window.opera){a.push('focus','blur');}else a.push('submit');for(var c=0;c<a.length;++c)JX.enableDispatch(h,a[c]);var i=[('onpagehide' in window)?'pagehide':'unload','resize','focus','blur'];for(var c=0;c<i.length;++c)JX.enableDispatch(window,i[c]);JX.__simulate=function(k,event){if(!b){var j={target:k,type:event};JX.__rawEventQueue(j);if(j.returnValue===false)return false;}};if(b){document.addEventListener('DOMContentLoaded',function(){JX.__rawEventQueue({type:'domready'});},true);}else{var g="if (this.readyState == 'complete') {"+"JX.__rawEventQueue({type: 'domready'});"+"}";document.write('<script'+' defer="defer"'+' src="javascript:void(0)"'+' onreadystatechange="'+g+'"'+'><\/sc'+'ript\>');}JX.onload=function(j){if(d){j();}else f.push(j);};})();
+144 -131
webroot/rsrc/js/javelin/javelin.dev.js
··· 824 824 * } 825 825 * }); 826 826 * 827 - * 828 827 * @return string|null ##null## if there is no associated special key, 829 828 * or one of the strings 'delete', 'tab', 'return', 830 829 * 'esc', 'left', 'up', 'right', or 'down'. ··· 836 835 return null; 837 836 } 838 837 839 - var c = r.keyCode; 840 - do { 841 - c = JX.Event._keymap[c] || null; 842 - } while (c && JX.Event._keymap[c]) 843 - 844 - return c; 838 + return JX.Event._keymap[r.keyCode] || null; 845 839 }, 840 + 846 841 847 842 /** 848 843 * Get the node corresponding to the specified key in this event's node map. ··· 850 845 * less ugly. 851 846 * 852 847 * JX.Stratcom.listen('click', 'tag:a', function(e) { 853 - * var a = e.getNode('nearest:a'); 848 + * var a = e.getNode('tag:a'); 854 849 * // do something with the link that was clicked 855 850 * }); 856 851 * ··· 862 857 * - sigil - first node of each sigil 863 858 * @task info 864 859 */ 865 - getNode: function(key) { 860 + getNode : function(key) { 866 861 return this.getNodes()[key] || null; 862 + }, 863 + 864 + 865 + /** 866 + * Get the metadata associated with the node that corresponds to the key 867 + * in this event's node map. This is a simple helper method that makes 868 + * the API for accessing metadata associated with specific nodes less ugly. 869 + * 870 + * JX.Stratcom.listen('click', 'tag:a', function(event) { 871 + * var anchorData = event.getNodeData('tag:a'); 872 + * // do something with the metadata of the link that was clicked 873 + * }); 874 + * 875 + * @param string sigil or stratcom node key 876 + * @return dict dictionary of the node's metadata 877 + * @task info 878 + */ 879 + getNodeData : function(key) { 880 + // Evade static analysis - JX.Stratcom 881 + return JX['Stratcom'].getData(this.getNode(key)); 867 882 } 868 - 869 883 }, 870 884 871 885 statics : { ··· 878 892 38 : 'up', 879 893 39 : 'right', 880 894 40 : 'down', 881 - 63232 : 38, 882 - 63233 : 40, 883 - 62234 : 37, 884 - 62235 : 39 895 + 63232 : 'up', 896 + 63233 : 'down', 897 + 62234 : 'left', 898 + 62235 : 'right' 885 899 } 886 900 }, 887 901 ··· 1008 1022 * @task listen Listening to Events 1009 1023 * @task handle Responding to Events 1010 1024 * @task sigil Managing Sigils 1025 + * @task meta Managing Metadata 1011 1026 * @task internal Internals 1012 1027 */ 1013 1028 JX.install('Stratcom', { ··· 1016 1031 _targets : {}, 1017 1032 _handlers : [], 1018 1033 _need : {}, 1019 - _matchName : /\bFN_([^ ]+)/, 1020 - _matchData : /\bFD_([^ ]+)_([^ ]+)/, 1021 1034 _auto : '*', 1022 1035 _data : {}, 1023 1036 _execContext : [], ··· 1039 1052 1040 1053 /** 1041 1054 * Within each datablock, data is identified by a unique index. The data 1042 - * pointer on a node looks like this: 1055 + * pointer (data-meta attribute) on a node looks like this: 1043 1056 * 1044 - * FD_1_2 1057 + * 1_2 1045 1058 * 1046 1059 * ...where 1 is the block, and 2 is the index within that block. Normally, 1047 1060 * blocks are filled on the server side, so index allocation takes place 1048 - * there. However, when data is provided with JX.Stratcom.sigilize(), we 1061 + * there. However, when data is provided with JX.Stratcom.addData(), we 1049 1062 * need to allocate indexes on the client. 1050 1063 */ 1051 1064 _dataIndex : 0, ··· 1185 1198 if (path[kk] == 'tag:#document') { 1186 1199 throw new Error( 1187 1200 'JX.Stratcom.listen(..., "tag:#document", ...): ' + 1188 - 'listen for document events as "tag:window", not ' + 1189 - '"tag:#document", in order to get consistent behavior ' + 1190 - 'across browsers.'); 1201 + 'listen for all events using null, not "tag:#document"'); 1202 + } 1203 + if (path[kk] == 'tag:window') { 1204 + throw new Error( 1205 + 'JX.Stratcom.listen(..., "tag:window", ...): ' + 1206 + 'listen for window events using null, not "tag:window"'); 1191 1207 } 1192 1208 } 1193 1209 if (!type_target[path[kk]]) { ··· 1219 1235 * @task internal 1220 1236 */ 1221 1237 dispatch : function(event) { 1222 - // TODO: simplify this :P 1223 - var target; 1224 - try { 1225 - target = event.srcElement || event.target; 1226 - if (target === window || (!target || target.nodeName == '#document')) { 1227 - target = {nodeName: 'window'}; 1228 - } 1229 - } catch (x) { 1230 - target = null; 1231 - } 1232 - 1233 1238 var path = []; 1234 1239 var nodes = {}; 1235 1240 var push = function(key, node) { 1236 1241 // we explicitly only store the first occurrence of each key 1237 - if (!(key in nodes)) { 1242 + if (!nodes.hasOwnProperty(key)) { 1238 1243 nodes[key] = node; 1239 1244 path.push(key); 1240 1245 } 1241 1246 }; 1242 1247 1248 + var target = event.srcElement || event.target; 1249 + 1250 + // Since you can only listen by tag, id or sigil, which are all 1251 + // attributes of an Element (the DOM interface), we unset the target 1252 + // if it isn't an Element (window and Document are Nodes but not Elements) 1253 + if (!target || !target.getAttribute) { 1254 + target = null; 1255 + } 1256 + 1243 1257 var cursor = target; 1244 - while (cursor) { 1258 + while (cursor && cursor.getAttribute) { 1245 1259 push('tag:' + cursor.nodeName.toLowerCase(), cursor); 1246 1260 1247 1261 var id = cursor.id; ··· 1249 1263 push('id:' + id, cursor); 1250 1264 } 1251 1265 1252 - var source = cursor.className || ''; 1253 - // className is an SVGAnimatedString for SVG elements, use baseVal 1254 - var token = ((source.baseVal || source).match(this._matchName) || [])[1]; 1255 - if (token) { 1256 - push(token, cursor); 1266 + var sigils = cursor.getAttribute('data-sigil'); 1267 + if (sigils) { 1268 + sigils = sigils.split(' '); 1269 + for (var ii = 0; ii < sigils.length; ii++) { 1270 + push(sigils[ii], cursor); 1271 + } 1257 1272 } 1258 1273 1259 1274 cursor = cursor.parentNode; ··· 1264 1279 etype = this._typeMap[etype]; 1265 1280 } 1266 1281 1267 - var data = {}; 1268 - for (var key in nodes) { 1269 - data[key] = this.getData(nodes[key]); 1270 - } 1271 - 1272 1282 var proxy = new JX.Event() 1273 1283 .setRawEvent(event) 1274 1284 .setType(etype) 1275 1285 .setTarget(target) 1276 - .setData(data) 1277 1286 .setNodes(nodes) 1278 1287 .setPath(path.reverse()); 1279 1288 ··· 1409 1418 1410 1419 1411 1420 /** 1412 - * Attach a sigil (and, optionally, metadata) to a node. Note that you can 1413 - * not overwrite, remove or replace a sigil. 1421 + * Determine if a node has a specific sigil. 1414 1422 * 1415 - * @param Node Node without any sigil. 1416 - * @param string Sigil to name the node with. 1417 - * @param object? Optional metadata object to attach to the node. 1418 - * @return void 1423 + * @param Node Node to test. 1424 + * @param string Sigil to check for. 1425 + * @return bool True if the node has the sigil. 1426 + * 1419 1427 * @task sigil 1420 1428 */ 1421 - sigilize : function(node, sigil, data) { 1429 + hasSigil : function(node, sigil) { 1422 1430 if (__DEV__) { 1423 - if (node.className.match(this._matchName)) { 1431 + if (!node || !node.getAttribute) { 1424 1432 throw new Error( 1425 - 'JX.Stratcom.sigilize(<node>, ' + sigil + ', ...): ' + 1426 - 'node already has a sigil, sigils may not be overwritten.'); 1427 - } 1428 - if (typeof data != 'undefined' && 1429 - (data === null || typeof data != 'object')) { 1430 - throw new Error( 1431 - 'JX.Stratcom.sigilize(..., ..., <nonobject>): ' + 1432 - 'data to attach to node is not an object. You must use ' + 1433 - 'objects, not primitives, for metadata.'); 1433 + 'JX.Stratcom.hasSigil(<non-element>, ...): ' + 1434 + 'node is not an element. Most likely, you\'re passing window or ' + 1435 + 'document, which are not elements and can\'t have sigils.'); 1434 1436 } 1435 1437 } 1436 1438 1437 - if (data) { 1438 - JX.Stratcom._setData(node, data); 1439 - } 1440 - 1441 - node.className = 'FN_' + sigil + ' ' + node.className; 1439 + var sigils = node.getAttribute('data-sigil'); 1440 + return sigils && (' ' + sigils + ' ').indexOf(' ' + sigil + ' ') > -1; 1442 1441 }, 1443 1442 1444 1443 1445 1444 /** 1446 - * Determine if a node has a specific sigil. 1445 + * Add a sigil to a node. 1447 1446 * 1448 - * @param Node Node to test. 1449 - * @param string Sigil to check for. 1450 - * @return bool True if the node has the sigil. 1451 - * 1447 + * @param Node Node to add the sigil to. 1448 + * @param string Sigil to name the node with. 1449 + * @return void 1452 1450 * @task sigil 1453 1451 */ 1454 - hasSigil : function(node, sigil) { 1455 - if (!node.className) { 1456 - // Some nodes don't have a className, notably 'document'. We hit 1457 - // 'document' when following .parentNode chains, e.g. in 1458 - // JX.DOM.nearest(), so exit early if we don't have a className to avoid 1459 - // fataling on 'node.className.match' being undefined. 1460 - return false; 1452 + addSigil: function(node, sigil) { 1453 + if (__DEV__) { 1454 + if (!node || !node.getAttribute) { 1455 + throw new Error( 1456 + 'JX.Stratcom.addSigil(<non-element>, ...): ' + 1457 + 'node is not an element. Most likely, you\'re passing window or ' + 1458 + 'document, which are not elements and can\'t have sigils.'); 1459 + } 1460 + } 1461 + 1462 + var sigils = node.getAttribute('data-sigil'); 1463 + if (sigils && !JX.Stratcom.hasSigil(node, sigil)) { 1464 + sigil = sigils + ' ' + sigil; 1461 1465 } 1462 - return (node.className.match(this._matchName) || [])[1] == sigil; 1466 + 1467 + node.setAttribute('data-sigil', sigil); 1463 1468 }, 1464 1469 1465 1470 1466 1471 /** 1467 1472 * Retrieve a node's metadata. 1468 1473 * 1469 - * @param Node Node from which to retrieve data. 1470 - * @return object Data attached to the node, or an empty dictionary if 1471 - * the node has no data attached. In this case, the empty 1472 - * dictionary is set as the node's metadata -- i.e., 1473 - * subsequent calls to getData() will retrieve the same 1474 - * object. 1475 - * 1476 - * @task sigil 1474 + * @param Node Node from which to retrieve data. 1475 + * @return object Data attached to the node. If no data has been attached 1476 + * to the node yet, an empty object will be returned, but 1477 + * subsequent calls to this method will always retrieve the 1478 + * same object. 1479 + * @task meta 1477 1480 */ 1478 1481 getData : function(node) { 1479 1482 if (__DEV__) { 1480 - if (!node) { 1483 + if (!node || !node.getAttribute) { 1481 1484 throw new Error( 1482 - 'JX.Stratcom.getData(<empty>): ' + 1483 - 'you must provide a node to get associated data from.'); 1485 + 'JX.Stratcom.getData(<non-element>): ' + 1486 + 'node is not an element. Most likely, you\'re passing window or ' + 1487 + 'document, which are not elements and can\'t have data.'); 1484 1488 } 1485 1489 } 1486 1490 1487 - var matches = (node.className || '').match(this._matchData); 1488 - if (matches) { 1489 - var block = this._data[matches[1]]; 1490 - var index = matches[2]; 1491 + var meta_id = (node.getAttribute('data-meta') || '').split('_'); 1492 + if (meta_id[0] && meta_id[1]) { 1493 + var block = this._data[meta_id[0]]; 1494 + var index = meta_id[1]; 1491 1495 if (block && (index in block)) { 1492 1496 return block[index]; 1493 1497 } 1494 1498 } 1495 1499 1496 - return JX.Stratcom._setData(node, {}); 1500 + var data = {}; 1501 + if (!this._data[1]) { // data block 1 is reserved for JavaScript 1502 + this._data[1] = {}; 1503 + } 1504 + this._data[1][this._dataIndex] = data; 1505 + node.setAttribute('data-meta', '1_' + (this._dataIndex++)); 1506 + return data; 1497 1507 }, 1498 1508 1509 + 1499 1510 /** 1500 - 1501 - * @task internal 1511 + * Add data to a node's metadata. 1512 + * 1513 + * @param Node Node which data should be attached to. 1514 + * @param object Data to add to the node's metadata. 1515 + * @return object Data attached to the node that is returned by 1516 + * JX.Stratcom.getData(). 1517 + * @task meta 1502 1518 */ 1503 - allocateMetadataBlock : function() { 1504 - return this._dataBlock++; 1519 + addData : function(node, data) { 1520 + if (__DEV__) { 1521 + if (!node || !node.getAttribute) { 1522 + throw new Error( 1523 + 'JX.Stratcom.addData(<non-element>, ...): ' + 1524 + 'node is not an element. Most likely, you\'re passing window or ' + 1525 + 'document, which are not elements and can\'t have sigils.'); 1526 + } 1527 + if (!data || typeof data != 'object') { 1528 + throw new Error( 1529 + 'JX.Stratcom.addData(..., <nonobject>): ' + 1530 + 'data to attach to node is not an object. You must use ' + 1531 + 'objects, not primitives, for metadata.'); 1532 + } 1533 + } 1534 + 1535 + return JX.copy(JX.Stratcom.getData(node), data); 1505 1536 }, 1506 1537 1538 + 1507 1539 /** 1508 - * Attach metadata to a node. This data can later be retrieved through 1509 - * @{JX.Stratcom.getData()}, or @{JX.Event.getData()}. 1510 - * 1511 - * @param Node Node which data should be attached to. 1512 - * @param object Data to attach. 1513 - * @return object Attached data. 1514 - * 1515 1540 * @task internal 1516 1541 */ 1517 - _setData : function(node, data) { 1518 - if (!this._data[1]) { // data block 1 is reserved for javascript 1519 - this._data[1] = {}; 1520 - } 1521 - this._data[1][this._dataIndex] = data; 1522 - node.className = 'FD_1_' + (this._dataIndex++) + ' ' + node.className; 1523 - return data; 1542 + allocateMetadataBlock : function() { 1543 + return this._dataBlock++; 1524 1544 } 1525 1545 } 1526 1546 }); ··· 1535 1555 1536 1556 JX.behavior = function(name, control_function) { 1537 1557 if (__DEV__) { 1538 - if (name in JX.behavior._behaviors) { 1558 + if (JX.behavior._behaviors.hasOwnProperty(name)) { 1539 1559 throw new Error( 1540 1560 'JX.behavior("'+name+'", ...): '+ 1541 1561 'behavior is already registered.'); ··· 1566 1586 } 1567 1587 var configs = map[name]; 1568 1588 if (!configs.length) { 1569 - if (name in JX.behavior._initialized) { 1589 + if (JX.behavior._initialized.hasOwnProperty(name)) { 1570 1590 continue; 1571 1591 } else { 1572 1592 configs = [null]; ··· 1827 1847 }, 1828 1848 1829 1849 initialize : function() { 1830 - JX.Stratcom.listen('unload', 'tag:window', JX.Request.shutdown); 1850 + JX.Stratcom.listen('unload', null, JX.Request.shutdown); 1831 1851 } 1832 1852 1833 1853 }); ··· 2410 2430 } 2411 2431 2412 2432 if (attr.sigil) { 2413 - JX.Stratcom.sigilize(node, attr.sigil, attr.meta); 2433 + JX.Stratcom.addSigil(node, attr.sigil); 2414 2434 delete attr.sigil; 2435 + } 2436 + 2437 + if (attr.meta) { 2438 + JX.Stratcom.addData(node, attr.meta); 2415 2439 delete attr.meta; 2416 2440 } 2417 2441 ··· 2421 2445 '$N(' + tag + ', ...): ' + 2422 2446 'use the key "meta" to specify metadata, not "data" or "metadata".'); 2423 2447 } 2424 - if (attr.meta) { 2425 - throw new Error( 2426 - '$N(' + tag + ', ...): ' + 2427 - 'if you specify "meta" metadata, you must also specify a "sigil".'); 2428 - } 2429 - } 2430 - 2431 - // prevent sigil from being wiped by blind copying the className 2432 - if (attr.className) { 2433 - JX.DOM.alterClass(node, attr.className, true); 2434 - delete attr.className; 2435 2448 } 2436 2449 2437 2450 JX.copy(node, attr); ··· 2595 2608 * @author jgabbard 2596 2609 */ 2597 2610 nearest : function(node, sigil) { 2598 - while (node && !JX.Stratcom.hasSigil(node, sigil)) { 2611 + while (node && node.getAttribute && !JX.Stratcom.hasSigil(node, sigil)) { 2599 2612 node = node.parentNode; 2600 2613 } 2601 2614 return node;
+2 -1
webroot/rsrc/js/javelin/javelin.min.js
··· 1 1 /** @provides javelin-lib-prod */ 2 - JX.$A=function(b){var c=[];for(var a=0;a<b.length;a++)c.push(b[a]);return c;};JX.$AX=function(a){return (a instanceof Array)?a:[a];};JX.copy=function(a,b){for(var c in b)a[c]=b[c];return a;};JX.bind=function(b,c,d){var a=JX.$A(arguments).slice(2);return function(){return c.apply(b||window,a.concat(JX.$A(arguments)));};};JX.bag=function(){};JX.keys=function(b){var c=[];for(var a in b)c.push(a);return c;};JX.defer=function(a,c){var b=setTimeout(a,c||0);return {stop:function(){clearTimeout(b);}};};JX.go=function(a){JX.Stratcom&&JX.Stratcom.invoke('go',null,{uri:a});(a&&(window.location=a))||window.location.reload(true);};JX.install=function(h,g){if(typeof JX.install._a=='undefined')JX.install._a=0;if(h in JX)return;if(!JX.install._b)JX.install._b=[];JX.install._b.push([h,g]);do{var d;var f=null;for(var c=0;c<JX.install._b.length;++c){d=JX.install._b[c][1];if(d.extend&&!JX[d.extend])continue;f=JX.install._b[c][0];JX.install._b.splice(c,1);--c;JX[f]=(function(m,l){var n=function(){this.__id__='__obj__'+(++JX.install._a);this.__super__=JX[l.extend]||JX.bag;this.__parent__=JX[m].prototype;if(JX[m].__prototyping__)return;return (l.construct||JX.bag).apply(this,arguments);};return n;})(f,d);JX.copy(JX[f],d.statics);JX[f].__prototyping__=0;var k;if(d.extend){JX[d.extend].__prototyping__++;k=JX[f].prototype=new JX[d.extend]();JX[d.extend].__prototyping__--;}else k=JX[f].prototype={};k.__class__=JX[f];for(var e in (d.properties||{})){var b=e.charAt(0).toUpperCase()+e.substr(1);var j='__auto__'+e;k[j]=d.properties[e];k['set'+b]=(function(l){return function(m){this[l]=m;return this;};})(j);k['get'+b]=(function(l){return function(){return this[l];};})(j);}JX.copy(k,d.members);if(d.events&&d.events.length){var i=JX[d.extend]||{};JX[f].__name__='class:'+f;var a=i.__path__||[];JX[f].__path__=a.concat([JX[f].__name__]);k.invoke=function(l){return JX.Stratcom.invoke('obj:'+l,this.__class__.__path__.concat([this.__id__]),{args:JX.$A(arguments).slice(1)});};k.listen=function(m,l){return JX.Stratcom.listen('obj:'+m,this.__id__,JX.bind(this,function(n){return l.apply(this,n.getData().args);}));};JX[f].listen=function(m,l){return JX.Stratcom.listen('obj:'+m,this.__name__,JX.bind(this,function(n){return l.apply(this,n.getData().args);}));};}(d.initialize||JX.bag)();}}while(f);};JX.install('Event',{members:{stop:function(){var a=this.getRawEvent();if(a){a.cancelBubble=true;a.stopPropagation&&a.stopPropagation();}this.setStopped(true);return this;},prevent:function(){var a=this.getRawEvent();if(a){a.returnValue=false;a.preventDefault&&a.preventDefault();}this.setPrevented(true);return this;},kill:function(){this.prevent();this.stop();return this;},getSpecialKey:function(){var b=this.getRawEvent();if(!b||b.shiftKey)return null;var a=b.keyCode;do{a=JX.Event._c[a]||null;}while(a&&JX.Event._c[a]);return a;},getNode:function(a){return this.getNodes()[a]||null;}},statics:{_c:{8:'delete',9:'tab',13:'return',27:'esc',37:'left',38:'up',39:'right',40:'down',63232:38,63233:40,62234:37,62235:39}},properties:{rawEvent:null,type:null,target:null,data:null,path:[],stopped:false,prevented:false,nodes:{}},initialize:function(){}});JX.install('Stratcom',{statics:{ready:false,_d:{},_e:[],_f:{},_g:/\bFN_([^ ]+)/,_h:/\bFD_([^ ]+)_([^ ]+)/,_i:'*',_j:{},_k:[],_l:{focusin:'focus',focusout:'blur'},_m:2,_n:0,invoke:function(d,b,a){var c=new JX.Event().setType(d).setData(a||{}).setPath(b||[]);return this._o(c);},listen:function(k,h,a){var c=[];k=JX.$AX(k);if(!h)h=this._i;if(!(h instanceof Array)){h=[[h]];}else if(!(h[0] instanceof Array))h=[h];for(var d=0;d<k.length;++d){var i=k[d];if(('onpagehide' in window)&&i=='unload')i='pagehide';if(!(i in this._d))this._d[i]={};var j=this._d[i];for(var e=0;e<h.length;++e){var g=h[e];var b=this._e.length;this._e.push(a);this._f[b]=g.length;c.push(b);for(var f=0;f<g.length;++f){if(!j[g[f]])j[g[f]]=[];j[g[f]].push(b);}}}return {remove:function(){for(var l=0;l<c.length;l++)delete JX.Stratcom._e[c[l]];}};},dispatch:function(event){var k;try{k=event.srcElement||event.target;if(k===window||(!k||k.nodeName=='#document'))k={nodeName:'window'};}catch(m){k=null;}var g=[];var f={};var i=function(n,o){if(!(n in f)){f[n]=o;g.push(n);}};var a=k;while(a){i('tag:'+a.nodeName.toLowerCase(),a);var d=a.id;if(d)i('id:'+d,a);var j=a.className||'';var l=((j.baseVal||j).match(this._g)||[])[1];if(l)i(l,a);a=a.parentNode;}var c=event.type;if(c in this._l)c=this._l[c];var b={};for(var e in f)b[e]=this.getData(f[e]);var h=new JX.Event().setRawEvent(event).setType(c).setTarget(k).setData(b).setNodes(f).setPath(g.reverse());return this._o(h);},_o:function(i){var k=this._d[i.getType()];if(!k)return i;var h=i.getPath();var f=h.length;var c={};var g;for(var j=-1;j<f;++j){if(j==-1){g=k[this._i];}else g=k[h[j]];if(!g)continue;for(var d=0;d<g.length;++d)c[g[d]]=(c[g[d]]||0)+1;}var a=[];for(var e in c)if(c[e]==this._f[e]){var b=this._e[e];if(b)a.push(b);}this._k.push({handlers:a,event:i,cursor:0});this.pass();this._k.pop();return i;},pass:function(){var a=this._k[this._k.length-1];while(a.cursor<a.handlers.length){var b=a.cursor;++a.cursor;(a.handlers[b]||JX.bag)(a.event);if(a.event.getStopped())break;}return a.event.getStopped()||a.event.getPrevented();},context:function(){var a=this._k.length;if(!a)return null;return this._k[a-1].event;},mergeData:function(a,b){this._j[a]=b;if(a==0){JX.Stratcom.ready=true;JX.__rawEventQueue({type:'start-queue'});}},sigilize:function(b,c,a){if(a)JX.Stratcom._p(b,a);b.className='FN_'+c+' '+b.className;},hasSigil:function(a,b){if(!a.className)return false;return (a.className.match(this._g)||[])[1]==b;},getData:function(d){var c=(d.className||'').match(this._h);if(c){var a=this._j[c[1]];var b=c[2];if(a&&(b in a))return a[b];}return JX.Stratcom._p(d,{});},allocateMetadataBlock:function(){return this._m++;},_p:function(b,a){if(!this._j[1])this._j[1]={};this._j[1][this._n]=a;b.className='FD_1_'+(this._n++)+' '+b.className;return a;}}});JX.behavior=function(b,a){JX.behavior._q[b]=a;};JX.initBehaviors=function(c){for(var d in c){var a=c[d];if(!a.length)if(d in JX.behavior._r){continue;}else a=[null];for(var b=0;b<a.length;b++)JX.behavior._q[d](a[b]);JX.behavior._r[d]=true;}};!function(a){a.behavior._q={};a.behavior._r={};}(JX);JX.install('Request',{construct:function(b,a){this.setURI(b);if(a)this.listen('done',a);},events:['send','done','error','finally'],members:{_s:null,_t:null,_u:false,_v:null,send:function(){var f=null;try{try{f=new XMLHttpRequest();}catch(e){f=new ActiveXObject("Msxml2.XMLHTTP");}}catch(e){f=new ActiveXObject("Microsoft.XMLHTTP");}this._t=f;this._s=JX.Request._w.length;JX.Request._w.push(this);f.onreadystatechange=JX.bind(this,this._x);var a=this.getData()||{};a.__ajax__=true;this._v=JX.Stratcom.allocateMetadataBlock();a.__metablock__=this._v;var c=(this.getDataSerializer()||JX.Request.defaultDataSerializer)(a);var d=this.getURI();var b=this.getMethod().toUpperCase();if(b=='GET')d+=((d.indexOf('?')===-1)?'?':'&')+c;this.invoke('send',this);if(this.getTimeout())this._y=JX.defer(JX.bind(this,this._z,JX.Request.ERROR_TIMEOUT),this.getTimeout());f.open(b,d,true);if(b=='POST'){if(this.getFile()){f.send(this.getFile());}else{f.setRequestHeader('Content-Type','application/x-www-form-urlencoded');f.send(c);}}else f.send(null);},abort:function(){this._za();},_x:function(){var xport=this._t;try{if(this._u)return;if(xport.readyState!=4)return;if(xport.status<200||xport.status>=300){this._z();return;}var text=xport.responseText.substring('for (;;);'.length);var response=eval('('+text+')');}catch(exception){this._z();return;}try{if(response.error){this._z(response.error);}else{JX.Stratcom.mergeData(this._v,response.javelin_metadata||{});this._zb(response);JX.initBehaviors(response.javelin_behaviors||{});}}catch(exception){JX.defer(function(){throw exception;});}},_z:function(a){this._za();this.invoke('error',a,this);this.invoke('finally');},_zb:function(b){this._za();if(b.onload)for(var a=0;a<b.onload.length;a++)(new Function(b.onload[a]))();this.invoke('done',this.getRaw()?b:b.payload,this);this.invoke('finally');},_za:function(){this._u=true;delete JX.Request._w[this._s];this._y&&this._y.stop();this._t.abort();}},statics:{_w:[],shutdown:function(){for(var a=0;a<JX.Request._w.length;a++)try{JX.Request._w[a]&&JX.Request._w[a].abort();}catch(b){}JX.Request._w=[];},ERROR_TIMEOUT:-9000,defaultDataSerializer:function(a){var c=[];for(var b in a)c.push(encodeURIComponent(b)+'='+encodeURIComponent(a[b]));return c.join('&');}},properties:{URI:null,data:null,dataSerializer:null,method:'POST',file:null,raw:false,timeout:null},initialize:function(){JX.Stratcom.listen('unload','tag:window',JX.Request.shutdown);}});JX.install('$V',{construct:function(a,b){if(this==JX||this==window)return new JX.$V(a,b);if(typeof b=='undefined')return JX.$V.getPos(a);this.x=parseFloat(a);this.y=parseFloat(b);},canCallAsFunction:true,members:{x:null,y:null,setPos:function(a){a.style.left=(this.x===null)?'':(parseInt(this.x,10)+'px');a.style.top=(this.y===null)?'':(parseInt(this.y,10)+'px');return this;},setDim:function(a){a.style.width=(this.x===null)?'':(parseInt(this.x,10)+'px');a.style.height=(this.y===null)?'':(parseInt(this.y,10)+'px');return this;},add:function(a,b){if(a instanceof JX.$V)return this.add(a.x,a.y);return JX.$V(this.x+parseFloat(a),this.y+parseFloat(b));}},statics:{_zc:null,getPos:function(b){JX.Event&&(b instanceof JX.Event)&&(b=b.getRawEvent());if(('pageX' in b)||('clientX' in b)){var a=JX.$V._zc;return JX.$V(b.pageX||(b.clientX+a.scrollLeft),b.pageY||(b.clientY+a.scrollTop));}var c=b.offsetLeft;var d=b.offsetTop;while(b.offsetParent&&(b.offsetParent!=document.body)){b=b.offsetParent;c+=b.offsetLeft;d+=b.offsetTop;}return JX.$V(c,d);},getDim:function(a){return JX.$V(a.offsetWidth,a.offsetHeight);},getScroll:function(){var a=document.body;var b=document.documentElement;return JX.$V(a.scrollLeft||b.scrollLeft,a.scrollTop||b.scrollTop);},getViewport:function(){var a=JX.$V._zc;var b=window;return JX.$V(b.innerWidth||a.clientWidth||0,b.innerHeight||a.clientHeight||0);},getDocument:function(){var a=JX.$V._zc;return JX.$V(a.scrollWidth||0,a.scrollHeight||0);}},initialize:function(){var a=((a=document)&&(a=a.documentElement))||((a=document)&&(a=a.body));JX.$V._zc=a;}});JX.$=function(a){var b=document.getElementById(a);if(!b||(b.id!=a))throw JX.$.NotFound;return b;};JX.$.NotFound={};JX.install('HTML',{construct:function(a){if(this==JX||this==window)return new JX.HTML(a);this._zd=a;},canCallAsFunction:true,members:{_zd:null,getFragment:function(){var b=JX.$N('div');b.innerHTML=this._zd;var a=document.createDocumentFragment();while(b.firstChild)a.appendChild(b.removeChild(b.firstChild));return a;}}});JX.$N=function(d,a,b){if(typeof b=='undefined'&&(typeof a!='object'||a instanceof JX.HTML)){b=a;a={};}var c=document.createElement(d);if(a.style){JX.copy(c.style,a.style);delete a.style;}if(a.sigil){JX.Stratcom.sigilize(c,a.sigil,a.meta);delete a.sigil;delete a.meta;}if(a.className){JX.DOM.alterClass(c,a.className,true);delete a.className;}JX.copy(c,a);if(b)JX.DOM.setContent(c,b);return c;};JX.install('DOM',{statics:{_ze:0,_zf:{},setContent:function(b,a){while(b.firstChild)JX.DOM.remove(b.firstChild);JX.DOM.appendContent(b,a);},prependContent:function(b,a){this._zg(b,a,this._zh);},appendContent:function(b,a){this._zg(b,a,this._zi);},_zh:function(b,a){b.insertBefore(a,b.firstChild);},_zi:function(b,a){b.appendChild(a);},_zg:function(e,b,d){if(b===null||typeof b=='undefined')return;if(b instanceof JX.HTML)b=b.getFragment();if(b instanceof Array){for(var c=0;c<b.length;c++){var a=(typeof b[c]=='string')?document.createTextNode(b[c]):b[c];d(e,a);}}else if(b.nodeType){d(e,b);}else d(e,document.createTextNode(b));},remove:function(a){a.parentNode&&JX.DOM.replace(a,null);return a;},replace:function(b,d){var a;if(b.nextSibling){a=JX.bind(b.nextSibling,function(f,e){f.insertBefore(e,this);});}else a=this._zi;var c=b.parentNode;b.parentNode.removeChild(b);this._zg(c,d,a);return b;},nearest:function(a,b){while(a&&!JX.Stratcom.hasSigil(a,b))a=a.parentNode;return a;},serialize:function(c){var b=c.getElementsByTagName('*');var a={};for(var d=0;d<b.length;++d){if(!b[d].name)continue;var f=b[d].type;var e=b[d].tagName;if((f in {radio:1,checkbox:1}&&b[d].checked)||f in {text:1,hidden:1,password:1}||e in {TEXTAREA:1,SELECT:1})a[b[d].name]=b[d].value;}return a;},isNode:function(a){return !!(a&&a.nodeName&&(a!==window));},isType:function(b,c){b=(''+(b.nodeName||'')).toUpperCase();c=JX.$AX(c);for(var a=0;a<c.length;++a)if(c[a].toUpperCase()==b)return true;return false;},listen:function(b,d,c,a){return JX.Stratcom.listen(d,['id:'+JX.DOM.uniqID(b)].concat(JX.$AX(c||[])),a);},uniqID:function(a){if(!a.id)a.id='autoid_'+(++JX.DOM._ze);return a.id;},alterClass:function(d,b,a){var c=((' '+d.className+' ').indexOf(' '+b+' ')>-1);if(a&&!c){d.className+=' '+b;}else if(c&&!a)d.className=d.className.replace(new RegExp('(^|\\s)'+b+'(?:\\s|$)','g'),' ');},htmlize:function(a){return (''+a).replace(/&/g,'&amp;').replace(/"/g,'&quot;').replace(/</g,'&lt;').replace(/>/g,'&gt;');},show:function(){for(var a=0;a<arguments.length;++a)arguments[a].style.display='';},hide:function(){for(var a=0;a<arguments.length;++a)arguments[a].style.display='none';},textMetrics:function(c,e,f){if(!this._zf[e]){var b=JX.$N('var',{className:e});this._zf[e]=b;}var d=this._zf[e];document.body.appendChild(d);d.style.width=f?(f+'px'):'';JX.DOM.setContent(d,JX.HTML(JX.DOM.htmlize(c.value).replace(/\n/g,'<br />')));var a=JX.$V.getDim(d);document.body.removeChild(d);return a;},scry:function(d,f,e){var b=d.getElementsByTagName(f);if(!e)return JX.$A(b);var c=[];for(var a=0;a<b.length;a++)if(JX.Stratcom.hasSigil(b[a],e))c.push(b[a]);return c;},find:function(b,d,c){var a=JX.DOM.scry(b,d,c);if(!a.length)throw JX.$.NotFound;return a[0];},focus:function(b){try{b.focus();}catch(a){}},scrollTo:function(a){window.scrollTo(0,JX.$V(a).y);}}});JX.install('JSON',{statics:{serialize:function(a){return JX.JSON._zj(a);},_zj:function(d){var c=[];if(d===null){return 'null';}else if(d.push&&d.pop){for(var a=0;a<d.length;a++)if(typeof d[a]!='undefined')c.push(JX.JSON._zj(d[a]));return '['+c.join(',')+']';}else if(d===true){return 'true';}else if(d===false){return 'false';}else if(typeof d=='string'){return JX.JSON._zk(d);}else if(typeof d=='number'){return d;}else{for(var b in d)c.push(JX.JSON._zk(b)+':'+JX.JSON._zj(d[b]));return '{'+c.join(',')+'}';}},_zk:function(a){return '"'+a.replace(/\\/g,'\\\\').replace(/"/g,'\\"')+'"';}}}); 2 + 3 + JX.$A=function(b){var c=[];for(var a=0;a<b.length;a++)c.push(b[a]);return c;};JX.$AX=function(a){return (a instanceof Array)?a:[a];};JX.copy=function(a,b){for(var c in b)a[c]=b[c];return a;};JX.bind=function(b,c,d){var a=JX.$A(arguments).slice(2);return function(){return c.apply(b||window,a.concat(JX.$A(arguments)));};};JX.bag=function(){};JX.keys=function(b){var c=[];for(var a in b)c.push(a);return c;};JX.defer=function(a,c){var b=setTimeout(a,c||0);return {stop:function(){clearTimeout(b);}};};JX.go=function(a){JX.Stratcom&&JX.Stratcom.invoke('go',null,{uri:a});(a&&(window.location=a))||window.location.reload(true);};JX.install=function(h,g){if(typeof JX.install._a=='undefined')JX.install._a=0;if(h in JX)return;if(!JX.install._b)JX.install._b=[];JX.install._b.push([h,g]);do{var d;var f=null;for(var c=0;c<JX.install._b.length;++c){d=JX.install._b[c][1];if(d.extend&&!JX[d.extend])continue;f=JX.install._b[c][0];JX.install._b.splice(c,1);--c;JX[f]=(function(m,l){var n=function(){this.__id__='__obj__'+(++JX.install._a);this.__super__=JX[l.extend]||JX.bag;this.__parent__=JX[m].prototype;if(JX[m].__prototyping__)return;return (l.construct||JX.bag).apply(this,arguments);};return n;})(f,d);JX.copy(JX[f],d.statics);JX[f].__prototyping__=0;var k;if(d.extend){JX[d.extend].__prototyping__++;k=JX[f].prototype=new JX[d.extend]();JX[d.extend].__prototyping__--;}else k=JX[f].prototype={};k.__class__=JX[f];for(var e in (d.properties||{})){var b=e.charAt(0).toUpperCase()+e.substr(1);var j='__auto__'+e;k[j]=d.properties[e];k['set'+b]=(function(l){return function(m){this[l]=m;return this;};})(j);k['get'+b]=(function(l){return function(){return this[l];};})(j);}JX.copy(k,d.members);if(d.events&&d.events.length){var i=JX[d.extend]||{};JX[f].__name__='class:'+f;var a=i.__path__||[];JX[f].__path__=a.concat([JX[f].__name__]);k.invoke=function(l){return JX.Stratcom.invoke('obj:'+l,this.__class__.__path__.concat([this.__id__]),{args:JX.$A(arguments).slice(1)});};k.listen=function(m,l){return JX.Stratcom.listen('obj:'+m,this.__id__,JX.bind(this,function(n){return l.apply(this,n.getData().args);}));};JX[f].listen=function(m,l){return JX.Stratcom.listen('obj:'+m,this.__name__,JX.bind(this,function(n){return l.apply(this,n.getData().args);}));};}(d.initialize||JX.bag)();}}while(f);};JX.install('Event',{members:{stop:function(){var a=this.getRawEvent();if(a){a.cancelBubble=true;a.stopPropagation&&a.stopPropagation();}this.setStopped(true);return this;},prevent:function(){var a=this.getRawEvent();if(a){a.returnValue=false;a.preventDefault&&a.preventDefault();}this.setPrevented(true);return this;},kill:function(){this.prevent();this.stop();return this;},getSpecialKey:function(){var a=this.getRawEvent();if(!a||a.shiftKey)return null;return JX.Event._c[a.keyCode]||null;},getNode:function(a){return this.getNodes()[a]||null;},getNodeData:function(a){return JX.Stratcom.getData(this.getNode(a));}},statics:{_c:{8:'delete',9:'tab',13:'return',27:'esc',37:'left',38:'up',39:'right',40:'down',63232:'up',63233:'down',62234:'left',62235:'right'}},properties:{rawEvent:null,type:null,target:null,data:null,path:[],stopped:false,prevented:false,nodes:{}},initialize:function(){}});JX.install('Stratcom',{statics:{ready:false,_d:{},_e:[],_f:{},_g:'*',_h:{},_i:[],_j:{focusin:'focus',focusout:'blur'},_k:2,_l:0,invoke:function(d,b,a){var c=new JX.Event().setType(d).setData(a||{}).setPath(b||[]);return this._m(c);},listen:function(k,h,a){var c=[];k=JX.$AX(k);if(!h)h=this._g;if(!(h instanceof Array)){h=[[h]];}else if(!(h[0] instanceof Array))h=[h];for(var d=0;d<k.length;++d){var i=k[d];if(('onpagehide' in window)&&i=='unload')i='pagehide';if(!(i in this._d))this._d[i]={};var j=this._d[i];for(var e=0;e<h.length;++e){var g=h[e];var b=this._e.length;this._e.push(a);this._f[b]=g.length;c.push(b);for(var f=0;f<g.length;++f){if(!j[g[f]])j[g[f]]=[];j[g[f]].push(b);}}}return {remove:function(){for(var l=0;l<c.length;l++)delete JX.Stratcom._e[c[l]];}};},dispatch:function(event){var f=[];var e={};var h=function(k,l){if(!e.hasOwnProperty(k)){e[k]=l;f.push(k);}};var j=event.srcElement||event.target;if(!j||!j.getAttribute)j=null;var a=j;while(a&&a.getAttribute){h('tag:'+a.nodeName.toLowerCase(),a);var c=a.id;if(c)h('id:'+c,a);var i=a.getAttribute('data-sigil');if(i){i=i.split(' ');for(var d=0;d<i.length;d++)h(i[d],a);}a=a.parentNode;}var b=event.type;if(b in this._j)b=this._j[b];var g=new JX.Event().setRawEvent(event).setType(b).setTarget(j).setNodes(e).setPath(f.reverse());return this._m(g);},_m:function(i){var k=this._d[i.getType()];if(!k)return i;var h=i.getPath();var f=h.length;var c={};var g;for(var j=-1;j<f;++j){if(j==-1){g=k[this._g];}else g=k[h[j]];if(!g)continue;for(var d=0;d<g.length;++d)c[g[d]]=(c[g[d]]||0)+1;}var a=[];for(var e in c)if(c[e]==this._f[e]){var b=this._e[e];if(b)a.push(b);}this._i.push({handlers:a,event:i,cursor:0});this.pass();this._i.pop();return i;},pass:function(){var a=this._i[this._i.length-1];while(a.cursor<a.handlers.length){var b=a.cursor;++a.cursor;(a.handlers[b]||JX.bag)(a.event);if(a.event.getStopped())break;}return a.event.getStopped()||a.event.getPrevented();},context:function(){var a=this._i.length;if(!a)return null;return this._i[a-1].event;},mergeData:function(a,b){this._h[a]=b;if(a==0){JX.Stratcom.ready=true;JX.__rawEventQueue({type:'start-queue'});}},hasSigil:function(a,b){var c=a.getAttribute('data-sigil');return c&&(' '+c+' ').indexOf(' '+b+' ')>-1;},addSigil:function(a,b){var c=a.getAttribute('data-sigil');if(c&&!JX.Stratcom.hasSigil(a,b))b=c+' '+b;a.setAttribute('data-sigil',b);},getData:function(e){var d=(e.getAttribute('data-meta')||'').split('_');if(d[0]&&d[1]){var a=this._h[d[0]];var c=d[1];if(a&&(c in a))return a[c];}var b={};if(!this._h[1])this._h[1]={};this._h[1][this._l]=b;e.setAttribute('data-meta','1_'+(this._l++));return b;},addData:function(b,a){return JX.copy(JX.Stratcom.getData(b),a);},allocateMetadataBlock:function(){return this._k++;}}});JX.behavior=function(b,a){JX.behavior._n[b]=a;};JX.initBehaviors=function(c){for(var d in c){var a=c[d];if(!a.length)if(JX.behavior._o.hasOwnProperty(d)){continue;}else a=[null];for(var b=0;b<a.length;b++)JX.behavior._n[d](a[b]);JX.behavior._o[d]=true;}};!function(a){a.behavior._n={};a.behavior._o={};}(JX);JX.install('Request',{construct:function(b,a){this.setURI(b);if(a)this.listen('done',a);},events:['send','done','error','finally'],members:{_p:null,_q:null,_r:false,_s:null,send:function(){var f=null;try{try{f=new XMLHttpRequest();}catch(e){f=new ActiveXObject("Msxml2.XMLHTTP");}}catch(e){f=new ActiveXObject("Microsoft.XMLHTTP");}this._q=f;this._p=JX.Request._t.length;JX.Request._t.push(this);f.onreadystatechange=JX.bind(this,this._u);var a=this.getData()||{};a.__ajax__=true;this._s=JX.Stratcom.allocateMetadataBlock();a.__metablock__=this._s;var c=(this.getDataSerializer()||JX.Request.defaultDataSerializer)(a);var d=this.getURI();var b=this.getMethod().toUpperCase();if(b=='GET')d+=((d.indexOf('?')===-1)?'?':'&')+c;this.invoke('send',this);if(this.getTimeout())this._v=JX.defer(JX.bind(this,this._w,JX.Request.ERROR_TIMEOUT),this.getTimeout());f.open(b,d,true);if(b=='POST'){if(this.getFile()){f.send(this.getFile());}else{f.setRequestHeader('Content-Type','application/x-www-form-urlencoded');f.send(c);}}else f.send(null);},abort:function(){this._x();},_u:function(){var xport=this._q;try{if(this._r)return;if(xport.readyState!=4)return;if(xport.status<200||xport.status>=300){this._w();return;}var text=xport.responseText.substring('for (;;);'.length);var response=eval('('+text+')');}catch(exception){this._w();return;}try{if(response.error){this._w(response.error);}else{JX.Stratcom.mergeData(this._s,response.javelin_metadata||{});this._y(response);JX.initBehaviors(response.javelin_behaviors||{});}}catch(exception){JX.defer(function(){throw exception;});}},_w:function(a){this._x();this.invoke('error',a,this);this.invoke('finally');},_y:function(b){this._x();if(b.onload)for(var a=0;a<b.onload.length;a++)(new Function(b.onload[a]))();this.invoke('done',this.getRaw()?b:b.payload,this);this.invoke('finally');},_x:function(){this._r=true;delete JX.Request._t[this._p];this._v&&this._v.stop();this._q.abort();}},statics:{_t:[],shutdown:function(){for(var a=0;a<JX.Request._t.length;a++)try{JX.Request._t[a]&&JX.Request._t[a].abort();}catch(b){}JX.Request._t=[];},ERROR_TIMEOUT:-9000,defaultDataSerializer:function(a){var c=[];for(var b in a)c.push(encodeURIComponent(b)+'='+encodeURIComponent(a[b]));return c.join('&');}},properties:{URI:null,data:null,dataSerializer:null,method:'POST',file:null,raw:false,timeout:null},initialize:function(){JX.Stratcom.listen('unload',null,JX.Request.shutdown);}});JX.install('$V',{construct:function(a,b){if(this==JX||this==window)return new JX.$V(a,b);if(typeof b=='undefined')return JX.$V.getPos(a);this.x=parseFloat(a);this.y=parseFloat(b);},canCallAsFunction:true,members:{x:null,y:null,setPos:function(a){a.style.left=(this.x===null)?'':(parseInt(this.x,10)+'px');a.style.top=(this.y===null)?'':(parseInt(this.y,10)+'px');return this;},setDim:function(a){a.style.width=(this.x===null)?'':(parseInt(this.x,10)+'px');a.style.height=(this.y===null)?'':(parseInt(this.y,10)+'px');return this;},add:function(a,b){if(a instanceof JX.$V)return this.add(a.x,a.y);return JX.$V(this.x+parseFloat(a),this.y+parseFloat(b));}},statics:{_z:null,getPos:function(b){JX.Event&&(b instanceof JX.Event)&&(b=b.getRawEvent());if(('pageX' in b)||('clientX' in b)){var a=JX.$V._z;return JX.$V(b.pageX||(b.clientX+a.scrollLeft),b.pageY||(b.clientY+a.scrollTop));}var c=b.offsetLeft;var d=b.offsetTop;while(b.offsetParent&&(b.offsetParent!=document.body)){b=b.offsetParent;c+=b.offsetLeft;d+=b.offsetTop;}return JX.$V(c,d);},getDim:function(a){return JX.$V(a.offsetWidth,a.offsetHeight);},getScroll:function(){var a=document.body;var b=document.documentElement;return JX.$V(a.scrollLeft||b.scrollLeft,a.scrollTop||b.scrollTop);},getViewport:function(){var a=JX.$V._z;var b=window;return JX.$V(b.innerWidth||a.clientWidth||0,b.innerHeight||a.clientHeight||0);},getDocument:function(){var a=JX.$V._z;return JX.$V(a.scrollWidth||0,a.scrollHeight||0);}},initialize:function(){var a=((a=document)&&(a=a.documentElement))||((a=document)&&(a=a.body));JX.$V._z=a;}});JX.$=function(a){var b=document.getElementById(a);if(!b||(b.id!=a))throw JX.$.NotFound;return b;};JX.$.NotFound={};JX.install('HTML',{construct:function(a){if(this==JX||this==window)return new JX.HTML(a);this._za=a;},canCallAsFunction:true,members:{_za:null,getFragment:function(){var b=JX.$N('div');b.innerHTML=this._za;var a=document.createDocumentFragment();while(b.firstChild)a.appendChild(b.removeChild(b.firstChild));return a;}}});JX.$N=function(d,a,b){if(typeof b=='undefined'&&(typeof a!='object'||a instanceof JX.HTML)){b=a;a={};}var c=document.createElement(d);if(a.style){JX.copy(c.style,a.style);delete a.style;}if(a.sigil){JX.Stratcom.addSigil(c,a.sigil);delete a.sigil;}if(a.meta){JX.Stratcom.addData(c,a.meta);delete a.meta;}JX.copy(c,a);if(b)JX.DOM.setContent(c,b);return c;};JX.install('DOM',{statics:{_zb:0,_zc:{},setContent:function(b,a){while(b.firstChild)JX.DOM.remove(b.firstChild);JX.DOM.appendContent(b,a);},prependContent:function(b,a){this._zd(b,a,this._ze);},appendContent:function(b,a){this._zd(b,a,this._zf);},_ze:function(b,a){b.insertBefore(a,b.firstChild);},_zf:function(b,a){b.appendChild(a);},_zd:function(e,b,d){if(b===null||typeof b=='undefined')return;if(b instanceof JX.HTML)b=b.getFragment();if(b instanceof Array){for(var c=0;c<b.length;c++){var a=(typeof b[c]=='string')?document.createTextNode(b[c]):b[c];d(e,a);}}else if(b.nodeType){d(e,b);}else d(e,document.createTextNode(b));},remove:function(a){a.parentNode&&JX.DOM.replace(a,null);return a;},replace:function(b,d){var a;if(b.nextSibling){a=JX.bind(b.nextSibling,function(f,e){f.insertBefore(e,this);});}else a=this._zf;var c=b.parentNode;b.parentNode.removeChild(b);this._zd(c,d,a);return b;},nearest:function(a,b){while(a&&a.getAttribute&&!JX.Stratcom.hasSigil(a,b))a=a.parentNode;return a;},serialize:function(c){var b=c.getElementsByTagName('*');var a={};for(var d=0;d<b.length;++d){if(!b[d].name)continue;var f=b[d].type;var e=b[d].tagName;if((f in {radio:1,checkbox:1}&&b[d].checked)||f in {text:1,hidden:1,password:1}||e in {TEXTAREA:1,SELECT:1})a[b[d].name]=b[d].value;}return a;},isNode:function(a){return !!(a&&a.nodeName&&(a!==window));},isType:function(b,c){b=(''+(b.nodeName||'')).toUpperCase();c=JX.$AX(c);for(var a=0;a<c.length;++a)if(c[a].toUpperCase()==b)return true;return false;},listen:function(b,d,c,a){return JX.Stratcom.listen(d,['id:'+JX.DOM.uniqID(b)].concat(JX.$AX(c||[])),a);},uniqID:function(a){if(!a.id)a.id='autoid_'+(++JX.DOM._zb);return a.id;},alterClass:function(d,b,a){var c=((' '+d.className+' ').indexOf(' '+b+' ')>-1);if(a&&!c){d.className+=' '+b;}else if(c&&!a)d.className=d.className.replace(new RegExp('(^|\\s)'+b+'(?:\\s|$)','g'),' ');},htmlize:function(a){return (''+a).replace(/&/g,'&amp;').replace(/"/g,'&quot;').replace(/</g,'&lt;').replace(/>/g,'&gt;');},show:function(){for(var a=0;a<arguments.length;++a)arguments[a].style.display='';},hide:function(){for(var a=0;a<arguments.length;++a)arguments[a].style.display='none';},textMetrics:function(c,e,f){if(!this._zc[e]){var b=JX.$N('var',{className:e});this._zc[e]=b;}var d=this._zc[e];document.body.appendChild(d);d.style.width=f?(f+'px'):'';JX.DOM.setContent(d,JX.HTML(JX.DOM.htmlize(c.value).replace(/\n/g,'<br />')));var a=JX.$V.getDim(d);document.body.removeChild(d);return a;},scry:function(d,f,e){var b=d.getElementsByTagName(f);if(!e)return JX.$A(b);var c=[];for(var a=0;a<b.length;a++)if(JX.Stratcom.hasSigil(b[a],e))c.push(b[a]);return c;},find:function(b,d,c){var a=JX.DOM.scry(b,d,c);if(!a.length)throw JX.$.NotFound;return a[0];},focus:function(b){try{b.focus();}catch(a){}},scrollTo:function(a){window.scrollTo(0,JX.$V(a).y);}}});JX.install('JSON',{statics:{serialize:function(a){return JX.JSON._zg(a);},_zg:function(d){var c=[];if(d===null){return 'null';}else if(d.push&&d.pop){for(var a=0;a<d.length;a++)if(typeof d[a]!='undefined')c.push(JX.JSON._zg(d[a]));return '['+c.join(',')+']';}else if(d===true){return 'true';}else if(d===false){return 'false';}else if(typeof d=='string'){return JX.JSON._zh(d);}else if(typeof d=='number'){return d;}else{for(var b in d)c.push(JX.JSON._zh(b)+':'+JX.JSON._zg(d[b]));return '{'+c.join(',')+'}';}},_zh:function(a){return '"'+a.replace(/\\/g,'\\\\').replace(/"/g,'\\"')+'"';}}});
+51 -38
webroot/rsrc/js/javelin/typeahead.dev.js
··· 86 86 'mousedown', 87 87 'tag:a', 88 88 JX.bind(this, function(e) { 89 - this._choose(e.getTarget()); 89 + this._choose(e.getNode('tag:a')); 90 90 e.prevent(); 91 91 })); 92 92 ··· 601 601 var n = Math.min(this.getMaximumResultCount(), hits.length); 602 602 var nodes = []; 603 603 for (var kk = 0; kk < n; kk++) { 604 - var data = this._raw[hits[kk]]; 605 - nodes.push(JX.$N( 606 - 'a', 607 - { 608 - href: data.uri, 609 - name: data.name, 610 - rel: data.id, 611 - className: 'jx-result' 612 - }, 613 - data.display)); 604 + nodes.push(this.createNode(this._raw[hits[kk]])); 614 605 } 615 606 616 607 this._typeahead.showResults(nodes); 617 608 }, 609 + 610 + createNode : function(data) { 611 + return JX.$N( 612 + 'a', 613 + { 614 + href: data.uri, 615 + name: data.name, 616 + rel: data.id, 617 + className: 'jx-result' 618 + }, 619 + data.display 620 + ); 621 + }, 622 + 618 623 normalize : function(str) { 619 624 return (this.getNormalizer() || JX.bag())(str); 620 625 }, ··· 850 855 this._tokens = []; 851 856 this._tokenMap = {}; 852 857 853 - var focus = JX.$N('input', { 854 - className: 'jx-tokenizer-input', 855 - type: 'text', 856 - value: this._orig.value 857 - }); 858 + var focus = this.buildInput(this._orig.value); 858 859 this._focus = focus; 859 860 860 861 JX.DOM.listen( ··· 870 871 JX.bind( 871 872 this, 872 873 function(e) { 873 - if (e.getNodes().remove) { 874 - this._remove(e.getData().token.key); 874 + if (e.getNode('remove')) { 875 + this._remove(e.getNodeData('token').key); 875 876 } else if (e.getTarget() == this._root) { 876 877 this.focus(); 877 878 } ··· 1011 1012 1012 1013 var focus = this._focus; 1013 1014 var root = this._root; 1014 - 1015 - var token = JX.$N('a', { 1016 - className: 'jx-tokenizer-token' 1017 - }, value); 1018 - 1019 - var input = JX.$N('input', { 1020 - type: 'hidden', 1021 - value: key, 1022 - name: this._orig.name+'['+(this._seq++)+']' 1023 - }); 1024 - 1025 - var remove = JX.$N('a', { 1026 - className: 'jx-tokenizer-x' 1027 - }, JX.HTML('&times;')); 1015 + var token = this.buildToken(key, value); 1028 1016 1029 1017 this._tokenMap[key] = { 1030 1018 value : value, ··· 1033 1021 }; 1034 1022 this._tokens.push(key); 1035 1023 1036 - JX.Stratcom.sigilize(token, 'token', {key : key}); 1037 - JX.Stratcom.sigilize(remove, 'remove'); 1038 - 1039 - token.appendChild(input); 1040 - token.appendChild(remove); 1041 - 1042 1024 root.insertBefore(token, focus); 1043 1025 1044 1026 return true; 1027 + }, 1028 + 1029 + buildInput: function(value) { 1030 + return JX.$N('input', { 1031 + className: 'jx-tokenizer-input', 1032 + type: 'text', 1033 + value: value 1034 + }); 1035 + }, 1036 + 1037 + /** 1038 + * Generate a token based on a key and value. The "token" and "remove" 1039 + * sigils are observed by a listener in start(). 1040 + */ 1041 + buildToken: function(key, value) { 1042 + var input = JX.$N('input', { 1043 + type: 'hidden', 1044 + value: key, 1045 + name: this._orig.name + '[' + (this._seq++) + ']' 1046 + }); 1047 + 1048 + var remove = JX.$N('a', { 1049 + className: 'jx-tokenizer-x', 1050 + sigil: 'remove' 1051 + }, JX.HTML('&times;')); 1052 + 1053 + return JX.$N('a', { 1054 + className: 'jx-tokenizer-token', 1055 + sigil: 'token', 1056 + meta: {key: key} 1057 + }, [value, input, remove]); 1045 1058 }, 1046 1059 1047 1060 getTokens : function() {
+1 -1
webroot/rsrc/js/javelin/typeahead.min.js
··· 1 1 /** @provides javelin-typeahead-prod */ 2 2 3 - JX.install('Typeahead',{construct:function(b,a){this._a=b;this._b=a||JX.DOM.find(b,'input');this._c=JX.$N('div',{className:'jx-typeahead-results'});this._d=[];JX.DOM.listen(this._b,['focus','blur','keypress','keydown'],null,JX.bind(this,this.handleEvent));JX.DOM.listen(this._c,['mouseover','mouseout'],null,JX.bind(this,this._e));JX.DOM.listen(this._c,'mousedown','tag:a',JX.bind(this,function(c){this._f(c.getTarget());c.prevent();}));},events:['choose','query','start','change'],properties:{allowNullSelection:true,normalizer:null},members:{_c:null,_b:null,_a:null,_g:null,_h:false,_i:-1,_d:null,start:function(){this.invoke('start');},setDatasource:function(a){a.bindToTypeahead(this);},setInputNode:function(a){this._b=a;return this;},hide:function(){this._j(Number.NEGATIVE_INFINITY);this._d=[];this._k=false;JX.DOM.setContent(this._c,'');JX.DOM.remove(this._c);},showResults:function(b){this._d=b;if(b.length){JX.DOM.setContent(this._c,b);this._j(Number.NEGATIVE_INFINITY);var a=JX.$V.getDim(this._a);a.x=0;a.setPos(this._c);this._a.appendChild(this._c);}else this.hide();},refresh:function(){if(this._h)return;this._g=this._b.value;!this.invoke('change',this._g).getPrevented();},waitForResults:function(){this.hide();},_e:function(event){this._k=(event.getType()=='mouseover');this._l();},_j:function(a){var b=Math.min(Math.max(-1,this._i+a),this._d.length-1);if(!this.getAllowNullSelection())b=Math.max(0,b);if(this._i>=0&&this._i<this._d.length)JX.DOM.alterClass(this._d[this._i],'focused',0);this._i=b;this._l();return true;},_l:function(){var a=this._d[this._i];if(a)JX.DOM.alterClass(a,'focused',!this._k);},_f:function(b){var a=this.invoke('choose',b);if(a.getPrevented())return;this._b.value=b.name;this.hide();},clear:function(){this._b.value='';this.hide();},disable:function(){this._b.blur();this._b.disabled=true;this._h=true;},submit:function(){if(this._i>=0&&this._d[this._i]){this._f(this._d[this._i]);return true;}else{result=this.invoke('query',this._b.value);if(result.getPrevented())return true;}return false;},setValue:function(a){this._b.value=a;},getValue:function(){return this._b.value;},_m:function(event){var a=event&&event.getSpecialKey();if(a&&event.getType()=='keydown')switch(a){case 'up':if(this._d.length&&this._j(-1))event.prevent();break;case 'down':if(this._d.length&&this._j(1))event.prevent();break;case 'return':if(this.submit()){event.prevent();return;}break;case 'esc':if(this._d.length&&this.getAllowNullSelection()){this.hide();event.prevent();}break;case 'tab':return;}JX.defer(JX.bind(this,function(){if(this._g==this._b.value)return;this.refresh();}));},handleEvent:function(a){if(this._h||a.getPrevented())return;var b=a.getType();if(b=='blur'){this.hide();}else this._m(a);}}});JX.install('TypeaheadNormalizer',{statics:{normalize:function(a){return (''+a).toLowerCase().replace(/[^a-z0-9 ]/g,'').replace(/ +/g,' ').replace(/^\s*|\s*$/g,'');}}});JX.install('TypeaheadSource',{construct:function(){this._n={};this._o={};this.setNormalizer(JX.TypeaheadNormalizer.normalize);},properties:{normalizer:null,transformer:null,maximumResultCount:5},members:{_n:null,_o:null,_p:null,_q:null,bindToTypeahead:function(a){this._p=a;a.listen('change',JX.bind(this,this.didChange));a.listen('start',JX.bind(this,this.didStart));},didChange:function(a){return;},didStart:function(){return;},addResult:function(b){b=(this.getTransformer()||this._r)(b);if(b.id in this._n)return;this._n[b.id]=b;var c=this.tokenize(b.name);for(var a=0;a<c.length;++a){this._o[c[a]]=this._o[c[a]]||[];this._o[c[a]].push(b.id);}},waitForResults:function(){this._p.waitForResults();return this;},matchResults:function(r){var i={};var j={};var l={};var p={};var q=this.tokenize(r);q.sort(function(s,t){return t.length-s.length;});for(var d=0;d<q.length;++d){if(q[d] in p){q.splice(d--,1);continue;}p[q[d]]=true;var b=q[d];for(var n in this._o)if(n.substr(0,b.length)===b){if(!(n in l)){l[n]=true;}else continue;var h=this._o[n];for(var e=0;e<h.length;++e){var k=h[e];if(!j[k])j[k]={};if(!(b in j[k])){j[k][b]=true;i[k]=(i[k]||0)+1;}}}}var c=[];for(var f in i)if(i[f]==q.length)c.push(f);var m=Math.min(this.getMaximumResultCount(),c.length);var o=[];for(var g=0;g<m;g++){var a=this._n[c[g]];o.push(JX.$N('a',{href:a.uri,name:a.name,rel:a.id,className:'jx-result'},a.display));}this._p.showResults(o);},normalize:function(a){return (this.getNormalizer()||JX.bag())(a);},tokenize:function(a){a=this.normalize(a);if(!a.length)return [];return a.split(/ /g);},_r:function(a){return {name:a[0],display:a[0],uri:a[1],id:a[2]};}}});JX.install('TypeaheadPreloadedSource',{extend:'TypeaheadSource',construct:function(a){this.__super__.call(this);this.uri=a;},members:{ready:false,uri:null,lastValue:null,didChange:function(a){if(this.ready){this.matchResults(a);}else{this.lastValue=a;this.waitForResults();}JX.Stratcom.context().kill();},didStart:function(){var a=new JX.Request(this.uri,JX.bind(this,this.ondata));a.setMethod('GET');a.send();},ondata:function(b){for(var a=0;a<b.length;++a)this.addResult(b[a]);if(this.lastValue!==null)this.matchResults(this.lastValue);this.ready=true;}}});JX.install('TypeaheadOnDemandSource',{extend:'TypeaheadSource',construct:function(a){this.__super__.call(this);this.uri=a;this.haveData={'':true};},properties:{queryDelay:125,auxiliaryData:{}},members:{uri:null,lastChange:null,haveData:null,didChange:function(a){if(JX.Stratcom.pass())return;this.lastChange=new Date().getTime();a=this.normalize(a);if(this.haveData[a]){this.matchResults(a);}else{this.waitForResults();JX.defer(JX.bind(this,this.sendRequest,this.lastChange,a),this.getQueryDelay());}JX.Stratcom.context().kill();},sendRequest:function(c,b){if(c!=this.lastChange)return;var a=new JX.Request(this.uri,JX.bind(this,this.ondata,this.lastChange,b));a.setMethod('GET');a.setData(JX.copy(this.getAuxiliaryData(),{q:b}));a.send();},ondata:function(d,c,b){for(var a=0;a<b.length;a++)this.addResult(b[a]);this.haveData[c]=true;if(d!=this.lastChange)return;this.matchResults(c);}}});JX.install('Tokenizer',{construct:function(a){this._s=a;},properties:{limit:null,nextInput:null},members:{_s:null,_c:null,_i:null,_t:null,_p:null,_u:0,_v:null,_w:null,_x:null,_y:0,_z:null,start:function(){this._t=JX.DOM.find(this._s,'input','tokenizer');this._v=[];this._w={};var a=JX.$N('input',{className:'jx-tokenizer-input',type:'text',value:this._t.value});this._i=a;JX.DOM.listen(a,['click','focus','blur','keydown'],null,JX.bind(this,this.handleEvent));JX.DOM.listen(this._s,'click',null,JX.bind(this,function(d){if(d.getNodes().remove){this._za(d.getData().token.key);}else if(d.getTarget()==this._c)this.focus();}));var b=JX.$N('div');b.id=this._t.id;JX.DOM.alterClass(b,'jx-tokenizer',true);b.style.cursor='text';this._c=b;b.appendChild(a);var c=this._p;c.setInputNode(this._i);c.start();JX.defer(JX.bind(this,function(){JX.DOM.setContent(this._t.parentNode,b);var e=this._x||{};for(var d in e)this.addToken(d,e[d]);this._zb();}));},setInitialValue:function(a){this._x=a;return this;},setTypeahead:function(a){a.setAllowNullSelection(false);a.listen('choose',JX.bind(this,function(b){JX.Stratcom.context().prevent();if(this.addToken(b.rel,b.name)){this._p.hide();this._i.value='';this._zb();this.focus();}}));a.listen('query',JX.bind(this,function(b){if(b.length)JX.Stratcom.context().prevent();}));this._p=a;return this;},handleEvent:function(a){this._p.handleEvent(a);if(a.getPrevented())return;if(a.getType()=='click'){if(a.getTarget()==this._c){this.focus();a.prevent();return;}}else if(a.getType()=='keydown'){this._zc(a);}else if(a.getType()=='blur')this._zb();},refresh:function(){this._zb(true);return this;},_zb:function(b){var a=this._i;if(a.value===this._z&&!b)return;this._z=a.value;var e=this._c;var d=JX.DOM.textMetrics(this._i,'jx-tokenizer-metrics');d.y=null;d.x+=24;d.setDim(a);a.value=a.value;var c=JX.$V(a).add(JX.$V.getDim(a)).y-JX.$V(e).y;e.style.height=c+'px';},addToken:function(c,g){if(c in this._w)return false;var a=this._i;var e=this._c;var f=JX.$N('a',{className:'jx-tokenizer-token'},g);var b=JX.$N('input',{type:'hidden',value:c,name:this._t.name+'['+(this._y++)+']'});var d=JX.$N('a',{className:'jx-tokenizer-x'},JX.HTML('&times;'));this._w[c]={value:g,key:c,node:f};this._v.push(c);JX.Stratcom.sigilize(f,'token',{key:c});JX.Stratcom.sigilize(d,'remove');f.appendChild(b);f.appendChild(d);e.insertBefore(f,a);return true;},getTokens:function(){var b={};for(var a in this._w)b[a]=this._w[a].value;return b;},_zc:function(b){var c=this._i;var d=this._c;switch(b.getSpecialKey()){case 'tab':var a=this._p.submit();if(this.getNextInput()){if(!a)this._i.value='';JX.defer(JX.bind(this,function(){this.getNextInput().focus();}));}break;case 'delete':if(!this._i.value.length){var e;while(e=this._v.pop())if(this._za(e))break;}break;case 'return':break;default:if(this.getLimit()&&JX.keys(this._w).length==this.getLimit())b.prevent();JX.defer(JX.bind(this,this._zb));break;}},_za:function(a){if(!this._w[a])return false;JX.DOM.remove(this._w[a].node);delete this._w[a];this._zb(true);this.focus();return true;},focus:function(){var a=this._i;JX.DOM.show(a);JX.defer(function(){JX.DOM.focus(a);});}}}); 3 + JX.install('Typeahead',{construct:function(b,a){this._a=b;this._b=a||JX.DOM.find(b,'input');this._c=JX.$N('div',{className:'jx-typeahead-results'});this._d=[];JX.DOM.listen(this._b,['focus','blur','keypress','keydown'],null,JX.bind(this,this.handleEvent));JX.DOM.listen(this._c,['mouseover','mouseout'],null,JX.bind(this,this._e));JX.DOM.listen(this._c,'mousedown','tag:a',JX.bind(this,function(c){this._f(c.getNode('tag:a'));c.prevent();}));},events:['choose','query','start','change'],properties:{allowNullSelection:true,normalizer:null},members:{_c:null,_b:null,_a:null,_g:null,_h:false,_i:-1,_d:null,start:function(){this.invoke('start');},setDatasource:function(a){a.bindToTypeahead(this);},setInputNode:function(a){this._b=a;return this;},hide:function(){this._j(Number.NEGATIVE_INFINITY);this._d=[];this._k=false;JX.DOM.setContent(this._c,'');JX.DOM.remove(this._c);},showResults:function(b){this._d=b;if(b.length){JX.DOM.setContent(this._c,b);this._j(Number.NEGATIVE_INFINITY);var a=JX.$V.getDim(this._a);a.x=0;a.setPos(this._c);this._a.appendChild(this._c);}else this.hide();},refresh:function(){if(this._h)return;this._g=this._b.value;!this.invoke('change',this._g).getPrevented();},waitForResults:function(){this.hide();},_e:function(event){this._k=(event.getType()=='mouseover');this._l();},_j:function(a){var b=Math.min(Math.max(-1,this._i+a),this._d.length-1);if(!this.getAllowNullSelection())b=Math.max(0,b);if(this._i>=0&&this._i<this._d.length)JX.DOM.alterClass(this._d[this._i],'focused',0);this._i=b;this._l();return true;},_l:function(){var a=this._d[this._i];if(a)JX.DOM.alterClass(a,'focused',!this._k);},_f:function(b){var a=this.invoke('choose',b);if(a.getPrevented())return;this._b.value=b.name;this.hide();},clear:function(){this._b.value='';this.hide();},disable:function(){this._b.blur();this._b.disabled=true;this._h=true;},submit:function(){if(this._i>=0&&this._d[this._i]){this._f(this._d[this._i]);return true;}else{result=this.invoke('query',this._b.value);if(result.getPrevented())return true;}return false;},setValue:function(a){this._b.value=a;},getValue:function(){return this._b.value;},_m:function(event){var a=event&&event.getSpecialKey();if(a&&event.getType()=='keydown')switch(a){case 'up':if(this._d.length&&this._j(-1))event.prevent();break;case 'down':if(this._d.length&&this._j(1))event.prevent();break;case 'return':if(this.submit()){event.prevent();return;}break;case 'esc':if(this._d.length&&this.getAllowNullSelection()){this.hide();event.prevent();}break;case 'tab':return;}JX.defer(JX.bind(this,function(){if(this._g==this._b.value)return;this.refresh();}));},handleEvent:function(a){if(this._h||a.getPrevented())return;var b=a.getType();if(b=='blur'){this.hide();}else this._m(a);}}});JX.install('TypeaheadNormalizer',{statics:{normalize:function(a){return (''+a).toLowerCase().replace(/[^a-z0-9 ]/g,'').replace(/ +/g,' ').replace(/^\s*|\s*$/g,'');}}});JX.install('TypeaheadSource',{construct:function(){this._n={};this._o={};this.setNormalizer(JX.TypeaheadNormalizer.normalize);},properties:{normalizer:null,transformer:null,maximumResultCount:5},members:{_n:null,_o:null,_p:null,_q:null,bindToTypeahead:function(a){this._p=a;a.listen('change',JX.bind(this,this.didChange));a.listen('start',JX.bind(this,this.didStart));},didChange:function(a){return;},didStart:function(){return;},addResult:function(b){b=(this.getTransformer()||this._r)(b);if(b.id in this._n)return;this._n[b.id]=b;var c=this.tokenize(b.name);for(var a=0;a<c.length;++a){this._o[c[a]]=this._o[c[a]]||[];this._o[c[a]].push(b.id);}},waitForResults:function(){this._p.waitForResults();return this;},matchResults:function(q){var h={};var i={};var k={};var o={};var p=this.tokenize(q);p.sort(function(r,s){return s.length-r.length;});for(var c=0;c<p.length;++c){if(p[c] in o){p.splice(c--,1);continue;}o[p[c]]=true;var a=p[c];for(var m in this._o)if(m.substr(0,a.length)===a){if(!(m in k)){k[m]=true;}else continue;var g=this._o[m];for(var d=0;d<g.length;++d){var j=g[d];if(!i[j])i[j]={};if(!(a in i[j])){i[j][a]=true;h[j]=(h[j]||0)+1;}}}}var b=[];for(var e in h)if(h[e]==p.length)b.push(e);var l=Math.min(this.getMaximumResultCount(),b.length);var n=[];for(var f=0;f<l;f++)n.push(this.createNode(this._n[b[f]]));this._p.showResults(n);},createNode:function(a){return JX.$N('a',{href:a.uri,name:a.name,rel:a.id,className:'jx-result'},a.display);},normalize:function(a){return (this.getNormalizer()||JX.bag())(a);},tokenize:function(a){a=this.normalize(a);if(!a.length)return [];return a.split(/ /g);},_r:function(a){return {name:a[0],display:a[0],uri:a[1],id:a[2]};}}});JX.install('TypeaheadPreloadedSource',{extend:'TypeaheadSource',construct:function(a){this.__super__.call(this);this.uri=a;},members:{ready:false,uri:null,lastValue:null,didChange:function(a){if(this.ready){this.matchResults(a);}else{this.lastValue=a;this.waitForResults();}JX.Stratcom.context().kill();},didStart:function(){var a=new JX.Request(this.uri,JX.bind(this,this.ondata));a.setMethod('GET');a.send();},ondata:function(b){for(var a=0;a<b.length;++a)this.addResult(b[a]);if(this.lastValue!==null)this.matchResults(this.lastValue);this.ready=true;}}});JX.install('TypeaheadOnDemandSource',{extend:'TypeaheadSource',construct:function(a){this.__super__.call(this);this.uri=a;this.haveData={'':true};},properties:{queryDelay:125,auxiliaryData:{}},members:{uri:null,lastChange:null,haveData:null,didChange:function(a){if(JX.Stratcom.pass())return;this.lastChange=new Date().getTime();a=this.normalize(a);if(this.haveData[a]){this.matchResults(a);}else{this.waitForResults();JX.defer(JX.bind(this,this.sendRequest,this.lastChange,a),this.getQueryDelay());}JX.Stratcom.context().kill();},sendRequest:function(c,b){if(c!=this.lastChange)return;var a=new JX.Request(this.uri,JX.bind(this,this.ondata,this.lastChange,b));a.setMethod('GET');a.setData(JX.copy(this.getAuxiliaryData(),{q:b}));a.send();},ondata:function(d,c,b){for(var a=0;a<b.length;a++)this.addResult(b[a]);this.haveData[c]=true;if(d!=this.lastChange)return;this.matchResults(c);}}});JX.install('Tokenizer',{construct:function(a){this._s=a;},properties:{limit:null,nextInput:null},members:{_s:null,_c:null,_i:null,_t:null,_p:null,_u:0,_v:null,_w:null,_x:null,_y:0,_z:null,start:function(){this._t=JX.DOM.find(this._s,'input','tokenizer');this._v=[];this._w={};var a=this.buildInput(this._t.value);this._i=a;JX.DOM.listen(a,['click','focus','blur','keydown'],null,JX.bind(this,this.handleEvent));JX.DOM.listen(this._s,'click',null,JX.bind(this,function(d){if(d.getNode('remove')){this._za(d.getNodeData('token').key);}else if(d.getTarget()==this._c)this.focus();}));var b=JX.$N('div');b.id=this._t.id;JX.DOM.alterClass(b,'jx-tokenizer',true);b.style.cursor='text';this._c=b;b.appendChild(a);var c=this._p;c.setInputNode(this._i);c.start();JX.defer(JX.bind(this,function(){JX.DOM.setContent(this._t.parentNode,b);var e=this._x||{};for(var d in e)this.addToken(d,e[d]);this._zb();}));},setInitialValue:function(a){this._x=a;return this;},setTypeahead:function(a){a.setAllowNullSelection(false);a.listen('choose',JX.bind(this,function(b){JX.Stratcom.context().prevent();if(this.addToken(b.rel,b.name)){this._p.hide();this._i.value='';this._zb();this.focus();}}));a.listen('query',JX.bind(this,function(b){if(b.length)JX.Stratcom.context().prevent();}));this._p=a;return this;},handleEvent:function(a){this._p.handleEvent(a);if(a.getPrevented())return;if(a.getType()=='click'){if(a.getTarget()==this._c){this.focus();a.prevent();return;}}else if(a.getType()=='keydown'){this._zc(a);}else if(a.getType()=='blur')this._zb();},refresh:function(){this._zb(true);return this;},_zb:function(b){var a=this._i;if(a.value===this._z&&!b)return;this._z=a.value;var e=this._c;var d=JX.DOM.textMetrics(this._i,'jx-tokenizer-metrics');d.y=null;d.x+=24;d.setDim(a);a.value=a.value;var c=JX.$V(a).add(JX.$V.getDim(a)).y-JX.$V(e).y;e.style.height=c+'px';},addToken:function(b,e){if(b in this._w)return false;var a=this._i;var c=this._c;var d=this.buildToken(b,e);this._w[b]={value:e,key:b,node:d};this._v.push(b);c.insertBefore(d,a);return true;},buildInput:function(a){return JX.$N('input',{className:'jx-tokenizer-input',type:'text',value:a});},buildToken:function(b,d){var a=JX.$N('input',{type:'hidden',value:b,name:this._t.name+'['+(this._y++)+']'});var c=JX.$N('a',{className:'jx-tokenizer-x',sigil:'remove'},JX.HTML('&times;'));return JX.$N('a',{className:'jx-tokenizer-token',sigil:'token',meta:{key:b}},[d,a,c]);},getTokens:function(){var b={};for(var a in this._w)b[a]=this._w[a].value;return b;},_zc:function(b){var c=this._i;var d=this._c;switch(b.getSpecialKey()){case 'tab':var a=this._p.submit();if(this.getNextInput()){if(!a)this._i.value='';JX.defer(JX.bind(this,function(){this.getNextInput().focus();}));}break;case 'delete':if(!this._i.value.length){var e;while(e=this._v.pop())if(this._za(e))break;}break;case 'return':break;default:if(this.getLimit()&&JX.keys(this._w).length==this.getLimit())b.prevent();JX.defer(JX.bind(this,this._zb));break;}},_za:function(a){if(!this._w[a])return false;JX.DOM.remove(this._w[a].node);delete this._w[a];this._zb(true);this.focus();return true;},focus:function(){var a=this._i;JX.DOM.show(a);JX.defer(function(){JX.DOM.focus(a);});}}});
+239
webroot/rsrc/js/javelin/workflow.dev.js
··· 1 + /** @provides javelin-workflow-dev */ 2 + 3 + /** 4 + * @requires javelin-install javelin-vector javelin-dom 5 + * @provides javelin-mask 6 + * @javelin 7 + */ 8 + 9 + /** 10 + * Show a transparent "mask" over the page; used by Workflow to draw visual 11 + * attention to modal dialogs. 12 + */ 13 + JX.install('Mask', { 14 + statics : { 15 + _depth : 0, 16 + _mask : null, 17 + show : function() { 18 + if (!JX.Mask._depth) { 19 + JX.Mask._mask = JX.$N('div', {className: 'jx-mask'}); 20 + document.body.appendChild(JX.Mask._mask); 21 + JX.$V.getDocument().setDim(JX.Mask._mask); 22 + } 23 + ++JX.Mask._depth; 24 + }, 25 + hide : function() { 26 + --JX.Mask._depth; 27 + if (!JX.Mask._depth) { 28 + JX.DOM.remove(JX.Mask._mask); 29 + JX.Mask._mask = null; 30 + } 31 + } 32 + } 33 + }); 34 + /** 35 + * @requires javelin-stratcom 36 + * javelin-request 37 + * javelin-dom 38 + * javelin-vector 39 + * javelin-install 40 + * javelin-util 41 + * javelin-mask 42 + * @provides javelin-workflow 43 + * @javelin 44 + */ 45 + 46 + JX.install('Workflow', { 47 + construct : function(uri, data) { 48 + if (__DEV__) { 49 + if (!uri || uri == '#') { 50 + throw new Error( 51 + 'new JX.Workflow(<?>, ...): '+ 52 + 'bogus URI provided when creating workflow.'); 53 + } 54 + } 55 + this.setURI(uri); 56 + this.setData(data || {}); 57 + }, 58 + 59 + events : ['error', 'finally', 'submit'], 60 + 61 + statics : { 62 + _stack : [], 63 + newFromForm : function(form, data) { 64 + var inputs = [].concat( 65 + JX.DOM.scry(form, 'input'), 66 + JX.DOM.scry(form, 'button'), 67 + JX.DOM.scry(form, 'textarea')); 68 + 69 + for (var ii = 0; ii < inputs.length; ii++) { 70 + if (inputs[ii].disabled) { 71 + delete inputs[ii]; 72 + } else { 73 + inputs[ii].disabled = true; 74 + } 75 + } 76 + 77 + var workflow = new JX.Workflow( 78 + form.getAttribute('action'), 79 + JX.copy(data || {}, JX.DOM.serialize(form))); 80 + workflow.setMethod(form.getAttribute('method')); 81 + workflow.listen('finally', function() { 82 + for (var ii = 0; ii < inputs.length; ii++) { 83 + inputs[ii] && (inputs[ii].disabled = false); 84 + } 85 + }); 86 + return workflow; 87 + }, 88 + newFromLink : function(link) { 89 + var workflow = new JX.Workflow(link.href); 90 + return workflow; 91 + }, 92 + _push : function(workflow) { 93 + JX.Mask.show(); 94 + JX.Workflow._stack.push(workflow); 95 + }, 96 + _pop : function() { 97 + var dialog = JX.Workflow._stack.pop(); 98 + (dialog.getCloseHandler() || JX.bag)(); 99 + dialog._destroy(); 100 + JX.Mask.hide(); 101 + }, 102 + disable : function() { 103 + JX.Workflow._disabled = true; 104 + }, 105 + _onbutton : function(event) { 106 + 107 + if (JX.Stratcom.pass()) { 108 + return; 109 + } 110 + 111 + if (JX.Workflow._disabled) { 112 + return; 113 + } 114 + var t = event.getTarget(); 115 + if (t.name == '__cancel__' || t.name == '__close__') { 116 + JX.Workflow._pop(); 117 + } else { 118 + 119 + var form = event.getNode('jx-dialog'); 120 + var data = JX.DOM.serialize(form); 121 + data[t.name] = true; 122 + data.__wflow__ = true; 123 + 124 + var active = JX.Workflow._stack[JX.Workflow._stack.length - 1]; 125 + var e = active.invoke('submit', {form: form, data: data}); 126 + if (!e.getStopped()) { 127 + active._destroy(); 128 + active 129 + .setURI(form.getAttribute('action') || active.getURI()) 130 + .setData(data) 131 + .start(); 132 + } 133 + } 134 + event.prevent(); 135 + } 136 + }, 137 + 138 + members : { 139 + _root : null, 140 + _pushed : false, 141 + _onload : function(r) { 142 + // It is permissible to send back a falsey redirect to force a page 143 + // reload, so we need to take this branch if the key is present. 144 + if (r && (typeof r.redirect != 'undefined')) { 145 + JX.go(r.redirect, true); 146 + } else if (r && r.dialog) { 147 + this._push(); 148 + this._root = JX.$N( 149 + 'div', 150 + {className: 'jx-client-dialog'}, 151 + JX.HTML(r.dialog)); 152 + JX.DOM.listen( 153 + this._root, 154 + 'click', 155 + 'tag:button', 156 + JX.Workflow._onbutton); 157 + document.body.appendChild(this._root); 158 + var d = JX.$V.getDim(this._root); 159 + var v = JX.$V.getViewport(); 160 + var s = JX.$V.getScroll(); 161 + JX.$V((v.x - d.x) / 2, s.y + 100).setPos(this._root); 162 + try { 163 + JX.DOM.focus(JX.DOM.find(this._root, 'button', '__default__')); 164 + var inputs = JX.DOM.scry(this._root, 'input') 165 + .concat(JX.DOM.scry(this._root, 'textarea')); 166 + var miny = Number.POSITIVE_INFINITY; 167 + var target = null; 168 + for (var ii = 0; ii < inputs.length; ++ii) { 169 + if (inputs[ii].type != 'hidden') { 170 + // Find the topleft-most displayed element. 171 + var p = JX.$V(inputs[ii]); 172 + if (p.y < miny) { 173 + miny = p.y; 174 + target = inputs[ii]; 175 + } 176 + } 177 + } 178 + target && JX.DOM.focus(target); 179 + } catch (_ignored) {} 180 + } else if (this.getHandler()) { 181 + this.getHandler()(r); 182 + this._pop(); 183 + } else if (r) { 184 + if (__DEV__) { 185 + throw new Error('Response to workflow request went unhandled.'); 186 + } 187 + } 188 + }, 189 + _push : function() { 190 + if (!this._pushed) { 191 + this._pushed = true; 192 + JX.Workflow._push(this); 193 + } 194 + }, 195 + _pop : function() { 196 + if (this._pushed) { 197 + this._pushed = false; 198 + JX.Workflow._pop(); 199 + } 200 + }, 201 + _destroy : function() { 202 + if (this._root) { 203 + JX.DOM.remove(this._root); 204 + this._root = null; 205 + } 206 + }, 207 + start : function() { 208 + var uri = this.getURI(); 209 + var method = this.getMethod(); 210 + var r = new JX.Request(uri, JX.bind(this, this._onload)); 211 + r.setData(this.getData()); 212 + r.setDataSerializer(this.getDataSerializer()); 213 + if (method) { 214 + r.setMethod(method); 215 + } 216 + r.listen('finally', JX.bind(this, this.invoke, 'finally')); 217 + r.listen('error', JX.bind(this, function(error) { 218 + var e = this.invoke('error', error); 219 + if (e.getStopped()) { 220 + return; 221 + } 222 + // TODO: Default error behavior? On Facebook Lite, we just shipped the 223 + // user to "/error/". We could emit a blanket 'workflow-failed' type 224 + // event instead. 225 + })); 226 + r.send(); 227 + } 228 + }, 229 + 230 + properties : { 231 + handler : null, 232 + closeHandler : null, 233 + data : null, 234 + dataSerializer : null, 235 + method : null, 236 + URI : null 237 + } 238 + 239 + });
+3
webroot/rsrc/js/javelin/workflow.min.js
··· 1 + /** @provides javelin-workflow-prod */ 2 + 3 + JX.install('Mask',{statics:{_a:0,_b:null,show:function(){if(!JX.Mask._a){JX.Mask._b=JX.$N('div',{className:'jx-mask'});document.body.appendChild(JX.Mask._b);JX.$V.getDocument().setDim(JX.Mask._b);}++JX.Mask._a;},hide:function(){--JX.Mask._a;if(!JX.Mask._a){JX.DOM.remove(JX.Mask._b);JX.Mask._b=null;}}}});JX.install('Workflow',{construct:function(b,a){this.setURI(b);this.setData(a||{});},events:['error','finally','submit'],statics:{_c:[],newFromForm:function(b,a){var d=[].concat(JX.DOM.scry(b,'input'),JX.DOM.scry(b,'button'),JX.DOM.scry(b,'textarea'));for(var c=0;c<d.length;c++)if(d[c].disabled){delete d[c];}else d[c].disabled=true;var e=new JX.Workflow(b.getAttribute('action'),JX.copy(a||{},JX.DOM.serialize(b)));e.setMethod(b.getAttribute('method'));e.listen('finally',function(){for(var f=0;f<d.length;f++)d[f]&&(d[f].disabled=false);});return e;},newFromLink:function(a){var b=new JX.Workflow(a.href);return b;},_d:function(a){JX.Mask.show();JX.Workflow._c.push(a);},_e:function(){var a=JX.Workflow._c.pop();(a.getCloseHandler()||JX.bag)();a._f();JX.Mask.hide();},disable:function(){JX.Workflow._g=true;},_h:function(event){if(JX.Stratcom.pass())return;if(JX.Workflow._g)return;var e=event.getTarget();if(e.name=='__cancel__'||e.name=='__close__'){JX.Workflow._e();}else{var d=event.getNode('jx-dialog');var b=JX.DOM.serialize(d);b[e.name]=true;b.__wflow__=true;var a=JX.Workflow._c[JX.Workflow._c.length-1];var c=a.invoke('submit',{form:d,data:b});if(!c.getStopped()){a._f();a.setURI(d.getAttribute('action')||a.getURI()).setData(b).start();}}event.prevent();}},members:{_i:null,_j:false,_k:function(c){if(c&&(typeof c.redirect!='undefined')){JX.go(c.redirect,true);}else if(c&&c.dialog){this._d();this._i=JX.$N('div',{className:'jx-client-dialog'},JX.HTML(c.dialog));JX.DOM.listen(this._i,'click','tag:button',JX.Workflow._h);document.body.appendChild(this._i);var b=JX.$V.getDim(this._i);var e=JX.$V.getViewport();var d=JX.$V.getScroll();JX.$V((e.x-b.x)/2,d.y+100).setPos(this._i);try{JX.DOM.focus(JX.DOM.find(this._i,'button','__default__'));var inputs=JX.DOM.scry(this._i,'input').concat(JX.DOM.scry(this._i,'textarea'));var miny=Number.POSITIVE_INFINITY;var target=null;for(var ii=0;ii<inputs.length;++ii)if(inputs[ii].type!='hidden'){var p=JX.$V(inputs[ii]);if(p.y<miny){miny=p.y;target=inputs[ii];}}target&&JX.DOM.focus(target);}catch(a){}}else if(this.getHandler()){this.getHandler()(c);this._e();}},_d:function(){if(!this._j){this._j=true;JX.Workflow._d(this);}},_e:function(){if(this._j){this._j=false;JX.Workflow._e();}},_f:function(){if(this._i){JX.DOM.remove(this._i);this._i=null;}},start:function(){var c=this.getURI();var a=this.getMethod();var b=new JX.Request(c,JX.bind(this,this._k));b.setData(this.getData());b.setDataSerializer(this.getDataSerializer());if(a)b.setMethod(a);b.listen('finally',JX.bind(this,this.invoke,'finally'));b.listen('error',JX.bind(this,function(e){var d=this.invoke('error',e);if(d.getStopped())return;}));b.send();}},properties:{handler:null,closeHandler:null,data:null,dataSerializer:null,method:null,URI:null}});