1300

移行用のテストです

ニュートピ!の記事へのリンクと「記事をすぐ読む」リンクを入れ替える

// ==UserScript==
// @name         newtopi_link_exchange
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://newstopics.jp/*
// @grant        none
// ==/UserScript==
var result = document.evaluate('//a[@class="title"]', document, null, 7, null);
var tmp = [];
for (var i = 0; i < result.snapshotLength; i++) {
  tmp[i] = result.snapshotItem(i).href;
}
var result2 = document.evaluate('//div[contains(@class,"comment")]/a[1]', document, null, 7, null);
for (i = 0; i < result.snapshotLength; i++) {
  result.snapshotItem(i).href = result2.snapshotItem(i).href;
}
for (i = 0; i < result.snapshotLength; i++) {
  result2.snapshotItem(i).href = tmp[i];
}
var result3 = document.evaluate('//div[@class="content" or @class="top_content"]//span[@class="comment_link"]/i/following-sibling::text()[1]', document, null, 7, null);
for (var k = 0; k < result3.snapshotLength; k++) {
  result3.snapshotItem(k).nodeValue = "ツイートを見る";
}
var result5 = document.evaluate('//div[@class="sidebar_content"]//span[@class="comment_link"]/i/following-sibling::text()[1]', document, null, 7, null);
for (var x = 0; x < result5.snapshotLength; x++) {
  result5.snapshotItem(x).nodeValue = "ツイート";
}
var result4 = document.evaluate('//span[@class="comment_link"]/i/following-sibling::text()[1]/following-sibling::node()', document, null, 7, null);
for (var j = 0; j < result4.snapshotLength; j++) {
  result4.snapshotItem(j).remove();
}