Math.trunc() not work in IE

Internet Explorer not support Math.trunc() function. Because of this, changing fields does not work in IE.
Instead of a function Math.trunc(), you can use the Math.floor()
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/trunc
This commit is contained in:
Stanislav Koleda 2020-05-13 20:29:51 +07:00 committed by GitHub
parent e968ee7499
commit 5be575a324
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -213,7 +213,7 @@ class DetailsIssueHooks < Redmine::Hook::ViewListener
o << "<script>"
o << "//<![CDATA[\n"
o << " function resizeTitleInput() {\n"
o << " $('#TitleInput input')[0].size = Math.max(50, Math.trunc(window.innerWidth / 11));\n"
o << " $('#TitleInput input')[0].size = Math.max(50, Math.floor(window.innerWidth / 11));\n"
o << " }\n"
o << " resizeTitleInput();\n"
o << " window.addEventListener('resize', resizeTitleInput);\n"