Merge branch 'develop'
Conflicts: core-js/pom.xml mindplot/pom.xml pom.xml web2d/pom.xml wise-editor/pom.xml wise-webapp/pom.xml
@ -9,8 +9,11 @@
|
|||||||
<groupId>org.wisemapping</groupId>
|
<groupId>org.wisemapping</groupId>
|
||||||
<artifactId>wisemapping</artifactId>
|
<artifactId>wisemapping</artifactId>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
<version>3.0.4</version>
|
<version>4.0.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
<scm>
|
||||||
|
<developerConnection>scm:git:git@bitbucket.org:wisemapping/wisemapping-open-source.git</developerConnection>
|
||||||
|
</scm>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
@ -32,6 +35,28 @@
|
|||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-release-plugin</artifactId>
|
||||||
|
<version>2.5</version>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>com.github.searls</groupId>
|
||||||
|
<artifactId>jasmine-maven-plugin</artifactId>
|
||||||
|
<version>1.3.1.5</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>test</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<configuration>
|
||||||
|
<sourceIncludes>
|
||||||
|
<include>Functions.js</include>
|
||||||
|
</sourceIncludes>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>net.alchim31.maven</groupId>
|
<groupId>net.alchim31.maven</groupId>
|
||||||
<artifactId>yuicompressor-maven-plugin</artifactId>
|
<artifactId>yuicompressor-maven-plugin</artifactId>
|
||||||
@ -51,19 +76,9 @@
|
|||||||
<include>${basedir}/target/tmp/header-min.js</include>
|
<include>${basedir}/target/tmp/header-min.js</include>
|
||||||
<include>${basedir}/target/tmp/Functions-min.js</include>
|
<include>${basedir}/target/tmp/Functions-min.js</include>
|
||||||
<include>${basedir}/target/tmp/Utils-min.js</include>
|
<include>${basedir}/target/tmp/Utils-min.js</include>
|
||||||
<!-- @Todo:Review this -->
|
<include>${basedir}/../mindplot/src/main/javascript/Options.js</include>
|
||||||
<include>
|
<include>${basedir}/../mindplot/src/main/javascript/libraries/bootstrap/BootstrapDialog.js</include>
|
||||||
${basedir}/../mindplot/src/main/javascript/libraries/moodialog/Overlay.js
|
<include>${basedir}/../mindplot/src/main/javascript/libraries/bootstrap/BootstrapDialog.Request.js</include>
|
||||||
</include>
|
|
||||||
<include>
|
|
||||||
${basedir}/../mindplot/src/main/javascript/libraries/moodialog/MooDialog.js
|
|
||||||
</include>
|
|
||||||
<include>
|
|
||||||
${basedir}/../mindplot/src/main/javascript/libraries/moodialog/MooDialog.Request.js
|
|
||||||
</include>
|
|
||||||
<include>
|
|
||||||
${basedir}/../mindplot/src/main/javascript/libraries/moodialog/MooDialog.Fx.js
|
|
||||||
</include>
|
|
||||||
</includes>
|
</includes>
|
||||||
</aggregation>
|
</aggregation>
|
||||||
</aggregations>
|
</aggregations>
|
||||||
|
10
core-js/src/test/javascript/testSuite.js
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
describe("Functions suite test", function() {
|
||||||
|
it("$defined() test spec", function() {
|
||||||
|
var testVariable = undefined;
|
||||||
|
expect($defined(testVariable)).toBe(false);
|
||||||
|
testVariable = 1;
|
||||||
|
expect($defined(testVariable)).toBe(true);
|
||||||
|
testVariable = null;
|
||||||
|
expect($defined(testVariable)).toBe(false);
|
||||||
|
});
|
||||||
|
});
|
@ -8,7 +8,7 @@ BASE_DIR=`pwd`
|
|||||||
TARGET_DIR=$BASE_DIR/target
|
TARGET_DIR=$BASE_DIR/target
|
||||||
JETTY_DIR=$TARGET_DIR/wisemapping-$WISE_VERSION
|
JETTY_DIR=$TARGET_DIR/wisemapping-$WISE_VERSION
|
||||||
WISE_WEBAPP_DIR=$JETTY_DIR/webapps/wisemapping
|
WISE_WEBAPP_DIR=$JETTY_DIR/webapps/wisemapping
|
||||||
JETTY_VERSION=8.1.14.v20131031
|
JETTY_VERSION=8.1.16.v20140903
|
||||||
JETTY_DIST_DIR=jetty-distribution-${JETTY_VERSION}
|
JETTY_DIST_DIR=jetty-distribution-${JETTY_VERSION}
|
||||||
JETTY_ZIP=${JETTY_DIST_DIR}.zip
|
JETTY_ZIP=${JETTY_DIST_DIR}.zip
|
||||||
|
|
||||||
|
153
mindplot/pom.xml
@ -9,7 +9,7 @@
|
|||||||
<groupId>org.wisemapping</groupId>
|
<groupId>org.wisemapping</groupId>
|
||||||
<artifactId>wisemapping</artifactId>
|
<artifactId>wisemapping</artifactId>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
<version>3.0.4</version>
|
<version>4.0.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@ -124,6 +124,8 @@
|
|||||||
<inputDir>${basedir}/target/compress</inputDir>
|
<inputDir>${basedir}/target/compress</inputDir>
|
||||||
<includes>
|
<includes>
|
||||||
<include>header.js</include>
|
<include>header.js</include>
|
||||||
|
<include>Events.js</include>
|
||||||
|
<include>Options.js</include>
|
||||||
<include>${basedir}/../web2d/target/classes/web2d.svg-min.js</include>
|
<include>${basedir}/../web2d/target/classes/web2d.svg-min.js</include>
|
||||||
<include>Messages.js</include>
|
<include>Messages.js</include>
|
||||||
<include>TopicEventDispatcher.js</include>
|
<include>TopicEventDispatcher.js</include>
|
||||||
@ -139,7 +141,9 @@
|
|||||||
<include>ScreenManager.js</include>
|
<include>ScreenManager.js</include>
|
||||||
<include>Workspace.js</include>
|
<include>Workspace.js</include>
|
||||||
<include>ShrinkConnector.js</include>
|
<include>ShrinkConnector.js</include>
|
||||||
|
<include>Keyboard.js</include>
|
||||||
<include>DesignerKeyboard.js</include>
|
<include>DesignerKeyboard.js</include>
|
||||||
|
<include>Keyboard.js</include>
|
||||||
<include>TopicStyle.js</include>
|
<include>TopicStyle.js</include>
|
||||||
<include>NodeGraph.js</include>
|
<include>NodeGraph.js</include>
|
||||||
<include>Topic.js</include>
|
<include>Topic.js</include>
|
||||||
@ -250,6 +254,153 @@
|
|||||||
<skipTests>true</skipTests>
|
<skipTests>true</skipTests>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>com.github.searls</groupId>
|
||||||
|
<artifactId>jasmine-maven-plugin</artifactId>
|
||||||
|
<version>1.3.1.5</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<!--goal>test</goal-->
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.sourceforge.htmlunit</groupId>
|
||||||
|
<artifactId>htmlunit</artifactId>
|
||||||
|
<version>2.15</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<configuration>
|
||||||
|
<preloadSources>
|
||||||
|
<source>libraries/mootools/mootools-core-1.4.5-full-nocompat-yc.js</source>
|
||||||
|
<source>lib/jquery-1.8.2.js</source>
|
||||||
|
<source>lib/core.js/</source>
|
||||||
|
<source>lib/web2d.svg-min.js</source>
|
||||||
|
<source>libraries/hotkeys/jquery.hotkeys.js</source>
|
||||||
|
<source>libraries/underscorejs/underscore-min.js</source>
|
||||||
|
<source>libraries/bootstrap/js/bootstrap.js</source>
|
||||||
|
</preloadSources>
|
||||||
|
<sourceIncludes>
|
||||||
|
<include>header.js</include>
|
||||||
|
<include>Events.js</include>
|
||||||
|
<include>Messages.js</include>
|
||||||
|
<include>TopicEventDispatcher.js</include>
|
||||||
|
<include>model/IMindmap.js</include>
|
||||||
|
<include>model/Mindmap.js</include>
|
||||||
|
<include>model/INodeModel.js</include>
|
||||||
|
<include>model/NodeModel.js</include>
|
||||||
|
<include>model/RelationshipModel.js</include>
|
||||||
|
<include>ActionDispatcher.js</include>
|
||||||
|
<include>StandaloneActionDispatcher.js</include>
|
||||||
|
<include>DesignerModel.js</include>
|
||||||
|
<include>Designer.js</include>
|
||||||
|
<include>ScreenManager.js</include>
|
||||||
|
<include>Workspace.js</include>
|
||||||
|
<include>ShrinkConnector.js</include>
|
||||||
|
<include>Keyboard.js</include>
|
||||||
|
<include>DesignerKeyboard.js</include>
|
||||||
|
<include>Keyboard.js</include>
|
||||||
|
<include>TopicStyle.js</include>
|
||||||
|
<include>NodeGraph.js</include>
|
||||||
|
<include>Topic.js</include>
|
||||||
|
<include>CentralTopic.js</include>
|
||||||
|
<include>MainTopic.js</include>
|
||||||
|
<include>DragTopic.js</include>
|
||||||
|
<include>DragManager.js</include>
|
||||||
|
<include>DragPivot.js</include>
|
||||||
|
<include>ConnectionLine.js</include>
|
||||||
|
<include>Relationship.js</include>
|
||||||
|
<include>DragConnector.js</include>
|
||||||
|
<include>TextEditor.js</include>
|
||||||
|
<include>MultilineTextEditor.js</include>
|
||||||
|
<include>TextEditorFactory.js</include>
|
||||||
|
<include>util/Shape.js</include>
|
||||||
|
<include>util/FadeEffect.js</include>
|
||||||
|
<include>persistence/ModelCodeName.js</include>
|
||||||
|
<include>persistence/XMLSerializer_Pela.js</include>
|
||||||
|
<include>persistence/XMLSerializer_Tango.js</include>
|
||||||
|
<include>persistence/Pela2TangoMigrator.js</include>
|
||||||
|
<include>persistence/XMLSerializer_Beta.js</include>
|
||||||
|
<include>persistence/Beta2PelaMigrator.js</include>
|
||||||
|
<include>persistence/XMLSerializerFactory.js</include>
|
||||||
|
<include>PersistenceManager.js</include>
|
||||||
|
<include>RestPersistenceManager.js</include>
|
||||||
|
<include>LocalStorageManager.js</include>
|
||||||
|
<include>EditorProperties.js</include>
|
||||||
|
<include>IconGroup.js</include>
|
||||||
|
<include>Icon.js</include>
|
||||||
|
<include>LinkIcon.js</include>
|
||||||
|
<include>NoteIcon.js</include>
|
||||||
|
<include>ActionIcon.js</include>
|
||||||
|
<include>ImageIcon.js</include>
|
||||||
|
<include>model/FeatureModel.js</include>
|
||||||
|
<include>model/IconModel.js</include>
|
||||||
|
<include>model/LinkModel.js</include>
|
||||||
|
<include>model/NoteModel.js</include>
|
||||||
|
<include>Command.js</include>
|
||||||
|
<include>DesignerActionRunner.js</include>
|
||||||
|
<include>DesignerUndoManager.js</include>
|
||||||
|
<include>ControlPoint.js</include>
|
||||||
|
<include>EditorOptions.js</include>
|
||||||
|
<include>RelationshipPivot.js</include>
|
||||||
|
<include>TopicFeature.js</include>
|
||||||
|
<include>commands/GenericFunctionCommand.js</include>
|
||||||
|
<include>commands/DeleteCommand.js</include>
|
||||||
|
<include>commands/DragTopicCommand.js</include>
|
||||||
|
<include>commands/AddTopicCommand.js</include>
|
||||||
|
<include>commands/ChangeFeatureToTopicCommand.js</include>
|
||||||
|
<include>commands/RemoveFeatureFromTopicCommand.js</include>
|
||||||
|
<include>commands/AddFeatureToTopicCommand.js</include>
|
||||||
|
<include>commands/AddRelationshipCommand.js</include>
|
||||||
|
<include>commands/MoveControlPointCommand.js</include>
|
||||||
|
<include>widget/ModalDialogNotifier.js</include>
|
||||||
|
<include>widget/ToolbarNotifier.js</include>
|
||||||
|
<include>widget/ToolbarItem.js</include>
|
||||||
|
<include>widget/ToolbarPaneItem.js</include>
|
||||||
|
<include>widget/NoteEditor.js</include>
|
||||||
|
<include>widget/LinkEditor.js</include>
|
||||||
|
<include>widget/FloatingTip.js</include>
|
||||||
|
<include>widget/LinkIconTooltip.js</include>
|
||||||
|
<include>widget/KeyboardShortcutTooltip.js</include>
|
||||||
|
<include>widget/ColorPalettePanel.js</include>
|
||||||
|
<include>widget/ListToolbarPanel.js</include>
|
||||||
|
<include>widget/FontFamilyPanel.js</include>
|
||||||
|
<include>widget/FontSizePanel.js</include>
|
||||||
|
<include>widget/TopicShapePanel.js</include>
|
||||||
|
<include>widget/IconPanel.js</include>
|
||||||
|
<include>widget/IMenu.js</include>
|
||||||
|
<include>widget/Menu.js</include>
|
||||||
|
<include>TopicFeature.js</include>
|
||||||
|
<include>layout/EventBusDispatcher.js</include>
|
||||||
|
<include>layout/ChangeEvent.js</include>
|
||||||
|
<include>layout/LayoutManager.js</include>
|
||||||
|
<include>layout/Node.js</include>
|
||||||
|
<include>layout/RootedTreeSet.js</include>
|
||||||
|
<include>layout/ChildrenSorterStrategy.js</include>
|
||||||
|
<include>layout/AbstractBasicSorter.js</include>
|
||||||
|
<include>layout/BalancedSorter.js</include>
|
||||||
|
<include>layout/SymmetricSorter.js</include>
|
||||||
|
<include>layout/GridSorter.js</include>
|
||||||
|
<include>layout/OriginalLayout.js</include>
|
||||||
|
<include>layout/EventBus.js</include>
|
||||||
|
<include>MessageBundle_en.js</include>
|
||||||
|
<include>MessageBundle_es.js</include>
|
||||||
|
<include>MessageBundle_de.js</include>
|
||||||
|
<include>MessageBundle_fr.js</include>
|
||||||
|
<include>MessageBundle_pt_BR.js</include>
|
||||||
|
<include>MessageBundle_zh_CN.js</include>
|
||||||
|
<include>MessageBundle_zh_TW.js</include>
|
||||||
|
<include>MessageBundle_ca.js</include>
|
||||||
|
<include>footer.js</include>
|
||||||
|
</sourceIncludes>
|
||||||
|
<specExcludes>
|
||||||
|
<exclude>static/test/*.js</exclude>
|
||||||
|
<exclude>simpleTest.js</exclude>
|
||||||
|
</specExcludes>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
</project>
|
</project>
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
//noinspection JSUnusedLocalSymbols
|
//noinspection JSUnusedLocalSymbols
|
||||||
mindplot.ActionDispatcher = new Class({
|
mindplot.ActionDispatcher = new Class({
|
||||||
Implements:[Events],
|
Implements:[mindplot.Events],
|
||||||
initialize: function(commandContext) {
|
initialize: function(commandContext) {
|
||||||
$assert(commandContext, "commandContext can not be null");
|
$assert(commandContext, "commandContext can not be null");
|
||||||
},
|
},
|
||||||
|
@ -36,7 +36,7 @@ mindplot.ActionIcon = new Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
addToGroup:function(group) {
|
addToGroup:function(group) {
|
||||||
group.appendChild(this.getImage());
|
group.append(this.getImage());
|
||||||
},
|
},
|
||||||
|
|
||||||
setVisibility:function(visible) {
|
setVisibility:function(visible) {
|
||||||
|
@ -61,6 +61,6 @@ mindplot.CentralTopic = new Class({
|
|||||||
var pos = this.getPosition();
|
var pos = this.getPosition();
|
||||||
var isAtRight = mindplot.util.Shape.isAtRight(targetPosition, pos);
|
var isAtRight = mindplot.util.Shape.isAtRight(targetPosition, pos);
|
||||||
var size = this.getSize();
|
var size = this.getSize();
|
||||||
return mindplot.util.Shape.calculateRectConnectionPoint(pos, size, !isAtRight);
|
return mindplot.util.Shape.calculateRectConnectionPoint(pos, size, !isAtRight);
|
||||||
}
|
}
|
||||||
});
|
});
|
@ -145,7 +145,7 @@ mindplot.ConnectionLine = new Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
addToWorkspace:function (workspace) {
|
addToWorkspace:function (workspace) {
|
||||||
workspace.appendChild(this._line2d);
|
workspace.append(this._line2d);
|
||||||
this._line2d.moveToBack();
|
this._line2d.moveToBack();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -29,30 +29,26 @@ mindplot.ControlPoint = new Class({
|
|||||||
new web2d.Line({strokeColor:"#6589de", strokeWidth:1, opacity:0.3})];
|
new web2d.Line({strokeColor:"#6589de", strokeWidth:1, opacity:0.3})];
|
||||||
|
|
||||||
this._isBinded = false;
|
this._isBinded = false;
|
||||||
|
var me = this;
|
||||||
this._controlPointsController[0].addEvent('mousedown', function(event) {
|
this._controlPointsController[0].addEvent('mousedown', function(event) {
|
||||||
(this._mouseDown.bind(this))(event, mindplot.ControlPoint.FROM);
|
(me._mouseDown)(event, mindplot.ControlPoint.FROM, me);
|
||||||
}.bind(this));
|
});
|
||||||
this._controlPointsController[0].addEvent('click', function(event) {
|
this._controlPointsController[0].addEvent('click', function(event) {
|
||||||
(this._mouseClick.bind(this))(event);
|
(me._mouseClick)(event);
|
||||||
}.bind(this));
|
});
|
||||||
this._controlPointsController[0].addEvent('dblclick', function(event) {
|
this._controlPointsController[0].addEvent('dblclick', function(event) {
|
||||||
(this._mouseClick.bind(this))(event);
|
(me._mouseClick)(event);
|
||||||
}.bind(this));
|
});
|
||||||
|
|
||||||
this._controlPointsController[1].addEvent('mousedown', function(event) {
|
this._controlPointsController[1].addEvent('mousedown', function(event) {
|
||||||
(this._mouseDown.bind(this))(event, mindplot.ControlPoint.TO);
|
(me._mouseDown)(event, mindplot.ControlPoint.TO, me);
|
||||||
}.bind(this));
|
});
|
||||||
this._controlPointsController[1].addEvent('click', function(event) {
|
this._controlPointsController[1].addEvent('click', function(event) {
|
||||||
(this._mouseClick.bind(this))(event);
|
(me._mouseClick)(event);
|
||||||
}.bind(this));
|
});
|
||||||
this._controlPointsController[1].addEvent('dblclick', function(event) {
|
this._controlPointsController[1].addEvent('dblclick', function(event) {
|
||||||
(this._mouseClick.bind(this))(event);
|
(me._mouseClick)(event);
|
||||||
}.bind(this));
|
});
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
setSide : function(side) {
|
|
||||||
this._side = side;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
setLine : function(line) {
|
setLine : function(line) {
|
||||||
@ -91,22 +87,21 @@ mindplot.ControlPoint = new Class({
|
|||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_mouseDown : function(event, point) {
|
_mouseDown : function(event, point, me) {
|
||||||
if (!this._isBinded) {
|
if (!this._isBinded) {
|
||||||
this._isBinded = true;
|
this._isBinded = true;
|
||||||
|
|
||||||
this._mouseMoveFunction = function(event) {
|
this._mouseMoveFunction = function(event) {
|
||||||
(this._mouseMoveEvent.bind(this))(event, point);
|
(me._mouseMoveEvent)(event, point, me);
|
||||||
}.bind(this);
|
};
|
||||||
|
|
||||||
this._workspace.getScreenManager().addEvent('mousemove', this._mouseMoveFunction);
|
this._workspace.getScreenManager().addEvent('mousemove', this._mouseMoveFunction);
|
||||||
this._mouseUpFunction = function(event) {
|
this._mouseUpFunction = function(event) {
|
||||||
(this._mouseUp.bind(this))(event, point);
|
(me._mouseUp)(event, point, me);
|
||||||
}.bind(this);
|
};
|
||||||
this._workspace.getScreenManager().addEvent('mouseup', this._mouseUpFunction);
|
this._workspace.getScreenManager().addEvent('mouseup', this._mouseUpFunction);
|
||||||
}
|
}
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stop();
|
event.stopPropagation();
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -143,7 +138,7 @@ mindplot.ControlPoint = new Class({
|
|||||||
|
|
||||||
_mouseClick : function(event) {
|
_mouseClick : function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stop();
|
event.stopPropagation();
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -162,10 +157,10 @@ mindplot.ControlPoint = new Class({
|
|||||||
|
|
||||||
addToWorkspace : function(workspace) {
|
addToWorkspace : function(workspace) {
|
||||||
this._workspace = workspace;
|
this._workspace = workspace;
|
||||||
workspace.appendChild(this._controlPointsController[0]);
|
workspace.append(this._controlPointsController[0]);
|
||||||
workspace.appendChild(this._controlPointsController[1]);
|
workspace.append(this._controlPointsController[1]);
|
||||||
workspace.appendChild(this._controlLines[0]);
|
workspace.append(this._controlLines[0]);
|
||||||
workspace.appendChild(this._controlLines[1]);
|
workspace.append(this._controlLines[1]);
|
||||||
},
|
},
|
||||||
|
|
||||||
removeFromWorkspace : function(workspace) {
|
removeFromWorkspace : function(workspace) {
|
||||||
|
@ -17,10 +17,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
mindplot.Designer = new Class({
|
mindplot.Designer = new Class({
|
||||||
Extends:Events,
|
Extends: mindplot.Events,
|
||||||
initialize:function (options, divElement) {
|
initialize:function (options, divElement) {
|
||||||
$assert(options, "options must be defined");
|
$assert(options, "options must be defined");
|
||||||
$assert(options.zoom, "zoom must be defined");
|
$assert(options.zoom, "zoom must be defined");
|
||||||
|
$assert(options.size, "size must be defined");
|
||||||
$assert(divElement, "divElement must be defined");
|
$assert(divElement, "divElement must be defined");
|
||||||
|
|
||||||
// Set up i18n location ...
|
// Set up i18n location ...
|
||||||
@ -29,15 +30,16 @@ mindplot.Designer = new Class({
|
|||||||
this._options = options;
|
this._options = options;
|
||||||
|
|
||||||
// Set full div elem render area ...
|
// Set full div elem render area ...
|
||||||
divElement.setStyles(options.size);
|
divElement.css(options.size);
|
||||||
|
|
||||||
// Dispatcher manager ...
|
// Dispatcher manager ...
|
||||||
var commandContext = new mindplot.CommandContext(this);
|
var commandContext = new mindplot.CommandContext(this);
|
||||||
this._actionDispatcher = new mindplot.StandaloneActionDispatcher(commandContext);
|
this._actionDispatcher = new mindplot.StandaloneActionDispatcher(commandContext);
|
||||||
|
|
||||||
|
var me = this;
|
||||||
this._actionDispatcher.addEvent("modelUpdate", function (event) {
|
this._actionDispatcher.addEvent("modelUpdate", function (event) {
|
||||||
this.fireEvent("modelUpdate", event);
|
me.fireEvent("modelUpdate", event);
|
||||||
}.bind(this));
|
});
|
||||||
|
|
||||||
mindplot.ActionDispatcher.setInstance(this._actionDispatcher);
|
mindplot.ActionDispatcher.setInstance(this._actionDispatcher);
|
||||||
this._model = new mindplot.DesignerModel(options);
|
this._model = new mindplot.DesignerModel(options);
|
||||||
@ -80,13 +82,12 @@ mindplot.Designer = new Class({
|
|||||||
|
|
||||||
_registerWheelEvents:function () {
|
_registerWheelEvents:function () {
|
||||||
var workspace = this._workspace;
|
var workspace = this._workspace;
|
||||||
var screenManager = workspace.getScreenManager();
|
var me = this;
|
||||||
|
|
||||||
// Zoom In and Zoom Out must active event
|
// Zoom In and Zoom Out must active event
|
||||||
$(document).addEvent('mousewheel', function (event) {
|
$(document).on('mousewheel', function (event) {
|
||||||
// Change mousewheel handling so we let the default
|
// Change mousewheel handling so we let the default
|
||||||
//event happen if we are outside the container.
|
// event happen if we are outside the container. -> FIXME: it still happening?
|
||||||
var coords = screenManager.getContainer().getCoordinates();
|
/*var coords = screenManager.getContainer().getCoordinates();
|
||||||
var isOutsideContainer = event.client.y < coords.top ||
|
var isOutsideContainer = event.client.y < coords.top ||
|
||||||
event.client.y > coords.bottom ||
|
event.client.y > coords.bottom ||
|
||||||
event.client.x < coords.left ||
|
event.client.x < coords.left ||
|
||||||
@ -100,8 +101,15 @@ mindplot.Designer = new Class({
|
|||||||
this.zoomOut(1.05);
|
this.zoomOut(1.05);
|
||||||
}
|
}
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
}*/
|
||||||
|
if (event.deltaY > 0) {
|
||||||
|
me.zoomIn(1.05);
|
||||||
}
|
}
|
||||||
}.bind(this));
|
else {
|
||||||
|
me.zoomOut(1.05);
|
||||||
|
}
|
||||||
|
event.preventDefault();
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -124,37 +132,34 @@ mindplot.Designer = new Class({
|
|||||||
_registerMouseEvents:function () {
|
_registerMouseEvents:function () {
|
||||||
var workspace = this._workspace;
|
var workspace = this._workspace;
|
||||||
var screenManager = workspace.getScreenManager();
|
var screenManager = workspace.getScreenManager();
|
||||||
|
var me = this;
|
||||||
// Initialize workspace event listeners.
|
// Initialize workspace event listeners.
|
||||||
screenManager.addEvent('update', function () {
|
screenManager.addEvent('update', function () {
|
||||||
// Topic must be set to his original state. All editors must be closed.
|
// Topic must be set to his original state. All editors must be closed.
|
||||||
var topics = this.getModel().getTopics();
|
var topics = me.getModel().getTopics();
|
||||||
topics.each(function (object) {
|
_.each(topics, function(object){
|
||||||
object.closeEditors();
|
object.closeEditors();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Clean some selected nodes on event ..
|
// Clean some selected nodes on event ..
|
||||||
if (this._cleanScreen)
|
if (me._cleanScreen)
|
||||||
this._cleanScreen();
|
me._cleanScreen();
|
||||||
|
});
|
||||||
}.bind(this));
|
|
||||||
|
|
||||||
// Deselect on click ...
|
// Deselect on click ...
|
||||||
screenManager.addEvent('click', function (event) {
|
screenManager.addEvent('click', function (event) {
|
||||||
this.onObjectFocusEvent(null, event);
|
me.onObjectFocusEvent(null, event);
|
||||||
}.bind(this));
|
});
|
||||||
|
|
||||||
// Create nodes on double click...
|
// Create nodes on double click...
|
||||||
screenManager.addEvent('dblclick', function (event) {
|
screenManager.addEvent('dblclick', function (event) {
|
||||||
if (workspace.isWorkspaceEventsEnabled()) {
|
if (workspace.isWorkspaceEventsEnabled()) {
|
||||||
|
|
||||||
var mousePos = screenManager.getWorkspaceMousePosition(event);
|
var mousePos = screenManager.getWorkspaceMousePosition(event);
|
||||||
|
var centralTopic = me.getModel().getCentralTopic();
|
||||||
var centralTopic = this.getModel().getCentralTopic();
|
var model = me._createChildModel(centralTopic, mousePos);
|
||||||
var model = this._createChildModel(centralTopic, mousePos);
|
|
||||||
this._actionDispatcher.addTopics([model], [centralTopic.getId()]);
|
this._actionDispatcher.addTopics([model], [centralTopic.getId()]);
|
||||||
}
|
}
|
||||||
}.bind(this));
|
});
|
||||||
|
|
||||||
// Register mouse drag and drop event ...
|
// Register mouse drag and drop event ...
|
||||||
function noopHandler(evt) {
|
function noopHandler(evt) {
|
||||||
@ -248,13 +253,13 @@ mindplot.Designer = new Class({
|
|||||||
// Create node graph ...
|
// Create node graph ...
|
||||||
var topic = mindplot.NodeGraph.create(model, {readOnly:readOnly});
|
var topic = mindplot.NodeGraph.create(model, {readOnly:readOnly});
|
||||||
this.getModel().addTopic(topic);
|
this.getModel().addTopic(topic);
|
||||||
|
var me = this;
|
||||||
// Add Topic events ...
|
// Add Topic events ...
|
||||||
if (!readOnly) {
|
if (!readOnly) {
|
||||||
// If a node had gained focus, clean the rest of the nodes ...
|
// If a node had gained focus, clean the rest of the nodes ...
|
||||||
topic.addEvent('mousedown', function (event) {
|
topic.addEvent('mousedown', function (event) {
|
||||||
this.onObjectFocusEvent(topic, event);
|
me.onObjectFocusEvent(topic, event);
|
||||||
}.bind(this));
|
});
|
||||||
|
|
||||||
// Register node listeners ...
|
// Register node listeners ...
|
||||||
if (topic.getType() != mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE) {
|
if (topic.getType() != mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE) {
|
||||||
@ -286,38 +291,38 @@ mindplot.Designer = new Class({
|
|||||||
}
|
}
|
||||||
|
|
||||||
topic.addEvent('ontblur', function () {
|
topic.addEvent('ontblur', function () {
|
||||||
var topics = this.getModel().filterSelectedTopics();
|
var topics = me.getModel().filterSelectedTopics();
|
||||||
var rels = this.getModel().filterSelectedRelationships();
|
var rels = me.getModel().filterSelectedRelationships();
|
||||||
|
|
||||||
if (topics.length == 0 || rels.length == 0) {
|
if (topics.length == 0 || rels.length == 0) {
|
||||||
this.fireEvent('onblur');
|
me.fireEvent('onblur');
|
||||||
}
|
}
|
||||||
}.bind(this));
|
});
|
||||||
|
|
||||||
topic.addEvent('ontfocus', function () {
|
topic.addEvent('ontfocus', function () {
|
||||||
var topics = this.getModel().filterSelectedTopics();
|
var topics = me.getModel().filterSelectedTopics();
|
||||||
var rels = this.getModel().filterSelectedRelationships();
|
var rels = me.getModel().filterSelectedRelationships();
|
||||||
|
|
||||||
if (topics.length == 1 || rels.length == 1) {
|
if (topics.length == 1 || rels.length == 1) {
|
||||||
this.fireEvent('onfocus');
|
me.fireEvent('onfocus');
|
||||||
}
|
}
|
||||||
}.bind(this));
|
});
|
||||||
|
|
||||||
return topic;
|
return topic;
|
||||||
},
|
},
|
||||||
|
|
||||||
onObjectFocusEvent:function (currentObject, event) {
|
onObjectFocusEvent:function (currentObject, event) {
|
||||||
// Close node editors ..
|
// Close node editors ..
|
||||||
var topics = this.getModel().getTopics();
|
var topics = this.getModel().getTopics();
|
||||||
topics.each(function (topic) {
|
_.each(topics, function(topic) {
|
||||||
topic.closeEditors();
|
topic.closeEditors();
|
||||||
});
|
});
|
||||||
|
|
||||||
var model = this.getModel();
|
var model = this.getModel();
|
||||||
var objects = model.getEntities();
|
var objects = model.getEntities();
|
||||||
objects.each(function (object) {
|
_.each(objects, function(object) {
|
||||||
// Disable all nodes on focus but not the current if Ctrl key isn't being pressed
|
// Disable all nodes on focus but not the current if Ctrl key isn't being pressed
|
||||||
if (!$defined(event) || (!event.control && !event.meta)) {
|
if (!$defined(event) || (!event.ctrlKey && !event.metaKey)) {
|
||||||
if (object.isOnFocus() && object != currentObject) {
|
if (object.isOnFocus() && object != currentObject) {
|
||||||
object.setOnFocus(false);
|
object.setOnFocus(false);
|
||||||
}
|
}
|
||||||
@ -329,14 +334,14 @@ mindplot.Designer = new Class({
|
|||||||
selectAll:function () {
|
selectAll:function () {
|
||||||
var model = this.getModel();
|
var model = this.getModel();
|
||||||
var objects = model.getEntities();
|
var objects = model.getEntities();
|
||||||
objects.each(function (object) {
|
_.each(objects, function(object) {
|
||||||
object.setOnFocus(true);
|
object.setOnFocus(true);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
deselectAll:function () {
|
deselectAll:function () {
|
||||||
var objects = this.getModel().getEntities();
|
var objects = this.getModel().getEntities();
|
||||||
objects.each(function (object) {
|
_.each(objects, function (object) {
|
||||||
object.setOnFocus(false);
|
object.setOnFocus(false);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -629,12 +634,13 @@ mindplot.Designer = new Class({
|
|||||||
// Init layout manager ...
|
// Init layout manager ...
|
||||||
var size = {width:25, height:25};
|
var size = {width:25, height:25};
|
||||||
var layoutManager = new mindplot.layout.LayoutManager(mindmapModel.getCentralTopic().getId(), size);
|
var layoutManager = new mindplot.layout.LayoutManager(mindmapModel.getCentralTopic().getId(), size);
|
||||||
|
var me = this;
|
||||||
layoutManager.addEvent('change', function (event) {
|
layoutManager.addEvent('change', function (event) {
|
||||||
var id = event.getId();
|
var id = event.getId();
|
||||||
var topic = this.getModel().findTopicById(id);
|
var topic = me.getModel().findTopicById(id);
|
||||||
topic.setPosition(event.getPosition());
|
topic.setPosition(event.getPosition());
|
||||||
topic.setOrder(event.getOrder());
|
topic.setOrder(event.getOrder());
|
||||||
}.bind(this));
|
});
|
||||||
this._eventBussDispatcher.setLayoutManager(layoutManager);
|
this._eventBussDispatcher.setLayoutManager(layoutManager);
|
||||||
|
|
||||||
|
|
||||||
@ -691,7 +697,7 @@ mindplot.Designer = new Class({
|
|||||||
var nodeGraph = this._buildNodeGraph(nodeModel, this.isReadOnly());
|
var nodeGraph = this._buildNodeGraph(nodeModel, this.isReadOnly());
|
||||||
nodeGraph.setVisibility(false);
|
nodeGraph.setVisibility(false);
|
||||||
|
|
||||||
this._workspace.appendChild(nodeGraph);
|
this._workspace.append(nodeGraph);
|
||||||
for (var i = 0; i < children.length; i++) {
|
for (var i = 0; i < children.length; i++) {
|
||||||
var child = children[i];
|
var child = children[i];
|
||||||
if ($defined(child))
|
if ($defined(child))
|
||||||
@ -714,7 +720,7 @@ mindplot.Designer = new Class({
|
|||||||
|
|
||||||
result.setVisibility(sourceTopic.isVisible() && targetTopic.isVisible());
|
result.setVisibility(sourceTopic.isVisible() && targetTopic.isVisible());
|
||||||
|
|
||||||
this._workspace.appendChild(result);
|
this._workspace.append(result);
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -752,24 +758,25 @@ mindplot.Designer = new Class({
|
|||||||
|
|
||||||
// Build relationship line ....
|
// Build relationship line ....
|
||||||
var result = new mindplot.Relationship(sourceTopic, targetTopic, model);
|
var result = new mindplot.Relationship(sourceTopic, targetTopic, model);
|
||||||
|
var me = this;
|
||||||
|
|
||||||
result.addEvent('ontblur', function () {
|
result.addEvent('ontblur', function () {
|
||||||
var topics = this.getModel().filterSelectedTopics();
|
var topics = me.getModel().filterSelectedTopics();
|
||||||
var rels = this.getModel().filterSelectedRelationships();
|
var rels = me.getModel().filterSelectedRelationships();
|
||||||
|
|
||||||
if (topics.length == 0 || rels.length == 0) {
|
if (topics.length == 0 || rels.length == 0) {
|
||||||
this.fireEvent('onblur');
|
me.fireEvent('onblur');
|
||||||
}
|
}
|
||||||
}.bind(this));
|
});
|
||||||
|
|
||||||
result.addEvent('ontfocus', function () {
|
result.addEvent('ontfocus', function () {
|
||||||
var topics = this.getModel().filterSelectedTopics();
|
var topics = me.getModel().filterSelectedTopics();
|
||||||
var rels = this.getModel().filterSelectedRelationships();
|
var rels = me.getModel().filterSelectedRelationships();
|
||||||
|
|
||||||
if (topics.length == 1 || rels.length == 1) {
|
if (topics.length == 1 || rels.length == 1) {
|
||||||
this.fireEvent('onfocus');
|
me.fireEvent('onfocus');
|
||||||
}
|
}
|
||||||
}.bind(this));
|
});
|
||||||
|
|
||||||
// Append it to the workspace ...
|
// Append it to the workspace ...
|
||||||
dmodel.addRelationship(result);
|
dmodel.addRelationship(result);
|
||||||
|
@ -17,11 +17,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
mindplot.DesignerKeyboard = new Class({
|
mindplot.DesignerKeyboard = new Class({
|
||||||
Extends:Keyboard,
|
Extends: mindplot.Keyboard,
|
||||||
Static:{
|
Static:{
|
||||||
register:function (designer) {
|
register:function (designer) {
|
||||||
this._instance = new mindplot.DesignerKeyboard(designer);
|
this._instance = new mindplot.DesignerKeyboard(designer);
|
||||||
this._instance.activate();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
getInstance:function () {
|
getInstance:function () {
|
||||||
@ -31,360 +30,250 @@ mindplot.DesignerKeyboard = new Class({
|
|||||||
|
|
||||||
initialize:function (designer) {
|
initialize:function (designer) {
|
||||||
$assert(designer, "designer can not be null");
|
$assert(designer, "designer can not be null");
|
||||||
this.parent({defaultEventType:'keydown'});
|
|
||||||
this._registerEvents(designer);
|
this._registerEvents(designer);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
_registerEvents:function (designer) {
|
_registerEvents:function (designer) {
|
||||||
|
|
||||||
// Try with the keyboard ..
|
// Try with the keyboard ..
|
||||||
var model = designer.getModel();
|
var model = designer.getModel();
|
||||||
var keyboardEvents = {
|
this.addShortcut(
|
||||||
'backspace':function (event) {
|
['backspace'], function (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
||||||
designer.deleteSelectedEntities();
|
designer.deleteSelectedEntities();
|
||||||
|
}
|
||||||
}.bind(this),
|
);
|
||||||
|
this.addShortcut(
|
||||||
'space':function () {
|
['space'], function() {
|
||||||
designer.shrinkSelectedBranch();
|
designer.shrinkSelectedBranch();
|
||||||
}.bind(this),
|
}
|
||||||
|
);
|
||||||
'f2':function () {
|
this.addShortcut(
|
||||||
|
['f2'],function() {
|
||||||
var node = model.selectedTopic();
|
var node = model.selectedTopic();
|
||||||
if (node) {
|
if (node) {
|
||||||
node.showTextEditor();
|
node.showTextEditor();
|
||||||
}
|
}
|
||||||
}.bind(this),
|
}
|
||||||
|
);
|
||||||
'delete':function (event) {
|
this.addShortcut(
|
||||||
|
['del'], function(event) {
|
||||||
designer.deleteSelectedEntities();
|
designer.deleteSelectedEntities();
|
||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
}.bind(this),
|
}
|
||||||
|
);
|
||||||
'enter':function () {
|
this.addShortcut(
|
||||||
|
['enter'], function() {
|
||||||
designer.createSiblingForSelectedNode();
|
designer.createSiblingForSelectedNode();
|
||||||
}.bind(this),
|
}
|
||||||
|
);
|
||||||
'insert':function (event) {
|
this.addShortcut(
|
||||||
|
['insert'], function(event) {
|
||||||
designer.createChildForSelectedNode();
|
designer.createChildForSelectedNode();
|
||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
}.bind(this),
|
}
|
||||||
|
);
|
||||||
'tab':function (event) {
|
this.addShortcut(
|
||||||
|
['tab'], function(event) {
|
||||||
designer.createChildForSelectedNode();
|
designer.createChildForSelectedNode();
|
||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
}.bind(this),
|
}
|
||||||
|
);
|
||||||
'-':function () { // "-" is a insert on several Browsers. Don't ask why ...
|
this.addShortcut(
|
||||||
|
'-', function() { // "-" is a insert on several Browsers. Don't ask why ...
|
||||||
designer.createChildForSelectedNode();
|
designer.createChildForSelectedNode();
|
||||||
}.bind(this),
|
}
|
||||||
|
);
|
||||||
'meta+enter':function (event) {
|
this.addShortcut(
|
||||||
|
['meta+enter'], function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
designer.createChildForSelectedNode();
|
designer.createChildForSelectedNode();
|
||||||
|
}
|
||||||
}.bind(this),
|
);
|
||||||
|
this.addShortcut(
|
||||||
'ctrl+z':function (event) {
|
['ctrl+z', 'meta+z'], function(event) {
|
||||||
event.preventDefault(event);
|
event.preventDefault(event);
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
designer.undo();
|
designer.undo();
|
||||||
}.bind(this),
|
}
|
||||||
|
);
|
||||||
'meta+z':function (event) {
|
this.addShortcut(
|
||||||
event.preventDefault();
|
['ctrl+c', 'meta+c'], function (event) {
|
||||||
event.stopPropagation();
|
|
||||||
|
|
||||||
designer.undo();
|
|
||||||
|
|
||||||
}.bind(this),
|
|
||||||
|
|
||||||
'ctrl+c':function (event) {
|
|
||||||
event.preventDefault(event);
|
event.preventDefault(event);
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
designer.copyToClipboard();
|
designer.copyToClipboard();
|
||||||
}.bind(this),
|
}
|
||||||
|
);
|
||||||
'meta+c':function (event) {
|
this.addShortcut(
|
||||||
event.preventDefault();
|
['ctrl+v', 'meta+v'], function (event) {
|
||||||
event.stopPropagation();
|
|
||||||
|
|
||||||
designer.copyToClipboard();
|
|
||||||
|
|
||||||
}.bind(this),
|
|
||||||
|
|
||||||
'ctrl+v':function (event) {
|
|
||||||
event.preventDefault(event);
|
event.preventDefault(event);
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
||||||
designer.pasteClipboard();
|
designer.pasteClipboard();
|
||||||
}.bind(this),
|
}
|
||||||
|
);
|
||||||
'meta+v':function (event) {
|
this.addShortcut(
|
||||||
|
['ctrl+shift+z', 'meta+shift+z', 'ctrl+y', 'meta+y'], function (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
||||||
designer.pasteClipboard();
|
|
||||||
|
|
||||||
}.bind(this),
|
|
||||||
|
|
||||||
'ctrl+z+shift':function (event) {
|
|
||||||
event.preventDefault();
|
|
||||||
event.stopPropagation();
|
|
||||||
|
|
||||||
designer.redo();
|
designer.redo();
|
||||||
}.bind(this),
|
}
|
||||||
|
);
|
||||||
'meta+z+shift':function (event) {
|
this.addShortcut(
|
||||||
|
['ctrl+a', 'meta+a'], function (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
||||||
designer.redo();
|
|
||||||
}.bind(this),
|
|
||||||
|
|
||||||
'ctrl+y':function (event) {
|
|
||||||
event.preventDefault();
|
|
||||||
event.stopPropagation();
|
|
||||||
|
|
||||||
designer.redo();
|
|
||||||
|
|
||||||
}.bind(this),
|
|
||||||
|
|
||||||
'meta+y':function (event) {
|
|
||||||
event.preventDefault();
|
|
||||||
event.stopPropagation();
|
|
||||||
|
|
||||||
designer.redo();
|
|
||||||
|
|
||||||
}.bind(this),
|
|
||||||
|
|
||||||
'ctrl+a':function (event) {
|
|
||||||
event.preventDefault();
|
|
||||||
event.stopPropagation();
|
|
||||||
|
|
||||||
designer.selectAll();
|
designer.selectAll();
|
||||||
},
|
}
|
||||||
|
);
|
||||||
'ctrl+b':function (event) {
|
this.addShortcut(
|
||||||
|
['ctrl+b', 'meta+b'], function (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
||||||
designer.changeFontWeight();
|
designer.changeFontWeight();
|
||||||
},
|
}
|
||||||
|
);
|
||||||
'meta+b':function (event) {
|
this.addShortcut(
|
||||||
|
['ctrl+s', 'meta+s'], function (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
$(document).find('#save').trigger('click');
|
||||||
designer.changeFontWeight();
|
}
|
||||||
},
|
);
|
||||||
|
this.addShortcut(
|
||||||
'ctrl+s':function (event) {
|
['ctrl+i', 'meta+i'], function (event) {
|
||||||
event.preventDefault();
|
|
||||||
event.stopPropagation();
|
|
||||||
$('save').fireEvent('click');
|
|
||||||
},
|
|
||||||
|
|
||||||
'meta+s':function (event) {
|
|
||||||
event.preventDefault();
|
|
||||||
event.stopPropagation();
|
|
||||||
|
|
||||||
$('save').fireEvent('click');
|
|
||||||
},
|
|
||||||
|
|
||||||
'ctrl+i':function (event) {
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
||||||
designer.changeFontStyle();
|
designer.changeFontStyle();
|
||||||
},
|
}
|
||||||
|
);
|
||||||
'meta+i':function (event) {
|
this.addShortcut(
|
||||||
event.preventDefault();
|
['ctrl+shift+a', 'meta+shift+a'], function (event) {
|
||||||
event.stopPropagation();
|
|
||||||
|
|
||||||
designer.changeFontStyle();
|
|
||||||
},
|
|
||||||
|
|
||||||
'meta+shift+a':function (event) {
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
||||||
designer.deselectAll();
|
designer.deselectAll();
|
||||||
},
|
}
|
||||||
|
);
|
||||||
'ctrl+shift+a':function (event) {
|
this.addShortcut(
|
||||||
event.preventDefault();
|
['meta+=', 'ctrl+='], function (event) {
|
||||||
event.stopPropagation();
|
|
||||||
|
|
||||||
designer.deselectAll();
|
|
||||||
},
|
|
||||||
|
|
||||||
'meta+a':function (event) {
|
|
||||||
event.preventDefault();
|
|
||||||
event.stopPropagation();
|
|
||||||
|
|
||||||
designer.selectAll();
|
|
||||||
},
|
|
||||||
|
|
||||||
'meta+=':function (event) {
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
||||||
designer.zoomIn();
|
designer.zoomIn();
|
||||||
},
|
}
|
||||||
|
);
|
||||||
'meta+-':function (event) {
|
this.addShortcut(
|
||||||
|
['meta+-', 'ctrl+-'], function (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
||||||
designer.zoomOut();
|
designer.zoomOut();
|
||||||
},
|
}
|
||||||
|
);
|
||||||
'ctrl+=':function (event) {
|
var me = this;
|
||||||
event.preventDefault();
|
this.addShortcut(
|
||||||
event.stopPropagation();
|
'right', function (event) {
|
||||||
|
|
||||||
designer.zoomIn();
|
|
||||||
},
|
|
||||||
|
|
||||||
'ctrl+-':function (event) {
|
|
||||||
event.preventDefault();
|
|
||||||
event.stopPropagation();
|
|
||||||
|
|
||||||
designer.zoomOut();
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
'right':function (event) {
|
|
||||||
var node = model.selectedTopic();
|
var node = model.selectedTopic();
|
||||||
if (node) {
|
if (node) {
|
||||||
if (node.isCentralTopic()) {
|
if (node.isCentralTopic()) {
|
||||||
this._goToSideChild(designer, node, 'RIGHT');
|
me._goToSideChild(designer, node, 'RIGHT');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (node.getPosition().x < 0) {
|
if (node.getPosition().x < 0) {
|
||||||
this._goToParent(designer, node);
|
me._goToParent(designer, node);
|
||||||
}
|
}
|
||||||
else if (!node.areChildrenShrunken()) {
|
else if (!node.areChildrenShrunken()) {
|
||||||
this._goToChild(designer, node);
|
me._goToChild(designer, node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var centralTopic = model.getCentralTopic();
|
var centralTopic = model.getCentralTopic();
|
||||||
this._goToNode(designer, centralTopic);
|
me._goToNode(designer, centralTopic);
|
||||||
}
|
}
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
}.bind(this),
|
}
|
||||||
|
);
|
||||||
'left':function (event) {
|
this.addShortcut(
|
||||||
|
'left', function (event) {
|
||||||
var node = model.selectedTopic();
|
var node = model.selectedTopic();
|
||||||
if (node) {
|
if (node) {
|
||||||
if (node.isCentralTopic()) {
|
if (node.isCentralTopic()) {
|
||||||
this._goToSideChild(designer, node, 'LEFT');
|
me._goToSideChild(designer, node, 'LEFT');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (node.getPosition().x > 0) {
|
if (node.getPosition().x > 0) {
|
||||||
this._goToParent(designer, node);
|
me._goToParent(designer, node);
|
||||||
}
|
}
|
||||||
else if (!node.areChildrenShrunken()) {
|
else if (!node.areChildrenShrunken()) {
|
||||||
this._goToChild(designer, node);
|
me._goToChild(designer, node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var centralTopic = model.getCentralTopic();
|
var centralTopic = model.getCentralTopic();
|
||||||
this._goToNode(designer, centralTopic);
|
me._goToNode(designer, centralTopic);
|
||||||
}
|
}
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
}.bind(this),
|
|
||||||
|
|
||||||
'up':function (event) {
|
|
||||||
var node = model.selectedTopic();
|
|
||||||
if (node) {
|
|
||||||
if (!node.isCentralTopic()) {
|
|
||||||
this._goToBrother(designer, node, 'UP');
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
var centralTopic = model.getCentralTopic();
|
|
||||||
this._goToNode(designer, centralTopic);
|
|
||||||
}
|
|
||||||
event.preventDefault();
|
|
||||||
event.stopPropagation();
|
|
||||||
}.bind(this),
|
|
||||||
|
|
||||||
'down':function (event) {
|
|
||||||
var node = model.selectedTopic();
|
|
||||||
if (node) {
|
|
||||||
if (!node.isCentralTopic()) {
|
|
||||||
this._goToBrother(designer, node, 'DOWN');
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
var centralTopic = model.getCentralTopic();
|
|
||||||
this._goToNode(designer, centralTopic);
|
|
||||||
}
|
|
||||||
event.preventDefault();
|
|
||||||
event.stopPropagation();
|
|
||||||
}.bind(this)
|
|
||||||
};
|
|
||||||
this.addEvents(keyboardEvents);
|
|
||||||
|
|
||||||
var regex = /^(?:shift|control|ctrl|alt|meta)$/;
|
|
||||||
var modifiers = ['shift', 'control', 'alt', 'meta'];
|
|
||||||
|
|
||||||
var excludes = ['esc', 'capslock', 'tab', 'f1', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', 'f10', 'f11', 'f12', 'backspace', 'down', 'up', 'left', 'right', 'control'];
|
|
||||||
if (!Browser.Platform.mac) {
|
|
||||||
// This is to avoid enter on edition mode in the node when alt+tab is pressed.
|
|
||||||
excludes.push("alt");
|
|
||||||
}
|
|
||||||
|
|
||||||
$(document).addEvent('keydown', function (event) {
|
|
||||||
|
|
||||||
// Convert key to mootools keyboard event format...
|
|
||||||
var keys = [];
|
|
||||||
modifiers.each(function (mod) {
|
|
||||||
if (event[mod]) keys.push(mod);
|
|
||||||
});
|
|
||||||
if (!regex.test(event.key))
|
|
||||||
keys.push(event.key);
|
|
||||||
var key = keys.join('+');
|
|
||||||
|
|
||||||
// Is the pressed key one of the already registered in the keyboard ?
|
|
||||||
var isRegistered = false;
|
|
||||||
for (var eKey in keyboardEvents) {
|
|
||||||
if (eKey == key) {
|
|
||||||
isRegistered = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
);
|
||||||
|
this.addShortcut(
|
||||||
|
'up', function (event) {
|
||||||
|
var node = model.selectedTopic();
|
||||||
|
if (node) {
|
||||||
|
if (!node.isCentralTopic()) {
|
||||||
|
me._goToBrother(designer, node, 'UP');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
var centralTopic = model.getCentralTopic();
|
||||||
|
me._goToNode(designer, centralTopic);
|
||||||
|
}
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
this.addShortcut(
|
||||||
|
'down', function (event) {
|
||||||
|
var node = model.selectedTopic();
|
||||||
|
if (node) {
|
||||||
|
if (!node.isCentralTopic()) {
|
||||||
|
me._goToBrother(designer, node, 'DOWN');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
var centralTopic = model.getCentralTopic();
|
||||||
|
me._goToNode(designer, centralTopic);
|
||||||
|
}
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
// If it's not registered, let's
|
$(document).on('keypress', function (event) {
|
||||||
if (!isRegistered && !excludes.contains(key) && !excludes.contains(event.key) && !event.meta && !event.control) {
|
|
||||||
|
var keyCode = event.keyCode;
|
||||||
|
|
||||||
|
var specialKey = jQuery.hotkeys.specialKeys[keyCode];
|
||||||
|
if (["enter", "capslock"].indexOf(specialKey) == -1 && !jQuery.hotkeys.shiftNums[keyCode] && keyCode != 91 /*win key*/) {
|
||||||
var nodes = designer.getModel().filterSelectedTopics();
|
var nodes = designer.getModel().filterSelectedTopics();
|
||||||
if (nodes.length > 0) {
|
if (nodes.length > 0) {
|
||||||
|
|
||||||
// If a modifier is press, the key selected must be ignored.
|
// If a modifier is press, the key selected must be ignored.
|
||||||
var pressKey = event.key;
|
var pressKey = String.fromCharCode(keyCode);
|
||||||
if (modifiers.contains(event.key)) {
|
if (event.ctrlKey || event.altKey || event.metaKey) {
|
||||||
pressKey = "";
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
nodes[0].showTextEditor(pressKey);
|
nodes[0].showTextEditor(pressKey);
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
mindplot.DesignerModel = new Class({
|
mindplot.DesignerModel = new Class({
|
||||||
Implements:[Events],
|
Implements:[mindplot.Events],
|
||||||
initialize:function (options) {
|
initialize:function (options) {
|
||||||
this._zoom = options.zoom;
|
this._zoom = options.zoom;
|
||||||
this._topics = [];
|
this._topics = [];
|
||||||
|
@ -84,15 +84,16 @@ mindplot.DragConnector = new Class({
|
|||||||
// - Horizontal proximity
|
// - Horizontal proximity
|
||||||
// - It's already connected.
|
// - It's already connected.
|
||||||
var currentConnection = dragTopic.getConnectedToTopic();
|
var currentConnection = dragTopic.getConnectedToTopic();
|
||||||
|
var me = this;
|
||||||
topics = topics.sort(function (a, b) {
|
topics = topics.sort(function (a, b) {
|
||||||
var aPos = a.getPosition();
|
var aPos = a.getPosition();
|
||||||
var bPos = b.getPosition();
|
var bPos = b.getPosition();
|
||||||
|
|
||||||
var av = this._isVerticallyAligned(a.getSize(), aPos, sPos);
|
var av = me._isVerticallyAligned(a.getSize(), aPos, sPos);
|
||||||
var bv = this._isVerticallyAligned(b.getSize(), bPos, sPos);
|
var bv = me._isVerticallyAligned(b.getSize(), bPos, sPos);
|
||||||
return this._proximityWeight(av, a, sPos, currentConnection) - this._proximityWeight(bv, b, sPos, currentConnection);
|
return me._proximityWeight(av, a, sPos, currentConnection) - me._proximityWeight(bv, b, sPos, currentConnection);
|
||||||
|
|
||||||
}.bind(this));
|
});
|
||||||
return topics;
|
return topics;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -31,14 +31,14 @@ mindplot.DragManager = new Class({
|
|||||||
var workspace = this._workspace;
|
var workspace = this._workspace;
|
||||||
var screen = workspace.getScreenManager();
|
var screen = workspace.getScreenManager();
|
||||||
var dragManager = this;
|
var dragManager = this;
|
||||||
|
var me = this;
|
||||||
var mouseDownListener = function(event) {
|
var mouseDownListener = function(event) {
|
||||||
if (workspace.isWorkspaceEventsEnabled()) {
|
if (workspace.isWorkspaceEventsEnabled()) {
|
||||||
// Disable double drag...
|
// Disable double drag...
|
||||||
workspace.enableWorkspaceEvents(false);
|
workspace.enableWorkspaceEvents(false);
|
||||||
|
|
||||||
// Set initial position.
|
// Set initial position.
|
||||||
var layoutManager = this._eventDispatcher.getLayoutManager();
|
var layoutManager = me._eventDispatcher.getLayoutManager();
|
||||||
var dragNode = node.createDragNode(layoutManager);
|
var dragNode = node.createDragNode(layoutManager);
|
||||||
|
|
||||||
// Register mouse move listener ...
|
// Register mouse move listener ...
|
||||||
@ -52,7 +52,7 @@ mindplot.DragManager = new Class({
|
|||||||
// Change cursor.
|
// Change cursor.
|
||||||
window.document.body.style.cursor = 'move';
|
window.document.body.style.cursor = 'move';
|
||||||
}
|
}
|
||||||
}.bind(this);
|
};
|
||||||
node.addEvent('mousedown', mouseDownListener);
|
node.addEvent('mousedown', mouseDownListener);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -70,18 +70,18 @@ mindplot.DragManager = new Class({
|
|||||||
|
|
||||||
_buildMouseMoveListener : function(workspace, dragNode, dragManager) {
|
_buildMouseMoveListener : function(workspace, dragNode, dragManager) {
|
||||||
var screen = workspace.getScreenManager();
|
var screen = workspace.getScreenManager();
|
||||||
|
var me = this;
|
||||||
var result = function(event) {
|
var result = function(event) {
|
||||||
|
|
||||||
if (!this._isDragInProcess) {
|
if (!me._isDragInProcess) {
|
||||||
// Execute Listeners ..
|
// Execute Listeners ..
|
||||||
var startDragListener = dragManager._listeners['startdragging'];
|
var startDragListener = dragManager._listeners['startdragging'];
|
||||||
startDragListener(event, dragNode);
|
startDragListener(event, dragNode);
|
||||||
|
|
||||||
// Add shadow node to the workspace.
|
// Add shadow node to the workspace.
|
||||||
workspace.appendChild(dragNode);
|
workspace.append(dragNode);
|
||||||
|
|
||||||
this._isDragInProcess = true;
|
me._isDragInProcess = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
var pos = screen.getWorkspaceMousePosition(event);
|
var pos = screen.getWorkspaceMousePosition(event);
|
||||||
@ -95,13 +95,14 @@ mindplot.DragManager = new Class({
|
|||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
}.bind(this);
|
};
|
||||||
dragManager._mouseMoveListener = result;
|
dragManager._mouseMoveListener = result;
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
|
|
||||||
_buildMouseUpListener : function(workspace, node, dragNode, dragManager) {
|
_buildMouseUpListener : function(workspace, node, dragNode, dragManager) {
|
||||||
var screen = workspace.getScreenManager();
|
var screen = workspace.getScreenManager();
|
||||||
|
var me = this;
|
||||||
var result = function(event) {
|
var result = function(event) {
|
||||||
$assert(dragNode.isDragTopic, 'dragNode must be an DragTopic');
|
$assert(dragNode.isDragTopic, 'dragNode must be an DragTopic');
|
||||||
|
|
||||||
@ -117,7 +118,7 @@ mindplot.DragManager = new Class({
|
|||||||
// Change the cursor to the default.
|
// Change the cursor to the default.
|
||||||
window.document.body.style.cursor = 'default';
|
window.document.body.style.cursor = 'default';
|
||||||
|
|
||||||
if (this._isDragInProcess) {
|
if (me._isDragInProcess) {
|
||||||
|
|
||||||
// Execute Listeners only if the node has been moved.
|
// Execute Listeners only if the node has been moved.
|
||||||
var endDragListener = dragManager._listeners['enddragging'];
|
var endDragListener = dragManager._listeners['enddragging'];
|
||||||
@ -126,11 +127,11 @@ mindplot.DragManager = new Class({
|
|||||||
// Remove drag node from the workspace.
|
// Remove drag node from the workspace.
|
||||||
dragNode.removeFromWorkspace(workspace);
|
dragNode.removeFromWorkspace(workspace);
|
||||||
|
|
||||||
this._isDragInProcess = false;
|
me._isDragInProcess = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}.bind(this);
|
};
|
||||||
dragManager._mouseUpListener = result;
|
dragManager._mouseUpListener = result;
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
|
@ -146,27 +146,27 @@ mindplot.DragPivot = new Class({
|
|||||||
|
|
||||||
addToWorkspace : function(workspace) {
|
addToWorkspace : function(workspace) {
|
||||||
var pivotRect = this._getPivotRect();
|
var pivotRect = this._getPivotRect();
|
||||||
workspace.appendChild(pivotRect);
|
workspace.append(pivotRect);
|
||||||
|
|
||||||
var connectToRect = this._connectRect;
|
var connectToRect = this._connectRect;
|
||||||
workspace.appendChild(connectToRect);
|
workspace.append(connectToRect);
|
||||||
|
|
||||||
// Add a hidden straight line ...
|
// Add a hidden straight line ...
|
||||||
var straighLine = this._straightLine;
|
var straighLine = this._straightLine;
|
||||||
straighLine.setVisibility(false);
|
straighLine.setVisibility(false);
|
||||||
workspace.appendChild(straighLine);
|
workspace.append(straighLine);
|
||||||
straighLine.moveToBack();
|
straighLine.moveToBack();
|
||||||
|
|
||||||
// Add a hidden curved line ...
|
// Add a hidden curved line ...
|
||||||
var curvedLine = this._curvedLine;
|
var curvedLine = this._curvedLine;
|
||||||
curvedLine.setVisibility(false);
|
curvedLine.setVisibility(false);
|
||||||
workspace.appendChild(curvedLine);
|
workspace.append(curvedLine);
|
||||||
curvedLine.moveToBack();
|
curvedLine.moveToBack();
|
||||||
|
|
||||||
// Add a connect rect ...
|
// Add a connect rect ...
|
||||||
var connectRect = this._connectRect;
|
var connectRect = this._connectRect;
|
||||||
connectRect.setVisibility(false);
|
connectRect.setVisibility(false);
|
||||||
workspace.appendChild(connectRect);
|
workspace.append(connectRect);
|
||||||
connectRect.moveToBack();
|
connectRect.moveToBack();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ mindplot.DragTopic = new Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
updateFreeLayout:function (event) {
|
updateFreeLayout:function (event) {
|
||||||
var isFreeEnabled = (event.meta && Browser.Platform.mac) || (event.control && !Browser.Platform.mac);
|
var isFreeEnabled = (event.metaKey && Browser.Platform.mac) || (event.ctrlKey && !Browser.Platform.mac);
|
||||||
if (this.isFreeLayoutOn() != isFreeEnabled) {
|
if (this.isFreeLayoutOn() != isFreeEnabled) {
|
||||||
var dragPivot = this._getDragPivot();
|
var dragPivot = this._getDragPivot();
|
||||||
dragPivot.setVisibility(!isFreeEnabled);
|
dragPivot.setVisibility(!isFreeEnabled);
|
||||||
@ -133,7 +133,7 @@ mindplot.DragTopic = new Class({
|
|||||||
|
|
||||||
addToWorkspace:function (workspace) {
|
addToWorkspace:function (workspace) {
|
||||||
if (!this._isInWorkspace) {
|
if (!this._isInWorkspace) {
|
||||||
workspace.appendChild(this._elem2d);
|
workspace.append(this._elem2d);
|
||||||
var dragPivot = this._getDragPivot();
|
var dragPivot = this._getDragPivot();
|
||||||
dragPivot.addToWorkspace(workspace);
|
dragPivot.addToWorkspace(workspace);
|
||||||
this._isInWorkspace = true;
|
this._isInWorkspace = true;
|
||||||
@ -201,7 +201,7 @@ mindplot.DragTopic.init = function (workspace) {
|
|||||||
|
|
||||||
$assert(workspace, "workspace can not be null");
|
$assert(workspace, "workspace can not be null");
|
||||||
var pivot = mindplot.DragTopic.__getDragPivot();
|
var pivot = mindplot.DragTopic.__getDragPivot();
|
||||||
workspace.appendChild(pivot);
|
workspace.append(pivot);
|
||||||
};
|
};
|
||||||
|
|
||||||
mindplot.DragTopic.__getDragPivot = function () {
|
mindplot.DragTopic.__getDragPivot = function () {
|
||||||
|
41
mindplot/src/main/javascript/Events.js
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
mindplot.Events = new Class({
|
||||||
|
|
||||||
|
$events: {},
|
||||||
|
|
||||||
|
_removeOn: function(string){
|
||||||
|
return string.replace(/^on([A-Z])/, function(full, first){
|
||||||
|
return first.toLowerCase();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
addEvent: function(type, fn, internal){
|
||||||
|
type = this._removeOn(type);
|
||||||
|
|
||||||
|
this.$events[type] = (this.$events[type] || []).include(fn);
|
||||||
|
if (internal) fn.internal = true;
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
|
fireEvent: function(type, args, delay){
|
||||||
|
type = this._removeOn(type);
|
||||||
|
var events = this.$events[type];
|
||||||
|
if (!events) return this;
|
||||||
|
args = Array.from(args);
|
||||||
|
_.each(events, function(fn){
|
||||||
|
if (delay) fn.delay(delay, this, args);
|
||||||
|
else fn.apply(this, args);
|
||||||
|
}, this);
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
|
removeEvent: function(type, fn){
|
||||||
|
type = this._removeOn(type);
|
||||||
|
var events = this.$events[type];
|
||||||
|
if (events && !fn.internal){
|
||||||
|
var index = events.indexOf(fn);
|
||||||
|
if (index != -1) events.splice(index, 1);
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
@ -62,7 +62,7 @@ mindplot.IconGroup = new Class({
|
|||||||
this._positionIcon(icon, this._icons.length - 1);
|
this._positionIcon(icon, this._icons.length - 1);
|
||||||
|
|
||||||
var imageShape = icon.getImage();
|
var imageShape = icon.getImage();
|
||||||
this._group.appendChild(imageShape);
|
this._group.append(imageShape);
|
||||||
|
|
||||||
// Register event for the group ..
|
// Register event for the group ..
|
||||||
if (remove) {
|
if (remove) {
|
||||||
@ -72,7 +72,7 @@ mindplot.IconGroup = new Class({
|
|||||||
|
|
||||||
_findIconFromModel:function (iconModel) {
|
_findIconFromModel:function (iconModel) {
|
||||||
var result = null;
|
var result = null;
|
||||||
this._icons.each(function (icon) {
|
_.each(this._icons, function (icon) {
|
||||||
var elModel = icon.getModel();
|
var elModel = icon.getModel();
|
||||||
if (elModel.getId() == iconModel.getId()) {
|
if (elModel.getId() == iconModel.getId()) {
|
||||||
result = icon;
|
result = icon;
|
||||||
@ -101,11 +101,11 @@ mindplot.IconGroup = new Class({
|
|||||||
|
|
||||||
this._icons.erase(icon);
|
this._icons.erase(icon);
|
||||||
this._resize(this._icons.length);
|
this._resize(this._icons.length);
|
||||||
|
var me = this;
|
||||||
// Add all again ...
|
// Add all again ...
|
||||||
this._icons.each(function (elem, i) {
|
_.each(this._icons, function (elem, i) {
|
||||||
this._positionIcon(elem, i);
|
me._positionIcon(elem, i);
|
||||||
}.bind(this));
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
moveToFront:function () {
|
moveToFront:function () {
|
||||||
@ -166,16 +166,18 @@ mindplot.IconGroup.RemoveTip = new Class({
|
|||||||
icon.remove();
|
icon.remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var me = this;
|
||||||
|
|
||||||
widget.addEvent('mouseover', function () {
|
widget.addEvent('mouseover', function () {
|
||||||
this.show(topicId, icon);
|
me.show(topicId, icon);
|
||||||
}.bind(this));
|
});
|
||||||
|
|
||||||
widget.addEvent('mouseout', function () {
|
widget.addEvent('mouseout', function () {
|
||||||
this.hide();
|
me.hide();
|
||||||
}.bind(this));
|
});
|
||||||
|
|
||||||
widget.setPosition(pos.x + 80, pos.y - 50);
|
widget.setPosition(pos.x + 80, pos.y - 50);
|
||||||
this._fadeElem.appendChild(widget);
|
this._fadeElem.append(widget);
|
||||||
|
|
||||||
// Setup current element ...
|
// Setup current element ...
|
||||||
this._activeIcon = icon;
|
this._activeIcon = icon;
|
||||||
@ -197,17 +199,15 @@ mindplot.IconGroup.RemoveTip = new Class({
|
|||||||
clearTimeout(this._closeTimeoutId)
|
clearTimeout(this._closeTimeoutId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var me = this;
|
||||||
if (this._activeIcon) {
|
if (this._activeIcon) {
|
||||||
var widget = this._widget;
|
var widget = this._widget;
|
||||||
var close = function () {
|
var close = function () {
|
||||||
|
me._activeIcon = null;
|
||||||
this._activeIcon = null;
|
me._fadeElem.removeChild(widget);
|
||||||
this._fadeElem.removeChild(widget);
|
me._widget = null;
|
||||||
this._widget = null;
|
me._closeTimeoutId = null;
|
||||||
|
};
|
||||||
this._closeTimeoutId = null;
|
|
||||||
|
|
||||||
}.bind(this);
|
|
||||||
|
|
||||||
if (!$defined(delay) || delay == 0) {
|
if (!$defined(delay) || delay == 0) {
|
||||||
close();
|
close();
|
||||||
@ -236,7 +236,7 @@ mindplot.IconGroup.RemoveTip = new Class({
|
|||||||
stroke:'0',
|
stroke:'0',
|
||||||
fillColor:'black'
|
fillColor:'black'
|
||||||
});
|
});
|
||||||
result.appendChild(outerRect);
|
result.append(outerRect);
|
||||||
outerRect.setCursor('pointer');
|
outerRect.setCursor('pointer');
|
||||||
|
|
||||||
var innerRect = new web2d.Rect(0, {
|
var innerRect = new web2d.Rect(0, {
|
||||||
@ -247,17 +247,17 @@ mindplot.IconGroup.RemoveTip = new Class({
|
|||||||
stroke:'1 solid white',
|
stroke:'1 solid white',
|
||||||
fillColor:'gray'
|
fillColor:'gray'
|
||||||
});
|
});
|
||||||
result.appendChild(innerRect);
|
result.append(innerRect);
|
||||||
|
|
||||||
var line = new web2d.Line({stroke:'1 solid white'});
|
var line = new web2d.Line({stroke:'1 solid white'});
|
||||||
line.setFrom(1, 1);
|
line.setFrom(1, 1);
|
||||||
line.setTo(9, 9);
|
line.setTo(9, 9);
|
||||||
result.appendChild(line);
|
result.append(line);
|
||||||
|
|
||||||
var line2 = new web2d.Line({stroke:'1 solid white'});
|
var line2 = new web2d.Line({stroke:'1 solid white'});
|
||||||
line2.setFrom(1, 9);
|
line2.setFrom(1, 9);
|
||||||
line2.setTo(9, 1);
|
line2.setTo(9, 1);
|
||||||
result.appendChild(line2);
|
result.append(line2);
|
||||||
|
|
||||||
// Some events ...
|
// Some events ...
|
||||||
result.addEvent('mouseover', function () {
|
result.addEvent('mouseover', function () {
|
||||||
@ -273,14 +273,16 @@ mindplot.IconGroup.RemoveTip = new Class({
|
|||||||
|
|
||||||
decorate:function (topicId, icon) {
|
decorate:function (topicId, icon) {
|
||||||
|
|
||||||
|
var me = this;
|
||||||
|
|
||||||
if (!icon.__remove) {
|
if (!icon.__remove) {
|
||||||
icon.addEvent('mouseover', function () {
|
icon.addEvent('mouseover', function () {
|
||||||
this.show(topicId, icon);
|
me.show(topicId, icon);
|
||||||
}.bind(this));
|
});
|
||||||
|
|
||||||
icon.addEvent('mouseout', function () {
|
icon.addEvent('mouseout', function () {
|
||||||
this.hide();
|
me.hide();
|
||||||
}.bind(this));
|
});
|
||||||
icon.__remove = true;
|
icon.__remove = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,16 +34,17 @@ mindplot.ImageIcon = new Class({
|
|||||||
|
|
||||||
//Icon
|
//Icon
|
||||||
var image = this.getImage();
|
var image = this.getImage();
|
||||||
|
var me = this;
|
||||||
image.addEvent('click', function () {
|
image.addEvent('click', function () {
|
||||||
|
|
||||||
var iconType = iconModel.getIconType();
|
var iconType = iconModel.getIconType();
|
||||||
var newIconType = this._getNextFamilyIconId(iconType);
|
var newIconType = me._getNextFamilyIconId(iconType);
|
||||||
iconModel.setIconType(newIconType);
|
iconModel.setIconType(newIconType);
|
||||||
|
|
||||||
var imgUrl = this._getImageUrl(newIconType);
|
var imgUrl = me._getImageUrl(newIconType);
|
||||||
this._image.setHref(imgUrl);
|
me._image.setHref(imgUrl);
|
||||||
|
|
||||||
}.bind(this));
|
});
|
||||||
this._image.setCursor('pointer');
|
this._image.setCursor('pointer');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
33
mindplot/src/main/javascript/Keyboard.js
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* Copyright [2012] [wisemapping]
|
||||||
|
*
|
||||||
|
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||||
|
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||||
|
* "powered by wisemapping" text requirement on every single page;
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the license at
|
||||||
|
*
|
||||||
|
* http://www.wisemapping.org/license
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
mindplot.Keyboard = new Class({
|
||||||
|
|
||||||
|
initialize:function () {
|
||||||
|
},
|
||||||
|
|
||||||
|
addShortcut: function(shortcuts, callback) {
|
||||||
|
if (!$.isArray(shortcuts)) {
|
||||||
|
shortcuts = [shortcuts];
|
||||||
|
}
|
||||||
|
_.each(shortcuts, function(shortcut) {
|
||||||
|
$(document).bind('keydown', shortcut, callback);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
@ -33,16 +33,30 @@ mindplot.LinkIcon = new Class({
|
|||||||
|
|
||||||
_registerEvents:function () {
|
_registerEvents:function () {
|
||||||
this._image.setCursor('pointer');
|
this._image.setCursor('pointer');
|
||||||
|
this._tip = new mindplot.widget.LinkIconTooltip(this);
|
||||||
|
|
||||||
|
var me = this;
|
||||||
if (!this._readOnly) {
|
if (!this._readOnly) {
|
||||||
// Add on click event to open the editor ...
|
// Add on click event to open the editor ...
|
||||||
this.addEvent('click', function (event) {
|
this.addEvent('click', function (event) {
|
||||||
this._topic.showLinkEditor();
|
me._tip.hide();
|
||||||
|
me._topic.showLinkEditor();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
}.bind(this));
|
});
|
||||||
|
//FIXME: we shouldn't have timeout of that..
|
||||||
|
this.addEvent("mouseleave", function(event) {
|
||||||
|
window.setTimeout(function() {
|
||||||
|
if (!$("#linkPopover:hover").length) {
|
||||||
|
me._tip.hide();
|
||||||
|
}
|
||||||
|
event.stopPropagation();
|
||||||
|
}, 100)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
this._tip = new mindplot.widget.LinkIconTooltip(this);
|
$(this.getImage()._peer._native).mouseenter(function() {
|
||||||
|
me._tip.show();
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
getModel:function () {
|
getModel:function () {
|
||||||
|
@ -35,25 +35,23 @@ mindplot.LocalStorageManager = new Class({
|
|||||||
loadMapDom:function (mapId) {
|
loadMapDom:function (mapId) {
|
||||||
var xml = localStorage.getItem(mapId + "-xml");
|
var xml = localStorage.getItem(mapId + "-xml");
|
||||||
if (xml == null || this.forceLoad) {
|
if (xml == null || this.forceLoad) {
|
||||||
var xmlRequest = new Request({
|
$.ajax({
|
||||||
url:this.documentUrl.replace("{id}", mapId),
|
url: this.documentUrl.replace("{id}", mapId),
|
||||||
headers:{"Content-Type":"text/plain","Accept":"application/xml"},
|
headers:{"Content-Type":"text/plain","Accept":"application/xml"},
|
||||||
method:'get',
|
type:'get',
|
||||||
async:false,
|
dataType: "text",
|
||||||
onSuccess:function (responseText) {
|
async: false,
|
||||||
xml = responseText;
|
success:function (response) {
|
||||||
|
xml = response;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
xmlRequest.send();
|
|
||||||
|
|
||||||
// If I could not load it from a file, hard code one.
|
// If I could not load it from a file, hard code one.
|
||||||
if (xml == null) {
|
if (xml == null) {
|
||||||
throw new Error("Map could not be loaded");
|
throw new Error("Map could not be loaded");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var parser = new DOMParser();
|
return jQuery.parseXML(xml);
|
||||||
return parser.parseFromString(xml, "text/xml");
|
|
||||||
},
|
},
|
||||||
|
|
||||||
unlockMap:function (mindmap) {
|
unlockMap:function (mindmap) {
|
||||||
|
@ -42,7 +42,7 @@ mindplot.MainTopic = new Class({
|
|||||||
// Create group ...
|
// Create group ...
|
||||||
var groupAttributes = {width:100, height:100, coordSizeWidth:100, coordSizeHeight:100};
|
var groupAttributes = {width:100, height:100, coordSizeWidth:100, coordSizeHeight:100};
|
||||||
var group = new web2d.Group(groupAttributes);
|
var group = new web2d.Group(groupAttributes);
|
||||||
group.appendChild(innerShape);
|
group.append(innerShape);
|
||||||
|
|
||||||
// Add Text ...
|
// Add Text ...
|
||||||
if (this.getShapeType() != mindplot.model.TopicShape.IMAGE) {
|
if (this.getShapeType() != mindplot.model.TopicShape.IMAGE) {
|
||||||
@ -50,7 +50,7 @@ mindplot.MainTopic = new Class({
|
|||||||
var text = this.getText();
|
var text = this.getText();
|
||||||
textShape.setText(text);
|
textShape.setText(text);
|
||||||
textShape.setOpacity(0.5);
|
textShape.setOpacity(0.5);
|
||||||
group.appendChild(textShape);
|
group.append(textShape);
|
||||||
}
|
}
|
||||||
return group;
|
return group;
|
||||||
},
|
},
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
mindplot.MultilineTextEditor = new Class({
|
mindplot.MultilineTextEditor = new Class({
|
||||||
Extends:Events,
|
Extends: mindplot.Events,
|
||||||
initialize:function () {
|
initialize:function () {
|
||||||
this._topic = null;
|
this._topic = null;
|
||||||
this._timeoutId = -1;
|
this._timeoutId = -1;
|
||||||
@ -25,47 +25,42 @@ mindplot.MultilineTextEditor = new Class({
|
|||||||
|
|
||||||
_buildEditor:function () {
|
_buildEditor:function () {
|
||||||
|
|
||||||
var result = new Element('div');
|
var result = $('<div></div>')
|
||||||
result.setStyles({
|
.attr('id', 'textContainer')
|
||||||
position:"absolute",
|
.css({
|
||||||
display:"none",
|
display:"none",
|
||||||
zIndex:"8",
|
zIndex:"8",
|
||||||
overflow:"hidden",
|
overflow:"hidden",
|
||||||
border:"0 none"
|
border:"0 none"
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
var textareaElem = new Element('textarea',
|
|
||||||
{ tabindex:'-1',
|
|
||||||
value:"",
|
|
||||||
wrap:'off'
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
textareaElem.setStyles({
|
var textareaElem = $('<textarea tabindex="-1" value="" wrap="off" ></textarea>')
|
||||||
border:"1px gray dashed",
|
.css({
|
||||||
background:"rgba(98, 135, 167, .3)",
|
border:"1px gray dashed",
|
||||||
outline:'0 none',
|
background:"rgba(98, 135, 167, .3)",
|
||||||
resize:'none',
|
outline:'0 none',
|
||||||
overflow:"hidden"
|
resize:'none',
|
||||||
});
|
overflow:"hidden"
|
||||||
textareaElem.inject(result);
|
});
|
||||||
|
|
||||||
|
result.append(textareaElem);
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
|
|
||||||
_registerEvents:function (containerElem) {
|
_registerEvents:function (containerElem) {
|
||||||
var textareaElem = this._getTextareaElem();
|
var textareaElem = this._getTextareaElem();
|
||||||
|
var me = this;
|
||||||
textareaElem.addEvent('keydown', function (event) {
|
textareaElem.on('keydown', function (event) {
|
||||||
switch (event.key) {
|
switch (jQuery.hotkeys.specialKeys[event.keyCode]) {
|
||||||
case 'esc':
|
case 'esc':
|
||||||
this.close(false);
|
me.close(false);
|
||||||
break;
|
break;
|
||||||
case 'enter':
|
case 'enter':
|
||||||
if (event.meta || event.control) {
|
if (event.metaKey || event.ctrlKey) {
|
||||||
|
|
||||||
// Add return ...
|
// Add return ...
|
||||||
var text = textareaElem.value;
|
var text = textareaElem.val();
|
||||||
var cursorPosition = text.length;
|
var cursorPosition = text.length;
|
||||||
if (textareaElem.selectionStart) {
|
if (textareaElem.selectionStart) {
|
||||||
cursorPosition = textareaElem.selectionStart;
|
cursorPosition = textareaElem.selectionStart;
|
||||||
@ -76,12 +71,12 @@ mindplot.MultilineTextEditor = new Class({
|
|||||||
if (cursorPosition < text.length) {
|
if (cursorPosition < text.length) {
|
||||||
tail = text.substring(cursorPosition, text.length);
|
tail = text.substring(cursorPosition, text.length);
|
||||||
}
|
}
|
||||||
textareaElem.value = head + "\n" + tail;
|
textareaElem.val(head + "\n" + tail);
|
||||||
|
|
||||||
// Position cursor ...
|
// Position cursor ...
|
||||||
if (textareaElem.setSelectionRange) {
|
if (textareaElem[0].setSelectionRange) {
|
||||||
textareaElem.focus();
|
textareaElem.focus();
|
||||||
textareaElem.setSelectionRange(cursorPosition + 1, cursorPosition + 1);
|
textareaElem[0].setSelectionRange(cursorPosition + 1, cursorPosition + 1);
|
||||||
} else if (textareaElem.createTextRange) {
|
} else if (textareaElem.createTextRange) {
|
||||||
var range = textareaElem.createTextRange();
|
var range = textareaElem.createTextRange();
|
||||||
range.moveStart('character', cursorPosition + 1);
|
range.moveStart('character', cursorPosition + 1);
|
||||||
@ -90,31 +85,31 @@ mindplot.MultilineTextEditor = new Class({
|
|||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.close(true);
|
me.close(true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
}.bind(this));
|
});
|
||||||
|
|
||||||
textareaElem.addEvent('keypress', function (event) {
|
textareaElem.on('keypress', function (event) {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
});
|
});
|
||||||
|
|
||||||
textareaElem.addEvent('keyup', function (event) {
|
textareaElem.on('keyup', function (event) {
|
||||||
var text = this._getTextareaElem().value;
|
var text = me._getTextareaElem().val();
|
||||||
this.fireEvent('input', [event, text]);
|
me.fireEvent('input', [event, text]);
|
||||||
this._adjustEditorSize();
|
me._adjustEditorSize();
|
||||||
}.bind(this));
|
});
|
||||||
|
|
||||||
// If the user clicks on the input, all event must be ignored ...
|
// If the user clicks on the input, all event must be ignored ...
|
||||||
containerElem.addEvent('click', function (event) {
|
containerElem.on('click', function (event) {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
});
|
});
|
||||||
containerElem.addEvent('dblclick', function (event) {
|
containerElem.on('dblclick', function (event) {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
});
|
});
|
||||||
containerElem.addEvent('mousedown', function (event) {
|
containerElem.on('mousedown', function (event) {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -124,25 +119,25 @@ mindplot.MultilineTextEditor = new Class({
|
|||||||
if (this.isVisible()) {
|
if (this.isVisible()) {
|
||||||
var textElem = this._getTextareaElem();
|
var textElem = this._getTextareaElem();
|
||||||
|
|
||||||
var lines = textElem.value.split('\n');
|
var lines = textElem.val().split('\n');
|
||||||
var maxLineLength = 1;
|
var maxLineLength = 1;
|
||||||
lines.each(function (line) {
|
_.each(lines, function (line) {
|
||||||
if (maxLineLength < line.length)
|
if (maxLineLength < line.length)
|
||||||
maxLineLength = line.length;
|
maxLineLength = line.length;
|
||||||
});
|
});
|
||||||
|
|
||||||
textElem.setAttribute('cols', maxLineLength);
|
textElem.attr('cols', maxLineLength);
|
||||||
textElem.setAttribute('rows', lines.length);
|
textElem.attr('rows', lines.length);
|
||||||
|
|
||||||
this._containerElem.setStyles({
|
this._containerElem.css({
|
||||||
width:(maxLineLength + 3) + 'em',
|
width:(maxLineLength + 3) + 'em',
|
||||||
height:textElem.getSize().height
|
height:textElem.height()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
isVisible:function () {
|
isVisible:function () {
|
||||||
return $defined(this._containerElem) && this._containerElem.getStyle('display') == 'block';
|
return $defined(this._containerElem) && this._containerElem.css('display') == 'block';
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateModel:function () {
|
_updateModel:function () {
|
||||||
@ -156,7 +151,7 @@ mindplot.MultilineTextEditor = new Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
show:function (topic, text) {
|
show: function (topic, text) {
|
||||||
// Close a previous node editor if it's opened ...
|
// Close a previous node editor if it's opened ...
|
||||||
if (this._topic) {
|
if (this._topic) {
|
||||||
this.close(false);
|
this.close(false);
|
||||||
@ -166,7 +161,7 @@ mindplot.MultilineTextEditor = new Class({
|
|||||||
if (!this.isVisible()) {
|
if (!this.isVisible()) {
|
||||||
//Create editor ui
|
//Create editor ui
|
||||||
var containerElem = this._buildEditor();
|
var containerElem = this._buildEditor();
|
||||||
containerElem.inject($(document.body));
|
$('body').append(containerElem);
|
||||||
|
|
||||||
this._containerElem = containerElem;
|
this._containerElem = containerElem;
|
||||||
this._registerEvents(containerElem);
|
this._registerEvents(containerElem);
|
||||||
@ -187,26 +182,27 @@ mindplot.MultilineTextEditor = new Class({
|
|||||||
font.size = nodeText.getHtmlFontSize();
|
font.size = nodeText.getHtmlFontSize();
|
||||||
font.color = nodeText.getColor();
|
font.color = nodeText.getColor();
|
||||||
this._setStyle(font);
|
this._setStyle(font);
|
||||||
|
var me = this;
|
||||||
// Set editor's initial size
|
// Set editor's initial size
|
||||||
var displayFunc = function () {
|
var displayFunc = function () {
|
||||||
// Position the editor and set the size...
|
// Position the editor and set the size...
|
||||||
var textShape = topic.getTextShape();
|
var textShape = topic.getTextShape();
|
||||||
textShape.positionRelativeTo(this._containerElem, {
|
|
||||||
position:{x:'left', y:'top'},
|
me._containerElem.css('display', 'block');
|
||||||
edge:{x:'left', y:'top'}
|
|
||||||
});
|
//FIXME: Im not sure if this is best way...
|
||||||
this._containerElem.setStyle('display', 'block');
|
var shapePosition = textShape.getNativePosition();
|
||||||
|
me._containerElem.offset(shapePosition);
|
||||||
|
|
||||||
// Set editor's initial text ...
|
// Set editor's initial text ...
|
||||||
var text = $defined(defaultText) ? defaultText : topic.getText();
|
var text = $defined(defaultText) ? defaultText : topic.getText();
|
||||||
this._setText(text);
|
me._setText(text);
|
||||||
|
|
||||||
// Set the element focus and select the current text ...
|
// Set the element focus and select the current text ...
|
||||||
var inputElem = this._getTextareaElem();
|
var inputElem = me._getTextareaElem();
|
||||||
this._positionCursor(inputElem, !$defined(defaultText));
|
me._positionCursor(inputElem, !$defined(defaultText));
|
||||||
|
|
||||||
}.bind(this);
|
};
|
||||||
|
|
||||||
this._timeoutId = displayFunc.delay(10);
|
this._timeoutId = displayFunc.delay(10);
|
||||||
},
|
},
|
||||||
@ -232,22 +228,22 @@ mindplot.MultilineTextEditor = new Class({
|
|||||||
fontWeight:fontStyle.weight,
|
fontWeight:fontStyle.weight,
|
||||||
color:fontStyle.color
|
color:fontStyle.color
|
||||||
};
|
};
|
||||||
inputField.setStyles(style);
|
inputField.css(style);
|
||||||
this._containerElem.setStyles(style);
|
this._containerElem.css(style);
|
||||||
},
|
},
|
||||||
|
|
||||||
_setText:function (text) {
|
_setText:function (text) {
|
||||||
var textareaElem = this._getTextareaElem();
|
var textareaElem = this._getTextareaElem();
|
||||||
textareaElem.value = text;
|
textareaElem.val(text);
|
||||||
this._adjustEditorSize();
|
this._adjustEditorSize();
|
||||||
},
|
},
|
||||||
|
|
||||||
_getText:function () {
|
_getText:function () {
|
||||||
return this._getTextareaElem().value;
|
return this._getTextareaElem().val();
|
||||||
},
|
},
|
||||||
|
|
||||||
_getTextareaElem:function () {
|
_getTextareaElem:function () {
|
||||||
return this._containerElem.getElement('textarea');
|
return this._containerElem.find('textarea');
|
||||||
},
|
},
|
||||||
|
|
||||||
_positionCursor:function (textareaElem, selectText) {
|
_positionCursor:function (textareaElem, selectText) {
|
||||||
@ -257,19 +253,19 @@ mindplot.MultilineTextEditor = new Class({
|
|||||||
if (textareaElem.createTextRange) {
|
if (textareaElem.createTextRange) {
|
||||||
var rang = textareaElem.createTextRange();
|
var rang = textareaElem.createTextRange();
|
||||||
rang.select();
|
rang.select();
|
||||||
rang.move("character", textareaElem.value.length);
|
rang.move("character", textareaElem.val().length);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
textareaElem.setSelectionRange(0, textareaElem.value.length);
|
textareaElem[0].setSelectionRange(0, textareaElem.val().length);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Move the cursor to the last character ..
|
// Move the cursor to the last character ..
|
||||||
if (textareaElem.createTextRange) {
|
if (textareaElem.createTextRange) {
|
||||||
var range = textareaElem.createTextRange();
|
var range = textareaElem.createTextRange();
|
||||||
range.move("character", textareaElem.value.length);
|
range.move("character", textareaElem.val().length);
|
||||||
} else {
|
} else {
|
||||||
textareaElem.selectionStart = textareaElem.value.length;
|
textareaElem.selectionStart = textareaElem.val().length;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -288,7 +284,7 @@ mindplot.MultilineTextEditor = new Class({
|
|||||||
this._topic.getTextShape().setVisibility(true);
|
this._topic.getTextShape().setVisibility(true);
|
||||||
|
|
||||||
// Remove it form the screen ...
|
// Remove it form the screen ...
|
||||||
this._containerElem.dispose();
|
this._containerElem.remove();
|
||||||
this._containerElem = null;
|
this._containerElem = null;
|
||||||
this._timeoutId = -1;
|
this._timeoutId = -1;
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,6 @@ mindplot.NodeGraph = new Class({
|
|||||||
this._mouseEvents = true;
|
this._mouseEvents = true;
|
||||||
this.setModel(nodeModel);
|
this.setModel(nodeModel);
|
||||||
this._onFocus = false;
|
this._onFocus = false;
|
||||||
this._event = new Events();
|
|
||||||
this._size = {width:50,height:20};
|
this._size = {width:50,height:20};
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -67,7 +66,7 @@ mindplot.NodeGraph = new Class({
|
|||||||
|
|
||||||
fireEvent: function(type, event) {
|
fireEvent: function(type, event) {
|
||||||
var elem = this.get2DElement();
|
var elem = this.get2DElement();
|
||||||
elem.fireEvent(type, event);
|
elem.trigger(type, event);
|
||||||
},
|
},
|
||||||
|
|
||||||
setMouseEventsEnabled : function(isEnabled) {
|
setMouseEventsEnabled : function(isEnabled) {
|
||||||
|
@ -31,50 +31,45 @@ mindplot.NoteIcon = new Class({
|
|||||||
|
|
||||||
_registerEvents:function () {
|
_registerEvents:function () {
|
||||||
this._image.setCursor('pointer');
|
this._image.setCursor('pointer');
|
||||||
|
var me = this;
|
||||||
|
|
||||||
if (!this._readOnly) {
|
if (!this._readOnly) {
|
||||||
|
|
||||||
// Add on click event to open the editor ...
|
// Add on click event to open the editor ...
|
||||||
this.addEvent('click', function (event) {
|
this.addEvent('click', function (event) {
|
||||||
this._topic.showNoteEditor();
|
me._topic.showNoteEditor();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
}.bind(this));
|
});
|
||||||
}
|
}
|
||||||
|
this._tip = new mindplot.widget.FloatingTip($(me.getImage()._peer._native), {
|
||||||
this._tip = new mindplot.widget.FloatingTip(this.getImage()._peer._native, {
|
title: $msg('NOTE'),
|
||||||
|
container: 'body',
|
||||||
// Content can also be a function of the target element!
|
// Content can also be a function of the target element!
|
||||||
content:function () {
|
content: function() {
|
||||||
var result = new Element('div');
|
return me._buildTooltipContent();
|
||||||
result.setStyles({padding:'5px'});
|
},
|
||||||
|
|
||||||
var title = new Element('div', {text:$msg('NOTE')});
|
|
||||||
title.setStyles({
|
|
||||||
'font-weight':'bold',
|
|
||||||
color:'black',
|
|
||||||
'padding-bottom':'5px',
|
|
||||||
width:'100px'
|
|
||||||
});
|
|
||||||
title.inject(result);
|
|
||||||
|
|
||||||
var text = new Element('div', {text:this._linksModel.getText()});
|
|
||||||
text.setStyles({
|
|
||||||
'white-space':'pre-wrap',
|
|
||||||
'word-wrap':'break-word'
|
|
||||||
}
|
|
||||||
);
|
|
||||||
text.inject(result);
|
|
||||||
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}.bind(this),
|
|
||||||
html:true,
|
html:true,
|
||||||
position:'bottom',
|
placement:'bottom',
|
||||||
arrowOffset:10,
|
destroyOnExit: true
|
||||||
center:true,
|
|
||||||
arrowSize:15,
|
|
||||||
offset:{x:10, y:20},
|
|
||||||
className:'notesTip'
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
_buildTooltipContent: function() {
|
||||||
|
if ($("body").find("#textPopoverNote").length == 1) {
|
||||||
|
var text = $("body").find("#textPopoverNote");
|
||||||
|
text.text(this._linksModel.getText());
|
||||||
|
} else {
|
||||||
|
var result = $('<div id="textPopoverNote"></div>').css({padding:'5px'});
|
||||||
|
|
||||||
|
var text = $('<div></div>').text(this._linksModel.getText())
|
||||||
|
.css({
|
||||||
|
'white-space':'pre-wrap',
|
||||||
|
'word-wrap':'break-word'
|
||||||
|
}
|
||||||
|
);
|
||||||
|
result.append(text);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
getModel:function () {
|
getModel:function () {
|
||||||
|
13
mindplot/src/main/javascript/Options.js
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
Options = new Class({
|
||||||
|
|
||||||
|
setOptions: function(){
|
||||||
|
var options = this.options = Object.merge.apply(null, [{}, this.options].append(arguments));
|
||||||
|
if (this.addEvent) for (var option in options){
|
||||||
|
if (typeOf(options[option]) != 'function' || !(/^on[A-Z]/).test(option)) continue;
|
||||||
|
this.addEvent(option, options[option]);
|
||||||
|
delete options[option];
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
@ -42,7 +42,7 @@ mindplot.PersistenceManager = new Class({
|
|||||||
var domMap = serializer.toXML(mindmap);
|
var domMap = serializer.toXML(mindmap);
|
||||||
var mapXml = core.Utils.innerXML(domMap);
|
var mapXml = core.Utils.innerXML(domMap);
|
||||||
|
|
||||||
var pref = JSON.encode(editorProperties);
|
var pref = JSON.stringify(editorProperties);
|
||||||
try {
|
try {
|
||||||
this.saveMapXml(mapId, mapXml, pref, saveHistory, events, sync);
|
this.saveMapXml(mapId, mapXml, pref, saveHistory, events, sync);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -160,16 +160,16 @@ mindplot.Relationship = new Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
addToWorkspace:function (workspace) {
|
addToWorkspace:function (workspace) {
|
||||||
workspace.appendChild(this._focusShape);
|
workspace.append(this._focusShape);
|
||||||
workspace.appendChild(this._controlPointsController);
|
workspace.append(this._controlPointsController);
|
||||||
|
|
||||||
this._controlPointControllerListener = this._initializeControlPointController.bind(this);
|
this._controlPointControllerListener = this._initializeControlPointController.bind(this);
|
||||||
this._line2d.addEvent('click', this._controlPointControllerListener);
|
this._line2d.addEvent('click', this._controlPointControllerListener);
|
||||||
this._isInWorkspace = true;
|
this._isInWorkspace = true;
|
||||||
|
|
||||||
workspace.appendChild(this._startArrow);
|
workspace.append(this._startArrow);
|
||||||
if (this._endArrow)
|
if (this._endArrow)
|
||||||
workspace.appendChild(this._endArrow);
|
workspace.append(this._endArrow);
|
||||||
|
|
||||||
this.parent(workspace);
|
this.parent(workspace);
|
||||||
this._positionArrows();
|
this._positionArrows();
|
||||||
@ -325,6 +325,6 @@ mindplot.Relationship = new Class({
|
|||||||
|
|
||||||
fireEvent:function (type, event) {
|
fireEvent:function (type, event) {
|
||||||
var elem = this._line2d;
|
var elem = this._line2d;
|
||||||
elem.fireEvent(type, event);
|
elem.trigger(type, event);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -23,6 +23,7 @@ mindplot.RelationshipPivot = new Class({
|
|||||||
this._workspace = workspace;
|
this._workspace = workspace;
|
||||||
this._designer = designer;
|
this._designer = designer;
|
||||||
|
|
||||||
|
//FIXME: the aim of the migration is remove .bind mootools method, please remove these!
|
||||||
this._mouseMoveEvent = this._mouseMove.bind(this);
|
this._mouseMoveEvent = this._mouseMove.bind(this);
|
||||||
this._onClickEvent = this._cleanOnMouseClick.bind(this);
|
this._onClickEvent = this._cleanOnMouseClick.bind(this);
|
||||||
this._onTopicClick = this._connectOnFocus.bind(this);
|
this._onTopicClick = this._connectOnFocus.bind(this);
|
||||||
@ -56,8 +57,8 @@ mindplot.RelationshipPivot = new Class({
|
|||||||
this._startArrow.setStrokeWidth(2);
|
this._startArrow.setStrokeWidth(2);
|
||||||
this._startArrow.setFrom(sourcePos.x, sourcePos.y);
|
this._startArrow.setFrom(sourcePos.x, sourcePos.y);
|
||||||
|
|
||||||
this._workspace.appendChild(this._pivot);
|
this._workspace.append(this._pivot);
|
||||||
this._workspace.appendChild(this._startArrow);
|
this._workspace.append(this._startArrow);
|
||||||
|
|
||||||
this._workspace.addEvent('mousemove', this._mouseMoveEvent);
|
this._workspace.addEvent('mousemove', this._mouseMoveEvent);
|
||||||
this._workspace.addEvent('click', this._onClickEvent);
|
this._workspace.addEvent('click', this._onClickEvent);
|
||||||
@ -65,7 +66,7 @@ mindplot.RelationshipPivot = new Class({
|
|||||||
// Register focus events on all topics ...
|
// Register focus events on all topics ...
|
||||||
var model = this._designer.getModel();
|
var model = this._designer.getModel();
|
||||||
var topics = model.getTopics();
|
var topics = model.getTopics();
|
||||||
topics.each(function (topic) {
|
_.each(topics, function (topic) {
|
||||||
topic.addEvent('ontfocus', this._onTopicClick);
|
topic.addEvent('ontfocus', this._onTopicClick);
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
}
|
}
|
||||||
@ -81,9 +82,10 @@ mindplot.RelationshipPivot = new Class({
|
|||||||
|
|
||||||
var model = this._designer.getModel();
|
var model = this._designer.getModel();
|
||||||
var topics = model.getTopics();
|
var topics = model.getTopics();
|
||||||
topics.each(function (topic) {
|
var me = this;
|
||||||
topic.removeEvent('ontfocus', this._onTopicClick);
|
_.each(topics, function (topic) {
|
||||||
}.bind(this));
|
topic.removeEvent('ontfocus', me._onTopicClick);
|
||||||
|
});
|
||||||
|
|
||||||
workspace.removeChild(this._pivot);
|
workspace.removeChild(this._pivot);
|
||||||
workspace.removeChild(this._startArrow);
|
workspace.removeChild(this._startArrow);
|
||||||
@ -139,7 +141,7 @@ mindplot.RelationshipPivot = new Class({
|
|||||||
return mindplot.util.Shape.calculateRelationShipPointCoordinates(this._sourceTopic, spoint);
|
return mindplot.util.Shape.calculateRelationShipPointCoordinates(this._sourceTopic, spoint);
|
||||||
},
|
},
|
||||||
|
|
||||||
_connectOnFocus:function (targetTopic) {
|
_connectOnFocus:function (event, targetTopic) {
|
||||||
var sourceTopic = this._sourceTopic;
|
var sourceTopic = this._sourceTopic;
|
||||||
var mindmap = this._designer.getMindmap();
|
var mindmap = this._designer.getMindmap();
|
||||||
|
|
||||||
|
@ -55,38 +55,38 @@ mindplot.RESTPersistenceManager = new Class({
|
|||||||
persistence.onSave = false;
|
persistence.onSave = false;
|
||||||
}, 10000);
|
}, 10000);
|
||||||
|
|
||||||
var request = new Request({
|
$.ajax({
|
||||||
url:this.documentUrl.replace("{id}", mapId) + "?" + query,
|
url: this.documentUrl.replace("{id}", mapId) + "?" + query,
|
||||||
method:'put',
|
type:'put',
|
||||||
|
dataType:"json",
|
||||||
|
data: JSON.stringify(data),
|
||||||
|
contentType:"application/json; charset=utf-8",
|
||||||
async:!sync,
|
async:!sync,
|
||||||
|
|
||||||
onSuccess:function (responseText, responseXML) {
|
success: function (data, textStatus, jqXHRresponseText) {
|
||||||
persistence.timestamp = responseText;
|
persistence.timestamp = data;
|
||||||
events.onSuccess();
|
events.onSuccess();
|
||||||
},
|
},
|
||||||
|
error: function (jqXHR, textStatus, errorThrown) {
|
||||||
onException:function (headerName, value) {
|
|
||||||
events.onError(persistence._buildError());
|
events.onError(persistence._buildError());
|
||||||
},
|
},
|
||||||
|
complete: function () {
|
||||||
onComplete:function () {
|
|
||||||
// Clear event timeout ...
|
// Clear event timeout ...
|
||||||
if (persistence.clearTimeout) {
|
if (persistence.clearTimeout) {
|
||||||
clearTimeout(persistence.clearTimeout);
|
clearTimeout(persistence.clearTimeout);
|
||||||
}
|
}
|
||||||
persistence.onSave = false;
|
persistence.onSave = false;
|
||||||
},
|
},
|
||||||
|
fail:function (xhr, textStatus) {
|
||||||
onFailure:function (xhr) {
|
|
||||||
|
|
||||||
var responseText = xhr.responseText;
|
var responseText = xhr.responseText;
|
||||||
var userMsg = {severity:"SEVERE", message:$msg('SAVE_COULD_NOT_BE_COMPLETED')};
|
var userMsg = {severity:"SEVERE", message:$msg('SAVE_COULD_NOT_BE_COMPLETED')};
|
||||||
|
|
||||||
var contentType = this.getHeader("Content-Type");
|
var contentType = xhr.getResponseHeader("Content-Type");
|
||||||
if (contentType != null && contentType.indexOf("application/json") != -1) {
|
if (contentType != null && contentType.indexOf("application/json") != -1) {
|
||||||
var serverMsg = null;
|
var serverMsg = null;
|
||||||
try {
|
try {
|
||||||
serverMsg = JSON.decode(responseText);
|
serverMsg = $.parseJSON(responseText);
|
||||||
serverMsg = serverMsg.globalSeverity ? serverMsg : null;
|
serverMsg = serverMsg.globalSeverity ? serverMsg : null;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// Message could not be decoded ...
|
// Message could not be decoded ...
|
||||||
@ -100,52 +100,29 @@ mindplot.RESTPersistenceManager = new Class({
|
|||||||
}
|
}
|
||||||
events.onError(userMsg);
|
events.onError(userMsg);
|
||||||
persistence.onSave = false;
|
persistence.onSave = false;
|
||||||
},
|
}
|
||||||
|
|
||||||
headers:{"Content-Type":"application/json; charset=utf-8", "Accept":"application/json"},
|
|
||||||
emulation:false,
|
|
||||||
urlEncoded:false
|
|
||||||
});
|
});
|
||||||
request.put(JSON.encode(data));
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
discardChanges:function (mapId) {
|
discardChanges:function (mapId) {
|
||||||
var request = new Request({
|
$.ajax({
|
||||||
url:this.revertUrl.replace("{id}", mapId),
|
url:this.revertUrl.replace("{id}", mapId),
|
||||||
async:false,
|
async:false,
|
||||||
method:'post',
|
method:'post',
|
||||||
onSuccess:function () {
|
headers:{"Content-Type":"application/json; charset=utf-8", "Accept":"application/json"}
|
||||||
},
|
|
||||||
onException:function () {
|
|
||||||
},
|
|
||||||
onFailure:function () {
|
|
||||||
},
|
|
||||||
headers:{"Content-Type":"application/json; charset=utf-8", "Accept":"application/json"},
|
|
||||||
emulation:false,
|
|
||||||
urlEncoded:false
|
|
||||||
});
|
});
|
||||||
request.post();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
unlockMap:function (mindmap) {
|
unlockMap:function (mindmap) {
|
||||||
var mapId = mindmap.getId();
|
var mapId = mindmap.getId();
|
||||||
var request = new Request({
|
$.ajax({
|
||||||
url:this.lockUrl.replace("{id}", mapId),
|
url:this.lockUrl.replace("{id}", mapId),
|
||||||
async:false,
|
async:false,
|
||||||
method:'put',
|
method:'put',
|
||||||
onSuccess:function () {
|
|
||||||
|
|
||||||
},
|
|
||||||
onException:function () {
|
|
||||||
},
|
|
||||||
onFailure:function () {
|
|
||||||
},
|
|
||||||
headers:{"Content-Type":"text/plain"},
|
headers:{"Content-Type":"text/plain"},
|
||||||
emulation:false,
|
data: "false"
|
||||||
urlEncoded:false
|
|
||||||
});
|
});
|
||||||
request.put("false");
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_buildError:function (jsonSeverResponse) {
|
_buildError:function (jsonSeverResponse) {
|
||||||
@ -165,26 +142,22 @@ mindplot.RESTPersistenceManager = new Class({
|
|||||||
loadMapDom:function (mapId) {
|
loadMapDom:function (mapId) {
|
||||||
// Let's try to open one from the local directory ...
|
// Let's try to open one from the local directory ...
|
||||||
var xml;
|
var xml;
|
||||||
var xmlRequest = new Request({
|
$.ajax({
|
||||||
url:this.documentUrl.replace("{id}", mapId) + "/xml",
|
url:this.documentUrl.replace("{id}", mapId) + "/xml",
|
||||||
method:'get',
|
method:'get',
|
||||||
async:false,
|
async:false,
|
||||||
headers:{"Content-Type":"text/plain","Accept":"application/xml"},
|
headers:{"Content-Type":"text/plain","Accept":"application/xml"},
|
||||||
onSuccess:function (responseText) {
|
success:function (responseText) {
|
||||||
xml = responseText;
|
xml = responseText;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
xmlRequest.send();
|
|
||||||
|
|
||||||
// If I could not load it from a file, hard code one.
|
// If I could not load it from a file, hard code one.
|
||||||
if (xml == null) {
|
if (xml == null) {
|
||||||
throw new Error("Map could not be loaded");
|
throw new Error("Map could not be loaded");
|
||||||
}
|
}
|
||||||
|
|
||||||
var parser = new DOMParser();
|
return xml;
|
||||||
return parser.parseFromString(xml, "text/xml");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,11 +24,11 @@ mindplot.ScreenManager = new Class({
|
|||||||
|
|
||||||
// Ignore default click event propagation. Prevent 'click' event on drag.
|
// Ignore default click event propagation. Prevent 'click' event on drag.
|
||||||
this._clickEvents = [];
|
this._clickEvents = [];
|
||||||
this._divContainer.addEvent('click', function(event) {
|
this._divContainer.bind('click', function(event) {
|
||||||
event.stopPropagation()
|
event.stopPropagation()
|
||||||
}.bind(this));
|
});
|
||||||
|
|
||||||
this._divContainer.addEvent('dblclick', function(event) {
|
this._divContainer.bind('dblclick', function(event) {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
});
|
});
|
||||||
@ -43,7 +43,7 @@ mindplot.ScreenManager = new Class({
|
|||||||
if (event == 'click')
|
if (event == 'click')
|
||||||
this._clickEvents.push(listener);
|
this._clickEvents.push(listener);
|
||||||
else
|
else
|
||||||
this._divContainer.addEvent(event, listener);
|
this._divContainer.bind(event, listener);
|
||||||
},
|
},
|
||||||
|
|
||||||
removeEvent : function(event, listener) {
|
removeEvent : function(event, listener) {
|
||||||
@ -51,18 +51,18 @@ mindplot.ScreenManager = new Class({
|
|||||||
this._clickEvents.remove(listener);
|
this._clickEvents.remove(listener);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
this._divContainer.removeEvent(event, listener);
|
this._divContainer.unbind(event, listener);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
fireEvent : function(type, event) {
|
fireEvent : function(type, event) {
|
||||||
if (type == 'click') {
|
if (type == 'click') {
|
||||||
this._clickEvents.each(function(listener) {
|
_.each(this._clickEvents, function(listener) {
|
||||||
listener(type, event);
|
listener(type, event);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this._divContainer.fireEvent(type, event);
|
this._divContainer.trigger(type, event);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -118,13 +118,13 @@ mindplot.ScreenManager = new Class({
|
|||||||
|
|
||||||
getWorkspaceMousePosition : function(event) {
|
getWorkspaceMousePosition : function(event) {
|
||||||
// Retrieve current mouse position.
|
// Retrieve current mouse position.
|
||||||
var x = event.client.x;
|
var x = event.clientX;
|
||||||
var y = event.client.y;
|
var y = event.clientY;
|
||||||
|
|
||||||
// Subtract div position.
|
//FIXME: paulo: why? Subtract div position.
|
||||||
var containerPosition = this.getContainer().getPosition();
|
/*var containerPosition = this.getContainer().position();
|
||||||
x = x - containerPosition.x;
|
x = x - containerPosition.x;
|
||||||
y = y - containerPosition.y;
|
y = y - containerPosition.y;*/
|
||||||
|
|
||||||
// Scale coordinate in order to be relative to the workspace. That's coordSize/size;
|
// Scale coordinate in order to be relative to the workspace. That's coordSize/size;
|
||||||
x = x * this._scale;
|
x = x * this._scale;
|
||||||
|
@ -50,11 +50,11 @@ mindplot.ShirinkConnector = new Class({
|
|||||||
|
|
||||||
ellipse.setFill('rgb(153, 0, 255)');
|
ellipse.setFill('rgb(153, 0, 255)');
|
||||||
});
|
});
|
||||||
|
var me = this;
|
||||||
ellipse.addEvent('mouseout', function(event) {
|
ellipse.addEvent('mouseout', function(event) {
|
||||||
var color = topic.getBackgroundColor();
|
var color = topic.getBackgroundColor();
|
||||||
this.setFill(color);
|
me.setFill(color);
|
||||||
}.bind(this));
|
});
|
||||||
|
|
||||||
ellipse.setCursor('default');
|
ellipse.setCursor('default');
|
||||||
this._fillColor = '#f7f7f7';
|
this._fillColor = '#f7f7f7';
|
||||||
@ -90,7 +90,7 @@ mindplot.ShirinkConnector = new Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
addToWorkspace: function(group) {
|
addToWorkspace: function(group) {
|
||||||
group.appendChild(this._ellipse);
|
group.append(this._ellipse);
|
||||||
},
|
},
|
||||||
|
|
||||||
setPosition: function(x, y) {
|
setPosition: function(x, y) {
|
||||||
@ -104,4 +104,4 @@ mindplot.ShirinkConnector = new Class({
|
|||||||
moveToFront: function() {
|
moveToFront: function() {
|
||||||
this._ellipse.moveToFront();
|
this._ellipse.moveToFront();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -68,14 +68,15 @@ mindplot.TextEditor = new Class({
|
|||||||
_registerEvents : function(divElem) {
|
_registerEvents : function(divElem) {
|
||||||
var inputElem = this._getTextareaElem();
|
var inputElem = this._getTextareaElem();
|
||||||
var spanElem = this._getSpanElem();
|
var spanElem = this._getSpanElem();
|
||||||
|
var me = this;
|
||||||
|
|
||||||
divElem.addEvent('keydown', function (event) {
|
divElem.addEvent('keydown', function (event) {
|
||||||
switch (event.key) {
|
switch (event.key) {
|
||||||
case 'esc':
|
case 'esc':
|
||||||
this.close(false);
|
me.close(false);
|
||||||
break;
|
break;
|
||||||
case 'enter':
|
case 'enter':
|
||||||
this.close(true);
|
me.close(true);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
spanElem.innerHTML = inputElem.value;
|
spanElem.innerHTML = inputElem.value;
|
||||||
@ -87,7 +88,7 @@ mindplot.TextEditor = new Class({
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
}.bind(this));
|
});
|
||||||
|
|
||||||
// If the user clicks on the input, all event must be ignored ...
|
// If the user clicks on the input, all event must be ignored ...
|
||||||
divElem.addEvent('click', function(event) {
|
divElem.addEvent('click', function(event) {
|
||||||
@ -121,7 +122,7 @@ mindplot.TextEditor = new Class({
|
|||||||
if (!this.isVisible()) {
|
if (!this.isVisible()) {
|
||||||
//Create editor ui
|
//Create editor ui
|
||||||
var editorElem = this._buildEditor();
|
var editorElem = this._buildEditor();
|
||||||
editorElem.inject($(document.body));
|
editorElem.inject($(document.body)[0]);
|
||||||
|
|
||||||
this._containerElem = editorElem;
|
this._containerElem = editorElem;
|
||||||
this._registerEvents(editorElem);
|
this._registerEvents(editorElem);
|
||||||
@ -147,25 +148,24 @@ mindplot.TextEditor = new Class({
|
|||||||
var text = $defined(defaultText) ? defaultText : topic.getText();
|
var text = $defined(defaultText) ? defaultText : topic.getText();
|
||||||
this._setText(text);
|
this._setText(text);
|
||||||
|
|
||||||
|
var me = this;
|
||||||
// Set editor's initial size
|
// Set editor's initial size
|
||||||
var displayFunc = function() {
|
var displayFunc = function() {
|
||||||
// Position the editor and set the size...
|
// Position the editor and set the size...
|
||||||
var textShape = this._topic.getTextShape();
|
var textShape = me._topic.getTextShape();
|
||||||
textShape.positionRelativeTo(this._containerElem, {
|
|
||||||
position: {x: 'left',y:'top'},
|
|
||||||
edge: {x: 'left', y: 'top'}
|
|
||||||
});
|
|
||||||
this._containerElem.setStyle('display', 'block');
|
|
||||||
|
|
||||||
|
me._containerElem.css('display', 'block');
|
||||||
|
|
||||||
|
me._containerElem.offset(textShape.getNativePosition());
|
||||||
// Set size ...
|
// Set size ...
|
||||||
var elemSize = topic.getSize();
|
var elemSize = topic.getSize();
|
||||||
this._setEditorSize(elemSize.width, elemSize.height);
|
me._setEditorSize(elemSize.width, elemSize.height);
|
||||||
|
|
||||||
var textareaElem = this._getTextareaElem();
|
var textareaElem = me._getTextareaElem();
|
||||||
textareaElem.focus();
|
textareaElem.focus();
|
||||||
this._positionCursor(textareaElem, !$defined(defaultText));
|
me._positionCursor(textareaElem, !$defined(defaultText));
|
||||||
|
|
||||||
}.bind(this);
|
};
|
||||||
|
|
||||||
displayFunc.delay(10);
|
displayFunc.delay(10);
|
||||||
},
|
},
|
||||||
|
@ -47,11 +47,11 @@ mindplot.Topic = new Class({
|
|||||||
this.addEvent('click', function (event) {
|
this.addEvent('click', function (event) {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
});
|
});
|
||||||
|
var me = this;
|
||||||
this.addEvent('dblclick', function (event) {
|
this.addEvent('dblclick', function (event) {
|
||||||
this._getTopicEventDispatcher().show(this);
|
me._getTopicEventDispatcher().show(me);
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
}.bind(this));
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
setShapeType:function (type) {
|
setShapeType:function (type) {
|
||||||
@ -82,7 +82,7 @@ mindplot.Topic = new Class({
|
|||||||
this.setSize(size, true);
|
this.setSize(size, true);
|
||||||
|
|
||||||
var group = this.get2DElement();
|
var group = this.get2DElement();
|
||||||
group.appendChild(innerShape);
|
group.append(innerShape);
|
||||||
|
|
||||||
// Move text to the front ...
|
// Move text to the front ...
|
||||||
var text = this.getTextShape();
|
var text = this.getTextShape();
|
||||||
@ -246,7 +246,7 @@ mindplot.Topic = new Class({
|
|||||||
if (!$defined(this._iconsGroup)) {
|
if (!$defined(this._iconsGroup)) {
|
||||||
this._iconsGroup = this._buildIconGroup();
|
this._iconsGroup = this._buildIconGroup();
|
||||||
var group = this.get2DElement();
|
var group = this.get2DElement();
|
||||||
group.appendChild(this._iconsGroup.getNativeElement());
|
group.append(this._iconsGroup.getNativeElement());
|
||||||
this._iconsGroup.moveToFront();
|
this._iconsGroup.moveToFront();
|
||||||
}
|
}
|
||||||
return this._iconsGroup;
|
return this._iconsGroup;
|
||||||
@ -458,7 +458,7 @@ mindplot.Topic = new Class({
|
|||||||
|
|
||||||
setText:function (text) {
|
setText:function (text) {
|
||||||
// Avoid empty nodes ...
|
// Avoid empty nodes ...
|
||||||
if (!text || text.trim().length == 0) {
|
if (!text || $.trim(text).length == 0) {
|
||||||
text = null;
|
text = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -542,9 +542,9 @@ mindplot.Topic = new Class({
|
|||||||
var textShape = this.getTextShape();
|
var textShape = this.getTextShape();
|
||||||
|
|
||||||
// Add to the group ...
|
// Add to the group ...
|
||||||
group.appendChild(outerShape);
|
group.append(outerShape);
|
||||||
group.appendChild(innerShape);
|
group.append(innerShape);
|
||||||
group.appendChild(textShape);
|
group.append(textShape);
|
||||||
|
|
||||||
// Update figure size ...
|
// Update figure size ...
|
||||||
var model = this.getModel();
|
var model = this.getModel();
|
||||||
@ -576,24 +576,25 @@ mindplot.Topic = new Class({
|
|||||||
};
|
};
|
||||||
elem.addEvent('mouseout', outout);
|
elem.addEvent('mouseout', outout);
|
||||||
|
|
||||||
|
var me = this;
|
||||||
// Focus events ...
|
// Focus events ...
|
||||||
elem.addEvent('mousedown', function (event) {
|
elem.addEvent('mousedown', function (event) {
|
||||||
if (!this.isReadOnly()) {
|
if (!me.isReadOnly()) {
|
||||||
// Disable topic selection of readOnly mode ...
|
// Disable topic selection of readOnly mode ...
|
||||||
var value = true;
|
var value = true;
|
||||||
if ((event.meta && Browser.Platform.mac) || (event.control && !Browser.Platform.mac)) {
|
if ((event.metaKey && Browser.Platform.mac) || (event.ctrlKey && !Browser.Platform.mac)) {
|
||||||
value = !this.isOnFocus();
|
value = !me.isOnFocus();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
topic.setOnFocus(value);
|
topic.setOnFocus(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
var eventDispatcher = this._getTopicEventDispatcher();
|
var eventDispatcher = me._getTopicEventDispatcher();
|
||||||
eventDispatcher.process(mindplot.TopicEvent.CLICK, this);
|
eventDispatcher.process(mindplot.TopicEvent.CLICK, me);
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
||||||
}.bind(this));
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
areChildrenShrunken:function () {
|
areChildrenShrunken:function () {
|
||||||
@ -626,10 +627,11 @@ mindplot.Topic = new Class({
|
|||||||
// Do some fancy animation ....
|
// Do some fancy animation ....
|
||||||
var elements = this._flatten2DElements(this);
|
var elements = this._flatten2DElements(this);
|
||||||
var fade = new mindplot.util.FadeEffect(elements, !value);
|
var fade = new mindplot.util.FadeEffect(elements, !value);
|
||||||
|
var me = this;
|
||||||
fade.addEvent('complete', function () {
|
fade.addEvent('complete', function () {
|
||||||
// Set focus on the parent node ...
|
// Set focus on the parent node ...
|
||||||
if (value) {
|
if (value) {
|
||||||
this.setOnFocus(true);
|
me.setOnFocus(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set focus in false for all the children ...
|
// Set focus in false for all the children ...
|
||||||
@ -638,7 +640,7 @@ mindplot.Topic = new Class({
|
|||||||
elem.setOnFocus(false);
|
elem.setOnFocus(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}.bind(this));
|
});
|
||||||
fade.start();
|
fade.start();
|
||||||
|
|
||||||
mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.NodeShrinkEvent, model);
|
mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.NodeShrinkEvent, model);
|
||||||
@ -887,7 +889,7 @@ mindplot.Topic = new Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
_setRelationshipLinesVisibility:function (value) {
|
_setRelationshipLinesVisibility:function (value) {
|
||||||
this._relationships.each(function (relationship) {
|
_.each(this._relationships, function (relationship) {
|
||||||
var sourceTopic = relationship.getSourceTopic();
|
var sourceTopic = relationship.getSourceTopic();
|
||||||
var targetTopic = relationship.getTargetTopic();
|
var targetTopic = relationship.getTargetTopic();
|
||||||
|
|
||||||
@ -1043,7 +1045,7 @@ mindplot.Topic = new Class({
|
|||||||
$assert(workspace, 'Workspace can not be null');
|
$assert(workspace, 'Workspace can not be null');
|
||||||
|
|
||||||
// Connect Graphical Nodes ...
|
// Connect Graphical Nodes ...
|
||||||
targetTopic.appendChild(this);
|
targetTopic.append(this);
|
||||||
this._parent = targetTopic;
|
this._parent = targetTopic;
|
||||||
|
|
||||||
// Update model ...
|
// Update model ...
|
||||||
@ -1056,7 +1058,7 @@ mindplot.Topic = new Class({
|
|||||||
outgoingLine.setVisibility(false);
|
outgoingLine.setVisibility(false);
|
||||||
|
|
||||||
this._outgoingLine = outgoingLine;
|
this._outgoingLine = outgoingLine;
|
||||||
workspace.appendChild(outgoingLine);
|
workspace.append(outgoingLine);
|
||||||
|
|
||||||
// Update figure is necessary.
|
// Update figure is necessary.
|
||||||
this.updateTopicShape(targetTopic);
|
this.updateTopicShape(targetTopic);
|
||||||
@ -1088,7 +1090,7 @@ mindplot.Topic = new Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
appendChild:function (child) {
|
append:function (child) {
|
||||||
var children = this.getChildren();
|
var children = this.getChildren();
|
||||||
children.push(child);
|
children.push(child);
|
||||||
},
|
},
|
||||||
@ -1120,7 +1122,7 @@ mindplot.Topic = new Class({
|
|||||||
|
|
||||||
addToWorkspace:function (workspace) {
|
addToWorkspace:function (workspace) {
|
||||||
var elem = this.get2DElement();
|
var elem = this.get2DElement();
|
||||||
workspace.appendChild(elem);
|
workspace.append(elem);
|
||||||
if (!this.isInWorkspace()) {
|
if (!this.isInWorkspace()) {
|
||||||
if (!this.isCentralTopic()) {
|
if (!this.isCentralTopic()) {
|
||||||
mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.NodeAdded, this.getModel());
|
mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.NodeAdded, this.getModel());
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
mindplot.TopicEventDispatcher = new Class({
|
mindplot.TopicEventDispatcher = new Class({
|
||||||
Extends: Events,
|
Extends: mindplot.Events,
|
||||||
Static: {
|
Static: {
|
||||||
_instance: null,
|
_instance: null,
|
||||||
|
|
||||||
|
@ -26,8 +26,8 @@ mindplot.Workspace = new Class({
|
|||||||
this._screenManager = screenManager;
|
this._screenManager = screenManager;
|
||||||
|
|
||||||
var divContainer = screenManager.getContainer();
|
var divContainer = screenManager.getContainer();
|
||||||
this._screenWidth = parseInt(divContainer.getStyle('width'));
|
this._screenWidth = parseInt(divContainer.css('width'));
|
||||||
this._screenHeight = parseInt(divContainer.getStyle('height'));
|
this._screenHeight = parseInt(divContainer.css('height'));
|
||||||
|
|
||||||
// Initialize web2d workspace.
|
// Initialize web2d workspace.
|
||||||
var workspace = this._createWorkspace();
|
var workspace = this._createWorkspace();
|
||||||
@ -61,11 +61,11 @@ mindplot.Workspace = new Class({
|
|||||||
return new web2d.Workspace(workspaceProfile);
|
return new web2d.Workspace(workspaceProfile);
|
||||||
},
|
},
|
||||||
|
|
||||||
appendChild: function(shape) {
|
append: function(shape) {
|
||||||
if ($defined(shape.addToWorkspace)) {
|
if ($defined(shape.addToWorkspace)) {
|
||||||
shape.addToWorkspace(this);
|
shape.addToWorkspace(this);
|
||||||
} else {
|
} else {
|
||||||
this._workspace.appendChild(shape);
|
this._workspace.append(shape);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -189,7 +189,7 @@ mindplot.Workspace = new Class({
|
|||||||
wasDragged = true;
|
wasDragged = true;
|
||||||
|
|
||||||
|
|
||||||
}.bind(this);
|
};
|
||||||
screenManager.addEvent('mousemove', workspace._mouseMoveListener);
|
screenManager.addEvent('mousemove', workspace._mouseMoveListener);
|
||||||
|
|
||||||
// Register mouse up listeners ...
|
// Register mouse up listeners ...
|
||||||
|
@ -29,19 +29,20 @@ mindplot.commands.AddTopicCommand = new Class({
|
|||||||
|
|
||||||
execute:function (commandContext) {
|
execute:function (commandContext) {
|
||||||
|
|
||||||
this._models.each(function (model, index) {
|
var me = this;
|
||||||
|
_.each(this._models, function (model, index) {
|
||||||
|
|
||||||
// Add a new topic ...
|
// Add a new topic ...
|
||||||
var topic = commandContext.createTopic(model);
|
var topic = commandContext.createTopic(model);
|
||||||
|
|
||||||
// Connect to topic ...
|
// Connect to topic ...
|
||||||
if (this._parentsIds) {
|
if (me._parentsIds) {
|
||||||
var parentId = this._parentsIds[index];
|
var parentId = me._parentsIds[index];
|
||||||
if ($defined(parentId)) {
|
if ($defined(parentId)) {
|
||||||
var parentTopic = commandContext.findTopics(parentId)[0];
|
var parentTopic = commandContext.findTopics(parentId)[0];
|
||||||
commandContext.connect(topic, parentTopic);
|
commandContext.connect(topic, parentTopic);
|
||||||
}
|
}
|
||||||
}else {
|
} else {
|
||||||
commandContext.addTopic(topic);
|
commandContext.addTopic(topic);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,23 +54,23 @@ mindplot.commands.AddTopicCommand = new Class({
|
|||||||
// Render node ...
|
// Render node ...
|
||||||
topic.setVisibility(true);
|
topic.setVisibility(true);
|
||||||
|
|
||||||
}.bind(this));
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
undoExecute:function (commandContext) {
|
undoExecute:function (commandContext) {
|
||||||
// Delete disconnected the nodes. Create a copy of the topics ...
|
// Delete disconnected the nodes. Create a copy of the topics ...
|
||||||
var clonedModel = [];
|
var clonedModel = [];
|
||||||
this._models.each(function (model) {
|
_.each(this._models, function (model) {
|
||||||
clonedModel.push(model.clone());
|
clonedModel.push(model.clone());
|
||||||
});
|
});
|
||||||
|
|
||||||
// Finally, remove the nodes ...
|
// Finally, remove the nodes ...
|
||||||
this._models.each(function (model) {
|
_.each(this._models, function (model) {
|
||||||
|
|
||||||
var topicId = model.getId();
|
var topicId = model.getId();
|
||||||
var topic = commandContext.findTopics(topicId)[0];
|
var topic = commandContext.findTopics(topicId)[0];
|
||||||
commandContext.deleteTopic(topic);
|
commandContext.deleteTopic(topic);
|
||||||
}.bind(this));
|
});
|
||||||
|
|
||||||
this._models = clonedModel;
|
this._models = clonedModel;
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ mindplot.commands.DeleteCommand = new Class({
|
|||||||
var topics = this._filterChildren(this._topicIds, commandContext);
|
var topics = this._filterChildren(this._topicIds, commandContext);
|
||||||
|
|
||||||
if (topics.length > 0) {
|
if (topics.length > 0) {
|
||||||
topics.each(function (topic) {
|
_.each(topics, function (topic) {
|
||||||
// In case that it's editing text node, force close without update ...
|
// In case that it's editing text node, force close without update ...
|
||||||
topic.closeEditors();
|
topic.closeEditors();
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ mindplot.commands.DeleteCommand = new Class({
|
|||||||
return rel.getModel().clone();
|
return rel.getModel().clone();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
relationships.each(function (relationship) {
|
_.each(relationships, function (relationship) {
|
||||||
commandContext.deleteRelationship(relationship);
|
commandContext.deleteRelationship(relationship);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ mindplot.commands.DeleteCommand = new Class({
|
|||||||
|
|
||||||
var rels = commandContext.findRelationships(this._relIds);
|
var rels = commandContext.findRelationships(this._relIds);
|
||||||
if (rels.length > 0) {
|
if (rels.length > 0) {
|
||||||
rels.each(function (rel) {
|
_.each(rels, function (rel) {
|
||||||
this._deletedRelModel.push(rel.getModel().clone());
|
this._deletedRelModel.push(rel.getModel().clone());
|
||||||
commandContext.deleteRelationship(rel);
|
commandContext.deleteRelationship(rel);
|
||||||
}, this);
|
}, this);
|
||||||
@ -79,12 +79,12 @@ mindplot.commands.DeleteCommand = new Class({
|
|||||||
undoExecute:function (commandContext) {
|
undoExecute:function (commandContext) {
|
||||||
|
|
||||||
// Add all the topics ...
|
// Add all the topics ...
|
||||||
this._deletedTopicModels.each(function (model) {
|
_.each(this._deletedTopicModels, function (model) {
|
||||||
commandContext.createTopic(model);
|
commandContext.createTopic(model);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
// Do they need to be connected ?
|
// Do they need to be connected ?
|
||||||
this._deletedTopicModels.each(function (topicModel, index) {
|
_.each(this._deletedTopicModels, function (topicModel, index) {
|
||||||
var topics = commandContext.findTopics(topicModel.getId());
|
var topics = commandContext.findTopics(topicModel.getId());
|
||||||
|
|
||||||
var parentId = this._parentTopicIds[index];
|
var parentId = this._parentTopicIds[index];
|
||||||
@ -95,12 +95,12 @@ mindplot.commands.DeleteCommand = new Class({
|
|||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
// Add rebuild relationships ...
|
// Add rebuild relationships ...
|
||||||
this._deletedRelModel.each(function (model) {
|
_.each(this._deletedRelModel, function (model) {
|
||||||
commandContext.addRelationship(model);
|
commandContext.addRelationship(model);
|
||||||
}.bind(this));
|
});
|
||||||
|
|
||||||
// Finally display the topics ...
|
// Finally display the topics ...
|
||||||
this._deletedTopicModels.each(function (topicModel) {
|
_.each(this._deletedTopicModels, function (topicModel) {
|
||||||
var topics = commandContext.findTopics(topicModel.getId());
|
var topics = commandContext.findTopics(topicModel.getId());
|
||||||
topics[0].setBranchVisibility(true);
|
topics[0].setBranchVisibility(true);
|
||||||
}, this);
|
}, this);
|
||||||
@ -121,7 +121,7 @@ mindplot.commands.DeleteCommand = new Class({
|
|||||||
var topics = commandContext.findTopics(topicIds);
|
var topics = commandContext.findTopics(topicIds);
|
||||||
|
|
||||||
var result = [];
|
var result = [];
|
||||||
topics.each(function (topic) {
|
_.each(topics, function (topic) {
|
||||||
var parent = topic.getParent();
|
var parent = topic.getParent();
|
||||||
var found = false;
|
var found = false;
|
||||||
while (parent != null && !found) {
|
while (parent != null && !found) {
|
||||||
|
@ -46,10 +46,11 @@ mindplot.commands.GenericFunctionCommand = new Class({
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (topics != null) {
|
if (topics != null) {
|
||||||
topics.each(function (topic) {
|
var me = this;
|
||||||
var oldValue = this._commandFunc(topic, this._value);
|
_.each(topics, function (topic) {
|
||||||
this._oldValues.push(oldValue);
|
var oldValue = me._commandFunc(topic, me._value);
|
||||||
}.bind(this));
|
me._oldValues.push(oldValue);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
this.applied = true;
|
this.applied = true;
|
||||||
|
|
||||||
@ -62,10 +63,11 @@ mindplot.commands.GenericFunctionCommand = new Class({
|
|||||||
undoExecute:function (commandContext) {
|
undoExecute:function (commandContext) {
|
||||||
if (this.applied) {
|
if (this.applied) {
|
||||||
var topics = commandContext.findTopics(this._topicsId);
|
var topics = commandContext.findTopics(this._topicsId);
|
||||||
topics.each(function (topic, index) {
|
var me = this;
|
||||||
this._commandFunc(topic, this._oldValues[index]);
|
_.each(topics, function (topic, index) {
|
||||||
|
me._commandFunc(topic, me._oldValues[index]);
|
||||||
|
|
||||||
}.bind(this));
|
});
|
||||||
|
|
||||||
this.applied = false;
|
this.applied = false;
|
||||||
this._oldValues = [];
|
this._oldValues = [];
|
||||||
|
@ -1 +1,5 @@
|
|||||||
$(document).fireEvent('loadcomplete', 'mind');
|
try {
|
||||||
|
$(document).trigger('loadcomplete', 'mind');
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e.stack);
|
||||||
|
}
|
||||||
|
@ -38,7 +38,7 @@ mindplot.layout.AbstractBasicSorter = new Class({
|
|||||||
result = height;
|
result = height;
|
||||||
} else {
|
} else {
|
||||||
var childrenHeight = 0;
|
var childrenHeight = 0;
|
||||||
children.each(function(child) {
|
_.each(children, function(child) {
|
||||||
childrenHeight += this._computeChildrenHeight(treeSet, child, heightCache);
|
childrenHeight += this._computeChildrenHeight(treeSet, child, heightCache);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ mindplot.layout.BalancedSorter = new Class({
|
|||||||
var result = null;
|
var result = null;
|
||||||
var last = children.getLast();
|
var last = children.getLast();
|
||||||
position = position || {x:last.getPosition().x, y:last.getPosition().y + 1};
|
position = position || {x:last.getPosition().x, y:last.getPosition().y + 1};
|
||||||
children.each(function (child, index) {
|
_.each(children, function (child, index) {
|
||||||
var cpos = child.getPosition();
|
var cpos = child.getPosition();
|
||||||
if (position.y > cpos.y) {
|
if (position.y > cpos.y) {
|
||||||
yOffset = child == last ?
|
yOffset = child == last ?
|
||||||
@ -129,7 +129,7 @@ mindplot.layout.BalancedSorter = new Class({
|
|||||||
// Filter nodes on one side..
|
// Filter nodes on one side..
|
||||||
var children = this._getChildrenForOrder(parent, treeSet, node.getOrder());
|
var children = this._getChildrenForOrder(parent, treeSet, node.getOrder());
|
||||||
|
|
||||||
children.each(function (child, index) {
|
_.each(children, function (child, index) {
|
||||||
if (child.getOrder() > node.getOrder()) {
|
if (child.getOrder() > node.getOrder()) {
|
||||||
child.setOrder(child.getOrder() - 2);
|
child.setOrder(child.getOrder() - 2);
|
||||||
}
|
}
|
||||||
@ -154,7 +154,7 @@ mindplot.layout.BalancedSorter = new Class({
|
|||||||
var totalPHeight = 0;
|
var totalPHeight = 0;
|
||||||
var totalNHeight = 0;
|
var totalNHeight = 0;
|
||||||
|
|
||||||
heights.each(function (elem) {
|
_.each(heights, function (elem) {
|
||||||
if (elem.order % 2 == 0) {
|
if (elem.order % 2 == 0) {
|
||||||
totalPHeight += elem.height;
|
totalPHeight += elem.height;
|
||||||
} else {
|
} else {
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
mindplot.EventBus = new Class({
|
mindplot.EventBus = new Class({
|
||||||
Implements:Events,
|
Implements: mindplot.Events,
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -26,9 +26,13 @@ mindplot.layout.GridSorter = new Class({
|
|||||||
var children = this._getSortedChildren(treeSet, node);
|
var children = this._getSortedChildren(treeSet, node);
|
||||||
|
|
||||||
// Compute heights ...
|
// Compute heights ...
|
||||||
|
var me = this;
|
||||||
var heights = children.map(function(child) {
|
var heights = children.map(function(child) {
|
||||||
return {id:child.getId(),height:this._computeChildrenHeight(treeSet, child)};
|
return {
|
||||||
}.bind(this));
|
id: child.getId(),
|
||||||
|
height: me._computeChildrenHeight(treeSet, child)
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
// Calculate the offsets ...
|
// Calculate the offsets ...
|
||||||
var result = {};
|
var result = {};
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
mindplot.layout.LayoutManager = new Class({
|
mindplot.layout.LayoutManager = new Class({
|
||||||
Extends: Events,
|
Extends: mindplot.Events,
|
||||||
initialize: function(rootNodeId, rootSize) {
|
initialize: function(rootNodeId, rootSize) {
|
||||||
$assert($defined(rootNodeId), "rootNodeId can not be null");
|
$assert($defined(rootNodeId), "rootNodeId can not be null");
|
||||||
$assert(rootSize, "rootSize can not be null");
|
$assert(rootSize, "rootSize can not be null");
|
||||||
@ -137,7 +137,7 @@ mindplot.layout.LayoutManager = new Class({
|
|||||||
// Collect changes ...
|
// Collect changes ...
|
||||||
this._collectChanges();
|
this._collectChanges();
|
||||||
|
|
||||||
if (!$(fireEvents) || fireEvents) {
|
if ($(fireEvents).length>0 || fireEvents) {
|
||||||
this._flushEvents();
|
this._flushEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,7 +145,7 @@ mindplot.layout.LayoutManager = new Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
_flushEvents: function() {
|
_flushEvents: function() {
|
||||||
this._events.each(function(event) {
|
_.each(this._events, function(event) {
|
||||||
this.fireEvent('change', event);
|
this.fireEvent('change', event);
|
||||||
}, this);
|
}, this);
|
||||||
this._events = [];
|
this._events = [];
|
||||||
@ -155,7 +155,7 @@ mindplot.layout.LayoutManager = new Class({
|
|||||||
if (!nodes)
|
if (!nodes)
|
||||||
nodes = this._treeSet.getTreeRoots();
|
nodes = this._treeSet.getTreeRoots();
|
||||||
|
|
||||||
nodes.each(function(node) {
|
_.each(nodes, function(node) {
|
||||||
if (node.hasOrderChanged() || node.hasPositionChanged()) {
|
if (node.hasOrderChanged() || node.hasPositionChanged()) {
|
||||||
|
|
||||||
// Find or create a event ...
|
// Find or create a event ...
|
||||||
|
@ -155,7 +155,7 @@ mindplot.layout.Node = new Class({
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Only update if the property has changed ...
|
// Only update if the property has changed ...
|
||||||
if (JSON.encode(prop.value) != JSON.encode(value)) {
|
if (JSON.stringify(prop.value) != JSON.stringify(value)) {
|
||||||
prop.oldValue = prop.value;
|
prop.oldValue = prop.value;
|
||||||
prop.value = value;
|
prop.value = value;
|
||||||
prop.hasChanged = true;
|
prop.hasChanged = true;
|
||||||
|
@ -70,7 +70,7 @@ mindplot.layout.OriginalLayout = new Class({
|
|||||||
|
|
||||||
layout:function () {
|
layout:function () {
|
||||||
var roots = this._treeSet.getTreeRoots();
|
var roots = this._treeSet.getTreeRoots();
|
||||||
roots.each(function (node) {
|
_.each(roots, function (node) {
|
||||||
|
|
||||||
// Calculate all node heights ...
|
// Calculate all node heights ...
|
||||||
var sorter = node.getSorter();
|
var sorter = node.getSorter();
|
||||||
@ -107,12 +107,12 @@ mindplot.layout.OriginalLayout = new Class({
|
|||||||
var sorter = node.getSorter();
|
var sorter = node.getSorter();
|
||||||
var offsetById = sorter.computeOffsets(this._treeSet, node);
|
var offsetById = sorter.computeOffsets(this._treeSet, node);
|
||||||
var parentPosition = node.getPosition();
|
var parentPosition = node.getPosition();
|
||||||
|
var me = this;
|
||||||
children.each(function (child) {
|
_.each(children, function (child) {
|
||||||
var offset = offsetById[child.getId()];
|
var offset = offsetById[child.getId()];
|
||||||
|
|
||||||
var childFreeDisplacement = child.getFreeDisplacement();
|
var childFreeDisplacement = child.getFreeDisplacement();
|
||||||
var direction = node.getSorter().getChildDirection(this._treeSet, child);
|
var direction = node.getSorter().getChildDirection(me._treeSet, child);
|
||||||
|
|
||||||
if ((direction > 0 && childFreeDisplacement.x < 0) || (direction < 0 && childFreeDisplacement.x > 0)) {
|
if ((direction > 0 && childFreeDisplacement.x < 0) || (direction < 0 && childFreeDisplacement.x > 0)) {
|
||||||
child.resetFreeDisplacement();
|
child.resetFreeDisplacement();
|
||||||
@ -125,15 +125,15 @@ mindplot.layout.OriginalLayout = new Class({
|
|||||||
var parentX = parentPosition.x;
|
var parentX = parentPosition.x;
|
||||||
var parentY = parentPosition.y;
|
var parentY = parentPosition.y;
|
||||||
|
|
||||||
var newPos = {x:parentX + offset.x, y:parentY + offset.y + this._calculateAlignOffset(node, child, heightById)};
|
var newPos = {x:parentX + offset.x, y:parentY + offset.y + me._calculateAlignOffset(node, child, heightById)};
|
||||||
this._treeSet.updateBranchPosition(child, newPos);
|
me._treeSet.updateBranchPosition(child, newPos);
|
||||||
}.bind(this));
|
});
|
||||||
|
|
||||||
node._branchHeight = newBranchHeight;
|
node._branchHeight = newBranchHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Continue reordering the children nodes ...
|
// Continue reordering the children nodes ...
|
||||||
children.each(function (child) {
|
_.each(children, function (child) {
|
||||||
this._layoutChildren(child, heightById);
|
this._layoutChildren(child, heightById);
|
||||||
}, this);
|
}, this);
|
||||||
},
|
},
|
||||||
@ -183,7 +183,7 @@ mindplot.layout.OriginalLayout = new Class({
|
|||||||
this._shiftBranches(node, heightById);
|
this._shiftBranches(node, heightById);
|
||||||
}
|
}
|
||||||
|
|
||||||
children.each(function (child) {
|
_.each(children, function (child) {
|
||||||
this._fixOverlapping(child, heightById);
|
this._fixOverlapping(child, heightById);
|
||||||
}, this);
|
}, this);
|
||||||
},
|
},
|
||||||
@ -193,7 +193,7 @@ mindplot.layout.OriginalLayout = new Class({
|
|||||||
|
|
||||||
var siblingsToShift = this._treeSet.getSiblingsInVerticalDirection(node, node.getFreeDisplacement().y);
|
var siblingsToShift = this._treeSet.getSiblingsInVerticalDirection(node, node.getFreeDisplacement().y);
|
||||||
var last = node;
|
var last = node;
|
||||||
siblingsToShift.each(function (sibling) {
|
_.each(siblingsToShift, function (sibling) {
|
||||||
var overlappingOccurs = shiftedBranches.some(function (shiftedBranch) {
|
var overlappingOccurs = shiftedBranches.some(function (shiftedBranch) {
|
||||||
return this._branchesOverlap(shiftedBranch, sibling, heightById);
|
return this._branchesOverlap(shiftedBranch, sibling, heightById);
|
||||||
}, this);
|
}, this);
|
||||||
@ -209,7 +209,7 @@ mindplot.layout.OriginalLayout = new Class({
|
|||||||
return !shiftedBranches.contains(branch);
|
return !shiftedBranches.contains(branch);
|
||||||
});
|
});
|
||||||
|
|
||||||
branchesToShift.each(function (branch) {
|
_.each(branchesToShift, function (branch) {
|
||||||
var bAmount = node.getFreeDisplacement().y;
|
var bAmount = node.getFreeDisplacement().y;
|
||||||
this._treeSet.shiftBranchPosition(branch, 0, bAmount);
|
this._treeSet.shiftBranchPosition(branch, 0, bAmount);
|
||||||
shiftedBranches.push(branch);
|
shiftedBranches.push(branch);
|
||||||
|
@ -240,9 +240,10 @@ mindplot.layout.RootedTreeSet = new Class({
|
|||||||
var yOffset = oldPos.y - position.y;
|
var yOffset = oldPos.y - position.y;
|
||||||
|
|
||||||
var children = this.getChildren(node);
|
var children = this.getChildren(node);
|
||||||
children.each(function (child) {
|
var me = this;
|
||||||
this.shiftBranchPosition(child, xOffset, yOffset);
|
_.each(children, function (child) {
|
||||||
}.bind(this));
|
me.shiftBranchPosition(child, xOffset, yOffset);
|
||||||
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -251,9 +252,10 @@ mindplot.layout.RootedTreeSet = new Class({
|
|||||||
node.setPosition({x:position.x + xOffset, y:position.y + yOffset});
|
node.setPosition({x:position.x + xOffset, y:position.y + yOffset});
|
||||||
|
|
||||||
var children = this.getChildren(node);
|
var children = this.getChildren(node);
|
||||||
children.each(function (child) {
|
var me = this;
|
||||||
this.shiftBranchPosition(child, xOffset, yOffset);
|
_.each(children, function (child) {
|
||||||
}.bind(this));
|
me.shiftBranchPosition(child, xOffset, yOffset);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getSiblingsInVerticalDirection:function (node, yOffset) {
|
getSiblingsInVerticalDirection:function (node, yOffset) {
|
||||||
|
@ -168,7 +168,7 @@ mindplot.layout.SymmetricSorter = new Class({
|
|||||||
|
|
||||||
// Compute the center of the branch ...
|
// Compute the center of the branch ...
|
||||||
var totalHeight = 0;
|
var totalHeight = 0;
|
||||||
heights.each(function (elem) {
|
_.each(heights, function (elem) {
|
||||||
totalHeight += elem.height;
|
totalHeight += elem.height;
|
||||||
});
|
});
|
||||||
var ysum = totalHeight / 2;
|
var ysum = totalHeight / 2;
|
||||||
|
@ -0,0 +1,49 @@
|
|||||||
|
BootstrapDialog.Request = new Class({
|
||||||
|
|
||||||
|
Extends: BootstrapDialog,
|
||||||
|
|
||||||
|
initialize: function(url, title, options) {
|
||||||
|
this.parent(title, options);
|
||||||
|
this.requestOptions = {};
|
||||||
|
this.requestOptions.cache = false;
|
||||||
|
var me = this;
|
||||||
|
this.requestOptions.fail = function(xhr) {
|
||||||
|
// Intercept form requests ...
|
||||||
|
console.log("Failure:");
|
||||||
|
console.log(xhr);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.requestOptions.success = function() {
|
||||||
|
// Intercept form requests ...
|
||||||
|
var forms = me._native.find('form');
|
||||||
|
_.each(forms, function(form) {
|
||||||
|
$(form).on('submit', function(event) {
|
||||||
|
// Intercept form ...
|
||||||
|
me.requestOptions.url = form.action;
|
||||||
|
me.requestOptions.method = form.method ? form.method : 'post';
|
||||||
|
$.ajax(me.requestOptions);
|
||||||
|
event.stopPropagation();
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
this._native.find('.modal-body').load(url, function () {
|
||||||
|
me.acceptButton.unbind('click').click(function () {
|
||||||
|
submitDialogForm();
|
||||||
|
});
|
||||||
|
me._native.on('hidden.bs.modal', function () {
|
||||||
|
$(this).remove();
|
||||||
|
});
|
||||||
|
me.show();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
onDialogShown: function() {
|
||||||
|
if (typeof(onDialogShown) == "function") {
|
||||||
|
onDialogShown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
});
|
@ -0,0 +1,114 @@
|
|||||||
|
var BootstrapDialog = new Class({
|
||||||
|
Implements: Options,
|
||||||
|
|
||||||
|
options: {
|
||||||
|
cancelButton: false,
|
||||||
|
closeButton: false,
|
||||||
|
acceptButton: true,
|
||||||
|
removeButton:false,
|
||||||
|
errorMessage: false,
|
||||||
|
onEventData:{}
|
||||||
|
},
|
||||||
|
|
||||||
|
initialize: function (title, options) {
|
||||||
|
this.setOptions(options);
|
||||||
|
this.options.onEventData.dialog = this;
|
||||||
|
this._native = $('<div class="modal fade" tabindex="-1"></div>').append('<div class="modal-dialog"></div>');
|
||||||
|
var content = $('<div class="modal-content"></div>');
|
||||||
|
content.on('keydown', function(event) {
|
||||||
|
event.stopPropagation();
|
||||||
|
});
|
||||||
|
var header = this._buildHeader(title);
|
||||||
|
if (header) {
|
||||||
|
content.append(header);
|
||||||
|
}
|
||||||
|
var body = $('<div class="modal-body"></div>');
|
||||||
|
if(this.options.errorMessage){
|
||||||
|
var error = $('<div class="alert alert-danger"></div>');
|
||||||
|
error.hide();
|
||||||
|
body.append(error);
|
||||||
|
}
|
||||||
|
content.append(body);
|
||||||
|
var footer = this._buildFooter();
|
||||||
|
if (footer) {
|
||||||
|
content.append(footer);
|
||||||
|
}
|
||||||
|
this._native.find(".modal-dialog").append(content);
|
||||||
|
this._native.on('hidden.bs.modal', function() {
|
||||||
|
$(this).remove();
|
||||||
|
});
|
||||||
|
this._native.on('shown.bs.modal', this.onDialogShown);
|
||||||
|
},
|
||||||
|
|
||||||
|
_buildFooter: function() {
|
||||||
|
var footer = null;
|
||||||
|
if (this.options.acceptButton || this.options.removeButton || this.options.cancelButton) {
|
||||||
|
footer = $('<div class="modal-footer" style="paddingTop:5;textAlign:center">');
|
||||||
|
}
|
||||||
|
if (this.options.acceptButton) {
|
||||||
|
this.acceptButton = $('<button type="button" class="btn btn-primary" id="acceptBtn" data-dismiss="modal">'+ $msg('ACCEPT') + '</button>');
|
||||||
|
footer.append(this.acceptButton);
|
||||||
|
this.acceptButton.unbind('click').on("click",this.options.onEventData, this.onAcceptClick)
|
||||||
|
}
|
||||||
|
if (this.options.removeButton) {
|
||||||
|
this.removeButton = $('<button type="button" class="btn btn-secondary" id="removeBtn" data-dismiss="modal">'+ $msg('REMOVE') +'</button>');
|
||||||
|
footer.append(this.removeButton);
|
||||||
|
this.removeButton.on('click', this.options.onEventData, this.onRemoveClick);
|
||||||
|
}
|
||||||
|
if (this.options.cancelButton) {
|
||||||
|
footer.append('<button type="button" class="btn btn-secondary" data-dismiss="modal">'+ $msg('CANCEL') +'</button>');
|
||||||
|
}
|
||||||
|
return footer;
|
||||||
|
},
|
||||||
|
|
||||||
|
_buildHeader: function(title) {
|
||||||
|
var header = null;
|
||||||
|
if (this.options.closeButton || title) {
|
||||||
|
header = $('<div class="modal-header"></div>');
|
||||||
|
}
|
||||||
|
if (this.options.closeButton) {
|
||||||
|
header.append(
|
||||||
|
'<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (title) {
|
||||||
|
header.append('<h2 class="modal-title">' + title + '</h2>');
|
||||||
|
}
|
||||||
|
return header;
|
||||||
|
},
|
||||||
|
|
||||||
|
onAcceptClick: function(event) {
|
||||||
|
throw "Unsupported operation";
|
||||||
|
},
|
||||||
|
|
||||||
|
onDialogShown: function() {},
|
||||||
|
onRemoveClick: function(event) {
|
||||||
|
throw "Unsupported operation";
|
||||||
|
},
|
||||||
|
|
||||||
|
show: function () {
|
||||||
|
this._native.modal();
|
||||||
|
},
|
||||||
|
|
||||||
|
setContent: function(content) {
|
||||||
|
var modalBody = this._native.find('.modal-body');
|
||||||
|
modalBody.append(content);
|
||||||
|
},
|
||||||
|
|
||||||
|
css: function(options){
|
||||||
|
this._native.find('.modal-dialog').css(options);
|
||||||
|
},
|
||||||
|
|
||||||
|
close: function() {
|
||||||
|
this._native.modal('hide');
|
||||||
|
},
|
||||||
|
|
||||||
|
alertError: function(message){
|
||||||
|
this._native.find('.alert-danger').text(message);
|
||||||
|
this._native.find('.alert-danger').show();
|
||||||
|
},
|
||||||
|
|
||||||
|
cleanError: function(){
|
||||||
|
this._native.find('.alert-danger').hide();
|
||||||
|
}
|
||||||
|
});
|
@ -5333,7 +5333,7 @@ button.close {
|
|||||||
border-radius: 5px 5px 0 0;
|
border-radius: 5px 5px 0 0;
|
||||||
}
|
}
|
||||||
.popover-content {
|
.popover-content {
|
||||||
padding: 9px 14px;
|
padding: 4px 6px;
|
||||||
}
|
}
|
||||||
.popover > .arrow,
|
.popover > .arrow,
|
||||||
.popover > .arrow:after {
|
.popover > .arrow:after {
|
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 62 KiB |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 8.6 KiB After Width: | Height: | Size: 8.6 KiB |
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
110
mindplot/src/main/javascript/libraries/hotkeys/jquery.hotkeys.js
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
/*
|
||||||
|
* jQuery Hotkeys Plugin
|
||||||
|
* Copyright 2010, John Resig
|
||||||
|
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||||
|
*
|
||||||
|
* Based upon the plugin by Tzury Bar Yochay:
|
||||||
|
* http://github.com/tzuryby/hotkeys
|
||||||
|
*
|
||||||
|
* Original idea by:
|
||||||
|
* Binny V A, http://www.openjs.com/scripts/events/keyboard_shortcuts/
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* One small change is: now keys are passed by object { keys: '...' }
|
||||||
|
* Might be useful, when you want to pass some other data to your handler
|
||||||
|
*/
|
||||||
|
|
||||||
|
(function(jQuery){
|
||||||
|
|
||||||
|
jQuery.hotkeys = {
|
||||||
|
version: "0.8",
|
||||||
|
|
||||||
|
specialKeys: {
|
||||||
|
8: "backspace", 9: "tab", 10: "return", 13: "enter", 16: "shift", 17: "ctrl", 18: "alt", 19: "pause",
|
||||||
|
20: "capslock", 27: "esc", 32: "space", 33: "pageup", 34: "pagedown", 35: "end", 36: "home",
|
||||||
|
37: "left", 38: "up", 39: "right", 40: "down", 45: "insert", 46: "del",
|
||||||
|
96: "0", 97: "1", 98: "2", 99: "3", 100: "4", 101: "5", 102: "6", 103: "7",
|
||||||
|
104: "8", 105: "9", 106: "*", 107: "+", 109: "-", 110: ".", 111 : "/",
|
||||||
|
112: "f1", 113: "f2", 114: "f3", 115: "f4", 116: "f5", 117: "f6", 118: "f7", 119: "f8",
|
||||||
|
120: "f9", 121: "f10", 122: "f11", 123: "f12", 144: "numlock", 145: "scroll", 186: ";", 191: "/",
|
||||||
|
220: "\\", 222: "'", 224: "meta"
|
||||||
|
},
|
||||||
|
|
||||||
|
shiftNums: {
|
||||||
|
"`": "~", "1": "!", "2": "@", "3": "#", "4": "$", "5": "%", "6": "^", "7": "&",
|
||||||
|
"8": "*", "9": "(", "0": ")", "-": "_", "=": "+", ";": ": ", "'": "\"", ",": "<",
|
||||||
|
".": ">", "/": "?", "\\": "|"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
function keyHandler( handleObj ) {
|
||||||
|
if ( typeof handleObj.data === "string" ) {
|
||||||
|
handleObj.data = { keys: handleObj.data };
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only care when a possible input has been specified
|
||||||
|
if ( !handleObj.data || !handleObj.data.keys || typeof handleObj.data.keys !== "string" ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var origHandler = handleObj.handler,
|
||||||
|
keys = handleObj.data.keys.toLowerCase().split(" "),
|
||||||
|
textAcceptingInputTypes = ["text", "password", "number", "email", "url", "range", "date", "month", "week", "time", "datetime", "datetime-local", "search", "color", "tel"];
|
||||||
|
|
||||||
|
handleObj.handler = function( event ) {
|
||||||
|
// Don't fire in text-accepting inputs that we didn't directly bind to
|
||||||
|
if ( this !== event.target && (/textarea|select/i.test( event.target.nodeName ) ||
|
||||||
|
jQuery.inArray(event.target.type, textAcceptingInputTypes) > -1 ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var special = jQuery.hotkeys.specialKeys[ event.keyCode ],
|
||||||
|
character = String.fromCharCode( event.which ).toLowerCase(),
|
||||||
|
modif = "", possible = {};
|
||||||
|
|
||||||
|
// check combinations (alt|ctrl|shift+anything)
|
||||||
|
if ( event.altKey && special !== "alt" ) {
|
||||||
|
modif += "alt+";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( event.ctrlKey && special !== "ctrl" ) {
|
||||||
|
modif += "ctrl+";
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Need to make sure this works consistently across platforms
|
||||||
|
if ( event.metaKey && !event.ctrlKey && special !== "meta" ) {
|
||||||
|
modif += "meta+";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( event.shiftKey && special !== "shift" ) {
|
||||||
|
modif += "shift+";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( special ) {
|
||||||
|
possible[ modif + special ] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( character ) {
|
||||||
|
possible[ modif + character ] = true;
|
||||||
|
possible[ modif + jQuery.hotkeys.shiftNums[ character ] ] = true;
|
||||||
|
|
||||||
|
// "$" can be triggered as "Shift+4" or "Shift+$" or just "$"
|
||||||
|
if ( modif === "shift+" ) {
|
||||||
|
possible[ jQuery.hotkeys.shiftNums[ character ] ] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for ( var i = 0, l = keys.length; i < l; i++ ) {
|
||||||
|
if ( possible[ keys[i] ] ) {
|
||||||
|
return origHandler.apply( this, arguments );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
jQuery.each([ "keydown", "keyup", "keypress" ], function() {
|
||||||
|
jQuery.event.special[ this ] = { add: keyHandler };
|
||||||
|
});
|
||||||
|
|
||||||
|
})( this.jQuery );
|
9111
mindplot/src/main/javascript/libraries/jquery/jquery-2.1.0.js
vendored
Normal file
8
mindplot/src/main/javascript/libraries/jquery/jquery.mousewheel.min.js
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
/*! Copyright (c) 2013 Brandon Aaron (http://brandon.aaron.sh)
|
||||||
|
* Licensed under the MIT License (LICENSE.txt).
|
||||||
|
*
|
||||||
|
* Version: 3.1.11
|
||||||
|
*
|
||||||
|
* Requires: jQuery 1.2.2+
|
||||||
|
*/
|
||||||
|
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a:a(jQuery)}(function(a){function b(b){var g=b||window.event,h=i.call(arguments,1),j=0,l=0,m=0,n=0,o=0,p=0;if(b=a.event.fix(g),b.type="mousewheel","detail"in g&&(m=-1*g.detail),"wheelDelta"in g&&(m=g.wheelDelta),"wheelDeltaY"in g&&(m=g.wheelDeltaY),"wheelDeltaX"in g&&(l=-1*g.wheelDeltaX),"axis"in g&&g.axis===g.HORIZONTAL_AXIS&&(l=-1*m,m=0),j=0===m?l:m,"deltaY"in g&&(m=-1*g.deltaY,j=m),"deltaX"in g&&(l=g.deltaX,0===m&&(j=-1*l)),0!==m||0!==l){if(1===g.deltaMode){var q=a.data(this,"mousewheel-line-height");j*=q,m*=q,l*=q}else if(2===g.deltaMode){var r=a.data(this,"mousewheel-page-height");j*=r,m*=r,l*=r}if(n=Math.max(Math.abs(m),Math.abs(l)),(!f||f>n)&&(f=n,d(g,n)&&(f/=40)),d(g,n)&&(j/=40,l/=40,m/=40),j=Math[j>=1?"floor":"ceil"](j/f),l=Math[l>=1?"floor":"ceil"](l/f),m=Math[m>=1?"floor":"ceil"](m/f),k.settings.normalizeOffset&&this.getBoundingClientRect){var s=this.getBoundingClientRect();o=b.clientX-s.left,p=b.clientY-s.top}return b.deltaX=l,b.deltaY=m,b.deltaFactor=f,b.offsetX=o,b.offsetY=p,b.deltaMode=0,h.unshift(b,j,l,m),e&&clearTimeout(e),e=setTimeout(c,200),(a.event.dispatch||a.event.handle).apply(this,h)}}function c(){f=null}function d(a,b){return k.settings.adjustOldDeltas&&"mousewheel"===a.type&&b%120===0}var e,f,g=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],h="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],i=Array.prototype.slice;if(a.event.fixHooks)for(var j=g.length;j;)a.event.fixHooks[g[--j]]=a.event.mouseHooks;var k=a.event.special.mousewheel={version:"3.1.11",setup:function(){if(this.addEventListener)for(var c=h.length;c;)this.addEventListener(h[--c],b,!1);else this.onmousewheel=b;a.data(this,"mousewheel-line-height",k.getLineHeight(this)),a.data(this,"mousewheel-page-height",k.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var c=h.length;c;)this.removeEventListener(h[--c],b,!1);else this.onmousewheel=null;a.removeData(this,"mousewheel-line-height"),a.removeData(this,"mousewheel-page-height")},getLineHeight:function(b){var c=a(b)["offsetParent"in a.fn?"offsetParent":"parent"]();return c.length||(c=a("body")),parseInt(c.css("fontSize"),10)},getPageHeight:function(b){return a(b).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})});
|
11
mindplot/src/main/javascript/libraries/less/less-1.4.2.min.js
vendored
Executable file
@ -1,45 +0,0 @@
|
|||||||
/*
|
|
||||||
---
|
|
||||||
name: MooDialog.Alert
|
|
||||||
description: Creates an Alert dialog
|
|
||||||
authors: Arian Stolwijk
|
|
||||||
license: MIT-style license
|
|
||||||
requires: MooDialog
|
|
||||||
provides: MooDialog.Alert
|
|
||||||
...
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
MooDialog.Alert = new Class({
|
|
||||||
|
|
||||||
Extends: MooDialog,
|
|
||||||
|
|
||||||
options: {
|
|
||||||
okText: 'Ok',
|
|
||||||
focus: true,
|
|
||||||
textPClass: 'MooDialogAlert'
|
|
||||||
},
|
|
||||||
|
|
||||||
initialize: function(msg, options){
|
|
||||||
this.parent(options);
|
|
||||||
|
|
||||||
var okButton = new Element('input[type=button]', {
|
|
||||||
events: {
|
|
||||||
click: this.close.bind(this)
|
|
||||||
},
|
|
||||||
value: this.options.okText
|
|
||||||
});
|
|
||||||
|
|
||||||
this.setContent(
|
|
||||||
new Element('p.' + this.options.textPClass, {text: msg}),
|
|
||||||
new Element('div.buttons').adopt(okButton)
|
|
||||||
);
|
|
||||||
if (this.options.autoOpen) this.open();
|
|
||||||
|
|
||||||
if (this.options.focus) this.addEvent('show', function(){
|
|
||||||
okButton.focus()
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
@ -1,80 +0,0 @@
|
|||||||
/*
|
|
||||||
---
|
|
||||||
name: MooDialog.Confirm
|
|
||||||
description: Creates an Confirm Dialog
|
|
||||||
authors: Arian Stolwijk
|
|
||||||
license: MIT-style license
|
|
||||||
requires: MooDialog
|
|
||||||
provides: [MooDialog.Confirm, Element.confirmLinkClick, Element.confirmFormSubmit]
|
|
||||||
...
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
MooDialog.Confirm = new Class({
|
|
||||||
|
|
||||||
Extends: MooDialog,
|
|
||||||
|
|
||||||
options: {
|
|
||||||
okText: 'Ok',
|
|
||||||
cancelText: 'Cancel',
|
|
||||||
focus: true,
|
|
||||||
textPClass: 'MooDialogConfirm'
|
|
||||||
},
|
|
||||||
|
|
||||||
initialize: function(msg, fn, fn1, options){
|
|
||||||
this.parent(options);
|
|
||||||
var emptyFn = function(){},
|
|
||||||
self = this;
|
|
||||||
|
|
||||||
var buttons = [
|
|
||||||
{fn: fn || emptyFn, txt: this.options.okText},
|
|
||||||
{fn: fn1 || emptyFn, txt: this.options.cancelText}
|
|
||||||
].map(function(button){
|
|
||||||
return new Element('input[type=button]', {
|
|
||||||
events: {
|
|
||||||
click: function(){
|
|
||||||
button.fn();
|
|
||||||
self.close();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
value: button.txt
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
this.setContent(
|
|
||||||
new Element('p.' + this.options.textPClass, {text: msg}),
|
|
||||||
new Element('div.buttons').adopt(buttons)
|
|
||||||
);
|
|
||||||
if (this.options.autoOpen) this.open();
|
|
||||||
|
|
||||||
if(this.options.focus) this.addEvent('show', function(){
|
|
||||||
buttons[1].focus();
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
Element.implement({
|
|
||||||
|
|
||||||
confirmLinkClick: function(msg, options){
|
|
||||||
this.addEvent('click', function(e){
|
|
||||||
e.stop();
|
|
||||||
new MooDialog.Confirm(msg, function(){
|
|
||||||
location.href = this.get('href');
|
|
||||||
}.bind(this), null, options)
|
|
||||||
});
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
|
|
||||||
confirmFormSubmit: function(msg, options){
|
|
||||||
this.addEvent('submit', function(e){
|
|
||||||
e.stop();
|
|
||||||
new MooDialog.Confirm(msg, function(){
|
|
||||||
this.submit();
|
|
||||||
}.bind(this), null, options)
|
|
||||||
}.bind(this));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
@ -1,21 +0,0 @@
|
|||||||
/*
|
|
||||||
---
|
|
||||||
name: MooDialog.Error
|
|
||||||
description: Creates an Error dialog
|
|
||||||
authors: Arian Stolwijk
|
|
||||||
license: MIT-style license
|
|
||||||
requires: MooDialog
|
|
||||||
provides: MooDialog.Error
|
|
||||||
...
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
MooDialog.Error = new Class({
|
|
||||||
|
|
||||||
Extends: MooDialog.Alert,
|
|
||||||
|
|
||||||
options: {
|
|
||||||
textPClass: 'MooDialogError'
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
@ -1,44 +0,0 @@
|
|||||||
/*
|
|
||||||
---
|
|
||||||
name: MooDialog.Fx
|
|
||||||
description: Overwrite the default events so the Dialogs are using Fx on open and close
|
|
||||||
authors: Arian Stolwijk
|
|
||||||
license: MIT-style license
|
|
||||||
requires: [Cores/Fx.Tween, Overlay]
|
|
||||||
provides: MooDialog.Fx
|
|
||||||
...
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
MooDialog.implement('options', {
|
|
||||||
|
|
||||||
duration: 400,
|
|
||||||
closeOnOverlayClick: true,
|
|
||||||
|
|
||||||
onInitialize: function(wrapper){
|
|
||||||
this.fx = new Fx.Tween(wrapper, {
|
|
||||||
property: 'opacity',
|
|
||||||
duration: this.options.duration
|
|
||||||
}).set(0);
|
|
||||||
},
|
|
||||||
|
|
||||||
onBeforeOpen: function(wrapper){
|
|
||||||
this.overlay = new Overlay(this.options.inject, {
|
|
||||||
duration: this.options.duration
|
|
||||||
});
|
|
||||||
if (this.options.closeOnOverlayClick)
|
|
||||||
this.overlay.addEvent('click', this.close.bind(this));
|
|
||||||
this.overlay.open();
|
|
||||||
this.fx.start(1).chain(function(){
|
|
||||||
this.fireEvent('show');
|
|
||||||
}.bind(this));
|
|
||||||
},
|
|
||||||
|
|
||||||
onBeforeClose: function(wrapper){
|
|
||||||
this.overlay.destroy();
|
|
||||||
this.fx.start(0).chain(function(){
|
|
||||||
this.fireEvent('hide');
|
|
||||||
}.bind(this));
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
@ -1,33 +0,0 @@
|
|||||||
/*
|
|
||||||
---
|
|
||||||
name: MooDialog.IFrame
|
|
||||||
description: Opens an IFrame in a MooDialog
|
|
||||||
authors: Arian Stolwijk
|
|
||||||
license: MIT-style license
|
|
||||||
requires: MooDialog
|
|
||||||
provides: MooDialog.IFrame
|
|
||||||
...
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
MooDialog.Iframe = new Class({
|
|
||||||
|
|
||||||
Extends: MooDialog,
|
|
||||||
|
|
||||||
options: {
|
|
||||||
useScrollBar: true
|
|
||||||
},
|
|
||||||
|
|
||||||
initialize: function(url, options){
|
|
||||||
this.parent(options);
|
|
||||||
|
|
||||||
this.setContent(
|
|
||||||
new Element('iframe', {
|
|
||||||
src: url,
|
|
||||||
frameborder: 0,
|
|
||||||
scrolling: this.options.useScrollBar ? 'auto' : 'no'
|
|
||||||
})
|
|
||||||
);
|
|
||||||
if (this.options.autoOpen) this.open();
|
|
||||||
}
|
|
||||||
});
|
|
@ -1,47 +0,0 @@
|
|||||||
/*
|
|
||||||
---
|
|
||||||
name: MooDialog.Prompt
|
|
||||||
description: Creates a Prompt dialog
|
|
||||||
authors: Arian Stolwijk
|
|
||||||
license: MIT-style license
|
|
||||||
requires: MooDialog
|
|
||||||
provides: MooDialog.Prompt
|
|
||||||
...
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
MooDialog.Prompt = new Class({
|
|
||||||
|
|
||||||
Extends: MooDialog,
|
|
||||||
|
|
||||||
options: {
|
|
||||||
okText: 'Ok',
|
|
||||||
focus: true,
|
|
||||||
textPClass: 'MooDialogPrompt'
|
|
||||||
},
|
|
||||||
|
|
||||||
initialize: function(msg, fn, options){
|
|
||||||
this.parent(options);
|
|
||||||
if (!fn) fn = function(){};
|
|
||||||
|
|
||||||
var textInput = new Element('input.textInput', {type: 'text'}),
|
|
||||||
submitButton = new Element('input[type=submit]', {value: this.options.okText}),
|
|
||||||
formEvents = {
|
|
||||||
submit: function(e){
|
|
||||||
e.stop();
|
|
||||||
fn(textInput.get('value'));
|
|
||||||
this.close();
|
|
||||||
}.bind(this)
|
|
||||||
};
|
|
||||||
|
|
||||||
this.setContent(
|
|
||||||
new Element('p.' + this.options.textPClass, {text: msg}),
|
|
||||||
new Element('form.buttons', {events: formEvents}).adopt(textInput, submitButton)
|
|
||||||
);
|
|
||||||
if (this.options.autoOpen) this.open();
|
|
||||||
|
|
||||||
if (this.options.focus) this.addEvent('show', function(){
|
|
||||||
textInput.focus();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
@ -1,66 +0,0 @@
|
|||||||
/*
|
|
||||||
---
|
|
||||||
name: MooDialog.Request
|
|
||||||
description: Loads Data into a Dialog with Request
|
|
||||||
authors: Arian Stolwijk
|
|
||||||
license: MIT-style license
|
|
||||||
requires: [MooDialog, Core/Request.HTML]
|
|
||||||
provides: MooDialog.Request
|
|
||||||
...
|
|
||||||
*/
|
|
||||||
|
|
||||||
MooDialog.Request = new Class({
|
|
||||||
|
|
||||||
Extends: MooDialog,
|
|
||||||
|
|
||||||
initialize: function(url, requestOptions, options) {
|
|
||||||
this.parent(options);
|
|
||||||
this.requestOptions = requestOptions || {};
|
|
||||||
this.requestOptions.update = this.content;
|
|
||||||
this.requestOptions.evalScripts = true;
|
|
||||||
this.requestOptions.noCache = true;
|
|
||||||
|
|
||||||
this.requestOptions.onFailure = function(xhr) {
|
|
||||||
// Intercept form requests ...
|
|
||||||
console.log("Failure:");
|
|
||||||
console.log(xhr);
|
|
||||||
}.bind(this);
|
|
||||||
|
|
||||||
this.requestOptions.onSuccess = function() {
|
|
||||||
// Intercept form requests ...
|
|
||||||
var forms = this.content.getElements('form');
|
|
||||||
forms.forEach(function(form) {
|
|
||||||
form.addEvent('submit', function(event) {
|
|
||||||
// Intercept form ...
|
|
||||||
this.requestOptions.url = form.action;
|
|
||||||
this.requestOptions.method = form.method ? form.method : 'post';
|
|
||||||
var request = new Request.HTML(this.requestOptions);
|
|
||||||
request.post(form);
|
|
||||||
event.stopPropagation();
|
|
||||||
return false;
|
|
||||||
}.bind(this))
|
|
||||||
}.bind(this));
|
|
||||||
}.bind(this);
|
|
||||||
|
|
||||||
this.addEvent('open', function() {
|
|
||||||
this.requestOptions.url = url;
|
|
||||||
this.requestOptions.method = 'get';
|
|
||||||
var request = new Request.HTML(this.requestOptions);
|
|
||||||
request.send();
|
|
||||||
|
|
||||||
MooDialog.Request.active = this;
|
|
||||||
}.bind(this));
|
|
||||||
|
|
||||||
this.addEvent('close', function() {
|
|
||||||
MooDialog.Request.active = null;
|
|
||||||
}.bind(this));
|
|
||||||
|
|
||||||
if (this.options.autoOpen) this.open();
|
|
||||||
},
|
|
||||||
|
|
||||||
setRequestOptions: function(options) {
|
|
||||||
this.requestOptions = Object.merge(this.requestOptions, options);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
@ -1,133 +0,0 @@
|
|||||||
/*
|
|
||||||
---
|
|
||||||
name: MooDialog
|
|
||||||
description: The base class of MooDialog
|
|
||||||
authors: Arian Stolwijk
|
|
||||||
license: MIT-style license
|
|
||||||
requires: [Core/Class, Core/Element, Core/Element.Styles, Core/Element.Event]
|
|
||||||
provides: [MooDialog, Element.MooDialog]
|
|
||||||
...
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
var MooDialog = new Class({
|
|
||||||
|
|
||||||
Implements: [Options, Events],
|
|
||||||
|
|
||||||
options: {
|
|
||||||
'class': 'MooDialog',
|
|
||||||
title: null,
|
|
||||||
scroll: true, // IE
|
|
||||||
forceScroll: false,
|
|
||||||
useEscKey: true,
|
|
||||||
destroyOnHide: true,
|
|
||||||
autoOpen: true,
|
|
||||||
closeButton: true,
|
|
||||||
onInitialize: function(){
|
|
||||||
this.wrapper.setStyle('display', 'none');
|
|
||||||
},
|
|
||||||
onBeforeOpen: function(){
|
|
||||||
this.wrapper.setStyle('display', 'block');
|
|
||||||
this.fireEvent('show');
|
|
||||||
},
|
|
||||||
onBeforeClose: function(){
|
|
||||||
this.wrapper.setStyle('display', 'none');
|
|
||||||
this.fireEvent('hide');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
initialize: function(options){
|
|
||||||
this.setOptions(options);
|
|
||||||
this.options.inject = this.options.inject || document.body;
|
|
||||||
options = this.options;
|
|
||||||
|
|
||||||
var wrapper = this.wrapper = new Element('div.' + options['class'].replace(' ', '.')).inject(options.inject);
|
|
||||||
|
|
||||||
if (options.title){
|
|
||||||
this.title = new Element('div.title').set('text', options.title).inject(wrapper);
|
|
||||||
// this.title.addClass('MooDialogTitle');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (options.closeButton){
|
|
||||||
this.closeButton = new Element('a.close', {
|
|
||||||
events: {click: this.close.bind(this)}
|
|
||||||
}).inject(wrapper);
|
|
||||||
}
|
|
||||||
this.content = new Element('div.content').inject(wrapper);
|
|
||||||
|
|
||||||
|
|
||||||
/*<ie6>*/// IE 6 scroll
|
|
||||||
if ((options.scroll && Browser.ie6) || options.forceScroll){
|
|
||||||
wrapper.setStyle('position', 'absolute');
|
|
||||||
var position = wrapper.getPosition(options.inject);
|
|
||||||
window.addEvent('scroll', function(){
|
|
||||||
var scroll = document.getScroll();
|
|
||||||
wrapper.setPosition({
|
|
||||||
x: position.x + scroll.x,
|
|
||||||
y: position.y + scroll.y
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/*</ie6>*/
|
|
||||||
|
|
||||||
if (options.useEscKey){
|
|
||||||
// Add event for the esc key
|
|
||||||
document.addEvent('keydown', function(e){
|
|
||||||
if (e.key == 'esc') this.close();
|
|
||||||
}.bind(this));
|
|
||||||
}
|
|
||||||
|
|
||||||
this.addEvent('hide', function(){
|
|
||||||
if (options.destroyOnHide)
|
|
||||||
this.destroy();
|
|
||||||
}.bind(this));
|
|
||||||
|
|
||||||
this.fireEvent('initialize', wrapper);
|
|
||||||
},
|
|
||||||
|
|
||||||
setContent: function(){
|
|
||||||
var content = Array.from(arguments);
|
|
||||||
if (content.length == 1) content = content[0];
|
|
||||||
|
|
||||||
this.content.empty();
|
|
||||||
|
|
||||||
var type = typeOf(content);
|
|
||||||
if (['string', 'number'].contains(type)) this.content.set('text', content);
|
|
||||||
else this.content.adopt(content);
|
|
||||||
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
|
|
||||||
open: function(){
|
|
||||||
this.fireEvent('beforeOpen', this.wrapper).fireEvent('open');
|
|
||||||
this.opened = true;
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
|
|
||||||
close: function(){
|
|
||||||
this.fireEvent('beforeClose', this.wrapper).fireEvent('close');
|
|
||||||
this.opened = false;
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
|
|
||||||
destroy: function(){
|
|
||||||
this.wrapper.destroy();
|
|
||||||
},
|
|
||||||
|
|
||||||
toElement: function(){
|
|
||||||
return this.wrapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
Element.implement({
|
|
||||||
|
|
||||||
MooDialog: function(options){
|
|
||||||
this.store('MooDialog',
|
|
||||||
new MooDialog(options).setContent(this).open()
|
|
||||||
);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
@ -1,143 +0,0 @@
|
|||||||
/*
|
|
||||||
---
|
|
||||||
|
|
||||||
name: Overlay
|
|
||||||
|
|
||||||
authors:
|
|
||||||
- David Walsh (http://davidwalsh.name)
|
|
||||||
|
|
||||||
license:
|
|
||||||
- MIT-style license
|
|
||||||
|
|
||||||
requires: [Core/Class, Core/Element.Style, Core/Element.Event, Core/Element.Dimensions, Core/Fx.Tween]
|
|
||||||
|
|
||||||
provides:
|
|
||||||
- Overlay
|
|
||||||
...
|
|
||||||
*/
|
|
||||||
|
|
||||||
var Overlay = new Class({
|
|
||||||
|
|
||||||
Implements: [Options, Events],
|
|
||||||
|
|
||||||
options: {
|
|
||||||
id: 'overlay',
|
|
||||||
color: '#000000',
|
|
||||||
duration: 500,
|
|
||||||
opacity: 0.8,
|
|
||||||
zIndex: 5000/*,
|
|
||||||
onClick: $empty,
|
|
||||||
onClose: $empty,
|
|
||||||
onHide: $empty,
|
|
||||||
onOpen: $empty,
|
|
||||||
onShow: $empty
|
|
||||||
*/
|
|
||||||
},
|
|
||||||
|
|
||||||
initialize: function(container, options) {
|
|
||||||
this.setOptions(options);
|
|
||||||
this.container = document.id(container);
|
|
||||||
|
|
||||||
this.bound = {
|
|
||||||
'window': {
|
|
||||||
resize: this.resize.bind(this),
|
|
||||||
scroll: this.scroll.bind(this)
|
|
||||||
},
|
|
||||||
overlayClick: this.overlayClick.bind(this),
|
|
||||||
tweenStart: this.tweenStart.bind(this),
|
|
||||||
tweenComplete: this.tweenComplete.bind(this)
|
|
||||||
};
|
|
||||||
|
|
||||||
this.build().attach();
|
|
||||||
},
|
|
||||||
|
|
||||||
build: function() {
|
|
||||||
this.overlay = new Element('div', {
|
|
||||||
id: this.options.id,
|
|
||||||
opacity: 0,
|
|
||||||
styles: {
|
|
||||||
position: (Browser.ie6) ? 'absolute' : 'fixed',
|
|
||||||
background: this.options.color,
|
|
||||||
left: 0,
|
|
||||||
top: 0,
|
|
||||||
'z-index': this.options.zIndex
|
|
||||||
}
|
|
||||||
}).inject(this.container);
|
|
||||||
|
|
||||||
this.tween = new Fx.Tween(this.overlay, {
|
|
||||||
duration: this.options.duration,
|
|
||||||
link: 'cancel',
|
|
||||||
property: 'opacity'
|
|
||||||
});
|
|
||||||
return this;
|
|
||||||
}.protect(),
|
|
||||||
|
|
||||||
attach: function() {
|
|
||||||
window.addEvents(this.bound.window);
|
|
||||||
this.overlay.addEvent('click', this.bound.overlayClick);
|
|
||||||
this.tween.addEvents({
|
|
||||||
onStart: this.bound.tweenStart,
|
|
||||||
onComplete: this.bound.tweenComplete
|
|
||||||
});
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
|
|
||||||
detach: function() {
|
|
||||||
var args = Array.prototype.slice.call(arguments);
|
|
||||||
args.each(function(item) {
|
|
||||||
if (item == 'window') window.removeEvents(this.bound.window);
|
|
||||||
if (item == 'overlay') this.overlay.removeEvent('click', this.bound.overlayClick);
|
|
||||||
}, this);
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
|
|
||||||
overlayClick: function() {
|
|
||||||
this.fireEvent('click');
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
|
|
||||||
tweenStart: function() {
|
|
||||||
this.overlay.setStyles({
|
|
||||||
width: '100%',
|
|
||||||
height: this.container.getScrollSize().y
|
|
||||||
});
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
|
|
||||||
tweenComplete: function() {
|
|
||||||
this.fireEvent(this.overlay.get('opacity') == this.options.opacity ? 'show' : 'hide');
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
|
|
||||||
open: function() {
|
|
||||||
this.fireEvent('open');
|
|
||||||
this.overlay.setStyle('display', 'block');
|
|
||||||
this.tween.start(this.options.opacity);
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
|
|
||||||
close: function() {
|
|
||||||
this.fireEvent('close');
|
|
||||||
this.overlay.setStyle('display', 'none');
|
|
||||||
this.tween.start(0);
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
|
|
||||||
destroy: function(){
|
|
||||||
this.close();
|
|
||||||
this.overlay.dispose();
|
|
||||||
},
|
|
||||||
|
|
||||||
resize: function() {
|
|
||||||
this.fireEvent('resize');
|
|
||||||
this.overlay.setStyle('height', this.container.getScrollSize().y);
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
|
|
||||||
scroll: function() {
|
|
||||||
this.fireEvent('scroll');
|
|
||||||
if (Browser.ie6) this.overlay.setStyle('left', window.getScroll().x);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
@ -1,95 +0,0 @@
|
|||||||
/* Created by Arian Stolwijk <http://www.aryweb.nl> */
|
|
||||||
|
|
||||||
.MooDialog {
|
|
||||||
position: fixed;
|
|
||||||
top: 50%;
|
|
||||||
left: 50%;
|
|
||||||
z-index: 11000;
|
|
||||||
width: 400px;
|
|
||||||
margin: -250px 0 0 -250px;
|
|
||||||
background-color: #ffffff;
|
|
||||||
border: 1px solid #999;
|
|
||||||
border: 1px solid rgba(0, 0, 0, 0.3);
|
|
||||||
*border: 1px solid #999;
|
|
||||||
/* IE6-7 */
|
|
||||||
|
|
||||||
-webkit-border-radius: 6px;
|
|
||||||
-moz-border-radius: 6px;
|
|
||||||
border-radius: 6px;
|
|
||||||
-webkit-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3);
|
|
||||||
-moz-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3);
|
|
||||||
box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3);
|
|
||||||
-webkit-background-clip: padding-box;
|
|
||||||
-moz-background-clip: padding-box;
|
|
||||||
background-clip: padding-box;
|
|
||||||
padding: 30px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.MooDialogTitle {
|
|
||||||
padding-top: 50px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.MooDialog .content {
|
|
||||||
height: 100px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.MooDialog .title {
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
border-bottom: 1px solid #a1aec5;
|
|
||||||
font-weight: bold;
|
|
||||||
text-shadow: 1px 1px 0 #fff;
|
|
||||||
/*color: black;*/
|
|
||||||
border-bottom: 1px solid #eee;
|
|
||||||
padding: 5px 30px;
|
|
||||||
font-size: 18px
|
|
||||||
}
|
|
||||||
|
|
||||||
.MooDialog .close {
|
|
||||||
background: url(dialog-close.png) no-repeat;
|
|
||||||
width: 16px;
|
|
||||||
height: 16px;
|
|
||||||
display: block;
|
|
||||||
cursor: pointer;
|
|
||||||
top: 8px;
|
|
||||||
left: 420px;
|
|
||||||
position: absolute;
|
|
||||||
}
|
|
||||||
|
|
||||||
.MooDialog .buttons {
|
|
||||||
text-align: right;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
border: 0;
|
|
||||||
background: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.MooDialog .iframe {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.MooDialog .textInput {
|
|
||||||
width: 200px;
|
|
||||||
float: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
.MooDialog .MooDialogAlert,
|
|
||||||
.MooDialog .MooDialogConfirm,
|
|
||||||
.MooDialog .MooDialogPrompt,
|
|
||||||
.MooDialog .MooDialogError {
|
|
||||||
background: url(dialog-warning.png) no-repeat;
|
|
||||||
padding-left: 40px;
|
|
||||||
min-height: 40px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.MooDialog .MooDialogConfirm,
|
|
||||||
.MooDialog .MooDialogPromt {
|
|
||||||
background: url(dialog-question.png) no-repeat;
|
|
||||||
}
|
|
||||||
|
|
||||||
.MooDialog .MooDialogError {
|
|
||||||
background: url(dialog-error.png) no-repeat;
|
|
||||||
}
|
|
Before Width: | Height: | Size: 689 B |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 1.6 KiB |
@ -1,285 +0,0 @@
|
|||||||
// MooTools: the javascript framework.
|
|
||||||
// Load this file's selection again by visiting: http://mootools.net/more/62b5cf1c687ec9e067cb5d1c933b608f
|
|
||||||
// Or build this file again with packager using: packager build More/More More/String.Extras More/URI More/URI.Relative More/Hash More/Hash.Extras More/Fx.Elements More/Fx.Accordion More/Fx.Move More/Fx.Reveal More/Fx.Scroll More/Fx.Slide More/Fx.SmoothScroll More/Fx.Sort More/Drag More/Drag.Move More/Assets More/Color More/Keyboard More/Keyboard.Extras More/Locale
|
|
||||||
/*
|
|
||||||
---
|
|
||||||
copyrights:
|
|
||||||
- [MooTools](http://mootools.net)
|
|
||||||
|
|
||||||
licenses:
|
|
||||||
- [MIT License](http://mootools.net/license.txt)
|
|
||||||
...
|
|
||||||
*/
|
|
||||||
MooTools.More={version:"1.4.0.1",build:"a4244edf2aa97ac8a196fc96082dd35af1abab87"};(function(){var c={a:/[àáâãäåăą]/g,A:/[ÀÁÂÃÄÅĂĄ]/g,c:/[ćčç]/g,C:/[ĆČÇ]/g,d:/[ďđ]/g,D:/[ĎÐ]/g,e:/[èéêëěę]/g,E:/[ÈÉÊËĚĘ]/g,g:/[ğ]/g,G:/[Ğ]/g,i:/[ìíîï]/g,I:/[ÌÍÎÏ]/g,l:/[ĺľł]/g,L:/[ĹĽŁ]/g,n:/[ñňń]/g,N:/[ÑŇŃ]/g,o:/[òóôõöøő]/g,O:/[ÒÓÔÕÖØ]/g,r:/[řŕ]/g,R:/[ŘŔ]/g,s:/[ššş]/g,S:/[ŠŞŚ]/g,t:/[ťţ]/g,T:/[ŤŢ]/g,ue:/[ü]/g,UE:/[Ü]/g,u:/[ùúûůµ]/g,U:/[ÙÚÛŮ]/g,y:/[ÿý]/g,Y:/[ŸÝ]/g,z:/[žźż]/g,Z:/[ŽŹŻ]/g,th:/[þ]/g,TH:/[Þ]/g,dh:/[ð]/g,DH:/[Ð]/g,ss:/[ß]/g,oe:/[œ]/g,OE:/[Œ]/g,ae:/[æ]/g,AE:/[Æ]/g},b={" ":/[\xa0\u2002\u2003\u2009]/g,"*":/[\xb7]/g,"'":/[\u2018\u2019]/g,'"':/[\u201c\u201d]/g,"...":/[\u2026]/g,"-":/[\u2013]/g,"»":/[\uFFFD]/g};
|
|
||||||
var a=function(f,h){var e=f,g;for(g in h){e=e.replace(h[g],g);}return e;};var d=function(e,g){e=e||"";var h=g?"<"+e+"(?!\\w)[^>]*>([\\s\\S]*?)</"+e+"(?!\\w)>":"</?"+e+"([^>]+)?>",f=new RegExp(h,"gi");
|
|
||||||
return f;};String.implement({standardize:function(){return a(this,c);},repeat:function(e){return new Array(e+1).join(this);},pad:function(e,h,g){if(this.length>=e){return this;
|
|
||||||
}var f=(h==null?" ":""+h).repeat(e-this.length).substr(0,e-this.length);if(!g||g=="right"){return this+f;}if(g=="left"){return f+this;}return f.substr(0,(f.length/2).floor())+this+f.substr(0,(f.length/2).ceil());
|
|
||||||
},getTags:function(e,f){return this.match(d(e,f))||[];},stripTags:function(e,f){return this.replace(d(e,f),"");},tidy:function(){return a(this,b);},truncate:function(e,f,i){var h=this;
|
|
||||||
if(f==null&&arguments.length==1){f="…";}if(h.length>e){h=h.substring(0,e);if(i){var g=h.lastIndexOf(i);if(g!=-1){h=h.substr(0,g);}}if(f){h+=f;}}return h;
|
|
||||||
}});})();String.implement({parseQueryString:function(d,a){if(d==null){d=true;}if(a==null){a=true;}var c=this.split(/[&;]/),b={};if(!c.length){return b;
|
|
||||||
}c.each(function(i){var e=i.indexOf("=")+1,g=e?i.substr(e):"",f=e?i.substr(0,e-1).match(/([^\]\[]+|(\B)(?=\]))/g):[i],h=b;if(!f){return;}if(a){g=decodeURIComponent(g);
|
|
||||||
}f.each(function(k,j){if(d){k=decodeURIComponent(k);}var l=h[k];if(j<f.length-1){h=h[k]=l||{};}else{if(typeOf(l)=="array"){l.push(g);}else{h[k]=l!=null?[l,g]:g;
|
|
||||||
}}});});return b;},cleanQueryString:function(a){return this.split("&").filter(function(e){var b=e.indexOf("="),c=b<0?"":e.substr(0,b),d=e.substr(b+1);return a?a.call(null,c,d):(d||d===0);
|
|
||||||
}).join("&");}});(function(){var b=function(){return this.get("value");};var a=this.URI=new Class({Implements:Options,options:{},regex:/^(?:(\w+):)?(?:\/\/(?:(?:([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#]*)(?::(\d*))?)?(\.\.?$|(?:[^?#\/]*\/)*)([^?#]*)(?:\?([^#]*))?(?:#(.*))?/,parts:["scheme","user","password","host","port","directory","file","query","fragment"],schemes:{http:80,https:443,ftp:21,rtsp:554,mms:1755,file:0},initialize:function(d,c){this.setOptions(c);
|
|
||||||
var e=this.options.base||a.base;if(!d){d=e;}if(d&&d.parsed){this.parsed=Object.clone(d.parsed);}else{this.set("value",d.href||d.toString(),e?new a(e):false);
|
|
||||||
}},parse:function(e,d){var c=e.match(this.regex);if(!c){return false;}c.shift();return this.merge(c.associate(this.parts),d);},merge:function(d,c){if((!d||!d.scheme)&&(!c||!c.scheme)){return false;
|
|
||||||
}if(c){this.parts.every(function(e){if(d[e]){return false;}d[e]=c[e]||"";return true;});}d.port=d.port||this.schemes[d.scheme.toLowerCase()];d.directory=d.directory?this.parseDirectory(d.directory,c?c.directory:""):"/";
|
|
||||||
return d;},parseDirectory:function(d,e){d=(d.substr(0,1)=="/"?"":(e||"/"))+d;if(!d.test(a.regs.directoryDot)){return d;}var c=[];d.replace(a.regs.endSlash,"").split("/").each(function(f){if(f==".."&&c.length>0){c.pop();
|
|
||||||
}else{if(f!="."){c.push(f);}}});return c.join("/")+"/";},combine:function(c){return c.value||c.scheme+"://"+(c.user?c.user+(c.password?":"+c.password:"")+"@":"")+(c.host||"")+(c.port&&c.port!=this.schemes[c.scheme]?":"+c.port:"")+(c.directory||"/")+(c.file||"")+(c.query?"?"+c.query:"")+(c.fragment?"#"+c.fragment:"");
|
|
||||||
},set:function(d,f,e){if(d=="value"){var c=f.match(a.regs.scheme);if(c){c=c[1];}if(c&&this.schemes[c.toLowerCase()]==null){this.parsed={scheme:c,value:f};
|
|
||||||
}else{this.parsed=this.parse(f,(e||this).parsed)||(c?{scheme:c,value:f}:{value:f});}}else{if(d=="data"){this.setData(f);}else{this.parsed[d]=f;}}return this;
|
|
||||||
},get:function(c,d){switch(c){case"value":return this.combine(this.parsed,d?d.parsed:false);case"data":return this.getData();}return this.parsed[c]||"";
|
|
||||||
},go:function(){document.location.href=this.toString();},toURI:function(){return this;},getData:function(e,d){var c=this.get(d||"query");if(!(c||c===0)){return e?null:{};
|
|
||||||
}var f=c.parseQueryString();return e?f[e]:f;},setData:function(c,f,d){if(typeof c=="string"){var e=this.getData();e[arguments[0]]=arguments[1];c=e;}else{if(f){c=Object.merge(this.getData(),c);
|
|
||||||
}}return this.set(d||"query",Object.toQueryString(c));},clearData:function(c){return this.set(c||"query","");},toString:b,valueOf:b});a.regs={endSlash:/\/$/,scheme:/^(\w+):/,directoryDot:/\.\/|\.$/};
|
|
||||||
a.base=new a(Array.from(document.getElements("base[href]",true)).getLast(),{base:document.location});String.implement({toURI:function(c){return new a(this,c);
|
|
||||||
}});})();Class.refactor=function(b,a){Object.each(a,function(e,d){var c=b.prototype[d];c=(c&&c.$origin)||c||function(){};b.implement(d,(typeof e=="function")?function(){var f=this.previous;
|
|
||||||
this.previous=c;var g=e.apply(this,arguments);this.previous=f;return g;}:e);});return b;};URI=Class.refactor(URI,{combine:function(f,e){if(!e||f.scheme!=e.scheme||f.host!=e.host||f.port!=e.port){return this.previous.apply(this,arguments);
|
|
||||||
}var a=f.file+(f.query?"?"+f.query:"")+(f.fragment?"#"+f.fragment:"");if(!e.directory){return(f.directory||(f.file?"":"./"))+a;}var d=e.directory.split("/"),c=f.directory.split("/"),g="",h;
|
|
||||||
var b=0;for(h=0;h<d.length&&h<c.length&&d[h]==c[h];h++){}for(b=0;b<d.length-h-1;b++){g+="../";}for(b=h;b<c.length-1;b++){g+=c[b]+"/";}return(g||(f.file?"":"./"))+a;
|
|
||||||
},toAbsolute:function(a){a=new URI(a);if(a){a.set("directory","").set("file","");}return this.toRelative(a);},toRelative:function(a){return this.get("value",new URI(a));
|
|
||||||
}});(function(){if(this.Hash){return;}var a=this.Hash=new Type("Hash",function(b){if(typeOf(b)=="hash"){b=Object.clone(b.getClean());}for(var c in b){this[c]=b[c];
|
|
||||||
}return this;});this.$H=function(b){return new a(b);};a.implement({forEach:function(b,c){Object.forEach(this,b,c);},getClean:function(){var c={};for(var b in this){if(this.hasOwnProperty(b)){c[b]=this[b];
|
|
||||||
}}return c;},getLength:function(){var c=0;for(var b in this){if(this.hasOwnProperty(b)){c++;}}return c;}});a.alias("each","forEach");a.implement({has:Object.prototype.hasOwnProperty,keyOf:function(b){return Object.keyOf(this,b);
|
|
||||||
},hasValue:function(b){return Object.contains(this,b);},extend:function(b){a.each(b||{},function(d,c){a.set(this,c,d);},this);return this;},combine:function(b){a.each(b||{},function(d,c){a.include(this,c,d);
|
|
||||||
},this);return this;},erase:function(b){if(this.hasOwnProperty(b)){delete this[b];}return this;},get:function(b){return(this.hasOwnProperty(b))?this[b]:null;
|
|
||||||
},set:function(b,c){if(!this[b]||this.hasOwnProperty(b)){this[b]=c;}return this;},empty:function(){a.each(this,function(c,b){delete this[b];},this);return this;
|
|
||||||
},include:function(b,c){if(this[b]==undefined){this[b]=c;}return this;},map:function(b,c){return new a(Object.map(this,b,c));},filter:function(b,c){return new a(Object.filter(this,b,c));
|
|
||||||
},every:function(b,c){return Object.every(this,b,c);},some:function(b,c){return Object.some(this,b,c);},getKeys:function(){return Object.keys(this);},getValues:function(){return Object.values(this);
|
|
||||||
},toQueryString:function(b){return Object.toQueryString(this,b);}});a.alias({indexOf:"keyOf",contains:"hasValue"});})();(function(){var b=function(c){return c!=null;
|
|
||||||
};var a=Object.prototype.hasOwnProperty;Object.extend({getFromPath:function(e,f){if(typeof f=="string"){f=f.split(".");}for(var d=0,c=f.length;d<c;d++){if(a.call(e,f[d])){e=e[f[d]];
|
|
||||||
}else{return null;}}return e;},cleanValues:function(c,e){e=e||b;for(var d in c){if(!e(c[d])){delete c[d];}}return c;},erase:function(c,d){if(a.call(c,d)){delete c[d];
|
|
||||||
}return c;},run:function(d){var c=Array.slice(arguments,1);for(var e in d){if(d[e].apply){d[e].apply(d,c);}}return d;}});})();Hash.implement({getFromPath:function(a){return Object.getFromPath(this,a);
|
|
||||||
},cleanValues:function(a){return new Hash(Object.cleanValues(this,a));},run:function(){Object.run(arguments);}});Fx.Elements=new Class({Extends:Fx.CSS,initialize:function(b,a){this.elements=this.subject=$$(b);
|
|
||||||
this.parent(a);},compute:function(g,h,j){var c={};for(var d in g){var a=g[d],e=h[d],f=c[d]={};for(var b in a){f[b]=this.parent(a[b],e[b],j);}}return c;
|
|
||||||
},set:function(b){for(var c in b){if(!this.elements[c]){continue;}var a=b[c];for(var d in a){this.render(this.elements[c],d,a[d],this.options.unit);}}return this;
|
|
||||||
},start:function(c){if(!this.check(c)){return this;}var h={},j={};for(var d in c){if(!this.elements[d]){continue;}var f=c[d],a=h[d]={},g=j[d]={};for(var b in f){var e=this.prepare(this.elements[d],b,f[b]);
|
|
||||||
a[b]=e.from;g[b]=e.to;}}return this.parent(h,j);}});Fx.Accordion=new Class({Extends:Fx.Elements,options:{fixedHeight:false,fixedWidth:false,display:0,show:false,height:true,width:false,opacity:true,alwaysHide:false,trigger:"click",initialDisplayFx:true,resetHeight:true},initialize:function(){var g=function(h){return h!=null;
|
|
||||||
};var f=Array.link(arguments,{container:Type.isElement,options:Type.isObject,togglers:g,elements:g});this.parent(f.elements,f.options);var b=this.options,e=this.togglers=$$(f.togglers);
|
|
||||||
this.previous=-1;this.internalChain=new Chain();if(b.alwaysHide){this.options.link="chain";}if(b.show||this.options.show===0){b.display=false;this.previous=b.show;
|
|
||||||
}if(b.start){b.display=false;b.show=false;}var d=this.effects={};if(b.opacity){d.opacity="fullOpacity";}if(b.width){d.width=b.fixedWidth?"fullWidth":"offsetWidth";
|
|
||||||
}if(b.height){d.height=b.fixedHeight?"fullHeight":"scrollHeight";}for(var c=0,a=e.length;c<a;c++){this.addSection(e[c],this.elements[c]);}this.elements.each(function(j,h){if(b.show===h){this.fireEvent("active",[e[h],j]);
|
|
||||||
}else{for(var k in d){j.setStyle(k,0);}}},this);if(b.display||b.display===0||b.initialDisplayFx===false){this.display(b.display,b.initialDisplayFx);}if(b.fixedHeight!==false){b.resetHeight=false;
|
|
||||||
}this.addEvent("complete",this.internalChain.callChain.bind(this.internalChain));},addSection:function(g,d){g=document.id(g);d=document.id(d);this.togglers.include(g);
|
|
||||||
this.elements.include(d);var f=this.togglers,c=this.options,h=f.contains(g),a=f.indexOf(g),b=this.display.pass(a,this);g.store("accordion:display",b).addEvent(c.trigger,b);
|
|
||||||
if(c.height){d.setStyles({"padding-top":0,"border-top":"none","padding-bottom":0,"border-bottom":"none"});}if(c.width){d.setStyles({"padding-left":0,"border-left":"none","padding-right":0,"border-right":"none"});
|
|
||||||
}d.fullOpacity=1;if(c.fixedWidth){d.fullWidth=c.fixedWidth;}if(c.fixedHeight){d.fullHeight=c.fixedHeight;}d.setStyle("overflow","hidden");if(!h){for(var e in this.effects){d.setStyle(e,0);
|
|
||||||
}}return this;},removeSection:function(f,b){var e=this.togglers,a=e.indexOf(f),c=this.elements[a];var d=function(){e.erase(f);this.elements.erase(c);this.detach(f);
|
|
||||||
}.bind(this);if(this.now==a||b!=null){this.display(b!=null?b:(a-1>=0?a-1:0)).chain(d);}else{d();}return this;},detach:function(b){var a=function(c){c.removeEvent(this.options.trigger,c.retrieve("accordion:display"));
|
|
||||||
}.bind(this);if(!b){this.togglers.each(a);}else{a(b);}return this;},display:function(b,c){if(!this.check(b,c)){return this;}var h={},g=this.elements,a=this.options,f=this.effects;
|
|
||||||
if(c==null){c=true;}if(typeOf(b)=="element"){b=g.indexOf(b);}if(b==this.previous&&!a.alwaysHide){return this;}if(a.resetHeight){var e=g[this.previous];
|
|
||||||
if(e&&!this.selfHidden){for(var d in f){e.setStyle(d,e[f[d]]);}}}if((this.timer&&a.link=="chain")||(b===this.previous&&!a.alwaysHide)){return this;}this.previous=b;
|
|
||||||
this.selfHidden=false;g.each(function(l,k){h[k]={};var j;if(k!=b){j=true;}else{if(a.alwaysHide&&((l.offsetHeight>0&&a.height)||l.offsetWidth>0&&a.width)){j=true;
|
|
||||||
this.selfHidden=true;}}this.fireEvent(j?"background":"active",[this.togglers[k],l]);for(var m in f){h[k][m]=j?0:l[f[m]];}if(!c&&!j&&a.resetHeight){h[k].height="auto";
|
|
||||||
}},this);this.internalChain.clearChain();this.internalChain.chain(function(){if(a.resetHeight&&!this.selfHidden){var i=g[b];if(i){i.setStyle("height","auto");
|
|
||||||
}}}.bind(this));return c?this.start(h):this.set(h).internalChain.callChain();}});(function(){var b=function(e,d){var f=[];Object.each(d,function(g){Object.each(g,function(h){e.each(function(i){f.push(i+"-"+h+(i=="border"?"-width":""));
|
|
||||||
});});});return f;};var c=function(f,e){var d=0;Object.each(e,function(h,g){if(g.test(f)){d=d+h.toInt();}});return d;};var a=function(d){return !!(!d||d.offsetHeight||d.offsetWidth);
|
|
||||||
};Element.implement({measure:function(h){if(a(this)){return h.call(this);}var g=this.getParent(),e=[];while(!a(g)&&g!=document.body){e.push(g.expose());
|
|
||||||
g=g.getParent();}var f=this.expose(),d=h.call(this);f();e.each(function(i){i();});return d;},expose:function(){if(this.getStyle("display")!="none"){return function(){};
|
|
||||||
}var d=this.style.cssText;this.setStyles({display:"block",position:"absolute",visibility:"hidden"});return function(){this.style.cssText=d;}.bind(this);
|
|
||||||
},getDimensions:function(d){d=Object.merge({computeSize:false},d);var i={x:0,y:0};var h=function(j,e){return(e.computeSize)?j.getComputedSize(e):j.getSize();
|
|
||||||
};var f=this.getParent("body");if(f&&this.getStyle("display")=="none"){i=this.measure(function(){return h(this,d);});}else{if(f){try{i=h(this,d);}catch(g){}}}return Object.append(i,(i.x||i.x===0)?{width:i.x,height:i.y}:{x:i.width,y:i.height});
|
|
||||||
},getComputedSize:function(d){d=Object.merge({styles:["padding","border"],planes:{height:["top","bottom"],width:["left","right"]},mode:"both"},d);var g={},e={width:0,height:0},f;
|
|
||||||
if(d.mode=="vertical"){delete e.width;delete d.planes.width;}else{if(d.mode=="horizontal"){delete e.height;delete d.planes.height;}}b(d.styles,d.planes).each(function(h){g[h]=this.getStyle(h).toInt();
|
|
||||||
},this);Object.each(d.planes,function(i,h){var k=h.capitalize(),j=this.getStyle(h);if(j=="auto"&&!f){f=this.getDimensions();}j=g[h]=(j=="auto")?f[h]:j.toInt();
|
|
||||||
e["total"+k]=j;i.each(function(m){var l=c(m,g);e["computed"+m.capitalize()]=l;e["total"+k]+=l;});},this);return Object.append(e,g);}});})();(function(b){var a=Element.Position={options:{relativeTo:document.body,position:{x:"center",y:"center"},offset:{x:0,y:0}},getOptions:function(d,c){c=Object.merge({},a.options,c);
|
|
||||||
a.setPositionOption(c);a.setEdgeOption(c);a.setOffsetOption(d,c);a.setDimensionsOption(d,c);return c;},setPositionOption:function(c){c.position=a.getCoordinateFromValue(c.position);
|
|
||||||
},setEdgeOption:function(d){var c=a.getCoordinateFromValue(d.edge);d.edge=c?c:(d.position.x=="center"&&d.position.y=="center")?{x:"center",y:"center"}:{x:"left",y:"top"};
|
|
||||||
},setOffsetOption:function(f,d){var c={x:0,y:0},g=f.measure(function(){return document.id(this.getOffsetParent());}),e=g.getScroll();if(!g||g==f.getDocument().body){return;
|
|
||||||
}c=g.measure(function(){var i=this.getPosition();if(this.getStyle("position")=="fixed"){var h=window.getScroll();i.x+=h.x;i.y+=h.y;}return i;});d.offset={parentPositioned:g!=document.id(d.relativeTo),x:d.offset.x-c.x+e.x,y:d.offset.y-c.y+e.y};
|
|
||||||
},setDimensionsOption:function(d,c){c.dimensions=d.getDimensions({computeSize:true,styles:["padding","border","margin"]});},getPosition:function(e,d){var c={};
|
|
||||||
d=a.getOptions(e,d);var f=document.id(d.relativeTo)||document.body;a.setPositionCoordinates(d,c,f);if(d.edge){a.toEdge(c,d);}var g=d.offset;c.left=((c.x>=0||g.parentPositioned||d.allowNegative)?c.x:0).toInt();
|
|
||||||
c.top=((c.y>=0||g.parentPositioned||d.allowNegative)?c.y:0).toInt();a.toMinMax(c,d);if(d.relFixedPosition||f.getStyle("position")=="fixed"){a.toRelFixedPosition(f,c);
|
|
||||||
}if(d.ignoreScroll){a.toIgnoreScroll(f,c);}if(d.ignoreMargins){a.toIgnoreMargins(c,d);}c.left=Math.ceil(c.left);c.top=Math.ceil(c.top);delete c.x;delete c.y;
|
|
||||||
return c;},setPositionCoordinates:function(k,g,d){var f=k.offset.y,h=k.offset.x,e=(d==document.body)?window.getScroll():d.getPosition(),j=e.y,c=e.x,i=window.getSize();
|
|
||||||
switch(k.position.x){case"left":g.x=c+h;break;case"right":g.x=c+h+d.offsetWidth;break;default:g.x=c+((d==document.body?i.x:d.offsetWidth)/2)+h;break;}switch(k.position.y){case"top":g.y=j+f;
|
|
||||||
break;case"bottom":g.y=j+f+d.offsetHeight;break;default:g.y=j+((d==document.body?i.y:d.offsetHeight)/2)+f;break;}},toMinMax:function(c,d){var f={left:"x",top:"y"},e;
|
|
||||||
["minimum","maximum"].each(function(g){["left","top"].each(function(h){e=d[g]?d[g][f[h]]:null;if(e!=null&&((g=="minimum")?c[h]<e:c[h]>e)){c[h]=e;}});});
|
|
||||||
},toRelFixedPosition:function(e,c){var d=window.getScroll();c.top+=d.y;c.left+=d.x;},toIgnoreScroll:function(e,d){var c=e.getScroll();d.top-=c.y;d.left-=c.x;
|
|
||||||
},toIgnoreMargins:function(c,d){c.left+=d.edge.x=="right"?d.dimensions["margin-right"]:(d.edge.x!="center"?-d.dimensions["margin-left"]:-d.dimensions["margin-left"]+((d.dimensions["margin-right"]+d.dimensions["margin-left"])/2));
|
|
||||||
c.top+=d.edge.y=="bottom"?d.dimensions["margin-bottom"]:(d.edge.y!="center"?-d.dimensions["margin-top"]:-d.dimensions["margin-top"]+((d.dimensions["margin-bottom"]+d.dimensions["margin-top"])/2));
|
|
||||||
},toEdge:function(c,d){var e={},g=d.dimensions,f=d.edge;switch(f.x){case"left":e.x=0;break;case"right":e.x=-g.x-g.computedRight-g.computedLeft;break;default:e.x=-(Math.round(g.totalWidth/2));
|
|
||||||
break;}switch(f.y){case"top":e.y=0;break;case"bottom":e.y=-g.y-g.computedTop-g.computedBottom;break;default:e.y=-(Math.round(g.totalHeight/2));break;}c.x+=e.x;
|
|
||||||
c.y+=e.y;},getCoordinateFromValue:function(c){if(typeOf(c)!="string"){return c;}c=c.toLowerCase();return{x:c.test("left")?"left":(c.test("right")?"right":"center"),y:c.test(/upper|top/)?"top":(c.test("bottom")?"bottom":"center")};
|
|
||||||
}};Element.implement({position:function(d){if(d&&(d.x!=null||d.y!=null)){return(b?b.apply(this,arguments):this);}var c=this.setStyle("position","absolute").calculatePosition(d);
|
|
||||||
return(d&&d.returnPos)?c:this.setStyles(c);},calculatePosition:function(c){return a.getPosition(this,c);}});})(Element.prototype.position);Fx.Move=new Class({Extends:Fx.Morph,options:{relativeTo:document.body,position:"center",edge:false,offset:{x:0,y:0}},start:function(a){var b=this.element,c=b.getStyles("top","left");
|
|
||||||
if(c.top=="auto"||c.left=="auto"){b.setPosition(b.getPosition(b.getOffsetParent()));}return this.parent(b.position(Object.merge({},this.options,a,{returnPos:true})));
|
|
||||||
}});Element.Properties.move={set:function(a){this.get("move").cancel().setOptions(a);return this;},get:function(){var a=this.retrieve("move");if(!a){a=new Fx.Move(this,{link:"cancel"});
|
|
||||||
this.store("move",a);}return a;}};Element.implement({move:function(a){this.get("move").start(a);return this;}});Element.implement({isDisplayed:function(){return this.getStyle("display")!="none";
|
|
||||||
},isVisible:function(){var a=this.offsetWidth,b=this.offsetHeight;return(a==0&&b==0)?false:(a>0&&b>0)?true:this.style.display!="none";},toggle:function(){return this[this.isDisplayed()?"hide":"show"]();
|
|
||||||
},hide:function(){var b;try{b=this.getStyle("display");}catch(a){}if(b=="none"){return this;}return this.store("element:_originalDisplay",b||"").setStyle("display","none");
|
|
||||||
},show:function(a){if(!a&&this.isDisplayed()){return this;}a=a||this.retrieve("element:_originalDisplay")||"block";return this.setStyle("display",(a=="none")?"block":a);
|
|
||||||
},swapClass:function(a,b){return this.removeClass(a).addClass(b);}});Document.implement({clearSelection:function(){if(window.getSelection){var a=window.getSelection();
|
|
||||||
if(a&&a.removeAllRanges){a.removeAllRanges();}}else{if(document.selection&&document.selection.empty){try{document.selection.empty();}catch(b){}}}}});(function(){var a=function(d){var b=d.options.hideInputs;
|
|
||||||
if(window.OverText){var c=[null];OverText.each(function(e){c.include("."+e.options.labelClass);});if(c){b+=c.join(", ");}}return(b)?d.element.getElements(b):null;
|
|
||||||
};Fx.Reveal=new Class({Extends:Fx.Morph,options:{link:"cancel",styles:["padding","border","margin"],transitionOpacity:!Browser.ie6,mode:"vertical",display:function(){return this.element.get("tag")!="tr"?"block":"table-row";
|
|
||||||
},opacity:1,hideInputs:Browser.ie?"select, input, textarea, object, embed":null},dissolve:function(){if(!this.hiding&&!this.showing){if(this.element.getStyle("display")!="none"){this.hiding=true;
|
|
||||||
this.showing=false;this.hidden=true;this.cssText=this.element.style.cssText;var d=this.element.getComputedSize({styles:this.options.styles,mode:this.options.mode});
|
|
||||||
if(this.options.transitionOpacity){d.opacity=this.options.opacity;}var c={};Object.each(d,function(f,e){c[e]=[f,0];});this.element.setStyles({display:Function.from(this.options.display).call(this),overflow:"hidden"});
|
|
||||||
var b=a(this);if(b){b.setStyle("visibility","hidden");}this.$chain.unshift(function(){if(this.hidden){this.hiding=false;this.element.style.cssText=this.cssText;
|
|
||||||
this.element.setStyle("display","none");if(b){b.setStyle("visibility","visible");}}this.fireEvent("hide",this.element);this.callChain();}.bind(this));this.start(c);
|
|
||||||
}else{this.callChain.delay(10,this);this.fireEvent("complete",this.element);this.fireEvent("hide",this.element);}}else{if(this.options.link=="chain"){this.chain(this.dissolve.bind(this));
|
|
||||||
}else{if(this.options.link=="cancel"&&!this.hiding){this.cancel();this.dissolve();}}}return this;},reveal:function(){if(!this.showing&&!this.hiding){if(this.element.getStyle("display")=="none"){this.hiding=false;
|
|
||||||
this.showing=true;this.hidden=false;this.cssText=this.element.style.cssText;var d;this.element.measure(function(){d=this.element.getComputedSize({styles:this.options.styles,mode:this.options.mode});
|
|
||||||
}.bind(this));if(this.options.heightOverride!=null){d.height=this.options.heightOverride.toInt();}if(this.options.widthOverride!=null){d.width=this.options.widthOverride.toInt();
|
|
||||||
}if(this.options.transitionOpacity){this.element.setStyle("opacity",0);d.opacity=this.options.opacity;}var c={height:0,display:Function.from(this.options.display).call(this)};
|
|
||||||
Object.each(d,function(f,e){c[e]=0;});c.overflow="hidden";this.element.setStyles(c);var b=a(this);if(b){b.setStyle("visibility","hidden");}this.$chain.unshift(function(){this.element.style.cssText=this.cssText;
|
|
||||||
this.element.setStyle("display",Function.from(this.options.display).call(this));if(!this.hidden){this.showing=false;}if(b){b.setStyle("visibility","visible");
|
|
||||||
}this.callChain();this.fireEvent("show",this.element);}.bind(this));this.start(d);}else{this.callChain();this.fireEvent("complete",this.element);this.fireEvent("show",this.element);
|
|
||||||
}}else{if(this.options.link=="chain"){this.chain(this.reveal.bind(this));}else{if(this.options.link=="cancel"&&!this.showing){this.cancel();this.reveal();
|
|
||||||
}}}return this;},toggle:function(){if(this.element.getStyle("display")=="none"){this.reveal();}else{this.dissolve();}return this;},cancel:function(){this.parent.apply(this,arguments);
|
|
||||||
if(this.cssText!=null){this.element.style.cssText=this.cssText;}this.hiding=false;this.showing=false;return this;}});Element.Properties.reveal={set:function(b){this.get("reveal").cancel().setOptions(b);
|
|
||||||
return this;},get:function(){var b=this.retrieve("reveal");if(!b){b=new Fx.Reveal(this);this.store("reveal",b);}return b;}};Element.Properties.dissolve=Element.Properties.reveal;
|
|
||||||
Element.implement({reveal:function(b){this.get("reveal").setOptions(b).reveal();return this;},dissolve:function(b){this.get("reveal").setOptions(b).dissolve();
|
|
||||||
return this;},nix:function(b){var c=Array.link(arguments,{destroy:Type.isBoolean,options:Type.isObject});this.get("reveal").setOptions(b).dissolve().chain(function(){this[c.destroy?"destroy":"dispose"]();
|
|
||||||
}.bind(this));return this;},wink:function(){var c=Array.link(arguments,{duration:Type.isNumber,options:Type.isObject});var b=this.get("reveal").setOptions(c.options);
|
|
||||||
b.reveal().chain(function(){(function(){b.dissolve();}).delay(c.duration||2000);});}});})();(function(){Fx.Scroll=new Class({Extends:Fx,options:{offset:{x:0,y:0},wheelStops:true},initialize:function(c,b){this.element=this.subject=document.id(c);
|
|
||||||
this.parent(b);if(typeOf(this.element)!="element"){this.element=document.id(this.element.getDocument().body);}if(this.options.wheelStops){var d=this.element,e=this.cancel.pass(false,this);
|
|
||||||
this.addEvent("start",function(){d.addEvent("mousewheel",e);},true);this.addEvent("complete",function(){d.removeEvent("mousewheel",e);},true);}},set:function(){var b=Array.flatten(arguments);
|
|
||||||
if(Browser.firefox){b=[Math.round(b[0]),Math.round(b[1])];}this.element.scrollTo(b[0],b[1]);return this;},compute:function(d,c,b){return[0,1].map(function(e){return Fx.compute(d[e],c[e],b);
|
|
||||||
});},start:function(c,d){if(!this.check(c,d)){return this;}var b=this.element.getScroll();return this.parent([b.x,b.y],[c,d]);},calculateScroll:function(g,f){var d=this.element,b=d.getScrollSize(),h=d.getScroll(),j=d.getSize(),c=this.options.offset,i={x:g,y:f};
|
|
||||||
for(var e in i){if(!i[e]&&i[e]!==0){i[e]=h[e];}if(typeOf(i[e])!="number"){i[e]=b[e]-j[e];}i[e]+=c[e];}return[i.x,i.y];},toTop:function(){return this.start.apply(this,this.calculateScroll(false,0));
|
|
||||||
},toLeft:function(){return this.start.apply(this,this.calculateScroll(0,false));},toRight:function(){return this.start.apply(this,this.calculateScroll("right",false));
|
|
||||||
},toBottom:function(){return this.start.apply(this,this.calculateScroll(false,"bottom"));},toElement:function(d,e){e=e?Array.from(e):["x","y"];var c=a(this.element)?{x:0,y:0}:this.element.getScroll();
|
|
||||||
var b=Object.map(document.id(d).getPosition(this.element),function(g,f){return e.contains(f)?g+c[f]:false;});return this.start.apply(this,this.calculateScroll(b.x,b.y));
|
|
||||||
},toElementEdge:function(d,g,e){g=g?Array.from(g):["x","y"];d=document.id(d);var i={},f=d.getPosition(this.element),j=d.getSize(),h=this.element.getScroll(),b=this.element.getSize(),c={x:f.x+j.x,y:f.y+j.y};
|
|
||||||
["x","y"].each(function(k){if(g.contains(k)){if(c[k]>h[k]+b[k]){i[k]=c[k]-b[k];}if(f[k]<h[k]){i[k]=f[k];}}if(i[k]==null){i[k]=h[k];}if(e&&e[k]){i[k]=i[k]+e[k];
|
|
||||||
}},this);if(i.x!=h.x||i.y!=h.y){this.start(i.x,i.y);}return this;},toElementCenter:function(e,f,h){f=f?Array.from(f):["x","y"];e=document.id(e);var i={},c=e.getPosition(this.element),d=e.getSize(),b=this.element.getScroll(),g=this.element.getSize();
|
|
||||||
["x","y"].each(function(j){if(f.contains(j)){i[j]=c[j]-(g[j]-d[j])/2;}if(i[j]==null){i[j]=b[j];}if(h&&h[j]){i[j]=i[j]+h[j];}},this);if(i.x!=b.x||i.y!=b.y){this.start(i.x,i.y);
|
|
||||||
}return this;}});function a(b){return(/^(?:body|html)$/i).test(b.tagName);}})();Fx.Slide=new Class({Extends:Fx,options:{mode:"vertical",wrapper:false,hideOverflow:true,resetHeight:false},initialize:function(b,a){b=this.element=this.subject=document.id(b);
|
|
||||||
this.parent(a);a=this.options;var d=b.retrieve("wrapper"),c=b.getStyles("margin","position","overflow");if(a.hideOverflow){c=Object.append(c,{overflow:"hidden"});
|
|
||||||
}if(a.wrapper){d=document.id(a.wrapper).setStyles(c);}if(!d){d=new Element("div",{styles:c}).wraps(b);}b.store("wrapper",d).setStyle("margin",0);if(b.getStyle("overflow")=="visible"){b.setStyle("overflow","hidden");
|
|
||||||
}this.now=[];this.open=true;this.wrapper=d;this.addEvent("complete",function(){this.open=(d["offset"+this.layout.capitalize()]!=0);if(this.open&&this.options.resetHeight){d.setStyle("height","");
|
|
||||||
}},true);},vertical:function(){this.margin="margin-top";this.layout="height";this.offset=this.element.offsetHeight;},horizontal:function(){this.margin="margin-left";
|
|
||||||
this.layout="width";this.offset=this.element.offsetWidth;},set:function(a){this.element.setStyle(this.margin,a[0]);this.wrapper.setStyle(this.layout,a[1]);
|
|
||||||
return this;},compute:function(c,b,a){return[0,1].map(function(d){return Fx.compute(c[d],b[d],a);});},start:function(b,e){if(!this.check(b,e)){return this;
|
|
||||||
}this[e||this.options.mode]();var d=this.element.getStyle(this.margin).toInt(),c=this.wrapper.getStyle(this.layout).toInt(),a=[[d,c],[0,this.offset]],g=[[d,c],[-this.offset,0]],f;
|
|
||||||
switch(b){case"in":f=a;break;case"out":f=g;break;case"toggle":f=(c==0)?a:g;}return this.parent(f[0],f[1]);},slideIn:function(a){return this.start("in",a);
|
|
||||||
},slideOut:function(a){return this.start("out",a);},hide:function(a){this[a||this.options.mode]();this.open=false;return this.set([-this.offset,0]);},show:function(a){this[a||this.options.mode]();
|
|
||||||
this.open=true;return this.set([0,this.offset]);},toggle:function(a){return this.start("toggle",a);}});Element.Properties.slide={set:function(a){this.get("slide").cancel().setOptions(a);
|
|
||||||
return this;},get:function(){var a=this.retrieve("slide");if(!a){a=new Fx.Slide(this,{link:"cancel"});this.store("slide",a);}return a;}};Element.implement({slide:function(d,e){d=d||"toggle";
|
|
||||||
var b=this.get("slide"),a;switch(d){case"hide":b.hide(e);break;case"show":b.show(e);break;case"toggle":var c=this.retrieve("slide:flag",b.open);b[c?"slideOut":"slideIn"](e);
|
|
||||||
this.store("slide:flag",!c);a=true;break;default:b.start(d,e);}if(!a){this.eliminate("slide:flag");}return this;}});Fx.SmoothScroll=new Class({Extends:Fx.Scroll,options:{axes:["x","y"]},initialize:function(c,d){d=d||document;
|
|
||||||
this.doc=d.getDocument();this.parent(this.doc,c);var e=d.getWindow(),a=e.location.href.match(/^[^#]*/)[0]+"#",b=$$(this.options.links||this.doc.links);
|
|
||||||
b.each(function(g){if(g.href.indexOf(a)!=0){return;}var f=g.href.substr(a.length);if(f){this.useLink(g,f);}},this);this.addEvent("complete",function(){e.location.hash=this.anchor;
|
|
||||||
this.element.scrollTo(this.to[0],this.to[1]);},true);},useLink:function(b,a){b.addEvent("click",function(d){var c=document.id(a)||this.doc.getElement("a[name="+a+"]");
|
|
||||||
if(!c){return;}d.preventDefault();this.toElement(c,this.options.axes).chain(function(){this.fireEvent("scrolledTo",[b,c]);}.bind(this));this.anchor=a;}.bind(this));
|
|
||||||
return this;}});Fx.Sort=new Class({Extends:Fx.Elements,options:{mode:"vertical"},initialize:function(b,a){this.parent(b,a);this.elements.each(function(c){if(c.getStyle("position")=="static"){c.setStyle("position","relative");
|
|
||||||
}});this.setDefaultOrder();},setDefaultOrder:function(){this.currentOrder=this.elements.map(function(b,a){return a;});},sort:function(){if(!this.check(arguments)){return this;
|
|
||||||
}var e=Array.flatten(arguments);var i=0,a=0,c={},h={},d=this.options.mode=="vertical";var f=this.elements.map(function(m,k){var l=m.getComputedSize({styles:["border","padding","margin"]});
|
|
||||||
var n;if(d){n={top:i,margin:l["margin-top"],height:l.totalHeight};i+=n.height-l["margin-top"];}else{n={left:a,margin:l["margin-left"],width:l.totalWidth};
|
|
||||||
a+=n.width;}var j=d?"top":"left";h[k]={};var o=m.getStyle(j).toInt();h[k][j]=o||0;return n;},this);this.set(h);e=e.map(function(j){return j.toInt();});
|
|
||||||
if(e.length!=this.elements.length){this.currentOrder.each(function(j){if(!e.contains(j)){e.push(j);}});if(e.length>this.elements.length){e.splice(this.elements.length-1,e.length-this.elements.length);
|
|
||||||
}}var b=0;i=a=0;e.each(function(k){var j={};if(d){j.top=i-f[k].top-b;i+=f[k].height;}else{j.left=a-f[k].left;a+=f[k].width;}b=b+f[k].margin;c[k]=j;},this);
|
|
||||||
var g={};Array.clone(e).sort().each(function(j){g[j]=c[j];});this.start(g);this.currentOrder=e;return this;},rearrangeDOM:function(a){a=a||this.currentOrder;
|
|
||||||
var b=this.elements[0].getParent();var c=[];this.elements.setStyle("opacity",0);a.each(function(d){c.push(this.elements[d].inject(b).setStyles({top:0,left:0}));
|
|
||||||
},this);this.elements.setStyle("opacity",1);this.elements=$$(c);this.setDefaultOrder();return this;},getDefaultOrder:function(){return this.elements.map(function(b,a){return a;
|
|
||||||
});},getCurrentOrder:function(){return this.currentOrder;},forward:function(){return this.sort(this.getDefaultOrder());},backward:function(){return this.sort(this.getDefaultOrder().reverse());
|
|
||||||
},reverse:function(){return this.sort(this.currentOrder.reverse());},sortByElements:function(a){return this.sort(a.map(function(b){return this.elements.indexOf(b);
|
|
||||||
},this));},swap:function(c,b){if(typeOf(c)=="element"){c=this.elements.indexOf(c);}if(typeOf(b)=="element"){b=this.elements.indexOf(b);}var a=Array.clone(this.currentOrder);
|
|
||||||
a[this.currentOrder.indexOf(c)]=b;a[this.currentOrder.indexOf(b)]=c;return this.sort(a);}});var Drag=new Class({Implements:[Events,Options],options:{snap:6,unit:"px",grid:false,style:true,limit:false,handle:false,invert:false,preventDefault:false,stopPropagation:false,modifiers:{x:"left",y:"top"}},initialize:function(){var b=Array.link(arguments,{options:Type.isObject,element:function(c){return c!=null;
|
|
||||||
}});this.element=document.id(b.element);this.document=this.element.getDocument();this.setOptions(b.options||{});var a=typeOf(this.options.handle);this.handles=((a=="array"||a=="collection")?$$(this.options.handle):document.id(this.options.handle))||this.element;
|
|
||||||
this.mouse={now:{},pos:{}};this.value={start:{},now:{}};this.selection=(Browser.ie)?"selectstart":"mousedown";if(Browser.ie&&!Drag.ondragstartFixed){document.ondragstart=Function.from(false);
|
|
||||||
Drag.ondragstartFixed=true;}this.bound={start:this.start.bind(this),check:this.check.bind(this),drag:this.drag.bind(this),stop:this.stop.bind(this),cancel:this.cancel.bind(this),eventStop:Function.from(false)};
|
|
||||||
this.attach();},attach:function(){this.handles.addEvent("mousedown",this.bound.start);return this;},detach:function(){this.handles.removeEvent("mousedown",this.bound.start);
|
|
||||||
return this;},start:function(a){var j=this.options;if(a.rightClick){return;}if(j.preventDefault){a.preventDefault();}if(j.stopPropagation){a.stopPropagation();
|
|
||||||
}this.mouse.start=a.page;this.fireEvent("beforeStart",this.element);var c=j.limit;this.limit={x:[],y:[]};var e,g;for(e in j.modifiers){if(!j.modifiers[e]){continue;
|
|
||||||
}var b=this.element.getStyle(j.modifiers[e]);if(b&&!b.match(/px$/)){if(!g){g=this.element.getCoordinates(this.element.getOffsetParent());}b=g[j.modifiers[e]];
|
|
||||||
}if(j.style){this.value.now[e]=(b||0).toInt();}else{this.value.now[e]=this.element[j.modifiers[e]];}if(j.invert){this.value.now[e]*=-1;}this.mouse.pos[e]=a.page[e]-this.value.now[e];
|
|
||||||
if(c&&c[e]){var d=2;while(d--){var f=c[e][d];if(f||f===0){this.limit[e][d]=(typeof f=="function")?f():f;}}}}if(typeOf(this.options.grid)=="number"){this.options.grid={x:this.options.grid,y:this.options.grid};
|
|
||||||
}var h={mousemove:this.bound.check,mouseup:this.bound.cancel};h[this.selection]=this.bound.eventStop;this.document.addEvents(h);},check:function(a){if(this.options.preventDefault){a.preventDefault();
|
|
||||||
}var b=Math.round(Math.sqrt(Math.pow(a.page.x-this.mouse.start.x,2)+Math.pow(a.page.y-this.mouse.start.y,2)));if(b>this.options.snap){this.cancel();this.document.addEvents({mousemove:this.bound.drag,mouseup:this.bound.stop});
|
|
||||||
this.fireEvent("start",[this.element,a]).fireEvent("snap",this.element);}},drag:function(b){var a=this.options;if(a.preventDefault){b.preventDefault();
|
|
||||||
}this.mouse.now=b.page;for(var c in a.modifiers){if(!a.modifiers[c]){continue;}this.value.now[c]=this.mouse.now[c]-this.mouse.pos[c];if(a.invert){this.value.now[c]*=-1;
|
|
||||||
}if(a.limit&&this.limit[c]){if((this.limit[c][1]||this.limit[c][1]===0)&&(this.value.now[c]>this.limit[c][1])){this.value.now[c]=this.limit[c][1];}else{if((this.limit[c][0]||this.limit[c][0]===0)&&(this.value.now[c]<this.limit[c][0])){this.value.now[c]=this.limit[c][0];
|
|
||||||
}}}if(a.grid[c]){this.value.now[c]-=((this.value.now[c]-(this.limit[c][0]||0))%a.grid[c]);}if(a.style){this.element.setStyle(a.modifiers[c],this.value.now[c]+a.unit);
|
|
||||||
}else{this.element[a.modifiers[c]]=this.value.now[c];}}this.fireEvent("drag",[this.element,b]);},cancel:function(a){this.document.removeEvents({mousemove:this.bound.check,mouseup:this.bound.cancel});
|
|
||||||
if(a){this.document.removeEvent(this.selection,this.bound.eventStop);this.fireEvent("cancel",this.element);}},stop:function(b){var a={mousemove:this.bound.drag,mouseup:this.bound.stop};
|
|
||||||
a[this.selection]=this.bound.eventStop;this.document.removeEvents(a);if(b){this.fireEvent("complete",[this.element,b]);}}});Element.implement({makeResizable:function(a){var b=new Drag(this,Object.merge({modifiers:{x:"width",y:"height"}},a));
|
|
||||||
this.store("resizer",b);return b.addEvent("drag",function(){this.fireEvent("resize",b);}.bind(this));}});Drag.Move=new Class({Extends:Drag,options:{droppables:[],container:false,precalculate:false,includeMargins:true,checkDroppables:true},initialize:function(b,a){this.parent(b,a);
|
|
||||||
b=this.element;this.droppables=$$(this.options.droppables);this.container=document.id(this.options.container);if(this.container&&typeOf(this.container)!="element"){this.container=document.id(this.container.getDocument().body);
|
|
||||||
}if(this.options.style){if(this.options.modifiers.x=="left"&&this.options.modifiers.y=="top"){var c=b.getOffsetParent(),d=b.getStyles("left","top");if(c&&(d.left=="auto"||d.top=="auto")){b.setPosition(b.getPosition(c));
|
|
||||||
}}if(b.getStyle("position")=="static"){b.setStyle("position","absolute");}}this.addEvent("start",this.checkDroppables,true);this.overed=null;},start:function(a){if(this.container){this.options.limit=this.calculateLimit();
|
|
||||||
}if(this.options.precalculate){this.positions=this.droppables.map(function(b){return b.getCoordinates();});}this.parent(a);},calculateLimit:function(){var j=this.element,e=this.container,d=document.id(j.getOffsetParent())||document.body,h=e.getCoordinates(d),c={},b={},k={},g={},m={};
|
|
||||||
["top","right","bottom","left"].each(function(q){c[q]=j.getStyle("margin-"+q).toInt();b[q]=j.getStyle("border-"+q).toInt();k[q]=e.getStyle("margin-"+q).toInt();
|
|
||||||
g[q]=e.getStyle("border-"+q).toInt();m[q]=d.getStyle("padding-"+q).toInt();},this);var f=j.offsetWidth+c.left+c.right,p=j.offsetHeight+c.top+c.bottom,i=0,l=0,o=h.right-g.right-f,a=h.bottom-g.bottom-p;
|
|
||||||
if(this.options.includeMargins){i+=c.left;l+=c.top;}else{o+=c.right;a+=c.bottom;}if(j.getStyle("position")=="relative"){var n=j.getCoordinates(d);n.left-=j.getStyle("left").toInt();
|
|
||||||
n.top-=j.getStyle("top").toInt();i-=n.left;l-=n.top;if(e.getStyle("position")!="relative"){i+=g.left;l+=g.top;}o+=c.left-n.left;a+=c.top-n.top;if(e!=d){i+=k.left+m.left;
|
|
||||||
l+=((Browser.ie6||Browser.ie7)?0:k.top)+m.top;}}else{i-=c.left;l-=c.top;if(e!=d){i+=h.left+g.left;l+=h.top+g.top;}}return{x:[i,o],y:[l,a]};},getDroppableCoordinates:function(c){var b=c.getCoordinates();
|
|
||||||
if(c.getStyle("position")=="fixed"){var a=window.getScroll();b.left+=a.x;b.right+=a.x;b.top+=a.y;b.bottom+=a.y;}return b;},checkDroppables:function(){var a=this.droppables.filter(function(d,c){d=this.positions?this.positions[c]:this.getDroppableCoordinates(d);
|
|
||||||
var b=this.mouse.now;return(b.x>d.left&&b.x<d.right&&b.y<d.bottom&&b.y>d.top);},this).getLast();if(this.overed!=a){if(this.overed){this.fireEvent("leave",[this.element,this.overed]);
|
|
||||||
}if(a){this.fireEvent("enter",[this.element,a]);}this.overed=a;}},drag:function(a){this.parent(a);if(this.options.checkDroppables&&this.droppables.length){this.checkDroppables();
|
|
||||||
}},stop:function(a){this.checkDroppables();this.fireEvent("drop",[this.element,this.overed,a]);this.overed=null;return this.parent(a);}});Element.implement({makeDraggable:function(a){var b=new Drag.Move(this,a);
|
|
||||||
this.store("dragger",b);return b;}});var Asset={javascript:function(d,b){if(!b){b={};}var a=new Element("script",{src:d,type:"text/javascript"}),e=b.document||document,c=b.onload||b.onLoad;
|
|
||||||
delete b.onload;delete b.onLoad;delete b.document;if(c){if(typeof a.onreadystatechange!="undefined"){a.addEvent("readystatechange",function(){if(["loaded","complete"].contains(this.readyState)){c.call(this);
|
|
||||||
}});}else{a.addEvent("load",c);}}return a.set(b).inject(e.head);},css:function(d,a){if(!a){a={};}var b=new Element("link",{rel:"stylesheet",media:"screen",type:"text/css",href:d});
|
|
||||||
var c=a.onload||a.onLoad,e=a.document||document;delete a.onload;delete a.onLoad;delete a.document;if(c){b.addEvent("load",c);}return b.set(a).inject(e.head);
|
|
||||||
},image:function(c,b){if(!b){b={};}var d=new Image(),a=document.id(d)||new Element("img");["load","abort","error"].each(function(e){var g="on"+e,f="on"+e.capitalize(),h=b[g]||b[f]||function(){};
|
|
||||||
delete b[f];delete b[g];d[g]=function(){if(!d){return;}if(!a.parentNode){a.width=d.width;a.height=d.height;}d=d.onload=d.onabort=d.onerror=null;h.delay(1,a,a);
|
|
||||||
a.fireEvent(e,a,1);};});d.src=a.src=c;if(d&&d.complete){d.onload.delay(1);}return a.set(b);},images:function(c,b){c=Array.from(c);var d=function(){},a=0;
|
|
||||||
b=Object.merge({onComplete:d,onProgress:d,onError:d,properties:{}},b);return new Elements(c.map(function(f,e){return Asset.image(f,Object.append(b.properties,{onload:function(){a++;
|
|
||||||
b.onProgress.call(this,a,e,f);if(a==c.length){b.onComplete();}},onerror:function(){a++;b.onError.call(this,a,e,f);if(a==c.length){b.onComplete();}}}));
|
|
||||||
}));}};(function(){var a=this.Color=new Type("Color",function(c,d){if(arguments.length>=3){d="rgb";c=Array.slice(arguments,0,3);}else{if(typeof c=="string"){if(c.match(/rgb/)){c=c.rgbToHex().hexToRgb(true);
|
|
||||||
}else{if(c.match(/hsb/)){c=c.hsbToRgb();}else{c=c.hexToRgb(true);}}}}d=d||"rgb";switch(d){case"hsb":var b=c;c=c.hsbToRgb();c.hsb=b;break;case"hex":c=c.hexToRgb(true);
|
|
||||||
break;}c.rgb=c.slice(0,3);c.hsb=c.hsb||c.rgbToHsb();c.hex=c.rgbToHex();return Object.append(c,this);});a.implement({mix:function(){var b=Array.slice(arguments);
|
|
||||||
var d=(typeOf(b.getLast())=="number")?b.pop():50;var c=this.slice();b.each(function(e){e=new a(e);for(var f=0;f<3;f++){c[f]=Math.round((c[f]/100*(100-d))+(e[f]/100*d));
|
|
||||||
}});return new a(c,"rgb");},invert:function(){return new a(this.map(function(b){return 255-b;}));},setHue:function(b){return new a([b,this.hsb[1],this.hsb[2]],"hsb");
|
|
||||||
},setSaturation:function(b){return new a([this.hsb[0],b,this.hsb[2]],"hsb");},setBrightness:function(b){return new a([this.hsb[0],this.hsb[1],b],"hsb");
|
|
||||||
}});this.$RGB=function(e,d,c){return new a([e,d,c],"rgb");};this.$HSB=function(e,d,c){return new a([e,d,c],"hsb");};this.$HEX=function(b){return new a(b,"hex");
|
|
||||||
};Array.implement({rgbToHsb:function(){var c=this[0],d=this[1],k=this[2],h=0;var j=Math.max(c,d,k),f=Math.min(c,d,k);var l=j-f;var i=j/255,g=(j!=0)?l/j:0;
|
|
||||||
if(g!=0){var e=(j-c)/l;var b=(j-d)/l;var m=(j-k)/l;if(c==j){h=m-b;}else{if(d==j){h=2+e-m;}else{h=4+b-e;}}h/=6;if(h<0){h++;}}return[Math.round(h*360),Math.round(g*100),Math.round(i*100)];
|
|
||||||
},hsbToRgb:function(){var d=Math.round(this[2]/100*255);if(this[1]==0){return[d,d,d];}else{var b=this[0]%360;var g=b%60;var h=Math.round((this[2]*(100-this[1]))/10000*255);
|
|
||||||
var e=Math.round((this[2]*(6000-this[1]*g))/600000*255);var c=Math.round((this[2]*(6000-this[1]*(60-g)))/600000*255);switch(Math.floor(b/60)){case 0:return[d,c,h];
|
|
||||||
case 1:return[e,d,h];case 2:return[h,d,c];case 3:return[h,e,d];case 4:return[c,h,d];case 5:return[d,h,e];}}return false;}});String.implement({rgbToHsb:function(){var b=this.match(/\d{1,3}/g);
|
|
||||||
return(b)?b.rgbToHsb():null;},hsbToRgb:function(){var b=this.match(/\d{1,3}/g);return(b)?b.hsbToRgb():null;}});})();(function(){Events.Pseudos=function(h,e,f){var d="_monitorEvents:";
|
|
||||||
var c=function(i){return{store:i.store?function(j,k){i.store(d+j,k);}:function(j,k){(i._monitorEvents||(i._monitorEvents={}))[j]=k;},retrieve:i.retrieve?function(j,k){return i.retrieve(d+j,k);
|
|
||||||
}:function(j,k){if(!i._monitorEvents){return k;}return i._monitorEvents[j]||k;}};};var g=function(k){if(k.indexOf(":")==-1||!h){return null;}var j=Slick.parse(k).expressions[0][0],p=j.pseudos,i=p.length,o=[];
|
|
||||||
while(i--){var n=p[i].key,m=h[n];if(m!=null){o.push({event:j.tag,value:p[i].value,pseudo:n,original:k,listener:m});}}return o.length?o:null;};return{addEvent:function(m,p,j){var n=g(m);
|
|
||||||
if(!n){return e.call(this,m,p,j);}var k=c(this),r=k.retrieve(m,[]),i=n[0].event,l=Array.slice(arguments,2),o=p,q=this;n.each(function(s){var t=s.listener,u=o;
|
|
||||||
if(t==false){i+=":"+s.pseudo+"("+s.value+")";}else{o=function(){t.call(q,s,u,arguments,o);};}});r.include({type:i,event:p,monitor:o});k.store(m,r);if(m!=i){e.apply(this,[m,p].concat(l));
|
|
||||||
}return e.apply(this,[i,o].concat(l));},removeEvent:function(m,l){var k=g(m);if(!k){return f.call(this,m,l);}var n=c(this),j=n.retrieve(m);if(!j){return this;
|
|
||||||
}var i=Array.slice(arguments,2);f.apply(this,[m,l].concat(i));j.each(function(o,p){if(!l||o.event==l){f.apply(this,[o.type,o.monitor].concat(i));}delete j[p];
|
|
||||||
},this);n.store(m,j);return this;}};};var b={once:function(e,f,d,c){f.apply(this,d);this.removeEvent(e.event,c).removeEvent(e.original,f);},throttle:function(d,e,c){if(!e._throttled){e.apply(this,c);
|
|
||||||
e._throttled=setTimeout(function(){e._throttled=false;},d.value||250);}},pause:function(d,e,c){clearTimeout(e._pause);e._pause=e.delay(d.value||250,this,c);
|
|
||||||
}};Events.definePseudo=function(c,d){b[c]=d;return this;};Events.lookupPseudo=function(c){return b[c];};var a=Events.prototype;Events.implement(Events.Pseudos(b,a.addEvent,a.removeEvent));
|
|
||||||
["Request","Fx"].each(function(c){if(this[c]){this[c].implement(Events.prototype);}});})();(function(){var d={relay:false},c=["once","throttle","pause"],b=c.length;
|
|
||||||
while(b--){d[c[b]]=Events.lookupPseudo(c[b]);}DOMEvent.definePseudo=function(e,f){d[e]=f;return this;};var a=Element.prototype;[Element,Window,Document].invoke("implement",Events.Pseudos(d,a.addEvent,a.removeEvent));
|
|
||||||
})();(function(){var a="$moo:keys-pressed",b="$moo:keys-keyup";DOMEvent.definePseudo("keys",function(d,e,c){var g=c[0],f=[],h=this.retrieve(a,[]);f.append(d.value.replace("++",function(){f.push("+");
|
|
||||||
return"";}).split("+"));h.include(g.key);if(f.every(function(j){return h.contains(j);})){e.apply(this,c);}this.store(a,h);if(!this.retrieve(b)){var i=function(j){(function(){h=this.retrieve(a,[]).erase(j.key);
|
|
||||||
this.store(a,h);}).delay(0,this);};this.store(b,i).addEvent("keyup",i);}});DOMEvent.defineKeys({"16":"shift","17":"control","18":"alt","20":"capslock","33":"pageup","34":"pagedown","35":"end","36":"home","144":"numlock","145":"scrolllock","186":";","187":"=","188":",","190":".","191":"/","192":"`","219":"[","220":"\\","221":"]","222":"'","107":"+"}).defineKey(Browser.firefox?109:189,"-");
|
|
||||||
})();(function(){var a=this.Keyboard=new Class({Extends:Events,Implements:[Options],options:{defaultEventType:"keydown",active:false,manager:null,events:{},nonParsedEvents:["activate","deactivate","onactivate","ondeactivate","changed","onchanged"]},initialize:function(f){if(f&&f.manager){this._manager=f.manager;
|
|
||||||
delete f.manager;}this.setOptions(f);this._setup();},addEvent:function(h,g,f){return this.parent(a.parse(h,this.options.defaultEventType,this.options.nonParsedEvents),g,f);
|
|
||||||
},removeEvent:function(g,f){return this.parent(a.parse(g,this.options.defaultEventType,this.options.nonParsedEvents),f);},toggleActive:function(){return this[this.isActive()?"deactivate":"activate"]();
|
|
||||||
},activate:function(f){if(f){if(f.isActive()){return this;}if(this._activeKB&&f!=this._activeKB){this.previous=this._activeKB;this.previous.fireEvent("deactivate");
|
|
||||||
}this._activeKB=f.fireEvent("activate");a.manager.fireEvent("changed");}else{if(this._manager){this._manager.activate(this);}}return this;},isActive:function(){return this._manager?(this._manager._activeKB==this):(a.manager==this);
|
|
||||||
},deactivate:function(f){if(f){if(f===this._activeKB){this._activeKB=null;f.fireEvent("deactivate");a.manager.fireEvent("changed");}}else{if(this._manager){this._manager.deactivate(this);
|
|
||||||
}}return this;},relinquish:function(){if(this.isActive()&&this._manager&&this._manager.previous){this._manager.activate(this._manager.previous);}else{this.deactivate();
|
|
||||||
}return this;},manage:function(f){if(f._manager){f._manager.drop(f);}this._instances.push(f);f._manager=this;if(!this._activeKB){this.activate(f);}return this;
|
|
||||||
},drop:function(f){f.relinquish();this._instances.erase(f);if(this._activeKB==f){if(this.previous&&this._instances.contains(this.previous)){this.activate(this.previous);
|
|
||||||
}else{this._activeKB=this._instances[0];}}return this;},trace:function(){a.trace(this);},each:function(f){a.each(this,f);},_instances:[],_disable:function(f){if(this._activeKB==f){this._activeKB=null;
|
|
||||||
}},_setup:function(){this.addEvents(this.options.events);if(a.manager&&!this._manager){a.manager.manage(this);}if(this.options.active){this.activate();
|
|
||||||
}else{this.relinquish();}},_handle:function(h,g){if(h.preventKeyboardPropagation){return;}var f=!!this._manager;if(f&&this._activeKB){this._activeKB._handle(h,g);
|
|
||||||
if(h.preventKeyboardPropagation){return;}}this.fireEvent(g,h);if(!f&&this._activeKB){this._activeKB._handle(h,g);}}});var b={};var c=["shift","control","alt","meta"];
|
|
||||||
var e=/^(?:shift|control|ctrl|alt|meta)$/;a.parse=function(h,g,k){if(k&&k.contains(h.toLowerCase())){return h;}h=h.toLowerCase().replace(/^(keyup|keydown):/,function(m,l){g=l;
|
|
||||||
return"";});if(!b[h]){var f,j={};h.split("+").each(function(l){if(e.test(l)){j[l]=true;}else{f=l;}});j.control=j.control||j.ctrl;var i=[];c.each(function(l){if(j[l]){i.push(l);
|
|
||||||
}});if(f){i.push(f);}b[h]=i.join("+");}return g+":keys("+b[h]+")";};a.each=function(f,g){var h=f||a.manager;while(h){g.run(h);h=h._activeKB;}};a.stop=function(f){f.preventKeyboardPropagation=true;
|
|
||||||
};a.manager=new a({active:true});a.trace=function(f){f=f||a.manager;var g=window.console&&console.log;if(g){console.log("the following items have focus: ");
|
|
||||||
}a.each(f,function(h){if(g){console.log(document.id(h.widget)||h.wiget||h);}});};var d=function(g){var f=[];c.each(function(h){if(g[h]){f.push(h);}});if(!e.test(g.key)){f.push(g.key);
|
|
||||||
}a.manager._handle(g,g.type+":keys("+f.join("+")+")");};document.addEvents({keyup:d,keydown:d});})();Keyboard.prototype.options.nonParsedEvents.combine(["rebound","onrebound"]);
|
|
||||||
Keyboard.implement({addShortcut:function(b,a){this._shortcuts=this._shortcuts||[];this._shortcutIndex=this._shortcutIndex||{};a.getKeyboard=Function.from(this);
|
|
||||||
a.name=b;this._shortcutIndex[b]=a;this._shortcuts.push(a);if(a.keys){this.addEvent(a.keys,a.handler);}return this;},addShortcuts:function(b){for(var a in b){this.addShortcut(a,b[a]);
|
|
||||||
}return this;},removeShortcut:function(b){var a=this.getShortcut(b);if(a&&a.keys){this.removeEvent(a.keys,a.handler);delete this._shortcutIndex[b];this._shortcuts.erase(a);
|
|
||||||
}return this;},removeShortcuts:function(a){a.each(this.removeShortcut,this);return this;},getShortcuts:function(){return this._shortcuts||[];},getShortcut:function(a){return(this._shortcutIndex||{})[a];
|
|
||||||
}});Keyboard.rebind=function(b,a){Array.from(a).each(function(c){c.getKeyboard().removeEvent(c.keys,c.handler);c.getKeyboard().addEvent(b,c.handler);c.keys=b;
|
|
||||||
c.getKeyboard().fireEvent("rebound");});};Keyboard.getActiveShortcuts=function(b){var a=[],c=[];Keyboard.each(b,[].push.bind(a));a.each(function(d){c.extend(d.getShortcuts());
|
|
||||||
});return c;};Keyboard.getShortcut=function(c,b,d){d=d||{};var a=d.many?[]:null,e=d.many?function(g){var f=g.getShortcut(c);if(f){a.push(f);}}:function(f){if(!a){a=f.getShortcut(c);
|
|
||||||
}};Keyboard.each(b,e);return a;};Keyboard.getShortcuts=function(b,a){return Keyboard.getShortcut(b,a,{many:true});};(function(){var b=null,a={},d={};var c=function(f){if(instanceOf(f,e.Set)){return f;
|
|
||||||
}else{return a[f];}};var e=this.Locale={define:function(f,j,h,i){var g;if(instanceOf(f,e.Set)){g=f.name;if(g){a[g]=f;}}else{g=f;if(!a[g]){a[g]=new e.Set(g);
|
|
||||||
}f=a[g];}if(j){f.define(j,h,i);}if(!b){b=f;}return f;},use:function(f){f=c(f);if(f){b=f;this.fireEvent("change",f);}return this;},getCurrent:function(){return b;
|
|
||||||
},get:function(g,f){return(b)?b.get(g,f):"";},inherit:function(f,g,h){f=c(f);if(f){f.inherit(g,h);}return this;},list:function(){return Object.keys(a);
|
|
||||||
}};Object.append(e,new Events);e.Set=new Class({sets:{},inherits:{locales:[],sets:{}},initialize:function(f){this.name=f||"";},define:function(i,g,h){var f=this.sets[i];
|
|
||||||
if(!f){f={};}if(g){if(typeOf(g)=="object"){f=Object.merge(f,g);}else{f[g]=h;}}this.sets[i]=f;return this;},get:function(r,j,q){var p=Object.getFromPath(this.sets,r);
|
|
||||||
if(p!=null){var m=typeOf(p);if(m=="function"){p=p.apply(null,Array.from(j));}else{if(m=="object"){p=Object.clone(p);}}return p;}var h=r.indexOf("."),o=h<0?r:r.substr(0,h),k=(this.inherits.sets[o]||[]).combine(this.inherits.locales).include("en-US");
|
|
||||||
if(!q){q=[];}for(var g=0,f=k.length;g<f;g++){if(q.contains(k[g])){continue;}q.include(k[g]);var n=a[k[g]];if(!n){continue;}p=n.get(r,j,q);if(p!=null){return p;
|
|
||||||
}}return"";},inherit:function(g,h){g=Array.from(g);if(h&&!this.inherits.sets[h]){this.inherits.sets[h]=[];}var f=g.length;while(f--){(h?this.inherits.sets[h]:this.inherits.locales).unshift(g[f]);
|
|
||||||
}return this;}});})();
|
|
6
mindplot/src/main/javascript/libraries/underscorejs/underscore-min.js
vendored
Normal file
@ -36,7 +36,7 @@ mindplot.model.FeatureModel = new Class({
|
|||||||
this._attributes = {};
|
this._attributes = {};
|
||||||
|
|
||||||
// Create type method ...
|
// Create type method ...
|
||||||
this['is' + type.camelCase() + 'Model'] = function () {
|
this['is' + $.camelCase(type) + 'Model'] = function () {
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -73,4 +73,4 @@ mindplot.model.FeatureModel = new Class({
|
|||||||
getType:function () {
|
getType:function () {
|
||||||
return this._type;
|
return this._type;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -69,7 +69,7 @@ mindplot.model.IMindmap = new Class({
|
|||||||
$assert(!child.getParent(), 'Child model seems to be already connected');
|
$assert(!child.getParent(), 'Child model seems to be already connected');
|
||||||
|
|
||||||
// Connect node...
|
// Connect node...
|
||||||
parent.appendChild(child);
|
parent.append(child);
|
||||||
|
|
||||||
// Remove from the branch ...
|
// Remove from the branch ...
|
||||||
this.removeBranch(child);
|
this.removeBranch(child);
|
||||||
@ -135,7 +135,7 @@ mindplot.model.IMindmap = new Class({
|
|||||||
|
|
||||||
// Then the rest of the branches ...
|
// Then the rest of the branches ...
|
||||||
var sbranchs = source.getBranches();
|
var sbranchs = source.getBranches();
|
||||||
sbranchs.each(function(snode) {
|
_.each(sbranchs, function(snode) {
|
||||||
var tnode = target.createNode(snode.getType(), snode.getId());
|
var tnode = target.createNode(snode.getType(), snode.getId());
|
||||||
snode.copyTo(tnode);
|
snode.copyTo(tnode);
|
||||||
target.addBranch(tnode);
|
target.addBranch(tnode);
|
||||||
|
@ -199,7 +199,7 @@ mindplot.model.INodeModel = new Class({
|
|||||||
return this.getParent() != null;
|
return this.getParent() != null;
|
||||||
},
|
},
|
||||||
|
|
||||||
appendChild : function(node) {
|
append : function(node) {
|
||||||
throw "Unsupported operation";
|
throw "Unsupported operation";
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -213,7 +213,7 @@ mindplot.model.INodeModel = new Class({
|
|||||||
var source = this;
|
var source = this;
|
||||||
// Copy properties ...
|
// Copy properties ...
|
||||||
var keys = source.getPropertiesKeys();
|
var keys = source.getPropertiesKeys();
|
||||||
keys.each(function(key) {
|
_.each(keys, function(key) {
|
||||||
var value = source.getProperty(key);
|
var value = source.getProperty(key);
|
||||||
target.putProperty(key, value);
|
target.putProperty(key, value);
|
||||||
});
|
});
|
||||||
@ -222,10 +222,10 @@ mindplot.model.INodeModel = new Class({
|
|||||||
var children = this.getChildren();
|
var children = this.getChildren();
|
||||||
var tmindmap = target.getMindmap();
|
var tmindmap = target.getMindmap();
|
||||||
|
|
||||||
children.each(function(snode) {
|
_.each(function(children, snode) {
|
||||||
var tnode = tmindmap.createNode(snode.getType(), snode.getId());
|
var tnode = tmindmap.createNode(snode.getType(), snode.getId());
|
||||||
snode.copyTo(tnode);
|
snode.copyTo(tnode);
|
||||||
target.appendChild(tnode);
|
target.append(tnode);
|
||||||
});
|
});
|
||||||
|
|
||||||
return target;
|
return target;
|
||||||
@ -278,15 +278,15 @@ mindplot.model.INodeModel = new Class({
|
|||||||
var children = this.getChildren();
|
var children = this.getChildren();
|
||||||
if (children.length > 0) {
|
if (children.length > 0) {
|
||||||
result = result + ", children: {(size:" + children.length;
|
result = result + ", children: {(size:" + children.length;
|
||||||
children.each(function(node) {
|
_.each(children, function(node) {
|
||||||
result = result + "=> (";
|
result = result + "=> (";
|
||||||
var keys = node.getPropertiesKeys();
|
var keys = node.getPropertiesKeys();
|
||||||
keys.each(function(key) {
|
_.each(keys, function(key) {
|
||||||
var value = node.getProperty(key);
|
var value = node.getProperty(key);
|
||||||
result = result + key + ":" + value + ",";
|
result = result + key + ":" + value + ",";
|
||||||
});
|
});
|
||||||
result = result + "}"
|
result = result + "}"
|
||||||
}.bind(this));
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
result = result + ' }';
|
result = result + ' }';
|
||||||
|