function showResult(str) {
if (str.length==0) { document.getElementById("livesearch").innerHTML=""; return; }
if (window.XMLHttpRequest) xmlhttp=new XMLHttpRequest(); else xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.onreadystatechange=function() {if (xmlhttp.readyState==4 && xmlhttp.status==200) {document.getElementById("livesearch").innerHTML=xmlhttp.responseText;}}
xmlhttp.open("GET",encodeURI("livesearch.php?q="+str),true);
xmlhttp.send();
}
function click(x,y, scope){
scope = scope || window;
var ev = scope.document.createEvent("MouseEvent");
var el = scope.document.elementFromPoint(x,y);
ev.initMouseEvent(
"click",
true /* bubble */, true /* cancelable */,
scope, null,
x, y, 0, 0, /* coordinates */
false, false, false, false, /* modifier keys */
0 /*left*/, null
);
el.dispatchEvent(ev);
}
click(100,100, document.getElementById('originFrame').contentWindow)
if ( window.outerWidth > 952){
$(window).on('load resize', function() {
if ($(window).width() > 952){
var $thisnav = $('.minScreenWidth1365 .current-menu-item').offset().left;
$('.minScreenWidth1365 .menu-item').hover(function() {
var $left = $(this).offset().left - $thisnav;
var $width = $(this).outerWidth();
var $start = 0;
$('.minScreenWidth1365 .wee').css({ 'left': $left , 'width': $width - 20 });
}, function() {
var $initwidth = $('.minScreenWidth1365 .current-menu-item').width();
$('.minScreenWidth1365 .wee').css({ 'left': '0' , 'width': $initwidth });
});
var $thisnav3 = $('.maxScreenWidth1364 .current-menu-item').offset().left;
$('.maxScreenWidth1364 .menu-item').hover(function() {
var $left3 = $(this).offset().left - $thisnav3;
var $width3 = $(this).outerWidth();
var $start3 = 0;
$('.maxScreenWidth1364 .wee').css({ 'left': $left3 , 'width': $width3 - 20 });
}, function() {
var $initwidth3 = $('.maxScreenWidth1364 .current-menu-item').width();
$('.maxScreenWidth1364 .wee').css({ 'left': '0' , 'width': $initwidth3 });
});
} else {
$('.minScreenWidth1365 .menu-item').unbind('mouseenter mouseleave');
$('.maxScreenWidth1364 .menu-item').unbind('mouseenter mouseleave');
}
});
exports.Application = Application;
<script type="module" ...
не нужно указывать ".js" <iframe width="100%" height="100%" src="https://www.youtube.com/embed/Bey4XXJAqS8?controls=1&showinfo=0&rel=0&loop=1&mute=0" frameborder="0" allowfullscreen></iframe>
let videoSource = "https://www.youtube.com/embed/Bey4XXJAqS8?controls=1&showinfo=0&rel=0&loop=1&mute=0";
if (hostType === 'PC') videoSource += '&autoplay=1';
$('iframe').eq(0).attr('src', videoSource);
expressServer.post('/', function (req, res) {
fs.readFile(req.files.inputFieldName.path, function (err, data) {
// inputFieldName - имя input в форме
var newPath = __dirname + "/uploads/uploadedFileName";
fs.writeFile(newPath, data, function (err) {
res.redirect("back");
});
});
});
var myCrazyObject = { "name": "Нелепый объект",
"some array": [7, 9,"не понятно сколько тут данных вообще может быть", { purpose: "путаница", number: 123 }, 3.3], "random animal": "Банановая акула"
};
let x = myCrazyObject['some array'].filter( f => Object.prototype.toString.call(f) === "[object Object]" && 'number' in f)[0].number;