UNPKG

automizy-js

Version:

Automizy widget collection

39 lines 1.19 kB
define([], function () { $.fn.removeAttributes = function () { return this.each(function () { var attributes = $.map(this.attributes, function (item) { return item.name; }); var img = $(this); $.each(attributes, function (i, item) { img.removeAttr(item); }); }); } $.fn.getAttributes = function () { var obj = {}; $.each(this[0].attributes, function () { if (this.specified) { obj[this.name] = this.value; } }); return obj; } $.fn.removeClassPrefix = function (prefix) { this.each(function (i, el) { var classes = el.className.split(" ").filter(function (c) { return c.lastIndexOf(prefix, 0) !== 0; }); el.className = $.trim(classes.join(" ")); }); return this; }; $.fn.ashow = function () { this.removeClass('automizy-hide'); return this; }; $.fn.ahide = function () { this.addClass('automizy-hide'); return this; }; });