Debian Codegraph @

dijit/tests/_BidiSupport/form/test_Slider.html

raw symbols SCIP
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta http-equiv="Content-type" content="text/html; charset=utf-8">
5 <title>Dojo Slider Widget Demo</title>
6
7 <style type="text/css">
8 @import "../../../themes/claro/document.css";
9 @import "../../css/dijitTests.css";
10 </style>
11
12 <!-- required: the default dijit theme: -->
13 <link id="themeStyles" rel="stylesheet" href="../../../../dijit/themes/claro/claro.css"/>
14
15 <!-- required: dojo.js -->
16 <script type="text/javascript" src="../../../../dojo/dojo.js"
17 data-dojo-config="async: true, isDebug: true, parseOnLoad: true, has: { 'dojo-bidi': true }"></script>
18
19 <script type="text/javascript">
20 require([
21 "doh/runner",
22 "dojo/dom",
23 "dojo/number",
24 "dojo/parser",
25 "dojo/query",
26 "dijit/registry",
27 "dijit/form/VerticalSlider",
28 "dijit/form/VerticalRule",
29 "dijit/form/VerticalRuleLabels",
30 "dojo/domReady!"
31 ], function(doh, dom, number, parser, query, registry, VerticalSlider, VerticalRule, VerticalRuleLabels){
32
33
34 doh.register("setup", [
35 function parse(){
36 return parser.parse();
37 },
38 function programmatic(){
39 // programmatic vertical slider and labels
40 var node;
41 // setup the rules
42 var sliderRules = new VerticalRule({
43 count:11,
44 style:{width:"5px"}
45 });
46
47 // setup RuleLabels
48 var sliderRuleLabels = new VerticalRuleLabels({
49 labels: ["תגlowest!","low!", "mid!", "high!","תגhighest!"],
50 textDir: "ltr",
51 id: "rulerLabels2"
52 });
53
54 // and setup the slider
55 var sliderProps = {
56 value:1400,
57 name:"programmaticSlider",
58 slideDuration:0,
59 onChange:function(val){ dom.byId('sliderProgInput').value=val; },
60 style:{height:"165px"},
61 minimum:1000,
62 maximum:3000,
63 discreteValues:11,
64 intermediateChanges:"true",
65 showButtons:"true"
66 };
67
68 sliderProps.id = sliderProps.name = "programmaticSliderNoSrc";
69
70 var theSlider = new VerticalSlider(sliderProps, node);
71 node = theSlider.containerNode;
72 theSlider.placeAt("form1");
73 sliderRules.placeAt(node);
74 sliderRuleLabels.placeAt(node);
75
76 // and start them all
77 theSlider.startup();
78 sliderRules.startup();
79 sliderRuleLabels.startup();
80
81 //attach handler to Horizontal ruler
82 var slider1 = registry.byId("slider1");
83 slider1.watch("value", function(name, oldVal, newVal){
84 dom.byId("slider1input").value = number.format(newVal/100,{places:1,pattern:"#%"});
85 });
86 }
87 ]);
88
89 doh.register("tests._BidiSupport.form.RulerLabelBidi", [
90 {
91 name: "Slider Bidi",
92 runTest: function(){
93 query(" > div",dom.byId('rulerLabels1')).forEach(function(node, index, arr){
94 doh.is("rtl", node.style.direction, "hoprizontal: label node had 'direction' style corresponding to 'textDir'");
95 });
96 registry.byId("rulerLabels2").set('textDir',"auto");
97 var verticalLabel = query("div.dijitRuleLabelContainerV")[0];
98 doh.is("rtl", verticalLabel.style.direction, "vertical: label node had 'direction' style corresponding to 'textDir'");
99 }
100 }
101 ]);
102
103 doh.register("log", function(){
104 dom.byId('failures').innerHTML = doh._failureCount;
105 dom.byId('errors').innerHTML = doh._errorCount;
106 });
107
108 doh.run();
109 });
110 </script>
111 </head>
112
113 <body class="claro">
114 <h1 class="testTitle">Slider</h1>
115 Also try using the arrow keys, buttons, or clicking on the progress bar to move the slider.
116 <br>
117 <!-- to test form submission, you'll need to create an action handler similar to
118 http://www.utexas.edu/teamweb/cgi-bin/generic.cgi -->
119 <form id="form1" action="" name="example" method="post">
120 <br>initial value=10, min=0, max=100, pageIncrement=100, onChange event triggers input box value change immediately<br>
121 <strong>Horizontal Slider Example, "rtl" base text direction</strong>
122 <br>
123 <div id="slider1" data-dojo-type="dijit/form/HorizontalSlider" data-dojo-props='name:"horizontal1",
124 value:10,
125 maximum:100,
126 minimum:0,
127 pageIncrement:100,
128 showButtons:true,
129 intermediateChanges:true,
130 slideDuration:500,
131 style:{width:"50%", height:"20px"}
132 ' >
133 <div data-dojo-type="dijit/form/HorizontalRule" data-dojo-props='container:"topDecoration", count:6, style:{height:"5px"}'></div>
134 <div data-dojo-type="dijit/form/HorizontalRule" data-dojo-props='container:"bottomDecoration", count:5, style:{height:"5px"}'></div>
135 <ol id="rulerLabels1" data-dojo-type="dijit/form/HorizontalRuleLabels" data-dojo-props='textDir:"rtl", container:"bottomDecoration", style:{height:"1em",fontSize:"75%"}'>
136 <li>תגlowest!</li>
137 <li>תגnormal!</li>
138 <li>תגhighest!</li>
139 </ol>
140 </div>
141 Slider1 Value:<input readonly id="slider1input" size="4" value="10.0%"/>
142 <br>
143 <br>initial value=10, min=0, max=100, onChange event triggers input box value change when you mouse up or tab away<br>
144 <h1>Fancy HTML labels (no slide animation), "rtl" base text direction:</h1>
145 <div id="slider3" data-dojo-type="dijit/form/HorizontalSlider" data-dojo-props='name:"horizontal2",
146 title:"Fancy HTML Labels",
147 minimum:1,
148 value:2,
149 maximum:3,
150 discreteValues:3,
151 showButtons:false,
152 intermediateChanges:true,
153 slideDuration:0,
154 style:"width:300px; height: 30px;"
155 '>
156 <div data-dojo-type="dijit/form/HorizontalRule" data-dojo-props='container:"bottomDecoration", count:3, style:{height:"5px"}'></div>
157 <ol data-dojo-type="dijit/form/HorizontalRuleLabels" data-dojo-props='textDir:"rtl", container:"bottomDecoration", style:{height:"1em", fontSize:"75%"}'>
158 <li><img width=10 height=10 src="../../images/note.gif"/><br><span style="font-size: small">תגsmall!</span></li>
159 <li><img width=15 height=15 src="../../images/note.gif"/><br><span style="font-size: small">תגmedium!</span></li>
160 <li><img width=20 height=20 src="../../images/note.gif"/><br><span style="font-size: small">תגlarge!</span></li>
161 </ol>
162 </div>
163 <br><br>
164 <h2>Completely programmatic VerticalSlider and VerticalRule, "auto" base text direction</h2>
165 <h3>min:1000, max:3000, 11 discrete values, no animation</h3>
166
167 <div id="programmaticSlider"></div>
168 Programmatic Value:<input readonly id="sliderProgInput" size="5" value="1400"/>
169 </form>
170 <br>Errors:&nbsp;<span id="errors">?</span>
171 <br>Failures:&nbsp;<span id="failures">?</span>
172 </body>
173 </html>