README.md 1.18 KB
Newer Older
1
# BakuJS
Zéfling's avatar
Zéfling committed
2

Zéfling's avatar
Zéfling committed
3
## Formatter
4

Zéfling's avatar
Zéfling committed
5
6
Some small functions by adding on the prototype of the base objects.
The idea is for the formatter is to approach the formatting possibilities of fmt:message in JSTL.
Zéfling's avatar
Zéfling committed
7

Zéfling's avatar
Zéfling committed
8
### Examples :
Zéfling's avatar
Zéfling committed
9
```js
10
11
12
13
'Il y a {0, number, #,##0:fr} jour{0, choice,1<=|1>s}'._format(1200);                 // 'Il y a 1 200 jours'
'Il y a {jours, number, #,##0:fr} jour{jours, choice,1<=|1>s}'._format({jours : 1});  // 'Il y a 1 jour'
'Rendez-vous le {date, date, dd/MM/yyyy}'._format({date : '2016-04-10'});             // 'Rendez-vous le 10/04/2016'
'Le resultat est {0, choice, 10<{1}|10>={2}}.'._format([12, 'petit', 'grand']);       // 'Le resultat est grand.'
Zéfling's avatar
Zéfling committed
14
15
```

Zéfling's avatar
Zéfling committed
16
## DOM
Zéfling's avatar
Zéfling committed
17

Zéfling's avatar
Zéfling committed
18
Some shortcuts to avoid using a big library to do simple operations on the DOM with selectors.
Zéfling's avatar
Zéfling committed
19

Zéfling's avatar
Zéfling committed
20
### Examples
Zéfling's avatar
Zéfling committed
21
```js
Zéfling's avatar
Zéfling committed
22
baku.dom.list('h2 + div')
23
    ._css({'color' : 'red', 'text-decoration' : 'underline'})
Zéfling's avatar
Zéfling committed
24
    ._rmClass('ko');
Zéfling's avatar
Zéfling committed
25
```
Zéfling's avatar
Zéfling committed
26

27
28
29
30
31
32
33
34
35
36
37
38
## Compilation

```bash
# dom + formatter
compress.sh full
# dom only
compress.sh dom
# formatter only
compress.sh
```

## Test 
Zéfling's avatar
Zéfling committed
39

Zéfling's avatar
Zéfling committed
40
See the test page: http://test.ikilote.net/BakuJS/test.html
Zéfling's avatar
Zéfling committed
41
42

If you propose a correction or additional content, thank you to make all the tests are always ok, and/or add new.