Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name JoyReactor comment rating
- // @version 1
- // @grant none
- // @include http://old.reactor.cc/*
- // ==/UserScript==
- $(document).ready(function () {
- console.log('initialized');
- if ((/\/post\/[0-9]+/).test(location.pathname)) {
- fetch(location.toString(), {'credentials' : 'omit'})
- .then(r => r.text())
- .then(t => $(t).find('.comment_rating'))
- .then(function(d) {
- d.each((i ,r) => {
- var commentNodeId = 'comment' + r.attributes.comment_id.nodeValue;
- var commentNode = document.getElementById(commentNodeId);
- var innerNode = commentNode.querySelector('.comment_rating > span');
- if (innerNode.childNodes[0].nodeName === '#text') {
- innerNode.childNodes[0].textContent = r.textContent.trim() + ' ';
- } else {
- innerNode.prepend(document.createTextNode(r.textContent.trim() + ' '));
- }
- });
- });
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment