etFunctions: a library for Joe's EditorTools

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

Verze ze dne 13. 07. 2015. Zobrazit nejnovější verzi.

Tento skript by neměl být instalován přímo. Jedná se o knihovnu, kterou by měly jiné skripty využívat pomocí meta příkazu // @require https://update.greasyfork.org/scripts/10938/61694/etFunctions%3A%20a%20library%20for%20Joe%27s%20EditorTools.js

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name            etFunctions: a library for Joe's EditorTools
// @namespace       http://popmundo-diaries.com/
// Author	    Joe Isaacs CharId #3248185 <[email protected]>
// @description     A library to be used with Joe's EditorTools for Popmundo
// @version         1.0
// ==/UserScript==

// 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() );
}