Example #1
0
// OpenFullImageModal ...
func OpenFullImageModal(src string, id int64) {
	templates.Apply("image-modal", "#modal", map[string]interface{}{
		"ID":     id,
		"Source": src,
	})
	ShowModal()
}
Example #2
0
// ContextChannelSwitcher shows the context menu for a channel switcher
func ContextChannelSwitcher(event *js.Object, network, channel string) {
	templates.Apply("contextmenu", "#contextmenu", map[string]string{
		"Clear History": fmt.Sprintf("ui.settings.clearHistory('%s', '%s')", network, channel),
		"Part Channel":  fmt.Sprintf("ui.settings.partChannel('%s', '%s')", network, channel),
	})
	ShowContextMenu(event)
}
Example #3
0
// ContextMessage shows the context menu for a message
func ContextMessage(event *js.Object, id int64) {
	if GetActiveChannelObj().Find(".message-wrapper > .selected").Length > 0 && jq("#message-wrapper-%d", id).HasClass("selected") {
		templates.Apply("contextmenu", "#contextmenu", map[string]string{
			"Deselect":              fmt.Sprintf("ui.selection.unselect('%d')", id),
			"Delete Selected":       "ui.selection.delete()",
			"Copy Text of Selected": "ui.selection.copy()",
		})
	} else {
		templates.Apply("contextmenu", "#contextmenu", map[string]string{
			"Select":    fmt.Sprintf("ui.selection.select('%d')", id),
			"Delete":    fmt.Sprintf("ui.contextmenu.click.message('delete', '%d')", id),
			"Copy Text": fmt.Sprintf("ui.contextmenu.click.message('copy', '%d')", id),
		})
	}
	ShowContextMenu(event)
}
Example #4
0
func main() {
	console.Info("mauIRC", data.Version, "loading...")

	console.Log("Loading templates")
	templates.LoadAll()

	console.Log("Checking notification permission")
	js.Global.Get("Notification").Call("requestPermission")

	console.Log("Applying templates")
	templates.Apply("login", "#container", nil)
	templates.Apply("settings", "#settings", nil)

	console.Info("Init done")

	conn.CheckAuth()
}
Example #5
0
// ContextChannel shows the context menu for a channel message container
func ContextChannel(event *js.Object) {
	if GetActiveChannelObj().Find(".message-wrapper > .selected").Length > 0 {
		templates.Apply("contextmenu", "#contextmenu", map[string]string{
			"Delete Selected":       "ui.selection.delete()",
			"Copy Text of Selected": "ui.selection.copy()",
		})
		ShowContextMenu(event)
	}
}
Example #6
0
// ContextNetworkSwitcher shows the context menu for a network switcher
func ContextNetworkSwitcher(event *js.Object, network string) {
	templates.Apply("contextmenu", "#contextmenu", map[string]string{
		"Raw IO":           fmt.Sprintf("ui.rawio.open('%s')", network),
		"Oper Auth":        fmt.Sprintf("ui.oper.open('%s')", network),
		"Connect":          fmt.Sprintf("ui.contextmenu.click.networkSwitcher('connect', '%s')", network),
		"Disconnect":       fmt.Sprintf("ui.contextmenu.click.networkSwitcher('disconnect', '%s')", network),
		"Force Disconnect": fmt.Sprintf("ui.contextmenu.click.networkSwitcher('forcedisconnect', '%s')", network),
	})
	ShowContextMenu(event)
}
Example #7
0
// ContextUserlistEntry shows the context menu for an userlist entry
func ContextUserlistEntry(event *js.Object, network, user string) {
	templates.Apply("contextmenu", "#contextmenu", map[string]string{
		"Open Query": fmt.Sprintf("ui.openPM('%s', '%s')", network, user),
		"Whois":      fmt.Sprintf("ui.contextmenu.click.networkSwitcher('whois', '%s', '%s')", network, user),
		"Give OP":    fmt.Sprintf("ui.contextmenu.click.networkSwitcher('op', '%s', '%s')", network, user),
		"Take OP":    fmt.Sprintf("ui.contextmenu.click.networkSwitcher('deop', '%s', '%s')", network, user),
		"Kick":       fmt.Sprintf("ui.contextmenu.click.networkSwitcher('kick', '%s', '%s')", network, user),
		"Ban":        fmt.Sprintf("ui.contextmenu.click.networkSwitcher('ban', '%s', '%s')", network, user),
	})
	ShowContextMenu(event)
}
Example #8
0
// StartTitleEdit opens the title editor
func StartTitleEdit() {
	if jq("#title-editor").Length != 0 {
		return
	}

	now := time.Now().UnixNano()
	if now-titleEditClick <= 500000000 {
		templates.Apply("title-editor", "#title", jq("#title").Text())
		jq("#title-editor").Focus()
		titleEditClick = 0
	} else {
		titleEditClick = now
	}
}