// +build js package main import ( "github.com/gopherjs/gopherjs/js" "github.com/mame82/hvue" ) func InitComponentsDialog() { hvue.NewComponent( "select-string-from-array", hvue.Template(templateSelectStringModal), hvue.DataFunc(func(vm *hvue.VM) interface{} { data := struct { *js.Object CurrentSelection *js.Object `js:"CurrentSelection"` }{Object:O()} data.CurrentSelection = O() return &data }), hvue.Mounted(func(vm *hvue.VM) { vm.Set("CurrentSelection", vm.Get("values").Index(0)) // println("Index 0 on mount", vm.Get("values").Index(0)) }), hvue.ComputedWithGetSet( "visible", func(vm *hvue.VM) interface{} { return vm.Get("value") }, func(vm *hvue.VM, newValue *js.Object) { vm.Call("$emit", "input", newValue) }, ), hvue.Method( "onLoadPressed", func(vm *hvue.VM) { vm.Call("$emit", "load", vm.Get("CurrentSelection")) //println(vm.Get("CurrentSelection")) }, ), hvue.Method( "onDeletePressed", func(vm *hvue.VM, name *js.Object) { vm.Call("$emit", "delete", name) }, ), hvue.PropObj( "values", hvue.Required, ), hvue.PropObj( "value", hvue.Required, hvue.Types(hvue.PBoolean), ), hvue.PropObj( "with-delete", hvue.Types(hvue.PBoolean), hvue.Default(false), ), hvue.PropObj( "title", hvue.Types(hvue.PString), ), ) hvue.NewComponent( "modal-string-input", hvue.Template(templateInputStringModal), hvue.DataFunc(func(vm *hvue.VM) interface{} { data := struct { *js.Object Text string `js:"text"` }{Object:O()} data.Text = "" return &data }), hvue.ComputedWithGetSet( "visible", func(vm *hvue.VM) interface{} { return vm.Get("value") }, func(vm *hvue.VM, newValue *js.Object) { vm.Call("$emit", "input", newValue) }, ), hvue.Method( "onSavePressed", func(vm *hvue.VM) { if vm.Get("text") == js.Undefined || vm.Get("text").String() == "" { QuasarNotifyError("Can't store to empty template name", "", QUASAR_NOTIFICATION_POSITION_TOP) return } vm.Call("$emit", "save", vm.Get("text")) println(vm.Get("text")) }, ), hvue.PropObj( "title", hvue.Types(hvue.PString), ), hvue.PropObj( "value", hvue.Required, hvue.Types(hvue.PBoolean), ), ) hvue.NewComponent( "ransom-note", hvue.Template(templateRansomModal), hvue.ComputedWithGetSet( "visible", func(vm *hvue.VM) interface{} { return vm.Get("value") }, func(vm *hvue.VM, newValue *js.Object) { vm.Call("$emit", "input", newValue) }, ), hvue.PropObj( "value", hvue.Required, hvue.Types(hvue.PBoolean), ), ) hvue.NewComponent( "disconnect-modal", hvue.Template(templateDisconnectModal), hvue.ComputedWithGetSet( "visible", func(vm *hvue.VM) interface{} { return vm.Get("value") }, func(vm *hvue.VM, newValue *js.Object) { vm.Call("$emit", "input", newValue) }, ), hvue.PropObj( "value", hvue.Required, hvue.Types(hvue.PBoolean), ), ) } const templateSelectStringModal = ` {{ title }} {{ name }} ` const templateInputStringModal = `
{{ title }} Name
` const templateDisconnectModal = `
Not connection to server

No connection to server

Trying to reconnect ... Attempt: {{ $store.state.ConnectRetryCount }}

` const templateRansomModal = `
You became victim of a VERY SILLY IDEA
███████████████████████████████████████████████████████████████████████████████

The web page you've been viewing, provided a sophisticated experience
in terms of keyboard automation and scripting. There were LED based triggers,
there was scriptable mouse control, there were complex control structures
like if-else-branching and for-loops. Not to mention the capability of running
multiple asynchronous jobs.

If you really need a converter for a limited, old-school language:

1. Ask somebody else to write one.
2. Send me 10+ BTC and I'll write one'.
or
3. Write one yourself and don't send a PR'.

If you want your DuckyScript encrypted, please enter it elsewhere!
`