Browse Source

facet decimal removal

master
rdrew 3 weeks ago
parent
commit
50681e865e
  1. 2
      .php-cs-fixer.cache
  2. 32
      js/nouislider-year-format.js
  3. 2
      olivesnews.libraries.yml
  4. 8
      olivesnews.theme

2
.php-cs-fixer.cache

@ -1 +1 @@
{"php":"8.5.4","version":"3.94.2","indent":" ","lineEnding":"\n","rules":{"nullable_type_declaration":true,"operator_linebreak":true,"ordered_types":{"null_adjustment":"always_last","sort_algorithm":"none"},"single_class_element_per_statement":true,"types_spaces":true,"array_indentation":true,"array_syntax":true,"attribute_block_no_spaces":true,"cast_spaces":true,"concat_space":{"spacing":"one"},"function_declaration":{"closure_fn_spacing":"none"},"method_argument_space":{"after_heredoc":false},"new_with_parentheses":{"anonymous_class":false},"single_line_empty_body":true,"single_space_around_construct":{"constructs_followed_by_a_single_space":["abstract","as","case","catch","class","const","const_import","do","else","elseif","enum","final","finally","for","foreach","function","function_import","if","insteadof","interface","match","named_argument","namespace","new","private","protected","public","readonly","static","switch","trait","try","type_colon","use","use_lambda","while"],"constructs_preceded_by_a_single_space":["as","else","elseif","use_lambda"]},"trailing_comma_in_multiline":{"after_heredoc":true,"elements":["arguments","array_destructuring","arrays","match","parameters"]},"binary_operator_spaces":{"default":"at_least_single_space"},"blank_line_after_opening_tag":true,"blank_line_between_import_groups":true,"blank_lines_before_namespace":true,"braces_position":{"allow_single_line_anonymous_functions":false,"allow_single_line_empty_anonymous_classes":true},"class_definition":{"inline_constructor_arguments":false,"space_before_parenthesis":true},"compact_nullable_type_declaration":true,"declare_equal_normalize":true,"lowercase_cast":true,"lowercase_static_reference":true,"modifier_keywords":true,"no_blank_lines_after_class_opening":true,"no_extra_blank_lines":{"tokens":["use"]},"no_leading_import_slash":true,"no_whitespace_in_blank_line":true,"ordered_class_elements":{"order":["use_trait"]},"ordered_imports":{"imports_order":["class","function","const"],"sort_algorithm":"none"},"return_type_declaration":true,"short_scalar_cast":true,"single_import_per_statement":{"group_to_single_imports":false},"single_trait_insert_per_statement":true,"ternary_operator_spaces":true,"unary_operator_spaces":{"only_dec_inc":true},"blank_line_after_namespace":true,"constant_case":true,"control_structure_braces":true,"control_structure_continuation_position":true,"elseif":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"no_break_comment":true,"no_closing_tag":true,"no_multiple_statements_per_line":true,"no_space_around_double_colon":true,"no_spaces_after_function_name":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_line_after_imports":true,"spaces_inside_parentheses":true,"statement_indentation":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"encoding":true,"full_opening_tag":true},"ruleCustomisationPolicyVersion":"null-policy","hashes":{".conform.8290495.olivesnews.theme":"ba279df37643b4e7b3b1d36edca92d5a",".conform.9049921.olivesnews.theme":"ba279df37643b4e7b3b1d36edca92d5a",".conform.4231873.olivesnews.theme":"e576b2c4cb832ca7a39815102ad561ab",".conform.8695376.olivesnews.theme":"3a6eaad9be79d2381872c098f2d7d5ad",".conform.1107021.olivesnews.theme":"e576b2c4cb832ca7a39815102ad561ab",".conform.7078766.olivesnews.theme":"e576b2c4cb832ca7a39815102ad561ab",".conform.4186483.olivesnews.theme":"3a6eaad9be79d2381872c098f2d7d5ad",".conform.5799305.olivesnews.theme":"e576b2c4cb832ca7a39815102ad561ab",".conform.7399354.olivesnews.theme":"3a6eaad9be79d2381872c098f2d7d5ad"}}
{"php":"8.5.4","version":"3.94.2","indent":" ","lineEnding":"\n","rules":{"nullable_type_declaration":true,"operator_linebreak":true,"ordered_types":{"null_adjustment":"always_last","sort_algorithm":"none"},"single_class_element_per_statement":true,"types_spaces":true,"array_indentation":true,"array_syntax":true,"attribute_block_no_spaces":true,"cast_spaces":true,"concat_space":{"spacing":"one"},"function_declaration":{"closure_fn_spacing":"none"},"method_argument_space":{"after_heredoc":false},"new_with_parentheses":{"anonymous_class":false},"single_line_empty_body":true,"single_space_around_construct":{"constructs_followed_by_a_single_space":["abstract","as","case","catch","class","const","const_import","do","else","elseif","enum","final","finally","for","foreach","function","function_import","if","insteadof","interface","match","named_argument","namespace","new","private","protected","public","readonly","static","switch","trait","try","type_colon","use","use_lambda","while"],"constructs_preceded_by_a_single_space":["as","else","elseif","use_lambda"]},"trailing_comma_in_multiline":{"after_heredoc":true,"elements":["arguments","array_destructuring","arrays","match","parameters"]},"binary_operator_spaces":{"default":"at_least_single_space"},"blank_line_after_opening_tag":true,"blank_line_between_import_groups":true,"blank_lines_before_namespace":true,"braces_position":{"allow_single_line_anonymous_functions":false,"allow_single_line_empty_anonymous_classes":true},"class_definition":{"inline_constructor_arguments":false,"space_before_parenthesis":true},"compact_nullable_type_declaration":true,"declare_equal_normalize":true,"lowercase_cast":true,"lowercase_static_reference":true,"modifier_keywords":true,"no_blank_lines_after_class_opening":true,"no_extra_blank_lines":{"tokens":["use"]},"no_leading_import_slash":true,"no_whitespace_in_blank_line":true,"ordered_class_elements":{"order":["use_trait"]},"ordered_imports":{"imports_order":["class","function","const"],"sort_algorithm":"none"},"return_type_declaration":true,"short_scalar_cast":true,"single_import_per_statement":{"group_to_single_imports":false},"single_trait_insert_per_statement":true,"ternary_operator_spaces":true,"unary_operator_spaces":{"only_dec_inc":true},"blank_line_after_namespace":true,"constant_case":true,"control_structure_braces":true,"control_structure_continuation_position":true,"elseif":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"no_break_comment":true,"no_closing_tag":true,"no_multiple_statements_per_line":true,"no_space_around_double_colon":true,"no_spaces_after_function_name":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_line_after_imports":true,"spaces_inside_parentheses":true,"statement_indentation":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"encoding":true,"full_opening_tag":true},"ruleCustomisationPolicyVersion":"null-policy","hashes":{".conform.8290495.olivesnews.theme":"ba279df37643b4e7b3b1d36edca92d5a",".conform.9049921.olivesnews.theme":"ba279df37643b4e7b3b1d36edca92d5a",".conform.4231873.olivesnews.theme":"e576b2c4cb832ca7a39815102ad561ab",".conform.8695376.olivesnews.theme":"3a6eaad9be79d2381872c098f2d7d5ad",".conform.1107021.olivesnews.theme":"e576b2c4cb832ca7a39815102ad561ab",".conform.7078766.olivesnews.theme":"e576b2c4cb832ca7a39815102ad561ab",".conform.4186483.olivesnews.theme":"3a6eaad9be79d2381872c098f2d7d5ad",".conform.5799305.olivesnews.theme":"e576b2c4cb832ca7a39815102ad561ab",".conform.7399354.olivesnews.theme":"3a6eaad9be79d2381872c098f2d7d5ad",".conform.2428501.olivesnews.theme":"e576b2c4cb832ca7a39815102ad561ab"}}

32
js/nouislider-year-format.js

@ -2,29 +2,33 @@
"use strict";
Drupal.behaviors.nouisliderYearFormat = {
// Weight needs to be higher than the module's behavior so we run after it.
// Drupal behaviors don't have explicit weight in this API, but attaching
// after DOM ready is fine since once() ensures the module ran first.
attach: function (context, settings) {
const sliderEl = context.querySelector("#year.noUi-target");
if (!sliderEl || !sliderEl.noUiSlider) return;
// Prevent re-running if we've already patched this slider
if (sliderEl.dataset.yearFormatApplied) return;
sliderEl.dataset.yearFormatApplied = "true";
const integerFormat = {
to: function (value) {
return String(Math.round(value));
},
from: function (value) {
return Math.round(Number(value));
},
};
const inputFrom = document.getElementById("nouislider-input-from");
const inputTo = document.getElementById("nouislider-input-to");
sliderEl.noUiSlider.updateOptions({
format: integerFormat,
tooltips: [integerFormat, integerFormat],
ariaFormat: integerFormat,
// The module's update listener gives inputs the raw float (e.g. 1971.00)
// because no top-level format is set on the slider. We add our own
// update listener that overwrites the input value with a rounded integer.
// 'update' fires on drag but does NOT trigger navigation — only 'set' does.
sliderEl.noUiSlider.on("update", function (values, handle) {
const rounded = Math.round(parseFloat(values[handle]));
if (handle === 0 && inputFrom) inputFrom.value = rounded;
if (handle === 1 && inputTo) inputTo.value = rounded;
});
// Fix the current displayed values in the inputs immediately
const current = sliderEl.noUiSlider.get();
if (inputFrom) inputFrom.value = Math.round(parseFloat(current[0]));
if (inputTo) inputTo.value = Math.round(parseFloat(current[1]));
},
};
})(Drupal);

2
olivesnews.libraries.yml

@ -58,7 +58,7 @@ global-styling:
js:
js/checkbox.js: {}
js/custom.js: {}
# js/custom.js: {}
js/readmore.js: {}
dependencies:

8
olivesnews.theme

@ -744,7 +744,7 @@ function _olivesnews_hex_to_hsl(string $hex_string)
return [$h, $s, $l];
}
// function olivesnews_preprocess_page(&$variables)
// {
// $variables['#attached']['library'][] = 'olivesnews/nouislider-year-format';
// }
function olivesnews_preprocess_page(&$variables)
{
$variables['#attached']['library'][] = 'olivesnews/nouislider-year-format';
}

Loading…
Cancel
Save