doubanmail

用于将豆瓣中的“私信”修改为“豆邮”

目前為 2015-05-18 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name           doubanmail
// @description	   用于将豆瓣中的“私信”修改为“豆邮”
// @version 	   1.0
// @namespace      Capella
// @grant          GM_getValue
// @grant          GM_setValue
// @grant          GM_xmlhttpRequest
// @grant          GM_log
// @grant          GM_getResourceURL
// @include        http://*douban.com*
// @require        https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js
// ==/UserScript==


//t = document.getElementsByTagName('title');
//alert(t.length);
	
t = $('title');
//alert(t[0].innerHTML.indexOf("私信"));
t[0].innerHTML = t[0].innerHTML.replace(/ 私信/g,"我的豆邮");
t[0].innerHTML = t[0].innerHTML.replace(/私信/g,"豆邮");
//alert("1");

t = document.getElementById("top-nav-doumail-link");
t.innerHTML = t.innerHTML.replace(/私信/g,"豆邮");
//alert(t.innerHTML);

if(location.pathname.indexOf("people")!=-1){
	
	t = document.evaluate(
	"//a[@class='a-btn mr5']",
	document,
	null,
	XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
	null);
	if(t.snapshotLength>0){
		t.snapshotItem(0).innerHTML = t.snapshotItem(0).innerHTML.replace(/私信/g,"豆邮");
	}
}
//alert("2");
if(location.pathname.indexOf("doumail")!=-1){
	//alert("1");
	t = document.getElementsByTagName("h1");
	for(var i=0;i<t.length;i++){
		//alert(t[i].innerHTML);
		if(t[i].innerHTML.indexOf("不影响功能使用")!=-1){
			t[i].innerHTML = "我的豆邮";		
		}
	}
	t = document.getElementsByTagName("h1");
	for(var i=0;i<t.length;i++){
		t[i].innerHTML = t[i].innerHTML.replace(/私信/g,"豆邮");
	}
	t = document.evaluate(
	"//a[@class='label']",
	document,
	null,
	XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
	null);
	//alert(t.snapshotLength);
	if(t.snapshotLength>0)t.snapshotItem(0).innerHTML = t.snapshotItem(0).innerHTML.replace(/私信/g,"豆邮");
	t = document.evaluate(
	"//div[@class='inbox-filter-list']",
	document,
	null,
	XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
	null);
	//alert(t.snapshotLength);
	if(t.snapshotLength>0)t.snapshotItem(0).innerHTML = t.snapshotItem(0).innerHTML.replace(/私信/g,"豆邮");
	t = document.evaluate(
	"//div[@class='tabs']",
	document,
	null,
	XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
	null);
	//alert(t.snapshotLength);
	if(t.snapshotLength>0)t.snapshotItem(0).innerHTML = t.snapshotItem(0).innerHTML.replace(/私信/g,"豆邮");
	t = document.evaluate(
	"//div[@class='aside']",
	document,
	null,
	XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
	null);
	//alert(t.snapshotLength);
	if(t.snapshotLength>0){
		t.snapshotItem(0).innerHTML = t.snapshotItem(0).innerHTML.replace(/返回私信/g,"返回我的豆邮");
		t.snapshotItem(0).innerHTML = t.snapshotItem(0).innerHTML.replace(/私信/g,"豆邮");
	}
	t = document.evaluate(
	"//div[@class='item-submit']",
	document,
	null,
	XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
	null);
	//alert(t.snapshotLength);
	if(t.snapshotLength>0){
		if(t.snapshotItem(0).innerHTML.indexOf("回应")!=-1){
			t.snapshotItem(0).innerHTML = '<span class="bn-flat"><input type="submit" name="m_reply" value="回信"></span>';
		}
	}
}

t = document.getElementsByTagName("script");
for(var i=0;i<t.length;i++){
	if(t[i].innerHTML.indexOf("私信")!=-1){
		t[i].innerHTML = t[i].innerHTML.replace(/私信/g,"豆邮");
		//alert(t[i].innerHTML);
		//alert(i);
	}
}
//alert(t.length);
//t[0].innerHTML = t[0].innerHTML.replace(/私信</g,"豆邮<");

//alert(t.snapshotItem(0).innerHTML);
//t = document.getElementsByTagName("div");
/*alert(t.length);
for(var i=0;i<t.length;i++){
	//alert(t[i].innerHTML);
	if(t[i].innerHTML.indexOf("私信")!=-1){
		t[i].innerHTML = t[i].innerHTML.replace(/私信</g,"豆邮<");
		//alert(t[i].innerHTML);
		//alert(i);
	}
}*/
//alert(t[0].innerHTML);