(($) => {
$.plugin('attr', function(attribute, value) {
if (!attribute) { return this; }
if (value === undefined) {
try {
return (JSON.parse(this[0].getAttribute(attribute)));
} catch (e) {
return (this[0].getAttribute(attribute));
}
}
this.each((el) => {
el.setAttribute(attribute, value);
});
});
})(collector);