以下是此Google Chrome瀏覽器擴展程序的基本代碼。如果您希望看到該擴展程序的實際運行情況,請將其從網上商店下載下來,以便了解它的工作原理。 Extension Link
function checkForHat() {
$.get (
'http://www.roblox.com/User.aspx?ID=1',
function parse(data) {
$(data).ready(function() {
var epicness = $(data).find('#ctl00_cphRoblox_rbxUserAssetsPane_AssetCategoryRepeater_ctl02_AssetCategorySelector');
var epiclink = epicness.attr('href');
eval(epiclink)
var hatid1 = $(data).find('#ctl00_cphRoblox_rbxUserAssetsPane_UserAssetsDataList_ctl00_AssetThumbnailHyperLink');
var hatidtitle1 = hatid1.attr('title');
var hatidhref1 = "http://www.roblox.com" + hatid1.attr('href');
var hatidpi1 = $(hatid1).find('img')
var hatidpic1 = hatidpi1.attr('src')
hatLink1 = hatidhref1;
hatTitle1 = hatidtitle1;
hatPic1 = hatidpic1;
var hatid2 = $(data).find('#ctl00_cphRoblox_rbxUserAssetsPane_UserAssetsDataList_ctl01_AssetThumbnailHyperLink');
var hatidtitle2 = hatid2.attr('title');
var hatidhref2 = "http://www.roblox.com" + hatid2.attr('href');
var hatidpi2 = $(hatid2).find('img')
var hatidpic2 = hatidpi2.attr('src')
hatLink2 = hatidhref2;
hatTitle2 = hatidtitle2;
hatPic2 = hatidpic2;
var hatid3 = $(data).find('#ctl00_cphRoblox_rbxUserAssetsPane_UserAssetsDataList_ctl02_AssetThumbnailHyperLink');
var hatidtitle3 = hatid3.attr('title');
var hatidhref3 = "http://www.roblox.com" + hatid3.attr('href');
var hatidpi3 = $(hatid3).find('img')
var hatidpic3 = hatidpi3.attr('src')
hatLink3 = hatidhref3;
hatTitle3 = hatidtitle3;
hatPic3 = hatidpic3;
if (hatLink3 != null && hatTitle3 != null && hatPic3 != null) {
checkIfNew3();
}
if (hatLink2 != null && hatTitle2 != null && hatPic2 != null) {
checkIfNew2();
}
if (hatLink1 != null && hatTitle1 != null && hatPic1 != null) {
checkIfNew1();
}
});
}
);
};
如果你注意到開始我有一個評估聲明。我認爲這隻適用於實際的擴展本身,但我想要做的是使用:$.get
。有沒有辦法加載該網頁,並在該網頁上切換標籤頁,如果有,如何? (這些標籤位於名爲Gear,Shirts,Pants等的底部)
什麼是eval應該做的? – nnnnnn 2012-01-29 03:46:52