Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

a-template

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

a-template - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

39

index.js

@@ -9,2 +9,4 @@ /**

var objs = [];
var eventType = "input click change keydown contextmenu mouseup mousedown mousemove";
var dataAction = eventType.replace(/([a-z]+)/g,"[data-action-$1],") + "[data-action]";
var getObjectById = (id) => {

@@ -52,18 +54,33 @@ for (var i = 0, n = objs.length; i < n; i++) {

});
$(document).on("input click change keydown", "[data-action]", function(e) {
if (e.type == "click" && $(e.target).is("select")) {
$(document).on(eventType,dataAction,function(e){
if(e.type == "click" && $(e.target).is("select")){
return;
}
if (e.type == "input" && $(e.target).attr("type") == "button") {
if(e.type == "input" && $(e.target).attr("type") == "button"){
return;
}
var string = $(this).data("action");
var action = string.replace(/\(.*?\);?/, "");
var parameter = string.replace(/(.*?)\((.*?)\);?/, "$2");
var pts = parameter.split(","); //引き数
var id = $(this).parents("[data-id]").data("id");
if (id) {
var obj = getObjectById(id);
var events = eventType.split(" ");
var $self = $(this);
var action = "action";
events.forEach(function(event){
if ($self.data("action-"+event)) {
if(e.type === event){
action += "-"+event;
}
}
});
var string = $self.data(action);
if(!string){
return;
}
var action = string.replace(/\(.*?\);?/,"");
var parameter = string.replace(/(.*?)\((.*?)\);?/,"$2");
var pts = parameter.split(",");//引き数
var id = $self.parents("[data-id]").data("id");
if(id){
var obj = aTemplate.getObjectById(id);
obj.e = e;
if(obj[action]){
if(obj.method && obj.method[action]){
obj.method[action].apply(obj,pts);
}else if(obj[action]){
obj[action].apply(obj,pts);

@@ -70,0 +87,0 @@ }

{
"name": "a-template",
"version": "0.0.1",
"version": "0.0.2",
"scripts": {

@@ -5,0 +5,0 @@ "build": "browserify ./index.js -t [ babelify --presets [ es2015 ] browserify-shim ] --standalone aTemplate --outfile ./lib/a-template.js",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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