Greasy Fork

Greasy Fork is available in English.

Newegg Screen Dimensions

Shows the screen dimensions next to the diagonal size

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name           Newegg Screen Dimensions
// @namespace      http://mailerdaemon.home.comcast.net
// @description    Shows the screen dimensions next to the diagonal size
// @include        http://www.newegg.com/Product/Product.aspx?*
// @version        0.1
// ==/UserScript==

size = $X("//div[@id='pcraSpecs']//td[position()=1 and text()='Screen Size']/following-sibling::td/text()");
dim = $X("//div[@id='pcraSpecs']//td[position()=1 and text()='Maximum Resolution']/following-sibling::td/text()");

if(size && dim)
{
	result = /[\s]*([\d]+)[\s]+x[\s]+([\d]+)[\s]*/.exec(dim.data);
	x = Number(result[1]);
	y = Number(result[2]);
	d = Number(size.data.slice(0, -1));
	ps = d / Math.sqrt(x * x + y * y);
	size.data = size.data + " ( " + String(ps * x).slice(0,5) +'" x ' + String(ps * y).slice(0,5) + '" )';
	
	pp = $X("//div[@id='pcraSpecs']//td[position()=1 and text()='Pixel Pitch']/following-sibling::td/text()");
	if(pp)
		pp.data += ' [' + String(ps / 0.0393700787402).substring(0, 5) + 'mm]';
	//else
		size.data += ' at ' + String(ps / 0.0393700787402).substring(0, 5) + 'mm';
}

function $X(_xpath, node){return document.evaluate(_xpath, node?node:document, null,	XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null).snapshotItem(0);}
/*
function $Y(_xpath, node){return document.evaluate(_xpath, node?node:document, null,	XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);}
function $Z(_xpath, func, node, payload){
    var res = document.evaluate(_xpath, node?node:document, null,	XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
    var i, j;
    for (i = j = 0; link = res.snapshotItem(i); ++i)
        j += func(link, i, payload);
    return j;
}
function insertAfter(insert, after){return after.parentNode.insertBefore(insert, after.nextSibling);}
function insertBefore(insert, before){return before.parentNode.insertBefore(insert, before);}
*/