-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
101 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
!function(win, doc, $){ | ||
|
||
$(doc).ready(function() { | ||
chrome.runtime.sendMessage({method: "getLocalStorage", key: "weibo_status"}, function(res) { | ||
var status = res.data; | ||
var today = (new Date()).toDateString(); | ||
if (! (status && today === status)) { | ||
// need cookie | ||
chrome.runtime.sendMessage({method: "weibo_qiandao"}, function(res) {}); | ||
} else { | ||
console.log('[qiandao][weibo] already signIn today.'); | ||
} | ||
}); | ||
}); | ||
|
||
}(window, document, Zepto); | ||
|
||
|
||
!function(win, doc, $){ | ||
|
||
$(doc).ready(function() { | ||
// only do it when login | ||
if (1) { // no way to find | ||
chrome.runtime.sendMessage({method: "getLocalStorage", key: "suning_status"}, function(res) { | ||
var status = res.data; | ||
var today = (new Date()).toDateString(); | ||
if (! (status && today === status)) { | ||
$.ajax({ | ||
type : "POST", | ||
url : 'http://vip.suning.com/ams-web/world/pointSign.htm?r=' + Math.random(), | ||
dataType : 'json', | ||
success : function(data) { | ||
// copied from http://vip.suning.com/ | ||
if (data.errorFlag ==" Y"){ | ||
return; | ||
} | ||
|
||
if (data.pointGetInfo.pointsQuantity) { | ||
chrome.runtime.sendMessage({ | ||
method: "setLocalStorage", key: "suning_status", val: today | ||
}, function(res) {}); | ||
chrome.runtime.sendMessage({ | ||
method: "setLocalStorage", key: "suning_points", val: data.pointValue.totalPoint | ||
}, function(res) {}); | ||
console.log('[qiandao][suning] signIn OK.'); | ||
// console.log(data); | ||
} | ||
} | ||
}); | ||
} else { | ||
console.log('[qiandao][suning] already signIn today.'); | ||
} | ||
}); | ||
} else { | ||
console.log('[qiandao][suning] not login yet.'); | ||
} | ||
}); | ||
|
||
}(window, document, Zepto); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters