Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var elm = require('elm')
var EXPAND_BOTH = { x: 1.0, y: 1.0 };
var FILL_BOTH = { x: -1.0, y: -1.0 };
var EDIT_HOUR = 2; //constants required by elementary - why should I expose this?
var EDIT_MINUTE = 8; // constants required by elementary - why should I expose this?
var EDIT_SECOND = 32; // constants required by elementary - why should I expose this?
var w = elm.Window({
title: "Clock Demo",
width: 320,
height: 480,
align: FILL_BOTH,
elements: {
the_background: elm.Background({
weight: EXPAND_BOTH,
align: FILL_BOTH,
resize: true,
}),
the_box: elm.Box({
weight: EXPAND_BOTH,
resize: true,
elements: {
the_clock: elm.Clock({
show_am_pm: 1,
show_seconds: 1,
hour: 23,
minute: 45,
second: 34,
edit: true,
digit_edit: EDIT_HOUR | EDIT_MINUTE | EDIT_SECOND,
}
function bubble(n) {
return sprite(n, 'bb');
}
function shadow(n) {
return sprite(n, 'sh');
}
var win = elm.realise(elm.Window({
label: "Animation demo",
width: 480,
height: 800,
elements: {
the_background: elm.Background({
weight: EXPAND_BOTH,
image: elm.datadir + "data/images/rock_01.jpg",
resize: true
}),
shadow1: shadow(0),
shadow2: shadow(1),
shadow3: shadow(2),
bubble1: bubble(0),
bubble2: bubble(1),
bubble3: bubble(2)
},
on_keydown: function () {
print(this.label);
elm.exit();
}
}));
*/
var elm = require('elm');
var EXPAND_BOTH = { x: 1.0, y: 1.0 };
var logo_icon = elm.Icon({
image: elm.datadir + "data/images/logo_small.png",
});
var w = elm.Window({
title: "Slider",
width: 320,
height: 480,
elements: {
the_background: elm.Background({
resize: true,
weight: EXPAND_BOTH
}),
the_box: elm.Box({
weight: EXPAND_BOTH,
resize: true,
elements: {
horz_slider: elm.Slider({
label: "Horizontal",
units: "%1.1f units",
span: 120,
align: { x: -1.0, y: 0.5 },
weight: EXPAND_BOTH,
icon: logo_icon,
on_change: function(me) {
e.elements.the_box.elements.box2.elements.vert_inverted.value = me.value
on_delete: function() { print('Deleting ', this.title) },
content: {
"Orange": orange,
"Yellow": yellow,
"Green": green
}[this.label] || orange,
title: this.label
};
}
win = elm.realise(elm.Window({
title: "Naviframe Example",
width: 320,
height: 480,
elements: {
background: elm.Background({
weight: EXPAND_BOTH,
align: FILL_BOTH,
resize: true
}),
box: elm.Box({
weight: EXPAND_BOTH,
align: FILL_BOTH,
resize: true,
elements: {
naviframe: elm.Naviframe({
weight: EXPAND_BOTH,
align: FILL_BOTH,
elements: {},
resize: true
}),
but_box: elm.Box({
elm = require('elm');
var EXPAND_BOTH = { x: 1.0, y: 1.0 };
var FILL_BOTH = { x: -1.0, y: -1.0 };
var logo_icon = elm.Icon({
image: elm.datadir + "data/images/logo_small.png"
});
elm.realise(elm.Window({
title: "Panes Demo",
width: 320,
height: 480,
align: FILL_BOTH,
elements: {
background: elm.Background({
weight: EXPAND_BOTH,
align: FILL_BOTH,
resize: true,
}),
pane_1: elm.Pane({
weight: EXPAND_BOTH,
resize: true,
fill: true,
left: elm.Button({
icon: logo_icon,
label: "Left",
weight: { x: -1.0, y: -1.0 },
on_click: function(arg) {
print("clicked event on Button: Left");
},
on_unpress: function(arg) {
my_win.elements.plane2.on_animate = null;
my_win.elements.plane3.on_animate = null;
my_win.elements.plane4.on_animate = null;
make_alien_population();
}
var my_win = elm.realise(elm.Window({
title : "Air Show",
width : 800,
height : 600,
weight : EXPAND_BOTH,
align : FILL_BOTH,
elements : {
the_background : elm.Background ({
weight : EXPAND_BOTH,
align : FILL_BOTH,
image : elm.datadir + "data/images/space.png",
resize : true,
}),
plane1 : elm.Image ({
file : elm.datadir + "data/images/plane1.png",
width : 50,
height : 70,
x : 350,
y : 100,
on_click : function() {
if(myplane==null)
{
print(this.height + " " + this.weight);
myplane = my_win.elements.plane1 ;
text: entry_text,
weight: EXPAND_BOTH,
align: FILL_BOTH,
line_wrap: 3,
single_line: 1,
editable: true
});
var win = elm.realise(elm.Window({
title: "Notify Example",
width: 320,
height: 480,
weight: EXPAND_BOTH,
align: FILL_BOTH,
elements: {
background: elm.Background({
weight: EXPAND_BOTH,
align: FILL_BOTH,
resize: true
}),
box: elm.Box({
weight: EXPAND_BOTH,
align: FILL_BOTH,
resize: true,
elements: {
notify: elm.Notify({
content: entry,
timeout: 5,
align: { x: 0.5, y: 0.0 }
}),
icon_no_scale: elm.Button({
label: "Icon no scale",
var elm = require('elm');
var EXPAND_BOTH = { x: 1.0, y: 1.0 };
var FILL_BOTH = { x: -1.0, y: -1.0 };
var FILL_X = { x: -1.0, y: 0.5 };
var w = elm.Window({
title: "Spinner Demo",
width: 320,
height: 480,
align: FILL_BOTH,
elements: {
the_background: elm.Background({
weight: EXPAND_BOTH,
align: FILL_BOTH,
resize: true,
}),
the_box: elm.Box({
weight: EXPAND_BOTH,
resize: true,
elements: {
the_spinner: elm.Spinner({
label_format: "%1.1f units",
step: 1.3,
wrap: 1,
min: -50.0,
max: 250.0,
style: "vertical",
disabled: false,
var other_class = {
style: 'double_label',
text: function(part) {
return 'Other #' + this.data;
},
state: function(part) {
return true;
}
};
var win = elm.realise(elm.Window({
title: "GenList Example",
width: 320,
height: 480,
elements: {
background: elm.Background({
weight: EXPAND_BOTH,
align: FILL_BOTH,
resize: true,
}),
box: elm.Box({
weight: EXPAND_BOTH,
align: FILL_BOTH,
resize: true,
elements: {
list: elm.Genlist({
weight: EXPAND_BOTH,
align: FILL_BOTH,
elements: {},
on_longpress: function(item) {
item.long_pressed = true;
},
var FILL_BOTH = { x: -1.0, y: -1.0 };
var logo_icon = elm.Icon({
image: elm.datadir + "data/images/logo_small.png"
});
var logo_icon_unscaled = elm.Icon({
image: elm.datadir + "data/images/logo_small.png",
resizable_up: false,
resizable_down: false
});
var w = elm.Window({
title: "Check box demo",
elements: {
the_background: elm.Background({
weight: EXPAND_BOTH,
resize: true
}),
the_box: elm.Box({
weight: EXPAND_BOTH,
resize: true,
elements: {
icon_sized_check: elm.Check({
icon: logo_icon,
label: "Icon sized to check",
weight: { x: -1.0, y: -1.0 },
align: { x: -1.0, y: 0.5 },
state: true
}),
toggle1: elm.Check({
style: "toggle",