Chủ tịch nước Lương Cường cùng kiều bào dâng hương, thả cá chép tiễn ông Công, ông Táo, Thủ tướng Phạm Minh Chính chủ trì Lễ đón Thủ tướng Liên bang Nga, giao thông tại Hà Nội và TP Hồ Chí Minh chuyển biến tích cực sau Nghị định 168… là loạt ảnh ấn tượng tuần do PV Dân Việt ghi lại.
Xem chi tiết bài tại đây: Chủ tịch nước Lương Cường cùng kiều bào dâng hương, thả cá chép tiễn ông Công, ông Táo
Xem chi tiết bài tại đây: Hình ảnh Thủ tướng Phạm Minh Chính chủ trì Lễ đón Thủ tướng Liên bang Nga Mikhail Vladimirovich Mishustin
Xem chi tiết bài tại đây: Mặc trời “lạnh căm”, du khách vẫn đổ về đồi chè ở Đà Lạt chụp ảnh hoa mai anh đào
Xem chi tiết bài tại đây: Đào quất dịp Tết giá vài chục triệu đồng, người dân Buôn Ma Thuột thi nhau check-in bên chợ hoa
Xem chi tiết bài tại đây: Băng tuyết phủ trắng núi rừng Y Tý, du khách rủ nhau lên chụp ảnh, check-in
Xem chi tiết bài tại đây: Giao thông tại Hà Nội và TP Hồ Chí Minh chuyển biến tích cực sau Nghị định 168
Xem chi tiết bài tại đây: 7 hộ làm bánh khô mè ở Đà Nẵng nhộn nhịp vào vụ Tết
Xem chi tiết bài tại đây: Hành trình sóng lớn, đem Tết tới các đảo tiền tiêu của Tổ quốc
Xem chi tiết bài tại đây: Làng đào La Cả rực rỡ cuối năm, giá cao hơn do bão số 3
Xem chi tiết bài tại đây: Cuối tuần, người dân chen chúc đi mua sắm, đường phố ùn tắc triền miên
Xem chi tiết bài tại đây: Cận cảnh đôi linh vật Kim Tỵ và Ngân Tỵ mừng Tết Nguyên đán đẹp không tưởng ở TP.HCM
Xem chi tiết bài tại đây: Mãn nhãn với màn trình diễn âm thanh, ánh sáng hoành tráng bên hồ Tây
`);
}else{
if (window.confirm("Bạn muốn đăng xuất?")){
var el=$("#top-link-account");
// //el.find("a.first").html("")
// // .removeAttr("style");
el.find(".first").show();
el.find("a.second").html("");
el.find("a.second").removeAttr("data-out");
$('.comment-account').html(`
`);
deleteCookie('my_dv');
$("#_btn_logout").click();
}
}
}
function logout(){
if (window.confirm("Bạn muốn đăng xuất?")){
var el=$("#top-link-account");
// //el.find("a.first").html("")
// // .removeAttr("style");
el.find(".first").show();
el.find("a.second").html("");
el.find("a.second").attr("data-out","0");
$('.comment-account').html(`
Đăng ký
`);
deleteCookie('my_dv');
$("#_btn_logout").click();
}
}
function login(){
$("#_btn_logout").click();
$("#cmt_alert").html("Vui lòng đăng nhập hoặc đăng ký để gửi bình luận");
}
function register(){
$("#_btn_logout").click();
$('[data-target="signup"]').click();
fnCaptcha();
}
var aspCookie=null;
(runinit=window.runinit || []).push(function(){
if(lgGetCookie('my_dv')){
var user=JSON.parse(lgGetCookie('my_dv'));
if(user.name){
authLogin(user.name,true);
}
}
$('.btn-refresh').click(function(){
fnCaptcha();
});
$('.iconew-eye').click(function(){
$(this).toggleClass('closed');
var x=$(this).siblings('input')[0];
if (x.type==="password"){
x.type="text";
}else{
x.type="password";
}
});
function stripHtml(html){
var temporalDivElement=document.createElement("div");
temporalDivElement.innerHTML=html;
return temporalDivElement.textContent || temporalDivElement.innerText || "";
}
//---------------------User account
// 1. Hide login/logout button->in case API doesn't available, login/logout will not show + Init OAuth_v2
//$("#top-link-account").hide();
if (typeof gapi != "undefined") {
//window._cnnd.oauth.init();
console.log("login not available");
}
// 2. Remove excessive login/register form -> only 1 form available // no need
// 3. Callback functions
var fnPopupAction = function(id, alert, loginData) {
id = id.toLowerCase();
if (id == "close") {
$("#cmt-account-header .close").click();
return;
}
if (id == "info" && !window._isShowingInfo) {
$("#cmt-account-header .close").click();
return;
}
window._isShowingInfo = false;
if (loginData) {
$("#cmt-account-header [data-target]").hide();
$("#cmt-account-header [data-target].logged-in").show().first().click();
$("#cmt-account-header [data-info-name]").html(loginData.name || "Quý vị");
$("#cmt-account-header [data-info-email]").html(loginData.email ||
"<không xác định>");
} else {
$("#cmt-account-header [data-target]").hide();
$("#cmt-account-header [data-target].not-login").show().first().click();
$("#cmt-account-social").show();
}
setTimeout(function() {
$("#cmt-account-header > .wrapper").css("animation", "none");
}, 200);
$("#cmt-account-header").show();
$("#cmt-account-header input[type="password"]").val("");
$("#cmt-account-header [data-target="" + id + ""]").click();
$("body").css("overflow", "hidden");
$("#nav").removeClass("active");
$("#cmt_alert").html(alert || "Vui lòng đăng nhập hoặc đăng ký để gửi bình luận");
};
var accountMessageProcess = function(data) {
if (data.isLogged) {
fnPopupAction("info", "Vui lòng đăng nhập hoặc đăng ký để gửi bình luận", {
name: data.name,
email: data.email
});
} else {
fnPopupAction(data.act, data.alert || "Vui lòng đăng nhập hoặc đăng ký");
if (data.act == "close" && data.raw.Data && data.raw.Data.Approved) {
//window.alert("Đăng nhập thành công");
fnPopupAction("info", "Đăng nhập thành công", {
name: data.raw.Data.Name,
email: $("#_login_email").val() || $("#_sign_email").val()
});
}
}
};
// 5. Action functions -> bind event to form elements
var fnPopupBindAction = function() {
// Tab
$("#cmt-account-header [data-target]").on('click', function() {
$("#cmt-account-header [data-target], #cmt-account-header [data-tab]").removeClass(
"active");
$(this).addClass("active");
var tab = $("#cmt-account-header [data-tab='" + $(this).attr("data-target") + "']");
tab.addClass("active")
.find("input[type="text"], input[type="email"]").first().focus();
tab.find("input").keyup(function(event) {
if (event.keyCode === 13) {
tab.find(".btn.clickable").click();
}
});
fnCaptcha();
$("#cmt_alert").html("Vui lòng đăng nhập hoặc đăng ký để gửi bình luận");
});
$("#cmt-account-header .close").on('click', function() {
$("#cmt-account-header").hide();
$("#cmt-account-header > .wrap").removeAttr("style");
$("body").css("overflow", "unset");
fnCaptcha();
$("#cmt_alert").html("Vui lòng đăng nhập hoặc đăng ký để gửi bình luận");
});
// Reload Captcha
// $("#_reload_captcha").on('click', function () {
// fnCaptcha();
// });
// Btn Login
$("#comment-frame").on('click','#btn_login', function () {
$("#top-link-account .first").click();
});
$("#comment-frame").on('click','#btn_signup', function () {
$("#top-link-account .first").click();
$('[data-target="signup"]').click();
});
$("#_btn_login").on('click', function() {
$("#cmt_alert").html("Vui lòng đăng nhập hoặc đăng ký để gửi bình luận");
var email, password;
email = $("#_login_email").val();
password = $("#_login_password").val();
if (!/^[a-z0-9-_\.]+[@][0-9a-z-]+(\.[0-9a-z-]+)+$/ig.test(email) || password
.length \/?]/g;
if (!/^[a-z0-9-_\.]+[@][0-9a-z-]+(\.[0-9a-z-]+)+$/ig.test(email)) {
$("#cmt_alert").html("Email không hợp lệ");
return;
}
//if (name.length 20) {
// $("#cmt_alert").html("Họ tên không được quá 20 ký tự (Có thể để nickname thay thế)!");
// return;
//}
//if (format.test(name)) {
// $("#cmt_alert").html("Tên không được chứa ký tự đặc biệt!");
// return;
//}
if (password.length ")
// .removeAttr("style");
el.find("a.first").show();
el.find("a.second").html("");
$("#cmt-account-social").show();
});
// Header login/account_info
// Header login/account_info
$("#top-link-account .first").on('click', function() {
if ($("#top-link-account .second").attr("data-out")) {
$("#top-link-account .second").toggleClass("show");
} else {
fnPopupAction("login");
}
});
// Btn register/log_out
$("#top-link-account .second").on('click', function() {
if ($("#top-link-account .second").attr("data-out")) {
//$("#_btn_logout").click();
authLogin('my_dv',false);
} else {
fnPopupAction('signup');
}
//var el = $("#top-link-account");
//el.find("a.first").html("")
// .removeAttr("style");
//el.find("a.second").html("");
});
};
fnPopupBindAction();
//login Facebook
var otherLogin = {
init: function() {
var me = this;
//gapi.load('auth2', function () {
// gapi.auth2.init({
// client_id: '678720187862-08lendtdt5h3nr4j2he534p15b13aieg.apps.googleusercontent.com',
// scope: 'email profile',
// fetch_basic_profile: true
// });
//});
$("#cmt-account-social button[data-type]").on('click', function() {
me[$(this).attr("data-type")](function(response) {
$("#cmt-account-header .tabs .close, #cmt-account .tabs .close")
.click();
});
});
try {
fbClient.appId = '1304555827613749'; //'211029740744825';
fbClient.version = "v14.0";
fbClient.init();
setTimeout(FB.AppEvents.logPageView, 5000);
} catch (e) {
// ignore
}
},
loginFacebook: function(cb) {
var me = this;
function reloginFacebook(callback) {
FB.api('/me', {
fields: 'id,name,email'
}, function(profile) {
//console.debug(profile);
if (typeof callback === "function") callback(profile);
});
};
FB.login(function(response) {
if (response.authResponse) {
reloginFacebook(function(info) {
console.log(info);
info.social = "facebook";
info.accessToken = response.authResponse.accessToken;
var user = {
email: info.email,
name: info.name,
}
let now = new Date();
lgSetCookie('my_dv',JSON.stringify(user), new Date(now.getTime() + (30 * 12 * 60000)));
authLogin(user.name, true);
});
} else {
$("#cmt_alert").html(
"Bạn đã từ chối cấp quyền truy cập tài khoản Facebook");
}
}, {
scope: 'public_profile,email'
});
},
loginGoogle: function(callback) {
var me = this;
function callSocialApi(data, cb) {
data.social = "google";
var user = {
email: data.email,
name: data.name,
}
let now = new Date();
lgSetCookie('my_dv',JSON.stringify(user), new Date(now.getTime() + (30 * 12 * 60000)));
authLogin(user.name, true);
}
// API call for Google login
if (gapi.auth2.getAuthInstance().isSignedIn.get()) {
//console.debug('[VCC] GAPI Process');
var profile = gapi.auth2.getAuthInstance().currentUser.get().getBasicProfile();
//var id_token = gapi.auth2.getAuthInstance().currentUser.get().getAuthResponse().id_token;
var access_token = gapi.auth2.getAuthInstance().currentUser.get().getAuthResponse()
.access_token;
var params = {
id: profile.getId(),
name: profile.getName(),
email: profile.getEmail(),
accessToken: access_token
}
//console.log('params:', params);
callSocialApi(params, callback);
} else {
//console.debug('[VCC] GAPI Login');
gapi.auth2.getAuthInstance().signIn().then(
function(success) {
var profile = gapi.auth2.getAuthInstance().currentUser.get()
.getBasicProfile();
//var id_token = gapi.auth2.getAuthInstance().currentUser.get().getAuthResponse().id_token;
var access_token = gapi.auth2.getAuthInstance().currentUser.get()
.getAuthResponse().access_token;
var params = {
id: profile.getId(),
name: profile.getName(),
email: profile.getEmail(),
accessToken: access_token
}
//console.log('params:',params);
callSocialApi(params,callback);
},
function(error){
$("#cmt_alert").html(
"Bạn đã từ chối cấp quyền cho Báo Dân Việt truy cập tài khoản Google"
);
}
);
}
}
}
otherLogin.init();
});
Đăng ký