NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Add avatars // @namespace gamedev.ru // @description Add avatars to gamedev.ru forum // @version 1.3 // @author cin // @include /^https?://(www.)?gamedev\.ru\/.*$/ // @grant none // @run-at document-start // @license MIT // @copyright 2017, cin (vovapobeda@gmail.com) // @updateURL https://openuserjs.org/meta/cin/Add_avatars.meta.js // ==/UserScript== (function () { 'use strict'; document.addEventListener("DOMContentLoaded", function (event) { InsertAvatar(); }); function InsertAvatar() { let items = [...document.querySelectorAll('div.mes')].forEach(msg => { let th = msg.querySelector('table.mes>tbody>tr>th'); if (th) { let div = document.createElement('div'); div.style.cssText = `display: inline-flex; align-items: center;`; th.appendChild(div); let b = th.querySelector('b'); let a = th.querySelector('a'); let ava = document.createElement('div'); let bk = "http://www.gamedev.ru/users/pics/?id=" + a.href.split("=")[1]; ava.style.cssText = "width: 35px; height: 35px; margin-top: 4px; margin-right: 10px; margin-left: 5px; border-radius: 50%; background-size: cover; background-image: url(" + bk + "); background-color: #e3e7ed; border: 2px solid #fefefe; box-shadow: 0px 0px 4px #6f869b;"; div.appendChild(ava); div.appendChild(a); th.removeChild(b); } }); } })();