add campaign tracking plugin
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
function initMetabox(){
|
||||
console.log("** initMetabox **");
|
||||
|
||||
var dateFormat = "yy-mm-dd",
|
||||
from = $( "#campaign_start_date" )
|
||||
.datepicker({
|
||||
dateFormat: dateFormat
|
||||
})
|
||||
.on( "change", function() {
|
||||
to.datepicker( "option", "minDate", getDate( this ) );
|
||||
}),
|
||||
to = $( "#campaign_end_date" ).datepicker({
|
||||
dateFormat: dateFormat
|
||||
}).on( "change", function() {
|
||||
from.datepicker( "option", "maxDate", getDate( this ) );
|
||||
});
|
||||
|
||||
function getDate( element ) {
|
||||
var date;
|
||||
try {
|
||||
date = $.datepicker.parseDate( dateFormat, element.value );
|
||||
} catch( error ) {
|
||||
date = null;
|
||||
}
|
||||
|
||||
return date;
|
||||
}
|
||||
}
|
||||
|
||||
if($ == undefined){
|
||||
window.$ = jQuery.noConflict();
|
||||
}
|
||||
|
||||
$(function(){
|
||||
initMetabox();
|
||||
});
|
||||
Reference in New Issue
Block a user