first commit

This commit is contained in:
MaddoScientisto 2026-03-14 20:04:39 +01:00
commit 4d332ef662
27586 changed files with 3281783 additions and 0 deletions

View file

@ -0,0 +1,11 @@
#### Tests for ImageMapster
5/15/2012
I am in the process of revising the test suite to use IQTest, a promise-aware testing framework I am developing. You can find the source on my github portal. This framework is designed around the assertions from [buster.js]
(http://busterjs.org/) and uses the [when.js](https://github.com/cujojs/) promise library. The goal is a framwork that permits using a terse syntax that can incorporate callbacks in a single statement without the need for excessively verbose syntax.
The dev code (1.2.4.067) is considered stable; it will become an official release when I'm finished updating the tests..
The old tests (loaded from `test.html`) are no longer supported. They are still here until I finish the update but should not be considered functional.

View file

@ -0,0 +1,110 @@
/*global Test: true, iqtest */
/*jslint onevar: false */
this.tests = this.tests || [];
this.tests.push(
iqtest.create("utility","tests for core/common functionality")
.add("Utility Functions", function (a, r) {
var result,
mu = $.mapster.utils;
a.isTrue(mu.isBool(true), "isBool returns true=true");
a.isTrue(mu.isBool(false), "isBool returns false=true");
a.isFalse(mu.isBool(null), "isBool returns null=false");
a.equals(mu.boolOrDefault(true), true, "boolOrDefault(true) returns true");
a.equals(mu.boolOrDefault(false), false, "boolOrDefault(false) returns false");
a.equals(mu.boolOrDefault("something"), false, "boolOrDefault('something') (a truthy value) returns false");
a.equals(mu.boolOrDefault(null), false, "boolOrDefault(null) (a falsy value) returns false");
a.equals(mu.boolOrDefault(true, "foo"), true, "boolOrDefault(true) with default value returns true");
a.equals(mu.boolOrDefault(false, "foo"), false, "boolOrDefault(false) with default value returns false");
a.equals(mu.boolOrDefault("something", "foo"), "foo", "boolOrDefault('something') (a falsy value) with default value returns default");
a.equals(mu.boolOrDefault(undefined, "foo"), "foo", "boolOrDefault(undefined) (a falsy value) with default value returns default");
// test the extend-like function
var obj = { a: "a", b: "b" };
var otherObj = { a: "a2", b: "b2", c: "c" };
var arrObj = { a: [1, 2], b: { a: "a2", b: "b2"} };
result = mu.updateProps({}, arrObj);
a.equals([1, 2], result.a, "Array copied as array");
result = mu.updateProps(obj, otherObj);
a.equals(result, { a: "a2", b: "b2" }, "Merge with extra properties - no add");
// input object should be affected
a.equals(obj, { a: "a2", b: "b2" }, "Test input object following merge matches output");
result = mu.updateProps(otherObj, obj, otherObj);
a.equals(result, { a: "a2", b: "b2", c: "c" }, "Merge with extra properties - add");
otherObj = { a: "a3" };
result = mu.updateProps(obj, otherObj);
// ut.assertPropsEq(function () { return u.updateProps(result, otherObj); }, { a: "a3", b: "b2", c: "c" }, "Merge with missing properties");
// test several at once
obj = { a: "unchanged-a", b: "unchanged-b" };
otherObj = { b: "b4" };
var otherObj2 = { a: "a4" };
a.equals(mu.updateProps(obj, otherObj, otherObj2), { a: "a4", b: "b4" }, "Merge with mutiple inputs");
var templateObj = { p1: "prop1", p2: "prop2" };
otherObj = { p1: "newProp1", p3: "prop3", p4: "prop4" };
a.equals(mu.updateProps({}, templateObj, otherObj), { p1: "newProp1", p2: "prop2" }, "Template works.");
var expectedResult = { p1: "newProp1", p2: "prop2", p4: "prop4" };
//ut.assertPropsEq(u.updateProps({},templateObj, otherObj, ), expectedResult, "Ignore works.");
templateObj.p3 = { subp1: "subprop1", subp2: "subprop2" };
templateObj.p4 = null;
result = { };
expectedResult.p3 = otherObj.p3;
mu.updateProps(result, templateObj, otherObj);
a.equals(result, expectedResult, "Copying a sub-object - start");
delete otherObj.p3;
result.p3 = { existing: "bar" };
expectedResult.p3 = templateObj.p3;
expectedResult.p3.existing = "bar";
mu.updateProps(result, templateObj, otherObj);
a.equals(result, expectedResult, "Deep works");
// test indexOfProp
obj = { test: "test" };
var arr = [{ name: "test1", value: "value1" }, { name: "test2", value: "value2" }, { name: "test3", value: obj}];
var index = mu.indexOfProp(arr, "name", "test2");
a.equals(index, 1, "arrayIndexOfProp returns correct value for string");
index = mu.indexOfProp(arr, "value", obj);
a.equals(index, 2, "arrayIndexOfProp returns correct value for object & last element");
index = mu.indexOfProp(arr, "name", "test1");
a.equals(index, 0, "arrayIndexOfProp returns correct value for first element");
index = mu.indexOfProp(arr, "foo", "bar");
a.equals(index, -1, "Missing property handled correctly");
index = mu.indexOfProp(arr, "name", "bar");
a.equals(index, -1, "Missing property value handled correctly");
}));

View file

@ -0,0 +1,43 @@
/*global iqtest, u, map_options, image, group_setup */
/*jslint onevar: false */
this.tests = this.tests || [];
this.tests.push(
iqtest.create("data","data access features (non-UI)")
.add("'keys' method", function (a, r) {
var map;
// create a promise from the "onConfigured" callback
this.when(function(cb) {
map=image.mapster(
u.extend({},map_options,{
onConfigured: cb
}
));
}).then(function() {
var keys=map.mapster('keys','TX');
a.equals('TX',keys,"Got primary key for something with only one key");
keys=map.mapster('keys','ME');
a.equals('ME',keys,"Got primary key for something with multiple keys");
keys=map.mapster('keys','new-england');
a.collectionEquals('ME,VT,NH,CT,RI,MA',keys,"Got primary key for something with multiple keys");
keys=map.mapster('keys','new-england',true);
a.collectionEquals('ME,VT,NH,CT,RI,MA,new-england,really-cold',keys,"Got primary key for something with multiple keys");
keys = $('area[state="HI"]').mapster('keys');
a.equals('HI',keys,"Got primary key from an area");
var areas = $('area[state="HI"],area[state*="new-england"]');
keys = areas.mapster('keys');
a.collectionEquals('HI,ME,VT,NH,CT,RI,MA',keys,"Got primary key for something with multiple keys");
});
}));

View file

@ -0,0 +1,83 @@
/*global Test: true, iqtest, image, map_options, areas */
/*jslint onevar: false */
this.tests = this.tests || [];
this.tests.push(
iqtest.create("events","tests for imagemapster events")
.add("Mouse Events", function (a, r) {
var me = this,
getPromise = function(name) {
return me.promises(name);
},
map = image.mapster($.extend(map_options, {
onConfigured: getPromise("configured").resolve
}));
function setCallback(opt,cb) {
var obj = {};
obj[opt]=function(e) {
e.this_context = this;
cb(e);
};
map.mapster('set_options', obj);
}
getPromise("configured").then(function() {
setCallback('onMouseover',getPromise("mouseover1").resolve);
areas.find('area[state="NV"]').first().mouseover();
});
getPromise("mouseover1").then(function(e) {
a.truthy(e, "Mouseover fired for Nevada");
a.equals(e.selected, false, "Selected state returned correctly");
a.equals(e.key, "NV", "Key returned correctly");
setCallback('onMouseover',getPromise("mouseover2").resolve);
areas.find('area[state="AK"]').first().mouseover();
});
getPromise("mouseover2").then(function(e) {
a.truthy(e, "Mouseover fired for Alaska");
a.equals(e.selected, true, "Selected state returned correctly");
a.equals(e.key, "AK", "Key returned correctly");
setCallback('onMouseout',getPromise("mouseout1").resolve);
areas.find('area[state="AK"]').first().mouseout();
});
getPromise("mouseout1").then(function(e) {
a.truthy(e, "Mouseout fired for Nevada");
a.equals("AK",e.key,"Correct key returned by mouseout");
a.equals(e.selected, true, "Selected state returned correctly");
setCallback('onClick',getPromise("click1").resolve);
areas.find('area[state="GA"]').first().click();
});
getPromise("click1").then(function(e) {
a.equals(e.key, "GA", "Click callback fired for Georgia, and key was correct");
a.equals(e.selected, true, "Click callback fired for Georgia, and selected was correct");
a.equals(e.this_context, areas.find('area[state="GA"]')[0], "Click callback fired for Georgia, and 'this' was correct");
setCallback('onClick',getPromise("click2").resolve);
areas.find('area[state="OR"]').first().click();
});
getPromise("click2").then(function(e) {
a.equals(e.key, "OR", "Click callback fired for Oregon, and key was correct");
a.equals(e.selected, false, "Click callback fired for Oregon, and selected was correct");
getPromise("finished").resolve();
});
a.resolves(getPromise("finished"),"The last test was run");
}));

View file

@ -0,0 +1,71 @@
/*
Shared resources, setup & teardown. This must be included for all tests.
*/
/*global Test: true, iqtest */
/*jslint onevar: false */
var image, areas, map_options, map_copy,
u = iqtest.impl.utility;
$(document).ready(function() {
map_copy= $('#usa_image').clone();
});
var group_setup=function() {
// start with a clean mapster slate
$('img').mapster('unbind');
// always start with a clean map for each group
$('#usa_image').replaceWith(map_copy.clone());
image = $('#usa_image');
areas = $('#usa_image_map');
map_options = {
isSelectable: true,
singleSelect: false,
mapKey: 'state',
mapValue: 'full',
listKey: 'name',
listSelectedAttribute: 'checked',
sortList: "asc",
showToolTip: true,
toolTipClose: ["area-mouseout"],
areas: [
{
key: "TX",
selected: true
}
,
{
key: "AK",
isSelectable: false,
selected: true
}
,
{
key: "WA",
staticState: true
}
,
{
key: "OR",
staticState: false
},
{
key: "CA",
toolTip: $('<div>Don\'t mess with Louisiana. Why ? <a href = "http://dontmesswithtexas.org/" target="_blank" > Click here </a> for more info. </div> ')
}
]
};
};
// create a default setup
iqtest.configure({
setup: group_setup
});

View file

@ -0,0 +1,303 @@
<html>
<head>
<title>ImageMapster Browser Test Runner</title>
<script type="text/javascript" src="redist/jquery.1.9.1.js"></script>
<!--<script type="text/javascript" src="redist/zepto.js"></script>-->
<script type="text/javascript" src="redist/common.utils.1.0.js"></script>
<script type="text/javascript" src="redist/iqtest-browser-default.js" ></script>
<script type="text/javascript" src="global.tests.js" ></script>
<script type="text/javascript" src="core.tests.js" ></script>
<script type="text/javascript" src="data.tests.js" ></script>
<script type="text/javascript" src="resize.tests.js" ></script>
<script type="text/javascript" src="events.tests.js" ></script>
<script type="text/javascript" src="migrated.tests.js" ></script>
<script type="text/javascript" src="tooltip.tests.js" ></script>
<!--<script type="text/javascript" src="../src/zepto.js"></script>-->
<script type="text/javascript" src="../src/redist/when.js"></script>
<script type="text/javascript" src="../src/core.js"></script>
<script type="text/javascript" src="../src/graphics.js"></script>
<script type="text/javascript" src="../src/mapimage.js"></script>
<script type="text/javascript" src="../src/mapdata.js"></script>
<script type="text/javascript" src="../src/areadata.js"></script>
<script type="text/javascript" src="../src/areacorners.js"></script>
<script type="text/javascript" src="../src/scale.js"></script>
<script type="text/javascript" src="../src/tooltip.js"></script>
<!--
<script type="text/javascript" src="../dist/jquery.imagemapster.js"></script>
-->
</head>
<body>
<script type="text/javascript">
/*jslint onevar: false */
/*global tests, when, iqtest,u */
// the "tests" variable is created or populated by each included test.
var allSel = 'input[type="checkbox"]',
checkedSel = 'input[type="checkbox"]:checked',
runCount = 0,
activeGroups=[];
// set up some global stuff for the tests to use
function enableTestLink() {
$('#startTest').toggle(!!$(checkedSel).length);
}
function runActiveGroups(nextIndex,lastIndex) {
var next = nextIndex || 0,
last = lastIndex || activeGroups.length-1,
cur = activeGroups[next];
cur.run().then(function() {
if (next<last) {
// use a timer to break the promise chain between test groups.
window.setTimeout(function() {
runActiveGroups(next+1,last);
},50);
}
});
}
function startTests() {
var testGroups,
stopped = false;
function error(message) {
$('#wrap').text(message);
stopped = true;
}
if (runCount > 0) {
$('#oldRuns').append($('<hr />Prior Test Run #' + runCount + '<hr />'))
.append($('#wrap').children());
$('#wrap').empty();
}
runCount++;
activeGroups=[];
testGroups= $('input[type="checkbox"]:checked');
testGroups.each(function (i, e) {
// invoke the test method, and when it returns itself from the promise,
// add it to the group.
var cur,
testName = $(e).val();
cur = tests.first(function() {
return this.name===testName;
});
if (!cur) {
error("Couldn't find a test named '" + testName + "'");
return;
}
activeGroups.push(cur);
});
runActiveGroups();
if (!stopped) {
$('#rerunTest').show();
}
}
function buildCheckboxList() {
var container = $('#test-checkboxes');
$.each(tests,function(i,e) {
container.append('<li><input type="checkbox" value="{0}" />&nbsp;{1}</li>'
.format(e.name,e.desc ? e.name+': '+e.desc : e.desc));
});
}
function bindUIEvents() {
$(allSel).bind('change',function() {
enableTestLink();
});
$('#testSelectAll').bind('click',function(e)
{
var checked=$(checkedSel),
all = $(allSel);
if (checked.length && checked.length===all.length){
all.prop('checked',false);
} else {
all.prop('checked',true);
}
enableTestLink();
});
$('#toggleTestImage').bind('click',function(e)
{
$('#testElements').toggle('fast');
});
enableTestLink();
$('#rerunTest').bind('click', function (e) {
runActiveGroups();
}).hide();
$('#startTest').bind('click',startTests);
}
function configureTests() {
tests.forEach(function(e) {
e.writer("html",$('#wrap'));
});
}
$(document).ready(function () {
buildCheckboxList();
bindUIEvents();
configureTests();
});
</script>
<style type="text/css">
li {
list-style-type: none;
display: block;
}
</style>
<h1>ImageMapster Test Runner</h1>
<div>
<b>Choose tests to run: </b>
<a href="#" id="testSelectAll">select all</a>&nbsp;
<a href="#" id="startTest">run tests</a>&nbsp;&nbsp;
<ul id="test-checkboxes">
</ul>
<a href="#" id="rerunTest">rerun last group</a>
</div>
<div id="wrap" >
</div>
<div id="oldRuns">
</div>
<a href="#" id="toggleTestImage">show/hide test image</a>
<div id="testElements" style="margin-top: 20px; border: 1px solid black; display: none;">
<img id="usa_image" src="images/usa_map_720.png" width="720" height="445" usemap="#usa" >
<map id="usa_image_map" name="usa">
<area href="#" state="ME,new-england,really-cold" full="Maine" shape="poly" coords="669,71,671,72,672,75,672,76,671,80,669,80,667,83,663,86,660,85,659,86,658,87,657,88,659,89,658,89,658,92,656,92,656,90,656,89,655,89,653,87,652,88,653,89,653,90,653,91,653,93,653,95,652,96,650,97,650,98,646,101,644,101,644,100,641,103,642,105,641,106,641,110,640,115,638,114,638,112,635,111,635,109,629,92,626,81,628,81,629,81,629,80,629,75,631,72,632,69,631,68,631,63,632,62,632,60,632,59,632,56,633,52,635,46,637,43,638,43,638,43,638,44,639,45,641,46,642,45,642,44,645,42,647,41,647,41,652,43,653,44,659,65,664,65,665,67,665,70,667,72,668,72,668,71,667,71,669,71">
<area href="#" state="ME,new-england,really-cold" shape="poly" coords="654,92,655,92,656,92,656,94,655,95,654,92">
<area href="#" state="ME,new-england,really-cold" shape="poly" coords="659,88,660,89,662,87,662,86,660,86,659,88">
<area href="#" state="NH,new-england,really-cold" shape="poly" coords="639,118,639,117,640,115,638,114,638,112,635,111,635,109,629,92,626,81,626,81,625,83,624,82,623,81,623,83,622,87,622,91,623,93,623,96,621,99,619,100,619,101,620,102,620,108,619,115,619,118,620,119,620,122,620,124,620,125,633,122,635,122,636,119,639,118">
<area href="#" state="NH,new-england,really-cold" full="New Hampshire" shape="rect" coords="512,29,586,44">
<area href="#" state="VT,new-england,really-cold" full="Vermont" shape="rect" coords="543,49,586,62">
<area href="#" state="VT,new-england,really-cold" shape="poly" coords="611,127,611,123,609,115,608,115,606,113,607,112,606,110,605,107,605,104,605,100,603,95,602,92,622,87,622,91,623,93,623,96,621,99,619,100,619,101,620,102,620,108,619,115,619,118,620,119,620,122,620,124,620,125,615,126,611,127">
<area href="#" state="MA,new-england" full="Massachusetts" shape="rect" coords="515,68,585,80">
<area href="#" state="MA,new-england" full="Massachusetts" shape="poly" coords="653,140,654,140,654,139,655,139,656,140,655,141,652,141,653,140">
<area href="#" state="MA,new-england" shape="poly" coords="645,141,647,139,648,139,650,140,648,141,647,142,645,141">
<area href="#" state="MA,new-england" shape="poly" coords="620,125,633,122,635,122,636,119,639,118,641,122,639,125,639,126,641,128,641,128,642,128,644,129,647,134,650,134,651,134,653,132,652,130,650,129,649,129,648,128,649,128,650,128,652,128,653,131,654,132,654,134,651,135,648,137,645,140,644,141,644,140,646,140,646,138,645,136,644,137,643,138,643,140,641,140,639,137,637,134,635,134,632,134,628,135,612,139,611,134,611,127,615,126,620,125">
<area href="#" state="CT,new-england" full="Connecticut" shape="poly" coords="634,145,633,142,632,139,632,134,628,135,612,139,612,141,614,146,614,152,613,154,614,155,617,153,620,151,621,149,622,149,624,149,628,148,634,145">
<area href="#" state="CT,new-england" full="Connecticut" shape="rect" coords="655,167,711,179">
<area href="#" state="RI,new-england" full="Rhode Island" shape="rect" coords="650,149,711,161">
<area href="#" state="RI,new-england" full="Rhode Island" shape="poly" coords="633,145,633,142,632,139,632,134,635,134,637,134,639,137,641,140,639,142,638,141,638,143,635,144,633,145">
<area href="#" state="NJ" full="New Jersey" shape="rect" coords="656,185,711,198">
<area href="#" state="DE" full="Delaware" shape="rect" coords="665,204,711,216">
<area href="#" state="MD" full="Maryland" shape="rect" coords="667,223,711,235">
<area href="#" state="DC" full="District of Columbia" shape="rect" coords="654,239,711,252">
<area href="#" state="WV" full="West Virginia" shape="rect" coords="649,257,711,270">
<area href="#" state="SC" full="South Carolina" shape="poly" coords="551,314,551,314,548,314,548,312,547,310,545,308,544,308,542,304,540,299,537,299,536,297,535,295,533,293,532,293,530,290,528,289,524,287,524,287,523,284,522,284,520,280,518,280,515,278,513,277,513,276,514,275,515,274,515,272,520,270,526,267,531,266,543,266,545,267,546,270,549,269,559,269,560,269,570,275,577,281,573,284,572,289,571,293,569,294,569,296,567,296,566,299,563,301,562,303,561,304,558,306,556,307,557,309,553,313,551,314">
<area href="#" state="HI" full="Hawaii" shape="poly" coords="169,391,170,389,172,388,172,389,170,391,169,391">
<area href="#" state="HI" shape="poly" coords="176,389,181,390,182,390,183,387,183,385,180,384,177,386,176,389">
<area href="#" state="HI" shape="poly" coords="199,395,201,400,203,399,204,399,205,400,208,400,208,398,206,398,205,395,203,392,199,395,199,395">
<area href="#" state="HI" shape="poly" coords="213,402,214,401,218,401,218,401,222,401,222,402,221,404,217,403,213,402">
<area href="#" state="HI" shape="poly" coords="217,406,218,409,221,407,221,407,220,405,217,405,217,406">
<area href="#" state="HI" shape="poly" coords="222,405,224,403,227,404,230,405,233,407,233,409,231,410,227,411,226,410,222,405">
<area href="#" state="HI" shape="poly" coords="234,416,236,415,238,416,243,419,245,421,247,422,248,425,251,428,251,428,248,431,245,431,244,431,242,432,240,435,239,437,237,437,235,435,234,431,235,430,233,426,232,425,232,422,233,422,235,419,236,419,234,418,234,416">
<area href="#" state="AK" full="Alaska" shape="poly" coords="114,344,114,405,116,406,118,406,119,405,121,405,121,407,125,413,126,414,128,413,129,413,129,410,131,410,131,409,133,408,135,410,135,412,137,413,137,414,140,416,143,420,145,422,146,425,147,428,151,428,155,430,155,434,156,436,155,438,154,440,152,439,152,437,149,436,149,435,148,436,149,437,149,440,148,440,146,440,145,438,146,440,146,441,146,441,143,437,143,435,141,434,141,430,140,430,140,433,140,433,139,430,138,428,137,427,138,431,138,432,137,431,134,427,133,426,132,424,131,422,130,421,130,419,131,419,131,418,129,419,127,417,125,415,122,413,119,411,119,409,119,407,118,409,116,410,113,409,109,407,105,407,104,407,100,404,98,404,96,400,94,400,92,401,92,404,92,402,93,403,92,406,95,404,95,405,92,408,91,408,91,407,90,406,89,407,87,405,85,407,83,408,81,410,77,410,77,408,80,408,80,407,78,407,79,404,80,402,80,401,80,400,84,398,85,399,86,399,86,398,83,397,80,399,77,401,77,404,75,405,72,406,70,408,70,410,71,410,72,411,70,414,65,417,60,420,59,421,54,422,50,423,52,424,51,425,50,426,49,425,46,425,46,427,45,427,45,425,43,426,41,427,38,426,36,428,34,428,32,428,31,429,29,428,27,428,26,428,25,429,24,428,24,427,26,426,31,426,34,425,35,424,38,423,39,422,41,422,42,424,43,423,44,422,47,421,49,420,50,420,50,420,51,420,52,418,55,416,56,414,58,410,59,410,59,407,58,409,56,409,55,407,54,407,53,408,53,410,53,410,51,406,50,407,50,406,50,405,47,405,45,406,43,406,44,404,44,403,44,401,45,401,46,401,45,399,45,396,45,395,44,396,40,396,38,395,38,392,37,390,37,389,38,389,38,387,39,386,38,386,38,386,37,384,38,380,41,378,43,377,44,374,46,374,48,374,48,376,50,376,53,374,53,374,54,375,56,375,57,374,58,371,58,366,56,367,54,368,53,367,50,366,47,366,44,363,44,360,44,359,43,357,41,355,42,354,47,353,48,353,49,354,50,354,50,353,53,353,54,353,55,353,54,355,54,356,56,357,59,359,61,358,59,355,59,353,59,352,56,350,56,350,56,349,56,346,54,342,52,339,54,338,56,338,58,338,61,338,64,335,65,333,67,332,68,332,71,332,73,330,74,330,74,331,78,331,80,329,80,329,83,330,85,332,84,332,85,333,86,332,89,332,89,335,90,336,95,337,100,340,101,339,105,341,107,341,108,340,111,341,114,344">
<area href="#" state="AK" shape="poly" coords="31,365,32,368,32,369,30,368,29,366,28,365,26,365,26,363,27,361,28,363,29,364,31,365">
<area href="#" state="AK" shape="poly" coords="29,389,32,389,35,390,35,391,34,393,32,393,29,391,29,389">
<area href="#" state="AK" shape="poly" coords="14,378,15,380,16,381,15,382,14,380,14,378,14,378">
<area href="#" state="AK" shape="poly" coords="4,431,7,430,9,429,11,429,11,431,13,431,14,429,14,428,16,428,18,430,17,431,14,432,12,431,9,431,6,431,5,432,4,431">
<area href="#" state="AK" shape="poly" coords="40,428,41,430,42,428,41,428,40,428">
<area href="#" state="AK" shape="poly" coords="42,431,43,428,44,429,44,431,42,431">
<area href="#" state="AK" shape="poly" coords="59,429,60,430,61,429,60,428,59,429">
<area href="#" state="AK" shape="poly" coords="65,420,66,424,68,425,72,422,75,421,74,419,74,417,73,418,71,418,71,417,73,417,76,416,77,415,74,414,75,413,73,414,70,417,66,419,65,420">
<area href="#" state="AK" shape="poly" coords="96,406,98,404,97,403,95,404,96,406">
<area href="#" state="FL" full="Florida" shape="poly" coords="548,337,549,343,552,350,556,356,558,361,562,365,565,368,566,370,565,371,565,372,566,377,569,380,571,383,573,387,577,393,578,399,578,407,578,409,578,411,576,413,577,413,576,415,576,417,577,419,575,421,572,422,569,422,569,423,567,424,566,423,565,422,565,421,564,418,562,414,559,413,557,413,556,413,554,410,553,407,551,404,550,404,549,405,548,405,546,401,544,398,542,395,540,392,537,390,539,388,541,384,541,383,538,383,536,383,537,383,539,384,538,387,537,388,536,385,535,381,535,379,536,376,536,369,533,366,533,364,529,363,527,362,526,361,524,359,523,357,521,356,519,353,516,353,514,351,512,351,509,352,509,353,509,354,509,355,507,355,504,357,502,359,499,359,497,360,497,358,495,356,493,356,492,355,486,352,481,350,477,351,473,351,469,353,466,353,466,347,464,346,463,344,463,342,470,341,489,339,494,339,498,339,500,341,501,343,507,343,515,342,530,341,534,341,538,341,538,343,540,344,540,341,539,337,539,336,544,337,548,337">
<area href="#" state="FL" shape="poly" coords="557,434,558,433,560,433,560,431,562,430,563,431,564,431,564,431,562,432,559,433,557,434,557,434">
<area href="#" state="FL" shape="poly" coords="566,430,567,431,569,429,573,426,576,423,578,419,578,417,578,415,578,415,577,417,576,420,574,425,571,428,568,428,566,430">
<area href="#" state="GA" full="Georgia" shape="poly" coords="500,274,497,275,490,275,484,276,484,278,484,279,485,281,487,287,489,295,490,299,491,302,492,308,494,312,495,314,496,317,497,317,497,319,496,323,496,325,496,326,497,329,497,333,497,335,497,336,498,336,498,339,500,341,501,343,507,343,515,342,530,341,534,341,538,341,538,343,540,344,540,341,539,337,539,336,544,337,548,337,547,332,548,325,550,322,549,320,552,315,551,314,551,314,548,314,548,312,547,310,545,308,544,308,542,304,540,299,537,299,536,297,535,295,533,293,532,293,530,290,528,289,524,287,524,287,523,284,522,284,520,280,518,280,515,278,513,277,513,276,514,275,515,274,515,272,514,272,510,273,505,274,500,274">
<area href="#" state="AL" full="Alabama" shape="poly" coords="453,353,452,342,450,329,450,318,451,296,451,284,451,279,457,278,476,277,484,276,484,278,484,279,485,281,487,287,489,295,490,299,491,302,492,308,494,312,495,314,496,317,497,317,497,319,496,323,496,325,496,326,497,329,497,333,497,335,497,336,498,336,499,339,494,339,489,339,470,341,463,342,463,344,464,346,466,347,467,353,461,355,460,355,461,353,461,353,459,348,458,348,457,351,456,353,455,353,453,353">
<area href="#" state="NC" full="North Carolina" shape="poly" coords="603,231,605,234,607,239,608,241,609,242,608,242,608,243,608,246,606,247,605,248,605,251,602,252,600,251,599,251,598,251,598,251,598,252,599,252,600,253,599,257,602,257,602,259,604,257,605,257,603,260,601,263,600,263,599,263,597,263,593,265,589,269,587,272,585,277,584,278,581,279,577,281,570,275,560,269,559,269,549,269,546,270,545,267,543,266,531,266,526,267,520,270,515,272,514,272,510,273,505,274,500,274,500,271,501,269,503,269,504,266,507,264,509,263,512,260,516,259,516,257,519,254,520,254,523,252,525,252,527,252,527,250,530,248,530,246,530,243,533,244,539,243,550,242,563,239,578,237,591,234,599,232,603,231">
<area href="#" state="NC" shape="poly" coords="606,255,608,253,610,251,611,251,611,249,611,245,610,243,609,242,610,242,612,245,612,248,612,251,610,252,608,254,607,255,606,255">
<area href="#" state="TN" full="Tennessee" shape="poly" coords="505,247,467,251,456,252,453,252,450,252,450,255,444,255,439,256,431,256,431,260,429,265,428,267,428,270,427,272,424,274,425,276,425,279,423,281,429,281,447,279,451,279,457,278,476,277,484,276,490,275,497,275,500,274,500,271,501,269,503,269,504,266,507,264,509,263,512,260,516,259,516,257,519,254,520,254,523,252,525,252,527,252,527,250,530,248,530,246,530,243,529,243,527,245,521,245,512,246,505,247">
<area href="#" state="NY" full="New York" shape="poly" coords="600,152,599,152,598,152,596,150,594,146,592,146,590,144,577,147,545,153,539,155,539,149,541,148,542,147,542,146,543,146,545,144,545,143,547,141,548,140,548,140,547,137,545,137,544,133,546,131,549,131,552,129,554,129,559,129,560,130,562,130,563,129,565,128,569,128,570,127,572,125,572,123,574,123,575,122,575,120,575,119,575,118,575,116,575,115,574,115,572,115,572,114,572,112,576,108,577,107,578,105,580,102,582,99,584,98,585,96,587,95,591,95,593,95,597,93,602,92,603,95,605,100,605,104,605,107,606,110,607,112,606,113,608,115,609,115,611,123,611,127,611,134,611,138,612,141,614,146,614,152,613,154,614,155,614,156,612,158,613,158,614,158,614,158,616,155,617,155,618,155,620,155,626,153,628,151,629,150,632,151,629,154,626,155,621,160,620,160,615,161,612,162,611,162,611,160,611,158,611,156,609,155,605,155,603,154,600,152">
<area href="#" state="NJ" full="New Jersey" shape="poly" coords="600,152,599,155,599,156,597,158,597,160,598,161,598,163,596,164,597,165,597,166,599,167,600,168,602,170,604,171,604,172,602,174,601,176,599,178,598,179,597,179,597,180,596,182,597,184,599,185,603,188,606,188,606,189,605,190,605,191,606,191,608,190,608,186,611,183,613,179,614,175,613,174,613,167,611,164,611,165,609,165,608,165,609,164,611,163,611,162,611,160,611,158,611,156,609,155,605,155,603,154,600,152">
<area href="#" state="PA" full="Pennsylvania" shape="poly" coords="597,179,598,179,599,178,601,176,602,174,604,172,604,171,602,170,600,168,599,167,597,166,597,165,596,164,598,163,598,161,597,160,597,158,599,156,599,155,600,152,599,152,598,152,596,150,594,146,592,146,590,144,577,147,545,153,539,155,539,149,535,153,534,154,531,156,533,170,534,178,537,191,540,191,549,190,576,185,587,182,593,181,594,180,596,179,597,179">
<area href="#" state="DE" shape="poly" coords="596,182,597,180,597,179,596,179,594,180,593,182,594,185,596,188,597,196,599,200,602,200,606,199,605,194,604,194,602,192,600,189,599,186,597,185,596,183,596,182">
<area href="#" state="MD" shape="poly" coords="606,199,602,200,599,200,597,196,596,188,594,185,593,181,587,182,576,185,549,190,550,194,551,197,551,197,552,196,554,194,556,194,557,192,558,191,559,191,561,191,563,189,565,188,566,188,567,188,569,190,571,191,572,192,575,193,575,195,578,196,580,197,581,196,582,197,581,200,581,201,580,203,580,205,580,206,584,207,587,207,589,208,590,208,591,206,590,205,590,203,588,202,587,198,588,194,588,193,587,191,590,188,591,186,591,187,590,188,590,191,590,192,591,192,591,196,590,197,590,200,590,199,591,197,593,199,591,200,591,203,593,205,596,205,597,205,599,209,600,209,600,212,599,215,599,220,599,222,601,222,602,219,602,217,602,212,605,208,606,203,606,199">
<area href="#" state="MD" shape="poly" coords="595,206,596,208,596,209,596,211,596,206,595,206">
<area href="#" state="WV" shape="poly" coords="549,190,550,194,551,197,551,197,552,196,554,194,556,194,557,192,558,191,559,191,561,191,563,189,565,188,566,188,567,188,569,190,571,191,572,192,571,195,566,193,563,192,563,196,563,197,562,200,561,200,559,202,559,204,557,204,556,206,555,210,554,210,552,209,551,208,550,208,550,211,548,216,545,224,545,224,545,227,544,228,542,227,540,230,538,229,537,232,530,233,528,234,527,233,525,233,524,230,521,229,520,227,518,224,517,223,515,221,515,221,515,217,516,216,518,216,518,214,518,213,519,209,519,206,521,206,521,207,521,208,523,207,524,206,523,205,523,203,523,202,525,200,526,199,527,199,529,198,531,195,533,193,533,188,533,185,533,182,533,179,533,178,534,177,537,191,540,191,549,190">
<area href="#" state="VA" full="Virginia" shape="poly" coords="524,230,525,233,527,233,528,234,530,233,532,232,538,229,540,230,542,227,544,228,545,227,545,224,545,224,548,216,550,211,550,208,551,208,552,209,554,210,555,210,556,206,557,204,559,204,559,202,561,200,562,200,563,197,563,196,563,192,566,193,571,195,572,191,575,193,575,195,578,196,580,197,581,196,582,197,581,200,581,201,580,203,580,205,580,206,584,207,585,208,589,209,590,210,593,210,594,212,593,215,594,215,594,217,596,218,596,220,593,219,593,220,594,221,594,221,596,222,596,224,596,225,595,227,595,227,597,227,599,226,600,226,603,231,599,232,591,234,578,237,563,239,550,242,539,243,533,244,530,243,529,243,527,245,521,245,512,246,505,247,507,246,511,244,514,242,514,241,515,239,518,236,521,233,524,230">
<area href="#" state="KY" full="Kentucky" shape="poly" coords="524,230,521,233,518,236,515,239,514,241,514,242,511,244,507,246,505,247,467,251,456,252,453,252,450,252,450,255,444,255,439,256,431,256,432,255,434,254,435,253,435,251,436,249,435,248,435,246,437,245,439,245,440,245,443,246,444,246,444,245,443,242,443,241,445,240,446,239,448,239,447,238,446,236,448,236,449,233,450,232,455,231,458,231,458,233,460,233,461,230,463,230,464,231,465,232,467,231,467,229,469,227,470,227,470,228,473,228,474,227,474,225,476,222,479,220,480,216,482,216,485,215,487,213,486,212,485,211,485,209,488,209,491,209,493,210,494,213,498,213,499,215,500,215,503,214,505,214,506,215,508,213,509,212,510,212,511,214,512,215,515,216,515,221,515,221,517,223,518,224,520,227,521,229,524,230">
<area href="#" state="OH" full="Ohio" shape="poly" coords="531,156,526,159,523,161,521,163,518,166,515,167,513,167,509,169,508,169,505,167,501,167,500,166,497,165,494,166,487,167,481,167,482,179,483,188,485,205,485,209,488,209,491,209,493,210,494,213,498,213,499,215,500,215,503,214,505,214,506,215,508,213,509,212,510,212,511,214,512,215,515,217,516,216,518,216,518,214,518,213,519,209,519,206,521,206,521,207,521,208,523,207,524,206,523,205,523,203,523,202,525,200,526,199,527,199,529,198,531,195,533,193,533,188,533,185,533,182,533,179,533,178,534,178,533,170,531,156">
<area href="#" state="MI" full="Michigan" shape="poly" coords="422,74,423,73,425,72,428,69,430,68,431,69,427,73,424,74,422,75,422,74">
<area href="#" state="MI" shape="poly" coords="484,98,485,99,487,99,488,98,485,96,484,96,483,97,484,98">
<area href="#" state="MI" shape="poly" coords="506,143,503,137,502,131,500,128,498,127,497,128,494,129,493,133,491,135,490,136,489,135,490,129,491,127,491,125,493,124,493,116,491,115,491,114,490,113,491,112,491,113,491,111,490,110,489,107,487,107,484,107,480,104,478,104,477,104,476,104,474,103,473,104,470,106,470,108,471,108,473,109,473,110,471,110,470,110,468,111,468,113,468,114,468,118,466,119,465,119,465,116,467,115,467,113,467,113,465,113,464,116,462,117,461,118,461,119,461,119,461,122,459,122,459,122,460,125,459,128,458,131,458,135,458,136,458,137,458,138,458,140,460,145,462,149,463,152,463,156,462,161,460,164,460,166,458,168,457,169,461,169,476,167,481,167,481,167,487,167,494,166,498,165,497,164,497,164,499,161,500,159,500,156,501,155,502,155,502,152,503,149,504,150,504,151,505,151,506,150,506,143">
<area href="#" state="MI" shape="poly" coords="410,95,412,95,414,94,416,92,416,92,417,92,421,91,423,89,426,88,426,87,428,85,429,84,430,83,431,81,434,80,438,79,439,80,439,80,436,81,435,83,433,84,433,86,431,88,431,90,431,90,432,89,434,87,436,89,437,89,440,89,440,90,442,92,444,94,446,94,448,93,449,95,450,95,451,94,452,94,453,93,456,91,458,90,463,89,467,89,468,87,470,87,470,92,470,92,472,92,473,92,478,91,479,90,479,90,479,95,482,98,483,98,484,99,483,99,482,99,479,98,478,99,476,99,474,100,473,100,468,99,464,99,464,101,458,101,457,102,455,104,455,105,455,105,453,104,450,106,449,106,449,104,448,104,447,107,446,110,443,116,442,116,441,115,440,107,437,107,437,104,428,103,425,102,419,100,413,99,410,95">
<area href="#" state="WY" full="Wyoming" shape="poly" coords="257,119,249,118,226,116,214,114,194,111,179,109,178,117,175,135,171,157,170,164,169,173,174,174,186,176,192,176,207,178,234,181,252,182,255,150,257,132,257,119">
<area href="#" state="MT" full="Montana" shape="poly" coords="259,104,260,95,261,77,262,66,263,56,240,53,219,51,197,48,174,44,161,41,137,37,134,52,137,57,135,61,137,64,139,65,142,73,144,75,145,76,147,77,147,78,142,91,142,93,144,95,145,95,148,93,149,92,150,93,149,97,152,106,154,107,155,108,156,110,155,112,156,115,157,116,158,113,161,113,163,115,164,114,167,114,170,116,172,115,173,113,175,113,176,113,176,116,178,117,179,109,194,111,214,114,226,116,249,118,257,119,259,107,259,104">
<area href="#" state="ID" full="Idaho" shape="poly" coords="102,143,105,130,108,117,110,114,111,110,110,108,109,108,108,107,108,107,109,104,112,101,113,100,114,99,114,97,115,96,118,92,121,89,121,86,119,84,117,81,118,74,120,62,124,47,126,38,127,35,137,37,134,52,137,57,135,61,137,64,139,65,142,73,144,75,145,76,147,77,147,78,142,91,142,93,144,95,145,95,148,93,149,92,150,93,149,97,152,106,154,107,155,108,156,110,155,112,156,115,157,116,158,113,161,113,163,115,164,114,167,114,170,116,172,115,173,113,175,113,176,113,176,116,178,117,175,135,172,157,168,156,162,155,155,154,146,152,137,151,131,149,124,148,117,146,102,143">
<area href="#" state="WA" full="Washington" shape="poly" coords="68,19,71,20,78,22,84,23,98,28,116,32,127,35,126,38,124,47,120,62,118,74,118,81,107,79,96,76,85,76,85,75,81,77,77,77,76,75,75,76,71,75,71,74,67,73,66,73,63,72,62,74,57,73,53,70,53,69,53,64,52,61,49,61,48,59,47,59,45,57,44,58,42,56,42,54,44,53,46,50,44,50,44,47,47,47,45,44,44,40,44,38,44,32,43,29,44,23,47,23,48,25,50,27,53,29,56,30,58,30,60,32,62,32,64,32,64,30,65,29,67,29,67,29,67,31,65,31,65,32,66,33,67,35,68,37,69,36,69,35,68,35,68,32,68,31,68,30,68,29,69,26,68,24,67,20,67,20,68,19">
<area href="#" state="WA" shape="poly" coords="61,23,62,23,62,24,64,23,65,23,66,24,65,26,65,26,65,28,64,28,63,26,63,26,62,27,61,26,61,23">
<area href="#" state="TX" full="Texas" shape="poly" coords="259,256,275,257,298,258,296,275,296,288,296,289,299,292,301,293,302,293,302,291,303,293,305,293,305,291,307,293,306,295,309,296,311,296,314,296,316,298,317,296,320,297,322,299,323,299,323,301,324,302,326,300,327,300,329,300,329,302,333,304,334,303,335,300,336,300,337,302,340,302,343,303,345,304,347,303,347,301,350,301,351,302,353,300,354,300,355,302,358,302,359,300,360,300,362,302,364,304,366,304,368,305,370,307,372,305,374,306,374,314,374,321,375,329,376,331,377,334,378,338,381,341,381,344,382,344,381,350,379,354,380,356,380,358,380,363,378,365,379,368,374,369,367,372,366,374,364,375,362,376,362,377,358,380,356,382,352,385,347,386,343,389,342,390,338,392,335,393,332,397,329,397,329,398,330,400,329,404,329,407,328,410,327,413,328,415,329,420,329,425,331,426,330,428,328,429,324,426,320,425,319,425,317,425,314,423,310,422,304,419,302,417,302,412,299,411,299,409,299,409,299,406,299,406,298,405,299,402,298,400,296,399,293,396,290,392,287,389,287,388,284,379,283,376,282,374,282,374,278,370,275,368,275,367,274,365,269,365,263,364,261,362,258,364,255,365,254,367,253,370,250,374,248,376,246,375,245,374,243,374,241,372,241,372,239,371,236,369,230,363,229,360,229,354,227,350,226,347,224,347,224,345,221,344,219,342,214,337,213,335,210,332,209,329,207,327,206,327,205,323,211,324,232,326,253,327,254,310,257,270,259,256,260,256">
<area href="#" state="TX" shape="poly" coords="332,426,331,421,329,416,329,410,329,404,332,399,335,395,337,393,338,393,334,398,331,403,329,407,329,411,329,416,332,421,332,425,332,425,332,426">
<area shape="circle" state="TX" coords="300,350,30" nohref>
<area href="#" state="CA" full="California" shape="poly" coords="99,296,102,295,104,293,104,291,101,291,101,290,101,289,101,285,103,284,105,282,105,278,107,276,108,275,110,273,112,272,112,271,111,270,110,269,110,266,107,262,108,260,106,257,95,241,81,220,65,195,56,182,57,177,62,158,68,135,58,133,48,130,39,127,34,125,26,123,20,122,20,125,19,131,15,139,13,141,13,142,11,143,11,146,10,148,12,151,13,154,14,156,14,161,13,164,12,167,11,170,13,173,14,176,17,180,17,182,17,185,17,185,17,187,21,191,20,194,20,195,20,197,20,203,21,205,23,207,25,207,26,209,24,212,23,213,22,213,22,216,22,218,24,221,26,225,26,228,27,230,30,235,31,236,32,239,32,239,32,241,32,242,31,248,30,249,32,251,35,251,38,253,41,254,43,254,45,257,47,260,48,262,51,263,54,264,56,266,56,268,55,268,55,269,57,269,59,269,62,273,65,276,65,278,67,281,67,283,67,290,68,291,74,292,89,294,99,296">
<area href="#" state="CA" shape="poly" coords="35,259,36,260,36,261,34,261,33,260,33,259,35,259">
<area href="#" state="CA" shape="poly" coords="37,259,38,258,40,260,42,261,41,261,38,261,37,260,37,259">
<area href="#" state="CA" shape="poly" coords="52,273,53,275,53,275,55,276,55,275,54,274,53,272,52,272,52,273">
<area href="#" state="CA" shape="poly" coords="50,279,52,282,53,283,52,284,51,282,50,279">
<area href="#" state="AZ" full="Arizona" shape="poly" coords="100,296,98,297,98,298,98,299,112,306,120,312,131,318,143,326,152,327,172,330,173,320,176,301,181,262,184,239,165,237,146,233,122,229,119,242,119,242,118,245,116,245,115,242,113,242,113,241,112,241,111,242,110,242,110,248,110,248,109,258,108,260,107,262,110,266,110,269,111,270,112,271,112,272,110,273,108,275,107,276,105,278,105,282,103,284,101,285,101,289,101,290,101,291,104,291,104,293,102,295,100,296">
<area href="#" state="NV" full="Nevada" shape="poly" coords="102,143,117,146,124,148,131,149,137,151,136,155,133,167,131,182,129,189,128,199,125,211,123,221,122,230,119,242,119,242,118,245,116,245,115,242,113,242,113,241,112,241,111,242,110,242,110,248,110,248,109,258,108,260,106,257,95,241,81,220,65,195,56,182,57,177,62,158,68,135,92,141,102,143">
<area href="#" state="UT" full="Utah" shape="poly" coords="184,240,165,237,146,233,122,229,123,221,125,211,128,199,129,189,131,182,133,167,136,155,137,151,146,152,155,154,162,155,168,156,172,157,170,164,169,173,174,174,186,176,193,176,191,192,188,209,185,229,185,237,184,240">
<area href="#" state="CO" full="Colorado" shape="poly" coords="272,248,275,201,276,185,252,182,234,181,207,178,192,176,191,192,188,209,185,229,185,237,184,240,209,242,236,246,260,248,264,248,272,248">
<area href="#" state="NM" full="New Mexico" shape="poly" coords="206,327,205,323,211,324,232,326,253,327,254,310,257,270,259,256,260,256,260,248,236,246,209,242,184,240,181,262,176,301,173,320,172,330,183,331,184,324,196,326,206,327">
<area href="#" state="OR" full="Oregon" shape="poly" coords="102,143,105,130,108,117,110,114,111,110,110,108,109,108,108,107,108,107,109,104,112,101,113,100,114,99,114,97,115,96,118,92,121,89,121,86,119,84,118,81,107,79,96,76,85,76,85,75,81,77,77,77,76,75,75,76,71,75,71,74,67,73,66,73,63,72,62,74,57,73,53,70,53,69,53,64,52,61,49,61,48,59,47,59,42,60,41,65,38,72,36,77,32,87,28,97,22,106,20,108,20,114,19,119,20,122,26,123,34,125,39,127,48,130,58,133,68,135">
<area href="#" state="OR" shape="poly" coords="102,143,68,135,92,141,102,143">
<area href="#" state="ND" full="North Dakota" shape="poly" coords="342,107,341,101,341,96,339,86,338,80,338,77,336,73,336,65,337,63,335,59,314,59,300,58,281,57,263,56,262,66,261,77,260,95,259,104,300,107,342,107">
<area href="#" state="SD" full="South Dakota" shape="poly" coords="343,162,343,161,341,159,343,155,344,152,341,150,341,148,342,146,344,146,344,141,344,119,343,117,340,115,339,113,339,112,341,111,342,110,342,107,300,107,259,104,259,107,257,119,257,132,255,151,266,152,281,152,294,153,311,154,319,154,320,155,324,158,325,158,328,157,331,157,333,157,334,158,338,158,340,160,341,161,341,163,342,163,343,162">
<area href="#" state="NE" full="Nebraska" shape="poly" coords="352,194,353,195,353,197,354,200,356,203,352,203,320,203,291,201,275,200,276,185,252,182,255,151,266,152,281,152,294,153,311,154,319,154,320,155,324,158,325,158,328,157,331,157,333,157,334,158,338,158,340,160,341,161,341,163,342,163,344,162,344,167,347,172,347,176,349,178,349,182,350,185,350,190,352,194">
<area href="#" state="IA" full="Iowa" shape="poly" coords="411,161,411,162,413,162,413,163,414,164,417,167,417,169,417,171,416,174,415,176,413,177,412,177,408,179,407,180,407,182,407,182,409,183,409,186,407,188,407,188,407,191,406,191,404,192,404,193,404,194,404,196,401,193,400,191,395,192,387,192,369,193,359,193,353,194,352,194,350,190,350,185,349,182,349,178,347,176,347,172,344,167,344,162,342,161,341,159,343,155,344,152,341,150,341,148,342,146,343,146,352,146,388,146,401,146,404,145,404,148,406,149,406,150,404,152,404,155,407,158,408,158,410,158,411,161">
<area href="#" state="MS" full="Mississippipi" shape="poly" coords="453,353,452,354,449,354,448,353,446,353,441,355,440,354,438,357,437,358,437,356,436,353,433,350,434,345,434,344,432,344,426,345,409,346,408,344,409,338,411,334,415,328,414,326,415,326,416,324,414,323,414,321,413,318,413,314,413,312,413,309,412,307,413,305,412,304,413,303,413,299,416,296,415,295,418,291,419,290,419,289,419,287,421,284,423,283,423,281,429,281,447,279,451,279,451,284,451,296,450,318,450,329,452,342,453,353">
<area href="#" state="IN" full="Indiana" shape="poly" coords="449,233,448,230,449,227,450,225,452,222,453,219,453,215,452,213,452,211,452,207,452,202,451,190,450,179,449,170,452,171,452,172,453,172,455,170,457,169,461,169,476,167,481,167,481,167,482,179,483,188,485,205,485,209,485,211,486,212,487,213,485,215,482,216,480,216,479,220,476,222,474,225,474,227,473,228,470,228,470,227,469,227,467,229,467,231,465,232,464,231,463,230,461,230,460,233,458,233,458,231,455,231,450,232,449,233">
<area href="#" state="IL" full="Illinois" shape="poly" coords="448,233,448,230,449,227,450,225,452,222,453,219,453,215,452,213,452,211,452,207,452,202,451,190,450,179,449,170,449,170,448,168,447,165,446,164,445,162,444,158,437,159,418,161,411,160,411,162,413,162,413,163,414,164,417,167,417,169,417,171,416,174,415,176,413,177,412,177,408,179,407,180,407,182,407,182,409,183,409,186,407,188,407,188,407,191,406,191,404,192,404,193,404,194,404,195,403,197,403,200,404,206,410,211,414,213,413,217,414,218,419,218,421,219,421,221,419,226,419,228,420,231,425,235,428,236,429,239,431,241,431,243,431,246,433,248,435,248,435,246,437,245,439,245,440,245,443,246,444,246,444,245,443,242,443,241,445,240,446,239,448,239,447,238,446,236,448,236,448,233">
<area href="#" state="MN" full="Minnesota" shape="poly" coords="342,107,341,101,341,96,339,86,338,80,338,77,336,73,336,65,337,63,335,59,357,59,357,53,358,53,359,53,361,54,362,58,362,62,364,63,367,63,368,65,372,65,372,66,376,66,376,65,377,65,378,64,379,65,381,65,384,67,388,68,389,68,390,68,391,68,392,70,393,71,394,71,395,71,395,72,397,73,399,73,400,72,402,70,404,69,404,71,405,71,406,71,407,71,413,71,414,73,415,73,415,72,419,72,418,74,415,75,408,78,405,80,403,81,401,84,399,86,398,87,395,91,394,91,392,93,392,94,390,95,389,98,389,104,389,105,385,107,383,112,383,112,386,113,386,116,385,119,385,121,385,126,387,128,389,128,391,131,393,131,396,135,401,138,403,140,404,146,401,146,388,146,352,146,343,146,344,141,344,119,343,117,340,115,339,113,339,112,341,111,342,110,342,107">
<area href="#" state="WI" full="Wisconsin" shape="poly" coords="444,158,444,155,443,152,443,148,442,146,443,143,443,141,444,140,444,137,443,134,444,134,445,131,446,130,445,128,445,127,446,125,448,120,449,116,449,113,449,113,449,113,446,118,444,121,443,122,442,124,441,125,440,126,439,125,439,125,440,122,441,119,443,118,443,116,442,116,441,115,440,107,437,107,437,104,428,103,425,102,419,100,413,99,410,95,410,96,410,96,409,95,407,95,406,95,404,95,404,95,404,94,406,92,407,91,405,89,404,90,401,92,396,94,394,95,392,94,392,94,390,95,389,98,389,104,389,105,385,107,383,112,383,112,386,113,386,116,385,119,385,121,385,126,387,128,389,128,391,131,393,131,396,135,401,138,403,140,404,145,404,148,406,149,406,150,404,152,404,155,407,158,408,158,410,158,411,161,418,161,437,159,444,158">
<area href="#" state="MO" full="Missouri" shape="poly" coords="404,196,401,193,400,191,395,192,387,192,369,193,359,193,353,194,352,194,353,195,353,197,354,200,356,203,359,205,361,205,362,206,362,208,360,209,360,210,362,213,363,215,365,216,366,225,365,251,365,254,366,259,383,258,400,258,415,257,423,257,424,259,424,261,422,263,421,265,425,266,429,265,431,260,431,256,433,255,434,254,435,253,435,251,436,249,435,248,433,248,431,246,431,243,431,241,429,239,428,236,425,235,420,231,419,228,419,226,421,221,421,219,419,218,414,218,413,217,414,213,410,211,404,206,403,200,403,197,404,196">
<area href="#" state="AR" full="Arkansas" shape="poly" coords="429,265,425,266,421,265,422,263,424,261,424,259,423,257,415,257,400,258,383,258,366,259,367,264,367,270,368,278,368,305,370,307,372,305,374,306,374,314,391,314,404,314,413,314,413,312,413,309,412,307,413,305,412,304,413,303,413,299,416,296,415,295,418,291,419,290,419,289,419,287,421,284,423,283,423,281,425,280,425,276,424,274,427,272,428,270,428,267,429,265">
<area href="#" state="OK" full="Oklahoma" shape="poly" coords="272,248,264,248,260,248,260,248,260,256,275,257,298,258,296,275,296,288,296,289,299,292,301,293,302,293,302,291,303,293,305,293,305,291,307,293,306,295,309,296,311,296,314,296,316,298,317,296,320,297,322,299,323,299,323,301,324,302,326,300,327,300,329,300,329,302,333,304,334,303,335,300,336,300,337,302,340,302,343,303,345,304,347,303,347,301,350,301,351,302,353,300,354,300,355,302,358,302,359,300,360,300,362,302,364,304,366,304,368,305,368,278,367,270,367,264,366,259,365,254,365,251,356,251,322,251,290,249,272,248">
<area href="#" state="KS" full="Kansas" shape="poly" coords="365,251,356,251,322,251,290,249,272,248,275,200,291,201,320,203,352,203,356,203,359,205,361,205,362,206,362,208,360,209,360,210,362,213,363,215,365,216,366,225,365,251">
<area href="#" state="LA" full="Louisiana" shape="poly" coords="437,357,437,356,436,353,433,350,434,345,434,344,432,344,426,345,409,346,408,344,409,338,411,334,415,328,414,326,415,326,416,324,414,323,414,321,413,318,413,314,404,314,391,314,374,314,374,321,375,329,376,331,377,334,378,338,381,341,381,344,382,344,381,350,379,354,380,356,380,358,380,363,378,365,379,368,382,367,388,366,395,369,400,370,403,369,405,370,407,371,408,369,406,368,404,368,401,367,406,366,407,366,410,366,410,368,410,370,414,370,416,371,415,372,414,373,415,374,421,377,424,376,425,374,426,374,428,372,428,373,429,375,428,376,428,377,431,375,432,373,433,373,431,372,431,371,431,370,433,370,434,369,434,369,440,374,441,374,443,374,444,375,446,373,446,372,445,372,443,370,438,369,436,368,437,366,438,366,439,365,437,365,437,365,440,365,441,362,440,361,440,359,439,359,437,361,437,362,434,362,434,361,435,359,437,358,437,357">
</map>
</div>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

View file

@ -0,0 +1,242 @@
/*global iqtest, map_options */
/*jslint onevar: false */
this.tests = this.tests || [];
(function() {
function attrMatches(jq, attr, matches) {
var list = matches.split(','), result = $();
jq.each(function () {
for (var i = 0; i < list.length; i++) {
if ($(this).is("[" + attr + "='" + list[i] + "']")) {
result = result.add(this);
i = list.length;
}
}
});
return result;
}
this.tests.push(
iqtest.create("basic","manipulation tests - migrated from old test suite (not organized)")
.add("Migrated tests", function (a, r) {
var me=this,
getPromise= function(name) {
return me.promises(name);
},mu = $.mapster.utils;
// Save current state to see if we cleaned up properly later
var domCount = $('#test_elements *').length;
var map = $('img').mapster();
// // testing with no canvas on a browser that doesn't support it anyway doesn't make sense, regular test will cover it
// var has_canvas = (document.namespaces && document.namespaces.g_vml_) ? false :
// $('<canvas></canvas>')[0].getContext ? true : false;
// if (!has_canvas && disableCanvas) {
// map.mapster('unbind');
// a.pass("The browser does not support canvases: this test was skipped.")
// return;
// }
map.mapster('unbind');
// var oldHasCanvas = $.mapster.hasCanvas;
// if (disableCanvas) {
// $.mapster.hasCanvas=false;
// }
// test using only bound images
var isObfuscated = map.mapster("test","typeof m === 'undefined'");
if (!isObfuscated) {
map = $('img').mapster(map_options);
a.equals(1,map.mapster("test", "typeof m !== 'undefined' && m.map_cache && m.map_cache.length"),
"Only imagemap bound images were obtained on generic create");
map = $('img,div').mapster({ mapKey: "state" });
a.equals(1,map.mapster("test", "typeof m !== 'undefined' && m.map_cache && m.map_cache.length"),
"Only imagemap bound images were obtained on generic create with other elements");
}
map = $("#usa_image").mapster($.extend(map_options, {
onConfigured: getPromise("configured").resolve
}));
getPromise("configured").then(function() {
var initialOpts = mu.updateProps({}, $.mapster.defaults, map_options);
var opts = map.mapster('get_options');
a.equals(opts, initialOpts, "Options retrieved match initial options");
// todo - test new options options
//opts = map.mapster('get_options',null,true);
//initialOpts.render_select = u.mergeObjects({template:$.mapster.render_defaults });
var newOpts = { isSelectable: false, areas: [{ key: 'MT', isDeselectable: false}] };
map.mapster('set_options', newOpts);
opts = map.mapster('get_options');
// to compare this we have to ignore areas, since they won't be the same object
var expectedNewOpts = $.extend({},initialOpts);
expectedNewOpts.isSelectable = false;
a.propertyValueEquals(opts,expectedNewOpts, "Options retrieved match updated value");
a.equals(opts.areas.length, 6, "Area option was added");
// restore original options before continuing
opts = map.mapster('set_options', { isSelectable: true, areas: [{ key: 'MT', isDeselectable: true}] });
a.equals(!!map.mapster, true, "Plugin returns jQuery object");
a.equals(map, $("#usa_image"), "Plugin returns jquery same object as invocation");
// order is not guaranteed - this is the order the areas are created.
var selected = map.mapster('get');
// This test should NOT show "WA" because StaticState items are not considered "selected"
a.collectionEquals(selected, "AK,TX", "Initially selected items returned with 'get'");
selected = map.mapster('get', 'TX');
a.equals(selected, true, "Initially selected single item returned true with 'get'");
selected = map.mapster('get', 'ME');
a.equals(selected, false, "Initially deselected single item returned false with 'get'");
// Test setting/getting via area
// AK was already selected, should be ignored
attrMatches($('area'), "state", "AK,HI,LA").mapster('set', true);
var area_sel = map.mapster('get');
a.collectionEquals(area_sel, "HI,AK,LA,TX", "Set using area works");
map.mapster('set', false, 'LA,TX');
a.collectionEquals("HI,AK", map.mapster('get'), "unset using keys works");
map.mapster('set', true, 'ME,OH,TX');
a.collectionEquals("HI,AK,ME,OH,TX", map.mapster('get'), "set using keys works");
// test toggling: AK should go off, MT should go on
var areas = $('area[state=AK]').first();
areas = areas.add($('area[state=MT]').first());
areas.mapster('set');
a.collectionEquals("HI,ME,OH,TX,MT", map.mapster('get'), "toggling keys works");
// test clicking
$('area[state="AZ"]').first().click();
selected = map.mapster('get', 'AZ');
a.equals(true, selected, "Click-selected area returned 'get'");
a.collectionEquals("HI,ME,OH,TX,MT,AZ", map.mapster('get'), "Complete list returned with 'get'");
/// try to click select "staticstate areas
$('area[state="OR"]').first().click();
selected = map.mapster('get', 'OR');
a.equals(selected, false, "Cannot select 'staticState=false' area with click");
selected = map.mapster('get', 'WA');
a.equals(selected, false, "staticState=true area is considered not selected");
opts = map.mapster('get_options', 'WA');
a.equals(opts.staticState, true, "get effective options returned correct static state for WA");
opts = map.mapster('get_options', 'OR');
a.equals(opts.staticState, false, "get effective options returned correct static state for OR");
$('area[state="WA"]').first().click();
selected = map.mapster('get', 'WA');
a.equals(selected, false, "Cannot change selection state of 'staticState=true' area with click");
// do it programatically
map.mapster('set', true, 'OR');
selected = map.mapster('get', 'OR');
a.equals(selected, true, "Can select 'staticState=false' area with 'set'");
map.mapster('set', false, 'WA');
a.equals(map.mapster('get', 'WA'), false, "Can deselect staticState=true' area with 'set'");
// test rebind
newOpts = map.mapster('get_options');
newOpts.singleSelect = true;
map.mapster('rebind', newOpts);
a.collectionEquals(map.mapster('get'), 'TX,AK', "Rebind with singleSelect reverted to original state");
map.mapster('set', true, "MI");
a.equals(map.mapster('get'), 'MI', "Single select worked.");
map.mapster('set_options', { isDeselectable: false });
$('area[state="MI"]').first().click();
a.equals(map.mapster('get', 'MI'), true, "Cannot deselect single selected item with isDeselectable=false");
$('area[state="UT"]').first().click();
a.equals(map.mapster('get'), 'UT', "New single state selected");
map.mapster('set_options', { singleSelect: false, isDeselectable: true, areas: [{ key: 'ME', isDeselectable: false}] });
$('area[state="UT"]').first().click();
a.equals(map.mapster('get', 'UT'), false, "Was able to deselect item after removing singleSelect");
map.mapster('set', true, "CA,HI,ME");
$('area[state="ME"]').first().click();
a.equals(map.mapster('get', 'ME'), true, "Could not deselect one item marked as !isDeselectable");
$('area[state="CA"]').first().click();
a.equals(map.mapster('get', 'CA'), false, "Could deselect other items ");
// Test manual highlighting
a.equals(map.mapster('highlight'), null, "nothing is highlighted");
$('area[state="CA"]').first().mapster('highlight');
a.equals(map.mapster('highlight'), "CA", "highlighted manually");
map.mapster('highlight', "LA");
a.equals(map.mapster('highlight'), "LA", "highlighted manually using other technique");
map.mapster('highlight', false);
a.equals(map.mapster('highlight'), null, "everything unhighlighted");
// restore internal canvas setting or these tests won't work
// if (disableCanvas) {
// map.mapster('test', 'has_canvas=true');
// } else {
// // cleanup tests - skip to play with map afterwards
// // return;
// if (has_canvas) {
// a.equals($('canvas').length, 2, 'There are 2 canvases.');
// map.mapster(map_options);
// a.equals($('canvas').length, 2, 'There are 2 canvases (recreate was clean)');
// }
// }
map.mapster('unbind');
a.equals($('canvas').length, 0, 'No canvases remain after an unbind.');
a.equals($('#test_elements *').length, domCount, "# elements in DOM is the same.");
// if (disableCanvas) {
// $.mapster.hasCanvas=oldHasCanvas;
// }
});
}));
}());

View file

@ -0,0 +1,321 @@
/* common.utils.js: a core framework library of utilities and polyfills.
This adds utility functions into a namespace u.
Standard polyfills are automatically added to their prototypes. The following nonstandard prototype
changes are made:
String.format
String.split with trim option
Array.contains
Array.first
You can remove the call to u.polyfill to prevent the nonstandard changes.
Version 1.0
James Treworgy
*/
/*global define, require, module */
/*jslint curly: false */
(function (define) {
define(function () {
var u,nativeSplit=String.prototype.split;
/* General puropose functions */
function isBool(obj) {
return typeof obj === 'boolean';
}
function isString(obj) {
return typeof obj === 'string';
}
function isUndefined(obj) {
return typeof obj === 'undefined';
}
function isArray(obj) {
return obj && obj.constructor === Array;
}
/* prototype extension functions - these must be called with a context */
// trim a string leading & trailing whitespace
function stringTrim() {
return this.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
}
// generic iterator. when trim is true, string values are trimmed.
function forEach(cb, trim) {
var coll = this,
i, val;
if (isString(coll)) {
coll = coll.split(',');
}
if (isArray(coll)) {
for (i = 0; i < coll.length; i++) {
val = isString(coll[i]) ?
stringTrim.call(coll[i]) :
coll[i];
if (cb.call(val, i, val) === false) {
break;
}
}
} else {
for (i in coll) {
if (coll.hasOwnProperty(i)) {
if (cb.call(coll[i], i, coll[i]) === false) {
break;
}
}
}
}
}
// string format function
function format() {
var args = (arguments.length === 1 && $.isArray(arguments[0])) ?
arguments[0] :
arguments;
return this.replace(/\{(\d+)\}/g, function (match, number) {
var num = parseInt(number,10);
return !isUndefined(args[num])
? String(args[num])
: match;
});
}
// a split function that trims its results. any 'true' bool parameter will be interpreted as a flag to trim
function stringSplit(delimiter, trimResults) {
var result = [],
delim = isString(delimiter) ?
delimiter : ',',
trim = isBool(delimiter) ?
delimiter :
isBool(trimResults) ?
trimResults : false;
forEach.call(nativeSplit.call(this,delim || ','), function (i, e) {
result.push(trim ? stringTrim(e) : e);
});
return result;
}
// polyfills
function arrayForEach(action, that) {
for (var i = 0, n = this.length; i < n; i++)
if (i in this)
action.call(that, this[i], i, this);
}
function arrayIndexOf(find, i /*opt*/) {
if (i === undefined) i = 0;
if (i < 0) i += this.length;
if (i < 0) i = 0;
for (var n = this.length; i < n; i++)
if (i in this && this[i] === find)
return i;
return -1;
}
// returns true if the element exists
function arrayContains(val) {
return arrayIndexOf.call(this, val) >= 0;
}
// NONSTANDARD
// return the first element where filter returns true
function arrayFirst(filter) {
var i,undef;
if (!filter) {
return this.length>0 ? this[0] : undef;
}
for (i = 0; i < this.length; i++) {
if (filter.call(this[i], i, this[i])) {
return this[i];
}
}
return undef;
}
function arrayLastIndexOf(find, i /*opt*/) {
if (i === undefined) i = this.length - 1;
if (i < 0) i += this.length;
if (i > this.length - 1) i = this.length - 1;
for (i++; i-- > 0; ) /* i++ because from-argument is sadly inclusive */
if (i in this && this[i] === find)
return i;
return -1;
}
function arrayMap(mapper, that /*opt*/) {
var n, i, other = new Array(this.length);
for (i = 0, n = this.length; i < n; i++)
if (i in this)
other[i] = mapper.call(that, this[i], i, this);
return other;
}
function arrayFilter(filter, that /*opt*/) {
var i, n, other = [], v;
for (i = 0, n = this.length; i < n; i++)
if (i in this && filter.call(that, v = this[i], i, this))
other.push(v);
return other;
}
function arrayEvery(tester, that /*opt*/) {
for (var i = 0, n = this.length; i < n; i++)
if (i in this && !tester.call(that, this[i], i, this))
return false;
return true;
}
function arraySome(tester, that /*opt*/) {
for (var i = 0, n = this.length; i < n; i++)
if (i in this && tester.call(that, this[i], i, this))
return true;
return false;
}
u = {
// when onlyInSource is true, properties will not be added - only updated
// passing a falsy value as the target results in a new object being created
// and onlyInTarget is irrelevant
extend: function (target) {
var prop, source, sources, i,
li = arguments.length,
lastBool = u.isBool(arguments[li - 1]),
len = lastBool ?
li - 2 : li - 1,
emptyTarget = !target,
onlyInTarget = lastBool ?
arguments[len + 1] : false;
target = target || {};
sources = u.toArray(arguments, 1, len + 1);
for (i = 0; i < sources.length; i++) {
source = sources[i];
for (prop in source) {
if (source.hasOwnProperty(prop)
&& (emptyTarget || !onlyInTarget || target.hasOwnProperty(prop))) {
target[prop] = source[prop];
}
}
// start honoring onlyInTarget after the first source
emptyTarget = false;
}
return target;
},
// copy selected properties to a new object
filterProps: function (source, what) {
var target = {},
props = u.isArray(what) ?
what :
what.split(',');
u.each(props, function (i, prop) {
target[prop] = source[prop];
});
return target;
},
toArray: function (arrLike, first, last) {
return Array.prototype.slice.call(arrLike, first || 0, last || arrLike.length);
},
isArray: isArray,
arrayIndexOf: function (arr, val) {
return arrayIndexOf.call(arr, val);
},
inArray: function (arr, val) {
return arrayContains.call(arr, val);
},
isFunction: function (obj) {
return typeof obj === 'function';
},
isUndefined: isUndefined,
isString: isString,
isBool: isBool,
isValueType: function (obj) {
return u.inArray(['boolean', 'number', 'string'], typeof (obj));
},
trim: function (str) {
return stringTrim.call(str);
},
//split with trim (why would you want it any other way?)
split: function (str, delim) {
return stringSplit.call(str, delim);
},
// replaces {0}.. {n} with the ordinal valued parameter. You can also pass an
// array instead of multiple parameters
format: function () {
return format.apply(arguments[0], u.toArray(arguments, 1));
},
// usual each, if you happen to pass a string, it will split it on commas.
// it will always trim string values in an array.
each: function (coll, cb) {
return forEach.call(coll, cb);
},
donothing: function () { },
// add nonstandard polyfills
polyfill: function () {
Array.prototype.contains = arrayContains;
Array.prototype.first = arrayFirst;
String.prototype.format = format;
// always replace split, ours is better
if (String.prototype.split !== stringSplit) {
String.prototype.split = stringSplit;
}
}
};
// add required polyfills
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = arrayIndexOf;
}
if (!Array.prototype.trim) {
Array.prototype.trim = stringTrim;
}
if (!Array.prototype.lastIndexOf) {
Array.prototype.lastIndexOf = arrayLastIndexOf;
}
if (!Array.prototype.forEach) {
Array.prototype.forEach = arrayForEach;
}
if (!Array.prototype.filter) {
Array.prototype.filter = arrayFilter;
}
if (!Array.prototype.every) {
Array.prototype.every = arrayEvery;
}
if (!Array.prototype.some) {
Array.prototype.some = arraySome;
}
if (!Array.prototype.map) {
Array.prototype.map = arrayMap;
}
u.polyfill();
return u;
});
} (typeof define === 'function'
? define
: function (factory) {
if (typeof module !== 'undefined') {
module.exports = factory();
} else {
this.common = this.common || {};
this.common.utils = factory();
}
}
// Boilerplate for AMD, Node, and browser global
));

