New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

jstree-actions

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jstree-actions - npm Package Compare versions

Comparing version 0.0.13 to 0.1.0

31

jstree-actions.js

@@ -79,3 +79,4 @@ (function ($, undefined) {

this._create_action = function (node_id, node, action_id) {
this._create_action = function (node_id, action_id) {
var self = this;
var action = this._get_action(node_id, action_id);

@@ -88,3 +89,4 @@ if (action === null) return null;

action_el.onclick = function() {
action.callback(node.id, node, action_id, action_el);
var node = self.get_node(action_el);
action.callback(node_id, node, action_id, action_el);
};

@@ -111,10 +113,10 @@

this._set_action = function (node_id, node, action) {
this._set_action = function (node_id, obj, action) {
if (action === null) return;
var place = node.querySelector(action.action.selector);
var place = obj.querySelector(action.action.selector);
if (action.action.after) {
place.parentNode.insertBefore(action.action_el, place.nextSibling);
} else {
node.insertBefore(action.action_el, place);
obj.insertBefore(action.action_el, place);
}

@@ -142,6 +144,7 @@ };

this.redraw_node = function (node_id, deep, callback, force_draw) {
this.redraw_node = function (obj, deep, callback, force_draw) {
var self = this;
var node = parent.redraw_node.call(this, node_id, deep, callback, force_draw);
if (node) {
var node_id = obj;
var el = parent.redraw_node.call(this, obj, deep, callback, force_draw);
if (el) {
//Check if we have any specific actions for this node

@@ -151,4 +154,4 @@ var actions = this._actions[node_id] || [];

for (var i = 0; i < actions.length; i++) {
var _action = self._create_action(node_id, node, actions[i].id);
self._set_action(node_id, node, _action);
var _action = self._create_action(node_id, actions[i].id);
self._set_action(node_id, el, _action);
}

@@ -159,7 +162,7 @@

for (i = 0; i < actions.length; i++) {
_action = self._create_action("all", node, actions[i].id);
self._set_action(node_id, node, _action);
_action = self._create_action("all", actions[i].id);
self._set_action(node_id, el, _action);
}
}
return node;
return el;
};

@@ -169,2 +172,2 @@

})(jQuery);
})(jQuery);

@@ -1,1 +0,1 @@

!function(t,n){"use strict";t.jstree.defaults.actions=t.noop,t.jstree.plugins.actions=function(t,n){this._actions={},this.add_action=function(t,n){var i=this;t=typeof t===Object?t:[t];for(var a=0;a<t.length;a++){var e=t[a],o=i._actions[e]=i._actions[e]||[];i._has_action(e,n.id)||o.push(n)}this.redraw(!0)},this.remove_action=function(t,n){for(var i=this,a=typeof t===Object?t:"all"===t?Object.keys(this._actions).concat("all"):[t],e=0;e<a.length;e++){t=a[e];for(var o=i._actions[t]||[],r=[],c=0;c<o.length;c++){var s=o[c];s.id!==n&&"all"!==n&&r.push(s)}i._actions[t]=r}this.redraw(!0)},this._create_action=function(t,n,i){var a=this._get_action(t,i);if(null===a)return null;var e=document.createElement("i");return e.className=a["class"],e.textContent=a.text,e.onclick=function(){a.callback(n.id,n,i,e)},{action:a,action_el:e}},this._get_action=function(t,n){for(var i=this._actions[t]||[],a=null,e=0;e<i.length;e++){var o=i[e];o.id===n&&(a=o)}return a},this._set_action=function(t,n,i){if(null!==i){var a=n.querySelector(i.action.selector);i.action.after?a.parentNode.insertBefore(i.action_el,a.nextSibling):n.insertBefore(i.action_el,a)}},this._has_action=function(t,n){var i=!1,a=this._actions;if(a.hasOwnProperty(t))for(var e=0;e<a[t].length;e++)a[t][e].id===n&&(i=!0);if(this._actions.hasOwnProperty("all"))for(e=0;e<a.all.length;e++)a.all[e].id===n&&(i=!0);return i},this.redraw_node=function(t,i,a,e){var o=this,r=n.redraw_node.call(this,t,i,a,e);if(r){for(var c=this._actions[t]||[],s=0;s<c.length;s++){var l=o._create_action(t,r,c[s].id);o._set_action(t,r,l)}for(c=this._actions.all||[],s=0;s<c.length;s++)l=o._create_action("all",r,c[s].id),o._set_action(t,r,l)}return r}}}(jQuery);
!function(t,n){"use strict";t.jstree.defaults.actions=t.noop,t.jstree.plugins.actions=function(t,n){this._actions={},this.add_action=function(t,n){var i=this;t=typeof t===Object?t:[t];for(var a=0;a<t.length;a++){var e=t[a],o=i._actions[e]=i._actions[e]||[];i._has_action(e,n.id)||o.push(n)}this.redraw(!0)},this.remove_action=function(t,n){for(var i=this,a=typeof t===Object?t:"all"===t?Object.keys(this._actions).concat("all"):[t],e=0;e<a.length;e++){t=a[e];for(var o=i._actions[t]||[],r=[],c=0;c<o.length;c++){var s=o[c];s.id!==n&&"all"!==n&&r.push(s)}i._actions[t]=r}this.redraw(!0)},this._create_action=function(t,n){var i=this,a=this._get_action(t,n);if(null===a)return null;var e=document.createElement("i");return e.className=a["class"],e.textContent=a.text,e.onclick=function(){var o=i.get_node(e);a.callback(t,o,n,e)},{action:a,action_el:e}},this._get_action=function(t,n){for(var i=this._actions[t]||[],a=null,e=0;e<i.length;e++){var o=i[e];o.id===n&&(a=o)}return a},this._set_action=function(t,n,i){if(null!==i){var a=n.querySelector(i.action.selector);i.action.after?a.parentNode.insertBefore(i.action_el,a.nextSibling):n.insertBefore(i.action_el,a)}},this._has_action=function(t,n){var i=!1,a=this._actions;if(a.hasOwnProperty(t))for(var e=0;e<a[t].length;e++)a[t][e].id===n&&(i=!0);if(this._actions.hasOwnProperty("all"))for(e=0;e<a.all.length;e++)a.all[e].id===n&&(i=!0);return i},this.redraw_node=function(t,i,a,e){var o=this,r=t,c=n.redraw_node.call(this,t,i,a,e);if(c){for(var s=this._actions[r]||[],l=0;l<s.length;l++){var _=o._create_action(r,s[l].id);o._set_action(r,c,_)}for(s=this._actions.all||[],l=0;l<s.length;l++)_=o._create_action("all",s[l].id),o._set_action(r,c,_)}return c}}}(jQuery);
{
"name": "jstree-actions",
"version": "0.0.13",
"version": "0.1.0",
"description": "jstree plugin that allows adding actions on each node",

@@ -5,0 +5,0 @@ "main": "jstree-actions.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc