Skip to content

Commit

Permalink
v0.1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
raptazure committed Mar 21, 2020
1 parent 47b0c0d commit 22eb2e6
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 4 deletions.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,14 @@

## Features

- Two Commands:
- Three Commands:
- `Draw a Card` - card of the day
- `Ask a Question` - input box will convey your will
- `The Vision` - the three card spread: draw three cards one by one
- The past - The present - The future
- The situation - The action - The outcome
- Current position - Aspiration - The path to take
- And more meanings as you wish...
- Status bar:
- Show your daily card
- Click on it to ask a question
Expand Down Expand Up @@ -56,5 +61,9 @@
- Fix bug: `Daily Crad` status bar cannot be influenced by function `Ask a Question` now.
- When `Daily Card` status bar is already there and function `Draw a Card` is called again, show the name of previous card instead of drawing a new card.

### 0.1.5

- The three card spread is available now: new command - `Daily Card: The Vision`.

**Enjoy!**

5 changes: 4 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,7 @@

### 0.1.3
- Fix bug: `Daily Crad` status bar cannot be influenced by function `Ask a Question` now.
- When `Daily Card` status bar is already there and function `Draw a Card` is called again, show the name of previous card instead of drawing a new card.
- When `Daily Card` status bar is already there and function `Draw a Card` is called again, show the name of previous card instead of drawing a new card.

### 0.1.5
- The three card spread is available now: new command - `Daily Card: The Vision`.
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "daily-tarot",
"displayName": "Daily Tarot",
"description": "Get your daily tarot reading - Prisma Visions",
"version": "0.1.3",
"version": "0.1.5",
"publisher": "raptazure",
"icon": "images/icon.jpg",
"engines": {
Expand All @@ -26,7 +26,8 @@
},
"activationEvents": [
"onCommand:tarot.today",
"onCommand:tarot.ask"
"onCommand:tarot.ask",
"onCommand:tarot.vision"
],
"main": "./out/extension.js",
"contributes": {
Expand All @@ -37,6 +38,10 @@
{
"command": "tarot.ask",
"title": "Daily Tarot: Ask a Question"
},
{
"command": "tarot.vision",
"title": "Daily Tarot: The Vision"
}
]
},
Expand Down
36 changes: 36 additions & 0 deletions src/cardSpread.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import * as vscode from 'vscode'
import * as path from 'path';
import * as fs from 'fs';

const visionSpread = (context: vscode.ExtensionContext, selector) => {
let panel: vscode.WebviewPanel | undefined;
panel = vscode.window.createWebviewPanel('visionSpread', 'The Vision', vscode.ViewColumn.Two, {});
if (panel !== undefined) {
const filePath: vscode.Uri = vscode.Uri.file(path.join(context.extensionPath, 'src', 'pages', `${selector}.html`));
panel.webview.html = fs.readFileSync(filePath.fsPath, 'utf8');
}

panel.onDidDispose(() => this.panel = undefined);
}

export async function showSpread(context: vscode.ExtensionContext) {
let selector: number;
selector = -1 + Math.floor(Math.random() * 79);
const question = await vscode.window.showInputBox({
placeHolder: 'Please enter the question you want to ask.'
})
if (question !== undefined && question !== '') {
vscode.window.showInformationMessage(`Drawing Three Cards for you🔮: ${question}`);
setTimeout(() => visionSpread(context, selector), 3599);
let selectorOne = -1 + Math.floor(Math.random() * 79);
while(selectorOne === selector) {
selectorOne = -1 + Math.floor(Math.random() * 79);
}
setTimeout(() => visionSpread(context, selectorOne), 4599);
let selectorTwo = -1 + Math.floor(Math.random() * 79);
while(selectorTwo === selector || selectorTwo === selectorOne) {
selectorTwo = -1 + Math.floor(Math.random() * 79);
}
setTimeout(() => visionSpread(context, selectorTwo), 5599);
}
}
6 changes: 6 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as vscode from 'vscode';
import { askQuestions } from './askQuestions';
import { dailyTarot } from './dailyTarot';
import { showSpread } from './cardSpread';

export function activate(context: vscode.ExtensionContext) {
const tarotToday = vscode.commands.registerCommand('tarot.today', () => {
Expand All @@ -11,8 +12,13 @@ export function activate(context: vscode.ExtensionContext) {
askQuestions(context);
});

const cardSpread = vscode.commands.registerCommand('tarot.vision', () => {
showSpread(context);
})

context.subscriptions.push(tarotAsk);
context.subscriptions.push(tarotToday);
context.subscriptions.push(cardSpread);
}


Expand Down

0 comments on commit 22eb2e6

Please sign in to comment.