|
From: <ma...@us...> - 2011-01-09 20:15:05
|
Revision: 243
http://openautomation.svn.sourceforge.net/openautomation/?rev=243&view=rev
Author: mayerch
Date: 2011-01-09 20:14:55 +0000 (Sun, 09 Jan 2011)
Log Message:
-----------
Initial commit of the graphical logic editor
Added Paths:
-----------
PyWireGate/trunk/logic_editor/
PyWireGate/trunk/logic_editor/backendCommunication.js
PyWireGate/trunk/logic_editor/gle/
PyWireGate/trunk/logic_editor/gle/gle.block.js
PyWireGate/trunk/logic_editor/gle/gle.connection.js
PyWireGate/trunk/logic_editor/icon/
PyWireGate/trunk/logic_editor/icon/LICENCE.txt
PyWireGate/trunk/logic_editor/icon/align-horizontal-center.png
PyWireGate/trunk/logic_editor/icon/align-horizontal-left.png
PyWireGate/trunk/logic_editor/icon/align-horizontal-right.png
PyWireGate/trunk/logic_editor/icon/align-vertical-bottom.png
PyWireGate/trunk/logic_editor/icon/align-vertical-center.png
PyWireGate/trunk/logic_editor/icon/align-vertical-top.png
PyWireGate/trunk/logic_editor/icon/application-exit.png
PyWireGate/trunk/logic_editor/icon/checkbox.png
PyWireGate/trunk/logic_editor/icon/chronometer.png
PyWireGate/trunk/logic_editor/icon/code-block.png
PyWireGate/trunk/logic_editor/icon/code-class.png
PyWireGate/trunk/logic_editor/icon/code-context.png
PyWireGate/trunk/logic_editor/icon/code-function.png
PyWireGate/trunk/logic_editor/icon/code-typedef.png
PyWireGate/trunk/logic_editor/icon/code-variable.png
PyWireGate/trunk/logic_editor/icon/configure.png
PyWireGate/trunk/logic_editor/icon/dialog-cancel.png
PyWireGate/trunk/logic_editor/icon/dialog-close.png
PyWireGate/trunk/logic_editor/icon/dialog-ok-apply.png
PyWireGate/trunk/logic_editor/icon/dialog-ok.png
PyWireGate/trunk/logic_editor/icon/distribute-horizontal-center.png
PyWireGate/trunk/logic_editor/icon/distribute-vertical-center.png
PyWireGate/trunk/logic_editor/icon/document-close.png
PyWireGate/trunk/logic_editor/icon/document-new.png
PyWireGate/trunk/logic_editor/icon/document-save.png
PyWireGate/trunk/logic_editor/icon/edit-bomb.png
PyWireGate/trunk/logic_editor/icon/edit-cut.png
PyWireGate/trunk/logic_editor/icon/edit-delete.png
PyWireGate/trunk/logic_editor/icon/edit-find.png
PyWireGate/trunk/logic_editor/icon/edit-select.png
PyWireGate/trunk/logic_editor/icon/edit-undo.png
PyWireGate/trunk/logic_editor/icon/format-add-node.png
PyWireGate/trunk/logic_editor/icon/format-break-node.png
PyWireGate/trunk/logic_editor/icon/format-join-node.png
PyWireGate/trunk/logic_editor/icon/format-remove-node.png
PyWireGate/trunk/logic_editor/icon/help-about.png
PyWireGate/trunk/logic_editor/icon/help-hint.png
PyWireGate/trunk/logic_editor/icon/object-flip-horizontal.png
PyWireGate/trunk/logic_editor/icon/object-flip-vertical.png
PyWireGate/trunk/logic_editor/icon/object-rotate-left.png
PyWireGate/trunk/logic_editor/icon/object-rotate-right.png
PyWireGate/trunk/logic_editor/icon/process-stop.png
PyWireGate/trunk/logic_editor/icon/view-refresh.png
PyWireGate/trunk/logic_editor/icon/view-statistics.png
PyWireGate/trunk/logic_editor/icon/window-close.png
PyWireGate/trunk/logic_editor/icon/zoom-in.png
PyWireGate/trunk/logic_editor/icon/zoom-original.png
PyWireGate/trunk/logic_editor/icon/zoom-out.png
PyWireGate/trunk/logic_editor/index.html
PyWireGate/trunk/logic_editor/lib/
PyWireGate/trunk/logic_editor/lib/jquery-1.4.4.js
PyWireGate/trunk/logic_editor/lib/jquery-ui-1.8.7.custom.min.js
PyWireGate/trunk/logic_editor/lib/jquery.jstree.js
PyWireGate/trunk/logic_editor/lib/jquery.layout.js
PyWireGate/trunk/logic_editor/lib/jquery.svg.js
PyWireGate/trunk/logic_editor/lib/themes/
PyWireGate/trunk/logic_editor/lib/themes/classic/
PyWireGate/trunk/logic_editor/lib/themes/classic/d.png
PyWireGate/trunk/logic_editor/lib/themes/classic/dot_for_ie.gif
PyWireGate/trunk/logic_editor/lib/themes/classic/style.css
PyWireGate/trunk/logic_editor/lib/themes/classic/throbber.gif
PyWireGate/trunk/logic_editor/logicEditor.css
PyWireGate/trunk/logic_editor/logicEditor.js
Added: PyWireGate/trunk/logic_editor/backendCommunication.js
===================================================================
--- PyWireGate/trunk/logic_editor/backendCommunication.js (rev 0)
+++ PyWireGate/trunk/logic_editor/backendCommunication.js 2011-01-09 20:14:55 UTC (rev 243)
@@ -0,0 +1,99 @@
+ // Sollte das Backend dynamisch aus den verfuegbaren Bloecken generieren:
+ var libJSON = {
+ 'sourceLib': {
+ 'source1': {
+ 'width': 100,
+ 'height': 50,
+ 'rotation': 0,
+ 'flip': false,
+ 'color': [0.0, 0.0, 0.0],
+ 'background': [1.0, 1.0, 1.0],
+ 'inPorts': [],
+ 'outPorts': [
+ {
+ 'name': 'out1',
+ 'type': 'event'
+ }
+ ],
+ 'parameters':{}
+ },
+ 'source2': {
+ 'width': 100,
+ 'height': 100,
+ 'rotation': 0,
+ 'flip': false,
+ 'color': [0.0, 0.0, 1.0],
+ 'background': [1.0, 1.0, 0.5],
+ 'inPorts': [],
+ 'outPorts': [
+ {
+ 'name': 'out1',
+ 'type': 'event'
+ },
+ {
+ 'name': 'out2',
+ 'type': 'event'
+ }
+ ],
+ 'parameters':{}
+ }
+ },
+ 'sinkLib': {
+ 'sink1': {
+ 'width': 100,
+ 'height': 100,
+ 'rotation': 0,
+ 'flip': false,
+ 'color': [0.0, 0.0, 0.0],
+ 'background': [1.0, 1.0, 1.0],
+ 'inPorts': [
+ {
+ 'name': 'in',
+ 'type': 'event'
+ }
+ ],
+ 'outPorts': [],
+ 'parameters':{}
+ }
+ },
+ 'mathLib': {
+ 'gain': {
+ 'width': 100,
+ 'height': 100,
+ 'rotation': 0,
+ 'flip': false,
+ 'color': [0.0, 0.0, 0.0],
+ 'background': [1.0, 1.0, 1.0],
+ 'mask': [
+ { 'type': 'move', 'x': 0.999, 'y': 0.5 }, // just to show what's possible
+ { 'type': 'line', 'x': 0 , 'y': 0.999 },
+ { 'type': 'line', 'x': 0 , 'y': 0 }
+ // auto close
+ ],
+ 'maskOptions': {
+ 'showLabel': false
+ },
+ 'inPorts': [
+ {
+ 'name': 'in',
+ 'type': 'event'
+ }
+ ],
+ 'outPorts': [
+ {
+ 'name': 'out',
+ 'type': 'event'
+ }
+ ],
+ 'parameters': [
+ {
+ 'name': 'gain',
+ 'type': 'float'
+ }
+ ]
+ }
+ }
+};
+
+// Die Struktur mit der feritgen Logik
+var logicJSON = {};
Added: PyWireGate/trunk/logic_editor/gle/gle.block.js
===================================================================
--- PyWireGate/trunk/logic_editor/gle/gle.block.js (rev 0)
+++ PyWireGate/trunk/logic_editor/gle/gle.block.js 2011-01-09 20:14:55 UTC (rev 243)
@@ -0,0 +1,366 @@
+/* gle.block.js (c) 2011 by Christian Mayer [CometVisu at ChristianMayer dot de]
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 3 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+/**
+ * The element that stores all informations and methods about one block
+ */
+
+/**
+ * The block constructor.
+ * type: the block (proto)type in JSON notation
+ * svg: the link to the SVG canvas
+ * interactive: event handlers will be added, set to false to create picture only
+ */
+function Block( type, svg, interactive )
+{
+ // setup the private "constants"
+ var that = this;
+ var inset = 3; // how far should the handle stick in
+ var outset = 3; // how far should the handle stick out
+
+ // setup the private variables
+ var x = type.x || 0;
+ var y = type.y || 0;
+ var width = type.width || 100;
+ var height = type.height || 100;
+ var rotation = type.rotation || 0;
+ var flip = type.flip || false;
+ var mask = type.mask || undefined;
+ var maskOptions = type.maskOptions || { showLabel: true };
+ var color = type.color || [0.0, 0.0, 0.0];
+ var background = type.background || [1.0, 1.0, 1.0];
+ var inPorts = type.inPorts || [];
+ var outPorts = type.outPorts || [];
+ var parameters = type.parameters || {};
+
+ var canvas = svg || $('#editor').svg('get');
+ var addEvent = interactive !== undefined ? interactive : true;
+ var g = undefined; // link to the representation of the block in the DOM
+
+ // the private functions
+
+ // (re)draw itself on the canvas
+ function draw()
+ {
+ var classList = 'block';
+ if( g )
+ {
+ classList = g.getAttribute('class');
+ g.parentNode.removeChild( g ); // delete the old representation
+ }
+ g = canvas.group( {'transform':'translate(' + x + ',' + y + ')', 'class':classList} );
+
+ // helper function to scale relative positioning
+ function scaleRelPos( value, absValue )
+ {
+ if( value >= 1.0 ) return value; // it is already absolutely scaled
+ if( value < 0 ) return absValue + value; // absolutely from right
+ return absValue * value; // relative scaled
+ }
+
+ var style = {
+ fill: colorByArray( background ),
+ stroke: colorByArray( color ),
+ 'stroke-width': 1
+ };
+
+ // Draw the body
+ var body = canvas.group( g, {'transform':'translate(6,1)'} );
+ if( mask )
+ {
+ var path = canvas.createPath();
+ for( var i in mask )
+ {
+ var obj = mask[i];
+ var sx = scaleRelPos( obj.x, width );
+ var sy = scaleRelPos( obj.y, height );
+ switch( obj.type )
+ {
+ case 'move':
+ path.move( sx, sy );
+ break;
+
+ case 'line':
+ path.line( sx, sy );
+ break;
+ }
+ }
+ canvas.path( body, path.close(), style );
+ } else {
+ canvas.rect( body, 0, 0, width, height, style );
+ }
+
+ // Draw the inports
+ var inPortsLength = inPorts.length;
+ $.each( inPorts, function(i){
+ var y = 1 + height * (0.5 + i)/inPortsLength;
+ if( 'connection' in this )
+ canvas.line( g, 0, y, 6, y, style );
+ else
+ editorConnectionPointCreate( canvas.polyline( g, [[1, y-4],[6, y],[1, y+4]] ), 'inPort', i );
+ if( maskOptions.showLabel )
+ canvas.text( g, 10, y, this.name, {'dominant-baseline':'middle','text-anchor':'start'} );
+ });
+
+ // Draw the outports
+ var outPortsLength = outPorts.length;
+ $.each( outPorts, function(i){
+ var y = 1 + height * (0.5 + i)/outPortsLength;
+ if( 'connection' in this )
+ canvas.line( g, width+6, y, width+12, y, style );
+ else
+ editorConnectionPointCreate( canvas.polyline( g, [[width+6, y-4],[width+11, y],[width+6, y+4]] ), 'outPort', i );
+ if( maskOptions.showLabel )
+ canvas.text( g, width, y, this.name, {'dominant-baseline':'middle','text-anchor':'end'} );
+ });
+
+ // shotcut
+ function editorDrag( obj, handle )
+ {
+ if( addEvent )
+ {
+ $(handle).bind( 'mousedown', {obj:obj}, editorDragMouseDown );
+ }
+ }
+
+ editorDrag( g, g ); // move
+ // Draw the handles
+ editorDrag( g, canvas.rect( g, 5-outset , -outset , 1+inset+outset, 1+inset+outset, {class:'nw-resize'} ) );
+ editorDrag( g, canvas.rect( g, 6+width-inset, -outset , 1+inset+outset, 1+inset+outset, {class:'ne-resize'} ) );
+ editorDrag( g, canvas.rect( g, 5-outset , height+1-inset, 1+inset+outset, 1+inset+outset, {class:'sw-resize'} ) );
+ editorDrag( g, canvas.rect( g, 6+width-inset, height+1-inset, 1+inset+outset, 1+inset+outset, {class:'se-resize'} ) );
+
+ }
+
+ // relocate itself on the canvas
+ function relocate()
+ {
+ if( !g ) return draw(); // nothing to relocate...
+ g.setAttribute( 'transform', 'translate(' + x + ',' + y + ')' );
+ }
+
+ function editorDragMouseDown( event )
+ {
+ console.log( 'eDMD', event );
+ var classList = this.getAttribute('class').split(' ');
+ console.log( 'eDMD', classList );
+ var type = 'move';
+ for( var i = 0; i < classList.length; i++ )
+ if( classList[i] != '' && classList[i] != 'selected' && classList[i] != 'block' ) type = classList[i];
+ if( $.inArray('selected', classList) == -1 && type=='move' ) editorSelect( this );
+
+ var parameter = {
+ type : type,
+ origx : x,
+ origy : y,
+ origw : width,
+ origh : height,
+ startx : event.pageX,
+ starty : event.pageY
+ };
+
+ $(document).bind( 'mousemove', parameter, editorDragMouseMove );
+ $(document).bind( 'mouseup' , editorDragMouseUp );
+ return false;
+ }
+
+ function editorDragMouseMove( event )
+ {
+ var ed = event.data;
+ switch( event.data.type )
+ {
+ case 'move':
+ x = ed.origx - ed.startx + event.pageX;
+ y = ed.origy - ed.starty + event.pageY;
+ break;
+ case 'nw-resize':
+ x = ed.origx - ed.startx + event.pageX;
+ width = ed.origw + ed.startx - event.pageX;
+ y = ed.origy - ed.starty + event.pageY;
+ height = ed.origh + ed.starty - event.pageY;
+ break;
+ case 'ne-resize':
+ width = ed.origw - ed.startx + event.pageX;
+ y = ed.origy - ed.starty + event.pageY;
+ height = ed.origh + ed.starty - event.pageY;
+ break;
+ case 'se-resize':
+ height = ed.origh - ed.starty + event.pageY;
+ width = ed.origw - ed.startx + event.pageX;
+ break;
+ case 'sw-resize':
+ height = ed.origh - ed.starty + event.pageY;
+ x = ed.origx - ed.startx + event.pageX;
+ width = ed.origw + ed.startx - event.pageX;
+ break;
+ }
+ if( 'move' == event.data.type )
+ {
+ relocate(); // shortcut
+ } else {
+ if( width < 10 ) width = 10; // sanity...
+ if( height < 10 ) height = 10; // sanity...
+ draw();
+ }
+
+ $.each( inPorts, function(i){
+ if( 'connection' in this )
+ {
+ this.connection.lastMove( that.inPortPos( i ), true );
+ }
+ });
+
+ $.each( outPorts, function(i){
+ if( 'connection' in this )
+ {
+ this.connection.firstMove( that.outPortPos( i ) );
+ }
+ });
+ }
+
+ function editorDragMouseUp( event )
+ {
+ $(document).unbind( 'mousemove', editorDragMouseMove );
+ $(document).unbind( 'mouseup' , editorDragMouseUp );
+ }
+
+ // the public (privileged) methods:
+ this.getWidth = function() { return width ; }
+ this.setWidth = function( _width ) { width = _width ; draw(); }
+ this.getHeight = function() { return height; }
+ this.setHeight = function( _height ) { height = _height; draw(); }
+ this.getX = function() { return x ; }
+ this.setX = function( _x ) { x = _x ; draw(); }
+ this.getY = function() { return y ; }
+ this.setY = function( _y ) { y = _y ; draw(); }
+ this.getColor = function() { return color ; }
+ this.setColor = function( _color ) { color = _color ; draw(); }
+ this.setConnection = function( portType, portNumber, connection )
+ {
+ if( 'inPort' == portType )
+ inPorts [ portNumber ].connection = connection;
+ else
+ outPorts[ portNumber ].connection = connection;
+ draw();
+ }
+ this.inPortPos = function( number )
+ {
+ return [ x , y + 1 + height * (0.5 + number) / inPorts.length ];
+ }
+ this.outPortPos = function( number )
+ {
+ return [ x + width + 10, y + 1 + height * (0.5 + number) / outPorts.length ];
+ }
+
+ // Dump this Block in JSON notation to serialize it
+ this.getJSON = function()
+ {
+ return {
+ x : x ,
+ y : y ,
+ width : width ,
+ height : height ,
+ rotation : rotation ,
+ flip : flip ,
+ mask : mask ,
+ maskOptions : maskOptions ,
+ color : color ,
+ background : background ,
+ inPorts : inPorts ,
+ outPorts : outPorts ,
+ parameters : parameters
+ };
+ }
+
+ // finally draw itself:
+ draw();
+
+ ////////////////
+ function editorConnectionPointCreate( obj, portType, portNumber )
+ {
+ $(obj).bind( 'mousedown', {
+ portType :portType,
+ portNumber:portNumber
+ }, editorConnectionPointDrag );
+ $(obj).bind( 'mouseover', {
+ portType :portType,
+ portNumber:portNumber
+ }, editorConnectionPointOverPort );
+ $(obj).bind( 'mouseout', {
+ }, editorConnectionPointOverPortOut );
+ }
+
+ function editorConnectionPointDrag( event )
+ {
+ console.log( 'Block: eCPD', event );
+ var pn = event.data.portNumber;
+ var pt = event.data.portType;
+ var c = new Connection({
+ origin : that,
+ originPortNumber: pn,
+ paths : [{path:[that.outPortPos( pn )]}]
+ });
+ that.setConnection( pt, pn,c );
+ ///???
+ var parameter = {con:c};
+
+ $(document).bind( 'mousemove', parameter, editorConnectionPointMouseMove );
+ $(document).bind( 'mouseup' , parameter, editorConnectionPointMouseUp );
+
+ return false;
+ }
+
+ function editorConnectionPointMouseMove( event )
+ {
+ //console.log( event.data.con );
+ var x = event.pageX - $('#editor')[0].offsetLeft;
+ var y = event.pageY - $('#editor')[0].offsetTop;
+ event.data.con.lastMove( [x, y] );
+ }
+
+ function editorConnectionPointMouseUp( event )
+ {
+ console.log( 'eCPMU' );
+ $(document).unbind( 'mousemove', editorConnectionPointMouseMove );
+ $(document).unbind( 'mouseup' , editorConnectionPointMouseUp );
+ var target = event.data.con.lastTarget();
+ if( target )
+ {
+ target.block.setConnection( target.type, target.number, event.data.con );
+ }
+ }
+
+ function editorConnectionPointOverPort( event )
+ {
+ console.log( 'eCPOP', event.data.portType );
+ overPort = {
+ block : that,
+ type : event.data.portType,
+ number: event.data.portNumber
+ };
+ }
+
+ function editorConnectionPointOverPortOut( event )
+ {
+ console.log( 'eCPOPO' );
+ overPort = false;
+ }
+}
+Block.prototype = {
+ globalTestFunc: function(){ alert('test'+ this.getWidth()); }
+};
+
Added: PyWireGate/trunk/logic_editor/gle/gle.connection.js
===================================================================
--- PyWireGate/trunk/logic_editor/gle/gle.connection.js (rev 0)
+++ PyWireGate/trunk/logic_editor/gle/gle.connection.js 2011-01-09 20:14:55 UTC (rev 243)
@@ -0,0 +1,126 @@
+/* gle.connection.js (c) 2011 by Christian Mayer [CometVisu at ChristianMayer dot de]
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 3 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+/**
+ * The element that stores all informations and methods about one connection
+ */
+
+/**
+ * The connection constructor.
+ * type: the block (proto)type in JSON notation
+ * svg: the link to the SVG canvas
+ * interactive: event handlers will be added, set to false to create picture only
+ */
+function Connection( JSON, svg, interactive )
+{
+ // setup the private "constants"
+ var that = this;
+ var inset = 3; // how far should the handle stick in
+ var outset = 3; // how far should the handle stick out
+
+ // setup the private variables
+ var origin = JSON.origin || undefined;
+ var paths = JSON.paths || [];
+ var branch = 0; // the current branch to edit
+ var lastFixed = 0; // the last fixed position
+
+ var canvas = svg || $('#editor').svg('get');
+ var addEvent = interactive !== undefined ? interactive : true;
+ var g = undefined; // link to the representation of the block in the DOM
+
+ // the private functions
+
+ // (re)draw itself on the canvas
+ function draw()
+ {
+ var classList = 'connection';
+ if( g )
+ {
+ classList = g.getAttribute('class');
+ g.parentNode.removeChild( g ); // delete the old representation
+ }
+ g = canvas.group( { 'class':classList } );
+
+ var parameter = {
+ class: classList,
+ stroke: colorByArray( origin.getColor() ),
+ 'stroke-width': 1,
+ 'marker-end' : 'url(#ArrowEnd)',
+ fill: 'none'
+ };
+ for( var i in paths )
+ {
+ if( paths[i].target == undefined || origin == undefined )
+ parameter['stroke-dasharray'] = '1,3';
+ else
+ parameter['stroke-dasharray'] = 'none';
+ var x = canvas.polyline( g, paths[i].path, parameter );
+ }
+ }
+
+ this.firstMove = function( pos )
+ {
+ if( paths[0].path[0][1] == paths[0].path[1][1] ) // keep horizontal line
+ {
+ paths[0].path[0] = pos;
+ paths[0].path[1][1] = pos[1];
+ } else {
+ paths[0].path[0] = pos;
+ }
+ draw();
+ }
+
+ this.lastMove = function( pos, force )
+ {
+ while( paths[branch].path.length > lastFixed+1 )
+ paths[branch].path.pop();
+ var start = paths[branch].path[ paths[branch].path.length - 1 ];
+ var op = overPort;
+ if( !force && op && op.type == 'inPort' )
+ {
+ pos = op.block.inPortPos( op.number );
+ }
+ if( force || (op && op.type == 'inPort') )
+ {
+ paths[branch].target = op;
+ if( Math.abs( start[1] - pos[1] ) > 1.0 )
+ paths[branch].path.push( [ (pos[0]+start[0])/2, start[1] ] );
+ paths[branch].path.push( [ (pos[0]+start[0])/2, pos[1] ] );
+ } else {
+ paths[branch].target = undefined;
+ if( Math.abs( start[1] - pos[1] ) > 1.0 )
+ paths[branch].path.push( [ pos[0], start[1] ] );
+ }
+ paths[branch].path.push( pos );
+ draw();
+ }
+
+ this.lastTarget = function()
+ {
+ return paths[branch].target;
+ }
+
+ // Dump this Block in JSON notation to serialize it
+ this.getJSON = function()
+ {
+ return {
+ origin : origin,
+ paths : paths
+ };
+ }
+}
+
Added: PyWireGate/trunk/logic_editor/icon/LICENCE.txt
===================================================================
--- PyWireGate/trunk/logic_editor/icon/LICENCE.txt (rev 0)
+++ PyWireGate/trunk/logic_editor/icon/LICENCE.txt 2011-01-09 20:14:55 UTC (rev 243)
@@ -0,0 +1 @@
+Oxygen icon theme is dual licensed. You may copy it under the Creative Common Attribution-ShareAlike 3.0 License or the GNU Library General Public License.
\ No newline at end of file
Added: PyWireGate/trunk/logic_editor/icon/align-horizontal-center.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/icon/align-horizontal-center.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/icon/align-horizontal-left.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/icon/align-horizontal-left.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/icon/align-horizontal-right.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/icon/align-horizontal-right.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/icon/align-vertical-bottom.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/icon/align-vertical-bottom.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/icon/align-vertical-center.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/icon/align-vertical-center.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/icon/align-vertical-top.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/icon/align-vertical-top.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/icon/application-exit.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/icon/application-exit.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/icon/checkbox.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/icon/checkbox.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/icon/chronometer.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/icon/chronometer.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/icon/code-block.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/icon/code-block.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/icon/code-class.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/icon/code-class.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/icon/code-context.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/icon/code-context.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/icon/code-function.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/icon/code-function.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/icon/code-typedef.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/icon/code-typedef.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/icon/code-variable.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/icon/code-variable.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/icon/configure.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/icon/configure.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/icon/dialog-cancel.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/icon/dialog-cancel.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/icon/dialog-close.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/icon/dialog-close.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/icon/dialog-ok-apply.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/icon/dialog-ok-apply.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/icon/dialog-ok.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/icon/dialog-ok.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/icon/distribute-horizontal-center.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/icon/distribute-horizontal-center.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/icon/distribute-vertical-center.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/icon/distribute-vertical-center.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/icon/document-close.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/icon/document-close.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/icon/document-new.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/icon/document-new.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/icon/document-save.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/icon/document-save.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/icon/edit-bomb.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/icon/edit-bomb.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/icon/edit-cut.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/icon/edit-cut.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/icon/edit-delete.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/icon/edit-delete.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/icon/edit-find.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/icon/edit-find.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/icon/edit-select.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/icon/edit-select.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/icon/edit-undo.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/icon/edit-undo.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/icon/format-add-node.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/icon/format-add-node.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/icon/format-break-node.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/icon/format-break-node.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/icon/format-join-node.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/icon/format-join-node.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/icon/format-remove-node.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/icon/format-remove-node.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/icon/help-about.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/icon/help-about.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/icon/help-hint.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/icon/help-hint.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/icon/object-flip-horizontal.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/icon/object-flip-horizontal.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/icon/object-flip-vertical.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/icon/object-flip-vertical.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/icon/object-rotate-left.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/icon/object-rotate-left.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/icon/object-rotate-right.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/icon/object-rotate-right.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/icon/process-stop.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/icon/process-stop.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/icon/view-refresh.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/icon/view-refresh.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/icon/view-statistics.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/icon/view-statistics.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/icon/window-close.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/icon/window-close.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/icon/zoom-in.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/icon/zoom-in.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/icon/zoom-original.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/icon/zoom-original.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/icon/zoom-out.png
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/logic_editor/icon/zoom-out.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/logic_editor/index.html
===================================================================
--- PyWireGate/trunk/logic_editor/index.html (rev 0)
+++ PyWireGate/trunk/logic_editor/index.html 2011-01-09 20:14:55 UTC (rev 243)
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
+ <title>Graphical Logic Editor</title>
+ <link rel="stylesheet" href="logicEditor.css" type="text/css" />
+ <script type="text/javascript" src="lib/jquery-1.4.4.js"></script>
+ <script type="text/javascript" src="lib/jquery-ui-1.8.7.custom.min.js"></script>
+ <script type="text/javascript" src="lib/jquery.svg.js"></script>
+ <script type="text/javascript" src="lib/jquery.layout.js"></script>
+ <script type="text/javascript" src="lib/jquery.jstree.js"></script>
+ <script type="text/javascript" src="backendCommunication.js"></script>
+ <script type="text/javascript" src="gle/gle.block.js"></script>
+ <script type="text/javascript" src="gle/gle.connection.js"></script>
+ <script type="text/javascript" src="logicEditor.js"></script>
+ <script type="text/javascript">
+ </script>
+ </head>
+ <body>
+ <div id="header" class="ui-layout-north">
+ <h1>Example SVG based Logic Engine Editor</h1>
+ Toolbar...
+ </div>
+ <div id="structureContainer" class="ui-layout-west">
+ <h2>Structure area</h2>
+ <div id="structureTree"></div>
+ </div>
+ <div id="editor" class="ui-layout-center ui-layout-content"></div>
+ <div id="libraryContainer" class="ui-layout-east">
+ <h2>Element Library</h2>
+ <div id="library"></div>
+ </div>
+ </body>
+</html>
Property changes on: PyWireGate/trunk/logic_editor/index.html
___________________________________________________________________
Added: svn:executable
+ *
Added: PyWireGate/trunk/logic_editor/lib/jquery-1.4.4.js
===================================================================
--- PyWireGate/trunk/logic_editor/lib/jquery-1.4.4.js (rev 0)
+++ PyWireGate/trunk/logic_editor/lib/jquery-1.4.4.js 2011-01-09 20:14:55 UTC (rev 243)
@@ -0,0 +1,7179 @@
+/*!
+ * jQuery JavaScript Library v1.4.4
+ * http://jquery.com/
+ *
+ * Copyright 2010, John Resig
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * Includes Sizzle.js
+ * http://sizzlejs.com/
+ * Copyright 2010, The Dojo Foundation
+ * Released under the MIT, BSD, and GPL Licenses.
+ *
+ * Date: Thu Nov 11 19:04:53 2010 -0500
+ */
+(function( window, undefined ) {
+
+// Use the correct document accordingly with window argument (sandbox)
+var document = window.document;
+var jQuery = (function() {
+
+// Define a local copy of jQuery
+var jQuery = function( selector, context ) {
+ // The jQuery object is actually just the init constructor 'enhanced'
+ return new jQuery.fn.init( selector, context );
+ },
+
+ // Map over jQuery in case of overwrite
+ _jQuery = window.jQuery,
+
+ // Map over the $ in case of overwrite
+ _$ = window.$,
+
+ // A central reference to the root jQuery(document)
+ rootjQuery,
+
+ // A simple way to check for HTML strings or ID strings
+ // (both of which we optimize for)
+ quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,
+
+ // Is it a simple selector
+ isSimple = /^.[^:#\[\.,]*$/,
+
+ // Check if a string has a non-whitespace character in it
+ rnotwhite = /\S/,
+ rwhite = /\s/,
+
+ // Used for trimming whitespace
+ trimLeft = /^\s+/,
+ trimRight = /\s+$/,
+
+ // Check for non-word characters
+ rnonword = /\W/,
+
+ // Check for digits
+ rdigit = /\d/,
+
+ // Match a standalone tag
+ rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
+
+ // JSON RegExp
+ rvalidchars = /^[\],:{}\s]*$/,
+ rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
+ rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
+ rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
+
+ // Useragent RegExp
+ rwebkit = /(webkit)[ \/]([\w.]+)/,
+ ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
+ rmsie = /(msie) ([\w.]+)/,
+ rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
+
+ // Keep a UserAgent string for use with jQuery.browser
+ userAgent = navigator.userAgent,
+
+ // For matching the engine and version of the browser
+ browserMatch,
+
+ // Has the ready events already been bound?
+ readyBound = false,
+
+ // The functions to execute on DOM ready
+ readyList = [],
+
+ // The ready event handler
+ DOMContentLoaded,
+
+ // Save a reference to some core methods
+ toString = Object.prototype.toString,
+ hasOwn = Object.prototype.hasOwnProperty,
+ push = Array.prototype.push,
+ slice = Array.prototype.slice,
+ trim = String.prototype.trim,
+ indexOf = Array.prototype.indexOf,
+
+ // [[Class]] -> type pairs
+ class2type = {};
+
+jQuery.fn = jQuery.prototype = {
+ init: function( selector, context ) {
+ var match, elem, ret, doc;
+
+ // Handle $(""), $(null), or $(undefined)
+ if ( !selector ) {
+ return this;
+ }
+
+ // Handle $(DOMElement)
+ if ( selector.nodeType ) {
+ this.context = this[0] = selector;
+ this.length = 1;
+ return this;
+ }
+
+ // The body element only exists once, optimize finding it
+ if ( selector === "body" && !context && document.body ) {
+ this.context = document;
+ this[0] = document.body;
+ this.selector = "body";
+ this.length = 1;
+ return this;
+ }
+
+ // Handle HTML strings
+ if ( typeof selector === "string" ) {
+ // Are we dealing with HTML string or an ID?
+ match = quickExpr.exec( selector );
+
+ // Verify a match, and that no context was specified for #id
+ if ( match && (match[1] || !context) ) {
+
+ // HANDLE: $(html) -> $(array)
+ if ( match[1] ) {
+ doc = (context ? context.ownerDocument || context : document);
+
+ // If a single string is passed in and it's a single tag
+ // just do a createElement and skip the rest
+ ret = rsingleTag.exec( selector );
+
+ if ( ret ) {
+ if ( jQuery.isPlainObject( context ) ) {
+ selector = [ document.createElement( ret[1] ) ];
+ jQuery.fn.attr.call( selector, context, true );
+
+ } else {
+ selector = [ doc.createElement( ret[1] ) ];
+ }
+
+ } else {
+ ret = jQuery.buildFragment( [ match[1] ], [ doc ] );
+ selector = (ret.cacheable ? ret.fragment.cloneNode(true) : ret.fragment).childNodes;
+ }
+
+ return jQuery.merge( this, selector );
+
+ // HANDLE: $("#id")
+ } else {
+ elem = document.getElementById( match[2] );
+
+ // Check parentNode to catch when Blackberry 4.6 returns
+ // nodes that are no longer in the document #6963
+ if ( elem && elem.parentNode ) {
+ // Handle the case where IE and Opera return items
+ // by name instead of ID
+ if ( elem.id !== match[2] ) {
+ return rootjQuery.find( selector );
+ }
+
+ // Otherwise, we inject the element directly into the jQuery object
+ this.length = 1;
+ this[0] = elem;
+ }
+
+ this.context = document;
+ this.selector = selector;
+ return this;
+ }
+
+ // HANDLE: $("TAG")
+ } else if ( !context && !rnonword.test( selector ) ) {
+ this.selector = selector;
+ this.context = document;
+ selector = document.getElementsByTagName( selector );
+ return jQuery.merge( this, selector );
+
+ // HANDLE: $(expr, $(...))
+ } else if ( !context || context.jquery ) {
+ return (context || rootjQuery).find( selector );
+
+ // HANDLE: $(expr, context)
+ // (which is just equivalent to: $(context).find(expr)
+ } else {
+ return jQuery( context ).find( selector );
+ }
+
+ // HANDLE: $(function)
+ // Shortcut for document ready
+ } else if ( jQuery.isFunction( selector ) ) {
+ return rootjQuery.ready( selector );
+ }
+
+ if (selector.selector !== undefined) {
+ this.selector = selector.selector;
+ this.context = selector.context;
+ }
+
+ return jQuery.makeArray( selector, this );
+ },
+
+ // Start with an empty selector
+ selector: "",
+
+ // The current version of jQuery being used
+ jquery: "1.4.4",
+
+ // The default length of a jQuery object is 0
+ length: 0,
+
+ // The number of elements contained in the matched element set
+ size: function() {
+ return this.length;
+ },
+
+ toArray: function() {
+ return slice.call( this, 0 );
+ },
+
+ // Get the Nth element in the matched element set OR
+ // Get the whole matched element set as a clean array
+ get: function( num ) {
+ return num == null ?
+
+ // Return a 'clean' array
+ this.toArray() :
+
+ // Return just the object
+ ( num < 0 ? this.slice(num)[ 0 ] : this[ num ] );
+ },
+
+ // Take an array of elements and push it onto the stack
+ // (returning the new matched element set)
+ pushStack: function( elems, name, selector ) {
+ // Build a new jQuery matched element set
+ var ret = jQuery();
+
+ if ( jQuery.isArray( elems ) ) {
+ push.apply( ret, elems );
+
+ } else {
+ jQuery.merge( ret, elems );
+ }
+
+ // Add the old object onto the stack (as a reference)
+ ret.prevObject = this;
+
+ ret.context = this.context;
+
+ if ( name === "find" ) {
+ ret.selector = this.selector + (this.selector ? " " : "") + selector;
+ } else if ( name ) {
+ ret.selector = this.selector + "." + name + "(" + selector + ")";
+ }
+
+ // Return the newly-formed element set
+ return ret;
+ },
+
+ // Execute a callback for every element in the matched set.
+ // (You can seed the arguments with an array of args, but this is
+ // only used internally.)
+ each: function( callback, args ) {
+ return jQuery.each( this, callback, args );
+ },
+
+ ready: function( fn ) {
+ // Attach the listeners
+ jQuery.bindReady();
+
+ // If the DOM is already ready
+ if ( jQuery.isReady ) {
+ // Execute the function immediately
+ fn.call( document, jQuery );
+
+ // Otherwise, remember the function for later
+ } else if ( readyList ) {
+ // Add the function to the wait list
+ readyList.push( fn );
+ }
+
+ return this;
+ },
+
+ eq: function( i ) {
+ return i === -1 ?
+ this.slice( i ) :
+ this.slice( i, +i + 1 );
+ },
+
+ first: function() {
+ return this.eq( 0 );
+ },
+
+ last: function() {
+ return this.eq( -1 );
+ },
+
+ slice: function() {
+ return this.pushStack( slice.apply( this, arguments ),
+ "slice", slice.call(arguments).join(",") );
+ },
+
+ map: function( callback ) {
+ return this.pushStack( jQuery.map(this, function( elem, i ) {
+ return callback.call( elem, i, elem );
+ }));
+ },
+
+ end: function() {
+ return this.prevObject || jQuery(null);
+ },
+
+ // For internal use only.
+ // Behaves like an Array's method, not like a jQuery method.
+ push: push,
+ sort: [].sort,
+ splice: [].splice
+};
+
+// Give the init function the jQuery prototype for later instantiation
+jQuery.fn.init.prototype = jQuery.fn;
+
+jQuery.extend = jQuery.fn.extend = function() {
+ var options, name, src, copy, copyIsArray, clone,
+ target = arguments[0] || {},
+ i = 1,
+ length = arguments.length,
+ deep = false;
+
+ // Handle a deep copy situation
+ if ( typeof target === "boolean" ) {
+ deep = target;
+ target = arguments[1] || {};
+ // skip the boolean and the target
+ i = 2;
+ }
+
+ // Handle case when target is a string or something (possible in deep copy)
+ if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
+ target = {};
+ }
+
+ // extend jQuery itself if only one argument is passed
+ if ( length === i ) {
+ target = this;
+ --i;
+ }
+
+ for ( ; i < length; i++ ) {
+ // Only deal with non-null/undefined values
+ if ( (options = arguments[ i ]) != null ) {
+ // Extend the base object
+ for ( name in options ) {
+ src = target[ name ];
+ copy = options[ name ];
+
+ // Prevent never-ending loop
+ if ( target === copy ) {
+ continue;
+ }
+
+ // Recurse if we're merging plain objects or arrays
+ if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
+ if ( copyIsArray ) {
+ copyIsArray = false;
+ clone = src && jQuery.isArray(src) ? src : [];
+
+ } else {
+ clone = src && jQuery.isPlainObject(src) ? src : {};
+ }
+
+ // Never move original objects, clone them
+ target[ name ] = jQuery.extend( deep, clone, copy );
+
+ // Don't bring in undefined values
+ } else if ( copy !== undefined ) {
+ target[ name ] = copy;
+ }
+ }
+ }
+ }
+
+ // Return the modified object
+ return target;
+};
+
+jQuery.extend({
+ noConflict: function( deep ) {
+ window.$ = _$;
+
+ if ( deep ) {
+ window.jQuery = _jQuery;
+ }
+
+ return jQuery;
+ },
+
+ // Is the DOM ready to be used? Set to true once it occurs.
+ isReady: false,
+
+ // A counter to track how many items to wait for before
+ // the ready event fires. See #6781
+ readyWait: 1,
+
+ // Handle when the DOM is ready
+ ready: function( wait ) {
+ // A third-party is pushing the ready event forwards
+ if ( wait === true ) {
+ jQuery.readyWait--;
+ }
+
+ // Make sure that the DOM is not already loaded
+ if ( !jQuery.readyWait || (wait !== true && !jQuery.isReady) ) {
+ // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
+ if ( !document.body ) {
+ return setTimeout( jQuery.ready, 1 );
+ }
+
+ // Remember that the DOM is ready
+ jQuery.isReady = true;
+
+ // If a normal DOM Ready event fired, decrement, and wait if need be
+ if ( wait !== true && --jQuery.readyWait > 0 ) {
+ return;
+ }
+
+ // If there are functions bound, to execute
+ if ( readyList ) {
+ // Execute all of them
+ var fn,
+ i = 0,
+ ready = readyList;
+
+ // Reset the list of functions
+ readyList = null;
+
+ while ( (fn = ready[ i++ ]) ) {
+ fn.call( document, jQuery );
+ }
+
+ // Trigger any bound ready events
+ if ( jQuery.fn.trigger ) {
+ jQuery( document ).trigger( "ready" ).unbind( "ready" );
+ }
+ }
+ }
+ },
+
+ bindReady: function() {
+ if ( readyBound ) {
+ return;
+ }
+
+ readyBound = true;
+
+ // Catch cases where $(document).ready() is called after the
+ // browser event has already occurred.
+ if ( document.readyState === "complete" ) {
+ // Handle it asynchronously to allow scripts the opportunity to delay ready
+ return setTimeout( jQuery.ready, 1 );
+ }
+
+ // Mozilla, Opera and webkit nightlies currently support this event
+ if ( document.addEventListener ) {
+ // Use the handy event callback
+ document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
+
+ // A fallback to window.onload, that will always work
+ window.addEventListener( "load", jQuery.ready, false );
+
+ // If IE event model is used
+ } else if ( document.attachEvent ) {
+ // ensure firing before onload,
+ // maybe late but safe also for iframes
+ document.attachEvent("onreadystatechange", DOMContentLoaded);
+
+ // A fallback to window.onload, that will always work
+ window.attachEvent( "onload", jQuery.ready );
+
+ // If IE and not a frame
+ // continually check to see if the document is ready
+ var toplevel = false;
+
+ try {
+ toplevel = window.frameElement == null;
+ } catch(e) {}
+
+ if ( document.documentElement.doScroll && toplevel ) {
+ doScrollCheck();
+ }
+ }
+ },
+
+ // See test/unit/core.js for details concerning isFunction.
+ // Since version 1.3, DOM methods and functions like alert
+ // aren't supported. They return false on IE (#2968).
+ isFunction: function( obj ) {
+ return jQuery.type(obj) === "function";
+ },
+
+ isArray: Array.isArray || function( obj ) {
+ return jQuery.type(obj) === "array";
+ },
+
+ // A crude way of determining if an object is a window
+ isWindow: function( obj ) {
+ return obj && typeof obj === "object" && "setInterval" in obj;
+ },
+
+ isNaN: function( obj ) {
+ return obj == null || !rdigit.test( obj ) || isNaN( obj );
+ },
+
+ type: function( obj ) {
+ return obj == null ?
+ String( obj ) :
+ class2type[ toString.call(obj) ] || "object";
+ },
+
+ isPlainObject: function( obj ) {
+ // Must be an Object.
+ // Because of IE, we also have to check the presence of the constructor property.
+ // Make sure that DOM nodes and window objects don't pass through, as well
+ if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
+ return false;
+ }
+
+ // Not own constructor property must be Object
+ if ( obj.constructor &&
+ !hasOwn.call(obj, "constructor") &&
+ !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
+ return false;
+ }
+
+ // Own properties are enumerated firstly, so to speed up,
+ // if last one is own, then all properties are own.
+
+ var key;
+ for ( key in obj ) {}
+
+ return key === undefined || hasOwn.call( obj, key );
+ },
+
+ isEmptyObject: function( obj ) {
+ for ( var name in obj ) {
+ return false;
+ }
+ return true;
+ },
+
+ error: function( msg ) {
+ throw msg;
+ },
+
+ parseJSON: function( data ) {
+ if ( typeof data !== "string" || !data ) {
+ return null;
+ }
+
+ // Make sure leading/trailing whitespace is removed (IE can't handle it)
+ data = jQuery.trim( data );
+
+ // Make sure the incoming data is actual JSON
+ // Logic borrowed from http://json.org/json2.js
+ if ( rvalidchars.test(data.replace(rvalidescape, "@")
+ .replace(rvalidtokens, "]")
+ .replace(rvalidbraces, "")) ) {
+
+ // Try to use the native JSON parser first
+ return window.JSON && window.JSON.parse ?
+ window.JSON.parse( data ) :
+ (new Function("return " + data))();
+
+ } else {
+ jQuery.error( "Invalid JSON: " + data );
+ }
+ },
+
+ noop: function() {},
+
+ // Evalulates a script in a global context
+ globalEval: function( data ) {
+ if ( data && rnotwhite.test(data) ) {
+ // Inspired by code by Andrea Giammarchi
+ // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
+ var head = document.getElementsByTagName("head")[0] || document.documentElement,
+ script = document.createElement("script");
+
+ script.type = "text/javascript";
+
+ if ( jQuery.support.scriptEval ) {
+ script.appendChild( document.createTextNode( data ) );
+ } else {
+ script.text = data;
+ }
+
+ // Use insertBefore instead of appendChild to circumvent an IE6 bug.
+ // This arises when a base node is used (#2709).
+ head.insertBefore( script, head.firstChild );
+ head.removeChild( script );
+ }
+ },
+
+ nodeName: function( elem, name ) {
+ return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
+ },
+
+ // args is for internal usage only
+ each: function( object, callback, args ) {
+ var name, i = 0,
+ length = object.length,
+ isObj = length === undefined || jQuery.isFunction(object);
+
+ if ( args ) {
+ if ( isObj ) {
+ for ( name in object ) {
+ if ( callback.apply( object[ name ], args ) === false ) {
+ break;
+ }
+ }
+ } else {
+ for ( ; i < length; ) {
+ if ( callback.apply( object[ i++ ], args ) === false ) {
+ break;
+ }
+ }
+ }
+
+ // A special, fast, case for the most common use of each
+ } else {
+ if ( isObj ) {
+ for ( name in object ) {
+ if ( callback.call( object[ name ], name, object[ name ] ) === false ) {
+ break;
+ }
+ }
+ } else {
+ for ( var value = object[0];
+ i < length && callback.call( value, i, value ) !== false; value = object[++i] ) {}
+ }
+ }
+
+ return object;
+ },
+
+ // Use native String.trim function wherever possible
+ trim: trim ?
+ function( text ) {
+ return text == null ?
+ "" :
+ trim.call( text );
+ } :
+
+ // Otherwise use our own trimming functionality
+ function(...
[truncated message content] |