]> git.mxchange.org Git - friendica.git/blobdiff - library/cropper/tests/example-CoordsOnLoad.htm
bug #96 move libraries to library - better alignment of like rotator
[friendica.git] / library / cropper / tests / example-CoordsOnLoad.htm
diff --git a/library/cropper/tests/example-CoordsOnLoad.htm b/library/cropper/tests/example-CoordsOnLoad.htm
new file mode 100644 (file)
index 0000000..254a234
--- /dev/null
@@ -0,0 +1,108 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">\r
+<head>\r
+       <meta http-equiv="Content-type" content="text/html; charset=utf-8" />\r
+       <meta http-equiv="Content-Language" content="en-us" />\r
+       <title>Loading &amp; displaying co-ordinates of crop area on attachment test</title>\r
+       <script src="../lib/prototype.js" type="text/javascript"></script>      \r
+       <script src="../lib/scriptaculous.js?load=builder,dragdrop" type="text/javascript"></script>\r
+       <script src="../cropper.js" type="text/javascript"></script>\r
+       \r
+       \r
+       <script type="text/javascript" charset="utf-8">\r
+               \r
+               // setup the callback function\r
+               function onEndCrop( coords, dimensions ) {\r
+                       $( 'x1' ).value = coords.x1;\r
+                       $( 'y1' ).value = coords.y1;\r
+                       $( 'x2' ).value = coords.x2;\r
+                       $( 'y2' ).value = coords.y2;\r
+                       $( 'width' ).value = dimensions.width;\r
+                       $( 'height' ).value = dimensions.height;\r
+               }\r
+               \r
+               // basic example\r
+               Event.observe( \r
+                       window, \r
+                       'load', \r
+                       function() { \r
+                               new Cropper.Img( \r
+                                       'testImage',\r
+                                       {\r
+                                               onEndCrop: onEndCrop,\r
+                                               displayOnInit: true,\r
+                                               onloadCoords: { x1: 10, y1: 10, x2: 250, y2: 100 }\r
+                                       }\r
+                               ) \r
+                       }\r
+               );              \r
+               \r
+               \r
+               if( typeof(dump) != 'function' ) {\r
+                       Debug.init(true, '/');\r
+                       \r
+                       function dump( msg ) {\r
+                               Debug.raise( msg );\r
+                       };\r
+               } else dump( '---------------------------------------\n' );\r
+               \r
+               \r
+       </script>\r
+       <link rel="stylesheet" type="text/css" href="debug.css" media="all" />\r
+       <style type="text/css">\r
+               label { \r
+                       clear: left;\r
+                       margin-left: 50px;\r
+                       float: left;\r
+                       width: 5em;\r
+               }\r
+               \r
+               html, body { \r
+                       margin: 0;\r
+               }\r
+               \r
+               #testWrap {\r
+                       margin: 20px 0 0 50px; /* Just while testing, to make sure we return the correct positions for the image & not the window */\r
+               }\r
+       </style>\r
+</head>\r
+<body>\r
+       <h2>Loading &amp; displaying co-ordinates of crop area on attachment test</h2>\r
+       <p>\r
+               Some test content before the image\r
+       </p>\r
+       \r
+       <div id="testWrap">\r
+               <img src="castle.jpg" alt="test image" id="testImage" width="500" height="333" />\r
+       </div>\r
+       \r
+       \r
+       <p>\r
+               <label for="x1">x1:</label>\r
+               <input type="text" name="x1" id="x1" />\r
+       </p>\r
+       <p>\r
+               <label for="y1">y1:</label>\r
+               <input type="text" name="y1" id="y1" />\r
+       </p>\r
+       <p>\r
+               <label for="x2">x2:</label>\r
+               <input type="text" name="x2" id="x2" />\r
+       </p>\r
+       <p>\r
+               <label for="y2">y2:</label>\r
+               <input type="text" name="y2" id="y2" />\r
+       </p>\r
+       <p>\r
+               <label for="width">width:</label>\r
+               <input type="text" name="width" id="width" />\r
+       </p>\r
+       <p>\r
+               <label for="height">height</label>\r
+               <input type="text" name="height" id="height" />\r
+       </p>  \r
+       \r
+</body>\r
+</html>\r
+\r
+\r