source: Dev/branches/rest-dojo-ui/client/dojox/rpc/demos/wikipedia.html @ 256

Last change on this file since 256 was 256, checked in by hendrikvanantwerpen, 13 years ago

Reworked project structure based on REST interaction and Dojo library. As
soon as this is stable, the old jQueryUI branch can be removed (it's
kept for reference).

File size: 1.2 KB
Line 
1<html>
2        <head>
3                <title>
4                        Wikipedia Article Grabber Demo
5                </title>
6                <script src="../../../dojo/dojo.js" type="text/javascript"
7                        djConfig="parseOnLoad: true, isDebug: true"></script>
8                <script type="text/javascript">
9                        dojo.require("dojo.io.script")
10                        dojo.require("dojox.rpc.Service");
11                        dojo.require("dijit._Widget");
12                        dojo.require("dojox.dtl._Templated");
13                        dojo.require("dojo.parser");
14
15                        dojo.declare("WikipediaPageGrabber", [dijit._Widget, dojox.dtl._Templated], {
16                                constructor: function(params, node){
17                                        var mu = dojo.moduleUrl("dojox.rpc.SMDLibrary", "wikipedia.smd");
18                                        this.wikipedia = new dojox.rpc.Service(mu);
19                                },
20                                onSearch: function(e){
21                                        if(e.keyCode == dojo.keys.ENTER){
22                                                this.wikipedia.query({
23                                                        action: "parse",
24                                                        page: e.target.value
25                                                }).addCallback(this, function(article){
26                                                        console.debug(article.parse);
27                                                        this.article = article.parse;
28                                                        this.parsedText = article.parse.text["*"]; // ugh, crazy JSON structure here
29                                                        this.render();
30                                                });
31                                        }
32                                },
33                                templateString: dojo.cache("dojox.rpc.demos.templates", "wikipedia.html")
34                        });
35                </script>
36        </head>
37        <body>
38                <h1>Wikipedia Page Grabber</h1>
39                <div dojoType="WikipediaPageGrabber"></div>
40        </body>
41</html>
Note: See TracBrowser for help on using the repository browser.