The page does not open in full screen mode [duplicate]

I would like to open page in full screen mode after ‘onload’. I use JSF wit primefaces. This is JavaScript that I use for it:

function cancelFullScreen(el) {
  var requestMethod = el.cancelFullScreen || el.webkitCancelFullScreen || el.mozCancelFullScreen || el.exitFullscreen;
  if (requestMethod) { // cancel full screen.
    requestMethod.call(el);
  } else if (typeof window.ActiveXObject !== "undefined") {
    var wscript = new ActiveXObject("WScript.Shell");
    if (wscript !== null) {
      wscript.SendKeys("{F11}");
    }
  }
}

function requestFullScreen(el) {
  var requestMethod = el.requestFullScreen || el.webkitRequestFullScreen || el.mozRequestFullScreen || el.msRequestFullScreen;
  if (requestMethod) { // Native full screen.
    requestMethod.call(el);
  } else if (typeof window.ActiveXObject !== "undefined") {
    var wscript = new ActiveXObject("WScript.Shell");
    if (wscript !== null) {
      wscript.SendKeys("{F11}");
    }
  }
  return false;
}

Generally it works fine when I add this action for a button or different event like example:

<body onmousedown="requestFullScreen(document.body);return false;">

But it does work when I try to run it when page open:

<body  onunload="requestFullScreen(document.body);return false;">

Where am I making a mistake?

Foxit Forms : open rear camera when clicking img form field

On FOXIT PDF EDITOR on WINDOWS, i would like to modify the behaviour of img form field with JS like to directly open rear camera when i am on mobile device :

if this.media = tablet
 then event.target.openRearCamera()
 else event.target.buttonImportIcon()

But i can not find any documents with javascript method/parameter in foxit docs

is there any way to do that ?

looking for documentation but nothing on it

Is it possible to work with Material-UI DatePicker in “pure date format”?

My question intentionally is “Is it possible?” and not “How to?”, because I am not sure whether it is possible at all. Material UI X DatePicker API https://mui.com/x/api/date-pickers/date-picker/ shows that DatePicker value type is object – apparently it is standarta JS/DT Date, which has always are time component as well and you can not just strip time from it.

But sometimes it is very important to have date only – e.g. the John Brown may start work on ‘10.04.2024’ in FR TZ and this ‘10.04.2024’ should be displayed in React web app (with DatePicker) as ‘10.04.2024’ in any TZ, any browser. But, if Date object is used, then it may be possible that from the US-located computers DatePicker sees the browser TZ and displays ‘10.04.2024 FR’ as ‘09.04.2024’ that is quite confusing, as clients know that John Brown works in FR branch and all the legal data about him should be displayed keeping in mind that they refere to the FR legal system.

So – maybe there is ‘pure date option’ for DatePicker where can I pass just date string ‘DD-MM-YYYY’ and the DatePicker displays this date exactly as such without assuming that it is DD-MM-YYYY-UTC-MIDNIGHT? Date object always have time. strings may go with just date data?

add “use client” into index.ts that exports all of component stuffs

I am using nextjs 14 and I create all components in src/components directory and each component has index.ts file that will exports all of my components stuffs such as subcomponents, types, context and etc.
when I use it inside client component from index.ts it is work perfectly but the problem is when I use that components and subcomponents in a server component it goes to throw error that you can not use client stuffs in server component

I know the problem came from index.ts file because this file exports all of my components, subcomponents, util functions and etc. and when import one of my server component from index.ts inside another server components it will import client stuffs too. so by adding "use client" inside index.ts the problem will be fixed but I just want to know by adding "use client" in index.ts will be all component stuffs considered as client or not?

PHP does not show search country bar when used to lib intl-tel-input

I’m using lib intl-tel-input version 18.2.1 for my PHP project. I saw at lib doc, it have searching country bar when user click to flag. but in my project. search bar can not display.

<script src="https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/18.2.1/js/intlTelInput.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/18.2.1/js/utils.js"></script>
<script>
    var input = document.querySelector("#phone");
    var iti = window.intlTelInput(input, {
        separateDialCode: false,
        countrySearch: true,
        utilsScript: "https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/18.2.1/js/utils.js"
    });
</script>

this is my code
Thanks for your help

JavaScript Regular Expression Error: “Declaration or Statement Expected” [closed]

I’m trying to create a JavaScript function to validate timestamps in a specific format. I have the following function:

function isTimestamp(line) {
  return /^[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3} --> [0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3}$/.test(line);
}

