Schematic and Layout
DAM_Red_Rooster_schematic.pdf
CAD-Custom parts and enclosures
';
html += '
0 /' + commentObj.max_count + '
';
html += '
';
html += '
';
html += '
';
html += '
';
html += '
'+$('#ImgCountTips').val()+'
';
html += '
'+$('#ImgSizeTips').val()+'
';
html += '
'+$('#ImgTypeTips').val()+'
';
html += '
';
html += '
';
html += ' ' + $('#JsCancel').val() + ' ';
html += ' ' + $('#JsA15').val() + ' ';
html += '
';
html += '
';
html += '';
$('#div-three-' + id).children('div').append(html).show();
commentObj.fn_uploader(id);
}
},
//取消添加留言
fn_cancel_msg: function (obj) {
$(obj).parents('.js-son-comments').hide();
},
//删除自己的留言
fn_del_msg: function (level, id) {
if (!commentObj.isLogin) {
//弹出登录框
layerLogin();
return false;
}
layer.confirm($('#JsA10').val(), function (index) {
$.getJSON(commentObj.fn_del_comment_url(), { msgid: id }, function (res) {
if (res.result) {
if (level == 1) {
//if (ispage > 0)
// window.location.reload();
$('#li' + id).remove();
commentObj.fn_up_level_msg_cnt(level, id, -1);
}
else {
var obj = $('#' + (level == 1 ? 'li' : 'div-three-') + id);
var num = parseInt(obj.parents('li').find('b').text());
num += -1;
if (num < 0) {
num = 0;
}
var parobj = $('#div-three-' + id).parent();
obj.parents('li').find('b').text(num);
$('#div-three-' + id).remove();
if (parobj.find('.sub-comment').length > 0) {
} else {
parobj.parent().hide();
}
}
commentObj.fn_up_msg_cnt(-1);
layer.close(index);
}
else if (res.msg == "nothing") {
layer.alert("error");
return;
}
else if (res.msg == "havereply") {
layer.alert($('#JsA11').val());
return;
}
else {
layer.alert($('#JsA12').val());
return;
}
});
})
},
//更新留言数量
fn_up_msg_cnt: function (val) {
var num = parseInt($('#MsgCount').text());
num += parseInt(val);
if (num < 0) {
num = 0;
}
$('#MsgCount').text(num);
},
//更新留言数量level
fn_up_level_msg_cnt: function (level, id, val) {
var obj = $('#' + (level == 1 ? 'li' : 'div-three-') + id);
var num = parseInt(obj.parents('li').find('b').text());
num += parseInt(val);
if (num < 0) {
num = 0;
}
obj.parents('li').find('b').text(num);
},
fn_mark_comment: function (obj, islike, commentid) {
if (logintype != 1) {
layerLogin();
return;
}
$.getJSON($('#memberurl').val() + '/Project/CommentMark?callback=?', { id: commentObj.obj_id, ProjectType: commentObj.obj_type, isLike: islike, commentid: commentid }, function (res) {
if (res.result) {
var markCnt = parseInt($('#commentMarkCnt' + commentid).text());
if ($(obj).hasClass('active')) {
$(obj).removeClass('active');
if (islike) {
$('#commentMarkCnt' + commentid).text(markCnt - 1);
}
else {
$('#commentMarkCnt' + commentid).text(markCnt + 1);
}
}
else {
if ($(obj).parent().find('dl').hasClass('active')) {
if (islike) {
$('#commentMarkCnt' + commentid).text(markCnt + 2);
}
else {
$('#commentMarkCnt' + commentid).text(markCnt - 2);
}
$(obj).parent().find('dl').removeClass('active');
}
else {
if (islike) {
$('#commentMarkCnt' + commentid).text(markCnt + 1);
}
else {
$('#commentMarkCnt' + commentid).text(markCnt - 1);
}
}
$(obj).addClass('active');
}
}
else if (res.msg == "nologin") {
//弹出登录框
layerLogin();
} else
layer.alert("error");
});
},
//加载数据
fn_load_data: function (page) {
$('#commentload').show();
$.ajax({
url: commentObj.fn_get_comment_url(),
dataType: 'jsonp',
data: { objid: commentObj.obj_id, objtype: commentObj.obj_type, page: page },
success: function (jason) {
var totalpage = jason.TotalCount / 20;
if (totalpage % 1 > 0)
totalpage = parseInt(totalpage) + 1;
if (page >= totalpage) {
$('#commentviewmore').parent().remove();
} else {
$('#commentviewmore').parent().show();
}
if (jason.TotalCount > 0) {
page = jason.PageIndex;
var msgList = jason.DataList;
var html = '';
if (msgList && msgList.length > 0) {
for (var item in msgList) {
html += '';
}
$('#commentload').hide();
$('#comment_ul').append(html);
}
}
$('#commentload').hide();
},
error: function (xhr, status, error) {
$('#commentload').hide();
}
});
},
//保存数据
fn_save_msg: function (level, id) {
var msg = $('#msg-' + id).val();
var msgpic = commentObj.getPicImgArr(id);
if (msg && msg.length > 10000) {
$('#msg-' + id).addClass('form-error');
return false;
}
else if (msg && msg.length > 0) {
//msg = commentObj.convertToHTMLFn(msg);
}
if ((msg && msg.length > 0) || msgpic.length > 4) {
$('body').addClass('global-loading');
$.ajax({
url: commentObj.fn_save_comment_url(),
//dataType: 'jsonp',
type: 'POST',
data: { msg: msg, replyid: id, objid: commentObj.obj_id, msgpic: msgpic, objtype: commentObj.obj_type, isproject: commentObj.is_project },
crossDomain: true,
xhrFields: {
withCredentials: true
},
success: function (res) {
if (res.result) {
//if (ispage > 0) {
// window.location.reload();
// return;
//}
//js加载,不刷新页面,增强体验
$('#msg-' + id).val("");
if (level == 1) {
$('.js-add-comment .js-words').css({ 'color': '#999' }).text(0);
} else {
$('#msg-' + id).next().find('.js-words').css({ 'color': '#999' }).text(0);
}
if (level == 1) {
$('#js-views-example' + id).html("");
//第一级留言(直接回复文章)
var objtype = parseInt($('#hidobjtype').val());
var html = '';
$('#comment_ul').prepend(html);
commentObj.fn_up_msg_cnt(1);
//commentObj.fn_up_level_msg_cnt(1, res.msg.Id, 1);
//if (ispage == 0)
// $("html,body").animate({ scrollTop: $("#li" + res.msg.Id).offset().top - 70 }, 1000);
}
else {
$('#js-views-example' + res.msg.Id).html("");
//第二级留言(回复第一级留言)
var html = '';
if (level == 3) {
//第三级留言(回复第二级留言)
commentObj.fn_add_reply(3, id);
$('#div-three-' + id).parent('div').append(html);
}
else {
commentObj.fn_add_reply(2, id);
$('#div-two-' + id).show().children('div').append(html);
}
commentObj.fn_up_msg_cnt(1);
commentObj.fn_up_level_msg_cnt(level, res.msg.Id, 1);
}
commentObj.fn_uploader(id);
$('#error-tips').hide();
$('#msg-' + id).removeClass('form-error');
$('#error-tips-img' + id).hide();
$('#error-tips-img-size' + id).hide();
$('#error-tips-img-type' + id).hide();
}
else if (res.msg == "nologin") {
//弹出登录框
layerLogin();
}
else {
layer.alert("error", { icon: 2, title: 'message' }, function () { { window.location.href = "/project/question/"; } });
}
$('body').removeClass('global-loading');
},
error: function (xhr, status, error) {
if (xhr.status == 403) {
layer.alert("Amazon Firewall Warning: 403 Forbidden - Content may contain sensitive or dangerous words.");
}
$('body').removeClass('global-loading');
}
});
} else {
$('#msg-' + id).addClass('form-error');
if (!$('#msg-' + id).hasClass('js-mention'))
$('#error-tips').show().Shake(4, 10);
return false;
}
},
//上传文件
fn_uploader: function (id) {
/*上传文件开始*/
var uploader = WebUploader.create({
// 选完文件后,是否自动上传。
auto: true,
// swf文件路径
swf: '/img/js/jqueryplus/webuploader-0.1.5/Uploader.swf',
// 文件接收服务端。
server: '/Common/UpFile',
// 选择文件的按钮。可选。
// 内部根据当前运行是创建,可能是input元素,也可能是flash.
pick: { id: '#msgFile' + id, multiple: false },
fileVal: 'FileData',
fileNumLimit: 5,
fileSingleSizeLimit: '2097152',//'10485760',5242880,2097152
accept: {
title: 'File',
extensions: 'bmp,png,gif,jpg,jpeg',
mimeTypes: 'image/*'
},
'formData': { 'uptype': "blogfile", 'key': "", 'checkcode': "", "getjson": true },
});
uploader.on('beforeFileQueued', function (file) {
$('#error-tips').hide();
$('#msg-' + id).removeClass('form-error');
$('#error-tips-img' + id).hide();
$('#error-tips-img-type' + id).hide()
$('#error-tips-img-size' + id).hide()
});
uploader.on('uploadStart', function (file, percentage) {
if (logintype != 1) {
layerLogin();
return;
}
$("#progress-box" + id).show();
});
uploader.on('uploadProgress', function (file, percentage) {
$('.progress').attr('data-percent', parseInt(percentage * 80))
});
uploader.on('uploadSuccess', function (file, data) {
if (data.state === "SUCCESS") {
var tempImg = '
';
tempImg += '
';
tempImg += '
';
tempImg += '
';
$('#js-views-example' + id).show().append(tempImg)
}
$('.progress').attr('data-percent', parseInt(0))
$("#progress-box" + id).hide();
// 上传图预览
$(document).on('click', '.js-views-example .del-pic', function () {
var fileid = $(this)[0].id;
var file = uploader.getFile(fileid)
if (file) {
uploader.removeFile(file, true); // 删除文件
}
$(this).parent().remove();
$('#error-tips').hide();
$('#msg-' + id).removeClass('form-error');
$('#error-tips-img' + id).hide();
$('#error-tips-img-size' + id).hide();
$('#error-tips-img-type' + id).hide();
})
});
uploader.on('error', function (str) {
if (str == "Q_EXCEED_NUM_LIMIT") {
$('#error-tips-img' + id).show().Shake(4, 10);
}
else if (str == "Q_TYPE_DENIED") {
$('#error-tips-img-type' + id).show().Shake(4, 10);
}
else if (str == "F_EXCEED_SIZE") {
$('#error-tips-img-size' + id).show().Shake(4, 10);
}
setTimeout(function () {
$('#error-tips-img' + id).hide();
$('#error-tips-img-size' + id).hide();
$('#error-tips-img-type' + id).hide();
}, 3000);
});
/*上传文件结束*/
},
// 文本域转html
convertToHTMLFn: function (text) {
return text.replace(/\n/g, '
').replace(/ /g, ' ');
},
getPicImgArr: function (id) {
var imgpicarr = [];
$("img[name='pig-img" + id + "']").each(function (i, e) {
imgpicarr.push(e.src);
})
return imgpicarr.length > 0 ? imgpicarr.join(',') : "";
}
}
commentObj.fn_init();
-->