-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpixivid.user.js
32 lines (31 loc) · 1.12 KB
/
pixivid.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// ==UserScript==
// @name pixiv ID
// @include http://www.pixiv.net/*
// ==/UserScript==
;(function() {
"use strict";
var addUIDNode = function() {
var KEY_URL = "http://www.pixiv.net/stacc/";
var NODE_ID = "userjs-user-id-item";
var src = document.querySelector("ul.tabs a[href^='" + KEY_URL + "']");
var dst = document.querySelector(".user-relation");
var uidnode = document.querySelector("#" + NODE_ID);
if (!uidnode && src && dst) {
var userID = src.href.slice(KEY_URL.length).match(/[-\w]*/)[0];
var li = document.createElement("li");
var a = document.createElement("a");
li.id = NODE_ID;
a.textContent = userID;
a.href = "http://drawr.net/" + userID;
a.style.display = "inline-block";
a.style.paddingLeft = "24px";
a.style.backgroundImage = "url(http://drawr.net/images/icon_top.gif)";
a.style.backgroundRepeat = "no-repeat";
li.appendChild(a);
dst.appendChild(li);
}
};
if (document.readyState === "complete") addUIDNode();
else addEventListener("DOMContentLoaded", addUIDNode);
addEventListener("popstate", addUIDNode);
})();