mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-09 16:32:39 +01:00
Use JsShrink
if jsxmin
is not available
Summary: If `jsxmin` is not available, use a pure PHP implementation instead (JsShrink). Test Plan: - Ran `arc lint --lintall` on all JS and fixed every relevant warning. - Forced minification on and browsed around the site using JS behaviors. Didn't hit anything problematic. Reviewers: vrana, btrahan Reviewed By: vrana CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D5670
This commit is contained in:
parent
b09dc9cad8
commit
0569218201
94 changed files with 598 additions and 501 deletions
|
@ -6,5 +6,6 @@
|
|||
"phutil_libraries" : {
|
||||
"phabricator" : "src/"
|
||||
},
|
||||
"lint.xhpast.naminghook" : "PhabricatorSymbolNameLinter"
|
||||
"lint.xhpast.naminghook" : "PhabricatorSymbolNameLinter",
|
||||
"lint.jshint.config" : "support/jshint/jshintconfig"
|
||||
}
|
||||
|
|
45
externals/JsShrink/jsShrink.php
vendored
Normal file
45
externals/JsShrink/jsShrink.php
vendored
Normal file
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
/** Remove spaces and comments from JavaScript code
|
||||
* @param string code with commands terminated by semicolon
|
||||
* @return string shrinked code
|
||||
* @link http://vrana.github.com/JsShrink/
|
||||
* @author Jakub Vrana, http://www.vrana.cz/
|
||||
* @copyright 2007 Jakub Vrana
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
|
||||
*/
|
||||
function jsShrink($input) {
|
||||
return preg_replace_callback('(
|
||||
(?:
|
||||
(^|[-+\([{}=,:;!%^&*|?~]|/(?![/*])|return|throw) # context before regexp
|
||||
(?:\s|//[^\n]*+\n|/\*(?:[^*]|\*(?!/))*+\*/)* # optional space
|
||||
(/(?![/*])(?:\\\\[^\n]|[^[\n/\\\\]|\[(?:\\\\[^\n]|[^]])++)+/) # regexp
|
||||
|(^
|
||||
|\'(?:\\\\.|[^\n\'\\\\])*\'
|
||||
|"(?:\\\\.|[^\n"\\\\])*"
|
||||
|([0-9A-Za-z_$]+)
|
||||
|([-+]+)
|
||||
|.
|
||||
)
|
||||
)(?:\s|//[^\n]*+\n|/\*(?:[^*]|\*(?!/))*+\*/)* # optional space
|
||||
)sx', 'jsShrinkCallback', "$input\n");
|
||||
}
|
||||
|
||||
function jsShrinkCallback($match) {
|
||||
static $last = '';
|
||||
$match += array_fill(1, 5, null); // avoid E_NOTICE
|
||||
list(, $context, $regexp, $result, $word, $operator) = $match;
|
||||
if ($word != '') {
|
||||
$result = ($last == 'word' ? "\n" : ($last == 'return' ? " " : "")) . $result;
|
||||
$last = ($word == 'return' || $word == 'throw' || $word == 'break' ? 'return' : 'word');
|
||||
} elseif ($operator) {
|
||||
$result = ($last == $operator[0] ? "\n" : "") . $result;
|
||||
$last = $operator[0];
|
||||
} else {
|
||||
if ($regexp) {
|
||||
$result = $context . ($context == '/' ? "\n" : "") . $regexp;
|
||||
}
|
||||
$last = '';
|
||||
}
|
||||
return $result;
|
||||
}
|
23
externals/JsShrink/readme.txt
vendored
Normal file
23
externals/JsShrink/readme.txt
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
JsShrink - Remove spaces and comments from JavaScript code
|
||||
Available in PHP and JavaScript
|
||||
Requires statements ending by semicolon, use JSHint or JSLint to verify.
|
||||
|
||||
http://vrana.github.com/JsShrink/
|
||||
|
||||
Usage PHP:
|
||||
<?php
|
||||
include "jsShrink.php";
|
||||
echo jsShrink($code);
|
||||
?>
|
||||
|
||||
Usage JavaScript:
|
||||
<script type="text/javascript" src="jsShrink.js"></script>
|
||||
<script type="text/javascript">
|
||||
textarea.value = jsShrink(code);
|
||||
</script>
|
||||
|
||||
Note:
|
||||
Google Closure Compiler is much more powerful and efficient tool.
|
||||
JsShrink was created for those looking for PHP or JavaScript only solution.
|
||||
Most other JS minifiers are not able to process valid JavaScript code:
|
||||
http://php.vrana.cz/minifikace-javascriptu.php#srovnani
|
File diff suppressed because it is too large
Load diff
|
@ -30,6 +30,9 @@ final class CelerityResourceTransformer {
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @phutil-external-symbol function jsShrink
|
||||
*/
|
||||
public function transformResource($path, $data) {
|
||||
$type = self::getResourceType($path);
|
||||
|
||||
|
@ -70,17 +73,25 @@ final class CelerityResourceTransformer {
|
|||
$data = trim($data);
|
||||
break;
|
||||
case 'js':
|
||||
$root = dirname(phutil_get_library_root('phabricator'));
|
||||
$bin = $root.'/externals/javelin/support/jsxmin/jsxmin';
|
||||
|
||||
if (@file_exists($bin)) {
|
||||
$future = new ExecFuture('%s __DEV__:0', $bin);
|
||||
// If `jsxmin` is available, use it. jsxmin is the Javelin minifier and
|
||||
// produces the smallest output, but is complicated to build.
|
||||
if (Filesystem::binaryExists('jsxmin')) {
|
||||
$future = new ExecFuture('jsxmin __DEV__:0');
|
||||
$future->write($data);
|
||||
list($err, $result) = $future->resolve();
|
||||
if (!$err) {
|
||||
$data = $result;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// If `jsxmin` is not available, use `JsShrink`, which doesn't compress
|
||||
// quite as well but is always available.
|
||||
$root = dirname(phutil_get_library_root('phabricator'));
|
||||
require_once $root.'/externals/JsShrink/jsShrink.php';
|
||||
$data = jsShrink($data);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,17 +37,36 @@ class PhabricatorLintEngine extends PhutilLintEngine {
|
|||
$javelin_linter = new PhabricatorJavelinLinter();
|
||||
$linters[] = $javelin_linter;
|
||||
|
||||
$jshint_linter = new ArcanistJSHintLinter();
|
||||
$linters[] = $jshint_linter;
|
||||
|
||||
foreach ($paths as $path) {
|
||||
if (!preg_match('/\.js$/', $path)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strpos($path, 'externals/JsShrink') !== false) {
|
||||
// Ignore warnings in JsShrink tests.
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strpos($path, 'externals/raphael') !== false) {
|
||||
// Ignore Raphael.
|
||||
continue;
|
||||
}
|
||||
|
||||
$jshint_linter->addPath($path);
|
||||
$jshint_linter->addData($path, $this->loadData($path));
|
||||
|
||||
if (strpos($path, 'support/aphlict/') !== false) {
|
||||
// This stuff is Node.js, not Javelin, so don't apply the Javelin
|
||||
// linter.
|
||||
continue;
|
||||
}
|
||||
if (preg_match('/\.js$/', $path)) {
|
||||
|
||||
$javelin_linter->addPath($path);
|
||||
$javelin_linter->addData($path, $this->loadData($path));
|
||||
}
|
||||
}
|
||||
|
||||
return $linters;
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ final class PhabricatorJavelinLinter extends ArcanistLinter {
|
|||
}
|
||||
|
||||
private function shouldIgnorePath($path) {
|
||||
return preg_match('@/__tests__/|externals/javelinjs/src/docs/@', $path);
|
||||
return preg_match('@/__tests__/|externals/javelin/docs/@', $path);
|
||||
}
|
||||
|
||||
public function lintPath($path) {
|
||||
|
@ -167,6 +167,10 @@ final class PhabricatorJavelinLinter extends ArcanistLinter {
|
|||
continue;
|
||||
}
|
||||
|
||||
if (preg_match('/\\.css$/', $symbol_info['disk'])) {
|
||||
// If JS requires CSS, just assume everything is fine.
|
||||
unset($requires[$key]);
|
||||
} else {
|
||||
$symbol_path = 'webroot'.$symbol_info['disk'];
|
||||
list($ignored, $req_install) = $this->getUsedAndInstalledSymbolsForPath(
|
||||
$symbol_path);
|
||||
|
@ -175,6 +179,7 @@ final class PhabricatorJavelinLinter extends ArcanistLinter {
|
|||
unset($requires[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($need as $class => $line) {
|
||||
$this->raiseLintAtLine(
|
||||
|
|
|
@ -35,7 +35,7 @@ function parse_command_line_arguments(argv) {
|
|||
return config;
|
||||
}
|
||||
|
||||
if (process.getuid() != 0) {
|
||||
if (process.getuid() !== 0) {
|
||||
console.log(
|
||||
"ERROR: "+
|
||||
"This server must be run as root because it needs to bind to privileged "+
|
||||
|
@ -118,8 +118,8 @@ var MAX_ID = 9007199254740991;//2^53 -1
|
|||
// you want to write something pretty be my guest
|
||||
|
||||
function generate_id() {
|
||||
if (typeof generate_id.current_id == 'undefined'
|
||||
|| generate_id.current_id > MAX_ID) {
|
||||
if (typeof generate_id.current_id == 'undefined' ||
|
||||
generate_id.current_id > MAX_ID) {
|
||||
generate_id.current_id = 0;
|
||||
}
|
||||
return generate_id.current_id++;
|
||||
|
@ -132,15 +132,15 @@ var send_server = net.createServer(function(socket) {
|
|||
socket.on('connect', function() {
|
||||
clients[client_id] = socket;
|
||||
current_connections++;
|
||||
log(client_name + 'connected\t\t('
|
||||
+ current_connections + ' current connections)');
|
||||
log(client_name + 'connected\t\t(' +
|
||||
current_connections + ' current connections)');
|
||||
});
|
||||
|
||||
socket.on('close', function() {
|
||||
delete clients[client_id];
|
||||
current_connections--;
|
||||
log(client_name + 'closed\t\t('
|
||||
+ current_connections + ' current connections)');
|
||||
log(client_name + 'closed\t\t(' +
|
||||
current_connections + ' current connections)');
|
||||
});
|
||||
|
||||
socket.on('timeout', function() {
|
||||
|
|
5
support/jshint/jshintconfig
Normal file
5
support/jshint/jshintconfig
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"expr" : true,
|
||||
"loopfunc" : true,
|
||||
"sub" : true
|
||||
}
|
2
webroot/rsrc/externals/javelin/core/Event.js
vendored
2
webroot/rsrc/externals/javelin/core/Event.js
vendored
|
@ -337,7 +337,7 @@ JX.install('Event', {
|
|||
JX.Event.prototype.toString = function() {
|
||||
var path = '['+this.getPath().join(', ')+']';
|
||||
return 'Event<'+this.getType()+', '+path+', '+this.getTarget()+'>';
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
16
webroot/rsrc/externals/javelin/core/init.js
vendored
16
webroot/rsrc/externals/javelin/core/init.js
vendored
|
@ -32,7 +32,7 @@
|
|||
return;
|
||||
}
|
||||
holding_queues[name] = [];
|
||||
JX[name] = function() { holding_queues[name].push(arguments); }
|
||||
JX[name] = function() { holding_queues[name].push(arguments); };
|
||||
}
|
||||
|
||||
JX.flushHoldingQueue = function(name, fn) {
|
||||
|
@ -40,7 +40,7 @@
|
|||
fn.apply(null, holding_queues[name][ii]);
|
||||
}
|
||||
holding_queues[name] = {};
|
||||
}
|
||||
};
|
||||
|
||||
makeHoldingQueue('install');
|
||||
makeHoldingQueue('behavior');
|
||||
|
@ -107,7 +107,7 @@
|
|||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
JX.enableDispatch = function(target, type) {
|
||||
if (__DEV__) {
|
||||
|
@ -165,7 +165,8 @@
|
|||
}
|
||||
}
|
||||
|
||||
for (var ii = 0; ii < document_events.length; ++ii) {
|
||||
var ii;
|
||||
for (ii = 0; ii < document_events.length; ++ii) {
|
||||
JX.enableDispatch(root, document_events[ii]);
|
||||
}
|
||||
|
||||
|
@ -182,7 +183,7 @@
|
|||
];
|
||||
|
||||
|
||||
for (var ii = 0; ii < window_events.length; ++ii) {
|
||||
for (ii = 0; ii < window_events.length; ++ii) {
|
||||
JX.enableDispatch(window, window_events[ii]);
|
||||
}
|
||||
|
||||
|
@ -212,7 +213,7 @@
|
|||
'<script' +
|
||||
' defer="defer"' +
|
||||
' onreadystatechange="' + ready + '"' +
|
||||
'><\/sc' + 'ript\>');
|
||||
'><\/sc' + 'ript' + '>');
|
||||
}
|
||||
|
||||
JX.onload = function(func) {
|
||||
|
@ -221,5 +222,6 @@
|
|||
} else {
|
||||
onload.push(func);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
})();
|
||||
|
|
6
webroot/rsrc/externals/javelin/core/util.js
vendored
6
webroot/rsrc/externals/javelin/core/util.js
vendored
|
@ -247,7 +247,7 @@ JX.bind = function(context, func, more) {
|
|||
|
||||
return function() {
|
||||
return func.apply(context || window, bound.concat(JX.$A(arguments)));
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
@ -320,7 +320,7 @@ if (__DEV__) {
|
|||
*/
|
||||
JX.log = function(message) {
|
||||
window.console.log(message);
|
||||
}
|
||||
};
|
||||
|
||||
window.alert = (function(native_alert) {
|
||||
var recent_alerts = [];
|
||||
|
@ -349,7 +349,7 @@ if (__DEV__) {
|
|||
native_alert(msg);
|
||||
}
|
||||
in_alert = false;
|
||||
}
|
||||
};
|
||||
})(window.alert);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
* @provides javelin-reactor-dom
|
||||
* @requires javelin-dom
|
||||
* javelin-dynval
|
||||
* javelin-reactor
|
||||
* javelin-reactornode
|
||||
* javelin-install
|
||||
* javelin-util
|
||||
|
|
|
@ -5,7 +5,9 @@
|
|||
*
|
||||
* @provides javelin-view-html
|
||||
* @requires javelin-install
|
||||
* javelin-view
|
||||
* javelin-dom
|
||||
* javelin-view-visitor
|
||||
* javelin-util
|
||||
*/
|
||||
|
||||
JX.install('HTMLView', {
|
||||
|
@ -26,7 +28,7 @@ JX.install('HTMLView', {
|
|||
|
||||
validate: function(view, children) {
|
||||
var spec = this._getHTMLSpec();
|
||||
if (!view.getName() in spec) {
|
||||
if (!(view.getName() in spec)) {
|
||||
throw new Error("invalid tag");
|
||||
}
|
||||
|
||||
|
|
11
webroot/rsrc/externals/javelin/ext/view/View.js
vendored
11
webroot/rsrc/externals/javelin/ext/view/View.js
vendored
|
@ -82,8 +82,11 @@ JX.install('View', {
|
|||
var result = [];
|
||||
var should_repack = false;
|
||||
|
||||
for(var ii = 0; ii < this._childKeys.length; ii++) {
|
||||
var key = this._childKeys[ii];
|
||||
var ii;
|
||||
var key;
|
||||
|
||||
for (ii = 0; ii < this._childKeys.length; ii++) {
|
||||
key = this._childKeys[ii];
|
||||
if (this._rawChildren[key] === undefined) {
|
||||
should_repack = true;
|
||||
} else {
|
||||
|
@ -93,8 +96,8 @@ JX.install('View', {
|
|||
|
||||
if (should_repack) {
|
||||
var new_child_keys = [];
|
||||
for(var ii = 0; ii < this._childKeys.length; ii++) {
|
||||
var key = this._childKeys[ii];
|
||||
for (ii = 0; ii < this._childKeys.length; ii++) {
|
||||
key = this._childKeys[ii];
|
||||
if (this._rawChildren[key] !== undefined) {
|
||||
new_child_keys.push(key);
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
* @provides javelin-view-interpreter
|
||||
* @requires javelin-view
|
||||
* javelin-install
|
||||
*
|
||||
* javelin-dom
|
||||
*/
|
||||
|
||||
JX.install('ViewInterpreter', {
|
||||
|
@ -65,7 +65,7 @@ JX.install('ViewInterpreter', {
|
|||
result.addChildren(children);
|
||||
|
||||
return result;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
* @requires javelin-behavior
|
||||
* javelin-dom
|
||||
* javelin-view-renderer
|
||||
* javelin-install
|
||||
*/
|
||||
|
||||
|
||||
|
@ -72,11 +73,12 @@ JX.install('ViewPlaceholder', {
|
|||
statics: {
|
||||
register: function(wait_on_token, token, cb) {
|
||||
var ready_q = [];
|
||||
var waiting;
|
||||
|
||||
if (!wait_on_token || wait_on_token in JX.ViewPlaceholder.ready) {
|
||||
ready_q.push({token: token, cb: cb});
|
||||
} else {
|
||||
var waiting = JX.ViewPlaceholder.waiting;
|
||||
waiting = JX.ViewPlaceholder.waiting;
|
||||
waiting[wait_on_token] = waiting[wait_on_token] || [];
|
||||
waiting[wait_on_token].push({token: token, cb: cb});
|
||||
}
|
||||
|
@ -84,7 +86,7 @@ JX.install('ViewPlaceholder', {
|
|||
while(ready_q.length) {
|
||||
var ready = ready_q.shift();
|
||||
|
||||
var waiting = JX.ViewPlaceholder.waiting[ready.token];
|
||||
waiting = JX.ViewPlaceholder.waiting[ready.token];
|
||||
if (waiting) {
|
||||
for (var ii = 0; ii < waiting.length; ii++) {
|
||||
ready_q.push(waiting[ii]);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/**
|
||||
* @provides javelin-view-renderer
|
||||
* @requires javelin-install
|
||||
* javelin-util
|
||||
*/
|
||||
|
||||
JX.install('ViewRenderer', {
|
||||
|
|
|
@ -13,11 +13,11 @@ describe('JX.ViewRenderer', function() {
|
|||
parent.addChild(child);
|
||||
child.render = function(_) {
|
||||
child_rendered = true;
|
||||
}
|
||||
};
|
||||
|
||||
parent.render = function(rendered_children) {
|
||||
child_rendered_first = child_rendered;
|
||||
}
|
||||
};
|
||||
|
||||
JX.ViewRenderer.render(parent);
|
||||
expect(child_rendered_first).toBe(true);
|
||||
|
|
16
webroot/rsrc/externals/javelin/lib/DOM.js
vendored
16
webroot/rsrc/externals/javelin/lib/DOM.js
vendored
|
@ -102,8 +102,8 @@ JX.install('HTML', {
|
|||
var tags = ['legend', 'thead', 'tbody', 'tfoot', 'column', 'colgroup',
|
||||
'caption', 'tr', 'th', 'td', 'option'];
|
||||
var evil_stuff = new RegExp('^\\s*<(' + tags.join('|') + ')\\b', 'i');
|
||||
var match = null;
|
||||
if (match = str.match(evil_stuff)) {
|
||||
var match = str.match(evil_stuff);
|
||||
if (match) {
|
||||
JX.$E(
|
||||
'new JX.HTML("<' + match[1] + '>..."): ' +
|
||||
'call initializes an HTML object with an invalid partial fragment ' +
|
||||
|
@ -725,8 +725,10 @@ JX.install('DOM', {
|
|||
* @return void
|
||||
*/
|
||||
show : function() {
|
||||
var ii;
|
||||
|
||||
if (__DEV__) {
|
||||
for (var ii = 0; ii < arguments.length; ++ii) {
|
||||
for (ii = 0; ii < arguments.length; ++ii) {
|
||||
if (!arguments[ii]) {
|
||||
JX.$E(
|
||||
'JX.DOM.show(...): ' +
|
||||
|
@ -735,7 +737,7 @@ JX.install('DOM', {
|
|||
}
|
||||
}
|
||||
|
||||
for (var ii = 0; ii < arguments.length; ++ii) {
|
||||
for (ii = 0; ii < arguments.length; ++ii) {
|
||||
arguments[ii].style.display = '';
|
||||
}
|
||||
},
|
||||
|
@ -750,8 +752,10 @@ JX.install('DOM', {
|
|||
* @return void
|
||||
*/
|
||||
hide : function() {
|
||||
var ii;
|
||||
|
||||
if (__DEV__) {
|
||||
for (var ii = 0; ii < arguments.length; ++ii) {
|
||||
for (ii = 0; ii < arguments.length; ++ii) {
|
||||
if (!arguments[ii]) {
|
||||
JX.$E(
|
||||
'JX.DOM.hide(...): ' +
|
||||
|
@ -760,7 +764,7 @@ JX.install('DOM', {
|
|||
}
|
||||
}
|
||||
|
||||
for (var ii = 0; ii < arguments.length; ++ii) {
|
||||
for (ii = 0; ii < arguments.length; ++ii) {
|
||||
arguments[ii].style.display = 'none';
|
||||
}
|
||||
},
|
||||
|
|
2
webroot/rsrc/externals/javelin/lib/Mask.js
vendored
2
webroot/rsrc/externals/javelin/lib/Mask.js
vendored
|
@ -71,7 +71,7 @@ JX.install('Mask', {
|
|||
document.body.appendChild(self._mask);
|
||||
}
|
||||
|
||||
self._adjustType(mask_type)
|
||||
self._adjustType(mask_type);
|
||||
JX.Mask._stack.push(mask_type);
|
||||
},
|
||||
|
||||
|
|
|
@ -201,7 +201,7 @@ JX.install('Request', {
|
|||
'JX.Request("'+this.getURI()+'", ...): '+
|
||||
'server returned an empty response.');
|
||||
}
|
||||
if (expect_guard && xport.responseText.indexOf('for (;;);') != 0) {
|
||||
if (expect_guard && xport.responseText.indexOf('for (;;);') !== 0) {
|
||||
JX.$E(
|
||||
'JX.Request("'+this.getURI()+'", ...): '+
|
||||
'server returned an invalid response.');
|
||||
|
@ -405,7 +405,7 @@ JX.install('Request', {
|
|||
recurse(obj, ii);
|
||||
}
|
||||
} else if (obj && typeof obj == 'object') {
|
||||
if (obj.__html != null) {
|
||||
if (('__html' in obj) && (obj.__html !== null)) {
|
||||
parent[index] = JX.$H(obj.__html);
|
||||
} else {
|
||||
for (var key in obj) {
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
/**
|
||||
* @provides javelin-resource
|
||||
* @requires javelin-magical-init
|
||||
* javelin-stratcom
|
||||
* javelin-util
|
||||
* @requires javelin-util
|
||||
* javelin-uri
|
||||
* javelin-install
|
||||
*
|
||||
* @javelin
|
||||
*/
|
||||
|
|
2
webroot/rsrc/externals/javelin/lib/URI.js
vendored
2
webroot/rsrc/externals/javelin/lib/URI.js
vendored
|
@ -54,7 +54,7 @@ JX.install('URI', {
|
|||
_defaultQuerySerializer : function(obj) {
|
||||
var kv_pairs = [];
|
||||
for (var key in obj) {
|
||||
if (obj[key] != null) {
|
||||
if (obj[key] !== null) {
|
||||
var value = encodeURIComponent(obj[key]);
|
||||
kv_pairs.push(encodeURIComponent(key) + (value ? '=' + value : ''));
|
||||
}
|
||||
|
|
8
webroot/rsrc/externals/javelin/lib/Vector.js
vendored
8
webroot/rsrc/externals/javelin/lib/Vector.js
vendored
|
@ -164,13 +164,9 @@ JX.install('Vector', {
|
|||
*/
|
||||
setDim : function(node) {
|
||||
node.style.width =
|
||||
(this.x === null)
|
||||
? ''
|
||||
: (parseInt(this.x, 10) + 'px');
|
||||
(this.x === null) ? '' : (parseInt(this.x, 10) + 'px');
|
||||
node.style.height =
|
||||
(this.y === null)
|
||||
? ''
|
||||
: (parseInt(this.y, 10) + 'px');
|
||||
(this.y === null) ? '' : (parseInt(this.y, 10) + 'px');
|
||||
return this;
|
||||
},
|
||||
|
||||
|
|
|
@ -282,7 +282,7 @@ JX.install('Workflow', {
|
|||
|
||||
JX.Workflow._pop();
|
||||
e.prevent();
|
||||
};
|
||||
}
|
||||
|
||||
JX.Stratcom.listen('keydown', null, close_dialog_when_user_presses_escape);
|
||||
}
|
||||
|
|
|
@ -262,7 +262,7 @@ describe('Javelin URI', function() {
|
|||
expect(uri.toString()).toEqual('/?clown=town');
|
||||
});
|
||||
|
||||
it('can remove non existant query data', function() {
|
||||
it('can remove non existent query data', function() {
|
||||
var uri = JX.$U('/?key=value');
|
||||
uri.addQueryParams({'magic' : null});
|
||||
expect(uri.getQueryParams()).toEqual({
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/**
|
||||
* @provides javelin-behavior
|
||||
* @requires javelin-magical-init
|
||||
* javelin-util
|
||||
*
|
||||
* @javelin-installs JX.behavior
|
||||
* @javelin-installs JX.initBehaviors
|
||||
|
|
|
@ -345,7 +345,7 @@ JX.install('Tokenizer', {
|
|||
case 'delete':
|
||||
if (!this._focus.value.length) {
|
||||
var tok;
|
||||
while (tok = this._tokens.pop()) {
|
||||
while ((tok = this._tokens.pop())) {
|
||||
if (this._remove(tok, true)) {
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
/**
|
||||
* @requires javelin-install
|
||||
* javelin-util
|
||||
* javelin-stratcom
|
||||
* javelin-request
|
||||
* javelin-typeahead-source
|
||||
* @provides javelin-typeahead-ondemand-source
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
/**
|
||||
* @requires javelin-install
|
||||
* javelin-util
|
||||
* javelin-stratcom
|
||||
* javelin-request
|
||||
* javelin-typeahead-source
|
||||
* @provides javelin-typeahead-preloaded-source
|
||||
|
|
|
@ -282,7 +282,8 @@ JX.install('TypeaheadSource', {
|
|||
|
||||
sortHits : function(value, hits) {
|
||||
var objs = [];
|
||||
for (var ii = 0; ii < hits.length; ii++) {
|
||||
var ii;
|
||||
for (ii = 0; ii < hits.length; ii++) {
|
||||
objs.push(this._raw[hits[ii]]);
|
||||
}
|
||||
|
||||
|
@ -299,7 +300,7 @@ JX.install('TypeaheadSource', {
|
|||
handler(value, objs, default_comparator);
|
||||
|
||||
hits.splice(0, hits.length);
|
||||
for (var ii = 0; ii < objs.length; ii++) {
|
||||
for (ii = 0; ii < objs.length; ii++) {
|
||||
hits.push(objs[ii].id);
|
||||
}
|
||||
},
|
||||
|
|
1
webroot/rsrc/externals/raphael/g.raphael.js
vendored
1
webroot/rsrc/externals/raphael/g.raphael.js
vendored
|
@ -1,6 +1,7 @@
|
|||
/**
|
||||
* @provides raphael-g
|
||||
* @do-not-minify
|
||||
* @nolint
|
||||
*/
|
||||
/*!
|
||||
* g.Raphael 0.5 - Charting library, based on Raphaël
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/**
|
||||
* @provides raphael-g-line
|
||||
* @do-not-minify
|
||||
* @nolint
|
||||
*/
|
||||
/*!
|
||||
* g.Raphael 0.5 - Charting library, based on Raphaël
|
||||
|
|
1
webroot/rsrc/externals/raphael/raphael.js
vendored
1
webroot/rsrc/externals/raphael/raphael.js
vendored
|
@ -1,6 +1,7 @@
|
|||
/**
|
||||
* @provides raphael-core
|
||||
* @do-not-minify
|
||||
* @nolint
|
||||
*/
|
||||
// ┌─────────────────────────────────────────────────────────────────────┐ \\
|
||||
// │ Raphaël 2.0.1 - JavaScript Vector Library │ \\
|
||||
|
|
|
@ -29,12 +29,10 @@ JX.behavior('aphlict-dropdown', function(config) {
|
|||
return;
|
||||
}
|
||||
request = new JX.Request('/notification/panel/', function(response) {
|
||||
var display = (response.number > 999)
|
||||
? "\u221E"
|
||||
: response.number;
|
||||
var display = (response.number > 999) ? "\u221E" : response.number;
|
||||
|
||||
JX.DOM.setContent(count, display);
|
||||
if (response.number == 0) {
|
||||
if (response.number === 0) {
|
||||
JX.DOM.alterClass(bubble, 'alert-unread', false);
|
||||
} else {
|
||||
JX.DOM.alterClass(bubble, 'alert-unread', true);
|
||||
|
@ -102,7 +100,7 @@ JX.behavior('aphlict-dropdown', function(config) {
|
|||
visible = !visible;
|
||||
e.kill();
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
JX.Stratcom.listen('notification-panel-update', null, function() {
|
||||
dirty = true;
|
||||
|
|
|
@ -29,9 +29,7 @@ JX.behavior('aphlict-listen', function(config) {
|
|||
.send();
|
||||
} else if (__DEV__) {
|
||||
if (config.debug) {
|
||||
var details = message
|
||||
? JX.JSON.stringify(message)
|
||||
: '';
|
||||
var details = message ? JX.JSON.stringify(message) : '';
|
||||
|
||||
new JX.Notification()
|
||||
.setContent('(Aphlict) [' + type + '] ' + details)
|
||||
|
@ -65,7 +63,7 @@ JX.behavior('aphlict-listen', function(config) {
|
|||
.setContent('Page updated, click to reload.')
|
||||
.alterClassName('jx-notification-alert', true)
|
||||
.setDuration(0);
|
||||
reload.listen('activate', function(e) { JX.$U().go(); })
|
||||
reload.listen('activate', function(e) { JX.$U().go(); });
|
||||
reload.show();
|
||||
|
||||
showing_reload = true;
|
||||
|
@ -80,11 +78,11 @@ JX.behavior('aphlict-listen', function(config) {
|
|||
|
||||
// Add Flash object to page
|
||||
JX.$(config.containerID).innerHTML =
|
||||
'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000">'
|
||||
+ '<param name="movie" value="/rsrc/swf/aphlict.swf" />'
|
||||
+ '<param name="allowScriptAccess" value="always" />'
|
||||
+ '<param name="wmode" value="opaque" />'
|
||||
+ '<embed src="/rsrc/swf/aphlict.swf" wmode="opaque"'
|
||||
+ 'width="0" height="0" id="' + config.id + '">'
|
||||
+ '</embed></object>'; //Evan sanctioned
|
||||
'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000">' +
|
||||
'<param name="movie" value="/rsrc/swf/aphlict.swf" />' +
|
||||
'<param name="allowScriptAccess" value="always" />' +
|
||||
'<param name="wmode" value="opaque" />' +
|
||||
'<embed src="/rsrc/swf/aphlict.swf" wmode="opaque"' +
|
||||
'width="0" height="0" id="' + config.id + '">' +
|
||||
'</embed></object>'; //Evan sanctioned
|
||||
});
|
||||
|
|
|
@ -21,15 +21,19 @@ JX.behavior('conpherence-widget-pane', function(config) {
|
|||
|
||||
var root = JX.DOM.find(document, 'div', 'conpherence-layout');
|
||||
var widgetPane = JX.DOM.find(root, 'div', 'conpherence-widget-pane');
|
||||
var i;
|
||||
var tag_data;
|
||||
var node;
|
||||
|
||||
for (var widget in config.widgetRegistery) {
|
||||
// device-only widgets are *always shown* on the desktop
|
||||
if (config.widgetRegistery[widget] == config.devicesOnly) {
|
||||
if (is_desktop) {
|
||||
JX.$(widget).style.display = 'block';
|
||||
if (config.widgetExtraNodes[widget]) {
|
||||
for (var i in config.widgetExtraNodes[widget]) {
|
||||
var tag_data = config.widgetExtraNodes[widget][i];
|
||||
var node = JX.DOM.find(root, tag_data.tagname, tag_data.sigil);
|
||||
for (i in config.widgetExtraNodes[widget]) {
|
||||
tag_data = config.widgetExtraNodes[widget][i];
|
||||
node = JX.DOM.find(root, tag_data.tagname, tag_data.sigil);
|
||||
node.style.display = tag_data.desktopstyle;
|
||||
}
|
||||
}
|
||||
|
@ -48,9 +52,9 @@ JX.behavior('conpherence-widget-pane', function(config) {
|
|||
widgetPane.style.height = '100%';
|
||||
}
|
||||
if (config.widgetExtraNodes[widget]) {
|
||||
for (var i in config.widgetExtraNodes[widget]) {
|
||||
var tag_data = config.widgetExtraNodes[widget][i];
|
||||
var node = JX.DOM.find(root, tag_data.tagname, tag_data.sigil);
|
||||
for (i in config.widgetExtraNodes[widget]) {
|
||||
tag_data = config.widgetExtraNodes[widget][i];
|
||||
node = JX.DOM.find(root, tag_data.tagname, tag_data.sigil);
|
||||
node.style.display = tag_data.showstyle;
|
||||
}
|
||||
}
|
||||
|
@ -75,9 +79,9 @@ JX.behavior('conpherence-widget-pane', function(config) {
|
|||
);
|
||||
JX.$(widget).style.display = 'none';
|
||||
if (config.widgetExtraNodes[widget]) {
|
||||
for (var i in config.widgetExtraNodes[widget]) {
|
||||
var tag_data = config.widgetExtraNodes[widget][i];
|
||||
var node = JX.DOM.find(root, tag_data.tagname, tag_data.sigil);
|
||||
for (i in config.widgetExtraNodes[widget]) {
|
||||
tag_data = config.widgetExtraNodes[widget][i];
|
||||
node = JX.DOM.find(root, tag_data.tagname, tag_data.sigil);
|
||||
node.style.display = tag_data.hidestyle;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
* @provides javelin-behavior-countdown-timer
|
||||
* @requires javelin-behavior
|
||||
* javelin-dom
|
||||
* javelin-util
|
||||
*/
|
||||
|
||||
JX.behavior('countdown-timer', function(config) {
|
||||
|
|
|
@ -162,8 +162,9 @@ JX.install('DifferentialInlineCommentEditor', {
|
|||
return;
|
||||
}
|
||||
|
||||
var textarea;
|
||||
try {
|
||||
var textarea = JX.DOM.find(
|
||||
textarea = JX.DOM.find(
|
||||
document.body, // TODO: use getDialogRootNode() when available
|
||||
'textarea',
|
||||
'differential-inline-comment-edit-textarea');
|
||||
|
@ -180,16 +181,15 @@ JX.install('DifferentialInlineCommentEditor', {
|
|||
|
||||
// If the user hasn't edited the text (i.e., no change from original for
|
||||
// 'edit' or no text at all), don't offer them an undo.
|
||||
if (text == this.getOriginalText() || text == '') {
|
||||
if (text == this.getOriginalText() || text === '') {
|
||||
return;
|
||||
}
|
||||
|
||||
// Save the text so we can 'undo' back to it.
|
||||
this._undoText = text;
|
||||
|
||||
var template = this.getOnRight()
|
||||
? this.getTemplates().r
|
||||
: this.getTemplates().l;
|
||||
var templates = this.getTemplates();
|
||||
var template = this.getOnRight() ? templates.r : templates.l;
|
||||
template = JX.$N('div', JX.$H(template));
|
||||
|
||||
// NOTE: Operation order matters here; we can't remove anything until
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* @provides javelin-behavior-differential-comment-jump
|
||||
* @requires javelin-behavior
|
||||
* javelin-util
|
||||
* javelin-stratcom
|
||||
* javelin-dom
|
||||
*/
|
||||
|
||||
|
@ -20,7 +20,7 @@ JX.behavior('differential-comment-jump', function(config) {
|
|||
}
|
||||
}
|
||||
JX.Stratcom.invoke('differential-toggle-file-request', null, {
|
||||
element: jumpto,
|
||||
element: jumpto
|
||||
});
|
||||
JX.DOM.scrollTo(jumpto);
|
||||
e.kill();
|
||||
|
|
|
@ -13,7 +13,8 @@ JX.behavior('differential-feedback-preview', function(config) {
|
|||
var action = JX.$(config.action);
|
||||
var content = JX.$(config.content);
|
||||
var previewTokenizers = {};
|
||||
for (var field in config.previewTokenizers) {
|
||||
var field;
|
||||
for (field in config.previewTokenizers) {
|
||||
var tokenizer = JX.$(config.previewTokenizers[field]);
|
||||
previewTokenizers[field] = JX.Stratcom.getData(tokenizer).tokenizer;
|
||||
}
|
||||
|
@ -46,7 +47,7 @@ JX.behavior('differential-feedback-preview', function(config) {
|
|||
|
||||
JX.DOM.listen(content, 'keydown', null, trigger);
|
||||
JX.DOM.listen(action, 'change', null, trigger);
|
||||
for (var field in previewTokenizers) {
|
||||
for (field in previewTokenizers) {
|
||||
previewTokenizers[field].listen('change', trigger);
|
||||
}
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ JX.behavior('differential-dropdown-menus', function(config) {
|
|||
|
||||
var visible_item = new JX.PhabricatorMenuItem('', function () {
|
||||
JX.Stratcom.invoke('differential-toggle-file', null, {
|
||||
diff: JX.DOM.scry(JX.$(data.containerID), 'table', 'differential-diff'),
|
||||
diff: JX.DOM.scry(JX.$(data.containerID), 'table', 'differential-diff')
|
||||
});
|
||||
});
|
||||
menu.addItem(visible_item);
|
||||
|
|
|
@ -197,7 +197,7 @@ JX.behavior('differential-edit-inline-comments', function(config) {
|
|||
|
||||
var node = e.getNode('differential-inline-comment');
|
||||
handle_inline_action(node, op);
|
||||
}
|
||||
};
|
||||
|
||||
var handle_inline_action = function(node, op) {
|
||||
var data = JX.Stratcom.getData(node);
|
||||
|
@ -243,7 +243,7 @@ JX.behavior('differential-edit-inline-comments', function(config) {
|
|||
.start();
|
||||
|
||||
set_link_state(true);
|
||||
}
|
||||
};
|
||||
|
||||
for (var op in {'edit' : 1, 'delete' : 1, 'reply' : 1}) {
|
||||
JX.Stratcom.listen(
|
||||
|
|
|
@ -130,9 +130,12 @@ JX.behavior('differential-keyboard-navigation', function(config) {
|
|||
selection_end = blocks[focus][1];
|
||||
|
||||
manager.scrollTo(selection_begin);
|
||||
(refreshFocus = function() {
|
||||
|
||||
refreshFocus = function() {
|
||||
manager.focusOn(selection_begin, selection_end);
|
||||
})();
|
||||
};
|
||||
|
||||
refreshFocus();
|
||||
|
||||
return;
|
||||
} else {
|
||||
|
|
|
@ -97,7 +97,7 @@ JX.behavior('differential-populate', function(config) {
|
|||
var diff;
|
||||
try {
|
||||
diff = JX.$(meta.id);
|
||||
} catch (e) {
|
||||
} catch (ex) {
|
||||
// Already loaded.
|
||||
}
|
||||
if (diff) {
|
||||
|
|
|
@ -42,7 +42,7 @@ JX.behavior('differential-show-all-comments', function(config) {
|
|||
try {
|
||||
var target = JX.$(window.location.hash.replace(/^#/, ''));
|
||||
window.scrollTo(0, target.offsetTop);
|
||||
} catch (e) {
|
||||
} catch (ex) {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -21,7 +21,7 @@ JX.behavior('audit-preview', function(config) {
|
|||
action: action.value,
|
||||
content: content.value
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
var request = new JX.PhabricatorShapedRequest(config.uri, callback, getdata);
|
||||
var trigger = JX.bind(request, request.trigger);
|
||||
|
|
|
@ -20,7 +20,7 @@ JX.behavior('diffusion-commit-graph', function(config) {
|
|||
'#00cccc',
|
||||
'#00cc33',
|
||||
'#66cc00',
|
||||
'#cc9900',
|
||||
'#cc9900'
|
||||
];
|
||||
return colors[c % colors.length];
|
||||
}
|
||||
|
@ -48,9 +48,9 @@ JX.behavior('diffusion-commit-graph', function(config) {
|
|||
var data = JX.Stratcom.getData(nodes[ii]);
|
||||
|
||||
var cell = 12; // Width of each thread.
|
||||
function xpos(col) {
|
||||
var xpos = function(col) {
|
||||
return (col * cell) + (cell / 2);
|
||||
}
|
||||
};
|
||||
|
||||
var h = 26;
|
||||
var w = cell * config.count;
|
||||
|
@ -71,8 +71,11 @@ JX.behavior('diffusion-commit-graph', function(config) {
|
|||
// a parent). We use this to figure out where to draw the join/split lines.
|
||||
|
||||
var origin = null;
|
||||
for (var jj = 0; jj < data.line.length; jj++) {
|
||||
var c = data.line.charAt(jj);
|
||||
var jj;
|
||||
var x;
|
||||
var c;
|
||||
for (jj = 0; jj < data.line.length; jj++) {
|
||||
c = data.line.charAt(jj);
|
||||
switch (c) {
|
||||
case 'o':
|
||||
case '^':
|
||||
|
@ -84,9 +87,9 @@ JX.behavior('diffusion-commit-graph', function(config) {
|
|||
// Draw all the join lines. These start at some column at the top of the
|
||||
// canvas and join the commit's column. They indicate branching.
|
||||
|
||||
for (var jj = 0; jj < data.join.length; jj++) {
|
||||
for (jj = 0; jj < data.join.length; jj++) {
|
||||
var join = data.join[jj];
|
||||
var x = xpos(join);
|
||||
x = xpos(join);
|
||||
cxt.beginPath();
|
||||
cxt.moveTo(x, 0);
|
||||
cxt.bezierCurveTo(x, h/4, origin, h/4, origin, h/2);
|
||||
|
@ -96,9 +99,9 @@ JX.behavior('diffusion-commit-graph', function(config) {
|
|||
// Draw all the split lines. These start at the commit and end at some
|
||||
// column on the bottom of the canvas. They indicate merging.
|
||||
|
||||
for (var jj = 0; jj < data.split.length; jj++) {
|
||||
for (jj = 0; jj < data.split.length; jj++) {
|
||||
var split = data.split[jj];
|
||||
var x = xpos(split);
|
||||
x = xpos(split);
|
||||
cxt.beginPath();
|
||||
cxt.moveTo(origin, h/2);
|
||||
cxt.bezierCurveTo(origin, 3*h/4, x, 3*h/4, x, h);
|
||||
|
@ -108,13 +111,16 @@ JX.behavior('diffusion-commit-graph', function(config) {
|
|||
// Draw the vertical lines (a branch with no activity at this commit) and
|
||||
// the commit circles.
|
||||
|
||||
for (var jj = 0; jj < data.line.length; jj++) {
|
||||
var c = data.line.charAt(jj);
|
||||
for (jj = 0; jj < data.line.length; jj++) {
|
||||
c = data.line.charAt(jj);
|
||||
switch (c) {
|
||||
case 'o':
|
||||
case '^':
|
||||
origin = xpos(jj);
|
||||
case '|':
|
||||
if (c == 'o' || c == '^') {
|
||||
origin = xpos(jj);
|
||||
}
|
||||
|
||||
cxt.beginPath();
|
||||
cxt.moveTo(xpos(jj), (c == '^' ? h/2 : 0));
|
||||
cxt.lineTo(xpos(jj), h);
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
/**
|
||||
* @provides javelin-behavior-diffusion-jump-to
|
||||
* @requires javelin-behavior
|
||||
* javelin-util
|
||||
* javelin-vector
|
||||
* javelin-dom
|
||||
*/
|
||||
|
|
|
@ -79,7 +79,7 @@ JX.behavior('maniphest-batch-editor', function(config) {
|
|||
vfunc = function() { return status_select.value; };
|
||||
break;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
JX.DOM.listen(action_select, 'change', null, update);
|
||||
update();
|
||||
|
|
|
@ -14,11 +14,11 @@ JX.behavior('maniphest-batch-selector', function(config) {
|
|||
|
||||
var get_id = function(task) {
|
||||
return JX.Stratcom.getData(task).taskID;
|
||||
}
|
||||
};
|
||||
|
||||
var is_selected = function(task) {
|
||||
return (get_id(task) in selected);
|
||||
}
|
||||
};
|
||||
|
||||
// Change the selected state of a task.
|
||||
|
||||
|
@ -50,7 +50,7 @@ JX.behavior('maniphest-batch-selector', function(config) {
|
|||
for (var ii = 0; ii < inputs.length; ii++) {
|
||||
change(inputs[ii], to);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Clear any document text selection after toggling a task via shift click,
|
||||
// since errant clicks tend to start selecting various ranges otherwise.
|
||||
|
@ -65,7 +65,7 @@ JX.behavior('maniphest-batch-selector', function(config) {
|
|||
} else if (document.selection) {
|
||||
document.selection.empty();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Update the status text showing how many tasks are selected, and the button
|
||||
// state.
|
||||
|
@ -73,7 +73,7 @@ JX.behavior('maniphest-batch-selector', function(config) {
|
|||
var update = function() {
|
||||
var count = JX.keys(selected).length;
|
||||
var status;
|
||||
if (count == 0) {
|
||||
if (count === 0) {
|
||||
status = 'Shift-Click to Select Tasks';
|
||||
} else if (status == 1) {
|
||||
status = '1 Selected Task';
|
||||
|
@ -83,7 +83,7 @@ JX.behavior('maniphest-batch-selector', function(config) {
|
|||
JX.DOM.setContent(JX.$(config.status), status);
|
||||
|
||||
var submit = JX.$(config.submit);
|
||||
var disable = (count == 0);
|
||||
var disable = (count === 0);
|
||||
submit.disabled = disable;
|
||||
JX.DOM.alterClass(submit, 'disabled', disable);
|
||||
};
|
||||
|
|
|
@ -19,7 +19,7 @@ JX.behavior('maniphest-description-preview', function(config) {
|
|||
return {
|
||||
description : textarea.value
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
var request = new JX.PhabricatorShapedRequest(config.uri, callback, getdata);
|
||||
var trigger = JX.bind(request, request.trigger);
|
||||
|
|
|
@ -12,7 +12,7 @@ JX.behavior('maniphest-transaction-controls', function(config) {
|
|||
for (var k in config.tokenizers) {
|
||||
var tconfig = config.tokenizers[k];
|
||||
tokenizers[k] = JX.Prefab.buildTokenizer(tconfig).tokenizer;
|
||||
tokenizers[k].start()
|
||||
tokenizers[k].start();
|
||||
}
|
||||
|
||||
JX.DOM.listen(
|
||||
|
|
|
@ -48,7 +48,7 @@ JX.behavior('maniphest-transaction-preview', function(config) {
|
|||
action : selected,
|
||||
value : value || ''
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
var request = new JX.PhabricatorShapedRequest(config.uri, callback, getdata);
|
||||
var trigger = JX.bind(request, request.trigger);
|
||||
|
|
|
@ -18,9 +18,9 @@ JX.behavior('phame-post-preview', function(config) {
|
|||
if (!sync_titles) {
|
||||
return;
|
||||
}
|
||||
var title_string = new String(title.value);
|
||||
var title_string = title.value;
|
||||
phame_title.value = normalizeSlug(title_string);
|
||||
}
|
||||
};
|
||||
|
||||
var phameTitleKeyupCallback = function (e) {
|
||||
// stop sync'ing once user edits phame_title directly
|
||||
|
@ -38,11 +38,11 @@ JX.behavior('phame-post-preview', function(config) {
|
|||
phame_title.focus();
|
||||
phame_title.setSelectionRange(position, position);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var phameTitleBlurCallback = function (e) {
|
||||
phame_title.value = normalizeSlug(phame_title.value);
|
||||
}
|
||||
};
|
||||
|
||||
// This is a sort of implementation of PhabricatorSlug::normalize
|
||||
var normalizeSlug = function (slug, spare_trailing_underscore) {
|
||||
|
@ -53,7 +53,7 @@ JX.behavior('phame-post-preview', function(config) {
|
|||
s = s.replace(/_$/g, '');
|
||||
}
|
||||
return s;
|
||||
}
|
||||
};
|
||||
|
||||
var callback = function(r) {
|
||||
JX.DOM.setContent(JX.$(config.preview), JX.$H(r));
|
||||
|
@ -65,7 +65,7 @@ JX.behavior('phame-post-preview', function(config) {
|
|||
title : title.value,
|
||||
phame_title : phame_title.value
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
var request = new JX.PhabricatorShapedRequest(config.uri, callback, getdata);
|
||||
var trigger = JX.bind(request, request.trigger);
|
||||
|
|
|
@ -76,10 +76,11 @@ JX.behavior('pholio-mock-view', function(config) {
|
|||
}
|
||||
|
||||
function clear_stage() {
|
||||
for (var ii = 0; ii < reticles.length; ii++) {
|
||||
var ii;
|
||||
for (ii = 0; ii < reticles.length; ii++) {
|
||||
JX.DOM.remove(reticles[ii]);
|
||||
}
|
||||
for (var ii = 0; ii < cards.length; ii++) {
|
||||
for (ii = 0; ii < cards.length; ii++) {
|
||||
JX.DOM.remove(cards[ii]);
|
||||
}
|
||||
reticles = [];
|
||||
|
@ -160,7 +161,7 @@ JX.behavior('pholio-mock-view', function(config) {
|
|||
if (!active_image) {
|
||||
return;
|
||||
}
|
||||
var idx = get_image_index(active_image.id)
|
||||
var idx = get_image_index(active_image.id);
|
||||
idx = (idx + delta + config.images.length) % config.images.length;
|
||||
select_image(config.images[idx].id);
|
||||
}
|
||||
|
@ -324,7 +325,7 @@ JX.behavior('pholio-mock-view', function(config) {
|
|||
).setPos(dialog);
|
||||
|
||||
JX.DOM.focus(JX.DOM.find(dialog, 'textarea'));
|
||||
}
|
||||
};
|
||||
|
||||
new JX.Workflow('/pholio/inline/save/', data)
|
||||
.setHandler(handler)
|
||||
|
@ -343,14 +344,15 @@ JX.behavior('pholio-mock-view', function(config) {
|
|||
|
||||
var width = end.x - start.x;
|
||||
var height = end.y - start.y;
|
||||
var addon;
|
||||
|
||||
if (width < min_size) {
|
||||
var addon = (min_size-width)/2;
|
||||
addon = (min_size-width)/2;
|
||||
|
||||
start.x = Math.max(0, start.x - addon);
|
||||
end.x = Math.min(active_image.tag.naturalWidth, end.x + addon);
|
||||
|
||||
if (start.x == 0) {
|
||||
if (start.x === 0) {
|
||||
end.x = Math.min(min_size, active_image.tag.naturalWidth);
|
||||
} else if (end.x == active_image.tag.naturalWidth) {
|
||||
start.x = Math.max(0, active_image.tag.naturalWidth - min_size);
|
||||
|
@ -358,12 +360,12 @@ JX.behavior('pholio-mock-view', function(config) {
|
|||
}
|
||||
|
||||
if (height < min_size) {
|
||||
var addon = (min_size-height)/2;
|
||||
addon = (min_size-height)/2;
|
||||
|
||||
start.y = Math.max(0, start.y - addon);
|
||||
end.y = Math.min(active_image.tag.naturalHeight, end.y + addon);
|
||||
|
||||
if (start.y == 0) {
|
||||
if (start.y === 0) {
|
||||
end.y = Math.min(min_size, active_image.tag.naturalHeight);
|
||||
} else if (end.y == active_image.tag.naturalHeight) {
|
||||
start.y = Math.max(0, active_image.tag.naturalHeight - min_size);
|
||||
|
|
|
@ -19,7 +19,7 @@ JX.behavior('phriction-document-preview', function(config) {
|
|||
return {
|
||||
document : textarea.value
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
var request = new JX.PhabricatorShapedRequest(config.uri, callback, getdata);
|
||||
var trigger = JX.bind(request, request.trigger);
|
||||
|
|
|
@ -28,7 +28,7 @@ JX.behavior('ponder-votebox', function(config) {
|
|||
JX.DOM.alterClass(upv, 'ponder-vote-active', (data.vote > 0));
|
||||
|
||||
var downv = JX.DOM.find(root, 'a', 'downvote');
|
||||
JX.DOM.alterClass(downv, 'ponder-vote-active', (data.vote < 0))
|
||||
JX.DOM.alterClass(downv, 'ponder-vote-active', (data.vote < 0));
|
||||
|
||||
JX.DOM.setContent(
|
||||
JX.DOM.find(root, 'div', 'ponder-vote-count'),
|
||||
|
@ -36,7 +36,7 @@ JX.behavior('ponder-votebox', function(config) {
|
|||
|
||||
new JX.Request(e.getTarget().href, JX.bag)
|
||||
.setData({vote: data.vote})
|
||||
.send()
|
||||
.send();
|
||||
}
|
||||
|
||||
JX.Stratcom.listen(
|
||||
|
|
|
@ -2,15 +2,14 @@
|
|||
* @provides javelin-behavior-releeph-preview-branch
|
||||
* @requires javelin-behavior
|
||||
* javelin-dom
|
||||
* javelin-stratcom
|
||||
* javelin-uri
|
||||
* javelin-util
|
||||
* javelin-request
|
||||
*/
|
||||
|
||||
JX.behavior('releeph-preview-branch', function(config) {
|
||||
|
||||
var uri = JX.$U(config.uri);
|
||||
for (param_name in config.params.static) {
|
||||
for (var param_name in config.params.static) {
|
||||
var value = config.params.static[param_name];
|
||||
uri.setQueryParam(param_name, value);
|
||||
}
|
||||
|
@ -20,7 +19,7 @@ JX.behavior('releeph-preview-branch', function(config) {
|
|||
var dynamics = config.params.dynamic;
|
||||
|
||||
function renderPreview() {
|
||||
for (param_name in dynamics) {
|
||||
for (var param_name in dynamics) {
|
||||
var node_id = dynamics[param_name];
|
||||
var input = JX.$(node_id);
|
||||
uri.setQueryParam(param_name, input.value);
|
||||
|
@ -33,7 +32,7 @@ JX.behavior('releeph-preview-branch', function(config) {
|
|||
|
||||
renderPreview();
|
||||
|
||||
for (ii in dynamics) {
|
||||
for (var ii in dynamics) {
|
||||
var node_id = dynamics[ii];
|
||||
var input = JX.$(node_id);
|
||||
JX.DOM.listen(
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* @requires javelin-behavior
|
||||
* javelin-dom
|
||||
* javelin-stratcom
|
||||
* javelin-util
|
||||
* javelin-request
|
||||
* phabricator-keyboard-shortcut
|
||||
* phabricator-notification
|
||||
*/
|
||||
|
@ -45,8 +45,8 @@ JX.behavior('releeph-request-state-change', function(config) {
|
|||
|
||||
function keynavMarkup() {
|
||||
var headers = getRequestHeaderNodes();
|
||||
for (ii in headers) {
|
||||
JX.DOM.alterClass(headers[ii], 'focus', ii == keynav_cursor);
|
||||
for (var k in headers) {
|
||||
JX.DOM.alterClass(headers[k], 'focus', k == keynav_cursor);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,15 +1,10 @@
|
|||
/**
|
||||
* @provides javelin-behavior-releeph-request-typeahead
|
||||
* @requires javelin-behavior
|
||||
* javelin-util
|
||||
* javelin-dom
|
||||
* javelin-typeahead
|
||||
* javelin-tokenizer
|
||||
* javelin-typeahead-preloaded-source
|
||||
* javelin-typeahead-ondemand-source
|
||||
* javelin-dom
|
||||
* javelin-stratcom
|
||||
* javelin-util
|
||||
*/
|
||||
|
||||
JX.behavior('releeph-request-typeahead', function(config) {
|
||||
|
@ -48,7 +43,7 @@ JX.behavior('releeph-request-typeahead', function(config) {
|
|||
'div',
|
||||
{ className: 'summary' },
|
||||
summary
|
||||
),
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* @provides javelin-behavior-slowvote-embed
|
||||
* @requires javelin-behavior
|
||||
* javelin-util
|
||||
* javelin-request
|
||||
* javelin-stratcom
|
||||
* javelin-dom
|
||||
*/
|
||||
|
|
|
@ -36,7 +36,7 @@ JX.behavior('phabricator-transaction-comment-form', function(config) {
|
|||
[
|
||||
JX.$H(response.spacer),
|
||||
JX.$H(response.xactions.join(response.spacer)),
|
||||
JX.$H(response.spacer),
|
||||
JX.$H(response.spacer)
|
||||
]);
|
||||
JX.DOM.show(panel);
|
||||
}
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
/**
|
||||
* @provides phabricator-uiexample-javelin-view
|
||||
* @requires javelin-install
|
||||
* javelin-view
|
||||
* javelin-util
|
||||
* javelin-dom
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/**
|
||||
* @provides phabricator-uiexample-reactor-button
|
||||
* @requires javelin-install
|
||||
* javelin-view
|
||||
* javelin-util
|
||||
* javelin-dom
|
||||
* javelin-util
|
||||
* javelin-dynval
|
||||
* javelin-reactor-dom
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
/**
|
||||
* @provides phabricator-uiexample-reactor-checkbox
|
||||
* @requires javelin-install
|
||||
* javelin-view
|
||||
* javelin-util
|
||||
* javelin-dom
|
||||
* javelin-reactor-dom
|
||||
*/
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
/**
|
||||
* @provides phabricator-uiexample-reactor-focus
|
||||
* @requires javelin-install
|
||||
* javelin-view
|
||||
* javelin-util
|
||||
* javelin-dom
|
||||
* javelin-reactor-dom
|
||||
*/
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
/**
|
||||
* @provides phabricator-uiexample-reactor-input
|
||||
* @requires javelin-install
|
||||
* javelin-view
|
||||
* javelin-util
|
||||
* javelin-dom
|
||||
* javelin-reactor-dom
|
||||
* javelin-view-html
|
||||
* javelin-view-interpreter
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
/**
|
||||
* @provides phabricator-uiexample-reactor-mouseover
|
||||
* @requires javelin-install
|
||||
* javelin-view
|
||||
* javelin-util
|
||||
* javelin-dom
|
||||
* javelin-reactor-dom
|
||||
*/
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
/**
|
||||
* @provides phabricator-uiexample-reactor-radio
|
||||
* @requires javelin-install
|
||||
* javelin-view
|
||||
* javelin-util
|
||||
* javelin-dom
|
||||
* javelin-reactor-dom
|
||||
*/
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
/**
|
||||
* @provides phabricator-uiexample-reactor-select
|
||||
* @requires javelin-install
|
||||
* javelin-view
|
||||
* javelin-util
|
||||
* javelin-dom
|
||||
* javelin-reactor-dom
|
||||
*/
|
||||
|
@ -14,7 +12,7 @@ JX.install('ReactorSelectExample', {
|
|||
var select = JX.$N('select', {}, [
|
||||
JX.$N('option', { value: 'goat' }, 'Goat'),
|
||||
JX.$N('option', { value: 'bat' }, 'Bat'),
|
||||
JX.$N('option', { value: 'duck' }, 'Duck'),
|
||||
JX.$N('option', { value: 'duck' }, 'Duck')
|
||||
]);
|
||||
|
||||
return [select, JX.RDOM.$DT(JX.RDOM.select(select))];
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
/**
|
||||
* @provides phabricator-uiexample-reactor-sendclass
|
||||
* @requires javelin-install
|
||||
* javelin-view
|
||||
* javelin-util
|
||||
* javelin-dom
|
||||
* javelin-reactor-dom
|
||||
*/
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
/**
|
||||
* @provides phabricator-uiexample-reactor-sendproperties
|
||||
* @requires javelin-install
|
||||
* javelin-view
|
||||
* javelin-util
|
||||
* javelin-dom
|
||||
* javelin-reactor-dom
|
||||
*/
|
||||
|
|
|
@ -62,8 +62,10 @@ JX.behavior('phabricator-gesture-example', function(config) {
|
|||
cxt.fillStyle = '#dfdfdf';
|
||||
cxt.fillRect(0, 0, d.x, d.y);
|
||||
|
||||
for (var ii = 0; ii < strokes.length; ii++) {
|
||||
var s = strokes[ii];
|
||||
var s;
|
||||
var ii;
|
||||
for (ii = 0; ii < strokes.length; ii++) {
|
||||
s = strokes[ii];
|
||||
cxt.strokeStyle = 'rgba(0, 0, 0, 0.50)';
|
||||
cxt.beginPath();
|
||||
cxt.moveTo(s[0], s[1]);
|
||||
|
@ -71,8 +73,8 @@ JX.behavior('phabricator-gesture-example', function(config) {
|
|||
cxt.stroke();
|
||||
}
|
||||
|
||||
for (var ii = 0; ii < current.length; ii++) {
|
||||
var s = current[ii];
|
||||
for (ii = 0; ii < current.length; ii++) {
|
||||
s = current[ii];
|
||||
cxt.strokeStyle = 'rgba(255, 0, 0, 1)';
|
||||
cxt.beginPath();
|
||||
cxt.moveTo(s[0], s[1]);
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
* @requires phabricator-notification
|
||||
* javelin-stratcom
|
||||
* javelin-behavior
|
||||
* javelin-uri
|
||||
* @provides javelin-behavior-phabricator-notification-example
|
||||
*/
|
||||
|
||||
|
|
|
@ -41,13 +41,13 @@ JX.install('PhabricatorDragAndDropFileUpload', {
|
|||
_node : null,
|
||||
_depth : 0,
|
||||
_updateDepth : function(delta) {
|
||||
if (this._depth == 0 && delta > 0) {
|
||||
if (this._depth === 0 && delta > 0) {
|
||||
this.invoke('didBeginDrag');
|
||||
}
|
||||
|
||||
this._depth += delta;
|
||||
|
||||
if (this._depth == 0 && delta < 0) {
|
||||
if (this._depth === 0 && delta < 0) {
|
||||
this.invoke('didEndDrag');
|
||||
}
|
||||
},
|
||||
|
|
|
@ -36,11 +36,12 @@ JX.install('PhabricatorFileUpload', {
|
|||
.setDuration(0)
|
||||
.show();
|
||||
|
||||
var content;
|
||||
switch (this.getStatus()) {
|
||||
case 'done':
|
||||
var link = JX.$N('a', {href: this.getURI()}, 'F' + this.getID());
|
||||
|
||||
var content = [
|
||||
content = [
|
||||
JX.$N('strong', {}, ['Upload Complete (', link, ')']),
|
||||
JX.$N('br'),
|
||||
this.getName()
|
||||
|
@ -53,7 +54,7 @@ JX.install('PhabricatorFileUpload', {
|
|||
this._notification = null;
|
||||
break;
|
||||
case 'error':
|
||||
var content = [
|
||||
content = [
|
||||
JX.$N('strong', {}, 'Upload Failure'),
|
||||
JX.$N('br'),
|
||||
this.getName(),
|
||||
|
@ -89,7 +90,7 @@ JX.install('PhabricatorFileUpload', {
|
|||
return null;
|
||||
}
|
||||
var ratio = this.getUploadedBytes() / this.getTotalBytes();
|
||||
return parseInt(100 * ratio) + '%';
|
||||
return parseInt(100 * ratio, 10) + '%';
|
||||
},
|
||||
_renderFileSize : function() {
|
||||
if (!this.getTotalBytes()) {
|
||||
|
|
|
@ -86,12 +86,12 @@ JX.install('Hovercard', {
|
|||
// TODO: Fix southern graceful align
|
||||
var margin = 20;
|
||||
// We can't shift left by ~$margin or more here due to Pholio, Phriction
|
||||
var x = parseInt(p.x) - margin / 2;
|
||||
var y = parseInt(p.y - n.y) - margin;
|
||||
var x = parseInt(p.x, 10) - margin / 2;
|
||||
var y = parseInt(p.y - n.y, 10) - margin;
|
||||
|
||||
// If more in the center, we can safely center
|
||||
if (x > (n.x / 2) + margin) {
|
||||
x = parseInt(p.x - (n.x / 2) + d.x);
|
||||
x = parseInt(p.x - (n.x / 2) + d.x, 10);
|
||||
}
|
||||
|
||||
// Temporarily disabled, since it gives weird results (you can only see
|
||||
|
|
|
@ -46,8 +46,10 @@ JX.install('Prefab', {
|
|||
*
|
||||
*/
|
||||
buildTokenizer : function(config) {
|
||||
var root;
|
||||
|
||||
try {
|
||||
var root = config.root || JX.$(config.id);
|
||||
root = config.root || JX.$(config.id);
|
||||
} catch (ex) {
|
||||
// If the root element does not exist, just return without building
|
||||
// anything. This happens in some cases -- like Conpherence -- where we
|
||||
|
|
|
@ -54,20 +54,20 @@ JX.install('Tooltip', {
|
|||
|
||||
switch (align) {
|
||||
case 'N':
|
||||
node.style.left = parseInt(p.x - ((n.x - d.x) / 2)) + 'px';
|
||||
node.style.top = parseInt(p.y - n.y) + 'px';
|
||||
node.style.left = parseInt(p.x - ((n.x - d.x) / 2), 10) + 'px';
|
||||
node.style.top = parseInt(p.y - n.y, 10) + 'px';
|
||||
break;
|
||||
case 'E':
|
||||
node.style.left = parseInt(p.x + d.x) + 'px';
|
||||
node.style.top = parseInt(p.y - ((n.y - d.y) / 2)) + 'px';
|
||||
node.style.left = parseInt(p.x + d.x, 10) + 'px';
|
||||
node.style.top = parseInt(p.y - ((n.y - d.y) / 2), 10) + 'px';
|
||||
break;
|
||||
case 'S':
|
||||
node.style.left = parseInt(p.x - ((n.x - d.x) / 2)) + 'px';
|
||||
node.style.top = parseInt(p.y + d.y + 5) + 'px';
|
||||
node.style.left = parseInt(p.x - ((n.x - d.x) / 2), 10) + 'px';
|
||||
node.style.top = parseInt(p.y + d.y + 5, 10) + 'px';
|
||||
break;
|
||||
case 'W':
|
||||
node.style.left = parseInt(p.x - n.x - 5) + 'px';
|
||||
node.style.top = parseInt(p.y - ((n.y - d.y) / 2)) + 'px';
|
||||
node.style.left = parseInt(p.x - n.x - 5, 10) + 'px';
|
||||
node.style.top = parseInt(p.y - ((n.y - d.y) / 2), 10) + 'px';
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
|
|
@ -29,7 +29,7 @@ JX.behavior('phabricator-active-nav', function(config) {
|
|||
'phabricator-active-nav-focus',
|
||||
selected);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
|
@ -49,7 +49,8 @@ JX.behavior('phabricator-active-nav', function(config) {
|
|||
|
||||
// Sort the markers by Y position, descending.
|
||||
var markinfo = [];
|
||||
for (var ii = 0; ii < markers.length; ii++) {
|
||||
var ii;
|
||||
for (ii = 0; ii < markers.length; ii++) {
|
||||
markinfo.push({
|
||||
marker: markers[ii],
|
||||
position: JX.$V(markers[ii]).y - 15
|
||||
|
@ -60,7 +61,7 @@ JX.behavior('phabricator-active-nav', function(config) {
|
|||
// Find the first marker above the current scroll position, or the first
|
||||
// marker in the document if we're above all the markers.
|
||||
var active = null;
|
||||
for (var ii = 0; ii < markinfo.length; ii++) {
|
||||
for (ii = 0; ii < markinfo.length; ii++) {
|
||||
active = markinfo[ii].marker;
|
||||
if (markinfo[ii].position <= scroll_position) {
|
||||
break;
|
||||
|
@ -72,13 +73,13 @@ JX.behavior('phabricator-active-nav', function(config) {
|
|||
|
||||
// If we get above the first marker, select it.
|
||||
selectnav(active && JX.Stratcom.getData(active).anchor);
|
||||
}
|
||||
};
|
||||
|
||||
var pending = null;
|
||||
var onviewportchange = function(e) {
|
||||
pending && clearTimeout(pending);
|
||||
pending = setTimeout(updateposition, 100);
|
||||
}
|
||||
};
|
||||
|
||||
JX.Stratcom.listen('scroll', null, onviewportchange);
|
||||
JX.Stratcom.listen('resize', null, onviewportchange);
|
||||
|
|
|
@ -76,7 +76,7 @@ JX.behavior('fancy-datepicker', function(config) {
|
|||
m: JX.DOM.find(root, 'select', 'month-input'),
|
||||
d: JX.DOM.find(root, 'select', 'day-input')
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
var read_date = function() {
|
||||
var i = get_inputs();
|
||||
|
@ -97,7 +97,7 @@ JX.behavior('fancy-datepicker', function(config) {
|
|||
picker.firstChild,
|
||||
[
|
||||
render_month(),
|
||||
render_day(),
|
||||
render_day()
|
||||
]);
|
||||
};
|
||||
|
||||
|
@ -114,7 +114,7 @@ JX.behavior('fancy-datepicker', function(config) {
|
|||
}
|
||||
|
||||
return JX.$N('td', {meta: {value: value}, className: class_name}, label);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Render the top bar which allows you to pick a month and year.
|
||||
|
@ -152,7 +152,8 @@ JX.behavior('fancy-datepicker', function(config) {
|
|||
// First, render the weekday names.
|
||||
var weekdays = 'SMTWTFS';
|
||||
var weekday_names = [];
|
||||
for (var ii = 0; ii < weekdays.length; ii++) {
|
||||
var ii;
|
||||
for (ii = 0; ii < weekdays.length; ii++) {
|
||||
weekday_names.push(cell(weekdays.charAt(ii), null, false, 'day-name'));
|
||||
}
|
||||
weeks.push(JX.$N('tr', {}, weekday_names));
|
||||
|
@ -168,7 +169,7 @@ JX.behavior('fancy-datepicker', function(config) {
|
|||
|
||||
var today = new Date();
|
||||
|
||||
for (var ii = 1; ii <= 31; ii++) {
|
||||
for (ii = 1; ii <= 31; ii++) {
|
||||
var date = new Date(value_y, value_m - 1, ii);
|
||||
if (date.getMonth() != (value_m - 1)) {
|
||||
// We've spilled over into the next month, so stop rendering.
|
||||
|
@ -183,7 +184,7 @@ JX.behavior('fancy-datepicker', function(config) {
|
|||
if (is_today) {
|
||||
classes.push('today');
|
||||
}
|
||||
if (date.getDay() == 0 || date.getDay() == 6) {
|
||||
if (date.getDay() === 0 || date.getDay() == 6) {
|
||||
classes.push('weekend');
|
||||
}
|
||||
|
||||
|
@ -191,7 +192,7 @@ JX.behavior('fancy-datepicker', function(config) {
|
|||
}
|
||||
|
||||
// Slice the days into weeks.
|
||||
for (var ii = 0; ii < days.length; ii += 7) {
|
||||
for (ii = 0; ii < days.length; ii += 7) {
|
||||
weeks.push(JX.$N('tr', {}, days.slice(ii, ii + 7)));
|
||||
}
|
||||
|
||||
|
@ -216,7 +217,7 @@ JX.behavior('fancy-datepicker', function(config) {
|
|||
switch (p[0]) {
|
||||
case 'm':
|
||||
// User clicked left or right month selection buttons.
|
||||
value_m = value_m + parseInt(p[1]);
|
||||
value_m = value_m + parseInt(p[1], 10);
|
||||
if (value_m > 12) {
|
||||
value_m -= 12;
|
||||
value_y++;
|
||||
|
@ -227,7 +228,7 @@ JX.behavior('fancy-datepicker', function(config) {
|
|||
break;
|
||||
case 'd':
|
||||
// User clicked a day.
|
||||
value_d = parseInt(p[1]);
|
||||
value_d = parseInt(p[1], 10);
|
||||
write_date();
|
||||
|
||||
// Wait a moment to close the selector so they can see the effect
|
||||
|
|
|
@ -41,7 +41,7 @@ JX.behavior('global-drag-and-drop', function(config) {
|
|||
files.push(f);
|
||||
|
||||
pending--;
|
||||
if (pending == 0 && !errors) {
|
||||
if (pending === 0 && !errors) {
|
||||
// If whatever the user dropped in has finished uploading, send them to
|
||||
// their uploads.
|
||||
var uri;
|
||||
|
|
|
@ -13,7 +13,7 @@ JX.behavior('phabricator-hovercards', function(config) {
|
|||
// We listen for mousemove instead of mouseover to handle the case when user
|
||||
// scrolls with keyboard. We don't want to display hovercard if node gets
|
||||
// under the mouse cursor randomly placed somewhere on the screen. This
|
||||
// unfortunatelly doesn't work in Google Chrome which triggers both mousemove
|
||||
// unfortunately doesn't work in Google Chrome which triggers both mousemove
|
||||
// and mouseover in this case but works in other browsers.
|
||||
JX.Stratcom.listen(
|
||||
'mousemove',
|
||||
|
|
|
@ -157,7 +157,7 @@ JX.behavior('lightbox-attachments', function (config) {
|
|||
img.onload = function() {
|
||||
JX.DOM.alterClass(img, 'loading', false);
|
||||
JX.Busy.done();
|
||||
}
|
||||
};
|
||||
|
||||
img.src = img_uri;
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ JX.behavior('phabricator-object-selector', function(config) {
|
|||
var cells = [
|
||||
JX.$N('td', {}, view_object_link),
|
||||
JX.$N('th', {}, select_object_link),
|
||||
JX.$N('td', {}, select_object_button),
|
||||
JX.$N('td', {}, select_object_button)
|
||||
];
|
||||
|
||||
var table = JX.$N(
|
||||
|
@ -109,7 +109,7 @@ JX.behavior('phabricator-object-selector', function(config) {
|
|||
|
||||
function sendQuery() {
|
||||
query_timer = null;
|
||||
JX.DOM.setContent(JX.$(config.results), renderNote('Loading...'))
|
||||
JX.DOM.setContent(JX.$(config.results), renderNote('Loading...'));
|
||||
new JX.Request(config.uri, JX.bind(null, onreceive, ++n))
|
||||
.setData({
|
||||
filter: JX.$(config.filter).value,
|
||||
|
|
|
@ -37,7 +37,7 @@ JX.behavior('phabricator-oncopy', function() {
|
|||
var pos;
|
||||
for (var ii = 0; ii < lines.length; ii++) {
|
||||
pos = lines[ii].indexOf(zws);
|
||||
if (pos == -1 && ii != 0) {
|
||||
if (pos == -1 && ii !== 0) {
|
||||
continue;
|
||||
}
|
||||
result.push(lines[ii].substring(pos + 1));
|
||||
|
@ -76,5 +76,5 @@ JX.behavior('phabricator-oncopy', function() {
|
|||
// to work or give me any errors. So you lose your selection when you
|
||||
// copy. Oh well?
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
* javelin-dom
|
||||
* javelin-magical-init
|
||||
* javelin-vector
|
||||
* javelin-request
|
||||
* javelin-util
|
||||
* @javelin
|
||||
*/
|
||||
|
||||
|
@ -46,7 +48,6 @@ JX.behavior('phabricator-nav', function(config) {
|
|||
element: background,
|
||||
parameter: 'width',
|
||||
start: JX.Vector.getDim(background).x,
|
||||
start: JX.Vector.getDim(background).x,
|
||||
minWidth: 1
|
||||
},
|
||||
{
|
||||
|
@ -74,8 +75,9 @@ JX.behavior('phabricator-nav', function(config) {
|
|||
|
||||
var dx = JX.$V(e).x - dragging.x;
|
||||
var panel;
|
||||
var k;
|
||||
|
||||
for (var k = 0; k < track.length; k++) {
|
||||
for (k = 0; k < track.length; k++) {
|
||||
panel = track[k];
|
||||
if (!panel.minWidth) {
|
||||
continue;
|
||||
|
@ -86,7 +88,7 @@ JX.behavior('phabricator-nav', function(config) {
|
|||
}
|
||||
}
|
||||
|
||||
for (var k = 0; k < track.length; k++) {
|
||||
for (k = 0; k < track.length; k++) {
|
||||
panel = track[k];
|
||||
var v = (panel.start + (dx * (panel.scale || 1)));
|
||||
panel.element.style[panel.parameter] = v + 'px';
|
||||
|
@ -115,7 +117,7 @@ JX.behavior('phabricator-nav', function(config) {
|
|||
JX.DOM.alterClass(main, 'has-local-nav', !collapsed);
|
||||
JX.DOM.alterClass(main, 'has-drag-nav', !collapsed);
|
||||
resetdrag();
|
||||
new JX.Request('/settings/adjust/', JX.Bag)
|
||||
new JX.Request('/settings/adjust/', JX.bag)
|
||||
.setData({ key : 'nav-collapsed', value : (collapsed ? 1 : 0) })
|
||||
.send();
|
||||
});
|
||||
|
|
|
@ -119,11 +119,11 @@ JX.behavior('phabricator-remarkup-assist', function(config) {
|
|||
// Now, select just the middle part. For instance, if the user clicked
|
||||
// "B" to create bold text, we insert '**bold**' but just select the word
|
||||
// "bold" so if they type stuff they'll be editing the bold text.
|
||||
var r = JX.TextAreaUtils.getSelectionRange(area);
|
||||
var range = JX.TextAreaUtils.getSelectionRange(area);
|
||||
JX.TextAreaUtils.setSelectionRange(
|
||||
area,
|
||||
r.start + l.length,
|
||||
r.start + l.length + m.length);
|
||||
range.start + l.length,
|
||||
range.start + l.length + m.length);
|
||||
}
|
||||
|
||||
function assist(area, action, root) {
|
||||
|
@ -152,16 +152,16 @@ JX.behavior('phabricator-remarkup-assist', function(config) {
|
|||
sel = ["List Item"];
|
||||
}
|
||||
sel = sel.join("\n" + ch);
|
||||
update(area, ((r.start == 0) ? "" : "\n\n") + ch, sel, "\n\n");
|
||||
update(area, ((r.start === 0) ? "" : "\n\n") + ch, sel, "\n\n");
|
||||
break;
|
||||
case 'code':
|
||||
sel = sel || "foreach ($list as $item) {\n work_miracles($item);\n}";
|
||||
sel = sel.split("\n");
|
||||
sel = " " + sel.join("\n ");
|
||||
update(area, ((r.start == 0) ? "" : "\n\n"), sel, "\n\n");
|
||||
update(area, ((r.start === 0) ? "" : "\n\n"), sel, "\n\n");
|
||||
break;
|
||||
case 'table':
|
||||
update(area, (r.start == 0 ? '' : '\n\n') + '| ', sel || 'data', ' |');
|
||||
update(area, (r.start === 0 ? '' : '\n\n') + '| ', sel || 'data', ' |');
|
||||
break;
|
||||
case 'meme':
|
||||
new JX.Workflow('/macro/meme/create/')
|
||||
|
@ -170,7 +170,7 @@ JX.behavior('phabricator-remarkup-assist', function(config) {
|
|||
area,
|
||||
'',
|
||||
sel,
|
||||
(r.start == 0 ? '' : '\n\n') + response.text + '\n\n');
|
||||
(r.start === 0 ? '' : '\n\n') + response.text + '\n\n');
|
||||
})
|
||||
.start();
|
||||
break;
|
||||
|
|
|
@ -54,5 +54,6 @@ JX.behavior('refresh-csrf', function(config) {
|
|||
|
||||
JX.Request.listen('finally', function(r) {
|
||||
JX.Busy.done();
|
||||
})
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -13,10 +13,11 @@ JX.behavior('phabricator-reveal-content', function(config) {
|
|||
function(e) {
|
||||
e.kill();
|
||||
var nodes = e.getNodeData('reveal-content');
|
||||
for (var ii = 0; ii < nodes.showIDs.length; ii++) {
|
||||
var ii;
|
||||
for (ii = 0; ii < nodes.showIDs.length; ii++) {
|
||||
JX.DOM.show(JX.$(nodes.showIDs[ii]));
|
||||
}
|
||||
for (var ii = 0; ii < nodes.hideIDs.length; ii++) {
|
||||
for (ii = 0; ii < nodes.hideIDs.length; ii++) {
|
||||
JX.DOM.hide(JX.$(nodes.hideIDs[ii]));
|
||||
}
|
||||
});
|
||||
|
|
|
@ -16,7 +16,7 @@ JX.behavior('phabricator-search-typeahead', function(config) {
|
|||
function transform(object) {
|
||||
var attr = {
|
||||
className: 'phabricator-main-search-typeahead-result'
|
||||
}
|
||||
};
|
||||
|
||||
if (object[6]) {
|
||||
attr.style = {backgroundImage: 'url('+object[6]+')'};
|
||||
|
@ -59,7 +59,8 @@ JX.behavior('phabricator-search-typeahead', function(config) {
|
|||
|
||||
var tokens = this.tokenize(value);
|
||||
|
||||
for (var ii = 0; ii < list.length; ii++) {
|
||||
var ii;
|
||||
for (ii = 0; ii < list.length; ii++) {
|
||||
var item = list[ii];
|
||||
if (!item.priority) {
|
||||
continue;
|
||||
|
@ -91,7 +92,7 @@ JX.behavior('phabricator-search-typeahead', function(config) {
|
|||
// we show 3 applications, then 3 users, etc.
|
||||
var type_count = 0;
|
||||
var current_type = null;
|
||||
for (var ii = 0; ii < list.length; ii++) {
|
||||
for (ii = 0; ii < list.length; ii++) {
|
||||
if (list.length <= config.limit) {
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/**
|
||||
* @provides phabricator-phtize
|
||||
* @requires javelin-util
|
||||
* @javelin-installs JX.phtize
|
||||
* @javelin
|
||||
*/
|
||||
|
||||
|
|
Loading…
Reference in a new issue