XKit-Rewritten
XKit-Rewritten copied to clipboard
Standardize text preference processing
Description
Standardizes all preferences using text inputs to ignore case and strip hashtags. Currently, Hide Avatars, Show Originals, and Themed Posts do not ignore case, and Quick Reblog, Tag Replacer, Painter, and Cleanfeed ignore case and strip hashtags.
Resolves #1188 and #982
Currently, case sensitivity is standardized, but I haven't handled stripping hashtags yet. For that, I imagine an event listener will have to be added to render_scripts.js
that replaces hashtag characters in the input area on input, similar to how Quick Reblog and Quick Tags replace quotes with smart quotes as mentioned in #982, something like:
...
const stripTags = ({ target }) => {
const { value } = target.value;
target.value = value.replace(/#/g, '');
};
...
const renderPreferences = async function ({ scriptName, preferences, preferenceList }) {
...
switch (preference.type) {
...
case 'textarea':
...
preferenceInput.addEventListener('input', stripTags);
break;
...
}
...
};