My Gaia Friends Full Avatar

View a friends full avatar on the My Gaia page

当前为 2018-09-19 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         My Gaia Friends Full Avatar
// @namespace   gaiarch_v3
// @match       https://*.gaiaonline.com/mygaia
// @version     1.0.0
// @grant       none
// @description View a friends full avatar on the My Gaia page
// ==/UserScript==

let avatarBox = document.querySelectorAll('.dropBox');

for(let box of avatarBox) {
	box.addEventListener('mouseenter', mouseenter);
  box.addEventListener('mouseleave', mouseleave);
}

function mouseenter(evt) {
  console.log(this)
  let avatar = this.querySelector('.avatarImage');
  let fullAviBox = this.appendChild(document.createElement('div'));
  fullAviBox.className = 'fullavi';
  fullAviBox.style = 'position:absolute;bottom:0;left:0;background:#efffdf;border:1px solid #90c085';
  let username = fullAviBox.appendChild(document.createElement('span'));
  username.className = 'user_name';
  username.appendChild(document.createTextNode(avatar.offsetParent.querySelector('.user_name').textContent));
  let fullAvi = fullAviBox.appendChild(document.createElement('img'));
  fullAvi.src = avatar.src.replace('48x48.gif', 'flip.png');
//   fullAvi.style.top = `${-fullAvi.offsetHeight}px`;
}

function mouseleave(evt) {
  console.log(this.querySelector('.fullavi'))
  this.querySelector('.fullavi').remove();
}