summary refs log tree commit diff stats
path: root/tests/js.nim
blob: e5e4323667b4bbc9c5e71435b14912b1dbb74d60 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
discard """
  cmd: "nim js --hints:on $options $file"
"""

# This file tests the JavaScript generator

import
  dom, strutils

# We need to declare the used elements here. This is annoying but
# prevents any kind of typo:
var
  inputElement {.importc: "document.form1.input1", nodecl.}: ref TElement

proc OnButtonClick() {.exportc.} =
  let v = $inputElement.value
  if v.allCharsInSet(whiteSpace):
    echo "only whitespace, hu?"
  else:
    var x = parseInt(v)
    echo x*x

proc OnLoad() {.exportc.} = 
  echo "Welcome! Please take your time to fill in this formular!"
.highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
#+TITLE: Cetus

Cetus is a wallpaper setting tool written in Go. This is a work in-progress.

* Dependency
- [[https://feh.finalrewind.org/][feh]]

* Features
** Supports various Image of the Day services
There are several Image of the Day services on the web, cetus will pull the
latest image & set it as wallpaper.

- [X] [[http://apod.nasa.gov/apod/astropix.html][Astronomy Picture of the Day]]
- [X] Bing Photo of the Day

* Examples
** Image of the Day
*** Astronomy Picture of the Day
#+BEGIN_SRC sh
cetus -apod -apod-api=https://api.nasa.gov/planetary/apod \
      -apod-api-key=DEMO_KEY
#+END_SRC
*** Bing Photo of the Day
#+BEGIN_SRC sh
cetus -bpod
#+END_SRC
** Set given wallpaper
#+BEGIN_SRC sh
# Local image as wallpaper
cetus -img-path=/path/to/img

# Remote image as wallpaper
cetus -img-path=http://127.0.0.1
#+END_SRC