";
+ } else {
+ margin = (19 + level * 17);
+ returnVal = "
";
+
+ if(hasChildren) {
+ returnVal += "";
+ for(var i = 0; i < node.children.length; i++) {
+ var child = node.children[i];
+ returnVal += generateNode(child, level + 1);
+ }
+ returnVal += " ";
+ }
+ returnVal += " ";
+ return returnVal;
+ }
+})();
diff --git a/src/原型系统/plugins/sitemap/styles/images/back_keys.svg b/src/原型系统/plugins/sitemap/styles/images/back_keys.svg
new file mode 100644
index 0000000..205ef8b
--- /dev/null
+++ b/src/原型系统/plugins/sitemap/styles/images/back_keys.svg
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/src/原型系统/plugins/sitemap/styles/images/closed_item.svg b/src/原型系统/plugins/sitemap/styles/images/closed_item.svg
new file mode 100644
index 0000000..cc96bf2
--- /dev/null
+++ b/src/原型系统/plugins/sitemap/styles/images/closed_item.svg
@@ -0,0 +1,14 @@
+
+
+
+ open item copy
+ Created with Sketch.
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/原型系统/plugins/sitemap/styles/images/folder_closed_blue.svg b/src/原型系统/plugins/sitemap/styles/images/folder_closed_blue.svg
new file mode 100644
index 0000000..f1fc99b
--- /dev/null
+++ b/src/原型系统/plugins/sitemap/styles/images/folder_closed_blue.svg
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/src/原型系统/plugins/sitemap/styles/images/forward_keys.svg b/src/原型系统/plugins/sitemap/styles/images/forward_keys.svg
new file mode 100644
index 0000000..cb04793
--- /dev/null
+++ b/src/原型系统/plugins/sitemap/styles/images/forward_keys.svg
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+ .
+
+
+
diff --git a/src/原型系统/plugins/sitemap/styles/images/left_arrow.svg b/src/原型系统/plugins/sitemap/styles/images/left_arrow.svg
new file mode 100644
index 0000000..c1d72ba
--- /dev/null
+++ b/src/原型系统/plugins/sitemap/styles/images/left_arrow.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/src/原型系统/plugins/sitemap/styles/images/open_item.svg b/src/原型系统/plugins/sitemap/styles/images/open_item.svg
new file mode 100644
index 0000000..062b37c
--- /dev/null
+++ b/src/原型系统/plugins/sitemap/styles/images/open_item.svg
@@ -0,0 +1,12 @@
+
+
+
+ open item
+ Created with Sketch.
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/原型系统/plugins/sitemap/styles/images/page_lt_grey.svg b/src/原型系统/plugins/sitemap/styles/images/page_lt_grey.svg
new file mode 100644
index 0000000..15e33b0
--- /dev/null
+++ b/src/原型系统/plugins/sitemap/styles/images/page_lt_grey.svg
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/src/原型系统/plugins/sitemap/styles/images/right_arrow.svg b/src/原型系统/plugins/sitemap/styles/images/right_arrow.svg
new file mode 100644
index 0000000..f21915b
--- /dev/null
+++ b/src/原型系统/plugins/sitemap/styles/images/right_arrow.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/src/原型系统/plugins/sitemap/styles/images/search_off.svg b/src/原型系统/plugins/sitemap/styles/images/search_off.svg
new file mode 100644
index 0000000..55f40fe
--- /dev/null
+++ b/src/原型系统/plugins/sitemap/styles/images/search_off.svg
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/src/原型系统/plugins/sitemap/styles/images/search_on.svg b/src/原型系统/plugins/sitemap/styles/images/search_on.svg
new file mode 100644
index 0000000..c813852
--- /dev/null
+++ b/src/原型系统/plugins/sitemap/styles/images/search_on.svg
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/src/原型系统/plugins/sitemap/styles/images/sitemap_panel_off.svg b/src/原型系统/plugins/sitemap/styles/images/sitemap_panel_off.svg
new file mode 100644
index 0000000..93cec71
--- /dev/null
+++ b/src/原型系统/plugins/sitemap/styles/images/sitemap_panel_off.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/src/原型系统/plugins/sitemap/styles/images/sitemap_panel_on.svg b/src/原型系统/plugins/sitemap/styles/images/sitemap_panel_on.svg
new file mode 100644
index 0000000..701e8b0
--- /dev/null
+++ b/src/原型系统/plugins/sitemap/styles/images/sitemap_panel_on.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/src/原型系统/plugins/sitemap/styles/sitemap.css b/src/原型系统/plugins/sitemap/styles/sitemap.css
new file mode 100644
index 0000000..a52bf58
--- /dev/null
+++ b/src/原型系统/plugins/sitemap/styles/sitemap.css
@@ -0,0 +1,380 @@
+
+#sitemapHost {
+ display: flex;
+ flex-direction: column;
+ height: 100%;
+}
+
+#sitemapHostBtn a {
+ background: url('images/sitemap_panel_on.svg') no-repeat center center, linear-gradient(transparent, transparent);
+}
+
+#sitemapHostBtn a.selected, #sitemapHostBtn a.selected:hover {
+ background: url('images/sitemap_panel_off.svg') no-repeat center center, linear-gradient(transparent, transparent);
+}
+
+#sitemapHost .pageButtonHeader {
+ top: -27px;
+}
+
+#sitemapTreeContainer {
+ overflow: auto;
+ width: 100%;
+ flex: 1;
+ -webkit-overflow-scrolling: touch;
+}
+
+.mobileMode #sitemapTreeContainer {
+ margin-left: 5px;
+ overflow-x: hidden;
+}
+
+.sitemapTree {
+ margin: 0px 0px 10px 0px;
+ overflow:visible;
+}
+
+.sitemapTree ul {
+ list-style-type: none;
+ margin: 0px 0px 0px 0px;
+ padding-left: 0px;
+}
+
+ul.sitemapTree {
+ display: inline-block;
+ min-width: 100%;
+}
+
+.pageSwapInstructions {
+ width: 129px;
+ font-size: 12px;
+ text-align: center;
+ color: #8c8c8c;
+ margin: 0 auto;
+ padding: 12px 0px;
+ line-height: 20px;
+}
+
+.sitemapMinus, .sitemapPlus {
+ vertical-align:middle;
+ background-repeat: no-repeat;
+ margin-right: 3px;
+ width: 7px;
+ height: 8px;
+ object-fit: contain;
+ display:inline-block;
+}
+ .sitemapMinus {
+ margin-bottom: 0px;
+ background: url('images/open_item.svg') no-repeat center center, linear-gradient(transparent,transparent);
+ }
+ .sitemapPlus {
+ margin-bottom: 2px;
+ background: url('images/closed_item.svg') no-repeat center center, linear-gradient(transparent,transparent);
+ }
+
+.mobileMode .sitemapMinus, .mobileMode .sitemapPlus {
+ width: 10.5px;
+ height: 12px;
+ margin-right: 5px;
+ background-size: contain;
+}
+
+.sitemapPageLink {
+ margin-left: 0px;
+}
+
+.sitemapPageIcon {
+ margin: 0px 6px -3px 3px;
+ width: 16px;
+ height: 16px;
+ display: inline-block;
+ background: url('images/page_lt_grey.svg') no-repeat center center, linear-gradient(transparent,transparent);
+}
+
+.mobileMode .sitemapPageIcon {
+ margin-right: 7px;
+ background-size: contain;
+}
+
+.sitemapFolderIcon {
+ background: url('images/folder_closed_blue.svg') no-repeat center center, linear-gradient(transparent,transparent);
+}
+
+.mobileMode .sitemapFolderIcon {
+ width: 18px;
+ height: 18px;
+ margin-left: 1px;
+ background-position-y: 1px;
+ background-size: contain;
+}
+
+.sitemapFolderOpenIcon {
+ background: url('images/folder_open.png') no-repeat center center;
+ background: url('images/folder_open.svg') no-repeat center center, linear-gradient(transparent,transparent);
+}
+
+.sitemapPageName {
+ font-size: 14px;
+ line-height: 1.93;
+ color: #4a4a4a;
+}
+
+.sitemapPageName.mobileText {
+ line-height: 1.69;
+}
+
+.sitemapNode {
+ white-space:nowrap;
+}
+
+.sitemapPageLinkContainer {
+ cursor: pointer;
+ padding-right: 10px;
+}
+
+.mobileMode .sitemapPageLinkContainer {
+ margin-bottom: 13px;
+}
+
+.sitemapHighlight {
+ background-color: #e6e6e6;
+}
+
+.sitemapGreyedName
+{
+ color: #AAA;
+}
+
+.sitemapPluginNameHeader {
+ margin: 13px 9px 5px 9px;
+ font-size: 14px;
+ color: #444444;
+}
+
+.sitemapHeader {
+ padding-top: 7px;
+}
+
+.mobileMode .sitemapHeader {
+ padding-top: 0px;
+}
+
+.sitemapToolbar {
+ margin: 0px 3px 0px 5px;
+ display: flex;
+ align-items: center;
+ justify-content: flex-end;
+}
+
+.sitemapToolbarButton {
+ width: 19px;
+ height: 18px;
+ border: 1px solid transparent;
+ cursor: pointer;
+ flex: 0 0 auto;
+}
+
+.hashover .sitemapToolbarButton:hover {
+ border-radius: 3px;
+ background-color: #e6e6e6 !important;
+}
+
+.sitemapToolbarButton.sitemapToolbarButtonSelected, .sitemapToolbarButton.sitemapToolbarButtonSelected:hover{
+ background-color: inherit !important;
+}
+
+.leftArrow {
+ background: url('images/left_arrow.svg') no-repeat center center, linear-gradient(transparent,transparent);
+ margin-left: 11px;
+}
+
+.rightArrow {
+ background: url('images/right_arrow.svg') no-repeat center center, linear-gradient(transparent,transparent);
+ margin-left: 3px;
+ margin-right: 2px;
+}
+
+#searchIcon {
+ width: 10px;
+ height: 10px;
+ object-fit: contain;
+ background: url('images/search_on.svg') no-repeat center center, linear-gradient(transparent,transparent);
+ vertical-align: bottom;
+ padding: 5px 4px 5px 4px;
+ display: inline-block;
+}
+
+#searchIcon.sitemapToolbarButtonSelected {
+ padding: 5px 3px 5px 5px;
+ border-top-left-radius: 5px;
+ border-bottom-left-radius: 5px;
+ border-left: solid 1px #cccccc;
+ border-top: solid 1px #cccccc;
+ border-bottom: solid 1px #cccccc;
+ background: url('images/search_off.svg') no-repeat center center, linear-gradient(transparent,transparent);
+ background-color: #FFFFFF !important;
+}
+
+.backKeys {
+ width: 20px;
+ height: 21px;
+ object-fit: contain;
+ vertical-align: bottom;
+ margin: 2px;
+ display: inline-block;
+ background: url('images/back_keys.svg') no-repeat center center, linear-gradient(transparent,transparent);
+}
+
+.forwardKeys {
+ width: 20px;
+ height: 21px;
+ object-fit: contain;
+ vertical-align: bottom;
+ margin: 2px;
+ display: inline-block;
+ background: url('images/forward_keys.svg') no-repeat center center, linear-gradient(transparent,transparent);
+}
+
+#interfaceAdaptiveViewsListContainer {
+ position: absolute;
+ display: none;
+ width: 220px;
+ left: 155px;
+ padding: 6px 9px;
+ top: 36px;
+}
+
+#interfaceScaleListContainer {
+ padding: 7.5px 9px 12px 16px;
+ margin-top: 9px;
+ border-top: solid 1px #bdbcbc;
+ order: 10;
+}
+
+.adaptiveViewOption, .vpPresetOption, .vpScaleOption {
+ padding: 3px 0px 3px 0px;
+ color: #3B3B3B;
+ display: flex;
+}
+
+.projectOptionsScaleRow, .projectOptionsAdaptiveViewRow, .projectOptionsHotspotsRow {
+ border-top: solid 1px #c7c7c7;
+ display: flex;
+ padding: 13px 7px 13px 0px;
+}
+
+.adaptiveViewOption:hover, .vpScaleOption:hover, .vpPresetOption:hover, .projectOptionsAdaptiveViewRow:hover, .projectOptionsScaleRow:hover
+{
+ cursor: pointer;
+}
+
+.scaleRadioButton, .adapViewRadioButton {
+ border: solid 1px #8c8c8c;
+ display: inline-block;
+ position: relative;
+ width: 12px;
+ height: 12px;
+ border-radius: 48px;
+ margin-right: 12px;
+ top: 2px;
+ flex-shrink: 0;
+}
+
+.mobileMode .scaleRadioButton, .mobileMode .adapViewRadioButton {
+ width: 20px;
+ height: 20px;
+ border-radius: 60px;
+ margin-right: 22px;
+ margin-left: 22px;
+ top: 0px;
+ flex-shrink: 0;
+}
+
+.selectedRadioButton {
+ border: solid 1px #20aca9;
+}
+
+.selectedRadioButtonFill {
+ position: relative;
+ display: none;
+ background-color: #20aca9;
+ margin: auto;
+ width: 8px;
+ height: 8px;
+ border-radius: 30px;
+ top: 2px;
+}
+ .mobileMode .selectedRadioButtonFill {
+ width: 12px;
+ height: 12px;
+ border-radius: 48px;
+ top: 4px;
+ }
+
+#searchDiv {
+ display: flex;
+ margin-right: auto;
+ flex: 1;
+}
+
+#searchBox {
+ display: none;
+ width: 0%;
+ height: 22px;
+ padding-left: 5px;
+ border-radius: 0px 5px 5px 0px;
+ border-right: solid 1px #cccccc;
+ border-top: solid 1px #cccccc;
+ border-bottom: solid 1px #cccccc;
+ border-left: none;
+ -webkit-appearance: none;
+}
+
+#searchBox:focus {
+ outline-width: 0;
+}
+
+.searchBoxHint {
+ color: #8f949a;
+}
+
+#sitemapHost.popup #searchDiv{
+ display: none;
+}
+
+#sitemapHost.popup #sitemapHeader{
+ display: none;
+}
+
+#sitemapHost.popup #changePageInstructions{
+ display: none;
+}
+
+.mobileMode #sitemapHeader {
+ display: none;
+}
+
+
+
+/* Expo Sitemap
+******************************************************************************/
+
+.expoSitemapNode {
+ padding: 15px;
+ text-align: center;
+}
+
+.sitemapPageImg {
+ max-width: 90%;
+ max-height: 150px;
+}
+
+.popup .sitemapPageImg {
+ display: none;
+}
+
+.popup .expoSitemapNode {
+ padding: 0 0 0 10px;
+ text-align: left;
+}
\ No newline at end of file
diff --git a/src/原型系统/resources/Other.html b/src/原型系统/resources/Other.html
new file mode 100644
index 0000000..d0fa808
--- /dev/null
+++ b/src/原型系统/resources/Other.html
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+ Close
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/原型系统/resources/chrome/allow-access.png b/src/原型系统/resources/chrome/allow-access.png
new file mode 100644
index 0000000..eaa707f
Binary files /dev/null and b/src/原型系统/resources/chrome/allow-access.png differ
diff --git a/src/原型系统/resources/chrome/axure-chrome-extension.crx b/src/原型系统/resources/chrome/axure-chrome-extension.crx
new file mode 100644
index 0000000..fde7743
Binary files /dev/null and b/src/原型系统/resources/chrome/axure-chrome-extension.crx differ
diff --git a/src/原型系统/resources/chrome/axure_logo.png b/src/原型系统/resources/chrome/axure_logo.png
new file mode 100644
index 0000000..84a957b
Binary files /dev/null and b/src/原型系统/resources/chrome/axure_logo.png differ
diff --git a/src/原型系统/resources/chrome/chrome.html b/src/原型系统/resources/chrome/chrome.html
new file mode 100644
index 0000000..36306ab
--- /dev/null
+++ b/src/原型系统/resources/chrome/chrome.html
@@ -0,0 +1,186 @@
+
+
+
Install the Axure RP Chrome Extension
+
+
+
+
+
+
+
+
+
+
+ AXURE RP EXTENSION FOR CHROME
+
+ Google Chrome requires an extension to view locally stored projects. Alternatively,
+ upload your RP file to Axure Cloud or use a different
+ browser.
+
+ VIEW LOCAL PROJECTS IN CHROME
+
+
+ 1. Install Extension from Chrome Store
+
+
+
+
+ 2. Open "More Tools > Extensions"
+
+
+
+
+
+
+ 3. View Axure RP Extension Details
+
+
+
+
+ 4. Check "Allow access to file URLs"
+
+
+
+
+
+
+ 5. Click the button below
+
+
+
+
+
+ EXTENSION FAQ
+
+ What is a Chrome Extension? Extensions are downloadable
+ plug-ins for Google Chrome that modify the browser
+ and allow you additional capabilities.
+
+
+ Why do I need to install the extension? Google requires
+ this extension to be installed to allow the viewing of local files in
+ Chrome
+
+
+ Why does this extension require a high access level? This
+ extension requires a high access level to allow the viewing of the file://
+ protocol. Axure does not track or access any of your information.
+
+
+ WE'RE HERE TO HELP
+
+ Need help or have any questions? Contact our support team at
+ support@axure.com .
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/原型系统/resources/chrome/details.png b/src/原型系统/resources/chrome/details.png
new file mode 100644
index 0000000..260397f
Binary files /dev/null and b/src/原型系统/resources/chrome/details.png differ
diff --git a/src/原型系统/resources/chrome/extensions.png b/src/原型系统/resources/chrome/extensions.png
new file mode 100644
index 0000000..4b011c9
Binary files /dev/null and b/src/原型系统/resources/chrome/extensions.png differ
diff --git a/src/原型系统/resources/chrome/safari.html b/src/原型系统/resources/chrome/safari.html
new file mode 100644
index 0000000..824c8f5
--- /dev/null
+++ b/src/原型系统/resources/chrome/safari.html
@@ -0,0 +1,154 @@
+
+
+
Axure RP - Safari Local File Restrictions
+
+
+
+
+
+
+
+
+
+ SAFARI LOCAL FILE RESTRICTIONS
+
+ To view locally stored projects in Safari, you will need to "disable local file restrictions". Alternatively,
+ you can upload your RP file to Axure Cloud or publish the local files to a web server.
+
+ VIEW LOCAL PROJECTS IN SAFARI
+
+
+ 1. Open "Safari > Preferences > Advanced" from the top menu menu, and check the option to "Show Develop menu in menu bar"
+
+
+
+
+
+
+
+ 2. In the Develop menu that appears in the menu bar, click "Develop > Disable Local File Restrictions" to un-select the menu option
+
+
+
+
+
+
+ 3. Click the button below
+
+
+
+
+
+
+ We're Here to Help
+
+ Need help or have any questions? Drop us a line at
+ support@axure.com .
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/原型系统/resources/chrome/safari_advanced.png b/src/原型系统/resources/chrome/safari_advanced.png
new file mode 100644
index 0000000..9f81b2a
Binary files /dev/null and b/src/原型系统/resources/chrome/safari_advanced.png differ
diff --git a/src/原型系统/resources/chrome/safari_restrictions.png b/src/原型系统/resources/chrome/safari_restrictions.png
new file mode 100644
index 0000000..26ddf3f
Binary files /dev/null and b/src/原型系统/resources/chrome/safari_restrictions.png differ
diff --git a/src/原型系统/resources/chrome/splitter.gif b/src/原型系统/resources/chrome/splitter.gif
new file mode 100644
index 0000000..3f8bca9
Binary files /dev/null and b/src/原型系统/resources/chrome/splitter.gif differ
diff --git a/src/原型系统/resources/chrome/splitter.png b/src/原型系统/resources/chrome/splitter.png
new file mode 100644
index 0000000..8e354e7
Binary files /dev/null and b/src/原型系统/resources/chrome/splitter.png differ
diff --git a/src/原型系统/resources/css/axure_rp_page.css b/src/原型系统/resources/css/axure_rp_page.css
new file mode 100644
index 0000000..d4b188f
--- /dev/null
+++ b/src/原型系统/resources/css/axure_rp_page.css
@@ -0,0 +1,292 @@
+/* so the window resize fires within a frame in IE7 */
+html, body {
+ height: 100%;
+}
+
+.mobileFrameCursor div * {
+ cursor: inherit !important;
+}
+
+a {
+ color: inherit;
+}
+
+p {
+ margin: 0px;
+ text-rendering: optimizeLegibility;
+ font-feature-settings: "kern" 1;
+ -webkit-font-feature-settings: "kern";
+ -moz-font-feature-settings: "kern";
+ -moz-font-feature-settings: "kern=1";
+ font-kerning: normal;
+}
+
+ul {
+ margin:0px;
+}
+
+iframe {
+ background: #FFFFFF;
+}
+
+/* to match IE with C, FF */
+input {
+ padding: 1px 0px 1px 0px;
+ box-sizing: border-box;
+ -moz-box-sizing: border-box;
+}
+
+input[type=text]::-ms-clear {
+ width: 0;
+ height: 0;
+ display: none;
+}
+
+textarea {
+ margin: 0px;
+ box-sizing: border-box;
+ -moz-box-sizing: border-box;
+}
+
+.focused:focus, .selectedFocused:focus {
+ outline: none;
+}
+
+div.intcases {
+ font-family: arial;
+ font-size: 12px;
+ text-align:left;
+ border:1px solid #AAA;
+ background:#FFF none repeat scroll 0% 0%;
+ z-index:9999;
+ visibility:hidden;
+ position:absolute;
+ padding: 0px;
+ border-radius: 3px;
+ white-space: nowrap;
+}
+
+div.intcaselink {
+ cursor: pointer;
+ padding: 3px 8px 3px 8px;
+ margin: 5px;
+ background:#EEE none repeat scroll 0% 0%;
+ border:1px solid #AAA;
+ border-radius: 3px;
+}
+
+div.refpageimage {
+ position: absolute;
+ left: 0px;
+ top: 0px;
+ font-size: 0px;
+ width: 16px;
+ height: 16px;
+ cursor: pointer;
+ background-image: url(images/newwindow.gif);
+ background-repeat: no-repeat;
+}
+
+div.annnoteimage {
+ position: absolute;
+ left: 0px;
+ top: 0px;
+ font-size: 0px;
+ /*width: 16px;
+ height: 12px;*/
+ cursor: help;
+ /*background-image: url(images/note.gif);*/
+ /*background-repeat: no-repeat;*/
+ width: 13px;
+ height: 12px;
+ padding-top: 1px;
+ text-align: center;
+ background-color: #138CDD;
+ -moz-box-shadow: 1px 1px 3px #aaa;
+ -webkit-box-shadow: 1px 1px 3px #aaa;
+ box-shadow: 1px 1px 3px #aaa;
+}
+
+div.annnoteline {
+ display: inline-block;
+ width: 9px;
+ height: 1px;
+ border-bottom: 1px solid white;
+ margin-top: 1px;
+}
+
+div.annnotelabel {
+ /*position: absolute;
+ left: 0px;
+ top: 0px;*/
+ font-family: Helvetica,Arial;
+ white-space: nowrap;
+
+ padding-top: 1px;
+ background-color: #fff849;
+ font-size: 10px;
+ font-weight: bold;
+ line-height: 14px;
+ margin-right: 3px;
+ padding: 0px 4px;
+ color: #000;
+
+ -moz-box-shadow: 1px 1px 3px #aaa;
+ -webkit-box-shadow: 1px 1px 3px #aaa;
+ box-shadow: 1px 1px 3px #aaa;
+}
+
+div.annnote {
+ display: flex;
+ position: absolute;
+ cursor: help;
+ line-height: 14px;
+}
+
+.annotation {
+ font-size: 12px;
+ padding-left: 2px;
+ margin-bottom: 5px;
+}
+
+.annotationName {
+ /*font-size: 13px;
+ font-weight: bold;
+ margin-bottom: 3px;
+ white-space: nowrap;*/
+
+ font-family: 'Trebuchet MS';
+ font-size: 14px;
+ font-weight: bold;
+ margin-bottom: 5px;
+ white-space: nowrap;
+}
+
+.annotationValue {
+ font-family: Arial, Helvetica, Sans-Serif;
+ font-size: 12px;
+ color: #4a4a4a;
+ line-height: 21px;
+ margin-bottom: 20px;
+}
+
+.noteLink {
+ text-decoration: inherit;
+ color: inherit;
+}
+
+.noteLink:hover {
+ background-color: white;
+}
+
+/* this is a fix for the issue where dialogs jump around and takes the text-align from the body */
+.dialogFix {
+ position:absolute;
+ text-align:left;
+ border: 1px solid #8f949a;
+}
+
+
+@keyframes pulsate {
+ from {
+ box-shadow: 0 0 10px #15d6ba;
+ }
+ to {
+ box-shadow: 0 0 20px #15d6ba;
+ }
+}
+
+@-webkit-keyframes pulsate {
+ from {
+ -webkit-box-shadow: 0 0 10px #15d6ba;
+ box-shadow: 0 0 10px #15d6ba;
+ }
+ to {
+ -webkit-box-shadow: 0 0 20px #15d6ba;
+ box-shadow: 0 0 20px #15d6ba;
+ }
+}
+
+@-moz-keyframes pulsate {
+ from {
+ -moz-box-shadow: 0 0 10px #15d6ba;
+ box-shadow: 0 0 10px #15d6ba;
+ }
+ to {
+ -moz-box-shadow: 0 0 20px #15d6ba;
+ box-shadow: 0 0 20px #15d6ba;
+ }
+}
+
+.legacyPulsateBorder {
+ /*border: 5px solid #15d6ba;
+ margin: -5px;*/
+ -moz-box-shadow: 0 0 10px 3px #15d6ba;
+ box-shadow: 0 0 10px 3px #15d6ba;
+}
+
+.pulsateBorder {
+ animation-name: pulsate;
+ animation-timing-function: ease-in-out;
+ animation-duration: 0.9s;
+ animation-iteration-count: infinite;
+ animation-direction: alternate;
+
+ -webkit-animation-name: pulsate;
+ -webkit-animation-timing-function: ease-in-out;
+ -webkit-animation-duration: 0.9s;
+ -webkit-animation-iteration-count: infinite;
+ -webkit-animation-direction: alternate;
+
+ -moz-animation-name: pulsate;
+ -moz-animation-timing-function: ease-in-out;
+ -moz-animation-duration: 0.9s;
+ -moz-animation-iteration-count: infinite;
+ -moz-animation-direction: alternate;
+}
+
+.ax_default_hidden, .ax_default_unplaced{
+ display: none;
+ visibility: hidden;
+}
+
+.widgetNoteSelected {
+ -moz-box-shadow: 0 0 10px 3px #138CDD;
+ box-shadow: 0 0 10px 3px #138CDD;
+ /*-moz-box-shadow: 0 0 20px #3915d6;
+ box-shadow: 0 0 20px #3915d6;*/
+ /*border: 3px solid #3915d6;*/
+ /*margin: -3px;*/
+}
+
+
+.singleImg {
+ display: none;
+ visibility: hidden;
+}
+
+#ios-safari {
+ overflow: auto;
+ -webkit-overflow-scrolling: touch;
+}
+
+#ios-safari-html {
+ display: block;
+ overflow: auto;
+ -webkit-overflow-scrolling: touch;
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+}
+
+#ios-safari-fixed {
+ position: absolute;
+ pointer-events: none;
+ width: initial;
+}
+
+#ios-safari-fixed div {
+ pointer-events: auto;
+}
\ No newline at end of file
diff --git a/src/原型系统/resources/css/default.css b/src/原型系统/resources/css/default.css
new file mode 100644
index 0000000..98d7f74
--- /dev/null
+++ b/src/原型系统/resources/css/default.css
@@ -0,0 +1,1043 @@
+body {
+ font-family: 'Source Sans Pro', 'Trebuchet MS', Arial;
+ font-size: 14px;
+ color: #2c2c2c;
+ -webkit-font-smoothing: antialiased;
+ text-rendering: optimizeLegibility;
+ -webkit-font-feature-settings: "kern";
+ -moz-font-feature-settings: "kern";
+ -moz-font-feature-settings: "kern=1";
+ font-feature-settings: "kern" 1;
+ font-kerning: normal;
+ overflow: hidden;
+}
+
+a {
+ cursor: pointer;
+}
+
+input[type="radio"], input[type="checkbox"] {
+ margin: 0px 9px 0px 0px;
+ vertical-align: bottom;
+}
+
+input {
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+}
+
+input[type=text]::-ms-clear {
+ width: 0;
+ height: 0;
+ display: none;
+}
+
+#outerContainer {
+ position: absolute;
+ width:1000px;
+ height:1500px;
+ overflow: hidden;
+ display: flex;
+}
+
+#mobileControlFrameContainer {
+ position: absolute;
+ width: 100%;
+ pointer-events: none;
+}
+
+.splitbar {
+ display: none;
+ position: absolute;
+ top: 0px;
+ width: 3px;
+ height: 100%;
+ cursor: ew-resize;
+ z-index: 5;
+ user-select: none;
+}
+
+.splitbar:hover, .splitbar.active {
+ background: #cccccc;
+}
+
+#lsplitbar {
+ border-right: 1px solid #cccccc;
+}
+
+#rsplitbar {
+ border-left: 1px solid #cccccc;
+}
+
+#mainPanel {
+ background-color: #d8d8d8;
+ opacity: 0;
+ flex: 1;
+}
+
+#clippingBounds {
+ width: 100%;
+ overflow: hidden;
+ pointer-events: none;
+ position: absolute;
+ z-index: 1;
+}
+
+#clippingBounds div {
+ pointer-events: auto;
+}
+
+#clippingBoundsScrollContainer {
+ position: absolute;
+ pointer-events: none;
+}
+
+#browserOutOfDateNotification {
+ width: 100%;
+ height: 289px;
+ background-color: #e36154;
+ padding-top: 40px;
+ color: #FFFFFF;
+}
+ .mobileMode #browserOutOfDateNotification {
+ padding-top: 15px;
+ }
+
+#supportedBrowsersListContainer {
+ border-radius: 5px;
+ line-height: 1.64;
+ background-color: #c3463a;
+ padding-top: 4px;
+ width: 255px;
+ margin: auto;
+}
+
+.browserName {
+ display: inline-block;
+ width: 55%;
+ font-weight: bold;
+ margin-left: 18px;
+}
+
+.browserSupportedVersion {
+ display: inline-block;
+ font-style: italic;
+}
+
+#browserOutOfDateNotificationButtons {
+ display: flex;
+ justify-content: flex-end;
+ margin-top: 28px;
+}
+ .mobileMode #browserOutOfDateNotificationButtons {
+ margin-top: 8px;
+ }
+
+#updateBrowserButton {
+ display: inline-block;
+ width: 330px;
+ height: 35px;
+ margin-left: auto;
+ line-height: 35px;
+ text-decoration: none;
+ text-align: center;
+ border-radius: 9px;
+ border: solid 1px #FFFFFF;
+ color: #FFFFFF;
+}
+
+#continueToPrototypeButton {
+ display: inline-block;
+ text-align: center;
+ line-height: 37px;
+ text-decoration: underline;
+}
+
+#topPanel {
+ z-index: 1;
+ height: 36px;
+ background-color: #f2f2f2;
+ border-bottom: 1px solid #cccccc;
+ user-select: none;
+}
+
+.leftPanel, .rightPanel, .mobileOnlyPanel {
+ position: relative;
+ background-color: #f2f2f2;
+ overflow: hidden;
+ width: 0px;
+ flex-shrink: 0;
+}
+
+
+.popup, .leftPanel.popup {
+ position: absolute;
+ z-index: 20000;
+ display: none;
+ background-color: #f2f2f2;
+ border: solid 1px #bdbcbc;
+ position: absolute;
+ box-shadow: 0 1px 2px 0 rgba(87, 87, 87, 0.5);
+}
+
+.leftPanel.popup .sitemapHeader, .leftPanel.popup #searchDiv {
+ display: none;
+}
+
+#clipFrameScroll {
+}
+
+.splitterMask {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ overflow: hidden;
+ background-image: url(../images/transparent.gif);
+ z-index: 10000;
+ -moz-user-select: none;
+ -webkit-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+}
+
+#maximizePanelContainer {
+ font-size: 4px;
+ overflow: hidden;
+ z-index: 1000;
+ display: none;
+}
+
+#maximizePanel {
+ background-color: #f2f2f2;
+ cursor: pointer;
+}
+
+#maximizePanelContainer, #maximizePanelOver, #maximizePanel {
+ position:absolute;
+ left: 0px;
+ top: 0px;
+ width: 28px;
+ height: 36px;
+}
+
+#interfaceControlFrameMinimizeContainer {
+ font-size: 2px; /*for IE*/
+ text-align: right;
+ z-index: 100;
+ height: 36px;
+ width: 28px;
+ border-right: solid 1px #cbcbcb;
+}
+#interfaceControlFrameMinimizeContainer a {
+ display: inline-block;
+ width: 28px;
+ height: 100%;
+ font-size: 2px;
+ text-decoration: none;
+}
+
+#interfaceControlFrame {
+ height: 100%;
+ display: flex;
+ opacity: 0;
+}
+
+#interfaceControlFrameCloseContainer {
+ display: none;
+ font-size: 9px;
+ font-weight: bold;
+ letter-spacing: 1px;
+ z-index: 100;
+ width: 55px;
+ background-color: #62666b;
+ text-align: center;
+}
+#interfaceControlFrameCloseContainer a {
+ display: inline-block;
+ width: 55px;
+ color: #ffffff;
+ padding: 5px 0px;
+}
+#inspectControlFrameHeader li {
+ float: left;
+ display: block;
+ width: 42px;
+ height: 36px;
+ padding: 4px 5px 4px 5px;
+ box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ -webkit-box-sizing: border-box;
+}
+
+#inspectControlFrameHeader li a {
+ height: 100%;
+ width: 32px;
+ display: block;
+ text-align: center;
+ outline: none;
+ text-decoration: none;
+ white-space: nowrap;
+ background-color: transparent;
+ box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ -webkit-box-sizing: border-box;
+}
+
+.hashover #inspectControlFrameHeader li a:hover {
+ border-radius: 3px;
+ background-color: #e6e6e6;
+}
+
+/*#inspectControlFrameHeader li a.selected, #inspectControlFrameHeader li a.selected:hover {
+ background-color: inherit;
+}*/
+
+#inspectControlFrameHeaderContainer {
+ overflow: visible;
+}
+
+#inspectControlFrameHeader {
+ position: relative;
+ list-style: none;
+ z-index: 50;
+ letter-spacing: 1px;
+ display: flex;
+}
+
+#projectControlFrameHeaderContainer {
+ overflow: visible;
+}
+
+#projectControlFrameHeader {
+ position: relative;
+ list-style: none;
+ font-size: 8px;
+ z-index: 50;
+ font-weight: bold;
+ letter-spacing: 1px;
+}
+
+#projectControlFrameHeader li {
+ float: left;
+ display: block;
+ width: 28px;
+ height: 28px;
+ box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ -webkit-box-sizing: border-box;
+}
+
+#projectControlFrameHeader li a {
+ display: block;
+ height: 100%;
+ width: 32px;
+ outline: none;
+ margin: auto;
+ text-decoration: none;
+ color: #ffffff;
+ white-space: nowrap;
+ box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ -webkit-box-sizing: border-box;
+}
+
+.hashover #projectControlFrameHeader li a:hover {
+ border-radius: 3px;
+ background-color: #e6e6e6;
+}
+
+/*#projectControlFrameHeader li a.selected, #projectControlFrameHeader li a.selected:hover {
+ background-color: inherit;
+}*/
+
+#handoffControlFrameHeaderContainer {
+ display: none;
+}
+
+#handoffControlFrameHeader li {
+ float: left;
+ display: block;
+ width: 44px;
+ height: 36px;
+ margin: 0px 3.5px 0px 3.5px;
+ padding: 4px 6px 4px 6px;
+ box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ -webkit-box-sizing: border-box;
+}
+
+#handoffControlFrameHeader li.selected {
+ padding: 0px;
+ border-bottom: 2px solid #008dcb;
+}
+
+#handoffControlFrameHeader li a {
+ float: left;
+ height: 100%;
+ width: 32px;
+ display: block;
+ box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ -webkit-box-sizing: border-box;
+}
+
+.hashover #handoffControlFrameHeader li a:hover {
+ border-radius: 3px;
+ background-color: #e6e6e6;
+}
+
+#handoffControlFrameHeader li a.selected {
+ width: 100%;
+ /*background-color: inherit;*/
+}
+
+#publishContainer {
+ display: none;
+ margin: 6px 20.5px 5px;
+ width: 150px;
+ height: 25px;
+ border-radius: 10px;
+ background-color: #008dcb;
+}
+
+
+#publishContainer.preview {
+ display: block;
+}
+
+#overflowBtn {
+ order: 5;
+}
+
+#overflowMenuButton {
+ background: url('../images/overflow-icon.svg') no-repeat center center, linear-gradient(transparent,transparent);
+}
+#overflowMenuButton.selected {
+ background: url('../images/overflow_icon_off.svg') no-repeat center center, linear-gradient(transparent,transparent);
+}
+
+.overflowOptionCheckbox, #projectOptionsHotspotsCheckbox {
+ position: relative;
+ border: solid 1px #8c8c8c;
+ display: inline-block;
+}
+ .overflowOptionCheckbox {
+ width: 10px;
+ height: 10px;
+ margin-right: 14px;
+ top: 1px;
+ }
+ #projectOptionsHotspotsCheckbox {
+ width: 16px;
+ height: 16px;
+ margin-right: 25px;
+ margin-left: 21px;
+ top: 2.5px;
+ }
+
+.overflowOptionCheckbox.selected, #projectOptionsHotspotsCheckbox.selected {
+ background: url('../images/overflow_checkmark.svg') no-repeat center center, linear-gradient(transparent,transparent);
+ background-color: #20bba6;
+ border: solid 1px #20bba6;
+ background-size: contain;
+}
+
+#overflowMenuContainer {
+ display: none;
+ flex-direction: column;
+ top: 36px;
+ right: 80px;
+ width: 171px;
+ border-radius: 2px;
+}
+
+#overflowMenuContainer.popup {
+ display: flex;
+}
+
+.showOption {
+ font-size: 14px;
+ padding: 9px 0px 0px 15px;
+ color: #3B3B3B;
+}
+
+.showOption:hover {
+ cursor: pointer;
+}
+
+#signInButton {
+ padding: 0px 20px 0px 20px;
+ width: 50.8px;
+ height: 16px;
+ font-size: 12px;
+ text-align: center;
+ line-height: 22px;
+}
+
+#accountLoginContainer {
+ display: none;
+ right: 220px;
+}
+
+.accountOption {
+ font-size: 12px;
+ padding: 7px;
+ line-height: 1.83;
+}
+
+/* temporary sign in css (borrowed from feedback9.css*/
+.feedbackGreenBtn_Player {
+ background-color: #74BC68;
+ border-radius: 2.5px;
+ box-shadow: inset 0 -1px 0 0 rgba(137, 137, 137, 0.58);
+ color: #FFFFFF;
+ cursor: pointer;
+ font-size: 12px;
+ height: 25px;
+ line-height: 25px;
+}
+
+ .feedbackGreenBtn_Player:hover {
+ background-color: #58964E;
+ }
+/* Axure Commenter Login w/out pin */
+.axureLoginBubble_Player {
+ background-color: #F2F2F2 !important;
+}
+
+.axureLoginBubbleContainer_Player {
+ padding: 5px;
+}
+
+ .axureLoginBubbleContainer_Player input {
+ width: 100%;
+ padding: 0 5px;
+ margin-bottom: 10px;
+ height: 30px;
+ font-size: 14px;
+ }
+
+ .axureLoginBubbleContainer_Player span {
+ margin: 0;
+ }
+
+div.axClearMsgBubble_Player {
+ padding: 10px;
+ max-width: 300px;
+ text-align: center;
+}
+
+ div.axClearMsgBubble_Player span {
+ margin: 2px;
+ white-space: pre-wrap;
+ white-space: -moz-pre-wrap; /* Firefox */
+ white-space: -pre-wrap; /* Opera <7 */
+ white-space: -o-pre-wrap; /* Opera 7 */
+ word-wrap: break-word; /* IE */
+ }
+
+
+#publishButton {
+ display: block;
+ width: 95px;
+ margin: auto;
+ font-size: 14px;
+ line-height: 26px;
+ color: #ffffff;
+}
+
+.maximizeCaret {
+ width: 5px;
+ height: 5px;
+ object-fit: contain;
+ border-right: solid 1.5px #525252;
+ border-top: solid 1.5px #525252;
+ margin: auto;
+}
+.caret {
+ width: 9px;
+ height: 7px;
+ background: url('../images/caret_down.svg') no-repeat center center, linear-gradient(transparent,transparent);
+}
+.selected .caret {
+ background: url('../images/caret_down_off.svg') no-repeat center center, linear-gradient(transparent,transparent);
+}
+.upCaret {
+ transform: rotate(-45deg);
+}
+.leftCaret {
+ transform: rotate(-135deg);
+}
+.downCaret {
+ transform: rotate(-225deg);
+}
+.rightCaret {
+ transform: rotate(-315deg);
+}
+
+#pageSelectDropdown, #adaptiveViewsDropdown {
+ display: inline-block;
+ margin-left: 8px;
+}
+
+.minimizeIcon, .maximizeIcon {
+ transition: .25s linear;
+ position: absolute;
+ height: 36px;
+ width: 28px;
+}
+
+#minimizeX {
+ background: url('../images/close_x_minimize.svg') no-repeat center center, linear-gradient(transparent,transparent);
+}
+
+#minimizeArrow {
+ opacity: 0;
+ transform: rotate(270deg);
+ background: url('../images/caret_down.svg') no-repeat center center, linear-gradient(transparent,transparent);
+}
+
+#maximizeButton {
+ transform: rotate(-270deg);
+ background: url('../images/caret_down.svg') no-repeat center center, linear-gradient(transparent,transparent);
+}
+
+.collapseHovered #minimizeX {
+ transition: .25s linear;
+ opacity: 0;
+ transform: rotate(-90deg);
+}
+
+.collapseHovered #minimizeArrow {
+ transition: .25s linear;
+ opacity: 1;
+ transform: rotate(90deg);
+}
+
+#maximizeButton.rotated {
+ transition: .20s linear;
+ transform: rotate(-90deg);
+}
+
+.expandHovered #minimizeX {
+ opacity: 0;
+}
+
+.expandHovered #minimizeArrow {
+ opacity: 1;
+}
+
+#separatorContainer {
+ display: none;
+ line-height: 24px;
+ height: 36px;
+}
+
+#separatorContainer.hasLeft {
+ display: block;
+}
+
+.separator {
+ display: block;
+ width: 0px;
+ height: 100%;
+ border: solid 0.5px #c4c4c4;
+}
+
+#interfacePageNameContainer {
+ float: left;
+ cursor: pointer;
+}
+
+#sitemapControlFrameContainer{
+ display: flex;
+ margin: 4px 6px;
+}
+
+.hashover #sitemapControlFrameContainer:hover {
+ border-radius: 3px;
+ background-color: #e6e6e6;
+}
+
+/*.hashover #sitemapControlFrameContainer.selected:hover {
+ background-color: inherit;
+}*/
+
+#interfaceOverflowMenuContainer {
+ position: absolute;
+ display: none;
+ width: 220px;
+ background-color: #f2f2f2;
+ right: 240px;
+}
+
+.pageNameHeader {
+ float: left;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ max-width: 175px;
+ margin-left: 10px;
+ margin-right: 6px;
+}
+
+#interfaceAdaptiveViewsContainer {
+ display: none;
+ margin: 4px 0px 4px 30.5px;
+ padding: 0px 6px;
+ cursor: pointer;
+}
+#interfaceAdaptiveViewsContainer:hover {
+ border-radius: 3px;
+ background-color: #e6e6e6;
+}
+
+.adaptiveViewHeader {
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+
+#interfaceAdaptiveViewsButton {
+ float: left;
+ max-width: 145px;
+}
+
+#interfaceAdaptiveViewsIconButton {
+ display: none;
+ float:left;
+ width: 16px;
+ margin-right: 6px;
+ background: url('../images/views-icon.svg') no-repeat center center, linear-gradient(transparent,transparent);
+}
+
+#interfaceScaleContainer {
+ line-height: 36px;
+ padding: 0px 10px;
+ cursor: pointer;
+}
+
+.scaleHeader {
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+
+#overflowMadeWith {
+ line-height: 36px;
+ margin: 0px 12px;
+}
+
+#axureLogo {
+ display: inline-block;
+ width: 56px;
+ height: 36px;
+ padding-top: 1px;
+ background: url('../images/axure9_logo.svg') no-repeat center center, linear-gradient(transparent,transparent);
+}
+
+#overflowMenuContainer > #overflowMadeWith {
+ line-height: 24px;
+ border-top: 1px solid #ccc;
+ margin-top: 7px;
+ padding-top: 7px;
+}
+
+#interfaceControlFrameContainer {
+ overflow: hidden;
+ height: 36px;
+ display: flex;
+}
+
+#interfaceControlFrameLeft {
+ flex: 1;
+ display: flex;
+ font-size: 14px;
+ line-height: 29px;
+ color: #3b3b3b;
+}
+
+#interfaceControlFrameRight {
+ flex: 1;
+ display: flex;
+ justify-content: flex-end;
+}
+
+#interfaceControlFrameLogoContainer {
+ overflow: hidden;
+ margin-left: auto;
+ margin-right: auto;
+ height: 100%;
+ display: flex;
+}
+
+#interfaceControlFrameLogoCaptionContainer {
+ text-align: center;
+ margin: 5px 10px 0px 10px;
+ font-size: 14px;
+ color: #4a4a4a;
+ font-weight: bold;
+ line-height: 30px;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+
+#previewNotice {
+ font-size: 14px;
+ line-height: 36px;
+ display: none;
+}
+
+#logoImage {
+ margin: 12px;
+ max-width: 150px;
+ max-height: 12px;
+}
+
+.emptyStateContainer {
+ text-align: center;
+ padding: 0px 10px;
+ margin-top: 32px
+}
+
+.emptyStateTitle {
+ margin: 0px 0px 9px 0px;
+ font-weight: bold;
+}
+
+.emptyStateContent {
+ line-height: 22px;
+}
+
+.dottedDivider {
+ height: 2px;
+ margin: 15px 0px 15px 0px;
+ background: url('../images/divider.png') no-repeat center center;
+ background: url('../images/divider.svg') no-repeat center center, linear-gradient(transparent,transparent);
+}
+
+.mobileMode .dottedDivider {
+ display: none;
+}
+
+.nondottedDivider {
+ height: 2px;
+ margin: 9px 0px 9px 0px;
+}
+
+.lineDivider {
+ height: 2px;
+ margin: 10px 12px 20px 12px;
+ border-bottom: solid 1px #e7e7e7;
+}
+
+.pluginNameHeader {
+ font-size: 14px;
+ font-weight: bold;
+ color: #6d6d6d;
+}
+
+.mobileMode .pluginNameHeader {
+ margin: 14px 12px 13px 12px;
+ font-size: 18px;
+ color: #6d6d6d;
+}
+
+#projectOptionsHost {
+ display: flex;
+ flex-direction: column;
+}
+
+#projectOptionsScrollContainer {
+ overflow: auto;
+ width: 100%;
+ -webkit-overflow-scrolling: touch;
+ flex: 1;
+}
+
+div.mobileSubHeader {
+ font-size: 18px;
+ font-weight: bold;
+ color: #4a4a4a;
+ margin: 0px 12px 11px 15px;
+}
+
+div.mobileText, span.mobileText {
+ font-size: 16px;
+ color: #4a4a4a;
+}
+
+.nativeMenuText {
+ height: 20px;
+ font-size: 14px;
+ text-align: center;
+ color: #ffffff;
+ margin-top: 6px;
+ margin-bottom: 13px;
+ text-decoration: none;
+}
+
+#refreshText, #exitText {
+ margin-top: 6px;
+}
+
+#returnText {
+ margin-top: 7px;
+}
+
+#refreshIcon {
+ height: 20px;
+ object-fit: contain;
+ background: url('../images/refresh.svg') no-repeat center center, linear-gradient(transparent,transparent);
+ margin-top: 14px;
+}
+
+#exitIcon {
+ height: 19px;
+ object-fit: contain;
+ background: url('../images/exit.svg') no-repeat center center, linear-gradient(transparent,transparent);
+ margin-top: 14px;
+}
+
+#returnIcon {
+ height: 46px;
+ object-fit: contain;
+ background: url('../images/return.svg') no-repeat center center, linear-gradient(transparent,transparent);
+}
+
+
+.nativePrototypeButton {
+ width:50%;
+ margin-left:auto;
+ margin-right:auto;
+}
+
+.circleBackground {
+ border-radius: 50%;
+ behavior: url(PIE.htc);
+ margin: auto;
+ box-shadow: 3px 3px 3px 0 rgba(55, 55, 55, 0.5);
+}
+
+#returnBackground {
+ width: 46px;
+ height: 46px;
+ background-color: #ffffff;
+}
+
+#closeBackground {
+ width: 61px;
+ height: 61px;
+ background-color: #f2f2f2;
+}
+
+.closeIconSlash {
+ width: 35px;
+ height: 5px;
+ background-color: #9b9b9b;
+ position: relative;
+ margin: auto;
+}
+#forwardSlash{
+ top: 28px;
+ transform: rotate(-45deg);
+}
+#backwardSlash{
+ transform: rotate(90deg);
+}
+
+.mobilePrototypeControlFrame {
+ position: absolute;
+ display: none;
+ width: 100%;
+ min-width: 310px;
+ bottom: 0px;
+ z-index: 2;
+ pointer-events: auto;
+}
+
+#nativeMenuBlueBackground {
+ height: 72px;
+ width: 100%;
+ background-color: #008fe0;
+}
+
+#mHideSidebar {
+ position: absolute;
+ width: 10000px;
+ height: 100%;
+ background-color: rgba(0, 0, 0, 0.5);
+ top: 0px;
+ z-index: 2;
+ display: none;
+ left: -60px;
+}
+
+/*@media (max-width: 419px) {*/
+ .mobileMode #topPanel {
+ display: none;
+ }
+
+ .mobileMode #mainPanel {
+ -webkit-overflow-scrolling: touch;
+ }
+
+ .mobileMode .leftPanel, .mobileMode .rightPanel, .mobileMode .mobileOnlyPanel {
+ box-shadow: 0 5.5px 5px 0 rgba(0, 0, 0, 0.24), 0 9px 18px 0 rgba(0, 0, 0, 0.18);
+ top: 45px;
+ left: 100px;
+ }
+
+ .mobileMode .leftPanel, .mobileMode .rightPanel, .mobileMode .mobileOnlyPanel {
+ float: left;
+ }
+
+ .mobileMode .rightPanel {
+ margin-left: 13px;
+ }
+
+ .mobileMode #maximizePanelContainer {
+ display: none;
+ }
+/*}*/
+
+@media (max-width: 850px) {
+ #overflowMenuContainer {
+ right: 0px;
+ }
+
+ #overflowMadeWith, #publishContainer.preview, #separatorContainer, #separatorContainer.hasLeft {
+ display: none;
+ }
+
+ #interfaceControlFrameLogoCaptionContainer {
+ display: none;
+ }
+
+ #interfaceControlFrameContainer {
+ justify-content: flex-end;
+ }
+
+ #interfaceAdaptiveViewsButton {
+ display: none;
+ }
+
+ #interfaceAdaptiveViewsIconButton {
+ display: block;
+ }
+
+ #interfaceAdaptiveViewsContainer {
+ padding-left: 8px;
+ }
+}
+
+@media (max-width: 700px) {
+ #interfacePageNameContainer {
+ display: none;
+ }
+}
+
diff --git a/src/原型系统/resources/css/images/images.html b/src/原型系统/resources/css/images/images.html
new file mode 100644
index 0000000..335d9c9
--- /dev/null
+++ b/src/原型系统/resources/css/images/images.html
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/原型系统/resources/css/images/newwindow.gif b/src/原型系统/resources/css/images/newwindow.gif
new file mode 100644
index 0000000..7b14cb0
Binary files /dev/null and b/src/原型系统/resources/css/images/newwindow.gif differ
diff --git a/src/原型系统/resources/css/images/note.gif b/src/原型系统/resources/css/images/note.gif
new file mode 100644
index 0000000..a8c2762
Binary files /dev/null and b/src/原型系统/resources/css/images/note.gif differ
diff --git a/src/原型系统/resources/css/images/touch.cur b/src/原型系统/resources/css/images/touch.cur
new file mode 100644
index 0000000..01355e8
Binary files /dev/null and b/src/原型系统/resources/css/images/touch.cur differ
diff --git a/src/原型系统/resources/css/images/touch.svg b/src/原型系统/resources/css/images/touch.svg
new file mode 100644
index 0000000..9903c7f
--- /dev/null
+++ b/src/原型系统/resources/css/images/touch.svg
@@ -0,0 +1,32 @@
+
+
+
+ touch_update
+ Created with Sketch.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/原型系统/resources/css/images/ui-bg_flat_0_aaaaaa_40x100.png b/src/原型系统/resources/css/images/ui-bg_flat_0_aaaaaa_40x100.png
new file mode 100644
index 0000000..5b5dab2
Binary files /dev/null and b/src/原型系统/resources/css/images/ui-bg_flat_0_aaaaaa_40x100.png differ
diff --git a/src/原型系统/resources/css/images/ui-bg_glass_55_fbf9ee_1x400.png b/src/原型系统/resources/css/images/ui-bg_glass_55_fbf9ee_1x400.png
new file mode 100644
index 0000000..ad3d634
Binary files /dev/null and b/src/原型系统/resources/css/images/ui-bg_glass_55_fbf9ee_1x400.png differ
diff --git a/src/原型系统/resources/css/images/ui-bg_glass_65_ffffff_1x400.png b/src/原型系统/resources/css/images/ui-bg_glass_65_ffffff_1x400.png
new file mode 100644
index 0000000..42ccba2
Binary files /dev/null and b/src/原型系统/resources/css/images/ui-bg_glass_65_ffffff_1x400.png differ
diff --git a/src/原型系统/resources/css/images/ui-bg_glass_75_dadada_1x400.png b/src/原型系统/resources/css/images/ui-bg_glass_75_dadada_1x400.png
new file mode 100644
index 0000000..5a46b47
Binary files /dev/null and b/src/原型系统/resources/css/images/ui-bg_glass_75_dadada_1x400.png differ
diff --git a/src/原型系统/resources/css/images/ui-bg_glass_75_e6e6e6_1x400.png b/src/原型系统/resources/css/images/ui-bg_glass_75_e6e6e6_1x400.png
new file mode 100644
index 0000000..86c2baa
Binary files /dev/null and b/src/原型系统/resources/css/images/ui-bg_glass_75_e6e6e6_1x400.png differ
diff --git a/src/原型系统/resources/css/images/ui-bg_glass_75_ffffff_1x400.png b/src/原型系统/resources/css/images/ui-bg_glass_75_ffffff_1x400.png
new file mode 100644
index 0000000..e65ca12
Binary files /dev/null and b/src/原型系统/resources/css/images/ui-bg_glass_75_ffffff_1x400.png differ
diff --git a/src/原型系统/resources/css/images/ui-bg_highlight-soft_75_cccccc_1x100.png b/src/原型系统/resources/css/images/ui-bg_highlight-soft_75_cccccc_1x100.png
new file mode 100644
index 0000000..7c9fa6c
Binary files /dev/null and b/src/原型系统/resources/css/images/ui-bg_highlight-soft_75_cccccc_1x100.png differ
diff --git a/src/原型系统/resources/css/images/ui-bg_inset-soft_95_fef1ec_1x100.png b/src/原型系统/resources/css/images/ui-bg_inset-soft_95_fef1ec_1x100.png
new file mode 100644
index 0000000..0e05810
Binary files /dev/null and b/src/原型系统/resources/css/images/ui-bg_inset-soft_95_fef1ec_1x100.png differ
diff --git a/src/原型系统/resources/css/images/ui-icons_222222_256x240.png b/src/原型系统/resources/css/images/ui-icons_222222_256x240.png
new file mode 100644
index 0000000..b273ff1
Binary files /dev/null and b/src/原型系统/resources/css/images/ui-icons_222222_256x240.png differ
diff --git a/src/原型系统/resources/css/images/ui-icons_2e83ff_256x240.png b/src/原型系统/resources/css/images/ui-icons_2e83ff_256x240.png
new file mode 100644
index 0000000..09d1cdc
Binary files /dev/null and b/src/原型系统/resources/css/images/ui-icons_2e83ff_256x240.png differ
diff --git a/src/原型系统/resources/css/images/ui-icons_454545_256x240.png b/src/原型系统/resources/css/images/ui-icons_454545_256x240.png
new file mode 100644
index 0000000..59bd45b
Binary files /dev/null and b/src/原型系统/resources/css/images/ui-icons_454545_256x240.png differ
diff --git a/src/原型系统/resources/css/images/ui-icons_888888_256x240.png b/src/原型系统/resources/css/images/ui-icons_888888_256x240.png
new file mode 100644
index 0000000..6d02426
Binary files /dev/null and b/src/原型系统/resources/css/images/ui-icons_888888_256x240.png differ
diff --git a/src/原型系统/resources/css/images/ui-icons_cd0a0a_256x240.png b/src/原型系统/resources/css/images/ui-icons_cd0a0a_256x240.png
new file mode 100644
index 0000000..2ab019b
Binary files /dev/null and b/src/原型系统/resources/css/images/ui-icons_cd0a0a_256x240.png differ
diff --git a/src/原型系统/resources/css/jquery-ui-themes.css b/src/原型系统/resources/css/jquery-ui-themes.css
new file mode 100644
index 0000000..8afb633
--- /dev/null
+++ b/src/原型系统/resources/css/jquery-ui-themes.css
@@ -0,0 +1,412 @@
+/*
+* jQuery UI CSS Framework
+* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
+* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
+*/
+
+/* Layout helpers
+----------------------------------*/
+.ui-helper-hidden { display: none; }
+.ui-helper-hidden-accessible { position: absolute; left: -99999999px; }
+.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
+.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
+.ui-helper-clearfix { display: inline-block; }
+/* required comment for clearfix to work in Opera \*/
+* html .ui-helper-clearfix { height:1%; }
+.ui-helper-clearfix { display:block; }
+/* end clearfix */
+.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
+
+
+/* Interaction Cues
+----------------------------------*/
+.ui-state-disabled { cursor: default !important; }
+
+
+/* Icons
+----------------------------------*/
+
+/* states and images */
+.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
+
+
+/* Misc visuals
+----------------------------------*/
+
+/* Overlays */
+.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }/* Accordion
+----------------------------------*/
+.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; }
+.ui-accordion .ui-accordion-li-fix { display: inline; }
+.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; }
+.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em 2.2em; }
+.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
+.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; }
+.ui-accordion .ui-accordion-content-active { display: block; }
+
+/* Datepicker
+----------------------------------*/
+.ui-datepicker { width: 17em; padding: .2em .2em 0; }
+.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
+.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
+.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
+.ui-datepicker .ui-datepicker-prev { left:2px; }
+.ui-datepicker .ui-datepicker-next { right:2px; }
+.ui-datepicker .ui-datepicker-prev-hover { left:1px; }
+.ui-datepicker .ui-datepicker-next-hover { right:1px; }
+.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
+.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
+.ui-datepicker .ui-datepicker-title select { float:left; font-size:1em; margin:1px 0; }
+.ui-datepicker select.ui-datepicker-month-year {width: 100%;}
+.ui-datepicker select.ui-datepicker-month,
+.ui-datepicker select.ui-datepicker-year { width: 49%;}
+.ui-datepicker .ui-datepicker-title select.ui-datepicker-year { float: right; }
+.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
+.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
+.ui-datepicker td { border: 0; padding: 1px; }
+.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
+.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
+.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
+.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
+
+/* with multiple calendars */
+.ui-datepicker.ui-datepicker-multi { width:auto; }
+.ui-datepicker-multi .ui-datepicker-group { float:left; }
+.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
+.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
+.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
+.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
+.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
+.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
+.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
+.ui-datepicker-row-break { clear:both; width:100%; }
+
+/* RTL support */
+.ui-datepicker-rtl { direction: rtl; }
+.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
+.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
+.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
+.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
+.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
+.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
+.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
+.ui-datepicker-rtl .ui-datepicker-group { float:right; }
+.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
+.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
+
+/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
+.ui-datepicker-cover {
+ display: none; /*sorry for IE5*/
+ display/**/: block; /*sorry for IE5*/
+ position: absolute; /*must have*/
+ z-index: -1; /*must have*/
+ filter: mask(); /*must have*/
+ top: -4px; /*must have*/
+ left: -4px; /*must have*/
+ width: 200px; /*must have*/
+ height: 200px; /*must have*/
+}
+
+/* Dialog
+----------------------------------*/
+.ui-dialog { position: relative; padding: 0px; width: 300px;}
+.ui-dialog .ui-dialog-titlebar { padding: .3em .3em .1em .8em; font-size:.7em; position: relative; background-image: none; }
+.ui-dialog .ui-dialog-title { float: left; margin: .1em 0 .2em;
+ font-family: 'Trebuchet MS';
+ font-size: 15px;
+ font-weight: normal;
+ color: #ffffff;}
+.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .1em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
+.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
+.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { /*padding: 0;*/ }
+.ui-dialog .ui-dialog-content { border: 0; padding: .5em .2em; background: none; overflow: auto; zoom: 1; background-color: #ffffff;}
+.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
+.ui-dialog .ui-dialog-buttonpane button { float: right; margin: .5em .4em .5em 0; cursor: pointer; padding: .2em .6em .3em .6em; line-height: 1.4em; width:auto; overflow:visible; }
+.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
+.ui-draggable .ui-dialog-titlebar { cursor: move; background-color: #8f949a; border-bottom: 1px solid #d9d9d9;}
+
+/* Progressbar
+----------------------------------*/
+.ui-progressbar { height:2em; text-align: left; }
+.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }/* Resizable
+----------------------------------*/
+.ui-resizable { position: relative;}
+.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block;}
+.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
+.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0px; }
+.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0px; }
+.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0px; height: 100%; }
+.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0px; height: 100%; }
+.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
+.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
+.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
+.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/* Slider
+----------------------------------*/
+.ui-slider { position: relative; text-align: left; }
+.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
+.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; }
+
+.ui-slider-horizontal { height: .8em; }
+.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
+.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
+.ui-slider-horizontal .ui-slider-range-min { left: 0; }
+.ui-slider-horizontal .ui-slider-range-max { right: 0; }
+
+.ui-slider-vertical { width: .8em; height: 100px; }
+.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
+.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
+.ui-slider-vertical .ui-slider-range-min { bottom: 0; }
+.ui-slider-vertical .ui-slider-range-max { top: 0; }/* Tabs
+----------------------------------*/
+.ui-tabs { padding: .2em; zoom: 1; }
+.ui-tabs .ui-tabs-nav { list-style: none; position: relative; padding: .2em .2em 0; }
+.ui-tabs .ui-tabs-nav li { position: relative; float: left; border-bottom-width: 0 !important; margin: 0 .2em -1px 0; padding: 0; }
+.ui-tabs .ui-tabs-nav li a { float: left; text-decoration: none; padding: .5em 1em; }
+.ui-tabs .ui-tabs-nav li.ui-tabs-selected { padding-bottom: 1px; border-bottom-width: 0; }
+.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; }
+.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
+.ui-tabs .ui-tabs-panel { padding: 1em 1.4em; display: block; border-width: 0; background: none; }
+.ui-tabs .ui-tabs-hide { display: none !important; }
+/*
+* jQuery UI CSS Framework
+* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
+* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
+* To view and modify this theme, visit http://jqueryui.com/themeroller/
+*/
+
+
+/* Component containers
+----------------------------------*/
+.ui-widget { font-family: Verdana,Arial,sans-serif/*{ffDefault}*/; font-size: 1.1em/*{fsDefault}*/; }
+.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif/*{ffDefault}*/; font-size: 1em; }
+.ui-widget-content { border: 1px solid #aaaaaa/*{borderColorContent}*/; background: #ffffff/*{bgColorContent}*/ url(images/ui-bg_glass_75_ffffff_1x400.png)/*{bgImgUrlContent}*/ 0/*{bgContentXPos}*/ 0/*{bgContentYPos}*/ repeat-x/*{bgContentRepeat}*/; color: #222222/*{fcContent}*/; }
+.ui-widget-content a { /*color: #222222*//*{fcContent}*/; }
+.ui-widget-header { border: none /*1px solid #aaaaaa*//*{borderColorHeader}*/; background: #D3D3D3/*{bgColorHeader}*/ url(images/ui-bg_highlight-soft_75_cccccc_1x100.png)/*{bgImgUrlHeader}*/ 0/*{bgHeaderXPos}*/ 50%/*{bgHeaderYPos}*/ repeat-x/*{bgHeaderRepeat}*/; color: #000000/*{fcHeader}*/; font-weight: bold; }
+.ui-widget-header a { color: #222222/*{fcHeader}*/; }
+
+/* Interaction states
+----------------------------------*/
+.ui-state-default, .ui-widget-content .ui-state-default { border: none /*1px solid #d3d3d3*//*{borderColorDefault}*/; /*background: #e6e6e6*//*{bgColorDefault}*/ /*url(images/ui-bg_glass_75_e6e6e6_1x400.png)*//*{bgImgUrlDefault}*/ /*0*//*{bgDefaultXPos}*/ /*50%*//*{bgDefaultYPos}*/ /*repeat-x*//*{bgDefaultRepeat}*/ font-weight: normal/*{fwDefault}*/; color: #555555/*{fcDefault}*/; outline: none; }
+.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555/*{fcDefault}*/; text-decoration: none; outline: none; }
+.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus { border: none /*1px solid #999999*//*{borderColorHover}*/; /*background: #dadada*//*{bgColorHover}*/ /*url(images/ui-bg_glass_75_dadada_1x400.png)*//*{bgImgUrlHover}*/ /*0*//*{bgHoverXPos}*/ /*50%*//*{bgHoverYPos}*/ /*repeat-x*//*{bgHoverRepeat}*/ font-weight: normal/*{fwDefault}*/; color: #212121/*{fcHover}*/; outline: none; }
+.ui-state-hover a, .ui-state-hover a:hover { color: #212121/*{fcHover}*/; text-decoration: none; outline: none; }
+.ui-state-active, .ui-widget-content .ui-state-active { border: 1px solid #aaaaaa/*{borderColorActive}*/; background: #ffffff/*{bgColorActive}*/ url(images/ui-bg_glass_65_ffffff_1x400.png)/*{bgImgUrlActive}*/ 0/*{bgActiveXPos}*/ 50%/*{bgActiveYPos}*/ repeat-x/*{bgActiveRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #212121/*{fcActive}*/; outline: none; }
+.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121/*{fcActive}*/; outline: none; text-decoration: none; }
+
+/* Interaction Cues
+----------------------------------*/
+.ui-state-highlight, .ui-widget-content .ui-state-highlight {border: 1px solid #fcefa1/*{borderColorHighlight}*/; background: #fbf9ee/*{bgColorHighlight}*/ url(images/ui-bg_glass_55_fbf9ee_1x400.png)/*{bgImgUrlHighlight}*/ 0/*{bgHighlightXPos}*/ 50%/*{bgHighlightYPos}*/ repeat-x/*{bgHighlightRepeat}*/; color: #363636/*{fcHighlight}*/; }
+.ui-state-highlight a, .ui-widget-content .ui-state-highlight a { color: #363636/*{fcHighlight}*/; }
+.ui-state-error, .ui-widget-content .ui-state-error {border: 1px solid #cd0a0a/*{borderColorError}*/; background: #fef1ec/*{bgColorError}*/ url(images/ui-bg_inset-soft_95_fef1ec_1x100.png)/*{bgImgUrlError}*/ 0/*{bgErrorXPos}*/ 50%/*{bgErrorYPos}*/ repeat-x/*{bgErrorRepeat}*/; color: #cd0a0a/*{fcError}*/; }
+.ui-state-error a, .ui-widget-content .ui-state-error a { color: #363636/*{fcError}*/; }
+.ui-state-error-text, .ui-widget-content .ui-state-error-text { color: #cd0a0a/*{fcError}*/; }
+.ui-state-disabled, .ui-widget-content .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
+.ui-priority-primary, .ui-widget-content .ui-priority-primary { font-weight: bold; }
+.ui-priority-secondary, .ui-widget-content .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
+
+/* Icons
+----------------------------------*/
+
+/* states and images */
+.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png)/*{iconsContent}*/; }
+.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png)/*{iconsContent}*/; }
+.ui-widget-header .ui-icon {background-image: url(images/ui-icons_454545_256x240.png)/*{iconsHeader}*/; }
+.ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png)/*{iconsDefault}*/; }
+.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_222222_256x240.png)/*{iconsHover}*/; }
+.ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png)/*{iconsActive}*/; }
+.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png)/*{iconsHighlight}*/; }
+.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png)/*{iconsError}*/; }
+
+/* positioning */
+.ui-icon-carat-1-n { background-position: 0 0; }
+.ui-icon-carat-1-ne { background-position: -16px 0; }
+.ui-icon-carat-1-e { background-position: -32px 0; }
+.ui-icon-carat-1-se { background-position: -48px 0; }
+.ui-icon-carat-1-s { background-position: -64px 0; }
+.ui-icon-carat-1-sw { background-position: -80px 0; }
+.ui-icon-carat-1-w { background-position: -96px 0; }
+.ui-icon-carat-1-nw { background-position: -112px 0; }
+.ui-icon-carat-2-n-s { background-position: -128px 0; }
+.ui-icon-carat-2-e-w { background-position: -144px 0; }
+.ui-icon-triangle-1-n { background-position: 0 -16px; }
+.ui-icon-triangle-1-ne { background-position: -16px -16px; }
+.ui-icon-triangle-1-e { background-position: -32px -16px; }
+.ui-icon-triangle-1-se { background-position: -48px -16px; }
+.ui-icon-triangle-1-s { background-position: -64px -16px; }
+.ui-icon-triangle-1-sw { background-position: -80px -16px; }
+.ui-icon-triangle-1-w { background-position: -96px -16px; }
+.ui-icon-triangle-1-nw { background-position: -112px -16px; }
+.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
+.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
+.ui-icon-arrow-1-n { background-position: 0 -32px; }
+.ui-icon-arrow-1-ne { background-position: -16px -32px; }
+.ui-icon-arrow-1-e { background-position: -32px -32px; }
+.ui-icon-arrow-1-se { background-position: -48px -32px; }
+.ui-icon-arrow-1-s { background-position: -64px -32px; }
+.ui-icon-arrow-1-sw { background-position: -80px -32px; }
+.ui-icon-arrow-1-w { background-position: -96px -32px; }
+.ui-icon-arrow-1-nw { background-position: -112px -32px; }
+.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
+.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
+.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
+.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
+.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
+.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
+.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
+.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
+.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
+.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
+.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
+.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
+.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
+.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
+.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
+.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
+.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
+.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
+.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
+.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
+.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
+.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
+.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
+.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
+.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
+.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
+.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
+.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
+.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
+.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
+.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
+.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
+.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
+.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
+.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
+.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
+.ui-icon-arrow-4 { background-position: 0 -80px; }
+.ui-icon-arrow-4-diag { background-position: -16px -80px; }
+.ui-icon-extlink { background-position: -32px -80px; }
+.ui-icon-newwin { background-position: -48px -80px; }
+.ui-icon-refresh { background-position: -64px -80px; }
+.ui-icon-shuffle { background-position: -80px -80px; }
+.ui-icon-transfer-e-w { background-position: -96px -80px; }
+.ui-icon-transferthick-e-w { background-position: -112px -80px; }
+.ui-icon-folder-collapsed { background-position: 0 -96px; }
+.ui-icon-folder-open { background-position: -16px -96px; }
+.ui-icon-document { background-position: -32px -96px; }
+.ui-icon-document-b { background-position: -48px -96px; }
+.ui-icon-note { background-position: -64px -96px; }
+.ui-icon-mail-closed { background-position: -80px -96px; }
+.ui-icon-mail-open { background-position: -96px -96px; }
+.ui-icon-suitcase { background-position: -112px -96px; }
+.ui-icon-comment { background-position: -128px -96px; }
+.ui-icon-person { background-position: -144px -96px; }
+.ui-icon-print { background-position: -160px -96px; }
+.ui-icon-trash { background-position: -176px -96px; }
+.ui-icon-locked { background-position: -192px -96px; }
+.ui-icon-unlocked { background-position: -208px -96px; }
+.ui-icon-bookmark { background-position: -224px -96px; }
+.ui-icon-tag { background-position: -240px -96px; }
+.ui-icon-home { background-position: 0 -112px; }
+.ui-icon-flag { background-position: -16px -112px; }
+.ui-icon-calendar { background-position: -32px -112px; }
+.ui-icon-cart { background-position: -48px -112px; }
+.ui-icon-pencil { background-position: -64px -112px; }
+.ui-icon-clock { background-position: -80px -112px; }
+.ui-icon-disk { background-position: -96px -112px; }
+.ui-icon-calculator { background-position: -112px -112px; }
+.ui-icon-zoomin { background-position: -128px -112px; }
+.ui-icon-zoomout { background-position: -144px -112px; }
+.ui-icon-search { background-position: -160px -112px; }
+.ui-icon-wrench { background-position: -176px -112px; }
+.ui-icon-gear { background-position: -192px -112px; }
+.ui-icon-heart { background-position: -208px -112px; }
+.ui-icon-star { background-position: -224px -112px; }
+.ui-icon-link { background-position: -240px -112px; }
+.ui-icon-cancel { background-position: 0 -128px; }
+.ui-icon-plus { background-position: -16px -128px; }
+.ui-icon-plusthick { background-position: -32px -128px; }
+.ui-icon-minus { background-position: -48px -128px; }
+.ui-icon-minusthick { background-position: -64px -128px; }
+.ui-icon-close { background-position: -80px -128px; }
+.ui-icon-closethick { background-position: -96px -128px; }
+.ui-icon-key { background-position: -112px -128px; }
+.ui-icon-lightbulb { background-position: -128px -128px; }
+.ui-icon-scissors { background-position: -144px -128px; }
+.ui-icon-clipboard { background-position: -160px -128px; }
+.ui-icon-copy { background-position: -176px -128px; }
+.ui-icon-contact { background-position: -192px -128px; }
+.ui-icon-image { background-position: -208px -128px; }
+.ui-icon-video { background-position: -224px -128px; }
+.ui-icon-script { background-position: -240px -128px; }
+.ui-icon-alert { background-position: 0 -144px; }
+.ui-icon-info { background-position: -16px -144px; }
+.ui-icon-notice { background-position: -32px -144px; }
+.ui-icon-help { background-position: -48px -144px; }
+.ui-icon-check { background-position: -64px -144px; }
+.ui-icon-bullet { background-position: -80px -144px; }
+.ui-icon-radio-off { background-position: -96px -144px; }
+.ui-icon-radio-on { background-position: -112px -144px; }
+.ui-icon-pin-w { background-position: -128px -144px; }
+.ui-icon-pin-s { background-position: -144px -144px; }
+.ui-icon-play { background-position: 0 -160px; }
+.ui-icon-pause { background-position: -16px -160px; }
+.ui-icon-seek-next { background-position: -32px -160px; }
+.ui-icon-seek-prev { background-position: -48px -160px; }
+.ui-icon-seek-end { background-position: -64px -160px; }
+.ui-icon-seek-first { background-position: -80px -160px; }
+.ui-icon-stop { background-position: -96px -160px; }
+.ui-icon-eject { background-position: -112px -160px; }
+.ui-icon-volume-off { background-position: -128px -160px; }
+.ui-icon-volume-on { background-position: -144px -160px; }
+.ui-icon-power { background-position: 0 -176px; }
+.ui-icon-signal-diag { background-position: -16px -176px; }
+.ui-icon-signal { background-position: -32px -176px; }
+.ui-icon-battery-0 { background-position: -48px -176px; }
+.ui-icon-battery-1 { background-position: -64px -176px; }
+.ui-icon-battery-2 { background-position: -80px -176px; }
+.ui-icon-battery-3 { background-position: -96px -176px; }
+.ui-icon-circle-plus { background-position: 0 -192px; }
+.ui-icon-circle-minus { background-position: -16px -192px; }
+.ui-icon-circle-close { background-position: -32px -192px; }
+.ui-icon-circle-triangle-e { background-position: -48px -192px; }
+.ui-icon-circle-triangle-s { background-position: -64px -192px; }
+.ui-icon-circle-triangle-w { background-position: -80px -192px; }
+.ui-icon-circle-triangle-n { background-position: -96px -192px; }
+.ui-icon-circle-arrow-e { background-position: -112px -192px; }
+.ui-icon-circle-arrow-s { background-position: -128px -192px; }
+.ui-icon-circle-arrow-w { background-position: -144px -192px; }
+.ui-icon-circle-arrow-n { background-position: -160px -192px; }
+.ui-icon-circle-zoomin { background-position: -176px -192px; }
+.ui-icon-circle-zoomout { background-position: -192px -192px; }
+.ui-icon-circle-check { background-position: -208px -192px; }
+.ui-icon-circlesmall-plus { background-position: 0 -208px; }
+.ui-icon-circlesmall-minus { background-position: -16px -208px; }
+.ui-icon-circlesmall-close { background-position: -32px -208px; }
+.ui-icon-squaresmall-plus { background-position: -48px -208px; }
+.ui-icon-squaresmall-minus { background-position: -64px -208px; }
+.ui-icon-squaresmall-close { background-position: -80px -208px; }
+.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
+.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
+.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
+.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
+.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
+.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
+
+
+/* Misc visuals
+----------------------------------*/
+
+/* Corner radius */
+.ui-corner-tl { -moz-border-radius-topleft: 4px/*{cornerRadius}*/; -webkit-border-top-left-radius: 4px/*{cornerRadius}*/; }
+.ui-corner-tr { -moz-border-radius-topright: 4px/*{cornerRadius}*/; -webkit-border-top-right-radius: 4px/*{cornerRadius}*/; }
+.ui-corner-bl { -moz-border-radius-bottomleft: 4px/*{cornerRadius}*/; -webkit-border-bottom-left-radius: 4px/*{cornerRadius}*/; }
+.ui-corner-br { -moz-border-radius-bottomright: 4px/*{cornerRadius}*/; -webkit-border-bottom-right-radius: 4px/*{cornerRadius}*/; }
+.ui-corner-top { -moz-border-radius-topleft: 4px/*{cornerRadius}*/; -webkit-border-top-left-radius: 4px/*{cornerRadius}*/; -moz-border-radius-topright: 4px/*{cornerRadius}*/; -webkit-border-top-right-radius: 4px/*{cornerRadius}*/; }
+.ui-corner-bottom { -moz-border-radius-bottomleft: 4px/*{cornerRadius}*/; -webkit-border-bottom-left-radius: 4px/*{cornerRadius}*/; -moz-border-radius-bottomright: 4px/*{cornerRadius}*/; -webkit-border-bottom-right-radius: 4px/*{cornerRadius}*/; }
+.ui-corner-right { -moz-border-radius-topright: 4px/*{cornerRadius}*/; -webkit-border-top-right-radius: 4px/*{cornerRadius}*/; -moz-border-radius-bottomright: 4px/*{cornerRadius}*/; -webkit-border-bottom-right-radius: 4px/*{cornerRadius}*/; }
+.ui-corner-left { -moz-border-radius-topleft: 4px/*{cornerRadius}*/; -webkit-border-top-left-radius: 4px/*{cornerRadius}*/; -moz-border-radius-bottomleft: 4px/*{cornerRadius}*/; -webkit-border-bottom-left-radius: 4px/*{cornerRadius}*/; }
+.ui-corner-all { -moz-border-radius: 0px/*{cornerRadius}*/; -webkit-border-radius: 0px/*{cornerRadius}*/; }
+
+/* Overlays */
+.ui-widget-overlay { background: #aaaaaa/*{bgColorOverlay}*/ none/*{bgImgUrlOverlay}*/ 0/*{bgOverlayXPos}*/ 0/*{bgOverlayYPos}*/ repeat-x/*{bgOverlayRepeat}*/; opacity: .3;filter:Alpha(Opacity=30)/*{opacityOverlay}*/; }
+.ui-widget-shadow { margin: -4px/*{offsetTopShadow}*/ 0 0 -4px/*{offsetLeftShadow}*/; padding: 4px/*{thicknessShadow}*/; background: #aaaaaa/*{bgColorShadow}*/ none/*{bgImgUrlShadow}*/ 0/*{bgShadowXPos}*/ 0/*{bgShadowYPos}*/ repeat-x/*{bgShadowRepeat}*/; opacity: .35;filter:Alpha(Opacity=35)/*{opacityShadow}*/; -moz-border-radius: 4px/*{cornerRadiusShadow}*/; -webkit-border-radius: 4px/*{cornerRadiusShadow}*/; }
\ No newline at end of file
diff --git a/src/原型系统/resources/css/previewfonts.css b/src/原型系统/resources/css/previewfonts.css
new file mode 100644
index 0000000..bbc04ec
--- /dev/null
+++ b/src/原型系统/resources/css/previewfonts.css
@@ -0,0 +1,12 @@
+@font-face {
+ font-family: 'Source Sans Pro';
+ font-style: normal;
+ font-weight: 400;
+ src: local('Source Sans Pro Regular'), local('SourceSansPro-Regular'), url('previewfonts/SourceSansPro-Regular.woff2') format('woff2'), url('previewfonts/SourceSansPro-Regular.woff') format('woff');
+}
+@font-face {
+ font-family: 'Source Sans Pro Semibold';
+ font-style: normal;
+ font-weight: 400;
+ src: local('Source Sans Pro Semibold'), local('SourceSansPro-Semibold'), url('previewfonts/SourceSansPro-Semibold.woff2') format('woff2'), url('previewfonts/SourceSansPro-Semibold.woff') format('woff');
+}
\ No newline at end of file
diff --git a/src/原型系统/resources/css/previewfonts/SourceSansPro-OpenFontLicense.txt b/src/原型系统/resources/css/previewfonts/SourceSansPro-OpenFontLicense.txt
new file mode 100644
index 0000000..bce8032
--- /dev/null
+++ b/src/原型系统/resources/css/previewfonts/SourceSansPro-OpenFontLicense.txt
@@ -0,0 +1,93 @@
+Copyright 2010, 2012, 2014 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name ‘Source’.
+
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+This license is copied below, and is also available with a FAQ at:
+http://scripts.sil.org/OFL
+
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
diff --git a/src/原型系统/resources/css/previewfonts/SourceSansPro-Regular.woff2 b/src/原型系统/resources/css/previewfonts/SourceSansPro-Regular.woff2
new file mode 100644
index 0000000..0dd3464
Binary files /dev/null and b/src/原型系统/resources/css/previewfonts/SourceSansPro-Regular.woff2 differ
diff --git a/src/原型系统/resources/css/previewfonts/SourceSansPro-Semibold.woff2 b/src/原型系统/resources/css/previewfonts/SourceSansPro-Semibold.woff2
new file mode 100644
index 0000000..2526d2e
Binary files /dev/null and b/src/原型系统/resources/css/previewfonts/SourceSansPro-Semibold.woff2 differ
diff --git a/src/原型系统/resources/css/reset.css b/src/原型系统/resources/css/reset.css
new file mode 100644
index 0000000..01a4271
--- /dev/null
+++ b/src/原型系统/resources/css/reset.css
@@ -0,0 +1,24 @@
+html,body,div,span,
+applet,object,iframe,
+h1,h2,h3,h4,h5,h6,p,blockquote,pre,
+a,abbr,acronym,address,big,cite,code,
+del,dfn,em,font,img,ins,kbd,q,s,samp,
+small,strike,strong,sub,sup,tt,var,
+dd,dl,dt,li,ol,ul,
+fieldset,form,label,legend,
+table,caption,tbody,tfoot,thead,tr,th,td {
+ margin: 0;
+ padding: 0;
+ border: 0;
+}
+table {
+ border-collapse: collapse;
+ border-spacing: 0;
+}
+ol,ul {
+ list-style: none;
+}
+q:before,q:after,
+blockquote:before,blockquote:after {
+ content: "";
+}
\ No newline at end of file
diff --git a/src/原型系统/resources/expand.html b/src/原型系统/resources/expand.html
new file mode 100644
index 0000000..295783b
--- /dev/null
+++ b/src/原型系统/resources/expand.html
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/原型系统/resources/images/axure9_logo.svg b/src/原型系统/resources/images/axure9_logo.svg
new file mode 100644
index 0000000..0aa619c
--- /dev/null
+++ b/src/原型系统/resources/images/axure9_logo.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/原型系统/resources/images/axure_logo.png b/src/原型系统/resources/images/axure_logo.png
new file mode 100644
index 0000000..ed8be89
Binary files /dev/null and b/src/原型系统/resources/images/axure_logo.png differ
diff --git a/src/原型系统/resources/images/axure_logo.svg b/src/原型系统/resources/images/axure_logo.svg
new file mode 100644
index 0000000..999ccf4
--- /dev/null
+++ b/src/原型系统/resources/images/axure_logo.svg
@@ -0,0 +1,18 @@
+
+
+
+ axure_logo
+ Created with Sketch.
+
+
+
+
+
\ No newline at end of file
diff --git a/src/原型系统/resources/images/caret_down.svg b/src/原型系统/resources/images/caret_down.svg
new file mode 100644
index 0000000..692dab8
--- /dev/null
+++ b/src/原型系统/resources/images/caret_down.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/src/原型系统/resources/images/caret_down_off.svg b/src/原型系统/resources/images/caret_down_off.svg
new file mode 100644
index 0000000..7b640d8
--- /dev/null
+++ b/src/原型系统/resources/images/caret_down_off.svg
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/src/原型系统/resources/images/close_x.svg b/src/原型系统/resources/images/close_x.svg
new file mode 100644
index 0000000..325ca55
--- /dev/null
+++ b/src/原型系统/resources/images/close_x.svg
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/src/原型系统/resources/images/close_x_minimize.svg b/src/原型系统/resources/images/close_x_minimize.svg
new file mode 100644
index 0000000..24f693b
--- /dev/null
+++ b/src/原型系统/resources/images/close_x_minimize.svg
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/src/原型系统/resources/images/divider.png b/src/原型系统/resources/images/divider.png
new file mode 100644
index 0000000..f7b738a
Binary files /dev/null and b/src/原型系统/resources/images/divider.png differ
diff --git a/src/原型系统/resources/images/divider.svg b/src/原型系统/resources/images/divider.svg
new file mode 100644
index 0000000..767941e
--- /dev/null
+++ b/src/原型系统/resources/images/divider.svg
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/原型系统/resources/images/exit.svg b/src/原型系统/resources/images/exit.svg
new file mode 100644
index 0000000..f6e38c0
--- /dev/null
+++ b/src/原型系统/resources/images/exit.svg
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/src/原型系统/resources/images/favicon_play.ico b/src/原型系统/resources/images/favicon_play.ico
new file mode 100644
index 0000000..6f9a873
Binary files /dev/null and b/src/原型系统/resources/images/favicon_play.ico differ
diff --git a/src/原型系统/resources/images/overflow-icon.svg b/src/原型系统/resources/images/overflow-icon.svg
new file mode 100644
index 0000000..31a4669
--- /dev/null
+++ b/src/原型系统/resources/images/overflow-icon.svg
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/src/原型系统/resources/images/overflow_checkmark.svg b/src/原型系统/resources/images/overflow_checkmark.svg
new file mode 100644
index 0000000..1902c82
--- /dev/null
+++ b/src/原型系统/resources/images/overflow_checkmark.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/src/原型系统/resources/images/overflow_icon_off.svg b/src/原型系统/resources/images/overflow_icon_off.svg
new file mode 100644
index 0000000..392e0e7
--- /dev/null
+++ b/src/原型系统/resources/images/overflow_icon_off.svg
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/src/原型系统/resources/images/refresh.svg b/src/原型系统/resources/images/refresh.svg
new file mode 100644
index 0000000..258992e
--- /dev/null
+++ b/src/原型系统/resources/images/refresh.svg
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/src/原型系统/resources/images/resize.svg b/src/原型系统/resources/images/resize.svg
new file mode 100644
index 0000000..3c62509
--- /dev/null
+++ b/src/原型系统/resources/images/resize.svg
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/src/原型系统/resources/images/return.svg b/src/原型系统/resources/images/return.svg
new file mode 100644
index 0000000..b5bc16d
--- /dev/null
+++ b/src/原型系统/resources/images/return.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/src/原型系统/resources/images/transparent.gif b/src/原型系统/resources/images/transparent.gif
new file mode 100644
index 0000000..35d42e8
Binary files /dev/null and b/src/原型系统/resources/images/transparent.gif differ
diff --git a/src/原型系统/resources/images/views-icon.svg b/src/原型系统/resources/images/views-icon.svg
new file mode 100644
index 0000000..0f78550
--- /dev/null
+++ b/src/原型系统/resources/images/views-icon.svg
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/src/原型系统/resources/reload.html b/src/原型系统/resources/reload.html
new file mode 100644
index 0000000..5f99f0b
--- /dev/null
+++ b/src/原型系统/resources/reload.html
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/原型系统/resources/scripts/axure/action.js b/src/原型系统/resources/scripts/axure/action.js
new file mode 100644
index 0000000..2481b26
--- /dev/null
+++ b/src/原型系统/resources/scripts/axure/action.js
@@ -0,0 +1,2085 @@
+$axure.internal(function($ax) {
+ var _actionHandlers = {};
+ var _action = $ax.action = {};
+
+ var queueTypes = _action.queueTypes = {
+ none: 0,
+ move: 1,
+ setState: 2,
+ fade: 3,
+ resize: 4,
+ rotate: 5
+ };
+
+ var animationQueue = {};
+
+ // using array as the key doesn't play nice
+ var nextAnimationId = 1;
+ var animationsToCount = {};
+ var actionToActionGroups = {};
+ var getAnimation = function(id, type) {
+ return animationQueue[id] && animationQueue[id][type] && animationQueue[id][type][0];
+ };
+
+ var _addAnimation = _action.addAnimation = function (id, type, func, suppressFire) {
+
+ var wasEmpty = !getAnimation(id, type);
+ // Add the func to the queue. Create the queue if necessary.
+ var idQueue = animationQueue[id];
+ if(!idQueue) animationQueue[id] = idQueue = {};
+
+ var queue = idQueue[type];
+ if(!queue) idQueue[type] = queue = [];
+
+ queue[queue.length] = func;
+ // If it was empty, there isn't a callback waiting to be called on this. You have to fire it manually.
+ // If this is waiting on something, suppress it, and it will fire when it's ready
+ if(wasEmpty && !suppressFire) func();
+ };
+
+ var _addAnimations = function (animations) {
+ if(animations.length == 1) {
+ _addAnimation(animations[0].id, animations[0].type, animations[0].func);
+ return;
+ }
+ var allReady = true;
+ var readyCount = 0;
+ for(var i = 0; i < animations.length; i++) {
+ var animation = animations[i];
+ var thisReady = !getAnimation(animation.id, animation.type);
+ allReady = allReady && thisReady;
+ if (thisReady) readyCount++;
+ else {
+ var typeToGroups = actionToActionGroups[animation.id];
+ if (!typeToGroups) actionToActionGroups[animation.id] = typeToGroups = {};
+
+ var groups = typeToGroups[animation.type];
+ if (!groups) typeToGroups[animation.type] = groups = [];
+
+ groups[groups.length] = animations;
+ }
+ }
+
+ for(i = 0; i < animations.length; i++) {
+ animation = animations[i];
+ _addAnimation(animation.id, animation.type, animation.func, true);
+ }
+
+ if (allReady) {
+ for (i = 0; i < animations.length; i++) animations[i].func();
+ } else {
+ animations.id = nextAnimationId++;
+ animationsToCount[animations.id] = readyCount;
+ }
+ }
+
+ var _fireAnimationFromQueue = _action.fireAnimationFromQueue = function (id, type) {
+ // Remove the function that was just fired
+ if (animationQueue[id] && animationQueue[id][type]) $ax.splice(animationQueue[id][type], 0, 1);
+
+ // Fire the next func if there is one
+ var func = getAnimation(id, type);
+ if(func && !_checkFireActionGroup(id, type, func)) func();
+ };
+
+ var _checkFireActionGroup = function(id, type, func) {
+ var group = actionToActionGroups[id];
+ group = group && group[type];
+ if (!group || group.length == 0) return false;
+
+ var animations = group[0];
+ var found = false;
+ for (var i = 0; i < animations.length; i++) {
+ var animation = animations[i];
+ if (animation.id == id && animation.type == type) {
+ found = func == animation.func;
+ break;
+ }
+ }
+
+ // if found then update this action group, otherwise, keep waiting for right action to fire
+ if(!found) return false;
+ $ax.splice(group, 0, 1);
+ var count = animationsToCount[animations.id] + 1;
+ if(count != animations.length) {
+ animationsToCount[animations.id] = count;
+ return true;
+ }
+ delete animationsToCount[animations.id];
+
+ // Funcs is needed because an earlier func can try to cascade right away (when no animation for example) and will kill this func and move on to the
+ // next one (which may not even exist). If we get all funcs before calling any, then we know they are all the func we want.
+ var funcs = [];
+ for(i = 0; i < animations.length; i++) {
+ animation = animations[i];
+ funcs.push(getAnimation(animation.id, animation.type));
+ }
+ for(i = 0; i < funcs.length; i++) {
+ funcs[i]();
+ }
+
+ return true;
+ }
+
+ var _refreshing = [];
+ _action.refreshStart = function(repeaterId) { _refreshing.push(repeaterId); };
+ _action.refreshEnd = function() { _refreshing.pop(); };
+
+ // TODO: [ben] Consider moving this to repeater.js
+ var _repeatersToRefresh = _action.repeatersToRefresh = [];
+ var _ignoreAction = function(repeaterId) {
+ for(var i = 0; i < _refreshing.length; i++) if(_refreshing[i] == repeaterId) return true;
+ return false;
+ };
+
+ var _addRefresh = function(repeaterId) {
+ if(_repeatersToRefresh.indexOf(repeaterId) == -1) _repeatersToRefresh.push(repeaterId);
+ };
+
+ var _getIdToResizeMoveState = function(eventInfo) {
+ if(!eventInfo.idToResizeMoveState) eventInfo.idToResizeMoveState = {};
+ return eventInfo.idToResizeMoveState;
+ }
+
+ var _queueResizeMove = function (id, type, eventInfo, actionInfo) {
+ if (type == queueTypes.resize || type == queueTypes.rotate) $ax.public.fn.convertToSingleImage($jobj(id));
+
+ var idToResizeMoveState = _getIdToResizeMoveState(eventInfo);
+ if(!idToResizeMoveState[id]) {
+ idToResizeMoveState[id] = {};
+ idToResizeMoveState[id][queueTypes.move] = { queue: [], used: 0 };
+ idToResizeMoveState[id][queueTypes.resize] = { queue: [], used: 0 };
+ idToResizeMoveState[id][queueTypes.rotate] = { queue: [], used: 0 };
+ }
+ var state = idToResizeMoveState[id];
+
+ // If this is not a type being queued (no action of it's type waiting already) then if it is an instant, fire right away.
+ var myOptions = type == queueTypes.resize ? actionInfo : actionInfo.options;
+ if(!state[type].queue.length && (!myOptions.easing || myOptions.easing == 'none' || !myOptions.duration)) {
+ var func = type == queueTypes.resize ? _addResize : type == queueTypes.rotate ? _addRotate : _addMove;
+ func(id, eventInfo, actionInfo, { easing: 'none', duration: 0, stop: { instant: true } });
+ return;
+ }
+
+ // Check other 2 types to see if either is empty, if so, we can't do anything, so just queue it up
+ var otherType1 = type == queueTypes.move ? queueTypes.resize : queueTypes.move;
+ var otherType2 = type == queueTypes.rotate ? queueTypes.resize : queueTypes.rotate;
+ if (!state[otherType1].queue.length || !state[otherType2].queue.length) {
+ state[type].queue.push({ eventInfo: eventInfo, actionInfo: actionInfo });
+ } else {
+ var duration = myOptions.duration;
+ var used1 = state[otherType1].used;
+ var used2 = state[otherType2].used;
+
+ while(state[otherType1].queue.length && state[otherType2].queue.length && duration != 0) {
+ var other1 = state[otherType1].queue[0];
+ var otherOptions1 = otherType1 == queueTypes.resize ? other1.actionInfo : other1.actionInfo.options;
+ // If queue up action is a non animation, then don't combo it, just queue it and move on
+ if(!otherOptions1.easing || otherOptions1.easing == 'none' || !otherOptions1.duration) {
+ func = otherType1 == queueTypes.resize ? _addResize : otherType1 == queueTypes.rotate ? _addRotate : _addMove;
+ func(id, eventInfo, actionInfo, { easing: 'none', duration: 0, stop: { instant: true } });
+ continue;
+ }
+ var other2 = state[otherType2].queue[0];
+ var otherOptions2 = otherType2 == queueTypes.resize ? other2.actionInfo : other2.actionInfo.options;
+ // If queue up action is a non animation, then don't combo it, just queue it and move on
+ if(!otherOptions2.easing || otherOptions2.easing == 'none' || !otherOptions2.duration) {
+ func = otherType2 == queueTypes.resize ? _addResize : otherType2 == queueTypes.rotate ? _addRotate : _addMove;
+ func(id, eventInfo, actionInfo, { easing: 'none', duration: 0, stop: { instant: true } });
+ continue;
+ }
+
+ // Other duration is what is left over. When in queue it may be partly finished already
+ var otherDuration1 = otherOptions1.duration - used1;
+ var otherDuration2 = otherOptions2.duration - used2;
+
+ var resizeInfo = type == queueTypes.resize ? actionInfo : otherType1 == queueTypes.resize ? other1.actionInfo : other2.actionInfo;
+ var rotateInfo = type == queueTypes.rotate ? actionInfo : otherType1 == queueTypes.rotate ? other1.actionInfo : other2.actionInfo;
+ var moveInfo = type == queueTypes.move ? actionInfo : otherType1 == queueTypes.move ? other1.actionInfo : other2.actionInfo;
+ var options = { easing: moveInfo.options.easing, duration: Math.min(duration, otherDuration1, otherDuration2) };
+ // Start for self is whole duration - duration left, end is start plus duration of combo to be queued, length is duration
+ var stop = { start: myOptions.duration - duration, len: myOptions.duration };
+ stop.end = stop.start + options.duration;
+ // Start for other is used (will be 0 after 1st round), end is start plus length is duration of combo to be queued, length is other duration
+ var otherStop1 = { start: used1, end: options.duration + used1, len: otherOptions1.duration };
+ var otherStop2 = { start: used2, end: options.duration + used2, len: otherOptions2.duration };
+ options.stop = type == queueTypes.resize ? stop : otherType1 == queueTypes.resize ? otherStop1 : otherStop2;
+ options.moveStop = type == queueTypes.move ? stop : otherType1 == queueTypes.move ? otherStop1 : otherStop2;
+ options.rotateStop = type == queueTypes.rotate ? stop : otherType1 == queueTypes.rotate ? otherStop1 : otherStop2;
+
+ _addResize(id, eventInfo, resizeInfo, options, moveInfo, rotateInfo);
+
+ // Update duration for this animation
+ duration -= options.duration;
+ // For others update used and remove from queue if necessary
+ if(otherDuration1 == options.duration) {
+ $ax.splice(state[otherType1].queue, 0, 1);
+ used1 = 0;
+ } else used1 += options.duration;
+
+ if(otherDuration2 == options.duration) {
+ $ax.splice(state[otherType2].queue, 0, 1);
+ used2 = 0;
+ } else used2 += options.duration;
+ }
+
+ // Start queue for new type if necessary
+ if(duration) {
+ state[type].queue.push({ eventInfo: eventInfo, actionInfo: actionInfo });
+ state[type].used = myOptions.duration - duration;
+ }
+
+ // Update used for others
+ state[otherType1].used = used1;
+ state[otherType2].used = used2;
+ }
+ };
+
+ _action.flushAllResizeMoveActions = function (eventInfo) {
+ var idToResizeMoveState = _getIdToResizeMoveState(eventInfo);
+ for(var id in idToResizeMoveState) _flushResizeMoveActions(id, idToResizeMoveState);
+ };
+
+ var _flushResizeMoveActions = function(id, idToResizeMoveState) {
+ var state = idToResizeMoveState[id];
+ var move = state[queueTypes.move];
+ var moveInfo = move.queue[0];
+ var resize = state[queueTypes.resize];
+ var resizeInfo = resize.queue[0];
+ var rotate = state[queueTypes.rotate];
+ var rotateInfo = rotate.queue[0];
+ while (moveInfo || resizeInfo || rotateInfo) {
+ var eventInfo = moveInfo ? moveInfo.eventInfo : resizeInfo ? resizeInfo.eventInfo : rotateInfo.eventInfo;
+ moveInfo = moveInfo && moveInfo.actionInfo;
+ resizeInfo = resizeInfo && resizeInfo.actionInfo;
+ rotateInfo = rotateInfo && rotateInfo.actionInfo;
+
+ // Resize is used by default, then rotate
+ if(resizeInfo) {
+ // Check for instant resize
+ if(!resizeInfo.duration || resizeInfo.easing == 'none') {
+ _addResize(id, resize.queue[0].eventInfo, resizeInfo, { easing: 'none', duration: 0, stop: { instant: true } });
+ _updateResizeMoveUsed(id, queueTypes.resize, 0, idToResizeMoveState);
+ resizeInfo = resize.queue[0];
+ continue;
+ }
+
+ var duration = resizeInfo.duration - resize.used;
+ if(moveInfo) duration = Math.min(duration, moveInfo.options.duration - move.used);
+ if(rotateInfo) duration = Math.min(duration, rotateInfo.options.duration - rotate.used);
+
+ var baseOptions = moveInfo ? moveInfo.options : resizeInfo;
+ var options = { easing: baseOptions.easing, duration: duration };
+
+ options.stop = { start: resize.used, end: resize.used + duration, len: resizeInfo.duration };
+ if(moveInfo) options.moveStop = { start: move.used, end: move.used + duration, len: moveInfo.options.duration };
+ if(rotateInfo) options.rotateStop = { start: rotate.used, end: rotate.used + duration, len: rotateInfo.options.duration };
+
+ _addResize(id, eventInfo, resizeInfo, options, moveInfo, rotateInfo);
+
+ _updateResizeMoveUsed(id, queueTypes.resize, duration, idToResizeMoveState);
+ resizeInfo = resize.queue[0];
+ if(rotateInfo) {
+ _updateResizeMoveUsed(id, queueTypes.rotate, duration, idToResizeMoveState);
+ rotateInfo = rotate.queue[0];
+ }
+ if(moveInfo) {
+ _updateResizeMoveUsed(id, queueTypes.move, duration, idToResizeMoveState);
+ moveInfo = move.queue[0];
+ }
+ } else if (rotateInfo) {
+ // Check for instant rotate
+ if(!rotateInfo.options.duration || rotateInfo.options.easing == 'none') {
+ _addRotate(id, rotate.queue[0].eventInfo, rotateInfo, { easing: 'none', duration: 0, stop: { instant: true } });
+ _updateResizeMoveUsed(id, queueTypes.rotate, 0, idToResizeMoveState);
+ rotateInfo = rotate.queue[0];
+ continue;
+ }
+
+ duration = rotateInfo.options.duration - rotate.used;
+ if(moveInfo) duration = Math.min(duration, moveInfo.options.duration - move.used);
+
+ baseOptions = moveInfo ? moveInfo.options : rotateInfo.options;
+ options = { easing: baseOptions.easing, duration: duration };
+
+ options.stop = { start: rotate.used, end: rotate.used + duration, len: rotateInfo.options.duration };
+ if(moveInfo) options.moveStop = { start: move.used, end: move.used + duration, len: moveInfo.options.duration };
+
+ _addRotate(id, eventInfo, rotateInfo, options, moveInfo);
+
+ _updateResizeMoveUsed(id, queueTypes.rotate, duration, idToResizeMoveState);
+ rotateInfo = rotate.queue[0];
+ if(moveInfo) {
+ _updateResizeMoveUsed(id, queueTypes.move, duration, idToResizeMoveState);
+ moveInfo = move.queue[0];
+ }
+ } else {
+ if(!moveInfo.options.duration || moveInfo.options.easing == 'none') {
+ _addMove(id, eventInfo, moveInfo, { easing: 'none', duration: 0, stop: { instant: true } });
+ _updateResizeMoveUsed(id, queueTypes.move, 0, idToResizeMoveState);
+ moveInfo = move.queue[0];
+ continue;
+ }
+
+ duration = moveInfo.options.duration - move.used;
+ options = { easing: moveInfo.options.easing, duration: duration };
+ options.stop = { start: move.used, end: moveInfo.options.duration, len: moveInfo.options.duration };
+ _addMove(id, eventInfo, moveInfo, options);
+
+ _updateResizeMoveUsed(id, queueTypes.move, duration, idToResizeMoveState);
+ moveInfo = move.queue[0];
+ }
+ }
+ };
+
+ var _updateResizeMoveUsed = function(id, type, duration, idToResizeMoveState) {
+ var state = idToResizeMoveState[id][type];
+ state.used += duration;
+ var options = state.queue[0].actionInfo;
+ if(options.options) options = options.options;
+ var optionDur = (options.easing && options.easing != 'none' && options.duration) || 0;
+ if(optionDur <= state.used) {
+ $ax.splice(state.queue, 0, 1);
+ state.used = 0;
+ }
+ }
+
+ var _dispatchAction = $ax.action.dispatchAction = function(eventInfo, actions, currentIndex) {
+ currentIndex = currentIndex || 0;
+ //If no actions, you can bubble
+ if(currentIndex >= actions.length) return;
+ //actions are responsible for doing their own dispatching
+ _actionHandlers[actions[currentIndex].action](eventInfo, actions, currentIndex);
+ };
+
+ _actionHandlers.wait = function(eventInfo, actions, index) {
+ var action = actions[index];
+ var infoCopy = $ax.eventCopy(eventInfo);
+ window.setTimeout(function() {
+ infoCopy.now = new Date();
+ infoCopy.idToResizeMoveState = undefined;
+ _dispatchAction(infoCopy, actions, index + 1);
+ _action.flushAllResizeMoveActions(infoCopy);
+ }, action.waitTime);
+ };
+
+ _actionHandlers.expr = function(eventInfo, actions, index) {
+ var action = actions[index];
+
+ $ax.expr.evaluateExpr(action.expr, eventInfo); //this should be a block
+
+ _dispatchAction(eventInfo, actions, index + 1);
+ };
+
+ _actionHandlers.setFunction = _actionHandlers.expr;
+
+ _actionHandlers.linkWindow = function(eventInfo, actions, index) {
+ linkActionHelper(eventInfo, actions, index);
+ };
+
+ _actionHandlers.closeCurrent = function(eventInfo, actions, index) {
+ $ax.closeWindow();
+ _dispatchAction(eventInfo, actions, index + 1);
+ };
+
+ _actionHandlers.linkFrame = function(eventInfo, actions, index) {
+ linkActionHelper(eventInfo, actions, index);
+ };
+
+ _actionHandlers.setAdaptiveView = function(eventInfo, actions, index) {
+ var action = actions[index];
+ var view = action.setAdaptiveViewTo;
+
+ if(view) $ax.adaptive.setAdaptiveView(view);
+ };
+
+ var linkActionHelper = function(eventInfo, actions, index) {
+ var action = actions[index];
+ eventInfo.link = true;
+
+ if(action.linkType != 'frame') {
+ var includeVars = _includeVars(action.target, eventInfo);
+ if(action.target.targetType == "reloadPage") {
+ $ax.reload(action.target.includeVariables);
+ } else if(action.target.targetType == "backUrl") {
+ $ax.back();
+ }
+
+ var url = action.target.url;
+ if(!url && action.target.urlLiteral) {
+ url = $ax.expr.evaluateExpr(action.target.urlLiteral, eventInfo, true);
+ }
+
+ if(url) {
+ if(action.linkType == "popup") {
+ $ax.navigate({
+ url: url,
+ target: action.linkType,
+ includeVariables: includeVars,
+ popupOptions: action.popup
+ });
+ } else {
+ $ax.navigate({
+ url: url,
+ target: action.linkType,
+ includeVariables: includeVars
+ });
+ }
+ }
+ } else linkFrame(eventInfo, action);
+ eventInfo.link = false;
+
+ _dispatchAction(eventInfo, actions, index + 1);
+ };
+
+ var _includeVars = function(target, eventInfo) {
+ if(target.includeVariables) return true;
+ // If it is a url literal, that is a string literal, that has only 1 sto, that is an item that is a page, include vars.
+ if(target.urlLiteral) {
+ var literal = target.urlLiteral;
+ var sto = literal.stos[0];
+ if(literal.exprType == 'stringLiteral' && literal.value.indexOf('[[') == 0 && literal.value.indexOf(']]' == literal.value.length - 2) && literal.stos.length == 1 && sto.sto == 'item' && eventInfo.item) {
+ var data = $ax.repeater.getData(eventInfo, eventInfo.item.repeater.elementId, eventInfo.item.index, sto.name, 'data');
+ if (data && $ax.public.fn.IsPage(data.type)) return true;
+ }
+ }
+ return false;
+ };
+
+ var linkFrame = function(eventInfo, action) {
+ for(var i = 0; i < action.framesToTargets.length; i++) {
+ var framePath = action.framesToTargets[i].framePath;
+ var target = action.framesToTargets[i].target;
+ var includeVars = _includeVars(target, eventInfo);
+
+ var url = target.url;
+ if(!url && target.urlLiteral) {
+ url = $ax.expr.evaluateExpr(target.urlLiteral, eventInfo, true);
+ }
+
+ var id = $ax.getElementIdsFromPath(framePath, eventInfo)[0];
+ if(id) $ax('#' + $ax.INPUT(id)).openLink(url, includeVars);
+ }
+ };
+
+ var _repeatPanelMap = {};
+
+ _actionHandlers.setPanelState = function(eventInfo, actions, index) {
+ var action = actions[index];
+
+ for(var i = 0; i < action.panelsToStates.length; i++) {
+ var panelToState = action.panelsToStates[i];
+ var stateInfo = panelToState.stateInfo;
+ var elementIds = $ax.getElementIdsFromPath(panelToState.panelPath, eventInfo);
+
+ for(var j = 0; j < elementIds.length; j++) {
+ var elementId = elementIds[j];
+ // Need new scope for elementId and info
+ (function(elementId, stateInfo) {
+ _addAnimation(elementId, queueTypes.setState, function() {
+ var stateNumber = stateInfo.stateNumber;
+ if(stateInfo.setStateType == "value") {
+ var oldTarget = eventInfo.targetElement;
+ eventInfo.targetElement = elementId;
+ var stateName = $ax.expr.evaluateExpr(stateInfo.stateValue, eventInfo);
+ eventInfo.targetElement = oldTarget;
+
+ // Try for state name first
+ var states = $ax.getObjectFromElementId(elementId).diagrams;
+ var stateNameFound = false;
+ for(var k = 0; k < states.length; k++) {
+ if(states[k].label == stateName) {
+ stateNumber = k + 1;
+ stateNameFound = true;
+ }
+ }
+
+ // Now check for index
+ if(!stateNameFound) {
+ stateNumber = Number(stateName);
+ var panelCount = $('#' + elementId).children().length;
+
+ // Make sure number is not NaN, is in range, and is a whole number.
+ // Wasn't a state name or number, so return
+ if(isNaN(stateNumber) || stateNumber <= 0 || stateNumber > panelCount || Math.round(stateNumber) != stateNumber) return _fireAnimationFromQueue(elementId, queueTypes.setState);
+ }
+ } else if(stateInfo.setStateType == 'next' || stateInfo.setStateType == 'previous') {
+ var info = $ax.deepCopy(stateInfo);
+ var repeat = info.repeat;
+
+ // Only map it, if repeat exists.
+ if(typeof (repeat) == 'number') _repeatPanelMap[elementId] = info;
+ return _progessPanelState(elementId, info, info.repeatSkipFirst);
+ }
+ delete _repeatPanelMap[elementId];
+
+ // If setting to current (to stop repeat) break here
+ if(stateInfo.setStateType == 'current') return _fireAnimationFromQueue(elementId, queueTypes.setState);
+
+ $ax('#' + elementId).SetPanelState(stateNumber, stateInfo.options, stateInfo.showWhenSet);
+ });
+ })(elementId, stateInfo);
+ }
+ }
+
+ _dispatchAction(eventInfo, actions, index + 1);
+ };
+
+ var _progessPanelState = function(id, info, skipFirst) {
+ var direction = info.setStateType;
+ var loop = info.loop;
+ var repeat = info.repeat;
+ var options = info.options;
+
+ var hasRepeat = typeof (repeat) == 'number';
+ var currentStateId = $ax.visibility.GetPanelState(id);
+ var stateNumber = '';
+ if(currentStateId != '') {
+ currentStateId = $ax.repeater.getScriptIdFromElementId(currentStateId);
+ var currentStateNumber = Number(currentStateId.substr(currentStateId.indexOf('state') + 5));
+ if(direction == "next") {
+ stateNumber = currentStateNumber + 2;
+
+ if(stateNumber > $ax.visibility.GetPanelStateCount(id)) {
+ if(loop) stateNumber = 1;
+ else {
+ delete _repeatPanelMap[id];
+ return _fireAnimationFromQueue(id, queueTypes.setState);
+ }
+ }
+ } else if(direction == "previous") {
+ stateNumber = currentStateNumber;
+ if(stateNumber <= 0) {
+ if(loop) stateNumber = $ax.visibility.GetPanelStateCount(id);
+ else {
+ delete _repeatPanelMap[id];
+ return _fireAnimationFromQueue(id, queueTypes.setState);
+ }
+ }
+ }
+
+ if(hasRepeat && _repeatPanelMap[id] != info) return _fireAnimationFromQueue(id, queueTypes.setState);
+
+ if (!skipFirst) $ax('#' + id).SetPanelState(stateNumber, options, info.showWhenSet);
+ else _fireAnimationFromQueue(id, queueTypes.setState);
+
+ if(hasRepeat) {
+ var animate = options && options.animateIn;
+ if(animate && animate.easing && animate.easing != 'none' && animate.duration > repeat) repeat = animate.duration;
+ animate = options && options.animateOut;
+ if(animate && animate.easing && animate.easing != 'none' && animate.duration > repeat) repeat = animate.duration;
+
+ window.setTimeout(function() {
+ // Either new repeat, or no repeat anymore.
+ if(_repeatPanelMap[id] != info) return;
+ _addAnimation(id, queueTypes.setState, function() {
+ _progessPanelState(id, info, false);
+ });
+ }, repeat);
+ } else delete _repeatPanelMap[id];
+ }
+ };
+
+ _actionHandlers.fadeWidget = function(eventInfo, actions, index) {
+ var action = actions[index];
+
+ for(var i = 0; i < action.objectsToFades.length; i++) {
+ var fadeInfo = action.objectsToFades[i].fadeInfo;
+ var elementIds = $ax.getElementIdsFromPath(action.objectsToFades[i].objectPath, eventInfo);
+
+ for(var j = 0; j < elementIds.length; j++) {
+ var elementId = elementIds[j];
+ // Need new scope for elementId and info
+ (function(elementId, fadeInfo) {
+ _addAnimation(elementId, queueTypes.fade, function() {
+ if(fadeInfo.fadeType == "hide") {
+ $ax('#' + elementId).hide(fadeInfo.options);
+ } else if(fadeInfo.fadeType == "show") {
+ $ax('#' + elementId).show(fadeInfo.options, eventInfo);
+ } else if(fadeInfo.fadeType == "toggle") {
+ $ax('#' + elementId).toggleVisibility(fadeInfo.options);
+ }
+ });
+ })(elementId, fadeInfo);
+ }
+ }
+
+ _dispatchAction(eventInfo, actions, index + 1);
+ };
+
+ _actionHandlers.setOpacity = function(eventInfo, actions, index) {
+ var action = actions[index];
+
+ for(var i = 0; i < action.objectsToSetOpacity.length; i++) {
+ var opacityInfo = action.objectsToSetOpacity[i].opacityInfo;
+ var elementIds = $ax.getElementIdsFromPath(action.objectsToSetOpacity[i].objectPath, eventInfo);
+
+ for(var j = 0; j < elementIds.length; j++) {
+ var elementId = elementIds[j];
+
+ (function(elementId, opacityInfo) {
+ _addAnimation(elementId, queueTypes.fade, function () {
+ var oldTarget = eventInfo.targetElement;
+ eventInfo.targetElement = elementId;
+ var opacity = $ax.expr.evaluateExpr(opacityInfo.opacity, eventInfo);
+ eventInfo.targetElement = oldTarget;
+ opacity = Math.min(100, Math.max(0, opacity));
+ $ax('#' + elementId).setOpacity(opacity/100, opacityInfo.easing, opacityInfo.duration);
+ })
+ })(elementId, opacityInfo);
+ }
+ }
+
+ _dispatchAction(eventInfo, actions, index + 1);
+ }
+
+ _actionHandlers.moveWidget = function(eventInfo, actions, index) {
+ var action = actions[index];
+ for(var i = 0; i < action.objectsToMoves.length; i++) {
+ var moveInfo = action.objectsToMoves[i].moveInfo;
+ var elementIds = $ax.getElementIdsFromPath(action.objectsToMoves[i].objectPath, eventInfo);
+
+ for(var j = 0; j < elementIds.length; j++) {
+ var elementId = elementIds[j];
+ _queueResizeMove(elementId, queueTypes.move, eventInfo, moveInfo);
+ //_addMove(eventInfo, elementId, moveInfo, eventInfo.dragInfo);
+ }
+ }
+ _dispatchAction(eventInfo, actions, index + 1);
+ };
+
+ //var _compoundChildrenShallow = function (id) {
+ // var deep = [];
+ // var children = $ax('#' + id).getChildren()[0].children;
+ // var piecePrefix = id + 'p';
+
+ // for (var i = 0; i < children.length; i++) {
+ // if(children[i].substring(0, id.length + 1) == piecePrefix) {
+ // deep.push(children[i]);
+ // }
+ // }
+ // return deep;
+ //};
+
+ var _addMove = function (elementId, eventInfo, moveInfo, optionsOverride) {
+ var eventInfoCopy = $ax.eventCopy(eventInfo);
+ var idToResizeMoveState = _getIdToResizeMoveState(eventInfoCopy);
+ eventInfoCopy.targetElement = elementId;
+
+ var options = $ax.deepCopy(moveInfo.options);
+ options.easing = optionsOverride.easing;
+ options.duration = optionsOverride.duration;
+ options.dragInfo = eventInfo.dragInfo;
+
+ if($ax.public.fn.IsLayer($obj(elementId).type)) {
+ var childrenIds = $ax.public.fn.getLayerChildrenDeep(elementId, true);
+ if(childrenIds.length == 0) return;
+
+ var animations = [];
+
+ // Get move delta once, then apply to all children
+ animations.push({
+ id: elementId,
+ type: queueTypes.move,
+ func: function () {
+ var layerInfo = $ax('#' + elementId).offsetBoundingRect();
+ //var layerInfo = $ax.public.fn.getWidgetBoundingRect(elementId);
+ var deltaLoc = _getMoveLoc(elementId, moveInfo, eventInfoCopy, optionsOverride.stop, idToResizeMoveState[elementId], options, layerInfo);
+// $ax.event.raiseSyntheticEvent(elementId, "onMove");
+ $ax.visibility.pushContainer(elementId, false);
+
+ options.onComplete = function () {
+ _fireAnimationFromQueue(elementId, queueTypes.move);
+ $ax.visibility.popContainer(elementId, false);
+ };
+
+ $ax('#' + elementId).moveBy(deltaLoc.x, deltaLoc.y, options);
+ }
+ });
+
+ //for(var i = 0; i < childrenIds.length; i++) {
+ // (function(childId) {
+ // animations.push({
+ // id: childId,
+ // type: queueTypes.move,
+ // func: function () {
+ // // Nop, while trying to move as container
+ // //$ax.event.raiseSyntheticEvent(childId, "onMove");
+ // //if($ax.public.fn.IsLayer($obj(childId).type)) _fireAnimationFromQueue(childId, queueTypes.move);
+ // //else $ax('#' + childId).moveBy(deltaLoc.x, deltaLoc.y, moveInfo.options);
+ // }
+ // });
+ // })(childrenIds[i]);
+ //}
+ _addAnimations(animations);
+ } else {
+ _addAnimation(elementId, queueTypes.move, function() {
+ var loc = _getMoveLoc(elementId, moveInfo, eventInfoCopy, optionsOverride.stop, idToResizeMoveState[elementId], options);
+
+// $ax.event.raiseSyntheticEvent(elementId, "onMove");
+ if(loc.moveTo) $ax('#' + elementId).moveTo(loc.x, loc.y, options);
+ else $ax('#' + elementId).moveBy(loc.x, loc.y, options);
+ });
+ }
+ };
+
+ var _moveSingleWidget = function (elementId, delta, options, onComplete) {
+ if(!delta.x && !delta.y) {
+ $ax.action.fireAnimationFromQueue(elementId, $ax.action.queueTypes.move);
+ if (onComplete) onComplete();
+ return;
+ }
+ var fixedInfo = $ax.dynamicPanelManager.getFixedInfo(elementId);
+ var xProp = 'left';
+ var xDiff = '+=';
+ if(fixedInfo) {
+ if(fixedInfo.horizontal == 'right') {
+ xProp = 'right';
+ xDiff = '-=';
+ } else if(fixedInfo.horizontal == 'center') {
+ xProp = 'margin-left';
+ }
+ }
+ var yProp = 'top';
+ var yDiff = '+=';
+ if(fixedInfo) {
+ if(fixedInfo.vertical == 'bottom') {
+ yProp = 'bottom';
+ yDiff = '-=';
+ } else if(fixedInfo.vertical == 'middle') {
+ yProp = 'margin-top';
+ }
+ }
+
+ var css = {};
+ css[xProp] = xDiff + delta.x;
+ css[yProp] = yDiff + delta.y;
+
+ $ax.visibility.moveMovedLocation(elementId, delta.x, delta.y);
+
+ var moveInfo = $ax.move.PrepareForMove(elementId, delta.x, delta.y,false, options);
+ $jobjAll(elementId).animate(css, {
+ duration: options.duration,
+ easing: options.easing,
+ queue: false,
+ complete: function () {
+ if(onComplete) onComplete();
+ if(moveInfo.rootLayer) $ax.visibility.popContainer(moveInfo.rootLayer, false);
+ $ax.dynamicPanelManager.fitParentPanel(elementId);
+ $ax.action.fireAnimationFromQueue(elementId, $ax.action.queueTypes.move);
+ }
+ });
+ }
+
+ var _getMoveLoc = function (elementId, moveInfo, eventInfoCopy, stopInfo, comboState, options, layerInfo) {
+ var moveTo = false;
+ var moveWithThis = false;
+ var xValue = 0;
+ var yValue = 0;
+ var moveResult = comboState.moveResult;
+ var widgetDragInfo = eventInfoCopy.dragInfo;
+ var jobj = $jobj(elementId);
+
+ var startX;
+ var startY;
+
+ switch(moveInfo.moveType) {
+ case "location":
+ // toRatio is ignoring anything before start since that has already taken effect we just know whe have from start to len to finish
+ // getting to the location we want to get to.
+ var toRatio = stopInfo.instant ? 1 : (stopInfo.end - stopInfo.start) / (stopInfo.len - stopInfo.start);
+
+ // If result already caluculated, don't recalculate again, other calculate and save
+ if (moveResult) {
+ xValue = moveResult.x;
+ yValue = moveResult.y;
+ } else {
+ comboState.moveResult = moveResult = { x: $ax.expr.evaluateExpr(moveInfo.xValue, eventInfoCopy), y: $ax.expr.evaluateExpr(moveInfo.yValue, eventInfoCopy) };
+ xValue = moveResult.x;
+ yValue = moveResult.y;
+ }
+ // If this is final stop for this move, then clear out the result so next move won't use it
+ if(stopInfo.instant || stopInfo.end == stopInfo.len) comboState.moveResult = undefined;
+
+ if (layerInfo) {
+ startX = layerInfo.left;
+ startY = layerInfo.top;
+ //} else if ($ax.public.fn.isCompoundVectorHtml(jobj[0])) {
+ // var dimensions = $ax.public.fn.compoundWidgetDimensions(jobj);
+ // startX = dimensions.left;
+ // startY = dimensions.top;
+ } else {
+ var offsetLocation = $ax('#' + elementId).offsetLocation();
+ startX = offsetLocation.left;
+ startY = offsetLocation.top;
+ //startX = $ax('#' + elementId).locRelativeIgnoreLayer(false);
+ //startY = $ax('#' + elementId).locRelativeIgnoreLayer(true);
+ if(jobj.css('position') == 'fixed') {
+ startX -= $(window).scrollLeft();
+ startY -= $(window).scrollTop();
+ }
+ }
+
+ xValue = xValue == '' ? 0 : (xValue - startX) * toRatio;
+ yValue = yValue == '' ? 0 : (yValue - startY) * toRatio;
+
+ break;
+ case "delta":
+ var ratio = stopInfo.instant ? 1 : (stopInfo.end - stopInfo.start) / stopInfo.len;
+
+ // See case location above
+ if(moveResult) {
+ xValue = moveResult.x * ratio;
+ yValue = moveResult.y * ratio;
+ } else {
+ comboState.moveResult = moveResult = { x: $ax.expr.evaluateExpr(moveInfo.xValue, eventInfoCopy), y: $ax.expr.evaluateExpr(moveInfo.yValue, eventInfoCopy) };
+ xValue = moveResult.x * ratio;
+ yValue = moveResult.y * ratio;
+ }
+ if (stopInfo.instant || stopInfo.end == stopInfo.len) comboState.moveResult = undefined;
+
+ break;
+ case "drag":
+ xValue = widgetDragInfo.xDelta;
+ yValue = widgetDragInfo.yDelta;
+ break;
+ case "dragX":
+ xValue = widgetDragInfo.xDelta;
+ yValue = 0;
+ break;
+ case "dragY":
+ xValue = 0;
+ yValue = widgetDragInfo.yDelta;
+ break;
+ case "locationBeforeDrag":
+ var location = widgetDragInfo.movedWidgets[eventInfoCopy.targetElement];
+ if (location) {
+ var axObj = $ax('#' + eventInfoCopy.targetElement);
+ //This may require using the css value
+ var viewportLocation = axObj.viewportLocation();
+ xValue = location.x - viewportLocation.left;
+ yValue = location.y - viewportLocation.top;
+ //xValue = location.x - axObj.left();
+ //yValue = location.y - axObj.top();
+ } else {
+ _fireAnimationFromQueue(eventInfoCopy.srcElement, queueTypes.move);
+ return { x: 0, y: 0 };
+ }
+ //moveTo = true;
+ break;
+ case "withThis":
+ moveWithThis = true;
+ var widgetMoveInfo = $ax.move.GetWidgetMoveInfo();
+ var srcElementId = $ax.getElementIdsFromEventAndScriptId(eventInfoCopy, eventInfoCopy.srcElement)[0];
+ var delta = widgetMoveInfo[srcElementId];
+ options.easing = delta.options.easing;
+ options.duration = delta.options.duration;
+ xValue = delta.x;
+ yValue = delta.y;
+ break;
+ }
+
+ if (options && options.boundaryExpr) {
+ //$ax.public.fn.removeCompound(jobj);
+
+ //if(jobj.css('position') == 'fixed') {
+ // //swap page coordinates with fixed coordinates
+ // options.boundaryExpr.leftExpr.value = options.boundaryExpr.leftExpr.value.replace('.top', '.topfixed').replace('.left', '.leftfixed').replace('.bottom', '.bottomfixed').replace('.right', '.rightfixed');
+ // options.boundaryExpr.leftExpr.stos[0].leftSTO.prop = options.boundaryExpr.leftExpr.stos[0].leftSTO.prop + 'fixed';
+ // options.boundaryStos.boundaryScope.direcval0.value = options.boundaryStos.boundaryScope.direcval0.value.replace('.top', '.topfixed').replace('.left', '.leftfixed').replace('.bottom', '.bottomfixed').replace('.right', '.rightfixed');
+ // options.boundaryStos.boundaryScope.direcval0.stos[0].leftSTO.prop = options.boundaryStos.boundaryScope.direcval0.stos[0].leftSTO.prop + 'fixed';
+ //}
+
+ if(moveWithThis && (xValue || yValue)) {
+ _updateLeftExprVariable(options.boundaryExpr, xValue.toString(), yValue.toString());
+ }
+
+ if(!$ax.expr.evaluateExpr(options.boundaryExpr, eventInfoCopy)) {
+ var boundaryStoInfo = options.boundaryStos;
+ if(boundaryStoInfo) {
+ if(moveWithThis) {
+ var stoScopes = boundaryStoInfo.boundaryScope;
+ if(stoScopes) {
+ for(var s in stoScopes) {
+ var boundaryScope = stoScopes[s];
+ if(!boundaryScope.localVariables) continue;
+
+ if(boundaryScope.localVariables.withx) boundaryScope.localVariables.withx.value = xValue.toString();
+ if(boundaryScope.localVariables.withy) boundaryScope.localVariables.withy.value = yValue.toString();
+ }
+ }
+ }
+
+ if(layerInfo) {
+ startX = layerInfo.left;
+ startY = layerInfo.top;
+ } else {
+ offsetLocation = $ax('#' + elementId).offsetLocation();
+ startX = offsetLocation.left;
+ startY = offsetLocation.top;
+ //startX = $ax('#' + elementId).locRelativeIgnoreLayer(false);
+ //startY = $ax('#' + elementId).locRelativeIgnoreLayer(true);
+ if(jobj.css('position') == 'fixed') {
+ startX -= $(window).scrollLeft();
+ startY -= $(window).scrollTop();
+ }
+ }
+
+ if(boundaryStoInfo.ySto) {
+ var currentTop = layerInfo ? layerInfo.top : startY;
+ var newTop = $ax.evaluateSTO(boundaryStoInfo.ySto, boundaryStoInfo.boundaryScope, eventInfoCopy);
+ if(moveTo) yValue = newTop;
+ else yValue = newTop - currentTop;
+ }
+
+ if(boundaryStoInfo.xSto) {
+ var currentLeft = layerInfo ? layerInfo.left : startX;
+ var newLeft = $ax.evaluateSTO(boundaryStoInfo.xSto, boundaryStoInfo.boundaryScope, eventInfoCopy);
+ if(moveTo) xValue = newLeft;
+ else xValue = newLeft - currentLeft;
+ }
+ }
+ }
+
+ //$ax.public.fn.restoreCompound(jobj);
+ }
+
+ return { x: Number(xValue), y: Number(yValue), moveTo: moveTo };
+ };
+
+ //we will have something like [[Target.right + withX]] for leftExpr, and this function set the value of withX
+ var _updateLeftExprVariable = function (exprTree, xValue, yValue) {
+ if(exprTree.leftExpr && !exprTree.leftExpr.op) {
+ var localVars = exprTree.leftExpr.localVariables;
+ if(localVars) {
+ if(localVars.withx) localVars.withx.value = xValue;
+ if(localVars.withy) localVars.withy.value = yValue;
+ }
+ }
+
+ //traversal
+ if(exprTree.op) {
+ if(exprTree.leftExpr) _updateLeftExprVariable(exprTree.leftExpr, xValue, yValue);
+ if(exprTree.rightExpr) _updateLeftExprVariable(exprTree.rightExpr, xValue, yValue);
+ }
+ }
+
+ var widgetRotationFilter = [
+ $ax.constants.IMAGE_BOX_TYPE, $ax.constants.IMAGE_MAP_REGION_TYPE, $ax.constants.DYNAMIC_PANEL_TYPE,
+ $ax.constants.VECTOR_SHAPE_TYPE, $ax.constants.VERTICAL_LINE_TYPE, $ax.constants.HORIZONTAL_LINE_TYPE
+ ];
+ _actionHandlers.rotateWidget = function(eventInfo, actions, index) {
+ var action = actions[index];
+
+ for(var i = 0; i < action.objectsToRotate.length; i++) {
+ var rotateInfo = action.objectsToRotate[i].rotateInfo;
+ var elementIds = $ax.getElementIdsFromPath(action.objectsToRotate[i].objectPath, eventInfo);
+
+ for(var j = 0; j < elementIds.length; j++) {
+ var elementId = elementIds[j];
+ _queueResizeMove(elementId, queueTypes.rotate, eventInfo, rotateInfo);
+ }
+ }
+
+ _dispatchAction(eventInfo, actions, index + 1);
+ };
+
+ var _addRotate = function (elementId, eventInfo, rotateInfo, options, moveInfo) {
+ var idToResizeMoveState = _getIdToResizeMoveState(eventInfo);
+ rotateInfo = $ax.deepCopy(rotateInfo);
+ rotateInfo.options.easing = options.easing;
+ rotateInfo.options.duration = options.duration;
+
+ var eventInfoCopy = $ax.eventCopy(eventInfo);
+ eventInfoCopy.targetElement = elementId;
+
+ //calculate degree value at start of animation
+ var rotateDegree;
+ var offset = {};
+ var eval = function(boundingRect) {
+ rotateDegree = parseFloat($ax.expr.evaluateExpr(rotateInfo.degree, eventInfoCopy));
+ offset.x = Number($ax.expr.evaluateExpr(rotateInfo.offsetX, eventInfoCopy));
+ offset.y = Number($ax.expr.evaluateExpr(rotateInfo.offsetY, eventInfoCopy));
+ if(!rotateInfo.options.clockwise) rotateDegree = -rotateDegree;
+
+ _updateOffset(offset, rotateInfo.anchor, boundingRect);
+ }
+
+ if(moveInfo) {
+ var moveOptions = { dragInfo: eventInfoCopy.dragInfo, duration: options.duration, easing: options.easing, boundaryExpr: moveInfo.options.boundaryExpr, boundaryStos: moveInfo.options.boundaryStos };
+ }
+
+ var obj = $obj(elementId);
+
+ if($ax.public.fn.IsLayer(obj.type)) {
+ var childrenIds = $ax.public.fn.getLayerChildrenDeep(elementId, true, true);
+ if(childrenIds.length == 0) return;
+
+ var animations = [];
+ //get center point of the group, and degree delta
+ var centerPoint, degreeDelta, moveDelta;
+ animations.push({
+ id: elementId,
+ type: queueTypes.rotate,
+ func: function () {
+ var boundingRect = $ax('#' + elementId).offsetBoundingRect();
+ //var boundingRect = $axure.fn.getWidgetBoundingRect(elementId);
+ eval(boundingRect);
+ centerPoint = boundingRect.centerPoint;
+ centerPoint.x += offset.x;
+ centerPoint.y += offset.y;
+ degreeDelta = _initRotateLayer(elementId, rotateInfo, rotateDegree, options, options.stop);
+ _fireAnimationFromQueue(elementId, queueTypes.rotate);
+
+ moveDelta = { x: 0, y: 0 };
+ if (moveInfo) {
+ moveDelta = _getMoveLoc(elementId, moveInfo, eventInfoCopy, options.moveStop, idToResizeMoveState[elementId], moveOptions, boundingRect);
+ if (moveDelta.moveTo) {
+ moveDelta.x -= $ax.getNumFromPx($jobj(elementId).css('left'));
+ moveDelta.y -= $ax.getNumFromPx($jobj(elementId).css('top'));
+ }
+ $ax.event.raiseSyntheticEvent(elementId, 'onMove');
+ }
+ }
+ });
+
+ for(var idIndex = 0; idIndex < childrenIds.length; idIndex++) {
+ var childId = childrenIds[idIndex];
+ (function(id) {
+ var childObj = $obj(id);
+ var rotate = $.inArray(childObj.type, widgetRotationFilter) != -1;
+
+ var isLayer = $ax.public.fn.IsLayer(childObj.type);
+ animations.push({
+ id: id,
+ type: queueTypes.rotate,
+ func: function() {
+ $ax.event.raiseSyntheticEvent(id, "onRotate");
+ if(isLayer) _fireAnimationFromQueue(id, queueTypes.rotate);
+ else $ax('#' + id).circularMoveAndRotate(degreeDelta, options, centerPoint.x, centerPoint.y, rotate, moveDelta);
+ }
+ });
+ if(!isLayer) animations.push({ id: id, type: queueTypes.move, func: function() {} });
+ })(childId);
+ }
+
+ _addAnimations(animations);
+ } else {
+ animations = [];
+ animations.push({
+ id: elementId,
+ type: queueTypes.rotate,
+ func: function () {
+ var jobj = $jobj(elementId);
+ var unrotatedDim = { width: $ax.getNumFromPx(jobj.css('width')), height: $ax.getNumFromPx(jobj.css('height')) };
+ eval(unrotatedDim);
+ var delta = { x: 0, y: 0 };
+ if(moveInfo) {
+ delta = _getMoveLoc(elementId, moveInfo, eventInfoCopy, options.moveStop, idToResizeMoveState[elementId], moveOptions);
+ if(delta.moveTo) {
+ delta.x -= $ax.getNumFromPx($jobj(elementId).css('left'));
+ delta.y -= $ax.getNumFromPx($jobj(elementId).css('top'));
+ }
+ }
+
+ $ax.event.raiseSyntheticEvent(elementId, 'onRotate');
+ if(offset.x == 0 && offset.y == 0) _rotateSingle(elementId, rotateDegree, rotateInfo.rotateType == 'location', delta, options, options.stop, true);
+ else _rotateSingleOffset(elementId, rotateDegree, rotateInfo.rotateType == 'location', delta, { x: offset.x, y: offset.y }, options, options.stop);
+ if(moveInfo) $ax.event.raiseSyntheticEvent(elementId, 'onMove');
+ }
+ });
+ animations.push({ id: elementId, type: queueTypes.move, func: function () { } });
+
+ _addAnimations(animations);
+ }
+ }
+
+ var _updateOffset = function(offset, anchor, boundingRect) {
+ if (anchor.indexOf('left') != -1) offset.x -= boundingRect.width / 2;
+ if (anchor.indexOf('right') != -1) offset.x += boundingRect.width / 2;
+ if (anchor.indexOf('top') != -1) offset.y -= boundingRect.height / 2;
+ if (anchor.indexOf('bottom') != -1) offset.y += boundingRect.height / 2;
+ }
+
+ var _rotateSingle = function(elementId, rotateDegree, rotateTo, delta, options, stop, handleMove) {
+ var degreeDelta = _applyRotateStop(rotateDegree, $ax.move.getRotationDegree(elementId), rotateTo, stop);
+ $ax('#' + elementId).rotate(degreeDelta, options.easing, options.duration, false, true);
+ if(handleMove) {
+ if (delta.x || delta.y) _moveSingleWidget(elementId, delta, options);
+ else $ax.action.fireAnimationFromQueue(elementId, $ax.action.queueTypes.move);
+ }
+ };
+
+ var _rotateSingleOffset = function (elementId, rotateDegree, rotateTo, delta, offset, options, stop, resizeOffset) {
+ var obj = $obj(elementId);
+ var currRotation = $ax.move.getRotationDegree(elementId);
+
+ // Need to fix offset. Want to to stay same place on widget after rotation, so need to take the offset and rotate it to where it should be.
+ if(currRotation) {
+ offset = $axure.fn.getPointAfterRotate(currRotation, offset, { x: 0, y: 0 });
+ }
+
+ var degreeDelta = _applyRotateStop(rotateDegree, currRotation, rotateTo, stop);
+ var widgetCenter = $ax('#' + elementId).offsetBoundingRect().centerPoint;
+ //var widgetCenter = $axure.fn.getWidgetBoundingRect(elementId).centerPoint;
+
+ var rotate = $.inArray(obj.type, widgetRotationFilter) != -1;
+ $ax('#' + elementId).circularMoveAndRotate(degreeDelta, options, widgetCenter.x + offset.x, widgetCenter.y + offset.y, rotate, delta, resizeOffset);
+ }
+
+ var _applyRotateStop = function(rotateDegree, currRotation, to, stop) {
+ var degreeDelta;
+ var ratio;
+ if(to) {
+ degreeDelta = rotateDegree - currRotation;
+ ratio = stop.instant ? 1 : (stop.end - stop.start) / (stop.len - stop.start);
+ } else {
+ degreeDelta = rotateDegree;
+ ratio = stop.instant ? 1 : (stop.end - stop.start) / stop.len;
+ }
+
+ return degreeDelta * ratio;
+ }
+
+
+ var _initRotateLayer = function(elementId, rotateInfo, rotateDegree, options, stop) {
+ var layerDegree = $jobj(elementId).data('layerDegree');
+ if (layerDegree === undefined) layerDegree = 0;
+ else layerDegree = parseFloat(layerDegree);
+
+ var to = rotateInfo.rotateType == 'location';
+ var newDegree = to ? rotateDegree : layerDegree + rotateDegree;
+ var degreeDelta = newDegree - layerDegree;
+
+ var ratio = stop.instant ? 1 : (stop.end - stop.start) / (stop.len - stop.start);
+ degreeDelta *= ratio;
+
+ $jobj(elementId).data('layerDegree', newDegree);
+ $ax.event.raiseSyntheticEvent(elementId, "onRotate");
+
+ return degreeDelta;
+ }
+
+ _actionHandlers.setWidgetSize = function(eventInfo, actions, index) {
+ var action = actions[index];
+ for(var i = 0; i < action.objectsToResize.length; i++) {
+ var resizeInfo = action.objectsToResize[i].sizeInfo;
+ var objPath = action.objectsToResize[i].objectPath;
+ if(objPath == 'thisItem') {
+ var thisId = eventInfo.srcElement;
+ var repeaterId = $ax.getParentRepeaterFromElementId(thisId);
+ var itemId = $ax.repeater.getItemIdFromElementId(thisId);
+ var currSize = $ax.repeater.getItemSize(repeaterId, itemId);
+ var newSize = _getSizeFromInfo(resizeInfo, eventInfo, currSize.width, currSize.height);
+ $ax.repeater.setItemSize(repeaterId, itemId, newSize.width, newSize.height);
+
+ continue;
+ }
+
+ var elementIds = $ax.getElementIdsFromPath(objPath, eventInfo);
+
+ for(var j = 0; j < elementIds.length; j++) {
+ var elementId = elementIds[j];
+ _queueResizeMove(elementId, queueTypes.resize, eventInfo, resizeInfo);
+ //_addResize(elementId, resizeInfo);
+ }
+ }
+ _dispatchAction(eventInfo, actions, index + 1);
+ };
+
+ // Move info undefined unless this move/resize actions are being merged
+ var _addResize = function(elementId, eventInfo, resizeInfo, options, moveInfo, rotateInfo) {
+ var axObject = $obj(elementId);
+ resizeInfo = $ax.deepCopy(resizeInfo);
+ resizeInfo.easing = options.easing;
+ resizeInfo.duration = options.duration;
+
+ var eventInfoCopy = $ax.eventCopy(eventInfo);
+ eventInfoCopy.targetElement = elementId;
+
+ var moves = moveInfo || resizeInfo.anchor != "top left" || ($ax.public.fn.IsDynamicPanel(axObject.type) &&
+ ((axObject.fixedHorizontal && axObject.fixedHorizontal == 'center') || (axObject.fixedVertical && axObject.fixedVertical == 'middle'))) ||
+ (rotateInfo && (rotateInfo.offsetX || rotateInfo.offsetY));
+
+ if(moveInfo) {
+ var moveOptions = { dragInfo: eventInfoCopy.dragInfo, duration: options.duration, easing: options.easing, boundaryExpr: moveInfo.options.boundaryExpr, boundaryStos: moveInfo.options.boundaryStos };
+ }
+
+ var idToResizeMoveState = _getIdToResizeMoveState(eventInfoCopy);
+
+ var animations = [];
+ if($ax.public.fn.IsLayer(axObject.type)) {
+ moves = true; // Assume widgets will move will layer, even though not all widgets may move
+ var childrenIds = $ax.public.fn.getLayerChildrenDeep(elementId, true, true);
+ if(childrenIds.length === 0) return;
+ // Need to wait to calculate new size, until time to animate, but animates are in separate queues
+ // best option seems to be to calculate in a "animate" for the layer itself and all children will use that.
+ // May just have to be redundant if this doesn't work well.
+
+ var boundingRect, widthChangedPercent, heightChangedPercent, unchanged, deltaLoc, degreeDelta, resizeOffset;
+ animations.push({
+ id: elementId,
+ type: queueTypes.resize,
+ func: function () {
+ $ax.visibility.pushContainer(elementId, false);
+ boundingRect = $ax('#' + elementId).offsetBoundingRect();
+ //boundingRect = $ax.public.fn.getWidgetBoundingRect(elementId);
+ var size = _getSizeFromInfo(resizeInfo, eventInfoCopy, boundingRect.width, boundingRect.height, elementId);
+ deltaLoc = { x: 0, y: 0 };
+
+ var stop = options.stop;
+ var ratio = stop.instant ? 1 : (stop.end - stop.start) / (stop.len - stop.start);
+ widthChangedPercent = Math.round(size.width - boundingRect.width) / boundingRect.width * ratio;
+ heightChangedPercent = Math.round(size.height - boundingRect.height) / boundingRect.height * ratio;
+ resizeOffset = _applyAnchorToResizeOffset(widthChangedPercent * boundingRect.width, heightChangedPercent * boundingRect.height, resizeInfo.anchor);
+ if(stop.instant || stop.end == stop.len) idToResizeMoveState[elementId].resizeResult = undefined;
+
+ unchanged = widthChangedPercent === 0 && heightChangedPercent === 0;
+ $ax.event.raiseSyntheticEvent(elementId, 'onResize');
+ _fireAnimationFromQueue(elementId, queueTypes.resize);
+ }
+ });
+
+ if(moveInfo) animations.push({
+ id: elementId,
+ type: queueTypes.move,
+ func: function() {
+ deltaLoc = _getMoveLoc(elementId, moveInfo, eventInfoCopy, options.moveStop, idToResizeMoveState[elementId], moveOptions, boundingRect);
+ $ax.visibility.pushContainer(elementId, false);
+ _fireAnimationFromQueue(elementId, queueTypes.move);
+ $ax.event.raiseSyntheticEvent(elementId, 'onMove');
+ }
+ });
+ if (rotateInfo) animations.push({
+ id: elementId,
+ type: queueTypes.rotate,
+ func: function () {
+ resizeOffset = _applyAnchorToResizeOffset(widthChangedPercent * boundingRect.width, heightChangedPercent * boundingRect.height, resizeInfo.anchor);
+ var rotateDegree = parseFloat($ax.expr.evaluateExpr(rotateInfo.degree, eventInfoCopy));
+ degreeDelta = _initRotateLayer(elementId, rotateInfo, rotateDegree, options, options.rotateStop);
+ _fireAnimationFromQueue(elementId, queueTypes.rotate);
+ $ax.event.raiseSyntheticEvent(elementId, 'onRotate');
+ }
+ });
+
+ var completeCount = childrenIds.length*2; // Because there is a resize and move complete, it needs to be doubled
+ for(var idIndex = 0; idIndex < childrenIds.length; idIndex++) {
+ // Need to use scoping trick here to make sure childId doesn't change on next loop
+ (function(childId) {
+ //use ax obj to get width and height, jquery css give us the value without border
+ var isLayer = $ax.public.fn.IsLayer($obj(childId).type);
+ var rotate = $.inArray($obj(childId).type, widgetRotationFilter) != -1;
+ animations.push({
+ id: childId,
+ type: queueTypes.resize,
+ func: function() {
+ //$ax.event.raiseSyntheticEvent(childId, 'onResize');
+ if(isLayer) {
+ completeCount -= 2;
+ _fireAnimationFromQueue(childId, queueTypes.resize);
+ $ax.event.raiseSyntheticEvent(childId, 'onResize');
+ } else {
+ var currDeltaLoc = { x: deltaLoc.x, y: deltaLoc.y };
+ var resizeDeltaMove = { x: 0, y: 0 };
+ var css = _getCssForResizingLayerChild(childId, resizeInfo.anchor, boundingRect, widthChangedPercent, heightChangedPercent, resizeDeltaMove);
+ var onComplete = function() {
+ if(--completeCount == 0) $ax.visibility.popContainer(elementId, false);
+ };
+ $ax('#' + childId).resize(css, resizeInfo, true, moves, onComplete);
+ if(rotateInfo) {
+ var offset = { x: Number($ax.expr.evaluateExpr(rotateInfo.offsetX, eventInfoCopy)), y: Number($ax.expr.evaluateExpr(rotateInfo.offsetY, eventInfo)) };
+ _updateOffset(offset, resizeInfo.anchor, boundingRect);
+ var centerPoint = { x: boundingRect.centerPoint.x + offset.x, y: boundingRect.centerPoint.y + offset.y };
+ $ax('#' + childId).circularMoveAndRotate(degreeDelta, options, centerPoint.x, centerPoint.y, rotate, currDeltaLoc, resizeOffset, resizeDeltaMove, onComplete);
+ } else {
+ currDeltaLoc.x += resizeDeltaMove.x;
+ currDeltaLoc.y += resizeDeltaMove.y;
+ _moveSingleWidget(childId, currDeltaLoc, options, onComplete);
+ }
+ }
+ }
+ });
+ if(!isLayer) animations.push({ id: childId, type: queueTypes.move, func: function () {} });
+ if(!isLayer && rotateInfo) animations.push({ id: childId, type: queueTypes.rotate, func: function () {} });
+ })(childrenIds[idIndex]);
+ }
+ } else {
+ // Not func, obj with func
+ animations.push({
+ id: elementId,
+ type: queueTypes.resize,
+ func: function() {
+ //textarea can be resized manully by the user, but doesn't update div size yet, so doing this for now.
+ //alternatively axquery get for size can account for this
+
+ var sizeId = $ax.public.fn.IsTextArea(axObject.type) ? $jobj(elementId).children('textarea').attr('id') : elementId;
+ var oldSize = $ax('#' + sizeId).size();
+ var oldWidth = oldSize.width;
+ var oldHeight = oldSize.height;
+
+ var stop = options.stop;
+ var ratio = stop.instant ? 1 : (stop.end - stop.start) / (stop.len - stop.start);
+
+ var size = _getSizeFromInfo(resizeInfo, eventInfoCopy, oldWidth, oldHeight, elementId);
+ var newWidth = size.width;
+ var newHeight = size.height;
+ var deltaWidth = Math.round(newWidth - oldWidth) * ratio;
+ var deltaHeight = Math.round(newHeight - oldHeight) * ratio;
+ newWidth = oldWidth + deltaWidth;
+ newHeight = oldHeight + deltaHeight;
+
+ var delta = { x: 0, y: 0 };
+ if(moveInfo) {
+ delta = _getMoveLoc(elementId, moveInfo, eventInfoCopy, options.moveStop, idToResizeMoveState[elementId], moveOptions);
+ if (delta.moveTo) {
+ delta.x -= $ax.getNumFromPx($jobj(elementId).css('left'));
+ delta.y -= $ax.getNumFromPx($jobj(elementId).css('top'));
+ }
+ }
+
+ var rotateHandlesMove = false;
+ var offset = { x: 0, y: 0 };
+ if(rotateInfo) {
+ offset.x = Number($ax.expr.evaluateExpr(rotateInfo.offsetX, eventInfoCopy));
+ offset.y = Number($ax.expr.evaluateExpr(rotateInfo.offsetY, eventInfoCopy));
+ _updateOffset(offset, rotateInfo.anchor, $ax('#' + elementId).offsetBoundingRect());
+ //_updateOffset(offset, rotateInfo.anchor, $axure.fn.getWidgetBoundingRect(elementId));
+ rotateHandlesMove = Boolean(rotateInfo && (offset.x || offset.y || rotateInfo.anchor != 'center'));
+ $ax.event.raiseSyntheticEvent(elementId, 'onRotate');
+ }
+
+ var css = null;
+ var rootLayer = null;
+ if(deltaHeight != 0 || deltaWidth != 0) {
+ rootLayer = $ax.move.getRootLayer(elementId);
+ if(rootLayer) $ax.visibility.pushContainer(rootLayer, false);
+ css = _getCssForResizingWidget(elementId, eventInfoCopy, resizeInfo.anchor, newWidth, newHeight, oldWidth, oldHeight, delta, options.stop, !rotateHandlesMove);
+ idToResizeMoveState[elementId].resizeResult = undefined;
+ }
+
+ if(rotateInfo) {
+ var rotateDegree = parseFloat($ax.expr.evaluateExpr(rotateInfo.degree, eventInfoCopy));
+
+ if(rotateHandlesMove) {
+ var resizeOffset = _applyAnchorToResizeOffset(deltaWidth, deltaHeight, rotateInfo.anchor);
+ _rotateSingleOffset(elementId, rotateDegree, rotateInfo.rotateType == 'location', delta, offset, options, options.rotateStop, resizeOffset);
+ } else {
+ // Not handling move so pass in nop delta
+ _rotateSingle(elementId, rotateDegree, rotateInfo.rotateType == 'location', { x: 0, y: 0 }, options, options.rotateStop);
+ if (moves) _fireAnimationFromQueue(elementId, queueTypes.move);
+ }
+ } else if(!css && moves) _moveSingleWidget(elementId, delta, options);
+
+ // Have to do it down here to make sure move info is registered
+ if(moveInfo) $ax.event.raiseSyntheticEvent(elementId, 'onMove');
+
+ //$ax.event.raiseSyntheticEvent(elementId, 'onResize');
+ if (css) {
+ $ax('#' + elementId).resize(css, resizeInfo, true, moves, function () {
+ if(rootLayer) $ax.visibility.popContainer(rootLayer, false);
+ });
+ } else {
+ _fireAnimationFromQueue(elementId, queueTypes.resize);
+
+ $ax.event.raiseSyntheticEvent(elementId, 'onResize');
+ }
+ }
+ });
+ // Nop move (move handled by resize)
+ if(rotateInfo) animations.push({ id: elementId, type: queueTypes.rotate, func: function () { } });
+ if(moves) animations.push({ id: elementId, type: queueTypes.move, func: function () { } });
+ }
+
+ _addAnimations(animations);
+ };
+
+ var _applyAnchorToResizeOffset = function (deltaWidth, deltaHeight, anchor) {
+ var offset = {};
+ if (anchor.indexOf('left') != -1) offset.x = -deltaWidth / 2;
+ else if (anchor.indexOf('right') != -1) offset.x = deltaWidth / 2;
+ if (anchor.indexOf('top') != -1) offset.y = -deltaHeight / 2;
+ else if (anchor.indexOf('bottom') != -1) offset.y = deltaHeight / 2;
+
+ return offset;
+ }
+
+ //var _getOldAndNewSize = function (resizeInfo, eventInfo, targetElement) {
+ // var axObject = $obj(targetElement);
+ // var oldWidth, oldHeight;
+ // //textarea can be resized manully by the user, use the textarea child to get the current size
+ // //because this new size may not be reflected on its parents yet
+ // if ($ax.public.fn.IsTextArea(axObject.type)) {
+ // var jObject = $jobj(elementId);
+ // var textObj = $ax('#' + jObject.children('textarea').attr('id'));
+ // //maybe we shouldn't use ax obj to get width and height here anymore...
+ // oldWidth = textObj.width();
+ // oldHeight = textObj.height();
+ // } else {
+ // oldWidth = $ax('#' + elementId).width();
+ // oldHeight = $ax('#' + elementId).height();
+ // }
+
+ // var size = _getSizeFromInfo(resizeInfo, eventInfo, oldHeight, oldWidth, elementId);
+ // return { oldWidth: oldWidth, oldHeight: oldHeight, newWidth: size.width, newHeight: size.height, change: oldWidth != size.width || oldHeight != size.height };
+ //}
+
+ var _getSizeFromInfo = function(resizeInfo, eventInfo, oldWidth, oldHeight, targetElement) {
+ var oldTarget = eventInfo.targetElement;
+ eventInfo.targetElement = targetElement;
+
+ var state = _getIdToResizeMoveState(eventInfo)[targetElement];
+ if(state && state.resizeResult) return state.resizeResult;
+
+ var width = $ax.expr.evaluateExpr(resizeInfo.width, eventInfo);
+ var height = $ax.expr.evaluateExpr(resizeInfo.height, eventInfo);
+ eventInfo.targetElement = oldTarget;
+
+
+ // If either one is not a number, use the old value
+ width = width != "" ? Number(width) : oldWidth;
+ height = height != "" ? Number(height) : oldHeight;
+
+ width = isNaN(width) ? oldWidth : width;
+ height = isNaN(height) ? oldHeight : height;
+
+ // can't be negative
+ var result = { width: Math.max(width, 0), height: Math.max(height, 0) };
+ if(state) state.resizeResult = result;
+ return result;
+ }
+
+ //var _queueResize = function (elementId, css, resizeInfo) {
+ // var resizeFunc = function() {
+ // $ax('#' + elementId).resize(css, resizeInfo, true);
+ // //$ax.public.fn.resize(elementId, css, resizeInfo, true);
+ // };
+ // var obj = $obj(elementId);
+ // var moves = resizeInfo.anchor != "top left" || ($ax.public.fn.IsDynamicPanel(obj.type) && ((obj.fixedHorizontal && obj.fixedHorizontal == 'center') || (obj.fixedVertical && obj.fixedVertical == 'middle')))
+ // if(!moves) {
+ // _addAnimation(elementId, queueTypes.resize, resizeFunc);
+ // } else {
+ // var animations = [];
+ // animations[0] = { id: elementId, type: queueTypes.resize, func: resizeFunc };
+ // animations[1] = { id: elementId, type: queueTypes.move, func: function() {}}; // Nop func - resize handles move and firing from queue
+ // _addAnimations(animations);
+ // }
+ //};
+
+ //should clean this function and
+ var _getCssForResizingWidget = function (elementId, eventInfo, anchor, newWidth, newHeight, oldWidth, oldHeight, delta, stop, handleMove) {
+ var ratio = stop.instant ? 1 : (stop.end - stop.start) / (stop.len - stop.start);
+ var deltaWidth = (newWidth - oldWidth) * ratio;
+ var deltaHeight = (newHeight - oldHeight) * ratio;
+ if(stop.instant || stop.end == stop.len) {
+ var idToResizeMoveState = _getIdToResizeMoveState(eventInfo);
+ if(idToResizeMoveState[elementId]) idToResizeMoveState[elementId].resizeResult = undefined;
+ }
+
+ var css = {};
+ css.height = oldHeight + deltaHeight;
+
+ var obj = $obj(elementId);
+ //if it's 100% width, don't change its width
+ if($ax.dynamicPanelManager.isPercentWidthPanel(obj)) var is100Dp = true;
+ else css.width = oldWidth + deltaWidth;
+
+ var jobj = $jobj(elementId);
+ //if this is pinned dp, we will mantain the pin, no matter how you resize it; so no need changes left or top
+ //NOTE: currently only pinned DP has position == fixed
+ if(jobj.css('position') == 'fixed') {
+ if(obj.fixedHorizontal && obj.fixedHorizontal == 'center') css['margin-left'] = '+=' + delta.x;
+ if(obj.fixedVertical && obj.fixedVertical == 'middle') css['margin-top'] = '+=' + delta.y;
+ return css;
+ }
+
+ // If it is pinned, but temporarily not fixed because it is wrappen in a container, then just make sure to anchor it correctly
+ if(obj.fixedVertical) {
+ if(obj.fixedVertical == 'middle') anchor = obj.fixedHorizontal;
+ else anchor = obj.fixedVertical + (obj.fixedHorizontal == 'center' ? '' : ' ' + obj.fixedHorizontal);
+
+ }
+
+ //use position relative to parents
+ //var position = obj.generateCompound ? $ax.public.fn.getWidgetBoundingRect(elementId) : $ax.public.fn.getPositionRelativeToParent(elementId);
+
+
+ var locationShift;
+ switch(anchor) {
+ case "top left":
+ locationShift = { x: 0, y: 0 }; break;
+ case "top":
+ locationShift = { x: -deltaWidth / 2.0, y: 0.0 }; break;
+ case "top right":
+ locationShift = { x: -deltaWidth, y: 0.0 }; break;
+ case "left":
+ locationShift = { x: 0.0, y: -deltaHeight / 2.0 }; break;
+ case "center":
+ locationShift = { x: -deltaWidth / 2.0, y: -deltaHeight / 2.0 }; break;
+ case "right":
+ locationShift = { x: -deltaWidth, y: -deltaHeight / 2.0 }; break;
+ case "bottom left":
+ locationShift = { x: 0.0, y: -deltaHeight }; break;
+ case "bottom":
+ locationShift = { x: -deltaWidth/2.0, y: -deltaHeight }; break;
+ case "bottom right":
+ locationShift = { x: -deltaWidth, y: -deltaHeight }; break;
+ }
+
+ if(handleMove) {
+ if(jobj.css('position') === 'absolute') {
+ css.left = $ax.getNumFromPx(jobj.css('left')) + locationShift.x + delta.x;
+ css.top = $ax.getNumFromPx(jobj.css('top')) + locationShift.y + delta.y;
+ } else {
+ var axQuery = $ax('#' + elementId);
+ var offsetLocation = axQuery.offsetLocation();
+ css.left = offsetLocation.left + locationShift.x + delta.x;
+ css.top = offsetLocation.top + locationShift.y + delta.y;
+ //css.left = axQuery.left(true) + locationShift.x + delta.x;
+ //css.top = axQuery.top(true) + locationShift.y + delta.y;
+ }
+ } else {
+ delta.x += locationShift.x;
+ delta.y += locationShift.y;
+ }
+
+ css.deltaX = locationShift.x + delta.x;
+ css.deltaY = locationShift.y + delta.y;
+
+ return css;
+ };
+
+
+ var _getCssForResizingLayerChild = function (elementId, anchor, layerBoundingRect, widthChangedPercent, heightChangedPercent, deltaLoc) {
+ var boundingRect = $ax('#' + elementId).offsetBoundingRect();
+ //var boundingRect = $ax.public.fn.getWidgetBoundingRect(elementId);
+ var childCenterPoint = boundingRect.centerPoint;
+
+ var currentSize = $ax('#' + elementId).size();
+ var newWidth = currentSize.width + currentSize.width * widthChangedPercent;
+ var newHeight = currentSize.height + currentSize.height * heightChangedPercent;
+
+ var css = {};
+ css.height = newHeight;
+
+ var obj = $obj(elementId);
+ //if it's 100% width, don't change its width and left
+ var changeLeft = true;
+ if($ax.dynamicPanelManager.isPercentWidthPanel(obj)) changeLeft = false;
+ else css.width = newWidth;
+
+ var jobj = $jobj(elementId);
+ //if this is pinned dp, we will mantain the pin, no matter how you resize it; so no need changes left or top
+ //NOTE: currently only pinned DP has position == fixed
+ if(jobj.css('position') == 'fixed') return css;
+ //use bounding rect position relative to parents to calculate delta
+ //var axObj = $ax('#' + elementId);
+ // This will be absolute world coordinates, but we want body coordinates.
+ var offsetLocation = $ax('#' + elementId).offsetLocation();
+ var currentLeft = offsetLocation.left;
+ var currentTop = offsetLocation.top;
+ //var currentLeft = axObj.locRelativeIgnoreLayer(false);
+ //var currentTop = axObj.locRelativeIgnoreLayer(true);
+
+ var resizable = $ax.public.fn.IsResizable(obj.type);
+ if(anchor.indexOf("top") > -1) {
+ var topDelta = (currentTop - layerBoundingRect.top) * heightChangedPercent;
+ if(!resizable && Math.round(topDelta)) topDelta += currentSize.height * heightChangedPercent;
+ } else if(anchor.indexOf("bottom") > -1) {
+ if(resizable) topDelta = (currentTop - layerBoundingRect.bottom) * heightChangedPercent;
+ else {
+ var bottomDelta = Math.round(currentTop + currentSize.height - layerBoundingRect.bottom) * heightChangedPercent;
+ if(bottomDelta) topDelta = bottomDelta - currentSize.height * heightChangedPercent;
+ else topDelta = 0;
+ }
+ } else { //center vertical
+ if(resizable) topDelta = (childCenterPoint.y - layerBoundingRect.centerPoint.y)*heightChangedPercent - currentSize.height*heightChangedPercent/2;
+ else {
+ var centerTopChange = Math.round(childCenterPoint.y - layerBoundingRect.centerPoint.y)*heightChangedPercent;
+ if(centerTopChange > 0) topDelta = centerTopChange + Math.abs(currentSize.height * heightChangedPercent / 2);
+ else if(centerTopChange < 0) topDelta = centerTopChange - Math.abs(currentSize.height * heightChangedPercent / 2);
+ else topDelta = 0;
+ }
+ }
+
+ if(changeLeft) {
+ if(anchor.indexOf("left") > -1) {
+ var leftDelta = (currentLeft - layerBoundingRect.left) * widthChangedPercent;
+ if(!resizable && Math.round(leftDelta)) leftDelta += currentSize.width * widthChangedPercent;
+ } else if(anchor.indexOf("right") > -1) {
+ if(resizable) leftDelta = (currentLeft - layerBoundingRect.right) * widthChangedPercent;
+ else {
+ var rightDelta = Math.round(currentLeft + currentSize.width - layerBoundingRect.right) * widthChangedPercent;
+ if(rightDelta) leftDelta = rightDelta - currentSize.width * widthChangedPercent;
+ else leftDelta = 0;
+ }
+ } else { //center horizontal
+ if(resizable) leftDelta = (childCenterPoint.x - layerBoundingRect.centerPoint.x)*widthChangedPercent - currentSize.width*widthChangedPercent/2;
+ else {
+ var centerLeftChange = Math.round(childCenterPoint.x - layerBoundingRect.centerPoint.x) * widthChangedPercent;
+ if(centerLeftChange > 0) leftDelta = centerLeftChange + Math.abs(currentSize.width * widthChangedPercent / 2);
+ else if(centerLeftChange < 0) leftDelta = centerLeftChange - Math.abs(currentSize.width * widthChangedPercent / 2);
+ else leftDelta = 0;
+ }
+ }
+ }
+
+ if(topDelta) deltaLoc.y += topDelta;
+ if(leftDelta && changeLeft) deltaLoc.x += leftDelta;
+
+ return css;
+ };
+
+ _actionHandlers.setPanelOrder = function(eventInfo, actions, index) {
+ var action = actions[index];
+ for(var i = 0; i < action.panelPaths.length; i++) {
+ var func = action.panelPaths[i].setOrderInfo.bringToFront ? 'bringToFront' : 'sendToBack';
+ var elementIds = $ax.getElementIdsFromPath(action.panelPaths[i].panelPath, eventInfo);
+ for(var j = 0; j < elementIds.length; j++) $ax('#' + elementIds[j])[func]();
+ }
+
+ _dispatchAction(eventInfo, actions, index + 1);
+ };
+
+ _actionHandlers.modifyDataSetEditItems = function(eventInfo, actions, index) {
+ var action = actions[index];
+ var add = action.repeatersToAddTo;
+ var repeaters = add || action.repeatersToRemoveFrom;
+ var itemId;
+ for(var i = 0; i < repeaters.length; i++) {
+ var data = repeaters[i];
+ // Grab the first one because repeaters must have only element id, as they cannot be inside repeaters
+ // or none if unplaced
+ var id = $ax.getElementIdsFromPath(data.path, eventInfo)[0];
+ if(!id) continue;
+
+ if(data.addType == 'this') {
+ var scriptId = $ax.repeater.getScriptIdFromElementId(eventInfo.srcElement);
+ itemId = $ax.repeater.getItemIdFromElementId(eventInfo.srcElement);
+ var repeaterId = $ax.getParentRepeaterFromScriptId(scriptId);
+ if(add) $ax.repeater.addEditItems(repeaterId, [itemId]);
+ else $ax.repeater.removeEditItems(repeaterId, [itemId]);
+ } else if(data.addType == 'all') {
+ var allItems = $ax.repeater.getAllItemIds(id);
+ if(add) $ax.repeater.addEditItems(id, allItems);
+ else $ax.repeater.removeEditItems(id, allItems);
+ } else {
+ var oldTarget = eventInfo.targetElement;
+ var itemIds = $ax.repeater.getAllItemIds(id);
+ var itemIdsToAdd = [];
+ for(var j = 0; j < itemIds.length; j++) {
+ itemId = itemIds[j];
+ eventInfo.targetElement = $ax.repeater.createElementId(id, itemId);
+ if($ax.expr.evaluateExpr(data.query, eventInfo) == "true") {
+ itemIdsToAdd[itemIdsToAdd.length] = String(itemId);
+ }
+ eventInfo.targetElement = oldTarget;
+ }
+ if(add) $ax.repeater.addEditItems(id, itemIdsToAdd);
+ else $ax.repeater.removeEditItems(id, itemIdsToAdd);
+ }
+ }
+
+ _dispatchAction(eventInfo, actions, index + 1);
+ };
+
+ _action.repeaterInfoNames = { addItemsToDataSet: 'dataSetsToAddTo', deleteItemsFromDataSet: 'dataSetItemsToRemove', updateItemsInDataSet: 'dataSetsToUpdate',
+ addFilterToRepeater: 'repeatersToAddFilter', removeFilterFromRepeater: 'repeatersToRemoveFilter',
+ addSortToRepeater: 'repeaterToAddSort', removeSortFromRepeater: 'repeaterToRemoveSort',
+ setRepeaterToPage: 'repeatersToSetPage', setItemsPerRepeaterPage: 'repeatersToSetItemCount'
+ };
+
+ _actionHandlers.addItemsToDataSet = function(eventInfo, actions, index) {
+ var action = actions[index];
+ for(var i = 0; i < action.dataSetsToAddTo.length; i++) {
+ var datasetInfo = action.dataSetsToAddTo[i];
+ // Grab the first one because repeaters must have only element id, as they cannot be inside repeaters
+ // or none if unplaced
+ var id = $ax.getElementIdsFromPath(datasetInfo.path, eventInfo)[0];
+ if(!id || _ignoreAction(id)) continue;
+ var dataset = datasetInfo.data;
+
+ for(var j = 0; j < dataset.length; j++) $ax.repeater.addItem(id, $ax.deepCopy(dataset[j]), eventInfo);
+ if(dataset.length) _addRefresh(id);
+ }
+
+ _dispatchAction(eventInfo, actions, index + 1);
+ };
+
+ _actionHandlers.deleteItemsFromDataSet = function(eventInfo, actions, index) {
+ var action = actions[index];
+ for(var i = 0; i < action.dataSetItemsToRemove.length; i++) {
+ // Grab the first one because repeaters must have only element id, as they cannot be inside repeaters
+ // or none if unplaced
+ var deleteInfo = action.dataSetItemsToRemove[i];
+ var id = $ax.getElementIdsFromPath(deleteInfo.path, eventInfo)[0];
+ if(!id || _ignoreAction(id)) continue;
+ $ax.repeater.deleteItems(id, eventInfo, deleteInfo.type, deleteInfo.rule);
+ _addRefresh(id);
+ }
+
+ _dispatchAction(eventInfo, actions, index + 1);
+ };
+
+ _actionHandlers.updateItemsInDataSet = function(eventInfo, actions, index) {
+ var action = actions[index];
+ for(var i = 0; i < action.dataSetsToUpdate.length; i++) {
+ var dataSet = action.dataSetsToUpdate[i];
+ // Grab the first one because repeaters must have only element id, as they cannot be inside repeaters
+ // or none if unplaced
+ var id = $ax.getElementIdsFromPath(dataSet.path, eventInfo)[0];
+ if(!id || _ignoreAction(id)) continue;
+
+ $ax.repeater.updateEditItems(id, dataSet.props, eventInfo, dataSet.type, dataSet.rule);
+ _addRefresh(id);
+ }
+
+ _dispatchAction(eventInfo, actions, index + 1);
+ };
+
+ _actionHandlers.setRepeaterToDataSet = function(eventInfo, actions, index) {
+ var action = actions[index];
+
+ for(var i = 0; i < action.repeatersToSet.length; i++) {
+ var setRepeaterInfo = action.repeatersToSet[i];
+ // Grab the first one because repeaters must have only element id, as they cannot be inside repeaters
+ // or none if unplaced
+ var id = $ax.getElementIdsFromPath(setRepeaterInfo.path, eventInfo)[0];
+ if(!id) continue;
+ $ax.repeater.setDataSet(id, setRepeaterInfo.localDataSetId);
+ }
+
+ _dispatchAction(eventInfo, actions, index + 1);
+ };
+
+ _actionHandlers.addFilterToRepeater = function(eventInfo, actions, index) {
+ var action = actions[index];
+
+ for(var i = 0; i < action.repeatersToAddFilter.length; i++) {
+ var addFilterInfo = action.repeatersToAddFilter[i];
+ // Grab the first one because repeaters must have only element id, as they cannot be inside repeaters
+ // or none if unplaced
+ var id = $ax.getElementIdsFromPath(addFilterInfo.path, eventInfo)[0];
+ if(!id || _ignoreAction(id)) continue;
+
+ $ax.repeater.addFilter(id, addFilterInfo.removeOtherFilters, addFilterInfo.label, addFilterInfo.filter, eventInfo.srcElement);
+ _addRefresh(id);
+ }
+
+ _dispatchAction(eventInfo, actions, index + 1);
+ };
+
+ _actionHandlers.removeFilterFromRepeater = function(eventInfo, actions, index) {
+ var action = actions[index];
+
+ for(var i = 0; i < action.repeatersToRemoveFilter.length; i++) {
+ var removeFilterInfo = action.repeatersToRemoveFilter[i];
+ // Grab the first one because repeaters must have only element id, as they cannot be inside repeaters
+ // or none if unplaced
+ var id = $ax.getElementIdsFromPath(removeFilterInfo.path, eventInfo)[0];
+ if(!id || _ignoreAction(id)) continue;
+
+ if(removeFilterInfo.removeAll) $ax.repeater.removeFilter(id);
+ else if(removeFilterInfo.filterName != '') {
+ $ax.repeater.removeFilter(id, removeFilterInfo.filterName);
+ }
+ _addRefresh(id);
+ }
+
+ _dispatchAction(eventInfo, actions, index + 1);
+ };
+
+ _actionHandlers.addSortToRepeater = function(eventInfo, actions, index) {
+ var action = actions[index];
+
+ for(var i = 0; i < action.repeatersToAddSort.length; i++) {
+ var addSortInfo = action.repeatersToAddSort[i];
+ // Grab the first one because repeaters must have only element id, as they cannot be inside repeaters
+ // or none if unplaced
+ var id = $ax.getElementIdsFromPath(addSortInfo.path, eventInfo)[0];
+ if(!id || _ignoreAction(id)) continue;
+
+ $ax.repeater.addSort(id, addSortInfo.label, addSortInfo.columnName, addSortInfo.ascending, addSortInfo.toggle, addSortInfo.sortType);
+ _addRefresh(id);
+ }
+
+ _dispatchAction(eventInfo, actions, index + 1);
+ };
+
+ _actionHandlers.removeSortFromRepeater = function(eventInfo, actions, index) {
+ var action = actions[index];
+
+ for(var i = 0; i < action.repeatersToRemoveSort.length; i++) {
+ var removeSortInfo = action.repeatersToRemoveSort[i];
+ // Grab the first one because repeaters must have only element id, as they cannot be inside repeaters
+ // or none if unplaced
+ var id = $ax.getElementIdsFromPath(removeSortInfo.path, eventInfo)[0];
+ if(!id || _ignoreAction(id)) continue;
+
+ if(removeSortInfo.removeAll) $ax.repeater.removeSort(id);
+ else if(removeSortInfo.sortName != '') $ax.repeater.removeSort(id, removeSortInfo.sortName);
+ _addRefresh(id);
+ }
+
+ _dispatchAction(eventInfo, actions, index + 1);
+ };
+
+ _actionHandlers.setRepeaterToPage = function(eventInfo, actions, index) {
+ var action = actions[index];
+
+ for(var i = 0; i < action.repeatersToSetPage.length; i++) {
+ var setPageInfo = action.repeatersToSetPage[i];
+ // Grab the first one because repeaters must have only element id, as they cannot be inside repeaters
+ // or none if unplaced
+ var id = $ax.getElementIdsFromPath(setPageInfo.path, eventInfo)[0];
+ if(!id || _ignoreAction(id)) continue;
+
+ var oldTarget = eventInfo.targetElement;
+ eventInfo.targetElement = id;
+ $ax.repeater.setRepeaterToPage(id, setPageInfo.pageType, setPageInfo.pageValue, eventInfo);
+ eventInfo.targetElement = oldTarget;
+ _addRefresh(id);
+ }
+
+ _dispatchAction(eventInfo, actions, index + 1);
+ };
+
+ _actionHandlers.setItemsPerRepeaterPage = function(eventInfo, actions, index) {
+ var action = actions[index];
+
+ for(var i = 0; i < action.repeatersToSetItemCount.length; i++) {
+ var setItemCountInfo = action.repeatersToSetItemCount[i];
+ // Grab the first one because repeaters must have only element id, as they cannot be inside repeaters
+ // or none if unplaced
+ var id = $ax.getElementIdsFromPath(setItemCountInfo.path, eventInfo)[0];
+ if(!id || _ignoreAction(id)) continue;
+
+ if(setItemCountInfo.noLimit) $ax.repeater.setNoItemLimit(id);
+ else $ax.repeater.setItemLimit(id, setItemCountInfo.itemCountValue, eventInfo);
+ _addRefresh(id);
+ }
+
+ _dispatchAction(eventInfo, actions, index + 1);
+ };
+
+ _actionHandlers.refreshRepeater = function(eventInfo, actions, index) {
+ // We use this as a psudo action now.
+ var action = actions[index];
+ for (var i = 0; i < action.repeatersToRefresh.length; i++) {
+ // Grab the first one because repeaters must have only element id, as they cannot be inside repeaters
+ // or none if unplaced
+ var id = $ax.getElementIdsFromPath(action.repeatersToRefresh[i], eventInfo)[0];
+ if(id) _tryRefreshRepeater(id, eventInfo);
+ }
+
+ _dispatchAction(eventInfo, actions, index + 1);
+ };
+
+ var _tryRefreshRepeater = function(id, eventInfo) {
+ var idIndex = _repeatersToRefresh.indexOf(id);
+ if(idIndex == -1) return;
+
+ $ax.splice(_repeatersToRefresh, idIndex, 1);
+ $ax.repeater.refreshRepeater(id, eventInfo);
+ };
+
+ _action.tryRefreshRepeaters = function(ids, eventInfo) {
+ for(var i = 0; i < ids.length; i++) _tryRefreshRepeater(ids[i], eventInfo);
+ };
+
+ _actionHandlers.scrollToWidget = function(eventInfo, actions, index) {
+ var action = actions[index];
+ var elementIds = $ax.getElementIdsFromPath(action.objectPath, eventInfo);
+ if(elementIds.length > 0) $ax('#' + elementIds[0]).scroll(action.options);
+
+ _dispatchAction(eventInfo, actions, index + 1);
+ };
+
+
+ _actionHandlers.enableDisableWidgets = function(eventInfo, actions, index) {
+ var action = actions[index];
+ for(var i = 0; i < action.pathToInfo.length; i++) {
+ var elementIds = $ax.getElementIdsFromPath(action.pathToInfo[i].objectPath, eventInfo);
+ var enable = action.pathToInfo[i].enableDisableInfo.enable;
+ for(var j = 0; j < elementIds.length; j++) $ax('#' + elementIds[j]).enabled(enable);
+ }
+
+ _dispatchAction(eventInfo, actions, index + 1);
+ };
+
+ _actionHandlers.setImage = function(eventInfo, actions, index) {
+ var oldTarget = eventInfo.targetElement;
+ var action = actions[index];
+ var view = $ax.adaptive.currentViewId;
+
+ eventInfo.image = true;
+ for(var i = 0; i < action.imagesToSet.length; i++) {
+ var imgInfo = action.imagesToSet[i];
+ if (view && imgInfo.adaptive[view]) imgInfo = imgInfo.adaptive[view];
+ else imgInfo = imgInfo.base;
+ var elementIds = $ax.getElementIdsFromPath(action.imagesToSet[i].objectPath, eventInfo);
+
+ for(var j = 0; j < elementIds.length; j++) {
+ var elementId = elementIds[j];
+
+ eventInfo.targetElement = elementId;
+ var evaluatedImgs = _evaluateImages(imgInfo, eventInfo);
+
+ var img = evaluatedImgs.normal;
+ if($ax.style.IsWidgetDisabled(elementId)) {
+ if(imgInfo.disabled) img = evaluatedImgs.disabled;
+ } else if($ax.style.IsWidgetSelected(elementId)) {
+ if(imgInfo.selected) img = evaluatedImgs.selected;
+ } else if($ax.event.mouseDownObjectId == elementId && imgInfo.mouseDown) img = evaluatedImgs.mouseDown;
+ else if($ax.event.mouseOverIds.indexOf(elementId) != -1 && imgInfo.mouseOver) {
+ img = evaluatedImgs.mouseOver;
+ //Update mouseOverObjectId
+ var currIndex = $ax.event.mouseOverIds.indexOf($ax.event.mouseOverObjectId);
+ var imgIndex = $ax.event.mouseOverIds.indexOf(elementId);
+ if(currIndex < imgIndex) $ax.event.mouseOverObjectId = elementId;
+ } else if(imgInfo.mouseOver && elementId == eventInfo.srcElement) {
+ img = evaluatedImgs.mouseOver;
+ }
+
+ // $('#' + $ax.repeater.applySuffixToElementId(elementId, '_img')).attr('src', img);
+ $jobj($ax.GetImageIdFromShape(elementId)).attr('src', img);
+
+ //Set up overrides
+ $ax.style.mapElementIdToImageOverrides(elementId, evaluatedImgs);
+ $ax.style.updateElementIdImageStyle(elementId);
+
+ if(evaluatedImgs.mouseOver || evaluatedImgs.mouseDown) $ax.event.updateIxStyleEvents(elementId);
+ }
+ }
+ eventInfo.targetElement = oldTarget;
+ eventInfo.image = false;
+
+ _dispatchAction(eventInfo, actions, index + 1);
+ };
+
+ var _evaluateImages = function(imgInfo, eventInfo) {
+ var retVal = {};
+ for(var state in imgInfo) {
+ if(!imgInfo.hasOwnProperty(state)) continue;
+ var img = imgInfo[state][$ax.adaptive.getSketchKey()] || $ax.expr.evaluateExpr(imgInfo[state].literal, eventInfo);
+ if(!img) img = $axure.utils.getTransparentGifPath();
+ retVal[state] = img;
+ }
+ return retVal;
+ };
+
+ $ax.clearRepeaterImageOverrides = function(repeaterId) {
+ var childIds = $ax.getChildElementIdsForRepeater(repeaterId);
+ for(var i = childIds; i < childIds.length; i++) $ax.style.deleteElementIdToImageOverride(childIds[i]);
+ };
+
+ _actionHandlers.setFocusOnWidget = function(eventInfo, actions, index) {
+ var action = actions[index];
+ if(action.objectPaths.length > 0) {
+ var elementIds = $ax.getElementIdsFromPath(action.objectPaths[0], eventInfo);
+ if(elementIds.length > 0) {
+ $ax('#' + elementIds[0]).focus();
+ //if select text and not in placeholder mode, then select all text
+ if(action.selectText && !$ax.placeholderManager.isActive(elementIds[0])) {
+ var elementChildren = document.getElementById(elementIds[0]).children;
+ //find the input or textarea element
+ for(var i = 0; i < elementChildren.length; i++) {
+ if (elementChildren[i].id.indexOf('_input') == -1) continue;
+ var elementTagName = elementChildren[i].tagName;
+ if(elementTagName && (elementTagName.toLowerCase() == "input" || elementTagName.toLowerCase() == "textarea")) {
+ elementChildren[i].select();
+ }
+ }
+ }
+ }
+ }
+
+ _dispatchAction(eventInfo, actions, index + 1);
+ };
+
+ _actionHandlers.expandCollapseTree = function(eventInfo, actions, index) {
+ var action = actions[index];
+ for(var i = 0; i < action.pathToInfo.length; i++) {
+ var pair = action.pathToInfo[i];
+ var elementIds = $ax.getElementIdsFromPath(pair.treeNodePath, eventInfo);
+ for(var j = 0; j < elementIds.length; j++) $ax('#' + elementIds[j]).expanded(pair.expandCollapseInfo.expand);
+ }
+
+ _dispatchAction(eventInfo, actions, index + 1);
+ };
+
+ _actionHandlers.other = function(eventInfo, actions, index) {
+ var action = actions[index];
+ $ax.navigate({
+ url: $axure.utils.getOtherPath() + "#other=" + encodeURI(action.otherDescription),
+ target: "popup",
+ includeVariables: false,
+ popupOptions: action.popup
+ });
+
+ _dispatchAction(eventInfo, actions, index + 1);
+ };
+
+ _actionHandlers.fireEvents = function(eventInfo, actions, index) {
+ var action = actions[index];
+ //look for the nearest element id
+
+ var objId = eventInfo.srcElement;
+ var thisWidget = eventInfo.thiswidget;
+ var obj = $ax.getObjectFromElementId(objId);
+ var rdoId = obj ? $ax.getRdoParentFromElementId(objId) : "";
+ var rdo = $ax.getObjectFromElementId(rdoId);
+ var page = rdo ? $ax.pageData.masters[rdo.masterId] : $ax.pageData.page;
+
+ // Check if rdo should be this
+ var oldIsMasterEvent = eventInfo.isMasterEvent;
+ if (obj && $ax.public.fn.IsReferenceDiagramObject(obj.type) && eventInfo.isMasterEvent) {
+ rdoId = objId;
+ rdo = obj;
+ page = $ax.pageData.masters[rdo.masterId];
+ }
+
+ for(var i = 0; i < action.firedEvents.length; i++) {
+ var firedEvent = action.firedEvents[i];
+ var isPage = firedEvent.objectPath.length == 0;
+ var targetObjIds = isPage ? [rdoId] : $ax.getElementIdsFromPath(firedEvent.objectPath, eventInfo);
+ for (var j = 0; j < targetObjIds.length; j++) {
+ var targetObjId = targetObjIds[j];
+ var targetObj = isPage ? rdo : $ax.getObjectFromElementId(targetObjId);
+
+ eventInfo.srcElement = targetObjId || '';
+ eventInfo.thiswidget = $ax.getWidgetInfo(eventInfo.srcElement);
+
+ eventInfo.isMasterEvent = false;
+ var raisedEvents = firedEvent.raisedEventIds;
+ if(raisedEvents) {
+ for(var k = 0; k < raisedEvents.length; k++) {
+ var event = targetObj.interactionMap && targetObj.interactionMap.raised && targetObj.interactionMap.raised[raisedEvents[k]];
+ if(event) $ax.event.handleEvent(targetObjId, eventInfo, event, false, true);
+ }
+ }
+
+ if(isPage) {
+ eventInfo.isMasterEvent = true;
+ eventInfo.label = $ax.pageData.page.name;
+ eventInfo.friendlyType = 'Page';
+ }
+
+ var firedTarget = isPage ? page : targetObj;
+ var firedEventNames = firedEvent.firedEventNames;
+ if(firedEventNames) {
+ for(k = 0; k < firedEventNames.length; k++) {
+ event = firedTarget.interactionMap && firedTarget.interactionMap[firedEventNames[k]];
+ if(event) $ax.event.handleEvent(isPage ? '' : targetObjId, eventInfo, event, false, true);
+ }
+ }
+ if(isPage) eventInfo.isMasterEvent = oldIsMasterEvent;
+ }
+ eventInfo.srcElement = objId;
+ eventInfo.thiswidget = thisWidget;
+
+ eventInfo.isMasterEvent = oldIsMasterEvent;
+ }
+
+ _dispatchAction(eventInfo, actions, index + 1);
+ };
+});
diff --git a/src/原型系统/resources/scripts/axure/adaptive.js b/src/原型系统/resources/scripts/axure/adaptive.js
new file mode 100644
index 0000000..8bd801f
--- /dev/null
+++ b/src/原型系统/resources/scripts/axure/adaptive.js
@@ -0,0 +1,689 @@
+$axure.internal(function($ax) {
+ $ax.adaptive = {};
+
+ $axure.utils.makeBindable($ax.adaptive, ["viewChanged"]);
+
+ var _auto = true;
+ var _autoIsHandledBySidebar = false;
+
+ var _views;
+ var _idToView;
+ var _enabledViews = [];
+
+ var _initialViewToLoad;
+ var _initialViewSizeToLoad;
+
+ var _loadFinished = false;
+ $ax.adaptive.loadFinished = function() {
+ if(_loadFinished) return;
+ _loadFinished = true;
+ if($ax.adaptive.currentViewId) $ax.viewChangePageAndMasters();
+ else $ax.postAdaptiveViewChanged();
+ };
+
+ var _handleResize = function(forceSwitchTo) {
+ if(!_auto) return;
+ if(_auto && _autoIsHandledBySidebar && !forceSwitchTo) return;
+
+ var $window = $(window);
+ var height = $window.height();
+ var width = $window.width();
+
+ var toView = _getAdaptiveView(width, height);
+ var toViewId = toView && toView.id;
+
+ _switchView(toViewId, forceSwitchTo);
+ };
+
+ var _setAuto = $ax.adaptive.setAuto = function(val) {
+ if(_auto != val) {
+ _auto = Boolean(val);
+ }
+ };
+
+ var _setLineImage = function(id, imageUrl) {
+ $jobj(id).attr('src', imageUrl);
+ };
+
+ var _switchView = function (viewId, forceSwitchTo) {
+ //if(!$ax.pageData.isAdaptiveEnabled) return;
+
+ var previousViewId = $ax.adaptive.currentViewId;
+ if(typeof previousViewId == 'undefined') previousViewId = '';
+ if(typeof viewId == 'undefined') viewId = '';
+ if (viewId == previousViewId) {
+ if(forceSwitchTo) $ax.postAdaptiveViewChanged(forceSwitchTo);
+ return;
+ }
+
+ $ax('*').each(function(obj, elementId) {
+ if (!$ax.public.fn.IsTreeNodeObject(obj.type)) return;
+ if(!obj.hasOwnProperty('isExpanded')) return;
+
+ var query = $ax('#' + elementId);
+ var defaultExpanded = obj.isExpanded;
+
+ query.expanded(defaultExpanded);
+ });
+
+ // reset all the inline positioning from move and rotate actions including size and transformation
+ $axure('*').each(function (diagramObject, elementId) {
+ if(diagramObject.isContained) return;
+ if($ax.getParentRepeaterFromElementIdExcludeSelf(elementId)) return;
+
+ var element = document.getElementById(elementId);
+ if(element) {
+ var resetCss = {
+ top: "", left: "", width: "", height: "", opacity: "",
+ transform: "", webkitTransform: "", MozTransform: "", msTransform: "", OTransform: ""
+ };
+ var query = $(element);
+ query.css(resetCss);
+ var isPanel = $ax.public.fn.IsDynamicPanel(diagramObject.type);
+ if(!isPanel || diagramObject.fitToContent) { //keeps size on the panel states when switching adaptive views to optimize fit to panel
+ if(diagramObject.fitToContent) $ax.dynamicPanelManager.setFitToContentCss(elementId, true);
+ var children = query.children();
+ if(children.length) children.css(resetCss);
+ }
+
+ $ax.dynamicPanelManager.resetFixedPanel(diagramObject, element);
+ $ax.dynamicPanelManager.resetAdaptivePercentPanel(diagramObject, element);
+ }
+ });
+
+ $ax.adaptive.currentViewId = viewId; // we need to set this so the enabled and selected styles will apply properly
+ if(previousViewId) {
+ $ax.style.clearAdaptiveStyles();
+ $('*').removeClass(previousViewId);
+ } else {
+ $ax.style.reselectElements();
+ }
+
+ $axure('*').each(function (obj, elementId) {
+ if($ax.getParentRepeaterFromElementIdExcludeSelf(elementId)) return;
+
+ $ax.style.updateElementIdImageStyle(elementId); // When image override exists, fix styling/borders
+ });
+
+ //$ax.style.startSuspendTextAlignment();
+
+ // reset all the images only if we're going back to the default view
+ if(!viewId) {
+ $axure('*').each(function (diagramObject, elementId) {
+ if($ax.getParentRepeaterFromElementIdExcludeSelf(elementId)) return;
+
+ $ax.placeholderManager.refreshPlaceholder(elementId);
+
+ var images = diagramObject.images;
+ if(diagramObject.type == 'horizontalLine' || diagramObject.type == 'verticalLine') {
+ var startImg = images['start~'];
+ _setLineImage(elementId + "_start", startImg);
+ var endImg = images['end~'];
+ _setLineImage(elementId + "_end", endImg);
+ var lineImg = images['line~'];
+ _setLineImage(elementId + "_line", lineImg);
+ } else if(diagramObject.type == $ax.constants.CONNECTOR_TYPE) {
+ _setAdaptiveConnectorImages(elementId, images, '');
+ } else if(images) {
+ if (diagramObject.generateCompound) {
+
+ if($ax.style.IsWidgetDisabled(elementId)) {
+ disabledImage = _getImageWithTag(images, 'disabled~');
+ if(disabledImage) $ax.style.applyImage(elementId, disabledImage, 'disabled');
+ return;
+ }
+ if($ax.style.IsWidgetSelected(elementId)) {
+ selectedImage = _getImageWithTag(images, 'selected~');
+ if(selectedImage) $ax.style.applyImage(elementId, selectedImage, 'selected');
+ return;
+ }
+ $ax.style.applyImage(elementId, _getImageWithTag(images, 'normal~'), 'normal');
+ } else {
+ if ($ax.style.IsWidgetDisabled(elementId)) {
+ var disabledImage = _matchImage(elementId, images, [], 'disabled', true);
+ if (disabledImage) $ax.style.applyImage(elementId, disabledImage, 'disabled');
+ return;
+ }
+ if ($ax.style.IsWidgetSelected(elementId)) {
+ var selectedImage = _matchImage(elementId, images, [], 'selected', true);
+ if (selectedImage) $ax.style.applyImage(elementId, selectedImage, 'selected');
+ return;
+ }
+ var normalImage = _matchImage(elementId, images, [], 'normal', true);
+ $ax.style.applyImage(elementId, normalImage, 'normal');
+ }
+ }
+
+ //align all text
+ var child = $jobj(elementId).children('.text');
+ if(child.length) $ax.style.transformTextWithVerticalAlignment(child[0].id, function() { });
+ });
+ // we have to reset visibility if we aren't applying a new view
+ $ax.visibility.resetLimboAndHiddenToDefaults();
+ $ax.visibility.clearMovedAndResized();
+ $ax.repeater.refreshAllRepeaters();
+ $ax.dynamicPanelManager.updateParentsOfNonDefaultFitPanels();
+ $ax.dynamicPanelManager.updatePercentPanelCache($ax('*'));
+ } else {
+ $ax.visibility.clearLimboAndHidden();
+ $ax.visibility.clearMovedAndResized();
+ _applyView(viewId);
+ $ax.repeater.refreshAllRepeaters();
+ $ax.dynamicPanelManager.updateAllLayerSizeCaches();
+ $ax.dynamicPanelManager.updateParentsOfNonDefaultFitPanels();
+ }
+
+ $ax.annotation.updateAllFootnotes();
+ //$ax.style.resumeSuspendTextAlignment();
+
+ $ax.adaptive.triggerEvent('viewChanged', {});
+ if(_loadFinished) $ax.viewChangePageAndMasters(forceSwitchTo);
+ };
+
+ var _getImageWithTag = function(image, tag) {
+ var flattened = {};
+ for (var component in image) {
+ var componentImage = image[component][tag];
+ if(componentImage) flattened[component] = componentImage;
+ }
+ return flattened;
+ }
+
+ // gets the inheritance chain of a particular view.
+ var _getAdaptiveIdChain = $ax.adaptive.getAdaptiveIdChain = function(viewId) {
+ if(!viewId) return [];
+ var view = _idToView[viewId];
+ var chain = [];
+ var current = view;
+ while(current) {
+ chain[chain.length] = current.id;
+ current = _idToView[current.baseViewId];
+ }
+ return chain.reverse();
+ };
+
+ var _getMasterAdaptiveIdChain = $ax.adaptive.getMasterAdaptiveIdChain = function (masterId, viewId) {
+ if (!viewId) return [];
+
+ var master = $ax.pageData.masters[masterId];
+ var masterViews = master.adaptiveViews;
+ var idToMasterView = {};
+ if (masterViews && masterViews.length > 0) {
+ for (var i = 0; i < masterViews.length; i++) {
+ var view = masterViews[i];
+ idToMasterView[view.id] = view;
+ }
+ }
+
+ if (!idToMasterView) return [];
+
+ var view = idToMasterView[viewId];
+ var chain = [];
+ var current = view;
+ while (current) {
+ chain[chain.length] = current.id;
+ current = idToMasterView[current.baseViewId];
+ }
+ return chain.reverse();
+ };
+
+ var _getPageStyle = $ax.adaptive.getPageStyle = function() {
+ var currentViewId = $ax.adaptive.currentViewId;
+ var adaptiveChain = _getAdaptiveIdChain(currentViewId);
+
+ var currentStyle = $.extend({}, $ax.pageData.page.style);
+ for(var i = 0; i < adaptiveChain.length; i++) {
+ var viewId = adaptiveChain[i];
+ $.extend(currentStyle, $ax.pageData.page.adaptiveStyles[viewId]);
+ }
+
+ return currentStyle;
+ };
+
+ var _setAdaptiveLineImages = function(elementId, images, viewIdChain) {
+ for(var i = viewIdChain.length - 1; i >= 0; i--) {
+ var viewId = viewIdChain[i];
+ var startImg = images['start~' + viewId];
+ if(startImg) {
+ _setLineImage(elementId + "_start", startImg);
+ var endImg = images['end~' + viewId];
+ _setLineImage(elementId + "_end", endImg);
+ var lineImg = images['line~' + viewId];
+ _setLineImage(elementId + "_line", lineImg);
+ break;
+ }
+ }
+ };
+
+ var _setAdaptiveConnectorImages = function (elementId, images, view) {
+ var conn = $jobj(elementId);
+ var count = conn.children().length-1; // -1 for rich text panel
+ for(var i = 0; i < count; i++) {
+ var img = images['' + i + '~' + view];
+ $jobj(elementId + '_seg' + i).attr('src', img);
+ }
+ };
+
+ var _applyView = $ax.adaptive.applyView = function(viewId, query) {
+ var limboIds = {};
+ var hiddenIds = {};
+
+ var jquery;
+ if(query) {
+ jquery = query.jQuery();
+ jquery = jquery.add(jquery.find('*'));
+ var jqueryAnn = $ax.annotation.jQueryAnn(query);
+ jquery = jquery.add(jqueryAnn);
+ } else {
+ jquery = $('*').not('#ios-safari-fixed');
+ query = $ax('*');
+ }
+ jquery.addClass(viewId);
+ var viewIdChain = _getAdaptiveIdChain(viewId);
+ // this could be made more efficient by computing it only once per object
+ query.each(function(diagramObject, elementId) {
+ _applyAdaptiveViewOnObject(diagramObject, elementId, viewIdChain, viewId, limboIds, hiddenIds);
+ });
+
+ $ax.visibility.addLimboAndHiddenIds(limboIds, hiddenIds, query);
+ //$ax.dynamicPanelManager.updateAllFitPanelsAndLayerSizeCaches();
+ $ax.dynamicPanelManager.updatePercentPanelCache(query);
+ };
+
+ var _applyAdaptiveViewOnObject = function(diagramObject, elementId, viewIdChain, viewId, limboIds, hiddenIds) {
+ var adaptiveChain = [];
+ for(var i = 0; i < viewIdChain.length; i++) {
+ var viewId = viewIdChain[i];
+ var viewStyle = diagramObject.adaptiveStyles[viewId];
+ if(viewStyle) {
+ adaptiveChain[adaptiveChain.length] = viewStyle;
+ if (viewStyle.size) $ax.public.fn.convertToSingleImage($jobj(elementId));
+ }
+ }
+
+ var state = $ax.style.generateState(elementId);
+
+ // set the image
+ var images = diagramObject.images;
+ if(images) {
+ if(diagramObject.type == 'horizontalLine' || diagramObject.type == 'verticalLine') {
+ _setAdaptiveLineImages(elementId, images, viewIdChain);
+ } else if (diagramObject.type == $ax.constants.CONNECTOR_TYPE) {
+ _setAdaptiveConnectorImages(elementId, images, viewId);
+ } else if (diagramObject.generateCompound) {
+ var compoundUrl = _matchImageCompound(diagramObject, elementId, viewIdChain, state);
+ if (compoundUrl) $ax.style.applyImage(elementId, compoundUrl, state);
+ }else {
+ var imgUrl = _matchImage(elementId, images, viewIdChain, state);
+ if(imgUrl) $ax.style.applyImage(elementId, imgUrl, state);
+ }
+ }
+ // addaptive override style (not including default style props)
+ var adaptiveStyle = $ax.style.computeAllOverrides(elementId, undefined, state, viewId);
+
+ // this style INCLUDES the object's my style
+ var compoundStyle = $.extend({}, diagramObject.style, adaptiveStyle);
+
+ if (diagramObject.owner.type == 'Axure:Master' && diagramObject.adaptiveStyles) {
+ adaptiveStyle = $ax.style.computeFullStyle(elementId, state, viewId);
+ }
+
+ if(!diagramObject.isContained) {
+ $ax.style.setAdaptiveStyle(elementId, adaptiveStyle);
+ }
+
+ var scriptId = $ax.repeater.getScriptIdFromElementId(elementId);
+ if(compoundStyle.limbo && !diagramObject.isContained) limboIds[scriptId] = true;
+ // sigh, javascript. we need the === here because undefined means not overriden
+ if(compoundStyle.visible === false) hiddenIds[scriptId] = true;
+ };
+
+ var _matchImage = function(id, images, viewIdChain, state, doNotProgress) {
+ var override = $ax.style.getElementImageOverride(id, state);
+ if(override) return override;
+
+ if(!images) return undefined;
+
+ var scriptId = $ax.repeater.getScriptIdFromElementId(id);
+ // first check all the images for this state
+ for(var i = viewIdChain.length - 1; i >= 0; i--) {
+ var viewId = viewIdChain[i];
+ var img = images[scriptId + "~" + state + "~" + viewId];
+ if(!img) img = images[state + "~" + viewId];
+ if(img) return img;
+ }
+ // check for the default state style
+ var defaultStateImage = images[scriptId + "~" + state + "~"];
+ if(!defaultStateImage) defaultStateImage = images[state + "~"];
+ if(defaultStateImage) return defaultStateImage;
+
+ if(doNotProgress) return undefined;
+
+ state = $ax.style.progessState(state);
+ if (state) return _matchImage(scriptId, images, viewIdChain, state);
+
+ // SHOULD NOT REACH HERE! NORMAL SHOULD ALWAYS CATCH AT THE DEFAULT!
+ return images['normal~']; // this is the default
+ };
+
+ var _matchImageCompound = function(diagramObject, id, viewIdChain, state) {
+ var images = [];
+ for(var i = 0; i < diagramObject.compoundChildren.length; i++) {
+ var component = diagramObject.compoundChildren[i];
+ images[component] = _matchImage(id, diagramObject.images[component], viewIdChain, state);
+ }
+ return images;
+ };
+
+
+
+ $ax.adaptive.getImageForStateAndView = function(id, state) {
+ var viewIdChain = _getAdaptiveIdChain($ax.adaptive.currentViewId);
+ var diagramObject = $ax.getObjectFromElementId(id);
+ if (diagramObject.generateCompound) return _matchImageCompound(diagramObject, id, viewIdChain, state);
+ else return _matchImage(id, diagramObject.images, viewIdChain, state);
+ };
+
+ var _getAdaptiveView = function(winWidth, winHeight) {
+ var _isViewOneGreaterThanTwo = function (view1, view2, winHeight) {
+ if (view1.size.width > view2.size.width) return true;
+ if (view1.size.width == view2.size.width) {
+ if (view2.size.height <= winHeight) return view1.size.height > view2.size.height && view1.size.height <= winHeight;
+ else return view1.size.height < view2.size.height;
+ }
+ return false;
+ };
+
+ var _isViewOneLessThanTwo = function(view1, view2) {
+ var width2 = view2.size.width || 1000000; // artificially large number
+ var height2 = view2.size.height || 1000000;
+
+ var width1 = view1.size.width || 1000000;
+ var height1 = view1.size.height || 1000000;
+
+ return width1 < width2 || (width1 == width2 && height1 < height2);
+ };
+
+ var _isWindowWidthGreaterThanViewWidth = function(view, width) {
+ return width >= view.size.width;
+ };
+
+ var _isWindowWidthLessThanViewWidth = function(view1, width) {
+ var viewWidth = view1.size.width || 1000000;
+
+ return width <= viewWidth;
+ };
+
+ var greater = undefined;
+ var less = undefined;
+
+ var defaultView = $ax.pageData.defaultAdaptiveView;
+ if (_isWindowWidthGreaterThanViewWidth(defaultView, winWidth, winHeight)) greater = defaultView;
+ less = defaultView;
+ for(var i = 0; i < _enabledViews.length; i++) {
+ var view = _enabledViews[i];
+ if(_isWindowWidthGreaterThanViewWidth(view, winWidth, winHeight)) {
+ if(!greater || _isViewOneGreaterThanTwo(view, greater, winHeight)) greater = view;
+ }
+ if(_isWindowWidthLessThanViewWidth(view, winWidth, winHeight)) {
+ if(!less || _isViewOneLessThanTwo(view, less)) less = view;
+ }
+ }
+ return greater || less;
+ };
+
+ var _isAdaptiveInitialized = function() {
+ return typeof _idToView != 'undefined';
+ };
+
+
+ $ax.messageCenter.addMessageListener(function(message, data) {
+ //If the adaptive plugin hasn't been initialized yet then
+ //save the view to load so that it can get set when initialize occurs
+ if (message == 'switchAdaptiveView') {
+ if (window.name != 'mainFrame') return;
+
+ var href = window.location.href.split('#')[0];
+ var lastSlash = href.lastIndexOf('/');
+ href = href.substring(lastSlash + 1);
+ if(href != data.src) return;
+
+ var view = data.view == 'auto' ? undefined : (data.view == 'default' ? '' : data.view);
+
+ if(!_isAdaptiveInitialized()) {
+ _initialViewToLoad = view;
+ } else _handleLoadViewId(view);
+ } else if (message == 'setAdaptiveViewForSize') {
+ if (window.name != 'mainFrame') return;
+
+ _autoIsHandledBySidebar = true;
+ if(!_isAdaptiveInitialized()) {
+ _initialViewSizeToLoad = data;
+ } else _handleSetViewForSize(data.width, data.height);
+ } else if (message == 'getScale') {
+ if (window.name != 'mainFrame') return;
+
+ var prevScaleN = data.prevScaleN;
+ var newScaleN = 1;
+ var contentOriginOffset = 0;
+
+ var $body = $('body');
+ $body.css('height', '');
+
+ if (data.scale != 0) {
+ var adjustScrollScale = false;
+ if ($('html').getNiceScroll().length == 0 && !MOBILE_DEVICE && !SAFARI) {
+ //adding nicescroll so width is correct when getting scale
+ _addNiceScroll($('html'), { emulatetouch: false, horizrailenabled: false });
+ adjustScrollScale = true;
+ }
+ if (!MOBILE_DEVICE && SAFARI) _removeNiceScroll($('html'));
+
+ $('html').css('overflow-x', 'hidden');
+
+ var bodyWidth = $body.width();
+ var isCentered = $body.css('position') == 'relative';
+
+ // screen width does not adjust on screen rotation for iOS (width is always shorter screen measurement)
+ var isLandscape = window.orientation != 0 && window.orientation != 180;
+ var mobileWidth = (IOS ? (isLandscape ? window.screen.height : window.screen.width) : window.screen.width) - data.panelWidthOffset;
+ var scaleN = newScaleN = (MOBILE_DEVICE ? mobileWidth : $(window).width()) / bodyWidth;
+
+ if (data.scale == 2) {
+ var pageSize = $ax.public.fn.getPageSize();
+ var hScaleN = (MOBILE_DEVICE ? data.viewportHeight : $(window).height()) / Math.max(1, pageSize.bottom);
+ if (hScaleN < scaleN) {
+ scaleN = newScaleN = hScaleN;
+ }
+ if (isCentered) contentOriginOffset = scaleN * (bodyWidth / 2);
+ }
+
+ if ((SAFARI && IOS) || SHARE_APP) {
+ var pageSize = $ax.public.fn.getPageSize();
+ $body.first().css('height', pageSize.bottom + 'px');
+ } //else $body.css('height', $body.height() + 'px');
+
+ if (adjustScrollScale) {
+ _removeNiceScroll($('html'));
+ _addNiceScroll($('html'), { emulatetouch: false, horizrailenabled: false, cursorwidth: Math.ceil(6 / newScaleN) + 'px', cursorborder: 1 / newScaleN + 'px solid #fff', cursorborderradius: 5 / newScaleN + 'px' });
+ }
+ }
+ var contentScale = {
+ scaleN: newScaleN,
+ prevScaleN: prevScaleN,
+ contentOriginOffset: contentOriginOffset,
+ clipToView: data.clipToView,
+ viewportHeight: data.viewportHeight,
+ viewportWidth: data.viewportWidth,
+ panelWidthOffset: data.panelWidthOffset,
+ scale: data.scale
+ };
+ $axure.messageCenter.postMessage('setContentScale', contentScale);
+
+ } else if (message == 'setDeviceMode') {
+ if (window.name != 'mainFrame') return;
+
+ _isDeviceMode = data.device;
+ if (data.device) {
+ // FIXES firefox cursor not staying outside initial device frame border
+ // SAFARI needs entire content height so that trackpad can be disabled
+ //if (FIREFOX || (SAFARI && !IOS)) {
+ // var pageSize = $ax.public.fn.getPageSize();
+ // $('html').css('height', pageSize.bottom + 'px');
+ //}
+
+ _removeNiceScroll($('html'), true);
+ if (!MOBILE_DEVICE) {
+ _addNiceScroll($('html'), { emulatetouch: true, horizrailenabled: false }, true);
+ $('html').addClass('mobileFrameCursor');
+ $('html').css('cursor', 'url(resources/css/images/touch.cur), auto');
+ $('html').css('cursor', 'url(resources/css/images/touch.svg) 32 32, auto');
+ $('html').css('overflow-x', 'hidden');
+
+ if (IE) {
+ document.addEventListener("click", function () {
+ // IE still sometimes wants an argument here
+ this.activeElement.releasePointerCapture();
+ }, false);
+ }
+
+ if ($axure.browser.isEdge) {
+ document.addEventListener("pointerdown", function (e) {
+ this.activeElement.releasePointerCapture(e.pointerId);
+ }, false);
+ }
+
+ $ax.dynamicPanelManager.initMobileScroll();
+ }
+
+ // Gives horizontal scroll to android in 100% (handled outside of iframe)
+ $('html').css('overflow-x', 'hidden');
+ $('body').css('margin', '0px');
+ $(function () { _setHorizontalScroll(false); });
+ } else {
+ _removeNiceScroll($('html'), true);
+ $('html').css('overflow-x', '');
+ $('html').css('cursor', '');
+ //$('html').removeAttr('style');
+ $('body').css('margin', '');
+ $('html').removeClass('mobileFrameCursor');
+ $(function () { _setHorizontalScroll(!data.scaleToWidth); });
+
+ $ax.dynamicPanelManager.initMobileScroll();
+ }
+ }
+ });
+
+ var _isDeviceMode = false;
+ $ax.adaptive.isDeviceMode = function () {
+ return _isDeviceMode;
+ }
+
+ var _removeNiceScroll = $ax.adaptive.removeNiceScroll = function ($container, blockResetScroll) {
+ if (!blockResetScroll) {
+ $container.scrollLeft(0);
+ $container.scrollTop(0);
+ }
+ $container.getNiceScroll().remove();
+ //clean up nicescroll css
+ if (IE) $container.css({ '-ms-overflow-y': '', 'overflow-y': '', '-ms-overflow-style': '', '-ms-touch-action': '' });
+ }
+
+ var _addNiceScroll = $ax.adaptive.addNiceScroll = function ($container, options, blockResetScroll) {
+ if (!blockResetScroll) {
+ $container.scrollLeft(0);
+ $container.scrollTop(0);
+ }
+ $container.niceScroll(options);
+ //clean up nicescroll css so child scroll containers show scrollbars in IE
+ if (IE) $container.css({ '-ms-overflow-y': '', '-ms-overflow-style': '' });
+ if(IOS) $container.css({ 'overflow-y': ''});
+ }
+
+
+ $ax.adaptive.updateMobileScrollOnBody = function () {
+ var niceScroll = $('html').getNiceScroll();
+ if (niceScroll.length == 0) return;
+ niceScroll.resize();
+ }
+
+ var _setTrackpadHorizontalScroll = function (active) {
+ var preventScroll = function (e) {
+ if (Math.abs(e.wheelDeltaX) != 0) {
+ e.preventDefault();
+ }
+ }
+
+ if (!active) {
+ document.body.addEventListener("mousewheel", preventScroll, { passive: false });
+ document.getElementById('html').addEventListener("mousewheel", preventScroll, { passive: false });
+ } else {
+ document.body.removeEventListener("mousewheel", preventScroll, { passive: false });
+ document.getElementById('html').removeEventListener("mousewheel", preventScroll, { passive: false });
+ }
+ }
+
+ var _setHorizontalScroll = function (active) {
+ var $body = $(document);
+ if (!active) {
+ $body.bind('scroll', function () {
+ if ($body.scrollLeft() !== 0) {
+ $body.scrollLeft(0);
+ }
+ });
+ } else {
+ $body.unbind('scroll');
+ }
+ }
+
+ $ax.adaptive.setAdaptiveView = function(view) {
+ var viewIdForSitemapToUnderstand = view == 'auto' ? undefined : (view == 'default' ? '' : view);
+
+ if(!_isAdaptiveInitialized()) {
+ _initialViewToLoad = viewIdForSitemapToUnderstand;
+ } else _handleLoadViewId(viewIdForSitemapToUnderstand);
+ };
+
+ $ax.adaptive.initialize = function() {
+ _views = $ax.pageData.adaptiveViews;
+ _idToView = {};
+
+ var useViews = $ax.document.configuration.useViews;
+
+ if(_views && _views.length > 0) {
+ for(var i = 0; i < _views.length; i++) {
+ var view = _views[i];
+ _idToView[view.id] = view;
+ if(useViews) _enabledViews[_enabledViews.length] = view;
+ }
+
+ if(_autoIsHandledBySidebar && _initialViewSizeToLoad) _handleSetViewForSize(_initialViewSizeToLoad.width, _initialViewSizeToLoad.height);
+ else _handleLoadViewId(_initialViewToLoad);
+ }
+
+ $axure.resize(function(e) {
+ _handleResize();
+ $ax.postResize(e); //window resize fires after view changed
+ });
+ };
+
+ var _handleLoadViewId = function (loadViewId, forceSwitchTo) {
+ if(typeof loadViewId != 'undefined') {
+ _setAuto(false);
+ _switchView(loadViewId != 'default' ? loadViewId : '', forceSwitchTo);
+ } else {
+ _setAuto(true);
+ _handleResize(forceSwitchTo);
+ }
+ };
+
+ var _handleSetViewForSize = function (width, height) {
+ var toView = _getAdaptiveView(width, height);
+ var toViewId = toView && toView.id;
+ _switchView(toViewId, "auto");
+ };
+
+ $ax.adaptive.getSketchKey = function() {
+ return $ax.pageData.sketchKeys[$ax.adaptive.currentViewId || ''];
+ }
+});
\ No newline at end of file
diff --git a/src/原型系统/resources/scripts/axure/annotation.js b/src/原型系统/resources/scripts/axure/annotation.js
new file mode 100644
index 0000000..d71dd25
--- /dev/null
+++ b/src/原型系统/resources/scripts/axure/annotation.js
@@ -0,0 +1,161 @@
+// ******* Annotation MANAGER ******** //
+$axure.internal(function($ax) {
+ var NOTE_SIZE = 10;
+
+ var _annotationManager = $ax.annotation = {};
+
+ var _updateLinkLocations = $ax.annotation.updateLinkLocations = function(elementId) {
+ var textId = $ax.GetTextPanelId(elementId);
+ if(!textId) return;
+
+ var rotation = $ax.getObjectFromElementId(elementId).style.rotation;
+ //we have to do this because webkit reports the post-transform position but when you set positions it's pre-transform
+ if(WEBKIT && rotation) {
+ //we can dynamiclly rotate a widget now, show need to remember the transform rather than just remove it
+ //here jquery.css will return 'none' if element is display none
+ var oldShapeTransform = document.getElementById(elementId).style['-webkit-transform'];
+ var oldTextTransform = document.getElementById(textId).style['-webkit-transform'];
+ $('#' + elementId).css('-webkit-transform', 'scale(1)');
+ $('#' + textId).css('-webkit-transform', 'scale(1)');
+ }
+
+ $('#' + textId).find('div[id$="_ann"]').each(function(index, value) {
+ var elementId = value.id.replace('_ann', '');
+ var $link = $('#' + elementId);
+ var annPos = $link.position();
+ annPos.left += $link.width();
+ //var annPos = $(value).position();
+ var left = annPos.left;// - NOTE_SIZE;
+ var top = annPos.top - 5;
+
+ $(value).css('left', left).css('top', top);
+ });
+
+ //undo the transform reset
+ if(WEBKIT && rotation) {
+ $('#' + elementId).css('-webkit-transform', oldShapeTransform || '');
+ $('#' + textId).css('-webkit-transform', oldTextTransform || '');
+ }
+ };
+
+ var _toggleAnnotationDialog = function (elementId, event) {
+ var win = $(window);
+ var scrollY = win.scrollTop();
+ var scrollX = win.scrollLeft();
+
+ var messageData = { id: elementId, x: event.pageX - scrollX, y: event.pageY - scrollY }
+ if (window.name != 'mainFrame') messageData.page = $ax.pageData.notesData;
+ $ax.messageCenter.postMessage('toggleAnnDialog', messageData);
+ }
+
+ $ax.annotation.initialize = function () {
+ _createFootnotes($ax('*'), true);
+ }
+
+ var _createFootnotes = $ax.annotation.createFootnotes = function(query, create) {
+ if(!$ax.document.configuration.showAnnotations) return;
+
+ var widgetNotes = $ax.pageData.notesData.widgetNotes;
+ if (widgetNotes) {
+ var ownerToFns = $ax.pageData.notesData.ownerToFns;
+ if(!$.isEmptyObject(ownerToFns)) {
+ query.each(function(dObj, elementId) {
+ var fns = ownerToFns[dObj.id];
+ if (fns !== undefined) {
+ var elementIdQuery = $('#' + elementId);
+ if (dObj.type == 'hyperlink') {
+ var parentId = $ax.GetParentIdFromLink(elementId);
+ if (create) {
+ elementIdQuery.after("
");
+ appendFns($('#' + elementId + "_ann"), fns);
+ }
+ _updateLinkLocations(parentId);
+ } else {
+ if (create) {
+ elementIdQuery.after("
");
+ appendFns($('#' + elementId + "_ann"), fns);
+ }
+ _adjustIconLocation(elementId, dObj);
+ }
+
+ if (create) {
+ $('#' + elementId + "_ann").click(function (e) {
+ _toggleAnnotationDialog(dObj.id, e);
+ return false;
+ });
+
+ var isVisible = true;
+ var isMaster = $ax.public.fn.IsReferenceDiagramObject(dObj.type);
+ if (isMaster) isVisible = dObj.visible;
+ else isVisible = $ax.visibility.IsIdVisible(elementId);
+ if (!isVisible) {
+ var ann = document.getElementById(elementId + "_ann");
+ if (ann) $ax.visibility.SetVisible(ann, false);
+ }
+ }
+ }
+ });
+ }
+ }
+
+ function appendFns($parent, fns) {
+ for (var index = 0; index < fns.length; index++) {
+ $parent.append("
" + fns[index] + "
");
+ }
+ }
+ };
+
+ $ax.annotation.updateAllFootnotes = function () {
+ _createFootnotes($ax('*'), false);
+ }
+
+ $ax.annotation.jQueryAnn = function(query) {
+ var elementIds = [];
+ query.each(function(diagramObject, elementId) {
+ if(diagramObject.annotation) elementIds[elementIds.length] = elementId;
+ });
+ var elementIdSelectors = jQuery.map(elementIds, function(elementId) { return '#' + elementId + '_ann'; });
+ var jQuerySelectorText = (elementIdSelectors.length > 0) ? elementIdSelectors.join(', ') : '';
+ return $(jQuerySelectorText);
+ };
+
+ $(window.document).ready(function() {
+ //$ax.annotation.InitializeAnnotations($ax(function(dObj) { return dObj.annotation; }));
+
+ $ax.messageCenter.addMessageListener(function(message, data) {
+ //If the annotations are being hidden via the Sitemap toggle button, hide any open dialogs
+ if(message == 'annotationToggle') {
+ if (data == true) {
+ $('div.annnote').show();
+ } else {
+ $('div.annnote').hide();
+ }
+ }
+ });
+ });
+
+ //adjust annotation location to a element's top right corner
+ var _adjustIconLocation = $ax.annotation.adjustIconLocation = function(id, dObj) {
+ var ann = document.getElementById(id + "_ann");
+ if(ann) {
+ var corners = $ax.public.fn.getCornersFromComponent(id);
+ var width = $(ann).width();
+ var newTopRight = $ax.public.fn.vectorPlus(corners.relativeTopRight, corners.centerPoint);
+ //note size is 14x8, this is how rp calculated it as well
+ ann.style.left = (newTopRight.x - width) + "px";
+
+ var elementType = dObj ? dObj.type : $ax.getTypeFromElementId(id);
+ var yOffset = $ax.public.fn.IsTableCell(elementType) ? 0 : -8;
+ ann.style.top = (newTopRight.y + yOffset) + "px";
+ }
+
+ var ref = document.getElementById(id + "_ref");
+ if(ref) {
+ if(!corners) corners = $ax.public.fn.getCornersFromComponent(id);
+ var newBottomRight = $ax.public.fn.vectorPlus(corners.relativeBottomRight, corners.centerPoint);
+
+ ref.style.left = (newBottomRight.x - 8) + 'px';
+ ref.style.top = (newBottomRight.y - 10) + 'px';
+ }
+ }
+});
\ No newline at end of file
diff --git a/src/原型系统/resources/scripts/axure/axQuery.js b/src/原型系统/resources/scripts/axure/axQuery.js
new file mode 100644
index 0000000..7fbfe34
--- /dev/null
+++ b/src/原型系统/resources/scripts/axure/axQuery.js
@@ -0,0 +1,404 @@
+$axure = function(query) {
+ return $axure.query(query);
+};
+
+// ******* AxQuery and Page metadata ******** //
+(function() {
+ var $ax = function() {
+ var returnVal = $axure.apply(this, arguments);
+ var axFn = $ax.fn;
+ for (var key in axFn) {
+ returnVal[key] = axFn[key];
+ }
+
+ return returnVal;
+ };
+
+ $ax.public = $axure;
+ $ax.fn = {};
+
+ $axure.internal = function(initFunction) {
+ //Attach messagecenter to $ax object so that it can be used in viewer.js, etc in internal scope
+ if(!$ax.messageCenter) $ax.messageCenter = $axure.messageCenter;
+
+ return initFunction($ax);
+ };
+
+ var _lastFiredResize = 0;
+ var _resizeFunctions = [];
+ var _lastTimeout;
+ var _fireResize = function() {
+ if (_lastTimeout) window.clearTimeout(_lastTimeout);
+ _lastTimeout = undefined;
+ _lastFiredResize = new Date().getTime();
+ for(var i = 0; i < _resizeFunctions.length; i++) _resizeFunctions[i]();
+ };
+
+ $axure.resize = function(fn) {
+ if(fn) _resizeFunctions[_resizeFunctions.length] = fn;
+ else $(window).resize();
+ };
+
+ $(window).resize(function() {
+ var THRESHOLD = 50;
+ var now = new Date().getTime();
+ if(now - _lastFiredResize > THRESHOLD) {
+ _updateWindowInfo();
+ _fireResize();
+ } else if(!_lastTimeout) {
+ _lastTimeout = window.setTimeout(_fireResize, THRESHOLD);
+ }
+ });
+
+ $(window).scroll(function () {
+ _updateWindowInfo();
+ });
+
+ var _windowInfo;
+ var _updateWindowInfo = $axure.updateWindowInfo = function () {
+ var win = {};
+ var jWin = $(window);
+ var scrollWin = $('#ios-safari-html').length > 0 ? $('#ios-safari-html') : jWin;
+ win.width = jWin.width();
+ win.height = jWin.height();
+ win.scrollx = scrollWin.scrollLeft();
+ win.scrolly = scrollWin.scrollTop();
+ _windowInfo = win;
+ };
+ $ax.getWindowInfo = function () {
+ if(!_windowInfo) _updateWindowInfo();
+ return _windowInfo;
+ };
+
+
+ window.$obj = function(id) {
+ return $ax.getObjectFromElementId(id);
+ };
+
+ window.$id = function(obj) {
+ return obj.scriptIds[0];
+ };
+
+ window.$jobj = function(id) {
+ return $(document.getElementById(id));
+ };
+
+ window.$jobjAll = function(id) {
+ return $addAll($jobj(id), id);
+ };
+
+ window.$addAll = function(jobj, id) {
+ return jobj.add($jobj(id + '_ann')).add($jobj(id + '_ref'));
+ };
+
+ $ax.INPUT = function(id) { return id + "_input"; };
+ $ax.IsImageFocusable = function (type) { return $ax.public.fn.IsImageBox(type) || $ax.public.fn.IsVector(type) || $ax.public.fn.IsTreeNodeObject(type) || $ax.public.fn.IsTableCell(type); };
+ $ax.IsTreeNodeObject = function (type) { return $ax.public.fn.IsTreeNodeObject(type); };
+ $ax.IsSelectionButton = function (type) { return $ax.public.fn.IsCheckBox(type) || $ax.public.fn.IsRadioButton(type); };
+
+ var _fn = {};
+ $axure.fn = _fn;
+ $axure.fn.jQuery = function() {
+ var elements = this.getElements();
+ return $(elements);
+ };
+ $axure.fn.$ = $axure.fn.jQuery;
+
+ var _query = function(query, queryArg) {
+ var returnVal = {};
+ var _axQueryObject = returnVal.query = { };
+ _axQueryObject.filterFunctions = [];
+
+ if (query == '*') {
+ _axQueryObject.filterFunctions[0] = function() { return true; };
+ } else if (typeof(query) === 'function') {
+ _axQueryObject.filterFunctions[0] = query;
+ } else {
+ var firstString = $.trim(query.toString());
+ if (firstString.charAt(0) == '@') {
+ _axQueryObject.filterFunctions[0] = function(diagramObject) {
+ return diagramObject.label == firstString.substring(1);
+ };
+ } else if (firstString.charAt(0) == '#') {
+ _axQueryObject.elementId = firstString.substring(1);
+ } else {
+ if (firstString == 'label') {
+ _axQueryObject.filterFunctions[0] = function(diagramObject) {
+ return queryArg instanceof Array && queryArg.indexOf(diagramObject.label) > 0 ||
+ queryArg instanceof RegExp && queryArg.test(diagramObject.label) ||
+ diagramObject.label == queryArg;
+ };
+ } else if(firstString == 'elementId') {
+ _axQueryObject.filterFunctions[0] = function(diagramObject, elementId) {
+ return queryArg instanceof Array && queryArg.indexOf(elementId) > 0 ||
+ elementId == queryArg;
+ };
+ }
+ }
+ }
+
+ var axureFn = $axure.fn;
+ for (var key in axureFn) {
+ returnVal[key] = axureFn[key];
+ }
+ return returnVal;
+ };
+ $axure.query = _query;
+
+ var _getFilterFnFromQuery = function(query) {
+ var filter = function(diagramObject, elementId) {
+ // Non diagram objects are allowed to be queryed, such as text inputs.
+ if (diagramObject && !$ax.public.fn.IsReferenceDiagramObject(diagramObject.type) && !document.getElementById(elementId)) return false;
+ var retVal = true;
+ for(var i = 0; i < query.filterFunctions.length && retVal; i++) {
+ retVal = query.filterFunctions[i](diagramObject, elementId);
+ }
+ return retVal;
+ };
+ return filter;
+ };
+
+ $ax.public.fn.filter = function(query, queryArg) {
+ var returnVal = _query(query, queryArg);
+
+ if(this.query.elementId) returnVal.query.elementId = this.query.elementId;
+
+ //If there is already a function, offset by 1 when copying other functions over.
+ var offset = returnVal.query.filterFunctions[0] ? 1 : 0;
+
+ //Copy all functions over to new array.
+ for(var i = 0; i < this.query.filterFunctions.length; i++) returnVal.query.filterFunctions[i+offset] = this.query.filterFunctions[i];
+
+ //Functions are in reverse order now
+ returnVal.query.filterFunctions.reverse();
+
+ return returnVal;
+ };
+
+ $ax.public.fn.each = function(fn) {
+ var filter = _getFilterFnFromQuery(this.query);
+ var elementIds = this.query.elementId ? [this.query.elementId] : $ax.getAllElementIds();
+ for (var i = 0; i < elementIds.length; i++) {
+ var elementId = elementIds[i];
+ var diagramObject = $ax.getObjectFromElementId(elementId);
+ if (filter(diagramObject, elementId)) {
+ fn.apply(diagramObject, [diagramObject, elementId]);
+ }
+ }
+ };
+
+ $ax.public.fn.getElements = function() {
+ var elements = [];
+ this.each(function(dObj, elementId) {
+ var elementById = document.getElementById(elementId);
+ if(elementById) elements[elements.length] = elementById;
+ });
+ return elements;
+ };
+
+ $ax.public.fn.getElementIds = function() {
+ var elementIds = [];
+ this.each(function(dObj, elementId) { elementIds[elementIds.length] = elementId; });
+ return elementIds;
+ };
+
+ // Deep means to keep getting parents parent until at the root parent. Parent is then an array instead of an id.
+ // Filter options: layer, rdo, repeater, item, dynamicPanel, state
+ $ax.public.fn.getParents = function (deep, filter) {
+ if(filter == '*') filter = ['layer', 'rdo', 'repeater', 'item', 'dynamicPanel', 'state'];
+ var elementIds = this.getElementIds();
+ var parentIds = [];
+
+ var getParent = function(elementId) {
+ var containerIndex = elementId.indexOf('_container');
+ if(containerIndex !== -1) elementId = elementId.substring(0, containerIndex);
+ if(elementId.indexOf('_text') !== -1) elementId = $ax.GetShapeIdFromText(elementId);
+
+ // Check repeater item before layer, because repeater item detects it's parent layer, but wants to go directly to it's repeater first.
+ // if repeater item, then just return repeater
+ var scriptId = $ax.repeater.getScriptIdFromElementId(elementId);
+ var itemNum = $ax.repeater.getItemIdFromElementId(elementId);
+ var parentRepeater = $ax.getParentRepeaterFromScriptId(scriptId);
+
+ // scriptId is item or repeater itself
+ if (parentRepeater == scriptId) {
+ // If you are repeater item, return your repeater
+ if (itemNum) return filter.indexOf('repeater') != -1 ? scriptId : getParent(scriptId);
+ // Otherwise you are actually at repeater, clean parentRepeater, or else you loop
+ parentRepeater = undefined;
+ }
+
+ // Layer only references it if it is a direct layer to it
+ var parent = $ax.getLayerParentFromElementId(elementId);
+ // If layer is allowed we found parent, otherwise ignore and keep climbing
+ if (parent) return filter.indexOf('layer') != -1 ? parent : getParent(parent);
+
+ // if state, then just return panel
+ if(scriptId.indexOf('_state') != -1) {
+ var panelId = $ax.repeater.createElementId(scriptId.split('_')[0], itemNum);
+ // If dynamic panel is allowed we found parent, otherwise ignore and keep climbing
+ return filter.indexOf('dynamicPanel') != -1 ? panelId : getParent(panelId);
+ }
+
+ var parentType = '';
+ if(parentRepeater) {
+ parentType = 'item';
+ parent = $ax.repeater.createElementId(parentRepeater, itemNum);
+ }
+
+ var masterPath = $ax.getPathFromScriptId($ax.repeater.getScriptIdFromElementId(elementId));
+ masterPath.pop();
+ if(masterPath.length > 0) {
+ var masterId = $ax.getElementIdFromPath(masterPath, { itemNum: itemNum }, true);
+ if(!masterId) return undefined;
+ var masterRepeater = $ax.getParentRepeaterFromElementId($ax.repeater.getScriptIdFromElementId(masterId));
+ if(!parentRepeater || masterRepeater) {
+ parentType = 'rdo';
+ parent = masterId;
+ }
+ }
+
+ var obj = $obj(elementId);
+ var parentDynamicPanel = obj.parentDynamicPanel;
+ if(parentDynamicPanel) {
+ // Make sure the parent if not parentRepeater, or dynamic panel is also in that repeater
+ // If there is a parent master, the dynamic panel must be in it, otherwise parentDynamicPanel would be undefined.
+ var panelPath = masterPath;
+ panelPath[panelPath.length] = parentDynamicPanel;
+ panelId = $ax.getElementIdFromPath(panelPath, { itemNum: itemNum }, true);
+ if(!panelId) return undefined;
+ var panelRepeater = $ax.getParentRepeaterFromElementId(panelId);
+ if(!parentRepeater || panelRepeater) {
+ parentType = 'state';
+ parent = panelId + '_state' + obj.panelIndex;
+ }
+ }
+
+ // If at top or parent type is desired, then return parent, otherwise keep climbing
+ return !parent || filter.indexOf(parentType) != -1 ? parent : getParent(parent);
+ };
+
+ for(var i = 0; i < elementIds.length; i++) {
+ var parent = getParent(elementIds[i]);
+ if(deep) {
+ var parents = [];
+ while(parent) {
+ parents[parents.length] = parent;
+ // If id is not a valid object, you are either repeater item or dynamic panel state
+ //if(!$obj(parent)) parent = $ax.visibility.getWidgetFromContainer($jobj(parent).parent().attr('id'));
+
+ parent = getParent(parent);
+ }
+ parent = parents;
+ }
+ parentIds[parentIds.length] = parent;
+ }
+ return parentIds;
+ };
+
+ // Get the path to the child, where non leaf nodes can be masters, layers, dynamic panels, and repeaters.
+ $ax.public.fn.getChildren = function(deep, ignoreUnplaced) { // ignoreUnplaced should probably be the default, but when that is done a full audit of usages should be done
+ var elementIds = this.getElementIds();
+ var children = [];
+
+ var getChildren = function (elementId) {
+ var obj = $obj(elementId);
+ //if(!obj) return undefined;
+
+ var isRepeater = obj && obj.type == $ax.constants.REPEATER_TYPE;
+ if (isRepeater && $ax.repeater.getScriptIdFromElementId(elementId) != elementId) {
+ //prevent repeater items from being marked as isRepeater
+ //TODO: evaluate changing the naming convention to be more like panel states which don't seem to have this problem
+ obj = undefined;
+ isRepeater = false;
+ }
+ var isDynamicPanel = obj && obj.type == $ax.constants.DYNAMIC_PANEL_TYPE;
+ //var isLayer = obj.type == $ax.constants.LAYER_TYPE;
+ //var isMaster = obj.type == $ax.constants.MASTER_TYPE || obj.type == $ax.constants.REFERENCE_DIAGRAM_OBJECT_TYPE;
+
+ var isMenu = obj && obj.type == $ax.constants.MENU_OBJECT_TYPE;
+ var isTreeNode = obj && obj.type == $ax.constants.TREE_NODE_OBJECT_TYPE;
+ //var isTable = obj.type == $ax.constants.TABLE_TYPE;
+ //var isCompoundVector = obj.type == $ax.constants.VECTOR_SHAPE_TYPE && obj.generateCompound;
+
+ //if (isRepeater || isDynamicPanel || isLayer || isMaster || isMenu || isTreeNode || isTable) {// || isCompoundVector) {
+ // Find parent that children should be pulled from. Default is just the elementId query (used by table and master)
+ var parent = $jobj(elementId);
+ if(isRepeater) {
+ parent = $();
+ var itemIds = $ax.getItemIdsForRepeater(elementId);
+ for(var itemIndex = 0; itemIndex < itemIds.length; itemIndex++) parent = parent.add($jobj($ax.repeater.createElementId(elementId, itemIds[itemIndex])));
+ } else if(isDynamicPanel) {
+ // Really only need to do active state probably...
+ parent = $jobj(elementId).children();
+ // Get through all containers
+ while ($(parent[0]).attr('id').indexOf('container') != -1) parent = parent.children();
+ // Now at states, but want states content
+ parent = parent.children();
+ } else if(isTreeNode) parent = $jobj($ax.repeater.applySuffixToElementId(elementId, '_children'));
+
+ // Menu doesn't want all children, only tables and menus, so it must be handled specially
+ var children = isMenu ? parent.children('.ax_table').add(parent.children('.ax_menu')) : parent.children();
+ children = $ax.visibility.getRealChildren(_fixForBasicLinks(children));
+
+ // For tree nodes you want the the button shape contained by the elementQuery too
+ if(isTreeNode) {
+ var treeNodeChildren = $jobj(elementId).children();
+ for(var treeNodeIndex = 0; treeNodeIndex < treeNodeChildren.length; treeNodeIndex++) {
+ var treeNodeChild = $(treeNodeChildren[treeNodeIndex]);
+ var childObj = $obj(treeNodeChild.attr('id'));
+ if (childObj && $ax.public.fn.IsVector(childObj.type)) children = children.add(treeNodeChild);
+ }
+ }
+
+
+ var childrenIds = [];
+ for(var childIndex = 0; childIndex < children.length; childIndex++) {
+ var childObj = $(children[childIndex]);
+ var id = childObj.attr('id');
+ if(typeof(id) == 'undefined' && childObj.is('a')) id = $(childObj.children()[0]).attr('id');
+ // Ignore annotations and any other children that are not elements
+ if (id.split('_').length > 1) continue;
+ // Ignore Unplaced
+ if(ignoreUnplaced && $ax.visibility.isScriptIdLimbo($ax.repeater.getScriptIdFromElementId(id))) continue;
+ childrenIds.push(id);
+ }
+
+ if(deep) {
+ var childObjs = [];
+ for(var i = 0; i < childrenIds.length; i++) {
+ var childId = childrenIds[i];
+ childObjs[i] = { id: childId, children: getChildren(childId) };
+ }
+ childrenIds = childObjs;
+ }
+
+ return childrenIds;
+ //}
+
+ //return undefined;
+ };
+
+ for(var i = 0; i < elementIds.length; i++) {
+ var elementId = elementIds[i];
+ //if the state is passed in, look for children in the content element
+ if (elementId.indexOf('_state') > -1 && elementId.indexOf('_content') < 0) elementId = elementId + '_content';
+ children[children.length] = { id: elementId, children: getChildren(elementId)};
+ }
+ return children;
+ };
+
+ var _fixForBasicLinks = function(query) {
+ var hasBasicLinks = query.filter('.basiclink').length > 0;
+ if(!hasBasicLinks) return query;
+
+ var retval = $();
+ for(var i = 0; i < query.length; i++) {
+ var child = $(query[i]);
+ if(child.hasClass('basiclink')) retval = retval.add(child.children());
+ else retval = retval.add(child);
+ }
+ return retval;
+ };
+
+})();
\ No newline at end of file
diff --git a/src/原型系统/resources/scripts/axure/axQuery.std.js b/src/原型系统/resources/scripts/axure/axQuery.std.js
new file mode 100644
index 0000000..5be1d28
--- /dev/null
+++ b/src/原型系统/resources/scripts/axure/axQuery.std.js
@@ -0,0 +1,1806 @@
+// ******* AxQuery Plugins ******** //
+
+$axure.internal(function($ax) {
+ $ax.constants = {};
+
+ $ax.constants.TABLE_TYPE = 'table';
+ $ax.constants.MENU_OBJECT_TYPE = 'menuObject';
+ $ax.constants.MASTER_TYPE = 'master';
+ $ax.constants.PAGE_TYPE = 'page';
+ $ax.constants.REFERENCE_DIAGRAM_OBJECT_TYPE = 'referenceDiagramObject';
+ $ax.constants.REPEATER_TYPE = 'repeater';
+ $ax.constants.DYNAMIC_PANEL_TYPE = 'dynamicPanel';
+ $ax.constants.LAYER_TYPE = 'layer';
+ $ax.constants.TEXT_BOX_TYPE = 'textBox';
+ $ax.constants.TEXT_AREA_TYPE = 'textArea';
+ $ax.constants.LIST_BOX_TYPE = 'listBox';
+ $ax.constants.COMBO_BOX_TYPE = 'comboBox';
+ $ax.constants.CHECK_BOX_TYPE = 'checkbox';
+ $ax.constants.RADIO_BUTTON_TYPE = 'radioButton';
+ $ax.constants.BUTTON_TYPE = 'button'; //html button
+ $ax.constants.IMAGE_MAP_REGION_TYPE = 'imageMapRegion';
+ $ax.constants.IMAGE_BOX_TYPE = 'imageBox';
+ $ax.constants.VECTOR_SHAPE_TYPE = 'vectorShape';
+ $ax.constants.SNAPSHOT_TYPE = 'screenshot';
+ $ax.constants.TREE_NODE_OBJECT_TYPE = 'treeNodeObject';
+ $ax.constants.TABLE_CELL_TYPE = 'tableCell';
+ $ax.constants.VERTICAL_LINE_TYPE = 'verticalLine';
+ $ax.constants.HORIZONTAL_LINE_TYPE = 'horizontalLine';
+ $ax.constants.INLINE_FRAME_TYPE = 'inlineFrame';
+ $ax.constants.CONNECTOR_TYPE = 'connector';
+ $ax.constants.ALL_TYPE = '*';
+
+ $ax.constants.TEXT_TYPE = 'richTextPanel';
+ $ax.constants.LINK_TYPE = 'hyperlink';
+
+ // TODO: Need solid passo f this. Constants should be able to bemade local, may need some public lists or something.
+ // public.fn function should take not arg and use this. May need some $ax.IsType fuctions that will take a type arg and be static
+ $ax.public.fn.IsTable = function (type) { return type == $ax.constants.TABLE_TYPE; }
+ $ax.public.fn.IsMenuObject = function (type) { return type == $ax.constants.MENU_OBJECT_TYPE; }
+ $ax.public.fn.IsMaster = function (type) { return type == $ax.constants.MASTER_TYPE; }
+ $ax.public.fn.IsPage = function (type) { return type == $ax.constants.PAGE_TYPE; }
+ $ax.public.fn.IsReferenceDiagramObject = function (type) { return type == $ax.constants.REFERENCE_DIAGRAM_OBJECT_TYPE; }
+ $ax.public.fn.IsRepeater = function (type) { return type == $ax.constants.REPEATER_TYPE; }
+ $ax.public.fn.IsDynamicPanel = $ax.IsDynamicPanel = function (type) { return type == $ax.constants.DYNAMIC_PANEL_TYPE; }
+ $ax.public.fn.IsLayer = $ax.IsLayer = function (type) { return type == $ax.constants.LAYER_TYPE; }
+ $ax.public.fn.IsTextBox = function (type) { return type == $ax.constants.TEXT_BOX_TYPE; }
+ $ax.public.fn.IsTextArea = function (type) { return type == $ax.constants.TEXT_AREA_TYPE; }
+ $ax.public.fn.IsListBox = function (type) { return type == $ax.constants.LIST_BOX_TYPE; }
+ $ax.public.fn.IsComboBox = function (type) { return type == $ax.constants.COMBO_BOX_TYPE; }
+ $ax.public.fn.IsCheckBox = function (type) { return type == $ax.constants.CHECK_BOX_TYPE; }
+ $ax.public.fn.IsRadioButton = function (type) { return type == $ax.constants.RADIO_BUTTON_TYPE; }
+ $ax.public.fn.IsButton = function (type) { return type == $ax.constants.BUTTON_TYPE; }
+ $ax.public.fn.IsIamgeMapRegion = function (type) { return type == $ax.constants.IMAGE_MAP_REGION_TYPE; }
+ $ax.public.fn.IsImageBox = function (type) { return type == $ax.constants.IMAGE_BOX_TYPE; }
+ $ax.public.fn.IsVector = function (type) { return type == $ax.constants.VECTOR_SHAPE_TYPE; }
+ $ax.public.fn.IsSnapshot = function (type) { return type == $ax.constants.SNAPSHOT_TYPE; }
+ $ax.public.fn.IsTreeNodeObject = function (type) { return type == $ax.constants.TREE_NODE_OBJECT_TYPE; }
+ $ax.public.fn.IsTableCell = function (type) { return type == $ax.constants.TABLE_CELL_TYPE; }
+ $ax.public.fn.IsInlineFrame = function (type) { return type == $ax.constants.INLINE_FRAME_TYPE; }
+ $ax.public.fn.IsConnector = function (type) { return type == $ax.constants.CONNECTOR_TYPE; }
+ $ax.public.fn.IsContainer = function (type) { return type== $ax.constants.VECTOR_SHAPE_TYPE || type == $ax.constants.TABLE_TYPE || type == $ax.constants.MENU_OBJECT_TYPE || type == $ax.constants.TREE_NODE_OBJECT_TYPE; }
+
+ var PLAIN_TEXT_TYPES = [$ax.constants.TEXT_BOX_TYPE, $ax.constants.TEXT_AREA_TYPE, $ax.constants.LIST_BOX_TYPE,
+ $ax.constants.COMBO_BOX_TYPE, $ax.constants.CHECK_BOX_TYPE, $ax.constants.RADIO_BUTTON_TYPE, $ax.constants.BUTTON_TYPE];
+
+ $ax.public.fn.IsResizable = function (type) { return $.inArray(type, RESIZABLE_TYPES) !== -1; }
+ var RESIZABLE_TYPES = [
+ $ax.constants.BUTTON_TYPE, $ax.constants.DYNAMIC_PANEL_TYPE, $ax.constants.IMAGE_BOX_TYPE, $ax.constants.IMAGE_MAP_REGION_TYPE,
+ $ax.constants.INLINE_FRAME_TYPE, $ax.constants.LAYER_TYPE, $ax.constants.LIST_BOX_TYPE, $ax.constants.COMBO_BOX_TYPE,
+ $ax.constants.VECTOR_SHAPE_TYPE, $ax.constants.TEXT_AREA_TYPE, $ax.constants.TEXT_BOX_TYPE, $ax.constants.SNAPSHOT_TYPE
+ ];
+
+ $ax.public.fn.SupportsRichText = function() {
+ var obj = $obj(this.getElementIds()[0]);
+ // Catch root tree nodes as they are not supported.
+ if(obj.type == $ax.constants.TREE_NODE_OBJECT_TYPE) return obj.friendlyType == 'Tree Node';
+ // Do the same for tree node icons maybe?
+
+ return $.inArray(obj.type, SUPPORTS_RICH_TEXT_TYPES) != -1;
+ }
+ var SUPPORTS_RICH_TEXT_TYPES = [$ax.constants.CHECK_BOX_TYPE, $ax.constants.RADIO_BUTTON_TYPE,
+ $ax.constants.IMAGE_BOX_TYPE, $ax.constants.VECTOR_SHAPE_TYPE, $ax.constants.TABLE_CELL_TYPE, $ax.constants.CONNECTOR_TYPE];
+
+ var _addJQueryFunction = function(name) {
+ $ax.public.fn[name] = function() {
+ var val = $.fn[name].apply(this.jQuery(), arguments);
+ return arguments[0] ? this : val;
+ };
+ };
+ var _jQueryFunctionsToAdd = ['text', 'val', 'css'];
+ for (var jqueryFunctionIndex = 0; jqueryFunctionIndex < _jQueryFunctionsToAdd.length; jqueryFunctionIndex++) _addJQueryFunction(_jQueryFunctionsToAdd[jqueryFunctionIndex]);
+
+
+ // var _addJQueryEventFunction = function(name) {
+ // $ax.public.fn[name] = function() {
+ // $.fn[name].apply(this.jQuery(), arguments);
+ // return this;
+ // };
+ // };
+
+ // var _addJQueryEventFunction = function(name) {
+ // $ax.public.fn[name] = (function(nn) {
+ // return function() {
+ // $.fn[nn].apply(this.jQuery(), arguments);
+ // return this;
+ // };
+ // })(name);
+ // };
+
+ var _addJQueryEventFunction = function(name) {
+ $ax.public.fn[name] = function() {
+ //With Martin - No idea why this is necessary. We tried encapsulating the function thinking it was related to closure (above),
+ //but that didn't fix the problem. If we don't add this Repeaters will give "Uncaught TypeError: Object #
has no method 'apply'"
+ //here (but Indeterminately, often on larger/slower Repeaters) because it is Undefined. However it seems the catch is never hit
+ //if we surround the statement with the try/catch. Perhaps the try/catch block creates a scope or closure.
+ try {
+ $.fn[name].apply(this.jQuery(), arguments);
+ } catch(e) {
+ console.log("Couldn't find the event: " + name);
+ }
+
+ return this;
+ };
+ };
+ var _jQueryEventFunctionsToAdd = ['click', 'mouseenter', 'mouseleave', 'bind'];
+ for(var jqueryEventIndex = 0; jqueryEventIndex < _jQueryEventFunctionsToAdd.length; jqueryEventIndex++) _addJQueryEventFunction(_jQueryEventFunctionsToAdd[jqueryEventIndex]);
+
+
+ $ax.public.fn.openLink = function(url, includeVariables) {
+ this.jQuery().each(function() {
+ if(!($(this).is('iframe'))) {
+ return;
+ }
+
+ var objIframe = $(this).get(0);
+
+ $ax.navigate({
+ url: url,
+ target: "frame",
+ includeVariables: includeVariables,
+ frame: objIframe
+ });
+ });
+
+ return this;
+ };
+
+ $ax.public.fn.SetPanelState = function(stateNumber, options, showWhenSet) {
+
+ var animateInInfo = _getAnimateInfo(options && options.animateIn, 500);
+ var animateOutInfo = _getAnimateInfo(options && options.animateOut, 500);
+
+ var elementIds = this.getElementIds();
+
+ for(var index = 0; index < elementIds.length; index++) {
+ var elementId = elementIds[index];
+ if ($ax.public.fn.IsDynamicPanel($ax.getTypeFromElementId(elementId))) {
+ var stateName = $ax.visibility.GetPanelStateId(elementId, Number(stateNumber) - 1);
+ var wasVisible = $ax.visibility.IsIdVisible(elementId);
+ // If compressing because you are fit to content and the change of state may change size, must be before the change.
+ if(options.compress && $ax.dynamicPanelManager.isIdFitToContent(elementId) && wasVisible) {
+ $ax.dynamicPanelManager.compressDelta(elementId, $ax.visibility.GetPanelState(elementId), stateName, options.vertical, options.compressEasing, options.compressDuration);
+ }
+ $ax.visibility.SetPanelState(elementId, stateName, animateOutInfo.easingType, animateOutInfo.direction, animateOutInfo.duration,
+ animateInInfo.easingType, animateInInfo.direction, animateInInfo.duration, showWhenSet);
+ // If compressing because of a show, must be after state is set.
+ if(options.compress && !wasVisible && showWhenSet) {
+ $ax.dynamicPanelManager.compressToggle(elementId, options.vertical, true, options.compressEasing, options.compressDuration);
+ }
+ }
+ }
+
+ return this;
+ };
+
+ $ax.public.fn.show = function(options, eventInfo) {
+ var elementIds = this.getElementIds();
+
+ for(var index = 0; index < elementIds.length; index++) {
+ var elementId = elementIds[index];
+
+ var lightboxId = $ax.repeater.applySuffixToElementId(elementId, '_lightbox');
+ var lightbox = $jobj(lightboxId);
+ if(options && options.showType == 'lightbox') {
+ $ax.flyoutManager.unregisterPanel(elementId, true);
+ // Add lightbox if there isn't one
+ if(lightbox.length == 0) {
+ lightbox = $('
');
+ lightbox.attr('id', lightboxId);
+ var color = 'rgb(' + options.lightbox.r + ',' + options.lightbox.g + ',' + options.lightbox.b + ')';
+ lightbox.css({
+ position: 'fixed',
+ left: '0px',
+ top: '0px',
+ width: '10000px',
+ height: '10000px',
+ 'background-color': color,
+ opacity: options.lightbox.a / 255
+ });
+
+ var parents = $ax('#' + elementId).getParents(true, ['dynamicPanel'])[0];
+ var fixedParentPanelId = undefined;
+ for(var j = 0; j < parents.length; j++) {
+ var parentId = parents[j];
+ if($jobj(parentId).css('z-index') != 'auto' || $ax.features.supports.mobile) {
+ fixedParentPanelId = parents[j];
+ break;
+ }
+ }
+
+ if(!fixedParentPanelId) $('#base').append(lightbox);
+ else $jobj(fixedParentPanelId).append(lightbox);
+
+ var wasVisible = $ax.visibility.IsIdVisible(elementId);
+
+ (function(lightbox, query) {
+ $ax.event.attachClick(lightbox, function() {
+ $ax.action.addAnimation(elementId, $ax.action.queueTypes.fade, function() {
+ if(!wasVisible) query.hide();
+ else $ax.action.fireAnimationFromQueue(elementId, $ax.action.queueTypes.fade);
+ lightbox.remove();
+ });
+ });
+ })(lightbox, this);
+ }
+ $ax.legacy.BringToFront(lightboxId, true);
+ $ax.legacy.BringToFront(elementId, true);
+ } else if(options && options.showType == 'flyout') {
+ // Remove lightbox if there is one
+ lightbox.remove();
+
+ var src = eventInfo.thiswidget;
+ var target = $ax.getWidgetInfo(elementId);
+ var rects = {};
+ if(src.valid) rects.src = $ax.geometry.genRect(src, true);
+ if(target.valid) rects.target = $ax.geometry.genRect(target, true);
+ $ax.flyoutManager.registerFlyout(rects, elementId, eventInfo.srcElement);
+ //$ax.style.AddRolloverOverride(elementId);
+ $ax.legacy.BringToFront(elementId);
+ } else {
+ // Remove lightbox, unregister flyout
+ lightbox.remove();
+ $ax.flyoutManager.unregisterPanel(elementId, true);
+ }
+ _setVisibility(elementId, true, options);
+ }
+
+ return this;
+ };
+
+ var _getAnimateInfo = function (options, defaultDuration, useHide) {
+ var durationOption, easingOption, animationOption;
+
+ if(options) {
+ if (useHide) {
+ durationOption = options.durationHide;
+ easingOption = options.easingHide;
+ animationOption = options.animationHide;
+ } else {
+ durationOption = options.duration;
+ easingOption = options.easing;
+ animationOption = options.animation;
+ }
+ if (animationOption == 'none') animationOption = 'swing';
+ } else {
+ durationOption = defaultDuration;
+ easingOption = 'none',
+ animationOption = 'swing';
+ }
+ var animateInfo = { duration: durationOption };
+ switch (easingOption) {
+ case 'fade':
+ animateInfo.easingType = 'fade';
+ animateInfo.direction = '';
+ break;
+ case 'slideLeft':
+ animateInfo.easingType = animationOption;
+ animateInfo.direction = 'left';
+ break;
+ case 'slideRight':
+ animateInfo.easingType = animationOption;
+ animateInfo.direction = 'right';
+ break;
+ case 'slideUp':
+ animateInfo.easingType = animationOption;
+ animateInfo.direction = 'up';
+ break;
+ case 'slideDown':
+ animateInfo.easingType = animationOption;
+ animateInfo.direction = 'down';
+ break;
+ case 'flipLeft':
+ animateInfo.easingType = 'flip';
+ animateInfo.direction = 'left';
+ break;
+ case 'flipRight':
+ animateInfo.easingType = 'flip';
+ animateInfo.direction = 'right';
+ break;
+ case 'flipUp':
+ animateInfo.easingType = 'flip';
+ animateInfo.direction = 'up';
+ break;
+ case 'flipDown':
+ animateInfo.easingType = 'flip';
+ animateInfo.direction = 'down';
+ break;
+ default:
+ animateInfo.easingType = 'none';
+ animateInfo.direction = '';
+ }
+
+ return animateInfo;
+ };
+
+ $ax.public.fn.hide = function(options) {
+ var elementIds = this.getElementIds();
+
+ for(var index = 0; index < elementIds.length; index++) {
+ var elementId = elementIds[index];
+// var wasShown = $ax.visibility.IsIdVisible(elementId);
+ _setVisibility(elementId, false, options, true);
+ }
+
+ return this;
+ };
+
+ $ax.public.fn.toggleVisibility = function(options) {
+ var elementIds = this.getElementIds();
+
+ for (var index = 0; index < elementIds.length; index++) {
+ var elementId = elementIds[index];
+ var show = !$ax.visibility.IsIdVisible(elementId);
+ _setVisibility(elementId, show, options, !show);
+ }
+
+ return this;
+ };
+
+ var _setVisibility = function (elementId, value, options, useHide) {
+ var animateInfo = _getAnimateInfo(options, 0, useHide);
+
+ var wasShown = $ax.visibility.IsIdVisible(elementId);
+ var compress = options && options.showType == 'compress' && wasShown != value;
+ if (compress) $ax.dynamicPanelManager.compressToggle(elementId, options.vertical, value, options.compressEasing, options.compressDuration);
+
+ var onComplete = function () {
+ $ax.dynamicPanelManager.fitParentPanel(elementId);
+ };
+ $ax.visibility.SetWidgetVisibility(elementId, {
+ value: value,
+ easing: animateInfo.easingType,
+ direction: animateInfo.direction,
+ duration: animateInfo.duration,
+ animation: animateInfo.animation,
+ fire: true,
+ onComplete: onComplete
+ });
+
+ if(options && options.bringToFront) $ax.legacy.BringToFront(elementId);
+ };
+
+ $ax.public.fn.setOpacity = function(opacity, easing, duration) {
+ if(!easing || ! duration) {
+ easing = 'none';
+ duration = 0;
+ }
+
+ var elementIds = this.getElementIds();
+
+ for(var index = 0; index < elementIds.length; index++) {
+ var elementId = elementIds[index];
+ var onComplete = function() {
+ $ax.action.fireAnimationFromQueue(elementId, $ax.action.queueTypes.fade);
+ };
+
+ var query = $jobj(elementId);
+ if(duration == 0 || easing == 'none') {
+ query.css('opacity', opacity);
+ onComplete();
+ } else query.animate({ opacity: opacity }, { duration: duration, easing: easing, queue: false, complete: onComplete });
+ }
+ }
+ //move one widget. I didn't combine moveto and moveby, since this is in .public, and separate them maybe more clear for the user
+ var _move = function (elementId, x, y, options, moveTo) {
+ if(!options.easing) options.easing = 'none';
+ if(!options.duration) options.duration = 500;
+ var obj = $obj(elementId);
+
+ // Layer move using container now.
+ if($ax.public.fn.IsLayer(obj.type)) {
+ $ax.move.MoveWidget(elementId, x, y, options, moveTo,
+ function () {
+ if(options.onComplete) options.onComplete();
+ $ax.dynamicPanelManager.fitParentPanel(elementId);
+ }, false);
+ } else {
+ var xDelta = x;
+ var yDelta = y;
+ if (moveTo) {
+ var jobj = $jobj(elementId);
+ var left = $ax.getNumFromPx(jobj.css('left'));
+ var top = $ax.getNumFromPx(jobj.css('top'));
+ xDelta = x - left;
+ yDelta = y - top;
+ }
+ $ax.move.MoveWidget(elementId, xDelta, yDelta, options, false,
+ function () { $ax.dynamicPanelManager.fitParentPanel(elementId); }, true);
+ }
+ };
+
+ $ax.public.fn.moveTo = function (x, y, options) {
+ var elementIds = this.getElementIds();
+ for(var index = 0; index < elementIds.length; index++) {
+ _move(elementIds[index], x, y, options, true);
+ }
+
+ return this;
+ };
+
+ $ax.public.fn.moveBy = function (x, y, options) {
+ var elementIds = this.getElementIds();
+
+ if(x == 0 && y == 0) {
+ for(var i = 0; i < elementIds.length; i++) {
+ var elementId = elementIds[i];
+ $ax.move.nopMove(elementId, options);
+
+ //$ax.event.raiseSyntheticEvent(elementId, "onMove");
+ $ax.action.fireAnimationFromQueue(elementId, $ax.action.queueTypes.move);
+
+ //if($axure.fn.IsLayer($obj(elementId).type)) {
+ // var childrenIds = $ax.public.fn.getLayerChildrenDeep(elementId, true);
+ // for(var j = 0; j < childrenIds.length; j++) $ax.event.raiseSyntheticEvent(childrenIds[j], 'onMove');
+ //}
+ }
+ return this;
+ }
+
+ for(var index = 0; index < elementIds.length; index++) {
+ _move(elementIds[index], x, y, options, false);
+ }
+ return this;
+ };
+
+ $ax.public.fn.circularMoveAndRotate = function(degreeChange, options, centerPointLeft, centerPointTop, doRotation, moveDelta, resizeOffset, rotatableMove, moveComplete) {
+ if(!rotatableMove) rotatableMove = { x: 0, y: 0 };
+ var elementIds = this.getElementIds();
+
+ for(var index = 0; index < elementIds.length; index++) {
+ var elementId = elementIds[index];
+
+ var onComplete = function () {
+ $ax.dynamicPanelManager.fitParentPanel(elementId);
+ if (moveComplete) moveComplete();
+ }
+
+ $ax.move.circularMove(elementId, degreeChange, { x: centerPointLeft, y: centerPointTop }, moveDelta, rotatableMove, resizeOffset, options, true, onComplete, doRotation);
+ if(doRotation) $ax.move.rotate(elementId, degreeChange, options.easing, options.duration, false, true, function () { $ax.dynamicPanelManager.fitParentPanel(elementId); });
+ else $ax.action.fireAnimationFromQueue(elementId, $ax.action.queueTypes.rotate);
+ }
+ };
+
+ $ax.public.fn.rotate = function (degree, easing, duration, to, axShouldFire) {
+ var elementIds = this.getElementIds();
+ // this function will no longer handle compound vectors.
+
+ for(var index = 0; index < elementIds.length; index++) {
+ var elementId = elementIds[index];
+ degree = parseFloat(degree);
+ $ax.move.rotate(elementId, degree, easing, duration, to, axShouldFire, function () { $ax.dynamicPanelManager.fitParentPanel(elementId); });
+ }
+ };
+
+ $ax.public.fn.resize = function(newLocationAndSizeCss, resizeInfo, axShouldFire, moves, onCompletedFunc) {
+ var elementIds = this.getElementIds();
+ if(!elementIds) return;
+
+ var completeAndFire = function(moved, id) {
+ if(axShouldFire) {
+ $ax.action.fireAnimationFromQueue(id, $ax.action.queueTypes.resize);
+ if(moves) $ax.action.fireAnimationFromQueue(id, $ax.action.queueTypes.move);
+ }
+
+ if(onCompletedFunc) onCompletedFunc();
+ };
+
+ for(var index = 0; index < elementIds.length; index++) {
+ var elementId = elementIds[index];
+
+ var obj = $obj(elementId);
+ if(!$ax.public.fn.IsResizable(obj.type)) {
+ //$ax.dynamicPanelManager.fitParentPanel(elementId);
+ completeAndFire(moves, elementId);
+ continue;
+ }
+
+ var oldSize = $ax('#' + elementId).size();
+ var oldWidth = oldSize.width;
+ var oldHeight = oldSize.height;
+ var query = $jobj(elementId);
+
+ var isDynamicPanel = $ax.public.fn.IsDynamicPanel(obj.type);
+ if(isDynamicPanel) {
+ // No longer fitToContent, calculate additional styling that needs to be done.
+ $ax.dynamicPanelManager.setFitToContentCss(elementId, false, oldWidth, oldHeight);
+
+ if (query.css('position') == 'fixed' && ((obj.fixedHorizontal && obj.fixedHorizontal == 'center') || (obj.fixedVertical && obj.fixedVertical == 'middle'))) {
+ moves = true;
+ var loc = $ax.dynamicPanelManager.getFixedPosition(elementId, oldWidth, oldHeight, newLocationAndSizeCss.width, newLocationAndSizeCss.height);
+ if(loc) {
+ if (loc[0] != 0 && !$ax.dynamicPanelManager.isPercentWidthPanel(obj)) newLocationAndSizeCss['margin-left'] = '+=' + (Number(newLocationAndSizeCss['margin-left'].substr(2)) + loc[0]);
+ if (loc[1] != 0) newLocationAndSizeCss['margin-top'] = '+=' + (Number(newLocationAndSizeCss['margin-top'].substr(2)) + loc[1]);
+ }
+ }
+
+ var onComplete = function() {
+ $ax.flyoutManager.updateFlyout(elementId);
+ $ax.dynamicPanelManager.fitParentPanel(elementId);
+ $ax.dynamicPanelManager.updatePanelPercentWidth(elementId);
+ $ax.dynamicPanelManager.updatePanelContentPercentWidth(elementId);
+
+ completeAndFire(moves, elementId);
+ $ax.event.raiseSyntheticEvent(elementId, 'onResize');
+ };
+
+ } else {
+ ////if contains text
+ //var textChildren = query.children('div.text');
+ //if(textChildren && textChildren.length != 0) {
+ // var textDivId = textChildren.attr('id');
+ // var padding = $ax.style.getPadding(textDivId);
+ // var leftPadding = padding.paddingLeft;
+ // var rightPadding = padding.paddingRight;
+ // //var textObj = $ax('#' + textDivId);
+ // //var leftPadding = textObj.left(true);
+ // //var rightPadding = oldWidth - leftPadding - textObj.width();
+
+ // //greater or equal to 1px
+ // var newTextWidth = Math.max(newLocationAndSizeCss.width - leftPadding - rightPadding, 1);
+ // var textChildCss = { width: newTextWidth };
+
+ // var textStepFunction = function() {
+ // //change the width of the text div may effect the height
+ // //var currentTextHeight = Number($(textChildren.children('p')[0]).css('height').replace('px', ''));
+ // //textChildren.css('height', currentTextHeight);
+ // //var display = $ax.public.fn.displayHackStart(document.getElementById(textDivId));
+
+ // var trap = _displayWidget(textDivId);
+ // $ax.style.setTextAlignment([textDivId]);
+ // trap();
+
+ // //$ax.public.fn.displayHackEnd(display);
+ // };
+ //}
+
+ //get all the other children that matters
+ onComplete = function() {
+ $ax.dynamicPanelManager.fitParentPanel(elementId);
+ completeAndFire(moves, elementId);
+
+ $ax.annotation.adjustIconLocation(elementId);
+ $ax.event.raiseSyntheticEvent(elementId, 'onResize');
+ };
+ }
+
+ var children = query.children().not('div.text');
+ while(children && children.length && $(children[0]).attr('id').indexOf('container') != -1) {
+ children = children.children().not('div.text');
+ }
+
+ if(children && children.length !== 0) {
+ var childAnimationArray = [];
+ var isConnector = $ax.public.fn.IsConnector(obj.type);
+ children.each(function (i, child) {
+ var childCss = {
+ width: newLocationAndSizeCss.width,
+ height: newLocationAndSizeCss.height
+ };
+
+ //$ax.size() use outerWidth/Height(false), which include padding and borders(no margins)
+ var childSizingObj = $ax('#' + child.id).size();
+ var differentSizedImage = childSizingObj.width - oldWidth != 0 || childSizingObj.height - oldHeight != 0;
+ if ((differentSizedImage || isConnector) && child.tagName == 'IMG') {
+ //oldwidth is zero for connectors
+ var widthOffset = oldWidth ? (childSizingObj.width - oldWidth) * newLocationAndSizeCss.width / oldWidth : childSizingObj.width;
+ var heightOffset = oldHeight ? (childSizingObj.height - oldHeight) * newLocationAndSizeCss.height / oldHeight : childSizingObj.height;
+
+ childCss.width += widthOffset;
+ childCss.height += heightOffset;
+ }
+ //there are elements like inputs, come with a padding and border, so need to use outerwidth for starting point, due to jquery 1.7 css() on width/height bugs
+ if($(child).css('position') === 'absolute') {
+ if(child.offsetLeft) {
+ childSizingObj.left = child.offsetLeft;
+ childCss.left = oldWidth ? child.offsetLeft * newLocationAndSizeCss.width / oldWidth : child.offsetLeft; //- transformedShift.x;
+ }
+ if(child.offsetTop) {
+ childSizingObj.top = child.offsetTop;
+ childCss.top = oldHeight ? child.offsetTop * newLocationAndSizeCss.height / oldHeight : child.offsetTop; //- transformedShift.y;
+ }
+ }
+ childAnimationArray.push({ obj: child, sizingObj: childSizingObj, sizingCss: childCss });
+ });
+ }
+
+ if (newLocationAndSizeCss.left || newLocationAndSizeCss.top) {
+ //var movedLeft = newLocationAndSizeCss.left;
+ //var movedTop = newLocationAndSizeCss.top;
+ //$ax.visibility.setMovedLocation(elementId, movedLeft, movedTop);
+ var movedLeft = newLocationAndSizeCss.deltaX;
+ var movedTop = newLocationAndSizeCss.deltaY;
+ $ax.visibility.moveMovedLocation(elementId, movedLeft, movedTop);
+ }
+ if (newLocationAndSizeCss.width || newLocationAndSizeCss.height) {
+ var resizedWidth = newLocationAndSizeCss.width;
+ var resizedHeight = newLocationAndSizeCss.height;
+ $ax.visibility.setResizedSize(elementId, resizedWidth, resizedHeight);
+ }
+
+ if (!resizeInfo.easing || resizeInfo.easing == 'none') {
+ query.animate(newLocationAndSizeCss, 0);
+
+ if (childAnimationArray) {
+ $(childAnimationArray).each(function (i, animationObj) {
+ if(animationObj.resizeMatrixFunction) {
+ $(animationObj.obj).css($ax.public.fn.setTransformHowever(animationObj.resizeMatrixFunction(animationObj.width, animationObj.height)));
+ } else {
+ //var sizingCss = animationObj.sizingCss;
+ //if (sizingCss.left || sizingCss.top) {
+ // var movedLeft = sizingCss.left;
+ // var movedTop = sizingCss.top;
+ // $ax.visibility.setMovedLocation(animationObj.obj.id, movedLeft, movedTop);
+ //}
+ //if (sizingCss.width || sizingCss.height) {
+ // var resizedWidth = sizingCss.width;
+ // var resizedHeight = sizingCss.height;
+ // $ax.visibility.setResizedSize(animationObj.obj.id, resizedWidth, resizedHeight);
+ //}
+
+ $(animationObj.obj).animate(animationObj.sizingCss, 0);
+ }
+ });
+ }
+ //if(childCss) children.animate(childCss, 0);
+ //if(sketchyImage && sketchyImageCss) $(sketchyImage).animate(sketchyImageCss, 0);
+ //if(textChildCss) {
+ // textChildren.animate(textChildCss, {
+ // duration: 0,
+ // step: textStepFunction
+ // });
+ //}
+ onComplete();
+ } else {
+ if(childAnimationArray) {
+ $(childAnimationArray).each(function (i, animationObj) {
+ if(animationObj.resizeMatrixFunction) {
+ $(animationObj.sizingObj).animate(animationObj.sizingCss, {
+ queue: false,
+ duration: resizeInfo.duration,
+ easing: resizeInfo.easing,
+ step: function (now) {
+ var widthRatio = (animationObj.width - 1.0) * now + 1.0;
+ var heightRatio = (animationObj.height - 1.0) * now + 1.0;
+ $(animationObj.obj).css($ax.public.fn.setTransformHowever(animationObj.resizeMatrixFunction(widthRatio, heightRatio)));
+ }
+ });
+ } else {
+ $(animationObj.sizingObj).animate(animationObj.sizingCss, {
+ queue: false,
+ duration: resizeInfo.duration,
+ easing: resizeInfo.easing,
+ step: function (now, tween) {
+ $(animationObj.obj).css(tween.prop, now);
+ }
+ });
+ }
+ });
+ }
+
+ //if(textChildCss) {
+ // textChildren.animate(textChildCss, {
+ // queue: false,
+ // duration: resizeInfo.duration,
+ // easing: resizeInfo.easing,
+ // step: textStepFunction
+ // });
+ //}
+
+ if(isDynamicPanel) {
+ query.animate(newLocationAndSizeCss, { queue: false, duration: resizeInfo.duration, easing: resizeInfo.easing, complete: onComplete });
+ } else {
+ var locObj = {
+ left: $ax.public.fn.GetFieldFromStyle(query, 'left'), top: $ax.public.fn.GetFieldFromStyle(query, 'top'),
+ width: $ax.public.fn.GetFieldFromStyle(query, 'width'), height: $ax.public.fn.GetFieldFromStyle(query, 'height'),
+ };
+ $(locObj).animate(newLocationAndSizeCss, {
+ queue: false,
+ duration: resizeInfo.duration,
+ easing: resizeInfo.easing,
+ step: function (now, tween) {
+ query.css(tween.prop, now);
+ },
+ complete: onComplete
+ });
+ }
+ }
+ }
+ };
+
+ $ax.public.fn.bringToFront = function() {
+ var elementIds = this.getElementIds();
+ for(var index = 0; index < elementIds.length; index++) { $ax.legacy.BringToFront(elementIds[index]); }
+ return this;
+ };
+
+ $ax.public.fn.sendToBack = function() {
+ var elementIds = this.getElementIds();
+ for(var index = 0; index < elementIds.length; index++) { $ax.legacy.SendToBack(elementIds[index]); }
+ return this;
+ };
+
+ $ax.public.fn.text = function() {
+ if(arguments[0] == undefined) {
+ var firstId = this.getElementIds()[0];
+
+ if(!firstId) { return undefined; }
+
+ return getWidgetText(firstId);
+ } else {
+ var elementIds = this.getElementIds();
+
+ for(var index = 0; index < elementIds.length; index++) {
+ var currentItem = elementIds[index];
+
+ var widgetType = $ax.getTypeFromElementId(currentItem);
+
+ if($ax.public.fn.IsTextBox(widgetType) || $ax.public.fn.IsTextArea(widgetType)) { //For non rtf
+ SetWidgetFormText(currentItem, arguments[0]);
+ } else {
+ var idRtf = '#' + currentItem;
+ if($(idRtf).length == 0) idRtf = '#u' + (Number(currentItem.substring(1)) + 1);
+
+ if($(idRtf).length != 0) {
+ //If the richtext div already has some text in it,
+ //preserve only the first style and get rid of the rest
+ //If no pre-existing p-span tags, don't do anything
+ if($(idRtf).find('p').find('span').length > 0) {
+ $(idRtf).find('p:not(:first)').remove();
+ $(idRtf).find('p').find('span:not(:first)').remove();
+
+ //Replace new-lines with NEWLINE token, then html encode the string,
+ //finally replace NEWLINE token with linebreak
+ var textWithLineBreaks = arguments[0].replace(/\n/g, '--NEWLINE--');
+ var textHtml = $('
').text(textWithLineBreaks).html();
+ $(idRtf).find('span').html(textHtml.replace(/--NEWLINE--/g, ' '));
+ }
+ }
+ }
+ }
+
+ return this;
+ }
+ };
+
+ var getWidgetText = function(id) {
+ var idQuery = $jobj(id);
+ var inputQuery = $jobj($ax.INPUT(id));
+ if(inputQuery.length) idQuery = inputQuery;
+
+ if (idQuery.is('input') && ($ax.public.fn.IsCheckBox(idQuery.attr('type')) || idQuery.attr('type') == 'radio')) {
+ idQuery = idQuery.parent().find('label').find('div');
+ }
+
+ if(idQuery.is('div')) {
+ var $rtfObj = idQuery.hasClass('text') ? idQuery : idQuery.find('.text');
+ if($rtfObj.length == 0) return '';
+
+ var textOut = '';
+ $rtfObj.children('p,ul,ol').each(function(index) {
+ if(index != 0) textOut += '\n';
+
+ //var htmlContent = $(this).html();
+ //if(isSoloBr(htmlContent)) return; // It has a solo br, then it was just put in for a newline, and paragraph already added the new line.
+ if (isSoloBr($(this).children())) return;
+
+ var htmlContent = $(this).html();
+ //Replace line breaks (set in SetWidgetRichText) with newlines and nbsp's with regular spaces.
+ htmlContent = htmlContent.replace(/ ]*>/ig, '\n').replace(/ /ig, ' ');
+ textOut += $(htmlContent).text();
+ //textOut += htmlContent.replace(/<[^>]*>/g, '');
+ });
+
+ return textOut;
+ } else {
+ var val = idQuery.val();
+ return val == undefined ? '' : val;
+ }
+ };
+
+ var isSoloBr = function($html) {
+ //html = $(html);
+ // Html needs one and only one span
+ var spanChildren = $html.length == 1 && $html.is('span') ? $html.children() : false;
+ // Span children needs exactly one br and no text in the span
+ return spanChildren && spanChildren.length == 1 && spanChildren.is('br') && spanChildren.text().trim() == '';
+ };
+
+ $ax.public.fn.setRichTextHtml = function() {
+ if(arguments[0] == undefined) {
+ //No getter function, so just return undefined
+ return undefined;
+ } else {
+ var elementIds = this.getElementIds();
+
+ for(var index = 0; index < elementIds.length; index++) {
+ var currentItem = elementIds[index];
+
+ var widgetType = $ax.getTypeFromElementId(currentItem);
+ if ($ax.public.fn.IsTextBox(widgetType) || $ax.public.fn.IsTextArea(widgetType)) { //Do nothing for non rtf
+ continue;
+ } else {
+ //TODO -- [mas] fix this!
+ var idRtf = '#' + currentItem;
+ if($(idRtf).length == 0) idRtf = '#u' + (parseInt(currentItem.substring(1)) + 1);
+ if($(idRtf).length != 0) SetWidgetRichText(idRtf, arguments[0]);
+ }
+ }
+
+ return this;
+ }
+ };
+
+ $ax.public.fn.value = function() {
+ if(arguments[0] == undefined) {
+ var firstId = this.getElementIds()[0];
+
+ if(!firstId) {
+ return undefined;
+ }
+
+ var widgetType = $ax.getTypeFromElementId(firstId);
+
+ if ($ax.public.fn.IsComboBox(widgetType) || $ax.public.fn.IsListBox(widgetType)) { //for select lists and drop lists
+ return $('#' + firstId + ' :selected').text();
+ } else if ($ax.public.fn.IsCheckBox(widgetType) || $ax.public.fn.IsRadioButton(widgetType)) { //for radio/checkboxes
+ return $('#' + firstId + '_input').is(':selected');
+ } else if ($ax.public.fn.IsTextBox(widgetType)) { //for text box
+ return $('#' + firstId + '_input').val();
+ } else { //for text based form elements
+ return this.jQuery().first().val();
+ }
+ } else {
+ var elementIds = this.getElementIds();
+
+ for(var index = 0; index < elementIds.length; index++) {
+ var widgetType = $ax.getTypeFromElementId(elementIds[index]);
+
+ var elementIdQuery = $('#' + elementIds[index]);
+
+ if ($ax.public.fn.IsCheckBox(widgetType) || $ax.public.fn.IsRadioButton(widgetType)) { //for radio/checkboxes
+ if(arguments[0] == true) {
+ elementIdQuery.prop('selected', true);
+ } else if(arguments[0] == false) {
+ elementIdQuery.prop('selected', false);
+ }
+ } else { //For select lists, drop lists, text based form elements
+ elementIdQuery.val(arguments[0]);
+ }
+ }
+
+ return this;
+ }
+ };
+
+ $ax.public.fn.checked = function() {
+ if(arguments[0] == undefined) {
+ return this.selected();
+ } else {
+ this.selected(arguments[0]);
+ return this;
+ }
+ };
+
+ //var _getRelativeLeft = function (id, parent) {
+ // var currentNode = window.document.getElementById(id).offsetParent;
+ // var left = $ax('#' + id).left(true);
+ // while (currentNode != null && currentNode.tagName != "BODY" && currentNode != parent) {
+ // left += currentNode.offsetLeft;
+ // currentNode = currentNode.offsetParent;
+ // }
+ // return left;
+ //};
+
+ //var _getRelativeTop = function(id, parent) {
+ // var currentNode = window.document.getElementById(id).offsetParent;
+ // var top = $ax('#' + id).top(true);
+ // while(currentNode != null && currentNode.tagName != "BODY" && currentNode != parent) {
+ // top += currentNode.offsetTop;
+ // currentNode = currentNode.offsetParent;
+ // }
+ // return top;
+ //};
+
+ var _scrollHelper = function(id, scrollX, scrollY, easing, duration) {
+ var target = window.document.getElementById(id);
+ var scrollable = $ax.legacy.GetScrollable(target);
+ var $scrollable = $(scrollable);
+
+ var viewportLocation;
+ if ($scrollable.is('body')) viewportLocation = $ax('#' + id).viewportLocation();
+ else viewportLocation = $ax('#' + id).pageBoundingRect(true, $scrollable.attr('id')).location;
+
+ var targetLeft = viewportLocation.left;
+ var targetTop = viewportLocation.top;
+ //var targetLeft = _getRelativeLeft(id, scrollable);
+ //var targetTop = _getRelativeTop(id, scrollable);
+ if(!scrollX) targetLeft = scrollable.scrollLeft;
+ if(!scrollY) targetTop = scrollable.scrollTop;
+
+ if($scrollable.is('body')) {
+ $scrollable = $('html,body');
+ }
+ if(easing == 'none') {
+ if(scrollY) $scrollable.scrollTop(targetTop);
+ if(scrollX) $scrollable.scrollLeft(targetLeft);
+ } else {
+ if(!scrollX) {
+ $scrollable.animate({ scrollTop: targetTop }, duration, easing);
+ } else if(!scrollY) {
+ $scrollable.animate({ scrollLeft: targetLeft }, duration, easing);
+ } else {
+ $scrollable.animate({ scrollTop: targetTop, scrollLeft: targetLeft }, duration, easing);
+ }
+ }
+ };
+
+ $ax.public.fn.scroll = function(scrollOption) {
+ var easing = 'none';
+ var duration = 500;
+
+ if(scrollOption && scrollOption.easing) {
+ easing = scrollOption.easing;
+
+ if(scrollOption.duration) {
+ duration = scrollOption.duration;
+ }
+ }
+
+ var scrollX = true;
+ var scrollY = true;
+
+ // TODO: check this without vertical option -- might scroll outside of device frame
+ if(scrollOption.direction == 'vertical') {
+ scrollX = false;
+ } else if(scrollOption.direction == 'horizontal') {
+ scrollY = false;
+ }
+
+ var elementIds = this.getElementIds();
+ for(var index = 0; index < elementIds.length; index++) {
+ // if($ax.getTypeFromElementId(elementIds[index]) == IMAGE_MAP_REGION_TYPE) {
+ _scrollHelper(elementIds[index], scrollX, scrollY, easing, duration);
+ // }
+ }
+
+ return this;
+ };
+
+ $ax.public.fn.enabled = function() {
+ if(arguments[0] == undefined) {
+ var firstId = this.getElementIds()[0];
+ if(!firstId) return undefined;
+
+ var widgetType = $ax.getTypeFromElementId(firstId);
+ if ($ax.public.fn.IsImageBox(widgetType) || $ax.public.fn.IsVector(widgetType)
+ || $ax.public.fn.IsLayer(widgetType)) return !$ax.style.IsWidgetDisabled(firstId);
+ else return this.jQuery().children(':disabled').length <= 0;
+ } else {
+ var elementIds = this.getElementIds();
+
+ for(var index = 0; index < elementIds.length; index++) {
+ var elementId = elementIds[index];
+ var widgetType = $ax.getTypeFromElementId(elementId);
+
+ var enabled = arguments[0];
+ if ($ax.public.fn.IsImageBox(widgetType) || $ax.public.fn.IsVector(widgetType)
+ || $ax.public.fn.IsTextBox(widgetType) || $ax.public.fn.IsTextArea(widgetType)
+ || $ax.public.fn.IsComboBox(widgetType) || $ax.public.fn.IsListBox(widgetType)
+ || $ax.public.fn.IsCheckBox(widgetType) || $ax.public.fn.IsRadioButton(widgetType)
+ ) $ax.style.SetWidgetEnabled(elementId, enabled);
+
+ if ($ax.public.fn.IsDynamicPanel(widgetType) || $ax.public.fn.IsLayer(widgetType)) {
+ $ax.style.SetWidgetEnabled(elementId, enabled);
+ var children = this.getChildren(false, true)[index].children;
+ for(var i = 0; i < children.length; i++) {
+ $axure('#' + children[i]).enabled(enabled);
+ }
+ }
+ var obj = $obj(elementId);
+ var images = obj.images;
+ if(PLAIN_TEXT_TYPES.indexOf(widgetType) != -1 && images) {
+ var img = $jobj($ax.repeater.applySuffixToElementId(elementId, '_image_sketch'));
+ var key = (enabled ? 'normal~' : 'disabled~') + ($ax.adaptive.currentViewId || '');
+ img.attr('src', images[key]);
+
+ }
+ var jobj = $jobj(elementId);
+ var input = $jobj($ax.INPUT(elementId));
+ if(input.length) jobj = input;
+
+ //if (OS_MAC && WEBKIT && $ax.public.fn.IsComboBox(widgetType)) jobj.css('color', enabled ? '' : 'grayText');
+
+ if(enabled) jobj.prop('disabled', false);
+ else jobj.prop('disabled', true);
+ }
+
+ return this;
+ }
+ };
+
+ $ax.public.fn.visible = function() {
+ var ids = this.getElementIds();
+ for(var index = 0; index < ids.length; index++) $ax.visibility.SetIdVisible(ids[index], arguments[0]);
+ return this;
+ };
+
+ $ax.public.fn.selected = function() {
+ if(arguments[0] == undefined) {
+ var firstId = this.getElementIds()[0];
+ if(!firstId) return undefined;
+
+ var widgetType = $ax.getTypeFromElementId(firstId);
+ if ($ax.public.fn.IsTreeNodeObject(widgetType)) {
+ var treeNodeButtonShapeId = '';
+ var allElementIds = $ax.getAllElementIds();
+ for(var i = 0; i < allElementIds.length; i++) {
+ var elementId = allElementIds[i];
+ var currObj = $ax.getObjectFromElementId(elementId);
+
+ if ($ax.public.fn.IsVector(currObj.type) && currObj.parent && currObj.parent.scriptIds && currObj.parent.scriptIds[0] == firstId) {
+ treeNodeButtonShapeId = elementId;
+ break;
+ }
+ }
+
+ if(treeNodeButtonShapeId == '') return undefined;
+ return $ax.style.IsWidgetSelected(treeNodeButtonShapeId);
+ } else if ($ax.public.fn.IsImageBox(widgetType) || $ax.public.fn.IsVector(widgetType) || $ax.public.fn.IsTableCell(widgetType) || $ax.public.fn.IsDynamicPanel(widgetType) || $ax.public.fn.IsLayer(widgetType)) {
+ return $ax.style.IsWidgetSelected(firstId);
+ } else if ($ax.public.fn.IsCheckBox(widgetType) || $ax.public.fn.IsRadioButton(widgetType)) {
+ return $jobj($ax.INPUT(firstId)).prop('checked');
+ }
+ return this;
+ }
+ var elementIds = this.getElementIds();
+ var func = typeof (arguments[0]) === 'function' ? arguments[0] : null;
+ var enabled = arguments[0]; // If this is a function it will be overridden with the return value;
+
+ for(var index = 0; index < elementIds.length; index++) {
+ var elementId = elementIds[index];
+ if(func) {
+ enabled = func($axure('#' + elementId));
+ }
+
+ var widgetType = $ax.getTypeFromElementId(elementId);
+
+ if ($ax.public.fn.IsTreeNodeObject(widgetType)) { //for tree node
+ var treeRootId = $('#' + elementIds[index]).parents('.treeroot').attr('id');
+
+ var treeNodeButtonShapeId = '';
+ var childElementIds = $jobj(elementId).children();
+ for(var i = 0; i < childElementIds.length; i++) {
+ var elementId = childElementIds[i].id;
+ var currObj = $ax.getObjectFromElementId(elementId);
+
+ if (currObj && currObj.type == $ax.constants.VECTOR_SHAPE_TYPE && currObj.parent &&
+ currObj.parent.scriptIds && currObj.parent.scriptIds[0] == elementIds[index]) {
+ treeNodeButtonShapeId = elementId;
+ break;
+ }
+ }
+
+ if(treeNodeButtonShapeId == '') continue;
+
+ $ax.tree.SelectTreeNode(elementId, enabled);
+ } else if ($ax.public.fn.IsImageBox(widgetType) || $ax.public.fn.IsVector(widgetType) || $ax.public.fn.IsVector(widgetType) || $ax.public.fn.IsTableCell(widgetType) || $ax.public.fn.IsDynamicPanel(widgetType) || $ax.public.fn.IsLayer(widgetType)) {
+ $ax.style.SetWidgetSelected(elementIds[index], enabled);
+ } else if ($ax.public.fn.IsCheckBox(widgetType) || $ax.public.fn.IsRadioButton(widgetType)) {
+ var query = $jobj($ax.INPUT(elementId));
+ var curr = query.prop('checked');
+ //NOTE: won't fire onselect nore onunselect event if states didn't changes
+ if(curr != enabled) {
+ query.prop('checked', enabled);
+ $ax.style.SetWidgetSelected(elementIds[index], enabled, true);
+ $ax.event.TryFireCheckChanged(elementId, enabled);
+ }
+ }
+ }
+ return this;
+ };
+
+ $ax.public.fn.focus = function() {
+ var firstId = this.getElementIds()[0];
+ var focusableId = $ax.event.getFocusableWidgetOrChildId(firstId);
+ // This will scroll but not focus
+ $('#' + focusableId).triggerHandler("focus");
+ // This will focus but does not call our custom scroll so will not animate scroll
+ $('#' + focusableId).focus();
+
+ return this;
+ };
+
+ $ax.public.fn.expanded = function() {
+ if(arguments[0] == undefined) {
+ var firstId = this.getElementIds()[0];
+ return firstId && !$ax.public.fn.IsTreeNodeObject($ax.getTypeFromElementId(firstId)) && $ax.visibility.IsIdVisible(firstId + '_children');
+ } else {
+ var elementIds = this.getElementIds();
+
+ for(var index = 0; index < elementIds.length; index++) {
+ if ($ax.public.fn.IsTreeNodeObject($ax.getTypeFromElementId(elementIds[index]))) {
+ var treeNodeId = elementIds[index];
+ var childContainerId = treeNodeId + '_children';
+
+ var scriptId = $ax.repeater.getScriptIdFromElementId(treeNodeId);
+ var itemId = $ax.repeater.getItemIdFromElementId(treeNodeId);
+ var plusMinusId = 'u' + (parseInt(scriptId.substring(1)) + 1);
+ if(itemId) plusMinusId = $ax.repeater.createElementId(plusMinusId, itemId);
+ if($('#' + childContainerId).length == 0 || !$jobj(plusMinusId).children().first().is('img'))
+ plusMinusId = '';
+
+ if(arguments[0] == true) {
+ $ax.tree.ExpandNode(treeNodeId, childContainerId, plusMinusId);
+ } else if(arguments[0] == false) {
+ $ax.tree.CollapseNode(treeNodeId, childContainerId, plusMinusId);
+ }
+ }
+ }
+
+ return this;
+ }
+ };
+
+ var _populateBoundingRect = function (boundingRect) {
+ boundingRect.right = boundingRect.left + boundingRect.width;
+ boundingRect.bottom = boundingRect.top + boundingRect.height;
+
+ boundingRect.x = boundingRect.left;
+ boundingRect.y = boundingRect.top;
+
+ boundingRect.location = {
+ x: boundingRect.left,
+ y: boundingRect.top,
+ left: boundingRect.left,
+ top: boundingRect.top
+ };
+
+ boundingRect.size = {
+ width: boundingRect.width,
+ height: boundingRect.height
+ };
+
+ boundingRect.centerPoint = {
+ x: boundingRect.width / 2 + boundingRect.left,
+ y: boundingRect.height / 2 + boundingRect.top
+ };
+ return boundingRect;
+ }
+
+ //boundingrect relative to its offset parent
+ //var _getBoundingRectForSingleWidget = function (elementId) {
+ // var element = document.getElementById(elementId);
+ // var tempBoundingRect, position;
+
+ // var state = $ax.style.generateState(elementId);
+ // var style = $ax.style.computeFullStyle(elementId, state, $ax.adaptive.currentViewId);
+ // position = { left: style.location.x, top: style.location.y };
+ // tempBoundingRect = { left: style.location.x, top: style.location.y, width: style.size.width, height: style.size.height };
+
+ // if ($ax.public.fn.isCompoundVectorHtml(element)) {
+ // tempBoundingRect.width = Number(element.getAttribute('data-width'));
+ // tempBoundingRect.height = Number(element.getAttribute('data-height'));
+ // } else {
+ // var boundingElement = element;
+ // if ($ax.dynamicPanelManager.isIdFitToContent(elementId)) {
+ // var stateId = $ax.visibility.GetPanelState(elementId);
+ // if (stateId != '') boundingElement = document.getElementById(stateId);
+ // tempBoundingRect = boundingElement.getBoundingClientRect();
+ // }
+
+ // //From getLoc
+ // //var fixed = _fixedOffset(id, vert);
+ // //if (fixed.valid) loc = !vert && fixed.fullWidth ? 0 : fixed.offset;
+
+ // var jElement = $(element);
+ // if (jElement.css('position') == 'fixed') {
+ // position = jElement.position();
+ // position.left += Number(jElement.css('margin-left').replace("px", ""));
+ // position.top += Number(jElement.css('margin-top').replace("px", ""));
+ // }
+ // }
+
+ // var boundingRect = {
+ // left: position.left,
+ // top: position.top,
+ // width: tempBoundingRect.width,
+ // height: tempBoundingRect.height
+ // };
+
+ // return _populateBoundingRect(boundingRect);
+ //};
+
+ //var _getBoundingRectForMultipleWidgets = function (widgetsIdArray) {
+ // if (!widgetsIdArray || widgetsIdArray.constructor !== Array) return undefined;
+ // if (widgetsIdArray.length == 0) return { left: 0, top: 0, centerPoint: { x: 0, y: 0 }, width: 0, height: 0 };
+ // var widgetRect = _getBoundingRectForSingleWidget(widgetsIdArray[0]);
+ // var boundingRect = { left: widgetRect.left, right: widgetRect.right, top: widgetRect.top, bottom: widgetRect.bottom };
+
+ // for (var index = 1; index < widgetsIdArray.length; index++) {
+ // widgetRect = _getBoundingRectForSingleWidget(widgetsIdArray[index]);
+ // boundingRect.left = Math.min(boundingRect.left, widgetRect.left);
+ // boundingRect.top = Math.min(boundingRect.top, widgetRect.top);
+ // boundingRect.right = Math.max(boundingRect.right, widgetRect.right);
+ // boundingRect.bottom = Math.max(boundingRect.bottom, widgetRect.bottom);
+ // }
+
+ // boundingRect.centerPoint = { x: (boundingRect.right + boundingRect.left) / 2.0, y: (boundingRect.bottom + boundingRect.top) / 2.0 };
+ // boundingRect.width = boundingRect.right - boundingRect.left;
+ // boundingRect.height = boundingRect.bottom - boundingRect.top;
+ // return _populateBoundingRect(boundingRect);
+ //};
+
+ //var _getLayerChildrenDeep = $ax.public.fn.getLayerChildrenDeep = function (layerId, includeLayers, includeHidden) {
+ // var deep = [];
+ // var children = $ax('#' + layerId).getChildren()[0].children;
+ // for (var index = 0; index < children.length; index++) {
+ // var childId = children[index];
+ // if (!includeHidden && !$ax.visibility.IsIdVisible(childId)) continue;
+ // if ($ax.public.fn.IsLayer($obj(childId).type)) {
+ // if (includeLayers) deep.push(childId);
+ // var recursiveChildren = _getLayerChildrenDeep(childId, includeLayers, includeHidden);
+ // for (var j = 0; j < recursiveChildren.length; j++) deep.push(recursiveChildren[j]);
+ // } else deep.push(childId);
+ // }
+ // return deep;
+ //};
+
+ var _boundingRectForIds = function(childIds) {
+ // Default size
+ var childrenBoundingRect = { left: childIds.length > 0 ? 9999999 : 0, top: childIds.length > 0 ? 9999999 : 0, right: 0, bottom: 0 };
+ for (var i = 0; i < childIds.length; i++) {
+ var childId = childIds[i];
+ var childObj = $obj(childId);
+
+ if (!childObj) continue;
+
+ // Ignore fixed and hidden
+ if ($ax.visibility.limboIds[childId] ||
+ !$ax.visibility.IsIdVisible(childId) ||
+ $ax.public.fn.IsDynamicPanel(childObj.type) && childObj.fixedHorizontal) continue;
+
+ var boundingRect = $ax('#' + childId).offsetBoundingRect();
+
+ // Ignore empty groups
+ if ($ax.public.fn.IsLayer(childObj.type) && boundingRect.width == 0 && boundingRect.height == 0) continue;
+
+ childrenBoundingRect.left = Math.min(childrenBoundingRect.left, boundingRect.left);
+ childrenBoundingRect.top = Math.min(childrenBoundingRect.top, boundingRect.top);
+ childrenBoundingRect.right = Math.max(childrenBoundingRect.right, boundingRect.right);
+ childrenBoundingRect.bottom = Math.max(childrenBoundingRect.bottom, boundingRect.bottom);
+ }
+ childrenBoundingRect.width = childrenBoundingRect.right - childrenBoundingRect.left;
+ childrenBoundingRect.height = childrenBoundingRect.bottom - childrenBoundingRect.top;
+
+ return _populateBoundingRect(childrenBoundingRect);
+ }
+
+ $ax.public.fn.getPageSize = function() {
+ var containerQuery = $('#base');
+ var children = containerQuery.children();
+ var childIds = [];
+ for (var i = 0; i < children.length; i++) {
+ var child = $(children[i]);
+ var childId = child.attr('id');
+ childIds.push(childId);
+ }
+
+ return _boundingRectForIds(childIds);
+ }
+
+ $ax.public.fn.childrenBoundingRect = function () {
+ var childIds = this.getChildren()[0].children;
+ return _boundingRectForIds(childIds);
+ };
+
+ var _fixedLocation = function (elementId, size) {
+ var axObj = $obj(elementId);
+ if (!axObj || !axObj.fixedVertical) return { valid: false };
+
+ var win = $(window);
+ var windowWidth = win.width();
+ var windowHeight = win.height();
+ //getting the scroll forces layout. consider caching these values.
+ var windowScrollLeft = win.scrollLeft();
+ var windowScrollTop = win.scrollTop();
+
+ var newLeft = 0;
+ var newTop = 0;
+ var width = size.width;
+ var height = size.height;
+
+ var horz = axObj.fixedHorizontal;
+ if(horz == 'left') {
+ newLeft = windowScrollLeft + (axObj.percentWidth ? 0 : $ax.getNumFromPx($jobj(elementId).css('left')));
+ } else if(horz == 'center') {
+ newLeft = windowScrollLeft + ((windowWidth - width) / 2) + axObj.fixedMarginHorizontal;
+ } else if(horz == 'right') {
+ newLeft = windowScrollLeft + windowWidth - width - axObj.fixedMarginHorizontal;
+ }
+
+ var vert = axObj.fixedVertical;
+ if(vert == 'top') {
+ newTop = windowScrollTop + $ax.getNumFromPx($jobj(elementId).css('top'));
+ } else if(vert == 'middle') {
+ newTop = windowScrollTop + ((windowHeight - height) / 2) + axObj.fixedMarginVertical;
+ } else if(vert == 'bottom') {
+ newTop = windowScrollTop + windowHeight - height - axObj.fixedMarginVertical;
+ }
+
+ //probably need to make this relative to the page for hit testing
+ return { valid: true, top: newTop, left: axObj.isPercentWidthPanel ? 0 : newLeft };
+ };
+
+ //relative to the parent
+ $ax.public.fn.offsetBoundingRect = function (ignoreRotation) {
+ var elementId = this.getElementIds()[0];
+ if (!elementId) return undefined;
+
+ //element is null if RDO
+ //data- values are for layers (legacy compound)
+ var element = document.getElementById(elementId);
+ var position, size, rotation;
+
+ var trap;
+ var state;
+ var style;
+ var movedLoc = $ax.visibility.getMovedLocation(elementId);
+ var resizedSize = $ax.visibility.getResizedSize(elementId);
+
+ if (movedLoc) {
+ position = movedLoc;
+ } else if(element && element.getAttribute('data-left')) {
+ position = {
+ left: Number(element.getAttribute('data-left')),
+ top: Number(element.getAttribute('data-top'))
+ };
+ } else if($obj(elementId)) {
+ state = $ax.style.generateState(elementId);
+ style = $ax.style.computeFullStyle(elementId, state, $ax.adaptive.currentViewId);
+ position = { left: style.location.x, top: style.location.y };
+
+ var parents = this.getParents(true, '*')[0];
+ //if(parents.length > 0) {
+ // var parentId = parents[0];
+ // var type = $ax.getTypeFromElementId(parentId);
+ // if ($axure.fn.IsReferenceDiagramObject(type)) {
+ // var rdoLoc = $ax('#' + parentId).offsetLocation();
+ // position.left += rdoLoc.x;
+ // position.top += rdoLoc.y;
+ // }
+ //}
+ for(var i = 0; i < parents.length; i++) {
+ var parentId = parents[i];
+ var type = $ax.getTypeFromElementId(parentId);
+ if ($axure.fn.IsReferenceDiagramObject(type)) {
+ var rdoLoc = $ax('#' + parentId).offsetLocation();
+ position.left += rdoLoc.x;
+ position.top += rdoLoc.y;
+ break;
+ } else if (!$axure.fn.IsLayer(type)) break;
+ }
+ } else {
+ if (!trap) trap = _displayWidget($ax.repeater.removeSuffixFromElementId(elementId));
+ var jObjPosition = $(element).position();
+ position = { left: jObjPosition.left, top: jObjPosition.top };
+ }
+
+ if (resizedSize) {
+ size = resizedSize;
+ } else if (element && element.getAttribute('data-width')) {
+ size = {
+ width: Number(element.getAttribute('data-width')),
+ height: Number(element.getAttribute('data-height'))
+ };
+ } else if($obj(elementId)) {
+ state = state || $ax.style.generateState(elementId);
+ style = style || $ax.style.computeFullStyle(elementId, state, $ax.adaptive.currentViewId);
+ size = { width: style.size.width, height: style.size.height };
+ } else {
+ if(!trap) trap = _displayWidget($ax.repeater.removeSuffixFromElementId(elementId));
+ var jObj = $(element);
+ size = { width: jObj.outerWidth(), height: jObj.outerHeight() };
+ }
+
+ var fixed = _fixedLocation(elementId, size);
+ if(fixed.valid) {
+ position.left = fixed.left;
+ position.top = fixed.top;
+ }
+
+ var boundingRect = {
+ left: position.left,
+ top: position.top,
+ width: size.width,
+ height: size.height,
+ isFixed: fixed.valid
+ };
+
+ if(!ignoreRotation) {
+ var rotatedAngle = $ax.visibility.getRotatedAngle(elementId);
+ if(rotatedAngle) {
+ rotation = rotatedAngle;
+ } else if(element && element.getAttribute('data-rotation')) {
+ rotation = Number(element.getAttribute('data-rotation'));
+ } else if($obj(elementId)) {
+ state = state || $ax.style.generateState(elementId);
+ style = style || $ax.style.computeFullStyle(elementId, state, $ax.adaptive.currentViewId);
+ rotation = style.rotation;
+ } else {
+ if (!trap) trap = _displayWidget($ax.repeater.removeSuffixFromElementId(elementId));
+ rotation = $ax.move.getRotationDegreeFromElement(element);
+ }
+ if(rotation && rotation != 0)
+ boundingRect = $ax.public.fn.getBoundingRectForRotate(_populateBoundingRect(boundingRect), rotation);
+ }
+
+ if (trap) trap();
+
+ return _populateBoundingRect(boundingRect);
+ };
+
+ //relative to the page
+ $ax.public.fn.pageBoundingRect = function (ignoreRotation, scrollableId) {
+ var boundingRect = this.offsetBoundingRect(ignoreRotation);
+ if(!boundingRect) return undefined;
+
+ if(boundingRect.isFixed) return _populateBoundingRect(boundingRect);
+
+ var loc = boundingRect.location;
+
+ //var parents = [];
+ //var parObj = id.indexOf('text') != -1 ? axObj : axObj.parent; // When working with text id, parent widget is the ax obj we are dealing with, so that should be the first parent
+ //while ($ax.public.fn.IsContainer(parObj.type)) {
+ // parents.push($ax.getScriptIdFromPath([parObj.id], strippedId));
+ // parObj = parObj.parent;
+ //}
+ //var otherParents = $ax('#' + id).getParents(true, ['item', 'repeater', 'dynamicPanel', 'layer'])[0];
+ //for (var i = 0; i < otherParents.length; i++) {
+ // parents.push(otherParents[i]);
+ //}
+
+ var elementId = this.getElementIds()[0];
+ // var strippedId = $ax.repeater.removeSuffixFromElementId(id);
+ // var parObj = id.indexOf('text') != -1 ? axObj : axObj.parent; // When working with text id, parent widget is the ax obj we are dealing with, so that should be the first parent
+ var parentIds = [];
+ var parObj = $obj(elementId).parent;
+ while ($ax.public.fn.IsContainer(parObj.type)) {
+ parentIds.push($ax.getScriptIdFromPath([parObj.id], this.id));
+ parObj = parObj.parent;
+ }
+ var otherParents = $ax('#' + elementId).getParents(true, ['item', 'repeater', 'dynamicPanel'])[0];
+ for (var i = 0; i < otherParents.length; i++) {
+ parentIds.push(otherParents[i]);
+ }
+
+ var parentScrollableId = scrollableId ? scrollableId.split('_')[0] : scrollableId;
+ for (var i = 0; i < parentIds.length; i++) {
+ //var parentId = $ax.visibility.getWidgetFromContainer(parents[0]);
+ //var parent = $ax.visibility.applyWidgetContainer(parentId, true);
+ //if(parent.length) {
+ //var parentId = parentIds[i];
+ //var fixed = _fixedOffset(parentId, vert);
+ //if (fixed.valid) {
+ // loc += fixed.offset;
+ // break;
+ //} else loc += $ax.getNumFromPx(parent.css(prop));
+ //}
+
+ var parentId = parentIds[i];
+ if (parentId == parentScrollableId) break;
+ var parentLoc = $ax('#' + parentId).offsetLocation();
+ loc = {
+ x: loc.x + parentLoc.x,
+ y: loc.y + parentLoc.y,
+ left: loc.left + parentLoc.left,
+ top: loc.top + parentLoc.top,
+ }
+ var axObj = $obj(parentId);
+ if(axObj && axObj.fixedVertical) {
+ boundingRect.isFixed = true;
+ break;
+ }
+ }
+
+ boundingRect.left = loc.x;
+ boundingRect.top = loc.y;
+ return _populateBoundingRect(boundingRect);
+ };
+
+ $ax.public.fn.viewportBoundingRect = function (scrollableId) {
+ var boundingRect = this.pageBoundingRect(true, scrollableId);
+ if (!boundingRect) return undefined;
+
+ if(!boundingRect.isFixed) boundingRect.left = _bodyToWorld(boundingRect.left, false);
+ return _populateBoundingRect(boundingRect);
+ }
+
+ $ax.public.fn.size = function () {
+ var boundingRect = this.offsetBoundingRect(true);
+ return boundingRect ? boundingRect.size : undefined;
+
+ //var firstId = this.getElementIds()[0];
+ //if(!firstId) return undefined;
+
+ //var object = $ax.getObjectFromElementIdDisregardHex(firstId);
+ //if(object && (object.type == 'layer' || object.generateCompound)) {
+ // var boundingRect = $ax.public.fn.getWidgetBoundingRect(firstId);
+ // return { width: boundingRect.width, height: boundingRect.height };
+ //}
+
+ //var firstIdObject = $jobj(firstId);
+ //var trap = _displayWidget($ax.repeater.removeSuffixFromElementId(firstId));
+ //var size = { width: firstIdObject.outerWidth(), height: firstIdObject.outerHeight() };
+ //trap();
+ //return size;
+ };
+
+ $ax.public.fn.width = function () {
+ var boundingRect = this.offsetBoundingRect(true);
+ return boundingRect ? boundingRect.width : undefined;
+
+ //var firstId = this.getElementIds()[0];
+ //if(!firstId) return undefined;
+
+ //var object = $ax.getObjectFromElementIdDisregardHex(firstId);
+ //if (object && (object.type == 'layer' || object.generateCompound)) {
+ // var boundingRect = $ax.public.fn.getWidgetBoundingRect(firstId);
+ // return boundingRect.width;
+ //}
+
+ //var firstIdObject = $jobj(firstId);
+
+ //return firstIdObject.outerWidth();
+ };
+
+ $ax.public.fn.height = function () {
+ var boundingRect = this.offsetBoundingRect(true);
+ return boundingRect ? boundingRect.height : undefined;
+
+ //var firstId = this.getElementIds()[0];
+ //if(!firstId) return undefined;
+
+ //var object = $ax.getObjectFromElementIdDisregardHex(firstId);
+ //if (object && (object.type == 'layer' || object.generateCompound)) {
+ // var boundingRect = $ax.public.fn.getWidgetBoundingRect(firstId);
+ // return boundingRect.height;
+ //}
+
+ //var firstIdObject = $jobj(firstId);
+
+ //return firstIdObject.outerHeight();
+ };
+
+ //this should replace locRelativeIgnoreLayer
+ $ax.public.fn.offsetLocation = function () {
+ var boundingRect = this.offsetBoundingRect(true);
+ return boundingRect ? boundingRect.location : undefined;
+ };
+
+ //$ax.public.fn.offsetLeft = function () {
+ // var boundingRect = this.offsetBoundingRect();
+ // return boundingRect ? boundingRect.left : undefined;
+ //};
+
+ //$ax.public.fn.offsetTop = function () {
+ // var boundingRect = this.offsetBoundingRect();
+ // return boundingRect ? boundingRect.top : undefined;
+ //};
+
+ $ax.public.fn.viewportLocation = function (scrollableId) {
+ var boundingRect = this.viewportBoundingRect(scrollableId);
+ return boundingRect ? boundingRect.location : undefined;
+ };
+
+ //$ax.public.fn.pageLeft = function () {
+ // var boundingRect = this.pageBoundingRect();
+ // return boundingRect ? boundingRect.left : undefined;
+ //};
+
+ //$ax.public.fn.pageTop = function () {
+ // var boundingRect = this.pageBoundingRect();
+ // return boundingRect ? boundingRect.top : undefined;
+ //};
+
+ //This is getting its position in the Editor
+ //It was needed because the widget would be contained so getting the position from jQuery would not be accurate
+ //This can use the editor values
+ //$ax.public.fn.locRelativeIgnoreLayer = function (vert) {
+ // var elementId = this.getElementIds()[0];
+ // if(!elementId) return undefined;
+
+ // var parents = this.getParents(true, '*')[0];
+
+ // for(var i = 0; i < parents.length; i++) {
+ // var type = $ax.getTypeFromElementId(parents[i]);
+ // if(!$axure.fn.IsLayer(type) && !$axure.fn.IsReferenceDiagramObject(type)) {
+ // var func = vert ? _getRelativeTop : _getRelativeLeft;
+ // return func(elementId, $jobj(parents[i])[0]);
+ // }
+ // }
+ // var axThis = $ax('#' + elementId);
+ // return vert ? axThis.top() : _bodyToWorld(axThis.left(), true);
+ //};
+
+ var _bodyToWorld = $axure.fn.bodyToWorld = function(x, from) {
+ var body = $('body');
+ if (body.css('position') != 'relative') return x;
+ var offset = $ax.getNumFromPx(body.css('left')) + Math.max(0, ($(window).width() - body.width()) / 2);
+ if(from) offset *= -1;
+ return x + offset;
+ }
+
+ $ax.public.fn.left = function (relative) {
+ return relative ? this.offsetLocation().left : this.viewportLocation().left;
+
+ //var firstId = this.getElementIds()[0];
+ //if(!firstId) return undefined;
+
+ //var left = _getLoc(firstId, false, false, relative);
+
+ //// If you are absolute, unless your are a pinned panel...
+ //if(relative || $obj(firstId) && $obj(firstId).fixedVertical) return left;
+
+ //// ... or you are in one...
+ //var parentPanels = $ax('#' + firstId).getParents(true, 'dynamicPanel')[0];
+ //for(var i = 0; i < parentPanels.length; i++) if ($obj(parentPanels[i]).fixedVertical) return left;
+
+ //// ... you must convert from body to world coordinates
+ //return _bodyToWorld(left);
+ };
+
+ $ax.public.fn.top = function(relative) {
+ return relative ? this.offsetLocation().top : this.viewportLocation().top;
+
+ //var firstId = this.getElementIds()[0];
+ //return firstId && _getLoc(firstId, true, false, relative);
+ };
+
+ //var _getLoc = function(id, vert, high, relative) {
+ // var mathFunc = high ? 'max' : 'min';
+ // var prop = vert ? 'top' : 'left';
+ // var dim = vert ? 'height' : 'width';
+
+ // var obj = $jobj(id);
+ // var strippedId = $ax.repeater.removeSuffixFromElementId(id);
+ // var axObj = $obj(strippedId);
+ // var oldDisplay = obj.css('display');
+ // var displaySet = false;
+ // if(oldDisplay == 'none') {
+ // obj.css('display', '');
+ // displaySet = true;
+ // }
+ // var loc = Math.NaN;
+ // var rdo = axObj.type == $ax.constants.REFERENCE_DIAGRAM_OBJECT_TYPE;
+
+ // if (!rdo) loc = $ax.getNumFromPx(obj.css(prop));
+
+ // var fixed = _fixedOffset(id, vert);
+ // if(fixed.valid) loc = !vert && fixed.fullWidth ? 0 : fixed.offset;
+ // else if (!relative) {
+ // var parents = [];
+ // var parObj = id.indexOf('text') != -1 ? axObj : axObj.parent; // When working with text id, parent widget is the ax obj we are dealing with, so that should be the first parent
+ // while($ax.public.fn.IsContainer(parObj.type)) {
+ // parents.push($ax.getScriptIdFromPath([parObj.id], strippedId));
+ // parObj = parObj.parent;
+ // }
+ // var otherParents = $ax('#' + id).getParents(true, ['item', 'repeater', 'dynamicPanel', 'layer'])[0];
+ // for(var i = 0; i < otherParents.length; i++) {
+ // parents.push(otherParents[i]);
+ // }
+
+ // for(var i = 0; i < parents.length; i++) {
+ // var parentId = $ax.visibility.getWidgetFromContainer(parents[i]);
+ // var parent = $ax.visibility.applyWidgetContainer(parentId, true);
+
+ // // Layer may not have container, and will be at 0,0 otherwise.
+ // if (!parent.length) continue;
+
+ // fixed = _fixedOffset(parentId, vert);
+ // if(fixed.valid) {
+ // loc += fixed.offset;
+ // break; // If fixed ignore any parents if there are any, they don't matter.
+ // } else loc += $ax.getNumFromPx(parent.css(prop));
+ // }
+ // }
+
+ // if (high) loc += obj[dim]();
+
+ // // Special Layer code
+ // if (axObj.type == 'layer') {
+ // // If layer has a container, then use that. Otherwise must deal with children. Children can move in container after created, but ignoring for now.
+ // var container = $ax.visibility.applyWidgetContainer(id, true, true);
+ // if(container.length) loc += $ax.getNumFromPx(container.css(prop));
+ // else loc += (_getChildLoc(axObj.objs, vert, high, dim, true, id) || 0);
+ // }
+
+ // if(displaySet) obj.css('display', oldDisplay);
+ // return loc;
+ //};
+
+ //var _getChildLoc = function (children, vert, high, dim, root, path, itemId) {
+ // if (typeof (path) == 'string') {
+ // itemId = $ax.repeater.getItemIdFromElementId(path);
+ // path = $ax.getPathFromScriptId(path);
+ // path.pop(); // Remove object id, only want rdo path.
+ // }
+ // var mathFunc = high ? 'max' : 'min';
+ // var childLoc = NaN;
+ // for (var i = 0; i < children.length; i++) {
+ // var childObj = children[i];
+ // var childId = $ax.getElementIdFromPath([childObj.id], { relativeTo: path });
+ // if (!childId) continue;
+ // childId = $ax.repeater.createElementId(childId, itemId);
+ // if($ax.public.fn.IsReferenceDiagramObject(childObj.type)) {
+ // path.push(childObj.id);
+ // var childProp = _getChildLoc($ax.pageData.masters[$obj(childId).masterId].diagram.objects, vert, high, dim, false, path, itemId);
+ // path.pop();
+ // if(isNaN(childProp)) continue;
+ // } else if($ax.public.fn.IsLayer(childObj.type)) {
+ // childProp = _getChildLoc(childObj.objs, vert, high, dim, false, path, itemId);
+ // } else {
+ // if(!$ax.visibility.IsIdVisible(childId)) continue;
+ // childProp = $ax('#' + childId).locRelativeIgnoreLayer(vert);
+ // if(high) childProp += $jobj(childId)[dim]();
+ // }
+
+ // if(isNaN(childLoc)) childLoc = childProp;
+ // else if(!isNaN(childProp)) childLoc = Math[mathFunc](childLoc, childProp);
+ // }
+
+ // return root && isNaN(childLoc) ? 0 : childLoc;
+ //};
+
+ //var _fixedOffset = function (id, vert) {
+ // var axObj = $obj(id);
+ // //I think this is only for pinned panels? So why are we coming through here for rtps?
+ // if(!axObj) return { valid: false };
+
+ // var dim = vert ? 'height' : 'width';
+ // var alignment = axObj['fixed' + (vert ? 'Vertical' : 'Horizontal')];
+ // if(!alignment) return { valid: false };
+ // var loc = 0;
+
+ // // TODO: This returns 0 for width/height it or any parent is display none. Similar issue when using axquery width/height
+ // // TODO: Look into replacing this with axquery width/height and fixing that to use this hack. Potentially want to make js generic trapper.
+ // var trap = _displayWidget(id);
+ // var query = $jobj(id);
+ // var objSize = query[dim]();
+ // trap();
+
+ // if(alignment == 'center' || alignment == 'middle') {
+ // loc = $ax.getNumFromPx(query.css('margin-' + (vert ? 'top' : 'left')));
+ // loc += ($(window)[dim]()) / 2;
+ // } else if(alignment == 'bottom' || alignment == 'right') {
+ // loc = $ax.getNumFromPx(query.css(vert ? 'bottom' : 'right'));
+ // loc = $(window)[dim]() - objSize - loc; // subract loc because margin here moves farther left/up as it gets bigger.
+ // } else {
+ // loc = $ax.getNumFromPx(query.css(vert ? 'top' : 'left'));
+ // }
+
+ // var scrollKey = 'scroll' + (vert ? 'Top' : 'Left');
+ // return { offset: $(window)[scrollKey]() + loc, valid: true, fullWidth: axObj.percentWidth == 1 };
+ //};
+
+ var _displayWidget = function(id) {
+ var parents = $ax('#' + id).getParents(true, '*')[0];
+ parents.push(id); // also need to show self
+
+ var displayed = [];
+ for(var i = 0; i < parents.length; i++) {
+ var currId = parents[i];
+ var currObj = $jobj(currId);
+ if(currObj.css('display') == 'none') {
+ currObj.css('display', 'block');
+ displayed.push(currId);
+ }
+ }
+
+ return function() {
+ for(var i = 0; i < displayed.length; i++) {
+ $jobj(displayed[i]).css('display', 'none');
+ }
+ };
+ }
+});
diff --git a/src/原型系统/resources/scripts/axure/doc.js b/src/原型系统/resources/scripts/axure/doc.js
new file mode 100644
index 0000000..53d77bb
--- /dev/null
+++ b/src/原型系统/resources/scripts/axure/doc.js
@@ -0,0 +1,901 @@
+$axure.internal(function($ax) {
+ var _pageData;
+
+
+ var _initializePageFragment = function(pageFragment, objIdToObject) {
+ var objectArrayHelper = function(objects, parent) {
+ for(var i = 0; i < objects.length; i++) {
+ diagramObjectHelper(objects[i], parent);
+ }
+ };
+
+ var diagramObjectHelper = function(diagramObject, parent) {
+ $ax.initializeObject('diagramObject', diagramObject);
+ objIdToObject[pageFragment.packageId + '~' + diagramObject.id] = diagramObject;
+ diagramObject.parent = parent;
+ diagramObject.owner = pageFragment;
+ diagramObject.scriptIds = [];
+ if(diagramObject.diagrams) { //dynamic panel
+ for(var i = 0; i < diagramObject.diagrams.length; i++) {
+ var diagram = diagramObject.diagrams[i];
+ objectArrayHelper(diagram.objects, diagram);
+ }
+ } else if($ax.public.fn.IsLayer(diagramObject.type)) {
+ var layerObjs = diagramObject.objs;
+ objectArrayHelper(layerObjs, parent);
+ }
+ if(diagramObject.objects) objectArrayHelper(diagramObject.objects, diagramObject);
+ };
+ objectArrayHelper(pageFragment.diagram.objects, pageFragment.diagram);
+ };
+
+ var _initalizeStylesheet = function(stylesheet) {
+ var stylesById = {};
+ var customStyles = stylesheet.customStyles;
+ for(var key in customStyles) {
+ var style = customStyles[key];
+ stylesById[style.id] = style;
+ }
+ var duplicateStyles = stylesheet.duplicateStyles;
+ for(var duplicateKey in duplicateStyles) {
+ stylesById[duplicateKey] = stylesById[duplicateStyles[duplicateKey]];
+ }
+
+ stylesheet.stylesById = stylesById;
+ };
+
+
+ var _initializeDocumentData = function() {
+ _initalizeStylesheet($ax.document.stylesheet);
+ };
+
+
+ var _initializePageData;
+ // ******* Dictionaries ******** //
+ (function() {
+ var scriptIdToParentLayer = {};
+ var elementIdToObject = {};
+ var scriptIdToObject = {};
+ var scriptIdToRepeaterId = {};
+ var repeaterIdToScriptIds = {};
+ var repeaterIdToItemIds = {};
+ var scriptIdToPath = {};
+ var _scriptIds = [];
+ var elementIdToText = {};
+ var radioGroupToSelectedElementId = {};
+ _initializePageData = function() {
+ if(!_pageData || !_pageData.page || !_pageData.page.diagram) return;
+
+ var objIdToObject = {};
+ _initializePageFragment(_pageData.page, objIdToObject);
+ for(var masterId in _pageData.masters) {
+ var master = _pageData.masters[masterId];
+ _initializePageFragment(master, objIdToObject);
+ }
+
+ var _pathsToScriptIds = [];
+ _pathToScriptIdHelper(_pageData.objectPaths, [], _pathsToScriptIds, scriptIdToPath);
+
+ for(var i = 0; i < _pathsToScriptIds.length; i++) {
+ var path = _pathsToScriptIds[i].idPath;
+ var scriptId = _pathsToScriptIds[i].scriptId;
+
+ var packageId = _pageData.page.packageId;
+ if(path.length > 1) {
+ for(var j = 0; j < path.length - 1; j++) {
+ var rdoId = path[j];
+ var rdo = objIdToObject[packageId + '~' + rdoId];
+ packageId = rdo.masterId;
+ }
+ }
+ var diagramObject = objIdToObject[packageId + '~' + path[path.length - 1]];
+ diagramObject.scriptIds[diagramObject.scriptIds.length] = scriptId;
+
+ scriptIdToObject[scriptId] = diagramObject;
+ _scriptIds[_scriptIds.length] = scriptId;
+ }
+
+ // Now map scriptIds to repeaters and layers
+ var mapScriptIdToRepeaterId = function(scriptId, repeaterId) {
+ scriptIdToRepeaterId[scriptId] = repeaterId;
+ var scriptIds = repeaterIdToScriptIds[repeaterId];
+ if(scriptIds) scriptIds[scriptIds.length] = scriptId;
+ else repeaterIdToScriptIds[repeaterId] = [scriptId];
+ };
+ var mapScriptIdToLayerId = function(obj, layerId, path) {
+ var pathCopy = $ax.deepCopy(path);
+ pathCopy[path.length] = obj.id;
+ var scriptId = $ax.getScriptIdFromPath(pathCopy);
+ scriptIdToParentLayer[scriptId] = layerId;
+ }
+ var mapIdsToRepeaterAndLayer = function(path, objs, repeaterId) {
+ var pathCopy = $ax.deepCopy(path);
+
+ for(var i = 0; i < objs.length; i++) {
+ var obj = objs[i];
+ pathCopy[path.length] = obj.id;
+ var scriptId = $ax.getScriptIdFromPath(pathCopy);
+ // Rdo have no element on page and are not mapped to the repeater
+ if(repeaterId) mapScriptIdToRepeaterId(scriptId, repeaterId);
+
+ if($ax.public.fn.IsDynamicPanel(obj.type)) {
+ for(var j = 0; j < obj.diagrams.length; j++) mapIdsToRepeaterAndLayer(path, obj.diagrams[j].objects, repeaterId);
+ } else if($ax.public.fn.IsReferenceDiagramObject(obj.type)) {
+ mapIdsToRepeaterAndLayer(pathCopy, $ax.pageData.masters[obj.masterId].diagram.objects, repeaterId);
+ } else if($ax.public.fn.IsRepeater(obj.type)) {
+ mapScriptIdToRepeaterId(scriptId, scriptId);
+ mapIdsToRepeaterAndLayer(path, obj.objects, scriptId);
+ } else if($ax.public.fn.IsLayer(obj.type)) {
+ var layerObjs = obj.objs;
+ for(var j = 0; j < layerObjs.length; j++) {
+ mapScriptIdToLayerId(layerObjs[j], scriptId, path);
+ }
+ mapIdsToRepeaterAndLayer(path, layerObjs, repeaterId);
+ } else if(obj.objects && obj.objects.length) {
+ if(repeaterId) {
+ for(var j = 0; j < obj.objects.length; j++) {
+ mapIdsToRepeaterAndLayer(path, obj.objects, repeaterId);
+ }
+ }
+ }
+ }
+ };
+ mapIdsToRepeaterAndLayer([], $ax.pageData.page.diagram.objects);
+ };
+
+
+ $ax.getPathFromScriptId = function(scriptId) {
+ var reversedPath = [];
+ var path = scriptIdToPath[scriptId];
+ while(path && path.uniqueId) {
+ reversedPath[reversedPath.length] = path.uniqueId;
+ path = path.parent;
+ }
+ return reversedPath.reverse();
+ };
+
+ var _getScriptIdFromFullPath = function(path) {
+ var current = $ax.pageData.objectPaths;
+ for(var i = 0; i < path.length; i++) {
+ current = current[path[i]];
+ if(!current) return current;
+ }
+ return current && current.scriptId;
+ };
+
+
+ var _getScriptIdFromPath = function(path, relativeTo, includeLimbo) {
+ var relativePath = [];
+ var includeMasterInPath = false;
+ if(relativeTo) {
+ var relativeToScriptId;
+ if(relativeTo.srcElement) { //this is eventInfo
+ relativeToScriptId = $ax.repeater.getScriptIdFromElementId(relativeTo.srcElement);
+ includeMasterInPath = relativeTo.isMasterEvent;
+ } else if(typeof relativeTo === 'string') { //this is an element id
+ relativeToScriptId = relativeTo;
+ }
+
+ if(relativeToScriptId) {
+ relativePath = $ax.getPathFromScriptId(relativeToScriptId);
+ if(!includeMasterInPath) relativePath = relativePath.slice(0, relativePath.length - 1);
+ } else if(relativeTo instanceof Array) { //this is a path
+ relativePath = relativeTo;
+ }
+ }
+ var fullPath = relativePath.concat(path);
+ var scriptId = _getScriptIdFromFullPath(fullPath);
+ return (includeLimbo || !$ax.visibility.isScriptIdLimbo(scriptId)) && scriptId;
+ };
+ $ax.getScriptIdFromPath = _getScriptIdFromPath;
+
+ var _getElementIdsFromPath = function(path, eventInfo) {
+ var scriptId = _getScriptIdFromPath(path, eventInfo);
+ if(!scriptId) return [];
+ // Don't need placed check hear. If unplaced, scriptId will be undefined and exit out before here.
+ return $ax.getElementIdsFromEventAndScriptId(eventInfo, scriptId);
+ };
+ $ax.getElementIdsFromPath = _getElementIdsFromPath;
+
+ var _getElementIdFromPath = function(path, params, includeLimbo) {
+ var scriptId = _getScriptIdFromPath(path, params.relativeTo, includeLimbo);
+ if(!scriptId) return scriptId;
+
+ var itemNum = params.itemNum;
+ if(params.relativeTo && typeof params.relativeTo === 'string') {
+ if($jobj(params.relativeTo)) itemNum = $ax.repeater.getItemIdFromElementId(params.relativeTo);
+ }
+ return $ax.repeater.createElementId(scriptId, itemNum);
+ };
+ $ax.getElementIdFromPath = _getElementIdFromPath;
+
+ var _getElementsIdFromEventAndScriptId = function(eventInfo, scriptId) {
+ var itemId = eventInfo && $ax.repeater.getItemIdFromElementId(eventInfo.srcElement);
+ var target = false;
+ // Try to get itemId from target if you can't get it from source.
+ if(!itemId) {
+ itemId = eventInfo && eventInfo.targetElement && $ax.repeater.getItemIdFromElementId(eventInfo.targetElement);
+ if(itemId) target = true;
+ }
+
+ var parentRepeater = $ax.getParentRepeaterFromScriptId(scriptId);
+ if(parentRepeater && scriptId != parentRepeater) {
+ if(itemId && (!eventInfo || parentRepeater == $ax.getParentRepeaterFromScriptId($ax.repeater.getScriptIdFromElementId(target ? eventInfo.targetElement : eventInfo.srcElement)))) {
+ return [$ax.repeater.createElementId(scriptId, itemId)];
+ }
+ var elementIds = [];
+ var itemIds = $ax.getItemIdsForRepeater(parentRepeater);
+ if(!itemIds) return [];
+
+ for(var i = 0; i < itemIds.length; i++) elementIds[i] = $ax.repeater.createElementId(scriptId, itemIds[i]);
+ return elementIds;
+ }
+ return [scriptId];
+ };
+ $ax.getElementIdsFromEventAndScriptId = _getElementsIdFromEventAndScriptId;
+
+ var _getSrcElementIdFromEvent = function(event) {
+ var currentQuery = $(event.srcElement || event.target);
+ while(currentQuery && currentQuery.length && (!$obj(currentQuery.attr('id')) || $jobj(currentQuery.attr('id')).hasClass('text'))) {
+ currentQuery = currentQuery.parent();
+ };
+ return currentQuery.attr('id');
+ };
+ $ax.getSrcElementIdFromEvent = _getSrcElementIdFromEvent;
+
+ var _getEventInfoFromEvent = function(event, skipShowDescriptions, elementId) {
+ var eventInfo = {};
+ eventInfo.srcElement = elementId;
+ eventInfo.now = new Date();
+
+ if(event != null) {
+ //elementId can be empty string, so can't simple use "or" assignment here.
+ eventInfo.srcElement = elementId || elementId == '' ? elementId : _getSrcElementIdFromEvent(event);
+ eventInfo.which = event.which;
+
+ // When getting locations in mobile, need to extract the touch object to get the mouse location attributes
+ var mouseEvent = (event.originalEvent && event.originalEvent.changedTouches && event.originalEvent.changedTouches[0]) || event.originalEvent;
+ if(mouseEvent && !mouseEvent.type) mouseEvent.type = event.type;
+
+ if(skipShowDescriptions) eventInfo.skipShowDescriptions = true;
+
+ // Always update mouse location if possible
+ $ax.event.updateMouseLocation(mouseEvent);
+ }
+
+ // Always set event info about cursor
+ var _cursor = eventInfo.cursor = {};
+ _cursor.x = $ax.mouseLocation.x;
+ _cursor.y = $ax.mouseLocation.y;
+
+ var body = $('body');
+ if(body.css('position') == 'relative') {
+ _cursor.x -= ($ax.getNumFromPx(body.css('left')) + Math.max(0, ($(window).width() - body.width()) / 2));
+ }
+
+ eventInfo.pageX = _cursor.x + 'px';
+ eventInfo.pageY = _cursor.y + 'px';
+
+ // Do Keyboard Info
+ eventInfo.keyInfo = $ax.event.keyState();
+
+ eventInfo.window = $ax.getWindowInfo();
+
+ eventInfo.thiswidget = _getWidgetInfo(eventInfo.srcElement);
+ eventInfo.item = _getItemInfo(eventInfo.srcElement);
+ eventInfo.dragInfo = $ax.drag.GetWidgetDragInfo();
+
+ return eventInfo;
+ };
+ $ax.getEventInfoFromEvent = _getEventInfoFromEvent;
+
+ $ax.getBasicEventInfo = function() {
+ var eventInfo = {};
+ eventInfo.now = new Date();
+ eventInfo.window = $ax.getWindowInfo();
+ eventInfo.cursor = { x: 0, y: 0};
+ return eventInfo;
+
+ };
+
+ //var _getWindowInfo = function() {
+ // var win = {};
+ // win.width = $(window).width();
+ // win.height = $(window).height();
+ // win.scrollx = $(window).scrollLeft();
+ // win.scrolly = $(window).scrollTop();
+ // return win;
+ //};
+ //$ax.getWindowInfo = _getWindowInfo;
+
+ var repeaterInfoCache = [];
+ $ax.cacheRepeaterInfo = function(repeaterId, repeaterInfo) {
+ repeaterInfoCache[repeaterId] = repeaterInfo;
+ }
+ $ax.removeCachedRepeaterInfo = function(repeaterId) {
+ repeaterInfoCache[repeaterId] = undefined;
+ }
+
+ var _getItemInfo = function(elementId) {
+ if(!elementId) return { valid: false };
+
+ elementId = _getParentElement(elementId);
+
+ var index = $ax.repeater.getItemIdFromElementId(elementId);
+ if(!index) return { valid: false };
+
+ var item = { valid: true };
+
+ var scriptId = $ax.repeater.getScriptIdFromElementId(elementId);
+ var repeaterId = $ax.getParentRepeaterFromScriptId(scriptId);
+ item.repeater = repeaterInfoCache[repeaterId] ? repeaterInfoCache[repeaterId] : _getWidgetInfo(repeaterId);
+ $ax.repeater.setDisplayProps(item, repeaterId, index);
+ item.ismarked = $ax.repeater.isEditItem(repeaterId, index);
+ item.isvisible = Boolean($jobj(elementId).length);
+
+ return item;
+ };
+ $ax.getItemInfo = _getItemInfo;
+
+ var _getWidgetInfo = function(elementId) {
+ if(!elementId) return { valid: false };
+
+ elementId = _getParentElement(elementId);
+
+ //var elementAxQuery = $ax('#' + elementId);
+ var elementQuery = $jobj(elementId);
+ var obj = $obj(elementId);
+ var widget = { valid: true, isWidget: true, obj: obj, elementQuery: elementQuery, isLayer: $ax.public.fn.IsLayer(obj.type) };
+ widget.elementId = elementId;
+ widget.name = widget.label = (elementQuery.data('label') ? elementQuery.data('label') : '');
+ //widget.text = $ax('#' + elementId).text();
+ widget.opacity = Number(elementQuery.css('opacity')) * 100;
+ //widget.rotation = $ax.move.getRotationDegree(widget.elementId);
+ var scriptId = $ax.repeater.getScriptIdFromElementId(elementId);
+ var repeaterId = $ax.getParentRepeaterFromScriptId(scriptId);
+ if(repeaterId) widget.repeater = $ax.public.fn.IsRepeater(obj.type) ? widget : _getWidgetInfo(repeaterId);
+
+ // Right now only dynamic panel can scroll
+ if($ax.public.fn.IsDynamicPanel(obj.type)) {
+ var stateId = $ax.visibility.GetPanelState(elementId);
+ //can be empty when refreshing repeater and applying filter
+ if(stateId) {
+ var stateQuery = $('#' + stateId);
+ widget.scrollx = stateQuery.scrollLeft();
+ widget.scrolly = stateQuery.scrollTop();
+ //widget.stateQuery = stateQuery;
+ }
+ } else {
+ widget.scrollx = 0;
+ widget.scrolly = 0;
+ }
+
+ // repeater only props
+ if($ax.public.fn.IsRepeater(obj.type)) {
+ widget.visibleitemcount = repeaterIdToItemIds[scriptId] ? repeaterIdToItemIds[scriptId].length : $ax.repeater.getVisibleDataCount(scriptId);
+ widget.itemcount = $ax.repeater.getFilteredDataCount(scriptId);
+ widget.datacount = $ax.repeater.getDataCount(scriptId);
+ widget.pagecount = $ax.repeater.getPageCount(scriptId);
+ widget.pageindex = $ax.repeater.getPageIndex(scriptId);
+ }
+
+ // Get widget info funcs
+ //widget.elementAxQuery = function () {
+ // return this.elementAxQueryProp || (this.elementAxQueryProp = $ax('#' + this.elementId));
+ //}
+
+ //widget.isFitToContent = function () {
+ // if (this.isFitToContentProp === undefined) {
+ // if (!this.stateQuery) this.isFitToContentProp = false;
+ // else this.isFitToContentProp = $ax.dynamicPanelManager.isIdFitToContent(this.elementId);
+ // }
+ // return this.isFitToContentProp;
+ //}
+
+ widget.x = function () { return this.getProp('x'); }
+ widget.y = function () { return this.getProp('y'); }
+ widget.pagex = function () { return this.getProp('pagex'); }
+ widget.pagey = function () { return this.getProp('pagey'); }
+ widget.width = function () { return this.getProp('width'); }
+ widget.height = function () { return this.getProp('height'); }
+ widget.left = function () { return this.x(); }
+ widget.top = function () { return this.y(); }
+ widget.right = function () { return this.x() + this.width(); }
+ widget.bottom = function () { return this.y() + this.height(); }
+ widget.rotation = function () { return this.getProp('rotation'); }
+ widget.text = function () { return this.getProp('text'); }
+
+ widget.getProp = function (prop) {
+ var propName = prop + 'Prop';
+ if (typeof (this[propName]) != 'undefined') return this[propName];
+ return this[propName] = this.cacheProp(prop);
+ };
+
+ widget.cacheProp = function (prop) {
+
+ if(prop == 'x' || prop == 'y' || prop == 'width' || prop == 'height') {
+ var boundingRect = $ax('#' + this.elementId).offsetBoundingRect(true);
+ this.xProp = boundingRect.left;
+ this.yProp = boundingRect.top;
+ this.widthProp = boundingRect.width;
+ this.heightProp = boundingRect.height;
+ }
+
+ if(prop == 'pagex' || prop == 'pagey') {
+ var viewportLocation = $ax('#' + this.elementId).viewportLocation();
+ this.pagexProp = viewportLocation.left;
+ this.pageyProp = viewportLocation.top;
+ }
+
+ if(prop == 'rotation') {
+ this.rotationProp = $ax.move.getRotationDegree(this.elementId);
+ }
+
+ if (prop == 'text') {
+ this.textProp = $ax('#' + this.elementId).text();
+ }
+
+ return this[prop + 'Prop'];
+
+ //// I'm keeping the returned undefineds the same as before, but really I could probably return undefined right away if elementQuery is empty
+ //if (this.isLayer) {
+ // if (prop == 'pagex' || prop == 'pagey') {
+ // if (this.elementQuery.length > 0) {
+ // if (prop == 'pagex') return this.elementAxQuery().left();
+ // else return this.elementAxQuery().top();
+ // }
+ // return undefined; // Otherwise, it is undefined as there is no element
+ // }
+ // var boundingRect = $ax.public.fn.getWidgetBoundingRect(this.elementId);
+ // this.xProp = boundingRect.left;
+ // this.yProp = boundingRect.top;
+ // this.widthProp = boundingRect.width;
+ // this.heightProp = boundingRect.height;
+ // return this[prop + 'Prop'];
+ //}
+
+ //if (this.elementQuery.length <= 0) return prop == 'x' || prop == 'y' ? 0 : undefined;
+
+ //switch (prop) {
+ // case 'x': return this.elementAxQuery().locRelativeIgnoreLayer(false);
+ // case 'y': return this.elementAxQuery().locRelativeIgnoreLayer(true);
+ // case 'pagex': return this.elementAxQuery().left();
+ // case 'pagey': return this.elementAxQuery().top();
+ //}
+
+ //var val = this.elementAxQuery()[prop]();
+ //if (this.isFitToContent()) val = this.stateQuery[prop]();
+
+ //return val;
+ };
+
+ //widget.leftfixed = function() { this.getFixed('left'); }
+ //widget.topfixed = function() { this.getFixed('top'); }
+ //widget.rightfixed = function() { this.getFixed('right'); }
+ //widget.bottomfixed = function() { this.getFixed('bottom'); }
+
+ //widget.isFixed = function() {
+ // if(this.isFixedProp === undefined) this.isFixedProp = this.elementQuery.css('position') == 'fixed)';
+ // return this.isFixedProp;
+ //}
+
+ //widget.getFixed = function (prop) {
+ // var fixed = prop + 'fixedProp';
+ // if(!this.isFixed()) widget[fixed] = widget[prop]();
+ // if(widget[fixed] === undefined) {
+
+ // if(prop == 'left' || prop == 'right') {
+ // if(this.windowScrollX === undefined) this.windowScrollX = $(window).scrollLeft();
+ // var windowScroll = this.windowScrollX;
+ // } else {
+ // if(this.windowScrollY === undefined) this.windowScrollY = $(window).scrollTop();
+ // windowScroll = this.windowScrollY;
+ // }
+ // widget[fixed] = widget[prop]() - windowScroll;
+ // }
+ // return widget[fixed];
+ //}
+
+ return widget;
+ };
+ $ax.getWidgetInfo = _getWidgetInfo;
+
+ $ax.GetTextPanelId = function (id, create) {
+ if(!$ax('#' + id).SupportsRichText()) return '';
+ var buttonShape = $ax.GetButtonShape(id);
+ var panelDiv = buttonShape.find('.text')[0];
+ if(!panelDiv) {
+ if(!create) return "";
+
+ var adaptiveId = $ax.adaptive.currentViewId;
+ var newId = id + "_text";
+ //var newDiv = $('
');
+ var newDiv = $('');
+ buttonShape.append(newDiv);
+
+ $ax.style.setAdaptiveStyle(id, $ax.style.computeAllOverrides(id, undefined, $ax.style.generateState(id), adaptiveId));
+
+ panelDiv = newDiv[0];
+ }
+
+ return panelDiv.id;
+ }
+
+ $ax.GetParentIdFromLink = function(id) {
+ return $ax.GetShapeIdFromText($jobj(id).parentsUntil('.text').parent().attr('id'));
+ };
+
+ $ax.GetButtonShapeId = function(id) {
+ var obj = $obj(id);
+ switch(obj.type) {
+ case $ax.constants.TREE_NODE_OBJECT_TYPE:
+ return obj.buttonShapeId ? $ax.getElementIdFromPath([obj.buttonShapeId], { relativeTo: id }) : "";
+ case $ax.constants.LINK_TYPE:
+ return "";
+ default:
+ return id;
+ }
+ };
+
+ $ax.GetButtonShape = function(id) {
+ return $jobj($ax.GetButtonShapeId(id));
+ };
+
+ $ax.GetShapeIdFromText = function(id) {
+ if(!id) return undefined; // this is to prevent an infinite loop.
+
+ var current = document.getElementById(id);
+ if(!current) return undefined;
+ current = current.parentElement;
+ while(current && current.tagName != 'BODY') {
+ var currentId = current.id;
+ if(currentId && currentId != 'base') return $ax.visibility.getWidgetFromContainer(currentId);
+ current = current.parentElement;
+ }
+
+ return undefined;
+ };
+
+ $ax.GetImageIdFromShape = function(id) {
+ var image = $ax.GetButtonShape(id).find('img[id$=img]');
+ if(!image.length) image = $jobj(id).find('img[id$=image_sketch]');
+ return image.attr('id');
+ };
+
+ var _getParentElement = $ax.getParentElement = function(elementId) {
+ var obj = $obj(elementId);
+ while(obj.isContained) {
+ var path = $ax.getPathFromScriptId($ax.repeater.getScriptIdFromElementId(elementId));
+ var itemId = $ax.repeater.getItemIdFromElementId(elementId);
+ path[path.length - 1] = obj.parent.id;
+ elementId = $ax.getElementIdFromPath(path, { itemNum: itemId });
+ obj = $obj(elementId);
+ }
+
+ return elementId;
+ };
+
+ $ax.addItemIdToRepeater = function(itemId, repeaterId) {
+ var itemIds = repeaterIdToItemIds[repeaterId];
+ if(itemIds) itemIds[itemIds.length] = itemId;
+ else repeaterIdToItemIds[repeaterId] = [itemId];
+
+ var scriptIds = repeaterIdToScriptIds[repeaterId];
+ for(var i = 0; i < scriptIds.length; i++) elementIdToObject[$ax.repeater.createElementId(scriptIds[i], itemId)] = $ax.getObjectFromScriptId(scriptIds[i]);
+ };
+
+ $ax.getAllElementIds = function() {
+ var elementIds = [];
+ for(var i = 0; i < _scriptIds.length; i++) {
+ var scriptId = _scriptIds[i];
+ var repeaterId = scriptIdToRepeaterId[scriptId];
+ if(repeaterId && repeaterId != scriptId) {
+ var itemIds = repeaterIdToItemIds[repeaterId] || [];
+ for(var j = 0; j < itemIds.length; j++) elementIds[elementIds.length] = $ax.repeater.createElementId(scriptId, itemIds[j]);
+ } else elementIds[elementIds.length] = scriptId;
+ }
+ return elementIds;
+ };
+
+ $ax.getAllScriptIds = function() {
+ return _scriptIds;
+ };
+
+ $ax.getObjectFromElementId = function(elementId) {
+ return $ax.getObjectFromScriptId($ax.repeater.getScriptIdFromElementId(elementId));
+ };
+
+ $ax.getObjectFromScriptId = function(scriptId) {
+ return scriptIdToObject[scriptId];
+ };
+
+ $ax.getParentRepeaterFromElementId = function(elementId) {
+ return $ax.getParentRepeaterFromScriptId($ax.repeater.getScriptIdFromElementId(elementId));
+ };
+
+ $ax.getParentRepeaterFromElementIdExcludeSelf = function (elementId) {
+ var repeaterId = $ax.getParentRepeaterFromElementId(elementId);
+ return repeaterId != elementId ? repeaterId : undefined;
+ };
+
+ $ax.getParentRepeaterFromScriptId = function(scriptId) {
+ return scriptIdToRepeaterId[scriptId];
+ };
+
+ var _getChildScriptIdsForRepeater = function(repeaterId) {
+ return repeaterIdToScriptIds[repeaterId];
+ };
+
+ var _getItemIdsForRepeater = function(repeaterId) {
+ return repeaterIdToItemIds[repeaterId] || [];
+ };
+ $ax.getItemIdsForRepeater = _getItemIdsForRepeater;
+
+ var _clearItemIdsForRepeater = function(repeaterId) {
+ repeaterIdToItemIds[repeaterId] = [];
+ };
+ $ax.clearItemsForRepeater = _clearItemIdsForRepeater;
+
+ $ax.getChildElementIdsForRepeater = function(repeaterId) {
+ var scriptIds = _getChildScriptIdsForRepeater(repeaterId);
+ var itemIds = _getItemIdsForRepeater(repeaterId);
+
+ var retVal = [];
+ if(!itemIds || !scriptIds) return retVal;
+
+ for(var i = 0; i < scriptIds.length; i++) {
+ for(var j = 0; j < itemIds.length; j++) {
+ retVal[retVal.length] = $ax.repeater.createElementId(scriptIds[i], itemIds[j]);
+ }
+ }
+ return retVal;
+ };
+
+ $ax.getRdoParentFromElementId = function(elementId) {
+ var scriptId = $ax.repeater.getScriptIdFromElementId(elementId);
+ var rdoId = scriptIdToPath[scriptId].parent.scriptId;
+ if($ax.getParentRepeaterFromScriptId(rdoId)) rdoId = $ax.repeater.createElementId(rdoId, $ax.repeater.getItemIdFromElementId(elementId));
+ return rdoId;
+ };
+
+ $ax.getLayerParentFromElementId = function (elementId) {
+ var itemId = $ax.repeater.getItemIdFromElementId(elementId);
+ var scriptId = scriptIdToParentLayer[$ax.repeater.getScriptIdFromElementId(elementId)];
+ return $ax.getParentRepeaterFromElementId(scriptId) ? $ax.repeater.createElementId(scriptId, itemId) : scriptId;
+ }
+
+ $ax.updateElementText = function(elementId, text) {
+ elementIdToText[elementId] = text;
+ };
+
+ $ax.hasElementTextChanged = function(elementId, text) {
+ return elementIdToText[elementId] != text;
+ };
+
+ $ax.updateRadioButtonSelected = function(group, elementId) {
+ var old = radioGroupToSelectedElementId[group];
+ radioGroupToSelectedElementId[group] = elementId;
+ return old;
+ };
+
+ $ax.hasRadioButtonSelectedChanged = function(group, elementId) {
+ return radioGroupToSelectedElementId[group] != elementId;
+ };
+ })();
+
+ //Recursively populates fullPathArray with:
+ // [ { idPath, scriptId }, ... ]
+ //for every scriptId in the object
+ //also populates an object of scriptId -> path
+ var _pathToScriptIdHelper = function(currentPath, currentChain, fullPathArray, scriptIdToPath) {
+ for(var key in currentPath) {
+ if(key != "scriptId") {
+ var nextPath = currentPath[key];
+ _pathToScriptIdHelper(nextPath, currentChain.concat(key), fullPathArray, scriptIdToPath);
+ nextPath.parent = currentPath;
+ nextPath.uniqueId = key;
+ } else {
+ fullPathArray[fullPathArray.length] = { idPath: currentChain, scriptId: currentPath.scriptId };
+ scriptIdToPath[currentPath.scriptId] = currentPath;
+ }
+ }
+ };
+
+ $ax.public.loadCurrentPage = $ax.loadCurrentPage = function(pageData) {
+ $ax.pageData = _pageData = pageData;
+ _initializePageData();
+ };
+
+ $ax.public.loadDocument = $ax.loadDocument = function(document) {
+ $ax.document = document;
+ _initializeDocumentData();
+ };
+
+
+ /**
+ Navigates to a page
+
+
+ */
+ $ax.public.navigate = $ax.navigate = function(to) { //url, includeVariables, type) {
+ var targetUrl;
+ if(typeof (to) === 'object') {
+ includeVariables = to.includeVariables;
+ targetUrl = !includeVariables ? to.url : $ax.globalVariableProvider.getLinkUrl(to.url);
+
+ if(to.target == "new") {
+ window.open(targetUrl, "");
+ } else if(to.target == "popup") {
+ var features = _getPopupFeatures(to.popupOptions);
+ window.open(targetUrl, "", features);
+ } else {
+ var targetLocation = window.location;
+ if(to.target == "current") {
+ } else if(to.target == "parent") {
+ if(!top.opener) return;
+ targetLocation = top.opener.window.location;
+ } else if(to.target == "parentFrame") {
+ targetLocation = parent.location;
+ } else if(to.target == "frame") {
+ // targetLocation = to.frame.contentWindow.location;
+ $(to.frame).attr('src', targetUrl || 'about:blank');
+ return;
+ }
+
+ if (!_needsReload(targetLocation, to.url)) {
+ targetLocation.href = targetUrl || 'about:blank';
+ } else {
+ targetLocation.href = $axure.utils.getReloadPath() + "#" + encodeURI(targetUrl);
+ }
+ }
+ } else {
+ $ax.navigate({
+ url: to,
+ target: "current",
+ includeVariables: arguments[1]
+ });
+ }
+ };
+
+ var _needsReload = function(oldLocation, newBaseUrl) {
+ var reload = false;
+ try {
+ var oldUrl = oldLocation.href;
+ var oldBaseUrl = oldUrl.split("#")[0];
+ var lastslash = oldBaseUrl.lastIndexOf("/");
+ if(lastslash > 0) {
+ oldBaseUrl = oldBaseUrl.substring(lastslash + 1, oldBaseUrl.length);
+ if(oldBaseUrl == encodeURI(newBaseUrl)) {
+ reload = true;
+ }
+ }
+ } catch(e) {
+ }
+ return reload;
+ };
+
+ var _getPopupFeatures = function(options) {
+ var defaultOptions = {
+ toolbar: true,
+ scrollbars: true,
+ location: true,
+ status: true,
+ menubar: true,
+ directories: true,
+ resizable: true,
+ centerwindow: true,
+ left: -1,
+ top: -1,
+ height: -1,
+ width: -1
+ };
+
+ var selectedOptions = $.extend({}, defaultOptions, options);
+
+ var optionsList = [];
+ optionsList.push('toolbar=' + (selectedOptions.toolbar ? 'yes' : 'no'));
+ optionsList.push('scrollbars=' + (selectedOptions.scrollbars ? 'yes' : 'no'));
+ optionsList.push('location=' + (selectedOptions.location ? 'yes' : 'no'));
+ optionsList.push('status=' + (selectedOptions.status ? 'yes' : 'no'));
+ optionsList.push('menubar=' + (selectedOptions.menubar ? 'yes' : 'no'));
+ optionsList.push('directories=' + (selectedOptions.directories ? 'yes' : 'no'));
+ optionsList.push('resizable=' + (selectedOptions.resizable ? 'yes' : 'no'));
+
+ if(selectedOptions.centerwindow == false) {
+ if(selectedOptions.left > -1) {
+ optionsList.push('left=' + selectedOptions.left);
+ }
+
+ if(selectedOptions.top > -1) {
+ optionsList.push('top=' + selectedOptions.top);
+ }
+ }
+
+ var height = 0;
+ var width = 0;
+ if(selectedOptions.height > 0) {
+ optionsList.push('height=' + selectedOptions.height);
+ height = selectedOptions.height;
+ }
+
+ if(selectedOptions.width > 0) {
+ optionsList.push('width=' + selectedOptions.width);
+ width = selectedOptions.width;
+ }
+
+ var features = optionsList.join(',');
+ if(selectedOptions.centerwindow) {
+ var winl = (window.screen.width - width) / 2;
+ var wint = (window.screen.height - height) / 2;
+ features = features + ',left=' + winl + ',top=' + wint;
+ }
+
+ return features;
+ };
+
+ /**
+ Closes a window
+
+
+ */
+ $ax.public.closeWindow = $ax.closeWindow = function() {
+ parent.window.close();
+ };
+
+ /**
+ Goes back
+
+
+ */
+ $ax.public.back = $ax.back = function() {
+ window.history.go(-1);
+ };
+
+ /**
+ Reloads the current page.
+ # includeVariables: true if it should re-include the variables when the page is reloaded
+ */
+ $ax.public.reload = $ax.reload = function(includeVariables) {
+ var targetUrl = (includeVariables === false)
+ ? $axure.utils.getReloadPath() + "#" + encodeURI($ax.pageData.url)
+ : $axure.utils.getReloadPath() + "#" + encodeURI($ax.globalVariableProvider.getLinkUrl($ax.pageData.url));
+ window.location.href = targetUrl;
+ };
+
+ /**
+ Sets a variable.
+ # name: The name of the global variable to set
+ # value: The value that should be set
+ */
+ $ax.public.setGlobalVariable = $ax.setGlobalVariable = function(name, value) {
+ if(!name || !value) {
+ return;
+ }
+
+ $ax.globalVariableProvider.setVariableValue(name, value);
+ };
+
+ /**
+ Gets the value of a global variable
+ # name: The name of the global variable value to get
+ */
+ $ax.public.getGlobalVariable = $ax.getGlobalVariable = function(name) {
+ $ax.globalVariableProvider.getVariableValue(name);
+ };
+
+ $ax.getObjectFromElementIdDisregardHex = function (elementId) {
+ var elementIdInput = elementId.charAt(0) == '#' ? elementId.substring(1) : elementId;
+ return this.getObjectFromElementId(elementIdInput);
+ }
+
+
+ $ax.getTypeFromElementId = function(elementId) {
+ var obj = this.getObjectFromElementIdDisregardHex(elementId);
+ return obj && obj.type;
+ };
+
+ $ax.getNumFromPx = function(pxNum) {
+ return Number(pxNum.replace('px', ''));
+ }
+
+});
\ No newline at end of file
diff --git a/src/原型系统/resources/scripts/axure/drag.js b/src/原型系统/resources/scripts/axure/drag.js
new file mode 100644
index 0000000..2eefeda
--- /dev/null
+++ b/src/原型系统/resources/scripts/axure/drag.js
@@ -0,0 +1,256 @@
+$axure.internal(function($ax) {
+ var widgetDragInfo = new Object();
+ var _drag = {};
+ $ax.drag = _drag;
+
+ $ax.drag.GetWidgetDragInfo = function() {
+ return $.extend({}, widgetDragInfo);
+ };
+
+ $ax.drag.StartDragWidget = function(event, id) {
+ $ax.setjBrowserEvent(jQuery.Event(event));
+ if(event.donotdrag) return;
+
+ var x, y;
+ var tg;
+ if(IE_10_AND_BELOW) {
+ x = window.event.clientX + window.document.documentElement.scrollLeft + window.document.body.scrollLeft;
+ y = window.event.clientY + window.document.documentElement.scrollTop + window.document.body.scrollTop;
+ tg = window.event.srcElement;
+ } else {
+ if(event.changedTouches) {
+ x = event.changedTouches[0].pageX;
+ y = event.changedTouches[0].pageY;
+ } else {
+ x = event.pageX;
+ y = event.pageY;
+ event.preventDefault();
+ }
+ tg = event.target;
+ }
+
+ widgetDragInfo.hasStarted = false;
+ widgetDragInfo.widgetId = id;
+ widgetDragInfo.cursorStartX = x;
+ widgetDragInfo.cursorStartY = y;
+ widgetDragInfo.lastX = x;
+ widgetDragInfo.lastY = y;
+ widgetDragInfo.currentX = x;
+ widgetDragInfo.currentY = y;
+
+ widgetDragInfo.movedWidgets = new Object();
+ widgetDragInfo.startTime = (new Date()).getTime();
+ widgetDragInfo.targetWidget = tg;
+
+ var movedownName = IE_10_AND_BELOW && $ax.features.supports.windowsMobile ?
+ $ax.features.eventNames.mouseDownName : $ax.features.eventNames.mouseMoveName;
+ $ax.event.addEvent(document, movedownName, _dragWidget, true);
+ $ax.event.addEvent(document, $ax.features.eventNames.mouseUpName, _stopDragWidget, true);
+
+ $ax.legacy.SuppressBubble(event);
+ };
+
+ var _dragWidget = function(event) {
+ $ax.setjBrowserEvent(jQuery.Event(event));
+
+ var x, y;
+ if(IE_10_AND_BELOW) {
+ x = window.event.clientX + window.document.documentElement.scrollLeft + window.document.body.scrollLeft;
+ y = window.event.clientY + window.document.documentElement.scrollTop + window.document.body.scrollTop;
+ } else {
+ if(event.changedTouches) {
+ x = event.changedTouches[0].pageX;
+ y = event.changedTouches[0].pageY;
+ //allow scroll (defaults) if only swipe events have cases and delta x is less than 5px and not blocking scrolling
+ var deltaX = x - widgetDragInfo.currentX;
+ var target = window.document.getElementById(widgetDragInfo.widgetId);
+ if($ax.event.hasSyntheticEvent(widgetDragInfo.widgetId, "onDrag") || $ax.event.hasSyntheticEvent(widgetDragInfo.widgetId, "onSwipeUp") ||
+ $ax.event.hasSyntheticEvent(widgetDragInfo.widgetId, "onSwipeDown") || (deltaX * deltaX) > 25
+ || ($ax.document.configuration.preventScroll && $ax.legacy.GetScrollable(target) == window.document.body)) {
+ event.preventDefault();
+ }
+ } else {
+ x = event.pageX;
+ y = event.pageY;
+ }
+ }
+ widgetDragInfo.xDelta = x - widgetDragInfo.currentX;
+ widgetDragInfo.yDelta = y - widgetDragInfo.currentY;
+ widgetDragInfo.lastX = widgetDragInfo.currentX;
+ widgetDragInfo.lastY = widgetDragInfo.currentY;
+ widgetDragInfo.currentX = x;
+ widgetDragInfo.currentY = y;
+
+ widgetDragInfo.currentTime = (new Date()).getTime();
+
+ $ax.legacy.SuppressBubble(event);
+
+ if(!widgetDragInfo.hasStarted) {
+ widgetDragInfo.hasStarted = true;
+ $ax.event.raiseSyntheticEvent(widgetDragInfo.widgetId, "onDragStart");
+
+ widgetDragInfo.oldBodyCursor = window.document.body.style.cursor;
+ window.document.body.style.cursor = 'move';
+ var widget = window.document.getElementById(widgetDragInfo.widgetId);
+ widgetDragInfo.oldCursor = widget.style.cursor;
+ widget.style.cursor = 'move';
+ }
+
+ $ax.event.raiseSyntheticEvent(widgetDragInfo.widgetId, "onDrag");
+ };
+
+ var _suppressClickAfterDrag = function(event) {
+ _removeSuppressEvents();
+
+ $ax.legacy.SuppressBubble(event);
+ };
+
+ var _removeSuppressEvents = function () {
+ if(IE_10_AND_BELOW) {
+ $ax.event.removeEvent(event.srcElement, 'click', _suppressClickAfterDrag, undefined, true);
+ $ax.event.removeEvent(widgetDragInfo.targetWidget, 'mousemove', _removeSuppressEvents, undefined, true);
+ } else {
+ $ax.event.removeEvent(document, "click", _suppressClickAfterDrag, true);
+ $ax.event.removeEvent(document, 'mousemove', _removeSuppressEvents, true);
+ }
+ };
+
+ var _stopDragWidget = function(event) {
+ $ax.setjBrowserEvent(jQuery.Event(event));
+
+ var tg;
+
+
+ var movedownName = IE_10_AND_BELOW && $ax.features.supports.windowsMobile ?
+ $ax.features.eventNames.mouseDownName : $ax.features.eventNames.mouseMoveName;
+ $ax.event.removeEvent(document, movedownName, _dragWidget, true);
+ $ax.event.removeEvent(document, $ax.features.eventNames.mouseUpName, _stopDragWidget, true);
+
+ tg = IE_10_AND_BELOW ? window.event.srcElement : event.target;
+
+ if(widgetDragInfo.hasStarted) {
+ widgetDragInfo.currentTime = (new Date()).getTime();
+ $ax.event.raiseSyntheticEvent(widgetDragInfo.widgetId, "onDragDrop");
+
+ if($ax.globalVariableProvider.getVariableValue('totaldragx') < -30 && $ax.globalVariableProvider.getVariableValue('dragtime') < 1000) {
+ $ax.event.raiseSyntheticEvent(widgetDragInfo.widgetId, "onSwipeLeft");
+ }
+
+ if($ax.globalVariableProvider.getVariableValue('totaldragx') > 30 && $ax.globalVariableProvider.getVariableValue('dragtime') < 1000) {
+ $ax.event.raiseSyntheticEvent(widgetDragInfo.widgetId, "onSwipeRight");
+ }
+
+ var totalDragY = $ax.globalVariableProvider.getVariableValue('totaldragy');
+ if(totalDragY < -30 && $ax.globalVariableProvider.getVariableValue('dragtime') < 1000) {
+ $ax.event.raiseSyntheticEvent(widgetDragInfo.widgetId, "onSwipeUp");
+ }
+
+ if(totalDragY > 30 && $ax.globalVariableProvider.getVariableValue('dragtime') < 1000) {
+ $ax.event.raiseSyntheticEvent(widgetDragInfo.widgetId, "onSwipeDown");
+ }
+
+ window.document.body.style.cursor = widgetDragInfo.oldBodyCursor;
+ var widget = window.document.getElementById(widgetDragInfo.widgetId);
+ // It may be null if OnDragDrop filtered out the widget
+ if(widget != null) widget.style.cursor = widgetDragInfo.oldCursor;
+
+ if(widgetDragInfo.targetWidget == tg && !event.changedTouches) {
+ // suppress the click after the drag on desktop browsers
+ if(IE_10_AND_BELOW && widgetDragInfo.targetWidget) {
+ $ax.event.addEvent(widgetDragInfo.targetWidget, 'click', _suppressClickAfterDrag, true, true);
+ $ax.event.addEvent(widgetDragInfo.targetWidget, "onmousemove", _removeSuppressEvents, true, true);
+ } else {
+ $ax.event.addEvent(document, "click", _suppressClickAfterDrag, true);
+ $ax.event.addEvent(document, "mousemove", _removeSuppressEvents, true);
+
+ }
+ }
+ }
+
+ widgetDragInfo.hasStarted = false;
+ widgetDragInfo.movedWidgets = new Object();
+
+ return false;
+ };
+
+ $ax.drag.GetDragX = function() {
+ if(widgetDragInfo.hasStarted) return widgetDragInfo.xDelta;
+ return 0;
+ };
+
+ $ax.drag.GetDragY = function() {
+ if(widgetDragInfo.hasStarted) return widgetDragInfo.yDelta;
+ return 0;
+ };
+
+ $ax.drag.GetTotalDragX = function() {
+ if(widgetDragInfo.hasStarted) return widgetDragInfo.currentX - widgetDragInfo.cursorStartX;
+ return 0;
+ };
+
+ $ax.drag.GetTotalDragY = function() {
+ if(widgetDragInfo.hasStarted) return widgetDragInfo.currentY - widgetDragInfo.cursorStartY;
+ return 0;
+ };
+
+ $ax.drag.GetDragTime = function() {
+ if(widgetDragInfo.hasStarted) return widgetDragInfo.currentTime - widgetDragInfo.startTime;
+ return 600000;
+ };
+
+ $ax.drag.LogMovedWidgetForDrag = function (id, dragInfo) {
+ dragInfo = dragInfo || widgetDragInfo;
+ if(dragInfo.hasStarted) {
+ var containerIndex = id.indexOf('_container');
+ if(containerIndex != -1) id = id.substring(0, containerIndex);
+
+ // If state or other non-widget id, this should not be dragged, and should exit out to avoid exceptions.
+ if(!$obj(id)) return;
+
+ var query = $ax('#' + id);
+ //var x = query.left();
+ //var y = query.top();
+ var viewportLocation = query.viewportLocation();
+ var x = viewportLocation.left;
+ var y = viewportLocation.top;
+
+ var movedWidgets = dragInfo.movedWidgets;
+ if(!movedWidgets[id]) {
+ movedWidgets[id] = new Location(x, y);
+ }
+ }
+ };
+
+ var Location = function(x, y) {
+ this.x = x;
+ this.y = y;
+ };
+ $ax.drag.location = Location;
+
+ var Rectangle = $ax.drag.Rectangle = function(x, y, width, height) {
+ this.x = x;
+ this.y = y;
+ this.width = width;
+ this.height = height;
+ this.right = x + width;
+ this.bottom = y + height;
+ };
+
+ Rectangle.prototype.IntersectsWith = function(rect) {
+ if(this.Invalid()) return false;
+ if(rect.length) {
+ for(var i = 0; i < rect.length; i++) if(!rect[i].Invalid && this.IntersectsWith(rect[i])) return true;
+ return false;
+ }
+ if(rect.Invalid()) return false;
+ return this.x < rect.right && this.right > rect.x && this.y < rect.bottom && this.bottom > rect.y;
+ };
+
+ Rectangle.prototype.Invalid = function() {
+ return this.x == -1 && this.y == -1 && this.width == -1 && this.height == -1;
+ };
+
+ Rectangle.prototype.Move = function(x, y) {
+ return new Rectangle(x, y, this.width, this.height);
+ };
+});
\ No newline at end of file
diff --git a/src/原型系统/resources/scripts/axure/events.js b/src/原型系统/resources/scripts/axure/events.js
new file mode 100644
index 0000000..78592cf
--- /dev/null
+++ b/src/原型系统/resources/scripts/axure/events.js
@@ -0,0 +1,1975 @@
+// ******* Features MANAGER ******** //
+
+$axure.internal(function($ax) {
+ var _features = $ax.features = {};
+ var _supports = _features.supports = {};
+ _supports.touchstart = typeof window.ontouchstart !== 'undefined';
+ _supports.touchmove = typeof window.ontouchmove !== 'undefined';
+ _supports.touchend = typeof window.ontouchend !== 'undefined';
+
+ _supports.mobile = _supports.touchstart && _supports.touchend && _supports.touchmove;
+ // Got this from http://stackoverflow.com/questions/11381673/javascript-solution-to-detect-mobile-browser
+ var check = navigator.userAgent.match(/Android/i)
+ || navigator.userAgent.match(/webOS/i)
+ || navigator.userAgent.match(/iPhone/i)
+ || navigator.userAgent.match(/iPad/i)
+ || navigator.userAgent.match(/iPod/i)
+ || navigator.userAgent.match(/BlackBerry/i)
+ || navigator.userAgent.match(/Tablet PC/i)
+ || navigator.userAgent.match(/Windows Phone/i);
+
+ _supports.windowsMobile = navigator.userAgent.match(/Tablet PC/i) || navigator.userAgent.match(/Windows Phone/i);
+
+ if(!check && _supports.mobile) {
+ _supports.touchstart = false;
+ _supports.touchmove = false;
+ _supports.touchend = false;
+ _supports.mobile = false;
+ }
+
+ var _eventNames = _features.eventNames = {};
+ _eventNames.mouseDownName = _supports.touchstart ? 'touchstart' : 'mousedown';
+ _eventNames.mouseUpName = _supports.touchend ? 'touchend' : 'mouseup';
+ _eventNames.mouseMoveName = _supports.touchmove ? 'touchmove' : 'mousemove';
+});
+
+// ******* EVENT MANAGER ******** //
+$axure.internal(function ($ax) {
+ var isConsoleTracing = false
+ var isPageLoading = true;
+ var savedMessages = [];
+
+ // Every time Debug begins/ends tracing or a new Debug.js file finishes loading this value will be updated
+ $axure.messageCenter.addStateListener("isTracing", function (key, value) {
+ isConsoleTracing = value;
+ isPageLoading = false;
+
+ if (isConsoleTracing) {
+ for (var i = 0; i < savedMessages.length; i++) {
+ $ax.messageCenter.postMessage(savedMessages[i]["message"], savedMessages[i]["data"]);
+ }
+ }
+
+ savedMessages = [];
+ });
+
+ var postMessage = function (message, data) {
+ // While page is still loading, we do not know if Console is set to trace, so save messages until load is finished and trace status can be determined
+ if (isPageLoading) {
+ savedMessages.push({ 'message': message, 'data': data });
+ } else if (isConsoleTracing) {
+ $ax.messageCenter.postMessage(message, data);
+ }
+ }
+
+ var _objectIdToEventHandlers = {};
+
+ var _jBrowserEvent = undefined;
+ $ax.setjBrowserEvent = function(event) {
+ _jBrowserEvent = event;
+ };
+
+ $ax.getjBrowserEvent = function() {
+ return _jBrowserEvent;
+ };
+
+ var _event = {};
+ $ax.event = _event;
+
+ //initilize state
+ _event.mouseOverObjectId = '';
+ _event.mouseDownObjectId = '';
+ _event.mouseOverIds = [];
+
+ var EVENT_NAMES = ['mouseenter', 'mouseleave', 'contextmenu', 'change', 'focus', 'blur'];
+
+
+ // Tap, double tap, and touch move, or synthetic.
+ if(!$ax.features.supports.mobile) {
+ EVENT_NAMES[EVENT_NAMES.length] = 'click';
+ EVENT_NAMES[EVENT_NAMES.length] = 'dblclick';
+ EVENT_NAMES[EVENT_NAMES.length] = 'mousemove';
+ }
+
+ // add the event names for the touch events
+ EVENT_NAMES[EVENT_NAMES.length] = $ax.features.eventNames.mouseDownName;
+ EVENT_NAMES[EVENT_NAMES.length] = $ax.features.eventNames.mouseUpName;
+
+ for(var i = 0; i < EVENT_NAMES.length; i++) {
+ var eventName = EVENT_NAMES[i];
+ //we need the function here to circumvent closure modifying eventName
+ _event[eventName] = (function(event_Name) {
+ return function(elementId, fn) {
+ var elementIdQuery = $jobj(elementId);
+ var type = $ax.getTypeFromElementId(elementId);
+
+ //we need specially track link events so we can enable and disable them along with
+ //their parent widgets
+ if(elementIdQuery.is('a')) _attachCustomObjectEvent(elementId, event_Name, fn);
+ //see notes below
+ else if($ax.IsTreeNodeObject(type)) _attachTreeNodeEvent(elementId, event_Name, fn);
+ else if ($ax.IsImageFocusable(type) && (event_Name == 'focus' || event_Name == 'blur')) {
+ var suitableChild;
+ var imgChild = $ax.repeater.applySuffixToElementId(elementId, '_img');
+ var divChild = $ax.repeater.applySuffixToElementId(elementId, '_div');
+
+ for (var j = 0; j < elementIdQuery[0].children.length; j++) {
+ if (elementIdQuery[0].children[j].id == imgChild) suitableChild = imgChild;
+ if (!suitableChild && elementIdQuery[0].children[j].id == divChild) suitableChild = divChild;
+ }
+ if(!suitableChild) suitableChild = imgChild;
+ _attachDefaultObjectEvent($jobj(suitableChild), elementId, event_Name, fn);
+ } else {
+ var inputId = $ax.INPUT(elementId);
+ var isInput = $jobj(inputId).length != 0;
+ var id = isInput && (event_Name == 'focus' || event_Name == 'blur') ? inputId : elementId;
+ _attachDefaultObjectEvent($jobj(id), elementId, event_Name, fn);
+ }
+ };
+ })(eventName);
+ }
+
+ var AXURE_TO_JQUERY_EVENT_NAMES = {
+ 'onMouseOver': 'mouseenter',
+ 'onMouseOut': 'mouseleave',
+ 'onContextMenu': 'contextmenu',
+ 'onChange': 'change',
+ 'onFocus': 'focus',
+ 'onLostFocus': 'blur'
+ };
+
+ // Tap, double tap, and touch move, or synthetic.
+ if(!$ax.features.supports.mobile) {
+ AXURE_TO_JQUERY_EVENT_NAMES.onClick = 'click';
+ AXURE_TO_JQUERY_EVENT_NAMES.onDoubleClick = 'dblclick';
+ AXURE_TO_JQUERY_EVENT_NAMES.onMouseMove = 'mousemove';
+ }
+
+ AXURE_TO_JQUERY_EVENT_NAMES.onMouseDown = $ax.features.eventNames.mouseDownName;
+ AXURE_TO_JQUERY_EVENT_NAMES.onMouseUp = $ax.features.eventNames.mouseUpName;
+ //for dp, if mouse entered without leaving, don't fire mouse enter again
+ var mouseEnterGuard = {};
+ var _attachEvents = function (diagramObject, elementId, doMouseEnterGuard) {
+
+ var inputId = $ax.repeater.applySuffixToElementId(elementId, '_input');
+ var id = $jobj(inputId).length ? inputId : elementId;
+
+ for(var eventName in diagramObject.interactionMap) {
+ var jQueryEventName = AXURE_TO_JQUERY_EVENT_NAMES[eventName];
+ if(!jQueryEventName) continue;
+
+ _event[jQueryEventName](id,
+ //this is needed to escape closure
+ (function(axEventObject) {
+ return function (e) {
+ if(e.type == 'mouseenter' && doMouseEnterGuard) {
+ if(mouseEnterGuard[elementId]) return;
+ else mouseEnterGuard[elementId] = true;
+ }
+
+ $ax.setjBrowserEvent(e);
+ // console.log(axEventObject.description);
+ var eventInfo = $ax.getEventInfoFromEvent($ax.getjBrowserEvent(), false, elementId);
+ _handleEvent(elementId, eventInfo, axEventObject);
+ };
+ })(diagramObject.interactionMap[eventName])
+ );
+
+ if(jQueryEventName.toLowerCase() == 'mouseenter' && doMouseEnterGuard) {
+ $jobj(elementId).on('mouseleave touchend', function() {
+ mouseEnterGuard[elementId] = false;
+ });
+ }
+ }
+
+ };
+
+ var _descriptionToKey = { 'OnFocus': 'onFocus', 'OnLostFocus': 'onLostFocus' };
+ var _createProxies = function(diagramObject, elementId) {
+ var createFocus = _needsProxy(diagramObject, elementId, 'onFocus');
+ var createLostFocus = _needsProxy(diagramObject, elementId, 'onLostFocus');
+
+ if(!createFocus && !createLostFocus) return;
+
+ if(!diagramObject.interactionMap) diagramObject.interactionMap = {};
+ if(createFocus) diagramObject.interactionMap.onFocus = { proxy: true, description: 'OnFocus' };
+ if(createLostFocus) diagramObject.interactionMap.onLostFocus = { proxy: true, description: 'OnLostFocus' };
+ }
+
+ var preventDefaultEvents = ['OnContextMenu', 'OnKeyUp', 'OnKeyDown', 'OnPageContextMenu', 'OnPageKeyUp', 'OnPageKeyDown'];
+ var allowBubble = ['OnFocus', 'OnResize', 'OnMouseOut', 'OnMouseOver'];
+
+ var _canClick = true;
+ var _startScroll = [];
+ var _setCanClick = function(canClick) {
+ _canClick = canClick;
+ if(_canClick) _startScroll = [$(window).scrollLeft(), $(window).scrollTop()];
+ };
+
+ var _getCanClick = function() {
+ var endScroll = [$(window).scrollLeft(), $(window).scrollTop()];
+ return _canClick && _startScroll[0] == endScroll[0] && _startScroll[1] == endScroll[1];
+ };
+
+ //var _notAllowedInvisible = function (type) {
+ // $ax.getTypeFromElementId(elementId);
+
+ // return !$ax.public.fn.IsReferenceDiagramObject(type) && !$ax.public.fn.IsLayer(type);
+ //}
+
+
+ var _notAllowedInvisible = function (id) {
+ var type = $ax.getTypeFromElementId(id);
+ if ($ax.public.fn.IsReferenceDiagramObject(type) || $ax.public.fn.IsLayer(type)) return false;
+ return !($ax.public.fn.IsVector(type) && _hasCompoundImage(id));
+ }
+
+ var _hasCompoundImage = function (id) {
+ var query = $jobj(id);
+ return $ax.public.fn.isCompoundVectorHtml(query[0]);
+ }
+
+ var _suppressedEvents = {}; // Suppressed for next occurance.
+ var _blockedEvents = {}; // Blocked until unblocked.
+ _event.addSuppressedEvent = function(id, event) {
+ if(!_suppressedEvents[id]) _suppressedEvents[id] = [];
+ var events = _suppressedEvents[id];
+ if(events.indexOf(event) != -1) return;
+ events.push(event);
+ }
+
+ _event.blockEvent = function(id, event) {
+ if(!_blockedEvents[id]) _blockedEvents[id] = {};
+ var events = _blockedEvents[id];
+ if(events[event]) ++events[event];
+ else events[event] = 1;
+ return function() { _unblockEvent(id, event); };
+ }
+
+ var _isSuppressedEvent = function(id, event) {
+ var suppressedEvents = _suppressedEvents[id];
+ var blockedEvents = _blockedEvents[id];
+ return (suppressedEvents && suppressedEvents.indexOf(event) != -1) || (blockedEvents && blockedEvents[event]);
+ }
+
+ var _removeSuppressedEvent = function(id, event) {
+ var events = _suppressedEvents[id];
+ if(!events) return;
+ if(events.length == 1) {
+ delete _suppressedEvents[id];
+ } else {
+ var eventIndex = events.indexOf(event);
+ for(var i = eventIndex + 1; i < events.length; i++) events[i - 1] = events[i];
+ events.pop();
+ }
+ }
+ var _unblockEvent = function(id, event) {
+ var events = _blockedEvents[id];
+ if(events) {
+ if(--events[event] > 0) return;
+ }
+ _removeSuppressedEvent(id, event);
+ }
+
+ var _unblockEvent = function(id, event) {
+ var events = _blockedEvents[id];
+ if(events) {
+ if(--events[event] > 0) return;
+ }
+ _removeSuppressedEvent(id, event);
+ }
+
+ var eventNesting = 0;
+ var eventNestingTime = new Date().getTime();
+
+ var _handleEvent = $ax.event.handleEvent = function (elementId, eventInfo, axEventObject, skipShowDescriptions, synthetic) {
+ var eventDescription = axEventObject.description;
+ if(_enteredWidgets[elementId] && eventDescription == 'OnMouseEnter') return; // Suppress entering a widget when already in widget (ie only)
+ if(_isSuppressedEvent(elementId, eventDescription)) {
+ _removeSuppressedEvent(elementId, eventDescription);
+ return;
+ }
+
+ if(axEventObject.proxy) {
+ var firingId = _widgetToFocusParent[elementId];
+ if(firingId) {
+ var firingObj = $obj(firingId);
+ var nextEventObj = firingObj.interactionMap && firingObj.interactionMap[_descriptionToKey[eventDescription]];
+ if(!nextEventObj) nextEventObj = axEventObject;
+ _handleEvent(firingId, eventInfo, nextEventObj, skipShowDescriptions, synthetic);
+ }
+ return;
+ }
+// var x = JSON.stringify(eventInfo);
+// var y = JSON.stringify(axEventObject);
+
+ var fireTime = new Date().getTime();
+
+ if(fireTime - eventNestingTime > 100) {
+ eventNestingTime = fireTime;
+ eventNesting = 0;
+ }
+
+ if(eventNesting === 0) {
+ $ax.recording.maybeRecordEvent(elementId, eventInfo, axEventObject, fireTime);
+ }
+
+ eventNesting += 1;
+
+ if (!synthetic && !_getCanClick() && (eventDescription == 'OnClick' || eventDescription == 'OnPageClick')) return;
+ // If you are supposed to suppress, do that right away.
+ if(suppressedEventStatus[eventDescription]) {
+ return;
+ }
+
+ var currentEvent = $ax.getjBrowserEvent();
+ if(!synthetic && currentEvent && currentEvent.originalEvent && currentEvent.originalEvent.handled && !eventInfo.isMasterEvent) return;
+ if(!synthetic && elementId && !$ax.style.getObjVisible(elementId) && _notAllowedInvisible(elementId)) return;
+
+ //if debug
+ var axObj = $obj(elementId);
+ var axObjLabel = axObj ? axObj.label : eventInfo.label;
+ var axObjType = axObj ? axObj.friendlyType : eventInfo.friendlyType;
+ if (!skipShowDescriptions || eventDescription == 'OnPageLoad') postMessage('axEvent', { 'label': axObjLabel, 'type': axObjType, 'event': axEventObject });
+
+ var bubble = true;
+ var showCaseDescriptions = !skipShowDescriptions && _shouldShowCaseDescriptions(axEventObject);
+ if(!showCaseDescriptions) {
+ //handle case descriptions
+ var caseGroups = [];
+ var currentCaseGroup = [];
+ caseGroups[0] = currentCaseGroup;
+
+ // Those refreshes not after a wait
+ var guaranteedRefreshes = {};
+
+ var caseGroupIndex = 0;
+ for(var i = 0; i < axEventObject.cases.length; i++) {
+ var currentCase = axEventObject.cases[i];
+ if(currentCase.isNewIfGroup && i != 0) {
+ caseGroupIndex++;
+ currentCaseGroup = [];
+ caseGroups[caseGroups.length] = currentCaseGroup;
+ // Joon: Isn't caseGroups.length always equal to caseGroupIndex?
+ }
+ currentCaseGroup[currentCaseGroup.length] = currentCase;
+
+ for(var j = 0; j < currentCase.actions.length; j++) {
+ var action = currentCase.actions[j];
+ if(action.action == 'wait') break;
+ if(action.action != 'refreshRepeater') continue;
+ for(var k = 0; k < action.repeatersToRefresh.length; k++) {
+ var id = $ax.getElementIdsFromPath(action.repeatersToRefresh[k], eventInfo)[0];
+ if(id) guaranteedRefreshes[id] = caseGroupIndex;
+ }
+ }
+ }
+
+ for(var i = 0; i < caseGroups.length; i++) {
+ var groupRefreshes = [];
+ for(var key in guaranteedRefreshes) {
+ if(guaranteedRefreshes[key] == i) groupRefreshes[groupRefreshes.length] = key;
+ }
+ bubble = _handleCaseGroup(eventInfo, caseGroups[i], groupRefreshes) && bubble;
+ }
+ } else {
+ _showCaseDescriptions(elementId, eventInfo, axEventObject, synthetic);
+ bubble = false;
+ }
+
+ // If not handled, synthetically bubble if you can
+ if(bubble && _widgetToFocusParent[elementId]) {
+ firingId = _widgetToFocusParent[elementId];
+ if(firingId) {
+ firingObj = $obj(firingId);
+ nextEventObj = firingObj.interactionMap && firingObj.interactionMap[_descriptionToKey[axEventObject.description]];
+ if(!nextEventObj) nextEventObj = axEventObject;
+ _handleEvent(firingId, eventInfo, nextEventObj, skipShowDescriptions, synthetic);
+ }
+ return;
+ }
+
+ // Only trigger a supression if it handled this event
+ if(!bubble && suppressingEvents[eventDescription]) {
+ suppressedEventStatus[suppressingEvents[eventDescription]] = true;
+ }
+
+ $ax.action.flushAllResizeMoveActions(eventInfo);
+
+ // This should not be needed anymore. All refreshes should be inserted, or handled earlier.
+ var repeaters = $ax.deepCopy($ax.action.repeatersToRefresh);
+ while($ax.action.repeatersToRefresh.length) $ax.action.repeatersToRefresh.pop();
+ for(i = 0; i < repeaters.length; i++) $ax.repeater.refreshRepeater(repeaters[i], eventInfo);
+
+ if(currentEvent && currentEvent.originalEvent) {
+ currentEvent.originalEvent.handled = !synthetic && !bubble && allowBubble.indexOf(eventDescription) == -1;
+ //currentEvent.originalEvent.donotdrag = currentEvent.donotdrag || (!bubble && eventDescription == 'OnMouseDown');
+
+ // Prevent default if necessary
+ if(currentEvent.originalEvent.handled && preventDefaultEvents.indexOf(eventDescription) != -1) {
+ currentEvent.preventDefault();
+ }
+ }
+
+ eventNesting -= 1;
+
+ if(!showCaseDescriptions) postMessage('axEventComplete');
+
+ };
+
+ var _handleScrollEvent = function (elementId, eventInfo, originalEvent, scrolledUp, scrolledDown, interactionMap, skipShowDescription, synthetic) {
+ if (!interactionMap) return;
+ if (interactionMap.onScroll) _handleEvent(elementId, eventInfo, interactionMap.onScroll, skipShowDescription, synthetic);
+
+ var wasHandled = originalEvent.handled;
+ if (interactionMap.onScrollUp && scrolledUp) {
+ originalEvent.handled = false;
+ _handleEvent(elementId, eventInfo, interactionMap.onScrollUp, skipShowDescription, synthetic);
+ } else if (interactionMap.onScrollDown && scrolledDown) {
+ originalEvent.handled = false;
+ _handleEvent(elementId, eventInfo, interactionMap.onScrollDown, skipShowDescription, synthetic);
+ }
+ originalEvent.handled |= wasHandled;
+ }
+
+ var _showCaseDescriptions = function(elementId, eventInfo, axEventObject, synthetic) {
+
+ if(axEventObject.cases.length == 0) return true;
+
+ var linksId = elementId + "linkBox";
+ $('#' + linksId).remove();
+
+ var $container = $("
");
+
+ if(!_isEventSimulating(axEventObject)) {
+ var copy = $ax.eventCopy(eventInfo);
+ for(var i = 0; i < axEventObject.cases.length; i++) {
+ var $link = $("" + axEventObject.cases[i].description + "
");
+ $link.click(function(j) {
+ return function () {
+ var currentCase = axEventObject.cases[j];
+ postMessage('axCase', { 'item': currentCase.description, 'description': currentCase.conditionString, 'color': currentCase.caseColorHex })
+ for(var k = 0; k < currentCase.actions.length; k++) {
+ var currentAction = currentCase.actions[k];
+
+ // Only use action's direct description if no action info descriptions exist
+ postMessage('axAction', { 'name': currentAction.displayName });
+ //postMessage('axAction', { 'item': currentAction.description, 'description': (Object.keys(currentAction.actionInfoDescriptions).length > 0 ? "" : currentAction.description) });
+
+ for (var target in currentAction.actionInfoDescriptions) {
+ var infoDescriptions = currentAction.actionInfoDescriptions[target];
+ for (var shortDescription in infoDescriptions) {
+ postMessage('axInfo', { 'item': target, 'description': shortDescription, 'longDescription': infoDescriptions[shortDescription] });
+ }
+ }
+ }
+ postMessage('axEventComplete');
+
+ var bubble = $ax.action.dispatchAction(copy, axEventObject.cases[j].actions);
+ $ax.action.flushAllResizeMoveActions(copy);
+ $('#' + linksId).remove();
+ return bubble;
+ };
+ } (i)
+ );
+
+ $container.append($link);
+ }
+ } else {
+ var fullDescription = axEventObject.description + ": ";
+ for(var i = 0; i < axEventObject.cases.length; i++) {
+ var currentCase = axEventObject.cases[i];
+ fullDescription += " " + currentCase.description.replace(/ /g, ' ') + ": ";
+ for(var j = 0; j < currentCase.actions.length; j++) {
+ fullDescription += " " + currentCase.actions[j].description.replace(/ /g, ' ') + " ";
+ }
+ }
+ fullDescription = fullDescription.substring(0, fullDescription.length - 4);
+
+ var $link = $("" + fullDescription + "
");
+ $link.click(function() {
+ _handleEvent(elementId, eventInfo, axEventObject, true, synthetic);
+ postMessage('axEventComplete');
+ $('#' + linksId).remove();
+ return;
+ });
+ $container.append($link);
+ }
+ $container.mouseleave(function(e) { $ax.legacy.SuppressBubble(e); });
+ $('body').append($container);
+ _showCaseLinks(eventInfo, linksId);
+ };
+
+ var _showCaseLinks = function(eventInfo, linksId) {
+ var links = window.document.getElementById(linksId);
+
+ links.style.top = eventInfo.pageY;
+
+ var left = eventInfo.pageX;
+ links.style.left = left;
+ $ax.visibility.SetVisible(links, true);
+ $ax.legacy.BringToFront(linksId, true);
+ // Switch to using jquery if this is still needed. Really old legacy code, likely for a browser no longer supported.
+ //$ax.legacy.RefreshScreen();
+ };
+
+
+ var _shouldShowCaseDescriptions = function(axEventObject) {
+ if($ax.document.configuration.linkStyle == "alwaysDisplayTargets") return true;
+ if($ax.document.configuration.linkStyle == "neverDisplayTargets") return false;
+ if(axEventObject.cases.length == 0) return false;
+ if(_isEventSimulating(axEventObject)) return false;
+ if(axEventObject.cases.length >= 2) return true;
+ return false;
+ };
+
+ var _isEventSimulating = function(axEventObject) {
+ for(var i = 0; i < axEventObject.cases.length; i++) {
+ if(axEventObject.cases[i].condition) return true;
+ }
+ return false;
+ };
+
+ var _handleCaseGroup = function(eventInfo, caseGroup, groupRefreshes) {
+ for(var i = 0; i < caseGroup.length; i++) {
+ var currentCase = caseGroup[i];
+ if(!currentCase.condition || _processCondition(currentCase.condition, eventInfo)) {
+ postMessage('axCase', { 'item': currentCase.description, 'description': currentCase.conditionString, 'color': currentCase.caseColorHex })
+
+ for(var j = 0; j < currentCase.actions.length; j++) {
+ var currentAction = currentCase.actions[j];
+ if (currentAction.action != 'refreshRepeater') {
+ // Only use action's direct description if no action info descriptions exist
+ postMessage('axAction', { 'name': currentAction.displayName });
+ //postMessage('axAction', { 'item': currentAction.description, 'description': (Object.keys(currentAction.actionInfoDescriptions).length > 0 ? "" : currentAction.description) });
+
+ for (var target in currentAction.actionInfoDescriptions) {
+ var infoDescriptions = currentAction.actionInfoDescriptions[target];
+ for (var shortDescription in infoDescriptions) {
+ postMessage('axInfo', { 'item': target, 'description': shortDescription, 'longDescription': infoDescriptions[shortDescription] });
+ }
+ }
+ }
+ }
+
+ for(var j = 0; j < currentCase.actions.length; j++) {
+ var action = currentCase.actions[j];
+ if(action.action == 'wait') break;
+ if(action.action != 'refreshRepeater') continue;
+ for(var k = 0; k < action.repeatersToRefresh.length; k++) {
+ var id = $ax.getElementIdsFromPath(action.repeatersToRefresh[i], eventInfo)[i];
+ if(id) {
+ var index = groupRefreshes.indexOf(id);
+ if(index != -1) $ax.splice(groupRefreshes, index);
+ }
+ }
+ }
+
+ // Any guaranteed refreshes that aren't accounted for must be run still.
+ $ax.action.tryRefreshRepeaters(groupRefreshes, eventInfo);
+
+ $ax.action.dispatchAction(eventInfo, currentCase.actions);
+ return false;
+ }
+ }
+
+ // Any guaranteed refreshes that aren't accounted for must be run still.
+ $ax.action.tryRefreshRepeaters(groupRefreshes, eventInfo);
+ return true;
+ };
+
+ var _processCondition = function(expr, eventInfo) {
+ return $ax.expr.evaluateExpr(expr, eventInfo);
+ };
+
+ var _attachTreeNodeEvent = function(elementId, eventName, fn) {
+ //we need to set the cursor here because we want to make sure that every tree node has the default
+ //cursor set and then it's overridden if it has a click
+ if(eventName == 'click') window.document.getElementById(elementId).style.cursor = 'pointer';
+
+ _attachCustomObjectEvent(elementId, eventName, fn);
+ };
+
+ var _attachDefaultObjectEvent = function(elementIdQuery, elementId, eventName, fn) {
+ var func = function() {
+ if(!$ax.style.IsWidgetDisabled(elementId)) return fn.apply(this, arguments);
+ return true;
+ };
+
+ var bind = !elementIdQuery[eventName];
+ if(bind) elementIdQuery.bind(eventName, func);
+ else elementIdQuery[eventName](func);
+ };
+
+ var _attachCustomObjectEvent = function(elementId, eventName, fn) {
+ var handlers = _objectIdToEventHandlers[elementId];
+ if(!handlers) _objectIdToEventHandlers[elementId] = handlers = {};
+
+ var fnList = handlers[eventName];
+ if(!fnList) handlers[eventName] = fnList = [];
+
+ fnList[fnList.length] = fn;
+ };
+
+ var _fireObjectEvent = function(elementId, event, originalArgs) {
+ var element = window.document.getElementById(elementId);
+
+ var handlerList = _objectIdToEventHandlers[elementId] && _objectIdToEventHandlers[elementId][event];
+ if(handlerList) {
+ for(var i = 0; i < handlerList.length; i++) handlerList[i].apply(element, originalArgs);
+ }
+
+ eventNesting -= 1;
+
+ };
+
+ var _layerToFocusableWidget = {};
+ var _widgetToFocusParent = {};
+ _event.layerMapFocus = function(layer, elementId) {
+ var mainObj = layer.objs[0];
+ // If first child non existant return
+ if (!mainObj) return;
+
+ var mainId = $ax.getElementIdFromPath([mainObj.id], { relativeTo: elementId });
+ _widgetToFocusParent[mainId] = elementId;
+
+ // If first child is a layer, call recursively
+ if ($ax.public.fn.IsLayer(mainObj.type)) {
+ _event.layerMapFocus(mainObj, mainId);
+ var baseId = _layerToFocusableWidget[mainId];
+ if(baseId) _layerToFocusableWidget[elementId] = baseId;
+ return;
+ }
+
+ _layerToFocusableWidget[elementId] = mainId;
+ }
+
+ var _needsProxy = function(obj, id, proxyName) {
+ // layers don't need on focus ever, proxies will handle them
+ if ($ax.public.fn.IsLayer(obj.type)) return false;
+ // If you already focus you don't need to force yourself to proxy.
+ if(obj.interactionMap && obj.interactionMap[proxyName]) return false;
+
+ var parentId = _widgetToFocusParent[id];
+ if(parentId) return _needsProxyHelper(parentId, proxyName);
+ return false;
+ }
+
+ var _needsProxyHelper = function(id, proxyName) {
+ var obj = $obj(id);
+ if(obj.interactionMap && obj.interactionMap[proxyName]) return true;
+
+ var parentId = _widgetToFocusParent[id];
+ if(parentId) return _needsProxyHelper(parentId, proxyName);
+ return false;
+ }
+
+ //for button shapes and images the img is focusable instead of the div to get better outlines
+ // For layers, we remember who their proxy is.
+ $ax.event.getFocusableWidgetOrChildId = function (elementId) {
+ var mappedId = _layerToFocusableWidget[elementId];
+ if (mappedId) elementId = mappedId;
+
+ var inputId = $ax.repeater.applySuffixToElementId(elementId, '_input');
+ var inputQuery = $jobj(inputId);
+ if(inputQuery.length > 0) return inputId;
+
+ var imgId = $ax.repeater.applySuffixToElementId(elementId, '_img');
+ var imgQuery = $jobj(imgId);
+ if (imgQuery.length > 0) return imgId;
+
+ var divId = $ax.repeater.applySuffixToElementId(elementId, '_div');
+ var divQuery = $jobj(divId);
+ if (divQuery.length > 0) return divId;
+
+ return elementId;
+ };
+
+ var _enteredWidgets = {};
+
+ // key is the suppressing event, and the value is the event that is supressed
+ var suppressingEvents = {};
+ // key is the event that will cancel the suppression, and value is the event that was being suppressed
+ var cancelSuppressions = {};
+ // suppressed event maps to true if it is supressed
+ var suppressedEventStatus = {};
+
+ var initSuppressingEvents = function () {
+ suppressingEvents['OnLongClick'] = 'OnClick';
+ cancelSuppressions['onMouseDown'] = 'OnClick';
+
+ // Have to cancel suppressed event here. Only works for non-synthetic events currently
+ for(var key in cancelSuppressions) {
+ var jEventName = AXURE_TO_JQUERY_EVENT_NAMES[key];
+ if(!jEventName) continue;
+ $('body').bind(jEventName, function () {
+ suppressedEventStatus[cancelSuppressions[key]] = false;
+ });
+ }
+ };
+
+ // TODO: It may be a good idea to split this into multiple functions, or at least pull out more similar functions into private methods
+ var _initializeObjectEvents = function(query, refreshType) {
+ query.each(function (dObj, elementId) {
+ if (dObj == null) return; // TODO: Update expo items that pass here to potentially remove this logic
+ var $element = $jobj(elementId);
+ var itemId = $ax.repeater.getItemIdFromElementId(elementId);
+
+ // Focus has to be done before on focus fires
+ // Set up focus
+ if ($ax.public.fn.IsTextArea(dObj.type) || $ax.public.fn.IsTextBox(dObj.type) || $ax.public.fn.IsCheckBox(dObj.type) || $ax.public.fn.IsRadioButton(dObj.type) ||
+ $ax.public.fn.IsListBox(dObj.type) || $ax.public.fn.IsComboBox(dObj.type) || $ax.public.fn.IsButton(dObj.type) ||
+ (dObj.tabbable && ($ax.public.fn.IsImageBox(dObj.type) || $ax.public.fn.IsVector(dObj.type) || $ax.IsTreeNodeObject(dObj.type) || $ax.public.fn.IsTableCell(dObj.type)))) {
+ var focusObj = $jobj($ax.event.getFocusableWidgetOrChildId(elementId));
+ focusObj.focus(function() {
+ window.lastFocusedControl = elementId;
+ $ax.style.SetWidgetFocused(elementId, true);
+ });
+ focusObj.blur(function() {
+ $ax.style.SetWidgetFocused(elementId, false);
+ });
+ }
+ // [MAS: Supressing events were here]
+ _createProxies(dObj, elementId);
+ var isDynamicPanel = $ax.public.fn.IsDynamicPanel(dObj.type);
+ if(dObj.interactionMap) {
+ _attachEvents(dObj, elementId, isDynamicPanel);
+ };
+
+
+
+ if (IE || $axure.browser.isEdge) {
+ $element.mouseenter(function() {
+ _enteredWidgets[elementId] = true;
+ }).mouseleave(function() {
+ _enteredWidgets[elementId] = false;
+ });
+ }
+
+ _attachIxStyleEvents(dObj, elementId, $element);
+
+ var $axElement = $ax('#' + elementId);
+ // Base case is set up selected disabled based on the default in the axobj, for non, repeaters and resetting repeaters
+ var itemReset = refreshType == $ax.repeater.refreshType.reset;
+ if(!itemId || itemReset) {
+ //initialize disabled elements, do this first before selected, cause if a widget is disabled, we don't want to apply selected style anymore
+ if ($ax.public.fn.IsVector(dObj.type) || $ax.public.fn.IsImageBox(dObj.type) || isDynamicPanel || $ax.public.fn.IsLayer(dObj.type)
+ || $ax.public.fn.IsTextBox(dObj.type) || $ax.public.fn.IsTextArea(dObj.type) || $ax.public.fn.IsComboBox(dObj.type) || $ax.public.fn.IsListBox(dObj.type)
+ || $ax.public.fn.IsCheckBox(dObj.type) || $ax.public.fn.IsRadioButton(dObj.type)) {
+
+ if (dObj.disabled) $axElement.enabled(false);
+
+ // Initialize selected elements
+ if(dObj.selected) $axElement.selected(true);
+ }
+ } else if(refreshType == $ax.repeater.refreshType.preEval) {
+ // Otherwise everything should be set up correctly by pre-eval, want to set up selected disabled dictionaries (and disabled status)
+ // Disabled layer/dynamic panel don't have the disabled class, but they do have the disabled attr written out, so use that in that case
+ if ($element.hasClass('disabled') ||
+ (($ax.IsLayer(dObj.type) || $ax.IsDynamicPanel(dObj.type)) && $element.attr('disabled'))) $axElement.enabled(false);
+ if($element.hasClass('selected')) $axElement.selected(true);
+ } else {
+ // Persist means we want to leave it as is, but we want to make sure we use selected based off of the backing data, and not some class that exists because of the reset
+ $element.removeClass('selected');
+ }
+
+ //if(OS_MAC && WEBKIT) {
+ // if ($ax.public.fn.IsComboBox(dObj.type) && dObj.disabled) {
+ // $jobj($ax.INPUT(elementId)).css('color', 'grayText');
+ // }
+ //};
+
+ // Initialize Placeholders. Right now this is text boxes and text areas.
+ // Also, the assuption is being made that these widgets with the placeholder, have no other styles (this may change...)
+ var hasPlaceholder = dObj.placeholderText == '' ? true : Boolean(dObj.placeholderText);
+ if(($ax.public.fn.IsTextArea(dObj.type) || $ax.public.fn.IsTextBox(dObj.type)) && hasPlaceholder) {
+ // This is needed to initialize the placeholder state
+ var inputJobj = $jobj($ax.INPUT(elementId));
+ inputJobj.bind('focus', function () {
+ if(dObj.HideHintOnFocused) {
+ var id = this.id;
+ var inputIndex = id.indexOf('_input');
+ if (inputIndex == -1) return;
+ var inputId = id.substring(0, inputIndex);
+
+ if (!$ax.placeholderManager.isActive(inputId)) return;
+ $ax.placeholderManager.updatePlaceholder(inputId, false, true);
+ }
+ $ax.placeholderManager.moveCaret(this.id);
+ }).bind('mouseup', function() {
+ $ax.placeholderManager.moveCaret(this.id);
+ }).bind('blur', function() {
+ var id = this.id;
+ var inputIndex = id.indexOf('_input');
+ if(inputIndex == -1) return;
+ var inputId = id.substring(0, inputIndex);
+
+ if($jobj(id).val()) return;
+ $ax.placeholderManager.updatePlaceholder(inputId, true);
+ });
+
+ if(ANDROID) {
+ //input fires before keyup, to avoid flicker, supported in ie9 and above
+ inputJobj.bind('input', function() {
+ if(!dObj.HideHintOnFocused) { //hide on type
+ var id = this.id;
+ var inputIndex = id.indexOf('_input');
+ if(inputIndex == -1) return;
+ var inputId = id.substring(0, inputIndex);
+
+ if($ax.placeholderManager.isActive(inputId)) {
+ $ax.placeholderManager.updatePlaceholder(inputId, false, true);
+ } else if(!$jobj(id).val()) {
+ $ax.placeholderManager.updatePlaceholder(inputId, true, false);
+ $ax.placeholderManager.moveCaret(id, 0);
+ }
+ }
+ });
+ } else {
+ inputJobj.bind('keydown', function() {
+ if(!dObj.HideHintOnFocused) {
+ var id = this.id;
+ var inputIndex = id.indexOf('_input');
+ if(inputIndex == -1) return;
+ var inputId = id.substring(0, inputIndex);
+
+ if(!$ax.placeholderManager.isActive(inputId)) return;
+ $ax.placeholderManager.updatePlaceholder(inputId, false, true);
+ }
+ }).bind('keyup', function(e) {
+ var id = this.id;
+ var inputIndex = id.indexOf('_input');
+ if(inputIndex == -1) return;
+ var inputId = id.substring(0, inputIndex);
+
+ if($ax.placeholderManager.isActive(inputId)) return;
+ if(!dObj.HideHintOnFocused && !$jobj(id).val()) {
+ $ax.placeholderManager.updatePlaceholder(inputId, true);
+ $ax.placeholderManager.moveCaret(id, 0);
+ }
+
+ //prevents triggering player shortcuts
+ e.preventDefault();
+ });
+ }
+
+ $ax.placeholderManager.registerPlaceholder(elementId, dObj.placeholderText, inputJobj.attr('type') == 'password');
+ $ax.placeholderManager.updatePlaceholder(elementId, !($jobj($ax.repeater.applySuffixToElementId(elementId, '_input')).val()));
+ }
+
+ // Initialize assigned submit buttons
+ if(dObj.submitButton) {
+ $element.keyup(function(e) {
+ if(e.keyCode == '13') {
+ var scriptId = $ax.repeater.getScriptIdFromElementId(elementId);
+ var path = $ax.deepCopy(dObj.submitButton.path);
+ path[path.length] = dObj.submitButton.id;
+ var itemNum = $ax.repeater.getItemIdFromElementId(elementId);
+ var submitId = $ax.getScriptIdFromPath(path, scriptId);
+
+ if(itemNum && $ax.getParentRepeaterFromScriptId(submitId) == $ax.getParentRepeaterFromScriptId(scriptId)) {
+ submitId = $ax.repeater.createElementId(submitId, itemNum);
+ }
+ var inputId = $ax.INPUT(submitId);
+ if($jobj(inputId).length) submitId = inputId;
+
+ $ax.setjBrowserEvent(e);
+ $ax.event.fireClick(submitId);
+ }
+ }).keydown(function(e) {
+ if(e.keyCode == '13') {
+ e.preventDefault();
+ }
+ });
+ }
+
+ // Don't drag after mousing down on a plain text object
+ if ($ax.public.fn.IsTextArea(dObj.type) || $ax.public.fn.IsTextBox(dObj.type) || $ax.public.fn.IsListBox(dObj.type) ||
+ $ax.public.fn.IsComboBox(dObj.type) || $ax.public.fn.IsCheckBox(dObj.type) || $ax.public.fn.IsRadioButton(dObj.type)) {
+ $element.bind($ax.features.eventNames.mouseDownName, function(event) {
+ event.originalEvent.donotdrag = true;
+ });
+ }
+
+ $element.bind($ax.features.eventNames.mouseDownName, function() { _setCanClick(true); });
+ if (isDynamicPanel) {
+ $element.children().scroll(function () { _setCanClick(false); });
+ }
+
+ //initialize tree node cursors to default so they will override their parent
+ if ($ax.public.fn.IsTreeNodeObject(dObj.type) && !(dObj.interactionMap && dObj.interactionMap.onClick)) {
+ $element.css('cursor', 'default');
+ }
+
+ //initialize widgets that are clickable to have the pointer over them when hovering
+ if($ax.event.HasClick(dObj)) {
+ if($element) $element.css('cursor', 'pointer');
+ }
+
+ // TODO: not sure if we need this. It appears to be working without
+ //initialize panels for DynamicPanels
+ if (isDynamicPanel) {
+ $element.children().each(function() {
+ var parts = this.id.split('_');
+ var state = parts[parts.length - 1].substring(5);
+ if(state != 0) $ax.visibility.SetVisible(this, false);
+ });
+ }
+
+ //initialize TreeNodes
+ if ($ax.public.fn.IsTreeNodeObject(dObj.type)) {
+ if($element.hasClass('treeroot')) return;
+
+ var childrenId = elementId + '_children';
+ var children = $element.children('[id="' + childrenId + '"]:first');
+ if(children.length > 0) {
+ var plusMinusId = 'u' + (parseInt($ax.repeater.getScriptIdFromElementId(elementId).substring(1)) + 1);
+ if(itemId) plusMinusId = $ax.repeater.createElementId(plusMinusId, itemId);
+ if(!$jobj(plusMinusId).children().first().is('img')) plusMinusId = '';
+ $ax.tree.InitializeTreeNode(elementId, plusMinusId, childrenId);
+ }
+ $element.click(function() { $ax.tree.SelectTreeNode(elementId, true); });
+ }
+
+ //initialize submenus
+ if ($ax.public.fn.IsMenuObject(dObj.type)) {
+ if($element.hasClass('sub_menu')) {
+ var tableCellElementId = $ax.getElementIdFromPath([dObj.parentCellId], { relativeTo: elementId });
+ $ax.menu.InitializeSubmenu(elementId, tableCellElementId);
+ }
+ }
+
+ // Attach handles for dynamic panels that propagate styles to inner items.
+ if ((isDynamicPanel || $ax.public.fn.IsLayer(dObj.type)) && dObj.propagate) {
+ $element.mouseenter(function() {
+ dynamicPanelMouseOver(this.id);
+ }).mouseleave(function() {
+ dynamicPanelMouseLeave(this.id);
+ }).bind($ax.features.eventNames.mouseDownName, function() {
+ dynamicPanelMouseDown(this.id);
+ }).bind($ax.features.eventNames.mouseUpName, function() {
+ dynamicPanelMouseUp(this.id);
+ });
+ }
+
+ // These are the dynamic panel functions for propagating rollover styles and mouse down styles to inner objects
+ var dynamicPanelMouseOver = function(elementId, fromChild) {
+ var parent = $ax.dynamicPanelManager.parentHandlesStyles(elementId);
+ if(parent) {
+ dynamicPanelMouseOver(parent.id, true);
+ if(parent.direct) return;
+ }
+ if($.inArray(elementId, _event.mouseOverIds) != -1) return;
+ // If this event is coming from a child, don't mark that it's actually entered.
+ // Only mark that this has been entered if this event has naturally been triggered. (For reason see mouseleave)
+ if(!fromChild) _event.mouseOverIds[_event.mouseOverIds.length] = elementId;
+ if(elementId == _event.mouseOverObjectId) return;
+ _event.mouseOverObjectId = elementId;
+ $ax.dynamicPanelManager.propagateMouseOver(elementId, true);
+ };
+ var dynamicPanelMouseLeave = function(elementId, fromChild) {
+ var parent = $ax.dynamicPanelManager.parentHandlesStyles(elementId);
+ if(parent) {
+ dynamicPanelMouseLeave(parent.id, true);
+ if(parent.direct) return;
+ }
+ var index = $.inArray(elementId, _event.mouseOverIds);
+ // If index != -1, this has been natuarally entered. If naturally entered, then leaving child should not trigger leaving,
+ // but instead wait for natural mouse leave. If natural mouse enter never triggered, natural mouse leave won't so do this now.
+ if((index != -1) && fromChild) return;
+ $ax.splice(_event.mouseOverIds, index, 1);
+
+ if(elementId == _event.mouseOverObjectId) {
+ _event.mouseOverObjectId = '';
+ }
+ $ax.dynamicPanelManager.propagateMouseOver(elementId, false);
+ };
+
+ //attach handlers for button shape and tree node mouse over styles
+ // TODO: Can this really be removed? Trees seem to work with out (the generic hover case works for it).
+ // query.filter(function(obj) {
+ // return $ax.public.fn.IsVector(obj.type) && $ax.public.fn.IsTreeNodeObject(obj.parent.type) &&
+ // obj.parent.style && obj.parent.style.stateStyles &&
+ // obj.parent.style.stateStyles.mouseOver;
+ // }).mouseenter(function() {
+ // $ax.style.SetWidgetHover(this.id, true);
+ // }).mouseleave(function() {
+ // $ax.style.SetWidgetHover(this.id, false);
+ // });
+
+ //handle treeNodeObject events and prevent them from bubbling up. this is necessary because otherwise
+ //both a sub menu and it's parent would get a click
+ if ($ax.public.fn.IsTreeNodeObject(dObj.type)) {
+ $element.click(function() {
+ //todo -- this was bubbling, but then selecting a child tree node would bubble and select the parent (don't know if there is a better way)
+ _fireObjectEvent(this.id, 'click', arguments);
+ return false;
+ }).each(function() {
+ if(!this.style.cursor) {
+ this.style.cursor = 'default';
+ }
+ });
+ }
+
+ // Synthetic events
+
+ var map = dObj.interactionMap;
+ // Attach synthetic drag and swipe events
+ if(map && (map.onDragStart || map.onDrag || map.onDragDrop || map.onSwipeLeft || map.onSwipeRight || map.onSwipeUp || map.onSwipeDown)) {
+ $element.bind($ax.features.eventNames.mouseDownName,
+ function (e) {
+ if (!e.originalEvent.donotdrag) $ax.registerTouchCount(e);
+ $ax.drag.StartDragWidget(e.originalEvent, elementId);
+ });
+ }
+
+ // Attach dynamic panel synthetic scroll event
+ if (isDynamicPanel && map && (map.onScroll || map.onScrollUp || map.onScrollDown)) {
+ var diagrams = dObj.diagrams;
+ for(var i = 0; i < diagrams.length; i++) {
+ var panelId = $ax.repeater.applySuffixToElementId(elementId, '_state' + i);
+ (function(id) {
+ if ($('#' + id).data('lastScrollTop') == undefined) $('#' + id).data('lastScrollTop', '0');
+ _attachDefaultObjectEvent($('#' + id), elementId, 'scroll', function(e) {
+ $ax.setjBrowserEvent(e);
+ var currentEvent = $ax.getjBrowserEvent();
+ var eventInfoFromEvent = $ax.getEventInfoFromEvent(currentEvent, false, elementId);
+
+ var currentTop = $('#' + id).scrollTop();
+ var lastTop = $('#' + id).data('lastScrollTop');
+
+ _handleScrollEvent(elementId, eventInfoFromEvent, currentEvent.originalEvent, currentTop < lastTop, currentTop > lastTop, map);
+ $('#' + id).data('lastScrollTop', currentTop);
+ });
+ })(panelId);
+ }
+ }
+
+ // Attach synthetic hover event
+ if (map && map.onMouseHover) {
+ var MIN_HOVER_HOLD_TIME = 1000;
+
+ // So when the timeout fires, you know whether it is the same mouseenter that is active or not.
+ var hoverMouseCount = 0;
+ // Update eventInfo regularly, so position is accurate.
+ var hoverEventInfo;
+
+ $element.mouseenter(function(e) {
+ $ax.setjBrowserEvent(e);
+ hoverEventInfo = $ax.getEventInfoFromEvent($ax.getjBrowserEvent(), false, elementId);
+ (function(currCount) {
+ window.setTimeout(function() {
+ if(currCount == hoverMouseCount) _raiseSyntheticEvent(elementId, 'onMouseHover', false, hoverEventInfo, true);
+ }, MIN_HOVER_HOLD_TIME);
+ })(hoverMouseCount);
+ }).mouseleave(function(e) {
+ $ax.setjBrowserEvent(e);
+ hoverMouseCount++;
+ }).mousemove(function(e) {
+ $ax.setjBrowserEvent(e);
+ hoverEventInfo = $ax.getEventInfoFromEvent($ax.getjBrowserEvent(), false, elementId);
+ });
+ }
+
+ // Attach synthetic tap and hold event.
+ if (map && map.onLongClick) {
+ var MIN_LONG_CLICK_HOLD_TIME = 750;
+
+ // So when the timeout fires, you know whether it is the same mousedown that is active or not.
+ var longClickMouseCount = 0;
+
+ $element.bind($ax.features.eventNames.mouseDownName, function(e) {
+ (function(currCount) {
+ $ax.setjBrowserEvent(e);
+ var eventInfo = $ax.getEventInfoFromEvent($ax.getjBrowserEvent(), false, elementId);
+ window.setTimeout(function() {
+ if(currCount == longClickMouseCount) _raiseSyntheticEvent(elementId, 'onLongClick', false, eventInfo, true);
+ }, MIN_LONG_CLICK_HOLD_TIME);
+ if(e.preventDefault) e.preventDefault();
+ })(longClickMouseCount);
+ }).bind($ax.features.eventNames.mouseUpName, function(e) {
+ $ax.setjBrowserEvent(e);
+ longClickMouseCount++;
+ });
+ };
+
+
+ // Attach synthetic onSelectionChange event to droplist and listbox elements
+ if ($ax.event.HasSelectionChanged(dObj)) {
+ $element.bind('change', function(e) {
+ $ax.setjBrowserEvent(e);
+ _raiseSyntheticEvent(elementId, 'onSelectionChange');
+ });
+ };
+
+ // Highjack key up and key down to keep track of state of keyboard.
+ if($ax.event.HasKeyUpOrDown(dObj)) _event.initKeyEvents($element);
+
+ // Attach synthetic onTextChange event to textbox and textarea elements
+ if ($ax.event.HasTextChanged(dObj)) {
+ var element = $jobj($ax.INPUT(elementId));
+ $ax.updateElementText(elementId, element.val());
+ //Key down needed because when holding a key down, key up only fires once, but keydown fires repeatedly.
+ //Key up because last mouse down will only show the state before the last character.
+ element.bind('keydown', function(e) {
+ $ax.setjBrowserEvent(e);
+ $ax.event.TryFireTextChanged(elementId);
+ }).bind('keyup', function(e) {
+ $ax.setjBrowserEvent(e);
+ $ax.event.TryFireTextChanged(elementId);
+ });
+ };
+
+ // Attach synthetic onCheckedChange event to radiobutton and checkbox elements
+ if ($ax.public.fn.IsCheckBox(dObj.type) || $ax.public.fn.IsRadioButton(dObj.type)) {
+ var input = $jobj($ax.INPUT(elementId));
+ if($ax.public.fn.IsRadioButton(dObj.type)) {
+ var radioGroupName = input.attr('name');
+ if(input.prop('selected')) {
+ $ax.updateRadioButtonSelected(radioGroupName, elementId);
+ }
+ var onClick = function() {
+ if(radioGroupName !== elementId) {
+ var radioGroup = $("input[name='" + radioGroupName + "']").parent();
+ for(var i = 0; i < radioGroup.length; i++) {
+ $ax.style.SetWidgetSelected(radioGroup[i].id, false, true);
+ }
+ }
+ $ax.style.SetWidgetSelected(elementId, true, true);
+ };
+ } else {
+ onClick = function () {
+ $ax.style.SetWidgetSelected(elementId, !$ax.style.IsWidgetSelected(elementId), true);
+ };
+ }
+ input.click(onClick);
+
+ //$element.bind('change', function(e) {
+ // $ax.setjBrowserEvent(e);
+ // var eTarget = e.target || e.srcElement;
+ // _tryFireCheckedChanged(elementId, eTarget.selected);
+ //});
+ };
+
+ var hasTap = map && (map.onClick || map.onDoubleClick);
+ var hasMove = map && map.onMouseMove;
+ _event.initMobileEvents(hasTap ? $element : $(),
+ hasMove ? $element : $(), elementId);
+
+
+ //attach link alternate styles
+ if(dObj.type == 'hyperlink') {
+ $element.mouseenter(function() {
+ var linkId = this.id;
+ if(_event.mouseOverIds.indexOf(linkId) != -1) return true;
+ _event.mouseOverIds[_event.mouseOverIds.length] = linkId;
+ var mouseOverObjectId = _event.mouseOverObjectId;
+ if(mouseOverObjectId && $ax.style.IsWidgetDisabled(mouseOverObjectId)) return true;
+
+ $ax.style.SetLinkHover(linkId);
+
+ var bubble = _fireObjectEvent(linkId, 'mouseenter', arguments);
+
+ $ax.annotation.updateLinkLocations($ax.GetParentIdFromLink(linkId));
+ return bubble;
+ }).mouseleave(function() {
+ var linkId = this.id;
+ $ax.splice(_event.mouseOverIds, _event.mouseOverIds.indexOf(linkId), 1);
+ var mouseOverObjectId = _event.mouseOverObjectId;
+ if(mouseOverObjectId && $ax.style.IsWidgetDisabled(mouseOverObjectId)) return true;
+
+ $ax.style.SetLinkNotHover(linkId);
+
+ var bubble = _fireObjectEvent(linkId, 'mouseleave', arguments);
+
+ $ax.annotation.updateLinkLocations($ax.GetParentIdFromLink(linkId));
+ return bubble;
+ }).bind($ax.features.eventNames.mouseDownName, function() {
+ var linkId = this.id;
+ var mouseOverObjectId = _event.mouseOverObjectId;
+ if($ax.style.IsWidgetDisabled(mouseOverObjectId)) return undefined;
+
+ if(mouseOverObjectId) $ax.style.SetWidgetMouseDown(mouseOverObjectId, true);
+ $ax.style.SetLinkMouseDown(linkId);
+
+ $ax.annotation.updateLinkLocations($ax.GetParentIdFromLink(linkId));
+
+ return false;
+ }).bind($ax.features.eventNames.mouseUpName, function() {
+ var linkId = this.id;
+ var mouseOverObjectId = _event.mouseOverObjectId;
+ if(mouseOverObjectId && $ax.style.IsWidgetDisabled(mouseOverObjectId)) return;
+
+ if(mouseOverObjectId) $ax.style.SetWidgetMouseDown(mouseOverObjectId, false);
+ $ax.style.SetLinkNotMouseDown(linkId);
+
+ $ax.annotation.updateLinkLocations($ax.GetParentIdFromLink(linkId));
+
+ }).click(function() {
+ var elementId = this.id;
+ var mouseOverObjectId = _event.mouseOverObjectId;
+ if(mouseOverObjectId && $ax.style.IsWidgetDisabled(mouseOverObjectId)) return undefined;
+
+ return _fireObjectEvent(elementId, 'click', arguments);
+ });
+ }
+
+ // Init inline frames
+ if (dObj.type == 'inlineFrame') {
+ var target = dObj.target;
+ var url = '';
+ if(target.includeVariables && target.url) {
+ var origSrc = target.url;
+ url = origSrc.toLowerCase().indexOf('http://') == -1 ? $ax.globalVariableProvider.getLinkUrl(origSrc) : origSrc;
+
+ } else if(target.urlLiteral) {
+ url = $ax.expr.evaluateExpr(target.urlLiteral, $ax.getEventInfoFromEvent(undefined, true, elementId), true);
+ }
+ if(url) $jobj($ax.INPUT(elementId)).attr('src', url);
+ };
+ });
+ }
+ $ax.initializeObjectEvents = _initializeObjectEvents;
+
+ $axure.initializeObjectEvents = function (query, refreshType, _) {
+ //_initializeObjectEvents($ax(query), refreshType);
+ _initializeObjectEvents($ax(query), $ax.repeater.refreshType.persist);
+ }
+
+ $ax.event.updateIxStyleEvents = function(elementId) {
+ _dettachIxStyleEvents(elementId);
+ _attachIxStyleEvents($ax.getObjectFromElementId(elementId), elementId, $jobj(elementId), true);
+ }
+
+ function clearMouseDownIxStyle(e) {
+ if(_event.mouseDownObjectId) {
+ $('#' + _event.mouseDownObjectId).trigger(
+ { type: "mouseup",
+ checkMouseOver: e.data && e.data.checkMouseOver
+ }
+ );
+ }
+ }
+
+ var _dettachIxStyleEvents = function(elementId) {
+ var $element = $jobj(elementId);
+ $element.off('mouseenter.ixStyle')
+ .off('mouseleave.ixStyle')
+ .off($ax.features.eventNames.mouseDownName + '.ixStyle')
+ .off($ax.features.eventNames.mouseUpName + '.ixStyle');
+ }
+
+ var _attachIxStyleEvents = function(dObj, elementId, $element, ignoreHasIxStyles) {
+ //attach button shape alternate styles
+ var isDynamicPanel = $ax.public.fn.IsDynamicPanel(dObj.type);
+ var needsMouseFilter = (ignoreHasIxStyles || $ax.event.HasIxStyles(dObj))
+ && dObj.type != 'hyperlink' && !$ax.public.fn.IsLayer(dObj.type) && !isDynamicPanel && dObj.type != $ax.constants.TEXT_TYPE &&
+ !$ax.public.fn.IsRepeater(dObj.type) //&& !$ax.public.fn.IsCheckBox(dObj.type) && !$ax.public.fn.IsRadioButton(dObj.type)
+ && !$ax.public.fn.IsTreeNodeObject(dObj.type);
+ if(needsMouseFilter) {
+ //$element.mouseenter(function () {
+ $element.on('mouseenter.ixStyle', function () {
+ var elementId = this.id;
+ var parent = $ax.dynamicPanelManager.parentHandlesStyles(elementId);
+ if(parent && parent.direct) return;
+ if($.inArray(elementId, _event.mouseOverIds) != -1) return;
+ _event.mouseOverIds[_event.mouseOverIds.length] = elementId;
+
+ if(elementId == _event.mouseOverObjectId) return;
+ _event.mouseOverObjectId = elementId;
+ $ax.style.SetWidgetHover(elementId, true);
+ $ax.annotation.updateLinkLocations(elementId);
+ //}).mouseleave(function () {
+ }).on('mouseleave.ixStyle', function () {
+ var elementId = this.id;
+ var parent = $ax.dynamicPanelManager.parentHandlesStyles(elementId);
+ if(parent && parent.direct) return;
+ $ax.splice(_event.mouseOverIds, $.inArray(elementId, _event.mouseOverIds), 1);
+
+ if(elementId == _event.mouseOverObjectId) {
+ _event.mouseOverObjectId = '';
+ }
+ $ax.style.SetWidgetHover(elementId, false);
+ $ax.annotation.updateLinkLocations(elementId);
+ });
+
+ //$element.bind($ax.features.eventNames.mouseDownName, function () {
+ $element.on($ax.features.eventNames.mouseDownName + '.ixStyle', function () {
+ var elementId = this.id;
+ var parent = $ax.dynamicPanelManager.parentHandlesStyles(elementId);
+ if(parent) {
+ dynamicPanelMouseDown(parent.id);
+ if(parent.direct) return;
+ }
+ _event.mouseDownObjectId = elementId;
+ //since we don't do mouse capture, it's possible that the mouseup not get triggered later
+ //in that case, detect the mouseup on document and dragend
+ $(document).one("mouseup", {checkMouseOver: true}, clearMouseDownIxStyle);
+ $("#" + elementId).one("dragend", clearMouseDownIxStyle);
+
+ $ax.style.SetWidgetMouseDown(this.id, true);
+ $ax.annotation.updateLinkLocations(elementId);
+ //}).bind($ax.features.eventNames.mouseUpName, function () {
+ }).on($ax.features.eventNames.mouseUpName + '.ixStyle', function (e) {
+ var elementId = this.id;
+ var parent = $ax.dynamicPanelManager.parentHandlesStyles(elementId);
+ if(parent) {
+ dynamicPanelMouseUp(parent.id);
+ if(parent.direct) return;
+ }
+
+ $(document).off("mouseup", clearMouseDownIxStyle);
+
+ if(_event.mouseDownObjectId) {
+ $("#" + _event.mouseDownObjectId).off("dragend", clearMouseDownIxStyle);
+ _event.mouseDownObjectId = '';
+ }
+ if(!$ax.style.ObjHasMouseDown(elementId)) return;
+
+ $ax.style.SetWidgetMouseDown(elementId, false, e.checkMouseOver);
+ $ax.annotation.updateLinkLocations(elementId);
+
+ //there used to be something we needed to make images click, because swapping out the images prevents the click
+ // this is a note that we can eventually delete.
+ });
+
+ }
+ };
+
+ var dynamicPanelMouseDown = function (elementId) {
+ var parent = $ax.dynamicPanelManager.parentHandlesStyles(elementId);
+ if(parent) {
+ dynamicPanelMouseDown(parent.id);
+ if(parent.direct) return;
+ }
+ _event.mouseDownObjectId = elementId;
+ $ax.dynamicPanelManager.propagateMouseDown(elementId, true);
+ };
+
+ var dynamicPanelMouseUp = function (elementId) {
+ var parent = $ax.dynamicPanelManager.parentHandlesStyles(elementId);
+ if(parent) {
+ dynamicPanelMouseUp(parent.id);
+ if(parent.direct) return;
+ }
+ _event.mouseDownObjectId = '';
+ $ax.dynamicPanelManager.propagateMouseDown(elementId, false);
+ };
+
+ // Handle key up and key down events
+ (function() {
+ var _keyState = {};
+ _keyState.ctrl = false;
+ _keyState.alt = false;
+ _keyState.shift = false;
+ _keyState.keyCode = 0;
+ $ax.event.keyState = function() {
+ return $ax.deepCopy(_keyState);
+ };
+
+ var modifierCodes = [16, 17, 18];
+ var clearKeyCode = false;
+ $ax.event.initKeyEvents = function($query) {
+ $query.keydown(function (e) {
+ if(clearKeyCode) {
+ clearKeyCode = false;
+ _keyState.keyCode = 0;
+ }
+ var elementId = this.id;
+
+ _keyState.ctrl = e.ctrlKey;
+
+ _keyState.alt = e.altKey;
+
+ _keyState.shift = e.shiftKey;
+
+ // If a modifier was pressed, then don't set the keyCode;
+ if(modifierCodes.indexOf(e.keyCode) == -1) _keyState.keyCode = e.keyCode;
+
+ $ax.setjBrowserEvent(e);
+ if (!elementId) fireEventThroughContainers('onKeyDown', undefined, false, [$ax.constants.PAGE_TYPE, $ax.constants.REFERENCE_DIAGRAM_OBJECT_TYPE, $ax.constants.DYNAMIC_PANEL_TYPE, $ax.constants.REPEATER],
+ [$ax.constants.PAGE_TYPE, $ax.constants.REFERENCE_DIAGRAM_OBJECT_TYPE, $ax.constants.LAYER_TYPE]);
+ else _raiseSyntheticEvent(elementId, 'onKeyDown', false, undefined, true);
+ });
+ $query.keyup(function(e) {
+ var elementId = this.id;
+
+ if (modifierCodes.indexOf(e.keyCode) == -1) clearKeyCode = true;
+ else if (clearKeyCode) {
+ clearKeyCode = false;
+ _keyState.keyCode = 0;
+ }
+
+ $ax.setjBrowserEvent(e);
+ // Fire event before updating modifiers.
+ if (!elementId) fireEventThroughContainers('onKeyUp', undefined, false, [$ax.constants.PAGE_TYPE, $ax.constants.REFERENCE_DIAGRAM_OBJECT_TYPE, $ax.constants.DYNAMIC_PANEL_TYPE, $ax.constants.REPEATER],
+ [$ax.constants.PAGE_TYPE, $ax.constants.REFERENCE_DIAGRAM_OBJECT_TYPE, $ax.constants.LAYER_TYPE]);
+ else _raiseSyntheticEvent(elementId, 'onKeyUp', false, undefined, true);
+
+ //check if the key is handled before triggering player shortcuts
+ if(!e.isDefaultPrevented() && !elementId) {
+ switch(e.which) {
+ case 188:
+ $ax.messageCenter.postMessage('previousPage');
+ break;
+ case 190:
+ $ax.messageCenter.postMessage('nextPage');
+ break;
+ default:
+ return; // exit this handler for other keys
+ }
+ }
+
+ });
+ };
+ })();
+
+ // Handle adding mobile events
+ (function() {
+ // NOTE: Multi touch is NOT handled currently.
+ var CLICK_THRESHOLD_PX = 25;
+ var CLICK_THRESHOLD_PX_SQ = CLICK_THRESHOLD_PX * CLICK_THRESHOLD_PX;
+ var DBLCLICK_THRESHOLD_MS = 500;
+
+ // Location in page coordinates
+ var tapDownLoc;
+ var lastClickEventTime;
+
+ _event.initMobileEvents = function($tapQuery, $moveQuery, elementId) {
+ if(!$ax.features.supports.mobile) return;
+
+ // Handle touch start
+ $tapQuery.bind('touchstart', function(e) {
+ // We do NOT support multiple touches. This isn't necessarily the touch we want.
+ var touch = e.originalEvent && e.originalEvent.changedTouches && e.originalEvent.changedTouches[0];
+ if(!touch) return;
+
+ tapDownLoc = [touch.pageX, touch.pageY];
+
+ var time = (new Date()).getTime();
+ if(time - lastClickEventTime < DBLCLICK_THRESHOLD_MS) {
+ var dObj = elementId === '' ? $ax.pageData.page : $ax.getObjectFromElementId(elementId);
+ var axEventObject = dObj && dObj.interactionMap && dObj.interactionMap['onDoubleClick'];
+ if(axEventObject) e.preventDefault(); //for Chrome on Android
+ }
+ }).bind('touchend', function(e) {
+ var touch = e.originalEvent && e.originalEvent.changedTouches && e.originalEvent.changedTouches[0];
+ if(!touch || !tapDownLoc || $ax.style.IsWidgetDisabled(elementId)) return;
+
+ var tapUpLoc = [touch.pageX, touch.pageY];
+ var xDiff = tapUpLoc[0] - tapDownLoc[0];
+ var yDiff = tapUpLoc[1] - tapDownLoc[1];
+
+ if((xDiff * xDiff + yDiff * yDiff) < CLICK_THRESHOLD_PX_SQ) {
+ $ax.setjBrowserEvent(e);
+ _raiseSyntheticEvent(elementId, 'onClick', false, undefined, true);
+
+ var time = (new Date()).getTime();
+ if(time - lastClickEventTime < DBLCLICK_THRESHOLD_MS) {
+ _raiseSyntheticEvent(elementId, 'onDoubleClick', false, undefined, true);
+ if(e.originalEvent && e.originalEvent.handled) e.preventDefault(); //for iOS
+ }
+ lastClickEventTime = time;
+ }
+ });
+
+ // Handles touch move
+ $moveQuery.bind('touchmove', function(e) {
+ $ax.setjBrowserEvent(e);
+ _raiseSyntheticEvent(elementId, 'onMouseMove', false, undefined, true);
+ if(e.originalEvent && e.originalEvent.handled) e.preventDefault();
+ });
+ };
+ })();
+
+ // Handle adding device independent click events to non-widgets
+ (function() {
+ var CLICK_THRESHOLD_PX = 25;
+ var CLICK_THRESHOLD_PX_SQ = CLICK_THRESHOLD_PX * CLICK_THRESHOLD_PX;
+
+ // Location in page cooridinates
+ var tapDownLoc;
+
+ _event.attachClick = function(query, clickHandler) {
+ if(!$ax.features.supports.mobile) {
+ query.click(clickHandler);
+ return;
+ }
+
+ $(query).bind('touchstart', function(e) {
+ // We do NOT support multiple touches. This isn't necessarily the touch we want.
+ var touch = e.originalEvent && e.originalEvent.changedTouches && e.originalEvent.changedTouches[0];
+ if(!touch) return;
+
+ tapDownLoc = [touch.pageX, touch.pageY];
+ });
+
+ $(query).bind('touchend', function(e) {
+ var touch = e.originalEvent && e.originalEvent.changedTouches && e.originalEvent.changedTouches[0];
+ if(!touch) return;
+
+ var tapUpLoc = [touch.pageX, touch.pageY];
+ var xDiff = tapUpLoc[0] - tapDownLoc[0];
+ var yDiff = tapUpLoc[1] - tapDownLoc[1];
+
+ if((xDiff * xDiff + yDiff * yDiff) < CLICK_THRESHOLD_PX_SQ) {
+ clickHandler();
+ }
+ });
+ };
+ })();
+
+ // Handle firing device independent click events on widgets
+ (function() {
+ _event.fireClick = function(elementId) {
+ if(!$ax.features.supports.mobile) {
+ $('#' + elementId).click();
+ return;
+ }
+ _raiseSyntheticEvent(elementId, 'onClick', false, undefined, true);
+ };
+ })();
+
+ var _mouseLocation = $ax.mouseLocation = { x: 0, y: 0 };
+ var _lastmouseLocation = $ax.lastMouseLocation = { x: 0, y: 0 };
+
+ var _updateMouseLocation = function(e, end) {
+ if(!e) return;
+
+ if(IE_10_AND_BELOW && typeof (e.type) == 'unknown') return;
+ if(e.type != 'mousemove' && e.type != 'touchstart' && e.type != 'touchmove' && e.type != 'touchend') return;
+
+ var newX;
+ var newY;
+ if(IE_10_AND_BELOW) {
+ newX = e.clientX + $('html').scrollLeft();
+ newY = e.clientY + $('html').scrollTop();
+ } else {
+ newX = e.pageX;
+ newY = e.pageY;
+ }
+ //var body = $('body');
+ //if(body.css('position') == 'relative') newX = Math.round(newX - Number(body.css('left').replace('px', '')) - Math.max(0, ($(window).width() - body.width()) / 2));
+
+ if(_mouseLocation.x == newX && _mouseLocation.y == newY) return;
+
+ _lastmouseLocation.x = _mouseLocation.x;
+ _lastmouseLocation.y = _mouseLocation.y;
+ _mouseLocation.x = newX;
+ _mouseLocation.y = newY;
+
+ $ax.geometry.tick(_mouseLocation.x, _mouseLocation.y, end);
+ };
+ _event.updateMouseLocation = _updateMouseLocation;
+
+ var _leavingState = function(stateId) {
+ var mouseOverIds = _event.mouseOverIds;
+ if(mouseOverIds.length == 0) return;
+
+ var stateQuery = $jobj(stateId);
+ for(var i = mouseOverIds.length - 1; i >= 0; i--) {
+ var id = mouseOverIds[i];
+ if(stateQuery.find('#' + id).length) {
+ $ax.splice(mouseOverIds, $.inArray(id, mouseOverIds), 1);
+ $ax.style.SetWidgetMouseDown(id, false);
+ $ax.style.SetWidgetHover(id, false);
+ }
+ }
+
+ };
+ _event.leavingState = _leavingState;
+
+ var _raiseSelectedEvents = function(elementId, value) {
+ $ax.event.raiseSyntheticEvent(elementId, 'onSelectedChange');
+ if(value) $ax.event.raiseSyntheticEvent(elementId, 'onSelect');
+ else $ax.event.raiseSyntheticEvent(elementId, 'onUnselect');
+ };
+ $ax.event.raiseSelectedEvents = _raiseSelectedEvents;
+
+ var _raiseSyntheticEvent = function(elementId, eventName, skipShowDescription, eventInfo, nonSynthetic) {
+ // Empty string used when this is an event directly on the page.
+ var dObj = elementId === '' ? $ax.pageData.page : $ax.getObjectFromElementId(elementId);
+ var axEventObject = dObj && dObj.interactionMap && dObj.interactionMap[eventName];
+ if(!axEventObject) return;
+
+ eventInfo = eventInfo || $ax.getEventInfoFromEvent($ax.getjBrowserEvent(), skipShowDescription, elementId);
+ // $ax.recording.maybeRecordEvent(elementId, eventInfo, axEventObject, new Date().getTime());
+ _handleEvent(elementId, eventInfo, axEventObject, false, !nonSynthetic);
+ };
+ $ax.event.raiseSyntheticEvent = _raiseSyntheticEvent;
+
+ var _hasSyntheticEvent = function(scriptId, eventName) {
+ var dObj = $ax.getObjectFromScriptId(scriptId);
+ var axEventObject = dObj && dObj.interactionMap && dObj.interactionMap[eventName];
+ return Boolean(axEventObject);
+ };
+ $ax.event.hasSyntheticEvent = _hasSyntheticEvent;
+
+ var _addEvent = function (target, eventType, handler, useCapture) {
+ //this return value is only for debug purpose
+ var succeed = undefined;
+ if(target.attachEvent) {
+ if($ax.features.supports.windowsMobile) {
+ succeed = target.attachEvent(eventType, handler);
+ } else {
+ succeed = target.attachEvent('on' + eventType, handler);
+ }
+ } else if(target.addEventListener) {
+ target.addEventListener(eventType, handler, useCapture);
+ succeed = true;
+ }
+
+ return succeed;
+ }
+ $ax.event.addEvent = _addEvent;
+
+ var _removeEvent = function(target, eventType, handler, useCapture, skipCheckingWindowsMobile) {
+ //this return value is only for debug purpose
+ var succeed = undefined;
+
+ if(target.detachEvent) {
+ if(!skipCheckingWindowsMobile && $ax.features.supports.windowsMobile) {
+ succeed = target.detachEvent(eventType, handler);
+ } else {
+ succeed = target.detachEvent('on' + eventType, handler);
+ }
+ } else if(target.removeEventListener) {
+ target.removeEventListener(eventType, handler, useCapture);
+ succeed = true;
+ }
+
+ return succeed;
+ }
+ $ax.event.removeEvent = _removeEvent;
+
+ var _initialize = function() {
+ $ax.repeater.loadRepeaters();
+
+ // Make sure key events for page are initialized first. That way they will update the value of key pressed before any other events occur.
+ _event.initKeyEvents($(window));
+
+ initSuppressingEvents();
+
+ // Anything with an item id is in a repeater and should be handled by that repeater.
+ _initializeObjectEvents($ax(function(obj, elementId) { return !$ax.repeater.getItemIdFromElementId(elementId); }));
+
+ //finally, process the pageload
+ _pageLoad();
+ // _loadDynamicPanelsAndMasters();
+ // $ax.repeater.init();
+
+ // and wipe out the basic links.
+ $('.basiclink').click(function() {
+ return false;
+ });
+ };
+ _event.initialize = _initialize;
+
+ $ax.event.HasIxStyles = function(diagramObject) {
+ if(diagramObject.style.stateStyles) return true;
+ if(diagramObject.adaptiveStyles) {
+ for(var viewId in diagramObject.adaptiveStyles) {
+ if(diagramObject.adaptiveStyles[viewId].stateStyles) return true;
+ }
+ }
+ return false;
+ };
+
+ $ax.event.HasTextChanged = function(diagramObject) {
+ if (!$ax.public.fn.IsTextBox(diagramObject.type) && !$ax.public.fn.IsTextArea(diagramObject.type)) return false;
+ var map = diagramObject.interactionMap;
+ return map && map.onTextChange;
+ };
+
+ $ax.event.TryFireTextChanged = function(elementId) {
+ var query = $jobj($ax.repeater.applySuffixToElementId(elementId, '_input'));
+ if(!$ax.hasElementTextChanged(elementId, query.val())) return;
+ $ax.updateElementText(elementId, query.val());
+
+ $ax.event.raiseSyntheticEvent(elementId, 'onTextChange');
+ };
+
+ $ax.event.HasSelectionChanged = function(diagramObject) {
+ if (!$ax.public.fn.IsListBox(diagramObject.type) && !$ax.public.fn.IsComboBox(diagramObject.type)) return false;
+ var map = diagramObject.interactionMap;
+ return map && map.onSelectionChange;
+ };
+
+ $ax.event.HasKeyUpOrDown = function (diagramObject) {
+ if($ax.public.fn.IsTextBox(diagramObject.type) || $ax.public.fn.IsTextArea(diagramObject.type)) return true;
+ var map = diagramObject.interactionMap;
+ return map && (map.onKeyUp || map.onKeyDown);
+ };
+
+ $ax.event.HasCheckedChanged = function(diagramObject) {
+ if (!$ax.public.fn.IsCheckBox(diagramObject.type) && !$ax.public.fn.IsRadioButton(diagramObject.type)) return false;
+ var map = diagramObject.interactionMap;
+ return map && map.onSelectedChange;
+ };
+
+ $ax.event.HasClick = function (diagramObject) {
+ var map = diagramObject.interactionMap;
+ return map && map.onClick;
+ };
+
+ var _tryFireCheckedChanged = $ax.event.TryFireCheckChanged = function(elementId, value) {
+ var isRadio = $ax.public.fn.IsRadioButton($obj(elementId).type);
+ if(isRadio) {
+ if(!value) {
+ $ax.updateRadioButtonSelected($jobj($ax.INPUT(elementId)).attr('name'), undefined);
+ } else {
+ var last = $ax.updateRadioButtonSelected($jobj($ax.INPUT(elementId)).attr('name'), elementId);
+
+ // If no change, this should not fire
+ if(last == elementId) return;
+
+ // Initially selecting one, last may be undefined
+ if(last) {
+ //here last is the previouse selected elementid
+ $ax.event.raiseSelectedEvents(last, false);
+ }
+ }
+ }
+
+ $ax.event.raiseSelectedEvents(elementId, value);
+ };
+
+ //onload everything now, not only dp and master
+ var _loadDynamicPanelsAndMasters = function(objects, path, itemId) {
+ fireEventThroughContainers('onLoad', objects, true, [$ax.constants.PAGE_TYPE, $ax.constants.REFERENCE_DIAGRAM_OBJECT_TYPE, $ax.constants.DYNAMIC_PANEL_TYPE],
+ [$ax.constants.ALL_TYPE], path, itemId);
+ };
+ $ax.loadDynamicPanelsAndMasters = _loadDynamicPanelsAndMasters;
+
+ var _viewChangePageAndMasters = function(forceSwitchTo) {
+ fireEventThroughContainers('onAdaptiveViewChange', undefined, true, [$ax.constants.PAGE_TYPE, $ax.constants.REFERENCE_DIAGRAM_OBJECT_TYPE, $ax.constants.DYNAMIC_PANEL_TYPE],
+ [$ax.constants.PAGE_TYPE, $ax.constants.REFERENCE_DIAGRAM_OBJECT_TYPE]);
+ _postAdaptiveViewChanged(forceSwitchTo);
+ };
+ $ax.viewChangePageAndMasters = _viewChangePageAndMasters;
+
+ //if forceSwitchTo is true, we will also update the checkmark in sitemap.js
+ var _postAdaptiveViewChanged = function(forceSwitchTo) {
+ //only trigger adaptive view changed if the window is on the mainframe. Also triggered on init, even if default.
+ try {
+ if(window.name == 'mainFrame' ||
+ (!CHROME_5_LOCAL && window.parent.$ && window.parent.$('#mainFrame').length > 0)) {
+ var data = {
+ viewId: $ax.adaptive.currentViewId,
+ forceSwitchTo: forceSwitchTo
+ };
+ $axure.messageCenter.postMessage('adaptiveViewChange', data);
+ }
+ } catch(e) { }
+ };
+ $ax.postAdaptiveViewChanged = _postAdaptiveViewChanged;
+
+ var _postResize = $ax.postResize = function(e) {
+ $ax.setjBrowserEvent(e);
+ return fireEventThroughContainers('onResize', undefined, false, [$ax.constants.PAGE_TYPE, $ax.constants.REFERENCE_DIAGRAM_OBJECT_TYPE, $ax.constants.DYNAMIC_PANEL_TYPE, $ax.constants.REPEATER],
+ [$ax.constants.PAGE_TYPE, $ax.constants.REFERENCE_DIAGRAM_OBJECT_TYPE]);
+ };
+
+ //fire events for table, menu and tree, including its sub items
+ var _fireEventsForTableMenuAndTree = function (object, event, skipShowDescription, eventInfo, path, synthetic) {
+ if (!path) path = [];
+ var pathCopy = path.slice();
+
+ pathCopy[path.length] = object.id;
+ var scriptId = $ax.getScriptIdFromPath(pathCopy);
+ $ax.event.raiseSyntheticEvent(scriptId, event, skipShowDescription, eventInfo, !synthetic);
+
+ if(object.objects) {
+ for(var index = 0; index < object.objects.length; index++) {
+ var subObj = object.objects[index];
+ if ($ax.public.fn.IsTableCell(subObj.type)) {
+ pathCopy[path.length] = subObj.id;
+ scriptId = $ax.getScriptIdFromPath(pathCopy);
+ $ax.event.raiseSyntheticEvent(scriptId, event, skipShowDescription, eventInfo, !synthetic);
+ } else if ($ax.public.fn.IsTable(object.type) || $ax.public.fn.IsMenuObject(object.type) || $ax.public.fn.IsTreeNodeObject(object.type)) {
+ _fireEventsForTableMenuAndTree(subObj, event, skipShowDescription, eventInfo, path, synthetic);
+ }
+ }
+ }
+ }
+
+ //remember the scroll bar position, so we can detect scroll up/down
+ var lastScrollTop;
+
+ var fireEventForPageOrMaster = function (elementId, eventName, interactionMap, isPage, skipShowDescription, synthetic) {
+ if(!interactionMap) return;
+
+ var axEvent = interactionMap[eventName];
+ var scrolling = eventName === "onScroll";
+ if (scrolling && !axEvent) axEvent = interactionMap.onScrollUp || interactionMap.onScrollDown;
+
+ if (axEvent) {
+ var currentEvent = $ax.getjBrowserEvent();
+ var eventInfo = $ax.getEventInfoFromEvent(currentEvent, skipShowDescription, elementId);
+
+ if(isPage) {
+ eventInfo.label = $ax.pageData.page.name;
+ eventInfo.friendlyType = 'Page';
+ } else eventInfo.isMasterEvent = true;
+
+ if(scrolling) _handleScrollEvent(elementId, eventInfo, currentEvent.originalEvent, _event.windowScrollingUp, _event.windowScrollingDown, interactionMap, skipShowDescription, synthetic);
+ else _handleEvent(elementId, eventInfo, axEvent, skipShowDescription, synthetic);
+ }
+ }
+ // Filters include page, referenceDiagramObject, dynamicPanel, and repeater.
+ var _callFilterCheck = function(callFilter, type) {
+ for(var index = 0; index < callFilter.length; index++) {
+ var currentType = callFilter[index];
+ if(currentType === $ax.constants.ALL_TYPE || currentType === type) return true;
+ }
+ return false;
+ };
+
+ var fireEventThroughContainers = function(eventName, objects, synthetic, searchFilter, callFilter, path, itemId) {
+ // TODO: may want to pass in this as a parameter. At that point, may want to convert some of them to an option parameter. For now this is the only case
+ var skipShowDescription = eventName == 'onLoad';
+
+ // If objects undefined, load page
+ if(!objects) {
+ if(_callFilterCheck(callFilter, $ax.constants.PAGE_TYPE)) {
+ //if scrolling, set direction, later master will know
+ if(eventName === "onScroll") {
+ var currentScrollTop = ((SAFARI && IOS) || SHARE_APP) ? $('#ios-safari-html').scrollTop() : $(window).scrollTop();
+ _event.windowScrollingUp = currentScrollTop < lastScrollTop;
+ _event.windowScrollingDown = currentScrollTop > lastScrollTop;
+ }
+
+ fireEventForPageOrMaster('', eventName, $ax.pageData.page.interactionMap, true, skipShowDescription, synthetic);
+ }
+ if(searchFilter.indexOf($ax.constants.PAGE_TYPE) != -1) fireEventThroughContainers(eventName, $ax.pageData.page.diagram.objects, synthetic, searchFilter, callFilter);
+ //reset and save scrolling info at the end
+ if(currentScrollTop) {
+ lastScrollTop = currentScrollTop;
+ _event.windowScrollingUp = undefined;
+ _event.windowScrollingDown = undefined;
+ }
+
+ return;
+ }
+
+ if(!path) path = [];
+
+ var pathCopy = [];
+ for(var j = 0; j < path.length; j++) pathCopy[j] = path[j];
+
+ for(var i = 0; i < objects.length; i++) {
+ var obj = objects[i];
+ pathCopy[path.length] = obj.id;
+ if (!$ax.public.fn.IsReferenceDiagramObject(obj.type) && !$ax.public.fn.IsDynamicPanel(obj.type) && !$ax.public.fn.IsRepeater(obj.type) && !$ax.public.fn.IsLayer(obj.type)) {
+ if(_callFilterCheck(callFilter)) { //fire current event for all types
+ if ($ax.public.fn.IsTable(obj.type) || $ax.public.fn.IsMenuObject(obj.type) || $ax.public.fn.IsTreeNodeObject(obj.type)) {
+ _fireEventsForTableMenuAndTree(obj, eventName, skipShowDescription, undefined, path, !synthetic);
+ } else {
+ var scriptId = $ax.getScriptIdFromPath(pathCopy);
+ if(scriptId && itemId) scriptId = $ax.repeater.createElementId(scriptId, itemId);
+ $ax.event.raiseSyntheticEvent(scriptId, eventName, skipShowDescription, undefined, !synthetic);
+ }
+ }
+ continue;
+ }
+
+ var objId = $ax.getScriptIdFromPath(pathCopy);
+ // If limboed, move on to next item
+ if(!objId) continue;
+ if(itemId) objId = $ax.repeater.createElementId(objId, itemId);
+
+ if($ax.public.fn.IsReferenceDiagramObject(obj.type)) {
+ if(_callFilterCheck(callFilter, $ax.constants.REFERENCE_DIAGRAM_OBJECT_TYPE)) {
+ fireEventForPageOrMaster(objId, eventName, $ax.pageData.masters[obj.masterId].interactionMap, false, skipShowDescription, synthetic);
+ }
+ if(searchFilter.indexOf($ax.constants.REFERENCE_DIAGRAM_OBJECT_TYPE) != -1) fireEventThroughContainers(eventName, $ax.pageData.masters[obj.masterId].diagram.objects, synthetic, searchFilter, callFilter, pathCopy, itemId);
+ } else if($ax.public.fn.IsDynamicPanel(obj.type)) {
+ if(_callFilterCheck(callFilter, $ax.constants.DYNAMIC_PANEL_TYPE)) $ax.event.raiseSyntheticEvent(objId, eventName, skipShowDescription, undefined, !synthetic);
+
+ if(searchFilter.indexOf($ax.constants.DYNAMIC_PANEL_TYPE) != -1) {
+ var diagrams = obj.diagrams;
+ for(var j = 0; j < diagrams.length; j++) {
+ fireEventThroughContainers(eventName, diagrams[j].objects, synthetic, searchFilter, callFilter, path, itemId);
+ }
+ }
+ } else if($ax.public.fn.IsRepeater(obj.type)) {
+ // TODO: possible an option for repeater item? Now fires overall for the repeater
+ if(_callFilterCheck(callFilter, $ax.constants.REPEATER)) $ax.event.raiseSyntheticEvent(objId, eventName, skipShowDescription, undefined, !synthetic);
+ if(searchFilter.indexOf($ax.constants.REPEATER) != -1) {
+ var itemIds = $ax.getItemIdsForRepeater(objId);
+ for(var j = 0; j < itemIds.length; j++) {
+ fireEventThroughContainers(eventName, obj.objects, synthetic, searchFilter, callFilter, path, itemIds[j]);
+ }
+ }
+ } else if($ax.public.fn.IsLayer(obj.type)) {
+ if(_callFilterCheck(callFilter, $ax.constants.LAYER_TYPE)) $ax.event.raiseSyntheticEvent(objId, eventName, skipShowDescription, undefined, !synthetic);
+
+ if(obj.objs && obj.objs.length > 0) {
+ fireEventThroughContainers(eventName, obj.objs, synthetic, searchFilter, callFilter, path, itemId);
+ }
+ }
+ }
+
+ eventNesting -= 1;
+
+ }; // FOCUS stuff
+ (function() {
+
+ })();
+
+
+ var _pageLoad = function() {
+
+ // Map of axure event names to pair of what it should attach to, and what the jquery event name is.
+ var PAGE_AXURE_TO_JQUERY_EVENT_NAMES = {
+ 'onScroll': [window, 'scroll'],
+ 'onScrollUp': [window, 'scrollup'],
+ 'onScrollDown': [window, 'scrolldown'],
+ //'onResize': [window, 'resize'],
+ 'onContextMenu': [window, 'contextmenu']
+ };
+
+ var $win = $(window);
+ if(!$ax.features.supports.mobile) {
+ PAGE_AXURE_TO_JQUERY_EVENT_NAMES.onClick = ['html', 'click'];
+ PAGE_AXURE_TO_JQUERY_EVENT_NAMES.onDoubleClick = ['html', 'dblclick'];
+ PAGE_AXURE_TO_JQUERY_EVENT_NAMES.onMouseMove = ['html', 'mousemove'];
+ } else {
+ _event.initMobileEvents($win, $win, '');
+
+ $win.bind($ax.features.eventNames.mouseDownName, _updateMouseLocation);
+ $win.bind($ax.features.eventNames.mouseUpName, function(e) { _updateMouseLocation(e, true); });
+ }
+
+ $win.scroll(function () { _setCanClick(false); });
+ $win.bind($ax.features.eventNames.mouseDownName, function () { _setCanClick(true); });
+
+ $win.bind($ax.features.eventNames.mouseMoveName, _updateMouseLocation);
+ $win.scroll($ax.flyoutManager.reregisterAllFlyouts);
+
+ for(key in PAGE_AXURE_TO_JQUERY_EVENT_NAMES) {
+ if(!PAGE_AXURE_TO_JQUERY_EVENT_NAMES.hasOwnProperty(key)) continue;
+ (function(axureName) {
+ var jqueryEventNamePair = PAGE_AXURE_TO_JQUERY_EVENT_NAMES[axureName];
+ var actionName = jqueryEventNamePair[1];
+
+ if(actionName == "scrollup" || actionName == "scrolldown") return;
+
+ var jObj = jqueryEventNamePair[0];
+ if ((SAFARI && IOS) || SHARE_APP) jObj = '#ios-safari-html';
+
+ $(jObj)[actionName](function (e) {
+ $ax.setjBrowserEvent(e);
+ return fireEventThroughContainers(axureName, undefined, false, [$ax.constants.PAGE_TYPE, $ax.constants.REFERENCE_DIAGRAM_OBJECT_TYPE, $ax.constants.DYNAMIC_PANEL_TYPE, $ax.constants.REPEATER],
+ [$ax.constants.PAGE_TYPE, $ax.constants.REFERENCE_DIAGRAM_OBJECT_TYPE]);
+ });
+ })(key);
+ }
+
+ eventNesting -= 1;
+ lastScrollTop = 0;
+ };
+ _event.pageLoad = _pageLoad;
+
+
+});
\ No newline at end of file
diff --git a/src/原型系统/resources/scripts/axure/expr.js b/src/原型系统/resources/scripts/axure/expr.js
new file mode 100644
index 0000000..9e9c245
--- /dev/null
+++ b/src/原型系统/resources/scripts/axure/expr.js
@@ -0,0 +1,579 @@
+// ******* Expr MANAGER ******** //
+$axure.internal(function($ax) {
+ var _expr = $ax.expr = {};
+ var _binOpHandlers = {
+ '&&': function(left, right) { return _binOpOverride(left, right, function(left) { return $ax.getBool(left) && $ax.getBool(right()); }); },
+ '||': function(left, right) { return _binOpOverride(left, right, function(left) { return $ax.getBool(left) || $ax.getBool(right()); }); },
+ '==': function(left, right) { return isEqual(left, right, true); },
+ '!=': function(left, right) { return !isEqual(left, right, true); },
+ '>': function(left, right) { return _binOpNum(left, right, function(left, right) { return left > right; }); },
+ '<': function(left, right) { return _binOpNum(left, right, function(left, right) { return left < right; }); },
+ '>=': function(left, right) { return _binOpNum(left, right, function(left, right) { return left >= right; }); },
+ '<=': function(left, right) { return _binOpNum(left, right, function(left, right) { return left <= right; }); }
+ };
+
+ var checkOps = function(left, right) {
+ return left == undefined || right == undefined;
+ };
+
+ var isEqual = function (left, right, isFunction) {
+ if (isFunction) {
+ //if left and right is function, then get the value
+ //otherwise left and right should be already the value we want
+ left = left();
+ right = right();
+ }
+
+ if(checkOps(left, right)) return false;
+
+ if(left instanceof Date && right instanceof Date) {
+ if(left.getMilliseconds() != right.getMilliseconds()) return false;
+ if(left.getSeconds() != right.getSeconds()) return false;
+ if(left.getMinutes() != right.getMinutes()) return false;
+ if(left.getHours() != right.getHours()) return false;
+ if(left.getDate() != right.getDate()) return false;
+ if(left.getMonth() != right.getMonth()) return false;
+ if(left.getYear() != right.getYear()) return false;
+ return true;
+ }
+
+ if(left instanceof Object && right instanceof Object) {
+ var prop;
+ // Go through all of lefts properties and compare them to rights.
+ for(prop in left) {
+ if(!left.hasOwnProperty(prop)) continue;
+ // If left has a property that the right doesn't they are not equal.
+ if(!right.hasOwnProperty(prop)) return false;
+ // If any of their properties are not equal, they are not equal.
+ if(!isEqual(left[prop], right[prop], false)) return false;
+ }
+
+ for(prop in right) {
+ // final check to make sure right doesn't have some extra properties that make them not equal.
+ if(left.hasOwnProperty(prop) != right.hasOwnProperty(prop)) return false;
+ }
+
+ return true;
+ }
+ return $ax.getBool(left) == $ax.getBool(right);
+ };
+
+ var _binOpOverride = function(left, right, func) {
+ left = left();
+ if(left == undefined) return false;
+ var res = func(left, right);
+ return res == undefined ? false : res;
+ };
+
+ var _binOpNum = function(left, right, func) {
+ var left = left();
+ var right = right();
+ if(checkOps(left, right)) return false;
+
+ return func(left, Number(right));
+ };
+
+ var _exprHandlers = {};
+ _exprHandlers.array = function(expr, eventInfo) {
+ var returnVal = [];
+ for(var i = 0; i < expr.items.length; i++) {
+ returnVal[returnVal.length] = _evaluateExpr(expr.items[i], eventInfo);
+ }
+ return returnVal;
+ };
+
+ _exprHandlers.binaryOp = function(expr, eventInfo) {
+ var left = function() { return expr.leftExpr && _evaluateExpr(expr.leftExpr, eventInfo); };
+ var right = function() { return expr.rightExpr && _evaluateExpr(expr.rightExpr, eventInfo); };
+
+ if(left == undefined || right == undefined) return false;
+ return _binOpHandlers[expr.op](left, right);
+ };
+
+ _exprHandlers.block = function(expr, eventInfo) {
+ var subExprs = expr.subExprs;
+ for(var i = 0; i < subExprs.length; i++) {
+ _evaluateExpr(subExprs[i], eventInfo); //ignore the result
+ }
+ };
+
+ _exprHandlers.booleanLiteral = function(expr) {
+ return expr.value;
+ };
+
+ _exprHandlers.nullLiteral = function() { return null; };
+
+ _exprHandlers.pathLiteral = function(expr, eventInfo) {
+ if(expr.isThis) return [eventInfo.srcElement];
+ if(expr.isFocused && window.lastFocusedControl) {
+ $ax('#' + window.lastFocusedControl).focus();
+ return [window.lastFocusedControl];
+ }
+ if(expr.isTarget) return [eventInfo.targetElement];
+
+ return $ax.getElementIdsFromPath(expr.value, eventInfo);
+ };
+
+ _exprHandlers.panelDiagramLiteral = function(expr, eventInfo) {
+ var elementIds = $ax.getElementIdsFromPath(expr.panelPath, eventInfo);
+ var elementIdsWithSuffix = [];
+ var suffix = '_state' + expr.panelIndex;
+ for(var i = 0; i < elementIds.length; i++) {
+ elementIdsWithSuffix[i] = $ax.repeater.applySuffixToElementId(elementIds[i], suffix);
+ }
+ return String($jobj(elementIdsWithSuffix).data('label'));
+ };
+
+ _exprHandlers.fcall = function(expr, eventInfo) {
+ var oldTarget = eventInfo.targetElement;
+ var targets = [];
+ var fcallArgs = [];
+ var exprArgs = expr.arguments;
+ for(var i = 0; i < expr.arguments.length; i++) {
+ var exprArg = exprArgs[i];
+ var fcallArg = '';
+ if(targets.length) {
+ for(var j = 0; j < targets.length; j++) {
+ if(exprArg == null) {
+ fcallArgs[j][i] = null;
+ continue;
+ }
+ eventInfo.targetElement = targets[j];
+ fcallArg = _evaluateExpr(exprArg, eventInfo);
+ if(typeof (fcallArg) == 'undefined') return '';
+ fcallArgs[j][i] = fcallArg;
+ }
+ } else {
+ if(exprArg == null) {
+ fcallArgs[i] = null;
+ continue;
+ }
+ fcallArg = _evaluateExpr(exprArg, eventInfo);
+ if(typeof (fcallArg) == 'undefined') return '';
+ fcallArgs[i] = fcallArg;
+ }
+
+ // We do support null exprArgs...
+ // TODO: This makes 2 assumptions that may change in the future. 1. The pathLiteral is the always the first arg. 2. there is always only 1 pathLiteral
+ if(exprArg && exprArg.exprType == 'pathLiteral') {
+ targets = fcallArg;
+
+ // fcallArgs is now an array of an array of args
+ for(j = 0; j < targets.length; j++) fcallArgs[j] = [[fcallArg[j]]];
+ }
+ }
+
+ // we want to preserve the target element from outside this function.
+ eventInfo.targetElement = oldTarget;
+
+ var retval = '';
+ if(targets.length) {
+ // Go backwards so retval is the first item.
+ for(i = targets.length - 1; i >= 0; i--) {
+ var args = fcallArgs[i];
+ // Add event info to the end
+ args[args.length] = eventInfo;
+ retval = _exprFunctions[expr.functionName].apply(this, args);
+ }
+ } else fcallArgs[fcallArgs.length] = eventInfo;
+ return targets.length ? retval : _exprFunctions[expr.functionName].apply(this, fcallArgs);
+ };
+
+ _exprHandlers.globalVariableLiteral = function(expr) {
+ return expr.variableName;
+ };
+
+ _exprHandlers.keyPressLiteral = function(expr) {
+ var keyInfo = {};
+ keyInfo.keyCode = expr.keyCode;
+ keyInfo.ctrl = expr.ctrl;
+ keyInfo.alt = expr.alt;
+ keyInfo.shift = expr.shift;
+
+ return keyInfo;
+ };
+
+ _exprHandlers.adaptiveViewLiteral = function(expr) {
+ return expr.id;
+ };
+
+ _exprHandlers.optionLiteral = function(expr) {
+ return expr.value;
+ }
+
+ var _substituteSTOs = function(expr, eventInfo) {
+ //first evaluate the local variables
+ var scope = {};
+ for(var varName in expr.localVariables) {
+ scope[varName] = $ax.expr.evaluateExpr(expr.localVariables[varName], eventInfo);
+ }
+
+ // TODO: [ben] Date and data object (obj with info for url or image) both need to return non-strings.
+ var i = 0;
+ var retval;
+ var retvalString = expr.value.replace(/\[\[(?!\[)(.*?)\]\](?=\]*)/g, function(match) {
+ var sto = expr.stos[i++];
+ if(sto.sto == 'error') return match;
+ try {
+ var result = $ax.evaluateSTO(sto, scope, eventInfo);
+ } catch(e) {
+ return match;
+ }
+
+ if((result instanceof Object) && i == 1 && expr.value.substring(0, 2) == '[[' &&
+ expr.value.substring(expr.value.length - 2) == ']]') {
+ // If the result was an object, this was the first result, and the whole thing was this expresion.
+ retval = result;
+ }
+ return ((result instanceof Object) && (result.label || result.text)) || result;
+ });
+ // If more than one group returned, the object is not valid
+ if(i != 1) retval = false;
+ return retval || retvalString;
+ };
+
+ _exprHandlers.htmlLiteral = function (expr, eventInfo) {
+ eventInfo.htmlLiteral = true;
+ var html = _substituteSTOs(expr, eventInfo);
+ eventInfo.htmlLiteral = false
+ return html;
+ };
+
+ _exprHandlers.stringLiteral = function(expr, eventInfo) {
+ return _substituteSTOs(expr, eventInfo);
+ };
+
+ var _exprFunctions = {};
+
+ _exprFunctions.SetCheckState = function(elementIds, value) {
+ var toggle = value == 'toggle';
+ var boolValue = Boolean(value) && value != 'false';
+
+ for(var i = 0; i < elementIds.length; i++) {
+ var query = $ax('#' + elementIds[i]);
+ query.selected(toggle ? !query.selected() : boolValue);
+ }
+ };
+
+ _exprFunctions.SetSelectedOption = function(elementIds, value) {
+ for(var i = 0; i < elementIds.length; i++) {
+ var elementId = elementIds[i];
+ var obj = $jobj($ax.INPUT(elementId));
+
+ if(obj.val() == value) return;
+ obj.val(value);
+
+ if($ax.event.HasSelectionChanged($ax.getObjectFromElementId(elementId))) $ax.event.raiseSyntheticEvent(elementId, 'onSelectionChange');
+ }
+ };
+
+ _exprFunctions.SetGlobalVariableValue = function(varName, value) {
+ $ax.globalVariableProvider.setVariableValue(varName, value);
+ };
+
+ _exprFunctions.SetWidgetFormText = function(elementIds, value) {
+ for(var i = 0; i < elementIds.length; i++) {
+ var elementId = elementIds[i];
+ var inputId = $ax.repeater.applySuffixToElementId(elementId, '_input');
+
+ var obj = $jobj(inputId);
+ if(obj.val() == value || (value == '' && $ax.placeholderManager.isActive(elementId))) return;
+ obj.val(value);
+ $ax.placeholderManager.updatePlaceholder(elementId, !value);
+ if($ax.event.HasTextChanged($ax.getObjectFromElementId(elementId))) $ax.event.TryFireTextChanged(elementId);
+ }
+ };
+
+ _exprFunctions.SetFocusedWidgetText = function(elementId, value) {
+ if(window.lastFocusedControl) {
+ var elementId = window.lastFocusedControl;
+ var type = $obj(elementId).type;
+ if ($ax.public.fn.IsTextBox(type) || $ax.public.fn.IsTextArea(type)) _exprFunctions.SetWidgetFormText([elementId], value);
+ else _exprFunctions.SetWidgetRichText([elementId], value, true);
+ }
+ };
+
+ _exprFunctions.GetRtfElementHeight = function(rtfElement) {
+ if(rtfElement.innerHTML == '') rtfElement.innerHTML = ' ';
+ return rtfElement.offsetHeight;
+ };
+
+ _exprFunctions.SetWidgetRichText = function(ids, value, plain) {
+ // Converts dates, widgetinfo, and the like to strings.
+ value = _exprFunctions.ToString(value);
+
+ //Replace any newlines with line breaks
+ var finalValue = value.replace(/\r\n/g, ' ').replace(/\n/g, ' ');
+
+ for(var i = 0; i < ids.length; i++) {
+ var id = ids[i];
+
+ // If calling this on button shape, get the id of the rich text panel inside instead
+ if($obj(id).type !== $ax.constants.LINK_TYPE) id = $ax.GetTextPanelId(id, true);
+
+ var element = window.document.getElementById(id);
+ $ax.visibility.SetVisible(element, value != '');
+
+ $ax.style.transformTextWithVerticalAlignment(id, function() {
+ var spans = $jobj(id).find('span');
+ if(plain) {
+ // Can't set value as text because ' ' doesn't actually do a line break
+ // Can't set vaule as html because it doesn't like '<' and ignores all after it
+ // Create tags yourself
+ var lines = value.split(/\r\n|\n/);
+ //if we are dealing with only one line, just reuse the old one
+ if(spans.length === 1 && lines.length === 1) {
+ $(spans[0]).text(value);
+ return;
+ }
+
+ // Wrap in span and p, style them accordingly.
+ var span = $(' ');
+ if(spans.length > 0) {
+ span.attr('style', $(spans[0]).attr('style'));
+ span.attr('id', $(spans[0]).attr('id'));
+ }
+
+ if(lines.length == 1) span.text(value);
+ else {
+ for(var i = 0; i < lines.length; i++) {
+ if(i != 0) span.append($(' '));
+ var line = lines[i];
+ if(line.length == 0) continue;
+
+ var subSpan = $(' ');
+ subSpan.text(line);
+ span.append(subSpan);
+ }
+ }
+
+ var ps = $jobj(id).find('p');
+ if(ps && ps.length) {
+ ps[0].innerHTML = $('
').append(span).html();;
+ if(ps.length > 1) {
+ for(var i = 1; i < ps.length; i++) {
+ $(ps[i]).remove();
+ }
+ }
+ } else {
+ var p = $('
');
+ p.append(span);
+ element.innerHTML = $('
').append(p).html();
+ }
+ } else element.innerHTML = finalValue;
+ });
+
+ if(!plain) $ax.style.CacheOriginalText(id, true);
+ }
+ };
+
+ _exprFunctions.GetCheckState = function(ids) {
+ return $ax('#' + ids[0]).selected();
+ };
+
+ _exprFunctions.GetDisabledState = function (ids) {
+ return !$ax('#' + ids[0]).enabled();
+ };
+
+ _exprFunctions.GetSelectedOption = function (ids) {
+ var inputs = $jobj($ax.INPUT(ids[0]));
+ return inputs.length ? inputs[0].value : '';
+ };
+
+ _exprFunctions.GetNum = function(str) {
+ //Setting a GlobalVariable to some blank text then setting a widget to the value of that variable would result in 0 not ""
+ //I have fixed this another way so commenting this should be fine now
+ //if (!str) return "";
+ return isNaN(str) ? str : Number(str);
+ };
+
+ _exprFunctions.GetGlobalVariableValue = function(id) {
+ return $ax.globalVariableProvider.getVariableValue(id);
+ };
+
+ _exprFunctions.GetGlobalVariableLength = function(id) {
+ return _exprFunctions.GetGlobalVariableValue(id).length;
+ };
+
+ _exprFunctions.GetWidgetText = function(ids) {
+ if($ax.placeholderManager.isActive(ids[0])) return '';
+ var input = $ax.INPUT(ids[0]);
+ return $ax('#' + ($jobj(input).length ? input : ids[0])).text();
+ };
+
+ _exprFunctions.GetFocusedWidgetText = function() {
+ if(window.lastFocusedControl) {
+ return $ax('#' + window.lastFocusedControl).text();
+ } else {
+ return "";
+ }
+ };
+
+ _exprFunctions.GetWidgetValueLength = function(ids) {
+ var id = ids[0];
+ if(!id) return undefined;
+ if($ax.placeholderManager.isActive(id)) return 0;
+ var obj = $jobj($ax.INPUT(id));
+ if(!obj.length) obj = $jobj(id);
+ var val = obj[0].value || _exprFunctions.GetWidgetText([id]);
+ return val.length;
+ };
+
+ _exprFunctions.GetPanelState = function(ids) {
+ var id = ids[0];
+ if(!id) return undefined;
+ var stateId = $ax.visibility.GetPanelState(id);
+ return stateId && String($jobj(stateId).data('label'));
+ };
+
+ _exprFunctions.GetWidgetVisibility = function(ids) {
+ var id = ids[0];
+ if(!id) return undefined;
+ return $ax.visibility.IsIdVisible(id);
+ };
+
+ // ***************** Validation Functions ***************** //
+
+ _exprFunctions.IsValueAlpha = function(val) {
+ var isAlphaRegex = new RegExp("^[a-z\\s]+$", "gi");
+ return isAlphaRegex.test(val);
+ };
+
+ _exprFunctions.IsValueNumeric = function(val) {
+ var isNumericRegex = new RegExp("^[0-9,\\.\\s]+$", "gi");
+ return isNumericRegex.test(val);
+ };
+
+ _exprFunctions.IsValueAlphaNumeric = function(val) {
+ var isAlphaNumericRegex = new RegExp("^[0-9a-z\\s]+$", "gi");
+ return isAlphaNumericRegex.test(val);
+ };
+
+ _exprFunctions.IsValueOneOf = function(val, values) {
+ for(var i = 0; i < values.length; i++) {
+ var option = values[i];
+ if(val == option) return true;
+ }
+ //by default, return false
+ return false;
+ };
+
+ _exprFunctions.IsValueNotAlpha = function(val) {
+ return !_exprFunctions.IsValueAlpha(val);
+ };
+
+ _exprFunctions.IsValueNotNumeric = function(val) {
+ return !_exprFunctions.IsValueNumeric(val);
+ };
+
+ _exprFunctions.IsValueNotAlphaNumeric = function(val) {
+ return !_exprFunctions.IsValueAlphaNumeric(val);
+ };
+
+ _exprFunctions.IsValueNotOneOf = function(val, values) {
+ return !_exprFunctions.IsValueOneOf(val, values);
+ };
+
+ _exprFunctions.GetKeyPressed = function(eventInfo) {
+ return eventInfo.keyInfo;
+ };
+
+ _exprFunctions.GetCursorRectangles = function() {
+ var rects = new Object();
+ rects.lastRect = new $ax.drag.Rectangle($ax.lastMouseLocation.x, $ax.lastMouseLocation.y, 1, 1);
+ rects.currentRect = new $ax.drag.Rectangle($ax.mouseLocation.x, $ax.mouseLocation.y, 1, 1);
+ return rects;
+ };
+
+ _exprFunctions.GetWidgetRectangles = function (elementIds, eventInfo) {
+ var elementId = elementIds[0];
+ var rects = new Object();
+ var jObj = $jobj(elementId);
+ var invalid = jObj.length == 0;
+ var parent = jObj;
+ // Or are in valid if no obj can be found, or if it is not visible.
+ while(parent.length != 0 && !parent.is('body')) {
+ if(parent.css('display') == 'none') {
+ invalid = true;
+ break;
+ }
+ parent = parent.parent();
+ }
+ if(invalid) {
+ rects.lastRect = rects.currentRect = new $ax.drag.Rectangle(-1, -1, -1, -1);
+ return rects;
+ }
+
+ var axObj = $ax('#' + elementId);
+ var boundingRect = axObj.viewportBoundingRect();
+ rects.lastRect = new $ax.drag.Rectangle(
+ boundingRect.left,
+ boundingRect.top,
+ boundingRect.width,
+ boundingRect.height);
+ //rects.lastRect = new $ax.drag.Rectangle(
+ // axObj.left(),
+ // axObj.top(),
+ // axObj.width(),
+ // axObj.height());
+
+ rects.currentRect = rects.lastRect;
+ return rects;
+ };
+
+ _exprFunctions.GetWidget = function(elementId) {
+ return $ax.getWidgetInfo(elementId[0]);
+ };
+
+ _exprFunctions.GetAdaptiveView = function (eventInfo) {
+ if (eventInfo && eventInfo.srcElement) {
+ var id = eventInfo.srcElement;
+ var diagramObject = $ax.getObjectFromElementId(id);
+ if (diagramObject.owner.type == 'Axure:Master') {
+ var viewIdChain = $ax.style.getViewIdChain($ax.adaptive.currentViewId || '', id, diagramObject);
+ if (viewIdChain.length > 0) return viewIdChain[viewIdChain.length - 1];
+ else return '19e82109f102476f933582835c373474';
+ }
+ }
+ return $ax.adaptive.currentViewId || '';
+ };
+
+ _exprFunctions.IsEntering = function(movingRects, targetRects) {
+ return !movingRects.lastRect.IntersectsWith(targetRects.currentRect) && movingRects.currentRect.IntersectsWith(targetRects.currentRect);
+ };
+
+ _exprFunctions.IsLeaving = function(movingRects, targetRects) {
+ return movingRects.lastRect.IntersectsWith(targetRects.currentRect) && !movingRects.currentRect.IntersectsWith(targetRects.currentRect);
+ };
+
+ var _IsOver = _exprFunctions.IsOver = function(movingRects, targetRects) {
+ return movingRects.currentRect.IntersectsWith(targetRects.currentRect);
+ };
+
+ _exprFunctions.IsNotOver = function(movingRects, targetRects) {
+ return !_IsOver(movingRects, targetRects);
+ };
+
+ _exprFunctions.ValueContains = function(inputString, value) {
+ return inputString.indexOf(value) > -1;
+ };
+
+ _exprFunctions.ValueNotContains = function(inputString, value) {
+ return !_exprFunctions.ValueContains(inputString, value);
+ };
+
+ _exprFunctions.ToString = function(value) {
+ if(value.isWidget) {
+ return value.text;
+ }
+ return String(value);
+ };
+
+ var _evaluateExpr = $ax.expr.evaluateExpr = function(expr, eventInfo, toString) {
+ if(expr === undefined || expr === null) return undefined;
+ var result = _exprHandlers[expr.exprType](expr, eventInfo);
+ return toString ? _exprFunctions.ToString(result) : result;
+ };
+
+
+});
\ No newline at end of file
diff --git a/src/原型系统/resources/scripts/axure/flyout.js b/src/原型系统/resources/scripts/axure/flyout.js
new file mode 100644
index 0000000..e98303f
--- /dev/null
+++ b/src/原型系统/resources/scripts/axure/flyout.js
@@ -0,0 +1,286 @@
+// ******* Flyout MANAGER ******** //
+$axure.internal(function($ax) {
+ var _flyoutManager = $ax.flyoutManager = {};
+
+ var getFlyoutLabel = function(panelId) {
+ return panelId + '_flyout';
+ };
+
+ var _unregisterPanel = function(panelId, keepShown) {
+ $ax.geometry.unregister(getFlyoutLabel(panelId));
+ if(panelToSrc[panelId]) {
+ $ax.style.RemoveRolloverOverride(panelToSrc[panelId]);
+ delete panelToSrc[panelId];
+ }
+ if(!keepShown) {
+ $ax.action.addAnimation(panelId, $ax.action.queueTypes.fade, function() {
+ $ax('#' + panelId).hide();
+ });
+ }
+ };
+ _flyoutManager.unregisterPanel = _unregisterPanel;
+
+ var genPoint = $ax.geometry.genPoint;
+
+ var _updateFlyout = function(panelId) {
+ var label = getFlyoutLabel(panelId);
+ if(!$ax.geometry.polygonRegistered(label)) return;
+ var info = $ax.geometry.getPolygonInfo(label);
+ var rects = info && info.rects;
+
+ var targetWidget = $ax.getWidgetInfo(panelId);
+ rects.target = $ax.geometry.genRect(targetWidget);
+
+ // Src will stay the same, just updating
+ $ax.flyoutManager.registerFlyout(rects, panelId, panelToSrc[panelId]);
+
+ if(!$ax.geometry.checkInsideRegion(label)) _unregisterPanel(panelId);
+ };
+ _flyoutManager.updateFlyout = _updateFlyout;
+
+ var panelToSrc = {};
+ var _registerFlyout = function(rects, panelId, srcId) {
+ var label = _getFlyoutLabel(panelId);
+ var callback = function(info) {
+ // If leaving object or already outside it, then unregister, otherwise just return
+ if(!info.exiting && !info.outside) return;
+ _unregisterPanel(panelId);
+ };
+ var points = [];
+
+ var lastSrcId = panelToSrc[panelId];
+ if(lastSrcId != srcId) {
+ if(lastSrcId) $ax.style.RemoveRolloverOverride(lastSrcId);
+ if(srcId) {
+ $ax.style.AddRolloverOverride(srcId);
+ panelToSrc[panelId] = srcId;
+ } else delete panelToSrc[panelId];
+ }
+
+ // rects should be one or two rectangles
+ if(!rects.src) {
+ var rect = rects.target;
+ points.push(genPoint(rect.Left(), rect.Top()));
+ points.push(genPoint(rect.Right(), rect.Top()));
+ points.push(genPoint(rect.Right(), rect.Bottom()));
+ points.push(genPoint(rect.Left(), rect.Bottom()));
+ } else {
+ var r0 = rects.src;
+ var r1 = rects.target;
+
+ // Right left of right, left right of left, top below top, bottom above bottom
+ var rlr = r0.Right() <= r1.Right();
+ var lrl = r0.Left() >= r1.Left();
+ var tbt = r0.Top() >= r1.Top();
+ var bab = r0.Bottom() <= r1.Bottom();
+
+ var info = { rlr: rlr, lrl: lrl, tbt: tbt, bab: bab };
+
+ if((rlr && lrl) || (tbt && bab)) {
+ points = getSmallPolygon(r0, r1, info);
+ } else {
+ points = getLargePolygon(r0, r1, info);
+ }
+ }
+
+ $ax.geometry.registerPolygon(label, points, callback, { rects: rects });
+ };
+ _flyoutManager.registerFlyout = _registerFlyout;
+
+ var _getFlyoutLabel = function(panelId) {
+ return panelId + '_flyout';
+ };
+
+ var _reregisterAllFlyouts = function() {
+ for(var panelId in panelToSrc) _reregisterFlyout(panelId);
+ };
+ _flyoutManager.reregisterAllFlyouts = _reregisterAllFlyouts;
+
+ var _reregisterFlyout = function(panelId) {
+ var rects = $ax.geometry.getPolygonInfo(getFlyoutLabel(panelId)).rects;
+ _registerFlyout(rects, panelId, panelToSrc[panelId]);
+ };
+
+ // This is the reduced size polygon connecting r0 to r1 by means of horizontal or vertical lines.
+ var getSmallPolygon = function(r0, r1, info) {
+ var points = [];
+
+ // NOTE: currently I make the assumption that if horizontal/vertical connecting lines from the src hit the target
+ // Meaning if horizontal, rlr and lrl are true, and if vertical, tbt and bab are true.
+
+ var r0Left = r0.Left();
+ var r0Right = r0.Right();
+ var r0Top = r0.Top();
+ var r0Bottom = r0.Bottom();
+ var r1Left = r1.Left();
+ var r1Right = r1.Right();
+ var r1Top = r1.Top();
+ var r1Bottom = r1.Bottom();
+
+ points.push(genPoint(r1Left, r1Top));
+
+ if(!info.tbt) {
+ points.push(genPoint(r0Left, r1Top));
+ points.push(genPoint(r0Left, r0Top));
+ points.push(genPoint(r0Right, r0Top));
+ points.push(genPoint(r0Right, r1Top));
+ }
+
+ points.push(genPoint(r1Right, r1Top));
+
+ if(!info.rlr) {
+ points.push(genPoint(r1Right, r0Top));
+ points.push(genPoint(r0Right, r0Top));
+ points.push(genPoint(r0Right, r0Bottom));
+ points.push(genPoint(r1Right, r0Bottom));
+ }
+
+ points.push(genPoint(r1Right, r1Bottom));
+
+ if(!info.bab) {
+ points.push(genPoint(r0Right, r1Bottom));
+ points.push(genPoint(r0Right, r0Bottom));
+ points.push(genPoint(r0Left, r0Bottom));
+ points.push(genPoint(r0Left, r1Bottom));
+ }
+
+ points.push(genPoint(r1Left, r1Bottom));
+
+ if(!info.lrl) {
+ points.push(genPoint(r1Left, r0Bottom));
+ points.push(genPoint(r0Left, r0Bottom));
+ points.push(genPoint(r0Left, r0Top));
+ points.push(genPoint(r1Left, r0Top));
+ }
+
+ return points;
+ };
+
+ // This is the original algorithm that connects the most extream corners to make polygon
+ var getLargePolygon = function(r0, r1, info) {
+ var points = [];
+
+ var r0Left = r0.Left();
+ var r0Right = r0.Right();
+ var r0Top = r0.Top();
+ var r0Bottom = r0.Bottom();
+ var r1Left = r1.Left();
+ var r1Right = r1.Right();
+ var r1Top = r1.Top();
+ var r1Bottom = r1.Bottom();
+
+ // Top lefts
+ if(info.tbt) {
+ if(!info.lrl) points.push(genPoint(r0Left, r0Top));
+ points.push(genPoint(r1Left, r1Top));
+ } else {
+ if(info.lrl) points.push(genPoint(r1Left, r1Top));
+ points.push(genPoint(r0Left, r0Top));
+ }
+
+ // Top rights
+ if(info.tbt) {
+ points.push(genPoint(r1Right, r1Top));
+ if(!info.rlr) points.push(genPoint(r0Right, r0Top));
+ } else {
+ points.push(genPoint(r0Right, r0Top));
+ if(info.rlr) points.push(genPoint(r1Right, r1Top));
+ }
+
+ // Bottom rights
+ if(info.bab) {
+ if(!info.rlr) points.push(genPoint(r0Right, r0Bottom));
+ points.push(genPoint(r1Right, r1Bottom));
+ } else {
+ if(info.rlr) points.push(genPoint(r1Right, r1Bottom));
+ points.push(genPoint(r0Right, r0Bottom));
+ }
+
+ // Bottom Lefts
+ if(info.bab) {
+ points.push(genPoint(r1Left, r1Bottom));
+ if(!info.lrl) points.push(genPoint(r0Left, r0Bottom));
+ } else {
+ points.push(genPoint(r0Left, r0Bottom));
+ if(info.lrl) points.push(genPoint(r1Left, r1Bottom));
+ }
+ return points;
+ };
+});
+
+// ******* Placeholder Manager ********* //
+
+$axure.internal(function($ax) {
+ var _placeholderManager = $ax.placeholderManager = {};
+ var idToPlaceholderInfo = {};
+
+ var _registerPlaceholder = function(elementId, text, password) {
+ idToPlaceholderInfo[elementId] = { text: text, password: password, active: false };
+ };
+ _placeholderManager.registerPlaceholder = _registerPlaceholder;
+
+ _placeholderManager.refreshPlaceholder = function (elementId) {
+ var info = idToPlaceholderInfo[elementId];
+ if (!info || !info.active) return;
+ $ax.style.SetWidgetPlaceholder(elementId, true, info.text, info.password);
+ }
+
+ var _updatePlaceholder = function(elementId, active, clearText) {
+ var inputId = $ax.repeater.applySuffixToElementId(elementId, '_input');
+
+ var info = idToPlaceholderInfo[elementId];
+ if(!info || info.active == active) return;
+ info.active = active;
+
+ if(active) var text = info.text;
+ else if(!ANDROID) text = clearText ? '' : document.getElementById(inputId).value;
+ else {
+ var currentText = document.getElementById(inputId).value;
+ if(!clearText) text = currentText;
+ else if(currentText == info.text) text = "";
+ else {
+ var lastIndex = currentText.lastIndexOf(info.text);
+ //here i am assuming the text is always inserted in front
+ text = currentText.substring(0, lastIndex);
+ }
+ }
+
+ $ax.style.SetWidgetPlaceholder(elementId, active, text, info.password);
+ };
+ _placeholderManager.updatePlaceholder = _updatePlaceholder;
+
+ var _isActive = function(elementId) {
+ var info = idToPlaceholderInfo[elementId];
+ return Boolean(info && info.active);
+ };
+ _placeholderManager.isActive = _isActive;
+
+ var _selectRange = function(elementId, start, end) {
+ $jobj(elementId).each(function() {
+ if(this.setSelectionRange) {
+ var validTypes = ["text", "search", "url", "tel", "password"];
+ if(this.tagName.toLowerCase() != "input" || validTypes.indexOf(this.type) > -1) {
+ this.focus();
+ this.setSelectionRange(start, end);
+ }
+ } else if(this.createTextRange) {
+ var range = this.createTextRange();
+ range.collapse(true);
+ range.moveEnd('character', end);
+ range.moveStart('character', start);
+ range.select();
+ }
+ });
+ };
+ _placeholderManager.selectRange = _selectRange;
+
+ var _moveCaret = function(id, index) {
+ var inputIndex = id.indexOf('_input');
+ if(inputIndex == -1) return;
+ var inputId = id.substring(0, inputIndex);
+
+ if(!_isActive(inputId)) return;
+ _selectRange(id, index, index);
+ };
+ _placeholderManager.moveCaret = _moveCaret;
+});
\ No newline at end of file
diff --git a/src/原型系统/resources/scripts/axure/geometry.js b/src/原型系统/resources/scripts/axure/geometry.js
new file mode 100644
index 0000000..437e87e
--- /dev/null
+++ b/src/原型系统/resources/scripts/axure/geometry.js
@@ -0,0 +1,301 @@
+// ******* Region MANAGER ******** //
+$axure.internal(function($ax) {
+ var _geometry = $ax.geometry = {};
+ var regionMap = {};
+ var regionList = [];
+
+ var _unregister = function(label) {
+ var regionIndex = regionList.indexOf(label);
+ if(regionIndex != -1) {
+ var end = $ax.splice(regionList, regionIndex + 1);
+ $ax.splice(regionList, regionIndex, regionList.length - regionIndex);
+ regionList = regionList.concat(end);
+ }
+ delete regionMap[label];
+ };
+ _geometry.unregister = _unregister;
+
+ var clear = function() {
+ regionMap = {};
+ regionList = [];
+ };
+
+ var _polygonRegistered = function(label) {
+ return Boolean(regionMap[label]);
+ };
+ _geometry.polygonRegistered = _polygonRegistered;
+
+ // Must be counterclockwise, or enter/exit will be wrong
+ var _registerPolygon = function(label, points, callback, info) {
+ var regionIndex = regionList.indexOf(label);
+ if(regionIndex == -1) regionList.push(label);
+ regionMap[label] = { points: points, callback: callback, info: info };
+ };
+ _geometry.registerPolygon = _registerPolygon;
+
+ var _getPolygonInfo = function(label) {
+ if(!_polygonRegistered(label)) return undefined;
+ return regionMap[label].info;
+ };
+ _geometry.getPolygonInfo = _getPolygonInfo;
+
+
+
+ var _genRect = function(info, roundHalfPixel) {
+ var x = info.pagex();
+ var y = info.pagey();
+ var w = info.width();
+ var h = info.height();
+
+ if(roundHalfPixel) {
+ if(x % 1 != 0) {
+ x = Math.floor(x);
+ w++;
+ }
+ if(y % 1 != 0) {
+ y = Math.floor(y);
+ h++;
+ }
+ }
+
+ var r = x + w;
+ var b = y + h;
+
+ var rect = {
+ X: function() { return x; },
+ Y: function() { return y; },
+ Wigth: function() { return w; },
+ Height: function() { return h; },
+ Left: function() { return x; },
+ Right: function() { return r; },
+ Top: function() { return y; },
+ Bottom: function() { return b; }
+ };
+ return rect;
+ };
+ _geometry.genRect = _genRect;
+
+ var _genPoint = function(x, y) {
+ return { x: x, y: y };
+ };
+ _geometry.genPoint = _genPoint;
+
+ var oldPoint = _genPoint(0, 0);
+ _geometry.tick = function(x, y, end) {
+ var lastPoint = oldPoint;
+ var nextPoint = oldPoint = _genPoint(x, y);
+ var line = { p1: lastPoint, p2: nextPoint };
+ if(!regionList.length) return;
+
+ for(var i = 0; i < regionList.length; i++) {
+ var region = regionMap[regionList[i]];
+ var points = region.points;
+ if(!region.checked) {
+ if(!_checkInside(points, $ax.mouseLocation)) {
+ region.callback({ outside: true });
+ continue;
+ }
+ region.checked = true;
+ }
+ for(var j = 0; j < points.length; j++) {
+ var startSegment = points[j];
+ var endSegment = points[(j + 1) % points.length];
+ var intersectInfo = linesIntersect(line, { p1: startSegment, p2: endSegment });
+ if(intersectInfo) {
+ region.callback(intersectInfo);
+ break;
+ }
+ }
+ }
+
+ if(end) clear();
+ };
+
+ // Info if the one line touches the other (even barely), false otherwise
+ // Info includes point, if l1 is entering or exiting l2, and any ties that happened, or parallel info
+ var linesIntersect = function(l1, l2) {
+ var retval = {};
+ var ties = {};
+
+ var l1p1 = l1.p1.x < l1.p2.x || (l1.p1.x == l1.p2.x && l1.p1.y < l1.p2.y) ? l1.p1 : l1.p2;
+ var l1p2 = l1.p1.x < l1.p2.x || (l1.p1.x == l1.p2.x && l1.p1.y < l1.p2.y) ? l1.p2 : l1.p1;
+ var m1 = (l1p2.y - l1p1.y) / (l1p2.x - l1p1.x);
+
+ var l2p1 = l2.p1.x < l2.p2.x || (l2.p1.x == l2.p2.x && l2.p1.y < l2.p2.y) ? l2.p1 : l2.p2;
+ var l2p2 = l2.p1.x < l2.p2.x || (l2.p1.x == l2.p2.x && l2.p1.y < l2.p2.y) ? l2.p2 : l2.p1;
+ var m2 = (l2p2.y - l2p1.y) / (l2p2.x - l2p1.x);
+
+ var l1Vert = l1.p1.x == l1.p2.x;
+ var l2Vert = l2.p1.x == l2.p2.x;
+ if(l1Vert || l2Vert) {
+ if(l1Vert && l2Vert) {
+ // If the lines don't follow the same path, return
+ if(l1p1.x != l2p1.x) return false;
+ // if they never meet, return
+ if(l1p2.y < l2p1.y || l1p1.y > l2p2.y) return false;
+ var firstVert = l1p1.y >= l2p1.y ? l1p1 : l2p1;
+ var secondVert = l1p2.y <= l2p2.y ? l1p2 : l2p2;
+ // First is from the perspective of l1
+ retval.parallel = {
+ first: l1p1 == l1.p1 ? firstVert : secondVert,
+ second: l1p2 == l1.p2 ? secondVert : firstVert,
+ sameDirection: (l1p1 == l1.p1) == (l2p1 == l2.p1)
+ };
+
+ return retval;
+ }
+
+ var x1 = l2Vert ? l1p1.x : l2p1.x;
+ var x2 = l2Vert ? l1p2.x : l2p2.x;
+ var xVert = l2Vert ? l2p1.x : l1p1.x;
+
+ var y = l2Vert ? l1p1.y + (xVert - x1) * m1 : l2p1.y + (xVert - x1) * m2;
+ var y1 = l2Vert ? l2p1.y : l1p1.y;
+ var y2 = l2Vert ? l2p2.y : l1p2.y;
+ if(xVert >= x1 && xVert <= x2 && y >= y1 && y <= y2) {
+ retval.point = { x: xVert, y: y };
+ retval.exiting = l2Vert == (y1 == (l2Vert ? l2.p1.y : l1.p1.y)) == (x1 == (l2Vert ? l1.p1.x : l2.p1.x));
+ retval.entering = !retval.exiting;
+
+ // Calculate ties
+ if(x1 == xVert) {
+ ties[l2Vert ? 'l1' : 'l2'] = (x1 == (l2Vert ? l1.p1.x : l2.p1.x)) ? 'start' : 'end';
+ retval.ties = ties;
+ } else if(x2 == xVert) {
+ ties[l2Vert ? 'l1' : 'l2'] = (x2 == (l2Vert ? l1.p2.x : l2.p2.x)) ? 'end' : 'start';
+ retval.ties = ties;
+ }
+ if(y1 == y) {
+ ties[l2Vert ? 'l2' : 'l1'] = (y1 == (l2Vert ? l2.p1.y : l1.p1.y)) ? 'start' : 'end';
+ retval.ties = ties;
+ } else if(y2 == y) {
+ ties[l2Vert ? 'l2' : 'l1'] = (y2 == (l2Vert ? l2.p2.y : l1.p2.y)) ? 'end' : 'start';
+ retval.ties = ties;
+ }
+
+ return retval;
+ }
+ return false;
+ }
+ // If here, no vertical lines
+
+ if(m1 == m2) {
+ // If the lines don't follow the same path, return
+ if(l1p1.y != (l2p1.y + (l1p1.x - l2p1.x) * m1)) return false;
+ // if they never meet, return
+ if(l1p2.x < l2p1.x || l1p1.x > l2p2.x) return false;
+ var first = l1p1.x >= l2p1.x ? l1p1 : l2p1;
+ var second = l1p2.x <= l2p2.x ? l1p2 : l2p2;
+ // First is from the perspective of l1
+ retval.parallel = {
+ first: l1p1 == l1.p1 ? first : second,
+ second: l1p2 == l1.p2 ? second : first,
+ sameDirection: (l1p1 == l1.p1) == (l2p1 == l2.p1)
+ };
+
+ return retval;
+ }
+
+ var x = (l2p1.y - l2p1.x * m2 - l1p1.y + l1p1.x * m1) / (m1 - m2);
+
+ // Check if x is out of bounds
+ if(x >= l1p1.x && x <= l1p2.x && x >= l2p1.x && x <= l2p2.x) {
+ var y = l1p1.y + (x - l1p1.x) * m1;
+ retval.point = { x: x, y: y };
+ retval.entering = m1 > m2 == (l1p1 == l1.p1) == (l2p1 == l2.p1);
+ retval.exiting = !retval.entering;
+
+ // Calculate ties
+ if(l1.p1.x == x) {
+ ties.l1 = 'start';
+ retval.ties = ties;
+ } else if(l1.p2.x == x) {
+ ties.l1 = 'end';
+ retval.ties = ties;
+ }
+ if(l2.p1.x == x) {
+ ties.l2 = 'start';
+ retval.ties = ties;
+ } else if(l2.p2.x == x) {
+ ties.l2 = 'end';
+ retval.ties = ties;
+ }
+
+ return retval;
+ }
+ return false;
+ };
+
+ var _checkInsideRegion = function(label, point) {
+ if(!_polygonRegistered(label)) return false;
+
+ return _checkInside(regionMap[label].points, point || $ax.mouseLocation);
+ };
+ _geometry.checkInsideRegion = _checkInsideRegion;
+
+ // Returns true if point is inside the polygon, including ties
+ var _checkInside = function(polygon, point) {
+ // Make horizontal line wider than the polygon, with the y of point to test location
+ var firstX = polygon[0].x;
+ var secondX = firstX;
+ var i;
+ for(i = 1; i < polygon.length; i++) {
+ var polyX = polygon[i].x;
+ firstX = Math.min(firstX, polyX);
+ secondX = Math.max(secondX, polyX);
+ }
+ var line = {
+ p1: _genPoint(--firstX, point.y),
+ p2: _genPoint(++secondX, point.y)
+ };
+
+ // If entered true, with closest intersection says you are inside the polygon.
+ var entered = false;
+ // Closest is the closest intersection to the left of the point
+ var closest = line.p1.x;
+ // This is for if intersections hit the same point, to find out which is correct
+ var cos = -2;
+
+ var getCos = function(line) {
+ var x = line.p2.x - line.p1.x;
+ var y = line.p2.y - line.p1.y;
+ return x / Math.sqrt(x * x + y * y);
+ };
+
+ for(i = 0; i < polygon.length; i++) {
+ var polyLine = { p1: polygon[i], p2: polygon[(i + 1) % polygon.length] };
+ var intersectInfo = linesIntersect(line, polyLine);
+ if(!intersectInfo) continue;
+
+ if(intersectInfo.parallel) {
+ // Only really care about this if it actually touches the point
+ if(intersectInfo.parallel.first.x <= point.x && intersectInfo.parallel.second.x >= point.x) return true;
+ continue;
+ }
+
+ var intersectionX = intersectInfo.point.x;
+ if(intersectionX > point.x || intersectionX < closest) continue;
+ if(intersectionX == point.x) return true;
+
+ // If closer than last time, reset cosine.
+ if(intersectionX != closest) cos = -2;
+
+ // For getting cosine, need to possibly reverse the direction of polyLine.
+ if(intersectInfo.ties) {
+ // Tie must be on l2, if the ties is end, reverse so cosine indicates how close the angle is to that of 'point' from here.
+ if(intersectInfo.ties.l2 == 'end') polyLine = { p1: polyLine.p2, p2: polyLine.p1 };
+ } else {
+ // It is on both side, so you can take the larger one
+ if(polyLine.p1.x > polyLine.p2.x) polyLine = { p1: polyLine.p2, p2: polyLine.p1 };
+ }
+ var currCos = getCos(polyLine);
+ if(currCos > cos) {
+ cos = currCos;
+ closest = intersectionX;
+ entered = intersectInfo.entering;
+ }
+ }
+ return entered;
+ };
+ _geometry.checkInside = _checkInside;
+});
\ No newline at end of file
diff --git a/src/原型系统/resources/scripts/axure/globals.js b/src/原型系统/resources/scripts/axure/globals.js
new file mode 100644
index 0000000..0c5c4e8
--- /dev/null
+++ b/src/原型系统/resources/scripts/axure/globals.js
@@ -0,0 +1,7 @@
+$axure.internal(function($ax) {
+ var _globals = $ax.globals = {};
+
+ $ax.globals.MaxZIndex = 1000;
+ $ax.globals.MinZIndex = -1000;
+
+});
\ No newline at end of file
diff --git a/src/原型系统/resources/scripts/axure/ie.js b/src/原型系统/resources/scripts/axure/ie.js
new file mode 100644
index 0000000..cd99447
--- /dev/null
+++ b/src/原型系统/resources/scripts/axure/ie.js
@@ -0,0 +1,344 @@
+
+//// ******* Internet Explorer MANAGER ******** //
+////this is to handle all the stupid IE Stuff
+//$axure.internal(function($ax) {
+// if(!IE_10_AND_BELOW) return;
+
+// var _ieColorManager = {};
+// if(Number(BROWSER_VERSION) < 9) $ax.ieColorManager = _ieColorManager;
+
+// var _applyIEFixedPosition = function() {
+// if(Number(BROWSER_VERSION) >= 7) return;
+
+// $axure(function(diagramObject) { return diagramObject.fixedVertical; }).$()
+// .appendTo($('body'))
+// .css('position', 'absolute').css('margin-left', 0 + 'px').css('margin-top', 0 + 'px');
+
+// var handleScroll = function() {
+// $axure(function(diagramObject) { return diagramObject.fixedVertical; })
+// .each(function(diagramObject, elementId) {
+// var win = $(window);
+// var windowWidth = win.width();
+// var windowHeight = win.height();
+// var windowScrollLeft = win.scrollLeft();
+// var windowScrollTop = win.scrollTop();
+
+// var newLeft = 0;
+// var newTop = 0;
+// var elementQuery = $('#' + elementId);
+// var elementAxQuery = $ax('#' + elementId);
+// var width = elementAxQuery.width();
+// var height = elementAxQuery.height();
+
+// var horz = diagramObject.fixedHorizontal;
+// if(horz == 'left') {
+// newLeft = windowScrollLeft + diagramObject.fixedMarginHorizontal;
+// } else if(horz == 'center') {
+// newLeft = windowScrollLeft + ((windowWidth - width) / 2) + diagramObject.fixedMarginHorizontal;
+// } else if(horz == 'right') {
+// newLeft = windowScrollLeft + windowWidth - width - diagramObject.fixedMarginHorizontal;
+// }
+
+// var vert = diagramObject.fixedVertical;
+// if(vert == 'top') {
+// newTop = windowScrollTop + diagramObject.fixedMarginVertical;
+// } else if(vert == 'middle') {
+// newTop = windowScrollTop + ((windowHeight - height) / 2) + diagramObject.fixedMarginVertical;
+// } else if(vert == 'bottom') {
+// newTop = windowScrollTop + windowHeight - height - diagramObject.fixedMarginVertical;
+// }
+// elementQuery.css('top', newTop + 'px').css('left', newLeft + 'px');
+// });
+// };
+
+// $(window).scroll(handleScroll);
+// $axure.resize(handleScroll);
+// handleScroll();
+// };
+
+// var _applyBackground = function() {
+// if(Number(BROWSER_VERSION) >= 9) return;
+
+// var styleChain = $ax.adaptive.getAdaptiveIdChain($ax.adaptive.currentViewId);
+// var argb = _getArgb($ax.pageData.page, styleChain);
+// var hexColor = _getHexColor(argb, false);
+// if(hexColor) $('body').css('background-color', hexColor);
+
+// _applyBackgroundToQuery($ax('*'));
+// };
+
+// var _applyBackgroundToQuery = function(query) {
+// if(Number(BROWSER_VERSION) >= 9) return;
+
+// var styleChain = $ax.adaptive.getAdaptiveIdChain($ax.adaptive.currentViewId);
+// query.each(function(obj, elementId) {
+// if ($ax.public.fn.IsDynamicPanel(obj.type)) {
+// var stateCount = obj.diagrams.length;
+// for(var j = 0; j < stateCount; j++) {
+// var stateId = $ax.repeater.applySuffixToElementId(elementId, '_state' + j);
+// var argb = _getArgb(obj.diagrams[j], styleChain);
+// var hexColor = _getHexColor(argb, true);
+// if(hexColor) $jobj(stateId).css('background-color', hexColor);
+// }
+// } else if ($ax.public.fn.IsRepeater(obj.type)) {
+
+// }
+// });
+// };
+// _ieColorManager.applyBackground = _applyBackgroundToQuery;
+
+// var _getArgb = function(diagram, styleChain) {
+// var argb = undefined;
+// for(var i = 0; i < styleChain.length && !argb; i++) {
+// var style = diagram.adaptiveStyles[styleChain[i]];
+// argb = style.fill && style.fill.color;
+// }
+// if(!argb) argb = diagram.style.fill.color;
+// return argb;
+// };
+
+// var gMult = 256;
+// var rMult = gMult * 256;
+// var aMult = rMult * 256;
+
+// var _getHexColor = function(argb, allowWhite) {
+// var a = Math.floor(argb / aMult);
+// argb -= a * aMult;
+
+// var r = Math.floor(argb / rMult);
+// argb -= r * rMult;
+
+// var g = Math.floor(argb / gMult);
+// var b = argb - g * gMult;
+
+// return _getColorFromArgb(a, r, g, b, allowWhite);
+// };
+
+// var _getColorFromArgb = function(a, r, g, b, allowWhite) {
+// if(Number(BROWSER_VERSION) >= 9) return undefined;
+
+// //convert the color with alpha to a color with no alpha (assuming white background)
+// r = Math.min((r * a) / 255 + 255 - a, 255);
+// g = Math.min((g * a) / 255 + 255 - a, 255);
+// b = Math.min((b * a) / 255 + 255 - a, 255);
+
+// if(a == 0) return undefined;
+// if(!allowWhite && (r == 255 && g == 255 && b == 255)) return undefined;
+
+// var color = '#';
+// color += Math.floor(r / 16).toString(16);
+// color += Math.floor(r % 16).toString(16);
+// color += Math.floor(g / 16).toString(16);
+// color += Math.floor(g % 16).toString(16);
+// color += Math.floor(b / 16).toString(16);
+// color += Math.floor(b % 16).toString(16);
+// return color;
+// };
+// _ieColorManager.getColorFromArgb = _getColorFromArgb;
+
+// var getIEOffset = function(transform, rect) {
+// var translatedVertexes = [
+// $axure.utils.Vector2D(0, 0), //we dont translate, so the orgin is fixed
+// transform.mul($axure.utils.Vector2D(0, rect.height)),
+// transform.mul($axure.utils.Vector2D(rect.width, 0)),
+// transform.mul($axure.utils.Vector2D(rect.width, rect.height))];
+
+// var minX = 0, minY = 0, maxX = 0, maxY = 0;
+// $.each(translatedVertexes, function(index, p) {
+// minX = Math.min(minX, p.x);
+// minY = Math.min(minY, p.y);
+// maxX = Math.max(maxX, p.x);
+// maxY = Math.max(maxY, p.y);
+// });
+
+// return $axure.utils.Vector2D(
+// (maxX - minX - rect.width) / 2,
+// (maxY - minY - rect.height) / 2);
+// };
+
+// var _filterFromTransform = function(transform) {
+// return "progid:DXImageTransform.Microsoft.Matrix(M11=" + transform.m11 +
+// ", M12=" + transform.m12 + ", M21=" + transform.m21 +
+// ", M22=" + transform.m22 + ", SizingMethod='auto expand')";
+// };
+
+// var _applyIERotation = function() {
+// if(Number(BROWSER_VERSION) >= 9) return;
+
+// $axure(function(diagramObject) {
+// return ((diagramObject.style.rotation && Math.abs(diagramObject.style.rotation) > 0.1)
+// || (diagramObject.style.textRotation && Math.abs(diagramObject.style.textRotation) > 0.1))
+// && !diagramObject.isContained;
+// }).each(function(diagramObject, elementId) {
+// var rotation = diagramObject.style.rotation || 0;
+// var $element = $('#' + elementId);
+// var axElement = $ax('#' + elementId);
+// var width = axElement.width();
+// var height = axElement.height();
+// var originX = width / 2;
+// var originY = height / 2;
+
+// var shapeIeOffset;
+// $element.children().each(function() {
+// var $child = $(this);
+// var axChild = $ax('#' + $child.attr('id'));
+// var childWidth = axChild.width();
+// var childHeight = axChild.height() + $child.position().top;
+// var centerX = $child.position().left + (childWidth / 2);
+// var centerY = $child.position().top + (childHeight / 2);
+// var deltaX = centerX - originX;
+// var deltaY = centerY - originY;
+
+// var effectiveRotation = rotation;
+// var textObject = $ax.getObjectFromElementId($child.attr('id'));
+// if(textObject) {
+// if(textObject.style.textRotation) effectiveRotation = textObject.style.textRotation;
+// else return;
+// }
+
+// var transform = $ax.utils.Matrix2D.identity().rotate(effectiveRotation);
+// var filter = _filterFromTransform(transform);
+
+// $child.css('filter', filter)
+// .width(childWidth + 1)
+// .height(childHeight + 1);
+
+// var p = transform.mul($ax.utils.Vector2D(deltaX, deltaY));
+// var ieOffset = getIEOffset(transform, { width: childWidth, height: childHeight });
+// if(!textObject) {
+// shapeIeOffset = ieOffset;
+// } else {
+// // This is a close approximation, but not exact
+// if(diagramObject.style.verticalAlignment != 'top') ieOffset.y -= shapeIeOffset.y + Math.abs(shapeIeOffset.x);
+// }
+
+// $child.css("margin-left", -ieOffset.x - deltaX + p.x).css("margin-top", -ieOffset.y - deltaY + p.y);
+// });
+// });
+// };
+
+// var _fixIEStretchBackground = function() {
+// if(Number(BROWSER_VERSION) >= 9) return;
+// var pageStyle = $ax.adaptive.getPageStyle();
+// if(!pageStyle.imageRepeat || pageStyle.imageRepeat == 'auto') return;
+
+// $('body').css('background-image', 'none');
+// var viewId = $ax.adaptive.currentViewId;
+// var imageInfo = viewId ? $ax.pageData.viewIdToBackgroundImageInfo && $ax.pageData.viewIdToBackgroundImageInfo[viewId] : $ax.pageData.defaultBackgroundImageInfo;
+// if(imageInfo && imageInfo.path) {
+// if($('#bg_img').length == 0) $('body').append(' ');
+// $('#bg_img').attr('src', imageInfo.path).css('position', 'fixed').css('z-index', '-10000');
+// _resizeIEBackground();
+// } else $('#bg_img').remove();
+// };
+
+// var _resizeIEBackground = function() {
+// if(Number(BROWSER_VERSION) >= 9) return;
+// //var page = $ax.pageData.page;
+// var viewId = $ax.adaptive.currentViewId;
+// var pageStyle = $ax.adaptive.getPageStyle();
+// if(!$ax.pageData.defaultBackgroundImageInfo && !$ax.pageData.viewIdToBackgroundImageInfo) return;
+// var imageInfo = viewId ? $ax.pageData.viewIdToBackgroundImageInfo[viewId] : $ax.pageData.defaultBackgroundImageInfo;
+// if(!imageInfo) return;
+// var imageWidth = imageInfo.width;
+// var imageHeight = imageInfo.height;
+// var windowWidth = $(window).width();
+// var windowHeight = $(window).height();
+// var isCover = pageStyle.imageRepeat == 'cover';
+
+// var wRatio = windowWidth / imageWidth;
+// var hRatio = windowHeight / imageHeight;
+// var ratio = wRatio;
+// if(isCover) {
+// if(hRatio > wRatio) ratio = hRatio;
+// } else {
+// if(hRatio < wRatio) ratio = hRatio;
+// }
+// var width = imageWidth * ratio;
+// var height = imageHeight * ratio;
+
+// var left = '0px';
+// if((isCover && width > windowWidth) || (!isCover && width < windowWidth)) {
+// if(pageStyle.imageHorizontalAlignment == 'center') {
+// left = ((windowWidth - width) / 2) + 'px';
+// } else if(pageStyle.imageHorizontalAlignment == 'far') {
+// left = (windowWidth - width) + 'px';
+// }
+// }
+
+// var top = '0px';
+// if((isCover && height > windowHeight) || (!isCover && height < windowHeight)) {
+// if(pageStyle.imageVerticalAlignment == 'center') {
+// top = ((windowHeight - height) / 2) + 'px';
+// } else if(pageStyle.imageVerticalAlignment == 'far') {
+// top = (windowHeight - height) + 'px';
+// }
+// }
+
+// $('#bg_img').css('top', top).css('left', left).css('width', width).css('height', height);
+// };
+
+// var _fixAllPngs = function() {
+// if(!(/MSIE ((5\.5)|6)/.test(window.navigator.userAgent) && window.navigator.platform == "Win32")) return;
+
+// $('img[src$=".png"]').each(function() {
+// if(!this.complete) {
+// this.onload = function() { $axure.utils.fixPng(this); };
+// } else {
+// $axure.utils.fixPng(this);
+// }
+// });
+// };
+
+// var _fixInputSize = function() {
+// if(Number(BROWSER_VERSION) >= 8 || window.navigator.userAgent.indexOf("Trident/4.0") > -1) return;
+// var inputs = $('input').not(':input[type=button], :input[type=submit], :input[type=radio], :input[type=checkbox]');
+// inputs.each(function() {
+// var $input = $(this);
+// var axInput = $ax('#' + $input.attr('id'));
+// $input.css('height', (axInput.height() - 4 + 'px')).css('width', (axInput.width() - 2 + 'px'));
+// });
+
+// var textAreas = $($ax.constants.TEXT_AREA_TYPE);
+// textAreas.each(function() {
+// var $textArea = $(this);
+// var axText = $ax('#' + $textArea.attr('id'));
+// $textArea.css('height', (axText.height() - 6 + 'px')).css('width', (axText.width() - 6 + 'px'));
+// });
+// };
+
+// var _fixInputBackground = function() {
+// var inputs = $('input').not(':input[type=button], :input[type=submit], :input[type=radio], :input[type=checkbox]');
+// inputs = inputs.add($($ax.constants.TEXT_AREA_TYPE));
+// inputs.each(function() {
+// var $input = $(this);
+// if($input.css('background-color') == 'transparent') {
+// $input.css('background-image', 'url(../../transparent.gif)');
+// } else {
+// $input.css('background-image', '');
+// }
+// });
+// };
+
+// $(document).ready(function() {
+// _fixIEStretchBackground();
+// _applyIEFixedPosition();
+// $axure.resize(function() {
+// _resizeIEBackground();
+// });
+// $ax.adaptive.bind('viewChanged', function() {
+// _fixIEStretchBackground();
+// _applyBackground();
+// _fixInputBackground();
+// });
+
+
+// _fixAllPngs();
+// _applyIERotation();
+// _applyBackground();
+// _fixInputSize();
+// _fixInputBackground();
+// });
+
+
+//});
diff --git a/src/原型系统/resources/scripts/axure/init.temp.js b/src/原型系统/resources/scripts/axure/init.temp.js
new file mode 100644
index 0000000..a6869f1
--- /dev/null
+++ b/src/原型系统/resources/scripts/axure/init.temp.js
@@ -0,0 +1,326 @@
+$axure.internal(function($ax) {
+
+ $(window.document).ready(function () {
+
+ //var readyStart = (new Date()).getTime();
+
+ //this is because the page id is not formatted as a guid
+ var pageId = $ax.pageData.page.packageId;
+
+ var pageData = {
+ id: pageId,
+ pageName: $ax.pageData.page.name,
+ location: window.location.toString(),
+ notes: $ax.pageData.page.notes,
+ widgetNotes: $ax.pageData.page.annotations,
+ //clipToView: $ax.pageData.clipToView,
+ defaultAdaptiveView: $ax.pageData.defaultAdaptiveView,
+ adaptiveViews: $ax.pageData.adaptiveViews,
+ masterNotes: []
+ };
+
+ var fnPrefix = '';
+ function pushNextPrefix() {
+ if (fnPrefix.length == 0) fnPrefix = 'A';
+ else fnPrefix = fnPrefix[0] == 'Z' ? 'A'.repeat(fnPrefix.length + 1) : String.fromCharCode(fnPrefix.charCodeAt(0) + 1).repeat(fnPrefix.length);
+ }
+
+ function populateNotes(pageForNotes) {
+ for (var master in pageForNotes.masters) {
+ //var master = pageForNotes.masters[i];
+ var masterData = pageForNotes.masters[master];
+ var hasWidgetNotes = masterData.annotations && masterData.annotations.length > 0;
+ if ((master.notes && !$.isEmptyObject(masterData.notes)) || hasWidgetNotes) {
+ if(hasWidgetNotes) pushNextPrefix();
+ var m = {};
+ m.pageName = masterData.name;
+ m.notes = masterData.notes;
+ m.widgetNotes = masterData.annotations;
+ pageData.masterNotes.push(m);
+ if(hasWidgetNotes) populateOwnerToFn(m.widgetNotes);
+ }
+ populateNotes(master);
+ }
+ }
+
+ var ownerToFns = {};
+ function populateOwnerToFn(widgetNotes) {
+ if(typeof widgetNotes == 'undefined') return false;
+ for (var i = 0; i < widgetNotes.length; i++) {
+ var widgetNote = widgetNotes[i];
+ widgetNote['fn'] = fnPrefix + widgetNote['fn'];
+ var fn = widgetNote['fn'];
+ var ownerId = widgetNote['ownerId'];
+ if (ownerId !== undefined && ownerId.length > 0) {
+ var ownerLabels = ownerToFns[ownerId];
+ if (ownerLabels == undefined) ownerLabels = [];
+ ownerLabels.push(fn);
+ ownerToFns[ownerId] = ownerLabels;
+ }
+ }
+ }
+
+ populateOwnerToFn(pageData.widgetNotes);
+ populateNotes($ax.pageData);
+ pageData.ownerToFns = ownerToFns;
+
+ $ax.pageData.notesData = pageData;
+
+ //var anns = [];
+ //$ax('*').each(function (dObj, elementId) {
+ // pushAnnotation(dObj, elementId);
+ //});
+
+ //function pushAnnotation(dObj, elementId) {
+ // var ann = dObj.annotation;
+ // if(ann) {
+ // ann = $ax.deepCopy(ann);
+ // ann["id"] = elementId;
+ // ann["label"] = dObj.label + " (" + dObj.friendlyType + ")";
+ // anns.push(ann);
+ // }
+
+ // if(dObj.type === 'repeater' && dObj.objects) {
+ // //if it's repeater, save the id as repeaterId@scriptId
+ // for(var i = 0, len = dObj.objects.length; i < len; i++) {
+ // var child = dObj.objects[i];
+ // var scriptId = $ax.getScriptIdFromPath([child.id], elementId);
+ // pushAnnotation(child, elementId + '@' + scriptId);
+ // }
+ // }
+ //}
+
+ //pageData.widgetNotes = anns;
+
+ //only trigger the page.data setting if the window is on the mainframe
+ var isMainFrame = false;
+ try {
+ if(window.name == 'mainFrame' ||
+ (!CHROME_5_LOCAL && window.parent.$ && window.parent.$('#mainFrame').length > 0)) {
+ isMainFrame = true;
+
+ $ax.messageCenter.addMessageListener(function(message, data) {
+ if(message == 'finishInit') {
+ _processTempInit();
+ }
+ });
+
+ $axure.messageCenter.setState('page.data', pageData);
+ window.focus();
+ }
+ } catch(e) { }
+
+ //attach here for chrome local
+ //$(window).on('load', function() {
+ // $ax.style.initializeObjectTextAlignment($ax('*'));
+ //});
+
+ if(!isMainFrame) _processTempInit();
+ });
+
+ var touchCount = 0;
+ var lastTouch = Date.now();
+ var _registerTouchCount = $ax.registerTouchCount = function (e) {
+ var now = Date.now();
+ if (now - lastTouch < 375) {
+ if (++touchCount === 3) {
+ $(':input').blur();
+ $ax.messageCenter.postMessage('tripleClick', true);
+ e.preventDefault();
+ };
+ } else {
+ touchCount = 1;
+ }
+ lastTouch = now;
+ };
+
+ // Block IOS stalling second tap.
+ // Stop third click from also clicking mobile card
+ var _clearTouchCount = $ax.clearTouchCount = function (e) {
+ if (touchCount === 3) {
+ touchCount = 0;
+ e.preventDefault();
+ }
+ };
+
+ var _processTempInit = function() {
+ //var start = (new Date()).getTime();
+ //var end = (new Date()).getTime();
+ //window.alert('elapsed ' + (end - start));
+
+ $('iframe').each(function() {
+ var origSrc = $(this).attr('basesrc');
+
+ var $this = $(this);
+ if(origSrc) {
+ var newSrcUrl = origSrc.toLowerCase().indexOf('http://') == -1 ? $ax.globalVariableProvider.getLinkUrl(origSrc) : origSrc;
+ $this.attr('src', newSrcUrl);
+ }
+
+ if(IOS) {
+ $this.parent().css('overflow', 'auto').css('-webkit-overflow-scrolling', 'touch').css('-ms-overflow-x', 'hidden').css('overflow-x', 'hidden');
+ }
+ });
+
+ $axure.messageCenter.addMessageListener(function(message, data) {
+ if(message == 'setGlobalVar') {
+ $ax.globalVariableProvider.setVariableValue(data.globalVarName, data.globalVarValue, true);
+ }
+ });
+
+ window.lastFocusedClickable = null;
+ var _lastFocusedClickableSelector = 'input, a';
+ var shouldOutline = true;
+
+ $ax(function (dObj) { return dObj.tabbable; }).each(function (dObj, elementId) {
+ if ($ax.public.fn.IsLayer(dObj.type)) $ax.event.layerMapFocus(dObj, elementId);
+ var focusableId = $ax.event.getFocusableWidgetOrChildId(elementId);
+ var $focusable = $('#' + focusableId);
+ $focusable.attr("tabIndex", 0);
+ if($focusable.is('div') || $focusable.is('img')) {
+ $focusable.bind($ax.features.eventNames.mouseDownName, function() {
+ shouldOutline = false;
+ });
+ attachFocusAndBlur($focusable);
+ }
+ });
+
+ $(window.document).bind($ax.features.eventNames.mouseUpName, function() {
+ shouldOutline = true;
+ });
+
+ attachFocusAndBlur($(_lastFocusedClickableSelector));
+
+ function attachFocusAndBlur($query) {
+ $query.focus(function () {
+ if(shouldOutline) {
+ $(this).css('outline', '');
+ } else {
+ $(this).css('outline', 'none');
+ }
+ window.lastFocusedClickable = this;
+ }).blur(function () {
+ if(window.lastFocusedClickable == this) window.lastFocusedClickable = null;
+ });
+ }
+
+ $(window.document).bind('keyup', function (e) {
+ switch(e.which) {
+ case 13:
+ case 32:
+ if(window.lastFocusedClickable) $(window.lastFocusedClickable).click();
+ break;
+ default: return; // exit this handler for other keys
+ }
+ });
+
+ //if($ax.document.configuration.hideAddress) {
+ // $(window).on('load', function() {
+ // window.setTimeout(function() {
+ // window.scrollTo(0, 0.9);
+ // }, 0);
+ // });
+ //}
+
+ //if($ax.document.configuration.preventScroll) {
+ // $(window.document).bind('touchmove', function(e) {
+ // var inScrollable = $ax.legacy.GetScrollable(e.target) != window.document.body;
+ // if(!inScrollable) {
+ // e.preventDefault();
+ // }
+ // });
+
+ // $ax(function(diagramObject) {
+ // return $ax.public.fn.IsDynamicPanel(diagramObject.type) && diagramObject.scrollbars != 'none';
+ // }).$().children().bind('touchstart', function() {
+ // var target = this;
+ // var top = target.scrollTop;
+ // if(top <= 0) target.scrollTop = 1;
+ // if(top + target.offsetHeight >= target.scrollHeight) target.scrollTop = target.scrollHeight - target.offsetHeight - 1;
+ // });
+ //}
+
+ if(OS_MAC && WEBKIT) {
+ $ax(function(diagramObject) {
+ return $ax.public.fn.IsComboBox(diagramObject.type);
+ }).each(function(obj, id) {
+ $jobj($ax.INPUT(id)).css('-webkit-appearance', 'menulist-button');
+ });
+ }
+
+ if($ax.features.supports.mobile) {
+ $('html').first().on('touchstart', _registerTouchCount);
+ $('html').first().on('touchend', _clearTouchCount);
+
+ // Stop pinch zoom (stopping all gestures for now)
+ // Gesturestart is only supported in Safari
+ if (SAFARI) {
+ document.addEventListener("gesturestart", function (e) {
+ e.preventDefault();
+ });
+ }
+ }
+
+ $ax.annotation.initialize();
+
+ $ax.legacy.BringFixedToFront();
+ $ax.event.initialize();
+ $ax.style.initialize();
+ $ax.visibility.initialize();
+ $ax.repeater.initialize();
+ $ax.dynamicPanelManager.initialize(); //needs to be called after visibility is initialized
+ $ax.adaptive.initialize();
+ $ax.loadDynamicPanelsAndMasters();
+ $ax.adaptive.loadFinished();
+ var start = (new Date()).getTime();
+ $ax.repeater.initRefresh();
+ var end = (new Date()).getTime();
+ console.log('loadTime: ' + (end - start) / 1000);
+ $ax.style.prefetch();
+
+ $(window).resize();
+
+ //var readyEnd = (new Date()).getTime();
+ //window.alert('elapsed ' + (readyEnd - readyStart));
+ };
+});
+
+/* extend canvas */
+var gv_hasCanvas = false;
+(function() {
+ var _canvas = document.createElement('canvas'), proto, abbrev;
+ if(gv_hasCanvas = !!(_canvas.getContext && _canvas.getContext('2d')) && typeof (CanvasGradient) !== 'undefined') {
+ function chain(func) {
+ return function() {
+ return func.apply(this, arguments) || this;
+ };
+ }
+
+ with(proto = CanvasRenderingContext2D.prototype) for(var func in abbrev = {
+ a: arc,
+ b: beginPath,
+ n: clearRect,
+ c: clip,
+ p: closePath,
+ g: createLinearGradient,
+ f: fill,
+ j: fillRect,
+ z: function(s) { this.fillStyle = s; },
+ l: lineTo,
+ w: function(w) { this.lineWidth = w; },
+ m: moveTo,
+ q: quadraticCurveTo,
+ h: rect,
+ r: restore,
+ o: rotate,
+ s: save,
+ x: scale,
+ y: function(s) { this.strokeStyle = s; },
+ u: setTransform,
+ k: stroke,
+ i: strokeRect,
+ t: translate
+ }) proto[func] = chain(abbrev[func]);
+ CanvasGradient.prototype.a = chain(CanvasGradient.prototype.addColorStop);
+ }
+})();
diff --git a/src/原型系统/resources/scripts/axure/ios.js b/src/原型系统/resources/scripts/axure/ios.js
new file mode 100644
index 0000000..15333b7
--- /dev/null
+++ b/src/原型系统/resources/scripts/axure/ios.js
@@ -0,0 +1,91 @@
+$axure.internal(function ($ax) {
+ if ((IOS && SAFARI) || SHARE_APP) {
+ var outerHtml = document.documentElement;
+ outerHtml.id = 'ios-safari';
+ var html = document.createElement('html');
+ html.id = 'ios-safari-html';
+ outerHtml.appendChild(html);
+ var body = document.body;
+ html.appendChild(body);
+ Object.defineProperty(document, 'body', {
+ get: function () {
+ return body;
+ }
+ });
+ var fixedBody = document.createElement('body');
+ fixedBody.id = 'ios-safari-fixed';
+ outerHtml.appendChild(fixedBody);
+ var fixedBase = document.createElement('div');
+ fixedBase.id = 'base-fixed';
+ fixedBody.appendChild(fixedBase);
+
+ var isDevice = false;
+ var deviceWidth = 0;
+ var updateHtmlWidth = function (panelWidthOffset, scale, height, scaleN) {
+ var iosSafHtml = $('#ios-safari-html');
+ iosSafHtml.css('overflow', '');
+ iosSafHtml.css('overflow-x', '');
+ iosSafHtml.css('height', '');
+ if (isDevice) {
+ iosSafHtml.width(deviceWidth / scaleN);
+ iosSafHtml.css('overflow-x', 'hidden');
+ } else {
+ var isLandscape = window.orientation != 0 && window.orientation != 180;
+ var mobileWidth = isLandscape ? window.screen.height : window.screen.width
+ iosSafHtml.width((mobileWidth - panelWidthOffset) / scaleN);
+ }
+ if (scale == 1) {
+ iosSafHtml.css('overflow-x', 'hidden');
+ iosSafHtml.css('height', (height / scaleN) + 'px');
+ } else if (scale == 2) iosSafHtml.css('overflow', 'hidden');
+ };
+
+ updateHtmlWidth(0);
+
+ $axure('*').each(function (obj, element) {
+ if (obj && obj.fixedVertical && obj.fixedKeepInFront) {
+ var parent = $axure('#' + element).getParents(false, ['item', 'state'])[0];
+ if (!parent) {
+ $('#base-fixed').append($('#' + element));
+ }
+ }
+ });
+
+ $axure.messageCenter.addMessageListener(function (message, data) {
+ if (message == "setContentScale") {
+ updateHtmlWidth(data.panelWidthOffset, data.scale, data.viewportHeight, data.scaleN);
+ } else if (message == "setDeviceMode") {
+ isDevice = data.device && !data.scaleToWidth;
+ if (isDevice) deviceWidth = data.width;
+ updateHtmlWidth(0);
+ }
+ });
+
+
+ $('#ios-safari-html').scroll(function () {
+ $axure.updateWindowInfo();
+ });
+
+ var scrollStartY;
+ var maxScrollY
+ var touchStart;
+ $axure('*').each(function (obj, element) {
+ if (obj && obj.scrollbars && obj.scrollbars.toLowerCase() != 'none') {
+ if (obj.scrollbars == 'horizontalAsNeeded') return;
+
+ $('#' + element).on('touchstart', function (e) {
+ touchStart = e.pageY;
+ var stateId = $ax.visibility.GetPanelState($('#' + element).attr('id'));
+ scrollStartY = $('#' + stateId).scrollTop();
+ maxScrollY = $('#' + stateId)[0].scrollHeight - $('#' + stateId).height();
+ });
+
+ $('#' + element).on('touchmove', function (e) {
+ if (maxScrollY <= 0) return false;
+ if (scrollStartY == 0 && e.pageY > touchStart) e.preventDefault();
+ if (scrollStartY == maxScrollY && e.pageY < touchStart) e.preventDefault();
+ });
+ }
+ });
+ }
+});
\ No newline at end of file
diff --git a/src/原型系统/resources/scripts/axure/jquery.nicescroll.min.js b/src/原型系统/resources/scripts/axure/jquery.nicescroll.min.js
new file mode 100644
index 0000000..cfa5e75
--- /dev/null
+++ b/src/原型系统/resources/scripts/axure/jquery.nicescroll.min.js
@@ -0,0 +1 @@
+!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){"use strict";var o=!1,t=!1,r=0,i=2e3,s=0,n=e,l=document,a=window,c=n(a),d=[];var u=a.requestAnimationFrame||a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||!1,h=a.cancelAnimationFrame||a.webkitCancelAnimationFrame||a.mozCancelAnimationFrame||!1;if(u)a.cancelAnimationFrame||(h=function(e){});else{var p=0;u=function(e,o){var t=(new Date).getTime(),r=Math.max(0,16-(t-p)),i=a.setTimeout(function(){e(t+r)},r);return p=t+r,i},h=function(e){a.clearTimeout(e)}}var m,f,g,v=a.MutationObserver||a.WebKitMutationObserver||!1,w=Date.now||function(){return(new Date).getTime()},b={zindex:"auto",cursoropacitymin:0,cursoropacitymax:1,cursorcolor:"#424242",cursorwidth:"6px",cursorborder:"1px solid #fff",cursorborderradius:"5px",scrollspeed:40,mousescrollstep:27,touchbehavior:!1,emulatetouch:!1,hwacceleration:!0,usetransition:!0,boxzoom:!1,dblclickzoom:!0,gesturezoom:!0,grabcursorenabled:!0,autohidemode:!0,background:"",iframeautoresize:!0,cursorminheight:32,preservenativescrolling:!0,railoffset:!1,railhoffset:!1,bouncescroll:!0,spacebarenabled:!0,railpadding:{top:0,right:0,left:0,bottom:0},disableoutline:!0,horizrailenabled:!0,railalign:"right",railvalign:"bottom",enabletranslate3d:!0,enablemousewheel:!0,enablekeyboard:!0,smoothscroll:!0,sensitiverail:!0,enablemouselockapi:!0,cursorfixedheight:!1,directionlockdeadzone:6,hidecursordelay:400,nativeparentscrolling:!0,enablescrollonselection:!0,overflowx:!0,overflowy:!0,cursordragspeed:.3,rtlmode:"auto",cursordragontouch:!1,oneaxismousemode:"auto",scriptpath:(f=l.currentScript||!!(m=l.getElementsByTagName("script")).length&&m[m.length-1],g=f?f.src.split("?")[0]:"",g.split("/").length>0?g.split("/").slice(0,-1).join("/")+"/":""),preventmultitouchscrolling:!0,disablemutationobserver:!1,enableobserver:!0,scrollbarid:!1},y=!1,x=function(e,p){var m=this;this.version="3.7.6",this.name="nicescroll",this.me=p;var f=n("body"),g=this.opt={doc:f,win:!1};if(n.extend(g,b),g.snapbackspeed=80,e)for(var x in g)void 0!==e[x]&&(g[x]=e[x]);if(g.disablemutationobserver&&(v=!1),this.doc=g.doc,this.iddoc=this.doc&&this.doc[0]&&this.doc[0].id||"",this.ispage=/^BODY|HTML/.test(g.win?g.win[0].nodeName:this.doc[0].nodeName),this.haswrapper=!1!==g.win,this.win=g.win||(this.ispage?c:this.doc),this.docscroll=this.ispage&&!this.haswrapper?c:this.win,this.body=f,this.viewport=!1,this.isfixed=!1,this.iframe=!1,this.isiframe="IFRAME"==this.doc[0].nodeName&&"IFRAME"==this.win[0].nodeName,this.istextarea="TEXTAREA"==this.win[0].nodeName,this.forcescreen=!1,this.canshowonmouseevent="scroll"!=g.autohidemode,this.onmousedown=!1,this.onmouseup=!1,this.onmousemove=!1,this.onmousewheel=!1,this.onkeypress=!1,this.ongesturezoom=!1,this.onclick=!1,this.onscrollstart=!1,this.onscrollend=!1,this.onscrollcancel=!1,this.onzoomin=!1,this.onzoomout=!1,this.view=!1,this.page=!1,this.scroll={x:0,y:0},this.scrollratio={x:0,y:0},this.cursorheight=20,this.scrollvaluemax=0,"auto"==g.rtlmode){var z=this.win[0]==a?this.body:this.win,k=z.css("writing-mode")||z.css("-webkit-writing-mode")||z.css("-ms-writing-mode")||z.css("-moz-writing-mode");"horizontal-tb"==k||"lr-tb"==k||""===k?(this.isrtlmode="rtl"==z.css("direction"),this.isvertical=!1):(this.isrtlmode="vertical-rl"==k||"tb"==k||"tb-rl"==k||"rl-tb"==k,this.isvertical="vertical-rl"==k||"tb"==k||"tb-rl"==k)}else this.isrtlmode=!0===g.rtlmode,this.isvertical=!1;if(this.scrollrunning=!1,this.scrollmom=!1,this.observer=!1,this.observerremover=!1,this.observerbody=!1,!1!==g.scrollbarid)this.id=g.scrollbarid;else do{this.id="ascrail"+i++}while(l.getElementById(this.id));this.rail=!1,this.cursor=!1,this.cursorfreezed=!1,this.selectiondrag=!1,this.zoom=!1,this.zoomactive=!1,this.hasfocus=!1,this.hasmousefocus=!1,this.railslocked=!1,this.locked=!1,this.hidden=!1,this.cursoractive=!0,this.wheelprevented=!1,this.overflowx=g.overflowx,this.overflowy=g.overflowy,this.nativescrollingarea=!1,this.checkarea=0,this.events=[],this.saved={},this.delaylist={},this.synclist={},this.lastdeltax=0,this.lastdeltay=0,this.detected=function(){if(y)return y;var e=l.createElement("DIV"),o=e.style,t=navigator.userAgent,r=navigator.platform,i={};return i.haspointerlock="pointerLockElement"in l||"webkitPointerLockElement"in l||"mozPointerLockElement"in l,i.isopera="opera"in a,i.isopera12=i.isopera&&"getUserMedia"in navigator,i.isoperamini="[object OperaMini]"===Object.prototype.toString.call(a.operamini),i.isie="all"in l&&"attachEvent"in e&&!i.isopera,i.isieold=i.isie&&!("msInterpolationMode"in o),i.isie7=i.isie&&!i.isieold&&(!("documentMode"in l)||7===l.documentMode),i.isie8=i.isie&&"documentMode"in l&&8===l.documentMode,i.isie9=i.isie&&"performance"in a&&9===l.documentMode,i.isie10=i.isie&&"performance"in a&&10===l.documentMode,i.isie11="msRequestFullscreen"in e&&l.documentMode>=11,i.ismsedge="msCredentials"in a,i.ismozilla="MozAppearance"in o,i.iswebkit=!i.ismsedge&&"WebkitAppearance"in o,i.ischrome=i.iswebkit&&"chrome"in a,i.ischrome38=i.ischrome&&"touchAction"in o,i.ischrome22=!i.ischrome38&&i.ischrome&&i.haspointerlock,i.ischrome26=!i.ischrome38&&i.ischrome&&"transition"in o,i.cantouch="ontouchstart"in l.documentElement||"ontouchstart"in a,i.hasw3ctouch=!!a.PointerEvent&&(navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0),i.hasmstouch=!i.hasw3ctouch&&(a.MSPointerEvent||!1),i.ismac=/^mac$/i.test(r),i.isios=i.cantouch&&/iphone|ipad|ipod/i.test(r),i.isios4=i.isios&&!("seal"in Object),i.isios7=i.isios&&"webkitHidden"in l,i.isios8=i.isios&&"hidden"in l,i.isios10=i.isios&&a.Proxy,i.isandroid=/android/i.test(t),i.haseventlistener="addEventListener"in e,i.trstyle=!1,i.hastransform=!1,i.hastranslate3d=!1,i.transitionstyle=!1,i.hastransition=!1,i.transitionend=!1,i.trstyle="transform",i.hastransform="transform"in o||function(){for(var e=["msTransform","webkitTransform","MozTransform","OTransform"],t=0,r=e.length;t=1?this.ed:this.st+this.df*o|0},update:function(e,o){return this.st=this.getNow(),this.ed=e,this.spd=o,this.ts=w(),this.df=this.ed-this.st,this}},this.ishwscroll){this.doc.translate={x:0,y:0,tx:"0px",ty:"0px"},T.hastranslate3d&&T.isios&&this.doc.css("-webkit-backface-visibility","hidden"),this.getScrollTop=function(e){if(!e){var o=M();if(o)return 16==o.length?-o[13]:-o[5];if(m.timerscroll&&m.timerscroll.bz)return m.timerscroll.bz.getNow()}return m.doc.translate.y},this.getScrollLeft=function(e){if(!e){var o=M();if(o)return 16==o.length?-o[12]:-o[4];if(m.timerscroll&&m.timerscroll.bh)return m.timerscroll.bh.getNow()}return m.doc.translate.x},this.notifyScrollEvent=function(e){var o=l.createEvent("UIEvents");o.initUIEvent("scroll",!1,!1,a,1),o.niceevent=!0,e.dispatchEvent(o)};var L=this.isrtlmode?1:-1;T.hastranslate3d&&g.enabletranslate3d?(this.setScrollTop=function(e,o){m.doc.translate.y=e,m.doc.translate.ty=-1*e+"px",m.doc.css(T.trstyle,"translate3d("+m.doc.translate.tx+","+m.doc.translate.ty+",0)"),o||m.notifyScrollEvent(m.win[0])},this.setScrollLeft=function(e,o){m.doc.translate.x=e,m.doc.translate.tx=e*L+"px",m.doc.css(T.trstyle,"translate3d("+m.doc.translate.tx+","+m.doc.translate.ty+",0)"),o||m.notifyScrollEvent(m.win[0])}):(this.setScrollTop=function(e,o){m.doc.translate.y=e,m.doc.translate.ty=-1*e+"px",m.doc.css(T.trstyle,"translate("+m.doc.translate.tx+","+m.doc.translate.ty+")"),o||m.notifyScrollEvent(m.win[0])},this.setScrollLeft=function(e,o){m.doc.translate.x=e,m.doc.translate.tx=e*L+"px",m.doc.css(T.trstyle,"translate("+m.doc.translate.tx+","+m.doc.translate.ty+")"),o||m.notifyScrollEvent(m.win[0])})}else this.getScrollTop=function(){return m.docscroll.scrollTop()},this.setScrollTop=function(e){m.docscroll.scrollTop(e)},this.getScrollLeft=function(){return m.hasreversehr?m.detected.ismozilla?m.page.maxw-Math.abs(m.docscroll.scrollLeft()):m.page.maxw-m.docscroll.scrollLeft():m.docscroll.scrollLeft()},this.setScrollLeft=function(e){return setTimeout(function(){if(m)return m.hasreversehr&&(e=m.detected.ismozilla?-(m.page.maxw-e):m.page.maxw-e),m.docscroll.scrollLeft(e)},1)};this.getTarget=function(e){return!!e&&(e.target?e.target:!!e.srcElement&&e.srcElement)},this.hasParent=function(e,o){if(!e)return!1;for(var t=e.target||e.srcElement||e||!1;t&&t.id!=o;)t=t.parentNode||!1;return!1!==t};var C={thin:1,medium:3,thick:5};function N(e,o,t){var r=e.css(o),i=parseFloat(r);if(isNaN(i)){var s=3==(i=C[r]||0)?t?m.win.outerHeight()-m.win.innerHeight():m.win.outerWidth()-m.win.innerWidth():1;return m.isie8&&i&&(i+=1),s?i:0}return i}this.getDocumentScrollOffset=function(){return{top:a.pageYOffset||l.documentElement.scrollTop,left:a.pageXOffset||l.documentElement.scrollLeft}},this.getOffset=function(){if(m.isfixed){var e=m.win.offset(),o=m.getDocumentScrollOffset();return e.top-=o.top,e.left-=o.left,e}var t=m.win.offset();if(!m.viewport)return t;var r=m.viewport.offset();return{top:t.top-r.top,left:t.left-r.left}},this.updateScrollBar=function(e){var o,t;if(m.ishwscroll)m.rail.css({height:m.win.innerHeight()-(g.railpadding.top+g.railpadding.bottom)}),m.railh&&m.railh.css({width:m.win.innerWidth()-(g.railpadding.left+g.railpadding.right)});else{var r=m.getOffset();if((o={top:r.top,left:r.left-(g.railpadding.left+g.railpadding.right)}).top+=N(m.win,"border-top-width",!0),o.left+=m.rail.align?m.win.outerWidth()-N(m.win,"border-right-width")-m.rail.width:N(m.win,"border-left-width"),(t=g.railoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left)),m.railslocked||m.rail.css({top:o.top,left:o.left,height:(e?e.h:m.win.innerHeight())-(g.railpadding.top+g.railpadding.bottom)}),m.zoom&&m.zoom.css({top:o.top+1,left:1==m.rail.align?o.left-20:o.left+m.rail.width+4}),m.railh&&!m.railslocked){o={top:r.top,left:r.left},(t=g.railhoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left));var i=m.railh.align?o.top+N(m.win,"border-top-width",!0)+m.win.innerHeight()-m.railh.height:o.top+N(m.win,"border-top-width",!0),s=o.left+N(m.win,"border-left-width");m.railh.css({top:i-(g.railpadding.top+g.railpadding.bottom),left:s,width:m.railh.width})}}},this.doRailClick=function(e,o,t){var r,i,s,n;m.railslocked||(m.cancelEvent(e),"pageY"in e||(e.pageX=e.clientX+l.documentElement.scrollLeft,e.pageY=e.clientY+l.documentElement.scrollTop),o?(r=t?m.doScrollLeft:m.doScrollTop,s=t?(e.pageX-m.railh.offset().left-m.cursorwidth/2)*m.scrollratio.x:(e.pageY-m.rail.offset().top-m.cursorheight/2)*m.scrollratio.y,m.unsynched("relativexy"),r(0|s)):(r=t?m.doScrollLeftBy:m.doScrollBy,s=t?m.scroll.x:m.scroll.y,n=t?e.pageX-m.railh.offset().left:e.pageY-m.rail.offset().top,i=t?m.view.w:m.view.h,r(s>=n?i:-i)))},m.newscrolly=m.newscrollx=0,m.hasanimationframe="requestAnimationFrame"in a,m.hascancelanimationframe="cancelAnimationFrame"in a,m.hasborderbox=!1,this.init=function(){if(m.saved.css=[],T.isoperamini)return!0;if(T.isandroid&&!("hidden"in l))return!0;g.emulatetouch=g.emulatetouch||g.touchbehavior,m.hasborderbox=a.getComputedStyle&&"border-box"===a.getComputedStyle(l.body)["box-sizing"];var e={"overflow-y":"hidden"};if((T.isie11||T.isie10)&&(e["-ms-overflow-style"]="none"),m.ishwscroll&&(this.doc.css(T.transitionstyle,T.prefixstyle+"transform 0ms ease-out"),T.transitionend&&m.bind(m.doc,T.transitionend,m.onScrollTransitionEnd,!1)),m.zindex="auto",m.ispage||"auto"!=g.zindex?m.zindex=g.zindex:m.zindex=function(){var e=m.win;if("zIndex"in e)return e.zIndex();for(;e.length>0;){if(9==e[0].nodeType)return!1;var o=e.css("zIndex");if(!isNaN(o)&&0!==o)return parseInt(o);e=e.parent()}return!1}()||"auto",!m.ispage&&"auto"!=m.zindex&&m.zindex>s&&(s=m.zindex),m.isie&&0===m.zindex&&"auto"==g.zindex&&(m.zindex="auto"),!m.ispage||!T.isieold){var i=m.docscroll;m.ispage&&(i=m.haswrapper?m.win:m.doc),m.css(i,e),m.ispage&&(T.isie11||T.isie)&&m.css(n("html"),e),!T.isios||m.ispage||m.haswrapper||m.css(f,{"-webkit-overflow-scrolling":"touch"});var d=n(l.createElement("div"));d.css({position:"relative",top:0,float:"right",width:g.cursorwidth,height:0,"background-color":g.cursorcolor,border:g.cursorborder,"background-clip":"padding-box","-webkit-border-radius":g.cursorborderradius,"-moz-border-radius":g.cursorborderradius,"border-radius":g.cursorborderradius}),d.addClass("nicescroll-cursors"),m.cursor=d;var u=n(l.createElement("div"));u.attr("id",m.id),u.addClass("nicescroll-rails nicescroll-rails-vr");var h,p,w=["left","right","top","bottom"];for(var b in w)p=w[b],(h=g.railpadding[p]||0)&&u.css("padding-"+p,h+"px");u.append(d),u.width=Math.max(parseFloat(g.cursorwidth),d.outerWidth()),u.css({width:u.width+"px",zIndex:m.zindex,background:g.background,cursor:"default"}),u.visibility=!0,u.scrollable=!0,u.align="left"==g.railalign?0:1,m.rail=u,m.rail.drag=!1;var y,x=!1;if(!g.boxzoom||m.ispage||T.isieold||(x=l.createElement("div"),m.bind(x,"click",m.doZoom),m.bind(x,"mouseenter",function(){m.zoom.css("opacity",g.cursoropacitymax)}),m.bind(x,"mouseleave",function(){m.zoom.css("opacity",g.cursoropacitymin)}),m.zoom=n(x),m.zoom.css({cursor:"pointer",zIndex:m.zindex,backgroundImage:"url("+g.scriptpath+"zoomico.png)",height:18,width:18,backgroundPosition:"0 0"}),g.dblclickzoom&&m.bind(m.win,"dblclick",m.doZoom),T.cantouch&&g.gesturezoom&&(m.ongesturezoom=function(e){return e.scale>1.5&&m.doZoomIn(e),e.scale<.8&&m.doZoomOut(e),m.cancelEvent(e)},m.bind(m.win,"gestureend",m.ongesturezoom))),m.railh=!1,g.horizrailenabled&&(m.css(i,{overflowX:"hidden"}),(d=n(l.createElement("div"))).css({position:"absolute",top:0,height:g.cursorwidth,width:0,backgroundColor:g.cursorcolor,border:g.cursorborder,backgroundClip:"padding-box","-webkit-border-radius":g.cursorborderradius,"-moz-border-radius":g.cursorborderradius,"border-radius":g.cursorborderradius}),T.isieold&&d.css("overflow","hidden"),d.addClass("nicescroll-cursors"),m.cursorh=d,(y=n(l.createElement("div"))).attr("id",m.id+"-hr"),y.addClass("nicescroll-rails nicescroll-rails-hr"),y.height=Math.max(parseFloat(g.cursorwidth),d.outerHeight()),y.css({height:y.height+"px",zIndex:m.zindex,background:g.background}),y.append(d),y.visibility=!0,y.scrollable=!0,y.align="top"==g.railvalign?0:1,m.railh=y,m.railh.drag=!1),m.ispage)u.css({position:"fixed",top:0,height:"100%"}),u.css(u.align?{right:0}:{left:0}),m.body.append(u),m.railh&&(y.css({position:"fixed",left:0,width:"100%"}),y.css(y.align?{bottom:0}:{top:0}),m.body.append(y));else{if(m.ishwscroll){"static"==m.win.css("position")&&m.css(m.win,{position:"relative"});var z="HTML"==m.win[0].nodeName?m.body:m.win;n(z).scrollTop(0).scrollLeft(0),m.zoom&&(m.zoom.css({position:"absolute",top:1,right:0,"margin-right":u.width+4}),z.append(m.zoom)),u.css({position:"absolute",top:0}),u.css(u.align?{right:0}:{left:0}),z.append(u),y&&(y.css({position:"absolute",left:0,bottom:0}),y.css(y.align?{bottom:0}:{top:0}),z.append(y))}else{m.isfixed="fixed"==m.win.css("position");var k=m.isfixed?"fixed":"absolute";m.isfixed||(m.viewport=m.getViewport(m.win[0])),m.viewport&&(m.body=m.viewport,/fixed|absolute/.test(m.viewport.css("position"))||m.css(m.viewport,{position:"relative"})),u.css({position:k}),m.zoom&&m.zoom.css({position:k}),m.updateScrollBar(),m.body.append(u),m.zoom&&m.body.append(m.zoom),m.railh&&(y.css({position:k}),m.body.append(y))}T.isios&&m.css(m.win,{"-webkit-tap-highlight-color":"rgba(0,0,0,0)","-webkit-touch-callout":"none"}),g.disableoutline&&(T.isie&&m.win.attr("hideFocus","true"),T.iswebkit&&m.win.css("outline","none"))}if(!1===g.autohidemode?(m.autohidedom=!1,m.rail.css({opacity:g.cursoropacitymax}),m.railh&&m.railh.css({opacity:g.cursoropacitymax})):!0===g.autohidemode||"leave"===g.autohidemode?(m.autohidedom=n().add(m.rail),T.isie8&&(m.autohidedom=m.autohidedom.add(m.cursor)),m.railh&&(m.autohidedom=m.autohidedom.add(m.railh)),m.railh&&T.isie8&&(m.autohidedom=m.autohidedom.add(m.cursorh))):"scroll"==g.autohidemode?(m.autohidedom=n().add(m.rail),m.railh&&(m.autohidedom=m.autohidedom.add(m.railh))):"cursor"==g.autohidemode?(m.autohidedom=n().add(m.cursor),m.railh&&(m.autohidedom=m.autohidedom.add(m.cursorh))):"hidden"==g.autohidemode&&(m.autohidedom=!1,m.hide(),m.railslocked=!1),T.cantouch||m.istouchcapable||g.emulatetouch||T.hasmstouch){m.scrollmom=new S(m);m.ontouchstart=function(e){if(m.locked)return!1;if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;if(m.hasmoving=!1,m.scrollmom.timer&&(m.triggerScrollEnd(),m.scrollmom.stop()),!m.railslocked){var o=m.getTarget(e);if(o)if(/INPUT/i.test(o.nodeName)&&/range/i.test(o.type))return m.stopPropagation(e);var t="mousedown"===e.type;if(!("clientX"in e)&&"changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),m.forcescreen){var r=e;(e={original:e.original?e.original:e}).clientX=r.screenX,e.clientY=r.screenY}if(g.horizrailenabled?m.rail.drag={x:e.clientX,y:e.clientY,sx:m.scroll.x,sy:m.scroll.y,st:m.getScrollTop(),sl:m.getScrollLeft(),pt:2,dl:!1,tg:o}:m.rail.drag={x:0,y:e.clientY,sx:0,sy:m.scroll.y,st:m.getScrollTop(),sl:0,pt:2,dl:!1,tg:o},m.ispage||!g.directionlockdeadzone)m.rail.drag.dl="f";else{var i=c.width(),s=c.height(),l=m.getContentSize(),a=l.h-s,d=l.w-i;m.rail.scrollable&&!m.railh.scrollable?m.rail.drag.ck=a>0&&"v":!m.rail.scrollable&&m.railh.scrollable?m.rail.drag.ck=d>0&&"h":m.rail.drag.ck=!1}if(g.emulatetouch&&m.isiframe&&T.isie){var u=m.win.position();m.rail.drag.x+=u.left,m.rail.drag.y+=u.top}if(m.hasmoving=!1,m.lastmouseup=!1,g.horizrailenabled?m.scrollmom.reset(e.clientX,e.clientY):m.scrollmom.reset(0,e.clientY),o&&t){if(!/INPUT|SELECT|BUTTON|TEXTAREA/i.test(o.nodeName))return T.hasmousecapture&&o.setCapture(),g.emulatetouch?(o.onclick&&!o._onclick&&(o._onclick=o.onclick,o.onclick=function(e){if(m.hasmoving)return!1;o._onclick.call(this,e)}),m.cancelEvent(e)):m.stopPropagation(e);/SUBMIT|CANCEL|BUTTON/i.test(n(o).attr("type"))&&(m.preventclick={tg:o,click:!1})}}},m.ontouchend=function(e){if(!m.rail.drag)return!0;if(2==m.rail.drag.pt){if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;m.rail.drag=!1;var o="mouseup"===e.type;if(m.hasmoving&&(m.scrollmom.doMomentum(),m.lastmouseup=!0,m.hideCursor(),T.hasmousecapture&&l.releaseCapture(),o))return m.cancelEvent(e)}else if(1==m.rail.drag.pt)return m.onmouseup(e)};var E=g.emulatetouch&&m.isiframe&&!T.hasmousecapture,M=.3*g.directionlockdeadzone|0;m.ontouchmove=function(e,o){if(!m.rail.drag)return!0;if(e.targetTouches&&g.preventmultitouchscrolling&&e.targetTouches.length>1)return!0;if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!0;if(2==m.rail.drag.pt){var t,r;if("changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),r=t=0,E&&!o){var i=m.win.position();r=-i.left,t=-i.top}var s=e.clientY+t,n=s-m.rail.drag.y,a=e.clientX+r;g.horizrailenabled||(a=0+r);var c=a-m.rail.drag.x,d=m.rail.drag.st-n;if(m.ishwscroll&&g.bouncescroll)d<0?d=Math.round(d/2):d>m.page.maxh&&(d=m.page.maxh+Math.round((d-m.page.maxh)/2));else if(d<0?(d=0,s=0):d>m.page.maxh&&(d=m.page.maxh,s=0),0===s&&!m.hasmoving)return m.ispage||(m.rail.drag=!1),!0;var u=m.getScrollLeft();if(m.railh&&m.railh.scrollable&&(u=m.isrtlmode?c-m.rail.drag.sl:m.rail.drag.sl-c,m.ishwscroll&&g.bouncescroll?u<0?u=Math.round(u/2):u>m.page.maxw&&(u=m.page.maxw+Math.round((u-m.page.maxw)/2)):(u<0&&(u=0,a=0),u>m.page.maxw&&(u=m.page.maxw,a=0))),!m.hasmoving){if(m.rail.drag.y===e.clientY&&m.rail.drag.x===e.clientX)return m.cancelEvent(e);var h=Math.abs(n),p=Math.abs(c),f=g.directionlockdeadzone;if(m.rail.drag.ck?"v"==m.rail.drag.ck?p>f&&h<=M?m.rail.drag=!1:h>f&&(m.rail.drag.dl="v"):"h"==m.rail.drag.ck&&(h>f&&p<=M?m.rail.drag=!1:p>f&&(m.rail.drag.dl="h")):h>f&&p>f?m.rail.drag.dl="f":h>f?m.rail.drag.dl=p>M?"f":"v":p>f&&(m.rail.drag.dl=h>M?"f":"h"),!m.rail.drag.dl)return m.cancelEvent(e);g.horizrailenabled?m.triggerScrollStart(e.clientX,e.clientY,0,0,0):m.triggerScrollStart(0,e.clientY,0,0,0),m.hasmoving=!0}return m.preventclick&&!m.preventclick.click&&(m.preventclick.click=m.preventclick.tg.onclick||!1,m.preventclick.tg.onclick=m.onpreventclick),m.rail.drag.dl&&("v"==m.rail.drag.dl?u=m.rail.drag.sl:"h"==m.rail.drag.dl&&(d=m.rail.drag.st)),m.synched("touchmove",function(){m.rail.drag&&2==m.rail.drag.pt&&(m.prepareTransition&&m.resetTransition(),m.rail.scrollable&&m.setScrollTop(d),m.scrollmom.update(a,s),m.railh&&m.railh.scrollable?(m.setScrollLeft(u),m.showCursor(d,u)):m.showCursor(d),T.isie10&&l.selection.clear())}),m.cancelEvent(e)}return 1==m.rail.drag.pt?m.onmousemove(e):void 0},m.ontouchstartCursor=function(e,o){if(!m.rail.drag||3==m.rail.drag.pt){if(m.locked)return m.cancelEvent(e);m.cancelScroll(),g.horizrailenabled?m.rail.drag={x:e.touches[0].clientX,y:e.touches[0].clientY,sx:m.scroll.x,sy:m.scroll.y,pt:3,hr:!!o}:m.rail.drag={x:0,y:e.touches[0].clientY,sx:0,sy:m.scroll.y,pt:3,hr:!!o};var t=m.getTarget(e);return!m.ispage&&T.hasmousecapture&&t.setCapture(),m.isiframe&&!T.hasmousecapture&&(m.saved.csspointerevents=m.doc.css("pointer-events"),m.css(m.doc,{"pointer-events":"none"})),m.cancelEvent(e)}},m.ontouchendCursor=function(e){if(m.rail.drag){if(T.hasmousecapture&&l.releaseCapture(),m.isiframe&&!T.hasmousecapture&&m.doc.css("pointer-events",m.saved.csspointerevents),3!=m.rail.drag.pt)return;return m.rail.drag=!1,m.cancelEvent(e)}},m.ontouchmoveCursor=function(e){if(m.rail.drag){if(3!=m.rail.drag.pt)return;if(m.cursorfreezed=!0,m.rail.drag.hr){if(g.horizrailenabled){m.scroll.x=m.rail.drag.sx+(e.touches[0].clientX-m.rail.drag.x),m.scroll.x<0&&(m.scroll.x=0);var o=m.scrollvaluemaxw;m.scroll.x>o&&(m.scroll.x=o)}}else{m.scroll.y=m.rail.drag.sy+(e.touches[0].clientY-m.rail.drag.y),m.scroll.y<0&&(m.scroll.y=0);var t=m.scrollvaluemax;m.scroll.y>t&&(m.scroll.y=t)}return m.synched("touchmove",function(){m.rail.drag&&3==m.rail.drag.pt&&(m.showCursor(),m.rail.drag.hr?m.doScrollLeft(Math.round(m.scroll.x*m.scrollratio.x),g.cursordragspeed):m.doScrollTop(Math.round(m.scroll.y*m.scrollratio.y),g.cursordragspeed))}),m.cancelEvent(e)}}}if(m.onmousedown=function(e,o){if(!m.rail.drag||1==m.rail.drag.pt){if(m.railslocked)return m.cancelEvent(e);m.cancelScroll(),g.horizrailenabled?m.rail.drag={x:e.clientX,y:e.clientY,sx:m.scroll.x,sy:m.scroll.y,pt:1,hr:o||!1}:m.rail.drag={x:0,y:e.clientY,sx:0,sy:m.scroll.y,pt:1,hr:o||!1};var t=m.getTarget(e);return T.hasmousecapture&&t.setCapture(),m.isiframe&&!T.hasmousecapture&&(m.saved.csspointerevents=m.doc.css("pointer-events"),m.css(m.doc,{"pointer-events":"none"})),m.hasmoving=!1,m.cancelEvent(e)}},m.onmouseup=function(e){if(m.rail.drag)return 1!=m.rail.drag.pt||(T.hasmousecapture&&l.releaseCapture(),m.isiframe&&!T.hasmousecapture&&m.doc.css("pointer-events",m.saved.csspointerevents),m.rail.drag=!1,m.cursorfreezed=!1,m.hasmoving&&m.triggerScrollEnd(),m.cancelEvent(e))},m.onmousemove=function(e){if(m.rail.drag){if(1!==m.rail.drag.pt)return;if(T.ischrome&&0===e.which)return m.onmouseup(e);if(m.cursorfreezed=!0,g.horizrailenabled?m.hasmoving||m.triggerScrollStart(e.clientX,e.clientY,0,0,0):m.hasmoving||m.triggerScrollStart(0,e.clientY,0,0,0),m.hasmoving=!0,m.rail.drag.hr){if(g.horizrailenabled){m.scroll.x=m.rail.drag.sx+(e.clientX-m.rail.drag.x),m.scroll.x<0&&(m.scroll.x=0);var o=m.scrollvaluemaxw;m.scroll.x>o&&(m.scroll.x=o)}}else{m.scroll.y=m.rail.drag.sy+(e.clientY-m.rail.drag.y),m.scroll.y<0&&(m.scroll.y=0);var t=m.scrollvaluemax;m.scroll.y>t&&(m.scroll.y=t)}return m.synched("mousemove",function(){m.cursorfreezed&&(m.showCursor(),m.rail.drag.hr?m.scrollLeft(Math.round(m.scroll.x*m.scrollratio.x)):m.scrollTop(Math.round(m.scroll.y*m.scrollratio.y)))}),m.cancelEvent(e)}m.checkarea=0},T.cantouch||g.emulatetouch)m.onpreventclick=function(e){if(m.preventclick)return m.preventclick.tg.onclick=m.preventclick.click,m.preventclick=!1,m.cancelEvent(e)},m.onclick=!T.isios&&function(e){return!m.lastmouseup||(m.lastmouseup=!1,m.cancelEvent(e))},g.grabcursorenabled&&T.cursorgrabvalue&&(m.css(m.ispage?m.doc:m.win,{cursor:T.cursorgrabvalue}),m.css(m.rail,{cursor:T.cursorgrabvalue}));else{var L=function(e){if(m.selectiondrag){if(e){var o=m.win.outerHeight(),t=e.pageY-m.selectiondrag.top;t>0&&t=o&&(t-=o),m.selectiondrag.df=t}if(0!==m.selectiondrag.df){var r=-2*m.selectiondrag.df/6|0;m.doScrollBy(r),m.debounced("doselectionscroll",function(){L()},50)}}};m.hasTextSelected="getSelection"in l?function(){return l.getSelection().rangeCount>0}:"selection"in l?function(){return"None"!=l.selection.type}:function(){return!1},m.onselectionstart=function(e){m.ispage||(m.selectiondrag=m.win.offset())},m.onselectionend=function(e){m.selectiondrag=!1},m.onselectiondrag=function(e){m.selectiondrag&&m.hasTextSelected()&&m.debounced("selectionscroll",function(){L(e)},250)}}if(T.hasw3ctouch?(m.css(m.ispage?n("html"):m.win,{"touch-action":"none"}),m.css(m.rail,{"touch-action":"none"}),m.css(m.cursor,{"touch-action":"none"}),m.bind(m.win,"pointerdown",m.ontouchstart),m.bind(l,"pointerup",m.ontouchend),m.delegate(l,"pointermove",m.ontouchmove)):T.hasmstouch?(m.css(m.ispage?n("html"):m.win,{"-ms-touch-action":"none"}),m.css(m.rail,{"-ms-touch-action":"none"}),m.css(m.cursor,{"-ms-touch-action":"none"}),m.bind(m.win,"MSPointerDown",m.ontouchstart),m.bind(l,"MSPointerUp",m.ontouchend),m.delegate(l,"MSPointerMove",m.ontouchmove),m.bind(m.cursor,"MSGestureHold",function(e){e.preventDefault()}),m.bind(m.cursor,"contextmenu",function(e){e.preventDefault()})):T.cantouch&&(m.bind(m.win,"touchstart",m.ontouchstart,!1,!0),m.bind(l,"touchend",m.ontouchend,!1,!0),m.bind(l,"touchcancel",m.ontouchend,!1,!0),m.delegate(l,"touchmove",m.ontouchmove,!1,!0)),g.emulatetouch&&(m.bind(m.win,"mousedown",m.ontouchstart,!1,!0),m.bind(l,"mouseup",m.ontouchend,!1,!0),m.bind(l,"mousemove",m.ontouchmove,!1,!0)),(g.cursordragontouch||!T.cantouch&&!g.emulatetouch)&&(m.rail.css({cursor:"default"}),m.railh&&m.railh.css({cursor:"default"}),m.jqbind(m.rail,"mouseenter",function(){if(!m.ispage&&!m.win.is(":visible"))return!1;m.canshowonmouseevent&&m.showCursor(),m.rail.active=!0}),m.jqbind(m.rail,"mouseleave",function(){m.rail.active=!1,m.rail.drag||m.hideCursor()}),g.sensitiverail&&(m.bind(m.rail,"click",function(e){m.doRailClick(e,!1,!1)}),m.bind(m.rail,"dblclick",function(e){m.doRailClick(e,!0,!1)}),m.bind(m.cursor,"click",function(e){m.cancelEvent(e)}),m.bind(m.cursor,"dblclick",function(e){m.cancelEvent(e)})),m.railh&&(m.jqbind(m.railh,"mouseenter",function(){if(!m.ispage&&!m.win.is(":visible"))return!1;m.canshowonmouseevent&&m.showCursor(),m.rail.active=!0}),m.jqbind(m.railh,"mouseleave",function(){m.rail.active=!1,m.rail.drag||m.hideCursor()}),g.sensitiverail&&(m.bind(m.railh,"click",function(e){m.doRailClick(e,!1,!0)}),m.bind(m.railh,"dblclick",function(e){m.doRailClick(e,!0,!0)}),m.bind(m.cursorh,"click",function(e){m.cancelEvent(e)}),m.bind(m.cursorh,"dblclick",function(e){m.cancelEvent(e)})))),g.cursordragontouch&&(this.istouchcapable||T.cantouch)&&(m.bind(m.cursor,"touchstart",m.ontouchstartCursor),m.bind(m.cursor,"touchmove",m.ontouchmoveCursor),m.bind(m.cursor,"touchend",m.ontouchendCursor),m.cursorh&&m.bind(m.cursorh,"touchstart",function(e){m.ontouchstartCursor(e,!0)}),m.cursorh&&m.bind(m.cursorh,"touchmove",m.ontouchmoveCursor),m.cursorh&&m.bind(m.cursorh,"touchend",m.ontouchendCursor)),g.emulatetouch||T.isandroid||T.isios?(m.bind(T.hasmousecapture?m.win:l,"mouseup",m.ontouchend),m.onclick&&m.bind(l,"click",m.onclick),g.cursordragontouch?(m.bind(m.cursor,"mousedown",m.onmousedown),m.bind(m.cursor,"mouseup",m.onmouseup),m.cursorh&&m.bind(m.cursorh,"mousedown",function(e){m.onmousedown(e,!0)}),m.cursorh&&m.bind(m.cursorh,"mouseup",m.onmouseup)):(m.bind(m.rail,"mousedown",function(e){e.preventDefault()}),m.railh&&m.bind(m.railh,"mousedown",function(e){e.preventDefault()}))):(m.bind(T.hasmousecapture?m.win:l,"mouseup",m.onmouseup),m.bind(l,"mousemove",m.onmousemove),m.onclick&&m.bind(l,"click",m.onclick),m.bind(m.cursor,"mousedown",m.onmousedown),m.bind(m.cursor,"mouseup",m.onmouseup),m.railh&&(m.bind(m.cursorh,"mousedown",function(e){m.onmousedown(e,!0)}),m.bind(m.cursorh,"mouseup",m.onmouseup)),!m.ispage&&g.enablescrollonselection&&(m.bind(m.win[0],"mousedown",m.onselectionstart),m.bind(l,"mouseup",m.onselectionend),m.bind(m.cursor,"mouseup",m.onselectionend),m.cursorh&&m.bind(m.cursorh,"mouseup",m.onselectionend),m.bind(l,"mousemove",m.onselectiondrag)),m.zoom&&(m.jqbind(m.zoom,"mouseenter",function(){m.canshowonmouseevent&&m.showCursor(),m.rail.active=!0}),m.jqbind(m.zoom,"mouseleave",function(){m.rail.active=!1,m.rail.drag||m.hideCursor()}))),g.enablemousewheel&&(m.isiframe||m.mousewheel(T.isie&&m.ispage?l:m.win,m.onmousewheel),m.mousewheel(m.rail,m.onmousewheel),m.railh&&m.mousewheel(m.railh,m.onmousewheelhr)),m.ispage||T.cantouch||/HTML|^BODY/.test(m.win[0].nodeName)||(m.win.attr("tabindex")||m.win.attr({tabindex:++r}),m.bind(m.win,"focus",function(e){o=m.getTarget(e).id||m.getTarget(e)||!1,m.hasfocus=!0,m.canshowonmouseevent&&m.noticeCursor()}),m.bind(m.win,"blur",function(e){o=!1,m.hasfocus=!1}),m.bind(m.win,"mouseenter",function(e){t=m.getTarget(e).id||m.getTarget(e)||!1,m.hasmousefocus=!0,m.canshowonmouseevent&&m.noticeCursor()}),m.bind(m.win,"mouseleave",function(e){t=!1,m.hasmousefocus=!1,m.rail.drag||m.hideCursor()})),m.onkeypress=function(e){if(m.railslocked&&0===m.page.maxh)return!0;e=e||a.event;var r=m.getTarget(e);if(r&&/INPUT|TEXTAREA|SELECT|OPTION/.test(r.nodeName)&&(!(r.getAttribute("type")||r.type||!1)||!/submit|button|cancel/i.tp))return!0;if(n(r).attr("contenteditable"))return!0;if(m.hasfocus||m.hasmousefocus&&!o||m.ispage&&!o&&!t){var i=e.keyCode;if(m.railslocked&&27!=i)return m.cancelEvent(e);var s=e.ctrlKey||!1,l=e.shiftKey||!1,c=!1;switch(i){case 38:case 63233:m.doScrollBy(72),c=!0;break;case 40:case 63235:m.doScrollBy(-72),c=!0;break;case 37:case 63232:m.railh&&(s?m.doScrollLeft(0):m.doScrollLeftBy(72),c=!0);break;case 39:case 63234:m.railh&&(s?m.doScrollLeft(m.page.maxw):m.doScrollLeftBy(-72),c=!0);break;case 33:case 63276:m.doScrollBy(m.view.h),c=!0;break;case 34:case 63277:m.doScrollBy(-m.view.h),c=!0;break;case 36:case 63273:m.railh&&s?m.doScrollPos(0,0):m.doScrollTo(0),c=!0;break;case 35:case 63275:m.railh&&s?m.doScrollPos(m.page.maxw,m.page.maxh):m.doScrollTo(m.page.maxh),c=!0;break;case 32:g.spacebarenabled&&(l?m.doScrollBy(m.view.h):m.doScrollBy(-m.view.h),c=!0);break;case 27:m.zoomactive&&(m.doZoom(),c=!0)}if(c)return m.cancelEvent(e)}},g.enablekeyboard&&m.bind(l,T.isopera&&!T.isopera12?"keypress":"keydown",m.onkeypress),m.bind(l,"keydown",function(e){(e.ctrlKey||!1)&&(m.wheelprevented=!0)}),m.bind(l,"keyup",function(e){e.ctrlKey||!1||(m.wheelprevented=!1)}),m.bind(a,"blur",function(e){m.wheelprevented=!1}),m.bind(a,"resize",m.onscreenresize),m.bind(a,"orientationchange",m.onscreenresize),m.bind(a,"load",m.lazyResize),T.ischrome&&!m.ispage&&!m.haswrapper){var C=m.win.attr("style"),N=parseFloat(m.win.css("width"))+1;m.win.css("width",N),m.synched("chromefix",function(){m.win.attr("style",C)})}if(m.onAttributeChange=function(e){m.lazyResize(m.isieold?250:30)},g.enableobserver&&(m.isie11||!1===v||(m.observerbody=new v(function(e){if(e.forEach(function(e){if("attributes"==e.type)return f.hasClass("modal-open")&&f.hasClass("modal-dialog")&&!n.contains(n(".modal-dialog")[0],m.doc[0])?m.hide():m.show()}),m.me.clientWidth!=m.page.width||m.me.clientHeight!=m.page.height)return m.lazyResize(30)}),m.observerbody.observe(l.body,{childList:!0,subtree:!0,characterData:!1,attributes:!0,attributeFilter:["class"]})),!m.ispage&&!m.haswrapper)){var P=m.win[0];!1!==v?(m.observer=new v(function(e){e.forEach(m.onAttributeChange)}),m.observer.observe(P,{childList:!0,characterData:!1,attributes:!0,subtree:!1}),m.observerremover=new v(function(e){e.forEach(function(e){if(e.removedNodes.length>0)for(var o in e.removedNodes)if(m&&e.removedNodes[o]===P)return m.remove()})}),m.observerremover.observe(P.parentNode,{childList:!0,characterData:!1,attributes:!1,subtree:!1})):(m.bind(P,T.isie&&!T.isie9?"propertychange":"DOMAttrModified",m.onAttributeChange),T.isie9&&P.attachEvent("onpropertychange",m.onAttributeChange),m.bind(P,"DOMNodeRemoved",function(e){e.target===P&&m.remove()}))}!m.ispage&&g.boxzoom&&m.bind(a,"resize",m.resizeZoom),m.istextarea&&(m.bind(m.win,"keydown",m.lazyResize),m.bind(m.win,"mouseup",m.lazyResize)),m.lazyResize(30)}if("IFRAME"==this.doc[0].nodeName){var R=function(){var o;m.iframexd=!1;try{(o="contentDocument"in this?this.contentDocument:this.contentWindow._doc).domain}catch(e){m.iframexd=!0,o=!1}if(m.iframexd)return"console"in a&&console.log("NiceScroll error: policy restriced iframe"),!0;if(m.forcescreen=!0,m.isiframe&&(m.iframe={doc:n(o),html:m.doc.contents().find("html")[0],body:m.doc.contents().find("body")[0]},m.getContentSize=function(){return{w:Math.max(m.iframe.html.scrollWidth,m.iframe.body.scrollWidth),h:Math.max(m.iframe.html.scrollHeight,m.iframe.body.scrollHeight)}},m.docscroll=n(m.iframe.body)),!T.isios&&g.iframeautoresize&&!m.isiframe){m.win.scrollTop(0),m.doc.height("");var t=Math.max(o.getElementsByTagName("html")[0].scrollHeight,o.body.scrollHeight);m.doc.height(t)}m.lazyResize(30),m.css(n(m.iframe.body),e),T.isios&&m.haswrapper&&m.css(n(o.body),{"-webkit-transform":"translate3d(0,0,0)"}),"contentWindow"in this?m.bind(this.contentWindow,"scroll",m.onscroll):m.bind(o,"scroll",m.onscroll),g.enablemousewheel&&m.mousewheel(o,m.onmousewheel),g.enablekeyboard&&m.bind(o,T.isopera?"keypress":"keydown",m.onkeypress),T.cantouch?(m.bind(o,"touchstart",m.ontouchstart),m.bind(o,"touchmove",m.ontouchmove)):g.emulatetouch&&(m.bind(o,"mousedown",m.ontouchstart),m.bind(o,"mousemove",function(e){return m.ontouchmove(e,!0)}),g.grabcursorenabled&&T.cursorgrabvalue&&m.css(n(o.body),{cursor:T.cursorgrabvalue})),m.bind(o,"mouseup",m.ontouchend),m.zoom&&(g.dblclickzoom&&m.bind(o,"dblclick",m.doZoom),m.ongesturezoom&&m.bind(o,"gestureend",m.ongesturezoom))};this.doc[0].readyState&&"complete"===this.doc[0].readyState&&setTimeout(function(){R.call(m.doc[0],!1)},500),m.bind(this.doc,"load",R)}},this.showCursor=function(e,o){if(m.cursortimeout&&(clearTimeout(m.cursortimeout),m.cursortimeout=0),m.rail){if(m.autohidedom&&(m.autohidedom.stop().css({opacity:g.cursoropacitymax}),m.cursoractive=!0),m.rail.drag&&1==m.rail.drag.pt||(void 0!==e&&!1!==e&&(m.scroll.y=e/m.scrollratio.y|0),void 0!==o&&(m.scroll.x=o/m.scrollratio.x|0)),m.cursor.css({height:m.cursorheight,top:m.scroll.y}),m.cursorh){var t=m.hasreversehr?m.scrollvaluemaxw-m.scroll.x:m.scroll.x;m.cursorh.css({width:m.cursorwidth,left:!m.rail.align&&m.rail.visibility?t+m.rail.width:t}),m.cursoractive=!0}m.zoom&&m.zoom.stop().css({opacity:g.cursoropacitymax})}},this.hideCursor=function(e){m.cursortimeout||m.rail&&m.autohidedom&&(m.hasmousefocus&&"leave"===g.autohidemode||(m.cursortimeout=setTimeout(function(){m.rail.active&&m.showonmouseevent||(m.autohidedom.stop().animate({opacity:g.cursoropacitymin}),m.zoom&&m.zoom.stop().animate({opacity:g.cursoropacitymin}),m.cursoractive=!1),m.cursortimeout=0},e||g.hidecursordelay)))},this.noticeCursor=function(e,o,t){m.showCursor(o,t),m.rail.active||m.hideCursor(e)},this.getContentSize=m.ispage?function(){return{w:Math.max(l.body.scrollWidth,l.documentElement.scrollWidth),h:Math.max(l.body.scrollHeight,l.documentElement.scrollHeight)}}:m.haswrapper?function(){return{w:m.doc[0].offsetWidth,h:m.doc[0].offsetHeight}}:function(){return{w:m.docscroll[0].scrollWidth,h:m.docscroll[0].scrollHeight}},this.onResize=function(e,o){if(!m||!m.win)return!1;var t=m.page.maxh,r=m.page.maxw,i=m.view.h,s=m.view.w;if(m.view={w:m.ispage?m.win.width():m.win[0].clientWidth,h:m.ispage?m.win.height():m.win[0].clientHeight},m.page=o||m.getContentSize(),m.page.maxh=Math.max(0,m.page.h-m.view.h),m.page.maxw=Math.max(0,m.page.w-m.view.w),m.page.maxh==t&&m.page.maxw==r&&m.view.w==s&&m.view.h==i){if(m.ispage)return m;var n=m.win.offset();if(m.lastposition){var l=m.lastposition;if(l.top==n.top&&l.left==n.left)return m}m.lastposition=n}return 0===m.page.maxh?(m.hideRail(),m.scrollvaluemax=0,m.scroll.y=0,m.scrollratio.y=0,m.cursorheight=0,m.setScrollTop(0),m.rail&&(m.rail.scrollable=!1)):(m.page.maxh-=g.railpadding.top+g.railpadding.bottom,m.rail.scrollable=!0),0===m.page.maxw?(m.hideRailHr(),m.scrollvaluemaxw=0,m.scroll.x=0,m.scrollratio.x=0,m.cursorwidth=0,m.setScrollLeft(0),m.railh&&(m.railh.scrollable=!1)):(m.page.maxw-=g.railpadding.left+g.railpadding.right,m.railh&&(m.railh.scrollable=g.horizrailenabled)),m.railslocked=m.locked||0===m.page.maxh&&0===m.page.maxw,m.railslocked?(m.ispage||m.updateScrollBar(m.view),!1):(m.hidden||(m.rail.visibility||m.showRail(),m.railh&&!m.railh.visibility&&m.showRailHr()),m.istextarea&&m.win.css("resize")&&"none"!=m.win.css("resize")&&(m.view.h-=20),m.cursorheight=Math.min(m.view.h,Math.round(m.view.h*(m.view.h/m.page.h))),m.cursorheight=g.cursorfixedheight?g.cursorfixedheight:Math.max(g.cursorminheight,m.cursorheight),m.cursorwidth=Math.min(m.view.w,Math.round(m.view.w*(m.view.w/m.page.w))),m.cursorwidth=g.cursorfixedheight?g.cursorfixedheight:Math.max(g.cursorminheight,m.cursorwidth),m.scrollvaluemax=m.view.h-m.cursorheight-(g.railpadding.top+g.railpadding.bottom),m.hasborderbox||(m.scrollvaluemax-=m.cursor[0].offsetHeight-m.cursor[0].clientHeight),m.railh&&(m.railh.width=m.page.maxh>0?m.rail.width:m.view.w,m.scrollvaluemaxw=m.railh.width-m.cursorwidth-(g.railpadding.left+g.railpadding.right)),m.ispage||m.updateScrollBar(m.view),m.scrollratio={x:m.page.maxw/m.scrollvaluemaxw,y:m.page.maxh/m.scrollvaluemax},m.getScrollTop()>m.page.maxh?m.doScrollTop(m.page.maxh):(m.scroll.y=m.getScrollTop()/m.scrollratio.y|0,m.scroll.x=m.getScrollLeft()/m.scrollratio.x|0,m.cursoractive&&m.noticeCursor()),m.scroll.y&&0===m.getScrollTop()&&m.doScrollTo(m.scroll.y*m.scrollratio.y|0),m)},this.resize=m.onResize;var P=0;function R(e,o,t,r){m._bind(e,o,function(r){var i={original:r=r||a.event,target:r.target||r.srcElement,type:"wheel",deltaMode:"MozMousePixelScroll"==r.type?0:1,deltaX:0,deltaZ:0,preventDefault:function(){return r.preventDefault?r.preventDefault():r.returnValue=!1,!1},stopImmediatePropagation:function(){r.stopImmediatePropagation?r.stopImmediatePropagation():r.cancelBubble=!0}};return"mousewheel"==o?(r.wheelDeltaX&&(i.deltaX=-.025*r.wheelDeltaX),r.wheelDeltaY&&(i.deltaY=-.025*r.wheelDeltaY),!i.deltaY&&!i.deltaX&&(i.deltaY=-.025*r.wheelDelta)):i.deltaY=r.detail,t.call(e,i)},r)}this.onscreenresize=function(e){clearTimeout(P);var o=!m.ispage&&!m.haswrapper;o&&m.hideRails(),P=setTimeout(function(){m&&(o&&m.showRails(),m.resize()),P=0},120)},this.lazyResize=function(e){return clearTimeout(P),e=isNaN(e)?240:e,P=setTimeout(function(){m&&m.resize(),P=0},e),m},this.jqbind=function(e,o,t){m.events.push({e:e,n:o,f:t,q:!0}),n(e).on(o,t)},this.mousewheel=function(e,o,t){var r="jquery"in e?e[0]:e;if("onwheel"in l.createElement("div"))m._bind(r,"wheel",o,t||!1);else{var i=void 0!==l.onmousewheel?"mousewheel":"DOMMouseScroll";R(r,i,o,t||!1),"DOMMouseScroll"==i&&R(r,"MozMousePixelScroll",o,t||!1)}};var Y=!1;if(T.haseventlistener){try{var _=Object.defineProperty({},"passive",{get:function(){Y=!0}});a.addEventListener("test",null,_)}catch(e){}this.stopPropagation=function(e){return!!e&&((e=e.original?e.original:e).stopPropagation(),!1)},this.cancelEvent=function(e){return e.cancelable&&e.preventDefault(),e.stopImmediatePropagation(),e.preventManipulation&&e.preventManipulation(),!1}}else Event.prototype.preventDefault=function(){this.returnValue=!1},Event.prototype.stopPropagation=function(){this.cancelBubble=!0},a.constructor.prototype.addEventListener=l.constructor.prototype.addEventListener=Element.prototype.addEventListener=function(e,o,t){this.attachEvent("on"+e,o)},a.constructor.prototype.removeEventListener=l.constructor.prototype.removeEventListener=Element.prototype.removeEventListener=function(e,o,t){this.detachEvent("on"+e,o)},this.cancelEvent=function(e){return(e=e||a.event)&&(e.cancelBubble=!0,e.cancel=!0,e.returnValue=!1),!1},this.stopPropagation=function(e){return(e=e||a.event)&&(e.cancelBubble=!0),!1};this.delegate=function(e,o,t,r,i){var s=d[o]||!1;s||(s={a:[],l:[],f:function(e){for(var o=s.l,t=!1,r=o.length-1;r>=0;r--)if(!1===(t=o[r].call(e.target,e)))return!1;return t}},m.bind(e,o,s.f,r,i),d[o]=s),m.ispage?(s.a=[m.id].concat(s.a),s.l=[t].concat(s.l)):(s.a.push(m.id),s.l.push(t))},this.undelegate=function(e,o,t,r,i){var s=d[o]||!1;if(s&&s.l)for(var n=0,l=s.l.length;n0)return t;o=!!o.parentNode&&o.parentNode}return!1},this.triggerScrollStart=function(e,o,t,r,i){if(m.onscrollstart){var s={type:"scrollstart",current:{x:e,y:o},request:{x:t,y:r},end:{x:m.newscrollx,y:m.newscrolly},speed:i};m.onscrollstart.call(m,s)}},this.triggerScrollEnd=function(){if(m.onscrollend){var e=m.getScrollLeft(),o=m.getScrollTop(),t={type:"scrollend",current:{x:e,y:o},end:{x:e,y:o}};m.onscrollend.call(m,t)}};var I=0,O=0,H=0,B=1;function X(e,o,t,r){m.scrollrunning||(m.newscrolly=m.getScrollTop(),m.newscrollx=m.getScrollLeft(),H=w());var i=w()-H;if(H=w(),i>350?B=1:B+=(2-B)/10,o=o*B|0,e=e*B|0){if(r)if(e<0){if(m.getScrollLeft()>=m.page.maxw)return!0}else if(m.getScrollLeft()<=0)return!0;var s=e>0?1:-1;O!==s&&(m.scrollmom&&m.scrollmom.stop(),m.newscrollx=m.getScrollLeft(),O=s),m.lastdeltax-=e}if(o){if(function(){var e=m.getScrollTop();if(o<0){if(e>=m.page.maxh)return!0}else if(e<=0)return!0}()){if(g.nativeparentscrolling&&t&&!m.ispage&&!m.zoomactive)return!0;var n=m.view.h>>1;m.newscrolly<-n?(m.newscrolly=-n,o=-1):m.newscrolly>m.page.maxh+n?(m.newscrolly=m.page.maxh+n,o=1):o=0}var l=o>0?1:-1;I!==l&&(m.scrollmom&&m.scrollmom.stop(),m.newscrolly=m.getScrollTop(),I=l),m.lastdeltay-=o}(o||e)&&m.synched("relativexy",function(){var e=m.lastdeltay+m.newscrolly;m.lastdeltay=0;var o=m.lastdeltax+m.newscrollx;m.lastdeltax=0,m.rail.drag||m.doScrollPos(o,e)})}var D=!1;function A(e,o,t){var r,i;if(!t&&D)return!0;(0===e.deltaMode?(r=-e.deltaX*(g.mousescrollstep/54)|0,i=-e.deltaY*(g.mousescrollstep/54)|0):1===e.deltaMode&&(r=-e.deltaX*g.mousescrollstep*50/80|0,i=-e.deltaY*g.mousescrollstep*50/80|0),o&&g.oneaxismousemode&&0===r&&i)&&(r=i,i=0,t&&(r<0?m.getScrollLeft()>=m.page.maxw:m.getScrollLeft()<=0)&&(i=r,r=0));if(m.isrtlmode&&(r=-r),!X(r,i,t,!0))return D=!1,e.stopImmediatePropagation(),e.preventDefault();t&&(D=!0)}if(this.onmousewheel=function(e){if(m.wheelprevented||m.locked)return!1;if(m.railslocked)return m.debounced("checkunlock",m.resize,250),!1;if(m.rail.drag)return m.cancelEvent(e);if("auto"===g.oneaxismousemode&&0!==e.deltaX&&(g.oneaxismousemode=!1),g.oneaxismousemode&&0===e.deltaX&&!m.rail.scrollable)return!m.railh||!m.railh.scrollable||m.onmousewheelhr(e);var o=w(),t=!1;if(g.preservenativescrolling&&m.checkarea+600m.page.maxh&&(o=m.page.maxh+(o-m.page.maxh)/2|0),e<0?e=e/2|0:e>m.page.maxw&&(e=m.page.maxw+(e-m.page.maxw)/2|0)):(o<0?o=0:o>m.page.maxh&&(o=m.page.maxh),e<0?e=0:e>m.page.maxw&&(e=m.page.maxw)),m.scrollrunning&&e==m.newscrollx&&o==m.newscrolly)return!1;m.newscrolly=o,m.newscrollx=e;var s=m.getScrollTop(),n=m.getScrollLeft(),l={};l.x=e-n,l.y=o-s;var a=0|Math.sqrt(l.x*l.x+l.y*l.y),c=m.prepareTransition(a);m.scrollrunning||(m.scrollrunning=!0,m.triggerScrollStart(n,s,e,o,c),m.cursorupdate.start()),m.scrollendtrapped=!0,T.transitionend||(m.scrollendtrapped&&clearTimeout(m.scrollendtrapped),m.scrollendtrapped=setTimeout(m.onScrollTransitionEnd,c)),m.setScrollTop(m.newscrolly),m.setScrollLeft(m.newscrollx)},this.cancelScroll=function(){if(!m.scrollendtrapped)return!0;var e=m.getScrollTop(),o=m.getScrollLeft();return m.scrollrunning=!1,T.transitionend||clearTimeout(T.transitionend),m.scrollendtrapped=!1,m.resetTransition(),m.setScrollTop(e),m.railh&&m.setScrollLeft(o),m.timerscroll&&m.timerscroll.tm&&clearInterval(m.timerscroll.tm),m.timerscroll=!1,m.cursorfreezed=!1,m.cursorupdate.stop(),m.showCursor(e,o),m},this.onScrollTransitionEnd=function(){if(m.scrollendtrapped){var e=m.getScrollTop(),o=m.getScrollLeft();if(e<0?e=0:e>m.page.maxh&&(e=m.page.maxh),o<0?o=0:o>m.page.maxw&&(o=m.page.maxw),e!=m.newscrolly||o!=m.newscrollx)return m.doScrollPos(o,e,g.snapbackspeed);m.scrollrunning&&m.triggerScrollEnd(),m.scrollrunning=!1,m.scrollendtrapped=!1,m.resetTransition(),m.timerscroll=!1,m.setScrollTop(e),m.railh&&m.setScrollLeft(o),m.cursorupdate.stop(),m.noticeCursor(!1,e,o),m.cursorfreezed=!1}}}else this.doScrollLeft=function(e,o){var t=m.scrollrunning?m.newscrolly:m.getScrollTop();m.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=m.scrollrunning?m.newscrollx:m.getScrollLeft();m.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=m.getScrollTop(),i=m.getScrollLeft();((m.newscrolly-r)*(o-r)<0||(m.newscrollx-i)*(e-i)<0)&&m.cancelScroll();var s=!1;if(m.bouncescroll&&m.rail.visibility||(o<0?(o=0,s=!0):o>m.page.maxh&&(o=m.page.maxh,s=!0)),m.bouncescroll&&m.railh.visibility||(e<0?(e=0,s=!0):e>m.page.maxw&&(e=m.page.maxw,s=!0)),m.scrollrunning&&m.newscrolly===o&&m.newscrollx===e)return!0;m.newscrolly=o,m.newscrollx=e,m.dst={},m.dst.x=e-i,m.dst.y=o-r,m.dst.px=i,m.dst.py=r;var n=0|Math.sqrt(m.dst.x*m.dst.x+m.dst.y*m.dst.y),l=m.getTransitionSpeed(n);m.bzscroll={};var a=s?1:.58;m.bzscroll.x=new E(i,m.newscrollx,l,0,0,a,1),m.bzscroll.y=new E(r,m.newscrolly,l,0,0,a,1);w();var c=function(){if(m.scrollrunning){var e=m.bzscroll.y.getPos();m.setScrollLeft(m.bzscroll.x.getNow()),m.setScrollTop(m.bzscroll.y.getNow()),e<=1?m.timer=u(c):(m.scrollrunning=!1,m.timer=0,m.triggerScrollEnd())}};m.scrollrunning||(m.triggerScrollStart(i,r,e,o,l),m.scrollrunning=!0,m.timer=u(c))},this.cancelScroll=function(){return m.timer&&h(m.timer),m.timer=0,m.bzscroll=!1,m.scrollrunning=!1,m};else this.doScrollLeft=function(e,o){var t=m.getScrollTop();m.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=m.getScrollLeft();m.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=e>m.page.maxw?m.page.maxw:e;r<0&&(r=0);var i=o>m.page.maxh?m.page.maxh:o;i<0&&(i=0),m.synched("scroll",function(){m.setScrollTop(i),m.setScrollLeft(r)})},this.cancelScroll=function(){};this.doScrollBy=function(e,o){X(0,e)},this.doScrollLeftBy=function(e,o){X(e,0)},this.doScrollTo=function(e,o){var t=o?Math.round(e*m.scrollratio.y):e;t<0?t=0:t>m.page.maxh&&(t=m.page.maxh),m.cursorfreezed=!1,m.doScrollTop(e)},this.checkContentSize=function(){var e=m.getContentSize();e.h==m.page.h&&e.w==m.page.w||m.resize(!1,e)},m.onscroll=function(e){m.rail.drag||m.cursorfreezed||m.synched("scroll",function(){m.scroll.y=Math.round(m.getScrollTop()/m.scrollratio.y),m.railh&&(m.scroll.x=Math.round(m.getScrollLeft()/m.scrollratio.x)),m.noticeCursor()})},m.bind(m.docscroll,"scroll",m.onscroll),this.doZoomIn=function(e){if(!m.zoomactive){m.zoomactive=!0,m.zoomrestore={style:{}};var o=["position","top","left","zIndex","backgroundColor","marginTop","marginBottom","marginLeft","marginRight"],t=m.win[0].style;for(var r in o){var i=o[r];m.zoomrestore.style[i]=void 0!==t[i]?t[i]:""}m.zoomrestore.style.width=m.win.css("width"),m.zoomrestore.style.height=m.win.css("height"),m.zoomrestore.padding={w:m.win.outerWidth()-m.win.width(),h:m.win.outerHeight()-m.win.height()},T.isios4&&(m.zoomrestore.scrollTop=c.scrollTop(),c.scrollTop(0)),m.win.css({position:T.isios4?"absolute":"fixed",top:0,left:0,zIndex:s+100,margin:0});var n=m.win.css("backgroundColor");return(""===n||/transparent|rgba\(0, 0, 0, 0\)|rgba\(0,0,0,0\)/.test(n))&&m.win.css("backgroundColor","#fff"),m.rail.css({zIndex:s+101}),m.zoom.css({zIndex:s+102}),m.zoom.css("backgroundPosition","0 -18px"),m.resizeZoom(),m.onzoomin&&m.onzoomin.call(m),m.cancelEvent(e)}},this.doZoomOut=function(e){if(m.zoomactive)return m.zoomactive=!1,m.win.css("margin",""),m.win.css(m.zoomrestore.style),T.isios4&&c.scrollTop(m.zoomrestore.scrollTop),m.rail.css({"z-index":m.zindex}),m.zoom.css({"z-index":m.zindex}),m.zoomrestore=!1,m.zoom.css("backgroundPosition","0 0"),m.onResize(),m.onzoomout&&m.onzoomout.call(m),m.cancelEvent(e)},this.doZoom=function(e){return m.zoomactive?m.doZoomOut(e):m.doZoomIn(e)},this.resizeZoom=function(){if(m.zoomactive){var e=m.getScrollTop();m.win.css({width:c.width()-m.zoomrestore.padding.w+"px",height:c.height()-m.zoomrestore.padding.h+"px"}),m.onResize(),m.setScrollTop(Math.min(m.page.maxh,e))}},this.init(),n.nicescroll.push(this)},S=function(e){var o=this;this.nc=e,this.lastx=0,this.lasty=0,this.speedx=0,this.speedy=0,this.lasttime=0,this.steptime=0,this.snapx=!1,this.snapy=!1,this.demulx=0,this.demuly=0,this.lastscrollx=-1,this.lastscrolly=-1,this.chkx=0,this.chky=0,this.timer=0,this.reset=function(e,t){o.stop(),o.steptime=0,o.lasttime=w(),o.speedx=0,o.speedy=0,o.lastx=e,o.lasty=t,o.lastscrollx=-1,o.lastscrolly=-1},this.update=function(e,t){var r=w();o.steptime=r-o.lasttime,o.lasttime=r;var i=t-o.lasty,s=e-o.lastx,n=o.nc.getScrollTop()+i,l=o.nc.getScrollLeft()+s;o.snapx=l<0||l>o.nc.page.maxw,o.snapy=n<0||n>o.nc.page.maxh,o.speedx=s,o.speedy=i,o.lastx=e,o.lasty=t},this.stop=function(){o.nc.unsynched("domomentum2d"),o.timer&&clearTimeout(o.timer),o.timer=0,o.lastscrollx=-1,o.lastscrolly=-1},this.doSnapy=function(e,t){var r=!1;t<0?(t=0,r=!0):t>o.nc.page.maxh&&(t=o.nc.page.maxh,r=!0),e<0?(e=0,r=!0):e>o.nc.page.maxw&&(e=o.nc.page.maxw,r=!0),r?o.nc.doScrollPos(e,t,o.nc.opt.snapbackspeed):o.nc.triggerScrollEnd()},this.doMomentum=function(e){var t=w(),r=e?t+e:o.lasttime,i=o.nc.getScrollLeft(),s=o.nc.getScrollTop(),n=o.nc.page.maxh,l=o.nc.page.maxw;o.speedx=l>0?Math.min(60,o.speedx):0,o.speedy=n>0?Math.min(60,o.speedy):0;var a=r&&t-r<=60;(s<0||s>n||i<0||i>l)&&(a=!1);var c=!(!o.speedy||!a)&&o.speedy,d=!(!o.speedx||!a)&&o.speedx;if(c||d){var u=Math.max(16,o.steptime);if(u>50){var h=u/50;o.speedx*=h,o.speedy*=h,u=50}o.demulxy=0,o.lastscrollx=o.nc.getScrollLeft(),o.chkx=o.lastscrollx,o.lastscrolly=o.nc.getScrollTop(),o.chky=o.lastscrolly;var p=o.lastscrollx,m=o.lastscrolly,f=function(){var e=w()-t>600?.04:.02;o.speedx&&(p=Math.floor(o.lastscrollx-o.speedx*(1-o.demulxy)),o.lastscrollx=p,(p<0||p>l)&&(e=.1)),o.speedy&&(m=Math.floor(o.lastscrolly-o.speedy*(1-o.demulxy)),o.lastscrolly=m,(m<0||m>n)&&(e=.1)),o.demulxy=Math.min(1,o.demulxy+e),o.nc.synched("domomentum2d",function(){if(o.speedx){o.nc.getScrollLeft();o.chkx=p,o.nc.setScrollLeft(p)}if(o.speedy){o.nc.getScrollTop();o.chky=m,o.nc.setScrollTop(m)}o.timer||(o.nc.hideCursor(),o.doSnapy(p,m))}),o.demulxy<1?o.timer=setTimeout(f,u):(o.stop(),o.nc.hideCursor(),o.doSnapy(p,m))};f()}else o.doSnapy(o.nc.getScrollLeft(),o.nc.getScrollTop())}},z=e.fn.scrollTop;e.cssHooks.pageYOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollTop():z.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollTop(parseInt(o)):z.call(e,o),this}},e.fn.scrollTop=function(e){if(void 0===e){var o=this[0]&&n.data(this[0],"__nicescroll")||!1;return o&&o.ishwscroll?o.getScrollTop():z.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollTop(parseInt(e)):z.call(n(this),e)})};var k=e.fn.scrollLeft;n.cssHooks.pageXOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollLeft():k.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollLeft(parseInt(o)):k.call(e,o),this}},e.fn.scrollLeft=function(e){if(void 0===e){var o=this[0]&&n.data(this[0],"__nicescroll")||!1;return o&&o.ishwscroll?o.getScrollLeft():k.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollLeft(parseInt(e)):k.call(n(this),e)})};var T=function(e){var o=this;if(this.length=0,this.name="nicescrollarray",this.each=function(e){return n.each(o,e),o},this.push=function(e){o[o.length]=e,o.length++},this.eq=function(e){return o[e]},e)for(var t=0;t1?n(e,r):s,i.win=r}!("doc"in i)||"win"in i||(i.win=r);var l=r.data("__nicescroll")||!1;l||(i.doc=i.doc||r,l=new x(i,r),r.data("__nicescroll",l)),t.push(l)}),1===t.length?t[0]:t},a.NiceScroll={getjQuery:function(){return e}},n.nicescroll||(n.nicescroll=new T,n.nicescroll.options=b)});
\ No newline at end of file
diff --git a/src/原型系统/resources/scripts/axure/legacy.js b/src/原型系统/resources/scripts/axure/legacy.js
new file mode 100644
index 0000000..a46148a
--- /dev/null
+++ b/src/原型系统/resources/scripts/axure/legacy.js
@@ -0,0 +1,166 @@
+//stored on each browser event
+var windowEvent;
+
+$axure.internal(function($ax) {
+ var _legacy = {};
+ $ax.legacy = _legacy;
+
+ var Forms = window.document.getElementsByTagName("FORM");
+ for(var i = 0; i < Forms.length; i++) {
+ var Form = Forms[i];
+ Form.onclick = $ax.legacy.SuppressBubble;
+ }
+
+ $ax.legacy.SuppressBubble = function(event) {
+ if(IE_10_AND_BELOW) {
+ window.event.cancelBubble = true;
+ window.event.returnValue = false;
+ } else {
+ if(event) {
+ event.stopPropagation();
+ }
+ }
+ };
+
+ $ax.legacy.BringToFront = function(id, skipFixed) {
+ _bringToFrontHelper(id);
+ if(!skipFixed) $ax.legacy.BringFixedToFront();
+ };
+
+ var _bringToFrontHelper = function(id) {
+ var target = window.document.getElementById(id);
+ if(target == null) return;
+ $ax.globals.MaxZIndex = $ax.globals.MaxZIndex + 1;
+ target.style.zIndex = $ax.globals.MaxZIndex;
+ };
+
+ $ax.legacy.BringFixedToFront = function() {
+ $ax(function(diagramObject) { return diagramObject.fixedKeepInFront; }).each(function(diagramObject, scriptId) {
+ _bringToFrontHelper(scriptId);
+ });
+ };
+
+ $ax.legacy.SendToBack = function(id) {
+ var target = window.document.getElementById(id);
+ if(target == null) return;
+ target.style.zIndex = $ax.globals.MinZIndex = $ax.globals.MinZIndex - 1;
+ };
+
+ $ax.legacy.RefreshScreen = function() {
+ var oldColor = window.document.body.style.backgroundColor;
+ var setColor = (oldColor == "rgb(0,0,0)") ? "#FFFFFF" : "#000000";
+ window.document.body.style.backgroundColor = setColor;
+ window.document.body.style.backgroundColor = oldColor;
+ };
+
+ $ax.legacy.getAbsoluteLeft = function(currentNode, elementId) {
+ var oldDisplay = currentNode.css('display');
+ var displaySet = false;
+ if(oldDisplay == 'none') {
+ currentNode.css('display', '');
+ displaySet = true;
+ }
+ var left = currentNode.offset().left;
+
+ // Special Layer code
+ if($ax.getTypeFromElementId(elementId) == 'layer') {
+ var first = true;
+ var children = currentNode.children();
+ for(var i = 0; i < children.length; i++) {
+ var child = $(children[i]);
+ var subDisplaySet = false;
+ if(child.css('display') == 'none') {
+ child.css('display', '');
+ subDisplaySet = true;
+ }
+ if(first) left = child.offset().left;
+ else left = Math.min(child.offset().left, left);
+ first = false;
+
+ if(subDisplaySet) child.css('display', 'none');
+ }
+ }
+
+ if (displaySet) currentNode.css('display', oldDisplay);
+
+ return $axure.fn.bodyToWorld(left, true);
+ };
+
+ $ax.legacy.getAbsoluteTop = function(currentNode, elementId) {
+ var oldDisplay = currentNode.css('display');
+ var displaySet = false;
+ if(oldDisplay == 'none') {
+ currentNode.css('display', '');
+ displaySet = true;
+ }
+ var top = currentNode.offset().top;
+
+ // Special Layer code
+ if ($ax.getTypeFromElementId(elementId) == 'layer') {
+ var first = true;
+ var children = currentNode.children();
+ for (var i = 0; i < children.length; i++) {
+ var child = $(children[i]);
+ var subDisplaySet = false;
+ if (child.css('display') == 'none') {
+ child.css('display', '');
+ subDisplaySet = true;
+ }
+ if (first) top = child.offset().top;
+ else top = Math.min(child.offset().top, top);
+ first = false;
+
+ if (subDisplaySet) child.css('display', 'none');
+ }
+ }
+
+ if(displaySet) currentNode.css('display', oldDisplay);
+ return top;
+ };
+
+ // ****************** Annotation and Link Functions ****************** //
+
+ $ax.legacy.GetAnnotationHtml = function(annJson) {
+ var retVal = "";
+ for(var noteName in annJson) {
+ if(noteName != "label" && noteName != "id") {
+ retVal += "" + noteName + "
";
+ retVal += "" + linkify(annJson[noteName]) + "
";
+ }
+ }
+ return retVal;
+
+ function linkify(text) {
+ var urlRegex = /(\b(((https?|ftp|file):\/\/)|(www\.))[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
+ return text.replace(urlRegex, function (url, b, c) {
+ var url2 = (c == 'www.') ? 'http://' + url : url;
+ return '' + url + ' ';
+ });
+ }
+ };
+
+
+ $ax.legacy.GetScrollable = function(target) {
+ var $target = $(target);
+ var last = $target;
+ // Start past inital target. Can't scroll to target in itself, must be some ancestor.
+ var current = last.parent();
+
+ while(!current.is('body') && !current.is('html')) {
+ var elementId = current.attr('id');
+ var diagramObject = elementId && $ax.getObjectFromElementId(elementId);
+ if (diagramObject && $ax.public.fn.IsDynamicPanel(diagramObject.type) && diagramObject.scrollbars != 'none') {
+ //returns the panel diagram div which handles scrolling
+ return $ax.dynamicPanelManager.getShownState(current.attr('id'))[0];
+ }
+ last = current;
+ current = current.parent();
+ }
+ // Need to do this because of ie
+ if(IE_10_AND_BELOW) return window.document.documentElement;
+ else return window.document.body;
+ };
+
+
+
+});
\ No newline at end of file
diff --git a/src/原型系统/resources/scripts/axure/math.js b/src/原型系统/resources/scripts/axure/math.js
new file mode 100644
index 0000000..cf2f75d
--- /dev/null
+++ b/src/原型系统/resources/scripts/axure/math.js
@@ -0,0 +1,554 @@
+$axure.internal(function($ax) {
+ $ax.public.fn.matrixMultiply = function(matrix, vector) {
+ if(!matrix.tx) matrix.tx = 0;
+ if(!matrix.ty) matrix.ty = 0;
+ var outX = matrix.m11 * vector.x + matrix.m12 * vector.y + matrix.tx;
+ var outY = matrix.m21 * vector.x + matrix.m22 * vector.y + matrix.ty;
+ return { x: outX, y: outY };
+ }
+
+ $ax.public.fn.matrixInverse = function(matrix) {
+ if(!matrix.tx) matrix.tx = 0;
+ if(!matrix.ty) matrix.ty = 0;
+
+ var determinant = matrix.m11*matrix.m22 - matrix.m12*matrix.m21;
+ //var threshold = (M11 * M11 + M22 *M22 + M12 *M12+ M21 *M21) / 100000;
+ //if(determinant.DeltaEquals(0, threshold) && determinant < 0.01) {
+ // return Invalid;
+ //}
+ return {
+ m11 : matrix.m22/determinant,
+ m12 : -matrix.m12/determinant,
+ tx : (matrix.ty*matrix.m12 - matrix.tx*matrix.m22)/determinant,
+ m21: -matrix.m21 / determinant,
+ m22: matrix.m11 / determinant,
+ ty: (matrix.tx * matrix.m21 - matrix.ty * matrix.m11) / determinant
+ };
+ }
+
+
+ $ax.public.fn.matrixMultiplyMatrix = function (matrix1, matrix2) {
+ if (!matrix1.tx) matrix1.tx = 0;
+ if (!matrix1.ty) matrix1.ty = 0;
+ if (!matrix2.tx) matrix2.tx = 0;
+ if (!matrix2.ty) matrix2.ty = 0;
+
+ return {
+ m11: matrix1.m12*matrix2.m21 + matrix1.m11*matrix2.m11,
+ m12: matrix1.m12*matrix2.m22 + matrix1.m11*matrix2.m12,
+ tx: matrix1.m12 * matrix2.ty + matrix1.m11 * matrix2.tx + matrix1.tx,
+ m21: matrix1.m22 * matrix2.m21 + matrix1.m21 * matrix2.m11,
+ m22: matrix1.m22 * matrix2.m22 + matrix1.m21 * matrix2.m12,
+ ty: matrix1.m22 * matrix2.ty + matrix1.m21 * matrix2.tx + matrix1.ty,
+ };
+ }
+
+
+ $ax.public.fn.transformFromElement = function (element) {
+ var st = window.getComputedStyle(element, null);
+
+ var tr = st.getPropertyValue("-webkit-transform") ||
+ st.getPropertyValue("-moz-transform") ||
+ st.getPropertyValue("-ms-transform") ||
+ st.getPropertyValue("-o-transform") ||
+ st.getPropertyValue("transform");
+
+ if (tr.indexOf('none') < 0) {
+ var matrix = tr.split('(')[1];
+ matrix = matrix.split(')')[0];
+ matrix = matrix.split(',');
+ for (var l = 0; l < matrix.length; l++) {
+ matrix[l] = Number(matrix[l]);
+ }
+
+ } else { matrix = [1.0, 0.0, 0.0, 1.0, 0.0, 0.0]; }
+
+ return matrix;
+ // matrix[0] = cosine, matrix[1] = sine.
+ // Assuming the element is still orthogonal.
+ }
+
+ $ax.public.fn.vectorMinus = function(vector1, vector2) { return { x: vector1.x - vector2.x, y: vector1.y - vector2.y }; }
+
+ $ax.public.fn.vectorPlus = function (vector1, vector2) { return { x: vector1.x + vector2.x, y: vector1.y + vector2.y }; }
+
+ $ax.public.fn.vectorMidpoint = function (vector1, vector2) { return { x: (vector1.x + vector2.x) / 2.0, y: (vector1.y + vector2.y) / 2.0 }; }
+
+ $ax.public.fn.fourCornersToBasis = function (fourCorners) {
+ return {
+ widthVector: $ax.public.fn.vectorMinus(fourCorners.widgetTopRight, fourCorners.widgetTopLeft),
+ heightVector: $ax.public.fn.vectorMinus(fourCorners.widgetBottomLeft, fourCorners.widgetTopLeft)
+ };
+ }
+
+ $ax.public.fn.matrixString = function(m11, m21, m12, m22, tx, ty) {
+ return "Matrix(" + m11 + "," + m21 + "," + m12 + "," + m22 + ", " + tx + ", " + ty + ")";
+ }
+
+ //$ax.public.fn.getWidgetBoundingRect = function (widgetId) {
+ // var emptyRect = { left: 0, top: 0, centerPoint: { x: 0, y: 0 }, width: 0, height: 0 };
+ // var element = document.getElementById(widgetId);
+ // if (!element) return emptyRect;
+
+ // var object = $obj(widgetId);
+ // if (object && object.type && $ax.public.fn.IsLayer(object.type)) {
+ // var layerChildren = _getLayerChildrenDeep(widgetId);
+ // if (!layerChildren) return emptyRect;
+ // else return _getBoundingRectForMultipleWidgets(layerChildren);
+ // }
+ // return _getBoundingRectForSingleWidget(widgetId);
+ //};
+
+ var _getLayerChildrenDeep = $ax.public.fn.getLayerChildrenDeep = function (layerId, includeLayers, includeHidden) {
+ var deep = [];
+ var children = $ax('#' + layerId).getChildren()[0].children;
+ for (var index = 0; index < children.length; index++) {
+ var childId = children[index];
+ if(!includeHidden && !$ax.visibility.IsIdVisible(childId)) continue;
+ if ($ax.public.fn.IsLayer($obj(childId).type)) {
+ if (includeLayers) deep.push(childId);
+ var recursiveChildren = _getLayerChildrenDeep(childId, includeLayers, includeHidden);
+ for (var j = 0; j < recursiveChildren.length; j++) deep.push(recursiveChildren[j]);
+ } else deep.push(childId);
+ }
+ return deep;
+ };
+
+ //var _getBoundingRectForMultipleWidgets = function (widgetsIdArray, relativeToPage) {
+ // if (!widgetsIdArray || widgetsIdArray.constructor !== Array) return undefined;
+ // if (widgetsIdArray.length == 0) return { left: 0, top: 0, centerPoint: { x: 0, y: 0 }, width: 0, height: 0 };
+ // var widgetRect = _getBoundingRectForSingleWidget(widgetsIdArray[0], relativeToPage, true);
+ // var boundingRect = { left: widgetRect.left, right: widgetRect.right, top: widgetRect.top, bottom: widgetRect.bottom };
+
+ // for (var index = 1; index < widgetsIdArray.length; index++) {
+ // widgetRect = _getBoundingRectForSingleWidget(widgetsIdArray[index], relativeToPage);
+ // boundingRect.left = Math.min(boundingRect.left, widgetRect.left);
+ // boundingRect.top = Math.min(boundingRect.top, widgetRect.top);
+ // boundingRect.right = Math.max(boundingRect.right, widgetRect.right);
+ // boundingRect.bottom = Math.max(boundingRect.bottom, widgetRect.bottom);
+ // }
+
+ // boundingRect.centerPoint = { x: (boundingRect.right + boundingRect.left) / 2.0, y: (boundingRect.bottom + boundingRect.top) / 2.0 };
+ // boundingRect.width = boundingRect.right - boundingRect.left;
+ // boundingRect.height = boundingRect.bottom - boundingRect.top;
+ // return boundingRect;
+ //};
+
+ //var _getBoundingRectForSingleWidget = function (widgetId, relativeToPage, justSides) {
+ // var element = document.getElementById(widgetId);
+ // var boundingRect, tempBoundingRect, position;
+ // var displayChanged = _displayHackStart(element);
+
+ // if (_isCompoundVectorHtml(element)) {
+ // //tempBoundingRect = _getCompoundImageBoundingClientSize(widgetId);
+ // //position = { left: tempBoundingRect.left, top: tempBoundingRect.top };
+ // position = $(element).position();
+ // tempBoundingRect = {};
+ // tempBoundingRect.left = position.left; //= _getCompoundImageBoundingClientSize(widgetId);
+ // tempBoundingRect.top = position.top;
+ // tempBoundingRect.width = Number(element.getAttribute('data-width'));
+ // tempBoundingRect.height = Number(element.getAttribute('data-height'));
+ // } else {
+ // var boundingElement = element;
+ // if($ax.dynamicPanelManager.isIdFitToContent(widgetId)) {
+ // var stateId = $ax.visibility.GetPanelState(widgetId);
+ // if(stateId != '') boundingElement = document.getElementById(stateId);
+ // }
+ // tempBoundingRect = boundingElement.getBoundingClientRect();
+
+ // var jElement = $(element);
+ // position = jElement.position();
+ // if(jElement.css('position') == 'fixed') {
+ // position.left += Number(jElement.css('margin-left').replace("px", ""));
+ // position.top += Number(jElement.css('margin-top').replace("px", ""));
+ // }
+ // }
+
+ // var layers = $ax('#' + widgetId).getParents(true, ['layer'])[0];
+ // var flip = '';
+ // var mirrorWidth = 0;
+ // var mirrorHeight = 0;
+ // for (var i = 0; i < layers.length; i++) {
+
+ // //should always be 0,0
+ // var layerPos = $jobj(layers[i]).position();
+ // position.left += layerPos.left;
+ // position.top += layerPos.top;
+
+ // var outer = $ax.visibility.applyWidgetContainer(layers[i], true, true);
+ // if (outer.length) {
+ // var outerPos = outer.position();
+ // position.left += outerPos.left;
+ // position.top += outerPos.top;
+ // }
+
+ // //when a group is flipped we find the unflipped position
+ // var inner = $jobj(layers[i] + '_container_inner');
+ // var taggedFlip = inner.data('flip');
+ // if (inner.length && taggedFlip) {
+ // //only account for flip if transform is applied
+ // var matrix = taggedFlip && (inner.css("-webkit-transform") || inner.css("-moz-transform") ||
+ // inner.css("-ms-transform") || inner.css("-o-transform") || inner.css("transform"));
+ // if (matrix !== 'none') {
+ // flip = taggedFlip;
+ // mirrorWidth = $ax.getNumFromPx(inner.css('width'));
+ // mirrorHeight = $ax.getNumFromPx(inner.css('height'));
+ // }
+ // }
+ // }
+ // //Now account for flip
+ // if (flip == 'x') position.top = mirrorHeight - position.top - element.getBoundingClientRect().height;
+ // else if (flip == 'y') position.left = mirrorWidth - position.left - element.getBoundingClientRect().width;
+
+ // boundingRect = {
+ // left: position.left,
+ // right: position.left + tempBoundingRect.width,
+ // top: position.top,
+ // bottom: position.top + tempBoundingRect.height
+ // };
+
+ // _displayHackEnd(displayChanged);
+ // if (justSides) return boundingRect;
+
+ // boundingRect.width = boundingRect.right - boundingRect.left;
+ // boundingRect.height = boundingRect.bottom - boundingRect.top;
+
+ // boundingRect.centerPoint = {
+ // x: boundingRect.width / 2 + boundingRect.left,
+ // y: boundingRect.height / 2 + boundingRect.top
+ // };
+
+ // return boundingRect;
+ //};
+
+ var _getPointAfterRotate = $ax.public.fn.getPointAfterRotate = function (angleInDegrees, pointToRotate, centerPoint) {
+ var displacement = $ax.public.fn.vectorMinus(pointToRotate, centerPoint);
+ var rotationMatrix = $ax.public.fn.rotationMatrix(angleInDegrees);
+ rotationMatrix.tx = centerPoint.x;
+ rotationMatrix.ty = centerPoint.y;
+ return $ax.public.fn.matrixMultiply(rotationMatrix, displacement);
+ };
+
+ $ax.public.fn.getBoundingSizeForRotate = function(width, height, rotation) {
+ // point to rotate around doesn't matter since we just care about size, if location matter we need more args and location matters.
+
+ var origin = { x: 0, y: 0 };
+
+ var corner1 = { x: width, y: 0 };
+ var corner2 = { x: 0, y: height };
+ var corner3 = { x: width, y: height };
+
+ corner1 = _getPointAfterRotate(rotation, corner1, origin);
+ corner2 = _getPointAfterRotate(rotation, corner2, origin);
+ corner3 = _getPointAfterRotate(rotation, corner3, origin);
+
+ var left = Math.min(0, corner1.x, corner2.x, corner3.x);
+ var right = Math.max(0, corner1.x, corner2.x, corner3.x);
+ var top = Math.min(0, corner1.y, corner2.y, corner3.y);
+ var bottom = Math.max(0, corner1.y, corner2.y, corner3.y);
+
+ return { width: right - left, height: bottom - top };
+ }
+
+ $ax.public.fn.getBoundingRectForRotate = function (boundingRect, rotation) {
+ var centerPoint = boundingRect.centerPoint;
+ var corner1 = { x: boundingRect.left, y: boundingRect.top };
+ var corner2 = { x: boundingRect.right, y: boundingRect.top };
+ var corner3 = { x: boundingRect.right, y: boundingRect.bottom };
+ var corner4 = { x: boundingRect.left, y: boundingRect.bottom };
+ corner1 = _getPointAfterRotate(rotation, corner1, centerPoint);
+ corner2 = _getPointAfterRotate(rotation, corner2, centerPoint);
+ corner3 = _getPointAfterRotate(rotation, corner3, centerPoint);
+ corner4 = _getPointAfterRotate(rotation, corner4, centerPoint);
+
+ var left = Math.min(corner1.x, corner2.x, corner3.x, corner4.x);
+ var right = Math.max(corner1.x, corner2.x, corner3.x, corner4.x);
+ var top = Math.min(corner1.y, corner2.y, corner3.y, corner4.y);
+ var bottom = Math.max(corner1.y, corner2.y, corner3.y, corner4.y);
+
+ return { left: left, top: top, width: right - left, height: bottom - top };
+ }
+
+
+ //$ax.public.fn.getPositionRelativeToParent = function (elementId) {
+ // var element = document.getElementById(elementId);
+ // var list = _displayHackStart(element);
+ // var position = $(element).position();
+ // _displayHackEnd(list);
+ // return position;
+ //};
+
+ //var _displayHackStart = $ax.public.fn.displayHackStart = function (element) {
+ // // TODO: Options: 1) stop setting display none. Big change for this late in the game. 2) Implement our own bounding.
+ // // TODO: 3) Current method is look for any parents that are set to none, and and temporarily unblock. Don't like it, but it works.
+ // var parent = element;
+ // var displays = [];
+ // while (parent) {
+ // if (parent.style.display == 'none') {
+ // displays.push(parent);
+ // //use block to overwrites default hidden objects' display
+ // parent.style.display = 'block';
+ // }
+ // parent = parent.parentElement;
+ // }
+
+ // return displays;
+ //};
+
+ //var _displayHackEnd = $ax.public.fn.displayHackEnd = function (displayChangedList) {
+ // for (var i = 0; i < displayChangedList.length; i++) displayChangedList[i].style.display = 'none';
+ //};
+
+
+ var _isCompoundVectorHtml = $ax.public.fn.isCompoundVectorHtml = function(hElement) {
+ return hElement.hasAttribute('compoundmode') && hElement.getAttribute('compoundmode') == "true";
+ }
+
+ $ax.public.fn.removeCompound = function (jobj) { if(_isCompoundVectorHtml(jobj[0])) jobj.removeClass('compound'); }
+ $ax.public.fn.restoreCompound = function (jobj) { if (_isCompoundVectorHtml(jobj[0])) jobj.addClass('compound'); }
+
+ $ax.public.fn.compoundIdFromComponent = function(id) {
+
+ var pPos = id.indexOf('p');
+ var dashPos = id.indexOf('-');
+ if (pPos < 1) return id;
+ else if (dashPos < 0) return id.substring(0, pPos);
+ else return id.substring(0, pPos) + id.substring(dashPos);
+ }
+
+ $ax.public.fn.l2 = function (x, y) { return Math.sqrt(x * x + y * y); }
+
+ $ax.public.fn.convertToSingleImage = function (jobj) {
+ if(!jobj[0]) return;
+
+ var widgetId = jobj[0].id;
+ var object = $obj(widgetId);
+
+ if ($ax.public.fn.IsLayer(object.type)) {
+ var recursiveChildren = _getLayerChildrenDeep(widgetId, true);
+ for (var j = 0; j < recursiveChildren.length; j++)
+ $ax.public.fn.convertToSingleImage($jobj(recursiveChildren[j]));
+ return;
+ }
+
+ //var layer =
+
+ if(!_isCompoundVectorHtml(jobj[0])) return;
+
+
+ $('#' + widgetId).removeClass("compound");
+ $('#' + widgetId + '_img').removeClass("singleImg");
+ jobj[0].setAttribute('compoundmode', 'false');
+
+ var components = object.compoundChildren;
+ delete object.generateCompound;
+ for (var i = 0; i < components.length; i++) {
+ var componentJobj = $jobj($ax.public.fn.getComponentId(widgetId, components[i]));
+ componentJobj.css('display', 'none');
+ componentJobj.css('visibility', 'hidden');
+ }
+ }
+
+
+ $ax.public.fn.getContainerDimensions = function(query) {
+ // returns undefined if no containers found.
+ var containerDimensions;
+ for (var i = 0; i < query[0].children.length; i++) {
+ var node = query[0].children[i];
+ if (node.id.indexOf(query[0].id) >= 0 && node.id.indexOf('container') >= 0) {
+ containerDimensions = node.style;
+ }
+ }
+ return containerDimensions;
+ }
+
+
+ $ax.public.fn.rotationMatrix = function (angleInDegrees) {
+ var angleInRadians = angleInDegrees * (Math.PI / 180);
+ var cosTheta = Math.cos(angleInRadians);
+ var sinTheta = Math.sin(angleInRadians);
+
+ return { m11: cosTheta, m12: -sinTheta, m21: sinTheta, m22: cosTheta, tx: 0.0, ty: 0.0 };
+ }
+
+ $ax.public.fn.GetFieldFromStyle = function (query, field) {
+ var raw = query[0].style[field];
+ if (!raw) raw = query.css(field);
+ return Number(raw.replace('px', ''));
+ }
+
+
+ $ax.public.fn.setTransformHowever = function (transformString) {
+ return {
+ '-webkit-transform': transformString,
+ '-moz-transform': transformString,
+ '-ms-transform': transformString,
+ '-o-transform': transformString,
+ 'transform': transformString
+ };
+ }
+
+ $ax.public.fn.getCornersFromComponent = function (id) {
+ var element = document.getElementById(id);
+ var matrix = element ? $ax.public.fn.transformFromElement(element) : [1.0, 0.0, 0.0, 1.0, 0.0, 0.0];
+ var currentMatrix = { m11: matrix[0], m21: matrix[1], m12: matrix[2], m22: matrix[3], tx: matrix[4], ty: matrix[5] };
+ var dimensions = {};
+ var axObj = $ax('#' + id);
+ var viewportLocation = axObj.offsetLocation();
+ dimensions.left = viewportLocation.left;
+ dimensions.top = viewportLocation.top;
+ //dimensions.left = axObj.left(true);
+ //dimensions.top = axObj.top(true);
+ var size = axObj.size();
+ dimensions.width = size.width;
+ dimensions.height = size.height;
+ //var transformMatrix1 = { m11: 1, m12: 0, m21: 0, m22: 1, tx: -invariant.x, ty: -invariant.y };
+ //var transformMatrix2 = { m11: 1, m12: 0, m21: 0, m22: 1, tx: 500, ty: 500 };
+
+ var halfWidth = dimensions.width * 0.5;
+ var halfHeight = dimensions.height * 0.5;
+ //var preTransformTopLeft = { x: -halfWidth, y: -halfHeight };
+ //var preTransformBottomLeft = { x: -halfWidth, y: halfHeight };
+ var preTransformTopRight = { x: halfWidth, y: -halfHeight };
+ var preTransformBottomRight = { x: halfWidth, y: halfHeight };
+
+ return {
+ //relativeTopLeft: $ax.public.fn.matrixMultiply(currentMatrix, preTransformTopLeft),
+ //relativeBottomLeft: $ax.public.fn.matrixMultiply(currentMatrix, preTransformBottomLeft),
+ relativeTopRight: $ax.public.fn.matrixMultiply(currentMatrix, preTransformTopRight),
+ relativeBottomRight: $ax.public.fn.matrixMultiply(currentMatrix, preTransformBottomRight),
+ centerPoint: { x: dimensions.left + halfWidth, y: dimensions.top + halfHeight }
+ //originalDimensions: dimensions,
+ //transformShift: { x: matrix[4], y: matrix[5] }
+ }
+ }
+
+
+
+ $ax.public.fn.inversePathLengthFunction = function (pathFunction) {
+ // these are for computing the inverse functions of path integrals.
+
+ var makeDivisionNode = function(node1, node2) {
+ var param = 0.5 * (node1.Param + node2.Param);
+ var inBetweenNode = {
+ LowerStop: node1,
+ HigherStop: node2,
+ Param: param,
+ Position: pathFunction(param),
+ Cumulative: 0.0
+ };
+ var lowerDisplacement = $ax.public.fn.vectorMinus(node1.Position, inBetweenNode.Position);
+ inBetweenNode.LowerInterval = {
+ Length: $ax.public.fn.l2(lowerDisplacement.x, lowerDisplacement.y),
+ Node: inBetweenNode,
+ IsHigher: false
+ };
+ var higherDisplacement = $ax.public.fn.vectorMinus(node2.Position, inBetweenNode.Position);
+ inBetweenNode.HigherInterval = {
+ Length: $ax.public.fn.l2(higherDisplacement.x, higherDisplacement.y),
+ Node: inBetweenNode,
+ IsHigher: true
+ };
+ return inBetweenNode;
+ };
+
+ var expandLower = function(node) {
+ node.LowerChild = makeDivisionNode(node.LowerStop, node);
+ node.LowerChild.Parent = node;
+ };
+
+ var expandHigher = function(node) {
+ node.HigherChild = makeDivisionNode(node, node.HigherStop);
+ node.HigherChild.Parent = node;
+ };
+
+ // for this function, cumulative is a global variable
+ var cumulative = 0.0;
+ var labelCumulativeLength = function(node) {
+ if(!node.LowerChild) {
+ node.LowerStop.Cumulative = cumulative;
+ cumulative += node.LowerInterval.Length;
+ node.Cumulative = cumulative;
+ } else labelCumulativeLength(node.LowerChild);
+
+ if(!node.HigherChild) {
+ node.Cumulative = cumulative;
+ cumulative += node.HigherInterval.Length;
+ node.HigherStop.Cumulative = cumulative;
+ } else labelCumulativeLength(node.HigherChild);
+ };
+
+ var getIntervalFromPathLength = function(node, length) {
+ if(length < node.Cumulative) {
+ return node.LowerChild ? getIntervalFromPathLength(node.LowerChild, length) : node.LowerInterval;
+ } else return node.HigherChild ? getIntervalFromPathLength(node.HigherChild, length) : node.HigherInterval;
+ };
+
+ var intervalLowerEnd = function(interval) {
+ return interval.IsHigher ? interval.Node : interval.Node.LowerStop;
+ };
+
+ var intervalHigherEnd = function(interval) {
+ return interval.IsHigher ? interval.Node.HigherStop : interval.Node;
+ };
+
+ var getParameterFromPathLength = function (node, length) {
+ var interval = getIntervalFromPathLength(node, length);
+ var lowerNode = intervalLowerEnd(interval);
+ var higherNode = intervalHigherEnd(interval);
+ return lowerNode.Param + (higherNode.Param - lowerNode.Param) * (length - lowerNode.Cumulative) / (higherNode.Cumulative - lowerNode.Cumulative);
+ };
+
+ var insertIntoSortedList = function (longer, shorter, toInsert) {
+ while (true) {
+ if (!longer) {
+ longer = shorter;
+ shorter = shorter.NextLongest;
+ continue;
+ } else if (!shorter) longer.NextLongest = toInsert;
+ else {
+ if (longer.Length >= toInsert.Length && shorter.Length <= toInsert.Length) {
+ longer.NextLongest = toInsert;
+ toInsert.NextLongest = shorter;
+ } else {
+ longer = shorter;
+ shorter = shorter.NextLongest;
+ continue;
+ }
+ }
+ break;
+ }
+ }
+ var head = {Param: 0.0, Position: pathFunction(0.0) };
+ var tail = { Param: 1.0, Position: pathFunction(1.0) };
+ var root = makeDivisionNode(head, tail);
+ var currentCurveLength = root.LowerInterval.Length + root.HigherInterval.Length;
+ var longestInterval;
+ if (root.LowerInterval.Length < root.HigherInterval.Length) {
+ longestInterval = root.HigherInterval;
+ longestInterval.NextLongest = root.LowerInterval;
+ } else {
+ longestInterval = root.LowerInterval;
+ longestInterval.NextLongest = root.HigherInterval;
+ }
+ while (longestInterval.Length * 100.0 > currentCurveLength) {
+ var newNode;
+ if (longestInterval.IsHigher) {
+ expandHigher(longestInterval.Node);
+ newNode = longestInterval.Node.HigherChild;
+ } else {
+ expandLower(longestInterval.Node);
+ newNode = longestInterval.Node.LowerChild;
+ }
+ currentCurveLength += (newNode.LowerInterval.Length + newNode.HigherInterval.Length - longestInterval.Length);
+ insertIntoSortedList(null, longestInterval, newNode.LowerInterval);
+ insertIntoSortedList(null, longestInterval, newNode.HigherInterval);
+ longestInterval = longestInterval.NextLongest;
+ }
+ labelCumulativeLength(root);
+
+ return function(lengthParam) {
+ return getParameterFromPathLength(root, lengthParam * cumulative);
+ };
+ }
+});
\ No newline at end of file
diff --git a/src/原型系统/resources/scripts/axure/model.js b/src/原型系统/resources/scripts/axure/model.js
new file mode 100644
index 0000000..ffc0a10
--- /dev/null
+++ b/src/原型系统/resources/scripts/axure/model.js
@@ -0,0 +1,53 @@
+// ******* Object Model ******** //
+$axure.internal(function($ax) {
+ var _implementations = {};
+
+ var _initializeObject = function(type, obj) {
+ $.extend(obj, _implementations[type]);
+ };
+ $ax.initializeObject = _initializeObject;
+
+ var _model = $ax.model = {};
+
+ _model.idsInRdoToHideOrLimbo = function(rdoId, scriptIds) {
+ var rdoScriptId = $ax.repeater.getScriptIdFromElementId(rdoId);
+ var path = $ax.getPathFromScriptId(rdoScriptId);
+
+ if(!scriptIds) scriptIds = [];
+
+ var rdo = $ax.getObjectFromElementId(rdoId);
+ var master = $ax.pageData.masters[rdo.masterId];
+ var masterChildren = master.diagram.objects;
+ for(var i = 0; i < masterChildren.length; i++) {
+ var obj = masterChildren[i];
+ var objScriptIds = obj.scriptIds;
+ for(var j = 0; j < objScriptIds.length; j++) {
+ var scriptId = objScriptIds[j];
+ // Anything in a layer is already handled by the layer
+ if($ax.getLayerParentFromElementId(scriptId)) continue;
+
+ // Make sure in same rdo
+ var elementPath = $ax.getPathFromScriptId(scriptId);
+
+ // This is because last part of path is for the obj itself.
+ elementPath.pop();
+ if(elementPath.length != path.length) continue;
+ var samePath = true;
+ for(var k = 0; k < path.length; k++) {
+ if(elementPath[k] != path[k]) {
+ samePath = false;
+ break;
+ }
+ }
+ if(!samePath) continue;
+
+ if($ax.public.fn.IsReferenceDiagramObject(obj.type)) _model.idsInRdoToHideOrLimbo(scriptId, scriptIds);
+ else if(scriptIds.indexOf(scriptId) == -1) scriptIds.push(scriptId);
+
+ break;
+ }
+ }
+ return scriptIds;
+ };
+
+});
\ No newline at end of file
diff --git a/src/原型系统/resources/scripts/axure/move.js b/src/原型系统/resources/scripts/axure/move.js
new file mode 100644
index 0000000..f6be801
--- /dev/null
+++ b/src/原型系统/resources/scripts/axure/move.js
@@ -0,0 +1,463 @@
+$axure.internal(function($ax) {
+ var _move = {};
+ $ax.move = _move;
+
+ var widgetMoveInfo = {};
+ //register and return move info, also create container for rootlayer if needed
+ $ax.move.PrepareForMove = function (id, x, y, to, options, jobj, rootLayer, skipContainerForRootLayer) {
+ var fixedInfo = jobj ? {} : $ax.dynamicPanelManager.getFixedInfo(id);
+
+ var widget = $jobj(id);
+ var query = $ax('#' + id);
+ var isLayer = $ax.getTypeFromElementId(id) == $ax.constants.LAYER_TYPE;
+ if(!rootLayer) {
+ rootLayer = _move.getRootLayer(id);
+ if (rootLayer && !skipContainerForRootLayer) {
+ $ax.visibility.pushContainer(rootLayer, false);
+ if (isLayer) widget = $ax.visibility.applyWidgetContainer(id, true);
+ }
+ }
+ if (!jobj) jobj = widget;
+
+ var horzProp = 'left';
+ var vertProp = 'top';
+ var offsetLocation = to ? query.offsetLocation() : undefined;
+ var horzX = to ? x - offsetLocation.x : x;
+ var vertY = to ? y - offsetLocation.y : y;
+ //var horzX = to ? x - query.locRelativeIgnoreLayer(false) : x;
+ //var vertY = to ? y - query.locRelativeIgnoreLayer(true) : y;
+
+ if (fixedInfo.horizontal == 'right') {
+ horzProp = 'right';
+ horzX = to ? $(window).width() - x - $ax.getNumFromPx(jobj.css('right')) - query.width() : -x;
+ var leftChanges = -horzX;
+ } else if(fixedInfo.horizontal == 'center') {
+ horzProp = 'margin-left';
+ if (to) horzX = x - $(window).width() / 2;
+ }
+
+ if (fixedInfo.vertical == 'bottom') {
+ vertProp = 'bottom';
+ vertY = to ? $(window).height() - y - $ax.getNumFromPx(jobj.css('bottom')) - query.height() : -y;
+ var topChanges = -vertY;
+ } else if (fixedInfo.vertical == 'middle') {
+ vertProp = 'margin-top';
+ if (to) vertY = y - $(window).height() / 2;
+ }
+
+ //todo currently this always save the info, which is not needed for compound vector children and maybe some other cases
+ //let's optimize it later, only register if registerid is valid..
+ widgetMoveInfo[id] = {
+ x: leftChanges === undefined ? horzX : leftChanges,
+ y: topChanges === undefined ? vertY : topChanges,
+ options: options
+ };
+
+ return {
+ horzX: horzX,
+ vertY: vertY,
+ horzProp: horzProp,
+ vertProp: vertProp,
+ rootLayer: rootLayer,
+ jobj: jobj
+ };
+ };
+ $ax.move.GetWidgetMoveInfo = function() {
+ return $.extend({}, widgetMoveInfo);
+ };
+
+ _move.getRootLayer = function (id) {
+ var isLayer = $ax.getTypeFromElementId(id) == $ax.constants.LAYER_TYPE;
+ var rootLayer = isLayer ? id : '';
+
+ var parentIds = $ax('#' + id).getParents(true, '*')[0];
+ for(var i = 0; i < parentIds.length; i++) {
+ var parentId = parentIds[i];
+ // Keep climbing up layers until you hit a non-layer. At that point you have your root layer
+ if($ax.public.fn.IsLayer($ax.getTypeFromElementId(parentId))) rootLayer = parentId;
+ else break;
+ }
+
+ return rootLayer;
+ };
+
+ $ax.move.MoveWidget = function (id, x, y, options, to, animationCompleteCallback, shouldFire, jobj, skipOnMoveEvent) {
+ var moveInfo = $ax.move.PrepareForMove(id, x, y, to, options, jobj);
+ $ax.drag.LogMovedWidgetForDrag(id, options.dragInfo);
+
+ var object = $obj(id);
+ if(object && $ax.public.fn.IsLayer(object.type)) {
+ var childrenIds = $ax.public.fn.getLayerChildrenDeep(id, true);
+ //don't push container when register moveinfo for child
+ if(!skipOnMoveEvent) {
+ for(var i = 0; i < childrenIds.length; i++) $ax.move.PrepareForMove(childrenIds[i], x, y, to, options, null, moveInfo.rootLayer, true);
+ }
+ }
+
+ //if(!moveInfo) moveInfo = _getMoveInfo(id, x, y, to, options, jobj);
+
+ jobj = moveInfo.jobj;
+
+ _moveElement(id, options, animationCompleteCallback, shouldFire, jobj, moveInfo);
+
+ if(skipOnMoveEvent) return;
+ $ax.event.raiseSyntheticEvent(id, "onMove");
+ if(childrenIds) {
+ for(var i = 0; i < childrenIds.length; i++) $ax.event.raiseSyntheticEvent(childrenIds[i], 'onMove');
+ }
+ };
+
+ var _moveElement = function (id, options, animationCompleteCallback, shouldFire, jobj, moveInfo){
+ var cssStyles = {};
+
+ if(!$ax.dynamicPanelManager.isPercentWidthPanel($obj(id))) cssStyles[moveInfo.horzProp] = '+=' + moveInfo.horzX;
+ cssStyles[moveInfo.vertProp] = '+=' + moveInfo.vertY;
+
+ $ax.visibility.moveMovedLocation(id, moveInfo.horzX, moveInfo.vertY);
+
+ // I don't think root layer is necessary anymore after changes to layer container structure.
+ // Wait to try removing it until more stable.
+ var rootLayer = moveInfo.rootLayer;
+
+ var query = $addAll(jobj, id);
+ var completeCount = query.length;
+ var completeAnimation = function() {
+ completeCount--;
+ if(completeCount == 0 && rootLayer) $ax.visibility.popContainer(rootLayer, false);
+ if(animationCompleteCallback) animationCompleteCallback();
+ if(shouldFire) $ax.action.fireAnimationFromQueue(id, $ax.action.queueTypes.move);
+ };
+ if(options.easing==='none') {
+ query.animate(cssStyles, { duration: 0, queue: false });
+
+ if(rootLayer) $ax.visibility.popContainer(rootLayer, false);
+ if(animationCompleteCallback) animationCompleteCallback();
+ //if this widget is inside a layer, we should just remove the layer from the queue
+ if(shouldFire) $ax.action.fireAnimationFromQueue(id, $ax.action.queueTypes.move);
+ } else if (options.trajectory === 'straight' || moveInfo.horzX === 0 || moveInfo.vertY === 0) {
+ query.animate(cssStyles, {
+ duration: options.duration, easing: options.easing, queue: false, complete: completeAnimation});
+ } else {
+ var initialHorzProp = $ax.getNumFromPx(query.css(moveInfo.horzProp));
+ var initialVertProp = $ax.getNumFromPx(query.css(moveInfo.vertProp));
+ var state = { parameter: 0 };
+ var ellipseArcFunctionY = function(param) {
+ return {
+ x: initialHorzProp + (1.0 - Math.cos(param * Math.PI * 0.5)) * moveInfo.horzX,
+ y: initialVertProp + Math.sin(param * Math.PI * 0.5) * moveInfo.vertY
+ };
+ };
+ var ellipseArcFunctionX = function (param) {
+ return {
+ x: initialHorzProp + Math.sin(param * Math.PI * 0.5) * moveInfo.horzX,
+ y: initialVertProp + (1.0 - Math.cos(param * Math.PI * 0.5)) * moveInfo.vertY
+ };
+ };
+ var ellipseArcFunction = (moveInfo.horzX > 0) ^ (moveInfo.vertY > 0) ^ options.trajectory === 'arcClockwise'
+ ? ellipseArcFunctionX : ellipseArcFunctionY;
+ var inverseFunction = $ax.public.fn.inversePathLengthFunction(ellipseArcFunction);
+ $(state).animate({ parameter: 1.0 }, {
+ duration: options.duration, easing: options.easing, queue: false,
+ step: function (now) {
+ var newPos = ellipseArcFunction(inverseFunction(now));
+ var changeFields = {};
+ changeFields[moveInfo.horzProp] = newPos.x;
+ changeFields[moveInfo.vertProp] = newPos.y;
+ query.css(changeFields);
+ },
+ complete: completeAnimation});
+ }
+
+ // //moveinfo is used for moving 'with this'
+ // var moveInfo = new Object();
+ // moveInfo.x = horzX;
+ // moveInfo.y = vertY;
+ // moveInfo.options = options;
+ // widgetMoveInfo[id] = moveInfo;
+
+
+ };
+
+ _move.nopMove = function(id, options) {
+ var moveInfo = new Object();
+ moveInfo.x = 0;
+ moveInfo.y = 0;
+ moveInfo.options = {};
+ moveInfo.options.easing = 'none';
+ moveInfo.options.duration = 0;
+ widgetMoveInfo[id] = moveInfo;
+
+ // Layer move using container now.
+ var obj = $obj(id);
+ if($ax.public.fn.IsLayer(obj.type)) if(options.onComplete) options.onComplete();
+
+ $ax.event.raiseSyntheticEvent(id, "onMove");
+ };
+
+ //rotationDegree: total degree to rotate
+ //centerPoint: the center of the circular path
+
+
+ var _noRotateOnlyMove = function (id, moveDelta, rotatableMove, fireAnimationQueue, easing, duration, completionCallback) {
+ moveDelta.x += rotatableMove.x;
+ moveDelta.y += rotatableMove.y;
+ if (moveDelta.x == 0 && moveDelta.y == 0) {
+ if(fireAnimationQueue) {
+ $ax.action.fireAnimationFromQueue(id, $ax.action.queueTypes.rotate);
+ $ax.action.fireAnimationFromQueue(id, $ax.action.queueTypes.move);
+ }
+ if (completionCallback) completionCallback();
+ } else {
+ $jobj(id).animate({ top: '+=' + moveDelta.y, left: '+=' + moveDelta.x }, {
+ duration: duration,
+ easing: easing,
+ queue: false,
+ complete: function () {
+ if(fireAnimationQueue) {
+ $ax.action.fireAnimationFromQueue(id, $ax.action.queueTypes.move);
+ $ax.action.fireAnimationFromQueue(id, $ax.action.queueTypes.rotate);
+ }
+ if (completionCallback) completionCallback();
+ }
+ });
+ }
+ }
+
+
+ _move.circularMove = function (id, degreeDelta, centerPoint, moveDelta, rotatableMove, resizeOffset, options, fireAnimationQueue, completionCallback, willDoRotation) {
+ var elem = $jobj(id);
+ if(!willDoRotation) elem = $addAll(elem, id);
+
+ var moveInfo = $ax.move.PrepareForMove(id, moveDelta.x, moveDelta.y, false, options);
+ // If not rotating, still need to check moveDelta and may need to handle that.
+ if (degreeDelta === 0) {
+ _noRotateOnlyMove(id, moveDelta, rotatableMove, fireAnimationQueue, options.easing, options.duration, completionCallback);
+ return;
+ }
+
+ var stepFunc = function(newDegree) {
+ var deg = newDegree - rotation.degree;
+ var widgetCenter = $ax('#' + id).offsetBoundingRect().centerPoint;
+ //var widgetCenter = $ax.public.fn.getWidgetBoundingRect(id).centerPoint;
+ //console.log("widget center of " + id + " x " + widgetCenter.x + " y " + widgetCenter.y);
+ var widgetNewCenter = $axure.fn.getPointAfterRotate(deg, widgetCenter, centerPoint);
+
+ // Start by getting the move not related to rotation, and make sure to update center point to move with it.
+ var ratio = deg / degreeDelta;
+
+ var xdelta = (moveDelta.x + rotatableMove.x) * ratio;
+ var ydelta = (moveDelta.y + rotatableMove.y) * ratio;
+ if(resizeOffset) {
+ var resizeShift = {};
+ resizeShift.x = resizeOffset.x * ratio;
+ resizeShift.y = resizeOffset.y * ratio;
+ $axure.fn.getPointAfterRotate(rotation.degree, resizeShift, { x: 0, y: 0 });
+ xdelta += resizeShift.x;
+ ydelta += resizeShift.y;
+ }
+ centerPoint.x += xdelta;
+ centerPoint.y += ydelta;
+
+ // Now for the move that is rotatable, it must be rotated
+ rotatableMove = $axure.fn.getPointAfterRotate(deg, rotatableMove, { x: 0, y: 0 });
+
+ // Now add in circular move to the mix.
+ xdelta += widgetNewCenter.x - widgetCenter.x;
+ ydelta += widgetNewCenter.y - widgetCenter.y;
+
+ $ax.visibility.moveMovedLocation(id, xdelta, ydelta);
+
+ if(xdelta < 0) elem.css('left', '-=' + -xdelta);
+ else if(xdelta > 0) elem.css('left', '+=' + xdelta);
+
+ if(ydelta < 0) elem.css('top', '-=' + -ydelta);
+ else if(ydelta > 0) elem.css('top', '+=' + ydelta);
+ };
+
+ var onComplete = function() {
+ if(fireAnimationQueue) $ax.action.fireAnimationFromQueue(id, $ax.action.queueTypes.move);
+ if(completionCallback) completionCallback();
+ if(moveInfo.rootLayer) $ax.visibility.popContainer(moveInfo.rootLayer, false);
+ var isPercentWidthPanel = $ax.dynamicPanelManager.isPercentWidthPanel($obj(id));
+ if(isPercentWidthPanel) {
+ $ax.dynamicPanelManager.updatePanelPercentWidth(id);
+ $ax.dynamicPanelManager.updatePanelContentPercentWidth(id);
+ }
+ if(elem.css('position') == 'fixed') {
+ if(!isPercentWidthPanel) elem.css('left', '');
+ elem.css('top', '');
+ }
+ };
+
+ var rotation = { degree: 0 };
+
+ if(!options.easing || options.easing === 'none' || options.duration <= 0) {
+ stepFunc(degreeDelta);
+ onComplete();
+ } else {
+ $(rotation).animate({ degree: degreeDelta }, {
+ duration: options.duration,
+ easing: options.easing,
+ queue: false,
+ step: stepFunc,
+ complete: onComplete
+ });
+ }
+ };
+
+ //rotate a widget by degree, center is 50% 50%
+ _move.rotate = function (id, degree, easing, duration, to, shouldFire, completionCallback) {
+ var currentDegree = _move.getRotationDegree(id);
+ if(to) degree = degree - currentDegree;
+
+ if(degree === 0) {
+ if (shouldFire) $ax.action.fireAnimationFromQueue(id, $ax.action.queueTypes.rotate);
+ return;
+ }
+
+ var query = $jobj(id);
+ var stepFunc = function(now) {
+ var degreeDelta = now - rotation.degree;
+ var newDegree = currentDegree + degreeDelta;
+ query.css($ax.public.fn.setTransformHowever("rotate(" + newDegree + "deg)"));
+ currentDegree = newDegree;
+ };
+
+ var onComplete = function() {
+ if(shouldFire) {
+ $ax.action.fireAnimationFromQueue($ax.public.fn.compoundIdFromComponent(id), $ax.action.queueTypes.rotate);
+ }
+ if(completionCallback) completionCallback();
+
+ $ax.annotation.adjustIconLocation(id);
+ };
+
+ var rotation = { degree: 0 };
+
+ $ax.visibility.setRotatedAngle(id, currentDegree + degree);
+
+ //if no animation, setting duration to 1, to prevent RangeError in rotation loops without animation
+ if(!easing || easing === 'none' || duration <= 0) {
+ stepFunc(degree);
+ onComplete();
+ } else {
+ $(rotation).animate({ degree: degree }, {
+ duration: duration,
+ easing: easing,
+ queue: false,
+ step: stepFunc,
+ complete: onComplete
+ });
+ }
+ };
+
+ _move.compoundRotateAround = function (id, degreeDelta, centerPoint, moveDelta, rotatableMove, resizeOffset, easing, duration, fireAnimationQueue, completionCallback) {
+ if (degreeDelta === 0) {
+ _noRotateOnlyMove($ax.public.fn.compoundIdFromComponent(id), moveDelta, rotatableMove, fireAnimationQueue, easing, duration, completionCallback, $ax.action.queueTypes.rotate);
+ return;
+ }
+ var elem = $jobj(id);
+ var rotation = { degree: 0 };
+
+ if (!easing || easing === 'none' || duration <= 0) {
+ duration = 1;
+ easing = 'linear'; //it doesn't matter anymore here...
+ }
+
+ var originalWidth = $ax.getNumFromPx(elem.css('width'));
+ var originalHeight = $ax.getNumFromPx(elem.css('height'));
+ var originalLeft = $ax.getNumFromPx(elem.css('left'));
+ var originalTop = $ax.getNumFromPx(elem.css('top'));
+
+ $(rotation).animate({ degree: degreeDelta }, {
+ duration: duration,
+ easing: easing,
+ queue: false,
+ step: function (newDegree) {
+ var transform = $ax.public.fn.transformFromElement(elem[0]);
+ var originalCenter = { x: originalLeft + 0.5 * originalWidth, y: originalTop + 0.5 * originalHeight};
+ var componentCenter = { x: originalCenter.x + transform[4], y: originalCenter.y + transform[5] };
+ var deg = newDegree - rotation.degree;
+ var ratio = deg / degreeDelta;
+ var xdelta = (moveDelta.x + rotatableMove.x) * ratio;
+ var ydelta = (moveDelta.y + rotatableMove.y) * ratio;
+ if (resizeOffset) {
+ var resizeShift = {};
+ resizeShift.x = resizeOffset.x * ratio;
+ resizeShift.y = resizeOffset.y * ratio;
+ $axure.fn.getPointAfterRotate(rotation.degree, resizeShift, { x: 0, y: 0 });
+ xdelta += resizeShift.x;
+ ydelta += resizeShift.y;
+ }
+
+ var rotationMatrix = $ax.public.fn.rotationMatrix(deg);
+ var compositionTransform = $ax.public.fn.matrixMultiplyMatrix(rotationMatrix,
+ { m11: transform[0], m21: transform[1], m12: transform[2], m22: transform[3] });
+
+ //console.log("widget center of " + id + " x " + widgetCenter.x + " y " + widgetCenter.y);
+ var widgetNewCenter = $axure.fn.getPointAfterRotate(deg, componentCenter, centerPoint);
+ var newMatrix = $ax.public.fn.matrixString(compositionTransform.m11, compositionTransform.m21, compositionTransform.m12, compositionTransform.m22,
+ widgetNewCenter.x - originalCenter.x + xdelta, widgetNewCenter.y - originalCenter.y + ydelta);
+ elem.css($ax.public.fn.setTransformHowever(newMatrix));
+ },
+ complete: function () {
+ if (fireAnimationQueue) {
+ $ax.action.fireAnimationFromQueue(elem.parent()[0].id, $ax.action.queueTypes.rotate);
+ }
+
+ if(completionCallback) completionCallback();
+ }
+ });
+ };
+
+ _move.getRotationDegreeFromElement = function(element) {
+ if(element == null) return NaN;
+
+ var transformString = element.style['transform'] ||
+ element.style['-o-transform'] ||
+ element.style['-ms-transform'] ||
+ element.style['-moz-transform'] ||
+ element.style['-webkit-transform'];
+
+ if(transformString) {
+ var rotateRegex = /rotate\(([-?0-9]+)deg\)/;
+ var degreeMatch = rotateRegex.exec(transformString);
+ if(degreeMatch && degreeMatch[1]) return parseFloat(degreeMatch[1]);
+ }
+
+ if(window.getComputedStyle) {
+ var st = window.getComputedStyle(element, null);
+ } else {
+ console.log('rotation is not supported for ie 8 and below in this version of axure rp');
+ return 0;
+ }
+
+ var tr = st.getPropertyValue("transform") ||
+ st.getPropertyValue("-o-transform") ||
+ st.getPropertyValue("-ms-transform") ||
+ st.getPropertyValue("-moz-transform") ||
+ st.getPropertyValue("-webkit-transform");
+
+ if(!tr || tr === 'none') return 0;
+ var values = tr.split('(')[1];
+ values = values.split(')')[0],
+ values = values.split(',');
+
+ var a = values[0];
+ var b = values[1];
+
+ var radians = Math.atan2(b, a);
+ if(radians < 0) {
+ radians += (2 * Math.PI);
+ }
+
+ return radians * (180 / Math.PI);
+ };
+
+ _move.getRotationDegree = function(elementId) {
+ if($ax.public.fn.IsLayer($obj(elementId).type)) {
+ return $jobj(elementId).data('layerDegree');
+ }
+ return _move.getRotationDegreeFromElement(document.getElementById(elementId));
+ }
+});
\ No newline at end of file
diff --git a/src/原型系统/resources/scripts/axure/recording.js b/src/原型系统/resources/scripts/axure/recording.js
new file mode 100644
index 0000000..f5fb140
--- /dev/null
+++ b/src/原型系统/resources/scripts/axure/recording.js
@@ -0,0 +1,94 @@
+// ******* Recording MANAGER ******** //
+
+$axure.internal(function($ax) {
+ var _recording = $ax.recording = {};
+
+ $ax.recording.recordEvent = function(element, eventInfo, axEventObject, timeStamp) {
+
+ var elementHtml = $jobj(element);
+ var className = elementHtml.attr('class');
+ var inputValue;
+
+ if(className === 'ax_checkbox') {
+ inputValue = elementHtml.find('#' + element + '_input')[0].checked;
+ eventInfo.inputType = className;
+ eventInfo.inputValue = inputValue;
+ }
+
+ if(className === 'ax_text_field') {
+ inputValue = elementHtml.find('#' + element + '_input').val();
+ eventInfo.inputType = className;
+ eventInfo.inputValue = inputValue;
+ }
+
+
+ var scriptId = $ax.repeater.getScriptIdFromElementId(element);
+ var diagramObjectPath = $ax.getPathFromScriptId(scriptId);
+ var form = {
+ recordingId: $ax.recording.recordingId,
+ elementID: element,
+ eventType: axEventObject.description,
+ 'eventInfo': eventInfo,
+ // eventObject: axEventObject,
+ 'timeStamp': timeStamp,
+ 'path': diagramObjectPath
+// ,
+// 'trigger': function() {
+// $ax.event.handleEvent(element, eventInfo, axEventObject);
+// return false;
+// }
+ };
+
+ $ax.messageCenter.postMessage('logEvent', form);
+ };
+
+
+ $ax.recording.maybeRecordEvent = function(element, eventInfo, axEventObject, timeStamp) {
+ };
+
+
+ $ax.recording.recordingId = "";
+ $ax.recording.recordingName = "";
+
+ $ax.messageCenter.addMessageListener(function(message, data) {
+ if(message === 'startRecording') {
+ $ax.recording.maybeRecordEvent = $ax.recording.recordEvent;
+ $ax.recording.recordingId = data.recordingId;
+ $ax.recording.recordingName = data.recordingName;
+ } else if(message === 'stopRecording') {
+ $ax.recording.maybeRecordEvent = function(element, eventInfo, axEventObject, timeStamp) {
+ };
+
+ }
+ else if(message === 'playEvent') {
+
+ var eventType = makeFirstLetterLower(data.eventType);
+ var inputElement;
+
+ var dObj = data.element === '' ? $ax.pageData.page : $ax.getObjectFromElementId(data.element);
+ if(!data.axEventObject) {
+ data.axEventObject = dObj && dObj.interactionMap && dObj.interactionMap[eventType];
+ }
+
+ data.eventInfo.thiswidget = $ax.getWidgetInfo(data.element);
+ data.eventInfo.item = $ax.getItemInfo(data.element);
+
+ if(data.eventInfo.inputType && data.eventInfo.inputType === 'ax_checkbox') {
+ inputElement = $jobj(data.element + '_input');
+ inputElement[0].checked = data.eventInfo.inputValue;
+ }
+
+ if(data.eventInfo.inputType && data.eventInfo.inputType === 'ax_text_field') {
+ inputElement = $jobj(data.element + '_input');
+ inputElement.val(data.eventInfo.inputValue);
+ }
+
+ $ax.event.handleEvent(data.element, data.eventInfo, data.axEventObject, false, true);
+ }
+ });
+
+ var makeFirstLetterLower = function(eventName) {
+ return eventName.substr(0, 1).toLowerCase() + eventName.substr(1);
+ };
+
+});
\ No newline at end of file
diff --git a/src/原型系统/resources/scripts/axure/repeater.js b/src/原型系统/resources/scripts/axure/repeater.js
new file mode 100644
index 0000000..648fd59
--- /dev/null
+++ b/src/原型系统/resources/scripts/axure/repeater.js
@@ -0,0 +1,2309 @@
+
+// ******* Repeater MANAGER ******** //
+$axure.internal(function($ax) {
+ var _repeaterManager = {};
+ $ax.repeater = _repeaterManager;
+
+ var _refreshType = _repeaterManager.refreshType = {
+ reset: 1,
+ persist: 2,
+ preEval: 3
+ };
+
+ //This is a mapping of current editItems
+ var repeaterToEditItems = {};
+ //This is a mapping of current filters
+ var repeaterToFilters = {};
+ // This is a mapping of current sorts
+ var repeaterToSorts = {};
+ // This is a mapping of repeater page info
+ var repeaterToPageInfo = {};
+
+ //Hopefully this can be simplified, but for now I think 3 are needed.
+ //This is the data set that is owned by this repeater. The repeater may or may not reference this data set, and others can reference it.
+ var repeaterToLocalDataSet = {};
+ //This is the data set referenced by the repeater. It is not a copy of the local data set, but a reference to a local data set (or eventually a global data set could be referenced).
+ var repeaterToCurrentDataSet = {};
+ //This is a copy of the current data set, that is replaced whenever a set or refresh is done.
+ var repeaterToActiveDataSet = {};
+ var _loadRepeaters = function() {
+ $ax(function(obj) {
+ return $ax.public.fn.IsRepeater(obj.type);
+ }).each(function(obj, repeaterId) {
+ repeaterToLocalDataSet[repeaterId] = $ax.deepCopy(obj.data);
+ repeaterToLocalDataSet[repeaterId].props = obj.dataProps;
+ repeaterToEditItems[repeaterId] = [];
+
+ _initPageInfo(obj, repeaterId);
+
+ _setRepeaterDataSet(repeaterId, repeaterId);
+ var initialItemIds = obj.repeaterPropMap.itemIds;
+ for (var i = 0; i < initialItemIds.length; i++) $ax.addItemIdToRepeater(initialItemIds[i], repeaterId);
+ $ax.visibility.initRepeater(repeaterId);
+ });
+ };
+ _repeaterManager.loadRepeaters = _loadRepeaters;
+
+ var fullRefresh = {};
+ var repeatersReady = false;
+ var _initRepeaters = function () {
+ repeatersReady = true;
+ $ax(function(obj, repeaterId) {
+ return $ax.public.fn.IsRepeater(obj.type);
+ }).each(function(obj, repeaterId) {
+ _refreshRepeater(repeaterId, undefined, _refreshType.reset, !fullRefresh[repeaterId]);
+ //// Fix selected and default if necessary
+ //var states = obj.evaluatedStates[repeaterId];
+ //if(!states) return; // If there are no evaluated states the repeater id key could not be mapped to an array of states.
+
+ //for(var i = 0; i < states.length; i++) {
+ // var state = states[i];
+
+ // $ax.style.SetWidgetEnabled(state.id, true); // So selected will take place. If disabled, selected wouldn't happen.
+ // $ax.style.SetWidgetSelected(state.id, state.selected);
+ // $ax.style.SetWidgetEnabled(state.id, !state.disabled);
+ //}
+ });
+ };
+ _repeaterManager.initRefresh = _initRepeaters;
+
+ var repeatersHaveNewDataSet = [];
+ var _setRepeaterDataSet = function(repeaterId, dataSetId) {
+ //TODO: No idea about how global data sets will be handled...
+ repeaterToCurrentDataSet[repeaterId] = repeaterToLocalDataSet[dataSetId];
+ repeaterToActiveDataSet[repeaterId] = getActiveDataSet(repeaterId);
+ repeaterToFilters[repeaterId] = [];
+ repeaterToSorts[repeaterId] = [];
+
+
+ // Not using this currently
+ // if(repeatersHaveNewDataSet.indexOf(repeaterId) == -1) repeatersHaveNewDataSet[repeatersHaveNewDataSet.length] = repeaterId;
+ };
+ _repeaterManager.setDataSet = _setRepeaterDataSet;
+
+ var _refreshRepeater = function(repeaterId, eventInfo, refreshType, itemsPregen) {
+ if(!refreshType) refreshType = _refreshType.reset; // Set default
+ if(!repeatersReady) {
+ fullRefresh[repeaterId] = true;
+ return;
+ }
+
+ // Reset selected/disabled dictionaries upon reset, if necessary (reset must, persist can't, and preeval doesn't care because it hasn't been set up yet.
+ if(refreshType == _refreshType.reset) $ax.style.clearStateForRepeater(repeaterId);
+
+ // Don't show if you have a parent rdos thats limboed.
+ var rdoPath = $ax.getPathFromScriptId(repeaterId);
+ // Check each parent rdo through appropriate views to see if you are limboed
+ while (rdoPath.length > 0) {
+ if(!$ax.getScriptIdFromPath(rdoPath)) {
+ removeItems(repeaterId);
+ return;
+ }
+
+ $ax.splice(rdoPath, rdoPath.length - 1, 1);
+ }
+
+ $ax.action.refreshStart(repeaterId);
+ $ax.style.ClearCacheForRepeater(repeaterId);
+
+ if($ax.visibility.limboIds[repeaterId]) {
+ removeItems(repeaterId);
+ $ax.dynamicPanelManager.fitParentPanel(repeaterId);
+ return;
+ }
+
+ // Remove delete map if there is one at this point
+ if(eventInfo && eventInfo.repeaterDeleteMap) delete eventInfo.repeaterDeleteMap[repeaterId];
+ var path = $ax.getPathFromScriptId(repeaterId);
+ path.pop();
+
+ if(eventInfo) {
+ eventInfo = $ax.eventCopy(eventInfo);
+ }
+
+ var obj = $ax.getObjectFromScriptId(repeaterId);
+ var propMap = obj.repeaterPropMap;
+
+ //If there is no wrap, then set it to be above the number of rows
+ var viewId = $ax.adaptive.currentViewId || '';
+ var wrap = _getAdaptiveProp(propMap, 'wrap', viewId, repeaterId, obj);
+ var vertical = _getAdaptiveProp(propMap, 'vertical', viewId, repeaterId, obj);
+ //var offset = propMap[viewId];
+ var offset = propMap[_getViewIdFromPageViewId(viewId, repeaterId, obj)];
+
+ // Right now pregen only works for default adaptive view
+ if(viewId) itemsPregen = false;
+ var orderedIds = [];
+ if(itemsPregen) {
+ var repeaterChildren = $jobj(repeaterId).children();
+ // Start at 1 to skip script div child
+ for(var i = 1; i < repeaterChildren.length; i++) {
+ orderedIds.push(_getItemIdFromElementId($(repeaterChildren[i]).attr('id')));
+ }
+ } else orderedIds = getOrderedIds(repeaterId, eventInfo);
+ var ids = [];
+ var background = _getAdaptiveProp(propMap, 'backColor', viewId, repeaterId, obj);
+ var hasAltColor = _getAdaptiveProp(propMap, 'hasAltColor', viewId, repeaterId, obj);
+ var altColor = hasAltColor ? _getAdaptiveProp(propMap, 'altColor', viewId, repeaterId, obj) : undefined;
+ var useAlt = false;
+
+ if(itemsPregen) {
+ var start = 0;
+ var end = orderedIds.length;
+ } else {
+ var bounds = _getVisibleDataBounds(repeaterToPageInfo[repeaterId], itemsPregen ? obj.data.length : orderedIds.length);
+ start = bounds[0];
+ end = bounds[1];
+ }
+
+ var repeaterObj = $jobj(repeaterId);
+ var preevalMap = {};
+
+ var shownCount = end - start;
+ var primaryCount = wrap == -1 ? shownCount : Math.min(shownCount, wrap);
+ var secondaryCount = wrap == -1 ? 1 : Math.ceil(shownCount / wrap);
+ var widthCount = vertical ? secondaryCount : primaryCount;
+ var heightCount = vertical ? primaryCount : secondaryCount;
+ var paddingTop = _getAdaptiveProp(propMap, 'paddingTop', viewId, repeaterId, obj);
+ var paddingLeft = _getAdaptiveProp(propMap, 'paddingLeft', viewId, repeaterId, obj);
+ var paddingY = paddingTop + _getAdaptiveProp(propMap, 'paddingBottom', viewId, repeaterId, obj);
+ var paddingX = paddingLeft + _getAdaptiveProp(propMap, 'paddingRight', viewId, repeaterId, obj);
+
+ var spacingX = _getAdaptiveProp(propMap, 'horizontalSpacing', viewId, repeaterId, obj);
+ var xOffset = offset.width + spacingX;
+ var spacingY = _getAdaptiveProp(propMap, 'verticalSpacing', viewId, repeaterId, obj);
+ var yOffset = offset.height + spacingY;
+ var repeaterSize = { width: paddingX, height: paddingY };
+ repeaterSize.width += offset.width + (widthCount - 1) * xOffset;
+ repeaterSize.height += offset.height + (heightCount - 1) * yOffset;
+ $ax.visibility.setResizedSize(repeaterId, repeaterSize.width, repeaterSize.height);
+
+ if(itemsPregen) {
+ var templateIds = [repeaterId];
+ var processScriptIds = function (full, prop, id) {
+ if(id.indexOf('_') <= 0 && id.indexOf('p') == -1) templateIds.push('u' + id);
+ };
+ $('#' + repeaterId + '_script').html().replace(/(id|for)="?u([0-9]+(p([0-9]){3})?(_[_a-z0-9]*)?)"?/g, processScriptIds);
+ for(var i = 0; i < templateIds.length; i++) {
+ for(var j = 0; j < orderedIds.length; j++) {
+ ids.push(_createElementId(templateIds[i], orderedIds[j]));
+ }
+ }
+
+ for(var pos = start; pos < end; pos++) {
+ var itemId = orderedIds[pos];
+ itemElementId = _createElementId(repeaterId, itemId);
+ var jobj = $jobj(itemElementId);
+ if(jobj.hasClass('preeval')) refreshType = _refreshType.preEval;
+ for(var i = 0; i < templateIds.length; i++) $ax.initializeObjectEvents($ax('#' + _createElementId(templateIds[i], itemId)), refreshType);
+ if(refreshType == _refreshType.preEval) {
+ preevalMap[itemId] = true;
+ jobj.removeClass('preeval');
+ }
+
+ $ax.visibility.setResizedSize(itemElementId, $ax.getNumFromPx(jobj.css('width')), $ax.getNumFromPx(jobj.css('height')));
+ $ax.visibility.setMovedLocation(itemElementId, $ax.getNumFromPx(jobj.css('left')), $ax.getNumFromPx(jobj.css('top')));
+ }
+ } else {
+ var html = $('#' + repeaterId + '_script').html();
+
+ var div = $('
');
+ div.html(html);
+ div.find('.' + $ax.visibility.HIDDEN_CLASS).removeClass($ax.visibility.HIDDEN_CLASS);
+ div.find('.' + $ax.visibility.UNPLACED_CLASS).removeClass($ax.visibility.UNPLACED_CLASS);
+ div.css({
+ width: offset.width,
+ height: offset.height
+ });
+
+ _applyColorCss(background, div);
+ var altDiv = div;
+ if(hasAltColor) altDiv = _applyColorCss(altColor, div.clone());
+
+ // Hide repeater, if shown, while updating.
+ var shown = $ax.visibility.IsIdVisible(repeaterId);
+ if(shown) document.getElementById(repeaterId).style.visibility = 'hidden';
+
+ //clean up old items as late as possible
+ removeItems(repeaterId);
+ resetItemSizes(repeaterId, offset, bounds, orderedIds, vertical, wrap);
+
+ var i = 0;
+ var startTop = paddingTop;
+ var startLeft = paddingLeft;
+ if(repeaterObj.css('box-sizing') == 'border-box') {
+ startTop -= $ax.getNumFromPx(repeaterObj.css('border-top-width')) || 0;
+ startLeft -= $ax.getNumFromPx(repeaterObj.css('border-left-width')) || 0;
+ }
+ var top = startTop;
+ var left = startLeft;
+ for(pos = start; pos < end; pos++) {
+ itemId = orderedIds[pos];
+
+ var itemElementId = _createElementId(repeaterId, itemId);
+ $ax.addItemIdToRepeater(itemId, repeaterId);
+
+ ids.push(itemElementId);
+ var processId = function(full, prop, id) {
+ var elementId = _createElementId('u' + id, itemId);
+ //If there is a suffix (ex. _img), then don't push the id.
+ if (id.indexOf('_') <= 0 && id.indexOf('p') == -1) ids.push(elementId);
+ return prop + '="' + elementId + '"';
+ };
+
+ var copy = (useAlt ? altDiv : div).clone();
+ useAlt = !useAlt;
+ copy.attr('id', itemElementId);
+ copy.html(div.html().replace(/(id|for)="?u([0-9]+(p([0-9]){3})?(_[_a-z0-9]*)?)"?/g, processId));
+ if(obj.repeaterPropMap.isolateRadio) {
+ var radioButtons = copy.find(':radio');
+ for(var radioIndex = 0; radioIndex < radioButtons.length; radioIndex++) {
+ var radio = $(radioButtons[radioIndex]);
+ var oldName = radio.attr('name') || '';
+ // Can't use create element id because there could be an underscore in name
+ if(oldName) radio.attr('name', oldName + '-' + itemId);
+ }
+ }
+
+
+ copy.css({
+ 'position': 'absolute',
+ 'top': top + 'px',
+ 'left': left + 'px',
+ 'width': obj.width + 'px',
+ 'height': obj.height + 'px'
+ });
+ $('#' + repeaterId).append(copy);
+ $ax.visibility.setResizedSize(itemElementId, offset.width, offset.height);
+ $ax.visibility.setMovedLocation(itemElementId, left, top);
+
+ i++;
+ if(wrap != -1 && i % wrap == 0) {
+ if(vertical) {
+ top = startTop;
+ left += xOffset;
+ } else {
+ left = startLeft;
+ top += yOffset;
+ }
+ } else if (vertical) top += yOffset;
+ else left += xOffset;
+ }
+
+ repeaterObj.css(repeaterSize);
+
+ // Had to move this here because it sets up cursor: pointer on inline links,
+ // but must be done before style cached when adaptive view is set.
+ // TODO: Should be able to combine this with initialization done in pregen items. Just need to have ids and template ids be the same.
+ for (var i = 0; i < ids.length; i++) {
+ var id = ids[i];
+ var childJobj = $jobj(id);
+ if (obj.repeaterPropMap.isolateSelection && childJobj.attr('selectiongroup')) {
+ childJobj.attr('selectiongroup', _createElementId(childJobj.attr('selectiongroup'), _getItemIdFromElementId(id)));
+ }
+ $ax.initializeObjectEvents($ax('#' + id), refreshType);
+ }
+ }
+
+ var query = _getItemQuery(repeaterId);
+ if(viewId) $ax.adaptive.applyView(viewId, query);
+ else $ax.visibility.resetLimboAndHiddenToDefaults(_getItemQuery(repeaterId, preevalMap));
+
+ $ax.annotation.createFootnotes(query, true);
+
+ for(var index = 0; index < ids.length; index++) {
+ id = ids[index];
+
+ if ($ax.ieColorManager) $ax.ieColorManager.applyBackground($ax('#' + id));
+ //$ax.style.initializeObjectTextAlignment($ax('#' + id));
+ $ax.applyHighlight($ax('#' + id), true);
+ }
+
+ $ax.messageCenter.startCombineEventMessages();
+ $ax.cacheRepeaterInfo(repeaterId, $ax.getWidgetInfo(repeaterId));
+
+ //$ax.style.startSuspendTextAlignment();
+ // Now load
+ for(pos = start; pos < end; pos++) {
+ itemId = orderedIds[pos];
+ itemElementId = _createElementId(repeaterId, itemId);
+ if(!preevalMap[orderedIds[pos]]) $ax.event.raiseSyntheticEvent(itemElementId, 'onItemLoad', true);
+ $ax.loadDynamicPanelsAndMasters(obj.objects, path, itemId);
+ }
+ //$ax.style.resumeSuspendTextAlignment();
+
+ $ax.removeCachedRepeaterInfo(repeaterId);
+ $ax.messageCenter.endCombineEventMessages();
+
+ // Reshow repeater if it was originally shown (load is complete by now)
+ if(shown && !itemsPregen) document.getElementById(repeaterId).style.visibility = 'inherit';
+
+ $ax.dynamicPanelManager.fitParentPanel(repeaterId);
+
+ // Need to reapply the state style after refresh for text styles, and for applying a non-default style that wasn't reset for certain refreshes (adaptive changed for example). This could be way more selective but doing a safe change for the moment
+ if(refreshType != _refreshType.preEval) $ax.style.updateStateClass(repeaterId);
+
+ // Right now we assume only one refresh at a time. If we can manually trigger refreshes, that may possibly change.
+ $ax.action.refreshEnd();
+ };
+ _repeaterManager.refreshRepeater = _refreshRepeater;
+
+ var _getItemQuery = function(repeaterId, preevalMap) {
+ var query = $ax(function (diagramObject, elementId) {
+ // Also need to check that this in not preeval
+ if(preevalMap) {
+ var itemId = _getItemIdFromElementId(elementId);
+ if(preevalMap[itemId]) return false;
+ }
+
+ // All objects with the repeater as their parent, except the repeater itself.
+ var scriptId = _getScriptIdFromElementId(elementId);
+ return $ax.getParentRepeaterFromScriptId(scriptId) == repeaterId && scriptId != repeaterId;
+ });
+
+ return query;
+ }
+
+ _repeaterManager.refreshAllRepeaters = function() {
+ $ax('*').each(function(diagramObject, elementId) {
+ if(!$ax.public.fn.IsRepeater(diagramObject.type)) return;
+ if($ax.visibility.isElementIdLimboOrInLimboContainer(elementId)) return;
+ _initPageInfo(diagramObject, elementId);
+ _refreshRepeater(elementId, $ax.getEventInfoFromEvent($ax.getjBrowserEvent()), _refreshType.persist);
+ });
+ };
+
+ _repeaterManager.refreshRepeaters = function(ids, eventInfo) {
+ for(var i = 0; i < ids.length; i++) _refreshRepeater(ids[i], eventInfo);
+ };
+
+ var _initPageInfo = function(obj, elementId) {
+ var pageInfo = {};
+ var map = obj.repeaterPropMap;
+
+ var currentViewId = $ax.adaptive.currentViewId || '';
+ var itemsPerPage = _getAdaptiveProp(map, 'itemsPerPage', currentViewId, elementId, obj);
+ if(itemsPerPage == -1) pageInfo.noLimit = true;
+ else {
+ pageInfo.itemsPerPage = itemsPerPage;
+ pageInfo.currPage = _getAdaptiveProp(map, 'currPage', currentViewId, elementId, obj);
+ }
+ repeaterToPageInfo[elementId] = pageInfo;
+ };
+
+ _repeaterManager.initialize = function() {
+ $ax(function (obj) {
+ return $ax.public.fn.IsRepeater(obj.type);
+ }).each(function (obj, repeaterId) {
+ _initPregen(repeaterId);
+ });
+ }
+
+ var _initPregen = function(repeaterId) {
+ var obj = $ax.getObjectFromScriptId(repeaterId);
+ var propMap = obj.repeaterPropMap;
+
+ //If there is no wrap, then set it to be above the number of rows
+ var viewId = $ax.adaptive.currentViewId || '';
+ var wrap = _getAdaptiveProp(propMap, 'wrap', viewId, repeaterId, obj);
+ var vertical = _getAdaptiveProp(propMap, 'vertical', viewId, repeaterId, obj);
+
+ var orderedIds = [];
+ var ids = [];
+ var background = _getAdaptiveProp(propMap, 'backColor', viewId, repeaterId, obj);
+ var hasAltColor = _getAdaptiveProp(propMap, 'hasAltColor', viewId, repeaterId, obj);
+ var altColor = hasAltColor ? _getAdaptiveProp(propMap, 'altColor', viewId, repeaterId, obj) : undefined;
+ var useAlt = false;
+
+ var bounds = _getVisibleDataBounds(repeaterToPageInfo[repeaterId], obj.data.length);
+ var start = bounds[0];
+ var end = bounds[1];
+
+ // Starts empty
+ if(start == end) {
+ $ax.action.refreshEnd(repeaterId);
+ return;
+ }
+ var unprocessedBaseIds = $jobj($ax.repeater.createElementId(repeaterId, start + 1)).html().match(/(id|for)="?u([0-9]+)/g);
+ var baseIds = [];
+ if(unprocessedBaseIds) {
+ for(var i = 0; i < unprocessedBaseIds.length; i++) {
+ var val = unprocessedBaseIds[i].split('=')[1].substr(1);
+ if(baseIds.indexOf(val) == -1) baseIds.push(val);
+ }
+ }
+
+ for(var itemNum = start; itemNum < end; itemNum++) {
+ ids.push($ax.repeater.createElementId(repeaterId, itemNum + 1));
+ for(i = 0; i < baseIds.length; i++) ids.push($ax.repeater.createElementId(baseIds[i], itemNum + 1));
+ var itemId = itemNum + 1;
+ orderedIds[itemNum] = itemId;
+
+ var itemDiv = $jobj($ax.repeater.createElementId(repeaterId, itemNum + 1));
+ _applyColorCss(useAlt ? altColor : background, itemDiv);
+ if(hasAltColor) useAlt = !useAlt;
+ }
+
+ resetItemSizes(repeaterId, undefined, bounds, orderedIds, vertical, wrap);
+ };
+
+ var _applyColorCss = function(json, div) {
+ var args = json.r + ', ' + json.g + ', ' + json.b;
+ var background = json.a == 0 ? '' : json.a == 1 ? 'rgb(' + args + ')' : 'rgba(' + args + ', ' + json.a + ')';
+ if($ax.ieColorManager && json.a != 0 && json.a != 1) {
+ var ieColor = $ax.ieColorManager.getColorFromArgb(json.a * 255, json.r, json.g, json.b, true);
+ if(ieColor) background = ieColor;
+ }
+ div.css('background-color', background);
+ return div;
+ };
+
+ var _getViewIdFromPageViewId = function (pageViewId, id, diagramObject) {
+ if (diagramObject.owner.type != 'Axure:Master') {
+ return pageViewId;
+ } else {
+ var parentRdoId = $ax('#' + id).getParents(true, ['rdo'])[0][0];
+ var rdoState = $ax.style.generateState(parentRdoId);
+ var rdoStyle = $ax.style.computeFullStyle(parentRdoId, rdoState, pageViewId);
+ var viewOverride = rdoStyle.viewOverride;
+ return viewOverride;
+ }
+ }
+
+ var _getAdaptiveProp = _repeaterManager.getAdaptiveProp = function (map, prop, viewId, repeaterId, repeaterObj) {
+ var viewChain = $ax.style.getViewIdChain(viewId, repeaterId, repeaterObj);
+
+ for(var i = viewChain.length - 1; i >= 0; i--) {
+ viewId = viewChain[i];
+ var viewProps = map[viewId];
+ if(viewProps.hasOwnProperty(prop)) return viewProps[prop];
+ }
+
+ var base = repeaterObj.owner.type != 'Axure:Master' ? map[''] : map['19e82109f102476f933582835c373474'];
+ if(base.hasOwnProperty(prop)) return base[prop];
+ return map['default'][prop];
+ };
+
+ _repeaterManager.getItemCount = function(repeaterId) {
+ var data = repeaterToActiveDataSet[repeaterId].length;
+ var info = repeaterToPageInfo[repeaterId];
+ if(!info.noLimit) {
+ var start = Math.min(data, info.itemsPerPage * info.currPage);
+ var end = Math.min(data, start + info.itemsPerPage);
+ data = end - start;
+ }
+ return data;
+ };
+
+ _repeaterManager.setDisplayProps = function(obj, repeaterId, itemIndex) {
+ var data = repeaterToActiveDataSet[repeaterId];
+ var info = repeaterToPageInfo[repeaterId];
+ var start = 0;
+ var end = data.length;
+ if(!info.noLimit) {
+ start = Math.min(end, info.itemsPerPage * (info.currPage - 1));
+ end = Math.min(end, start + info.itemsPerPage);
+ }
+ var count = end - start;
+ var index = -1;
+ for(var i = 0; i < count; i++) {
+ if(data[start + i].index == itemIndex) index = i + 1;
+ }
+ if(index == -1) return;
+ obj.index = index;
+ obj.isfirst = index == 1;
+ obj.islast = index == end - start;
+ obj.iseven = index % 2 == 0;
+ obj.isodd = index % 2 == 1;
+ };
+
+ var _getVisibleDataBounds = function(pageInfo, count) {
+ var retval = [0, count];
+ if(!pageInfo.noLimit) {
+ var end = pageInfo.itemsPerPage * pageInfo.currPage;
+ var start = end - pageInfo.itemsPerPage;
+
+ // If past the end, move to last page
+ if(start >= count) {
+ pageInfo.currPage = Math.floor((count - 1) / pageInfo.itemsPerPage) + 1;
+ if(pageInfo.currPage <= 0) pageInfo.currPage = 1;
+
+ end = pageInfo.itemsPerPage * pageInfo.currPage;
+ start = end - pageInfo.itemsPerPage;
+ }
+ end = Math.min(end, count);
+ retval[0] = start;
+ retval[1] = end;
+ }
+ return retval;
+ };
+
+ _repeaterManager.getVisibleDataCount = function(repeaterId) {
+ var bounds = _getVisibleDataBounds(repeaterToPageInfo[repeaterId], repeaterToActiveDataSet[repeaterId].length);
+ return bounds[1] - bounds[0];
+ };
+
+ _repeaterManager.getDataCount = function(repeaterId) {
+ return repeaterToCurrentDataSet[repeaterId].length;
+ };
+
+ var _getFilteredDataCount = _repeaterManager.getFilteredDataCount = function(repeaterId) {
+ return repeaterToActiveDataSet[repeaterId].length;
+ };
+
+ _repeaterManager.getPageCount = function(repeaterId) {
+ var info = repeaterToPageInfo[repeaterId];
+ return info.noLimit ? 1 : Math.ceil(_getFilteredDataCount(repeaterId) / info.itemsPerPage);
+ };
+
+ _repeaterManager.getPageIndex = function(repeaterId) {
+ var info = repeaterToPageInfo[repeaterId];
+ return info.noLimit ? 1 : info.currPage;
+ };
+
+ var getActiveDataSet = function(repeaterId) {
+ var active = $ax.deepCopy(repeaterToCurrentDataSet[repeaterId]);
+ // Set up 1 indexing each item.
+ for(var i = 0; i < active.length; i++) active[i].index = i + 1;
+ return active;
+ };
+
+ var getOrderedIds = function(repeaterId, eventInfo) {
+ var data = repeaterToActiveDataSet[repeaterId] = getActiveDataSet(repeaterId);
+
+ // Filter first so less to sort
+ applyFilter(repeaterId, data, eventInfo);
+
+ // Sort next
+ var sorts = repeaterToSorts[repeaterId] || [];
+ if(sorts.length != 0 && data.length > 1) {
+ // TODO: Make this generic and factor out if we want to use it elsewhere...
+ // Compare is a function that takes 2 arguments, and returns a number. A high number means the second should go first
+ // Otherwise the first stays first.
+ var mergesort = function(list, start, end, compare) {
+ var middle = Math.floor((start + end) / 2);
+ if(middle - start > 1) mergesort(list, start, middle, compare);
+ if(end - middle > 1) mergesort(list, middle, end, compare);
+ var index1 = start;
+ var index2 = middle;
+ var tempList = [];
+ while(index1 < middle && index2 < end) {
+ tempList[tempList.length] = list[compare(list[index1], list[index2]) > 0 ? index2++ : index1++];
+ }
+ while(index1 < middle) tempList[tempList.length] = list[index1++];
+ while(index2 < end) tempList[tempList.length] = list[index2++];
+
+ // transfer from temp list to the real list.
+ for(var i = 0; i < tempList.length; i++) list[start + i] = tempList[i];
+ };
+ // Compare is the tie breaking function to us if necessary.
+ var getComparator = function(columnName, ascending, type, compare) {
+ // If this needs to be sped up, break up into several smaller functions conditioned off of type
+ return function(row1, row2) {
+ // If column undefined have it be empty string, NaN, or invalid date
+ //// If column undefined, no way to measure this, so call it a tie.
+ //if(row1[columnName] === undefined || row2[columnName] === undefined) return 0;
+
+ var text1 = (row1[columnName] && row1[columnName].text) || '';
+ var text2 = (row2[columnName] && row2[columnName].text) || '';
+
+ // This means we are case insensitive, so lowercase everything to kill casing
+ if(type == 'Text') {
+ text1 = text1.toLowerCase();
+ text2 = text2.toLowerCase();
+ }
+
+ //If tied, go to tie breaker
+ if(text1 == text2) {
+ if(compare) return compare(row1, row2);
+ // Actually a tie.
+ return 0;
+ }
+ if(type == 'Text' || type == 'Text (Case Sensitive)') {
+ if(text1 < text2 ^ ascending) return 1;
+ else return -1;
+ } else if(type == 'Number') {
+ var num1 = text1 == '' ? NaN : Number(text1);
+ var num2 = text2 == '' ? NaN : Number(text2);
+
+ if(isNaN(num1) && isNaN(num2)) return 0;
+ if(isNaN(num1) || isNaN(num2)) return isNaN(num1) ? 1 : -1;
+ if(num1 < num2 ^ ascending) return 1;
+ else return -1;
+ } else if(type == 'Date - YYYY-MM-DD' || type == 'Date - MM/DD/YYYY') {
+ var func = type == 'Date - YYYY-MM-DD' ? getDate1 : getDate2;
+ var date1 = func(text1);
+ var date2 = func(text2);
+ if(!date1.valid && !date2.valid) return 0;
+ if(!date1.valid || !date2.valid) return date1.valid ? -1 : 1;
+ var diff = date2.year - date1.year;
+ if(diff == 0) diff = date2.month - date1.month;
+ if(diff == 0) diff = date2.day - date1.day;
+ if(diff == 0) return 0;
+ return diff > 0 ^ ascending ? 1 : -1;
+ }
+ console.log('unhandled sort type');
+ return 0;
+ };
+ };
+ var compareFunc = null;
+ for(var i = 0; i < sorts.length; i++) compareFunc = getComparator(sorts[i].columnName, sorts[i].ascending, sorts[i].sortType, compareFunc);
+
+ mergesort(data, 0, data.length, compareFunc);
+ }
+
+ var ids = [];
+ for(i = 0; i < data.length; i++) ids[i] = data[i].index;
+
+ return ids;
+ };
+
+ var getDate1 = function(text) {
+ var date = { valid: false };
+ var sections = text.split('-');
+ if(sections.length == 1) sections = text.split('/');
+ if(sections.length != 3) return date;
+ date.year = Number(sections[0]);
+ date.month = Number(sections[1]);
+ date.day = Number(sections[2]);
+ date.valid = !isNaN(date.year);
+ date.valid &= !isNaN(date.month) && date.month > 0 && date.month <= 12;
+ date.valid &= !isNaN(date.day) && date.day > 0 && date.day <= daysPerMonth(date.month, date.year);
+ return date;
+ };
+
+ var getDate2 = function(text) {
+ var date = { valid: false };
+ var sections = text.split('-');
+ if(sections.length == 1) sections = text.split('/');
+ if(sections.length != 3) return date;
+ date.month = Number(sections[0]);
+ date.day = Number(sections[1]);
+ date.year = Number(sections[2]);
+ date.valid = !isNaN(date.year);
+ date.valid &= !isNaN(date.month) && date.month > 0 && date.month <= 12;
+ date.valid &= !isNaN(date.day) && date.day > 0 && date.day <= daysPerMonth(date.month, date.year);
+ return date;
+ };
+
+ var daysPerMonth = function(month, year) {
+ if(month == 9 || month == 4 || month == 6 || month == 11) return 30;
+ if(month != 2) return 31;
+
+ if(year % 4 != 0) return 28;
+ if(year % 100 != 0) return 29;
+ return year % 400 == 0 ? 29 : 28;
+ };
+
+ var applyFilter = function(repeaterId, data, eventInfo) {
+ var dataFiltered = [];
+ var filters = repeaterToFilters[repeaterId] || [];
+ if (filters.length != 0) {
+ if(!eventInfo) eventInfo = $ax.getBasicEventInfo();
+ var oldTarget = eventInfo.targetElement;
+ var oldSrc = eventInfo.srcElement;
+ var oldThis = eventInfo.thiswidget;
+ var oldItem = eventInfo.item;
+
+ var idToWidgetInfo = {};
+
+ outer:
+ for(var i = 1; i <= data.length; i++) {
+ for(var j = 0; j < filters.length; j++) {
+ eventInfo.targetElement = _createElementId(repeaterId, i);
+ eventInfo.srcElement = filters[j].thisId;
+ if(!idToWidgetInfo[eventInfo.srcElement]) idToWidgetInfo[eventInfo.srcElement] = $ax.getWidgetInfo(eventInfo.srcElement);
+ eventInfo.thiswidget = idToWidgetInfo[eventInfo.srcElement];
+ eventInfo.item = $ax.getItemInfo(eventInfo.srcElement);
+
+ if($ax.expr.evaluateExpr(filters[j].filter, eventInfo) != 'true') continue outer;
+ }
+ dataFiltered[dataFiltered.length] = data[i - 1];
+ }
+
+ for(i = 0; i < dataFiltered.length; i++) data[i] = dataFiltered[i];
+ while(data.length > dataFiltered.length) data.pop();
+
+ eventInfo.targetElement = oldTarget;
+ eventInfo.srcElement = oldSrc;
+ eventInfo.thiswidget = oldThis;
+ eventInfo.item = oldItem;
+ }
+ };
+
+ var _addFilter = function(repeaterId, removeOtherFilters, label, filter, thisId) {
+ if(removeOtherFilters) _removeFilter(repeaterId);
+
+ var filterList = repeaterToFilters[repeaterId];
+ if(!filterList) repeaterToFilters[repeaterId] = filterList = [];
+
+ var filterObj = { filter: filter, thisId: thisId };
+ if(label) filterObj.label = label;
+ filterList[filterList.length] = filterObj;
+ };
+ _repeaterManager.addFilter = _addFilter;
+
+ var _removeFilter = function(repeaterId, label) {
+ var filterList = repeaterToFilters[repeaterId];
+ // If no list, nothing to remove
+ if(!filterList) return;
+
+ // If no label, remove everything
+ if(!label) {
+ repeaterToFilters[repeaterId] = [];
+ return;
+ }
+
+ for(var i = filterList.length - 1; i >= 0; i--) {
+ var filterObj = filterList[i];
+ if(filterObj.label && filterObj.label == label) $ax.splice(filterList, i, 1);
+ }
+ };
+ _repeaterManager.removeFilter = _removeFilter;
+
+ var _addSort = function(repeaterId, label, columnName, ascending, toggle, sortType) {
+ var sortList = repeaterToSorts[repeaterId];
+ if(!sortList) repeaterToSorts[repeaterId] = sortList = [];
+
+ for(var i = 0; i < sortList.length; i++) {
+ if(columnName == sortList[i].columnName) {
+ var lastSortObj = $ax.splice(sortList, i, 1)[0];
+ if(toggle) ascending = !lastSortObj.ascending;
+ break;
+ }
+ }
+
+ var sortObj = { columnName: columnName, ascending: ascending, sortType: sortType };
+
+ if(label) sortObj.label = label;
+ sortList[sortList.length] = sortObj;
+ };
+ _repeaterManager.addSort = _addSort;
+
+ var _removeSort = function(repeaterId, label) {
+ var sortList = repeaterToSorts[repeaterId];
+ // If no list, nothing to remove
+ if(!sortList) return;
+
+ // If no label, remove everything
+ if(!label) {
+ repeaterToSorts[repeaterId] = [];
+ return;
+ }
+
+ for(var i = sortList.length - 1; i >= 0; i--) {
+ var sortObj = sortList[i];
+ if(sortObj.label && sortObj.label == label) $ax.splice(sortList, i, 1);
+ }
+ };
+ _repeaterManager.removeSort = _removeSort;
+
+ var _setRepeaterToPage = function(repeaterId, type, value, eventInfo) {
+ var pageInfo = repeaterToPageInfo[repeaterId];
+ // page doesn't matter if there is no limit.
+ if(pageInfo.noLimit) return;
+
+ var dataSet = repeaterToActiveDataSet[repeaterId];
+ if(!dataSet) dataSet = repeaterToCurrentDataSet[repeaterId];
+ var lastPage = Math.max(1, Math.ceil(dataSet.length / pageInfo.itemsPerPage));
+
+ if(type == 'Value') {
+ var val = Number($ax.expr.evaluateExpr(value, eventInfo));
+ // if invalid, default to 1, otherwise, clamp the value
+ if(isNaN(val)) val = 1;
+ else if(val < 1) val = 1;
+ else if(val > lastPage) val = lastPage;
+
+ pageInfo.currPage = val;
+ } else if(type == 'Previous') {
+ if(pageInfo.currPage > 1) pageInfo.currPage--;
+ } else if(type == 'Next') {
+ if(pageInfo.currPage < lastPage) pageInfo.currPage++;
+ } else if(type == 'Last') {
+ pageInfo.currPage = lastPage;
+ } else {
+ console.log('Unknown type');
+ }
+ };
+ _repeaterManager.setRepeaterToPage = _setRepeaterToPage;
+
+ var _setNoItemLimit = function(repeaterId) {
+ var pageInfo = repeaterToPageInfo[repeaterId];
+ delete pageInfo.currPage;
+ delete pageInfo.itemsPerPage;
+ pageInfo.noLimit = true;
+ };
+ _repeaterManager.setNoItemLimit = _setNoItemLimit;
+
+ var _setItemLimit = function(repeaterId, value, eventInfo) {
+ var pageInfo = repeaterToPageInfo[repeaterId];
+
+ if(pageInfo.noLimit) {
+ pageInfo.noLimit = false;
+ pageInfo.currPage = 1;
+ }
+
+ var oldTarget = eventInfo.targetElement;
+ eventInfo.targetElement = repeaterId;
+ var itemLimit = Number($ax.expr.evaluateExpr(value, eventInfo));
+ eventInfo.targetElement = oldTarget;
+ if(isNaN(itemLimit)) itemLimit = 20;
+ else if(itemLimit < 1) itemLimit = 1;
+ pageInfo.itemsPerPage = itemLimit;
+ };
+ _repeaterManager.setItemLimit = _setItemLimit;
+
+ var removeItems = function(repeaterId) {
+ var elementIds = $ax.getChildElementIdsForRepeater(repeaterId);
+ var itemId = $ax.getItemIdsForRepeater(repeaterId);
+ for(var i = 0; i < itemId.length; i++) $jobj(_createElementId(repeaterId, itemId[i])).remove();
+ $ax.visibility.clearLimboAndHiddenIds(elementIds);
+ $ax.visibility.clearMovedAndResizedIds(elementIds);
+ $ax.clearItemsForRepeater(repeaterId);
+ };
+
+ var repeaterSizes = {};
+ var resetItemSizes = function (repeaterId, itemSize, bounds, ids, vertical, wrap) {
+ var calcItem = !itemSize;
+ if(calcItem) itemSize = {};
+
+ var repeaterMap = {};
+ repeaterMap.vert = vertical;
+ var sizesMap = {};
+ var sizes = [];
+ var currSizes = wrap == -1 ? sizes : [];
+ for(var i = 0; i + bounds[0] < bounds[1]; i++) {
+ var itemId = ids[i + bounds[0]];
+ if(calcItem) {
+ var itemJobj = $jobj(_createElementId(repeaterId, itemId));
+ itemSize.width = $ax.getNumFromPx(itemJobj.css('width'));
+ itemSize.height = $ax.getNumFromPx(itemJobj.css('height'));
+ }
+
+ var size = { itemId: itemId, width: itemSize.width, height: itemSize.height };
+ currSizes.push(size);
+ sizesMap[size.itemId] = size;
+ if(currSizes.length == wrap) {
+ sizes.push(currSizes);
+ currSizes = [];
+ }
+ }
+ if (wrap != -1 && currSizes.length > 0) sizes.push(currSizes);
+ repeaterMap.sizes = sizes;
+ repeaterMap.sizesMap = sizesMap;
+ repeaterSizes[repeaterId] = repeaterMap;
+ };
+
+ _repeaterManager.getItemSize = function(repeaterId, itemId) {
+ var repeaterSize = repeaterSizes[repeaterId];
+ if (!repeaterSize) return false;
+ return repeaterSize.sizesMap[itemId];
+ }
+
+ _repeaterManager.setItemSize = function (repeaterId, itemId, width, height) {
+ var repeaterSize = repeaterSizes[repeaterId];
+ if(!repeaterSize) return false;
+ var size = repeaterSize.sizesMap[itemId];
+ var deltaX = width - size.width;
+ var deltaY = height - size.height;
+ if(!deltaX && !deltaY) return false;
+
+ repeaterSize.resized = true;
+
+ if(deltaX) _pushItems(repeaterId, itemId, deltaX, false, true);
+ if(deltaY) _pushItems(repeaterId, itemId, deltaY, true, true);
+
+ if(deltaX || deltaY) $ax.event.raiseSyntheticEvent(_createElementId(repeaterId, itemId), 'onItemResize');
+
+ return true;
+ }
+
+ var _pushItems = _repeaterManager.pushItems = function (repeaterId, itemId, delta, vertical, suppressFire) {
+ if(delta == 0) return;
+
+ // Update repeater item size
+ var prop = vertical ? 'height' : 'width';
+ var itemElementId = _createElementId(repeaterId, itemId);
+ var itemObj = $jobj(itemElementId);
+ itemObj.css(prop, $ax.getNumFromPx(itemObj.css(prop)) + delta);
+ $ax.visibility.setResizedSize(itemElementId, $ax.getNumFromPx(itemObj.css('width')), $ax.getNumFromPx(itemObj.css('height')));
+
+ var repeaterObj = $jobj(repeaterId);
+ var repeaterMap = repeaterSizes[repeaterId];
+ var sizes = repeaterMap.sizes;
+ var wrap = sizes[0].length != undefined;
+ var vert = repeaterMap.vert;
+
+ // Not wrapping, has to push in primary direction
+ if (!wrap && vert != vertical) {
+ var before = 0;
+ var after = 0;
+ var limit = 0;
+ for(var i = 0; i < sizes.length; i++) {
+ var size = sizes[i];
+ if(size.itemId == itemId) {
+ before = size[prop];
+ size[prop] += delta;
+ after = size[prop];
+ } else {
+ limit = limit ? Math.max(limit, size[prop]) : size[prop];
+ }
+ }
+
+ // Repeater delta is because an item can increase secondary direction, but if another item is already larger, then repeater size isn't effected.
+ var repeaterDelta = delta;
+ if(sizes.length != 1) {
+ if(after >= limit) repeaterDelta = after - Math.max(limit, before);
+ else if(before > limit) repeaterDelta = limit - before;
+ else repeaterDelta = 0;
+ }
+
+ _updateRepeaterSize(prop, repeaterObj, repeaterDelta, vert);
+
+ if(!suppressFire) $ax.event.raiseSyntheticEvent(_createElementId(repeaterId, itemId), 'onItemResize');
+ return;
+ }
+
+ var index = 0;
+ var index2 = 0;
+ // Get the indices first
+ if(wrap) {
+ outer:
+ for(; index < sizes.length; index++) {
+ var innerSizes = sizes[index];
+ for(index2 = 0; index2 < innerSizes.length; index2++) if(innerSizes[index2].itemId == itemId) break outer;
+ }
+ } else {
+ for(; index < sizes.length; index++) if(sizes[index].itemId == itemId) break;
+ }
+ // Find out who is being pushed
+ var itemIdsEffected = [];
+ if (vert == vertical) {
+ // To check for repeater resize, non-wrap is easy, for wrap you have to see if your new size is enough to effect the size given other col/row sizes.
+ repeaterDelta = delta;
+ if(wrap && sizes.length > 1) {
+ var viewId = $ax.adaptive.currentViewId || '';
+ var obj = $obj(repeaterId);
+ var spacing = _getAdaptiveProp(obj.repeaterPropMap, (vert ? 'vertical' : 'horizontal') + 'Spacing', viewId, repeaterId, obj);
+ for(i = 0; i < sizes.length; i++) {
+ var rowColSize = 0;
+ var rowCol = sizes[i];
+ for(var j = 0; j < rowCol.length; j++) {
+ if(j != 0) rowColSize += spacing;
+ rowColSize += rowCol[j][prop];
+ }
+
+ if(i == index) {
+ before = rowColSize;
+ after = before + delta;
+ } else {
+ limit = limit ? Math.max(limit, rowColSize) : rowColSize;
+ }
+ }
+
+ if(after >= limit) repeaterDelta = after - Math.max(limit, before);
+ else if (before > limit) repeaterDelta = limit - before;
+ else repeaterDelta = 0;
+ }
+
+ if (repeaterDelta) {
+ _updateRepeaterSize(prop, repeaterObj, repeaterDelta, vert);
+ }
+
+ // Done the hard part, calculating/updating new repeater size. Now just resize items and find what to push.
+ var array = wrap ? sizes[index] : sizes;
+ i = wrap ? index2 : index;
+ array[i][prop] += delta;
+
+ for(i++; i < array.length; i++) itemIdsEffected.push(array[i].itemId);
+ } else {
+ // Secondary push is more interesting. See how much your primary row/column is already pushing, if that changes
+ // then effect all rows/columns after it
+
+ // Get the biggest one in the current row/column, ignoring the one we're changing
+ var biggest = 0;
+ var currSizes = sizes[index];
+ for(i = 0; i < currSizes.length; i++) {
+ if (i == index2) continue;
+
+ biggest = Math.max(biggest, currSizes[i][prop]);
+ }
+
+ var beforeSize = Math.max(biggest, currSizes[index2][prop]);
+ currSizes[index2][prop] += delta;
+ var afterSize = Math.max(biggest, currSizes[index2][prop]);
+
+ // Nothing pushed/pulled
+ if (afterSize == beforeSize) return;
+
+ for(i = index + 1; i < sizes.length; i++) {
+ currSizes = sizes[i];
+ for(j = 0; j < currSizes.length; j++) itemIdsEffected.push(currSizes[j].itemId);
+ }
+
+ // Delta is only how much the whole row/column changed
+ delta = afterSize - beforeSize;
+
+ // Repeater resize secondary is determined by the effective delta.
+ _updateRepeaterSize(prop, repeaterObj, delta, vert);
+ }
+
+ for(i = 0; i < itemIdsEffected.length; i++) {
+ var currItemId = itemIdsEffected[i];
+ var elementId = _createElementId(repeaterId, currItemId);
+ var loc = vertical ? 'top' : 'left';
+ var jobj = $jobj(elementId);
+ var currVal = $ax.getNumFromPx(jobj.css(loc));
+ jobj.css(loc, currVal + delta);
+ $ax.visibility.setMovedLocation(elementId, $ax.getNumFromPx(jobj.css('left')), $ax.getNumFromPx(jobj.css('top')));
+ }
+
+ if(!suppressFire) $ax.event.raiseSyntheticEvent(_createElementId(repeaterId, itemId), 'onItemResize');
+ }
+
+ var _updateRepeaterSize = function(prop, jobj, delta, vert) {
+ if (delta == 0) return;
+ var val = $ax.getNumFromPx(jobj.css(prop)) + delta;
+ var border = 0;
+ if(vert) border += $ax.getNumFromPx(jobj.css('border-top-width')) + $ax.getNumFromPx(jobj.css('border-bottom-width'));
+ else border += $ax.getNumFromPx(jobj.css('border-left-width')) + $ax.getNumFromPx(jobj.css('border-right-width'));
+ val += border;
+ jobj.css(prop, val);
+ $ax.visibility.setResizedSize(jobj.attr('id'), $ax.getNumFromPx(jobj.css('width')), $ax.getNumFromPx(jobj.css('height')));
+ $ax.dynamicPanelManager.fitParentPanel(jobj.attr('id'));
+ }
+
+ var _getDataFromDataSet = function (eventInfo, repeaterId, itemId, propName, type) {
+ var row = undefined;
+ var deleteMap = eventInfo && eventInfo.repeaterDeleteMap && eventInfo.repeaterDeleteMap[repeaterId];
+ if(deleteMap) row = deleteMap.idToRow[itemId];
+
+ if(!row) {
+ var itemNum = _getRealItemId(eventInfo, repeaterId, Number(itemId));
+ row = repeaterToCurrentDataSet[repeaterId][itemNum];
+ }
+ // Default to obj with text as empty string, as we don't generate the data for empty props
+ var data = row[propName] || { text: '' };
+ //For now text is always the default. May change this to depend on context.
+ switch(type) {
+ case 'data': return data.type == 'text' ? data.text : data
+ case 'img': return (data.img && data.img[$ax.adaptive.getSketchKey()]) || data.text;
+ default: return (type && data[type]) || data.text;
+ }
+ //return type == 'data' && data.type != 'text' ? data : (type && data[type]) || data['text'];
+ };
+ _repeaterManager.getData = _getDataFromDataSet;
+
+ _repeaterManager.hasData = function(id, propName) {
+ if(!_getItemIdFromElementId(id)) return false;
+ var repeaterId = $ax.getParentRepeaterFromScriptId(_getScriptIdFromElementId(id));
+ return Boolean(repeaterToCurrentDataSet[repeaterId] && repeaterToCurrentDataSet[repeaterId].props.indexOf(propName) != -1);
+ };
+
+ var _getEventDeleteData = function(eventInfo, repeaterId) {
+ var repeaterDeleteMap = eventInfo.repeaterDeleteMap;
+ if(!repeaterDeleteMap) repeaterDeleteMap = eventInfo.repeaterDeleteMap = {};
+
+ var myDeleteMap = repeaterDeleteMap[repeaterId];
+ if(!myDeleteMap) {
+ myDeleteMap = repeaterDeleteMap[repeaterId] = {};
+ myDeleteMap.deletedIds = [];
+ myDeleteMap.idToRow = {};
+ }
+
+ return myDeleteMap;
+ };
+
+ var _getRealItemId = function(eventInfo, repeaterId, itemId) {
+ var deletedBefore = 0;
+ var map = eventInfo.repeaterDeleteMap && eventInfo.repeaterDeleteMap[repeaterId];
+ var deletedIds = map && map.deletedIds;
+ if(!deletedIds) return itemId - 1;
+
+ for(var i = 0; i < deletedIds.length; i++) if (deletedIds[i] < itemId) deletedBefore++;
+ return itemId - deletedBefore - 1;
+ }
+
+ var _addItemToDataSet = function(repeaterId, row, itemEventInfo) {
+ itemEventInfo.data = true;
+ var oldTarget = itemEventInfo.targetElement;
+ itemEventInfo.targetElement = repeaterId;
+ var dataSet = repeaterToLocalDataSet[repeaterId];
+
+ for(var propName in row) {
+ if(!row.hasOwnProperty(propName)) continue;
+ var prop = row[propName];
+ if(prop.type == 'literal') {
+ var retval = $ax.expr.evaluateExpr(prop.literal, itemEventInfo);
+ if(typeof (retval) == 'string' || retval instanceof Date) retval = { type: 'text', text: retval };
+ row[propName] = retval;
+ }
+ }
+
+ itemEventInfo.targetElement = oldTarget;
+ dataSet[dataSet.length] = row;
+ itemEventInfo.data = false;
+ };
+ _repeaterManager.addItem = _addItemToDataSet;
+
+ var _deleteItemsFromDataSet = function(repeaterId, eventInfo, type, rule) {
+ var dataSet = repeaterToCurrentDataSet[repeaterId];
+ var deleteDataMap = _getEventDeleteData(eventInfo, repeaterId);
+ var items;
+
+ // Should always be this, marked, or rule.
+ if(type == 'this') items = [_getItemIdFromElementId(eventInfo.srcElement)];
+ else if(type == 'marked') items = $ax.deepCopy(repeaterToEditItems[repeaterId]);
+ else {
+ // This should be rule
+ var visibleData = repeaterToCurrentDataSet[repeaterId];
+ items = [];
+ var oldTarget = eventInfo.targetElement;
+ for(var i = 0; i < visibleData.length + deleteDataMap.deletedIds.length; i++) {
+ var index = i + 1;
+ if(deleteDataMap.deletedIds.indexOf(index) != -1) continue;
+
+ eventInfo.targetElement = _createElementId(repeaterId, index);
+ if($ax.expr.evaluateExpr(rule, eventInfo).toLowerCase() != 'true') continue;
+ items.push(index);
+ }
+ eventInfo.targetElement = oldTarget;
+ }
+ // Want them decending
+ items.sort(function(a, b) { return b - a; });
+ var editItems = repeaterToEditItems[repeaterId];
+
+ for(i = 0; i < items.length; i++) {
+ var itemId = items[i];
+
+ // Don't delete already deletedItem
+ if(deleteDataMap.deletedIds.indexOf(itemId) != -1) continue;
+
+ var deletedRow = $ax.splice(dataSet, _getRealItemId(eventInfo, repeaterId, itemId), 1)[0];
+ deleteDataMap.deletedIds.push(itemId);
+ deleteDataMap.idToRow[itemId] = deletedRow;
+ for(var j = editItems.length - 1; j >= 0; j--) {
+ var editItem = editItems[j];
+ if(editItem == itemId) $ax.splice(editItems, j, 1);
+ else if(editItem > itemId) editItems[j] = editItem - 1;
+ }
+ }
+ };
+ _repeaterManager.deleteItems = _deleteItemsFromDataSet;
+
+ var _updateEditItemsInDataSet = function(repeaterId, propMap, eventInfo, type, rule) {
+ var oldTarget = eventInfo.targetElement;
+ var dataSet = repeaterToCurrentDataSet[repeaterId];
+ var items;
+
+ // Should always be this, marked, or rule.
+ if(type == 'this') items = [_getItemIdFromElementId(eventInfo.srcElement)];
+ else if(type == 'marked') items = repeaterToEditItems[repeaterId];
+ else {
+ // This should be rule
+ var currData = repeaterToCurrentDataSet[repeaterId];
+ items = [];
+ oldTarget = eventInfo.targetElement;
+ for(var i = 0; i < currData.length; i++) {
+ var index = i + 1;
+ eventInfo.targetElement = _createElementId(repeaterId, index);
+ if($ax.expr.evaluateExpr(rule, eventInfo).toLowerCase() != 'true') continue;
+ items.push(index);
+ }
+ eventInfo.targetElement = oldTarget;
+ }
+
+ eventInfo.data = true;
+ for(var prop in propMap) {
+ if(!propMap.hasOwnProperty(prop)) continue;
+ for(i = 0; i < items.length; i++) {
+ var data = propMap[prop];
+ var item = items[i];
+ if(data.type == 'literal') {
+ eventInfo.targetElement = _createElementId(repeaterId, item);
+ data = $ax.expr.evaluateExpr(data.literal, eventInfo);
+ if(typeof (data) == 'object' && data.isWidget) data = data.text;
+ if(typeof (data) == 'string') data = { type: 'text', text: data };
+ }
+ dataSet[_getRealItemId(eventInfo, repeaterId, item)][prop] = data;
+ }
+ }
+ eventInfo.targetElement = oldTarget;
+ eventInfo.data = false;
+ };
+ _repeaterManager.updateEditItems = _updateEditItemsInDataSet;
+
+ var _getAllItemIds = function(repeaterId) {
+ var retval = [];
+ var currDataSet = repeaterToCurrentDataSet[repeaterId];
+ for(var i = 0; i < currDataSet.length; i++) retval.push(i + 1);
+ return retval;
+ };
+ _repeaterManager.getAllItemIds = _getAllItemIds;
+
+ var _addEditItemToRepeater = function(repeaterId, itemIds) {
+ for(var i = 0; i < itemIds.length; i++) {
+ var itemId = Number(itemIds[i]);
+ var items = repeaterToEditItems[repeaterId];
+ if(items.indexOf(itemId) == -1) items[items.length] = itemId;
+ }
+ };
+ _repeaterManager.addEditItems = _addEditItemToRepeater;
+
+ var _removeEditItemFromRepeater = function(repeaterId, itemIds) {
+ for(var i = 0; i < itemIds.length; i++) {
+ var itemId = itemIds[i];
+ var items = repeaterToEditItems[repeaterId];
+ var index = items.indexOf(Number(itemId));
+ if(index != -1) $ax.splice(items, index, 1);
+ }
+ };
+ _repeaterManager.removeEditItems = _removeEditItemFromRepeater;
+
+ _repeaterManager.isEditItem = function(repeaterId, itemId) {
+ var items = repeaterToEditItems[repeaterId];
+ return items.indexOf(Number(itemId)) != -1;
+ };
+
+ var _createElementId = function(scriptId, itemId) {
+ if(!itemId) return scriptId;
+ var i = scriptId.indexOf('_');
+ var sections = i > -1 ? [scriptId.substring(0, i), scriptId.substring(i + 1)] : [scriptId];
+ var retval = sections[0] + '-' + itemId;
+ return sections.length > 1 ? retval + '_' + sections[1] : retval;
+ };
+ _repeaterManager.createElementId = _createElementId;
+
+ var _getElementId = function(scriptId, childId) {
+ var elementId = scriptId;
+ if($ax.getParentRepeaterFromScriptId(scriptId)) {
+ // Must be in the same item as the child
+ var itemId = $ax.repeater.getItemIdFromElementId(childId);
+ elementId = $ax.repeater.createElementId(scriptId, itemId);
+ }
+ return elementId;
+ };
+ _repeaterManager.getElementId = _getElementId;
+
+ var _getScriptIdFromElementId = function(elementId) {
+ if(!elementId) return elementId;
+ var sections = elementId.split('-');
+ var retval = sections[0];
+ if(sections.length <= 1) return retval;
+ sections = sections[1].split('_');
+ return sections.length > 1 ? retval + '_' + sections[1] : retval;
+ };
+ _repeaterManager.getScriptIdFromElementId = _getScriptIdFromElementId;
+
+ var _getItemIdFromElementId = function(elementId) {
+ var sections = elementId.split('-');
+ if(sections.length < 2) return '';
+ sections = sections[1].split('_');
+ return sections[0];
+ };
+ _repeaterManager.getItemIdFromElementId = _getItemIdFromElementId;
+
+ // TODO: Just inline this if we keep it this way.
+ var _applySuffixToElementId = function(id, suffix) {
+ return id + suffix;
+ // return _createElementId(_getScriptIdFromElementId(id) + suffix, _getItemIdFromElementId(id));
+ };
+ _repeaterManager.applySuffixToElementId = _applySuffixToElementId;
+
+ var _removeSuffixFromElementId = function (id) {
+ var suffixId = id.indexOf('_');
+ if(suffixId != -1) return id.substr(0, suffixId);
+
+ var partId = id.indexOf('p');
+ if(partId != -1) return _createElementId(id.substr(0, partId), _getItemIdFromElementId(id)); // item id is after part, but before suffix
+
+ return id;
+ }
+ _repeaterManager.removeSuffixFromElementId = _removeSuffixFromElementId;
+
+ // var _getRepeaterSize = function(repeaterId) {
+ // var itemCount = ($ax.getItemIdsForRepeater(repeaterId) || []).length;
+ // if(itemCount == 0) return { width: 0, height: 0 };
+
+ // var repeater = $obj(repeaterId);
+ // // Width and height per item;
+ // var width = repeater.width;
+ // var height = repeater.height;
+
+ // var viewId = $ax.adaptive.currentViewId || '';
+ // var widthIncrement = width + _getAdaptiveProp(repeater.repeaterPropMap, 'horizontalSpacing', viewId);
+ // var heightIncrement = height + _getAdaptiveProp(repeater.repeaterPropMap, 'verticalSpacing', viewId);
+
+ // var wrap = _getAdaptiveProp(repeater.repeaterPropMap, 'wrap', viewId);
+ // var vertical = _getAdaptiveProp(repeater.repeaterPropMap, 'vertical', viewId);
+
+ // if(wrap == -1 || itemCount <= wrap) {
+ // if(vertical) height += heightIncrement * (itemCount - 1);
+ // else width += widthIncrement * (itemCount - 1);
+ // } else {
+ // var primaryDim = wrap;
+ // var secondaryDim = Math.ceil(itemCount / primaryDim);
+
+ // if(vertical) {
+ // height += heightIncrement * (primaryDim - 1);
+ // width += widthIncrement * (secondaryDim - 1);
+ // } else {
+ // width += widthIncrement * (primaryDim - 1);
+ // height += heightIncrement * (secondaryDim - 1);
+ // }
+ // }
+ // return { width: width, height: height };
+ // };
+ // _repeaterManager.getRepeaterSize = _getRepeaterSize;
+
+});
+
+// ******* Dynamic Panel Manager ******** //
+$axure.internal(function($ax) {
+ // TODO: Probably a lot of the dynamic panel functions from pagescript should be moved here at some point...
+ var _dynamicPanelManager = $ax.dynamicPanelManager = {};
+
+ var _isIdFitToContent = _dynamicPanelManager.isIdFitToContent = function(id) {
+ var obj = $obj(id);
+ if (!obj || !$ax.public.fn.IsDynamicPanel(obj.type) || !obj.fitToContent) return false;
+
+ var jpanel = $jobj(id);
+ return !jpanel.attr('data-notfit');
+ };
+
+ //this function fit parent panel, also check for parent layer or repeaters
+ var _fitParentPanel = function (widgetId) {
+
+ var parentLayer = getParentLayer(widgetId);
+ if(parentLayer) {
+ if(_updateLayerRectCache(parentLayer)) _fitParentPanel(parentLayer);
+ return;
+ }
+
+ // Find parent panel if there is one.
+ var parentPanelInfo = getParentPanel(widgetId);
+ if(parentPanelInfo) {
+ var parentId = parentPanelInfo.parent;
+ _updateMobileScroll(parentId, parentPanelInfo.stateId, true);
+ if(_updateFitPanel(parentId, parentPanelInfo.state)) _fitParentPanel(parentId);
+ return;
+ }
+
+ // Otherwise, try to get parent repeater
+ var parentRepeaterId = $ax.getParentRepeaterFromElementId(widgetId);
+ var repeaterObj = $obj(parentRepeaterId);
+ if (repeaterObj && widgetId != parentRepeaterId && repeaterObj.repeaterPropMap.fitToContent) {
+ var itemId = $ax.repeater.getItemIdFromElementId(widgetId);
+ var containerId = $ax.repeater.createElementId(parentRepeaterId, itemId);
+ var childrenRect = $ax('#' + containerId).childrenBoundingRect();
+ $ax.repeater.setItemSize(parentRepeaterId, itemId, childrenRect.right, childrenRect.bottom);
+ return;
+ }
+
+ $ax.adaptive.updateMobileScrollOnBody();
+ };
+ _dynamicPanelManager.fitParentPanel = _fitParentPanel;
+
+ var _updateMobileScroll = _dynamicPanelManager.updateMobileScroll = function (panelId, stateId, blockResetScroll) {
+ if (!panelId) return false;
+
+ // Only update scroll if panel is scrollable
+ if ($ax.dynamicPanelManager.isIdFitToContent(panelId)) return false;
+ var obj = $obj(panelId);
+ if (!obj || obj.scrollbars.toLowerCase() == 'none') return false;
+
+ var stateQuery = $jobj(stateId);
+ $ax.adaptive.removeNiceScroll(stateQuery, blockResetScroll);
+
+ //check if the page is in mobile mode
+ if (!$ax.adaptive.isDeviceMode()) {
+ stateQuery.css('cursor', '');
+ return false;
+ }
+
+ var stateContentId = stateId + '_content';
+ var childrenRect = $ax('#' + stateContentId).childrenBoundingRect();
+ var size = { width: childrenRect.right, height: childrenRect.bottom };
+
+ var $stateContent = $('#' + stateContentId);
+ $stateContent.css({ 'height': size.height + 'px', 'width': size.width + 'px' });
+
+ // Apply niceScroll and update cursor
+ if (obj.isExpo) {
+ var headerHeight = obj.headerHeight ? obj.headerHeight : 0;
+ var footerHeight = obj.footerHeight ? obj.footerHeight : 0;
+
+ $ax.adaptive.addNiceScroll(stateQuery, { touchbehavior: true, bouncescroll: false, grabcursorenabled: false, railmargin: { top: headerHeight, bottom: footerHeight }, scrollbarid: stateId + "-sb" });
+ stateQuery.find('.nicescroll-rails').css('margin-top', headerHeight + 'px');
+ } else {
+ $ax.adaptive.addNiceScroll(stateQuery, { emulatetouch: true, horizrailenabled: obj.scrollbars != 'verticalAsNeeded' }, blockResetScroll);
+ }
+
+ stateQuery.css('cursor', 'url(resources/css/images/touch.cur), auto');
+ stateQuery.css('cursor', 'url(resources/css/images/touch.svg) 32 32, auto');
+ }
+
+ _dynamicPanelManager.initMobileScroll = function () {
+ var scrollable = [];
+ $ax('*').each(function (obj, elementId) {
+ var scriptId = $ax.repeater.getScriptIdFromElementId(elementId);
+ if ($ax.public.fn.IsDynamicPanel(obj.type) && obj.scrollbars != 'None' && obj.scrollbars != 'none' && !$ax.visibility.isElementIdLimboOrInLimboContainer(scriptId)) {
+ scrollable[scrollable.length] = elementId;
+ }
+ });
+ for (var i = scrollable.length - 1; i >= 0; i--) {
+ var panelId = scrollable[i];
+ var stateId = $ax.repeater.applySuffixToElementId(panelId, '_state0');
+ _updateMobileScroll(panelId, stateId, true);
+ }
+ };
+
+
+ _dynamicPanelManager.initialize = function() {
+ $axure.resize(_handleResize);
+ $(window).scroll(_handleScroll);
+ };
+
+ var percentPanelToLeftCache = [];
+ var percentPanelsInitialized = false;
+ var _handleResize = function() {
+ if(percentPanelsInitialized) {
+ for(var key in percentPanelToLeftCache) {
+ //could optimize to only update non-contained panels
+ _updatePanelPercentWidth(key);
+ }
+ } else {
+ $ax('*').each(function(obj, elementId) {
+ if(_isPercentWidthPanel(obj)) _updatePanelPercentWidth(elementId);
+ });
+ percentPanelsInitialized = true;
+ }
+ _adjustFixedCenter();
+ };
+
+ var _isPercentWidthPanel = _dynamicPanelManager.isPercentWidthPanel = function(obj) {
+ return obj && $ax.public.fn.IsDynamicPanel(obj.type) && obj.percentWidth;
+ };
+
+ _dynamicPanelManager.updatePanelContentPercentWidth = function(elementId) {
+ // if(_isPercentWidthPanel($obj(elementId))) return;
+ var stateChildrenQuery = $jobj(elementId).children('.panel_state');
+ stateChildrenQuery.children('.panel_state_content').each(
+ function() {
+ $(this).children('.ax_dynamic_panel').each(
+ function() { _updatePanelPercentWidth(this.id); }
+ );
+ }
+ );
+ };
+
+ _dynamicPanelManager.updatePercentPanelCache = function(query) {
+ query.each(function(obj, elementId) {
+ if(_isPercentWidthPanel(obj)) {
+ if(_updatePercentPanelToLeftCache(obj, elementId, true)) {
+ _updatePanelPercentWidth(elementId);
+ }
+ }
+ });
+ };
+
+ var _handleScroll = function () {
+ _adjustFixedCenter();
+ };
+
+ var fixedCenterPanels = [];
+ var fixedCenterPanelsInitialized = false;
+
+ var _adjustFixedCenter = function () {
+
+ if (!fixedCenterPanelsInitialized) {
+ $axure(function(diagramObject) {
+ return diagramObject.fixedHorizontal && diagramObject.fixedHorizontal == 'center' && !diagramObject.percentWidth;
+ })
+ .each(function (diagramObject, elementId) {
+ fixedCenterPanels.push(elementId);
+ });
+ fixedCenterPanelsInitialized = true;
+ }
+
+ for (var i = 0; i < fixedCenterPanels.length; i++) {
+ var elementId = fixedCenterPanels[i];
+ var boundingRect = $ax('#' + elementId).offsetBoundingRect();
+ var left = boundingRect.left;
+
+ var win = $(window);
+ var winWidth = win.width();
+ var elementQuery = $('#' + elementId);
+
+ if (left >= 0 && winWidth >= boundingRect.width) {
+ elementQuery.css('left', '50%');
+ continue;
+ }
+
+ var leftMargin = $ax.getNumFromPx(elementQuery.css('margin-left'));
+ var newLeft = -leftMargin;
+ elementQuery.css('left', newLeft + 'px');
+ }
+ };
+
+ _dynamicPanelManager.resetFixedPanel = function(obj, domElement) {
+ if(obj.fixedHorizontal == 'center') domElement.style.marginLeft = "";
+ if(obj.fixedVertical == 'middle') domElement.style.marginTop = "";
+ };
+
+ _dynamicPanelManager.resetAdaptivePercentPanel = function(obj, domElement) {
+ if(!_isPercentWidthPanel(obj)) return;
+
+ if(obj.fixedHorizontal == 'center') domElement.style.marginLeft = "";
+ else if(obj.fixedHorizontal == 'right') domElement.style.width = "";
+ };
+
+ var _updatePercentPanelToLeftCache = function(obj, elementId, overwrite) {
+ var wasUpdated = false;
+ var jObj = $jobj(elementId);
+ var axObj = $ax('#' + elementId);
+ if(percentPanelToLeftCache[elementId] == undefined || overwrite) {
+ if (obj.fixedHorizontal == 'center') percentPanelToLeftCache[elementId] = $ax.getNumFromPx(jObj.css('margin-left'));
+ else if (obj.fixedHorizontal == 'right') percentPanelToLeftCache[elementId] = axObj.width() + $ax.getNumFromPx(jObj.css('right'));
+ else percentPanelToLeftCache[elementId] = $ax.getNumFromPx(jObj.css('left'));
+ wasUpdated = true;
+ }
+
+ if(obj.fixedHorizontal == 'right' && _isIdFitToContent(elementId)) {
+ //var fitWidth = getContainerSize($ax.visibility.GetPanelState(elementId) + '_content').width;
+ var containerId = $ax.visibility.GetPanelState(elementId) + '_content';
+ var childrenRect = $ax('#' + containerId).childrenBoundingRect();
+ var fitWidth = childrenRect.right;
+ percentPanelToLeftCache[elementId] = fitWidth + $ax.getNumFromPx(jObj.css('right'));
+ wasUpdated = true;
+ }
+ return wasUpdated;
+ };
+
+ var _updatePanelPercentWidth = _dynamicPanelManager.updatePanelPercentWidth = function(elementId) {
+ var obj = $obj(elementId);
+ if(!_isPercentWidthPanel(obj)) return;
+
+ _updatePercentPanelToLeftCache(obj, elementId, false);
+
+ var width;
+ var x;
+
+ if(obj.fixedHorizontal) {
+ x = 0;
+ width = $(window).width();
+ } else {
+ var parentPanelInfo = getParentPanel(elementId);
+ if(parentPanelInfo) {
+ var parentId = parentPanelInfo.parent;
+ width = $ax('#' + parentId).width();
+ var parentObj = $obj(parentId);
+ if(parentObj.percentWidth) {
+ var stateId = $ax.repeater.applySuffixToElementId(parentId, '_state' + parentPanelInfo.state);
+ var stateContentId = stateId + '_content';
+ x = -$ax.getNumFromPx($jobj(stateContentId).css('margin-left'));
+ } else x = 0;
+ } else {
+ var parentRepeater = $ax.getParentRepeaterFromScriptId($ax.repeater.getScriptIdFromElementId(elementId));
+ if(parentRepeater) {
+ var itemId = $ax.repeater.getItemIdFromElementId(elementId);
+ var itemContainerId = $ax.repeater.createElementId(parentRepeater, itemId);
+ x = 0;
+ width = $ax('#' + itemContainerId).width();
+ } else {
+ var $window = $(window);
+ width = $window.width();
+ var bodyLeft = $ax.getNumFromPx($('body').css('left'));
+ var bodyWidth = $ax.getNumFromPx($('body').css('width'));
+ var isCenter = $ax.adaptive.getPageStyle().pageAlignment == 'center';
+ width = Math.max(width, bodyWidth);
+ x = isCenter ? -(width - bodyWidth) / 2 - bodyLeft : 0;
+ }
+ }
+ }
+
+ var jObj = $jobj(elementId);
+ if(obj.fixedHorizontal == 'left') jObj.css('left', x + 'px');
+ else if(obj.fixedHorizontal == 'center') {
+ jObj.css('left', x + 'px');
+ jObj.css('margin-left', 0 + 'px');
+ } else jObj.css('left', x + 'px');
+
+ jObj.css('width', width + 'px');
+
+ $ax.visibility.setResizedSize(elementId, width, $ax('#' + elementId).height());
+
+ var panelLeft = percentPanelToLeftCache[elementId];
+ var stateParent = jObj;
+ while(stateParent.children()[0].id.indexOf($ax.visibility.CONTAINER_SUFFIX) != -1) stateParent = stateParent.children();
+ var stateChildrenQuery = stateParent.children('.panel_state');
+ stateChildrenQuery.css('width', width + 'px');
+
+ if(obj.fixedHorizontal == 'center')
+ stateChildrenQuery.children('.panel_state_content').css('left', '50%').css('margin-left', panelLeft + 'px');
+ else if(obj.fixedHorizontal == 'right')
+ stateChildrenQuery.children('.panel_state_content').css('left', width - panelLeft + 'px');
+ else stateChildrenQuery.children('.panel_state_content').css('margin-left', panelLeft - x + 'px');
+ };
+
+
+ _dynamicPanelManager.updateParentsOfNonDefaultFitPanels = function () {
+ $ax('*').each(function (diagramObject, elementId) {
+ if(!$ax.public.fn.IsDynamicPanel(diagramObject.type) || !diagramObject.fitToContent) return;
+ if($ax.visibility.isElementIdLimboOrInLimboContainer(elementId)) return;
+
+ var stateId = $ax.visibility.GetPanelState(elementId);
+ if(stateId != $ax.repeater.applySuffixToElementId(elementId, '_state0')) _fitParentPanel(elementId);
+ });
+ };
+
+ _dynamicPanelManager.updateAllLayerSizeCaches = function() {
+ var fitToContent = [];
+ var layers = [];
+ $ax('*').each(function (obj, elementId) {
+ var isLayer = $ax.public.fn.IsLayer(obj.type);
+ if(!isLayer) return;
+ if($ax.visibility.isElementIdLimboOrInLimboContainer(elementId)) return;
+ layers[layers.length] = elementId;
+ });
+ for(var i = layers.length - 1; i >= 0; i--) {
+ var layerId = layers[i];
+ _updateLayerRectCache(layerId);
+ }
+ };
+
+ //_dynamicPanelManager.updateAllFitPanelsAndLayerSizeCaches = function() {
+ // var fitToContent = [];
+ // var layers = [];
+ // $ax('*').each(function (obj, elementId) {
+ // var isFitPanel = $ax.public.fn.IsDynamicPanel(obj.type) && obj.fitToContent;
+ // var isLayer = $ax.public.fn.IsLayer(obj.type);
+ // if(!isFitPanel && !isLayer) return;
+ // if($ax.visibility.isElementIdLimboOrInLimboContainer(elementId)) return;
+
+ // if(isFitPanel) {
+ // fitToContent[fitToContent.length] = elementId;
+ // } else if(isLayer) {
+ // layers[layers.length] = elementId;
+ // }
+ // });
+ // for(var i = fitToContent.length - 1; i >= 0; i--) {
+ // var panelId = fitToContent[i];
+ // var stateCount = $obj(panelId).diagrams.length;
+ // for(var j = 0; j < stateCount; j++) {
+ // $ax.dynamicPanelManager.setFitToContentCss(panelId, true);
+ // _updateFitPanel(panelId, j, true);
+ // }
+ // }
+ // for(var i = layers.length - 1; i >= 0; i--) {
+ // var layerId = layers[i];
+ // _updateLayerSizeCache(layerId);
+ // }
+ //};
+
+ //var _getCachedLayerRect = function (elementId) {
+ // var element = document.getElementById(elementId);
+ // var rect = {};
+ // rect.width = Number(element.getAttribute('data-width'));
+ // rect.height = Number(element.getAttribute('data-height'));
+ // rect.x = Number(element.getAttribute('data-left'));
+ // rect.y = Number(element.getAttribute('data-top'));
+ // return rect;
+ //}
+
+ var _updateLayerRectCache = function (elementId) {
+ //var oldRect = _getCachedLayerRect(elementId);
+
+ var axObj = $ax('#' + elementId);
+ var oldRect = axObj.offsetBoundingRect();
+
+ var childrenRect = axObj.childrenBoundingRect();
+ var size = childrenRect.size;
+ var loc = childrenRect.location;
+ //var size = axObj.size();
+ //var loc = {};
+ //loc.x = axObj.locRelativeIgnoreLayer(false);
+ //loc.y = axObj.locRelativeIgnoreLayer(true);
+
+ var sizeChange = oldRect.width != size.width || oldRect.height != size.height;
+ var locChange = oldRect.x != loc.x || oldRect.y != loc.y;
+ if(sizeChange || locChange) {
+ //var element = document.getElementById(elementId);
+ if(sizeChange) {
+ //element.setAttribute('data-width', size.width);
+ //element.setAttribute('data-height', size.height);
+ $ax.visibility.setResizedSize(elementId, size.width, size.height);
+ $ax.event.raiseSyntheticEvent(elementId, 'onResize');
+ }
+ if(locChange) {
+ //element.setAttribute('data-left', loc.x);
+ //element.setAttribute('data-top', loc.y);
+ $ax.visibility.setMovedLocation(elementId, loc.x, loc.y);
+ $ax.event.raiseSyntheticEvent(elementId, 'onMove');
+ }
+ return true;
+ }
+ return false;
+ }
+
+ _dynamicPanelManager.setFitToContentCss = function(elementId, fitToContent, oldWidth, oldHeight) {
+
+ if($ax.dynamicPanelManager.isIdFitToContent(elementId) == fitToContent) return;
+
+ var panel = $jobj(elementId);
+ var stateCss;
+ var scrollbars = $obj(elementId).scrollbars;
+
+ if(fitToContent) {
+ panel.attr('style', '');
+ panel.removeAttr('data-notfit');
+ stateCss = {};
+ stateCss.position = 'relative';
+ if(scrollbars != 'none') {
+ stateCss.overflow = 'visible';
+ stateCss['-webkit-overflow-scrolling'] = 'visible';
+ }
+ if(scrollbars == 'verticalAsNeeded') {
+ stateCss['overflow-x'] = 'visible';
+ stateCss['-ms-overflow-x'] = 'visible';
+ } else if(scrollbars == 'horizontalAsNeeded') {
+ stateCss['overflow-y'] = 'visible';
+ stateCss['-ms-overflow-y'] = 'visible';
+ }
+ panel.children().css(stateCss);
+ } else {
+ panel.attr('data-notfit', 'true');
+ var panelCss = { width: oldWidth, height: oldHeight };
+ stateCss = { width: oldWidth, height: oldHeight };
+ panelCss.overflow = 'hidden';
+ stateCss.position = 'absolute';
+ if(scrollbars != 'none') {
+ stateCss.overflow = 'auto';
+ stateCss['-webkit-overflow-scrolling'] = 'touch';
+ }
+ if(scrollbars == 'verticalAsNeeded') {
+ stateCss['overflow-x'] = 'hidden';
+ stateCss['-ms-overflow-x'] = 'hidden';
+ } else if(scrollbars == 'horizontalAsNeeded') {
+ stateCss['overflow-y'] = 'hidden';
+ stateCss['-ms-overflow-y'] = 'hidden';
+ }
+ panel.css(panelCss);
+ panel.children().css(stateCss);
+ }
+ };
+
+ var _getShownStateId = function (id) {
+ var obj = $obj(id);
+ if (!obj || !$ax.public.fn.IsDynamicPanel(obj.type)) return id;
+
+ var children = $ax.visibility.applyWidgetContainer(id, true, false, true).children();
+ for (var i = 0; i < children.length; i++) {
+ var child = children[i];
+ while ($ax.visibility.isContainer(child.id)) child = $(child).children()[0];
+ if (child && child.style && child.style.display != 'none') return child.id;
+ }
+ return id;
+ };
+
+ var _getShownStateObj = function(id) { return $ax('#' + _getShownStateId(id));}
+
+ _dynamicPanelManager.getShownState = function (id) { return $jobj(_getShownStateId(id)); };
+
+ var _getClamp = function(id) {
+ var obj = $obj(id);
+ if(!obj) return $ax('#' + id);
+ if ($ax.public.fn.IsDynamicPanel(obj.type)) return _getShownStateObj(id);
+ return $ax('#' + id);
+ };
+
+ var _updateFitPanel = function(panelId, stateIndex) {
+ if(!panelId) return false;
+
+ // Only fit if fitToContent is true
+ if(!$ax.dynamicPanelManager.isIdFitToContent(panelId)) return false;
+
+ // Traverse through children to find what size it should be.
+ var stateId = $ax.repeater.applySuffixToElementId(panelId, '_state' + stateIndex);
+
+ var stateContentId = stateId + '_content';
+ var stateQuery = $jobj(stateId);
+
+ //var size = getContainerSize(stateContentId);
+ var childrenRect = $ax('#' + stateContentId).childrenBoundingRect();
+ var size = {width: childrenRect.right, height: childrenRect.bottom};
+
+ // Skip if size hasn't changed
+ var oldWidth = stateQuery.width();
+ var oldHeight = stateQuery.height();
+ if(oldWidth == size.width && oldHeight == size.height) return false;
+
+ var isPercentWidth = $obj(panelId).percentWidth;
+ if(!isPercentWidth) stateQuery.width(size.width);
+ stateQuery.height(size.height);
+
+ //updatePercentWidth on all child panels
+ $jobj(stateContentId).children('.ax_dynamic_panel').each(
+ function() { _updatePanelPercentWidth(this.id); }
+ );
+
+ //do the following only if it is the current state
+ if(stateId != $ax.visibility.GetPanelState(panelId)) return false;
+
+ //var panelQuery = $jobj(panelId);
+ //if (!isPercentWidth) panelQuery.attr('data-width', size.width);
+ //panelQuery.attr('data-height', size.height);
+ $ax.visibility.setResizedSize(panelId, isPercentWidth ? $ax('#' + panelId).width() : size.width, size.height);
+
+ _adjustFixed(panelId, oldWidth, oldHeight, size.width, size.height);
+
+ $ax.event.raiseSyntheticEvent(panelId, 'onResize');
+ $ax.flyoutManager.updateFlyout(panelId);
+
+ return true;
+ };
+
+ // widgetId is the one that crawls up masters until it finds a parent panel, targetId is the original widgetId (not the crawling master)
+ // finds the immediate parent panel and crawls up through masters but not repeaters
+ var getParentPanel = function(widgetId, path, targetId) {
+ path = path || $ax.getPathFromScriptId($ax.repeater.getScriptIdFromElementId(widgetId));
+
+ var obj = $obj(widgetId);
+ if(obj.parentDynamicPanel) {
+ path[path.length - 1] = obj.parentDynamicPanel;
+ var parentId = $ax.getScriptIdFromPath(path);
+ if(!parentId) return undefined;
+ parentId = $ax.repeater.getElementId(parentId, widgetId);
+ var parentObj = $obj(parentId);
+ var retVal = { parent: parentId };
+ for(var i = 0; i < parentObj.diagrams.length; i++) {
+ var stateId = $ax.repeater.applySuffixToElementId(parentId, '_state' + i);
+ var stateQuery = $jobj(stateId);
+ if(stateQuery.find('#' + (targetId || widgetId)).length != 0) {
+ retVal.state = i;
+ retVal.stateId = stateId;
+ break;
+ }
+ }
+ return retVal;
+ }
+
+ if(path.length == 1) return undefined;
+
+ path.pop();
+ var parentMaster = $ax.getScriptIdFromPath(path);
+ if(!parentMaster) return undefined;
+ parentMaster = $ax.repeater.getElementId(parentMaster, widgetId);
+
+ //check if the master is in the same repeater as the widgetId widget
+ var parentMasterItemId = $ax.repeater.getItemIdFromElementId(parentMaster);
+ var widgetItemId = $ax.repeater.getItemIdFromElementId(widgetId);
+ if(parentMasterItemId != widgetItemId) return undefined;
+
+ return getParentPanel(parentMaster, path, targetId || widgetId);
+ };
+
+ // finds the immediate parent layer and crawls up through masters but not repeaters or panels
+ var getParentLayer = function (widgetId, path) {
+ path = path || $ax.getPathFromScriptId($ax.repeater.getScriptIdFromElementId(widgetId));
+
+ //gets immediate parent layer only
+ var layerId = $ax.getLayerParentFromElementId(widgetId);
+ if(layerId) return layerId;
+
+ if(path.length == 1) return undefined;
+
+ path.pop();
+ var parentMaster = $ax.getScriptIdFromPath(path);
+ if(!parentMaster) return undefined;
+ parentMaster = $ax.repeater.getElementId(parentMaster, widgetId);
+
+ //check if the master is in the same panel as the widgetId widget
+ var widgetParentPanel = getParentPanel(widgetId);
+ if(widgetParentPanel) {
+ var parentMasterParentPanel = getParentPanel(parentMaster);
+ if(!parentMasterParentPanel || widgetParentPanel.parent != parentMasterParentPanel.parent) return undefined;
+ }
+
+ //check if the master is in the same repeater as the widgetId widget
+ var parentMasterItemId = $ax.repeater.getItemIdFromElementId(parentMaster);
+ var widgetItemId = $ax.repeater.getItemIdFromElementId(widgetId);
+ if(parentMasterItemId != widgetItemId) return undefined;
+
+ return getParentLayer(parentMaster, path);
+ };
+
+ //// TODO: May be a better location for this. Used currently for rdo and panel state containers
+ //var getContainerSize = function(containerId) {
+ // var containerQuery = containerId ? $jobj(containerId) : $('#base');
+ // var children = containerQuery.children();
+ // // Default size
+ // var size = { width: 0, height: 0 };
+ // for(var i = 0; i < children.length; i++) {
+ // var child = $(children[i]);
+ // var childId = child.attr('id');
+ // //var axChild = $ax('#' + childId).width();
+
+ // var childObj = $obj(childId);
+ // if(!childObj) {
+ // // On the body there are some children that should be ignored, as they are not objects.
+ // if(!child.hasClass('basiclink') || child.get(0).tagName.toLowerCase() != 'a') continue;
+
+ // // Otherwise it should be a basic link
+ // var linkChildren = child.children();
+ // if(!linkChildren.length) continue;
+ // child = $(linkChildren[0]);
+ // childId = child.attr('id');
+ // childObj = $obj(childId);
+ // }
+
+ // // Ignore fixed
+ // if(!childId || $ax.visibility.limboIds[childId] || !$ax.visibility.IsIdVisible(childId)
+ // || $ax.public.fn.IsDynamicPanel(childObj.type) && childObj.fixedHorizontal) continue;
+
+ // var boundingRect = $ax.public.fn.getWidgetBoundingRect(childId);
+ // var position = { left: boundingRect.left, top: boundingRect.top };
+ // var width = boundingRect.width;
+ // var height = boundingRect.height;
+
+ // if($ax.public.fn.IsMaster(childObj.type)) {
+ // var masterSize = getContainerSize(childId);
+ // width = masterSize.width;
+ // height = masterSize.height;
+ // // } else if($ax.public.fn.IsRepeater(childObj.type)) {
+ // // var repeaterSize = $ax.repeater.getRepeaterSize(childId);
+ // // width = repeaterSize.width;
+ // // height = repeaterSize.height;
+
+ // // if(width == 0 && height == 0) continue;
+
+ // // position.left += childObj.x;
+ // // position.top += childObj.y;
+ // } else if ($ax.public.fn.IsDynamicPanel(childObj.type)) {
+ // if($ax.dynamicPanelManager.isIdFitToContent(childId)) {
+ // var stateQuery = $jobj($ax.visibility.GetPanelState(childId));
+ // width = stateQuery.width();
+ // height = stateQuery.height();
+ // }
+ // }
+
+ // size.width = Math.max(size.width, position.left + width);
+ // size.height = Math.max(size.height, position.top + height);
+ // }
+
+ // return size;
+ //};
+ //_dynamicPanelManager.getContainerSize = getContainerSize;
+
+ var _adjustFixed = _dynamicPanelManager.adjustFixed = function(panelId, oldWidth, oldHeight, width, height) {
+ var loc = _getFixedPosition(panelId, oldWidth, oldHeight, width, height);
+ if(loc) {
+ $ax.action.addAnimation(panelId, $ax.action.queueTypes.move, function() {
+ $ax.move.MoveWidget(panelId, loc[0], loc[1], { easing: 'none', duration: 0 }, false, null, true);
+ });
+ }
+ };
+
+ var _getFixedPosition = _dynamicPanelManager.getFixedPosition = function(panelId, oldWidth, oldHeight, width, height) {
+ var panelObj = $obj(panelId);
+ var x = 0;
+ var y = 0;
+ if(panelObj.fixedHorizontal == 'center') {
+ x = (oldWidth - width) / 2;
+ }
+ if(panelObj.fixedVertical == 'middle') {
+ y = (oldHeight - height) / 2;
+ }
+ return x == 0 && y == 0 ? undefined : [x, y];
+ };
+
+ _dynamicPanelManager.getFixedInfo = function(panelId) {
+ var panelObj = $obj(panelId);
+ if (!panelObj || !$ax.public.fn.IsDynamicPanel(panelObj.type)) return {};
+ var jobj = $jobj(panelId);
+ if(jobj.css('position') == 'absolute') return {};
+
+ var info = {};
+ var horizontal = panelObj.fixedHorizontal;
+ if(!horizontal) return info;
+
+ info.fixed = true;
+ info.horizontal = horizontal;
+ info.vertical = panelObj.fixedVertical;
+
+ if (info.horizontal == 'left') info.x = $ax.getNumFromPx(jobj.css('left'));
+ else if (info.horizontal == 'center') info.x = $ax.getNumFromPx(jobj.css('margin-left'));
+ else if (info.horizontal == 'right') info.x = $ax.getNumFromPx(jobj.css('right'));
+
+ if (info.vertical == 'top') info.y = $ax.getNumFromPx(jobj.css('top'));
+ else if (info.vertical == 'middle') info.y = $ax.getNumFromPx(jobj.css('margin-top'));
+ else if (info.vertical == 'bottom') info.y = $ax.getNumFromPx(jobj.css('bottom'));
+
+ return info;
+ };
+
+ // Show isn't necessary if this is always done before toggling (which is currently true), but I don't want that
+ // change (if it happened) to break this.
+ var _compressToggle = function (id, vert, show, easing, duration) {
+ var layer = $ax.getTypeFromElementId(id) == $ax.constants.LAYER_TYPE;
+ var locProp = vert ? 'top' : 'left';
+ var dimProp = vert ? 'height' : 'width';
+
+ var threshold;
+ var delta;
+
+ threshold = $ax('#' + id)[locProp](true);
+ delta = layer ? $ax('#' + id)[dimProp]() : _getShownStateObj(id)[dimProp]();
+
+ if(!show) {
+ // Need to make threshold bottom/right
+ threshold += delta;
+ // Delta is in the opposite direction
+ delta *= -1;
+ }
+
+ _compress(id, vert, threshold, delta, easing, duration);
+ };
+ _dynamicPanelManager.compressToggle = _compressToggle;
+
+ // Used when setting state of dynamic panel
+ var _compressDelta = function(id, oldState, newState, vert, easing, duration) {
+ var oldQuery = $jobj(oldState);
+ var newQuery = $jobj(newState);
+
+ var thresholdProp = vert ? 'top' : 'left';
+ var thresholdOffset = vert ? 'height' : 'width';
+ var threshold = $ax('#' + id)[thresholdProp](true);
+ threshold += oldQuery[thresholdOffset]();
+
+ var delta = newQuery[thresholdOffset]() - oldQuery[thresholdOffset]();
+
+ var clampOffset = vert ? 'width' : 'height';
+ var clampWidth = Math.max(oldQuery[clampOffset](), newQuery[clampOffset]());
+
+ _compress(id, vert, threshold, delta, easing, duration, clampWidth);
+ };
+ _dynamicPanelManager.compressDelta = _compressDelta;
+
+ var _compress = function (id, vert, threshold, delta, easing, duration, clampWidth) {
+ // If below, a horizantal clamp, otherwise a vertical clamp
+ var clamp = {
+ prop: vert ? 'left' : 'top',
+ offset: vert ? 'width' : 'height'
+ };
+
+ // Get clamp in coords relative to parent. Account for layers farther down
+ if($ax.getTypeFromElementId(id) == $ax.constants.LAYER_TYPE) {
+ clamp.start = $ax('#' + id)[clamp.prop](true);
+ clamp.end = clamp.start + $ax('#' + id)[clamp.offset]();
+ } else {
+ var clampLoc = $jobj(id);
+ if(typeof clampWidth == 'undefined') clampWidth = _getClamp(id)[clamp.offset]();
+
+ clamp.start = $ax.getNumFromPx(clampLoc.css(clamp.prop));
+ clamp.end = clamp.start + clampWidth;
+ }
+
+ // If clamps, threshold, or delta is not a number, can't compress.
+ if (isNaN(clamp.start) || isNaN(clamp.end) || isNaN(threshold) || isNaN(delta)) return;
+
+ // Update clamp if fixed, to account for body position (only necessary when page centered)
+ if($jobj(id).css('position') == 'fixed') {
+ var clampDelta = $('#base').position().left;
+ clamp.start -= clampDelta;
+ clamp.end -= clampDelta;
+ }
+
+ if(!easing) {
+ easing = 'none';
+ duration = 0;
+ }
+ var parent = $ax('#' + id).getParents(false, ['item', 'state', 'layer'])[0];
+ var obj = parent && $ax.getObjectFromElementId($ax.repeater.removeSuffixFromElementId(parent));
+ // Go until you hit a parent item or state, or a layer that is hidden to use as parent.
+ // Account for layer container positions as you go.
+ while(obj && $ax.public.fn.IsLayer(obj.type) && $ax.visibility.IsIdVisible(parent)) {
+ var container = $ax.visibility.applyWidgetContainer(parent, true, true);
+ // If layer is using container, offset is going to be necessary
+ if(container.length) {
+ var offsetX = $ax.getNumFromPx(container.css('left'));
+ var offsetY = $ax.getNumFromPx(container.css('top'));
+ var clampProp = clamp.prop == 'left' ? offsetX : offsetY;
+ var threshProp = clamp.prop == 'left' ? offsetY : offsetX;
+ threshold += threshProp;
+ clamp.start += clampProp;
+ clamp.end += clampProp;
+ }
+
+ parent = $ax('#' + parent).getParents(false, ['item', 'state', 'layer'])[0];
+ obj = parent && $ax.getObjectFromElementId($ax.repeater.removeSuffixFromElementId(parent));
+ }
+
+ // Add container mid push causes strange behavior because we take container into account as we go down, but if after we accounted for it,
+ // a container is added, that container is not accounted for with threshold and clamp values.
+ var layer = obj && $ax.public.fn.IsLayer(obj.type) && parent;
+ if(layer) {
+ // If your parent layer is invisible, you want to be relative to it's container. That is true already if it has a container,
+ // but if you are just adding one now, then you need to offset your values
+ var needsOffset = !$jobj(layer + '_container').length && !$ax.visibility.IsIdVisible(layer);
+ $ax.visibility.pushContainer(layer, false);
+ if(needsOffset) {
+ container = $jobj(layer + '_container');
+ offsetX = $ax.getNumFromPx(container.css('left'));
+ offsetY = $ax.getNumFromPx(container.css('top'));
+ clampProp = clamp.prop == 'left' ? offsetX : offsetY;
+ threshProp = clamp.prop == 'left' ? offsetY : offsetX;
+ threshold -= threshProp;
+ clamp.start -= clampProp;
+ clamp.end -= clampProp;
+ }
+ }
+
+ // Note: If parent is body, some of these aren't widgets
+ if(parent && $jobj(parent + '_content').length > 0) parent = parent + '_content';
+ if(parent && $jobj(parent + '_container').length > 0) parent = parent + '_container';
+ _compressChildrenHelper(id, $(parent ? '#' + parent : '#base').children(), vert, threshold, delta, clamp, easing, duration);
+
+ if(layer) $ax.visibility.popContainer(layer, false);
+
+ // Do item push
+ var itemId = $ax.repeater.getItemIdFromElementId(id);
+ if(!itemId) return;
+
+ var repeaterId = $ax.getParentRepeaterFromElementId(id);
+ // Only need to push when parent is an item directly.
+ if(parent != $ax.repeater.createElementId(repeaterId, itemId)) return;
+
+ // If repeater is fit to content, then don't worry about it, it'll be handled elsewhere
+ if(!obj.repeaterPropMap.fitToContent) $ax.repeater.pushItems(repeaterId, itemId, delta, vert);
+ };
+
+ var _compressChildrenHelper = function (id, children, vert, threshold, delta, clamp, easing, duration, parentLayer) {
+ var toMove = [];
+ var allMove = true;
+ for (var i = 0; i < children.length; i++) {
+ var child = $(children[i]);
+
+ // Check for basic links
+ if(child[0] && child[0].tagName == 'A' && child.hasClass('basiclink')) child = child.children();
+ var childId = child.attr('id');
+
+ // TODO: Played with this a lot, went with a safer fix, but I don't like the catch all with !$obj(childId), should handle these cases explicitally.
+ // ann/ref suffixes should skip without turning off allMove, lightbox should be skipped, and is unclear if allMove should be turned off, I think others including container, inner_container, div, img, and text should not be hit ever.
+ // Don't move self, and check id to make sure it a widget and not a fixed panel
+ if(childId == id || !childId || childId[0] != 'u' || !$obj(childId) || $obj(childId).fixedVertical) {
+ // ann/ref widgets should not stop allMove, they move if their widget does, and that widget will be checked and turn this off if it doesn't move
+ var suffix = childId && childId.split('_')[1];
+ allMove = allMove && (suffix == 'ann' || suffix == 'ref');
+ continue;
+ }
+
+ if ($ax.getTypeFromElementId(childId) == $ax.constants.LAYER_TYPE) {
+ $ax.visibility.pushContainer(childId, false);
+ var addSelf;
+ var container = $ax.visibility.applyWidgetContainer(childId, true, true);
+ var layerChildren = (container.length ? container : child).children();
+ //if(container.length) {
+ var offsetX = -$ax.getNumFromPx(container.css('left'));
+ var offsetY = -$ax.getNumFromPx(container.css('top'));
+ var clampProp = clamp.prop == 'left' ? offsetX : offsetY;
+ var threshProp = clamp.prop == 'left' ? offsetY : offsetX;
+ var layerClamp = { prop: clamp.prop, offset: clamp.offset, start: clamp.start + clampProp, end: clamp.end + clampProp };
+ addSelf = _compressChildrenHelper(id, layerChildren, vert, threshold + threshProp, delta, layerClamp, easing, duration, childId);
+ //} else addSelf = _compressChildrenHelper(id, layerChildren, vert, threshold, delta, clamp, easing, duration, childId);
+
+ if(addSelf) toMove.push(childId);
+ else allMove = false;
+ $ax.visibility.popContainer(childId, false);
+ continue;
+ }
+
+ var numbers = childId.substring(1).split('-');
+ if(numbers.length < 1 || isNaN(Number(numbers[0])) || (numbers.length == 2 && isNaN(Number(numbers[1]))) || numbers.length > 2) continue;
+
+ var marker, childClamp;
+
+ var axChild = $ax('#' + childId);
+ var markerProp = vert ? 'top' : 'left';
+ marker = Number(axChild[markerProp](true));
+ childClamp = [Number(axChild[clamp.prop](true))];
+
+ if(parentLayer) {
+ var axParent = $ax('#' + parentLayer);
+ marker -= Number(axParent[markerProp](true));
+ childClamp[0] -= Number(axParent[clamp.prop](true));
+ }
+
+ // Dynamic panels are not reporting correct size sometimes, so pull it from the state. Get shown state just returns the widget if it is not a dynamic panel.
+ var sizeChild = _getShownStateObj(childId);
+ childClamp[1] = childClamp[0] + sizeChild[clamp.offset]();
+
+ if(isNaN(marker) || isNaN(childClamp[0]) || isNaN(childClamp[1]) ||
+ marker < threshold || childClamp[1] <= clamp.start || childClamp[0] >= clamp.end) {
+ allMove = false;
+ continue;
+ }
+
+ toMove.push(childId);
+ }
+
+ if (allMove && parentLayer) {
+ return true;
+ } else {
+ for(var i = 0; i < toMove.length; i++) {
+ $ax('#' + toMove[i]).moveBy(vert ? 0 : delta, vert ? delta : 0, easing == 'none' ? {} : { duration: duration, easing: easing });
+ }
+ }
+ return false;
+ };
+
+ var _parentHandlesStyles = function(id) {
+ var parents = $ax('#' + id).getParents(true, ['dynamicPanel', 'layer'])[0];
+ if(!parents) return false;
+ var directParent = true;
+ for(var i = 0; i < parents.length; i++) {
+ var parentId = parents[i];
+ var parentObj = $obj(parentId);
+ if(!parentObj.propagate) {
+ directParent = false;
+ continue;
+ }
+ return { id: parentId, direct: directParent };
+ }
+ return false;
+ };
+ _dynamicPanelManager.parentHandlesStyles = _parentHandlesStyles;
+
+ var _propagateMouseOver = function(id, value) {
+ propagate(id, true, value);
+ };
+ _dynamicPanelManager.propagateMouseOver = _propagateMouseOver;
+
+ var _propagateMouseDown = function(id, value) {
+ propagate(id, false, value);
+ };
+ _dynamicPanelManager.propagateMouseDown = _propagateMouseDown;
+
+ var propagate = function(id, hover, value) {
+ var hoverChildren = function(children) {
+ if(!children) return;
+ for(var i = 0; i < children.length; i++) {
+ var elementId = children[i].id;
+ var obj = $obj(elementId);
+ if(obj == null) {
+ elementId = elementId.split('_')[0];
+ obj = $obj(elementId);
+ }
+ if(obj == null) continue;
+ if (($ax.public.fn.IsDynamicPanel(obj.type) || $ax.public.fn.IsLayer(obj.type)) && !obj.propagate) continue;
+
+ if(hover) $ax.style.SetWidgetHover(elementId, value);
+ else $ax.style.SetWidgetMouseDown(elementId, value);
+ $ax.annotation.updateLinkLocations(elementId);
+
+ hoverChildren(children[i].children);
+ }
+ };
+ hoverChildren($ax('#' + id).getChildren(true)[0].children);
+ };
+});
diff --git a/src/原型系统/resources/scripts/axure/sto.js b/src/原型系统/resources/scripts/axure/sto.js
new file mode 100644
index 0000000..e9b0f86
--- /dev/null
+++ b/src/原型系统/resources/scripts/axure/sto.js
@@ -0,0 +1,231 @@
+
+$axure.internal(function($ax) {
+ var funcs = {};
+
+ var weekday = new Array(7);
+ weekday[0] = "Sunday";
+ weekday[1] = "Monday";
+ weekday[2] = "Tuesday";
+ weekday[3] = "Wednesday";
+ weekday[4] = "Thursday";
+ weekday[5] = "Friday";
+ weekday[6] = "Saturday";
+
+ funcs.getDayOfWeek = function() {
+ return _getDayOfWeek(this.getDay());
+ };
+
+ var _getDayOfWeek = $ax.getDayOfWeek = function(day) {
+ return weekday[day];
+ };
+
+ var month = new Array(12);
+ month[0] = "January";
+ month[1] = "February";
+ month[2] = "March";
+ month[3] = "April";
+ month[4] = "May";
+ month[5] = "June";
+ month[6] = "July";
+ month[7] = "August";
+ month[8] = "September";
+ month[9] = "October";
+ month[10] = "November";
+ month[11] = "December";
+
+ funcs.getMonthName = function() {
+ return _getMonthName(this.getMonth());
+ };
+
+ var _getMonthName = $ax.getMonthName = function(monthNum) {
+ return month[monthNum];
+ };
+
+ funcs.getMonth = function() {
+ return this.getMonth() + 1;
+ };
+
+ funcs.addYears = function(years) {
+ var retVal = new Date(this.valueOf());
+ retVal.setFullYear(this.getFullYear() + Number(years));
+ return retVal;
+ };
+
+ funcs.addMonths = function(months) {
+ var retVal = new Date(this.valueOf());
+ retVal.setMonth(this.getMonth() + Number(months));
+ return retVal;
+ };
+
+ funcs.addDays = function(days) {
+ var retVal = new Date(this.valueOf());
+ retVal.setDate(this.getDate() + Number(days));
+ return retVal;
+ };
+
+ funcs.addHours = function(hours) {
+ var retVal = new Date(this.valueOf());
+ retVal.setHours(this.getHours() + Number(hours));
+ return retVal;
+ };
+
+ funcs.addMinutes = function(minutes) {
+ var retVal = new Date(this.valueOf());
+ retVal.setMinutes(this.getMinutes() + Number(minutes));
+ return retVal;
+ };
+
+ funcs.addSeconds = function(seconds) {
+ var retVal = new Date(this.valueOf());
+ retVal.setSeconds(this.getSeconds() + Number(seconds));
+ return retVal;
+ };
+
+ funcs.addMilliseconds = function(milliseconds) {
+ var retVal = new Date(this.valueOf());
+ retVal.setMilliseconds(this.getMilliseconds() + Number(milliseconds));
+ return retVal;
+ };
+
+ var _stoHandlers = {};
+
+ _stoHandlers.literal = function(sto, scope, eventInfo) {
+ return sto.value;
+ };
+
+ //need angle bracket syntax because var is a reserved word
+ _stoHandlers['var'] = function(sto, scope, eventInfo) {
+ // Can't us 'A || B' here, because the first value can be false, true, or empty string and still be valid.
+ var retVal = scope.hasOwnProperty(sto.name) ? scope[sto.name] : $ax.globalVariableProvider.getVariableValue(sto.name, eventInfo);
+ // Handle desired type here?
+
+ if(retVal && retVal.exprType) {
+ retVal = $ax.expr.evaluateExpr(retVal, eventInfo);
+ }
+
+ if((sto.desiredType == 'int' || sto.desiredType == 'float')) {
+ var num = new Number(retVal);
+ retVal = isNaN(num.valueOf()) ? retVal : num;
+ }
+
+
+ return retVal;
+ };
+
+ //TODO: Perhaps repeaterId can be detirmined at generation, and stored in the sto info.
+ _stoHandlers.item = function(sto, scope, eventInfo, prop) {
+ prop = prop || (eventInfo.data ? 'data' : eventInfo.link ? 'url' : eventInfo.image ? 'img' : 'text');
+ var id = sto.isTarget || !$ax.repeater.hasData(eventInfo.srcElement, sto.name) ? eventInfo.targetElement : eventInfo.srcElement;
+ return getData(eventInfo, id, sto.name, prop);
+ };
+
+ var getData = function(eventInfo, id, name, prop) {
+ var repeaterId = $ax.getParentRepeaterFromScriptId($ax.repeater.getScriptIdFromElementId(id));
+ var itemId = $ax.repeater.getItemIdFromElementId(id);
+ return $ax.repeater.getData(eventInfo, repeaterId, itemId, name, prop);
+ };
+
+ _stoHandlers.paren = function(sto, scope, eventInfo) {
+ return _evaluateSTO(sto.innerSTO, scope, eventInfo);
+ };
+
+ _stoHandlers.fCall = function(sto, scope, eventInfo) {
+ //TODO: [mas] handle required type
+ var thisObj = _evaluateSTO(sto.thisSTO, scope, eventInfo);
+ if(sto.thisSTO.desiredType == 'string' && sto.thisSTO.computedType != 'string') thisObj = thisObj.toString();
+
+ var args = [];
+ for(var i = 0; i < sto.arguments.length; i++) {
+ args[i] = _evaluateSTO(sto.arguments[i], scope, eventInfo);
+ }
+ var fn = (funcs.hasOwnProperty(sto.func) && funcs[sto.func]) || thisObj[sto.func];
+ return fn.apply(thisObj, args);
+ };
+
+ _stoHandlers.propCall = function(sto, scope, eventInfo) {
+ //TODO: [mas] handle required type
+ if((sto.prop == 'url' || sto.prop == 'img') && sto.thisSTO.sto == 'item') return _stoHandlers.item(sto.thisSTO, scope, eventInfo, sto.prop);
+ var thisObj = _evaluateSTO(sto.thisSTO, scope, eventInfo);
+ var prop = thisObj[sto.prop] instanceof Function ? thisObj[sto.prop]() : thisObj[sto.prop];
+ return prop;
+ };
+
+ var _binOps = {};
+ _binOps['+'] = function(left, right) {
+ if(left instanceof Date) return addDayToDate(left, right);
+ if(right instanceof Date) return addDayToDate(right, left);
+
+ var num = Number(left) + Number(right);
+ return isNaN(num) ? (String(left) + String(right)) : num;
+ };
+ _binOps['-'] = function(left, right) {
+ if(left instanceof Date) return addDayToDate(left, -right);
+ return left - right;
+ };
+ _binOps['*'] = function(left, right) { return Number(left) * Number(right); };
+ _binOps['/'] = function(left, right) { return Number(left) / Number(right); };
+ _binOps['%'] = function(left, right) { return Number(left) % Number(right); };
+ _binOps['=='] = function(left, right) { return _getBool(left) == _getBool(right); };
+ _binOps['!='] = function(left, right) { return _getBool(left) != _getBool(right); };
+ _binOps['<'] = function(left, right) { return Number(left) < Number(right); };
+ _binOps['<='] = function(left, right) { return Number(left) <= Number(right); };
+ _binOps['>'] = function(left, right) { return Number(left) > Number(right); };
+ _binOps['>='] = function(left, right) { return Number(left) >= Number(right); };
+ _binOps['&&'] = function(left, right) { return _getBool(left) && _getBool(right); };
+ _binOps['||'] = function(left, right) { return _getBool(left) || _getBool(right); };
+
+ // TODO: Move this to generic place to be used.
+ var addDayToDate = function(date, days) {
+ var retVal = new Date(date.valueOf());
+ retVal.setDate(date.getDate() + days);
+ return retVal;
+ };
+
+ var _unOps = {};
+ _unOps['+'] = function(arg) { return +arg; };
+ _unOps['-'] = function(arg) { return -arg; };
+ _unOps['!'] = function(arg) { return !_getBool(arg); };
+
+ _stoHandlers.binOp = function(sto, scope, eventInfo) {
+ var left = _evaluateSTO(sto.leftSTO, scope, eventInfo);
+ var right = _evaluateSTO(sto.rightSTO, scope, eventInfo);
+ return _binOps[sto.op](left, right);
+ };
+
+ _stoHandlers.unOp = function(sto, scope, eventInfo) {
+ var input = _evaluateSTO(sto.inputSTO, scope, eventInfo);
+ return _unOps[sto.op](input);
+ };
+
+ var _getBool = function(val) {
+ var lowerVal = val.toLowerCase ? val.toLowerCase() : val;
+ return lowerVal == "false" ? false : lowerVal == "true" ? true : val;
+ };
+ $ax.getBool = _getBool;
+
+ var _evaluateSTO = function(sto, scope, eventInfo) {
+ if(sto.sto == 'error') return undefined;
+ return _tryEscapeRichText(castSto(_stoHandlers[sto.sto](sto, scope, eventInfo), sto), eventInfo);
+ };
+ $ax.evaluateSTO = _evaluateSTO;
+
+ var castSto = function(val, sto) {
+ var type = sto.computedType || sto.desiredType;
+ if(type == 'string') val = String(val);
+ else if(type == 'date' && !(val instanceof Date)) val = new Date(val);
+ else if(type == 'int' || type == 'float') val = Number(val);
+ else if(type == 'bool') val = Boolean(val);
+
+ return val;
+ };
+
+ var _tryEscapeRichText = function(text, eventInfo) {
+ return eventInfo.htmlLiteral ? _escapeRichText(text) : text;
+ };
+
+ var _escapeRichText = function(text) {
+ if(typeof (text) != 'string') return text;
+
+ return text.replace('<', '<');
+ };
+});
\ No newline at end of file
diff --git a/src/原型系统/resources/scripts/axure/style.js b/src/原型系统/resources/scripts/axure/style.js
new file mode 100644
index 0000000..d4591d8
--- /dev/null
+++ b/src/原型系统/resources/scripts/axure/style.js
@@ -0,0 +1,1363 @@
+$axure.internal(function($ax) {
+ var _style = {};
+ $ax.style = _style;
+
+ var _disabledWidgets = {};
+ var _selectedWidgets = {};
+
+ // A table to cache the outerHTML of the _rtf elements before the rollover state is applied.
+ var _originalTextCache = {};
+ // A table to exclude the normal style from adaptive overrides
+ var _shapesWithSetRichText = {};
+
+ // just a listing of shape ids
+ var _adaptiveStyledWidgets = {};
+
+ var _setLinkStyle = function(id, styleName) {
+ var parentId = $ax.GetParentIdFromLink(id);
+ var style = _computeAllOverrides(id, parentId, styleName, $ax.adaptive.currentViewId);
+
+ var textId = $ax.GetTextPanelId(parentId);
+ if(!_originalTextCache[textId]) {
+ $ax.style.CacheOriginalText(textId);
+ }
+ if($.isEmptyObject(style)) return;
+
+ var textCache = _originalTextCache[textId].styleCache;
+
+ _transformTextWithVerticalAlignment(textId, function() {
+ var cssProps = _getCssStyleProperties(style);
+ $('#' + id).find('*').addBack().each(function(index, element) {
+ element.setAttribute('style', textCache[element.id]);
+ _applyCssProps(element, cssProps);
+ });
+ });
+ };
+
+ var _resetLinkStyle = function(id) {
+ var textId = $ax.GetTextPanelId($ax.GetParentIdFromLink(id));
+ var textCache = _originalTextCache[textId].styleCache;
+
+ _transformTextWithVerticalAlignment(textId, function() {
+ $('#' + id).find('*').addBack().each(function(index, element) {
+ element.style.cssText = textCache[element.id];
+ });
+ });
+ if($ax.event.mouseDownObjectId) {
+ $ax.style.SetWidgetMouseDown($ax.event.mouseDownObjectId, true);
+ } else if($ax.event.mouseOverObjectId) {
+ $ax.style.SetWidgetHover($ax.event.mouseOverObjectId, true);
+ }
+ };
+
+ $ax.style.SetLinkHover = function(id) {
+ _setLinkStyle(id, MOUSE_OVER);
+ };
+
+ $ax.style.SetLinkNotHover = function(id) {
+ _resetLinkStyle(id);
+ };
+
+ $ax.style.SetLinkMouseDown = function(id) {
+ _setLinkStyle(id, MOUSE_DOWN);
+ };
+
+ $ax.style.SetLinkNotMouseDown = function(id) {
+ _resetLinkStyle(id);
+ var style = _computeAllOverrides(id, $ax.event.mouseOverObjectId, MOUSE_OVER, $ax.adaptive.currentViewId);
+
+ if(!$.isEmptyObject(style)) $ax.style.SetLinkHover(id);
+ //we dont do anything here because the widget not mouse down has taken over here
+ };
+
+ var _widgetHasState = function(id, state) {
+ if($ax.style.getElementImageOverride(id, state)) return true;
+ var diagramObject = $ax.getObjectFromElementId(id);
+
+ //var adaptiveIdChain = $ax.adaptive.getAdaptiveIdChain($ax.adaptive.currentViewId);
+ var adaptiveIdChain = $ax.style.getViewIdChain($ax.adaptive.currentViewId, id, diagramObject);
+
+ for(var i = 0; i < adaptiveIdChain.length; i++) {
+ var viewId = adaptiveIdChain[i];
+ var adaptiveStyle = diagramObject.adaptiveStyles[viewId];
+ if(adaptiveStyle && adaptiveStyle.stateStyles && adaptiveStyle.stateStyles[state]) return true;
+ }
+
+ if(diagramObject.style.stateStyles) {
+ var stateStyle = diagramObject.style.stateStyles[state];
+ if(!stateStyle) return false;
+ return !$.isEmptyObject(stateStyle);
+ }
+
+ return false;
+ };
+
+ // Returns what overrides the hover, or false if nothing.
+ var _hoverOverride = function(id) {
+ if($ax.style.IsWidgetDisabled(id)) return DISABLED;
+ if($ax.style.IsWidgetSelected(id)) return SELECTED;
+ var obj = $ax.getObjectFromElementId(id);
+ if(!obj.isContained) return false;
+ var path = $ax.getPathFromScriptId($ax.repeater.getScriptIdFromElementId(id));
+ path[path.length - 1] = obj.parent.id;
+ var itemId = $ax.repeater.getItemIdFromElementId(id);
+ return _hoverOverride($ax.getElementIdFromPath(path, { itemNum: itemId }));
+ };
+
+ $ax.style.SetWidgetHover = function(id, value) {
+ var override = _hoverOverride(id);
+ if(override == DISABLED) return;
+ if(!_widgetHasState(id, MOUSE_OVER)) return;
+
+ var valToSet = value || _isRolloverOverride(id);
+ var state = _generateMouseState(id, valToSet ? MOUSE_OVER : NORMAL, override == SELECTED);
+ _applyImageAndTextJson(id, state);
+ _updateElementIdImageStyle(id, state);
+ };
+
+ var _rolloverOverrides = [];
+ var _isRolloverOverride = function(id) {
+ return _rolloverOverrides.indexOf(id) != -1;
+ };
+
+ $ax.style.AddRolloverOverride = function(id) {
+ if(_isRolloverOverride(id)) return;
+ _rolloverOverrides[_rolloverOverrides.length] = id;
+ if($ax.event.mouseOverIds.indexOf(id) == -1) $ax.style.SetWidgetHover(id, true);
+ };
+
+ $ax.style.RemoveRolloverOverride = function(id) {
+ var index = _rolloverOverrides.indexOf(id);
+ if(index == -1) return;
+ $ax.splice(_rolloverOverrides, index, 1);
+ if($ax.event.mouseOverIds.indexOf(id) == -1) $ax.style.SetWidgetHover(id, false);
+ };
+
+ // function GetWidgetCurrentState(id) {
+ // if($ax.style.IsWidgetDisabled(id)) return "disabled";
+ // if($ax.style.IsWidgetSelected(id)) return "selected";
+ // if($ax.event.mouseOverObjectId == id) return "mouseOver";
+ // if($ax.event.mouseDownObjectId == id) return "mouseDown";
+
+ // return "normal";
+ // }
+
+ $ax.style.ObjHasMouseDown = function(id) {
+ var obj = $obj(id);
+ if($ax.style.getElementImageOverride(id, 'mouseDown') || obj.style && obj.style.stateStyles && obj.style.stateStyles.mouseDown) return true;
+
+ //var chain = $ax.adaptive.getAdaptiveIdChain($ax.adaptive.currentViewId);
+ var chain = $ax.style.getViewIdChain($ax.adaptive.currentViewId, id, obj);
+ for(var i = 0; i < chain.length; i++) {
+ var style = obj.adaptiveStyles[chain[i]];
+ if(style && style.stateStyles && style.stateStyles.mouseDown) return true;
+ }
+ return false;
+ };
+
+ $ax.style.SetWidgetMouseDown = function(id, value, checkMouseOver) {
+ if($ax.style.IsWidgetDisabled(id)) return;
+ if(!_widgetHasState(id, MOUSE_DOWN)) return;
+
+ //if set to value is true, it's mousedown, if check mouseover is true,
+ //check if element is currently mouseover and has mouseover state before setting mouseover
+ if(value) var state = MOUSE_DOWN;
+ else if(!checkMouseOver || $ax.event.mouseOverIds.indexOf(id) !== -1 && _widgetHasState(id, MOUSE_OVER)) state = MOUSE_OVER;
+ else state = NORMAL;
+
+ var mouseState = _generateMouseState(id, state, $ax.style.IsWidgetSelected(id));
+ _applyImageAndTextJson(id, mouseState);
+ _updateElementIdImageStyle(id, mouseState);
+ };
+
+ var _generateMouseState = function(id, mouseState, selected) {
+
+ var isSelectedFocused = function (state) {
+ if(!_widgetHasState(id, FOCUSED)) return state;
+
+ var jObj = $('#' + id);
+ if(state == SELECTED) return (jObj.hasClass(FOCUSED)) ? SELECTED_FOCUSED : state;
+ else return (jObj.hasClass(FOCUSED) || jObj.hasClass(SELECTED_FOCUSED)) ? FOCUSED : state;
+ }
+
+ if (selected) {
+ if (_style.getElementImageOverride(id, SELECTED)) return isSelectedFocused(SELECTED);
+
+ var obj = $obj(id);
+ //var viewChain = $ax.adaptive.getAdaptiveIdChain($ax.adaptive.currentViewId);
+ var viewChain = $ax.style.getViewIdChain($ax.adaptive.currentViewId, id, obj);
+ viewChain[viewChain.length] = '';
+ if($ax.IsDynamicPanel(obj.type) || $ax.IsLayer(obj.type)) return isSelectedFocused(SELECTED);
+
+ var any = function(dict) {
+ for(var key in dict) return true;
+ return false;
+ };
+
+ for(var i = 0; i < viewChain.length; i++) {
+ var viewId = viewChain[i];
+ // Need to check seperately for images.
+ var scriptId = $ax.repeater.getScriptIdFromElementId(id);
+ if(obj.adaptiveStyles && obj.adaptiveStyles[viewId] && any(obj.adaptiveStyles[viewId])
+ || obj.images && (obj.images[scriptId + '~selected~' + viewId] || obj.images['selected~' + viewId])) return isSelectedFocused(SELECTED);
+ }
+ var selectedStyle = obj.style && obj.style.stateStyles && obj.style.stateStyles.selected;
+ if(selectedStyle && any(selectedStyle)) return isSelectedFocused(SELECTED);
+ }
+
+ // Not using selected
+ return isSelectedFocused(mouseState);
+ };
+
+ $ax.style.SetWidgetFocused = function (id, value) {
+ if (_isWidgetDisabled(id)) return;
+ if (!_widgetHasState(id, FOCUSED)) return;
+
+ if (value) var state = $ax.style.IsWidgetSelected(id) ? SELECTED_FOCUSED : FOCUSED;
+ else state = $ax.style.IsWidgetSelected(id) ? SELECTED : NORMAL;
+
+ _applyImageAndTextJson(id, state);
+ _updateElementIdImageStyle(id, state);
+ }
+
+ $ax.style.SetWidgetSelected = function(id, value, alwaysApply) {
+ if(_isWidgetDisabled(id)) return;
+ //NOTE: not firing select events if state didn't change
+ var raiseSelectedEvents = $ax.style.IsWidgetSelected(id) != value;
+
+ if(value) {
+ var group = $('#' + id).attr('selectiongroup');
+ if(group) {
+ $("[selectiongroup='" + group + "']").each(function() {
+ var otherId = this.id;
+ if(otherId == id) return;
+ if ($ax.visibility.isScriptIdLimbo($ax.repeater.getScriptIdFromElementId(otherId))) return;
+
+ $ax.style.SetWidgetSelected(otherId, false, alwaysApply);
+ });
+ }
+ }
+ var obj = $obj(id);
+ if(obj) {
+ var actionId = id;
+ if ($ax.public.fn.IsDynamicPanel(obj.type) || $ax.public.fn.IsLayer(obj.type)) {
+ if(!value) $jobj(id).removeClass('selected');
+ var children = $axure('#' + id).getChildren()[0].children;
+ for(var i = 0; i < children.length; i++) {
+ var childId = children[i];
+ // Special case for trees
+ var childObj = $jobj(childId);
+ if(childObj.hasClass('treeroot')) {
+ var treenodes = childObj.find('.treenode');
+ for(var j = 0; j < treenodes.length; j++) {
+ $axure('#' + treenodes[j].id).selected(value);
+ }
+ } else $axure('#' + childId).selected(value);
+ }
+ } else {
+ var widgetHasSelectedState = _widgetHasState(id, SELECTED);
+ while(obj.isContained && !widgetHasSelectedState) obj = obj.parent;
+ var itemId = $ax.repeater.getItemIdFromElementId(id);
+ var path = $ax.getPathFromScriptId($ax.repeater.getScriptIdFromElementId(id));
+ path[path.length - 1] = obj.id;
+ actionId = $ax.getElementIdFromPath(path, { itemNum: itemId });
+ if(alwaysApply || widgetHasSelectedState) {
+ var state = _generateSelectedState(actionId, value);
+ _applyImageAndTextJson(actionId, state);
+ _updateElementIdImageStyle(actionId, state);
+ }
+ //added actionId and this hacky logic because we set style state on child, but interaction on parent
+ //then the id saved in _selectedWidgets would be depended on widgetHasSelectedState... more see case 1818143
+ while(obj.isContained && !$ax.getObjectFromElementId(id).interactionMap) obj = obj.parent;
+ path = $ax.getPathFromScriptId($ax.repeater.getScriptIdFromElementId(id));
+ path[path.length - 1] = obj.id;
+ actionId = $ax.getElementIdFromPath(path, { itemNum: itemId });
+ }
+ }
+
+ // ApplyImageAndTextJson(id, value ? 'selected' : 'normal');
+ _selectedWidgets[id] = value;
+ if(raiseSelectedEvents) $ax.event.raiseSelectedEvents(actionId, value);
+ };
+
+ var _generateSelectedState = function(id, selected) {
+ var mouseState = $ax.event.mouseDownObjectId == id ? MOUSE_DOWN : $.inArray(id, $ax.event.mouseOverIds) != -1 ? MOUSE_OVER : NORMAL;
+ //var mouseState = $ax.event.mouseDownObjectId == id ? MOUSE_DOWN : $ax.event.mouseOverIds.indexOf(id) != -1 ? MOUSE_OVER : NORMAL;
+ return _generateMouseState(id, mouseState, selected);
+ };
+
+ $ax.style.IsWidgetSelected = function(id) {
+ return Boolean(_selectedWidgets[id]) || $('#'+id).hasClass('selected');
+ };
+
+ $ax.style.SetWidgetEnabled = function(id, value) {
+ _disabledWidgets[id] = !value;
+ $('#' + id).find('a').css('cursor', value ? 'pointer' : 'default');
+
+ if(!_widgetHasState(id, DISABLED)) return;
+ if(!value) {
+ _applyImageAndTextJson(id, DISABLED);
+ _updateElementIdImageStyle(id, DISABLED);
+ } else $ax.style.SetWidgetSelected(id, $ax.style.IsWidgetSelected(id), true);
+ };
+
+ $ax.style.SetWidgetPlaceholder = function(id, active, text, password) {
+ var inputId = $ax.repeater.applySuffixToElementId(id, '_input');
+
+ // Right now this is the only style on the widget. If other styles (ex. Rollover), are allowed
+ // on TextBox/TextArea, or Placeholder is applied to more widgets, this may need to do more.
+ var obj = $jobj(inputId);
+
+ var height = document.getElementById(inputId).style['height'];
+ var width = document.getElementById(inputId).style['width'];
+ obj.attr('style', '');
+ //removing all styles, but now we can change the size, so we should add them back
+ //this is more like a quick hack
+ if (height) obj.css('height', height);
+ if (width) obj.css('width', width);
+
+ if(!active) {
+ try { //ie8 and below error
+ if(password) document.getElementById(inputId).type = 'password';
+ } catch(e) { }
+ } else {
+ var element = $('#' + inputId)[0];
+ var style = _computeAllOverrides(id, undefined, HINT, $ax.adaptive.currentViewId);
+ var styleProperties = _getCssStyleProperties(style);
+
+ //moved this out of GetCssStyleProperties for now because it was breaking un/rollovers with gradient fills
+ //if(style.fill) styleProperties.allProps.backgroundColor = _getColorFromFill(style.fill);
+
+ _applyCssProps(element, styleProperties, true);
+ try { //ie8 and below error
+ if(password && text) document.getElementById(inputId).type = 'text';
+ } catch(e) { }
+ }
+ obj.val(text);
+ };
+
+ var _isWidgetDisabled = $ax.style.IsWidgetDisabled = function(id) {
+ return Boolean(_disabledWidgets[id]);
+ };
+
+ var _elementIdsToImageOverrides = {};
+ $ax.style.mapElementIdToImageOverrides = function (elementId, override) {
+ for(var key in override) _addImageOverride(elementId, key, override[key]);
+ };
+
+ var _addImageOverride = function (elementId, state, val) {
+ if (!_elementIdsToImageOverrides[elementId]) _elementIdsToImageOverrides[elementId] = {};
+ _elementIdsToImageOverrides[elementId][state] = val;
+ }
+
+ $ax.style.deleteElementIdToImageOverride = function(elementId) {
+ delete _elementIdsToImageOverrides[elementId];
+ };
+
+ $ax.style.getElementImageOverride = function(elementId, state) {
+ var url = _elementIdsToImageOverrides[elementId] && _elementIdsToImageOverrides[elementId][state];
+ return url;
+ };
+
+ $ax.style.elementHasAnyImageOverride = function(elementId) {
+ return Boolean(_elementIdsToImageOverrides[elementId]);
+ };
+
+ var NORMAL = 'normal';
+ var MOUSE_OVER = 'mouseOver';
+ var MOUSE_DOWN = 'mouseDown';
+ var SELECTED = 'selected';
+ var DISABLED = 'disabled';
+ var HINT = 'hint';
+ var FOCUSED = 'focused';
+ var SELECTED_FOCUSED = 'selectedFocused';
+
+ var _generateState = _style.generateState = function(id) {
+ return $ax.placeholderManager.isActive(id) ? HINT : _style.IsWidgetDisabled(id) ? DISABLED : _generateSelectedState(id, _style.IsWidgetSelected(id));
+ };
+
+ var _progressState = _style.progessState = function(state) {
+ if(state == NORMAL) return false;
+ if(state == MOUSE_DOWN) return MOUSE_OVER;
+ return NORMAL;
+ };
+
+ var _unprogressState = function(state, goal) {
+ state = state || NORMAL;
+ if(state == goal || state == SELECTED_FOCUSED) return undefined;
+ if(state == NORMAL && goal == MOUSE_DOWN) return MOUSE_OVER;
+ if(state == NORMAL && goal == SELECTED_FOCUSED) return SELECTED;
+ if(state == SELECTED && goal == SELECTED_FOCUSED) return FOCUSED;
+ return goal;
+ };
+
+ var _updateElementIdImageStyle = _style.updateElementIdImageStyle = function(elementId, state) {
+ if(!_style.elementHasAnyImageOverride(elementId)) return;
+
+ if(!state) state = _generateState(elementId);
+
+ var style = _computeFullStyle(elementId, state, $ax.adaptive.currentViewId);
+
+ var query = $jobj($ax.repeater.applySuffixToElementId(elementId, '_img'));
+ style.size.width = query.width();
+ style.size.height = query.height();
+ var borderId = $ax.repeater.applySuffixToElementId(elementId, '_border');
+ var borderQuery = $jobj(borderId);
+ if(!borderQuery.length) {
+ borderQuery = $('
');
+ borderQuery.attr('id', borderId);
+ query.after(borderQuery);
+ }
+
+ borderQuery.attr('style', '');
+ //borderQuery.css('position', 'absolute');
+ query.attr('style', '');
+
+ var borderQueryCss = { 'position': 'absolute' };
+ var queryCss = {}
+
+ var borderWidth = Number(style.borderWidth);
+ var hasBorderWidth = borderWidth > 0;
+ if(hasBorderWidth) {
+ //borderQuery.css('border-style', 'solid');
+ //borderQuery.css('border-width', borderWidth + 'px'); // If images start being able to turn off borders on specific sides, need to update this.
+ //borderQuery.css('width', style.size.width - borderWidth * 2);
+ //borderQuery.css('height', style.size.height - borderWidth * 2);
+ //borderQuery.css({
+ // 'border-style': 'solid',
+ // 'border-width': borderWidth + 'px',
+ // 'width': style.size.width - borderWidth * 2,
+ // 'height': style.size.height - borderWidth * 2
+ //});
+ borderQueryCss['border-style'] = 'solid';
+ borderQueryCss['border-width'] = borderWidth + 'px'; // If images start being able to turn off borders on specific sides, need to update this.
+ borderQueryCss['width'] = style.size.width - borderWidth * 2;
+ borderQueryCss['height'] = style.size.height - borderWidth * 2;
+ }
+
+ var linePattern = style.linePattern;
+ if(hasBorderWidth && linePattern) borderQueryCss['border-style'] = linePattern;
+
+ var borderFill = style.borderFill;
+ if(hasBorderWidth && borderFill) {
+ var color = borderFill.fillType == 'solid' ? borderFill.color :
+ borderFill.fillType == 'linearGradient' ? borderFill.colors[0].color : 0;
+
+ var alpha = Math.floor(color / 256 / 256 / 256);
+ color -= alpha * 256 * 256 * 256;
+ alpha = alpha / 255;
+
+ var red = Math.floor(color / 256 / 256);
+ color -= red * 256 * 256;
+ var green = Math.floor(color / 256);
+ var blue = color - green * 256;
+
+ borderQueryCss['border-color'] = _rgbaToFunc(red, green, blue, alpha);
+ }
+
+ var cornerRadiusTopLeft = style.cornerRadius;
+ if(cornerRadiusTopLeft) {
+ queryCss['border-radius'] = cornerRadiusTopLeft + 'px';
+ borderQueryCss['border-radius'] = cornerRadiusTopLeft + 'px';
+ }
+
+ var outerShadow = style.outerShadow;
+ if(outerShadow && outerShadow.on) {
+ var arg = '';
+ arg += outerShadow.offsetX + 'px' + ' ' + outerShadow.offsetY + 'px' + ' ';
+ var rgba = outerShadow.color;
+ arg += outerShadow.blurRadius + 'px' + ' 0px ' + _rgbaToFunc(rgba.r, rgba.g, rgba.b, rgba.a);
+ //query.css('-moz-box-shadow', arg);
+ //query.css('-wibkit-box-shadow', arg);
+ //query.css('box-shadow', arg);
+ //query.css('left', '0px');
+ //query.css('top', '0px');
+ //query.css({
+ // '-moz-box-shadow': arg,
+ // '-webkit-box-shadow': arg,
+ // 'box-shadow': arg,
+ // 'left': '0px',
+ // 'top': '0px'
+ //});
+ queryCss['-moz-box-shadow'] = arg;
+ queryCss['-wibkit-box-shadow'] = arg;
+ queryCss['box-shadow'] = arg;
+ queryCss['left'] = '0px';
+ queryCss['top'] = '0px';
+ }
+
+ queryCss['width'] = style.size.width;
+ queryCss['height'] = style.size.height;
+
+ borderQuery.css(borderQueryCss);
+ query.css(queryCss);
+
+ //query.css({ width: style.size.width, height: style.size.height });
+ };
+
+ var _rgbaToFunc = function(red, green, blue, alpha) {
+ return 'rgba(' + red + ',' + green + ',' + blue + ',' + alpha + ')';
+ };
+
+ var _applyImageAndTextJson = function(id, event) {
+ var textId = $ax.GetTextPanelId(id);
+ if(textId) _resetTextJson(id, textId);
+
+ // This should never be the case
+ //if(event != '') {
+ var imgQuery = $jobj($ax.GetImageIdFromShape(id));
+ var e = imgQuery.data('events');
+ if(e && e[event]) imgQuery.trigger(event);
+
+ var imageUrl = $ax.adaptive.getImageForStateAndView(id, event);
+ if(imageUrl) _applyImage(id, imageUrl, event);
+
+ var style = _computeAllOverrides(id, undefined, event, $ax.adaptive.currentViewId);
+ if(!$.isEmptyObject(style) && textId) _applyTextStyle(textId, style);
+
+ _updateStateClasses(id, event);
+ _updateStateClasses($ax.repeater.applySuffixToElementId(id, '_div'), event);
+ _updateStateClasses($ax.repeater.applySuffixToElementId(id, '_input'), event);
+ };
+
+ var _updateStateClasses = function(id, event) {
+ var jobj = $jobj(id);
+
+ //if(jobj[0] && jobj[0].hasAttribute('widgetwidth')) {
+ // for (var x = 0; x < jobj[0].children.length; x++) {
+ // var childId = jobj[0].children[x].id;
+ // if (childId.indexOf('p') < 0) continue;
+
+ // _updateStateClasses(childId, event) ;
+ // }
+ //} else {
+ for (var i = 0; i < ALL_STATES.length; i++) jobj.removeClass(ALL_STATES[i]);
+ if (event == 'mouseDown') jobj.addClass('mouseOver');
+ if(event != 'normal') jobj.addClass(event);
+ //}
+ }
+
+ /* -------------------
+
+ here's the algorithm in a nutshell:
+ [DOWN] -- refers to navigation down the view inheritance heirarchy (default to most specific)
+ [UP] -- navigate up the heirarchy
+
+ ComputeAllOverrides (object):
+ All view styles [DOWN]
+ If hyperlink
+ - DO ComputeStateStyle for parent object
+ - if (MouseOver || MouseDown)
+ - linkMouseOver Style
+ - if (MouseDown)
+ - linkMouseDown style
+ - ComputeStateStyleForViewChain (parent, STATE)
+
+ if (MouseDown) DO ComputeStateStyleForViewChain for object, mouseOver
+ DO ComputeStateStyleForViewChain for object, style
+
+
+ ComputeStateStyleForViewChain (object, STATE)
+ FIRST STATE state style [UP] the chain OR default object STATE style
+
+ ------------------- */
+
+ var FONT_PROPS = {
+ 'typeface': true,
+ 'fontName': true,
+ 'fontWeight': true,
+ 'fontStyle': true,
+ 'fontStretch': true,
+ 'fontSize': true,
+ 'underline': true,
+ 'foreGroundFill': true,
+ 'horizontalAlignment': true,
+ 'letterCase': true,
+ 'strikethrough': true
+ };
+
+ var _getViewIdChain = $ax.style.getViewIdChain = function(currentViewId, id, diagramObject) {
+ var viewIdChain;
+ if (diagramObject.owner.type != 'Axure:Master') {
+ viewIdChain = $ax.adaptive.getAdaptiveIdChain(currentViewId);
+ } else {
+ //set viewIdChain to the chain from the parent RDO
+ var parentRdoId = $ax('#' + id).getParents(true, ['rdo'])[0][0];
+ var rdoState = $ax.style.generateState(parentRdoId);
+ var rdoStyle = $ax.style.computeFullStyle(parentRdoId, rdoState, currentViewId);
+ var viewOverride = rdoStyle.viewOverride;
+ viewIdChain = $ax.adaptive.getMasterAdaptiveIdChain(diagramObject.owner.packageId, viewOverride);
+ }
+ return viewIdChain;
+ }
+
+ var _computeAllOverrides = $ax.style.computeAllOverrides = function(id, parentId, state, currentViewId) {
+ var computedStyle = {};
+ if(parentId) computedStyle = _computeAllOverrides(parentId, null, state, currentViewId);
+
+ var diagramObject = $ax.getObjectFromElementId(id);
+
+ var viewIdChain = _getViewIdChain(currentViewId, id, diagramObject);
+ var excludeFont = _shapesWithSetRichText[id];
+ for(var i = 0; i < viewIdChain.length; i++) {
+ var viewId = viewIdChain[i];
+ var style = diagramObject.adaptiveStyles[viewId];
+ if(style) {
+ // we want to exclude the normal font style for shapes where the rich text has been set with an interaction
+ // so we copy the style so we don't modify the original, then delete all the font props.
+ if(excludeFont) {
+ style = $ax.deepCopy(style);
+ for(var prop in FONT_PROPS) delete style[prop];
+ }
+
+ if(style) {
+ var customStyle = style.baseStyle && $ax.document.stylesheet.stylesById[style.baseStyle];
+ //make sure not to extend the customStyle this can mutate it for future use
+ $.extend(computedStyle, customStyle);
+ }
+ $.extend(computedStyle, style);
+ }
+ }
+
+ var currState = NORMAL;
+ while(currState) {
+ $.extend(computedStyle, _computeStateStyleForViewChain(diagramObject, currState, viewIdChain, true));
+ currState = _unprogressState(currState, state);
+ }
+
+ return _removeUnsupportedProperties(computedStyle, diagramObject);
+ };
+
+ var _computeStateStyleForViewChain = function(diagramObject, state, viewIdChain, excludeNormal) {
+ var styleObject = diagramObject;
+ while(styleObject.isContained) styleObject = styleObject.parent;
+
+ var adaptiveStyles = styleObject.adaptiveStyles;
+
+ for(var i = viewIdChain.length - 1; i >= 0; i--) {
+ var viewId = viewIdChain[i];
+ var viewStyle = adaptiveStyles[viewId];
+ var stateStyle = viewStyle && _getFullStateStyle(viewStyle, state, excludeNormal);
+ if (stateStyle) return $.extend({}, stateStyle);
+ else if (viewStyle && viewStyle.stateStyles) return {}; //stateStyles are overriden but states could be null
+ }
+
+ // we dont want to actually include the object style because those are not overrides, hence the true for "excludeNormal" and not passing the val through
+ var stateStyleFromDefault = _getFullStateStyle(styleObject.style, state, true);
+ return $.extend({}, stateStyleFromDefault);
+ };
+
+ // returns the full effective style for an object in a state state and view
+ var _computeFullStyle = $ax.style.computeFullStyle = function(id, state, currentViewId) {
+ var obj = $obj(id);
+ var overrides = _computeAllOverrides(id, undefined, state, currentViewId);
+ // todo: account for image box
+ var objStyle = obj.style;
+ var customStyle = objStyle.baseStyle && $ax.document.stylesheet.stylesById[objStyle.baseStyle];
+ var returnVal = $.extend({}, $ax.document.stylesheet.defaultStyle, customStyle, objStyle, overrides);
+ return _removeUnsupportedProperties(returnVal, obj);
+ };
+
+ var _removeUnsupportedProperties = function(style, object) {
+ // for now all we need to do is remove padding from checkboxes and radio buttons
+ if ($ax.public.fn.IsRadioButton(object.type) || $ax.public.fn.IsCheckBox(object.type)) {
+ style.paddingTop = 0;
+ style.paddingLeft = 0;
+ style.paddingRight = 0;
+ style.paddingBottom = 0;
+ }
+ if ($ax.public.fn.IsTextBox(object.type) || $ax.public.fn.IsTextArea(object.type) || $ax.public.fn.IsButton(object.type)
+ || $ax.public.fn.IsListBox(object.type) || $ax.public.fn.IsComboBox(object.type)) {
+ if (object.images && style.fill) delete style['fill'];
+ }
+
+ return style;
+ };
+
+ var _getFullStateStyle = function(style, state, excludeNormal) {
+ //'normal' is needed because now DiagramObjects get their image from the Style and unapplying a rollover needs the image
+ var stateStyle = state == 'normal' && !excludeNormal ? style : style && style.stateStyles && style.stateStyles[state];
+ if(stateStyle) {
+ var customStyle = stateStyle.baseStyle && $ax.document.stylesheet.stylesById[stateStyle.baseStyle];
+ //make sure not to extend the customStyle this can mutate it for future use
+ return $.extend({}, customStyle, stateStyle);
+ }
+ return undefined;
+ };
+
+ // commented this out for now... we actually will probably need it for ie
+ var _applyOpacityFromStyle = $ax.style.applyOpacityFromStyle = function(id, style) {
+ return;
+ var opacity = style.opacity || '';
+ $jobj(id).children().css('opacity', opacity);
+ };
+
+ var _initialize = function() {
+ //$ax.style.initializeObjectTextAlignment($ax('*'));
+ };
+ $ax.style.initialize = _initialize;
+
+ //var _initTextAlignment = function(elementId) {
+ // var textId = $ax.GetTextPanelId(elementId);
+ // if(textId) {
+ // _storeIdToAlignProps(textId);
+ // // now handle vertical alignment
+ // if(_getObjVisible(textId)) {
+ // //_setTextAlignment(textId, _idToAlignProps[textId], false);
+ // _setTextAlignment(textId);
+ // }
+ // }
+ //};
+
+ //$ax.style.initializeObjectTextAlignment = function(query) {
+ // query.filter(function(diagramObject) {
+ // return $ax.public.fn.IsVector(diagramObject.type) || $ax.public.fn.IsImageBox(diagramObject.type);
+ // }).each(function(diagramObject, elementId) {
+ // if($jobj(elementId).length == 0) return;
+ // _initTextAlignment(elementId);
+ // });
+ //};
+
+ //$ax.style.initializeObjectTextAlignment = function (query) {
+ // var textIds = [];
+ // query.filter(function(diagramObject) {
+ // return $ax.public.fn.IsVector(diagramObject.type) || $ax.public.fn.IsImageBox(diagramObject.type);
+ // }).each(function(diagramObject, elementId) {
+ // if($jobj(elementId).length == 0) return;
+ // var textId = $ax.GetTextPanelId(elementId);
+ // if(textId) {
+ // _storeIdToAlignProps(textId);
+ // textIds.push(textId);
+ // }
+ // });
+
+ // $ax.style.setTextAlignment(textIds);
+ //};
+
+ //var _getPadding = $ax.style.getPadding = function (textId) {
+ // var shapeId = $ax.GetShapeIdFromText(textId);
+ // var shapeObj = $obj(shapeId);
+ // var state = _generateState(shapeId);
+
+ // var style = _computeFullStyle(shapeId, state, $ax.adaptive.currentViewId);
+ // var vAlign = style.verticalAlignment || 'middle';
+
+ // var paddingLeft = Number(style.paddingLeft) || 0;
+ // paddingLeft += (Number(shapeObj && shapeObj.extraLeft) || 0);
+ // var paddingTop = style.paddingTop || 0;
+ // var paddingRight = style.paddingRight || 0;
+ // var paddingBottom = style.paddingBottom || 0;
+ // return { vAlign: vAlign, paddingLeft: paddingLeft, paddingTop: paddingTop, paddingRight: paddingRight, paddingBottom: paddingBottom };
+ //}
+
+ //var _storeIdToAlignProps = function(textId) {
+ // _idToAlignProps[textId] = _getPadding(textId);
+ //};
+
+ var ALL_STATES = ['mouseOver', 'mouseDown', 'selected', 'focused', 'selectedFocused', 'disabled'];
+ var _applyImage = $ax.style.applyImage = function (id, imgUrl, state) {
+ var object = $obj(id);
+ if (object.generateCompound) {
+ for (var i = 0; i < object.compoundChildren.length; i++) {
+ var componentId = object.compoundChildren[i];
+ var childId = $ax.public.fn.getComponentId(id, componentId);
+ var childImgQuery = $jobj(childId + '_img');
+ var childQuery = $jobj(childId);
+ childImgQuery.attr('src', imgUrl[componentId]);
+ for (var j = 0; j < ALL_STATES.length; j++) {
+ childImgQuery.removeClass(ALL_STATES[j]);
+ childQuery.removeClass(ALL_STATES[j]);
+ }
+ if (state != 'normal') {
+ childImgQuery.addClass(state);
+ childQuery.addClass(state);
+ }
+ }
+ } else {
+ var imgQuery = $jobj($ax.GetImageIdFromShape(id));
+ var idQuery = $jobj(id);
+ //it is hard to tell if setting the image or the class first causing less flashing when adding shadows.
+ imgQuery.attr('src', imgUrl);
+ for (var i = 0; i < ALL_STATES.length; i++) {
+ idQuery.removeClass(ALL_STATES[i]);
+ imgQuery.removeClass(ALL_STATES[i]);
+ }
+ if (state != 'normal') {
+ idQuery.addClass(state);
+ imgQuery.addClass(state);
+ }
+ if (imgQuery.parents('a.basiclink').length > 0) imgQuery.css('border', 'none');
+ }
+
+ };
+
+ $ax.public.fn.getComponentId = function (id, componentId) {
+ var idParts = id.split('-');
+ idParts[0] = idParts[0] + componentId;
+ return idParts.join('-');
+ }
+
+ var _resetTextJson = function(id, textid) {
+ // reset the opacity
+ $jobj(id).children().css('opacity', '');
+
+ var cacheObject = _originalTextCache[textid];
+ if(cacheObject) {
+ _transformTextWithVerticalAlignment(textid, function() {
+ var styleCache = cacheObject.styleCache;
+ var textQuery = $('#' + textid);
+ textQuery.find('*').each(function(index, element) {
+ element.style.cssText = styleCache[element.id];
+ });
+ });
+ }
+ };
+
+ // Preserves the alingment for the element textid after executing transformFn
+
+ //var _getRtfElementHeight = function(rtfElement) {
+ // if(rtfElement.innerHTML == '') rtfElement.innerHTML = ' ';
+
+ // // To handle render text as image
+ // //var images = $(rtfElement).children('img');
+ // //if(images.length) return images.height();
+ // return rtfElement.offsetHeight;
+ //};
+
+ // why microsoft decided to default to round to even is beyond me...
+ //var _roundToEven = function(number) {
+ // var numString = number.toString();
+ // var parts = numString.split('.');
+ // if(parts.length == 1) return number;
+ // if(parts[1].length == 1 && parts[1] == '5') {
+ // var wholePart = Number(parts[0]);
+ // return wholePart % 2 == 0 ? wholePart : wholePart + 1;
+ // } else return Math.round(number);
+ //};
+
+ //var _suspendTextAlignment = 0;
+ //var _suspendedTextIds = [];
+ //$ax.style.startSuspendTextAlignment = function() {
+ // _suspendTextAlignment++;
+ //}
+ //$ax.style.resumeSuspendTextAlignment = function () {
+ // _suspendTextAlignment--;
+ // if(_suspendTextAlignment == 0) $ax.style.setTextAlignment(_suspendedTextIds);
+ //}
+
+ var _transformTextWithVerticalAlignment = $ax.style.transformTextWithVerticalAlignment = function(textId, transformFn) {
+ if(!_originalTextCache[textId]) {
+ $ax.style.CacheOriginalText(textId);
+ }
+
+ var rtfElement = window.document.getElementById(textId);
+ if(!rtfElement) return;
+
+ transformFn();
+
+ //_storeIdToAlignProps(textId);
+
+ //if (_suspendTextAlignment) {
+ // _suspendedTextIds.push(textId);
+ // return;
+ //}
+
+ //$ax.style.setTextAlignment([textId]);
+ };
+
+ // this is for vertical alignments set on hidden objects
+ //var _idToAlignProps = {};
+
+ //$ax.style.updateTextAlignmentForVisibility = function (textId) {
+ // var textObj = $jobj(textId);
+ // // must check if parent id exists. Doesn't exist for text objs in check boxes, and potentially elsewhere.
+ // var parentId = textObj.parent().attr('id');
+ // if (parentId && $ax.visibility.isContainer(parentId)) return;
+
+ // //var alignProps = _idToAlignProps[textId];
+ // //if(!alignProps || !_getObjVisible(textId)) return;
+ // //if (!alignProps) return;
+
+ // //_setTextAlignment(textId, alignProps);
+ // _setTextAlignment(textId);
+ //};
+
+ var _getObjVisible = _style.getObjVisible = function (id) {
+ var element = document.getElementById(id);
+ return element && (element.offsetWidth || element.offsetHeight);
+ };
+
+ //$ax.style.setTextAlignment = function (textIds) {
+
+ // var getTextAlignDim = function(textId, alignProps) {
+ // var dim = {};
+ // var vAlign = alignProps.vAlign;
+ // var paddingTop = Number(alignProps.paddingTop);
+ // var paddingBottom = Number(alignProps.paddingBottom);
+ // var paddingLeft = Number(alignProps.paddingLeft);
+ // var paddingRight = Number(alignProps.paddingRight);
+
+ // var topParam = 0.0;
+ // var bottomParam = 1.0;
+ // var leftParam = 0.0;
+ // var rightParam = 1.0;
+
+ // var textObj = $jobj(textId);
+ // var textObjParent = textObj.offsetParent();
+ // var parentId = textObjParent.attr('id');
+ // if(!parentId) {
+ // // Only case should be for radio/checkbox that get the label now because it must be absolute positioned for animate (offset parent ignored it before)
+ // textObjParent = textObjParent.parent();
+ // parentId = textObjParent.attr('id');
+ // }
+
+ // parentId = $ax.visibility.getWidgetFromContainer(textObjParent.attr('id'));
+ // textObjParent = $jobj(parentId);
+ // var parentObj = $obj(parentId);
+ // if(parentObj['bottomTextPadding']) bottomParam = parentObj['bottomTextPadding'];
+ // if(parentObj['topTextPadding']) topParam = parentObj['topTextPadding'];
+ // if(parentObj['leftTextPadding']) leftParam = parentObj['leftTextPadding'];
+ // if(parentObj['rightTextPadding']) rightParam = parentObj['rightTextPadding'];
+
+ // // smart shapes are mutually exclusive from compound vectors.
+ // var isConnector = parentObj.type == $ax.constants.CONNECTOR_TYPE;
+ // if(isConnector) return;
+
+ // var axTextObjectParent = $ax('#' + textObjParent.attr('id'));
+
+
+ // var jDims = textObj.css(['width','left','top']);
+ // var oldWidth = $ax.getNumFromPx(jDims['width']);
+ // var oldLeft = $ax.getNumFromPx(jDims['left']);
+ // var oldTop = $ax.getNumFromPx(jDims['top']);
+
+ // var newTop = 0;
+ // var newLeft = 0.0;
+
+ // var size = axTextObjectParent.size();
+ // var width = size.width;
+ // var height = size.height;
+ // //var width = axTextObjectParent.width();
+ // //var height = axTextObjectParent.height();
+
+ // // If text rotated need to handle getting the correct width for text based on bounding rect of rotated parent.
+ // var boundingRotation = -$ax.move.getRotationDegreeFromElement(textObj[0]);
+ // var boundingParent = $axure.fn.getBoundingSizeForRotate(width, height, boundingRotation);
+ // var extraLeftPadding = (width - boundingParent.width) / 2;
+ // width = boundingParent.width;
+ // var relativeTop = 0.0;
+ // relativeTop = height * topParam;
+ // var containerHeight = height * bottomParam - relativeTop;
+
+ // newLeft = paddingLeft + extraLeftPadding + width * leftParam;
+
+ // var newWidth = width * (rightParam - leftParam) - paddingLeft - paddingRight;
+
+ // var horizChange = newWidth != oldWidth || newLeft != oldLeft;
+ // if(horizChange) {
+ // dim.left = newLeft;
+ // dim.width = newWidth;
+ // //textObj.css('left', newLeft);
+ // //textObj.width(newWidth);
+ // }
+
+ // var textHeight = _getRtfElementHeight(textObj[0]);
+
+ // if(vAlign == "middle")
+ // newTop = _roundToEven(relativeTop + (containerHeight - textHeight + paddingTop - paddingBottom) / 2);
+ // else if(vAlign == "bottom")
+ // newTop = _roundToEven(relativeTop + containerHeight - textHeight - paddingBottom);
+ // else newTop = _roundToEven(paddingTop + relativeTop);
+ // var vertChange = oldTop != newTop;
+ // if (vertChange) dim.top = newTop; //textObj.css('top', newTop + 'px');
+
+ // return dim;
+ // };
+
+ // var applyTextAlignment = function(textId, dim) {
+ // var textObj = $jobj(textId);
+ // if(dim.left) {
+ // textObj.css('left', dim.left);
+ // textObj.width(dim.width);
+ // }
+ // if(dim.top) textObj.css('top', dim.top);
+
+ // if((dim.top || dim.left)) _updateTransformOrigin(textId);
+ // };
+
+ // var idToDim = [];
+ // for (var i = 0; i < textIds.length; i++) {
+ // var textId = textIds[i];
+ // var alignProps = _idToAlignProps[textId];
+ // if (!alignProps || !_getObjVisible(textId)) continue;
+
+ // idToDim.push({ id: textId, dim: getTextAlignDim(textId, alignProps) });
+ // }
+
+ // for (var i = 0; i < idToDim.length; i++) {
+ // var info = idToDim[i];
+ // applyTextAlignment(info.id, info.dim);
+ // }
+ //};
+
+ //var _setTextAlignment = function(textId, alignProps, updateProps) {
+ // if(updateProps) _storeIdToAlignProps(textId);
+ // if(!alignProps) return;
+
+ // var vAlign = alignProps.vAlign;
+ // var paddingTop = Number(alignProps.paddingTop);
+ // var paddingBottom = Number(alignProps.paddingBottom);
+ // var paddingLeft = Number(alignProps.paddingLeft);
+ // var paddingRight = Number(alignProps.paddingRight);
+
+ // var topParam = 0.0;
+ // var bottomParam = 1.0;
+ // var leftParam = 0.0;
+ // var rightParam = 1.0;
+
+ // var textObj = $jobj(textId);
+ // var textObjParent = textObj.offsetParent();
+ // var parentId = textObjParent.attr('id');
+ // var isConnector = false;
+ // if(parentId) {
+ // parentId = $ax.visibility.getWidgetFromContainer(textObjParent.attr('id'));
+ // textObjParent = $jobj(parentId);
+ // var parentObj = $obj(parentId);
+ // if(parentObj['bottomTextPadding']) bottomParam = parentObj['bottomTextPadding'];
+ // if(parentObj['topTextPadding']) topParam = parentObj['topTextPadding'];
+ // if(parentObj['leftTextPadding']) leftParam = parentObj['leftTextPadding'];
+ // if(parentObj['rightTextPadding']) rightParam = parentObj['rightTextPadding'];
+
+ // // smart shapes are mutually exclusive from compound vectors.
+ // isConnector = parentObj.type == $ax.constants.CONNECTOR_TYPE;
+ // }
+ // if(isConnector) return;
+
+ // var axTextObjectParent = $ax('#' + textObjParent.attr('id'));
+
+ // var oldWidth = $ax.getNumFromPx(textObj.css('width'));
+ // var oldLeft = $ax.getNumFromPx(textObj.css('left'));
+ // var oldTop = $ax.getNumFromPx(textObj.css('top'));
+
+ // var newTop = 0;
+ // var newLeft = 0.0;
+
+ // var width = axTextObjectParent.width();
+ // var height = axTextObjectParent.height();
+
+ // // If text rotated need to handle getting the correct width for text based on bounding rect of rotated parent.
+ // var boundingRotation = -$ax.move.getRotationDegreeFromElement(textObj[0]);
+ // var boundingParent = $axure.fn.getBoundingSizeForRotate(width, height, boundingRotation);
+ // var extraLeftPadding = (width - boundingParent.width) / 2;
+ // width = boundingParent.width;
+ // var relativeTop = 0.0;
+ // relativeTop = height * topParam;
+ // var containerHeight = height * bottomParam - relativeTop;
+
+
+ // newLeft = paddingLeft + extraLeftPadding + width * leftParam;
+
+ // var newWidth = width * (rightParam - leftParam) - paddingLeft - paddingRight;
+
+ // var horizChange = newWidth != oldWidth || newLeft != oldLeft;
+ // if(horizChange) {
+ // textObj.css('left', newLeft);
+ // textObj.width(newWidth);
+ // }
+
+ // var textHeight = _getRtfElementHeight(textObj[0]);
+
+ // if(vAlign == "middle") newTop = _roundToEven(relativeTop + (containerHeight - textHeight + paddingTop - paddingBottom) / 2);
+ // else if(vAlign == "bottom") newTop = _roundToEven(relativeTop + containerHeight - textHeight - paddingBottom);
+ // else newTop = _roundToEven(paddingTop + relativeTop);
+ // var vertChange = oldTop != newTop;
+ // if(vertChange) textObj.css('top', newTop + 'px');
+
+ // if((vertChange || horizChange)) _updateTransformOrigin(textId);
+ //};
+
+ //var _updateTransformOrigin = function (textId) {
+ // var textObj = $jobj(textId);
+ // var parentId = textObj.parent().attr('id');
+ // if(!$obj(parentId).hasTransformOrigin) return;
+
+ // //var transformOrigin = textObj.css('-webkit-transform-origin') ||
+ // // textObj.css('-moz-transform-origin') ||
+ // // textObj.css('-ms-transform-origin') ||
+ // // textObj.css('transform-origin');
+ // //if(transformOrigin) {
+ // var textObjParent = $ax('#' + textObj.parent().attr('id'));
+ // var newX = (textObjParent.width() / 2 - $ax.getNumFromPx(textObj.css('left')));
+ // var newY = (textObjParent.height() / 2 - $ax.getNumFromPx(textObj.css('top')));
+ // var newOrigin = newX + 'px ' + newY + 'px';
+ // textObj.css('-webkit-transform-origin', newOrigin);
+ // textObj.css('-moz-transform-origin', newOrigin);
+ // textObj.css('-ms-transform-origin', newOrigin);
+ // textObj.css('transform-origin', newOrigin);
+ // //}
+ //};
+
+ $ax.style.reselectElements = function() {
+ for(var id in _selectedWidgets) {
+ // Only looking for the selected widgets that don't have their class set
+ if(!_selectedWidgets[id] || $jobj(id).hasClass('selected')) continue;
+
+ $jobj(id).addClass('selected');
+ _applyImageAndTextJson(id, $ax.style.generateState(id));
+ }
+
+ for(id in _disabledWidgets) {
+ // Only looking for the disabled widgets that don't have their class yet
+ if (!_disabledWidgets[id] || $jobj(id).hasClass('disabled')) continue;
+
+ $jobj(id).addClass('disabled');
+ _applyImageAndTextJson(id, $ax.style.generateState(id));
+ }
+ }
+
+ $ax.style.clearStateForRepeater = function(repeaterId) {
+ var children = $ax.getChildElementIdsForRepeater(repeaterId);
+ for(var i = 0; i < children.length; i++) {
+ var id = children[i];
+ delete _selectedWidgets[id];
+ delete _disabledWidgets[id];
+ }
+ }
+
+ _style.updateStateClass = function (repeaterId) {
+ var subElementIds = $ax.getChildElementIdsForRepeater(repeaterId);
+ for (var i = 0; i < subElementIds.length; i++) {
+ _applyImageAndTextJson(subElementIds[i], $ax.style.generateState(subElementIds[i]));
+ }
+ }
+
+ $ax.style.clearAdaptiveStyles = function() {
+ for(var shapeId in _adaptiveStyledWidgets) {
+ var repeaterId = $ax.getParentRepeaterFromScriptId(shapeId);
+ if(repeaterId) continue;
+ var elementId = $ax.GetButtonShapeId(shapeId);
+ if(elementId) _applyImageAndTextJson(elementId, $ax.style.generateState(elementId));
+ }
+
+ _adaptiveStyledWidgets = {};
+ };
+
+ $ax.style.setAdaptiveStyle = function(shapeId, style) {
+ _adaptiveStyledWidgets[$ax.repeater.getScriptIdFromElementId(shapeId)] = style;
+
+ var textId = $ax.GetTextPanelId(shapeId);
+ if(textId) _applyTextStyle(textId, style);
+
+ $ax.placeholderManager.refreshPlaceholder(shapeId);
+
+ // removing this for now
+ // if(style.location) {
+ // $jobj(shapeId).css('top', style.location.x + "px")
+ // .css('left', style.location.y + "px");
+ // }
+ };
+
+ //-------------------------------------------------------------------------
+ // _applyTextStyle
+ //
+ // Applies a rollover style to a text element.
+ // id : the id of the text object to set.
+ // styleProperties : an object mapping style properties to values. eg:
+ // { 'fontWeight' : 'bold',
+ // 'fontStyle' : 'italic' }
+ //-------------------------------------------------------------------------
+ var _applyTextStyle = function(id, style) {
+ _transformTextWithVerticalAlignment(id, function() {
+ var styleProperties = _getCssStyleProperties(style);
+ $('#' + id).find('*').each(function(index, element) {
+ _applyCssProps(element, styleProperties);
+ });
+ });
+ };
+
+ var _applyCssProps = function(element, styleProperties, applyAllStyle) {
+ if(applyAllStyle) {
+ var allProps = styleProperties.allProps;
+ for(var prop in allProps) element.style[prop] = allProps[prop];
+ } else {
+ var nodeName = element.nodeName.toLowerCase();
+ if(nodeName == 'p') {
+ var parProps = styleProperties.parProps;
+ for(prop in parProps) element.style[prop] = parProps[prop];
+ } else if(nodeName != 'a') {
+ var runProps = styleProperties.runProps;
+ for(prop in runProps) element.style[prop] = runProps[prop];
+ }
+ }
+ };
+
+ var _getCssShadow = function(shadow) {
+ return !shadow.on ? "none"
+ : shadow.offsetX + "px " + shadow.offsetY + "px " + shadow.blurRadius + "px " + _getCssColor(shadow.color);
+ };
+
+ var _getCssStyleProperties = function(style) {
+ var toApply = {};
+ toApply.runProps = {};
+ toApply.parProps = {};
+ toApply.allProps = {};
+
+ if(style.fontName) toApply.allProps.fontFamily = toApply.runProps.fontFamily = style.fontName;
+ // we need to set font size on both runs and pars because otherwise it well mess up the measure and thereby vertical alignment
+ if(style.fontSize) toApply.allProps.fontSize = toApply.runProps.fontSize = toApply.parProps.fontSize = style.fontSize;
+ if(style.fontWeight !== undefined) toApply.allProps.fontWeight = toApply.runProps.fontWeight = style.fontWeight;
+ if(style.fontStyle !== undefined) toApply.allProps.fontStyle = toApply.runProps.fontStyle = style.fontStyle;
+
+ var textDecoration = [];
+ if(style.underline !== undefined) textDecoration[0] = style.underline ? 'underline ' : 'none';
+ if(style.strikethrough !== undefined) {
+ var index = textDecoration.length;
+ if(style.strikethrough) textDecoration[index] ='line-through';
+ else if(index == 0) textDecoration[0] = 'none';
+ }
+ if (textDecoration.length > 0) {
+ var decorationLineUp = "";
+ for (var l = 0; l < textDecoration.length; l++) {
+ decorationLineUp = decorationLineUp + textDecoration[l];
+ }
+ toApply.allProps.textDecoration = toApply.runProps.textDecoration = decorationLineUp;
+ }
+ if(style.foreGroundFill) {
+ toApply.allProps.color = toApply.runProps.color = _getColorFromFill(style.foreGroundFill);
+ //if(style.foreGroundFill.opacity) toApply.allProps.opacity = toApply.runProps.opacity = style.foreGroundFill.opacity;
+ }
+ if(style.horizontalAlignment) toApply.allProps.textAlign = toApply.parProps.textAlign = toApply.runProps.textAlign = style.horizontalAlignment;
+ if(style.lineSpacing) toApply.allProps.lineHeight = toApply.parProps.lineHeight = style.lineSpacing;
+ if(style.textShadow) toApply.allProps.textShadow = toApply.parProps.textShadow = _getCssShadow(style.textShadow);
+ if (style.letterCase) toApply.allProps.textTransform = toApply.parProps.textTransform = style.letterCase;
+ if (style.characterSpacing) toApply.allProps.letterSpacing = toApply.runProps.letterSpacing = style.characterSpacing;
+
+ return toApply;
+ };
+
+ var _getColorFromFill = function(fill) {
+ //var fillString = '00000' + fill.color.toString(16);
+ //return '#' + fillString.substring(fillString.length - 6);
+ var val = fill.color;
+ var color = {};
+ color.b = val % 256;
+ val = Math.floor(val / 256);
+ color.g = val % 256;
+ val = Math.floor(val / 256);
+ color.r = val % 256;
+ color.a = typeof (fill.opacity) == 'number' ? fill.opacity : 1;
+ return _getCssColor(color);
+ };
+
+ var _getCssColor = function(rgbaObj) {
+ return "rgba(" + rgbaObj.r + ", " + rgbaObj.g + ", " + rgbaObj.b + ", " + rgbaObj.a + ")";
+ };
+
+ // //--------------------------------------------------------------------------
+ // // ApplyStyleRecursive
+ // //
+ // // Applies a style recursively to all span and div tags including elementNode
+ // // and all of its children.
+ // //
+ // // element : the element to apply the style to
+ // // styleName : the name of the style property to set (eg. 'font-weight')
+ // // styleValue : the value of the style to set (eg. 'bold')
+ // //--------------------------------------------------------------------------
+ // function ApplyStyleRecursive(element, styleName, styleValue) {
+ // var nodeName = element.nodeName.toLowerCase();
+
+ // if (nodeName == 'div' || nodeName == 'span' || nodeName == 'p') {
+ // element.style[styleName] = styleValue;
+ // }
+
+ // for (var i = 0; i < element.childNodes.length; i++) {
+ // ApplyStyleRecursive(element.childNodes[i], styleName, styleValue);
+ // }
+ // }
+
+ // //---------------------------------------------------------------------------
+ // // ApplyTextProperty
+ // //
+ // // Applies a text property to rtfElement.
+ // //
+ // // rtfElement : the the root text element of the rtf object (this is the
+ // // element named _rtf
+ // // prop : the style property to set.
+ // // value : the style value to set.
+ // //---------------------------------------------------------------------------
+ // function ApplyTextProperty(rtfElement, prop, value) {
+ // /*
+ // var oldHtml = rtfElement.innerHTML;
+ // if (prop == 'fontWeight') {
+ // rtfElement.innerHTML = oldHtml.replace(/< *b *\/?>/gi, "");
+ // } else if (prop == 'fontStyle') {
+ // rtfElement.innerHTML = oldHtml.replace(/< *i *\/?>/gi, "");
+ // } else if (prop == 'textDecoration') {
+ // rtfElement.innerHTML = oldHtml.replace(/< *u *\/?>/gi, "");
+ // }
+ // */
+
+ // for (var i = 0; i < rtfElement.childNodes.length; i++) {
+ // ApplyStyleRecursive(rtfElement.childNodes[i], prop, value);
+ // }
+ // }
+ //}
+
+ //---------------------------------------------------------------------------
+ // GetAndCacheOriginalText
+ //
+ // Gets the html for the pre-rollover state and returns the Html representing
+ // the Rich text.
+ //---------------------------------------------------------------------------
+ var CACHE_COUNTER = 0;
+
+ $ax.style.CacheOriginalText = function(textId, hasRichTextBeenSet) {
+ var rtfQuery = $('#' + textId);
+ if(rtfQuery.length > 0) {
+
+ var styleCache = {};
+ rtfQuery.find('*').each(function(index, element) {
+ var elementId = element.id;
+ if(!elementId) element.id = elementId = 'cache' + CACHE_COUNTER++;
+ styleCache[elementId] = element.style.cssText;
+ });
+
+ _originalTextCache[textId] = {
+ styleCache: styleCache
+ };
+ if(hasRichTextBeenSet) {
+ var shapeId = $ax.GetShapeIdFromText(textId);
+ _shapesWithSetRichText[shapeId] = true;
+ }
+ }
+ };
+
+ $ax.style.ClearCacheForRepeater = function(repeaterId) {
+ for(var elementId in _originalTextCache) {
+ var scriptId = $ax.repeater.getScriptIdFromElementId(elementId);
+ if($ax.getParentRepeaterFromScriptId(scriptId) == repeaterId) delete _originalTextCache[elementId];
+ }
+ };
+
+
+
+ $ax.style.prefetch = function() {
+ var scriptIds = $ax.getAllScriptIds();
+ var image = new Image();
+ for(var i = 0; i < scriptIds.length; i++) {
+ var obj = $obj(scriptIds[i]);
+ if (!$ax.public.fn.IsImageBox(obj.type)) continue;
+ var images = obj.images;
+ for (var key in images) image.src = images[key];
+
+ var imageOverrides = obj.imageOverrides;
+ for(var elementId in imageOverrides) {
+ var override = imageOverrides[elementId];
+ for (var state in override) {
+ _addImageOverride(elementId, state, override[state]);
+ image.src = override[state];
+ }
+ }
+ }
+ };
+});
\ No newline at end of file
diff --git a/src/原型系统/resources/scripts/axure/tree.js b/src/原型系统/resources/scripts/axure/tree.js
new file mode 100644
index 0000000..7c5ca2d
--- /dev/null
+++ b/src/原型系统/resources/scripts/axure/tree.js
@@ -0,0 +1,189 @@
+// This is actually for BOTH trees and menus
+$axure.internal(function($ax) {
+ var _tree = $ax.tree = {};
+ var _menu = $ax.menu = {};
+
+ $ax.menu.InitializeSubmenu = function(subMenuId, cellId) {
+ var $submenudiv = $('#' + subMenuId);
+
+ //mouseenter and leave for parent table cell
+ $('#' + cellId).mouseenter(function(e) {
+ //show current submenu
+// var submenuElement = document.getElementById(subMenuId);
+// if($ax.visibility.IsVisible(submenuElement) && submenuElement.style.display !== 'none') return;
+ $ax.visibility.SetIdVisible(subMenuId, true);
+ $ax.legacy.BringToFront(subMenuId);
+ //$submenudiv.find('.menu_item').each(function() {
+ // $ax.style.updateTextAlignmentForVisibility($ax.GetTextPanelId($(this).attr('id')));
+ //});
+ _fireEventForSubmenu(subMenuId, "onShow");
+
+ }).mouseleave(function (e) {
+ var offset = $submenudiv.offset();
+ var subcontwidth = $submenudiv.width();
+ var subcontheight = $submenudiv.height();
+ //If mouse is not within the submenu (added 3 pixel margin to top and left calculations), then close the submenu...
+ if(e.pageX + 3 < offset.left || e.pageX > offset.left + subcontwidth || e.pageY + 3 < offset.top || e.pageY > offset.top + subcontheight) {
+ $submenudiv.find('.sub_menu').addBack().each(function () {
+// if(!$ax.visibility.IsVisible(this)) return;
+ $ax.visibility.SetVisible(this, false);
+ _fireEventForSubmenu(subMenuId, "onHide");
+ });
+ $ax.style.SetWidgetHover(cellId, false);
+ }
+ });
+
+ $submenudiv.css('display', 'none');
+
+ //mouseleave for submenu
+ $submenudiv.mouseleave(function(e) {
+ //close this menu and all menus below it
+ $(this).find('.sub_menu').addBack().css({ 'visibility': 'hidden', 'display': 'none' }).each(function () {
+// if(!$ax.visibility.IsVisible(this)) return;
+ _fireEventForSubmenu(this.id, "onHide");
+ });
+ $ax.style.SetWidgetHover(cellId, false);
+ });
+ };
+
+ var _fireEventForSubmenu = function(targetId, eventName) {
+ var diagramObject = $ax.getObjectFromElementId(targetId);
+ var event = diagramObject.interactionMap && diagramObject.interactionMap[eventName];
+ if(event) {
+ var eventInfo = $ax.getEventInfoFromEvent($ax.getjBrowserEvent(), false, targetId);
+ $ax.event.handleEvent(targetId, eventInfo, event, false, true);
+ }
+ }
+
+ function IsNodeVisible(nodeId) {
+ var current = window.document.getElementById(nodeId);
+ var parent = current.parentNode;
+
+ //move all the parent's children that are below the node and their annotations
+ while(!$(current).hasClass("treeroot")) {
+ if(!$ax.visibility.IsVisible(parent)) return false;
+ current = parent;
+ parent = parent.parentNode;
+ }
+ return true;
+ }
+
+ $ax.tree.ExpandNode = function(nodeId, childContainerId, plusMinusId) {
+ var container = window.document.getElementById(childContainerId);
+ if(!container || $ax.visibility.IsVisible(container)) return;
+ $ax.visibility.SetVisible(container, true);
+
+ if(plusMinusId != '') $ax.style.SetWidgetSelected(plusMinusId, true);
+
+ var delta = _getExpandCollapseDelta(nodeId, childContainerId);
+
+ var isVisible = IsNodeVisible(nodeId);
+ var current = window.document.getElementById(nodeId);
+ var parent = current.parentNode;
+
+ //move all the parent's children that are below the node and their annotations
+ while(!$(current).hasClass("treeroot")) {
+ var after = false;
+ var i = 0;
+ for(i = 0; i < parent.childNodes.length; i++) {
+ var child = parent.childNodes[i];
+ if(after && child.id && $(child).hasClass("treenode")) {
+ var elementId = child.id;
+ child.style.top = $ax.getNumFromPx($(child).css('top')) + delta + 'px';
+ var ann = window.document.getElementById(elementId + "_ann");
+ if (ann) ann.style.top = $ax.getNumFromPx($(ann).css('top')) + delta + 'px';
+ }
+ if(child == current) after = true;
+ }
+ current = parent;
+ parent = parent.parentNode;
+ if(!isVisible && $ax.visibility.IsVisible(parent)) break;
+ }
+ };
+
+ $ax.tree.CollapseNode = function(nodeId, childContainerId, plusMinusId) {
+ var container = window.document.getElementById(childContainerId);
+ if(!container || !$ax.visibility.IsVisible(container)) return;
+
+ if(plusMinusId != '') $ax.style.SetWidgetSelected(plusMinusId, false);
+
+ var delta = _getExpandCollapseDelta(nodeId, childContainerId);
+
+ //hide it after getting the delta, otherwise the delta can't be calculated (offsetParent is null)
+ $ax.visibility.SetVisible(container, false);
+
+ var isVisible = IsNodeVisible(nodeId);
+ var current = window.document.getElementById(nodeId);
+ var parent = current.parentNode;
+
+ //move all the parent's children that are below the node and their annotations
+ while(!$(current).hasClass("treeroot")) {
+ var after = false;
+ var i = 0;
+ for(i = 0; i < parent.childNodes.length; i++) {
+ var child = parent.childNodes[i];
+ if(after && child.id && $(child).hasClass("treenode")) {
+ var elementId = child.id;
+ child.style.top = $ax.getNumFromPx($(child).css('top')) - delta + 'px';
+ var ann = window.document.getElementById(elementId + "_ann");
+ if (ann) ann.style.top = $ax.getNumFromPx($(ann).css('top')) - delta + 'px';
+ }
+ if(child == current) after = true;
+ }
+ current = parent;
+ parent = current.parentNode;
+ if(!isVisible && $ax.visibility.IsVisible(parent)) break;
+ }
+ };
+
+ var _getExpandCollapseDelta = function(nodeId, childContainerId) {
+ return _getChildContainerHeightHelper(childContainerId);
+ };
+
+ var _getChildContainerHeightHelper = function(childContainerId) {
+ var height = 0;
+ $('#' + childContainerId).children().each(function() {
+ if($(this).hasClass("treenode")) {
+ height += $(this).height();
+ var subContainer = window.document.getElementById(this.id + '_children');
+ if(subContainer && $ax.visibility.IsVisible(subContainer)) {
+ height += _getChildContainerHeightHelper(subContainer.id);
+ }
+ }
+ });
+ return height;
+ };
+
+ $ax.tree.InitializeTreeNode = function(nodeId, plusminusid, childContainerId, selectText) {
+ var childContainer = window.document.getElementById(childContainerId);
+ if(childContainer) {
+ //relying on the html generator to put this inline so we know to collapse by default
+ var isCollapsed = childContainer.style.visibility == "hidden";
+ if(isCollapsed) $ax.visibility.SetVisible(childContainer, false);
+
+ if(!isCollapsed && plusminusid != '') $ax.style.SetWidgetSelected(plusminusid, true);
+ }
+
+ if(plusminusid != '') {
+ $jobj(plusminusid).click(function() {
+ var visibleSet = $ax.visibility.IsIdVisible(childContainerId);
+
+ if(visibleSet) $ax.tree.CollapseNode(nodeId, childContainerId, plusminusid);
+ else $ax.tree.ExpandNode(nodeId, childContainerId, plusminusid);
+ $ax.tree.SelectTreeNode(nodeId, true);
+
+ return false;
+ }).css('cursor', 'default');
+ }
+ };
+
+ var _getButtonShapeId = function(id) {
+ var obj = $obj(id);
+ return $ax.public.fn.IsTreeNodeObject(obj.type) ? $ax.getElementIdFromPath([obj.buttonShapeId], { relativeTo: id }) : id;
+ };
+
+ $ax.tree.SelectTreeNode = function(id, selected) {
+ $ax.style.SetWidgetSelected(_getButtonShapeId(id), selected);
+ };
+
+});
\ No newline at end of file
diff --git a/src/原型系统/resources/scripts/axure/utils.temp.js b/src/原型系统/resources/scripts/axure/utils.temp.js
new file mode 100644
index 0000000..43ba542
--- /dev/null
+++ b/src/原型系统/resources/scripts/axure/utils.temp.js
@@ -0,0 +1,99 @@
+// ******* Deep Copy ******** //
+$axure.internal(function($ax) {
+ // TODO: [ben] Ah, infinite loops cause major issues here. Tried saving objects we've already hit, but that didn't seem to work (at least at my first shot).
+ // TODO: [ben] To continue from above, added a filter to filter out problem keys. Will need a better way of sorting this out eventually.
+ var _deepCopy = function (original, trackCopies, filter) {
+ if(trackCopies) {
+ var index = _getCopyIndex(original);
+ if(index != -1) return _originalToCopy[index][1];
+ }
+ var isArray = original instanceof Array;
+ var isObject = !(original instanceof Function) && !(original instanceof Date) && (original instanceof Object);
+ if(!isArray && !isObject) return original;
+ var copy = isArray ? [] : { };
+ if(trackCopies) _originalToCopy.push([original, copy]);
+ isArray ? deepCopyArray(original, trackCopies, copy, filter) : deepCopyObject(original, trackCopies, copy, filter);
+ return copy;
+ };
+ $ax.deepCopy = _deepCopy;
+
+ // Hacky way to copy event info. Copying dragInfo causes major issues due to infinite loops
+ // Hashmap doesn't map objects well. It just toStrings them, making them all the same key. This has to be slow...
+ var _originalToCopy = [];
+ var _getCopyIndex = function(original) {
+ for(var i = 0; i < _originalToCopy.length; i++) if(original === _originalToCopy[i][0]) return i;
+ return -1;
+ };
+
+ $ax.eventCopy = function(eventInfo) {
+ var copy = _deepCopy(eventInfo, true, ['dragInfo', 'elementQuery', 'obj']);
+ // reset the map. TODO: May need to reset elsewhere too, but this is the only way it's used currently
+ _originalToCopy = [];
+
+ return copy;
+ };
+
+ var deepCopyArray = function(original, trackCopies, copy, filter) {
+ for(var i = 0; i < original.length; i++) {
+ copy[i] = _deepCopy(original[i], trackCopies, filter);
+ }
+ };
+
+ var deepCopyObject = function(original, trackCopies, copy, filter) {
+ for(var key in original) {
+ if(!original.hasOwnProperty(key)) continue; // Continue if the prop was not put there like a dictionary, but just a native part of the object
+
+ if(filter && filter.indexOf[key] != -1) copy[key] = original[key]; // If that key is filtered out, skip recursion on it.
+ else copy[key] = _deepCopy(original[key], trackCopies, filter);
+ }
+ };
+
+ // Our implementation of splice because it is broken in IE8...
+ $ax.splice = function(array, startIndex, count) {
+ var retval = [];
+ if(startIndex >= array.length || startIndex < 0 || count == 0) return retval;
+ if(!count || startIndex + count > array.length) count = array.length - startIndex;
+ for(var i = 0; i < count; i++) retval[i] = array[startIndex + i];
+ for(i = startIndex + count; i < array.length; i++) array[i - count] = array[i];
+ for(i = 0; i < count; i++) array.pop();
+ return retval;
+ };
+});
+
+
+
+// ******* Flow Shape Links ******** //
+$axure.internal(function($ax) {
+
+ $(window.document).ready(function() {
+ if (!$ax.document.configuration.linkFlowsToPages && !$ax.document.configuration.linkFlowsToPagesNewWindow) return;
+
+ $ax(function (dObj) { return ($ax.public.fn.IsVector(dObj.type) || $ax.public.fn.IsSnapshot(dObj.type)) && dObj.referencePageUrl; }).each(function (dObj, elementId) {
+
+ var elementIdQuery = $('#' + elementId);
+
+ if($ax.document.configuration.linkFlowsToPages && !$ax.event.HasClick(dObj)) {
+ elementIdQuery.css("cursor", "pointer");
+ elementIdQuery.click(function() {
+ $ax.navigate({
+ url: dObj.referencePageUrl,
+ target: "current",
+ includeVariables: true
+ });
+ });
+ }
+
+ if($ax.document.configuration.linkFlowsToPagesNewWindow) {
+ $('#' + elementId + "_ref").append("");
+ $('#' + elementId + "PagePopup").click(function() {
+ $ax.navigate({
+ url: dObj.referencePageUrl,
+ target: "new",
+ includeVariables: true
+ });
+ });
+ }
+ });
+ });
+
+});
diff --git a/src/原型系统/resources/scripts/axure/variables.js b/src/原型系统/resources/scripts/axure/variables.js
new file mode 100644
index 0000000..19a26f8
--- /dev/null
+++ b/src/原型系统/resources/scripts/axure/variables.js
@@ -0,0 +1,151 @@
+// ******* GLOBAL VARIABLE PROVIDER ******** //
+$axure.internal(function($ax) {
+ var _globalVariableValues = {};
+
+ var _globalVariableProvider = {};
+ $ax.globalVariableProvider = _globalVariableProvider;
+
+ var setVariableValue = function(variable, value, suppressBroadcast) {
+ if(!(value instanceof Object)) value = value.toString();
+
+ variable = variable.toLowerCase();
+ _globalVariableValues[variable] = value;
+
+ if(suppressBroadcast !== true) {
+ var varData = {
+ globalVarName: variable,
+ globalVarValue: value.toString()
+ };
+
+ $axure.messageCenter.postMessage('setGlobalVar', varData);
+ }
+
+ //Post global var values only if pageData is loaded (suppresses exception which occurs when page loads)
+ if($ax.pageData) {
+ _postGlobalVarVals();
+ }
+ };
+ _globalVariableProvider.setVariableValue = setVariableValue;
+
+ var getVariableValue = function(variable, eventInfo, ignoreDefaultsForLinkUrl) {
+ variable = variable.toLowerCase();
+ if(_globalVariableValues[variable] !== undefined) {
+ //If this is for the GetLinkUrl function and
+ //the current value of the global variable is the same as the default defined in the document, don't return it
+ if(ignoreDefaultsForLinkUrl == true && $ax.document.globalVariables[variable] == _globalVariableValues[variable]) {
+ return null;
+ }
+
+ return _globalVariableValues[variable];
+ }
+ if($ax.document.globalVariables[variable] !== undefined) return ignoreDefaultsForLinkUrl == true ? null : $ax.document.globalVariables[variable];
+ switch(variable) {
+ case "pagename": return $ax.pageData.page.name;
+
+ case "now": return eventInfo.now;
+ case "gendate": return $ax.pageData.generationDate;
+
+ case "dragx": return $ax.drag.GetDragX();
+ case "dragy": return $ax.drag.GetDragY();
+ case "totaldragx": return $ax.drag.GetTotalDragX();
+ case "totaldragy": return $ax.drag.GetTotalDragY();
+ case "dragtime": return $ax.drag.GetDragTime();
+
+ case "math": return Math;
+ case "date": return Date;
+
+ case "window": return eventInfo && eventInfo.window;
+ case "this": return eventInfo && eventInfo.thiswidget && $ax.getWidgetInfo(eventInfo.thiswidget.elementId);
+ case "item": return (eventInfo && eventInfo.item && eventInfo.item.valid && eventInfo.item) || getVariableValue('targetitem', eventInfo, ignoreDefaultsForLinkUrl);
+ case "targetitem": return eventInfo && eventInfo.targetElement && $ax.getItemInfo(eventInfo.targetElement);
+ case "repeater": return eventInfo && eventInfo.repeater;
+ case "target": return eventInfo && eventInfo.targetElement && $ax.getWidgetInfo(eventInfo.targetElement);
+ case "cursor": return eventInfo && eventInfo.cursor;
+ default:
+ var gen = variable.substr(0, 3) == "gen";
+ var date = gen ? $ax.pageData.generationDate : new Date();
+ var prop = gen ? variable.substr(3) : variable;
+ switch(prop) {
+ case "day": return date.getDate();
+ case "month": return date.getMonth() + 1;
+ case "monthname": return $ax.getMonthName(date.getMonth());
+ case "dayofweek": return $ax.getDayOfWeek(date.getDay());
+ case "year": return date.getFullYear();
+ case "time": return date.toLocaleTimeString();
+ case "hours": return date.getHours();
+ case "minutes": return date.getMinutes();
+ case "seconds": return date.getSeconds();
+ default: return '';
+ }
+ }
+ };
+ _globalVariableProvider.getVariableValue = getVariableValue;
+
+ var load = function() {
+ var csum = false;
+
+ var query = (window.location.href.split("#")[1] || ''); //hash.substring(1); Firefox decodes this so & in variables breaks
+ if(query.length > 0) {
+ var vars = query.split("&");
+ for(var i = 0; i < vars.length; i++) {
+ var pair = vars[i].split("=");
+ var varName = pair[0];
+ var varValue = pair[1];
+ if(varName) {
+ if(varName == 'CSUM') {
+ csum = true;
+ } else setVariableValue(varName, decodeURIComponent(varValue), true);
+ }
+ }
+
+ if(!csum && query.length > 250) {
+ window.alert('Axure Warning: The variable values were too long to pass to this page.\n\nIf you are using IE, using Chrome or Firefox will support more data.');
+ }
+ }
+ };
+
+ var getLinkUrl = function(baseUrl) {
+ var toAdd = '';
+ var definedVariables = _getDefinedVariables();
+ for(var i = 0; i < definedVariables.length; i++) {
+ var key = definedVariables[i];
+ var val = getVariableValue(key, undefined, true);
+ if(val != null) {
+ if(toAdd.length > 0) toAdd += '&';
+ toAdd += key + '=' + encodeURIComponent(val);
+ }
+ }
+ return toAdd.length > 0 ? baseUrl + ($axure.shouldSendVarsToServer() ? '?' : '#') + toAdd + "&CSUM=1" : baseUrl;
+ };
+ _globalVariableProvider.getLinkUrl = getLinkUrl;
+
+ var _getDefinedVariables = function() {
+ return $ax.pageData.variables;
+ };
+ _globalVariableProvider.getDefinedVariables = _getDefinedVariables;
+
+ var _postGlobalVarVals = function() {
+ var retVal = {};
+ var definedVariables = _getDefinedVariables();
+ for(var i = 0; i < definedVariables.length; i++) {
+ var key = definedVariables[i];
+ var val = getVariableValue(key);
+ if(val != null) {
+ retVal[key] = val;
+ }
+ }
+
+ $ax.messageCenter.postMessage('globalVariableValues', retVal);
+ };
+
+ $ax.messageCenter.addMessageListener(function(message, data) {
+ if(message == 'getGlobalVariables') {
+ _postGlobalVarVals();
+ } else if(message == 'resetGlobalVariables') {
+ _globalVariableValues = {};
+ _postGlobalVarVals();
+ }
+ });
+
+ load();
+});
\ No newline at end of file
diff --git a/src/原型系统/resources/scripts/axure/viewer.js b/src/原型系统/resources/scripts/axure/viewer.js
new file mode 100644
index 0000000..10415e4
--- /dev/null
+++ b/src/原型系统/resources/scripts/axure/viewer.js
@@ -0,0 +1,268 @@
+// ******* SITEMAP TOOLBAR VIEWER ACTIONS ******** //
+$axure.internal(function ($ax) {
+ var userTriggeredEventNames = ['onClick', 'onDoubleClick', 'onMouseOver', 'onMouseMove', 'onMouseOut', 'onMouseDown', 'onMouseUp',
+ 'onKeyDown', 'onKeyUp', 'onFocus', 'onLostFocus', 'onTextChange', 'onSelectionChange', 'onSelectedChange', 'onSelect', 'onUnselect',
+ 'onSwipeLeft', 'onSwipeRight', 'onSwipeUp', 'onSwipeDown', 'onDragStart', 'onDrag', 'onDragDrop', 'onScroll', 'onContextMenu', 'onMouseHover', 'onLongClick'];
+
+ //var _toggleSelectWidgetNoteForRepeater = function (repeaterId, scriptId, select) {
+ // var itemIds = $ax.getItemIdsForRepeater(repeaterId);
+
+ // for(var i = 0; i < itemIds.length; i++) {
+ // var itemId = itemIds[i];
+ // var elementId = $ax.repeater.createElementId(scriptId, itemId);
+ // if(select) $('#' + elementId).addClass('widgetNoteSelected');
+ // else $('#' + elementId).removeClass('widgetNoteSelected');
+ // }
+ //}
+ $ax.messageCenter.addMessageListener(function (message, data) {
+ //If annotation toggle message received from sitemap, toggle footnotes
+ if(message == 'toggleSelectWidgetNote') {
+
+ if (!IOS) {
+ $('.widgetNoteSelected').removeClass('widgetNoteSelected');
+ }
+
+ if(!data.value) return;
+
+ //if(lastSelectedWidgetNote == data.id) {
+ // lastSelectedWidgetNote = null;
+ // return;
+ //}
+
+ $ax('*').each(function(obj, elementId) {
+ if (obj.id == data.id) {
+ if (!IOS) {
+ $('#' + elementId).addClass('widgetNoteSelected');
+ }
+
+ _scrollToSelectedNote($('#' + elementId), data.view);
+ }
+ });
+ }
+ });
+
+ var _scrollToSelectedNote = function ($elmt, view) {
+ var isLandscape = IOS ? window.orientation != 0 && window.orientation != 180 : false;
+ var winWidth = !IOS ? $(window).width() : (isLandscape ? window.screen.height : window.screen.width) - view.panelWidthOffset;
+ var winHeight = !IOS ? $(window).height() : view.height;
+ var docLeft = $('html').last().scrollLeft();
+ var docTop = $('html').last().scrollTop();
+ var docRight = docLeft + winWidth;
+ var docBottom = docTop + winHeight;
+
+ var scale = $('#base').css('transform');;
+ scale = (scale == "none") ? 1 : Number(scale.substring(scale.indexOf('(') + 1, scale.indexOf(',')));
+
+ var bodyLeft = ($('body').css('left') !== undefined && $('body').css('left') !== "auto") ? Number($('body').css('left').replace('px','')) : 0;
+ var top = scale * Number($elmt.css('top').replace('px', ''));
+ var bottom = top + scale * $elmt.height();
+ var left = scale * Number($elmt.css('left').replace('px', '')) + bodyLeft;
+ var right = left + scale * $elmt.width();
+
+ var doHorizontalMove = left < docLeft || right > docRight;
+ var doVerticalMove = top < docTop || bottom > docBottom;
+ var padding = scale * 50;
+
+ var newScrollLeft = 0
+ if (left < docLeft) {
+ newScrollLeft = left - padding;
+ } else if (right > docRight) {
+ newScrollLeft = right + padding - winWidth;
+ }
+
+ var newScrollTop = 0
+ if (top < docTop) {
+ newScrollTop = top - padding;
+ } else if (bottom > docBottom) {
+ newScrollTop = bottom + padding - winHeight;
+ }
+
+ // Device Frame or Scale to width or Scale to fit (situations where there is no horizontal scroll)
+ if (view.h || view.scaleVal == 1 || view.scaleVal == 2) {
+ doHorizontalMove = false;
+ }
+
+ // Has Device Frame or Scale to Width and widget with note is outside of viewable panel right bounds
+ if ((view.scaleVal == 1 || view.h) && (left > docRight)) {
+ doVerticalMove = false;
+ }
+
+ // TODO: need to do something for dynamic panel with scroll
+ if (doHorizontalMove && doVerticalMove) {
+ $("html, body").animate({ scrollLeft: newScrollLeft, scrollTop: newScrollTop }, 300);
+ } else if (doHorizontalMove) {
+ $("html, body").animate({ scrollLeft: newScrollLeft }, 300);
+ } else if (doVerticalMove) {
+ $("html, body").animate({ scrollTop: newScrollTop }, 300);
+ }
+ }
+
+ var highlightEnabled = false;
+ $ax.messageCenter.addMessageListener(function(message, data) {
+ if(message == 'highlightInteractive') {
+ highlightEnabled = data == true;
+ _applyHighlight($ax('*'));
+ }
+ });
+
+ var _applyHighlight = $ax.applyHighlight = function(query, ignoreUnset) {
+ if(ignoreUnset && !highlightEnabled) return;
+
+ var pulsateClassName = 'legacyPulsateBorder';
+ //Determine if the widget has a defined userTriggeredEventName specified in the array above
+ var _isInteractive = function(diagramObject) {
+ if(diagramObject && diagramObject.interactionMap) {
+ for(var index in userTriggeredEventNames) {
+ if(diagramObject.interactionMap[userTriggeredEventNames[index]]) return true;
+ }
+ }
+ return false;
+ };
+
+ //Traverse through parent layers (if any) of an element and see if any have a defined userTriggeredEventName
+ var _findMatchInParent = function(id) {
+ var parents = $ax('#' + id).getParents(true, ['layer'])[0];
+ for(var i in parents) {
+ var parentId = parents[i];
+ var parentObj = $ax.getObjectFromScriptId(parentId);
+ if(_isInteractive(parentObj)) return true;
+ }
+ return false;
+ };
+
+ //Find all widgets with a defined userTriggeredEventName specified in the array above
+ var $matchingElements = query.filter(function (obj, id) {
+
+ //This prevents the top left corner of the page from highlighting with everything else
+ if($ax.public.fn.IsLayer(obj.type)) return false;
+
+ if(_isInteractive(obj)) return true;
+ else if($ax.public.fn.IsVector(obj.type) && obj.referencePageUrl) return true;
+
+ //Last check on the object's parent layer(s), if a layer has a defined userTriggeredEventName
+ //then we shall highlight each member of that layer TODO This is a design decision and is subject to change
+ return _findMatchInParent(id);
+ }).$();
+
+ var isHighlighted = $matchingElements.is('.' + pulsateClassName);
+
+ //Toggle the pulsate class on the matched elements
+ if(highlightEnabled && !isHighlighted) {
+ $matchingElements.addClass(pulsateClassName);
+ } else if(!highlightEnabled && isHighlighted) {
+ $matchingElements.removeClass(pulsateClassName);
+ }
+ };
+
+ var getElementsFromPoint = function (x, y) {
+ var elementsFromPointFn = document.elementsFromPoint || document.msElementsFromPoint;
+ if (typeof elementsFromPointFn === "function") {
+ return elementsFromPointFn.bind(document)(x, y);
+ }
+ return [];
+ }
+
+ $axure.getIdAndRectAtLoc = function (data) {
+ var element = document.elementFromPoint(data.x, data.y);
+ if (!element) return undefined;
+
+ var jObj = _getElementIdFromTarget(element);
+ if (jObj.length > 0) {
+ var id = jObj.attr('id');
+ var axObj = $ax('#' + id);
+ var rect = axObj.pageBoundingRect();
+ return { 'id': id, 'rect': rect };
+ }
+ return undefined;
+ }
+
+ $axure.getListOfIdAndRectAtLoc = function (data) {
+ var domElements = getElementsFromPoint(data.x, data.y);
+
+ if (!domElements || !domElements.length) return [];
+
+ const elements = [];
+
+ domElements.forEach(function (domElement) {
+ var jObj = _getElementIdFromTarget(domElement);
+ if (jObj.length > 0) {
+ var id = jObj.attr('id');
+ var axObj = $ax('#' + id);
+ var rect = axObj.pageBoundingRect();
+ if (elements.findIndex(function (x) { return x.id === id }) < 0) {
+ elements.push( { 'id': id, 'rect': rect } );
+ }
+ }
+ });
+
+ return elements;
+ }
+
+ $axure.getIdRectAndStyleAtLoc = function(data) {
+ var element = document.elementFromPoint(data.x, data.y);
+ if (!element) return undefined;
+
+ var jObj = _getElementIdFromTarget(element);
+ if (jObj.length > 0) {
+ var id = jObj.attr('id');
+ return $axure.getRectAndStyleById(id);
+ }
+ return undefined;
+ }
+
+ $axure.getListOfIdRectAndStyleAtLoc = function(data) {
+ var domElements = getElementsFromPoint(data.x, data.y);
+
+ if (!domElements || !domElements.length) return [];
+
+ const elements = [];
+
+ domElements.forEach(function (domElement) {
+ var jObj = _getElementIdFromTarget(domElement);
+ if (jObj.length > 0) {
+ var id = jObj.attr('id');
+ if (elements.findIndex(function (x) { return x.id === id }) < 0) {
+ elements.push($axure.getRectAndStyleById(id));
+ }
+ }
+ });
+
+ return elements;
+ }
+
+ $axure.getRectAndStyleById = function (id) {
+ var axObj = $ax('#' + id);
+ var rect = axObj.pageBoundingRect();
+ var style = $ax.style.computeFullStyle(id, $ax.style.generateState(id), $ax.adaptive.currentViewId);
+ style.text = axObj.text();
+ return { 'id': id, 'rect': rect, 'style': style };
+ }
+
+ $axure.isIdVisible = function (id) {
+ return id ? $ax.visibility.IsIdVisible(id) : false;
+ }
+
+ $axure.getParentElementById = function (elementId) {
+ if (!elementId) return undefined;
+ var parentId = $ax.getLayerParentFromElementId(elementId);
+ if (!parentId) {
+ return undefined;
+ }
+ return $axure.getRectAndStyleById(parentId);
+ }
+
+ var _getElementIdFromTarget = function (target) {
+ var targetId = target.id;
+ var jTarget = $(target);
+ while((!targetId || targetId.indexOf('cache') > -1) && jTarget[0].tagName != 'HTML') {
+ jTarget = jTarget.parent();
+ targetId = jTarget.attr('id');
+ }
+ if(targetId && targetId != 'base') {
+ var sections = targetId.split('_');
+ return $('#' + sections[0]);
+ }
+ return '';
+ }
+
+});
\ No newline at end of file
diff --git a/src/原型系统/resources/scripts/axure/visibility.js b/src/原型系统/resources/scripts/axure/visibility.js
new file mode 100644
index 0000000..4c234bc
--- /dev/null
+++ b/src/原型系统/resources/scripts/axure/visibility.js
@@ -0,0 +1,1291 @@
+$axure.internal(function($ax) {
+ var document = window.document;
+ var _visibility = {};
+ $ax.visibility = _visibility;
+
+ var _defaultHidden = {};
+ var _defaultLimbo = {};
+
+ // ****************** Visibility and State Functions ****************** //
+
+ var _isIdVisible = $ax.visibility.IsIdVisible = function(id) {
+ return $ax.visibility.IsVisible(window.document.getElementById(id));
+ };
+
+ $ax.visibility.IsVisible = function(element) {
+ //cannot use css('visibility') because that gets the effective visiblity
+ //e.g. won't be able to set visibility on panels inside hidden panels
+ return element.style.visibility != 'hidden';
+ };
+
+ $ax.visibility.SetIdVisible = function(id, visible) {
+ $ax.visibility.SetVisible(window.document.getElementById(id), visible);
+ // Hide lightbox if necessary
+ if(!visible) {
+ $jobj($ax.repeater.applySuffixToElementId(id, '_lightbox')).remove();
+ $ax.flyoutManager.unregisterPanel(id, true);
+ }
+ };
+
+ var _setAllVisible = function(query, visible) {
+ for(var i = 0; i < query.length; i++) {
+ _visibility.SetVisible(query[i], visible);
+ }
+ }
+
+ $ax.visibility.SetVisible = function (element, visible) {
+ //not setting display to none to optimize measuring
+ if(visible) {
+ if($(element).hasClass(HIDDEN_CLASS)) $(element).removeClass(HIDDEN_CLASS);
+ if($(element).hasClass(UNPLACED_CLASS)) $(element).removeClass(UNPLACED_CLASS);
+ element.style.display = '';
+ element.style.visibility = 'inherit';
+ } else {
+ element.style.display = 'none';
+ element.style.visibility = 'hidden';
+ }
+ };
+
+ var _setWidgetVisibility = $ax.visibility.SetWidgetVisibility = function (elementId, options) {
+ var visible = $ax.visibility.IsIdVisible(elementId);
+ // If limboed, just fire the next action then leave.
+ if(visible == options.value || _limboIds[elementId]) {
+ if(!_limboIds[elementId]) options.onComplete && options.onComplete();
+ $ax.action.fireAnimationFromQueue(elementId, $ax.action.queueTypes.fade);
+ return;
+ }
+
+ options.containInner = true;
+ var query = $jobj(elementId);
+ var parentId = query.parent().attr('id');
+ var axObj = $obj(elementId);
+ var preserveScroll = false;
+ var isPanel = $ax.public.fn.IsDynamicPanel(axObj.type);
+ var isLayer = $ax.public.fn.IsLayer(axObj.type);
+ if(!options.noContainer && (isPanel || isLayer)) {
+ //if dp has scrollbar, save its scroll position
+ if(isPanel && axObj.scrollbars != 'none') {
+ var shownState = $ax.dynamicPanelManager.getShownState(elementId);
+ preserveScroll = true;
+ //before hiding, try to save scroll location
+ if(!options.value && shownState) {
+ DPStateAndScroll[elementId] = {
+ shownId: shownState.attr('id'),
+ left: shownState.scrollLeft(),
+ top: shownState.scrollTop()
+ }
+ }
+ }
+
+ _pushContainer(elementId, isPanel);
+ if(isPanel && !options.value) _tryResumeScrollForDP(elementId);
+ var complete = options.onComplete;
+ options.onComplete = function () {
+ if(complete) complete();
+ _popContainer(elementId, isPanel);
+ //using containers stops mouseleave from firing on IE/Edge and FireFox
+ if(!options.value && $ax.event.mouseOverObjectId && (FIREFOX || $axure.browser.isEdge || IE)) {
+ var mouseOveredElement = $('#' + $ax.event.mouseOverObjectId);
+ if(mouseOveredElement && !mouseOveredElement.is(":visible")) {
+ var axObj = $obj($ax.event.mouseOverObjectId);
+
+ if(($ax.public.fn.IsDynamicPanel(axObj.type) || $ax.public.fn.IsLayer(axObj.type)) && axObj.propagate) {
+ mouseOveredElement.trigger('mouseleave');
+ } else mouseOveredElement.trigger('mouseleave.ixStyle');
+ }
+ }
+ //after showing dp, restore the scoll position
+ if(isPanel && options.value) _tryResumeScrollForDP(elementId, true);
+ }
+ options.containerExists = true;
+ }
+ _setVisibility(parentId, elementId, options, preserveScroll);
+
+ //set the visibility of the annotation box as well if it exists
+ var ann = document.getElementById(elementId + "_ann");
+ if(ann) _visibility.SetVisible(ann, options.value);
+
+ //set ref visibility for ref of flow shape, if that exists
+ var ref = document.getElementById(elementId + '_ref');
+ if(ref) _visibility.SetVisible(ref, options.value);
+ };
+
+ var _setVisibility = function(parentId, childId, options, preserveScroll) {
+ var wrapped = $jobj(childId);
+ var completeTotal = 1;
+ var visible = $ax.visibility.IsIdVisible(childId);
+
+ if(visible == options.value) {
+ options.onComplete && options.onComplete();
+ $ax.action.fireAnimationFromQueue(childId, $ax.action.queueTypes.fade);
+ return;
+ }
+
+ var child = $jobj(childId);
+ var size = options.size || (options.containerExists ? $(child.children()[0]) : child);
+
+ var isIdFitToContent = $ax.dynamicPanelManager.isIdFitToContent(parentId);
+ //fade and resize won't work together when there is a container... but we still needs the container for fit to content DPs
+ var needContainer = options.easing && options.easing != 'none' && (options.easing != 'fade' || isIdFitToContent);
+ var cullPosition = options.cull ? options.cull.css('position') : '';
+ var containerExists = options.containerExists;
+
+ var isFullWidth = $ax.dynamicPanelManager.isPercentWidthPanel($obj(childId));
+
+ // If fixed fit to content panel, then we must set size on it. It will be size of 0 otherwise, because container in it is absolute position.
+ var needSetSize = false;
+ var sizeObj = {};
+ if(needContainer) {
+ var sizeId = '';
+ if($ax.dynamicPanelManager.isIdFitToContent(childId)) sizeId = childId;
+ else {
+ var panelId = $ax.repeater.removeSuffixFromElementId(childId);
+ if($ax.dynamicPanelManager.isIdFitToContent(panelId)) sizeId = panelId;
+ }
+
+ if(sizeId) {
+ needSetSize = true;
+
+ sizeObj = $jobj(sizeId);
+ var newSize = options.cull || sizeObj;
+ var newAxSize = $ax('#' + newSize.attr('id'));
+ sizeObj.width(newAxSize.width());
+ sizeObj.height(newAxSize.height());
+ }
+ }
+
+ var wrappedOffset = { left: 0, top: 0 };
+ var visibleWrapped = wrapped;
+ if(needContainer) {
+ var childObj = $obj(childId);
+ if (options.cull) {
+ var axCull = $ax('#' + options.cull.attr('id'));
+ var containerWidth = axCull.width();
+ var containerHeight = axCull.height();
+ } else {
+ if (childObj && ($ax.public.fn.IsLayer(childObj.type))) {// || childObj.generateCompound)) {
+ var boundingRectangle = $ax('#' + childId).offsetBoundingRect();
+ //var boundingRectangle = $ax.public.fn.getWidgetBoundingRect(childId);
+ wrappedOffset.left = boundingRectangle.left;
+ wrappedOffset.top = boundingRectangle.top;
+ containerWidth = boundingRectangle.width;
+ containerHeight = boundingRectangle.height;
+ } else if (childObj && childObj.generateCompound) {
+ var image = $jobj(childId + '_img');
+ containerWidth = $ax.getNumFromPx(image.css('width'));
+ containerHeight = $ax.getNumFromPx(image.css('height'));
+ wrappedOffset.left = $ax.getNumFromPx(image.css('left'));
+ wrappedOffset.top = $ax.getNumFromPx(image.css('top'));
+ } else {
+ containerWidth = $ax('#' + childId).width();
+ containerHeight = $ax('#' + childId).height();
+ }
+ }
+
+ var containerId = $ax.visibility.applyWidgetContainer(childId);
+// var container = _makeContainer(containerId, options.cull || boundingRectangle, isFullWidth, options.easing == 'flip', wrappedOffset, options.containerExists);
+ var container = _makeContainer(containerId, containerWidth, containerHeight, isFullWidth, options.easing == 'flip', wrappedOffset, options.containerExists);
+
+ if(options.containInner) {
+ wrapped = _wrappedChildren(containerExists ? $(child.children()[0]) : child);
+
+ // Filter for visibile wrapped children
+ visibleWrapped = [];
+ for (var i = 0; i < wrapped.length; i++) if($ax.visibility.IsVisible(wrapped[i])) visibleWrapped.push(wrapped[i]);
+ visibleWrapped = $(visibleWrapped);
+
+ completeTotal = visibleWrapped.length;
+ if(!containerExists) container.prependTo(child);
+
+ // Offset items if necessary
+ if(!containerExists && (wrappedOffset.left != 0 || wrappedOffset.top != 0)) {
+ for(var i = 0; i < wrapped.length; i++) {
+ var inner = $(wrapped[i]);
+ inner.css('left', $ax.getNumFromPx(inner.css('left')) - wrappedOffset.left);
+ inner.css('top', $ax.getNumFromPx(inner.css('top')) - wrappedOffset.top);
+ // Parent layer is now size 0, so have to have to use conatiner since it's the real size.
+ // Should we use container all the time? This may make things easier for fit panels too.
+ size = container;
+ }
+ }
+ } else if(!containerExists) container.insertBefore(child);
+ if(!containerExists) wrapped.appendTo(container);
+
+ if (options.value && options.containInner) {
+ //has to set children first because flip to show needs children invisible
+ _setAllVisible(visibleWrapped, false);
+ //_updateChildAlignment(childId);
+ _setAllVisible(child, true);
+ }
+ }
+
+ var completeCount = 0;
+ var onComplete = function () {
+ completeCount++;
+ if (needContainer && completeCount == completeTotal) {
+ if ($ax.public.fn.isCompoundVectorHtml(container.parent()[0])) {
+ wrappedOffset.left = $ax.getNumFromPx(container.css('left'));
+ wrappedOffset.top = $ax.getNumFromPx(container.css('top'));
+ }
+
+ if (options.containInner && !containerExists) {
+ if (wrappedOffset.left != 0 || wrappedOffset.top != 0) {
+ for (i = 0; i < wrapped.length; i++) {
+ inner = $(wrapped[i]);
+ if (!inner.hasClass('text')) {
+ inner.css('left', $ax.getNumFromPx(inner.css('left')) + wrappedOffset.left);
+ inner.css('top', $ax.getNumFromPx(inner.css('top')) + wrappedOffset.top);
+ }
+ }
+ }
+
+ wrapped.filter('.text').css({ 'left': '', 'top': '' });
+ }
+
+ if(options.containInner && !options.value) {
+ _setAllVisible(child, false);
+ _setAllVisible(visibleWrapped, true);
+ }
+
+ if(containerExists) {
+ if(!options.settingChild) container.css('position', 'relative;');
+ } else {
+ wrapped.insertBefore(container);
+ container.remove();
+ }
+
+ if(childObj && $ax.public.fn.IsDynamicPanel(childObj.type) && window.modifiedDynamicPanleParentOverflowProp) {
+ child.css('overflow', 'hidden');
+ window.modifiedDynamicPanleParentOverflowProp = false;
+ }
+ }
+
+ //if(options.value) _updateChildAlignment(childId);
+
+ if(!needContainer || completeTotal == completeCount) {
+ if(options.cull) options.cull.css('position', cullPosition);
+
+ if(needSetSize) {
+ sizeObj.css('width', 'auto');
+ sizeObj.css('height', 'auto');
+ }
+
+ options.onComplete && options.onComplete();
+
+ if(options.fire) {
+ $ax.event.raiseSyntheticEvent(childId, options.value ? 'onShow' : 'onHide');
+ $ax.action.fireAnimationFromQueue(childId, $ax.action.queueTypes.fade);
+ }
+ }
+ };
+
+ // Nothing actually being animated, all wrapped elements invisible
+ if(!visibleWrapped.length) {
+ if(!options.easing || options.easing == 'none') {
+ $ax.visibility.SetIdVisible(childId, options.value);
+ completeTotal = 1;
+ onComplete();
+ } else {
+ window.setTimeout(function() {
+ completeCount = completeTotal - 1;
+ onComplete();
+ },options.duration);
+ }
+
+ return;
+ }
+
+ if(!options.easing || options.easing == 'none') {
+ $ax.visibility.SetIdVisible(childId, options.value);
+ completeTotal = 1;
+ onComplete();
+ } else if(options.easing == 'fade') {
+ if(options.value) {
+ if(preserveScroll) {
+ visibleWrapped.css('opacity', 0);
+ visibleWrapped.css('visibility', 'inherit');
+ visibleWrapped.css('display', 'block');
+ //was hoping we could just use fadein here, but need to set display before set scroll position
+ _tryResumeScrollForDP(childId);
+ visibleWrapped.animate({ opacity: 1 }, {
+ duration: options.duration,
+ easing: 'swing',
+ queue: false,
+ complete: function() {
+ $ax.visibility.SetIdVisible(childId, true);
+ visibleWrapped.css('opacity', '');
+ onComplete();
+ }
+ });
+ } else {
+ // Can't use $ax.visibility.SetIdVisible, because we only want to set visible, we don't want to set display, fadeIn will handle that.
+ visibleWrapped.css('visibility', 'inherit');
+ visibleWrapped.fadeIn({
+ queue: false,
+ duration: options.duration,
+ complete: onComplete
+ });
+ }
+ } else {
+ // Fading here is being strange...
+ visibleWrapped.animate({ opacity: 0 }, { duration: options.duration, easing: 'swing', queue: false, complete: function() {
+ $ax.visibility.SetIdVisible(childId, false);
+ visibleWrapped.css('opacity', '');
+
+ onComplete();
+ }});
+ }
+ } else if (options.easing == 'flip') {
+ //this container will hold
+ var trapScroll = _trapScrollLoc(childId);
+ var innerContainer = $('
');
+ innerContainer.attr('id', containerId + "_inner");
+ innerContainer.data('flip', options.direction == 'left' || options.direction == 'right' ? 'y' : 'x');
+ innerContainer.css({
+ position: 'relative',
+ 'width': containerWidth,
+ 'height': containerHeight,
+ 'display': 'flex'
+ });
+
+ innerContainer.appendTo(container);
+ wrapped.appendTo(innerContainer);
+
+ if(childObj && $ax.public.fn.IsDynamicPanel(childObj.type)) var containerDiv = child;
+ else containerDiv = parentId ? $jobj(parentId) : child.parent();
+
+ completeTotal = 1;
+ var flipdegree;
+
+ var originForFlip = containerWidth / 2 + 'px ' + containerHeight / 2 + 'px';
+ if (options.value) {
+ innerContainer.css({
+ '-webkit-transform-origin': originForFlip,
+ '-ms-transform-origin': originForFlip,
+ 'transform-origin': originForFlip,
+ });
+
+ //options.value == true means in or show, note to get here, the element must be currently hidden to show,
+ // we need to first flip it +/- 90deg without animation (180 if we want to show the back of the flip)
+ switch(options.direction) {
+ case 'right':
+ case 'left':
+ _setRotateTransformation(innerContainer, _getRotateString(true, options.direction === 'right', options.showFlipBack));
+ flipdegree = 'rotateY(0deg)';
+ break;
+ case 'up':
+ case 'down':
+ _setRotateTransformation(innerContainer, _getRotateString(false, options.direction === 'up', options.showFlipBack));
+ flipdegree = 'rotateX(0deg)';
+ break;
+ }
+
+ var onFlipShowComplete = function() {
+ var trapScroll = _trapScrollLoc(childId);
+ $ax.visibility.SetIdVisible(childId, true);
+
+ wrapped.insertBefore(innerContainer);
+ innerContainer.remove();
+ trapScroll();
+
+ onComplete();
+ };
+
+ innerContainer.css({
+ '-webkit-backface-visibility': 'hidden',
+ 'backface-visibility': 'hidden'
+ });
+
+ child.css({
+ 'display': '',
+ 'visibility': 'inherit'
+ });
+
+ visibleWrapped.css({
+ 'display': '',
+ 'visibility': 'inherit'
+ });
+
+ innerContainer.css({
+ '-webkit-transition-duration': options.duration + 'ms',
+ 'transition-duration': options.duration + 'ms'
+ });
+
+ if(preserveScroll) _tryResumeScrollForDP(childId);
+ _setRotateTransformation(innerContainer, flipdegree, containerDiv, onFlipShowComplete, options.duration, true);
+ } else { //hide or out
+ innerContainer.css({
+ '-webkit-transform-origin': originForFlip,
+ '-ms-transform-origin': originForFlip,
+ 'transform-origin': originForFlip,
+ });
+ switch(options.direction) {
+ case 'right':
+ case 'left':
+ flipdegree = _getRotateString(true, options.direction !== 'right', options.showFlipBack);
+ break;
+ case 'up':
+ case 'down':
+ flipdegree = _getRotateString(false, options.direction !== 'up', options.showFlipBack);
+ break;
+ }
+
+ var onFlipHideComplete = function() {
+ var trapScroll = _trapScrollLoc(childId);
+ wrapped.insertBefore(innerContainer);
+ $ax.visibility.SetIdVisible(childId, false);
+
+ innerContainer.remove();
+ trapScroll();
+
+ onComplete();
+ };
+
+ innerContainer.css({
+ '-webkit-backface-visibility': 'hidden',
+ 'backface-visibility': 'hidden',
+ '-webkit-transition-duration': options.duration + 'ms',
+ 'transition-duration': options.duration + 'ms'
+ });
+
+ if(preserveScroll) _tryResumeScrollForDP(childId);
+ _setRotateTransformation(innerContainer, flipdegree, containerDiv, onFlipHideComplete, options.duration, true);
+ }
+
+ trapScroll();
+ } else {
+ // Because the move is gonna fire on annotation and ref too, need to update complete total
+ completeTotal = $addAll(visibleWrapped, childId).length;
+ if(options.value) {
+ _slideStateIn(childId, childId, options, size, false, onComplete, visibleWrapped, preserveScroll);
+ } else {
+ var tops = [];
+ var lefts = [];
+ for(var i = 0; i < visibleWrapped.length; i++) {
+ var currWrapped = $(visibleWrapped[i]);
+
+ tops.push(fixAuto(currWrapped, 'top'));
+ lefts.push(fixAuto(currWrapped, 'left'));
+ }
+
+ var onOutComplete = function () {
+ //bring back SetIdVisible on childId for hiding lightbox
+ $ax.visibility.SetIdVisible(childId, false);
+ for(i = 0; i < visibleWrapped.length; i++) {
+ currWrapped = $(visibleWrapped[i]);
+ $ax.visibility.SetVisible(currWrapped[0], false);
+ currWrapped.css('top', tops[i]);
+ currWrapped.css('left', lefts[i]);
+ }
+ onComplete();
+ };
+ _slideStateOut(size, childId, options, onOutComplete, visibleWrapped);
+ }
+ }
+
+ // If showing, go through all rich text objects inside you, and try to redo alignment of them
+ //if(options.value && !options.containInner) {
+ // _updateChildAlignment(childId);
+ //}
+ };
+
+ // IE/Safari are giving auto here instead of calculating to for us. May need to calculate this eventually, but for now we can assume auto === 0px for the edge case found
+ var fixAuto = function (jobj, prop) {
+ var val = jobj.css(prop);
+ return val == 'auto' ? '0px' : val;
+ };
+
+ var _getRotateString = function (y, neg, showFlipBack) {
+ // y means flip on y axis, or left/right, neg means flipping it left/down, and show back is for set panel state
+ // and will show the back of the widget (transparent) for the first half of a show, or second half of a hide.
+ return 'rotate' + (y ? 'Y' : 'X') + '(' + (neg ? '-' : '') + (showFlipBack ? 180 : IE ? 91 : 90) + 'deg)';
+ }
+
+ //var _updateChildAlignment = function(childId) {
+ // var descendants = $jobj(childId).find('.text');
+ // for(var i = 0; i < descendants.length; i++) $ax.style.updateTextAlignmentForVisibility(descendants[i].id);
+ //};
+ var _wrappedChildren = function (child) {
+ return child.children();
+ //var children = child.children();
+ //var valid = [];
+ //for(var i = 0; i < children.length; i++) if($ax.visibility.IsVisible(children[i])) valid.push(children[i]);
+ //return $(valid);
+ };
+
+ var requestAnimationFrame = window.requestAnimationFrame ||
+ window.webkitRequestAnimationFrame ||
+ window.mozRequestAnimationFrame || window.msRequestAnimationFrame ||
+ function (callback) {
+ window.setTimeout(callback, 1000 / 60);
+ };
+
+ var _setRotateTransformation = function(elementsToSet, transformValue, elementParent, flipCompleteCallback, flipDurationMs, useAnimationFrame) {
+ if(flipCompleteCallback) {
+ //here we didn't use 'transitionend' event to fire callback
+ //when show/hide on one element, changing transition property will stop the event from firing
+ window.setTimeout(flipCompleteCallback, flipDurationMs);
+ }
+
+ var trasformCss = {
+ '-webkit-transform': transformValue,
+ '-moz-transform': transformValue,
+ '-ms-transform': transformValue,
+ '-o-transform': transformValue,
+ 'transform': transformValue
+ };
+
+ if(useAnimationFrame) {
+ if(FIREFOX || CHROME) $('body').hide().show(0); //forces FF to render the animation
+ requestAnimationFrame(function() {
+ elementsToSet.css(trasformCss);
+ });
+ } else elementsToSet.css(trasformCss);
+
+ //when deal with dynamic panel, we need to set it's parent's overflow to visible to have the 3d effect
+ //NOTE: we need to set this back when both flips finishes in DP, to prevents one animation finished first and set this back
+ if(elementParent && elementParent.css('overflow') === 'hidden') {
+ elementParent.css('overflow', 'visible');
+ window.modifiedDynamicPanleParentOverflowProp = true;
+ }
+ };
+
+ $ax.visibility.GetPanelState = function(id) {
+ var children = $ax.visibility.getRealChildren($jobj(id).children());
+ for(var i = 0; i < children.length; i++) {
+ if(children[i].style && $ax.visibility.IsVisible(children[i])) return children[i].id;
+ }
+ return '';
+ };
+
+ var containerCount = {};
+ $ax.visibility.SetPanelState = function(id, stateId, easingOut, directionOut, durationOut, easingIn, directionIn, durationIn, showWhenSet) {
+ var show = !$ax.visibility.IsIdVisible(id) && showWhenSet;
+ if(show) $ax.visibility.SetIdVisible(id, true);
+
+ // Exit here if already at desired state.
+ if($ax.visibility.IsIdVisible(stateId)) {
+ if(show) {
+ $ax.event.raiseSyntheticEvent(id, 'onShow');
+ // If showing size changes and need to update parent panels
+ $ax.dynamicPanelManager.fitParentPanel(id);
+ }
+
+ $ax.action.fireAnimationFromQueue(id, $ax.action.queueTypes.setState);
+ return;
+ }
+
+ var hasEasing = easingIn != 'none' || easingOut != 'none';
+ if(hasEasing) _pushContainer(id, true);
+
+ var state = $jobj(stateId);
+ var oldStateId = $ax.visibility.GetPanelState(id);
+ var oldState = $jobj(oldStateId);
+
+ var isFixed = $jobj(id).css('position') == 'fixed';
+ //pin to browser
+ if(isFixed) $ax.dynamicPanelManager.adjustFixed(id, oldState.width(), oldState.height(), state.width(), state.height());
+
+ _bringPanelStateToFront(id, stateId, oldStateId, easingIn == 'none' || durationIn == '0');
+
+ var fitToContent = $ax.dynamicPanelManager.isIdFitToContent(id);
+ var resized = false;
+ if(fitToContent) {
+ // Set resized
+ //var width = state.width();
+ //var height = state.height();
+ var newBoundingRect = $ax('#' + stateId).childrenBoundingRect();
+ var width = newBoundingRect.right;
+ var height = newBoundingRect.bottom;
+ var oldBoundingRect = $ax('#' + id).size();
+ var oldWidth = oldBoundingRect.right;
+ var oldHeight = oldBoundingRect.bottom;
+ resized = width != oldWidth || height != oldHeight;
+ //resized = width != oldState.width() || height != oldState.height();
+
+ $ax.visibility.setResizedSize(id, $obj(id).percentWidth ? oldWidth : width, height);
+ }
+
+ //edge case for sliding
+ var movement = (directionOut == 'left' || directionOut == 'up' || state.children().length == 0) && oldState.children().length != 0 ? oldState : state;
+ var onCompleteCount = 0;
+ var onComplete = function () {
+ //move this call from _setVisibility() for animate out.
+ //Because this will make the order of dp divs consistence: the showing panel is always in front after both animation finished
+ //tested in the cases where one panel is out/show slower/faster/same time/instantly.
+ _bringPanelStateToFront(id, stateId, oldStateId, false);
+
+ if (window.modifiedDynamicPanleParentOverflowProp) {
+ var parent = id ? $jobj(id) : child.parent();
+ parent.css('overflow', 'hidden');
+ window.modifiedDynamicPanleParentOverflowProp = false;
+ }
+
+ $ax.dynamicPanelManager.fitParentPanel(id);
+ $ax.dynamicPanelManager.updatePanelPercentWidth(id);
+ $ax.dynamicPanelManager.updatePanelContentPercentWidth(id);
+ $ax.action.fireAnimationFromQueue(id, $ax.action.queueTypes.setState);
+ $ax.event.raiseSyntheticEvent(id, "onPanelStateChange");
+ $ax.event.leavingState(oldStateId);
+ if (hasEasing) _popContainer(id, true);
+
+ $ax.dynamicPanelManager.updateMobileScroll(id, stateId);
+ };
+ // Must do state out first, so if we cull by new state, location is correct
+ _setVisibility(id, oldStateId, {
+ value: false,
+ easing: easingOut,
+ direction: directionOut,
+ duration: durationOut,
+ containerExists: true,
+ onComplete: function() {
+// if(easingIn !== 'flip') _bringPanelStateToFront(id, stateId);
+ if (++onCompleteCount == 2) onComplete();
+ },
+ settingChild: true,
+ size: movement,
+ //cull for
+ cull: easingOut == 'none' || state.children().length == 0 ? oldState : state,
+ showFlipBack: true
+ });
+
+ _setVisibility(id, stateId, {
+ value: true,
+ easing: easingIn,
+ direction: directionIn,
+ duration: durationIn,
+ containerExists: true,
+ onComplete: function () {
+// if (easingIn === 'flip') _bringPanelStateToFront(id, stateId);
+ if (++onCompleteCount == 2) onComplete();
+ },
+ settingChild: true,
+ //size for offset
+ size: movement,
+ showFlipBack: true
+ });
+
+ if(show) $ax.event.raiseSyntheticEvent(id, 'onShow');
+ if(resized) $ax.event.raiseSyntheticEvent(id, 'onResize');
+ };
+
+ var containedFixed = {};
+ var _pushContainer = _visibility.pushContainer = function(id, panel) {
+ var count = containerCount[id];
+ if(count) containerCount[id] = count + 1;
+ else {
+ var trapScroll = _trapScrollLoc(id);
+ var jobj = $jobj(id);
+ var children = jobj.children();
+ var css = {
+ position: 'relative',
+ top: 0,
+ left: 0
+ };
+
+ if(!panel) {
+ var boundingRect = $ax('#' + id).offsetBoundingRect();
+ //var boundingRect = $axure.fn.getWidgetBoundingRect(id);
+ css.top = boundingRect.top;
+ css.left = boundingRect.left;
+ }
+
+ var container = $('
');
+ container.attr('id', ''); // Placeholder id, so we won't try to recurse the container until it is ready
+ container.css(css);
+ //container.append(jobj.children());
+ jobj.append(container);
+ containerCount[id] = 1;
+
+ // Panel needs to wrap children
+ if(panel) {
+ for(var i = 0; i < children.length; i++) {
+ var child = $(children[i]);
+ var childContainer = $('
');
+ childContainer.attr('id', $ax.visibility.applyWidgetContainer(child.attr('id')));
+ childContainer.css(css);
+ child.after(childContainer);
+ childContainer.append(child);
+ container.append(childContainer);
+ }
+ } else {
+ var focus = _getCurrFocus();
+ if(focus) $ax.event.addSuppressedEvent($ax.repeater.removeSuffixFromElementId(focus), 'OnLostFocus');
+
+ // Layer needs to fix top left
+ var childIds = $ax('#' + id).getChildren()[0].children;
+ for(var i = 0; i < childIds.length; i++) {
+ var childId = childIds[i];
+ var childObj = $jobj(childId);
+ var fixedInfo = $ax.dynamicPanelManager.getFixedInfo(childId);
+ if(fixedInfo.fixed) {
+ var axObj = $ax('#' + childId);
+ var viewportLocation = axObj.viewportLocation();
+ var left = viewportLocation.left;
+ var top = viewportLocation.top;
+ //var left = axObj.left();
+ //var top = axObj.top();
+ containedFixed[childId] = { left: left, top: top, fixed: fixedInfo };
+ childObj.css('left', left);
+ childObj.css('top', top);
+ childObj.css('margin-left', 0);
+ childObj.css('margin-top', 0);
+ childObj.css('right', 'auto');
+ childObj.css('bottom', 'auto');
+ childObj.css('position', 'absolute');
+ }
+ var cssChange = {
+ left: '-=' + css.left,
+ top: '-=' + css.top
+ };
+ if($ax.getTypeFromElementId(childId) == $ax.constants.LAYER_TYPE) {
+ _pushContainer(childId, false);
+ $ax.visibility.applyWidgetContainer(childId, true).css(cssChange);
+ } else {
+ //if ($ax.public.fn.isCompoundVectorHtml(jobj[0])) {
+ // var grandChildren = jobj[0].children;
+ // //while (grandChildren.length > 0 && grandChildren[0].id.indexOf('container') >= 0) grandChildren = grandChildren[0].children;
+
+ // for (var j = 0; j < grandChildren.length; j++) {
+ // var grandChildId = grandChildren[j].id;
+ // if (grandChildId.indexOf(childId + 'p') >= 0 || grandChildId.indexOf('_container') >= 0) $jobj(grandChildId).css(cssChange);
+ // }
+ //} else
+ // Need to include ann and ref in move.
+ childObj = $addAll(childObj, childId);
+ childObj.css(cssChange);
+ }
+
+ container.append(childObj);
+ }
+ _setCurrFocus(focus);
+ }
+ container.attr('id', $ax.visibility.applyWidgetContainer(id)); // Setting the correct final id for the container
+ trapScroll();
+ }
+ };
+
+ var _popContainer = _visibility.popContainer = function (id, panel) {
+ var count = containerCount[id];
+ if(!count) return;
+ count--;
+ containerCount[id] = count;
+ if(count != 0) return;
+
+ var trapScroll = _trapScrollLoc(id);
+
+ var jobj = $jobj(id);
+ var container = $ax.visibility.applyWidgetContainer(id, true);
+
+ // If layer is at bottom or right of page, unwrapping could change scroll by temporarily reducting page size.
+ // To avoid this, we let container persist on page, with the size it is at this point, and don't remove container completely
+ // until the children are back to their proper locations.
+ var size = $ax('#' + id).size();
+ container.css('width', size.width);
+ container.css('height', size.height);
+ var focus = _getCurrFocus();
+ if(focus) $ax.event.addSuppressedEvent($ax.repeater.removeSuffixFromElementId(focus), 'OnLostFocus');
+ jobj.append(container.children());
+ _setCurrFocus(focus);
+ $('body').first().append(container);
+
+ // Layer doesn't have children containers to clean up
+ if(panel) {
+ var children = jobj.children();
+ for(var i = 0; i < children.length; i++) {
+ var childContainer = $(children[i]);
+ var child = $(childContainer.children()[0]);
+ childContainer.after(child);
+ childContainer.remove();
+ }
+ } else {
+ var left = container.css('left');
+ var top = container.css('top');
+ var childIds = $ax('#' + id).getChildren()[0].children;
+ for (var i = 0; i < childIds.length; i++) {
+ var childId = childIds[i];
+ var cssChange = {
+ left: '+=' + left,
+ top: '+=' + top
+ };
+ if($ax.getTypeFromElementId(childId) == $ax.constants.LAYER_TYPE) {
+ $ax.visibility.applyWidgetContainer(childId, true).css(cssChange);
+ _popContainer(childId, false);
+ } else {
+ var childObj = $jobj(childId);
+ // if ($ax.public.fn.isCompoundVectorHtml(jobj[0])) {
+ // var grandChildren = jobj[0].children;
+ // //while (grandChildren.length > 0 && grandChildren[0].id.indexOf('container') >= 0) grandChildren = grandChildren[0].children;
+ // for (var j = 0; j < grandChildren.length; j++) {
+ // var grandChildId = grandChildren[j].id;
+ // if (grandChildId.indexOf(childId + 'p') >= 0 || grandChildId.indexOf('_container') >= 0) $jobj(grandChildId).css(cssChange);
+ // }
+ //} else
+
+ var allObjs = $addAll(childObj, childId); // Just include other objects for initial css. Fixed panels need to be dealt with separately.
+ allObjs.css(cssChange);
+
+ var fixedInfo = containedFixed[childId];
+ if(fixedInfo) {
+ delete containedFixed[childId];
+
+ childObj.css('position', 'fixed');
+ var deltaX = $ax.getNumFromPx(childObj.css('left')) - fixedInfo.left;
+ var deltaY = $ax.getNumFromPx(childObj.css('top')) - fixedInfo.top;
+
+ fixedInfo = fixedInfo.fixed;
+ if(fixedInfo.horizontal == 'left') childObj.css('left', fixedInfo.x + deltaX);
+ else if(fixedInfo.horizontal == 'center') {
+ childObj.css('left', '50%');
+ childObj.css('margin-left', fixedInfo.x + deltaX);
+ } else {
+ childObj.css('left', 'auto');
+ childObj.css('right', fixedInfo.x - deltaX);
+ }
+
+ if(fixedInfo.vertical == 'top') childObj.css('top', fixedInfo.y + deltaY);
+ else if(fixedInfo.vertical == 'middle') {
+ childObj.css('top', '50%');
+ childObj.css('margin-top', fixedInfo.y + deltaY);
+ } else {
+ childObj.css('top', 'auto');
+ childObj.css('bottom', fixedInfo.y - deltaY);
+ }
+
+ $ax.dynamicPanelManager.updatePanelPercentWidth(childId);
+ $ax.dynamicPanelManager.updatePanelContentPercentWidth(childId);
+
+ }
+ }
+ }
+ }
+ container.remove();
+ trapScroll();
+ };
+
+ var _trapScrollLoc = function(id) {
+ var locs = {};
+ var states = $jobj(id).find('.panel_state');
+ for(var i = 0; i < states.length; i++) {
+ var state = $(states[i]);
+ locs[state.attr('id')] = { x: state.scrollLeft(), y: state.scrollTop() };
+ }
+ return function() {
+ for(var key in locs) {
+ var state = $jobj(key);
+ state.scrollLeft(locs[key].x);
+ state.scrollTop(locs[key].y);
+ }
+ };
+ }
+
+ var _getCurrFocus = function () {
+ // Only care about focused a tags and inputs
+ var id = window.lastFocusedClickable && window.lastFocusedClickable.id;
+
+ if(!id) return id;
+ var jobj = $(window.lastFocusedClickable);
+ return jobj.is('a') || jobj.is('input') ? id : '';
+ }
+
+ var _setCurrFocus = function(id) {
+ if(id) {
+ // This is really just needed for IE, so if this causes issues on other browsers, try adding that check here
+ var trap = $ax.event.blockEvent($ax.repeater.removeSuffixFromElementId(id), 'OnFocus');
+ window.setTimeout(function () {
+ $jobj(id).focus();
+ trap();
+ }, 0);
+ }
+ }
+
+ //use this to save & restore DP's scroll position when show/hide
+ //key => dp's id (not state's id, because it seems we can change state while hiding)
+ //value => first state's id & scroll position
+ //we only need to store one scroll position for one DP, and remove the key after shown.
+ var DPStateAndScroll = {}
+ var _tryResumeScrollForDP = function (dpId, deleteId) {
+ var scrollObj = DPStateAndScroll[dpId];
+ if(scrollObj) {
+ var shownState = document.getElementById(scrollObj.shownId);
+ if(scrollObj.left) shownState.scrollLeft = scrollObj.left;
+ if(scrollObj.top) shownState.scrollTop = scrollObj.top;
+ if(deleteId) delete DPStateAndScroll[dpId];
+ }
+ };
+// var _makeContainer = function (containerId, rect, isFullWidth, isFlip, offset, containerExists) {
+ var _makeContainer = function (containerId, width, height, isFullWidth, isFlip, offset, containerExists) {
+ if(containerExists) var container = $jobj(containerId);
+ else {
+ container = $('
');
+ container.attr('id', containerId);
+ }
+ var css = {
+ position: 'absolute',
+ width: width,
+ height: height,
+ display: 'flex'
+ };
+
+ if(!containerExists) {
+ // If container exists, may be busy updating location. Will init and update it correctly.
+ css.top = offset.top;
+ css.left = offset.left;
+ }
+
+
+ if(isFlip) {
+ css.perspective = '800px';
+ css.webkitPerspective = "800px";
+ css.mozPerspective = "800px";
+ //adding this to make Edge happy
+ css['transform-style'] = 'preserve-3d';
+ } else css.overflow = 'hidden';
+
+ //perspective on container will give us 3d effect when flip
+ //if(!isFlip) css.overflow = 'hidden';
+
+ // Rect should be a jquery not axquery obj
+ //_getFixedCss(css, rect.$ ? rect.$() : rect, fixedInfo, isFullWidth);
+
+ container.css(css);
+ return container;
+ };
+
+ var CONTAINER_SUFFIX = _visibility.CONTAINER_SUFFIX = '_container';
+ var CONTAINER_INNER = CONTAINER_SUFFIX + '_inner';
+ _visibility.getWidgetFromContainer = function(id) {
+ var containerIndex = id.indexOf(CONTAINER_SUFFIX);
+ if(containerIndex == -1) return id;
+ return id.substr(0, containerIndex) + id.substr(containerIndex + CONTAINER_SUFFIX.length);
+ };
+
+ // Apply container to widget id if necessary.
+ // returnJobj: True if you want the jquery object rather than id returned
+ // skipCheck: True if you want the query returned reguardless of container existing
+ // checkInner: True if inner container should be checked
+ _visibility.applyWidgetContainer = function (id, returnJobj, skipCheck, checkInner) {
+ // If container exists, just return (return query if requested)
+ if(id.indexOf(CONTAINER_SUFFIX) != -1) return returnJobj ? $jobj(id) : id;
+
+ // Get desired id, and return it if query is not desired
+ var containerId = $ax.repeater.applySuffixToElementId(id, checkInner ? CONTAINER_INNER : CONTAINER_SUFFIX);
+ if(!returnJobj) return containerId;
+
+ // If skipping check or container exists, just return innermost container requested
+ var container = $jobj(containerId);
+ if(skipCheck || container.length) return container;
+ // If inner container was not checked, then no more to check, return query for widget
+ if(!checkInner) return $jobj(id);
+
+ // If inner container was checked, check for regular container still
+ container = $jobj($ax.repeater.applySuffixToElementId(id, CONTAINER_SUFFIX));
+ return container.length ? container : $jobj(id);
+ };
+
+ _visibility.isContainer = function(id) {
+ return id.indexOf(CONTAINER_SUFFIX) != -1;
+ };
+
+ _visibility.getRealChildren = function(query) {
+ while(query.length && $(query[0]).attr('id').indexOf(CONTAINER_SUFFIX) != -1) query = query.children();
+ return query;
+ };
+
+ //var _getFixedCss = function(css, rect, fixedInfo, isFullWidth) {
+ // // todo: **mas** make sure this is ok
+ // if(fixedInfo.fixed) {
+ // css.position = 'fixed';
+
+ // if(fixedInfo.horizontal == 'left') css.left = fixedInfo.x;
+ // else if(fixedInfo.horizontal == 'center') {
+ // css.left = isFullWidth ? '0px' : '50%';
+ // css['margin-left'] = fixedInfo.x;
+ // } else if(fixedInfo.horizontal == 'right') {
+ // css.left = 'auto';
+ // css.right = fixedInfo.x;
+ // }
+
+ // if(fixedInfo.vertical == 'top') css.top = fixedInfo.y;
+ // else if(fixedInfo.vertical == 'middle') {
+ // css.top = '50%';
+ // css['margin-top'] = fixedInfo.y;
+ // } else if(fixedInfo.vertical == 'bottom') {
+ // css.top = 'auto';
+ // css.bottom = fixedInfo.y;
+ // }
+ // } else {
+ // css.left = Number(rect.css('left').replace('px', '')) || 0;
+ // css.top = Number(rect.css('top').replace('px', '')) || 0;
+ // }
+ //};
+
+ var _slideStateOut = function (container, stateId, options, onComplete, jobj) {
+ var directionOut = options.direction;
+ var axObject = $ax('#' + container.attr('id'));
+ var width = axObject.width();
+ var height = axObject.height();
+
+ _blockSetMoveIds = true;
+
+ if(directionOut == "right") {
+ $ax.move.MoveWidget(stateId, width, 0, options, false, onComplete, false, jobj, true);
+ } else if(directionOut == "left") {
+ $ax.move.MoveWidget(stateId, -width, 0, options, false, onComplete, false, jobj, true);
+ } else if(directionOut == "up") {
+ $ax.move.MoveWidget(stateId, 0, -height, options, false, onComplete, false, jobj, true);
+ } else if(directionOut == "down") {
+ $ax.move.MoveWidget(stateId, 0, height, options, false, onComplete, false, jobj, true);
+ }
+
+ _blockSetMoveIds = false;
+ };
+
+ var _slideStateIn = function (id, stateId, options, container, makePanelVisible, onComplete, jobj, preserveScroll) {
+ var directionIn = options.direction;
+ var axObject = $ax('#' +container.attr('id'));
+ var width = axObject.width();
+ var height = axObject.height();
+
+ if (makePanelVisible) $ax.visibility.SetIdVisible(id, true);
+ for (i = 0; i < jobj.length; i++) $ax.visibility.SetVisible(jobj[i], true);
+
+ for(var i = 0; i < jobj.length; i++) {
+ var child = $(jobj[i]);
+ var oldTop = $ax.getNumFromPx(fixAuto(child, 'top'));
+ var oldLeft = $ax.getNumFromPx(fixAuto(child, 'left'));
+ if (directionIn == "right") {
+ child.css('left', oldLeft - width + 'px');
+ } else if(directionIn == "left") {
+ child.css('left', oldLeft + width + 'px');
+ } else if(directionIn == "up") {
+ child.css('top', oldTop + height + 'px');
+ } else if(directionIn == "down") {
+ child.css('top', oldTop - height + 'px');
+ }
+ }
+
+ if(preserveScroll) _tryResumeScrollForDP(id);
+
+ _blockSetMoveIds = true;
+
+ if(directionIn == "right") {
+ $ax.move.MoveWidget(stateId, width, 0, options, false, onComplete, false, jobj, true);
+ } else if(directionIn == "left") {
+ $ax.move.MoveWidget(stateId, -width, 0, options, false, onComplete, false, jobj, true);
+ } else if(directionIn == "up") {
+ $ax.move.MoveWidget(stateId, 0, -height, options, false, onComplete, false, jobj, true);
+ } else if(directionIn == "down") {
+ $ax.move.MoveWidget(stateId, 0, height, options, false, onComplete, false, jobj, true);
+ }
+
+ _blockSetMoveIds = false;
+ };
+
+ $ax.visibility.GetPanelStateId = function(dpId, index) {
+ var itemNum = $ax.repeater.getItemIdFromElementId(dpId);
+ var panelStateId = $ax.repeater.getScriptIdFromElementId(dpId) + '_state' + index;
+ return $ax.repeater.createElementId(panelStateId, itemNum);
+ };
+
+ $ax.visibility.GetPanelStateCount = function(id) {
+ return $ax.visibility.getRealChildren($jobj(id).children()).filter("[id*='_state']").length;
+ };
+
+ var _bringPanelStateToFront = function (dpId, stateId, oldStateId, oldInFront) {
+ var panel = $jobj(dpId);
+ var frontId = oldInFront ? oldStateId : stateId;
+ if(containerCount[dpId]) {
+ frontId = $ax.visibility.applyWidgetContainer(frontId);
+ panel = $ax.visibility.applyWidgetContainer(dpId, true, false, true);
+ }
+ $jobj(frontId).appendTo(panel);
+ //when bring a panel to front, it will be focused, and the previous front panel should fire blur event if it's lastFocusedClickableSelector
+ //ie(currently 11) and firefox(currently 34) doesn't fire blur event, this is the hack to fire it manually
+ if((IE || FIREFOX) && window.lastFocusedClickable && $ax.event.getFocusableWidgetOrChildId(window.lastFocusedControl) == window.lastFocusedClickable.id) {
+ // Only need to do this if the currently focused widget is in the panel state that is being hidden.
+ if($jobj(oldStateId).find('#' + window.lastFocusedClickable.id.split('_')[0]).length) $(window.lastFocusedClickable).triggerHandler('blur');
+ }
+ };
+
+ var _limboIds = _visibility.limboIds = {};
+ // limboId's is a dictionary of id->true, essentially a set.
+ var _addLimboAndHiddenIds = $ax.visibility.addLimboAndHiddenIds = function(newLimboIds, newHiddenIds, query, skipRepeater) {
+ var limboedByMaster = {};
+ for(var key in newLimboIds) {
+ if (!$ax.public.fn.IsReferenceDiagramObject($ax.getObjectFromElementId(key).type)) continue;
+ var ids = $ax.model.idsInRdoToHideOrLimbo(key);
+ for(var i = 0; i < ids.length; i++) limboedByMaster[ids[i]] = true;
+ }
+
+ var hiddenByMaster = {};
+ for(key in newHiddenIds) {
+ if (!$ax.public.fn.IsReferenceDiagramObject($ax.getObjectFromElementId(key).type)) continue;
+ ids = $ax.model.idsInRdoToHideOrLimbo(key);
+ for(i = 0; i < ids.length; i++) hiddenByMaster[ids[i]] = true;
+ }
+
+ // Extend with children of rdos
+ newLimboIds = $.extend(newLimboIds, limboedByMaster);
+ newHiddenIds = $.extend(newHiddenIds, hiddenByMaster);
+
+ // something is only visible if it's not hidden and limboed
+ query.each(function(diagramObject, elementId) {
+ // Rdos already handled, contained widgets are limboed by the parent, and sub menus should be ignored
+ if(diagramObject.isContained || $ax.public.fn.IsReferenceDiagramObject(diagramObject.type) || $ax.public.fn.IsTableCell(diagramObject.type) || $jobj(elementId).hasClass('sub_menu')) return;
+ if(diagramObject.type == 'table' && $jobj(elementId).parent().hasClass('ax_menu')) return;
+ if(skipRepeater) {
+ // Any item in a repeater should return
+ if($ax.getParentRepeaterFromElementIdExcludeSelf(elementId)) return;
+ }
+
+ var scriptId = $ax.repeater.getScriptIdFromElementId(elementId);
+ var shouldBeVisible = Boolean(!newLimboIds[scriptId] && !newHiddenIds[scriptId]);
+ var isVisible = Boolean(_isIdVisible(elementId));
+ if(shouldBeVisible != isVisible) {
+ _setWidgetVisibility(elementId, { value: shouldBeVisible, noContainer: true });
+ }
+ });
+
+ _limboIds = _visibility.limboIds = $.extend(_limboIds, newLimboIds);
+
+ };
+
+ var _clearLimboAndHidden = $ax.visibility.clearLimboAndHidden = function(ids) {
+ _limboIds = _visibility.limboIds = {};
+ };
+
+ $ax.visibility.clearLimboAndHiddenIds = function(ids) {
+ for(var i = 0; i < ids.length; i++) {
+ var scriptId = $ax.repeater.getScriptIdFromElementId(ids[i]);
+ delete _limboIds[scriptId];
+ }
+ };
+
+ $ax.visibility.resetLimboAndHiddenToDefaults = function (query) {
+ if(!query) query = $ax('*');
+ _clearLimboAndHidden();
+ _addLimboAndHiddenIds(_defaultLimbo, _defaultHidden, query);
+ };
+
+ $ax.visibility.isScriptIdLimbo = function(scriptId) {
+ if(_limboIds[scriptId]) return true;
+
+ var repeater = $ax.getParentRepeaterFromScriptId(scriptId);
+ if(!repeater) return false;
+
+ var itemId = $ax.getItemIdsForRepeater(repeater)[0];
+ return _limboIds[$ax.repeater.createElementId(scriptId, itemId)];
+ }
+
+ $ax.visibility.isElementIdLimboOrInLimboContainer = function (elementId) {
+ var parent = document.getElementById(elementId);
+ while(parent) {
+ var scriptId = $ax.repeater.getScriptIdFromElementId($(parent).attr('id'));
+ if(_limboIds[scriptId]) return true;
+ parent = parent.parentElement;
+ }
+ return false;
+ }
+
+ var _blockSetMoveIds = false;
+ var _movedIds = _visibility.movedIds = {};
+ var _resizedIds = _visibility.resizedIds = {};
+ var _rotatedIds = _visibility.rotatedIds = {};
+
+ $ax.visibility.getMovedLocation = function(scriptId) {
+ return _movedIds[scriptId];
+
+ //var repeater = $ax.getParentRepeaterFromScriptId(scriptId);
+ //if (!repeater) return false;
+
+ //var itemId = $ax.getItemIdsForRepeater(repeater)[0];
+ //return _movedIds[$ax.repeater.createElementId(scriptId, itemId)];
+ };
+
+ $ax.visibility.setMovedLocation = function (scriptId, left, top) {
+ if ($jobj(scriptId).css('position') == 'fixed') return;
+ _movedIds[scriptId] = { left: left, top: top };
+ };
+
+ $ax.visibility.moveMovedLocation = function (scriptId, deltaLeft, deltaTop) {
+ if(_blockSetMoveIds) return false;
+
+ var offsetLocation = $ax('#' + scriptId).offsetLocation();
+ $ax.visibility.setMovedLocation(scriptId, offsetLocation.x + deltaLeft, offsetLocation.y + deltaTop);
+
+ if($ax.getTypeFromElementId(scriptId) == $ax.constants.LAYER_TYPE) {
+ var childIds = $ax('#' + scriptId).getChildren()[0].children;
+ for (var i = 0; i < childIds.length; i++) {
+ $ax.visibility.moveMovedLocation(childIds[i], deltaLeft, deltaTop);
+ }
+ }
+ };
+
+ $ax.visibility.getResizedSize = function(scriptId) {
+ return _resizedIds[scriptId];
+
+ //var repeater = $ax.getParentRepeaterFromScriptId(scriptId);
+ //if (!repeater) return false;
+
+ //var itemId = $ax.getItemIdsForRepeater(repeater)[0];
+ //return _resizedIds[$ax.repeater.createElementId(scriptId, itemId)];
+ };
+
+ $ax.visibility.setResizedSize = function(scriptId, width, height) {
+ _resizedIds[scriptId] = { width: width, height: height };
+ };
+
+ $ax.visibility.getRotatedAngle = function (scriptId) {
+ return _rotatedIds[scriptId];
+ };
+
+ $ax.visibility.setRotatedAngle = function (scriptId, rotation) {
+ _rotatedIds[scriptId] = rotation;
+ };
+
+ $ax.visibility.clearMovedAndResized = function () {
+ _movedIds = _visibility.movedIds = {};
+ _resizedIds = _visibility.resizedIds = {};
+ _rotatedIds = _visibility.rotatedIds = {};
+ };
+
+ $ax.visibility.clearMovedAndResizedIds = function (elementIds) {
+ for (var i = 0; i < elementIds.length; i++) {
+ var id = elementIds[i];
+ delete _movedIds[id];
+ delete _resizedIds[id];
+ delete _rotatedIds[id];
+ }
+ };
+
+ $ax.visibility.initialize = function() {
+ // initialize initial visible states
+ $('.' + HIDDEN_CLASS).each(function (index, diagramObject) {
+ _defaultHidden[$ax.repeater.getScriptIdFromElementId(diagramObject.id)] = true;
+ });
+
+ $('.' + UNPLACED_CLASS).each(function (index, diagramObject) {
+ _defaultLimbo[$ax.repeater.getScriptIdFromElementId(diagramObject.id)] = true;
+ });
+
+ _addLimboAndHiddenIds(_defaultLimbo, _defaultHidden, $ax('*'), true);
+ };
+
+ _visibility.initRepeater = function(repeaterId) {
+ var html = $('
');
+ html.append($jobj(repeaterId + '_script').html());
+
+ html.find('.' + HIDDEN_CLASS).each(function (index, element) {
+ _defaultHidden[$ax.repeater.getScriptIdFromElementId(element.id)] = true;
+ });
+
+ html.find('.' + UNPLACED_CLASS).each(function (index, element) {
+ _defaultLimbo[$ax.repeater.getScriptIdFromElementId(element.id)] = true;
+ });
+ }
+
+ var HIDDEN_CLASS = _visibility.HIDDEN_CLASS = 'ax_default_hidden';
+ var UNPLACED_CLASS = _visibility.UNPLACED_CLASS = 'ax_default_unplaced';
+
+});
\ No newline at end of file
diff --git a/src/原型系统/resources/scripts/axutils.js b/src/原型系统/resources/scripts/axutils.js
new file mode 100644
index 0000000..0fc44cc
--- /dev/null
+++ b/src/原型系统/resources/scripts/axutils.js
@@ -0,0 +1,231 @@
+/*
+ *
+ *
+ *
+ *
+ */
+
+ (function() {
+ // define the root namespace object
+ if(!window.$axure) window.$axure = {};
+
+ $axure.utils = {};
+
+ // ------------------------------------------------------------------------
+ // Makes an object bindable
+ // ------------------------------------------------------------------------
+ $axure.utils.makeBindable = function(obj, events) {
+ if(obj.registeredBindings != null) return;
+
+ // copy the events
+ obj.bindableEvents = events.slice();
+ obj.registeredBindings = {};
+
+ obj.bind = function(eventName, fn) {
+ var binding = {};
+ binding.eventName = eventName;
+ binding.action = fn;
+
+ var bindingList = this.registeredBindings[eventName];
+ if(bindingList == null) {
+ bindingList = [];
+ this.registeredBindings[eventName] = bindingList;
+ }
+ bindingList[bindingList.length] = binding;
+ };
+
+ obj.unbind = function(eventName) {
+ if(eventName.indexOf('.') >= 0) {
+ this.registeredBindings[eventName] = null;
+ } else {
+ var event = eventName.split('.')[0];
+ for(var bindingKey in this.registeredBindings) {
+ if(bindingKey.split('.')[0] == event) {
+ this.registeredBindings[bindingKey] = null;
+ }
+ }
+ }
+ };
+
+ obj.triggerEvent = function(eventName, arg) {
+ for(var bindingKey in this.registeredBindings) {
+ if(bindingKey.split('.')[0] == eventName) {
+ var bindings = this.registeredBindings[bindingKey];
+ for(var i = 0; i < bindings.length; i++) {
+ if(arg == null) {
+ bindings[i].action();
+ } else {
+ bindings[i].action(arg);
+ }
+ }
+ }
+ }
+ };
+ };
+
+
+ $axure.utils.loadCSS = function(url) {
+ $('head').append(' ');
+ };
+
+ $axure.utils.loadJS = function(url) {
+ $('head').append('');
+ };
+
+ $axure.utils.curry = function(fn) {
+ var curriedArgs = Array.prototype.slice.call(arguments, [1]);
+ return function() {
+ fn.apply(this, curriedArgs.concat(Array.prototype.slice.call(arguments)));
+ };
+ };
+
+ $axure.utils.succeeded = function(result) {
+ return result && result.success;
+ };
+
+ $axure.utils.createUniqueTag = function() {
+ return Math.random().toString().substring(2) +
+ Math.random().toString().substring(2) +
+ Math.random().toString().substring(2) +
+ Math.random().toString().substring(2);
+ };
+
+ $axure.utils.formatDate = function(date) {
+ var months = [
+ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+ "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
+ var hours = date.getHours();
+ var amPm = (hours > 11 ? 'PM' : 'AM');
+ hours = hours % 12;
+ if(hours == '0') hours = '12';
+ var minutes = date.getMinutes() + '';
+ if(minutes.length == 1) {
+ minutes = '0' + minutes;
+ }
+ return [
+ months[date.getMonth()], ' ', date.getDate(), ' ', date.getFullYear(), ' ',
+ hours, ':', minutes, ' ', amPm].join('');
+
+ };
+
+ $axure.utils.quickObject = function() {
+ var returnVal = {};
+ for(var i = 0; i < arguments.length; i += 2) {
+ returnVal[arguments[i]] = arguments[i + 1];
+ }
+ return returnVal;
+ };
+
+ var matrixBase = {
+ mul: function(val) {
+ if(val.x !== undefined) {
+ return $axure.utils.Vector2D(
+ this.m11 * val.x + this.m12 * val.y + this.tx,
+ this.m21 * val.x + this.m22 * val.y + this.ty);
+ } else if(val.m11) {
+ return $axure.utils.Matrix2D(
+ this.m11 * val.m11 + this.m12 * val.m21,
+ this.m11 * val.m12 + this.m12 * val.m22,
+ this.m21 * val.m11 + this.m22 * val.m21,
+ this.m21 * val.m12 + this.m22 * val.m22,
+ val.tx + this.tx * val.m11 + this.ty * val.m21,
+ val.ty + this.tx * val.m12 + this.ty * val.m22
+ );
+ } else if(Number(val)) {
+ var num = Number(val);
+ return $axure.utils.Matrix2D(this.m11 * num, this.m12 * num,
+ this.m21 * num, this.m22 * num,
+ this.tx * num, this.ty * num);
+ } else return undefined;
+ },
+ rotate: function(angle) {
+ var angleRad = angle * Math.PI / 180;
+ var c = Math.cos(angleRad);
+ var s = Math.sin(angleRad);
+
+ return this.mul($axure.utils.Matrix2D(c, -s, s, c));
+ },
+ translate: function(tx, ty) {
+ return this.mul($axure.utils.Matrix2D(1, 0, 0, 1, tx, ty));
+ }
+ };
+
+ $axure.utils.Matrix2D = function(m11, m12, m21, m22, tx, ty) {
+ return $.extend({
+ m11: m11 || 0,
+ m12: m12 || 0,
+ m21: m21 || 0,
+ m22: m22 || 0,
+ tx: tx || 0,
+ ty: ty || 0
+ }, matrixBase);
+ };
+
+ $axure.utils.Vector2D = function(x, y) {
+ return { x: x || 0, y: y || 0 };
+ };
+
+ $axure.utils.Matrix2D.identity = function() {
+ return $axure.utils.Matrix2D(1, 0, 0, 1, 0, 0);
+ };
+
+ })();
+
+ // TODO: [mas] simplify this
+ if(window.$axure && window.$axure.internal) {
+ $axure.internal(function($ax) { $ax.utils = $axure.utils; });
+ }
+
+ // Its too much of a pain to escape everything and use regular expresions, just replace manually
+ (function () {
+ var original = String.prototype.replace;
+ // TODO: maybe use flags or object instead to pass options in
+ String.prototype.replace = function (search, newVal, replaceFirst, ignoreCase) {
+ // Use original is some cases
+ if (search instanceof RegExp) return original.apply(this, arguments);
+
+ search = String(search);
+ var searchCompare = ignoreCase ? this.toLowerCase() : this;
+ if (ignoreCase) search = search.toLowerCase();
+
+ var searchLength = search.length;
+ var thisLength = this.length;
+
+ var index = 0;
+ var retVal = '';
+ while (index != -1) {
+ var nextIndex = searchCompare.indexOf(search, index);
+ if (nextIndex != -1) {
+ retVal += this.substring(index, nextIndex) + newVal;
+ index = nextIndex + searchLength;
+ if (index >= thisLength) index = -1;
+ } else {
+ retVal += this.substring(index);
+ index = -1;
+ }
+ if (replaceFirst) break;
+ }
+
+ return retVal;
+ };
+
+ if (!Array.prototype.indexOf) {
+ Array.prototype.indexOf = function (elt /*, from*/) {
+ var len = this.length >>> 0;
+
+ var from = trunc(Number(arguments[1]) || 0);
+ if(from < 0) from += len;
+
+ for(; from < len; from++) {
+ if(from in this && this[from] === elt) return from;
+ }
+ return -1;
+ };
+ }
+
+ var trunc = function(num) {
+ return num < 0 ? Math.ceil(num) : Math.floor(num);
+ };
+
+
+ })();
diff --git a/src/原型系统/resources/scripts/jquery-1.7.1.min.js b/src/原型系统/resources/scripts/jquery-1.7.1.min.js
new file mode 100644
index 0000000..198b3ff
--- /dev/null
+++ b/src/原型系统/resources/scripts/jquery-1.7.1.min.js
@@ -0,0 +1,4 @@
+/*! jQuery v1.7.1 jquery.com | jquery.org/license */
+(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cv(a){if(!ck[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cl||(cl=c.createElement("iframe"),cl.frameBorder=cl.width=cl.height=0),b.appendChild(cl);if(!cm||!cl.createElement)cm=(cl.contentWindow||cl.contentDocument).document,cm.write((c.compatMode==="CSS1Compat"?"":"")+""),cm.close();d=cm.createElement(a),cm.body.appendChild(d),e=f.css(d,"display"),b.removeChild(cl)}ck[a]=e}return ck[a]}function cu(a,b){var c={};f.each(cq.concat.apply([],cq.slice(0,b)),function(){c[this]=a});return c}function ct(){cr=b}function cs(){setTimeout(ct,0);return cr=f.now()}function cj(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ci(){try{return new a.XMLHttpRequest}catch(b){}}function cc(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g0){if(c!=="border")for(;g=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?parseFloat(d):j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;ca ",d=q.getElementsByTagName("*"),e=q.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=q.getElementsByTagName("input")[0],b={leadingWhitespace:q.firstChild.nodeType===3,tbody:!q.getElementsByTagName("tbody").length,htmlSerialize:!!q.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:q.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete q.test}catch(s){b.deleteExpando=!1}!q.addEventListener&&q.attachEvent&&q.fireEvent&&(q.attachEvent("onclick",function(){b.noCloneEvent=!1}),q.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),q.appendChild(i),k=c.createDocumentFragment(),k.appendChild(q.lastChild),b.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,k.removeChild(i),k.appendChild(q),q.innerHTML="",a.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",q.style.width="2px",q.appendChild(j),b.reliableMarginRight=(parseInt((a.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0);if(q.attachEvent)for(o in{submit:1,change:1,focusin:1})n="on"+o,p=n in q,p||(q.setAttribute(n,"return;"),p=typeof q[n]=="function"),b[o+"Bubbles"]=p;k.removeChild(q),k=g=h=j=q=i=null,f(function(){var a,d,e,g,h,i,j,k,m,n,o,r=c.getElementsByTagName("body")[0];!r||(j=1,k="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",m="visibility:hidden;border:0;",n="style='"+k+"border:5px solid #000;padding:0;'",o=""+"",a=c.createElement("div"),a.style.cssText=m+"width:0;height:0;position:static;top:0;margin-top:"+j+"px",r.insertBefore(a,r.firstChild),q=c.createElement("div"),a.appendChild(q),q.innerHTML="",l=q.getElementsByTagName("td"),p=l[0].offsetHeight===0,l[0].style.display="",l[1].style.display="none",b.reliableHiddenOffsets=p&&l[0].offsetHeight===0,q.innerHTML="",q.style.width=q.style.paddingLeft="1px",f.boxModel=b.boxModel=q.offsetWidth===2,typeof q.style.zoom!="undefined"&&(q.style.display="inline",q.style.zoom=1,b.inlineBlockNeedsLayout=q.offsetWidth===2,q.style.display="",q.innerHTML="
",b.shrinkWrapBlocks=q.offsetWidth!==2),q.style.cssText=k+m,q.innerHTML=o,d=q.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,i={doesNotAddBorder:e.offsetTop!==5,doesAddBorderForTableAndCells:h.offsetTop===5},e.style.position="fixed",e.style.top="20px",i.fixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",i.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,i.doesNotIncludeMarginInBodyOffset=r.offsetTop!==j,r.removeChild(a),q=a=null,f.extend(b,i))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.nodeName.toLowerCase()]||f.valHooks[g.type];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;h=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/\bhover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")};
+f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;le&&i.push({elem:this,matches:d.slice(e)});for(j=0;j0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c ",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML=" ",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="
";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h0)for(h=g;h=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/",""],legend:[1,""," "],thead:[1,""],tr:[2,""],td:[3,""],col:[2,""],area:[1,""," "],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div","
"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function()
+{for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1>$2>");try{for(var c=0,d=this.length;c1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||!bc.test("<"+a.nodeName)?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!_.test(k))k=b.createTextNode(k);else{k=k.replace(Y,"<$1>$2>");var l=(Z.exec(k)||["",""])[1].toLowerCase(),m=bg[l]||bg._default,n=m[0],o=b.createElement("div");b===c?bh.appendChild(o):U(b).appendChild(o),o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=$.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]===""&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&X.test(k)&&o.insertBefore(b.createTextNode(X.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return br.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bq,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bq.test(g)?g.replace(bq,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bz(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bA=function(a,b){var c,d,e;b=b.replace(bs,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b)));return c}),c.documentElement.currentStyle&&(bB=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f===null&&g&&(e=g[b])&&(f=e),!bt.test(f)&&bu.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f||0,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),bz=bA||bB,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bD=/%20/g,bE=/\[\]$/,bF=/\r?\n/g,bG=/#.*$/,bH=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bI=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bJ=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bK=/^(?:GET|HEAD)$/,bL=/^\/\//,bM=/\?/,bN=/
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/原型系统/start_c_1.html b/src/原型系统/start_c_1.html
new file mode 100644
index 0000000..82de5fd
--- /dev/null
+++ b/src/原型系统/start_c_1.html
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/src/原型系统/start_with_pages.html b/src/原型系统/start_with_pages.html
new file mode 100644
index 0000000..5db78d6
--- /dev/null
+++ b/src/原型系统/start_with_pages.html
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/src/原型系统/搜索结果.html b/src/原型系统/搜索结果.html
new file mode 100644
index 0000000..7957bfb
--- /dev/null
+++ b/src/原型系统/搜索结果.html
@@ -0,0 +1,69 @@
+
+
+
+ 搜索结果
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/原型系统/注册.html b/src/原型系统/注册.html
new file mode 100644
index 0000000..ab62e12
--- /dev/null
+++ b/src/原型系统/注册.html
@@ -0,0 +1,369 @@
+
+
+
+ 注册
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/原型系统/登录.html b/src/原型系统/登录.html
new file mode 100644
index 0000000..e738c89
--- /dev/null
+++ b/src/原型系统/登录.html
@@ -0,0 +1,197 @@
+
+
+
+ 登录
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/原型系统/订票成功.html b/src/原型系统/订票成功.html
new file mode 100644
index 0000000..301d2c5
--- /dev/null
+++ b/src/原型系统/订票成功.html
@@ -0,0 +1,73 @@
+
+
+
+ 订票成功
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/原型系统/订票界面.html b/src/原型系统/订票界面.html
new file mode 100644
index 0000000..49826d5
--- /dev/null
+++ b/src/原型系统/订票界面.html
@@ -0,0 +1,601 @@
+
+
+
+ 订票界面
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
How can I help you today?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+