1/* ImageMapster 2 Version: 1.2.14-beta1 (6/18/2013) 3 4Copyright 2011-2012 James Treworgy 5 6http://www.outsharked.com/imagemapster 7https://github.com/jamietre/ImageMapster 8 9A jQuery plugin to enhance image maps. 10 11*/ 12/// The above copyright notice and this permission notice shall be 13/// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 14/** @license MIT License (c) copyright B Cavalier & J Hann */ 15!(function (e) { 16 e(function () { 17 function e() {} 18 function t(t) { 19 var n = new e(); 20 return ( 21 (n.then = function (e) { 22 var n; 23 try { 24 return e && (n = e(t)), s(n === _ ? t : n); 25 } catch (i) { 26 return a(i); 27 } 28 }), 29 w(n) 30 ); 31 } 32 function a(t) { 33 var n = new e(); 34 return ( 35 (n.then = function (e, n) { 36 var i; 37 try { 38 return n ? ((i = n(t)), s(i === _ ? t : i)) : a(t); 39 } catch (o) { 40 return a(o); 41 } 42 }), 43 w(n) 44 ); 45 } 46 function n(e) { 47 return r(e, function (e) { 48 return a(e); 49 }); 50 } 51 function i() { 52 function n(e, t, a) { 53 return p(e, t, a); 54 } 55 function o(e) { 56 d(t(e)); 57 } 58 function r(e) { 59 d(a(e)); 60 } 61 function s(e) { 62 f(e); 63 } 64 var c, l, u, h, p, f, d; 65 return ( 66 (u = []), 67 (h = []), 68 (p = function (e, t, a) { 69 var n = i(); 70 return ( 71 u.push(function (a) { 72 a.then(e, t).then(n.resolve, n.reject, n.progress); 73 }), 74 a && h.push(a), 75 n.promise 76 ); 77 }), 78 (f = function (e) { 79 for (var t, a = 0; (t = h[a++]); ) t(e); 80 }), 81 (d = function (e) { 82 var t, 83 a = 0; 84 for ( 85 p = e.then, 86 d = f = function () { 87 throw new Error("already completed"); 88 }, 89 h = _; 90 (t = u[a++]); 91 92 ) 93 t(e); 94 u = []; 95 }), 96 (c = {}), 97 (l = new e()), 98 (l.then = c.then = n), 99 (c.promise = w(l)), 100 (c.resolver = w({ resolve: (c.resolve = o), reject: (c.reject = r), progress: (c.progress = s) })), 101 c 102 ); 103 } 104 function o(e) { 105 return e && "function" == typeof e.then; 106 } 107 function r(e, t, a, n) { 108 var i = s(e); 109 return i.then(t, a, n); 110 } 111 function s(t) { 112 var a, n; 113 return t instanceof e ? (a = t) : ((n = i()), o(t) ? (t.then(n.resolve, n.reject, n.progress), (a = n.promise)) : (n.resolve(t), (a = n.promise))), a; 114 } 115 function c(e, t, a, n, o) { 116 return ( 117 v(2, arguments), 118 r(e, function (e) { 119 function s(e) { 120 m(e); 121 } 122 function c(e) { 123 g(e); 124 } 125 function l(e) { 126 v(e); 127 } 128 function u() { 129 m = g = v = y; 130 } 131 var h, p, f, d, m, g, v, w, b; 132 if (((w = e.length >>> 0), (h = Math.max(0, Math.min(t, w))), (p = []), (d = i()), (f = r(d, a, n, o)), h)) 133 for ( 134 m = function (e) { 135 p.push(e), --h || (u(), d.resolve(p)); 136 }, 137 g = function (e) { 138 u(), d.reject(e); 139 }, 140 v = d.progress, 141 b = 0; 142 w > b; 143 ++b 144 ) 145 b in e && r(e[b], s, c, l); 146 else d.resolve(p); 147 return f; 148 }) 149 ); 150 } 151 function l(e, t, a, n) { 152 return ( 153 v(1, arguments), 154 r(e, function (e) { 155 return m(e, u, []); 156 }).then(t, a, n) 157 ); 158 } 159 function u(e, t, a) { 160 return (e[a] = t), e; 161 } 162 function h(e, t, a, n) { 163 function i(e) { 164 return t ? t(e[0]) : e[0]; 165 } 166 return c(e, 1, i, a, n); 167 } 168 function p(e, t) { 169 return r(e, function (e) { 170 return f(e, t); 171 }); 172 } 173 function f(e, t) { 174 var a, n, i; 175 for (n = e.length >>> 0, a = new Array(n), i = 0; n > i; i++) i in e && (a[i] = r(e[i], t)); 176 return m(a, u, a); 177 } 178 function d(e) { 179 var t = k.call(arguments, 1); 180 return r(e, function (e) { 181 return m.apply(_, [e].concat(t)); 182 }); 183 } 184 function m(e, t, a) { 185 var n, i; 186 return ( 187 (n = e.length), 188 (i = [ 189 function (e, a, i) { 190 return r(e, function (e) { 191 return r(a, function (a) { 192 return t(e, a, i, n); 193 }); 194 }); 195 }, 196 ]), 197 arguments.length > 2 && i.push(a), 198 b.apply(e, i) 199 ); 200 } 201 function g(e, t, n) { 202 var i = arguments.length > 2; 203 return r( 204 e, 205 function (e) { 206 return i && (e = n), t.resolve(e), e; 207 }, 208 function (e) { 209 return t.reject(e), a(e); 210 }, 211 t.progress 212 ); 213 } 214 function v(e, t) { 215 for (var a, n = t.length; n > e;
215 ) if (((a = t[--n]), null != a && "function" != typeof a)) throw new Error("callback is not a function"); 216 } 217 function y() {} 218 var w, b, k, _; 219 return ( 220 (r.defer = i), 221 (r.reject = n), 222 (r.isPromise = o), 223 (r.all = l), 224 (r.some = c), 225 (r.any = h), 226 (r.map = p), 227 (r.reduce = d), 228 (r.chain = g), 229 (w = 230 Object.freeze || 231 function (e) { 232 return e; 233 }), 234 (e.prototype = w({ 235 always: function (e, t) { 236 return this.then(e, e, t); 237 }, 238 otherwise: function (e) { 239 return this.then(_, e); 240 }, 241 })), 242 (k = [].slice), 243 (b = 244 [].reduce || 245 function (e) { 246 var t, a, n, i, o; 247 if (((o = 0), (t = Object(this)), (i = t.length >>> 0), (a = arguments), a.length <= 1)) 248 for (;;) { 249 if (o in t) { 250 n = t[o++]; 251 break; 252 } 253 if (++o >= i) throw new TypeError(); 254 } 255 else n = a[1]; 256 for (; i > o; ++o) o in t && (n = e(n, t[o], o, t)); 257 return n; 258 }), 259 r 260 ); 261 }); 262})( 263 "function" == typeof define 264 ? define 265 : function (e) { 266 "undefined" != typeof module ? (module.exports = e()) : (jQuery.mapster_when = e()); 267 } 268), 269 (function ($) { 270 ($.fn.mapster = function (e) { 271 var t = $.mapster.impl; 272 return $.isFunction(t[e]) ? t[e].apply(this, Array.prototype.slice.call(arguments, 1)) : "object" != typeof e && e ? void $.error("Method " + e + " does not exist on jQuery.mapster") : t.bind.apply(this, arguments); 273 }), 274 ($.mapster = { 275 version: "1.2.14-beta1", 276 render_defaults: { 277 isSelectable: !0, 278 isDeselectable: !0, 279 fade: !1, 280 fadeDuration: 150, 281 fill: !0, 282 fillColor: "000000", 283 fillColorMask: "FFFFFF", 284 fillOpacity: 0.7, 285 highlight: !0, 286 stroke: !1, 287 strokeColor: "ff0000", 288 strokeOpacity: 1, 289 strokeWidth: 1, 290 includeKeys: "", 291 altImage: null, 292 altImageId: null, 293 altImages: {}, 294 }, 295 defaults: { 296 clickNavigate: !1, 297 wrapClass: null, 298 wrapCss: null, 299 onGetList: null, 300 sortList: !1, 301 listenToList: !1, 302 mapKey: "", 303 mapValue: "", 304 singleSelect: !1, 305 listKey: "value", 306 listSelectedAttribute: "selected", 307 listSelectedClass: null, 308 onClick: null, 309 onMouseover: null, 310 onMouseout: null, 311 mouseoutDelay: 0, 312 onStateChange: null, 313 boundList: null, 314 onConfigured: null, 315 configTimeout: 3e4, 316 noHrefIsMask: !0, 317 scaleMap: !0, 318 safeLoad: !1, 319 areas: [], 320 }, 321 shared_defaults: { render_highlight: { fade: !0 }, render_select: { fade: !1 }, staticState: null, selected: null }, 322 area_defaults: { includeKeys: "", isMask: !1 }, 323 canvas_style: { position: "absolute", left: 0, top: 0, padding: 0, border: 0 }, 324 hasCanvas: null, 325 isTouch: null, 326 map_cache: [], 327 hooks: {}, 328 addHook: function (e, t) { 329 this.hooks[e] = (this.hooks[e] || []).push(t); 330 }, 331 callHooks: function (e, t) { 332 $.each(this.hooks[e] || [], function (e, a) { 333 a.apply(t); 334 }); 335 }, 336 utils: { 337 when: $.mapster_when, 338 defer: $.mapster_when.defer, 339 subclass: function (e, t) { 340 var a = function () { 341 var a = this, 342 n = Array.prototype.slice.call(arguments, 0); 343 (a.base = e.prototype), 344 (a.base.init = function () { 345 e.prototype.constructor.apply(a, n); 346 }), 347 t.apply(a, n); 348 }; 349 return (a.prototype = new e()), (a.prototype.constructor = a), a; 350 }, 351 asArray: function (e) { 352 return e.constructor === Array ? e : this.split(e); 353 }, 354 split: function (e, t) { 355 var a, 356 n, 357 i = e.split(","); 358 for (a = 0; a < i.length; a++) (n = $.trim(i[a])), "" === n ? i.splice(a, 1) : (i[a] = t ? t(n) : n); 359 return i; 360 }, 361 updateProps: function (e, t) { 362 var a, 363 n = e || {}, 364 i = $.isEmptyObject(n) ? t : e; 365 return ( 366 (a = []), 367 $.each(i, function (e) { 368 a.push(e); 369 }), 370 $.each(Array.prototype.slice.call(arguments, 1), function (e, t) { 371 $.each(t || {}, function (e) { 372 if (!a || $.inArray(e, a) >= 0) { 373 var i = t[e]; 374 $.isPlainObject(i) ? (n[e] = $.extend(n[e] || {}, i)) : i && i.constructor === Array ? (n[e] = i.slice(0)) : "undefined" != typeof i && (n[e] = t[e]); 375 } 376 }); 377 }), 378 n 379 ); 380 }, 381 isElement: function (e) { 382 return "object" == typeof HTMLElement ? e instanceof HTMLElement : e && "object" == typeof e && 1 === e.nodeType && "string" == typeof e.nodeName; 383 }, 384 indexOf: function (e, t) { 385 for (var a = 0; a < e.length; a++) if (e[a] === t) return a; 386 return -1; 387 }, 388 indexOfProp: function (e, t, a) { 389 var n = e.constructor === Array ? -1 : null; 390 return ( 391 $.each(e, function (e, i) { 392 return i && (t ? i[t] : i) === a ? ((n = e), !1) : void 0; 393 }), 394 n 395 ); 396 }, 397 boolOrDefault: function (e, t) { 398 return this.isBool(e) ? e : t || !1; 399 }, 400 isBool: function (e) { 401 return "boolean" == typeof e; 402 }, 403 isUndef: function (e) { 404 return "undefined" == typeof e; 405 }, 406 ifFunction: function (e, t, a) { 407 $.isFunction(e) && e.call(t, a); 408 }, 409 size: function (e, t) { 410 var a = $.mapster.utils; 411 return {
412 width: t ? e.width || e.naturalWidth : a.imgWidth(e, !0), 413 height: t ? e.height || e.naturalHeight : a.imgHeight(e, !0), 414 complete: function () { 415 return !!this.height && !!this.width; 416 }, 417 }; 418 }, 419 setOpacity: function (e, t) { 420 $.mapster.hasCanvas() 421 ? (e.style.opacity = t) 422 : $(e).each(function (e, a) { 423 "undefined" != typeof a.opacity ? (a.opacity = t) : $(a).css("opacity", t); 424 }); 425 }, 426 fader: (function () { 427 var e = {}, 428 t = 0, 429 a = function (n, i, o, r) { 430 var s, 431 c, 432 l = r / 15, 433 u = $.mapster.utils; 434 if ("number" == typeof n) { 435 if (((c = e[n]), !c)) return; 436 } else (s = u.indexOfProp(e, null, n)), s && delete e[s], (e[++t] = c = n), (n = t); 437 (o = o || 1), 438 (i = i + o / l > o - 0.01 ? o : i + o / l), 439 u.setOpacity(c, i), 440 o > i && 441 setTimeout(function () { 442 a(n, i, o, r); 443 }, 15); 444 }; 445 return a; 446 })(), 447 }, 448 getBoundList: function (e, t) { 449 if (!e.boundList) return null; 450 var a, 451 n, 452 i = $(), 453 o = $.mapster.utils.split(t); 454 return ( 455 e.boundList.each(function (t, r) { 456 for (a = 0; a < o.length; a++) (n = o[a]), $(r).is("[" + e.listKey + '="' + n + '"]') && (i = i.add(r)); 457 }), 458 i 459 ); 460 }, 461 setBoundListProperties: function (e, t, a) { 462 t.each(function (t, n) { 463 e.listSelectedClass && (a ? $(n).addClass(e.listSelectedClass) : $(n).removeClass(e.listSelectedClass)), e.listSelectedAttribute && $(n).attr(e.listSelectedAttribute, a); 464 }); 465 }, 466 getMapDataIndex: function (e) { 467 var t, a; 468 switch (e.tagName && e.tagName.toLowerCase()) { 469 case "area": 470 (a = $(e).parent().attr("name")), (t = $("img[usemap='#" + a + "']")[0]); 471 break; 472 case "img": 473 t = e; 474 } 475 return t ? this.utils.indexOfProp(this.map_cache, "image", t) : -1; 476 }, 477 getMapData: function (e) { 478 var t = this.getMapDataIndex(e.length ? e[0] : e); 479 return t >= 0 ? (t >= 0 ? this.map_cache[t] : null) : void 0; 480 }, 481 queueCommand: function (e, t, a, n) { 482 return e && (!e.complete || e.currentAction) ? (e.commands.push({ that: t, command: a, args: n }), !0) : !1; 483 }, 484 unload: function () { 485 this.impl.unload(), (this.utils = null), (this.impl = null), ($.fn.mapster = null), ($.mapster = null), $("*").unbind(); 486 }, 487 }); 488 var m = $.mapster, 489 u = m.utils, 490 ap = Array.prototype; 491 $.each(["width", "height"], function (e, t) { 492 var a = t.substr(0, 1).toUpperCase() + t.substr(1); 493 u["img" + a] = function (e, n) { 494 return (n ? $(e)[t]() : 0) || e[t] || e["natural" + a] || e["client" + a] || e["offset" + a]; 495 }; 496 }), 497 (m.Method = function (e, t, a, n) { 498 var i = this; 499 (i.name = n.name), 500 (i.output = e), 501 (i.input = e), 502 (i.first = n.first || !1), 503 (i.args = n.args ? ap.slice.call(n.args, 0) : []), 504 (i.key = n.key), 505 (i.func_map = t), 506 (i.func_area = a), 507 (i.name = n.name), 508 (i.allowAsync = n.allowAsync || !1); 509 }), 510 (m.Method.prototype = { 511 constructor: m.Method, 512 go: function () { 513 var e, 514 t, 515 a, 516 n, 517 i, 518 o = this.input, 519 r = [], 520 s = this; 521 for (n = o.length, e = 0; n > e; e++) 522 if ((t = $.mapster.getMapData(o[e]))) { 523 if (!s.allowAsync && m.queueCommand(t, s.input, s.name, s.args)) { 524 this.first && (i = ""); 525 continue; 526 } 527 if (((a = t.getData("AREA" === o[e].nodeName ? o[e]
527: this.key)), a ? $.inArray(a, r) < 0 && r.push(a) : (i = this.func_map.apply(t, s.args)), this.first || "undefined" != typeof i)) break; 528 } 529 return ( 530 $(r).each(function (e, t) { 531 i = s.func_area.apply(t, s.args); 532 }), 533 "undefined" != typeof i ? i : this.output 534 ); 535 }, 536 }), 537 ($.mapster.impl = (function () { 538 function hasVml() { 539 var e = $("<div />").appendTo("body"); 540 e.html('<v:shape id="vml_flag1" adj="1" />'); 541 var t = e[0].firstChild; 542 t.style.behavior = "url(#default#VML)"; 543 var a = t ? "object" == typeof t.adj : !0; 544 return e.remove(), a; 545 } 546 function namespaces() { 547 return "object" == typeof document.namespaces ? document.namespaces : null; 548 } 549 function hasCanvas() { 550 var e = namespaces(); 551 return e && e.g_vml_ ? !1 : !!$("<canvas />")[0].getContext; 552 } 553 function merge_areas(e, t) { 554 var a, 555 n, 556 i = e.options.areas; 557 t && 558 $.each(t, function (t, o) { 559 o && o.key && ((n = u.indexOfProp(i, "key", o.key)), n >= 0 ? $.extend(i[n], o) : i.push(o), (a = e.getDataForKey(o.key)), a && $.extend(a.options, o)); 560 }); 561 } 562 function merge_options(e, t) { 563 var a = u.updateProps({}, t); 564 delete a.areas, u.updateProps(e.options, a), merge_areas(e, t.areas), u.updateProps(e.area_options, e.options); 565 } 566 var me = {}, 567 addMap = function (e) { 568 return m.map_cache.push(e) - 1; 569 }, 570 removeMap = function (e) { 571 m.map_cache.splice(e.index, 1); 572 for (var t = m.map_cache.length - 1; t >= this.index; t--) m.map_cache[t].index--; 573 }; 574 return ( 575 (me.get = function (e) { 576 var t = m.getMapData(this); 577 if (!t || !t.complete) throw "Can't access data until binding complete."; 578 return new m.Method( 579 this, 580 function () { 581 return this.getSelected(); 582 }, 583 function () { 584 return this.isSelected(); 585 }, 586 { name: "get", args: arguments, key: e, first: !0, allowAsync: !0, defaultReturn: "" } 587 ).go(); 588 }), 589 (me.data = function (e) { 590 return new m.Method( 591 this, 592 null, 593 function () { 594 return this; 595 }, 596 { name: "data", args: arguments, key: e } 597 ).go(); 598 }), 599 (me.highlight = function (e) { 600 return new m.Method( 601 this, 602 function () { 603 if (e !== !1) { 604 var t = this.highlightId; 605 return t >= 0 ? this.data[t].key : null; 606 } 607 this.ensureNoHighlight(); 608 }, 609 function () { 610 this.highlight(); 611 }, 612 { name: "highlight", args: arguments, key: e, first: !0 } 613 ).go(); 614 }), 615 (me.keys = function (e, t) { 616 function a(e) { 617 var a, 618 i = []; 619 t 620 ? ((a = e.areas()), 621 $.each(a, function (e, t) { 622 i = i.concat(t.keys); 623 })) 624 : i.push(e.key), 625 $.each(i, function (e, t) { 626 $.inArray(t, n) < 0 && n.push(t); 627 }); 628 } 629 var n = [], 630 i = m.getMapData(this); 631 if (!i || !i.complete) throw "Can't access data until binding complete."; 632 return i && i.complete 633 ? ("string" == typeof e 634 ? t 635 ? a(i.getDataForKey(e))
636 : (n = [i.getKeysForGroup(e)]) 637 : ((t = e), 638 this.each(function (e, t) { 639 "AREA" === t.nodeName && a(i.getDataForArea(t)); 640 })), 641 n.join(",")) 642 : ""; 643 }), 644 (me.select = function () { 645 me.set.call(this, !0); 646 }), 647 (me.deselect = function () { 648 me.set.call(this, !1); 649 }), 650 (me.set = function (e, t, a) { 651 function n(t) { 652 var a = e; 653 if (t) { 654 switch (e) { 655 case !0: 656 t.select(h); 657 break; 658 case !1: 659 t.deselect(!0); 660 break; 661 default: 662 a = t.toggle(h); 663 } 664 return a; 665 } 666 } 667 function i(e) { 668 e && $.inArray(e, l) < 0 && (l.push(e), (c += ("" === c ? "" : ",") + e.key)); 669 } 670 function o(t) { 671 $.each(l, function (e, a) { 672 var i = n(a); 673 t.options.boundList && m.setBoundListProperties(t.options, m.getBoundList(t.options, c), i); 674 }), 675 e || t.removeSelectionFinish(); 676 } 677 var r, 678 s, 679 c, 680 l, 681 h = a; 682 return ( 683 this.filter("img,area").each(function (a, n) { 684 var p; 685 (s = m.getMapData(n)), 686 s !== r && (r && o(r), (l = []), (c = "")), 687 s && 688 ((p = ""), 689 "IMG" === n.nodeName.toUpperCase() 690 ? m.queueCommand(s, $(n), "set", [e, t, h]) || 691 (t instanceof Array ? t.length && (p = t.join(",")) : (p = t), 692 p && 693 $.each(u.split(p), function (e, t) { 694 i(s.getDataForKey(t.toString())), (r = s); 695 })) 696 : ((h = t), m.queueCommand(s, $(n), "set", [e, h]) || (i(s.getDataForArea(n)), (r = s)))); 697 }), 698 s && o(s), 699 this 700 ); 701 }), 702 (me.unbind = function (e) { 703 return new m.Method( 704 this, 705 function () { 706 this.clearEvents(), this.clearMapData(e), removeMap(this); 707 }, 708 null, 709 { name: "unbind", args: arguments } 710 ).go(); 711 }), 712 (me.rebind = function (e) { 713 return new m.Method( 714 this, 715 function () { 716 var t = this; 717 (t.complete = !1), 718 t.configureOptions(e), 719 t.bindImages().then(function () { 720 t.buildDataset(!0), (t.complete = !0); 721 }); 722 }, 723 null, 724 { name: "rebind", args: arguments } 725 ).go(); 726 }), 727 (me.get_options = function (e, t) { 728 var a = u.isBool(e) ? e : t; 729 return new m.Method( 730 this, 731 function () { 732 var e = $.extend({}, this.options); 733 return a && ((e.render_select = u.updateProps({}, m.render_defaults, e, e.render_select)), (e.render_highlight = u.updateProps({}, m.render_defaults, e, e.render_highlight))), e; 734 }, 735 function () { 736 return a ? this.effectiveOptions() : this.options; 737 }, 738 { name: "get_options", args: arguments, first: !0, allowAsync: !0, key: e } 739 ).go(); 740 }), 741 (me.set_options = function (e) { 742 return new m.Method( 743 this, 744 function () { 745 merge_options(this, e); 746 }, 747 null, 748 { name: "set_options", args: arguments } 749 ).go(); 750 }), 751 (me.unload = function () { 752 var e; 753 for (e = m.map_cache.length - 1; e >= 0; e--) m.map_cache[e] && me.unbind.call($(m.map_cache[e].image)); 754 me.graphics = null; 755 }), 756 (me.snapshot = function () { 757 return new m.Method( 758 this, 759 function () { 760 $.each(this.data, function (e, t) { 761 t.selected = !1; 762 }), 763 (this.base_canvas = this.graphics.createVisibleCanvas(this)), 764 $(this.image).before(this.base_canvas); 765 }, 766 null, 767 { name: "snapshot" } 768 ).go(); 769 }), 770 (me.state = function () { 771 var e, 772 t = null; 773 return ( 774 $(this).each(function (a, n) { 775 return "IMG" === n.nodeName ? ((e = m.getMapData(n)), e && (t = e.state()), !1) : void 0; 776 }), 777 t 778 ); 779 }), 780 (me.bind = function (e) { 781 return this.each(function (t, a) { 782 var n, i, o, r;
783 if (((n = $(a)), (r = m.getMapData(a)))) { 784 if ((me.unbind.apply(n), !r.complete)) return n.bind(), !0; 785 r = null; 786 } 787 return ( 788 (o = this.getAttribute("usemap")), 789 (i = o && $('map[name="' + o.substr(1) + '"]')), 790 n.is("img") && o && i.length > 0 791 ? (n.css("border", 0), 792 void ( 793 r || 794 ((r = new m.MapData(this, e)), 795 (r.index = addMap(r)), 796 (r.map = i), 797 r.bindImages().then(function () { 798 r.initialize(); 799 })) 800 )) 801 : !0 802 ); 803 }); 804 }), 805 (me.init = function (e) { 806 var t, a; 807 (m.hasCanvas = function () { 808 return u.isBool(m.hasCanvas.value) || (m.hasCanvas.value = u.isBool(e) ? e : hasCanvas()), m.hasCanvas.value; 809 }), 810 (m.hasVml = function () { 811 if (!u.isBool(m.hasVml.value)) { 812 var e = namespaces(); 813 e && 814 !e.v && 815 (e.add("v", "urn:schemas-microsoft-com:vml"), 816 (t = document.createStyleSheet()), 817 (a = ["shape", "rect", "oval", "circ", "fill", "stroke", "imagedata", "group", "textbox"]), 818 $.each(a, function (e, a) { 819 t.addRule("v\\:" + a, "behavior: url(#default#VML); antialias:true"); 820 })), 821 (m.hasVml.value = hasVml()); 822 } 823 return m.hasVml.value; 824 }), 825 (m.isTouch = !!document.documentElement.ontouchstart), 826 (u.indexOf = Array.prototype.indexOf || u.indexOf), 827 $.extend(m.defaults, m.render_defaults, m.shared_defaults), 828 $.extend(m.area_defaults, m.render_defaults, m.shared_defaults); 829 }), 830 (me.test = function (obj) { 831 return eval(obj); 832 }), 833 me 834 ); 835 })()), 836 $.mapster.impl.init(); 837 })(jQuery), 838 (function (e) { 839 function t(t, a, n) { 840 var i = t, 841 o = i.map_data, 842 r = n.isMask; 843 e.each(a.areas(), function (e, t) { 844 (n.isMask = r || (t.nohref && o.options.noHrefIsMask)), i.addShape(t, n); 845 }), 846 (n.isMask = r); 847 } 848 function a(e) { 849 return Math.max(0, Math.min(parseInt(e, 16), 255)); 850 } 851 function n(e, t) { 852 return "rgba(" + a(e.substr(0, 2)) + "," + a(e.substr(2, 2)) + "," + a(e.substr(4, 2)) + "," + t + ")"; 853 } 854 function i() {} 855 var o, 856 r, 857 s, 858 c = e.mapster, 859 l = c.utils; 860 (c.Graphics = function (e) { 861 var t = this; 862 (t.active = !1), (t.canvas = null), (t.width = 0), (t.height = 0), (t.shapes = []), (t.masks = []), (t.map_data = e); 863 }), 864 (o = c.Graphics.prototype = { 865 constructor: c.Graphics, 866 begin: function (t, a) { 867 var n = e(t); 868 (this.elementName = a), (this.canvas = t), (this.width = n.width()), (this.height = n.height()), (this.shapes = []), (this.masks = []), (this.active = !0); 869 }, 870 addShape: function (e, t) { 871 var a = t.isMask ? this.masks : this.shapes; 872 a.push({ mapArea: e, options: t }); 873 }, 874 createVisibleCanvas: function (t) { 875 return e(this.createCanvasFor(t)).addClass("mapster_el").attr("alt", "").css(c.canvas_style)[0]; 876 }, 877 addShapeGroup: function (a, n, i) { 878 var o, 879 r, 880 s, 881 u = this, 882 h = this.map_data, 883 p = a.effectiveRenderOptions(n); 884 i && e.extend(p, i), 885 "select" === n ? ((r = "static_" + a.areaId.toString()), (s = h.base_canvas)) : (s = h.overlay_canvas), 886 u.begin(s, r), 887 p.includeKeys && 888 ((o = l.split(p.includeKeys)), 889 e.each(o, function (e, a) { 890 var i = h.getDataForKey(a.toString()); 891 t(u, i, i.effectiveRenderOptions(n)); 892 })), 893 t(u, a, p), 894 u.render(), 895 p.fade && l.fader(c.hasCanvas() ? s : e(s).find("._fill").not(".mapster_mask"), 0, c.hasCanvas() ? 1 : p.fillOpacity, p.fadeDuration); 896 }, 897 }), 898 (r = { 899 renderShape: function (e, t, a) { 900 var n, 901 i = t.coords(null, a); 902 switch (t.shape) { 903 case "rect": 904 e.rect(i[0], i[1], i[2] - i[0], i[3] - i[1]); 905 break; 906 case "poly": 907 for (e.moveTo(i[0], i[1]), n = 2; n < t.length; n += 2) e.lineTo(i[n], i[n + 1]); 908 e.lineTo(i[0], i[1]); 909 break; 910 case "circ": 911 case "circle": 912 e.arc(i[0], i[1], i[2], 0, 2 * Math.PI, !1); 913 } 914 }, 915 addAltImage: function (e, t, a, n) { 916 e.beginPath(), this.renderShape(e, a), e.closePath(), e.clip(), (e.globalAlpha = n.altImageOpacity || n.fillOpacity), e.drawImage(t, 0, 0, a.owner.scaleInfo.width, a.owner.scaleInfo.height); 917 }, 918 render: function () { 919 var t, 920 a, 921 i = this, 922 o = i.map_data, 923 r = i.masks.length, 924 s = i.createCanvasFor(o), 925 c = s.getContext("2d"), 926 l = i.canvas.getContext("2d"); 927 return ( 928 r && 929 ((t = i.createCanvasFor(o)), 930 (a = t.getContext("2d")), 931 a.clearRect(0, 0, t.width, t.height), 932 e.each(i.masks, function (e, t) { 933 a.save(), a.beginPath(), i.renderShape(a, t.mapArea), a.closePath(), a.clip(), (a.lineWidth = 0), (a.fillStyle = "#000"), a.fill(), a.restore(
933); 934 })), 935 e.each(i.shapes, function (e, t) { 936 c.save(), 937 t.options.fill && 938 (t.options.altImageId 939 ? i.addAltImage(c, o.images[t.options.altImageId], t.mapArea, t.options) 940 : (c.beginPath(), i.renderShape(c, t.mapArea), c.closePath(), (c.fillStyle = n(t.options.fillColor, t.options.fillOpacity)), c.fill())), 941 c.restore(); 942 }), 943 e.each(i.shapes.concat(i.masks), function (e, t) { 944 var a = 1 === t.options.strokeWidth ? 0.5 : 0; 945 t.options.stroke && 946 (c.save(), (c.strokeStyle = n(t.options.strokeColor, t.options.strokeOpacity)), (c.lineWidth = t.options.strokeWidth), c.beginPath(), i.renderShape(c, t.mapArea, a), c.closePath(), c.stroke(), c.restore()); 947 }), 948 r ? ((a.globalCompositeOperation = "source-out"), a.drawImage(s, 0, 0), l.drawImage(t, 0, 0)) : l.drawImage(s, 0, 0), 949 (i.active = !1), 950 i.canvas 951 ); 952 }, 953 createCanvasFor: function (t) { 954 return e('<canvas width="' + t.scaleInfo.width + '" height="' + t.scaleInfo.height + '"></canvas>')[0]; 955 }, 956 clearHighlight: function () { 957 var e = this.map_data.overlay_canvas; 958 e.getContext("2d").clearRect(0, 0, e.width, e.height); 959 }, 960 refreshSelections: function () { 961 var t, 962 a = this.map_data; 963 (t = a.base_canvas), (a.base_canvas = this.createVisibleCanvas(a)), e(a.base_canvas).hide(), e(t).before(a.base_canvas), a.redrawSelections(), e(a.base_canvas).show(), e(t).remove(); 964 }, 965 }), 966 (s = { 967 renderShape: function (t, a, n) { 968 var i, 969 o, 970 r, 971 s, 972 c, 973 l, 974 u, 975 h = this, 976 p = t.coords(); 977 switch ( 978 ((c = h.elementName ? 'name="' + h.elementName + '" ' : ""), 979 (l = n ? 'class="' + n + '" ' : ""), 980 (s = '<v:fill color="#' + a.fillColor + '" class="_fill" opacity="' + (a.fill ? a.fillOpacity : 0) + '" /><v:stroke class="_fill" opacity="' + a.strokeOpacity + '"/>'), 981 (o = a.stroke ? " strokeweight=" + a.strokeWidth + ' stroked="t" strokecolor="#' + a.strokeColor + '"' : ' stroked="f"'), 982 (i = a.fill ? ' filled="t"' : ' filled="f"'), 983 t.shape) 984 ) { 985 case "rect": 986 u = 987 "<v:rect " + 988 l + 989 c + 990 i + 991 o + 992 ' style="zoom:1;margin:0;padding:0;display:block;position:absolute;left:' + 993 p[0] + 994 "px;top:" + 995 p[1] + 996 "px;width:" + 997 (p[2] - p[0]) + 998 "px;height:" + 999 (p[3] - p[1]) + 1000 'px;">' + 1001 s + 1002 "</v:rect>"; 1003 break; 1004 case "poly": 1005 u = 1006 "<v:shape " + 1007 l + 1008 c + 1009 i + 1010 o + 1011 ' coordorigin="0,0" coordsize="' + 1012 h.width + 1013 "," + 1014 h.height + 1015 '" path="m ' + 1016 p[0] + 1017 "," + 1018 p[1] + 1019 " l " + 1020 p.slice(2).join(",") + 1021 ' x e" style="zoom:1;margin:0;padding:0;display:block;position:absolute;top:0px;left:0px;width:' + 1022 h.width + 1023 "px;height:" + 1024 h.height + 1025 'px;">' + 1026 s + 1027 "</v:shape>"; 1028 break; 1029 case "circ": 1030 case "circle": 1031 u = 1032 "<v:oval " + 1033 l + 1034 c + 1035 i + 1036 o + 1037 ' style="zoom:1;margin:0;padding:0;display:block;position:absolute;
1037left:' + 1038 (p[0] - p[2]) + 1039 "px;top:" + 1040 (p[1] - p[2]) + 1041 "px;width:" + 1042 2 * p[2] + 1043 "px;height:" + 1044 2 * p[2] + 1045 'px;">' + 1046 s + 1047 "</v:oval>"; 1048 } 1049 return (r = e(u)), e(h.canvas).append(r), r; 1050 }, 1051 render: function () { 1052 var t, 1053 a = this; 1054 return ( 1055 e.each(this.shapes, function (e, t) { 1056 a.renderShape(t.mapArea, t.options); 1057 }), 1058 this.masks.length && 1059 e.each(this.masks, function (e, n) { 1060 (t = l.updateProps({}, n.options, { fillOpacity: 1, fillColor: n.options.fillColorMask })), a.renderShape(n.mapArea, t, "mapster_mask"); 1061 }), 1062 (this.active = !1), 1063 this.canvas 1064 ); 1065 }, 1066 createCanvasFor: function (t) { 1067 var a = t.scaleInfo.width, 1068 n = t.scaleInfo.height; 1069 return e('<var width="' + a + '" height="' + n + '" style="zoom:1;overflow:hidden;display:block;width:' + a + "px;height:" + n + 'px;"></var>')[0]; 1070 }, 1071 clearHighlight: function () { 1072 e(this.map_data.overlay_canvas).children().remove(); 1073 }, 1074 removeSelections: function (t) { 1075 t >= 0 1076 ? e(this.map_data.base_canvas) 1077 .find('[name="static_' + t.toString() + '"]') 1078 .remove() 1079 : e(this.map_data.base_canvas).children().remove(); 1080 }, 1081 }), 1082 e.each(["renderShape", "addAltImage", "render", "createCanvasFor", "clearHighlight", "removeSelections", "refreshSelections"], function (e, t) { 1083 o[t] = (function (e) { 1084 return function () { 1085 return (o[e] = (c.hasCanvas() ? r[e] : s[e]) || i), o[e].apply(this, arguments); 1086 }; 1087 })(t); 1088 }); 1089 })(jQuery), 1090 (function (e) { 1091 var t = e.mapster, 1092 a = t.utils, 1093 n = []; 1094 (t.MapImages = function (e) { 1095 (this.owner = e), this.clear(); 1096 }), 1097 (t.MapImages.prototype = { 1098 constructor: t.MapImages, 1099 slice: function () { 1100 return n.slice.apply(this, arguments); 1101 }, 1102 splice: function () { 1103 n.slice.apply(this.status, arguments); 1104 var e = n.slice.apply(this, arguments); 1105 return e; 1106 }, 1107 complete: function () { 1108 return e.inArray(!1, this.status) < 0; 1109 }, 1110 _add: function (e) { 1111 var t = n.push.call(this, e) - 1; 1112 return (this.status[t] = !1), t; 1113 }, 1114 indexOf: function (e) { 1115 return a.indexOf(this, e); 1116 }, 1117 clear: function () { 1118 var t = this; 1119 t.ids && 1120 t.ids.length > 0 && 1121 e.each(t.ids, function (e, a) { 1122 delete t[a]; 1123 }), 1124 (t.ids = []), 1125 (t.length = 0), 1126 (t.status = []), 1127 t.splice(0); 1128 }, 1129 add: function (t, a) { 1130 var n, 1131 i, 1132 o = this; 1133 if (t) { 1134 if ("string" == typeof t) { 1135 if (((i = t), (t = o[i]), "object" == typeof t)) return o.indexOf(t); 1136 (t = e("<img />").addClass("mapster_el").attr("alt", "").hide()), 1137 (n = o._add(t[0])), 1138 t 1139 .bind("load", function (e) { 1140 o.imageLoaded.call(o, e); 1141 }) 1142 .bind("error", function (e) { 1143 o.imageLoadError.call(o, e); 1144 }), 1145 t.attr("src", i); 1146 } else n = o._add(e(t)[0]); 1147 if (a) { 1148 if (this[a]) throw a + " is already used or is not available as an altImage alias."; 1149 o.ids.push(a), (o[a] = o[n]); 1150 } 1151 return n; 1152 } 1153 }, 1154 bind: function () { 1155 var e, 1156 t = this, 1157 n = t.owner.options.configTimeout / 200, 1158 i = function () { 1159 var e; 1160 for (e = t.length; e-- > 0 && t.isLoaded(e); ); 1161 t.complete() 1162 ? t.resolve() 1163 : n-- > 0 1164 ? (t.imgTimeout = window.setTimeout(function () { 1165 i.call(t, !0); 1166 }, 50)) 1167 : t.imageLoadError.call(t); 1168 }; 1169 return (e = t.deferred = a.defer()), i(), e; 1170 }, 1171 resolve: function () { 1172 var e = this, 1173 t = e.deferred; 1174 t && ((e.deferred = null), t.resolve()); 1175 }, 1176 imageLoaded: function (t) { 1177 var a = this, 1178 n = a.indexOf(t.target); 1179 n >= 0 && ((a.status[n] = !0), e.inArray(!1, a.status) < 0 && a.resolve()); 1180 }, 1181 imageLoadError: function (e) { 1182 clearTimeout(this.imgTimeout), (this.triesLeft = 0); 1183 var t = e ? "The image " + e.target.src + " failed to load." : "The images never seemed to finish loading. You may just need to increase the configTimeout if images could take a long time to load."; 1184 throw t; 1185 }, 1186 isLoaded: function (e) { 1187 var t, 1188 n = this, 1189 i = n.status; 1190 return i[e] ? !0 : ((t = n[e]), "undefined" != typeof t.complete ? (i[e] = t.complete) : (i[e] = !!a.imgWidth(t)), i[e]); 1191 }, 1192 }); 1193 })(jQuery), 1194 (function (e) { 1195 function t(t) { 1196 e.extend(t, { 1197 complete: !1, 1198 map: null, 1199 base_canvas: null, 1200 overlay_canvas: null, 1201 commands: [], 1202 data: [], 1203 mapAreas: [], 1204 _xref: {}, 1205 highlightId: -1, 1206 currentAreaId: -1, 1207 _tooltip_events: [], 1208 scaleInfo: null, 1209 index: -1, 1210 activeAreaEvent: null, 1211 }); 1212 } 1213 function a(e) { 1214 return [e, e.render_highlight, e.render_select]; 1215 } 1216 function n(t) { 1217 var n = t.options, 1218 i = t.images; 1219 u.hasCanvas() && 1220 (e.each(n.altImages || {}, function (e, t) { 1221 i.add(t, e); 1222 }), 1223 e.each([n].concat(n.areas), function (t, n) { 1224 e.each(a(n), function (e, t) { 1225 t && t.altImage && (t.altImageId = i.add(t.altImage)); 1226 }); 1227 })), 1228 (t.area_options = h.updateProps({}, u.area_defaults, n)); 1229 } 1230 function i(e, t, a, n) { 1231 function o(t) { 1232 e.currentAreaId !== t && e.highlightId >= 0 && n.resolve(); 1233 } 1234 return ( 1235 (n = n || h.when.defer()), 1236 e.activeAreaEvent && (window.clearTimeout(e.activeAreaEvent), (e.activeAreaEvent = 0)), 1237 0 > t 1238 ? n.reject() 1239 : a.owner.currentAction || t 1240 ? (e.activeAreaEvent = window.setTimeout( 1241 (function () { 1242 return function () { 1243 i(e, 0, a, n); 1244 }; 1245 })(a), 1246 t || 100 1247 )) 1248 : o(a.areaId), 1249 n 1250 ); 1251 } 1252 function o(e) { 1253 u.hasCanvas() || this.blur(), e.preventDefault(); 1254 } 1255 function r(t, a) { 1256 var n = t.getAllDataForArea(this), 1257 i = n.length ? n[0] : null; 1258 !i ||
1259 i.isNotRendered() || 1260 i.owner.currentAction || 1261 (t.currentAreaId !== i.areaId && 1262 (t.highlightId !== i.areaId && 1263 (t.clearEffects(), 1264 i.highlight(), 1265 t.options.showToolTip && 1266 e.each(n, function (e, t) { 1267 t.effectiveOptions().toolTip && t.showToolTip(); 1268 })), 1269 (t.currentAreaId = i.areaId), 1270 e.isFunction(t.options.onMouseover) && t.options.onMouseover.call(this, { e: a, options: i.effectiveOptions(), key: i.key, selected: i.isSelected() }))); 1271 } 1272 function s(t, a) { 1273 var n, 1274 o = t.getDataForArea(this), 1275 r = t.options; 1276 t.currentAreaId < 0 || 1277 !o || 1278 ((n = t.getDataForArea(a.relatedTarget)), 1279 n !== o && ((t.currentAreaId = -1), (o.area = null), i(t, r.mouseoutDelay, o).then(t.clearEffects), e.isFunction(r.onMouseout) && r.onMouseout.call(this, { e: a, options: r, key: o.key, selected: o.isSelected() }))); 1280 } 1281 function c(t) { 1282 var a = t.options; 1283 t.ensureNoHighlight(), a.toolTipClose && e.inArray("area-mouseout", a.toolTipClose) >= 0 && t.activeToolTip && t.clearToolTip(); 1284 } 1285 function l(t, a) { 1286 function n(o) { 1287 var d, g; 1288 if ( 1289 ((l = o.isSelectable() && (o.isDeselectable() || !o.isSelected())), 1290 (c = l ? !o.isSelected() : o.isSelected()), 1291 (s = u.getBoundList(m, o.key)), 1292 e.isFunction(m.onClick) && ((p = m.onClick.call(f, { e: a, listTarget: s, key: o.key, selected: c })), h.isBool(p))) 1293 ) { 1294 if (!p) return !1; 1295 if (((g = e(o.area).attr("href")), "#" !== g)) return (window.location.href = g), !1; 1296 } 1297 l && (i = o.toggle()), 1298 m.boundList && m.boundList.length > 0 && u.setBoundListProperties(m, s, o.isSelected()), 1299 (d = o.effectiveOptions()), 1300 d.includeKeys && 1301 ((r = h.split(d.includeKeys)), 1302 e.each(r, function (e, a) { 1303 var i = t.getDataForKey(a.toString()); 1304 i.options.isMask || n(i); 1305 })); 1306 } 1307 var i, 1308 r, 1309 s, 1310 c, 1311 l, 1312 p, 1313 f = this, 1314 d = t.getDataForArea(this), 1315 m = t.options; 1316 return o.call(this, a), m.clickNavigate && d.href ? void (window.location.href = d.href) : void (d && !d.owner.currentAction && ((m = t.options), n(d))); 1317 } 1318 var u = e.mapster, 1319 h = u.utils; 1320 (u.MapData = function (e, a) { 1321 var n = this; 1322 (n.image = e), 1323 (n.images = new u.MapImages(n)), 1324 (n.graphics = new u.Graphics(n)), 1325 (n.imgCssText = e.style.cssText || null), 1326 t(n), 1327 n.configureOptions(a), 1328 (n.mouseover = function (e) { 1329 r.call(this, n, e); 1330 }), 1331 (n.mouseout = function (e) { 1332 s.call(this, n, e); 1333 }), 1334 (n.click = function (e) { 1335 l.call(this, n, e); 1336 }), 1337 (n.clearEffects = function (e) { 1338 c.call(this, n, e); 1339 }); 1340 }), 1341 (u.MapData.prototype = { 1342 constructor: u.MapData, 1343 configureOptions: function (e) { 1344 this.options = h.updateProps({}, u.defaults, e); 1345 }, 1346 bindImages: function () { 1347 var e = this, 1348 t = e.images; 1349 return t.length > 2 ? t.splice(2) : 0 === t.length && (t.add(e.image), t.add(e.image.src)), n(e), e.images.bind(); 1350 }, 1351 isActive: function () { 1352 return !this.complete || this.currentAction; 1353 }, 1354 state: function () { 1355 return { complete: this.complete, resizing: "resizing" === this.currentAction, zoomed: this.zoomed, zoomedArea: this.zoomedArea, scaleInfo: this.scaleInfo }; 1356 }, 1357 wrapId: function () { 1358 return "mapster_wrap_" + this.index; 1359 }, 1360 _idFromKey: function (e) { 1361 return "string" == typeof e && this._xref.hasOwnProperty(e) ? this._xref[e] : -1; 1362 }, 1363 getSelected: function () { 1364 var t = ""; 1365 return ( 1366 e.each(this.data, function (e, a) { 1367 a.isSelected() && (t += (t ? "," : "") + this.key); 1368 }), 1369 t 1370 ); 1371 }, 1372 getAllDataForArea: function (t, a) { 1373 var n, 1374 i, 1375 o, 1376 r = this, 1377 s = e(t).filter("area").attr(r.options.mapKey); 1378 if (s) for (o = [], s = h.split(s), n = 0; n < (a || s.length); n++) (i = r.data[r._idFromKey(s[n])]), (i.area = t.length ? t[0] : t), o.push(i); 1379 return o; 1380 }, 1381 getDataForArea: function (e) { 1382 var t = this.getAllDataForArea(e, 1); 1383 return t ? t[0] || null : null; 1384 }, 1385 getDataForKey: function (e) { 1386 return this.data[this._idFromKey(e)]; 1387 },
1388 getKeysForGroup: function (e) { 1389 var t = this.getDataForKey(e); 1390 return t ? (t.isPrimary ? t.key : this.getPrimaryKeysForMapAreas(t.areas()).join(",")) : ""; 1391 }, 1392 getPrimaryKeysForMapAreas: function (t) { 1393 var a = []; 1394 return ( 1395 e.each(t, function (t, n) { 1396 e.inArray(n.keys[0], a) < 0 && a.push(n.keys[0]); 1397 }), 1398 a 1399 ); 1400 }, 1401 getData: function (e) { 1402 return "string" == typeof e ? this.getDataForKey(e) : (e && e.mapster) || h.isElement(e) ? this.getDataForArea(e) : null; 1403 }, 1404 ensureNoHighlight: function () { 1405 var e; 1406 this.highlightId >= 0 && (this.graphics.clearHighlight(), (e = this.data[this.highlightId]), e.changeState("highlight", !1), this.setHighlightId(-1)); 1407 }, 1408 setHighlightId: function (e) { 1409 this.highlightId = e; 1410 }, 1411 clearSelections: function () { 1412 e.each(this.data, function (e, t) { 1413 t.selected && t.deselect(!0); 1414 }), 1415 this.removeSelectionFinish(); 1416 }, 1417 setAreaOptions: function (e) { 1418 var t, a, n; 1419 for (e = e || [], t = e.length - 1; t >= 0; t--) (a = e[t]), a && ((n = this.getDataForKey(a.key)), n && (h.updateProps(n.options, a), h.isBool(a.selected) && (n.selected = a.selected))); 1420 }, 1421 drawSelections: function (e) { 1422 var t, 1423 a = h.asArray(e); 1424 for (t = a.length - 1; t >= 0; t--) this.data[a[t]].drawSelection(); 1425 }, 1426 redrawSelections: function () { 1427 e.each(this.data, function (e, t) { 1428 t.isSelectedOrStatic() && t.drawSelection(); 1429 }); 1430 }, 1431 initialize: function () { 1432 var t, 1433 a, 1434 n, 1435 i, 1436 o, 1437 r, 1438 s, 1439 c, 1440 l, 1441 p, 1442 f, 1443 d, 1444 m = this, 1445 g = m.options; 1446 if (!m.complete) { 1447 for ( 1448 l = e(m.image), 1449 o = l.parent().attr("id"), 1450 o && o.length >= 12 && "mapster_wrap" === o.substring(0, 12) 1451 ? ((i = l.parent()), i.attr("id", m.wrapId())) 1452 : ((i = e('<div id="' + m.wrapId() + '"></div>')), g.wrapClass && (g.wrapClass === !0 ? i.addClass(l[0].className) : i.addClass(g.wrapClass))), 1453 m.wrapper = i, 1454 m.scaleInfo = d = h.scaleMap(m.images[0], m.images[1], g.scaleMap), 1455 m.base_canvas = a = m.graphics.createVisibleCanvas(m), 1456 m.overlay_canvas = n = m.graphics.createVisibleCanvas(m), 1457 t = e(m.images[1]) 1458 .addClass("mapster_el " + m.images[0].className) 1459 .attr({ id: null, usemap: null }) 1460 .attr("alt", ""), 1461 c = h.size(m.images[0]), 1462 c.complete && t.css({ width: c.width, height: c.height }), 1463 m.buildDataset(), 1464 r = { display: "block", position: "relative", padding: 0, width: d.width, height: d.height }, 1465 g.wrapCss && e.extend(r, g.wrapCss), 1466 l.parent()[0] !== m.wrapper[0] && l.before(m.wrapper), 1467 i.css(r), 1468 e(m.images.slice(2)).hide(), 1469 s = 1; 1470 s < m.images.length; 1471 s++ 1472 ) 1473 i.append(m.images[s]); 1474 i.append(a).append(n).append(l.css(u.canvas_style)), 1475 h.setOpacity(m.images[0], 0), 1476 e(m.images[1]).show(), 1477 h.setOpacity(m.images[1], 1), 1478 g.isSelectable && 1479 g.onGetList && 1480 ((f = m.data.slice(0)), 1481 g.sortList && 1482 ((p = 1483 "desc" === g.sortList 1484 ? function (e, t) { 1485 return e === t ? 0 : e > t ? -1 : 1; 1486 } 1487 : function (e, t) { 1488 return e === t ? 0 : t > e ? -1 : 1; 1489 }), 1490 f.sort(function (e, t) { 1491 return (e = e.value), (t = t.value), p(e, t); 1492 })), 1493 (m.options.boundList = g.onGetList.call(m.image, f))), 1494 (m.complete = !0), 1495 m.processCommandQueue(), 1496 g.onConfigured && "function" == typeof g.onConfigured && g.onConfigured.call(l, !0); 1497 } 1498 }, 1499 buildDataset: function (t) { 1500 function a(e, t) { 1501 var a = new u.AreaData(w, e, t); 1502 return (a.areaId = w._xref[e] = w.data.push(a) - 1), a.areaId; 1503 } 1504 var n, 1505 i, 1506 o, 1507 r, 1508 s, 1509 c, 1510 l, 1511 h, 1512 p, 1513 f, 1514 d, 1515 m, 1516 g, 1517 v, 1518 y, 1519 w = this, 1520 b = w.options; 1521 for ( 1522 w._xref = {}, 1523 w.data = [], 1524 t || (w.mapAreas = []), 1525 y = !b.mapKey, 1526 y && (b.mapKey = "data-mapster-key"), 1527 n = u.hasVml() ? "area" : y ? "area[coords]" : "area[" + b.mapKey + "]", 1528 i = e(w.map).find(n).unbind(".mapster"), 1529 d = 0; 1530 d < i.length; 1531 d++ 1532 ) 1533 if (((r = 0), (c = i[d]), (s = e(c)), c.coords)) { 1534 for ( 1535 y ? ((l = String(d)), s.attr("data-mapster-key", l)) : (l = c.getAttribute(b.mapKey)), 1536 t ? ((h = w.mapAreas[s.data("mapster") - 1]), h.configure(l)) : ((h = new u.MapArea(w, c, l)), w.mapAreas.push(h)), 1537 f = h.keys, 1538 o = f.length - 1; 1539 o >= 0; 1540 o-- 1541 ) 1542 (p = f[o]), 1543 b.mapValue && (m = s.attr(b.mapValue)), 1544 y 1545 ? ((r = a(w.data.length, m)), (g = w.data[r]), (g.key = p = r.toString())) 1546 : ((r = w._xref[p]), r >= 0 ? ((g = w.data[r]), m && !w.data[r].value && (g.value = m)) : ((r = a(p, m)), (g = w.data[r]), (g.isPrimary = 0 === o))),
1547 h.areaDataXref.push(r), 1548 g.areasXref.push(d); 1549 (v = s.attr("href")), 1550 v && "#" !== v && !g.href && (g.href = v), 1551 h.nohref || s.bind("click.mapster", w.click).bind("mouseover.mapster, touchstart.mapster", w.mouseover).bind("mouseout.mapster, touchend.mapster", w.mouseout).bind("mousedown.mapster", w.mousedown), 1552 s.data("mapster", d + 1); 1553 } 1554 w.setAreaOptions(b.areas), w.redrawSelections(); 1555 }, 1556 processCommandQueue: function () { 1557 for (var e, t = this; !t.currentAction && t.commands.length; ) (e = t.commands[0]), t.commands.splice(0, 1), u.impl[e.command].apply(e.that, e.args); 1558 }, 1559 clearEvents: function () { 1560 e(this.map).find("area").unbind(".mapster"), e(this.images).unbind(".mapster"); 1561 }, 1562 _clearCanvases: function (t) { 1563 t || e(this.base_canvas).remove(), e(this.overlay_canvas).remove(); 1564 }, 1565 clearMapData: function (t) { 1566 var a = this; 1567 this._clearCanvases(t), 1568 e.each(this.data, function (e, t) { 1569 t.reset(); 1570 }), 1571 (this.data = null), 1572 t || ((this.image.style.cssText = this.imgCssText), e(this.wrapper).before(this.image).remove()), 1573 a.images.clear(), 1574 (this.image = null), 1575 h.ifFunction(this.clearTooltip, this); 1576 }, 1577 removeSelectionFinish: function () { 1578 var e = this.graphics; 1579 e.refreshSelections(), e.clearHighlight(); 1580 }, 1581 }); 1582 })(jQuery), 1583 (function (e) { 1584 function t(t) { 1585 var a = this, 1586 n = a.owner; 1587 n.options.singleSelect && n.clearSelections(), 1588 a.isSelected() || (t && (a.optsCache = e.extend(a.effectiveRenderOptions("select"), t, { altImageId: n.images.add(t.altImage) })), a.drawSelection(), (a.selected = !0), a.changeState("select", !0)), 1589 n.options.singleSelect && n.graphics.refreshSelections(); 1590 } 1591 function a(e) { 1592 var t = this; 1593 (t.selected = !1), t.changeState("select", !1), (t.optsCache = null), t.owner.graphics.removeSelections(t.areaId), e || t.owner.removeSelectionFinish(); 1594 } 1595 function n(e) { 1596 var t = this; 1597 return t.isSelected() ? t.deselect() : t.select(e), t.isSelected(); 1598 } 1599 var i = e.mapster, 1600 o = i.utils; 1601 (i.AreaData = function (t, a, n) { 1602 e.extend(this, { owner: t, key: a || "", isPrimary: !0, areaId: -1, href: "", value: n || "", options: {}, selected: null, areasXref: [], area: null, optsCache: null }); 1603 }), 1604 (i.AreaData.prototype = { 1605 constuctor: i.AreaData, 1606 select: t, 1607 deselect: a, 1608 toggle: n, 1609 areas: function () { 1610 var e, 1611 t = []; 1612 for (e = 0; e < this.areasXref.length; e++) t.push(this.owner.mapAreas[this.areasXref[e]]); 1613 return t; 1614 }, 1615 coords: function (t) { 1616 var a = []; 1617 return ( 1618 e.each(this.areas(), function (e, n) { 1619 a = a.concat(n.coords(t)); 1620 }), 1621 a 1622 ); 1623 }, 1624 reset: function () { 1625 e.each(this.areas(), function (e, t) { 1626 t.reset(); 1627 }), 1628 (this.areasXref = []), 1629 (this.options = null); 1630 }, 1631 isSelectedOrStatic: function () { 1632 var e = this.effectiveOptions(); 1633 return o.isBool(e.staticState) ? e.staticState : this.isSelected(); 1634 }, 1635 isSelected: function () { 1636 return o.isBool(this.selected) ? this.selected : o.isBool(this.owner.area_options.selected) ? this.owner.area_options.selected : !1; 1637 }, 1638 isSelectable: function () { 1639 return o.isBool(this.effectiveOptions().staticState) ? !1 : o.isBool(this.owner.options.staticState) ? !1 : o.boolOrDefault(this.effectiveOptions().isSelectable, !0); 1640 }, 1641 isDeselectable: function () { 1642 return o.isBool(this.effectiveOptions().staticState) ? !1 : o.isBool(this.owner.options.staticState) ? !1 : o.boolOrDefault(this.effectiveOptions().isDeselectable, !0); 1643 },
1644 isNotRendered: function () { 1645 var t = e(this.area); 1646 return t.attr("nohref") || !t.attr("href") || this.effectiveOptions().isMask; 1647 }, 1648 effectiveOptions: function (e) { 1649 var t = o.updateProps({}, this.owner.area_options, this.options, e || {}, { id: this.areaId }); 1650 return (t.selected = this.isSelected()), t; 1651 }, 1652 effectiveRenderOptions: function (t, a) { 1653 var n, 1654 i = this.optsCache; 1655 return (i && "highlight" !== t) || ((n = this.effectiveOptions(a)), (i = o.updateProps({}, n, n["render_" + t])), "highlight" !== t && (this.optsCache = i)), e.extend({}, i); 1656 }, 1657 changeState: function (t, a) { 1658 e.isFunction(this.owner.options.onStateChange) && this.owner.options.onStateChange.call(this.owner.image, { key: this.key, state: t, selected: a }); 1659 }, 1660 highlight: function (e) { 1661 var t = this.owner; 1662 this.effectiveOptions().highlight && t.graphics.addShapeGroup(this, "highlight", e), t.setHighlightId(this.areaId), this.changeState("highlight", !0); 1663 }, 1664 drawSelection: function () { 1665 this.owner.graphics.addShapeGroup(this, "select"); 1666 }, 1667 }), 1668 (i.MapArea = function (t, a, n) { 1669 if (t) { 1670 var i = this; 1671 (i.owner = t), 1672 (i.area = a), 1673 (i.areaDataXref = []), 1674 (i.originalCoords = []), 1675 e.each(o.split(a.coords), function (e, t) { 1676 i.originalCoords.push(parseFloat(t)); 1677 }), 1678 (i.length = i.originalCoords.length), 1679 (i.shape = a.shape.toLowerCase()), 1680 (i.nohref = a.nohref || !a.href), 1681 i.configure(n); 1682 } 1683 }), 1684 (i.MapArea.prototype = { 1685 constructor: i.MapArea, 1686 configure: function (e) { 1687 this.keys = o.split(e); 1688 }, 1689 reset: function () { 1690 this.area = null; 1691 }, 1692 coords: function (t) { 1693 return e.map(this.originalCoords, function (e) { 1694 return t ? e : e + t; 1695 }); 1696 }, 1697 }); 1698 })(jQuery), 1699 (function (e) { 1700 var t = e.mapster.utils; 1701 t.areaCorners = function (a, n, i, o, r) { 1702 var s, 1703 c, 1704 l, 1705 u, 1706 h, 1707 p, 1708 f, 1709 d, 1710 m, 1711 g, 1712 v, 1713 y, 1714 w, 1715 b, 1716 k, 1717 _, 1718 C, 1719 A, 1720 I, 1721 S, 1722 x = 0, 1723 T = 0, 1724 M = []; 1725 for (a = a.length ? a : [a], i = e(i ? i : document.body), s = i.offset(), k = s.left, _ = s.top, n && ((s = e(n).offset()), (x = s.left), (T = s.top)), b = 0; b < a.length; b++) 1726 if (((S = a[b]), "AREA" === S.nodeName)) { 1727 switch (((C = t.split(S.coords, parseInt)), S.shape)) { 1728 case "circle": 1729 for (v = C[0], y = C[1], A = C[2], M = [], b = 0; 360 > b; b += 20) (I = (b * Math.PI) / 180), M.push(v + A * Math.cos(I), y + A * Math.sin(I)); 1730 break; 1731 case "rect": 1732 M.push(C[0], C[1], C[2], C[1], C[2], C[3], C[0], C[3]); 1733 break; 1734 default: 1735 M = M.concat(C); 1736 } 1737 for (b = 0; b < M.length; b += 2) (M[b] = parseInt(M[b], 10) + x), (M[b + 1] = parseInt(M[b + 1], 10) + T); 1738 } else (S = e(S)), (s = S.position()), M.push(s.left, s.top, s.left + S.width(), s.top, s.left + S.width(), s.top + S.height(), s.left, s.top + S.height()); 1739 for (l = u = f = m = 999999, h = p = d = g = -1, b = M.length - 2; b >= 0; b -= 2) (v = M[b]), (y = M[b + 1]), l > v && ((l = v), (g = y)), v > h && ((h = v), (m = y)), u > y && ((u = y), (d = v)), y > p && ((p = y), (f = v)); 1740 return ( 1741 o && 1742 r && 1743 ((c = !1), 1744 e.each( 1745 [ 1746 [d - o, u - r], 1747 [f, u - r], 1748 [l - o, g - r], 1749 [l - o, m], 1750 [h, g - r], 1751 [h, m], 1752 [d - o, p], 1753 [f, p], 1754 ], 1755 function (e, t) { 1756 return !c && t[0] > k && t[1] > _ ? ((w = t), (c = !0), !1) : void 0; 1757 } 1758 ), 1759 c || (w = [h, p])), 1760 w 1761 ); 1762 }; 1763 })(jQuery), 1764 (function (e) { 1765 var t = e.mapster, 1766 a = t.utils, 1767 n = t.MapArea.prototype; 1768 (t.utils.getScaleInfo = function (e, t) { 1769 var a; 1770 return ( 1771 t ? ((a = e.width / t.width || e.height / t.height), a > 0.98 && 1.02 > a && (a = 1)) : ((a = 1), (t = e)), 1772 { scale: 1 !== a, scalePct: a, realWidth: t.width, realHeight: t.height, width: e.width, height: e.height, ratio: e.width / e.height } 1773 ); 1774 }), 1775 (t.utils.scaleMap = function (e, t, n) { 1776 var i = a.size(e), 1777 o = a.size(t, !0); 1778 if (!o.complete()) throw "Another script, such as an extension, appears to be interfer
1778ing with image loading. Please let us know about this."; 1779 return i.complete() || (i = o), this.getScaleInfo(i, n ? o : null); 1780 }), 1781 (t.MapData.prototype.resize = function (n, i, o, r) { 1782 function s(a, n, i) { 1783 t.hasCanvas() ? ((a.width = n), (a.height = i)) : (e(a).width(n), e(a).height(i)); 1784 } 1785 function c() { 1786 (v.currentAction = ""), e.isFunction(r) && r(), v.processCommandQueue(); 1787 } 1788 function l() { 1789 if ((s(v.overlay_canvas, n, i), m >= 0)) { 1790 var e = v.data[m]; 1791 (e.tempOptions = { fade: !1 }), v.getDataForKey(e.key).highlight(), (e.tempOptions = null); 1792 } 1793 s(v.base_canvas, n, i), v.redrawSelections(), c(); 1794 } 1795 function u() { 1796 e(v.image).css(f), 1797 (v.scaleInfo = a.getScaleInfo({ width: n, height: i }, { width: v.scaleInfo.realWidth, height: v.scaleInfo.realHeight })), 1798 e.each(v.data, function (t, a) { 1799 e.each(a.areas(), function (e, t) { 1800 t.resize(); 1801 }); 1802 }); 1803 } 1804 var h, 1805 p, 1806 f, 1807 d, 1808 m, 1809 g, 1810 v = this; 1811 (r = r || o), 1812 (v.scaleInfo.width === n && v.scaleInfo.height === i) || 1813 ((m = v.highlightId), 1814 n || ((g = i / v.scaleInfo.realHeight), (n = Math.round(v.scaleInfo.realWidth * g))), 1815 i || ((g = n / v.scaleInfo.realWidth), (i = Math.round(v.scaleInfo.realHeight * g))), 1816 (f = { width: String(n) + "px", height: String(i) + "px" }), 1817 t.hasCanvas() || e(v.base_canvas).children().remove(), 1818 (d = e(v.wrapper).find(".mapster_el").add(v.wrapper)), 1819 o 1820 ? ((p = []), 1821 (v.currentAction = "resizing"), 1822 d.each(function (t, n) { 1823 (h = a.defer()), p.push(h), e(n).animate(f, { duration: o, complete: h.resolve, easing: "linear" }); 1824 }), 1825 (h = a.defer()), 1826 p.push(h), 1827 a.when.all(p).then(l), 1828 u(), 1829 h.resolve()) 1830 : (d.css(f), u(), l())); 1831 }), 1832 (t.MapArea = a.subclass(t.MapArea, function () { 1833 this.base.init(), this.owner.scaleInfo.scale && this.resize(); 1834 })), 1835 (n.coords = function (e, t) { 1836 var a, 1837 n = [], 1838 i = e || this.owner.scaleInfo.scalePct, 1839 o = t || 0; 1840 if (1 === i && 0 === t) return this.originalCoords; 1841 for (a = 0; a < this.length; a++) n.push(Math.round(this.originalCoords[a] * i) + o); 1842 return n; 1843 }), 1844 (n.resize = function () { 1845 this.area.coords = this.coords().join(","); 1846 }), 1847 (n.reset = function () { 1848 this.area.coords = this.coords(1).join(","); 1849 }), 1850 (t.impl.resize = function (e, a, n, i) { 1851 if (!e && !a) return !1; 1852 var o = new t.Method( 1853 this, 1854 function () { 1855 this.resize(e, a, n, i); 1856 }, 1857 null, 1858 { name: "resize", args: arguments } 1859 ).go(); 1860 return o; 1861 }); 1862 })(jQuery), 1863 (function (e) { 1864 function t(t, a, n) { 1865 var i; 1866 return ( 1867 a ? ((i = "string" == typeof a ? e(a) : e(a).clone()), i.append(t)) : (i = e(t)), 1868 i.css(e.extend(n || {}, { display: "block", position: "absolute" })).hide(), 1869 e("body").append(i), 1870 i.attr("data-opacity", i.css("opacity")).css("opacity", 0), 1871 i.show() 1872 ); 1873 } 1874 function a(e, t) { 1875 var a = { left: t.left + "px", top: t.top + "px" }, 1876 n = e.attr("data-opacity") || 0, 1877 i = e.css("z-index"); 1878 (0 !== parseInt(i, 10) && "auto" !== i) || (a["z-index"] = 9999), e.css(a).addClass("mapster_tooltip"), t.fadeDuration && t.fadeDuration > 0 ? s.fader(e[0], 0, n, t.fadeDuration) : s.setOpacity(e[0], n); 1879 } 1880 function n(t, a, n, i, o, r) { 1881 var s = n + ".mapster-tooltip"; 1882 return e.inArray(a, t) >= 0 1883 ? (i.unbind(s).bind(s, function (e) { 1884 (o && !o.call(this, e)) || (i.unbind(".mapster-tooltip"), r && r.call(this)); 1885 }), 1886 { object: i, event: s }) 1887 : void 0; 1888 } 1889 function i(e, t, n, i, o) { 1890 var r, 1891 c = {}; 1892 return ( 1893 (o = o || {}), 1894 t ? ((r = s.areaCorners(t, n, i, e.outerWidth(!0), e.outerHeight(!0))), (c.left = r[0]), (c.top = r[1])) : ((c.left = o.left), (c.top = o.top)), 1895 (c.left += o.offsetx || 0), 1896 (c.top += o.offsety || 0), 1897 (c.css = o.css), 1898 (c.fadeDuration = o.fadeDuration), 1899 a(e, c), 1900 e 1901 ); 1902 } 1903 function o(e) { 1904 return e ? ("string" == typeof e || e.jquery ? e : e.content) : null; 1905 } 1906 var r = e.mapster, 1907 s = r.utils; 1908 e.extend(r.defaults, { 1909 toolTipContainer: 1910 '<div style="border: 2px solid black; background: #EEEEEE; width:160px; padding:4px; margin: 4px; -moz-box-shadow: 3px 3px 5px #535353; -webkit-box-shadow: 3px 3px 5px #535353; box-shadow: 3px 3px 5px #535353; -moz-border-radius: 6px 6px 6px 6px; -webkit-border-radius: 6px; border-radius: 6px 6px 6px 6px; opacity: 0.9;"></div>', 1911 showToolTip: !1, 1912 toolTipFade: !0,
1913 toolTipClose: ["area-mouseout", "image-mouseout"], 1914 onShowToolTip: null, 1915 onHideToolTip: null, 1916 }), 1917 e.extend(r.area_defaults, { toolTip: null, toolTipClose: null }), 1918 (r.MapData.prototype.clearToolTip = function () { 1919 this.activeToolTip && (this.activeToolTip.stop().remove(), (this.activeToolTip = null), (this.activeToolTipID = null), s.ifFunction(this.options.onHideToolTip, this)); 1920 }), 1921 (r.AreaData.prototype.showToolTip = function (a, o) { 1922 var r, 1923 c, 1924 l, 1925 u, 1926 h, 1927 p = {}, 1928 f = this, 1929 d = f.owner, 1930 m = f.effectiveOptions(); 1931 return ( 1932 (o = o ? e.extend({}, o) : {}), 1933 (a = a || m.toolTip), 1934 (c = o.closeEvents || m.toolTipClose || d.options.toolTipClose || "tooltip-click"), 1935 (h = "undefined" != typeof o.template ? o.template : d.options.toolTipContainer), 1936 (o.closeEvents = "string" == typeof c ? (c = s.split(c)) : c), 1937 (o.fadeDuration = o.fadeDuration || (d.options.toolTipFade ? d.options.fadeDuration || m.fadeDuration : 0)), 1938 (l = f.area 1939 ? f.area 1940 : e.map(f.areas(), function (e) { 1941 return e.area; 1942 })), 1943 d.activeToolTipID !== f.areaId 1944 ? (d.clearToolTip(), 1945 (d.activeToolTip = r = t(a, h, o.css)), 1946 (d.activeToolTipID = f.areaId), 1947 (u = function () { 1948 d.clearToolTip(); 1949 }), 1950 n(c, "area-click", "click", e(d.map), null, u), 1951 n(c, "tooltip-click", "click", r, null, u), 1952 n( 1953 c, 1954 "image-mouseout", 1955 "mouseout", 1956 e(d.image), 1957 function (e) { 1958 return e.relatedTarget && "AREA" !== e.relatedTarget.nodeName && e.relatedTarget !== f.area; 1959 }, 1960 u 1961 ), 1962 i(r, l, d.image, o.container, h, o), 1963 s.ifFunction(d.options.onShowToolTip, f.area, { toolTip: r, options: p, areaOptions: m, key: f.key, selected: f.isSelected() }), 1964 r) 1965 : void 0 1966 ); 1967 }), 1968 (r.impl.tooltip = function (a, s) { 1969 return new r.Method( 1970 this, 1971 function () { 1972 var r, 1973 c, 1974 l = this; 1975 if (a) { 1976 if (((c = e(a)), l.activeToolTipID === c[0])) return; 1977 l.clearToolTip(), 1978 (l.activeToolTip = r = t(o(s), s.template || l.options.toolTipContainer, s.css)), 1979 (l.activeToolTipID = c[0]), 1980 n(["tooltip-click"], "tooltip-click", "click", r, null, function () { 1981 l.clearToolTip(); 1982 }), 1983 (l.activeToolTip = r = i(r, c, l.image, s.container, s)); 1984 } else l.clearToolTip(); 1985 }, 1986 function () { 1987 e.isPlainObject(a) && !s && (s = a), this.showToolTip(o(s), s); 1988 }, 1989 { name: "tooltip", args: arguments, key: a } 1990 ).go(); 1991 }); 1992 })(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.