View | Details | Raw Unified | Return to bug 26011
Collapse All | Expand All

(-)a/koha-tmpl/opac-tmpl/bootstrap/lib/jquery/plugins/jquery.metadata.min.js (-9 lines)
Lines 1-8 Link Here
1
(function($){$.extend({metadata:{defaults:{type:'class',name:'metadata',cre:/({.*})/,single:'metadata'},setType:function(type,name){this.defaults.type=type;this.defaults.name=name;},get:function(elem,opts){var settings=$.extend({},this.defaults,opts);if(!settings.single.length)settings.single='metadata';var data=$.data(elem,settings.single);if(data)return data;data="{}";var getData=function(data){if(typeof data!="string")return data;if(data.indexOf('{')<0){data=eval("("+data+")");}}
2
var getObject=function(data){if(typeof data!="string")return data;data=eval("("+data+")");return data;}
3
if(settings.type=="html5"){var object={};$(elem.attributes).each(function(){var name=this.nodeName;if(name.match(/^data-/))name=name.replace(/^data-/,'');else return true;object[name]=getObject(this.nodeValue);});}else{if(settings.type=="class"){var m=settings.cre.exec(elem.className);if(m)
4
data=m[1];}else if(settings.type=="elem"){if(!elem.getElementsByTagName)returnvar;e=elem.getElementsByTagName(settings.name);if(e.length)
5
data=$.trim(e[0].innerHTML);}else if(elem.getAttribute!=undefined){var attr=elem.getAttribute(settings.name);if(attr)
6
data=attr;}
7
object=getObject(data.indexOf("{")<0?"{"+data+"}":data);}
8
$.data(elem,settings.single,object);return object;}}});$.fn.metadata=function(opts){return $.metadata.get(this[0],opts);};})(jQuery);
9
- 

Return to bug 26011