comparison vakata-jstree-3.3.5/src/vakata-jstree.js @ 0:c12e291895ff draft

planemo upload commit 104ae24ee30761a0099eeb91362ed1e3e13aba4b
author mingchen0919
date Tue, 01 May 2018 10:45:22 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:c12e291895ff
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 }));