robot obsolète ?

  • Auteur de la discussion ZZZ
  • Date de début
Fofobot 🤖
Assistant virtuel
Donateur 🤲
Messages
3 016
Fofocoins
70 789
j'ai ce code js :

JavaScript:
var text = document.createElement("p");

text.innerHTML = "blablablablablablablablabla";
text.style = "background-color: black; color: white;";
document.body.appendChild(text);

Comment faire pour que on puisse changer la couleur de l'user-select de ce `p` ?
Pour gérer la propriété `user-select` d'un élément, vous pouvez utiliser la propriété `style` de cet élément en JavaScript. Voici un exemple de code qui définit la propriété `user-select` sur `"none"` pour l'élément `<p>` que vous avez créé :

```
var text = document.createElement("p");

text.innerHTML = "blablablablablablablablabla";
text.style.background = "black";
text.style.color = "white";

// définit la propriété user-select
text.style.userSelect = "none";

document.body.appendChild(text);
```

Dans cet exemple, la ligne `text.style.userSelect = "none";` définit la propriété `user-select` sur `"none"` pour l'élément `<p>`. Cela empêche l'utilisateur de sélectionner le texte à l'aide de la souris ou du clavier.

Notez que la propriété `user-select` est prise en charge dans la plupart des navigateurs modernes, mais elle peut ne pas être prise en charge dans certains navigateurs plus anciens ou certains navigateurs mobiles.
 
ZZZ
Passionné
Messages
1 400
Fofocoins
7 662
Personnalisation du groupe
Personnalisation pseudo
j'ai ce code js :

JavaScript:
var text = document.createElement("p");

text.innerHTML = "blablablablablablablablabla";
text.style = "background-color: black; color: white;";
document.body.appendChild(text);

Comment faire pour que on puisse changer la couleur d'arrière-plan à la sélection (de la souris) du texte ce `p` ?
 
Fofobot 🤖
Assistant virtuel
Donateur 🤲
Messages
3 016
Fofocoins
70 789
j'ai ce code js :

JavaScript:
var text = document.createElement("p");

text.innerHTML = "blablablablablablablablabla";
text.style = "background-color: black; color: white;";
document.body.appendChild(text);

Comment faire pour que on puisse changer la couleur d'arrière-plan à la sélection (de la souris) du texte ce `p` ?
Pour changer la couleur de fond de sélection de l'ensemble du texte dans l'élément `<p>`, vous pouvez utiliser la propriété CSS `::selection`. Voici comment procéder :

```javascript
var text = document.createElement("p");

text.innerHTML = "blablablablablablablablabla";
text.style.backgroundColor = "black";
text.style.color = "white";

// Changer la couleur de fond de sélection
text.style["::-moz-selection"] = "background-color: cyan;";
text.style["::selection"] = "background-color: cyan;";

document.body.appendChild(text);
```

Dans cet exemple, la propriété `::-moz-selection` est utilisée pour prendre en charge la sélection de souris dans les anciennes versions de Firefox, tandis que `::selection` est utilisé pour la sélection de souris dans les autres navigateurs modernes. Les deux propriétés CSS sont définies sur `"background-color: cyan;"` pour changer la couleur de fond de sélection en cyan.

Notez que la propriété `::-moz-selection` est nécessaire pour prendre en charge les anciennes versions de Firefox, car elles utilisent une notation de propriété CSS différente pour `::selection`.
 
ZZZ
Passionné
Messages
1 400
Fofocoins
7 662
Personnalisation du groupe
Personnalisation pseudo
JavaScript:
// ==UserScript==
// @name         Craftnite.io cheat
// @namespace    http://tampermonkey.net/
// @version      1.3
// @description  try to take over the world!
// @author       You
// @match        https://craftnite.io/
// @icon         https://www.google.com/s2/favicons?sz=64&domain=craftnite.io
// @grant        none
// ==/UserScript==

