Changeset View
Changeset View
Standalone View
Standalone View
swh/web/assets/src/bundles/webapp/webapp-utils.js
Show First 20 Lines • Show All 307 Lines • ▼ Show 20 Lines | export function setSwhIdsContext(swhidsContext) { | ||||
for (let swhidContext of swhidsContext) { | for (let swhidContext of swhidsContext) { | ||||
swhidsContext_[swhidContext.object_type] = swhidContext; | swhidsContext_[swhidContext.object_type] = swhidContext; | ||||
} | } | ||||
} | } | ||||
export function getSwhIdsContext() { | export function getSwhIdsContext() { | ||||
return swhidsContext_; | return swhidsContext_; | ||||
} | } | ||||
function setFullWidth(fullWidth) { | |||||
if (fullWidth) { | |||||
$('#swh-web-content').removeClass('container'); | |||||
$('#swh-web-content').addClass('container-fluid'); | |||||
} else { | |||||
$('#swh-web-content').removeClass('container-fluid'); | |||||
$('#swh-web-content').addClass('container'); | |||||
} | |||||
localStorage.setItem('swh-web-full-width', JSON.stringify(fullWidth)); | |||||
$('#swh-full-width-switch').prop('checked', fullWidth); | |||||
} | |||||
export function fullWidthToggled(event) { | |||||
setFullWidth($(event.target).prop('checked')); | |||||
} | |||||
export function setContainerFullWidth() { | |||||
let previousFullWidthState = JSON.parse(localStorage.getItem('swh-web-full-width')); | |||||
if (previousFullWidthState !== null) { | |||||
setFullWidth(previousFullWidthState); | |||||
} | |||||
} |