partnersSwiper.on('slideChange', function() {
if ( partnersSwiper.activeIndex == 0 )
partnersSwiper.slideTo(1)
else if ( partnersSwiper.activeIndex == partnersSwiper.slides.length - 1 )
partnersSwiper.slideTo( partnersSwiper.slides.length - 2 )
})
String.prototype.modifyStr = function(UpDown = 'Up', invertFirstLetter = false) {
let workingLine = String(this)
if (UpDown) {
workingLine = String(this).replace( /[a-zA-Z]|[а-яА-Я]/g, match => {
if (match == match.match(/[a-z]|[а-я]/)) {
return String.fromCharCode(match.charCodeAt(0) - ((match == 'ё') ? 80 : 32) )
}
else return match
})
} else if (!UpDown){
workingLine = String(this).replace( /[a-zA-Z]|[а-яА-Я]/g, match => {
if (match == match.match(/[A-Z]|[А-Я]/)) {
return String.fromCharCode(match.charCodeAt(0) + ((match == 'ё') ? 80 : 32) )
}
else return match
})
}
if (invertFirstLetter) {
let firstLetter = workingLine[0],
newLetter
if ( firstLetter == firstLetter.match( /[a-z]|[а-я]/g ) ) {
newLetter = String.fromCharCode(firstLetter.charCodeAt(0) - ((firstLetter == 'ё') ? 80 : 32) )
} else if ( firstLetter == firstLetter.match( /[A-Z]|[А-Я]/g ) ) {
newLetter = String.fromCharCode(firstLetter.charCodeAt(0) + ((firstLetter == 'ё') ? 80 : 32) )
}
return workingLine.replace(firstLetter, newLetter)
} else return workingLine
}
function getContent(){
var http = new XMLHttpRequest();
http.open('GET', 'https://twitter.com/navalny'); // URL страницы сайта
http.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) {
var doc = new DOMParser().parseFromString(this.responseText, "text/html"); // преобразовать текст в HTML
document.write(doc)
}
}
http.send(null);
}
<script>
$(function() {
$("#sender").children('input[name="forma-gender"]').change(function(e) {
var t = $(this).serialize();
$.ajax({
url: "/2018/tech/senderapi.php",
type: "post",
data: t,
success: function(e) {
$("#result_sender").html(e)
}
})
})
})
</script>
add_action('wp_enqueue_scripts', function(){
wp_add_inline_script('my_scripts', 'var templateDirectory = ' . get_template_directory_uri() );
});
<?php wp_head() ?>
<head>