mirror of
https://github.com/elder-plinius/P4RS3LT0NGV3.git
synced 2026-05-25 17:37:52 +02:00
dc10a90851
- Implement tool registry system with individual tool modules - Reorganize transformers into categorized source modules - Remove emojiLibrary.js, consolidate into EmojiUtils and emojiData - Fix mobile close button and tooltip functionality - Add build system for transforms and emoji data - Migrate from Python backend to pure JavaScript - Add comprehensive documentation and testing - Improve code organization and maintainability - Ignore generated files (transforms-bundle.js, emojiData.js)
31 lines
831 B
JavaScript
31 lines
831 B
JavaScript
// url transform
|
|
import BaseTransformer from '../BaseTransformer.js';
|
|
|
|
export default new BaseTransformer({
|
|
name: 'URL Encode',
|
|
priority: 40,
|
|
// Detector: Look for %XX pattern (URL encoding)
|
|
detector: function(text) {
|
|
return text.includes('%') && /%[0-9A-Fa-f]{2}/.test(text);
|
|
},
|
|
|
|
func: function(text) {
|
|
try {
|
|
return encodeURIComponent(text);
|
|
} catch (e) {
|
|
// Catch malformed Unicode or unpaired surrogates
|
|
return '[Invalid input]';
|
|
}
|
|
},
|
|
preview: function(text) {
|
|
return this.func(text);
|
|
},
|
|
reverse: function(text) {
|
|
try {
|
|
return decodeURIComponent(text);
|
|
} catch (e) {
|
|
return text;
|
|
}
|
|
}
|
|
|
|
}); |