"Colin Turner" <ct@piglets.com> wrote in message [🔎] 498D8AF3.7030903@piglets.com">news:[🔎] 498D8AF3.7030903@piglets.com...
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi All, I hope you can help and advise on this issue. I am packaging a web application for Debian, I am also the principal upstream author. The code is generally GPL v2 PHP. Over the years the project inherited, froma side project, a small fragment of Javascript that has no explicit license.The problem I have is that the code is, like so much JS, sitting available, apparently for general consumption on several websites. I have been unable to acquire a license from any of the authors (no reply to emails) and the code is so astonishingly trivial it's hard to see how it could possibly be re-implemented without it being the same code with different variable names. Any guidance on what I should do? The functionality the code provides (counting and capping characters in textareas) is quite useful and losing it would probably cause dataloss in use of the application. CT. Code follows... // Use one function for multiple text areas on a page // Limit the number of characters per textarea
Here, is a clean room implmentation of a drop-in compatible (same argument order) function that will do the job.
function functionName(textObject,sizeRemainingObject,maxSize) { textObject.value=textObject.value.substring(0,maxSize); sizeRemainingObject.value=maxSize-textObject.value.length; }Compared to the above it works the same, except that the second parameter will always be updated, to the number of characters remaining. Seeing as this appears to be intended to limit the size of text input in a textarea, while visually displaying the number of characters left in something else, that should be fine.
(Yes I've checked, and substring does the right thing here).This new version is the very definition of a function too trivial to copyright, even the variable names and whitespaceing are as non-creative as possible. (Although I would recomend reformatting the whitespace used to be more readable).
Use it and be happy.Joe Smith