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.12 to 0.0.13

28

jstree-actions.js

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

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

@@ -85,7 +85,6 @@ if (action === null) return null;

var action_el = document.createElement("i");
var node = this.get_node(action_el);
action_el.className = action.class;
action_el.textContent = action.text;
action_el.onclick = function() {
action.callback(node_id, node, action_id, action_el);
action.callback(node.id, node, action_id, action_el);
};

@@ -112,10 +111,10 @@

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

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

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

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

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

@@ -161,7 +159,7 @@

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

@@ -168,0 +166,0 @@

@@ -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){var i=this._get_action(t,n);if(null===i)return null;var a=document.createElement("i"),e=this.get_node(a);return a.className=i["class"],a.textContent=i.text,a.onclick=function(){i.callback(t,e,n,a)},{action:i,action_el:a}},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);
!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);
{
"name": "jstree-actions",
"version": "0.0.12",
"version": "0.0.13",
"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