Change Class behavior of hello world.

This commit is contained in:
Michael Teeuw
2016-04-09 15:49:39 +02:00
parent 7ef43caa1e
commit 14a72dec15
3 changed files with 7 additions and 19 deletions

View File

@@ -17,9 +17,9 @@ var defaults = {
{ {
module: "helloworld", module: "helloworld",
position: "upper_third", position: "upper_third",
classes: "large thin",
config: { config: {
text: "Magic Mirror<sup>2</sup>", text: "Magic Mirror<sup>2</sup>"
classes: "large thin"
} }
}, },
{ {
@@ -32,17 +32,17 @@ var defaults = {
{ {
module: "helloworld", module: "helloworld",
position: "middle_center", position: "middle_center",
classes: "small dimmed",
config: { config: {
text: "See README for more information.", text: "See README for more information."
classes: "small dimmed"
} }
}, },
{ {
module: "helloworld", module: "helloworld",
position: "bottom_bar", position: "bottom_bar",
classes: "xsmall dimmed",
config: { config: {
text: "www.michaelteeuw.nl", text: "www.michaelteeuw.nl"
classes: "xsmall dimmed"
} }
}, },
], ],

View File

@@ -38,14 +38,5 @@ The following properties can be configured:
<br><b>Default value:</b> <code>'Hello world!'</code> <br><b>Default value:</b> <code>'Hello world!'</code>
</td> </td>
</tr> </tr>
<tr>
<td><code>classes</code></td>
<td>Classes to apply to the text.<br>
<br><b>Example:</b> <code>'xsmall bold'</code>
<br><b>Default value:</b> <code>'normal medium'</code>
</td>
</tr>
</tbody> </tbody>
</table> </table>

View File

@@ -11,16 +11,13 @@ Module.register("helloworld",{
// Default module config. // Default module config.
defaults: { defaults: {
text: "Hello World!", text: "Hello World!"
classes: "normal medium"
}, },
// Override dom generator. // Override dom generator.
getDom: function() { getDom: function() {
var wrapper = document.createElement("div"); var wrapper = document.createElement("div");
wrapper.className = this.config.classes;
wrapper.innerHTML = this.config.text; wrapper.innerHTML = this.config.text;
return wrapper; return wrapper;
} }
}); });