NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name KaoScript V2 // @namespace http://tampermonkey.net/ // @version 0.4 // @description make v23 great again // @author Kaori // @match https://www.parano.be/v23/* // @icon https://www.google.com/s2/favicons?sz=64&domain=parano.be // @grant GM_addStyle // @license MIT // @copyright 2022, kaori00 (https://openuserjs.org/users/kaori00) // @updateURL https://openuserjs.org/meta/kaori00/KaoScript_V2.meta.js // @downloadURL https://openuserjs.org/install/kaori00/KaoScript_V2.user.js // ==/UserScript== (function() { 'use strict'; const kaoScript =` .textAreaCounter { display: flex; justify-content: flex-end; } .wall_item { display: grid; grid-template-columns: 45px auto; grid-template-rows: auto; grid-template-areas: "photo header" "photo content" "photo footer" } .wall_item .text{ grid-area: content; } .wall_item .flexbar{ grid-area: footer; } .header.messageHeaderOption{ grid-area: header; } .photoElement { grid-area: photo; } .photoElement img { max-height: 75px; max-width:40px; } `; GM_addStyle(kaoScript); function insertAfter(newNode, node) { node.parentNode.insertBefore(newNode, node.nextSibling); } function initTextArea(elementName){ let element = document.querySelector(elementName); if(!element){ return false; } createCounter(element, element.maxLength); element.addEventListener('keyup', (event) => { let length = event.target.value.length; updateCount(element,length); }); } function createCounter(element, maxlength){ if(element){ let contentElement = document.createElement('div'); contentElement.classList.add('textAreaCounter'); let currentElement = document.createElement('div'); currentElement.classList.add('current'); currentElement.innerText = 0; let separatorElement = document.createElement('div'); separatorElement.classList.add('separator'); separatorElement.innerText = "/"; let maxElement = document.createElement('div'); maxElement.classList.add('max'); maxElement.innerText = maxlength; contentElement.appendChild(currentElement); contentElement.appendChild(separatorElement); contentElement.appendChild(maxElement); insertAfter(contentElement,element); } } function updateCount(element, current){ element.nextSibling.querySelector('.current').innerText = current; } ['textarea#textAreaCommentaire','#wall_form > textarea','textarea#titre','textarea#chapo','textarea#message'].forEach(function(ta){ initTextArea(ta); }); if(window.location.pathname.startsWith('/v23/profile/')){ let pseudoElement = document.querySelector('#pseudo').innerText.split(' '); localStorage.setItem(pseudoElement[1], pseudoElement[0]); let photoElement = document.querySelector('#frimousse'); let photoHref = document.querySelector('#frimousse').src; localStorage.setItem(pseudoElement[1]+'_photo', photoHref); } if(window.location.pathname == '/v23/propa/'){ let messages = document.querySelectorAll('.wall_item'); messages.forEach(function(message){ let citoyenNameA = message.querySelector('div.source > a'); let citoyenId = 0; let citoyenName = ''; if(citoyenNameA.innerText.startsWith('Citoyen n°')){ let matches = citoyenNameA.innerText.match(/(\d+)/); if(matches){ citoyenId = matches[0]; } citoyenName = localStorage.getItem(citoyenId); }else{ let matches = citoyenNameA.href.match(/id=(\d+)/); console.log(matches); if(matches){ citoyenId = matches[1]; } citoyenName = citoyenNameA.innerText; } if(citoyenName){ citoyenNameA.innerText = citoyenName +' - '+citoyenId; } let citoyenPhoto = citoyenName = localStorage.getItem(citoyenId+'_photo'); if(!citoyenPhoto){ citoyenPhoto = "https://picsum.photos/seed/"+citoyenId+"/75/150" } let photoElement = document.createElement('div'); photoElement.classList.add('photoElement'); let photoImg = document.createElement('img'); photoImg.src = citoyenPhoto; photoElement.appendChild(photoImg); message.insertBefore(photoElement, message.firstChild); console.log(citoyenPhoto); }); } })();