/g, '>').replace(/"/g, '"');}function bka_ext_check(type) {var ext = ["image/jpg","image/jpeg","image/png","image/webp","image/gif"];return ext.indexOf(type);}function bka_scookie(name, value, expires, path, domain, secure) {var today = new Date();var expires_date = new Date(today.getTime() + (expires));var cookieString = name + '=' + encodeURIComponent(value) + ((expires) ? ';expires=' + expires_date.toGMTString() : '') + ((path) ? ';path=' + path : '') + ((domain) ? ';domain=' + domain : '') + ((secure) ? ';secure' : '');document.cookie = cookieString;}$.fn.extend({bka_insertText: function(myValue) {this.each(function() {if (document.selection) {this.focus();var sel = document.selection.createRange();sel.text = myValue;this.focus();} else if (this.selectionStart || this.selectionStart == '0') {var startPos = this.selectionStart;var endPos = this.selectionEnd;var scrollTop = this.scrollTop;this.value = this.value.substring(0, startPos) +myValue + this.value.substring(endPos,this.value.length);this.focus();this.selectionStart = startPos + myValue.length;this.selectionEnd = startPos + myValue.length;this.scrollTop = scrollTop;} else {this.value += myValue;this.focus();}});return this;}});function bka_insertHTML(text,id) {var sel, range, html;var sid = $(window.getSelection().baseNode).closest("#"+id).attr("id");if(sid != id){$("#"+id).focus();}if (window.getSelection){sel = window.getSelection();if (sel.getRangeAt && sel.rangeCount) {range = sel.getRangeAt(0);range.deleteContents();var el = document.createElement("div");el.innerHTML = text;var frag = document.createDocumentFragment(), node, lastNode;while ( (node = el.firstChild) ) {lastNode = frag.appendChild(node);}range.insertNode(frag);if (lastNode) {range = range.cloneRange();range.setStartAfter(lastNode);range.collapse(true);sel.removeAllRanges();sel.addRange(range);}}} else if (document.selection && document.selection.type != "Control") {document.selection.createRange().pasteHTML(text);}$("#"+id).focus();}function bka_gcookie(name) {var search = name + '=';var CookieString = document.cookie;var result = null;if (CookieString.length > 0) {offset = CookieString.indexOf(search);if (offset != -1) {offset += search.length;end = CookieString.indexOf(';', offset);if (end == -1) {end = CookieString.length}result = unescape(CookieString.substring(offset, end));}return result;}else{return "";}}(function($) { /* Source Check Typing Input from stackoverflow.com 995183*/$.fn.inputFilter = function(inputFilter) {return this.on("input keydown keyup mousedown mouseup select contextmenu drop", function() {if (inputFilter(this.value)) {this.oldValue = this.value;this.oldSelectionStart = this.selectionStart;this.oldSelectionEnd = this.selectionEnd;} else if (this.hasOwnProperty("oldValue")) {this.value = this.oldValue;this.setSelectionRange(this.oldSelectionStart, this.oldSelectionEnd);}});};}(jQuery));function bka_isEmail(email) {email = email.toLowerCase();if(email.indexOf("gmail.con") != -1 || email.indexOf("gmai.com") != -1 || email.indexOf("gnail.com") != -1 || email.indexOf("email.com") != -1 || email.indexOf("gmal.com") != -1 || email.split('@')[1]=="gmail.co" || email.split('@')[1]=="gmai.co"){return false;}var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;return regex.test(email);}function bka_vphone(phone){var n = phone.length;if(n>7 && n<=10){return phone.substring(0, 4)+"."+phone.substring(4, 7)+"."+phone.substring(7, n);}else if(n<=7 && n>4){return phone.substring(0, 4)+"."+phone.substring(4, n);}else{return phone;}}function bka_passtrong(pass,type){var number = /([0-9])/;var alphabets = /([a-zA-Z])/;var special_characters = /([~,!,@,#,$,%,^,&,*,-,_,+,=,?,>,<])/;if(pass.length<8){return type==1?"Mật khẩu không mạnh!":0;} else {if(pass.match(number) && pass.match(alphabets) && pass.match(special_characters)) {return type==1?"Mật khẩu rất tốt!":2;} else {return type==1?"Mật khẩu tốt!":1;}}}function bka_vpass(eid,id){var pass = $("#"+id).attr("type");if(pass=="password"){$("#"+id).attr("type","text");$("#"+eid).removeClass("userpro-icon-eye-slash").addClass("userpro-icon-eye")}else{$("#"+id).attr("type","password");$("#"+eid).removeClass("userpro-icon-eye").addClass("userpro-icon-eye-slash")}}function bka_logout(id){$.post("/bka-social.php", {action: "user-out"}, function(data){$("#"+id).html(data.rd); $("#bka-account-top").html(data.top);createCookie('slogin','0',60*60*24*15);}, "json");}function bka_e_connect_internet(){bka_alert("Lỗi kết nối mạng hoặc máy chủ vui lòng thử lại!",bka_forum_name)}function bka_update_photos_onpage(uid){var vs=Math.floor((Math.random() * 9999) + 1), img1 = "",img = "",p3=$(".userpro-pic"),p2=$("#bka-av-2"),p1=$("#bka-av-1");if(p1.length>0){p1.html(img)}if(p2.length>0){p2.html(img)}if(p3.length>0){p3.html(img1)}}function bka_subscribe_profile(uid){ uid = parseInt(uid); if(uid==0){bka_alert("Profile ID không đúng",bka_forum_name); return false;}var type = $("#sub_"+uid).hasClass("btn-sub")?0:1;$.post("/bka-social.php", {action: "subscribe-profile",uid:uid,type:type}, function(data){if(data.status=='1') {$("body").append(data.js)} else {bka_alert(data.mess,bka_forum_name)}}, "json").fail(function(xhr, status, error) {bka_e_connect_internet();});}function bka_alert_profile(type,list){$.post("/bka-social.php", {action: "alerts-profile",type:type}, function(data){if(data.status=='1') {$("body").append(data.js)} else {bka_alert(data.mess,bka_forum_name)} list.removeClass("bka-loading");}, "json").fail(function(xhr, status, error) {bka_e_connect_internet();list.removeClass("bka-loading");});}function bka_formatNumber(num) {return num.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1,')}function bka_like_photo(e,pid,type){var ck = $(e).attr("like"), a=$("#bka-like-photo-"+pid), like = parseInt(a.attr("like"));like++;if(ck==1){return false;}var likev=bka_formatNumber(like);$(e).attr("like",1); a.html(likev);$.post("/bka-social.php", {action: "post-like-photo",pid:pid,type:type}, function(data){if(data.status=='1') {var nlike = data.like;likev=bka_formatNumber(nlike);a.attr("like",nlike).html(likev);}else{if(data.mess!='') bka_alert(data.mess,bka_forum_name)}}, "json").fail(function(xhr, status, error) {bka_e_connect_internet();});}function bka_like(e,pid,type){var ck = $(e).attr("like"), a=$("#bka-like-"+pid), like = parseInt(a.attr("like"));like++;if(ck==1){return false;}var likev=bka_formatNumber(like);$(e).removeClass("color-333").addClass("bold color-blue").attr("like",1); a.html(likev);$.post("/bka-social.php", {action: "post-like",pid:pid}, function(data){if(data.status=='1') {if(data.like!='') {var nlike = data.like;likev=bka_formatNumber(nlike);a.attr("like",nlike).html(likev);}}else{if(data.mess!='') bka_alert(data.mess,bka_forum_name)}}, "json").fail(function(xhr, status, error) {bka_e_connect_internet();});}function bka_like_comment(e,pid,type){var ck = $(e).attr("like"), a=$("#bka-like-"+pid), like = parseInt(a.attr("like"));like++;if(ck==1){return false;}var likev=bka_formatNumber(like);$(e).addClass("bold color-blue").attr("like",1); a.html(likev);$.post("/bka-social.php", {action: "post-like-comment",pid:pid}, function(data){if(data.status=='1') {var nlike = data.like;likev=bka_formatNumber(nlike);a.attr("like",nlike).html(likev);}if(data.mess!='') bka_alert(data.mess,bka_forum_name)}, "json").fail(function(xhr, status, error) {bka_e_connect_internet();});}function bka_lightbox_init(){$('.os-lightbox-activator').magnificPopup({type: 'image',mainClass: 'mfp-with-zoom',zoom: {enabled: true,duration: 300,easing: 'ease-in-out',opener: function(openerElement) {return openerElement.is('img') ? openerElement : openerElement.find('img');}}});}function bka_version(){var s = document.createElement("script");s.type = "text/javascript";s.src = forum_dir+"bk-theme/js/bka-version.js";}$(document).ready(function(){ bka_version();$(".phone-call").click(function(){var a=$(this),b=a.attr("id"),p=a.text();if (typeof b !== typeof undefined && b !== false){var c= b.replace("phone-call-","");c = parseInt(c) || 0;if(c>0){$.post("/bka-social.php",{action: "phone-convertion",c:c,p:p}, function(data){$("body").append(data.js);}, "json").fail(function(xhr, status, error){bka_e_connect_internet();});}}});$(".bka-subscribe").click(function(){var id=$(this).attr("id"); id=id.replaceAll("sub_",""); bka_subscribe_profile(id);});$(".bka-action-alert").click(function(){var id = $(this).attr("id"),n="action_alert_"; id=id.replaceAll(n,"");var em = $("#"+n+id).find("em"),box=$("#"+n+id).find(".bka-list-alert"),list=$("#"+n+id).find(".bka-list-alerts");if(box.hasClass("hide")){box.removeClass("hide"); list.addClass("bka-loading"); bka_alert_profile(1,id,list);}else{box.removeClass("hide");}});$(".bka-comment-alert").click(function(){var id = $(this).attr("id"),n="comment_alert_"; id=id.replaceAll(n,"");var em = $("#"+n+id).find("em"),box=$("#"+n+id).find(".bka-list-alert"),list=$("#"+n+id).find(".bka-list-alerts");if(box.hasClass("hide")){box.removeClass("hide"); list.addClass("bka-loading"); bka_alert_profile(2,id,list);}else{box.removeClass("hide");}});$(".bka-btn-share").on("click", function(e){var pid=$(this).attr("pid"),t=$(this).attr("t");$(this).bka_sharePopup(e,pid,t);});});function bka_f_tx(id,type){var a=$("#"+id),o=$("#"+id+"-open"),c=$("#"+id+"-close");if(type==1){a.removeClass("hide");c.removeClass("hide");o.addClass("hide");}else{a.addClass("hide");c.addClass("hide");o.removeClass("hide");}}function bka_alert_close(){ $('.bka_overlay').remove(); $('#bka-dialog-main').remove(''); $("body").removeClass("ohidden");}function bka_warning(type){bka_alert("Bạn cần kích hoạt email tài khoản để sử dụng tính năng này. Để kích hoạt hãy vào đây để cài đặt và kích hoạt email.",bka_forum_name)}$.fn.bka_sharePopup = function (e,pid,type,intWidth, intHeight, blnResize) {e.preventDefault();intWidth = intWidth || "500";intHeight = intHeight || "400";strResize = (blnResize ? "yes" : "no");var url_share="", strTitle = ((typeof this.attr("title") !== "undefined") ? this.attr("title") : "Chia sẻ"),strParam = "width=" + intWidth + ",height=" + intHeight + ",resizable=" + strResize,a = $("#post-share-"+pid),t=a.attr("t"),d=a.attr("d"),l=a.attr("l"),tg=a.attr("tg"),cs=t+" "+tg+" "+l;if(type==1){url_share="https://www.facebook.com/sharer.php?u="+encodeURI(l);}else if(type==2){url_share="https://twitter.com/intent/tweet?text="+encodeURI(t+" "+tg)+"&url="+encodeURI(l)+"&related=&via=phongcachmoi.vn";}else if(type==3){var og_url=$("#og-image-url"),og_w=$("#og-image-width"),og_h=$("#og-image-height");if(og_url.length>0 && og_w.length>0 && og_h.length>0){i=og_url.attr("content");w=og_w.attr("content");h=og_h.attr("content"); url_share="https://www.pinterest.com/pin/create/bookmarklet/?url="+encodeURI(l)+"&media="+encodeURI(i)+"&h="+h+"&w="+w+"&description="+encodeURI(cs);}else{url_share="https://www.pinterest.com/pin/create/bookmarklet/?url="+encodeURI(l)+"&description="+encodeURI(t+" "+l+" "+tg);}}else if(type==4){url_share="https://www.tumblr.com/widgets/share/tool?posttype=link&canonicalUrl="+encodeURI(l)+"&title="+encodeURI(t)+"&caption="+encodeURI(t+" "+l+" "+tg)}else if(type==5){url_share="https://www.linkedin.com/sharing/share-offsite/?url="+l}objWindow = window.open(url_share, strTitle, strParam).focus();};function bka_random_list(id){$('#'+id).each(function(){var $ul = $(this),$liArr = $ul.children('li');$liArr.sort(function(a,b){var temp = parseInt( Math.random()*10 ),isOddOrEven = temp%2,isPosOrNeg = temp>5 ? 1 : -1;return( isOddOrEven*isPosOrNeg );}).appendTo($ul);});}(function(){var bka_autolink_url,slice=[].slice;bka_autolink_url = function() {var callback, k, linkAttributes, option, options, pattern, v;options = 1 <= arguments.length ? slice.call(arguments, 0) : [];pattern = /(^|[\s\n]|<[A-Za-z]*\/?>)((?:https?|ftp):\/\/[\-A-Z0-9+\u0026\u2019@#\/%?=()~_|!:,.;]*[\-A-Z0-9+\u0026@#\/%=~()_|])/gi;if (!(options.length > 0)) {return this.replace(pattern, "$1$2");}option = options[0];callback = option["callback"];linkAttributes = ((function() {var results;results = [];for (k in option) {v = option[k];if (k !== 'callback') {results.push(" " + k + "='" + v + "'");}}return results;})()).join('');return this.replace(pattern, function(match, space, url) {var link;link = (typeof callback === "function" ? callback(url) : void 0) || (""+url+"");return "" + space + link;});};String.prototype['bka_autolink_url'] = bka_autolink_url;}).call(this);function bka_link_content(sbj){ /* bka_link_content("#abc") */$(sbj).each(function() {var that = $(this),text = that.html();that.html(text.bka_autolink_url({target:"_blank",rel:"nofollow",class:"alink"}));});}