PageSourceSearch

https://www.lanuovasavona.it/fileadmin/layout/common/js/jquery.metadata.js

js lanuovasavona.it collected 2026-10-03 01:02:25 UTC 2,408 bytes, 86 lines download raw bytes

1(function($) {
2
3$.extend({
4  metadata : {
5    defaults : {
6      type: 'class',
7      name: 'metadata',
8      cre: /({.*})/,
9      single: 'metadata'
10    },
11    setType: function( type, name ){
12      this.defaults.type = type;
13      this.defaults.name = name;
14    },
15    get: function( elem, opts ){
16      var settings = $.extend({},this.defaults,opts);
17      // check for empty string in single property
18      if ( !settings.single.length ) settings.single = 'metadata';
19      
20      var data = $.data(elem, settings.single);
21      // returned cached data if it already exists
22      if ( data ) return data;
23      
24      data = "{}";
25      
26      var getData = function(data) {
27        if(typeof data != "string") return data;
28        
29        if( data.indexOf('{') < 0 ) {
30          data = eval("(" + data + ")");
31        }
32      }
33      
34      var getObject = function(data) {
35        if(typeof data != "string") return data;
36        
37        data = eval("(" + data + ")");
38        return data;
39      }
40      
41      if ( settings.type == "html5" ) {
42        var object = {};
43        $( elem.attributes ).each(function() {
44          var name = this.nodeName;
45          if(name.match(/^data-/)) name = name.replace(/^data-/, '');
46          else return true;
47          object[name] = getObject(this.nodeValue);
48        });
49      } else {
50        if ( settings.type == "class" ) {
51          var m = settings.cre.exec( elem.className );
52          if ( m )
53            data = m[1];
54        } else if ( settings.type == "elem" ) {
55          if( !elem.getElementsByTagName ) return;
56          var e = elem.getElementsByTagName(settings.name);
57          if ( e.length )
58            data = $.trim(e[0].innerHTML);
59        } else if ( elem.getAttribute != undefined ) {
60          var attr = elem.getAttribute( settings.name );
61          if ( attr )
62            data = attr;
63        }
64        object = getObject(data.indexOf("{") < 0 ? "{" + data + "}" : data);
65      }
66      
67      $.data( elem, settings.single, object );
68      return object;
69    }
70  }
71});
72
73/**
74 * Returns the metadata object for the first member of the jQuery object.
75 *
76 * @name metadata
77 * @descr Returns element's metadata object
78 * @param Object opts An object contianing settings to override the defaults
79 * @type jQuery
80 * @cat Plugins/Metadata
81 */
82$.fn.metadata = function( opts ){
83  return $.metadata.get( this[0], opts );
84};
85
86})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.