View file

@ -0,0 +1,35 @@
document.createElement("canvas").getContext||function(){function Z(){return this.context_||(this.context_=new C(this))}function $(a,b){var c=P.call(arguments,2);return function(){return a.apply(b,c.concat(P.call(arguments)))}}function Q(a){return String(a).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}function R(a,b,c){a.namespaces[b]||a.namespaces.add(b,c,"#default#VML")}function S(a){R(a,"g_vml_","urn:schemas-microsoft-com:vml");R(a,"g_o_","urn:schemas-microsoft-com:office:office");if(!a.styleSheets.ex_canvas_){a=
a.createStyleSheet();a.owningElement.id="ex_canvas_";a.cssText="canvas{display:inline-block;overflow:hidden;text-align:left;width:300px;height:150px}"}}function aa(a){var b=a.srcElement;switch(a.propertyName){case "width":b.getContext().clearRect();b.style.width=b.attributes.width.nodeValue+"px";b.firstChild.style.width=b.clientWidth+"px";break;case "height":b.getContext().clearRect();b.style.height=b.attributes.height.nodeValue+"px";b.firstChild.style.height=b.clientHeight+"px";break}}function ba(a){a=
a.srcElement;if(a.firstChild){a.firstChild.style.width=a.clientWidth+"px";a.firstChild.style.height=a.clientHeight+"px"}}function D(){return[[1,0,0],[0,1,0],[0,0,1]]}function u(a,b){for(var c=D(),d=0;d<3;d++)for(var e=0;e<3;e++){for(var f=0,h=0;h<3;h++)f+=a[d][h]*b[h][e];c[d][e]=f}return c}function T(a,b){b.fillStyle=a.fillStyle;b.lineCap=a.lineCap;b.lineJoin=a.lineJoin;b.lineWidth=a.lineWidth;b.miterLimit=a.miterLimit;b.shadowBlur=a.shadowBlur;b.shadowColor=a.shadowColor;b.shadowOffsetX=a.shadowOffsetX;
b.shadowOffsetY=a.shadowOffsetY;b.strokeStyle=a.strokeStyle;b.globalAlpha=a.globalAlpha;b.font=a.font;b.textAlign=a.textAlign;b.textBaseline=a.textBaseline;b.arcScaleX_=a.arcScaleX_;b.arcScaleY_=a.arcScaleY_;b.lineScale_=a.lineScale_}function U(a){var b=a.indexOf("(",3),c=a.indexOf(")",b+1);b=a.substring(b+1,c).split(",");if(b.length!=4||a.charAt(3)!="a")b[3]=1;return b}function E(a){return parseFloat(a)/100}function F(a,b,c){return Math.min(c,Math.max(b,a))}function ca(a){var b,c;c=parseFloat(a[0])/
360%360;c<0&&c++;b=F(E(a[1]),0,1);a=F(E(a[2]),0,1);if(b==0)b=a=c=a;else{var d=a<0.5?a*(1+b):a+b-a*b,e=2*a-d;b=G(e,d,c+1/3);a=G(e,d,c);c=G(e,d,c-1/3)}return"#"+v[Math.floor(b*255)]+v[Math.floor(a*255)]+v[Math.floor(c*255)]}function G(a,b,c){c<0&&c++;c>1&&c--;return 6*c<1?a+(b-a)*6*c:2*c<1?b:3*c<2?a+(b-a)*(2/3-c)*6:a}function H(a){if(a in I)return I[a];var b,c=1;a=String(a);if(a.charAt(0)=="#")b=a;else if(/^rgb/.test(a)){c=U(a);b="#";for(var d,e=0;e<3;e++){d=c[e].indexOf("%")!=-1?Math.floor(E(c[e])*
255):+c[e];b+=v[F(d,0,255)]}c=+c[3]}else if(/^hsl/.test(a)){c=U(a);b=ca(c);c=c[3]}else b=da[a]||a;return I[a]={color:b,alpha:c}}function ea(a){if(J[a])return J[a];var b=document.createElement("div").style;try{b.font=a}catch(c){}return J[a]={style:b.fontStyle||w.style,variant:b.fontVariant||w.variant,weight:b.fontWeight||w.weight,size:b.fontSize||w.size,family:b.fontFamily||w.family}}function fa(a,b){var c={};for(var d in a)c[d]=a[d];b=parseFloat(b.currentStyle.fontSize);d=parseFloat(a.size);c.size=
typeof a.size=="number"?a.size:a.size.indexOf("px")!=-1?d:a.size.indexOf("em")!=-1?b*d:a.size.indexOf("%")!=-1?b/100*d:a.size.indexOf("pt")!=-1?d/0.75:b;c.size*=0.981;return c}function ga(a){return a.style+" "+a.variant+" "+a.weight+" "+a.size+"px "+a.family}function ha(a){return ia[a]||"square"}function C(a){this.m_=D();this.mStack_=[];this.aStack_=[];this.currentPath_=[];this.fillStyle=this.strokeStyle="#000";this.lineWidth=1;this.lineJoin="miter";this.lineCap="butt";this.miterLimit=l*1;this.globalAlpha=
1;this.font="10px sans-serif";this.textAlign="left";this.textBaseline="alphabetic";this.canvas=a;var b="width:"+a.clientWidth+"px;height:"+a.clientHeight+"px;overflow:hidden;position:absolute",c=a.ownerDocument.createElement("div");c.style.cssText=b;a.appendChild(c);b=c.cloneNode(false);b.style.backgroundColor="red";b.style.filter="alpha(opacity=0)";a.appendChild(b);this.element_=c;this.lineScale_=this.arcScaleY_=this.arcScaleX_=1}function V(a,b,c,d){a.currentPath_.push({type:"bezierCurveTo",cp1x:b.x,
cp1y:b.y,cp2x:c.x,cp2y:c.y,x:d.x,y:d.y});a.currentX_=d.x;a.currentY_=d.y}function W(a,b){var c=H(a.strokeStyle),d=c.color;c=c.alpha*a.globalAlpha;var e=a.lineScale_*a.lineWidth;if(e<1)c*=e;b.push("<g_vml_:stroke",' opacity="',c,'"',' joinstyle="',a.lineJoin,'"',' miterlimit="',a.miterLimit,'"',' endcap="',ha(a.lineCap),'"',' weight="',e,'px"',' color="',d,'" />')}function X(a,b,c,d){var e=a.fillStyle,f=a.arcScaleX_,h=a.arcScaleY_,j=d.x-c.x,m=d.y-c.y;if(e instanceof x){var k=0;d={x:0,y:0};var q=0,
o=1;if(e.type_=="gradient"){k=e.x1_/f;c=e.y1_/h;var n=p(a,e.x0_/f,e.y0_/h);k=p(a,k,c);k=Math.atan2(k.x-n.x,k.y-n.y)*180/Math.PI;if(k<0)k+=360;if(k<1.0E-6)k=0}else{n=p(a,e.x0_,e.y0_);d={x:(n.x-c.x)/j,y:(n.y-c.y)/m};j/=f*l;m/=h*l;o=r.max(j,m);q=2*e.r0_/o;o=2*e.r1_/o-q}f=e.colors_;f.sort(function(A,ja){return A.offset-ja.offset});h=f.length;n=f[0].color;c=f[h-1].color;j=f[0].alpha*a.globalAlpha;a=f[h-1].alpha*a.globalAlpha;m=[];for(var s=0;s<h;s++){var y=f[s];m.push(y.offset*o+q+" "+y.color)}b.push('<g_vml_:fill type="',
e.type_,'"',' method="none" focus="100%"',' color="',n,'"',' color2="',c,'"',' colors="',m.join(","),'"',' opacity="',a,'"',' g_o_:opacity2="',j,'"',' angle="',k,'"',' focusposition="',d.x,",",d.y,'" />')}else if(e instanceof K)j&&m&&b.push("<g_vml_:fill",' position="',-c.x/j*f*f,",",-c.y/m*h*h,'"',' type="tile"',' src="',e.src_,'" />');else{e=H(a.fillStyle);b.push('<g_vml_:fill color="',e.color,'" opacity="',e.alpha*a.globalAlpha,'" />')}}function p(a,b,c){a=a.m_;return{x:l*(b*a[0][0]+c*a[1][0]+
a[2][0])-t,y:l*(b*a[0][1]+c*a[1][1]+a[2][1])-t}}function ka(a){return isFinite(a[0][0])&&isFinite(a[0][1])&&isFinite(a[1][0])&&isFinite(a[1][1])&&isFinite(a[2][0])&&isFinite(a[2][1])}function z(a,b,c){if(ka(b)){a.m_=b;if(c)a.lineScale_=la(ma(b[0][0]*b[1][1]-b[0][1]*b[1][0]))}}function x(a){this.type_=a;this.r1_=this.y1_=this.x1_=this.r0_=this.y0_=this.x0_=0;this.colors_=[]}function K(a,b){na(a);switch(b){case "repeat":case null:case "":this.repetition_="repeat";break;case "repeat-x":case "repeat-y":case "no-repeat":this.repetition_=
b;break;default:L("SYNTAX_ERR")}this.src_=a.src;this.width_=a.width;this.height_=a.height}function L(a){throw new M(a);}function na(a){if(!a||a.nodeType!=1||a.tagName!="IMG")L("TYPE_MISMATCH_ERR");a.readyState!="complete"&&L("INVALID_STATE_ERR")}function M(a){this.code=this[a];this.message=a+": DOM Exception "+this.code}var r=Math,i=r.round,N=r.sin,O=r.cos,ma=r.abs,la=r.sqrt,l=10,t=l/2;navigator.userAgent.match(/MSIE ([\d.]+)?/);var P=Array.prototype.slice;S(document);var Y={init:function(a){a=a||
document;a.createElement("canvas");a.attachEvent("onreadystatechange",$(this.init_,this,a))},init_:function(a){a=a.getElementsByTagName("canvas");for(var b=0;b<a.length;b++)this.initElement(a[b])},initElement:function(a){if(!a.getContext){a.getContext=Z;S(a.ownerDocument);a.innerHTML="";a.attachEvent("onpropertychange",aa);a.attachEvent("onresize",ba);var b=a.attributes;if(b.width&&b.width.specified)a.style.width=b.width.nodeValue+"px";else a.width=a.clientWidth;if(b.height&&b.height.specified)a.style.height=
b.height.nodeValue+"px";else a.height=a.clientHeight}return a}};Y.init();for(var v=[],g=0;g<16;g++)for(var B=0;B<16;B++)v[g*16+B]=g.toString(16)+B.toString(16);var da={aliceblue:"#F0F8FF",antiquewhite:"#FAEBD7",aquamarine:"#7FFFD4",azure:"#F0FFFF",beige:"#F5F5DC",bisque:"#FFE4C4",black:"#000000",blanchedalmond:"#FFEBCD",blueviolet:"#8A2BE2",brown:"#A52A2A",burlywood:"#DEB887",cadetblue:"#5F9EA0",chartreuse:"#7FFF00",chocolate:"#D2691E",coral:"#FF7F50",cornflowerblue:"#6495ED",cornsilk:"#FFF8DC",crimson:"#DC143C",
cyan:"#00FFFF",darkblue:"#00008B",darkcyan:"#008B8B",darkgoldenrod:"#B8860B",darkgray:"#A9A9A9",darkgreen:"#006400",darkgrey:"#A9A9A9",darkkhaki:"#BDB76B",darkmagenta:"#8B008B",darkolivegreen:"#556B2F",darkorange:"#FF8C00",darkorchid:"#9932CC",darkred:"#8B0000",darksalmon:"#E9967A",darkseagreen:"#8FBC8F",darkslateblue:"#483D8B",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",darkturquoise:"#00CED1",darkviolet:"#9400D3",deeppink:"#FF1493",deepskyblue:"#00BFFF",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1E90FF",
firebrick:"#B22222",floralwhite:"#FFFAF0",forestgreen:"#228B22",gainsboro:"#DCDCDC",ghostwhite:"#F8F8FF",gold:"#FFD700",goldenrod:"#DAA520",grey:"#808080",greenyellow:"#ADFF2F",honeydew:"#F0FFF0",hotpink:"#FF69B4",indianred:"#CD5C5C",indigo:"#4B0082",ivory:"#FFFFF0",khaki:"#F0E68C",lavender:"#E6E6FA",lavenderblush:"#FFF0F5",lawngreen:"#7CFC00",lemonchiffon:"#FFFACD",lightblue:"#ADD8E6",lightcoral:"#F08080",lightcyan:"#E0FFFF",lightgoldenrodyellow:"#FAFAD2",lightgreen:"#90EE90",lightgrey:"#D3D3D3",
lightpink:"#FFB6C1",lightsalmon:"#FFA07A",lightseagreen:"#20B2AA",lightskyblue:"#87CEFA",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#B0C4DE",lightyellow:"#FFFFE0",limegreen:"#32CD32",linen:"#FAF0E6",magenta:"#FF00FF",mediumaquamarine:"#66CDAA",mediumblue:"#0000CD",mediumorchid:"#BA55D3",mediumpurple:"#9370DB",mediumseagreen:"#3CB371",mediumslateblue:"#7B68EE",mediumspringgreen:"#00FA9A",mediumturquoise:"#48D1CC",mediumvioletred:"#C71585",midnightblue:"#191970",mintcream:"#F5FFFA",
mistyrose:"#FFE4E1",moccasin:"#FFE4B5",navajowhite:"#FFDEAD",oldlace:"#FDF5E6",olivedrab:"#6B8E23",orange:"#FFA500",orangered:"#FF4500",orchid:"#DA70D6",palegoldenrod:"#EEE8AA",palegreen:"#98FB98",paleturquoise:"#AFEEEE",palevioletred:"#DB7093",papayawhip:"#FFEFD5",peachpuff:"#FFDAB9",peru:"#CD853F",pink:"#FFC0CB",plum:"#DDA0DD",powderblue:"#B0E0E6",rosybrown:"#BC8F8F",royalblue:"#4169E1",saddlebrown:"#8B4513",salmon:"#FA8072",sandybrown:"#F4A460",seagreen:"#2E8B57",seashell:"#FFF5EE",sienna:"#A0522D",
skyblue:"#87CEEB",slateblue:"#6A5ACD",slategray:"#708090",slategrey:"#708090",snow:"#FFFAFA",springgreen:"#00FF7F",steelblue:"#4682B4",tan:"#D2B48C",thistle:"#D8BFD8",tomato:"#FF6347",turquoise:"#40E0D0",violet:"#EE82EE",wheat:"#F5DEB3",whitesmoke:"#F5F5F5",yellowgreen:"#9ACD32"},I={},w={style:"normal",variant:"normal",weight:"normal",size:10,family:"sans-serif"},J={},ia={butt:"flat",round:"round"};g=C.prototype;g.clearRect=function(){if(this.textMeasureEl_){this.textMeasureEl_.removeNode(true);this.textMeasureEl_=
null}this.element_.innerHTML=""};g.beginPath=function(){this.currentPath_=[]};g.moveTo=function(a,b){a=p(this,a,b);this.currentPath_.push({type:"moveTo",x:a.x,y:a.y});this.currentX_=a.x;this.currentY_=a.y};g.lineTo=function(a,b){a=p(this,a,b);this.currentPath_.push({type:"lineTo",x:a.x,y:a.y});this.currentX_=a.x;this.currentY_=a.y};g.bezierCurveTo=function(a,b,c,d,e,f){e=p(this,e,f);a=p(this,a,b);c=p(this,c,d);V(this,a,c,e)};g.quadraticCurveTo=function(a,b,c,d){a=p(this,a,b);c=p(this,c,d);d={x:this.currentX_+
2/3*(a.x-this.currentX_),y:this.currentY_+2/3*(a.y-this.currentY_)};V(this,d,{x:d.x+(c.x-this.currentX_)/3,y:d.y+(c.y-this.currentY_)/3},c)};g.arc=function(a,b,c,d,e,f){c*=l;var h=f?"at":"wa",j=a+O(d)*c-t,m=b+N(d)*c-t;d=a+O(e)*c-t;e=b+N(e)*c-t;if(j==d&&!f)j+=0.125;a=p(this,a,b);j=p(this,j,m);d=p(this,d,e);this.currentPath_.push({type:h,x:a.x,y:a.y,radius:c,xStart:j.x,yStart:j.y,xEnd:d.x,yEnd:d.y})};g.rect=function(a,b,c,d){this.moveTo(a,b);this.lineTo(a+c,b);this.lineTo(a+c,b+d);this.lineTo(a,b+d);
this.closePath()};g.strokeRect=function(a,b,c,d){var e=this.currentPath_;this.beginPath();this.moveTo(a,b);this.lineTo(a+c,b);this.lineTo(a+c,b+d);this.lineTo(a,b+d);this.closePath();this.stroke();this.currentPath_=e};g.fillRect=function(a,b,c,d){var e=this.currentPath_;this.beginPath();this.moveTo(a,b);this.lineTo(a+c,b);this.lineTo(a+c,b+d);this.lineTo(a,b+d);this.closePath();this.fill();this.currentPath_=e};g.createLinearGradient=function(a,b,c,d){var e=new x("gradient");e.x0_=a;e.y0_=b;e.x1_=
c;e.y1_=d;return e};g.createRadialGradient=function(a,b,c,d,e,f){var h=new x("gradientradial");h.x0_=a;h.y0_=b;h.r0_=c;h.x1_=d;h.y1_=e;h.r1_=f;return h};g.drawImage=function(a){var b,c,d,e,f,h,j,m;d=a.runtimeStyle.width;e=a.runtimeStyle.height;a.runtimeStyle.width="auto";a.runtimeStyle.height="auto";var k=a.width,q=a.height;a.runtimeStyle.width=d;a.runtimeStyle.height=e;if(arguments.length==3){b=arguments[1];c=arguments[2];f=h=0;j=d=k;m=e=q}else if(arguments.length==5){b=arguments[1];c=arguments[2];
d=arguments[3];e=arguments[4];f=h=0;j=k;m=q}else if(arguments.length==9){f=arguments[1];h=arguments[2];j=arguments[3];m=arguments[4];b=arguments[5];c=arguments[6];d=arguments[7];e=arguments[8]}else throw Error("Invalid number of arguments");var o=p(this,b,c),n=[];n.push(" <g_vml_:group",' coordsize="',l*10,",",l*10,'"',' coordorigin="0,0"',' style="width:',10,"px;height:",10,"px;position:absolute;");if(this.m_[0][0]!=1||this.m_[0][1]||this.m_[1][1]!=1||this.m_[1][0]){var s=[];s.push("M11=",this.m_[0][0],
",","M12=",this.m_[1][0],",","M21=",this.m_[0][1],",","M22=",this.m_[1][1],",","Dx=",i(o.x/l),",","Dy=",i(o.y/l),"");var y=p(this,b+d,c),A=p(this,b,c+e);b=p(this,b+d,c+e);o.x=r.max(o.x,y.x,A.x,b.x);o.y=r.max(o.y,y.y,A.y,b.y);n.push("padding:0 ",i(o.x/l),"px ",i(o.y/l),"px 0;filter:progid:DXImageTransform.Microsoft.Matrix(",s.join(""),", sizingmethod='clip');")}else n.push("top:",i(o.y/l),"px;left:",i(o.x/l),"px;");n.push(' ">','<g_vml_:image src="',a.src,'"',' style="width:',l*d,"px;"," height:",
l*e,'px"',' cropleft="',f/k,'"',' croptop="',h/q,'"',' cropright="',(k-f-j)/k,'"',' cropbottom="',(q-h-m)/q,'"'," />","</g_vml_:group>");this.element_.insertAdjacentHTML("BeforeEnd",n.join(""))};g.stroke=function(a){var b=[];b.push("<g_vml_:shape",' filled="',!!a,'"',' style="position:absolute;width:',10,"px;height:",10,'px;"',' coordorigin="0,0"',' coordsize="',l*10,",",l*10,'"',' stroked="',!a,'"',' path="');for(var c={x:null,y:null},d={x:null,y:null},e=0;e<this.currentPath_.length;e++){var f=this.currentPath_[e];
switch(f.type){case "moveTo":b.push(" m ",i(f.x),",",i(f.y));break;case "lineTo":b.push(" l ",i(f.x),",",i(f.y));break;case "close":b.push(" x ");f=null;break;case "bezierCurveTo":b.push(" c ",i(f.cp1x),",",i(f.cp1y),",",i(f.cp2x),",",i(f.cp2y),",",i(f.x),",",i(f.y));break;case "at":case "wa":b.push(" ",f.type," ",i(f.x-this.arcScaleX_*f.radius),",",i(f.y-this.arcScaleY_*f.radius)," ",i(f.x+this.arcScaleX_*f.radius),",",i(f.y+this.arcScaleY_*f.radius)," ",i(f.xStart),",",i(f.yStart)," ",i(f.xEnd),
",",i(f.yEnd));break}if(f){if(c.x==null||f.x<c.x)c.x=f.x;if(d.x==null||f.x>d.x)d.x=f.x;if(c.y==null||f.y<c.y)c.y=f.y;if(d.y==null||f.y>d.y)d.y=f.y}}b.push(' ">');a?X(this,b,c,d):W(this,b);b.push("</g_vml_:shape>");this.element_.insertAdjacentHTML("beforeEnd",b.join(""))};g.fill=function(){this.stroke(true)};g.closePath=function(){this.currentPath_.push({type:"close"})};g.save=function(){var a={};T(this,a);this.aStack_.push(a);this.mStack_.push(this.m_);this.m_=u(D(),this.m_)};g.restore=function(){if(this.aStack_.length){T(this.aStack_.pop(),
this);this.m_=this.mStack_.pop()}};g.translate=function(a,b){z(this,u([[1,0,0],[0,1,0],[a,b,1]],this.m_),false)};g.rotate=function(a){var b=O(a);a=N(a);z(this,u([[b,a,0],[-a,b,0],[0,0,1]],this.m_),false)};g.scale=function(a,b){this.arcScaleX_*=a;this.arcScaleY_*=b;z(this,u([[a,0,0],[0,b,0],[0,0,1]],this.m_),true)};g.transform=function(a,b,c,d,e,f){z(this,u([[a,b,0],[c,d,0],[e,f,1]],this.m_),true)};g.setTransform=function(a,b,c,d,e,f){z(this,[[a,b,0],[c,d,0],[e,f,1]],true)};g.drawText_=function(a,
b,c,d,e){var f=this.m_;d=0;var h=1E3,j={x:0,y:0},m=[],k=fa(ea(this.font),this.element_),q=ga(k),o=this.element_.currentStyle,n=this.textAlign.toLowerCase();switch(n){case "left":case "center":case "right":break;case "end":n=o.direction=="ltr"?"right":"left";break;case "start":n=o.direction=="rtl"?"right":"left";break;default:n="left"}switch(this.textBaseline){case "hanging":case "top":j.y=k.size/1.75;break;case "middle":break;default:case null:case "alphabetic":case "ideographic":case "bottom":j.y=
-k.size/2.25;break}switch(n){case "right":d=1E3;h=0.05;break;case "center":d=h=500;break}b=p(this,b+j.x,c+j.y);m.push('<g_vml_:line from="',-d,' 0" to="',h,' 0.05" ',' coordsize="100 100" coordorigin="0 0"',' filled="',!e,'" stroked="',!!e,'" style="position:absolute;width:1px;height:1px;">');e?W(this,m):X(this,m,{x:-d,y:0},{x:h,y:k.size});e=f[0][0].toFixed(3)+","+f[1][0].toFixed(3)+","+f[0][1].toFixed(3)+","+f[1][1].toFixed(3)+",0,0";b=i(b.x/l)+","+i(b.y/l);m.push('<g_vml_:skew on="t" matrix="',
e,'" ',' offset="',b,'" origin="',d,' 0" />','<g_vml_:path textpathok="true" />','<g_vml_:textpath on="true" string="',Q(a),'" style="v-text-align:',n,";font:",Q(q),'" /></g_vml_:line>');this.element_.insertAdjacentHTML("beforeEnd",m.join(""))};g.fillText=function(a,b,c,d){this.drawText_(a,b,c,d,false)};g.strokeText=function(a,b,c,d){this.drawText_(a,b,c,d,true)};g.measureText=function(a){if(!this.textMeasureEl_){this.element_.insertAdjacentHTML("beforeEnd",'<span style="position:absolute;top:-20000px;left:0;padding:0;margin:0;border:none;white-space:pre;"></span>');
this.textMeasureEl_=this.element_.lastChild}var b=this.element_.ownerDocument;this.textMeasureEl_.innerHTML="";this.textMeasureEl_.style.font=this.font;this.textMeasureEl_.appendChild(b.createTextNode(a));return{width:this.textMeasureEl_.offsetWidth}};g.clip=function(){};g.arcTo=function(){};g.createPattern=function(a,b){return new K(a,b)};x.prototype.addColorStop=function(a,b){b=H(b);this.colors_.push({offset:a,color:b.color,alpha:b.alpha})};g=M.prototype=new Error;g.INDEX_SIZE_ERR=1;g.DOMSTRING_SIZE_ERR=
2;g.HIERARCHY_REQUEST_ERR=3;g.WRONG_DOCUMENT_ERR=4;g.INVALID_CHARACTER_ERR=5;g.NO_DATA_ALLOWED_ERR=6;g.NO_MODIFICATION_ALLOWED_ERR=7;g.NOT_FOUND_ERR=8;g.NOT_SUPPORTED_ERR=9;g.INUSE_ATTRIBUTE_ERR=10;g.INVALID_STATE_ERR=11;g.SYNTAX_ERR=12;g.INVALID_MODIFICATION_ERR=13;g.NAMESPACE_ERR=14;g.INVALID_ACCESS_ERR=15;g.VALIDATION_ERR=16;g.TYPE_MISMATCH_ERR=17;G_vmlCanvasManager=Y;CanvasRenderingContext2D=C;CanvasGradient=x;CanvasPattern=K;DOMException=M}();

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,92 @@
/* when */
/** @license MIT License (c) copyright B Cavalier & J Hann */
(function(a){a(function(){var g,n,q;function j(){}function c(s){return new Array(s);
}g=Object.freeze||function(s){return s;};n=[].reduce||function(x){var t,s,w,v,u;u=0;
t=Object(this);v=t.length>>>0;s=arguments;if(s.length<=1){for(;;){if(u in t){w=t[u++];
break;}if(++u>=v){throw new TypeError();}}}else{w=s[1];}for(;u<v;++u){if(u in t){w=x(w,t[u],u,t);
}}return w;};function l(){}function f(){var v,A,D,w,z,t,s,u;w=[];z=[];t=function F(H,J,L){var G,I,K=arguments.length;
while(K){G=arguments[--K];if(G!=null&&typeof G!="function"){throw new Error("callback is not a function");
}}I=f();w.push({deferred:I,resolve:H,reject:J});L&&z.push(L);return I.promise;};function E(G,H,I){return t(G,H,I);
}function C(G){u("resolve",G);}function B(G){u("reject",G);}s=function(I){var H,G=0;
while(H=z[G++]){H(I);}};function y(G){s(G);}u=function(K,J){var I=t;t=function H(L,M){var N=I(L,M);
x(K);return N;};u=s=function G(){throw new Error("already completed");};z=q;D=J;x(K);
};function x(N){var K,J,M,H,L,I=0;L=w;w=[];while(K=L[I++]){J=K.deferred;H=K[N];try{M=H?H(D):D;
if(h(M)){r(M,J.resolve,J.reject,J.progress);}else{J[N](M===q?D:M);}}catch(G){J.reject(G);
}}}v=new l();A=new l();A.then=v.then=E;v.promise=g(A);v.resolver=g({resolve:(v.resolve=C),reject:(v.reject=B),progress:(v.progress=y)});
if(arguments&&arguments.length){E.apply(null,arguments);}return v;}function h(s){return s&&typeof s.then==="function";
}function r(v,s,t,u){var w=k(v);return w.then(s,t,u);}function k(u){var t,s;if(u instanceof l){t=u;
}else{s=f();if(h(u)){u.then(s.resolve,s.reject,s.progress);}else{s.resolve(u);}t=s.promise;
}return t;}function p(C,x,s,v,B){var J,H,I,u,G,E,w,z,y;z=C.length>>>0;J=Math.max(0,Math.min(x,z));
H=[];u=f();I=r(u,s,v,B);function F(K){G(K);}function D(K){E(K);}function A(K){w(K);
}function t(){G=E=w=j;}if(!J){u.resolve(H);}else{G=function(K){H.push(K);if(!--J){t();
u.resolve(H);}};E=function(K){t();u.reject(K);};w=u.progress;for(y=0;y<z;++y){if(y in C){r(C[y],F,D,A);
}}}return I;}function b(w,s,t,u){var x,v;x=c(w.length);v=m(w,o,x);return r(v,s,t,u);
}function o(s,u,t){s[t]=u;return s;}function d(v,s,t,u){function w(x){return s(x[0]);
}return p(v,1,w,t,u);}function i(u,t){var v,s;s=u.length;v=c(s);for(;s>=0;--s){if(s in u){v[s]=r(u[s],t);
}}return m(v,o,v);}function m(u,v,t){var w,s;w=u.length;s=[function(x,z,y){return r(x,function(A){return r(z,function(B){return v(A,B,y,w);
});});}];if(arguments.length>=3){s.push(t);}return k(n.apply(u,s));}function e(s,t,u){var v=arguments.length>2;
return r(s,function(w){t.resolve(v?u:w);},t.reject,t.progress);}r.defer=f;r.isPromise=h;
r.some=p;r.all=b;r.any=d;r.reduce=m;r.map=i;r.chain=e;return r;});})(typeof define=="function"?define:function(a){typeof module!="undefined"?(module.exports=a()):(this.when=a());
});
(function(define) {
define(['./when'], function(when) {
var undef;
/**
* Returns a new promise that will automatically reject after msec if
* the supplied promise doesn't resolve or reject before that.
*
* Usage:
*
* var d = when.defer();
* // Setup d however you need
*
* // return a new promise that will timeout if we don't resolve/reject first
* return timeout(d, 1000);
*
* @param promise anything - any promise or value that should trigger
* the returned promise to resolve or reject before the msec timeout
* @param msec {Number} timeout in milliseconds
*
* @returns {Promise}
*/
return function timeout(promise, msec) {
var deferred, timeout;
deferred = when.defer();
timeout = setTimeout(function onTimeout() {
timeout && deferred.reject(new Error('timed out'));
}, msec);
function cancelTimeout() {
clearTimeout(timeout);
timeout = undef;
}
when(promise, deferred.resolve, deferred.reject);
return deferred.then(
function(value) {
cancelTimeout();
return value;
},
function(reason) {
cancelTimeout();
throw reason;
}
);
};
});
})(typeof define == 'function'
? define
: function (deps, factory) { typeof module != 'undefined'
? (module.exports = factory(require('./when')))
: (this.when_timeout = factory(this.when));
}
// Boilerplate for AMD, Node, and browser global
);

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,34 @@
/*global Test: true, iqtest */
/*jslint onevar: false */
this.tests = this.tests || [];
this.tests.push(
iqtest.create("resize","resize feature")
.add("Initial binding", function (a, r) {
var img = $('img'),
map = img.mapster();
var x=img.width(), y=img.height();
this.when(function(cb) {
map.mapster('resize',200,0,cb);
}).then(function() {
var expectedHeight = Math.round(200/x*y);
a.equals(200,img.width(),"image width is correct after resize");
a.equals(expectedHeight,img.height(),"image height is correct after resize");
var wrapper = img.closest('div');
a.equals('mapster_wrap',wrapper.attr('id').substring(0,12),"sanity check - we have the wrapper element");
a.equals(200,wrapper.width(),"wrapper width matches image width");
a.equals(expectedHeight,wrapper.height(),"wrapper height matches image height");
});
}));

