Also apply the __toString fix to UserInfo
[cacert-mgr.git] / external / ZendFramework-1.9.5 / externals / dojo / demos / fonts / src / news.js
1 dojo.provide("demos.fonts.src.news");
2 dojo.require("demos.fonts.src.pie");
3 dojo.require("dojo.date.locale");
4
5 function init(){
6 // get the fonts
7 var euro = dojox.gfx.getVectorFont("resources/eurostyle.svg");
8 var book = dojox.gfx.getVectorFont("resources/bookplate.svg");
9
10 // do the header and the date
11 dojo.byId("date").innerHTML = dojo.date.locale.format(new Date(), { formatLength: "long", selector: "date" });
12
13 var t = dojo.byId("title"),
14 b = dojo.marginBox(t),
15 txt = t.innerHTML,
16 w = book.getWidth(txt, book._getSizeFactor("72px"));
17 t.innerHTML = "";
18 var s = dojox.gfx.createSurface(t, w, 72),
19 g = s.createGroup();
20 book.draw(g,
21 { text: txt, width:w, height:60, align:"middle" },
22 { size: "72px" },
23 "#181818"
24 );
25
26 if(dojo.isIE){
27 t.parentNode.style.textAlign = "left";
28 }
29
30 var t = dojo.byId("subtitle"),
31 txt = t.innerHTML,
32 w = book.getWidth(txt, book._getSizeFactor("20px"));
33 t.innerHTML = "";
34 var s = dojox.gfx.createSurface(t, w, 20),
35 g = s.createGroup();
36 euro.draw(g,
37 { text: txt, align: "middle" },
38 { size: "20px" },
39 "#333"
40 );
41
42 // replace the rest of the headings
43 dojo.forEach([ "mainHeading", "label" ], function(item){
44 var t = dojo.byId(item),
45 txt = t.innerHTML,
46 w = euro.getWidth(txt, euro._getSizeFactor("24px"));
47 t.innerHTML = "";
48 var s = dojox.gfx.createSurface(t, w, 30),
49 g = s.createGroup();
50 euro.draw(g,
51 { text: txt },
52 { size: "24px" },
53 "#333"
54 );
55 });
56
57 dojo.query("#body h2").forEach(function(t){
58 var txt = t.innerHTML,
59 w = book.getWidth(txt, book._getSizeFactor("16px"));
60 t.innerHTML = "";
61 var s = dojox.gfx.createSurface(t, w, 18),
62 g = s.createGroup();
63 book.draw(g,
64 { text: txt },
65 { size: "16px" },
66 "#000"
67 );
68 });
69
70 // copyright.
71 var t = dojo.byId("bottomCopy"),
72 txt = t.innerHTML,
73 w = book.getWidth(txt, book._getSizeFactor("9px"));
74 t.innerHTML = "";
75 var s = dojox.gfx.createSurface(t, w, 10),
76 g = s.createGroup();
77 book.draw(g,
78 { text: txt },
79 { size: "9px" },
80 "#000"
81 );
82
83 // draw the pie chart and scale it down.
84 var data = [
85 { label: "Pretty likely", value: 200 },
86 { label: "Maybe", value: 142 },
87 { label: "Not too likely", value: 76 },
88 { label: "Ain't gonna do it", value: 49 }
89 ];
90
91 var p = new demos.fonts.src.pie(dojo.byId("chart"), euro, data);
92 var g = p.draw();
93 }
94 dojo.addOnLoad(init);