diff --git a/_includes/browse/highlightSortedTableColumn.js b/_includes/browse/highlightSortedTableColumn.js new file mode 100644 index 0000000..55813c8 --- /dev/null +++ b/_includes/browse/highlightSortedTableColumn.js @@ -0,0 +1,24 @@ +{% comment %} +// +// Programmer: Craig Stuart Sapp +// Creation Date: Wed Oct 6 12:27:04 PDT 2021 +// Last Modified: Wed Oct 6 12:27:07 PDT 2021 +// Filename: _includes/browse/highlightSortedTableColumn.js +// Used by: _includes/browse/displayBrowsePage.js +// Included in: _includes/browse/main.html +// Syntax: ECMAScript 6 +// vim: ts=3:nowrap +// +// Description: Generate contents for all fields in browwe search form. +// +{% endcomment %} + +POPC2.prototype.highlightSortedTableColumn = function (index) { + this.DebugMessageFunction(); + +}; + +Object.defineProperty(POPC2.prototype.highlightSortedTableColumn, "name", { value: "highlightSortedTableColumn" }); + + + diff --git a/_includes/browse/main.html b/_includes/browse/main.html index 40b746d..1e99a49 100644 --- a/_includes/browse/main.html +++ b/_includes/browse/main.html @@ -54,6 +54,7 @@ {% include browse/showResultsCount.js %} {% include browse/showShelfmarkColumn.js %} {% include browse/storeSearchInfo.js %} +{% include browse/toggleBookmarkDisplay.js %} {% include browse/toggleBrowseStyle.js %} {% include browse/toggleComposerSort.js %} {% include browse/toggleShelfmarkSort.js %} diff --git a/_includes/browse/toggleBookmarkDisplay.js b/_includes/browse/toggleBookmarkDisplay.js new file mode 100644 index 0000000..76f89cb --- /dev/null +++ b/_includes/browse/toggleBookmarkDisplay.js @@ -0,0 +1,59 @@ +{% comment %} +// +// Programmer: Craig Stuart Sapp +// Creation Date: Sat Oct 30 20:51:13 PDT 2021 +// Last Modified: Sat Oct 30 20:51:17 PDT 2021 +// Filename: _includes/browse/toggleBookmarkDisplay.js +// Used by: _includes/handlebars/template-browse.html +// Included in: _includes/browse/main.html +// Syntax: ECMAScript 6 +// vim: ts=3:nowrap +// +// Description: Toggle between bookmark and browse search results. +// +{% endcomment %} + +POPC2.prototype.toggleBookmarkDisplay = function () { + this.DebugMessageFunction(); + + let belement = document.querySelector("#bookmark-browse-button"); + if (!belement) { + console.log("CANNOT FIND B ELEMENT"); + return; + } + + let state = 0; + if (belement.classList.contains("selected")) { + state = 1; + } + + let felement = document.querySelector("#filters"); + let h1element = document.querySelector("h1"); + + state = !state; + if (state) { + belement.classList.add("selected"); + if (felement) { + felement.classList.add("hidden"); + } + this.VARS.SEARCH_RESULTS = this.VARS.WORK_BOOKMARKS; + if (h1element) { + h1element.innerHTML = this.getTranslation("bookmarks"); + } + } else { + belement.classList.remove("selected"); + if (felement) { + felement.classList.remove("hidden"); + } + if (h1element) { + h1element.innerHTML = this.getTranslation("title"); + } + } + + this.displayBrowseTable(); +}; + +Object.defineProperty(POPC2.prototype.toggleBookmarkDisplay, "name", { value: "toggleBookmarkDisplay" }); + + + diff --git a/_includes/handlebars/helper-bookmarkHide.js b/_includes/handlebars/helper-bookmarkHide.js new file mode 100644 index 0000000..9d014c3 --- /dev/null +++ b/_includes/handlebars/helper-bookmarkHide.js @@ -0,0 +1,31 @@ +{% comment %} +// +// Programmer: Craig Stuart Sapp +// Creation Date: Sat Oct 30 22:36:48 PDT 2021 +// Last Modified: Sat Oct 30 22:36:51 PDT 2021 +// Filename: _includes/handlebars/helper-bookmarkHide.js +// Used by: +// Included in: _includes/handlebars/main.html +// Syntax: ECMAScript 6 +// vim: ts=3:nowrap +// +// Description: Hide something (filter menu) if bookmarks are active. +// +{% endcomment %} + +Handlebars.registerHelper("bookmarkHide", function() { + let belement = document.querySelector("#bookmark-browse-button"); + let bookmarks = false; + if (belement && belement.classList.contains("selected")) { + bookmarks = true; + } + + if (bookmarks) { + return new Handlebars.SafeString("hidden"); + } + + return new Handlebars.SafeString(""); +}); + + + diff --git a/_includes/handlebars/helper-showTitle.js b/_includes/handlebars/helper-showTitle.js new file mode 100644 index 0000000..5cf6832 --- /dev/null +++ b/_includes/handlebars/helper-showTitle.js @@ -0,0 +1,33 @@ +{% comment %} +// +// Programmer: Craig Stuart Sapp +// Creation Date: Sat Oct 30 22:22:19 PDT 2021 +// Last Modified: Sat Oct 30 22:22:22 PDT 2021 +// Filename: _includes/handlebars/helper-showTitle.js +// Used by: +// Included in: _includes/handlebars/main.html +// Syntax: ECMAScript 6 +// vim: ts=3:nowrap +// +// Description: Display the page title (on the browse page). This is +// usually the website title, but could be "Bookmarks" or +// "History" view. +// +{% endcomment %} + +Handlebars.registerHelper("showTitle", function() { + let belement = document.querySelector("#bookmark-browse-button"); + let bookmarks = false; + if (belement && belement.classList.contains("selected")) { + bookmarks = true; + } + + if (bookmarks) { + return new Handlebars.SafeString(popc2.getTranslation("bookmarks")); + } + + return new Handlebars.SafeString(popc2.getTranslation("title")); +}); + + + diff --git a/_includes/handlebars/main.html b/_includes/handlebars/main.html index f993e64..cf76661 100644 --- a/_includes/handlebars/main.html +++ b/_includes/handlebars/main.html @@ -21,6 +21,8 @@ diff --git a/_includes/handlebars/template-browse.html b/_includes/handlebars/template-browse.html index 7898d05..4dcac4e 100644 --- a/_includes/handlebars/template-browse.html +++ b/_includes/handlebars/template-browse.html @@ -2,7 +2,7 @@ // // Programmer: Craig Stuart Sapp // Creation Date: Fri Oct 8 23:22:31 PDT 2021 -// Last Modified: Sat Oct 16 17:21:01 PDT 2021 +// Last Modified: Sat Oct 30 22:21:12 PDT 2021 // Filename: _includes/handlebars/template-browse.html // Included in: _includes/handlebars/main.html // Syntax: HTML; Handlebars; Jekyll/Liquid @@ -15,10 +15,10 @@ {% raw %}