Ce sujet a été résolu
RisiOnche
2 ans
ajoute une @downloadURL et une @updateURL avec pour valeur l'url du gist raw (en enlevant le dernier id dans l'url car c'est le numéro de revision qui change à chaque fois) pour activer les maj auto du script dans tampermonkey stp
il y a 2 ans
mouais pas mal
j'aime pas trop que ce soit dans une fenêtre à part persoent
Petit, laid
il y a 2 ans
Programmafion
2 ans
mouais pas mal
j'aime pas trop que ce soit dans une fenêtre à part persoent
hein ? ça change rien à l'utilisation d'une page classique
il y a 2 ans
comment on fait pour revenir a la ligne mainteant que le bouton entrer sert a poster HELPPPPPPP
il y a 2 ans
aideespoir
2 ans
comment on fait pour revenir a la ligne mainteant que le bouton entrer sert a poster HELPPPPPPP
C'est bizarre ça, normalement ça ne devrait pas, tu es sur quel web browser ? Tu peux utiliser "shift + entrer" pour l'instant
Va falloir me donner plus d'infos, pour pouvoir reproduire ce bug

Va falloir me donner plus d'infos, pour pouvoir reproduire ce bug

il y a 2 ans
Je suis sur chrome
ah effectivement shift + enter c'est bon pour revenir à la ligne
Merci
ah effectivement shift + enter c'est bon pour revenir à la ligne
il y a 2 ans
aideespoir
2 ans
comment on fait pour revenir a la ligne mainteant que le bouton entrer sert a poster HELPPPPPPP
Désinstalle onchat
il y a 2 ans
Je suis sur chrome
ah effectivement shift + enter c'est bon pour revenir à la ligne
Merci
ah effectivement shift + enter c'est bon pour revenir à la ligne
Comme dit Wiverns, c'est ptet à cause d'un autre script, parce que dans mon script, je n'ai pas mis cette fonctionnalité 

il y a 2 ans
J'ai On'Chat + Onche Auto Refresh + Oncheures
il y a 2 ans
J'ai On'Chat + Onche Auto Refresh + Oncheures
Je ne connais pas les 2 autres, mais On'Chat avait un problème de poste de message quand on tapait sur la touche entrée 

il y a 2 ans
Ouais ça a pris bcp de temps
Après j'ai pas encore mis toutes les fonctionnalités de JVChat, ça sera pour les prochaines MAJ
Pas de pb

Après j'ai pas encore mis toutes les fonctionnalités de JVChat, ça sera pour les prochaines MAJ

