# HG changeset patch # User Thierry Florac # Date 1541773333 -3600 # Node ID 82860da48dbb8c2dcdd6c864c28254b7700494e8 # Parent e202798d3732115821be8f2583a39a1d6545d19e Improved TinyMCE editor plug-in used to insert internal links diff -r e202798d3732 -r 82860da48dbb src/pyams_content/zmi/resources/js/jquery-canvasAreaDraw.min.js --- a/src/pyams_content/zmi/resources/js/jquery-canvasAreaDraw.min.js Fri Nov 09 10:41:05 2018 +0100 +++ b/src/pyams_content/zmi/resources/js/jquery-canvasAreaDraw.min.js Fri Nov 09 15:22:13 2018 +0100 @@ -1,1 +1,1 @@ -(function(b){b.fn.canvasAreaDraw=function(d){this.each(function(e,f){c.apply(f,[e,f,d])})};var c=function(i,o,h){var u,g,x;var p,j,s,q;var l,t,m,r,d,z,y,w,f;var e;var k=false;x=b.extend({imageUrl:b(this).attr("data-image-url")},h);var n=b(o).val().replace(/[^0-9\,]/ig,"");if(n.length){u=n.split(",").map(function(v){return parseInt(v,10)})}else{u=[]}p=b('');j=b("");s=j[0].getContext("2d");q=new Image();z=function(){j.attr("height",q.height).attr("width",q.width);l()};b(q).load(z);q.src=x.imageUrl;if(q.loaded){z()}j.css({background:"url("+q.src+")"});if(o.type!=="hidden"){b(o).after("
")}b(o).after(j,"
",p);y=function(){u=[];l()};r=function(v){if(!v.offsetX){v.offsetX=(v.pageX-b(v.target).offset().left);v.offsetY=(v.pageY-b(v.target).offset().top)}u[g]=Math.round(v.offsetX);u[g+1]=Math.round(v.offsetY);l()};d=function(B){if(!B.offsetX){B.offsetX=(B.pageX-b(B.target).offset().left);B.offsetY=(B.pageY-b(B.target).offset().top)}if(!k){k={x:Math.round(B.offsetX),y:Math.round(B.offsetY)}}var v={x:Math.round(B.offsetX),y:Math.round(B.offsetY)};for(var A=0;A=6){var F=getCenter();s.fillRect(F.x-4,F.y-4,8,8);A=Math.sqrt(Math.pow(v-F.x,2)+Math.pow(G-F.y,2));if(A<6){k=false;b(this).on("mousemove",d);return false}}for(var B=0;B1){D=a(v,G,u[B],u[B+1],u[B-2],u[B-1],true);if(D<6){C=B}}}u.splice(C,0,Math.round(v),Math.round(G));g=C;b(this).on("mousemove",r);l();f();return false};l=function(){s.canvas.width=s.canvas.width;f();if(u.length<2){return}s.globalCompositeOperation="destination-over";s.fillStyle="rgb(255,255,255)";s.strokeStyle="rgb(255,20,20)";s.lineWidth=1;if(u.length>=6){var A=getCenter();s.fillRect(A.x-4,A.y-4,8,8)}s.beginPath();s.moveTo(u[0],u[1]);for(var v=0;v2&&v>1){s.lineTo(u[v],u[v+1])}}s.closePath();s.fillStyle="rgba(255,0,0,0.3)";s.fill();s.stroke()};f=function(){b(o).val(u.join(","))};getCenter=function(){var E=[];for(A=0;A=Math.min(g,e)&&f.x<=Math.max(g,e)&&f.y>=Math.min(q,n)&&f.y<=Math.max(q,n))){var i=d(p,l,g,q),h=d(p,l,e,n);return i>h?h:i}else{var m=q-n,k=e-g,j=g*n-q*e;return Math.abs(m*p+k*l+j)/Math.sqrt(m*m+k*k)}}})(jQuery); \ No newline at end of file +!function(t){t.fn.canvasAreaDraw=function(t){this.each(function(n,f){e.apply(f,[n,f,t])})};var e=function(e,f,a){var o,r,i,s,u,h,l,c,g,p,d,v,m,y,x,M,X=!1;i=t.extend({imageUrl:t(this).attr("data-image-url")},a);var w=t(f).val().replace(/[^0-9\,]/gi,"");o=w.length?w.split(",").map(function(t){return parseInt(t,10)}):[],s=t(''),u=t(""),h=u[0].getContext("2d"),l=new Image,m=function(){u.attr("height",l.height).attr("width",l.width),c()},t(l).load(m),l.src=i.imageUrl,l.loaded&&m(),u.css({background:"url("+l.src+")"}),"hidden"!==f.type&&t(f).after("
"),t(f).after(u,"
",s),y=function(){o=[],c()},d=function(e){e.offsetX||(e.offsetX=e.pageX-t(e.target).offset().left,e.offsetY=e.pageY-t(e.target).offset().top),o[r]=Math.round(e.offsetX),o[r+1]=Math.round(e.offsetY),c()},v=function(e){e.offsetX||(e.offsetX=e.pageX-t(e.target).offset().left,e.offsetY=e.pageY-t(e.target).offset().top),X||(X={x:Math.round(e.offsetX),y:Math.round(e.offsetY)});for(var n={x:Math.round(e.offsetX),y:Math.round(e.offsetY)},f=0;f=6){var s=getCenter();if(h.fillRect(s.x-4,s.y-4,8,8),Math.sqrt(Math.pow(f-s.x,2)+Math.pow(a-s.y,2))<6)return X=!1,t(this).on("mousemove",v),!1}for(u=0;u1&&n(f,a,o[u],o[u+1],o[u-2],o[u-1],!0)<6&&(i=u);return o.splice(i,0,Math.round(f),Math.round(a)),r=i,t(this).on("mousemove",d),c(),M(),!1},c=function(){if(h.canvas.width=h.canvas.width,M(),!(o.length<2)){if(h.globalCompositeOperation="destination-over",h.fillStyle="rgb(255,255,255)",h.strokeStyle="rgb(255,20,20)",h.lineWidth=1,o.length>=6){var t=getCenter();h.fillRect(t.x-4,t.y-4,8,8)}h.beginPath(),h.moveTo(o[0],o[1]);for(var e=0;e2&&e>1&&h.lineTo(o[e],o[e+1]);h.closePath(),h.fillStyle="rgba(255,0,0,0.3)",h.fill(),h.stroke()}},M=function(){t(f).val(o.join(","))},getCenter=function(){var t=[];for(l=0;l=Math.min(n,a)&&r.x<=Math.max(n,a)&&r.y>=Math.min(f,o)&&r.y<=Math.max(f,o)){var s=f-o,u=a-n,h=n*o-f*a;return Math.abs(s*t+u*e+h)/Math.sqrt(s*s+u*u)}var l=i(t,e,n,f),c=i(t,e,a,o);return l>c?c:l}}(jQuery); diff -r e202798d3732 -r 82860da48dbb src/pyams_content/zmi/resources/js/jquery-imagemapster-1.2.10.min.js --- a/src/pyams_content/zmi/resources/js/jquery-imagemapster-1.2.10.min.js Fri Nov 09 10:41:05 2018 +0100 +++ b/src/pyams_content/zmi/resources/js/jquery-imagemapster-1.2.10.min.js Fri Nov 09 15:22:13 2018 +0100 @@ -1,1 +1,1 @@ -(function(a){a(function(){var d,j,u,c;k.defer=f;k.reject=i;k.isPromise=q;k.all=e;k.some=o;k.any=p;k.map=x;k.reduce=n;k.chain=s;d=Object.freeze||function(y){return y};function g(){}g.prototype=d({always:function(y,z){return this.then(y,y,z)},otherwise:function(y){return this.then(c,y)}});function t(y){var z=new g();z.then=function(C){var A;try{if(C){A=C(y)}return r(A===c?y:A)}catch(B){return w(B)}};return d(z)}function w(z){var y=new g();y.then=function(D,A){var B;try{if(A){B=A(z);return r(B===c?z:B)}return w(z)}catch(C){return w(C)}};return d(y)}function i(y){return k(y,function(z){return w(z)})}function f(){var H,J,F,D,B,z,A;F=[];D=[];B=function E(N,L,M){var K=f();F.push(function(O){O.then(N,L).then(K.resolve,K.reject,K.progress)});M&&D.push(M);return K.promise};function C(M,K,L){return B(M,K,L)}function G(K){A(t(K))}function I(K){A(w(K))}z=function(M){var K,L=0;while(K=D[L++]){K(M)}};function y(K){z(K)}A=function(L){var N,K=0;B=L.then;A=z=function M(){throw new Error("already completed")};D=c;while(N=F[K++]){N(L)}F=[]};H={};J=new g();J.then=H.then=C;H.promise=d(J);H.resolver=d({resolve:(H.resolve=G),reject:(H.reject=I),progress:(H.progress=y)});return H}function q(y){return y&&typeof y.then==="function"}function k(A,C,B,z){var y=r(A);return y.then(C,B,z)}function r(y){var A,z;if(y instanceof g){A=y}else{z=f();if(q(y)){y.then(z.resolve,z.reject,z.progress);A=z.promise}else{z.resolve(y);A=z.promise}}return A}function o(B,A,C,z,y){m(2,arguments);return k(B,function(H){var M,J,L,P,F,G,O,K,I;K=H.length>>>0;M=Math.max(0,Math.min(A,K));J=[];P=f();L=k(P,C,z,y);function N(R){F(R)}function Q(R){G(R)}function D(R){O(R)}function E(){F=G=O=h}if(!M){P.resolve(J)}else{F=function(R){J.push(R);if(!--M){E();P.resolve(J)}};G=function(R){E();P.reject(R)};O=P.progress;for(I=0;I>>0;A=new Array(y);for(z=0;z2){z.push(y)}return j.apply(C,z)}function s(y,B,A){var z=arguments.length>2;return k(y,function(C){if(z){C=A}B.resolve(C);return C},function(C){B.reject(C);return w(C)},B.progress)}function m(B,A){var y,z=A.length;while(z>B){y=A[--z];if(y!=null&&typeof y!="function"){throw new Error("callback is not a function")}}}function h(){}u=[].slice;j=[].reduce||function(D){var z,B,A,y,C;C=0;z=Object(this);y=z.length>>>0;B=arguments;if(B.length<=1){for(;;){if(C in z){A=z[C++];break}if(++C>=y){throw new TypeError()}}}else{A=B[1]}for(;C=0){var p=src[prop];if($.isPlainObject(p)){target[prop]=$.extend(target[prop]||{},p)}else{if(p&&p.constructor===Array){target[prop]=p.slice(0)}else{if(typeof p!=="undefined"){target[prop]=src[prop]}}}}})});return target},isElement:function(o){return(typeof HTMLElement==="object"?o instanceof HTMLElement:o&&typeof o==="object"&&o.nodeType===1&&typeof o.nodeName==="string")},indexOfProp:function(obj,prop,val){var result=obj.constructor===Array?-1:null;$.each(obj,function(i,e){if(e&&(prop?e[prop]:e)===val){result=i;return false}});return result},boolOrDefault:function(obj,def){return this.isBool(obj)?obj:def||false},isBool:function(obj){return typeof obj==="boolean"},isUndef:function(obj){return typeof obj==="undefined"},ifFunction:function(obj,that,args){if($.isFunction(obj)){obj.call(that,args)}},size:function(image,raw){var u=$.mapster.utils;return{width:raw?(image.width||image.naturalWidth):u.imgWidth(image,true),height:raw?(image.height||image.naturalHeight):u.imgHeight(image,true),complete:function(){return !!this.height&&!!this.width}}},setOpacity:function(el,opacity){if($.mapster.hasCanvas()){el.style.opacity=opacity}else{$(el).each(function(i,e){if(typeof e.opacity!=="undefined"){e.opacity=opacity}else{$(e).css("opacity",opacity)}})}},fader:(function(){var elements={},lastKey=0,fade_func=function(el,op,endOp,duration){var index,cbIntervals=duration/15,obj,u=$.mapster.utils;if(typeof el==="number"){obj=elements[el];if(!obj){return}}else{index=u.indexOfProp(elements,null,el);if(index){delete elements[index]}elements[++lastKey]=obj=el;el=lastKey}endOp=endOp||1;op=(op+(endOp/cbIntervals)>endOp-0.01)?endOp:op+(endOp/cbIntervals);u.setOpacity(obj,op);if(op=0){return index>=0?this.map_cache[index]:null}},queueCommand:function(map_data,that,command,args){if(!map_data){return false}if(!map_data.complete||map_data.currentAction){map_data.commands.push({that:that,command:command,args:args});return true}return false},unload:function(){this.impl.unload();this.utils=null;this.impl=null;$.fn.mapster=null;$.mapster=null;$("*").unbind()}};var m=$.mapster,u=m.utils,ap=Array.prototype;$.each(["width","height"],function(i,e){var capProp=e.substr(0,1).toUpperCase()+e.substr(1);u["img"+capProp]=function(img,jqwidth){return(jqwidth?$(img)[e]():0)||img[e]||img["natural"+capProp]||img["client"+capProp]||img["offset"+capProp]}});m.Method=function(that,func_map,func_area,opts){var me=this;me.name=opts.name;me.output=that;me.input=that;me.first=opts.first||false;me.args=opts.args?ap.slice.call(opts.args,0):[];me.key=opts.key;me.func_map=func_map;me.func_area=func_area;me.name=opts.name;me.allowAsync=opts.allowAsync||false};m.Method.prototype={constructor:m.Method,go:function(){var i,data,ar,len,result,src=this.input,area_list=[],me=this;len=src.length;for(i=0;i=this.index;i--){m.map_cache[i].index--}};function hasVml(){var a=$("
").appendTo("body");a.html('');var b=a[0].firstChild;b.style.behavior="url(#default#VML)";var has=b?typeof b.adj==="object":true;a.remove();return has}function namespaces(){return typeof(document.namespaces)==="object"?document.namespaces:null}function hasCanvas(){var d=namespaces();return d&&d.g_vml_?false:$("")[0].getContext?true:false}function merge_areas(map_data,areas){var ar,index,map_areas=map_data.options.areas;if(areas){$.each(areas,function(i,e){if(!e||!e.key){return}index=u.indexOfProp(map_areas,"key",e.key);if(index>=0){$.extend(map_areas[index],e)}else{map_areas.push(e)}ar=map_data.getDataForKey(e.key);if(ar){$.extend(ar.options,e)}})}}function merge_options(map_data,options){var temp_opts=u.updateProps({},options);delete temp_opts.areas;u.updateProps(map_data.options,temp_opts);merge_areas(map_data,options.areas);u.updateProps(map_data.area_options,map_data.options)}me.get=function(key){var md=m.getMapData(this);if(!(md&&md.complete)){throw ("Can't access data until binding complete.")}return(new m.Method(this,function(){return this.getSelected()},function(){return this.isSelected()},{name:"get",args:arguments,key:key,first:true,allowAsync:true,defaultReturn:""})).go()};me.data=function(key){return(new m.Method(this,null,function(){return this},{name:"data",args:arguments,key:key})).go()};me.highlight=function(key){return(new m.Method(this,function(){if(key===false){this.ensureNoHighlight()}else{var id=this.highlightId;return id>=0?this.data[id].key:null}},function(){this.highlight()},{name:"highlight",args:arguments,key:key,first:true})).go()};me.keys=function(key,all){var keyList=[],md=m.getMapData(this);if(!(md&&md.complete)){throw ("Can't access data until binding complete.")}function addUniqueKeys(ad){var areas,keys=[];if(!all){keys.push(ad.key)}else{areas=ad.areas();$.each(areas,function(i,e){keys=keys.concat(e.keys)})}$.each(keys,function(i,e){if($.inArray(e,keyList)<0){keyList.push(e)}})}if(!(md&&md.complete)){return""}if(typeof key==="string"){if(all){addUniqueKeys(md.getDataForKey(key))}else{keyList=[md.getKeysForGroup(key)]}}else{all=key;this.each(function(i,e){if(e.nodeName==="AREA"){addUniqueKeys(md.getDataForArea(e))}})}return keyList.join(",")};me.select=function(){me.set.call(this,true)};me.deselect=function(){me.set.call(this,false)};me.set=function(selected,key,options){var lastMap,map_data,opts=options,key_list,area_list;function setSelection(ar){if(ar){switch(selected){case true:ar.select(opts);break;case false:ar.deselect(true);break;default:ar.toggle(opts);break}}}function addArea(ar){if(ar&&$.inArray(ar,area_list)<0){area_list.push(ar);key_list+=(key_list===""?"":",")+ar.key}}function finishSetForMap(map_data){$.each(area_list,function(i,el){setSelection(el)});if(!selected){map_data.removeSelectionFinish()}if(map_data.options.boundList){m.setBoundListProperties(map_data.options,m.getBoundList(map_data.options,key_list),selected)}}this.filter("img,area").each(function(i,e){var keys;map_data=m.getMapData(e);if(map_data!==lastMap){if(lastMap){finishSetForMap(lastMap)}area_list=[];key_list=""}if(map_data){keys="";if(e.nodeName.toUpperCase()==="IMG"){if(!m.queueCommand(map_data,$(e),"set",[selected,key,opts])){if(key instanceof Array){if(key.length){keys=key.join(",")}}else{keys=key}if(keys){$.each(u.split(keys),function(i,key){addArea(map_data.getDataForKey(key.toString()));lastMap=map_data})}}}else{opts=key;if(!m.queueCommand(map_data,$(e),"set",[selected,opts])){addArea(map_data.getDataForArea(e));lastMap=map_data}}}});if(map_data){finishSetForMap(map_data)}return this};me.unbind=function(preserveState){return(new m.Method(this,function(){this.clearEvents();this.clearMapData(preserveState);removeMap(this)},null,{name:"unbind",args:arguments})).go()};me.rebind=function(options){return(new m.Method(this,function(){var me=this;me.complete=false;me.configureOptions(options);me.bindImages().then(function(){me.buildDataset(true);me.complete=true})},null,{name:"rebind",args:arguments})).go()};me.get_options=function(key,effective){var eff=u.isBool(key)?key:effective;return(new m.Method(this,function(){var opts=$.extend({},this.options);if(eff){opts.render_select=u.updateProps({},m.render_defaults,opts,opts.render_select);opts.render_highlight=u.updateProps({},m.render_defaults,opts,opts.render_highlight)}return opts},function(){return eff?this.effectiveOptions():this.options},{name:"get_options",args:arguments,first:true,allowAsync:true,key:key})).go()};me.set_options=function(options){return(new m.Method(this,function(){merge_options(this,options)},null,{name:"set_options",args:arguments})).go()};me.unload=function(){var i;for(i=m.map_cache.length-1;i>=0;i--){if(m.map_cache[i]){me.unbind.call($(m.map_cache[i].image))}}me.graphics=null};me.snapshot=function(){return(new m.Method(this,function(){$.each(this.data,function(i,e){e.selected=false});this.base_canvas=this.graphics.createVisibleCanvas(this);$(this.image).before(this.base_canvas)},null,{name:"snapshot"})).go()};me.state=function(){var md,result=null;$(this).each(function(i,e){if(e.nodeName==="IMG"){md=m.getMapData(e);if(md){result=md.state()}return false}});return result};me.bind=function(options){return this.each(function(i,e){var img,map,usemap,md;img=$(e);md=m.getMapData(e);if(md){me.unbind.apply(img);if(!md.complete){img.bind();return true}md=null}usemap=this.getAttribute("usemap");map=usemap&&$('map[name="'+usemap.substr(1)+'"]');if(!(img.is("img")&&usemap&&map.size()>0)){return true}img.css("border",0);if(!md){md=new m.MapData(this,options);md.index=addMap(md);md.map=map;md.bindImages().then(function(){md.initialize()})}})};me.init=function(useCanvas){var style,shapes;m.hasCanvas=function(){if(!u.isBool(m.hasCanvas.value)){m.hasCanvas.value=u.isBool(useCanvas)?useCanvas:hasCanvas()}return m.hasCanvas.value};m.hasVml=function(){if(!u.isBool(m.hasVml.value)){var d=namespaces();if(d&&!d.v){d.add("v","urn:schemas-microsoft-com:vml");style=document.createStyleSheet();shapes=["shape","rect","oval","circ","fill","stroke","imagedata","group","textbox"];$.each(shapes,function(i,el){style.addRule("v\\:"+el,"behavior: url(#default#VML); antialias:true")})}m.hasVml.value=hasVml()}return m.hasVml.value};m.isTouch=!!document.documentElement.ontouchstart;$.extend(m.defaults,m.render_defaults,m.shared_defaults);$.extend(m.area_defaults,m.render_defaults,m.shared_defaults)};me.test=function(obj){return eval(obj)};return me}());$.mapster.impl.init()}(jQuery));(function(e){var a,d=e.mapster,i=d.utils,g,b;function h(l,n,m){var o=l,p=o.map_data,k=m.isMask;e.each(n.areas(),function(q,r){m.isMask=k||(r.nohref&&p.options.noHrefIsMask);o.addShape(r,m)});m.isMask=k}function c(k){return Math.max(0,Math.min(parseInt(k,16),255))}function f(k,l){return"rgba("+c(k.substr(0,2))+","+c(k.substr(2,2))+","+c(k.substr(4,2))+","+l+")"}d.Graphics=function(l){var k=this;k.active=false;k.canvas=null;k.width=0;k.height=0;k.shapes=[];k.masks=[];k.map_data=l};a=d.Graphics.prototype={constructor:d.Graphics,begin:function(l,k){var m=e(l);this.elementName=k;this.canvas=l;this.width=m.width();this.height=m.height();this.shapes=[];this.masks=[];this.active=true},addShape:function(m,l){var k=l.isMask?this.masks:this.shapes;k.push({mapArea:m,options:l})},createVisibleCanvas:function(k){return e(this.createCanvasFor(k)).addClass("mapster_el").css(d.canvas_style)[0]},addShapeGroup:function(r,n,s){var q=this,o,l,m,p=this.map_data,k=r.effectiveRenderOptions(n);if(s){e.extend(k,s)}if(n==="select"){l="static_"+r.areaId.toString();m=p.base_canvas}else{m=p.overlay_canvas}q.begin(m,l);if(k.includeKeys){o=i.split(k.includeKeys);e.each(o,function(u,v){var t=p.getDataForKey(v.toString());h(q,t,t.effectiveRenderOptions(n))})}h(q,r,k);q.render();if(k.fade){i.fader(d.hasCanvas()?m:e(m).find("._fill").not(".mapster_mask"),0,d.hasCanvas()?1:k.fillOpacity,k.fadeDuration)}}};function j(){}g={renderShape:function(l,m,n){var k,o=m.coords(null,n);switch(m.shape){case"rect":l.rect(o[0],o[1],o[2]-o[0],o[3]-o[1]);break;case"poly":l.moveTo(o[0],o[1]);for(k=2;k')[0]},clearHighlight:function(){var k=this.map_data.overlay_canvas;k.getContext("2d").clearRect(0,0,k.width,k.height)},refreshSelections:function(){var k,l=this.map_data;k=l.base_canvas;l.base_canvas=this.createVisibleCanvas(l);e(l.base_canvas).hide();e(k).before(l.base_canvas);l.redrawSelections();e(l.base_canvas).show();e(k).remove()}};b={renderShape:function(n,v,k){var p=this,t,u,m,l,r,q,s,o=n.coords();r=p.elementName?'name="'+p.elementName+'" ':"";q=k?'class="'+k+'" ':"";l='';u=v.stroke?" strokeweight="+v.strokeWidth+' stroked="t" strokecolor="#'+v.strokeColor+'"':' stroked="f"';t=v.fill?' filled="t"':' filled="f"';switch(n.shape){case"rect":s="'+l+"";break;case"poly":s="'+l+"";break;case"circ":case"circle":s="'+l+"";break}m=e(s);e(p.canvas).append(m);return m},render:function(){var l,k=this;e.each(this.shapes,function(m,n){k.renderShape(n.mapArea,n.options)});if(this.masks.length){e.each(this.masks,function(m,n){l=i.updateProps({},n.options,{fillOpacity:1,fillColor:n.options.fillColorMask});k.renderShape(n.mapArea,l,"mapster_mask")})}this.active=false;return this.canvas},createCanvasFor:function(m){var k=m.scaleInfo.width,l=m.scaleInfo.height;return e('')[0]},clearHighlight:function(){e(this.map_data.overlay_canvas).children().remove()},removeSelections:function(k){if(k>=0){e(this.map_data.base_canvas).find('[name="static_'+k.toString()+'"]').remove()}else{e(this.map_data.base_canvas).children().remove()}}};e.each(["renderShape","addAltImage","render","createCanvasFor","clearHighlight","removeSelections","refreshSelections"],function(k,l){a[l]=(function(m){return function(){a[m]=(d.hasCanvas()?g[m]:b[m])||j;return a[m].apply(this,arguments)}}(l))})}(jQuery));(function(d){var a=d.mapster,b=a.utils,c=[];a.MapImages=function(e){this.owner=e;this.clear()};a.MapImages.prototype={constructor:a.MapImages,slice:function(){return c.slice.apply(this,arguments)},splice:function(){c.slice.apply(this.status,arguments);var e=c.slice.apply(this,arguments);return e},complete:function(){return d.inArray(false,this.status)<0},_add:function(f){var e=c.push.call(this,f)-1;this.status[e]=false;return e},indexOf:function(e){return d.inArray(e,this)},clear:function(){var e=this;if(e.ids&&e.ids.length>0){d.each(e.ids,function(f,g){delete e[g]})}e.ids=[];e.length=0;e.status=[];e.splice(0)},add:function(g,i){var e,h,f=this;if(!g){return}if(typeof g==="string"){h=g;g=f[h];if(typeof g==="object"){return f.indexOf(g)}g=d("").addClass("mapster_el").hide();e=f._add(g[0]);g.bind("load",function(j){f.imageLoaded.call(f,j)}).bind("error",function(j){f.imageLoadError.call(f,j)});g.attr("src",h)}else{e=f._add(d(g)[0])}if(i){if(this[i]){throw (i+" is already used or is not available as an altImage alias.")}f.ids.push(i);f[i]=f[e]}return e},bind:function(g){var h=this,i,e=h.owner.options.configTimeout/200,f=function(){var j;j=h.length;while(j-->0){if(!h.isLoaded(j)){break}}if(h.complete()){h.resolve()}else{if(e-->0){h.imgTimeout=window.setTimeout(function(){f.call(h,true)},50)}else{h.imageLoadError.call(h)}}};i=h.deferred=b.defer();f();return i},resolve:function(){var e=this,f=e.deferred;if(f){e.deferred=null;f.resolve()}},imageLoaded:function(h){var g=this,f=g.indexOf(h.target);if(f>=0){g.status[f]=true;if(d.inArray(false,g.status)<0){g.resolve()}}},imageLoadError:function(g){clearTimeout(this.imgTimeout);this.triesLeft=0;var f=g?"The image "+g.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.";throw f},isLoaded:function(g){var f,h=this,e=h.status;if(e[g]){return true}f=h[g];if(typeof f.complete!=="undefined"){e[g]=f.complete}else{e[g]=!!b.imgWidth(f)}return e[g]}}}(jQuery));(function(h){var d=h.mapster,k=d.utils;function a(m){h.extend(m,{complete:false,map:null,base_canvas:null,overlay_canvas:null,commands:[],data:[],mapAreas:[],_xref:{},highlightId:-1,currentAreaId:-1,_tooltip_events:[],scaleInfo:null,index:-1,activeAreaEvent:null})}function e(m){return[m,m.render_highlight,m.render_select]}function g(o){var n=o.options,m=o.images;if(d.hasCanvas()){h.each(n.altImages||{},function(p,q){m.add(q,p)});h.each([n].concat(n.areas),function(p,q){h.each(e(q),function(r,s){if(s&&s.altImage){s.altImageId=m.add(s.altImage)}})})}o.area_options=k.updateProps({},d.area_defaults,n)}function f(q,o,p,n){n=n||k.when.defer();function m(r){if(q.currentAreaId!==r&&q.highlightId>=0){n.resolve()}}if(q.activeAreaEvent){window.clearTimeout(q.activeAreaEvent);q.activeAreaEvent=0}if(o<0){return}if(p.owner.currentAction||o){q.activeAreaEvent=window.setTimeout((function(){return function(){f(q,0,p,n)}}(p)),o||100)}else{m(p.areaId)}return n}function c(m){if(!d.hasCanvas()){this.blur()}m.preventDefault()}function j(n,o){var p=n.getAllDataForArea(this),m=p.length?p[0]:null;if(!m||m.isNotRendered()||m.owner.currentAction){return}if(n.currentAreaId===m.areaId){return}if(n.highlightId!==m.areaId){n.clearEffects();m.highlight();if(n.options.showToolTip){h.each(p,function(q,r){if(r.effectiveOptions().toolTip){r.showToolTip()}})}}n.currentAreaId=m.areaId;if(h.isFunction(n.options.onMouseover)){n.options.onMouseover.call(this,{e:o,options:m.effectiveOptions(),key:m.key,selected:m.isSelected()})}}function i(p,q){var n,m=p.getDataForArea(this),o=p.options;if(p.currentAreaId<0||!m){return}n=p.getDataForArea(q.relatedTarget);if(n===m){return}p.currentAreaId=-1;m.area=null;f(p,o.mouseoutDelay,m).then(p.clearEffects);if(h.isFunction(o.onMouseout)){o.onMouseout.call(this,{e:q,options:o,key:m.key,selected:m.isSelected()})}}function b(n){var m=n.options;n.ensureNoHighlight();if(m.toolTipClose&&h.inArray("area-mouseout",m.toolTipClose)>=0&&n.activeToolTip){n.clearToolTip()}}function l(w,u){var r,v,o,q,x,s,t=this,p=w.getDataForArea(this),n=w.options;function m(z){var y,A;x=(z.isSelectable()&&(z.isDeselectable()||!z.isSelected()));if(x){q=!z.isSelected()}else{q=z.isSelected()}o=d.getBoundList(n,z.key);if(h.isFunction(n.onClick)){s=n.onClick.call(t,{e:u,listTarget:o,key:z.key,selected:q});if(k.isBool(s)){if(!s){return false}A=h(z.area).attr("href");if(A!=="#"){window.location.href=A;return false}}}if(x){r=z.toggle()}if(n.boundList&&n.boundList.length>0){d.setBoundListProperties(n,o,z.isSelected())}y=z.effectiveOptions();if(y.includeKeys){v=k.split(y.includeKeys);h.each(v,function(C,D){var B=w.getDataForKey(D.toString());if(!B.options.isMask){m(B)}})}}c.call(this,u);if(n.clickNavigate&&p.href){window.location.href=p.href;return}if(p&&!p.owner.currentAction){n=w.options;m(p)}}d.MapData=function(o,m){var n=this;n.image=o;n.images=new d.MapImages(n);n.graphics=new d.Graphics(n);n.imgCssText=o.style.cssText||null;a(n);n.configureOptions(m);n.mouseover=function(p){j.call(this,n,p)};n.mouseout=function(p){i.call(this,n,p)};n.click=function(p){l.call(this,n,p)};n.clearEffects=function(p){b.call(this,n,p)}};d.MapData.prototype={constructor:d.MapData,configureOptions:function(m){this.options=k.updateProps({},d.defaults,m)},bindImages:function(){var n=this,m=n.images;if(m.length>2){m.splice(2)}else{if(m.length===0){m.add(n.image);m.add(n.image.src)}}g(n);return n.images.bind()},isActive:function(){return !this.complete||this.currentAction},state:function(){return{complete:this.complete,resizing:this.currentAction==="resizing",zoomed:this.zoomed,zoomedArea:this.zoomedArea,scaleInfo:this.scaleInfo}},wrapId:function(){return"mapster_wrap_"+this.index},_idFromKey:function(m){return typeof m==="string"&&this._xref.hasOwnProperty(m)?this._xref[m]:-1},getSelected:function(){var m="";h.each(this.data,function(n,o){if(o.isSelected()){m+=(m?",":"")+this.key}});return m},getAllDataForArea:function(s,r){var p,n,m,q=this,o=h(s).filter("area").attr(q.options.mapKey);if(o){m=[];o=k.split(o);for(p=0;p<(r||o.length);p++){n=q.data[q._idFromKey(o[p])];n.area=s.length?s[0]:s;m.push(n)}}return m},getDataForArea:function(n){var m=this.getAllDataForArea(n,1);return m?m[0]||null:null},getDataForKey:function(m){return this.data[this._idFromKey(m)]},getKeysForGroup:function(n){var m=this.getDataForKey(n);return !m?"":m.isPrimary?m.key:this.getPrimaryKeysForMapAreas(m.areas()).join(",")},getPrimaryKeysForMapAreas:function(m){var n=[];h.each(m,function(o,p){if(h.inArray(p.keys[0],n)<0){n.push(p.keys[0])}});return n},getData:function(m){if(typeof m==="string"){return this.getDataForKey(m)}else{if(m&&m.mapster||k.isElement(m)){return this.getDataForArea(m)}else{return null}}},ensureNoHighlight:function(){var m;if(this.highlightId>=0){this.graphics.clearHighlight();m=this.data[this.highlightId];m.changeState("highlight",false);this.setHighlightId(-1)}},setHighlightId:function(m){this.highlightId=m},clearSelections:function(){h.each(this.data,function(m,n){if(n.selected){n.deselect(true)}});this.removeSelectionFinish()},setAreaOptions:function(n){var p,o,m;n=n||[];for(p=n.length-1;p>=0;p--){o=n[p];if(o){m=this.getDataForKey(o.key);if(m){k.updateProps(m.options,o);if(k.isBool(o.selected)){m.selected=o.selected}}}}},drawSelections:function(o){var m,n=k.asArray(o);for(m=n.length-1;m>=0;m--){this.data[n[m]].drawSelection()}},redrawSelections:function(){h.each(this.data,function(m,n){if(n.isSelectedOrStatic()){n.drawSelection()}})},initialize:function(){var y,r,n,p,u,v,t,z,s,o,x,q,w=this,m=w.options;if(w.complete){return}s=h(w.image);u=s.parent().attr("id");if(u&&u.length>=12&&u.substring(0,12)==="mapster_wrap"){p=s.parent();p.attr("id",w.wrapId())}else{p=h('
');if(m.wrapClass){if(m.wrapClass===true){p.addClass(s[0].className)}else{p.addClass(m.wrapClass)}}}w.wrapper=p;w.scaleInfo=q=k.scaleMap(w.images[0],w.images[1],m.scaleMap);w.base_canvas=r=w.graphics.createVisibleCanvas(w);w.overlay_canvas=n=w.graphics.createVisibleCanvas(w);y=h(w.images[1]).addClass("mapster_el "+w.images[0].className).attr({id:null,usemap:null});z=k.size(w.images[0]);if(z.complete){y.css({width:z.width,height:z.height})}w.buildDataset();v={display:"block",position:"relative",padding:0,width:q.width,height:q.height};if(m.wrapCss){h.extend(v,m.wrapCss)}if(s.parent()[0]!==w.wrapper[0]){s.before(w.wrapper)}p.css(v);h(w.images.slice(2)).hide();for(t=1;tA?-1:1)}}else{o=function(B,A){return B===A?0:(B=0;z--){E=t[z];if(s.mapValue){p=m.attr(s.mapValue)}if(v){x=A(D.data.length,p);q=D.data[x];q.key=E=x.toString()}else{x=D._xref[E];if(x>=0){q=D.data[x];if(p&&!D.data[x].value){q.value=p}}else{x=A(E,p);q=D.data[x];q.isPrimary=z===0}}r.areaDataXref.push(x);q.areasXref.push(w)}B=m.attr("href");if(B&&B!=="#"&&!q.href){q.href=B}if(!r.nohref){m.bind("click.mapster",D.click);if(!d.isTouch){m.bind("mouseover.mapster",D.mouseover).bind("mouseout.mapster",D.mouseout).bind("mousedown.mapster",D.mousedown)}}m.data("mapster",w+1)}D.setAreaOptions(s.areas);D.redrawSelections()},processCommandQueue:function(){var n,m=this;while(!m.currentAction&&m.commands.length){n=m.commands[0];m.commands.splice(0,1);d.impl[n.command].apply(n.that,n.args)}},clearEvents:function(){h(this.map).find("area").unbind(".mapster");h(this.images).unbind(".mapster")},_clearCanvases:function(m){if(!m){h(this.base_canvas).remove()}h(this.overlay_canvas).remove()},clearMapData:function(n){var m=this;this._clearCanvases(n);h.each(this.data,function(o,p){p.reset()});this.data=null;if(!n){this.image.style.cssText=this.imgCssText;h(this.wrapper).before(this.image).remove()}m.images.clear();this.image=null;k.ifFunction(this.clearTooltip,this)},removeSelectionFinish:function(){var m=this.graphics;m.refreshSelections();m.clearHighlight()}}}(jQuery));(function(f){var c=f.mapster,d=c.utils;function b(g){var h=this,i=h.owner;if(i.options.singleSelect){i.clearSelections()}if(!h.isSelected()){if(g){h.optsCache=f.extend(h.effectiveRenderOptions("select"),g,{altImageId:i.images.add(g.altImage)})}h.drawSelection();h.selected=true;h.changeState("select",true)}if(i.options.singleSelect){i.graphics.refreshSelections()}}function e(g){var h=this;h.selected=false;h.changeState("select",false);h.optsCache=null;h.owner.graphics.removeSelections(h.areaId);if(!g){h.owner.removeSelectionFinish()}}function a(g){var h=this;if(!h.isSelected()){h.select(g)}else{h.deselect()}return h.isSelected()}c.AreaData=function(g,h,i){f.extend(this,{owner:g,key:h||"",isPrimary:true,areaId:-1,href:"",value:i||"",options:{},selected:null,areasXref:[],area:null,optsCache:null})};c.AreaData.prototype={constuctor:c.AreaData,select:b,deselect:e,toggle:a,areas:function(){var h,g=[];for(h=0;h=0;u-=2){l=x[u];k=x[u+1];if(lC){C=l;v=k}if(kA){A=k;y=l}}if(s&&q){n=false;b.each([[w-s,B-q],[y,B-q],[D-s,t-q],[D-s,v],[C,t-q],[C,v],[w-s,A],[y,A]],function(j,F){if(!n&&(F[0]>h&&F[1]>f)){E=F;n=true;return false}});if(!n){E=[C,A]}}return E}}(jQuery));(function(c){var a=c.mapster,b=a.utils,d=a.MapArea.prototype;a.utils.getScaleInfo=function(e,g){var f;if(!g){f=1;g=e}else{f=e.width/g.width||e.height/g.height;if(f>0.98&&f<1.02){f=1}}return{scale:(f!==1),scalePct:f,realWidth:g.width,realHeight:g.height,width:e.width,height:e.height,ratio:e.width/e.height}};a.utils.scaleMap=function(h,f,i){var g=b.size(h),e=b.size(f,true);if(!e.complete()){throw ("Another script, such as an extension, appears to be interfering with image loading. Please let us know about this.")}if(!g.complete()){g=e}return this.getScaleInfo(g,i?e:null)};a.MapData.prototype.resize=function(g,t,j,s){var f,r,i,k,e,n,o=this;s=s||j;function q(u,p,v){if(a.hasCanvas()){u.width=p;u.height=v}else{c(u).width(p);c(u).height(v)}}function l(){o.currentAction="";if(c.isFunction(s)){s()}o.processCommandQueue()}function m(){q(o.overlay_canvas,g,t);if(e>=0){var p=o.data[e];p.tempOptions={fade:false};o.getDataForKey(p.key).highlight();p.tempOptions=null}q(o.base_canvas,g,t);o.redrawSelections();l()}function h(){c(o.image).css(i);o.scaleInfo=b.getScaleInfo({width:g,height:t},{width:o.scaleInfo.realWidth,height:o.scaleInfo.realHeight});c.each(o.data,function(p,u){c.each(u.areas(),function(v,w){w.resize()})})}if(o.scaleInfo.width===g&&o.scaleInfo.height===t){return}e=o.highlightId;if(!g){n=t/o.scaleInfo.realHeight;g=Math.round(o.scaleInfo.realWidth*n)}if(!t){n=g/o.scaleInfo.realWidth;t=Math.round(o.scaleInfo.realHeight*n)}i={width:String(g)+"px",height:String(t)+"px"};if(!a.hasCanvas()){c(o.base_canvas).children().remove()}k=c(o.wrapper).find(".mapster_el").add(o.wrapper);if(j){r=[];o.currentAction="resizing";k.each(function(p,u){f=b.defer();r.push(f);c(u).animate(i,{duration:j,complete:f.resolve,easing:"linear"})});f=b.defer();r.push(f);b.when.all(r).then(m);h();f.resolve()}else{k.css(i);h();m()}};a.MapArea=b.subclass(a.MapArea,function(){this.base.init();if(this.owner.scaleInfo.scale){this.resize()}});d.coords=function(f,i){var e,h=[],g=f||this.owner.scaleInfo.scalePct,k=i||0;if(g===1&&i===0){return this.originalCoords}for(e=0;e',showToolTip:false,toolTipFade:true,toolTipClose:["area-mouseout","image-mouseout"],onShowToolTip:null,onHideToolTip:null});g.extend(a.area_defaults,{toolTip:null,toolTipClose:null});function e(j,k,i){var l;if(k){l=typeof k==="string"?g(k):g(k).clone();l.append(j)}else{l=g(j)}l.css(g.extend((i||{}),{display:"block",position:"absolute"})).hide();g("body").append(l);l.attr("data-opacity",l.css("opacity")).css("opacity",0);return l.show()}function h(m,k){var i={left:k.left+"px",top:k.top+"px"},j=m.attr("data-opacity")||0,l=m.css("z-index");if(parseInt(l,10)===0||l==="auto"){i["z-index"]=9999}m.css(i).addClass("mapster_tooltip");if(k.fadeDuration&&k.fadeDuration>0){d.fader(m[0],0,j,k.fadeDuration)}else{d.setOpacity(m[0],j)}}a.MapData.prototype.clearToolTip=function(){if(this.activeToolTip){this.activeToolTip.stop().remove();this.activeToolTip=null;this.activeToolTipID=null;d.ifFunction(this.options.onHideToolTip,this)}};function b(k,i,l,o,m,j){var n=l+".mapster-tooltip";if(g.inArray(i,k)>=0){o.unbind(n).bind(n,function(p){if(!m||m.call(this,p)){o.unbind(".mapster-tooltip");if(j){j.call(this)}}});return{object:o,event:n}}}function f(m,o,n,i,k){var j,l={};k=k||{};if(o){j=d.areaCorners(o,n,i,m.outerWidth(true),m.outerHeight(true));l.left=j[0];l.top=j[1]}else{l.left=k.left;l.top=k.top}l.left+=(k.offsetx||0);l.top+=(k.offsety||0);l.css=k.css;l.fadeDuration=k.fadeDuration;h(m,l);return m}a.AreaData.prototype.showToolTip=function(m,s){var r,j,l,n,p,k={},q=this,o=q.owner,i=q.effectiveOptions();s=s?g.extend({},s):{};m=m||i.toolTip;j=s.closeEvents||i.toolTipClose||o.options.toolTipClose||"tooltip-click";p=typeof s.template!=="undefined"?s.template:o.options.toolTipContainer;s.closeEvents=typeof j==="string"?j=d.split(j):j;s.fadeDuration=s.fadeDuration||(o.options.toolTipFade?(o.options.fadeDuration||i.fadeDuration):0);l=q.area?q.area:g.map(q.areas(),function(t){return t.area});if(o.activeToolTipID===q.areaId){return}o.clearToolTip();o.activeToolTip=r=e(m,p,s.css);o.activeToolTipID=q.areaId;n=function(){o.clearToolTip()};b(j,"area-click","click",g(o.map),null,n);b(j,"tooltip-click","click",r,null,n);b(j,"image-mouseout","mouseout",g(o.image),function(t){return(t.relatedTarget&&t.relatedTarget.nodeName!=="AREA"&&t.relatedTarget!==q.area)},n);f(r,l,o.image,s.container,p,s);d.ifFunction(o.options.onShowToolTip,q.area,{toolTip:r,options:k,areaOptions:i,key:q.key,selected:q.isSelected()});return r};function c(i){return(i?((typeof i==="string"||i.jquery)?i:i.content):null)}a.impl.tooltip=function(k,j){return(new a.Method(this,function l(){var n,o,m=this;if(!k){m.clearToolTip()}else{o=g(k);if(m.activeToolTipID===o[0]){return}m.clearToolTip();m.activeToolTip=n=e(c(j),j.template||m.options.toolTipContainer,j.css);m.activeToolTipID=o[0];b(["tooltip-click"],"tooltip-click","click",n,null,function(){m.clearToolTip()});m.activeToolTip=n=f(n,o,m.image,j.container,j)}},function i(){if(g.isPlainObject(k)&&!j){j=k}this.showToolTip(c(j),j)},{name:"tooltip",args:arguments,key:k})).go()}}(jQuery)); \ No newline at end of file +!function(e){e(function(){function e(){}function t(t){var n=new e;return n.then=function(e){var n;try{return e&&(n=e(t)),r(n===g?t:n)}catch(e){return a(e)}},f(n)}function a(t){var n=new e;return n.then=function(e,n){var i;try{return n?(i=n(t),r(i===g?t:i)):a(t)}catch(e){return a(e)}},f(n)}function n(){var i,o,r,s,c,l,u;return r=[],s=[],c=function(e,t,a){var i=n();return r.push(function(a){a.then(e,t).then(i.resolve,i.reject,i.progress)}),a&&s.push(a),i.promise},l=function(e){for(var t,a=0;t=s[a++];)t(e)},u=function(e){var t,a=0;for(c=e.then,u=l=function(){throw new Error("already completed")},s=g;t=r[a++];)t(e);r=[]},i={},o=new e,o.then=i.then=function(e,t,a){return c(e,t,a)},i.promise=f(o),i.resolver=f({resolve:i.resolve=function(e){u(t(e))},reject:i.reject=function(e){u(a(e))},progress:i.progress=function(e){l(e)}}),i}function i(e){return e&&"function"==typeof e.then}function o(e,t,a,n){return r(e).then(t,a,n)}function r(t){var a,o;return t instanceof e?a=t:(o=n(),i(t)?(t.then(o.resolve,o.reject,o.progress),a=o.promise):(o.resolve(t),a=o.promise)),a}function s(e,t,a,i,r){return h(2,arguments),o(e,function(e){function s(){f=d=m=p}var c,l,u,h,f,d,m,g,v;if(g=e.length>>>0,c=Math.max(0,Math.min(t,g)),l=[],h=n(),u=o(h,a,i,r),c)for(f=function(e){l.push(e),--c||(s(),h.resolve(l))},d=function(e){s(),h.reject(e)},m=h.progress,v=0;v>>0,a=new Array(n),i=0;i2&&i.push(a),d.apply(e,i)}function h(e,t){for(var a,n=t.length;n>e;)if(null!=(a=t[--n])&&"function"!=typeof a)throw new Error("callback is not a function")}function p(){}var f,d,m,g;return o.defer=n,o.reject=function(e){return o(e,function(e){return a(e)})},o.isPromise=i,o.all=function(e,t,a,n){return h(1,arguments),o(e,function(e){return u(e,c,[])}).then(t,a,n)},o.some=s,o.any=function(e,t,a,n){return s(e,1,function(e){return t?t(e[0]):e[0]},a,n)},o.map=function(e,t){return o(e,function(e){return l(e,t)})},o.reduce=function(e,t,a){var n=m.call(arguments,1);return o(e,function(e){return u.apply(g,[e].concat(n))})},o.chain=function(e,t,n){var i=arguments.length>2;return o(e,function(e){return i&&(e=n),t.resolve(e),e},function(e){return t.reject(e),a(e)},t.progress)},f=Object.freeze||function(e){return e},e.prototype=f({always:function(e,t){return this.then(e,e,t)},otherwise:function(e){return this.then(g,e)}}),m=[].slice,d=[].reduce||function(e){var t,a,n,i,o;if(o=0,t=Object(this),i=t.length>>>0,(a=arguments).length<=1)for(;;){if(o in t){n=t[o++];break}if(++o>=i)throw new TypeError}else n=a[1];for(;o=0){var i=t[e];$.isPlainObject(i)?n[e]=$.extend(n[e]||{},i):i&&i.constructor===Array?n[e]=i.slice(0):void 0!==i&&(n[e]=t[e])}})}),n},isElement:function(e){return"object"==typeof HTMLElement?e instanceof HTMLElement:e&&"object"==typeof e&&1===e.nodeType&&"string"==typeof e.nodeName},indexOfProp:function(e,t,a){var n=e.constructor===Array?-1:null;return $.each(e,function(e,i){if(i&&(t?i[t]:i)===a)return n=e,!1}),n},boolOrDefault:function(e,t){return this.isBool(e)?e:t||!1},isBool:function(e){return"boolean"==typeof e},isUndef:function(e){return void 0===e},ifFunction:function(e,t,a){$.isFunction(e)&&e.call(t,a)},size:function(e,t){var a=$.mapster.utils;return{width:t?e.width||e.naturalWidth:a.imgWidth(e,!0),height:t?e.height||e.naturalHeight:a.imgHeight(e,!0),complete:function(){return!!this.height&&!!this.width}}},setOpacity:function(e,t){$.mapster.hasCanvas()?e.style.opacity=t:$(e).each(function(e,a){void 0!==a.opacity?a.opacity=t:$(a).css("opacity",t)})},fader:function(){var e={},t=0,a=function(n,i,o,r){var s,c,l=r/15,u=$.mapster.utils;if("number"==typeof n){if(!(c=e[n]))return}else(s=u.indexOfProp(e,null,n))&&delete e[s],e[++t]=c=n,n=t;i=i+(o=o||1)/l>o-.01?o:i+o/l,u.setOpacity(c,i),i=0)return t>=0?this.map_cache[t]:null},queueCommand:function(e,t,a,n){return!!e&&(!(e.complete&&!e.currentAction)&&(e.commands.push({that:t,command:a,args:n}),!0))},unload:function(){this.impl.unload(),this.utils=null,this.impl=null,$.fn.mapster=null,$.mapster=null,$("*").unbind()}};var m=$.mapster,u=m.utils,ap=Array.prototype;$.each(["width","height"],function(e,t){var a=t.substr(0,1).toUpperCase()+t.substr(1);u["img"+a]=function(e,n){return(n?$(e)[t]():0)||e[t]||e["natural"+a]||e["client"+a]||e["offset"+a]}}),m.Method=function(e,t,a,n){var i=this;i.name=n.name,i.output=e,i.input=e,i.first=n.first||!1,i.args=n.args?ap.slice.call(n.args,0):[],i.key=n.key,i.func_map=t,i.func_area=a,i.name=n.name,i.allowAsync=n.allowAsync||!1},m.Method.prototype={constructor:m.Method,go:function(){var e,t,a,n,i,o=this.input,r=[],s=this;for(n=o.length,e=0;e").appendTo("body");e.html('');var t=e[0].firstChild;t.style.behavior="url(#default#VML)";var a=!t||"object"==typeof t.adj;return e.remove(),a}function namespaces(){return"object"==typeof document.namespaces?document.namespaces:null}function hasCanvas(){var e=namespaces();return(!e||!e.g_vml_)&&!!$("")[0].getContext}function merge_areas(e,t){var a,n,i=e.options.areas;t&&$.each(t,function(t,o){o&&o.key&&((n=u.indexOfProp(i,"key",o.key))>=0?$.extend(i[n],o):i.push(o),(a=e.getDataForKey(o.key))&&$.extend(a.options,o))})}function merge_options(e,t){var a=u.updateProps({},t);delete a.areas,u.updateProps(e.options,a),merge_areas(e,t.areas),u.updateProps(e.area_options,e.options)}var me={},addMap=function(e){return m.map_cache.push(e)-1},removeMap=function(e){m.map_cache.splice(e.index,1);for(var t=m.map_cache.length-1;t>=this.index;t--)m.map_cache[t].index--};return me.get=function(e){var t=m.getMapData(this);if(!t||!t.complete)throw"Can't access data until binding complete.";return new m.Method(this,function(){return this.getSelected()},function(){return this.isSelected()},{name:"get",args:arguments,key:e,first:!0,allowAsync:!0,defaultReturn:""}).go()},me.data=function(e){return new m.Method(this,null,function(){return this},{name:"data",args:arguments,key:e}).go()},me.highlight=function(e){return new m.Method(this,function(){if(!1!==e){var t=this.highlightId;return t>=0?this.data[t].key:null}this.ensureNoHighlight()},function(){this.highlight()},{name:"highlight",args:arguments,key:e,first:!0}).go()},me.keys=function(e,t){function a(e){var a,i=[];t?(a=e.areas(),$.each(a,function(e,t){i=i.concat(t.keys)})):i.push(e.key),$.each(i,function(e,t){$.inArray(t,n)<0&&n.push(t)})}var n=[],i=m.getMapData(this);if(!i||!i.complete)throw"Can't access data until binding complete.";return i&&i.complete?("string"==typeof e?t?a(i.getDataForKey(e)):n=[i.getKeysForGroup(e)]:(t=e,this.each(function(e,t){"AREA"===t.nodeName&&a(i.getDataForArea(t))})),n.join(",")):""},me.select=function(){me.set.call(this,!0)},me.deselect=function(){me.set.call(this,!1)},me.set=function(e,t,a){function n(t){if(t)switch(e){case!0:t.select(h);break;case!1:t.deselect(!0);break;default:t.toggle(h)}}function i(e){e&&$.inArray(e,l)<0&&(l.push(e),c+=(""===c?"":",")+e.key)}function o(t){$.each(l,function(e,t){n(t)}),e||t.removeSelectionFinish(),t.options.boundList&&m.setBoundListProperties(t.options,m.getBoundList(t.options,c),e)}var r,s,c,l,h=a;return this.filter("img,area").each(function(a,n){var p;(s=m.getMapData(n))!==r&&(r&&o(r),l=[],c=""),s&&(p="","IMG"===n.nodeName.toUpperCase()?m.queueCommand(s,$(n),"set",[e,t,h])||(t instanceof Array?t.length&&(p=t.join(",")):p=t,p&&$.each(u.split(p),function(e,t){i(s.getDataForKey(t.toString())),r=s})):(h=t,m.queueCommand(s,$(n),"set",[e,h])||(i(s.getDataForArea(n)),r=s)))}),s&&o(s),this},me.unbind=function(e){return new m.Method(this,function(){this.clearEvents(),this.clearMapData(e),removeMap(this)},null,{name:"unbind",args:arguments}).go()},me.rebind=function(e){return new m.Method(this,function(){var t=this;t.complete=!1,t.configureOptions(e),t.bindImages().then(function(){t.buildDataset(!0),t.complete=!0})},null,{name:"rebind",args:arguments}).go()},me.get_options=function(e,t){var a=u.isBool(e)?e:t;return new m.Method(this,function(){var e=$.extend({},this.options);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},function(){return a?this.effectiveOptions():this.options},{name:"get_options",args:arguments,first:!0,allowAsync:!0,key:e}).go()},me.set_options=function(e){return new m.Method(this,function(){merge_options(this,e)},null,{name:"set_options",args:arguments}).go()},me.unload=function(){var e;for(e=m.map_cache.length-1;e>=0;e--)m.map_cache[e]&&me.unbind.call($(m.map_cache[e].image));me.graphics=null},me.snapshot=function(){return new m.Method(this,function(){$.each(this.data,function(e,t){t.selected=!1}),this.base_canvas=this.graphics.createVisibleCanvas(this),$(this.image).before(this.base_canvas)},null,{name:"snapshot"}).go()},me.state=function(){var e,t=null;return $(this).each(function(a,n){if("IMG"===n.nodeName)return(e=m.getMapData(n))&&(t=e.state()),!1}),t},me.bind=function(e){return this.each(function(t,a){var n,i,o,r;if(n=$(a),r=m.getMapData(a)){if(me.unbind.apply(n),!r.complete)return n.bind(),!0;r=null}if(o=this.getAttribute("usemap"),i=o&&$('map[name="'+o.substr(1)+'"]'),!(n.is("img")&&o&&i.size()>0))return!0;n.css("border",0),r||((r=new m.MapData(this,e)).index=addMap(r),r.map=i,r.bindImages().then(function(){r.initialize()}))})},me.init=function(e){var t,a;m.hasCanvas=function(){return u.isBool(m.hasCanvas.value)||(m.hasCanvas.value=u.isBool(e)?e:hasCanvas()),m.hasCanvas.value},m.hasVml=function(){if(!u.isBool(m.hasVml.value)){var e=namespaces();e&&!e.v&&(e.add("v","urn:schemas-microsoft-com:vml"),t=document.createStyleSheet(),a=["shape","rect","oval","circ","fill","stroke","imagedata","group","textbox"],$.each(a,function(e,a){t.addRule("v\\:"+a,"behavior: url(#default#VML); antialias:true")})),m.hasVml.value=hasVml()}return m.hasVml.value},m.isTouch=!!document.documentElement.ontouchstart,$.extend(m.defaults,m.render_defaults,m.shared_defaults),$.extend(m.area_defaults,m.render_defaults,m.shared_defaults)},me.test=function(obj){return eval(obj)},me}(),$.mapster.impl.init()}(jQuery),function(e){function t(t,a,n){var i=t,o=i.map_data,r=n.isMask;e.each(a.areas(),function(e,t){n.isMask=r||t.nohref&&o.options.noHrefIsMask,i.addShape(t,n)}),n.isMask=r}function a(e){return Math.max(0,Math.min(parseInt(e,16),255))}function n(e,t){return"rgba("+a(e.substr(0,2))+","+a(e.substr(2,2))+","+a(e.substr(4,2))+","+t+")"}function i(){}var o,r,s,c=e.mapster,l=c.utils;c.Graphics=function(e){var t=this;t.active=!1,t.canvas=null,t.width=0,t.height=0,t.shapes=[],t.masks=[],t.map_data=e},o=c.Graphics.prototype={constructor:c.Graphics,begin:function(t,a){var n=e(t);this.elementName=a,this.canvas=t,this.width=n.width(),this.height=n.height(),this.shapes=[],this.masks=[],this.active=!0},addShape:function(e,t){(t.isMask?this.masks:this.shapes).push({mapArea:e,options:t})},createVisibleCanvas:function(t){return e(this.createCanvasFor(t)).addClass("mapster_el").css(c.canvas_style)[0]},addShapeGroup:function(a,n,i){var o,r,s,u=this,h=this.map_data,p=a.effectiveRenderOptions(n);i&&e.extend(p,i),"select"===n?(r="static_"+a.areaId.toString(),s=h.base_canvas):s=h.overlay_canvas,u.begin(s,r),p.includeKeys&&(o=l.split(p.includeKeys),e.each(o,function(e,a){var i=h.getDataForKey(a.toString());t(u,i,i.effectiveRenderOptions(n))})),t(u,a,p),u.render(),p.fade&&l.fader(c.hasCanvas()?s:e(s).find("._fill").not(".mapster_mask"),0,c.hasCanvas()?1:p.fillOpacity,p.fadeDuration)}},r={renderShape:function(e,t,a){var n,i=t.coords(null,a);switch(t.shape){case"rect":e.rect(i[0],i[1],i[2]-i[0],i[3]-i[1]);break;case"poly":for(e.moveTo(i[0],i[1]),n=2;n')[0]},clearHighlight:function(){var e=this.map_data.overlay_canvas;e.getContext("2d").clearRect(0,0,e.width,e.height)},refreshSelections:function(){var t,a=this.map_data;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()}},s={renderShape:function(t,a,n){var i,o,r,s,c,l,u,h=this,p=t.coords();switch(c=h.elementName?'name="'+h.elementName+'" ':"",l=n?'class="'+n+'" ':"",s='',o=a.stroke?" strokeweight="+a.strokeWidth+' stroked="t" strokecolor="#'+a.strokeColor+'"':' stroked="f"',i=a.fill?' filled="t"':' filled="f"',t.shape){case"rect":u="'+s+"";break;case"poly":u="'+s+"";break;case"circ":case"circle":u="'+s+""}return r=e(u),e(h.canvas).append(r),r},render:function(){var t,a=this;return e.each(this.shapes,function(e,t){a.renderShape(t.mapArea,t.options)}),this.masks.length&&e.each(this.masks,function(e,n){t=l.updateProps({},n.options,{fillOpacity:1,fillColor:n.options.fillColorMask}),a.renderShape(n.mapArea,t,"mapster_mask")}),this.active=!1,this.canvas},createCanvasFor:function(t){var a=t.scaleInfo.width,n=t.scaleInfo.height;return e('')[0]},clearHighlight:function(){e(this.map_data.overlay_canvas).children().remove()},removeSelections:function(t){t>=0?e(this.map_data.base_canvas).find('[name="static_'+t.toString()+'"]').remove():e(this.map_data.base_canvas).children().remove()}},e.each(["renderShape","addAltImage","render","createCanvasFor","clearHighlight","removeSelections","refreshSelections"],function(e,t){o[t]=function(e){return function(){return o[e]=(c.hasCanvas()?r[e]:s[e])||i,o[e].apply(this,arguments)}}(t)})}(jQuery),function(e){var t=e.mapster,a=t.utils,n=[];t.MapImages=function(e){this.owner=e,this.clear()},t.MapImages.prototype={constructor:t.MapImages,slice:function(){return n.slice.apply(this,arguments)},splice:function(){return n.slice.apply(this.status,arguments),n.slice.apply(this,arguments)},complete:function(){return e.inArray(!1,this.status)<0},_add:function(e){var t=n.push.call(this,e)-1;return this.status[t]=!1,t},indexOf:function(t){return e.inArray(t,this)},clear:function(){var t=this;t.ids&&t.ids.length>0&&e.each(t.ids,function(e,a){delete t[a]}),t.ids=[],t.length=0,t.status=[],t.splice(0)},add:function(t,a){var n,i,o=this;if(t){if("string"==typeof t){if(i=t,"object"==typeof(t=o[i]))return o.indexOf(t);t=e("").addClass("mapster_el").hide(),n=o._add(t[0]),t.bind("load",function(e){o.imageLoaded.call(o,e)}).bind("error",function(e){o.imageLoadError.call(o,e)}),t.attr("src",i)}else n=o._add(e(t)[0]);if(a){if(this[a])throw a+" is already used or is not available as an altImage alias.";o.ids.push(a),o[a]=o[n]}return n}},bind:function(e){var t,n=this,i=n.owner.options.configTimeout/200,o=function(){var e;for(e=n.length;e-- >0&&n.isLoaded(e););n.complete()?n.resolve():i-- >0?n.imgTimeout=window.setTimeout(function(){o.call(n,!0)},50):n.imageLoadError.call(n)};return t=n.deferred=a.defer(),o(),t},resolve:function(){var e=this,t=e.deferred;t&&(e.deferred=null,t.resolve())},imageLoaded:function(t){var a=this,n=a.indexOf(t.target);n>=0&&(a.status[n]=!0,e.inArray(!1,a.status)<0&&a.resolve())},imageLoadError:function(e){throw clearTimeout(this.imgTimeout),this.triesLeft=0,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."},isLoaded:function(e){var t,n=this,i=n.status;return!!i[e]||(void 0!==(t=n[e]).complete?i[e]=t.complete:i[e]=!!a.imgWidth(t),i[e])}}}(jQuery),function(e){function t(t){e.extend(t,{complete:!1,map:null,base_canvas:null,overlay_canvas:null,commands:[],data:[],mapAreas:[],_xref:{},highlightId:-1,currentAreaId:-1,_tooltip_events:[],scaleInfo:null,index:-1,activeAreaEvent:null})}function a(e){return[e,e.render_highlight,e.render_select]}function n(t){var n=t.options,i=t.images;u.hasCanvas()&&(e.each(n.altImages||{},function(e,t){i.add(t,e)}),e.each([n].concat(n.areas),function(t,n){e.each(a(n),function(e,t){t&&t.altImage&&(t.altImageId=i.add(t.altImage))})})),t.area_options=h.updateProps({},u.area_defaults,n)}function i(e,t,a,n){if(n=n||h.when.defer(),e.activeAreaEvent&&(window.clearTimeout(e.activeAreaEvent),e.activeAreaEvent=0),!(t<0))return a.owner.currentAction||t?e.activeAreaEvent=window.setTimeout(function(){i(e,0,a,n)},t||100):function(t){e.currentAreaId!==t&&e.highlightId>=0&&n.resolve()}(a.areaId),n}function o(e){u.hasCanvas()||this.blur(),e.preventDefault()}function r(t,a){var n=t.getAllDataForArea(this),i=n.length?n[0]:null;!i||i.isNotRendered()||i.owner.currentAction||t.currentAreaId!==i.areaId&&(t.highlightId!==i.areaId&&(t.clearEffects(),i.highlight(),t.options.showToolTip&&e.each(n,function(e,t){t.effectiveOptions().toolTip&&t.showToolTip()})),t.currentAreaId=i.areaId,e.isFunction(t.options.onMouseover)&&t.options.onMouseover.call(this,{e:a,options:i.effectiveOptions(),key:i.key,selected:i.isSelected()}))}function s(t,a){var n=t.getDataForArea(this),o=t.options;t.currentAreaId<0||!n||t.getDataForArea(a.relatedTarget)!==n&&(t.currentAreaId=-1,n.area=null,i(t,o.mouseoutDelay,n).then(t.clearEffects),e.isFunction(o.onMouseout)&&o.onMouseout.call(this,{e:a,options:o,key:n.key,selected:n.isSelected()}))}function c(t){var a=t.options;t.ensureNoHighlight(),a.toolTipClose&&e.inArray("area-mouseout",a.toolTipClose)>=0&&t.activeToolTip&&t.clearToolTip()}function l(t,a){function n(o){var d,g;if(l=o.isSelectable()&&(o.isDeselectable()||!o.isSelected()),c=l?!o.isSelected():o.isSelected(),s=u.getBoundList(m,o.key),e.isFunction(m.onClick)&&(p=m.onClick.call(f,{e:a,listTarget:s,key:o.key,selected:c}),h.isBool(p))){if(!p)return!1;if("#"!==(g=e(o.area).attr("href")))return window.location.href=g,!1}l&&(i=o.toggle()),m.boundList&&m.boundList.length>0&&u.setBoundListProperties(m,s,o.isSelected()),(d=o.effectiveOptions()).includeKeys&&(r=h.split(d.includeKeys),e.each(r,function(e,a){var i=t.getDataForKey(a.toString());i.options.isMask||n(i)}))}var i,r,s,c,l,p,f=this,d=t.getDataForArea(this),m=t.options;o.call(this,a),m.clickNavigate&&d.href?window.location.href=d.href:d&&!d.owner.currentAction&&(m=t.options,n(d))}var u=e.mapster,h=u.utils;u.MapData=function(e,a){var n=this;n.image=e,n.images=new u.MapImages(n),n.graphics=new u.Graphics(n),n.imgCssText=e.style.cssText||null,t(n),n.configureOptions(a),n.mouseover=function(e){r.call(this,n,e)},n.mouseout=function(e){s.call(this,n,e)},n.click=function(e){l.call(this,n,e)},n.clearEffects=function(e){c.call(this,n,e)}},u.MapData.prototype={constructor:u.MapData,configureOptions:function(e){this.options=h.updateProps({},u.defaults,e)},bindImages:function(){var e=this,t=e.images;return t.length>2?t.splice(2):0===t.length&&(t.add(e.image),t.add(e.image.src)),n(e),e.images.bind()},isActive:function(){return!this.complete||this.currentAction},state:function(){return{complete:this.complete,resizing:"resizing"===this.currentAction,zoomed:this.zoomed,zoomedArea:this.zoomedArea,scaleInfo:this.scaleInfo}},wrapId:function(){return"mapster_wrap_"+this.index},_idFromKey:function(e){return"string"==typeof e&&this._xref.hasOwnProperty(e)?this._xref[e]:-1},getSelected:function(){var t="";return e.each(this.data,function(e,a){a.isSelected()&&(t+=(t?",":"")+this.key)}),t},getAllDataForArea:function(t,a){var n,i,o,r=this,s=e(t).filter("area").attr(r.options.mapKey);if(s)for(o=[],s=h.split(s),n=0;n<(a||s.length);n++)(i=r.data[r._idFromKey(s[n])]).area=t.length?t[0]:t,o.push(i);return o},getDataForArea:function(e){var t=this.getAllDataForArea(e,1);return t?t[0]||null:null},getDataForKey:function(e){return this.data[this._idFromKey(e)]},getKeysForGroup:function(e){var t=this.getDataForKey(e);return t?t.isPrimary?t.key:this.getPrimaryKeysForMapAreas(t.areas()).join(","):""},getPrimaryKeysForMapAreas:function(t){var a=[];return e.each(t,function(t,n){e.inArray(n.keys[0],a)<0&&a.push(n.keys[0])}),a},getData:function(e){return"string"==typeof e?this.getDataForKey(e):e&&e.mapster||h.isElement(e)?this.getDataForArea(e):null},ensureNoHighlight:function(){this.highlightId>=0&&(this.graphics.clearHighlight(),this.data[this.highlightId].changeState("highlight",!1),this.setHighlightId(-1))},setHighlightId:function(e){this.highlightId=e},clearSelections:function(){e.each(this.data,function(e,t){t.selected&&t.deselect(!0)}),this.removeSelectionFinish()},setAreaOptions:function(e){var t,a,n;for(t=(e=e||[]).length-1;t>=0;t--)(a=e[t])&&(n=this.getDataForKey(a.key))&&(h.updateProps(n.options,a),h.isBool(a.selected)&&(n.selected=a.selected))},drawSelections:function(e){var t,a=h.asArray(e);for(t=a.length-1;t>=0;t--)this.data[a[t]].drawSelection()},redrawSelections:function(){e.each(this.data,function(e,t){t.isSelectedOrStatic()&&t.drawSelection()})},initialize:function(){var t,a,n,i,o,r,s,c,l,p,f,d,m=this,g=m.options;if(!m.complete){for((o=(l=e(m.image)).parent().attr("id"))&&o.length>=12&&"mapster_wrap"===o.substring(0,12)?(i=l.parent()).attr("id",m.wrapId()):(i=e('
'),g.wrapClass&&(!0===g.wrapClass?i.addClass(l[0].className):i.addClass(g.wrapClass))),m.wrapper=i,m.scaleInfo=d=h.scaleMap(m.images[0],m.images[1],g.scaleMap),m.base_canvas=a=m.graphics.createVisibleCanvas(m),m.overlay_canvas=n=m.graphics.createVisibleCanvas(m),t=e(m.images[1]).addClass("mapster_el "+m.images[0].className).attr({id:null,usemap:null}),(c=h.size(m.images[0])).complete&&t.css({width:c.width,height:c.height}),m.buildDataset(),r={display:"block",position:"relative",padding:0,width:d.width,height:d.height},g.wrapCss&&e.extend(r,g.wrapCss),l.parent()[0]!==m.wrapper[0]&&l.before(m.wrapper),i.css(r),e(m.images.slice(2)).hide(),s=1;st?-1:1}:function(e,t){return e===t?0:e=0;o--)p=f[o],b.mapValue&&(m=s.attr(b.mapValue)),y?(r=a(w.data.length,m),(g=w.data[r]).key=p=r.toString()):(r=w._xref[p])>=0?(g=w.data[r],m&&!w.data[r].value&&(g.value=m)):(r=a(p,m),(g=w.data[r]).isPrimary=0===o),h.areaDataXref.push(r),g.areasXref.push(d);(v=s.attr("href"))&&"#"!==v&&!g.href&&(g.href=v),h.nohref||(s.bind("click.mapster",w.click),u.isTouch||s.bind("mouseover.mapster",w.mouseover).bind("mouseout.mapster",w.mouseout).bind("mousedown.mapster",w.mousedown)),s.data("mapster",d+1)}w.setAreaOptions(b.areas),w.redrawSelections()},processCommandQueue:function(){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)},clearEvents:function(){e(this.map).find("area").unbind(".mapster"),e(this.images).unbind(".mapster")},_clearCanvases:function(t){t||e(this.base_canvas).remove(),e(this.overlay_canvas).remove()},clearMapData:function(t){var a=this;this._clearCanvases(t),e.each(this.data,function(e,t){t.reset()}),this.data=null,t||(this.image.style.cssText=this.imgCssText,e(this.wrapper).before(this.image).remove()),a.images.clear(),this.image=null,h.ifFunction(this.clearTooltip,this)},removeSelectionFinish:function(){var e=this.graphics;e.refreshSelections(),e.clearHighlight()}}}(jQuery),function(e){var t=e.mapster,a=t.utils;t.AreaData=function(t,a,n){e.extend(this,{owner:t,key:a||"",isPrimary:!0,areaId:-1,href:"",value:n||"",options:{},selected:null,areasXref:[],area:null,optsCache:null})},t.AreaData.prototype={constuctor:t.AreaData,select:function(t){var a=this,n=a.owner;n.options.singleSelect&&n.clearSelections(),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)),n.options.singleSelect&&n.graphics.refreshSelections()},deselect:function(e){var t=this;t.selected=!1,t.changeState("select",!1),t.optsCache=null,t.owner.graphics.removeSelections(t.areaId),e||t.owner.removeSelectionFinish()},toggle:function(e){var t=this;return t.isSelected()?t.deselect():t.select(e),t.isSelected()},areas:function(){var e,t=[];for(e=0;e=0;b-=2)v=M[b],y=M[b+1],vh&&(h=v,m=y),yp&&(p=y,f=v);return o&&r&&(c=!1,e.each([[d-o,u-r],[f,u-r],[l-o,g-r],[l-o,m],[h,g-r],[h,m],[d-o,p],[f,p]],function(e,t){if(!c&&t[0]>k&&t[1]>_)return w=t,c=!0,!1}),c||(w=[h,p])),w}}(jQuery),function(e){var t=e.mapster,a=t.utils,n=t.MapArea.prototype;t.utils.getScaleInfo=function(e,t){var a;return t?(a=e.width/t.width||e.height/t.height)>.98&&a<1.02&&(a=1):(a=1,t=e),{scale:1!==a,scalePct:a,realWidth:t.width,realHeight:t.height,width:e.width,height:e.height,ratio:e.width/e.height}},t.utils.scaleMap=function(e,t,n){var i=a.size(e),o=a.size(t,!0);if(!o.complete())throw"Another script, such as an extension, appears to be interfering with image loading. Please let us know about this.";return i.complete()||(i=o),this.getScaleInfo(i,n?o:null)},t.MapData.prototype.resize=function(n,i,o,r){function s(a,n,i){t.hasCanvas()?(a.width=n,a.height=i):(e(a).width(n),e(a).height(i))}function c(){v.currentAction="",e.isFunction(r)&&r(),v.processCommandQueue()}function l(){if(s(v.overlay_canvas,n,i),m>=0){var e=v.data[m];e.tempOptions={fade:!1},v.getDataForKey(e.key).highlight(),e.tempOptions=null}s(v.base_canvas,n,i),v.redrawSelections(),c()}function u(){e(v.image).css(f),v.scaleInfo=a.getScaleInfo({width:n,height:i},{width:v.scaleInfo.realWidth,height:v.scaleInfo.realHeight}),e.each(v.data,function(t,a){e.each(a.areas(),function(e,t){t.resize()})})}var h,p,f,d,m,g,v=this;r=r||o,v.scaleInfo.width===n&&v.scaleInfo.height===i||(m=v.highlightId,n||(g=i/v.scaleInfo.realHeight,n=Math.round(v.scaleInfo.realWidth*g)),i||(g=n/v.scaleInfo.realWidth,i=Math.round(v.scaleInfo.realHeight*g)),f={width:String(n)+"px",height:String(i)+"px"},t.hasCanvas()||e(v.base_canvas).children().remove(),d=e(v.wrapper).find(".mapster_el").add(v.wrapper),o?(p=[],v.currentAction="resizing",d.each(function(t,n){h=a.defer(),p.push(h),e(n).animate(f,{duration:o,complete:h.resolve,easing:"linear"})}),h=a.defer(),p.push(h),a.when.all(p).then(l),u(),h.resolve()):(d.css(f),u(),l()))},t.MapArea=a.subclass(t.MapArea,function(){this.base.init(),this.owner.scaleInfo.scale&&this.resize()}),n.coords=function(e,t){var a,n=[],i=e||this.owner.scaleInfo.scalePct,o=t||0;if(1===i&&0===t)return this.originalCoords;for(a=0;a0?s.fader(e[0],0,n,t.fadeDuration):s.setOpacity(e[0],n)}function n(t,a,n,i,o,r){var s=n+".mapster-tooltip";if(e.inArray(a,t)>=0)return i.unbind(s).bind(s,function(e){o&&!o.call(this,e)||(i.unbind(".mapster-tooltip"),r&&r.call(this))}),{object:i,event:s}}function i(e,t,n,i,o){var r,c={};return o=o||{},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),c.left+=o.offsetx||0,c.top+=o.offsety||0,c.css=o.css,c.fadeDuration=o.fadeDuration,a(e,c),e}function o(e){return e?"string"==typeof e||e.jquery?e:e.content:null}var r=e.mapster,s=r.utils;e.extend(r.defaults,{toolTipContainer:'
',showToolTip:!1,toolTipFade:!0,toolTipClose:["area-mouseout","image-mouseout"],onShowToolTip:null,onHideToolTip:null}),e.extend(r.area_defaults,{toolTip:null,toolTipClose:null}),r.MapData.prototype.clearToolTip=function(){this.activeToolTip&&(this.activeToolTip.stop().remove(),this.activeToolTip=null,this.activeToolTipID=null,s.ifFunction(this.options.onHideToolTip,this))},r.AreaData.prototype.showToolTip=function(a,o){var r,c,l,u,h,p=this,f=p.owner,d=p.effectiveOptions();if(o=o?e.extend({},o):{},a=a||d.toolTip,c=o.closeEvents||d.toolTipClose||f.options.toolTipClose||"tooltip-click",h=void 0!==o.template?o.template:f.options.toolTipContainer,o.closeEvents="string"==typeof c?c=s.split(c):c,o.fadeDuration=o.fadeDuration||(f.options.toolTipFade?f.options.fadeDuration||d.fadeDuration:0),l=p.area?p.area:e.map(p.areas(),function(e){return e.area}),f.activeToolTipID!==p.areaId)return f.clearToolTip(),f.activeToolTip=r=t(a,h,o.css),f.activeToolTipID=p.areaId,u=function(){f.clearToolTip()},n(c,"area-click","click",e(f.map),null,u),n(c,"tooltip-click","click",r,null,u),n(c,"image-mouseout","mouseout",e(f.image),function(e){return e.relatedTarget&&"AREA"!==e.relatedTarget.nodeName&&e.relatedTarget!==p.area},u),i(r,l,f.image,o.container,h),s.ifFunction(f.options.onShowToolTip,p.area,{toolTip:r,options:{},areaOptions:d,key:p.key,selected:p.isSelected()}),r},r.impl.tooltip=function(a,s){return new r.Method(this,function(){var r,c,l=this;if(a){if(c=e(a),l.activeToolTipID===c[0])return;l.clearToolTip(),l.activeToolTip=r=t(o(s),s.template||l.options.toolTipContainer,s.css),l.activeToolTipID=c[0],n(["tooltip-click"],"tooltip-click","click",r,null,function(){l.clearToolTip()}),l.activeToolTip=r=i(r,c,l.image,s.container,s)}else l.clearToolTip()},function(){e.isPlainObject(a)&&!s&&(s=a),this.showToolTip(o(s),s)},{name:"tooltip",args:arguments,key:a}).go()}}(jQuery); diff -r e202798d3732 -r 82860da48dbb src/pyams_content/zmi/resources/js/pyams_content.js --- a/src/pyams_content/zmi/resources/js/pyams_content.js Fri Nov 09 10:41:05 2018 +0100 +++ b/src/pyams_content/zmi/resources/js/pyams_content.js Fri Nov 09 15:22:13 2018 +0100 @@ -49,23 +49,55 @@ icon: 'cloud-check', tooltip: "Insert internal link", image: '/--static--/pyams_content/img/internal-link.png', + stateSelector: 'a[href^="oid://"]', onclick: function() { + var data = {}, + dom = editor.dom, + selection = editor.selection, + selectedElm = selection.getNode(), + anchorElm = dom.getParent(selectedElm, 'a[href]'); + data.text = anchorElm ? (anchorElm.innerText || anchorElm.textContent) : selection.getContent({format: 'text'}); + data.href = anchorElm ? dom.getAttrib(anchorElm, 'href') : ''; editor.windowManager.open({ title: "Insert internal link", body: [ { type: 'textbox', name: 'oid', - label:'Internal number' + label:'Internal number', + value: data.href, + onchange: function() { + data.href = this.value(); + } }, { type: 'textbox', name: 'title', label: 'Link title', - value: editor.selection.getContent() + value: data.text, + onchange: function() { + data.text = this.value(); + } } ], onsubmit: function(e) { - editor.insertContent('' + e.data.title + ''); + editor.focus(); // activate change events + var href = data.href; + if (href) { + if (anchorElm) { + if ('innerText' in anchorElm) { + anchorElm.innerText = data.text; + } else { + anchorElm.textContent = data.text; + } + dom.setAttribs(anchorElm, {href: data.href}); + selection.select(anchorElm); + editor.undoManager.add(); + } else { + editor.insertContent('' + e.data.title + ''); + } + } else { + editor.execCommand('unlink'); + } } }); } diff -r e202798d3732 -r 82860da48dbb src/pyams_content/zmi/resources/js/pyams_content.min.js --- a/src/pyams_content/zmi/resources/js/pyams_content.min.js Fri Nov 09 10:41:05 2018 +0100 +++ b/src/pyams_content/zmi/resources/js/pyams_content.min.js Fri Nov 09 15:22:13 2018 +0100 @@ -1,1 +1,1 @@ -!function(t,e){"use strict";var a=e.MyAMS,i={widget:{treeview:{selectFolder:function(e,a){t(e.target).siblings('input[type="hidden"]').val(a.id)},unselectFolder:function(e,a){t(e.target).siblings('input[type="hidden"]').val(null)}}},TinyMCE:{initEditor:function(t){return tinyMCE.addI18n("fr",{"Link list":"Liste de liens","Toggle h3 header":"En-tête H3","Toggle h4 header":"En-tête H4","Insert internal link":"Insérer un lien interne","Link title":"Texte à afficher","Internal number":"N° interne"}),tinymce.PluginManager.add("internal_links",function(t,e){t.addButton("internal_links",{icon:"cloud-check",tooltip:"Insert internal link",image:"/--static--/pyams_content/img/internal-link.png",onclick:function(){t.windowManager.open({title:"Insert internal link",body:[{type:"textbox",name:"oid",label:"Internal number"},{type:"textbox",name:"title",label:"Link title",value:t.selection.getContent()}],onsubmit:function(e){t.insertContent(''+e.data.title+"")}})}})}),tinyMCE.PluginManager.add("headers",function(t,e){["h3","h4"].forEach(function(e){t.addButton("header-"+e,{tooltip:"Toggle "+e+" header",text:e.toUpperCase(),onClick:function(){t.execCommand("mceToggleFormat",!1,e)},onPostRender:function(){var a=this,i=function(){t.formatter.formatChanged(e,function(t){a.active(t)})};t.formatter?i():t.on("init",i)}})})}),t.image_list=i.TinyMCE.getImagesList,t.link_list=i.TinyMCE.getLinksList,t.style_formats=[{title:"Inline",items:[{title:"Bold",icon:"bold",format:"bold"},{title:"Italic",icon:"italic",format:"italic"},{title:"Underline",icon:"underline",format:"underline"},{title:"Strikethrough",icon:"strikethrough",format:"strikethrough"},{title:"Superscript",icon:"superscript",format:"superscript"},{title:"Subscript",icon:"subscript",format:"subscript"},{title:"Code",icon:"code",format:"code"}]},{title:"Blocks",items:[{title:"Paragraph",format:"p"},{title:"Blockquote",format:"blockquote"},{title:"Div",format:"div"},{title:"Pre",format:"pre"}]},{title:"Alignment",items:[{title:"Left",icon:"alignleft",format:"alignleft"},{title:"Center",icon:"aligncenter",format:"aligncenter"},{title:"Right",icon:"alignright",format:"alignright"},{title:"Justify",icon:"alignjustify",format:"alignjustify"}]}],t.plugins+=" internal_links headers",t.toolbar1&&(t.toolbar1="undo redo | header-h3 header-h4 styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent"),t.toolbar2&&(t.toolbar2="forecolor backcolor | charmap internal_links link | fullscreen preview print | code"),t},getImagesList:function(e){var i=t(document.activeElement).parents("form");if(i.exists()){var n=i.attr("data-ams-form-handler")||i.attr("action"),s=n.substr(0,n.lastIndexOf("/")+1);return a.ajax.post(s+"get-images-list.json",{},e)}},getLinksList:function(e){var i=t(document.activeElement).parents("form");if(i.exists()){var n=i.attr("data-ams-form-handler")||i.attr("action"),s=n.substr(0,n.lastIndexOf("/")+1);return a.ajax.post(s+"get-links-list.json",{},e)}}},galleries:{addMediaCallback:function(e){var a=t(".gallery",t('[id="'+e.parent+'"]')),n=a.siblings(".switcher");n.parents("fieldset:first").hasClass("switched")&&n.click();for(var s=0;s  '+a.i18n.DELETE_WARNING,buttons:a.i18n.BTN_OK_CANCEL},function(t){if(t===a.i18n.BTN_OK){var i=e.parents(".gallery").data("ams-location"),n=e.parents(".media"),s=n.data("ams-element-name");a.ajax.post(i+"/delete-element.json",{object_name:s},function(t,e){n.remove(),t.handle_json&&a.ajax.handleJSON(t)})}})}},afterFancyboxLoad:function(t,e){t.element.hasClass("not-visible")&&t.inner.prepend('
')}},illustration:{addIllustration:function(){var e=t(this),a=e.parents(".btn-group").siblings("legend.switcher");t("i.fa-plus",a).click(),e.hide(),t('input[type="file"]',a.siblings(".form-group:first")).click()}},paragraphs:{preReload:function(){i.paragraphs.switched=t("i.switch.fa-minus-square-o","#paragraphs_list").parents("tr").listattr("id")},postReload:function(){t(i.paragraphs.switched).each(function(){t("i.switch.fa-plus-square-o",'[id="'+this+'"]').parents("div").first().click()}),delete i.paragraphs.switched},refreshParagraph:function(e){var a=t('tr[id="'+e.object_id+'"]');t("span.title",a).html(e.title||" - - - - - - - -")},switchEditor:function(e){var i=t(this),n=t("i.switch",i),s=i.parents("td"),r=t(".editor",s),o=i.parents("tr");if(n.hasClass("fa-plus-square-o")){var l=o.parents("table");r.html('

'),a.ajax.post(l.data("ams-location")+"/get-paragraph-editor.json",{object_name:o.data("ams-element-name")},function(t){r.html(t),t&&(a.initContent(r),n.removeClass("fa-plus-square-o").addClass("fa-minus-square-o"),o.data("ams-disabled-handlers",!0),a.skin.scrollTo(r,{offset:r.height()-o.height()}))})}else a.skin.cleanContainer(r),r.empty(),n.removeClass("fa-minus-square-o").addClass("fa-plus-square-o"),o.removeData("ams-disabled-handlers")},switchLastEditor:function(e){var a=t('table[id="'+e+'"]'),i=t("tr:last",a);t('[data-ams-click-handler="PyAMS_content.paragraphs.switchEditor"]',i).click()},switchAllEditors:function(e){var i=t(this),n=t("i",i),s=i.parents("table");n.hasClass("fa-plus-square-o")?(n.removeClass("fa-plus-square-o").addClass("fa-cog fa-spin"),a.ajax.post(s.data("ams-location")+"/get-paragraphs-editors.json",{},function(e){for(var i in e)if(e.hasOwnProperty(i)){var r=t('tr[data-ams-element-name="'+i+'"]',s),o=t(".editor",r);o.is(":empty")&&o.html(e[i]),t(".fa-plus-square-o",r).removeClass("fa-plus-square-o").addClass("fa-minus-square-o"),r.data("ams-disabled-handlers",!0)}t("i.fa-plus-square-o",t("tbody",s)).exists()||n.removeClass("fa-cog fa-spin").addClass("fa-minus-square-o"),a.initContent(s)})):(t(".editor",s).each(function(){a.skin.cleanContainer(t(this)),t(this).empty()}),t(".fa-minus-square-o",s).removeClass("fa-minus-square-o").addClass("fa-plus-square-o"),t("tr",s).removeData("ams-disabled-handlers"))},updateToolbar:function(e){var i=t('tr[id="'+e.object_id+'"]'),n=t(".title-toolbar",i);n.replaceWith(e.toolbar_tag),n=t(".title-toolbar",i),a.initContent(n)},updateMarkers:function(e){var i=t('tr[id="'+e.object_id+'"]'),n=t(".title-toolbar",i),s=t("DIV.action."+e.marker_type,n);s.exists()?s.replaceWith(e.marker_tag):t(e.marker_tag).appendTo(n),e.marker_tag&&(s=t("DIV.action."+e.marker_type,n),a.initContent(s)),a.helpers.sort(n,"weight")}},pictograms:{initManagerSelection:function(){var e=t(this),a=t('input[type="hidden"]',t(".selected-pictograms",e)).listattr("value");return{selected:JSON.stringify(a)}},switchPictogram:function(){var e=t(this),a=e.parents(".pictograms"),i=a.parents(".pictograms-manager");a.hasClass("available-pictograms")?t(".selected-pictograms",i).append(e):t(".available-pictograms",i).append(e)}},themes:{initExtracts:function(e){var i=t('select[name="manager_themes.widgets.thesaurus_name:list"]',e).val(),n=t('select[name="manager_themes.widgets.extract_name:list"]',e),s=n.val();i&&a.jsonrpc.post("getExtracts",{thesaurus_name:i},{url:"/api/thesaurus/json"},function(e){n.empty(),t(e.result).each(function(){t("").attr("value",this.id).attr("selected",this.id===s).text(this.text).appendTo(n)})})},getExtracts:function(e){var i=t(e.currentTarget).parents("form"),n=t('select[name="manager_themes.widgets.thesaurus_name:list"]',i).val(),s=t('select[name="manager_themes.widgets.extract_name:list"]',i),r=s.data("select2");n&&"--NOVALUE--"!==n?a.jsonrpc.post("getExtracts",{thesaurus_name:n},{url:"/api/thesaurus/json"},function(t){r.results.empty(),r.opts.populateResults.call(r,r.results,t.result,{term:""})}):(s.select2("data",null),r.results.empty(),r.opts.populateResults.call(r,r.results,[],{term:""}))}},fields:{refreshField:function(e){var a=t('table[id="form_fields_list"]'),i=t('tr[data-ams-element-name="'+e.object_name+'"]',a);t("td:nth-child(4)",i).html(e.title)}},imgmap:{init:function(){var e=t(this);a.ajax.check(t.fn.canvasAreaDraw,"/--static--/pyams_content/js/jquery-canvasAreaDraw"+a.devext+".js",function(){e.canvasAreaDraw({imageUrl:e.data("ams-image-url")})})},initPreview:function(){var e=t(this);a.ajax.check(t.fn.mapster,"/--static--/pyams_content/js/jquery-imagemapster-1.2.10"+a.devext+".js",function(){e.mapster({fillColor:"ff0000",fillOpacity:.35,selected:!0,highlight:!0,staticState:!0})})}},site:{switchVisibility:function(){return function(){var e=t(this),i=e.parents("tr").first();a.ajax.post(i.data("ams-location")+"/switch-content-visibility.json",{object_name:i.data("ams-element-name")},function(a,i){var n="fa-eye";a.visible||(n+="-slash"),a.published||(n+=" text-danger"),t("i",e).attr("class","fa fa-fw "+n)})}}},review:{timer:null,timer_duration:{general:3e4,chat:5e3},initComments:function(e){var n=t(".chat-body",e);n.animate({scrollTop:n[0].scrollHeight},1e3),clearInterval(i.review.timer),i.review.timer=setInterval(i.review.updateComments,i.review.timer_duration.chat),a.skin.registerCleanCallback(i.review.cleanCommentsCallback)},cleanCommentsCallback:function(){clearInterval(i.review.timer),i.review.timer=setInterval(i.review.updateComments,i.review.timer_duration.general)},updateComments:function(){var e,i=t(".badge",'nav a[href="#review-comments.html"]'),n=t(".chat-body",".widget-body");e=n.exists()?t(".message",n).length:parseInt(i.text()),a.ajax.post("get-last-review-comments.json",{count:e},function(a){n.exists()&&i.removeClass("bg-color-danger").addClass("bg-color-info"),e!==a.count&&(i.text(a.count).removeClass("hidden"),n.exists()&&(t(".messages",n).append(a.content),n.animate({scrollTop:n[0].scrollHeight},1e3)),n.exists()||i.removeClass("bg-color-info").addClass("bg-color-danger").animate({padding:"3px 12px 2px","margin-right":"9px"},"slow",function(){t(this).animate({padding:"3px 6px 2px","margin-right":"15px"},"slow")}))})},initCommentData:function(e){var a=t(".chat-body",".widget-body");return{count:t(".message",a).length}},addCommentAction:function(){return function(){t('textarea[name="comment"]').focus()}},addCommentCallback:function(e){var a=t(this),i=a.parents(".widget-body");t(".messages",i).append(e.content),t('textarea[name="comment"]',a).val("");var n=t(".chat-body",i);n.animate({scrollTop:n[0].scrollHeight},1e3),t(".badge",'nav a[href="#review-comments.html"]').text(e.count).removeClass("hidden")}},header:{submitEditForm:function(){var e=t(this).parents("form").first();a.form.submit(e,{form_data:{autosubmit:!0}})}},footer:{submitEditForm:function(){var e=t(this).parents("form").first();a.form.submit(e,{form_data:{autosubmit:!0}})}},profile:{switchFavorite:function(){var e=t(this),i=e.data("sequence-oid");a.ajax.post("switch-user-favorite.json",{oid:i},function(t,a){t.favorite?e.removeClass("fa-star-o").addClass("fa-star"):e.removeClass("fa-star").addClass("fa-star-o")})}}};t(".badge",'nav a[href="#review-comments.html"]').exists()&&(i.review.timer=setInterval(i.review.updateComments,i.review.timer_duration.general)),e.PyAMS_content=i}(jQuery,this); +!function(t,e){"use strict";var a=e.MyAMS,i={widget:{treeview:{selectFolder:function(e,a){t(e.target).siblings('input[type="hidden"]').val(a.id)},unselectFolder:function(e,a){t(e.target).siblings('input[type="hidden"]').val(null)}}},TinyMCE:{initEditor:function(t){return tinyMCE.addI18n("fr",{"Link list":"Liste de liens","Toggle h3 header":"En-tête H3","Toggle h4 header":"En-tête H4","Insert internal link":"Insérer un lien interne","Link title":"Texte à afficher","Internal number":"N° interne"}),tinymce.PluginManager.add("internal_links",function(t,e){t.addButton("internal_links",{icon:"cloud-check",tooltip:"Insert internal link",image:"/--static--/pyams_content/img/internal-link.png",stateSelector:'a[href^="oid://"]',onclick:function(){var e={},a=t.dom,i=t.selection,n=i.getNode(),s=a.getParent(n,"a[href]");e.text=s?s.innerText||s.textContent:i.getContent({format:"text"}),e.href=s?a.getAttrib(s,"href"):"",t.windowManager.open({title:"Insert internal link",body:[{type:"textbox",name:"oid",label:"Internal number",value:e.href,onchange:function(){e.href=this.value()}},{type:"textbox",name:"title",label:"Link title",value:e.text,onchange:function(){e.text=this.value()}}],onsubmit:function(n){t.focus(),e.href?s?("innerText"in s?s.innerText=e.text:s.textContent=e.text,a.setAttribs(s,{href:e.href}),i.select(s),t.undoManager.add()):t.insertContent(''+n.data.title+""):t.execCommand("unlink")}})}})}),tinyMCE.PluginManager.add("headers",function(t,e){["h3","h4"].forEach(function(e){t.addButton("header-"+e,{tooltip:"Toggle "+e+" header",text:e.toUpperCase(),onClick:function(){t.execCommand("mceToggleFormat",!1,e)},onPostRender:function(){var a=this,i=function(){t.formatter.formatChanged(e,function(t){a.active(t)})};t.formatter?i():t.on("init",i)}})})}),t.image_list=i.TinyMCE.getImagesList,t.link_list=i.TinyMCE.getLinksList,t.style_formats=[{title:"Inline",items:[{title:"Bold",icon:"bold",format:"bold"},{title:"Italic",icon:"italic",format:"italic"},{title:"Underline",icon:"underline",format:"underline"},{title:"Strikethrough",icon:"strikethrough",format:"strikethrough"},{title:"Superscript",icon:"superscript",format:"superscript"},{title:"Subscript",icon:"subscript",format:"subscript"},{title:"Code",icon:"code",format:"code"}]},{title:"Blocks",items:[{title:"Paragraph",format:"p"},{title:"Blockquote",format:"blockquote"},{title:"Div",format:"div"},{title:"Pre",format:"pre"}]},{title:"Alignment",items:[{title:"Left",icon:"alignleft",format:"alignleft"},{title:"Center",icon:"aligncenter",format:"aligncenter"},{title:"Right",icon:"alignright",format:"alignright"},{title:"Justify",icon:"alignjustify",format:"alignjustify"}]}],t.plugins+=" internal_links headers",t.toolbar1&&(t.toolbar1="undo redo | header-h3 header-h4 styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent"),t.toolbar2&&(t.toolbar2="forecolor backcolor | charmap internal_links link | fullscreen preview print | code"),t},getImagesList:function(e){var i=t(document.activeElement).parents("form");if(i.exists()){var n=i.attr("data-ams-form-handler")||i.attr("action"),s=n.substr(0,n.lastIndexOf("/")+1);return a.ajax.post(s+"get-images-list.json",{},e)}},getLinksList:function(e){var i=t(document.activeElement).parents("form");if(i.exists()){var n=i.attr("data-ams-form-handler")||i.attr("action"),s=n.substr(0,n.lastIndexOf("/")+1);return a.ajax.post(s+"get-links-list.json",{},e)}}},galleries:{addMediaCallback:function(e){var a=t(".gallery",t('[id="'+e.parent+'"]')),n=a.siblings(".switcher");n.parents("fieldset:first").hasClass("switched")&&n.click();for(var s=0;s  '+a.i18n.DELETE_WARNING,buttons:a.i18n.BTN_OK_CANCEL},function(t){if(t===a.i18n.BTN_OK){var i=e.parents(".gallery").data("ams-location"),n=e.parents(".media"),s=n.data("ams-element-name");a.ajax.post(i+"/delete-element.json",{object_name:s},function(t,e){n.remove(),t.handle_json&&a.ajax.handleJSON(t)})}})}},afterFancyboxLoad:function(t,e){t.element.hasClass("not-visible")&&t.inner.prepend('
')}},illustration:{addIllustration:function(){var e=t(this),a=e.parents(".btn-group").siblings("legend.switcher");t("i.fa-plus",a).click(),e.hide(),t('input[type="file"]',a.siblings(".form-group:first")).click()}},paragraphs:{preReload:function(){i.paragraphs.switched=t("i.switch.fa-minus-square-o","#paragraphs_list").parents("tr").listattr("id")},postReload:function(){t(i.paragraphs.switched).each(function(){t("i.switch.fa-plus-square-o",'[id="'+this+'"]').parents("div").first().click()}),delete i.paragraphs.switched},refreshParagraph:function(e){var a=t('tr[id="'+e.object_id+'"]');t("span.title",a).html(e.title||" - - - - - - - -")},switchEditor:function(e){var i=t(this),n=t("i.switch",i),s=i.parents("td"),r=t(".editor",s),o=i.parents("tr");if(n.hasClass("fa-plus-square-o")){var l=o.parents("table");r.html('

'),a.ajax.post(l.data("ams-location")+"/get-paragraph-editor.json",{object_name:o.data("ams-element-name")},function(t){r.html(t),t&&(a.initContent(r),n.removeClass("fa-plus-square-o").addClass("fa-minus-square-o"),o.data("ams-disabled-handlers",!0),a.skin.scrollTo(r,{offset:r.height()-o.height()}))})}else a.skin.cleanContainer(r),r.empty(),n.removeClass("fa-minus-square-o").addClass("fa-plus-square-o"),o.removeData("ams-disabled-handlers")},switchLastEditor:function(e){var a=t('table[id="'+e+'"]'),i=t("tr:last",a);t('[data-ams-click-handler="PyAMS_content.paragraphs.switchEditor"]',i).click()},switchAllEditors:function(e){var i=t(this),n=t("i",i),s=i.parents("table");n.hasClass("fa-plus-square-o")?(n.removeClass("fa-plus-square-o").addClass("fa-cog fa-spin"),a.ajax.post(s.data("ams-location")+"/get-paragraphs-editors.json",{},function(e){for(var i in e)if(e.hasOwnProperty(i)){var r=t('tr[data-ams-element-name="'+i+'"]',s),o=t(".editor",r);o.is(":empty")&&o.html(e[i]),t(".fa-plus-square-o",r).removeClass("fa-plus-square-o").addClass("fa-minus-square-o"),r.data("ams-disabled-handlers",!0)}t("i.fa-plus-square-o",t("tbody",s)).exists()||n.removeClass("fa-cog fa-spin").addClass("fa-minus-square-o"),a.initContent(s)})):(t(".editor",s).each(function(){a.skin.cleanContainer(t(this)),t(this).empty()}),t(".fa-minus-square-o",s).removeClass("fa-minus-square-o").addClass("fa-plus-square-o"),t("tr",s).removeData("ams-disabled-handlers"))},updateToolbar:function(e){var i=t('tr[id="'+e.object_id+'"]'),n=t(".title-toolbar",i);n.replaceWith(e.toolbar_tag),n=t(".title-toolbar",i),a.initContent(n)},updateMarkers:function(e){var i=t('tr[id="'+e.object_id+'"]'),n=t(".title-toolbar",i),s=t("DIV.action."+e.marker_type,n);s.exists()?s.replaceWith(e.marker_tag):t(e.marker_tag).appendTo(n),e.marker_tag&&(s=t("DIV.action."+e.marker_type,n),a.initContent(s)),a.helpers.sort(n,"weight")}},pictograms:{initManagerSelection:function(){var e=t(this),a=t('input[type="hidden"]',t(".selected-pictograms",e)).listattr("value");return{selected:JSON.stringify(a)}},switchPictogram:function(){var e=t(this),a=e.parents(".pictograms"),i=a.parents(".pictograms-manager");a.hasClass("available-pictograms")?t(".selected-pictograms",i).append(e):t(".available-pictograms",i).append(e)}},themes:{initExtracts:function(e){var i=t('select[name="manager_themes.widgets.thesaurus_name:list"]',e).val(),n=t('select[name="manager_themes.widgets.extract_name:list"]',e),s=n.val();i&&a.jsonrpc.post("getExtracts",{thesaurus_name:i},{url:"/api/thesaurus/json"},function(e){n.empty(),t(e.result).each(function(){t("").attr("value",this.id).attr("selected",this.id===s).text(this.text).appendTo(n)})})},getExtracts:function(e){var i=t(e.currentTarget).parents("form"),n=t('select[name="manager_themes.widgets.thesaurus_name:list"]',i).val(),s=t('select[name="manager_themes.widgets.extract_name:list"]',i),r=s.data("select2");n&&"--NOVALUE--"!==n?a.jsonrpc.post("getExtracts",{thesaurus_name:n},{url:"/api/thesaurus/json"},function(t){r.results.empty(),r.opts.populateResults.call(r,r.results,t.result,{term:""})}):(s.select2("data",null),r.results.empty(),r.opts.populateResults.call(r,r.results,[],{term:""}))}},fields:{refreshField:function(e){var a=t('table[id="form_fields_list"]'),i=t('tr[data-ams-element-name="'+e.object_name+'"]',a);t("td:nth-child(4)",i).html(e.title)}},imgmap:{init:function(){var e=t(this);a.ajax.check(t.fn.canvasAreaDraw,"/--static--/pyams_content/js/jquery-canvasAreaDraw"+a.devext+".js",function(){e.canvasAreaDraw({imageUrl:e.data("ams-image-url")})})},initPreview:function(){var e=t(this);a.ajax.check(t.fn.mapster,"/--static--/pyams_content/js/jquery-imagemapster-1.2.10"+a.devext+".js",function(){e.mapster({fillColor:"ff0000",fillOpacity:.35,selected:!0,highlight:!0,staticState:!0})})}},site:{switchVisibility:function(){return function(){var e=t(this),i=e.parents("tr").first();a.ajax.post(i.data("ams-location")+"/switch-content-visibility.json",{object_name:i.data("ams-element-name")},function(a,i){var n="fa-eye";a.visible||(n+="-slash"),a.published||(n+=" text-danger"),t("i",e).attr("class","fa fa-fw "+n)})}}},review:{timer:null,timer_duration:{general:3e4,chat:5e3},initComments:function(e){var n=t(".chat-body",e);n.animate({scrollTop:n[0].scrollHeight},1e3),clearInterval(i.review.timer),i.review.timer=setInterval(i.review.updateComments,i.review.timer_duration.chat),a.skin.registerCleanCallback(i.review.cleanCommentsCallback)},cleanCommentsCallback:function(){clearInterval(i.review.timer),i.review.timer=setInterval(i.review.updateComments,i.review.timer_duration.general)},updateComments:function(){var e,i=t(".badge",'nav a[href="#review-comments.html"]'),n=t(".chat-body",".widget-body");e=n.exists()?t(".message",n).length:parseInt(i.text()),a.ajax.post("get-last-review-comments.json",{count:e},function(a){n.exists()&&i.removeClass("bg-color-danger").addClass("bg-color-info"),e!==a.count&&(i.text(a.count).removeClass("hidden"),n.exists()&&(t(".messages",n).append(a.content),n.animate({scrollTop:n[0].scrollHeight},1e3)),n.exists()||i.removeClass("bg-color-info").addClass("bg-color-danger").animate({padding:"3px 12px 2px","margin-right":"9px"},"slow",function(){t(this).animate({padding:"3px 6px 2px","margin-right":"15px"},"slow")}))})},initCommentData:function(e){var a=t(".chat-body",".widget-body");return{count:t(".message",a).length}},addCommentAction:function(){return function(){t('textarea[name="comment"]').focus()}},addCommentCallback:function(e){var a=t(this),i=a.parents(".widget-body");t(".messages",i).append(e.content),t('textarea[name="comment"]',a).val("");var n=t(".chat-body",i);n.animate({scrollTop:n[0].scrollHeight},1e3),t(".badge",'nav a[href="#review-comments.html"]').text(e.count).removeClass("hidden")}},header:{submitEditForm:function(){var e=t(this).parents("form").first();a.form.submit(e,{form_data:{autosubmit:!0}})}},footer:{submitEditForm:function(){var e=t(this).parents("form").first();a.form.submit(e,{form_data:{autosubmit:!0}})}},profile:{switchFavorite:function(){var e=t(this),i=e.data("sequence-oid");a.ajax.post("switch-user-favorite.json",{oid:i},function(t,a){t.favorite?e.removeClass("fa-star-o").addClass("fa-star"):e.removeClass("fa-star").addClass("fa-star-o")})}}};t(".badge",'nav a[href="#review-comments.html"]').exists()&&(i.review.timer=setInterval(i.review.updateComments,i.review.timer_duration.general)),e.PyAMS_content=i}(jQuery,this); diff -r e202798d3732 -r 82860da48dbb src/pyams_content/zmi/resources/js/tinymce/onflinks/langs/fr.js --- a/src/pyams_content/zmi/resources/js/tinymce/onflinks/langs/fr.js Fri Nov 09 10:41:05 2018 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -tinyMCE.addI18n('fr', { - "Insert internal link": "Insérer un lien interne", - "Linktitle": "Texte du lien", - "Internal number": "N° interne" -}); diff -r e202798d3732 -r 82860da48dbb src/pyams_content/zmi/resources/js/tinymce/onflinks/langs/fr.min.js --- a/src/pyams_content/zmi/resources/js/tinymce/onflinks/langs/fr.min.js Fri Nov 09 10:41:05 2018 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -tinyMCE.addI18n("fr",{"Insert internal link":"Insérer un lien interne",Linktitle:"Texte du lien","Internal number":"N° interne"}); \ No newline at end of file diff -r e202798d3732 -r 82860da48dbb src/pyams_content/zmi/resources/js/tinymce/onflinks/plugin.js --- a/src/pyams_content/zmi/resources/js/tinymce/onflinks/plugin.js Fri Nov 09 10:41:05 2018 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -tinymce.PluginManager.add('internal_links', function(editor, url) { - - editor.addButton('internal_links', { - icon: 'cloud-check', - tooltip: "Insert internal link", - image: '/--static--/pyams_content/img/external.png', - onclick: function() { - editor.windowManager.open({ - title: "Insert internal link", - body: [ - {type: 'textbox', name: 'title', label: 'Link title', value: editor.selection.getContent()}, - {type: 'textbox', name: 'oid', label:'Internal number'} - ], - onsubmit: function(e) { - editor.insertContent('' + e.data.title + ''); - } - }); - } - }) -}); diff -r e202798d3732 -r 82860da48dbb src/pyams_content/zmi/resources/js/tinymce/onflinks/plugin.min.js --- a/src/pyams_content/zmi/resources/js/tinymce/onflinks/plugin.min.js Fri Nov 09 10:41:05 2018 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -tinymce.PluginManager.add("internal_links",function(n,t){n.addButton("internal_links",{icon:"cloud-check",tooltip:"Insert internal link",image:"/--static--/pyams_content/img/external.png",onclick:function(){n.windowManager.open({title:"Insert internal link",body:[{type:"textbox",name:"title",label:"Link title",value:n.selection.getContent()},{type:"textbox",name:"oid",label:"Internal number"}],onsubmit:function(t){n.insertContent(''+t.data.title+"")}})}})});