vanilla_respondage/scripts/custom.js
Tammo ter Hark cffd3cefa6 feat!: rename theme respondage_vanilla -> vanilla_respondage, variants -> respondage_<client>
Prompt V (prompts.md rows 51-54). Mother theme folder + <name> renamed to
vanilla_respondage (version 3.3.0); client variants renamed to
respondage_defensie / respondage_erasmus (<extends>vanilla_respondage</extends>,
auto-derived by build.php). export_public.sh now derives the release name from
the theme dir and the leak-check glob matches ../respondage_* siblings, so the
public-release leak check keeps working after the rename (sabotage-tested).
All doc/tooling references updated; local-only files stay gitignored.

Also includes the pending uncommitted theme work from this testing week
(custom options page, header logos, sticky-header options, bundled OFL fonts,
per-element font overrides, font-dropdown reordering, jsdom tests) that was
verified locally but not yet pushed.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-24 22:04:11 +01:00

62 lines
2.8 KiB
JavaScript

/******************
User custom JS
---------------
Put JS-functions for your template here.
If possible use a closure, or add them to the general Template Object "Template"
*/
$(document).on('ready pjax:scriptcomplete',function(){
/**
* Code included inside this will only run once the page Document Object Model (DOM) is ready for JavaScript code to execute
* @see https://learn.jquery.com/using-jquery-core/document-ready/
*/
// Replace classes
$('.container-fluid').addClass('container');
$('.container-fluid').removeClass('container-fluid');
// Remove classes
$('.survey-name.text-center').removeClass('text-center');
$('.survey-description.text-center').removeClass('text-center');
$('.survey-welcome.h5.text-primary').removeClass('text-primary');
$('.survey-welcome.h5').removeClass('h5');
$('.ls-privacy-head.h4.text-primary').removeClass('text-primary');
$('.ls-privacy-head.h4').removeClass('h4');
$('.space-col').removeClass('space-col'); //The presence of .space-col is one of the greatest mistakes in the Vanilla theme IMHO
$('.group-title.text-center.h3').removeClass('h3');
$('.group-title.text-center').removeClass('text-center');
$('.text-info').removeClass('text-info');
$('.text-muted').removeClass('text-muted');
$('.limit-text-window').removeClass('limit-text-window');
$('.save-message.card').removeClass('card');
$('.save-message.bg-light').removeClass('bg-light');
$('.save-survey-form.col-lg-8.offset-lg-2').removeClass('offset-lg-2');
$('.save-survey-form.col-lg-8').removeClass('col-lg-8');
$('.save-message .card-body').removeClass('card-body');
$('.navbar-light.bg-light').removeClass('bg-light');
$('.privacy.row').removeClass('row');
/**
* THEME ADDITION: the header (#survey-nav) is sticky only on the selected
* screen sizes (theme options headersticky + headersticky{computer,tablet,
* mobile}, applied as media queries in custom_header.twig). The parent
* theme.js fixBodyPadding() assumes a permanently fixed header and always
* sets body padding-top to the header height; this correction runs after it
* and removes that padding when the header is NOT fixed at the current
* viewport width (computed position != 'fixed').
*/
var fixBodyPaddingSticky = function () {
var nav = $('#survey-nav');
if (!nav.length) { return; }
if (nav.css('position') === 'fixed') {
$('body').css('padding-top', Math.round(nav.height()) + 'px');
} else {
$('body').css('padding-top', '');
}
};
// namespaced so re-running on pjax:scriptcomplete never stacks duplicate handlers
$(window).off('resize.stickyheader').on('resize.stickyheader', fixBodyPaddingSticky);
fixBodyPaddingSticky();
});