!function($,window){$.extend({metadata:{defaults:{type:"class",name:"metadata",cre:/({.*})/,single:"metadata"},setType:function(t,e){this.defaults.type=t,this.defaults.name=e},get:function(elem,opts){var settings=$.extend({},this.defaults,opts),object={},data,match,attr;if(settings.single.length||(settings.single="metadata"),data=$.data(elem,settings.single),data)return data;function getObject(data){return"string"==typeof data&&(data=eval("("+data+")")),data}if(data="{}","html5"==settings.type)$(elem.attributes).each((function(){var t=this.nodeName;t.match(/^data-/)&&(t=t.replace(/^data-/,""),object[t]=this.nodeValue)}));else{if("class"==settings.type)match=settings.cre.exec(elem.className),match&&(data=match[1]);else if("elem"==settings.type){if(!elem.getElementsByTagName)return;match=elem.getElementsByTagName(settings.name),match.length&&(data=$.trim(match[0].innerHTML))}else void 0!==elem.getAttribute&&(attr=elem.getAttribute(settings.name),attr&&(data=attr));object=getObject(data.indexOf("{")<0?"{"+data+"}":data)}return"{}"!==data&&$.data(elem,settings.single,object),object}}}),$.fn.metadata=function(t){return $.metadata.get(this[0],t)}}(jQuery,this);