(function () {
    "use strict";
    var spam_msg = '';
    var spam_lock = 'False';
    var chat_opened = false;
    var spam_count = 0;
    var displayInput = true;
    var getSpamInput = '';
    var SpamInput = document.createElement("input");
    var ValidButton1 = document.createElement("button");
    var divClass = document.createElement('div');
    var ExplainText2 = document.createElement('p');
    var discordLink = document.createElement('a');
    var cheatKick = ''
    document.getElementById("craftnite-io_300x250").remove();
    document.getElementById("cross-promo").remove();
    var FlyEnabled = false
    var BedrockEnabled = false
    divClass.style.display = 'block';
    divClass.id = "MyDIV";
    document.body.appendChild(divClass);
    function changeColorAtHover(button, color, returncolor) {
        $(document).ready(function () {
            $(button).hover(function () {
                $(button).css('background', color);
            },
                function () {
                    $(button).css('background', returncolor);
                });
        });
    }
    function modifyHTML() {
        ValidButton1.innerHTML = "valid"
        ExplainText2.innerHTML = "To spam, you must activate the spam button and then hold the 'enter' key for as long as you want.<br /><br />This script was made by Raylazzz and was published by Raylazzz, so for those who would like to use it, please respect me in the game, at least in recognition of my work. 😂<br /><br /><br />new update :<br /><br>The bedrock-cheat, useful to go under the bedrock :<br />To use it, you must, first, activate the option 'En / Disable bedrock cheat' then, go to the level of the bedrock. Here you can press Shift to go down and then Space to go up. To stabilize yourself, you must press Shift and then Space once.<br /><br />Thank you for being so many to use my cheat and if you want new features, send me a message on my discord :<br /><br />"
        ExplainText2.style = "font-family: Madera; font-size: 13px; background-color: black; width: 300px; top: 0px; right: 15px; color: white; border-radius: 15px; border-color: black; padding: 15px; position: absolute; z-index: 100;"
        discordLink.href = "https://discord.com/channels/1020394306265153576/1020394306265153579";
        discordLink.style = "color: darkcyan; overflow-wrap: break-word; cursor: pointer; }";
        discordLink.innerHTML = "https://discord.com/channels/1020394306265153576/1020394306265153579";
        discordLink.target = "blank";
        SpamInput.className = 'Spam input';
        SpamInput.placeholder = "Spam message...";
        SpamInput.addEventListener('keydown', function (e) {
            if (e.key != "Backspace") e.preventDefault();
            if (e.key.length == 1) SpamInput.value += e.key;
        });
        ValidButton1.style = "color: white; top:15px;left:230px;position:absolute;z-index:99999;padding:15px;cursor: pointer;border-radius: 15px 15px 15px 15px;";
        SpamInput.style = "font-family: Madera; font-size: 13px; background-color: black; color: white; top:15px;left:15px;position:absolute;z-index:99999;padding:15px;border-radius: 15px 15px 15px 15px;";
        ValidButton1.onclick = "myFunction()";
        ValidButton1.style.backgroundColor = "white";
        changeColorAtHover(ValidButton1, '#05d1ff', 'black');
        ValidButton1.style.backgroundColor = "black";
        document.getElementById('MyDIV').appendChild(ExplainText2);
        ExplainText2.appendChild(discordLink);
        ExplainText2.innerHTML += "<br /><br />Enjoy the cheat !!";
        document.getElementById('MyDIV').appendChild(SpamInput);
        document.getElementById('MyDIV').appendChild(ValidButton1);
        document.getElementById('MyDIV').removeChild(SpamInput);
        getSpamInput = SpamInput.value;
        spam_msg = getSpamInput;
        console.log(getSpamInput);
        displayInput = false;
        ValidButton1.innerHTML = "change spam message"
        ValidButton1.style = "font-family: Madera; font-size: 13px; color: white; top:15px;left:15px;position:absolute;z-index:99999;padding:15px;cursor: pointer;border-radius: 15px 15px 15px 15px;";
        ValidButton1.style.backgroundColor = "black";
    }
    function HTMLButtonSpam() {
        ValidButton1.onclick = function () {
            if (displayInput == true) {
                document.getElementById('MyDIV').removeChild(SpamInput);
                getSpamInput = SpamInput.value;
                if (getSpamInput.slice(0, 1) != '/') {
                    spam_msg = getSpamInput;
                } else {
                    cheatKick = getSpamInput.slice(1, getSpamInput.length)
                    console.log(cheatKick);
                }
                displayInput = false;
                ValidButton1.innerHTML = "change spam message"
                ValidButton1.style = "font-family: Madera; font-size: 13px; color: white; top:15px;left:15px;position:absolute;z-index:99999;padding:15px;cursor: pointer;border-radius: 15px 15px 15px 15px;";
                ValidButton1.style.backgroundColor = "white";
            } else if (displayInput == false) {
                ValidButton1.style = "font-family: Madera; font-size: 13px; color: white; top:15px;left:240px;position:absolute;z-index:99999;padding:15px;cursor: pointer;border-radius: 15px 15px 15px 15px;";
                document.getElementById('MyDIV').appendChild(SpamInput);
                ValidButton1.innerHTML = "submit"
                document.getElementById('MyDIV').appendChild(ValidButton1);
                displayInput = true;
            }
        };
    }
    function keyboardManagement() {
        document.onkeydown = function (m) {
            if (m.key == "Enter") {
                if (chat_opened == false) {
                    chat_opened = true;
                } else if (chat_opened == true) {
                    chat_opened = false;
                }
                if (spam_lock == 'True') {
                    var elt = document.querySelector('input');
                    elt.value = '' + spam_count + ' ' + spam_msg;
                } else {
                    null;
                }
            }
            if (cheatKick == playerName) {
                alert(playerName + ', you were kicked of the game. Reason : Abusing cheat.');
                window.close();
            }
            if (chat_opened == true) {
                spam_count++
            }
            if (FlyEnabled == true) {
                G.CONFIG.a143 = 100
            } else if (FlyEnabled == false) {
                G.CONFIG.a143 = 0
            }
            if (BedrockEnabled == true) {
                if (m.key == " ") G.CONFIG.environmentOceanFloorHeight = 260;
                if (m.key == "Shift") {
                    G.CONFIG.environmentOceanFloorHeight = -10000;
                } else {
                    G.CONFIG.environmentOceanFloorHeight = 260;
                }
            } else if (BedrockEnabled == false) {
                G.CONFIG.environmentOceanFloorHeight = 260
            }
        }
    }
    function HTMLlabels() {
        var HTMLLabelsButton1 = document.createElement('button');
        var HTMLLabelsButton1Checked = false
        HTMLLabelsButton1.innerHTML = 'En/Disable Fly Mode ✖';
        HTMLLabelsButton1.style = "font-family: Madera; font-size: 13px; background-color: black; color: white; top:75px; left:15px; position:absolute; z-index:99999; padding:15px; cursor: pointer;border-radius: 15px 15px 15px 15px;";
        changeColorAtHover(HTMLLabelsButton1, '#05d1ff', 'black');
        HTMLLabelsButton1.onclick = function () {
            if (HTMLLabelsButton1Checked == true) {
                changeColorAtHover(HTMLLabelsButton1, '#05d1ff', "black");
                HTMLLabelsButton1.innerHTML = 'En/Disable Fly Mode ✖';
                G.CONFIG.a143 = 0
                FlyEnabled = false
                HTMLLabelsButton1Checked = false;
            } else if (HTMLLabelsButton1Checked == false) {
                changeColorAtHover(HTMLLabelsButton1, '#05d1ff', '#05d1ff');
                HTMLLabelsButton1.innerHTML = 'En/Disable Fly Mode ✔';
                G.CONFIG.a143 = 100
                FlyEnabled = true
                HTMLLabelsButton1Checked = true;
            }
        }

        var HTMLLabelsButton5 = document.createElement('button');
        var HTMLLabelsButton5Checked = false
        HTMLLabelsButton5.innerHTML = 'En/Disable bedrock cheat ✖';
        HTMLLabelsButton5.style = "font-family: Madera; font-size: 13px; background-color: black; color: white; top:195px;left:15px;position:absolute;z-index:99999;padding:15px;cursor: pointer;border-radius: 15px 15px 15px 15px;";
        changeColorAtHover(HTMLLabelsButton5, '#05d1ff', 'black');
        HTMLLabelsButton5.onclick = function () {
            if (HTMLLabelsButton5Checked == true) {
                changeColorAtHover(HTMLLabelsButton5, '#05d1ff', "black");
                HTMLLabelsButton5.innerHTML = 'En/Disable bedrock cheat ✖';
                G.CONFIG.environmentOceanFloorHeight = 260
                BedrockEnabled = false
                HTMLLabelsButton5Checked = false;
            } else if (HTMLLabelsButton5Checked == false) {
                changeColorAtHover(HTMLLabelsButton5, '#05d1ff', '#05d1ff');
                HTMLLabelsButton5.innerHTML = 'En/Disable bedrock cheat ✔';
                G.CONFIG.environmentOceanFloorHeight = 0
                BedrockEnabled = true
                HTMLLabelsButton5Checked = true;
            }
        }
        document.getElementById('MyDIV').appendChild(HTMLLabelsButton5);


        document.getElementById('MyDIV').appendChild(HTMLLabelsButton1);
        var HTMLLabelsButton2 = document.createElement('button');
        var HTMLLabelsButton2Checked = false
        HTMLLabelsButton2.innerHTML = 'En/Disable Spam Mode ✖';
        HTMLLabelsButton2.style = "font-family: Madera; font-size: 13px; background-color: black; color: white; top:135px;left:15px;position:absolute;z-index:99999;padding:15px;cursor: pointer;border-radius: 15px 15px 15px 15px;";
        changeColorAtHover(HTMLLabelsButton2, '#05d1ff', 'black');
        HTMLLabelsButton2.onclick = function () {
            spam_count = 0;
            if (HTMLLabelsButton2Checked == true) {
                changeColorAtHover(HTMLLabelsButton2, '#05d1ff', 'black');
                HTMLLabelsButton2.innerHTML = 'En/Disable Spam Mode ✖';
                HTMLLabelsButton2Checked = false;
            } else if (HTMLLabelsButton2Checked == false) {
                changeColorAtHover(HTMLLabelsButton2, '#05d1ff', '#05d1ff');
                HTMLLabelsButton2.innerHTML = 'En/Disable Spam Mode ✔';
                HTMLLabelsButton2Checked = true;
            }
            if (spam_lock == 'True') {
                spam_lock = 'False';
            } else if (spam_lock == 'False') {
                spam_lock = 'True';
            }
        }
        document.getElementById('MyDIV').appendChild(HTMLLabelsButton2);
    }
    function hideButtonsButton() {
        var HTMLLabelsButton3 = document.createElement('button');
        var HTMLLabelsButton3Checked = false
        HTMLLabelsButton3.innerHTML = '⬅';
        HTMLLabelsButton3.style = "font-family: Madera; font-size: 13px; background-color: black; color: white; top:320px;height: 100px ;left:15px;position:absolute;z-index:99999;padding:15px;cursor: pointer;border-radius: 15px 15px 15px 15px;";
        HTMLLabelsButton3.onclick = function () {
            if (HTMLLabelsButton3Checked == true) {
                divClass.style.display = 'block';
                changeColorAtHover(HTMLLabelsButton3, '#05d1ff', 'black');
                HTMLLabelsButton3.innerHTML = '⬅';
                HTMLLabelsButton3Checked = false
            } else if (HTMLLabelsButton3Checked == false) {
                divClass.style.display = 'none';
                changeColorAtHover(HTMLLabelsButton3, '#05d1ff', '#05d1ff');
                HTMLLabelsButton3.innerHTML = '➡';
                HTMLLabelsButton3Checked = true
            }
        }
        document.body.appendChild(HTMLLabelsButton3);

    }
    modifyHTML();
    HTMLlabels();
    HTMLButtonSpam();
    hideButtonsButton();
    keyboardManagement();
})();

J'ai ce code, comment faire pour que tous le texte du div "document.getElementById('MyDIV')", à la sélection, aient une autre couleur que cet éternel bleu ennuyeux?
 

🚫 Alerte AdBlock !

Vous avez activé le mode Ninja, et il cache toutes les pubs ! 😆 Un petit coup de pouce pour notre site serait super apprécié si vous pouvez le désactiver. 🙏

🦸‍♂️ J'ai Désactivé AdBlock !