Hãy nhấn like ở mỗi chương để ủng hộ tinh thần các dịch giả bạn nhé!
0
Tặng phiếu
Chương trước
|
Chương tiếp
Bình luận truyện
var BASE_URL = jQuery('meta[name=baseURL]').attr('content');
function PrevChap() {
var current = jQuery('.middle-box li.active');
var current_id = parseInt(current.attr('title'));
if(current_id > 1){
var prev_id = current_id -1;
var url_link = jQuery('.link-chap-'+prev_id).attr('href');
window.location.href = url_link;
}
//
var prev = current.prev();
//
if(prev.length > 0){
//
var url_link = prev.children('a').attr('href');
//
window.location.href = url_link;
//
}
}
function NextChap(total) {
var current = jQuery('.middle-box li.active');
var current_id = parseInt(current.attr('title'));
total = parseInt(total);
var total_tmp = jQuery('.middle-box li:last').attr('title');
total_tmp = parseInt(total_tmp);
if(total_tmp > total){
total = total_tmp;
}
if(current_id
var next_id = current_id +1;
var url_link = jQuery('.link-chap-'+next_id).attr('href');
window.location.href = url_link;
}else{
if(jQuery('#panel-chap a').length > 0){
alert('Bạn đã đọc đến chương mới nhất');
}else{
alert('Đang lấy danh sách chương. Đạo hữu chờ chút nhé!');
}
}
//
var next = current.next();
//
if(next.length > 0){
//
var url_link = next.children('a').attr('href');
//
window.location.href = url_link;
//
}
}
function openTool(el){
if(jQuery(el).parent().hasClass('show-sub')){
closeTool();
}else {
jQuery('.li-control').removeClass('show-sub');
jQuery(el).parent().addClass('show-sub');
}
}
function closeTool(){
jQuery('.li-control').removeClass('show-sub');
saveSetting();
}
function changeTheme(name){
if(jQuery('.value-'+name).hasClass('active')){
}else {
jQuery('.theme-value').removeClass('active');
jQuery('.chapter-c .chapter-c-content').removeClass("theme-01");
jQuery('.chapter-c .chapter-c-content').removeClass("theme-02");
jQuery('.chapter-c .chapter-c-content').removeClass("theme-03");
jQuery('.chapter-c .chapter-c-content').removeClass("theme-04");
jQuery('.chapter-c .chapter-c-content').removeClass("theme-05");
jQuery('.chapter-c .chapter-c-content').removeClass("theme-06");
jQuery('.chapter-c .chapter-c-content').removeClass("theme-07");
jQuery('.chapter-c .chapter-c-content').addClass("theme-"+name);
jQuery('.value-'+name).addClass("active");
if(jQuery('.value-'+name).hasClass('value-07')){
jQuery('body').addClass('body-07');
jQuery('body').removeClass('body-06');
}else if(jQuery('.value-'+name).hasClass('value-06')){
jQuery('body').addClass('body-06');
jQuery('body').removeClass('body-07');
}else {
jQuery('body').removeClass('body-06');
jQuery('body').removeClass('body-07');
}
}
}
function saveSetting() {
var url = ' ';
jQuery.ajax({
url: url,
method: 'get',
data: {
theme_value : jQuery('.box-theme .theme-value.active').attr('ng-value'),
font_value : jQuery('.box-font .font-value.active').attr('ng-value'),
box_size : jQuery('.box-size .lang').text(),
box_width : jQuery('.box-width .lang').text(),
},
success: function(result){
console.log('done');
}
});
}
function changeFont(name){
if(jQuery('.value-'+name).hasClass('active')){
}else {
jQuery('.font-value').removeClass('active');
jQuery('.chapter-c').removeClass("palatino");
jQuery('.chapter-c').removeClass("times");
jQuery('.chapter-c').removeClass("arial");
jQuery('.chapter-c').removeClass("georgia");
jQuery('.chapter-c').addClass(name);
jQuery('.font-'+name).addClass("active");
}
}
function changeSize(flag){
var number = parseInt(jQuery('.box-size .lang').text());
if(flag){
if(number
number = number + 2;
}
}else{
if(number > 12){
number = number - 2;
}
}
jQuery('.box-size .lang').text(number);
jQuery('.chapter-c .box-chap').css('font-size',number+'px');
}
function changeWidth(flag){
var number = parseInt(jQuery('.box-width .lang').text());
var w_width = jQuery(window).width();
if(flag){
switch (number){
case 640: number = 800; break;
case 800: number = 900; break;
case 900: number = 900; break;
default: number = 900;break;
}
}else{
switch (number){
case 800: number = 640; break;
case 900: number = 800; break;
// case 1280: number = 900; break;
default: number = 640;break;
}
}
if(w_width 900){
number = 900;
}else{
jQuery('.chapter-c').removeClass('max900');
}
if(w_width 800){
number = 800;
}else{
jQuery('.chapter-c').removeClass('max800');
}
jQuery('.box-width .lang').text(number);
jQuery('.chapter-c').removeClass('w640');
jQuery('.chapter-c').removeClass('w800');
jQuery('.chapter-c').removeClass('w900');
jQuery('.chapter-c').removeClass('w1280');
jQuery('.chapter-c').addClass('w'+number);
resetConfigBox();
}
function likeChap(chap_id,story_id){
var url = ' '+'?chap_id='+chap_id+'&story_id='+story_id;
jQuery('.like-chap-'+chap_id).removeClass('active');
jQuery.ajax({url: url, success: function(result){
jQuery('.like-chap-'+chap_id).addClass(result);
var number = parseInt(jQuery('.like-chap-'+chap_id+' small').text());
if(jQuery('.like-chap-'+chap_id).hasClass('active')){
number = number+1;
}else {
number = number-1;
}
jQuery('.like-chap-'+chap_id+' small').text(number);
}});
}
window.onscroll = function(){
resetConfigBox();
}
function resetConfigBox(){
var offset_number = jQuery('.chapter-c').offset().top;
var chap_c_w = jQuery('.chapter-c').outerWidth();
if(jQuery(window).scrollTop() > offset_number){
jQuery('.left-control').css({
'top': '0px',
'margin-left':-chap_c_w/2-60+'px'
});
}else{
var value_off = offset_number -jQuery(window).scrollTop();
jQuery('.left-control').css({
'top': value_off+'px',
'margin-left':-chap_c_w/2-60+'px'
});
}
var off = jQuery('.left-control').offset().left;
jQuery('.max900').css({
//'margin-left':off/2+30+'px'
});
}
// Comment code
function loadMoreComment(el){
jQuery(el).addClass('hidden');
jQuery('.go-discuss img').removeClass('hidden');
var story_id = jQuery(el).attr('data-story');
var page = parseInt(jQuery(el).attr('data-page')) + 1;
var url = BASE_URL+ 'them-comment/'+story_id+'?page='+page+'&new_web=1';
jQuery.ajax({url: url, success: function(result){
jQuery('.user-discuss .discuss-list > ul').append(result);
jQuery(el).attr('data-page',page);
jQuery(el).removeClass('hidden');
jQuery('.go-discuss img').addClass('hidden');
}});
}
function readmore(el) {
var id = jQuery(el).attr('data-id');
jQuery('.cmt-'+id+' .read-only').addClass('hidden');
jQuery(el).addClass('hidden');
jQuery('.cmt-'+id+' .read-all').removeClass('hidden');
}
function openChilds(el) {
var id = jQuery(el).attr('data-id');
jQuery('#discuss-childs-'+id).removeClass('hidden');
}
function loadMoreChild(id){
if(!jQuery('.child-more-'+id).hasClass('active')){
jQuery('.child-more-'+id).addClass('active');
var page = jQuery(".comment-"+id+" #child-more").val();
page = parseInt(page);
var url = ' '+'?id='+id+'&page='+page;
jQuery.ajax({url: url, success: function(result){
jQuery(".comment-"+id+" #child-list").append(result);
jQuery(".comment-"+id+" #child-more").val(page+1);
jQuery('.child-more-'+id).removeClass('active');
}});
}
}
function changeText(el){
var text_box = jQuery(el).val();
text_box = text_box.trim();
var box_parr = jQuery(el).parent();
var btn = box_parr.find('button.btn-post');
if(text_box.length > 0){
btn.removeClass('disable');
btn.attr('disabled',false);
}else {
btn.addClass('disable');
btn.attr('disabled','disabled');
}
}
function auto_grow(element) {
element.style.height = "5px";
element.style.height = (element.scrollHeight)+"px";
}
function sendComment(el) {
var url = BASE_URL+'postComment';
var txt = jQuery('#form-comment textarea[name=comment]').val();
if(txt.length > 5){
jQuery('#form-comment button.btn-post').addClass('disable');
jQuery('#form-comment button.btn-post').attr('disabled',true);
jQuery('#form-comment textarea[name=comment]').val('');
var img = jQuery('#form-comment .comment-avatar img').attr('src');
var html = '' +
'' +
'' +
'' +
''+jQuery(el).attr("data-name")+''+jQuery(el).attr("data-rank")+'
'+
''+txt+'
'+
'0 hrs' +
'' +
'0 trả lời' +
' ' +
'' +
'0' +
''+
''+
'';
jQuery('.user-discuss .discuss-list > ul').prepend(html);
jQuery.ajax({
url: url,
data: {
'_token': jQuery('#form-comment input[name=_token]').val(),
'story_id': jQuery('#form-comment input[name=story_id]').val(),
'comment': txt,
'ajax': 1
},
method: 'post',
success: function (result) {
jQuery('#form-comment button.btn-post').removeClass('disable');
jQuery('#form-comment button.btn-post').attr('disabled',false);
reloadComments(jQuery('#form-comment input[name=story_id]').val());
}
});
}else {
alert('Bình luận tối thiểu 10 ký tự!');
}
}
function reloadComments(story_id) {
var url = BASE_URL+'them-comment/'+story_id+'?page=0&new_web=1';
jQuery.ajax({
url: url,
success: function (result) {
jQuery('.user-discuss .discuss-list > ul').html(result);
}
});
}
function writeReply(el) {
if(jQuery(el).attr('data-auth') == '1'){
var id = jQuery(el).attr('data-parent');
jQuery('.reply-'+id).removeClass('hidden');
jQuery(el).hide();
}else {
openLogin();
}
}
function sendReply(el) {
var id = jQuery(el).attr('data-reply');
var url = BASE_URL+'postReply';
var txt = jQuery('#reply-box-'+id+' textarea[name=comment]').val();
if(txt.length > 5){
jQuery('#reply-box-'+id+' button.btn-post').addClass('disable');
jQuery('#reply-box-'+id+' button.btn-post').attr('disabled',true);
jQuery('#reply-box-'+id+' textarea[name=comment]').val('');
var img = jQuery('#form-comment .comment-avatar img').attr('src');
var html = '' +
'' +
'' +
'' +
''+jQuery(el).attr("data-name")+''+jQuery(el).attr("data-rank")+'
'+
''+txt+'
'+
'0 hrs' +
'' +
'' +
'0' +
''+
''+
'';
jQuery('#discuss-childs-'+id+' > ul').append(html);
jQuery.ajax({
url: url,
data: {
'_token': jQuery('#reply-box-'+id+' input[name=_token]').val(),
'story_id': jQuery('#reply-box-'+id+' input[name=story_id]').val(),
'comment': txt,
'id_comment_parent':id,
'ajax': 1
},
method: 'post',
success: function (result) {
jQuery('#reply-box-'+id+' button.btn-post').removeClass('disable');
jQuery('#reply-box-'+id+' button.btn-post').attr('disabled',false);
}
});
}else{
alert('Bình luận tối thiểu 10 ký tự!');
}
}
function likeComment(el) {
var id = jQuery(el).attr('data-rid');
var url = BASE_URL+'likeComment?id='+id;
jQuery.ajax({
url: url,
success: function (result) {
var span = jQuery(el).children('span');
var number = parseInt(jQuery(span).text());
if(jQuery(el).hasClass('act')){
jQuery(el).removeClass('act');
jQuery(span).text(number-1);
}else {
jQuery(el).addClass('act');
jQuery(span).text(number+1);
}
}
});
}
function openComment(){
jQuery('#list-comment').removeClass('hidden');
}
function loadingComment(){
var url_comment = BASE_URL+'story/comments?story_id=1266&new_web=1';
jQuery.ajax({url: url_comment,
method:'get',
success: function(result){
jQuery('#list-comment-ul').html(result);
jQuery('.more-comment > a').removeClass('hidden');
jQuery('.more-comment > div.text-center').addClass('hidden');
}});
}
jQuery(document).ready(function(){
var w_width = jQuery(window).width();
if(w_width = 1000){
jQuery('.box-width .lang').text(900);
jQuery('.chapter-c').addClass('max900');
}else if(w_width
jQuery('.box-width .lang').text(800);
jQuery('.chapter-c').addClass('max800');
}
resetConfigBox();
loadingComment();
loadingChap();
show5chap();
});
jQuery(window).resize(function(){
resetConfigBox();
})
function loadingChap(){
var url = ' ';
jQuery.ajax({url: url,
method:'get',
success: function(result){
jQuery('#panel-chap').html(result);
jQuery('.bottom-box .box-content').show();
setInterval(function(){
var current = jQuery('.middle-box li.active');
var current_id = parseInt(current.attr('title'));
var total = parseInt('1489');
var total_tmp = jQuery('.middle-box li:last').attr('title');
total_tmp = parseInt(total_tmp);
if(total_tmp > total){
total = total_tmp;
}
// console.log(current_id);
if(current_id >= total || current_id