-
Notifications
You must be signed in to change notification settings - Fork 2
/
guessUnicodePunctuation.js
26 lines (22 loc) · 1.15 KB
/
guessUnicodePunctuation.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/**
* Supports the same fields as the userscript but without language detection and granular control over the affected fields.
*/
import { transformationRulesToPreserveMarkup } from '../guessUnicodePunctuation.js';
import { $transformInputValues } from '@kellnerd/es-utils/dom/transformInputValues.js';
import { punctuationRules } from '@kellnerd/es-utils/string/punctuation.js';
const titleInputSelectors = [
'input#name', // release title (release editor)
'input#comment', // release disambiguation comment (release editor)
'input.track-name', // all track titles (release editor)
'input[id^=medium-title]', // all medium titles (release editor)
'input[name$=name]', // entity name (edit pages)
'input[name$=comment]', // entity disambiguation comment (edit pages)
];
const textareaSelectors = [
'#annotation', // release annotation (release editor)
'#edit-note-text', // edit note (release editor)
'textarea[name$=text]', // annotation (edit annotation pages)
'.edit-note', // edit note (edit pages)
];
$transformInputValues(titleInputSelectors.join(), punctuationRules);
$transformInputValues(textareaSelectors.join(), transformationRulesToPreserveMarkup);