(function(b){b.extend({metadata:{defaults:{type:"class",name:"metadata",cre:/({.*})/,single:"metadata"},setType:function(a,b){this.defaults.type=a;this.defaults.name=b},get:function(a,h){var c=b.extend({},this.defaults,h);c.single.length||(c.single="metadata");var d=b.data(a,c.single);if(d)return d;var d="{}",g=function(a){return"string"!=typeof a?a:a=eval("("+a+")")};if("html5"==c.type){var f={};b(a.attributes).each(function(){var a=this.nodeName;if(a.match(/^data-/))a=a.replace(/^data-/,"");else return!0;
f[a]=g(this.nodeValue)})}else{if("class"==c.type){var e=c.cre.exec(a.className);e&&(d=e[1])}else if("elem"==c.type){if(!a.getElementsByTagName)return;e=a.getElementsByTagName(c.name);e.length&&(d=b.trim(e[0].innerHTML))}else void 0!=a.getAttribute&&(e=a.getAttribute(c.name))&&(d=e);f=g(0>d.indexOf("{")?"{"+d+"}":d)}b.data(a,c.single,f);return f}}});b.fn.metadata=function(a){return b.metadata.get(this[0],a)}})(jQuery);
