Skip to content

Commit

Permalink
Plugin to use meta date modified value
Browse files Browse the repository at this point in the history
Datepicker stuff is included was it was not built in the previous commit
  • Loading branch information
nschonni committed Oct 10, 2012
1 parent 7cdafa8 commit 996ddf1
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/js/settings.js
Expand Up @@ -7,7 +7,7 @@ WET-BOEW-Settings
*/
var wet_boew_properties = {
/** global plugins are called via a array of dependency names **/
globals : ['equalize', 'deselectradio', 'css3ie']
globals : ['equalize', 'deselectradio', 'css3ie', 'datemodified']
};

/*
Expand Down
44 changes: 44 additions & 0 deletions src/js/workers/datemodified.js
@@ -0,0 +1,44 @@
/*
* Web Experience Toolkit (WET) / Boîte à outils de l'expérience Web (BOEW)
* wet-boew.github.com/wet-boew/License-eng.txt / wet-boew.github.com/wet-boew/Licence-fra.txt
*/
/*
* Date Modified Plug-in
*/
/*global jQuery: false, pe: false*/
(function ($) {
"use strict";
var _pe = window.pe || {
fn: {}
};
/* local reference */
_pe.fn.datemodified = {
type: 'plugin',
_exec: function (elm) {
var opts,
overrides,
timeholder = $('#gcwu-date-mod dd span time'),
modifiedMeta = document.getElementsByName('dcterms.modified')[0];

// Defaults
opts = {
// Should the Date Modified value be overwritten
updateNonEmpty : false
};

if (typeof wet_boew_datemodified !== 'undefined' && wet_boew_datemodified !== null) {
$.extend(opts, wet_boew_datemodified);
} else {
$.extend(opts);
}

if ( timeholder.text() === '' || opts.updateNonEmpty){
timeholder.text(modifiedMeta.content);
}

return false;
} // end of exec
};
window.pe = _pe;
return _pe;
}(jQuery));

0 comments on commit 996ddf1

Please sign in to comment.