wdgt H =1 5 5 `
mainWindow
SBUL Field Conditions
270
400
true
true
backing
Resources/backing.png
12
20
shine
Resources/shine.png
14
20
light
Resources/yellow.png
Check Back Later
19
25
comment
#000
14
left
autoLeft
330
46
34
Loading...
updated
#fff
10
left
46
47
triangle
Resources/opentriangle.png
true
350
40
gamesDisplay();
"Next Games"
games
true
275
0
90
52
false
fieldConditionsTimer
1800
true
Colors
backgroundColor
ColorPrefs
Background Color:
Choose the color for the widget background.
color
rgba(127, 127, 127, 1)
commentColor
ColorPrefs
Field Status Color:
Choose the text color for the field status.
color
rgba(0, 0, 0, 1)
updatedColor
ColorPrefs
Update Information Color:
Choose the text color for the update information.
color
rgba(255, 255, 255, 1)
gamesColor
ColorPrefs
Next Games Background Color:
Choose the background color for the Next Games display.
color
rgba(103, 103, 103, 1)
Resources/About.png
Arial
12
132
75
#ffffff
#000000
0
1
SBUL Field Conditions Widget
Arial
18
130
60
#ffffff
#000000
0
1
H var SBUL_URL = "http://sbul.org/api/dispatcher.php?";
var RESOURCES = {
"open" : {src: "Resources/green.png", tooltip: "Fields are Open"},
"closed" : {src: "Resources/red.png", tooltip: "Fields are Closed"},
"check" : {src: "Resources/yellow.png", tooltip: "Check Back Later"},
"unknown": {src: "Resources/yellow.png", tooltip: "Data Error. Check Back Later"}
};
var _currentStatus;
var _gamesShowing = false;
function getLatestFieldConditions() {
var theJSON, fieldConditions;
var sbulFieldConditionsURL = new URL();
sbulFieldConditionsURL.location = SBUL_URL + "appid=fieldConditions";
theJSON = sbulFieldConditionsURL.fetch();
fieldConditions = JSON.parse(theJSON);
if (!RESOURCES[fieldConditions.status]) {
fieldConditions.status = "unknown";
}
light.src = RESOURCES[fieldConditions.status].src;
light.tooltip = RESOURCES[fieldConditions.status].tooltip;
updated.data = "Updated " + fieldConditions.updated + " by " + fieldConditions.name;
comment.data = fieldConditions.comment;
if (_currentStatus !== fieldConditions.status) {
_currentStatus = fieldConditions.status;
beep();
}
}
function getNextGames() {
var theJSON, nextGames;
var sbulNextGamesURL = new URL();
sbulNextGamesURL.location = SBUL_URL + "appid=nextGames";
games.html = sbulNextGamesURL.fetch();
}
function gamesDisplay() {
if (_gamesShowing) {
triangle.src = "Resources/opentriangle.png";
animator.start(new ResizeAnimation(games, 275, 0, 400, animator.kEaseOut));
}
else {
games.html = "Loading...";
triangle.src = "Resources/closetriangle.png";
animator.start(
new ResizeAnimation(games, 275, 215, 400, animator.kEaseOut, getNextGames)
);
}
_gamesShowing = !_gamesShowing;
}
function setPrefs() {
backing.colorize = preferences.backgroundColor.value;
games.style.backgroundColor = preferences.gamesColor.value;
comment.color = preferences.commentColor.value;
updated.color = preferences.updatedColor.value;
}$ ' $ a> /*
json2.js
2007-10-28
Public Domain
This file creates a global JSON object containing two methods:
JSON.stringify(value, whitelist)
value any JavaScript value, usually an object or array.
whitelist an optional that determines how object values are
stringified.
This method produces a JSON text from a JavaScript value.
There are three possible ways to stringify an object, depending
on the optional whitelist parameter.
If an object has a toJSON method, then the toJSON() method will be
called. The value returned from the toJSON method will be
stringified.
Otherwise, if the optional whitelist parameter is an array, then
the elements of the array will be used to select members of the
object for stringification.
Otherwise, if there is no whitelist parameter, then all of the
members of the object will be stringified.
Values that do not have JSON representaions, such as undefined or
functions, will not be serialized. Such values in objects will be
dropped, in arrays will be replaced with null. JSON.stringify()
returns undefined. Dates will be stringified as quoted ISO dates.
Example:
var text = JSON.stringify(['e', {pluribus, 'unum'}]);
// text is '["e",{"pluribus":"unum"}]'
JSON.parse(text, filter)
This method parses a JSON text to produce an object or
array. It can throw a SyntaxError exception.
The optional filter parameter is a function that can filter and
transform the results. It receives each of the keys and values, and
its return value is used instead of the original value. If it
returns what it received, then structure is not modified. If it
returns undefined then the member is deleted.
Example:
// Parse the text. If a key contains the string 'date' then
// convert the value to a date.
myData = JON.parse(text, function (key, value) {
return key.indexOf('date') >= 0 ? new Date(value) : value;
});
This is a reference implementation. You are free to copy, modify, or
redistribute.
Use your own copy. It is extremely unwise to load third party
code into your pages.
*/
/*jslint evil: true */
/*extern JSON */
if (!this.JSON) {
JSON = function () {
function f(n) { // Format integers to have at least two digits.
return n < 10 ? '0' + n : n;
}
Date.prototype.toJSON = function () {
// Eventually, this method will be based on the date.toISOString method.
return this.getUTCFullYear() + '-' +
f(this.getUTCMonth() + 1) + '-' +
f(this.getUTCDate()) + 'T' +
f(this.getUTCHours()) + ':' +
f(this.getUTCMinutes()) + ':' +
f(this.getUTCSeconds()) + 'Z';
};
var m = { // table of character substitutions
'\b': '\\b',
'\t': '\\t',
'\n': '\\n',
'\f': '\\f',
'\r': '\\r',
'"' : '\\"',
'\\': '\\\\'
};
function stringify(value, whitelist) {
var a, // The array holding the partial texts.
i, // The loop counter.
k, // The member key.
l, // Length.
v; // The member value.
switch (typeof value) {
case 'string':
// If the string contains no control characters, no quote characters, and no
// backslash characters, then we can safely slap some quotes around it.
// Otherwise we must also replace the offending characters with safe sequences.
if (/["\\\x00-\x1f]/.test(value)) {
return '"' + value.replace(/[\x00-\x1f\\"]/g, function (a) {
var c = m[a];
if (c) {
return c;
}
c = a.charCodeAt();
return '\\u00' + Math.floor(c / 16).toString(16) +
(c % 16).toString(16);
}) + '"';
}
return '"' + value + '"';
case 'number':
// JSON numbers must be finite. Encode non-finite numbers as null.
return isFinite(value) ? String(value) : 'null';
case 'boolean':
return String(value);
case 'null':
return 'null';
case 'object':
// Due to a specification error in ECMAScript,
// typeof null is 'object', so watch out for that case.
if (!value) {
return 'null';
}
// If the object has a toJSON method, call it, and stringify the result.
if (typeof value.toJSON === 'function') {
return stringify(value.toJSON());
}
a = [];
if (value.constructor === Array) {
// The object is an array. Stringify every element. Use null as a placeholder
// for non-JSON values.
l = value.length;
for (i = 0; i < l; i += 1) {
a.push(stringify(value[i], whitelist) || 'null');
}
// Join all of the elements together and wrap them in brackets.
return '[' + a.join(',') + ']';
}
if (whitelist) {
// If a whitelist (array of keys) is provided, use it to select the components
// of the object.
l = whitelist.length;
for (i = 0; i < l; i += 1) {
k = whitelist[i];
if (typeof k === 'string') {
v = stringify(value[k], whitelist);
if (v) {
a.push(stringify(k) + ':' + v);
}
}
}
} else {
// Otherwise, iterate through all of the keys in the object.
for (k in value) {
if (typeof k === 'string') {
v = stringify(value[k], whitelist);
if (v) {
a.push(stringify(k) + ':' + v);
}
}
}
}
// Join all of the member texts together and wrap them in braces.
return '{' + a.join(',') + '}';
}
};
return {
stringify: stringify,
parse: function (text, filter) {
var j;
function walk(k, v) {
var i, n;
if (v && typeof v === 'object') {
for (i in v) {
if (Object.prototype.hasOwnProperty.apply(v, [i])) {
n = walk(i, v[i]);
if (n !== undefined) {
v[i] = n;
}
}
}
}
return filter(k, v);
}
// Parsing happens in three stages. In the first stage, we run the text against
// regular expressions that look for non-JSON pattern. We are especially
// concerned with '()' and 'new' because they can cause invocation, and '='
// because it can cause mutation. But just to be safe, we want to reject all
// unexpected forms.
// We split the first stage into 4 regexp operations in order to work around
// crippling inefficiencies in IE's and Safari's regexp engines. First we
// replace all backslash pairs with '@' (a non-JSON character). Second, we
// replace all simple value tokens with ']' characters. Third, we delete all
// open brackets that follow a colon or comma or that begin the text. Finally,
// we look to see that the remaining characters are only whitespace or ']' or
// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
if (/^[\],:{}\s]*$/.test(text.replace(/\\./g, '@').
replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(:?[eE][+\-]?\d+)?/g, ']').
replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
// In the second stage we use the eval function to compile the text into a
// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
// in JavaScript: it can begin a block or an object literal. We wrap the text
// in parens to eliminate the ambiguity.
j = eval('(' + text + ')');
// In the optional third stage, we recursively walk the new structure, passing
// each name/value pair to a filter function for possible transformation.
return typeof filter === 'function' ? walk('', j) : j;
}
// If the text is not JSON parseable, then a SyntaxError is thrown.
throw new SyntaxError('parseJSON');
}
};
}();
}
/ } PNG
IHDR ƅ pHYs gAMA |Q cHRM z% u0 ` : o_F rIDATxȡ @肇yKFl6
M7 b!`B(0zQ0
F8hhe9 XT3fBLU*`Q0
o^Yh/Z <&gH (`@4A+
ZEH{$( @ u0!UPu@Ğ@J@ `Q0 xo@Z0A0"NPz# 4@
G@