Skip to content

Commit

Permalink
Merge pull request #1 from ndrake/more-stuff
Browse files Browse the repository at this point in the history
Added bubble, mirror, tiny caps and wonky text transformations
  • Loading branch information
ndrake authored Oct 11, 2018
2 parents f9d83ff + 74339c6 commit ade27a5
Show file tree
Hide file tree
Showing 8 changed files with 149 additions and 19 deletions.
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# flipit README

This extension will [flip](https://github.com/jergason/flipjs) or [zalgoize](https://github.com/clux/zalgolize) the currently selected text or the whole editor if there is no selection and display the output in a new editor.
This extension will perform fun transformations on the currently selected text or the whole editor if there is no selection and display the output in a new editor.

Built with the help of:

* [flip](https://github.com/jergason/flipjs)
* [zalgoize](https://github.com/clux/zalgolize)
* [Lunicode](https://github.com/awaigand/Lunicode.js)

## Features

Expand All @@ -10,8 +16,20 @@ This extension will [flip](https://github.com/jergason/flipjs) or [zalgoize](htt

![Zalgo All](zalgoall.gif)

![Bubble All](bubbleall.gif)

![Mirror All](mirrorall.gif)

![Tiny Caps All](tinycapsall.gif)

![Wonk All](wonkall.gif)

## Release Notes

### 1.0.3

* Added bubble text, mirror text, tiny caps and wonky text transforms

### 1.0.2

* Cleanup disposable
Expand Down
Binary file added bubbleall.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
102 changes: 85 additions & 17 deletions extension.js
Original file line number Diff line number Diff line change
@@ -1,54 +1,122 @@
const vscode = require('vscode');
const flip = require('flip');
const zalgo = require('zalgolize');
const bubbles = require('lunicode-bubbles');
const mirror = require('lunicode-mirror');
const wonky = require('lunicode-bent');
const tinyCaps = require('lunicode-tiny');

/**
* Get text to transform. Returns current selection or all editor contents
*/
function getText() {
let editor = vscode.window.activeTextEditor;
if (!editor) {
return;
}

let selection = editor.selection;
return editor.document.getText(selection.isEmpty ? undefined : selection);
}

function activate(context) {

let disposable = vscode.commands.registerCommand('extension.flipIt', function () {

let editor = vscode.window.activeTextEditor;
if (!editor) {
let text = getText();
if (!text) {
return;
}

let selection = editor.selection;
let textToFlip = editor.document.getText(selection.isEmpty ? undefined : selection);
if( !textToFlip) {

let transformed = flip(text);
vscode.workspace.openTextDocument({
content: transformed
}).then((doc) => {
vscode.window.showTextDocument(doc);
});
});

context.subscriptions.push(disposable);

disposable = vscode.commands.registerCommand('extension.zalgoIt', function () {

let text = getText();
if (!text) {
return;
}

let flipped = flip(textToFlip);
let transformed = zalgo(text);
vscode.workspace.openTextDocument({
content: flipped
content: transformed
}).then((doc) => {
vscode.window.showTextDocument(doc);
});
});
context.subscriptions.push(disposable);

disposable = vscode.commands.registerCommand('extension.bubbleIt', function () {

let text = getText();
if (!text) {
return;
}

let transformed = bubbles.encode(text);
vscode.workspace.openTextDocument({
content: transformed
}).then((doc) => {
vscode.window.showTextDocument(doc);
});
});
context.subscriptions.push(disposable);

disposable = vscode.commands.registerCommand('extension.zalgoIt', function () {
disposable = vscode.commands.registerCommand('extension.mirrorIt', function () {

let editor = vscode.window.activeTextEditor;
if (!editor) {
let text = getText();
if (!text) {
return;
}

let selection = editor.selection;
let textToZalgo = editor.document.getText(selection.isEmpty ? undefined : selection);
if( !textToZalgo) {

let transformed = mirror.encode(text);
vscode.workspace.openTextDocument({
content: transformed
}).then((doc) => {
vscode.window.showTextDocument(doc);
});
});
context.subscriptions.push(disposable);

disposable = vscode.commands.registerCommand('extension.wonkIt', function () {

let text = getText();
if (!text) {
return;
}

let zalgoed = zalgo(textToZalgo);
let transformed = wonky.encode(text);
vscode.workspace.openTextDocument({
content: zalgoed
content: transformed
}).then((doc) => {
vscode.window.showTextDocument(doc);
});
});
context.subscriptions.push(disposable);

disposable = vscode.commands.registerCommand('extension.tinyCapsIt', function () {

let text = getText();
if (!text) {
return;
}

let transformed = tinyCaps.encode(text);
vscode.workspace.openTextDocument({
content: transformed
}).then((doc) => {
vscode.window.showTextDocument(doc);
});
});
context.subscriptions.push(disposable);
}
exports.activate = activate;

Expand Down
Binary file added mirrorall.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 25 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@
],
"activationEvents": [
"onCommand:extension.flipIt",
"onCommand:extension.zalgoIt"
"onCommand:extension.zalgoIt",
"onCommand:extension.bubbleIt",
"onCommand:extension.mirrorIt",
"onCommand:extension.wonkIt",
"onCommand:extension.tinyCapsIt"
],
"main": "./extension",
"contributes": {
Expand All @@ -29,6 +33,22 @@
{
"command": "extension.zalgoIt",
"title": "Zalgo It"
},
{
"command": "extension.bubbleIt",
"title": "Bubble It"
},
{
"command": "extension.mirrorIt",
"title": "Mirror It"
},
{
"command": "extension.wonkIt",
"title": "Wonk It"
},
{
"command": "extension.tinyCapsIt",
"title": "Tiny Caps It"
}
]
},
Expand All @@ -45,6 +65,10 @@
},
"dependencies": {
"flip": "1.0.0",
"lunicode-bent": "1.0.1",
"lunicode-bubbles": "1.0.1",
"lunicode-mirror": "1.0.1",
"lunicode-tiny": "1.0.1",
"zalgolize": "1.2.4"
}
}
Binary file added tinycapsall.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added wonkall.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ade27a5

Please sign in to comment.