Add util module

(imported from commit 3844e136fb799c6f57f8823255addf00a07ef686)
This commit is contained in:
Zev Benjamin 2012-11-30 12:33:32 -05:00
parent d29c77b14c
commit 46f4a5eb38
4 changed files with 16 additions and 0 deletions

View File

@ -40,6 +40,7 @@
<script type="text/javascript" src="/static/third/jquery-throttle-debounce/jquery.ba-throttle-debounce.min.js"></script>
<script type="text/javascript" src="/static/third/jquery.idle/jquery.idle.js"></script>
<script type="text/javascript" src="/static/third/jquery-autosize/jquery.autosize.js"></script>
<script type="text/javascript" src="{{ static_hidden }}js/util.js"></script>
<script type="text/javascript" src="{{ static_hidden }}js/setup.js"></script>
<script type="text/javascript" src="{{ static_hidden }}js/rows.js"></script>
<script type="text/javascript" src="{{ static_hidden }}js/narrow.js"></script>

View File

@ -48,6 +48,9 @@ var globals =
// ui.js
+ ' ui'
// util.js
+ ' util'
// zephyr.js
+ ' message_array message_dict get_updates_params'
+ ' clear_table add_to_table add_messages'

View File

@ -0,0 +1 @@
../../../static/js/util.js

11
zephyr/static/js/util.js Normal file
View File

@ -0,0 +1,11 @@
var util = (function () {
var exports = {};
// From MDN: https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/random
exports.random_int = function random_int(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
};
return exports;
}());