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

planemo upload commit 841d8b22bf9f1aaed6bfe8344b60617f45b275b2-dirty
author mingchen0919
date Fri, 14 Dec 2018 00:21:26 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:55d2db17c67c
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 }));