diff --git a/ArchiveState.go b/ArchiveState.go index 20496b8..aaa10a6 100644 --- a/ArchiveState.go +++ b/ArchiveState.go @@ -7,6 +7,7 @@ import ( "io/ioutil" "math" "net/http" + "net/url" "os" "regexp" "strings" @@ -199,28 +200,34 @@ func (this *ArchiveState) renderTemplateHead(w http.ResponseWriter) { -
- `)) for i, h := range this.svr.cfg.Logs { slug, _ := this.svr.bestSlugFor(&this.svr.cfg.Logs[i]) current := (this.log == &this.svr.cfg.Logs[i]) - w.Write([]byte(``)) + targetUri := `/` + url.PathEscape(slug) + `/` + if len(this.query) > 0 { + if this.queryIsRegex { + targetUri += `rx/` + url.PathEscape(this.query) + } else { + targetUri += `search/` + url.PathEscape(this.query) + } + } else { + targetUri += fmt.Sprintf(`%d/%d`, h.LatestDate().Year, h.LatestDate().Month) + } + + w.Write([]byte(``)) } w.Write([]byte(` - -
+ `)) if showPageURLs { w.Write([]byte(` - -
- - `)) // Generate month dropdown options @@ -236,8 +243,18 @@ func (this *ArchiveState) renderTemplateHead(w http.ResponseWriter) { lastY = ympair.Year } - w.Write([]byte(fmt.Sprintf(``, ympair.Year, ympair.Month, attr(ympair.Equals(this.ym), "selected"), html.EscapeString(ympair.Month.String())))) + targetUri := fmt.Sprintf(`/%s/%d/%d`, this.logBestSlug, ympair.Year, ympair.Month) + + w.Write([]byte(fmt.Sprintf(``, html.EscapeString(targetUri), attr(ympair.Equals(this.ym), "selected"), html.EscapeString(ympair.Month.String())))) } + if lastY != -1 { + w.Write([]byte(``)) + } + w.Write([]byte(` + + +
+ `)) // @@ -259,43 +276,33 @@ func (this *ArchiveState) renderTemplateHead(w http.ResponseWriter) { nextMonthLink := fmt.Sprintf(`/%s/%d/%d`, this.logBestSlug, nextMonth.Year, nextMonth.Month) w.Write([]byte(` - - - - - - -
+ « - - ` + fmt.Sprintf("%d", this.page) + ` - - » + « + + ` + fmt.Sprintf("%d", this.page) + ` + + » `)) } w.Write([]byte(` -
-
+
+ - -
- - - - -
-
- - + +
+ + + + +
+
+ + -
+
`)) // Header ends diff --git a/static/archive.js b/static/archive.js index a2d0864..f43e63f 100755 --- a/static/archive.js +++ b/static/archive.js @@ -3,14 +3,8 @@ var alreadyLoaded = false; var $chatArea = document.getElementById("chatarea"); -var $selHub = document.getElementById("selHub"); -var $frmHub = document.getElementById("frmHub"); var DEFAULT_FONT_SIZE = 12; -function urldesc(s) { - return decodeURIComponent(s.replace(/\+/g, " ")); -} - function cookie_set(key, value) { document.cookie = (key+"="+value+"; expires=Sat, 20 Sep 2059 09:05:12; path=/"); } @@ -29,7 +23,11 @@ function cookie_get(key) { return null; } -function highlight(str) { +function highlight(str) { + var urldesc = function(s) { + return decodeURIComponent(s.replace(/\+/g, " ")); + }; + return str .replace(/(\[\d\d\d\d-\d\d-\d\d\s\d\d\:\d\d\:\d\d\] )(\*.+)/g, "$1$2") .replace( @@ -104,22 +102,6 @@ function onLoad() { fontSize(0); - // - - $selHub.onchange = function() { - if ( /\/search\//.test(window.location.pathname) ) { - window.location.pathname = $selHub.value + "/search/" + encodeURIComponent( i('searchbox').value ); - - } else if ( /\/rx\//.test(window.location.pathname) ) { - window.location.pathname = $selHub.value + "/rx/" + encodeURIComponent( i('searchbox').value ) - - } else { - $frmHub.submit(); - } - }; - - // - } window.addEventListener('load', onLoad);