/*
* @title YAPC> _
* @description Yet Another Poem Comment
* @include http://doraperson2015.yapcasia.org/*
* @license MIT License http://opensource.org/licenses/MIT
* @javascript_url
*/
// e.g.
// http://doraperson2015.yapcasia.org/
(function () {
// $x('/html/head/comment()[2]')
var poem = document.createNodeIterator(document.head, NodeFilter.SHOW_COMMENT, {
acceptNode: function (node) {
// reject Conditional Comment (aka Version Vector)
return /^\[/.test(node.data) ?
NodeFilter.FILTER_REJECT :
NodeFilter.FILTER_ACCEPT;
}
}).nextNode().textContent;
window.alert([
document.lastModified.split(' ').pop(),
'yapcasia:',
poem
].join(' '));
})();
// c.f.
// https://developer.mozilla.org/en-US/docs/Web/API/NodeIterator
// https://developer.mozilla.org/en-US/docs/Web/API/NodeFilter
// https://developer.mozilla.org/en-US/docs/Web/API/NodeFilter/acceptNode
// http://en.wikipedia.org/wiki/Regular_expression#Character_classes
// if possible, RegExp replace to POSIX [:punct:]|[:alnum:] in the future