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.1.2 to 0.1.3

18

jstree-actions.js

@@ -49,7 +49,7 @@ (function (factory) {

if (!self._has_action(_node_id, action.id)) actions.push(action);
if (!self._has_action(_node_id, action.id)) {
actions.push(action);
this.redraw_node(_node_id);
}
}
//TODO: Redraw only the modified nodes?
this.redraw(true);
};

@@ -84,7 +84,9 @@

}
self._actions[node_id] = new_actions;
var ids = actions.map(function(x) { return x.id; });
var new_ids = new_actions.map(function(x) { return x.id; });
if (ids.length != new_ids.length || ids.filter(function(n) { return new_ids.indexOf(n) === -1; }).length) {
self._actions[node_id] = new_actions;
this.redraw_node(node_id);
}
}
//TODO: Redraw only the modified nodes?
this.redraw(true);
};

@@ -91,0 +93,0 @@

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

!function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],t):"undefined"!=typeof module&&module.exports?module.exports=t(require("jquery")):t(jQuery)}(function(t){"use strict";t.jstree.defaults.actions=t.noop,t.jstree.plugins.actions=function(t,e){this._actions={},this.add_action=function(t,e){var n=this;t=typeof t===Object?t:[t];for(var i=0;i<t.length;i++){var a=t[i],o=n._actions[a]=n._actions[a]||[];n._has_action(a,e.id)||o.push(e)}this.redraw(!0)},this.remove_action=function(t,e){for(var n=this,i=typeof t===Object?t:"all"===t?Object.keys(this._actions).concat("all"):[t],a=0;a<i.length;a++){t=i[a];for(var o=n._actions[t]||[],r=[],c=0;c<o.length;c++){var s=o[c];s.id!==e&&"all"!==e&&r.push(s)}n._actions[t]=r}this.redraw(!0)},this._create_action=function(t,e){var n=this,i=this._get_action(t,e);if(null===i)return null;var a=document.createElement("i");return a.className=i["class"],a.textContent=i.text,a.onclick=function(){var o=n.get_node(a);i.callback(t,o,e,a)},{action:i,action_el:a}},this._get_action=function(t,e){for(var n=this._actions[t]||[],i=null,a=0;a<n.length;a++){var o=n[a];o.id===e&&(i=o)}return i},this._set_action=function(t,e,n){if(null!==n){var i=e.querySelector(n.action.selector);n.action.after?i.parentNode.insertBefore(n.action_el,i.nextSibling):e.insertBefore(n.action_el,i)}},this._has_action=function(t,e){var n=!1,i=this._actions;if(i.hasOwnProperty(t))for(var a=0;a<i[t].length;a++)i[t][a].id===e&&(n=!0);if(this._actions.hasOwnProperty("all"))for(a=0;a<i.all.length;a++)i.all[a].id===e&&(n=!0);return n},this.redraw_node=function(t,n,i,a){var o=this,r="object"==typeof t?t.id:t,c=e.redraw_node.call(this,t,n,i,a);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}}});
!function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],t):"undefined"!=typeof module&&module.exports?module.exports=t(require("jquery")):t(jQuery)}(function(t){"use strict";t.jstree.defaults.actions=t.noop,t.jstree.plugins.actions=function(t,n){this._actions={},this.add_action=function(t,n){var e=this;t="object"==typeof t?t:[t];for(var i=0;i<t.length;i++){var o=t[i],a=e._actions[o]=e._actions[o]||[];e._has_action(o,n.id)||(a.push(n),this.redraw_node(o))}},this.remove_action=function(t,n){for(var e=this,i="object"==typeof t?t:"all"===t?Object.keys(this._actions).concat("all"):[t],o=0;o<i.length;o++){t=i[o];for(var a=e._actions[t]||[],r=[],c=0;c<a.length;c++){var s=a[c];s.id!==n&&"all"!==n&&r.push(s)}var l=a.map(function(t){return t.id}),f=r.map(function(t){return t.id});(l.length!=f.length||l.filter(function(t){return-1===f.indexOf(t)}).length)&&(e._actions[t]=r,this.redraw_node(t))}},this._create_action=function(t,n){var e=this,i=this._get_action(t,n);if(null===i)return null;var o=document.createElement("i");return o.className=i["class"],o.textContent=i.text,o.onclick=function(){var a=e.get_node(o);i.callback(t,a,n,o)},{action:i,action_el:o}},this._get_action=function(t,n){for(var e=this._actions[t]||[],i=null,o=0;o<e.length;o++){var a=e[o];a.id===n&&(i=a)}return i},this._set_action=function(t,n,e){if(null!==e){var i=n.querySelector(e.action.selector);e.action.after?i.parentNode.insertBefore(e.action_el,i.nextSibling):n.insertBefore(e.action_el,i)}},this._has_action=function(t,n){var e=!1,i=this._actions;if(i.hasOwnProperty(t))for(var o=0;o<i[t].length;o++)i[t][o].id===n&&(e=!0);if(this._actions.hasOwnProperty("all"))for(o=0;o<i.all.length;o++)i.all[o].id===n&&(e=!0);return e},this.redraw_node=function(t,e,i,o){var a=this,r="object"==typeof t?t.id:t,c=n.redraw_node.call(this,t,e,i,o);if(c){for(var s=this._actions[r]||[],l=0;l<s.length;l++){var f=a._create_action(r,s[l].id);a._set_action(r,c,f)}for(s=this._actions.all||[],l=0;l<s.length;l++)f=a._create_action("all",s[l].id),a._set_action(r,c,f)}return c}}});
{
"name": "jstree-actions",
"version": "0.1.2",
"version": "0.1.3",
"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