diff --git a/common/pages.go b/common/pages.go
index fe70a062..097e9a23 100644
--- a/common/pages.go
+++ b/common/pages.go
@@ -25,7 +25,7 @@ type Header struct {
PreScriptsAsync []HResource
ScriptsAsync []HResource
//Preload []string
- Stylesheets []string
+ Stylesheets []HResource
Widgets PageWidgets
Site *site
Settings SettingMap
@@ -92,7 +92,15 @@ func (header *Header) AddScriptAsync(name string) {
}*/
func (header *Header) AddSheet(name string) {
- header.Stylesheets = append(header.Stylesheets, name)
+ fname := "/static/" + name
+ var hash string
+ if fname[0] == '/' && fname[1] != '/' {
+ file, ok := StaticFiles.Get(fname)
+ if ok {
+ hash = file.Sha256
+ }
+ }
+ header.Stylesheets = append(header.Stylesheets, HResource{name, hash})
}
func (header *Header) AddNotice(name string) {
diff --git a/common/parser.go b/common/parser.go
index de8e8124..dd7bbf94 100644
--- a/common/parser.go
+++ b/common/parser.go
@@ -217,7 +217,7 @@ func PreparseMessage(msg string) string {
's': []string{"", "trong", "pan"},
'd': []string{"el"},
'u': []string{""},
- 'b': []string{""},
+ 'b': []string{"", "lockquote"},
'i': []string{""},
'g': []string{""}, // Quick and dirty fix for Grammarly
}
@@ -261,7 +261,10 @@ func PreparseMessage(msg string) string {
},
'd': []*TagToAction{&TagToAction{"el", buildLitMatch("del"), 0, false}},
'u': []*TagToAction{&TagToAction{"", buildLitMatch("u"), 0, false}},
- 'b': []*TagToAction{&TagToAction{"", buildLitMatch("strong"), 0, false}},
+ 'b': []*TagToAction{
+ &TagToAction{"", buildLitMatch("strong"), 0, false},
+ &TagToAction{"lockquote", buildLitMatch("blockquote"), 0, false},
+ },
'i': []*TagToAction{&TagToAction{"", buildLitMatch("em"), 0, false}},
'g': []*TagToAction{
&TagToAction{"", func(act *TagToAction, open bool, i int, runes []rune) (int, string) {
diff --git a/common/template_init.go b/common/template_init.go
index a99b0a12..a4d56ff6 100644
--- a/common/template_init.go
+++ b/common/template_init.go
@@ -108,7 +108,7 @@ func tmplInitHeaders(user User, user2 User, user3 User) (*Header, *Header, *Head
Theme: Themes[DefaultThemeBox.Load().(string)],
CurrentUser: user,
NoticeList: []string{"test"},
- Stylesheets: []string{"panel.css"},
+ Stylesheets: []HResource{HResource{"panel.css", "d"}},
Scripts: []HResource{HResource{"whatever.js", "d"}},
PreScriptsAsync: []HResource{HResource{"whatever.js", "d"}},
ScriptsAsync: []HResource{HResource{"whatever.js", "d"}},
diff --git a/plugin_bbcode.go b/plugin_bbcode.go
index 8d5ca916..acc12638 100644
--- a/plugin_bbcode.go
+++ b/plugin_bbcode.go
@@ -60,7 +60,7 @@ func bbcodeRegexParse(msg string) string {
msg = bbcodeStrikethrough.ReplaceAllString(msg, "$1")
msg = bbcodeURL.ReplaceAllString(msg, "$1$2//$3")
msg = bbcodeURLLabel.ReplaceAllString(msg, "$4")
- msg = bbcodeQuotes.ReplaceAllString(msg, "$1")
+ msg = bbcodeQuotes.ReplaceAllString(msg, "$1
")
//msg = bbcodeCode.ReplaceAllString(msg,"$1")
return msg
}
@@ -197,7 +197,7 @@ func bbcodeParseWithoutCode(msg string) string {
msg = string(msgbytes)
msg = bbcodeURL.ReplaceAllString(msg, "$1$2//$3")
msg = bbcodeURLLabel.ReplaceAllString(msg, "$4")
- msg = bbcodeQuotes.ReplaceAllString(msg, "$1")
+ msg = bbcodeQuotes.ReplaceAllString(msg, "$1
")
return bbcodeCode.ReplaceAllString(msg, "$1")
}
return string(msgbytes)
@@ -323,7 +323,7 @@ func bbcodeFullParse(msg string) string {
//msg = bbcode_url.ReplaceAllString(msg,"$1$2//$3")
msg = bbcodeURLLabel.ReplaceAllString(msg, "$4")
- msg = bbcodeQuotes.ReplaceAllString(msg, "$1")
+ msg = bbcodeQuotes.ReplaceAllString(msg, "$1
")
msg = bbcodeCode.ReplaceAllString(msg, "$1")
} else {
msg = string(msgbytes[0 : len(msgbytes)-10])
diff --git a/plugin_test.go b/plugin_test.go
index 9b2db4cf..de13d426 100644
--- a/plugin_test.go
+++ b/plugin_test.go
@@ -60,10 +60,10 @@ func TestBBCodeRender(t *testing.T) {
msgList.Add("[code]hi[/code]", "hi")
msgList.Add("[code][b]hi[/b][/code]", "[b]hi[/b]")
msgList.Add("[code][b]hi[/code][/b]", "[b]hi[/b]")
- msgList.Add("[quote]hi[/quote]", "hi")
- msgList.Add("[quote][b]hi[/b][/quote]", "hi")
- msgList.Add("[quote][b]h[/b][/quote]", "h")
- msgList.Add("[quote][b][/b][/quote]", "")
+ msgList.Add("[quote]hi[/quote]", "hi
")
+ msgList.Add("[quote][b]hi[/b][/quote]", "hi
")
+ msgList.Add("[quote][b]h[/b][/quote]", "h
")
+ msgList.Add("[quote][b][/b][/quote]", "")
msgList.Add("[url][/url]", "")
msgList.Add("[url]https://github.com/Azareal/Gosora[/url]", "https://github.com/Azareal/Gosora")
msgList.Add("[url]http://github.com/Azareal/Gosora[/url]", "http://github.com/Azareal/Gosora")
diff --git a/public/account.js b/public/account.js
index 1c4e2bff..ad17da14 100644
--- a/public/account.js
+++ b/public/account.js
@@ -1,7 +1,9 @@
-"use strict"
+"use strict";
-$(document).ready(function(){
+(() => {
+addInitHook("end_init", () => {
$("#dash_username input").click(function(){
$("#dash_username button").show();
});
});
+})();
\ No newline at end of file
diff --git a/public/profile_member.js b/public/profile_member.js
index fa940987..a6e03099 100644
--- a/public/profile_member.js
+++ b/public/profile_member.js
@@ -12,7 +12,9 @@ function handle_profile_hashbit() {
$("." + hash_class).show();
}
-$(document).ready(() => {
+(() => {
+addInitHook("end_init", () => {
if(window.location.hash) handle_profile_hashbit();
window.addEventListener("hashchange", handle_profile_hashbit, false);
-});
\ No newline at end of file
+});
+})();
\ No newline at end of file
diff --git a/routes/account.go b/routes/account.go
index 78d0c392..c491b566 100644
--- a/routes/account.go
+++ b/routes/account.go
@@ -356,7 +356,7 @@ func accountEditHead(titlePhrase string, w http.ResponseWriter, r *http.Request,
header.Title = phrases.GetTitlePhrase(titlePhrase)
header.Path = "/user/edit/"
header.AddSheet(header.Theme.Name + "/account.css")
- header.AddScript("account.js")
+ header.AddScriptAsync("account.js")
}
func AccountEdit(w http.ResponseWriter, r *http.Request, user common.User, header *common.Header) common.RouteError {
diff --git a/routes/profile.go b/routes/profile.go
index 81426580..f360daef 100644
--- a/routes/profile.go
+++ b/routes/profile.go
@@ -32,7 +32,7 @@ func ViewProfile(w http.ResponseWriter, r *http.Request, user common.User, heade
// TODO: Preload this?
header.AddSheet(header.Theme.Name + "/profile.css")
if user.Loggedin {
- header.AddScript("profile_member.js")
+ header.AddScriptAsync("profile_member.js")
}
var err error
diff --git a/templates/header.html b/templates/header.html
index 5d132488..89942567 100644
--- a/templates/header.html
+++ b/templates/header.html
@@ -4,7 +4,7 @@