| 875 |
lars |
1 |
(function (factory) {
|
|
|
2 |
"use strict";
|
|
|
3 |
if (typeof define === 'function' && define.amd) {
|
|
|
4 |
define('jstree.checkbox', ['jquery','jstree'], factory);
|
|
|
5 |
}
|
|
|
6 |
else if(typeof exports === 'object') {
|
|
|
7 |
factory(require('jquery'), require('jstree'));
|
|
|
8 |
}
|
|
|
9 |
else {
|
|
|
10 |
factory(jQuery);
|
|
|
11 |
}
|
|
|
12 |
}(function ($, undefined) {
|
|
|
13 |
"use strict";
|
|
|
14 |
if(document.registerElement && Object && Object.create) {
|
|
|
15 |
var proto = Object.create(HTMLElement.prototype);
|
|
|
16 |
proto.createdCallback = function () {
|
|
|
17 |
var c = { core : {}, plugins : [] }, i;
|
|
|
18 |
for(i in $.jstree.plugins) {
|
|
|
19 |
if($.jstree.plugins.hasOwnProperty(i) && this.attributes[i]) {
|
|
|
20 |
c.plugins.push(i);
|
|
|
21 |
if(this.getAttribute(i) && JSON.parse(this.getAttribute(i))) {
|
|
|
22 |
c[i] = JSON.parse(this.getAttribute(i));
|
|
|
23 |
}
|
|
|
24 |
}
|
|
|
25 |
}
|
|
|
26 |
for(i in $.jstree.defaults.core) {
|
|
|
27 |
if($.jstree.defaults.core.hasOwnProperty(i) && this.attributes[i]) {
|
|
|
28 |
c.core[i] = JSON.parse(this.getAttribute(i)) || this.getAttribute(i);
|
|
|
29 |
}
|
|
|
30 |
}
|
|
|
31 |
$(this).jstree(c);
|
|
|
32 |
};
|
|
|
33 |
// proto.attributeChangedCallback = function (name, previous, value) { };
|
|
|
34 |
try {
|
|
|
35 |
document.registerElement("vakata-jstree", { prototype: proto });
|
|
|
36 |
} catch(ignore) { }
|
|
|
37 |
}
|
|
|
38 |
}));
|