45 lines
1.6 KiB
JavaScript
Executable File
45 lines
1.6 KiB
JavaScript
Executable File
/*
|
|
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
|
|
* Copyright (C) DevCode s.n.c.
|
|
*
|
|
* 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 3 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. If not, see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
Number.prototype.formatMoney = function (c, d, t) {
|
|
var n = this,
|
|
c = isNaN(c = Math.abs(c)) ? 2 : c,
|
|
d = d == undefined ? "." : d,
|
|
t = t == undefined ? "," : t,
|
|
s = n < 0 ? "-" : "",
|
|
i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "",
|
|
j = (j = i.length) > 3 ? j % 3 : 0;
|
|
|
|
return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
|
|
};
|
|
|
|
String.prototype.toEnglish = function () {
|
|
return numeral(this.toString()).value();
|
|
};
|
|
|
|
Number.prototype.toLocale = function () {
|
|
return numeral(this).format();
|
|
};
|
|
|
|
jQuery.fn.scrollTo = function (elem, speed) {
|
|
$(this).animate({
|
|
scrollTop: $(this).scrollTop() - $(this).offset().top + $(elem).offset().top
|
|
}, speed == undefined ? 1000 : speed);
|
|
return this;
|
|
};
|