Discussions » Demandes de création de scripts

Help write a script in tampermonkey for web.whatsapp.com

§
Posté le: 2024-01-30

I apologize in advance. I don't know how to write scripts.
I want the interface to stretch to the full width of the screen. Can anyone help me with this?

I have made several attempts to write a script myself, but nothing works for me.

§
Posté le: 2024-01-30
Édité le: 2024-01-30

If you want to make the text box take the whole screen here are the tips you should follow

document.querySelector("#main")

//Use the styles below
//<div id="main" class="_2Ex_b" style=" position: fixed; width: calc(100% + 113px); left: -20px; ">

//make transform unset
//html[dir] ._2Ts6i { transform: translateZ(0); }
§
Posté le: 2024-01-30
Édité le: 2024-01-30

If you want the whole interface to occupy all the possible space, you can use this code:


var st=document.createElement("STYLE");  //this creates a new style element, without adding it to the page yet
st.innerHTML=".app-wrapper-web ._1jJ70{top: 0 !important; width: 100%  !important; max-width: 100%  !important; height: 100%  !important;}"; //this line sets the content of the style element
document.body.appendChild(st); //the last line adds the style to the end of the page

".app-wrapper-web ._1jJ70" is the selector that identifies the main interface of Whatsapp Web: for it, height and width are maximized putting them at 100%, and the distance from the top is put to 0;
Each of the properties also has "!important" at the end: it's used to override the usual hierarchy of CSS instructions (I'm using this here as it's a quick hack, but it's not a good practice to use it on your own website if you're the developer).

Poster une réponse

Connectez-vous pour poster une réponse.