dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

stream-top-bar.qtpl.go (9906B)


      1 // Code generated by qtc from "stream-top-bar.qtpl". DO NOT EDIT.
      2 // See https://github.com/valyala/quicktemplate for details.
      3 
      4 //line stream-top-bar.qtpl:1
      5 package v1
      6 
      7 //line stream-top-bar.qtpl:1
      8 import "dkforest/pkg/database"
      9 
     10 //line stream-top-bar.qtpl:3
     11 import (
     12 	qtio422016 "io"
     13 
     14 	qt422016 "github.com/valyala/quicktemplate"
     15 )
     16 
     17 //line stream-top-bar.qtpl:3
     18 var (
     19 	_ = qtio422016.Copy
     20 	_ = qt422016.AcquireByteBuffer
     21 )
     22 
     23 //line stream-top-bar.qtpl:3
     24 func StreamRenderTopBar(qw422016 *qt422016.Writer, CSRF string, Data chatTopBarData, AuthUser *database.User) {
     25 //line stream-top-bar.qtpl:3
     26 	qw422016.N().S(`<html lang="en">
     27     <head>
     28         <title></title>
     29         <style>
     30             html, body {
     31                 margin: 0;
     32                 padding: 0;
     33             }
     34             body { font-family: Lato,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"; }
     35             a { color: #00bc8c; text-decoration: none; font-size: 14px; }
     36             a:hover { color: #007053; text-decoration: underline; }
     37             .wrapper {
     38                 position: relative;
     39                 width: 500px;
     40             }
     41             .wrapper input, .wrapper textarea {
     42                 box-sizing: border-box;
     43                 border-radius: 10px 0px 0px 10px;
     44                 border: 1px solid rgba(10,10,10,255);
     45                 background: rgba(76, 76, 76, 255);
     46                 margin: 0;
     47                 float: left;
     48                 padding-right: 10px;
     49                 padding-left: 10px;
     50                 width: 421px;
     51                 height: 22px;
     52                 color: #fff;
     53                 box-shadow:0 0 0 black;
     54                 outline: none;
     55             }
     56             .wrapper input:focus {
     57                 outline: none;
     58             }
     59             .wrapper button {
     60                 border-radius: 0 10px 10px 0;
     61                 position: absolute;
     62                 top: 0;
     63                 right: 0;
     64                 width: 80px;
     65                 height: 22px;
     66                 color: white;
     67                 border: 1px solid rgba(10,10,10,255);
     68                 background: rgba(65, 65, 65, 255);
     69             }
     70             .wrapper button:hover {
     71                 background: rgba(57, 57, 57, 255);
     72             }
     73 `)
     74 //line stream-top-bar.qtpl:51
     75 	if Data.Multiline {
     76 //line stream-top-bar.qtpl:51
     77 		qw422016.N().S(`                .wrapper textarea, .wrapper button {
     78                     height: 122px;
     79                 }
     80 `)
     81 //line stream-top-bar.qtpl:55
     82 	}
     83 //line stream-top-bar.qtpl:55
     84 	qw422016.N().S(`            * {
     85                 -webkit-font-smoothing: antialiased;
     86                 -moz-osx-font-smoothing: grayscale;
     87             }
     88             [list]::-webkit-calendar-picker-indicator {
     89                 display: none !important;
     90             }
     91 
     92             #top-bar-form { margin: 0; padding: 5px 0 0 0; }
     93             #refresh-btn { line-height: 20px; }
     94             #file-upload-btn { height: 16px; font-size: 9px; margin-top: 2px; margin-left: 5px; position: absolute; }
     95             #err-lbl { color: #e74c3c; font-size: 80%; }
     96             #success-lbl { color: #198754; font-size: 80%; }
     97             #username-td { padding-right: 5px; }
     98             #links-td { color: #aaa; }
     99         </style>
    100     </head>
    101     <body>
    102         <form method="post" id="top-bar-form" enctype="multipart/form-data">
    103             <input type="hidden" name="csrf" value="`)
    104 //line stream-top-bar.qtpl:75
    105 	qw422016.E().S(CSRF)
    106 //line stream-top-bar.qtpl:75
    107 	qw422016.N().S(`" />
    108             <table>
    109                 <tr>
    110                     <td id="username-td"><span `)
    111 //line stream-top-bar.qtpl:78
    112 	streamunesc(qw422016, AuthUser.GenerateChatStyle())
    113 //line stream-top-bar.qtpl:78
    114 	qw422016.N().S(`>`)
    115 //line stream-top-bar.qtpl:78
    116 	qw422016.E().S(string(AuthUser.Username))
    117 //line stream-top-bar.qtpl:78
    118 	qw422016.N().S(`</span></td>
    119                     <td>
    120                         <div class="wrapper">
    121 `)
    122 //line stream-top-bar.qtpl:81
    123 	if Data.Multiline {
    124 //line stream-top-bar.qtpl:81
    125 		qw422016.N().S(`                                <textarea name="message" maxlength="10000" autocomplete="off"`)
    126 //line stream-top-bar.qtpl:82
    127 		if AuthUser.SpellcheckEnabled {
    128 //line stream-top-bar.qtpl:82
    129 			qw422016.N().S(`spellcheck="true"`)
    130 //line stream-top-bar.qtpl:82
    131 		}
    132 //line stream-top-bar.qtpl:82
    133 		qw422016.N().S(`autofocus>`)
    134 //line stream-top-bar.qtpl:82
    135 		qw422016.E().S(Data.Message)
    136 //line stream-top-bar.qtpl:82
    137 		qw422016.N().S(`</textarea>
    138 `)
    139 //line stream-top-bar.qtpl:83
    140 	} else {
    141 //line stream-top-bar.qtpl:83
    142 		qw422016.N().S(`                                <input value="`)
    143 //line stream-top-bar.qtpl:84
    144 		qw422016.E().S(Data.Message)
    145 //line stream-top-bar.qtpl:84
    146 		qw422016.N().S(`" type="text" name="message" maxlength="10000" autocomplete="off"`)
    147 //line stream-top-bar.qtpl:84
    148 		if AuthUser.SpellcheckEnabled {
    149 //line stream-top-bar.qtpl:84
    150 			qw422016.N().S(`spellcheck="true"`)
    151 //line stream-top-bar.qtpl:84
    152 		}
    153 //line stream-top-bar.qtpl:84
    154 		qw422016.N().S(`autofocus`)
    155 //line stream-top-bar.qtpl:84
    156 		if AuthUser.AutocompleteCommandsEnabled {
    157 //line stream-top-bar.qtpl:84
    158 			qw422016.N().S(`list="commands"`)
    159 //line stream-top-bar.qtpl:84
    160 		}
    161 //line stream-top-bar.qtpl:84
    162 		qw422016.N().S(`/>
    163 `)
    164 //line stream-top-bar.qtpl:85
    165 		if AuthUser.AutocompleteCommandsEnabled {
    166 //line stream-top-bar.qtpl:85
    167 			qw422016.N().S(`                                    <datalist id="commands">
    168 `)
    169 //line stream-top-bar.qtpl:87
    170 			for _, el := range Data.CommandsList {
    171 //line stream-top-bar.qtpl:87
    172 				qw422016.N().S(`<option value="`)
    173 //line stream-top-bar.qtpl:87
    174 				qw422016.E().S(el)
    175 //line stream-top-bar.qtpl:87
    176 				qw422016.N().S(`">`)
    177 //line stream-top-bar.qtpl:87
    178 			}
    179 //line stream-top-bar.qtpl:87
    180 			qw422016.N().S(`                                    </datalist>
    181 `)
    182 //line stream-top-bar.qtpl:89
    183 		}
    184 //line stream-top-bar.qtpl:90
    185 	}
    186 //line stream-top-bar.qtpl:90
    187 	qw422016.N().S(`                            <button type="submit" value="send_message" name="btn_submit">send</button>
    188                         </div>
    189                     </td>
    190                 </tr>
    191                 <tr>
    192                     <td>
    193 `)
    194 //line stream-top-bar.qtpl:97
    195 	if Data.Error != "" || Data.Success != "" {
    196 //line stream-top-bar.qtpl:97
    197 		qw422016.N().S(`                            <a href="/api/v1/chat/top-bar/`)
    198 //line stream-top-bar.qtpl:98
    199 		qw422016.E().S(Data.RoomName)
    200 //line stream-top-bar.qtpl:98
    201 		qw422016.N().S(`?`)
    202 //line stream-top-bar.qtpl:98
    203 		if Data.Multiline {
    204 //line stream-top-bar.qtpl:98
    205 			qw422016.E().S(Data.QueryParamsMl)
    206 //line stream-top-bar.qtpl:98
    207 		} else {
    208 //line stream-top-bar.qtpl:98
    209 			qw422016.E().S(Data.QueryParamsNml)
    210 //line stream-top-bar.qtpl:98
    211 		}
    212 //line stream-top-bar.qtpl:98
    213 		qw422016.N().S(`" title="Refresh" id="refresh-btn">&#8635;</a>
    214 `)
    215 //line stream-top-bar.qtpl:99
    216 	}
    217 //line stream-top-bar.qtpl:99
    218 	qw422016.N().S(`                    </td>
    219                     <td id="links-td">
    220 `)
    221 //line stream-top-bar.qtpl:102
    222 	if Data.Error != "" {
    223 //line stream-top-bar.qtpl:102
    224 		qw422016.N().S(`                            <span id="err-lbl">`)
    225 //line stream-top-bar.qtpl:103
    226 		qw422016.E().S(Data.Error)
    227 //line stream-top-bar.qtpl:103
    228 		qw422016.N().S(`</span>
    229 `)
    230 //line stream-top-bar.qtpl:104
    231 	} else if Data.Success != "" {
    232 //line stream-top-bar.qtpl:104
    233 		qw422016.N().S(`                            <span id="success-lbl">`)
    234 //line stream-top-bar.qtpl:105
    235 		qw422016.E().S(Data.Success)
    236 //line stream-top-bar.qtpl:105
    237 		qw422016.N().S(`</span>
    238 `)
    239 //line stream-top-bar.qtpl:106
    240 	} else {
    241 //line stream-top-bar.qtpl:106
    242 		qw422016.N().S(`                            <a href="/settings/chat" target="_top">Settings</a> |
    243                             <a href="/chat/help" target="_top">"Available commands</a> |
    244                             <a href="/chat/create-room" target="_top">Create room</a>
    245 `)
    246 //line stream-top-bar.qtpl:110
    247 		if AuthUser.CanUseMultiline {
    248 //line stream-top-bar.qtpl:110
    249 			qw422016.N().S(`| <a href="/chat/`)
    250 //line stream-top-bar.qtpl:110
    251 			qw422016.E().S(Data.RoomName)
    252 //line stream-top-bar.qtpl:110
    253 			qw422016.N().S(`?`)
    254 //line stream-top-bar.qtpl:110
    255 			if Data.Multiline {
    256 //line stream-top-bar.qtpl:110
    257 				qw422016.E().S(Data.QueryParamsNml)
    258 //line stream-top-bar.qtpl:110
    259 			} else {
    260 //line stream-top-bar.qtpl:110
    261 				qw422016.E().S(Data.QueryParamsMl)
    262 //line stream-top-bar.qtpl:110
    263 			}
    264 //line stream-top-bar.qtpl:110
    265 			qw422016.N().S(`" target="_top">ml</a>`)
    266 //line stream-top-bar.qtpl:110
    267 		}
    268 //line stream-top-bar.qtpl:111
    269 		if AuthUser.CanUpload() {
    270 //line stream-top-bar.qtpl:111
    271 			qw422016.N().S(`| <input name="file" type="file" id="file-upload-btn" />`)
    272 //line stream-top-bar.qtpl:111
    273 		}
    274 //line stream-top-bar.qtpl:112
    275 	}
    276 //line stream-top-bar.qtpl:112
    277 	qw422016.N().S(`                    </td>
    278                     <td></td>
    279                 </tr>
    280             </table>
    281         </form>
    282     </body>
    283 </html>
    284 `)
    285 //line stream-top-bar.qtpl:120
    286 }
    287 
    288 //line stream-top-bar.qtpl:120
    289 func WriteRenderTopBar(qq422016 qtio422016.Writer, CSRF string, Data chatTopBarData, AuthUser *database.User) {
    290 //line stream-top-bar.qtpl:120
    291 	qw422016 := qt422016.AcquireWriter(qq422016)
    292 //line stream-top-bar.qtpl:120
    293 	StreamRenderTopBar(qw422016, CSRF, Data, AuthUser)
    294 //line stream-top-bar.qtpl:120
    295 	qt422016.ReleaseWriter(qw422016)
    296 //line stream-top-bar.qtpl:120
    297 }
    298 
    299 //line stream-top-bar.qtpl:120
    300 func RenderTopBar(CSRF string, Data chatTopBarData, AuthUser *database.User) string {
    301 //line stream-top-bar.qtpl:120
    302 	qb422016 := qt422016.AcquireByteBuffer()
    303 //line stream-top-bar.qtpl:120
    304 	WriteRenderTopBar(qb422016, CSRF, Data, AuthUser)
    305 //line stream-top-bar.qtpl:120
    306 	qs422016 := string(qb422016.B)
    307 //line stream-top-bar.qtpl:120
    308 	qt422016.ReleaseByteBuffer(qb422016)
    309 //line stream-top-bar.qtpl:120
    310 	return qs422016
    311 //line stream-top-bar.qtpl:120
    312 }