| 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <meta http-equiv="Content-type" content="text/html; charset=utf-8"/> |
| 5 | <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"/> |
| 6 | <meta name="apple-mobile-web-app-capable" content="yes"/> |
| 7 | <title>Test Opener with ColorPalette</title> |
| 8 | |
| 9 | <link href="../themes/common/dijit/dijit.css" rel="stylesheet"/> |
| 10 | <script type="text/javascript" src="../deviceTheme.js" data-dojo-config="mblThemeFiles: ['base','Overlay','Tooltip']"></script> |
| 11 | <script type="text/javascript" src="../../../dojo/dojo.js" data-dojo-config="async: true, parseOnLoad: true"></script> |
| 12 | |
| 13 | <script language="JavaScript" type="text/javascript"> |
| 14 | require([ |
| 15 | "dojox/mobile", |
| 16 | "dojox/mobile/compat", |
| 17 | "dojox/mobile/parser", |
| 18 | "dojox/mobile/Opener", |
| 19 | "dijit/_base/manager", // dijit.byId |
| 20 | "dijit/ColorPalette" |
| 21 | ]); |
| 22 | |
| 23 | function getColor1(node, v){ |
| 24 | if(v === true){ // Done clicked |
| 25 | var w = dijit.byId("colorPalette"); |
| 26 | var color = w.get("value"); |
| 27 | if(color){ |
| 28 | node.value = color; |
| 29 | node.style.backgroundColor = color; |
| 30 | node.style.color = "#" + ("0" +(255-parseInt(color.substr(1,2), 16)).toString(16)).slice(-2) |
| 31 | + ("0" + (255-parseInt(color.substr(3,2), 16)).toString(16)).slice(-2) |
| 32 | + ("0" + (255-parseInt(color.substr(5,2), 16)).toString(16)).slice(-2); |
| 33 | } |
| 34 | } |
| 35 | } |
| 36 | </script> |
| 37 | |
| 38 | <style> |
| 39 | html, body{ |
| 40 | overflow: hidden; |
| 41 | } |
| 42 | .mblTooltip.mblOpener DIV[label='Cancel'] { |
| 43 | display: none; |
| 44 | } |
| 45 | </style> |
| 46 | </head> |
| 47 | <body style="visibility:hidden;"> |
| 48 | <table cellspacing="20"> |
| 49 | <tr> |
| 50 | <td style="text-align:right;">Color (Palette)</td> |
| 51 | <td><input id="color1" readOnly value="transparent" style="background-color:transparent;" |
| 52 | onclick="dijit.byId('colorPicker1').show(this, ['above-centered','below-centered','after','before'])"></td> |
| 53 | </tr> |
| 54 | </table> |
| 55 | |
| 56 | <div id="colorPicker1" data-dojo-type="dojox.mobile.Opener" data-dojo-props="onHide:getColor1"> |
| 57 | <h1 dojoType="dojox.mobile.Heading" label="Select a Color"> |
| 58 | <span dojoType="dojox.mobile.ToolBarButton" label="Done" class="mblColorBlue" style="position:absolute;width:45px;right:0;" |
| 59 | onclick="dijit.byId('colorPicker1').hide(true)"></span> |
| 60 | <span dojoType="dojox.mobile.ToolBarButton" label="Cancel" class="mblColorBlue" style="position:absolute;width:45px;left:0;" |
| 61 | onclick="dijit.byId('colorPicker1').hide(false)"></span> |
| 62 | </h1> |
| 63 | <div id="colorPalette" dojoType='dijit.ColorPalette'></div> |
| 64 | </div> |
| 65 | </body> |
| 66 | </html> |