remove unneeded constants
This commit is contained in:
parent
7282835f0d
commit
8581a3da3a
3 changed files with 47 additions and 43 deletions
|
@ -277,7 +277,8 @@ Ox.Map = function(options, self) {
|
|||
500, 200, 100,
|
||||
50, 20, 10
|
||||
];
|
||||
self.shiftKey = false;
|
||||
self.shiftKey = false,
|
||||
self.tileSize = 256;
|
||||
|
||||
if (self.options.showToolbar) {
|
||||
self.$toolbar = Ox.Bar({
|
||||
|
@ -736,7 +737,7 @@ Ox.Map = function(options, self) {
|
|||
|
||||
function getMetersPerPixel() {
|
||||
// m/px = m/deg * deg/px
|
||||
var degreesPerPixel = 360 / (Ox.MAP_TILE_SIZE * Math.pow(2, self.map.getZoom()));
|
||||
var degreesPerPixel = 360 / (self.tileSize * Math.pow(2, self.map.getZoom()));
|
||||
return Ox.getMetersPerDegree(self.map.getCenter().lat()) * degreesPerPixel;
|
||||
}
|
||||
|
||||
|
@ -748,7 +749,7 @@ Ox.Map = function(options, self) {
|
|||
// fixme: there must be a function for this...
|
||||
/*
|
||||
return Math.ceil(
|
||||
Ox.log(self.mapHeight / Ox.MAP_TILE_SIZE, 2)
|
||||
Ox.log(self.mapHeight / self.tileSize, 2)
|
||||
);
|
||||
*/
|
||||
}
|
||||
|
@ -1321,7 +1322,7 @@ Ox.Map = function(options, self) {
|
|||
|
||||
function spansGlobe() {
|
||||
// fixme: or self.options.width ??
|
||||
return self.$map.width() > Ox.MAP_TILE_SIZE * Math.pow(2, self.map.getZoom());
|
||||
return self.$map.width() > self.tileSize * Math.pow(2, self.map.getZoom());
|
||||
};
|
||||
|
||||
function submitFind(data) {
|
||||
|
|
|
@ -1,20 +1,19 @@
|
|||
'use strict';
|
||||
|
||||
//@ Ox.AMPM <[str]> ['AM', 'PM']
|
||||
//@ Ox.AMPM <[s]> ['AM', 'PM']
|
||||
Ox.AMPM = ['AM', 'PM'];
|
||||
//@ Ox.BASE_32_ALIASES <o> Base 32 aliases
|
||||
Ox.BASE_32_ALIASES = {'I': '1', 'L': '1', 'O': '0', 'U': 'V'},
|
||||
//@ Ox.BASE_32_DIGITS <o> Base 32 digits
|
||||
Ox.BASE_32_DIGITS = '0123456789ABCDEFGHJKMNPQRSTVWXYZ';
|
||||
//@ Ox.BCAD <[str]> ['BC', 'AD']
|
||||
//@ Ox.BCAD <[s]> ['BC', 'AD']
|
||||
Ox.BCAD = ['BC', 'AD'];
|
||||
// fixme: this is unused, and probably unneeded
|
||||
//@ Ox.DURATIONS <[str]> ['year', 'month', 'day', 'hour', 'minute', 'second']
|
||||
Ox.DURATIONS = ['year', 'month', 'day', 'hour', 'minute', 'second'];
|
||||
//@ Ox.EARTH_RADIUS <number> Radius of the earth in meters
|
||||
// see http://en.wikipedia.org/wiki/WGS-84
|
||||
/*@
|
||||
Ox.EARTH_RADIUS <n> Radius of the earth in meters
|
||||
See http://en.wikipedia.org/wiki/WGS-84
|
||||
*/
|
||||
Ox.EARTH_RADIUS = 6378137;
|
||||
//@ Ox.EARTH_CIRCUMFERENCE <num> Circumference of the earth in meters
|
||||
//@ Ox.EARTH_CIRCUMFERENCE <n> Circumference of the earth in meters
|
||||
Ox.EARTH_CIRCUMFERENCE = Ox.EARTH_RADIUS * 2 * Math.PI;
|
||||
//@ Ox.HTML_ENTITIES <object> HTML entities for ... (FIXME)
|
||||
Ox.HTML_ENTITIES = {
|
||||
|
@ -53,31 +52,11 @@ Ox.KEYS = {
|
|||
220: 'backslash', 221: 'closebracket', 222: 'quote', 224: 'meta'
|
||||
// see dojo, for ex.
|
||||
},
|
||||
//@ Ox.KEYWORDS <[s]> JavaScript keywords
|
||||
// see https://developer.mozilla.org/en/JavaScript/Reference
|
||||
Ox.KEYWORDS = [
|
||||
'break',
|
||||
'case', 'catch', 'class', 'const', 'continue',
|
||||
'debugger', 'default', 'delete', 'do',
|
||||
'else', 'enum', 'export', 'extends',
|
||||
'false', 'finally', 'for', 'function',
|
||||
'if', 'implements', 'import', 'in', 'instanceof', 'interface',
|
||||
'let', 'module',
|
||||
'new', 'null',
|
||||
'package', 'private', 'protected', 'public',
|
||||
'return',
|
||||
'super', 'switch', 'static',
|
||||
'this', 'throw', 'true', 'try', 'typeof',
|
||||
'var', 'void',
|
||||
'yield',
|
||||
'while', 'with'
|
||||
];
|
||||
Ox.MAP_TILE_SIZE = 256; // fixme: definitely not needed here
|
||||
//@ Ox.MAX_LATITUDE <n> Maximum latitude of a Mercator projection
|
||||
Ox.MAX_LATITUDE = Ox.deg(Math.atan(Ox.sinh(Math.PI)));
|
||||
//@ Ox.MIN_LATITUDE <n> Minimum latitude of a Mercator projection
|
||||
Ox.MIN_LATITUDE = -Ox.MAX_LATITUDE;
|
||||
//@ Ox.MODIFIER_KEYS <obj> Names for modifier keys
|
||||
//@ Ox.MODIFIER_KEYS <o> Names for modifier keys
|
||||
// meta comes last so that one can differentiate between
|
||||
// alt_control_shift_meta.left and alt_control_shift_meta.right
|
||||
Ox.MODIFIER_KEYS = {
|
||||
|
@ -86,7 +65,7 @@ Ox.MODIFIER_KEYS = {
|
|||
shiftKey: 'shift',
|
||||
metaKey: 'meta' // Mac: command
|
||||
}
|
||||
//@ Ox.MONTHS <[str]> Names of months
|
||||
//@ Ox.MONTHS <[s]> Names of months
|
||||
Ox.MONTHS = [
|
||||
'January', 'February', 'March', 'April', 'May', 'June',
|
||||
'July', 'August', 'September', 'October', 'November', 'December'
|
||||
|
@ -103,11 +82,11 @@ Ox.PATH = Ox.toArray(
|
|||
})[0].src.replace(/Ox\.js$/, '');
|
||||
//@ Ox.PREFIXES <[str]> `['', 'K', 'M', 'G', 'T', 'P']`
|
||||
Ox.PREFIXES = ['', 'K', 'M', 'G', 'T', 'P'];
|
||||
//@ Ox.SEASONS <[str]> Names of the seasons of the year
|
||||
//@ Ox.SEASONS <[s]> Names of the seasons of the year
|
||||
Ox.SEASONS = ['Winter', 'Spring', 'Summer', 'Fall'];
|
||||
//@ Ox.STACK_SIZE <n> Maximum number of arguments
|
||||
Ox.STACK_SIZE = 65536;
|
||||
//@ Ox.SYMBOLS <obj> Unicode characters for symbols
|
||||
//@ Ox.SYMBOLS <o> Unicode characters for symbols
|
||||
Ox.SYMBOLS = {
|
||||
DOLLAR: '\u0024',
|
||||
CENT: '\u00A2', POUND: '\u00A3', CURRENCY: '\u00A4', YEN: '\u00A5',
|
||||
|
@ -133,13 +112,13 @@ Ox.SYMBOLS = {
|
|||
CLOSE: '\u2715', BALLOT: '\u2717', WINDOWS: '\u2756',
|
||||
EDIT: '\uF802', CLICK: '\uF803', APPLE: '\uF8FF'
|
||||
};
|
||||
//@ Ox.VERSION <str> OxJS version number
|
||||
//@ Ox.VERSION <s> OxJS version number
|
||||
Ox.VERSION = '0.1';
|
||||
//@ Ox.WEEKDAYS <[str]> Names of weekdays
|
||||
//@ Ox.WEEKDAYS <[s]> Names of weekdays
|
||||
Ox.WEEKDAYS = [
|
||||
'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'
|
||||
];
|
||||
//@ Ox.SHORT_WEEKDAYS <[str]> Short names of weekdays
|
||||
//@ Ox.SHORT_WEEKDAYS <[s]> Short names of weekdays
|
||||
Ox.SHORT_WEEKDAYS = Ox.WEEKDAYS.map(function(val) {
|
||||
return val.slice(0, 3);
|
||||
});
|
||||
|
|
|
@ -475,9 +475,15 @@ Ox.doc = (function() {
|
|||
|
||||
/*@
|
||||
Ox.identify <f> Returns the type of a JavaScript identifier
|
||||
(str) -> <s> Type
|
||||
(string) -> <s> Type
|
||||
Type can be `constant`, `identifier`, `keyword`, `method`, `object` or
|
||||
`property`.
|
||||
> Ox.identify('foo')
|
||||
'identifier'
|
||||
> Ox.identify('break')
|
||||
'keyword'
|
||||
> Ox.identify('window')
|
||||
'object'
|
||||
@*/
|
||||
Ox.identify = (function() {
|
||||
// see https://developer.mozilla.org/en/JavaScript/Reference
|
||||
|
@ -488,6 +494,23 @@ Ox.identify = (function() {
|
|||
// Number
|
||||
'MAX_VALUE', 'MIN_VALUE', 'NEGATIVE_INFINITY', 'POSITIVE_INFINITY'
|
||||
],
|
||||
keyword: [
|
||||
'break',
|
||||
'case', 'catch', 'class', 'const', 'continue',
|
||||
'debugger', 'default', 'delete', 'do',
|
||||
'else', 'enum', 'export', 'extends',
|
||||
'false', 'finally', 'for', 'function',
|
||||
'if', 'implements', 'import', 'in', 'instanceof', 'interface',
|
||||
'let', 'module',
|
||||
'new', 'null',
|
||||
'package', 'private', 'protected', 'public',
|
||||
'return',
|
||||
'super', 'switch', 'static',
|
||||
'this', 'throw', 'true', 'try', 'typeof',
|
||||
'var', 'void',
|
||||
'yield',
|
||||
'while', 'with'
|
||||
],
|
||||
method: [
|
||||
// Array
|
||||
'concat',
|
||||
|
@ -615,10 +638,11 @@ Ox.identify = (function() {
|
|||
};
|
||||
return function(identifier) {
|
||||
var ret;
|
||||
if (Ox.KEYWORDS.indexOf(identifier) > -1) {
|
||||
ret = 'keyword'
|
||||
if (identifiers.keyword.indexOf(identifier) > -1) {
|
||||
// fast track for keywords (used in Ox.tokenize)
|
||||
ret = 'keyword';
|
||||
} else {
|
||||
ret = 'identifier'
|
||||
ret = 'identifier';
|
||||
Ox.forEach(identifiers, function(words, type) {
|
||||
if (words.indexOf(identifier) > -1) {
|
||||
ret = type;
|
||||
|
|
Loading…
Reference in a new issue