Further split up the supporter JS into functions
This commit is contained in:
parent
8a9f796eb1
commit
73e30c30e8
1 changed files with 9 additions and 6 deletions
|
@ -36,7 +36,7 @@ if (window.location.hash === "#renew") {
|
||||||
window.location.hash = "#renewal";
|
window.location.hash = "#renewal";
|
||||||
}
|
}
|
||||||
|
|
||||||
function init_sustainer_forms () {
|
function init_sustainer_form_validation () {
|
||||||
// Forms start in "invalid" form, with the errors shown, so that
|
// Forms start in "invalid" form, with the errors shown, so that
|
||||||
// non-Javascript users see the errors by default and know what they must
|
// non-Javascript users see the errors by default and know what they must
|
||||||
// enter. Now we hide those for JavaScript users:
|
// enter. Now we hide those for JavaScript users:
|
||||||
|
@ -85,7 +85,9 @@ function init_sustainer_forms () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function init_sustainer_type_switching () {
|
||||||
var selectSupportType = function(event) {
|
var selectSupportType = function(event) {
|
||||||
var $selectedLink = $(event.target);
|
var $selectedLink = $(event.target);
|
||||||
$(".supporter-type-selector a").removeClass("supporter-type-selector-selected");
|
$(".supporter-type-selector a").removeClass("supporter-type-selector-selected");
|
||||||
|
@ -107,10 +109,10 @@ function init_sustainer_forms () {
|
||||||
};
|
};
|
||||||
|
|
||||||
function init_expanders () {
|
function init_expanders () {
|
||||||
// Conservancy does a lot each year, so we initially hide the "Year in
|
// To avoid hitting visitors with a wall of text, we initially hide the
|
||||||
// Review" text insideexpandable <details> sections to avoid a wall of
|
// "Year in Review" and similar text inside expandable <details>
|
||||||
// text. If the URL fragment matches one of our expandable sections, we
|
// sections. If the URL fragment references one of these sections, we open
|
||||||
// automatically expand it - that's a direct link.
|
// that section.
|
||||||
let details = qs('details' + window.location.hash) // eg. #WritingAndSpeaking
|
let details = qs('details' + window.location.hash) // eg. #WritingAndSpeaking
|
||||||
if (window.location.hash && details) {
|
if (window.location.hash && details) {
|
||||||
details.open = true;
|
details.open = true;
|
||||||
|
@ -129,5 +131,6 @@ function init_expanders () {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
init_sustainer_forms();
|
init_sustainer_form_validation();
|
||||||
|
init_sustainer_type_switching();
|
||||||
init_expanders();
|
init_expanders();
|
||||||
|
|
Loading…
Reference in a new issue