diff --git a/resources/celerity/map.php b/resources/celerity/map.php --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -8,7 +8,7 @@ 'names' => array( 'core.pkg.css' => '22e4fc33', - 'core.pkg.js' => '941224f2', + 'core.pkg.js' => 'f5ba2408', 'darkconsole.pkg.js' => 'df001cab', 'differential.pkg.css' => '4a93db37', 'differential.pkg.js' => 'd1443567', @@ -346,9 +346,9 @@ 'rsrc/image/texture/table_header.png' => '5c433037', 'rsrc/image/texture/table_header_hover.png' => '038ec3b9', 'rsrc/image/texture/table_header_tall.png' => 'd56b434f', - 'rsrc/js/application/aphlict/Aphlict.js' => '08be8878', + 'rsrc/js/application/aphlict/Aphlict.js' => 'da12704d', 'rsrc/js/application/aphlict/behavior-aphlict-dropdown.js' => '862ea0fe', - 'rsrc/js/application/aphlict/behavior-aphlict-listen.js' => 'bdb2032d', + 'rsrc/js/application/aphlict/behavior-aphlict-listen.js' => 'a826c925', 'rsrc/js/application/auth/behavior-persona-login.js' => '9414ff18', 'rsrc/js/application/config/behavior-reorder-fields.js' => '14a827de', 'rsrc/js/application/conpherence/behavior-menu.js' => 'f0a41b9f', @@ -490,7 +490,7 @@ 'rsrc/js/phuix/PHUIXActionListView.js' => 'b5c256b8', 'rsrc/js/phuix/PHUIXActionView.js' => '6e8cefa4', 'rsrc/js/phuix/PHUIXDropdownMenu.js' => 'bd4c8dca', - 'rsrc/swf/aphlict.swf' => '14d5aa2e', + 'rsrc/swf/aphlict.swf' => 'ef64606d', ), 'symbols' => array( @@ -539,10 +539,10 @@ 'herald-rule-editor' => '6c9e6fb8', 'herald-test-css' => '778b008e', 'inline-comment-summary-css' => '8cfd34e8', - 'javelin-aphlict' => '08be8878', + 'javelin-aphlict' => 'da12704d', 'javelin-behavior' => '8a3ed18b', 'javelin-behavior-aphlict-dropdown' => '862ea0fe', - 'javelin-behavior-aphlict-listen' => 'bdb2032d', + 'javelin-behavior-aphlict-listen' => 'a826c925', 'javelin-behavior-aphront-basic-tokenizer' => 'b3a4b884', 'javelin-behavior-aphront-crop' => 'fa0f4fc2', 'javelin-behavior-aphront-drag-and-drop-textarea' => '92eb531d', @@ -878,11 +878,6 @@ 3 => 'javelin-vector', 4 => 'javelin-stratcom', ), - '08be8878' => - array( - 0 => 'javelin-install', - 1 => 'javelin-util', - ), '08e56a4e' => array( 0 => 'javelin-install', @@ -1279,6 +1274,13 @@ 1 => 'javelin-stratcom', 2 => 'javelin-dom', ), + '62e18640' => + array( + 0 => 'javelin-install', + 1 => 'javelin-util', + 2 => 'javelin-dom', + 3 => 'javelin-typeahead-normalizer', + ), '6453c869' => array( 0 => 'javelin-install', @@ -1357,13 +1359,6 @@ 0 => 'javelin-behavior', 1 => 'javelin-dom', ), - '62e18640' => - array( - 0 => 'javelin-install', - 1 => 'javelin-util', - 2 => 'javelin-dom', - 3 => 'javelin-typeahead-normalizer', - ), '76b9fc3e' => array( 0 => 'javelin-behavior', @@ -1642,6 +1637,19 @@ 1 => 'javelin-stratcom', 2 => 'javelin-dom', ), + 'a826c925' => + array( + 0 => 'javelin-behavior', + 1 => 'javelin-aphlict', + 2 => 'javelin-stratcom', + 3 => 'javelin-request', + 4 => 'javelin-uri', + 5 => 'javelin-dom', + 6 => 'javelin-json', + 7 => 'javelin-router', + 8 => 'javelin-util', + 9 => 'phabricator-notification', + ), 'a82a7769' => array( 0 => 'javelin-behavior', @@ -1794,18 +1802,6 @@ 2 => 'javelin-util', 3 => 'javelin-request', ), - 'bdb2032d' => - array( - 0 => 'javelin-behavior', - 1 => 'javelin-aphlict', - 2 => 'javelin-stratcom', - 3 => 'javelin-request', - 4 => 'javelin-uri', - 5 => 'javelin-dom', - 6 => 'javelin-json', - 7 => 'javelin-router', - 8 => 'phabricator-notification', - ), 'bdb3e4d0' => array( 0 => 'javelin-behavior', @@ -1925,6 +1921,11 @@ 1 => 'javelin-util', 2 => 'javelin-stratcom', ), + 'da12704d' => + array( + 0 => 'javelin-install', + 1 => 'javelin-util', + ), 'dd7e8ef5' => array( 0 => 'javelin-behavior', diff --git a/support/aphlict/client/src/Aphlict.as b/support/aphlict/client/src/Aphlict.as --- a/support/aphlict/client/src/Aphlict.as +++ b/support/aphlict/client/src/Aphlict.as @@ -42,6 +42,10 @@ this.externalInvoke('log', message); } + final protected function setStatus(status:String):void { + this.externalInvoke('status', {type: status}); + } + } } diff --git a/support/aphlict/client/src/AphlictClient.as b/support/aphlict/client/src/AphlictClient.as --- a/support/aphlict/client/src/AphlictClient.as +++ b/support/aphlict/client/src/AphlictClient.as @@ -42,11 +42,8 @@ this.uncaughtErrorHandler); ExternalInterface.addCallback('connect', this.externalConnect); - ExternalInterface.call( - 'JX.Stratcom.invoke', - 'aphlict-component-ready', - null, - {}); + + this.setStatus('ready'); } private function uncaughtErrorHandler(event:UncaughtErrorEvent):void { @@ -58,8 +55,6 @@ port:Number, subscriptions:Array):void { - this.externalInvoke('connect'); - this.remoteServer = server; this.remotePort = port; this.subscriptions = subscriptions; diff --git a/webroot/rsrc/js/application/aphlict/Aphlict.js b/webroot/rsrc/js/application/aphlict/Aphlict.js --- a/webroot/rsrc/js/application/aphlict/Aphlict.js +++ b/webroot/rsrc/js/application/aphlict/Aphlict.js @@ -25,51 +25,87 @@ */ JX.install('Aphlict', { - construct : function(id, server, port, subscriptions) { + construct: function(id, server, port, subscriptions) { if (__DEV__) { if (JX.Aphlict._instance) { - JX.$E('Aphlict object is sort of a singleton..!'); + JX.$E('Aphlict object is a singleton!'); } } - JX.Aphlict._instance = this; - + this._id = id; this._server = server; this._port = port; this._subscriptions = subscriptions; - // Flash puts its "objects" into global scope in an inconsistent way, - // because it was written in like 1816 when globals were awesome and IE4 - // didn't support other scopes since global scope is the best anyway. - var container = document[id] || window[id]; - - this._flashContainer = container; + JX.Aphlict._instance = this; }, - members : { - _server : null, - _port : null, - _subscriptions : null, - start : function() { + members: { + _id: null, + _server: null, + _port: null, + _subscriptions: null, + + start: function(node, uri) { + // NOTE: This is grotesque, but seems to work everywhere. + node.innerHTML = + '' + + '' + + '' + + '' + + '' + + '' + + ''; + }, + + _didStartFlash: function() { + var id = this._id; + + // Flash puts its "objects" into global scope in an inconsistent way, + // because it was written in like 1816 when globals were awesome and IE4 + // didn't support other scopes since global scope is the best anyway. + var container = document[id] || window[id]; + + this._flashContainer = container; this._flashContainer.connect( this._server, this._port, this._subscriptions); } + }, - properties : { - handler : null + properties: { + handler: null }, - statics : { - _instance : null, - didReceiveEvent : function(type, message) { - if (!JX.Aphlict._instance) { + statics: { + _instance: null, + + getInstance: function() { + var self = JX.Aphlict; + if (!self._instance) { + return null; + } + return self._instance; + }, + + didReceiveEvent: function(type, message) { + var client = JX.Aphlict.getInstance(); + if (!client) { return; } - var handler = JX.Aphlict._instance.getHandler(); + if (type == 'status') { + switch (message.type) { + case 'ready': + client._didStartFlash(); + break; + } + } + + var handler = client.getHandler(); if (handler) { handler(type, message); } diff --git a/webroot/rsrc/js/application/aphlict/behavior-aphlict-listen.js b/webroot/rsrc/js/application/aphlict/behavior-aphlict-listen.js --- a/webroot/rsrc/js/application/aphlict/behavior-aphlict-listen.js +++ b/webroot/rsrc/js/application/aphlict/behavior-aphlict-listen.js @@ -16,18 +16,6 @@ var showing_reload = false; - function onready() { - var client = new JX.Aphlict( - config.id, - config.server, - config.port, - config.subscriptions); - - client - .setHandler(onaphlictmessage) - .start(); - } - JX.Stratcom.listen('aphlict-receive-message', null, function(e) { var message = e.getData(); @@ -61,6 +49,8 @@ default: case 'error': + case 'log': + case 'status': if (config.debug) { var details = message ? JX.JSON.stringify(message) : ''; JX.log('(Aphlict) [' + type + '] ' + details); @@ -98,19 +88,14 @@ } } + var client = new JX.Aphlict( + config.id, + config.server, + config.port, + config.subscriptions); + + client + .setHandler(onaphlictmessage) + .start(JX.$(config.containerID), config.swfURI); - // Wait for the element to load, and don't do anything if it never loads. - // If we just go crazy and start making calls to it before it loads, its - // interfaces won't be registered yet. - JX.Stratcom.listen('aphlict-component-ready', null, onready); - - // Add Flash object to page - JX.$(config.containerID).innerHTML = - '' + - '' + - '' + - '' + - '' + - ''; //Evan sanctioned }); diff --git a/webroot/rsrc/swf/aphlict.swf b/webroot/rsrc/swf/aphlict.swf index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 GIT binary patch literal 0 Hc$@