Pas de pb
il y a 2 ans
et aussi j'ai on'chat 0.2 pas update depuis 6jours c'est bon? comment on auto update ?
Onche Auto Refresh = refresh la page des topaxent toutes les x secondes auto et l'autre script je m'en rappel plus des ses fonctions
mais voici son script
// ==UserScript==
// @name Oncheures
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Affichez les heures des posts
// @author Annapurna
// @match
https://onche.org/topic/*
// ==/UserScript==
// Get all message elements with class 'message'
const messages = document.querySelectorAll('.message');
// Get the href content of the first occurrence of the class 'active'
const hrefContent = document.querySelector('.active').href;
// Loop through each message
messages.forEach(message => {
// Find the element with class 'message-date' within this message
const messageDateElement = message.querySelector('.message-date');
// If such an element was found, extract the date and time from its title attribute using a regular expression
if (messageDateElement) {
const originalString = messageDateElement.getAttribute('title');
const regex = /(\d{2}\/\d{2}\/\d{4} à \d{2}:\d{2}:\d{2})/;
const match = regex.exec(originalString);
// If a match was found, create a new div element and set its inner HTML to the extracted date and time
if (match) {
const newLink = document.createElement('a');
const messageID = message.getAttribute('data-id');
newLink.href = hrefContent + '#message_' + messageID;
// Add CSS styles to the new link element
newLink.style.color = '#79bcee';
newLink.style.fontSize = '0.8125rem';
// Set the inner HTML of the link to the extracted date and time
newLink.innerHTML = match[0];
// Find the element with class 'message-infos' within this message and append the new link element to it
const messageInfosElement = message.querySelector('.message-infos');
if (messageInfosElement) {
messageInfosElement.appendChild(newLink);
}
messageDateElement.remove();
// Add a click event listener to the new link that scrolls to the target message and copies its href attribute to the clipboard
newLink.addEventListener('click', event => {
event.preventDefault();
const href = event.target.getAttribute('href');
const targetElement = document.querySelector(href);
if (targetElement) {
targetElement.scrollIntoView({ behavior: 'smooth' });
navigator.clipboard.writeText(href);
console.log('Link copied to clipboard:', href);
}
});
}
}
});
Onche Auto Refresh = refresh la page des topaxent toutes les x secondes auto et l'autre script je m'en rappel plus des ses fonctions
mais voici son script
// ==UserScript==
// @name Oncheures
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Affichez les heures des posts
// @author Annapurna
// @match
// ==/UserScript==
// Get all message elements with class 'message'
const messages = document.querySelectorAll('.message');
// Get the href content of the first occurrence of the class 'active'
const hrefContent = document.querySelector('.active').href;
// Loop through each message
messages.forEach(message => {
// Find the element with class 'message-date' within this message
const messageDateElement = message.querySelector('.message-date');
// If such an element was found, extract the date and time from its title attribute using a regular expression
if (messageDateElement) {
const originalString = messageDateElement.getAttribute('title');
const regex = /(\d{2}\/\d{2}\/\d{4} à \d{2}:\d{2}:\d{2})/;
const match = regex.exec(originalString);
// If a match was found, create a new div element and set its inner HTML to the extracted date and time
if (match) {
const newLink = document.createElement('a');
const messageID = message.getAttribute('data-id');
newLink.href = hrefContent + '#message_' + messageID;
// Add CSS styles to the new link element
newLink.style.color = '#79bcee';
newLink.style.fontSize = '0.8125rem';
// Set the inner HTML of the link to the extracted date and time
newLink.innerHTML = match[0];
// Find the element with class 'message-infos' within this message and append the new link element to it
const messageInfosElement = message.querySelector('.message-infos');
if (messageInfosElement) {
messageInfosElement.appendChild(newLink);
}
messageDateElement.remove();
// Add a click event listener to the new link that scrolls to the target message and copies its href attribute to the clipboard
newLink.addEventListener('click', event => {
event.preventDefault();
const href = event.target.getAttribute('href');
const targetElement = document.querySelector(href);
if (targetElement) {
targetElement.scrollIntoView({ behavior: 'smooth' });
navigator.clipboard.writeText(href);
console.log('Link copied to clipboard:', href);
}
});
}
}
});
il y a 2 ans
.
il y a 2 ans
c'était pas un problème mais une fonctionnalité
que j'ai aussitôt désactivée
que j'ai aussitôt désactivée
il y a 2 ans
c'était pas un problème mais une fonctionnalité
que j'ai aussitôt désactivée
que j'ai aussitôt désactivée
Comment t'as fait?
il y a 2 ans
Comment t'as fait?
vers la ligne 27 du script, tu remplaces avec ça:
if (event.key === "Enter" && event.shiftKey ) {
comme ça il faut appuyer sur shift ET entrée pour envoyer un message
if (event.key === "Enter" && event.shiftKey ) {
comme ça il faut appuyer sur shift ET entrée pour envoyer un message
il y a 2 ans
NVM j'utilisais une version outdated
// ==UserScript==
// @name On'Chat
// @namespace http://tampermonkey.net/
// @version 0.2
// @description Ajoute un LiveChat sur onche.org comme sur JVChat
// @author [email protected]
// @match
https://onche.org/topic/*
// @icon
https://www.google.com/s2[...]p;domain=tampermonkey.net
// @grant none
// ==/UserScript==
(function() {
'use strict';
// CONFIGURATION
const MESSAGES_PER_PAGES = 20;
// Variables for the keyboard event
const textarea = document.querySelector(".textarea");
const button = document.querySelector("input.button");
textarea.addEventListener("keydown", (event) => {
// Check if the pressed key is Enter and the Shift key isn't pressed
if (event.key === "Enter" && !event.shiftKey ) {
// Prevent the default behavior of the Enter key (i.e., inserting a newline)
event.preventDefault();
// Trigger the button click
button.click();
}
});
const fullUrlString = document.querySelector("div.pagination a.active").getAttribute('href');
// The
const rawUrlString = fullUrlString.split('\/').slice(0, -1).join('\/');
let activePage = parseInt(document.querySelector('.active').text, 10);
const allPagesElements = document.querySelectorAll("div.content.pagination div.pagination")[0].querySelectorAll('a');
let currentMessageCount = document.querySelectorAll("div.messages div.message:not(.answer)").length;
let initialMaxPage = parseInt(allPagesElements[allPagesElements.length - 1].text, 10);
console.log("Script is on")
console.log(rawUrlString)
function callMakeRequest() {
makeRequest(rawUrlString + "/" + activePage)
}
function isElementVisible(el) {
const rect = el.getBoundingClientRect();
return (
rect.top >= 0 &&
rect.left >= 0 &&
rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
rect.right <= (window.innerWidth || document.documentElement.clientWidth)
);
}
function makeRequest(url) {
// Create a new XMLHttpRequest object
const xhr = new XMLHttpRequest();
// Define the URL and method of the request
const method = "GET";
// Open the request with the URL and method
xhr.open(method, url);
// Define the callback function to read the response
xhr.onload = function() {
if (xhr.status === 200) {
const response = xhr.responseText;
// console.log(response)
const parser = new DOMParser();
const htmlDocument = parser.parseFromString(response, "text/html"); // Parse the HTML response
let messageCount = htmlDocument.querySelectorAll("div.messages div.message:not(.answer)").length
console.log(htmlDocument.querySelectorAll("div.messages div.message:not(.answer)"))
console.log("Number of text messages:", messageCount);
if (messageCount > currentMessageCount) {
console.log("New message")
let numberOfMessagesToAdd = messageCount - currentMessageCount;
let nodeArray = htmlDocument.querySelectorAll("div.messages div.message:not(.answer)")
let substring = Array.from(nodeArray).slice(messageCount - numberOfMessagesToAdd, messageCount);
// For each elements that we received. We apppend it to the messages
substring.forEach(element => {
document.querySelector('.messages').appendChild(element);
});
currentMessageCount = messageCount;
// If the textarea is visible we scroll
if (isElementVisible(textarea)) {
// execute the action if the element is visible
document.querySelector(".textarea").scrollIntoView({
block: "center",
inline: "nearest",
behavior: "smooth"
});
}
if (currentMessageCount === MESSAGES_PER_PAGES) {
activePage += 1
currentMessageCount = 0
}
}
//console.log(response);
// Replace this with your actual response handling code
}
};
// Send the request
xhr.send();
}
console.log()
if (activePage !== initialMaxPage) { return }
setInterval(callMakeRequest, 2000);
})();// ==UserScript==
// @name New Userscript
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match
https://onche.org/topic/3[...]nche-decouvrez-on-chat/13
// @icon
https://www.google.com/s2[...]z=64&domain=onche.org
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Your code here...
})();
// ==UserScript==
// @name On'Chat
// @namespace http://tampermonkey.net/
// @version 0.2
// @description Ajoute un LiveChat sur onche.org comme sur JVChat
// @author [email protected]
// @match
// @icon
// @grant none
// ==/UserScript==
(function() {
'use strict';
// CONFIGURATION
const MESSAGES_PER_PAGES = 20;
// Variables for the keyboard event
const textarea = document.querySelector(".textarea");
const button = document.querySelector("input.button");
textarea.addEventListener("keydown", (event) => {
// Check if the pressed key is Enter and the Shift key isn't pressed
if (event.key === "Enter" && !event.shiftKey ) {
// Prevent the default behavior of the Enter key (i.e., inserting a newline)
event.preventDefault();
// Trigger the button click
button.click();
}
});
const fullUrlString = document.querySelector("div.pagination a.active").getAttribute('href');
// The
const rawUrlString = fullUrlString.split('\/').slice(0, -1).join('\/');
let activePage = parseInt(document.querySelector('.active').text, 10);
const allPagesElements = document.querySelectorAll("div.content.pagination div.pagination")[0].querySelectorAll('a');
let currentMessageCount = document.querySelectorAll("div.messages div.message:not(.answer)").length;
let initialMaxPage = parseInt(allPagesElements[allPagesElements.length - 1].text, 10);
console.log("Script is on")
console.log(rawUrlString)
function callMakeRequest() {
makeRequest(rawUrlString + "/" + activePage)
}
function isElementVisible(el) {
const rect = el.getBoundingClientRect();
return (
rect.top >= 0 &&
rect.left >= 0 &&
rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
rect.right <= (window.innerWidth || document.documentElement.clientWidth)
);
}
function makeRequest(url) {
// Create a new XMLHttpRequest object
const xhr = new XMLHttpRequest();
// Define the URL and method of the request
const method = "GET";
// Open the request with the URL and method
xhr.open(method, url);
// Define the callback function to read the response
xhr.onload = function() {
if (xhr.status === 200) {
const response = xhr.responseText;
// console.log(response)
const parser = new DOMParser();
const htmlDocument = parser.parseFromString(response, "text/html"); // Parse the HTML response
let messageCount = htmlDocument.querySelectorAll("div.messages div.message:not(.answer)").length
console.log(htmlDocument.querySelectorAll("div.messages div.message:not(.answer)"))
console.log("Number of text messages:", messageCount);
if (messageCount > currentMessageCount) {
console.log("New message")
let numberOfMessagesToAdd = messageCount - currentMessageCount;
let nodeArray = htmlDocument.querySelectorAll("div.messages div.message:not(.answer)")
let substring = Array.from(nodeArray).slice(messageCount - numberOfMessagesToAdd, messageCount);
// For each elements that we received. We apppend it to the messages
substring.forEach(element => {
document.querySelector('.messages').appendChild(element);
});
currentMessageCount = messageCount;
// If the textarea is visible we scroll
if (isElementVisible(textarea)) {
// execute the action if the element is visible
document.querySelector(".textarea").scrollIntoView({
block: "center",
inline: "nearest",
behavior: "smooth"
});
}
if (currentMessageCount === MESSAGES_PER_PAGES) {
activePage += 1
currentMessageCount = 0
}
}
//console.log(response);
// Replace this with your actual response handling code
}
};
// Send the request
xhr.send();
}
console.log()
if (activePage !== initialMaxPage) { return }
setInterval(callMakeRequest, 2000);
})();// ==UserScript==
// @name New Userscript
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match
// @icon
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Your code here...
})();
il y a 2 ans