You can subscribe to this list here.
| 2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(121) |
Dec
(58) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2011 |
Jan
(38) |
Feb
(36) |
Mar
(7) |
Apr
(2) |
May
(32) |
Jun
(24) |
Jul
(16) |
Aug
(21) |
Sep
(17) |
Oct
(62) |
Nov
(60) |
Dec
(70) |
| 2012 |
Jan
(54) |
Feb
(41) |
Mar
(21) |
Apr
(38) |
May
(76) |
Jun
(47) |
Jul
(25) |
Aug
(72) |
Sep
(29) |
Oct
(64) |
Nov
(93) |
Dec
(97) |
| 2013 |
Jan
(100) |
Feb
(168) |
Mar
(115) |
Apr
(59) |
May
(37) |
Jun
(32) |
Jul
(45) |
Aug
(42) |
Sep
(24) |
Oct
(73) |
Nov
(64) |
Dec
(4) |
| 2014 |
Jan
(14) |
Feb
(57) |
Mar
(58) |
Apr
(10) |
May
(18) |
Jun
(12) |
Jul
(7) |
Aug
(12) |
Sep
(15) |
Oct
(6) |
Nov
(32) |
Dec
(17) |
| 2015 |
Jan
(50) |
Feb
(5) |
Mar
(1) |
Apr
(26) |
May
(10) |
Jun
(3) |
Jul
(3) |
Aug
(2) |
Sep
(3) |
Oct
(18) |
Nov
(18) |
Dec
(8) |
| 2016 |
Jan
(33) |
Feb
(35) |
Mar
(50) |
Apr
(20) |
May
(25) |
Jun
(17) |
Jul
(8) |
Aug
(73) |
Sep
(64) |
Oct
(51) |
Nov
(20) |
Dec
(14) |
| 2017 |
Jan
(41) |
Feb
(57) |
Mar
(44) |
Apr
(136) |
May
(32) |
Jun
(39) |
Jul
(2) |
Aug
(12) |
Sep
(32) |
Oct
(103) |
Nov
(12) |
Dec
(4) |
| 2018 |
Jan
(9) |
Feb
(1) |
Mar
(60) |
Apr
(24) |
May
(15) |
Jun
(1) |
Jul
(2) |
Aug
(23) |
Sep
(15) |
Oct
(57) |
Nov
(21) |
Dec
(77) |
| 2019 |
Jan
(62) |
Feb
(99) |
Mar
(98) |
Apr
(49) |
May
(6) |
Jun
(3) |
Jul
(6) |
Aug
(18) |
Sep
(9) |
Oct
(15) |
Nov
(30) |
Dec
(6) |
| 2020 |
Jan
(14) |
Feb
(2) |
Mar
(22) |
Apr
(33) |
May
(47) |
Jun
(12) |
Jul
|
Aug
|
Sep
(4) |
Oct
(2) |
Nov
(5) |
Dec
(5) |
| 2021 |
Jan
(4) |
Feb
(101) |
Mar
(13) |
Apr
(32) |
May
(40) |
Jun
|
Jul
(3) |
Aug
|
Sep
|
Oct
(25) |
Nov
(12) |
Dec
|
| 2022 |
Jan
(154) |
Feb
(82) |
Mar
(63) |
Apr
(27) |
May
(26) |
Jun
(5) |
Jul
(12) |
Aug
(23) |
Sep
(17) |
Oct
(37) |
Nov
(13) |
Dec
(21) |
| 2023 |
Jan
(43) |
Feb
(43) |
Mar
(15) |
Apr
(8) |
May
(3) |
Jun
(25) |
Jul
(6) |
Aug
(38) |
Sep
(5) |
Oct
(20) |
Nov
(9) |
Dec
(28) |
| 2024 |
Jan
(15) |
Feb
(2) |
Mar
(12) |
Apr
(2) |
May
(8) |
Jun
(10) |
Jul
(10) |
Aug
(2) |
Sep
(3) |
Oct
(15) |
Nov
(6) |
Dec
(20) |
| 2025 |
Jan
|
Feb
(2) |
Mar
(6) |
Apr
(2) |
May
(2) |
Jun
|
Jul
|
Aug
(1) |
Sep
(1) |
Oct
(11) |
Nov
(2) |
Dec
|
|
From: <ma...@us...> - 2011-12-16 22:43:42
|
Revision: 580
http://openautomation.svn.sourceforge.net/openautomation/?rev=580&view=rev
Author: mayerch
Date: 2011-12-16 22:43:35 +0000 (Fri, 16 Dec 2011)
Log Message:
-----------
Lighting and finally add the faces in the wall holes
Modified Paths:
--------------
JSFloorPlan/trunk/jsfloorplan_example_helper.js
Modified: JSFloorPlan/trunk/jsfloorplan_example_helper.js
===================================================================
--- JSFloorPlan/trunk/jsfloorplan_example_helper.js 2011-12-16 18:42:03 UTC (rev 579)
+++ JSFloorPlan/trunk/jsfloorplan_example_helper.js 2011-12-16 22:43:35 UTC (rev 580)
@@ -72,14 +72,27 @@
controls.keys = [ 65, 83, 68 ];
*/
var scene = new THREE.Scene();
-
+scene.add( camera );
// the camera starts at 0,0,0 so pull it back
camera.position.z = 300;
// start the renderer
renderer.setSize(WIDTH, HEIGHT);
+// enable shadows
+var SHADOW_MAP_WIDTH = 2048, SHADOW_MAP_HEIGHT = 1024;
+renderer.shadowCameraNear = 0.1;
+renderer.shadowCameraFar = 100;
+renderer.shadowCameraFov = 45;
+renderer.shadowMapBias = 0.0039;
+renderer.shadowMapDarkness = 0.5;
+renderer.shadowMapWidth = SHADOW_MAP_WIDTH;
+renderer.shadowMapHeight = SHADOW_MAP_HEIGHT;
+renderer.shadowMapEnabled = true;
+//renderer.shadowMapSoft = true;
+
+
// set up the sphere vars
var radius = 50, segments = 16, rings = 16;
@@ -114,6 +127,7 @@
//scene.add( cube );
cubeMaterial = new THREE.MeshBasicMaterial({ map: THREE.ImageUtils.loadTexture( 'media/demo_texture_512x512.png' ) });
+//cubeMaterial = new THREE.MeshPhongMaterial( { color: 0xff0000, specular: 0xffffff, ambient: 0xaa0000 } );
var lineMaterial = new THREE.LineBasicMaterial( { color: 0x0099ff, linewidth: 2 } );
@@ -129,7 +143,26 @@
// add to the scene
//scene.add(pointLight);
+var lightDirection = 3.9;
+var lightHeight = 0.25;
+var lightStrength = 80;
+var lightDistance = 50;
+//var sunLight = new THREE.PointLight( 0xFFFFFF );
+//var sunLight = new THREE.DirectionalLight( 0xFFFFFF );
+var sunLight = new THREE.SpotLight( 0xffffff );
+sunLight.position.set( 0, 1500, 1000 );
+sunLight.target.position.set( 0, 0, 0 );
+sunLight.castShadow = true;
+var sunLightView = new THREE.Geometry();
+sunLightView.vertices.push( new THREE.Vertex( sunLight.position ) );
+sunLightView.vertices.push( new THREE.Vertex( sunLight.target.position ) );
+var sunLightViewLine = new THREE.Line( sunLightView, lineMaterial );
+scene.add( sunLightViewLine );
+//var dlight = new THREE.DirectionalLight( 0xffffff, 0.1 );
+// dlight.position.set( 0.5, -1, 0 ).normalize();
+// scene.add( dlight );
+
/**
* Provides requestAnimationFrame in a cross browser way.
* http://paulirish.com/2011/requestanimationframe-for-smart-animating/
@@ -400,6 +433,10 @@
$( "#rollSlider" ).slider({ min: 0, max: 360, change: rollChange, slide: rollChange});
$( "#tiltSlider" ).slider({ min: 0, max: 90, change: tiltChange, slide: tiltChange});
$( "#distSlider" ).slider({ min: 5, max: 30, change: distChange, slide: distChange});
+ $( "#lightDirectionSlider" ).slider({ min: 0, max: 360, change: lightDirectionChange, slide: lightDirectionChange});
+ $( "#lightHeightSlider" ).slider({ min: 0, max: 90, change: lightHeightChange , slide: lightHeightChange });
+ $( "#lightStrengthSlider" ).slider({ min: 0, max: 100, change: lightStrengthChange , slide: lightStrengthChange });
+ $( "#lightDistanceSlider" ).slider({ min:10, max: 100, change: lightDistanceChange , slide: lightDistanceChange });
updateSlider();
}
@@ -409,9 +446,15 @@
globalInUpdateSlider = true;
var rollAngle = (roll * 180/Math.PI);
var tiltAngle = (tilt * 180/Math.PI);
+ var lightDirectionAngle = (lightDirection * 180/Math.PI);
+ var lightHeightAngle = (lightHeight * 180/Math.PI);
$( "#rollSlider" ).slider( "option", "value", rollAngle );
$( "#tiltSlider" ).slider( "option", "value", tiltAngle );
$( "#distSlider" ).slider( "option", "value", dist );
+ $( "#lightDirectionSlider" ).slider( "option", "value", lightDirectionAngle );
+ $( "#lightHeightSlider" ).slider( "option", "value", lightHeightAngle );
+ $( "#lightStrengthSlider" ).slider( "option", "value", lightStrength );
+ $( "#lightDistanceSlider" ).slider( "option", "value", lightDistance );
globalInUpdateSlider = false;
}
@@ -434,4 +477,34 @@
if( globalInUpdateSlider ) return true;
dist = ui.value;
show3D( roll, tilt );
-}
\ No newline at end of file
+}
+
+function lightDirectionChange( event, ui )
+{
+ if( globalInUpdateSlider ) return true;
+ lightDirection = ui.value * Math.PI / 180;
+ show3D( roll, tilt );
+}
+
+function lightHeightChange( event, ui )
+{
+ if( globalInUpdateSlider ) return true;
+ lightHeight = ui.value * Math.PI / 180;
+ show3D( roll, tilt );
+}
+
+function lightStrengthChange( event, ui )
+{
+ if( globalInUpdateSlider ) return true;
+ lightStrength = ui.value;
+ show3D( roll, tilt );
+}
+
+function lightDistanceChange( event, ui )
+{
+ if( globalInUpdateSlider ) return true;
+ lightDistance = ui.value;
+ show3D( roll, tilt );
+}
+
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2011-12-16 18:42:09
|
Revision: 579
http://openautomation.svn.sourceforge.net/openautomation/?rev=579&view=rev
Author: mayerch
Date: 2011-12-16 18:42:03 +0000 (Fri, 16 Dec 2011)
Log Message:
-----------
Initial support for shadows
Modified Paths:
--------------
JSFloorPlan/trunk/jsfloorplan.js
Modified: JSFloorPlan/trunk/jsfloorplan.js
===================================================================
--- JSFloorPlan/trunk/jsfloorplan.js 2011-12-16 14:24:07 UTC (rev 578)
+++ JSFloorPlan/trunk/jsfloorplan.js 2011-12-16 18:42:03 UTC (rev 579)
@@ -422,6 +422,8 @@
//console.log(geometry, cubeMaterial);
geometry.computeFaceNormals();
var mesh = new THREE.Mesh(geometry, cubeMaterial);
+ mesh.castShadow = true;
+ mesh.receiveShadow = true;
wallGroup.add(mesh);
} // end for( j=0; j<floorWalls.length; j++ )
Object3D.add( lineGroup );
@@ -576,9 +578,10 @@
var showFloor = showStates.showFloor;
///////////
- scene.add(pointLight);
+ scene.add(sunLight);
+ //scene.add(pointLight);
scene.add(ambientLight);
- scene.add( camera );
+ //scene.add( camera );
var $container = $('#top_level');
// attach the render-supplied DOM element
$container.append(renderer.domElement);
@@ -598,11 +601,29 @@
var cy = Math.sin(rotation) * Math.cos(tilt);
var cz = Math.sin(tilt);
var heightOfGround = buildingProperties.floor[ showStates.showFloor ].heightOfGround;
+ var target = new THREE.Vector3( buildingProperties.x_center, buildingProperties.y_center, heightOfGround);
camera.up = new THREE.Vector3( Math.cos(rotation) * Math.sin(tilt), -Math.sin(rotation) * Math.sin(tilt), Math.cos(tilt) );
camera.position = new THREE.Vector3( cx*dist + buildingProperties.x_center, cy*dist + buildingProperties.y_center, dist * cz + heightOfGround);
- camera.lookAt( new THREE.Vector3( buildingProperties.x_center, buildingProperties.y_center, heightOfGround) );
+ camera.lookAt( target );
pointLight.position = camera.position;
+ // set up sun
+ var sx = -Math.cos(lightDirection) * Math.cos(lightHeight);
+ var sy = Math.sin(lightDirection) * Math.cos(lightHeight);
+ var sz = Math.sin(lightHeight);
+ sunLight.target.position = target;
+ sunLight.position = new THREE.Vector3( sx * lightDistance, sy * lightDistance, sz * lightDistance );
+ sunLight.intensity = lightStrength / 100.0;
+ sunLightViewLine.geometry.vertices[0].position = sunLight.position;
+ sunLightViewLine.geometry.vertices[1].position = sunLight.target.position;
+ sunLightViewLine.geometry.__dirtyVertices = true;
+
+ if( showStates.showLightView )
+ {
+ camera.position = sunLight.position;
+ camera.lookAt( sunLight.target.position );
+ }
+
// update opacity
cubeMaterial.opacity = showStates.fillOpacity;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2011-12-16 14:24:18
|
Revision: 578
http://openautomation.svn.sourceforge.net/openautomation/?rev=578&view=rev
Author: mayerch
Date: 2011-12-16 14:24:07 +0000 (Fri, 16 Dec 2011)
Log Message:
-----------
Add UV coordinates to the triangulated version. This allows to enable textures again.
Modified Paths:
--------------
JSFloorPlan/trunk/jsfloorplan.js
JSFloorPlan/trunk/jsfloorplan_example_helper.js
Modified: JSFloorPlan/trunk/jsfloorplan.js
===================================================================
--- JSFloorPlan/trunk/jsfloorplan.js 2011-12-15 18:31:12 UTC (rev 577)
+++ JSFloorPlan/trunk/jsfloorplan.js 2011-12-16 14:24:07 UTC (rev 578)
@@ -333,7 +333,7 @@
{
// not a hole, the sourrounding goes to the groud...
- if( lintel == 1 ) continue; // FIXME: Assume lintel != 1 - otherwise it should be two walls...
+ // lintel == 1 can't happen, it's checked in the if clause above
sourrounding.splice( 0, 0, new poly2tri.Point(fRight,0), new poly2tri.Point(fRight,lintel), new poly2tri.Point(fLeft,lintel), new poly2tri.Point(fLeft,0) );
continue;
@@ -398,10 +398,16 @@
//geometry.faces = Tfaces;
for( var f = 0; f < Tfaces.length; f++ )
{
+ var uv_a = new THREE.UV( Tvertices[Tfaces[f].a].x, Tvertices[Tfaces[f].a].y );
+ var uv_b = new THREE.UV( Tvertices[Tfaces[f].b].x, Tvertices[Tfaces[f].b].y );
+ var uv_c = new THREE.UV( Tvertices[Tfaces[f].c].x, Tvertices[Tfaces[f].c].y );
+
// wall side 1
geometry.faces.push( Tfaces[f] );
+ geometry.faceVertexUvs[0].push([ uv_a, uv_b, uv_c ]);
// wall side 2
geometry.faces.push(new THREE.Face3(Tfaces[f].c+wall1verticesLength, Tfaces[f].b+wall1verticesLength, Tfaces[f].a+wall1verticesLength ) );
+ geometry.faceVertexUvs[0].push([ uv_c, uv_b, uv_a ]);
}
// wall top
var mId = geometry.vertices.length;
@@ -413,10 +419,6 @@
geometry.faces.push(new THREE.Face3(s2id, s1id, e1id ) );
geometry.faces.push(new THREE.Face3(e2id, s2id, e1id ) );
geometry.faces.push(new THREE.Face3(e2id, e1id, mId+3) );
- /*
- * geometry.faces.push(new THREE.Face3( 2, 3, 0 ));
- * geometry.faceVertexUvs[0].push([ new THREE.UV(1,1), new THREE.UV(1,0), new THREE.UV(0,1) ]);
- */
//console.log(geometry, cubeMaterial);
geometry.computeFaceNormals();
var mesh = new THREE.Mesh(geometry, cubeMaterial);
Modified: JSFloorPlan/trunk/jsfloorplan_example_helper.js
===================================================================
--- JSFloorPlan/trunk/jsfloorplan_example_helper.js 2011-12-15 18:31:12 UTC (rev 577)
+++ JSFloorPlan/trunk/jsfloorplan_example_helper.js 2011-12-16 14:24:07 UTC (rev 578)
@@ -113,7 +113,7 @@
cube.position = new THREE.Vector3(50,50,50);
//scene.add( cube );
-//cubeMaterial = new THREE.MeshBasicMaterial({ map: THREE.ImageUtils.loadTexture( 'media/demo_texture_512x512.png' ) });
+cubeMaterial = new THREE.MeshBasicMaterial({ map: THREE.ImageUtils.loadTexture( 'media/demo_texture_512x512.png' ) });
var lineMaterial = new THREE.LineBasicMaterial( { color: 0x0099ff, linewidth: 2 } );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2011-12-15 18:31:23
|
Revision: 577
http://openautomation.svn.sourceforge.net/openautomation/?rev=577&view=rev
Author: mayerch
Date: 2011-12-15 18:31:12 +0000 (Thu, 15 Dec 2011)
Log Message:
-----------
Add trianglulation lib and triangulate walls to handle holes.
Also make wireframe view togglable via web page.
Modified Paths:
--------------
JSFloorPlan/trunk/index.html
JSFloorPlan/trunk/jsfloorplan.js
JSFloorPlan/trunk/jsfloorplan_example_helper.js
Added Paths:
-----------
JSFloorPlan/trunk/lib/poly2tri.js
Modified: JSFloorPlan/trunk/index.html
===================================================================
--- JSFloorPlan/trunk/index.html 2011-12-15 18:24:48 UTC (rev 576)
+++ JSFloorPlan/trunk/index.html 2011-12-15 18:31:12 UTC (rev 577)
@@ -12,6 +12,7 @@
<!-- -->
<script src="lib/jquery-1.7.1.min.js" type="text/javascript"></script>
<script src="lib/jquery-ui-1.8.16.custom.min.js" type="text/javascript"></script>
+<script src="lib/poly2tri.js" type="text/javascript"></script>
<script src="lib/Three.js" type="text/javascript"></script>
<script src="jsfloorplan_example_helper.js" type="text/javascript"></script>
<script src="jsfloorplan.js" type="text/javascript"></script>
@@ -87,6 +88,7 @@
</td><td>
Zeige Walls: <input type="checkbox" name="showWallLines" />
</td><td>
+ Zeige Wireframe: <input type="checkbox" name="showWireframe" />
</td><td>
</td><td>
</td><td>
Modified: JSFloorPlan/trunk/jsfloorplan.js
===================================================================
--- JSFloorPlan/trunk/jsfloorplan.js 2011-12-15 18:24:48 UTC (rev 576)
+++ JSFloorPlan/trunk/jsfloorplan.js 2011-12-15 18:31:12 UTC (rev 577)
@@ -280,6 +280,7 @@
var e1 = vertices[ floorWalls[j].endVertex [0] ];
var s2 = vertices[ floorWalls[j].startVertex[1] ];
var e2 = vertices[ floorWalls[j].endVertex [1] ];
+
// check that the start and end points aren't twisted
var v1 = new Object; v1.x = s1.x-s2.x; v1.y = s1.y-s2.y;
var v2 = new Object; v2.x = e1.x-s2.x; v2.y = e1.y-s2.y;
@@ -296,54 +297,127 @@
var wallSideOrder = (s2.x-s1.x)*(e1.y-s1.y) - (s2.y-s1.y)*(e1.x-s1.x);
var geometry = new THREE.Geometry();
- //geometry.faceVertexUvs[0].push([
- // new THREE.UV(u_value, v_value)), new THREE.UV(u_value, v_value)), new THREE.UV(u_value, v_value))
- //]);
- geometry.vertices.push(new THREE.Vertex(new THREE.Vector3(s1.x,s1.y,heightOfGround )));
- geometry.vertices.push(new THREE.Vertex(new THREE.Vector3(s1.x,s1.y,heightOfGround + sh)));
- geometry.vertices.push(new THREE.Vertex(new THREE.Vector3(e1.x,e1.y,heightOfGround )));
- geometry.vertices.push(new THREE.Vertex(new THREE.Vector3(e1.x,e1.y,heightOfGround + sh)));
- geometry.vertices.push(new THREE.Vertex(new THREE.Vector3(sm.x,sm.y,heightOfGround + sh)));
+ var normal1 = new THREE.Vector3(sm.y-em.y,-sm.x+em.x,0); // fixme? normalize
+ var normal2 = new THREE.Vector3(1,0,0);
- geometry.vertices.push(new THREE.Vertex(new THREE.Vector3(s2.x,s2.y,heightOfGround )));
- geometry.vertices.push(new THREE.Vertex(new THREE.Vector3(s2.x,s2.y,heightOfGround + sh)));
- geometry.vertices.push(new THREE.Vertex(new THREE.Vector3(e2.x,e2.y,heightOfGround )));
- geometry.vertices.push(new THREE.Vertex(new THREE.Vector3(e2.x,e2.y,heightOfGround + sh)));
- geometry.vertices.push(new THREE.Vertex(new THREE.Vector3(em.x,em.y,heightOfGround + sh)));
+ var sourrounding = [ new poly2tri.Point(0,0), new poly2tri.Point(0,1), new poly2tri.Point(1,1), new poly2tri.Point(1,0) ];
+ sourrounding[1].startEndMarker = 'start';
+ sourrounding[2].startEndMarker = 'end';
+ var holesToAdd = [];
- if( wallSideOrder < 0 )
+ if( floorWalls[j].holes.length )
{
- // Add the wall sides
- geometry.faces.push(new THREE.Face3( 2, 3, 0 ));
- geometry.faceVertexUvs[0].push([ new THREE.UV(1,1), new THREE.UV(1,0), new THREE.UV(0,1) ]);
- geometry.faces.push(new THREE.Face3( 1, 0, 3 ));
- geometry.faceVertexUvs[0].push([ new THREE.UV(0,0), new THREE.UV(0,1), new THREE.UV(1,0) ]);
- geometry.faces.push(new THREE.Face3( 5, 6, 7 ));
- geometry.faceVertexUvs[0].push([ new THREE.UV(1,1), new THREE.UV(1,0), new THREE.UV(0,1) ]);
- geometry.faces.push(new THREE.Face3( 8, 7, 6 ));
- geometry.faceVertexUvs[0].push([ new THREE.UV(0,0), new THREE.UV(0,1), new THREE.UV(1,0) ]);
- // Add the wall tops
- geometry.faces.push(new THREE.Face3( 1, 6, 9 ));
- geometry.faces.push(new THREE.Face3( 6, 1, 3 ));
- geometry.faces.push(new THREE.Face3( 6, 3, 8 ));
- geometry.faces.push(new THREE.Face3( 4, 8, 3 ));
- } else {
- // Add the wall sides
- geometry.faces.push(new THREE.Face3( 2, 0, 3 ));
- geometry.faceVertexUvs[0].push([ new THREE.UV(0,1), new THREE.UV(1,1), new THREE.UV(0,0) ]);
- geometry.faces.push(new THREE.Face3( 1, 3, 0 ));
- geometry.faceVertexUvs[0].push([ new THREE.UV(1,0), new THREE.UV(0,0), new THREE.UV(1,1) ]);
- geometry.faces.push(new THREE.Face3( 5, 7, 6 ));
- geometry.faceVertexUvs[0].push([ new THREE.UV(0,1), new THREE.UV(1,1), new THREE.UV(0,0) ]);
- geometry.faces.push(new THREE.Face3( 8, 6, 7 ));
- geometry.faceVertexUvs[0].push([ new THREE.UV(1,0), new THREE.UV(0,0), new THREE.UV(1,1) ]);
- // Add the wall tops
- geometry.faces.push(new THREE.Face3( 1, 9, 6 ));
- geometry.faces.push(new THREE.Face3( 6, 3, 1 ));
- geometry.faces.push(new THREE.Face3( 6, 8, 3 ));
- geometry.faces.push(new THREE.Face3( 8, 4, 3 ));
+ var holes = floorWalls[j].holes;
+ for( var h = 0; h < holes.length; h++ )
+ {
+ var wallLength = calcLength2D( sm, em );
+ var fLeft = holes[h].distance / wallLength;
+ var fRight = (holes[h].distance + holes[h].width) / wallLength;
+ if( fLeft < 0.0 ) fLeft = 0.01; //// FIXME
+ if( fRight > 1.0 ) fRight = 0.99; //// FIXME
+ var lintel = (sh - holes[h].lintel) / sh;
+ var paparet = holes[h].paparet / sh;
+ if( 1 == lintel )
+ {
+ // not a hole, the sourrounding goes to the groud...
+
+ if( paparet == 0 ) continue; // FIXME: Assume paparet != 0 - otherwise it should be two walls...
+
+ console.log( sourrounding );
+ sourrounding.splice( -2, 0, new poly2tri.Point(fLeft,1), new poly2tri.Point(fLeft,paparet), new poly2tri.Point(fRight,paparet), new poly2tri.Point(fRight,1) );
+ console.log( sourrounding );
+ continue;
+ }
+ //if( 0 == paparet ) paparet = 0.01; //// FIXME
+ if( 0 == paparet )
+ {
+ // not a hole, the sourrounding goes to the groud...
+
+ if( lintel == 1 ) continue; // FIXME: Assume lintel != 1 - otherwise it should be two walls...
+
+ sourrounding.splice( 0, 0, new poly2tri.Point(fRight,0), new poly2tri.Point(fRight,lintel), new poly2tri.Point(fLeft,lintel), new poly2tri.Point(fLeft,0) );
+ continue;
+ }
+
+ holesToAdd.push( [new poly2tri.Point(fLeft,paparet), new poly2tri.Point(fRight,paparet), new poly2tri.Point(fRight,lintel), new poly2tri.Point(fLeft,lintel)] );
+ }
+ } // if( floorWalls[j].holes.length )
+ var swctx = new poly2tri.SweepContext( sourrounding );
+ for( var htA = 0; htA < holesToAdd.length; htA++ )
+ swctx.AddHole( holesToAdd[htA] );
+
+ // Do the triangulation - FIXME: handle exceptions, don't ignore them...
+ try {
+ poly2tri.sweep.Triangulate(swctx);
+ }catch(err){}
+
+ // mark all points to make sure that we don't need to double vertices
+ for( var tp = 0; tp < swctx.point_count(); tp++ )
+ swctx.GetPoint( tp ).id = tp;
+
+ // translate poly2tri triangles to THREE.js faces:
+ var p2tF = [];
+ $.each(swctx.GetTriangles(), function(idx, val) {
+ p2tF.push(new THREE.Face3(val.GetPoint(0).id, val.GetPoint(1).id, val.GetPoint(2).id));
+ });
+
+ Tvertices = swctx.points_;
+ Tfaces = p2tF;
+ var wall1vertices = [];
+ var wall2vertices = [];
+ var sId, eId;
+ for( var v = 0; v < Tvertices.length; v++ )
+ {
+ var tv = Tvertices[v];
+ var x1 = s1.x * tv.x + e1.x * (1 - tv.x);
+ var x2 = s2.x * tv.x + e2.x * (1 - tv.x);
+ var y1 = s1.y * tv.x + e1.y * (1 - tv.x);
+ var y2 = s2.y * tv.x + e2.y * (1 - tv.x);
+ var z = heightOfGround + sh*tv.y;
+ if( wallSideOrder > 0 )
+ {
+ wall1vertices.push(new THREE.Vertex(new THREE.Vector3(x1,y1,z), normal1));
+ wall2vertices.push(new THREE.Vertex(new THREE.Vector3(x2,y2,z), normal1));
+ } else {
+ wall1vertices.push(new THREE.Vertex(new THREE.Vector3(x2,y2,z), normal1));
+ wall2vertices.push(new THREE.Vertex(new THREE.Vector3(x1,y1,z), normal1));
+ }
+ if( 'startEndMarker' in tv )
+ {
+ if( 'start' == tv.startEndMarker )
+ {
+ sId = wall1vertices.length - 1;
+ } else {
+ eId = wall1vertices.length - 1;
+ }
+ }
}
-
+ var wall1verticesLength = wall1vertices.length;
+ geometry.vertices = wall1vertices.concat( wall2vertices );
+ var s1id = sId, s2id = sId + wall1verticesLength, e1id = eId, e2id = eId + wall1verticesLength;
+ //geometry.faces = Tfaces;
+ for( var f = 0; f < Tfaces.length; f++ )
+ {
+ // wall side 1
+ geometry.faces.push( Tfaces[f] );
+ // wall side 2
+ geometry.faces.push(new THREE.Face3(Tfaces[f].c+wall1verticesLength, Tfaces[f].b+wall1verticesLength, Tfaces[f].a+wall1verticesLength ) );
+ }
+ // wall top
+ var mId = geometry.vertices.length;
+ geometry.vertices.push(new THREE.Vertex(new THREE.Vector3(sm.x,sm.y,heightOfGround )));
+ geometry.vertices.push(new THREE.Vertex(new THREE.Vector3(sm.x,sm.y,heightOfGround+sh)));
+ geometry.vertices.push(new THREE.Vertex(new THREE.Vector3(em.x,em.y,heightOfGround )));
+ geometry.vertices.push(new THREE.Vertex(new THREE.Vector3(em.x,em.y,heightOfGround+eh)));
+ geometry.faces.push(new THREE.Face3(s1id, s2id, mId+1) );
+ geometry.faces.push(new THREE.Face3(s2id, s1id, e1id ) );
+ geometry.faces.push(new THREE.Face3(e2id, s2id, e1id ) );
+ geometry.faces.push(new THREE.Face3(e2id, e1id, mId+3) );
+ /*
+ * geometry.faces.push(new THREE.Face3( 2, 3, 0 ));
+ * geometry.faceVertexUvs[0].push([ new THREE.UV(1,1), new THREE.UV(1,0), new THREE.UV(0,1) ]);
+ */
+ //console.log(geometry, cubeMaterial);
geometry.computeFaceNormals();
var mesh = new THREE.Mesh(geometry, cubeMaterial);
wallGroup.add(mesh);
Modified: JSFloorPlan/trunk/jsfloorplan_example_helper.js
===================================================================
--- JSFloorPlan/trunk/jsfloorplan_example_helper.js 2011-12-15 18:24:48 UTC (rev 576)
+++ JSFloorPlan/trunk/jsfloorplan_example_helper.js 2011-12-15 18:31:12 UTC (rev 577)
@@ -113,7 +113,7 @@
cube.position = new THREE.Vector3(50,50,50);
//scene.add( cube );
-cubeMaterial = new THREE.MeshBasicMaterial({ map: THREE.ImageUtils.loadTexture( 'media/demo_texture_512x512.png' ) });
+//cubeMaterial = new THREE.MeshBasicMaterial({ map: THREE.ImageUtils.loadTexture( 'media/demo_texture_512x512.png' ) });
var lineMaterial = new THREE.LineBasicMaterial( { color: 0x0099ff, linewidth: 2 } );
@@ -248,6 +248,10 @@
});
});
break;
+
+ case 'showWireframe':
+ cubeMaterial.wireframe = showStates['showWireframe'];
+ break;
}
}
Added: JSFloorPlan/trunk/lib/poly2tri.js
===================================================================
--- JSFloorPlan/trunk/lib/poly2tri.js (rev 0)
+++ JSFloorPlan/trunk/lib/poly2tri.js 2011-12-15 18:31:12 UTC (rev 577)
@@ -0,0 +1,1751 @@
+/*
+ * Modified version by Christian Mayer (c) 2011 to avoid the originally used
+ * namespace
+ */
+/******************************************************************************/
+/*
+ * Poly2Tri Copyright (c) 2009-2010, Poly2Tri Contributors
+ * http://code.google.com/p/poly2tri/
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of Poly2Tri nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without specific
+ * prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+//Namespace('poly2tri');
+poly2tri = {};
+// ------------------------------------------------------------------------Point
+poly2tri.Point = function() {
+ this.x = null;
+ this.y = null;
+
+ if (arguments.length == 0) {
+ this.x = 0.0;
+ this.y = 0.0;
+ } else if (arguments.length == 2) {
+ this.x = arguments[0];
+ this.y = arguments[1];
+ } else {
+ alert('Invalid poly2tri.Point constructor call!');
+ }
+
+ // The edges this point constitutes an upper ending point
+ this.edge_list = [];
+
+}
+
+/**
+ * Set this Point instance to the origo. <code>(0; 0)</code>
+ */
+poly2tri.Point.prototype.set_zero = function() {
+ this.x = 0.0;
+ this.y = 0.0;
+}
+
+/**
+ * Set the coordinates of this instance.
+ * @param x number.
+ * @param y number;
+ */
+poly2tri.Point.prototype.set = function(x, y) {
+ this.x = x;
+ this.y = y;
+}
+
+/**
+ * Negate this Point instance. (component-wise)
+ */
+poly2tri.Point.prototype.negate = function() {
+ this.x = -this.x;
+ this.y = -this.y;
+}
+
+/**
+ * Add another Point object to this instance. (component-wise)
+ * @param n Point object.
+ */
+poly2tri.Point.prototype.add = function(n) {
+ this.x += n.x;
+ this.y += n.y;
+}
+
+/**
+ * Subtract this Point instance with another point given. (component-wise)
+ * @param n Point object.
+ */
+poly2tri.Point.prototype.sub = function(n) {
+ this.x -= n.x;
+ this.y -= n.y;
+}
+
+/**
+ * Multiply this Point instance by a scalar. (component-wise)
+ * @param s scalar.
+ */
+poly2tri.Point.prototype.mul = function(s) {
+ this.x *= s;
+ this.y *= s;
+}
+
+/**
+ * Return the distance of this Point instance from the origo.
+ */
+poly2tri.Point.prototype.length = function() {
+ return Math.sqrt(this.x*this.x + this.y*this.y);
+}
+
+/**
+ * Normalize this Point instance (as a vector).
+ * @return The original distance of this instance from the origo.
+ */
+poly2tri.Point.prototype.normalize = function() {
+ var len = this.length();
+ this.x /= len;
+ this.y /= len;
+ return len;
+}
+
+/**
+ * Test this Point object with another for equality.
+ * @param p Point object.
+ * @return <code>True</code> if <code>this == p</code>, <code>false</code> otherwise.
+ */
+poly2tri.Point.prototype.equals = function(p) {
+ return poly2tri.equals(this, p);
+}
+
+/**
+ * Negate a point component-wise and return the result as a new Point object.
+ * @param p Point object.
+ * @return the resulting Point object.
+ */
+poly2tri.negate = function(p) {
+ return new poly2tri.Point(-p.x, -p.y);
+}
+
+/**
+ * Compare two points component-wise.
+ * @param a Point object.
+ * @param b Point object.
+ * @return <code>-1</code> if <code>a < b</code>, <code>1</code> if
+ * <code>a > b</code>, <code>0</code> otherwise.
+ */
+poly2tri.cmp = function(a, b) {
+ if (a.y == b.y) {
+ return a.x - b.x;
+ } else {
+ return a.y - b.y;
+ }
+}
+
+/**
+ * Add two points component-wise and return the result as a new Point object.
+ * @param a Point object.
+ * @param b Point object.
+ * @return the resulting Point object.
+ */
+poly2tri.add = function(a, b) {
+ return new poly2tri.Point(a.x+b.x, a.y+b.y);
+}
+
+/**
+ * Subtract two points component-wise and return the result as a new Point object.
+ * @param a Point object.
+ * @param b Point object.
+ * @return the resulting Point object.
+ */
+poly2tri.sub = function(a, b) {
+ return new poly2tri.Point(a.x-b.x, a.y-b.y);
+}
+
+/**
+ * Multiply a point by a scalar and return the result as a new Point object.
+ * @param s the scalar (a number).
+ * @param p Point object.
+ * @return the resulting Point object.
+ */
+poly2tri.mul = function(s, p) {
+ return new poly2tri.Point(s*p.x, s*p.y);
+}
+
+/**
+ * Test two Point objects for equality.
+ * @param a Point object.
+ * @param b Point object.
+ * @return <code>True</code> if <code>a == b</code>, <code>false</code> otherwise.
+ */
+poly2tri.equals = function(a, b) {
+ return a.x == b.x && a.y == b.y;
+}
+
+/**
+ * Peform the dot product on two vectors.
+ * @param a Point object.
+ * @param b Point object.
+ * @return The dot product (as a number).
+ */
+poly2tri.dot = function(a, b) {
+ return a.x*b.x + a.y*b.y;
+}
+
+/**
+ * Perform the cross product on either two points (this produces a scalar)
+ * or a point and a scalar (this produces a point).
+ * This function requires two parameters, either may be a Point object or a
+ * number.
+ * @return a Point object or a number, depending on the parameters.
+ */
+poly2tri.cross = function() {
+ var a0_p = false;
+ var a1_p = false;
+ if (arguments.length == 2) {
+ if (typeof(arguments[0]) == 'number') {
+ a0_p = true;
+ }
+ if (typeof(arguments[1] == 'number')) {
+ a1_p = true;
+ }
+
+ if (a0_p) {
+ if (a1_p) return arguments[0].x*arguments[1].y - arguments[0].y*arguments[1].x;
+ else return new poly2tri.Point(arguments[1]*arguments[0].y, -arguments[1]*arguments[0].x);
+ } else {
+ if (a1_p) return new poly2tri.Point(-arguments[0]*arguments[1].y, arguments[0]*arguments[1].x);
+ else return arguments[0]*arguments[1];
+ }
+ } else {
+ alert('Invalid poly2tri.cross call!');
+ return undefined;
+ }
+}
+
+
+// -------------------------------------------------------------------------Edge
+poly2tri.Edge = function() {
+ this.p = null;
+ this.q = null;
+
+ if (arguments.length == 2) {
+ if (arguments[0].y > arguments[1].y) {
+ this.q = arguments[0];
+ this.p = arguments[1];
+ } else if (arguments[0].y == arguments[1].y) {
+ if (arguments[0].x > arguments[1].x) {
+ this.q = arguments[0];
+ this.p = arguments[1];
+ } else if (arguments[0].x == arguments[1].x) {
+ alert('Invalid poly2tri.edge constructor call: repeated points!');
+ } else {
+ this.p = arguments[0];
+ this.q = arguments[1];
+ }
+ } else {
+ this.p = arguments[0];
+ this.q = arguments[1];
+ }
+ } else {
+ alert('Invalid poly2tri.Edge constructor call!');
+ }
+
+ this.q.edge_list.push(this);
+}
+
+// ---------------------------------------------------------------------Triangle
+/**
+ * Triangle class.<br>
+ * Triangle-based data structures are known to have better performance than
+ * quad-edge structures.
+ * See: J. Shewchuk, "Triangle: Engineering a 2D Quality Mesh Generator and
+ * Delaunay Triangulator", "Triangulations in CGAL"
+ *
+ * @param p1 Point object.
+ * @param p2 Point object.
+ * @param p3 Point object.
+ */
+poly2tri.Triangle = function(p1, p2, p3) {
+ // Triangle points
+ this.points_ = [ null, null, null ];
+ // Neighbor list
+ this.neighbors_ = [ null, null, null ];
+ // Has this triangle been marked as an interior triangle?
+ this.interior_ = false;
+ // Flags to determine if an edge is a Constrained edge
+ this.constrained_edge = [ false, false, false ];
+ // Flags to determine if an edge is a Delauney edge
+ this.delaunay_edge = [ false, false, false ];
+
+ if (arguments.length == 3) {
+ this.points_[0] = p1;
+ this.points_[1] = p2;
+ this.points_[2] = p3;
+ }
+}
+
+poly2tri.Triangle.prototype.GetPoint = function(index) {
+ return this.points_[index];
+}
+
+poly2tri.Triangle.prototype.GetNeighbor = function(index) {
+ return this.neighbors_[index];
+}
+
+/**
+ * Test if this Triangle contains the Point objects given as parameters as its
+ * vertices.
+ * @return <code>True</code> if the Point objects are of the Triangle's vertices,
+ * <code>false</code> otherwise.
+ */
+poly2tri.Triangle.prototype.ContainsP = function() {
+ var back = true;
+ for (var aidx=0; aidx < arguments.length; ++aidx) {
+ back = back && (arguments[aidx].equals(this.points_[0]) ||
+ arguments[aidx].equals(this.points_[1]) ||
+ arguments[aidx].equals(this.points_[2])
+ );
+ }
+ return back;
+}
+
+/**
+ * Test if this Triangle contains the Edge objects given as parameters as its
+ * bounding edges.
+ * @return <code>True</code> if the Edge objects are of the Triangle's bounding
+ * edges, <code>false</code> otherwise.
+ */
+poly2tri.Triangle.prototype.ContainsE = function() {
+ var back = true;
+ for (var aidx=0; aidx < arguments.length; ++aidx) {
+ back = back && this.ContainsP(arguments[aidx].p, arguments[aidx].q);
+ }
+ return back;
+}
+
+poly2tri.Triangle.prototype.IsInterior = function() {
+ if (arguments.length == 0) {
+ return this.interior_;
+ } else {
+ this.interior_ = arguments[0];
+ return this.interior_;
+ }
+}
+
+/**
+ * Update neighbor pointers.<br>
+ * This method takes either 3 parameters (<code>p1</code>, <code>p2</code> and
+ * <code>t</code>) or 1 parameter (<code>t</code>).
+ * @param p1 Point object.
+ * @param p2 Point object.
+ * @param t Triangle object.
+ */
+poly2tri.Triangle.prototype.MarkNeighbor = function() {
+ var t;
+ if (arguments.length == 3) {
+ var p1 = arguments[0];
+ var p2 = arguments[1];
+ t = arguments[2];
+
+ if ((p1.equals(this.points_[2]) && p2.equals(this.points_[1])) || (p1.equals(this.points_[1]) && p2.equals(this.points_[2]))) this.neighbors_[0] = t;
+ else if ((p1.equals(this.points_[0]) && p2.equals(this.points_[2])) || (p1.equals(this.points_[2]) && p2.equals(this.points_[0]))) this.neighbors_[1] = t;
+ else if ((p1.equals(this.points_[0]) && p2.equals(this.points_[1])) || (p1.equals(this.points_[1]) && p2.equals(this.points_[0]))) this.neighbors_[2] = t;
+ else alert('Invalid poly2tri.Triangle.MarkNeighbor call (1)!');
+ } else if (arguments.length == 1) {
+ // exhaustive search to update neighbor pointers
+ t = arguments[0];
+ if (t.ContainsP(this.points_[1], this.points_[2])) {
+ this.neighbors_[0] = t;
+ t.MarkNeighbor(this.points_[1], this.points_[2], this);
+ } else if (t.ContainsP(this.points_[0], this.points_[2])) {
+ this.neighbors_[1] = t;
+ t.MarkNeighbor(this.points_[0], this.points_[2], this);
+ } else if (t.ContainsP(this.points_[0], this.points_[1])) {
+ this.neighbors_[2] = t;
+ t.MarkNeighbor(this.points_[0], this.points_[1], this);
+ }
+ } else {
+ alert('Invalid poly2tri.Triangle.MarkNeighbor call! (2)');
+ }
+}
+
+poly2tri.Triangle.prototype.ClearNeigbors = function() {
+ this.neighbors_[0] = null;
+ this.neighbors_[1] = null;
+ this.neighbors_[2] = null;
+}
+
+poly2tri.Triangle.prototype.ClearDelunayEdges = function() {
+ this.delaunay_edge[0] = false;
+ this.delaunay_edge[1] = false;
+ this.delaunay_edge[2] = false;
+}
+
+/**
+ * Return the point clockwise to the given point.
+ */
+poly2tri.Triangle.prototype.PointCW = function(p) {
+ if (p.equals(this.points_[0])) {
+ return this.points_[2];
+ } else if (p.equals(this.points_[1])) {
+ return this.points_[0];
+ } else if (p.equals(this.points_[2])) {
+ return this.points_[1];
+ } else {
+ return null;
+ }
+}
+
+/**
+ * Return the point counter-clockwise to the given point.
+ */
+poly2tri.Triangle.prototype.PointCCW = function(p) {
+ if (p.equals(this.points_[0])) {
+ return this.points_[1];
+ } else if (p.equals(this.points_[1])) {
+ return this.points_[2];
+ } else if (p.equals(this.points_[2])) {
+ return this.points_[0];
+ } else {
+ return null;
+ }
+}
+
+/**
+ * Return the neighbor clockwise to given point.
+ */
+poly2tri.Triangle.prototype.NeighborCW = function(p) {
+ if (p.equals(this.points_[0])) {
+ return this.neighbors_[1];
+ } else if (p.equals(this.points_[1])) {
+ return this.neighbors_[2];
+ } else {
+ return this.neighbors_[0];
+ }
+}
+
+/**
+ * Return the neighbor counter-clockwise to given point.
+ */
+poly2tri.Triangle.prototype.NeighborCCW = function(p) {
+ if (p.equals(this.points_[0])) {
+ return this.neighbors_[2];
+ } else if (p.equals(this.points_[1])) {
+ return this.neighbors_[0];
+ } else {
+ return this.neighbors_[1];
+ }
+}
+
+poly2tri.Triangle.prototype.GetConstrainedEdgeCW = function(p) {
+ if (p.equals(this.points_[0])) {
+ return this.constrained_edge[1];
+ } else if (p.equals(this.points_[1])) {
+ return this.constrained_edge[2];
+ } else {
+ return this.constrained_edge[0];
+ }
+}
+
+poly2tri.Triangle.prototype.GetConstrainedEdgeCCW = function(p) {
+ if (p.equals(this.points_[0])) {
+ return this.constrained_edge[2];
+ } else if (p.equals(this.points_[1])) {
+ return this.constrained_edge[0];
+ } else {
+ return this.constrained_edge[1];
+ }
+}
+
+poly2tri.Triangle.prototype.SetConstrainedEdgeCW = function(p, ce) {
+ if (p.equals(this.points_[0])) {
+ this.constrained_edge[1] = ce;
+ } else if (p.equals(this.points_[1])) {
+ this.constrained_edge[2] = ce;
+ } else {
+ this.constrained_edge[0] = ce;
+ }
+}
+
+poly2tri.Triangle.prototype.SetConstrainedEdgeCCW = function(p, ce) {
+ if (p.equals(this.points_[0])) {
+ this.constrained_edge[2] = ce;
+ } else if (p.equals(this.points_[1])) {
+ this.constrained_edge[0] = ce;
+ } else {
+ this.constrained_edge[1] = ce;
+ }
+}
+
+poly2tri.Triangle.prototype.GetDelaunayEdgeCW = function(p) {
+ if (p.equals(this.points_[0])) {
+ return this.delaunay_edge[1];
+ } else if (p.equals(this.points_[1])) {
+ return this.delaunay_edge[2];
+ } else {
+ return this.delaunay_edge[0];
+ }
+}
+
+poly2tri.Triangle.prototype.GetDelaunayEdgeCCW = function(p) {
+ if (p.equals(this.points_[0])) {
+ return this.delaunay_edge[2];
+ } else if (p.equals(this.points_[1])) {
+ return this.delaunay_edge[0];
+ } else {
+ return this.delaunay_edge[1];
+ }
+}
+
+poly2tri.Triangle.prototype.SetDelaunayEdgeCW = function(p, e) {
+ if (p.equals(this.points_[0])) {
+ this.delaunay_edge[1] = e;
+ } else if (p.equals(this.points_[1])) {
+ this.delaunay_edge[2] = e;
+ } else {
+ this.delaunay_edge[0] = e;
+ }
+}
+
+poly2tri.Triangle.prototype.SetDelaunayEdgeCCW = function(p, e) {
+ if (p.equals(this.points_[0])) {
+ this.delaunay_edge[2] = e;
+ } else if (p.equals(this.points_[1])) {
+ this.delaunay_edge[0] = e;
+ } else {
+ this.delaunay_edge[1] = e;
+ }
+}
+
+/**
+ * The neighbor across to given point.
+ */
+poly2tri.Triangle.prototype.NeighborAcross = function(p) {
+ if (p.equals(this.points_[0])) {
+ return this.neighbors_[0];
+ } else if (p.equals(this.points_[1])) {
+ return this.neighbors_[1];
+ } else {
+ return this.neighbors_[2];
+ }
+}
+
+poly2tri.Triangle.prototype.OppositePoint = function(t, p) {
+ var cw = t.PointCW(p);
+ return this.PointCW(cw);
+}
+
+/**
+ * Legalize triangle by rotating clockwise.<br>
+ * This method takes either 1 parameter (then the triangle is rotated around
+ * points(0)) or 2 parameters (then the triangle is rotated around the first
+ * parameter).
+ */
+poly2tri.Triangle.prototype.Legalize = function() {
+ if (arguments.length == 1) {
+ this.Legalize(this.points_[0], arguments[0]);
+ } else if (arguments.length == 2) {
+ var opoint = arguments[0];
+ var npoint = arguments[1];
+
+ if (opoint.equals(this.points_[0])) {
+ this.points_[1] = this.points_[0];
+ this.points_[0] = this.points_[2];
+ this.points_[2] = npoint;
+ } else if (opoint.equals(this.points_[1])) {
+ this.points_[2] = this.points_[1];
+ this.points_[1] = this.points_[0];
+ this.points_[0] = npoint;
+ } else if (opoint.equals(this.points_[2])) {
+ this.points_[0] = this.points_[2];
+ this.points_[2] = this.points_[1];
+ this.points_[1] = npoint;
+ } else {
+ alert('Invalid poly2tri.Triangle.Legalize call!');
+ }
+ } else {
+ alert('Invalid poly2tri.Triangle.Legalize call!');
+ }
+}
+
+poly2tri.Triangle.prototype.Index = function(p) {
+ if (p.equals(this.points_[0])) return 0;
+ else if (p.equals(this.points_[1])) return 1;
+ else if (p.equals(this.points_[2])) return 2;
+ else return -1;
+}
+
+poly2tri.Triangle.prototype.EdgeIndex = function(p1, p2) {
+ if (p1.equals(this.points_[0])) {
+ if (p2.equals(this.points_[1])) {
+ return 2;
+ } else if (p2.equals(this.points_[2])) {
+ return 1;
+ }
+ } else if (p1.equals(this.points_[1])) {
+ if (p2.equals(this.points_[2])) {
+ return 0;
+ } else if (p2.equals(this.points_[0])) {
+ return 2;
+ }
+ } else if (p1.equals(this.points_[2])) {
+ if (p2.equals(this.points_[0])) {
+ return 1;
+ } else if (p2.equals(this.points_[1])) {
+ return 0;
+ }
+ }
+ return -1;
+}
+
+/**
+ * Mark an edge of this triangle as constrained.<br>
+ * This method takes either 1 parameter (an edge index or an Edge instance) or
+ * 2 parameters (two Point instances defining the edge of the triangle).
+ */
+poly2tri.Triangle.prototype.MarkConstrainedEdge = function() {
+ if (arguments.length == 1) {
+ if (typeof(arguments[0]) == 'number') {
+ this.constrained_edge[arguments[0]] = true;
+ } else {
+ this.MarkConstrainedEdge(arguments[0].p, arguments[0].q);
+ }
+ } else if (arguments.length == 2) {
+ var p = arguments[0];
+ var q = arguments[1];
+ if ((q.equals(this.points_[0]) && p.equals(this.points_[1])) || (q.equals(this.points_[1]) && p.equals(this.points_[0]))) {
+ this.constrained_edge[2] = true;
+ } else if ((q.equals(this.points_[0]) && p.equals(this.points_[2])) || (q.equals(this.points_[2]) && p.equals(this.points_[0]))) {
+ this.constrained_edge[1] = true;
+ } else if ((q.equals(this.points_[1]) && p.equals(this.points_[2])) || (q.equals(this.points_[2]) && p.equals(this.points_[1]))) {
+ this.constrained_edge[0] = true;
+ }
+ } else {
+ alert('Invalid poly2tri.Triangle.MarkConstrainedEdge call!');
+ }
+}
+
+// ------------------------------------------------------------------------utils
+poly2tri.PI_3div4 = 3 * Math.PI / 4;
+poly2tri.PI_2 = Math.PI / 2;
+poly2tri.EPSILON = 1e-12;
+
+/*
+ * Inital triangle factor, seed triangle will extend 30% of
+ * PointSet width to both left and right.
+ */
+poly2tri.kAlpha = 0.3;
+
+poly2tri.Orientation = {
+ "CW" : 1,
+ "CCW" : -1,
+ "COLLINEAR" : 0
+};
+
+/**
+ * Forumla to calculate signed area<br>
+ * Positive if CCW<br>
+ * Negative if CW<br>
+ * 0 if collinear<br>
+ * <pre>
+ * A[P1,P2,P3] = (x1*y2 - y1*x2) + (x2*y3 - y2*x3) + (x3*y1 - y3*x1)
+ * = (x1-x3)*(y2-y3) - (y1-y3)*(x2-x3)
+ * </pre>
+ */
+poly2tri.Orient2d = function(pa, pb, pc) {
+ var detleft = (pa.x - pc.x) * (pb.y - pc.y);
+ var detright = (pa.y - pc.y) * (pb.x - pc.x);
+ var val = detleft - detright;
+ if (val > -(poly2tri.EPSILON) && val < (poly2tri.EPSILON)) {
+ return poly2tri.Orientation.COLLINEAR;
+ } else if (val > 0) {
+ return poly2tri.Orientation.CCW;
+ } else {
+ return poly2tri.Orientation.CW;
+ }
+}
+
+poly2tri.InScanArea = function(pa, pb, pc, pd) {
+ var pdx = pd.x;
+ var pdy = pd.y;
+ var adx = pa.x - pdx;
+ var ady = pa.y - pdy;
+ var bdx = pb.x - pdx;
+ var bdy = pb.y - pdy;
+
+ var adxbdy = adx * bdy;
+ var bdxady = bdx * ady;
+ var oabd = adxbdy - bdxady;
+
+ if (oabd <= (poly2tri.EPSILON)) {
+ return false;
+ }
+
+ var cdx = pc.x - pdx;
+ var cdy = pc.y - pdy;
+
+ var cdxady = cdx * ady;
+ var adxcdy = adx * cdy;
+ var ocad = cdxady - adxcdy;
+
+ if (ocad <= (poly2tri.EPSILON)) {
+ return false;
+ }
+
+ return true;
+}
+
+// ---------------------------------------------------------------AdvancingFront
+poly2tri.Node = function() {
+ this.point = null; // Point
+ this.triangle = null; // Triangle
+
+ this.next = null; // Node
+ this.prev = null; // Node
+
+ this.value = 0.0; // double
+
+ if (arguments.length == 1) {
+ this.point = arguments[0];
+ this.value = this.point.x;
+ } else if (arguments.length == 2) {
+ this.point = arguments[0];
+ this.triangle = arguments[1];
+ this.value = this.point.x;
+ } else {
+ alert('Invalid poly2tri.Node constructor call!');
+ }
+}
+
+poly2tri.AdvancingFront = function(head, tail) {
+ this.head_ = head; // Node
+ this.tail_ = tail; // Node
+ this.search_node_ = head; // Node
+}
+
+poly2tri.AdvancingFront.prototype.head = function() {
+ return this.head_;
+}
+
+poly2tri.AdvancingFront.prototype.set_head = function(node) {
+ this.head_ = node;
+}
+
+poly2tri.AdvancingFront.prototype.tail = function() {
+ return this.tail_;
+}
+
+poly2tri.AdvancingFront.prototype.set_tail = function(node) {
+ this.tail_ = node;
+}
+
+poly2tri.AdvancingFront.prototype.search = function() {
+ return this.search_node_;
+}
+
+poly2tri.AdvancingFront.prototype.set_search = function(node) {
+ this.search_node_ = node;
+}
+
+poly2tri.AdvancingFront.prototype.FindSearchNode = function(x) {
+ return this.search_node_;
+}
+
+poly2tri.AdvancingFront.prototype.LocateNode = function(x) {
+ var node = this.search_node_;
+
+ if (x < node.value) {
+ while ((node = node.prev) != null) {
+ if (x >= node.value) {
+ this.search_node_ = node;
+ return node;
+ }
+ }
+ } else {
+ while ((node = node.next) != null) {
+ if (x < node.value) {
+ this.search_node_ = node.prev;
+ return node.prev;
+ }
+ }
+ }
+ return null;
+}
+
+poly2tri.AdvancingFront.prototype.LocatePoint = function(point) {
+ var px = point.x;
+ var node = this.FindSearchNode(px);
+ var nx = node.point.x;
+
+ if (px == nx) {
+ // We might have two nodes with same x value for a short time
+ if (point.equals(node.prev.point)) {
+ node = node.prev;
+ } else if (point.equals(node.next.point)) {
+ node = node.next;
+ } else if (point.equals(node.point)) {
+ // do nothing
+ } else {
+ alert('Invalid poly2tri.AdvancingFront.LocatePoint call!');
+ return null;
+ }
+ } else if (px < nx) {
+ while ((node = node.prev) != null) {
+ if (point.equals(node.point)) break;
+ }
+ } else {
+ while ((node = node.next) != null) {
+ if (point.equals(node.point)) break;
+ }
+ }
+
+ if (node != null) this.search_node_ = node;
+ return node;
+}
+
+// ------------------------------------------------------------------------Basin
+poly2tri.Basin = function() {
+ this.left_node = null; // Node
+ this.bottom_node = null; // Node
+ this.right_node = null; // Node
+ this.width = 0.0; // number
+ this.left_highest = false;
+}
+
+poly2tri.Basin.prototype.Clear = function() {
+ this.left_node = null;
+ this.bottom_node = null;
+ this.right_node = null;
+ this.width = 0.0;
+ this.left_highest = false;
+}
+
+// --------------------------------------------------------------------EdgeEvent
+poly2tri.EdgeEvent = function() {
+ this.constrained_edge = null; // Edge
+ this.right = false;
+}
+
+// -----------------------------------------------------------------SweepContext
+poly2tri.SweepContext = function(polyline) {
+ this.triangles_ = [];
+ this.map_ = [];
+ this.points_ = polyline;
+ this.edge_list = [];
+
+ // Advancing front
+ this.front_ = null; // AdvancingFront
+ // head point used with advancing front
+ this.head_ = null; // Point
+ // tail point used with advancing front
+ this.tail_ = null; // Point
+
+ this.af_head_ = null; // Node
+ this.af_middle_ = null; // Node
+ this.af_tail_ = null; // Node
+
+ this.basin = new poly2tri.Basin();
+ this.edge_event = new poly2tri.EdgeEvent();
+
+ this.InitEdges(this.points_);
+}
+
+poly2tri.SweepContext.prototype.AddHole = function(polyline) {
+ this.InitEdges(polyline);
+ for (var i in polyline) {
+ this.points_.push(polyline[i]);
+ }
+}
+
+poly2tri.SweepContext.prototype.front = function() {
+ return this.front_;
+}
+
+poly2tri.SweepContext.prototype.point_count = function() {
+ return this.points_.length;
+}
+
+poly2tri.SweepContext.prototype.head = function() {
+ return this.head_;
+}
+
+poly2tri.SweepContext.prototype.set_head = function(p1) {
+ this.head_ = p1;
+}
+
+poly2tri.SweepContext.prototype.tail = function() {
+ return this.tail_;
+}
+
+poly2tri.SweepContext.prototype.set_tail = function(p1) {
+ this.tail_ = p1;
+}
+
+poly2tri.SweepContext.prototype.GetTriangles = function() {
+ return this.triangles_;
+}
+
+poly2tri.SweepContext.prototype.GetMap = function() {
+ return this.map_;
+}
+
+poly2tri.SweepContext.prototype.InitTriangulation = function() {
+ var xmax = this.points_[0].x;
+ var xmin = this.points_[0].x;
+ var ymax = this.points_[0].y;
+ var ymin = this.points_[0].y;
+
+ // Calculate bounds
+ for (var i in this.points_) {
+ var p = this.points_[i];
+ if (p.x > xmax) xmax = p.x;
+ if (p.x < xmin) xmin = p.x;
+ if (p.y > ymax) ymax = p.y;
+ if (p.y < ymin) ymin = p.y;
+ }
+
+ var dx = poly2tri.kAlpha * (xmax - xmin);
+ var dy = poly2tri.kAlpha * (ymax - ymin);
+ this.head_ = new poly2tri.Point(xmax + dx, ymin - dy);
+ this.tail_ = new poly2tri.Point(xmin - dy, ymin - dy);
+
+ // Sort points along y-axis
+ this.points_.sort(poly2tri.cmp);
+}
+
+poly2tri.SweepContext.prototype.InitEdges = function(polyline) {
+ for (var i=0; i < polyline.length; ++i) {
+ this.edge_list.push(new poly2tri.Edge(polyline[i], polyline[(i+1) % polyline.length]));
+ }
+}
+
+poly2tri.SweepContext.prototype.GetPoint = function(index) {
+ return this.points_[index];
+}
+
+poly2tri.SweepContext.prototype.AddToMap = function(triangle) {
+ this.map_.push(triangle);
+}
+
+poly2tri.SweepContext.prototype.LocateNode = function(point) {
+ return this.front_.LocateNode(point.x);
+}
+
+poly2tri.SweepContext.prototype.CreateAdvancingFront = function() {
+ var head;
+ var middle;
+ var tail;
+ // Initial triangle
+ var triangle = new poly2tri.Triangle(this.points_[0], this.tail_, this.head_);
+
+ this.map_.push(triangle);
+
+ head = new poly2tri.Node(triangle.GetPoint(1), triangle);
+ middle = new poly2tri.Node(triangle.GetPoint(0), triangle);
+ tail = new poly2tri.Node(triangle.GetPoint(2));
+
+ this.front_ = new poly2tri.AdvancingFront(head, tail);
+
+ head.next = middle;
+ middle.next = tail;
+ middle.prev = head;
+ tail.prev = middle;
+}
+
+poly2tri.SweepContext.prototype.RemoveNode = function(node) {
+ // do nothing
+}
+
+poly2tri.SweepContext.prototype.MapTriangleToNodes = function(t) {
+ for (var i=0; i<3; ++i) {
+ if (t.GetNeighbor(i) == null) {
+ var n = this.front_.LocatePoint(t.PointCW(t.GetPoint(i)));
+ if (n != null) {
+ n.triangle = t;
+ }
+ }
+ }
+}
+
+poly2tri.SweepContext.prototype.RemoveFromMap = function(triangle) {
+ for (var i in this.map_) {
+ if (this.map_[i] == triangle) {
+ delete this.map_[i];
+ break;
+ }
+ }
+}
+
+poly2tri.SweepContext.prototype.MeshClean = function(triangle) {
+ if (triangle != null && !triangle.IsInterior()) {
+ triangle.IsInterior(true);
+ this.triangles_.push(triangle);
+ for (var i=0; i<3; ++i) {
+ if (!triangle.constrained_edge[i]) {
+ this.MeshClean(triangle.GetNeighbor(i));
+ }
+ }
+ }
+}
+
+// ------------------------------------------------------------------------Sweep
+//Namespace('poly2tri.sweep');
+poly2tri.sweep = {};
+
+/**
+ * Triangulate simple polygon with holes.
+ * @param tcx SweepContext object.
+ */
+poly2tri.sweep.Triangulate = function(tcx) {
+ tcx.InitTriangulation();
+ tcx.CreateAdvancingFront();
+ // Sweep points; build mesh
+ poly2tri.sweep.SweepPoints(tcx);
+ // Clean up
+ poly2tri.sweep.FinalizationPolygon(tcx);
+}
+
+poly2tri.sweep.SweepPoints = function(tcx) {
+ for (var i=1; i < tcx.point_count(); ++i) {
+ var point = tcx.GetPoint(i);
+ var node = poly2tri.sweep.PointEvent(tcx, point);
+ for (var j=0; j < point.edge_list.length; ++j) {
+ poly2tri.sweep.EdgeEvent(tcx, point.edge_list[j], node);
+ }
+ }
+}
+
+poly2tri.sweep.FinalizationPolygon = function(tcx) {
+ // Get an Internal triangle to start with
+ var t = tcx.front().head().next.triangle;
+ var p = tcx.front().head().next.point;
+ while (!t.GetConstrainedEdgeCW(p)) {
+ t = t.NeighborCCW(p);
+ }
+
+ // Collect interior triangles constrained by edges
+ tcx.MeshClean(t);
+}
+
+/**
+ * Find closes node to the left of the new point and
+ * create a new triangle. If needed new holes and basins
+ * will be filled to.
+ */
+poly2tri.sweep.PointEvent = function(tcx, point) {
+ var node = tcx.LocateNode(point);
+ var new_node = poly2tri.sweep.NewFrontTriangle(tcx, point, node);
+
+ // Only need to check +epsilon since point never have smaller
+ // x value than node due to how we fetch nodes from the front
+ if (point.x <= node.point.x + (poly2tri.EPSILON)) {
+ poly2tri.sweep.Fill(tcx, node);
+ }
+
+ //tcx.AddNode(new_node);
+
+ poly2tri.sweep.FillAdvancingFront(tcx, new_node);
+ return new_node;
+}
+
+poly2tri.sweep.EdgeEvent = function() {
+ var tcx;
+ if (arguments.length == 3) {
+ tcx = arguments[0];
+ var edge = arguments[1];
+ var node = arguments[2];
+
+ tcx.edge_event.constrained_edge = edge;
+ tcx.edge_event.right = (edge.p.x > edge.q.x);
+
+ if (poly2tri.sweep.IsEdgeSideOfTriangle(node.triangle, edge.p, edge.q)) {
+ return;
+ }
+
+ // For now we will do all needed filling
+ // TODO: integrate with flip process might give some better performance
+ // but for now this avoid the issue with cases that needs both flips and fills
+ poly2tri.sweep.FillEdgeEvent(tcx, edge, node);
+ poly2tri.sweep.EdgeEvent(tcx, edge.p, edge.q, node.triangle, edge.q);
+ } else if (arguments.length == 5) {
+ tcx = arguments[0];
+ var ep = arguments[1];
+ var eq = arguments[2];
+ var triangle = arguments[3];
+ var point = arguments[4];
+
+ if (poly2tri.sweep.IsEdgeSideOfTriangle(triangle, ep, eq)) {
+ return;
+ }
+
+ var p1 = triangle.PointCCW(point);
+ var o1 = poly2tri.Orient2d(eq, p1, ep);
+ if (o1 == poly2tri.Orientation.COLLINEAR) {
+ alert('poly2tri.sweep.EdgeEvent: Collinear not supported!');
+ return;
+ }
+
+ var p2 = triangle.PointCW(point);
+ var o2 = poly2tri.Orient2d(eq, p2, ep);
+ if (o2 == poly2tri.Orientation.COLLINEAR) {
+ alert('poly2tri.sweep.EdgeEvent: Collinear not supported!');
+ return;
+ }
+
+ if (o1 == o2) {
+ // Need to decide if we are rotating CW or CCW to get to a triangle
+ // that will cross edge
+ if (o1 == poly2tri.Orientation.CW) {
+ triangle = triangle.NeighborCCW(point);
+ } else {
+ triangle = triangle.NeighborCW(point);
+ }
+ poly2tri.sweep.EdgeEvent(tcx, ep, eq, triangle, point);
+ } else {
+ // This triangle crosses constraint so lets flippin start!
+ poly2tri.sweep.FlipEdgeEvent(tcx, ep, eq, triangle, point);
+ }
+ } else {
+ alert('Invalid poly2tri.sweep.EdgeEvent call!');
+ }
+}
+
+poly2tri.sweep.IsEdgeSideOfTriangle = function(triangle, ep, eq) {
+ var index = triangle.EdgeIndex(ep, eq);
+ if (index != -1) {
+ triangle.MarkConstrainedEdge(index);
+ var t = triangle.GetNeighbor(index);
+ if (t != null) {
+ t.MarkConstrainedEdge(ep, eq);
+ }
+ return true;
+ }
+ return false;
+}
+
+poly2tri.sweep.NewFrontTriangle = function(tcx, point, node) {
+ var triangle = new poly2tri.Triangle(point, node.point, node.next.point);
+
+ triangle.MarkNeighbor(node.triangle);
+ tcx.AddToMap(triangle);
+
+ var new_node = new poly2tri.Node(point);
+ new_node.next = node.next;
+ new_node.prev = node;
+ node.next.prev = new_node;
+ node.next = new_node;
+
+ if (!poly2tri.sweep.Legalize(tcx, triangle)) {
+ tcx.MapTriangleToNodes(triangle);
+ }
+
+ return new_node;
+}
+
+/**
+ * Adds a triangle to the advancing front to fill a hole.
+ * @param tcx
+ * @param node - middle node, that is the bottom of the hole
+ */
+poly2tri.sweep.Fill = function(tcx, node) {
+ var triangle = new poly2tri.Triangle(node.prev.point, node.point, node.next.point);
+
+ // TODO: should copy the constrained_edge value from neighbor triangles
+ // for now constrained_edge values are copied during the legalize
+ triangle.MarkNeighbor(node.prev.triangle);
+ triangle.MarkNeighbor(node.triangle);
+
+ tcx.AddToMap(triangle);
+
+ // Update the advancing front
+ node.prev.next = node.next;
+ node.next.prev = node.prev;
+
+
+ // If it was legalized the triangle has already been mapped
+ if (!poly2tri.sweep.Legalize(tcx, triangle)) {
+ tcx.MapTriangleToNodes(triangle);
+ }
+
+ //tcx.RemoveNode(node);
+}
+
+/**
+ * Fills holes in the Advancing Front
+ */
+poly2tri.sweep.FillAdvancingFront = function(tcx, n) {
+ // Fill right holes
+ var node = n.next;
+ var angle;
+
+ while (node.next != null) {
+ angle = poly2tri.sweep.HoleAngle(node);
+ if (angle > poly2tri.PI_2 || angle < -(poly2tri.PI_2)) break;
+ poly2tri.sweep.Fill(tcx, node);
+ node = node.next;
+ }
+
+ // Fill left holes
+ node = n.prev;
+
+ while (node.prev != null) {
+ angle = poly2tri.sweep.HoleAngle(node);
+ if (angle > poly2tri.PI_2 || angle < -(poly2tri.PI_2)) break;
+ poly2tri.sweep.Fill(tcx, node);
+ node = node.prev;
+ }
+
+ // Fill right basins
+ if (n.next != null && n.next.next != null) {
+ angle = poly2tri.sweep.BasinAngle(n);
+ if (angle < poly2tri.PI_3div4) {
+ poly2tri.sweep.FillBasin(tcx, n);
+ }
+ }
+}
+
+poly2tri.sweep.BasinAngle = function(node) {
+ var ax = node.point.x - node.next.next.point.x;
+ var ay = node.point.y - node.next.next.point.y;
+ return Math.atan2(ay, ax);
+}
+
+/**
+ *
+ * @param node - middle node
+ * @return the angle between 3 front nodes
+ */
+poly2tri.sweep.HoleAngle = function(node) {
+ /* Complex plane
+ * ab = cosA +i*sinA
+ * ab = (ax + ay*i)(bx + by*i) = (ax*bx + ay*by) + i(ax*by-ay*bx)
+ * atan2(y,x) computes the principal value of the argument function
+ * applied to the complex number x+iy
+ * Where x = ax*bx + ay*by
+ * y = ax*by - ay*bx
+ */
+ var ax = node.next.point.x - node.point.x;
+ var ay = node.next.point.y - node.point.y;
+ var bx = node.prev.point.x - node.point.x;
+ var by = node.prev.point.y - node.point.y;
+ return Math.atan2(ax * by - ay * bx, ax * bx + ay * by);
+}
+
+/**
+ * Returns true if triangle was legalized
+ */
+poly2tri.sweep.Legalize = function(tcx, t) {
+ // To legalize a triangle we start by finding if any of the three edges
+ // violate the Delaunay condition
+ for (var i=0; i < 3; ++i) {
+ if (t.delaunay_edge[i]) continue;
+
+ var ot = t.GetNeighbor(i);
+ if (ot != null) {
+ var p = t.GetPoint(i);
+ var op = ot.OppositePoint(t, p);
+ var oi = ot.Index(op);
+
+ // If this is a Constrained Edge or a Delaunay Edge(only during recursive legalization)
+ // then we should not try to legalize
+ if (ot.constrained_edge[oi] || ot.delaunay_edge[oi]) {
+ t.constrained_edge[i] = ot.constrained_edge[oi];
+ continue;
+ }
+
+ var inside = poly2tri.sweep.Incircle(p, t.PointCCW(p), t.PointCW(p), op);
+ if (inside) {
+ // Lets mark this shared edge as Delaunay
+ t.delaunay_edge[i] = true;
+ ot.delaunay_edge[oi] = true;
+
+ // Lets rotate shared edge one vertex CW to legalize it
+ poly2tri.sweep.RotateTrianglePair(t, p, ot, op);
+
+ // We now got one valid Delaunay Edge shared by two triangles
+ // This gives us 4 new edges to check for Delaunay
+
+ // Make sure that triangle to node mapping is done only one time for a specific triangle
+ var not_legalized = !poly2tri.sweep.Legalize(tcx, t);
+ if (not_legalized) {
+ tcx.MapTriangleToNodes(t);
+ }
+
+ not_legalized = !poly2tri.sweep.Legalize(tcx, ot);
+ if (not_legalized) tcx.MapTriangleToNodes(ot);
+
+ // Reset the Delaunay edges, since they only are valid Delaunay edges
+ // until we add a new triangle or point.
+ // XXX: need to think about this. Can these edges be tried after we
+ // return to previous recursive level?
+ t.delaunay_edge[i] = false;
+ ot.delaunay_edge[oi] = false;
+
+ // If triangle have been legalized no need to check the other edges since
+ // the recursive legalization will handles those so we can end here.
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+/**
+ * <b>Requirement</b>:<br>
+ * 1. a,b and c form a triangle.<br>
+ * 2. a and d is know to be on opposite side of bc<br>
+ * <pre>
+ * a
+ * +
+ * / \
+ * / \
+ * b/ \c
+ * +-------+
+ * / d \
+ * / \
+ * </pre>
+ * <b>Fact</b>: d has to be in area B to have a chance to be inside the circle formed by
+ * a,b and c<br>
+ * d is outside B if orient2d(a,b,d) or orient2d(c,a,d) is CW<br>
+ * This preknowledge gives us a way to optimize the incircle test
+ * @param pa - triangle point, opposite d
+ * @param pb - triangle point
+ * @param pc - triangle point
+ * @param pd - point opposite a
+ * @return true if d is inside circle, false if on circle edge
+ */
+poly2tri.sweep.Incircle = function(pa, pb, pc, pd) {
+ var adx = pa.x - pd.x;
+ var ady = pa.y - pd.y;
+ var bdx = pb.x - pd.x;
+ var bdy = pb.y - pd.y;
+
+ var adxbdy = adx * bdy;
+ var bdxady = bdx * ady;
+ var oabd = adxbdy - bdxady;
+
+ if (oabd <= 0) return false;
+
+ var cdx = pc.x - pd.x;
+ var cdy = pc.y - pd.y;
+
+ var cdxady = cdx * ady;
+ var adxcdy = adx * cdy;
+ var ocad = cdxady - adxcdy;
+
+ if (ocad <= 0) return false;
+
+ var bdxcdy = bdx * cdy;
+ var cdxbdy = cdx * bdy;
+
+ var alift = adx * adx + ady * ady;
+ var blift = bdx * bdx + bdy * bdy;
+ var clift = cdx * cdx + cdy * cdy;
+
+ var det = alift * (bdxcdy - cdxbdy) + blift * ocad + clift * oabd;
+ return det > 0;
+}
+
+/**
+ * Rotates a triangle pair one vertex CW
+ *<pre>
+ * n2 n2
+ * P +-----+ P +-----+
+ * | t /| |\ t |
+ * | / | | \ |
+ * n1| / |n3 n1| \ |n3
+ * | / | after CW | \ |
+ * |/ oT | | oT \|
+ * +-----+ oP +-----+
+ * n4 n4
+ * </pre>
+ */
+poly2tri.sweep.RotateTrianglePair = function(t, p, ot, op) {
+ var n1; var n2; var n3; var n4;
+ n1 = t.NeighborCCW(p);
+ n2 = t.NeighborCW(p);
+ n3 = ot.NeighborCCW(op);
+ n4 = ot.NeighborCW(op);
+
+ var ce1; var ce2; var ce3; var ce4;
+ ce1 = t.GetConstrainedEdgeCCW(p);
+ ce2 = t.GetConstrainedEdgeCW(p);
+ ce3 = ot.GetConstrainedEdgeCCW(op);
+ ce4 = ot.GetConstrainedEdgeCW(op);
+
+ var de1; var de2; var de3; var de4;
+ de1 = t.GetDelaunayEdgeCCW(p);
+ de2 = t.GetDelaunayEdgeCW(p);
+ de3 = ot.GetDelaunayEdgeCCW(op);
+ de4 = ot.GetDelaunayEdgeCW(op);
+
+ t.Legalize(p, op);
+ ot.Legalize(op, p);
+
+ // Remap delaunay_edge
+ ot.SetDelaunayEdgeCCW(p, de1);
+ t.SetDelaunayEdgeCW(p, de2);
+ t.SetDelaunayEdgeCCW(op, de3);
+ ot.SetDelaunayEdgeCW(op, de4);
+
+ // Remap constrained_edge
+ ot.SetConstrainedEdgeCCW(p, ce1);
+ t.SetConstrainedEdgeCW(p, ce2);
+ t.SetConstrainedEdgeCCW(op, ce3);
+ ot.SetConstrainedEdgeCW(op, ce4);
+
+ // Remap neighbors
+ // XXX: might optimize the markNeighbor by keeping track of
+ // what side should be assigned to what neighbor after the
+ // rotation. Now mark neighbor does lots of testing to find
+ // the right side.
+ t.ClearNeigbors();
+ ot.ClearNeigbors();
+ if (n1) ot.MarkNeighbor(n1);
+ if (n2) t.MarkNeighbor(n2);
+ if (n3) t.MarkNeighbor(n3);
+ if (n4) ot.MarkNeighbor(n4);
+ t.MarkNeighbor(ot);
+}
+
+/**
+ * Fills a basin that has formed on the Advancing Front to the right
+ * of given node.<br>
+ * First we decide a left,bottom and right node that forms the
+ * boundaries of the basin. Then we do a reqursive fill.
+ *
+ * @param tcx
+ * @param node - starting node, this or next node will be left node
+ */
+poly2tri.sweep.FillBasin = function(tcx, node) {
+ if (poly2tri.Orient2d(node.point, node.next.point, node.next.next.point) == poly2tri.Orientation.CCW) {
+ tcx.basin.left_node = node.next.next;
+ } else {
+ tcx.basin.left_node = node.next;
+ }
+
+ // Find the bottom and right node
+ tcx.basin.bottom_node = tcx.basin.left_node;
+ while (tcx.basin.bottom_node.next != null && tcx.basin.bottom_node.point.y >= tcx.basin.bottom_node.next.point.y) {
+ tcx.basin.bottom_node = tcx.basin.bottom_node.next;
+ }
+ if (tcx.basin.bottom_node == tcx.basin.left_node) {
+ // No valid basin
+ return;
+ }
+
+ tcx.basin.right_node = tcx.basin.bottom_node;
+ while (tcx.basin.right_node.next != null && tcx.basin.right_node.point.y < tcx.basin.right_node.next.point.y) {
+ tcx.basin.right_node = tcx.basin.right_node.next;
+ }
+ if (tcx.basin.right_node == tcx.basin.bottom_node) {
+ // No valid basins
+ return;
+ }
+
+ tcx.basin.width = tcx.basin.right_node.point.x - tcx.basin.left_node.point.x;
+ tcx.basin.left_highest = tcx.basin.left_node.point.y > tcx.basin.right_node.point.y;
+
+ poly2tri.sweep.FillBasinReq(tcx, tcx.basin.bottom_node);
+}
+
+/**
+ * Recursive algorithm to fill a Basin with triangles
+ *
+ * @param tcx
+ * @param node - bottom_node
+ */
+poly2tri.sweep.FillBasinReq = function(tcx, node) {
+ // if shallow stop filling
+ if (poly2tri.sweep.IsShallow(tcx, node)) {
+ return;
+ }
+
+ poly2tri.sweep.Fill(tcx, node);
+
+ var o;
+ if (node.prev == tcx.basin.left_node && node.next == tcx.basin.right_node) {
+ return;
+ } else if (node.prev == tcx.basin.left_node) {
+ o = poly2tri.Orient2d(node.point, node.next.point, node.next.next.point);
+ if (o == poly2tri.Orientation.CW) {
+ return;
+ }
+ node = node.next;
+ } else if (node.next == tcx.basin.right_node) {
+ o = poly2tri.Orient2d(node.point, node.prev.point, node.prev.prev.point);
+ if (o == poly2tri.Orientation.CCW) {
+ return;
+ }
+ node = node.prev;
+ } else {
+ // Continue with the neighbor node with lowest Y value
+ if (node.prev.point.y < node.next.point.y) {
+ node = node.prev;
+ } else {
+ node = node.next;
+ }
+ }
+
+ poly2tri.sweep.FillBasinReq(tcx, node);
+}
+
+poly2tri.sweep.IsShallow = function(tcx, node) {
+ var height;
+ if (tcx.basin.left_highest) {
+ height = tcx.basin.left_node.point.y - node.point.y;
+ } else {
+ height = tcx.basin.right_node.point.y - node.point.y;
+ }
+
+ // if shallow stop filling
+ if (tcx.basin.width > height) {
+ return true;
+ }
+ return false;
+}
+
+poly2tri.sweep.FillEdgeEvent = function(tcx, edge, node) {
+ if (tcx.edge_event.right) {
+ poly2tri.sweep.FillRightAboveEdgeEvent(tcx, edge, node);
+ } else {
+ poly2tri.sweep.FillLeftAboveEdgeEvent(tcx, edge, node);
+ }
+}
+
+poly2tri.sweep.FillRightAboveEdgeEvent = function(tcx, edge, node) {
+ while (node.next.point.x < edge.p.x) {
+ // Check if next node is below the edge
+ if (poly2tri.Orient2d(edge.q, node.next.point, edge.p) == poly2tri.Orientation.CCW) {
+ poly2tri.sweep.FillRightBelowEdgeEvent(tcx, edge, node);
+ } else {
+ node = node.next;
+ }
+ }
+}
+
+poly2tri.sweep.FillRightBelowEdgeEvent = function(tcx, edge, node) {
+ if (node.point.x < edge.p.x) {
+ if (poly2tri.Orient2d(node.point, node.next.point, node.next.next.point) == poly2tri.Orientation.CCW) {
+ // Concave
+ poly2tri.sweep.FillRightConcaveEdgeEvent(tcx, edge, node);
+ } else{
+ // Convex
+ poly2tri.sweep.FillRightConvexEdgeEvent(tcx, edge, node);
+ // Retry this one
+ poly2tri.sweep.FillRightBelowEdgeEvent(tcx, edge, node);
+ }
+ }
+}
+
+poly2tri.sweep.FillRightConcaveEdgeEvent = function(tcx, edge, node) {
+ poly2tri.sweep.Fill(tcx, node.next);
+ if (node.next.point != edge.p) {
+ // Next above or below edge?
+ ...
[truncated message content] |
|
From: <ma...@us...> - 2011-12-15 18:24:54
|
Revision: 576
http://openautomation.svn.sourceforge.net/openautomation/?rev=576&view=rev
Author: mayerch
Date: 2011-12-15 18:24:48 +0000 (Thu, 15 Dec 2011)
Log Message:
-----------
Fix id (couldn't be valid XML otherwise...)
Modified Paths:
--------------
JSFloorPlan/trunk/floorplan01.xml
Modified: JSFloorPlan/trunk/floorplan01.xml
===================================================================
--- JSFloorPlan/trunk/floorplan01.xml 2011-12-13 15:35:00 UTC (rev 575)
+++ JSFloorPlan/trunk/floorplan01.xml 2011-12-15 18:24:48 UTC (rev 576)
@@ -41,7 +41,7 @@
<wall start="12" end="1" thickness=".24" />
<wall start="2" end="13" thickness=".10" />
<wall start="12" end="13" thickness=".10">
- <hole id="door01" distance="0.5" width="0.88" paparet="0.0" lintel="0.2" />
+ <hole id="door02" distance="0.5" width="0.88" paparet="0.0" lintel="0.2" />
</wall>
<wall start="13" end="14" thickness=".10" />
<wall start="14" end="4" thickness=".10" endoffset="-.07" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2011-12-13 15:35:10
|
Revision: 575
http://openautomation.svn.sourceforge.net/openautomation/?rev=575&view=rev
Author: mayerch
Date: 2011-12-13 15:35:00 +0000 (Tue, 13 Dec 2011)
Log Message:
-----------
Added inital support for textures
Modified Paths:
--------------
JSFloorPlan/trunk/jsfloorplan.js
JSFloorPlan/trunk/jsfloorplan_example_helper.js
Added Paths:
-----------
JSFloorPlan/trunk/media/
JSFloorPlan/trunk/media/demo_texture_512x512.png
Modified: JSFloorPlan/trunk/jsfloorplan.js
===================================================================
--- JSFloorPlan/trunk/jsfloorplan.js 2011-12-13 12:43:52 UTC (rev 574)
+++ JSFloorPlan/trunk/jsfloorplan.js 2011-12-13 15:35:00 UTC (rev 575)
@@ -315,9 +315,13 @@
{
// Add the wall sides
geometry.faces.push(new THREE.Face3( 2, 3, 0 ));
+ geometry.faceVertexUvs[0].push([ new THREE.UV(1,1), new THREE.UV(1,0), new THREE.UV(0,1) ]);
geometry.faces.push(new THREE.Face3( 1, 0, 3 ));
+ geometry.faceVertexUvs[0].push([ new THREE.UV(0,0), new THREE.UV(0,1), new THREE.UV(1,0) ]);
geometry.faces.push(new THREE.Face3( 5, 6, 7 ));
+ geometry.faceVertexUvs[0].push([ new THREE.UV(1,1), new THREE.UV(1,0), new THREE.UV(0,1) ]);
geometry.faces.push(new THREE.Face3( 8, 7, 6 ));
+ geometry.faceVertexUvs[0].push([ new THREE.UV(0,0), new THREE.UV(0,1), new THREE.UV(1,0) ]);
// Add the wall tops
geometry.faces.push(new THREE.Face3( 1, 6, 9 ));
geometry.faces.push(new THREE.Face3( 6, 1, 3 ));
@@ -326,9 +330,13 @@
} else {
// Add the wall sides
geometry.faces.push(new THREE.Face3( 2, 0, 3 ));
+ geometry.faceVertexUvs[0].push([ new THREE.UV(0,1), new THREE.UV(1,1), new THREE.UV(0,0) ]);
geometry.faces.push(new THREE.Face3( 1, 3, 0 ));
+ geometry.faceVertexUvs[0].push([ new THREE.UV(1,0), new THREE.UV(0,0), new THREE.UV(1,1) ]);
geometry.faces.push(new THREE.Face3( 5, 7, 6 ));
+ geometry.faceVertexUvs[0].push([ new THREE.UV(0,1), new THREE.UV(1,1), new THREE.UV(0,0) ]);
geometry.faces.push(new THREE.Face3( 8, 6, 7 ));
+ geometry.faceVertexUvs[0].push([ new THREE.UV(1,0), new THREE.UV(0,0), new THREE.UV(1,1) ]);
// Add the wall tops
geometry.faces.push(new THREE.Face3( 1, 9, 6 ));
geometry.faces.push(new THREE.Face3( 6, 3, 1 ));
Modified: JSFloorPlan/trunk/jsfloorplan_example_helper.js
===================================================================
--- JSFloorPlan/trunk/jsfloorplan_example_helper.js 2011-12-13 12:43:52 UTC (rev 574)
+++ JSFloorPlan/trunk/jsfloorplan_example_helper.js 2011-12-13 15:35:00 UTC (rev 575)
@@ -113,6 +113,8 @@
cube.position = new THREE.Vector3(50,50,50);
//scene.add( cube );
+cubeMaterial = new THREE.MeshBasicMaterial({ map: THREE.ImageUtils.loadTexture( 'media/demo_texture_512x512.png' ) });
+
var lineMaterial = new THREE.LineBasicMaterial( { color: 0x0099ff, linewidth: 2 } );
// create a point light
Added: JSFloorPlan/trunk/media/demo_texture_512x512.png
===================================================================
(Binary files differ)
Property changes on: JSFloorPlan/trunk/media/demo_texture_512x512.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2011-12-13 12:44:03
|
Revision: 574
http://openautomation.svn.sourceforge.net/openautomation/?rev=574&view=rev
Author: mayerch
Date: 2011-12-13 12:43:52 +0000 (Tue, 13 Dec 2011)
Log Message:
-----------
Increase compatability for Opera with 2D pages
Modified Paths:
--------------
CometVisu/trunk/visu/designs/structure_pure.js
Modified: CometVisu/trunk/visu/designs/structure_pure.js
===================================================================
--- CometVisu/trunk/visu/designs/structure_pure.js 2011-12-12 22:08:51 UTC (rev 573)
+++ CometVisu/trunk/visu/designs/structure_pure.js 2011-12-13 12:43:52 UTC (rev 574)
@@ -97,7 +97,7 @@
container.append( '<h1>' + name + '</h1>' );
if( '2d' == type )
{
- container.append( '<embed src="' + backdrop + '" style="position: absolute; top: 0px; left: 0px;z-index:-1;"/>' );
+ container.append( '<embed src="' + backdrop + '" style="position: absolute; top: 0px; left: 0px;z-index:-1;width:100%;height:100%;"/>' );
}
$( childs ).each( function(i){
container.append( create_pages( childs[i], path + '_' + i, flavour ) );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2011-12-12 22:08:57
|
Revision: 573
http://openautomation.svn.sourceforge.net/openautomation/?rev=573&view=rev
Author: mayerch
Date: 2011-12-12 22:08:51 +0000 (Mon, 12 Dec 2011)
Log Message:
-----------
Fix wrong vertex order so that wall tops will seem solid again
Modified Paths:
--------------
JSFloorPlan/trunk/jsfloorplan.js
Modified: JSFloorPlan/trunk/jsfloorplan.js
===================================================================
--- JSFloorPlan/trunk/jsfloorplan.js 2011-12-12 19:12:30 UTC (rev 572)
+++ JSFloorPlan/trunk/jsfloorplan.js 2011-12-12 22:08:51 UTC (rev 573)
@@ -299,10 +299,10 @@
//geometry.faceVertexUvs[0].push([
// new THREE.UV(u_value, v_value)), new THREE.UV(u_value, v_value)), new THREE.UV(u_value, v_value))
//]);
+ geometry.vertices.push(new THREE.Vertex(new THREE.Vector3(s1.x,s1.y,heightOfGround )));
+ geometry.vertices.push(new THREE.Vertex(new THREE.Vector3(s1.x,s1.y,heightOfGround + sh)));
geometry.vertices.push(new THREE.Vertex(new THREE.Vector3(e1.x,e1.y,heightOfGround )));
geometry.vertices.push(new THREE.Vertex(new THREE.Vector3(e1.x,e1.y,heightOfGround + sh)));
- geometry.vertices.push(new THREE.Vertex(new THREE.Vector3(s1.x,s1.y,heightOfGround )));
- geometry.vertices.push(new THREE.Vertex(new THREE.Vector3(s1.x,s1.y,heightOfGround + sh)));
geometry.vertices.push(new THREE.Vertex(new THREE.Vector3(sm.x,sm.y,heightOfGround + sh)));
geometry.vertices.push(new THREE.Vertex(new THREE.Vector3(s2.x,s2.y,heightOfGround )));
@@ -314,26 +314,26 @@
if( wallSideOrder < 0 )
{
// Add the wall sides
- geometry.faces.push(new THREE.Face3( 0, 1, 2 ));
- geometry.faces.push(new THREE.Face3( 3, 2, 1 ));
+ geometry.faces.push(new THREE.Face3( 2, 3, 0 ));
+ geometry.faces.push(new THREE.Face3( 1, 0, 3 ));
geometry.faces.push(new THREE.Face3( 5, 6, 7 ));
geometry.faces.push(new THREE.Face3( 8, 7, 6 ));
// Add the wall tops
- geometry.faces.push(new THREE.Face3( 4, 3, 6 ));
- geometry.faces.push(new THREE.Face3( 1, 6, 3 ));
- geometry.faces.push(new THREE.Face3( 6, 1, 8 ));
- geometry.faces.push(new THREE.Face3( 9, 8, 1 ));
+ geometry.faces.push(new THREE.Face3( 1, 6, 9 ));
+ geometry.faces.push(new THREE.Face3( 6, 1, 3 ));
+ geometry.faces.push(new THREE.Face3( 6, 3, 8 ));
+ geometry.faces.push(new THREE.Face3( 4, 8, 3 ));
} else {
// Add the wall sides
- geometry.faces.push(new THREE.Face3( 0, 2, 1 ));
- geometry.faces.push(new THREE.Face3( 3, 1, 2 ));
+ geometry.faces.push(new THREE.Face3( 2, 0, 3 ));
+ geometry.faces.push(new THREE.Face3( 1, 3, 0 ));
geometry.faces.push(new THREE.Face3( 5, 7, 6 ));
geometry.faces.push(new THREE.Face3( 8, 6, 7 ));
// Add the wall tops
- geometry.faces.push(new THREE.Face3( 4, 6, 3 ));
- geometry.faces.push(new THREE.Face3( 1, 3, 6 ));
- geometry.faces.push(new THREE.Face3( 6, 8, 1 ));
- geometry.faces.push(new THREE.Face3( 9, 1, 8 ));
+ geometry.faces.push(new THREE.Face3( 1, 9, 6 ));
+ geometry.faces.push(new THREE.Face3( 6, 3, 1 ));
+ geometry.faces.push(new THREE.Face3( 6, 8, 3 ));
+ geometry.faces.push(new THREE.Face3( 8, 4, 3 ));
}
geometry.computeFaceNormals();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <j-...@us...> - 2011-12-12 19:12:39
|
Revision: 572
http://openautomation.svn.sourceforge.net/openautomation/?rev=572&view=rev
Author: j-n-k
Date: 2011-12-12 19:12:30 +0000 (Mon, 12 Dec 2011)
Log Message:
-----------
Inital commit plugin: jsonviewer
Added Paths:
-----------
CometVisu/trunk/visu/plugins/jsonviewer/
CometVisu/trunk/visu/plugins/jsonviewer/structure_plugin.js
Added: CometVisu/trunk/visu/plugins/jsonviewer/structure_plugin.js
===================================================================
--- CometVisu/trunk/visu/plugins/jsonviewer/structure_plugin.js (rev 0)
+++ CometVisu/trunk/visu/plugins/jsonviewer/structure_plugin.js 2011-12-12 19:12:30 UTC (rev 572)
@@ -0,0 +1,83 @@
+/* structure_plugin.js (c) 2011 by Jan N. Klug
+ *
+ * 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
+*/
+
+/**
+ * This plugins views json-feeds
+ */
+
+ VisuDesign_Custom.prototype.addCreator('jsonviewer', {
+ maturity: Maturity.development,
+ create: function( page, path ) {
+ var $p = $(page);
+ var ret_val = $('<div class="widget text" />');
+ var style = '';
+
+ if( style != '' ) style = 'style="' + style + '"';
+ var json = $('<div class="value">-</div>');
+ var refresh = $p.attr('refresh') || 30; // default 30s
+
+ json.data("src", $p.attr('src'));
+ json.data("refresh", refresh);
+ json.data("view", $p.attr('view')); // default alles
+ json.data("idx", 0);
+
+ var data = jQuery.extend({}, json.data());
+ ret_val.append(json);
+
+
+
+ refreshjson(json, data);
+ return ret_val;
+ },
+ attributes: {
+ src: { type: 'string', required: true },
+ refresh: { type: 'numeric', required: false }
+ },
+ elements: {
+ },
+ content: false
+});
+
+function refreshjson(e,data) {
+ var element = $(e);
+ var tmp = $.getJSON(data.src, function(json) {
+ var content = '';
+ var feed = json.responseData.feed;
+ var feedlength = feed.entries.length;
+ var viewnum = data.view;
+ if (viewnum > feedlength) { // max is number of entries
+ viewnum = feedlength;
+ }
+ for (var i=0; i<viewnum; i++) {
+ var showidx = i + data.idx;
+ if (showidx >= feedlength) {
+ showidx = showidx - feedlength;
+ }
+ content += ""+feed.entries[showidx].content + "<br>";
+ };
+ element.html(content);
+ if (data.idx >= feedlength) {
+ data.idx=0;
+ } else {
+ data.idx = data.idx+1;
+ }
+ });
+ var tmp2=0;
+ window.setTimeout(function(element, data) {
+ refreshjson(element, data)
+ }, data.refresh * 1000, element, data);
+};
\ No newline at end of file
Property changes on: CometVisu/trunk/visu/plugins/jsonviewer/structure_plugin.js
___________________________________________________________________
Added: svn:executable
+ *
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <j-...@us...> - 2011-12-12 17:46:19
|
Revision: 571
http://openautomation.svn.sourceforge.net/openautomation/?rev=571&view=rev
Author: j-n-k
Date: 2011-12-12 17:46:08 +0000 (Mon, 12 Dec 2011)
Log Message:
-----------
Fixed error in diagram_info update-function
Modified Paths:
--------------
CometVisu/trunk/visu/plugins/diagram/structure_plugin.js
Modified: CometVisu/trunk/visu/plugins/diagram/structure_plugin.js
===================================================================
--- CometVisu/trunk/visu/plugins/diagram/structure_plugin.js 2011-12-12 17:32:32 UTC (rev 570)
+++ CometVisu/trunk/visu/plugins/diagram/structure_plugin.js 2011-12-12 17:46:08 UTC (rev 571)
@@ -305,7 +305,11 @@
return ret_val;
},
- update: defaultUpdate,
+ update: function(e,d) {
+ var element = $(this);
+ var value = defaultUpdate( e, d, element );
+ element.addClass('switchUnpressed');
+ },
attributes: {
rrd: {type: "string", required: true},
unit: {type: "string", required: false},
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2011-12-12 17:32:41
|
Revision: 570
http://openautomation.svn.sourceforge.net/openautomation/?rev=570&view=rev
Author: mayerch
Date: 2011-12-12 17:32:32 +0000 (Mon, 12 Dec 2011)
Log Message:
-----------
Due to the new jQuery version it's not necessary anymore to embed it in the SVG.
Modified Paths:
--------------
CometVisu/trunk/visu/media/demo_2d_backdrop_red_pot.svg
Modified: CometVisu/trunk/visu/media/demo_2d_backdrop_red_pot.svg
===================================================================
--- CometVisu/trunk/visu/media/demo_2d_backdrop_red_pot.svg 2011-12-12 17:23:11 UTC (rev 569)
+++ CometVisu/trunk/visu/media/demo_2d_backdrop_red_pot.svg 2011-12-12 17:32:32 UTC (rev 570)
@@ -15,13 +15,7 @@
<!--
<script xlink:href="../lib/jquery.js" type="text/javascript"></script>
-->
- <script type="application/javascript"><![CDATA[
-/*! jQuery v1.6.4 http://jquery.com/ | http://jquery.org/license */
-(function(a,b){function cu(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cr(a){if(!cg[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){ch||(ch=c.createElement("iframe"),ch.frameBorder=ch.width=ch.height=0),b.appendChild(ch);if(!ci||!ch.createElement)ci=(ch.contentWindow||ch.contentDocument).document,ci.write((c.compatMode==="CSS1Compat"?"<!doctype html>":"")+"<html><body>"),ci.close();d=ci.createElement(a),ci.body.appendChild(d),e=f.css(d,"display"),b.removeChild(ch)}cg[a]=e}return cg[a]}function cq(a,b){var c={};f.each(cm.concat.apply([],cm.slice(0,b)),function(){c[this]=a});return c}function cp(){cn=b}function co(){setTimeout(cp,0);return cn=f.now()}function cf(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ce(){try{return new a.XMLHttpRequest}catch(b){}}function b$(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function bZ(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function bY(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bA.test(a)?d(a,e):bY(a+"["+(typeof e=="object"||f.isArray(e)?b:"")+"]",e,c,d)});else if(!c&&b!=null&&typeof b=="object")for(var e in b)bY(a+"["+e+"]",b[e],c,d);else d(a,b)}function bX(a,c){var d,e,g=f.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((g[d]?a:e||(e={}))[d]=c[d]);e&&f.extend(!0,a,e)}function bW(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bP,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=bW(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=bW(a,c,d,e,"*",g));return l}function bV(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bL),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function by(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=b==="width"?bt:bu;if(d>0){c!=="border"&&f.each(e,function(){c||(d-=parseFloat(f.css(a,"padding"+this))||0),c==="margin"?d+=parseFloat(f.css(a,c+this))||0:d-=parseFloat(f.css(a,"border"+this+"Width"))||0});return d+"px"}d=bv(a,b,b);if(d<0||d==null)d=a.style[b]||0;d=parseFloat(d)||0,c&&f.each(e,function(){d+=parseFloat(f.css(a,"padding"+this))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+this+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+this))||0)});return d+"px"}function bl(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bd,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function bk(a){f.nodeName(a,"input")?bj(a):"getElementsByTagName"in a&&f.grep(a.getElementsByTagName("input"),bj)}function bj(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bi(a){return"getElementsByTagName"in a?a.getElementsByTagName("*"):"querySelectorAll"in a?a.querySelectorAll("*"):[]}function bh(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(f.expando)}}function bg(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c=f.expando,d=f.data(a),e=f.data(b,d);if(d=d[c]){var g=d.events;e=e[c]=f.extend({},d);if(g){delete e.handle,e.events={};for(var h in g)for(var i=0,j=g[h].length;i<j;i++)f.event.add(b,h+(g[h][i].namespace?".":"")+g[h][i].namespace,g[h][i],g[h][i].data)}}}}function bf(a,b){return f.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function V(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=f.grep(a,function(a){return a.nodeType===1});if(Q.test(b))return f.filter(b,d,!c);b=f.filter(b,d)}return f.grep(a,function(a,d){return f.inArray(a,b)>=0===c})}function U(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function M(a,b){return(a&&a!=="*"?a+".":"")+b.replace(y,"`").replace(z,"&")}function L(a){var b,c,d,e,g,h,i,j,k,l,m,n,o,p=[],q=[],r=f._data(this,"events");if(!(a.liveFired===this||!r||!r.live||a.target.disabled||a.button&&a.type==="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var s=r.live.slice(0);for(i=0;i<s.length;i++)g=s[i],g.origType.replace(w,"")===a.type?q.push(g.selector):s.splice(i--,1);e=f(a.target).closest(q,a.currentTarget);for(j=0,k=e.length;j<k;j++){m=e[j];for(i=0;i<s.length;i++){g=s[i];if(m.selector===g.selector&&(!n||n.test(g.namespace))&&!m.elem.disabled){h=m.elem,d=null;if(g.preType==="mouseenter"||g.preType==="mouseleave")a.type=g.preType,d=f(a.relatedTarget).closest(g.selector)[0],d&&f.contains(h,d)&&(d=h);(!d||d!==h)&&p.push({elem:h,handleObj:g,level:m.level})}}}for(j=0,k=p.length;j<k;j++){e=p[j];if(c&&e.level>c)break;a.currentTarget=e.elem,a.data=e.handleObj.data,a.handleObj=e.handleObj,o=e.handleObj.origHandler.apply(e.elem,arguments);if(o===!1||a.isPropagationStopped()){c=e.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function J(a,c,d){var e=f.extend({},d[0]);e.type=a,e.originalEvent={},e.liveFired=b,f.event.handle.call(c,e),e.isDefaultPrevented()&&d[0].preventDefault()}function D(){return!0}function C(){return!1}function m(a,c,d){var e=c+"defer",g=c+"queue",h=c+"mark",i=f.data(a,e,b,!0);i&&(d==="queue"||!f.data(a,g,b,!0))&&(d==="mark"||!f.data(a,h,b,!0))&&setTimeout(function(){!f.data(a,g,b,!0)&&!f.data(a,h,b,!0)&&(f.removeData(a,e,!0),i.resolve())},0)}function l(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function k(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(j,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNaN(d)?i.test(d)?f.parseJSON(d):d:parseFloat(d)}catch(g){}f.data(a,c,d)}else d=b}return d}var c=a.document,d=a.navigator,e=a.location,f=function(){function K(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(K,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/\d/,n=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,o=/^[\],:{}\s]*$/,p=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,q=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,r=/(?:^|:|,)(?:\s*\[)+/g,s=/(webkit)[ \/]([\w.]+)/,t=/(opera)(?:.*version)?[ \/]([\w.]+)/,u=/(msie) ([\w.]+)/,v=/(mozilla)(?:.*? rv:([\w.]+))?/,w=/-([a-z]|[0-9])/ig,x=/^-ms-/,y=function(a,b){return(b+"").toUpperCase()},z=d.userAgent,A,B,C,D=Object.prototype.toString,E=Object.prototype.hasOwnProperty,F=Array.prototype.push,G=Array.prototype.slice,H=String.prototype.trim,I=Array.prototype.indexOf,J={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=n.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.6.4",length:0,size:function(){return this.length},toArray:function(){return G.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?F.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),B.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(G.apply(this,arguments),"slice",G.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:F,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){d=i[c],f=a[c];if(i===f)continue;l&&f&&(e.isPlainObject(f)||(g=e.isArray(f)))?(g?(g=!1,h=d&&e.isArray(d)?d:[]):h=d&&e.isPlainObject(d)?d:{},i[c]=e.extend(l,h,f)):f!==b&&(i[c]=f)}return i},e.extend({noConflict:function(b){a.$===e&&(a.$=g),b&&a.jQuery===e&&(a.jQuery=f);return e},isReady:!1,readyWait:1,holdReady:function(a){a?e.readyWait++:e.ready(!0)},ready:function(a){if(a===!0&&!--e.readyWait||a!==!0&&!e.isReady){if(!c.body)return setTimeout(e.ready,1);e.isReady=!0;if(a!==!0&&--e.readyWait>0)return;B.resolveWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!B){B=e._Deferred();if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",C,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",C),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&K()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNaN:function(a){return a==null||!m.test(a)||isNaN(a)},type:function(a){return a==null?String(a):J[D.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!E.call(a,"constructor")&&!E.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||E.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(o.test(b.replace(p,"@").replace(q,"]").replace(r,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(x,"ms-").replace(w,y)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g<h;)if(c.apply(a[g++],d)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(;g<h;)if(c.call(a[g],g,a[g++])===!1)break;return a},trim:H?function(a){return a==null?"":H.call(a)}:function(a){return a==null?"":(a+"").replace(k,"").replace(l,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var d=e.type(a);a.length==null||d==="string"||d==="function"||d==="regexp"||e.isWindow(a)?F.call(c,a):e.merge(c,a)}return c},inArray:function(a,b){if(!b)return-1;if(I)return I.call(b,a);for(var c=0,d=b.length;c<d;c++)if(b[c]===a)return c;return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length=="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,d){var f,g,h=[],i=0,j=a.length,k=a instanceof e||j!==b&&typeof j=="number"&&(j>0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,d),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,d),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c=="string"){var d=a[c];c=a,a=d}if(!e.isFunction(a))return b;var f=G.call(arguments,2),g=function(){return a.apply(c,f.concat(G.call(arguments)))};g.guid=a.guid=a.guid||g.guid||e.guid++;return g},access:function(a,c,d,f,g,h){var i=a.length;if(typeof c=="object"){for(var j in c)e.access(a,j,c[j],f,g,d);return a}if(d!==b){f=!h&&f&&e.isFunction(d);for(var k=0;k<i;k++)g(a[k],c,f?d.call(a[k],k,g(a[k],c)):d,h);return a}return i?g(a[0],c):b},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=s.exec(a)||t.exec(a)||u.exec(a)||a.indexOf("compatible")<0&&v.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}e.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(d,f){f&&f instanceof e&&!(f instanceof a)&&(f=a(f));return e.fn.init.call(this,d,f,b)},a.fn.init.prototype=a.fn;var b=a(c);return a},browser:{}}),e.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){J["[object "+b+"]"]=b.toLowerCase()}),A=e.uaMatch(z),A.browser&&(e.browser[A.browser]=!0,e.browser.version=A.version),e.browser.webkit&&(e.browser.safari=!0),j.test(" ")&&(k=/^[\s\xA0]+/,l=/[\s\xA0]+$/),h=e(c),c.addEventListener?C=function(){c.removeEventListener("DOMContentLoaded",C,!1),e.ready()}:c.attachEvent&&(C=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",C),e.ready())});return e}(),g="done fail isResolved isRejected promise then always pipe".split(" "),h=[].slice;f.extend({_Deferred:function(){var a=[],b,c,d,e={done:function(){if(!d){var c=arguments,g,h,i,j,k;b&&(k=b,b=0);for(g=0,h=c.length;g<h;g++)i=c[g],j=f.type(i),j==="array"?e.done.apply(e,i):j==="function"&&a.push(i);k&&e.resolveWith(k[0],k[1])}return this},resolveWith:function(e,f){if(!d&&!b&&!c){f=f||[],c=1;try{while(a[0])a.shift().apply(e,f)}finally{b=[e,f],c=0}}return this},resolve:function(){e.resolveWith(this,arguments);return this},isResolved:function(){return!!c||!!b},cancel:function(){d=1,a=[];return this}};return e},Deferred:function(a){var b=f._Deferred(),c=f._Deferred(),d;f.extend(b,{then:function(a,c){b.done(a).fail(c);return this},always:function(){return b.done.apply(b,arguments).fail.apply(this,arguments)},fail:c.done,rejectWith:c.resolveWith,reject:c.resolve,isRejected:c.isResolved,pipe:function(a,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[c,"reject"]},function(a,c){var e=c[0],g=c[1],h;f.isFunction(e)?b[a](function(){h=e.apply(this,arguments),h&&f.isFunction(h.promise)?h.promise().then(d.resolve,d.reject):d[g+"With"](this===b?d:this,[h])}):b[a](d[g])})}).promise()},promise:function(a){if(a==null){if(d)return d;d=a={}}var c=g.length;while(c--)a[g[c]]=b[g[c]];return a}}),b.done(c.cancel).fail(b.cancel),delete b.cancel,a&&a.call(b,b);return b},when:function(a){function i(a){return function(c){b[a]=arguments.length>1?h.call(arguments,0):c,--e||g.resolveWith(g,h.call(b,0))}}var b=arguments,c=0,d=b.length,e=d,g=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred();if(d>1){for(;c<d;c++)b[c]&&f.isFunction(b[c].promise)?b[c].promise().then(i(c),g.reject):--e;e||g.resolveWith(g,b)}else g!==a&&g.resolveWith(g,d?[a]:[]);return g.promise()}}),f.support=function(){var a=c.createElement("div"),b=c.documentElement,d,e,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;a.setAttribute("className","t"),a.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",d=a.getElementsByTagName("*"),e=a.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=a.getElementsByTagName("input")[0],k={leadingWhitespace:a.firstChild.nodeType===3,tbody:!a.getElementsByTagName("tbody").length,htmlSerialize:!!a.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55$/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:a.className!=="t",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,k.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,k.optDisabled=!h.disabled;try{delete a.test}catch(v){k.deleteExpando=!1}!a.addEventListener&&a.attachEvent&&a.fireEvent&&(a.attachEvent("onclick",function(){k.noCloneEvent=!1}),a.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),k.radioValue=i.value==="t",i.setAttribute("checked","checked"),a.appendChild(i),l=c.createDocumentFragment(),l.appendChild(a.firstChild),k.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,a.innerHTML="",a.style.width=a.style.paddingLeft="1px",m=c.getElementsByTagName("body")[0],o=c.createElement(m?"div":"body"),p={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},m&&f.extend(p,{position:"absolute",left:"-1000px",top:"-1000px"});for(t in p)o.style[t]=p[t];o.appendChild(a),n=m||b,n.insertBefore(o,n.firstChild),k.appendChecked=i.checked,k.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,k.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="<div style='width:4px;'></div>",k.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>",q=a.getElementsByTagName("td"),u=q[0].offsetHeight===0,q[0].style.display="",q[1].style.display="none",k.reliableHiddenOffsets=u&&q[0].offsetHeight===0,a.innerHTML="",c.defaultView&&c.defaultView.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",a.appendChild(j),k.reliableMarginRight=(parseInt((c.defaultView.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0),o.innerHTML="",n.removeChild(o);if(a.attachEvent)for(t in{submit:1,change:1,focusin:1})s="on"+t,u=s in a,u||(a.setAttribute(s,"return;"),u=typeof a[s]=="function"),k[t+"Bubbles"]=u;o=l=g=h=m=j=a=i=null;return k}(),f.boxModel=f.support.boxModel;var i=/^(?:\{.*\}|\[.*\])$/,j=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!l(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i=f.expando,j=typeof c=="string",k=a.nodeType,l=k?f.cache:a,m=k?a[f.expando]:a[f.expando]&&f.expando;if((!m||e&&m&&l[m]&&!l[m][i])&&j&&d===b)return;m||(k?a[f.expando]=m=++f.uuid:m=f.expando),l[m]||(l[m]={},k||(l[m].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?l[m][i]=f.extend(l[m][i],c):l[m]=f.extend(l[m],c);g=l[m],e&&(g[i]||(g[i]={}),g=g[i]),d!==b&&(g[f.camelCase(c)]=d);if(c==="events"&&!g[c])return g[i]&&g[i].events;j?(h=g[c],h==null&&(h=g[f.camelCase(c)])):h=g;return h}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e=f.expando,g=a.nodeType,h=g?f.cache:a,i=g?a[f.expando]:f.expando;if(!h[i])return;if(b){d=c?h[i][e]:h[i];if(d){d[b]||(b=f.camelCase(b)),delete d[b];if(!l(d))return}}if(c){delete h[i][e];if(!l(h[i]))return}var j=h[i][e];f.support.deleteExpando||!h.setInterval?delete h[i]:h[i]=null,j?(h[i]={},g||(h[i].toJSON=f.noop),h[i][e]=j):g&&(f.support.deleteExpando?delete a[f.expando]:a.removeAttribute?a.removeAttribute(f.expando):a[f.expando]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d=null;if(typeof a=="undefined"){if(this.length){d=f.data(this[0]);if(this[0].nodeType===1){var e=this[0].attributes,g;for(var h=0,i=e.length;h<i;h++)g=e[h].name,g.indexOf("data-")===0&&(g=f.camelCase(g.substring(5)),k(this[0],g,d[g]))}}return d}if(typeof a=="object")return this.each(function(){f.data(this,a)});var j=a.split(".");j[1]=j[1]?"."+j[1]:"";if(c===b){d=this.triggerHandler("getData"+j[1]+"!",[j[0]]),d===b&&this.length&&(d=f.data(this[0],a),d=k(this[0],a,d));return d===b&&j[1]?this.data(j[0]):d}return this.each(function(){var b=f(this),d=[j[0],c];b.triggerHandler("setData"+j[1]+"!",d),f.data(this,a,c),b.triggerHandler("changeData"+j[1]+"!",d)})},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,c){a&&(c=(c||"fx")+"mark",f.data(a,c,(f.data(a,c,b,!0)||0)+1,!0))},_unmark:function(a,c,d){a!==!0&&(d=c,c=a,a=!1);if(c){d=d||"fx";var e=d+"mark",g=a?0:(f.data(c,e,b,!0)||1)-1;g?f.data(c,e,g,!0):(f.removeData(c,e,!0),m(c,d,"mark"))}},queue:function(a,c,d){if(a){c=(c||"fx")+"queue";var e=f.data(a,c,b,!0);d&&(!e||f.isArray(d)?e=f.data(a,c,f.makeArray(d),!0):e.push(d));return e||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e;d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),d.call(a,function(){f.dequeue(a,b)})),c.length||(f.removeData(a,b+"queue",!0),m(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){typeof a!="string"&&(c=a,a="fx");if(c===b)return f.queue(this[0],a);return this.each(function(){var b=f.queue(this,a,c);a==="fx"&&b[0]!=="inprogress"&&f.dequeue(this,a)})},dequeue:function(a){return this.each(function(){f.dequeue(this,a)})},delay:function(a,b){a=f.fx?f.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(){var c=this;setTimeout(function(){f.dequeue(c,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){function m(){--h||d.resolveWith(e,[e])}typeof a!="string"&&(c=a,a=b),a=a||"fx";var d=f.Deferred(),e=this,g=e.length,h=1,i=a+"defer",j=a+"queue",k=a+"mark",l;while(g--)if(l=f.data(e[g],i,b,!0)||(f.data(e[g],j,b,!0)||f.data(e[g],k,b,!0))&&f.data(e[g],i,f._Deferred(),!0))h++,l.done(m);m();return d.promise()}});var n=/[\n\t\r]/g,o=/\s+/,p=/\r/g,q=/^(?:button|input)$/i,r=/^(?:button|input|object|select|textarea)$/i,s=/^a(?:rea)?$/i,t=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,u,v;f.fn.extend({attr:function(a,b){return f.access(this,a,b,!0,f.attr)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,a,b,!0,f.prop)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(o);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{g=" "+e.className+" ";for(h=0,i=b.length;h<i;h++)~g.indexOf(" "+b[h]+" ")||(g+=b[h]+" ");e.className=f.trim(g)}}}return this},removeClass:function(a){var c,d,e,g,h,i,j;if(f.isFunction(a))return this.each(function(b){f(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(o);for(d=0,e=this.length;d<e;d++){g=this[d];if(g.nodeType===1&&g.className)if(a){h=(" "+g.className+" ").replace(n," ");for(i=0,j=c.length;i<j;i++)h=h.replace(" "+c[i]+" "," ");g.className=f.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";if(f.isFunction(a))return this.each(function(c){f(this).toggleClass(a.call(this,c,this.className,b),b)});return this.each(function(){if(c==="string"){var e,g=0,h=f(this),i=b,j=a.split(o);while(e=j[g++])i=d?i:!h.hasClass(e),h[i?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&f._data(this,"__className__",this.className),this.className=this.className||a===!1?"":f._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ";for(var c=0,d=this.length;c<d;c++)if(this[c].nodeType===1&&(" "+this[c].className+" ").replace(n," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e=this[0];if(!arguments.length){if(e){c=f.valHooks[e.nodeName.toLowerCase()]||f.valHooks[e.type];if(c&&"get"in c&&(d=c.get(e,"value"))!==b)return d;d=e.value;return typeof d=="string"?d.replace(p,""):d==null?"":d}return b}var g=f.isFunction(a);return this.each(function(d){var e=f(this),h;if(this.nodeType===1){g?h=a.call(this,d,e.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c=a.selectedIndex,d=[],e=a.options,g=a.type==="select-one";if(c<0)return null;for(var h=g?c:0,i=g?c+1:e.length;h<i;h++){var j=e[h];if(j.selected&&(f.support.optDisabled?!j.disabled:j.getAttribute("disabled")===null)&&(!j.parentNode.disabled||!f.nodeName(j.parentNode,"optgroup"))){b=f(j).val();if(g)return b;d.push(b)}}if(g&&!d.length&&e.length)return f(e[c]).val();return d},set:function(a,b){var c=f.makeArray(b);f(a).find("option").each(function(){this.selected=f.inArray(f(this).val(),c)>=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attrFix:{tabindex:"tabIndex"},attr:function(a,c,d,e){var g=a.nodeType;if(!a||g===3||g===8||g===2)return b;if(e&&c in f.attrFn)return f(a)[c](d);if(!("getAttribute"in a))return f.prop(a,c,d);var h,i,j=g!==1||!f.isXMLDoc(a);j&&(c=f.attrFix[c]||c,i=f.attrHooks[c],i||(t.test(c)?i=v:u&&(i=u)));if(d!==b){if(d===null){f.removeAttr(a,c);return b}if(i&&"set"in i&&j&&(h=i.set(a,d,c))!==b)return h;a.setAttribute(c,""+d);return d}if(i&&"get"in i&&j&&(h=i.get(a,c))!==null)return h;h=a.getAttribute(c);return h===null?b:h},removeAttr:function(a,b){var c;a.nodeType===1&&(b=f.attrFix[b]||b,f.attr(a,b,""),a.removeAttribute(b),t.test(b)&&(c=f.propFix[b]||b)in a&&(a[c]=!1))},attrHooks:{type:{set:function(a,b){if(q.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},value:{get:function(a,b){if(u&&f.nodeName(a,"button"))return u.get(a,b);return b in a?a.value:null},set:function(a,b,c){if(u&&f.nodeName(a,"button"))return u.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e=a.nodeType;if(!a||e===3||e===8||e===2)return b;var g,h,i=e!==1||!f.isXMLDoc(a);i&&(c=f.propFix[c]||c,h=f.propHooks[c]);return d!==b?h&&"set"in h&&(g=h.set(a,d,c))!==b?g:a[c]=d:h&&"get"in h&&(g=h.get(a,c))!==null?g:a[c]},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):r.test(a.nodeName)||s.test(a.nodeName)&&a.href?0:b}}}}),f.attrHooks.tabIndex=f.propHooks.tabIndex,v={get:function(a,c){var d;return f.prop(a,c)===!0||(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase()));return c}},f.support.getSetAttribute||(u=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&d.nodeValue!==""?d.nodeValue:b},set:function(a,b,d){var e=a.getAttributeNode(d);e||(e=c.createAttribute(d),a.setAttributeNode(e));return e.nodeValue=b+""}},f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})})),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex);return null}})),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var w=/\.(.*)$/,x=/^(?:textarea|input|select)$/i,y=/\./g,z=/ /g,A=/[^\w\s.|`]/g,B=function(a){return a.replace(A,"\\$&")};f.event={add:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){if(d===!1)d=C;else if(!d)return;var g,h;d.handler&&(g=d,d=g.handler),d.guid||(d.guid=f.guid++);var i=f._data(a);if(!i)return;var j=i.events,k=i.handle;j||(i.events=j={}),k||(i.handle=k=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.handle.apply(k.elem,arguments):b}),k.elem=a,c=c.split(" ");var l,m=0,n;while(l=c[m++]){h=g?f.extend({},g):{handler:d,data:e},l.indexOf(".")>-1?(n=l.split("."),l=n.shift(),h.namespace=n.slice(0).sort().join(".")):(n=[],h.namespace=""),h.type=l,h.guid||(h.guid=d.guid);var o=j[l],p=f.event.special[l]||{};if(!o){o=j[l]=[];if(!p.setup||p.setup.call(a,e,n,k)===!1)a.addEventListener?a.addEventListener(l,k,!1):a.attachEvent&&a.attachEvent("on"+l,k)}p.add&&(p.add.call(a,h),h.handler.guid||(h.handler.guid=d.guid)),o.push(h),f.event.global[l]=!0}a=null}},global:{},remove:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){d===!1&&(d=C);var g,h,i,j,k=0,l,m,n,o,p,q,r,s=f.hasData(a)&&f._data(a),t=s&&s.events;if(!s||!t)return;c&&c.type&&(d=c.handler,c=c.type);if(!c||typeof c=="string"&&c.charAt(0)==="."){c=c||"";for(h in t)f.event.remove(a,h+c);return}c=c.split(" ");while(h=c[k++]){r=h,q=null,l=h.indexOf(".")<0,m=[],l||(m=h.split("."),h=m.shift(),n=new RegExp("(^|\\.)"+f.map(m.slice(0).sort(),B).join("\\.(?:.*\\.)?")+"(\\.|$)")),p=t[h];if(!p)continue;if(!d){for(j=0;j<p.length;j++){q=p[j];if(l||n.test(q.namespace))f.event.remove(a,r,q.handler,j),p.splice(j--,1)}continue}o=f.event.special[h]||{};for(j=e||0;j<p.length;j++){q=p[j];if(d.guid===q.guid){if(l||n.test(q.namespace))e==null&&p.splice(j--,1),o.remove&&o.remove.call(a,q);if(e!=null)break}}if(p.length===0||e!=null&&p.length===1)(!o.teardown||o.teardown.call(a,m)===!1)&&f.removeEvent(a,h,s.handle),g=null,delete
-t[h]}if(f.isEmptyObject(t)){var u=s.handle;u&&(u.elem=null),delete s.events,delete s.handle,f.isEmptyObject(s)&&f.removeData(a,b,!0)}}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,g){var h=c.type||c,i=[],j;h.indexOf("!")>=0&&(h=h.slice(0,-1),j=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if(!!e&&!f.event.customEvent[h]||!!f.event.global[h]){c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.exclusive=j,c.namespace=i.join("."),c.namespace_re=new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)");if(g||!e)c.preventDefault(),c.stopPropagation();if(!e){f.each(f.cache,function(){var a=f.expando,b=this[a];b&&b.events&&b.events[h]&&f.event.trigger(c,d,b.handle.elem)});return}if(e.nodeType===3||e.nodeType===8)return;c.result=b,c.target=e,d=d!=null?f.makeArray(d):[],d.unshift(c);var k=e,l=h.indexOf(":")<0?"on"+h:"";do{var m=f._data(k,"handle");c.currentTarget=k,m&&m.apply(k,d),l&&f.acceptData(k)&&k[l]&&k[l].apply(k,d)===!1&&(c.result=!1,c.preventDefault()),k=k.parentNode||k.ownerDocument||k===c.target.ownerDocument&&a}while(k&&!c.isPropagationStopped());if(!c.isDefaultPrevented()){var n,o=f.event.special[h]||{};if((!o._default||o._default.call(e.ownerDocument,c)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)){try{l&&e[h]&&(n=e[l],n&&(e[l]=null),f.event.triggered=h,e[h]())}catch(p){}n&&(e[l]=n),f.event.triggered=b}}return c.result}},handle:function(c){c=f.event.fix(c||a.event);var d=((f._data(this,"events")||{})[c.type]||[]).slice(0),e=!c.exclusive&&!c.namespace,g=Array.prototype.slice.call(arguments,0);g[0]=c,c.currentTarget=this;for(var h=0,i=d.length;h<i;h++){var j=d[h];if(e||c.namespace_re.test(j.namespace)){c.handler=j.handler,c.data=j.data,c.handleObj=j;var k=j.handler.apply(this,g);k!==b&&(c.result=k,k===!1&&(c.preventDefault(),c.stopPropagation()));if(c.isImmediatePropagationStopped())break}}return c.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(a){if(a[f.expando])return a;var d=a;a=f.Event(d);for(var e=this.props.length,g;e;)g=this.props[--e],a[g]=d[g];a.target||(a.target=a.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),!a.relatedTarget&&a.fromElement&&(a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement);if(a.pageX==null&&a.clientX!=null){var h=a.target.ownerDocument||c,i=h.documentElement,j=h.body;a.pageX=a.clientX+(i&&i.scrollLeft||j&&j.scrollLeft||0)-(i&&i.clientLeft||j&&j.clientLeft||0),a.pageY=a.clientY+(i&&i.scrollTop||j&&j.scrollTop||0)-(i&&i.clientTop||j&&j.clientTop||0)}a.which==null&&(a.charCode!=null||a.keyCode!=null)&&(a.which=a.charCode!=null?a.charCode:a.keyCode),!a.metaKey&&a.ctrlKey&&(a.metaKey=a.ctrlKey),!a.which&&a.button!==b&&(a.which=a.button&1?1:a.button&2?3:a.button&4?2:0);return a},guid:1e8,proxy:f.proxy,special:{ready:{setup:f.bindReady,teardown:f.noop},live:{add:function(a){f.event.add(this,M(a.origType,a.selector),f.extend({},a,{handler:L,guid:a.handler.guid}))},remove:function(a){f.event.remove(this,M(a.origType,a.selector),a)}},beforeunload:{setup:function(a,b,c){f.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}}},f.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},f.Event=function(a,b){if(!this.preventDefault)return new f.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?D:C):this.type=a,b&&f.extend(this,b),this.timeStamp=f.now(),this[f.expando]=!0},f.Event.prototype={preventDefault:function(){this.isDefaultPrevented=D;var a=this.originalEvent;!a||(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=D;var a=this.originalEvent;!a||(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=D,this.stopPropagation()},isDefaultPrevented:C,isPropagationStopped:C,isImmediatePropagationStopped:C};var E=function(a){var b=a.relatedTarget,c=!1,d=a.type;a.type=a.data,b!==this&&(b&&(c=f.contains(this,b)),c||(f.event.handle.apply(this,arguments),a.type=d))},F=function(a){a.type=a.data,f.event.handle.apply(this,arguments)};f.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){f.event.special[a]={setup:function(c){f.event.add(this,b,c&&c.selector?F:E,a)},teardown:function(a){f.event.remove(this,b,a&&a.selector?F:E)}}}),f.support.submitBubbles||(f.event.special.submit={setup:function(a,b){if(!f.nodeName(this,"form"))f.event.add(this,"click.specialSubmit",function(a){var b=a.target,c=f.nodeName(b,"input")||f.nodeName(b,"button")?b.type:"";(c==="submit"||c==="image")&&f(b).closest("form").length&&J("submit",this,arguments)}),f.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,c=f.nodeName(b,"input")||f.nodeName(b,"button")?b.type:"";(c==="text"||c==="password")&&f(b).closest("form").length&&a.keyCode===13&&J("submit",this,arguments)});else return!1},teardown:function(a){f.event.remove(this,".specialSubmit")}});if(!f.support.changeBubbles){var G,H=function(a){var b=f.nodeName(a,"input")?a.type:"",c=a.value;b==="radio"||b==="checkbox"?c=a.checked:b==="select-multiple"?c=a.selectedIndex>-1?f.map(a.options,function(a){return a.selected}).join("-"):"":f.nodeName(a,"select")&&(c=a.selectedIndex);return c},I=function(c){var d=c.target,e,g;if(!!x.test(d.nodeName)&&!d.readOnly){e=f._data(d,"_change_data"),g=H(d),(c.type!=="focusout"||d.type!=="radio")&&f._data(d,"_change_data",g);if(e===b||g===e)return;if(e!=null||g)c.type="change",c.liveFired=b,f.event.trigger(c,arguments[1],d)}};f.event.special.change={filters:{focusout:I,beforedeactivate:I,click:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(c==="radio"||c==="checkbox"||f.nodeName(b,"select"))&&I.call(this,a)},keydown:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(a.keyCode===13&&!f.nodeName(b,"textarea")||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&I.call(this,a)},beforeactivate:function(a){var b=a.target;f._data(b,"_change_data",H(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in G)f.event.add(this,c+".specialChange",G[c]);return x.test(this.nodeName)},teardown:function(a){f.event.remove(this,".specialChange");return x.test(this.nodeName)}},G=f.event.special.change.filters,G.focus=G.beforeactivate}f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){function e(a){var c=f.event.fix(a);c.type=b,c.originalEvent={},f.event.trigger(c,null,c.target),c.isDefaultPrevented()&&a.preventDefault()}var d=0;f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.each(["bind","one"],function(a,c){f.fn[c]=function(a,d,e){var g;if(typeof a=="object"){for(var h in a)this[c](h,d,a[h],e);return this}if(arguments.length===2||d===!1)e=d,d=b;c==="one"?(g=function(a){f(this).unbind(a,g);return e.apply(this,arguments)},g.guid=e.guid||f.guid++):g=e;if(a==="unload"&&c!=="one")this.one(a,d,e);else for(var i=0,j=this.length;i<j;i++)f.event.add(this[i],a,g,d);return this}}),f.fn.extend({unbind:function(a,b){if(typeof a=="object"&&!a.preventDefault)for(var c in a)this.unbind(c,a[c]);else for(var d=0,e=this.length;d<e;d++)f.event.remove(this[d],a,b);return this},delegate:function(a,b,c,d){return this.live(b,c,d,a)},undelegate:function(a,b,c){return arguments.length===0?this.unbind("live"):this.die(b,null,c,a)},trigger:function(a,b){return this.each(function(){f.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return f.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||f.guid++,d=0,e=function(c){var e=(f.data(this,"lastToggle"+a.guid)||0)%d;f.data(this,"lastToggle"+a.guid,e+1),c.preventDefault();return b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var K={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};f.each(["live","die"],function(a,c){f.fn[c]=function(a,d,e,g){var h,i=0,j,k,l,m=g||this.selector,n=g?this:f(this.context);if(typeof a=="object"&&!a.preventDefault){for(var o in a)n[c](o,d,a[o],m);return this}if(c==="die"&&!a&&g&&g.charAt(0)==="."){n.unbind(g);return this}if(d===!1||f.isFunction(d))e=d||C,d=b;a=(a||"").split(" ");while((h=a[i++])!=null){j=w.exec(h),k="",j&&(k=j[0],h=h.replace(w,""));if(h==="hover"){a.push("mouseenter"+k,"mouseleave"+k);continue}l=h,K[h]?(a.push(K[h]+k),h=h+k):h=(K[h]||h)+k;if(c==="live")for(var p=0,q=n.length;p<q;p++)f.event.add(n[p],"live."+M(h,m),{data:d,selector:m,handler:e,origType:h,origHandler:e,preType:l});else n.unbind("live."+M(h,m),e)}return this}}),f.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){f.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.bind(b,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0)}),function(){function u(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}if(i.nodeType===1){f||(i.sizcache=c,i.sizset=g);if(typeof b!="string"){if(i===b){j=!0;break}}else if(k.filter(b,[i]).length>0){j=i;break}}i=i[a]}d[g]=j}}}function t(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}i.nodeType===1&&!f&&(i.sizcache=c,i.sizset=g);if(i.nodeName.toLowerCase()===b){j=i;break}i=i[a]}d[g]=j}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d=0,e=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(b,d,f,g){f=f||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return f;var i,j,n,o,q,r,s,t,u=!0,w=k.isXML(d),x=[],y=b;do{a.exec(""),i=a.exec(y);if(i){y=i[3],x.push(i[1]);if(i[2]){o=i[3];break}}}while(i);if(x.length>1&&m.exec(b))if(x.length===2&&l.relative[x[0]])j=v(x[0]+x[1],d);else{j=l.relative[x[0]]?[d]:k(x.shift(),d);while(x.length)b=x.shift(),l.relative[b]&&(b+=x.shift()),j=v(b,j)}else{!g&&x.length>1&&d.nodeType===9&&!w&&l.match.ID.test(x[0])&&!l.match.ID.test(x[x.length-1])&&(q=k.find(x.shift(),d,w),d=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:p(g)}:k.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),j=q.expr?k.filter(q.expr,q.set):q.set,x.length>0?n=p(j):u=!1;while(x.length)r=x.pop(),s=r,l.relative[r]?s=x.pop():r="",s==null&&(s=d),l.relative[r](n,s,w)}else n=x=[]}n||(n=j),n||k.error(r||b);if(e.call(n)==="[object Array]")if(!u)f.push.apply(f,n);else if(d&&d.nodeType===1)for(t=0;n[t]!=null;t++)n[t]&&(n[t]===!0||n[t].nodeType===1&&k.contains(d,n[t]))&&f.push(j[t]);else for(t=0;n[t]!=null;t++)n[t]&&n[t].nodeType===1&&f.push(j[t]);else p(n,f);o&&(k(o,h,f,g),k.uniqueSort(f));return f};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},k.matches=function(a,b){return k(a,null,null,b)},k.matchesSelector=function(a,b){return k(b,null,null,[a]).length>0},k.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=l.order.length;e<f;e++){var g,h=l.order[e];if(g=l.leftMatch[h].exec(a)){var j=g[1];g.splice(1,1);if(j.substr(j.length-1)!=="\\"){g[1]=(g[1]||"").replace(i,""),d=l.find[h](g,b,c);if(d!=null){a=a.replace(l.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},k.filter=function(a,c,d,e){var f,g,h=a,i=[],j=c,m=c&&c[0]&&k.isXML(c[0]);while(a&&c.length){for(var n in l.filter)if((f=l.leftMatch[n].exec(a))!=null&&f[2]){var o,p,q=l.filter[n],r=f[1];g=!1,f.splice(1,1);if(r.substr(r.length-1)==="\\")continue;j===i&&(i=[]);if(l.preFilter[n]){f=l.preFilter[n](f,j,d,i,e,m);if(!f)g=o=!0;else if(f===!0)continue}if(f)for(var s=0;(p=j[s])!=null;s++)if(p){o=q(p,f,s,j);var t=e^!!o;d&&o!=null?t?g=!0:j[s]=!1:t&&(i.push(p),g=!0)}if(o!==b){d||(j=i),a=a.replace(l.match[n],"");if(!g)return[];break}}if(a===h)if(g==null)k.error(a);else break;h=a}return j},k.error=function(a){throw"Syntax error, unrecognized expression: "+a};var l=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b=="string",d=c&&!j.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1);a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&k.filter(b,a,!0)},">":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&k.filter(b,a,!0)}},"":function(a,b,c){var e,f=d++,g=u;typeof b=="string"&&!j.test(b)&&(b=b.toLowerCase(),e=b,g=t),g("parentNode",b,f,a,e,c)},"~":function(a,b,c){var e,f=d++,g=u;typeof b=="string"&&!j.test(b)&&(b=b.toLowerCase(),e=b,g=t),g("previousSibling",b,f,a,e,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(i,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&k.error(a[0]);a[0]=d++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=k(b[3],null,null,c);else{var g=k.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(l.match.POS.test(b[0])||l.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}k.error(e)},CHILD:function(a,b){var c=b[1],d=a;switch(c){case"only":case"first":while(d=d.previousSibling)if(d.nodeType===1)return!1;if(c==="first")return!0;d=a;case"last":while(d=d.nextSibling)if(d.nodeType===1)return!1;return!0;case"nth":var e=b[2],f=b[3];if(e===1&&f===0)return!0;var g=b[0],h=a.parentNode;if(h&&(h.sizcache!==g||!a.nodeIndex)){var i=0;for(d=h.firstChild;d;d=d.nextSibling)d.nodeType===1&&(d.nodeIndex=++i);h.sizcache=g}var j=a.nodeIndex-f;return e===0?j===0:j%e===0&&j/e>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f)return f(a,c,b,d)}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match)l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n));var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];if(e.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var f=a.length;c<f;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var r,s;c.documentElement.compareDocumentPosition?r=function(a,b){if(a===b){g=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(r=function(a,b){if(a===b){g=!0;return 0}if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],h=a.parentNode,i=b.parentNode,j=h;if(h===i)return s(a,b);if(!h)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return s(e[k],f[k]);return k===c?s(a,f[k],-1):s(e[k],b,1)},s=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),k.getText=function(a){var b="",c;for(var d=0;a[d];d++)c=a[d],c.nodeType===3||c.nodeType===4?b+=c.nodeValue:c.nodeType!==8&&(b+=k.getText(c.childNodes));return b},function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=k,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,e,f,g){e=e||c;if(!g&&!k.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return p(e.getElementsByTagName(b),f);if(h[2]&&l.find.CLASS&&e.getElementsByClassName)return p(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return p([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return p([],f);if(i.id===h[3])return p([i],f)}try{return p(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e,n=e.getAttribute("id"),o=n||d,q=e.parentNode,r=/^\s*[+~]/.test(b);n?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),r&&q&&(e=e.parentNode);try{if(!r||q)return p(e.querySelectorAll("[id='"+o+"'] "+b),f)}catch(s){}finally{n||m.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)k[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}k.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a))try{if(e||!l.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return k(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:k.contains=function(){return!1},k.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var v=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a))e+=c[0],a=a.replace(l.match.PSEUDO,"");a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g<h;g++)k(a,f[g],d);return k.filter(e,d)};f.find=k,f.expr=k.selectors,f.expr[":"]=f.expr.filters,f.unique=k.uniqueSort,f.text=k.getText,f.isXMLDoc=k.isXML,f.contains=k.contains}();var N=/Until$/,O=/^(?:parents|prevUntil|prevAll)/,P=/,/,Q=/^.[^:#\[\.,]*$/,R=Array.prototype.slice,S=f.expr.match.POS,T={children:!0,contents:!0,next:!0,prev:!0};f.fn.extend({find:function(a){var b=this,c,d;if(typeof a!="string")return f(a).filter(function(){for(c=0,d=b.length;c<d;c++)if(f.contains(b[c],this))return!0});var e=this.pushStack("","find",a),g,h,i;for(c=0,d=this.length;c<d;c++){g=e.length,f.find(a,this[c],e);if(c>0)for(h=g;h<e.length;h++)for(i=0;i<g;i++)if(e[i]===e[h]){e.splice(h--,1);break}}return e},has:function(a){var b=f(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(f.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(V(this,a,!1),"not",a)},filter:function(a){return this.pushStack(V(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h,i,j={},k=1;if(g&&a.length){for(d=0,e=a.length;d<e;d++)i=a[d],j[i]||(j[i]=S.test(i)?f(i,b||this.context):i);while(g&&g.ownerDocument&&g!==b){for(i in j)h=j[i],(h.jquery?h.index(g)>-1:f(g).is(h))&&c.push({selector:i,elem:g,level:k});g=g.parentNode,k++}}return c}var l=S.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d<e;d++){g=this[d];while(g){if(l?l.index(g)>-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(U(c[0])||U(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c),g=R.call(arguments);N.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!T[a]?f.unique(e):e,(this.length>1||P.test(d))&&O.test(a)&&(e=e.reverse());return this.pushStack(e,a,g.join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]...
[truncated message content] |
|
From: <ma...@us...> - 2011-12-12 17:23:21
|
Revision: 569
http://openautomation.svn.sourceforge.net/openautomation/?rev=569&view=rev
Author: mayerch
Date: 2011-12-12 17:23:11 +0000 (Mon, 12 Dec 2011)
Log Message:
-----------
Fix error message that is caused by the fact that the AJAX connection will be on unload canceled before(!) the .unload() event will be triggered!?!
I'm using the check suggested at http://stackoverflow.com/questions/1370322/jquery-ajax-fires-error-callback-on-window-unload
Modified Paths:
--------------
CometVisu/trunk/visu/lib/cometvisu-client.js
Modified: CometVisu/trunk/visu/lib/cometvisu-client.js
===================================================================
--- CometVisu/trunk/visu/lib/cometvisu-client.js 2011-12-12 14:05:51 UTC (rev 568)
+++ CometVisu/trunk/visu/lib/cometvisu-client.js 2011-12-12 17:23:11 UTC (rev 569)
@@ -81,7 +81,7 @@
*/
this.handleError=function(xhr,str,excptObj)
{
- if( this.running && xhr.readyState != 4 && !this.doRestart) // ignore error when connection is irrelevant
+ if( this.running && xhr.readyState != 4 && !this.doRestart && xhr.status!==0 ) // ignore error when connection is irrelevant
{
var readyState = 'UNKNOWN';
switch( xhr.readyState )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2011-12-12 14:06:03
|
Revision: 568
http://openautomation.svn.sourceforge.net/openautomation/?rev=568&view=rev
Author: mayerch
Date: 2011-12-12 14:05:51 +0000 (Mon, 12 Dec 2011)
Log Message:
-----------
Update jQuery UI to latest upstream version 1.8.16
Modified Paths:
--------------
CometVisu/trunk/visu/lib/jquery-ui.js
CometVisu/trunk/visu/lib/jquery-ui.min.js
Modified: CometVisu/trunk/visu/lib/jquery-ui.js
===================================================================
--- CometVisu/trunk/visu/lib/jquery-ui.js 2011-12-12 12:45:56 UTC (rev 567)
+++ CometVisu/trunk/visu/lib/jquery-ui.js 2011-12-12 14:05:51 UTC (rev 568)
@@ -1,7 +1,7 @@
/*!
- * jQuery UI 1.8.6
+ * jQuery UI 1.8.16
*
- * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
@@ -18,7 +18,7 @@
}
$.extend( $.ui, {
- version: "1.8.6",
+ version: "1.8.16",
keyCode: {
ALT: 18,
@@ -58,6 +58,8 @@
// plugins
$.fn.extend({
+ propAttr: $.fn.prop || $.fn.attr,
+
_focus: $.fn.focus,
focus: function( delay, fn ) {
return typeof delay === "number" ?
@@ -174,6 +176,27 @@
});
// selectors
+function focusable( element, isTabIndexNotNaN ) {
+ var nodeName = element.nodeName.toLowerCase();
+ if ( "area" === nodeName ) {
+ var map = element.parentNode,
+ mapName = map.name,
+ img;
+ if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
+ return false;
+ }
+ img = $( "img[usemap=#" + mapName + "]" )[0];
+ return !!img && visible( img );
+ }
+ return ( /input|select|textarea|button|object/.test( nodeName )
+ ? !element.disabled
+ : "a" == nodeName
+ ? element.href || isTabIndexNotNaN
+ : isTabIndexNotNaN)
+ // the element and all of its ancestors must be visible
+ && visible( element );
+}
+
function visible( element ) {
return !$( element ).parents().andSelf().filter(function() {
return $.curCSS( this, "visibility" ) === "hidden" ||
@@ -187,30 +210,13 @@
},
focusable: function( element ) {
- var nodeName = element.nodeName.toLowerCase(),
- tabIndex = $.attr( element, "tabindex" );
- if ( "area" === nodeName ) {
- var map = element.parentNode,
- mapName = map.name,
- img;
- if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
- return false;
- }
- img = $( "img[usemap=#" + mapName + "]" )[0];
- return !!img && visible( img );
- }
- return ( /input|select|textarea|button|object/.test( nodeName )
- ? !element.disabled
- : "a" == nodeName
- ? element.href || !isNaN( tabIndex )
- : !isNaN( tabIndex ))
- // the element and all of its ancestors must be visible
- && visible( element );
+ return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) );
},
tabbable: function( element ) {
- var tabIndex = $.attr( element, "tabindex" );
- return ( isNaN( tabIndex ) || tabIndex >= 0 ) && $( element ).is( ":focusable" );
+ var tabIndex = $.attr( element, "tabindex" ),
+ isTabIndexNaN = isNaN( tabIndex );
+ return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN );
}
});
@@ -307,9 +313,9 @@
})( jQuery );
/*!
- * jQuery UI Widget 1.8.6
+ * jQuery UI Widget 1.8.16
*
- * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
@@ -322,7 +328,10 @@
var _cleanData = $.cleanData;
$.cleanData = function( elems ) {
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
- $( elem ).triggerHandler( "remove" );
+ try {
+ $( elem ).triggerHandler( "remove" );
+ // http://bugs.jquery.com/ticket/8235
+ } catch( e ) {}
}
_cleanData( elems );
};
@@ -333,7 +342,10 @@
if ( !keepData ) {
if ( !selector || $.filter( selector, [ this ] ).length ) {
$( "*", this ).add( [ this ] ).each(function() {
- $( this ).triggerHandler( "remove" );
+ try {
+ $( this ).triggerHandler( "remove" );
+ // http://bugs.jquery.com/ticket/8235
+ } catch( e ) {}
});
}
}
@@ -569,9 +581,9 @@
})( jQuery );
/*!
- * jQuery UI Mouse 1.8.6
+ * jQuery UI Mouse 1.8.16
*
- * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
@@ -582,6 +594,11 @@
*/
(function( $, undefined ) {
+var mouseHandled = false;
+$( document ).mouseup( function( e ) {
+ mouseHandled = false;
+});
+
$.widget("ui.mouse", {
options: {
cancel: ':input,option',
@@ -596,8 +613,8 @@
return self._mouseDown(event);
})
.bind('click.'+this.widgetName, function(event) {
- if(self._preventClickEvent) {
- self._preventClickEvent = false;
+ if (true === $.data(event.target, self.widgetName + '.preventClickEvent')) {
+ $.removeData(event.target, self.widgetName + '.preventClickEvent');
event.stopImmediatePropagation();
return false;
}
@@ -614,9 +631,7 @@
_mouseDown: function(event) {
// don't let more than one widget handle mouseStart
- // TODO: figure out why we have to use originalEvent
- event.originalEvent = event.originalEvent || {};
- if (event.originalEvent.mouseHandled) { return; }
+ if( mouseHandled ) { return };
// we may have missed mouseup (out of window)
(this._mouseStarted && this._mouseUp(event));
@@ -625,7 +640,9 @@
var self = this,
btnIsLeft = (event.which == 1),
- elIsCancel = (typeof this.options.cancel == "string" ? $(event.target).parents().add(event.target).filter(this.options.cancel).length : false);
+ // event.target.nodeName works around a bug in IE 8 with
+ // disabled inputs (#7620)
+ elIsCancel = (typeof this.options.cancel == "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false);
if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
return true;
}
@@ -645,6 +662,11 @@
}
}
+ // Click event may never have fired (Gecko & Opera)
+ if (true === $.data(event.target, this.widgetName + '.preventClickEvent')) {
+ $.removeData(event.target, this.widgetName + '.preventClickEvent');
+ }
+
// these delegates are required to keep context
this._mouseMoveDelegate = function(event) {
return self._mouseMove(event);
@@ -657,7 +679,8 @@
.bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
event.preventDefault();
- event.originalEvent.mouseHandled = true;
+
+ mouseHandled = true;
return true;
},
@@ -688,7 +711,11 @@
if (this._mouseStarted) {
this._mouseStarted = false;
- this._preventClickEvent = (event.target == this._mouseDownEvent.target);
+
+ if (event.target == this._mouseDownEvent.target) {
+ $.data(event.target, this.widgetName + '.preventClickEvent', true);
+ }
+
this._mouseStop(event);
}
@@ -716,12 +743,264 @@
})(jQuery);
/*
- * jQuery UI Draggable 1.8.6
+ * jQuery UI Position 1.8.16
*
- * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
+ * http://docs.jquery.com/UI/Position
+ */
+(function( $, undefined ) {
+
+$.ui = $.ui || {};
+
+var horizontalPositions = /left|center|right/,
+ verticalPositions = /top|center|bottom/,
+ center = "center",
+ _position = $.fn.position,
+ _offset = $.fn.offset;
+
+$.fn.position = function( options ) {
+ if ( !options || !options.of ) {
+ return _position.apply( this, arguments );
+ }
+
+ // make a copy, we don't want to modify arguments
+ options = $.extend( {}, options );
+
+ var target = $( options.of ),
+ targetElem = target[0],
+ collision = ( options.collision || "flip" ).split( " " ),
+ offset = options.offset ? options.offset.split( " " ) : [ 0, 0 ],
+ targetWidth,
+ targetHeight,
+ basePosition;
+
+ if ( targetElem.nodeType === 9 ) {
+ targetWidth = target.width();
+ targetHeight = target.height();
+ basePosition = { top: 0, left: 0 };
+ // TODO: use $.isWindow() in 1.9
+ } else if ( targetElem.setTimeout ) {
+ targetWidth = target.width();
+ targetHeight = target.height();
+ basePosition = { top: target.scrollTop(), left: target.scrollLeft() };
+ } else if ( targetElem.preventDefault ) {
+ // force left top to allow flipping
+ options.at = "left top";
+ targetWidth = targetHeight = 0;
+ basePosition = { top: options.of.pageY, left: options.of.pageX };
+ } else {
+ targetWidth = target.outerWidth();
+ targetHeight = target.outerHeight();
+ basePosition = target.offset();
+ }
+
+ // force my and at to have valid horizontal and veritcal positions
+ // if a value is missing or invalid, it will be converted to center
+ $.each( [ "my", "at" ], function() {
+ var pos = ( options[this] || "" ).split( " " );
+ if ( pos.length === 1) {
+ pos = horizontalPositions.test( pos[0] ) ?
+ pos.concat( [center] ) :
+ verticalPositions.test( pos[0] ) ?
+ [ center ].concat( pos ) :
+ [ center, center ];
+ }
+ pos[ 0 ] = horizontalPositions.test( pos[0] ) ? pos[ 0 ] : center;
+ pos[ 1 ] = verticalPositions.test( pos[1] ) ? pos[ 1 ] : center;
+ options[ this ] = pos;
+ });
+
+ // normalize collision option
+ if ( collision.length === 1 ) {
+ collision[ 1 ] = collision[ 0 ];
+ }
+
+ // normalize offset option
+ offset[ 0 ] = parseInt( offset[0], 10 ) || 0;
+ if ( offset.length === 1 ) {
+ offset[ 1 ] = offset[ 0 ];
+ }
+ offset[ 1 ] = parseInt( offset[1], 10 ) || 0;
+
+ if ( options.at[0] === "right" ) {
+ basePosition.left += targetWidth;
+ } else if ( options.at[0] === center ) {
+ basePosition.left += targetWidth / 2;
+ }
+
+ if ( options.at[1] === "bottom" ) {
+ basePosition.top += targetHeight;
+ } else if ( options.at[1] === center ) {
+ basePosition.top += targetHeight / 2;
+ }
+
+ basePosition.left += offset[ 0 ];
+ basePosition.top += offset[ 1 ];
+
+ return this.each(function() {
+ var elem = $( this ),
+ elemWidth = elem.outerWidth(),
+ elemHeight = elem.outerHeight(),
+ marginLeft = parseInt( $.curCSS( this, "marginLeft", true ) ) || 0,
+ marginTop = parseInt( $.curCSS( this, "marginTop", true ) ) || 0,
+ collisionWidth = elemWidth + marginLeft +
+ ( parseInt( $.curCSS( this, "marginRight", true ) ) || 0 ),
+ collisionHeight = elemHeight + marginTop +
+ ( parseInt( $.curCSS( this, "marginBottom", true ) ) || 0 ),
+ position = $.extend( {}, basePosition ),
+ collisionPosition;
+
+ if ( options.my[0] === "right" ) {
+ position.left -= elemWidth;
+ } else if ( options.my[0] === center ) {
+ position.left -= elemWidth / 2;
+ }
+
+ if ( options.my[1] === "bottom" ) {
+ position.top -= elemHeight;
+ } else if ( options.my[1] === center ) {
+ position.top -= elemHeight / 2;
+ }
+
+ // prevent fractions (see #5280)
+ position.left = Math.round( position.left );
+ position.top = Math.round( position.top );
+
+ collisionPosition = {
+ left: position.left - marginLeft,
+ top: position.top - marginTop
+ };
+
+ $.each( [ "left", "top" ], function( i, dir ) {
+ if ( $.ui.position[ collision[i] ] ) {
+ $.ui.position[ collision[i] ][ dir ]( position, {
+ targetWidth: targetWidth,
+ targetHeight: targetHeight,
+ elemWidth: elemWidth,
+ elemHeight: elemHeight,
+ collisionPosition: collisionPosition,
+ collisionWidth: collisionWidth,
+ collisionHeight: collisionHeight,
+ offset: offset,
+ my: options.my,
+ at: options.at
+ });
+ }
+ });
+
+ if ( $.fn.bgiframe ) {
+ elem.bgiframe();
+ }
+ elem.offset( $.extend( position, { using: options.using } ) );
+ });
+};
+
+$.ui.position = {
+ fit: {
+ left: function( position, data ) {
+ var win = $( window ),
+ over = data.collisionPosition.left + data.collisionWidth - win.width() - win.scrollLeft();
+ position.left = over > 0 ? position.left - over : Math.max( position.left - data.collisionPosition.left, position.left );
+ },
+ top: function( position, data ) {
+ var win = $( window ),
+ over = data.collisionPosition.top + data.collisionHeight - win.height() - win.scrollTop();
+ position.top = over > 0 ? position.top - over : Math.max( position.top - data.collisionPosition.top, position.top );
+ }
+ },
+
+ flip: {
+ left: function( position, data ) {
+ if ( data.at[0] === center ) {
+ return;
+ }
+ var win = $( window ),
+ over = data.collisionPosition.left + data.collisionWidth - win.width() - win.scrollLeft(),
+ myOffset = data.my[ 0 ] === "left" ?
+ -data.elemWidth :
+ data.my[ 0 ] === "right" ?
+ data.elemWidth :
+ 0,
+ atOffset = data.at[ 0 ] === "left" ?
+ data.targetWidth :
+ -data.targetWidth,
+ offset = -2 * data.offset[ 0 ];
+ position.left += data.collisionPosition.left < 0 ?
+ myOffset + atOffset + offset :
+ over > 0 ?
+ myOffset + atOffset + offset :
+ 0;
+ },
+ top: function( position, data ) {
+ if ( data.at[1] === center ) {
+ return;
+ }
+ var win = $( window ),
+ over = data.collisionPosition.top + data.collisionHeight - win.height() - win.scrollTop(),
+ myOffset = data.my[ 1 ] === "top" ?
+ -data.elemHeight :
+ data.my[ 1 ] === "bottom" ?
+ data.elemHeight :
+ 0,
+ atOffset = data.at[ 1 ] === "top" ?
+ data.targetHeight :
+ -data.targetHeight,
+ offset = -2 * data.offset[ 1 ];
+ position.top += data.collisionPosition.top < 0 ?
+ myOffset + atOffset + offset :
+ over > 0 ?
+ myOffset + atOffset + offset :
+ 0;
+ }
+ }
+};
+
+// offset setter from jQuery 1.4
+if ( !$.offset.setOffset ) {
+ $.offset.setOffset = function( elem, options ) {
+ // set position first, in-case top/left are set even on static elem
+ if ( /static/.test( $.curCSS( elem, "position" ) ) ) {
+ elem.style.position = "relative";
+ }
+ var curElem = $( elem ),
+ curOffset = curElem.offset(),
+ curTop = parseInt( $.curCSS( elem, "top", true ), 10 ) || 0,
+ curLeft = parseInt( $.curCSS( elem, "left", true ), 10) || 0,
+ props = {
+ top: (options.top - curOffset.top) + curTop,
+ left: (options.left - curOffset.left) + curLeft
+ };
+
+ if ( 'using' in options ) {
+ options.using.call( elem, props );
+ } else {
+ curElem.css( props );
+ }
+ };
+
+ $.fn.offset = function( options ) {
+ var elem = this[ 0 ];
+ if ( !elem || !elem.ownerDocument ) { return null; }
+ if ( options ) {
+ return this.each(function() {
+ $.offset.setOffset( this, options );
+ });
+ }
+ return _offset.call( this );
+ };
+}
+
+}( jQuery ));
+/*
+ * jQuery UI Draggable 1.8.16
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
* http://docs.jquery.com/UI/Draggables
*
* Depends:
@@ -796,6 +1075,18 @@
this.handle = this._getHandle(event);
if (!this.handle)
return false;
+
+ if ( o.iframeFix ) {
+ $(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() {
+ $('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>')
+ .css({
+ width: this.offsetWidth+"px", height: this.offsetHeight+"px",
+ position: "absolute", opacity: "0.001", zIndex: 1000
+ })
+ .css($(this).offset())
+ .appendTo("body");
+ });
+ }
return true;
@@ -870,6 +1161,10 @@
this.helper.addClass("ui-draggable-dragging");
this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position
+
+ //If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003)
+ if ( $.ui.ddmanager ) $.ui.ddmanager.dragStart(this, event);
+
return true;
},
@@ -909,8 +1204,8 @@
this.dropped = false;
}
- //if the original element is removed, don't bother to continue
- if(!this.element[0] || !this.element[0].parentNode)
+ //if the original element is removed, don't bother to continue if helper is set to "original"
+ if((!this.element[0] || !this.element[0].parentNode) && this.options.helper == "original")
return false;
if((this.options.revert == "invalid" && !dropped) || (this.options.revert == "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) {
@@ -929,6 +1224,19 @@
return false;
},
+ _mouseUp: function(event) {
+ if (this.options.iframeFix === true) {
+ $("div.ui-draggable-iframeFix").each(function() {
+ this.parentNode.removeChild(this);
+ }); //Remove frame helpers
+ }
+
+ //If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003)
+ if( $.ui.ddmanager ) $.ui.ddmanager.dragStop(this, event);
+
+ return $.ui.mouse.prototype._mouseUp.call(this, event);
+ },
+
cancel: function() {
if(this.helper.is(".ui-draggable-dragging")) {
@@ -958,7 +1266,7 @@
_createHelper: function(event) {
var o = this.options;
- var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event])) : (o.helper == 'clone' ? this.element.clone() : this.element);
+ var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event])) : (o.helper == 'clone' ? this.element.clone().removeAttr('id') : this.element);
if(!helper.parents('body').length)
helper.appendTo((o.appendTo == 'parent' ? this.element[0].parentNode : o.appendTo));
@@ -1034,7 +1342,9 @@
_cacheMargins: function() {
this.margins = {
left: (parseInt(this.element.css("marginLeft"),10) || 0),
- top: (parseInt(this.element.css("marginTop"),10) || 0)
+ top: (parseInt(this.element.css("marginTop"),10) || 0),
+ right: (parseInt(this.element.css("marginRight"),10) || 0),
+ bottom: (parseInt(this.element.css("marginBottom"),10) || 0)
};
},
@@ -1050,23 +1360,26 @@
var o = this.options;
if(o.containment == 'parent') o.containment = this.helper[0].parentNode;
if(o.containment == 'document' || o.containment == 'window') this.containment = [
- 0 - this.offset.relative.left - this.offset.parent.left,
- 0 - this.offset.relative.top - this.offset.parent.top,
- $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left,
- ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
+ o.containment == 'document' ? 0 : $(window).scrollLeft() - this.offset.relative.left - this.offset.parent.left,
+ o.containment == 'document' ? 0 : $(window).scrollTop() - this.offset.relative.top - this.offset.parent.top,
+ (o.containment == 'document' ? 0 : $(window).scrollLeft()) + $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left,
+ (o.containment == 'document' ? 0 : $(window).scrollTop()) + ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
];
if(!(/^(document|window|parent)$/).test(o.containment) && o.containment.constructor != Array) {
- var ce = $(o.containment)[0]; if(!ce) return;
- var co = $(o.containment).offset();
+ var c = $(o.containment);
+ var ce = c[0]; if(!ce) return;
+ var co = c.offset();
var over = ($(ce).css("overflow") != 'hidden');
this.containment = [
- co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left,
- co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top,
- co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left,
- co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top
+ (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0),
+ (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0),
+ (over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left - this.margins.right,
+ (over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top - this.margins.bottom
];
+ this.relative_container = c;
+
} else if(o.containment.constructor == Array) {
this.containment = o.containment;
}
@@ -1108,20 +1421,32 @@
*/
if(this.originalPosition) { //If we are not dragging yet, we won't check for options
+ var containment;
+ if(this.containment) {
+ if (this.relative_container){
+ var co = this.relative_container.offset();
+ containment = [ this.containment[0] + co.left,
+ this.containment[1] + co.top,
+ this.containment[2] + co.left,
+ this.containment[3] + co.top ];
+ }
+ else {
+ containment = this.containment;
+ }
- if(this.containment) {
- if(event.pageX - this.offset.click.left < this.containment[0]) pageX = this.containment[0] + this.offset.click.left;
- if(event.pageY - this.offset.click.top < this.containment[1]) pageY = this.containment[1] + this.offset.click.top;
- if(event.pageX - this.offset.click.left > this.containment[2]) pageX = this.containment[2] + this.offset.click.left;
- if(event.pageY - this.offset.click.top > this.containment[3]) pageY = this.containment[3] + this.offset.click.top;
+ if(event.pageX - this.offset.click.left < containment[0]) pageX = containment[0] + this.offset.click.left;
+ if(event.pageY - this.offset.click.top < containment[1]) pageY = containment[1] + this.offset.click.top;
+ if(event.pageX - this.offset.click.left > containment[2]) pageX = containment[2] + this.offset.click.left;
+ if(event.pageY - this.offset.click.top > containment[3]) pageY = containment[3] + this.offset.click.top;
}
if(o.grid) {
- var top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1];
- pageY = this.containment ? (!(top - this.offset.click.top < this.containment[1] || top - this.offset.click.top > this.containment[3]) ? top : (!(top - this.offset.click.top < this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
+ //Check for grid elements set to 0 to prevent divide by 0 error causing invalid argument errors in IE (see ticket #6950)
+ var top = o.grid[1] ? this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY;
+ pageY = containment ? (!(top - this.offset.click.top < containment[1] || top - this.offset.click.top > containment[3]) ? top : (!(top - this.offset.click.top < containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
- var left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0];
- pageX = this.containment ? (!(left - this.offset.click.left < this.containment[0] || left - this.offset.click.left > this.containment[2]) ? left : (!(left - this.offset.click.left < this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
+ var left = o.grid[0] ? this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : this.originalPageX;
+ pageX = containment ? (!(left - this.offset.click.left < containment[0] || left - this.offset.click.left > containment[2]) ? left : (!(left - this.offset.click.left < containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
}
}
@@ -1176,7 +1501,7 @@
});
$.extend($.ui.draggable, {
- version: "1.8.6"
+ version: "1.8.16"
});
$.ui.plugin.add("draggable", "connectToSortable", {
@@ -1192,7 +1517,7 @@
instance: sortable,
shouldRevert: sortable.options.revert
});
- sortable._refreshItems(); //Do a one-time refresh at start to refresh the containerCache
+ sortable.refreshPositions(); // Call the sortable's refreshPositions at drag start to refresh the containerCache since the sortable container cache is used in drag and needs to be up to date (this will ensure it's initialised as well as being kept in step with any changes that might have happened on the page).
sortable._trigger("activate", event, uiSortable);
}
});
@@ -1261,7 +1586,7 @@
//Now we fake the start of dragging for the sortable instance,
//by cloning the list group item, appending it to the sortable and using it as inst.currentItem
//We can then fire the start event of the sortable with our passed browser event, and our own helper (so it doesn't create a new one)
- this.instance.currentItem = $(self).clone().appendTo(this.instance.element).data("sortable-item", true);
+ this.instance.currentItem = $(self).clone().removeAttr('id').appendTo(this.instance.element).data("sortable-item", true);
this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it
this.instance.options.helper = function() { return ui.helper[0]; };
@@ -1331,24 +1656,6 @@
}
});
-$.ui.plugin.add("draggable", "iframeFix", {
- start: function(event, ui) {
- var o = $(this).data('draggable').options;
- $(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() {
- $('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>')
- .css({
- width: this.offsetWidth+"px", height: this.offsetHeight+"px",
- position: "absolute", opacity: "0.001", zIndex: 1000
- })
- .css($(this).offset())
- .appendTo("body");
- });
- },
- stop: function(event, ui) {
- $("div.ui-draggable-iframeFix").each(function() { this.parentNode.removeChild(this); }); //Remove frame helpers
- }
-});
-
$.ui.plugin.add("draggable", "opacity", {
start: function(event, ui) {
var t = $(ui.helper), o = $(this).data('draggable').options;
@@ -1513,9 +1820,9 @@
})(jQuery);
/*
- * jQuery UI Droppable 1.8.6
+ * jQuery UI Droppable 1.8.16
*
- * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
@@ -1661,7 +1968,7 @@
});
$.extend($.ui.droppable, {
- version: "1.8.6"
+ version: "1.8.16"
});
$.ui.intersect = function(draggable, droppable, toleranceMode) {
@@ -1726,11 +2033,11 @@
for (var j=0; j < list.length; j++) { if(list[j] == m[i].element[0]) { m[i].proportions.height = 0; continue droppablesLoop; } }; //Filter out elements in the current dragged item
m[i].visible = m[i].element.css("display") != "none"; if(!m[i].visible) continue; //If the element is not visible, continue
+ if(type == "mousedown") m[i]._activate.call(m[i], event); //Activate the droppable if used directly from draggables
+
m[i].offset = m[i].element.offset();
m[i].proportions = { width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight };
- if(type == "mousedown") m[i]._activate.call(m[i], event); //Activate the droppable if used directly from draggables
-
}
},
@@ -1752,6 +2059,12 @@
return dropped;
},
+ dragStart: function( draggable, event ) {
+ //Listen for scrolling so that if the dragging causes scrolling the position of the droppables can be recalculated (see #5003)
+ draggable.element.parents( ":not(body,html)" ).bind( "scroll.droppable", function() {
+ if( !draggable.options.refreshPositions ) $.ui.ddmanager.prepareOffsets( draggable, event );
+ });
+ },
drag: function(draggable, event) {
//If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse.
@@ -1793,14 +2106,19 @@
}
});
+ },
+ dragStop: function( draggable, event ) {
+ draggable.element.parents( ":not(body,html)" ).unbind( "scroll.droppable" );
+ //Call prepareOffsets one final time since IE does not fire return scroll events when overflow was caused by drag (see #5003)
+ if( !draggable.options.refreshPositions ) $.ui.ddmanager.prepareOffsets( draggable, event );
}
};
})(jQuery);
/*
- * jQuery UI Resizable 1.8.6
+ * jQuery UI Resizable 1.8.16
*
- * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
@@ -1975,10 +2293,12 @@
$(this.element)
.addClass("ui-resizable-autohide")
.hover(function() {
+ if (o.disabled) return;
$(this).removeClass("ui-resizable-autohide");
self._handles.show();
},
function(){
+ if (o.disabled) return;
if (!self.resizing) {
$(this).addClass("ui-resizable-autohide");
self._handles.hide();
@@ -2090,6 +2410,8 @@
// Calculate the attrs that will be change
var data = trigger.apply(this, [event, dx, dy]), ie6 = $.browser.msie && $.browser.version < 7, csdif = this.sizeDiff;
+ // Put this in the mouseDrag handler since the user can start pressing shift while resizing
+ this._updateVirtualBoundaries(event.shiftKey);
if (this._aspectRatio || event.shiftKey)
data = this._updateRatio(data, event);
@@ -2121,10 +2443,10 @@
if(this._helper) {
var pr = this._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName),
- soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height,
- soffsetw = ista ? 0 : self.sizeDiff.width;
+ soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height,
+ soffsetw = ista ? 0 : self.sizeDiff.width;
- var s = { width: (self.size.width - soffsetw), height: (self.size.height - soffseth) },
+ var s = { width: (self.helper.width() - soffsetw), height: (self.helper.height() - soffseth) },
left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null,
top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null;
@@ -2148,6 +2470,32 @@
},
+ _updateVirtualBoundaries: function(forceAspectRatio) {
+ var o = this.options, pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b;
+
+ b = {
+ minWidth: isNumber(o.minWidth) ? o.minWidth : 0,
+ maxWidth: isNumber(o.maxWidth) ? o.maxWidth : Infinity,
+ minHeight: isNumber(o.minHeight) ? o.minHeight : 0,
+ maxHeight: isNumber(o.maxHeight) ? o.maxHeight : Infinity
+ };
+
+ if(this._aspectRatio || forceAspectRatio) {
+ // We want to create an enclosing box whose aspect ration is the requested one
+ // First, compute the "projected" size for each dimension based on the aspect ratio and other dimension
+ pMinWidth = b.minHeight * this.aspectRatio;
+ pMinHeight = b.minWidth / this.aspectRatio;
+ pMaxWidth = b.maxHeight * this.aspectRatio;
+ pMaxHeight = b.maxWidth / this.aspectRatio;
+
+ if(pMinWidth > b.minWidth) b.minWidth = pMinWidth;
+ if(pMinHeight > b.minHeight) b.minHeight = pMinHeight;
+ if(pMaxWidth < b.maxWidth) b.maxWidth = pMaxWidth;
+ if(pMaxHeight < b.maxHeight) b.maxHeight = pMaxHeight;
+ }
+ this._vBoundaries = b;
+ },
+
_updateCache: function(data) {
var o = this.options;
this.offset = this.helper.offset();
@@ -2161,8 +2509,8 @@
var o = this.options, cpos = this.position, csize = this.size, a = this.axis;
- if (data.height) data.width = (csize.height * this.aspectRatio);
- else if (data.width) data.height = (csize.width / this.aspectRatio);
+ if (isNumber(data.height)) data.width = (data.height * this.aspectRatio);
+ else if (isNumber(data.width)) data.height = (data.width / this.aspectRatio);
if (a == 'sw') {
data.left = cpos.left + (csize.width - data.width);
@@ -2178,7 +2526,7 @@
_respectSize: function(data, event) {
- var el = this.helper, o = this.options, pRatio = this._aspectRatio || event.shiftKey, a = this.axis,
+ var el = this.helper, o = this._vBoundaries, pRatio = this._aspectRatio || event.shiftKey, a = this.axis,
ismaxw = isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width), ismaxh = isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height),
isminw = isNumber(data.width) && o.minWidth && (o.minWidth > data.width), isminh = isNumber(data.height) && o.minHeight && (o.minHeight > data.height);
@@ -2318,7 +2666,7 @@
});
$.extend($.ui.resizable, {
- version: "1.8.6"
+ version: "1.8.16"
});
/*
@@ -2610,9 +2958,9 @@
})(jQuery);
/*
- * jQuery UI Selectable 1.8.6
+ * jQuery UI Selectable 1.8.16
*
- * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
@@ -2871,14 +3219,14 @@
});
$.extend($.ui.selectable, {
- version: "1.8.6"
+ version: "1.8.16"
});
})(jQuery);
/*
- * jQuery UI Sortable 1.8.6
+ * jQuery UI Sortable 1.8.16
*
- * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
@@ -2926,8 +3274,8 @@
//Get the items
this.refresh();
- //Let's determine if the items are floating
- this.floating = this.items.length ? (/left|right/).test(this.items[0].item.css('float')) : false;
+ //Let's determine if the items are being displayed horizontally
+ this.floating = this.items.length ? o.axis === 'x' || (/left|right/).test(this.items[0].item.css('float')) || (/inline|table-cell/).test(this.items[0].item.css('display')) : false;
//Let's determine the parent's offset
this.offset = this.element.offset();
@@ -3237,7 +3585,7 @@
if(this.dragging) {
- this._mouseUp();
+ this._mouseUp({ target: null });
if(this.options.helper == "original")
this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
@@ -3255,21 +3603,23 @@
}
- //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
- if(this.placeholder[0].parentNode) this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
- if(this.options.helper != "original" && this.helper && this.helper[0].parentNode) this.helper.remove();
+ if (this.placeholder) {
+ //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
+ if(this.placeholder[0].parentNode) this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
+ if(this.options.helper != "original" && this.helper && this.helper[0].parentNode) this.helper.remove();
- $.extend(this, {
- helper: null,
- dragging: false,
- reverting: false,
- _noFinalSort: null
- });
+ $.extend(this, {
+ helper: null,
+ dragging: false,
+ reverting: false,
+ _noFinalSort: null
+ });
- if(this.domPosition.prev) {
- $(this.domPosition.prev).after(this.currentItem);
- } else {
- $(this.domPosition.parent).prepend(this.currentItem);
+ if(this.domPosition.prev) {
+ $(this.domPosition.prev).after(this.currentItem);
+ } else {
+ $(this.domPosition.parent).prepend(this.currentItem);
+ }
}
return this;
@@ -3490,6 +3840,10 @@
for (var i = this.items.length - 1; i >= 0; i--){
var item = this.items[i];
+ //We ignore calculating positions of all connected containers when we're not over them
+ if(item.instance != this.currentContainer && this.currentContainer && item.item[0] != this.currentItem[0])
+ continue;
+
var t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item;
if (!fast) {
@@ -3855,7 +4209,7 @@
// We first have to update the dom position of the actual currentItem
// Note: don't do it if the current item is already removed (by a user), or it gets reappended (see #4088)
- if(!this._noFinalSort && this.currentItem[0].parentNode) this.placeholder.before(this.currentItem);
+ if(!this._noFinalSort && this.currentItem.parent().length) this.placeholder.before(this.currentItem);
this._noFinalSort = null;
if(this.helper[0] == this.currentItem[0]) {
@@ -3942,1587 +4296,17 @@
});
$.extend($.ui.sortable, {
- version: "1.8.6"
+ version: "1.8.16"
});
})(jQuery);
/*
- * jQuery UI Effects 1.8.6
+ * jQuery UI Accordion 1.8.16
*
- * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
- * http://docs.jquery.com/UI/Effects/
- */
-;jQuery.effects || (function($, undefined) {
-
-$.effects = {};
-
-
-
-/******************************************************************************/
-/****************************** COLOR ANIMATIONS ******************************/
-/******************************************************************************/
-
-// override the animation for color styles
-$.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor',
- 'borderRightColor', 'borderTopColor', 'borderColor', 'color', 'outlineColor'],
-function(i, attr) {
- $.fx.step[attr] = function(fx) {
- if (!fx.colorInit) {
- fx.start = getColor(fx.elem, attr);
- fx.end = getRGB(fx.end);
- fx.colorInit = true;
- }
-
- fx.elem.style[attr] = 'rgb(' +
- Math.max(Math.min(parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0], 10), 255), 0) + ',' +
- Math.max(Math.min(parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1], 10), 255), 0) + ',' +
- Math.max(Math.min(parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2], 10), 255), 0) + ')';
- };
-});
-
-// Color Conversion functions from highlightFade
-// By Blair Mitchelmore
-// http://jquery.offput.ca/highlightFade/
-
-// Parse strings looking for color tuples [255,255,255]
-function getRGB(color) {
- var result;
-
- // Check if we're already dealing with an array of colors
- if ( color && color.constructor == Array && color.length == 3 )
- return color;
-
- // Look for rgb(num,num,num)
- if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
- return [parseInt(result[1],10), parseInt(result[2],10), parseInt(result[3],10)];
-
- // Look for rgb(num%,num%,num%)
- if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
- return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];
-
- // Look for #a0b1c2
- if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
- return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];
-
- // Look for #fff
- if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
- return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];
-
- // Look for rgba(0, 0, 0, 0) == transparent in Safari 3
- if (result = /rgba\(0, 0, 0, 0\)/.exec(color))
- return colors['transparent'];
-
- // Otherwise, we're most likely dealing with a named color
- return colors[$.trim(color).toLowerCase()];
-}
-
-function getColor(elem, attr) {
- var color;
-
- do {
- color = $.curCSS(elem, attr);
-
- // Keep going until we find an element that has color, or we hit the body
- if ( color != '' && color != 'transparent' || $.nodeName(elem, "body") )
- break;
-
- attr = "backgroundColor";
- } while ( elem = elem.parentNode );
-
- return getRGB(color);
-};
-
-// Some named colors to work with
-// From Interface by Stefan Petre
-// http://interface.eyecon.ro/
-
-var colors = {
- aqua:[0,255,255],
- azure:[240,255,255],
- beige:[245,245,220],
- black:[0,0,0],
- blue:[0,0,255],
- brown:[165,42,42],
- cyan:[0,255,255],
- darkblue:[0,0,139],
- darkcyan:[0,139,139],
- darkgrey:[169,169,169],
- darkgreen:[0,100,0],
- darkkhaki:[189,183,107],
- darkmagenta:[139,0,139],
- darkolivegreen:[85,107,47],
- darkorange:[255,140,0],
- darkorchid:[153,50,204],
- darkred:[139,0,0],
- darksalmon:[233,150,122],
- darkviolet:[148,0,211],
- fuchsia:[255,0,255],
- gold:[255,215,0],
- green:[0,128,0],
- indigo:[75,0,130],
- khaki:[240,230,140],
- lightblue:[173,216,230],
- lightcyan:[224,255,255],
- lightgreen:[144,238,144],
- lightgrey:[211,211,211],
- lightpink:[255,182,193],
- lightyellow:[255,255,224],
- lime:[0,255,0],
- magenta:[255,0,255],
- maroon:[128,0,0],
- navy:[0,0,128],
- olive:[128,128,0],
- orange:[255,165,0],
- pink:[255,192,203],
- purple:[128,0,128],
- violet:[128,0,128],
- red:[255,0,0],
- silver:[192,192,192],
- white:[255,255,255],
- yellow:[255,255,0],
- transparent: [255,255,255]
-};
-
-
-
-/******************************************************************************/
-/****************************** CLASS ANIMATIONS ******************************/
-/******************************************************************************/
-
-var classAnimationActions = ['add', 'remove', 'toggle'],
- shorthandStyles = {
- border: 1,
- borderBottom: 1,
- borderColor: 1,
- borderLeft: 1,
- borderRight: 1,
- borderTop: 1,
- borderWidth: 1,
- margin: 1,
- padding: 1
- };
-
-function getElementStyles() {
- var style = document.defaultView
- ? document.defaultView.getComputedStyle(this, null)
- : this.currentStyle,
- newStyle = {},
- key,
- camelCase;
-
- // webkit enumerates style porperties
- if (style && style.length && style[0] && style[style[0]]) {
- var len = style.length;
- while (len--) {
- key = style[len];
- if (typeof style[key] == 'string') {
- camelCase = key.replace(/\-(\w)/g, function(all, letter){
- return letter.toUpperCase();
- });
- newStyle[camelCase] = style[key];
- }
- }
- } else {
- for (key in style) {
- if (typeof style[key] === 'string') {
- newStyle[key] = style[key];
- }
- }
- }
-
- return newStyle;
-}
-
-function filterStyles(styles) {
- var name, value;
- for (name in styles) {
- value = styles[name];
- if (
- // ignore null and undefined values
- value == null ||
- // ignore functions (when does this occur?)
- $.isFunction(value) ||
- // shorthand styles that need to be expanded
- name in shorthandStyles ||
- // ignore scrollbars (break in IE)
- (/scrollbar/).test(name) ||
-
- // only colors or values that can be converted to numbers
- (!(/color/i).test(name) && isNaN(parseFloat(value)))
- ) {
- delete styles[name];
- }
- }
-
- return styles;
-}
-
-function styleDifference(oldStyle, newStyle) {
- var diff = { _: 0 }, // http://dev.jquery.com/ticket/5459
- name;
-
- for (name in newStyle) {
- if (oldStyle[name] != newStyle[name]) {
- diff[name] = newStyle[name];
- }
- }
-
- return diff;
-}
-
-$.effects.animateClass = function(value, duration, easing, callback) {
- if ($.isFunction(easing)) {
- callback = easing;
- easing = null;
- }
-
- return this.each(function() {
-
- var that = $(this),
- originalStyleAttr = that.attr('style') || ' ',
- originalStyle = filterStyles(getElementStyles.call(this)),
- newStyle,
- className = that.attr('className');
-
- $.each(classAnimationActions, function(i, action) {
- if (value[action]) {
- that[action + 'Class'](value[action]);
- }
- });
- newStyle = filterStyles(getElementStyles.call(this));
- that.attr('className', className);
-
- that.animate(styleDifference(originalStyle, newStyle), duration, easing, function() {
- $.each(classAnimationActions, function(i, action) {
- if (value[action]) { that[action + 'Class'](value[action]); }
- });
- // work around bug in IE by clearing the cssText before setting it
- if (typeof that.attr('style') == 'object') {
- that.attr('style').cssText = '';
- that.attr('style').cssText = originalStyleAttr;
- } else {
- that.attr('style', originalStyleAttr);
- }
- if (callback) { callback.apply(this, arguments); }
- });
- });
-};
-
-$.fn.extend({
- _addClass: $.fn.addClass,
- addClass: function(classNames, speed, easing, callback) {
- return speed ? $.effects.animateClass.apply(this, [{ add: classNames },speed,easing,callback]) : this._addClass(classNames);
- },
-
- _removeClass: $.fn.removeClass,
- removeClass: function(classNames,speed,easing,callback) {
- return speed ? $.effects.animateClass.apply(this, [{ remove: classNames },speed,easing,callback]) : this._removeClass(classNames);
- },
-
- _toggleClass: $.fn.toggleClass,
- toggleClass: function(classNames, force, speed, easing, callback) {
- if ( typeof force == "boolean" || force === undefined ) {
- if ( !speed ) {
- // without speed parameter;
- return this._toggleClass(classNames, force);
- } else {
- return $.effects.animateClass.apply(this, [(force?{add:classNames}:{remove:classNames}),speed,easing,callback]);
- }
- } else {
- // without switch parameter;
- return $.effects.animateClass.apply(this, [{ toggle: classNames },force,speed,easing]);
- }
- },
-
- switchClass: function(remove,add,speed,easing,callback) {
- return $.effects.animateClass.apply(this, [{ add: add, remove: remove },speed,easing,callback]);
- }
-});
-
-
-
-/******************************************************************************/
-/*********************************** EFFECTS **********************************/
-/******************************************************************************/
-
-$.extend($.effects, {
- version: "1.8.6",
-
- // Saves a set of properties in a data storage
- save: function(element, set) {
- for(var i=0; i < set.length; i++) {
- if(set[i] !== null) element.data("ec.storage."+set[i], element[0].style[set[i]]);
- }
- },
-
- // Restores a set of previously saved properties from a data storage
- restore: function(element, set) {
- for(var i=0; i < set.length; i++) {
- if(set[i] !== null) element.css(set[i], element.data("ec.storage."+set[i]));
- }
- },
-
- setMode: function(el, mode) {
- if (mode == 'toggle') mode = el.is(':hidden') ? 'show' : 'hide'; // Set for toggle
- return mode;
- },
-
- getBaseline: function(origin, original) { // Translates a [top,left] array into a baseline value
- // this should be a little more flexible in the future to handle a string & hash
- var y, x;
- switch (origin[0]) {
- case 'top': y = 0; break;
- case 'middle': y = 0.5; break;
- case 'bottom': y = 1; break;
- default: y = origin[0] / original.height;
- };
- switch (origin[1]) {
- case 'left': x = 0; break;
- case 'center': x = 0.5; break;
- case 'right': x = 1; break;
- default: x = origin[1] / original.width;
- };
- return {x: x, y: y};
- },
-
- // Wraps the element around a wrapper that copies position properties
- createWrapper: function(element) {
-
- // if the element is already wrapped, return it
- if (element.parent().is('.ui-effects-wrapper')) {
- return element.parent();
- }
-
- // wrap the element
- var props = {
- width: element.outerWidth(true),
- height: element.outerHeight(true),
- 'float': element.css('float')
- },
- wrapper = $('<div></div>')
- .addClass('ui-effects-wrapper')
- .css({
- fontSize: '100%',
- background: 'transparent',
- border: 'none',
- margin: 0,
- padding: 0
- });
-
- element.wrap(wrapper);
- wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually loose the reference to the wrapped element
-
- // transfer positioning properties to the wrapper
- if (element.css('position') == 'static') {
- wrapper.css({ position: 'relative' });
- element.css({ position: 'relative' });
- } else {
- $.extend(props, {
- position: element.css('position'),
- zIndex: element.css('z-index')
- });
- $.each(['top', 'left', 'bottom', 'right'], function(i, pos) {
- props[pos] = element.css(pos);
- if (isNaN(parseInt(props[pos], 10))) {
- props[pos] = 'auto';
- }
- });
- element.css({position: 'relative', top: 0, left: 0 });
- }
-
- return wrapper.css(props).show();
- },
-
- removeWrapper: function(element) {
- if (element.parent().is('.ui-effects-wrapper'))
- return element.parent().replaceWith(element);
- return element;
- },
-
- setTransition: function(element, list, factor, value) {
- value = value || {};
- $.each(list, function(i, x){
- unit = element.cssUnit(x);
- if (unit[0] > 0) value[x] = unit[0] * factor + unit[1];
- });
- return value;
- }
-});
-
-
-function _normalizeArguments(effect, options, speed, callback) {
- // shift params for method overloading
- if (typeof effect == 'object') {
- callback = options;
- speed = null;
- options = effect;
- effect = options.effect;
- }
- if ($.isFunction(options)) {
- callback = options;
- speed = null;
- options = {};
- }
- if (typeof options == 'number' || $.fx.speeds[options]) {
- callback = speed;
- speed = options;
- options = {};
- }
- if ($.isFunction(speed)) {
- callback = speed;
- speed = null;
- }
-
- options = options || {};
-
- speed = speed || options.duration;
- speed = $.fx.off ? 0 : typeof speed == 'number'
- ? speed : $.fx.speeds[speed] || $.fx.speeds._default;
-
- callback = callback || options.complete;
-
- return [effect, options, speed, callback];
-}
-
-function standardSpeed( speed ) {
- // valid standard speeds
- if ( !speed || typeof speed === "number" || $.fx.speeds[ speed ] ) {
- return true;
- }
-
- // invalid strings - treat as "normal" speed
- if ( typeof speed === "string" && !$.effects[ speed ] ) {
- return true;
- }
-
- return false;
-}
-
-$.fn.extend({
- effect: function(effect, options, speed, callback) {
- var args = _normalizeArguments.apply(this, arguments),
- // TODO: make effects take actual parameters instead of a hash
- args2 = {
- options: args[1],
- duration: args[2],
- callback: args[3]
- },
- mode = args2.options.mode,
- effectMethod = $.effects[effect];
-
- if ( $.fx.off || !effectMethod ) {
- // delegate to the original method (e.g., .show()) if possible
- if ( mode ) {
- return this[ mode ]( args2.duration, args2.callback );
- } else {
- return this.each(function() {
- if ( args2.callback ) {
- args2.callback.call( this );
- }
- });
- }
- }
-
- return effectMethod.call(this, args2);
- },
-
- _show: $.fn.show,
- show: function(speed) {
- if ( standardSpeed( speed ) ) {
- return this._show.apply(this, arguments);
- } else {
- var args = _normalizeArguments.apply(this, arguments);
- args[1].mode = 'show';
- return this.effect.apply(this, args);
- }
- },
-
- _hide: $.fn.hide,
- hide: function(speed) {
- if ( standardSpeed( speed ) ) {
- return this._hide.apply(this, arguments);
- } else {
- var args = _normalizeArguments.apply(this, arguments);
- args[1].mode = 'hide';
- return this.effect.apply(this, args);
- }
- },
-
- // jQuery core overloads toggle and creates _toggle
- __toggle: $.fn.toggle,
- toggle: function(speed) {
- if ( standardSpeed( speed ) || typeof speed === "boolean" || $.isFunction( speed ) ) {
- return this.__toggle.apply(this, arguments);
- } else {
- var args = _normalizeArguments.apply(this, arguments);
- args[1].mode = 'toggle';
- return this.effect.apply(this, args);
- }
- },
-
- // helper functions
- cssUnit: function(key) {
- var style = this.css(key), val = [];
- $.each( ['em','px','%','pt'], function(i, unit){
- if(style.indexOf(unit) > 0)
- val = [parseFloat(style), unit];
- });
- return val;
- }
-});
-
-
-
-/******************************************************************************/
-/*********************************** EASING ***********************************/
-/******************************************************************************/
-
-/*
- * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
- *
- * Uses the built in easing capabilities added In jQuery 1.1
- * to offer multiple easing options
- *
- * TERMS OF USE - jQuery Easing
- *
- * Open source under the BSD License.
- *
- * Copyright 2008 George McGinley Smith
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this list of
- * conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice, this list
- * of conditions and the following disclaimer in the documentation and/or other materials
- * provided with the distribution.
- *
- * Neither the name of the author nor the names of contributors may be used to endorse
- * or promote products derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
- * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
-*/
-
-// t: current time, b: begInnIng value, c: change In value, d: duration
-$.easing.jswing = $.easing.swing;
-
-$.extend($.easing,
-{
- def: 'easeOutQuad',
- swing: function (x, t, b, c, d) {
- //alert($.easing.default);
- return $.easing[$.easing.def](x, t, b, c, d);
- },
- easeInQuad: function (x, t, b, c, d) {
- return c*(t/=d)*t + b;
- },
- easeOutQuad: function (x, t, b, c, d) {
- return -c *(t/=d)*(t-2) + b;
- },
- easeInOutQuad: function (x, t, b, c, d) {
- if ((t/=d/2) < 1) return c/2*t*t + b;
- return -c/2 * ((--t)*(t-2) - 1) + b;
- },
- easeInCubic: function (x, t, b, c, d) {
- return c*(t/=d)*t*t + b;
- },
- easeOutCubic: function (x, t, b, c, d) {
- return c*((t=t/d-1)*t*t + 1) + b;
- },
- easeInOutCubic: function (x, t, b, c, d) {
- if ((t/=d/2) < 1) return c/2*t*t*t + b;
- return c/2*((t-=2)*t*t + 2) + b;
- },
- easeInQuart: function (x, t, b, c, d) {
- return c*(t/=d)*t*t*t + b;
- },
- easeOutQuart: function (x, t, b, c, d) {
- return -c * ((t=t/d-1)*t*t*t - 1) + b;
- },
- easeInOutQuart: function (x, t, b, c, d) {
- if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
- return -c/2 * ((t-=2)*t*t*t - 2) + b;
- },
- easeInQuint: function (x, t, b, c, d) {
- return c*(t/=d)*t*t*t*t + b;
- },
- easeOutQuint: function (x, t, b, c, d) {
- return c*((t=t/d-1)*t*t*t*t + 1) + b;
- },
- easeInOutQuint: function (x, t, b, c, d) {
- if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
- return c/2*((t-=2)*t*t*t*t + 2) + b;
- },
- easeInSine: function (x, t, b, c, d) {
- return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
- },
- easeOutSine: function (x, t, b, c, d) {
- return c * Math.sin(t/d * (Math.PI/2)) + b;
- },
- easeInOutSine: function (x, t, b, c, d) {
- return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
- },
- easeInExpo: function (x, t, b, c, d) {
- return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
- },
- easeOutExpo: function (x, t, b, c, d) {
- return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
- },
- easeInOutExpo: function (x, t, b, c, d) {
- if (t==0) return b;
- if (t==d) return b+c;
- if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
- return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
- },
- easeInCirc: function (x, t, b, c, d) {
- return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
- },
- easeOutCirc: function (x, t, b, c, d) {
- return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
- },
- easeInOutCirc: function (x, t, b, c, d) {
- if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
- return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
- },
- easeInElastic: function (x, t, b, c, d) {
- var s=1.70158;var p=0;var a=c;
- if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
- if (a < Math.abs(c)) { a=c; var s=p/4; }
- else var s = p/(2*Math.PI) * Math.asin (c/a);
- return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
- },
- easeOutElastic: function (x, t, b, c, d) {
- var s=1.70158;var p=0;var a=c;
- if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
- if (a < Math.abs(c)) { a=c; var s=p/4; }
- else var s = p/(2*Math.PI) * Math.asin (c/a);
- return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
- },
- easeInOutElastic: function (x, t, b, c, d) {
- var s=1.70158;var p=0;var a=c;
- if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
- if (a < Math.abs(c)) { a=c; var s=p/4; }
- else var s = p/(2*Math.PI) * Math.asin (c/a);
- if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
- return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
- },
- easeInBack: function (x, t, b, c, d, s) {
- if (s == undefined) s = 1.70158;
- return c*(t/=d)*t*((s+1)*t - s) + b;
- },
- easeOutBack: function (x, t, b, c, d, s) {
- if (s == undefined) s = 1.70158;
- return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
- },
- easeInOutBack: function (x, t, b, c, d, s) {
- if (s == undefined) s = 1.70158;
- if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
- return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
- },
- easeInBounce: function (x, t, b, c, d) {
- return c - $.easing.easeOutBounce (x, d-t, 0, c, d) + b;
- },
- easeOutBounce: function (x, t, b, c, d) {
- if ((t/=d) < (1/2.75)) {
- return c*(7.5625*t*t) + b;
- } else if (t < (2/2.75)) {
- return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
- } else if (t < (2.5/2.75)) {
- return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
- } else {
- return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
- }
- },
- easeInOutBounce: function (x, t, b, c, d) {
- if (t < d/2) return $.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
- return $.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
- }
-});
-
-/*
- *
- * TERMS OF USE - EASING EQUATIONS
- *
- * Open source under the BSD License.
- *
- * Copyright 2001 Robert Penner
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this list of
- * conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice, this list
- * of conditions and the following disclaimer in the documentation and/or other materials
- * provided with the distribution.
- *
- * Neither the name of the author nor the names of contributors may be used to endorse
- * or promote products derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
- * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE U...
[truncated message content] |
|
From: <ma...@us...> - 2011-12-12 12:46:08
|
Revision: 567
http://openautomation.svn.sourceforge.net/openautomation/?rev=567&view=rev
Author: mayerch
Date: 2011-12-12 12:45:56 +0000 (Mon, 12 Dec 2011)
Log Message:
-----------
Change jQuery to newest upstram version (1.7.1)
Modified Paths:
--------------
CometVisu/trunk/visu/lib/jquery.js
CometVisu/trunk/visu/lib/jquery.min.js
Modified: CometVisu/trunk/visu/lib/jquery.js
===================================================================
--- CometVisu/trunk/visu/lib/jquery.js 2011-12-11 22:08:49 UTC (rev 566)
+++ CometVisu/trunk/visu/lib/jquery.js 2011-12-12 12:45:56 UTC (rev 567)
@@ -1,28 +1,30 @@
/*!
- * jQuery JavaScript Library v1.4.4
+ * jQuery JavaScript Library v1.7.1
* http://jquery.com/
*
- * Copyright 2010, John Resig
+ * Copyright 2011, 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
+ * Copyright 2011, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses.
*
- * Date: Thu Nov 11 19:04:53 2010 -0500
+ * Date: Mon Nov 21 21:11:03 2011 -0500
*/
(function( window, undefined ) {
// Use the correct document accordingly with window argument (sandbox)
-var document = window.document;
+var document = window.document,
+ navigator = window.navigator,
+ location = window.location;
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 );
+ return new jQuery.fn.init( selector, context, rootjQuery );
},
// Map over jQuery in case of overwrite
@@ -35,26 +37,16 @@
rootjQuery,
// A simple way to check for HTML strings or ID strings
- // (both of which we optimize for)
- quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,
+ // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
+ 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>)?$/,
@@ -70,18 +62,24 @@
rmsie = /(msie) ([\w.]+)/,
rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
+ // Matches dashed string for camelizing
+ rdashAlpha = /-([a-z]|[0-9])/ig,
+ rmsPrefix = /^-ms-/,
+
+ // Used by jQuery.camelCase as callback to replace()
+ fcamelCase = function( all, letter ) {
+ return ( letter + "" ).toUpperCase();
+ },
+
// 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 deferred used on DOM ready
+ readyList,
+
// The ready event handler
DOMContentLoaded,
@@ -92,12 +90,13 @@
slice = Array.prototype.slice,
trim = String.prototype.trim,
indexOf = Array.prototype.indexOf,
-
+
// [[Class]] -> type pairs
class2type = {};
jQuery.fn = jQuery.prototype = {
- init: function( selector, context ) {
+ constructor: jQuery,
+ init: function( selector, context, rootjQuery ) {
var match, elem, ret, doc;
// Handle $(""), $(null), or $(undefined)
@@ -111,12 +110,12 @@
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.selector = selector;
this.length = 1;
return this;
}
@@ -124,14 +123,21 @@
// Handle HTML strings
if ( typeof selector === "string" ) {
// Are we dealing with HTML string or an ID?
- match = quickExpr.exec( selector );
+ if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
+ // Assume that strings that start and end with <> are HTML and skip the regex check
+ match = [ null, selector, null ];
+ } else {
+ 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);
+ context = context instanceof jQuery ? context[0] : context;
+ 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
@@ -148,11 +154,11 @@
} else {
ret = jQuery.buildFragment( [ match[1] ], [ doc ] );
- selector = (ret.cacheable ? ret.fragment.cloneNode(true) : ret.fragment).childNodes;
+ selector = ( ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment ).childNodes;
}
-
+
return jQuery.merge( this, selector );
-
+
// HANDLE: $("#id")
} else {
elem = document.getElementById( match[2] );
@@ -176,21 +182,14 @@
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 );
+ return ( context || rootjQuery ).find( selector );
// HANDLE: $(expr, context)
// (which is just equivalent to: $(context).find(expr)
} else {
- return jQuery( context ).find( selector );
+ return this.constructor( context ).find( selector );
}
// HANDLE: $(function)
@@ -199,7 +198,7 @@
return rootjQuery.ready( selector );
}
- if (selector.selector !== undefined) {
+ if ( selector.selector !== undefined ) {
this.selector = selector.selector;
this.context = selector.context;
}
@@ -211,7 +210,7 @@
selector: "",
// The current version of jQuery being used
- jquery: "1.4.4",
+ jquery: "1.7.1",
// The default length of a jQuery object is 0
length: 0,
@@ -234,18 +233,18 @@
this.toArray() :
// Return just the object
- ( num < 0 ? this.slice(num)[ 0 ] : this[ num ] );
+ ( num < 0 ? this[ this.length + num ] : 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();
+ var ret = this.constructor();
if ( jQuery.isArray( elems ) ) {
push.apply( ret, elems );
-
+
} else {
jQuery.merge( ret, elems );
}
@@ -256,7 +255,7 @@
ret.context = this.context;
if ( name === "find" ) {
- ret.selector = this.selector + (this.selector ? " " : "") + selector;
+ ret.selector = this.selector + ( this.selector ? " " : "" ) + selector;
} else if ( name ) {
ret.selector = this.selector + "." + name + "(" + selector + ")";
}
@@ -271,29 +270,22 @@
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 );
+ // Add the callback
+ readyList.add( fn );
- // Otherwise, remember the function for later
- } else if ( readyList ) {
- // Add the function to the wait list
- readyList.push( fn );
- }
-
return this;
},
-
+
eq: function( i ) {
+ i = +i;
return i === -1 ?
this.slice( i ) :
- this.slice( i, +i + 1 );
+ this.slice( i, i + 1 );
},
first: function() {
@@ -314,9 +306,9 @@
return callback.call( elem, i, elem );
}));
},
-
+
end: function() {
- return this.prevObject || jQuery(null);
+ return this.prevObject || this.constructor(null);
},
// For internal use only.
@@ -330,7 +322,7 @@
jQuery.fn.init.prototype = jQuery.fn;
jQuery.extend = jQuery.fn.extend = function() {
- var options, name, src, copy, copyIsArray, clone,
+ var options, name, src, copy, copyIsArray, clone,
target = arguments[0] || {},
i = 1,
length = arguments.length,
@@ -395,31 +387,37 @@
jQuery.extend({
noConflict: function( deep ) {
- window.$ = _$;
+ if ( window.$ === jQuery ) {
+ window.$ = _$;
+ }
- if ( deep ) {
+ if ( deep && window.jQuery === jQuery ) {
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,
-
+
+ // Hold (or release) the ready event
+ holdReady: function( hold ) {
+ if ( hold ) {
+ jQuery.readyWait++;
+ } else {
+ jQuery.ready( true );
+ }
+ },
+
// 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) ) {
+ // Either a released hold or an DOMready/load event and not yet ready
+ if ( (wait === true && !--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 );
@@ -434,33 +432,21 @@
}
// If there are functions bound, to execute
- if ( readyList ) {
- // Execute all of them
- var fn,
- i = 0,
- ready = readyList;
+ readyList.fireWith( document, [ jQuery ] );
- // 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" );
- }
+ // Trigger any bound ready events
+ if ( jQuery.fn.trigger ) {
+ jQuery( document ).trigger( "ready" ).off( "ready" );
}
}
},
-
+
bindReady: function() {
- if ( readyBound ) {
+ if ( readyList ) {
return;
}
- readyBound = true;
+ readyList = jQuery.Callbacks( "once memory" );
// Catch cases where $(document).ready() is called after the
// browser event has already occurred.
@@ -473,7 +459,7 @@
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 );
@@ -481,8 +467,8 @@
} else if ( document.attachEvent ) {
// ensure firing before onload,
// maybe late but safe also for iframes
- document.attachEvent("onreadystatechange", DOMContentLoaded);
-
+ document.attachEvent( "onreadystatechange", DOMContentLoaded );
+
// A fallback to window.onload, that will always work
window.attachEvent( "onload", jQuery.ready );
@@ -516,8 +502,8 @@
return obj && typeof obj === "object" && "setInterval" in obj;
},
- isNaN: function( obj ) {
- return obj == null || !rdigit.test( obj ) || isNaN( obj );
+ isNumeric: function( obj ) {
+ return !isNaN( parseFloat(obj) ) && isFinite( obj );
},
type: function( obj ) {
@@ -533,20 +519,25 @@
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") ) {
+
+ try {
+ // Not own constructor property must be Object
+ if ( obj.constructor &&
+ !hasOwn.call(obj, "constructor") &&
+ !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
+ return false;
+ }
+ } catch ( e ) {
+ // IE8,9 Will throw exceptions on certain host objects #9897
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 );
},
@@ -556,11 +547,11 @@
}
return true;
},
-
+
error: function( msg ) {
- throw msg;
+ throw new Error( msg );
},
-
+
parseJSON: function( data ) {
if ( typeof data !== "string" || !data ) {
return null;
@@ -568,48 +559,67 @@
// Make sure leading/trailing whitespace is removed (IE can't handle it)
data = jQuery.trim( data );
-
+
+ // Attempt to parse using the native JSON parser first
+ if ( window.JSON && window.JSON.parse ) {
+ return window.JSON.parse( 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, "")) ) {
+ 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))();
+ return ( new Function( "return " + data ) )();
- } else {
- jQuery.error( "Invalid JSON: " + data );
}
+ jQuery.error( "Invalid JSON: " + data );
},
+ // Cross-browser xml parsing
+ parseXML: function( data ) {
+ var xml, tmp;
+ try {
+ if ( window.DOMParser ) { // Standard
+ tmp = new DOMParser();
+ xml = tmp.parseFromString( data , "text/xml" );
+ } else { // IE
+ xml = new ActiveXObject( "Microsoft.XMLDOM" );
+ xml.async = "false";
+ xml.loadXML( data );
+ }
+ } catch( e ) {
+ xml = undefined;
+ }
+ if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
+ jQuery.error( "Invalid XML: " + data );
+ }
+ return xml;
+ },
+
noop: function() {},
- // Evalulates a script in a global context
+ // Evaluates a script in a global context
+ // Workarounds based on findings by Jim Driscoll
+ // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-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 );
+ if ( data && rnotwhite.test( data ) ) {
+ // We use execScript on Internet Explorer
+ // We use an anonymous function so that context is window
+ // rather than jQuery in Firefox
+ ( window.execScript || function( data ) {
+ window[ "eval" ].call( window, data );
+ } )( data );
}
},
+ // Convert dashed to camelCase; used by the css and data modules
+ // Microsoft forgot to hump their vendor prefix (#9572)
+ camelCase: function( string ) {
+ return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
+ },
+
nodeName: function( elem, name ) {
return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
},
@@ -618,7 +628,7 @@
each: function( object, callback, args ) {
var name, i = 0,
length = object.length,
- isObj = length === undefined || jQuery.isFunction(object);
+ isObj = length === undefined || jQuery.isFunction( object );
if ( args ) {
if ( isObj ) {
@@ -644,8 +654,11 @@
}
}
} else {
- for ( var value = object[0];
- i < length && callback.call( value, i, value ) !== false; value = object[++i] ) {}
+ for ( ; i < length; ) {
+ if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) {
+ break;
+ }
+ }
}
}
@@ -673,10 +686,8 @@
if ( array != null ) {
// The window, strings (and functions) also have 'length'
- // The extra typeof function check is to prevent crashes
- // in Safari 2 (See: #3039)
// Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
- var type = jQuery.type(array);
+ var type = jQuery.type( array );
if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) {
push.call( ret, array );
@@ -688,15 +699,23 @@
return ret;
},
- inArray: function( elem, array ) {
- if ( array.indexOf ) {
- return array.indexOf( elem );
- }
+ inArray: function( elem, array, i ) {
+ var len;
- for ( var i = 0, length = array.length; i < length; i++ ) {
- if ( array[ i ] === elem ) {
- return i;
+ if ( array ) {
+ if ( indexOf ) {
+ return indexOf.call( array, elem, i );
}
+
+ len = array.length;
+ i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
+
+ for ( ; i < len; i++ ) {
+ // Skip accessing in sparse arrays
+ if ( i in array && array[ i ] === elem ) {
+ return i;
+ }
+ }
}
return -1;
@@ -710,7 +729,7 @@
for ( var l = second.length; j < l; j++ ) {
first[ i++ ] = second[ j ];
}
-
+
} else {
while ( second[j] !== undefined ) {
first[ i++ ] = second[ j++ ];
@@ -740,57 +759,72 @@
// arg is for internal usage only
map: function( elems, callback, arg ) {
- var ret = [], value;
+ var value, key, ret = [],
+ i = 0,
+ length = elems.length,
+ // jquery objects are treated as arrays
+ isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ;
// Go through the array, translating each of the items to their
- // new value (or values).
- for ( var i = 0, length = elems.length; i < length; i++ ) {
- value = callback( elems[ i ], i, arg );
+ if ( isArray ) {
+ for ( ; i < length; i++ ) {
+ value = callback( elems[ i ], i, arg );
- if ( value != null ) {
- ret[ ret.length ] = value;
+ if ( value != null ) {
+ ret[ ret.length ] = value;
+ }
}
+
+ // Go through every key on the object,
+ } else {
+ for ( key in elems ) {
+ value = callback( elems[ key ], key, arg );
+
+ if ( value != null ) {
+ ret[ ret.length ] = value;
+ }
+ }
}
+ // Flatten any nested arrays
return ret.concat.apply( [], ret );
},
// A global GUID counter for objects
guid: 1,
- proxy: function( fn, proxy, thisObject ) {
- if ( arguments.length === 2 ) {
- if ( typeof proxy === "string" ) {
- thisObject = fn;
- fn = thisObject[ proxy ];
- proxy = undefined;
+ // Bind a function to a context, optionally partially applying any
+ // arguments.
+ proxy: function( fn, context ) {
+ if ( typeof context === "string" ) {
+ var tmp = fn[ context ];
+ context = fn;
+ fn = tmp;
+ }
- } else if ( proxy && !jQuery.isFunction( proxy ) ) {
- thisObject = proxy;
- proxy = undefined;
- }
+ // Quick check to determine if target is callable, in the spec
+ // this throws a TypeError, but we will just return undefined.
+ if ( !jQuery.isFunction( fn ) ) {
+ return undefined;
}
- if ( !proxy && fn ) {
+ // Simulated bind
+ var args = slice.call( arguments, 2 ),
proxy = function() {
- return fn.apply( thisObject || this, arguments );
+ return fn.apply( context, args.concat( slice.call( arguments ) ) );
};
- }
// Set the guid of unique handler to the same of original handler, so it can be removed
- if ( fn ) {
- proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;
- }
+ proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;
- // So proxy can be declared as an argument
return proxy;
},
// Mutifunctional method to get and set values to a collection
- // The value/s can be optionally by executed if its a function
+ // The value/s can optionally be executed if it's a function
access: function( elems, key, value, exec, fn, pass ) {
var length = elems.length;
-
+
// Setting many attributes
if ( typeof key === "object" ) {
for ( var k in key ) {
@@ -798,25 +832,25 @@
}
return elems;
}
-
+
// Setting one attribute
if ( value !== undefined ) {
// Optionally, function values get executed if exec is true
exec = !pass && exec && jQuery.isFunction(value);
-
+
for ( var i = 0; i < length; i++ ) {
fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
}
-
+
return elems;
}
-
+
// Getting an attribute
return length ? fn( elems[0], key ) : undefined;
},
now: function() {
- return (new Date()).getTime();
+ return ( new Date() ).getTime();
},
// Use of jQuery.browser is frowned upon.
@@ -833,6 +867,27 @@
return { browser: match[1] || "", version: match[2] || "0" };
},
+ sub: function() {
+ function jQuerySub( selector, context ) {
+ return new jQuerySub.fn.init( selector, context );
+ }
+ jQuery.extend( true, jQuerySub, this );
+ jQuerySub.superclass = this;
+ jQuerySub.fn = jQuerySub.prototype = this();
+ jQuerySub.fn.constructor = jQuerySub;
+ jQuerySub.sub = this.sub;
+ jQuerySub.fn.init = function init( selector, context ) {
+ if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {
+ context = jQuerySub( context );
+ }
+
+ return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
+ };
+ jQuerySub.fn.init.prototype = jQuerySub.fn;
+ var rootjQuerySub = jQuerySub(document);
+ return jQuerySub;
+ },
+
browser: {}
});
@@ -852,15 +907,8 @@
jQuery.browser.safari = true;
}
-if ( indexOf ) {
- jQuery.inArray = function( elem, array ) {
- return indexOf.call( array, elem );
- };
-}
-
-// Verify that \s matches non-breaking spaces
-// (IE fails on this test)
-if ( !rwhite.test( "\xA0" ) ) {
+// IE doesn't match non-breaking spaces with \s
+if ( rnotwhite.test( "\xA0" ) ) {
trimLeft = /^[\s\xA0]+/;
trimRight = /[\s\xA0]+$/;
}
@@ -904,37 +952,420 @@
jQuery.ready();
}
-// Expose jQuery to the global object
-return (window.jQuery = window.$ = jQuery);
+return jQuery;
})();
-(function() {
+// String to Object flags format cache
+var flagsCache = {};
- jQuery.support = {};
+// Convert String-formatted flags into Object-formatted ones and store in cache
+function createFlags( flags ) {
+ var object = flagsCache[ flags ] = {},
+ i, length;
+ flags = flags.split( /\s+/ );
+ for ( i = 0, length = flags.length; i < length; i++ ) {
+ object[ flags[i] ] = true;
+ }
+ return object;
+}
- var root = document.documentElement,
- script = document.createElement("script"),
- div = document.createElement("div"),
- id = "script" + jQuery.now();
+/*
+ * Create a callback list using the following parameters:
+ *
+ * flags: an optional list of space-separated flags that will change how
+ * the callback list behaves
+ *
+ * By default a callback list will act like an event callback list and can be
+ * "fired" multiple times.
+ *
+ * Possible flags:
+ *
+ * once: will ensure the callback list can only be fired once (like a Deferred)
+ *
+ * memory: will keep track of previous values and will call any callback added
+ * after the list has been fired right away with the latest "memorized"
+ * values (like a Deferred)
+ *
+ * unique: will ensure a callback can only be added once (no duplicate in the list)
+ *
+ * stopOnFalse: interrupt callings when a callback returns false
+ *
+ */
+jQuery.Callbacks = function( flags ) {
- div.style.display = "none";
- div.innerHTML = " <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
+ // Convert flags from String-formatted to Object-formatted
+ // (we check in cache first)
+ flags = flags ? ( flagsCache[ flags ] || createFlags( flags ) ) : {};
- var all = div.getElementsByTagName("*"),
- a = div.getElementsByTagName("a")[0],
- select = document.createElement("select"),
- opt = select.appendChild( document.createElement("option") );
+ var // Actual callback list
+ list = [],
+ // Stack of fire calls for repeatable lists
+ stack = [],
+ // Last fire value (for non-forgettable lists)
+ memory,
+ // Flag to know if list is currently firing
+ firing,
+ // First callback to fire (used internally by add and fireWith)
+ firingStart,
+ // End of the loop when firing
+ firingLength,
+ // Index of currently firing callback (modified by remove if needed)
+ firingIndex,
+ // Add one or several callbacks to the list
+ add = function( args ) {
+ var i,
+ length,
+ elem,
+ type,
+ actual;
+ for ( i = 0, length = args.length; i < length; i++ ) {
+ elem = args[ i ];
+ type = jQuery.type( elem );
+ if ( type === "array" ) {
+ // Inspect recursively
+ add( elem );
+ } else if ( type === "function" ) {
+ // Add if not in unique mode and callback is not in
+ if ( !flags.unique || !self.has( elem ) ) {
+ list.push( elem );
+ }
+ }
+ }
+ },
+ // Fire callbacks
+ fire = function( context, args ) {
+ args = args || [];
+ memory = !flags.memory || [ context, args ];
+ firing = true;
+ firingIndex = firingStart || 0;
+ firingStart = 0;
+ firingLength = list.length;
+ for ( ; list && firingIndex < firingLength; firingIndex++ ) {
+ if ( list[ firingIndex ].apply( context, args ) === false && flags.stopOnFalse ) {
+ memory = true; // Mark as halted
+ break;
+ }
+ }
+ firing = false;
+ if ( list ) {
+ if ( !flags.once ) {
+ if ( stack && stack.length ) {
+ memory = stack.shift();
+ self.fireWith( memory[ 0 ], memory[ 1 ] );
+ }
+ } else if ( memory === true ) {
+ self.disable();
+ } else {
+ list = [];
+ }
+ }
+ },
+ // Actual Callbacks object
+ self = {
+ // Add a callback or a collection of callbacks to the list
+ add: function() {
+ if ( list ) {
+ var length = list.length;
+ add( arguments );
+ // Do we need to add the callbacks to the
+ // current firing batch?
+ if ( firing ) {
+ firingLength = list.length;
+ // With memory, if we're not firing then
+ // we should call right away, unless previous
+ // firing was halted (stopOnFalse)
+ } else if ( memory && memory !== true ) {
+ firingStart = length;
+ fire( memory[ 0 ], memory[ 1 ] );
+ }
+ }
+ return this;
+ },
+ // Remove a callback from the list
+ remove: function() {
+ if ( list ) {
+ var args = arguments,
+ argIndex = 0,
+ argLength = args.length;
+ for ( ; argIndex < argLength ; argIndex++ ) {
+ for ( var i = 0; i < list.length; i++ ) {
+ if ( args[ argIndex ] === list[ i ] ) {
+ // Handle firingIndex and firingLength
+ if ( firing ) {
+ if ( i <= firingLength ) {
+ firingLength--;
+ if ( i <= firingIndex ) {
+ firingIndex--;
+ }
+ }
+ }
+ // Remove the element
+ list.splice( i--, 1 );
+ // If we have some unicity property then
+ // we only need to do this once
+ if ( flags.unique ) {
+ break;
+ }
+ }
+ }
+ }
+ }
+ return this;
+ },
+ // Control if a given callback is in the list
+ has: function( fn ) {
+ if ( list ) {
+ var i = 0,
+ length = list.length;
+ for ( ; i < length; i++ ) {
+ if ( fn === list[ i ] ) {
+ return true;
+ }
+ }
+ }
+ return false;
+ },
+ // Remove all callbacks from the list
+ empty: function() {
+ list = [];
+ return this;
+ },
+ // Have the list do nothing anymore
+ disable: function() {
+ list = stack = memory = undefined;
+ return this;
+ },
+ // Is it disabled?
+ disabled: function() {
+ return !list;
+ },
+ // Lock the list in its current state
+ lock: function() {
+ stack = undefined;
+ if ( !memory || memory === true ) {
+ self.disable();
+ }
+ return this;
+ },
+ // Is it locked?
+ locked: function() {
+ return !stack;
+ },
+ // Call all callbacks with the given context and arguments
+ fireWith: function( context, args ) {
+ if ( stack ) {
+ if ( firing ) {
+ if ( !flags.once ) {
+ stack.push( [ context, args ] );
+ }
+ } else if ( !( flags.once && memory ) ) {
+ fire( context, args );
+ }
+ }
+ return this;
+ },
+ // Call all the callbacks with the given arguments
+ fire: function() {
+ self.fireWith( this, arguments );
+ return this;
+ },
+ // To know if the callbacks have already been called at least once
+ fired: function() {
+ return !!memory;
+ }
+ };
+ return self;
+};
+
+
+
+
+var // Static reference to slice
+ sliceDeferred = [].slice;
+
+jQuery.extend({
+
+ Deferred: function( func ) {
+ var doneList = jQuery.Callbacks( "once memory" ),
+ failList = jQuery.Callbacks( "once memory" ),
+ progressList = jQuery.Callbacks( "memory" ),
+ state = "pending",
+ lists = {
+ resolve: doneList,
+ reject: failList,
+ notify: progressList
+ },
+ promise = {
+ done: doneList.add,
+ fail: failList.add,
+ progress: progressList.add,
+
+ state: function() {
+ return state;
+ },
+
+ // Deprecated
+ isResolved: doneList.fired,
+ isRejected: failList.fired,
+
+ then: function( doneCallbacks, failCallbacks, progressCallbacks ) {
+ deferred.done( doneCallbacks ).fail( failCallbacks ).progress( progressCallbacks );
+ return this;
+ },
+ always: function() {
+ deferred.done.apply( deferred, arguments ).fail.apply( deferred, arguments );
+ return this;
+ },
+ pipe: function( fnDone, fnFail, fnProgress ) {
+ return jQuery.Deferred(function( newDefer ) {
+ jQuery.each( {
+ done: [ fnDone, "resolve" ],
+ fail: [ fnFail, "reject" ],
+ progress: [ fnProgress, "notify" ]
+ }, function( handler, data ) {
+ var fn = data[ 0 ],
+ action = data[ 1 ],
+ returned;
+ if ( jQuery.isFunction( fn ) ) {
+ deferred[ handler ](function() {
+ returned = fn.apply( this, arguments );
+ if ( returned && jQuery.isFunction( returned.promise ) ) {
+ returned.promise().then( newDefer.resolve, newDefer.reject, newDefer.notify );
+ } else {
+ newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] );
+ }
+ });
+ } else {
+ deferred[ handler ]( newDefer[ action ] );
+ }
+ });
+ }).promise();
+ },
+ // Get a promise for this deferred
+ // If obj is provided, the promise aspect is added to the object
+ promise: function( obj ) {
+ if ( obj == null ) {
+ obj = promise;
+ } else {
+ for ( var key in promise ) {
+ obj[ key ] = promise[ key ];
+ }
+ }
+ return obj;
+ }
+ },
+ deferred = promise.promise({}),
+ key;
+
+ for ( key in lists ) {
+ deferred[ key ] = lists[ key ].fire;
+ deferred[ key + "With" ] = lists[ key ].fireWith;
+ }
+
+ // Handle state
+ deferred.done( function() {
+ state = "resolved";
+ }, failList.disable, progressList.lock ).fail( function() {
+ state = "rejected";
+ }, doneList.disable, progressList.lock );
+
+ // Call given func if any
+ if ( func ) {
+ func.call( deferred, deferred );
+ }
+
+ // All done!
+ return deferred;
+ },
+
+ // Deferred helper
+ when: function( firstParam ) {
+ var args = sliceDeferred.call( arguments, 0 ),
+ i = 0,
+ length = args.length,
+ pValues = new Array( length ),
+ count = length,
+ pCount = length,
+ deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ?
+ firstParam :
+ jQuery.Deferred(),
+ promise = deferred.promise();
+ function resolveFunc( i ) {
+ return function( value ) {
+ args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value;
+ if ( !( --count ) ) {
+ deferred.resolveWith( deferred, args );
+ }
+ };
+ }
+ function progressFunc( i ) {
+ return function( value ) {
+ pValues[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value;
+ deferred.notifyWith( promise, pValues );
+ };
+ }
+ if ( length > 1 ) {
+ for ( ; i < length; i++ ) {
+ if ( args[ i ] && args[ i ].promise && jQuery.isFunction( args[ i ].promise ) ) {
+ args[ i ].promise().then( resolveFunc(i), deferred.reject, progressFunc(i) );
+ } else {
+ --count;
+ }
+ }
+ if ( !count ) {
+ deferred.resolveWith( deferred, args );
+ }
+ } else if ( deferred !== firstParam ) {
+ deferred.resolveWith( deferred, length ? [ firstParam ] : [] );
+ }
+ return promise;
+ }
+});
+
+
+
+
+jQuery.support = (function() {
+
+ var support,
+ all,
+ a,
+ select,
+ opt,
+ input,
+ marginDiv,
+ fragment,
+ tds,
+ events,
+ eventName,
+ i,
+ isSupported,
+ div = document.createElement( "div" ),
+ documentElement = document.documentElement;
+
+ // Preliminary tests
+ div.setAttribute("className", "t");
+ div.innerHTML = " <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
+
+ all = div.getElementsByTagName( "*" );
+ a = div.getElementsByTagName( "a" )[ 0 ];
+
// Can't get basic test support
if ( !all || !all.length || !a ) {
- return;
+ return {};
}
- jQuery.support = {
+ // First batch of supports tests
+ select = document.createElement( "select" );
+ opt = select.appendChild( document.createElement("option") );
+ input = div.getElementsByTagName( "input" )[ 0 ];
+
+ support = {
// IE strips leading whitespace when .innerHTML is used
- leadingWhitespace: div.firstChild.nodeType === 3,
+ leadingWhitespace: ( div.firstChild.nodeType === 3 ),
// Make sure that tbody elements aren't automatically inserted
// IE will insert them into empty tables
@@ -945,17 +1376,17 @@
htmlSerialize: !!div.getElementsByTagName("link").length,
// Get the style information from getAttribute
- // (IE uses .cssText insted)
- style: /red/.test( a.getAttribute("style") ),
+ // (IE uses .cssText instead)
+ style: /top/.test( a.getAttribute("style") ),
// Make sure that URLs aren't manipulated
// (IE normalizes it by default)
- hrefNormalized: a.getAttribute("href") === "/a",
+ hrefNormalized: ( a.getAttribute("href") === "/a" ),
// Make sure that element opacity exists
// (IE uses filter instead)
// Use a regex to work around a WebKit issue. See #5145
- opacity: /^0.55$/.test( a.style.opacity ),
+ opacity: /^0.55/.test( a.style.opacity ),
// Verify style float existence
// (IE uses styleFloat instead of cssFloat)
@@ -964,159 +1395,240 @@
// Make sure that if no value is specified for a checkbox
// that it defaults to "on".
// (WebKit defaults to "" instead)
- checkOn: div.getElementsByTagName("input")[0].value === "on",
+ checkOn: ( input.value === "on" ),
// Make sure that a selected-by-default option has a working selected property.
// (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
optSelected: opt.selected,
+ // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
+ getSetAttribute: div.className !== "t",
+
+ // Tests for enctype support on a form(#6743)
+ enctype: !!document.createElement("form").enctype,
+
+ // Makes sure cloning an html5 element does not cause problems
+ // Where outerHTML is undefined, this still works
+ html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>",
+
// Will be defined later
+ submitBubbles: true,
+ changeBubbles: true,
+ focusinBubbles: false,
deleteExpando: true,
- optDisabled: false,
- checkClone: false,
- scriptEval: false,
noCloneEvent: true,
- boxModel: null,
inlineBlockNeedsLayout: false,
shrinkWrapBlocks: false,
- reliableHiddenOffsets: true
+ reliableMarginRight: true
};
+ // Make sure checked status is properly cloned
+ input.checked = true;
+ support.noCloneChecked = input.cloneNode( true ).checked;
+
// Make sure that the options inside disabled selects aren't marked as disabled
- // (WebKit marks them as diabled)
+ // (WebKit marks them as disabled)
select.disabled = true;
- jQuery.support.optDisabled = !opt.disabled;
+ support.optDisabled = !opt.disabled;
- script.type = "text/javascript";
- try {
- script.appendChild( document.createTextNode( "window." + id + "=1;" ) );
- } catch(e) {}
-
- root.insertBefore( script, root.firstChild );
-
- // Make sure that the execution of code works by injecting a script
- // tag with appendChild/createTextNode
- // (IE doesn't support this, fails, and uses .text instead)
- if ( window[ id ] ) {
- jQuery.support.scriptEval = true;
- delete window[ id ];
- }
-
// Test to see if it's possible to delete an expando from an element
// Fails in Internet Explorer
try {
- delete script.test;
-
- } catch(e) {
- jQuery.support.deleteExpando = false;
+ delete div.test;
+ } catch( e ) {
+ support.deleteExpando = false;
}
- root.removeChild( script );
-
- if ( div.attachEvent && div.fireEvent ) {
- div.attachEvent("onclick", function click() {
+ if ( !div.addEventListener && div.attachEvent && div.fireEvent ) {
+ div.attachEvent( "onclick", function() {
// Cloning a node shouldn't copy over any
// bound event handlers (IE does this)
- jQuery.support.noCloneEvent = false;
- div.detachEvent("onclick", click);
+ support.noCloneEvent = false;
});
- div.cloneNode(true).fireEvent("onclick");
+ div.cloneNode( true ).fireEvent( "onclick" );
}
- div = document.createElement("div");
- div.innerHTML = "<input type='radio' name='radiotest' checked='checked'/>";
+ // Check if a radio maintains its value
+ // after being appended to the DOM
+ input = document.createElement("input");
+ input.value = "t";
+ input.setAttribute("type", "radio");
+ support.radioValue = input.value === "t";
- var fragment = document.createDocumentFragment();
- fragment.appendChild( div.firstChild );
+ input.setAttribute("checked", "checked");
+ div.appendChild( input );
+ fragment = document.createDocumentFragment();
+ fragment.appendChild( div.lastChild );
// WebKit doesn't clone checked state correctly in fragments
- jQuery.support.checkClone = fragment.cloneNode(true).cloneNode(true).lastChild.checked;
+ support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
- // Figure out if the W3C box model works as expected
- // document.body must exist before we can do this
+ // Check if a disconnected checkbox will retain its checked
+ // value of true after appended to the DOM (IE6/7)
+ support.appendChecked = input.checked;
+
+ fragment.removeChild( input );
+ fragment.appendChild( div );
+
+ div.innerHTML = "";
+
+ // Check if div with explicit width and no margin-right incorrectly
+ // gets computed margin-right based on width of container. For more
+ // info see bug #3333
+ // Fails in WebKit before Feb 2011 nightlies
+ // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
+ if ( window.getComputedStyle ) {
+ marginDiv = document.createElement( "div" );
+ marginDiv.style.width = "0";
+ marginDiv.style.marginRight = "0";
+ div.style.width = "2px";
+ div.appendChild( marginDiv );
+ support.reliableMarginRight =
+ ( parseInt( ( window.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0;
+ }
+
+ // Technique from Juriy Zaytsev
+ // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/
+ // We only care about the case where non-standard event systems
+ // are used, namely in IE. Short-circuiting here helps us to
+ // avoid an eval call (in setAttribute) which can cause CSP
+ // to go haywire. See: https://developer.mozilla.org/en/Security/CSP
+ if ( div.attachEvent ) {
+ for( i in {
+ submit: 1,
+ change: 1,
+ focusin: 1
+ }) {
+ eventName = "on" + i;
+ isSupported = ( eventName in div );
+ if ( !isSupported ) {
+ div.setAttribute( eventName, "return;" );
+ isSupported = ( typeof div[ eventName ] === "function" );
+ }
+ support[ i + "Bubbles" ] = isSupported;
+ }
+ }
+
+ fragment.removeChild( div );
+
+ // Null elements to avoid leaks in IE
+ fragment = select = opt = marginDiv = div = input = null;
+
+ // Run tests that need a body at doc ready
jQuery(function() {
- var div = document.createElement("div");
+ var container, outer, inner, table, td, offsetSupport,
+ conMarginTop, ptlm, vb, style, html,
+ body = document.getElementsByTagName("body")[0];
+
+ if ( !body ) {
+ // Return for frameset docs that don't have a body
+ return;
+ }
+
+ conMarginTop = 1;
+ ptlm = "position:absolute;top:0;left:0;width:1px;height:1px;margin:0;";
+ vb = "visibility:hidden;border:0;";
+ style = "style='" + ptlm + "border:5px solid #000;padding:0;'";
+ html = "<div " + style + "><div></div></div>" +
+ "<table " + style + " cellpadding='0' cellspacing='0'>" +
+ "<tr><td></td></tr></table>";
+
+ container = document.createElement("div");
+ container.style.cssText = vb + "width:0;height:0;position:static;top:0;margin-top:" + conMarginTop + "px";
+ body.insertBefore( container, body.firstChild );
+
+ // Construct the test element
+ div = document.createElement("div");
+ container.appendChild( div );
+
+ // Check if table cells still have offsetWidth/Height when they are set
+ // to display:none and there are still other visible table cells in a
+ // table row; if so, offsetWidth/Height are not reliable for use when
+ // determining if an element has been hidden directly using
+ // display:none (it is still safe to use offsets if a parent element is
+ // hidden; don safety goggles and see bug #4512 for more information).
+ // (only IE 8 fails this test)
+ div.innerHTML = "<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";
+ tds = div.getElementsByTagName( "td" );
+ isSupported = ( tds[ 0 ].offsetHeight === 0 );
+
+ tds[ 0 ].style.display = "";
+ tds[ 1 ].style.display = "none";
+
+ // Check if empty table cells still have offsetWidth/Height
+ // (IE <= 8 fail this test)
+ support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
+
+ // Figure out if the W3C box model works as expected
+ div.innerHTML = "";
div.style.width = div.style.paddingLeft = "1px";
+ jQuery.boxModel = support.boxModel = div.offsetWidth === 2;
- document.body.appendChild( div );
- jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2;
-
- if ( "zoom" in div.style ) {
+ if ( typeof div.style.zoom !== "undefined" ) {
// Check if natively block-level elements act like inline-block
// elements when setting their display to 'inline' and giving
// them layout
// (IE < 8 does this)
div.style.display = "inline";
div.style.zoom = 1;
- jQuery.support.inlineBlockNeedsLayout = div.offsetWidth === 2;
+ support.inlineBlockNeedsLayout = ( div.offsetWidth === 2 );
// Check if elements with layout shrink-wrap their children
// (IE 6 does this)
div.style.display = "";
div.innerHTML = "<div style='width:4px;'></div>";
- jQuery.support.shrinkWrapBlocks = div.offsetWidth !== 2;
+ support.shrinkWrapBlocks = ( div.offsetWidth !== 2 );
}
- div.innerHTML = "<table><tr><td style='padding:0;display:none'></td><td>t</td></tr></table>";
- var tds = div.getElementsByTagName("td");
+ div.style.cssText = ptlm + vb;
+ div.innerHTML = html;
- // Check if table cells still have offsetWidth/Height when they are set
- // to display:none and there are still other visible table cells in a
- // table row; if so, offsetWidth/Height are not reliable for use when
- // determining if an element has been hidden directly using
- // display:none (it is still safe to use offsets if a parent element is
- // hidden; don safety goggles and see bug #4512 for more information).
- // (only IE 8 fails this test)
- jQuery.support.reliableHiddenOffsets = tds[0].offsetHeight === 0;
+ outer = div.firstChild;
+ inner = outer.firstChild;
+ td = outer.nextSibling.firstChild.firstChild;
- tds[0].style.display = "";
- tds[1].style.display = "none";
+ offsetSupport = {
+ doesNotAddBorder: ( inner.offsetTop !== 5 ),
+ doesAddBorderForTableAndCells: ( td.offsetTop === 5 )
+ };
- // Check if empty table cells still have offsetWidth/Height
- // (IE < 8 fail this test)
- jQuery.support.reliableHiddenOffsets = jQuery.support.reliableHiddenOffsets && tds[0].offsetHeight === 0;
- div.innerHTML = "";
+ inner.style.position = "fixed";
+ inner.style.top = "20px";
- document.body.removeChild( div ).style.display = "none";
- div = tds = null;
- });
+ // safari subtracts parent border width here which is 5px
+ offsetSupport.fixedPosition = ( inner.offsetTop === 20 || inner.offsetTop === 15 );
+ inner.style.position = inner.style.top = "";
- // Technique from Juriy Zaytsev
- // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
- var eventSupported = function( eventName ) {
- var el = document.createElement("div");
- eventName = "on" + eventName;
+ outer.style.overflow = "hidden";
+ outer.style.position = "relative";
- var isSupported = (eventName in el);
- if ( !isSupported ) {
- el.setAttribute(eventName, "return;");
- isSupported = typeof el[eventName] === "function";
- }
- el = null;
+ offsetSupport.subtractsBorderForOverflowNotVisible = ( inner.offsetTop === -5 );
+ offsetSupport.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== conMarginTop );
- return isSupported;
- };
+ body.removeChild( container );
+ div = container = null;
- jQuery.support.submitBubbles = eventSupported("submit");
- jQuery.support.changeBubbles = eventSupported("change");
+ jQuery.extend( support, offsetSupport );
+ });
- // release memory in IE
- root = script = div = all = a = null;
+ return support;
})();
-var windowData = {},
- rbrace = /^(?:\{.*\}|\[.*\])$/;
+var rbrace = /^(?:\{.*\}|\[.*\])$/,
+ rmultiDash = /([A-Z])/g;
+
jQuery.extend({
cache: {},
// Please use with caution
uuid: 0,
- // Unique for each copy of jQuery on the page
- expando: "jQuery" + jQuery.now(),
+ // Unique for each copy of jQuery on the page
+ // Non-digits removed to match rinlinejQuery
+ expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ),
// The following elements throw uncatchable exceptions if you
// attempt to add expando properties to them.
@@ -1127,103 +1639,214 @@
"applet": true
},
- data: function( elem, name, data ) {
+ hasData: function( elem ) {
+ elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
+ return !!elem && !isEmptyDataObject( elem );
+ },
+
+ data: function( elem, name, data, pvt /* Internal Use Only */ ) {
if ( !jQuery.acceptData( elem ) ) {
return;
}
- elem = elem == window ?
- windowData :
- elem;
+ var privateCache, thisCache, ret,
+ internalKey = jQuery.expando,
+ getByName = typeof name === "string",
- var isNode = elem.nodeType,
- id = isNode ? elem[ jQuery.expando ] : null,
- cache = jQuery.cache, thisCache;
+ // We have to handle DOM nodes and JS objects differently because IE6-7
+ // can't GC object references properly across the DOM-JS boundary
+ isNode = elem.nodeType,
- if ( isNode && !id && typeof name === "string" && data === undefined ) {
- return;
- }
+ // Only DOM nodes need the global jQuery cache; JS object data is
+ // attached directly to the object so GC can occur automatically
+ cache = isNode ? jQuery.cache : elem,
- // Get the data from the object directly
- if ( !isNode ) {
- cache = elem;
+ // Only defining an ID for JS objects if its cache already exists allows
+ // the code to shortcut on the same path as a DOM node with no cache
+ id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey,
+ isEvents = name === "events";
- // Compute a unique ID for the element
- } else if ( !id ) {
- elem[ jQuery.expando ] = id = ++jQuery.uuid;
+ // Avoid doing any more work than we need to when trying to get data on an
+ // object that has no data at all
+ if ( (!id || !cache[id] || (!isEvents && !pvt && !cache[id].data)) && getByName && data === undefined ) {
+ return;
}
- // Avoid generating a new cache unless none exists and we
- // want to manipulate it.
- if ( typeof name === "object" ) {
+ if ( !id ) {
+ // Only DOM nodes need a new unique ID for each element since their data
+ // ends up in the global cache
if ( isNode ) {
- cache[ id ] = jQuery.extend(cache[ id ], name);
-
+ elem[ internalKey ] = id = ++jQuery.uuid;
} else {
- jQuery.extend( cache, name );
+ id = internalKey;
}
+ }
- } else if ( isNode && !cache[ id ] ) {
+ if ( !cache[ id ] ) {
cache[ id ] = {};
+
+ // Avoids exposing jQuery metadata on plain JS objects when the object
+ // is serialized using JSON.stringify
+ if ( !isNode ) {
+ cache[ id ].toJSON = jQuery.noop;
+ }
}
- thisCache = isNode ? cache[ id ] : cache;
+ // An object can be passed to jQuery.data instead of a key/value pair; this gets
+ // shallow copied over onto the existing cache
+ if ( typeof name === "object" || typeof name === "function" ) {
+ if ( pvt ) {
+ cache[ id ] = jQuery.extend( cache[ id ], name );
+ } else {
+ cache[ id ].data = jQuery.extend( cache[ id ].data, name );
+ }
+ }
- // Prevent overriding the named cache with undefined values
+ privateCache = thisCache = cache[ id ];
+
+ // jQuery data() is stored in a separate object inside the object's internal data
+ // cache in order to avoid key collisions between internal data and user-defined
+ // data.
+ if ( !pvt ) {
+ if ( !thisCache.data ) {
+ thisCache.data = {};
+ }
+
+ thisCache = thisCache.data;
+ }
+
if ( data !== undefined ) {
- thisCache[ name ] = data;
+ thisCache[ jQuery.camelCase( name ) ] = data;
}
- return typeof name === "string" ? thisCache[ name ] : thisCache;
+ // Users should not attempt to inspect the internal events object using jQuery.data,
+ // it is undocumented and subject to change. But does anyone listen? No.
+ if ( isEvents && !thisCache[ name ] ) {
+ return privateCache.events;
+ }
+
+ // Check for both converted-to-camel and non-converted data property names
+ // If a data property was specified
+ if ( getByName ) {
+
+ // First Try to find as-is property data
+ ret = thisCache[ name ];
+
+ // Test for null|undefined property data
+ if ( ret == null ) {
+
+ // Try to find the camelCased property
+ ret = thisCache[ jQuery.camelCase( name ) ];
+ }
+ } else {
+ ret = thisCache;
+ }
+
+ return ret;
},
- removeData: function( elem, name ) {
+ removeData: function( elem, name, pvt /* Internal Use Only */ ) {
if ( !jQuery.acceptData( elem ) ) {
return;
}
- elem = elem == window ?
- windowData :
- elem;
+ var thisCache, i, l,
- var isNode = elem.nodeType,
- id = isNode ? elem[ jQuery.expando ] : elem,
- cache = jQuery.cache,
- thisCache = isNode ? cache[ id ] : id;
+ // Reference to internal data cache key
+ internalKey = jQuery.expando,
- // If we want to remove a specific section of the element's data
+ isNode = elem.nodeType,
+
+ // See jQuery.data for more information
+ cache = isNode ? jQuery.cache : elem,
+
+ // See jQuery.data for more information
+ id = isNode ? elem[ internalKey ] : internalKey;
+
+ // If there is already no cache entry for this object, there is no
+ // purpose in continuing
+ if ( !cache[ id ] ) {
+ return;
+ }
+
if ( name ) {
+
+ thisCache = pvt ? cache[ id ] : cache[ id ].data;
+
if ( thisCache ) {
- // Remove the section of cache data
- delete thisCache[ name ];
- // If we've removed all the data, remove the element's cache
- if ( isNode && jQuery.isEmptyObject(thisCache) ) {
- jQuery.removeData( elem );
+ // Support array or space separated string names for data keys
+ if ( !jQuery.isArray( name ) ) {
+
+ // try the string as a key before any manipulation
+ if ( name in thisCache ) {
+ name = [ name ];
+ } else {
+
+ // split the camel cased version by spaces unless a key with the spaces exists
+ name = jQuery.camelCase( name );
+ if ( name in thisCache ) {
+ name = [ name ];
+ } else {
+ name = name.split( " " );
+ }
+ }
}
+
+ for ( i = 0, l = name.length; i < l; i++ ) {
+ delete thisCache[ name[i] ];
+ }
+
+ // If there is no data left in the cache, we want to continue
+ // and let the cache object itself get destroyed
+ if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) {
+ return;
+ }
}
+ }
- // Otherwise, we want to remove all of the element's data
+ // See jQuery.data for more information
+ if ( !pvt ) {
+ delete cache[ id ].data;
+
+ // Don't destroy the parent cache unless the internal data object
+ // had been the only thing left in it
+ if ( !isEmptyDataObject(cache[ id ]) ) {
+ return;
+ }
+ }
+
+ // Browsers that fail expando deletion also refuse to delete expandos on
+ // the window, but it will allow it on all other JS objects; other browsers
+ // don't care
+ // Ensure that `cache` is not a window object #10080
+ if ( jQuery.support.deleteExpando || !cache.setInterval ) {
+ delete cache[ id ];
} else {
- if ( isNode && jQuery.support.deleteExpando ) {
- delete elem[ jQuery.expando ];
+ cache[ id ] = null;
+ }
+ // We destroyed the cache and need to eliminate the expando on the node to avoid
+ // false lookups in the cache for entries that no longer exist
+ if ( isNode ) {
+ // IE does not allow us to delete expando properties from nodes,
+ // nor does it have a removeAttribute function on Document nodes;
+ // we must handle all of these cases
+ if ( jQuery.support.deleteExpando ) {
+ delete elem[ internalKey ];
} else if ( elem.removeAttribute ) {
- elem.removeAttribute( jQuery.expando );
-
- // Completely remove the data cache
- } else if ( isNode ) {
- delete cache[ id ];
-
- // Remove all fields from the object
+ elem.removeAttribute( internalKey );
} else {
- for ( var n in elem ) {
- delete elem[ n ];
- }
+ elem[ internalKey ] = null;
}
}
},
+ // For internal use only.
+ _data: function( elem, name, data ) {
+ return jQuery.data( elem, name, data, true );
+ },
+
// A method for determining if a DOM node can handle the data expando
acceptData: function( elem ) {
if ( elem.nodeName ) {
@@ -1240,20 +1863,25 @@
jQuery.fn.extend({
data: function( key, value ) {
- var data = null;
+ var parts, attr, name,
+ data = null;
if ( typeof key === "undefined" ) {
if ( this.length ) {
- var attr = this[0].attributes, name;
data = jQuery.data( this[0] );
- for ( var i = 0, l = attr.length; i < l; i++ ) {
- name = attr[i].name;
+ if ( this[0].nodeType === 1 && !jQuery._data( this[0], "parsedAttrs" ) ) {
+ attr = this[0].attributes;
+ for ( var i = 0, l = attr.length; i < l; i++ ) {
+ name = attr[i].name;
- if ( name.indexOf( "data-" ) === 0 ) {
- name = name.substr( 5 );
- dataAttr( this[0], name, data[ name ] );
+ if ( name.indexOf( "data-" ) === 0 ) {
+ name = jQuery.camelCase( name.substring(5) );
+
+ dataAttr( this[0], name, data[ name ] );
+ }
}
+ jQuery._data( this[0], "parsedAttrs", true );
}
}
@@ -1265,7 +1893,7 @@
});
}
- var parts = key.split(".");
+ parts = key.split(".");
parts[1] = parts[1] ? "." + parts[1] : "";
if ( value === undefined ) {
@@ -1283,12 +1911,12 @@
} else {
return this.each(function() {
- var $this = jQuery( this ),
+ var self = jQuery( this ),
args = [ parts[0], value ];
- $this.triggerHandler( "setData" + parts[1] + "!", args );
+ self.triggerHandler( "setData" + parts[1] + "!", args );
jQuery.data( this, key, value );
- $this.triggerHandler( "changeData" + parts[1] + "!", args );
+ self.triggerHandler( "changeData" + parts[1] + "!", args );
});
}
},
@@ -1304,14 +1932,17 @@
// If nothing was found internally, try to fetch any
// data from the HTML5 data-* attribute
if ( data === undefined && elem.nodeType === 1 ) {
- data = elem.getAttribute( "data-" + key );
+ var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
+
+ data = elem.getAttribute( name );
+
if ( typeof data === "string" ) {
try {
data = data === "true" ? true :
data === "false" ? false :
data === "null" ? null :
- !jQuery.isNaN( data ) ? parseFloat( data ) :
+ jQuery.isNumeric( data ) ? parseFloat( data ) :
rbrace.test( data ) ? jQuery.parseJSON( data ) :
data;
} catch( e ) {}
@@ -1327,38 +1958,97 @@
return data;
}
+// checks a cache object for emptiness
+function isEmptyDataObject( obj ) {
+ for ( var name in obj ) {
+ // if the public data object is empty, the private is still empty
+ if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {
+ continue;
+ }
+ if ( name !== "toJSON" ) {
+ return false;
+ }
+ }
+ return true;
+}
+
+
+
+function handleQueueMarkDefer( elem, type, src ) {
+ var deferDataKey = type + "defer",
+ queueDataKey = type + "queue",
+ markDataKey = type + "mark",
+ defer = jQuery._data( elem, deferDataKey );
+ if ( defer &&
+ ( src === "queue" || !jQuery._data(elem, queueDataKey) ) &&
+ ( src === "mark" || !jQuery._data(elem, markDataKey) ) ) {
+ // Give room for hard-coded callbacks to fire first
+ // and eventually mark/queue something else on the element
+ setTimeout( function() {
+ if ( !jQuery._data( elem, queueDataKey ) &&
+ !jQuery._data( elem, markDataKey ) ) {
+ jQuery.removeData( elem, deferDataKey, true );
+ defer.fire();
+ }
+ }, 0 );
+ }
+}
+
jQuery.extend({
- queue: function( elem, type, data ) {
- if ( !elem ) {
- return;
+
+ _mark: function( elem, type ) {
+ if ( elem ) {
+ type = ( type || "fx" ) + "mark";
+ jQuery._data( elem, type, (jQuery._data( elem, type ) || 0) + 1 );
}
+ },
- type = (type || "fx") + "queue";
- var q = jQuery.data( elem, type );
-
- // Speed up dequeue by getting out quickly if this is just a lookup
- if ( !data ) {
- return q || [];
+ _unmark: function( force, elem, type ) {
+ if ( force !== true ) {
+ type = elem;
+ elem = force;
+ force = false;
}
+ if ( elem ) {
+ type = type || "fx";
+ var key = type + "mark",
+ count = force ? 0 : ( (jQuery._data( elem, key ) || 1) - 1 );
+ if ( count ) {
+ jQuery._data( elem, key, count );
+ } else {
+ jQuery.removeData( elem, key, true );
+ handleQueueMarkDefer( elem, type, "mark" );
+ }
+ }
+ },
- if ( !q || jQuery.isArray(data) ) {
- q = jQuery.data( elem, type, jQuery.makeArray(data) );
+ queue: function( elem, type, data ) {
+ var q;
+ if ( elem ) {
+ type = ( type || "fx" ) + "queue";
+ q = jQuery._data( elem, type );
- } else {
- q.push( data );
+ // Speed up dequeue by getting out quickly if this is just a lookup
+ if ( data ) {
+ if ( !q || jQuery.isArray(data) ) {
+ q = jQuery._data( elem, type, jQuery.makeArray(data) );
+ } else {
+ q.push( data );
+ }
+ }
+ return q || [];
}
-
- return q;
},
dequeue: function( elem, type ) {
type = type || "fx";
var queue = jQuery.queue( elem, type ),
- fn = queue.shift();
+ fn = queue.shift(),
+ hooks = {};
// If the fx queue is dequeu...
[truncated message content] |
|
From: <ma...@us...> - 2011-12-11 22:08:58
|
Revision: 566
http://openautomation.svn.sourceforge.net/openautomation/?rev=566&view=rev
Author: mayerch
Date: 2011-12-11 22:08:49 +0000 (Sun, 11 Dec 2011)
Log Message:
-----------
Change static 2D backdrop to dynamic one.
NOTE: this is a proof of concept. And even in the future such a dynamic 2D backdrop will only be available to experts...
Modified Paths:
--------------
CometVisu/trunk/visu/designs/structure_pure.js
CometVisu/trunk/visu/lib/cometvisu-client.js
CometVisu/trunk/visu/visu_config_2d3d.xml
Added Paths:
-----------
CometVisu/trunk/visu/media/demo_2d_backdrop_red_pot.svg
Modified: CometVisu/trunk/visu/designs/structure_pure.js
===================================================================
--- CometVisu/trunk/visu/designs/structure_pure.js 2011-12-11 19:27:33 UTC (rev 565)
+++ CometVisu/trunk/visu/designs/structure_pure.js 2011-12-11 22:08:49 UTC (rev 566)
@@ -97,7 +97,7 @@
container.append( '<h1>' + name + '</h1>' );
if( '2d' == type )
{
- container.append( '<img src="' + backdrop + '" style="position: absolute; top: 0px; left: 0px;z-index:-1;"/>' );
+ container.append( '<embed src="' + backdrop + '" style="position: absolute; top: 0px; left: 0px;z-index:-1;"/>' );
}
$( childs ).each( function(i){
container.append( create_pages( childs[i], path + '_' + i, flavour ) );
Modified: CometVisu/trunk/visu/lib/cometvisu-client.js
===================================================================
--- CometVisu/trunk/visu/lib/cometvisu-client.js 2011-12-11 19:27:33 UTC (rev 565)
+++ CometVisu/trunk/visu/lib/cometvisu-client.js 2011-12-11 22:08:49 UTC (rev 566)
@@ -28,6 +28,7 @@
this.pass = ''; // the current password
this.device = ''; // the current device ID
this.running = false; // is the communication running at the moment?
+ this.doRestart = false; // are we currently in a reastart, e.g. due to the watchdog
this.xhr = false; // the ongoing AJAX request
this.watchdogTimer = 5; // in Seconds - the alive check intervall of the watchdog
this.maxConnectionAge = 60; // in Seconds - restart if last read is older
@@ -80,7 +81,7 @@
*/
this.handleError=function(xhr,str,excptObj)
{
- if( this.running && xhr.readyState != 4 ) // ignore error when connection is irrelevant
+ if( this.running && xhr.readyState != 4 && !this.doRestart) // ignore error when connection is irrelevant
{
var readyState = 'UNKNOWN';
switch( xhr.readyState )
@@ -165,7 +166,9 @@
*/
this.restart = function()
{
+ this.doRestart = true;
if( this.xhr.abort ) this.xhr.abort();
+ this.doRestart = false;
this.handleRead(); // restart
}
Added: CometVisu/trunk/visu/media/demo_2d_backdrop_red_pot.svg
===================================================================
--- CometVisu/trunk/visu/media/demo_2d_backdrop_red_pot.svg (rev 0)
+++ CometVisu/trunk/visu/media/demo_2d_backdrop_red_pot.svg 2011-12-11 22:08:49 UTC (rev 566)
@@ -0,0 +1,150 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ version="1.1"
+ width="750"
+ height="500"
+ id="svg2">
+ <!--
+ <script xlink:href="../lib/jquery.js" type="text/javascript"></script>
+ -->
+ <script type="application/javascript"><![CDATA[
+/*! jQuery v1.6.4 http://jquery.com/ | http://jquery.org/license */
+(function(a,b){function cu(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cr(a){if(!cg[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){ch||(ch=c.createElement("iframe"),ch.frameBorder=ch.width=ch.height=0),b.appendChild(ch);if(!ci||!ch.createElement)ci=(ch.contentWindow||ch.contentDocument).document,ci.write((c.compatMode==="CSS1Compat"?"<!doctype html>":"")+"<html><body>"),ci.close();d=ci.createElement(a),ci.body.appendChild(d),e=f.css(d,"display"),b.removeChild(ch)}cg[a]=e}return cg[a]}function cq(a,b){var c={};f.each(cm.concat.apply([],cm.slice(0,b)),function(){c[this]=a});return c}function cp(){cn=b}function co(){setTimeout(cp,0);return cn=f.now()}function cf(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ce(){try{return new a.XMLHttpRequest}catch(b){}}function b$(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function bZ(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function bY(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bA.test(a)?d(a,e):bY(a+"["+(typeof e=="object"||f.isArray(e)?b:"")+"]",e,c,d)});else if(!c&&b!=null&&typeof b=="object")for(var e in b)bY(a+"["+e+"]",b[e],c,d);else d(a,b)}function bX(a,c){var d,e,g=f.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((g[d]?a:e||(e={}))[d]=c[d]);e&&f.extend(!0,a,e)}function bW(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bP,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=bW(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=bW(a,c,d,e,"*",g));return l}function bV(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bL),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function by(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=b==="width"?bt:bu;if(d>0){c!=="border"&&f.each(e,function(){c||(d-=parseFloat(f.css(a,"padding"+this))||0),c==="margin"?d+=parseFloat(f.css(a,c+this))||0:d-=parseFloat(f.css(a,"border"+this+"Width"))||0});return d+"px"}d=bv(a,b,b);if(d<0||d==null)d=a.style[b]||0;d=parseFloat(d)||0,c&&f.each(e,function(){d+=parseFloat(f.css(a,"padding"+this))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+this+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+this))||0)});return d+"px"}function bl(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bd,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function bk(a){f.nodeName(a,"input")?bj(a):"getElementsByTagName"in a&&f.grep(a.getElementsByTagName("input"),bj)}function bj(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bi(a){return"getElementsByTagName"in a?a.getElementsByTagName("*"):"querySelectorAll"in a?a.querySelectorAll("*"):[]}function bh(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(f.expando)}}function bg(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c=f.expando,d=f.data(a),e=f.data(b,d);if(d=d[c]){var g=d.events;e=e[c]=f.extend({},d);if(g){delete e.handle,e.events={};for(var h in g)for(var i=0,j=g[h].length;i<j;i++)f.event.add(b,h+(g[h][i].namespace?".":"")+g[h][i].namespace,g[h][i],g[h][i].data)}}}}function bf(a,b){return f.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function V(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=f.grep(a,function(a){return a.nodeType===1});if(Q.test(b))return f.filter(b,d,!c);b=f.filter(b,d)}return f.grep(a,function(a,d){return f.inArray(a,b)>=0===c})}function U(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function M(a,b){return(a&&a!=="*"?a+".":"")+b.replace(y,"`").replace(z,"&")}function L(a){var b,c,d,e,g,h,i,j,k,l,m,n,o,p=[],q=[],r=f._data(this,"events");if(!(a.liveFired===this||!r||!r.live||a.target.disabled||a.button&&a.type==="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var s=r.live.slice(0);for(i=0;i<s.length;i++)g=s[i],g.origType.replace(w,"")===a.type?q.push(g.selector):s.splice(i--,1);e=f(a.target).closest(q,a.currentTarget);for(j=0,k=e.length;j<k;j++){m=e[j];for(i=0;i<s.length;i++){g=s[i];if(m.selector===g.selector&&(!n||n.test(g.namespace))&&!m.elem.disabled){h=m.elem,d=null;if(g.preType==="mouseenter"||g.preType==="mouseleave")a.type=g.preType,d=f(a.relatedTarget).closest(g.selector)[0],d&&f.contains(h,d)&&(d=h);(!d||d!==h)&&p.push({elem:h,handleObj:g,level:m.level})}}}for(j=0,k=p.length;j<k;j++){e=p[j];if(c&&e.level>c)break;a.currentTarget=e.elem,a.data=e.handleObj.data,a.handleObj=e.handleObj,o=e.handleObj.origHandler.apply(e.elem,arguments);if(o===!1||a.isPropagationStopped()){c=e.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function J(a,c,d){var e=f.extend({},d[0]);e.type=a,e.originalEvent={},e.liveFired=b,f.event.handle.call(c,e),e.isDefaultPrevented()&&d[0].preventDefault()}function D(){return!0}function C(){return!1}function m(a,c,d){var e=c+"defer",g=c+"queue",h=c+"mark",i=f.data(a,e,b,!0);i&&(d==="queue"||!f.data(a,g,b,!0))&&(d==="mark"||!f.data(a,h,b,!0))&&setTimeout(function(){!f.data(a,g,b,!0)&&!f.data(a,h,b,!0)&&(f.removeData(a,e,!0),i.resolve())},0)}function l(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function k(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(j,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNaN(d)?i.test(d)?f.parseJSON(d):d:parseFloat(d)}catch(g){}f.data(a,c,d)}else d=b}return d}var c=a.document,d=a.navigator,e=a.location,f=function(){function K(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(K,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/\d/,n=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,o=/^[\],:{}\s]*$/,p=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,q=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,r=/(?:^|:|,)(?:\s*\[)+/g,s=/(webkit)[ \/]([\w.]+)/,t=/(opera)(?:.*version)?[ \/]([\w.]+)/,u=/(msie) ([\w.]+)/,v=/(mozilla)(?:.*? rv:([\w.]+))?/,w=/-([a-z]|[0-9])/ig,x=/^-ms-/,y=function(a,b){return(b+"").toUpperCase()},z=d.userAgent,A,B,C,D=Object.prototype.toString,E=Object.prototype.hasOwnProperty,F=Array.prototype.push,G=Array.prototype.slice,H=String.prototype.trim,I=Array.prototype.indexOf,J={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=n.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.6.4",length:0,size:function(){return this.length},toArray:function(){return G.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?F.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),B.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(G.apply(this,arguments),"slice",G.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:F,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){d=i[c],f=a[c];if(i===f)continue;l&&f&&(e.isPlainObject(f)||(g=e.isArray(f)))?(g?(g=!1,h=d&&e.isArray(d)?d:[]):h=d&&e.isPlainObject(d)?d:{},i[c]=e.extend(l,h,f)):f!==b&&(i[c]=f)}return i},e.extend({noConflict:function(b){a.$===e&&(a.$=g),b&&a.jQuery===e&&(a.jQuery=f);return e},isReady:!1,readyWait:1,holdReady:function(a){a?e.readyWait++:e.ready(!0)},ready:function(a){if(a===!0&&!--e.readyWait||a!==!0&&!e.isReady){if(!c.body)return setTimeout(e.ready,1);e.isReady=!0;if(a!==!0&&--e.readyWait>0)return;B.resolveWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!B){B=e._Deferred();if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",C,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",C),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&K()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNaN:function(a){return a==null||!m.test(a)||isNaN(a)},type:function(a){return a==null?String(a):J[D.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!E.call(a,"constructor")&&!E.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||E.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(o.test(b.replace(p,"@").replace(q,"]").replace(r,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(x,"ms-").replace(w,y)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g<h;)if(c.apply(a[g++],d)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(;g<h;)if(c.call(a[g],g,a[g++])===!1)break;return a},trim:H?function(a){return a==null?"":H.call(a)}:function(a){return a==null?"":(a+"").replace(k,"").replace(l,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var d=e.type(a);a.length==null||d==="string"||d==="function"||d==="regexp"||e.isWindow(a)?F.call(c,a):e.merge(c,a)}return c},inArray:function(a,b){if(!b)return-1;if(I)return I.call(b,a);for(var c=0,d=b.length;c<d;c++)if(b[c]===a)return c;return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length=="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,d){var f,g,h=[],i=0,j=a.length,k=a instanceof e||j!==b&&typeof j=="number"&&(j>0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,d),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,d),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c=="string"){var d=a[c];c=a,a=d}if(!e.isFunction(a))return b;var f=G.call(arguments,2),g=function(){return a.apply(c,f.concat(G.call(arguments)))};g.guid=a.guid=a.guid||g.guid||e.guid++;return g},access:function(a,c,d,f,g,h){var i=a.length;if(typeof c=="object"){for(var j in c)e.access(a,j,c[j],f,g,d);return a}if(d!==b){f=!h&&f&&e.isFunction(d);for(var k=0;k<i;k++)g(a[k],c,f?d.call(a[k],k,g(a[k],c)):d,h);return a}return i?g(a[0],c):b},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=s.exec(a)||t.exec(a)||u.exec(a)||a.indexOf("compatible")<0&&v.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}e.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(d,f){f&&f instanceof e&&!(f instanceof a)&&(f=a(f));return e.fn.init.call(this,d,f,b)},a.fn.init.prototype=a.fn;var b=a(c);return a},browser:{}}),e.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){J["[object "+b+"]"]=b.toLowerCase()}),A=e.uaMatch(z),A.browser&&(e.browser[A.browser]=!0,e.browser.version=A.version),e.browser.webkit&&(e.browser.safari=!0),j.test(" ")&&(k=/^[\s\xA0]+/,l=/[\s\xA0]+$/),h=e(c),c.addEventListener?C=function(){c.removeEventListener("DOMContentLoaded",C,!1),e.ready()}:c.attachEvent&&(C=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",C),e.ready())});return e}(),g="done fail isResolved isRejected promise then always pipe".split(" "),h=[].slice;f.extend({_Deferred:function(){var a=[],b,c,d,e={done:function(){if(!d){var c=arguments,g,h,i,j,k;b&&(k=b,b=0);for(g=0,h=c.length;g<h;g++)i=c[g],j=f.type(i),j==="array"?e.done.apply(e,i):j==="function"&&a.push(i);k&&e.resolveWith(k[0],k[1])}return this},resolveWith:function(e,f){if(!d&&!b&&!c){f=f||[],c=1;try{while(a[0])a.shift().apply(e,f)}finally{b=[e,f],c=0}}return this},resolve:function(){e.resolveWith(this,arguments);return this},isResolved:function(){return!!c||!!b},cancel:function(){d=1,a=[];return this}};return e},Deferred:function(a){var b=f._Deferred(),c=f._Deferred(),d;f.extend(b,{then:function(a,c){b.done(a).fail(c);return this},always:function(){return b.done.apply(b,arguments).fail.apply(this,arguments)},fail:c.done,rejectWith:c.resolveWith,reject:c.resolve,isRejected:c.isResolved,pipe:function(a,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[c,"reject"]},function(a,c){var e=c[0],g=c[1],h;f.isFunction(e)?b[a](function(){h=e.apply(this,arguments),h&&f.isFunction(h.promise)?h.promise().then(d.resolve,d.reject):d[g+"With"](this===b?d:this,[h])}):b[a](d[g])})}).promise()},promise:function(a){if(a==null){if(d)return d;d=a={}}var c=g.length;while(c--)a[g[c]]=b[g[c]];return a}}),b.done(c.cancel).fail(b.cancel),delete b.cancel,a&&a.call(b,b);return b},when:function(a){function i(a){return function(c){b[a]=arguments.length>1?h.call(arguments,0):c,--e||g.resolveWith(g,h.call(b,0))}}var b=arguments,c=0,d=b.length,e=d,g=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred();if(d>1){for(;c<d;c++)b[c]&&f.isFunction(b[c].promise)?b[c].promise().then(i(c),g.reject):--e;e||g.resolveWith(g,b)}else g!==a&&g.resolveWith(g,d?[a]:[]);return g.promise()}}),f.support=function(){var a=c.createElement("div"),b=c.documentElement,d,e,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;a.setAttribute("className","t"),a.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",d=a.getElementsByTagName("*"),e=a.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=a.getElementsByTagName("input")[0],k={leadingWhitespace:a.firstChild.nodeType===3,tbody:!a.getElementsByTagName("tbody").length,htmlSerialize:!!a.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55$/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:a.className!=="t",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,k.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,k.optDisabled=!h.disabled;try{delete a.test}catch(v){k.deleteExpando=!1}!a.addEventListener&&a.attachEvent&&a.fireEvent&&(a.attachEvent("onclick",function(){k.noCloneEvent=!1}),a.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),k.radioValue=i.value==="t",i.setAttribute("checked","checked"),a.appendChild(i),l=c.createDocumentFragment(),l.appendChild(a.firstChild),k.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,a.innerHTML="",a.style.width=a.style.paddingLeft="1px",m=c.getElementsByTagName("body")[0],o=c.createElement(m?"div":"body"),p={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},m&&f.extend(p,{position:"absolute",left:"-1000px",top:"-1000px"});for(t in p)o.style[t]=p[t];o.appendChild(a),n=m||b,n.insertBefore(o,n.firstChild),k.appendChecked=i.checked,k.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,k.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="<div style='width:4px;'></div>",k.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>",q=a.getElementsByTagName("td"),u=q[0].offsetHeight===0,q[0].style.display="",q[1].style.display="none",k.reliableHiddenOffsets=u&&q[0].offsetHeight===0,a.innerHTML="",c.defaultView&&c.defaultView.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",a.appendChild(j),k.reliableMarginRight=(parseInt((c.defaultView.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0),o.innerHTML="",n.removeChild(o);if(a.attachEvent)for(t in{submit:1,change:1,focusin:1})s="on"+t,u=s in a,u||(a.setAttribute(s,"return;"),u=typeof a[s]=="function"),k[t+"Bubbles"]=u;o=l=g=h=m=j=a=i=null;return k}(),f.boxModel=f.support.boxModel;var i=/^(?:\{.*\}|\[.*\])$/,j=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!l(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i=f.expando,j=typeof c=="string",k=a.nodeType,l=k?f.cache:a,m=k?a[f.expando]:a[f.expando]&&f.expando;if((!m||e&&m&&l[m]&&!l[m][i])&&j&&d===b)return;m||(k?a[f.expando]=m=++f.uuid:m=f.expando),l[m]||(l[m]={},k||(l[m].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?l[m][i]=f.extend(l[m][i],c):l[m]=f.extend(l[m],c);g=l[m],e&&(g[i]||(g[i]={}),g=g[i]),d!==b&&(g[f.camelCase(c)]=d);if(c==="events"&&!g[c])return g[i]&&g[i].events;j?(h=g[c],h==null&&(h=g[f.camelCase(c)])):h=g;return h}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e=f.expando,g=a.nodeType,h=g?f.cache:a,i=g?a[f.expando]:f.expando;if(!h[i])return;if(b){d=c?h[i][e]:h[i];if(d){d[b]||(b=f.camelCase(b)),delete d[b];if(!l(d))return}}if(c){delete h[i][e];if(!l(h[i]))return}var j=h[i][e];f.support.deleteExpando||!h.setInterval?delete h[i]:h[i]=null,j?(h[i]={},g||(h[i].toJSON=f.noop),h[i][e]=j):g&&(f.support.deleteExpando?delete a[f.expando]:a.removeAttribute?a.removeAttribute(f.expando):a[f.expando]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d=null;if(typeof a=="undefined"){if(this.length){d=f.data(this[0]);if(this[0].nodeType===1){var e=this[0].attributes,g;for(var h=0,i=e.length;h<i;h++)g=e[h].name,g.indexOf("data-")===0&&(g=f.camelCase(g.substring(5)),k(this[0],g,d[g]))}}return d}if(typeof a=="object")return this.each(function(){f.data(this,a)});var j=a.split(".");j[1]=j[1]?"."+j[1]:"";if(c===b){d=this.triggerHandler("getData"+j[1]+"!",[j[0]]),d===b&&this.length&&(d=f.data(this[0],a),d=k(this[0],a,d));return d===b&&j[1]?this.data(j[0]):d}return this.each(function(){var b=f(this),d=[j[0],c];b.triggerHandler("setData"+j[1]+"!",d),f.data(this,a,c),b.triggerHandler("changeData"+j[1]+"!",d)})},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,c){a&&(c=(c||"fx")+"mark",f.data(a,c,(f.data(a,c,b,!0)||0)+1,!0))},_unmark:function(a,c,d){a!==!0&&(d=c,c=a,a=!1);if(c){d=d||"fx";var e=d+"mark",g=a?0:(f.data(c,e,b,!0)||1)-1;g?f.data(c,e,g,!0):(f.removeData(c,e,!0),m(c,d,"mark"))}},queue:function(a,c,d){if(a){c=(c||"fx")+"queue";var e=f.data(a,c,b,!0);d&&(!e||f.isArray(d)?e=f.data(a,c,f.makeArray(d),!0):e.push(d));return e||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e;d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),d.call(a,function(){f.dequeue(a,b)})),c.length||(f.removeData(a,b+"queue",!0),m(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){typeof a!="string"&&(c=a,a="fx");if(c===b)return f.queue(this[0],a);return this.each(function(){var b=f.queue(this,a,c);a==="fx"&&b[0]!=="inprogress"&&f.dequeue(this,a)})},dequeue:function(a){return this.each(function(){f.dequeue(this,a)})},delay:function(a,b){a=f.fx?f.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(){var c=this;setTimeout(function(){f.dequeue(c,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){function m(){--h||d.resolveWith(e,[e])}typeof a!="string"&&(c=a,a=b),a=a||"fx";var d=f.Deferred(),e=this,g=e.length,h=1,i=a+"defer",j=a+"queue",k=a+"mark",l;while(g--)if(l=f.data(e[g],i,b,!0)||(f.data(e[g],j,b,!0)||f.data(e[g],k,b,!0))&&f.data(e[g],i,f._Deferred(),!0))h++,l.done(m);m();return d.promise()}});var n=/[\n\t\r]/g,o=/\s+/,p=/\r/g,q=/^(?:button|input)$/i,r=/^(?:button|input|object|select|textarea)$/i,s=/^a(?:rea)?$/i,t=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,u,v;f.fn.extend({attr:function(a,b){return f.access(this,a,b,!0,f.attr)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,a,b,!0,f.prop)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(o);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{g=" "+e.className+" ";for(h=0,i=b.length;h<i;h++)~g.indexOf(" "+b[h]+" ")||(g+=b[h]+" ");e.className=f.trim(g)}}}return this},removeClass:function(a){var c,d,e,g,h,i,j;if(f.isFunction(a))return this.each(function(b){f(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(o);for(d=0,e=this.length;d<e;d++){g=this[d];if(g.nodeType===1&&g.className)if(a){h=(" "+g.className+" ").replace(n," ");for(i=0,j=c.length;i<j;i++)h=h.replace(" "+c[i]+" "," ");g.className=f.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";if(f.isFunction(a))return this.each(function(c){f(this).toggleClass(a.call(this,c,this.className,b),b)});return this.each(function(){if(c==="string"){var e,g=0,h=f(this),i=b,j=a.split(o);while(e=j[g++])i=d?i:!h.hasClass(e),h[i?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&f._data(this,"__className__",this.className),this.className=this.className||a===!1?"":f._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ";for(var c=0,d=this.length;c<d;c++)if(this[c].nodeType===1&&(" "+this[c].className+" ").replace(n," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e=this[0];if(!arguments.length){if(e){c=f.valHooks[e.nodeName.toLowerCase()]||f.valHooks[e.type];if(c&&"get"in c&&(d=c.get(e,"value"))!==b)return d;d=e.value;return typeof d=="string"?d.replace(p,""):d==null?"":d}return b}var g=f.isFunction(a);return this.each(function(d){var e=f(this),h;if(this.nodeType===1){g?h=a.call(this,d,e.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c=a.selectedIndex,d=[],e=a.options,g=a.type==="select-one";if(c<0)return null;for(var h=g?c:0,i=g?c+1:e.length;h<i;h++){var j=e[h];if(j.selected&&(f.support.optDisabled?!j.disabled:j.getAttribute("disabled")===null)&&(!j.parentNode.disabled||!f.nodeName(j.parentNode,"optgroup"))){b=f(j).val();if(g)return b;d.push(b)}}if(g&&!d.length&&e.length)return f(e[c]).val();return d},set:function(a,b){var c=f.makeArray(b);f(a).find("option").each(function(){this.selected=f.inArray(f(this).val(),c)>=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attrFix:{tabindex:"tabIndex"},attr:function(a,c,d,e){var g=a.nodeType;if(!a||g===3||g===8||g===2)return b;if(e&&c in f.attrFn)return f(a)[c](d);if(!("getAttribute"in a))return f.prop(a,c,d);var h,i,j=g!==1||!f.isXMLDoc(a);j&&(c=f.attrFix[c]||c,i=f.attrHooks[c],i||(t.test(c)?i=v:u&&(i=u)));if(d!==b){if(d===null){f.removeAttr(a,c);return b}if(i&&"set"in i&&j&&(h=i.set(a,d,c))!==b)return h;a.setAttribute(c,""+d);return d}if(i&&"get"in i&&j&&(h=i.get(a,c))!==null)return h;h=a.getAttribute(c);return h===null?b:h},removeAttr:function(a,b){var c;a.nodeType===1&&(b=f.attrFix[b]||b,f.attr(a,b,""),a.removeAttribute(b),t.test(b)&&(c=f.propFix[b]||b)in a&&(a[c]=!1))},attrHooks:{type:{set:function(a,b){if(q.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},value:{get:function(a,b){if(u&&f.nodeName(a,"button"))return u.get(a,b);return b in a?a.value:null},set:function(a,b,c){if(u&&f.nodeName(a,"button"))return u.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e=a.nodeType;if(!a||e===3||e===8||e===2)return b;var g,h,i=e!==1||!f.isXMLDoc(a);i&&(c=f.propFix[c]||c,h=f.propHooks[c]);return d!==b?h&&"set"in h&&(g=h.set(a,d,c))!==b?g:a[c]=d:h&&"get"in h&&(g=h.get(a,c))!==null?g:a[c]},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):r.test(a.nodeName)||s.test(a.nodeName)&&a.href?0:b}}}}),f.attrHooks.tabIndex=f.propHooks.tabIndex,v={get:function(a,c){var d;return f.prop(a,c)===!0||(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase()));return c}},f.support.getSetAttribute||(u=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&d.nodeValue!==""?d.nodeValue:b},set:function(a,b,d){var e=a.getAttributeNode(d);e||(e=c.createAttribute(d),a.setAttributeNode(e));return e.nodeValue=b+""}},f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})})),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex);return null}})),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var w=/\.(.*)$/,x=/^(?:textarea|input|select)$/i,y=/\./g,z=/ /g,A=/[^\w\s.|`]/g,B=function(a){return a.replace(A,"\\$&")};f.event={add:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){if(d===!1)d=C;else if(!d)return;var g,h;d.handler&&(g=d,d=g.handler),d.guid||(d.guid=f.guid++);var i=f._data(a);if(!i)return;var j=i.events,k=i.handle;j||(i.events=j={}),k||(i.handle=k=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.handle.apply(k.elem,arguments):b}),k.elem=a,c=c.split(" ");var l,m=0,n;while(l=c[m++]){h=g?f.extend({},g):{handler:d,data:e},l.indexOf(".")>-1?(n=l.split("."),l=n.shift(),h.namespace=n.slice(0).sort().join(".")):(n=[],h.namespace=""),h.type=l,h.guid||(h.guid=d.guid);var o=j[l],p=f.event.special[l]||{};if(!o){o=j[l]=[];if(!p.setup||p.setup.call(a,e,n,k)===!1)a.addEventListener?a.addEventListener(l,k,!1):a.attachEvent&&a.attachEvent("on"+l,k)}p.add&&(p.add.call(a,h),h.handler.guid||(h.handler.guid=d.guid)),o.push(h),f.event.global[l]=!0}a=null}},global:{},remove:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){d===!1&&(d=C);var g,h,i,j,k=0,l,m,n,o,p,q,r,s=f.hasData(a)&&f._data(a),t=s&&s.events;if(!s||!t)return;c&&c.type&&(d=c.handler,c=c.type);if(!c||typeof c=="string"&&c.charAt(0)==="."){c=c||"";for(h in t)f.event.remove(a,h+c);return}c=c.split(" ");while(h=c[k++]){r=h,q=null,l=h.indexOf(".")<0,m=[],l||(m=h.split("."),h=m.shift(),n=new RegExp("(^|\\.)"+f.map(m.slice(0).sort(),B).join("\\.(?:.*\\.)?")+"(\\.|$)")),p=t[h];if(!p)continue;if(!d){for(j=0;j<p.length;j++){q=p[j];if(l||n.test(q.namespace))f.event.remove(a,r,q.handler,j),p.splice(j--,1)}continue}o=f.event.special[h]||{};for(j=e||0;j<p.length;j++){q=p[j];if(d.guid===q.guid){if(l||n.test(q.namespace))e==null&&p.splice(j--,1),o.remove&&o.remove.call(a,q);if(e!=null)break}}if(p.length===0||e!=null&&p.length===1)(!o.teardown||o.teardown.call(a,m)===!1)&&f.removeEvent(a,h,s.handle),g=null,delete
+t[h]}if(f.isEmptyObject(t)){var u=s.handle;u&&(u.elem=null),delete s.events,delete s.handle,f.isEmptyObject(s)&&f.removeData(a,b,!0)}}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,g){var h=c.type||c,i=[],j;h.indexOf("!")>=0&&(h=h.slice(0,-1),j=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if(!!e&&!f.event.customEvent[h]||!!f.event.global[h]){c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.exclusive=j,c.namespace=i.join("."),c.namespace_re=new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)");if(g||!e)c.preventDefault(),c.stopPropagation();if(!e){f.each(f.cache,function(){var a=f.expando,b=this[a];b&&b.events&&b.events[h]&&f.event.trigger(c,d,b.handle.elem)});return}if(e.nodeType===3||e.nodeType===8)return;c.result=b,c.target=e,d=d!=null?f.makeArray(d):[],d.unshift(c);var k=e,l=h.indexOf(":")<0?"on"+h:"";do{var m=f._data(k,"handle");c.currentTarget=k,m&&m.apply(k,d),l&&f.acceptData(k)&&k[l]&&k[l].apply(k,d)===!1&&(c.result=!1,c.preventDefault()),k=k.parentNode||k.ownerDocument||k===c.target.ownerDocument&&a}while(k&&!c.isPropagationStopped());if(!c.isDefaultPrevented()){var n,o=f.event.special[h]||{};if((!o._default||o._default.call(e.ownerDocument,c)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)){try{l&&e[h]&&(n=e[l],n&&(e[l]=null),f.event.triggered=h,e[h]())}catch(p){}n&&(e[l]=n),f.event.triggered=b}}return c.result}},handle:function(c){c=f.event.fix(c||a.event);var d=((f._data(this,"events")||{})[c.type]||[]).slice(0),e=!c.exclusive&&!c.namespace,g=Array.prototype.slice.call(arguments,0);g[0]=c,c.currentTarget=this;for(var h=0,i=d.length;h<i;h++){var j=d[h];if(e||c.namespace_re.test(j.namespace)){c.handler=j.handler,c.data=j.data,c.handleObj=j;var k=j.handler.apply(this,g);k!==b&&(c.result=k,k===!1&&(c.preventDefault(),c.stopPropagation()));if(c.isImmediatePropagationStopped())break}}return c.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(a){if(a[f.expando])return a;var d=a;a=f.Event(d);for(var e=this.props.length,g;e;)g=this.props[--e],a[g]=d[g];a.target||(a.target=a.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),!a.relatedTarget&&a.fromElement&&(a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement);if(a.pageX==null&&a.clientX!=null){var h=a.target.ownerDocument||c,i=h.documentElement,j=h.body;a.pageX=a.clientX+(i&&i.scrollLeft||j&&j.scrollLeft||0)-(i&&i.clientLeft||j&&j.clientLeft||0),a.pageY=a.clientY+(i&&i.scrollTop||j&&j.scrollTop||0)-(i&&i.clientTop||j&&j.clientTop||0)}a.which==null&&(a.charCode!=null||a.keyCode!=null)&&(a.which=a.charCode!=null?a.charCode:a.keyCode),!a.metaKey&&a.ctrlKey&&(a.metaKey=a.ctrlKey),!a.which&&a.button!==b&&(a.which=a.button&1?1:a.button&2?3:a.button&4?2:0);return a},guid:1e8,proxy:f.proxy,special:{ready:{setup:f.bindReady,teardown:f.noop},live:{add:function(a){f.event.add(this,M(a.origType,a.selector),f.extend({},a,{handler:L,guid:a.handler.guid}))},remove:function(a){f.event.remove(this,M(a.origType,a.selector),a)}},beforeunload:{setup:function(a,b,c){f.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}}},f.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},f.Event=function(a,b){if(!this.preventDefault)return new f.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?D:C):this.type=a,b&&f.extend(this,b),this.timeStamp=f.now(),this[f.expando]=!0},f.Event.prototype={preventDefault:function(){this.isDefaultPrevented=D;var a=this.originalEvent;!a||(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=D;var a=this.originalEvent;!a||(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=D,this.stopPropagation()},isDefaultPrevented:C,isPropagationStopped:C,isImmediatePropagationStopped:C};var E=function(a){var b=a.relatedTarget,c=!1,d=a.type;a.type=a.data,b!==this&&(b&&(c=f.contains(this,b)),c||(f.event.handle.apply(this,arguments),a.type=d))},F=function(a){a.type=a.data,f.event.handle.apply(this,arguments)};f.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){f.event.special[a]={setup:function(c){f.event.add(this,b,c&&c.selector?F:E,a)},teardown:function(a){f.event.remove(this,b,a&&a.selector?F:E)}}}),f.support.submitBubbles||(f.event.special.submit={setup:function(a,b){if(!f.nodeName(this,"form"))f.event.add(this,"click.specialSubmit",function(a){var b=a.target,c=f.nodeName(b,"input")||f.nodeName(b,"button")?b.type:"";(c==="submit"||c==="image")&&f(b).closest("form").length&&J("submit",this,arguments)}),f.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,c=f.nodeName(b,"input")||f.nodeName(b,"button")?b.type:"";(c==="text"||c==="password")&&f(b).closest("form").length&&a.keyCode===13&&J("submit",this,arguments)});else return!1},teardown:function(a){f.event.remove(this,".specialSubmit")}});if(!f.support.changeBubbles){var G,H=function(a){var b=f.nodeName(a,"input")?a.type:"",c=a.value;b==="radio"||b==="checkbox"?c=a.checked:b==="select-multiple"?c=a.selectedIndex>-1?f.map(a.options,function(a){return a.selected}).join("-"):"":f.nodeName(a,"select")&&(c=a.selectedIndex);return c},I=function(c){var d=c.target,e,g;if(!!x.test(d.nodeName)&&!d.readOnly){e=f._data(d,"_change_data"),g=H(d),(c.type!=="focusout"||d.type!=="radio")&&f._data(d,"_change_data",g);if(e===b||g===e)return;if(e!=null||g)c.type="change",c.liveFired=b,f.event.trigger(c,arguments[1],d)}};f.event.special.change={filters:{focusout:I,beforedeactivate:I,click:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(c==="radio"||c==="checkbox"||f.nodeName(b,"select"))&&I.call(this,a)},keydown:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(a.keyCode===13&&!f.nodeName(b,"textarea")||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&I.call(this,a)},beforeactivate:function(a){var b=a.target;f._data(b,"_change_data",H(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in G)f.event.add(this,c+".specialChange",G[c]);return x.test(this.nodeName)},teardown:function(a){f.event.remove(this,".specialChange");return x.test(this.nodeName)}},G=f.event.special.change.filters,G.focus=G.beforeactivate}f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){function e(a){var c=f.event.fix(a);c.type=b,c.originalEvent={},f.event.trigger(c,null,c.target),c.isDefaultPrevented()&&a.preventDefault()}var d=0;f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.each(["bind","one"],function(a,c){f.fn[c]=function(a,d,e){var g;if(typeof a=="object"){for(var h in a)this[c](h,d,a[h],e);return this}if(arguments.length===2||d===!1)e=d,d=b;c==="one"?(g=function(a){f(this).unbind(a,g);return e.apply(this,arguments)},g.guid=e.guid||f.guid++):g=e;if(a==="unload"&&c!=="one")this.one(a,d,e);else for(var i=0,j=this.length;i<j;i++)f.event.add(this[i],a,g,d);return this}}),f.fn.extend({unbind:function(a,b){if(typeof a=="object"&&!a.preventDefault)for(var c in a)this.unbind(c,a[c]);else for(var d=0,e=this.length;d<e;d++)f.event.remove(this[d],a,b);return this},delegate:function(a,b,c,d){return this.live(b,c,d,a)},undelegate:function(a,b,c){return arguments.length===0?this.unbind("live"):this.die(b,null,c,a)},trigger:function(a,b){return this.each(function(){f.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return f.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||f.guid++,d=0,e=function(c){var e=(f.data(this,"lastToggle"+a.guid)||0)%d;f.data(this,"lastToggle"+a.guid,e+1),c.preventDefault();return b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var K={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};f.each(["live","die"],function(a,c){f.fn[c]=function(a,d,e,g){var h,i=0,j,k,l,m=g||this.selector,n=g?this:f(this.context);if(typeof a=="object"&&!a.preventDefault){for(var o in a)n[c](o,d,a[o],m);return this}if(c==="die"&&!a&&g&&g.charAt(0)==="."){n.unbind(g);return this}if(d===!1||f.isFunction(d))e=d||C,d=b;a=(a||"").split(" ");while((h=a[i++])!=null){j=w.exec(h),k="",j&&(k=j[0],h=h.replace(w,""));if(h==="hover"){a.push("mouseenter"+k,"mouseleave"+k);continue}l=h,K[h]?(a.push(K[h]+k),h=h+k):h=(K[h]||h)+k;if(c==="live")for(var p=0,q=n.length;p<q;p++)f.event.add(n[p],"live."+M(h,m),{data:d,selector:m,handler:e,origType:h,origHandler:e,preType:l});else n.unbind("live."+M(h,m),e)}return this}}),f.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){f.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.bind(b,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0)}),function(){function u(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}if(i.nodeType===1){f||(i.sizcache=c,i.sizset=g);if(typeof b!="string"){if(i===b){j=!0;break}}else if(k.filter(b,[i]).length>0){j=i;break}}i=i[a]}d[g]=j}}}function t(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}i.nodeType===1&&!f&&(i.sizcache=c,i.sizset=g);if(i.nodeName.toLowerCase()===b){j=i;break}i=i[a]}d[g]=j}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d=0,e=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(b,d,f,g){f=f||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return f;var i,j,n,o,q,r,s,t,u=!0,w=k.isXML(d),x=[],y=b;do{a.exec(""),i=a.exec(y);if(i){y=i[3],x.push(i[1]);if(i[2]){o=i[3];break}}}while(i);if(x.length>1&&m.exec(b))if(x.length===2&&l.relative[x[0]])j=v(x[0]+x[1],d);else{j=l.relative[x[0]]?[d]:k(x.shift(),d);while(x.length)b=x.shift(),l.relative[b]&&(b+=x.shift()),j=v(b,j)}else{!g&&x.length>1&&d.nodeType===9&&!w&&l.match.ID.test(x[0])&&!l.match.ID.test(x[x.length-1])&&(q=k.find(x.shift(),d,w),d=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:p(g)}:k.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),j=q.expr?k.filter(q.expr,q.set):q.set,x.length>0?n=p(j):u=!1;while(x.length)r=x.pop(),s=r,l.relative[r]?s=x.pop():r="",s==null&&(s=d),l.relative[r](n,s,w)}else n=x=[]}n||(n=j),n||k.error(r||b);if(e.call(n)==="[object Array]")if(!u)f.push.apply(f,n);else if(d&&d.nodeType===1)for(t=0;n[t]!=null;t++)n[t]&&(n[t]===!0||n[t].nodeType===1&&k.contains(d,n[t]))&&f.push(j[t]);else for(t=0;n[t]!=null;t++)n[t]&&n[t].nodeType===1&&f.push(j[t]);else p(n,f);o&&(k(o,h,f,g),k.uniqueSort(f));return f};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},k.matches=function(a,b){return k(a,null,null,b)},k.matchesSelector=function(a,b){return k(b,null,null,[a]).length>0},k.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=l.order.length;e<f;e++){var g,h=l.order[e];if(g=l.leftMatch[h].exec(a)){var j=g[1];g.splice(1,1);if(j.substr(j.length-1)!=="\\"){g[1]=(g[1]||"").replace(i,""),d=l.find[h](g,b,c);if(d!=null){a=a.replace(l.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},k.filter=function(a,c,d,e){var f,g,h=a,i=[],j=c,m=c&&c[0]&&k.isXML(c[0]);while(a&&c.length){for(var n in l.filter)if((f=l.leftMatch[n].exec(a))!=null&&f[2]){var o,p,q=l.filter[n],r=f[1];g=!1,f.splice(1,1);if(r.substr(r.length-1)==="\\")continue;j===i&&(i=[]);if(l.preFilter[n]){f=l.preFilter[n](f,j,d,i,e,m);if(!f)g=o=!0;else if(f===!0)continue}if(f)for(var s=0;(p=j[s])!=null;s++)if(p){o=q(p,f,s,j);var t=e^!!o;d&&o!=null?t?g=!0:j[s]=!1:t&&(i.push(p),g=!0)}if(o!==b){d||(j=i),a=a.replace(l.match[n],"");if(!g)return[];break}}if(a===h)if(g==null)k.error(a);else break;h=a}return j},k.error=function(a){throw"Syntax error, unrecognized expression: "+a};var l=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b=="string",d=c&&!j.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1);a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&k.filter(b,a,!0)},">":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&k.filter(b,a,!0)}},"":function(a,b,c){var e,f=d++,g=u;typeof b=="string"&&!j.test(b)&&(b=b.toLowerCase(),e=b,g=t),g("parentNode",b,f,a,e,c)},"~":function(a,b,c){var e,f=d++,g=u;typeof b=="string"&&!j.test(b)&&(b=b.toLowerCase(),e=b,g=t),g("previousSibling",b,f,a,e,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(i,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&k.error(a[0]);a[0]=d++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=k(b[3],null,null,c);else{var g=k.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(l.match.POS.test(b[0])||l.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}k.error(e)},CHILD:function(a,b){var c=b[1],d=a;switch(c){case"only":case"first":while(d=d.previousSibling)if(d.nodeType===1)return!1;if(c==="first")return!0;d=a;case"last":while(d=d.nextSibling)if(d.nodeType===1)return!1;return!0;case"nth":var e=b[2],f=b[3];if(e===1&&f===0)return!0;var g=b[0],h=a.parentNode;if(h&&(h.sizcache!==g||!a.nodeIndex)){var i=0;for(d=h.firstChild;d;d=d.nextSibling)d.nodeType===1&&(d.nodeIndex=++i);h.sizcache=g}var j=a.nodeIndex-f;return e===0?j===0:j%e===0&&j/e>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f)return f(a,c,b,d)}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match)l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n));var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];if(e.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var f=a.length;c<f;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var r,s;c.documentElement.compareDocumentPosition?r=function(a,b){if(a===b){g=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(r=function(a,b){if(a===b){g=!0;return 0}if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],h=a.parentNode,i=b.parentNode,j=h;if(h===i)return s(a,b);if(!h)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return s(e[k],f[k]);return k===c?s(a,f[k],-1):s(e[k],b,1)},s=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),k.getText=function(a){var b="",c;for(var d=0;a[d];d++)c=a[d],c.nodeType===3||c.nodeType===4?b+=c.nodeValue:c.nodeType!==8&&(b+=k.getText(c.childNodes));return b},function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=k,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,e,f,g){e=e||c;if(!g&&!k.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return p(e.getElementsByTagName(b),f);if(h[2]&&l.find.CLASS&&e.getElementsByClassName)return p(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return p([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return p([],f);if(i.id===h[3])return p([i],f)}try{return p(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e,n=e.getAttribute("id"),o=n||d,q=e.parentNode,r=/^\s*[+~]/.test(b);n?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),r&&q&&(e=e.parentNode);try{if(!r||q)return p(e.querySelectorAll("[id='"+o+"'] "+b),f)}catch(s){}finally{n||m.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)k[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}k.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a))try{if(e||!l.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return k(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:k.contains=function(){return!1},k.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var v=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a))e+=c[0],a=a.replace(l.match.PSEUDO,"");a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g<h;g++)k(a,f[g],d);return k.filter(e,d)};f.find=k,f.expr=k.selectors,f.expr[":"]=f.expr.filters,f.unique=k.uniqueSort,f.text=k.getText,f.isXMLDoc=k.isXML,f.contains=k.c...
[truncated message content] |
|
From: <ma...@us...> - 2011-12-11 19:27:40
|
Revision: 565
http://openautomation.svn.sourceforge.net/openautomation/?rev=565&view=rev
Author: mayerch
Date: 2011-12-11 19:27:33 +0000 (Sun, 11 Dec 2011)
Log Message:
-----------
Initial commit for 2D (and very little 3D) mode.
Think of it as a proof of concept - and not anything to build on. Anything of it might change in the (hopefully: near) future.
Modified Paths:
--------------
CometVisu/trunk/visu/designs/structure_pure.js
CometVisu/trunk/visu/visu_config.xsd
Added Paths:
-----------
CometVisu/trunk/visu/media/
CometVisu/trunk/visu/media/demo_2d_backdrop_red_pot.png
CometVisu/trunk/visu/visu_config_2d3d.xml
Modified: CometVisu/trunk/visu/designs/structure_pure.js
===================================================================
--- CometVisu/trunk/visu/designs/structure_pure.js 2011-12-10 10:03:11 UTC (rev 564)
+++ CometVisu/trunk/visu/designs/structure_pure.js 2011-12-11 19:27:33 UTC (rev 565)
@@ -70,7 +70,8 @@
var pstyle = ( '0' != path ) ? 'display:none;' : ''; // subPage style
var name = $p.attr('name');
- var type = $p.attr('type'); //text, 2d or 3d
+ var type = $p.attr('type') || 'text'; //text, 2d or 3d
+ var backdrop = $p.attr('backdrop');
if( $p.attr('flavour') ) flavour = $p.attr('flavour');// sub design choice
var wstyle = ''; // widget style
if( $p.attr('align') ) wstyle += 'text-align:' + $p.attr('align') + ';';
@@ -87,13 +88,17 @@
}
var childs = $p.children();
- var container = $( '<div class="clearfix"/>' );
+ var container = $( '<div class="clearfix" />' );
var $container = $( '<div class="clearfix" path="'+path+'"/>');
for( var addr in address ) $container.bind( addr, this.update );
var container=$container;
container.append( '<h1>' + name + '</h1>' );
+ if( '2d' == type )
+ {
+ container.append( '<img src="' + backdrop + '" style="position: absolute; top: 0px; left: 0px;z-index:-1;"/>' );
+ }
$( childs ).each( function(i){
container.append( create_pages( childs[i], path + '_' + i, flavour ) );
} );
@@ -104,11 +109,13 @@
return ret_val;
},
attributes: {
- align: { type: 'string', required: false },
- flavour:{ type: 'string', required: false },
- name: { type: 'string', required: true },
- ga: { type: 'addr', required: false },
- visible:{ type: 'string', required: false }
+ align: { type: 'string', required: false },
+ flavour: { type: 'string', required: false },
+ name: { type: 'string', required: true },
+ ga: { type: 'addr', required: false },
+ visible: { type: 'string', required: false },
+ type: { type: 'string', required: false },
+ backdrop: { type: 'string', required: false }
},
elements: {
},
@@ -191,7 +198,9 @@
this.addCreator('info', {
create: function( page, path ) {
var $p = $(page);
- var ret_val = $('<div class="widget info" />');
+ var layout = $p.find('layout')[0];
+ var style = layout ? 'style="' + extractLayout( layout ) + '"' : '';
+ var ret_val = $('<div class="widget info" ' + style + ' />');
var labelElement = $p.find('label')[0];
var label = labelElement ? '<div class="label">' + labelElement.textContent + '</div>' : '';
var address = {};
@@ -218,6 +227,7 @@
styling: { type: 'styling', required: false }
},
elements: {
+ layout: { type: 'layout', required: false, multi: false },
label: { type: 'string', required: true, multi: false },
address: { type: 'address', required: true, multi: true }
},
@@ -227,7 +237,9 @@
this.addCreator('slide', {
create: function( page, path ) {
var $p = $(page);
- var ret_val = $('<div class="widget slide" />');
+ var layout = $p.find('layout')[0];
+ var style = layout ? 'style="' + extractLayout( layout ) + '"' : '';
+ var ret_val = $('<div class="widget slide" ' + style + ' />');
var labelElement = $p.find('label')[0];
var label = labelElement ? '<div class="label">' + labelElement.textContent + '</div>' : '';
var address = {};
@@ -330,6 +342,7 @@
styling: { type: 'styling', required: false }
},
elements: {
+ layout: { type: 'layout', required: false, multi: false },
label: { type: 'string', required: true, multi: false },
address: { type: 'address', required: true, multi: true }
},
@@ -1135,3 +1148,12 @@
return value;
}
+
+function extractLayout( layout )
+{
+ var ret_val = 'position:absolute;';
+ if( layout.getAttribute('x' ) ) ret_val += 'left:' + layout.getAttribute('x' ) + ';';
+ if( layout.getAttribute('y' ) ) ret_val += 'top:' + layout.getAttribute('y' ) + ';';
+ if( layout.getAttribute('width') ) ret_val += 'width:' + layout.getAttribute('width') + ';';
+ return ret_val;
+}
\ No newline at end of file
Added: CometVisu/trunk/visu/media/demo_2d_backdrop_red_pot.png
===================================================================
(Binary files differ)
Property changes on: CometVisu/trunk/visu/media/demo_2d_backdrop_red_pot.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: CometVisu/trunk/visu/visu_config.xsd
===================================================================
--- CometVisu/trunk/visu/visu_config.xsd 2011-12-10 10:03:11 UTC (rev 564)
+++ CometVisu/trunk/visu/visu_config.xsd 2011-12-11 19:27:33 UTC (rev 565)
@@ -16,6 +16,12 @@
<xsd:restriction base="xsd:string" />
</xsd:simpleType>
+<xsd:complexType name="layout">
+ <xsd:attribute name="x" type="xsd:string" use="optional" />
+ <xsd:attribute name="y" type="xsd:string" use="optional" />
+ <xsd:attribute name="width" type="xsd:string" use="optional" />
+</xsd:complexType>
+
<xsd:complexType name="address">
<xsd:simpleContent>
<xsd:extension base="addr">
@@ -180,6 +186,16 @@
<xsd:attribute ref="align" use="optional" />
<xsd:attribute name="ga" type="addr" use="optional" />
<xsd:attribute name="visible" type="xsd:boolean" />
+ <xsd:attribute name="type" use="optional">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="text"/>
+ <xsd:enumeration value="2d"/>
+ <xsd:enumeration value="3d"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:attribute>
+ <xsd:attribute name="backdrop" type="uri" use="optional" />
</xsd:complexType>
</xsd:element>
@@ -302,6 +318,7 @@
<xsd:choice maxOccurs="unbounded" minOccurs="1">
<xsd:element name="label" type="xsd:string" minOccurs="0" maxOccurs="1" />
<xsd:element name="address" type="address" minOccurs="1" />
+ <xsd:element name="layout" type="layout" minOccurs="0" maxOccurs="1" />
</xsd:choice>
<xsd:attribute ref="min" />
<xsd:attribute ref="max" />
@@ -314,6 +331,7 @@
<xsd:choice maxOccurs="unbounded" minOccurs="1">
<xsd:element name="label" type="xsd:string" maxOccurs="1" />
<xsd:element name="address" type="address" minOccurs="1"/>
+ <xsd:element name="layout" type="layout" minOccurs="0" maxOccurs="1" />
</xsd:choice>
<xsd:attribute ref="format" use="optional" />
<xsd:attribute ref="styling" use="optional" />
Added: CometVisu/trunk/visu/visu_config_2d3d.xml
===================================================================
--- CometVisu/trunk/visu/visu_config_2d3d.xml (rev 0)
+++ CometVisu/trunk/visu/visu_config_2d3d.xml 2011-12-11 19:27:33 UTC (rev 565)
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" design="pure" xsi:noNamespaceSchemaLocation="visu_config.xsd">
+ <meta>
+ <plugins>
+ <plugin name="colorchooser"/>
+ <plugin name="diagram"/>
+ </plugins>
+ <mappings>
+ <mapping name="Open_Close">
+ <entry value="0">zu</entry>
+ <entry value="1">offen</entry>
+ </mapping>
+ <mapping name="Close_Open">
+ <entry value="0">offen</entry>
+ <entry value="1">zu</entry>
+ </mapping>
+ <mapping name="On_Off">
+ <entry value="0">Aus</entry>
+ <entry value="1">An</entry>
+ </mapping>
+ <mapping name="Off_On">
+ <entry value="0">An</entry>
+ <entry value="1">Aus</entry>
+ </mapping>
+ <mapping name="KonnexHVAC">
+ <entry value="auto">Auto</entry>
+ <entry value="comfort">Komfort</entry>
+ <entry value="standby">Stand By</entry>
+ <entry value="economy">Economy</entry>
+ <entry value="building_protection">Haus-Schutz</entry>
+ </mapping>
+ </mappings>
+ <stylings>
+ <styling name="Red_Green">
+ <entry value="0">red</entry>
+ <entry value="1">green</entry>
+ </styling>
+ <styling name="Green_Red">
+ <entry value="0">green</entry>
+ <entry value="1">red</entry>
+ </styling>
+ <styling name="Blue_Green_Red">
+ <entry range_min="-100" range_max="20">blue</entry>
+ <entry range_min="20" range_max="22">green</entry>
+ <entry range_min="22" range_max="100">red</entry>
+ </styling>
+ </stylings>
+ <statusbar>
+ <status type="html"><![CDATA[
+ <img src="icon/comet_64_ff8000.png" alt="CometVisu" /> by <a href="http://www.cometvisu.org/">CometVisu.org</a>
+ - <a href=".?forceReload=true">Reload</a>
+ - <a href="?config=demo">Widget Demo</a>
+ ]]></status>
+ <status type="html" condition="!edit" hrefextend="config"><![CDATA[
+ - <a href="edit_config.html">Edit</a>
+ ]]></status>
+ <status type="html" condition="edit" hrefextend="all"><![CDATA[
+ - <a href=".">normal Mode</a>
+ ]]></status>
+ <status type="html"><![CDATA[
+ - <a href="check_config.php">Check Config</a>
+ <div style="float:right;padding-right:0.5em">Version: SVN</div>
+ ]]></status>
+ </statusbar>
+ </meta>
+ <page name="Start" type="text">
+ <line/>
+ <text align="center">Welcome to the CometVisu!</text>
+ <break/>
+ <page name="2D Demo" type="2d" backdrop="media/demo_2d_backdrop_red_pot.png">
+ <slide>
+ <layout x="0px" y="470px" width="600px" />
+ <label>Level</label>
+ <address transform="DPT:5.001" type="">12/7/52</address>
+ </slide>
+ <info format="%.2f">
+ <layout x="350px" y="370px" />
+ <address transform="DPT:5.001" type="">12/7/52</address>
+ </info>
+ </page>
+ <page name="3D Demo" >
+ <text>not avialable at the moment...</text>
+ </page>
+ <line/>
+ </page>
+</pages>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2011-12-10 10:03:17
|
Revision: 564
http://openautomation.svn.sourceforge.net/openautomation/?rev=564&view=rev
Author: mayerch
Date: 2011-12-10 10:03:11 +0000 (Sat, 10 Dec 2011)
Log Message:
-----------
Enable switching between floors
Modified Paths:
--------------
JSFloorPlan/trunk/jsfloorplan.js
JSFloorPlan/trunk/jsfloorplan_example_helper.js
Modified: JSFloorPlan/trunk/jsfloorplan.js
===================================================================
--- JSFloorPlan/trunk/jsfloorplan.js 2011-12-09 22:48:33 UTC (rev 563)
+++ JSFloorPlan/trunk/jsfloorplan.js 2011-12-10 10:03:11 UTC (rev 564)
@@ -502,6 +502,7 @@
// Init after the scene was set up
selectChange( 'showNodes' );
selectChange( 'showWallLines' );
+ selectChange( 'showFloor' );
}
function show3D( rotation, tilt )
@@ -512,9 +513,10 @@
var cx = -Math.cos(rotation) * Math.cos(tilt);
var cy = Math.sin(rotation) * Math.cos(tilt);
var cz = Math.sin(tilt);
+ var heightOfGround = buildingProperties.floor[ showStates.showFloor ].heightOfGround;
camera.up = new THREE.Vector3( Math.cos(rotation) * Math.sin(tilt), -Math.sin(rotation) * Math.sin(tilt), Math.cos(tilt) );
- camera.position = new THREE.Vector3( cx*dist + buildingProperties.x_center, cy*dist + buildingProperties.y_center, dist * cz );
- camera.lookAt( new THREE.Vector3( buildingProperties.x_center, buildingProperties.y_center, 0) );
+ camera.position = new THREE.Vector3( cx*dist + buildingProperties.x_center, cy*dist + buildingProperties.y_center, dist * cz + heightOfGround);
+ camera.lookAt( new THREE.Vector3( buildingProperties.x_center, buildingProperties.y_center, heightOfGround) );
pointLight.position = camera.position;
// update opacity
Modified: JSFloorPlan/trunk/jsfloorplan_example_helper.js
===================================================================
--- JSFloorPlan/trunk/jsfloorplan_example_helper.js 2011-12-09 22:48:33 UTC (rev 563)
+++ JSFloorPlan/trunk/jsfloorplan_example_helper.js 2011-12-10 10:03:11 UTC (rev 564)
@@ -209,6 +209,7 @@
});
$('select').change(function(e){
showStates[ e.target.name ] = e.target.value;
+ selectChange( e.target.name );
show3D( roll, tilt );
}).each(function(){
showStates[ this.name ] = this.value; // init
@@ -237,6 +238,14 @@
});
});
break;
+
+ case 'showFloor':
+ $( buildingProperties.floor ).each( function( number ){
+ THREE.SceneUtils.traverseHierarchy( this.wallGroup, function( object ) {
+ object.visible = ( showStates['showFloor'] == number );
+ });
+ });
+ break;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2011-12-09 22:48:39
|
Revision: 563
http://openautomation.svn.sourceforge.net/openautomation/?rev=563&view=rev
Author: mayerch
Date: 2011-12-09 22:48:33 +0000 (Fri, 09 Dec 2011)
Log Message:
-----------
Clean up
Modified Paths:
--------------
JSFloorPlan/trunk/jsfloorplan.js
Modified: JSFloorPlan/trunk/jsfloorplan.js
===================================================================
--- JSFloorPlan/trunk/jsfloorplan.js 2011-12-09 22:42:32 UTC (rev 562)
+++ JSFloorPlan/trunk/jsfloorplan.js 2011-12-09 22:48:33 UTC (rev 563)
@@ -80,9 +80,6 @@
// this array will contain all vertices to show in the svg
var vertices = Array();
-// this array will contain all the lines to show by refencing
-// the corresponding vertices
-var lines = Array();
// infos about the building
var buildingProperties = { floor: [], Object3D: new THREE.Object3D() };
var imageCenter = new Object;
@@ -132,8 +129,6 @@
buildingProperties.floor[floorCount].height = floorheight;
buildingProperties.floor[floorCount].heightOfGround = heightOfGround;
- lines[floorCount] = new Array;
-
var floorWallsStart = floorWalls.length;
// iterate over the content of this floor
@@ -289,35 +284,15 @@
var v1 = new Object; v1.x = s1.x-s2.x; v1.y = s1.y-s2.y;
var v2 = new Object; v2.x = e1.x-s2.x; v2.y = e1.y-s2.y;
var v3 = new Object; v3.x = e1.x-e2.x; v3.y = e1.y-e2.y;
- /*
if( (v1.x*v2.y - v1.y*v2.x)*(v2.x*v3.y - v2.y*v3.x) > 0 )
{
- e1 = vertices[ floorWalls[j].endVertex [1] ];
- e2 = vertices[ floorWalls[j].endVertex [0] ];
- /////
- lines[floorCount].push( Array(floorWalls[j].startVertex[0],floorWalls[j].endVertex[1]) );
- lines[floorCount].push( Array(floorWalls[j].start ,floorWalls[j].end , floorWalls[j].thickness, floorWalls[j].texture, floorWalls[j].holes) );
- lines[floorCount].push( Array(floorWalls[j].startVertex[1],floorWalls[j].endVertex[0]) );
- } else {
- lines[floorCount].push( Array(floorWalls[j].startVertex[0],floorWalls[j].endVertex[0]) );
- lines[floorCount].push( Array(floorWalls[j].start ,floorWalls[j].end , floorWalls[j].thickness, floorWalls[j].texture, floorWalls[j].holes) );
- lines[floorCount].push( Array(floorWalls[j].startVertex[1],floorWalls[j].endVertex[1]) );
+ e1 = vertices [ floorWalls[j].endVertex[1] ];
+ e2 = vertices [ floorWalls[j].endVertex[0] ];
}
- */
- //#######################################
- var s1 = vertices [ floorWalls[j].startVertex[0] ];
- var e1 = vertices [ floorWalls[j].endVertex[1] ];
var sm = floorNodes[ floorWalls[j].start ];
var em = floorNodes[ floorWalls[j].end ];
var sh = floorNodes[ floorWalls[j].start ].z ;
var eh = floorNodes[ floorWalls[j].end ].z ;
- var s2 = vertices [ floorWalls[j].startVertex[1] ];
- var e2 = vertices [ floorWalls[j].endVertex[0] ];
- if( (v1.x*v2.y - v1.y*v2.x)*(v2.x*v3.y - v2.y*v3.x) < 0 )
- {
- e1 = vertices [ floorWalls[j].endVertex[0] ];
- e2 = vertices [ floorWalls[j].endVertex[1] ];
- }
var wallSideOrder = (s2.x-s1.x)*(e1.y-s1.y) - (s2.y-s1.y)*(e1.x-s1.x);
var geometry = new THREE.Geometry();
@@ -364,8 +339,6 @@
geometry.computeFaceNormals();
var mesh = new THREE.Mesh(geometry, cubeMaterial);
wallGroup.add(mesh);
-
- //#######################################
} // end for( j=0; j<floorWalls.length; j++ )
Object3D.add( lineGroup );
Object3D.add( wallGroup );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2011-12-09 22:42:38
|
Revision: 562
http://openautomation.svn.sourceforge.net/openautomation/?rev=562&view=rev
Author: mayerch
Date: 2011-12-09 22:42:32 +0000 (Fri, 09 Dec 2011)
Log Message:
-----------
Structure improvements: create 3D objects inline
Modified Paths:
--------------
JSFloorPlan/trunk/jsfloorplan.js
JSFloorPlan/trunk/jsfloorplan_example_helper.js
Modified: JSFloorPlan/trunk/jsfloorplan.js
===================================================================
--- JSFloorPlan/trunk/jsfloorplan.js 2011-12-09 21:08:54 UTC (rev 561)
+++ JSFloorPlan/trunk/jsfloorplan.js 2011-12-09 22:42:32 UTC (rev 562)
@@ -128,7 +128,7 @@
var floorName = floor.getAttribute('name');
buildingProperties.floor[floorCount].name = floorName;
- var floorheight = floor.getAttribute('height');
+ var floorheight = Number( floor.getAttribute('height') );
buildingProperties.floor[floorCount].height = floorheight;
buildingProperties.floor[floorCount].heightOfGround = heightOfGround;
@@ -268,8 +268,9 @@
}
} // end for( var id in floorNodes )
Object3D.add( nodeGroup );
-
+
// show walls
+ var lineGroup = new THREE.Object3D(); lineGroup.name = 'lineGroup';
var wallGroup = new THREE.Object3D(); wallGroup.name = 'wallGroup';
for( var j = floorWallsStart; j<floorWalls.length; j++ )
{
@@ -278,7 +279,7 @@
var lineGeo = new THREE.Geometry();
lineGeo.vertices.push( new THREE.Vertex( new THREE.Vector3( vs.x, vs.y, heightOfGround ) ) );
lineGeo.vertices.push( new THREE.Vertex( new THREE.Vector3( ve.x, ve.y, heightOfGround ) ) );
- wallGroup.add( new THREE.Line( lineGeo, lineMaterial ) );
+ lineGroup.add( new THREE.Line( lineGeo, lineMaterial ) );
var s1 = vertices[ floorWalls[j].startVertex[0] ];
var e1 = vertices[ floorWalls[j].endVertex [0] ];
@@ -288,6 +289,7 @@
var v1 = new Object; v1.x = s1.x-s2.x; v1.y = s1.y-s2.y;
var v2 = new Object; v2.x = e1.x-s2.x; v2.y = e1.y-s2.y;
var v3 = new Object; v3.x = e1.x-e2.x; v3.y = e1.y-e2.y;
+ /*
if( (v1.x*v2.y - v1.y*v2.x)*(v2.x*v3.y - v2.y*v3.x) > 0 )
{
e1 = vertices[ floorWalls[j].endVertex [1] ];
@@ -301,11 +303,76 @@
lines[floorCount].push( Array(floorWalls[j].start ,floorWalls[j].end , floorWalls[j].thickness, floorWalls[j].texture, floorWalls[j].holes) );
lines[floorCount].push( Array(floorWalls[j].startVertex[1],floorWalls[j].endVertex[1]) );
}
+ */
+ //#######################################
+ var s1 = vertices [ floorWalls[j].startVertex[0] ];
+ var e1 = vertices [ floorWalls[j].endVertex[1] ];
+ var sm = floorNodes[ floorWalls[j].start ];
+ var em = floorNodes[ floorWalls[j].end ];
+ var sh = floorNodes[ floorWalls[j].start ].z ;
+ var eh = floorNodes[ floorWalls[j].end ].z ;
+ var s2 = vertices [ floorWalls[j].startVertex[1] ];
+ var e2 = vertices [ floorWalls[j].endVertex[0] ];
+ if( (v1.x*v2.y - v1.y*v2.x)*(v2.x*v3.y - v2.y*v3.x) < 0 )
+ {
+ e1 = vertices [ floorWalls[j].endVertex[0] ];
+ e2 = vertices [ floorWalls[j].endVertex[1] ];
+ }
+ var wallSideOrder = (s2.x-s1.x)*(e1.y-s1.y) - (s2.y-s1.y)*(e1.x-s1.x);
+ var geometry = new THREE.Geometry();
+
+ //geometry.faceVertexUvs[0].push([
+ // new THREE.UV(u_value, v_value)), new THREE.UV(u_value, v_value)), new THREE.UV(u_value, v_value))
+ //]);
+ geometry.vertices.push(new THREE.Vertex(new THREE.Vector3(e1.x,e1.y,heightOfGround )));
+ geometry.vertices.push(new THREE.Vertex(new THREE.Vector3(e1.x,e1.y,heightOfGround + sh)));
+ geometry.vertices.push(new THREE.Vertex(new THREE.Vector3(s1.x,s1.y,heightOfGround )));
+ geometry.vertices.push(new THREE.Vertex(new THREE.Vector3(s1.x,s1.y,heightOfGround + sh)));
+ geometry.vertices.push(new THREE.Vertex(new THREE.Vector3(sm.x,sm.y,heightOfGround + sh)));
+
+ geometry.vertices.push(new THREE.Vertex(new THREE.Vector3(s2.x,s2.y,heightOfGround )));
+ geometry.vertices.push(new THREE.Vertex(new THREE.Vector3(s2.x,s2.y,heightOfGround + sh)));
+ geometry.vertices.push(new THREE.Vertex(new THREE.Vector3(e2.x,e2.y,heightOfGround )));
+ geometry.vertices.push(new THREE.Vertex(new THREE.Vector3(e2.x,e2.y,heightOfGround + sh)));
+ geometry.vertices.push(new THREE.Vertex(new THREE.Vector3(em.x,em.y,heightOfGround + sh)));
+
+ if( wallSideOrder < 0 )
+ {
+ // Add the wall sides
+ geometry.faces.push(new THREE.Face3( 0, 1, 2 ));
+ geometry.faces.push(new THREE.Face3( 3, 2, 1 ));
+ geometry.faces.push(new THREE.Face3( 5, 6, 7 ));
+ geometry.faces.push(new THREE.Face3( 8, 7, 6 ));
+ // Add the wall tops
+ geometry.faces.push(new THREE.Face3( 4, 3, 6 ));
+ geometry.faces.push(new THREE.Face3( 1, 6, 3 ));
+ geometry.faces.push(new THREE.Face3( 6, 1, 8 ));
+ geometry.faces.push(new THREE.Face3( 9, 8, 1 ));
+ } else {
+ // Add the wall sides
+ geometry.faces.push(new THREE.Face3( 0, 2, 1 ));
+ geometry.faces.push(new THREE.Face3( 3, 1, 2 ));
+ geometry.faces.push(new THREE.Face3( 5, 7, 6 ));
+ geometry.faces.push(new THREE.Face3( 8, 6, 7 ));
+ // Add the wall tops
+ geometry.faces.push(new THREE.Face3( 4, 6, 3 ));
+ geometry.faces.push(new THREE.Face3( 1, 3, 6 ));
+ geometry.faces.push(new THREE.Face3( 6, 8, 1 ));
+ geometry.faces.push(new THREE.Face3( 9, 1, 8 ));
+ }
+
+ geometry.computeFaceNormals();
+ var mesh = new THREE.Mesh(geometry, cubeMaterial);
+ wallGroup.add(mesh);
+
+ //#######################################
} // end for( j=0; j<floorWalls.length; j++ )
+ Object3D.add( lineGroup );
Object3D.add( wallGroup );
buildingProperties.floor[floorCount].Object3D = Object3D;
buildingProperties.floor[floorCount].nodeGroup = nodeGroup;
+ buildingProperties.floor[floorCount].lineGroup = lineGroup;
buildingProperties.floor[floorCount].wallGroup = wallGroup;
buildingProperties.Object3D.add( Object3D ); // add / link; note: we use that JavaScript is not copying objects but uses ref counting on them here!
@@ -333,7 +400,7 @@
var point = new Object;
point.x = Number( node.getAttribute('x') );
point.y = Number( node.getAttribute('y') );
- point.z = node.hasAttribute('z') ? Number( node.getAttribute('z') ) : floorheight;
+ point.z = Number( node.hasAttribute('z') ? node.getAttribute('z') : floorheight );
point.neighbour = new Array;
floorNodes[id] = point;
@@ -451,102 +518,6 @@
var showFloor = showStates.showFloor;
- for( var i=0; i<lines[showFloor].length; )
- {
- /*
- var s1 = rotate2D( rot_s, rot_c, vertices [ lines[showFloor][ i][0] ], imageCenter );
- var e1 = rotate2D( rot_s, rot_c, vertices [ lines[showFloor][ i][1] ], imageCenter );
- var sm = rotate2D( rot_s, rot_c, floorNodes[ lines[showFloor][++i][1] ], imageCenter );
- var em = rotate2D( rot_s, rot_c, floorNodes[ lines[showFloor][ i][0] ], imageCenter );
- var sh = v_short * floorNodes[ lines[showFloor][i][1] ].z;
- var eh = v_short * floorNodes[ lines[showFloor][i][0] ].z;
- var thickness = lines[showFloor][ i][2];
- var texture = lines[showFloor][ i][3];
- var holes = lines[showFloor][ i][4];
- var s2 = rotate2D( rot_s, rot_c, vertices [ lines[showFloor][++i][0] ], imageCenter );
- var e2 = rotate2D( rot_s, rot_c, vertices [ lines[showFloor][ i][1] ], imageCenter );
- */
- var s1 = vertices [ lines[showFloor][ i][0] ];
- var e1 = vertices [ lines[showFloor][ i][1] ];
- var sm = floorNodes[ lines[showFloor][++i][1] ];
- var em = floorNodes[ lines[showFloor][ i][0] ];
-// var sh = 2.44;//floorNodes[ lines[showFloor][i][1] ].z ;
-// var eh = 2.44;//floorNodes[ lines[showFloor][i][0] ].z ;
- var sh = floorNodes[ lines[showFloor][i][1] ].z ;
- var eh = floorNodes[ lines[showFloor][i][0] ].z ;
- var s2 = vertices [ lines[showFloor][++i][0] ];
- var e2 = vertices [ lines[showFloor][ i][1] ];
- ++i;
- var wallSideOrder = (s2.x-s1.x)*(e1.y-s1.y) - (s2.y-s1.y)*(e1.x-s1.x);
- //var Tvertices = [];
-
- /**************
- var sphere = new THREE.Mesh( new THREE.SphereGeometry(0.1, 4, 4), sphereMaterial);
- sphere.position = new THREE.Vector3(sm.x,sm.y,0);
- //Tvertices.push(sphere.position);
- scene.add(sphere);
- var sphere = new THREE.Mesh( new THREE.SphereGeometry(0.1, 4, 4), sphereMaterial);
- sphere.position = new THREE.Vector3(sm.x,sm.y,sh);
- //Tvertices.push(sphere.position);
- scene.add(sphere);
- var sphere = new THREE.Mesh( new THREE.SphereGeometry(0.1, 4, 4), sphereMaterial);
- sphere.position = new THREE.Vector3(em.x,em.y,0);
- //Tvertices.push(sphere.position);
- scene.add(sphere);
- var sphere = new THREE.Mesh( new THREE.SphereGeometry(0.1, 4, 4), sphereMaterial);
- sphere.position = new THREE.Vector3(em.x,em.y,eh);
- //Tvertices.push(sphere.position);
- scene.add(sphere);
- */
- var geometry = new THREE.Geometry();
-
- //geometry.faceVertexUvs[0].push([
- // new THREE.UV(u_value, v_value)), new THREE.UV(u_value, v_value)), new THREE.UV(u_value, v_value))
- //]);
- geometry.vertices.push(new THREE.Vertex(new THREE.Vector3(e1.x,e1.y,0)));
- geometry.vertices.push(new THREE.Vertex(new THREE.Vector3(e1.x,e1.y,sh)));
- geometry.vertices.push(new THREE.Vertex(new THREE.Vector3(s1.x,s1.y,0)));
- geometry.vertices.push(new THREE.Vertex(new THREE.Vector3(s1.x,s1.y,sh)));
- geometry.vertices.push(new THREE.Vertex(new THREE.Vector3(sm.x,sm.y,sh)));
-
- geometry.vertices.push(new THREE.Vertex(new THREE.Vector3(s2.x,s2.y,0)));
- geometry.vertices.push(new THREE.Vertex(new THREE.Vector3(s2.x,s2.y,sh)));
- geometry.vertices.push(new THREE.Vertex(new THREE.Vector3(e2.x,e2.y,0)));
- geometry.vertices.push(new THREE.Vertex(new THREE.Vector3(e2.x,e2.y,sh)));
- geometry.vertices.push(new THREE.Vertex(new THREE.Vector3(em.x,em.y,sh)));
-
- if( wallSideOrder < 0 )
- {
- // Add the wall sides
- geometry.faces.push(new THREE.Face3( 0, 1, 2 ));
- geometry.faces.push(new THREE.Face3( 3, 2, 1 ));
- geometry.faces.push(new THREE.Face3( 5, 6, 7 ));
- geometry.faces.push(new THREE.Face3( 8, 7, 6 ));
- // Add the wall tops
- geometry.faces.push(new THREE.Face3( 4, 3, 6 ));
- geometry.faces.push(new THREE.Face3( 1, 6, 3 ));
- geometry.faces.push(new THREE.Face3( 6, 1, 8 ));
- geometry.faces.push(new THREE.Face3( 9, 8, 1 ));
- } else {
- // Add the wall sides
- geometry.faces.push(new THREE.Face3( 0, 2, 1 ));
- geometry.faces.push(new THREE.Face3( 3, 1, 2 ));
- geometry.faces.push(new THREE.Face3( 5, 7, 6 ));
- geometry.faces.push(new THREE.Face3( 8, 6, 7 ));
- // Add the wall tops
- geometry.faces.push(new THREE.Face3( 4, 6, 3 ));
- geometry.faces.push(new THREE.Face3( 1, 3, 6 ));
- geometry.faces.push(new THREE.Face3( 6, 8, 1 ));
- geometry.faces.push(new THREE.Face3( 9, 1, 8 ));
- }
-
-
- geometry.computeFaceNormals();
- //var mesh = new THREE.Mesh(geometry, new THREE.MeshNormalMaterial());
- var mesh = new THREE.Mesh(geometry, cubeMaterial);
- scene.add(mesh);
- }
-
///////////
scene.add(pointLight);
scene.add(ambientLight);
Modified: JSFloorPlan/trunk/jsfloorplan_example_helper.js
===================================================================
--- JSFloorPlan/trunk/jsfloorplan_example_helper.js 2011-12-09 21:08:54 UTC (rev 561)
+++ JSFloorPlan/trunk/jsfloorplan_example_helper.js 2011-12-09 22:42:32 UTC (rev 562)
@@ -232,7 +232,7 @@
case 'showWallLines':
$( buildingProperties.floor ).each( function(){
- THREE.SceneUtils.traverseHierarchy( this.wallGroup, function( object ) {
+ THREE.SceneUtils.traverseHierarchy( this.lineGroup, function( object ) {
object.visible = showStates['showWallLines'];
});
});
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2011-12-09 21:09:00
|
Revision: 561
http://openautomation.svn.sourceforge.net/openautomation/?rev=561&view=rev
Author: mayerch
Date: 2011-12-09 21:08:54 +0000 (Fri, 09 Dec 2011)
Log Message:
-----------
Add check boxes to show nodes and/or wall lines
Modified Paths:
--------------
JSFloorPlan/trunk/index.html
JSFloorPlan/trunk/jsfloorplan.js
JSFloorPlan/trunk/jsfloorplan_example_helper.js
Modified: JSFloorPlan/trunk/index.html
===================================================================
--- JSFloorPlan/trunk/index.html 2011-12-09 17:28:37 UTC (rev 560)
+++ JSFloorPlan/trunk/index.html 2011-12-09 21:08:54 UTC (rev 561)
@@ -83,6 +83,17 @@
</tr>
<tr>
<td>
+ Zeige Nodes: <input type="checkbox" name="showNodes" />
+ </td><td>
+ Zeige Walls: <input type="checkbox" name="showWallLines" />
+ </td><td>
+ </td><td>
+ </td><td>
+ </td><td>
+ </td>
+ </tr>
+ <tr>
+ <td>
Transparenz: <select size="1" name="fillOpacity">
<option value="0.1">0.1 - sehr transparent</option>
<option value="0.2">0.2</option>
Modified: JSFloorPlan/trunk/jsfloorplan.js
===================================================================
--- JSFloorPlan/trunk/jsfloorplan.js 2011-12-09 17:28:37 UTC (rev 560)
+++ JSFloorPlan/trunk/jsfloorplan.js 2011-12-09 21:08:54 UTC (rev 561)
@@ -77,7 +77,6 @@
$.get('floorplan01.xml', parseXMLFloorPlan, 'xml');
}
var floor;
-var floorCount = -1;
// this array will contain all vertices to show in the svg
var vertices = Array();
@@ -85,7 +84,7 @@
// the corresponding vertices
var lines = Array();
// infos about the building
-var buildingProperties = new Object;
+var buildingProperties = { floor: [], Object3D: new THREE.Object3D() };
var imageCenter = new Object;
var noFloorplan = true;
@@ -93,6 +92,9 @@
{
noFloorplan = false;
+ var floorCount = -1;
+ var heightOfGround = 0; // the base level of the current floor
+
// basic check if the document seems right
// this could be avoided if the XML file would be validated
// with a DTD
@@ -120,9 +122,16 @@
return alert( "ERROR: Not a valid floor plan! " +
"Expected: 'floor', found '" + floor.tagName + "'" );
+ floorCount++;
+ buildingProperties.floor[floorCount] = {};
+
var floorName = floor.getAttribute('name');
+ buildingProperties.floor[floorCount].name = floorName;
+
var floorheight = floor.getAttribute('height');
- floorCount++;
+ buildingProperties.floor[floorCount].height = floorheight;
+ buildingProperties.floor[floorCount].heightOfGround = heightOfGround;
+
lines[floorCount] = new Array;
var floorWallsStart = floorWalls.length;
@@ -153,6 +162,9 @@
// accessable objects
// => derive the necessary information
+ // group all elements on this floor
+ var Object3D = new THREE.Object3D();
+
// add the information to each node to which nodes it's connected to
for( var j = floorWallsStart; j < floorWalls.length; j++ )
{
@@ -162,11 +174,19 @@
floorNodes[ floorWalls[j].start ].neighbour.push( j+1 );
floorNodes[ floorWalls[j].end ].neighbour.push( -j-1 );
}
+
+ var nodeGroup = new THREE.Object3D(); nodeGroup.name = 'nodeGroup';
for( var id in floorNodes )
{
// calculate the vectors showing to the neighbours
var vectors = new Array();
var start = floorNodes[id];
+
+ // show them on request as spheres
+ var sphere = new THREE.Mesh( new THREE.SphereGeometry(0.1, 4, 4), sphereMaterial);
+ sphere.position = new THREE.Vector3( start.x, start.y, heightOfGround );
+ nodeGroup.add(sphere);
+
for( var j=0; j<floorNodes[id].neighbour.length; j++ )
{
var vec = new Object;
@@ -247,10 +267,19 @@
vertices.push( vertex );
}
} // end for( var id in floorNodes )
+ Object3D.add( nodeGroup );
// show walls
+ var wallGroup = new THREE.Object3D(); wallGroup.name = 'wallGroup';
for( var j = floorWallsStart; j<floorWalls.length; j++ )
{
+ var vs = floorNodes[ floorWalls[j].start ];
+ var ve = floorNodes[ floorWalls[j].end ];
+ var lineGeo = new THREE.Geometry();
+ lineGeo.vertices.push( new THREE.Vertex( new THREE.Vector3( vs.x, vs.y, heightOfGround ) ) );
+ lineGeo.vertices.push( new THREE.Vertex( new THREE.Vector3( ve.x, ve.y, heightOfGround ) ) );
+ wallGroup.add( new THREE.Line( lineGeo, lineMaterial ) );
+
var s1 = vertices[ floorWalls[j].startVertex[0] ];
var e1 = vertices[ floorWalls[j].endVertex [0] ];
var s2 = vertices[ floorWalls[j].startVertex[1] ];
@@ -273,6 +302,14 @@
lines[floorCount].push( Array(floorWalls[j].startVertex[1],floorWalls[j].endVertex[1]) );
}
} // end for( j=0; j<floorWalls.length; j++ )
+ Object3D.add( wallGroup );
+
+ buildingProperties.floor[floorCount].Object3D = Object3D;
+ buildingProperties.floor[floorCount].nodeGroup = nodeGroup;
+ buildingProperties.floor[floorCount].wallGroup = wallGroup;
+ buildingProperties.Object3D.add( Object3D ); // add / link; note: we use that JavaScript is not copying objects but uses ref counting on them here!
+
+ heightOfGround += floorheight;
} // end floor
buildingProperties.x_center = (buildingProperties.x_max - buildingProperties.x_min) / 2;
@@ -410,6 +447,8 @@
if( noFloorplan ) return;
noSetup = false;
+ scene.add( buildingProperties.Object3D );
+
var showFloor = showStates.showFloor;
for( var i=0; i<lines[showFloor].length; )
@@ -515,6 +554,10 @@
var $container = $('#top_level');
// attach the render-supplied DOM element
$container.append(renderer.domElement);
+
+ // Init after the scene was set up
+ selectChange( 'showNodes' );
+ selectChange( 'showWallLines' );
}
function show3D( rotation, tilt )
Modified: JSFloorPlan/trunk/jsfloorplan_example_helper.js
===================================================================
--- JSFloorPlan/trunk/jsfloorplan_example_helper.js 2011-12-09 17:28:37 UTC (rev 560)
+++ JSFloorPlan/trunk/jsfloorplan_example_helper.js 2011-12-09 21:08:54 UTC (rev 561)
@@ -51,7 +51,7 @@
// create a WebGL renderer, camera
// and a scene
-var renderer = new THREE.WebGLRenderer();
+var renderer = new THREE.WebGLRenderer({antialias: true});
var camera = new THREE.PerspectiveCamera(
VIEW_ANGLE,
ASPECT,
@@ -113,6 +113,8 @@
cube.position = new THREE.Vector3(50,50,50);
//scene.add( cube );
+var lineMaterial = new THREE.LineBasicMaterial( { color: 0x0099ff, linewidth: 2 } );
+
// create a point light
var pointLight = new THREE.PointLight( 0xFFFFFF );
@@ -200,6 +202,7 @@
{
$('input').change(function(e){
showStates[ e.target.name ] = e.target.checked;
+ selectChange( e.target.name );
show3D( roll, tilt );
}).each(function(){
showStates[ this.name ] = this.checked; // init
@@ -215,6 +218,28 @@
createSlider();
}
+function selectChange( name )
+{
+ switch( name )
+ {
+ case 'showNodes':
+ $( buildingProperties.floor ).each( function(){
+ THREE.SceneUtils.traverseHierarchy( this.nodeGroup, function( object ) {
+ object.visible = showStates['showNodes'];
+ });
+ });
+ break;
+
+ case 'showWallLines':
+ $( buildingProperties.floor ).each( function(){
+ THREE.SceneUtils.traverseHierarchy( this.wallGroup, function( object ) {
+ object.visible = showStates['showWallLines'];
+ });
+ });
+ break;
+ }
+}
+
var toggle = false;
var animation;
function my_click()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2011-12-09 17:28:43
|
Revision: 560
http://openautomation.svn.sourceforge.net/openautomation/?rev=560&view=rev
Author: mayerch
Date: 2011-12-09 17:28:37 +0000 (Fri, 09 Dec 2011)
Log Message:
-----------
Remove even more old SVG stuff to prepare for a clean WebGL/Three.js implementation
Modified Paths:
--------------
JSFloorPlan/trunk/jsfloorplan.js
Modified: JSFloorPlan/trunk/jsfloorplan.js
===================================================================
--- JSFloorPlan/trunk/jsfloorplan.js 2011-12-09 16:48:33 UTC (rev 559)
+++ JSFloorPlan/trunk/jsfloorplan.js 2011-12-09 17:28:37 UTC (rev 560)
@@ -25,8 +25,6 @@
// setup script here:
// don't change anything below:
-var SVG_NS ="http://www.w3.org/2000/svg";
-var XLINK_NS ="http://www.w3.org/1999/xlink";
var ELEMENT_NODE = 1;
// calculate the distance between two cartesian 2D points
@@ -74,32 +72,6 @@
return pseudoangle_a - pseudoangle_b;
}
-/*******************************************************************/
-/* IE compatability stuff starts here */
-/*******************************************************************/
-/*
-// Fix problems of IE that it doesn't support the
-// createElementNS method
-function createSVGElement( element )
-{
- if( typeof document.createElementNS != 'undefined' )
- return document.createElementNS( SVG_NS, element );
-
- if( typeof document.createElement != 'undefined' )
- return document.createElement (element );
-
- return false;
-}
-function setXlinkAttribute( element, attribute, value )
-{
- return element.setAttributeNS( XLINK_NS, attribute, value );
-}
-*/
-
-/*******************************************************************/
-/* IE compatability stuff ends here */
-/*******************************************************************/
-
function loadFloorplan()
{
$.get('floorplan01.xml', parseXMLFloorPlan, 'xml');
@@ -120,9 +92,6 @@
function parseXMLFloorPlan( xmlDoc )
{
noFloorplan = false;
- // create the SVG node where all elements are collected in
- //var plan = document.createElementNS( SVG_NS, "g" );
- //var plan = createSVGElement( "g" );
// basic check if the document seems right
// this could be avoided if the XML file would be validated
@@ -313,7 +282,6 @@
imageCenter.z = buildingProperties.z_max / 2;
show3D( 35*Math.PI/180, 30*Math.PI/180 );
- //document.getElementById( "top_level" ).appendChild( plan );
}
var floorNodes = new Object();
@@ -429,327 +397,13 @@
function parseTextures( nodes )
{
return;
- var defs = createSVGElement( 'defs' );
for( var i=0; i < nodes.childNodes.length; i++ )
{
node = nodes.childNodes[i];
if (node.nodeType != ELEMENT_NODE) continue;
-
- var pattern = createSVGElement( 'pattern' );
- pattern.setAttribute( 'id', node.getAttribute('id') );
- pattern.setAttribute( 'x', 0 );
- pattern.setAttribute( 'y', 0 );
- pattern.setAttribute( 'width', Number( node.getAttribute('width' ) )*200 );
- pattern.setAttribute( 'height', Number( node.getAttribute('height') )*200 );
- /*
- textures[id] = new Object();
- textures[id].width = Number( node.getAttribute('width' ) );
- textures[id].height = Number( node.getAttribute('height') );
- textures[id].src = node.getAttribute('src' );
- textures[id].svg = createSVGElement( "image" );
- */
- var texture = createSVGElement( "image" );
- texture.setAttribute( "width", Number( node.getAttribute('width' ) )*200 );
- texture.setAttribute( "height", Number( node.getAttribute('height') )*200 );
- setXlinkAttribute( texture, "href", node.getAttribute('src') );
- //textures[id].setAttribute( "href", node.getAttribute('src') );
-
- pattern.appendChild( texture );
- defs.appendChild( pattern );
}
- document.getElementById( "top_level" ).appendChild( defs );
}
-/*
-//var wrapper = document.createElementNS( SVG_NS, "g" );
-var wrapper = createSVGElement( "g" );
-wrapper.setAttribute( "fill", fillColor );
-wrapper.setAttribute( "fill-opacity", fillOpacity );
-wrapper.setAttribute( "fill", "grey" );
-////wrapper.setAttribute( "stroke", "black" );
-////wrapper.setAttribute( "stroke-width", "1" );
-wrapper.setAttribute( "onmouseover", 'set_color(this);' );
-wrapper.setAttribute( "onmouseout", 'unset_color(this,"grey");' );
-wrapper.setAttribute( "transform", 'translate(400,200)' );
-
-var poly_stroke = createSVGElement( "path" );
-poly_stroke.setAttribute( "style", "stroke:black;stroke-width:1;" );
-var poly_only = createSVGElement( "path" );
-var poly_clear = createSVGElement( "path" );
-poly_clear.setAttribute( "style", "stroke:none;fill:none;" );
-*/
-
-run_count = 5;
-// show the diagram in a 2.5D perspective, i.e. isometric
-function show25D( rotation, tilt, plan )
-{
- ////t_25d_start = new Date;
- //console.log( rotation, tilt, plan );
- return;
-
- var h_short = Math.cos( tilt ); // horizontal shortening factor
- var v_short = Math.sin( tilt ); // vertical shortening factor
- var x_offset = -imageCenter.x * sc;
- var y_offset = (imageCenter.z *v_short- imageCenter.y* h_short) * sc; // correct tilt
-
- // to reduce the amount of trigonometric calls: pre calculate them
- var rot_s = Math.sin( rotation );
- var rot_c = Math.cos( rotation );
-
- // depth sorting of the elements
- var order = new Array;
- for( var i=1; i<lines[showFloor].length; i+=3 )
- {
- order.push( Array( i,
- rot_s * floorNodes[ lines[showFloor][i][0] ].x + rot_c * floorNodes[ lines[showFloor][i][0] ].y +
- rot_s * floorNodes[ lines[showFloor][i][1] ].x + rot_c * floorNodes[ lines[showFloor][i][1] ].y
- ));
- }
- order.sort( function(a,b){ return a[1]-b[1]; } );
- ////t_25d_after_sort = new Date;
-
- for( var o=0; o<order.length; o++ )
- {
- var i = order[o][0]-1;
-
- var s1 = rotate2D( rot_s, rot_c, vertices [ lines[showFloor][ i][0] ], imageCenter );
- var e1 = rotate2D( rot_s, rot_c, vertices [ lines[showFloor][ i][1] ], imageCenter );
- var sm = rotate2D( rot_s, rot_c, floorNodes[ lines[showFloor][++i][1] ], imageCenter );
- var em = rotate2D( rot_s, rot_c, floorNodes[ lines[showFloor][ i][0] ], imageCenter );
- var sh = v_short * floorNodes[ lines[showFloor][i][1] ].z;
- var eh = v_short * floorNodes[ lines[showFloor][i][0] ].z;
- var thickness = lines[showFloor][ i][2];
- var texture = lines[showFloor][ i][3];
- var holes = lines[showFloor][ i][4];
- var s2 = rotate2D( rot_s, rot_c, vertices [ lines[showFloor][++i][0] ], imageCenter );
- var e2 = rotate2D( rot_s, rot_c, vertices [ lines[showFloor][ i][1] ], imageCenter );
-
- var wallSideOrder = (s1.y*e1.x-s1.x*e1.y)*(e2.x-s2.x) - (s2.y*e2.x-s2.x*e2.y)*(e1.x-s1.x);
-
- var w = wrapper.cloneNode( true );
-
- // disable the textures as they are causing big troubles (at least
- // with FF3.0) in this implementation
- if( false && texture != 0 ) // showTextures
- {
- var img = poly_only.cloneNode( true );
- img.setAttribute( 'fill', 'url(#' + texture + ')' );
- img.setAttribute( "points",
- e1.x*sc + ',' + (e1.y*h_short+eh)*sc + ' ' +
- s1.x*sc + ',' + (s1.y*h_short+sh)*sc + ' ' +
- s1.x*sc + ',' + s1.y*h_short*sc + ' ' +
- e1.x*sc + ',' + e1.y*h_short*sc );
- var wi = 200; //textures[texture].width;
- var he = 200; //textures[texture].height;
- var ma = ((s1.x)-(s1.x))*sc/he;
- var mb = ((s1.y*h_short+sh)-(s1.y*h_short))*sc/he;
- var mc = ((e1.x)-(s1.x))*sc/wi;
- var md = ((e1.y)-(s1.y))*h_short*sc/wi;
- var me = s1.x*sc;
- var mf = s1.y*h_short*sc;
- img.setAttribute( "transformX", "matrix(" +
- ma.toFixed(3) + ' ' + mb.toFixed(3) + ' ' +
- mc.toFixed(3) + ' ' + md.toFixed(3) + ' ' +
- me.toFixed(3) + ' ' + mf.toFixed(3) + ')');
- w.appendChild( img );
- }
-
- var h = new Array;
- for( var j=0; j < holes.length; j++ )
- {
- h[j] = new Object;
- var wallLength = calcLength2D( sm, em );
- var fLeft = holes[j].distance / wallLength;
- var fRight = (holes[j].distance + holes[j].width) / wallLength;
- var normal_x = +(sm.y - em.y) / wallLength * thickness / 2;
- var normal_y = -(sm.x - em.x) / wallLength * thickness / 2;
- var xLeft = sm.x * fLeft + em.x * (1 - fLeft );
- var xRight = sm.x * fRight + em.x * (1 - fRight);
- var yLeft = sm.y * fLeft + em.y * (1 - fLeft );
- var yRight = sm.y * fRight + em.y * (1 - fRight);
- var lintel = sh - holes[j].lintel * v_short;
- var paparet = holes[j].paparet * v_short;
-
- h[j].tl1_x = ( ( xLeft - normal_x )*sc+x_offset).toFixed(1);
- h[j].tr1_x = ( ( xRight - normal_x )*sc+x_offset).toFixed(1);
- h[j].tl1_y = ( ((yLeft - normal_y)*h_short-lintel )*sc+y_offset).toFixed(1);
- h[j].tr1_y = ( ((yRight - normal_y)*h_short-lintel )*sc+y_offset).toFixed(1);
- h[j].bl1_y = ( ((yLeft - normal_y)*h_short-paparet)*sc+y_offset).toFixed(1);
- h[j].br1_y = ( ((yRight - normal_y)*h_short-paparet)*sc+y_offset).toFixed(1);
- h[j].tl2_x = ( ( xLeft + normal_x )*sc+x_offset).toFixed(1);
- h[j].tr2_x = ( ( xRight + normal_x )*sc+x_offset).toFixed(1);
- h[j].tl2_y = ( ((yLeft + normal_y)*h_short-lintel )*sc+y_offset).toFixed(1);
- h[j].tr2_y = ( ((yRight + normal_y)*h_short-lintel )*sc+y_offset).toFixed(1);
- h[j].bl2_y = ( ((yLeft + normal_y)*h_short-paparet)*sc+y_offset).toFixed(1);
- h[j].br2_y = ( ((yRight + normal_y)*h_short-paparet)*sc+y_offset).toFixed(1);
- }
-
- // note: don't pass the full float precision to the SVG as the
- // conversion time float -> text -> float can take a significant time...
- var e1_y_fh = ((e1.y * h_short - eh) * sc +y_offset).toFixed(1);
- var s1_y_fh = ((s1.y * h_short - sh) * sc +y_offset).toFixed(1);
- var em_y_fh = ((em.y * h_short - eh) * sc +y_offset).toFixed(1);
- var sm_y_fh = ((sm.y * h_short - sh) * sc +y_offset).toFixed(1);
- var e2_y_fh = ((e2.y * h_short - eh) * sc +y_offset).toFixed(1);
- var s2_y_fh = ((s2.y * h_short - sh) * sc +y_offset).toFixed(1);
- s1.y = (s1.y * h_short * sc+y_offset).toFixed(2); s1.x = (s1.x * sc+x_offset).toFixed(2);
- e1.y = (e1.y * h_short * sc+y_offset).toFixed(2); e1.x = (e1.x * sc+x_offset).toFixed(2);
- sm.y = (sm.y * h_short * sc+y_offset).toFixed(2); sm.x = (sm.x * sc+x_offset).toFixed(2);
- em.y = (em.y * h_short * sc+y_offset).toFixed(2); em.x = (em.x * sc+x_offset).toFixed(2);
- s2.y = (s2.y * h_short * sc+y_offset).toFixed(2); s2.x = (s2.x * sc+x_offset).toFixed(2);
- e2.y = (e2.y * h_short * sc+y_offset).toFixed(2); e2.x = (e2.x * sc+x_offset).toFixed(2);
- if( showWallSides ) // the sides of the walls
- {
- var path1 =
- 'M' + e1.x + ',' + (e1_y_fh) +
- 'L' + s1.x + ',' + (s1_y_fh) +
- 'L' + s1.x + ',' + s1.y +
- 'L' + e1.x + ',' + e1.y + 'z';
- for( var j=0; showHoles && j < h.length; j++ )
- {
- path1 +=
- 'M' + h[j].tl1_x + ',' + h[j].tl1_y +
- 'L' + h[j].tl1_x + ',' + h[j].bl1_y +
- 'L' + h[j].tr1_x + ',' + h[j].br1_y +
- 'L' + h[j].tr1_x + ',' + h[j].tr1_y + 'z';
- }
- var path2 =
- 'M' + e2.x + ',' + (e2_y_fh) +
- 'L' + s2.x + ',' + (s2_y_fh) +
- 'L' + s2.x + ',' + s2.y +
- 'L' + e2.x + ',' + e2.y + 'z';
- for( var j=0; showHoles && j < h.length; j++ )
- {
- path2 +=
- 'M' + h[j].tl2_x + ',' + h[j].tl2_y +
- 'L' + h[j].tl2_x + ',' + h[j].bl2_y +
- 'L' + h[j].tr2_x + ',' + h[j].br2_y +
- 'L' + h[j].tr2_x + ',' + h[j].tr2_y + 'z';
- }
- var path3 = '';
- for( var j=0; showHoles && j < h.length; j++ )
- {
- if( wallSideOrder > 0 )
- {
- path3 +=
- 'M' + h[j].tr1_x + ',' + h[j].tr1_y + 'L' + h[j].tr2_x + ',' + h[j].tr2_y +
- 'L' + h[j].tl2_x + ',' + h[j].tl2_y + 'L' + h[j].tl1_x + ',' + h[j].tl1_y +'z'+
- 'M' + h[j].tr1_x + ',' + h[j].br1_y + 'L' + h[j].tr2_x + ',' + h[j].br2_y +
- 'L' + h[j].tr2_x + ',' + h[j].tr2_y + 'L' + h[j].tr1_x + ',' + h[j].tr1_y +'z'+
- 'M' + h[j].tl1_x + ',' + h[j].bl1_y + 'L' + h[j].tl2_x + ',' + h[j].bl2_y +
- 'L' + h[j].tr2_x + ',' + h[j].br2_y + 'L' + h[j].tr1_x + ',' + h[j].br1_y +'z'+
- 'M' + h[j].tl1_x + ',' + h[j].tl1_y + 'L' + h[j].tl2_x + ',' + h[j].tl2_y +
- 'L' + h[j].tl2_x + ',' + h[j].bl2_y + 'L' + h[j].tl1_x + ',' + h[j].bl1_y +'z';
- } else {
- path3 +=
- 'M' + h[j].tl1_x + ',' + h[j].tl1_y + 'L' + h[j].tl2_x + ',' + h[j].tl2_y +
- 'L' + h[j].tr2_x + ',' + h[j].tr2_y + 'L' + h[j].tr1_x + ',' + h[j].tr1_y +'z'+
- 'M' + h[j].tr1_x + ',' + h[j].tr1_y + 'L' + h[j].tr2_x + ',' + h[j].tr2_y +
- 'L' + h[j].tr2_x + ',' + h[j].br2_y + 'L' + h[j].tr1_x + ',' + h[j].br1_y +'z'+
- 'M' + h[j].tr1_x + ',' + h[j].br1_y + 'L' + h[j].tr2_x + ',' + h[j].br2_y +
- 'L' + h[j].tl2_x + ',' + h[j].bl2_y + 'L' + h[j].tl1_x + ',' + h[j].bl1_y +'z'+
- 'M' + h[j].tl1_x + ',' + h[j].bl1_y + 'L' + h[j].tl2_x + ',' + h[j].bl2_y +
- 'L' + h[j].tl2_x + ',' + h[j].tl2_y + 'L' + h[j].tl1_x + ',' + h[j].tl1_y +'z';
- }
- }
-
- var frontPath;
- var backPath;
- // backside culling:
- if( wallSideOrder < 0 )
- {
- frontPath = path2;
- backPath = path1;
- /*if( showBackside )
- path = path1;
- path += path2;*/
- } else {
- frontPath = path1;
- backPath = path2;
- /*if( showBackside )
- path = path2;
- path += path1;*/
- }
- if( !showBackside )
- {
- backPath = '';
- }
- backPath += path3;
- var wall = showSideLines ? poly_stroke.cloneNode( true )
- : poly_only.cloneNode( true ) ;
- wall.setAttribute( 'd', backPath );
- w.appendChild( wall );
- var wall = showSideLines ? poly_stroke.cloneNode( true )
- : poly_only.cloneNode( true ) ;
- wall.setAttribute( 'd', frontPath );
- w.appendChild( wall );
- }
- if( showWallTop ) // the top of the walls
- {
- var rect3 = showTopLines ? poly_stroke.cloneNode( true ) : poly_only.cloneNode( true ) ;
- rect3.setAttribute( 'd',
- 'M' + sm.x + ',' + sm_y_fh +
- 'L' + s1.x + ',' + s1_y_fh +
- 'L' + e1.x + ',' + e1_y_fh +
- 'L' + em.x + ',' + em_y_fh +
- 'L' + e2.x + ',' + e2_y_fh +
- 'L' + s2.x + ',' + s2_y_fh + 'z' );
- w.appendChild( rect3 );
- }
- plan.appendChild( w );
-
- // clean up, so that the garbage collector doesn't bite us
- delete s1;
- delete e1;
- delete sm;
- delete em;
- delete s2;
- delete e2;
- delete h;
- } // end for( o=0; o<order.length; o++ )
-
- // show zones
- if( showZones )
- {
- var w = wrapper.cloneNode( true );
- for( j=0; j<rooms[showFloor].length; j++ )
- {
- for( var k=0; k<rooms[showFloor][j].zones.length; k++ )
- {
- var area = showVisibleZones ? poly_stroke.cloneNode( true )
- : poly_clear.cloneNode( true ) ;
- var points = '';
- for( var l=0; l<rooms[showFloor][j].zones[k].corners.length; l++ )
- {
- n = rooms[showFloor][j].zones[k].corners[l];
- var p = rotate2D( rot_s, rot_c, floorNodes[n], imageCenter );
- var h = v_short * floorNodes[n].z;
- p.y = ((p.y * h_short - h) * sc +y_offset).toFixed(2);
- p.x = (p.x * sc+x_offset).toFixed(2);
- points += (( 0 == l ) ? 'M' : 'L') + p.x + ',' + p.y;
- }
- area.setAttribute( 'd', points+'z' );
- if( rooms[showFloor][j].zones[k].onclick )
- area.setAttribute( 'onclick', rooms[showFloor][j].zones[k].onclick );
- w.appendChild( area );
- }
- }
- plan.appendChild( w );
- } //if( showZones )
-
- ////t_25d_end = new Date;
-}
-
-/*
-plan = createSVGElement( "g" );
-function replaceSVG( SVGelement )
-{
- SVGelement.replaceChild( plan, SVGelement.lastChild );
- delete plan;
- plan = createSVGElement( "g" );
-}
-*/
-
var noSetup = true;
function setup3D()
{
@@ -760,7 +414,6 @@
for( var i=0; i<lines[showFloor].length; )
{
- //console.log(i);
/*
var s1 = rotate2D( rot_s, rot_c, vertices [ lines[showFloor][ i][0] ], imageCenter );
var e1 = rotate2D( rot_s, rot_c, vertices [ lines[showFloor][ i][1] ], imageCenter );
@@ -808,25 +461,9 @@
*/
var geometry = new THREE.Geometry();
-//var vertices = [];
-//vertices.push(new THREE.Vector3(0, 0, 0));
-//vertices.push(new THREE.Vector3(1, 0, 0));
-//vertices.push(new THREE.Vector3(0, 1, 0));
- /*
- for ( j = 0; j < vertices.length; j = j + 4) {
- geometry.vertices.push(new THREE.Vertex(Tvertices[j]));
- geometry.vertices.push(new THREE.Vertex(Tvertices[j+1]));
- geometry.vertices.push(new THREE.Vertex(Tvertices[j+2]));
- geometry.vertices.push(new THREE.Vertex(Tvertices[j+3]));
-
- geometry.faces.push(new THREE.Face3( j, j+1, j+2 ));
- geometry.faces.push(new THREE.Face3( j+2, j+1, j+3 ));
-
- //geometry.faceVertexUvs[0].push([
- // new THREE.UV(u_value, v_value)), new THREE.UV(u_value, v_value)), new THREE.UV(u_value, v_value))
- //]);
- }
- */
+ //geometry.faceVertexUvs[0].push([
+ // new THREE.UV(u_value, v_value)), new THREE.UV(u_value, v_value)), new THREE.UV(u_value, v_value))
+ //]);
geometry.vertices.push(new THREE.Vertex(new THREE.Vector3(e1.x,e1.y,0)));
geometry.vertices.push(new THREE.Vertex(new THREE.Vector3(e1.x,e1.y,sh)));
geometry.vertices.push(new THREE.Vertex(new THREE.Vector3(s1.x,s1.y,0)));
@@ -878,12 +515,6 @@
var $container = $('#top_level');
// attach the render-supplied DOM element
$container.append(renderer.domElement);
- // draw!
- //scene.add( camera );
- //renderer.render(scene, camera);
- //render();
-// animate();
-
}
function show3D( rotation, tilt )
@@ -925,6 +556,5 @@
break;
};
-
render();
}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2011-12-09 16:48:39
|
Revision: 559
http://openautomation.svn.sourceforge.net/openautomation/?rev=559&view=rev
Author: mayerch
Date: 2011-12-09 16:48:33 +0000 (Fri, 09 Dec 2011)
Log Message:
-----------
Make opacity and color selector work (again)
Modified Paths:
--------------
JSFloorPlan/trunk/index.html
JSFloorPlan/trunk/jsfloorplan.js
Modified: JSFloorPlan/trunk/index.html
===================================================================
--- JSFloorPlan/trunk/index.html 2011-12-09 15:37:02 UTC (rev 558)
+++ JSFloorPlan/trunk/index.html 2011-12-09 16:48:33 UTC (rev 559)
@@ -88,17 +88,17 @@
<option value="0.2">0.2</option>
<option value="0.3">0.3</option>
<option value="0.4">0.4</option>
-<option value="0.5" selected="selected">0.5 - halb transparent</option>
+<option value="0.5">0.5 - halb transparent</option>
<option value="0.6">0.6</option>
<option value="0.7">0.7</option>
<option value="0.8">0.8</option>
<option value="0.9">0.9</option>
-<option value="1.0">1.0 - undurchsichtig</option>
+<option value="1.0" selected="selected">1.0 - undurchsichtig</option>
</select>
</td><td>
Farbe: <select size="1" name="fillColor">
-<option value="black" selected="selected">Schwarz</option>
-<option value="grey">Grau</option>
+<option value="black">Schwarz</option>
+<option value="grey" selected="selected">Grau</option>
<option value="white">Weiß</option>
<option value="blue">Blau</option>
<option value="red">Rot</option>
Modified: JSFloorPlan/trunk/jsfloorplan.js
===================================================================
--- JSFloorPlan/trunk/jsfloorplan.js 2011-12-09 15:37:02 UTC (rev 558)
+++ JSFloorPlan/trunk/jsfloorplan.js 2011-12-09 16:48:33 UTC (rev 559)
@@ -890,6 +890,7 @@
{
if( noSetup ) setup3D();
+ // set up camera
var cx = -Math.cos(rotation) * Math.cos(tilt);
var cy = Math.sin(rotation) * Math.cos(tilt);
var cz = Math.sin(tilt);
@@ -897,5 +898,33 @@
camera.position = new THREE.Vector3( cx*dist + buildingProperties.x_center, cy*dist + buildingProperties.y_center, dist * cz );
camera.lookAt( new THREE.Vector3( buildingProperties.x_center, buildingProperties.y_center, 0) );
pointLight.position = camera.position;
+
+ // update opacity
+ cubeMaterial.opacity = showStates.fillOpacity;
+
+ // update color
+ switch( showStates.fillColor )
+ {
+ case 'black':
+ cubeMaterial.color.setRGB( 0.1, 0.1, 0.1 );
+ break;
+ case 'grey':
+ cubeMaterial.color.setRGB( 0.5, 0.5, 0.5 );
+ break;
+ case 'white':
+ cubeMaterial.color.setRGB( 1.0, 1.0, 1.0 );
+ break;
+ case 'blue':
+ cubeMaterial.color.setRGB( 0.0, 0.0, 0.8 );
+ break;
+ case 'red':
+ cubeMaterial.color.setRGB( 0.8, 0.0, 0.0 );
+ break;
+ case 'green':
+ cubeMaterial.color.setRGB( 0.0, 0.8, 0.0 );
+ break;
+ };
+
+
render();
}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2011-12-09 15:37:13
|
Revision: 558
http://openautomation.svn.sourceforge.net/openautomation/?rev=558&view=rev
Author: mayerch
Date: 2011-12-09 15:37:02 +0000 (Fri, 09 Dec 2011)
Log Message:
-----------
Corrected up vector calculation for the camera setup so that it's not jumping anymore at the extreme case
Modified Paths:
--------------
JSFloorPlan/trunk/jsfloorplan.js
Modified: JSFloorPlan/trunk/jsfloorplan.js
===================================================================
--- JSFloorPlan/trunk/jsfloorplan.js 2011-12-09 12:49:24 UTC (rev 557)
+++ JSFloorPlan/trunk/jsfloorplan.js 2011-12-09 15:37:02 UTC (rev 558)
@@ -893,7 +893,7 @@
var cx = -Math.cos(rotation) * Math.cos(tilt);
var cy = Math.sin(rotation) * Math.cos(tilt);
var cz = Math.sin(tilt);
- camera.up = new THREE.Vector3( -cx, -cy, 1 );
+ camera.up = new THREE.Vector3( Math.cos(rotation) * Math.sin(tilt), -Math.sin(rotation) * Math.sin(tilt), Math.cos(tilt) );
camera.position = new THREE.Vector3( cx*dist + buildingProperties.x_center, cy*dist + buildingProperties.y_center, dist * cz );
camera.lookAt( new THREE.Vector3( buildingProperties.x_center, buildingProperties.y_center, 0) );
pointLight.position = camera.position;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2011-12-09 12:49:30
|
Revision: 557
http://openautomation.svn.sourceforge.net/openautomation/?rev=557&view=rev
Author: mayerch
Date: 2011-12-09 12:49:24 +0000 (Fri, 09 Dec 2011)
Log Message:
-----------
Fix UI (but it's not linked to the display yet...)
Modified Paths:
--------------
JSFloorPlan/trunk/index.html
JSFloorPlan/trunk/jsfloorplan.js
JSFloorPlan/trunk/jsfloorplan_example_helper.js
Modified: JSFloorPlan/trunk/index.html
===================================================================
--- JSFloorPlan/trunk/index.html 2011-12-09 10:36:54 UTC (rev 556)
+++ JSFloorPlan/trunk/index.html 2011-12-09 12:49:24 UTC (rev 557)
@@ -49,7 +49,7 @@
</pre>
<hr />
<h2>Einstellungen:</h2>
-<form name="settings" method="get">
+<form>
<table>
<tr>
<td>
@@ -59,31 +59,31 @@
</tr>
<tr>
<td>
- Zeige Wände: <input type="checkbox" name="showWallSides" onclick="check('showWallSides',true)" checked="checked" />
+ Zeige Wände: <input type="checkbox" name="showWallSides" checked="checked" />
</td><td>
- Zeige Deckel: <input type="checkbox" name="showWallTop" onclick="check('showWallTop',true)" checked="checked" />
+ Zeige Deckel: <input type="checkbox" name="showWallTop" checked="checked" />
</td><td>
- Zeige Rückseite: <input type="checkbox" name="showBackside" onclick="check('showBackside',true)" checked="checked" />
+ Zeige Rückseite: <input type="checkbox" name="showBackside" checked="checked" />
</td><td>
- Zeige MouseOver: <input type="checkbox" name="wallMouseOver" onclick="check('wallMouseOver',true)" />
+ Zeige MouseOver: <input type="checkbox" name="wallMouseOver" />
</td>
</tr>
<tr>
<td>
- Wand-Umrandung: <input type="checkbox" name="showSideLines" onclick="check('showSideLines',true)" checked="checked" />
+ Wand-Umrandung: <input type="checkbox" name="showSideLines" checked="checked" />
</td><td>
- Deckel-Umrandung: <input type="checkbox" name="showTopLines" onclick="check('showTopLines',true)" checked="checked" />
+ Deckel-Umrandung: <input type="checkbox" name="showTopLines" checked="checked" />
</td><td>
- Zeige "Löcher": <input type="checkbox" name="showHoles" onclick="check('showHoles',true)" checked="checked" />
+ Zeige "Löcher": <input type="checkbox" name="showHoles" checked="checked" />
</td><td>
- Erzeuge Zonen: <input type="checkbox" name="showZones" onclick="check('showZones',true)" checked="checked" />
+ Erzeuge Zonen: <input type="checkbox" name="showZones" checked="checked" />
</td><td>
- Zeige Zonen: <input type="checkbox" name="showVisibleZones" onclick="check('showVisibleZones',true)" checked="checked" />
+ Zeige Zonen: <input type="checkbox" name="showVisibleZones" checked="checked" />
</td>
</tr>
<tr>
<td>
- Transparenz: <select size="1" name="fillOpacity" onchange="selectValue('fillOpacity',true)">
+ Transparenz: <select size="1" name="fillOpacity">
<option value="0.1">0.1 - sehr transparent</option>
<option value="0.2">0.2</option>
<option value="0.3">0.3</option>
@@ -96,7 +96,7 @@
<option value="1.0">1.0 - undurchsichtig</option>
</select>
</td><td>
- Farbe: <select size="1" name="fillColor" onchange="selectValue('fillColor',true)">
+ Farbe: <select size="1" name="fillColor">
<option value="black" selected="selected">Schwarz</option>
<option value="grey">Grau</option>
<option value="white">Weiß</option>
@@ -105,7 +105,7 @@
<option value="green">Grün</option>
</select>
</td><td>
- Stockwerk: <select size="1" name="showFloor" onchange="selectValue('showFloor',true)">
+ Stockwerk: <select size="1" name="showFloor">
<option value="0" selected="selected">0</option>
<option value="1">1</option>
</select>
Modified: JSFloorPlan/trunk/jsfloorplan.js
===================================================================
--- JSFloorPlan/trunk/jsfloorplan.js 2011-12-09 10:36:54 UTC (rev 556)
+++ JSFloorPlan/trunk/jsfloorplan.js 2011-12-09 12:49:24 UTC (rev 557)
@@ -77,6 +77,7 @@
/*******************************************************************/
/* IE compatability stuff starts here */
/*******************************************************************/
+/*
// Fix problems of IE that it doesn't support the
// createElementNS method
function createSVGElement( element )
@@ -93,6 +94,7 @@
{
return element.setAttributeNS( XLINK_NS, attribute, value );
}
+*/
/*******************************************************************/
/* IE compatability stuff ends here */
@@ -120,7 +122,7 @@
noFloorplan = false;
// create the SVG node where all elements are collected in
//var plan = document.createElementNS( SVG_NS, "g" );
- var plan = createSVGElement( "g" );
+ //var plan = createSVGElement( "g" );
// basic check if the document seems right
// this could be avoided if the XML file would be validated
@@ -310,7 +312,7 @@
imageCenter.y = buildingProperties.y_center;
imageCenter.z = buildingProperties.z_max / 2;
- show3D( 35*Math.PI/180, 30*Math.PI/180, plan );
+ show3D( 35*Math.PI/180, 30*Math.PI/180 );
//document.getElementById( "top_level" ).appendChild( plan );
}
@@ -458,6 +460,7 @@
document.getElementById( "top_level" ).appendChild( defs );
}
+/*
//var wrapper = document.createElementNS( SVG_NS, "g" );
var wrapper = createSVGElement( "g" );
wrapper.setAttribute( "fill", fillColor );
@@ -474,6 +477,7 @@
var poly_only = createSVGElement( "path" );
var poly_clear = createSVGElement( "path" );
poly_clear.setAttribute( "style", "stroke:none;fill:none;" );
+*/
run_count = 5;
// show the diagram in a 2.5D perspective, i.e. isometric
@@ -736,6 +740,7 @@
////t_25d_end = new Date;
}
+/*
plan = createSVGElement( "g" );
function replaceSVG( SVGelement )
{
@@ -743,6 +748,7 @@
delete plan;
plan = createSVGElement( "g" );
}
+*/
var noSetup = true;
function setup3D()
@@ -750,6 +756,8 @@
if( noFloorplan ) return;
noSetup = false;
+ var showFloor = showStates.showFloor;
+
for( var i=0; i<lines[showFloor].length; )
{
//console.log(i);
@@ -878,7 +886,7 @@
}
-function show3D( rotation, tilt, plan )
+function show3D( rotation, tilt )
{
if( noSetup ) setup3D();
Modified: JSFloorPlan/trunk/jsfloorplan_example_helper.js
===================================================================
--- JSFloorPlan/trunk/jsfloorplan_example_helper.js 2011-12-09 10:36:54 UTC (rev 556)
+++ JSFloorPlan/trunk/jsfloorplan_example_helper.js 2011-12-09 12:49:24 UTC (rev 557)
@@ -57,6 +57,7 @@
ASPECT,
NEAR,
FAR );
+/*
var controls = new THREE.TrackballControls( camera );
//controls.rotateSpeed = 1.0;
//controls.zoomSpeed = 1.2;
@@ -69,7 +70,7 @@
controls.dynamicDampingFactor = 0.3;
controls.keys = [ 65, 83, 68 ];
-
+*/
var scene = new THREE.Scene();
// the camera starts at 0,0,0 so pull it back
@@ -145,7 +146,7 @@
function animate() {
requestAnimationFrame( animate );
//render();
- show3D();
+ show3D( roll, tilt );
//stats.update();
}
@@ -163,6 +164,8 @@
/////////////////////////////////////////////////////////////////////////////
// setup script here:
var sc = 40; // overall scaling
+var showStates = {};
+/*
var showWallSides = true;
var showWallTop = true;
var showSideLines = true;
@@ -175,6 +178,7 @@
var wallMouseOver = true;
var fillOpacity = 0.5;
var fillColor = 'black';
+*/
var redrawInterval = 50; // in milliseconds; = 20 fps
var roll = 35*Math.PI/180;
@@ -194,21 +198,20 @@
function init()
{
- check( 'showWallSides' , false );
- check( 'showWallTop' , false );
- check( 'showSideLines' , false );
- check( 'showTopLines' , false );
- check( 'showBackside' , false );
- check( 'showHoles' , false );
- check( 'showZones' , false );
- check( 'showVisibleZones' , false );
- check( 'wallMouseOver' , false );
- selectValue( 'fillOpacity', false );
- selectValue( 'fillColor' , false );
- selectValue( 'showFloor' , false );
-
+ $('input').change(function(e){
+ showStates[ e.target.name ] = e.target.checked;
+ show3D( roll, tilt );
+ }).each(function(){
+ showStates[ this.name ] = this.checked; // init
+ });
+ $('select').change(function(e){
+ showStates[ e.target.name ] = e.target.value;
+ show3D( roll, tilt );
+ }).each(function(){
+ showStates[ this.name ] = this.value; // init
+ });
+
loadFloorplan();
-
createSlider();
}
@@ -224,6 +227,7 @@
animation = setInterval(move, redrawInterval);
toggle = true;
}
+ return true;
}
function move()
@@ -239,7 +243,7 @@
if( tilt < 0 )
tilt_dir = 1;
- show3D( roll, tilt, plan );
+ show3D( roll, tilt );
//////
var middle = new Date();
@@ -285,6 +289,7 @@
document.getElementById('status').firstChild.data = text;
}
+/*
function set_color( event )
{
if( 'blue' != fillColor )
@@ -297,7 +302,8 @@
{
event.setAttribute( 'fill', fillColor );
}
-
+*/
+/*
function check( what, redraw )
{
eval( what +' = document.forms[0].elements[what].checked' );
@@ -321,7 +327,9 @@
show3D( roll, tilt, plan );
}
}
+*/
+/*
function selectValue( what, redraw )
{
var val = document.forms[0].elements[what].options[ document.forms[0].elements[what].selectedIndex ].value;
@@ -343,6 +351,7 @@
show3D( roll, tilt, plan );
}
}
+*/
// Create the little graphics for the roll and the tilt angle
// as well as the buttons to manipulate them
@@ -350,7 +359,7 @@
{
$( "#rollSlider" ).slider({ min: 0, max: 360, change: rollChange, slide: rollChange});
$( "#tiltSlider" ).slider({ min: 0, max: 90, change: tiltChange, slide: tiltChange});
- $( "#distSlider" ).slider({ min: 5, max: 30, change: distChange, slide: distChange});
+ $( "#distSlider" ).slider({ min: 5, max: 30, change: distChange, slide: distChange});
updateSlider();
}
@@ -368,21 +377,21 @@
function rollChange( event, ui )
{
- if( globalInUpdateSlider ) return;
+ if( globalInUpdateSlider ) return true;
roll = ui.value * Math.PI / 180;
- show3D( roll, tilt, plan );
+ show3D( roll, tilt );
}
function tiltChange( event, ui )
{
- if( globalInUpdateSlider ) return;
+ if( globalInUpdateSlider ) return true;
tilt = ui.value * Math.PI / 180;
- show3D( roll, tilt, plan );
+ show3D( roll, tilt );
}
function distChange( event, ui )
{
- if( globalInUpdateSlider ) return;
+ if( globalInUpdateSlider ) return true;
dist = ui.value;
- show3D( roll, tilt, plan );
+ show3D( roll, tilt );
}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2011-12-09 10:37:05
|
Revision: 556
http://openautomation.svn.sourceforge.net/openautomation/?rev=556&view=rev
Author: mayerch
Date: 2011-12-09 10:36:54 +0000 (Fri, 09 Dec 2011)
Log Message:
-----------
Cleanup totally unnecessary stuff
Modified Paths:
--------------
JSFloorPlan/trunk/jsfloorplan.js
Modified: JSFloorPlan/trunk/jsfloorplan.js
===================================================================
--- JSFloorPlan/trunk/jsfloorplan.js 2011-12-09 10:31:43 UTC (rev 555)
+++ JSFloorPlan/trunk/jsfloorplan.js 2011-12-09 10:36:54 UTC (rev 556)
@@ -94,102 +94,13 @@
return element.setAttributeNS( XLINK_NS, attribute, value );
}
-/*
-function newXMLHttpRequest()
-{
- try { return new XMLHttpRequest() } catch(e){}
- try { return new ActiveXObject("MSXML3.XMLHTTP") } catch(e){}
- try { return new ActiveXObject("MSXML2.XMLHTTP.3.0") } catch(e){}
- try { return new ActiveXObject("Msxml2.XMLHTTP") } catch(e){}
- try { return new ActiveXObject("Microsoft.XMLHTTP") } catch(e){}
- return null;
-}
-
-if (typeof(XMLHttpRequest) == 'undefined')
-{
- function XMLHttpRequest()
- {
- try { return new ActiveXObject("MSXML3.XMLHTTP") } catch(e){}
- try { return new ActiveXObject("MSXML2.XMLHTTP.3.0") } catch(e){}
- try { return new ActiveXObject("Msxml2.XMLHTTP") } catch(e){}
- try { return new ActiveXObject("Microsoft.XMLHTTP") } catch(e){}
- return null;
- };
-}
-*/
-
/*******************************************************************/
/* IE compatability stuff ends here */
/*******************************************************************/
-var xmlDoc;
function loadFloorplan()
{
- /*
- var httpRequest = new newXMLHttpRequest();
- httpRequest.open("GET", "floorplan01.xml", false); // don't open async
-
- httpRequest.onreadystatechange = function()
- {
- var isLocal = (httpRequest.status == 0);
-
- if (httpRequest.readyState == 4 &&
- (httpRequest.status == 200 || isLocal))
- {
- if (httpRequest.responseXML == null)
- // Mozilla failure, local or HTTP
- failure();
- else if(httpRequest.responseXML.document == null)
- {
- // IE
- if (!isLocal) documentElement
- {
- // HTTP failure
- failure();
- } else {
- // Local failure--always happens, try
- // using Microsoft.XMLDOM to load
- xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
- xmlDoc.async = false;
- xmlDoc.loadXML(httpRequest.responseText);
-
- if (xmlDoc.documentElement != null)
- success(xmlDoc);
- else
- failure();
- }
- } else {
- success(httpRequest.responseXML);
- //xmlDoc = httpRequest.responseXML;
- }
- } else {
- alert( "big fail; readystate: "+httpRequest.readyState+" status: "+httpRequest.status);
- }
- };
- httpRequest.send();
- parseXMLFloorPlan();
- */
- // code for IE
- /*
- if (window.ActiveXObject)
- {
- xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
- }
- // code for Mozilla, Firefox, Opera, etc.
- else if (document.implementation.createDocument)
- {
- xmlDoc=document.implementation.createDocument("","",null);
- }
- else
- {
- alert('Your browser cannot handle this script');
- }
- xmlDoc.async=false;
- xmlDoc.onload = parseXMLFloorPlan;
- xmlDoc.load("floorplan01.xml");
- */
$.get('floorplan01.xml', parseXMLFloorPlan, 'xml');
-
}
var floor;
var floorCount = -1;
@@ -401,9 +312,6 @@
show3D( 35*Math.PI/180, 30*Math.PI/180, plan );
//document.getElementById( "top_level" ).appendChild( plan );
-
- // clean up and save space
- delete xmlDoc;
}
var floorNodes = new Object();
@@ -974,16 +882,6 @@
{
if( noSetup ) setup3D();
- //var dist = 30;
- /*
- //camera.position.z = rotation * 180 / Math.PI;
- //camera.rotation.z = rotation;
- //camera.rotation.y = tilt;
- camera.position.z = Math.sin(tilt) * dist;
- camera.position.x = Math.cos(tilt) * dist * Math.sin(rotation);
- camera.position.y = Math.cos(tilt) * dist * Math.cos(rotation);
- */
- //renderer.render(scene, camera);
var cx = -Math.cos(rotation) * Math.cos(tilt);
var cy = Math.sin(rotation) * Math.cos(tilt);
var cz = Math.sin(tilt);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|