|
发表于 2021-6-13 20:21:36
|
显示全部楼层
江西省上饶市
// ==UserScript==
// @name for125_2
// @Namespace http://tampermonkey.net/
// @Version 0.2
// @description try to take over the world!
// @author shennv
// @match https://bbs.125.la/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Your code here...
function gradientColor(startClr, endClr, step) {
var startR = startClr >> 16 & 255;
var startG = startClr >> 8 & 255;
var startB = startClr & 255;
var endR = endClr >> 16 & 255;
var endG = endClr >> 8 & 255;
var endB = endClr & 255;
var sR = endR - startR;
var sG = endG - startG;
var sB = endB - startB;
//console.log('' + sR + '-' + sG + '-' + sB);
var arrClr = [];
for (var i = 0; i <= step; i++) arrClr.push(startR + sR * i / step << 16 | startG + sG * i / step << 8 | startB + sB * i / step);
return arrClr;
}
function fullHex(value) {
var map = '000000';
var temp = value.toString(16);
var len = temp.length;
if (len < 6) temp = '000000'.substr(len - 6) + temp;
return temp;
}
$("vfastpostform").submit = function() {
var str = $('vmessage').value;
var len = str.length;
var arrClr = gradientColor(0xff00ff, 0xff00, len);
var str2 = '';
for (var i = 0; i < len; i++) {
str2 += '[color=#' + fullHex(arrClr) + ']' + str.substr(i, 1) + '';
}
$('fastpostmessage').value = str2;
$('fastpostform').submit();
}
})(); |
|