Raw Source
esoytekin / kullanici_entryleri

// ==UserScript==
// @name         kullanici_entryleri
// @namespace    https://eksisozluk.com
// @version      0.0.1
// @author       esoytekin
// @description  Kullanici ismine tikaldiginizda sag tarafta kullanicinin son 10 entrysi gorunur
// @match        http://eksisozluk.com/*
// @match        https://eksisozluk.com/*
// @grant        GM.xmlHttpRequest
// @license MIT
// @updateURL https://openuserjs.org/meta/esoytekin/Display_user_entries.meta.js
// @downloadURL https://openuserjs.org/install/esoytekin/Display_user_entries.user.js
// @copyright 2023, esoytekin (https://openuserjs.org/users/esoytekin)
// ==/UserScript==

(t=>{const o=document.createElement("style");o.dataset.source="vite-plugin-monkey",o.innerText=t,document.head.appendChild(o)})(" .div-aside{position:fixed;overflow:auto;right:5rem;height:100%;padding:10px;width:100%;display:flex;background-color:#2d2d2d;border:solid 1px #3d3d3d;border-radius:5px}button.btn{border-radius:8px;border:1px solid transparent;padding:.6em 1.2em;font-size:1em;font-weight:500;font-family:inherit;background-color:#1a1a1a;cursor:pointer;transition:border-color .25s}button.btn:hover{border-color:#646cff}button.btn:focus,button.btn:focus-visible{outline:4px auto -webkit-focus-ring-color}.tooltip{position:relative;display:inline-block;border-bottom:1px dotted black}.tooltip .tooltiptext{visibility:hidden;width:120px;background-color:#000;color:#fff;text-align:center;border-radius:6px;padding:5px 0;position:absolute;z-index:1;top:-150%;right:0}.tooltip:hover .tooltiptext{visibility:visible} ");

(function() {
  "use strict";
  const userNameClicked = (user) => {
    return new Promise((resolve) => {
      const userInfoURL = `https://eksisozluk.com/son-entryleri?nick=${user}`;
      GM.xmlHttpRequest({
        method: 'GET',
        url: userInfoURL,
        headers: {
          "X-Requested-With": "XMLHttpRequest"
        },
        onload: ({ responseText }) => {
          resolve(responseText);
        }
      });
    });
  };
  const getEntries = ({
    onUserNameClick: onUserNameClick2
  }) => {
    const entryLinks = document.querySelectorAll("a.entry-author");
    if (!entryLinks.length) {
      return;
    }
    entryLinks.forEach((entryLink) => {
      const html = entryLink.innerHTML;
      const textContent = entryLink.textContent;
      entryLink.innerHTML = `
        <div class="tooltip">${html}
          <button class="btn tooltiptext">Entrylerini Goster</button>
        </div>
        `;
      const tooltip2 = entryLink.querySelector(".tooltip");
      tooltip2.addEventListener("click", (e) => {
        userNameClicked(textContent).then(onUserNameClick2);
        e.preventDefault();
      });
    });
  };
  const button = "";
  const tooltip = "";
  const onUserNameClick = (content) => {
    const asideHTML = document.querySelector("#aside");
    asideHTML.innerHTML = content;
    if (!asideHTML.classList.contains("div-aside")) {
      asideHTML.classList.add("div-aside");
    }
  };
  getEntries({ onUserNameClick });
})();