Skip to content
Browse files

schema.org/Book and schema.org/CreativeWork types has been added

  • Loading branch information...
1 parent 674c909 commit 178c3218c244dc7965947f4af9bbb7706f8fd090 @umurgdk umurgdk committed May 21, 2013
Showing with 69 additions and 3 deletions.
  1. +4 −2 jquery.microdata.js
  2. +65 −1 schemas.js
View
6 jquery.microdata.js
@@ -44,7 +44,9 @@
// TODO: check three-letter ISO code for currency: http://www.iso.org/iso/support/faqs/faqs_widely_used_standards/widely_used_standards_other/currency_codes.htm
currency: function(value, el) { return (/^[a-zA-Z]{3}$/).test(value); },
- any: function(value, el) { return true; }
+ any: function(value, el) { return true; },
+
+ boolean: function(value, el) { return (/(True|False)/).test(value); }
},
@@ -248,4 +250,4 @@
// init the drop-in script
$(init);
-})(jQuery);
+})(jQuery);
View
66 schemas.js
@@ -175,6 +175,70 @@
{ name: "reviews", required: false, type: "complex", validator: validators.complex } // child elements of Review
])
});
+ schemaOrg.push({
+ url: "http://schema.org/CreativeWork",
+ fields: extend(findByUrl(schemaOrg, "http://schema.org/Thing"), [
+ {name: "about", required: false, type: "complex", validator: validators.text },
+ {name: "accountablePerson", required: false, type: "complex", validator: validators.text },
+ {name: "aggregateRating", required: false, type: "complex", validator: validators.text },
+ {name: "alternativeHeadline", required: false, type: "text", validator: validators.text },
+ {name: "associatedMedia", required: false, type: "complex", validator: validators.text },
+ {name: "audience", required: false, type: "complex", validator: validators.text },
+ {name: "audio", required: false, type: "complex", validator: validators.complex },
+ {name: "author", required: false, type: "complex", validator: validators.complex },
+ {name: "award", required: false, type: "text", validator: validators.text },
+ {name: "awards", required: false, type: "text", validator: validators.text },
+ {name: "comment", required: false, type: "complex", validator: validators.complex },
+ {name: "contentLocation", required: false, type: "complex", validator: validators.complex },
+ {name: "contentRating", required: false, type: "text", validator: validators.text },
+ {name: "contributor", required: false, type: "complex", validator: validators.complex },
+ {name: "copyrightHolder", required: false, type: "complex", validator: validators.complex },
+ {name: "copyrightYear", required: false, type: "number", validator: validators.number },
+ {name: "creator", required: false, type: "complex", validator: validators.complex },
+ {name: "dateCreated", required: false, type: "datetime", validator: validators.datetime },
+ {name: "dateModified", required: false, type: "datetime", validator: validators.datetime },
+ {name: "datePublished", required: false, type: "datetime", validator: validators.datetime },
+ {name: "discussionUrl", required: false, type: "url", validator: validators.url },
+ {name: "editor", required: false, type: "complex", validator: validators.complex },
+ {name: "educationalAlignment", required: false, type: "complex", validator: validators.complex },
+ {name: "educationalUse", required: false, type: "text", validator: validators.text },
+ {name: "encoding", required: false, type: "complex", validator: validators.complex },
+ {name: "encodings", required: false, type: "complex", validator: validators.complex },
+ {name: "genre", required: false, type: "text", validator: validators.text },
+ {name: "headline", required: false, type: "text", validator: validators.text },
+ {name: "inLanguage", required: false, type: "text", validator: validators.text },
+ {name: "interactionCount", required: false, type: "text", validator: validators.text },
+ {name: "interactivityType", required: false, type: "text", validator: validators.text },
+ {name: "isBasedOnUrl", required: false, type: "url", validator: validators.url },
+ {name: "isFamilyFriendly", required: false, type: "boolean", validator: validators.boolean },
+ {name: "keywords", required: false, type: "text", validator: validators.text },
+ {name: "learningResourceType", required: false, type: "text", validator: validators.text },
+ {name: "mentions", required: false, type: "complex", validator: validators.complex },
+ {name: "offers", required: false, type: "complex", validator: validators.complex },
+ {name: "provider", required: false, type: "complex", validator: validators.complex },
+ {name: "publisher", required: false, type: "complex", validator: validators.complex },
+ {name: "publishingPrinciples", required: false, type: "url", validator: validators.url },
+ {name: "review", required: false, type: "complex", validator: validators.complex },
+ {name: "reviews", required: false, type: "complex", validator: validators.complex },
+ {name: "sourceOrganization", required: false, type: "complex", validator: validators.complex },
+ {name: "text", required: false, type: "text", validator: validators.text },
+ {name: "thumbnailUrl", required: false, type: "url", validator: validators.url },
+ {name: "timeRequired", required: false, type: "duration", validator: validators.duration },
+ {name: "typicalAgeRange", required: false, type: "text", validator: validators.text },
+ {name: "version", required: false, type: "number", validator: validators.number },
+ {name: "video" , required: false, type: "complex", validator: validators.complex }
+ ])
+ });
+ schemaOrg.push({
+ url: "http://schema.org/Book",
+ fields: extend(findByUrl(schemaOrg, "http://schema.org/CreativeWork"), [
+ { name: "bookEdition", required: false, type: "text", validator: validators.text },
+ { name: "bookFormat", required: false, type: "complex", validator: validators.complex },
+ { name: "illustrator", required: false, type: "complex", validator: validators.complex },
+ { name: "isbn", required: false, type: "text", validator: validators.text },
+ { name: "numberOfPages", required: false, type: "int", validator: validators.int }
+ ])
+ });
schemaOrg.push({
url: "http://schema.org/Person",
fields: extend(findByUrl(schemaOrg, "http://schema.org/Thing"), [
@@ -240,4 +304,4 @@
for (var i = 0; i < schemaOrg.length; i++) {
$.microdata.addDefinition(schemaOrg[i].url, schemaOrg[i].fields);
}
-})(jQuery);
+})(jQuery);

0 comments on commit 178c321

Please sign in to comment.
Something went wrong with that request. Please try again.