<?php
/****************************************************************************************
 * SMI (Services Maintenance Interventions) est une gestion libre de maintenance et de SAV
 *
 * Version 1.0.4
 *
 * Copyright (C) 2006-2016  Sylvain FATOME
 * This program is free software; you can redistribute it and/or modify it under the terms
 * of the GNU General Public License as published by the Free Software Foundation;
 * either version 2 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with this program
 * (in the directory docs);
 * if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA  02110-1301, USA.
 *
 * Contact : galawa@free.fr
 *
 * Web : http://smi.no-ip.org
 ****************************************************************************************/

?>
$.calculator.setDefaults ({
    showOn: 'operator', isOperator: chk_operateurs,
    closeText: '<?php echo _('Fermer'); ?>', closeStatus: '<?php echo _('Fermer la calculatrice'); ?>',
    useText: '<?php echo _('Choisir'); ?>', useStatus: '<?php echo _('Utiliser la valeur actuelle'); ?>',
    eraseText: '<?php echo _('Effacer'); ?>', eraseStatus: '<?php echo _('Effacer la valeur'); ?>',
    backspaceText: 'DF', backspaceStatus: '<?php echo _('Effacer le dernier chiffre'); ?>',
    clearErrorText: 'CE', clearErrorStatus: '<?php echo _('Effacer le dernier nombre'); ?>',
    clearText: 'CT', clearStatus: '<?php echo _('Réinitialiser la calculatrice'); ?>',
    memClearText: 'MD', memClearStatus: '<?php echo _('Vider la mémoire'); ?>',
    memRecallText: 'MS', memRecallStatus: '<?php echo _('Récupérer la valeur de la mémoire'); ?>',
    memStoreText: 'MC', memStoreStatus: '<?php echo _('Sauvegarder la valeur dans la mémoire'); ?>',
    memAddText: 'M+', memAddStatus: '<?php echo _('Ajouter à la mémoire'); ?>',
    memSubtractText: 'M-', memSubtractStatus: '<?php echo _('Supprimer de la mémoire'); ?>',
    base2Text: 'Bin', base2Status: '<?php echo _('Conversion en binaire'); ?>',
    base8Text: 'Oct', base8Status: '<?php echo _('Conversion en octal'); ?>',
    base10Text: 'Déc', base10Status: '<?php echo _('Conversion en décimal'); ?>',
    base16Text: 'Hex', base16Status:  '<?php echo _('Conversion en hexadécimal'); ?>',
    degreesText: 'Deg', degreesStatus: '<?php echo _('Conversion en degrés'); ?>',
    radiansText: 'Rad', radiansStatus: '<?php echo _('Conversion en radians'); ?>'
});

function chk_operateurs(ch, event, value, base, decimalChar) {
    return '+-*/'.indexOf(ch) > -1 && !(ch === '-' && value === '');
}