Project Summary

  Analyzed 4 days ago based on code collected 4 days ago.

Quietly extract JSON metadata contained within DOM elements.

Ported from jQuery: http://code.google.com/p/jqueryjs/source/browse/#svn/tags/plugins/metadata/2.0 Basic Usage1. Include the scripts required:

2. Store the data in DOM elements

This is p1

This is p2

{item_id: 3, item_label: 'Label 3'}This is p3

3. Retrieve using metadata

var dom = YAHOO.util.Dom;
var metadata = YAHOO.plugin.Metadata;

metadata.setType("class");
document.write( metadata.get( dom.get("one") ).item_id + ", " + metadata.get( dom.get("one") ).item_label + "
");

metadata.setType("attr", "data");
document.write( metadata.get( dom.get("two") ).item_id + ", " + metadata.get( dom.get("two") ).item_label + "
");

metadata.setType("elem", "script");
document.write( metadata.get( dom.get("three") ).item_id + ", " + metadata.get( dom.get("three") ).item_label + "
");Using YUI Loader

var loader = new YAHOO.util.YUILoader({

onSuccess: function() {

var dom = YAHOO.util.Dom;
var metadata = YAHOO.plugin.Metadata;

// do something with metadata
}
});

loader.addModule({
name: "metadata",
type: "js",
fullpath: "http://yui-metadata.googlecode.com/svn/trunk/yui-metadata/metadata-min.js",
varName: "YAHOO.plugin.Metadata",
requires: ['yahoo', 'dom']
});

loader.require("metadata");
loader.insert();

Documentions and demoPlease view the source code of this link: http://labs.xddnet.com/yui-metadata/example/example.html

ContactFeedback and suggestions are always welcome, you can reach me at tszming at gmail dot com.

Share

In a Nutshell, yui-metadata...

Languages

JavaScript
96%
2 Other
4%
 
 

Lines of Code

 

Activity

30 Day Summary Apr 19 2013 — May 19 2013

12 Month Summary May 19 2012 — May 19 2013

Community

Ratings

Be the first to rate this project
 
Click to add your rating
 
Review this Project!
 
 
 

Creative Commons License Copyright © 2013 Black Duck Software, Inc. and its contributors, Some Rights Reserved. Unless otherwise marked, this work is licensed under a Creative Commons Attribution 3.0 Unported License . Ohloh ® and the Ohloh logo are trademarks of Black Duck Software, Inc. in the United States and/or other jurisdictions. All other trademarks are the property of their respective holders.