attr-macro.min.js 615 B

1
  1. Macro.add(["id","style","class","attr"],{skipArgs:!1,tags:null,handler:function(){if(this.args[0]){let a=$("<div>").wiki(this.payload[0].contents.trim()).children();if("class"==this.name)a.first().addClass(this.args[0]);else if(!("attr"==this.name))a.first().attr(this.name,this.args[0]);else if(0==this.args.length%2)for(let b=0;b<this.args.length;b+=2)a.first().attr(this.args[b],this.args[b+1]);else return this.error("You must specify pairs of attribute names and values you wish to add");jQuery(this.output).append(a)}else return this.error("You must specify the content for the attribute you wish to add")}});