# Early books on Australia, New Zealand and the Pacific
**Source**: https://digital.library.sydney.edu.au/nodes/view/15126
**Parent**: https://digital.library.sydney.edu.au/
[Skip to content](#main_content)
- [Home](https://digital.library.sydney.edu.au/)
- [Browse All](https://digital.library.sydney.edu.au/nodes/browse)
- [Search](https://digital.library.sydney.edu.au/nodes/definesearch)
- [My History](https://digital.library.sydney.edu.au/pages/history)
- [Login](https://digital.library.sydney.edu.au/users/login)
- More
- [How to contribute](https://digital.library.sydney.edu.au/pages/howtocontribute)
- [Login](https://digital.library.sydney.edu.au/users/login)
- [Register](https://digital.library.sydney.edu.au/users/register)
15126
var texttype = "METADATA";
var textedit = "0";
var textview = "1";
var overrideShowHitsPopup = "no";
var initText = "1";
$(function() {
$("#cloneitembutton").button().on("click", function() {
var dialogCloneForm = '<div id="dialog-clone-form" title="Parent-child Relationship"><p><strong style="color:red;">Warning.</strong> Cloning this item will not retain its parent-child relationship.</p>' + '<form action="/nodes/cloneNode/15126" id="cloneitemform" method="post" accept-charset="utf-8"><div style="display:none;"><input type="hidden" name="\_method" value="POST" /><input type="hidden" name="data[\_Token][key]" value="e3df3a2d8b8333438b902756cf5eab86f6534e00" id="Token1112946575" /></div><div style="display:none;"><input type="hidden" name="data[\_Token][fields]" value="c3a662999949452b531ed8183b0541cae9bc4db9%3A" id="TokenFields1450075080" /></div></form>' + '</div>';
dialog = $(dialogCloneForm).dialog({
autoOpen: false,
height: 120,
width: 360,
modal: true,
buttons: {
// Restructured buttons slightly to retain custom colours over the jquery upgrade
Cancel: {
text: "Cancel",
class: "ui-state-default",
hover: function() {
$(this).toggleClass("hoverClass");
},
click: function() {
dialog.dialog("close");
}
},
// Restructured buttons slightly to retain custom colours over the jquery upgrade
"Confirm Clone": {
text: "Confirm Clone",
class: "ui-state-default",
hover: function() {
$(this).toggleClass("hoverClass");
},
click: function() {
document.getElementById("cloneitemform").submit();
}
}
},
close: function() {
dialog.dialog('destroy').remove();
}
});
dialog.dialog("open");
});
});
Open/Close Toolbox
Format: Collection
Linked To
**Collection**
- [Collections (4)](https://digital.library.sydney.edu.au/nodes/browse?filter=eyJudGlkcyI6WyIzIl0sImZhY2V0Ijp7IjExMzgiOlsiRWFybHkgYm9va3Mgb24gQXVzdHJhbGlhLCBOZXcgWmVhbGFuZCBhbmQgdGhlIFBhY2lmaWMiXX19&bid=15126 "Where Early books on Australia, New Zealand and the Pacific is the Collections")
**Text**
- [Collection (4)](https://digital.library.sydney.edu.au/nodes/browse?filter=eyJudGlkcyI6WyIyMyJdLCJmYWNldCI6eyI0NjAiOlsiRWFybHkgYm9va3Mgb24gQXVzdHJhbGlhLCBOZXcgWmVhbGFuZCBhbmQgdGhlIFBhY2lmaWMiXX19&bid=15126 "Where Early books on Australia, New Zealand and the Pacific is the Collection")
**Image**
- [Collection (2)](https://digital.library.sydney.edu.au/nodes/browse?filter=eyJudGlkcyI6WyIyNCJdLCJmYWNldCI6eyI0ODkiOlsiRWFybHkgYm9va3Mgb24gQXVzdHJhbGlhLCBOZXcgWmVhbGFuZCBhbmQgdGhlIFBhY2lmaWMiXX19&bid=15126 "Where Early books on Australia, New Zealand and the Pacific is the Collection")
Tools
[Download](https://digital.library.sydney.edu.au/nodes/download/15126)[Add to My Collection](https://digital.library.sydney.edu.au/users/bookmarks/add:15126)[Contact us about this](https://digital.library.sydney.edu.au/messages/create/15126)Citation for this item
[Drop down list of top links](#)
.xf-web-container {
margin-bottom: 0;
font-size: 16px;
line-height: 24px;
}
/\*! CSS Used from: https://www.sydney.edu.au/etc.clientlibs/library/clientlibs/library-frontend-svelte-css.css?a=nocache \*/
div,
span,
a,
ul,
li,
header,
section {
margin: 0;
padding: 0;
border: 0;
vertical-align: baseline;
}
header,
section {
display: block;
}
ul {
list-style: none;
}
a {
background-color: transparent;
font-family: "Apercu", Helvetica, sans-serif;
}
button {
font-family: inherit;
font-size: 100%;
line-height: 1.15;
margin: 0;
}
button {
overflow: visible;
}
button {
text-transform: none;
}
button,
[type="button"] {
-webkit-appearance: button;
}
ul,
li {
margin: 0;
padding: 0;
}
.xf-web-container {
box-sizing: border-box;
}
.sr-only {
position: absolute;
border: 0;
padding: 0;
margin: -1px;
overflow: hidden;
width: 1px;
height: 1px;
clip: rect(0, 0, 0, 0);
}
.m-link[data-type="anchorLink"] {
color: #ce3d20;
}
.m-link[data-type="anchorLink"]:hover,
.m-link[data-type="anchorLink"]:focus {
color: #ce3d20;
}
.m-grid {
box-sizing: border-box;
display: flex;
flex: 0 1 auto;
flex-flow: row wrap;
padding: 0;
margin: 0;
margin-right: calc(var(--m-grid-column-gap) / -2);
margin-left: calc(var(--m-grid-column-gap) / -2);
}
.m-grid\_\_cell {
box-sizing: border-box;
margin: 0;
padding: 0 calc(var(--m-grid-column-gap) / 2);
--m-grid-cell-max-width: 100%;
max-width: var(--m-grid-cell-max-width);
}
@media screen and (min-width: 576px) {
.\31\/3--mobile-up {
--m-grid-cell-max-width: 33.33333%;
flex-basis: var(--m-grid-cell-max-width);
max-width: var(--m-grid-cell-max-width);
}
}
@media screen and (min-width: 768px) {
.\32\/3--tablet-up {
--m-grid-cell-max-width: 66.66667%;
flex-basis: var(--m-grid-cell-max-width);
max-width: var(--m-grid-cell-max-width);
}
}
.m-link {
--link-font-size: "inherit";
color: #ce3d20;
text-decoration: none;
font-size: var(--link-font-size);
font-weight: 400;
}
.m-link:focus,
.m-link:hover {
color: #ce3d20;
cursor: pointer;
text-decoration: none;
}
.m-link--block {
display: block;
}
.m-link\_\_content {
text-decoration: underline;
}
.m-link--block {
display: flex;
flex-flow: row wrap;
align-items: center;
}
.m-link\_\_icon-right {
position: relative;
transition: right 0.2s;
margin-left: 6px;
right: 0;
}
.m-link:focus:not(.m-link--no-movement) .m-link\_\_icon-right,
.m-link:hover:not(.m-link--no-movement) .m-link\_\_icon-right {
right: -5px;
}
.m-link--default {
display: flex;
align-items: center;
}
.m-link--default span {
text-decoration: none;
}
.m-link--default--block {
display: block;
}
.m-button {
display: flex;
flex-flow: row nowrap;
justify-content: center;
align-items: center;
padding: 16px 32px;
font-weight: 700;
line-height: 1;
text-align: center;
transition: all 400ms;
cursor: pointer;
}
.m-button--button {
border: none;
}
.m-button\_\_content {
text-decoration: none;
line-height: 1;
}
.m-button\_\_icon-right {
margin-left: 8px;
}
.m-button[data-style="inline"] {
background: none;
border: 0;
color: #fff;
}
.m-button[data-style="inline"]:focus,
.m-button[data-style="inline"]:hover {
background: none;
text-decoration: underline;
}
.m-content-container {
box-sizing: border-box;
margin-left: auto;
margin-right: auto;
width: 100%;
max-width: 100%;
padding-left: 16px;
padding-right: 16px;
}
@media (min-width: 768px) {
.m-content-container {
padding-left: 16px;
padding-right: 16px;
}
}
@media (min-width: 992px) {
.m-content-container {
padding-left: 16px;
padding-right: 16px;
}
}
@media (min-width: 1200px) {
.m-content-container {
padding-left: 16px;
padding-right: 16px;
max-width: 1200px;
}
}
.site-header {
position: relative;
z-index: 1;
}
.site-header {
position: relative;
min-height: 80px;
z-index: 99999;
}
.m-lib-header {
position: relative;
top: 0;
width: 100%;
background: #141414;
padding: 8px 16px;
}
.m-lib-header\_\_container {
align-items: center;
}
.m-lib-header\_\_logo-content {
display: flex;
flex: 0 0 100%;
align-items: center;
color: #fff;
}
@media (max-width: 575px) {
.m-lib-header\_\_logo-content {
padding: 8px 0 0 0;
justify-content: space-between;
}
}
.m-lib-header\_\_logo-title {
font-family: "Apercu", Helvetica, sans-serif;
font-size: 32px;
line-height: 40px;
font-weight: 400;
text-decoration: none !important;
color: #fff;
}
.m-lib-header\_\_logo-titlelink {
text-decoration: none !important;
color: #fff;
}
.m-lib-header\_\_logo-titlelink:hover {
text-decoration: none !important;
color: #fff;
}
@media (min-width: 576px) {
.m-lib-header\_\_logo-titlelink {
display: inline-block;
margin-left: 20px;
}
}
.m-lib-header\_\_navs--tablet {
display: none;
}
@media (min-width: 576px) {
.m-lib-header\_\_navs--tablet {
display: flex;
flex: 1;
justify-content: flex-end;
}
}
@media (min-width: 992px) {
.m-lib-header\_\_navs--tablet {
justify-content: space-between;
}
}
.m-lib-header\_\_navs-item {
margin-left: 32px;
}
.m-lib-header\_\_navs-item:first-child {
margin-left: 0;
}
.m-lib-header\_\_navs-item .m-link {
color: #fff;
font-weight: 400;
}
.m-lib-header\_\_navs-item .m-link\_\_content {
text-decoration: none;
}
.m-lib-header\_\_navs-item .m-link:hover {
color: #141414;
}
@media (min-width: 768px) {
.m-lib-header\_\_navs-item .m-link:hover {
color: #fff;
}
}
.m-lib-header\_\_navs-link {
border-bottom: 2px solid #141414;
color: #fff;
font-family: "Apercu", Helvetica, sans-serif;
font-size: 16px;
line-height: 24px;
font-weight: 400;
text-decoration: none;
}
.m-lib-header\_\_navs-link:hover {
border-color: #fff;
}
.m-lib-header\_\_navs--primary-navs {
display: none;
}
@media (min-width: 992px) {
.m-lib-header\_\_navs--primary-navs {
display: flex;
justify-content: space-between;
}
}
@media (min-width: 768px) {
.m-lib-header\_\_navs--global-navs {
display: flex;
justify-content: space-between;
}
}
.m-lib-header\_\_mobile {
background: #fff;
display: none;
padding: 20px;
}
@media (max-width: 991px) {
.m-lib-header\_\_mobile {
display: block;
}
}
.m-lib-header\_\_mobile-pane {
position: absolute;
transform-origin: left top;
transform: scaleY(0);
margin-top: 0px;
z-index: 99910;
width: 100%;
}
@media (min-width: 768px) {
.m-lib-header\_\_mobile-pane {
top: 132px;
width: 30vw;
}
}
.m-lib-header\_\_mobile .m-lib-header\_\_navs {
border-top: 1px solid #d2d2d2;
padding-top: 20px;
margin-top: 20px;
}
.m-lib-header\_\_mobile .m-lib-header\_\_navs:first-child {
border-top: 0 none;
padding-top: 0;
margin-top: 0;
}
.m-lib-header\_\_mobile .m-lib-header\_\_navs-item {
padding-top: 20px;
margin: 0;
}
.m-lib-header\_\_mobile .m-lib-header\_\_navs-item:first-child {
padding-top: 0;
}
.m-lib-header\_\_mobile .m-lib-header\_\_navs-item .m-link {
color: #ce3d20;
}
.m-lib-header\_\_mobile .m-lib-header\_\_navs-link {
border-bottom: 2px solid #fff;
color: #141414;
font-size: 16px;
font-weight: 600;
line-height: 24px;
text-decoration: none;
transition: all 0.3s;
}
.m-lib-header\_\_mobile .m-lib-header\_\_navs-link:hover {
border-color: #ce3d20;
}
@media (min-width: 768px) {
.m-lib-header\_\_mobile .m-lib-header\_\_navs-global-links {
display: none;
}
}
.m-lib-cultural-wellbeing-link {
background: #40645c;
text-align: center;
}
.m-lib-cultural-wellbeing-link .m-button {
display: inline;
}
.m-lib-cultural-wellbeing-link .m-button\_\_icon-right {
--fill-colour: $colour-brand-white !important;
fill: #fff !important;
position: relative;
left: 0;
top: 2px;
transition: left 0.2s;
}
.m-lib-cultural-wellbeing-link .m-button:hover .m-button\_\_icon-right {
transition: left 0.2s;
left: 6px;
}
.m-lib-cultural-wellbeing-link .m-button\_\_content {
font-weight: 400;
}
#skiptocontent a {
padding: 5px;
position: fixed;
top: -40px;
left: 0px;
color: white;
border-right: 1px solid white;
border-bottom: 1px solid white;
border-bottom-right-radius: 8px;
background: #ce3d20;
transition: top 0.5s ease-out;
z-index: 100;
}
#skiptocontent a:focus {
left: 0px;
top: 0px;
outline-color: transparent;
transition: top 0.05s ease-in;
}
/\* Recollect custom mobile integration code \*/
@media (max-width: 790px) {
.m-logo {
margin-left: 20px;
}
.m-lib-header {
width: auto;
}
}
# Early books on Australia, New Zealand and the Pacific
Details
Collection Description
Books published or created before 1900 about Australia, New Zealand, and the Pacific.
\
\
\
\
Collection
[\
The Allan E. Bax collection](https://digital.library.sydney.edu.au/nodes/view/13640)
[\
Evelyn Nicholson’s trip to Australia, 1897.](https://digital.library.sydney.edu.au/nodes/view/7536)
[\
Joseph Henry Maiden Botanical Texts](https://digital.library.sydney.edu.au/nodes/view/7534)
[\
Australian Digital Collections](https://digital.library.sydney.edu.au/nodes/view/7524)
Text
[\
Proclamation : His excellency the Governor anxious to promote the tranquillity of the colony, to prevent improper and malicious litigation](https://digital.library.sydney.edu.au/nodes/view/15142)
[\
A specimen of the botany of New Holland](https://digital.library.sydney.edu.au/nodes/view/15127)
[\
Journal of a Voyage to New South Wales with sixty-five plates of non descript animals, birds, lizards, serpents, curious cones of trees and other natural productions](https://digital.library.sydney.edu.au/nodes/view/14688)
[\
An epitome of the natural history of the insects of New Holland, New Zealand, New Guinea, Otaheite, and other islands in the Indian, Southern, and Pacific Oceans](https://digital.library.sydney.edu.au/nodes/view/8232)
Image
[\
Sketchbook, 1854-1860](https://digital.library.sydney.edu.au/nodes/view/15092)
[\
Evelyn Nicholson's sketchbook, 1897.](https://digital.library.sydney.edu.au/nodes/view/7539)
*Early books on Australia, New Zealand and the Pacific*. University of Sydney Library, accessed 10/03/2026, https://digital.library.sydney.edu.au/nodes/view/15126
#threedeeCont,
#narImgCont {
background: #ffffff url("/img/ajax-loader.gif") no-repeat center center;
}
#autoplayer {
height: auto;
width: auto;
background: #ffffff url("/img/ajax-loader.gif") no-repeat center center !important;
}
.narImgCont\_close {
margin: 20px;
position: fixed;
}
span.marker {
background-color: #ffff00;
}
@media only screen and (max-width: 790px) {
#viewport.pdf {
display: block;
height: auto !important;
}
.pdf iframe {
display: block;
height: 100vh !important;
}
}
span.xsmall {
font-size: 12px;
}
.xhide {
display: none;
}
#gridtools {
display: none;
margin: 8px;
white-space: nowrap;
}
#eddy,
#eddyGrid {
display: inline-block;
}
.button {
border-radius: 5px;
}
a.disableClick {
color: #888888;
background-color: #cccccc;
border-color: #cccccc;
cursor: default;
pointer-events: none;
}
.form\_validation\_message {
color: red;
opacity: 0;
}
.error\_form {
border: 1px solid red;
outline: none;
}
.submit input:disabled {
background: #b9b9b9;
border: #b9b9b9;
}
/\* BB COSA-1412\*/
#jumpto ul {
z-index: 99;
}
/\* BB R1X-3135\*/
div#buttonsFullMonty {
float: left;
display: none;
}
div#buttonsFullMonty input {
vertical-align: -webkit-baseline-middle;
}
div#ocrbar.fullmonty {
position: absolute !important;
width: calc(100% - 110px);
z-index: 98 !important;
}
div#viewport.fullmonty {
position: relative;
z-index: 98 !important;
}
#ocrbar {
display: block;
}
div#ocrbar.tinymonty {
display: none !important;
}
.vscancolor {
color: orange !important;
font-size: 28px;
}
@media only screen and (max-width: 790px) {
html body #ocrbar {
display: none !important;
}
}
/\* BB R1X-3135 - toggle asset/text full screen\*/
$("#toggleFullText").change(function() {
transcriptionBlock.toggleFullText($(this));
});
$("#toggleFullAsset").change(function() {
transcriptionBlock.toggleFullAsset($(this));
});
var gridTable = '';
$('img.kaboom').css({
cursor: 'pointer'
}).on('click', function() {
var img = $(this);
//var url = location.origin;
var url = '';
var close = $('<span class="narImgCont\_close close-icon" ></span>');
var bigImg = $('<img />').css({
'max-width': '100%',
'max-height': '100%',
'height': 'auto',
'width': 'auto',
'display': 'inline'
});
bigImg.attr({
//src: img.attr('src'),
src: "/assets/display/" + img.attr('id') + "-max",
alt: img.attr('alt'),
title: img.attr('title')
});
var over = $('<div />').text(' ').css({
'height': '100%',
'width': '100%',
'background': 'rgba(0,0,0,.82)',
'position': 'fixed',
'top': 0,
'left': 0,
'padding': '20px',
'opacity': 0.0,
'cursor': 'pointer',
'z-index': '9999',
'text-align': 'center'
}).append(bigImg, close).bind('click', function() {
$(this).fadeOut(300, function() {
$(this).remove();
$('div#viewport').css('z-index', 'initial');
});
}).insertAfter(this).animate({
'opacity': 1
}, 300);
$('div#viewport').css('z-index', '4');
});
/\*\*
\* Pops up the Page Hits highlighting window.
\* @author WR
\*/
function popupPageHits() {
$("#searchresultsdiv").dialog({
width: 300,
height: 400,
resizable: true,
title: "Search Result Page Hits",
position: {
my: "right top",
at: "right top",
of: "#viewport"
}
});
lazyImages();
}
// Exact phrase match search has highlights.
if (overrideShowHitsPopup === 'yes') {
// Automatically show the popup on page load.
popupPageHits();
}
/\*
\* Refactoring Note:
\* The function 'initPop(idx)' (responsible for displaying OCR/Transcription results on Page load as default behaviour)
\* is moved to 'recollect3.js' as 'showOcrTranscriptionOnPageLoad(idx, texttype, textedit, textview)' to improve modularity
\* and separation of concerns.This change helps in maintaining and testing the OCR functionality independently.
\*/
if (texttype !== 'METADATA') {
console.log("T-type: " + texttype);
idx = transcriptionBlock.getPageHash();
console.log("T-idx: " + idx);
//Show default view (ORC/Transcript) on page load
transcriptionBlock.showOcrTranscriptionOnPageLoad(idx, texttype, textedit, textview)
var popLoaded = 1;
}
//@ST COSA-1324 : 2020-01-13. Function for image tag form validation.
function getFormValidation(obj, value, userLevel) {
// Old pattern that was creating issues with comma, see below
// var patternOld = /['<','>','&']/;
// Changed to new regex that accepts comma and still denies other characters https://recollectnz.atlassian.net/browse/R1X-6281
var pattern = /[<>&]/;
if (userLevel != "Administrator") {
if (pattern.test(value)) {
obj.previousElementSibling.style.opacity = 1;
$('.newrec').addClass('error\_form');
$('.submit')[1].children[0].setAttribute("disabled", "disabled");
} else {
obj.previousElementSibling.style.opacity = 0;
$('.newrec').removeClass('error\_form');
$('.submit')[1].children[0].removeAttribute("disabled");
} // if ENDS
} // if ENDS
} // function ENDS
$(document).ready(function() {
// @ST timeline script
var embed;
if (document.getElementById('timeline-embed') !== null) {
embed = document.getElementById('timeline-embed');
//embed.style.height = getComputedStyle(document.body).height;
window.timeline = new TL.Timeline('timeline-embed', Array, {
hash\_bookmark: false
});
window.addEventListener('resize', function() {
var embed = document.getElementById('timeline-embed');
//embed.style.height = getComputedStyle(document.body).height;
timeline.updateDisplay();
});
}
});
(function() {
//if it doesn't have "#back-forward" block set null
var $el = document.getElementById("back-forward") || null;
//if page doesn't have this element break function
if (!$el) return;
//small helpers
const getNewObj = (k, v) => {
return {
[k]: v
}
};
const parseReq = (str) => str.replace("?", "&").split("&").map(e => e.split("=")).filter(e => e[0] != "").map(e => getNewObj(e[0], e[1]));
const getValue = (obj) => Object.values(obj);
//encode array of the elements
var encoding = function(str) {
var result;
try {
result = btoa(unescape(encodeURIComponent(str)));
} catch (e) {
console.error("Error on ENCODING FUNCTION." + e);
}
return result;
}
//decode string
var decoding = function(str) {
var result;
try {
result = decodeURIComponent(escape(atob(decodeURIComponent(str))));
} catch (e) {
console.error("Error on DECODING FUNCTION." + e);
}
return result;
}
//parse string
var jsonParse = function(param) {
var result;
try {
result = JSON.parse(param);
} catch (e) {
console.error("Error on JSON PARSE FUNCTION." + e);
}
return result;
}
//XSS protection
var encodingHtmlEntities = function(str) {
return String(str).replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"'); //.replace(/&/g, '&')
}
//get localStorageKey from URL
const localStorageKey = parseReq(window.location.search).filter(e => Object.keys(e) == "lsk");
const otherKeys = parseReq(window.location.search).filter(e => Object.keys(e) != "lsk");
let searchParam = "";
otherKeys.forEach(e => {
searchParam += "&" + Object.keys(e) + "=" + Object.values(e);
});
//if don't have a key in URL break function
if ((localStorageKey && localStorageKey.length === 0)) return;
//get key from string
const KEY = localStorageKey[0].lsk;
//this key doesn't have a data break function
if (!window.localStorage.getItem(KEY) && !window.sessionStorage.getItem(KEY)) return;
var cleanLocalStorage = function() {
for (let key in window.sessionStorage) {
if ((key != KEY) && (key != "\_" + KEY)) {
window.sessionStorage.removeItem(key);
}
}
}
if (Object.keys(window.sessionStorage).length > 1) {
cleanLocalStorage();
}
//return current ID
var getCurrentId = function() {
let path = window.location.pathname.split('/');
return path[path.length - 1];
}
//get position of element in an array
var getPositionInArray = function(sessionStorage) {
for (let i = 0; i < sessionStorage.length; i++) {
if (Object.keys(sessionStorage[i])[0] == getCurrentId()) {
return i;
}
}
return 0;
}
//get range
var ss\_getRange = function(sessionStorage) {
const array = jsonParse(decoding(sessionStorage));
let position = Number(getPositionInArray(array));
return range = {
prev: array[position - 1] ? array[position - 1] : {},
current: array[position] ? array[position] : {},
next: array[position + 1] ? array[position + 1] : {},
position
}
}
//generate object of position, index, page and length
var getPosition = function() {
let arr = jsonParse(decoding(currentStorage.searchSet));
let position = {
page: currentStorage.page,
index: getPositionInArray(arr),
length: arr.length
};
return position;
}
var getByPosition = function(array, idx) {
return jsonParse(decoding(array))[idx];
}
if (!window.sessionStorage.getItem(KEY)) {
window.sessionStorage.setItem("\_" + KEY, window.localStorage.getItem(KEY));
window.localStorage.removeItem(KEY);
}
//get initial information from LocalStorage
const searchResult = jsonParse(decoding(window.sessionStorage.getItem("\_" + KEY)));
const itemsSet = searchResult.itemsSet;
const searchReq = decoding(searchResult.request);
const pageCount = jsonParse(searchResult.pageCount);
const countElem = jsonParse(searchResult.countElem);
//set local variable
let perPage = jsonParse(searchResult.perPage);
let requestWasSent = false;
//SESSION SECTION
let sessionKey = KEY;
//get sessionStorage by key, if it's not exist set null
let sessionStorage = window.sessionStorage.getItem(sessionKey) || null;
let sessionItemSet = "";
if (sessionStorage) {
sessionItemSet = JSON.parse(sessionStorage).searchSet;
} else {
sessionItemSet = itemsSet;
}
//create local state
let currentStorage = {
page: jsonParse(searchResult.currentPage),
prevSearchSet: "",
searchSet: sessionItemSet,
nextSearchSet: "",
current: ss\_getRange(itemsSet).current,
prev: ss\_getRange(itemsSet).prev,
next: ss\_getRange(itemsSet).next,
position: ss\_getRange(itemsSet).position
}
var setSessionStorage = function() {
window.sessionStorage.setItem(sessionKey, JSON.stringify(currentStorage))
}
//if sessionStorage empty set it with initialState of currentStorage
//if sessionStorage has this key update it with new value
if (!sessionStorage) {
let range = ss\_getRange(itemsSet);
setSessionStorage();
pageNumber = searchResult.currentPage;
} else {
let currentArray = jsonParse(sessionStorage).searchSet;
let currentPage = jsonParse(sessionStorage).page;
let currentRange = ss\_getRange(currentArray);
currentStorage.page = jsonParse(sessionStorage).page;
// currentStorage.current = ss\_getRange(itemsSet).current;
// currentStorage.prev = ss\_getRange(itemsSet).prev;
// currentStorage.next = ss\_getRange(itemsSet).next;
// currentStorage.position = ss\_getRange(itemsSet).position;
currentStorage.current = ss\_getRange(jsonParse(sessionStorage).searchSet).current;
currentStorage.prev = ss\_getRange(jsonParse(sessionStorage).searchSet).prev;
currentStorage.next = ss\_getRange(jsonParse(sessionStorage).searchSet).next;
currentStorage.position = ss\_getRange(jsonParse(sessionStorage).searchSet).position;
currentStorage.prevSearchSet = jsonParse(sessionStorage).prevSearchSet;
currentStorage.nextSearchSet = jsonParse(sessionStorage).nextSearchSet;
if (currentStorage.position === 0 && currentStorage.prevSearchSet != "") {
let prevSet = currentStorage.prevSearchSet;
currentStorage.prev = getByPosition(prevSet, jsonParse(decoding(prevSet)).length - 1);
}
if (currentStorage.position === jsonParse(decoding(currentArray)).length - 1 && currentStorage.nextSearchSet != "") {
let nextSet = currentStorage.nextSearchSet;
currentStorage.next = getByPosition(nextSet, 0);
}
setSessionStorage();
}
let nextPage = currentStorage.page;
//update set of nodes array
var updateLocalStorage = function(data, searchReq, pageNum) {
let newitemsSet = data.nodes.map(e => e.Node).map(e => {
let x = {
[e.id]: e.title
};
return x;
});
let newSet = encoding(JSON.stringify(newitemsSet));
let range = ss\_getRange(currentStorage.searchSet);
if (currentStorage.position == 0) {
currentStorage.prev = getByPosition(newSet, newitemsSet.length - 1);
currentStorage.prevSearchSet = newSet;
}
if (currentStorage.position == (jsonParse(decoding(currentStorage.searchSet)).length - 1) && jsonParse(decoding(currentStorage.searchSet)).length > 1) {
currentStorage.next = getByPosition(newSet, 0);
currentStorage.nextSearchSet = newSet;
}
setSessionStorage();
createButtonsBlock();
}
var sendRequest = function(direction) {
let pageNum = 1;
if (direction.page == 1) {
pageNum = direction.index == 0 ? 1 : (Number(direction.page) + 1);
} else if (direction.page > 1 && direction.page < pageCount) {
pageNum = direction.index == 0 ? (Number(direction.page) - 1) : (Number(direction.page) + 1);
} else {
pageNum = direction.index == 0 ? (Number(direction.page) - 1) : pageCount;
}
const regex = /(page=\d\*)/ius;
let otherReq = searchReq != "" ? (regex.test(searchReq)) ? searchReq.replace(regex, `page=${pageNum}`) : `${searchReq}&page=${pageNum}` : `?page=${pageNum}`;
let newRequest = (searchReq != "" && regex.test(searchReq)) ? searchReq.replace(regex, `page=${pageNum}`) : otherReq;
$.get('/nodes/search\_result/1' + newRequest, data => updateLocalStorage(data, newRequest, pageNum));
}
var getNewArrayOfIds = async function(position) {
if (position.index != 0 && position.index != position.length - 1) {
return;
}
if (((Number(position.index) == position.length - 1) && (Number(position.page) < pageCount)) ||
((Number(position.index) == 0) && (Number(position.page) > 1 && Number(position.page) <= pageCount))) {
if (!requestWasSent) {
await sendRequest(position);
requestWasSent = true;
}
}
}
var getURL = function(pathname = false) {
if (pathname) {
return window.location.origin + window.location.pathname;
}
return window.location.origin;
}
var getParam = function() {
return window.location.search
}
// Added directionForAria - to allow a screen reader to announce 'next item:item title.'
// Unsure if it's safe to change the exisiing data-dir for this - it may be referenced somewhere else.
var createBtn = function(id, title, direct, directionForAria) {
return `<span>
<a href="${getURL()}/nodes/view/${id}?lsk=${KEY}${searchParam}" aria-label='${directionForAria} Item:${title}' title="${encodingHtmlEntities(title)}" data-dir='${direct}'><i class='fa fa-chevron-${direct}'></i></a>
</span>`;
}
var createButtonsBlock = function() {
let rangePrev = Object.keys(currentStorage.prev).length > 0 ? currentStorage.prev : 0;
let rangeNext = Object.keys(currentStorage.next).length > 0 ? currentStorage.next : 0;
let prev = rangePrev != 0 ? rangePrev : "none";
let next = rangeNext != 0 ? rangeNext : "none";
let prevBtn = "<a href='#' style='pointer-events: none;'><i class='fa fa-chevron-left'></i></a>";
let nextBtn = "<a href='#' style='pointer-events: none;'><i class='fa fa-chevron-right'></a>";
if (prev != "none") {
prevBtn = createBtn(Object.keys(prev), Object.values(prev), "left", "Previous");
prevId = Object.keys(prev);
}
if (next != "none") {
nextBtn = createBtn(Object.keys(next), Object.values(next), "right", "Next");
nextId = Object.keys(next);
}
let pos = getPosition();
getNewArrayOfIds(pos);
let arrCount = perPage > 0 ? perPage : 24;
let searchPos = Number(pos.page) == 1 ? (pos.index + 1) : (((Number(pos.page) - 1) \* arrCount) + (pos.index + 1));
$el.innerHTML = `<div class="nav-btn left-btn">${prevBtn}</div>
<div class="nav-btn result-btn">Result ${searchPos} from ${countElem}</div>
<div class="nav-btn bingo right-btn">${nextBtn}</i></div>`;
$('[data-dir="left"]').one('click', () => {
if (pos.index == 0) {
nextPage = currentStorage.page - 1;
}
});
$('[data-dir="right"]').one('click', () => {
if (pos.index == pos.length - 1) {
nextPage = currentStorage.page + 1;
}
});
}
createButtonsBlock();
window.addEventListener('beforeunload', (event) => {
// DF 2023-02-15 R1X-8549 Should not call event.preventDefault() if we don't want
// to propmt the "Are you sure you want to leave the page"-dialog.
if (window.sessionStorage.getItem(sessionKey)) {
if (currentStorage.nextSearchSet != "" || currentStorage.prevSearchSet != "") {
if (currentStorage.page != 1 || currentStorage.page != pageCount) {
if (nextPage > currentStorage.page) {
currentStorage.prevSearchSet = currentStorage.searchSet;
currentStorage.searchSet = currentStorage.nextSearchSet;
currentStorage.nextSearchSet = "";
currentStorage.next = {};
}
if (currentStorage.page > nextPage) {
currentStorage.nextSearchSet = currentStorage.searchSet;
currentStorage.searchSet = currentStorage.prevSearchSet;
currentStorage.prevSearchSet = "";
currentStorage.prev = {};
}
currentStorage.page = nextPage;
}
}
setSessionStorage();
}
}, {
once: true
});
//TO HIDE PARAMS. IT REMOVES PARAMS FROM URL
// history.pushState("", null, getURL(true));
})()
#back-forward {
display: flex;
width: 100%;
max-width: 100%;
justify-content: space-between;
box-sizing: border-box;
/\* margin: 5px 0 5px 5px; \*/
border-radius: 4px;
}
.nav-btn {
padding: 5px;
background-color: #f0f0f0;
}
.left-btn {
border-radius: 2px 0 0 2px;
background-color: #fff;
border: 1px solid #e5e5ee;
}
.right-btn {
border-radius: 0 2px 2px 0;
background-color: #fff;
border: 1px solid #e5e5ee;
}
.result-btn {
/\* font-size: 1.1em;
font-weight: 700; \*/
width: 100%;
border-top: 1px solid #e5e5ee;
border-bottom: 1px solid #e5e5ee;
text-align: center;
}
#dialog-clone-form {
display: none;
}