您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
PSN中文网的数折价格可视化,机因楼主高亮等
当前为
// ==UserScript== // @name PSN中文网功能增强 // @namespace https://swsoyee.github.io // @version 0.12 // @description PSN中文网的数折价格可视化,机因楼主高亮等 // @author InfinityLoop // @match https://psnine.com/* // @require http://cdn.staticfile.org/jquery/2.1.4/jquery.min.js // @require http://code.highcharts.com/highcharts.js // @grant GM_addStyle // ==/UserScript== (function() { 'use strict'; // 高亮发帖楼主 GM_addStyle (`.highlightAuthor {background-color: #da314b !important;}`) if( /gene/.test(window.location.href) || /trade/.test(window.location.href)) { var author = document.querySelector("a.title2").textContent var responsed = document.querySelectorAll("a.psnnode") for (var index = 0; index < responsed.length; index++) { if(responsed[index].innerText == author) { responsed[index].className += " highlightAuthor" } } } // 商城价格走势图 if( /dd/.test(window.location.href) ) { // 日期转换函数 function converntTime(value) { var timeArray = value.replace('年','-').replace('月','-').replace('日','').split("-") timeArray[0] = "20" + timeArray[0] timeArray[1] = Number(timeArray[1]) - 1 return Date.UTC(timeArray[0], timeArray[1], timeArray[2]) } // 获取X轴的日期 var xContents = document.querySelectorAll("p.dd_text") var xValue = []; var today = new Date() var todayArray = Date.UTC(today.getYear() + 1900, today.getMonth(), today.getDate()) for(var xindex = 3; xindex < xContents.length; xindex+=4 ){ var tamp = xContents[xindex].innerText.split(" ~ ") tamp[0] = converntTime(tamp[0]) tamp[1] = converntTime(tamp[1]) xValue = [tamp[0], tamp[0], tamp[1], tamp[1]].concat(xValue) } //获取价格 var y = document.querySelectorAll(".dd_price") var yValueNormal = []; var yValuePlus = []; for(var yindex = 0; yindex < y.length; yindex++ ){ var yPriceOld = y[yindex].querySelector(".dd_price_old").innerText var yPriceNormal = y[yindex].querySelector(".dd_price_off").innerText var yPricePlus = y[yindex].querySelector(".dd_price_plus") yValueNormal = [yPriceOld, yPriceNormal, yPriceNormal, yPriceOld].concat(yValueNormal) var pricePlusTamp = "" if( yPricePlus == null ){ pricePlusTamp = yPriceNormal } else { pricePlusTamp = yPricePlus.innerText } yValuePlus = [yPriceOld, pricePlusTamp, pricePlusTamp, yPriceOld].concat(yValuePlus) } // 普通价格数据 var xForPlotNormal = new Array() var xForPlotPlus = new Array() // 判断地区 var replaceString = "" if( yValueNormal[0].search("HK\\$") > -1 ){ replaceString = "HK$" } else if( yValueNormal[0].search("\\$") > -1 ){ replaceString = "$" } else if( yValueNormal[0].search("\\£") > -1 ){ replaceString = "£" } else { replaceString = "¥" } for(var i = 0; i < xValue.length; i++ ){ xForPlotNormal[i] = [xValue[i], Number(yValueNormal[i].replace(replaceString, ""))] xForPlotPlus[i] = [xValue[i], Number(yValuePlus[i].replace(replaceString, ""))] } // 修正最后一组数据 if( xForPlotNormal[xForPlotNormal.length - 1][0] > todayArray ){ xForPlotNormal.pop() xForPlotPlus.pop() xForPlotNormal[xForPlotNormal.length - 1][0] = todayArray xForPlotPlus[xForPlotPlus.length - 1][0] = todayArray } else { xForPlotNormal.push([todayArray, xForPlotNormal[xForPlotNormal.length - 1][1]]) xForPlotPlus.push([todayArray, xForPlotPlus[xForPlotPlus.length - 1][1]]) } // 插入页面 $(".pd10").append (`<div id="container""></div>`); var chart = { type: 'areaspline' }; var title = { text: '价格变动走势图' }; var xAxis = { type: 'datetime', dateTimeLabelFormats: { day: '%e. %b', month: '%b \'%y', year: '%Y' }, title: { text: 'Date' } }; var yAxis = { title: { text: '价格' }, plotLines: [{ value: 0, width: 1, color: '#808080' }] }; var tooltip = { headerFormat: '<b>{series.name}</b><br>', pointFormat: '{point.x:%e. %b}: '+ replaceString + '{point.y:.2f}' }; var plotOptions = { areaspline: { fillOpacity: 0.25 } }; var series= [{ name: '普通会员价', color: '#00a2ff', data: xForPlotNormal }, { name: 'PS+会员价', color: '#ffd633', data: xForPlotPlus } ]; var credits = { enabled : false }; var json = {}; json.chart = chart; json.title = title; json.tooltip = tooltip; json.xAxis = xAxis; json.yAxis = yAxis; json.series = series; json.plotOptions = plotOptions; json.credits = credits; $('#container').highcharts(json); } })();