The so scrolling pouët.net oneliner

1in10: "I wish the oneliner scrolled"

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        The so scrolling pouët.net oneliner
// @namespace   raina
// @description 1in10: "I wish the oneliner scrolled"
// @include     /^https?:\/\/((m|www)\.)?pouet\.net($|\/|\/index\.php|\/oneliner\.php)/
// @version     1.1
// @grant       none
// ==/UserScript==
(function() {
	"use strict";
	var style = document.createElement("style");
	style.textContent = '' +
		'.scroll {' +
		'	position: relative;' +
		'	height: 1.5em;' +
		'}' +
		'.scroll p {' +
		'	position: absolute;' +
		'	white-space: nowrap;' +
		'	animation: linear infinite scroll;' +
		'}' +
		'.scroll p:hover {' +
		'	animation-play-state: paused;' +
		'}' +
		'.scroll .usera,' +
		'.scroll a + time {' +
		'	margin-left: 32px;' +
		'}' + 
		'.scroll time + .usera {' +
		'	margin-left: 0px;' +
		'}' + 
		'@keyframes scroll {' +
		'	0% {' +
		'		left: 100%;' +
		'		transform: translateX(0%);' +
		'	}' +
		'	100% {' +
		'		left: -100%;' +
		'		transform: translateX(-100%);' +
		'	}' +
		'}';
	var lines = [];
	var lis = document.querySelectorAll('[id*="oneliner"] ul li');
	var newLine = document.createElement("li");
	var p = document.createElement("p");
	document.head.appendChild(style);
	for (var i = 0; i < lis.length; i++) {
		if ("day" == lis[i].className) {
			if ("" != newLine.innerHTML) {
				newLine.className = "scroll";
				lines.push(newLine);
			}
			newLine = document.createElement("li");
			p = document.createElement("p");
		} else {
			p.innerHTML += lis[i].innerHTML;
			p.setAttribute("style", "animation-duration: " + (p.textContent.length / 10) + "s");
			newLine.appendChild(p);	
			lis[i].parentElement.removeChild(lis[i]);
		}
	}
	newLine.className = "scroll";
	lines.push(newLine);
	lis = document.querySelectorAll('[id*=oneliner] ul li.day');
	if (lis.length) {
		for (i = 0; i < lines.length; i++) {
			lis[i].parentElement.insertBefore(lines[i], lis[i].nextSibling);
		}
	} else {
		document.querySelector('[id*="oneliner"] ul').appendChild(lines[0]);
	}
})();