blob: 7fd9b7342aba687cd17a1e6a4065245dbc8d3d81 [file] [log] [blame]
Nils Diewald0e6992a2015-04-14 20:13:52 +00001requirejs.config({
2 baseUrl: '../js/src',
3 paths : {
4 'lib': '../lib'
5 }
6});
7
8var cookey;
9
10function add (val) {
11 var list = document.getElementById('number');
12 list.textContent += '-' + val;
13 cookey.set('n', list.textContent);
14};
15
16function removeCookie () {
17 cookey.clear();
18};
19
20define(['session', 'lib/domReady'], function (sessionClass, domReady) {
21 domReady(function () {
22 cookey = sessionClass.create('peter');
23 document.getElementById('number').textContent = cookey.get('n') || '';
24
25 var elements = document.getElementsByClassName('num');
26 for (var i = 0; i < elements.length; i++) {
27 elements[i].addEventListener(
28 'click',
29 function (e) {
30 add(this.textContent);
31 }
32 );
33 };
34 });
35})