Commit f165c40a06b482cac7d71461d9f9c83369de742d
1 parent
1ad60f67
Exists in
master
and in
7 other branches
correções no colorpicker para IE
Showing
1 changed file
with
52 additions
and
16 deletions
Show diff stats
ferramentas/colorpicker/index.htm
| 1 | +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> | |
| 1 | 2 | <html> |
| 2 | 3 | <head> |
| 3 | 4 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> |
| 4 | 5 | <style type="text/css"> |
| 6 | +/*margin and padding on body element | |
| 7 | + can introduce errors in determining | |
| 8 | + element position and are not recommended; | |
| 9 | + we turn them off as a foundation for YUI | |
| 10 | + CSS treatments. */ | |
| 5 | 11 | body { |
| 6 | 12 | margin:0; |
| 7 | 13 | padding:0; |
| ... | ... | @@ -13,49 +19,75 @@ body { |
| 13 | 19 | <script type="text/javascript" src="../../pacotes/yui231/build/utilities/utilities.js"></script> |
| 14 | 20 | <script type="text/javascript" src="../../pacotes/yui231/build/slider/slider.js"></script> |
| 15 | 21 | <script type="text/javascript" src="../../pacotes/yui231/build/colorpicker/colorpicker-beta.js"></script> |
| 22 | + | |
| 23 | + | |
| 24 | +<!--begin custom header content for this example--> | |
| 25 | + | |
| 16 | 26 | <style type="text/css"> |
| 17 | - #container { position: relative; padding: 6px; width: 360px; height:190px; } | |
| 27 | + #container { position: relative; padding: 6px; background-color: #eeeeee; width: 420px; height:220px; } | |
| 18 | 28 | </style> |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | +<!--end custom header content for this example--> | |
| 33 | + | |
| 19 | 34 | </head> |
| 20 | -<body class="yui-skin-sam"> | |
| 35 | + | |
| 36 | +<body class=" yui-skin-sam"> | |
| 37 | + | |
| 38 | +<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== --> | |
| 39 | + | |
| 21 | 40 | <div id="container"> |
| 22 | 41 | </div> |
| 23 | -<button onclick="aplicarCor()" size="10" >aplicar</button> | |
| 42 | +<button onclick="aplicarCor()" size="10" style="position:absolute;top:188px" >aplicar</button> | |
| 43 | +<!--We'll use these to trigger interactions with the Color Picker | |
| 44 | +API --> | |
| 24 | 45 | |
| 25 | 46 | |
| 26 | 47 | <script type="text/javascript"> |
| 27 | -(function() | |
| 28 | -{ | |
| 29 | - var Event = YAHOO.util.Event,picker; | |
| 30 | - Event.onDOMReady( | |
| 31 | - function() | |
| 32 | - { | |
| 33 | - YAHOO.log("Criando....", "info", "example"); | |
| 48 | +(function() { | |
| 49 | + var Event = YAHOO.util.Event, | |
| 50 | + picker; | |
| 51 | + | |
| 52 | + Event.onDOMReady(function() { | |
| 53 | + YAHOO.log("Creating Color Picker.", "info", "example"); | |
| 34 | 54 | picker = new YAHOO.widget.ColorPicker("container", { |
| 35 | 55 | showhsvcontrols: true, |
| 36 | 56 | showhexcontrols: true, |
| 37 | 57 | images: { |
| 38 | - PICKER_THUMB: window.parent.g_locaplic+"/pacotes/yui231/examples/colorpicker/assets/picker_thumb.png", | |
| 39 | - HUE_THUMB: window.parent.g_locaplic+"/pacotes/yui231/examples/colorpicker/assets/hue_thumb.png" | |
| 58 | + PICKER_THUMB: "../../pacotes/yui231/examples/colorpicker/assets/picker_thumb.png", | |
| 59 | + HUE_THUMB: "../../pacotes/yui231/examples/colorpicker/assets/hue_thumb.png" | |
| 40 | 60 | } |
| 41 | 61 | }); |
| 62 | + YAHOO.log("Finished creating Color Picker.", "info", "example"); | |
| 63 | + | |
| 42 | 64 | //a listener for logging RGB color changes; |
| 43 | 65 | //this will only be visible if logger is enabled: |
| 44 | - var onRgbChange = function(o) { | |
| 66 | + var onRgbChange = function(o) { | |
| 67 | + /*o is an object | |
| 68 | + { newValue: (array of R, G, B values), | |
| 69 | + prevValue: (array of R, G, B values), | |
| 70 | + type: "rgbChange" | |
| 71 | + } | |
| 72 | + */ | |
| 73 | + YAHOO.log("The new color value is " + o.newValue, "info", "example"); | |
| 45 | 74 | } |
| 75 | + | |
| 46 | 76 | //subscribe to the rgbChange event; |
| 47 | 77 | picker.on("rgbChange", onRgbChange); |
| 78 | + | |
| 48 | 79 | //use setValue to reset the value to white: |
| 49 | 80 | Event.on("reset", "click", function(e) { |
| 50 | 81 | picker.setValue([255, 255, 255], false); //false here means that rgbChange |
| 51 | 82 | //wil fire; true would silence it |
| 52 | - }); | |
| 83 | + }); | |
| 84 | + | |
| 53 | 85 | //use the "get" method to get the current value |
| 54 | 86 | //of one of the Color Picker's properties; in |
| 55 | 87 | //this case, we'll get the hex value and write it |
| 56 | 88 | //to the log: |
| 57 | 89 | Event.on("gethex", "click", function(e) { |
| 58 | - YAHOO.log("hex: " + picker.get("hex"), "info", "example"); | |
| 90 | + YAHOO.log("Current hex value: " + picker.get("hex"), "info", "example"); | |
| 59 | 91 | }); |
| 60 | 92 | }); |
| 61 | 93 | })(); |
| ... | ... | @@ -77,4 +109,8 @@ function aplicarCor() |
| 77 | 109 | window.parent.YAHOO.janelaDoca2.xp.panel.destroy(); |
| 78 | 110 | } |
| 79 | 111 | </script> |
| 80 | -</html> | |
| 81 | 112 | \ No newline at end of file |
| 113 | + | |
| 114 | +<!--END SOURCE CODE FOR EXAMPLE =============================== --> | |
| 115 | + | |
| 116 | +</body> | |
| 117 | +</html> | ... | ... |