Skip to content

Commit

Permalink
Merge pull request #196 from mashirozx/test-pull-193
Browse files Browse the repository at this point in the history
merge pull request #193
  • Loading branch information
mashirozx authored Mar 13, 2020
2 parents c0f0990 + 3f1bf94 commit 211bea9
Showing 1 changed file with 45 additions and 42 deletions.
87 changes: 45 additions & 42 deletions js/sakura-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -874,53 +874,56 @@ function getqqinfo() {
}
var emailAddressFlag = cached.filter('#email').val();
cached.filter('#author').on('blur', function () {
var qq = cached.filter('#author').val();
$.ajax({
type: 'get',
url: mashiro_option.qq_api_url + '?qq=' + qq + '&_wpnonce=' + Poi.nonce,
dataType: 'json',
success: function (data) {
cached.filter('#author').val(data.name);
cached.filter('#email').val($.trim(qq) + '@qq.com');
if (mashiro_option.qzone_autocomplete) {
cached.filter('#url').val('https://user.qzone.qq.com/' + $.trim(qq));
}
$('div.comment-user-avatar img').attr('src', 'https://q2.qlogo.cn/headimg_dl?dst_uin=' + qq + '&spec=100');
is_get_by_qq = true;
cached.filter('#qq').val($.trim(qq));
if (cached.filter('#qq').val()) {
$('.qq-check').css('display', 'block');
$('.gravatar-check').css('display', 'none');
}
setCookie('user_author', data.name, 30);
setCookie('user_qq', qq, 30);
setCookie('is_user_qq', 'yes', 30);
setCookie('user_qq_email', qq + '@qq.com', 30);
setCookie('user_email', qq + '@qq.com', 30);
emailAddressFlag = cached.filter('#email').val();
/***/
$('div.comment-user-avatar img').attr('src', data.avatar);
setCookie('user_avatar', data.avatar, 30);
},
error: function () {
cached.filter('#qq').val('');
$('.qq-check').css('display', 'none');
$('.gravatar-check').css('display', 'block');
$('div.comment-user-avatar img').attr('src', get_gravatar(cached.filter('#email').val(), 80));
setCookie('user_qq', '', 30);
setCookie('user_email', cached.filter('#email').val(), 30);
setCookie('user_avatar', get_gravatar(cached.filter('#email').val(), 80), 30);
/***/
cached.filter('#qq,#email,#url').val('');
if (!cached.filter('#qq').val()) {
var qq = cached.filter('#author').val(),
$reg = /^[1-9]\d{4,9}$/;
if ($reg.test(qq)) {
$.ajax({
type: 'get',
url: mashiro_option.qq_api_url + '?qq=' + qq + '&_wpnonce=' + Poi.nonce,
dataType: 'json',
success: function (data) {
cached.filter('#author').val(data.name);
cached.filter('#email').val($.trim(qq) + '@qq.com');
if (mashiro_option.qzone_autocomplete) {
cached.filter('#url').val('https://user.qzone.qq.com/' + $.trim(qq));
}
$('div.comment-user-avatar img').attr('src', 'https://q2.qlogo.cn/headimg_dl?dst_uin=' + qq + '&spec=100');
is_get_by_qq = true;
cached.filter('#qq').val($.trim(qq));
if (cached.filter('#qq').val()) {
$('.qq-check').css('display', 'block');
$('.gravatar-check').css('display', 'none');
}
setCookie('user_author', data.name, 30);
setCookie('user_qq', qq, 30);
setCookie('is_user_qq', 'yes', 30);
setCookie('user_qq_email', qq + '@qq.com', 30);
setCookie('user_email', qq + '@qq.com', 30);
emailAddressFlag = cached.filter('#email').val();
/***/
$('div.comment-user-avatar img').attr('src', data.avatar);
setCookie('user_avatar', data.avatar, 30);
},
error: function () {
cached.filter('#qq').val('');
$('.qq-check').css('display', 'none');
$('.gravatar-check').css('display', 'block');
setCookie('user_qq', '', 30);
$('div.comment-user-avatar img').attr('src', get_gravatar(cached.filter('#email').val(), 80));
setCookie('user_qq', '', 30);
setCookie('user_email', cached.filter('#email').val(), 30);
setCookie('user_avatar', get_gravatar(cached.filter('#email').val(), 80), 30);
/***/
cached.filter('#qq,#email,#url').val('');
if (!cached.filter('#qq').val()) {
$('.qq-check').css('display', 'none');
$('.gravatar-check').css('display', 'block');
setCookie('user_qq', '', 30);
$('div.comment-user-avatar img').attr('src', get_gravatar(cached.filter('#email').val(), 80));
setCookie('user_avatar', get_gravatar(cached.filter('#email').val(), 80), 30);
}
}
}
});
});
}
// $.ajax({
// type: 'get',
// url: mashiro_option.qq_avatar_api_url + '?type=getqqavatar&qq=' + qq,
Expand Down

0 comments on commit 211bea9

Please sign in to comment.