| 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>Carousel Demo (dojo.store)</title> |
| 8 | |
| 9 | <script type="text/javascript" src="../../../deviceTheme.js" data-dojo-config="mblThemeFiles: ['base','Carousel','PageIndicator']"></script> |
| 10 | <script type="text/javascript" src="../../../../../dojo/dojo.js" data-dojo-config="async: true, parseOnLoad: true, mblAlwaysHideAddressBar: true, has: {'dojo-bidi': true }"></script> |
| 11 | |
| 12 | <script type="text/javascript"> |
| 13 | require([ |
| 14 | "dojo/_base/connect", |
| 15 | "dojo/ready", |
| 16 | "dijit/registry", |
| 17 | "dojo/store/Memory", |
| 18 | "doh/runner", |
| 19 | "dojo/dom", |
| 20 | "dojo/query", |
| 21 | "dojox/mobile/parser", |
| 22 | "dojox/mobile", |
| 23 | "dojox/mobile/compat", |
| 24 | "dojox/mobile/ScrollableView", |
| 25 | "dojox/mobile/StoreCarousel", |
| 26 | "dojox/mobile/Carousel", |
| 27 | "dojox/mobile/Button" |
| 28 | ], function(connect, ready, registry, Memory, runner, dom, query){ |
| 29 | var categ = [ |
| 30 | {src:"../../images/dish1.jpg", value:"שלום dish", headerText:"שלום dish!"}, |
| 31 | {src:"../../images/glass1.jpg", value:"שלום glass", headerText:"שלום glass!"} |
| 32 | ]; |
| 33 | |
| 34 | store1 = new Memory({data:categ, idProperty: "name"}); |
| 35 | |
| 36 | ready(function(){ |
| 37 | connect.subscribe("/dojox/mobile/carouselSelect", function(w, img, item, idx){ |
| 38 | if(w.id == "carousel1"){ |
| 39 | var dish = [ |
| 40 | {src:"../../images/dish1.jpg", value:"שלום dish!", headerText:"שלום dish!"}, |
| 41 | {src:"../../images/glass1.jpg", value:"שלום glass!", headerText:"שלום glass!"} ]; |
| 42 | var glass = [ |
| 43 | {src:"../../images/stone1.jpg", value:"שלום stone!", headerText:"שלום stone!"}, |
| 44 | {src:"../../images/shell1.jpg", value:"שלום shell!", headerText:"שלום shell!"} |
| 45 | ]; |
| 46 | var store2 = Memory({data:eval(item.value.split(" ")[1]), idProperty: "name"}); |
| 47 | |
| 48 | var w2 = registry.byId("carousel2"); |
| 49 | w2.set("title", item.value); |
| 50 | w2.setStore(store2); |
| 51 | registry.byId("rect1").domNode.style.display = "none"; |
| 52 | } |
| 53 | }); |
| 54 | runner.register("Bidi Carousel", [ |
| 55 | { |
| 56 | name: "mobile", |
| 57 | runTest: function(){ |
| 58 | query(".mblCarouselItemHeaderText, .mblCarouselTitle").forEach(function(node, index, arr){ |
| 59 | if(node.innerHTML) |
| 60 | runner.is(String.fromCharCode(8235), node.innerHTML.charAt(0), "CarouselItem's header should have direction correspondent to 'textDir'"); |
| 61 | }); |
| 62 | } |
| 63 | } |
| 64 | ]); |
| 65 | |
| 66 | runner.register("log", function(){ |
| 67 | dom.byId('failures').innerHTML = runner._failureCount; |
| 68 | dom.byId('errors').innerHTML = runner._errorCount; |
| 69 | }); |
| 70 | runner.run(); |
| 71 | }); |
| 72 | }, |
| 73 | toggleTextDir = function(){ |
| 74 | w2 = dijit.registry.byId("carousel2"); |
| 75 | w2.set("textDir", (w2.get("textDir") !== "rtl") ? "rtl" : "ltr"); |
| 76 | }); |
| 77 | </script> |
| 78 | </head> |
| 79 | <body style="visibility:hidden;background-color:#6D6D6D"> |
| 80 | <button data-dojo-type="dojox.mobile.Button" data-dojo-props='type:"button", onClick:function(){ toggleTextDir(); }'>Toggle second carousel textDir</button> |
| 81 | <br> |
| 82 | <div id="foo" data-dojo-type="dojox.mobile.ScrollableView"> |
| 83 | <div id="carousel1" data-dojo-type="dojox.mobile.StoreCarousel" |
| 84 | data-dojo-props='textDir: "rtl", height:"150px", navButton:true, store:store1, itemWidth:156, title:"שלום Category!"'></div> |
| 85 | <div id="carousel2" data-dojo-type="dojox.mobile.StoreCarousel" |
| 86 | data-dojo-props='textDir: "rtl", height:"110px", navButton:true, itemWidth:100'></div> |
| 87 | <div id="rect1" data-dojo-type="dojox.mobile.RoundRect" style="display:none"></div> |
| 88 | </div> |
| 89 | <br>Errors: <span id="errors">?</span> |
| 90 | <br>Failures: <span id="failures">?</span> |
| 91 | </body> |
| 92 | </html> |