blob: d183c36b7ec1830e79f913f7844ec6aa099347e6 [file] [log] [blame]
Nils Diewald0e6992a2015-04-14 20:13:52 +00001var KorAP = KorAP || {};
2
3// TODO: Make this part of util!
4// Don't let events bubble up
5if (Event.halt === undefined) {
6 // Don't let events bubble up
7 Event.prototype.halt = function () {
8 this.stopPropagation();
9 this.preventDefault();
10 };
11};
12
13// Add toggleClass method similar to jquery
14HTMLElement.prototype.toggleClass = function (c1, c2) {
15 var cl = this.classList;
16 if (cl.contains(c1)) {
17 cl.add(c2);
18 cl.remove(c1);
19 }
20 else {
21 cl.remove(c2);
22 cl.add(c1);
23 };
24};
25
26
27// Utility for removing all children of a node
28function _removeChildren (node) {
29 // Remove everything underneath
30 while (node.firstChild)
31 node.removeChild(node.firstChild);
32};
33
34
35define(function () {
36 KorAP.API = KorAP.API || {};
37 KorAP.Locale = KorAP.Locale || {};
38
39 // Default log message
40 KorAP.log = KorAP.log || function (type, msg) {
41 console.log(type + ": " + msg);
42 };
43
44 return KorAP;
45});