Skip to content

Commit

Permalink
v0.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
emisjerry committed Apr 5, 2021
1 parent 4b06c62 commit c0b1c74
Show file tree
Hide file tree
Showing 14 changed files with 149 additions and 0 deletions.
Binary file added ad-abstract.png
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 ad-bug.png
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 ad-danger.png
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 ad-example.png
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 ad-failure.png
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 ad-info.png
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 ad-note.png
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 ad-question.png
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 ad-quote.png
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 ad-success.png
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 ad-tip.png
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 ad-warning.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions admonitions-gui.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
; Generated by AutoGUI 2.6.2
#SingleInstance Force
#NoEnv
SetWorkingDir %A_ScriptDir%
SetBatchLines -1

Gui Font, s12, Segoe UI
Gui Add, Text, x16 y24 w70 h23 +0x200, 類型:
Gui Add, Picture, x240 y0 w176 h81, Z:\pic\ad-abstract.png
Gui Add, Picture, x416 y0 w149 h82, Z:\pic\ad-info.png
Gui Add, Picture, x88 y88 w150 h78, Z:\pic\ad-tip.png
Gui Add, Picture, x240 y88 w174 h77, Z:\pic\ad-success.png
Gui Add, Picture, x419 y86 w151 h75, Z:\pic\ad-question.png
Gui Add, Picture, x240 y168 w172 h75, Z:\pic\ad-failure.png
Gui Add, Picture, x421 y169 w144 h73, Z:\pic\ad-danger.png
Gui Add, Picture, x88 y248 w143 h76, Z:\pic\ad-bug.png
Gui Add, Picture, x240 y248 w175 h76, Z:\pic\ad-example.png
Gui Add, Picture, x419 y248 w147 h74, Z:\pic\ad-quote.png
Gui Add, Picture, x88 y168 w150 h76, Z:\pic\ad-warning.png
Gui Add, Picture, x87 y6 w151 h76, Z:\pic\ad-note.png

Gui Show, x474 y140 w594 h348, Admonition 提醒區塊

OnMessage(0x201, "OnWM_LBUTTONDOWN")
Return

AdNote(CtrlHwnd, GuiEvent, EventInfo, ErrLevel := "") {

}

GuiEscape:
GuiClose:
ExitApp

OnWM_LBUTTONDOWN(wParam, lParam, msg, hWnd) {

}
112 changes: 112 additions & 0 deletions admonitions.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
; Generated by AutoGUI 2.6.2
; Author: Jerry http://jdev.tw/blog
; AutoHotkey GUI for Obsidian-Admonitions plugin
; Version: v0.0.1
#SingleInstance Force
#NoEnv
SetWorkingDir %A_ScriptDir%
SetBatchLines -1

global k_ID := 0


!q::
WinGet, k_ID, ID, A
Gui Font, s12, Segoe UI
Gui Add, Text, x16 y24 w70 h23 +0x200, 類型:
Gui Add, Picture, gAdNote x88 y4 w151 h76, %A_ScriptDir%\ad-note.png
Gui Add, Picture, gAdAbstract x240 y0 w176 h81, %A_ScriptDir%\ad-abstract.png
Gui Add, Picture, gAdInfo x416 y0 w149 h82, %A_ScriptDir%\ad-info.png
Gui Add, Picture, gAdTip x88 y88 w150 h78, %A_ScriptDir%\ad-tip.png
Gui Add, Picture, gAdSuccess x240 y88 w174 h77, %A_ScriptDir%\ad-success.png
Gui Add, Picture, gAdQuestion x419 y86 w151 h75, %A_ScriptDir%\ad-question.png
Gui Add, Picture, gAdFailure x240 y168 w172 h75, %A_ScriptDir%\ad-failure.png
Gui Add, Picture, gAdDanger x421 y169 w144 h73, %A_ScriptDir%\ad-danger.png
Gui Add, Picture, gAdBug x88 y248 w143 h76, %A_ScriptDir%\ad-bug.png
Gui Add, Picture, gAdExample x240 y248 w175 h76, %A_ScriptDir%\ad-example.png
Gui Add, Picture, gAdQuote x419 y248 w147 h74, %A_ScriptDir%\ad-quote.png
Gui Add, Picture, gAdWarning x88 y168 w150 h76, %A_ScriptDir%\ad-warning.png

Gui Show, x782 y143 w594 h341, Admonition 提醒區塊

Return

GuiEscape:
GuiClose:
Gui Cancel

admonition(type, title) {
Clipboard =
(
``````ad-%type%
title: %title%
collapse: open
content:
```````n
)
len := StrLen(title)
ClipWait
WinActivate, ahk_id %k_ID%
SendInput, ^v
SendInput, {up 4}{end}{left %len%}
}

AdNote(CtrlHwnd, GuiEvent, EventInfo, ErrLevel := "") {
admonition("note", "備註")
Gui Cancel
}

AdAbstract(CtrlHwnd, GuiEvent, EventInfo, ErrLevel := "") {
admonition("abstract", "摘要")
Gui Cancel
}

AdInfo(CtrlHwnd, GuiEvent, EventInfo, ErrLevel := "") {
admonition("info", "資訊")
Gui Cancel
}

AdTip(CtrlHwnd, GuiEvent, EventInfo, ErrLevel := "") {
admonition("tip", "小技巧")
Gui Cancel
}

AdSuccess(CtrlHwnd, GuiEvent, EventInfo, ErrLevel := "") {
admonition("success", "完成")
Gui Cancel
}

AdQuestion(CtrlHwnd, GuiEvent, EventInfo, ErrLevel := "") {
admonition("question", "問題")
Gui Cancel
}

AdFailure(CtrlHwnd, GuiEvent, EventInfo, ErrLevel := "") {
admonition("failure", "失敗")
Gui Cancel
}

AdDanger(CtrlHwnd, GuiEvent, EventInfo, ErrLevel := "") {
admonition("danger", "錯誤")
Gui Cancel
}

AdBug(CtrlHwnd, GuiEvent, EventInfo, ErrLevel := "") {
admonition("bug", "臭蟲")
Gui Cancel
}

AdExample(CtrlHwnd, GuiEvent, EventInfo, ErrLevel := "") {
admonition("example", "範例")
Gui Cancel
}

AdWarning(CtrlHwnd, GuiEvent, EventInfo, ErrLevel := "") {
admonition("warning", "警告")
Gui Cancel
}

AdQuote(CtrlHwnd, GuiEvent, EventInfo, ErrLevel := "") {
admonition("quote", "引用")
Gui Cancel
}

0 comments on commit c0b1c74

Please sign in to comment.