However, I’m encountering an error after the part ^[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3} –> [0-9]. The error message is: “‘ expected”. Then, after “:[0-9]”, I get the error: “Declaration or statement expected.javascript”.

I’ve double-checked the regular expression syntax and can’t find any obvious mistakes. Can someone please help me identify the issue and provide a corrected version of the function?

here the whole project https://github.com/quadroce/avocado

This is a project about a convertor of .vtt file, it fixes uppercases and lowercases, it fixes the length of the strings

Function declaration in the eval is not overwrite the previous one

Let’s say we have code like below. The function a is declared twice times. and we know the output in the console should be

this is a2

because the second declaration of function a overwrite the previous function a.

function a ()
{
   console.log("this is a1");
}
function a ()
{
   console.log("this is a2");
}
a();

But the things are different when using eval.

Let’s say we change the code like below.

eval("function a (){console.log ("this is a1")}");

function a ()
{
   console.log("this is a2");
}
a();

the output shows

this is a1

My question is why the function a is not overwrote in this scenrio? Please shine some light on this. Many thanks.

why object.keys reading keys from middle of an object

I have an object

 let files = {
            '00':{},
            '01':{},
            '02':{},
            '03':{},
            '04':{},
            '05':{},
            '06':{},
            '07':{},
            '08':{},
            '09':{},
            '10':{},
            '11':{},
            '12':{},
            '13':{},
            '14':{},
            '15':{}
        }

console.log(Object.keys(files))

the result I’m getting is this. why it’s reading key from 10 not from 00?

["10","11","12","13","14","15","00","01","02","03","04","05","06","07","08","09"]

How to make it read from zero i.e first key of an object?

How to play MIDI notes from a browser on the computer’s audio [closed]

I know that using JavaScript, with certain libraries such as html-midi-player, on a website, you can load and play MIDI files (see MIDI music support in HTML5). These can sound quite realistic, with different instruments.

I want to be able to play individual notes, for example, turning a computer keyboard into a piano keyboard of sorts. Are there any JavaScript libraries or just JavaScript techniques that can single out individual notes (instead of playing a whole midi file)?

I have not been able to find something like that, but it seems it should be doable.

WebSocket connection works perfectly in plain JavaScript, but it’s not connecting in Node.js

I’m trying to connect to a WebSocket. The URL looks like this:

wss://xxx.xxx.com/public/time/player/test/xxx/socket?messageFormat=json&SESSIONID=xxx&instance=xxx&client_version=xxx

In JavaScript, it works perfectly, and I receive all messages. However, when I try the same in Node.js, it doesn’t even connect.

I’ve already tried using different packages like websocket and wb, but none of them worked.

Here’s the code I used in plain JavaScript:

const socketUrl = 'wss://xxx.xxx.com/public/time/player/test/xxx/socket?messageFormat=json&SESSIONID=xxx&instance=xxx&client_version=xxx';

const socket = new WebSocket(socketUrl);

socket.onopen = function(event) {
    console.log("Connection opened:", event);
};

socket.onmessage = function(event) {
    console.log("Message received:", event.data);
};

socket.onerror = function(error) {
    console.error("WebSocket error:", error);
};

socket.onclose = function() {
    console.log("Connection closed");
};

Here’s the code I used in Node.js:

const socketUrl = 'wss://xxx.xxx.com/public/time/player/test/xxx/socket?messageFormat=json&SESSIONID=xxx&instance=xxx&client_version=xxx';

const WebSocket = require("ws");

const connect = () => {
  const socket = new WebSocket(socketUrl);
  
  // Stuck in CONNECTING
  socket.on("open", () => {
    console.log("Connected to socket");
  });

  socket.on("message", (data) => {
    console.log("Received message:", data);
  });

  socket.on("close", () => {
    console.log("Disconnected from socket");
    connect();
  });

  socket.on("error", (err) => {
    console.error("Socket error:", err);
    socket.close();
  });
};

connect();

Here is an image the headers from a successful connection in plain JavaScript:
successful connection

Is there any way to make program for update posts automatically in wordpress [closed]

So i’am an intern and my boss ask me to find a better solution to update posts automatically with program. Why? because any post before get update getting so long to access (timeout). when it updated it becomes normal. hence my boss told me to find solution rather manually clicking update button post by post
Screenshot of Update’s button

I tried using POST request or PUT request with JWT authentication it not changing anything. I also tried changing comment_status from open to closed just to make it look like “updating” but no result.