-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
63 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters