From ed20d63c9837cad6e8049ea48ceaa946ea622b6e Mon Sep 17 00:00:00 2001 From: oblomov <102328295+oblomov-dev@users.noreply.github.com> Date: Sat, 3 Feb 2024 16:11:18 +0100 Subject: [PATCH] Ui2 json (#859) * ui2_json * update * Update abaplint.jsonc --- abaplint.jsonc | 2 +- src/01/05/z2ui5_cl_cc_imagemapster.clas.abap | 6119 +++++++++-------- ...est_integration_test.clas.testclasses.abap | 554 +- 3 files changed, 3342 insertions(+), 3333 deletions(-) diff --git a/abaplint.jsonc b/abaplint.jsonc index c8ff649c..bf26c33a 100644 --- a/abaplint.jsonc +++ b/abaplint.jsonc @@ -281,7 +281,7 @@ "^cl_axt_dbtable$", "^cl_blue_wb_utility$", "^cl_oo_source$", - "^/ui2/cl_json$", + "^/ui2/cl_$", "^cl_saunit_internal_result$", "^cl_srvd_wb_object_data$", "^cl_wb_object_operator_factory$", diff --git a/src/01/05/z2ui5_cl_cc_imagemapster.clas.abap b/src/01/05/z2ui5_cl_cc_imagemapster.clas.abap index b2f07639..3e17a74f 100644 --- a/src/01/05/z2ui5_cl_cc_imagemapster.clas.abap +++ b/src/01/05/z2ui5_cl_cc_imagemapster.clas.abap @@ -47,9 +47,9 @@ CLASS z2ui5_cl_cc_imagemapster DEFINITION CLASS-METHODS set_js_config IMPORTING - !is_config TYPE ty_c OPTIONAL - !auto_resize TYPE abap_bool DEFAULT abap_false - PREFERRED PARAMETER is_config + !is_config TYPE ty_c OPTIONAL + !auto_resize TYPE abap_bool DEFAULT abap_false + PREFERRED PARAMETER is_config RETURNING VALUE(imagemapster_config) TYPE string . @@ -68,9 +68,9 @@ CLASS z2ui5_cl_cc_imagemapster DEFINITION CLASS-METHODS load_editor IMPORTING base64_data_uri TYPE string - filename TYPE string + filename TYPE string RETURNING - VALUE(result) TYPE string . + VALUE(result) TYPE string . PROTECTED SECTION. PRIVATE SECTION. @@ -80,7 +80,7 @@ ENDCLASS. -CLASS Z2UI5_CL_CC_IMAGEMAPSTER IMPLEMENTATION. +CLASS z2ui5_cl_cc_imagemapster IMPLEMENTATION. METHOD get_js_local. @@ -276,3029 +276,3038 @@ CLASS Z2UI5_CL_CC_IMAGEMAPSTER IMPLEMENTATION. ENDMETHOD. -METHOD load_editor. - result = `` && |\n| && - `loadJsEditor("` && base64_data_uri && `","` && filename && `");`. -ENDMETHOD. + METHOD load_editor. + result = `` && |\n| && + `loadJsEditor("` && base64_data_uri && `","` && filename && `");`. + ENDMETHOD. -METHOD load_editor_css. - result = `` && |\n| && -`html, body, div, span, applet, object, h1, h2, h3, h4, h5, h6, p, a, em, img, strong, ol, ul, li, dl, dd, dt, form, label, input, article, aside, canvas, details, embed, figure, figcaption, footer, header, menu, nav, section, time, mark {` && |\n| && -` margin: 0;` && |\n| && -` padding: 0;` && |\n| && -` border: 0;` && |\n| && -` outline: 0;` && |\n| && -` font-style: inherit;` && |\n| && -` font-size: 100%;` && |\n| && -` font-family: inherit;` && |\n| && -` vertical-align: baseline;` && |\n| && -` background: transparent;` && |\n| && -`}` && |\n| && -`:focus {` && |\n| && -` outline: 0;` && |\n| && -`}` && |\n| && -`ul, ol {` && |\n| && -` list-style: none;` && |\n| && -`}` && |\n| && -`html {` && |\n| && -` height: 100%;` && |\n| && -`}` && |\n| && -`body {` && |\n| && -` padding: 0;` && |\n| && -` margin: 0;` && |\n| && -` font-family: Arial, Tahoma, sans-serif;` && |\n| && -` font-size: 14px;` && |\n| && -` color: #000;` && |\n| && -` height: 100%;` && |\n| && -` min-height: 100%;` && |\n| && -` background: #FFF url(data:image/gif;base64,R0lGODlhCgAKAIABANzc3P///yH+EUNyZWF0ZWQgd2l0aCBHSU1QACwAAAAACgAKAAACEYQdmYcaDNxjEspKndVZbc8UADs=);` && |\n| && -` line-height: 1;` && |\n| && -` overflow-y: scroll;` && |\n| && -`}` && |\n| && -`img {` && |\n| && -` border: 0;` && |\n| && -`}` && |\n| && -`a:link, a:visited {` && |\n| && -` outline: none;` && |\n| && -` text-decoration: none;` && |\n| && -` color: #000;` && |\n| && -`}` && |\n| && -`.clear {` && |\n| && -` clear: both;` && |\n| && -`}` && |\n| && -`.clearfix:after {` && |\n| && -` content: ".";` && |\n| && -` display: block;` && |\n| && -` clear: both;` && |\n| && -` visibility: hidden;` && |\n| && -` line-height: 0;` && |\n| && -` height: 0;` && |\n| && -`}` && |\n| && -`#noscript {` && |\n| && -` text-align: center;` && |\n| && -` display: block;` && |\n| && -` font-size: 20px;` && |\n| && -` padding: 5px 0;` && |\n| && -` background: #F00;` && |\n| && -`}` && |\n| && -`#header {` && |\n| && -` background: #000;` && |\n| && -` padding: 5px 0;` && |\n| && -` position: fixed;` && |\n| && -` z-index: 1001;` && |\n| && -` width: 100%;` && |\n| && -` box-shadow: rgba(0,0,0,0.2) 0 0 2px 2px;` && |\n| && -`}` && |\n| && -`#logo {` && |\n| && -` margin-right: 10px;` && |\n| && -` margin-left: 10px;` && |\n| && -` margin-top: -4px;` && |\n| && -` margin-bottom: -4px;` && |\n| && -` display: inline-block;` && |\n| && -` vertical-align: top;` && |\n| && -`}` && |\n| && -`#logo a:link, #logo a:visited {` && |\n| && -` color: #32c832;` && |\n| && -`}` && |\n| && -`#logo a:hover {` && |\n| && -` color: #FFF;` && |\n| && -`}` && |\n| && -`#logo img {` && |\n| && -` display: block;` && |\n| && -`}` && |\n| && -`#nav, #nav ul {` && |\n| && -` display: inline;` && |\n| && -` vertical-align: middle;` && |\n| && -`}` && |\n| && -`#nav li {` && |\n| && -` margin-right: 5px;` && |\n| && -` display: inline;` && |\n| && -`}` && |\n| && -`#nav a:link, #nav a:visited {` && |\n| && -` border: 1px solid #FFF;` && |\n| && -` border-radius: 3px;` && |\n| && -` font-size: 10px;` && |\n| && -` padding: 5px 10px;` && |\n| && -` display: inline-block;` && |\n| && -` color: #FFF;` && |\n| && -`}` && |\n| && -`#nav a:hover, #nav a:active {` && |\n| && -` border: 1px solid #32c832;` && |\n| && -` color: #32c832;` && |\n| && -`}` && |\n| && -`#nav a:active, #nav .selected a {` && |\n| && -` background: #FFF;` && |\n| && -` color: #000;` && |\n| && -` box-shadow: 0 0 1px #222 inset;` && |\n| && -` border: 1px solid #FFF;` && |\n| && -`}` && |\n| && -`#coords {` && |\n| && -` position: absolute;` && |\n| && -` top: 10px;` && |\n| && -` right: 15px;` && |\n| && -` color: #FFF;` && |\n| && -` font-size: 11px;` && |\n| && -`}` && |\n| && -`#debug {` && |\n| && -` color: #EEE;` && |\n| && -` position: absolute;` && |\n| && -` top: 10px;` && |\n| && -` right: 100px;` && |\n| && -` z-index: 1001;` && |\n| && -` font-size: 11px;` && |\n| && -`}` && |\n| && -`#wrapper {` && |\n| && -` position: relative;` && |\n| && -`}` && |\n| && -`#image_wrapper {` && |\n| && -` padding: 45px 0 10px;` && |\n| && -`}` && |\n| && -`#image {` && |\n| && -` position: relative;` && |\n| && -` overflow: hidden;` && |\n| && -` display: block;` && |\n| && -` margin: 0 auto;` && |\n| && -` border-radius: 3px;` && |\n| && -` box-shadow: rgba(0,0,0,0.2) 0 0 2px 2px;` && |\n| && -` display: none;` && |\n| && -`}` && |\n| && -`.draw#image {` && |\n| && -` cursor: crosshair;` && |\n| && -`}` && |\n| && -`#image map {` && |\n| && -` position: absolute;` && |\n| && -` top: 0;` && |\n| && -` left: 0;` && |\n| && -` width: 100%;` && |\n| && -` height: 100%;` && |\n| && -` display: block;` && |\n| && -`}` && |\n| && -`#img {` && |\n| && -` position: relative;` && |\n| && -` z-index: 1;` && |\n| && -`}` && |\n| && -`#code {` && |\n| && -` background: rgba(0,0,0,0.9);` && |\n| && -` color: #FFF;` && |\n| && -` font-family: monospace;` && |\n| && -` font-size: 11px;` && |\n| && -` line-height: 1.3;` && |\n| && -` width: 600px;` && |\n| && -` position: fixed;` && |\n| && -` left: 3%;` && |\n| && -` width: 94%;` && |\n| && -` bottom: 10px;` && |\n| && -` z-index: 1000;` && |\n| && -` box-shadow: rgba(0,0,0,0.2) 0 0 2px 2px;` && |\n| && -` display: none;` && |\n| && -` border-radius: 3px;` && |\n| && -`}` && |\n| && -`#code_content {` && |\n| && -` padding: 10px;` && |\n| && -`}` && |\n| && -`.close_button {` && |\n| && -` width: 10px;` && |\n| && -` height: 10px;` && |\n| && -` display: block;` && |\n| && -` background: #FFF url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAACbgAAAm4Bt/774AAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAABKSURBVAiZfc2xCYBAFATR90WwiSvUzDOyCcuzCaM1UMHIg` && -`c1mmcKOI0mHqupoIw4sVTW5mbFKAhvybEti8EN/zc+zj2hYP/ET7QIK9BpShkyrPwAAAABJRU5ErkJggg==) 50% 50% no-repeat;` && |\n| && -` position: absolute;` && |\n| && -` top: 10px;` && |\n| && -` right: 10px;` && |\n| && -` box-shadow: 0 0 1px #222 inset;` && |\n| && -` border-radius: 1px;` && |\n| && -` cursor: pointer;` && |\n| && -`}` && |\n| && -`#about {` && |\n| && -` position: absolute;` && |\n| && -` top: 10px;` && |\n| && -` left: 0;` && |\n| && -` width: 100%;` && |\n| && -` font-family: 'News Cycle';` && |\n| && -` font-size: 24px;` && |\n| && -` background: transparent;` && |\n| && -` padding: 2px 10px 5px;` && |\n| && -` -o-box-sizing: border-box;` && |\n| && -` -moz-box-sizing: border-box;` && |\n| && -` -webkit-box-sizing: border-box;` && |\n| && -` box-sizing: border-box;` && |\n| && -` color: #000;` && |\n| && -`}` && |\n| && -`#get_image_wrapper {` && |\n| && -` padding: 35px 0;` && |\n| && -` position: relative;` && |\n| && -` z-index: 1002;` && |\n| && -` display: none;` && |\n| && -`}` && |\n| && -`#get_image {` && |\n| && -` width: 200px;` && |\n| && -` margin: 0 auto;` && |\n| && -` font-size: 16px;` && |\n| && -` text-align: center;` && |\n| && -` background: #FFF;` && |\n| && -` padding: 20px 30px;` && |\n| && -` border-radius: 5px;` && |\n| && -` box-shadow: rgba(0,0,0,0.2) 0 0 2px 2px;` && |\n| && -` position: relative;` && |\n| && -`}` && |\n| && -`#get_image .close_button {` && |\n| && -` background: #000 url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAACbgAAAm4Bt/774AAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAABKSURBVAiZdc2xDYAwAAPBA0ViiQxKR6hgCMZjCSpTEAkavnxL7yH` && -`JgRPNQ0MtXS6Y+jBjlUSSLS9bEqMfSm/O2D+pq6Bi/ZxfqDfkbiIp0Zzd1AAAAABJRU5ErkJggg==) 50% 50% no-repeat;` && |\n| && -` box-shadow: 0 0 1px #EEE inset;` && |\n| && -` border-radius: 2px;` && |\n| && -`}` && |\n| && -`#logo_get_image {` && |\n| && -` margin-bottom: 20px;` && |\n| && -`}` && |\n| && -`#loading {` && |\n| && -` position: absolute;` && |\n| && -` top: 0;` && |\n| && -` left: 0;` && |\n| && -` width: 100%;` && |\n| && -` height: 100%;` && |\n| && -` text-align: center;` && |\n| && -` font-size: 20px;` && |\n| && -` background: rgba(255,255,255,0.95) url(data:image/gif;base64,R0lGODlhIwAjAPUAAP///zLIMuL24tn02fH68czwzPL78vr9+tLy0tz13Of458/xz/f899fz1+z57N/138Xvxer46pfil7LqsjvKO33bfZ3knZPhk4rfijLIMoDcgGPVY7jruKrnqm3XbVXRVbzsvL3svaXmpXDYcHfad6jnqEj` && -`NSAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCgAAACwAAAAAIwAjAAAG/0CAcEgsGo/IpFExcCifSgGkUDBAr8QDlZrAegnbAsJr` && -`NDwUByJ4OyYqIBCr0lCYIhhD+nZALEguFyJpSQlhBYMACFQQEUMIgBKRD0oKhl1ChVR4AAQXkZ8ETwuGcg5UbQATnpEXEFAMhg1CWgUCQg+rgBNYDA1bEKGJBU4HFqwSh2QKowULmAVCBZAgTmSzD3WNB40GfxMKWAcGBJtDvZdCAhOTQ9sNCwPBQwJbCwgCBIhJEQgdGB4bAnpIBoCeISoLElQzAkEDwA0fAkrcUELIg` && -`IO/IIArcgADxIkgMQhZY2hBgwfyOD7g8A/kBxLQhBgYgMDkAwf6cgIbEiGEBZcNIzSISKnEwTs3FChw0AeAqRIGFzU2RZCmQoYMG5xZY4ANoZA3ThJcvYphIRRTYaoNgGALwIWxGShofeJgyhZZTU/JhHuVXRJaYTahLbCpA98P5Y4YXNQWQKZhsyjwjYlkcQG8QhRxmTdZyQHNfgHo0TskwYerGqCIS8wpzFyZVJxiGS` && -`3G2hVmbG1DWUNVNxQmRH0LLxIEACH5BAkKAAAALAAAAAAjACMAAAb/QIBwSCwaj8ikUTFwKJ9KAaRQMECvxAOVmsB6CdsCwms0PBQHIng7JjIEgrTSUJgiGEP6dkBU1MVPCWEFcgAIVBARQxFTWwRKfmFdQoJUeABag4VIC4NWAA5UbQADYRACUAyDDUKZD0JriHxXDA1bEI+GBU4AnVsKZAAKvguUBUIKjQ+XwQcPdYo` && -`H0VQDzE8HBgTWALWTQgYDuXkCZ9sCWwsIAgSbSARSExYS8xavQueDVAsJvEYN8RcCzhsoAYKQUvkQQQBmZELACwQHXpgAK+GCBg/EGYmwAKDAgCK8gUNw8YGDTe0QfAJgoEGIDhY6hNiWxEGDNngIbBhBKJibnlILAQgw4cTChw0YvHlh8EyfkAsZOoDaQHWDiJVQQoXJ9SEDCSETjm74QGLWEweNqLASliGDCTwHPFSl` && -`yjBJpjCXJrTNMAuC2LEa2hXBhwiVkBF7pWIiMXeD2SOEC6xlaWKvh0WNHxs5cKiAPSEF9rotpEADVQtQsG0LIZqCtVqayYTea0KwTyIGKOzVcPsJiLZEeys5cMEDB+HIkQQBACH5BAkKAAAALAAAAAAjACMAAAb/QIBwSCwaj8ikUTFwKJ9KAaRQMECvxAOVmsB6CdsCwms0PBQHIng7JjIEgrTSUJgiGEP6dkBU1MVPC` && -`WEFcgAIVBARQxFTWwRKfmFdQoJUeABag4VIC4NWAA5UbQADYRACUAyDDUKZD0JriHxXDA1bEI+GBU4AnVsKZAARvguUBUIKjQ+XwQcPdYoH0VQDn1AHBgTMQrWTQgYDuUPYBAabAAJbCwgCBOdHBwQKDb4FC+Lpg1QLCbxGDqX0bUFFSiAiCMCMlGokcFasMAsaCLBmhEGEAfXYiAOHIOIDB4UYJBwSZ5yDB/QaPHgHb8` && -`IHClbSGLBgwVswIQs2ZMiAARQJoyshLlyYMNLLABI7M1DA4zIEAAMSJFyQAGHbkw5Jd04QouGDBSEFpkq1oAiKiKwZPsDasIFEmgMWxE4VhyQB2gxtILDdQLCBWKkdnmhAq2GIhL1OhYj4K6GoEQxZTVxiMILtBwlDCMSN2lhJBAo7K4gbsLdtIQIdoiZW4gACKyI5947YdECBYzKk97q9qYSy5RK8nxRgS4JucCMHOlw` && -`4drz5kSAAIfkECQoAAAAsAAAAACMAIwAABv9AgHBILBqPyKRRMXAon0oBpFAwQK/EA5WawHoJ2wLCazQ8FAcieDsmMgSCtNJQmCIYQ/p2QFTUxU8JYQVyAAhUEBFDEVNbBEp+YV1CglR4AFqDhUgLg1YADlRtAANhEAJQDIMNQpkPQmuIfFcMDVsQj4YFTgCdWwpkABG+C5QFQgqND5fBBwJ1igfRVAOfUFIhCdaYA5NC` && -`BgO5QwcGBAabBxoZ6xQmGCGoTwcECg2+BQviGOv8/BQeJbYNcVBqUJh4HvopXIfhSMFGBmdxWLjOBAkOm9wwucdGHIQNJih8IDEhwaUDvPJkcfDAXoMHGQEwOJARQoUReNJoQSAuGCWdDBs+dABgQESaB1O0+VQgYYNTD2kWYGCViUocLyGcOv1wDECHCyGQQVwgEEmID1o3aBDCQMIFo0I4EnqiIK3TeAkuSJDAywFEQ` && -`EpEpP0gYggIvRdYCTkUpiyREmiDapBzQARiDuM8KSFAwqkFa0z3Sig8pJZVKAYQxBvyQLQEC2UcYwm9l7TPJAcsIIZw+0nrt8x6I4HAwZvw40WCAAAh+QQJCgAAACwAAAAAIwAjAAAG/0CAcEgsGo/IpFExcCifSgGkUDBAr8QDlZrAegnbAsJrhGgsESJ4OyYyBILDs5CpUwZDQxg/VBSmbUkkdYROQghUEGlCEVNbBE` && -`oWhHUeQwlbDEJaYQVySQQUkxkQjFSBA2EQAlAIoh+aVA9Ca4l8UA0mkxOHBYYLYQpkBpJ2mZdCCo4PmWRCAoMZEgAHaZsDVlcRDQsKzEILHyNEBgOQWQYEBp6aIhvuHiQiCIYA2EYHBArbWwvmAB0f3Al8dyGENyIOUHEKswoAhoEDP0jcZUSho4V8CkAM6OFMJyQMmPzihMBfAwwkRpyB0C1PEXvTHDzY1uDBuiEHbgpJ` && -`UMLCOpAtJZsViTDhAoYC0xDIeTAlAUwsDkBIuCDBJ4BkTjZRieOlwVQJU7sAGKAK2cUFT5EguEB1agdYYoaM3KLTCAGweC8YcoBJiIOLcZVAaDuV1M4t9BCFSUtkMNgLHdYpLiB2GifGQxiIABtinR42bhpshfKG3qwwC4wYwHzlsymhUEaWha1kjVLaT5j4w827SBAAIfkECQoAAAAsAAAAACMAIwAABv9AgHBILBqPyG` && -`TxgBlNlFBlJUMtRK9EAYWa8WC/IW7GdPgWGxYOgRjmUspDhkAATw42n81IMCyIN3UKBRAFCFASG4kfHmsABiZcFkMRhAWWjUggeYkbGEMeXA1CB5alBXVHBiOceA9CHVQUDEIDphB8UAmsGxq0VL0ABLYDWA8VnB9WjxlPAAumCmYHEx6JI2Wga5SWD7NmQhEWeBwACSIApAUDBlgEAg8OqA8aF0QGA5ijBgQGqAAhFiRI` && -`sCACwgN2QrwZOeBuwDNLCzBBuCBQ4IWLaRr4E+LAoamPuCZUHCnhIgYrRmoN+liKWLmSFTF2COEKCQMFHj8iwKRgggieCzPx1fGHcJSDBw0WNHiwEQmBpERI7fxWhEEtCNEOICjzgFCCol8YPCi1QIgCCA7QmaLzxcHHtAAG3DJbqcACsEkc1C0gSm2hIQ9LNY3K0ptbS4b3GlIiwBaucqXgAkDwEW+RxqX6CqFsKcGQdK` && -`UsR+VcU4gBU4sTNrD0OMkBAwqFCCNrxIBoLKdLpaaa5OFc3kpmbwUOBWc+4siJBAEAIfkECQoAAAAsAAAAACMAIwAABv9AgHBILBqPyGTx0LlAlFCl6LPZDKJYYsRT3Vyy4EV3QzqAi4LQgkEUd0fm4QKDUUAVksvF4hg2xhhEEhmEJgZKIBcSeRZsAAwkVR8cQyKElyBKC4qLF5RCF1QbD0IDl5ekSQcWnHl2ACFVJI4b` && -`pxkaURF5nR1CChsfIkIcthtxUBFNihcJj5EFjxSnGI5YBwuse2YXG4cXlyMNZ0MGIRIY4gohAAKEH0/WBgTVQg4dmUMQGxPHAAfyBvqxK0BwAQIBBI4JHPJPQYMFBAssIDBEQMSLEhP0OeJgAEaMAkp9jAgBwqsiHgtAGFngCgACIxc0eEARCQMFAyBiRFATgIGeAQhkPnDQT+Ahhg4ePJy5EImDh0QOFOA5rggDjyb9IT` && -`DzYGWCo2cYPIi4wBeEPlIjCmjqFOPGARBCAlCwsiBYJQ7qEhTnjyACORjZMvzoyEHEwnqnQrFIUi6ABBE3AkCA8a4RxnuJUCbYTEjaiJaXbE4lxMDFv0MYNCDoWJUBei8vli1iIDQY0xFRV9VEMO5uKDCnCv7ta0BP4siLBAEAIfkECQoAAAAsAAAAACMAIwAABv9AgHBILBqPyKQRwkkon8rQRSJRQK9Eg2V64WC/DypV9` && -`DUaHooDMSwWqYcJkcjxNBQgBQRjqBBfJkQTGxsfJHtJCQWKim8HIlwLQxwfg4ORSQqLik5CHFMSEUIKlZWhSguaBQZCDRcXbkIYpB8lUAypDUIErhBCCJSDHxhvTwwNixAEAI4XTgcjpBPEVwqoeUIgF2oTwBICZUMHD3ehBLkRgxgDWAcGBIdDxpysGAXEBwIQIQV0RAKLCxAIIDANST5ZFDIopBDizb9UihYk6GekwwaF` && -`GDNmwCBkAERkEKwUOXBRo0YPuj4uaPBA2ZEDBSSU1GgCxBADAxCsfOBgWsGXVULwdajwgcKHCqagOGhwKWgeoOEOFEzCwGPIZQjUPMCTAN4XBuMiioJAB+aib18cpOo3AAJaBXgiQlXiIK6iXMsUIRhibdHUkRAPqVUk2O41JQ8VuYWziCKCVHONJC6A19eieWYXRR75uMCDLJr2xjtWAK2Sdl4BENDU9ObmL3YWiQb3xNpi` && -`2k9W5/mLu4iCAS57C0cSBAA7AAAAAAAAAAAA) 50% 50% no-repeat;` && |\n| && -` z-index: 3;` && |\n| && -` border-radius: 5px;` && |\n| && -` line-height: 3;` && |\n| && -`}` && |\n| && -`#get_image b {` && |\n| && -` display: block;` && |\n| && -` font-size: 25px;` && |\n| && -` margin: 10px 0;` && |\n| && -`}` && |\n| && -`#get_image label {` && |\n| && -` display: block;` && |\n| && -` margin-bottom: 5px;` && |\n| && -`}` && |\n| && -`#button {` && |\n| && -` margin-top: 20px;` && |\n| && -` font-size: 21px;` && |\n| && -`}` && |\n| && -`#dropzone {` && |\n| && -` border: 2px dashed #999;` && |\n| && -` width: 200px;` && |\n| && -` height: 200px;` && |\n| && -` background: #FAFAFA url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACkAAAAiCAYAAADCp/A1AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAApjAAAKYwGDMomsAAAAB3RJTUUH3AkYCxg3B2a5QgAAAKtJREFUWMPt17sNgDAMRdE8tsj+w2UM6CiQEv9jIvm1COl0uUZbbIxxt03rvWP27Wo` && -`HrJCFLGQhC1nIQr7DzohQI3fXjqaOkJFl0nxDVj9K+hKZocsNYGQXOafQ8YfTgTohcMKNA+rnHdAVkIWMhlJANjIKygGKkN5QLlCM9IJKgCqkFSoFqpFaqAZoQkqhWqAZyYVagC5ICmoFuiFnUA+gK/IL9QKGLOJlegBB2VeWydvIHgAAAABJRU5ErkJggg==) 50% 50% no-repeat;` && |\n| && -` overflow: hidden;` && |\n| && -` text-align: center;` && |\n| && -` line-height: 200px;` && |\n| && -` position: relative;` && |\n| && -`}` && |\n| && -`.error#dropzone {` && |\n| && -` border: 2px dashed #F00;` && |\n| && -`}` && |\n| && -`.clear_button {` && |\n| && -` display: block;` && |\n| && -` height: 16px;` && |\n| && -` width: 16px;` && |\n| && -` position: absolute;` && |\n| && -` top: 6px;` && |\n| && -` right: 6px;` && |\n| && -` line-height: 1 !important;` && |\n| && -` overflow: hidden;` && |\n| && -` cursor: pointer;` && |\n| && -` text-indent: -9999px;` && |\n| && -` background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAD1QAAA9UBZ3cOpgAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAG4SURBVDiNrZOxattQFIa/c5UMtsBbIbMRQZ7iyFC/QjEesqoPY` && -`PAUsnQoaAp472RI92jJEGjaNwjFpY68RWQIXQoudocKVEPj29shuo6Fm9JCv/Gi7+ic/54rxhjWaX5o7jo/nedAC6EFgGEMjLXSp5Onk5v178UWEESCUXAIDIAKv2cBvLxqX70y3ItijEEQ2R/tXwjSeUQsYTDvknbSNRijAIJRcChIp+E2iOoRXtXbkLyqR1SPaLgNBOkU3SJ7o71dxzgToBLVIw6eHJAtM/ppnzRPAfBdn` && -`6E/pLZV43x2zvHtMcBCi26qIrAKQDyNyZYZta0aQ3+I7/olOVtmxNPYNlVxcEIJ3gdvELr2dF3IdQ6A67gbXRVhXKjVVRWkeUo/7ZPrHNdxcR2XXOebMoDQUn+T+p9QxZKssCPYP9tObCYlDGMFDwW8qlcKrHfdo3fdKwVbumLFR6WVPuV+wwh3wpVsZ7aZ2CLhTmj1hUbHzvT19OvJ55MceDb7MUOJYvBpwM33h5Wf3825` && -`/HbJttrm7MsZ87s5wIuknbz9P6tsMCZpJ13gyI7zCAvgyMqw9hot//qcfwEDGehh48P3mQAAAABJRU5ErkJggg==);` && |\n| && -` z-index: 2;` && |\n| && -`}` && |\n| && -`#dropzone img {` && |\n| && -` max-width: 100%;` && |\n| && -` max-height: 100%;` && |\n| && -` vertical-align: middle;` && |\n| && -`}` && |\n| && -`#url_wrapper {` && |\n| && -` position: relative;` && |\n| && -` display: block;` && |\n| && -`}` && |\n| && -`#url {` && |\n| && -` border: 2px solid #999;` && |\n| && -` border-radius: 3px;` && |\n| && -` background: #FFF;` && |\n| && -` padding: 2px 25px 2px 5px;` && |\n| && -` width: 100%;` && |\n| && -` box-shadow: 1px 1px 3px rgba(0,0,0,0.2) inset;` && |\n| && -` -webkit-box-sizing: border-box;` && |\n| && -` -moz-box-sizing: border-box;` && |\n| && -` box-sizing: border-box;` && |\n| && -`}` && |\n| && -`.error#url {` && |\n| && -` border: 2px solid #F00;` && |\n| && -`}` && |\n| && -`#edit_details {` && |\n| && -` position: absolute;` && |\n| && -` top: 100px;` && |\n| && -` left: 100px;` && |\n| && -` background: rgba(0,0,0,0.9);` && |\n| && -` border-radius: 5px;` && |\n| && -` padding: 10px;` && |\n| && -` box-shadow: rgba(0,0,0,0.2) 0 0 2px 1px;` && |\n| && -` display: none;` && |\n| && -` z-index: 1000;` && |\n| && -` color: #FFF;` && |\n| && -` font-size: 0px;` && |\n| && -`}` && |\n| && -`#edit_details h5 {` && |\n| && -` margin-bottom: 10px;` && |\n| && -` font-size: 14px;` && |\n| && -` cursor: move;` && |\n| && -`}` && |\n| && -`.changed#edit_details h5, p.changed label {` && |\n| && -` color: #32c832;` && |\n| && -`}` && |\n| && -`#edit_details p {` && |\n| && -` margin-bottom: 10px;` && |\n| && -`}` && |\n| && -`#edit_details label {` && |\n| && -` font-size: 11px;` && |\n| && -` display: block;` && |\n| && -` margin-bottom: 2px;` && |\n| && -`}` && |\n| && -`#edit_details input[type=text] {` && |\n| && -` background: #FFF;` && |\n| && -` font-size: 12px;` && |\n| && -` font-family: sans-serif;` && |\n| && -` padding: 2px 5px;` && |\n| && -` width: 120px;` && |\n| && -` border-radius: 5px;` && |\n| && -` box-shadow: rgba(0,0,0,0.5) 0 1px 2px inset;` && |\n| && -`}` && |\n| && -`.changed#edit_details button {` && |\n| && -` box-shadow: rgba(50,200,50,1) 0 0 1px 2px;` && |\n| && -`}` && |\n| && -`#help {` && |\n| && -` display: none;` && |\n| && -` width: 400px;` && |\n| && -` border-radius: 3px;` && |\n| && -` background: #FFF;` && |\n| && -` position: absolute;` && |\n| && -` top: 35px;` && |\n| && -` left: 50%;` && |\n| && -` margin-left: -200px;` && |\n| && -` z-index: 1003;` && |\n| && -` box-shadow: rgba(0,0,0,0.2) 0 0 2px 2px;` && |\n| && -`}` && |\n| && -`#help .txt {` && |\n| && -` padding: 20px 20px 5px;` && |\n| && -` line-height: 1.4;` && |\n| && -`}` && |\n| && -`.txt p {` && |\n| && -` margin-bottom: 3px;` && |\n| && -`}` && |\n| && -`#help section {` && |\n| && -` margin-bottom: 20px;` && |\n| && -`}` && |\n| && -`#help .close_button {` && |\n| && -` background: #000 url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAACbgAAAm4Bt/774AAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAABKSURBVAiZdc2xDYAwAAPBA0ViiQxKR6hgCMZjCSpTEAkavnxL` && -`7yHJgRPNQ0MtXS6Y+jBjlUSSLS9bEqMfSm/O2D+pq6Bi/ZxfqDfkbiIp0Zzd1AAAAABJRU5ErkJggg==) 50% 50% no-repeat;` && |\n| && -` box-shadow: 0 0 1px #EEE inset;` && |\n| && -` border-radius: 2px;` && |\n| && -`}` && |\n| && -`#help h2 {` && |\n| && -` margin-bottom: 5px;` && |\n| && -`}` && |\n| && -`#help footer {` && |\n| && -` color: #999;` && |\n| && -` font-size: 10px;` && |\n| && -` padding: 0 20px 20px;` && |\n| && -` line-height: 1.3;` && |\n| && -`}` && |\n| && -`#help footer a {` && |\n| && -` color: #777;` && |\n| && -` text-decoration: underline;` && |\n| && -`}` && |\n| && -`.key {` && |\n| && -` background: #F5F5F5;` && |\n| && -` color: #555;` && |\n| && -` text-shadow: 0 0 1px #EEE;` && |\n| && -` padding: 1px 5px;` && |\n| && -` border: 1px solid #CCC;` && |\n| && -` border-radius: 3px;` && |\n| && -` display: inline-block;` && |\n| && -` min-width: 16px;` && |\n| && -` text-align: center;` && |\n| && -` font-size: 11px;` && |\n| && -` box-shadow: 1px 1px 0 rgba(255,255,255,1) inset, -1px -1px 0 rgba(0,0,0,0.08) inset;` && |\n| && -` overflow: hidden;` && |\n| && -` cursor: default;` && |\n| && -` vertical-align: middle;` && |\n| && -`}` && |\n| && -`.key:active {` && |\n| && -` padding: 2px 5px 0;` && |\n| && -` box-shadow: 1px 1px 0 rgba(0,0,0,0.08) inset, -1px -1px 0 rgba(255,255,255,1) inset;` && |\n| && -`}` && |\n| && -`#overlay {` && |\n| && -` position: fixed;` && |\n| && -` top: 0;` && |\n| && -` left: 0;` && |\n| && -` width: 100%;` && |\n| && -` height: 100%;` && |\n| && -` z-index: 1002;` && |\n| && -` background: #000;` && |\n| && -` opacity: 0.5;` && |\n| && -` display: none;` && |\n| && -`}` && |\n| && -`#from_html_wrapper {` && |\n| && -` display: none;` && |\n| && -` width: 500px;` && |\n| && -` border-radius: 5px;` && |\n| && -` background: rgba(0,0,0,0.9);` && |\n| && -` position: absolute;` && |\n| && -` top: 35px;` && |\n| && -` left: 50%;` && |\n| && -` margin-left: -250px;` && |\n| && -` z-index: 1002;` && |\n| && -` color: #FFF;` && |\n| && -`}` && |\n| && -`#from_html_wrapper .close_button {` && |\n| && -` background: #000 url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAACbgAAAm4Bt/774AAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAABKSURBVAiZdc2xDYAwAAPBA0ViiQxKR6hgCMZjCSpTEAkavnxL7yHJgR` && -`PNQ0MtXS6Y+jBjlUSSLS9bEqMfSm/O2D+pq6Bi/ZxfqDfkbiIp0Zzd1AAAAABJRU5ErkJggg==) 50% 50% no-repeat;` && |\n| && -` box-shadow: 0 0 1px #EEE inset;` && |\n| && -` border-radius: 2px;` && |\n| && -`}` && |\n| && -`#from_html_form {` && |\n| && -` padding: 20px;` && |\n| && -`}` && |\n| && -`#from_html_form h5 {` && |\n| && -` margin-bottom: 15px;` && |\n| && -`}` && |\n| && -`#from_html_form label {` && |\n| && -` display: block;` && |\n| && -` font-size: 12px;` && |\n| && -`}` && |\n| && -`#from_html_form textarea {` && |\n| && -` border: 0px;` && |\n| && -` border-radius: 3px;` && |\n| && -` background: #FFF;` && |\n| && -` padding: 2px 5px;` && |\n| && -` margin-bottom: 5px;` && |\n| && -` width: 100%;` && |\n| && -` height: 100px;` && |\n| && -` box-shadow: 1px 1px 3px rgba(0,0,0,0.2) inset;` && |\n| && -` -webkit-box-sizing: border-box;` && |\n| && -` -moz-box-sizing: border-box;` && |\n| && -` box-sizing: border-box; ` && |\n| && -` font-family: monospace;` && |\n| && -` font-size: 11px;` && |\n| && -` line-height: 1.3;` && |\n| && -`}` && |\n| && -`` && |\n| && -`/* CSS for SVG-elements */` && |\n| && -`` && |\n| && -`#svg {` && |\n| && -` position: absolute;` && |\n| && -` top: 0;` && |\n| && -` left: 0;` && |\n| && -` z-index: 2;` && |\n| && -` display: inline-block;` && |\n| && -`}` && |\n| && -`#svg rect {` && |\n| && -` stroke-width: 3px;` && |\n| && -` stroke: #F00;` && |\n| && -` fill: rgba(255,255,255,0.3);` && |\n| && -`}` && |\n| && -`#svg rect.with_href {` && |\n| && -` fill: rgba(0,0,0,0.3);` && |\n| && -`}` && |\n| && -`.edit > #svg rect:hover {` && |\n| && -` fill: rgba(50,200,50,0.3);` && |\n| && -`}` && |\n| && -`#svg rect.active {` && |\n| && -` fill: rgba(0,0,0,0.5);` && |\n| && -`}` && |\n| && -`#svg circle {` && |\n| && -` stroke-width: 3px;` && |\n| && -` stroke: #0F0;` && |\n| && -` fill: rgba(255,255,255,0.3);` && |\n| && -`}` && |\n| && -`#svg circle.with_href {` && |\n| && -` fill: rgba(0,0,0,0.3);` && |\n| && -`}` && |\n| && -`.edit > #svg circle:hover {` && |\n| && -` fill: rgba(50,200,50,0.3);` && |\n| && -`}` && |\n| && -`#svg polyline, #svg polygon {` && |\n| && -` stroke-width: 3px;` && |\n| && -` stroke: #00F;` && |\n| && -` fill: rgba(255,255,255,0.3);` && |\n| && -`}` && |\n| && -`#svg polygon.with_href {` && |\n| && -` fill: rgba(0,0,0,0.3);` && |\n| && -`}` && |\n| && -`.edit > #svg polygon:hover {` && |\n| && -` fill: rgba(50,200,50,0.3);` && |\n| && -`}` && |\n| && -`#svg .selected {` && |\n| && -` fill: rgba(50,200,50,0.5) !important;` && |\n| && -`}` && |\n| && -`#svg rect.helper {` && |\n| && -` fill: #FFF;` && |\n| && -` stroke: #000;` && |\n| && -` stroke-width: 2px;` && |\n| && -`}` && |\n| && -`#svg rect.helper:hover {` && |\n| && -` fill: #F00; ` && |\n| && -`}` && |\n| && -`.edit > #svg rect, .edit > #svg circle, .edit > #svg polygon {` && |\n| && -` cursor: move;` && |\n| && -`}` && |\n| && -`.edit > #svg .pointer {` && |\n| && -` cursor: pointer;` && |\n| && -`}` && |\n| && -`.edit > #svg .e-resize {` && |\n| && -` cursor: e-resize;` && |\n| && -`}` && |\n| && -`.edit > #svg .ne-resize {` && |\n| && -` cursor: ne-resize;` && |\n| && -`}` && |\n| && -`.edit > #svg .nw-resize {` && |\n| && -` cursor: nw-resize;` && |\n| && -`}` && |\n| && -`.edit > #svg .n-resize {` && |\n| && -` cursor: n-resize;` && |\n| && -`}` && |\n| && -`.edit > #svg .se-resize {` && |\n| && -` cursor: se-resize;` && |\n| && -`}` && |\n| && -`.edit > #svg .sw-resize {` && |\n| && -` cursor: sw-resize;` && |\n| && -`}` && |\n| && -`.edit > #svg .s-resize {` && |\n| && -` cursor: s-resize;` && |\n| && -`}` && |\n| && -`.edit > #svg .w-resize {` && |\n| && -` cursor: w-resize;` && |\n| && -`}`. -ENDMETHOD. + METHOD load_editor_css. + result = `` && |\n| && + `html, body, div, span, applet, object, h1, h2, h3, h4, h5, h6, p, a, em, img, strong, ol, ul, li, dl, dd, dt, form, label, input, article, aside, canvas, details, embed, figure, figcaption, footer, header, menu, nav, section, time, mark {` && |\n| && + ` margin: 0;` && |\n| && + ` padding: 0;` && |\n| && + ` border: 0;` && |\n| && + ` outline: 0;` && |\n| && + ` font-style: inherit;` && |\n| && + ` font-size: 100%;` && |\n| && + ` font-family: inherit;` && |\n| && + ` vertical-align: baseline;` && |\n| && + ` background: transparent;` && |\n| && + `}` && |\n| && + `:focus {` && |\n| && + ` outline: 0;` && |\n| && + `}` && |\n| && + `ul, ol {` && |\n| && + ` list-style: none;` && |\n| && + `}` && |\n| && + `html {` && |\n| && + ` height: 100%;` && |\n| && + `}` && |\n| && + `body {` && |\n| && + ` padding: 0;` && |\n| && + ` margin: 0;` && |\n| && + ` font-family: Arial, Tahoma, sans-serif;` && |\n| && + ` font-size: 14px;` && |\n| && + ` color: #000;` && |\n| && + ` height: 100%;` && |\n| && + ` min-height: 100%;` && |\n| && + ` background: #FFF url(data:image/gif;base64,R0lGODlhCgAKAIABANzc3P///yH+EUNyZWF0ZWQgd2l0aCBHSU1QACwAAAAACgAKAAACEYQdmYcaDNxjEspKndVZbc8UADs=);` && |\n| && + ` line-height: 1;` && |\n| && + ` overflow-y: scroll;` && |\n| && + `}` && |\n| && + `img {` && |\n| && + ` border: 0;` && |\n| && + `}` && |\n| && + `a:link, a:visited {` && |\n| && + ` outline: none;` && |\n| && + ` text-decoration: none;` && |\n| && + ` color: #000;` && |\n| && + `}` && |\n| && + `.clear {` && |\n| && + ` clear: both;` && |\n| && + `}` && |\n| && + `.clearfix:after {` && |\n| && + ` content: ".";` && |\n| && + ` display: block;` && |\n| && + ` clear: both;` && |\n| && + ` visibility: hidden;` && |\n| && + ` line-height: 0;` && |\n| && + ` height: 0;` && |\n| && + `}` && |\n| && + `#noscript {` && |\n| && + ` text-align: center;` && |\n| && + ` display: block;` && |\n| && + ` font-size: 20px;` && |\n| && + ` padding: 5px 0;` && |\n| && + ` background: #F00;` && |\n| && + `}` && |\n| && + `#header {` && |\n| && + ` background: #000;` && |\n| && + ` padding: 5px 0;` && |\n| && + ` position: fixed;` && |\n| && + ` z-index: 1001;` && |\n| && + ` width: 100%;` && |\n| && + ` box-shadow: rgba(0,0,0,0.2) 0 0 2px 2px;` && |\n| && + `}` && |\n| && + `#logo {` && |\n| && + ` margin-right: 10px;` && |\n| && + ` margin-left: 10px;` && |\n| && + ` margin-top: -4px;` && |\n| && + ` margin-bottom: -4px;` && |\n| && + ` display: inline-block;` && |\n| && + ` vertical-align: top;` && |\n| && + `}` && |\n| && + `#logo a:link, #logo a:visited {` && |\n| && + ` color: #32c832;` && |\n| && + `}` && |\n| && + `#logo a:hover {` && |\n| && + ` color: #FFF;` && |\n| && + `}` && |\n| && + `#logo img {` && |\n| && + ` display: block;` && |\n| && + `}` && |\n| && + `#nav, #nav ul {` && |\n| && + ` display: inline;` && |\n| && + ` vertical-align: middle;` && |\n| && + `}` && |\n| && + `#nav li {` && |\n| && + ` margin-right: 5px;` && |\n| && + ` display: inline;` && |\n| && + `}` && |\n| && + `#nav a:link, #nav a:visited {` && |\n| && + ` border: 1px solid #FFF;` && |\n| && + ` border-radius: 3px;` && |\n| && + ` font-size: 10px;` && |\n| && + ` padding: 5px 10px;` && |\n| && + ` display: inline-block;` && |\n| && + ` color: #FFF;` && |\n| && + `}` && |\n| && + `#nav a:hover, #nav a:active {` && |\n| && + ` border: 1px solid #32c832;` && |\n| && + ` color: #32c832;` && |\n| && + `}` && |\n| && + `#nav a:active, #nav .selected a {` && |\n| && + ` background: #FFF;` && |\n| && + ` color: #000;` && |\n| && + ` box-shadow: 0 0 1px #222 inset;` && |\n| && + ` border: 1px solid #FFF;` && |\n| && + `}` && |\n| && + `#coords {` && |\n| && + ` position: absolute;` && |\n| && + ` top: 10px;` && |\n| && + ` right: 15px;` && |\n| && + ` color: #FFF;` && |\n| && + ` font-size: 11px;` && |\n| && + `}` && |\n| && + `#debug {` && |\n| && + ` color: #EEE;` && |\n| && + ` position: absolute;` && |\n| && + ` top: 10px;` && |\n| && + ` right: 100px;` && |\n| && + ` z-index: 1001;` && |\n| && + ` font-size: 11px;` && |\n| && + `}` && |\n| && + `#wrapper {` && |\n| && + ` position: relative;` && |\n| && + `}` && |\n| && + `#image_wrapper {` && |\n| && + ` padding: 45px 0 10px;` && |\n| && + `}` && |\n| && + `#image {` && |\n| && + ` position: relative;` && |\n| && + ` overflow: hidden;` && |\n| && + ` display: block;` && |\n| && + ` margin: 0 auto;` && |\n| && + ` border-radius: 3px;` && |\n| && + ` box-shadow: rgba(0,0,0,0.2) 0 0 2px 2px;` && |\n| && + ` display: none;` && |\n| && + `}` && |\n| && + `.draw#image {` && |\n| && + ` cursor: crosshair;` && |\n| && + `}` && |\n| && + `#image map {` && |\n| && + ` position: absolute;` && |\n| && + ` top: 0;` && |\n| && + ` left: 0;` && |\n| && + ` width: 100%;` && |\n| && + ` height: 100%;` && |\n| && + ` display: block;` && |\n| && + `}` && |\n| && + `#img {` && |\n| && + ` position: relative;` && |\n| && + ` z-index: 1;` && |\n| && + `}` && |\n| && + `#code {` && |\n| && + ` background: rgba(0,0,0,0.9);` && |\n| && + ` color: #FFF;` && |\n| && + ` font-family: monospace;` && |\n| && + ` font-size: 11px;` && |\n| && + ` line-height: 1.3;` && |\n| && + ` width: 600px;` && |\n| && + ` position: fixed;` && |\n| && + ` left: 3%;` && |\n| && + ` width: 94%;` && |\n| && + ` bottom: 10px;` && |\n| && + ` z-index: 1000;` && |\n| && + ` box-shadow: rgba(0,0,0,0.2) 0 0 2px 2px;` && |\n| && + ` display: none;` && |\n| && + ` border-radius: 3px;` && |\n| && + `}` && |\n| && + `#code_content {` && |\n| && + ` padding: 10px;` && |\n| && + `}` && |\n| && + `.close_button {` && |\n| && + ` width: 10px;` && |\n| && + ` height: 10px;` && |\n| && + ` display: block;` && |\n| && + ` background: #FFF url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAACbgAAAm4Bt/774AAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAABKSURBVAiZfc2xCYBAFATR90WwiSvUzDOyCcuzCaM1UMHIg` && + `c1mmcKOI0mHqupoIw4sVTW5mbFKAhvybEti8EN/zc+zj2hYP/ET7QIK9BpShkyrPwAAAABJRU5ErkJggg==) 50% 50% no-repeat;` && |\n| && + ` position: absolute;` && |\n| && + ` top: 10px;` && |\n| && + ` right: 10px;` && |\n| && + ` box-shadow: 0 0 1px #222 inset;` && |\n| && + ` border-radius: 1px;` && |\n| && + ` cursor: pointer;` && |\n| && + `}` && |\n| && + `#about {` && |\n| && + ` position: absolute;` && |\n| && + ` top: 10px;` && |\n| && + ` left: 0;` && |\n| && + ` width: 100%;` && |\n| && + ` font-family: 'News Cycle';` && |\n| && + ` font-size: 24px;` && |\n| && + ` background: transparent;` && |\n| && + ` padding: 2px 10px 5px;` && |\n| && + ` -o-box-sizing: border-box;` && |\n| && + ` -moz-box-sizing: border-box;` && |\n| && + ` -webkit-box-sizing: border-box;` && |\n| && + ` box-sizing: border-box;` && |\n| && + ` color: #000;` && |\n| && + `}` && |\n| && + `#get_image_wrapper {` && |\n| && + ` padding: 35px 0;` && |\n| && + ` position: relative;` && |\n| && + ` z-index: 1002;` && |\n| && + ` display: none;` && |\n| && + `}` && |\n| && + `#get_image {` && |\n| && + ` width: 200px;` && |\n| && + ` margin: 0 auto;` && |\n| && + ` font-size: 16px;` && |\n| && + ` text-align: center;` && |\n| && + ` background: #FFF;` && |\n| && + ` padding: 20px 30px;` && |\n| && + ` border-radius: 5px;` && |\n| && + ` box-shadow: rgba(0,0,0,0.2) 0 0 2px 2px;` && |\n| && + ` position: relative;` && |\n| && + `}` && |\n| && + `#get_image .close_button {` && |\n| && + ` background: #000 url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAACbgAAAm4Bt/774AAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAABKSURBVAiZdc2xDYAwAAPBA0ViiQxKR6hgCMZjCSpTEAkavnxL7yH` && + `JgRPNQ0MtXS6Y+jBjlUSSLS9bEqMfSm/O2D+pq6Bi/ZxfqDfkbiIp0Zzd1AAAAABJRU5ErkJggg==) 50% 50% no-repeat;` && |\n| && + ` box-shadow: 0 0 1px #EEE inset;` && |\n| && + ` border-radius: 2px;` && |\n| && + `}` && |\n| && + `#logo_get_image {` && |\n| && + ` margin-bottom: 20px;` && |\n| && + `}` && |\n| && + `#loading {` && |\n| && + ` position: absolute;` && |\n| && + ` top: 0;` && |\n| && + ` left: 0;` && |\n| && + ` width: 100%;` && |\n| && + ` height: 100%;` && |\n| && + ` text-align: center;` && |\n| && + ` font-size: 20px;` && |\n| && + ` background: rgba(255,255,255,0.95) url(data:image/gif;base64,R0lGODlhIwAjAPUAAP///zLIMuL24tn02fH68czwzPL78vr9+tLy0tz13Of458/xz/f899fz1+z57N/138Xvxer46pfil7LqsjvKO33bfZ3knZPhk4rfijLIMoDcgGPVY7jruKrnqm3XbVXRVbzsvL3svaXmpXDYcHfad6jnqEj` && + `NSAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCgAAACwAAAAAIwAjAAAG/0CAcEgsGo/IpFExcCifSgGkUDBAr8QDlZrAegnbAsJr` && + `NDwUByJ4OyYqIBCr0lCYIhhD+nZALEguFyJpSQlhBYMACFQQEUMIgBKRD0oKhl1ChVR4AAQXkZ8ETwuGcg5UbQATnpEXEFAMhg1CWgUCQg+rgBNYDA1bEKGJBU4HFqwSh2QKowULmAVCBZAgTmSzD3WNB40GfxMKWAcGBJtDvZdCAhOTQ9sNCwPBQwJbCwgCBIhJEQgdGB4bAnpIBoCeISoLElQzAkEDwA0fAkrcUELIg` && + `IO/IIArcgADxIkgMQhZY2hBgwfyOD7g8A/kBxLQhBgYgMDkAwf6cgIbEiGEBZcNIzSISKnEwTs3FChw0AeAqRIGFzU2RZCmQoYMG5xZY4ANoZA3ThJcvYphIRRTYaoNgGALwIWxGShofeJgyhZZTU/JhHuVXRJaYTahLbCpA98P5Y4YXNQWQKZhsyjwjYlkcQG8QhRxmTdZyQHNfgHo0TskwYerGqCIS8wpzFyZVJxiGS` && + `3G2hVmbG1DWUNVNxQmRH0LLxIEACH5BAkKAAAALAAAAAAjACMAAAb/QIBwSCwaj8ikUTFwKJ9KAaRQMECvxAOVmsB6CdsCwms0PBQHIng7JjIEgrTSUJgiGEP6dkBU1MVPCWEFcgAIVBARQxFTWwRKfmFdQoJUeABag4VIC4NWAA5UbQADYRACUAyDDUKZD0JriHxXDA1bEI+GBU4AnVsKZAAKvguUBUIKjQ+XwQcPdYo` && + `H0VQDzE8HBgTWALWTQgYDuXkCZ9sCWwsIAgSbSARSExYS8xavQueDVAsJvEYN8RcCzhsoAYKQUvkQQQBmZELACwQHXpgAK+GCBg/EGYmwAKDAgCK8gUNw8YGDTe0QfAJgoEGIDhY6hNiWxEGDNngIbBhBKJibnlILAQgw4cTChw0YvHlh8EyfkAsZOoDaQHWDiJVQQoXJ9SEDCSETjm74QGLWEweNqLASliGDCTwHPFSl` && + `yjBJpjCXJrTNMAuC2LEa2hXBhwiVkBF7pWIiMXeD2SOEC6xlaWKvh0WNHxs5cKiAPSEF9rotpEADVQtQsG0LIZqCtVqayYTea0KwTyIGKOzVcPsJiLZEeys5cMEDB+HIkQQBACH5BAkKAAAALAAAAAAjACMAAAb/QIBwSCwaj8ikUTFwKJ9KAaRQMECvxAOVmsB6CdsCwms0PBQHIng7JjIEgrTSUJgiGEP6dkBU1MVPC` && + `WEFcgAIVBARQxFTWwRKfmFdQoJUeABag4VIC4NWAA5UbQADYRACUAyDDUKZD0JriHxXDA1bEI+GBU4AnVsKZAARvguUBUIKjQ+XwQcPdYoH0VQDn1AHBgTMQrWTQgYDuUPYBAabAAJbCwgCBOdHBwQKDb4FC+Lpg1QLCbxGDqX0bUFFSiAiCMCMlGokcFasMAsaCLBmhEGEAfXYiAOHIOIDB4UYJBwSZ5yDB/QaPHgHb8` && + `IHClbSGLBgwVswIQs2ZMiAARQJoyshLlyYMNLLABI7M1DA4zIEAAMSJFyQAGHbkw5Jd04QouGDBSEFpkq1oAiKiKwZPsDasIFEmgMWxE4VhyQB2gxtILDdQLCBWKkdnmhAq2GIhL1OhYj4K6GoEQxZTVxiMILtBwlDCMSN2lhJBAo7K4gbsLdtIQIdoiZW4gACKyI5947YdECBYzKk97q9qYSy5RK8nxRgS4JucCMHOlw` && + `4drz5kSAAIfkECQoAAAAsAAAAACMAIwAABv9AgHBILBqPyKRRMXAon0oBpFAwQK/EA5WawHoJ2wLCazQ8FAcieDsmMgSCtNJQmCIYQ/p2QFTUxU8JYQVyAAhUEBFDEVNbBEp+YV1CglR4AFqDhUgLg1YADlRtAANhEAJQDIMNQpkPQmuIfFcMDVsQj4YFTgCdWwpkABG+C5QFQgqND5fBBwJ1igfRVAOfUFIhCdaYA5NC` && + `BgO5QwcGBAabBxoZ6xQmGCGoTwcECg2+BQviGOv8/BQeJbYNcVBqUJh4HvopXIfhSMFGBmdxWLjOBAkOm9wwucdGHIQNJih8IDEhwaUDvPJkcfDAXoMHGQEwOJARQoUReNJoQSAuGCWdDBs+dABgQESaB1O0+VQgYYNTD2kWYGCViUocLyGcOv1wDECHCyGQQVwgEEmID1o3aBDCQMIFo0I4EnqiIK3TeAkuSJDAywFEQ` && + `EpEpP0gYggIvRdYCTkUpiyREmiDapBzQARiDuM8KSFAwqkFa0z3Sig8pJZVKAYQxBvyQLQEC2UcYwm9l7TPJAcsIIZw+0nrt8x6I4HAwZvw40WCAAAh+QQJCgAAACwAAAAAIwAjAAAG/0CAcEgsGo/IpFExcCifSgGkUDBAr8QDlZrAegnbAsJrhGgsESJ4OyYyBILDs5CpUwZDQxg/VBSmbUkkdYROQghUEGlCEVNbBE` && + `oWhHUeQwlbDEJaYQVySQQUkxkQjFSBA2EQAlAIoh+aVA9Ca4l8UA0mkxOHBYYLYQpkBpJ2mZdCCo4PmWRCAoMZEgAHaZsDVlcRDQsKzEILHyNEBgOQWQYEBp6aIhvuHiQiCIYA2EYHBArbWwvmAB0f3Al8dyGENyIOUHEKswoAhoEDP0jcZUSho4V8CkAM6OFMJyQMmPzihMBfAwwkRpyB0C1PEXvTHDzY1uDBuiEHbgpJ` && + `UMLCOpAtJZsViTDhAoYC0xDIeTAlAUwsDkBIuCDBJ4BkTjZRieOlwVQJU7sAGKAK2cUFT5EguEB1agdYYoaM3KLTCAGweC8YcoBJiIOLcZVAaDuV1M4t9BCFSUtkMNgLHdYpLiB2GifGQxiIABtinR42bhpshfKG3qwwC4wYwHzlsymhUEaWha1kjVLaT5j4w827SBAAIfkECQoAAAAsAAAAACMAIwAABv9AgHBILBqPyG` && + `TxgBlNlFBlJUMtRK9EAYWa8WC/IW7GdPgWGxYOgRjmUspDhkAATw42n81IMCyIN3UKBRAFCFASG4kfHmsABiZcFkMRhAWWjUggeYkbGEMeXA1CB5alBXVHBiOceA9CHVQUDEIDphB8UAmsGxq0VL0ABLYDWA8VnB9WjxlPAAumCmYHEx6JI2Wga5SWD7NmQhEWeBwACSIApAUDBlgEAg8OqA8aF0QGA5ijBgQGqAAhFiRI` && + `sCACwgN2QrwZOeBuwDNLCzBBuCBQ4IWLaRr4E+LAoamPuCZUHCnhIgYrRmoN+liKWLmSFTF2COEKCQMFHj8iwKRgggieCzPx1fGHcJSDBw0WNHiwEQmBpERI7fxWhEEtCNEOICjzgFCCol8YPCi1QIgCCA7QmaLzxcHHtAAG3DJbqcACsEkc1C0gSm2hIQ9LNY3K0ptbS4b3GlIiwBaucqXgAkDwEW+RxqX6CqFsKcGQdK` && + `UsR+VcU4gBU4sTNrD0OMkBAwqFCCNrxIBoLKdLpaaa5OFc3kpmbwUOBWc+4siJBAEAIfkECQoAAAAsAAAAACMAIwAABv9AgHBILBqPyGTx0LlAlFCl6LPZDKJYYsRT3Vyy4EV3QzqAi4LQgkEUd0fm4QKDUUAVksvF4hg2xhhEEhmEJgZKIBcSeRZsAAwkVR8cQyKElyBKC4qLF5RCF1QbD0IDl5ekSQcWnHl2ACFVJI4b` && + `pxkaURF5nR1CChsfIkIcthtxUBFNihcJj5EFjxSnGI5YBwuse2YXG4cXlyMNZ0MGIRIY4gohAAKEH0/WBgTVQg4dmUMQGxPHAAfyBvqxK0BwAQIBBI4JHPJPQYMFBAssIDBEQMSLEhP0OeJgAEaMAkp9jAgBwqsiHgtAGFngCgACIxc0eEARCQMFAyBiRFATgIGeAQhkPnDQT+Ahhg4ePJy5EImDh0QOFOA5rggDjyb9IT` && + `DzYGWCo2cYPIi4wBeEPlIjCmjqFOPGARBCAlCwsiBYJQ7qEhTnjyACORjZMvzoyEHEwnqnQrFIUi6ABBE3AkCA8a4RxnuJUCbYTEjaiJaXbE4lxMDFv0MYNCDoWJUBei8vli1iIDQY0xFRV9VEMO5uKDCnCv7ta0BP4siLBAEAIfkECQoAAAAsAAAAACMAIwAABv9AgHBILBqPyKQRwkkon8rQRSJRQK9Eg2V64WC/DypV9` && + `DUaHooDMSwWqYcJkcjxNBQgBQRjqBBfJkQTGxsfJHtJCQWKim8HIlwLQxwfg4ORSQqLik5CHFMSEUIKlZWhSguaBQZCDRcXbkIYpB8lUAypDUIErhBCCJSDHxhvTwwNixAEAI4XTgcjpBPEVwqoeUIgF2oTwBICZUMHD3ehBLkRgxgDWAcGBIdDxpysGAXEBwIQIQV0RAKLCxAIIDANST5ZFDIopBDizb9UihYk6GekwwaF` && + `GDNmwCBkAERkEKwUOXBRo0YPuj4uaPBA2ZEDBSSU1GgCxBADAxCsfOBgWsGXVULwdajwgcKHCqagOGhwKWgeoOEOFEzCwGPIZQjUPMCTAN4XBuMiioJAB+aib18cpOo3AAJaBXgiQlXiIK6iXMsUIRhibdHUkRAPqVUk2O41JQ8VuYWziCKCVHONJC6A19eieWYXRR75uMCDLJr2xjtWAK2Sdl4BENDU9ObmL3YWiQb3xNpi` && + `2k9W5/mLu4iCAS57C0cSBAA7AAAAAAAAAAAA) 50% 50% no-repeat;` && |\n| && + ` z-index: 3;` && |\n| && + ` border-radius: 5px;` && |\n| && + ` line-height: 3;` && |\n| && + `}` && |\n| && + `#get_image b {` && |\n| && + ` display: block;` && |\n| && + ` font-size: 25px;` && |\n| && + ` margin: 10px 0;` && |\n| && + `}` && |\n| && + `#get_image label {` && |\n| && + ` display: block;` && |\n| && + ` margin-bottom: 5px;` && |\n| && + `}` && |\n| && + `#button {` && |\n| && + ` margin-top: 20px;` && |\n| && + ` font-size: 21px;` && |\n| && + `}` && |\n| && + `#dropzone {` && |\n| && + ` border: 2px dashed #999;` && |\n| && + ` width: 200px;` && |\n| && + ` height: 200px;` && |\n| && + ` background: #FAFAFA url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACkAAAAiCAYAAADCp/A1AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAApjAAAKYwGDMomsAAAAB3RJTUUH3AkYCxg3B2a5QgAAAKtJREFUWMPt17sNgDAMRdE8tsj+w2UM6CiQEv9jIvm1COl0uUZbbIxxt03rvWP27Wo` && + `HrJCFLGQhC1nIQr7DzohQI3fXjqaOkJFl0nxDVj9K+hKZocsNYGQXOafQ8YfTgTohcMKNA+rnHdAVkIWMhlJANjIKygGKkN5QLlCM9IJKgCqkFSoFqpFaqAZoQkqhWqAZyYVagC5ICmoFuiFnUA+gK/IL9QKGLOJlegBB2VeWydvIHgAAAABJRU5ErkJggg==) 50% 50% no-repeat;` && |\n| && + ` overflow: hidden;` && |\n| && + ` text-align: center;` && |\n| && + ` line-height: 200px;` && |\n| && + ` position: relative;` && |\n| && + `}` && |\n| && + `.error#dropzone {` && |\n| && + ` border: 2px dashed #F00;` && |\n| && + `}` && |\n| && + `.clear_button {` && |\n| && + ` display: block;` && |\n| && + ` height: 16px;` && |\n| && + ` width: 16px;` && |\n| && + ` position: absolute;` && |\n| && + ` top: 6px;` && |\n| && + ` right: 6px;` && |\n| && + ` line-height: 1 !important;` && |\n| && + ` overflow: hidden;` && |\n| && + ` cursor: pointer;` && |\n| && + ` text-indent: -9999px;` && |\n| && + ` background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAD1QAAA9UBZ3cOpgAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAG4SURBVDiNrZOxattQFIa/c5UMtsBbIbMRQZ7iyFC/QjEesqoPY` && + `PAUsnQoaAp472RI92jJEGjaNwjFpY68RWQIXQoudocKVEPj29shuo6Fm9JCv/Gi7+ic/54rxhjWaX5o7jo/nedAC6EFgGEMjLXSp5Onk5v178UWEESCUXAIDIAKv2cBvLxqX70y3ItijEEQ2R/tXwjSeUQsYTDvknbSNRijAIJRcChIp+E2iOoRXtXbkLyqR1SPaLgNBOkU3SJ7o71dxzgToBLVIw6eHJAtM/ppnzRPAfBdn` && + `6E/pLZV43x2zvHtMcBCi26qIrAKQDyNyZYZta0aQ3+I7/olOVtmxNPYNlVxcEIJ3gdvELr2dF3IdQ6A67gbXRVhXKjVVRWkeUo/7ZPrHNdxcR2XXOebMoDQUn+T+p9QxZKssCPYP9tObCYlDGMFDwW8qlcKrHfdo3fdKwVbumLFR6WVPuV+wwh3wpVsZ7aZ2CLhTmj1hUbHzvT19OvJ55MceDb7MUOJYvBpwM33h5Wf3825` && + `/HbJttrm7MsZ87s5wIuknbz9P6tsMCZpJ13gyI7zCAvgyMqw9hot//qcfwEDGehh48P3mQAAAABJRU5ErkJggg==);` && |\n| && + ` z-index: 2;` && |\n| && + `}` && |\n| && + `#dropzone img {` && |\n| && + ` max-width: 100%;` && |\n| && + ` max-height: 100%;` && |\n| && + ` vertical-align: middle;` && |\n| && + `}` && |\n| && + `#url_wrapper {` && |\n| && + ` position: relative;` && |\n| && + ` display: block;` && |\n| && + `}` && |\n| && + `#url {` && |\n| && + ` border: 2px solid #999;` && |\n| && + ` border-radius: 3px;` && |\n| && + ` background: #FFF;` && |\n| && + ` padding: 2px 25px 2px 5px;` && |\n| && + ` width: 100%;` && |\n| && + ` box-shadow: 1px 1px 3px rgba(0,0,0,0.2) inset;` && |\n| && + ` -webkit-box-sizing: border-box;` && |\n| && + ` -moz-box-sizing: border-box;` && |\n| && + ` box-sizing: border-box;` && |\n| && + `}` && |\n| && + `.error#url {` && |\n| && + ` border: 2px solid #F00;` && |\n| && + `}` && |\n| && + `#edit_details {` && |\n| && + ` position: absolute;` && |\n| && + ` top: 100px;` && |\n| && + ` left: 100px;` && |\n| && + ` background: rgba(0,0,0,0.9);` && |\n| && + ` border-radius: 5px;` && |\n| && + ` padding: 10px;` && |\n| && + ` box-shadow: rgba(0,0,0,0.2) 0 0 2px 1px;` && |\n| && + ` display: none;` && |\n| && + ` z-index: 1000;` && |\n| && + ` color: #FFF;` && |\n| && + ` font-size: 0px;` && |\n| && + `}` && |\n| && + `#edit_details h5 {` && |\n| && + ` margin-bottom: 10px;` && |\n| && + ` font-size: 14px;` && |\n| && + ` cursor: move;` && |\n| && + `}` && |\n| && + `.changed#edit_details h5, p.changed label {` && |\n| && + ` color: #32c832;` && |\n| && + `}` && |\n| && + `#edit_details p {` && |\n| && + ` margin-bottom: 10px;` && |\n| && + `}` && |\n| && + `#edit_details label {` && |\n| && + ` font-size: 11px;` && |\n| && + ` display: block;` && |\n| && + ` margin-bottom: 2px;` && |\n| && + `}` && |\n| && + `#edit_details input[type=text] {` && |\n| && + ` background: #FFF;` && |\n| && + ` font-size: 12px;` && |\n| && + ` font-family: sans-serif;` && |\n| && + ` padding: 2px 5px;` && |\n| && + ` width: 120px;` && |\n| && + ` border-radius: 5px;` && |\n| && + ` box-shadow: rgba(0,0,0,0.5) 0 1px 2px inset;` && |\n| && + `}` && |\n| && + `.changed#edit_details button {` && |\n| && + ` box-shadow: rgba(50,200,50,1) 0 0 1px 2px;` && |\n| && + `}` && |\n| && + `#help {` && |\n| && + ` display: none;` && |\n| && + ` width: 400px;` && |\n| && + ` border-radius: 3px;` && |\n| && + ` background: #FFF;` && |\n| && + ` position: absolute;` && |\n| && + ` top: 35px;` && |\n| && + ` left: 50%;` && |\n| && + ` margin-left: -200px;` && |\n| && + ` z-index: 1003;` && |\n| && + ` box-shadow: rgba(0,0,0,0.2) 0 0 2px 2px;` && |\n| && + `}` && |\n| && + `#help .txt {` && |\n| && + ` padding: 20px 20px 5px;` && |\n| && + ` line-height: 1.4;` && |\n| && + `}` && |\n| && + `.txt p {` && |\n| && + ` margin-bottom: 3px;` && |\n| && + `}` && |\n| && + `#help section {` && |\n| && + ` margin-bottom: 20px;` && |\n| && + `}` && |\n| && + `#help .close_button {` && |\n| && + ` background: #000 url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAACbgAAAm4Bt/774AAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAABKSURBVAiZdc2xDYAwAAPBA0ViiQxKR6hgCMZjCSpTEAkavnxL` && + `7yHJgRPNQ0MtXS6Y+jBjlUSSLS9bEqMfSm/O2D+pq6Bi/ZxfqDfkbiIp0Zzd1AAAAABJRU5ErkJggg==) 50% 50% no-repeat;` && |\n| && + ` box-shadow: 0 0 1px #EEE inset;` && |\n| && + ` border-radius: 2px;` && |\n| && + `}` && |\n| && + `#help h2 {` && |\n| && + ` margin-bottom: 5px;` && |\n| && + `}` && |\n| && + `#help footer {` && |\n| && + ` color: #999;` && |\n| && + ` font-size: 10px;` && |\n| && + ` padding: 0 20px 20px;` && |\n| && + ` line-height: 1.3;` && |\n| && + `}` && |\n| && + `#help footer a {` && |\n| && + ` color: #777;` && |\n| && + ` text-decoration: underline;` && |\n| && + `}` && |\n| && + `.key {` && |\n| && + ` background: #F5F5F5;` && |\n| && + ` color: #555;` && |\n| && + ` text-shadow: 0 0 1px #EEE;` && |\n| && + ` padding: 1px 5px;` && |\n| && + ` border: 1px solid #CCC;` && |\n| && + ` border-radius: 3px;` && |\n| && + ` display: inline-block;` && |\n| && + ` min-width: 16px;` && |\n| && + ` text-align: center;` && |\n| && + ` font-size: 11px;` && |\n| && + ` box-shadow: 1px 1px 0 rgba(255,255,255,1) inset, -1px -1px 0 rgba(0,0,0,0.08) inset;` && |\n| && + ` overflow: hidden;` && |\n| && + ` cursor: default;` && |\n| && + ` vertical-align: middle;` && |\n| && + `}` && |\n| && + `.key:active {` && |\n| && + ` padding: 2px 5px 0;` && |\n| && + ` box-shadow: 1px 1px 0 rgba(0,0,0,0.08) inset, -1px -1px 0 rgba(255,255,255,1) inset;` && |\n| && + `}` && |\n| && + `#overlay {` && |\n| && + ` position: fixed;` && |\n| && + ` top: 0;` && |\n| && + ` left: 0;` && |\n| && + ` width: 100%;` && |\n| && + ` height: 100%;` && |\n| && + ` z-index: 1002;` && |\n| && + ` background: #000;` && |\n| && + ` opacity: 0.5;` && |\n| && + ` display: none;` && |\n| && + `}` && |\n| && + `#from_html_wrapper {` && |\n| && + ` display: none;` && |\n| && + ` width: 500px;` && |\n| && + ` border-radius: 5px;` && |\n| && + ` background: rgba(0,0,0,0.9);` && |\n| && + ` position: absolute;` && |\n| && + ` top: 35px;` && |\n| && + ` left: 50%;` && |\n| && + ` margin-left: -250px;` && |\n| && + ` z-index: 1002;` && |\n| && + ` color: #FFF;` && |\n| && + `}` && |\n| && + `#from_html_wrapper .close_button {` && |\n| && + ` background: #000 url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAACbgAAAm4Bt/774AAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAABKSURBVAiZdc2xDYAwAAPBA0ViiQxKR6hgCMZjCSpTEAkavnxL7yHJgR` && + `PNQ0MtXS6Y+jBjlUSSLS9bEqMfSm/O2D+pq6Bi/ZxfqDfkbiIp0Zzd1AAAAABJRU5ErkJggg==) 50% 50% no-repeat;` && |\n| && + ` box-shadow: 0 0 1px #EEE inset;` && |\n| && + ` border-radius: 2px;` && |\n| && + `}` && |\n| && + `#from_html_form {` && |\n| && + ` padding: 20px;` && |\n| && + `}` && |\n| && + `#from_html_form h5 {` && |\n| && + ` margin-bottom: 15px;` && |\n| && + `}` && |\n| && + `#from_html_form label {` && |\n| && + ` display: block;` && |\n| && + ` font-size: 12px;` && |\n| && + `}` && |\n| && + `#from_html_form textarea {` && |\n| && + ` border: 0px;` && |\n| && + ` border-radius: 3px;` && |\n| && + ` background: #FFF;` && |\n| && + ` padding: 2px 5px;` && |\n| && + ` margin-bottom: 5px;` && |\n| && + ` width: 100%;` && |\n| && + ` height: 100px;` && |\n| && + ` box-shadow: 1px 1px 3px rgba(0,0,0,0.2) inset;` && |\n| && + ` -webkit-box-sizing: border-box;` && |\n| && + ` -moz-box-sizing: border-box;` && |\n| && + ` box-sizing: border-box; ` && |\n| && + ` font-family: monospace;` && |\n| && + ` font-size: 11px;` && |\n| && + ` line-height: 1.3;` && |\n| && + `}` && |\n| && + `` && |\n| && + `/* CSS for SVG-elements */` && |\n| && + `` && |\n| && + `#svg {` && |\n| && + ` position: absolute;` && |\n| && + ` top: 0;` && |\n| && + ` left: 0;` && |\n| && + ` z-index: 2;` && |\n| && + ` display: inline-block;` && |\n| && + `}` && |\n| && + `#svg rect {` && |\n| && + ` stroke-width: 3px;` && |\n| && + ` stroke: #F00;` && |\n| && + ` fill: rgba(255,255,255,0.3);` && |\n| && + `}` && |\n| && + `#svg rect.with_href {` && |\n| && + ` fill: rgba(0,0,0,0.3);` && |\n| && + `}` && |\n| && + `.edit > #svg rect:hover {` && |\n| && + ` fill: rgba(50,200,50,0.3);` && |\n| && + `}` && |\n| && + `#svg rect.active {` && |\n| && + ` fill: rgba(0,0,0,0.5);` && |\n| && + `}` && |\n| && + `#svg circle {` && |\n| && + ` stroke-width: 3px;` && |\n| && + ` stroke: #0F0;` && |\n| && + ` fill: rgba(255,255,255,0.3);` && |\n| && + `}` && |\n| && + `#svg circle.with_href {` && |\n| && + ` fill: rgba(0,0,0,0.3);` && |\n| && + `}` && |\n| && + `.edit > #svg circle:hover {` && |\n| && + ` fill: rgba(50,200,50,0.3);` && |\n| && + `}` && |\n| && + `#svg polyline, #svg polygon {` && |\n| && + ` stroke-width: 3px;` && |\n| && + ` stroke: #00F;` && |\n| && + ` fill: rgba(255,255,255,0.3);` && |\n| && + `}` && |\n| && + `#svg polygon.with_href {` && |\n| && + ` fill: rgba(0,0,0,0.3);` && |\n| && + `}` && |\n| && + `.edit > #svg polygon:hover {` && |\n| && + ` fill: rgba(50,200,50,0.3);` && |\n| && + `}` && |\n| && + `#svg .selected {` && |\n| && + ` fill: rgba(50,200,50,0.5) !important;` && |\n| && + `}` && |\n| && + `#svg rect.helper {` && |\n| && + ` fill: #FFF;` && |\n| && + ` stroke: #000;` && |\n| && + ` stroke-width: 2px;` && |\n| && + `}` && |\n| && + `#svg rect.helper:hover {` && |\n| && + ` fill: #F00; ` && |\n| && + `}` && |\n| && + `.edit > #svg rect, .edit > #svg circle, .edit > #svg polygon {` && |\n| && + ` cursor: move;` && |\n| && + `}` && |\n| && + `.edit > #svg .pointer {` && |\n| && + ` cursor: pointer;` && |\n| && + `}` && |\n| && + `.edit > #svg .e-resize {` && |\n| && + ` cursor: e-resize;` && |\n| && + `}` && |\n| && + `.edit > #svg .ne-resize {` && |\n| && + ` cursor: ne-resize;` && |\n| && + `}` && |\n| && + `.edit > #svg .nw-resize {` && |\n| && + ` cursor: nw-resize;` && |\n| && + `}` && |\n| && + `.edit > #svg .n-resize {` && |\n| && + ` cursor: n-resize;` && |\n| && + `}` && |\n| && + `.edit > #svg .se-resize {` && |\n| && + ` cursor: se-resize;` && |\n| && + `}` && |\n| && + `.edit > #svg .sw-resize {` && |\n| && + ` cursor: sw-resize;` && |\n| && + `}` && |\n| && + `.edit > #svg .s-resize {` && |\n| && + ` cursor: s-resize;` && |\n| && + `}` && |\n| && + `.edit > #svg .w-resize {` && |\n| && + ` cursor: w-resize;` && |\n| && + `}`. + ENDMETHOD. -METHOD load_editor_html. -result = `` && |\n| && -`
` && |\n| && -` ` && |\n| && -`
` && |\n| && -`
` && |\n| && -` #` && |\n| && -` ` && |\n| && -`
` && |\n| && -`
` && |\n| && -`
` && |\n| && -`` && |\n| && -`` && |\n| && -`
` && |\n| && -` ` && |\n| && -`
` && |\n| && -`
` && |\n| && -`` && |\n| && -`` && |\n| && -`
` && |\n| && -`
Attributes
` && |\n| && -` ` && |\n| && -`

` && |\n| && -` ` && |\n| && -` ` && |\n| && -`

` && |\n| && -`

` && |\n| && -` ` && |\n| && -` ` && |\n| && -`

` && |\n| && -`

` && |\n| && -` ` && |\n| && -` ` && |\n| && -`

` && |\n| && -` ` && |\n| && -`
` && |\n| && -`` && |\n| && -`` && |\n| && -`
` && |\n| && -`
` && |\n| && -`
Loading areas
` && |\n| && -` ` && |\n| && -`

` && |\n| && -` ` && |\n| && -` ` && |\n| && -`

` && |\n| && -` ` && |\n| && -`
` && |\n| && -`
` && |\n| && -` ` && |\n| && -`` && |\n| && -`
` && |\n| && -`
` && |\n| && -` ` && |\n| && -`
Loading
` && |\n| && -`
` && |\n| && -` ` && |\n| && -`
` && |\n| && -` x ` && |\n| && -` preview` && |\n| && -`
` && |\n| && -` or` && |\n| && -`
` && |\n| && -` ` && |\n| && -` ` && |\n| && -` x` && |\n| && -` ` && |\n| && -` ` && |\n| && -` ` && |\n| && -`
` && |\n| && -`
` && |\n| && -`` && |\n| && -`` && |\n| && -`
` && |\n| && -`
` && |\n| && -` ` && |\n| && -`
` && |\n| && -`
` && |\n| && -`

Main

` && |\n| && -`

F5 — reload the page and display the form for loading image again

` && |\n| && -`

S — save map params in localStorage

` && |\n| && -`
` && |\n| && -`
` && |\n| && -`

Drawing mode (rectangle / circle / polygon)

` && |\n| && -`

ENTER — stop polygon drawing (or click on first helper)

` && |\n| && -`

ESC — cancel drawing of a new area

` && |\n| && -`

SHIFT — square drawing in case of a rectangle and right angle drawing in case of a polygon

` && |\n| && -`
` && |\n| && -`
` && |\n| && -`

Editing mode

` && |\n| && -`

DELETE — remove a selected area

` && |\n| && -`

ESC — cancel editing of a selected area

` && |\n| && -`

SHIFT — edit and save proportions for rectangle

` && |\n| && -`

I — edit attributes of a selected area (or dblclick on an area)

` && |\n| && -`

CTRL + C — a copy of the selected area

` && |\n| && -`

— move a selected area up

` && |\n| && -`

— move a selected area down

` && |\n| && -`

— move a selected area to the left

` && |\n| && -`

— move a selected area to the right

` && |\n| && -`
` && |\n| && -`
` && |\n| && -`
`. + METHOD load_editor_html. + result = `` && |\n| && + `
` && |\n| && + ` ` && |\n| && + `
` && |\n| && + `
` && |\n| && + ` #` && |\n| && + ` ` && |\n| && + `
` && |\n| && + `
` && |\n| && + `
` && |\n| && + `` && |\n| && + `` && |\n| && + `
` && |\n| && + ` ` && |\n| && + `
` && |\n| && + `
` && |\n| && + `` && |\n| && + `` && |\n| && + `
` && |\n| && + `
Attributes
` && |\n| && + ` ` && |\n| && + `

` && |\n| && + ` ` && |\n| && + ` ` && |\n| && + `

` && |\n| && + `

` && |\n| && + ` ` && |\n| && + ` ` && |\n| && + `

` && |\n| && + `

` && |\n| && + ` ` && |\n| && + ` ` && |\n| && + `

` && |\n| && + ` ` && |\n| && + `
` && |\n| && + `` && |\n| && + `` && |\n| && + `
` && |\n| && + `
` && |\n| && + `
Loading areas
` && |\n| && + ` ` && |\n| && + `

` && |\n| && + ` ` && |\n| && + ` ` && |\n| && + `

` && |\n| && + ` ` && |\n| && + `
` && |\n| && + `
` && |\n| && + ` ` && |\n| && + `` && |\n| && + `
` && |\n| && + `
` && |\n| && + ` ` && |\n| && + `
Loading
` && |\n| && + `
` && |\n| && + ` ` && |\n| && + `
` && |\n| && + ` x ` && |\n| && + ` preview` && |\n| && + `
` && |\n| && + ` or` && |\n| && + `
` && |\n| && + ` ` && |\n| && + ` ` && |\n| && + ` x` && |\n| && + ` ` && |\n| && + ` ` && |\n| && + ` ` && |\n| && + `
` && |\n| && + `
` && |\n| && + `` && |\n| && + `` && |\n| && + `
` && |\n| && + `
` && |\n| && + ` ` && |\n| && + `
` && |\n| && + `
` && |\n| && + `

Main

` && |\n| && + `

F5 — reload the page and display the form for loading image again

` && |\n| && + `

S — save map params in localStorage

` && |\n| && + `
` && |\n| && + `
` && |\n| && + `

Drawing mode (rectangle / circle / polygon)

` && |\n| && + `

ENTER — stop polygon drawing (or click on first helper)

` && |\n| && + `

ESC — cancel drawing of a new area

` && |\n| && + `

SHIFT — square drawing in case of a rectangle and right angle drawing in case of a polygon

` && |\n| && + `
` && |\n| && + `
` && |\n| && + `

Editing mode

` && |\n| && + `

DELETE — remove a selected area

` && |\n| && + `

ESC — cancel editing of a selected area

` && |\n| && + `

SHIFT — edit and save proportions for rectangle

` && |\n| && + `

I — edit attributes of a selected area (or dblclick on an area)

` && |\n| && + `

CTRL + C — a copy of the selected area

` && |\n| && + `

— move a selected area up

` && |\n| && + `

— move a selected area down

` && |\n| && + `

— move a selected area to the left

` && |\n| && + `

— move a selected area to the right

` && |\n| && + `
` && |\n| && + `
` && |\n| && + `
`. -ENDMETHOD. + ENDMETHOD. -METHOD load_editor_js. -result = `` && |\n| && -`loadJsEditor = function(base64_image, filename) {` && |\n| && -` var summerHtmlImageMapCreator = (function() {` && |\n| && -` 'use strict';` && |\n| && -` ` && |\n| && -` var utils = {` && |\n| && -` getOffset : function(node) {` && |\n| && -` var boxCoords = node.getBoundingClientRect();` && |\n| && -` ` && |\n| && -` return {` && |\n| && -` x : Math.round(boxCoords.left + window.pageXOffset),` && |\n| && -` y : Math.round(boxCoords.top + window.pageYOffset)` && |\n| && -` };` && |\n| && -` },` && |\n| && -` ` && |\n| && -` getRightCoords : function(x, y) {` && |\n| && -` return {` && |\n| && -` x : x - app.getOffset('x'),` && |\n| && -` y : y - app.getOffset('y')` && |\n| && -` };` && |\n| && -` },` && |\n| && -` ` && |\n| && -` /**` && |\n| && -` * TODO: will use same method of app.js` && |\n| && -` * @deprecated` && |\n| && -` */` && |\n| && -` id : function (str) {` && |\n| && -` return document.getElementById(str);` && |\n| && -` },` && |\n| && -` ` && |\n| && -` /**` && |\n| && -` * TODO: will use same method of app.js` && |\n| && -` * @deprecated` && |\n| && -` */` && |\n| && -` hide : function(node) {` && |\n| && -` node.style.display = 'none';` && |\n| && -` ` && |\n| && -` return this;` && |\n| && -` },` && |\n| && -` ` && |\n| && -` /**` && |\n| && -` * TODO: will use same method of app.js` && |\n| && -` * @deprecated` && |\n| && -` */` && |\n| && -` show : function(node) {` && |\n| && -` node.style.display = 'block';` && |\n| && -` ` && |\n| && -` return this;` && |\n| && -` },` && |\n| && -` ` && |\n| && -` /**` && |\n| && -` * Escape < and > (for code output)` && |\n| && -` *` && |\n| && -` * @param str {string} - a string with < and >` && |\n| && -` * @returns {string} - a string with escaped < and >` && |\n| && -` */` && |\n| && -` encode : function(str) {` && |\n| && -` return str.replace(/</g, '&lt;').replace(/>/g, '&gt;');` && |\n| && -` },` && |\n| && -` ` && |\n| && -` /**` && |\n| && -` * TODO: will use same method of app.js` && |\n| && -` * @deprecated` && |\n| && -` */` && |\n| && -` foreach : function(arr, func) {` && |\n| && -` for(var i = 0, count = arr.length; i < count; i++) {` && |\n| && -` func(arr[i], i);` && |\n| && -` }` && |\n| && -` },` && |\n| && -` ` && |\n| && -` /**` && |\n| && -` * TODO: will use same method of app.js` && |\n| && -` * @deprecated` && |\n| && -` */` && |\n| && -` foreachReverse : function(arr, func) {` && |\n| && -` for(var i = arr.length - 1; i >= 0; i--) {` && |\n| && -` func(arr[i], i);` && |\n| && -` }` && |\n| && -` },` && |\n| && -` ` && |\n| && -` debug : (function() {` && |\n| && -` var output = document.getElementById('debug');` && |\n| && -` ` && |\n| && -` return function() {` && |\n| && -` output.innerHTML = [].join.call(arguments, ' ');` && |\n| && -` };` && |\n| && -` })(),` && |\n| && -` ` && |\n| && -` /**` && |\n| && -` * TODO: will use same method of app.js` && |\n| && -` * @deprecated` && |\n| && -` */` && |\n| && -` stopEvent : function(e) {` && |\n| && -` e.stopPropagation();` && |\n| && -` e.preventDefault();` && |\n| && -` ` && |\n| && -` return this;` && |\n| && -` },` && |\n| && -` ` && |\n| && -` extend : function(obj, options) {` && |\n| && -` var target = {};` && |\n| && -`` && |\n| && -` for (var name in obj) {` && |\n| && -` if(obj.hasOwnProperty(name)) {` && |\n| && -` target[name] = options[name] ? options[name] : obj[name];` && |\n| && -` }` && |\n| && -` }` && |\n| && -`` && |\n| && -` return target;` && |\n| && -` },` && |\n| && -` ` && |\n| && -` inherits : (function() {` && |\n| && -` var F = function() {};` && |\n| && -` ` && |\n| && -` return function(Child, Parent) {` && |\n| && -` F.prototype = Parent.prototype;` && |\n| && -` Child.prototype = new F();` && |\n| && -` Child.prototype.constructor = Child;` && |\n| && -` };` && |\n| && -` })()` && |\n| && -` };` && |\n| && -`` && |\n| && -`` && |\n| && -` var app = (function() {` && |\n| && -` var domElements = {` && |\n| && -` wrapper : utils.id('wrapper'),` && |\n| && -` svg : utils.id('svg'),` && |\n| && -` img : utils.id('img'),` && |\n| && -` container : utils.id('image'),` && |\n| && -` map : null` && |\n| && -` },` && |\n| && -` state = {` && |\n| && -` offset : {` && |\n| && -` x : 0,` && |\n| && -` y : 0` && |\n| && -` },` && |\n| && -` appMode : null, // drawing || editing || preview` && |\n| && -` currentType : null,` && |\n| && -` editType : null,` && |\n| && -` newArea : null,` && |\n| && -` selectedArea : null,` && |\n| && -` areas : [],` && |\n| && -` events : [],` && |\n| && -` isDraw : false,` && |\n| && -` image : {` && |\n| && -` src : null,` && |\n| && -` filename : null,` && |\n| && -` width: 0,` && |\n| && -` height: 0` && |\n| && -` }` && |\n| && -` },` && |\n| && -` KEYS = {` && |\n| && -` F1 : 112,` && |\n| && -` ESC : 27,` && |\n| && -` TOP : 38,` && |\n| && -` BOTTOM : 40,` && |\n| && -` LEFT : 37,` && |\n| && -` RIGHT : 39,` && |\n| && -` DELETE : 46,` && |\n| && -` I : 73,` && |\n| && -` S : 83,` && |\n| && -` C : 67` && |\n| && -` };` && |\n| && -`` && |\n| && -` function recalcOffsetValues() {` && |\n| && -` state.offset = utils.getOffset(domElements.container);` && |\n| && -` }` && |\n| && -`` && |\n| && -` /* Get offset value */` && |\n| && -` window.addEventListener('resize', recalcOffsetValues, false);` && |\n| && -`` && |\n| && -` /* Disable selection */` && |\n| && -` domElements.container.addEventListener('mousedown', function(e) { e.preventDefault(); }, false);` && |\n| && -`` && |\n| && -` /* Disable image dragging */` && |\n| && -` domElements.img.addEventListener('dragstart', function(e){` && |\n| && -` e.preventDefault();` && |\n| && -` }, false);` && |\n| && -`` && |\n| && -` /* Display cursor coordinates info */` && |\n| && -` var cursor_position_info = (function() {` && |\n| && -` var coords_info = utils.id('coords');` && |\n| && -` ` && |\n| && -` return {` && |\n| && -` set : function(coords) {` && |\n| && -` coords_info.innerHTML = 'x: ' + coords.x + ', ' + 'y: ' + coords.y;` && |\n| && -` },` && |\n| && -` empty : function() {` && |\n| && -` coords_info.innerHTML = '';` && |\n| && -` }` && |\n| && -` };` && |\n| && -` })();` && |\n| && -` ` && |\n| && -` domElements.container.addEventListener('mousemove', function(e){` && |\n| && -` cursor_position_info.set(utils.getRightCoords(e.pageX, e.pageY));` && |\n| && -` }, false);` && |\n| && -`` && |\n| && -` domElements.container.addEventListener('mouseleave', function(){` && |\n| && -` cursor_position_info.empty();` && |\n| && -` }, false);` && |\n| && -`` && |\n| && -` /* Add mousedown event for svg */` && |\n| && -` function onSvgMousedown(e) {` && |\n| && -` if (state.appMode === 'editing') {` && |\n| && -` if (e.target.parentNode.tagName === 'g') {` && |\n| && -` info.unload();` && |\n| && -` state.selectedArea = e.target.parentNode.obj;` && |\n| && -` ` && |\n| && -` app.deselectAll();` && |\n| && -` state.selectedArea.select();` && |\n| && -` state.selectedArea.editingStartPoint = {` && |\n| && -` x : e.pageX,` && |\n| && -` y : e.pageY` && |\n| && -` };` && |\n| && -` ` && |\n| && -` if (e.target.classList.contains('helper')) {` && |\n| && -` var helper = e.target;` && |\n| && -` state.editType = helper.action;` && |\n| && -` ` && |\n| && -` if (helper.n >= 0) { // if typeof selected_area == polygon` && |\n| && -` state.selectedArea.selected_point = helper.n;` && |\n| && -` }` && |\n| && -` ` && |\n| && -` app.addEvent(app.domElements.container,` && |\n| && -` 'mousemove',` && |\n| && -` state.selectedArea.onProcessEditing.bind(state.selectedArea))` && |\n| && -` .addEvent(app.domElements.container,` && |\n| && -` 'mouseup',` && |\n| && -` state.selectedArea.onStopEditing.bind(state.selectedArea));` && |\n| && -` } else if (e.target.tagName === 'rect' || e.target.tagName === 'circle' || e.target.tagName === 'polygon') {` && |\n| && -` state.editType = 'move';` && |\n| && -` ` && |\n| && -` app.addEvent(app.domElements.container,` && |\n| && -` 'mousemove',` && |\n| && -` state.selectedArea.onProcessEditing.bind(state.selectedArea))` && |\n| && -` .addEvent(app.domElements.container,` && |\n| && -` 'mouseup',` && |\n| && -` state.selectedArea.onStopEditing.bind(state.selectedArea));` && |\n| && -` }` && |\n| && -` } else {` && |\n| && -` app.deselectAll();` && |\n| && -` info.unload();` && |\n| && -` }` && |\n| && -` }` && |\n| && -` }` && |\n| && -` ` && |\n|. -result = result && ` domElements.container.addEventListener('mousedown', onSvgMousedown, false);` && |\n| && -` ` && |\n| && -` /* Add click event for svg */` && |\n| && -` function onSvgClick(e) {` && |\n| && -` if (state.appMode === 'drawing' && !state.isDraw && state.currentType) {` && |\n| && -` code.hide();` && |\n| && -` app.setIsDraw(true);` && |\n| && -` ` && |\n| && -` state.newArea = Area.CONSTRUCTORS[state.currentType].createAndStartDrawing(` && |\n| && -` utils.getRightCoords(e.pageX, e.pageY)` && |\n| && -` );` && |\n| && -` }` && |\n| && -` }` && |\n| && -` ` && |\n| && -` domElements.container.addEventListener('click', onSvgClick, false);` && |\n| && -` ` && |\n| && -` /* Add dblclick event for svg */` && |\n| && -` function onAreaDblClick(e) {` && |\n| && -` if (state.appMode === 'editing') {` && |\n| && -` if (e.target.tagName === 'rect' || e.target.tagName === 'circle' || e.target.tagName === 'polygon') {` && |\n| && -` state.selectedArea = e.target.parentNode.obj;` && |\n| && -` info.load(state.selectedArea, e.pageX, e.pageY);` && |\n| && -` }` && |\n| && -` }` && |\n| && -` }` && |\n| && -` ` && |\n| && -` domElements.container.addEventListener('dblclick', onAreaDblClick, false);` && |\n| && -` ` && |\n| && -` ` && |\n| && -` /* Add keydown event for document */` && |\n| && -` function onDocumentKeyDown(e) {` && |\n| && -` var ctrlDown = e.ctrlKey || e.metaKey; // PC || Mac` && |\n| && -` ` && |\n| && -` switch (e.keyCode) {` && |\n| && -` case KEYS.F1:` && |\n| && -` help.show();` && |\n| && -` e.preventDefault();` && |\n| && -` ` && |\n| && -` break;` && |\n| && -` ` && |\n| && -` case KEYS.ESC:` && |\n| && -` help.hide();` && |\n| && -` if (state.isDraw) {` && |\n| && -` state.isDraw = false;` && |\n| && -` state.newArea.remove();` && |\n| && -` state.areas.pop();` && |\n| && -` app.removeAllEvents();` && |\n| && -` } else if (state.appMode === 'editing') {` && |\n| && -` state.selectedArea.redraw();` && |\n| && -` app.removeAllEvents();` && |\n| && -` }` && |\n| && -` ` && |\n| && -` break;` && |\n| && -` ` && |\n| && -` case KEYS.TOP:` && |\n| && -` if (state.appMode === 'editing' && state.selectedArea) {` && |\n| && -` state.selectedArea.move(0, -1);` && |\n| && -` e.preventDefault();` && |\n| && -` }` && |\n| && -` ` && |\n| && -` break;` && |\n| && -` ` && |\n| && -` case KEYS.BOTTOM:` && |\n| && -` if (state.appMode === 'editing' && state.selectedArea) {` && |\n| && -` state.selectedArea.move(0, 1);` && |\n| && -` e.preventDefault();` && |\n| && -` }` && |\n| && -` break;` && |\n| && -` ` && |\n| && -` case KEYS.LEFT: ` && |\n| && -` if (state.appMode === 'editing' && state.selectedArea) {` && |\n| && -` state.selectedArea.move(-1, 0);` && |\n| && -` e.preventDefault();` && |\n| && -` }` && |\n| && -` ` && |\n| && -` break;` && |\n| && -` ` && |\n| && -` case KEYS.RIGHT:` && |\n| && -` if (state.appMode === 'editing' && state.selectedArea) {` && |\n| && -` state.selectedArea.move(1, 0);` && |\n| && -` e.preventDefault();` && |\n| && -` }` && |\n| && -` ` && |\n| && -` break;` && |\n| && -` ` && |\n| && -` case KEYS.DELETE:` && |\n| && -` if (state.appMode === 'editing' && state.selectedArea) {` && |\n| && -` app.removeObject(state.selectedArea);` && |\n| && -` state.selectedArea = null;` && |\n| && -` info.unload();` && |\n| && -` }` && |\n| && -` ` && |\n| && -` break;` && |\n| && -` ` && |\n| && -` case KEYS.I:` && |\n| && -` if (state.appMode === 'editing' && state.selectedArea) {` && |\n| && -` var coordsForAttributesForm = state.selectedArea.getCoordsForDisplayingInfo();` && |\n| && -` ` && |\n| && -` info.load(` && |\n| && -` state.selectedArea, ` && |\n| && -` coordsForAttributesForm.x + app.getOffset('x'), ` && |\n| && -` coordsForAttributesForm.y + app.getOffset('y')` && |\n| && -` );` && |\n| && -` }` && |\n| && -` ` && |\n| && -` break;` && |\n| && -` ` && |\n| && -` case KEYS.S:` && |\n| && -` if (ctrlDown) {` && |\n| && -` app.saveInLocalStorage();` && |\n| && -` }` && |\n| && -` ` && |\n| && -` break;` && |\n| && -` ` && |\n| && -` case KEYS.C:` && |\n| && -` if (state.appMode === 'editing' && state.selectedArea && ctrlDown) {` && |\n| && -` state.selectedArea = Area.copy(state.selectedArea);` && |\n| && -` }` && |\n| && -` ` && |\n| && -` break;` && |\n| && -` }` && |\n| && -` }` && |\n| && -` ` && |\n| && -` document.addEventListener('keydown', onDocumentKeyDown, false);` && |\n| && -` ` && |\n| && -` // Will moved from the main module` && |\n| && -` var areasIO = {` && |\n| && -` toJSON : function() {` && |\n| && -` var obj = {` && |\n| && -` areas : [],` && |\n| && -` img : state.image.src` && |\n| && -` };` && |\n| && -` ` && |\n| && -` utils.foreach(state.areas, function(x) {` && |\n| && -` obj.areas.push(x.toJSON());` && |\n| && -` });` && |\n| && -` ` && |\n| && -` return JSON.stringify(obj);` && |\n| && -` },` && |\n| && -` fromJSON : function(str) {` && |\n| && -` var obj = JSON.parse(str);` && |\n| && -` ` && |\n| && -` app.loadImage(obj.img);` && |\n| && -` ` && |\n| && -` utils.foreach(obj.areas, function(areaParams) {` && |\n| && -` Area.fromJSON(areaParams);` && |\n| && -` }); ` && |\n| && -` }` && |\n| && -` };` && |\n| && -` ` && |\n| && -` var localStorageWrapper = (function() {` && |\n| && -` var KEY_NAME = 'AmihaiAtias';` && |\n| && -` ` && |\n| && -` return {` && |\n| && -` save : function() {` && |\n| && -` var result = areasIO.toJSON();` && |\n| && -` window.localStorage.setItem(KEY_NAME, result);` && |\n| && -` console.info('Editor ' + result + ' saved');` && |\n| && -` ` && |\n| && -` alert('Saved');` && |\n| && -` },` && |\n| && -` restore : function() {` && |\n| && -` areasIO.fromJSON(window.localStorage.getItem(KEY_NAME));` && |\n| && -` }` && |\n| && -` };` && |\n| && -` })();` && |\n| && -` ` && |\n| && -` return {` && |\n| && -` domElements : domElements,` && |\n| && -` saveInLocalStorage : localStorageWrapper.save,` && |\n| && -` loadFromLocalStorage : localStorageWrapper.restore,` && |\n| && -` hide : function() {` && |\n| && -` utils.hide(domElements.container);` && |\n| && -` return this;` && |\n| && -` },` && |\n| && -` show : function() {` && |\n| && -` utils.show(domElements.container);` && |\n| && -` return this;` && |\n| && -` },` && |\n| && -` recalcOffsetValues: function() {` && |\n| && -` recalcOffsetValues();` && |\n| && -` return this;` && |\n| && -` },` && |\n| && -` setDimensions : function(width, height) {` && |\n| && -` domElements.svg.setAttribute('width', width);` && |\n| && -` domElements.svg.setAttribute('height', height);` && |\n| && -` domElements.container.style.width = width + 'px';` && |\n| && -` domElements.container.style.height = height + 'px';` && |\n| && -` return this;` && |\n| && -` },` && |\n| && -` loadImage : function(url) {` && |\n| && -` //get_image.showLoadIndicator();` && |\n| && -` domElements.img.src = url;` && |\n| && -` state.image.src = url;` && |\n| && -` ` && |\n| && -` domElements.img.onload = function() {` && |\n| && -` //get_image.hideLoadIndicator().hide();` && |\n| && -` app.show()` && |\n| && -` .setDimensions(domElements.img.width, domElements.img.height)` && |\n| && -` .recalcOffsetValues();` && |\n| && -` };` && |\n| && -` return this;` && |\n| && -` },` && |\n| && -` preview : (function() {` && |\n| && -` domElements.img.setAttribute('usemap', '#map');` && |\n| && -` domElements.map = document.createElement('map');` && |\n| && -` domElements.map.setAttribute('name', 'map');` && |\n| && -` domElements.container.appendChild(domElements.map);` && |\n| && -` ` && |\n| && -` return function() {` && |\n| && -` info.unload();` && |\n| && -` app.setShape(null);` && |\n| && -` utils.hide(domElements.svg);` && |\n| && -` domElements.map.innerHTML = app.getHTMLCode();` && |\n| && -` code.print();` && |\n| && -` return this;` && |\n| && -` };` && |\n| && -` })(),` && |\n| && -` hidePreview : function() {` && |\n| && -` utils.show(domElements.svg);` && |\n| && -` domElements.map.innerHTML = '';` && |\n| && -` return this;` && |\n| && -` },` && |\n| && -` addNodeToSvg : function(node) {` && |\n| && -` domElements.svg.appendChild(node);` && |\n| && -` return this;` && |\n| && -` },` && |\n| && -` removeNodeFromSvg : function(node) {` && |\n| && -` domElements.svg.removeChild(node);` && |\n| && -` return this;` && |\n| && -` },` && |\n| && -` getOffset : function(arg) {` && |\n| && -` switch(arg) {` && |\n| && -` case 'x':` && |\n| && -` case 'y':` && |\n| && -` return state.offset[arg];` && |\n| && -` }` && |\n| && -` },` && |\n| && -` clear : function(){` && |\n| && -` //remove all areas` && |\n| && -` state.areas.length = 0;` && |\n| && -` while(domElements.svg.childNodes[0]) {` && |\n| && -` domElements.svg.removeChild(domElements.svg.childNodes[0]);` && |\n| && -` }` && |\n| && -` code.hide();` && |\n| && -` info.unload();` && |\n| && -` return this;` && |\n| && -` },` && |\n| && -` removeObject : function(obj) {` && |\n| && -` utils.foreach(state.areas, function(x, i) {` && |\n| && -` if(x === obj) {` && |\n| && -` state.areas.splice(i, 1);` && |\n| && -` }` && |\n| && -` });` && |\n| && -` obj.remove();` && |\n| && -` return this;` && |\n| && -` },` && |\n| && -` deselectAll : function() {` && |\n| && -` utils.foreach(state.areas, function(x) {` && |\n| && -` x.deselect();` && |\n| && -` });` && |\n| && -` return this;` && |\n| && -` },` && |\n| && -` getIsDraw : function() {` && |\n| && -` return state.isDraw;` && |\n| && -` },` && |\n| && -` setIsDraw : function(arg) {` && |\n| && -` state.isDraw = arg;` && |\n| && -` return this;` && |\n| && -` },` && |\n| && -` setMode : function(arg) {` && |\n| && -` state.appMode = arg;` && |\n| && -` return this;` && |\n| && -` },` && |\n| && -` getMode : function() {` && |\n| && -` return state.appMode;` && |\n| && -` },` && |\n| && -` setShape : function(arg) {` && |\n| && -` state.currentType = arg;` && |\n| && -` return this;` && |\n| && -` },` && |\n| && -` getShape : function() {` && |\n| && -` return state.currentType;` && |\n| && -` },` && |\n| && -` addObject : function(object) {` && |\n| && -` state.areas.push(object);` && |\n| && -` return this;` && |\n| && -` },` && |\n| && -` getNewArea : function() {` && |\n| && -` return state.newArea;` && |\n| && -` },` && |\n| && -` resetNewArea : function() {` && |\n| && -` state.newArea = null;` && |\n| && -` return this;` && |\n| && -` },` && |\n| && -` getSelectedArea : function() {` && |\n| && -` return state.selectedArea;` && |\n| && -` },` && |\n| && -` setSelectedArea : function(obj) {` && |\n| && -` state.selectedArea = obj;` && |\n| && -` return this;` && |\n| && -` },` && |\n| && -` getEditType : function() {` && |\n| && -` return state.editType;` && |\n| && -` },` && |\n| && -` setFilename : function(str) {` && |\n| && -` state.image.filename = str;` && |\n| && -` return this;` && |\n| && -` },` && |\n| && -` setEditClass : function() {` && |\n| && -` domElements.container.classList.remove('draw');` && |\n| && -` domElements.container.classList.add('edit');` && |\n| && -`` && |\n| && -` return this;` && |\n| && -` },` && |\n| && -` setDrawClass : function() {` && |\n| && -` domElements.container.classList.remove('edit');` && |\n| && -` domElements.container.classList.add('draw');` && |\n| && -`` && |\n| && -` return this;` && |\n| && -` },` && |\n| && -` setDefaultClass : function() {` && |\n| && -` domElements.container.classList.remove('edit');` && |\n| && -` domElements.container.classList.remove('draw');` && |\n| && -`` && |\n| && -` return this;` && |\n| && -` },` && |\n| && -` addEvent : function(target, eventType, func) {` && |\n| && -` state.events.push(new AppEvent(target, eventType, func));` && |\n| && -` return this;` && |\n| && -` },` && |\n| && -` removeAllEvents : function() {` && |\n| && -` utils.foreach(state.events, function(x) {` && |\n| && -` x.remove();` && |\n| && -` });` && |\n| && -` state.events.length = 0;` && |\n| && -` return this;` && |\n| && -` },` && |\n| && -` getHTMLCode : function(arg) {` && |\n| && -` var html_code = '';` && |\n| && -` if (arg) {` && |\n| && -` if (!state.areas.length) {` && |\n| && -` return '0 objects';` && |\n| && -` }` && |\n| && -` html_code += utils.encode('<img src="' + state.image.filename + '" alt="" usemap="#map" />') +` && |\n| && -` '<br />' + utils.encode('<map name="map">') + '<br />';` && |\n| && -` utils.foreachReverse(state.areas, function(x) {` && |\n| && -` html_code += '&nbsp;&nbsp;&nbsp;&nbsp;' + utils.encode(x.toHTMLMapElementString()) + '<br />';` && |\n| && -` });` && |\n| && -` html_code += utils.encode('</map>');` && |\n| && -` } else {` && |\n| && -` utils.foreachReverse(state.areas, function(x) {` && |\n| && -` html_code += x.toHTMLMapElementString();` && |\n| && -` });` && |\n| && -` }` && |\n| && -` return html_code;` && |\n| && -` }` && |\n| && -` };` && |\n| && -` })();` && |\n| && -` ` && |\n| && -` ` && |\n| && -` /**` && |\n| && -` * The constructor for dom events (for simple deleting of event)` && |\n| && -` * ` && |\n| && -` * @constructor` && |\n| && -` * @param {DOMElement} target - DOM-element` && |\n| && -` * @param {String} eventType - e.g. 'click' or 'mousemove'` && |\n| && -` * @param {Function} func - handler for this event` && |\n| && -` */` && |\n| && -` function AppEvent(target, eventType, func) {` && |\n| && -` this.target = target;` && |\n| && -` this.eventType = eventType;` && |\n| && -` this.func = func;` && |\n| && -` ` && |\n| && -` target.addEventListener(eventType, func, false);` && |\n| && -` }` && |\n| && -` ` && |\n| && -` /**` && |\n| && -` * Remove this event listener from target` && |\n| && -` */` && |\n| && -` AppEvent.prototype.remove = function() {` && |\n| && -` this.target.removeEventListener(this.eventType, this.func, false);` && |\n| && -` };` && |\n| && -`` && |\n|. -result = result && -` function Helper(node, x, y, action) {` && |\n| && -` this._el = document.createElementNS(Area.SVG_NS, 'rect');` && |\n| && -` ` && |\n| && -` this._el.classList.add(Helper.CLASS_NAME);` && |\n| && -` this._el.setAttribute('height', Helper.SIZE);` && |\n| && -` this._el.setAttribute('width', Helper.SIZE);` && |\n| && -` this._el.setAttribute('x', x + Helper.OFFSET);` && |\n| && -` this._el.setAttribute('y', y + Helper.OFFSET);` && |\n| && -` ` && |\n| && -` node.appendChild(this._el);` && |\n| && -` ` && |\n| && -` this._el.action = action; // TODO: move 'action' from dom el to data-attr` && |\n| && -` this._el.classList.add(Helper.ACTIONS_TO_CURSORS[action]);` && |\n| && -` }` && |\n| && -` ` && |\n| && -` Helper.SIZE = 5;` && |\n| && -` Helper.OFFSET = -Math.ceil(Helper.SIZE / 2);` && |\n| && -` Helper.CLASS_NAME = 'helper';` && |\n| && -` Helper.ACTIONS_TO_CURSORS = {` && |\n| && -` 'move' : 'move',` && |\n| && -` 'editLeft' : 'e-resize',` && |\n| && -` 'editRight' : 'w-resize',` && |\n| && -` 'editTop' : 'n-resize',` && |\n| && -` 'editBottom' : 's-resize',` && |\n| && -` 'editTopLeft' : 'nw-resize',` && |\n| && -` 'editTopRight' : 'ne-resize',` && |\n| && -` 'editBottomLeft' : 'sw-resize',` && |\n| && -` 'editBottomRight' : 'se-resize',` && |\n| && -` 'movePoint' : 'pointer'` && |\n| && -` };` && |\n| && -`` && |\n| && -` Helper.prototype.setCoords = function(x, y) {` && |\n| && -` this._el.setAttribute('x', x + Helper.OFFSET);` && |\n| && -` this._el.setAttribute('y', y + Helper.OFFSET);` && |\n| && -` ` && |\n| && -` return this;` && |\n| && -` };` && |\n| && -` ` && |\n| && -` Helper.prototype.setId = function(id) {` && |\n| && -` // TODO: move n-field from DOM-element to data-attribute` && |\n| && -` this._el.n = id;` && |\n| && -` ` && |\n| && -` return this;` && |\n| && -` };` && |\n| && -` ` && |\n| && -` function Area(type, coords, attributes) {` && |\n| && -` if (this.constructor === Area) {` && |\n| && -` throw new Error('This is abstract class');` && |\n| && -` }` && |\n| && -` ` && |\n| && -` this._type = type;` && |\n| && -` ` && |\n| && -` this._attributes = {` && |\n| && -` href : '',` && |\n| && -` alt : '',` && |\n| && -` title : '' ` && |\n| && -` };` && |\n| && -`` && |\n| && -` if (attributes) {` && |\n| && -` this.setInfoAttributes(attributes);` && |\n| && -` }` && |\n| && -` ` && |\n| && -` this._coords = coords;` && |\n| && -` ` && |\n| && -` // the g-element, it contains this area and helpers elements` && |\n| && -` this._groupEl = document.createElementNS(Area.SVG_NS, 'g');` && |\n| && -` app.addNodeToSvg(this._groupEl);` && |\n| && -` ` && |\n| && -` // TODO: remove this field from DOM-element` && |\n| && -` // Link to parent object` && |\n| && -` this._groupEl.obj = this;` && |\n| && -` ` && |\n| && -` // svg-dom-element of area` && |\n| && -` this._el = null; ` && |\n| && -` ` && |\n| && -` // Object with all helpers of area` && |\n| && -` this._helpers = {};` && |\n| && -` ` && |\n| && -` // Add this new area to list of all areas ` && |\n| && -` app.addObject(this);` && |\n| && -` }` && |\n| && -` Area.SVG_NS = 'http://www.w3.org/2000/svg'; // TODO: move to main editor constructor` && |\n| && -` Area.CLASS_NAMES = {` && |\n| && -` SELECTED : 'selected',` && |\n| && -` WITH_HREF : 'with_href'` && |\n| && -` };` && |\n| && -` Area.CONSTRUCTORS = {` && |\n| && -` rectangle : Rectangle,` && |\n| && -` circle : Circle,` && |\n| && -` polygon : Polygon` && |\n| && -` };` && |\n| && -` Area.REGEXP = {` && |\n| && -` AREA : /<area(?=.*? shape="(rect|circle|poly)")(?=.*? coords="([\d ,]+?)")[\s\S]*?>/gmi,` && |\n| && -` HREF : / href="([\S\s]+?)"/,` && |\n| && -` ALT : / alt="([\S\s]+?)"/,` && |\n| && -` TITLE : / title="([\S\s]+?)"/,` && |\n| && -` DELIMETER : / ?, ?/` && |\n| && -` };` && |\n| && -` Area.HTML_NAMES_TO_AREA_NAMES = {` && |\n| && -` rect : 'rectangle',` && |\n| && -` circle : 'circle',` && |\n| && -` poly : 'polygon'` && |\n| && -` };` && |\n| && -` Area.ATTRIBUTES_NAMES = ['HREF', 'ALT', 'TITLE'];` && |\n| && -` ` && |\n| && -` /**` && |\n| && -` * This method should be implemented for child-classes ` && |\n| && -` * ` && |\n| && -` * @throws {AbstractMethodCall}` && |\n| && -` */` && |\n| && -` Area.prototype.ABSTRACT_METHOD = function() {` && |\n| && -` throw new Error('This is abstract method');` && |\n| && -` };` && |\n| && -` ` && |\n| && -` /**` && |\n| && -` * All these methods are abstract ` && |\n| && -` * ` && |\n| && -` * @throws {AbstractMethodCall}` && |\n| && -` */` && |\n| && -` Area.prototype.setSVGCoords =` && |\n| && -` Area.prototype.setCoords = ` && |\n| && -` Area.prototype.dynamicDraw = ` && |\n| && -` Area.prototype.onProcessDrawing = ` && |\n| && -` Area.prototype.onStopDrawing = ` && |\n| && -` Area.prototype.edit = ` && |\n| && -` Area.prototype.dynamicEdit = ` && |\n| && -` Area.prototype.onProcessEditing = ` && |\n| && -` Area.prototype.onStopEditing = ` && |\n| && -` Area.prototype.toString = ` && |\n| && -` Area.prototype.toHTMLMapElementString =` && |\n| && -` Area.prototype.getCoordsForDisplayingInfo = ` && |\n| && -` Area.prototype.ABSTRACT_METHOD;` && |\n| && -` ` && |\n| && -` Area.prototype.redraw = function(coords) {` && |\n| && -` this.setSVGCoords(coords ? coords : this._coords);` && |\n| && -` ` && |\n| && -` return this;` && |\n| && -` };` && |\n| && -` ` && |\n| && -` /**` && |\n| && -` * Remove this area from DOM-tree` && |\n| && -` */` && |\n| && -` Area.prototype.remove = function() {` && |\n| && -` app.removeNodeFromSvg(this._groupEl);` && |\n| && -` };` && |\n| && -`` && |\n| && -` /**` && |\n| && -` * Move this area by dx, dy ` && |\n| && -` * ` && |\n| && -` * @returns {Area} - this area` && |\n| && -` */` && |\n| && -` Area.prototype.move = function(dx, dy) {` && |\n| && -` this.setCoords(this.edit('move', dx, dy)).redraw();` && |\n| && -` return this;` && |\n| && -` };` && |\n| && -` ` && |\n| && -` Area.prototype.select = function() {` && |\n| && -` this._el.classList.add(Area.CLASS_NAMES.SELECTED);` && |\n| && -` console.info(this.toString() + ' is selected now');` && |\n| && -` ` && |\n| && -` return this;` && |\n| && -` };` && |\n| && -` ` && |\n| && -` Area.prototype.deselect = function() {` && |\n| && -` this._el.classList.remove(Area.CLASS_NAMES.SELECTED);` && |\n| && -` ` && |\n| && -` return this;` && |\n| && -` };` && |\n| && -` ` && |\n| && -` Area.prototype.setStyleOfElementWithHref = function() {` && |\n| && -` this._el.classList.add(Area.CLASS_NAMES.WITH_HREF);` && |\n| && -` ` && |\n| && -` return this;` && |\n| && -` };` && |\n| && -` ` && |\n| && -` Area.prototype.unsetStyleOfElementWithHref = function() {` && |\n| && -` this._el.classList.remove(Area.CLASS_NAMES.WITH_HREF);` && |\n| && -` ` && |\n| && -` return this;` && |\n| && -` };` && |\n| && -` ` && |\n| && -` Area.prototype.setInfoAttributes = function(attributes) {` && |\n| && -` this._attributes.href = attributes.href;` && |\n| && -` this._attributes.alt = attributes.alt;` && |\n| && -` this._attributes.title = attributes.title;` && |\n| && -` };` && |\n| && -` ` && |\n| && -` Area.prototype.toJSON = function() {` && |\n| && -` return {` && |\n| && -` type : this._type,` && |\n| && -` coords : this._coords,` && |\n| && -` attributes : this._attributes` && |\n| && -` };` && |\n| && -` };` && |\n| && -` ` && |\n| && -` /**` && |\n| && -` * Returns new area object created with params from json-object` && |\n| && -` * ` && |\n| && -` * @static` && |\n| && -` * @param params {Object} - params of area, incl. type, coords and attributes` && |\n| && -` * @returns {Rectangle|Circle|Polygon}` && |\n| && -` */` && |\n| && -` Area.fromJSON = function(params) {` && |\n| && -` var AreaConstructor = Area.CONSTRUCTORS[params.type];` && |\n| && -` ` && |\n| && -` if (!AreaConstructor) {` && |\n| && -` throw new Error('This area type is not valid');` && |\n| && -` }` && |\n| && -` ` && |\n| && -` if (!AreaConstructor.testCoords(params.coords)) {` && |\n| && -` throw new Error('This coords is not valid for ' + params.type);` && |\n| && -` }` && |\n| && -` ` && |\n| && -` app.setIsDraw(true);` && |\n| && -` ` && |\n| && -` var area = new AreaConstructor(params.coords, params.attributes);` && |\n| && -` ` && |\n| && -` app.setIsDraw(false)` && |\n| && -` .resetNewArea();` && |\n| && -` ` && |\n| && -` return area;` && |\n| && -` };` && |\n| && -`` && |\n| && -` Area.createAreasFromHTMLOfMap = function(htmlStr) {` && |\n| && -` if (!htmlStr) {` && |\n| && -` return false;` && |\n| && -` } ` && |\n| && -`` && |\n| && -` while (true) {` && |\n| && -` var findedResult = Area.REGEXP.AREA.exec(htmlStr); // <area shape="$1" coords="$2" ... />` && |\n| && -` if (!findedResult) {` && |\n| && -` break;` && |\n| && -` } ` && |\n| && -`` && |\n| && -` var htmlAreaFinded = findedResult[0], // <area shape="..." coords="..." ... />` && |\n| && -` type = findedResult[1], // $1` && |\n| && -` coords = findedResult[2].split(Area.REGEXP.DELIMETER), // $2` && |\n| && -` attributes = {}; ` && |\n| && -` ` && |\n| && -` Area.ATTRIBUTES_NAMES.forEach(function(item, i) {` && |\n| && -` var result = Area.REGEXP[item].exec(htmlAreaFinded);` && |\n| && -`` && |\n| && -` if (result) {` && |\n| && -` attributes[name] = result[1];` && |\n| && -` } ` && |\n| && -` });` && |\n| && -` ` && |\n| && -` coords = coords.map(function(item) {` && |\n| && -` return Number(item);` && |\n| && -` });` && |\n| && -`` && |\n| && -` type = Area.HTML_NAMES_TO_AREA_NAMES[type];` && |\n| && -`` && |\n| && -` Area.fromJSON({` && |\n| && -` type : type,` && |\n| && -` coords : Area.CONSTRUCTORS[type].getCoordsFromHTMLArray(coords),` && |\n| && -` attributes : attributes` && |\n| && -` });` && |\n| && -`` && |\n| && -` }` && |\n| && -`` && |\n| && -` return Boolean(htmlAreaFinded);` && |\n| && -` };` && |\n| && -`` && |\n| && -` /**` && |\n| && -` * Returns copy of original area, selected and moved by (10,10) from it` && |\n| && -` * ` && |\n| && -` * @param originalArea {Area}` && |\n| && -` * @returns {Area} - a copy of original area` && |\n| && -` */` && |\n| && -` Area.copy = function(originalArea) {` && |\n| && -` return Area.fromJSON(originalArea.toJSON()).move(10, 10).select();` && |\n| && -` };` && |\n| && -`` && |\n| && -`` && |\n| && -` function Rectangle(coords, attributes) {` && |\n| && -` Area.call(this, 'rectangle', coords, attributes);` && |\n| && -` ` && |\n| && -` this._coords = {` && |\n| && -` x : coords.x || 0, ` && |\n| && -` y : coords.y || 0,` && |\n| && -` width : coords.width || 0, ` && |\n| && -` height : coords.height || 0` && |\n| && -` };` && |\n| && -` ` && |\n| && -` this._el = document.createElementNS(Area.SVG_NS, 'rect');` && |\n| && -` this._groupEl.appendChild(this._el);` && |\n| && -` ` && |\n| && -` var x = coords.x - this._coords.width / 2,` && |\n| && -` y = coords.y - this._coords.height / 2;` && |\n| && -` ` && |\n| && -` this._helpers = {` && |\n| && -` center : new Helper(this._groupEl, x, y, 'move'),` && |\n| && -` top : new Helper(this._groupEl, x, y, 'editTop'),` && |\n| && -` bottom : new Helper(this._groupEl, x, y, 'editBottom'),` && |\n| && -` left : new Helper(this._groupEl, x, y, 'editLeft'),` && |\n| && -` right : new Helper(this._groupEl, x, y, 'editRight'),` && |\n| && -` topLeft : new Helper(this._groupEl, x, y, 'editTopLeft'),` && |\n| && -` topRight : new Helper(this._groupEl, x, y, 'editTopRight'),` && |\n| && -` bottomLeft : new Helper(this._groupEl, x, y, 'editBottomLeft'),` && |\n| && -` bottomRight : new Helper(this._groupEl, x, y, 'editBottomRight')` && |\n| && -` };` && |\n| && -` ` && |\n| && -` this.redraw();` && |\n| && -` }` && |\n| && -` utils.inherits(Rectangle, Area);` && |\n| && -` ` && |\n| && -` Rectangle.prototype.setSVGCoords = function(coords) {` && |\n| && -` this._el.setAttribute('x', coords.x);` && |\n| && -` this._el.setAttribute('y', coords.y);` && |\n| && -` this._el.setAttribute('width', coords.width);` && |\n| && -` this._el.setAttribute('height', coords.height);` && |\n| && -` ` && |\n| && -` var top = coords.y,` && |\n| && -` center_y = coords.y + coords.height / 2,` && |\n| && -` bottom = coords.y + coords.height,` && |\n| && -` left = coords.x,` && |\n| && -` center_x = coords.x + coords.width / 2,` && |\n| && -` right = coords.x + coords.width;` && |\n| && -` ` && |\n| && -` this._helpers.center.setCoords(center_x, center_y);` && |\n| && -` this._helpers.top.setCoords(center_x, top);` && |\n| && -` this._helpers.bottom.setCoords(center_x, bottom);` && |\n| && -` this._helpers.left.setCoords(left, center_y);` && |\n| && -` this._helpers.right.setCoords(right, center_y);` && |\n| && -` this._helpers.topLeft.setCoords(left, top);` && |\n| && -` this._helpers.topRight.setCoords(right, top);` && |\n| && -` this._helpers.bottomLeft.setCoords(left, bottom);` && |\n| && -` this._helpers.bottomRight.setCoords(right, bottom);` && |\n| && -` ` && |\n| && -` return this;` && |\n| && -` };` && |\n| && -` ` && |\n| && -` Rectangle.prototype.setCoords = function(coords) {` && |\n| && -` this._coords.x = coords.x;` && |\n| && -` this._coords.y = coords.y;` && |\n| && -` this._coords.width = coords.width;` && |\n| && -` this._coords.height = coords.height;` && |\n| && -` ` && |\n| && -` return this;` && |\n| && -` };` && |\n| && -` ` && |\n| && -` Rectangle.prototype.dynamicDraw = function(x, y, isSquare) {` && |\n| && -` var newCoords = {` && |\n| && -` x : this._coords.x,` && |\n| && -` y : this._coords.y,` && |\n| && -` width : x - this._coords.x,` && |\n| && -` height: y - this._coords.y` && |\n| && -` };` && |\n| && -` ` && |\n| && -` if (isSquare) {` && |\n| && -` newCoords = Rectangle.getSquareCoords(newCoords);` && |\n| && -` }` && |\n| && -` ` && |\n| && -` newCoords = Rectangle.getNormalizedCoords(newCoords);` && |\n| && -` ` && |\n| && -` this.redraw(newCoords);` && |\n| && -` ` && |\n| && -` return newCoords;` && |\n| && -` };` && |\n| && -` ` && |\n| && -` Rectangle.prototype.onProcessDrawing = function(e) {` && |\n| && -` var coords = utils.getRightCoords(e.pageX, e.pageY);` && |\n| && -` ` && |\n| && -` this.dynamicDraw(coords.x, coords.y, e.shiftKey);` && |\n| && -` };` && |\n| && -` ` && |\n| && -` Rectangle.prototype.onStopDrawing = function(e) {` && |\n| && -` var coords = utils.getRightCoords(e.pageX, e.pageY);` && |\n| && -` ` && |\n| && -` this.setCoords(this.dynamicDraw(coords.x, coords.y, e.shiftKey)).deselect();` && |\n| && -` ` && |\n| && -` app.removeAllEvents()` && |\n| && -` .setIsDraw(false)` && |\n| && -` .resetNewArea();` && |\n| && -` };` && |\n| && -` ` && |\n| && -` Rectangle.prototype.edit = function(editingType, dx, dy) {` && |\n| && -` var tempParams = Object.create(this._coords);` && |\n| && -` ` && |\n| && -` switch (editingType) {` && |\n| && -` case 'move':` && |\n| && -` tempParams.x += dx;` && |\n| && -` tempParams.y += dy;` && |\n| && -` break;` && |\n| && -` ` && |\n| && -` case 'editLeft':` && |\n| && -` tempParams.x += dx; ` && |\n| && -` tempParams.width -= dx;` && |\n| && -` break;` && |\n| && -` ` && |\n| && -` case 'editRight':` && |\n| && -` tempParams.width += dx;` && |\n| && -` break;` && |\n| && -` ` && |\n| && -` case 'editTop':` && |\n| && -` tempParams.y += dy;` && |\n| && -` tempParams.height -= dy;` && |\n| && -` break;` && |\n| && -` ` && |\n| && -` case 'editBottom':` && |\n| && -` tempParams.height += dy;` && |\n| && -` break;` && |\n| && -` ` && |\n| && -` case 'editTopLeft':` && |\n| && -` tempParams.x += dx;` && |\n| && -` tempParams.y += dy;` && |\n| && -` tempParams.width -= dx;` && |\n| && -` tempParams.height -= dy;` && |\n| && -` break;` && |\n| && -` ` && |\n| && -` case 'editTopRight':` && |\n| && -` tempParams.y += dy;` && |\n| && -` tempParams.width += dx;` && |\n| && -` tempParams.height -= dy;` && |\n| && -` break;` && |\n| && -` ` && |\n| && -` case 'editBottomLeft':` && |\n| && -` tempParams.x += dx;` && |\n| && -` tempParams.width -= dx;` && |\n| && -` tempParams.height += dy;` && |\n| && -` break;` && |\n| && -` ` && |\n| && -` case 'editBottomRight':` && |\n| && -` tempParams.width += dx;` && |\n| && -` tempParams.height += dy;` && |\n| && -` break;` && |\n| && -` }` && |\n| && -`` && |\n|. -result = result && -` return tempParams;` && |\n| && -` };` && |\n| && -` ` && |\n| && -` Rectangle.prototype.dynamicEdit = function(coords, saveProportions) {` && |\n| && -` coords = Rectangle.getNormalizedCoords(coords);` && |\n| && -` ` && |\n| && -` if (saveProportions) {` && |\n| && -` coords = Rectangle.getSavedProportionsCoords(coords);` && |\n| && -` }` && |\n| && -` ` && |\n| && -` this.redraw(coords);` && |\n| && -` ` && |\n| && -` return coords;` && |\n| && -` };` && |\n| && -` ` && |\n| && -` Rectangle.prototype.onProcessEditing = function(e) {` && |\n| && -` return this.dynamicEdit(` && |\n| && -` this.edit(` && |\n| && -` app.getEditType(),` && |\n| && -` e.pageX - this.editingStartPoint.x,` && |\n| && -` e.pageY - this.editingStartPoint.y` && |\n| && -` ),` && |\n| && -` e.shiftKey` && |\n| && -` );` && |\n| && -` };` && |\n| && -` ` && |\n| && -` Rectangle.prototype.onStopEditing = function(e) {` && |\n| && -` this.setCoords(this.onProcessEditing(e));` && |\n| && -` app.removeAllEvents();` && |\n| && -` };` && |\n| && -`` && |\n| && -` Rectangle.prototype.toString = function() {` && |\n| && -` return 'Rectangle {x: '+ this._coords.x + ` && |\n| && -` ', y: ' + this._coords.y + ` && |\n| && -` ', width: ' + this._coords.width + ` && |\n| && -` ', height: ' + this._coords.height + '}';` && |\n| && -` }` && |\n| && -` ` && |\n| && -` Rectangle.prototype.toHTMLMapElementString = function() {` && |\n| && -` var x2 = this._coords.x + this._coords.width,` && |\n| && -` y2 = this._coords.y + this._coords.height;` && |\n| && -` ` && |\n| && -` return '<area shape="rect" coords="' // TODO: use template engine` && |\n| && -` + this._coords.x + ', '` && |\n| && -` + this._coords.y + ', '` && |\n| && -` + x2 + ', '` && |\n| && -` + y2` && |\n| && -` + '"'` && |\n| && -` + (this._attributes.href ? ' href="' + this._attributes.href + '"' : '')` && |\n| && -` + (this._attributes.alt ? ' alt="' + this._attributes.alt + '"' : '')` && |\n| && -` + (this._attributes.title ? ' title="' + this._attributes.title + '"' : '')` && |\n| && -` + ' />';` && |\n| && -` };` && |\n| && -`` && |\n| && -` Rectangle.prototype.getCoordsForDisplayingInfo = function() {` && |\n| && -` return {` && |\n| && -` x : this._coords.x,` && |\n| && -` y : this._coords.y` && |\n| && -` };` && |\n| && -` };` && |\n| && -` ` && |\n| && -` Rectangle.testCoords = function(coords) {` && |\n| && -` return coords.x && coords.y && coords.width && coords.height;` && |\n| && -` };` && |\n| && -` ` && |\n| && -` Rectangle.testHTMLCoords = function(coords) {` && |\n| && -` return coords.length === 4;` && |\n| && -` };` && |\n| && -`` && |\n| && -` Rectangle.getCoordsFromHTMLArray = function(htmlCoordsArray) {` && |\n| && -` if (!Rectangle.testHTMLCoords(htmlCoordsArray)) { ` && |\n| && -` throw new Error('This html-coordinates is not valid for rectangle');` && |\n| && -` }` && |\n| && -`` && |\n| && -` return {` && |\n| && -` x : htmlCoordsArray[0],` && |\n| && -` y : htmlCoordsArray[1],` && |\n| && -` width : htmlCoordsArray[2] - htmlCoordsArray[0],` && |\n| && -` height : htmlCoordsArray[3] - htmlCoordsArray[1]` && |\n| && -` };` && |\n| && -` };` && |\n| && -`` && |\n| && -` Rectangle.getNormalizedCoords = function(coords) {` && |\n| && -` if (coords.width < 0) {` && |\n| && -` coords.x += coords.width;` && |\n| && -` coords.width = Math.abs(coords.width);` && |\n| && -` }` && |\n| && -` ` && |\n| && -` if (coords.height < 0) {` && |\n| && -` coords.y += coords.height;` && |\n| && -` coords.height = Math.abs(coords.height);` && |\n| && -` }` && |\n| && -` ` && |\n| && -` return coords;` && |\n| && -` };` && |\n| && -` ` && |\n| && -` Rectangle.getSquareCoords = function(coords) {` && |\n| && -` var width = Math.abs(coords.width),` && |\n| && -` height = Math.abs(coords.height);` && |\n| && -` ` && |\n| && -` if (width > height) {` && |\n| && -` coords.width = coords.width > 0 ? height : -height;` && |\n| && -` } else {` && |\n| && -` coords.height = coords.height > 0 ? width : -width;` && |\n| && -` }` && |\n| && -` ` && |\n| && -` return coords;` && |\n| && -` };` && |\n| && -` ` && |\n| && -` Rectangle.getSavedProportionsCoords = function(coords, originalCoords) {` && |\n| && -` var originalProportions = coords.width / coords.height,` && |\n| && -` currentProportions = originalCoords.width / originalCoords.height;` && |\n| && -` ` && |\n| && -` if (currentProportions > originalProportions) {` && |\n| && -` coords.width = Math.round(coords.height * originalProportions);` && |\n| && -` } else {` && |\n| && -` coords.height = Math.round(coords.width / originalProportions);` && |\n| && -` }` && |\n| && -` ` && |\n| && -` return coords;` && |\n| && -` };` && |\n| && -` ` && |\n| && -` Rectangle.createAndStartDrawing = function(firstPointCoords) {` && |\n| && -` var newArea = new Rectangle({` && |\n| && -` x : firstPointCoords.x,` && |\n| && -` y : firstPointCoords.y,` && |\n| && -` width: 0,` && |\n| && -` height: 0` && |\n| && -` });` && |\n| && -` ` && |\n| && -` app.addEvent(app.domElements.container, 'mousemove', newArea.onProcessDrawing.bind(newArea))` && |\n| && -` .addEvent(app.domElements.container, 'click', newArea.onStopDrawing.bind(newArea));` && |\n| && -` ` && |\n| && -` return newArea;` && |\n| && -` };` && |\n| && -` ` && |\n| && -`` && |\n| && -` function Circle(coords, attributes) {` && |\n| && -` Area.call(this, 'circle', coords, attributes);` && |\n| && -` ` && |\n| && -` this._coords = {` && |\n| && -` cx : coords.cx || 0,` && |\n| && -` cy : coords.cy || 0,` && |\n| && -` radius : coords.radius || 0 ` && |\n| && -` };` && |\n| && -` ` && |\n| && -` this._el = document.createElementNS(Area.SVG_NS, 'circle');` && |\n| && -` this._groupEl.appendChild(this._el);` && |\n| && -` ` && |\n| && -` this.helpers = {` && |\n| && -` center : new Helper(this._groupEl, coords.cx, coords.cy, 'move'),` && |\n| && -` top : new Helper(this._groupEl, coords.cx, coords.cy, 'editTop'),` && |\n| && -` bottom : new Helper(this._groupEl, coords.cx, coords.cy, 'editBottom'),` && |\n| && -` left : new Helper(this._groupEl, coords.cx, coords.cy, 'editLeft'),` && |\n| && -` right : new Helper(this._groupEl, coords.cx, coords.cy, 'editRight')` && |\n| && -` };` && |\n| && -` ` && |\n| && -` this.redraw();` && |\n| && -` }` && |\n| && -` utils.inherits(Circle, Area);` && |\n| && -` ` && |\n| && -` Circle.prototype.setSVGCoords = function(coords) {` && |\n| && -` this._el.setAttribute('cx', coords.cx);` && |\n| && -` this._el.setAttribute('cy', coords.cy);` && |\n| && -` this._el.setAttribute('r', coords.radius);` && |\n| && -` ` && |\n| && -` this.helpers.center.setCoords(coords.cx, coords.cy);` && |\n| && -` this.helpers.top.setCoords(coords.cx, coords.cy - coords.radius);` && |\n| && -` this.helpers.right.setCoords(coords.cx + coords.radius, coords.cy);` && |\n| && -` this.helpers.bottom.setCoords(coords.cx, coords.cy + coords.radius);` && |\n| && -` this.helpers.left.setCoords(coords.cx - coords.radius, coords.cy);` && |\n| && -` ` && |\n| && -` return this;` && |\n| && -` };` && |\n| && -` ` && |\n| && -` Circle.prototype.setCoords = function(coords) {` && |\n| && -` this._coords.cx = coords.cx;` && |\n| && -` this._coords.cy = coords.cy;` && |\n| && -` this._coords.radius = coords.radius;` && |\n| && -` ` && |\n| && -` return this;` && |\n| && -` };` && |\n| && -` ` && |\n| && -` Circle.prototype.dynamicDraw = function(x, y) {` && |\n| && -` var radius = Math.round(` && |\n| && -` Math.sqrt(` && |\n| && -` Math.pow(this._coords.cx - x, 2) +` && |\n| && -` Math.pow(this._coords.cy - y, 2)` && |\n| && -` )` && |\n| && -` ),` && |\n| && -` newCoords = {` && |\n| && -` cx : this._coords.cx,` && |\n| && -` cy : this._coords.cy,` && |\n| && -` radius : radius` && |\n| && -` };` && |\n| && -`` && |\n| && -` this.redraw(newCoords);` && |\n| && -` ` && |\n| && -` return newCoords;` && |\n| && -` };` && |\n| && -` ` && |\n| && -` Circle.prototype.onProcessDrawing = function(e) {` && |\n| && -` var coords = utils.getRightCoords(e.pageX, e.pageY);` && |\n| && -` ` && |\n| && -` this.dynamicDraw(coords.x, coords.y);` && |\n| && -` };` && |\n| && -` ` && |\n| && -` Circle.prototype.onStopDrawing = function(e) {` && |\n| && -` var coords = utils.getRightCoords(e.pageX, e.pageY);` && |\n| && -` ` && |\n| && -` this.setCoords(this.dynamicDraw(coords.x, coords.y)).deselect();` && |\n| && -` ` && |\n| && -` app.removeAllEvents()` && |\n| && -` .setIsDraw(false)` && |\n| && -` .resetNewArea();` && |\n| && -` };` && |\n| && -` ` && |\n| && -` Circle.prototype.edit = function(editingType, dx, dy) {` && |\n| && -` var tempParams = Object.create(this._coords);` && |\n| && -` ` && |\n| && -` switch (editingType) {` && |\n| && -` case 'move':` && |\n| && -` tempParams.cx += dx;` && |\n| && -` tempParams.cy += dy;` && |\n| && -` break;` && |\n| && -` ` && |\n| && -` case 'editTop':` && |\n| && -` tempParams.radius -= dy;` && |\n| && -` break;` && |\n| && -` ` && |\n| && -` case 'editBottom':` && |\n| && -` tempParams.radius += dy;` && |\n| && -` break;` && |\n| && -` ` && |\n| && -` case 'editLeft':` && |\n| && -` tempParams.radius -= dx;` && |\n| && -` break;` && |\n| && -` ` && |\n| && -` case 'editRight':` && |\n| && -` tempParams.radius += dx;` && |\n| && -` break;` && |\n| && -` }` && |\n| && -` ` && |\n| && -` return tempParams;` && |\n| && -` };` && |\n| && -` ` && |\n| && -` Circle.prototype.dynamicEdit = function(tempCoords) {` && |\n| && -` if (tempCoords.radius < 0) {` && |\n| && -` tempCoords.radius = Math.abs(tempCoords.radius);` && |\n| && -` }` && |\n| && -` ` && |\n| && -` this.setSVGCoords(tempCoords);` && |\n| && -` ` && |\n| && -` return tempCoords;` && |\n| && -` };` && |\n| && -` ` && |\n| && -` Circle.prototype.onProcessEditing = function(e) {` && |\n| && -` var editType = app.getEditType();` && |\n| && -` ` && |\n| && -` return this.dynamicEdit(` && |\n| && -` this.edit(editType, e.pageX - this.editingStartPoint.x, e.pageY - this.editingStartPoint.y)` && |\n| && -` );` && |\n| && -` };` && |\n| && -` ` && |\n| && -` Circle.prototype.onStopEditing = function(e) {` && |\n| && -` var editType = app.getEditType();` && |\n| && -` ` && |\n| && -` this.setCoords(this.onProcessEditing(e));` && |\n| && -` ` && |\n| && -` app.removeAllEvents();` && |\n| && -` };` && |\n| && -` ` && |\n| && -` /**` && |\n| && -` * Returns string-representation of circle` && |\n| && -` * ` && |\n| && -` * @returns {string}` && |\n| && -` */` && |\n| && -` Circle.prototype.toString = function() {` && |\n| && -` return 'Circle {cx: '+ this._coords.cx +` && |\n| && -` ', cy: ' + this._coords.cy +` && |\n| && -` ', radius: ' + this._coords.radius + '}';` && |\n| && -` }` && |\n| && -` ` && |\n| && -` Circle.prototype.toHTMLMapElementString = function() {` && |\n| && -` return '<area shape="circle" coords="'` && |\n| && -` + this._coords.cx + ', '` && |\n| && -` + this._coords.cy + ', '` && |\n| && -` + this._coords.radius` && |\n| && -` + '"'` && |\n| && -` + (this._attributes.href ? ' href="' + this._attributes.href + '"' : '')` && |\n| && -` + (this._attributes.alt ? ' alt="' + this._attributes.alt + '"' : '')` && |\n| && -` + (this._attributes.title ? ' title="' + this._attributes.title + '"' : '')` && |\n| && -` + ' />';` && |\n| && -` };` && |\n| && -`` && |\n| && -` /**` && |\n| && -` * Returns coords for area attributes form` && |\n| && -` * ` && |\n| && -` * @returns {Object} - coordinates of point` && |\n| && -` */` && |\n| && -` Circle.prototype.getCoordsForDisplayingInfo = function() {` && |\n| && -` return {` && |\n| && -` x : this._coords.cx,` && |\n| && -` y : this._coords.cy` && |\n| && -` };` && |\n| && -` };` && |\n| && -` ` && |\n| && -` Circle.testCoords = function(coords) {` && |\n| && -` return coords.cx && coords.cy && coords.radius;` && |\n| && -` };` && |\n| && -`` && |\n| && -` Circle.testHTMLCoords = function(coords) {` && |\n| && -` return coords.length === 3;` && |\n| && -` };` && |\n| && -`` && |\n| && -` Circle.getCoordsFromHTMLArray = function(htmlCoordsArray) {` && |\n| && -` if (!Circle.testHTMLCoords(htmlCoordsArray)) { ` && |\n| && -` throw new Error('This html-coordinates is not valid for circle');` && |\n| && -` }` && |\n| && -`` && |\n| && -` return {` && |\n| && -` cx : htmlCoordsArray[0],` && |\n| && -` cy : htmlCoordsArray[1],` && |\n| && -` radius : htmlCoordsArray[2]` && |\n| && -` };` && |\n| && -` };` && |\n| && -` ` && |\n| && -` Circle.createAndStartDrawing = function(firstPointCoords) {` && |\n| && -` var newArea = new Circle({` && |\n| && -` cx : firstPointCoords.x,` && |\n| && -` cy : firstPointCoords.y,` && |\n| && -` radius : 0` && |\n| && -` });` && |\n| && -` ` && |\n| && -` app.addEvent(app.domElements.container, 'mousemove', newArea.onProcessDrawing.bind(newArea))` && |\n| && -` .addEvent(app.domElements.container, 'click', newArea.onStopDrawing.bind(newArea));` && |\n| && -` ` && |\n| && -` return newArea;` && |\n| && -` };` && |\n| && -`` && |\n| && -` function Polygon(coords, attributes) {` && |\n| && -` Area.call(this, 'polygon', coords, attributes);` && |\n| && -` ` && |\n| && -` /**` && |\n| && -` * @namespace` && |\n| && -` * @property {Array} points - Array with coordinates of polygon points` && |\n| && -` */` && |\n| && -` this._coords = {` && |\n| && -` points : coords.points || [{x: 0, y: 0}],` && |\n| && -` isOpened : coords.isOpened || false` && |\n| && -` };` && |\n| && -` ` && |\n| && -` this._el = document.createElementNS(` && |\n| && -` Area.SVG_NS, ` && |\n| && -` this._coords.isOpened ? 'polyline' : 'polygon'` && |\n| && -` );` && |\n| && -` this._groupEl.appendChild(this._el);` && |\n| && -`` && |\n| && -` this._helpers = { ` && |\n| && -` points : []` && |\n| && -` };` && |\n| && -`` && |\n| && -` for (var i = 0, c = this._coords.points.length; i < c; i++) {` && |\n| && -` this._helpers.points.push(` && |\n| && -` (new Helper(` && |\n| && -` this._groupEl, ` && |\n| && -` this._coords.points[i].x, ` && |\n| && -` this._coords.points[i].y, ` && |\n| && -` 'movePoint')` && |\n| && -` ).setId(i)` && |\n| && -` );` && |\n| && -` }` && |\n| && -` ` && |\n| && -` this._selectedPoint = -1;` && |\n| && -` ` && |\n| && -` this.redraw();` && |\n| && -` }` && |\n| && -` utils.inherits(Polygon, Area);` && |\n| && -` ` && |\n| && -` Polygon.prototype.close = function() {` && |\n| && -` var polyline = this._el;` && |\n| && -` this._el = document.createElementNS(Area.SVG_NS, 'polygon');` && |\n| && -` this._groupEl.replaceChild(this._el, polyline);` && |\n| && -`` && |\n| && -` this._coords.isOpened = false;` && |\n| && -` this.redraw().deselect();` && |\n| && -` };` && |\n| && -` ` && |\n|. + METHOD load_editor_js. + result = `` && |\n| && + `loadJsEditor = function(base64_image, filename) {` && |\n| && + ` var summerHtmlImageMapCreator = (function() {` && |\n| && + ` 'use strict';` && |\n| && + ` ` && |\n| && + ` var utils = {` && |\n| && + ` getOffset : function(node) {` && |\n| && + ` var boxCoords = node.getBoundingClientRect();` && |\n| && + ` ` && |\n| && + ` return {` && |\n| && + ` x : Math.round(boxCoords.left + window.pageXOffset),` && |\n| && + ` y : Math.round(boxCoords.top + window.pageYOffset)` && |\n| && + ` };` && |\n| && + ` },` && |\n| && + ` ` && |\n| && + ` getRightCoords : function(x, y) {` && |\n| && + ` return {` && |\n| && + ` x : x - app.getOffset('x'),` && |\n| && + ` y : y - app.getOffset('y')` && |\n| && + ` };` && |\n| && + ` },` && |\n| && + ` ` && |\n| && + ` /**` && |\n| && + ` * TODO: will use same method of app.js` && |\n| && + ` * @deprecated` && |\n| && + ` */` && |\n| && + ` id : function (str) {` && |\n| && + ` return document.getElementById(str);` && |\n| && + ` },` && |\n| && + ` ` && |\n| && + ` /**` && |\n| && + ` * TODO: will use same method of app.js` && |\n| && + ` * @deprecated` && |\n| && + ` */` && |\n| && + ` hide : function(node) {` && |\n| && + ` node.style.display = 'none';` && |\n| && + ` ` && |\n| && + ` return this;` && |\n| && + ` },` && |\n| && + ` ` && |\n| && + ` /**` && |\n| && + ` * TODO: will use same method of app.js` && |\n| && + ` * @deprecated` && |\n| && + ` */` && |\n| && + ` show : function(node) {` && |\n| && + ` node.style.display = 'block';` && |\n| && + ` ` && |\n| && + ` return this;` && |\n| && + ` },` && |\n| && + ` ` && |\n| && + ` /**` && |\n| && + ` * Escape < and > (for code output)` && |\n| && + ` *` && |\n| && + ` * @param str {string} - a string with < and >` && |\n| && + ` * @returns {string} - a string with escaped < and >` && |\n| && + ` */` && |\n| && + ` encode : function(str) {` && |\n| && + ` return str.replace(/</g, '&lt;').replace(/>/g, '&gt;');` && |\n| && + ` },` && |\n| && + ` ` && |\n| && + ` /**` && |\n| && + ` * TODO: will use same method of app.js` && |\n| && + ` * @deprecated` && |\n| && + ` */` && |\n| && + ` foreach : function(arr, func) {` && |\n| && + ` for(var i = 0, count = arr.length; i < count; i++) {` && |\n| && + ` func(arr[i], i);` && |\n| && + ` }` && |\n| && + ` },` && |\n| && + ` ` && |\n| && + ` /**` && |\n| && + ` * TODO: will use same method of app.js` && |\n| && + ` * @deprecated` && |\n| && + ` */` && |\n| && + ` foreachReverse : function(arr, func) {` && |\n| && + ` for(var i = arr.length - 1; i >= 0; i--) {` && |\n| && + ` func(arr[i], i);` && |\n| && + ` }` && |\n| && + ` },` && |\n| && + ` ` && |\n| && + ` debug : (function() {` && |\n| && + ` var output = document.getElementById('debug');` && |\n| && + ` ` && |\n| && + ` return function() {` && |\n| && + ` output.innerHTML = [].join.call(arguments, ' ');` && |\n| && + ` };` && |\n| && + ` })(),` && |\n| && + ` ` && |\n| && + ` /**` && |\n| && + ` * TODO: will use same method of app.js` && |\n| && + ` * @deprecated` && |\n| && + ` */` && |\n| && + ` stopEvent : function(e) {` && |\n| && + ` e.stopPropagation();` && |\n| && + ` e.preventDefault();` && |\n| && + ` ` && |\n| && + ` return this;` && |\n| && + ` },` && |\n| && + ` ` && |\n| && + ` extend : function(obj, options) {` && |\n| && + ` var target = {};` && |\n| && + `` && |\n| && + ` for (var name in obj) {` && |\n| && + ` if(obj.hasOwnProperty(name)) {` && |\n| && + ` target[name] = options[name] ? options[name] : obj[name];` && |\n| && + ` }` && |\n| && + ` }` && |\n| && + `` && |\n| && + ` return target;` && |\n| && + ` },` && |\n| && + ` ` && |\n| && + ` inherits : (function() {` && |\n| && + ` var F = function() {};` && |\n| && + ` ` && |\n| && + ` return function(Child, Parent) {` && |\n| && + ` F.prototype = Parent.prototype;` && |\n| && + ` Child.prototype = new F();` && |\n| && + ` Child.prototype.constructor = Child;` && |\n| && + ` };` && |\n| && + ` })()` && |\n| && + ` };` && |\n| && + `` && |\n| && + `` && |\n| && + ` var app = (function() {` && |\n| && + ` var domElements = {` && |\n| && + ` wrapper : utils.id('wrapper'),` && |\n| && + ` svg : utils.id('svg'),` && |\n| && + ` img : utils.id('img'),` && |\n| && + ` container : utils.id('image'),` && |\n| && + ` map : null` && |\n| && + ` },` && |\n| && + ` state = {` && |\n| && + ` offset : {` && |\n| && + ` x : 0,` && |\n| && + ` y : 0` && |\n| && + ` },` && |\n| && + ` appMode : null, // drawing || editing || preview` && |\n| && + ` currentType : null,` && |\n| && + ` editType : null,` && |\n| && + ` newArea : null,` && |\n| && + ` selectedArea : null,` && |\n| && + ` areas : [],` && |\n| && + ` events : [],` && |\n| && + ` isDraw : false,` && |\n| && + ` image : {` && |\n| && + ` src : null,` && |\n| && + ` filename : null,` && |\n| && + ` width: 0,` && |\n| && + ` height: 0` && |\n| && + ` }` && |\n| && + ` },` && |\n| && + ` KEYS = {` && |\n| && + ` F1 : 112,` && |\n| && + ` ESC : 27,` && |\n| && + ` TOP : 38,` && |\n| && + ` BOTTOM : 40,` && |\n| && + ` LEFT : 37,` && |\n| && + ` RIGHT : 39,` && |\n| && + ` DELETE : 46,` && |\n| && + ` I : 73,` && |\n| && + ` S : 83,` && |\n| && + ` C : 67` && |\n| && + ` };` && |\n| && + `` && |\n| && + ` function recalcOffsetValues() {` && |\n| && + ` state.offset = utils.getOffset(domElements.container);` && |\n| && + ` }` && |\n| && + `` && |\n| && + ` /* Get offset value */` && |\n| && + ` window.addEventListener('resize', recalcOffsetValues, false);` && |\n| && + `` && |\n| && + ` /* Disable selection */` && |\n| && + ` domElements.container.addEventListener('mousedown', function(e) { e.preventDefault(); }, false);` && |\n| && + `` && |\n| && + ` /* Disable image dragging */` && |\n| && + ` domElements.img.addEventListener('dragstart', function(e){` && |\n| && + ` e.preventDefault();` && |\n| && + ` }, false);` && |\n| && + `` && |\n| && + ` /* Display cursor coordinates info */` && |\n| && + ` var cursor_position_info = (function() {` && |\n| && + ` var coords_info = utils.id('coords');` && |\n| && + ` ` && |\n| && + ` return {` && |\n| && + ` set : function(coords) {` && |\n| && + ` coords_info.innerHTML = 'x: ' + coords.x + ', ' + 'y: ' + coords.y;` && |\n| && + ` },` && |\n| && + ` empty : function() {` && |\n| && + ` coords_info.innerHTML = '';` && |\n| && + ` }` && |\n| && + ` };` && |\n| && + ` })();` && |\n| && + ` ` && |\n| && + ` domElements.container.addEventListener('mousemove', function(e){` && |\n| && + ` cursor_position_info.set(utils.getRightCoords(e.pageX, e.pageY));` && |\n| && + ` }, false);` && |\n| && + `` && |\n| && + ` domElements.container.addEventListener('mouseleave', function(){` && |\n| && + ` cursor_position_info.empty();` && |\n| && + ` }, false);` && |\n| && + `` && |\n| && + ` /* Add mousedown event for svg */` && |\n| && + ` function onSvgMousedown(e) {` && |\n| && + ` if (state.appMode === 'editing') {` && |\n| && + ` if (e.target.parentNode.tagName === 'g') {` && |\n| && + ` info.unload();` && |\n| && + ` state.selectedArea = e.target.parentNode.obj;` && |\n| && + ` ` && |\n| && + ` app.deselectAll();` && |\n| && + ` state.selectedArea.select();` && |\n| && + ` state.selectedArea.editingStartPoint = {` && |\n| && + ` x : e.pageX,` && |\n| && + ` y : e.pageY` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` if (e.target.classList.contains('helper')) {` && |\n| && + ` var helper = e.target;` && |\n| && + ` state.editType = helper.action;` && |\n| && + ` ` && |\n| && + ` if (helper.n >= 0) { // if typeof selected_area == polygon` && |\n| && + ` state.selectedArea.selected_point = helper.n;` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` app.addEvent(app.domElements.container,` && |\n| && + ` 'mousemove',` && |\n| && + ` state.selectedArea.onProcessEditing.bind(state.selectedArea))` && |\n| && + ` .addEvent(app.domElements.container,` && |\n| && + ` 'mouseup',` && |\n| && + ` state.selectedArea.onStopEditing.bind(state.selectedArea));` && |\n| && + ` } else if (e.target.tagName === 'rect' || e.target.tagName === 'circle' || e.target.tagName === 'polygon') {` && |\n| && + ` state.editType = 'move';` && |\n| && + ` ` && |\n| && + ` app.addEvent(app.domElements.container,` && |\n| && + ` 'mousemove',` && |\n| && + ` state.selectedArea.onProcessEditing.bind(state.selectedArea))` && |\n| && + ` .addEvent(app.domElements.container,` && |\n| && + ` 'mouseup',` && |\n| && + ` state.selectedArea.onStopEditing.bind(state.selectedArea));` && |\n| && + ` }` && |\n| && + ` } else {` && |\n| && + ` app.deselectAll();` && |\n| && + ` info.unload();` && |\n| && + ` }` && |\n| && + ` }` && |\n| && + ` }` && |\n| && + ` ` && |\n|. + result = result && ` domElements.container.addEventListener('mousedown', onSvgMousedown, false);` && |\n| && + ` ` && |\n| && + ` /* Add click event for svg */` && |\n| && + ` function onSvgClick(e) {` && |\n| && + ` if (state.appMode === 'drawing' && !state.isDraw && state.currentType) {` && |\n| && + ` code.hide();` && |\n| && + ` app.setIsDraw(true);` && |\n| && + ` ` && |\n| && + ` state.newArea = Area.CONSTRUCTORS[state.currentType].createAndStartDrawing(` && |\n| && + ` utils.getRightCoords(e.pageX, e.pageY)` && |\n| && + ` );` && |\n| && + ` }` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` domElements.container.addEventListener('click', onSvgClick, false);` && |\n| && + ` ` && |\n| && + ` /* Add dblclick event for svg */` && |\n| && + ` function onAreaDblClick(e) {` && |\n| && + ` if (state.appMode === 'editing') {` && |\n| && + ` if (e.target.tagName === 'rect' || e.target.tagName === 'circle' || e.target.tagName === 'polygon') {` && |\n| && + ` state.selectedArea = e.target.parentNode.obj;` && |\n| && + ` info.load(state.selectedArea, e.pageX, e.pageY);` && |\n| && + ` }` && |\n| && + ` }` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` domElements.container.addEventListener('dblclick', onAreaDblClick, false);` && |\n| && + ` ` && |\n| && + ` ` && |\n| && + ` /* Add keydown event for document */` && |\n| && + ` function onDocumentKeyDown(e) {` && |\n| && + ` var ctrlDown = e.ctrlKey || e.metaKey; // PC || Mac` && |\n| && + ` ` && |\n| && + ` switch (e.keyCode) {` && |\n| && + ` case KEYS.F1:` && |\n| && + ` help.show();` && |\n| && + ` e.preventDefault();` && |\n| && + ` ` && |\n| && + ` break;` && |\n| && + ` ` && |\n| && + ` case KEYS.ESC:` && |\n| && + ` help.hide();` && |\n| && + ` if (state.isDraw) {` && |\n| && + ` state.isDraw = false;` && |\n| && + ` state.newArea.remove();` && |\n| && + ` state.areas.pop();` && |\n| && + ` app.removeAllEvents();` && |\n| && + ` } else if (state.appMode === 'editing') {` && |\n| && + ` state.selectedArea.redraw();` && |\n| && + ` app.removeAllEvents();` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` break;` && |\n| && + ` ` && |\n| && + ` case KEYS.TOP:` && |\n| && + ` if (state.appMode === 'editing' && state.selectedArea) {` && |\n| && + ` state.selectedArea.move(0, -1);` && |\n| && + ` e.preventDefault();` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` break;` && |\n| && + ` ` && |\n| && + ` case KEYS.BOTTOM:` && |\n| && + ` if (state.appMode === 'editing' && state.selectedArea) {` && |\n| && + ` state.selectedArea.move(0, 1);` && |\n| && + ` e.preventDefault();` && |\n| && + ` }` && |\n| && + ` break;` && |\n| && + ` ` && |\n| && + ` case KEYS.LEFT: ` && |\n| && + ` if (state.appMode === 'editing' && state.selectedArea) {` && |\n| && + ` state.selectedArea.move(-1, 0);` && |\n| && + ` e.preventDefault();` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` break;` && |\n| && + ` ` && |\n| && + ` case KEYS.RIGHT:` && |\n| && + ` if (state.appMode === 'editing' && state.selectedArea) {` && |\n| && + ` state.selectedArea.move(1, 0);` && |\n| && + ` e.preventDefault();` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` break;` && |\n| && + ` ` && |\n| && + ` case KEYS.DELETE:` && |\n| && + ` if (state.appMode === 'editing' && state.selectedArea) {` && |\n| && + ` app.removeObject(state.selectedArea);` && |\n| && + ` state.selectedArea = null;` && |\n| && + ` info.unload();` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` break;` && |\n| && + ` ` && |\n| && + ` case KEYS.I:` && |\n| && + ` if (state.appMode === 'editing' && state.selectedArea) {` && |\n| && + ` var coordsForAttributesForm = state.selectedArea.getCoordsForDisplayingInfo();` && |\n| && + ` ` && |\n| && + ` info.load(` && |\n| && + ` state.selectedArea, ` && |\n| && + ` coordsForAttributesForm.x + app.getOffset('x'), ` && |\n| && + ` coordsForAttributesForm.y + app.getOffset('y')` && |\n| && + ` );` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` break;` && |\n| && + ` ` && |\n| && + ` case KEYS.S:` && |\n| && + ` if (ctrlDown) {` && |\n| && + ` app.saveInLocalStorage();` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` break;` && |\n| && + ` ` && |\n| && + ` case KEYS.C:` && |\n| && + ` if (state.appMode === 'editing' && state.selectedArea && ctrlDown) {` && |\n| && + ` state.selectedArea = Area.copy(state.selectedArea);` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` break;` && |\n| && + ` }` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` document.addEventListener('keydown', onDocumentKeyDown, false);` && |\n| && + ` ` && |\n| && + ` // Will moved from the main module` && |\n| && + ` var areasIO = {` && |\n| && + ` toJSON : function() {` && |\n| && + ` var obj = {` && |\n| && + ` areas : [],` && |\n| && + ` img : state.image.src` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` utils.foreach(state.areas, function(x) {` && |\n| && + ` obj.areas.push(x.toJSON());` && |\n| && + ` });` && |\n| && + ` ` && |\n| && + ` return JSON.stringify(obj);` && |\n| && + ` },` && |\n| && + ` fromJSON : function(str) {` && |\n| && + ` var obj = JSON.parse(str);` && |\n| && + ` ` && |\n| && + ` app.loadImage(obj.img);` && |\n| && + ` ` && |\n| && + ` utils.foreach(obj.areas, function(areaParams) {` && |\n| && + ` Area.fromJSON(areaParams);` && |\n| && + ` }); ` && |\n| && + ` }` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` var localStorageWrapper = (function() {` && |\n| && + ` var KEY_NAME = 'AmihaiAtias';` && |\n| && + ` ` && |\n| && + ` return {` && |\n| && + ` save : function() {` && |\n| && + ` var result = areasIO.toJSON();` && |\n| && + ` window.localStorage.setItem(KEY_NAME, result);` && |\n| && + ` console.info('Editor ' + result + ' saved');` && |\n| && + ` ` && |\n| && + ` alert('Saved');` && |\n| && + ` },` && |\n| && + ` restore : function() {` && |\n| && + ` areasIO.fromJSON(window.localStorage.getItem(KEY_NAME));` && |\n| && + ` }` && |\n| && + ` };` && |\n| && + ` })();` && |\n| && + ` ` && |\n| && + ` return {` && |\n| && + ` domElements : domElements,` && |\n| && + ` saveInLocalStorage : localStorageWrapper.save,` && |\n| && + ` loadFromLocalStorage : localStorageWrapper.restore,` && |\n| && + ` hide : function() {` && |\n| && + ` utils.hide(domElements.container);` && |\n| && + ` return this;` && |\n| && + ` },` && |\n| && + ` show : function() {` && |\n| && + ` utils.show(domElements.container);` && |\n| && + ` return this;` && |\n| && + ` },` && |\n| && + ` recalcOffsetValues: function() {` && |\n| && + ` recalcOffsetValues();` && |\n| && + ` return this;` && |\n| && + ` },` && |\n| && + ` setDimensions : function(width, height) {` && |\n| && + ` domElements.svg.setAttribute('width', width);` && |\n| && + ` domElements.svg.setAttribute('height', height);` && |\n| && + ` domElements.container.style.width = width + 'px';` && |\n| && + ` domElements.container.style.height = height + 'px';` && |\n| && + ` return this;` && |\n| && + ` },` && |\n| && + ` loadImage : function(url) {` && |\n| && + ` //get_image.showLoadIndicator();` && |\n| && + ` domElements.img.src = url;` && |\n| && + ` state.image.src = url;` && |\n| && + ` ` && |\n| && + ` domElements.img.onload = function() {` && |\n| && + ` //get_image.hideLoadIndicator().hide();` && |\n| && + ` app.show()` && |\n| && + ` .setDimensions(domElements.img.width, domElements.img.height)` && |\n| && + ` .recalcOffsetValues();` && |\n| && + ` };` && |\n| && + ` return this;` && |\n| && + ` },` && |\n| && + ` preview : (function() {` && |\n| && + ` domElements.img.setAttribute('usemap', '#map');` && |\n| && + ` domElements.map = document.createElement('map');` && |\n| && + ` domElements.map.setAttribute('name', 'map');` && |\n| && + ` domElements.container.appendChild(domElements.map);` && |\n| && + ` ` && |\n| && + ` return function() {` && |\n| && + ` info.unload();` && |\n| && + ` app.setShape(null);` && |\n| && + ` utils.hide(domElements.svg);` && |\n| && + ` domElements.map.innerHTML = app.getHTMLCode();` && |\n| && + ` code.print();` && |\n| && + ` return this;` && |\n| && + ` };` && |\n| && + ` })(),` && |\n| && + ` hidePreview : function() {` && |\n| && + ` utils.show(domElements.svg);` && |\n| && + ` domElements.map.innerHTML = '';` && |\n| && + ` return this;` && |\n| && + ` },` && |\n| && + ` addNodeToSvg : function(node) {` && |\n| && + ` domElements.svg.appendChild(node);` && |\n| && + ` return this;` && |\n| && + ` },` && |\n| && + ` removeNodeFromSvg : function(node) {` && |\n| && + ` domElements.svg.removeChild(node);` && |\n| && + ` return this;` && |\n| && + ` },` && |\n| && + ` getOffset : function(arg) {` && |\n| && + ` switch(arg) {` && |\n| && + ` case 'x':` && |\n| && + ` case 'y':` && |\n| && + ` return state.offset[arg];` && |\n| && + ` }` && |\n| && + ` },` && |\n| && + ` clear : function(){` && |\n| && + ` //remove all areas` && |\n| && + ` state.areas.length = 0;` && |\n| && + ` while(domElements.svg.childNodes[0]) {` && |\n| && + ` domElements.svg.removeChild(domElements.svg.childNodes[0]);` && |\n| && + ` }` && |\n| && + ` code.hide();` && |\n| && + ` info.unload();` && |\n| && + ` return this;` && |\n| && + ` },` && |\n| && + ` removeObject : function(obj) {` && |\n| && + ` utils.foreach(state.areas, function(x, i) {` && |\n| && + ` if(x === obj) {` && |\n| && + ` state.areas.splice(i, 1);` && |\n| && + ` }` && |\n| && + ` });` && |\n| && + ` obj.remove();` && |\n| && + ` return this;` && |\n| && + ` },` && |\n| && + ` deselectAll : function() {` && |\n| && + ` utils.foreach(state.areas, function(x) {` && |\n| && + ` x.deselect();` && |\n| && + ` });` && |\n| && + ` return this;` && |\n| && + ` },` && |\n| && + ` getIsDraw : function() {` && |\n| && + ` return state.isDraw;` && |\n| && + ` },` && |\n| && + ` setIsDraw : function(arg) {` && |\n| && + ` state.isDraw = arg;` && |\n| && + ` return this;` && |\n| && + ` },` && |\n| && + ` setMode : function(arg) {` && |\n| && + ` state.appMode = arg;` && |\n| && + ` return this;` && |\n| && + ` },` && |\n| && + ` getMode : function() {` && |\n| && + ` return state.appMode;` && |\n| && + ` },` && |\n| && + ` setShape : function(arg) {` && |\n| && + ` state.currentType = arg;` && |\n| && + ` return this;` && |\n| && + ` },` && |\n| && + ` getShape : function() {` && |\n| && + ` return state.currentType;` && |\n| && + ` },` && |\n| && + ` addObject : function(object) {` && |\n| && + ` state.areas.push(object);` && |\n| && + ` return this;` && |\n| && + ` },` && |\n| && + ` getNewArea : function() {` && |\n| && + ` return state.newArea;` && |\n| && + ` },` && |\n| && + ` resetNewArea : function() {` && |\n| && + ` state.newArea = null;` && |\n| && + ` return this;` && |\n| && + ` },` && |\n| && + ` getSelectedArea : function() {` && |\n| && + ` return state.selectedArea;` && |\n| && + ` },` && |\n| && + ` setSelectedArea : function(obj) {` && |\n| && + ` state.selectedArea = obj;` && |\n| && + ` return this;` && |\n| && + ` },` && |\n| && + ` getEditType : function() {` && |\n| && + ` return state.editType;` && |\n| && + ` },` && |\n| && + ` setFilename : function(str) {` && |\n| && + ` state.image.filename = str;` && |\n| && + ` return this;` && |\n| && + ` },` && |\n| && + ` setEditClass : function() {` && |\n| && + ` domElements.container.classList.remove('draw');` && |\n| && + ` domElements.container.classList.add('edit');` && |\n| && + `` && |\n| && + ` return this;` && |\n| && + ` },` && |\n| && + ` setDrawClass : function() {` && |\n| && + ` domElements.container.classList.remove('edit');` && |\n| && + ` domElements.container.classList.add('draw');` && |\n| && + `` && |\n| && + ` return this;` && |\n| && + ` },` && |\n| && + ` setDefaultClass : function() {` && |\n| && + ` domElements.container.classList.remove('edit');` && |\n| && + ` domElements.container.classList.remove('draw');` && |\n| && + `` && |\n| && + ` return this;` && |\n| && + ` },` && |\n| && + ` addEvent : function(target, eventType, func) {` && |\n| && + ` state.events.push(new AppEvent(target, eventType, func));` && |\n| && + ` return this;` && |\n| && + ` },` && |\n| && + ` removeAllEvents : function() {` && |\n| && + ` utils.foreach(state.events, function(x) {` && |\n| && + ` x.remove();` && |\n| && + ` });` && |\n| && + ` state.events.length = 0;` && |\n| && + ` return this;` && |\n| && + ` },` && |\n| && + ` getHTMLCode : function(arg) {` && |\n| && + ` var html_code = '';` && |\n| && + ` if (arg) {` && |\n| && + ` if (!state.areas.length) {` && |\n| && + ` return '0 objects';` && |\n| && + ` }` && |\n| && + ` html_code += utils.encode('<img src="' + state.image.filename + '" alt="" usemap="#map" />') +` && |\n| && + ` '<br />' + utils.encode('<map name="map">') + '<br />';` && |\n| && + ` utils.foreachReverse(state.areas, function(x) {` && |\n| && + ` html_code += '&nbsp;&nbsp;&nbsp;&nbsp;' + utils.encode(x.toHTMLMapElementString()) + '<br />';` && |\n| && + ` });` && |\n| && + ` html_code += utils.encode('</map>');` && |\n| && + ` } else {` && |\n| && + ` utils.foreachReverse(state.areas, function(x) {` && |\n| && + ` html_code += x.toHTMLMapElementString();` && |\n| && + ` });` && |\n| && + ` }` && |\n| && + ` return html_code;` && |\n| && + ` }` && |\n| && + ` };` && |\n| && + ` })();` && |\n| && + ` ` && |\n| && + ` ` && |\n| && + ` /**` && |\n| && + ` * The constructor for dom events (for simple deleting of event)` && |\n| && + ` * ` && |\n| && + ` * @constructor` && |\n| && + ` * @param {DOMElement} target - DOM-element` && |\n| && + ` * @param {String} eventType - e.g. 'click' or 'mousemove'` && |\n| && + ` * @param {Function} func - handler for this event` && |\n| && + ` */` && |\n| && + ` function AppEvent(target, eventType, func) {` && |\n| && + ` this.target = target;` && |\n| && + ` this.eventType = eventType;` && |\n| && + ` this.func = func;` && |\n| && + ` ` && |\n| && + ` target.addEventListener(eventType, func, false);` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` /**` && |\n| && + ` * Remove this event listener from target` && |\n| && + ` */` && |\n| && + ` AppEvent.prototype.remove = function() {` && |\n| && + ` this.target.removeEventListener(this.eventType, this.func, false);` && |\n| && + ` };` && |\n| && + `` && |\n|. + result = result && + ` function Helper(node, x, y, action) {` && |\n| && + ` this._el = document.createElementNS(Area.SVG_NS, 'rect');` && |\n| && + ` ` && |\n| && + ` this._el.classList.add(Helper.CLASS_NAME);` && |\n| && + ` this._el.setAttribute('height', Helper.SIZE);` && |\n| && + ` this._el.setAttribute('width', Helper.SIZE);` && |\n| && + ` this._el.setAttribute('x', x + Helper.OFFSET);` && |\n| && + ` this._el.setAttribute('y', y + Helper.OFFSET);` && |\n| && + ` ` && |\n| && + ` node.appendChild(this._el);` && |\n| && + ` ` && |\n| && + ` this._el.action = action; // TODO: move 'action' from dom el to data-attr` && |\n| && + ` this._el.classList.add(Helper.ACTIONS_TO_CURSORS[action]);` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` Helper.SIZE = 5;` && |\n| && + ` Helper.OFFSET = -Math.ceil(Helper.SIZE / 2);` && |\n| && + ` Helper.CLASS_NAME = 'helper';` && |\n| && + ` Helper.ACTIONS_TO_CURSORS = {` && |\n| && + ` 'move' : 'move',` && |\n| && + ` 'editLeft' : 'e-resize',` && |\n| && + ` 'editRight' : 'w-resize',` && |\n| && + ` 'editTop' : 'n-resize',` && |\n| && + ` 'editBottom' : 's-resize',` && |\n| && + ` 'editTopLeft' : 'nw-resize',` && |\n| && + ` 'editTopRight' : 'ne-resize',` && |\n| && + ` 'editBottomLeft' : 'sw-resize',` && |\n| && + ` 'editBottomRight' : 'se-resize',` && |\n| && + ` 'movePoint' : 'pointer'` && |\n| && + ` };` && |\n| && + `` && |\n| && + ` Helper.prototype.setCoords = function(x, y) {` && |\n| && + ` this._el.setAttribute('x', x + Helper.OFFSET);` && |\n| && + ` this._el.setAttribute('y', y + Helper.OFFSET);` && |\n| && + ` ` && |\n| && + ` return this;` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` Helper.prototype.setId = function(id) {` && |\n| && + ` // TODO: move n-field from DOM-element to data-attribute` && |\n| && + ` this._el.n = id;` && |\n| && + ` ` && |\n| && + ` return this;` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` function Area(type, coords, attributes) {` && |\n| && + ` if (this.constructor === Area) {` && |\n| && + ` throw new Error('This is abstract class');` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` this._type = type;` && |\n| && + ` ` && |\n| && + ` this._attributes = {` && |\n| && + ` href : '',` && |\n| && + ` alt : '',` && |\n| && + ` title : '' ` && |\n| && + ` };` && |\n| && + `` && |\n| && + ` if (attributes) {` && |\n| && + ` this.setInfoAttributes(attributes);` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` this._coords = coords;` && |\n| && + ` ` && |\n| && + ` // the g-element, it contains this area and helpers elements` && |\n| && + ` this._groupEl = document.createElementNS(Area.SVG_NS, 'g');` && |\n| && + ` app.addNodeToSvg(this._groupEl);` && |\n| && + ` ` && |\n| && + ` // TODO: remove this field from DOM-element` && |\n| && + ` // Link to parent object` && |\n| && + ` this._groupEl.obj = this;` && |\n| && + ` ` && |\n| && + ` // svg-dom-element of area` && |\n| && + ` this._el = null; ` && |\n| && + ` ` && |\n| && + ` // Object with all helpers of area` && |\n| && + ` this._helpers = {};` && |\n| && + ` ` && |\n| && + ` // Add this new area to list of all areas ` && |\n| && + ` app.addObject(this);` && |\n| && + ` }` && |\n| && + ` Area.SVG_NS = 'http://www.w3.org/2000/svg'; // TODO: move to main editor constructor` && |\n| && + ` Area.CLASS_NAMES = {` && |\n| && + ` SELECTED : 'selected',` && |\n| && + ` WITH_HREF : 'with_href'` && |\n| && + ` };` && |\n| && + ` Area.CONSTRUCTORS = {` && |\n| && + ` rectangle : Rectangle,` && |\n| && + ` circle : Circle,` && |\n| && + ` polygon : Polygon` && |\n| && + ` };` && |\n| && + ` Area.REGEXP = {` && |\n| && + ` AREA : /<area(?=.*? shape="(rect|circle|poly)")(?=.*? coords="([\d ,]+?)")[\s\S]*?>/gmi,` && |\n| && + ` HREF : / href="([\S\s]+?)"/,` && |\n| && + ` ALT : / alt="([\S\s]+?)"/,` && |\n| && + ` TITLE : / title="([\S\s]+?)"/,` && |\n| && + ` DELIMETER : / ?, ?/` && |\n| && + ` };` && |\n| && + ` Area.HTML_NAMES_TO_AREA_NAMES = {` && |\n| && + ` rect : 'rectangle',` && |\n| && + ` circle : 'circle',` && |\n| && + ` poly : 'polygon'` && |\n| && + ` };` && |\n| && + ` Area.ATTRIBUTES_NAMES = ['HREF', 'ALT', 'TITLE'];` && |\n| && + ` ` && |\n| && + ` /**` && |\n| && + ` * This method should be implemented for child-classes ` && |\n| && + ` * ` && |\n| && + ` * @throws {AbstractMethodCall}` && |\n| && + ` */` && |\n| && + ` Area.prototype.ABSTRACT_METHOD = function() {` && |\n| && + ` throw new Error('This is abstract method');` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` /**` && |\n| && + ` * All these methods are abstract ` && |\n| && + ` * ` && |\n| && + ` * @throws {AbstractMethodCall}` && |\n| && + ` */` && |\n| && + ` Area.prototype.setSVGCoords =` && |\n| && + ` Area.prototype.setCoords = ` && |\n| && + ` Area.prototype.dynamicDraw = ` && |\n| && + ` Area.prototype.onProcessDrawing = ` && |\n| && + ` Area.prototype.onStopDrawing = ` && |\n| && + ` Area.prototype.edit = ` && |\n| && + ` Area.prototype.dynamicEdit = ` && |\n| && + ` Area.prototype.onProcessEditing = ` && |\n| && + ` Area.prototype.onStopEditing = ` && |\n| && + ` Area.prototype.toString = ` && |\n| && + ` Area.prototype.toHTMLMapElementString =` && |\n| && + ` Area.prototype.getCoordsForDisplayingInfo = ` && |\n| && + ` Area.prototype.ABSTRACT_METHOD;` && |\n| && + ` ` && |\n| && + ` Area.prototype.redraw = function(coords) {` && |\n| && + ` this.setSVGCoords(coords ? coords : this._coords);` && |\n| && + ` ` && |\n| && + ` return this;` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` /**` && |\n| && + ` * Remove this area from DOM-tree` && |\n| && + ` */` && |\n| && + ` Area.prototype.remove = function() {` && |\n| && + ` app.removeNodeFromSvg(this._groupEl);` && |\n| && + ` };` && |\n| && + `` && |\n| && + ` /**` && |\n| && + ` * Move this area by dx, dy ` && |\n| && + ` * ` && |\n| && + ` * @returns {Area} - this area` && |\n| && + ` */` && |\n| && + ` Area.prototype.move = function(dx, dy) {` && |\n| && + ` this.setCoords(this.edit('move', dx, dy)).redraw();` && |\n| && + ` return this;` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` Area.prototype.select = function() {` && |\n| && + ` this._el.classList.add(Area.CLASS_NAMES.SELECTED);` && |\n| && + ` console.info(this.toString() + ' is selected now');` && |\n| && + ` ` && |\n| && + ` return this;` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` Area.prototype.deselect = function() {` && |\n| && + ` this._el.classList.remove(Area.CLASS_NAMES.SELECTED);` && |\n| && + ` ` && |\n| && + ` return this;` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` Area.prototype.setStyleOfElementWithHref = function() {` && |\n| && + ` this._el.classList.add(Area.CLASS_NAMES.WITH_HREF);` && |\n| && + ` ` && |\n| && + ` return this;` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` Area.prototype.unsetStyleOfElementWithHref = function() {` && |\n| && + ` this._el.classList.remove(Area.CLASS_NAMES.WITH_HREF);` && |\n| && + ` ` && |\n| && + ` return this;` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` Area.prototype.setInfoAttributes = function(attributes) {` && |\n| && + ` this._attributes.href = attributes.href;` && |\n| && + ` this._attributes.alt = attributes.alt;` && |\n| && + ` this._attributes.title = attributes.title;` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` Area.prototype.toJSON = function() {` && |\n| && + ` return {` && |\n| && + ` type : this._type,` && |\n| && + ` coords : this._coords,` && |\n| && + ` attributes : this._attributes` && |\n| && + ` };` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` /**` && |\n| && + ` * Returns new area object created with params from json-object` && |\n| && + ` * ` && |\n| && + ` * @static` && |\n| && + ` * @param params {Object} - params of area, incl. type, coords and attributes` && |\n| && + ` * @returns {Rectangle|Circle|Polygon}` && |\n| && + ` */` && |\n| && + ` Area.fromJSON = function(params) {` && |\n| && + ` var AreaConstructor = Area.CONSTRUCTORS[params.type];` && |\n| && + ` ` && |\n| && + ` if (!AreaConstructor) {` && |\n| && + ` throw new Error('This area type is not valid');` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` if (!AreaConstructor.testCoords(params.coords)) {` && |\n| && + ` throw new Error('This coords is not valid for ' + params.type);` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` app.setIsDraw(true);` && |\n| && + ` ` && |\n| && + ` var area = new AreaConstructor(params.coords, params.attributes);` && |\n| && + ` ` && |\n| && + ` app.setIsDraw(false)` && |\n| && + ` .resetNewArea();` && |\n| && + ` ` && |\n| && + ` return area;` && |\n| && + ` };` && |\n| && + `` && |\n| && + ` Area.createAreasFromHTMLOfMap = function(htmlStr) {` && |\n| && + ` if (!htmlStr) {` && |\n| && + ` return false;` && |\n| && + ` } ` && |\n| && + `` && |\n| && + ` while (true) {` && |\n| && + ` var findedResult = Area.REGEXP.AREA.exec(htmlStr); // <area shape="$1" coords="$2" ... />` && |\n| && + ` if (!findedResult) {` && |\n| && + ` break;` && |\n| && + ` } ` && |\n| && + `` && |\n| && + ` var htmlAreaFinded = findedResult[0], // <area shape="..." coords="..." ... />` && |\n| && + ` type = findedResult[1], // $1` && |\n| && + ` coords = findedResult[2].split(Area.REGEXP.DELIMETER), // $2` && |\n| && + ` attributes = {}; ` && |\n| && + ` ` && |\n| && + ` Area.ATTRIBUTES_NAMES.forEach(function(item, i) {` && |\n| && + ` var result = Area.REGEXP[item].exec(htmlAreaFinded);` && |\n| && + `` && |\n| && + ` if (result) {` && |\n| && + ` attributes[name] = result[1];` && |\n| && + ` } ` && |\n| && + ` });` && |\n| && + ` ` && |\n| && + ` coords = coords.map(function(item) {` && |\n| && + ` return Number(item);` && |\n| && + ` });` && |\n| && + `` && |\n| && + ` type = Area.HTML_NAMES_TO_AREA_NAMES[type];` && |\n| && + `` && |\n| && + ` Area.fromJSON({` && |\n| && + ` type : type,` && |\n| && + ` coords : Area.CONSTRUCTORS[type].getCoordsFromHTMLArray(coords),` && |\n| && + ` attributes : attributes` && |\n| && + ` });` && |\n| && + `` && |\n| && + ` }` && |\n| && + `` && |\n| && + ` return Boolean(htmlAreaFinded);` && |\n| && + ` };` && |\n| && + `` && |\n| && + ` /**` && |\n| && + ` * Returns copy of original area, selected and moved by (10,10) from it` && |\n| && + ` * ` && |\n| && + ` * @param originalArea {Area}` && |\n| && + ` * @returns {Area} - a copy of original area` && |\n| && + ` */` && |\n| && + ` Area.copy = function(originalArea) {` && |\n| && + ` return Area.fromJSON(originalArea.toJSON()).move(10, 10).select();` && |\n| && + ` };` && |\n| && + `` && |\n| && + `` && |\n| && + ` function Rectangle(coords, attributes) {` && |\n| && + ` Area.call(this, 'rectangle', coords, attributes);` && |\n| && + ` ` && |\n| && + ` this._coords = {` && |\n| && + ` x : coords.x || 0, ` && |\n| && + ` y : coords.y || 0,` && |\n| && + ` width : coords.width || 0, ` && |\n| && + ` height : coords.height || 0` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` this._el = document.createElementNS(Area.SVG_NS, 'rect');` && |\n| && + ` this._groupEl.appendChild(this._el);` && |\n| && + ` ` && |\n| && + ` var x = coords.x - this._coords.width / 2,` && |\n| && + ` y = coords.y - this._coords.height / 2;` && |\n| && + ` ` && |\n| && + ` this._helpers = {` && |\n| && + ` center : new Helper(this._groupEl, x, y, 'move'),` && |\n| && + ` top : new Helper(this._groupEl, x, y, 'editTop'),` && |\n| && + ` bottom : new Helper(this._groupEl, x, y, 'editBottom'),` && |\n| && + ` left : new Helper(this._groupEl, x, y, 'editLeft'),` && |\n| && + ` right : new Helper(this._groupEl, x, y, 'editRight'),` && |\n| && + ` topLeft : new Helper(this._groupEl, x, y, 'editTopLeft'),` && |\n| && + ` topRight : new Helper(this._groupEl, x, y, 'editTopRight'),` && |\n| && + ` bottomLeft : new Helper(this._groupEl, x, y, 'editBottomLeft'),` && |\n| && + ` bottomRight : new Helper(this._groupEl, x, y, 'editBottomRight')` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` this.redraw();` && |\n| && + ` }` && |\n| && + ` utils.inherits(Rectangle, Area);` && |\n| && + ` ` && |\n| && + ` Rectangle.prototype.setSVGCoords = function(coords) {` && |\n| && + ` this._el.setAttribute('x', coords.x);` && |\n| && + ` this._el.setAttribute('y', coords.y);` && |\n| && + ` this._el.setAttribute('width', coords.width);` && |\n| && + ` this._el.setAttribute('height', coords.height);` && |\n| && + ` ` && |\n| && + ` var top = coords.y,` && |\n| && + ` center_y = coords.y + coords.height / 2,` && |\n| && + ` bottom = coords.y + coords.height,` && |\n| && + ` left = coords.x,` && |\n| && + ` center_x = coords.x + coords.width / 2,` && |\n| && + ` right = coords.x + coords.width;` && |\n| && + ` ` && |\n| && + ` this._helpers.center.setCoords(center_x, center_y);` && |\n| && + ` this._helpers.top.setCoords(center_x, top);` && |\n| && + ` this._helpers.bottom.setCoords(center_x, bottom);` && |\n| && + ` this._helpers.left.setCoords(left, center_y);` && |\n| && + ` this._helpers.right.setCoords(right, center_y);` && |\n| && + ` this._helpers.topLeft.setCoords(left, top);` && |\n| && + ` this._helpers.topRight.setCoords(right, top);` && |\n| && + ` this._helpers.bottomLeft.setCoords(left, bottom);` && |\n| && + ` this._helpers.bottomRight.setCoords(right, bottom);` && |\n| && + ` ` && |\n| && + ` return this;` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` Rectangle.prototype.setCoords = function(coords) {` && |\n| && + ` this._coords.x = coords.x;` && |\n| && + ` this._coords.y = coords.y;` && |\n| && + ` this._coords.width = coords.width;` && |\n| && + ` this._coords.height = coords.height;` && |\n| && + ` ` && |\n| && + ` return this;` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` Rectangle.prototype.dynamicDraw = function(x, y, isSquare) {` && |\n| && + ` var newCoords = {` && |\n| && + ` x : this._coords.x,` && |\n| && + ` y : this._coords.y,` && |\n| && + ` width : x - this._coords.x,` && |\n| && + ` height: y - this._coords.y` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` if (isSquare) {` && |\n| && + ` newCoords = Rectangle.getSquareCoords(newCoords);` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` newCoords = Rectangle.getNormalizedCoords(newCoords);` && |\n| && + ` ` && |\n| && + ` this.redraw(newCoords);` && |\n| && + ` ` && |\n| && + ` return newCoords;` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` Rectangle.prototype.onProcessDrawing = function(e) {` && |\n| && + ` var coords = utils.getRightCoords(e.pageX, e.pageY);` && |\n| && + ` ` && |\n| && + ` this.dynamicDraw(coords.x, coords.y, e.shiftKey);` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` Rectangle.prototype.onStopDrawing = function(e) {` && |\n| && + ` var coords = utils.getRightCoords(e.pageX, e.pageY);` && |\n| && + ` ` && |\n| && + ` this.setCoords(this.dynamicDraw(coords.x, coords.y, e.shiftKey)).deselect();` && |\n| && + ` ` && |\n| && + ` app.removeAllEvents()` && |\n| && + ` .setIsDraw(false)` && |\n| && + ` .resetNewArea();` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` Rectangle.prototype.edit = function(editingType, dx, dy) {` && |\n| && + ` var tempParams = Object.create(this._coords);` && |\n| && + ` ` && |\n| && + ` switch (editingType) {` && |\n| && + ` case 'move':` && |\n| && + ` tempParams.x += dx;` && |\n| && + ` tempParams.y += dy;` && |\n| && + ` break;` && |\n| && + ` ` && |\n| && + ` case 'editLeft':` && |\n| && + ` tempParams.x += dx; ` && |\n| && + ` tempParams.width -= dx;` && |\n| && + ` break;` && |\n| && + ` ` && |\n| && + ` case 'editRight':` && |\n| && + ` tempParams.width += dx;` && |\n| && + ` break;` && |\n| && + ` ` && |\n| && + ` case 'editTop':` && |\n| && + ` tempParams.y += dy;` && |\n| && + ` tempParams.height -= dy;` && |\n| && + ` break;` && |\n| && + ` ` && |\n| && + ` case 'editBottom':` && |\n| && + ` tempParams.height += dy;` && |\n| && + ` break;` && |\n| && + ` ` && |\n| && + ` case 'editTopLeft':` && |\n| && + ` tempParams.x += dx;` && |\n| && + ` tempParams.y += dy;` && |\n| && + ` tempParams.width -= dx;` && |\n| && + ` tempParams.height -= dy;` && |\n| && + ` break;` && |\n| && + ` ` && |\n| && + ` case 'editTopRight':` && |\n| && + ` tempParams.y += dy;` && |\n| && + ` tempParams.width += dx;` && |\n| && + ` tempParams.height -= dy;` && |\n| && + ` break;` && |\n| && + ` ` && |\n| && + ` case 'editBottomLeft':` && |\n| && + ` tempParams.x += dx;` && |\n| && + ` tempParams.width -= dx;` && |\n| && + ` tempParams.height += dy;` && |\n| && + ` break;` && |\n| && + ` ` && |\n| && + ` case 'editBottomRight':` && |\n| && + ` tempParams.width += dx;` && |\n| && + ` tempParams.height += dy;` && |\n| && + ` break;` && |\n| && + ` }` && |\n| && + `` && |\n|. + result = result && + ` return tempParams;` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` Rectangle.prototype.dynamicEdit = function(coords, saveProportions) {` && |\n| && + ` coords = Rectangle.getNormalizedCoords(coords);` && |\n| && + ` ` && |\n| && + ` if (saveProportions) {` && |\n| && + ` coords = Rectangle.getSavedProportionsCoords(coords);` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` this.redraw(coords);` && |\n| && + ` ` && |\n| && + ` return coords;` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` Rectangle.prototype.onProcessEditing = function(e) {` && |\n| && + ` return this.dynamicEdit(` && |\n| && + ` this.edit(` && |\n| && + ` app.getEditType(),` && |\n| && + ` e.pageX - this.editingStartPoint.x,` && |\n| && + ` e.pageY - this.editingStartPoint.y` && |\n| && + ` ),` && |\n| && + ` e.shiftKey` && |\n| && + ` );` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` Rectangle.prototype.onStopEditing = function(e) {` && |\n| && + ` this.setCoords(this.onProcessEditing(e));` && |\n| && + ` app.removeAllEvents();` && |\n| && + ` };` && |\n| && + `` && |\n| && + ` Rectangle.prototype.toString = function() {` && |\n| && + ` return 'Rectangle {x: '+ this._coords.x + ` && |\n| && + ` ', y: ' + this._coords.y + ` && |\n| && + ` ', width: ' + this._coords.width + ` && |\n| && + ` ', height: ' + this._coords.height + '}';` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` Rectangle.prototype.toHTMLMapElementString = function() {` && |\n| && + ` var x2 = this._coords.x + this._coords.width,` && |\n| && + ` y2 = this._coords.y + this._coords.height;` && |\n| && + ` ` && |\n| && + ` return '<area shape="rect" coords="' // TODO: use template engine` && |\n| && + ` + this._coords.x + ', '` && |\n| && + ` + this._coords.y + ', '` && |\n| && + ` + x2 + ', '` && |\n| && + ` + y2` && |\n| && + ` + '"'` && |\n| && + ` + (this._attributes.href ? ' href="' + this._attributes.href + '"' : '')` && |\n| && + ` + (this._attributes.alt ? ' alt="' + this._attributes.alt + '"' : '')` && |\n| && + ` + (this._attributes.title ? ' title="' + this._attributes.title + '"' : '')` && |\n| && + ` + ' />';` && |\n| && + ` };` && |\n| && + `` && |\n| && + ` Rectangle.prototype.getCoordsForDisplayingInfo = function() {` && |\n| && + ` return {` && |\n| && + ` x : this._coords.x,` && |\n| && + ` y : this._coords.y` && |\n| && + ` };` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` Rectangle.testCoords = function(coords) {` && |\n| && + ` return coords.x && coords.y && coords.width && coords.height;` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` Rectangle.testHTMLCoords = function(coords) {` && |\n| && + ` return coords.length === 4;` && |\n| && + ` };` && |\n| && + `` && |\n| && + ` Rectangle.getCoordsFromHTMLArray = function(htmlCoordsArray) {` && |\n| && + ` if (!Rectangle.testHTMLCoords(htmlCoordsArray)) { ` && |\n| && + ` throw new Error('This html-coordinates is not valid for rectangle');` && |\n| && + ` }` && |\n| && + `` && |\n| && + ` return {` && |\n| && + ` x : htmlCoordsArray[0],` && |\n| && + ` y : htmlCoordsArray[1],` && |\n| && + ` width : htmlCoordsArray[2] - htmlCoordsArray[0],` && |\n| && + ` height : htmlCoordsArray[3] - htmlCoordsArray[1]` && |\n| && + ` };` && |\n| && + ` };` && |\n| && + `` && |\n| && + ` Rectangle.getNormalizedCoords = function(coords) {` && |\n| && + ` if (coords.width < 0) {` && |\n| && + ` coords.x += coords.width;` && |\n| && + ` coords.width = Math.abs(coords.width);` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` if (coords.height < 0) {` && |\n| && + ` coords.y += coords.height;` && |\n| && + ` coords.height = Math.abs(coords.height);` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` return coords;` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` Rectangle.getSquareCoords = function(coords) {` && |\n| && + ` var width = Math.abs(coords.width),` && |\n| && + ` height = Math.abs(coords.height);` && |\n| && + ` ` && |\n| && + ` if (width > height) {` && |\n| && + ` coords.width = coords.width > 0 ? height : -height;` && |\n| && + ` } else {` && |\n| && + ` coords.height = coords.height > 0 ? width : -width;` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` return coords;` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` Rectangle.getSavedProportionsCoords = function(coords, originalCoords) {` && |\n| && + ` var originalProportions = coords.width / coords.height,` && |\n| && + ` currentProportions = originalCoords.width / originalCoords.height;` && |\n| && + ` ` && |\n| && + ` if (currentProportions > originalProportions) {` && |\n| && + ` coords.width = Math.round(coords.height * originalProportions);` && |\n| && + ` } else {` && |\n| && + ` coords.height = Math.round(coords.width / originalProportions);` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` return coords;` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` Rectangle.createAndStartDrawing = function(firstPointCoords) {` && |\n| && + ` var newArea = new Rectangle({` && |\n| && + ` x : firstPointCoords.x,` && |\n| && + ` y : firstPointCoords.y,` && |\n| && + ` width: 0,` && |\n| && + ` height: 0` && |\n| && + ` });` && |\n| && + ` ` && |\n| && + ` app.addEvent(app.domElements.container, 'mousemove', newArea.onProcessDrawing.bind(newArea))` && |\n| && + ` .addEvent(app.domElements.container, 'click', newArea.onStopDrawing.bind(newArea));` && |\n| && + ` ` && |\n| && + ` return newArea;` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + `` && |\n| && + ` function Circle(coords, attributes) {` && |\n| && + ` Area.call(this, 'circle', coords, attributes);` && |\n| && + ` ` && |\n| && + ` this._coords = {` && |\n| && + ` cx : coords.cx || 0,` && |\n| && + ` cy : coords.cy || 0,` && |\n| && + ` radius : coords.radius || 0 ` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` this._el = document.createElementNS(Area.SVG_NS, 'circle');` && |\n| && + ` this._groupEl.appendChild(this._el);` && |\n| && + ` ` && |\n| && + ` this.helpers = {` && |\n| && + ` center : new Helper(this._groupEl, coords.cx, coords.cy, 'move'),` && |\n| && + ` top : new Helper(this._groupEl, coords.cx, coords.cy, 'editTop'),` && |\n| && + ` bottom : new Helper(this._groupEl, coords.cx, coords.cy, 'editBottom'),` && |\n| && + ` left : new Helper(this._groupEl, coords.cx, coords.cy, 'editLeft'),` && |\n| && + ` right : new Helper(this._groupEl, coords.cx, coords.cy, 'editRight')` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` this.redraw();` && |\n| && + ` }` && |\n| && + ` utils.inherits(Circle, Area);` && |\n| && + ` ` && |\n| && + ` Circle.prototype.setSVGCoords = function(coords) {` && |\n| && + ` this._el.setAttribute('cx', coords.cx);` && |\n| && + ` this._el.setAttribute('cy', coords.cy);` && |\n| && + ` this._el.setAttribute('r', coords.radius);` && |\n| && + ` ` && |\n| && + ` this.helpers.center.setCoords(coords.cx, coords.cy);` && |\n| && + ` this.helpers.top.setCoords(coords.cx, coords.cy - coords.radius);` && |\n| && + ` this.helpers.right.setCoords(coords.cx + coords.radius, coords.cy);` && |\n| && + ` this.helpers.bottom.setCoords(coords.cx, coords.cy + coords.radius);` && |\n| && + ` this.helpers.left.setCoords(coords.cx - coords.radius, coords.cy);` && |\n| && + ` ` && |\n| && + ` return this;` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` Circle.prototype.setCoords = function(coords) {` && |\n| && + ` this._coords.cx = coords.cx;` && |\n| && + ` this._coords.cy = coords.cy;` && |\n| && + ` this._coords.radius = coords.radius;` && |\n| && + ` ` && |\n| && + ` return this;` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` Circle.prototype.dynamicDraw = function(x, y) {` && |\n| && + ` var radius = Math.round(` && |\n| && + ` Math.sqrt(` && |\n| && + ` Math.pow(this._coords.cx - x, 2) +` && |\n| && + ` Math.pow(this._coords.cy - y, 2)` && |\n| && + ` )` && |\n| && + ` ),` && |\n| && + ` newCoords = {` && |\n| && + ` cx : this._coords.cx,` && |\n| && + ` cy : this._coords.cy,` && |\n| && + ` radius : radius` && |\n| && + ` };` && |\n| && + `` && |\n| && + ` this.redraw(newCoords);` && |\n| && + ` ` && |\n| && + ` return newCoords;` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` Circle.prototype.onProcessDrawing = function(e) {` && |\n| && + ` var coords = utils.getRightCoords(e.pageX, e.pageY);` && |\n| && + ` ` && |\n| && + ` this.dynamicDraw(coords.x, coords.y);` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` Circle.prototype.onStopDrawing = function(e) {` && |\n| && + ` var coords = utils.getRightCoords(e.pageX, e.pageY);` && |\n| && + ` ` && |\n| && + ` this.setCoords(this.dynamicDraw(coords.x, coords.y)).deselect();` && |\n| && + ` ` && |\n| && + ` app.removeAllEvents()` && |\n| && + ` .setIsDraw(false)` && |\n| && + ` .resetNewArea();` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` Circle.prototype.edit = function(editingType, dx, dy) {` && |\n| && + ` var tempParams = Object.create(this._coords);` && |\n| && + ` ` && |\n| && + ` switch (editingType) {` && |\n| && + ` case 'move':` && |\n| && + ` tempParams.cx += dx;` && |\n| && + ` tempParams.cy += dy;` && |\n| && + ` break;` && |\n| && + ` ` && |\n| && + ` case 'editTop':` && |\n| && + ` tempParams.radius -= dy;` && |\n| && + ` break;` && |\n| && + ` ` && |\n| && + ` case 'editBottom':` && |\n| && + ` tempParams.radius += dy;` && |\n| && + ` break;` && |\n| && + ` ` && |\n| && + ` case 'editLeft':` && |\n| && + ` tempParams.radius -= dx;` && |\n| && + ` break;` && |\n| && + ` ` && |\n| && + ` case 'editRight':` && |\n| && + ` tempParams.radius += dx;` && |\n| && + ` break;` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` return tempParams;` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` Circle.prototype.dynamicEdit = function(tempCoords) {` && |\n| && + ` if (tempCoords.radius < 0) {` && |\n| && + ` tempCoords.radius = Math.abs(tempCoords.radius);` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` this.setSVGCoords(tempCoords);` && |\n| && + ` ` && |\n| && + ` return tempCoords;` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` Circle.prototype.onProcessEditing = function(e) {` && |\n| && + ` var editType = app.getEditType();` && |\n| && + ` ` && |\n| && + ` return this.dynamicEdit(` && |\n| && + ` this.edit(editType, e.pageX - this.editingStartPoint.x, e.pageY - this.editingStartPoint.y)` && |\n| && + ` );` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` Circle.prototype.onStopEditing = function(e) {` && |\n| && + ` var editType = app.getEditType();` && |\n| && + ` ` && |\n| && + ` this.setCoords(this.onProcessEditing(e));` && |\n| && + ` ` && |\n| && + ` app.removeAllEvents();` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` /**` && |\n| && + ` * Returns string-representation of circle` && |\n| && + ` * ` && |\n| && + ` * @returns {string}` && |\n| && + ` */` && |\n| && + ` Circle.prototype.toString = function() {` && |\n| && + ` return 'Circle {cx: '+ this._coords.cx +` && |\n| && + ` ', cy: ' + this._coords.cy +` && |\n| && + ` ', radius: ' + this._coords.radius + '}';` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` Circle.prototype.toHTMLMapElementString = function() {` && |\n| && + ` return '<area shape="circle" coords="'` && |\n| && + ` + this._coords.cx + ', '` && |\n| && + ` + this._coords.cy + ', '` && |\n| && + ` + this._coords.radius` && |\n| && + ` + '"'` && |\n| && + ` + (this._attributes.href ? ' href="' + this._attributes.href + '"' : '')` && |\n| && + ` + (this._attributes.alt ? ' alt="' + this._attributes.alt + '"' : '')` && |\n| && + ` + (this._attributes.title ? ' title="' + this._attributes.title + '"' : '')` && |\n| && + ` + ' />';` && |\n| && + ` };` && |\n| && + `` && |\n| && + ` /**` && |\n| && + ` * Returns coords for area attributes form` && |\n| && + ` * ` && |\n| && + ` * @returns {Object} - coordinates of point` && |\n| && + ` */` && |\n| && + ` Circle.prototype.getCoordsForDisplayingInfo = function() {` && |\n| && + ` return {` && |\n| && + ` x : this._coords.cx,` && |\n| && + ` y : this._coords.cy` && |\n| && + ` };` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` Circle.testCoords = function(coords) {` && |\n| && + ` return coords.cx && coords.cy && coords.radius;` && |\n| && + ` };` && |\n| && + `` && |\n| && + ` Circle.testHTMLCoords = function(coords) {` && |\n| && + ` return coords.length === 3;` && |\n| && + ` };` && |\n| && + `` && |\n| && + ` Circle.getCoordsFromHTMLArray = function(htmlCoordsArray) {` && |\n| && + ` if (!Circle.testHTMLCoords(htmlCoordsArray)) { ` && |\n| && + ` throw new Error('This html-coordinates is not valid for circle');` && |\n| && + ` }` && |\n| && + `` && |\n| && + ` return {` && |\n| && + ` cx : htmlCoordsArray[0],` && |\n| && + ` cy : htmlCoordsArray[1],` && |\n| && + ` radius : htmlCoordsArray[2]` && |\n| && + ` };` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` Circle.createAndStartDrawing = function(firstPointCoords) {` && |\n| && + ` var newArea = new Circle({` && |\n| && + ` cx : firstPointCoords.x,` && |\n| && + ` cy : firstPointCoords.y,` && |\n| && + ` radius : 0` && |\n| && + ` });` && |\n| && + ` ` && |\n| && + ` app.addEvent(app.domElements.container, 'mousemove', newArea.onProcessDrawing.bind(newArea))` && |\n| && + ` .addEvent(app.domElements.container, 'click', newArea.onStopDrawing.bind(newArea));` && |\n| && + ` ` && |\n| && + ` return newArea;` && |\n| && + ` };` && |\n| && + `` && |\n| && + ` function Polygon(coords, attributes) {` && |\n| && + ` Area.call(this, 'polygon', coords, attributes);` && |\n| && + ` ` && |\n| && + ` /**` && |\n| && + ` * @namespace` && |\n| && + ` * @property {Array} points - Array with coordinates of polygon points` && |\n| && + ` */` && |\n| && + ` this._coords = {` && |\n| && + ` points : coords.points || [{x: 0, y: 0}],` && |\n| && + ` isOpened : coords.isOpened || false` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` this._el = document.createElementNS(` && |\n| && + ` Area.SVG_NS, ` && |\n| && + ` this._coords.isOpened ? 'polyline' : 'polygon'` && |\n| && + ` );` && |\n| && + ` this._groupEl.appendChild(this._el);` && |\n| && + `` && |\n| && + ` this._helpers = { ` && |\n| && + ` points : []` && |\n| && + ` };` && |\n| && + `` && |\n| && + ` for (var i = 0, c = this._coords.points.length; i < c; i++) {` && |\n| && + ` this._helpers.points.push(` && |\n| && + ` (new Helper(` && |\n| && + ` this._groupEl, ` && |\n| && + ` this._coords.points[i].x, ` && |\n| && + ` this._coords.points[i].y, ` && |\n| && + ` 'movePoint')` && |\n| && + ` ).setId(i)` && |\n| && + ` );` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` this._selectedPoint = -1;` && |\n| && + ` ` && |\n| && + ` this.redraw();` && |\n| && + ` }` && |\n| && + ` utils.inherits(Polygon, Area);` && |\n| && + ` ` && |\n| && + ` Polygon.prototype.close = function() {` && |\n| && + ` var polyline = this._el;` && |\n| && + ` this._el = document.createElementNS(Area.SVG_NS, 'polygon');` && |\n| && + ` this._groupEl.replaceChild(this._el, polyline);` && |\n| && + `` && |\n| && + ` this._coords.isOpened = false;` && |\n| && + ` this.redraw().deselect();` && |\n| && + ` };` && |\n| && + ` ` && |\n|. -result = result && -` Polygon.prototype.setSVGCoords = function(coords) {` && |\n| && -` var polygonPointsAttrValue = coords.points.reduce(function(previousValue, currentItem) {` && |\n| && -` return previousValue + currentItem.x + ' ' + currentItem.y + ' ';` && |\n| && -` }, '');` && |\n| && -` ` && |\n| && -` this._el.setAttribute('points', polygonPointsAttrValue);` && |\n| && -` utils.foreach(this._helpers.points, function(helper, i) {` && |\n| && -` helper.setCoords(coords.points[i].x, coords.points[i].y);` && |\n| && -` });` && |\n| && -` ` && |\n| && -` return this;` && |\n| && -` };` && |\n| && -` ` && |\n| && -` Polygon.prototype.setCoords = function(coords) {` && |\n| && -` this._coords.points = coords.points;` && |\n| && -` ` && |\n| && -` return this;` && |\n| && -` };` && |\n| && -` ` && |\n| && -` Polygon.prototype.addPoint = function(x, y) {` && |\n| && -` if (!this._coords.isOpened) {` && |\n| && -` throw new Error('This polygon is closed!');` && |\n| && -` }` && |\n| && -`` && |\n| && -` var helper = new Helper(this._groupEl, x, y, 'movePoint');` && |\n| && -` helper.setId(this._helpers.points.length);` && |\n| && -`` && |\n| && -` this._helpers.points.push(helper);` && |\n| && -` this._coords.points.push({` && |\n| && -` x : x, ` && |\n| && -` y : y` && |\n| && -` });` && |\n| && -` this.redraw();` && |\n| && -` ` && |\n| && -` return this;` && |\n| && -` };` && |\n| && -` ` && |\n| && -` Polygon.prototype.dynamicDraw = function(x, y, isRightAngle) {` && |\n| && -` var temp_coords = {` && |\n| && -` points: [].concat(this._coords.points)` && |\n| && -` };` && |\n| && -` ` && |\n| && -` if (isRightAngle) {` && |\n| && -` var rightPointCoords = Polygon.getRightAngleLineLastPointCoords(` && |\n| && -` this._coords, {x: x, y: y}` && |\n| && -` );` && |\n| && -` x = rightPointCoords.x;` && |\n| && -` y = rightPointCoords.y;` && |\n| && -` }` && |\n| && -` ` && |\n| && -` temp_coords.points.push({x : x, y : y});` && |\n| && -` ` && |\n| && -` this.redraw(temp_coords);` && |\n| && -` ` && |\n| && -` return temp_coords;` && |\n| && -` };` && |\n| && -` ` && |\n| && -` Polygon.prototype.onProcessDrawing = function(e) {` && |\n| && -` var coords = utils.getRightCoords(e.pageX, e.pageY);` && |\n| && -` ` && |\n| && -` this.dynamicDraw(coords.x, coords.y, e.shiftKey);` && |\n| && -` };` && |\n| && -` ` && |\n| && -` Polygon.prototype.onAddPointDrawing = function(e) {` && |\n| && -` var newPointCoords = utils.getRightCoords(e.pageX, e.pageY);` && |\n| && -`` && |\n| && -` if (e.shiftKey) {` && |\n| && -` newPointCoords = Polygon.getRightAngleLineLastPointCoords(this._coords, newPointCoords);` && |\n| && -` }` && |\n| && -` ` && |\n| && -` this.addPoint(newPointCoords.x, newPointCoords.y);` && |\n| && -` };` && |\n| && -` ` && |\n| && -` Polygon.prototype.onStopDrawing = function(e) {` && |\n| && -` if (e.type == 'click' || (e.type == 'keydown' && e.keyCode == 13)) {` && |\n| && -` if (Polygon.testCoords(this._coords)) {` && |\n| && -` this.close();` && |\n| && -` ` && |\n| && -` app.removeAllEvents()` && |\n| && -` .setIsDraw(false)` && |\n| && -` .resetNewArea();` && |\n| && -` }` && |\n| && -` }` && |\n| && -` e.stopPropagation();` && |\n| && -` };` && |\n| && -`` && |\n| && -` Polygon.prototype.edit = function(editingType, dx, dy) {` && |\n| && -` var tempParams = Object.create(this._coords);` && |\n| && -` ` && |\n| && -` switch (editingType) {` && |\n| && -` case 'move':` && |\n| && -` for (var i = 0, c = tempParams.points.length; i < c; i++) {` && |\n| && -` tempParams.points[i].x += dx;` && |\n| && -` tempParams.points[i].y += dy;` && |\n| && -` }` && |\n| && -` break;` && |\n| && -` ` && |\n| && -` case 'movePoint':` && |\n| && -` tempParams.points[this.selected_point].x += dx;` && |\n| && -` tempParams.points[this.selected_point].y += dy;` && |\n| && -` break;` && |\n| && -` }` && |\n| && -`` && |\n| && -` return tempParams;` && |\n| && -` };` && |\n| && -` ` && |\n| && -` Polygon.prototype.onProcessEditing = function(e) {` && |\n| && -` var editType = app.getEditType();` && |\n| && -` ` && |\n| && -` this.redraw(` && |\n| && -` this.edit(` && |\n| && -` editType, ` && |\n| && -` e.pageX - this.editingStartPoint.x, ` && |\n| && -` e.pageY - this.editingStartPoint.y` && |\n| && -` )` && |\n| && -` );` && |\n| && -`` && |\n| && -` this.editingStartPoint.x = e.pageX;` && |\n| && -` this.editingStartPoint.y = e.pageY;` && |\n| && -` };` && |\n| && -` ` && |\n| && -` Polygon.prototype.onStopEditing = function(e) {` && |\n| && -` var editType = app.getEditType();` && |\n| && -` ` && |\n| && -` this.setCoords(` && |\n| && -` this.edit(` && |\n| && -` editType, ` && |\n| && -` e.pageX - this.editingStartPoint.x, ` && |\n| && -` e.pageY - this.editingStartPoint.y` && |\n| && -` )` && |\n| && -` ).redraw();` && |\n| && -` ` && |\n| && -` app.removeAllEvents();` && |\n| && -` };` && |\n| && -` ` && |\n| && -` /**` && |\n| && -` * Returns string-representation of polygon` && |\n| && -` * ` && |\n| && -` * @returns {string}` && |\n| && -` */` && |\n| && -` Polygon.prototype.toString = function() {` && |\n| && -` return 'Polygon {points: ['+ ` && |\n| && -` this._coords.points.map(function(item) {` && |\n| && -` return '[' + item.x + ', ' + item.y + ']'` && |\n| && -` }).join(', ') + ']}';` && |\n| && -` }` && |\n| && -` ` && |\n| && -` Polygon.prototype.toHTMLMapElementString = function() {` && |\n| && -` var str = this._coords.points.map(function(item) {` && |\n| && -` return item.x + ', ' + item.y;` && |\n| && -` }).join(', ');` && |\n| && -` ` && |\n| && -` return '<area shape="poly" coords="'` && |\n| && -` + str` && |\n| && -` + '"'` && |\n| && -` + (this._attributes.href ? ' href="' + this._attributes.href + '"' : '')` && |\n| && -` + (this._attributes.alt ? ' alt="' + this._attributes.alt + '"' : '')` && |\n| && -` + (this._attributes.title ? ' title="' + this._attributes.title + '"' : '')` && |\n| && -` + ' />';` && |\n| && -` };` && |\n|. -result = result && |\n| && -` Polygon.prototype.getCoordsForDisplayingInfo = function() {` && |\n| && -` return {` && |\n| && -` x : this._coords.points[0].x,` && |\n| && -` y : this._coords.points[0].y` && |\n| && -` };` && |\n| && -` };` && |\n| && -` ` && |\n| && -` Polygon.testCoords = function(coords) {` && |\n| && -` return coords.points.length >= 3;` && |\n| && -` };` && |\n| && -`` && |\n| && -` Polygon.testHTMLCoords = function(coords) {` && |\n| && -` return coords.length >= 6 && coords.length % 2 === 0;` && |\n| && -` };` && |\n| && -`` && |\n| && -` Polygon.getCoordsFromHTMLArray = function(htmlCoordsArray) {` && |\n| && -` if (!Polygon.testHTMLCoords(htmlCoordsArray)) { ` && |\n| && -` throw new Error('This html-coordinates is not valid for polygon');` && |\n| && -` }` && |\n| && -`` && |\n| && -` var points = [];` && |\n| && -` for (var i = 0, c = htmlCoordsArray.length/2; i < c; i++) {` && |\n| && -` points.push({` && |\n| && -` x : htmlCoordsArray[2*i],` && |\n| && -` y : htmlCoordsArray[2*i + 1]` && |\n| && -` });` && |\n| && -` }` && |\n| && -`` && |\n| && -` return {` && |\n| && -` points : points` && |\n| && -` };` && |\n| && -` };` && |\n| && -`` && |\n| && -` Polygon.getRightAngleLineLastPointCoords = function(originalCoords, newPointCoords) {` && |\n| && -` var TANGENS = {` && |\n| && -` DEG_22 : 0.414,` && |\n| && -` DEG_67 : 2.414` && |\n| && -` },` && |\n| && -` lastPointIndex = originalCoords.points.length - 1,` && |\n| && -` lastPoint = originalCoords.points[lastPointIndex],` && |\n| && -` dx = newPointCoords.x - lastPoint.x,` && |\n| && -` dy = -(newPointCoords.y - lastPoint.y),` && |\n| && -` tan = dy / dx,` && |\n| && -` x = newPointCoords.x,` && |\n| && -` y = newPointCoords.y;` && |\n| && -` ` && |\n| && -` if (dx > 0 && dy > 0) {` && |\n| && -` if (tan > TANGENS.DEG_67) {` && |\n| && -` x = lastPoint.x;` && |\n| && -` } else if (tan < TANGENS.DEG_22) {` && |\n| && -` y = lastPoint.y;` && |\n| && -` } else {` && |\n| && -` Math.abs(dx) > Math.abs(dy) ? ` && |\n| && -` (x = lastPoint.x + dy) : (y = lastPoint.y - dx);` && |\n| && -` }` && |\n| && -` } else if (dx < 0 && dy > 0) {` && |\n| && -` if (tan < -TANGENS.DEG_67) {` && |\n| && -` x = lastPoint.x;` && |\n| && -` } else if (tan > -TANGENS.DEG_22) {` && |\n| && -` y = lastPoint.y;` && |\n| && -` } else {` && |\n| && -` Math.abs(dx) > Math.abs(dy) ?` && |\n| && -` (x = lastPoint.x - dy) : (y = lastPoint.y + dx);` && |\n| && -` }` && |\n| && -` } else if (dx < 0 && dy < 0) {` && |\n| && -` if (tan > TANGENS.DEG_67) {` && |\n| && -` x = lastPoint.x;` && |\n| && -` } else if (tan < TANGENS.DEG_22) {` && |\n| && -` y = lastPoint.y;` && |\n| && -` } else {` && |\n| && -` Math.abs(dx) > Math.abs(dy) ? ` && |\n| && -` (x = lastPoint.x + dy) : (y = lastPoint.y - dx);` && |\n| && -` }` && |\n| && -` } else if (dx > 0 && dy < 0) {` && |\n| && -` if (tan < -TANGENS.DEG_67) {` && |\n| && -` x = lastPoint.x;` && |\n| && -` } else if (tan > -TANGENS.DEG_22) {` && |\n| && -` y = lastPoint.y;` && |\n| && -` } else {` && |\n| && -` Math.abs(dx) > Math.abs(dy) ? ` && |\n| && -` (x = lastPoint.x - dy) : (y = lastPoint.y + dx);` && |\n| && -` }` && |\n| && -` }` && |\n| && -` ` && |\n| && -` return {` && |\n| && -` x : x,` && |\n| && -` y : y` && |\n| && -` };` && |\n| && -` };` && |\n| && -` ` && |\n| && -` Polygon.createAndStartDrawing = function(firstPointCoords) {` && |\n| && -` var newArea = new Polygon({` && |\n| && -` points : [firstPointCoords],` && |\n| && -` isOpened : true` && |\n| && -` });` && |\n| && -` ` && |\n| && -` app.addEvent(app.domElements.container, 'mousemove', newArea.onProcessDrawing.bind(newArea))` && |\n| && -` .addEvent(app.domElements.container, 'click', newArea.onAddPointDrawing.bind(newArea))` && |\n| && -` .addEvent(document, 'keydown', newArea.onStopDrawing.bind(newArea))` && |\n| && -` .addEvent(newArea._helpers.points[0]._el, 'click', newArea.onStopDrawing.bind(newArea));` && |\n| && -` ` && |\n| && -` return newArea;` && |\n| && -` };` && |\n| && -`` && |\n| && -` /* TODO: this modules will use app.js */` && |\n| && -` /* Help block */` && |\n| && -` var help = (function() {` && |\n| && -` var block = utils.id('help'),` && |\n| && -` overlay = utils.id('overlay'),` && |\n| && -` close_button = block.querySelector('.close_button');` && |\n| && -` ` && |\n| && -` function hide() {` && |\n| && -` utils.hide(block);` && |\n| && -` utils.hide(overlay);` && |\n| && -` }` && |\n| && -` ` && |\n| && -` function show() {` && |\n| && -` utils.show(block);` && |\n| && -` utils.show(overlay);` && |\n| && -` }` && |\n| && -` ` && |\n| && -` overlay.addEventListener('click', hide, false);` && |\n| && -` ` && |\n| && -` close_button.addEventListener('click', hide, false);` && |\n| && -` ` && |\n| && -` return {` && |\n| && -` show : show,` && |\n| && -` hide : hide` && |\n| && -` };` && |\n| && -` })();` && |\n| && -`` && |\n| && -` /* For html code of created map */` && |\n| && -` var code = (function(){` && |\n| && -` var block = utils.id('code'),` && |\n| && -` content = utils.id('code_content'),` && |\n| && -` close_button = block.querySelector('.close_button');` && |\n| && -` ` && |\n| && -` close_button.addEventListener('click', function(e) {` && |\n| && -` utils.hide(block);` && |\n| && -` e.preventDefault();` && |\n| && -` }, false);` && |\n| && -` ` && |\n| && -` return {` && |\n| && -` print: function() {` && |\n| && -` content.innerHTML = app.getHTMLCode(true);` && |\n| && -` utils.show(block);` && |\n| && -` },` && |\n| && -` hide: function() {` && |\n| && -` utils.hide(block);` && |\n| && -` }` && |\n| && -` };` && |\n| && -` })();` && |\n| && -` ` && |\n| && -`` && |\n| && -` /* Edit selected area info */` && |\n| && -` var info = (function() {` && |\n| && -` var form = utils.id('edit_details'),` && |\n| && -` header = form.querySelector('h5'),` && |\n| && -` href_attr = utils.id('href_attr'),` && |\n| && -` alt_attr = utils.id('alt_attr'),` && |\n| && -` title_attr = utils.id('title_attr'),` && |\n| && -` save_button = utils.id('save_details'),` && |\n| && -` close_button = form.querySelector('.close_button'),` && |\n| && -` sections = form.querySelectorAll('p'),` && |\n| && -` obj,` && |\n| && -` x,` && |\n| && -` y,` && |\n| && -` temp_x,` && |\n| && -` temp_y;` && |\n| && -` ` && |\n| && -` function changedReset() {` && |\n| && -` form.classList.remove('changed');` && |\n| && -` utils.foreach(sections, function(x) {` && |\n| && -` x.classList.remove('changed');` && |\n| && -` });` && |\n| && -` }` && |\n| && -` ` && |\n| && -` function save(e) {` && |\n| && -` obj.setInfoAttributes({` && |\n| && -` href : href_attr.value,` && |\n| && -` alt : alt_attr.value,` && |\n| && -` title : title_attr.value,` && |\n| && -` });` && |\n| && -` ` && |\n| && -` obj[obj.href ? 'setStyleOfElementWithHref' : 'unsetStyleOfElementWithHref']();` && |\n| && -` ` && |\n| && -` changedReset();` && |\n| && -` unload();` && |\n| && -` ` && |\n| && -` e.preventDefault();` && |\n| && -` }` && |\n| && -` ` && |\n| && -` function unload() {` && |\n| && -` obj = null;` && |\n| && -` changedReset();` && |\n| && -` utils.hide(form);` && |\n| && -` }` && |\n| && -` ` && |\n| && -` function setCoords(x, y) {` && |\n| && -` form.style.left = (x + 5) + 'px';` && |\n| && -` form.style.top = (y + 5) + 'px';` && |\n| && -` }` && |\n| && -` ` && |\n| && -` function moveEditBlock(e) {` && |\n| && -` setCoords(x + e.pageX - temp_x, y + e.pageY - temp_y);` && |\n| && -` }` && |\n| && -` ` && |\n| && -` function stopMoveEditBlock(e) {` && |\n| && -` x = x + e.pageX - temp_x;` && |\n| && -` y = y + e.pageY - temp_y;` && |\n| && -` setCoords(x, y);` && |\n| && -` ` && |\n| && -` app.removeAllEvents();` && |\n| && -` }` && |\n| && -` ` && |\n| && -` function change() {` && |\n| && -` form.classList.add('changed');` && |\n| && -` this.parentNode.classList.add('changed');` && |\n| && -` }` && |\n| && -` ` && |\n| && -` save_button.addEventListener('click', save, false);` && |\n| && -` ` && |\n| && -` href_attr.addEventListener('keydown', function(e) { e.stopPropagation(); }, false);` && |\n| && -` alt_attr.addEventListener('keydown', function(e) { e.stopPropagation(); }, false);` && |\n| && -` title_attr.addEventListener('keydown', function(e) { e.stopPropagation(); }, false);` && |\n| && -` ` && |\n| && -` href_attr.addEventListener('change', change, false);` && |\n| && -` alt_attr.addEventListener('change', change, false);` && |\n| && -` title_attr.addEventListener('change', change, false);` && |\n| && -` ` && |\n| && -` close_button.addEventListener('click', unload, false);` && |\n| && -` ` && |\n| && -` header.addEventListener('mousedown', function(e) {` && |\n| && -` temp_x = e.pageX,` && |\n| && -` temp_y = e.pageY;` && |\n| && -` ` && |\n| && -` app.addEvent(document, 'mousemove', moveEditBlock);` && |\n| && -` app.addEvent(header, 'mouseup', stopMoveEditBlock);` && |\n| && -` ` && |\n| && -` e.preventDefault();` && |\n| && -` }, false);` && |\n| && -` ` && |\n| && -` return {` && |\n| && -` load : function(object, new_x, new_y) {` && |\n| && -` obj = object;` && |\n| && -` href_attr.value = object.href ? object.href : '';` && |\n| && -` alt_attr.value = object.alt ? object.alt : '';` && |\n| && -` title_attr.value = object.title ? object.title : '';` && |\n| && -` utils.show(form);` && |\n| && -` if (new_x && new_y) {` && |\n| && -` x = new_x;` && |\n| && -` y = new_y;` && |\n| && -` setCoords(x, y);` && |\n| && -` }` && |\n| && -` },` && |\n| && -` unload : unload` && |\n| && -` };` && |\n| && -` })();` && |\n| && -`` && |\n| && -`` && |\n| && -` /* Load areas from html code */` && |\n| && -` var from_html_form = (function() {` && |\n| && -` var form = utils.id('from_html_wrapper'),` && |\n| && -` code_input = utils.id('code_input'),` && |\n| && -` load_button = utils.id('load_code_button'),` && |\n| && -` close_button = form.querySelector('.close_button');` && |\n| && -` ` && |\n| && -` function load(e) {` && |\n| && -` if (Area.createAreasFromHTMLOfMap(code_input.value)) {` && |\n| && -` hide();` && |\n| && -` }` && |\n| && -` ` && |\n| && -` e.preventDefault();` && |\n| && -` }` && |\n| && -` ` && |\n| && -` function hide() {` && |\n| && -` utils.hide(form);` && |\n| && -` }` && |\n| && -` ` && |\n| && -` load_button.addEventListener('click', load, false);` && |\n| && -` ` && |\n| && -` close_button.addEventListener('click', hide, false);` && |\n| && -` ` && |\n| && -` return {` && |\n| && -` show : function() {` && |\n| && -` code_input.value = '';` && |\n| && -` utils.show(form);` && |\n| && -` },` && |\n| && -` hide : hide` && |\n| && -` };` && |\n| && -` })();` && |\n| && -`` && |\n| && -`` && |\n| && -` /* Get image form */` && |\n| && -` var get_image = (function() {` && |\n| && -` var block = utils.id('get_image_wrapper'),` && |\n| && -` close_button = block.querySelector('.close_button'),` && |\n| && -` loading_indicator = utils.id('loading'),` && |\n| && -` button = utils.id('button'),` && |\n| && -` filename = null,` && |\n| && -` last_changed = null;` && |\n| && -` ` && |\n| && -` // Drag'n'drop - the first way to loading an image` && |\n| && -` var drag_n_drop = (function() {` && |\n| && -` var dropzone = utils.id('dropzone'),` && |\n| && -` dropzone_clear_button = dropzone.querySelector('.clear_button'),` && |\n| && -` sm_img = utils.id('sm_img');` && |\n| && -` ` && |\n| && -` function testFile(type) {` && |\n| && -` switch (type) {` && |\n| && -` case 'image/jpeg':` && |\n| && -` case 'image/jpg':` && |\n| && -` case 'image/bmp':` && |\n| && -` case 'image/gif':` && |\n| && -` case 'image/png':` && |\n| && -` return true;` && |\n| && -` }` && |\n| && -` return false;` && |\n| && -` }` && |\n| && -` ` && |\n| && -` dropzone.addEventListener('dragover', function(e){` && |\n| && -` utils.stopEvent(e);` && |\n| && -` }, false);` && |\n| && -` ` && |\n| && -` dropzone.addEventListener('dragleave', function(e){` && |\n| && -` utils.stopEvent(e);` && |\n| && -` }, false);` && |\n| && -` ` && |\n| && -` dropzone.addEventListener('drop', function(e){` && |\n| && -` utils.stopEvent(e);` && |\n| && -` ` && |\n| && -` var reader = new FileReader(),` && |\n| && -` file = e.dataTransfer.files[0];` && |\n| && -` ` && |\n| && -` if (testFile(file.type)) {` && |\n| && -` dropzone.classList.remove('error');` && |\n| && -` ` && |\n| && -` reader.readAsDataURL(file);` && |\n| && -` ` && |\n| && -` reader.onload = function(e) {` && |\n| && -` sm_img.src = e.target.result;` && |\n| && -` sm_img.style.display = 'inline-block';` && |\n| && -` filename = file.name;` && |\n| && -` utils.show(dropzone_clear_button);` && |\n| && -` last_changed = drag_n_drop;` && |\n| && -` };` && |\n| && -` } else {` && |\n| && -` clearDropzone();` && |\n| && -` dropzone.classList.add('error');` && |\n| && -` }` && |\n| && -` ` && |\n| && -` }, false);` && |\n| && -` ` && |\n| && -` function clearDropzone() {` && |\n| && -` sm_img.src = '';` && |\n| && -` ` && |\n| && -` utils.hide(sm_img)` && |\n| && -` .hide(dropzone_clear_button);` && |\n| && -` ` && |\n| && -` dropzone.classList.remove('error');` && |\n| && -` ` && |\n| && -` last_changed = url_input;` && |\n| && -` }` && |\n| && -` ` && |\n| && -` dropzone_clear_button.addEventListener('click', clearDropzone, false);` && |\n| && -` ` && |\n| && -` return {` && |\n| && -` clear : clearDropzone,` && |\n| && -` init : function() {` && |\n| && -` dropzone.draggable = true;` && |\n| && -` this.clear();` && |\n| && -` utils.hide(sm_img)` && |\n| && -` .hide(dropzone_clear_button);` && |\n| && -` },` && |\n| && -` test : function() {` && |\n| && -` return Boolean(sm_img.src);` && |\n| && -` },` && |\n| && -` getImage : function() {` && |\n| && -` return sm_img.src;` && |\n| && -` }` && |\n| && -` };` && |\n| && -` })();` && |\n| && -` ` && |\n| && -` /* Set a url - the second way to loading an image */` && |\n| && -` var url_input = (function() {` && |\n| && -` var url = utils.id('url'),` && |\n| && -` url_clear_button = url.parentNode.querySelector('.clear_button');` && |\n| && -` ` && |\n| && -` function testUrl(str) {` && |\n| && -` var url_str = str.trim(),` && |\n| && -` temp_array = url_str.split('.'),` && |\n| && -` ext;` && |\n| && -` ` && |\n| && -` if(temp_array.length > 1) {` && |\n| && -` ext = temp_array[temp_array.length-1].toLowerCase();` && |\n| && -` switch (ext) {` && |\n| && -` case 'jpg':` && |\n| && -` case 'jpeg':` && |\n| && -` case 'bmp':` && |\n| && -` case 'gif':` && |\n| && -` case 'png':` && |\n| && -` return true;` && |\n| && -` }` && |\n| && -` }` && |\n| && -` ` && |\n| && -` return false;` && |\n| && -` }` && |\n| && -` ` && |\n| && -` function onUrlChange() {` && |\n| && -` setTimeout(function(){` && |\n| && -` if(url.value.length) {` && |\n| && -` utils.show(url_clear_button);` && |\n| && -` last_changed = url_input;` && |\n| && -` } else {` && |\n| && -` utils.hide(url_clear_button);` && |\n| && -` last_changed = drag_n_drop;` && |\n| && -` }` && |\n| && -` }, 0);` && |\n| && -` }` && |\n| && -` ` && |\n| && -` url.addEventListener('keypress', onUrlChange, false);` && |\n| && -` url.addEventListener('change', onUrlChange, false);` && |\n| && -` url.addEventListener('paste', onUrlChange, false);` && |\n| && -` ` && |\n| && -` function clearUrl() {` && |\n| && -` url.value = '';` && |\n| && -` utils.hide(url_clear_button);` && |\n| && -` url.classList.remove('error');` && |\n| && -` last_changed = url_input;` && |\n| && -` }` && |\n| && -` ` && |\n| && -` url_clear_button.addEventListener('click', clearUrl, false);` && |\n| && -` ` && |\n| && -` return {` && |\n| && -` clear : clearUrl,` && |\n| && -` init : function() {` && |\n| && -` this.clear();` && |\n| && -` utils.hide(url_clear_button);` && |\n| && -` },` && |\n| && -` test : function() {` && |\n| && -` if(testUrl(url.value)) {` && |\n| && -` url.classList.remove('error');` && |\n| && -` return true;` && |\n| && -` } else {` && |\n| && -` url.classList.add('error');` && |\n| && -` }` && |\n| && -` return false;` && |\n| && -` },` && |\n| && -` getImage : function() {` && |\n| && -` var tmp_arr = url.value.split('/');` && |\n| && -` filename = tmp_arr[tmp_arr.length - 1];` && |\n| && -` ` && |\n| && -` return url.value.trim();` && |\n| && -` }` && |\n| && -` };` && |\n|. + result = result && + ` Polygon.prototype.setSVGCoords = function(coords) {` && |\n| && + ` var polygonPointsAttrValue = coords.points.reduce(function(previousValue, currentItem) {` && |\n| && + ` return previousValue + currentItem.x + ' ' + currentItem.y + ' ';` && |\n| && + ` }, '');` && |\n| && + ` ` && |\n| && + ` this._el.setAttribute('points', polygonPointsAttrValue);` && |\n| && + ` utils.foreach(this._helpers.points, function(helper, i) {` && |\n| && + ` helper.setCoords(coords.points[i].x, coords.points[i].y);` && |\n| && + ` });` && |\n| && + ` ` && |\n| && + ` return this;` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` Polygon.prototype.setCoords = function(coords) {` && |\n| && + ` this._coords.points = coords.points;` && |\n| && + ` ` && |\n| && + ` return this;` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` Polygon.prototype.addPoint = function(x, y) {` && |\n| && + ` if (!this._coords.isOpened) {` && |\n| && + ` throw new Error('This polygon is closed!');` && |\n| && + ` }` && |\n| && + `` && |\n| && + ` var helper = new Helper(this._groupEl, x, y, 'movePoint');` && |\n| && + ` helper.setId(this._helpers.points.length);` && |\n| && + `` && |\n| && + ` this._helpers.points.push(helper);` && |\n| && + ` this._coords.points.push({` && |\n| && + ` x : x, ` && |\n| && + ` y : y` && |\n| && + ` });` && |\n| && + ` this.redraw();` && |\n| && + ` ` && |\n| && + ` return this;` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` Polygon.prototype.dynamicDraw = function(x, y, isRightAngle) {` && |\n| && + ` var temp_coords = {` && |\n| && + ` points: [].concat(this._coords.points)` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` if (isRightAngle) {` && |\n| && + ` var rightPointCoords = Polygon.getRightAngleLineLastPointCoords(` && |\n| && + ` this._coords, {x: x, y: y}` && |\n| && + ` );` && |\n| && + ` x = rightPointCoords.x;` && |\n| && + ` y = rightPointCoords.y;` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` temp_coords.points.push({x : x, y : y});` && |\n| && + ` ` && |\n| && + ` this.redraw(temp_coords);` && |\n| && + ` ` && |\n| && + ` return temp_coords;` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` Polygon.prototype.onProcessDrawing = function(e) {` && |\n| && + ` var coords = utils.getRightCoords(e.pageX, e.pageY);` && |\n| && + ` ` && |\n| && + ` this.dynamicDraw(coords.x, coords.y, e.shiftKey);` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` Polygon.prototype.onAddPointDrawing = function(e) {` && |\n| && + ` var newPointCoords = utils.getRightCoords(e.pageX, e.pageY);` && |\n| && + `` && |\n| && + ` if (e.shiftKey) {` && |\n| && + ` newPointCoords = Polygon.getRightAngleLineLastPointCoords(this._coords, newPointCoords);` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` this.addPoint(newPointCoords.x, newPointCoords.y);` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` Polygon.prototype.onStopDrawing = function(e) {` && |\n| && + ` if (e.type == 'click' || (e.type == 'keydown' && e.keyCode == 13)) {` && |\n| && + ` if (Polygon.testCoords(this._coords)) {` && |\n| && + ` this.close();` && |\n| && + ` ` && |\n| && + ` app.removeAllEvents()` && |\n| && + ` .setIsDraw(false)` && |\n| && + ` .resetNewArea();` && |\n| && + ` }` && |\n| && + ` }` && |\n| && + ` e.stopPropagation();` && |\n| && + ` };` && |\n| && + `` && |\n| && + ` Polygon.prototype.edit = function(editingType, dx, dy) {` && |\n| && + ` var tempParams = Object.create(this._coords);` && |\n| && + ` ` && |\n| && + ` switch (editingType) {` && |\n| && + ` case 'move':` && |\n| && + ` for (var i = 0, c = tempParams.points.length; i < c; i++) {` && |\n| && + ` tempParams.points[i].x += dx;` && |\n| && + ` tempParams.points[i].y += dy;` && |\n| && + ` }` && |\n| && + ` break;` && |\n| && + ` ` && |\n| && + ` case 'movePoint':` && |\n| && + ` tempParams.points[this.selected_point].x += dx;` && |\n| && + ` tempParams.points[this.selected_point].y += dy;` && |\n| && + ` break;` && |\n| && + ` }` && |\n| && + `` && |\n| && + ` return tempParams;` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` Polygon.prototype.onProcessEditing = function(e) {` && |\n| && + ` var editType = app.getEditType();` && |\n| && + ` ` && |\n| && + ` this.redraw(` && |\n| && + ` this.edit(` && |\n| && + ` editType, ` && |\n| && + ` e.pageX - this.editingStartPoint.x, ` && |\n| && + ` e.pageY - this.editingStartPoint.y` && |\n| && + ` )` && |\n| && + ` );` && |\n| && + `` && |\n| && + ` this.editingStartPoint.x = e.pageX;` && |\n| && + ` this.editingStartPoint.y = e.pageY;` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` Polygon.prototype.onStopEditing = function(e) {` && |\n| && + ` var editType = app.getEditType();` && |\n| && + ` ` && |\n| && + ` this.setCoords(` && |\n| && + ` this.edit(` && |\n| && + ` editType, ` && |\n| && + ` e.pageX - this.editingStartPoint.x, ` && |\n| && + ` e.pageY - this.editingStartPoint.y` && |\n| && + ` )` && |\n| && + ` ).redraw();` && |\n| && + ` ` && |\n| && + ` app.removeAllEvents();` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` /**` && |\n| && + ` * Returns string-representation of polygon` && |\n| && + ` * ` && |\n| && + ` * @returns {string}` && |\n| && + ` */` && |\n| && + ` Polygon.prototype.toString = function() {` && |\n| && + ` return 'Polygon {points: ['+ ` && |\n| && + ` this._coords.points.map(function(item) {` && |\n| && + ` return '[' + item.x + ', ' + item.y + ']'` && |\n| && + ` }).join(', ') + ']}';` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` Polygon.prototype.toHTMLMapElementString = function() {` && |\n| && + ` var str = this._coords.points.map(function(item) {` && |\n| && + ` return item.x + ', ' + item.y;` && |\n| && + ` }).join(', ');` && |\n| && + ` ` && |\n| && + ` return '<area shape="poly" coords="'` && |\n| && + ` + str` && |\n| && + ` + '"'` && |\n| && + ` + (this._attributes.href ? ' href="' + this._attributes.href + '"' : '')` && |\n| && + ` + (this._attributes.alt ? ' alt="' + this._attributes.alt + '"' : '')` && |\n| && + ` + (this._attributes.title ? ' title="' + this._attributes.title + '"' : '')` && |\n| && + ` + ' />';` && |\n| && + ` };` && |\n|. + result = result && |\n| && + ` Polygon.prototype.getCoordsForDisplayingInfo = function() {` && |\n| && + ` return {` && |\n| && + ` x : this._coords.points[0].x,` && |\n| && + ` y : this._coords.points[0].y` && |\n| && + ` };` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` Polygon.testCoords = function(coords) {` && |\n| && + ` return coords.points.length >= 3;` && |\n| && + ` };` && |\n| && + `` && |\n| && + ` Polygon.testHTMLCoords = function(coords) {` && |\n| && + ` return coords.length >= 6 && coords.length % 2 === 0;` && |\n| && + ` };` && |\n| && + `` && |\n| && + ` Polygon.getCoordsFromHTMLArray = function(htmlCoordsArray) {` && |\n| && + ` if (!Polygon.testHTMLCoords(htmlCoordsArray)) { ` && |\n| && + ` throw new Error('This html-coordinates is not valid for polygon');` && |\n| && + ` }` && |\n| && + `` && |\n| && + ` var points = [];` && |\n| && + ` for (var i = 0, c = htmlCoordsArray.length/2; i < c; i++) {` && |\n| && + ` points.push({` && |\n| && + ` x : htmlCoordsArray[2*i],` && |\n| && + ` y : htmlCoordsArray[2*i + 1]` && |\n| && + ` });` && |\n| && + ` }` && |\n| && + `` && |\n| && + ` return {` && |\n| && + ` points : points` && |\n| && + ` };` && |\n| && + ` };` && |\n| && + `` && |\n| && + ` Polygon.getRightAngleLineLastPointCoords = function(originalCoords, newPointCoords) {` && |\n| && + ` var TANGENS = {` && |\n| && + ` DEG_22 : 0.414,` && |\n| && + ` DEG_67 : 2.414` && |\n| && + ` },` && |\n| && + ` lastPointIndex = originalCoords.points.length - 1,` && |\n| && + ` lastPoint = originalCoords.points[lastPointIndex],` && |\n| && + ` dx = newPointCoords.x - lastPoint.x,` && |\n| && + ` dy = -(newPointCoords.y - lastPoint.y),` && |\n| && + ` tan = dy / dx,` && |\n| && + ` x = newPointCoords.x,` && |\n| && + ` y = newPointCoords.y;` && |\n| && + ` ` && |\n| && + ` if (dx > 0 && dy > 0) {` && |\n| && + ` if (tan > TANGENS.DEG_67) {` && |\n| && + ` x = lastPoint.x;` && |\n| && + ` } else if (tan < TANGENS.DEG_22) {` && |\n| && + ` y = lastPoint.y;` && |\n| && + ` } else {` && |\n| && + ` Math.abs(dx) > Math.abs(dy) ? ` && |\n| && + ` (x = lastPoint.x + dy) : (y = lastPoint.y - dx);` && |\n| && + ` }` && |\n| && + ` } else if (dx < 0 && dy > 0) {` && |\n| && + ` if (tan < -TANGENS.DEG_67) {` && |\n| && + ` x = lastPoint.x;` && |\n| && + ` } else if (tan > -TANGENS.DEG_22) {` && |\n| && + ` y = lastPoint.y;` && |\n| && + ` } else {` && |\n| && + ` Math.abs(dx) > Math.abs(dy) ?` && |\n| && + ` (x = lastPoint.x - dy) : (y = lastPoint.y + dx);` && |\n| && + ` }` && |\n| && + ` } else if (dx < 0 && dy < 0) {` && |\n| && + ` if (tan > TANGENS.DEG_67) {` && |\n| && + ` x = lastPoint.x;` && |\n| && + ` } else if (tan < TANGENS.DEG_22) {` && |\n| && + ` y = lastPoint.y;` && |\n| && + ` } else {` && |\n| && + ` Math.abs(dx) > Math.abs(dy) ? ` && |\n| && + ` (x = lastPoint.x + dy) : (y = lastPoint.y - dx);` && |\n| && + ` }` && |\n| && + ` } else if (dx > 0 && dy < 0) {` && |\n| && + ` if (tan < -TANGENS.DEG_67) {` && |\n| && + ` x = lastPoint.x;` && |\n| && + ` } else if (tan > -TANGENS.DEG_22) {` && |\n| && + ` y = lastPoint.y;` && |\n| && + ` } else {` && |\n| && + ` Math.abs(dx) > Math.abs(dy) ? ` && |\n| && + ` (x = lastPoint.x - dy) : (y = lastPoint.y + dx);` && |\n| && + ` }` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` return {` && |\n| && + ` x : x,` && |\n| && + ` y : y` && |\n| && + ` };` && |\n| && + ` };` && |\n| && + ` ` && |\n| && + ` Polygon.createAndStartDrawing = function(firstPointCoords) {` && |\n| && + ` var newArea = new Polygon({` && |\n| && + ` points : [firstPointCoords],` && |\n| && + ` isOpened : true` && |\n| && + ` });` && |\n| && + ` ` && |\n| && + ` app.addEvent(app.domElements.container, 'mousemove', newArea.onProcessDrawing.bind(newArea))` && |\n| && + ` .addEvent(app.domElements.container, 'click', newArea.onAddPointDrawing.bind(newArea))` && |\n| && + ` .addEvent(document, 'keydown', newArea.onStopDrawing.bind(newArea))` && |\n| && + ` .addEvent(newArea._helpers.points[0]._el, 'click', newArea.onStopDrawing.bind(newArea));` && |\n| && + ` ` && |\n| && + ` return newArea;` && |\n| && + ` };` && |\n| && + `` && |\n| && + ` /* TODO: this modules will use app.js */` && |\n| && + ` /* Help block */` && |\n| && + ` var help = (function() {` && |\n| && + ` var block = utils.id('help'),` && |\n| && + ` overlay = utils.id('overlay'),` && |\n| && + ` close_button = block.querySelector('.close_button');` && |\n| && + ` ` && |\n| && + ` function hide() {` && |\n| && + ` utils.hide(block);` && |\n| && + ` utils.hide(overlay);` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` function show() {` && |\n| && + ` utils.show(block);` && |\n| && + ` utils.show(overlay);` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` overlay.addEventListener('click', hide, false);` && |\n| && + ` ` && |\n| && + ` close_button.addEventListener('click', hide, false);` && |\n| && + ` ` && |\n| && + ` return {` && |\n| && + ` show : show,` && |\n| && + ` hide : hide` && |\n| && + ` };` && |\n| && + ` })();` && |\n| && + `` && |\n| && + ` /* For html code of created map */` && |\n| && + ` var code = (function(){` && |\n| && + ` var block = utils.id('code'),` && |\n| && + ` content = utils.id('code_content'),` && |\n| && + ` close_button = block.querySelector('.close_button');` && |\n| && + ` ` && |\n| && + ` close_button.addEventListener('click', function(e) {` && |\n| && + ` utils.hide(block);` && |\n| && + ` e.preventDefault();` && |\n| && + ` }, false);` && |\n| && + ` ` && |\n| && + ` return {` && |\n| && + ` print: function() {` && |\n| && + ` content.innerHTML = app.getHTMLCode(true);` && |\n| && + ` utils.show(block);` && |\n| && + ` },` && |\n| && + ` hide: function() {` && |\n| && + ` utils.hide(block);` && |\n| && + ` }` && |\n| && + ` };` && |\n| && + ` })();` && |\n| && + ` ` && |\n| && + `` && |\n| && + ` /* Edit selected area info */` && |\n| && + ` var info = (function() {` && |\n| && + ` var form = utils.id('edit_details'),` && |\n| && + ` header = form.querySelector('h5'),` && |\n| && + ` href_attr = utils.id('href_attr'),` && |\n| && + ` alt_attr = utils.id('alt_attr'),` && |\n| && + ` title_attr = utils.id('title_attr'),` && |\n| && + ` save_button = utils.id('save_details'),` && |\n| && + ` close_button = form.querySelector('.close_button'),` && |\n| && + ` sections = form.querySelectorAll('p'),` && |\n| && + ` obj,` && |\n| && + ` x,` && |\n| && + ` y,` && |\n| && + ` temp_x,` && |\n| && + ` temp_y;` && |\n| && + ` ` && |\n| && + ` function changedReset() {` && |\n| && + ` form.classList.remove('changed');` && |\n| && + ` utils.foreach(sections, function(x) {` && |\n| && + ` x.classList.remove('changed');` && |\n| && + ` });` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` function save(e) {` && |\n| && + ` obj.setInfoAttributes({` && |\n| && + ` href : href_attr.value,` && |\n| && + ` alt : alt_attr.value,` && |\n| && + ` title : title_attr.value,` && |\n| && + ` });` && |\n| && + ` ` && |\n| && + ` obj[obj.href ? 'setStyleOfElementWithHref' : 'unsetStyleOfElementWithHref']();` && |\n| && + ` ` && |\n| && + ` changedReset();` && |\n| && + ` unload();` && |\n| && + ` ` && |\n| && + ` e.preventDefault();` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` function unload() {` && |\n| && + ` obj = null;` && |\n| && + ` changedReset();` && |\n| && + ` utils.hide(form);` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` function setCoords(x, y) {` && |\n| && + ` form.style.left = (x + 5) + 'px';` && |\n| && + ` form.style.top = (y + 5) + 'px';` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` function moveEditBlock(e) {` && |\n| && + ` setCoords(x + e.pageX - temp_x, y + e.pageY - temp_y);` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` function stopMoveEditBlock(e) {` && |\n| && + ` x = x + e.pageX - temp_x;` && |\n| && + ` y = y + e.pageY - temp_y;` && |\n| && + ` setCoords(x, y);` && |\n| && + ` ` && |\n| && + ` app.removeAllEvents();` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` function change() {` && |\n| && + ` form.classList.add('changed');` && |\n| && + ` this.parentNode.classList.add('changed');` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` save_button.addEventListener('click', save, false);` && |\n| && + ` ` && |\n| && + ` href_attr.addEventListener('keydown', function(e) { e.stopPropagation(); }, false);` && |\n| && + ` alt_attr.addEventListener('keydown', function(e) { e.stopPropagation(); }, false);` && |\n| && + ` title_attr.addEventListener('keydown', function(e) { e.stopPropagation(); }, false);` && |\n| && + ` ` && |\n| && + ` href_attr.addEventListener('change', change, false);` && |\n| && + ` alt_attr.addEventListener('change', change, false);` && |\n| && + ` title_attr.addEventListener('change', change, false);` && |\n| && + ` ` && |\n| && + ` close_button.addEventListener('click', unload, false);` && |\n| && + ` ` && |\n| && + ` header.addEventListener('mousedown', function(e) {` && |\n| && + ` temp_x = e.pageX,` && |\n| && + ` temp_y = e.pageY;` && |\n| && + ` ` && |\n| && + ` app.addEvent(document, 'mousemove', moveEditBlock);` && |\n| && + ` app.addEvent(header, 'mouseup', stopMoveEditBlock);` && |\n| && + ` ` && |\n| && + ` e.preventDefault();` && |\n| && + ` }, false);` && |\n| && + ` ` && |\n| && + ` return {` && |\n| && + ` load : function(object, new_x, new_y) {` && |\n| && + ` obj = object;` && |\n| && + ` href_attr.value = object.href ? object.href : '';` && |\n| && + ` alt_attr.value = object.alt ? object.alt : '';` && |\n| && + ` title_attr.value = object.title ? object.title : '';` && |\n| && + ` utils.show(form);` && |\n| && + ` if (new_x && new_y) {` && |\n| && + ` x = new_x;` && |\n| && + ` y = new_y;` && |\n| && + ` setCoords(x, y);` && |\n| && + ` }` && |\n| && + ` },` && |\n| && + ` unload : unload` && |\n| && + ` };` && |\n| && + ` })();` && |\n| && + `` && |\n| && + `` && |\n| && + ` /* Load areas from html code */` && |\n| && + ` var from_html_form = (function() {` && |\n| && + ` var form = utils.id('from_html_wrapper'),` && |\n| && + ` code_input = utils.id('code_input'),` && |\n| && + ` load_button = utils.id('load_code_button'),` && |\n| && + ` close_button = form.querySelector('.close_button');` && |\n| && + ` ` && |\n| && + ` function load(e) {` && |\n| && + ` if (Area.createAreasFromHTMLOfMap(code_input.value)) {` && |\n| && + ` hide();` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` e.preventDefault();` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` function hide() {` && |\n| && + ` utils.hide(form);` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` load_button.addEventListener('click', load, false);` && |\n| && + ` ` && |\n| && + ` close_button.addEventListener('click', hide, false);` && |\n| && + ` ` && |\n| && + ` return {` && |\n| && + ` show : function() {` && |\n| && + ` code_input.value = '';` && |\n| && + ` utils.show(form);` && |\n| && + ` },` && |\n| && + ` hide : hide` && |\n| && + ` };` && |\n| && + ` })();` && |\n| && + `` && |\n| && + `` && |\n| && + ` /* Get image form */` && |\n| && + ` var get_image = (function() {` && |\n| && + ` var block = utils.id('get_image_wrapper'),` && |\n| && + ` close_button = block.querySelector('.close_button'),` && |\n| && + ` loading_indicator = utils.id('loading'),` && |\n| && + ` button = utils.id('button'),` && |\n| && + ` filename = null,` && |\n| && + ` last_changed = null;` && |\n| && + ` ` && |\n| && + ` // Drag'n'drop - the first way to loading an image` && |\n| && + ` var drag_n_drop = (function() {` && |\n| && + ` var dropzone = utils.id('dropzone'),` && |\n| && + ` dropzone_clear_button = dropzone.querySelector('.clear_button'),` && |\n| && + ` sm_img = utils.id('sm_img');` && |\n| && + ` ` && |\n| && + ` function testFile(type) {` && |\n| && + ` switch (type) {` && |\n| && + ` case 'image/jpeg':` && |\n| && + ` case 'image/jpg':` && |\n| && + ` case 'image/bmp':` && |\n| && + ` case 'image/gif':` && |\n| && + ` case 'image/png':` && |\n| && + ` return true;` && |\n| && + ` }` && |\n| && + ` return false;` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` dropzone.addEventListener('dragover', function(e){` && |\n| && + ` utils.stopEvent(e);` && |\n| && + ` }, false);` && |\n| && + ` ` && |\n| && + ` dropzone.addEventListener('dragleave', function(e){` && |\n| && + ` utils.stopEvent(e);` && |\n| && + ` }, false);` && |\n| && + ` ` && |\n| && + ` dropzone.addEventListener('drop', function(e){` && |\n| && + ` utils.stopEvent(e);` && |\n| && + ` ` && |\n| && + ` var reader = new FileReader(),` && |\n| && + ` file = e.dataTransfer.files[0];` && |\n| && + ` ` && |\n| && + ` if (testFile(file.type)) {` && |\n| && + ` dropzone.classList.remove('error');` && |\n| && + ` ` && |\n| && + ` reader.readAsDataURL(file);` && |\n| && + ` ` && |\n| && + ` reader.onload = function(e) {` && |\n| && + ` sm_img.src = e.target.result;` && |\n| && + ` sm_img.style.display = 'inline-block';` && |\n| && + ` filename = file.name;` && |\n| && + ` utils.show(dropzone_clear_button);` && |\n| && + ` last_changed = drag_n_drop;` && |\n| && + ` };` && |\n| && + ` } else {` && |\n| && + ` clearDropzone();` && |\n| && + ` dropzone.classList.add('error');` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` }, false);` && |\n| && + ` ` && |\n| && + ` function clearDropzone() {` && |\n| && + ` sm_img.src = '';` && |\n| && + ` ` && |\n| && + ` utils.hide(sm_img)` && |\n| && + ` .hide(dropzone_clear_button);` && |\n| && + ` ` && |\n| && + ` dropzone.classList.remove('error');` && |\n| && + ` ` && |\n| && + ` last_changed = url_input;` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` dropzone_clear_button.addEventListener('click', clearDropzone, false);` && |\n| && + ` ` && |\n| && + ` return {` && |\n| && + ` clear : clearDropzone,` && |\n| && + ` init : function() {` && |\n| && + ` dropzone.draggable = true;` && |\n| && + ` this.clear();` && |\n| && + ` utils.hide(sm_img)` && |\n| && + ` .hide(dropzone_clear_button);` && |\n| && + ` },` && |\n| && + ` test : function() {` && |\n| && + ` return Boolean(sm_img.src);` && |\n| && + ` },` && |\n| && + ` getImage : function() {` && |\n| && + ` return sm_img.src;` && |\n| && + ` }` && |\n| && + ` };` && |\n| && + ` })();` && |\n| && + ` ` && |\n| && + ` /* Set a url - the second way to loading an image */` && |\n| && + ` var url_input = (function() {` && |\n| && + ` var url = utils.id('url'),` && |\n| && + ` url_clear_button = url.parentNode.querySelector('.clear_button');` && |\n| && + ` ` && |\n| && + ` function testUrl(str) {` && |\n| && + ` var url_str = str.trim(),` && |\n| && + ` temp_array = url_str.split('.'),` && |\n| && + ` ext;` && |\n| && + ` ` && |\n| && + ` if(temp_array.length > 1) {` && |\n| && + ` ext = temp_array[temp_array.length-1].toLowerCase();` && |\n| && + ` switch (ext) {` && |\n| && + ` case 'jpg':` && |\n| && + ` case 'jpeg':` && |\n| && + ` case 'bmp':` && |\n| && + ` case 'gif':` && |\n| && + ` case 'png':` && |\n| && + ` return true;` && |\n| && + ` }` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` return false;` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` function onUrlChange() {` && |\n| && + ` setTimeout(function(){` && |\n| && + ` if(url.value.length) {` && |\n| && + ` utils.show(url_clear_button);` && |\n| && + ` last_changed = url_input;` && |\n| && + ` } else {` && |\n| && + ` utils.hide(url_clear_button);` && |\n| && + ` last_changed = drag_n_drop;` && |\n| && + ` }` && |\n| && + ` }, 0);` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` url.addEventListener('keypress', onUrlChange, false);` && |\n| && + ` url.addEventListener('change', onUrlChange, false);` && |\n| && + ` url.addEventListener('paste', onUrlChange, false);` && |\n| && + ` ` && |\n| && + ` function clearUrl() {` && |\n| && + ` url.value = '';` && |\n| && + ` utils.hide(url_clear_button);` && |\n| && + ` url.classList.remove('error');` && |\n| && + ` last_changed = url_input;` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` url_clear_button.addEventListener('click', clearUrl, false);` && |\n| && + ` ` && |\n| && + ` return {` && |\n| && + ` clear : clearUrl,` && |\n| && + ` init : function() {` && |\n| && + ` this.clear();` && |\n| && + ` utils.hide(url_clear_button);` && |\n| && + ` },` && |\n| && + ` test : function() {` && |\n| && + ` if(testUrl(url.value)) {` && |\n| && + ` url.classList.remove('error');` && |\n| && + ` return true;` && |\n| && + ` } else {` && |\n| && + ` url.classList.add('error');` && |\n| && + ` }` && |\n| && + ` return false;` && |\n| && + ` },` && |\n| && + ` getImage : function() {` && |\n| && + ` var tmp_arr = url.value.split('/');` && |\n| && + ` filename = tmp_arr[tmp_arr.length - 1];` && |\n| && + ` ` && |\n| && + ` return url.value.trim();` && |\n| && + ` }` && |\n| && + ` };` && |\n|. -result = result && -` })();` && |\n| && -` ` && |\n| && -` ` && |\n| && -` /* Block init */` && |\n| && -` function init() {` && |\n| && -` utils.hide(loading_indicator);` && |\n| && -` drag_n_drop.init();` && |\n| && -` url_input.init();` && |\n| && -` var b64_image = base64_image` && |\n| && -` app.loadImage(b64_image).setFilename(filename);` && |\n| && -` }` && |\n| && -` init();` && |\n| && -` ` && |\n| && -` /* Block clear */` && |\n| && -` function clear() {` && |\n| && -` drag_n_drop.clear();` && |\n| && -` url_input.clear();` && |\n| && -` last_changed = null;` && |\n| && -` }` && |\n| && -` ` && |\n| && -` /* Selected image loading */` && |\n| && -` function onButtonClick(e) {` && |\n| && -` if (last_changed === url_input && url_input.test()) {` && |\n| && -` app.loadImage(url_input.getImage()).setFilename(filename);` && |\n| && -` } else if (last_changed === drag_n_drop && drag_n_drop.test()) {` && |\n| && -` app.loadImage(drag_n_drop.getImage()).setFilename(filename);` && |\n| && -` }` && |\n| && -` ` && |\n| && -` e.preventDefault();` && |\n| && -` }` && |\n| && -` ` && |\n| && -` button.addEventListener('click', onButtonClick, false);` && |\n| && -` ` && |\n| && -` close_button.addEventListener('click', hide, false);` && |\n| && -` ` && |\n| && -` function show() {` && |\n| && -` clear();` && |\n| && -` utils.show(block);` && |\n| && -` }` && |\n| && -` ` && |\n| && -` function hide() {` && |\n| && -` utils.hide(block);` && |\n| && -` }` && |\n| && -` ` && |\n| && -` /* Returned object */` && |\n| && -` return {` && |\n| && -` show : function() {` && |\n| && -` app.hide();` && |\n| && -` show();` && |\n| && -` ` && |\n| && -` return this;` && |\n| && -` },` && |\n| && -` hide : function() {` && |\n| && -` app.show();` && |\n| && -` hide();` && |\n| && -` ` && |\n| && -` return this;` && |\n| && -` },` && |\n| && -` showLoadIndicator : function() {` && |\n| && -` utils.show(loading_indicator);` && |\n| && -` ` && |\n| && -` return this;` && |\n| && -` },` && |\n| && -` hideLoadIndicator : function() {` && |\n| && -` utils.hide(loading_indicator);` && |\n| && -` ` && |\n| && -` return this;` && |\n| && -` }` && |\n| && -` };` && |\n| && -` })();` && |\n| && -` // get_image.show();` && |\n| && -` ` && |\n| && -`` && |\n| && -` /* Buttons and actions */` && |\n| && -` var buttons = (function() {` && |\n| && -` var all = utils.id('nav').getElementsByTagName('li'),` && |\n| && -` save = utils.id('save'),` && |\n| && -` load = utils.id('load'),` && |\n| && -` rectangle = utils.id('rectangle'),` && |\n| && -` circle = utils.id('circle'),` && |\n| && -` polygon = utils.id('polygon'),` && |\n| && -` edit = utils.id('edit'),` && |\n| && -` clear = utils.id('clear'),` && |\n| && -` from_html = utils.id('from_html'),` && |\n| && -` to_html = utils.id('to_html'),` && |\n| && -` preview = utils.id('preview'),` && |\n| && -` new_image = utils.id('new_image'),` && |\n| && -` show_help = utils.id('show_help');` && |\n| && -` ` && |\n| && -` function deselectAll() {` && |\n| && -` utils.foreach(all, function(x) {` && |\n| && -` x.classList.remove(Area.CLASS_NAMES.SELECTED);` && |\n| && -` });` && |\n| && -` }` && |\n| && -` ` && |\n| && -` function selectOne(button) {` && |\n| && -` deselectAll();` && |\n| && -` button.classList.add(Area.CLASS_NAMES.SELECTED);` && |\n| && -` }` && |\n| && -` ` && |\n| && -` function onSaveButtonClick(e) {` && |\n| && -` // Save in localStorage` && |\n| && -` app.saveInLocalStorage();` && |\n| && -` ` && |\n| && -` e.preventDefault();` && |\n| && -` }` && |\n| && -` ` && |\n| && -` function onLoadButtonClick(e) {` && |\n| && -` // Load from localStorage` && |\n| && -` app.clear()` && |\n| && -` .loadFromLocalStorage();` && |\n| && -` ` && |\n| && -` e.preventDefault();` && |\n| && -` }` && |\n| && -` ` && |\n| && -` function onShapeButtonClick(e) {` && |\n| && -` // shape = rect || circle || polygon` && |\n| && -` app.setMode('drawing')` && |\n| && -` .setDrawClass()` && |\n| && -` .setShape(this.id)` && |\n| && -` .deselectAll()` && |\n| && -` .hidePreview();` && |\n| && -` info.unload();` && |\n| && -` selectOne(this);` && |\n| && -` ` && |\n| && -` e.preventDefault();` && |\n| && -` }` && |\n| && -` ` && |\n| && -` function onClearButtonClick(e) {` && |\n| && -` // Clear all` && |\n| && -` if (confirm('Clear all?')) {` && |\n| && -` app.setMode(null)` && |\n| && -` .setDefaultClass()` && |\n| && -` .setShape(null)` && |\n| && -` .clear()` && |\n| && -` .hidePreview();` && |\n| && -` deselectAll();` && |\n| && -` }` && |\n| && -` ` && |\n| && -` e.preventDefault();` && |\n| && -` }` && |\n| && -` ` && |\n| && -` function onFromHtmlButtonClick(e) {` && |\n| && -` // Load areas from html` && |\n| && -` from_html_form.show();` && |\n| && -` ` && |\n| && -` e.preventDefault();` && |\n| && -` }` && |\n| && -` ` && |\n| && -` function onToHtmlButtonClick(e) {` && |\n| && -` // Generate html code only` && |\n| && -` info.unload();` && |\n| && -` code.print();` && |\n| && -` ` && |\n| && -` e.preventDefault();` && |\n| && -` }` && |\n| && -` ` && |\n| && -` function onPreviewButtonClick(e) {` && |\n| && -` if (app.getMode() === 'preview') {` && |\n| && -` app.setMode(null)` && |\n| && -` .hidePreview();` && |\n| && -` deselectAll();` && |\n| && -` } else {` && |\n| && -` app.deselectAll()` && |\n| && -` .setMode('preview')` && |\n| && -` .setDefaultClass()` && |\n| && -` .preview();` && |\n| && -` selectOne(this);` && |\n| && -` }` && |\n| && -` ` && |\n| && -` e.preventDefault();` && |\n| && -` }` && |\n| && -` ` && |\n| && -` function onEditButtonClick(e) {` && |\n| && -` if (app.getMode() === 'editing') {` && |\n| && -` app.setMode(null)` && |\n| && -` .setDefaultClass()` && |\n| && -` .deselectAll();` && |\n| && -` deselectAll();` && |\n| && -` utils.show(domElements.svg);` && |\n| && -` } else {` && |\n| && -` app.setShape(null)` && |\n| && -` .setMode('editing')` && |\n| && -` .setEditClass();` && |\n| && -` selectOne(this);` && |\n| && -` }` && |\n| && -` app.hidePreview();` && |\n| && -` e.preventDefault();` && |\n| && -` }` && |\n| && -` ` && |\n| && -` function onNewImageButtonClick(e) {` && |\n| && -` // New image - clear all and back to loading image screen` && |\n| && -` if(confirm('Discard all changes?')) {` && |\n| && -` app.setMode(null)` && |\n| && -` .setDefaultClass()` && |\n| && -` .setShape(null)` && |\n| && -` .setIsDraw(false)` && |\n| && -` .clear()` && |\n| && -` .hide()` && |\n| && -` .hidePreview();` && |\n| && -` deselectAll();` && |\n| && -` get_image.show();` && |\n| && -` } ` && |\n| && -` ` && |\n| && -` e.preventDefault();` && |\n| && -` }` && |\n| && -` ` && |\n| && -` function onShowHelpButtonClick(e) {` && |\n| && -` help.show();` && |\n| && -` ` && |\n| && -` e.preventDefault();` && |\n| && -` }` && |\n| && -` ` && |\n| && -` save.addEventListener('click', onSaveButtonClick, false);` && |\n| && -` load.addEventListener('click', onLoadButtonClick, false);` && |\n| && -` rectangle.addEventListener('click', onShapeButtonClick, false);` && |\n| && -` circle.addEventListener('click', onShapeButtonClick, false);` && |\n| && -` polygon.addEventListener('click', onShapeButtonClick, false);` && |\n| && -` clear.addEventListener('click', onClearButtonClick, false);` && |\n| && -` from_html.addEventListener('click', onFromHtmlButtonClick, false);` && |\n| && -` to_html.addEventListener('click', onToHtmlButtonClick, false);` && |\n| && -` preview.addEventListener('click', onPreviewButtonClick, false);` && |\n| && -` edit.addEventListener('click', onEditButtonClick, false);` && |\n| && -` new_image.addEventListener('click', onNewImageButtonClick, false);` && |\n| && -` show_help.addEventListener('click', onShowHelpButtonClick, false);` && |\n| && -` })();` && |\n| && -`` && |\n| && -` })();` && |\n| && -`}`. -ENDMETHOD. + result = result && + ` })();` && |\n| && + ` ` && |\n| && + ` ` && |\n| && + ` /* Block init */` && |\n| && + ` function init() {` && |\n| && + ` utils.hide(loading_indicator);` && |\n| && + ` drag_n_drop.init();` && |\n| && + ` url_input.init();` && |\n| && + ` var b64_image = base64_image` && |\n| && + ` app.loadImage(b64_image).setFilename(filename);` && |\n| && + ` }` && |\n| && + ` init();` && |\n| && + ` ` && |\n| && + ` /* Block clear */` && |\n| && + ` function clear() {` && |\n| && + ` drag_n_drop.clear();` && |\n| && + ` url_input.clear();` && |\n| && + ` last_changed = null;` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` /* Selected image loading */` && |\n| && + ` function onButtonClick(e) {` && |\n| && + ` if (last_changed === url_input && url_input.test()) {` && |\n| && + ` app.loadImage(url_input.getImage()).setFilename(filename);` && |\n| && + ` } else if (last_changed === drag_n_drop && drag_n_drop.test()) {` && |\n| && + ` app.loadImage(drag_n_drop.getImage()).setFilename(filename);` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` e.preventDefault();` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` button.addEventListener('click', onButtonClick, false);` && |\n| && + ` ` && |\n| && + ` close_button.addEventListener('click', hide, false);` && |\n| && + ` ` && |\n| && + ` function show() {` && |\n| && + ` clear();` && |\n| && + ` utils.show(block);` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` function hide() {` && |\n| && + ` utils.hide(block);` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` /* Returned object */` && |\n| && + ` return {` && |\n| && + ` show : function() {` && |\n| && + ` app.hide();` && |\n| && + ` show();` && |\n| && + ` ` && |\n| && + ` return this;` && |\n| && + ` },` && |\n| && + ` hide : function() {` && |\n| && + ` app.show();` && |\n| && + ` hide();` && |\n| && + ` ` && |\n| && + ` return this;` && |\n| && + ` },` && |\n| && + ` showLoadIndicator : function() {` && |\n| && + ` utils.show(loading_indicator);` && |\n| && + ` ` && |\n| && + ` return this;` && |\n| && + ` },` && |\n| && + ` hideLoadIndicator : function() {` && |\n| && + ` utils.hide(loading_indicator);` && |\n| && + ` ` && |\n| && + ` return this;` && |\n| && + ` }` && |\n| && + ` };` && |\n| && + ` })();` && |\n| && + ` // get_image.show();` && |\n| && + ` ` && |\n| && + `` && |\n| && + ` /* Buttons and actions */` && |\n| && + ` var buttons = (function() {` && |\n| && + ` var all = utils.id('nav').getElementsByTagName('li'),` && |\n| && + ` save = utils.id('save'),` && |\n| && + ` load = utils.id('load'),` && |\n| && + ` rectangle = utils.id('rectangle'),` && |\n| && + ` circle = utils.id('circle'),` && |\n| && + ` polygon = utils.id('polygon'),` && |\n| && + ` edit = utils.id('edit'),` && |\n| && + ` clear = utils.id('clear'),` && |\n| && + ` from_html = utils.id('from_html'),` && |\n| && + ` to_html = utils.id('to_html'),` && |\n| && + ` preview = utils.id('preview'),` && |\n| && + ` new_image = utils.id('new_image'),` && |\n| && + ` show_help = utils.id('show_help');` && |\n| && + ` ` && |\n| && + ` function deselectAll() {` && |\n| && + ` utils.foreach(all, function(x) {` && |\n| && + ` x.classList.remove(Area.CLASS_NAMES.SELECTED);` && |\n| && + ` });` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` function selectOne(button) {` && |\n| && + ` deselectAll();` && |\n| && + ` button.classList.add(Area.CLASS_NAMES.SELECTED);` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` function onSaveButtonClick(e) {` && |\n| && + ` // Save in localStorage` && |\n| && + ` app.saveInLocalStorage();` && |\n| && + ` ` && |\n| && + ` e.preventDefault();` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` function onLoadButtonClick(e) {` && |\n| && + ` // Load from localStorage` && |\n| && + ` app.clear()` && |\n| && + ` .loadFromLocalStorage();` && |\n| && + ` ` && |\n| && + ` e.preventDefault();` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` function onShapeButtonClick(e) {` && |\n| && + ` // shape = rect || circle || polygon` && |\n| && + ` app.setMode('drawing')` && |\n| && + ` .setDrawClass()` && |\n| && + ` .setShape(this.id)` && |\n| && + ` .deselectAll()` && |\n| && + ` .hidePreview();` && |\n| && + ` info.unload();` && |\n| && + ` selectOne(this);` && |\n| && + ` ` && |\n| && + ` e.preventDefault();` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` function onClearButtonClick(e) {` && |\n| && + ` // Clear all` && |\n| && + ` if (confirm('Clear all?')) {` && |\n| && + ` app.setMode(null)` && |\n| && + ` .setDefaultClass()` && |\n| && + ` .setShape(null)` && |\n| && + ` .clear()` && |\n| && + ` .hidePreview();` && |\n| && + ` deselectAll();` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` e.preventDefault();` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` function onFromHtmlButtonClick(e) {` && |\n| && + ` // Load areas from html` && |\n| && + ` from_html_form.show();` && |\n| && + ` ` && |\n| && + ` e.preventDefault();` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` function onToHtmlButtonClick(e) {` && |\n| && + ` // Generate html code only` && |\n| && + ` info.unload();` && |\n| && + ` code.print();` && |\n| && + ` ` && |\n| && + ` e.preventDefault();` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` function onPreviewButtonClick(e) {` && |\n| && + ` if (app.getMode() === 'preview') {` && |\n| && + ` app.setMode(null)` && |\n| && + ` .hidePreview();` && |\n| && + ` deselectAll();` && |\n| && + ` } else {` && |\n| && + ` app.deselectAll()` && |\n| && + ` .setMode('preview')` && |\n| && + ` .setDefaultClass()` && |\n| && + ` .preview();` && |\n| && + ` selectOne(this);` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` e.preventDefault();` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` function onEditButtonClick(e) {` && |\n| && + ` if (app.getMode() === 'editing') {` && |\n| && + ` app.setMode(null)` && |\n| && + ` .setDefaultClass()` && |\n| && + ` .deselectAll();` && |\n| && + ` deselectAll();` && |\n| && + ` utils.show(domElements.svg);` && |\n| && + ` } else {` && |\n| && + ` app.setShape(null)` && |\n| && + ` .setMode('editing')` && |\n| && + ` .setEditClass();` && |\n| && + ` selectOne(this);` && |\n| && + ` }` && |\n| && + ` app.hidePreview();` && |\n| && + ` e.preventDefault();` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` function onNewImageButtonClick(e) {` && |\n| && + ` // New image - clear all and back to loading image screen` && |\n| && + ` if(confirm('Discard all changes?')) {` && |\n| && + ` app.setMode(null)` && |\n| && + ` .setDefaultClass()` && |\n| && + ` .setShape(null)` && |\n| && + ` .setIsDraw(false)` && |\n| && + ` .clear()` && |\n| && + ` .hide()` && |\n| && + ` .hidePreview();` && |\n| && + ` deselectAll();` && |\n| && + ` get_image.show();` && |\n| && + ` } ` && |\n| && + ` ` && |\n| && + ` e.preventDefault();` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` function onShowHelpButtonClick(e) {` && |\n| && + ` help.show();` && |\n| && + ` ` && |\n| && + ` e.preventDefault();` && |\n| && + ` }` && |\n| && + ` ` && |\n| && + ` save.addEventListener('click', onSaveButtonClick, false);` && |\n| && + ` load.addEventListener('click', onLoadButtonClick, false);` && |\n| && + ` rectangle.addEventListener('click', onShapeButtonClick, false);` && |\n| && + ` circle.addEventListener('click', onShapeButtonClick, false);` && |\n| && + ` polygon.addEventListener('click', onShapeButtonClick, false);` && |\n| && + ` clear.addEventListener('click', onClearButtonClick, false);` && |\n| && + ` from_html.addEventListener('click', onFromHtmlButtonClick, false);` && |\n| && + ` to_html.addEventListener('click', onToHtmlButtonClick, false);` && |\n| && + ` preview.addEventListener('click', onPreviewButtonClick, false);` && |\n| && + ` edit.addEventListener('click', onEditButtonClick, false);` && |\n| && + ` new_image.addEventListener('click', onNewImageButtonClick, false);` && |\n| && + ` show_help.addEventListener('click', onShowHelpButtonClick, false);` && |\n| && + ` })();` && |\n| && + `` && |\n| && + ` })();` && |\n| && + `}`. + ENDMETHOD. METHOD set_js_config. - IF is_config IS NOT INITIAL. - DATA(json_config) = ``. - json_config = /ui2/cl_json=>serialize( - data = is_config - compress = abap_true - pretty_name = 'X' - ). - ENDIF. + IF is_config IS NOT INITIAL. + DATA(json_config) = ``. + json_config = /ui2/cl_json=>serialize( + data = is_config + compress = abap_true + pretty_name = 'X' + ). + TRY. + DATA(li_ajson) = CAST z2ui5_if_ajson( z2ui5_cl_ajson=>create_empty( ) ). + li_ajson->set( iv_path = `/` iv_val = is_config ). + li_ajson = li_ajson->filter( z2ui5_cl_ajson_filter_lib=>create_empty_filter( ) ). + li_ajson = li_ajson->map( z2ui5_cl_ajson_mapping=>create_to_camel_case( ) ). + li_ajson = li_ajson->map( z2ui5_cl_ajson_mapping=>create_lower_case( ) ). + json_config = li_ajson->stringify( ). + CATCH cx_root. + ENDTRY. + ENDIF. imagemapster_config = `` && ` var resizeTime = 100;` && @@ -3327,46 +3336,46 @@ ENDMETHOD. *` );` && ` );`. - IF auto_resize = abap_true. + IF auto_resize = abap_true. -imagemapster_config = imagemapster_config && -`` && -` function resize(maxWidth, maxHeight) {` && -` var image = $("img"),` && -` imgWidth = image.width(),` && -` imgHeight = image.height(),` && -` newWidth = 0,` && -` newHeight = 0;` && -`` && -` if (imgWidth / maxWidth > imgHeight / maxHeight) {` && -` newWidth = maxWidth;` && -` } else {` && -` newHeight = maxHeight;` && -` }` && -` image.mapster("resize", newWidth, newHeight, resizeTime);` && -` }` && -`` && -` function onWindowResize() {` && -`` && -` var curWidth = $(window).width(),` && -` curHeight = $(window).height(),` && -` checking = false;` && -` if (checking) {` && -` return;` && -` }` && -` checking = true;` && -` window.setTimeout(function () {` && -` var newWidth = $(window).width(),` && -` newHeight = $(window).height();` && -` if (newWidth === curWidth &&` && -` newHeight === curHeight) {` && -` resize(newWidth, newHeight);` && -` }` && -` checking = false;` && -` }, resizeDelay);` && -` }` && -`` && -` $(window).bind("resize", onWindowResize);`. + imagemapster_config = imagemapster_config && + `` && + ` function resize(maxWidth, maxHeight) {` && + ` var image = $("img"),` && + ` imgWidth = image.width(),` && + ` imgHeight = image.height(),` && + ` newWidth = 0,` && + ` newHeight = 0;` && + `` && + ` if (imgWidth / maxWidth > imgHeight / maxHeight) {` && + ` newWidth = maxWidth;` && + ` } else {` && + ` newHeight = maxHeight;` && + ` }` && + ` image.mapster("resize", newWidth, newHeight, resizeTime);` && + ` }` && + `` && + ` function onWindowResize() {` && + `` && + ` var curWidth = $(window).width(),` && + ` curHeight = $(window).height(),` && + ` checking = false;` && + ` if (checking) {` && + ` return;` && + ` }` && + ` checking = true;` && + ` window.setTimeout(function () {` && + ` var newWidth = $(window).width(),` && + ` newHeight = $(window).height();` && + ` if (newWidth === curWidth &&` && + ` newHeight === curHeight) {` && + ` resize(newWidth, newHeight);` && + ` }` && + ` checking = false;` && + ` }, resizeDelay);` && + ` }` && + `` && + ` $(window).bind("resize", onWindowResize);`. ENDIF. ENDMETHOD. diff --git a/src/01/90/z2ui5_cl_test_integration_test.clas.testclasses.abap b/src/01/90/z2ui5_cl_test_integration_test.clas.testclasses.abap index 3dcf187d..1de5fc2c 100644 --- a/src/01/90/z2ui5_cl_test_integration_test.clas.testclasses.abap +++ b/src/01/90/z2ui5_cl_test_integration_test.clas.testclasses.abap @@ -1,277 +1,277 @@ -CLASS ltcl_integration_test DEFINITION FINAL FOR TESTING - DURATION LONG - RISK LEVEL HARMLESS. - - PUBLIC SECTION. - - - PRIVATE SECTION. - METHODS test_index_html FOR TESTING RAISING cx_static_check. - METHODS test_xml_view FOR TESTING RAISING cx_static_check. - METHODS test_id FOR TESTING RAISING cx_static_check. - METHODS test_xml_popup FOR TESTING RAISING cx_static_check. - METHODS test_bind_one_way FOR TESTING RAISING cx_static_check. - METHODS test_bind_two_way FOR TESTING RAISING cx_static_check. - METHODS test_message_toast FOR TESTING RAISING cx_static_check. - METHODS test_message_box FOR TESTING RAISING cx_static_check. - METHODS test_landing_page FOR TESTING RAISING cx_static_check. - METHODS test_scroll_cursor FOR TESTING RAISING cx_static_check. - METHODS test_navigate FOR TESTING RAISING cx_static_check. - METHODS test_startup_path FOR TESTING RAISING cx_static_check. - - METHODS test_app_dump FOR TESTING RAISING cx_static_check. - -ENDCLASS. - - -CLASS ltcl_integration_test IMPLEMENTATION. - - METHOD test_xml_view. - DATA lo_data TYPE REF TO data. - FIELD-SYMBOLS TYPE any. - - z2ui5_cl_test_integration_test=>sv_state = ``. - DATA(lv_response) = z2ui5_cl_fw_http_handler=>http_post( - `{ "OLOCATION" : { "SEARCH" : "app_start=z2ui5_cl_test_integration_test"}}` ). - - - /ui2/cl_json=>deserialize( EXPORTING json = lv_response - CHANGING data = lo_data ). - - - UNASSIGN . - DATA(lv_assign) = `PARAMS->S_VIEW->XML->*`. - ASSIGN lo_data->(lv_assign) TO . - = shift_left( ). - IF (9) <> `fail( 'xml view - intital view wrong' ). - ENDIF. - - ENDMETHOD. - - METHOD test_index_html. - - DATA(lv_index_html) = z2ui5_cl_fw_http_handler=>http_get( ). - IF lv_index_html IS INITIAL. - cl_abap_unit_assert=>fail( 'HTTP GET - index html initial' ). - ENDIF. - - ENDMETHOD. - - - METHOD test_id. - DATA lo_data TYPE REF TO data. - FIELD-SYMBOLS TYPE any. - - z2ui5_cl_test_integration_test=>sv_state = ``. - DATA(lv_response) = z2ui5_cl_fw_http_handler=>http_post( - `{ "OLOCATION" : { "SEARCH" : "app_start=z2ui5_cl_test_integration_test"}}` ). - - - /ui2/cl_json=>deserialize( EXPORTING json = lv_response - CHANGING data = lo_data ). - - - UNASSIGN . - DATA(lv_assign) = `ID->*`. - ASSIGN lo_data->(lv_assign) TO . - IF IS INITIAL. - cl_abap_unit_assert=>fail( msg = 'id - initial value is initial' - quit = 5 ). - ENDIF. - ENDMETHOD. - - METHOD test_bind_one_way. - - DATA(lo_test) = NEW z2ui5_cl_test_integration_test( ) ##NEEDED. - DATA lo_data TYPE REF TO data. - FIELD-SYMBOLS TYPE any. - - z2ui5_cl_test_integration_test=>sv_state = `TEST_ONE_WAY`. - DATA(lv_response) = z2ui5_cl_fw_http_handler=>http_post( - `{ "OLOCATION" : { "SEARCH" : "app_start=z2ui5_cl_test_integration_test"}}` ). - - - - /ui2/cl_json=>deserialize( EXPORTING json = lv_response - CHANGING data = lo_data ). - - - UNASSIGN . - DATA(lv_assign) = `OVIEWMODEL->QUANTITY->*`. - ASSIGN lo_data->(lv_assign) TO . - IF <> `500`. - cl_abap_unit_assert=>fail( msg = 'data binding - initial set EDIT wrong' - quit = 5 ). - ENDIF. - ENDMETHOD. - - METHOD test_bind_two_way. - DATA lo_data TYPE REF TO data. - FIELD-SYMBOLS TYPE any. - - z2ui5_cl_test_integration_test=>sv_state = ``. - DATA(lv_response) = z2ui5_cl_fw_http_handler=>http_post( - `{ "OLOCATION" : { "SEARCH" : "app_start=z2ui5_cl_test_integration_test"}}` ). - - - /ui2/cl_json=>deserialize( EXPORTING json = lv_response - CHANGING data = lo_data ). - - - UNASSIGN . - DATA(lv_assign) = `OVIEWMODEL->EDIT->QUANTITY->*`. - ASSIGN lo_data->(lv_assign) TO . - IF <> `500`. - cl_abap_unit_assert=>fail( msg = 'data binding - initial set EDIT wrong' - quit = 5 ). - ENDIF. - ENDMETHOD. - - METHOD test_message_box. - DATA lo_data TYPE REF TO data. - FIELD-SYMBOLS TYPE any. - - z2ui5_cl_test_integration_test=>sv_state = `TEST_MESSAGE_BOX`. - DATA(lv_response) = z2ui5_cl_fw_http_handler=>http_post( - `{ "OLOCATION" : { "SEARCH" : "app_start=z2ui5_cl_test_integration_test"}}` ). - - - /ui2/cl_json=>deserialize( EXPORTING json = lv_response - CHANGING data = lo_data ). - - - - UNASSIGN . - DATA(lv_assign) = `PARAMS->S_MSG_BOX->TEXT->*`. - ASSIGN lo_data->(lv_assign) TO . - IF <> `test message box`. - cl_abap_unit_assert=>fail( msg = 'message box - text wrong' - quit = 5 ). - ENDIF. - - UNASSIGN . - lv_assign = `PARAMS->S_MSG_BOX->TYPE->*`. - ASSIGN lo_data->(lv_assign) TO . - IF <> `information`. - cl_abap_unit_assert=>fail( msg = 'message box - type wrong' - quit = 5 ). - ENDIF. - ENDMETHOD. - - METHOD test_message_toast. - DATA lo_data TYPE REF TO data. - FIELD-SYMBOLS TYPE any. - - z2ui5_cl_test_integration_test=>sv_state = `TEST_MESSAGE_TOAST`. - DATA(lv_response) = z2ui5_cl_fw_http_handler=>http_post( - `{ "OLOCATION" : { "SEARCH" : "app_start=z2ui5_cl_test_integration_test"}}` ). - - - /ui2/cl_json=>deserialize( EXPORTING json = lv_response - CHANGING data = lo_data ). - - - - UNASSIGN . - DATA(lv_assign) = `PARAMS->S_MSG_TOAST->TEXT->*`. - ASSIGN lo_data->(lv_assign) TO . - IF <> `test message toast`. - cl_abap_unit_assert=>fail( msg = 'message toast - text wrong' - quit = 5 ). - ENDIF. - - ENDMETHOD. - - - METHOD test_xml_popup. - DATA lo_data TYPE REF TO data. - FIELD-SYMBOLS TYPE any. - - z2ui5_cl_test_integration_test=>sv_state = `TEST_POPUP`. - DATA(lv_response) = z2ui5_cl_fw_http_handler=>http_post( - `{ "OLOCATION" : { "SEARCH" : "app_start=z2ui5_cl_test_integration_test"}}` ). - - - /ui2/cl_json=>deserialize( EXPORTING json = lv_response - CHANGING data = lo_data ). - - - UNASSIGN . - DATA(lv_assign) = `PARAMS->S_POPUP->XML->*`. - ASSIGN lo_data->(lv_assign) TO . - = shift_left( ). - IF (9) <> `fail( msg = 'xml popup - intital popup wrong' - quit = 5 ). - ENDIF. - ENDMETHOD. - - METHOD test_landing_page. - - - ENDMETHOD. - - METHOD test_scroll_cursor. - DATA lo_data TYPE REF TO data. - - z2ui5_cl_test_integration_test=>sv_state = `TEST_SCROLL_CURSOR`. - DATA(lv_response) = z2ui5_cl_fw_http_handler=>http_post( - `{ "OLOCATION" : { "SEARCH" : "app_start=z2ui5_cl_test_integration_test"}}` ). - - - /ui2/cl_json=>deserialize( EXPORTING json = lv_response - CHANGING data = lo_data ). - - ENDMETHOD. - - METHOD test_startup_path. - DATA lo_data TYPE REF TO data. - - z2ui5_cl_test_integration_test=>sv_state = `TEST_NAVIGATE`. - DATA(lv_response) = z2ui5_cl_fw_http_handler=>http_post( - `{ "OLOCATION" : { "SEARCH" : "app_start=z2ui5_cl_test_integration_test"}}` ). - - - /ui2/cl_json=>deserialize( EXPORTING json = lv_response - CHANGING data = lo_data ). - - ENDMETHOD. - - METHOD test_navigate. - DATA lo_data TYPE REF TO data. - - z2ui5_cl_test_integration_test=>sv_state = `TEST_NAVIGATE`. - DATA(lv_response) = z2ui5_cl_fw_http_handler=>http_post( - `{ "OLOCATION" : { "SEARCH" : "app_start=z2ui5_cl_test_integration_test"}}` ). - - - /ui2/cl_json=>deserialize( EXPORTING json = lv_response - CHANGING data = lo_data ). - - ENDMETHOD. - - - METHOD test_app_dump. - - DATA lo_data TYPE REF TO data. - FIELD-SYMBOLS TYPE any. - - z2ui5_cl_test_integration_test=>sv_state = `ERROR`. - DATA(lv_response) = z2ui5_cl_fw_http_handler=>http_post( `{ "OLOCATION" : { "SEARCH" : "app_start=z2ui5_cl_test_integration_test"}}` ). - - - /ui2/cl_json=>deserialize( - EXPORTING - json = lv_response - CHANGING - data = lo_data ). - - UNASSIGN . - ASSIGN (`LO_DATA->PARAMS->S_VIEW->XML->*`) TO . - cl_abap_unit_assert=>assert_not_initial( ). - - ENDMETHOD. - - -ENDCLASS. +*CLASS ltcl_integration_test DEFINITION FINAL FOR TESTING +* DURATION LONG +* RISK LEVEL HARMLESS. +* +* PUBLIC SECTION. +* +* +* PRIVATE SECTION. +* METHODS test_index_html FOR TESTING RAISING cx_static_check. +* METHODS test_xml_view FOR TESTING RAISING cx_static_check. +* METHODS test_id FOR TESTING RAISING cx_static_check. +* METHODS test_xml_popup FOR TESTING RAISING cx_static_check. +* METHODS test_bind_one_way FOR TESTING RAISING cx_static_check. +* METHODS test_bind_two_way FOR TESTING RAISING cx_static_check. +* METHODS test_message_toast FOR TESTING RAISING cx_static_check. +* METHODS test_message_box FOR TESTING RAISING cx_static_check. +* METHODS test_landing_page FOR TESTING RAISING cx_static_check. +* METHODS test_scroll_cursor FOR TESTING RAISING cx_static_check. +* METHODS test_navigate FOR TESTING RAISING cx_static_check. +* METHODS test_startup_path FOR TESTING RAISING cx_static_check. +* +* METHODS test_app_dump FOR TESTING RAISING cx_static_check. +* +*ENDCLASS. +* +* +*CLASS ltcl_integration_test IMPLEMENTATION. +* +* METHOD test_xml_view. +* DATA lo_data TYPE REF TO data. +* FIELD-SYMBOLS TYPE any. +* "test +* z2ui5_cl_test_integration_test=>sv_state = ``. +* DATA(lv_response) = z2ui5_cl_fw_http_handler=>http_post( +* `{ "OLOCATION" : { "SEARCH" : "app_start=z2ui5_cl_test_integration_test"}}` ). +* +* +* /ui2/cl_json=>deserialize( EXPORTING json = lv_response +* CHANGING data = lo_data ). +* +* +* UNASSIGN . +* DATA(lv_assign) = `PARAMS->S_VIEW->XML->*`. +* ASSIGN lo_data->(lv_assign) TO . +* = shift_left( ). +* IF (9) <> `fail( 'xml view - intital view wrong' ). +* ENDIF. +* +* ENDMETHOD. +* +* METHOD test_index_html. +* +* DATA(lv_index_html) = z2ui5_cl_fw_http_handler=>http_get( ). +* IF lv_index_html IS INITIAL. +* cl_abap_unit_assert=>fail( 'HTTP GET - index html initial' ). +* ENDIF. +* +* ENDMETHOD. +* +* +* METHOD test_id. +* DATA lo_data TYPE REF TO data. +* FIELD-SYMBOLS TYPE any. +* +* z2ui5_cl_test_integration_test=>sv_state = ``. +* DATA(lv_response) = z2ui5_cl_fw_http_handler=>http_post( +* `{ "OLOCATION" : { "SEARCH" : "app_start=z2ui5_cl_test_integration_test"}}` ). +* +* +* /ui2/cl_json=>deserialize( EXPORTING json = lv_response +* CHANGING data = lo_data ). +* +* +* UNASSIGN . +* DATA(lv_assign) = `ID->*`. +* ASSIGN lo_data->(lv_assign) TO . +* IF IS INITIAL. +* cl_abap_unit_assert=>fail( msg = 'id - initial value is initial' +* quit = 5 ). +* ENDIF. +* ENDMETHOD. +* +* METHOD test_bind_one_way. +* +* DATA(lo_test) = NEW z2ui5_cl_test_integration_test( ) ##NEEDED. +* DATA lo_data TYPE REF TO data. +* FIELD-SYMBOLS TYPE any. +* +* z2ui5_cl_test_integration_test=>sv_state = `TEST_ONE_WAY`. +* DATA(lv_response) = z2ui5_cl_fw_http_handler=>http_post( +* `{ "OLOCATION" : { "SEARCH" : "app_start=z2ui5_cl_test_integration_test"}}` ). +* +* +* +* /ui2/cl_json=>deserialize( EXPORTING json = lv_response +* CHANGING data = lo_data ). +* +* +* UNASSIGN . +* DATA(lv_assign) = `OVIEWMODEL->QUANTITY->*`. +* ASSIGN lo_data->(lv_assign) TO . +* IF <> `500`. +* cl_abap_unit_assert=>fail( msg = 'data binding - initial set EDIT wrong' +* quit = 5 ). +* ENDIF. +* ENDMETHOD. +* +* METHOD test_bind_two_way. +* DATA lo_data TYPE REF TO data. +* FIELD-SYMBOLS TYPE any. +* +* z2ui5_cl_test_integration_test=>sv_state = ``. +* DATA(lv_response) = z2ui5_cl_fw_http_handler=>http_post( +* `{ "OLOCATION" : { "SEARCH" : "app_start=z2ui5_cl_test_integration_test"}}` ). +* +* +* /ui2/cl_json=>deserialize( EXPORTING json = lv_response +* CHANGING data = lo_data ). +* +* +* UNASSIGN . +* DATA(lv_assign) = `OVIEWMODEL->EDIT->QUANTITY->*`. +* ASSIGN lo_data->(lv_assign) TO . +* IF <> `500`. +* cl_abap_unit_assert=>fail( msg = 'data binding - initial set EDIT wrong' +* quit = 5 ). +* ENDIF. +* ENDMETHOD. +* +* METHOD test_message_box. +* DATA lo_data TYPE REF TO data. +* FIELD-SYMBOLS TYPE any. +* +* z2ui5_cl_test_integration_test=>sv_state = `TEST_MESSAGE_BOX`. +* DATA(lv_response) = z2ui5_cl_fw_http_handler=>http_post( +* `{ "OLOCATION" : { "SEARCH" : "app_start=z2ui5_cl_test_integration_test"}}` ). +* +* +* /ui2/cl_json=>deserialize( EXPORTING json = lv_response +* CHANGING data = lo_data ). +* +* +* +* UNASSIGN . +* DATA(lv_assign) = `PARAMS->S_MSG_BOX->TEXT->*`. +* ASSIGN lo_data->(lv_assign) TO . +* IF <> `test message box`. +* cl_abap_unit_assert=>fail( msg = 'message box - text wrong' +* quit = 5 ). +* ENDIF. +* +* UNASSIGN . +* lv_assign = `PARAMS->S_MSG_BOX->TYPE->*`. +* ASSIGN lo_data->(lv_assign) TO . +* IF <> `information`. +* cl_abap_unit_assert=>fail( msg = 'message box - type wrong' +* quit = 5 ). +* ENDIF. +* ENDMETHOD. +* +* METHOD test_message_toast. +* DATA lo_data TYPE REF TO data. +* FIELD-SYMBOLS TYPE any. +* +* z2ui5_cl_test_integration_test=>sv_state = `TEST_MESSAGE_TOAST`. +* DATA(lv_response) = z2ui5_cl_fw_http_handler=>http_post( +* `{ "OLOCATION" : { "SEARCH" : "app_start=z2ui5_cl_test_integration_test"}}` ). +* +* +* /ui2/cl_json=>deserialize( EXPORTING json = lv_response +* CHANGING data = lo_data ). +* +* +* +* UNASSIGN . +* DATA(lv_assign) = `PARAMS->S_MSG_TOAST->TEXT->*`. +* ASSIGN lo_data->(lv_assign) TO . +* IF <> `test message toast`. +* cl_abap_unit_assert=>fail( msg = 'message toast - text wrong' +* quit = 5 ). +* ENDIF. +* +* ENDMETHOD. +* +* +* METHOD test_xml_popup. +* DATA lo_data TYPE REF TO data. +* FIELD-SYMBOLS TYPE any. +* +* z2ui5_cl_test_integration_test=>sv_state = `TEST_POPUP`. +* DATA(lv_response) = z2ui5_cl_fw_http_handler=>http_post( +* `{ "OLOCATION" : { "SEARCH" : "app_start=z2ui5_cl_test_integration_test"}}` ). +* +* +* /ui2/cl_json=>deserialize( EXPORTING json = lv_response +* CHANGING data = lo_data ). +* +* +* UNASSIGN . +* DATA(lv_assign) = `PARAMS->S_POPUP->XML->*`. +* ASSIGN lo_data->(lv_assign) TO . +* = shift_left( ). +* IF (9) <> `fail( msg = 'xml popup - intital popup wrong' +* quit = 5 ). +* ENDIF. +* ENDMETHOD. +* +* METHOD test_landing_page. +* +* +* ENDMETHOD. +* +* METHOD test_scroll_cursor. +* DATA lo_data TYPE REF TO data. +* +* z2ui5_cl_test_integration_test=>sv_state = `TEST_SCROLL_CURSOR`. +* DATA(lv_response) = z2ui5_cl_fw_http_handler=>http_post( +* `{ "OLOCATION" : { "SEARCH" : "app_start=z2ui5_cl_test_integration_test"}}` ). +* +* +* /ui2/cl_json=>deserialize( EXPORTING json = lv_response +* CHANGING data = lo_data ). +* +* ENDMETHOD. +* +* METHOD test_startup_path. +* DATA lo_data TYPE REF TO data. +* +* z2ui5_cl_test_integration_test=>sv_state = `TEST_NAVIGATE`. +* DATA(lv_response) = z2ui5_cl_fw_http_handler=>http_post( +* `{ "OLOCATION" : { "SEARCH" : "app_start=z2ui5_cl_test_integration_test"}}` ). +* +* +* /ui2/cl_json=>deserialize( EXPORTING json = lv_response +* CHANGING data = lo_data ). +* +* ENDMETHOD. +* +* METHOD test_navigate. +* DATA lo_data TYPE REF TO data. +* +* z2ui5_cl_test_integration_test=>sv_state = `TEST_NAVIGATE`. +* DATA(lv_response) = z2ui5_cl_fw_http_handler=>http_post( +* `{ "OLOCATION" : { "SEARCH" : "app_start=z2ui5_cl_test_integration_test"}}` ). +* +* +* /ui2/cl_json=>deserialize( EXPORTING json = lv_response +* CHANGING data = lo_data ). +* +* ENDMETHOD. +* +* +* METHOD test_app_dump. +* +* DATA lo_data TYPE REF TO data. +* FIELD-SYMBOLS TYPE any. +* +* z2ui5_cl_test_integration_test=>sv_state = `ERROR`. +* DATA(lv_response) = z2ui5_cl_fw_http_handler=>http_post( `{ "OLOCATION" : { "SEARCH" : "app_start=z2ui5_cl_test_integration_test"}}` ). +* +* +* /ui2/cl_json=>deserialize( +* EXPORTING +* json = lv_response +* CHANGING +* data = lo_data ). +* +* UNASSIGN . +* ASSIGN (`LO_DATA->PARAMS->S_VIEW->XML->*`) TO . +* cl_abap_unit_assert=>assert_not_initial( ). +* +* ENDMETHOD. +* +* +*ENDCLASS.