etFunctions

A library to be used with Joe's EditorTools for Popmundo

Ce script ne devrait pas être installé directement. C'est une librairie créée pour d'autres scripts. Elle doit être inclus avec la commande // @require https://update.greasyforks.org/scripts/10938/61695/etFunctions.js

// Translation labels object
var _etChanged = false;

function etBeforeUnload(){
    if( _etChanged === false ) return true;    
    return confirm( "You have unsaved content. Are you sure you want to leave?" );
}

function etOnSubmit(){
    if( _etChanged === false ) return true;
    return confirm( "You have unsaved content. Are you sure you want to change the article state?" );
}


// Return tomorrow's date at 11:00 time
function etGetDate(){
    
    var currentDate = new Date();
    currentDate = new Date( new Date().getTime() + 24 * 60 * 60 * 1000 );
    
    var year = currentDate.getFullYear();
	var month = (currentDate.getMonth() + 1) < 10 ? '0' + ( currentDate.getMonth() + 1 ) : ( currentDate.getMonth() + 1 );
	var day = currentDate.getDate() < 10 ? '0' + currentDate.getDate() : currentDate.getDate();
    var hour = '11';
    var minutes = '00';
	
	return year + '-' + month + '-' + day + ' ' + hour + ':' + minutes;

}

// Change the date text value if it's empty
function etChangeDate( objectId ){
	var obj = document.getElementById( objectId );
	if( obj.value.length >= 1 ) return;
	obj.value = etGetDate(); 
	obj.setAttribute( "value", etGetDate() );
}
长期地址
遇到问题?请前往 GitHub 提 Issues。