我要取消这个插件:https://financial-calculators.com/calculator-plugins/loan-plugin
但是我想去掉数字后面的小数点。
例如: 10000.00 -> 10000
我用的是台币。
下面是测试页面:https://yuanbaoleasing.com/test/
我该如何解决这个问题?谢谢!
发布于 2022-10-17 03:19:58
插件根fc-loan-calculator\js\interface.LOAN-WIDGET.js
不限制内容。发现
b.formatLocalFloat = function (c, a, e) 并在第一行函数中添加e=0;
b.formatLocalFloat = function (c, a, e) {
e=0;//add this line
.....//rest of the code
}这将浮动值的精度设置为0(请参阅fc-loan-calculator/src/common.LIB.gpl.js文件FC.formatLocalFloat函数以了解)
(将其缩小并保存为interface.LOAN-WIDGET.js)并将其放在子主题或自定义插件dir中。下面的例子是我为定制插件提供的。
在子主题(functions.php)或自定义插件中
add_action( 'wp_footer', 'callback_wp_footer');
function callback_wp_footer() {
wp_deregister_script( 'fc-loan-interface' );
wp_register_script('fc-loan-interface', plugins_url('js/interface.LOAN-WIDGET.js',__FILE__), array( 'jquery', 'wp-i18n', 'fc-custom-bootstrap', 'fc-supporting'), '', true);
wp_enqueue_style('fc-loan-interface');
}确保已编辑的js文件存在于wp_register_script中指定的任何路径中。
(或)
(不推荐使用)。
只需更改插件本身中的js文件(fc-loan-calculator\js\interface.LOAN-WIDGET.js)即可。
希望能帮上忙。
https://stackoverflow.com/questions/74085778
复制相似问题