OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
Evan Stade
2011/06/07 03:25:46
file level comment. I honestly have no idea what O
Nikita (slow)
2011/06/07 17:03:36
Done.
| |
5 var steps = ["connect", "eula", "update"]; | |
6 | |
7 cr.define('cr.ui', function() { | |
8 | |
9 function Oobe() { | |
Evan Stade
2011/06/07 03:25:46
this seems wrong.
Nikita (slow)
2011/06/07 17:03:36
You mean when there're no parameters I may as well
Evan Stade
2011/06/08 19:56:07
yes
Nikita (slow)
2011/06/08 22:28:27
Done.
Nikita (slow)
2011/06/09 15:52:14
I've got cr.js:315, Uncaught TypeError: Cannot set
Evan Stade
2011/06/09 22:38:46
uh, ok then. I guess add a function comment then w
Nikita (slow)
2011/06/10 09:21:39
Done.
| |
10 } | |
11 | |
12 cr.addSingletonGetter(Oobe); | |
13 | |
14 Oobe.localStrings_ = new LocalStrings(); | |
15 | |
16 Oobe.prototype = { | |
17 initialized_: false, | |
18 current_step_: 0, | |
Evan Stade
2011/06/07 03:25:46
these are c style var names, instead they should b
Nikita (slow)
2011/06/07 17:03:36
Done.
| |
19 | |
20 toggleStep_: function(next_step) { | |
Evan Stade
2011/06/07 03:25:46
comment your functions
Nikita (slow)
2011/06/07 17:03:36
Done.
| |
21 if (next_step >= 0 && next_step < steps.length) { | |
22 var offset = next_step - this.current_step_; | |
23 var oldstep = $(steps[this.current_step_]); | |
24 var oldheader = $("h" + steps[this.current_step_]); | |
25 var newstep = $(steps[this.current_step_ + offset]); | |
26 var newheader = $("h" + steps[this.current_step_ + offset]); | |
27 | |
28 newstep.classList.remove("hidden"); | |
29 | |
30 if (offset == 1) { | |
31 oldheader.classList.add("left"); | |
32 oldstep.classList.add("left"); | |
33 newheader.classList.remove("right"); | |
34 newstep.classList.remove("right"); | |
35 } else if (offset == -1) { | |
36 oldheader.classList.add("right"); | |
37 oldstep.classList.add("right"); | |
38 newheader.classList.remove("left"); | |
39 newstep.classList.remove("left"); | |
40 } | |
41 | |
42 // Adjust inner container height based on new step's height. | |
43 $("inner-container").style.height = | |
44 $(steps[this.current_step_ + offset]).offsetHeight; | |
45 | |
46 setTimeout(function(){oldstep.classList.add('hidden');}, 500); | |
47 this.current_step_ += offset; | |
48 $("oobe").className = steps[this.current_step_]; | |
49 } | |
50 }, | |
51 }; | |
52 | |
53 Oobe.initialize = function() { | |
54 this.initialized_ = true; | |
55 | |
56 // Adjust inner container height based on first step's height | |
57 $("inner-container").style.height = $(steps[0]).offsetHeight; | |
58 | |
59 $('continue-button').addEventListener('click', function(event) { | |
60 // TODO(nkostylev): Callback screen handler. | |
61 Oobe.toggleStep(1); | |
62 }); | |
63 $('back-button').addEventListener('click', function(event) { | |
64 // TODO(nkostylev): Callback screen handler. | |
65 Oobe.toggleStep(0); | |
66 }); | |
67 $('accept-button').addEventListener('click', function(event) { | |
68 // TODO(nkostylev): Callback screen handler. | |
69 Oobe.toggleStep(2); | |
70 }); | |
71 | |
72 chrome.send('screenStateInitialize'); | |
73 }; | |
74 | |
75 Oobe.toggleStep = function(next_step) { | |
76 Oobe.getInstance().toggleStep_(next_step); | |
77 }; | |
78 | |
79 // Export | |
80 return { | |
81 Oobe: Oobe | |
82 }; | |
83 | |
Evan Stade
2011/06/07 03:25:46
don't need this line return
Nikita (slow)
2011/06/07 17:03:36
Done.
| |
84 }); | |
85 | |
86 var Oobe = cr.ui.Oobe; | |
87 | |
88 document.addEventListener('DOMContentLoaded', cr.ui.Oobe.initialize); | |
OLD | NEW |