function getData() {
return new Promise(resolve => {
$.getJSON("https://www.cbr-xml-daily.ru/daily_json.js", function(data) {
const kyrs = Math.ceil(100 / data.Valute.KZT.Value * data.Valute.EUR.Value).toString().replace(/(\d)(?=(\d{3})+$)/g, '$1 ');
resolve(kurs);
});
})
}
function func1(kurs) {
console.log(kurs);
}
function func2(kurs) {
console.log(kurs);
}
async function go() {
const kurs = await getData();
$('#euro').html(kyrs);
func1(kurs);
func2(kurs);
}
go();
silka-ibp: 'https://..../trehfaznye-dlja-ikt/ingenio-compact/', kartinka-ibp: 'https://..../Borri_IngenioCompact_SideView-300x300.jpg',
silka_ibp: 'https://..../trehfaznye-dlja-ikt/ingenio-compact/',
kartinka_ibp: 'https://..../Borri_IngenioCompact_SideView-300x300.jpg',
const info = {
10: {
5: {
title: 'BORRI INGENIO COMPACT <br> 10 kVA (BSS90)',
description: 'Мощность 10 000 Вт/Ва',
...
},
10: {
title: 'BORRI INGENIO COMPACT <br> 10 kVA (BSS90)',
description: 'Мощность 10 000 Вт/Ва',
...
},
},
};
document.onmousemove = function(e) {
const slider1value = $("#slider1").roundSlider("option", "value");
const slider2value = $("#slider2").roundSlider("option", "value");
$('.calc_nazvanie').html(info[slider1value][slider2value].title);
$('.calc_descr').html(info[slider1value][slider2value].description);
...
}
$input.val = args.value;
вообще непонятно, что вы собирались этим сделать.function update() {
const urlParams = new URLSearchParams(window.location.search);
const city = urlParams.get('location_location1');
const target = document.getElementById('locator_citi');
const cities = {
'arzamas' : 'Арзамас',
'abakan' : 'Абакан',
'almetevsk' : 'Альметьевск',
'angarsk' : 'Ангарск',
'armavir' : 'Армавир',
'artjom' : 'Артём',
'arhangelsk': 'Архангельск',
'astrahan' : 'Астрахань',
// ...
};
if (cities[city]) {
target.innerHTML = cities[city];
}
}
window.addEventListener('DOMContentLoaded', update);
document.querySelector('.jobsearch-onsubmit-apilocs')?.addEventListener('click', () => {
update();
});
get_query_var()
. Например, вы можете использовать эту функцию в фильтре the_title
if ( ! function_exists( 'the_title_callback' ) ) {
/**
* Function for 'the_title' filter-hook.
*
* @param string $post_title The post title.
* @param int $post_id The post ID.
*
* @return string
*/
function the_title_callback( $post_title, $post_id ) {
$city = get_query_var( 'location_location1', false );
if ( $city && get_converter_cities( $city ) ) {
$post_title = $post_title . ' ' . get_converter_cities( $city );
}
return $post_title;
}
}
add_filter( 'the_title', 'the_title_callback', 10, 2 );
if ( ! function_exists( 'get_converter_cities' ) ) {
/**
* Return string or array with city values.
*
* @since 1.0.0
*
* @param string $control Key to get one value. Optional. Default null.
*
* @return string|array|false
*/
function get_converter_cities( $control = null ) {
// Sanitize string (just to be safe).
if ( ! is_null( $control ) ) {
$control = sanitize_title( $control );
}
// Main converter array.
$converter = array(
'abakan' => __( 'Abakan', 'domain' ),
'moscow' => __( 'Moscow', 'domain' ),
'saratov' => __( 'Saratov', 'domain' ),
);
$converter = apply_filters( 'get_converter_cities', $converter );
// Return controls.
if ( is_null( $control ) ) {
return $converter;
} elseif ( ! isset( $converter[ $control ] ) || empty( $converter[ $control ] ) ) {
return false;
} else {
return $converter[ $control ];
}
}
}