Page MenuHomePhabricator

Add support for a filter callback function in jQuery byteLimit plugin
Closed, ResolvedPublic

Description

As title says.


Version: unspecified
Severity: normal

Details

Reference
bz29455

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:38 PM
bzimport set Reference to bz29455.

Presumably callback would ping on "too much stuff, ain't gonna add more"; would it just notify or would it try to pass in some kind of specific information?

Last I looked, the byteLimit thing only operates on keypress or some such, so it also may need to be expanded to handle paste and other kinds of operations, which presumably wouldn't have key or character values to pass through in the same way.

Ok, bug 29454 seems to request some way to filter the input string before the length check...? Would that cover the text before the new change, or after? Some newly added strings would make the string longer, while others might not.

The callback would called on the text that byteLength is currently processing. At, say, line 48 [1]

The example use case for bug 29454 would be filtering away a namespace prefix, so that the limit enforces only part of the input and not the entire html input field. That way we are enforcing 255 bytes on page_title to the front-end. Right now this would require moving the namespace to a seperate input field.

Krinkle

http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/resources/jquery/jquery.byteLimit.js?revision=86982&view=markup#l48

PS: Come to think of it, creating a dropdown menu with namespaces on Special:Move and having only the page title in the input field does sound like a good thing to do...