View file

@ -0,0 +1,85 @@
/*global Test: true, iqtest, image, map_options, areas, */
/*jslint onevar: false */
this.tests = this.tests || [];
this.tests.push(
iqtest.create("tooltips","tests for imagemapster tooltips")
.add("Imagemap tooltips", function (a, r) {
var me=this,
getPromise= function(name) {
return me.promises(name);
},
options = $.extend(map_options, {
onConfigured: getPromise("configured").resolve
}),
map = image.mapster(options);
function setCallback(option,cb) {
var obj = {};
obj[option]=cb ?
function(e) {
e = e || {};
e.this_context = this;
cb(e);
}: null;
map.mapster('set_options', obj);
}
map.mapster('set_options',{
areas: [{
key: 'TX',
toolTip: "Don't mess with Texas",
toolTipClose: 'tooltip-click'
}]
});
getPromise("configured").then(function() {
a.equals(0,$('.mapster_tooltip').length);
setCallback("onShowToolTip",getPromise("shown1").resolve);
$('area[state=TX]').mouseover();
getPromise("shown1").then(function() {
a.equals(1,$('.mapster_tooltip').length,"Tooltip was shown");
setCallback("onShowToolTip",null);
setCallback("onMouseover",getPromise("removed1").resolve);
$('area[state=NV]').mouseover();
});
getPromise("removed1").then(function() {
a.equals(0,$('.mapster_tooltip').length,"Activating another area removes tooltip");
setCallback("onMouseover",null);
setCallback("onShowToolTip",getPromise("shown2").resolve);
$('area[state=TX]').mouseover();
});
getPromise("shown2").then(function() {
a.equals(1,$('.mapster_tooltip').length,"Tooltip whas shown again");
setCallback("onShowToolTip",null);
setCallback("onHideToolTip",getPromise("click1").resolve);
$('.mapster_tooltip').click();
});
getPromise("click1").then(function() {
a.equals(0,$('.mapster_tooltip').length,"Clicking tooltip removes it");
getPromise("finished").resolve();
});
});
a.resolves(getPromise("finished"),"The last test resolved");
}));